diff --git a/.gitattributes b/.gitattributes index a2aa278207e8cbcaecca63f9bfd17022782994e3..5ec31e681da8ca244e3654cdfd07056645f07524 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2160,3 +2160,91 @@ staff-app/assets/assets/brand/williewastles-hero.b9d53d27b66f903b5618a7177b2ffad staff-app/assets/assets/brand/williewastles.055a77893ced99bf3a6c5402ba5baac6.png filter=lfs diff=lfs merge=lfs -text staff-app/assets/assets/brand/yasmins-hero.a5aef62e37dfcecbe0afc056186f4ad9.png filter=lfs diff=lfs merge=lfs -text staff-app/assets/assets/brand/yasmins.8482602e9f0a965655924835625cb02b.png filter=lfs diff=lfs merge=lfs -text +wildings/chef-app/assets/assets/brand/drunkencoo-hero.65c21c4da9e466cf4bffc969639a1427.png filter=lfs diff=lfs merge=lfs -text +wildings/chef-app/assets/assets/brand/drunkencoo.f6d92af3b14e4205a3deaf4434754c51.png filter=lfs diff=lfs merge=lfs -text +wildings/chef-app/assets/assets/brand/mrbasrais-hero.4ce74641cfcf52d099157c84005b9d2a.png filter=lfs diff=lfs merge=lfs -text +wildings/chef-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png filter=lfs diff=lfs merge=lfs -text +wildings/chef-app/assets/assets/brand/rupeeroom-hero.969fa372add526aaacf3a6c009b8ac92.png filter=lfs diff=lfs merge=lfs -text +wildings/chef-app/assets/assets/brand/rupeeroom.689e6fb536dc0845eeb174a1ec7bd346.png filter=lfs diff=lfs merge=lfs -text +wildings/chef-app/assets/assets/brand/smokinggoat-hero.0588f17ef0eed7f757f22916cd4d37db.png filter=lfs diff=lfs merge=lfs -text +wildings/chef-app/assets/assets/brand/smokinggoat.20a3a1970596ab43c5d6468d4ed549a7.png filter=lfs diff=lfs merge=lfs -text +wildings/chef-app/assets/assets/brand/williewastles-hero.b9d53d27b66f903b5618a7177b2ffad4.png filter=lfs diff=lfs merge=lfs -text +wildings/chef-app/assets/assets/brand/williewastles.055a77893ced99bf3a6c5402ba5baac6.png filter=lfs diff=lfs merge=lfs -text +wildings/chef-app/assets/assets/brand/yasmins-hero.a5aef62e37dfcecbe0afc056186f4ad9.png filter=lfs diff=lfs merge=lfs -text +wildings/chef-app/assets/assets/brand/yasmins.8482602e9f0a965655924835625cb02b.png filter=lfs diff=lfs merge=lfs -text +wildings/customer-app/assets/assets/brand/drunkencoo-hero.65c21c4da9e466cf4bffc969639a1427.png filter=lfs diff=lfs merge=lfs -text +wildings/customer-app/assets/assets/brand/drunkencoo.f6d92af3b14e4205a3deaf4434754c51.png filter=lfs diff=lfs merge=lfs -text +wildings/customer-app/assets/assets/brand/mrbasrais-hero.4ce74641cfcf52d099157c84005b9d2a.png filter=lfs diff=lfs merge=lfs -text +wildings/customer-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png filter=lfs diff=lfs merge=lfs -text +wildings/customer-app/assets/assets/brand/rupeeroom-hero.969fa372add526aaacf3a6c009b8ac92.png filter=lfs diff=lfs merge=lfs -text +wildings/customer-app/assets/assets/brand/rupeeroom.689e6fb536dc0845eeb174a1ec7bd346.png filter=lfs diff=lfs merge=lfs -text +wildings/customer-app/assets/assets/brand/smokinggoat-hero.0588f17ef0eed7f757f22916cd4d37db.png filter=lfs diff=lfs merge=lfs -text +wildings/customer-app/assets/assets/brand/smokinggoat.20a3a1970596ab43c5d6468d4ed549a7.png filter=lfs diff=lfs merge=lfs -text +wildings/customer-app/assets/assets/brand/williewastles-hero.b9d53d27b66f903b5618a7177b2ffad4.png filter=lfs diff=lfs merge=lfs -text +wildings/customer-app/assets/assets/brand/williewastles.055a77893ced99bf3a6c5402ba5baac6.png filter=lfs diff=lfs merge=lfs -text +wildings/customer-app/assets/assets/brand/yasmins-hero.a5aef62e37dfcecbe0afc056186f4ad9.png filter=lfs diff=lfs merge=lfs -text +wildings/customer-app/assets/assets/brand/yasmins.8482602e9f0a965655924835625cb02b.png filter=lfs diff=lfs merge=lfs -text +wildings/display-app/assets/assets/brand/drunkencoo-hero.65c21c4da9e466cf4bffc969639a1427.png filter=lfs diff=lfs merge=lfs -text +wildings/display-app/assets/assets/brand/drunkencoo.f6d92af3b14e4205a3deaf4434754c51.png filter=lfs diff=lfs merge=lfs -text +wildings/display-app/assets/assets/brand/mrbasrais-hero.4ce74641cfcf52d099157c84005b9d2a.png filter=lfs diff=lfs merge=lfs -text +wildings/display-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png filter=lfs diff=lfs merge=lfs -text +wildings/display-app/assets/assets/brand/rupeeroom-hero.969fa372add526aaacf3a6c009b8ac92.png filter=lfs diff=lfs merge=lfs -text +wildings/display-app/assets/assets/brand/rupeeroom.689e6fb536dc0845eeb174a1ec7bd346.png filter=lfs diff=lfs merge=lfs -text +wildings/display-app/assets/assets/brand/smokinggoat-hero.0588f17ef0eed7f757f22916cd4d37db.png filter=lfs diff=lfs merge=lfs -text +wildings/display-app/assets/assets/brand/smokinggoat.20a3a1970596ab43c5d6468d4ed549a7.png filter=lfs diff=lfs merge=lfs -text +wildings/display-app/assets/assets/brand/williewastles-hero.b9d53d27b66f903b5618a7177b2ffad4.png filter=lfs diff=lfs merge=lfs -text +wildings/display-app/assets/assets/brand/williewastles.055a77893ced99bf3a6c5402ba5baac6.png filter=lfs diff=lfs merge=lfs -text +wildings/display-app/assets/assets/brand/yasmins-hero.a5aef62e37dfcecbe0afc056186f4ad9.png filter=lfs diff=lfs merge=lfs -text +wildings/display-app/assets/assets/brand/yasmins.8482602e9f0a965655924835625cb02b.png filter=lfs diff=lfs merge=lfs -text +wildings/owner-app/assets/assets/brand/drunkencoo-hero.65c21c4da9e466cf4bffc969639a1427.png filter=lfs diff=lfs merge=lfs -text +wildings/owner-app/assets/assets/brand/drunkencoo.f6d92af3b14e4205a3deaf4434754c51.png filter=lfs diff=lfs merge=lfs -text +wildings/owner-app/assets/assets/brand/mrbasrais-hero.4ce74641cfcf52d099157c84005b9d2a.png filter=lfs diff=lfs merge=lfs -text +wildings/owner-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png filter=lfs diff=lfs merge=lfs -text +wildings/owner-app/assets/assets/brand/rupeeroom-hero.969fa372add526aaacf3a6c009b8ac92.png filter=lfs diff=lfs merge=lfs -text +wildings/owner-app/assets/assets/brand/rupeeroom.689e6fb536dc0845eeb174a1ec7bd346.png filter=lfs diff=lfs merge=lfs -text +wildings/owner-app/assets/assets/brand/smokinggoat-hero.0588f17ef0eed7f757f22916cd4d37db.png filter=lfs diff=lfs merge=lfs -text +wildings/owner-app/assets/assets/brand/smokinggoat.20a3a1970596ab43c5d6468d4ed549a7.png filter=lfs diff=lfs merge=lfs -text +wildings/owner-app/assets/assets/brand/williewastles-hero.b9d53d27b66f903b5618a7177b2ffad4.png filter=lfs diff=lfs merge=lfs -text +wildings/owner-app/assets/assets/brand/williewastles.055a77893ced99bf3a6c5402ba5baac6.png filter=lfs diff=lfs merge=lfs -text +wildings/owner-app/assets/assets/brand/yasmins-hero.a5aef62e37dfcecbe0afc056186f4ad9.png filter=lfs diff=lfs merge=lfs -text +wildings/owner-app/assets/assets/brand/yasmins.8482602e9f0a965655924835625cb02b.png filter=lfs diff=lfs merge=lfs -text +wildings/staff-app/assets/assets/brand/drunkencoo-hero.65c21c4da9e466cf4bffc969639a1427.png filter=lfs diff=lfs merge=lfs -text +wildings/staff-app/assets/assets/brand/drunkencoo.f6d92af3b14e4205a3deaf4434754c51.png filter=lfs diff=lfs merge=lfs -text +wildings/staff-app/assets/assets/brand/mrbasrais-hero.4ce74641cfcf52d099157c84005b9d2a.png filter=lfs diff=lfs merge=lfs -text +wildings/staff-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png filter=lfs diff=lfs merge=lfs -text +wildings/staff-app/assets/assets/brand/rupeeroom-hero.969fa372add526aaacf3a6c009b8ac92.png filter=lfs diff=lfs merge=lfs -text +wildings/staff-app/assets/assets/brand/rupeeroom.689e6fb536dc0845eeb174a1ec7bd346.png filter=lfs diff=lfs merge=lfs -text +wildings/staff-app/assets/assets/brand/smokinggoat-hero.0588f17ef0eed7f757f22916cd4d37db.png filter=lfs diff=lfs merge=lfs -text +wildings/staff-app/assets/assets/brand/smokinggoat.20a3a1970596ab43c5d6468d4ed549a7.png filter=lfs diff=lfs merge=lfs -text +wildings/staff-app/assets/assets/brand/williewastles-hero.b9d53d27b66f903b5618a7177b2ffad4.png filter=lfs diff=lfs merge=lfs -text +wildings/staff-app/assets/assets/brand/williewastles.055a77893ced99bf3a6c5402ba5baac6.png filter=lfs diff=lfs merge=lfs -text +wildings/staff-app/assets/assets/brand/yasmins-hero.a5aef62e37dfcecbe0afc056186f4ad9.png filter=lfs diff=lfs merge=lfs -text +wildings/staff-app/assets/assets/brand/yasmins.8482602e9f0a965655924835625cb02b.png filter=lfs diff=lfs merge=lfs -text +williewastles/chef-app/assets/assets/brand/abbotsford-hero.78fcb8ee06ee22c4ca659c9254db7512.png filter=lfs diff=lfs merge=lfs -text +williewastles/chef-app/assets/assets/brand/abbotsford.b26602bba5ce4969733c5422a45ad053.png filter=lfs diff=lfs merge=lfs -text +williewastles/chef-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png filter=lfs diff=lfs merge=lfs -text +williewastles/chef-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png filter=lfs diff=lfs merge=lfs -text +williewastles/chef-app/assets/assets/brand/drunkencoo-hero.65c21c4da9e466cf4bffc969639a1427.png filter=lfs diff=lfs merge=lfs -text +williewastles/chef-app/assets/assets/brand/drunkencoo.f6d92af3b14e4205a3deaf4434754c51.png filter=lfs diff=lfs merge=lfs -text +williewastles/chef-app/assets/assets/brand/greenside-hero.1caec5a6cb939434cccb5f3a613b50f8.png filter=lfs diff=lfs merge=lfs -text +williewastles/chef-app/assets/assets/brand/kirkmichael-hero.63b13cde7fd82eb622622b39ac80c394.png filter=lfs diff=lfs merge=lfs -text +williewastles/chef-app/assets/assets/brand/kirkmichael.63b13cde7fd82eb622622b39ac80c394.png filter=lfs diff=lfs merge=lfs -text +williewastles/chef-app/assets/assets/brand/kirkton-hero.9d0837b292c2f4f30f4521d806bb28c3.png filter=lfs diff=lfs merge=lfs -text +williewastles/chef-app/assets/assets/brand/kirkton.bcf8d846df4861474d224a7a77f498fb.png filter=lfs diff=lfs merge=lfs -text +williewastles/chef-app/assets/assets/brand/mrbasrais-hero.4ce74641cfcf52d099157c84005b9d2a.png filter=lfs diff=lfs merge=lfs -text +williewastles/chef-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png filter=lfs diff=lfs merge=lfs -text +williewastles/chef-app/assets/assets/brand/rupeeroom-hero.969fa372add526aaacf3a6c009b8ac92.png filter=lfs diff=lfs merge=lfs -text +williewastles/chef-app/assets/assets/brand/rupeeroom.689e6fb536dc0845eeb174a1ec7bd346.png filter=lfs diff=lfs merge=lfs -text +williewastles/chef-app/assets/assets/brand/smokinggoat-hero.0588f17ef0eed7f757f22916cd4d37db.png filter=lfs diff=lfs merge=lfs -text +williewastles/chef-app/assets/assets/brand/smokinggoat.20a3a1970596ab43c5d6468d4ed549a7.png filter=lfs diff=lfs merge=lfs -text +williewastles/chef-app/assets/assets/brand/souters.f4c58d9349b6e1700fe5abcc9e9b665c.png filter=lfs diff=lfs merge=lfs -text +williewastles/chef-app/assets/assets/brand/wildings-hero-logo-text.4661e4b935726f2511f9c17a1567c89a.png filter=lfs diff=lfs merge=lfs -text +williewastles/chef-app/assets/assets/brand/wildings.076f4fcd06d19a0af0205c410f461b14.png filter=lfs diff=lfs merge=lfs -text +williewastles/chef-app/assets/assets/brand/williewastles-hero.b9d53d27b66f903b5618a7177b2ffad4.png filter=lfs diff=lfs merge=lfs -text +williewastles/chef-app/assets/assets/brand/williewastles.055a77893ced99bf3a6c5402ba5baac6.png filter=lfs diff=lfs merge=lfs -text +williewastles/chef-app/assets/assets/brand/yasmins-hero.a5aef62e37dfcecbe0afc056186f4ad9.png filter=lfs diff=lfs merge=lfs -text +williewastles/chef-app/assets/assets/brand/yasmins.8482602e9f0a965655924835625cb02b.png filter=lfs diff=lfs merge=lfs -text +williewastles/chef-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf filter=lfs diff=lfs merge=lfs -text +williewastles/chef-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf filter=lfs diff=lfs merge=lfs -text +williewastles/chef-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf filter=lfs diff=lfs merge=lfs -text +williewastles/chef-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf filter=lfs diff=lfs merge=lfs -text diff --git a/wildings/chef-app/_expo/static/js/web/index-4a8e84fd487a5f2cafba4c6915cad230.js b/wildings/chef-app/_expo/static/js/web/index-4a8e84fd487a5f2cafba4c6915cad230.js new file mode 100644 index 0000000000000000000000000000000000000000..2a2b9f322d22e0ff8fa09bd34e741dc187543dfc --- /dev/null +++ b/wildings/chef-app/_expo/static/js/web/index-4a8e84fd487a5f2cafba4c6915cad230.js @@ -0,0 +1,37 @@ +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return l}});var n=r(d[0]);r(d[1]);var t=r(d[2]),s=r(d[3]),u=r(d[4]),c=r(d[5]);function l(){return(0,t.canShow)('display')?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(s.DisplayBoard,{}),(0,c.jsx)(u.DisplayPairing,{})]}):(0,c.jsx)(n.Redirect,{href:t.ENTRY[t.APP_VARIANT]})}},796,[804,30,806,876,911,24]); +__d(function(_g,_r,_i,_a,m,_e2,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"EDIT_IDLE_MS",{enumerable:!0,get:function(){return ke}}),_e2.DisplayBoard=function({embedded:e=!1}={}){const{width:d,height:R}=(0,M.default)(),me=d<700,xe=d>=R,ve=!me&&xe&&d>=600,Be=ve,Me=Math.round(Math.min(520,Math.max(240,.3*d))),ze=w.default.useRef(null),Le=w.default.useRef(0),[Pe,Re]=(0,j.useState)({w:0,h:0}),We=(0,A.useOwner)(e=>e.site),He=(0,H.useRestaurant)(We);(0,re.useAlertWatcher)(We,{enabled:!e}),(0,p.useSoldOutLink)(!1,void 0,!e);const Oe=(0,H.useOrders)(We),Ae=(0,H.useBookings)(We),Ee=(0,H.useEvents)(We),Ne=(0,H.useStore)(e=>e.skipMinutes),_e=(0,H.useStore)(e=>e.clock.mode),Fe=(0,H.useNow)(5e3),Ve=(0,A.useOwner)(e=>e.staff),Ge=(0,A.useOwner)(e=>e.attendance),Ue=(0,A.useOwner)(e=>e.shifts);w.default.useEffect(()=>{(0,N.ensureAttendance)((0,W.ymd)(Fe),Fe)},[(0,W.ymd)(Fe)]);const qe=Ge.filter(e=>e.in&&!e.out&&Fe.getTime()-new Date(e.in).getTime()<72e6&&Fe.getTime()>=new Date(e.in).getTime()),Ke=De(Ve.find(e=>e.id===qe[0]?.staffId)?.name)||'Duty Manager',Ye=(0,W.ymd)(Fe),Qe=(0,D.useTravelDay)('display',Ye),Je=(0,E.useFrontDoor)(Ye,xe),Xe=(0,_.useDisplaySettings)(We),Ze=Xe.privacy,et=(0,_.usePlan)(We),tt=(0,_.useFloor)(e=>e.live[We]),st=(0,de.useBlocks)(e=>e.blocks),[lt,ot]=(0,j.useState)('plan'),[it,at]=(0,j.useState)('all'),[nt,rt]=(0,j.useState)(null),[dt,ct]=(0,j.useState)(null),[ut,ht]=(0,j.useState)(null),[gt,bt]=(0,j.useState)(!1),[yt,pt]=(0,j.useState)(!1),[mt,xt]=(0,j.useState)(null),[ft,jt]=(0,j.useState)(!1),[wt,kt]=(0,j.useState)(!1),[Dt,It]=(0,j.useState)(null),[vt,St]=(0,j.useState)(null),[Tt,Ct]=(0,j.useState)(null),$t=w.default.useRef(0),Bt=e=>{$t.current=Date.now(),Ct(e)};w.default.useEffect(()=>{if(!Tt)return;const e=setInterval(()=>{Date.now()-$t.current>=he.DAY_IDLE_MS&&Ct(null)},5e3);return()=>clearInterval(e)},[Tt]);const Mt=(0,H.useWaitlist)(We),zt=(0,H.useStore)(e=>e.walkIns[We]??0),[Lt,Pt]=(0,j.useState)(!1),[Rt,Wt]=(0,j.useState)(null);w.default.useEffect(()=>{Rt&&((0,x.notify)({id:`floor-note:${Date.now()}`,title:Rt,timeoutMs:4500,big:!0,testID:'floor-toast'}),Wt(null))},[Rt]),w.default.useEffect(()=>{if(!e)return(0,I.setDisplaySilent)(!0),()=>(0,I.setDisplaySilent)(!1)},[e]);const[Ht,Ot]=(0,j.useState)(null),At=w.default.useRef(0),[Et,Nt]=(0,j.useState)(null);w.default.useEffect(()=>{if(!Ht)return;At.current=Date.now();const e=setInterval(()=>{const e=Date.now()-At.current;if(e>=ke)return Ot(null),void Wt('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');Nt(e>=105e3?Math.ceil((ke-e)/1e3):null)},1e3);return()=>clearInterval(e)},[Ht]);const _t=e=>e.date!==Ye?ht({title:`Guest details \xb7 ${(0,he.dayWord)(e.date,Ye)} ${e.time}`,body:(0,we.jsx)(we.Fragment,{children:(0,oe.bookingDetails)(e)})}):ht({title:`Guest details \xb7 ${e.time}`,body:(0,we.jsxs)(we.Fragment,{children:[(0,we.jsx)($e,{rid:We,id:e.id,turnBase:He.settings.turnMins}),e.walkIn?null:(0,we.jsx)(L.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{ht(null),xt(e.id)},style:{minHeight:56}}),(0,oe.bookingDetails)(e)]})}),Ft=Ae.filter(e=>e.date===Ye).sort((e,t)=>e.time.localeCompare(t.time)),Vt=Ft.filter(e=>!['cancelled','noshow'].includes(e.status)),Gt=Vt.reduce((e,t)=>e+t.partySize,0),Ut=Oe.filter(Ie).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),qt=(0,j.useMemo)(()=>(0,n.forecastToday)(He,Ae,Oe,Ee,Fe),[He,Ae,Oe,Ee,Fe.getTime()/6e4|0]),Kt=(0,de.closedAreasAt)(st,We,Ye,(0,W.hm)(Fe)),Yt=[...Kt].join(','),Qt=(0,j.useMemo)(()=>(0,F.floorView)(et,Ae,Oe,tt??{},Fe,He.settings.turnMins,Kt),[et,Ae,Oe,tt,Fe.getTime(),Yt]),Jt=(0,le.hoursFor)(He,Fe),Xt=Jt?.open??new Date(`${Ye}T12:00:00`),Zt=Jt?.close??new Date(`${Ye}T21:00:00`),es=(0,W.addMins)(Xt,-Xt.getMinutes()),ts=(0,W.addMins)(Zt,90),ss=e=>new Date(`${Ye}T${e}:00`),ls=(0,de.blocksOn)(st,We,Ye).map(e=>({from:ss(e.from),to:ss(e.to),label:e.reason??'Paused'})).concat((0,l.queuedServicePauses)(He,Fe,Ye)),os=Object.keys(Qt).filter(e=>'blocked'===Qt[e]?.status),is=Tt&&Tt!==Ye?Tt:Ye,as=is!==Ye,ns=(0,he.dayWord)(is,Ye),rs=/^(Today|Yesterday|Tomorrow)$/.test(ns),ds=as?(0,he.bookingsForDay)(Ae,is,Ye).sort((e,t)=>e.time.localeCompare(t.time)):Ft,cs=(0,W.parseYmd)(is);cs.setHours(12);const us=as?(0,le.hoursFor)(He,cs):Jt,hs=us?.open??new Date(`${is}T12:00:00`),gs=us?.close??new Date(`${is}T21:00:00`),bs=e=>new Date(`${is}T${e}:00`),ys=[...as?(0,de.blocksOn)(st,We,is).map(e=>({from:bs(e.from),to:bs(e.to),label:e.reason??'Paused'})):ls,...as?(0,l.queuedServicePauses)(He,cs,is):[]],ps=(0,l.queuedServiceSessions)(He,cs),ms=t.IS_QUEUED_VENUE&&(void 0===ps||!ps.length),xs=(0,we.jsxs)(B.default,{testID:"queued-hours-gate",style:[be.look.panel,{padding:14,gap:8}],children:[(0,we.jsx)(L.T,{weight:"semibold",children:void 0===ps?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,we.jsx)(L.Muted,{children:s.queuedVenues[We]?.hours.note})]}),fs=as?us||ds.length?isas?(0,F.dayFloorView)(et,ds,is):Qt,[as,et,ds,is,Qt]),[ws,ks]=(0,j.useState)(null),Ds=as?ds.filter(e=>!['cancelled','noshow'].includes(e.status)):Vt,Is=Ds.reduce((e,t)=>e+t.partySize,0),vs=!qt.example&&qt.open&&qt.enough&&qt.restOfDay.high>0?`Usual for a ${Fe.toLocaleDateString('en-GB',{weekday:'long'})}: about ${(0,n.coversRange)(Math.round((qt.restOfDay.low+qt.restOfDay.high)/2),Math.round((qt.restOfDay.low+qt.restOfDay.high)/2))} more`:void 0,Ss=async(e,t)=>{const s=Qt[e]?.booking;if(!s||e===t)return;const l=Qt[t]?.status;if(l&&!['free','soon'].includes(l))return void Wt('dirty'===l?`${(0,a.tableNumbers)(t)} needs clearing first.`:`${(0,a.tableNumbers)(t)} is ${F.STATUS[l].label.toLowerCase()}. Pick a free table.`);await H.repo.bookings.update(s.id,{table:t});const o=tt?.[e]?.stage;_.useFloor.getState().setLive(We,t,{stage:o??'seated',dirty:!1}),_.useFloor.getState().setLive(We,e,{stage:void 0,dirty:!0}),Wt(`${(0,J.privName)(s,Ze)} moved ${(0,a.tableNumbers)(e)} \u2192 ${t}. ${(0,a.tableNumbers)(e)} needs clearing.`)},Ts=vt?Ae.find(e=>e.id===vt.id):void 0,Cs=vt&&Ts?(()=>{const e=Ts.walkIn?(0,J.privName)(Ts,Ze):De(Ts.name),t=(0,se.seatsOf)(et,vt.tables).total,s=(0,se.seatLine)(t,Ts.partySize),l=(0,se.pickClashes)(Ts,vt.tables,Ae.filter(e=>e.date===Ts.date),He.settings.turnMins),o=(0,se.tableKey)(vt.tables)!==(0,se.tableKey)((0,_.tablesOf)(Ts.table));return(0,we.jsxs)(B.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:O.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:O.colours.gold,padding:10},children:[(0,we.jsxs)(B.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,he.dayWord)(Ts.date,Ye)} ${Ts.time}. Tap tables on the plan to add or take them off. ${(0,se.tablesWords)(vt.tables)}. ${s.text}.${l.length?` ${l.length} clash${1===l.length?'':'es'} with other bookings.`:''}`,children:[(0,we.jsxs)(L.T,{size:17,weight:"semibold",colour:O.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,he.dayWord)(Ts.date,Ye)," ",Ts.time]}),(0,we.jsxs)(L.T,{size:16,colour:O.colours.text,children:[(0,se.tablesWords)(vt.tables)," \xb7 ",s.text,l.length?` \xb7 ${[...new Set(l.map(e=>(0,a.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),(0,we.jsxs)(L.Row,{gap:8,wrap:!0,children:[(0,we.jsx)(L.Button,{testID:"plan-pick-save",label:l.length?'Save anyway':'Save tables',disabled:!o,style:{minHeight:56},accessibilityLabel:`${l.length?'Save anyway':'Save'}, ${(0,se.tablesWords)(vt.tables)} for ${e}. ${s.text}.`,onPress:async()=>{await(0,te.saveBookingTables)(We,Ts,vt.tables),Wt((0,se.savedWords)(e,Ts.partySize,vt.tables,t)),St(null)}}),(0,we.jsx)(L.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>St(null)})]})]})})():null,$s=et.areas.filter(e=>et.tables.some(t=>t.areaId===e.id)),Bs=e=>{const t=et.tables.filter(t=>t.areaId===e);return as?`${t.filter(e=>!js[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(Qt[e.name]?.status??'free')).length}/${t.length} free`},Ms='all'===it||$s.some(e=>e.id===it)?it:'all',zs=e=>(0,we.jsx)(V.FloorCanvas,{plan:et,areaId:e,mode:"live",fit:"contain",crop:!0,fill:ve,big:!0,view:js,privacy:Ze,turnBase:He.settings.turnMins,highlight:vt?vt.tables:dt?[dt]:void 0,onTap:e=>{return t=e.name,void(vt?St(e=>e?{...e,tables:(0,se.toggleTable)(e.tables,t)}:e):as?ks(t):dt?(t!==dt&&Ss(dt,t),ct(null)):rt(t));var t},onDrop:(e,t)=>vt||as?void 0:Ss(e.name,t.name)}),Ls=me?1:xe||$s.length>2?2:1,Ps=e=>{const t=et.tables.filter(t=>t.areaId===e);if(!t.length)return.5;const s=Math.max(...t.map(e=>e.x+e.w))-Math.min(...t.map(e=>e.x))+92;return(Math.max(...t.map(e=>e.y+e.h))-Math.min(...t.map(e=>e.y))+92)/s},Rs=[];for(let e=0;e<$s.length;e+=Ls)Rs.push($s.slice(e,e+Ls));const Ws=ve?(0,G.venueGrid)($s.map(e=>{const t=(0,V.areaBounds)(et,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,V.minReadableScale)(et,e.id)}}),Pe.w,Pe.h):null,Hs=e=>(0,we.jsxs)(L.Row,{style:{justifyContent:'space-between',height:G.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,we.jsxs)(L.T,{size:14,weight:"semibold",colour:(0,O.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,U.areaMarks)(e)]}),Kt.has(e.id)?(0,we.jsx)(L.T,{size:13,weight:"semibold",colour:O.colours.blue,children:"Closed for weather"}):(0,we.jsx)(L.T,{size:13,colour:O.colours.muted,children:Bs(e.id)})]}),Os=(0,we.jsx)(B.default,{testID:"venue-grid",style:{flex:1,minHeight:0},onLayout:e=>{const{width:t,height:s}=e.nativeEvent.layout;(Math.abs(t-Pe.w)>1||Math.abs(s-Pe.h)>1)&&Re({w:t,h:s})},children:Ws?(0,we.jsx)($.default,{style:{flex:1},scrollEnabled:Ws.scroll,showsVerticalScrollIndicator:Ws.scroll,contentContainerStyle:{gap:G.GRID_GAP},children:Ws.rows.map((e,t)=>(0,we.jsx)(B.default,{style:{height:Ws.rowHeights[t],flexDirection:'row',gap:G.GRID_GAP},children:e.map(e=>{const t=$s.find(t=>t.id===e);return(0,we.jsxs)(B.default,{testID:`area-cell-${e}`,style:{width:Ws.cellW,gap:2},children:[Hs(t),(0,we.jsx)(B.default,{style:{flex:1},children:zs(e)})]},e)})},t))}):null}),As=(0,we.jsxs)(B.default,{testID:"venue-plan",style:{flex:me?void 0:1,gap:10,minWidth:0},children:[(0,we.jsx)(i.TableNumberWarning,{plan:et}),et.tables.length?null:(0,we.jsxs)(B.default,{testID:"venue-plan-pending",style:{flex:1,justifyContent:'center',alignItems:'center',gap:8,padding:24},children:[(0,we.jsx)(L.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,we.jsx)(L.Muted,{center:!0,children:"Waiting for the venue\u2019s real table plan. No sample tables have been added."})]}),(()=>{const e=[(0,we.jsx)(Te,{label:"Whole venue",selected:'all'===Ms,onPress:()=>at('all')},"__all"),...$s.map(e=>(0,we.jsx)(Te,{label:`${e.name}${(0,U.areaMarks)(e)}`,colour:(0,O.brandColour)(e.colour),sub:Kt.has(e.id)?'closed':Ms===e.id?Bs(e.id):void 0,selected:Ms===e.id,onPress:()=>at(e.id)},e.id))];return me?(0,we.jsx)(B.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8},children:e}):ve&&R<500||!ve&&d<900?(0,we.jsx)($.default,{horizontal:!0,showsHorizontalScrollIndicator:!1,style:{flexGrow:0},contentContainerStyle:{gap:6},children:e}):(0,we.jsx)(L.Row,{wrap:!0,gap:8,children:e})})(),(0,we.jsx)(r.FloorLegend,{}),Cs,dt?(0,we.jsxs)(L.Row,{gap:8,style:{backgroundColor:O.colours.goldTint,borderRadius:10,padding:8},children:[(0,we.jsxs)(L.T,{weight:"semibold",colour:O.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,a.tableNumbers)(dt),": tap the new table."]}),(0,we.jsx)(L.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>ct(null)})]}):null,'all'===Ms&&ve?Os:'all'===Ms?(0,we.jsx)(B.default,{style:{flex:me?void 0:1,gap:12,minHeight:Be?void 0:360},children:Rs.map((e,t)=>(0,we.jsxs)(B.default,{style:{flex:me?void 0:Math.max(.3,...e.map(e=>Ps(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,we.jsxs)(B.default,{style:{flex:1,gap:2},children:[me?(0,we.jsxs)(B.default,{style:{alignItems:'center',gap:4},children:[(0,we.jsxs)(L.T,{center:!0,size:18,weight:"semibold",colour:(0,O.brandColour)(e.colour),children:[e.name,(0,U.areaMarks)(e)]}),Kt.has(e.id)?(0,we.jsx)(L.T,{center:!0,size:14,weight:"semibold",colour:O.colours.blue,children:"Closed for weather"}):(0,we.jsx)(L.Muted,{center:!0,children:Bs(e.id)})]}):(0,we.jsxs)(L.Row,{style:{justifyContent:'space-between'},children:[(0,we.jsxs)(L.T,{size:14,weight:"semibold",colour:(0,O.brandColour)(e.colour),children:[e.name,(0,U.areaMarks)(e)]}),Kt.has(e.id)?(0,we.jsx)(L.T,{size:13,weight:"semibold",colour:O.colours.blue,children:"Closed for weather"}):(0,we.jsx)(L.Muted,{children:Bs(e.id)})]}),(0,we.jsx)(B.default,{style:me?{height:Math.max(280,Math.round((d-40)*Ps(e.id)))}:{flex:1},children:zs(e.id)})]},e.id)),e.length{if(as)return void It(e.id);const t=(0,_.tablesOf)(e.table)[0];t&&Qt[t]?rt(t):_t(e)}},is)}),Ns='timeline'===lt,_s=as?(0,we.jsxs)(B.default,{testID:"display-day-bar",style:{flexDirection:'row',alignItems:'center',gap:10,marginBottom:8,padding:8,paddingLeft:12,borderRadius:12,borderWidth:1,borderColor:O.colours.gold,backgroundColor:O.colours.goldTint},children:[(0,we.jsxs)(B.default,{style:{flex:1,minWidth:0},accessible:!0,accessibilityRole:"header",accessibilityLabel:`Showing ${rs?`${ns}, `:''}${(0,he.dayLong)(is)}. Guests, table plan, Timeline and Covers are for that day.`,children:[(0,we.jsxs)(L.T,{size:18,weight:"semibold",colour:O.colours.goldLight,children:["Showing ",rs?`${ns} \xb7 `:'',(0,he.dayLong)(is)]}),(0,we.jsx)(L.T,{size:14,colour:O.colours.text,children:"Guests, table plan, Timeline and Covers are for this day."})]}),(0,we.jsx)(L.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{St(null),Bt(null)},style:{minHeight:56}})]}):null,Fs=(0,we.jsx)(B.default,{accessibilityRole:"tablist",style:{flexDirection:'row',borderRadius:15,padding:4,gap:4,borderWidth:1,borderColor:'rgba(255,255,255,0.08)',backgroundColor:'rgba(255,255,255,0.035)',alignSelf:me?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,s,l])=>{const o='timeline'===e===Ns;return(0,we.jsx)(C.default,{testID:l,accessibilityRole:"tab",accessibilityLabel:s,accessibilityState:{selected:o},onPress:()=>ot(e),style:{flex:me?1:void 0,minHeight:me?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:o?O.colours.gold:'transparent',...be.look.web(o?{backgroundImage:t.IS_ISOLATED_VENUE?'none':'linear-gradient(180deg, #DDB671 0%, #C29550 100%)',boxShadow:t.IS_ISOLATED_VENUE?'0 4px 12px rgba(0,0,0,0.3)':'0 1px 0 rgba(255,255,255,0.3) inset, 0 4px 12px rgba(207,164,95,0.22)'}:{})},children:(0,we.jsx)(L.T,{size:me?16:13,weight:"semibold",colour:o?'#16120B':'#BDB5A6',children:s})},e)})}),Vs=e=>(0,we.jsxs)(we.Fragment,{children:[(0,we.jsx)(ye.BigAction,{premium:!0,label:"Walk-in",onPress:Je.openWalkIn,testID:"add-walkin",block:e,size:"s"}),(0,we.jsx)(ye.BigAction,{premium:!0,label:"New booking",onPress:Je.openBooking,testID:"add-booking",block:e,size:"s"}),(0,we.jsx)(ye.BigAction,{premium:!0,label:"Edit booking",onPress:()=>pt(!0),testID:"display-edit-booking",block:e,size:"s"})]});(0,je.useDisplayNotices)(We,!e);const Gs=(0,we.jsxs)(B.default,{testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||g.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)})},style:{flexDirection:'row',flexWrap:d>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:me?12:6,justifyContent:me?'center':void 0,borderTopWidth:1,borderTopColor:O.colours.hairline,backgroundColor:(0,o.soutersSurface)('#0D0D0C')},children:[e?null:(0,we.jsx)(fe.DisplayClockButton,{}),et.areas.some(e=>e.outdoor)?(0,we.jsx)(ce.CloseGardenButton,{rid:We,r:He,now:Fe,by:Ke,quiet:!0,short:!0}):null,(0,we.jsx)(ce.BlockBookingsButton,{rid:We,r:He,now:Fe,by:Ke,quiet:!0,display:!0}),(0,we.jsx)(K.HoldToEdit,{quiet:!0,onUnlock:()=>{Nt(null),Ot({at:Date.now()})},onHint:()=>Wt('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,we.jsx)(h.GiftQrButton,{rid:We,venue:He.name}),e?null:(0,we.jsx)(b.ExitButton,{})]}),Us=Ut.length?(0,we.jsxs)(B.default,{testID:"takeaway-panel",style:[be.look.panel,{overflow:'hidden'}],children:[(0,we.jsxs)(L.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,we.jsx)(L.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,we.jsxs)(L.T,{size:12,colour:O.colours.muted,children:[Ut.length," live"]})]}),(0,we.jsx)(B.default,{style:{padding:10},children:(0,we.jsx)(Ce,{list:Ut,me:Ke,compact:!0,bookings:Ae})})]}):null,qs=(ge.DueToday,as?ds:Ft.filter(e=>'confirmed'===e.status||'seated'===e.status).sort((e,t)=>e.time.localeCompare(t.time))),Ks=as?rs?`${ns}\u2019s guests`:`Guests ${ns}`:'Today\u2019s guests',Ys=(0,we.jsxs)(we.Fragment,{children:[0===qs.length?(0,we.jsx)(L.Muted,{children:as?is{const t=(0,X.guestRowText)(e,{name:e.walkIn?(0,J.privName)(e,Ze):(e.name??'').replace(' (example)',''),seated:'seated'===e.status&&!as});return(0,we.jsxs)(C.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:t.a11y,accessibilityHint:as?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{kt(!1),It(e.id)},style:({pressed:e})=>({minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:O.colours.hairline,backgroundColor:e?O.colours.tilePressed:'transparent'}),children:[(0,we.jsxs)(B.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,we.jsx)(L.T,{size:18,weight:"semibold",colour:O.colours.gold,style:{width:58},children:t.time}),(0,we.jsx)(L.T,{size:18,weight:"semibold",testID:"guest-row-name",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:t.name})]}),(0,we.jsxs)(L.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,we.jsx)(L.T,{size:16,colour:O.colours.text,children:t.people}),t.deposit?(0,we.jsx)(L.T,{size:16,colour:O.colours.muted,children:" \xb7 "}):null,t.deposit?(0,we.jsx)(L.T,{size:16,weight:"semibold",colour:t.depositWarn?O.colours.amber:O.colours.goldLight,testID:`display-deposit-${e.id}`,children:t.deposit}):null,(0,we.jsx)(L.T,{size:16,colour:O.colours.muted,children:" \xb7 "}),(0,we.jsx)(L.T,{size:16,colour:'No table yet'===t.table?O.colours.muted:O.colours.text,children:t.table}),t.dog?(0,we.jsx)(L.T,{size:16,children:" "}):null,t.dog?(0,we.jsx)(B.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,we.jsx)(Z.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]})]},e.id)})]}),Qs=(0,we.jsx)($.default,{testID:"display-guest-list",accessibilityLabel:Ks,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:Ys}),Js=T.default.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>12&&Math.abs(t.dx)>Math.abs(t.dy),onPanResponderRelease:(e,t)=>{t.dx<-40&&kt(!1)}}),Xs=(0,we.jsxs)(C.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${Ks}, ${qs.length}`,accessibilityState:{expanded:wt},'aria-expanded':wt,onPress:()=>kt(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:wt?O.colours.gold:O.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?O.colours.tilePressed:wt?O.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,we.jsx)(L.T,{size:16,weight:"bold",colour:O.colours.gold,children:qs.length}),(0,we.jsx)(B.default,{style:{width:44,height:150,alignItems:'center',justifyContent:'center'},children:(0,we.jsx)(B.default,{style:{position:'absolute',width:150,height:44,left:-53,top:53,alignItems:'center',justifyContent:'center',transform:[{rotate:'-90deg'}]},children:(0,we.jsxs)(L.T,{size:13,weight:"semibold",colour:O.colours.goldLight,numberOfLines:1,children:[Ks," ",wt?'\u2039':'\u203a']})})})]}),Zs=wt?(0,we.jsxs)(B.default,{style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:40,flexDirection:'row'},children:[(0,we.jsxs)(B.default,{testID:"guests-drawer",...Js.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*d)),backgroundColor:O.colours.surface,borderRightWidth:1,borderColor:O.colours.gold,borderRadius:14,...be.look.web({boxShadow:'6px 0 24px rgba(0,0,0,0.5)'})},children:[(0,we.jsxs)(L.Row,{style:{justifyContent:'space-between',paddingHorizontal:12,paddingTop:10},children:[(0,we.jsxs)(L.T,{size:17,weight:"semibold",colour:O.colours.gold,style:{flex:1,flexWrap:'wrap'},children:[Ks.toUpperCase()," (",qs.length,")"]}),(0,we.jsx)(C.default,{accessibilityRole:"button",accessibilityLabel:`Close ${Ks}`,onPress:()=>kt(!1),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,we.jsx)(L.T,{size:18,colour:O.colours.muted,children:"\u2715"})})]}),Qs]}),(0,we.jsx)(C.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${Ks}`,accessibilityRole:"button",onPress:()=>kt(!1),style:{flex:1}})]}):null,el=ms?xs:t.IS_KIRKTON&&!Object.values(He.kitchenHours??{}).some(Boolean)?(0,we.jsxs)(B.default,{testID:"kirkton-hours-to-confirm",style:[be.look.panel,{padding:14,gap:8}],children:[(0,we.jsx)(L.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,we.jsx)(L.Muted,{children:"No service hours have been set for this venue."})]}):(0,we.jsx)(ue.DayGraph,{todays:ds,open:hs,close:gs,now:Fe,turnBase:He.settings.turnMins,pauses:ys,compact:me,height:me?180:Math.round(Math.min(130,Math.max(90,.13*R))),forecastNote:as?void 0:vs,emptyText:fs,past:is{as?kt(!0):ot('timeline')},ol=(0,we.jsxs)(B.default,{style:{flex:1,flexDirection:'row',padding:12,paddingTop:10,gap:12,minHeight:0},children:[Qe?null:Xs,(0,we.jsxs)(B.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[Qe?null:_s,Qe?(0,we.jsx)($.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,we.jsx)(D.DayView,{rid:We,day:Qe,today:Ye,app:"display"})}):Ns?Es:As,Zs]}),(0,we.jsxs)(B.default,{testID:"display-side",style:{width:Me,gap:10,minHeight:0},children:[(0,we.jsx)(B.default,{testID:"primary-actions",style:{flexDirection:'row',gap:8},children:Vs(!1)}),Fs,(0,we.jsxs)($.default,{testID:"display-side-scroll",style:{flex:1},contentContainerStyle:{gap:10,paddingBottom:6},children:[Us,(0,we.jsx)(ce.BlocksBanner,{rid:We,now:Fe,big:!0,by:Ke})]}),Qe?null:sl,Qe?null:tl,Qe?null:(0,we.jsx)(B.default,{testID:"covers-dock",children:(0,we.jsx)(k.CoversToday,{rid:We,day:is,sound:(0,I.flapSoundOn)(),onPress:ll})})]})]}),il=(xe&&Math.round(Math.min(160,Math.max(105,.16*R))),d<1180),al=xe&&d>=900;return(0,we.jsxs)(z.SafeAreaView,{style:{flex:1,backgroundColor:O.colours.bg},onTouchStart:()=>{$t.current=Date.now()},onMouseDown:()=>{$t.current=Date.now()},children:[me?(0,we.jsxs)(B.default,{style:{flex:1},children:[(0,we.jsxs)($.default,{ref:ze,testID:"phone-dashboard-scroll",style:{flex:1},contentContainerStyle:{padding:12,gap:16,paddingBottom:24,width:'100%',maxWidth:700,alignSelf:'center'},children:[(0,we.jsxs)(B.default,{testID:"display-header",style:{alignItems:'center',gap:8,paddingVertical:12},children:[(0,we.jsx)(P.RestaurantLogo,{rid:We,size:64}),(0,we.jsx)(L.T,{center:!0,size:24,weight:"semibold",accessibilityRole:"header",children:He.name}),(0,we.jsx)(P.PoweredBy,{}),(0,we.jsx)(f.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,we.jsx)(B.default,{accessible:!0,accessibilityLabel:`Current time ${(0,W.hm)(Fe)}`,children:(0,we.jsx)(L.T,{center:!0,size:30,weight:"semibold",colour:O.colours.goldLight,children:(0,W.hm)(Fe)})}),(0,we.jsx)(pe.ShellfishChip,{rid:We,by:Ke,app:"display",size:"m"})]}),(0,we.jsx)(B.default,{testID:"phone-glance",style:{width:'100%'},children:(0,we.jsx)(Se,{phone:!0,items:[{label:'Tables',value:Ds.length,testID:'badge-tables'},{label:'Covers',value:Is,testID:'badge-covers'},{label:'Takeaway',value:Ut.length,alert:Ut.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>bt(!0)}]})}),(0,we.jsx)(B.default,{testID:"primary-actions",style:{gap:8},children:Vs(!0)}),(0,we.jsx)(ce.BlocksBanner,{rid:We,now:Fe,big:!0,by:Ke}),sl,Fs,(0,we.jsx)(B.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:Ns?Es:As}),(0,we.jsxs)(B.default,{onLayout:e=>{Le.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[be.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,we.jsxs)(L.T,{center:!0,size:20,weight:"semibold",colour:O.colours.goldLight,accessibilityRole:"header",children:[Ks," (",qs.length,")"]}),(0,we.jsx)(B.default,{testID:"display-guest-list",accessibilityLabel:Ks,style:{gap:4},children:Ys})]}),Us,tl,(0,we.jsx)(B.default,{testID:"covers-dock",children:(0,we.jsx)(k.CoversToday,{rid:We,day:is,compact:!0,sound:(0,I.flapSoundOn)(),onPress:()=>ze.current?.scrollTo({y:Le.current,animated:!0})})}),(0,we.jsxs)(B.default,{testID:"phone-display-settings",style:{gap:8,alignItems:'center'},children:[(0,we.jsx)(L.T,{center:!0,size:14,colour:Ze?O.colours.muted:O.colours.amber,children:Ze?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,we.jsx)(L.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>Pt(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),Gs]}),e?null:(0,we.jsx)(B.default,{testID:"phone-voice-footer",style:{alignItems:'center',paddingVertical:6,borderTopWidth:1,borderColor:O.colours.hairline},children:(0,we.jsx)(S.VoiceSlot,{size:56})})]}):(0,we.jsxs)(we.Fragment,{children:[(0,we.jsxs)(B.default,{testID:"display-header",style:{flexDirection:'row',flexWrap:al?'nowrap':'wrap',alignItems:'center',paddingHorizontal:d>=1e3?18:14,paddingVertical:R<500?3:8,gap:il?10:14,minHeight:R<500?46:60,backgroundColor:(0,o.soutersSurface)('#0D0D0C'),...be.look.web({backgroundImage:t.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,we.jsx)(B.default,{style:{flexShrink:1,minWidth:0},children:(0,we.jsx)(P.RestaurantBrand,{rid:He.id,size:30})}),(0,we.jsx)(f.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),d>=1e3?(0,we.jsx)(B.default,{style:{width:1,height:26,backgroundColor:'rgba(255,255,255,0.08)'}}):null,(0,we.jsxs)(B.default,{style:{flexDirection:'row',alignItems:'baseline',gap:10},children:[(0,we.jsx)(L.T,{size:26,weight:"semibold",colour:O.colours.goldLight,style:{letterSpacing:.5,lineHeight:32},children:(0,W.hm)(Fe)}),R>=500&&!il?(0,we.jsx)(L.T,{size:14,colour:O.colours.muted,children:(0,W.niceDate)(Fe)}):null]}),(0,we.jsx)(B.default,{style:{flex:1}}),(0,we.jsx)(pe.ShellfishChip,{rid:We,by:Ke,app:"display",size:d<1e3||R<500?'s':'m'}),(0,we.jsx)(Se,{tight:d<1e3,items:[{label:as?`tables ${rs?ns.toLowerCase():ns}`:'tables',value:Ds.length,testID:'badge-tables'},{label:as?`Covers ${rs?ns.toLowerCase():ns}`:'covers',value:as?Is:Gt,testID:'badge-covers'},{label:'takeaway',value:Ut.length,alert:Ut.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>bt(!0)}]}),R>=500||!Ze?(0,we.jsx)(L.T,{size:12,colour:Ze?'#A89A80':O.colours.amber,children:Ze?'Privacy':'Privacy off'}):null,(0,we.jsx)(C.default,{testID:"colour-key-help",accessibilityRole:"button",accessibilityLabel:"Help: table colours and symbols",onPress:()=>Pt(!0),style:({pressed:e})=>({width:44,height:44,borderRadius:22,borderWidth:1,borderColor:'rgba(255,255,255,0.10)',backgroundColor:e?'rgba(255,255,255,0.08)':'rgba(255,255,255,0.03)',alignItems:'center',justifyContent:'center'}),children:(0,we.jsx)(L.T,{size:15,weight:"semibold",colour:O.colours.muted,children:"?"})}),'simulated'===_e?(0,we.jsx)(C.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>Ne(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,we.jsx)(L.T,{size:11,colour:O.colours.muted,children:il?'+15':'Skip 15 min'})}):null,(0,we.jsx)(S.VoiceSlot,{size:R<500?52:il?56:72})]}),ve?ol:(nl=(0,we.jsxs)(we.Fragment,{children:[(0,we.jsxs)(B.default,{testID:"front-door-bar",style:{gap:10},children:[(0,we.jsx)(B.default,{testID:"primary-actions",style:{flexDirection:'row',gap:12},children:Vs(!1)}),Fs]}),(0,we.jsx)(ce.BlocksBanner,{rid:We,now:Fe,big:!0,by:Ke}),Qe?(0,we.jsx)(D.DayView,{rid:We,day:Qe,today:Ye,app:"display"}):(0,we.jsx)(we.Fragment,{children:(0,we.jsxs)(B.default,{style:{flex:1,minHeight:0,flexDirection:'row',gap:10},children:[Xs,(0,we.jsxs)(B.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[_s,Ns?Es:As,Zs]})]})}),Us,Qe?null:sl,Qe?null:(0,we.jsxs)(B.default,{style:{flexDirection:'row',gap:12,alignItems:'stretch'},children:[(0,we.jsx)(B.default,{style:{flex:1.4},children:tl}),(0,we.jsx)(B.default,{testID:"covers-dock",style:{flex:1},children:(0,we.jsx)(k.CoversToday,{rid:We,day:is,sound:(0,I.flapSoundOn)(),onPress:ll})})]})]}),(0,we.jsx)(B.default,{style:{flex:1,padding:12,paddingTop:10,gap:10,minHeight:0},children:nl})),Gs]}),(0,we.jsx)(y.SoldOutStrip,{rid:We}),(0,we.jsx)(u.TableOrderCue,{rid:We}),Je.elements,yt?(0,we.jsx)(c.EditBookingPicker,{rid:We,today:Ye,who:Ke,hidePrivate:!0,onClose:()=>pt(!1)}):null,mt?(0,we.jsx)(c.EditBookingSheet,{rid:We,id:mt,who:Ke,hidePrivate:!0,onClose:()=>xt(null)}):null,nt?(0,we.jsx)(oe.TableSheet,{rid:We,name:nt,view:Qt,plan:et,todays:Ft,now:Fe,privacy:Ze,turnBase:He.settings.turnMins,onClose:()=>rt(null),onWalkIn:e=>Je.openWalkInAt(e),onMove:e=>ct(e),onDetails:_t}):null,ws?(()=>{const e=js[ws],t=e?.dayBookings??[];return(0,we.jsxs)(L.Sheet,{visible:!0,onClose:()=>ks(null),title:`${(0,a.tableNumbers)(ws)} \xb7 ${rs?ns:(0,he.dayLong)(is)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,we.jsxs)(L.T,{size:16,colour:O.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${rs?ns.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${rs?ns.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,J.privName)(e,Ze):De(e.name);return(0,we.jsx)(L.Button,{kind:"secondary",label:`${e.time} \xb7 ${t} \xb7 ${e.partySize} Covers`,testID:`day-table-booking-${e.id}`,accessibilityLabel:`${e.time}, ${t}, ${e.partySize} Covers, ${(0,se.tablesWords)((0,_.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{ks(null),It(e.id)},style:{minHeight:56}},e.id)}),(0,we.jsx)(L.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>ks(null),style:{minHeight:56}})]})})():null,Dt?(()=>{const e=Ae.find(e=>e.id===Dt);return e?(0,we.jsx)(ee.GuestActionsSheet,{rid:We,b:e,name:e.walkIn?(0,J.privName)(e,Ze):De(e.name),view:Qt,now:Fe,otherDay:e.date!==Ye,turnBase:He.settings.turnMins,onClose:()=>It(null),onDetails:_t,onDone:Wt,onPickOnPlan:(e,t)=>{kt(!1),ot('plan'),at('all'),St({id:e.id,tables:t})}}):null})():null,ut?(0,we.jsx)(oe.DetailsPanel,{title:ut.title,onClose:()=>ht(null),children:ut.body}):null,ft?(0,we.jsx)(oe.ServiceSummary,{r:He,todays:Ft,orders:Oe,waitlistAll:Mt,walkInCount:zt,onClose:()=>jt(!1)}):null,Lt?(0,we.jsxs)(L.Sheet,{visible:!0,onClose:()=>Pt(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,we.jsx)(oe.Legend,{}),(0,we.jsx)(L.Button,{kind:"secondary",label:"Close",onPress:()=>Pt(!1)})]}):null,gt?(0,we.jsxs)(oe.DetailsPanel,{title:"Takeaway",onClose:()=>bt(!1),children:[(0,we.jsx)(L.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,we.jsx)(Ce,{list:Ut,me:Ke,bookings:Ae})]}):null,Ht?(0,we.jsx)(B.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:O.colours.bg},children:(0,we.jsx)(q.PlanDesigner,{initial:et,venue:He.name,mode:"display",startStep:"arrange",onActivity:()=>{At.current=Date.now(),null!==Et&&Nt(null)},notice:null!==Et?`Locking again in ${Et} s \xb7 touch to keep editing`:null,onSave:e=>{_.useFloor.getState().setPlan(We,e),Ot(null),Wt('Table plan saved. Editing is locked again.')},onCancel:()=>{Ot(null),Wt('No changes kept. Editing is locked again.')}},Ht.at)}):null,e?null:(0,we.jsx)(Q.Screensaver,{rid:We,idleMins:Xe.idleMins,pinOn:Xe.pinOn,wake:Xe,tonightCards:Xe.tonightCards}),e?null:(0,we.jsx)(ae.PrintHost,{rid:We}),e?null:(0,we.jsx)(ie.AlertHost,{variant:"display",rid:We,skipTakeaway:!0}),e?null:(0,we.jsx)(v.SeatAllergenReminder,{rid:We}),e?null:(0,we.jsx)(ne.TakeawayTakeover,{rid:We,me:Ke})]});var nl};var t=_r(_d[0]),s=_r(_d[1]),l=_r(_d[2]),o=_r(_d[3]),i=_r(_d[4]),a=_r(_d[5]),n=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),g=_r(_d[12]),b=_r(_d[13]),y=_r(_d[14]),p=_r(_d[15]),x=_r(_d[16]),f=_r(_d[17]),j=_r(_d[18]),w=e(j),k=_r(_d[19]),D=_r(_d[20]),I=_r(_d[21]),v=_r(_d[22]),S=_r(_d[23]),T=e(_r(_d[24])),C=e(_r(_d[25])),$=e(_r(_d[26])),B=e(_r(_d[27])),M=e(_r(_d[28])),z=_r(_d[29]),L=_r(_d[30]),P=_r(_d[31]),R=_r(_d[32]),W=_r(_d[33]),H=_r(_d[34]),O=_r(_d[35]),A=_r(_d[36]),E=_r(_d[37]),N=_r(_d[38]),_=_r(_d[39]),F=_r(_d[40]),V=_r(_d[41]),G=_r(_d[42]),U=_r(_d[43]),q=_r(_d[44]),K=_r(_d[45]),Y=_r(_d[46]),Q=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),le=_r(_d[54]),oe=_r(_d[55]),ie=_r(_d[56]),ae=_r(_d[57]),ne=_r(_d[58]),re=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),ge=_r(_d[64]),be=_r(_d[65]),ye=_r(_d[66]),pe=_r(_d[67]),me=_r(_d[68]),xe=_r(_d[69]),fe=_r(_d[70]),je=_r(_d[71]),we=_r(_d[72]);const ke=12e4,De=e=>(e??'').replace(' (example)',''),Ie=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),ve=e=>e.slotTime?(0,W.hm)(new Date(e.slotTime)):'ASAP';function Se({items:e,tight:t,phone:s}){return(0,we.jsx)(B.default,{style:{flexDirection:'row',alignItems:'center',borderRadius:14,borderWidth:1,borderColor:'rgba(255,255,255,0.07)',backgroundColor:'rgba(255,255,255,0.025)',overflow:'hidden'},children:e.map((e,l)=>{const o=(0,we.jsxs)(B.default,{testID:e.testID,style:{flex:s?1:void 0,flexDirection:s?'column':'row',alignItems:s?'center':'baseline',justifyContent:s?'center':void 0,gap:6,minHeight:44,paddingHorizontal:t?10:14,paddingVertical:6,borderLeftWidth:l?1:0,borderLeftColor:'rgba(255,255,255,0.07)',backgroundColor:e.alert?'rgba(232,168,56,0.14)':'transparent',...s?{minHeight:76}:{}},children:[(0,we.jsx)(L.T,{size:s?24:19,weight:"semibold",colour:e.alert?O.colours.amber:O.colours.text,children:e.value}),(0,we.jsx)(L.T,{size:s?14:12,colour:O.colours.muted,style:{letterSpacing:.3},children:e.label})]});return e.onPress?(0,we.jsx)(C.default,{accessibilityRole:"button",accessibilityLabel:`${e.label} ${e.value}`,onPress:e.onPress,style:s?{flex:1,minWidth:0}:void 0,children:o},e.testID):(0,we.jsx)(w.default.Fragment,{children:o},e.testID)})})}function Te({label:e,sub:t,selected:s,onPress:l,colour:o}){return(0,we.jsxs)(C.default,{accessibilityRole:"button",accessibilityState:{selected:s},accessibilityLabel:`${e}${t?`, ${t}`:''}${s?', selected':''}`,'aria-pressed':s,onPress:l,style:({pressed:e})=>({flexDirection:'row',alignItems:'center',gap:7,minHeight:44,paddingHorizontal:14,borderRadius:999,borderWidth:1,borderColor:s?'rgba(207,164,95,0.75)':'rgba(255,255,255,0.08)',backgroundColor:s?'rgba(207,164,95,0.16)':e?'rgba(255,255,255,0.06)':'rgba(255,255,255,0.03)'}),children:[o?(0,we.jsx)(B.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:o}}):null,(0,we.jsx)(L.T,{size:14,weight:s?'semibold':'medium',colour:s?O.colours.goldLight:'#CFC8BA',children:e}),t?(0,we.jsx)(L.T,{size:12,colour:O.colours.muted,children:t}):null]})}function Ce({list:e,me:t,compact:s,bookings:l}){const o=(e,t)=>(0,xe.statusBlock)(e,t,(0,xe.linkedBooking)(e,l));return e.length?(0,we.jsx)(B.default,{style:{gap:8},children:e.map(e=>(0,we.jsxs)(B.default,{testID:`takeaway-${e.ref}`,style:{backgroundColor:O.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?O.colours.ok:e.allergies.length?O.colours.red:O.colours.gold},children:[(0,we.jsxs)(L.Row,{style:{justifyContent:'space-between'},children:[(0,we.jsxs)(L.T,{size:s?16:18,weight:"bold",children:[ve(e)," \xb7 ",De(e.customerName)]}),(0,we.jsx)(L.Badge,{kind:'ready'===e.status?'ok':'new'===e.status?'amber':'gold',label:'new'===e.status?'NEW':'ready'===e.status?'READY':'preparing'===e.status?'COOKING':'CONFIRMED'})]}),(0,we.jsxs)(L.Muted,{children:[e.ref," \xb7 ",e.lines.reduce((e,t)=>e+t.qty,0)," items",'here'===e.customerSignal?' \xb7 CUSTOMER IS HERE':e.customerSignal?' \xb7 on the way':'']}),e.allergies.length?(0,we.jsxs)(L.T,{size:14,weight:"semibold",colour:O.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,R.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,we.jsx)(me.AllergyChain,{o:e,me:t,compact:!0}):null,(0,we.jsxs)(L.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,we.jsx)(L.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>H.repo.orders.accept(e.id,t)}),e.accepted&&['new','acknowledged','preparing'].includes(e.status)?(0,we.jsx)(L.Button,{small:!0,kind:"success",label:o(e,'ready')?'Kitchen sign-off first':'Ready',disabled:!!o(e,'ready'),testID:`ready-${e.ref}`,onPress:()=>H.repo.orders.setStatus(e.id,'ready',t)}):null,'ready'===e.status?(0,we.jsx)(L.Button,{small:!0,label:o(e,'collected')?'Sign-offs needed':'Collected',disabled:!!o(e,'collected'),testID:`collected-${e.ref}`,onPress:()=>H.repo.orders.setStatus(e.id,'collected',t)}):null,(0,we.jsx)(ae.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,we.jsx)(L.Muted,{children:"No takeaway orders right now."})}function $e({rid:e,id:t,turnBase:s}){const l=(0,H.useBookings)(e).find(e=>e.id===t);return l?(0,we.jsx)(d.BookingTableButton,{rid:e,booking:l,turnBase:s}):null}},876,[5,6,877,912,913,808,868,878,914,915,879,880,916,882,883,917,918,919,30,920,921,922,923,924,241,263,151,127,287,289,813,860,814,818,819,821,854,925,926,825,826,927,884,928,885,888,890,893,892,895,896,897,929,930,815,899,931,900,932,933,824,934,905,935,907,936,908,937,938,939,909,910,24]); +__d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.queuedServiceSessions=u,e.queuedServicePauses=function(n,t,s){const i=u(n,t);return i?i.slice(1).flatMap((n,t)=>{const u=i[t][1],r=n[0];return ue).join(', ')}`,style:{flexDirection:'row',flexWrap:'wrap',gap:10,alignItems:'center'},children:c.map(([e,l])=>(0,n.jsxs)(t.default,{style:{flexDirection:'row',alignItems:'center',gap:4},children:[(0,n.jsx)(t.default,{style:{width:16,height:16,borderRadius:4,backgroundColor:o.STATUS[e].colour,borderWidth:1,borderColor:'rgba(255,255,255,0.25)'}}),(0,n.jsx)(s.T,{size:13,children:l})]},e))})},r(d[0]);var e,l=r(d[1]),t=(e=l)&&e.__esModule?e:{default:e},o=r(d[2]),s=r(d[3]),n=r(d[4]);const c=[['free','Free'],['seated','Seated'],['dirty','Needs clearing']]},878,[30,127,826,813,24]); +__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TableOrderCue=function({rid:o}){const t=(0,n.useNow)(15e3).getTime(),f=(0,n.useOrders)(o).filter(e=>(0,s.isTableQr)(e)&&('new'===e.status||(0,s.waitingForStaff)(e))&&t-new Date(e.createdAt).getTime()<6e5);if(!f.length)return null;const b=[...new Set(f.map(e=>e.tableNo??'?'))].sort((e,o)=>Number(e)-Number(o)),w=f.some(s.waitingForStaff);return(0,c.jsx)(a.default,{testID:"table-order-cue",style:{marginHorizontal:10,marginTop:6,paddingVertical:6,paddingHorizontal:12,borderRadius:8,borderWidth:1,borderColor:u.colours.gold,backgroundColor:u.colours.surface2},children:(0,c.jsxs)(l.T,{weight:"semibold",colour:u.colours.gold,children:["New order \xb7 ",b.map(o=>`${(0,e.tableNumbers)(o)}`).join(', '),w?' \xb7 waiting for staff to accept':'']})})};var e=r(d[0]);r(d[1]);var o,t=r(d[2]),a=(o=t)&&o.__esModule?o:{default:o},l=r(d[3]),n=r(d[4]),s=r(d[5]),u=r(d[6]),c=r(d[7])},879,[808,30,127,813,819,874,821,24]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GiftQrButton=function({rid:e,venue:x}){const j=(0,f.useFloor)(t=>t.settings[e]),[C,R]=(0,t.useState)(!1),{width:F,height:T}=(0,l.default)();if(!(0,h.giftQrShown)(j))return null;const w=Math.round(Math.max(180,Math.min(.7*F,.55*T,520)));return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(s.default,{testID:"gift-qr-open",accessibilityRole:"button",accessibilityLabel:"Buy a gift card. Shows a QR code to scan",onPress:()=>R(!0),style:({pressed:e})=>({...b.look.quiet(e),flexGrow:1,minHeight:48}),children:(0,p.jsx)(u.T,{size:15,weight:"semibold",colour:y.colours.goldLight,children:"Buy a gift card"})}),(0,p.jsx)(o.default,{visible:C,animationType:"fade",onRequestClose:()=>R(!1),supportedOrientations:['portrait','landscape'],children:(0,p.jsxs)(n.default,{testID:"gift-qr-panel",style:{flex:1,backgroundColor:y.colours.bg,alignItems:'center',justifyContent:'center',padding:24,gap:20},children:[(0,p.jsx)(u.T,{size:30,weight:"bold",colour:y.colours.gold,style:{textAlign:'center'},children:h.GIFT_QR_TEXT}),(0,p.jsx)(n.default,{accessible:!0,accessibilityRole:"image",accessibilityLabel:`QR code for ${x}'s gift card page`,style:{padding:14,backgroundColor:'#FFFFFF',borderRadius:16,borderWidth:2,borderColor:y.colours.gold},children:(0,p.jsx)(c.QR,{value:(j.giftQrUrl??'').trim(),size:w})}),(0,p.jsxs)(u.T,{size:20,colour:y.colours.text,style:{textAlign:'center'},children:[x," gift cards are sold on our website."]}),(0,p.jsx)(s.default,{testID:"gift-qr-close",accessibilityRole:"button",accessibilityLabel:"Close",onPress:()=>R(!1),hitSlop:8,style:({pressed:e})=>({minHeight:56,minWidth:160,paddingHorizontal:24,alignItems:'center',justifyContent:'center',borderRadius:14,borderWidth:1.5,borderColor:y.colours.gold,backgroundColor:e?y.colours.goldTint:'transparent'}),children:(0,p.jsx)(u.T,{size:20,weight:"semibold",colour:y.colours.gold,children:"Close"})})]})})]})};var t=r(d[0]),o=e(r(d[1])),s=e(r(d[2])),l=e(r(d[3])),n=e(r(d[4])),c=r(d[5]),u=r(d[6]),b=r(d[7]),f=r(d[8]),h=r(d[9]),y=r(d[10]),p=r(d[11])},880,[30,256,263,287,127,867,813,936,825,881,821,24]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"GIFT_QR_TEXT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"GIFT_QR_MAX",{enumerable:!0,get:function(){return n}}),e.giftQrUrlOk=o,Object.defineProperty(e,"giftQrShown",{enumerable:!0,get:function(){return u}});const t='Scan to buy a gift card on your phone',n=300;function o(t){const o=(t??'').trim();return!(!o||o.length>n||/\s/.test(o))&&/^https:\/\/[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)+(:\d+)?(\/[^\s]*)?$/i.test(o)}const u=t=>!!t?.giftQrOn&&o(t?.giftQrUrl)},881,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"EXIT_LABEL",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"EXIT_ARMED_LABEL",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"EXIT_UPDATE_TEXT",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"EXIT_ARM_MS",{enumerable:!0,get:function(){return j}}),_e.nativeExit=C,Object.defineProperty(_e,"inTabletApp",{enumerable:!0,get:function(){return w}}),_e.ExitButton=function(){const[e,D]=(0,o.useState)(!1),[E,I]=(0,o.useState)(!1),v=(0,o.useRef)(null);(0,o.useEffect)(()=>()=>{v.current&&clearTimeout(v.current)},[]);const _=w();return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(l.default,{testID:"display-exit",accessibilityRole:"button",accessibilityLabel:e?y:f,onPress:()=>{if(!e)return D(!0),v.current&&clearTimeout(v.current),void(v.current=setTimeout(()=>D(!1),j));v.current&&clearTimeout(v.current),D(!1);const t=C();if(t)try{t.exit()}catch{}else{try{T()?.CoverChargeNative?.checkUpdate?.()}catch{}I(!0)}},hitSlop:4,style:({pressed:e})=>({...p.look.quiet(e),flexGrow:0,marginLeft:'auto',minHeight:48,minWidth:64,paddingHorizontal:14,alignItems:'center',justifyContent:'center'}),children:(0,h.jsx)(u.T,{size:14,weight:e?'semibold':'regular',colour:e?b.colours.gold:b.colours.muted,children:e?'Exit? Tap again':'Exit'})}),(0,h.jsx)(s.default,{visible:E,transparent:!0,animationType:"fade",onRequestClose:()=>I(!1),supportedOrientations:['portrait','landscape'],children:(0,h.jsx)(c.default,{style:{flex:1,backgroundColor:'rgba(0,0,0,0.75)',alignItems:'center',justifyContent:'center',padding:24},children:(0,h.jsxs)(c.default,{testID:"display-exit-update",accessibilityViewIsModal:!0,style:{maxWidth:560,width:'100%',gap:16,padding:24,borderRadius:16,borderWidth:1.5,borderColor:b.colours.gold,backgroundColor:(0,t.soutersSurface)('#141414')},children:[(0,h.jsx)(u.T,{size:22,weight:"bold",colour:b.colours.gold,children:x}),_?(0,h.jsx)(u.T,{size:17,colour:b.colours.text,children:"A new Display app is ready. Open the tablet's recent apps, swipe Cover Charge for Display away, then open it again. After a few seconds a large \u201cUpdate the Display app\u201d button appears at the bottom: tap it and Android asks you to confirm."}):(0,h.jsx)(u.T,{size:17,colour:b.colours.text,children:"Exit closes the Display tablet app. In a web browser, close the tab instead, or install the Display tablet app."}),(0,h.jsxs)(c.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:12},children:[_?null:(0,h.jsx)(l.default,{testID:"display-exit-get",accessibilityRole:"link",accessibilityLabel:"Get the Display tablet app",onPress:()=>{n.default.openURL('/tablet.html')},style:({pressed:e})=>({minHeight:56,paddingHorizontal:20,alignItems:'center',justifyContent:'center',borderRadius:14,borderWidth:1.5,borderColor:b.colours.gold,backgroundColor:e?b.colours.goldTint:'transparent'}),children:(0,h.jsx)(u.T,{size:18,weight:"semibold",colour:b.colours.gold,children:"Get the Display app"})}),(0,h.jsx)(l.default,{testID:"display-exit-close",accessibilityRole:"button",accessibilityLabel:"Close",onPress:()=>I(!1),style:({pressed:e})=>({minHeight:56,minWidth:120,paddingHorizontal:20,alignItems:'center',justifyContent:'center',borderRadius:14,borderWidth:1.5,borderColor:b.colours.gold,backgroundColor:e?b.colours.goldTint:'transparent'}),children:(0,h.jsx)(u.T,{size:18,weight:"semibold",colour:b.colours.gold,children:"Close"})})]})]})})})]})};var t=r(d[0]),o=r(d[1]),n=e(r(d[2])),s=e(r(d[3])),l=e(r(d[4])),c=e(r(d[5])),u=r(d[6]),p=r(d[7]),b=r(d[8]),h=r(d[9]);const f='Exit the Display app',y='Tap again to exit the Display app',x='Update the Display app to use Exit',j=3e3,T=()=>'undefined'!=typeof window?window:void 0;function C(){const e=T()?.CoverChargeNative;return e&&'function'==typeof e.exit?e:null}const w=()=>/CoverChargeTablet\//.test(String(T()?.navigator?.userAgent??''))},882,[912,30,239,256,263,127,813,936,821,24]); +__d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"STRIP_FONT",{enumerable:!0,get:function(){return F}}),_e.SoldOutStrip=function({rid:e,now:k}){const T=(0,f.useSoldOut)(e=>e.entries),O=(0,u.useStore)(e=>e.clock),[v,C]=(0,n.useState)(0),[I,z]=(0,n.useState)(!1),H=(0,p.useAutoSoldOutView)(e);(0,n.useEffect)(()=>{w()},[]);const D=k??(0,h.nowFrom)(O),_=(0,x.activeSoldOut)(T,e,D);if(!_.length)return null;const A=_.map(e=>(0,y.withReason)(e.name,H.reason(e.itemId))),M=(0,x.stripText)(A),L=v>0&&(0,x.stripNeedsTicker)(A,v,F),P=Math.round(.28*M.length),R=[20,30,40,50,60,80,100,120].find(e=>e>=P)??120,B=(e,t=!1)=>(0,b.jsx)(o.Text,{numberOfLines:t?void 0:1,style:{flexShrink:t?0:1,...t&&j?{whiteSpace:'nowrap'}:{},fontFamily:S.fonts.medium,fontSize:F,lineHeight:20,color:S.colours.gold,paddingRight:48},children:M},e);return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(l.default,{testID:"display-soldout-strip",accessibilityRole:"button",accessibilityLabel:`Sold out: ${A.join(', ')}. Tap for the list.`,onPress:()=>z(!0),onLayout:e=>C(e.nativeEvent.layout.width),style:{flexDirection:'row',alignItems:'center',minHeight:44,paddingHorizontal:12,paddingVertical:4,gap:10,backgroundColor:(0,t.soutersSurface)('#161411'),borderTopWidth:1,borderTopColor:S.colours.accentBorder},children:[(0,b.jsxs)(o.Text,{style:{fontFamily:S.fonts.bold,fontSize:12,lineHeight:16,letterSpacing:1,color:S.colours.amber},children:["SOLD OUT",_.length>1?` \xb7 ${_.length}`:'']}),(0,b.jsx)(c.default,{style:{flex:1,overflow:'hidden'},children:L&&j?(0,b.jsxs)(c.default,{testID:"display-soldout-ticker",dataSet:{ccso:`tick-${R}`},style:{flexDirection:'row',alignSelf:'flex-start',flexShrink:0},children:[B('a',!0),B('b',!0)]}):B('a')}),L&&!j?(0,b.jsx)(o.Text,{style:{fontFamily:S.fonts.regular,fontSize:12,color:S.colours.muted},children:"Tap for all"}):null]}),(0,b.jsxs)(d.Sheet,{visible:I,onClose:()=>z(!1),title:(0,x.soldOutCount)(_.length),maxWidth:520,testID:"display-soldout-sheet",children:[(0,b.jsx)(s.default,{style:{maxHeight:420},children:_.map(e=>(0,b.jsxs)(c.default,{style:{paddingVertical:8,borderBottomWidth:1,borderBottomColor:S.colours.border},children:[(0,b.jsx)(o.Text,{style:{fontFamily:S.fonts.semibold,fontSize:17,color:S.colours.text},children:e.name}),H.reason(e.itemId)?(0,b.jsx)(o.Text,{style:{fontFamily:S.fonts.medium,fontSize:14,color:S.colours.amber},children:H.reason(e.itemId).replace(/^./,e=>e.toUpperCase())}):null,(0,b.jsxs)(o.Text,{style:{fontFamily:S.fonts.regular,fontSize:13,color:S.colours.muted},children:["Since ",$(e.at),e.auto?' \xb7 Auto, from the counts \xb7 back on when the count is back up':`${e.by?` \xb7 ${e.by}`:''}${e.clearAfter?` \xb7 back on at ${$(e.clearAfter)}`:''}`]})]},e.itemId))}),(0,b.jsx)(o.Text,{style:{fontFamily:S.fonts.regular,fontSize:13,color:S.colours.muted,marginTop:8},children:"A reminder for staff. Mark dishes sold out or back on in Front of House, Managers or Head Chef."})]})]})};var t=r(_d[0]),o=r(_d[1]),n=r(_d[2]);r(_d[3]);var l=e(r(_d[4])),s=e(r(_d[5])),c=e(r(_d[6])),d=r(_d[7]),u=r(_d[8]),f=r(_d[9]),h=r(_d[10]),p=r(_d[11]),y=r(_d[12]),x=r(_d[13]),S=r(_d[14]),b=r(_d[15]);const j='undefined'!=typeof document,k=`\n${[20,30,40,50,60,80,100,120].map(e=>`[data-ccso="tick-${e}"]{display:inline-flex;white-space:nowrap;animation:ccso-tick ${e}s linear infinite}`).join('\n')}\n@keyframes ccso-tick{from{transform:translate3d(0,0,0)}to{transform:translate3d(-50%,0,0)}}\n@media (prefers-reduced-motion: reduce){[data-ccso^="tick"]{animation:none!important}}\n`;let T=!1;function w(){if(!j||T)return;T=!0;const e=document.createElement('style');e.setAttribute('data-ccso-css','1'),e.textContent=k,document.head.appendChild(e)}const $=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`},F=15},883,[912,875,30,122,263,151,127,813,819,917,870,941,942,943,821,24]); +__d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"AREA_LABEL_H",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"GRID_GAP",{enumerable:!0,get:function(){return r}}),e.venueGrid=function(n,l,o,s=r,c=t){if(!n.length||l<=0||o<=0)return null;Math.max(0,...n.map(t=>t.minScale));const a=t=>{const r=[];for(let l=0;la/t.w)),h=r.reduce((t,r)=>t+Math.max(...r.map(t=>t.h)),0),i=(o-r.length*c-s*(r.length-1))/h;return{cols:t,rows:r,cellW:a,byW:u,byH:i,sumH:h,s:Math.min(u,i)}};let u=Array.from({length:n.length},(t,r)=>a(r+1)).reduce((t,r)=>r.s>t.s+1e-6?r:t),h=u.s;const i=u.rows.map(t=>Math.max(...t.map(t=>t.h))*h+c),p=i.reduce((t,r)=>t+r,0)+s*(u.rows.length-1),f=Math.max(0,o-p),w=i.map(t=>Math.floor(t+f*(t-c)/(u.sumH*h||1)));return{cols:u.cols,rows:u.rows.map(t=>t.map(t=>t.id)),rowHeights:w,cellW:u.cellW,scale:h,scroll:!1,totalH:w.reduce((t,r)=>t+r,0)+s*(u.rows.length-1)}};const t=24,r=8},884,[]); +__d(function(g,r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.cleanPlan=v,_e.PlanDesigner=function(e){const[s,a]=(0,n.useReducer)(S,{past:[],now:e.initial,future:[]}),A=s.now,B=e=>a({t:'set',p:e}),[N,F]=(0,n.useState)(e.startStep??'areas'),[E,W]=(0,n.useState)(e.initial.areas[0]?.id??''),[H,O]=(0,n.useState)(null),U=(0,y.useOwner)(e=>e.site),_=(0,j.useFloor)(e=>e.settings[U]),G=!1!==_?.gridSnap,K=(0,f.gridOf)(_?.gridSize),[J,X]=(0,n.useState)(null),[Y,Z]=(0,n.useState)(null),[q,V]=(0,n.useState)(''),{width:Q,height:ee}=(0,u.default)(),te=Q>=900,se=s.past.length>0||JSON.stringify(A)!==JSON.stringify(e.initial),ae=(0,h.planCounts)(A);(0,n.useEffect)(()=>{A.areas.some(e=>e.id===E)||W(A.areas[0]?.id??'')},[A.areas,E]),(0,n.useEffect)(()=>{q&&((0,o.notify)({id:`plan-note:${Date.now()}`,title:q,timeoutMs:3500,testID:'plan-toast'}),V(''))},[q]);const le='table'===H?.kind?A.tables.find(e=>e.id===H.id):void 0,oe='fixture'===H?.kind?(A.fixtures??[]).find(e=>e.id===H.id):void 0,re=(e,t)=>{const s=A.tables.find(t=>t.id===e),a=s&&t.name&&t.name!==s.name?A.joins.map(e=>({...e,tables:e.tables.map(e=>e===s.name?t.name:e)})):A.joins,l=s&&t.name&&t.name!==s.name?A.areas.map(e=>e.best?.includes(s.name)?{...e,best:e.best.map(e=>e===s.name?t.name:e)}:e):A.areas;B({...A,areas:l,joins:a,tables:A.tables.map(s=>s.id===e?{...s,...t}:s)})},ne=e=>{const t=A.tables.find(t=>t.id===e);B({...A,tables:A.tables.filter(t=>t.id!==e),joins:A.joins.filter(e=>!t||!e.tables.includes(t.name))}),O(null)},ie=e=>{const t=h.FIXTURES.find(t=>t.id===e),s={id:(0,h.fid)('fx'),areaId:E,kind:e,x:25*Math.round((h.PLAN_W-t.w)/50),y:25,w:t.w,h:t.h};B({...A,fixtures:[...A.fixtures??[],s]}),O({kind:'fixture',id:s.id})},de=e=>{const t=(0,f.tidyArea)(A,e,K),s=(0,f.movedCount)(A,t);s?(B(t),V(`Tidied: ${s} table${1===s?'':'s'} lined up on the grid. Undo (\u2318Z / Ctrl+Z) if you preferred it before.`)):V('Already tidy: every table is on the grid and lined up.')},ue=e=>{const t=(0,h.autoArrange)(A.tables.filter(t=>t.areaId===e),R(A,e));B({...A,tables:[...A.tables.filter(t=>t.areaId!==e),...t]}),V('Layout tidied. Undo if you preferred it before.')};(0,n.useEffect)(()=>{if('undefined'==typeof document)return;const e=e=>{const t=e.target?.tagName;if('INPUT'===t||'TEXTAREA'===t)return;if((e.ctrlKey||e.metaKey)&&'z'===e.key.toLowerCase())return e.preventDefault(),void a({t:e.shiftKey?'redo':'undo'});if((e.ctrlKey||e.metaKey)&&'y'===e.key.toLowerCase())return e.preventDefault(),void a({t:'redo'});if('arrange'!==N||!H)return;const s=e.altKey?1:G?K:5,l={ArrowLeft:[-s,0],ArrowRight:[s,0],ArrowUp:[0,-s],ArrowDown:[0,s]}[e.key];l&&(e.preventDefault(),ce(H.kind,H.id,l[0],l[1],!0)),'Delete'!==e.key&&'Backspace'!==e.key||(e.preventDefault(),'table'===H.kind?ne(H.id):(B({...A,fixtures:(A.fixtures??[]).filter(e=>e.id!==H.id)}),O(null))),'r'===e.key.toLowerCase()&&he(H.kind,H.id)};return document.addEventListener('keydown',e),()=>document.removeEventListener('keydown',e)});const ce=(e,t,s,a,l=!1)=>{const o=e=>({x:Math.max(0,Math.min(h.PLAN_W-e.w,l?e.x+s:s)),y:Math.max(0,Math.min(h.PLAN_H-e.h,l?e.y+a:a))});B('table'===e?{...A,tables:A.tables.map(e=>e.id===t?{...e,...o(e)}:e)}:{...A,fixtures:(A.fixtures??[]).map(e=>e.id===t?{...e,...o(e)}:e)})},he=(e,t)=>{B('table'===e?{...A,tables:A.tables.map(e=>e.id===t?(0,h.rotate90)(e):e)}:{...A,fixtures:(A.fixtures??[]).map(e=>e.id===t?(0,h.rotate90)(e):e)})},be='display'===e.mode;return(0,T.jsxs)(c.default,{testID:"plan-designer",style:{flex:1,backgroundColor:b.colours.bg},onStartShouldSetResponderCapture:()=>(e.onActivity?.(),!1),onMoveShouldSetResponderCapture:()=>(e.onActivity?.(),!1),children:[be?(0,T.jsxs)(c.default,{testID:"editing-banner",accessibilityRole:"summary",style:{backgroundColor:b.colours.gold,paddingHorizontal:16,paddingVertical:8,flexDirection:'row',alignItems:'center',gap:10},children:[(0,T.jsx)(p.T,{size:18,weight:"bold",colour:b.colours.onGold,children:"\u270e EDITING THE TABLE PLAN"}),(0,T.jsx)(p.T,{size:14,weight:"medium",colour:b.colours.onGold,style:{flex:1},children:"The Display is unlocked. Nothing changes on the floor until you tap Save changes."}),e.notice?(0,T.jsx)(c.default,{style:{backgroundColor:(0,t.soutersSurface)('#0B0B0B'),borderRadius:8,paddingHorizontal:10,paddingVertical:4},children:(0,T.jsx)(p.T,{size:13,weight:"semibold",colour:b.colours.amber,children:e.notice})}):null]}):null,(0,T.jsxs)(c.default,{style:{flexDirection:'row',flexWrap:'wrap',alignItems:'center',gap:10,paddingHorizontal:14,paddingVertical:8,borderBottomWidth:1,borderColor:b.colours.border,backgroundColor:b.colours.surface},children:[(0,T.jsxs)(c.default,{style:{marginRight:6},children:[(0,T.jsx)(p.T,{weight:"bold",size:17,colour:b.colours.gold,children:"Table plan"}),(0,T.jsx)(p.Muted,{size:12,children:e.venue})]}),(0,T.jsx)(p.Row,{gap:6,children:C.map(e=>{const t=e.id===N;return(0,T.jsxs)(i.default,{testID:`step-${e.id}`,accessibilityRole:"tab",accessibilityState:{selected:t},accessibilityLabel:`Step ${e.n}: ${e.label}`,onPress:()=>{F(e.id),O(null),X(null)},style:{flexDirection:'row',alignItems:'center',gap:8,minHeight:44,paddingHorizontal:12,borderRadius:22,borderWidth:1.5,borderColor:t?b.colours.gold:b.colours.border,backgroundColor:t?b.colours.goldTint:'transparent'},children:[(0,T.jsx)(c.default,{style:{width:24,height:24,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:t?b.colours.gold:b.colours.surface2},children:(0,T.jsx)(p.T,{size:13,weight:"bold",colour:t?b.colours.onGold:b.colours.muted,children:e.n})}),(0,T.jsx)(p.T,{weight:"semibold",size:15,colour:t?b.colours.goldLight:b.colours.text,children:e.label})]},e.id)})}),(0,T.jsx)(c.default,{style:{flex:1}}),(0,T.jsxs)(c.default,{testID:"plan-counts",style:{alignItems:'flex-end',marginRight:4},children:[(0,T.jsxs)(p.T,{weight:"bold",size:16,children:[ae.tables," tables \xb7 ",ae.seats," seats"]}),(0,T.jsxs)(p.Muted,{size:12,children:[A.areas.length," area",1===A.areas.length?'':'s',se?' \xb7 unsaved changes':'']})]}),(0,T.jsx)(z,{label:"Undo",glyph:"\u21b6",disabled:!s.past.length,onPress:()=>a({t:'undo'})}),(0,T.jsx)(z,{label:"Redo",glyph:"\u21b7",disabled:!s.future.length,onPress:()=>a({t:'redo'})}),(0,T.jsx)(p.Button,{small:!0,kind:"secondary",label:"Cancel",testID:"designer-cancel",onPress:()=>se?Z({title:'Discard your changes?',body:'The table plan goes back to how it was before you started editing.',ok:'Discard changes',danger:!0,run:e.onCancel}):e.onCancel(),style:{minHeight:44}}),(0,T.jsx)(p.Button,{small:!0,label:"Save changes",testID:"designer-save",disabled:!se,onPress:()=>Z({title:'Save changes to the table plan?',body:`${ae.tables} tables \xb7 ${ae.seats} seats across ${A.areas.length} area${1===A.areas.length?'':'s'}. The live floor plan updates straight away on this device.`,ok:'Save changes',run:()=>e.onSave(v(A))}),style:{minHeight:44}})]}),(0,T.jsxs)(c.default,{style:{flex:1},children:['areas'===N?(0,T.jsx)($,{plan:A,set:B,confirm:Z,wide:te,next:()=>F('tables'),toast:V}):null,'tables'===N?(0,T.jsx)(M,{plan:A,set:B,area:E,setArea:W,addTables:(e,t)=>{let s={...A,areas:[...A.areas],tables:[...A.tables]};const a=new Set(s.tables.map(e=>e.name)),l=[];let o=0;const n=new Set;for(const t of e){if(a.has(t.name)){l.push(t.name);continue}let e=E;if(t.area){const a=s.areas.find(e=>e.name.toLowerCase()===t.area.toLowerCase());a?e=a.id:(e=D(s,t.area),s.areas.push({id:e,name:t.area,dogs:!1,outdoor:!1}))}const i=(0,h.newTable)(t.name,e,t.seats,I(s,e)),[d]=(0,h.placeNew)(s.tables.filter(t=>t.areaId===e),[i],(s.fixtures??[]).filter(t=>t.areaId===e));s.tables.push(d),a.add(t.name),n.add(e),o++}if(t)for(const e of n){const t=s.tables.filter(t=>t.areaId===e),a=(0,h.autoArrange)(t,R(s,e));s={...s,tables:[...s.tables.filter(t=>t.areaId!==e),...a]}}return o&&B(s),V(`${o} table${1===o?'':'s'} added${l.length?` \xb7 skipped ${l.join(', ')} (already on the plan)`:''}`),o},remove:ne,patch:re,wide:te,next:()=>F('arrange'),back:()=>F('areas')}):null,'arrange'===N?(0,T.jsxs)(c.default,{style:{flex:1,flexDirection:te?'row':'column'},children:[(0,T.jsxs)(c.default,{style:{flex:1,padding:10,gap:8,minHeight:te?void 0:Math.min(420,.5*ee)},children:[(0,T.jsx)(P,{plan:A,area:E,onPick:e=>{W(e),O(null),X(null)}}),J?(0,T.jsxs)(c.default,{style:{backgroundColor:b.colours.blueBg,borderRadius:10,padding:8,flexDirection:'row',alignItems:'center',gap:8},children:[(0,T.jsxs)(p.T,{colour:b.colours.blue,style:{flex:1},children:["Tap the table to join with ",(0,l.tableNumbers)(A.tables.find(e=>e.id===J)?.name),"."]}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Stop joining",onPress:()=>X(null)})]}):null,(0,T.jsx)(x.DesignerCanvas,{plan:A,areaId:E,sel:H,onSelect:e=>{if(J&&'table'===e?.kind&&e.id!==J){const t=A.tables.find(e=>e.id===J),s=A.tables.find(t=>t.id===e.id),a=A.joins.find(e=>e.tables.includes(t.name)),l=a?A.joins.map(e=>e===a?{...e,tables:[...new Set([...e.tables,s.name])].sort((e,t)=>(0,h.numOf)(e)-(0,h.numOf)(t))}:e).filter(e=>e===a||!e.tables.includes(s.name)):[...A.joins.filter(e=>!e.tables.includes(s.name)),{id:(0,h.fid)('j'),tables:[t.name,s.name].sort((e,t)=>(0,h.numOf)(e)-(0,h.numOf)(t))}];return B({...A,joins:l}),X(null),V(`Joined: book as ${l.find(e=>e.tables.includes(t.name)).tables.join('+')}`),void O(e)}X(null),O(e)},snapOn:G,grid:K,joinFrom:J,onMove:(e,t,s,a)=>ce(e,t,s,a),onResize:(e,t,s,a)=>{if('table'===e){const e=A.tables.find(e=>e.id===t);if('round'===e.shape){const l=Math.max(s,a);re(t,{w:l,h:l,x:e.x,y:e.y})}else re(t,{w:s,h:a,shape:s===a?'square':'rect',x:e.x,y:e.y})}else B({...A,fixtures:(A.fixtures??[]).map(e=>e.id===t?{...e,w:s,h:a}:e)})}}),(0,T.jsxs)(p.Muted,{size:12,children:["Drag to move \xb7 the gold dot resizes \xb7 ",G?`tables snap to a ${K} grid and line up with each other (gold guides)`:'snap to grid is off',' \xb7 hold Alt (Option on a Mac) to move freely \xb7 keys: arrows nudge, R rotates, Delete removes, Ctrl+Z / \u2318Z undoes']})]}),(0,T.jsx)(d.default,{style:{width:te?330:void 0,flexGrow:te?0:1,flexShrink:0,flexBasis:te?330:void 0,borderLeftWidth:te?1:0,borderTopWidth:te?0:1,borderColor:b.colours.border,backgroundColor:b.colours.surface},contentContainerStyle:{padding:14,gap:12},children:le?(0,T.jsx)(L,{t:le,plan:A,patch:e=>re(le.id,e),rotate:()=>he('table',le.id),remove:()=>ne(le.id),duplicate:()=>{const e=k(A),t={...le,id:`t-${e}-${(0,h.fid)('d')}`,name:e,label:void 0},[s]=(0,h.placeNew)(A.tables.filter(e=>e.areaId===le.areaId),[t],(A.fixtures??[]).filter(e=>e.areaId===le.areaId));B({...A,tables:[...A.tables,s]}),O({kind:'table',id:s.id}),V(`${(0,l.tableNumbers)(e)} added`)},join:()=>X(le.id),split:e=>B({...A,joins:A.joins.filter(t=>t.id!==e)}),moveArea:e=>{const[t]=(0,h.placeNew)(A.tables.filter(t=>t.areaId===e),[{...le,areaId:e,sectionId:I(A,e)}],(A.fixtures??[]).filter(t=>t.areaId===e));B({...A,tables:A.tables.map(e=>e.id===le.id?t:e)}),W(e)},onDone:()=>O(null),toast:V}):oe?(0,T.jsxs)(c.default,{style:{gap:10},children:[(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{weight:"bold",size:18,colour:b.colours.gold,children:h.FIXTURES.find(e=>e.id===oe.kind)?.label}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Done",onPress:()=>O(null)})]}),(0,T.jsx)(p.Muted,{children:"Drag it into place; the gold dot changes its length."}),(0,T.jsx)(p.Row,{gap:6,wrap:!0,children:h.FIXTURES.map(e=>(0,T.jsx)(p.Chip,{label:e.label,selected:oe.kind===e.id,onPress:()=>B({...A,fixtures:(A.fixtures??[]).map(t=>t.id===oe.id?{...t,kind:e.id}:t)})},e.id))}),(0,T.jsx)(p.Button,{kind:"secondary",label:"Rotate 90\xb0",onPress:()=>he('fixture',oe.id)}),(0,T.jsx)(p.Button,{kind:"danger",label:"Remove",onPress:()=>{B({...A,fixtures:(A.fixtures??[]).filter(e=>e.id!==oe.id)}),O(null)}})]}):(0,T.jsxs)(c.default,{style:{gap:12},children:[(0,T.jsxs)(p.T,{weight:"bold",size:18,colour:b.colours.gold,children:["Arrange ",A.areas.find(e=>e.id===E)?.name??'']}),(0,T.jsx)(p.Muted,{children:"Tap a table to change its seats, rotate it or join it to another. Drag anything to move it."}),(0,T.jsx)(p.Button,{label:"Add table",testID:"arrange-add-table",onPress:()=>{const e=k(A),t=(0,h.newTable)(e,E,4,I(A,E)),[s]=(0,h.placeNew)(A.tables.filter(e=>e.areaId===E),[t],(A.fixtures??[]).filter(e=>e.areaId===E));B({...A,tables:[...A.tables,s]}),O({kind:'table',id:s.id})}}),(0,T.jsx)(p.T,{weight:"semibold",size:14,colour:b.colours.muted,children:"FIXTURES"}),(0,T.jsx)(p.Row,{gap:6,wrap:!0,children:h.FIXTURES.map(e=>(0,T.jsx)(c.default,{testID:`add-fixture-${e.id}`,children:(0,T.jsx)(p.Chip,{label:e.label,onPress:()=>ie(e.id)})},e.id))}),(0,T.jsx)(p.Button,{label:"Tidy up",testID:"tidy-up",onPress:()=>de(E)}),(0,T.jsx)(p.Muted,{size:12,children:"Snaps every table in this area to the grid and evens out the rows. Table numbers, covers and sizes stay the same. You can undo."}),(0,T.jsx)(p.Button,{kind:"secondary",label:"Re-arrange from scratch",testID:"tidy-area",onPress:()=>ue(E)}),(0,T.jsx)(p.Toggle,{label:"Snap to grid",value:G,onChange:e=>j.useFloor.getState().setSettings(U,{...j.DEFAULT_SETTINGS,..._??{},gridSnap:e})}),(0,T.jsx)(c.default,{style:{borderTopWidth:1,borderColor:b.colours.border,paddingTop:10,gap:4},children:A.areas.map(e=>{const t=(0,h.planCounts)(A,e.id);return(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsxs)(p.T,{size:14,children:[e.name,(0,w.areaMarks)(e)]}),(0,T.jsxs)(p.T,{size:14,colour:b.colours.muted,children:[t.tables," tables \xb7 ",t.seats," seats"]})]},e.id)})})]})})]}):null]}),Y?(0,T.jsx)(c.default,{testID:"designer-confirm",style:{position:'absolute',left:0,right:0,top:0,bottom:0,backgroundColor:'rgba(0,0,0,0.72)',alignItems:'center',justifyContent:'center',padding:16},children:(0,T.jsxs)(c.default,{style:{width:'100%',maxWidth:460,backgroundColor:b.colours.surface,borderRadius:16,borderWidth:1,borderColor:b.colours.gold,padding:20,gap:12},children:[(0,T.jsx)(p.T,{weight:"bold",size:20,children:Y.title}),(0,T.jsx)(p.T,{colour:b.colours.muted,children:Y.body}),(0,T.jsxs)(p.Row,{gap:10,style:{justifyContent:'flex-end'},children:[(0,T.jsx)(p.Button,{kind:"secondary",label:"Keep editing",onPress:()=>Z(null)}),(0,T.jsx)(p.Button,{kind:Y.danger?'danger':'primary',label:Y.ok,testID:"confirm-ok",onPress:()=>{const e=Y;Z(null),e.run()}})]})]})}):null]})};var t=r(_d[0]),s=r(_d[1]),a=r(_d[2]),l=r(_d[3]),o=r(_d[4]),n=r(_d[5]);r(_d[6]);var i=e(r(_d[7])),d=e(r(_d[8])),u=e(r(_d[9])),c=e(r(_d[10])),h=r(_d[11]),b=r(_d[12]),p=r(_d[13]),x=r(_d[14]),f=r(_d[15]),j=r(_d[16]),y=r(_d[17]),w=r(_d[18]),T=r(_d[19]);const C=[{id:'areas',n:1,label:'Areas'},{id:'tables',n:2,label:'Tables'},{id:'arrange',n:3,label:'Arrange'}];function S(e,t){return'set'===t.t?{past:[...e.past,e.now].slice(-80),now:t.p,future:[]}:'undo'===t.t?e.past.length?{past:e.past.slice(0,-1),now:e.past[e.past.length-1],future:[e.now,...e.future]}:e:'redo'===t.t?e.future.length?{past:[...e.past,e.now],now:e.future[0],future:e.future.slice(1)}:e:{past:[],now:t.p,future:[]}}function v(e){const t=new Set(e.tables.map(e=>e.name)),s=[...e.sections];for(const t of e.areas)s.some(e=>e.id===`s-${t.id}`)||e.tables.some(e=>e.areaId===t.id&&e.sectionId)||s.push({id:`s-${t.id}`,name:t.name,colour:'#CFA45F',server:''});return{...e,sections:s,fixtures:(e.fixtures??[]).filter(t=>e.areas.some(e=>e.id===t.areaId)),joins:e.joins.filter(e=>e.tables.length>1&&e.tables.every(e=>t.has(e)))}}const k=e=>{let t=1;const s=new Set(e.tables.map(e=>e.name));for(;s.has(String(t));)t++;return String(t)},I=(e,t)=>e.tables.find(e=>e.areaId===t)?.sectionId??`s-${t}`,R=(e,t)=>(e.fixtures??[]).some(e=>e.areaId===t&&e.y<100&&('bar'===e.kind||e.w>=300))?150:100;const D=(e,t)=>{let s=(0,h.slug)(t),a=2;for(;e.areas.some(e=>e.id===s);)s=`${(0,h.slug)(t)}-${a++}`;return s};function z({label:e,glyph:t,onPress:s,disabled:a}){return(0,T.jsx)(i.default,{accessibilityRole:"button",accessibilityLabel:e,testID:`designer-${e.toLowerCase()}`,disabled:a,onPress:s,style:({pressed:e})=>({minWidth:48,height:44,borderRadius:10,borderWidth:1.5,borderColor:b.colours.border,alignItems:'center',justifyContent:'center',opacity:a?.35:e?.7:1,paddingHorizontal:8}),children:(0,T.jsxs)(p.T,{size:18,weight:"bold",colour:b.colours.gold,children:[t,(0,T.jsxs)(p.T,{size:12,colour:b.colours.muted,children:[" ",e]})]})})}function P({plan:e,area:t,onPick:s}){return(0,T.jsx)(d.default,{horizontal:!0,showsHorizontalScrollIndicator:!1,style:{flexGrow:0},contentContainerStyle:{gap:6},children:e.areas.map(a=>{const l=a.id===t,o=(0,h.planCounts)(e,a.id);return(0,T.jsx)(i.default,{testID:`darea-${a.id}`,accessibilityRole:"tab",accessibilityState:{selected:l},accessibilityLabel:`Area ${a.name}`,onPress:()=>s(a.id),style:{minHeight:44,paddingHorizontal:14,borderRadius:22,borderWidth:1.5,borderColor:l?b.colours.gold:b.colours.border,backgroundColor:l?b.colours.gold:b.colours.surface,justifyContent:'center'},children:(0,T.jsxs)(p.T,{weight:"semibold",size:14,colour:l?b.colours.onGold:b.colours.text,children:[a.name,(0,w.areaMarks)(a)," ",(0,T.jsxs)(p.T,{size:12,colour:l?b.colours.onGold:b.colours.muted,children:[o.tables," \xb7 ",o.seats]})]})},a.id)})})}function $({plan:e,set:t,confirm:a,wide:o,next:u,toast:x}){const[f,j]=(0,n.useState)(''),y=(s,a)=>t({...e,areas:e.areas.map(e=>e.id===s?{...e,...a}:e)}),w=(s,a)=>{const l=[...e.areas],o=s+a;o<0||o>=l.length||([l[s],l[o]]=[l[o],l[s]],t({...e,areas:l}))},C=()=>{const s=f.trim();if(!s)return;if(e.areas.some(e=>e.name.toLowerCase()===s.toLowerCase()))return void x(`There's already an area called ${s}`);const a=D(e,s);t({...e,areas:[...e.areas,{id:a,name:s,dogs:!1,outdoor:!1}],sections:[...e.sections,{id:`s-${a}`,name:s,colour:'#CFA45F',server:''}]}),j('')};return(0,T.jsxs)(d.default,{contentContainerStyle:{padding:16,gap:16,flexDirection:o?'row':'column',alignItems:'flex-start'},children:[(0,T.jsxs)(c.default,{style:{flex:o?3:void 0,alignSelf:'stretch',gap:10},children:[(0,T.jsx)(p.T,{weight:"bold",size:20,children:"1. Areas"}),(0,T.jsx)(p.Muted,{children:"The rooms and spaces guests can sit in. Tick where dogs are welcome and which areas are outdoors (so you can close them in bad weather)."}),e.areas.map((s,o)=>{const n=(0,h.planCounts)(e,s.id);return(0,T.jsxs)(c.default,{testID:`area-card-${s.id}`,style:{backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border,padding:12,gap:8},children:[(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(B,{value:s.name,onCommit:e=>e&&e!==s.name&&y(s.id,{name:e})}),(0,T.jsx)(p.Badge,{label:`${n.tables} tables \xb7 ${n.seats} seats`}),(0,T.jsx)(z,{label:"Up",glyph:"\u2191",disabled:0===o,onPress:()=>w(o,-1)}),(0,T.jsx)(z,{label:"Down",glyph:"\u2193",disabled:o===e.areas.length-1,onPress:()=>w(o,1)})]}),(0,T.jsx)(p.Row,{gap:8,children:(0,T.jsx)(B,{value:s.label??'',label:"Area description (optional)",placeholder:"Description, e.g. Covered conservatory, no pets",onCommit:e=>e!==(s.label??'')&&y(s.id,{label:e||void 0})})}),(0,T.jsxs)(p.Row,{gap:6,wrap:!0,style:{alignItems:'center'},children:[(0,T.jsx)(p.T,{size:13,colour:b.colours.muted,children:"Colour"}),A.map(a=>{const l=(s.colour??e.sections.find(e=>e.id===`s-${s.id}`)?.colour)===a;return(0,T.jsx)(i.default,{testID:`area-colour-${s.id}-${a.slice(1)}`,accessibilityRole:"radio",accessibilityState:{selected:l},accessibilityLabel:`Area colour ${a}`,onPress:()=>t({...e,areas:e.areas.map(e=>e.id===s.id?{...e,colour:a}:e),sections:e.sections.map(e=>e.id===`s-${s.id}`?{...e,colour:a}:e)}),style:{width:32,height:32,borderRadius:16,backgroundColor:a,borderWidth:l?3:1,borderColor:l?'#FFFFFF':b.colours.border}},a)})]}),(()=>{const t=e.tables.filter(e=>e.areaId===s.id).sort((e,t)=>e.name.localeCompare(t.name,void 0,{numeric:!0})),a=s.best??[];return t.length?(0,T.jsxs)(c.default,{style:{gap:6},testID:`area-best-${s.id}`,children:[(0,T.jsx)(p.T,{size:13,colour:b.colours.muted,children:"Best tables"}),(0,T.jsx)(p.Row,{gap:6,wrap:!0,children:t.map(e=>(0,T.jsx)(p.Chip,{testID:`area-best-${s.id}-${e.name}`,label:(0,l.tableNumbers)(e.name),selected:a.includes(e.name),onPress:()=>y(s.id,{best:a.includes(e.name)?a.filter(t=>t!==e.name):[...a,e.name]})},e.id))}),(0,T.jsx)(p.Muted,{size:12,children:"Tip: tap the tables you\u2019d seat first. They show as BEST for walk-ins and bookings when they suit the party size. None ticked: CoverCharge picks by size."})]}):null})(),(0,T.jsxs)(p.Row,{gap:16,wrap:!0,children:[(0,T.jsx)(c.default,{style:{minWidth:220,flex:1},children:(0,T.jsx)(p.Toggle,{label:"\ud83d\udc3e Dogs allowed",value:!!s.dogs,onChange:e=>y(s.id,{dogs:e})})}),(0,T.jsx)(c.default,{style:{minWidth:220,flex:1},children:(0,T.jsx)(p.Toggle,{label:"\ud83c\udf26 Outdoor (weather)",value:!!s.outdoor,onChange:e=>y(s.id,{outdoor:e})})}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Remove area",disabled:e.areas.length<2,onPress:()=>a({title:`Remove ${s.name}?`,body:n.tables?`Its ${n.tables} tables (${n.seats} seats) are removed too. You can undo this.`:'You can undo this.',ok:'Remove area',danger:!0,run:()=>t({...e,areas:e.areas.filter(e=>e.id!==s.id),tables:e.tables.filter(e=>e.areaId!==s.id),fixtures:(e.fixtures??[]).filter(e=>e.areaId!==s.id)})})})]})]},s.id)}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(s.TextInput,{accessibilityLabel:"New area name",placeholder:"New area, e.g. Snug",placeholderTextColor:"#7D776C",value:f,onChangeText:j,onSubmitEditing:C,style:[p.styles.input,{flex:1,minHeight:48}]}),(0,T.jsx)(p.Button,{label:"Add area",testID:"add-area",onPress:C,disabled:!f.trim()})]}),(0,T.jsx)(p.Button,{label:"Next: Tables",onPress:u,testID:"next-tables"})]}),(0,T.jsxs)(c.default,{style:{flex:o?2:void 0,alignSelf:'stretch',gap:10},testID:"templates",children:[(0,T.jsx)(p.T,{weight:"bold",size:18,colour:b.colours.gold,children:"Start from a template"}),(0,T.jsx)(p.Muted,{children:"Replaces the whole plan. You can undo, and nothing is saved until you tap Save changes."}),h.TEMPLATES.map(e=>(0,T.jsxs)(i.default,{testID:`template-${e.id}`,accessibilityRole:"button",accessibilityLabel:`Template: ${e.name}`,onPress:()=>a({title:`Start from ${e.name}?`,body:'This replaces the areas, tables and fixtures in the plan you are editing. You can undo it.',ok:'Use template',run:()=>{t(e.make()),x(`${e.name} template loaded`)}}),style:({pressed:e})=>({backgroundColor:e?b.colours.goldTint:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border,padding:12,minHeight:56}),children:[(0,T.jsx)(p.T,{weight:"semibold",children:e.name}),(0,T.jsx)(p.Muted,{children:e.sub})]},e.id))]})]})}const A=[...h.SECTION_COLOURS,'#E5736B','#F2F2F2'];function B({value:e,onCommit:t,label:a="Area name",placeholder:l}){const[o,i]=(0,n.useState)(e);return(0,n.useEffect)(()=>i(e),[e]),(0,T.jsx)(s.TextInput,{accessibilityLabel:a,placeholder:l,placeholderTextColor:"#7D776C",value:o,onChangeText:i,onBlur:()=>t(o.trim()),onSubmitEditing:()=>t(o.trim()),style:[p.styles.input,{flex:1,minHeight:48,fontSize:17}]})}function M({plan:e,set:t,area:a,setArea:o,addTables:i,remove:u,patch:x,wide:f,next:j,back:y}){const[w,C]=(0,n.useState)(''),[S,v]=(0,n.useState)(4),[I,R]=(0,n.useState)(''),[D,$]=(0,n.useState)(!0),A=(0,n.useMemo)(()=>(0,h.parseTableList)(I),[I]),B=e.tables.filter(e=>e.areaId===a).sort(h.byNumber),M=k(e),L=e.areas.find(e=>e.id===a),N=(e,t)=>{const s=(0,h.sizeFor)(t),a=(0,h.sizeFor)(e.maxSeats),l=e.w!==a.w||e.h!==a.h;x(e.id,{maxSeats:t,minSeats:Math.min(e.minSeats,t),...l?{}:'round'===e.shape?{w:s.h,h:s.h}:{w:s.w,h:s.h,shape:s.shape}})};return(0,T.jsxs)(d.default,{contentContainerStyle:{padding:16,gap:16,flexDirection:f?'row':'column',alignItems:'flex-start'},children:[(0,T.jsxs)(c.default,{style:{flex:f?3:void 0,alignSelf:'stretch',gap:10},children:[(0,T.jsx)(p.T,{weight:"bold",size:20,children:"2. Tables"}),(0,T.jsx)(P,{plan:e,area:a,onPick:o}),(0,T.jsxs)(p.Muted,{children:[L?`${L.name}${L.dogs?' \xb7 dogs allowed':''}${L.outdoor?' \xb7 outdoor':''}`:'',". Table numbers are what you use in website bookings and on the floor."]}),(0,T.jsx)(c.default,{style:{backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border},children:B.length?B.map((e,t)=>(0,T.jsxs)(p.Row,{gap:10,style:{padding:10,borderTopWidth:t?1:0,borderColor:b.colours.border},children:[(0,T.jsxs)(c.default,{style:{width:92},children:[(0,T.jsx)(p.T,{weight:"bold",size:17,colour:b.colours.goldLight,children:(0,h.tableLabel)(e)}),(0,T.jsxs)(p.Muted,{size:12,children:[(0,h.shapeLabel)(e.shape),(0,h.tableLabel)(e)!==e.name?` \xb7 no. ${e.name}`:'']})]}),(0,T.jsx)(c.default,{style:{flex:1},children:(0,T.jsx)(p.Stepper,{value:e.maxSeats,min:1,max:20,label:`seats at table ${e.name}`,onChange:t=>N(e,t)})}),(0,T.jsx)(p.Muted,{children:"seats"}),(0,T.jsx)(z,{label:"Remove",glyph:"\u2715",onPress:()=>u(e.id)})]},e.id)):(0,T.jsx)(c.default,{style:{padding:16},children:(0,T.jsx)(p.Muted,{children:"No tables in this area yet. Add one, or paste a list."})})}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.Button,{kind:"secondary",label:"Back: Areas",onPress:y,style:{flex:1}}),(0,T.jsx)(p.Button,{label:"Next: Arrange",onPress:j,testID:"next-arrange",style:{flex:1}})]})]}),(0,T.jsxs)(c.default,{style:{flex:f?2:void 0,alignSelf:'stretch',gap:12},children:[(0,T.jsxs)(c.default,{style:{backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.gold,padding:14,gap:10},children:[(0,T.jsxs)(p.T,{weight:"bold",size:17,colour:b.colours.gold,children:["Add a table to ",L?.name]}),(0,T.jsxs)(p.Row,{gap:10,children:[(0,T.jsxs)(c.default,{style:{width:120},children:[(0,T.jsx)(p.T,{size:13,colour:b.colours.muted,children:"Table number"}),(0,T.jsx)(s.TextInput,{testID:"add-number",accessibilityLabel:"Table number",value:w,placeholder:M,placeholderTextColor:"#7D776C",onChangeText:e=>C(e.replace(/[^0-9A-Za-z]/g,'').slice(0,4)),style:[p.styles.input,{minHeight:48,fontSize:18}]})]}),(0,T.jsxs)(c.default,{children:[(0,T.jsx)(p.T,{size:13,colour:b.colours.muted,children:"Seats"}),(0,T.jsx)(p.Stepper,{value:S,min:1,max:20,label:"seats",onChange:v})]})]}),(0,T.jsx)(p.Button,{label:`Add ${(0,l.tableNumbers)(w||M)}`,testID:"add-table",onPress:()=>{i([{name:(w||M).toUpperCase(),seats:S}],!1)&&C('')}})]}),(0,T.jsxs)(c.default,{style:{backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border,padding:14,gap:10},children:[(0,T.jsx)(p.T,{weight:"bold",size:17,colour:b.colours.gold,children:"Or paste a list"}),(0,T.jsx)(p.Muted,{children:"One table per line, like \u201c7 - upto 5 people\u201d. A line with just a name (e.g. \u201cBeer Garden\u201d) puts the tables after it in that area."}),(0,T.jsx)(s.TextInput,{testID:"paste-list",accessibilityLabel:"Paste a list of tables",multiline:!0,value:I,onChangeText:R,placeholder:'7 - upto 5 people\n9 - upto 2 people',placeholderTextColor:"#7D776C",style:[p.styles.input,{minHeight:120,textAlignVertical:'top',fontSize:15}]}),I.trim()?(0,T.jsxs)(p.T,{size:14,colour:A.items.length?b.colours.ok:b.colours.amber,children:["Found ",A.items.length," table",1===A.items.length?'':'s'," \xb7 ",A.items.reduce((e,t)=>e+t.seats,0)," seats",A.skipped.length?` \xb7 couldn't read: ${A.skipped.slice(0,2).join('; ')}`:'']}):null,(0,T.jsx)(p.Toggle,{label:"Tidy the layout after adding",value:D,onChange:$}),(0,T.jsx)(p.Button,{label:A.items.length?`Add ${A.items.length} tables`:'Add tables',testID:"paste-add",disabled:!A.items.length,onPress:()=>{i(A.items,D)&&R('')}})]})]})]})}function L({t:e,plan:t,patch:o,rotate:i,remove:d,duplicate:u,join:x,split:f,moveArea:j,onDone:y,toast:w}){const[C,S]=(0,n.useState)(e.name);(0,n.useEffect)(()=>S(e.name),[e.id,e.name]);const v=t.joins.find(t=>t.tables.includes(e.name)),k=()=>{const s=C.trim().toUpperCase();if(s&&s!==e.name)return t.tables.some(e=>e.name===s)?(w(`${(0,l.tableNumbers)(s)} already exists`),void S(e.name)):void o({name:s})};return(0,T.jsxs)(c.default,{style:{gap:12},testID:"table-inspector",children:[(0,T.jsx)(a.TableNumberWarning,{plan:t}),(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{weight:"bold",size:20,colour:b.colours.gold,children:(0,h.tableLabel)(e)}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Done",onPress:y})]}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.T,{size:14,colour:b.colours.muted,style:{width:80},children:"Number"}),(0,T.jsx)(s.TextInput,{accessibilityLabel:"Table number",value:C,onChangeText:S,onBlur:k,onSubmitEditing:k,style:[p.styles.input,{flex:1,minHeight:44}]})]}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.T,{size:14,colour:b.colours.muted,style:{width:80},children:"Seats"}),(0,T.jsx)(p.Stepper,{value:e.maxSeats,min:1,max:20,label:"seats",onChange:t=>o({maxSeats:t,minSeats:Math.min(e.minSeats,t)})})]}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.T,{size:14,colour:b.colours.muted,style:{width:80},children:"Min covers"}),(0,T.jsx)(p.Stepper,{value:e.minSeats,min:1,max:e.maxSeats,label:"minimum covers",onChange:e=>o({minSeats:e})})]}),(0,T.jsxs)(p.Row,{gap:6,wrap:!0,children:[(0,T.jsx)(p.Chip,{label:"Square",selected:'square'===e.shape,onPress:()=>{const t=Math.max(e.w,e.h);o({shape:'square',w:t,h:t})}}),(0,T.jsx)(p.Chip,{label:"Round",selected:'round'===e.shape,onPress:()=>{const t=Math.max(e.w,e.h);o({shape:'round',w:t,h:t})}}),(0,T.jsx)(p.Chip,{label:"Rectangle",selected:'rect'===e.shape,onPress:()=>{if('rect'===e.shape)return;const t=(0,h.sizeFor)(Math.max(5,e.maxSeats));o({shape:'rect',w:e.h>e.w?e.w:t.w,h:e.h>e.w?t.w:t.h})}}),(0,T.jsx)(p.Chip,{label:"Fit to seats",onPress:()=>{const t=(0,h.sizeFor)(e.maxSeats);o({shape:t.shape,w:t.w,h:t.h,minSeats:Math.min(e.minSeats,e.maxSeats)||(0,h.minFor)(e.maxSeats)})}})]}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.Button,{kind:"secondary",label:"Rotate 90\xb0",testID:"rotate",onPress:i,style:{flex:1}}),(0,T.jsx)(p.Button,{kind:"secondary",label:"Duplicate",onPress:u,style:{flex:1}})]}),v?(0,T.jsxs)(c.default,{style:{gap:6},children:[(0,T.jsxs)(p.T,{size:14,children:["Joined with ",v.tables.filter(t=>t!==e.name).map(l.tableNumbers).join(', ')," \xb7 book as ",(0,T.jsx)(p.T,{weight:"bold",colour:b.colours.goldLight,children:(0,l.tableNumbers)(v.tables.join('+'))})]}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.Button,{small:!0,kind:"secondary",label:"Join another",onPress:x,style:{flex:1}}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Split",onPress:()=>f(v.id),style:{flex:1}})]})]}):(0,T.jsx)(p.Button,{kind:"secondary",label:"Join with another table",testID:"join",onPress:x}),(0,T.jsx)(p.Toggle,{label:"Bookable online",value:e.online,onChange:e=>o({online:e})}),t.areas.length>1?(0,T.jsxs)(c.default,{style:{gap:6},children:[(0,T.jsx)(p.T,{size:14,colour:b.colours.muted,children:"Move to area"}),(0,T.jsx)(p.Row,{gap:6,wrap:!0,children:t.areas.map(t=>(0,T.jsx)(p.Chip,{label:t.name,selected:t.id===e.areaId,onPress:()=>t.id!==e.areaId&&j(t.id)},t.id))})]}):null,(0,T.jsx)(p.Button,{kind:"danger",label:"Remove table",onPress:d})]})}},885,[912,875,913,808,918,30,122,263,151,287,127,944,821,813,886,887,825,854,928,24]); +__d(function(_g,_r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.DesignerCanvas=function({plan:e,areaId:p,sel:b,onSelect:g,onMove:x,onResize:y,snapOn:v,grid:w=a.GRID,joinFrom:j}){const[C,L]=(0,n.useState)({w:0,h:0}),R=C.w&&C.h?Math.min(C.w/a.PLAN_W,C.h/a.PLAN_H):0,I=e=>e*R,S=e.tables.filter(e=>e.areaId===p),k=(e.fixtures??[]).filter(e=>e.areaId===p),[A,E]=(0,n.useState)(null),M=(e,t)=>t?(0,i.snapTo)(e,w):Math.round(e),z=[...S,...k].map(e=>({id:e.id,x:e.x,y:e.y,w:e.w,h:e.h})),F=(e,t,o,n)=>(0,i.snapMove)(e,e.x+t,e.y+o,z,{grid:w,snap:v,free:n});let $=[],_=[];const N=(0,n.useRef)(null),W=new Set;for(const e of S)for(const t of S)e.id!==t.id&&e.xt.x&&e.yt.y&&W.add(e.id);const D=e=>{if(A?.id!==e.id||!R)return e;const t=A.dx/R,o=A.dy/R;if('move'===A.kind){const n=F(e,t,o,A.free);return $=n.guides,_=n.spacing,{...e,x:n.x,y:n.y}}const n=v&&!A.free;return{...e,w:(0,a.clamp)(M(e.w+t,n),25,a.PLAN_W-e.x),h:(0,a.clamp)(M(e.h+o,n),25,a.PLAN_H-e.y)}},P=(e,t,o)=>({onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>!0,onResponderTerminationRequest:()=>!1,onResponderGrant:e=>{N.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY,moved:!1}},onResponderMove:n=>{const r=N.current;if(!r)return;const i=n.nativeEvent.pageX-r.x,s=n.nativeEvent.pageY-r.y;!r.moved&&Math.abs(i)+Math.abs(s)<6||(r.moved=!0,b&&b.id===t.id||g({kind:e,id:t.id}),E({id:t.id,kind:o,dx:i,dy:s,free:f(n)}))},onResponderRelease:n=>{const r=N.current;if(N.current=null,E(null),!r||!r.moved||!R)return void('move'===o&&g({kind:e,id:t.id}));const i=(n.nativeEvent.pageX-r.x)/R,s=(n.nativeEvent.pageY-r.y)/R,l=f(n),u=v&&!l;if('move'===o){const o=F(t,i,s,l);x(e,t.id,o.x,o.y)}else y(e,t.id,(0,a.clamp)(M(t.w+i,u),'table'===e?50:25,a.PLAN_W-t.x),(0,a.clamp)(M(t.h+s,u),'table'===e?50:25,a.PLAN_H-t.y))}}),T=(e,t)=>(0,c.jsx)(s.default,{testID:"resize-handle",accessibilityRole:"adjustable",accessibilityLabel:"Drag to resize",...P(e,t,'resize'),style:{position:'absolute',left:I(t.x+t.w)-22,top:I(t.y+t.h)-22,width:44,height:44,alignItems:'center',justifyContent:'center',zIndex:80,cursor:'nwse-resize',touchAction:'none'},children:(0,c.jsx)(s.default,{style:{width:26,height:26,borderRadius:13,backgroundColor:l.colours.gold,borderWidth:3,borderColor:'#FFFFFF'}})}),H=w,O=4*w,B=S.map(e=>({t0:e,t:D(e)})),X=k.map(e=>({f0:e,f:D(e)}));return(0,c.jsx)(s.default,{testID:"designer-canvas",style:{flex:1,alignSelf:'stretch',minHeight:240},onLayout:e=>L({w:e.nativeEvent.layout.width,h:e.nativeEvent.layout.height}),children:R?(0,c.jsxs)(s.default,{style:{width:I(a.PLAN_W),height:I(a.PLAN_H),alignSelf:'center',backgroundColor:(0,t.soutersSurface)('#0C0B09'),borderRadius:14,borderWidth:1.5,borderColor:'#4A3F2C',overflow:'hidden'},children:[(0,c.jsx)(s.default,{accessibilityLabel:"Empty floor (tap to clear selection)",onStartShouldSetResponder:()=>!0,onResponderRelease:()=>g(null),style:{position:'absolute',left:0,top:0,right:0,bottom:0}}),Array.from({length:a.PLAN_W/H-1},(e,t)=>(0,c.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',left:I((t+1)*H),top:0,bottom:0,width:1,backgroundColor:(t+1)*H%O===0?'#2A251C':'#17150F'}},`v${t}`)),Array.from({length:a.PLAN_H/H-1},(e,t)=>(0,c.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',top:I((t+1)*H),left:0,right:0,height:1,backgroundColor:(t+1)*H%O===0?'#2A251C':'#17150F'}},`h${t}`)),X.map(({f0:e,f:t})=>{const o='fixture'===b?.kind&&b.id===t.id;return(0,c.jsxs)(r.default.Fragment,{children:[(0,c.jsx)(h.FixtureShape,{f:t,S:I,selected:o}),(0,c.jsx)(s.default,{testID:`fixture-${t.kind}`,accessibilityRole:"button",accessibilityLabel:`${t.kind}, drag to move`,...P('fixture',e,'move'),style:{position:'absolute',left:I(t.x)-4,top:I(t.y)-4,width:I(t.w)+8,height:I(t.h)+8,zIndex:5,cursor:'grab',touchAction:'none'}}),o?T('fixture',t):null]},t.id)}),e.joins.map(e=>{const t=S.filter(t=>e.tables.includes(t.name)).map(D);if(t.length<2)return null;const[o,n]=t,r=o.x+o.w/2,i=o.y+o.h/2,a=n.x+n.w/2,l=n.y+n.h/2,u=Math.hypot(a-r,l-i),h=Math.atan2(l-i,a-r);return(0,c.jsx)(s.default,{pointerEvents:"none",testID:`join-${e.tables.join('+')}`,style:{position:'absolute',left:I((r+a)/2-u/2),top:I((i+l)/2)-3,width:I(u),height:6,borderRadius:3,backgroundColor:'rgba(207,164,95,0.6)',transform:[{rotate:`${h}rad`}],zIndex:6}},e.id)}),B.map(({t0:e,t:n})=>{const i='table'===b?.kind&&b.id===n.id,p=j===n.id,f=A?.id===n.id,g=(0,a.tableLabel)(n),x=(0,h.fitLabel)(Math.max(12,Math.min(26,I(Math.min(n.w,n.h))/2.6)),g,I(n.w)*('round'===n.shape?.85:1));return(0,c.jsxs)(r.default.Fragment,{children:[(0,h.seatSpots)(n).map((e,o)=>(0,c.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',zIndex:9,left:I(n.x+e.x)-Math.max(4,I(7)),top:I(n.y+e.y)-Math.max(4,I(7)),width:Math.max(8,I(14)),height:Math.max(8,I(14)),borderRadius:3,borderWidth:1.5,borderColor:'rgba(207,164,95,0.75)',backgroundColor:(0,t.soutersSurface)('#0C0B09')}},o)),(0,c.jsxs)(s.default,{testID:`dtable-${n.name}`,accessibilityRole:"button",accessibilityLabel:`Table ${(0,o.tableNumbers)(g)}${g!==n.name?` (number ${n.name})`:''}, ${n.maxSeats} seats, ${(0,a.shapeLabel)(n.shape).toLowerCase()}${W.has(n.id)?', overlapping another table':''}`,...P('table',e,'move'),style:{position:'absolute',left:I(n.x),top:I(n.y),width:I(n.w),height:I(n.h),zIndex:f?70:10,borderRadius:'round'===n.shape?I(Math.min(n.w,n.h))/2:I(8),backgroundColor:i?'#2A2216':'#15120D',borderWidth:i||p?3:2,borderColor:W.has(n.id)?l.colours.red:i?'#FFFFFF':p?l.colours.blue:l.colours.gold,alignItems:'center',justifyContent:'center',cursor:'grab',touchAction:'none',shadowColor:l.colours.gold,shadowOpacity:i?.45:0,shadowRadius:12,opacity:f?.92:1},children:[(0,c.jsx)(u.T,{weight:"bold",size:x,colour:l.colours.goldLight,center:!0,numberOfLines:1,children:g}),I(n.h)>46?(0,c.jsxs)(u.T,{size:Math.max(10,.5*x),colour:l.colours.muted,center:!0,children:[n.maxSeats," seat",1===n.maxSeats?'':'s',n.online?'':' \xb7 staff']}):null]}),i?T('table',n):null]},n.id)}),A&&!A.free?$.map((e,t)=>(0,c.jsx)(s.default,{testID:"snap-guide",pointerEvents:"none",style:'x'===e.axis?{position:'absolute',zIndex:75,left:I(e.at)-.5,top:I(e.from)-8,width:1.5,height:I(e.to-e.from)+16,backgroundColor:'centre'===e.kind?l.colours.goldLight:l.colours.gold,opacity:.9}:{position:'absolute',zIndex:75,top:I(e.at)-.5,left:I(e.from)-8,height:1.5,width:I(e.to-e.from)+16,backgroundColor:'centre'===e.kind?l.colours.goldLight:l.colours.gold,opacity:.9}},`g${t}`)):null,A&&!A.free?_.map((e,o)=>e.spans.map(([n,r],i)=>(0,c.jsx)(s.default,{testID:"spacing-hint",pointerEvents:"none",style:'x'===e.axis?{position:'absolute',zIndex:76,left:I(n),top:I(e.cross)-10,width:I(r-n),height:20,borderTopWidth:1.5,borderColor:l.colours.goldLight,alignItems:'center'}:{position:'absolute',zIndex:76,top:I(n),left:I(e.cross)-10,height:I(r-n),width:20,borderLeftWidth:1.5,borderColor:l.colours.goldLight,justifyContent:'center'},children:(0,c.jsx)(s.default,{style:{backgroundColor:(0,t.soutersSurface)('#0C0B09'),paddingHorizontal:3,borderRadius:4},children:(0,c.jsx)(u.T,{size:10,colour:l.colours.goldLight,children:e.gap})})},`sp${o}-${i}`))):null,A?.free?(0,c.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',right:8,top:8,zIndex:77,backgroundColor:(0,t.soutersSurface)('#0C0B09'),borderRadius:6,paddingHorizontal:6,paddingVertical:2,borderWidth:1,borderColor:l.colours.border},children:(0,c.jsx)(u.T,{size:11,colour:l.colours.muted,children:"Moving freely (Alt / Option)"})}):null,0===S.length&&0===k.length?(0,c.jsx)(s.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:'44%'},children:(0,c.jsx)(u.T,{center:!0,colour:l.colours.muted,children:"No tables in this area yet. Add them in step 2, or use Add table."})}):null]}):null})};var t=_r(d[0]),o=_r(d[1]),n=_r(d[2]),r=e(n),i=_r(d[3]),s=e(_r(d[4])),a=_r(d[5]),l=_r(d[6]),u=_r(d[7]),h=_r(d[8]),c=_r(d[9]);let p=!1;if('undefined'!=typeof window&&window.addEventListener){const e=e=>{p=e.altKey};window.addEventListener('keydown',e),window.addEventListener('keyup',e),window.addEventListener('blur',()=>{p=!1})}const f=e=>p||!!e.nativeEvent?.altKey},886,[912,808,30,887,127,944,821,813,927,24]); +__d(function(_g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"GRID_SIZES",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"DEFAULT_GRID",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"GUIDE_PULL",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"snapTo",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"gridOf",{enumerable:!0,get:function(){return o}}),_e.snapMove=function(e,n,o,x,y){const c=y.pull??r,f=(n,r)=>({x:(0,t.clamp)(Math.round(n),0,t.PLAN_W-e.w),y:(0,t.clamp)(Math.round(r),0,t.PLAN_H-e.h)});if(y.free){return{...f(n,o),guides:[],spacing:[]}}let h=y.snap?s(n,y.grid):n,u=y.snap?s(o,y.grid):o;const d=x.filter(t=>t.id!==e.id),l=t=>{const r='x'===t?n:o,s='x'===t?e.w:e.h;let a=null;for(const e of d){const n='x'===t?e.x:e.y,o='x'===t?e.w:e.h,i=[[n,'edge'],[n+o-s,'edge'],[n+o/2-s/2,'centre'],[n-s,'edge'],[n+o,'edge']];for(const[t,e]of i){const n=Math.abs(r-t);n<=c&&(!a||nt.areaId===r);if(!a.length)return e;const i=(e.fixtures??[]).filter(t=>t.areaId===r).map(t=>({id:t.id,x:t.x,y:t.y,w:t.w,h:t.h})),c=new Map,f=(e,n)=>(0,t.clamp)(n,0,t.PLAN_W-e.w),h=(e,n)=>(0,t.clamp)(n,0,t.PLAN_H-e.h);for(const t of y(a)){const e=t.reduce((t,e)=>t+e.y+e.h/2,0)/t.length,n=s(e,o),r=t.map(t=>t.h),a=t.map(t=>t.y).sort((t,e)=>t-e),i=s(a[Math.floor(a.length/2)],o),y=Math.max(...r)-Math.min(...r)<=2*o,u=t=>h(t,y?i:Math.round(n-t.h/2)),d=t.map(t=>({...t,x:f(t,s(t.x,o)),y:u(t)}));let l=d;if(t.length>=3){const e=d[0],n=d[d.length-1],r=d.reduce((t,e)=>t+e.w,0),a=(n.x+n.w-e.x-r)/(t.length-1);if(a>=0){let t=e.x;l=d.map(e=>{const n={...e,x:f(e,s(t,5))};return t+=e.w+a,n}),l.some((t,e)=>Math.abs(t.x-d[e].x)>2*o)&&(l=d)}}const g=t=>t.some((e,n)=>t.some((t,r)=>nc.set(t.id,{x:t.x,y:t.y}))}let u=a.map(t=>({...t,...c.get(t.id)??{}}));for(let t=0;t<5;t++){let t=!1;if(u=u.map((e,n)=>{const r=a[n];if(e.x===r.x&&e.y===r.y)return e;return u.some((t,s)=>s!==n&&x(e,t)&&!x(r,a[s]))||i.some(t=>x(e,t)&&!x(r,t))?(t=!0,r):e}),!t)break}const d=new Map(u.map(t=>[t.id,t]));return{...e,tables:e.tables.map(t=>{const e=d.get(t.id);return e?{...t,x:e.x,y:e.y}:t})}},Object.defineProperty(_e,"backupOf",{enumerable:!0,get:function(){return c}}),_e.restoreFrom=function(t,e){return{...t,tables:t.tables.map(t=>{const n=e.tables.find(e=>e.id===t.id)??e.tables.find(e=>e.name===t.name);return n?{...t,x:n.x,y:n.y}:t})}},Object.defineProperty(_e,"movedCount",{enumerable:!0,get:function(){return f}}),_e.onlyPositionsChanged=function(t,e){if(t.tables.length!==e.tables.length)return!1;const n=t=>JSON.stringify({...t,x:0,y:0});return t.tables.every((t,r)=>n(t)===n(e.tables[r]))&&JSON.stringify(t.areas)===JSON.stringify(e.areas)&&JSON.stringify(t.joins)===JSON.stringify(e.joins)&&JSON.stringify(t.sections)===JSON.stringify(e.sections)&&JSON.stringify(t.fixtures??[])===JSON.stringify(e.fixtures??[])};var t=_r(_d[0]);const e=[10,25,50],n=25,r=8,s=(t,e)=>Math.round(t/e)*e,o=t=>e.includes(t)?t:n;function a(t,e){const n=[],r=t=>{if(n.some(e=>e.axis===t.axis&&e.at===t.at)){const e=n.find(e=>e.axis===t.axis&&e.at===t.at);e.from=Math.min(e.from,t.from),e.to=Math.max(e.to,t.to)}else n.push(t)};for(const n of e){const e=[[t.x,n.x,'edge'],[t.x+t.w,n.x+n.w,'edge'],[t.x,n.x+n.w,'edge'],[t.x+t.w,n.x,'edge'],[t.x+t.w/2,n.x+n.w/2,'centre']];for(const[s,o,a]of e)Math.abs(s-o)<.5&&r({axis:'x',at:s,from:Math.min(t.y,n.y),to:Math.max(t.y+t.h,n.y+n.h),kind:a});const s=[[t.y,n.y,'edge'],[t.y+t.h,n.y+n.h,'edge'],[t.y,n.y+n.h,'edge'],[t.y+t.h,n.y,'edge'],[t.y+t.h/2,n.y+n.h/2,'centre']];for(const[e,o,a]of s)Math.abs(e-o)<.5&&r({axis:'y',at:e,from:Math.min(t.x,n.x),to:Math.max(t.x+t.w,n.x+n.w),kind:a})}return n}function i(t,e){const n=[],r=e=>e.yt.y,s=e=>e.xt.x,o=e.filter(e=>r(e)&&e.x+e.w<=t.x).sort((t,e)=>e.x+e.w-(t.x+t.w))[0],a=e.filter(e=>r(e)&&e.x>=t.x+t.w).sort((t,e)=>t.x-e.x)[0];if(o&&a){const e=t.x-(o.x+o.w),r=a.x-(t.x+t.w);e>0&&Math.abs(e-r)<=2&&n.push({axis:'x',gap:Math.round(e),spans:[[o.x+o.w,t.x],[t.x+t.w,a.x]],cross:t.y+t.h/2})}const i=e.filter(e=>s(e)&&e.y+e.h<=t.y).sort((t,e)=>e.y+e.h-(t.y+t.h))[0],x=e.filter(e=>s(e)&&e.y>=t.y+t.h).sort((t,e)=>t.y-e.y)[0];if(i&&x){const e=t.y-(i.y+i.h),r=x.y-(t.y+t.h);e>0&&Math.abs(e-r)<=2&&n.push({axis:'y',gap:Math.round(e),spans:[[i.y+i.h,t.y],[t.y+t.h,x.y]],cross:t.x+t.w/2})}return n}const x=(t,e)=>t.xe.x&&t.ye.y;function y(t){const e=[...t].sort((t,e)=>t.y+t.h/2-(e.y+e.h/2)),n=[];for(const t of e){const e=t.y+t.h/2,r=n[n.length-1];if(r){const n=r.reduce((t,e)=>t+e.y+e.h/2,0)/r.length,s=Math.max(12,Math.min(t.h,...r.map(t=>t.h))/2);if(Math.abs(e-n)<=s){r.push(t);continue}}n.push([t])}return n.map(t=>t.sort((t,e)=>t.x-e.x))}const c=(t,e,n,r)=>({at:e,by:n,note:r,tables:t.tables.map(t=>({id:t.id,name:t.name,x:t.x,y:t.y}))});const f=(t,e)=>t.tables.filter(t=>{const n=e.tables.find(e=>e.id===t.id);return n&&(n.x!==t.x||n.y!==t.y)}).length},887,[944]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"HOLD_SLOP_PX",{enumerable:!0,get:function(){return u.HOLD_SLOP_PX}}),_e.HoldToEdit=function({label:t="Edit plan",ms:n=2e3,onUnlock:h,onHint:f,testID:p="view-plan",big:b,quiet:k}){const[E,L]=(0,e.useState)(0),[x,w]=(0,e.useState)(!1),y=(0,e.useRef)((0,u.makeHold)(n)).current,D=(0,e.useRef)(null),j=(0,e.useRef)({onUnlock:h,onHint:f});j.current={onUnlock:h,onHint:f};const C=(0,e.useRef)(0),H=(0,e.useRef)(null),I=()=>{D.current&&clearInterval(D.current),D.current=null},T=e=>{const t=y.up();I(),L(0),e&&null!=t&&Date.now()-t{const e=H.current;if(!e||!e.addEventListener)return I;const t=e.style;t.touchAction='none',t.userSelect='none',t.webkitUserSelect='none',t.webkitTouchCallout='none',t.webkitTapHighlightColor='transparent';const n=t=>{if(!(t.button>0)){try{e.setPointerCapture(t.pointerId)}catch{}var n,o;n=t.clientX,o=t.clientY,I(),y.down(n,o,Date.now()),L(.001),D.current=setInterval(()=>{const e=y.tick(Date.now());if(!y.active()&&e<1)return I(),void L(0);L(e),e>=1&&(I(),L(0),C.current=Date.now()+1500,j.current.onUnlock())},40)}},o=e=>y.move(e.clientX,e.clientY),s=e=>T('mouse'!==e.pointerType),l=()=>T(!1),c=e=>{e.preventDefault()},u=()=>{Date.now(){'Enter'!==e.key&&' '!==e.key||(e.preventDefault(),w(!0))},h={passive:!1};return e.addEventListener('pointerdown',n),e.addEventListener('pointermove',o),e.addEventListener('pointerup',s),e.addEventListener('pointercancel',l),e.addEventListener('contextmenu',c),e.addEventListener('selectstart',c),e.addEventListener('touchstart',c,h),e.addEventListener('dragstart',c),e.addEventListener('click',u),e.addEventListener('keydown',v),()=>{I(),e.removeEventListener('pointerdown',n),e.removeEventListener('pointermove',o),e.removeEventListener('pointerup',s),e.removeEventListener('pointercancel',l),e.removeEventListener('contextmenu',c),e.removeEventListener('selectstart',c),e.removeEventListener('touchstart',c,h),e.removeEventListener('dragstart',c),e.removeEventListener('click',u),e.removeEventListener('keydown',v)}},[]);const _=E>0,P=k?{...c.look.quiet(!1),borderColor:_?s.colours.gold:'rgba(255,255,255,0.10)',backgroundColor:'rgba(255,255,255,0.025)',flexGrow:1,minWidth:130,minHeight:44,overflow:'hidden',userSelect:'none'}:{minHeight:b?60:48,minWidth:150,borderRadius:16,borderWidth:1.5,borderColor:_?s.colours.gold:s.colours.border,overflow:'hidden',justifyContent:'center',paddingHorizontal:14,backgroundColor:s.colours.surface,userSelect:'none'},S={testID:p,accessible:!0,accessibilityRole:'button',accessibilityLabel:`${t}, locked. Double-tap to unlock with a confirm, or press and hold for 2 seconds.`},U=(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(o.default,{testID:"hold-progress",pointerEvents:"none",style:{position:'absolute',left:0,top:0,bottom:0,width:`${Math.round(100*E)}%`,backgroundColor:s.colours.gold,opacity:.85}}),(0,v.jsxs)(o.default,{pointerEvents:"none",style:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8},children:[(0,v.jsx)(l.T,{size:k?14:b?18:16,children:'\ud83d\udd11'}),(0,v.jsxs)(o.default,{children:[(0,v.jsx)(l.T,{size:k?14:b?17:15,weight:"semibold",colour:_&&E>.5?s.colours.onGold:k?s.colours.muted:s.colours.goldLight,children:_?'Keep holding\u2026':t}),(0,v.jsx)(l.T,{size:k?10:11,colour:_&&E>.5?s.colours.onGold:k?'#857D6E':s.colours.muted,children:_?`${Math.max(0,Math.ceil((1-E)*n/1e3))} s`:'Hold 2 s to unlock'})]})]})]});return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(o.default,{ref:H,...S,tabIndex:0,style:P,children:U}),(0,v.jsxs)(l.Sheet,{visible:x,onClose:()=>w(!1),title:`Unlock ${t}?`,maxWidth:420,testID:"unlock-confirm",children:[(0,v.jsx)(l.T,{colour:s.colours.muted,children:"The table plan can then be changed on this Display."}),(0,v.jsxs)(o.default,{style:{flexDirection:'row',gap:10,marginTop:14},children:[(0,v.jsx)(o.default,{style:{flex:1},children:(0,v.jsx)(l.Button,{label:"Unlock",testID:"unlock-confirm-yes",onPress:()=>{w(!1),j.current.onUnlock()}})}),(0,v.jsx)(o.default,{style:{flex:1},children:(0,v.jsx)(l.Button,{label:"Cancel",kind:"secondary",testID:"unlock-confirm-no",onPress:()=>w(!1)})})]})]})]})};var e=r(d[0]);r(d[1]),r(d[2]);var t,n=r(d[3]),o=(t=n)&&t.__esModule?t:{default:t},s=r(d[4]),l=r(d[5]),c=r(d[6]),u=r(d[7]),v=r(d[8])},888,[30,122,263,127,821,813,936,889,24]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"HOLD_SLOP_PX",{enumerable:!0,get:function(){return n}}),e.makeHold=function(t,u=n){let l=null,o=0,c=0,f=!1;return{down(n,t,u){l=u,o=n,c=t,f=!1},move(n,t){null!=l&&Math.hypot(n-o,t-c)>u&&(l=null)},up(){const n=l;return l=null,n},tick(n){if(null==l||f)return 0;const u=Math.min(1,(n-l)/t);return u>=1&&(f=!0,l=null),u},active:()=>null!=l}};const n=15},889,[]); +__d(function(_g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"SLOT_W",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"ROW_H",{enumerable:!0,get:function(){return x}}),_e.Timeline=function({plan:e,bookings:k,now:w,privacy:C,onOpen:T,turnBase:v,t0:z,t1:M,height:R,pauses:$,blockedTables:E,hideNow:S,compact:I=!1}){const D=(0,r.useMemo)(()=>[{key:'__none',area:'',name:'To assign'},...e.areas.flatMap(t=>e.tables.filter(e=>e.areaId===t.id).map(e=>({key:e.name,area:t.name,name:(0,s.tableLabel)(e)})))],[e]),L=k.filter(e=>!['cancelled','noshow'].includes(e.status)),O=(0,r.useMemo)(()=>(0,a.clashes)(L,v),[L,v]),W=Math.ceil((M.getTime()-z.getTime())/9e5),_=e=>(e.getTime()-z.getTime())/9e5*y,[B,N]=(0,r.useState)(null),F=(0,r.useRef)(null),H=(0,r.useRef)(null);(0,r.useEffect)(()=>{const e=Math.max(0,_(w)-120);setTimeout(()=>H.current?.scrollTo({x:e,animated:!1}),50)},[]);const[P,A]=(0,r.useState)(''),V=(e,t)=>({onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>!0,onResponderTerminationRequest:()=>!1,onResponderGrant:e=>{F.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY}},onResponderMove:o=>{if(!F.current)return;const r=o.nativeEvent.pageX-F.current.x,l=o.nativeEvent.pageY-F.current.y;(Math.abs(l)>=6||Math.abs(r)>=6)&&N({id:e.id,row:t,dy:l})},onResponderRelease:o=>{const r=F.current;F.current=null,N(null);const l=o.nativeEvent.pageX-(r?.x??0),n=o.nativeEvent.pageY-(r?.y??0);if(Math.abs(l)<6&&Math.abs(n)<6)return void T(e);const s=D.findIndex(e=>e.key===t),d=Math.max(0,Math.min(D.length-1,s+Math.round(n/x))),h=(0,u.dragTables)(e.table,t,D[d].key);h?(i.repo.bookings.update(e.id,{table:h,tableSetHere:!0}),A(`${(0,g.privName)(e,C)} \u2192 ${(0,u.tablesWords)(h.split('+'))}, still ${(0,c.hm)((0,a.startOf)(e))}`)):Math.abs(l)>=6&&Math.abs(n)<26&&A('Times only change in Edit booking.')}}),Y=_(w);return(0,p.jsxs)(n.default,{style:{flex:1,gap:6},testID:"timeline",children:[I?(0,p.jsxs)(n.default,{testID:"timeline-instructions",style:{gap:8,alignItems:'center'},children:[(0,p.jsx)(n.default,{style:{alignSelf:'center'},children:(0,p.jsx)(f.Badge,{kind:O.size?'red':'ok',label:O.size?`${O.size} bookings clash`:'No clashes'})}),(0,p.jsx)(f.Muted,{center:!0,children:"Drag a booking up or down to another table \xb7 times change only in Edit booking"}),(0,p.jsx)(f.T,{center:!0,size:14,colour:b.colours.goldLight,children:"Swipe sideways for service times"}),P?(0,p.jsx)(n.default,{testID:"clash-count",accessibilityLabel:`clashes ${O.size}`,children:(0,p.jsx)(f.T,{center:!0,size:14,colour:b.colours.goldLight,children:P})}):null]}):(0,p.jsxs)(f.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsxs)(f.Row,{gap:8,children:[(0,p.jsx)(f.Badge,{kind:O.size?'red':'ok',label:O.size?`${O.size} bookings clash`:'No clashes'}),(0,p.jsx)(n.default,{style:{flex:1,minWidth:0},children:(0,p.jsx)(f.Muted,{children:"Drag a booking up or down to another table \xb7 times change only in Edit booking"})})]}),(0,p.jsx)(n.default,{testID:"clash-count",accessibilityLabel:`clashes ${O.size}`,children:(0,p.jsx)(f.T,{size:13,colour:b.colours.goldLight,children:P})})]}),(0,p.jsx)(n.default,{testID:"timeline-grid",style:{flex:R?void 0:1,height:R,flexShrink:I?0:void 0,flexDirection:'row',borderRadius:14,borderWidth:1,borderColor:b.colours.border,overflow:'hidden',backgroundColor:(0,t.soutersSurface)('#0F0E0C')},children:(0,p.jsxs)(l.default,{style:{flex:1},contentContainerStyle:{flexDirection:'row'},children:[(0,p.jsxs)(n.default,{style:{width:j,borderRightWidth:1,borderColor:b.colours.border,backgroundColor:b.colours.surface},children:[(0,p.jsx)(n.default,{style:{height:30,justifyContent:'center',paddingLeft:8,borderBottomWidth:1,borderColor:b.colours.border},children:(0,p.jsx)(f.T,{size:12,colour:b.colours.muted,children:"Table"})}),D.map((e,t)=>(0,p.jsxs)(n.default,{style:{height:x,justifyContent:'center',paddingLeft:8,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:t>0&&D[t-1].area!==e.area?2:0,borderTopColor:b.colours.gold},children:[(0,p.jsx)(f.T,{size:14,weight:"semibold",children:e.name}),!e.area||0!==t&&D[t-1].area===e.area?null:(0,p.jsx)(f.T,{size:10,colour:b.colours.gold,children:e.area.toUpperCase()})]},e.key))]}),(0,p.jsx)(l.default,{ref:H,horizontal:!0,style:{flex:1},children:(0,p.jsxs)(n.default,{style:{width:W*y},children:[(0,p.jsx)(n.default,{style:{height:30,flexDirection:'row',borderBottomWidth:1,borderColor:b.colours.border},children:Array.from({length:Math.ceil(W/4)},(e,t)=>(0,p.jsx)(n.default,{style:{width:Math.min(4,W-4*t)*y,justifyContent:'center',borderLeftWidth:1,borderColor:b.colours.border},children:(0,p.jsx)(f.T,{size:11,colour:b.colours.muted,numberOfLines:1,style:{paddingLeft:3},children:(0,c.hm)((0,c.addMins)(z,60*t))})},t))}),($??[]).map((e,t)=>{const o=Math.max(0,_(e.from)),r=Math.min(W*y,_(e.to));return r<=o?null:(0,p.jsx)(n.default,{testID:"tl-pause",pointerEvents:"none",style:{position:'absolute',left:o,width:r-o,top:0,bottom:0,backgroundColor:'rgba(255,181,71,0.10)',borderLeftWidth:2,borderRightWidth:2,borderColor:'rgba(255,181,71,0.55)',zIndex:1},children:(0,p.jsx)(n.default,{style:{backgroundColor:b.colours.amber,alignSelf:'flex-start',borderBottomRightRadius:6,paddingHorizontal:5},children:(0,p.jsxs)(f.T,{size:10,weight:"bold",colour:"#0B0B0B",numberOfLines:1,children:["\u23f8 ",e.label]})})},`pz${t}`)}),D.map((e,r)=>{return(0,p.jsxs)(n.default,{testID:`tl-row-${e.key}`,style:{height:x,borderBottomWidth:1,borderColor:'#211E19',borderTopWidth:r>0&&D[r-1].area!==e.area?2:0,borderTopColor:'rgba(207,164,95,0.4)'},children:[Array.from({length:Math.ceil(W/4)},(e,o)=>(0,p.jsx)(n.default,{pointerEvents:"none",style:{position:'absolute',left:4*o*y,top:0,bottom:0,width:1,backgroundColor:(0,t.soutersSurface)('#1E1B16')}},o)),E?.includes(e.key)?(0,p.jsx)(n.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:0,bottom:0,backgroundColor:'rgba(58,58,58,0.55)',justifyContent:'center',paddingLeft:Math.max(6,Y+6)},children:(0,p.jsx)(f.T,{size:11,weight:"bold",colour:"#CFCFCF",children:"Table blocked"})}):null,(l=e.key,L.filter(e=>'__none'===l?!e.table:(0,s.tablesOf)(e.table).includes(l))).map(t=>{const r=B?.id===t.id&&B.row===e.key?B:null,l=_((0,a.startOf)(t)),i=Math.max(y,(0,a.durOf)(t,v)/15*y),s=O.has(t.id);return(0,p.jsx)(n.default,{testID:`tl-${t.id}`,accessibilityRole:"button",accessibilityLabel:`${(0,g.privName)(t,C)}, ${'__none'===e.key?'no table':`Table ${e.name}`}, ${t.partySize} Covers, ${(0,c.hm)((0,a.startOf)(t))}, ${(0,a.durOf)(t,v)} min${s?', clash':''}${(0,d.depositView)(t,!0)?`, ${(0,d.depositView)(t,!0).a11y}`:''}`,...V(t,e.key),style:[{position:'absolute',left:l,top:4+(r?r.dy:0),width:i,height:44,borderRadius:8,backgroundColor:(0,h.blockColour)(t),borderWidth:s?2.5:1,borderColor:s?'#FF6B5E':'rgba(0,0,0,0.4)',paddingHorizontal:6,justifyContent:'center',zIndex:r?40:2,opacity:'finished'===t.status?h.FINISHED_OPACITY:1,cursor:'ns-resize',touchAction:'none'},r?null:{transitionProperty:'left, width, top',transitionDuration:'200ms'}],children:(0,p.jsxs)(f.T,{size:14,weight:"semibold",colour:(0,h.blockTextColour)(t),numberOfLines:2,style:{lineHeight:16},children:[s?'\u26a0 ':'','__none'===e.key?'':`${(0,o.tableNumbers)(e.key)} \xb7 `,t.walkIn?'Walk-in':(0,g.privName)(t,C)," \xb7 ",t.partySize,'\n',(0,c.hm)((0,a.startOf)(t)),t.allergies.length?' \u26a0':'',(0,d.depositView)(t,!0)?i>=150?` \xb7 ${(0,d.depositView)(t,!0).label}`:'Deposit paid'===(0,d.depositShort)(t)?' \u2713':'':'']})},t.id)})]},e.key);var l}),!S&&Y>=0&&Y<=W*y?(0,p.jsx)(n.default,{testID:"now-line",pointerEvents:"none",style:{position:'absolute',left:Y,top:0,bottom:0,width:2,backgroundColor:b.colours.gold,zIndex:30},children:(0,p.jsx)(n.default,{style:{position:'absolute',top:0,left:-18,width:38,backgroundColor:b.colours.gold,borderRadius:6},children:(0,p.jsx)(f.T,{size:10,weight:"bold",colour:"#0B0B0B",center:!0,children:(0,c.hm)(w)})})}):null]})})]})})]})};var t=_r(_d[0]),o=_r(_d[1]),r=_r(_d[2]);_r(_d[3]);var l=e(_r(_d[4])),n=e(_r(_d[5])),i=_r(_d[6]),s=_r(_d[7]),a=_r(_d[8]),d=_r(_d[9]),c=_r(_d[10]),u=_r(_d[11]),h=_r(_d[12]),b=_r(_d[13]),f=_r(_d[14]),g=_r(_d[15]),p=_r(_d[16]);const y=30,x=52,j=96},890,[912,808,30,122,151,127,819,825,826,13,818,930,891,821,813,892,24]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"blockColour",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"blockTextColour",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"FINISHED_OPACITY",{enumerable:!0,get:function(){return u}});const t=t=>'seated'===t.status?'#CFA45F':'finished'===t.status?'#3A352C':t.walkIn?'#B9925A':'#7A5C2E',n=t=>'seated'===t.status||t.walkIn&&'finished'!==t.status?'#0B0B0B':'#EAF4FF',u=.8},891,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"initials",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"shortName",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"pv",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"privName",{enumerable:!0,get:function(){return o}});const t=t=>t.replace(' (example)','').split(/\s+/).filter(Boolean).map(t=>`${t[0].toUpperCase()}.`).join(' '),n=t=>{const n=t.replace(' (example)','').split(/\s+/).filter(Boolean);return n.length<=1?n.length?n[0]:'':[n[0],...n.slice(1).map(t=>`${t[0].toUpperCase()}.`)].join(' ')},l=(t,l)=>t?l?n(t):t.replace(' (example)',''):'',o=(t,n)=>t.walkIn?`Walk-in ${t.ref}`:l(t.name,n)},892,[]); +__d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.Screensaver=function({rid:e,idleMins:t,pinOn:n,wake:s,tonightCards:c}){const[u,l]=(0,o.useState)(!1),[d,f]=(0,o.useState)(!1),[p,h]=(0,o.useState)(''),w=(0,o.useRef)(Date.now()),_=(0,o.useRef)(!1),j=(0,o.useRef)(0);_.current=u,(0,o.useEffect)(()=>(v.useScreensaverAsleep.getState().set(u),()=>v.useScreensaverAsleep.getState().set(!1)),[u]);const D=6e4*t;(0,o.useEffect)(()=>S?(0,b.keepFullscreen)():void 0,[]),(0,o.useEffect)(()=>{if(!S)return;const e=e=>'pointerdown'===e.type||'touchstart'===e.type||'mousedown'===e.type||'keydown'===e.type,t=t=>{const n=performance.now();return _.current&&e(t)?(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation?.(),j.current=n+800,_.current=!1,window.__ccWokeAt=n,l(!1),L.current&&f(!0),void(w.current=Date.now())):n{w.current=0});const n=['pointerdown','pointerup','mousedown','mouseup','touchstart','touchend','click','keydown','wheel'];n.forEach(e=>window.addEventListener(e,t,{capture:!0,passive:!1}));const o=setInterval(()=>{!_.current&&!P.current&&Date.now()-w.current>=D&&(_.current=!0,l(!0))},1e3);return()=>{n.forEach(e=>window.removeEventListener(e,t,{capture:!0})),clearInterval(o)}},[D]);const L=(0,o.useRef)(n);L.current=n;const P=(0,o.useRef)(d);return P.current=d,(0,o.useEffect)(()=>{if(!S)return;let e=null;const t=async()=>{try{e=await(navigator.wakeLock?.request?.('screen')),window.__ccWakeLock=e?'on':'unsupported'}catch{window.__ccWakeLock='refused'}};t();const n=()=>{'visible'===document.visibilityState&&t()};return document.addEventListener('visibilitychange',n),()=>{document.removeEventListener('visibilitychange',n);try{e?.release?.()}catch{}}},[]),d?(0,E.jsx)(x,{wake:s,entry:p,setEntry:h,onOk:()=>{f(!1),h(''),w.current=Date.now(),s.pinDefault&&(0,y.notify)({id:'wake-pin-default',tone:'warn',icon:'\ud83d\udd11',title:'Change the wake PIN',body:'This Display still uses the starting PIN (2580). A manager should set a new 6 to 8 digit PIN in Settings \u203a Display.',timeoutMs:12e3})}}):u?(0,E.jsx)(I,{rid:e,tonightCards:c}):null};var t=r(_d[0]),n=r(_d[1]),o=r(_d[2]),s=e(r(_d[3])),c=e(r(_d[4]));r(_d[5]);var u=e(r(_d[6])),l=e(r(_d[7])),d=e(r(_d[8])),f=r(_d[9]),p=r(_d[10]),h=r(_d[11]),w=r(_d[12]),y=r(_d[13]),v=r(_d[14]),b=r(_d[15]),k=r(_d[16]),E=r(_d[17]);const S='undefined'!=typeof window;function x({wake:e,entry:t,setEntry:o,onOk:s}){const c=e.pinLen||4,d=n=>{const u=(t+n).slice(0,c);o(u),u.length===c&&((0,w.wakePinMatches)(e,u)?s():setTimeout(()=>o(''),300))};return(0,E.jsxs)(l.default,{testID:"wake-pin",style:{position:S?'fixed':'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e5,backgroundColor:(0,n.soutersSurface)('rgba(5,5,5,0.97)'),alignItems:'center',justifyContent:'center',gap:16},children:[(0,E.jsx)(h.T,{size:22,weight:"semibold",colour:f.colours.gold,children:"Enter staff PIN"}),(0,E.jsxs)(h.T,{size:30,weight:"bold",children:['\u25cf'.repeat(t.length),'\u25cb'.repeat(Math.max(0,c-t.length))]}),(0,E.jsx)(l.default,{style:{flexDirection:'row',flexWrap:'wrap',width:252,gap:12,justifyContent:'center'},children:['1','2','3','4','5','6','7','8','9','0'].map(e=>(0,E.jsx)(u.default,{accessibilityRole:"button",accessibilityLabel:`PIN ${e}`,onPress:()=>d(e),style:{width:72,height:72,borderRadius:36,borderWidth:2,borderColor:f.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,E.jsx)(h.T,{size:26,colour:f.colours.gold,children:e})},e))})]})}function I({rid:e}){const{width:n,height:u}=(0,d.default)(),l=(0,p.useBrand)(e),w=p.HERO_LOGOS[e]??l.logo,y=(0,o.useRef)(new s.default.Value(0)).current;(0,o.useEffect)(()=>{s.default.timing(y,{toValue:1,duration:700,useNativeDriver:!1}).start()},[]);const v=.5*Math.min(n,u);return(0,E.jsx)(s.default.View,{testID:"screensaver",accessibilityLabel:"Screensaver \u2014 touch to wake",style:{position:S?'fixed':'absolute',left:0,top:0,right:0,bottom:0,zIndex:1e5,backgroundColor:'abbotsford'===e?'#32373C':'kirkton'===e?'#0B0B0B':'greenside'===e?'#1A1A1A':'wildings'===e?'#272A2F':t.IS_SOUTERS?f.colours.bg:'#000000',opacity:y,overflow:'hidden',cursor:'pointer',alignItems:'center',justifyContent:'center'},children:w?(0,E.jsx)(c.default,{source:w,style:{width:v,height:v},resizeMode:"contain",accessibilityLabel:`${l.name} logo`}):(0,E.jsx)(h.T,{size:48,weight:"bold",colour:f.colours.gold,children:l.name})})}},893,[5,912,30,120,196,122,263,127,287,821,860,813,945,946,916,894,2,24]); +__d(function(g,_r,i,a,m,e,_d){"use strict";function n(){if('undefined'!=typeof document&&!c())try{const n=document;if(n.fullscreenElement||n.webkitFullscreenElement)return;const t=document.documentElement,c=t.requestFullscreen??t.webkitRequestFullscreen;if('function'!=typeof c)return;const u=t.requestFullscreen?t.requestFullscreen({navigationUI:'hide'}):c.call(t);u&&'function'==typeof u.catch&&u.catch(()=>{})}catch{}}Object.defineProperty(e,'__esModule',{value:!0}),e.enterFullscreen=n,Object.defineProperty(e,"FULLSCREEN_TAP_EVENTS",{enumerable:!0,get:function(){return t}}),e.inTabletApp=c,e.keepFullscreen=function(){if('undefined'==typeof document||c())return()=>{};const t=()=>{'hidden'!==document.visibilityState&&n()};t();const u=()=>t(),r=()=>{const n=document;n.fullscreenElement||n.webkitFullscreenElement?window.__ccFullscreen='on':window.__ccFullscreen='off, next tap'};return document.addEventListener('visibilitychange',u),document.addEventListener('fullscreenchange',r),document.addEventListener('webkitfullscreenchange',r),()=>{document.removeEventListener('visibilitychange',u),document.removeEventListener('fullscreenchange',r),document.removeEventListener('webkitfullscreenchange',r)}},_r(_d[0]);const t=['pointerup','touchend','click','keydown'];function c(){return'undefined'!=typeof navigator&&/CoverChargeTablet\//.test(navigator.userAgent||'')}},894,[122]); +__d(function(g,r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.guestDeposit=l,e.guestRowText=function(o,s){const p=o.partySize,u=`${p} ${1===p?'person':'people'}`,b=(0,n.tablesOf)(o.table??void 0),$=s.seated?"Seated"+(b.length?` \xb7 ${(0,t.tableNumbers)(o.table)}`:''):b.length?(0,t.tableNumbers)(o.table):'No table yet',c=l(o),f=b.length?`table${b.length>1?'s':''} ${d(b.map(t.plainTableNumber))}`:'no table yet',x=!!o.dog,D=[o.time,s.name,u,s.seated?'seated':'',c?.spoken??'',f,x?'dog':''].filter(Boolean).join(', ')+'.';return{time:o.time,name:s.name,people:u,deposit:c?.text??null,depositWarn:!!c?.warn,table:$,dog:x,a11y:D}};var t=r(_d[0]),o=r(_d[1]),n=r(_d[2]);const s=t=>`\xa3${(t/100).toFixed(t%100?2:0)}`,p=t=>`${(t/100).toFixed(t%100?2:0)} pounds`,d=t=>t.length<=1?t.join(''):`${t.slice(0,-1).join(', ')} and ${t[t.length-1]}`;function l(t){const n=(0,o.depositBadge)(t,s);if(!n)return null;const d=(0,o.wixPayStatus)(t),l=t.depositPaid??0,u=t.depositDue??0;if('PARTIALLY_PAID'===d||l>0&&u>l&&!n.label.startsWith('Deposit paid')){const t=l||0;return t>0&&u>t?{text:`Deposit ${s(t)} of ${s(u)} paid`,spoken:`deposit ${p(t).replace(' pounds','')} of ${p(u)} paid`,warn:!0}:{text:'Deposit part paid',spoken:'deposit part paid',warn:!0}}const b=n.label.match(/\xa3[\d.,]+/);if(n.label.startsWith('Deposit paid')){const t=/about/.test(n.label);return b?{text:`Deposit paid ${t?'about ':''}${b[0]}`,spoken:`deposit ${t?'about ':''}${b[0].slice(1)} pounds paid`,warn:!1}:{text:'Deposit paid',spoken:'deposit paid',warn:!1}}return/refund/.test(n.label)?{text:'Deposit refunded',spoken:'deposit refunded',warn:!1}:/link sent/.test(n.label)?{text:'Deposit not paid yet',spoken:'deposit not paid yet',warn:!0}:b?{text:`Deposit ${b[0]} not paid`,spoken:`deposit ${b[0].slice(1)} pounds not paid`,warn:!0}:{text:'Deposit not paid',spoken:'deposit not paid',warn:!0}}},895,[808,13,825]); +__d(function(g,r,i,a,m,_e,d){"use strict";function l(l){return l&&l.__esModule?l:{default:l}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.DogIcon=function({size:l=18,colour:u=t.colours.gold,testID:f}){return(0,o.jsx)(e.default,{testID:f,accessible:!0,accessibilityRole:"image",accessibilityLabel:"Dog",style:{width:l,height:l},children:(0,o.jsxs)(c.default,{width:l,height:l,viewBox:"0 0 24 24",children:[(0,o.jsx)(s.Path,{d:"M5.2 4.5 C2.6 4.8 1.6 8.6 2.4 11.8 C2.8 13.3 4.6 13.2 5.1 11.8 L6.6 7.4 Z",fill:u}),(0,o.jsx)(s.Path,{d:"M18.8 4.5 C21.4 4.8 22.4 8.6 21.6 11.8 C21.2 13.3 19.4 13.2 18.9 11.8 L17.4 7.4 Z",fill:u}),(0,o.jsx)(s.Path,{d:"M12 4.2 C8.3 4.2 6 6.9 6 10.8 C6 15.6 8.6 20 12 20 C15.4 20 18 15.6 18 10.8 C18 6.9 15.7 4.2 12 4.2 Z",fill:u}),(0,o.jsx)(s.Circle,{cx:9.6,cy:10.4,r:1.1,fill:t.colours.bg}),(0,o.jsx)(s.Circle,{cx:14.4,cy:10.4,r:1.1,fill:t.colours.bg}),(0,o.jsx)(s.Ellipse,{cx:12,cy:15.2,rx:1.9,ry:1.4,fill:t.colours.bg})]})})},r(d[0]);var e=l(r(d[1])),s=r(d[2]),c=l(s),t=r(d[3]),o=r(d[4])},896,[30,127,947,821,24]); +__d(function(_g,r,i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GuestActionsSheet=function({rid:e,b:$,name:x,view:j,now:D,onClose:C,onDetails:P,onDone:B,otherDay:I,turnBase:S=90,onPickOnPlan:v}){const[L,T]=(0,t.useState)(!1),[N,W]=(0,t.useState)(!1),[_,z]=(0,t.useState)(!1),M=(0,u.guestRowText)($,{name:x,seated:'seated'===$.status&&!I}),A=I?[]:(0,b.guestActions)($,x,j,D).filter(e=>'details'!==e.id),G=(0,y.tableActions)($,x),O={id:'details',label:'Guest details',a11y:`Guest details, ${x}`},F=async s=>{const t={...$,table:s};s!==$.table&&await c.repo.bookings.update($.id,{table:s}),await(0,o.seatBookingNow)(e,t),B(`${x} seated at ${(0,b.tableWords)(s)}.`),C()},H=async s=>'seat'===s.id&&s.table?F(s.table):'pick'===s.id?T(e=>!e):'details'===s.id?(C(),P($)):'finished'===s.id?('seated'===$.status?await(0,o.finishBookingNow)(e,$):await c.repo.bookings.setStatus($.id,'finished'),B('seated'===$.status&&$.table?`${x} finished. ${(0,b.tableWords)($.table).replace(/^t/,'T')} needs clearing.`:`${x} finished.`),C()):'noshow'===s.id?(await c.repo.bookings.setStatus($.id,'noshow'),B(`${x} marked as a no-show.`),C()):void 0,R=L?(0,b.freeTablesNow)(j,$.partySize).slice(0,8):[];if(N)return(0,f.jsx)(g.TablePicker,{rid:e,booking:$,name:x,turnBase:S,onClose:C,onSaved:B,onPickOnPlan:v?e=>{C(),v($,e)}:void 0});if(_)return(0,f.jsx)(h.CancelWalkInConfirm,{rid:e,b:$,onClose:C,onDone:B});const q=[...A];return(0,f.jsxs)(n.Sheet,{visible:!0,onClose:C,title:`${$.time} \xb7 ${x}`,maxWidth:560,testID:"guest-actions",children:[(0,f.jsx)(l.default,{accessible:!0,accessibilityLabel:M.a11y,testID:"guest-actions-summary",children:(0,f.jsxs)(n.T,{size:18,children:[M.people,M.deposit?(0,f.jsxs)(n.T,{size:18,weight:"semibold",colour:M.depositWarn?k.colours.amber:k.colours.goldLight,children:[" \xb7 ",M.deposit]}):null," \xb7 ",M.table]})}),(0,f.jsxs)(l.default,{style:{gap:10},children:[q.map(e=>(0,f.jsxs)(a.default.Fragment,{children:[(0,f.jsx)(n.Button,{kind:w(e),label:e.label,accessibilityLabel:e.a11y,testID:`guest-act-${e.id}`,onPress:()=>H(e),style:p}),'pick'===e.id&&e.note&&'No table yet'!==e.note?(0,f.jsxs)(n.Muted,{children:[e.note,"."]}):null,'pick'===e.id&&L?(0,f.jsxs)(l.default,{style:{gap:8},testID:"guest-pick-tables",accessibilityLabel:"Free tables",children:[0===R.length?(0,f.jsx)(n.Muted,{children:"No free tables right now."}):null,R.map(e=>(0,f.jsx)(n.Button,{kind:"secondary",label:`${(0,s.tableNumbers)(e.table)} \xb7 ${e.seats} seats`,accessibilityLabel:`Seat ${x} at table ${e.table}, ${e.seats} seats`,testID:`guest-pick-${e.table}`,onPress:()=>F(e.table),style:p},e.table))]}):null]},e.id)),G.map(s=>(0,f.jsx)(n.Button,{kind:"secondary",label:s.label,accessibilityLabel:s.a11y,testID:`guest-act-${s.id}`,style:p,onPress:async()=>{if('assign'===s.id)return W(!0);await(0,g.saveBookingTables)(e,$,[]),B(`${x}: table taken off.`),C()}},s.id)),!I&&(0,h.canCancelWalkIn)($)?(0,f.jsx)(n.Button,{kind:"secondary",label:"Cancel walk-in",accessibilityLabel:`Cancel walk-in ${$.ref}, ${$.partySize} Covers`,testID:"guest-act-cancelwalkin",onPress:()=>z(!0),style:p}):null,(0,f.jsx)(n.Button,{kind:"ghost",label:O.label,accessibilityLabel:O.a11y,testID:"guest-act-details",onPress:()=>H(O),style:p})]}),(0,f.jsx)(n.Button,{kind:"secondary",label:"Close",accessibilityLabel:"Close guest actions",testID:"guest-actions-close",onPress:C,style:p})]})};var s=r(d[0]),t=r(d[1]),a=e(t),l=e(r(d[2])),n=r(d[3]),o=r(d[4]),c=r(d[5]),b=r(d[6]),u=r(d[7]),y=r(d[8]),g=r(d[9]),h=r(d[10]),k=r(d[11]),f=r(d[12]);const p={minHeight:64},w=e=>'seat'===e.id||'pick'===e.id?'primary':'finished'===e.id?'success':'details'===e.id?'ghost':'secondary'},897,[808,30,127,813,925,819,898,895,930,929,948,821,24]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"dueOnTable",{enumerable:!0,get:function(){return a.dueOnTable}}),Object.defineProperty(e,"tableWords",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"timeHasCome",{enumerable:!0,get:function(){return u}}),e.freeTablesNow=function(t,a){const s=Object.entries(t).filter(([,t])=>'free'===t.status||'soon'===t.status),l=s.filter(([,t])=>t.table.maxSeats>=a);return(l.length?l:s).map(([t,a])=>({table:t,seats:a.table.maxSeats})).sort((t,a)=>t.seats-a.seats||t.table.localeCompare(a.table,void 0,{numeric:!0}))},e.guestActions=function(a,l,c,h){const $=[],f=(0,t.tablesOf)(a.table);if('seated'===a.status)$.push({id:'finished',label:'Finished',a11y:`Finished, ${l}${f.length?`, ${o(a.table)} will need clearing`:''}`});else if('confirmed'===a.status){const t=f.filter(t=>c[t]&&(s.includes(c[t].status)||'dirty'===c[t].status||'blocked'===c[t].status));if(f.length&&f.every(t=>c[t])&&!t.length)$.push({id:'seat',label:`Seat at ${o(a.table).replace(/^t/,'T')}`,a11y:`Seat ${l}, ${b(a.partySize)}, at ${o(a.table)}`,table:a.table});else if(u(a,h)){const s=f.length?t.length?`${o(t.join('+')).replace(/^t/,'T')} ${t.length>1?'are':'is'} ${'dirty'===c[t[0]].status?'waiting to be cleared':'blocked'===c[t[0]].status?'blocked':'in use'}`:`${o(a.table).replace(/^t/,'T')} is not on the table plan`:'No table yet';$.push({id:'pick',label:'Pick a table',a11y:`Pick a table for ${l}, ${b(a.partySize)}. ${s}.`,note:s})}u(a,h)&&$.push({id:'finished',label:'Finished',a11y:`Finished, ${l}, ${a.time} booking, without seating at a table`}),n(h,a)<=0&&$.push({id:'noshow',label:'No-show',a11y:`No-show, ${l}, ${a.time} booking`})}return $.push({id:'details',label:'Guest details',a11y:`Guest details, ${l}`}),$};var t=r(d[0]),a=r(d[1]);const s=['seated','mains','dessert','bill'],l=t=>new Date(`${t.date}T${t.time}:00`),n=(t,a)=>(l(a).getTime()-t.getTime())/6e4,o=a=>{const s=(0,t.tablesOf)(a);return s.length>1?`tables ${l=s,l.length<=1?l.join(''):`${l.slice(0,-1).join(', ')} and ${l[l.length-1]}`}`:`table ${s[0]??''}`.trim();var l},b=t=>`${t} ${1===t?'person':'people'}`,u=(t,a)=>n(a,t)<=45},898,[825,826]); +__d(function(g,_r,_i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"Card",{enumerable:!0,get:function(){return $}}),_e.ArrivalsStrip=function({todays:e,now:t,privacy:s}){const a=e.filter(e=>'confirmed'===e.status).map(e=>({b:e,m:(0,k.minsBetween)(t,new Date(`${e.date}T${e.time}:00`))})).filter(e=>e.m>=-20&&e.m<=60).sort((e,t)=>e.m-t.m);return(0,T.jsxs)(b.default,{testID:"arrivals-strip",style:{flexDirection:'row',alignItems:'center',gap:8,minHeight:40},children:[(0,T.jsx)(h.T,{size:13,weight:"semibold",colour:S.colours.gold,children:"NEXT HOUR"}),(0,T.jsxs)(c.default,{horizontal:!0,showsHorizontalScrollIndicator:!1,contentContainerStyle:{gap:6},children:[0===a.length?(0,T.jsx)(h.Muted,{children:"No arrivals due in the next hour."}):null,a.map(({b:e,m:t})=>(0,T.jsxs)(b.default,{style:{flexDirection:'row',alignItems:'center',gap:6,paddingHorizontal:10,paddingVertical:5,borderRadius:16,backgroundColor:t<0?S.colours.amberBg:'#12263D',borderWidth:1,borderColor:t<0?S.colours.amber:'#3C78B5'},children:[(0,T.jsx)(h.T,{size:13,weight:"semibold",children:e.time}),(0,T.jsxs)(h.T,{size:13,children:[(0,x.privName)(e,s)," \xb7 ",e.partySize]}),(0,T.jsx)(h.T,{size:12,colour:S.colours.muted,children:e.table?`${(0,l.tableNumbers)(e.table)}`:'no table'}),(0,T.jsx)(h.T,{size:12,colour:t<0?S.colours.amber:S.colours.blue,children:t<0?-t+"m late":0===t?'now':`in ${t}m`}),e.allergies.length?(0,T.jsx)(h.T,{size:12,children:"\u26a0"}):null,e.occasion?(0,T.jsx)(h.T,{size:12,children:w.OCCASION_ICON[e.occasion]}):null]},e.id))]})]})},_e.Legend=function(){return(0,T.jsxs)(h.Row,{wrap:!0,gap:10,style:{paddingVertical:2},children:[['free','seated','dirty'].map(e=>(0,T.jsxs)(h.Row,{gap:4,children:[(0,T.jsx)(b.default,{style:{width:12,height:12,borderRadius:4,backgroundColor:w.STATUS[e].colour}}),(0,T.jsx)(h.T,{size:12,colour:S.colours.muted,children:w.STATUS[e].label})]},e)),(0,T.jsx)(h.T,{size:12,colour:S.colours.muted,children:"\u26a0 allergy \xb7 \u2605 VIP \xb7 \u2665 regular \xb7 \ud83c\udf82 birthday \xb7 \ud83d\udc9d anniversary"})]})},_e.DetailsPanel=function({title:e,children:t,onClose:s}){const[l,a]=(0,r.useState)(20);return(0,r.useEffect)(()=>{const e=Date.now(),t=()=>a(20-Math.floor((Date.now()-e)/1e3)),s=setInterval(t,1e3),l=setTimeout(t,2e4);return()=>{clearInterval(s),clearTimeout(l)}},[]),(0,r.useEffect)(()=>{l<=0&&s()},[l]),(0,T.jsxs)(h.Sheet,{visible:!0,onClose:s,title:e,maxWidth:560,testID:"private-details",children:[(0,T.jsx)(h.Badge,{kind:"amber",label:`Private \xb7 closes in ${Math.max(0,l)}s`}),t,(0,T.jsx)(h.Button,{kind:"secondary",label:"Close now",onPress:s})]})},Object.defineProperty(_e,"bookingDetails",{enumerable:!0,get:function(){return I}}),_e.TableSheet=function({rid:e,name:t,view:a,plan:n,todays:c,now:j,privacy:v,turnBase:$,onClose:I,onWalkIn:C,onMove:B,onDetails:D}){const M=a[t],z=p.useFloor.getState(),[P,N]=(0,r.useState)(!1),[R,L]=(0,r.useState)(M?.note??''),[A,O]=(0,r.useState)(!1);if(!M)return null;const W=M.booking,H=['seated','mains','dessert','bill'].includes(M.status),F=c.filter(e=>'confirmed'===e.status).sort((e,t)=>Math.abs((0,k.minsBetween)(j,(0,w.startOf)(e)))-Math.abs((0,k.minsBetween)(j,(0,w.startOf)(t)))),E=e=>e.partySize<=M.table.maxSeats,_=M.next??M.due,G=(0,w.turnFor)(M.covers||M.table.maxSeats,$);return(0,T.jsxs)(h.Sheet,{visible:!0,onClose:I,title:`${(0,l.tableNumbers)(t)} \xb7 ${w.STATUS[M.status].label}`,maxWidth:640,testID:"table-sheet",children:['dirty'===M.status?(0,T.jsx)(h.Button,{kind:"success",label:"Mark cleared \u2014 table free",accessibilityLabel:`Mark table ${t} cleared, table free`,onPress:()=>{p.useFloor.getState().setLive(e,t,{dirty:!1,stage:void 0}),I()},testID:"mark-clean",style:{minHeight:64}}):null,(0,T.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,T.jsx)(h.Badge,{kind:"neutral",label:`${M.table.minSeats}\u2013${M.table.maxSeats} seats`}),W?(0,T.jsx)(h.Badge,{kind:"gold",label:`${(0,x.privName)(W,v)} \xb7 ${W.partySize} \xb7 ${M.seatedMins}m`}):null,W?(0,T.jsx)(h.Badge,{kind:M.seatedMins>(0,w.durOf)(W,$)?'red':'neutral',label:`Turn about ${(0,w.durOf)(W,$)} min \xb7 free about ${(0,k.hm)((0,w.endOf)(W,$))} (est.)`}):(0,T.jsx)(h.Badge,{kind:"neutral",label:`Turn estimate for ${M.table.maxSeats}: about ${G} min`}),M.next?(0,T.jsx)(h.Badge,{kind:"blue",label:`Next: ${M.next.time} ${(0,x.privName)(M.next,v)} (${M.next.partySize})`}):null,M.allergy?(0,T.jsx)(h.Badge,{kind:"red",label:"\u26a0 Allergy \u2014 see details"}):null,W??_?(0,T.jsx)(y.DepositChip,{b:W??_,money:!0,testID:"table-sheet-deposit"}):null]}),W??_?(0,T.jsx)(o.BookingTableButton,{rid:e,booking:W??_,turnBase:$,testID:"table-sheet-table-btn"}):null,W&&W.walkIn?(0,T.jsx)(i.CancelWalkInButton,{rid:e,b:W}):null,!H&&'blocked'!==M.status&&_?(0,T.jsx)(h.Button,{label:`Seat ${(0,x.privName)(_,v)}`,accessibilityLabel:`Seat ${(0,x.privName)(_,v)}, ${_.time} booking, ${_.partySize} ${1===_.partySize?'person':'people'}, at table ${t}`,testID:"seat-next-here",style:{minHeight:64},onPress:async()=>{const s=_;await f.repo.bookings.update(s.id,{table:s.table&&(0,p.tablesOf)(s.table).includes(t)?s.table:t}),await f.repo.bookings.setStatus(s.id,'seated'),(0,m.resetTableLive)(e,t),I()}}):null,!H&&'blocked'!==M.status&&_&&(0,w.startOf)(_)<=j?(0,T.jsxs)(h.Row,{gap:8,children:[(0,T.jsx)(h.Button,{kind:"success",label:"Finished",accessibilityLabel:`Finished, ${(0,x.privName)(_,v)}, ${_.time} booking, without seating`,testID:"due-finished",style:{flex:1,minHeight:56},onPress:async()=>{await f.repo.bookings.setStatus(_.id,'finished'),I()}}),(0,T.jsx)(h.Button,{kind:"secondary",label:"No-show",accessibilityLabel:`No-show, ${(0,x.privName)(_,v)}, ${_.time} booking`,testID:"due-noshow",style:{flex:1,minHeight:56},onPress:async()=>{await f.repo.bookings.setStatus(_.id,'noshow'),I()}})]}):null,H||'blocked'===M.status?null:(0,T.jsxs)(h.Row,{gap:8,children:[(0,T.jsx)(h.Button,{label:"Seat walk-in here",onPress:()=>{'dirty'===M.status&&p.useFloor.getState().setLive(e,t,{dirty:!1}),I(),C(t)},testID:"seat-walkin-here",style:{flex:1,minHeight:56}}),(0,T.jsx)(h.Button,{kind:"secondary",label:"Seat a booking",onPress:()=>O(!A),testID:"seat-booking-here",style:{flex:1,minHeight:56}})]}),A?(0,T.jsxs)(b.default,{style:{gap:6},children:[0===F.length?(0,T.jsx)(h.Muted,{children:"No bookings left to seat today."}):null,F.slice(0,8).map(s=>(0,T.jsxs)(u.default,{accessibilityRole:"button",accessibilityLabel:`Seat ${(0,x.privName)(s,v)} ${s.time}`,onPress:async()=>{await f.repo.bookings.update(s.id,{table:t}),await f.repo.bookings.setStatus(s.id,'seated'),(0,m.resetTableLive)(e,t),I()},style:{padding:10,borderRadius:10,borderWidth:1,borderColor:E(s)?S.colours.border:S.colours.amber,backgroundColor:S.colours.surface2},children:[(0,T.jsxs)(h.T,{weight:"semibold",children:[s.time," \xb7 ",(0,x.privName)(s,v)," \xb7 ",s.partySize,s.table?` \xb7 booked ${(0,l.tableNumbers)(s.table)}`:'',s.allergies.length?' \xb7 \u26a0':'']}),E(s)?null:(0,T.jsxs)(h.T,{size:12,colour:S.colours.amber,children:["Bigger than this table (",M.table.maxSeats," max)"]})]},s.id))]}):null,H?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(h.T,{size:14,colour:S.colours.muted,children:"Course / status"}),(0,T.jsx)(h.Row,{wrap:!0,gap:6,children:w.STAGES.map(s=>(0,T.jsx)(h.Chip,{label:w.STAGE_LABEL[s],selected:M.status===s,onPress:()=>z.setLive(e,t,{stage:s})},s))}),(0,T.jsxs)(h.Row,{wrap:!0,gap:8,children:[W?(0,T.jsx)(h.Button,{kind:"secondary",label:"Move party\u2026",onPress:()=>{I(),B(t)},testID:"move-party"}):null,(0,T.jsx)(h.Button,{kind:"success",label:"Clear table",testID:"clear-table",onPress:async()=>{W&&await f.repo.bookings.setStatus(W.id,'finished'),z.setLive(e,t,{stage:void 0,dirty:!0}),I()}})]})]}):null,(0,T.jsxs)(h.Row,{wrap:!0,gap:8,children:[(0,T.jsx)(h.Button,{kind:"secondary",label:'blocked'===M.status?'Unblock table':'Block table',onPress:()=>{z.setLive(e,t,{blocked:'blocked'!==M.status}),I()},testID:"block-table"}),(0,T.jsx)(h.Button,{kind:"ghost",label:M.note?'Edit note':'Note',onPress:()=>N(!P)}),W||_?(0,T.jsx)(h.Button,{kind:"ghost",label:"Guest details",onPress:()=>{I(),D(W??_)},testID:"guest-details"}):null]}),P?(0,T.jsxs)(h.Row,{gap:6,children:[(0,T.jsx)(s.TextInput,{accessibilityLabel:"Table note",value:R,onChangeText:L,placeholder:"e.g. wobbly leg, high chair here",placeholderTextColor:"#7D776C",style:[h.styles.input,{flex:1}]}),(0,T.jsx)(h.Button,{small:!0,label:"Save",onPress:()=>{z.setLive(e,t,{note:R.trim()||void 0}),N(!1)}})]}):null,v?(0,T.jsx)(h.Muted,{children:"Privacy mode: names as initials; tap Guest details for notes and allergies (closes after 20 s)."}):null,n.joins.some(e=>e.tables.includes(t))?(0,T.jsxs)(h.Muted,{children:["Joins with ",n.joins.find(e=>e.tables.includes(t)).tables.filter(e=>e!==t).join(', ')," for bigger parties (book as ",n.joins.find(e=>e.tables.includes(t)).tables.join('+'),")."]}):null]})},_e.WaitlistPanel=function({rid:e,r:t,plan:l,view:a,todays:o,waiting:i,now:n,privacy:c,busy:j,onToast:y}){const[I,C]=(0,r.useState)(''),[B,D]=(0,r.useState)(2),M=(0,p.useFloor)(e=>e.smsLog);return(0,T.jsxs)($,{title:`Waitlist (${i.length})`,right:(0,T.jsxs)(h.Muted,{children:["new party about ",(0,v.estimateWait)(i.length+1,t.settings.turnMins,j)," min"]}),testID:"waitlist-panel",children:[0===i.length?(0,T.jsx)(h.Muted,{children:"Nobody waiting."}):null,i.map((s,i)=>{const r=(0,w.suggestTable)(l,o,a,s.partySize,n,(0,w.turnFor)(s.partySize,t.settings.turnMins)),u=(0,v.estimateWait)(i+1,t.settings.turnMins,j),$=Math.max(0,(0,k.minsBetween)(new Date(s.joinedAt),n)),I=M.find(t=>t.rid===e&&t.text.includes(`#${s.number} `));return(0,T.jsxs)(b.default,{style:{backgroundColor:S.colours.surface2,borderRadius:10,padding:8,gap:4},children:[(0,T.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsxs)(h.T,{weight:"semibold",children:["#",s.number," ",(0,x.pv)(s.name,c)," \xb7 ",s.partySize]}),(0,T.jsxs)(h.T,{size:12,colour:$>u?S.colours.amber:S.colours.muted,children:["waited ",$,"m \xb7 quoted about ",u,"m"]})]}),r?(0,T.jsxs)(h.T,{size:12,colour:r.clashes?S.colours.amber:S.colours.ok,children:["Best table: ",r.table," (",r.why,")"]}):(0,T.jsx)(h.T,{size:12,colour:S.colours.amber,children:"No table big enough \u2014 join tables in the plan"}),(0,T.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,T.jsx)(h.Button,{small:!0,label:I||'notified'===s.status?'Mark as told again':'Mark as told: table ready',testID:`sms-${s.number}`,onPress:()=>{p.useFloor.getState().logSms(e,n.toISOString(),`#${s.number} ${s.partySize}: Your table at ${t.name} is ready.`),f.repo.waitlist.setStatus(s.id,'notified'),y(`DEMO \u2014 no text sent. Would say: "Your table at ${t.name} is ready."`)}}),r?(0,T.jsx)(h.Button,{small:!0,kind:"success",label:`Seat at ${r.table}`,onPress:async()=>{await f.repo.waitlist.setStatus(s.id,'seated'),await f.repo.bookings.seatWalkIn(e,s.partySize,r.table,`From waitlist #${s.number}`),(0,m.resetTableLive)(e,r.table),y(`Waitlist #${s.number} seated at ${r.table}`)}}):null,(0,T.jsx)(h.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>f.repo.waitlist.setStatus(s.id,'removed')})]}),'notified'===s.status?(0,T.jsx)(h.Badge,{kind:"ok",label:`Told table ready${I?` ${(0,k.hm)(new Date(I.at))}`:''} `}):null]},s.id)}),(0,T.jsxs)(h.Row,{gap:6,children:[(0,T.jsx)(s.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:I,onChangeText:C,style:[h.styles.input,{flex:1,minWidth:0,width:40,paddingVertical:6}]}),(0,T.jsx)(u.default,{accessibilityLabel:"Waitlist party size",onPress:()=>D(e=>e>=8?1:e+1),style:{width:48,height:48,borderRadius:10,borderWidth:1,borderColor:S.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,T.jsx)(h.T,{weight:"bold",colour:S.colours.gold,children:B})}),(0,T.jsx)(h.Button,{small:!0,label:"Add",disabled:I.trim().length<2,onPress:()=>{f.repo.waitlist.join(e,I.trim(),B),C('')}})]})]})},_e.PacePanel=function({r:e,fc:s,todays:l,now:o,walkInCount:i,staffOn:r,onSummary:n}){const u=i+l.filter(e=>['seated','finished'].includes(e.status)).reduce((e,t)=>e+t.partySize,0),c=o.getHours(),m=Math.round(s.hours.filter(e=>e.houre+t.covers,0)+(s.hours.find(e=>e.hour===c)?.covers??0)*(o.getMinutes()/60)),x=m?u/m:1,f=x>=1.1?S.colours.amber:x>=.85?S.colours.ok:S.colours.blue,p=Array.from({length:8},(e,t)=>{const s=(0,k.addMins)(o,15*(t-4)-o.getMinutes()%15),a=(0,k.addMins)(s,15),i=l.filter(e=>!['cancelled','noshow'].includes(e.status)).filter(e=>{const t=(0,w.startOf)(e);return t>=s&&te+t.partySize,0);return{from:s,covers:i,future:t>=4}}),j=Math.max(4,Math.round(e.settings.capacityPerHour/4)),y=Math.max(j,...p.map(e=>e.covers)),v=p.filter(e=>e.future&&e.covers>j),I=s.nextHour?.covers??0,C=Math.ceil(I/16);return(0,T.jsxs)($,{title:"Pace & kitchen",right:(0,T.jsx)(h.Badge,{kind:"amber",label:"ESTIMATE"}),testID:"pace-panel",children:[(0,T.jsxs)(b.default,{testID:"pace-meter",accessibilityLabel:`Covers so far ${u} vs forecast ${m}`,style:{gap:4},children:[(0,T.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(h.T,{size:14,children:"Covers so far"}),(0,T.jsxs)(h.T,{weight:"bold",colour:f,children:[u," ",(0,T.jsxs)(h.T,{size:13,colour:S.colours.muted,children:["/ about ",m," forecast"]})]})]}),(0,T.jsx)(b.default,{style:{height:10,borderRadius:5,backgroundColor:(0,t.soutersSurface)('#2A2620'),overflow:'hidden'},children:(0,T.jsx)(b.default,{style:{width:`${Math.min(100,75*x)}%`,height:10,borderRadius:5,backgroundColor:f}})}),(0,T.jsxs)(h.Muted,{children:[x>=1.1?'Ahead of forecast':x>=.85?'On pace':'Behind forecast'," \xb7 next hour about ",s.nextHour?(0,a.coversRange)(s.nextHour.coversLow,s.nextHour.coversHigh):'0 covers']})]}),(0,T.jsx)(h.T,{size:13,colour:S.colours.muted,children:"Covers seated per 15 min (last hour \xb7 next hour)"}),(0,T.jsx)(b.default,{testID:"kitchen-pacing",style:{flexDirection:'row',alignItems:'flex-end',gap:4,height:64},children:p.map((e,t)=>(0,T.jsxs)(b.default,{style:{flex:1,alignItems:'center',gap:2},children:[(0,T.jsx)(h.T,{size:10,colour:S.colours.muted,children:e.covers||''}),(0,T.jsx)(b.default,{style:{width:'80%',height:Math.max(2,e.covers/y*40),borderRadius:3,backgroundColor:e.covers>j?S.colours.red:e.future?'#6B5A3A':S.colours.gold}}),(0,T.jsx)(h.T,{size:9,colour:4===t?S.colours.gold:S.colours.muted,children:(0,k.hm)(e.from)})]},t))}),v.map(e=>(0,T.jsxs)(h.T,{size:13,colour:S.colours.amber,children:["\u26a0 Kitchen: ",e.covers," covers due ",(0,k.hm)(e.from),"\u2013",(0,k.hm)((0,k.addMins)(e.from,15))," (pace about ",j,") \u2014 stagger seating if you can."]},e.from.getTime())),C>r?(0,T.jsxs)(h.T,{size:13,colour:S.colours.amber,children:["\u26a0 Next hour about ",I," covers with ",r," on: about ",C-r," more on the floor suggested."]}):(0,T.jsxs)(h.T,{size:13,colour:S.colours.ok,children:["Staffing looks OK for the next hour (",r," on)."]}),(0,T.jsx)(h.Button,{small:!0,kind:"secondary",label:"End-of-service summary",onPress:n,testID:"eos-open"})]})},_e.ServiceSummary=function({r:e,todays:t,orders:s,waitlistAll:l,walkInCount:a,onClose:o}){const i=t.filter(e=>['seated','finished'].includes(e.status)),r=i.reduce((e,t)=>e+t.partySize,0)+a,n=t.filter(e=>e.walkIn),u=t.filter(e=>'finished'===e.status&&e.seatedAt&&e.finishedAt).map(e=>(0,k.minsBetween)(new Date(e.seatedAt),new Date(e.finishedAt))),c=(0,p.useFloor)(t=>t.smsLog.filter(t=>t.rid===e.id).length),b=(e,t)=>(0,T.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(h.T,{children:e}),(0,T.jsx)(h.T,{weight:"semibold",children:t})]},e);return(0,T.jsxs)(h.Sheet,{visible:!0,onClose:o,title:`End of service \xb7 ${e.name}`,maxWidth:560,testID:"eos-summary",children:[b('Covers served',String(r)),b('Bookings seated',`${i.filter(e=>!e.walkIn).length} of ${t.filter(e=>!e.walkIn&&'cancelled'!==e.status).length}`),b('Walk-ins',`${n.length} parties \xb7 ${n.reduce((e,t)=>e+t.partySize,0)+a} covers`),b('No-shows',String(t.filter(e=>'noshow'===e.status).length)),b('Average table time',u.length?`${Math.round(u.reduce((e,t)=>e+t,0)/u.length)} min`:'\u2014'),b('Waitlist seated',`${l.filter(e=>'seated'===e.status).length} (${l.filter(e=>'removed'===e.status).length} left)`),b('"Table ready" texts',`${c} (texts not set up yet, none sent)`),(0,T.jsx)(h.Muted,{children:"Nothing is sent anywhere: texting guests is not set up yet."})]})},Object.defineProperty(_e,"isWeb",{enumerable:!0,get:function(){return C}}),Object.defineProperty(_e,"tablesOf",{enumerable:!0,get:function(){return p.tablesOf}});var t=_r(d[0]),s=_r(d[1]),l=_r(d[2]),a=_r(d[3]),o=_r(d[4]),i=_r(d[5]),r=_r(d[6]),n=_r(d[7]);_r(d[8]);var u=e(_r(d[9])),c=e(_r(d[10])),b=e(_r(d[11])),h=_r(d[12]),m=_r(d[13]),x=_r(d[14]),f=_r(d[15]),p=_r(d[16]),j=_r(d[17]),y=_r(d[18]),w=_r(d[19]),k=_r(d[20]),v=_r(d[21]),S=_r(d[22]),T=_r(d[23]);const $=({title:e,right:t,children:s,testID:l})=>(0,T.jsxs)(b.default,{testID:l,style:{backgroundColor:S.colours.surface,borderRadius:14,borderWidth:1,borderColor:S.colours.border,padding:10,gap:6},children:[(0,T.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(h.T,{weight:"semibold",colour:S.colours.gold,children:e}),t]}),s]});const I=e=>(0,T.jsxs)(b.default,{style:{gap:6},children:[(0,T.jsxs)(h.T,{size:18,weight:"semibold",children:[e.walkIn?`Walk-in ${e.ref}`:e.name.replace(' (example)','')," \xb7 ",e.partySize]}),(0,T.jsxs)(h.Muted,{children:[e.time," \xb7 ",e.table?(0,p.tablesLabel)(e.table):'No table'," \xb7 ",e.ref,e.tags?.length?` \xb7 ${e.tags.join(', ')}`:'',e.occasion?` \xb7 ${e.occasion}`:'']}),(0,T.jsx)(y.DepositChip,{b:e,money:!0,big:!0,testID:`details-deposit-${e.id}`}),(0,T.jsx)(n.BookingNeeds,{b:e,big:!0}),e.notes?(0,T.jsxs)(h.T,{children:["Notes: ",e.notes]}):(0,T.jsx)(h.Muted,{children:"No notes."}),e.allergies.length?(0,T.jsx)(b.default,{style:{backgroundColor:S.colours.redBg,borderRadius:8,padding:8},children:(0,T.jsxs)(h.T,{weight:"bold",colour:"#FFE3DF",children:["ALLERGY: ",e.allergies.map(e=>`${(0,j.allergenLabel)(e.allergen)} \u2014 ${(0,j.severityLabel)(e.severity)}`).join('; ')]})}):(0,T.jsx)(h.Muted,{children:"No allergies declared."}),(0,T.jsx)(h.Muted,{children:"Phone and email stay in the Managers app; the Display never shows them."})]});const C=!0},899,[912,875,808,868,914,948,30,949,122,263,151,127,813,925,892,819,825,814,950,826,818,869,821,24]); +__d(function(g,_r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.PrintHost=function({rid:e}){const t=(0,l.useFloor)(t=>t.settings[e]?.printing),i=(0,o.useStore)(b),d=(0,p.usePrintStatus)(m);(0,r.useEffect)(()=>{(0,p.checkDue)(e)},[e,t,i]),(0,r.useEffect)(()=>{const t=setInterval(()=>(0,p.checkDue)(e),2e4);return()=>clearInterval(t)},[e]);const c=Object.values(d);return c.length?(0,u.jsxs)(n.default,{testID:"print-fail",accessibilityRole:"summary",style:{position:'fixed',left:12,bottom:76,zIndex:9e3,maxWidth:520,gap:8},children:[c.slice(0,3).map(t=>(0,u.jsxs)(n.default,{style:{backgroundColor:h.colours.amberBg,borderColor:h.colours.amber,borderWidth:2,borderRadius:12,padding:12,gap:6},children:[(0,u.jsxs)(s.T,{weight:"semibold",colour:h.colours.amber,children:["\u26a0 Ticket didn\u2019t print: #",t.ref," \xb7 ",t.name]}),(0,u.jsxs)(s.T,{size:14,children:[t.printer,": ",t.reason,". The order is safe and still on screen",t.tries>1?` (tried ${t.tries} times)`:'',". Read it from the screen, or print it another way."]}),(0,u.jsxs)(s.Row,{wrap:!0,gap:6,children:[(0,u.jsx)(s.Button,{small:!0,label:"Try again",testID:`print-retry-${t.ref}`,onPress:()=>(0,p.retryFail)(e,t)}),(0,u.jsx)(s.Button,{small:!0,kind:"secondary",label:"Print on this screen",onPress:()=>(0,p.printHere)(e,t)}),(0,u.jsx)(s.Button,{small:!0,kind:"ghost",label:"Done, kitchen has it",onPress:()=>(0,p.dismissFail)(e,t)})]})]},`${t.orderId}:${t.printerId}`)),c.length>3?(0,u.jsxs)(s.T,{size:13,colour:h.colours.amber,children:["+ ",c.length-3," more tickets didn\u2019t print. Check the printer."]}):null]}):null},_e.ReprintButton=function({rid:e,o:t}){const[i,o]=(0,r.useState)('');return(0,u.jsxs)(n.default,{style:{gap:4},children:[(0,u.jsx)(s.Button,{small:!0,kind:"secondary",label:"Reprint ticket",testID:`reprint-${t.ref}`,onPress:()=>{o('Printing\u2026'),(0,p.reprint)(e,t).then(e=>o(e.ok?`Sent to ${e.where}.`:`Didn\u2019t print: ${e.error??'no answer'}.`))}}),i?(0,u.jsx)(s.Muted,{size:12,children:i}):null,t.printed?(0,u.jsxs)(s.Muted,{size:12,children:["Ticket printed ",new Date(t.printed.at).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})," on ",t.printed.printer]}):null]})},_e.PrintersSettings=function({rid:e,go:p}){const b=(0,l.useFloor)(t=>t.settings[e]?.printing),m=(0,d.normPrint)(b),k=t=>{const r=l.useFloor.getState().settings[e]??l.DEFAULT_SETTINGS;l.useFloor.getState().setSettings(e,{...r,printing:t})},y=(e,t)=>k({...m,printers:m.printers.map(r=>r.id===e?(0,d.normPrinter)({...r,...t}):r)}),P=(0,c.thisDevice)(),[j,T]=(0,r.useState)({}),[S,v]=(0,r.useState)({busy:!1,text:'',found:[]}),[I,C]=(0,r.useState)([]),D=e=>k({...m,printers:[...m.printers,(0,d.normPrinter)({id:f(),name:m.printers.length?`Printer ${m.printers.length+1}`:'Kitchen printer',from:'owner'===P||'display'===P?['tablet','mac',P]:[P,...['tablet','mac'].filter(e=>e!==P)],...e})]}),B=async t=>{T(e=>({...e,[t.id]:'Printing a test ticket\u2026'}));const r=await(0,c.sendTicket)(t,(0,c.testTicket)(o.useStore.getState().restaurants.find(t=>t.id===e)?.name??'',t));T(e=>({...e,[t.id]:r.ok?'Test ticket sent. Check the printer: the \xa3 sign and the allergy lines should be clear.':`Didn\u2019t print: ${r.error}.`}))};return(0,u.jsxs)(n.default,{style:{gap:10},testID:"adv-printers-body",children:[(0,u.jsx)(s.Toggle,{testID:"print-auto",label:"Print a kitchen ticket for every takeaway order",value:m.auto,onChange:e=>k({...m,auto:e,since:e?(new Date).toISOString():m.since}),a11y:"Print a kitchen ticket for every takeaway order"}),(0,u.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,u.jsx)(s.Chip,{testID:"print-when-arrival",label:"As soon as it comes in",selected:'arrival'===m.when,onPress:()=>k({...m,when:'arrival'})}),(0,u.jsx)(s.Chip,{testID:"print-when-accept",label:"When it\u2019s accepted",selected:'accept'===m.when,onPress:()=>k({...m,when:'accept'})})]}),(0,u.jsx)(s.Muted,{size:13,children:"The ticket shows the order number, collection time, name, every dish with its options and notes, allergies in white-on-black, and whether it\u2019s paid. If a printer doesn\u2019t answer, an amber warning shows on screen and the order stays there. Nothing is lost."}),(0,u.jsxs)(s.Muted,{size:13,children:["You\u2019re on: ",d.DEVICE_LABEL[P],"."]}),m.printers.map(e=>{const r=(0,d.canDrive)(P,e);return(0,u.jsxs)(n.default,{testID:`printer-${e.id}`,style:{borderWidth:1,borderColor:h.colours.hairline,borderRadius:12,padding:12,gap:8},children:[(0,u.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(t.TextInput,{accessibilityLabel:"Printer name",value:e.name,onChangeText:t=>y(e.id,{name:t}),style:[w,{flex:1}]}),(0,u.jsx)(s.Toggle,{label:"On",value:e.on,onChange:t=>y(e.id,{on:t}),a11y:`${e.name} on`})]}),(0,u.jsx)(s.T,{size:14,weight:"semibold",children:"Type"}),(0,u.jsx)(s.Row,{wrap:!0,gap:6,children:['epson','star','escpos','bluetooth','browser'].map(t=>(0,u.jsx)(s.Chip,{label:'epson'===t?'Epson':'star'===t?'Star':'escpos'===t?'Other (port 9100)':'bluetooth'===t?'Bluetooth':'Print dialog',selected:e.kind===t,onPress:()=>y(e.id,{kind:t})},t))}),(0,u.jsx)(s.Muted,{size:12,children:d.PRINTER_KIND_LABEL[e.kind]}),'epson'===e.kind||'star'===e.kind||'escpos'===e.kind?(0,u.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,u.jsx)(t.TextInput,{accessibilityLabel:"Printer IP address",testID:`printer-ip-${e.id}`,value:e.host??'',onChangeText:t=>y(e.id,{host:t.trim()}),placeholder:"IP address, e.g. 192.168.1.50",placeholderTextColor:h.colours.muted,style:[w,{minWidth:220,borderColor:e.host&&!(0,d.hostOk)(e.host)?h.colours.amber:h.colours.hairline}]}),'escpos'===e.kind?(0,u.jsx)(t.TextInput,{accessibilityLabel:"Port",value:String(e.port??9100),onChangeText:t=>y(e.id,{port:Number(t.replace(/\D/g,''))||9100}),style:[w,{width:90}]}):(0,u.jsx)(s.Toggle,{label:"HTTPS",value:!!e.https,onChange:t=>y(e.id,{https:t}),a11y:"Use HTTPS"})]}):null,'bluetooth'===e.kind?(0,u.jsxs)(n.default,{style:{gap:6},children:[(0,u.jsx)(s.Muted,{size:13,children:e.btAddress?`Printer: ${e.btName??e.btAddress}`:'Pair the printer in the tablet\u2019s Bluetooth settings first, then choose it here.'}),(0,u.jsx)(s.Button,{small:!0,kind:"secondary",label:"Choose a paired printer",onPress:()=>{(0,c.pairedBluetooth)().then(t=>{C(t.devices),T(r=>({...r,[e.id]:t.ok?t.devices.length?'Tap your printer below.':'No paired Bluetooth devices. Pair the printer in Android Settings \u203a Bluetooth first.':t.error??''}))})}}),(0,u.jsx)(s.Row,{wrap:!0,gap:6,children:I.map(t=>(0,u.jsx)(s.Chip,{label:t.name||t.address,selected:e.btAddress===t.address,onPress:()=>y(e.id,{btAddress:t.address,btName:t.name})},t.address))})]}):null,(0,u.jsx)(s.T,{size:14,weight:"semibold",children:"Prints"}),(0,u.jsxs)(s.Row,{wrap:!0,gap:6,children:[(0,u.jsx)(s.Chip,{label:"Kitchen ticket",selected:'kitchen'===e.role,onPress:()=>y(e.id,{role:'kitchen'})}),(0,u.jsx)(s.Chip,{label:"Front-of-house ticket (with prices)",selected:'foh'===e.role,onPress:()=>y(e.id,{role:'foh'})}),(0,u.jsx)(s.Chip,{label:"Both",selected:'both'===e.role,onPress:()=>y(e.id,{role:'both'})})]}),(0,u.jsxs)(s.Row,{wrap:!0,gap:6,children:[(0,u.jsx)(s.T,{size:14,children:"Kitchen copies"}),[1,2,3].map(t=>(0,u.jsx)(s.Chip,{label:String(t),selected:e.copies===t,onPress:()=>y(e.id,{copies:t})},t)),(0,u.jsx)(s.T,{size:14,children:" Paper"}),[48,42,32].map(t=>(0,u.jsx)(s.Chip,{label:32===t?'58 mm':42===t?'80 mm (42)':'80 mm',selected:e.cols===t,onPress:()=>y(e.id,{cols:t})},t))]}),(0,u.jsx)(s.T,{size:14,weight:"semibold",children:"Which devices print to it (first one first)"}),(0,u.jsx)(s.Row,{wrap:!0,gap:6,children:x.map(t=>{const r=e.from.indexOf(t);return(0,u.jsx)(s.Chip,{label:`${r>=0?`${r+1}. `:''}${'tablet'===t?'Tablet app':'mac'===t?'Mac app':'display'===t?'Display (browser)':'Managers (browser)'}`,selected:r>=0,onPress:()=>y(e.id,{from:r>=0?e.from.filter(e=>e!==t):[...e.from,t]})},t)})}),(0,u.jsx)(s.Muted,{size:12,children:"If the first device is off, the next one prints after a few seconds. A ticket is printed once, not by every device."}),r.ok?null:(0,u.jsx)(s.Banner,{kind:"warn",title:"This device can\u2019t reach this printer",children:r.why}),(0,u.jsxs)(s.Row,{wrap:!0,gap:6,children:[(0,u.jsx)(s.Button,{small:!0,label:"Test print",testID:`printer-test-${e.id}`,disabled:!r.ok,onPress:()=>{B(e)}}),(0,u.jsx)(s.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>k({...m,printers:m.printers.filter(t=>t.id!==e.id)})})]}),j[e.id]?(0,u.jsx)(s.T,{size:13,colour:/Didn/.test(j[e.id])?h.colours.amber:h.colours.goldLight,children:j[e.id]}):null]},e.id)}),(0,u.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,u.jsx)(s.Button,{testID:"printer-add",label:"Add a printer by IP address",onPress:()=>D({kind:'epson'})}),(0,u.jsx)(s.Button,{kind:"secondary",testID:"printer-scan",label:S.busy?'Looking\u2026':'Find printers on this Wi-Fi',disabled:S.busy,onPress:()=>{v({busy:!0,text:'Looking for printers on this Wi-Fi (up to 30 seconds)\u2026',found:[]}),(0,c.scanNetwork)().then(e=>v({busy:!1,text:e.ok?e.found.length?`Found ${e.found.length}. Tap one to add it.`:'No printers found. Check the printer is on and on the same Wi-Fi, or type its IP address.':e.error??'',found:e.found}))}}),(0,u.jsx)(s.Button,{kind:"secondary",label:"Use this device\u2019s Print dialog",onPress:()=>D({kind:'browser',name:'Print dialog',from:[P]})})]}),S.text?(0,u.jsx)(s.Muted,{size:13,children:S.text}):null,(0,u.jsx)(s.Row,{wrap:!0,gap:6,children:S.found.map(e=>(0,u.jsx)(s.Chip,{label:`${e.name??('epson'===e.kind?'Epson':'star'===e.kind?'Star':'Printer')} \xb7 ${e.host}`,onPress:()=>D({kind:'epson'===e.kind?'epson':'star'===e.kind?'star':'escpos',host:e.host,port:e.port,name:e.name??'Kitchen printer'})},`${e.host}:${e.port}`))}),p?(0,u.jsx)(i.default,{accessibilityRole:"link",onPress:()=>p('more','printerhelp'),children:(0,u.jsx)(s.T,{size:14,colour:h.colours.gold,children:"How to connect a Wi-Fi or Bluetooth printer \u203a"})}):null,(0,u.jsx)(s.Muted,{size:13,children:"Tip: print a test ticket after any change, and keep a spare roll by the printer."})]})},_e.PrinterHelpPage=function(){return(0,u.jsxs)(n.default,{style:{gap:12},testID:"printer-help",children:[(0,u.jsx)(s.Muted,{children:"Printing kitchen tickets for takeaway orders, in plain words."}),k.map(e=>(0,u.jsxs)(n.default,{style:{gap:6,borderWidth:1,borderColor:h.colours.hairline,borderRadius:12,padding:12},children:[(0,u.jsx)(s.T,{size:17,weight:"semibold",colour:h.colours.gold,children:e.h}),e.p.map(e=>(0,u.jsx)(s.T,{size:15,children:e},e))]},e.h)),(0,u.jsx)(s.Muted,{size:13,children:"Tip: put the printer where the kitchen sees it first, out of the way of steam and grease."})]})};var t=_r(_d[0]),r=_r(_d[1]);_r(_d[2]);var i=e(_r(_d[3])),n=e(_r(_d[4])),s=_r(_d[5]),o=_r(_d[6]),l=_r(_d[7]),d=_r(_d[8]),h=_r(_d[9]),p=_r(_d[10]),c=_r(_d[11]),u=_r(_d[12]);const b=e=>e.orders,m=e=>e.fails;const w={minHeight:44,borderRadius:10,borderWidth:1,borderColor:h.colours.hairline,backgroundColor:h.colours.surface2,color:h.colours.text,paddingHorizontal:10,fontSize:15},f=()=>`pr-${Date.now().toString(36)}${Math.random().toString(36).slice(2,5)}`,x=['tablet','mac','display','owner'];const k=[{h:'Which printers work',p:['Epson TM-m30, TM-T20 and TM-T88 with a network port or Wi-Fi (they understand Epson ePOS-Print).','Star printers with WebPRNT on the network, e.g. TSP143IV LAN or mC-Print3.','Most other receipt printers on the network that take ESC/POS on port 9100 (from the tablet app or the Mac app).','Bluetooth receipt printers that take ESC/POS, from the Display tablet app (Android) only.','Any printer your computer or tablet already prints to, using its own Print dialog (one tap per ticket).']},{h:'Wi-Fi or network printer',p:['1. Plug the printer into your router with a network cable, or join it to your Wi-Fi using the maker\u2019s app (Epson TM Utility or Star Quick Setup).','2. Find its IP address: switch the printer off, hold the Feed button and switch it on. It prints a page with the IP address (for example 192.168.1.50).','3. Ask whoever looks after your Wi-Fi to fix (reserve) that address for the printer, so it doesn\u2019t change.','4. In Settings \u203a Advanced \u203a Printers, tap Add a printer by IP address (or Find printers on this Wi-Fi in the tablet or Mac app), choose the type and type the address.','5. Tap Test print. You should see a ticket with \xa3 signs and white-on-black allergy lines.']},{h:'Bluetooth printer (tablet app)',p:['1. Switch the printer on. On the tablet open Settings \u203a Bluetooth and pair it (the PIN is often 0000 or 1234).','2. Open the CoverCharge Display app, go to Settings \u203a Advanced \u203a Printers and tap Add a printer, then choose Bluetooth.','3. Tap Choose a paired printer and pick it. Allow Nearby devices if the tablet asks.','4. Tap Test print. Keep the printer within a few metres of the tablet.']},{h:'If a ticket doesn\u2019t print',p:['An amber warning shows on screen with the order number. The order is never lost: it stays on the Display and in Orders.','Check the printer is on, has paper, the lid is shut, and it\u2019s on the same Wi-Fi. Then tap Try again.','Print on this screen opens the device\u2019s Print dialog. Done, kitchen has it clears the warning once someone has the order.','Reprint ticket on any order prints it again, marked REPRINT.']},{h:'Web browsers',p:['A web browser can\u2019t reach port 9100 printers or Bluetooth, and can only reach Epson or Star printers over HTTPS. That means switching on HTTPS on the printer and opening https:// once to accept its certificate. The Display tablet app and CoverCharge for Mac have none of these limits, so use one of them for automatic printing.']}]},900,[875,30,122,263,127,813,819,825,901,821,902,904,24]); +__d(function(g,r,_i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DEVICE_LABEL",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"PRINTER_KIND_LABEL",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"DEFAULT_PRINT",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"normPrint",{enumerable:!0,get:function(){return i}}),e.normPrinter=s,e.canDrive=function(t,n){const o='tablet'===t||'mac'===t;return'browser'===n.kind?{ok:!0}:'bluetooth'===n.kind?'tablet'===t?{ok:!0}:{ok:!1,why:'Bluetooth printers work from the Display tablet app (Android) only.'}:'escpos'===n.kind?o?{ok:!0}:{ok:!1,why:'A web browser cannot reach port 9100. Use the Display tablet app or CoverCharge for Mac.'}:o||n.https?{ok:!0}:{ok:!1,why:'A web browser can only reach Epson or Star printers over HTTPS (switch it on below and accept the printer\u2019s certificate once). The tablet app and the Mac app need no HTTPS.'}},Object.defineProperty(e,"IPV4",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"hostOk",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"printDelayMs",{enumerable:!0,get:function(){return d}}),e.dueForTicket=function(t,n,o){if(!n.auto)return[];const i=n.since?new Date(n.since).getTime():0,s=o.getTime()-216e5;return t.filter(t=>{if('takeaway'!==t.type&&('table'!==t.type||'table-qr'!==t.channel||t.held&&!t.accepted))return!1;if(['cancelled','collected','closed','served'].includes(t.status))return!1;const o=new Date(t.createdAt).getTime();return o>=i&&o>=s&&('accept'!==n.when||(!!t.accepted||'table'===t.type))})},Object.defineProperty(e,"printedOn",{enumerable:!0,get:function(){return l}});const t={tablet:'Display tablet app (Android)',mac:'CoverCharge for Mac',display:'Display in a web browser',owner:'Managers app in a web browser'},n={epson:'Epson (ePOS-Print, e.g. TM-m30, TM-T20, TM-T88)',star:'Star (WebPRNT, e.g. TSP143IV LAN, mC-Print3)',escpos:'Other receipt printer (ESC/POS on port 9100)',bluetooth:'Bluetooth receipt printer (ESC/POS)',browser:"This device's own Print (any printer it has)"},o={auto:!1,when:'arrival',printers:[]},i=t=>({...o,...t??{},printers:Array.isArray(t?.printers)?t.printers.filter(t=>t&&'string'==typeof t.id).map(s):[]});function s(t){const n=['epson','star','escpos','bluetooth','browser'].includes(t.kind)?t.kind:'escpos';return{id:String(t.id),name:(t.name||'Kitchen printer').slice(0,40),kind:n,host:t.host?.trim()||void 0,port:'escpos'===n?t.port&&t.port>0&&t.port<65536?t.port:9100:t.port,https:!!t.https,btAddress:t.btAddress,btName:t.btName,cols:32===t.cols||42===t.cols?t.cols:48,role:'foh'===t.role||'both'===t.role?t.role:'kitchen',from:Array.isArray(t.from)&&t.from.length?t.from.filter(t=>['tablet','mac','display','owner'].includes(t)):['tablet','mac'],copies:2===t.copies||3===t.copies?t.copies:1,on:!1!==t.on}}const c=/^(25[0-5]|2[0-4]\d|1?\d?\d)(\.(25[0-5]|2[0-4]\d|1?\d?\d)){3}$/,p=t=>{const n=(t??'').trim();return!!n&&(/^[\d.]+$/.test(n)?c.test(n):/^[a-z0-9]([a-z0-9-]{0,62}\.)*[a-z0-9-]{1,63}$/i.test(n)&&!n.endsWith('-'))},d=(t,n)=>{const o=t.from.indexOf(n);return o<0?-1:8e3*o};const l=(t,n)=>!!t.printed&&(!t.printed.ids||t.printed.ids.includes(n))},901,[]); +__d(function(g,_r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"usePrintStatus",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"printSettingsOf",{enumerable:!0,get:function(){return f}}),e.printOrder=y,e.reprintTargets=b,e.reprint=async function(t,r){const n=b(t);if(!n.length){const n=m(t,r,{id:'browser',name:'Print',kind:'browser',cols:42,role:'kitchen',from:[],copies:1,on:!0},'REPRINT')[0];return{...(0,c.browserPrint)(n),where:'this device\u2019s Print'}}let o={ok:!1};for(const s of n)if(o=await y(t,r,s,{reprint:!0}),o.ok)return{ok:!0,where:s.name};return{...o,where:n.map(t=>t.name).join(', ')}},e.checkDue=function(t,n=new Date){const s=f(t);if(!s.auto)return;const l=(0,c.thisDevice)(),p=r.useStore.getState().orders.filter(r=>r.restaurantId===t),h=S(t);for(const r of(0,o.dueForTicket)(p,s,n))for(const n of s.printers){if(!n.on)continue;const s=(0,o.printDelayMs)(n,l);if(s<0||!(0,o.canDrive)(l,n).ok)continue;const c=`${r.id}:${n.id}`;(0,o.printedOn)(r,n.id)||h.has(c)||k.has(c)||u.getState().busy[c]||u.getState().fails[c]||k.set(c,setTimeout(()=>{I(t,r.id,n.id,0)},s))}},e.retryFail=function(t,n){const o=`${n.orderId}:${n.printerId}`,s=k.get(o);s&&clearTimeout(s);k.delete(o);const c=r.useStore.getState().orders.find(t=>t.id===n.orderId),l=f(t).printers.find(t=>t.id===n.printerId);if(!c||!l)return void u.getState().set(o,null);y(t,c,l)},e.printHere=function(t,n){const o=r.useStore.getState().orders.find(t=>t.id===n.orderId);if(!o)return;v(t,n);const s=f(t).printers.find(t=>t.id===n.printerId);(0,c.browserPrint)(m(t,o,{...s??{id:'b',name:'Print',cols:42,role:'kitchen',from:[],copies:1,on:!0},kind:'browser'})[0])},e.dismissFail=v;var t=_r(d[0]),r=_r(d[1]),n=_r(d[2]),o=_r(d[3]),s=_r(d[4]),c=_r(d[5]);const u=(0,t.create)()(t=>({fails:{},busy:{},set:(r,n)=>t(t=>{const o={...t.fails};return n?o[r]=n:delete o[r],{fails:o}}),setBusy:(r,n)=>t(t=>({busy:{...t.busy,[r]:n}}))})),f=t=>(0,o.normPrint)(n.useFloor.getState().settings[t]?.printing),l=t=>`cc-printed:${t}`,p=()=>{try{return globalThis.localStorage}catch{return}};function S(t){try{return new Set(JSON.parse(p()?.getItem(l(t))??'[]'))}catch{return new Set}}function h(t,r){const n=S(t);n.add(r);try{p()?.setItem(l(t),JSON.stringify([...n].slice(-400)))}catch{}}function m(t,n,o,c){const u=r.useStore.getState(),f=u.restaurants.find(r=>r.id===t)?.name,l=t=>u.menu.find(r=>r.id===t)?.allergens,p='both'===o.role?['kitchen','foh']:['foh'===o.role?'foh':'kitchen'],S=[];for(const t of p)for(let r=1;r<=('kitchen'===t?o.copies:1);r++){const u=[c,'kitchen'===t&&o.copies>1?`COPY ${r} OF ${o.copies}`:''].filter(Boolean).join(' - ')||void 0;S.push((0,s.buildTicket)(n,{venue:f,kind:t,copyLabel:u,dishAllergens:l}))}return S}async function y(t,n,o,s={}){const f=`${n.id}:${o.id}`;u.getState().setBusy(f,!0);try{for(const r of m(t,n,o,s.reprint?'REPRINT':void 0)){const t=await(0,c.sendTicket)(o,r);if(!t.ok){const r=u.getState().fails[f];return u.getState().set(f,{orderId:n.id,ref:n.ref,name:n.customerName,printer:o.name,printerId:o.id,reason:t.error??'did not print',at:(new Date).toISOString(),tries:(r?.tries??0)+1}),t}}if(u.getState().set(f,null),!s.reprint){h(t,f);const s=(0,c.thisDevice)();r.useStore.setState(t=>({orders:t.orders.map(t=>t.id===n.id?{...t,printed:{at:t.printed?.at??(new Date).toISOString(),by:t.printed?.by??s,printer:t.printed?.printer??o.name,ids:[...new Set([...t.printed?.ids??[],o.id])]}}:t)}))}return{ok:!0}}finally{u.getState().setBusy(f,!1)}}function b(t){const r=(0,c.thisDevice)();return f(t).printers.filter(t=>t.on&&'foh'!==t.role&&(0,o.canDrive)(r,t).ok)}const k=new Map,w=[15e3,45e3];async function I(t,n,s,c){const l=`${n}:${s}`,p=r.useStore.getState().orders.find(t=>t.id===n),S=f(t).printers.find(t=>t.id===s);if(!p||!S||!S.on||0===c&&(0,o.printedOn)(p,S.id)||'cancelled'===p.status)return void k.delete(l);(await y(t,p,S)).ok||c>=w.length?k.delete(l):k.set(l,setTimeout(()=>{u.getState().set(l,{...u.getState().fails[l],tries:c+1}),I(t,n,s,c+1)},w[c]))}function v(t,r){const n=`${r.orderId}:${r.printerId}`;h(t,n);const o=k.get(n);o&&clearTimeout(o),k.delete(n),u.getState().set(n,null)}},902,[951,819,825,901,903,904]); +__d(function(g,_r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TICKET_ALLERGENS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"pounds",{enumerable:!0,get:function(){return p}}),e.collectTime=d,Object.defineProperty(e,"paidState",{enumerable:!0,get:function(){return h}}),e.buildTicket=function(s,a={}){const l=a.kind??'kitchen',f=[],b=a.now??new Date,$=d(s),x='table'===s.type?(0,t.tableNumbers)(s.tableNo)||'?':null;f.push({k:'text',t:x?'kitchen'===l?`KITCHEN - ${x}`:`${x} - FRONT OF HOUSE`:'kitchen'===l?'KITCHEN - TAKEAWAY':'TAKEAWAY - FRONT OF HOUSE',align:'c',bold:!0}),a.venue&&f.push({k:'text',t:a.venue,align:'c'});a.copyLabel&&f.push({k:'text',t:` ${a.copyLabel} `,align:'c',inv:!0,bold:!0});f.push({k:'text',t:`#${s.ref}`,size:3,bold:!0,align:'c'}),x?f.push({k:'text',t:x,size:3,bold:!0,align:'c'}):(f.push({k:'text',t:$.at?`COLLECT ${$.label}`:'COLLECT ASAP',size:2,bold:!0,align:'c'}),$.at&&f.push({k:'text',t:c($.at),align:'c'}));if(f.push({k:'rule'}),f.push({k:'text',t:s.customerName||'Guest',size:2,bold:!0}),f.push({k:'text',t:`Ordered ${r(new Date(s.createdAt))}${s.channel?` - ${u[s.channel]??s.channel}`:''}${s.accepted?` - accepted by ${s.accepted.by}`:''}`}),s.allergies?.length){f.push({k:'rule',heavy:!0}),f.push({k:'text',t:' ALLERGY ALERT ',inv:!0,bold:!0,size:2,align:'c'});for(const t of s.allergies)f.push({k:'text',t:` ${i(t.allergen).toUpperCase()} - ${o[t.severity]??t.severity} `,inv:!0,bold:!0});f.push({k:'text',t:'Check every dish below before it goes out.',bold:!0}),f.push({k:'rule',heavy:!0})}else f.push({k:'rule'});let k=0;for(const t of s.lines??[]){k+=t.qty,'foh'===l?f.push({k:'pair',l:`${t.qty} x ${t.name}`,r:p(t.unitPrice*t.qty),bold:!0}):f.push({k:'text',t:`${t.qty} x ${t.name}`,size:2,bold:!0,indent:4});for(const n of t.choices??[])f.push({k:'text',t:`+ ${n}`,indent:4});t.notes&&f.push({k:'text',t:`NOTE: ${t.notes}`,bold:!0,indent:4});const o=new Set([...t.contains??[],...t.may??[]]);for(const n of t.contains??[])f.push({k:'text',t:` !! CONTAINS ${i(n).toUpperCase()} - CUSTOMER ALLERGY `,inv:!0,bold:!0,indent:4});for(const n of t.may??[])f.push({k:'text',t:` !! MAY CONTAIN ${i(n).toUpperCase()} - CUSTOMER ALLERGY `,inv:!0,bold:!0,indent:4});t.overridden&&f.push({k:'text',t:'Allergy warning overridden when ordering: check with the manager',bold:!0,indent:4});const s=a.dishAllergens?.(t.itemId);if(s){const t=n.filter(t=>'contains'===s[t.id]&&!o.has(t.id)).map(t=>t.name),i=n.filter(t=>'may'===s[t.id]&&!o.has(t.id)).map(t=>t.name);t.length&&f.push({k:'text',t:`Allergens: ${t.join(', ')}`,indent:4}),i.length&&f.push({k:'text',t:`May contain: ${i.join(', ')}`,indent:4})}}s.notes&&(f.push({k:'rule'}),f.push({k:'text',t:`ORDER NOTE: ${s.notes}`,bold:!0}));f.push({k:'rule'});const y=h(s);'foh'===l&&(s.giftCardApplied&&f.push({k:'pair',l:'Gift card',r:`-${p(s.giftCardApplied)}`}),s.tip&&f.push({k:'pair',l:'Tip',r:p(s.tip)}),f.push({k:'pair',l:'Total',r:p(s.total??0),bold:!0,size:2}));x?'foh'===l&&f.push({k:'text',t:`Pay at the bar or till: ${p(Math.max(0,(s.total??0)-(s.paid??0)))}`,bold:!0,align:'c'}):y.paid?f.push({k:'text',t:y.label,size:2,bold:!0,align:'c'}):(f.push({k:'text',t:` ${y.label} `,size:2,bold:!0,inv:!0,align:'c'}),f.push({k:'text',t:`Take ${p(y.due)} on collection`,bold:!0,align:'c'}));return f.push({k:'pair',l:`${k} item${1===k?'':'s'}`,r:`Printed ${r(b)} ${c(b)}`}),f.push({k:'feed',n:3}),{lines:f,title:`${'kitchen'===l?'Kitchen':'Front of house'} ticket #${s.ref}`}},e.wrap=f,e.rows=$,Object.defineProperty(e,"ticketText",{enumerable:!0,get:function(){return x}}),e.cp437=A,e.escpos=function(t,n={}){const i=n.cols??42,o=[v,64,v,116,0];for(const n of $(t,i))o.push(v,97,'c'===n.align?1:'r'===n.align?2:0,v,69,n.bold?1:0,E,66,n.inv?1:0,E,33,3===n.size?34:2===n.size?17:0),o.push(...A(n.s),10);o.push(E,33,0,E,66,0,v,69,0,v,97,0),n.beep&&o.push(v,66,2,2);!1!==n.cut&&o.push(E,86,66,3);return Uint8Array.from(o)},e.eposXml=function(t,n={}){const i=n.cols??48;let o='';for(const n of $(t,i)){const t=n.size>1;o+=`${O(n.s)} `}return o+='',`${o}`},Object.defineProperty(e,"eposUrl",{enumerable:!0,get:function(){return S}}),e.eposResult=function(t){const n=(/]*>/i.exec(t)||[])[0];if(!n)return{ok:!1,code:'no reply from the printer'};const i=(/\bcode="([^"]*)"/i.exec(n)||[])[1];return/\bsuccess="true"/i.test(n)?{ok:!0}:{ok:!1,code:i||'printer said no'}},Object.defineProperty(e,"starEsc",{enumerable:!0,get:function(){return T}}),e.starRequest=function(t,n={}){const i=n.cols??48;let o='';for(const n of $(t,i))o+=`${T(n.s+'\n')}`;return o+='',o},Object.defineProperty(e,"starEnvelope",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"starUrl",{enumerable:!0,get:function(){return M}}),e.starResult=function(t,n=!0){return/\s*false/i.test(t)||/traderSuccess"?\s*[:=]\s*"?false/i.test(t)?{ok:!1,code:(/([^<]*)<\/code>/i.exec(t)||[])[1]||'Star printer reported an error'}:n?{ok:!0}:{ok:!1,code:'no reply from the printer'}},e.ticketHtml=function(t,n=42){const i=$(t,n).map(t=>`
${O(t.s)||' '}
`).join('');return`${O(t.title)}${i}`},e.friendlyError=function(t){const n=String(t||'');return/COVER_OPEN/i.test(n)?'the printer lid is open':/EMPTY|PAPER/i.test(n)?'the printer is out of paper':/OFFLINE|NOT_FOUND|ECONNREFUSED|EHOSTUNREACH|ENETUNREACH|refused|unreachable|could not reach|timeout|timed out|no reply/i.test(n)?'the printer did not answer (is it switched on and on the same Wi-Fi?)':/bluetooth/i.test(n)?'the Bluetooth printer did not connect (is it on and paired?)':n||'the printer did not answer'};var t=_r(_d[0]);const n=[{id:'gluten',name:'Gluten'},{id:'crustaceans',name:'Crustaceans'},{id:'molluscs',name:'Molluscs'},{id:'eggs',name:'Eggs'},{id:'fish',name:'Fish'},{id:'peanuts',name:'Peanuts'},{id:'treenuts',name:'Tree nuts'},{id:'soya',name:'Soya'},{id:'milk',name:'Milk'},{id:'celery',name:'Celery'},{id:'mustard',name:'Mustard'},{id:'sesame',name:'Sesame'},{id:'sulphites',name:'Sulphites'},{id:'lupin',name:'Lupin'}],i=t=>n.find(n=>n.id===t)?.name??String(t),o={intolerance:'intolerance',allergy:'allergy',coeliac:'coeliac',anaphylaxis:'ANAPHYLAXIS'},s=t=>String(t).padStart(2,'0'),r=t=>`${s(t.getHours())}:${s(t.getMinutes())}`,a=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],l=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],c=t=>`${a[t.getDay()]} ${t.getDate()} ${l[t.getMonth()]}`,p=t=>`\xa3${(Math.round(t)/100).toFixed(2)}`,u={app:'App',phone:'Phone','walk-in':'Walk-in','staff-table':'Staff','table-qr':'Table QR'};function d(t){const n=t.readyBy||t.slotTime;if(!n)return{label:'ASAP'};const i=new Date(n);return isNaN(i.getTime())?{label:'ASAP'}:{label:r(i),at:i}}const h=t=>{const n=Math.max(0,Math.round((t.total??0)-(t.paid??0)));return n<=0?{paid:!0,due:0,label:`PAID ${p(t.paid||t.total||0)}`}:{paid:!1,due:n,label:`NOT PAID ${p(n)}`}};function f(t,n,i=0){const o=[],s=' '.repeat(Math.min(i,Math.max(0,n-8)));let r='';const a=Math.max(4,n);for(const n of t.split(/(\s+)/)){if(!n)continue;let t=n;for(;(r+t).length>a;)if(r.trim()){if(o.push(r.replace(/\s+$/,'')),r=s,/^\s+$/.test(t)){t='';break}}else o.push((r+t).slice(0,a)),t=(r+t).slice(a),r=s;r+=t}return!r.trim()&&o.length||o.push(r.replace(/\s+$/,'')),o}const b=(t,n,i)=>{const o=i-n.length-1,s=f(t,Math.max(8,o)),r=s.pop()??'';return[...s,r+' '.repeat(Math.max(1,i-r.length-n.length))+n]};function $(t,n=42){const i=[];for(const o of t.lines)if('rule'===o.k)i.push({s:(o.heavy?'=':'-').repeat(n),size:1,bold:!1,inv:!1,align:'l'});else if('feed'===o.k)for(let t=0;t$(t,n).map(t=>{const i=Math.floor(n/t.size),o='c'===t.align?Math.max(0,Math.floor((i-t.s.length)/2)):'r'===t.align?Math.max(0,i-t.s.length):0;return' '.repeat(o)+t.s}).join('\n'),k={'\xc7':128,'\xfc':129,'\xe9':130,'\xe2':131,'\xe4':132,'\xe0':133,'\xe5':134,'\xe7':135,'\xea':136,'\xeb':137,'\xe8':138,'\xef':139,'\xee':140,'\xec':141,'\xc4':142,'\xc5':143,'\xc9':144,'\xe6':145,'\xc6':146,'\xf4':147,'\xf6':148,'\xf2':149,'\xfb':150,'\xf9':151,'\xff':152,'\xd6':153,'\xdc':154,'\xa2':155,'\xa3':156,'\xa5':157,'\xe1':160,'\xed':161,'\xf3':162,'\xfa':163,'\xf1':164,'\xd1':165,'\xbd':171,'\xbc':172,'\xb0':248,'\xb7':250},y={'\u20ac':'EUR','\u2018':"'",'\u2019':"'",'\u201c':'"','\u201d':'"','\u2013':'-','\u2014':'-','\u2026':'...','\xd7':'x','\u2022':'*','\u26a0':'!','\u0153':'oe','\xdf':'ss','\xf8':'o','\xd8':'O',' ':' '};function A(t){const n=[];for(const i of t.normalize('NFC')){const t=i.codePointAt(0)??63;if(t>=32&&t<127)n.push(t);else if(null!=k[i])n.push(k[i]);else if(null!=y[i])for(const t of y[i])n.push(t.charCodeAt(0));else{const t=i.normalize('NFD').replace(/[\u0300-\u036f]/g,'');if(t&&t!==i&&/^[\x20-\x7e]+$/.test(t))for(const i of t)n.push(i.charCodeAt(0));else n.push(63)}}return n}const v=27,E=29;const O=t=>t.replace(/&/g,'&').replace(//g,'>').replace(/"/g,'"').replace(/'/g,''');const S=(t,n=!1,i="local_printer")=>`${n?'https':'http'}://${t}/cgi-bin/epos/service.cgi?devid=${encodeURIComponent(i)}&timeout=10000`;const T=t=>t.replace(/[\\\x00-\x20&<>\x7f]/g,t=>'\\'===t?'\\\\':`\\x${t.charCodeAt(0).toString(16).padStart(2,'0')}`);const w=t=>`${O(`${t}`)}`,M=(t,n=!1)=>`${n?'https':'http'}://${t}/StarWebPRNT/SendMessage`},903,[808]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.thisDevice=function(){const e=t();if(e?.CcPrintNative||/CoverChargeTablet/.test(e?.navigator?.userAgent??''))return'tablet';if(e?.ccDesktop)return'mac';const r=String(e?.location?.pathname??'');return/\/display(-app)?\//.test(r)||r.startsWith('/display')?'display':'owner'},Object.defineProperty(_e,"hasNative",{enumerable:!0,get:function(){return l}}),_e.browserPrint=f,_e.sendTicket=async function(t,r){const o=(t.host??'').trim();let n;if('browser'===t.kind)n=f(r,t.cols);else if('escpos'===t.kind)n=o?await d(o,t.port??9100,(0,e.escpos)(r,{cols:t.cols,beep:!0})):{ok:!1,error:'no IP address set'};else if('bluetooth'===t.kind)n=t.btAddress?await p(t.btAddress,(0,e.escpos)(r,{cols:t.cols,beep:!0})):{ok:!1,error:'bluetooth: no printer chosen'};else if('epson'===t.kind)if(o){const s=await u((0,e.eposUrl)(o,!!t.https),(0,e.eposXml)(r,{cols:t.cols}),{'Content-Type':'text/xml; charset=utf-8',SOAPAction:'""','If-Modified-Since':'Thu, 01 Jan 1970 00:00:00 GMT'});n=s.error?{ok:!1,error:s.error}:(0,e.eposResult)(s.body??''),!n.ok&&n.code&&(n.error=n.code)}else n={ok:!1,error:'no IP address set'};else if(o){const s=await u((0,e.starUrl)(o,!!t.https),(0,e.starEnvelope)((0,e.starRequest)(r,{cols:t.cols})),{'Content-Type':'text/xml; charset=UTF-8'});n=s.error?{ok:!1,error:s.error}:(0,e.starResult)(s.body??'',s.ok),!n.ok&&n.code&&(n.error=n.code)}else n={ok:!1,error:'no IP address set'};return n.ok?{ok:!0}:{ok:!1,error:(0,e.friendlyError)(n.error)}},_e.scanNetwork=async function(){const e=n()?await s('scan',[],4e4):i()?await i().scan():{ok:!1,error:'Scanning needs the Display tablet app or CoverCharge for Mac. In a web browser, type the printer\u2019s IP address instead.'};return{ok:!!e.ok,error:e.error,found:e.found??[]}},_e.pairedBluetooth=async function(){if(!n())return{ok:!1,error:'Bluetooth printers work from the Display tablet app only.',devices:[]};const e=await s('btList',[],2e4);return{ok:!!e.ok,error:e.error,devices:e.devices??[]}},Object.defineProperty(_e,"testTicket",{enumerable:!0,get:function(){return h}}),_r(_d[0]);var e=_r(_d[1]);const t=()=>'undefined'!=typeof window?window:void 0;let r=0;const o=new Map;function n(){return t()?.CcPrintNative}function s(e,s,i=15e3){const c=n();if(!c||'function'!=typeof c[e])return Promise.resolve({ok:!1,error:'This tablet app is too old to print. Install the latest Display tablet app.'});const l=t();l.__ccNativeDone||(l.__ccNativeDone=(e,t)=>{const r=o.get(e);if(r){o.delete(e);try{r(JSON.parse(t))}catch{r({ok:!1,error:'bad reply'})}}});const d=`p${Date.now().toString(36)}${(r++).toString(36)}`;return new Promise(t=>{const r=setTimeout(()=>{o.delete(d)&&t({ok:!1,error:'timed out'})},i);o.set(d,e=>{clearTimeout(r),t(e)});try{c[e](d,...s)}catch(e){o.delete(d),clearTimeout(r),t({ok:!1,error:String(e?.message??e)})}})}const i=()=>t()?.ccDesktop?.printer,c=e=>{let r='';for(let t=0;tglobalThis.Buffer.from(e,'binary').toString('base64')))(r)},l=()=>!!n()||!!i();async function d(e,t,r){return n()?s('tcp',[e,t,c(r)]):i()?i().tcp(e,t,c(r)):{ok:!1,error:'This device cannot reach port 9100.'}}async function u(e,t,r){if(n())return s('http',[e,t,JSON.stringify(r)]);if(i())return i().http(e,t,r);try{const o='undefined'!=typeof AbortController?new AbortController:null,n=setTimeout(()=>o?.abort(),12e3),s=await fetch(e,{method:'POST',headers:r,body:t,signal:o?.signal});return clearTimeout(n),{ok:s.ok,status:s.status,body:await s.text()}}catch(e){return{ok:!1,error:/abort/i.test(String(e))?'timed out':'could not reach the printer (for a web browser it needs HTTPS and its certificate accepted once)'}}}async function p(e,t){return n()?s('bt',[e,c(t)],25e3):{ok:!1,error:'bluetooth: only the Display tablet app can print over Bluetooth'}}function f(r,o=42){const n=t();if(!n?.document)return{ok:!1,error:'no Print on this device'};try{const t=n.document.createElement('iframe');t.setAttribute('aria-hidden','true'),t.style.cssText='position:fixed;right:0;bottom:0;width:0;height:0;border:0;',n.document.body.appendChild(t);const s=t.contentDocument;return s.open(),s.write((0,e.ticketHtml)(r,o)),s.close(),setTimeout(()=>{try{t.contentWindow.focus(),t.contentWindow.print()}catch{}setTimeout(()=>t.remove(),6e4)},250),{ok:!0}}catch(e){return{ok:!1,error:String(e?.message??e)}}}const h=(t,r)=>(0,e.buildTicket)({id:'test',ref:'TEST',restaurantId:'',customerId:'',customerName:'Test print',type:'takeaway',lines:[{itemId:'t1',name:'Fish supper',qty:2,unitPrice:1250,choices:['Mushy peas','Large'],notes:'No salt',contains:['fish'],may:[],overridden:!1,prepMins:12},{itemId:'t2',name:'Sticky toffee pudding',qty:1,unitPrice:750,choices:[],notes:'',contains:[],may:['treenuts'],overridden:!1,prepMins:3}],subtotal:3250,tip:0,giftCardApplied:0,total:3250,paid:3250,status:'new',createdAt:(new Date).toISOString(),allergies:[{allergen:'fish',severity:'allergy'},{allergen:'treenuts',severity:'anaphylaxis'}],readiness:{},slotTime:new Date(Date.now()+12e5).toISOString(),notes:'This is a test ticket. Nothing to cook.'},{venue:t,kind:'foh'===r.role?'foh':'kitchen',copyLabel:'TEST PRINT',dishAllergens:e=>'t1'===e?{fish:'contains',gluten:'contains'}:{milk:'contains',eggs:'contains',gluten:'contains'}})},904,[122,903]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.DayGraph=function({todays:e,open:c,close:x,now:f,turnBase:p,pauses:y,height:j=150,forecastNote:T,emptyText:b,past:F,closed:k,compact:M=!1}){const[w,$]=(0,o.useState)(0),z=c.getTime()-18e5,v=x.getTime()+36e5,_=(0,o.useMemo)(()=>(0,m.coverCurve)(e,new Date(z),new Date(v),p),[e,z,v,p]),D=Math.max(8,..._.map(e=>e.covers)),P=(0,m.peaksOf)(_),L=F||k?[]:(0,m.quietOf)(_,c.getTime(),x.getTime()),S=34,W=22,A=Math.max(10,w-S-12),C=j-W-20,O=e=>S+(e-z)/(v-z)*A,R=e=>W+C-e/(1.15*D)*C,q=[];for(const e of P){const t=q[q.length-1];t&&O(e.from)-O(t.from)<110?(e.covers??0)>(t.covers??0)&&(q[q.length-1]=e):q.push(e)}const B=e=>e<84?'start':e>S+A-50?'end':'middle',H=(e,t)=>e.length*t*.6,I=(e,t,o)=>'start'===o?[e,e+t]:'end'===o?[e-t,e]:[e-t/2,e+t/2],E=(e,t)=>e-t/2<2?'start':e+t/2>w-2?'end':'middle',N=(k?[]:[{t:c.getTime(),l:`Open ${(0,d.hm)(c)}`},{t:x.getTime(),l:`Close ${(0,d.hm)(x)}`}]).map(e=>{const t=H(e.l,11),o=E(O(e.t),t),[s,l]=I(O(e.t),t,o);return{...e,a:o,box:{l:s,r:l,t:2,b:17}}}),Q=(e,t)=>e.le.box);for(const e of L)if(O(e.to)-O(e.from)>70){const t=(O(e.from)+O(e.to))/2,o=H('Quiet \xb7 good for breaks',11);G.push({l:t-o/2,r:t+o/2,t:R(0)-18,b:R(0)-3})}const Z=q.map(e=>{const t=O(e.from),o=R(e.covers),s=`Busy ${(0,d.hm)(new Date(e.from))} \xb7 ${e.covers}`,l=H(s,12),i=B(t),[n,r]=I(t,l,i);for(const l of[o-8,o+18]){const a={l:n,r:r,t:l-12,b:l+3};if(!(l+3>W+C+2)&&!G.some(e=>Q(e,a)))return G.push(a),{p:e,px:t,py:o,txt:s,a:i,ly:l}}return{p:e,px:t,py:o,txt:s,a:i,ly:null}}),J=_.map((e,t)=>`${t?'L':'M'}${O(e.t).toFixed(1)},${R(e.covers).toFixed(1)}`).join(' '),K=_.length?`${J} L${O(_[_.length-1].t).toFixed(1)},${R(0)} L${O(_[0].t).toFixed(1)},${R(0)} Z`:'',U=[];for(let e=new Date(z);e.getTime()<=v;e=new Date(e.getTime()+36e5)){const t=new Date(e);t.setMinutes(0,0,0),t.getTime()>=z&&U.push(t.getTime())}f.getTime()>=z&&f.getTime();const V=e.filter(e=>!['cancelled','noshow'].includes(e.status)).length;return(0,u.jsxs)(l.default,{testID:"day-graph",style:[a.look.panel,{overflow:'hidden',paddingTop:10}],children:[M?(0,u.jsxs)(l.default,{style:{alignItems:'center',gap:4,paddingHorizontal:14},children:[(0,u.jsx)(r.T,{center:!0,size:18,weight:"semibold",children:"Covers through the day"}),(0,u.jsxs)(r.T,{center:!0,size:14,colour:h.colours.muted,children:[V," ",1===V?'table':'tables'," ",F?'seated':'booked']})]}):(0,u.jsxs)(r.Row,{style:{justifyContent:'space-between',paddingHorizontal:14},children:[(0,u.jsx)(r.T,{size:15,weight:"semibold",children:"Covers through the day"}),(0,u.jsxs)(r.T,{size:12,colour:h.colours.muted,children:[V," ",1===V?'table':'tables'," ",F?'seated':'booked']})]}),(0,u.jsx)(l.default,{onLayout:e=>$(e.nativeEvent.layout.width),style:{height:j},children:w?(0,u.jsxs)(n.default,{width:w,height:j,children:[L.map((e,t)=>(0,u.jsx)(i.Rect,{x:O(e.from),y:W,width:Math.max(2,O(e.to)-O(e.from)),height:C,fill:"rgba(207,164,95,0.08)"},`q${t}`)),y.map((e,t)=>(0,u.jsx)(i.Rect,{x:Math.max(S,O(e.from.getTime())),y:W,width:Math.max(2,Math.min(S+A,O(e.to.getTime()))-Math.max(S,O(e.from.getTime()))),height:C,fill:"rgba(255,181,71,0.16)",stroke:"rgba(255,181,71,0.6)",strokeWidth:1},`p${t}`)),U.map(e=>(0,u.jsx)(i.Line,{x1:O(e),x2:O(e),y1:W,y2:W+C,stroke:"#1E1C18",strokeWidth:1},e)),U.map(e=>(0,u.jsx)(i.Text,{fontFamily:"Poppins_500Medium",x:O(e),y:j-5,fill:h.colours.muted,fontSize:(0,t.soutersFont)(11),textAnchor:"middle",children:(0,d.hm)(new Date(e)).slice(0,2)},`l${e}`)),(0,u.jsx)(i.Line,{x1:S,x2:S+A,y1:R(0),y2:R(0),stroke:h.colours.border,strokeWidth:1}),(0,u.jsx)(i.Text,{fontFamily:"Poppins_500Medium",x:28,y:R(D)+4,fill:h.colours.muted,fontSize:(0,t.soutersFont)(10),textAnchor:"end",children:D}),(0,u.jsx)(i.Text,{fontFamily:"Poppins_500Medium",x:28,y:R(0)+4,fill:h.colours.muted,fontSize:(0,t.soutersFont)(10),textAnchor:"end",children:"0"}),K?(0,u.jsx)(i.Path,{d:K,fill:"rgba(207,164,95,0.22)"}):null,J?(0,u.jsx)(i.Path,{d:J,stroke:h.colours.gold,strokeWidth:2.5,fill:"none"}):null,N.map(e=>(0,u.jsxs)(s.default.Fragment,{children:[(0,u.jsx)(i.Line,{x1:O(e.t),x2:O(e.t),y1:18,y2:W+C,stroke:h.colours.goldLight,strokeWidth:1.5,strokeDasharray:"4,4"}),(0,u.jsx)(i.Text,{fontFamily:"Poppins_500Medium",x:O(e.t),y:14,fill:h.colours.goldLight,fontSize:(0,t.soutersFont)(11),fontWeight:"bold",textAnchor:e.a,children:e.l})]},e.l)),L.map((e,o)=>O(e.to)-O(e.from)>70?(0,u.jsx)(i.Text,{fontFamily:"Poppins_500Medium",x:(O(e.from)+O(e.to))/2,y:R(0)-6,fill:h.colours.ok,fontSize:(0,t.soutersFont)(11),textAnchor:"middle",children:"Quiet \xb7 good for breaks"},`qt${o}`):null),y.map((e,o)=>(0,u.jsxs)(i.Text,{fontFamily:"Poppins_500Medium",x:Math.max(S,O(e.from.getTime()))+4,y:34,fill:h.colours.amber,fontSize:(0,t.soutersFont)(11),fontWeight:"bold",children:["\u23f8 ",e.label]},`pt${o}`)),Z.map((e,o)=>(0,u.jsxs)(s.default.Fragment,{children:[(0,u.jsx)(i.Rect,{x:e.px-3,y:e.py-3,width:6,height:6,fill:h.colours.text}),null!==e.ly?(0,u.jsx)(i.Text,{testID:`graph-peak-${o}`,fontFamily:"Poppins_500Medium",x:e.px,y:e.ly,fill:h.colours.text,fontSize:(0,t.soutersFont)(12),fontWeight:"bold",textAnchor:e.a,children:e.txt}):null]},`k${o}`)),null,V?null:(0,u.jsx)(i.Text,{fontFamily:"Poppins_500Medium",x:S+A/2,y:W+C/2,fill:h.colours.muted,fontSize:(0,t.soutersFont)(13),textAnchor:"middle",children:b??'No bookings yet today'})]}):null}),T?(0,u.jsx)(r.T,{size:11,colour:"#8C8477",style:{paddingHorizontal:14,paddingBottom:8},children:T}):(0,u.jsx)(l.default,{style:{height:6}})]})};var t=_r(_d[0]),o=_r(_d[1]),s=e(o),l=e(_r(_d[2])),i=_r(_d[3]),n=e(i),r=_r(_d[4]),a=_r(_d[5]),d=_r(_d[6]),h=_r(_d[7]),m=_r(_d[8]),u=_r(_d[9])},905,[912,30,127,947,813,936,818,821,906,24]); +__d(function(g,r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.coverCurve=function(s,c,n,a){const u=s.filter(t=>!['cancelled','noshow'].includes(t.status)).map(o=>{const s=(0,t.startOf)(o).getTime();return{s:s,e:s+6e4*(0,t.durOf)(o,a),n:o.partySize}}),f=[];for(let t=c.getTime();t<=n.getTime();t+=o)f.push({t:t,covers:u.reduce((o,s)=>t>=s.s&&tt.covers));if(!o)return[];const s=[];return t.forEach((c,n)=>{const a=t.slice(Math.max(0,n-3),n+4);c.covers<.6*o||c.coverst.covers))||s.some(t=>Math.abs(t.from-c.t)<36e5)||s.push({from:c.t,to:c.t,covers:c.covers})}),s.slice(0,3)},e.quietOf=function(t,o,s){const c=Math.max(0,...t.map(t=>t.covers)),n=Math.max(2,.25*c),a=[];let u=null;const f=t.filter(t=>t.t>=o&&t.t<=s);return f.forEach((t,o)=>{const s=t.covers<=n;s&&null===u&&(u=t.t);const c=o===f.length-1;if((!s||c)&&null!==u){const o=t.t;o-u>=18e5&&a.push({from:u,to:o}),u=null}}),a.sort((t,o)=>o.to-o.from-(t.to-t.from)).slice(0,3).sort((t,o)=>t.from-o.from)};var t=r(d[0]);const o=9e5},906,[826]); +__d(function(g,_r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.DueToday=function({shifts:e,att:t,staff:h,today:p,now:x,compact:j}){const y=60*x.getHours()+x.getMinutes(),I=e.filter(e=>e.date===p&&e.published).sort((e,t)=>e.start-t.start),b=e=>t.filter(t=>t.staffId===e&&t.date===p&&t.in).sort((e,t)=>t.in.localeCompare(e.in))[0],w=I.filter(e=>!b(e.staffId)).map(e=>({s:e,late:y>60*e.start+10})),T=I.filter(e=>{const t=b(e.staffId);return t&&!t.out}).sort((e,t)=>e.end-t.end),z=t.filter(e=>e.date===p&&e.in&&!e.out&&!I.some(t=>t.staffId===e.staffId)),D=I.filter(e=>b(e.staffId)?.out).length,$=j?4:6,S=e=>c(h.find(t=>t.id===e)?.name),M=(e,t,n,r,f)=>(0,u.jsxs)(l.default,{style:{flexDirection:'row',alignItems:'center',gap:8,paddingVertical:3},children:[(0,u.jsx)(s.StaffAvatar,{id:t,size:j?24:28,ring:!1}),(0,u.jsx)(o.T,{size:14,weight:"medium",numberOfLines:1,style:{flex:1},children:n}),(0,u.jsx)(o.T,{size:13,weight:"semibold",colour:'amber'===f?a.colours.amber:'ok'===f?a.colours.ok:a.colours.goldLight,children:r})]},e),_=(e,t,s,n,r,f)=>(0,u.jsxs)(l.default,{testID:r,style:{flex:1,minWidth:0,gap:2},children:[(0,u.jsxs)(l.default,{style:{flexDirection:'row',alignItems:'baseline',gap:6,marginBottom:2},children:[(0,u.jsx)(o.T,{size:11,weight:"semibold",colour:a.colours.gold,style:{letterSpacing:1.6},children:e}),t?(0,u.jsx)(o.T,{size:11,colour:a.colours.muted,children:t}):null,f?(0,u.jsxs)(o.T,{size:11,weight:"semibold",colour:a.colours.amber,children:["\xb7 ",f]}):null]}),s.length?s.slice(0,$):(0,u.jsx)(o.T,{size:13,colour:"#857D6E",children:n}),s.length>$?(0,u.jsxs)(o.T,{size:12,colour:a.colours.muted,children:["+",s.length-$," more"]}):null]});return(0,u.jsxs)(l.default,{testID:"due-today",style:[n.look.panel,{padding:12,paddingHorizontal:14,gap:8}],children:[(0,u.jsxs)(l.default,{style:{flexDirection:'row',alignItems:'center',justifyContent:'space-between'},children:[(0,u.jsx)(o.T,{size:15,weight:"semibold",children:"Team today"}),(0,u.jsx)(o.T,{size:12,colour:a.colours.muted,children:I.length?`${T.length+z.length} on now${D?` \xb7 ${D} finished`:''}`:''})]}),I.length||z.length?(0,u.jsxs)(l.default,{style:{flexDirection:'row',gap:16},children:[_('DUE IN',w.length,w.map(({s:e,late:t})=>M(`in-${e.id}`,e.staffId,S(e.staffId),f(e.start),t?'amber':'muted')),'Everyone is in','due-in',w.some(e=>e.late)?`${w.filter(e=>e.late).length} late`:void 0),_('DUE OUT',T.length+z.length,[...T.map(e=>M(`out-${e.id}`,e.staffId,S(e.staffId),f(e.end),y>=60*e.end?'amber':'ok')),...z.map(e=>M(`x-${e.id}`,e.staffId,S(e.staffId),`in ${(0,r.hm)(new Date(e.in))}`,'muted'))],'Nobody on yet','due-out')]}):(0,u.jsx)(o.T,{size:13,colour:a.colours.muted,children:"No published shifts for today. Build and publish the rota in Managers \u203a Rota to see who\u2019s due in and out here."})]})},_r(d[0]);var e,t=_r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},s=_r(d[2]),o=_r(d[3]),n=_r(d[4]),r=_r(d[5]),a=_r(d[6]),u=_r(d[7]);const f=e=>`${String(Math.floor(e)).padStart(2,'0')}:${String(Math.round(e%1*60)).padStart(2,'0')}`,c=e=>(e??'Staff').replace(' (example)','').split(' ')[0]},907,[30,127,952,813,936,818,821,24]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ACTION_GOLD",{enumerable:!0,get:function(){return f}}),_e.BigAction=function({label:e,onPress:l,testID:u,size:h="l",block:x,premium:p}){const{width:y}=(0,o.default)(),b='l'===h&&y>=520,w='s'===h,j=x?{alignSelf:'stretch'}:p?{flex:1,minWidth:0}:{flexGrow:1,flexShrink:1,minWidth:0,flexBasis:b?200:150,maxWidth:b?300:260};return(0,c.jsx)(n.default,{testID:u,accessibilityRole:"button",accessibilityLabel:e,onPress:l,style:({pressed:e})=>p?{...j,minHeight:w?52:b?78:62,borderRadius:w?14:20,...w?{paddingVertical:4}:{},alignItems:'center',justifyContent:'center',flexDirection:'row',gap:b?12:8,paddingHorizontal:w?6:b?20:10,...t.look.primary(e)}:{...j,minHeight:b?76:62,borderRadius:18,backgroundColor:e?'#B8904F':f,borderWidth:2,borderColor:'#E8C98F',alignItems:'center',justifyContent:'center',flexDirection:'row',gap:b?10:6,paddingHorizontal:b?18:8,shadowColor:'#000',shadowOpacity:.35,shadowRadius:8,shadowOffset:{width:0,height:3}},children:(0,c.jsx)(s.T,{size:w?16:b?p?25:26:18,weight:p?'semibold':'bold',colour:t.look.onPrimary,center:w,numberOfLines:w?2:void 0,style:p?{flexShrink:1,letterSpacing:.2}:{flexShrink:1},children:e})})},_e.FrontDoorBar=function({primary:e,left:t,right:n,oneRow:o,testID:s="front-door-bar"}){const f=(e,t)=>e?(0,c.jsx)(l.default,{style:{flex:o?1:void 0,flexDirection:'row',flexWrap:'wrap',gap:8,alignItems:'center',justifyContent:o?t?'flex-end':'flex-start':'center'},children:e}):null,u=(0,c.jsx)(l.default,{testID:"primary-actions",style:{flexDirection:'row',gap:12,justifyContent:'center',flexGrow:o?0:1,flexBasis:o?520:void 0,flexShrink:1,maxWidth:'100%'},children:e});return o?(0,c.jsxs)(l.default,{testID:s,style:{flexDirection:'row',alignItems:'center',gap:12},children:[f(t),u,f(n,!0)]}):(0,c.jsxs)(l.default,{testID:s,style:{gap:8},children:[u,t||n?(0,c.jsxs)(l.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'center',alignItems:'center'},children:[t,n]}):null]})},r(d[0]);var t=r(d[1]),n=e(r(d[2])),l=e(r(d[3])),o=e(r(d[4])),s=r(d[5]),c=r(d[6]);const f='#CFA45F'},908,[30,936,263,127,287,813,24]); +__d(function(g,_r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.DisplayClockButton=function(){const[e,t]=(0,r.useState)(!1);return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(l.default,{testID:"display-clock-btn",accessibilityRole:"button",accessibilityLabel:"Clock in or out",onPress:()=>t(!0),style:({pressed:e})=>({...s.look.quiet(e),flexGrow:1}),children:(0,y.jsx)(c.T,{size:15,weight:"semibold",colour:u.colours.goldLight,children:"Clock in / out"})}),e?(0,y.jsx)(w,{onClose:()=>t(!1)}):null]})},_e.PinPad=D,_e.DisplayClockSheet=w,_e.TempCode=I,_e.AddTempForm=P;var t=_r(_d[0]),n=_r(_d[1]),o=_r(_d[2]),s=_r(_d[3]),r=_r(_d[4]),l=e(_r(_d[5])),i=e(_r(_d[6])),d=e(_r(_d[7])),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),m=_r(_d[12]),f=_r(_d[13]),b=_r(_d[14]),k=_r(_d[15]),y=_r(_d[16]);const x=()=>(new Date).toLocaleDateString('en-CA',{timeZone:'Europe/London'}),j={in:'clocked in',break_start:'started a break',break_end:'ended the break',out:'clocked out'};function D({title:e,sub:t,onDone:n,error:o,busy:s,length:d=4,min:h}){const[p,m]=(0,r.useState)('');(0,r.useEffect)(()=>{o&&m('')},[o]);const f=null!=h,b=f?8:d,k=e=>{if(s)return;const t=(p+e).slice(0,b);m(t),f||t.length!==d||(n(t),setTimeout(()=>m(''),300))},x=f?Math.max(h??4,p.length):d,j=(e,t,n)=>(0,y.jsx)(l.default,{testID:n,accessibilityRole:"button",accessibilityLabel:'\u232b'===e?'Delete':'OK'===e?'Done':e,onPress:t,style:({pressed:e})=>({width:84,height:72,borderRadius:14,alignItems:'center',justifyContent:'center',borderWidth:1,borderColor:'rgba(255,255,255,0.10)',backgroundColor:e?'rgba(201,162,74,0.25)':'#1B1A18'}),children:(0,y.jsx)(c.T,{size:28,weight:"semibold",children:e})},n);return(0,y.jsxs)(i.default,{testID:"pin-pad",style:{alignItems:'center',gap:12},children:[(0,y.jsx)(c.T,{size:20,weight:"semibold",children:e}),t?(0,y.jsx)(c.Muted,{children:t}):null,(0,y.jsx)(i.default,{testID:"pin-dots",style:{flexDirection:'row',gap:14},children:Array.from({length:x},(e,t)=>t).map(e=>(0,y.jsx)(i.default,{style:{width:18,height:18,borderRadius:9,borderWidth:2,borderColor:u.colours.gold,backgroundColor:e(0,y.jsx)(c.Row,{gap:10,children:e.map(e=>j(e,()=>k(e),`pin-key-${e}`))},e.join())),(0,y.jsxs)(c.Row,{gap:10,children:[f?j('OK',()=>{if(s||!f||p.length<(h??4))return;n(p),setTimeout(()=>m(''),300)},'pin-ok'):(0,y.jsx)(i.default,{style:{width:84}}),j('0',()=>k('0'),'pin-key-0'),j('\u232b',()=>m(p.slice(0,-1)),'pin-back')]})]})]})}function w({onClose:e,initial:t}){const{width:n}=(0,d.default)(),s=(0,h.useOwner)(e=>e.staff),w=(0,b.useDisplayTiles)(e=>e.tiles),T=(0,b.useDisplayTiles)(e=>e.managers),C=(0,b.useDisplayTiles)(e=>e.lens),S=e=>C[e]?.len??4,v=(0,k.useSync)(e=>'device'===e.kind)||o.PITCH,[B,M]=(0,r.useState)(t??{s:'tiles'}),[$,N]=(0,r.useState)(null),[A,L]=(0,r.useState)(!1),R=(0,r.useRef)(Date.now());(0,r.useEffect)(()=>{(0,b.refreshTiles)(),(0,b.refreshManagers)()},[]),(0,r.useEffect)(()=>{R.current=Date.now();const t=setInterval(()=>{Date.now()-R.current>6e4&&e()},5e3);return()=>clearInterval(t)},[B,e]),(0,r.useEffect)(()=>{if('done'!==B.s)return;const t=setTimeout(e,5e3);return()=>clearTimeout(t)},[B,e]);const _=(0,r.useMemo)(()=>w??(0,b.localTiles)(s,x()),[w,s]),E=v?T:s.filter(e=>e.active&&('owner'===e.role||'manager'===e.role)&&!e.name.includes('(example)')).map(e=>({ref:e.id,name:e.name})),F=e=>{N(null),M(e)},Y=async(e,t,n,o={})=>{L(!0);const s=await(0,b.displayClock)(e.ref,t,n,o);if(L(!1),!s.ok)return void N((0,b.errorText)(s.error));const r=s.at?(0,m.hm)(new Date(s.at)):'';(0,f.notify)({id:`display-clock-${e.ref}`,icon:'\ud83d\udd52',kicker:'VIA DISPLAY',title:`${e.name} ${j[n]}${r?` at ${r}`:''}`,body:'',tone:'normal',timeoutMs:6e3}),(0,b.refreshTiles)(),F({s:'done',text:`${e.name} ${j[n]}${r?` at ${r}`:''}. Logged via Display.`})},z=async(e,t)=>{L(!0);const n=await(0,b.displayClock)(e.ref,t,'status');L(!1),n.ok?F({s:'actions',t:e,pin:t,st:n}):N((0,b.errorText)(n.error))};let O='Clock in / out',K=null;if('tiles'===B.s){const e=n>=1100?4:n>=760?3:2;K=(0,y.jsxs)(i.default,{testID:"clock-tiles",style:{gap:12},children:[(0,y.jsx)(c.Muted,{children:"Tap your name, then type your PIN. This tablet is at the venue, so no location check is needed."}),v?null:(0,y.jsx)(c.Banner,{kind:"info",title:"Pair this Display first",children:"The names show, but clocking in needs this Display paired to the venue (Managers app \u203a Settings \u203a Devices)."}),_.length?null:(0,y.jsx)(c.Muted,{children:"Nobody is set up to clock in here yet. A manager can turn on \u201cCan clock in at the Display\u201d for a person in Staff & roles."}),(0,y.jsx)(i.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:12},children:_.map(t=>(0,y.jsxs)(l.default,{testID:`clock-tile-${t.ref}`,accessibilityRole:"button",accessibilityLabel:`${t.name}${t.temp?', temp':''}`,onPress:()=>F({s:'pin',t:t}),style:({pressed:n})=>({width:100/e-2+"%",minHeight:110,borderRadius:16,padding:14,justifyContent:'center',gap:6,borderWidth:1,borderColor:t.clockedIn?u.colours.gold:'rgba(255,255,255,0.10)',backgroundColor:n?'rgba(201,162,74,0.20)':'#1B1A18'}),children:[(0,y.jsx)(c.T,{size:24,weight:"semibold",children:(0,h.staffLabel)({name:t.name,nickname:t.nickname??void 0})}),(0,y.jsxs)(c.Row,{gap:6,wrap:!0,children:[t.dept?(0,y.jsx)(c.Muted,{children:t.dept}):null,t.temp?(0,y.jsx)(c.Badge,{kind:"gold",label:"Temp"}):null,t.clockedIn?(0,y.jsx)(c.Badge,{kind:"neutral",label:"In"}):null]})]},t.ref))}),(0,y.jsx)(c.Button,{testID:"clock-add-temp",kind:"secondary",label:"Add temp staff (manager PIN)",onPress:()=>F({s:'mgr'})})]})}else if('pin'===B.s){const e=B.t;O=`Hello ${e.name}`,K=(0,y.jsx)(D,{length:S(e.ref),title:"Type your PIN",sub:e.temp?'Temp staff: use the 4-digit code your manager gave you.':'Forgotten it? A manager can reset it in Staff & roles.',error:$,busy:A,onDone:t=>{z(e,t)}})}else if('actions'===B.s){const{t:e,pin:t,st:n}=B;O=(0,h.staffLabel)({name:e.name,nickname:e.nickname??void 0});const o=n.since?Math.round((Date.now()-new Date(n.since).getTime())/6e4):0;K=(0,y.jsxs)(i.default,{testID:"clock-actions",style:{gap:12},children:[(0,y.jsxs)(c.Muted,{children:[n.clockedIn?`Clocked in since ${n.since?(0,m.hm)(new Date(n.since)):'\u2014'}${n.onBreak?' \xb7 on a break now':''}.`:'Not clocked in.'," Tip: this is logged as \u201cvia Display\u201d."]}),$?(0,y.jsx)(c.T,{colour:u.colours.amber,children:$}):null,n.clockedIn?null:(0,y.jsx)(c.Button,{testID:"clock-do-in",label:"Clock in",disabled:A,onPress:()=>n.onRota?void Y(e,t,'in'):F({s:'offrota',t:e,pin:t})}),n.clockedIn&&!n.onBreak?(0,y.jsx)(c.Button,{testID:"clock-do-break-start",kind:"secondary",label:"Start break",disabled:A,onPress:()=>{Y(e,t,'break_start')}}):null,n.clockedIn&&n.onBreak?(0,y.jsx)(c.Button,{testID:"clock-do-break-end",kind:"secondary",label:"End break",disabled:A,onPress:()=>{Y(e,t,'break_end')}}):null,n.clockedIn?(0,y.jsx)(c.Button,{testID:"clock-do-out",label:"Clock out",disabled:A,onPress:()=>n.hadBreak||n.onBreak?void Y(e,t,'out'):F({s:'break',t:e,pin:t,worked:o})}):null,(0,y.jsx)(c.Button,{testID:"clock-change-pin",kind:"ghost",label:e.temp?'Change my code':'Change my PIN',onPress:()=>F({s:'newpin',t:e,pin:t})})]})}else if('offrota'===B.s){const{t:t,pin:n}=B;O='Do you want to sign in?',K=(0,y.jsxs)(i.default,{testID:"clock-offrota",style:{gap:12},children:[(0,y.jsx)(c.T,{size:18,children:"Should you be on the rota?"}),(0,y.jsx)(c.Muted,{children:"You\u2019re not on today\u2019s published rota. If you\u2019re working, clock in and your manager gets a note."}),(0,y.jsx)(c.Button,{testID:"clock-offrota-yes",label:"Yes, clock me in",disabled:A,onPress:()=>{Y(t,n,'in',{offRota:!0})}}),(0,y.jsx)(c.Button,{testID:"clock-offrota-no",kind:"secondary",label:"No, just visiting",onPress:e})]})}else if('break'===B.s){const{t:e,pin:t,worked:n}=B;O='Did you take a break? If so, how long?',K=(0,y.jsxs)(i.default,{testID:"forgot-break-prompt",style:{gap:10},children:[(0,y.jsx)(c.Muted,{children:"No break was recorded on this shift. Pick how long it was, or No break. Your manager can change it later in Hours."}),(0,y.jsx)(c.Row,{wrap:!0,gap:6,children:p.DEFAULT_BREAK_OPTIONS.map(o=>(0,y.jsx)(c.Chip,{testID:`forgot-break-${o}`,label:(0,p.breakLabel)(o),disabled:o>=n&&n>0,onPress:()=>{Y(e,t,'out',{breakMins:o})}},o))}),(0,y.jsx)(c.Button,{testID:"forgot-break-none",kind:"secondary",label:"No break",onPress:()=>{Y(e,t,'out',{breakMins:0})}}),n>360?(0,y.jsx)(c.Muted,{children:"UK workers are generally entitled to a 20-minute rest break when working more than 6 hours."}):null]})}else if('newpin'===B.s){const{t:e,pin:t,first:n}=B;O=e.temp?'Change my code':'Change my PIN';const o=e.temp?4:(W=e.ref,C[W]?.min??4);K=(0,y.jsx)(D,{min:o,title:n?'Type it again, then OK':`Type a new PIN (${o} to 8 digits), then OK`,sub:"Pick something that isn\u2019t 1234 or your birthday.",error:$,busy:A,onDone:async s=>{if(!n){const n=(0,b.pinProblem)(s,o);return n?void N(n):void F({s:'newpin',t:e,pin:t,first:s})}if(s!==n)return N('They didn\u2019t match. Start again.'),void M({s:'newpin',t:e,pin:t});L(!0);const r=await(0,b.displayChangePin)(e.ref,t,s);L(!1),r.ok?F({s:'done',text:`${e.name}, your ${e.temp?'code':'PIN'} is changed.`}):N((0,b.errorText)(r.error,r))}})}else if('done'===B.s)O='Done',K=(0,y.jsxs)(i.default,{testID:"clock-done",style:{gap:12},children:[(0,y.jsx)(c.T,{size:20,weight:"semibold",colour:u.colours.goldLight,children:B.text}),(0,y.jsx)(c.Button,{label:"Close",onPress:e})]});else if('mgr'===B.s)O='Add temp staff',K=(0,y.jsxs)(i.default,{testID:"clock-mgr-tiles",style:{gap:12},children:[(0,y.jsx)(c.Muted,{children:"A manager or owner taps their name and types their own PIN to add a temp."}),(0,y.jsx)(i.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:10},children:E.map(e=>(0,y.jsx)(c.Chip,{testID:`clock-mgr-${e.ref}`,label:e.name,onPress:()=>F({s:'mgrpin',m:e})},e.ref))}),E.length?null:(0,y.jsx)(c.Muted,{children:"No manager has a PIN yet. Set one in Staff & roles first."}),(0,y.jsx)(c.Button,{kind:"secondary",label:"Back",onPress:()=>F({s:'tiles'})})]});else if('mgrpin'===B.s){const e=B.m;O='Manager PIN',K=(0,y.jsx)(D,{length:S(e.ref),title:`${e.name}: type your PIN`,error:$,busy:A,onDone:t=>F({s:'temp',m:e,pin:t})})}else if('temp'===B.s){const{m:e,pin:t}=B;O='Add temp staff',K=(0,y.jsx)(P,{noPay:!0,busy:A,error:$,onSubmit:async n=>{L(!0);const o=await(0,b.displayAddTemp)(e.ref,t,n);if(L(!1),!o.ok)return N((0,b.errorText)(o.error)),void('wrong'!==o.error&&'locked'!==o.error||M({s:'mgrpin',m:e}));(0,b.refreshTiles)(),F({s:'code',name:o.name??n.name,code:o.code??''})}})}else'code'===B.s&&(O='Temp added',K=(0,y.jsx)(I,{name:B.name,code:B.code,onClose:e}));var W;return(0,y.jsx)(c.Sheet,{visible:!0,onClose:e,title:O,maxWidth:'tiles'===B.s?1100:560,testID:"display-clock-sheet",children:(0,y.jsx)(i.default,{onTouchStart:()=>{R.current=Date.now()},children:K})})}function I({name:e,code:t,onClose:n}){return(0,y.jsxs)(i.default,{testID:"temp-code",style:{gap:12,alignItems:'center'},children:[(0,y.jsxs)(c.T,{children:["Tell ",e," this code now. It won\u2019t be shown again."]}),(0,y.jsx)(c.T,{size:48,weight:"bold",colour:u.colours.goldLight,style:{letterSpacing:12},children:t}),(0,y.jsx)(c.Muted,{children:"They tap their name on the Display and type it to clock in, start and end breaks and clock out. It doesn\u2019t work in any phone app. Change it any time on the Display, or reset it in Staff & roles."}),(0,y.jsx)(c.Button,{label:"Done",onPress:n})]})}const T=['Kitchen','Front of house','Bar'],C=e=>{const t=new Date;return t.setDate(t.getDate()+e),t.toLocaleDateString('en-CA',{timeZone:'Europe/London'})};function P({onSubmit:e,busy:o,error:s,noPay:l}){const[d,h]=(0,r.useState)(''),[p,m]=(0,r.useState)(null),[f,b]=(0,r.useState)(''),[k,x]=(0,r.useState)(''),j=f.trim()?Number(f.replace(/[\xa3,\s]/g,'')):null,D=null!=j&&(!Number.isFinite(j)||j<0||j>200),w=!!k&&(!/^\d{4}-\d{2}-\d{2}$/.test(k)||k(0,y.jsx)(c.Chip,{testID:`temp-dept-${e}`,label:e,selected:p===e,onPress:()=>m(p===e?null:e)},e))}),l?null:(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(c.T,{weight:"semibold",children:"Hourly rate (optional)"}),(0,y.jsx)(n.TextInput,{testID:"temp-rate",value:f,onChangeText:b,placeholder:"\xa3 per hour, e.g. 12.21",placeholderTextColor:"#777",keyboardType:"decimal-pad",style:I}),D?(0,y.jsx)(c.T,{colour:u.colours.amber,children:"Check the hourly rate."}):null]}),(0,y.jsx)(c.T,{weight:"semibold",children:"End date (optional)"}),(0,y.jsx)(c.Row,{wrap:!0,gap:6,children:[['No end date',''],['Today',C(0)],['In 1 week',C(7)],['In 2 weeks',C(14)]].map(([e,t])=>(0,y.jsx)(c.Chip,{testID:`temp-until-${e}`,label:e,selected:k===t,onPress:()=>x(t)},e))}),(0,y.jsx)(n.TextInput,{testID:"temp-until",value:k,onChangeText:x,placeholder:"YYYY-MM-DD",placeholderTextColor:"#777",style:I}),w?(0,y.jsxs)(c.T,{colour:u.colours.amber,children:["Use a date from today on, like ",C(7),"."]}):null,(0,y.jsx)(c.Muted,{children:"After the end date they are hidden from the Display and staff lists (kept, not deleted, so their hours stay)."}),s?(0,y.jsx)(i.default,{testID:"temp-error",children:(0,y.jsx)(c.T,{colour:u.colours.amber,children:s})}):null,(0,y.jsx)(c.Button,{testID:"temp-save",label:"Add and show the code",disabled:o||!d.trim()||D||w,onPress:()=>e({name:d.trim(),dept:p,rate:j,until:k||null})})]})}},909,[912,875,2,936,30,263,127,287,813,821,854,953,818,946,954,820,24]); +__d(function(g,r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useDisplayNotices=function(d,D=!0){const y=(0,s.useNotifs)(t=>t.items.map(t=>`${t.id}:${t.updatedAt??''}`).join()),S=(0,f.useDisplayTiles)(t=>t.at??0);(0,t.useEffect)(()=>{if(!D)return;const t=()=>{const t=p(),D=new Date(t).toLocaleDateString('en-CA',{timeZone:'Europe/London'}),y=o.useOwner.getState().staff,S=f.useDisplayTiles.getState().tiles??(0,f.localTiles)(y,D),v=y.map(t=>({id:t.id,role:t.role,level:t.level,job:t.job,department:t.dept,active:t.active})),$=v.filter(s=>!1!==s.active&&(0,u.shiftNow)(s.id,t).on).map(t=>t.id),h=s.useNotifs.getState();for(const o of h.items)if(o.rid===d)for(const f of S){const u=`sched:${o.id}:${f.ref}`;if(o.removed||o.paused||!o.sendBy.inApp||!(0,c.isRecipient)(o,f.ref,v,$)){(0,l.dismissNotice)(u);continue}const{due:D,forDate:y}=(0,c.notifDue)(o,t),S=n.useReminders.getState().done.find(t=>t.reminderId===o.id&&t.forDate===y),I=`sched:${o.id}:${y}:${f.ref}`;!D||S||(h.snooze[I]??0)>t?(0,l.dismissNotice)(u):(0,l.notify)({id:u,icon:'\ud83d\udd14',kicker:`FOR ${f.name.toUpperCase()}`,title:`${f.name}: ${o.title}`,body:o.message,testID:'display-sched-notice',timeoutMs:null,actions:[{label:'Done',testID:'display-sched-done',onPress:()=>n.useReminders.getState().markDone({rid:d,reminderId:o.id,forDate:y,at:new Date(p()).toISOString(),staffRef:f.ref,staffName:`${f.name} (via Display)`})},{label:'Later',kind:'ghost',testID:'display-sched-later',onPress:()=>s.useNotifs.getState().setSnooze(I,p()+9e5)}]})}};t();const y=setInterval(t,2e4);return()=>clearInterval(y)},[d,y,S,D])};var t=r(_d[0]),s=r(_d[1]),o=r(_d[2]),n=r(_d[3]),d=r(_d[4]),c=r(_d[5]),l=r(_d[6]),f=r(_d[7]),u=r(_d[8]);const p=()=>{try{return(0,d.nowFrom)(d.useStore.getState().clock).getTime()}catch{return Date.now()}}},910,[30,955,854,956,870,957,946,954,958]); +__d(function(g,_r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"codeFromText",{enumerable:!0,get:function(){return x}}),_e.DisplayPairing=function(){const{height:e}=(0,u.default)(),_=(0,c.useSync)(e=>e.mode),T=(0,c.useSync)(e=>e.message),[m,E]=(0,o.useState)(!1),[R,j]=(0,o.useState)(!1),[y,f]=(0,o.useState)(''),[D,A]=(0,o.useState)(!1),[N,M]=(0,o.useState)(''),[z,P]=(0,o.useState)(''),k=async e=>{const t=x(e);if(t.length<6)return void M('Type the code exactly as shown in Managers \u2192 Displays.');A(!0),M('');const r=await(0,c.pairWithCode)(t);A(!1),r.ok?(P(`Paired with ${r.venueName}`),E(!1),f(''),setTimeout(()=>P(''),4e3)):M(r.error)};(0,o.useEffect)(()=>{I.START_PAIR&&(E(!0),f(I.START_PAIR),k(I.START_PAIR))},[]);const U=(0,S.useScreensaverAsleep)(e=>e.asleep),C=(0,S.useDisplayToolsH)(e=>e.h),O='unpaired'===_,v=m||O&&!R&&!I.START_PAIR;return(0,b.jsxs)(b.Fragment,{children:[z?(0,b.jsx)(l.default,{testID:"pair-ok",style:{position:'absolute',top:12,alignSelf:'center',zIndex:960,padding:10,borderRadius:10,backgroundColor:h.colours.okBg,borderWidth:1,borderColor:h.colours.ok},children:(0,b.jsx)(p.T,{size:14,children:z})}):null,!O||v||U?null:(0,b.jsx)(n.default,{testID:"pair-banner",accessibilityRole:t.IS_SOUTERS?'button':void 0,accessibilityLabel:t.IS_SOUTERS?'Not paired. Tap to pair this display.':void 0,onPress:()=>E(!0),style:{position:'absolute',bottom:Math.max(72,C+7),right:8,zIndex:900,paddingHorizontal:12,paddingVertical:6,borderRadius:999,backgroundColor:(0,r.soutersSurface)('#2A2114'),borderWidth:1,borderColor:h.colours.gold,...t.IS_SOUTERS?{minHeight:44,minWidth:44,justifyContent:'center'}:{}},children:(0,b.jsx)(p.T,{size:13,colour:h.colours.gold,children:"Not paired \xb7 tap to pair this display"})}),v?(0,b.jsx)(l.default,{testID:"pair-screen",style:{position:'absolute',top:0,left:0,right:0,bottom:0,zIndex:980,backgroundColor:t.IS_QUEUED_VENUE||t.IS_ABBOTSFORD||t.IS_KIRKTON?h.colours.bg:t.IS_GREENSIDE?'#1A1A1A':t.IS_WILDINGS?'#272A2F':(0,r.soutersSurface)('rgba(8,7,5,0.97)'),alignItems:'center',justifyContent:'center',padding:24},children:(0,b.jsxs)(l.default,{style:{width:'100%',maxWidth:460,gap:12},children:[t.IS_QUEUED_VENUE?(0,b.jsx)(s.RestaurantHero,{rid:t.VENUE_RID,size:Math.min(220,Math.max(120,.25*e))}):t.IS_ABBOTSFORD?(0,b.jsx)(s.RestaurantHero,{rid:"abbotsford",size:Math.min(220,Math.max(120,.25*e))}):t.IS_KIRKTON?(0,b.jsx)(s.RestaurantHero,{rid:"kirkton",size:Math.min(220,Math.max(120,.25*e))}):t.IS_GREENSIDE?(0,b.jsx)(s.RestaurantHero,{rid:"greenside",size:Math.min(220,Math.max(120,.25*e))}):t.IS_WILDINGS?(0,b.jsx)(s.RestaurantHero,{rid:"wildings",size:Math.min(220,Math.max(120,.25*e))}):t.IS_ISOLATED_VENUE?(0,b.jsx)(s.RestaurantBrand,{rid:t.VENUE_RID,sub:"Display"}):null,(0,b.jsx)(p.T,{size:26,weight:"bold",children:"Pair this display"}),t.IS_ISOLATED_VENUE?(0,b.jsx)(p.Muted,{children:"No table plan or bookings have been added. The venue\u2019s authorised manager must create a pairing code after setup."}):null,(0,b.jsx)(p.Muted,{children:"In the Managers app, open Settings \u2192 Displays and make a pairing code. Type it here, or open the pairing link on this tablet. No login needed."}),T?(0,b.jsx)(p.T,{size:14,colour:h.colours.gold,children:T}):null,(0,b.jsx)(p.Field,{testID:"pair-code",label:"Pairing code (or link)",value:y,onChangeText:f,autoCapitalize:"characters",autoCorrect:!1,placeholder:"e.g. ABCDE 23456"}),N?(0,b.jsx)(l.default,{testID:"pair-error",children:(0,b.jsx)(p.T,{size:14,colour:h.colours.red,children:N})}):null,(0,b.jsx)(p.Button,{testID:"pair-go",label:D?'Pairing\u2026':'Pair',disabled:D||!y.trim(),onPress:()=>k(y)}),(0,b.jsx)(p.Button,{kind:"secondary",label:"Not now (use this tablet\u2019s own data)",onPress:()=>{E(!1),j(!0)}})]})}):null]})};var t=_r(d[0]),r=_r(d[1]),s=_r(d[2]),o=_r(d[3]);_r(d[4]);var n=e(_r(d[5])),l=e(_r(d[6])),u=e(_r(d[7])),c=_r(d[8]),h=_r(d[9]),p=_r(d[10]),S=_r(d[11]),I=_r(d[12]),b=_r(d[13]);const x=e=>{const t=e.match(/[?&#]pair=([A-Za-z0-9 -]{6,})/);return(t?t[1]:e).toUpperCase().replace(/[^A-Z0-9]/g,'')}},911,[5,912,860,30,122,263,127,287,820,821,813,916,959,24]); \ No newline at end of file diff --git a/wildings/chef-app/_expo/static/js/web/index-837efe1be9c39737e9750ae18a91c7cb.js b/wildings/chef-app/_expo/static/js/web/index-837efe1be9c39737e9750ae18a91c7cb.js new file mode 100644 index 0000000000000000000000000000000000000000..b95277b8fc09755dc3248956ed5558cae76e1892 --- /dev/null +++ b/wildings/chef-app/_expo/static/js/web/index-837efe1be9c39737e9750ae18a91c7cb.js @@ -0,0 +1 @@ +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return f}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]),c=r(d[4]);function f(){return(0,u.canShow)('chef')?(0,c.jsx)(n.ChefApp,{}):(0,c.jsx)(t.Redirect,{href:u.ENTRY[u.APP_VARIANT]})}},776,[804,30,805,806,24]); \ No newline at end of file diff --git a/wildings/chef-app/_expo/static/js/web/index-9ab206088a709796371257b9528a09bc.js b/wildings/chef-app/_expo/static/js/web/index-9ab206088a709796371257b9528a09bc.js new file mode 100644 index 0000000000000000000000000000000000000000..ef5b0f79038972ca8f636d9e54cc6ef9da5c6dcc --- /dev/null +++ b/wildings/chef-app/_expo/static/js/web/index-9ab206088a709796371257b9528a09bc.js @@ -0,0 +1,855 @@ +__d(function(g,r,i,a,m,e,d){"use strict";r(d[0]),r(d[1])},0,[1,18]); +__d(function(g,_r,_i,_a,_m,_e,d){"use strict";var e,t=_r(d[0]),o=_r(d[1]),a=_r(d[2]),n=_r(d[3]),i=_r(d[4]),c=(e=i)&&e.__esModule?e:{default:e};if(t.PITCH){const e=o.restaurants.find(e=>'anchorage'===e.id);e&&Object.assign(e,{name:n.PITCH_VENUE.name,tagline:n.PITCH_VENUE.tagline,location:n.PITCH_VENUE.location,phone:n.PITCH_VENUE.phone,website:n.PITCH_VENUE.website,hoursNote:'Kitchen (food) hours. The closing time is last food orders.',fictional:!1}),e&&(e.settings={...e.settings,whatsapp:'07700 900123'});for(const e of c.default.areas)delete e.best;for(let e=a.ROSTER.length-1;e>=0;e--){const t=n.PITCH_TEAM[a.ROSTER[e].id];t?(Object.assign(a.ROSTER[e],{name:t.name,job:t.job,hourlyPence:t.hourlyPence,...t.dept?{dept:t.dept}:{},...null!=t.salaried?{salaried:t.salaried}:{}}),delete a.ROSTER[e].nickname):a.ROSTER.splice(e,1)}if('undefined'!=typeof document){const e=t=>{if(3===t.nodeType){const e=t.nodeValue??'',o=(0,n.pitchText)(e);return void(o!==e&&(t.nodeValue=o))}if(1!==t.nodeType)return;const o=t;if('INPUT'===o.tagName||'TEXTAREA'===o.tagName){const e=o,t=(0,n.pitchText)(e.value);t!==e.value&&(e.value=t);const a=e.getAttribute('placeholder');if(a){const t=(0,n.pitchText)(a);t!==a&&e.setAttribute('placeholder',t)}}for(const e of['aria-label','title']){const t=o.getAttribute(e);if(t){const a=(0,n.pitchText)(t);a!==t&&o.setAttribute(e,a)}}o.childNodes.forEach(e)},t=()=>{e(document.body),document.title=(0,n.pitchText)(document.title),new MutationObserver(t=>{for(const o of t)'characterData'===o.type?e(o.target):o.addedNodes.forEach(e),'attributes'===o.type&&e(o.target);document.title=(0,n.pitchText)(document.title)}).observe(document.body,{subtree:!0,childList:!0,characterData:!0,attributes:!0,attributeFilter:['value','placeholder','aria-label']}),document.addEventListener('input',e=>{e.target},!0)};document.body?t():document.addEventListener('DOMContentLoaded',t)}}},1,[2,3,14,16,17]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PITCH",{enumerable:!0,get:function(){return n}});const n=(['anchorage','souters','kirkmichael','wildings','kirkton','abbotsford','greenside',"3idiots","cecchinis","mrbasrais","yasmins","williewastles","rupeeroom","smokinggoat","pizzaioli","drunkencoo"].includes("wildings"),!1)},2,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"GREENSIDE_RESTAURANT",{enumerable:!0,get:function(){return t.GREENSIDE_RESTAURANT}}),Object.defineProperty(e,"ABBOTSFORD_RESTAURANT",{enumerable:!0,get:function(){return n.ABBOTSFORD_RESTAURANT}}),Object.defineProperty(e,"KIRKTON_RESTAURANT",{enumerable:!0,get:function(){return o.KIRKTON_RESTAURANT}}),Object.defineProperty(e,"WILDINGS_RESTAURANT",{enumerable:!0,get:function(){return s.WILDINGS_RESTAURANT}}),Object.defineProperty(e,"KIRKMICHAEL_RESTAURANT",{enumerable:!0,get:function(){return l.KIRKMICHAEL_RESTAURANT}}),Object.defineProperty(e,"ANCHORAGE_PAY",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"ANCHORAGE_KITCHEN",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"ANCHORAGE_KITCHEN_OLD",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"restaurants",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"demoMenus",{enumerable:!0,get:function(){return T}});var t=r(d[0]),n=r(d[1]),o=r(d[2]),s=r(d[3]),l=r(d[4]);const c={slotMinutes:15,slotCap:3,bufferMins:5,leadMins:20,takeawayPaused:!1,bookingCoversPerSlot:16,deposit:{...r(d[5]).DEPOSIT_DEFAULT},stampTarget:8,stampReward:'Free dessert',stampMinSpend:1e3,capacityPerHour:48,walkInShare:.35,turnMins:75,orderAtTable:!0},u={tipsFrequency:'fortnightly',tipsAnchorPayday:'2026-11-02',tipsEndsDaysBefore:1,wagePayDay:28,wageCutoffDay:23,weekendRule:'none'},h={0:['12:30','19:00'],1:null,2:null,3:['12:00','19:00'],4:['12:00','19:00'],5:['12:00','20:00'],6:['12:00','20:00']},f={0:['12:30','20:00'],1:null,2:null,3:['12:00','19:00'],4:['12:00','19:00'],5:['12:00','20:30'],6:['12:00','20:30']},b=[{id:'anchorage',name:'The Anchorage',tagline:'Harbourside seafood & Scottish produce',location:'Harbour View, Dunure, South Ayrshire',fictional:!1,phone:'01292 502826',website:'anchoragedunure.com',kitchenHours:h,hoursNote:'Kitchen (food) hours from Gordon, 30 Oct 2026: closed Mon\u2013Tue. The closing time is last food orders. Bar hours not set.',settings:{...c,orderAtTable:!1,pay:u},sections:[]},{id:'saltmarsh',name:'The Venue',tagline:'FICTIONAL demo restaurant \u2014 shows multi-tenancy',location:'Port Ailsa (fictional town)',fictional:!0,kitchenHours:{0:['12:00','20:00'],1:['12:00','20:00'],2:['12:00','20:00'],3:['12:00','20:00'],4:['12:00','21:00'],5:['12:00','21:00'],6:['12:00','21:00']},settings:{...c,slotCap:4,stampTarget:6,stampReward:'Free side',capacityPerHour:30},sections:['Small plates','Mains','Puddings']},{id:'brae',name:'Brae Bakehouse',tagline:'FICTIONAL demo caf\xe9 \u2014 shows multi-tenancy',location:'Kilbrae (fictional village)',fictional:!0,kitchenHours:{0:['09:00','16:00'],1:['09:00','16:00'],2:['09:00','16:00'],3:['09:00','16:00'],4:['09:00','16:00'],5:['09:00','20:00'],6:['09:00','20:00']},settings:{...c,slotCap:5,slotMinutes:15,stampTarget:10,stampReward:'Free coffee & cake',capacityPerHour:24,bookingCoversPerSlot:10},sections:['Bakes','Lunch','Hot drinks']}],p={by:'Fictional demo',at:'2026-10-26'},A=(t,n,o,s,l,c,u,h,f=[])=>({id:n,restaurantId:t,section:o,name:s,description:l,price:c,allergens:u,prepMins:h,dietary:f,soldOut:!1,signOff:p}),T=[A('saltmarsh','s-beets','Small plates','Roast beetroot & whipped feta','Fictional dish for the demo.',750,{milk:'contains',treenuts:'may'},6,['V']),A('saltmarsh','s-squid','Small plates','Salt & pepper squid','Fictional dish for the demo.',850,{molluscs:'contains',gluten:'contains'},7),A('saltmarsh','s-hake','Mains','Pan-roast hake, mussel broth','Fictional dish for the demo.',1950,{fish:'contains',molluscs:'contains',milk:'contains',celery:'contains'},15),A('saltmarsh','s-risotto','Mains','Wild mushroom risotto','Fictional dish for the demo.',1600,{milk:'contains',celery:'contains',sulphites:'contains'},16,['V']),A('saltmarsh','s-cranachan','Puddings','Cranachan','Fictional dish for the demo.',700,{milk:'contains',gluten:'contains'},3,['V']),A('brae','b-scone','Bakes','Cheese scone','Fictional dish for the demo.',350,{gluten:'contains',milk:'contains',eggs:'contains'},2,['V']),A('brae','b-caramel','Bakes','Millionaire\u2019s shortbread','Fictional dish for the demo.',300,{gluten:'contains',milk:'contains',soya:'may'},1,['V']),A('brae','b-toastie','Lunch','Ham & mustard toastie','Fictional dish for the demo.',750,{gluten:'contains',milk:'contains',mustard:'contains'},6),A('brae','b-soup','Lunch','Lentil soup & bread','Fictional dish for the demo.',600,{gluten:'contains',celery:'contains'},4,['VG']),A('brae','b-flat','Hot drinks','Flat white','Fictional dish for the demo.',330,{milk:'contains'},2,['V'])]},3,[4,8,9,10,12,13]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"GREENSIDE_UUID",{enumerable:!0,get:function(){return n.GREENSIDE_UUID}}),Object.defineProperty(e,"GREENSIDE_BOOKING_PHONE",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"GREENSIDE_VENUE_HOURS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"GREENSIDE_KITCHEN_HOURS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"GREENSIDE_RESTAURANT",{enumerable:!0,get:function(){return u}});var n=r(d[0]);const t='tel:01655889685',o={0:['10:00','00:00'],1:null,2:null,3:['10:00','23:00'],4:['10:00','23:00'],5:['10:00','00:00'],6:['10:00','00:00']},s={0:['10:00','20:00'],1:null,2:null,3:['10:00','20:00'],4:['10:00','20:00'],5:['10:00','21:00'],6:['10:00','21:00']},u={id:'greenside',name:'The Greenside Restaurant',tagline:'Restaurant \xb7 Wood Fired Pizza \xb7 Maybole',location:'5 Greenside, Maybole, South Ayrshire KA19 7DG',address:'5 Greenside, Maybole, South Ayrshire KA19 7DG',phone:'01655 889685',email:'info@thegreensiderestaurant.co.uk',emailNeedsConfirmation:!0,website:'thegreensiderestaurant.co.uk',fictional:!1,cashOnly:!0,kitchenHours:s,venueHours:o,hoursNote:'Closed Monday and Tuesday. Venue Wednesday and Thursday 10:00\u201323:00, Friday to Sunday 10:00\u201300:00. Kitchen Wednesday, Thursday and Sunday 10:00\u201320:00; Friday and Saturday 10:00\u201321:00. Cash only.',sections:[],settings:{slotMinutes:15,slotCap:3,bufferMins:5,leadMins:20,takeawayPaused:!0,bookingCoversPerSlot:0,stampTarget:8,stampReward:'',stampMinSpend:0,capacityPerHour:0,walkInShare:0,turnMins:75,orderAtTable:!1,showTakeaway:!1,shortName:'The Greenside',reserveStock:!1,tableRequests:!0,deposit:{on:!1,perPersonPence:null,fromParty:null,refundable:null,cutoffHours:null,needsConfirmation:!0,wixLinksOn:!1,policy:'Deposit policy needs confirmation. Deposits and payments are off. Requests need a manager to confirm.'}}}},4,[5]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"VENUE_RID",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"ISOLATED_VENUE_IDS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"IS_GREENSIDE",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"GREENSIDE_UUID",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"IS_ABBOTSFORD",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"ABBOTSFORD_UUID",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"IS_KIRKTON",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"KIRKTON_UUID",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"IS_QUEUED_VENUE",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"IS_SOUTERS",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"IS_WILDINGS",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"IS_KIRKMICHAEL",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"IS_ISOLATED_VENUE",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"SOUTERS_UUID",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"KIRKMICHAEL_UUID",{enumerable:!0,get:function(){return U}}),Object.defineProperty(e,"WILDINGS_UUID",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"VENUE_UUID",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"venueKey",{enumerable:!0,get:function(){return P}}),Object.defineProperty(e,"venueIdentityAllowed",{enumerable:!0,get:function(){return D}});var n=r(d[0]);const t="wildings".toLowerCase().replace(/[^a-z0-9-]/g,'')||'anchorage',c={"3idiots":"59766322-119e-4036-a18a-f6909f60a8d2",cecchinis:"596c6f7e-9797-4e16-84fe-db4a99fa1bdc",mrbasrais:"5d500571-e205-4ead-bb58-60e986b6f40e",yasmins:"f43f20ad-55d0-4008-88c8-7738dc1698df",williewastles:"6abc2793-93ab-4e23-a705-b4011a5cc011",rupeeroom:"78bff97d-5f07-440a-bb99-f6a6118da7a3",smokinggoat:"cd985ff5-2443-458d-ac8b-342d553628cf",pizzaioli:"35f870fc-772c-4aad-bb9e-09a9a16bc925",drunkencoo:"f500ef12-b405-438b-9671-e54289bec5dd",abbotsford:'24624ea5-d1e3-4182-b0d1-73402b8a1532',kirkton:'e0afad1d-cbc1-414a-add6-92e47d302139',greenside:'1bc2a056-2ef6-4585-abfd-b7d21c84f215',souters:'41ce63ca-ae46-432d-a5ba-25e1b801e64d',kirkmichael:'43c8da91-b8b8-4ce9-9ab7-f00c84c5f4f6',wildings:'47f86b36-4c99-466a-be9c-30eb3d79f1e1'},b='greenside'===t,u=c.greenside,f='abbotsford'===t,o=c.abbotsford,l='kirkton'===t,s=c.kirkton,I=(0,n.isQueuedVenue)(t),O='souters'===t,p='wildings'===t,y='kirkmichael'===t,E=Object.prototype.hasOwnProperty.call(c,t),_=c.souters,U=c.kirkmichael,S=c.wildings,j=c[t],P=n=>E?`cc-venue:${t}:${n}`:n,D=(c,b)=>!E||c===j&&b===(0,n.queuedDatabaseSlug)(t)},5,[6]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"queuedVenues",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"isQueuedVenue",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"queuedDatabaseSlug",{enumerable:!0,get:function(){return o}}),_e.queuedRestaurant=function(e){const t=n[e];if(!t)throw Error('Unknown venue');const s=t.kitchenSessionsByDay??t.hours.sessionsByDay,o=Object.fromEntries(Array.from({length:7},(e,t)=>[t,s?.[t]?.length?[s[t][0][0],s[t][s[t].length-1][1]]:null]));return{id:e,name:t.name,location:t.address,address:t.address,phone:t.phone||'',email:t.email||'',website:t.website||'',fictional:!1,tagline:'Restaurant',kitchenHours:o,...s?{kitchenSessionsByDay:s}:{},hoursNeedsConfirmation:!0,hoursNote:t.hours.note,sections:[],settings:{slotMinutes:15,slotCap:0,bufferMins:0,leadMins:0,takeawayPaused:!0,bookingCoversPerSlot:0,stampTarget:0,stampReward:'',stampMinSpend:0,capacityPerHour:0,walkInShare:0,turnMins:0,orderAtTable:!1,showTakeaway:!1,shortName:t.name,reserveStock:!1,tableRequests:!0,deposit:{on:!1,perPersonPence:null,fromParty:null,refundable:null,cutoffHours:null,needsConfirmation:!0,wixLinksOn:!1,policy:'Deposit terms to confirm. No payment is taken for requests.'}}}};var e,t=r(d[0]);const n=((e=t)&&e.__esModule?e:{default:e}).default,s=e=>Object.prototype.hasOwnProperty.call(n,e),o=e=>s(e)?n[e].databaseSlug:e},6,[7]); +__d(function(e,i,a,n,r,l,o){r.exports={"3idiots":{venueId:"3idiots",databaseSlug:"3idiots",urlSlug:"3idiots",uuidReserved:"59766322-119e-4036-a18a-f6909f60a8d2",name:"3 Idiots",address:"10 George Street, Ayr, KA8 0BL",phone:"01292 280791",email:"",website:"https://3idiotsonline.com/",branding:{accent:"#AB7310",accentSuggested:"#AB7310",ink:"#202020",smallTextAccent:"#B78731",onAccent:"#0B0B0B",testedDarkSurfaces:["#202020","#222222","#292929"],minimumSmallTextContrast:4.519221411452106,buttonLabelContrast:4.865696452139418,rawAccentOnInkContrast:4.0278176365022285,logoRecoloured:!1,hasLogo:!0,logo:"assets/brand/3idiots.png",hero:"assets/brand/3idiots-hero.png",noDuplicateNameLine:!0},hours:{status:"to-confirm",days:{},sessionsByDay:null,needsConfirmation:!0,note:"Venue and kitchen hours to confirm. Unknown hours are not closed days."},kitchenSessionsByDay:null,booking:{mode:"in-app-manager-request",nativeDiary:!0,nativeRequests:!0,automaticConfirmation:!1,externalLinks:!1,requiresManager:!0,managerReady:!1,requiresConfirmedKitchenHours:!0,lastSittingMinutesBeforeClose:null,fields:["date","time","Covers","name","phone","email","notes"],sendMessages:!1},deposit:{on:!1,amount:null,perPersonPence:null,fromParty:null,policy:null,needsConfirmation:!0},features:{takeaway:!1,delivery:!1,payments:!1,loyalty:!1,orderAtTable:!1,hotel:!1,directOrdering:!1},clockArea:{on:!0,lat:55.4650286,lng:-4.6283062,radius:150,offRotaPrompt:!1,needsConfirmation:!1,source:"FSA establishment 1104402; exact address previously verified"},gatesToConfirm:["authorised manager and staff","table plan and Covers","deposit and booking terms","pay settings","ordering and delivery to set up","loyalty to set up","opening and kitchen hours","public email","dine-in versus takeaway prices","menu options and allergens"],menuServiceContext:null,allergenCaveat:null,emailNeedsConfirmation:!0,questionnaire:{version:1,venueId:"3idiots",source:"from-config",venue:{name:"3 Idiots",tagline:"Indian Restaurant & Takeaway \xb7 Ayr",address:"10 George Street, Ayr, KA8 0BL",phone:"01292 280791",email:"",website:"https://3idiotsonline.com/",hasLogo:!0},team:[],suppliers:[],accounts:[],hours:{status:"to-confirm",days:{},sessionsByDay:null,needsConfirmation:!0,note:"Venue and kitchen hours to confirm. Unknown hours are not closed days."},tables:{template:"restaurant",tables:null,covers:null,areas:[],needsConfirmation:!0,note:"Table plan and Covers to confirm."},features:{bookings:!0,takeaway:!1,orderAtTable:!1,tips:!1,rota:!1,games:!1,specials:!1,loyalty:!1},notes:"Separate 3idiots tenant. In-app manager-confirmed table requests only. Deposit terms to confirm; charging is off. Team empty. No payroll or connected accounts. Ordering, delivery and loyalty to set up. Published menu is reference only; current prices, availability and allergens to confirm."},menu:{venueId:"3idiots",venueName:"3 Idiots",tradingName:"3idiots",timezone:"Europe/London",currency:"GBP",categories:[{id:"cat_2",categoryId:2,name:"Starters",nestedCategoryIds:null,itemCount:27,items:[{name:"Vegetable Pakora",description:null,price:null,priceLabel:null,options:[{name:"Small",price:5.5,priceLabel:"\xa35.50"},{name:"Large",price:8.5,priceLabel:"\xa38.50"}]},{name:"Fish Pakora",description:null,price:null,priceLabel:null,options:[{name:"Small",price:7.5,priceLabel:"\xa37.50"},{name:"Large",price:10.5,priceLabel:"\xa310.50"}]},{name:"Aloo Tikki",description:null,price:5.5,priceLabel:"\xa35.50",options:null},{name:"Chicken Chaat",description:null,price:6.5,priceLabel:"\xa36.50",options:null},{name:"Chilli Chicken Dosa",description:null,price:5.5,priceLabel:"\xa35.50",options:null},{name:"Garlic Mushrooms",description:null,price:5.5,priceLabel:"\xa35.50",options:null},{name:"King Prawn Poori",description:null,price:10.5,priceLabel:"\xa310.50",options:null},{name:"Mushroom Poori",description:null,price:5.5,priceLabel:"\xa35.50",options:null},{name:"Vegetable Samosa",description:null,price:4.3,priceLabel:"\xa34.30",options:null},{name:"Chilli Chicken Dosa",description:null,price:5.5,priceLabel:"\xa35.50",options:null},{name:"Spiced Haddock",description:null,price:7.5,priceLabel:"\xa37.50",options:null},{name:"Chicken Pakora",description:null,price:null,priceLabel:null,options:[{name:"Small",price:6.5,priceLabel:"\xa36.50"},{name:"Large",price:9.5,priceLabel:"\xa39.50"}]},{name:"Aubergine Fritters",description:null,price:5.5,priceLabel:"\xa35.50",options:null},{name:"Chana Poori",description:null,price:5.5,priceLabel:"\xa35.50",options:null},{name:"Aloo Saag Dosa",description:null,price:5.5,priceLabel:"\xa35.50",options:null},{name:"Keema Samosa",description:null,price:4.5,priceLabel:"\xa34.50",options:null},{name:"Garlic Chicken Tikka",description:null,price:6.5,priceLabel:"\xa36.50",options:null},{name:"Haggis Pakora",description:null,price:null,priceLabel:null,options:[{name:"Small",price:5.5,priceLabel:"\xa35.50"},{name:"Large",price:13.5,priceLabel:"\xa313.50"}]},{name:"Gobi Pakora",description:null,price:null,priceLabel:null,options:[{name:"Small",price:5.5,priceLabel:"\xa35.50"},{name:"Large",price:8.5,priceLabel:"\xa38.50"}]},{name:"Gobi Pakora",description:null,price:null,priceLabel:null,options:[{name:"Small",price:5.5,priceLabel:"\xa35.50"},{name:"Large",price:8.5,priceLabel:"\xa38.50"}]},{name:"Onion Bhaji",description:null,price:null,priceLabel:null,options:[{name:"Small",price:6.5,priceLabel:"\xa36.50"},{name:"Large",price:9.5,priceLabel:"\xa39.50"}]},{name:"Paneer Pakora",description:null,price:null,priceLabel:null,options:[{name:"Small",price:6.5,priceLabel:"\xa36.50"},{name:"Large",price:9.5,priceLabel:"\xa39.50"}]},{name:"Garlic Mushroom Pakora",description:null,price:null,priceLabel:null,options:[{name:"Small",price:5.5,priceLabel:"\xa35.50"},{name:"Large",price:8.5,priceLabel:"\xa38.50"}]},{name:"Mushroom Pakora",description:null,price:null,priceLabel:null,options:[{name:"Small",price:5.5,priceLabel:"\xa35.50"},{name:"Large",price:8.5,priceLabel:"\xa38.50"}]},{name:"Seekh Kebab",description:null,price:7.5,priceLabel:"\xa37.50",options:null},{name:"Chicken Tandoori Breast",description:null,price:7.5,priceLabel:"\xa37.50",options:null},{name:"Lamb Tikka",description:null,price:7.5,priceLabel:"\xa37.50",options:null}]},{id:"cat_7",categoryId:7,name:"Tandoori Dishes",nestedCategoryIds:null,itemCount:6,items:[{name:"King Prawn Tandoori",description:null,price:null,priceLabel:null,options:[{name:"Starter",price:9,priceLabel:"\xa39.00"},{name:"Main Meal",price:18.5,priceLabel:"\xa318.50"}]},{name:"Chicken Tikka Tandoori",description:null,price:null,priceLabel:null,options:[{name:"Starter",price:8.5,priceLabel:"\xa38.50"},{name:"Main Meal",price:17.5,priceLabel:"\xa317.50"}]},{name:"Lamb Tikka Tandoori",description:null,price:null,priceLabel:null,options:[{name:"Starter",price:8,priceLabel:"\xa38.00"},{name:"Main Meal",price:17.5,priceLabel:"\xa317.50"}]},{name:"Lamb Chops Tandoori",description:null,price:null,priceLabel:null,options:[{name:"Starter",price:9.5,priceLabel:"\xa39.50"},{name:"Main Meal",price:18.5,priceLabel:"\xa318.50"}]},{name:"Seekh Kebab Tandoori",description:null,price:null,priceLabel:null,options:[{name:"Starter",price:8.5,priceLabel:"\xa38.50"},{name:"Main Meal",price:17.5,priceLabel:"\xa317.50"}]},{name:"Chicken Tandoori Breast",description:null,price:null,priceLabel:null,options:[{name:"Starter",price:8.5,priceLabel:"\xa38.50"},{name:"Main Meal",price:18,priceLabel:"\xa318.00"}]}]},{id:"cat_56",categoryId:56,name:"Traditional Indian Curry",nestedCategoryIds:null,itemCount:10,items:[{name:"Ginger Chicken Spinach Leaf",description:"with extra ginger & spinach leaves",price:11.5,priceLabel:"\xa311.50",options:null},{name:"Ginger Lime Chicken Tikka",description:"Cooked with ginger & helping of lime",price:11.5,priceLabel:"\xa311.50",options:null},{name:"Butter Chicken",description:"Cooked in butter with medium spices",price:12.5,priceLabel:"\xa312.50",options:null},{name:"South Indian Ginger Lamb",description:"Lamb cooked with abundance of ginger",price:12.5,priceLabel:"\xa312.50",options:null},{name:"Padina Lamb",description:"Cooked with mint leaves",price:12.5,priceLabel:"\xa312.50",options:null},{name:"Lamb Okra",description:"Lamb cooked with ladyfinger",price:12.5,priceLabel:"\xa312.50",options:null},{name:"Methi Keema Mutter",description:"Lamb mince cooked with fenugreek and peas",price:12.5,priceLabel:"\xa312.50",options:null},{name:"Delhi Style Lamb",description:"Cooked with peppers, onions & roasted potatoes",price:12.5,priceLabel:"\xa312.50",options:null},{name:"Machi Masala",description:"Fish cooked with a variety of spices",price:14.5,priceLabel:"\xa314.50",options:null},{name:"Ginger Lime King Prawn",description:"Cooked with ginger & helping of lime",price:16.5,priceLabel:"\xa316.50",options:null}]},{id:"cat_57",categoryId:57,name:"House Specialities",nestedCategoryIds:null,itemCount:22,items:[{name:"Chilli Garlic",description:"Diced chicken marinated in garlic pickle and then cooked",price:null,priceLabel:null,options:[{name:"Chicken Breast",price:12.5,priceLabel:"\xa312.50"},{name:"Chicken Tikka",price:11.5,priceLabel:"\xa311.50"},{name:"Tender Lamb",price:13,priceLabel:"\xa313.00"},{name:"King Prawn",price:16.5,priceLabel:"\xa316.50"},{name:"Vegetable",price:11.5,priceLabel:"\xa311.50"}]},{name:"Korma",description:"Chicken cooked in very mild spices & creamy sauce",price:null,priceLabel:null,options:[{name:"Chicken Breast",price:12.5,priceLabel:"\xa312.50"},{name:"Chicken Tikka",price:11.5,priceLabel:"\xa311.50"},{name:"Tender Lamb",price:13,priceLabel:"\xa313.00"},{name:"King Prawn",price:16.5,priceLabel:"\xa316.50"},{name:"Vegetable",price:11.5,priceLabel:"\xa311.50"}]},{name:"Masala",description:"Chicken cooked in masala sauce",price:null,priceLabel:null,options:[{name:"Chicken Breast",price:12.5,priceLabel:"\xa312.50"},{name:"Chicken Tikka",price:11.5,priceLabel:"\xa311.50"},{name:"Tender Lamb",price:13,priceLabel:"\xa313.00"},{name:"King Prawn",price:16.5,priceLabel:"\xa316.50"},{name:"Vegetable",price:11.5,priceLabel:"\xa311.50"}]},{name:"Rogan Josh",description:"Chicken cooked in tomato & pepper sauce",price:null,priceLabel:null,options:[{name:"Chicken Breast",price:12.5,priceLabel:"\xa312.50"},{name:"Chicken Tikka",price:11.5,priceLabel:"\xa311.50"},{name:"Tender Lamb",price:13,priceLabel:"\xa313.00"},{name:"King Prawn",price:16.5,priceLabel:"\xa316.50"},{name:"Vegetable",price:11.5,priceLabel:"\xa311.50"}]},{name:"Chasni",description:"Chicken cooked in sweet & sour sauce",price:null,priceLabel:null,options:[{name:"Chicken Breast",price:12.5,priceLabel:"\xa312.50"},{name:"Chicken Tikka",price:11.5,priceLabel:"\xa311.50"},{name:"Tender Lamb",price:13,priceLabel:"\xa313.00"},{name:"King Prawn",price:16.5,priceLabel:"\xa316.50"},{name:"Vegetable",price:11.5,priceLabel:"\xa311.50"}]},{name:"Punjabi Chilli",description:"Chicken cooked in punjabi spices and chilli sauce",price:null,priceLabel:null,options:[{name:"Chicken Breast",price:12.5,priceLabel:"\xa312.50"},{name:"Chicken Tikka",price:11.5,priceLabel:"\xa311.50"},{name:"Tender Lamb",price:13,priceLabel:"\xa313.00"},{name:"King Prawn",price:16.5,priceLabel:"\xa316.50"},{name:"Vegetable",price:11.5,priceLabel:"\xa311.50"}]},{name:"Passanda",description:"Lamb cooked with coconut cream and yoghurt",price:null,priceLabel:null,options:[{name:"Chicken Breast",price:12.5,priceLabel:"\xa312.50"},{name:"Chicken Tikka",price:11.5,priceLabel:"\xa311.50"},{name:"Tender Lamb",price:13,priceLabel:"\xa313.00"},{name:"King Prawn",price:16.5,priceLabel:"\xa316.50"},{name:"Vegetable",price:11.5,priceLabel:"\xa311.50"}]},{name:"Saag",description:"Cooked in a rich sauce with spinach",price:null,priceLabel:null,options:[{name:"Chicken Breast",price:12.5,priceLabel:"\xa312.50"},{name:"Chicken Tikka",price:11.5,priceLabel:"\xa311.50"},{name:"Tender Lamb",price:13,priceLabel:"\xa313.00"},{name:"King Prawn",price:16.5,priceLabel:"\xa316.50"},{name:"Vegetable",price:11.5,priceLabel:"\xa311.50"}]},{name:"Achari",description:"Cooked in a rich sauce with mixed pickle",price:null,priceLabel:null,options:[{name:"Chicken Breast",price:10.5,priceLabel:"\xa310.50"},{name:"Chicken Tikka",price:11.5,priceLabel:"\xa311.50"},{name:"Tender Lamb",price:12,priceLabel:"\xa312.00"},{name:"King Prawn",price:16,priceLabel:"\xa316.00"},{name:"Vegetable",price:10.5,priceLabel:"\xa310.50"}]},{name:"Malaidar",description:"Cooked with fresh spinach cream",price:null,priceLabel:null,options:[{name:"Chicken Breast",price:12.5,priceLabel:"\xa312.50"},{name:"Chicken Tikka",price:11.5,priceLabel:"\xa311.50"},{name:"Tender Lamb",price:13,priceLabel:"\xa313.00"},{name:"King Prawn",price:16.5,priceLabel:"\xa316.50"},{name:"Vegetable",price:11.5,priceLabel:"\xa311.50"}]},{name:"Jalfrezi",description:"Cooked with a mixture of peppers, onion & cream",price:null,priceLabel:null,options:[{name:"Chicken Breast",price:12.5,priceLabel:"\xa312.50"},{name:"Chicken Tikka",price:11.5,priceLabel:"\xa311.50"},{name:"Tender Lamb",price:13,priceLabel:"\xa313.00"},{name:"King Prawn",price:16.5,priceLabel:"\xa316.50"},{name:"Vegetable",price:11.5,priceLabel:"\xa311.50"}]},{name:"Jaipuri",description:"Made with roasted mushrooms, onions & peppers",price:null,priceLabel:null,options:[{name:"Chicken Breast",price:12.5,priceLabel:"\xa312.50"},{name:"Chicken Tikka",price:11.5,priceLabel:"\xa311.50"},{name:"Tender Lamb",price:13,priceLabel:"\xa313.00"},{name:"King Prawn",price:16.5,priceLabel:"\xa316.50"},{name:"Vegetable",price:11.5,priceLabel:"\xa311.50"}]},{name:"Kashmiri Korma",description:"Made with cream & fruits",price:null,priceLabel:null,options:[{name:"Chicken Breast",price:12.5,priceLabel:"\xa312.50"},{name:"Chicken Tikka",price:11.5,priceLabel:"\xa311.50"},{name:"Tender Lamb",price:13,priceLabel:"\xa313.00"},{name:"King Prawn",price:16.5,priceLabel:"\xa316.50"},{name:"Vegetable",price:11.5,priceLabel:"\xa311.50"}]},{name:"Balti",description:"Cooked with chickpeas & a touch of tomato",price:null,priceLabel:null,options:[{name:"Chicken Breast",price:12.5,priceLabel:"\xa312.50"},{name:"Chicken Tikka",price:11.5,priceLabel:"\xa311.50"},{name:"Tender Lamb",price:13,priceLabel:"\xa313.00"},{name:"King Prawn",price:16.5,priceLabel:"\xa316.50"},{name:"Vegetable",price:11.5,priceLabel:"\xa311.50"}]},{name:"Madras",description:"A hot dish",price:null,priceLabel:null,options:[{name:"Chicken Breast",price:12.5,priceLabel:"\xa312.50"},{name:"Chicken Tikka",price:11.5,priceLabel:"\xa311.50"},{name:"Tender Lamb",price:13,priceLabel:"\xa313.00"},{name:"King Prawn",price:16.5,priceLabel:"\xa316.50"},{name:"Vegetable",price:11.5,priceLabel:"\xa311.50"}]},{name:"Masaledar",description:"Touch of Indian spices & sweet & sour sauce",price:null,priceLabel:null,options:[{name:"Chicken Breast",price:12.5,priceLabel:"\xa312.50"},{name:"Chicken Tikka",price:11.5,priceLabel:"\xa311.50"},{name:"Tender Lamb",price:13,priceLabel:"\xa313.00"},{name:"King Prawn",price:16.5,priceLabel:"\xa316.50"},{name:"Vegetable",price:11.5,priceLabel:"\xa311.50"}]},{name:"Dhansak",description:"A cooked with lentils",price:null,priceLabel:null,options:[{name:"Chicken Breast",price:12.5,priceLabel:"\xa312.50"},{name:"Chicken Tikka",price:11.5,priceLabel:"\xa311.50"},{name:"Tender Lamb",price:13,priceLabel:"\xa313.00"},{name:"King Prawn",price:16.5,priceLabel:"\xa316.50"},{name:"Vegetable",price:11.5,priceLabel:"\xa311.50"}]},{name:"Karahi",description:"A popular dish prepared in a wok with penty of ginger, garlic & special spices",price:null,priceLabel:null,options:[{name:"Chicken Breast",price:12.5,priceLabel:"\xa312.50"},{name:"Chicken Tikka",price:11.5,priceLabel:"\xa311.50"},{name:"Tender Lamb",price:13,priceLabel:"\xa313.00"},{name:"King Prawn",price:16.5,priceLabel:"\xa316.50"},{name:"Vegetable",price:11.5,priceLabel:"\xa311.50"}]},{name:"Do Piaza",description:"Cooked with extra onions",price:null,priceLabel:null,options:[{name:"Chicken Breast",price:12.5,priceLabel:"\xa312.50"},{name:"Chicken Tikka",price:11.5,priceLabel:"\xa311.50"},{name:"Tender Lamb",price:13,priceLabel:"\xa313.00"},{name:"King Prawn",price:16.5,priceLabel:"\xa316.50"},{name:"Vegetable",price:11.5,priceLabel:"\xa311.50"}]},{name:"Bhoona",description:"A Thick tomato based Punjabi sauce",price:null,priceLabel:null,options:[{name:"Chicken Breast",price:12.5,priceLabel:"\xa312.50"},{name:"Chicken Tikka",price:11.5,priceLabel:"\xa311.50"},{name:"Tender Lamb",price:13,priceLabel:"\xa313.00"},{name:"King Prawn",price:16.5,priceLabel:"\xa316.50"},{name:"Vegetable",price:11.5,priceLabel:"\xa311.50"}]},{name:"Patia",description:"A sweet & sour dish",price:null,priceLabel:null,options:[{name:"Chicken Breast",price:12.5,priceLabel:"\xa312.50"},{name:"Chicken Tikka",price:11.5,priceLabel:"\xa311.50"},{name:"Tender Lamb",price:13,priceLabel:"\xa313.00"},{name:"King Prawn",price:16.5,priceLabel:"\xa316.50"},{name:"Vegetable",price:11.5,priceLabel:"\xa311.50"}]},{name:"3 Idiots Special Curry",description:"Chicken, lamb & king prawn cooked together in a special sauce with blend of Punjabi spices",price:null,priceLabel:null,options:[{name:"Chicken Breast",price:12.5,priceLabel:"\xa312.50"},{name:"Chicken Tikka",price:11.5,priceLabel:"\xa311.50"},{name:"Tender Lamb",price:13,priceLabel:"\xa313.00"},{name:"King Prawn",price:16.5,priceLabel:"\xa316.50"},{name:"Vegetable",price:11.5,priceLabel:"\xa311.50"}]}]},{id:"cat_6",categoryId:6,name:"Vegetable Dishes",nestedCategoryIds:null,itemCount:11,items:[{name:"Baby Aubergine & Potato",description:"baby aubergine cooked with spiced potato",price:11.5,priceLabel:"\xa311.50",options:null},{name:"Fried Dried Okra with Tomato",description:"ladyfingers cooked with fresh tomatoes",price:11.5,priceLabel:"\xa311.50",options:null},{name:"Aloo Gobi & Green Beans",description:"potato & cauliflower",price:11.5,priceLabel:"\xa311.50",options:null},{name:"Saag Paneer",description:"indian cottage cheese cooked with spinach",price:11.5,priceLabel:"\xa311.50",options:null},{name:"Chana Potato",description:"chickpeas & potato",price:11.5,priceLabel:"\xa311.50",options:null},{name:"Bhoona Potato",description:"Cooked in bhoona sauce",price:11.5,priceLabel:"\xa311.50",options:null},{name:"Mushroom Paneer Bhuna",description:"Cooked in bhoona sauce",price:11.5,priceLabel:"\xa311.50",options:null},{name:"Muttar Paneer",description:"Chicken peas & indian cottage cheese",price:11.5,priceLabel:"\xa311.50",options:null},{name:"Daal Makhani",description:"Lentils in buttery sauce",price:11.5,priceLabel:"\xa311.50",options:null},{name:"Bombay Aloo",description:"Spiced potatoes",price:11.5,priceLabel:"\xa311.50",options:null},{name:"Mixed Veg Curry",description:null,price:11.5,priceLabel:"\xa311.50",options:null}]},{id:"cat_8",categoryId:8,name:"Sundries & Breads",nestedCategoryIds:null,itemCount:26,items:[{name:"Spiced Onions",description:null,price:1,priceLabel:"\xa31.00",options:null},{name:"Poppadom",description:null,price:1,priceLabel:"\xa31.00",options:null},{name:"Mango Chutney",description:null,price:1,priceLabel:"\xa31.00",options:null},{name:"Mixed Pickle",description:null,price:1,priceLabel:"\xa31.00",options:null},{name:"Raita",description:null,price:3,priceLabel:"\xa33.00",options:null},{name:"Coriander Chutney",description:null,price:1.5,priceLabel:"\xa31.50",options:null},{name:"Boiled Rice",description:null,price:3.5,priceLabel:"\xa33.50",options:null},{name:"Mushroom Rice",description:null,price:4.5,priceLabel:"\xa34.50",options:null},{name:"Basmati Pilau Rice",description:null,price:3.5,priceLabel:"\xa33.50",options:null},{name:"Chana Rice",description:null,price:4.5,priceLabel:"\xa34.50",options:null},{name:"Chapati",description:null,price:2,priceLabel:"\xa32.00",options:null},{name:"Vegetable Rice",description:null,price:4.5,priceLabel:"\xa34.50",options:null},{name:"Tandoori Roti",description:null,price:2,priceLabel:"\xa32.00",options:null},{name:"Plain Nan Bread",description:null,price:4,priceLabel:"\xa34.00",options:null},{name:"Garlic Nan",description:null,price:4.5,priceLabel:"\xa34.50",options:null},{name:"Peshwari Nan",description:null,price:5,priceLabel:"\xa35.00",options:null},{name:"Chilli & Coriander Nan",description:null,price:4.5,priceLabel:"\xa34.50",options:null},{name:"Cheese Nan",description:null,price:5,priceLabel:"\xa35.00",options:null},{name:"Cheese & Chilli Nan",description:null,price:5,priceLabel:"\xa35.00",options:null},{name:"Cheese & Onion Nan",description:null,price:5,priceLabel:"\xa35.00",options:null},{name:"Garlic & Chilli Nan",description:null,price:4.5,priceLabel:"\xa34.50",options:null},{name:"Mince Nan",description:null,price:5,priceLabel:"\xa35.00",options:null},{name:"Paratha",description:null,price:4,priceLabel:"\xa34.00",options:null},{name:"Veg Paratha",description:null,price:4.5,priceLabel:"\xa34.50",options:null},{name:"Chips",description:null,price:4,priceLabel:"\xa34.00",options:null},{name:"Chips & Cheese",description:null,price:4.8,priceLabel:"\xa34.80",options:null}]},{id:"cat_9",categoryId:9,name:"Vegan Dishes",nestedCategoryIds:null,itemCount:28,items:[{name:"Aloo Chana (Vegan)",description:null,price:10.5,priceLabel:"\xa310.50",options:null},{name:"Aloo Gobi & Grean Beans (Vegan)",description:null,price:10.5,priceLabel:"\xa310.50",options:null},{name:"Saag Tofu (Vegan)",description:null,price:10.5,priceLabel:"\xa310.50",options:null},{name:"Saag Aloo (Vegan)",description:null,price:10.5,priceLabel:"\xa310.50",options:null},{name:"Saag Tofu (Vegan)",description:null,price:9,priceLabel:"\xa39.00",options:null},{name:"Aubergine Potato (Vegan)",description:null,price:10.5,priceLabel:"\xa310.50",options:null},{name:"Chana Daal (Vegan)",description:null,price:10.5,priceLabel:"\xa310.50",options:null},{name:"Okra Tomato (Vegan)",description:null,price:10.5,priceLabel:"\xa310.50",options:null},{name:"Mutter Paneer (Vegan)",description:null,price:10.5,priceLabel:"\xa310.50",options:null},{name:"Okra Tomato (V)",description:null,price:6.95,priceLabel:"\xa36.95",options:null},{name:"Mushroom Bhaji (Curry) (Vegan)",description:null,price:10.5,priceLabel:"\xa310.50",options:null},{name:"Okra Potato (V)",description:null,price:9,priceLabel:"\xa39.00",options:null},{name:"Vegetable Pakora (Vegan)",description:null,price:5.5,priceLabel:"\xa35.50",options:null},{name:"Garlic & Mushroom Pakora (Vegan)",description:null,price:5.5,priceLabel:"\xa35.50",options:null},{name:"Gobi Pakora (Vegan)",description:null,price:5.5,priceLabel:"\xa35.50",options:null},{name:"Chana Poori (Vegan)",description:null,price:5.5,priceLabel:"\xa35.50",options:null},{name:"Mushroom Poori (Vegan)",description:null,price:5.5,priceLabel:"\xa35.50",options:null},{name:"Aloo Saag Dosa (Vegan)",description:null,price:5.5,priceLabel:"\xa35.50",options:null},{name:"Nan Bread (Vegan)",description:null,price:3.5,priceLabel:"\xa33.50",options:null},{name:"Roti (Vegan)",description:null,price:2,priceLabel:"\xa32.00",options:null},{name:"Garlic Nan (Vegan)",description:null,price:4,priceLabel:"\xa34.00",options:null},{name:"Peshwari Nan (Vegan)",description:null,price:4.5,priceLabel:"\xa34.50",options:null},{name:"Chilli Nan (Vegan)",description:null,price:4.5,priceLabel:"\xa34.50",options:null},{name:"Paratha (Vegan)",description:null,price:3.5,priceLabel:"\xa33.50",options:null},{name:"Basmati Rice (Vegan)",description:null,price:3,priceLabel:"\xa33.00",options:null},{name:"Tandoori Roti (Vegan)",description:null,price:2,priceLabel:"\xa32.00",options:null},{name:"Boiled Rice (Vegan)",description:null,price:3,priceLabel:"\xa33.00",options:null},{name:"Chips (Vegan)",description:null,price:4,priceLabel:"\xa34.00",options:null}]},{id:"cat_10",categoryId:10,name:"Set Meals",nestedCategoryIds:null,itemCount:4,items:[{name:"Set Meal 1 For 1 Person",description:"Choice of veg pakora or mushroom pakora or cauliflower pakora Any 1 chicken or veg or lamb curry (king prawn \xc2\xa35 extra per dish) Nan or garlic nan or rice or chips",price:null,priceLabel:null,options:[{name:"Choose Options",price:15,priceLabel:"\xa315.00"}]},{name:"Set Meal 2 For 2 Persons",description:"2 Poppadams & spiced onion, Any pakora, Choice of any 2 curries chicken or veg or lamb curry (king prawn \xc3\xc3\xc2\xa35 extra per dish) Nan or garlic nan or rice or chips",price:null,priceLabel:null,options:[{name:"Choose Options",price:30,priceLabel:"\xa330.00"}]},{name:"Set Meal 3 For 3 Persons",description:"3 Poppadams & spiced onion, Any Large pakora, Choice of any 3 curries chicken or veg or lamb curry (king prawn \xc3\xc2\xa35 extra per dish) 1 rice & 1 chips & any 1 nan bread",price:null,priceLabel:null,options:[{name:"Choose Options",price:45,priceLabel:"\xa345.00"}]},{name:"Set Meal 4 For 4 Persons",description:"4 Poppadams & spiced onion, Any 2 pakoras, Choice of any 4 curries chicken or veg or lamb curry",price:null,priceLabel:null,options:[{name:"Choose Options",price:60,priceLabel:"\xa360.00"}]}]},{id:"cat_21",categoryId:21,name:"Drinks",nestedCategoryIds:null,itemCount:9,items:[{name:"Cobra bottle 330ml",description:null,price:2.5,priceLabel:"\xa32.50",options:null},{name:"Kingfisher draught pint",description:null,price:3.5,priceLabel:"\xa33.50",options:null},{name:"Moretti Beer",description:null,price:2.5,priceLabel:"\xa32.50",options:null},{name:"Peacock Mango & Lime Cider",description:null,price:3.9,priceLabel:"\xa33.90",options:null},{name:"Peacock original Cider",description:null,price:3.9,priceLabel:"\xa33.90",options:null},{name:"Diet Coke",description:null,price:1,priceLabel:"\xa31.00",options:null},{name:"Irn Bru",description:null,price:1.5,priceLabel:"\xa31.50",options:null},{name:"Coke",description:null,price:1.5,priceLabel:"\xa31.50",options:null},{name:"Fanta",description:null,price:1.5,priceLabel:"\xa31.50",options:null}]},{id:"cat_20",categoryId:20,name:"Kids Meals",nestedCategoryIds:null,itemCount:1,items:[{name:"Kids Menu",description:"Starters",price:null,priceLabel:null,options:[{name:"Choose Options",price:6.95,priceLabel:"\xa36.95"}]}]},{id:"cat_54",categoryId:54,name:"Chef's Platter",nestedCategoryIds:null,itemCount:1,items:[{name:"Chef's Platter For 3 People",description:"Chicken tikka, lamb tikka, lamb chops, fish pakora, vegetable pakora, chicken pakora",price:35,priceLabel:"\xa335.00",options:null}]},{id:"cat_55",categoryId:55,name:"Vegetable",nestedCategoryIds:null,itemCount:16,items:[{name:"Vegetable Samosa",description:null,price:4.5,priceLabel:"\xa34.50",options:null},{name:"Vegetable Pakora",description:null,price:4.5,priceLabel:"\xa34.50",options:null},{name:"Garlic Mushroom Pakora",description:null,price:4.5,priceLabel:"\xa34.50",options:null},{name:"Gobi Pakora",description:null,price:4.5,priceLabel:"\xa34.50",options:null},{name:"Aubergine & Potato Fritters",description:null,price:4.5,priceLabel:"\xa34.50",options:null},{name:"Mushroom Poori",description:null,price:5.5,priceLabel:"\xa35.50",options:null},{name:"Chana Poori",description:null,price:5.5,priceLabel:"\xa35.50",options:null},{name:"Aloo Saag Dosa",description:null,price:5.5,priceLabel:"\xa35.50",options:null},{name:"Channa Daal",description:null,price:6,priceLabel:"\xa36.00",options:null},{name:"Saag Paneer",description:null,price:6,priceLabel:"\xa36.00",options:null},{name:"Chana Aloo",description:null,price:6,priceLabel:"\xa36.00",options:null},{name:"Baby Aubergine & Potatoes",description:null,price:6,priceLabel:"\xa36.00",options:null},{name:"Okra & Potato Bhaji",description:null,price:6,priceLabel:"\xa36.00",options:null},{name:"Mushroom Bhaji Curry",description:null,price:6,priceLabel:"\xa36.00",options:null},{name:"Fried Dry Okra & Tomatoes",description:null,price:6,priceLabel:"\xa36.00",options:null},{name:"Aloo Gobi with Grean Beans",description:null,price:6,priceLabel:"\xa36.00",options:null}]},{id:"cat_14",categoryId:14,name:"3 Idiots Tapas Menu",nestedCategoryIds:[54,55],itemCount:1,items:[{name:"Kids Menu",description:"Starters",price:6.95,priceLabel:"\xa36.95",options:null}]},{id:"cat_15",categoryId:15,name:"Rice, Breads and Sundries",nestedCategoryIds:null,itemCount:27,items:[{name:"Basmati Fried Rice",description:null,price:3,priceLabel:"\xa33.00",options:null},{name:"Boiled Rice",description:null,price:3,priceLabel:"\xa33.00",options:null},{name:"Nan Bread",description:null,price:3.5,priceLabel:"\xa33.50",options:null},{name:"Garlic Nan",description:null,price:4,priceLabel:"\xa34.00",options:null},{name:"Mushroom Rice",description:null,price:4.5,priceLabel:"\xa34.50",options:null},{name:"Peshwari Nan",description:null,price:4.5,priceLabel:"\xa34.50",options:null},{name:"Cheese Nan",description:null,price:4.5,priceLabel:"\xa34.50",options:null},{name:"Chilli Coriander Nan",description:null,price:4.5,priceLabel:"\xa34.50",options:null},{name:"Mince Nan",description:null,price:4,priceLabel:"\xa34.00",options:null},{name:"Paratha",description:null,price:4,priceLabel:"\xa34.00",options:null},{name:"Chapati",description:null,price:2,priceLabel:"\xa32.00",options:null},{name:"Tandoori Roti",description:null,price:2,priceLabel:"\xa32.00",options:null},{name:"Mango Chutney",description:null,price:1,priceLabel:"\xa31.00",options:null},{name:"Chana Rice",description:null,price:4.5,priceLabel:"\xa34.50",options:null},{name:"Cheese & Onion Nan",description:null,price:4.5,priceLabel:"\xa34.50",options:null},{name:"Coriander Chutney",description:null,price:1.5,priceLabel:"\xa31.50",options:null},{name:"Garlic & Chilli Nan",description:null,price:4.5,priceLabel:"\xa34.50",options:null},{name:"Mince Nan",description:null,price:4.5,priceLabel:"\xa34.50",options:null},{name:"Mixed Pickle",description:null,price:1,priceLabel:"\xa31.00",options:null},{name:"Vegetable Nan",description:null,price:5,priceLabel:"\xa35.00",options:null},{name:"Vegetable Nan",description:null,price:5,priceLabel:"\xa35.00",options:null},{name:"Vegetable Rice",description:null,price:4.5,priceLabel:"\xa34.50",options:null},{name:"Raita",description:null,price:1.5,priceLabel:"\xa31.50",options:null},{name:"Poppadom",description:null,price:1,priceLabel:"\xa31.00",options:null},{name:"Chips",description:null,price:4,priceLabel:"\xa34.00",options:null},{name:"Spiced Onions",description:null,price:1,priceLabel:"\xa31.00",options:null},{name:"Vegetable Paratha",description:null,price:4.5,priceLabel:"\xa34.50",options:null}]},{id:"cat_17",categoryId:17,name:"Soft Drinks",nestedCategoryIds:null,itemCount:37,items:[{name:"Black Current",description:null,price:.9,priceLabel:"\xa30.90",options:null},{name:"Black Current Water",description:null,price:1.3,priceLabel:"\xa31.30",options:null},{name:"Ginger Ale",description:null,price:2.9,priceLabel:"\xa32.90",options:null},{name:"LRG Soda Water",description:null,price:1.5,priceLabel:"\xa31.50",options:null},{name:"LRG.FR.OR.LEMO",description:null,price:3.9,priceLabel:"\xa33.90",options:null},{name:"Milk",description:null,price:1.5,priceLabel:"\xa31.50",options:null},{name:"Soda Water",description:null,price:1.5,priceLabel:"\xa31.50",options:null},{name:"Sprite",description:null,price:2.8,priceLabel:"\xa32.80",options:null},{name:"Coke Zero",description:null,price:2.8,priceLabel:"\xa32.80",options:null},{name:"Diet Coke",description:null,price:2.8,priceLabel:"\xa32.80",options:null},{name:"Irn Bru",description:null,price:2.8,priceLabel:"\xa32.80",options:null},{name:"Diet Irn-Bru",description:null,price:2.8,priceLabel:"\xa32.80",options:null},{name:"Fanta",description:null,price:2.8,priceLabel:"\xa32.80",options:null},{name:"Appletiser",description:null,price:2.8,priceLabel:"\xa32.80",options:null},{name:"Dash Lime",description:null,price:.9,priceLabel:"\xa30.90",options:null},{name:"Mango Lassi",description:null,price:3.9,priceLabel:"\xa33.90",options:null},{name:"Pint Coke",description:null,price:3.9,priceLabel:"\xa33.90",options:null},{name:"Pint Diet Coke",description:null,price:3.9,priceLabel:"\xa33.90",options:null},{name:"Schweppes Slime Line Tonic",description:null,price:2.8,priceLabel:"\xa32.80",options:null},{name:"Schweppes Tonic",description:null,price:2.8,priceLabel:"\xa32.80",options:null},{name:"Sparkling Water",description:null,price:2.8,priceLabel:"\xa32.80",options:null},{name:"DASH + WATER LRG",description:null,price:1.25,priceLabel:"\xa31.25",options:null},{name:"Fruit Shoot",description:null,price:1,priceLabel:"\xa31.00",options:null},{name:"LRG Soda Lime",description:null,price:3.9,priceLabel:"\xa33.90",options:null},{name:"Soda Lime",description:null,price:2.9,priceLabel:"\xa32.90",options:null},{name:"Still Water",description:null,price:2.8,priceLabel:"\xa32.80",options:null},{name:"Ginger Beer",description:null,price:2.9,priceLabel:"\xa32.90",options:null},{name:"Ginger Beer Lime",description:null,price:3.4,priceLabel:"\xa33.40",options:null},{name:"Glass of Water",description:null,price:0,priceLabel:"\xa30.00",options:null},{name:"Jug of Water",description:null,price:0,priceLabel:"\xa30.00",options:null},{name:"BLK CURR LEMO",description:null,price:2.9,priceLabel:"\xa32.90",options:null},{name:"FR OR LEMO",description:null,price:2.9,priceLabel:"\xa32.90",options:null},{name:"Fresh Orange Juice",description:null,price:2.8,priceLabel:"\xa32.80",options:null},{name:"Lemonade Lime Large",description:null,price:3.9,priceLabel:"\xa33.90",options:null},{name:"Lemonade Lime Small",description:null,price:2.9,priceLabel:"\xa32.90",options:null},{name:"LR BLK CURR LEMO",description:null,price:3.9,priceLabel:"\xa33.90",options:null},{name:"LRG FR OR LEMO",description:null,price:3.9,priceLabel:"\xa33.90",options:null}]},{id:"cat_18",categoryId:18,name:"Hot Beverages & Desserts",nestedCategoryIds:null,itemCount:18,items:[{name:"Black Coffee",description:null,price:2.9,priceLabel:"\xa32.90",options:null},{name:"White Coffee",description:null,price:3.2,priceLabel:"\xa33.20",options:null},{name:"Espresso",description:null,price:2.9,priceLabel:"\xa32.90",options:null},{name:"Cappuccino",description:null,price:3.5,priceLabel:"\xa33.50",options:null},{name:"Caf\xe9 Latte",description:null,price:3.5,priceLabel:"\xa33.50",options:null},{name:"Assam Tea",description:null,price:2.9,priceLabel:"\xa32.90",options:null},{name:"Massala Tea",description:null,price:2.9,priceLabel:"\xa32.90",options:null},{name:"Liqueur Coffee",description:null,price:7.9,priceLabel:"\xa37.90",options:null},{name:"Tartufo Bianco",description:"Sabayon ice cream with a coffee semifreddo core sprinkled with crushed meringue",price:6.5,priceLabel:"\xa36.50",options:null},{name:"Ice Cream",description:null,price:null,priceLabel:null,options:[{name:"Choose Options",price:0,priceLabel:"\xa30.00"}]},{name:"Tartufo Classic",description:"Sabayon semifreddo and gianduia gelato coated with crushed hazelnuts and dusted with cocoa powder",price:6.5,priceLabel:"\xa36.50",options:null},{name:"Casatta",description:"A slice of vanilla and chocolate ice cream with a cream and candied fruit centre",price:6.5,priceLabel:"\xa36.50",options:null},{name:"Gulab Jamin",description:null,price:6.5,priceLabel:"\xa36.50",options:null},{name:"Kulfi",description:"Traditional Indian Ice cream",price:6.5,priceLabel:"\xa36.50",options:null},{name:"Chocolate Fudge Cake",description:null,price:6.5,priceLabel:"\xa36.50",options:null},{name:"Lemon Cheesecake",description:"Gluten free Sweet digestive biscuit crumb based topped with a refreshing, zingy lemon cheesecake, finished with a stunning marbled lemon glaze",price:6.5,priceLabel:"\xa36.50",options:null},{name:"Vanilla Cheesecake",description:"Gluten Free New York Vanilla Cheesecake with a crunchy biscuit base",price:6.5,priceLabel:"\xa36.50",options:null},{name:"Caramel Shortcake",description:"A crunchie digestive biscuit base, covered with a rich golden caramel and topped with a smooth milk chocolate coating",price:5.5,priceLabel:"\xa35.50",options:null}]},{id:"cat_19",categoryId:19,name:"Vegan Menu",nestedCategoryIds:null,itemCount:29,items:[{name:"Aloo Chana (Vegan)",description:null,price:5.5,priceLabel:"\xa35.50",options:null},{name:"Spiced Onions (Vegan)",description:null,price:1,priceLabel:"\xa31.00",options:null},{name:"Poppadom (Vegan)",description:null,price:.9,priceLabel:"\xa30.90",options:null},{name:"Saag Tofu (Vegan)",description:"also available in garlic chilli - ginger lime - achari",price:5.5,priceLabel:"\xa35.50",options:null},{name:"Saag Aloo (Vegan)",description:null,price:5.5,priceLabel:"\xa35.50",options:null},{name:"Aubergine Potato (Vegan)",description:null,price:5.5,priceLabel:"\xa35.50",options:null},{name:"Aloo Gobi & Green Beans (Vegan)",description:null,price:5.5,priceLabel:"\xa35.50",options:null},{name:"Chilli Coriander Nan (Vegan)",description:null,price:3.5,priceLabel:"\xa33.50",options:null},{name:"Chana Daal (Vegan)",description:null,price:5.5,priceLabel:"\xa35.50",options:null},{name:"Chapati (Vegan)",description:null,price:1,priceLabel:"\xa31.00",options:null},{name:"Mutter Paneer (Vegan)",description:null,price:5.5,priceLabel:"\xa35.50",options:null},{name:"Okra Tomato (Vegan)",description:null,price:5.5,priceLabel:"\xa35.50",options:null},{name:"Mushroom Bhaji (dry) (Vegan)",description:null,price:5.5,priceLabel:"\xa35.50",options:null},{name:"Tandoori Roti (Vegan)",description:null,price:1.5,priceLabel:"\xa31.50",options:null},{name:"Okra Potato (Vegan)",description:null,price:5.5,priceLabel:"\xa35.50",options:null},{name:"Vegetable Pakora (Vegan)",description:null,price:4,priceLabel:"\xa34.00",options:null},{name:"Garlic & Mushroom Pakora (Vegan)",description:null,price:4.5,priceLabel:"\xa34.50",options:null},{name:"Gobi Pakora (Vegan)",description:null,price:4.5,priceLabel:"\xa34.50",options:null},{name:"Chana Poori (Vegan)",description:null,price:4.5,priceLabel:"\xa34.50",options:null},{name:"Mushroom Poori (Vegan)",description:null,price:4.5,priceLabel:"\xa34.50",options:null},{name:"Aloo Saag Dosa (Vegan)",description:null,price:4.5,priceLabel:"\xa34.50",options:null},{name:"Nan Bread (Vegan)",description:null,price:2.5,priceLabel:"\xa32.50",options:null},{name:"Garlic Nan (Vegan)",description:null,price:3,priceLabel:"\xa33.00",options:null},{name:"Peshwari Nan (Vegan)",description:null,price:3.5,priceLabel:"\xa33.50",options:null},{name:"Paratha (Vegan)",description:null,price:2.5,priceLabel:"\xa32.50",options:null},{name:"Chips (Vegan)",description:null,price:2.5,priceLabel:"\xa32.50",options:null},{name:"Fried Rice (Vegan)",description:null,price:2.5,priceLabel:"\xa32.50",options:null},{name:"Boiled Rice (Vegan)",description:null,price:2.5,priceLabel:"\xa32.50",options:null},{name:"Mushroom Rice (Vegan)",description:null,price:3.5,priceLabel:"\xa33.50",options:null}]},{id:"cat_23",categoryId:23,name:"Gin",nestedCategoryIds:null,itemCount:11,items:[{name:"Bombay Saphire",description:null,price:6.45,priceLabel:"\xa36.45",options:null},{name:"Brock",description:"Brockmans gin and meditteranean tonic garnished with sliced orange.",price:5.95,priceLabel:"\xa35.95",options:null},{name:"Delhite",description:null,price:6.45,priceLabel:"\xa36.45",options:null},{name:"Glaswegian",description:"Glasgow gin and elderflower tonic garnished with lime.",price:5.45,priceLabel:"\xa35.45",options:null},{name:"Gordon's",description:null,price:4.8,priceLabel:"\xa34.80",options:null},{name:"Hendricks",description:null,price:5.95,priceLabel:"\xa35.95",options:null},{name:"Hills and Harbour",description:"Hills and Harbour and classic tonic garnished with grapefruit",price:5.95,priceLabel:"\xa35.95",options:null},{name:"Rhubarb Fizz",description:"Edinberg Rubarb and Ginger gin, ginger ale, garnished with a rubarb stick.",price:6.45,priceLabel:"\xa36.45",options:null},{name:"Traditional",description:null,price:5.45,priceLabel:"\xa35.45",options:null},{name:"Tanquery",description:null,price:5.95,priceLabel:"\xa35.95",options:null},{name:"Hills & Harbour",description:null,price:4.7,priceLabel:"\xa34.70",options:null}]},{id:"cat_24",categoryId:24,name:"Vodka",nestedCategoryIds:null,itemCount:3,items:[{name:"Smirnoff",description:null,price:4.8,priceLabel:"\xa34.80",options:null},{name:"Belvedere",description:null,price:5.8,priceLabel:"\xa35.80",options:null},{name:"Grey Goose",description:null,price:5.8,priceLabel:"\xa35.80",options:null}]},{id:"cat_25",categoryId:25,name:"Rum",nestedCategoryIds:null,itemCount:2,items:[{name:"Captain Morgan\u2019s Spiced",description:null,price:4.8,priceLabel:"\xa34.80",options:null},{name:"Bacardi",description:null,price:4.8,priceLabel:"\xa34.80",options:null}]},{id:"cat_50",categoryId:50,name:"Main Course",nestedCategoryIds:null,itemCount:33,items:[{name:"Channa Daal",description:null,price:10.5,priceLabel:"\xa310.50",options:null},{name:"Saag Paneer",description:null,price:10.5,priceLabel:"\xa310.50",options:null},{name:"Channa Aloo",description:null,price:10.5,priceLabel:"\xa310.50",options:null},{name:"Baby Aubergine & Potatoes",description:null,price:10.5,priceLabel:"\xa310.50",options:null},{name:"Okra & Potatoes",description:null,price:10.5,priceLabel:"\xa310.50",options:null},{name:"Mushroom Bhaji Curry",description:null,price:10.5,priceLabel:"\xa310.50",options:null},{name:"Aloo Gobi with Beans",description:null,price:10.5,priceLabel:"\xa310.50",options:null},{name:"Fried Dry Okra & Tomatoes",description:null,price:10.5,priceLabel:"\xa310.50",options:null},{name:"Seekh Kebab",description:null,price:16.5,priceLabel:"\xa316.50",options:null},{name:"Lamb Tikka",description:null,price:17.5,priceLabel:"\xa317.50",options:null},{name:"Lamb Chops",description:null,price:17.5,priceLabel:"\xa317.50",options:null},{name:"Chicken Tikka",description:null,price:16.5,priceLabel:"\xa316.50",options:null},{name:"Mix Tikka",description:null,price:17.5,priceLabel:"\xa317.50",options:null},{name:"Chilli King Prawns",description:null,price:17.5,priceLabel:"\xa317.50",options:null},{name:"Lamb Karahi",description:null,price:13.5,priceLabel:"\xa313.50",options:null},{name:"Padina Lamb",description:null,price:13.5,priceLabel:"\xa313.50",options:null},{name:"South Indian Ginger Lamb",description:null,price:13.5,priceLabel:"\xa313.50",options:null},{name:"Lamb Saag",description:null,price:13.5,priceLabel:"\xa313.50",options:null},{name:"Lamb Okra",description:null,price:13.5,priceLabel:"\xa313.50",options:null},{name:"Butter Chicken",description:null,price:12.5,priceLabel:"\xa312.50",options:null},{name:"Chilli Garlic Chicken",description:null,price:12.5,priceLabel:"\xa312.50",options:null},{name:"Chicken Saag",description:null,price:12.5,priceLabel:"\xa312.50",options:null},{name:"Chicken Breast Curry",description:null,price:12.5,priceLabel:"\xa312.50",options:null},{name:"Chicken Tikka Masala",description:null,price:12.5,priceLabel:"\xa312.50",options:null},{name:"Chicken Korma",description:null,price:12.5,priceLabel:"\xa312.50",options:null},{name:"Ginger Lime Chicken Tikka",description:null,price:12.5,priceLabel:"\xa312.50",options:null},{name:"Chicken Chasni",description:null,price:12.5,priceLabel:"\xa312.50",options:null},{name:"Chicken Punjabi Chilli",description:null,price:12.5,priceLabel:"\xa312.50",options:null},{name:"Chicken Achari",description:null,price:12.5,priceLabel:"\xa312.50",options:null},{name:"Ginger & Lime King Prawn",description:null,price:16.5,priceLabel:"\xa316.50",options:null},{name:"Ginger Chicken & Spinach Leaf",description:null,price:12.5,priceLabel:"\xa312.50",options:null},{name:"Machi Masala",description:null,price:14.5,priceLabel:"\xa314.50",options:null},{name:"King Prawn Curry",description:null,price:16.5,priceLabel:"\xa316.50",options:null}]},{id:"cat_51",categoryId:51,name:"Tandoori Dishes",nestedCategoryIds:null,itemCount:10,items:[{name:"King Prawn Tandoori",description:null,price:19.95,priceLabel:"\xa319.95",options:null},{name:"King Prawn Tandoori",description:null,price:19.95,priceLabel:"\xa319.95",options:null},{name:"Chicken Tikka Tandoori",description:null,price:16.5,priceLabel:"\xa316.50",options:null},{name:"Lamb Tikka Tandoori",description:null,price:18,priceLabel:"\xa318.00",options:null},{name:"Lamb Chops Tandoori",description:null,price:18.5,priceLabel:"\xa318.50",options:null},{name:"Chicken Tikka Tandoori Breast",description:null,price:17.5,priceLabel:"\xa317.50",options:null},{name:"Seekh Kebab Tandoori",description:null,price:17.5,priceLabel:"\xa317.50",options:null},{name:"Mixed Tikka",description:null,price:19,priceLabel:"\xa319.00",options:null},{name:"Tandoori Mix Grill",description:null,price:22.95,priceLabel:"\xa322.95",options:null},{name:"Paneer Tikka Tandoori",description:null,price:16.5,priceLabel:"\xa316.50",options:null}]},{id:"cat_52",categoryId:52,name:"Traditional Indian Curry",nestedCategoryIds:null,itemCount:9,items:[{name:"Ginger Chicken Spinach Leaf",description:null,price:12.5,priceLabel:"\xa312.50",options:null},{name:"Ginger Lime Chicken Tikka",description:null,price:12.5,priceLabel:"\xa312.50",options:null},{name:"South Indian Ginger Lamb",description:null,price:13.5,priceLabel:"\xa313.50",options:null},{name:"Padina Lamb",description:null,price:13.5,priceLabel:"\xa313.50",options:null},{name:"Lamb Okra",description:null,price:13.5,priceLabel:"\xa313.50",options:null},{name:"Delhi Style Lamb",description:null,price:13.5,priceLabel:"\xa313.50",options:null},{name:"Machi Keema Mutter",description:null,price:14.5,priceLabel:"\xa314.50",options:null},{name:"Methi Keema Mutter",description:null,price:13.5,priceLabel:"\xa313.50",options:null},{name:"Ginger Lime King Prawn",description:null,price:16.5,priceLabel:"\xa316.50",options:null}]},{id:"cat_53",categoryId:53,name:"House Specialities",nestedCategoryIds:null,itemCount:21,items:[{name:"Chilli Garlic",description:null,price:null,priceLabel:null,options:[{name:"Chicken Breast",price:12.5,priceLabel:"\xa312.50"},{name:"Chicken Tikka",price:12.5,priceLabel:"\xa312.50"},{name:"Tender Lamb",price:13.5,priceLabel:"\xa313.50"},{name:"King Prawn",price:16.5,priceLabel:"\xa316.50"},{name:"Vegetable",price:11.5,priceLabel:"\xa311.50"}]},{name:"Korma",description:null,price:null,priceLabel:null,options:[{name:"Chicken Breast",price:12.5,priceLabel:"\xa312.50"},{name:"Chicken Tikka",price:12.5,priceLabel:"\xa312.50"},{name:"Tender Lamb",price:13.5,priceLabel:"\xa313.50"},{name:"King Prawn",price:16.5,priceLabel:"\xa316.50"},{name:"Vegetable",price:11.5,priceLabel:"\xa311.50"}]},{name:"Masala",description:null,price:null,priceLabel:null,options:[{name:"Chicken Breast",price:12.5,priceLabel:"\xa312.50"},{name:"Chicken Tikka",price:12.5,priceLabel:"\xa312.50"},{name:"Tender Lamb",price:13.5,priceLabel:"\xa313.50"},{name:"King Prawn",price:16.5,priceLabel:"\xa316.50"},{name:"Vegetable",price:11.5,priceLabel:"\xa311.50"}]},{name:"Rogan Josh",description:null,price:null,priceLabel:null,options:[{name:"Chicken Breast",price:12.5,priceLabel:"\xa312.50"},{name:"Chicken Tikka",price:12.5,priceLabel:"\xa312.50"},{name:"Tender Lamb",price:13.5,priceLabel:"\xa313.50"},{name:"King Prawn",price:16.5,priceLabel:"\xa316.50"},{name:"Vegetable",price:11.5,priceLabel:"\xa311.50"}]},{name:"Punjabi Chilli",description:null,price:null,priceLabel:null,options:[{name:"Chicken Breast",price:12.5,priceLabel:"\xa312.50"},{name:"Chicken Tikka",price:12.5,priceLabel:"\xa312.50"},{name:"Tender Lamb",price:13.5,priceLabel:"\xa313.50"},{name:"King Prawn",price:16.5,priceLabel:"\xa316.50"},{name:"Vegetable",price:11.5,priceLabel:"\xa311.50"}]},{name:"Chasni",description:null,price:null,priceLabel:null,options:[{name:"Chicken Breast",price:12.5,priceLabel:"\xa312.50"},{name:"Chicken Tikka",price:12.5,priceLabel:"\xa312.50"},{name:"Tender Lamb",price:13.5,priceLabel:"\xa313.50"},{name:"King Prawn",price:16.5,priceLabel:"\xa316.50"},{name:"Vegetable",price:11.5,priceLabel:"\xa311.50"}]},{name:"Passanda",description:null,price:null,priceLabel:null,options:[{name:"Chicken Breast",price:12.5,priceLabel:"\xa312.50"},{name:"Chicken Tikka",price:12.5,priceLabel:"\xa312.50"},{name:"Tender Lamb",price:13.5,priceLabel:"\xa313.50"},{name:"King Prawn",price:16.5,priceLabel:"\xa316.50"},{name:"Vegetable",price:11.5,priceLabel:"\xa311.50"}]},{name:"Saag",description:null,price:null,priceLabel:null,options:[{name:"Chicken Breast",price:12.5,priceLabel:"\xa312.50"},{name:"Chicken Tikka",price:12.5,priceLabel:"\xa312.50"},{name:"Tender Lamb",price:13.5,priceLabel:"\xa313.50"},{name:"King Prawn",price:16.5,priceLabel:"\xa316.50"},{name:"Vegetable",price:11.5,priceLabel:"\xa311.50"}]},{name:"Achari",description:null,price:null,priceLabel:null,options:[{name:"Chicken Breast",price:12.5,priceLabel:"\xa312.50"},{name:"Chicken Tikka",price:12.5,priceLabel:"\xa312.50"},{name:"Tender Lamb",price:13.5,priceLabel:"\xa313.50"},{name:"King Prawn",price:16.5,priceLabel:"\xa316.50"},{name:"Vegetable",price:11.5,priceLabel:"\xa311.50"}]},{name:"Malaidar",description:null,price:null,priceLabel:null,options:[{name:"Chicken Breast",price:12.5,priceLabel:"\xa312.50"},{name:"Chicken Tikka",price:12.5,priceLabel:"\xa312.50"},{name:"Tender Lamb",price:13.5,priceLabel:"\xa313.50"},{name:"King Prawn",price:16.5,priceLabel:"\xa316.50"},{name:"Vegetable",price:11.5,priceLabel:"\xa311.50"}]},{name:"Jalfrezi",description:null,price:null,priceLabel:null,options:[{name:"Chicken Breast",price:12.5,priceLabel:"\xa312.50"},{name:"Chicken Tikka",price:12.5,priceLabel:"\xa312.50"},{name:"Tender Lamb",price:13.5,priceLabel:"\xa313.50"},{name:"King Prawn",price:16.5,priceLabel:"\xa316.50"},{name:"Vegetable",price:11.5,priceLabel:"\xa311.50"}]},{name:"Jaipuri",description:null,price:null,priceLabel:null,options:[{name:"Chicken Breast",price:12.5,priceLabel:"\xa312.50"},{name:"Chicken Tikka",price:12.5,priceLabel:"\xa312.50"},{name:"Tender Lamb",price:13.5,priceLabel:"\xa313.50"},{name:"King Prawn",price:16.5,priceLabel:"\xa316.50"},{name:"Vegetable",price:11.5,priceLabel:"\xa311.50"}]},{name:"Kashmiri Korma",description:null,price:null,priceLabel:null,options:[{name:"Chicken Breast",price:12.5,priceLabel:"\xa312.50"},{name:"Chicken Tikka",price:12.5,priceLabel:"\xa312.50"},{name:"Tender Lamb",price:13.5,priceLabel:"\xa313.50"},{name:"King Prawn",price:16.5,priceLabel:"\xa316.50"},{name:"Vegetable",price:11.5,priceLabel:"\xa311.50"}]},{name:"Balti",description:null,price:null,priceLabel:null,options:[{name:"Chicken Breast",price:12.5,priceLabel:"\xa312.50"},{name:"Chicken Tikka",price:12.5,priceLabel:"\xa312.50"},{name:"Tender Lamb",price:13.5,priceLabel:"\xa313.50"},{name:"King Prawn",price:16.5,priceLabel:"\xa316.50"},{name:"Vegetable",price:11.5,priceLabel:"\xa311.50"}]},{name:"Masaledar",description:null,price:null,priceLabel:null,options:[{name:"Chicken Breast",price:12.5,priceLabel:"\xa312.50"},{name:"Chicken Tikka",price:12.5,priceLabel:"\xa312.50"},{name:"Tender Lamb",price:13.5,priceLabel:"\xa313.50"},{name:"King Prawn",price:16.5,priceLabel:"\xa316.50"},{name:"Vegetable",price:11.5,priceLabel:"\xa311.50"}]},{name:"Madras",description:null,price:null,priceLabel:null,options:[{name:"Chicken Breast",price:12.5,priceLabel:"\xa312.50"},{name:"Chicken Tikka",price:12.5,priceLabel:"\xa312.50"},{name:"Tender Lamb",price:13.5,priceLabel:"\xa313.50"},{name:"King Prawn",price:16.5,priceLabel:"\xa316.50"},{name:"Vegetable",price:11.5,priceLabel:"\xa311.50"}]},{name:"Dhansac",description:null,price:null,priceLabel:null,options:[{name:"Chicken Breast",price:12.5,priceLabel:"\xa312.50"},{name:"Chicken Tikka",price:12.5,priceLabel:"\xa312.50"},{name:"Tender Lamb",price:13.5,priceLabel:"\xa313.50"},{name:"King Prawn",price:16.5,priceLabel:"\xa316.50"},{name:"Vegetable",price:11.5,priceLabel:"\xa311.50"}]},{name:"Karahi",description:null,price:null,priceLabel:null,options:[{name:"Chicken Breast",price:12.5,priceLabel:"\xa312.50"},{name:"Chicken Tikka",price:12.5,priceLabel:"\xa312.50"},{name:"Tender Lamb",price:13.5,priceLabel:"\xa313.50"},{name:"King Prawn",price:16.5,priceLabel:"\xa316.50"},{name:"Vegetable",price:11.5,priceLabel:"\xa311.50"}]},{name:"Do Piaza",description:null,price:null,priceLabel:null,options:[{name:"Chicken Breast",price:12.5,priceLabel:"\xa312.50"},{name:"Chicken Tikka",price:12.5,priceLabel:"\xa312.50"},{name:"Tender Lamb",price:13.5,priceLabel:"\xa313.50"},{name:"King Prawn",price:16.5,priceLabel:"\xa316.50"},{name:"Vegetable",price:11.5,priceLabel:"\xa311.50"}]},{name:"Patia",description:null,price:null,priceLabel:null,options:[{name:"Chicken Breast",price:12.5,priceLabel:"\xa312.50"},{name:"Chicken Tikka",price:12.5,priceLabel:"\xa312.50"},{name:"Tender Lamb",price:13.5,priceLabel:"\xa313.50"},{name:"King Prawn",price:16.5,priceLabel:"\xa316.50"},{name:"Vegetable",price:11.5,priceLabel:"\xa311.50"}]},{name:"Bhoona",description:null,price:null,priceLabel:null,options:[{name:"Chicken Breast",price:12.5,priceLabel:"\xa312.50"},{name:"Chicken Tikka",price:12.5,priceLabel:"\xa312.50"},{name:"Tender Lamb",price:13.5,priceLabel:"\xa313.50"},{name:"King Prawn",price:16.5,priceLabel:"\xa316.50"},{name:"Vegetable",price:11.5,priceLabel:"\xa311.50"}]}]}],totals:{categories:24,items:362},orderingEnabled:!1,orderable:!1,currentMenuConfirmed:!1,needsConfirmation:!0,status:"published-reference-to-confirm"}},cecchinis:{venueId:"cecchinis",databaseSlug:"cecchinis",urlSlug:"cecchinis",uuidReserved:"596c6f7e-9797-4e16-84fe-db4a99fa1bdc",name:"Cecchinis",address:"72 Fort Street, Wellington Square, Ayr, South Ayrshire KA7 1EH",phone:"01292 263607",email:"",website:"https://cecchinisayr.co.uk/",branding:{accent:"#C88810",accentSuggested:"#C88810",ink:"#0A0A0A",smallTextAccent:"#C88810",onAccent:"#0B0B0B",testedDarkSurfaces:["#0A0A0A","#222222","#292929"],minimumSmallTextContrast:4.8390203326660215,buttonLabelContrast:6.546833660360053,rawAccentOnInkContrast:6.585257265326411,logoRecoloured:!1,hasLogo:!0,logo:"assets/brand/cecchinis.png",hero:"assets/brand/cecchinis-hero.png",noDuplicateNameLine:!0},hours:{status:"published-venue-hours-to-confirm",days:{0:["10:00","21:00"],1:["10:00","22:00"],2:["10:00","22:00"],3:["10:00","22:00"],4:["10:00","22:00"],5:["10:00","22:00"],6:["10:00","22:00"]},sessionsByDay:null,needsConfirmation:!0,note:"Published venue hours: Mon\u2013Sat 10:00\u201322:00; Sun 10:00\u201321:00. Other opening-time sources conflict. Food service starts at 12:00; kitchen closing times to confirm."},kitchenSessionsByDay:null,booking:{mode:"in-app-manager-request",nativeDiary:!0,nativeRequests:!0,automaticConfirmation:!1,externalLinks:!1,requiresManager:!0,managerReady:!1,requiresConfirmedKitchenHours:!0,lastSittingMinutesBeforeClose:null,fields:["date","time","Covers","name","phone","email","notes"],sendMessages:!1},deposit:{on:!1,amount:null,perPersonPence:null,fromParty:null,policy:null,needsConfirmation:!0},features:{takeaway:!1,delivery:!1,payments:!1,loyalty:!1,orderAtTable:!1,hotel:!1,directOrdering:!1},clockArea:{on:!0,lat:55.461505,lng:-4.6345736,radius:150,offRotaPrompt:!1,needsConfirmation:!1,source:"Exact-address FSA location recorded in current venue pack; 21063"},gatesToConfirm:["authorised manager and staff","table plan and Covers","deposit and booking terms","pay settings","ordering and delivery to set up","loyalty to set up","opening and kitchen hours","public email","set-menu offer time window","dine-in versus takeaway prices","allergen matrix"],menuServiceContext:null,allergenCaveat:null,emailNeedsConfirmation:!0,questionnaire:{version:1,venueId:"cecchinis",source:"from-config",venue:{name:"Cecchinis",tagline:"Bar, bistro & restaurant \xb7 authentic Italian \xb7 Ayr since 1985",address:"72 Fort Street, Wellington Square, Ayr, South Ayrshire KA7 1EH",phone:"01292 263607",email:"",website:"https://cecchinisayr.co.uk/",hasLogo:!0},team:[],suppliers:[],accounts:[],hours:{status:"published-venue-hours-to-confirm",days:{0:["10:00","21:00"],1:["10:00","22:00"],2:["10:00","22:00"],3:["10:00","22:00"],4:["10:00","22:00"],5:["10:00","22:00"],6:["10:00","22:00"]},sessionsByDay:null,needsConfirmation:!0,note:"Published venue hours: Mon\u2013Sat 10:00\u201322:00; Sun 10:00\u201321:00. Other opening-time sources conflict. Food service starts at 12:00; kitchen closing times to confirm."},tables:{template:"restaurant",tables:null,covers:null,areas:[],needsConfirmation:!0,note:"Table plan and Covers to confirm."},features:{bookings:!0,takeaway:!1,orderAtTable:!1,tips:!1,rota:!1,games:!1,specials:!1,loyalty:!1},notes:"Separate cecchinis tenant. In-app manager-confirmed table requests only. Deposit terms to confirm; charging is off. Team empty. No payroll or connected accounts. Ordering, delivery and loyalty to set up. Published menu is reference only; current prices, availability and allergens to confirm."},menu:{venueId:"cecchinis",currency:"GBP",offers:[{name:"2 for \xa322 Pizza / Pasta",when:"Monday & Wednesday 12:00\u201318:30"},{name:"2 Courses for \xa318.95",when:"Everyday \u2014 home banner 12:00\u201318:30; menus page set block says 16:00\u201318:30"},{name:"Add a third course",priceGbp:6.25,when:"With 2-course set"}],menus:[{id:"all-day",name:"All Day Menu",when:"Served from 12:00",channel:"dine-in",sections:[{name:"Starters",items:[{name:"Zuppa Del Giorno",desc:"Homemade soup of the day",priceGbp:6.25},{name:"Pate Della Casa",desc:"Chicken liver pate, with garlic bread & homemade chutney",priceGbp:8.65,markers:["*"]},{name:"Melone con Sorbetto",desc:"Served with berry compote and refreshing sorbet",priceGbp:8.25,markers:["v","vo","*"]},{name:"Mozzarella",desc:"Mozzarella sticks, coated in breadcrumbs, deep fried, with Napoli sauce",priceGbp:8.75,markers:["v"]},{name:"Chicken Tempura",desc:"Strips of chicken in tempura batter, served with sweet chilli dip",priceGbp:9.95},{name:"Gamberoni",desc:"King prawns, pan fried with garlic & chilli, served with lemon & basil flavoured rice",priceGbp:10.25,markers:["*"]},{name:"Goats Cheese Insalata",desc:"Mixed leaves, goats cheese, sundried tomatoes, pinenuts & pesto",priceGbp:8.95,markers:["v","*"]},{name:"Prawn Cocktail",desc:"Atlantic prawns bound in a marie rose dressing served with mixed leaves",priceGbp:9.55,markers:["*"]}]},{name:"Main Courses",items:[{name:"Pollo",desc:"Chicken breast, pan fried with bacon & leeks in a cream sauce served with potatoes & market vegetables",priceGbp:18.95,markers:["*"]},{name:"Chicken Tempura",desc:"Strips of chicken in tempura batter, served with chips, salad & sweet chilli dip",priceGbp:18.95},{name:"Pollo Milanese",desc:"Breaded chicken breast with spaghetti Napoli",priceGbp:17.95},{name:"Spezzatino",desc:"Slow cooked beef braised with red wine, vegetables, herbs & Italian spices",priceGbp:18.95,markers:["*"]},{name:"Borlotti Casserole",desc:"Borlotti beans, Italian sausage, peppers in a Napoli sauce, with garlic bread & mashed potatoes",priceGbp:17.95,markers:["*"]},{name:"Merluzzo",desc:"Deep fried battered haddock served with chips & tartare sauce",priceGbp:18.5},{name:"Roasted Pepper",desc:"Filled with tomato and pepper risotto and mozzarella, finished with balsamic glaze and pesto",priceGbp:18.95,markers:["*"]},{name:"Baked Salmon",desc:"With seasonal vegetables & potatoes finished with a pesto cream sauce",priceGbp:19.95,markers:["*"]},{name:"Gamberoni e Riso",desc:"King prawns, pan fried with garlic & chilli, served with lemon & basil flavoured rice",priceGbp:19.95,markers:["*"]}]},{name:"Burgers",items:[{name:"Cecchini Burger",desc:"8oz Scotch beef burger in toasted bun with tomato, baby gem & chips",priceGbp:17.95,extras:["add cheese \xa31.50","bacon \xa32"]},{name:"Crispy Chicken Burger",desc:"Breaded chicken breast in toasted bun with chips, salad & cajun mayonnaise",priceGbp:17.95,extras:["add cheese \xa31.50","bacon \xa32"]},{name:"Vegan Burger",desc:"Served in a toasted bun with chips",priceGbp:17.95,markers:["v","vo"]}]},{name:"Risotto",items:[{name:"Red pepper & sun-dried tomato",priceGbp:15.5,markers:["v"],extras:["add chicken \xa33","add bacon \xa32"]},{name:"Wild mushroom & parmesan",priceGbp:16.5,markers:["v","*"],extras:["add chicken \xa33","add bacon \xa32"]},{name:"Smoked haddock & pea risotto",desc:"Smoked haddock, sweet garden peas, butter & parmesan",priceGbp:18.5,markers:["*"]}]},{name:"Pizza",items:[{name:"Authentic Margherita",desc:"Mozzarella & Napoli sauce & basil",priceGbp:11.95,markers:["v"]},{name:"Arrabbiata",desc:"Mozzarella, Napoli sauce, onions, peppers, mushrooms & chilli",priceGbp:13.95,markers:["v"]},{name:"Cecchini",desc:"Mozzarella, Napoli sauce, Parma ham, mushrooms & black olives",priceGbp:14.95},{name:"Pollo e Pancetta",desc:"Mozzarella, Napoli sauce, chicken, bacon & sun dried tomatoes",priceGbp:15.95},{name:"Festa Di Carne",desc:"Mozzarella, Napoli sauce, Italian sausage, pepperoni, bacon & Parma ham",priceGbp:17.95},{name:"Quattro Stagioni",desc:"Mozzarella, Napoli sauce, onions, mushrooms, olives & peppers",priceGbp:14.95,markers:["v"]},{name:"Pepperoni",desc:"Mozzarella, Napoli sauce & pepperoni",priceGbp:14.5},{name:"Goats Cheese",desc:"Goats cheese, tomato, caramelized red onions, sun blushed tomatoes & rocket",priceGbp:15.95}]},{name:"Pasta",items:[{name:"Macaroni",desc:"Macaroni cooked in a rich cheese sauce",priceGbp:12.95,markers:["v","*"],extras:["add bacon \xa32"]},{name:"Spaghetti Napoli",desc:"Cecchini\u2019s Napoli sauce",priceGbp:11.95,markers:["v","vo","*"],extras:["add chicken \xa33","add bacon \xa32"]},{name:"Penne Arrabbiata",desc:"Onions, mushrooms, peppers, chillies & Napoli sauce",priceGbp:13.95,markers:["v","vo","*"],extras:["add chicken \xa33","add bacon \xa32"]},{name:"Lasagne al Forno",desc:"Served with garlic bread",priceGbp:18.5},{name:"Spaghetti Bolognese",desc:"Minced beef, tomatoes, garlic, oregano & red wine",priceGbp:16.5,markers:["*"]},{name:"Linguine Carbonara",desc:"Bacon, garlic, white wine and cream",priceGbp:16.65,markers:["*"]},{name:"Penne al Pesto",desc:"Penne, pinenuts, basil, olive oil, garlic, cherry tomatoes & parmesan",priceGbp:16.5,markers:["v","*"]},{name:"Penne Salsiccia Toscana",desc:"Italian sausage, peppers, garlic & Napoli sauce",priceGbp:16.5,markers:["*"]},{name:"Penne al Pollo",desc:"Chicken breast, mushrooms, leeks, white wine & cream",priceGbp:16.5,markers:["*"]},{name:"Linguine de Mare",desc:"Squid, mussels, salmon, king prawn, Napoli sauce & chilli",priceGbp:19.95,markers:["*"]},{name:"Tortelli Ricotta E Spinaci",desc:"Served in a Napoli sauce finished with cream",priceGbp:16.95,markers:["v"]}]},{name:"Side Orders",items:[{name:"Garlic bread",priceGbp:4},{name:"Bruschetta",priceGbp:8.95,extras:["with cheese \xa39.95"]},{name:"Garlic pizza base with rosemary",priceGbp:9.95,extras:["with cheese \xa310.95"]},{name:"Macaroni Bites",priceGbp:4.95}]}]},{id:"set-2course",name:"Trattoria \u2014 2 Course Set Menu",when:"2 courses \xa318.95 | Everyday \u2014 site conflict 12:00\u201318:30 (banner) vs 16:00\u201318:30 (menus page); courses must be ordered together",channel:"dine-in",priceGbp:18.95,addThirdCourseGbp:6.25,sections:[{name:"Starters",items:[{name:"Zuppa Del Giorno"},{name:"Pate Della Casa"},{name:"Funghi",desc:"Toasted garlic bread topped with pan fried garlic mushrooms finished with cream",markers:["v"]},{name:"Mozzarella",markers:["v"]}]},{name:"Mains",items:[{name:"Pollo Milanese"},{name:"Spezzatino"},{name:"Cecchini Burger",extras:["add cheese \xa31.00","add bacon \xa31.85"]},{name:"Merluzzo"},{name:"Pizza Margherita",markers:["v"]},{name:"Penne Arrabbiata",markers:["v"],extras:["add chicken \xa32","add bacon \xa31.85"]},{name:"Macaroni",markers:["v"]}]},{name:"Desserts",items:[{name:"Tiramisu"},{name:"Torta Della Nonna"},{name:"Warm Chocolate Fudge Cake"},{name:"Honeycomb & Chocolate Cheesecake",desc:"Served with vanilla ice cream"}]}]},{id:"kids",name:"Kids Menu",when:"All day, everyday",channel:"dine-in",sections:[{name:"Starters",priceGbp:2.5,items:[{name:"Soup of the day"},{name:"Garlic bread & cheese"},{name:"Melon with fruit compote"},{name:"Deep fried mozzarella cheese"},{name:"Make your own Margherita Pizza"}]},{name:"Mains",items:[{name:"I Don't Care \u2014 Hotdog & Chips"},{name:"I'm Not Hungry \u2014 Penne Napoli"},{name:"I Don't Want That \u2014 Macaroni Cheese"},{name:"Whatever \u2014 Penne Bolognaise"},{name:"Haddock Goujons & chips"},{name:"I Don't Like It Here \u2014 Chicken Tempura & chips"}]},{name:"Ice cream",items:[{name:"Vanilla, chocolate or strawberry"}]}]},{id:"takeaway",name:"Takeaway",when:"Monday\u2013Saturday 12:00\u201322:00 | Sunday 12:00\u201321:00",channel:"takeaway",sections:[{name:"Starters",items:[{name:"Pate Della Casa",desc:"Homemade chicken liver pate, oatcakes & homemade chutney",priceGbp:5.95},{name:"Funghi",desc:"Toasted Vienna bread topped with pan fried garlic mushrooms finished with cream",priceGbp:5.95,markers:["v"]},{name:"Mozzarella",desc:"Mozzarella sticks with mixed salad",priceGbp:5.95,markers:["v"]},{name:"Crispy Chicken Tempura",desc:"Starter with sweet chilli; main with chips",priceStarterGbp:7.95,priceMainGbp:12.95}]},{name:"Mains",items:[{name:"Pollo",priceGbp:11.95},{name:"Borlotti Casserole",priceGbp:10.95},{name:"Cecchini Burger",priceGbp:11.95,extras:["add cheese \xa31.50","add cheese & bacon \xa32.00"]},{name:"Merluzzo",priceGbp:10.95},{name:"Spezzatino",priceGbp:10.95}]},{name:"Pizza",items:[{name:"Margherita",priceGbp:10.95,markers:["v"]},{name:"Arrabbiata",priceGbp:11.95,markers:["v"]},{name:"Cecchini",priceGbp:12.95},{name:"Salsiccia",priceGbp:12.95},{name:"Festa Di Carne",priceGbp:13.95},{name:"Quattro Stagioni",priceGbp:11.95,markers:["v"]},{name:"Pepperoni",priceGbp:12.95},{name:"Pollo e pancetta pizza",priceGbp:12.95},{name:"Goats cheese pizza",priceGbp:12.95}]},{name:"Pasta",items:[{name:"Maccheroni",priceGbp:10.95,markers:["v"]},{name:"Spaghetti Napoli",priceGbp:10.95,markers:["v"]},{name:"Penne Arrabbiata",priceGbp:11.5,markers:["v"]},{name:"Lasagne Al Forno",priceGbp:10.95},{name:"Spaghetti Bolognese",priceGbp:11.95},{name:"Spaghetti Carbonara",priceGbp:11.95},{name:"Penne Della Casa",priceGbp:11.95},{name:"Penne Salsiccia Toscana",priceGbp:11.95},{name:"Penne Al Pollo",priceGbp:11.95},{name:"Penne Pesto",priceGbp:11.95,markers:["v"]}]},{name:"Risotto",items:[{name:"Red Pepper & Sun-Blushed Tomato",priceGbp:9.95,markers:["v"],extras:["add chicken \xa33","add bacon \xa32"]},{name:"Wild Mushroom & Parmesan",priceGbp:9.95,markers:["v"],extras:["add chicken \xa33","add bacon \xa32"]}]},{name:"Desserts",items:[{name:"Chocolate Fudge Cake",priceGbp:5.5},{name:"Honeycomb Cheesecake",priceGbp:5.5},{name:"Caramel Apple Pie",priceGbp:5.5},{name:"Tiramisu",priceGbp:5.5}]},{name:"Kids takeaway",items:[{name:"Margherita Pizza",priceGbp:5.95},{name:"Chicken Tempura & Chips",priceGbp:5.95},{name:"Penne Bolognese",priceGbp:5.95},{name:"Haddock & Chips",priceGbp:5.95}]},{name:"Sides",items:[{name:"Garlic Bread plain",priceGbp:3.5},{name:"Garlic Bread with cheese",priceGbp:4.5},{name:"Bruschetta plain",priceGbp:5},{name:"Bruschetta with cheese",priceGbp:6},{name:"Garlic Pizza",priceGbp:9.95},{name:"Side Salad",priceGbp:3.5},{name:"Chips",priceGbp:3.95},{name:"Cajun Chips",priceGbp:4.55},{name:"Parmesan & Chilli Chips",priceGbp:4.55}]},{name:"Buffet Trays",items:[{name:"Lasagne",priceGbp:60},{name:"Penne Arrabbiata",priceGbp:55},{name:"Penne Bolognese",priceGbp:60},{name:"Penne Napoli",priceGbp:55},{name:"Penne Salsiccia",priceGbp:60}]}]}],orderingEnabled:!1,orderable:!1,currentMenuConfirmed:!1,needsConfirmation:!0,status:"published-reference-to-confirm"}},mrbasrais:{venueId:"mrbasrais",databaseSlug:"mrbasrais",urlSlug:"mrbasrais",uuidReserved:"5d500571-e205-4ead-bb58-60e986b6f40e",name:"Mr Basrai's World Cuisine",address:"3\u20137 Beresford Terrace, Ayr, South Ayrshire, KA7 2ER",phone:"01292 267888",email:"info@mrbasraisayr.com",website:"https://www.mrbasraisayr.com/",branding:{accent:"#E11A2C",accentSuggested:"#E11A2C",ink:"#1A0A0A",smallTextAccent:"#EB6370",onAccent:"#FFFFFF",testedDarkSurfaces:["#1A0A0A","#222222","#292929"],minimumSmallTextContrast:4.538442146778251,buttonLabelContrast:4.788356992699011,rawAccentOnInkContrast:4.017175228571037,logoRecoloured:!1,hasLogo:!0,logo:"assets/brand/mrbasrais.png",hero:"assets/brand/mrbasrais-hero.png",noDuplicateNameLine:!0},hours:{status:"published-split-sessions",days:{},sessionsByDay:{0:[["12:00","17:00"],["17:00","21:00"]],1:[["12:00","15:00"],["16:30","21:00"]],2:[],3:[["12:00","15:00"],["16:30","21:00"]],4:[["12:00","15:00"],["16:30","21:00"]],5:[["12:00","15:00"],["16:30","21:00"]],6:[["12:00","16:00"],["16:30","21:30"]]},needsConfirmation:!0,note:"Published buffet sessions; Tuesday closed. Mon/Wed\u2013Fri lunch 12:00\u201315:00 and dinner 16:30\u201321:00; Saturday 12:00\u201316:00 and 16:30\u201321:30; Sunday 12:00\u201317:00 and 17:00\u201321:00. Breaks preserved. Holiday exceptions to confirm."},kitchenSessionsByDay:{0:[["12:00","17:00"],["17:00","21:00"]],1:[["12:00","15:00"],["16:30","21:00"]],2:[],3:[["12:00","15:00"],["16:30","21:00"]],4:[["12:00","15:00"],["16:30","21:00"]],5:[["12:00","15:00"],["16:30","21:00"]],6:[["12:00","16:00"],["16:30","21:30"]]},booking:{mode:"in-app-manager-request",nativeDiary:!0,nativeRequests:!0,automaticConfirmation:!1,externalLinks:!1,requiresManager:!0,managerReady:!1,requiresConfirmedKitchenHours:!0,lastSittingMinutesBeforeClose:30,fields:["date","time","Covers","name","phone","email","notes"],sendMessages:!1},deposit:{on:!1,amount:null,perPersonPence:null,fromParty:null,policy:null,needsConfirmation:!0},features:{takeaway:!1,delivery:!1,payments:!1,loyalty:!1,orderAtTable:!1,hotel:!1,directOrdering:!1},clockArea:{on:!1,lat:null,lng:null,radius:150,offRotaPrompt:!1,needsConfirmation:!0},gatesToConfirm:["authorised manager and staff","table plan and Covers","deposit and booking terms","pay settings","ordering and delivery to set up","loyalty to set up","kitchen and last-sitting confirmation","bank-holiday exceptions","Christmas hours and prices","buffet rotation and availability","drinks prices","accessibility details","precise venue location"],menuServiceContext:null,allergenCaveat:null,emailNeedsConfirmation:!1,questionnaire:{version:1,venueId:"mrbasrais",source:"from-config",venue:{name:"Mr Basrai's World Cuisine",tagline:"Multicuisine World Buffet Restaurant \xb7 Ayr",address:"3\u20137 Beresford Terrace, Ayr, South Ayrshire, KA7 2ER",phone:"01292 267888",email:"info@mrbasraisayr.com",website:"https://www.mrbasraisayr.com/",hasLogo:!0},team:[],suppliers:[],accounts:[],hours:{status:"published-split-sessions",days:{},sessionsByDay:{0:[["12:00","17:00"],["17:00","21:00"]],1:[["12:00","15:00"],["16:30","21:00"]],2:[],3:[["12:00","15:00"],["16:30","21:00"]],4:[["12:00","15:00"],["16:30","21:00"]],5:[["12:00","15:00"],["16:30","21:00"]],6:[["12:00","16:00"],["16:30","21:30"]]},needsConfirmation:!0,note:"Published buffet sessions; Tuesday closed. Mon/Wed\u2013Fri lunch 12:00\u201315:00 and dinner 16:30\u201321:00; Saturday 12:00\u201316:00 and 16:30\u201321:30; Sunday 12:00\u201317:00 and 17:00\u201321:00. Breaks preserved. Holiday exceptions to confirm."},tables:{template:"restaurant",tables:null,covers:null,areas:[],needsConfirmation:!0,note:"Table plan and Covers to confirm."},features:{bookings:!0,takeaway:!1,orderAtTable:!1,tips:!1,rota:!1,games:!1,specials:!1,loyalty:!1},notes:"Separate mrbasrais tenant. In-app manager-confirmed table requests only. Deposit terms to confirm; charging is off. Team empty. No payroll or connected accounts. Ordering, delivery and loyalty to set up. Published menu is reference only; current prices, availability and allergens to confirm."},menu:{currency:"GBP",buffetSessionPrices:{currency:"GBP",asOf:"2026-11-06",sessions:[{label:"Mon\u2013Fri lunch",price:13.99},{label:"Sat lunch",price:14.99},{label:"Sun & BH lunch",price:18.99},{label:"Mon\u2013Fri dinner",price:18.99},{label:"Sat dinner",price:19.99},{label:"Sun & BH dinner",price:18.99}],kids:"10 & under half price; infants 3 & under free (proof of age may be required)"},menus:[{id:"buffet-stations",name:"World Buffet Stations",setPrice:null,setPriceNote:"Priced per session \u2014 see buffetSessionPrices / Price & Time page",categories:[{name:"Indian",description:"High-quality fusion of delicately spiced dishes and masala sauces; nostalgic Indian dishes with global techniques.",items:[{name:"Onion Bhaji",description:"Indian starter",price:null,priceType:"included_in_buffet",allergens:null},{name:"Chicken Pakora",description:"Indian starter",price:null,priceType:"included_in_buffet",allergens:null},{name:"Vegetable pakora (varieties)",description:"Indian starter",price:null,priceType:"included_in_buffet",allergens:null},{name:"Chicken Tikka",description:"Indian starter",price:null,priceType:"included_in_buffet",allergens:null},{name:"Paneer Tikka",description:"Indian starter",price:null,priceType:"included_in_buffet",allergens:null},{name:"Samosa",description:"Indian starter",price:null,priceType:"included_in_buffet",allergens:null},{name:"Hariyali Tikki",description:"Indian starter",price:null,priceType:"included_in_buffet",allergens:null},{name:"Samosa Chat",description:"Indian street food",price:null,priceType:"included_in_buffet",allergens:null},{name:"Aloo Tikki Chat",description:"Indian street food",price:null,priceType:"included_in_buffet",allergens:null},{name:"Masala Dosa",description:"Indian street food",price:null,priceType:"included_in_buffet",allergens:null},{name:"Pani Puri",description:"Indian street food",price:null,priceType:"included_in_buffet",allergens:null},{name:"Dahi Bhalle",description:"Indian street food",price:null,priceType:"included_in_buffet",allergens:null},{name:"Chicken Korma",description:"Indian curry",price:null,priceType:"included_in_buffet",allergens:null},{name:"Butter Chicken",description:"Indian curry",price:null,priceType:"included_in_buffet",allergens:null},{name:"Chicken Tikka Masala",description:"Indian curry",price:null,priceType:"included_in_buffet",allergens:null},{name:"Lamb Bhuna",description:"Indian curry",price:null,priceType:"included_in_buffet",allergens:null},{name:"Lamb Rogan Josh",description:"Indian curry",price:null,priceType:"included_in_buffet",allergens:null},{name:"Lamb Karahi",description:"Indian curry",price:null,priceType:"included_in_buffet",allergens:null},{name:"Lamb Vindaloo",description:"Indian curry",price:null,priceType:"included_in_buffet",allergens:null},{name:"Curry on the Bone",description:"Indian curry",price:null,priceType:"included_in_buffet",allergens:null},{name:"Chicken Chasni",description:"Indian curry",price:null,priceType:"included_in_buffet",allergens:null},{name:"Chicken Madras",description:"Indian curry",price:null,priceType:"included_in_buffet",allergens:null},{name:"Chicken Masala",description:"Indian curry",price:null,priceType:"included_in_buffet",allergens:null}]},{name:"Chinese",description:"Chinese starters and mains as published on menus page.",items:[{name:"Spring rolls",description:"Starter",price:null,priceType:"included_in_buffet",allergens:null},{name:"Chilli chicken",description:"Starter",price:null,priceType:"included_in_buffet",allergens:null},{name:"Dimsums",description:"Starter",price:null,priceType:"included_in_buffet",allergens:null},{name:"Roast Duck & Pancakes",description:"Starter",price:null,priceType:"included_in_buffet",allergens:null},{name:"Chilli chips",description:"Starter",price:null,priceType:"included_in_buffet",allergens:null},{name:"Prawn crackers",description:"Starter",price:null,priceType:"included_in_buffet",allergens:null},{name:"Sweet & Sour Chicken",description:"Main",price:null,priceType:"included_in_buffet",allergens:null},{name:"Manchurian",description:"Main",price:null,priceType:"included_in_buffet",allergens:null},{name:"Fried Mushrooms",description:"Main",price:null,priceType:"included_in_buffet",allergens:null},{name:"Beef in Black Beans",description:"Main",price:null,priceType:"included_in_buffet",allergens:null},{name:"Kung-pao Chicken",description:"Main",price:null,priceType:"included_in_buffet",allergens:null},{name:"Dragon Chicken",description:"Main",price:null,priceType:"included_in_buffet",allergens:null},{name:"Chinese Chicken Curry",description:"Main",price:null,priceType:"included_in_buffet",allergens:null},{name:"Chicken Satay",description:"Main",price:null,priceType:"included_in_buffet",allergens:null},{name:"Mussels",description:"Main",price:null,priceType:"included_in_buffet",allergens:null},{name:"Mixed seafood with Egg Fried Rice",description:"Main",price:null,priceType:"included_in_buffet",allergens:null},{name:"Lamb in honey ginger",description:"Main",price:null,priceType:"included_in_buffet",allergens:null},{name:"Steamed fish in ginger",description:"Main",price:null,priceType:"included_in_buffet",allergens:null}]},{name:"Sushi",description:"Freshly made sushi; all sushi served with soya sauce, ginger pickle and wasabi.",items:[{name:"Salmon sushi / rolls",description:null,price:null,priceType:"included_in_buffet",allergens:null},{name:"Tuna sushi / rolls",description:null,price:null,priceType:"included_in_buffet",allergens:null},{name:"Mixed Pepper Maki",description:null,price:null,priceType:"included_in_buffet",allergens:null},{name:"Avocado Sushi",description:null,price:null,priceType:"included_in_buffet",allergens:null},{name:"Mixed Veg Maki",description:null,price:null,priceType:"included_in_buffet",allergens:null},{name:"Mango sushi",description:null,price:null,priceType:"included_in_buffet",allergens:null},{name:"Tofu sushi",description:null,price:null,priceType:"included_in_buffet",allergens:null},{name:"Crab Sushi",description:null,price:null,priceType:"included_in_buffet",allergens:null}]},{name:"Chargrill",description:"Live chargrill; quality meat cooked to guest satisfaction.",items:[{name:"Beef Steak",description:null,price:null,priceType:"included_in_buffet",allergens:null},{name:"Lamb Chops",description:null,price:null,priceType:"included_in_buffet",allergens:null},{name:"Peri-Peri Chicken",description:null,price:null,priceType:"included_in_buffet",allergens:null},{name:"Grilled Chicken Wings",description:null,price:null,priceType:"included_in_buffet",allergens:null},{name:"Grilled Cheese burgers",description:null,price:null,priceType:"included_in_buffet",allergens:null},{name:"Seekh Kebabs",description:null,price:null,priceType:"included_in_buffet",allergens:null}]},{name:"Noodle Bar",description:"Live noodle cooking station \u2014 Thailand, Japan, China, Vietnam influences; meats/ingredients added on request.",items:[{name:"Japanese udon noodles",description:"Live station option",price:null,priceType:"included_in_buffet",allergens:null},{name:"Egg noodles",description:"Live station option",price:null,priceType:"included_in_buffet",allergens:null},{name:"Leeks, beansprouts, Chinese cabbage, mix pepper, mushrooms",description:"Fresh ingredients listed on site",price:null,priceType:"included_in_buffet",allergens:null}]},{name:"Carvery",description:"Roasts with gravy, peppercorn and creamy mushroom sauces; sides include rosemary potatoes, mashed potato, butter vegetables, Yorkshire puddings.",items:[{name:"Roast Beef",description:null,price:null,priceType:"included_in_buffet",allergens:null},{name:"Roast Pork",description:null,price:null,priceType:"included_in_buffet",allergens:null},{name:"Roast Chicken",description:null,price:null,priceType:"included_in_buffet",allergens:null},{name:"Grilled Salmon",description:null,price:null,priceType:"included_in_buffet",allergens:null},{name:"Rosemary potatoes",description:"Side",price:null,priceType:"included_in_buffet",allergens:null},{name:"Mashed potato",description:"Side",price:null,priceType:"included_in_buffet",allergens:null},{name:"Butter vegetables",description:"Side",price:null,priceType:"included_in_buffet",allergens:null},{name:"Yorkshire puddings",description:"Side",price:null,priceType:"included_in_buffet",allergens:null}]},{name:"Italian",description:"Traditional and contemporary Italian \u2014 pizza, pasta, risotto.",items:[{name:"Freshly-made Pizza",description:null,price:null,priceType:"included_in_buffet",allergens:null},{name:"Macaroni Cheese",description:null,price:null,priceType:"included_in_buffet",allergens:null},{name:"Spaghetti Carbonara",description:null,price:null,priceType:"included_in_buffet",allergens:null},{name:"Spicy Penne Arrabbiata",description:null,price:null,priceType:"included_in_buffet",allergens:null},{name:"Chicken Risotto",description:null,price:null,priceType:"included_in_buffet",allergens:null},{name:"Mushroom Risotto",description:null,price:null,priceType:"included_in_buffet",allergens:null},{name:"Veg Risotto",description:null,price:null,priceType:"included_in_buffet",allergens:null}]},{name:"Mexican",description:"Added by guest demand; served with homemade sour cream, salsa and nachos.",items:[{name:"Taco",description:null,price:null,priceType:"included_in_buffet",allergens:null},{name:"Fajitas",description:null,price:null,priceType:"included_in_buffet",allergens:null},{name:"Chilli con carne",description:null,price:null,priceType:"included_in_buffet",allergens:null}]},{name:"Kids Selection",description:"Family-friendly choices listed on menus page.",items:[{name:"Pizza",description:null,price:null,priceType:"included_in_buffet",allergens:null},{name:"Pasta",description:null,price:null,priceType:"included_in_buffet",allergens:null},{name:"Nuggets",description:null,price:null,priceType:"included_in_buffet",allergens:null},{name:"Chips",description:null,price:null,priceType:"included_in_buffet",allergens:null},{name:"Mozzarella sticks",description:null,price:null,priceType:"included_in_buffet",allergens:null},{name:"Noodles",description:null,price:null,priceType:"included_in_buffet",allergens:null},{name:"Sushi",description:null,price:null,priceType:"included_in_buffet",allergens:null},{name:"Marshmallow",description:null,price:null,priceType:"included_in_buffet",allergens:null},{name:"Chocolate Fountain",description:null,price:null,priceType:"included_in_buffet",allergens:null},{name:"Ice Cream",description:null,price:null,priceType:"included_in_buffet",allergens:null},{name:"Cakes",description:null,price:null,priceType:"included_in_buffet",allergens:null},{name:"Jelly",description:null,price:null,priceType:"included_in_buffet",allergens:null}]},{name:"Cakes & Puddings",description:"Sweets station including chocolate fountain.",items:[{name:"Chocolate Fountain with marshmallows",description:null,price:null,priceType:"included_in_buffet",allergens:null},{name:"Strawberry cheesecake",description:null,price:null,priceType:"included_in_buffet",allergens:null},{name:"Blueberry cheesecake",description:null,price:null,priceType:"included_in_buffet",allergens:null},{name:"Caramel cheesecake",description:null,price:null,priceType:"included_in_buffet",allergens:null},{name:"Pannacotta",description:null,price:null,priceType:"included_in_buffet",allergens:null},{name:"Mousse",description:null,price:null,priceType:"included_in_buffet",allergens:null},{name:"Walnut and chocolate brownies",description:null,price:null,priceType:"included_in_buffet",allergens:null},{name:"Almond Pears Cake",description:null,price:null,priceType:"included_in_buffet",allergens:null},{name:"Chocolate mud cakes",description:null,price:null,priceType:"included_in_buffet",allergens:null},{name:"Jelly (selections)",description:null,price:null,priceType:"included_in_buffet",allergens:null},{name:"Apple Crumble",description:null,price:null,priceType:"included_in_buffet",allergens:null},{name:"Hot custard",description:null,price:null,priceType:"included_in_buffet",allergens:null},{name:"Gulab Jamun",description:"Indian sweet",price:null,priceType:"included_in_buffet",allergens:null},{name:"Ice cream \u2014 Vanilla",description:null,price:null,priceType:"included_in_buffet",allergens:null},{name:"Ice cream \u2014 Tutti frutti",description:null,price:null,priceType:"included_in_buffet",allergens:null},{name:"Ice cream \u2014 Malai",description:null,price:null,priceType:"included_in_buffet",allergens:null},{name:"Ice cream \u2014 Bubblegum",description:null,price:null,priceType:"included_in_buffet",allergens:null},{name:"Ice cream \u2014 Keshar Pista",description:null,price:null,priceType:"included_in_buffet",allergens:null},{name:"Freshly cut fruits",description:null,price:null,priceType:"included_in_buffet",allergens:null}]},{name:"Cocktails, bar & soft drinks",description:"Described on menus page; no unit prices published there. Unlimited soft drinks mentioned for buffet context \u2014 confirm with Gordon.",items:[{name:"Pina Colada",description:"Cocktail",price:null,priceType:"included_in_buffet",allergens:null},{name:"French Martini",description:"Cocktail",price:null,priceType:"included_in_buffet",allergens:null},{name:"Porn-star Martini",description:"Cocktail",price:null,priceType:"included_in_buffet",allergens:null},{name:"Sex on the Beach",description:"Cocktail",price:null,priceType:"included_in_buffet",allergens:null},{name:"Strawberry Daiquiri",description:"Cocktail",price:null,priceType:"included_in_buffet",allergens:null},{name:"Mojito",description:"Cocktail",price:null,priceType:"included_in_buffet",allergens:null},{name:"Blue lagoon",description:"Cocktail",price:null,priceType:"included_in_buffet",allergens:null},{name:"Wines \u2014 Pinot Grigio, Chardonnay, Malbec, Merlot, Shiraz, Zinfandel (examples)",description:"Red, ros\xe9 and white",price:null,priceType:"included_in_buffet",allergens:null},{name:"Vodka, whisky, rum, cognac, single malts, shots",description:"Spirits \u2014 examples listed on site",price:null,priceType:"included_in_buffet",allergens:null},{name:"Draft and bottled beers",description:null,price:null,priceType:"included_in_buffet",allergens:null},{name:"Mocktail \u2014 Sweet kiss",description:null,price:null,priceType:"included_in_buffet",allergens:null},{name:"Mocktail \u2014 Cranberry cooler",description:null,price:null,priceType:"included_in_buffet",allergens:null},{name:"Mocktail \u2014 Virgin apple mojito",description:null,price:null,priceType:"included_in_buffet",allergens:null},{name:"Mocktail \u2014 Fairy tango",description:null,price:null,priceType:"included_in_buffet",allergens:null},{name:"Mango Lassi",description:null,price:null,priceType:"included_in_buffet",allergens:null},{name:"Juices and unlimited soft drinks",description:"As published on menus page",price:null,priceType:"included_in_buffet",allergens:null},{name:"Bottled soft drinks, milkshakes, freshly brewed coffees",description:null,price:null,priceType:"included_in_buffet",allergens:null}]}]}],venueId:"mrbasrais",orderingEnabled:!1,orderable:!1,currentMenuConfirmed:!1,needsConfirmation:!0,status:"published-reference-to-confirm"}},yasmins:{venueId:"yasmins",databaseSlug:"yasmins",urlSlug:"yasmins",uuidReserved:"f43f20ad-55d0-4008-88c8-7738dc1698df",name:"Yasmin's Indian Cuisine",address:"10 Dalrymple Street, Girvan, South Ayrshire KA26 9AE",phone:"01465 712712",email:"",website:"https://yasminsindiancuisine.com/",branding:{accent:"#DB643A",accentSuggested:"#DB643A",ink:"#1A0F0A",smallTextAccent:"#DE704A",onAccent:"#0B0B0B",testedDarkSurfaces:["#1A0F0A","#222222","#292929"],minimumSmallTextContrast:4.518580198317754,buttonLabelContrast:5.526113354465791,rawAccentOnInkContrast:5.280132459497854,logoRecoloured:!1,hasLogo:!0,logo:"assets/brand/yasmins.png",hero:"assets/brand/yasmins-hero.png",noDuplicateNameLine:!0},hours:{status:"to-confirm",days:{},sessionsByDay:null,needsConfirmation:!0,note:"Venue and kitchen hours to confirm. Unknown hours are not closed days."},kitchenSessionsByDay:null,booking:{mode:"in-app-manager-request",nativeDiary:!0,nativeRequests:!0,automaticConfirmation:!1,externalLinks:!1,requiresManager:!0,managerReady:!1,requiresConfirmedKitchenHours:!0,lastSittingMinutesBeforeClose:null,fields:["date","time","Covers","name","phone","email","notes"],sendMessages:!1},deposit:{on:!1,amount:null,perPersonPence:null,fromParty:null,policy:null,needsConfirmation:!0},features:{takeaway:!1,delivery:!1,payments:!1,loyalty:!1,orderAtTable:!1,hotel:!1,directOrdering:!1},clockArea:{on:!1,lat:null,lng:null,radius:150,offRotaPrompt:!1,needsConfirmation:!0},gatesToConfirm:["authorised manager and staff","table plan and Covers","deposit and booking terms","pay settings","ordering and delivery to set up","loyalty to set up","opening and kitchen hours","public email","missing published menu prices","allergen matrix","alcohol policy","precise venue location"],menuServiceContext:null,allergenCaveat:null,emailNeedsConfirmation:!0,questionnaire:{version:1,venueId:"yasmins",source:"from-config",venue:{name:"Yasmin's Indian Cuisine",tagline:"Indian restaurant and takeaway \xb7 Girvan",address:"10 Dalrymple Street, Girvan, South Ayrshire KA26 9AE",phone:"01465 712712",email:"",website:"https://yasminsindiancuisine.com/",hasLogo:!0},team:[],suppliers:[],accounts:[],hours:{status:"to-confirm",days:{},sessionsByDay:null,needsConfirmation:!0,note:"Venue and kitchen hours to confirm. Unknown hours are not closed days."},tables:{template:"restaurant",tables:null,covers:null,areas:[],needsConfirmation:!0,note:"Table plan and Covers to confirm."},features:{bookings:!0,takeaway:!1,orderAtTable:!1,tips:!1,rota:!1,games:!1,specials:!1,loyalty:!1},notes:"Separate yasmins tenant. In-app manager-confirmed table requests only. Deposit terms to confirm; charging is off. Team empty. No payroll or connected accounts. Ordering, delivery and loyalty to set up. Published menu is reference only; current prices, availability and allergens to confirm. Official logo supplied; hasLogo true. Accent #DB643A. No missing-logo gate."},menu:{currency:"GBP",menus:[{id:"meal-deals",name:"Meal Deals",when:"As listed on official menu \u2014 prices not visible in scrape",categories:[{name:"Meal Deals",items:[{name:"Set Meal A For 1",description:"Vegetable Pakora, 2 Popadoms & Spice Onions, Any 1 Curry, Fried Rice Or Naan Bread",price:null,dietary:[]},{name:"Set Meal B For 2",description:"Vegetable Pakora Or Chicken Chaat, Any 2 Popular Dishes (Korma, Bhoona, Dopiaza, Phall, Madras, Traditional Chicken Curry Or Traditional Lamb Curry), 1x Rice & Plain Nan Bread",price:null,dietary:[]},{name:"Set Meal C For 2",description:"Chicken Pakora Or Mixed Pakora, Chicken Tikka (main course), Any 1 Curry, Fried Rice & Any Nan Bread (any changes subject to charge)",price:null,dietary:[]},{name:"Yasmin's Special Buffet",description:"3\u20134 people. Mixed Platter (large mixed pakora), Chicken Chaat (sweet & sour), 4 Poppadoms & Spiced Onions, 2 Speciality Curries, Chicken Or Lamb Tikka (main), 2 Fried Rice & Nan Bread & Salad",price:null,dietary:[]},{name:"Tandoori Box",description:"9\" box: Chicken Tikka, Lamb Tikka, Chicken Chaat, Mix Pakora, Chips, Onion Rings with Nan, Salad, 2 Dips, Spiced Onions & 2 cans of juice (changes subject to charge)",price:null,dietary:[]},{name:"Special Tandoori Box",description:"Chicken Pakora, Vegetable Pakora, Chicken Chaat, Onion Rings, Chips, Chicken Tikka, Lamb Tikka, Dip, 2 Cans Of Pepsi, Naan, Poppadum, Spiced Onions, Side Salad & Tub Of Curry Sauce",price:null,dietary:[]}]}]},{id:"starters",name:"Starters",categories:[{name:"Starters",items:[{name:"Crispy Poppadoms",description:null,price:1.25,dietary:[]},{name:"Prawn Cocktail Marie Rose",description:null,price:null,dietary:[]},{name:"Breaded Garlic Mushrooms",description:null,price:null,dietary:[]},{name:"Seasonal Vegetable Pakora",description:null,price:null,dietary:[]},{name:"Chicken Breast Pakora",description:null,price:null,dietary:[]},{name:"Mixed Pakora",description:"Chicken, Vegetable & Chicken Chaat",price:null,dietary:[]},{name:"Fish Pakora",description:null,price:null,dietary:[]},{name:"Button Mushroom Pakora",description:null,price:null,dietary:[]},{name:"Onion Bhaji",description:null,price:null,dietary:[]},{name:"Tandoori Lamb Tikka Starter",description:null,price:null,dietary:[]},{name:"Tandoori Chicken Tikka Starter",description:null,price:null,dietary:[]},{name:"4pcs King Prawn Starter",description:null,price:null,dietary:[]},{name:"Tandoori Mixed Tikka Starter",description:"Chicken & Lamb",price:null,dietary:[]},{name:"Spicy Chicken Chaat",description:"3 \u2014 on the bone",price:null,dietary:[]},{name:"Pooris",description:"Deep fried chapati with options",price:null,dietary:[]},{name:"Large Chicken Pakora",description:null,price:null,dietary:[]},{name:"Large Veg Pakora",description:null,price:null,dietary:[]}]},{name:"Samosas",items:[{name:"Vegetable Samosas",description:null,price:null,dietary:[]},{name:"Mince Samosas",description:null,price:null,dietary:[]}]},{name:"Chips",items:[{name:"Chips",description:null,price:null,dietary:[]},{name:"Chips & Cheese",description:null,price:null,dietary:[]},{name:"Chips & Curry Sauce",description:null,price:null,dietary:[]},{name:"Chips & Chicken Tikka",description:null,price:null,dietary:[]},{name:"Chips, Cheese & Chicken Tikka",description:null,price:null,dietary:[]}]}]},{id:"kebabs",name:"Kebabs",when:"All come in 9\" pizza box",categories:[{name:"Kebabs",items:[{name:"Chicken Tikka Nan Kebab",description:"Salad, chips, dips & can of juice",price:null,dietary:[]},{name:"Nan Chicken BBQ Kebab",description:"Salad, chips, dips & can of juice",price:null,dietary:[]},{name:"Lamb Tikka Kebab",description:"Salad, chips, dips & can of juice",price:null,dietary:[]},{name:"Mix Tikka Kebab",description:"Chicken & Lamb Tikka, chips, dips, salad & can of juice",price:null,dietary:[]}]}]},{id:"popular-favourites",name:"Popular Favourites / Specialty Curries",when:"Rice not included. Also available in lamb & chicken. All chicken dishes are chicken breast.",categories:[{name:"Specialty curries",items:[{name:"South Indian Garlic Chilli",description:"Freshly chopped green chillies with garlic puree & chef's spices.",price:null,dietary:[],variants:[{name:"Chicken",price:10.95},{name:"Lamb",price:12.95},{name:"King Prawn",price:13.45}]},{name:"Masander",description:"Rich sauce with green peppers, onions, spring onions & green chillies.",price:null,dietary:[],variants:[{name:"Chicken",price:10.95},{name:"Lamb",price:12.95},{name:"King Prawn",price:13.45}]},{name:"Shani",description:"Special tikka sauce with green peppers, onions, mushrooms, chillies & coriander.",price:null,dietary:[],variants:[{name:"Chicken",price:10.95}]},{name:"Achari",description:"Pickles, green chillies & fresh coriander; slightly tangy.",price:null,dietary:[],variants:[{name:"Chicken",price:10.95}]},{name:"Garlic Masala",description:"Special garlic sauce, peppers, onions, herbs & spices.",price:null,dietary:[],variants:[{name:"Chicken",price:10.95}]},{name:"Tikka Lahori Saag",description:"Spring onion, ginger, garlic, coriander \u2014 medium to hot with spinach.",price:null,dietary:[],variants:[{name:"Chicken",price:10.95}]},{name:"Nihari",description:"Tikka with black pepper, green chillies, tomatoes & coriander.",price:null,dietary:[],variants:[{name:"Chicken",price:10.95}]},{name:"Jalandri",description:"Ginger, garlic, mushrooms, spinach & spices.",price:null,dietary:[],variants:[{name:"Chicken",price:10.95}]},{name:"Zakadar",description:"Recommended. Fresh sybee with black pepper & mint.",price:null,dietary:[]},{name:"Cobra",description:"Ginger, garlic, spring onions, coriander, green chillies & mustard masala.",price:null,dietary:[]},{name:"Chicken Tawa",description:"Ginger, garlic, coriander, spring onion & special spices.",price:null,dietary:[]},{name:"Lahori Masala",description:"Ginger, garlic, green chillies, spring onions, coriander, homemade curry sauce & tamarind.",price:null,dietary:[]},{name:"Rogan Josh",description:"Garlic, ginger, onion, green peppers, Punjabi spices; tomatoes & coriander.",price:null,dietary:[],variants:[{name:"Lamb",price:12.95}]},{name:"Multani Sawadi",description:"Homemade curry sauce, tomatoes, ginger, garlic, spring onions, coriander, chillies & chilli pickle.",price:null,dietary:[],variants:[{name:"Chicken",price:10.95}]},{name:"Peri Peri Masala",description:"Highly recommended. Ginger, garlic & fresh coriander.",price:null,dietary:[]},{name:"Chilli Bhoona",description:"Highly recommended. Slightly hot bhoona with green chillies, tomatoes, onions & coriander.",price:null,dietary:[]},{name:"Jalfrezi",description:"Tikka with garlic, ginger, onions, green peppers, cream, chillies & tomatoes.",price:null,dietary:[]},{name:"Jaipuri",description:"Tikka with onions, green peppers & mushrooms.",price:null,dietary:[]},{name:"Masaledar",description:"Pathia-style with onions, green peppers & mushrooms.",price:null,dietary:[]},{name:"Masala",description:"Tikka in a special sauce.",price:null,dietary:[],variants:[{name:"Chicken",price:10.95},{name:"Lamb",price:12.95},{name:"King Prawn",price:13.45}]},{name:"Signature Mix Masala",description:"Chicken tikka, lamb tikka & prawns.",price:null,dietary:[],variants:[{name:"King Prawn",price:13.45}]},{name:"Creamy Tikka Masala",description:"Yoghurt marinade; creamy mild masala.",price:null,dietary:[],variants:[{name:"Lamb",price:12.95},{name:"Prawn",price:12.45},{name:"King Prawn",price:13.45}]},{name:"Thai Masala",description:"Ginger, garlic, spring onion, coriander & sweet chilli.",price:null,dietary:[]},{name:"Masala Korma",description:"Green peppers, ginger, garlic, coriander & yoghurt.",price:null,dietary:[]},{name:"Karahi",description:"Karahi with capsicum & onions.",price:null,dietary:[]},{name:"Balti",description:"Chicken tikka with garlic, ginger, tomatoes & balti paste.",price:null,dietary:[],variants:[{name:"Chicken Tikka",price:10.95},{name:"King Prawn",price:13.45}]},{name:"Lasani",description:"Recommended. Punjabi spices in homemade lassani sauce.",price:null,dietary:[],variants:[{name:"King Prawn",price:13.45}]},{name:"Liziz",description:"Yoghurt, creamed coconut & cheese sauce.",price:null,dietary:[]},{name:"Pasanda",description:"Cashew nuts, fresh cream & almonds.",price:null,dietary:[]},{name:"Pathia",description:"Traditional sweet 'n' sour.",price:null,dietary:[],variants:[{name:"King Prawn",price:13.45}]},{name:"Butter Masala",description:"Chopped tomatoes & ground cashew nuts.",price:null,dietary:[],variants:[{name:"King Prawn",price:13.45}]},{name:"Sweet 'n' Sour Chicken",description:"Spring onions, ginger, garlic, sweet 'n' sour sauce & coriander.",price:null,dietary:[]},{name:"Chasni",description:"Mild creamy sweet 'n' sour.",price:null,dietary:[]},{name:"Dilbahar Korma",description:"Traditional korma with sweet paste \u2014 very mild.",price:null,dietary:[]},{name:"Pashori Masala",description:"Masala with ginger, garlic, cream & honey \u2014 very mild.",price:null,dietary:[]},{name:"Sanam Korma",description:"Highly recommended. Cream & ground nuts.",price:null,dietary:[]},{name:"Shahi Bahar Korma",description:"Coconut, cream, dried mixed fruit, mild herbs & spices.",price:null,dietary:[]},{name:"Garam Masala",description:"Garlic, ginger, green pepper, green chilli, bhoona style.",price:null,dietary:[]}]}]},{id:"european",name:"European Dishes",when:"All served with chips & salad \u2014 prices not visible in scrape",categories:[{name:"European",items:[{name:"Mushroom Omelette",description:null,price:null,dietary:[]},{name:"French Omelette",description:"Onions, tomato & mushroom",price:null,dietary:[]},{name:"Asian Omelette",description:"Onion, tomato & green chillies",price:null,dietary:[]},{name:"Spanish Omelette",description:"Tomato, chicken, onion & mushroom",price:null,dietary:[]},{name:"French Fried Chicken",description:null,price:null,dietary:[]},{name:"Chicken Maryland",description:"Breadcrumbs with pineapple & banana",price:null,dietary:[]},{name:"Fish 'n' Chips",description:null,price:null,dietary:[]},{name:"Deep Fried Breaded Scampi",description:null,price:null,dietary:[]},{name:"Peri Peri Chips",description:null,price:null,dietary:[]}]}]},{id:"tandoori",name:"Tandoori Sizzlers",when:"Served with rice, salad & curry sauce \u2014 prices not visible in scrape",categories:[{name:"Tandoori Sizzlers",items:[{name:"Tandoori Lamb Tikka Meal",description:"Lamb fillet marinated in spicy sauce, cooked in tandoor.",price:null,dietary:[]},{name:"Tandoori Chicken Tikka Meal",description:"Chicken marinated in spices & cooked in tandoor.",price:null,dietary:[]},{name:"Tandoori Mix Grill",description:"Chicken tikka, lamb tikka, chicken on the bone & seekh kebab with rice, curry sauce, nan & salad.",price:null,dietary:[]},{name:"King Prawn Tandoori Meal",description:"King prawn in clay oven with rice, curry sauce, salad & any naan.",price:null,dietary:[]},{name:"Chicken BBQ Tikka",description:null,price:null,dietary:[]},{name:"Chicken & Lamb Tikka Meal",description:null,price:null,dietary:[]},{name:"Tandoori Chicken",description:null,price:null,dietary:[]}]}]},{id:"biryani",name:"Biryani Dishes",when:"Meat & rice cooked together with separate curry sauce \u2014 prices not visible in scrape",categories:[{name:"Biryani",items:[{name:"Special Biryani",description:null,price:null,dietary:[]},{name:"Lamb Biryani",description:null,price:null,dietary:[]},{name:"Prawn Biryani",description:null,price:null,dietary:[]},{name:"Vegetable Biryani",description:null,price:null,dietary:[]},{name:"King Prawn Biryani",description:null,price:null,dietary:[]},{name:"Chicken Tikka Biryani",description:null,price:null,dietary:[]}]}]},{id:"sides-drinks",name:"Rice, Breads, Kids & Drinks",categories:[{name:"Basmati Rice",items:[{name:"Boiled Rice",description:null,price:null,dietary:[]},{name:"Pilau Fried Rice",description:null,price:null,dietary:[]},{name:"Mushroom Rice",description:null,price:null,dietary:[]},{name:"Special Fried Rice",description:null,price:null,dietary:[]},{name:"Egg Fried Rice",description:null,price:null,dietary:[]}]},{name:"Bread Basket",items:[{name:"Plain Nan Bread",description:null,price:null,dietary:[]},{name:"Garlic Nan Bread",description:null,price:null,dietary:[]},{name:"Garlic & Coriander Nan",description:null,price:null,dietary:[]},{name:"Cheese Nan Bread",description:null,price:null,dietary:[]},{name:"Spicy Chilli Cheese Nan Bread",description:null,price:null,dietary:[]},{name:"Peshwari Nan",description:null,price:null,dietary:[]},{name:"Tandoori Chapati",description:null,price:null,dietary:[]},{name:"Plain Paratha",description:null,price:null,dietary:[]}]},{name:"Kids Meals",when:"Served with a can of juice \u2014 dish list/prices not fully visible in scrape",items:[]},{name:"Drinks",items:[{name:"Coke",description:"Can",price:1.5,dietary:[]},{name:"Coke Zero",description:"Can",price:1.5,dietary:[]},{name:"Diet Coke",description:null,price:null,dietary:[]},{name:"Irn Bru",description:null,price:null,dietary:[]},{name:"Diet Irn Bru",description:null,price:null,dietary:[]},{name:"7 Up",description:null,price:null,dietary:[]},{name:"Water",description:null,price:1.5,dietary:[]},{name:"Pepsi",description:null,price:null,dietary:[]},{name:"Beers",description:null,price:null,dietary:[]},{name:"Tango",description:null,price:null,dietary:[]},{name:"Lemonade",description:null,price:null,dietary:[]}]}]}],venueId:"yasmins",orderingEnabled:!1,orderable:!1,currentMenuConfirmed:!1,needsConfirmation:!0,status:"published-reference-to-confirm"}},williewastles:{venueId:"williewastles",databaseSlug:"williewastles",urlSlug:"williewastles",uuidReserved:"6abc2793-93ab-4e23-a705-b4011a5cc011",name:"Willie Wastle's",address:"16-18 New Bridge Street, Ayr, South Ayrshire, KA7 1JX",phone:"01292 262 000",email:"williewastlesbar@gmail.com",website:"https://www.williewastles.com/",branding:{accent:"#00D8FF",accentSuggested:"#00D8FF",ink:"#0E0D0D",smallTextAccent:"#00D8FF",onAccent:"#0B0B0B",testedDarkSurfaces:["#0E0D0D","#222222","#292929"],minimumSmallTextContrast:8.497773636675975,buttonLabelContrast:11.496854044434171,rawAccentOnInkContrast:11.336172333681871,logoRecoloured:!1,hasLogo:!0,logo:"assets/brand/williewastles.png",hero:"assets/brand/williewastles-hero.png",noDuplicateNameLine:!0},hours:{status:"published-food-hours-only",days:{},sessionsByDay:{0:[["12:00","20:00"]],1:[["12:00","20:00"]],2:[["12:00","20:00"]],3:[["12:00","20:00"]],4:[["12:00","20:00"]],5:[["12:00","21:00"]],6:[["12:00","21:00"]]},needsConfirmation:!0,note:"Restaurant food hours from published menu: Sun\u2013Thu 12:00\u201320:00; Fri\u2013Sat 12:00\u201321:00. These are not full venue/bar hours. Breakfast is published from 09:00 with no confirmed end; full bar times and breakfast window to confirm."},kitchenSessionsByDay:{0:[["12:00","20:00"]],1:[["12:00","20:00"]],2:[["12:00","20:00"]],3:[["12:00","20:00"]],4:[["12:00","20:00"]],5:[["12:00","21:00"]],6:[["12:00","21:00"]]},booking:{mode:"in-app-manager-request",nativeDiary:!0,nativeRequests:!0,automaticConfirmation:!1,externalLinks:!1,requiresManager:!0,managerReady:!1,requiresConfirmedKitchenHours:!0,lastSittingMinutesBeforeClose:null,fields:["date","time","Covers","name","phone","email","notes"],sendMessages:!1},deposit:{on:!1,amount:null,perPersonPence:null,fromParty:null,policy:null,needsConfirmation:!0},features:{takeaway:!1,delivery:!1,payments:!1,loyalty:!1,orderAtTable:!1,hotel:!1,directOrdering:!1},clockArea:{on:!0,lat:55.4646261,lng:-4.6323929,radius:150,offRotaPrompt:!1,needsConfirmation:!1,source:"Exact-address FSA location recorded in current venue pack; 915242"},gatesToConfirm:["authorised manager and staff","table plan and Covers","deposit and booking terms","pay settings","ordering and delivery to set up","loyalty to set up","venue and bar closing times","breakfast start and end versus restaurant food hours","bar versus restaurant prices","allergen matrix","accessibility details"],menuServiceContext:null,allergenCaveat:null,emailNeedsConfirmation:!1,questionnaire:{version:1,venueId:"williewastles",source:"from-config",venue:{name:"Willie Wastle's",tagline:"Sports Bar & Restaurant \xb7 Ayr",address:"16-18 New Bridge Street, Ayr, South Ayrshire, KA7 1JX",phone:"01292 262 000",email:"williewastlesbar@gmail.com",website:"https://www.williewastles.com/",hasLogo:!0},team:[],suppliers:[],accounts:[],hours:{status:"published-food-hours-only",days:{},sessionsByDay:{0:[["12:00","20:00"]],1:[["12:00","20:00"]],2:[["12:00","20:00"]],3:[["12:00","20:00"]],4:[["12:00","20:00"]],5:[["12:00","21:00"]],6:[["12:00","21:00"]]},needsConfirmation:!0,note:"Restaurant food hours from published menu: Sun\u2013Thu 12:00\u201320:00; Fri\u2013Sat 12:00\u201321:00. These are not full venue/bar hours. Breakfast is published from 09:00 with no confirmed end; full bar times and breakfast window to confirm."},tables:{template:"restaurant",tables:null,covers:null,areas:[],needsConfirmation:!0,note:"Table plan and Covers to confirm."},features:{bookings:!0,takeaway:!1,orderAtTable:!1,tips:!1,rota:!1,games:!1,specials:!1,loyalty:!1},notes:"Separate williewastles tenant. In-app manager-confirmed table requests only. Deposit terms to confirm; charging is off. Team empty. No payroll or connected accounts. Ordering, delivery and loyalty to set up. Published menu is reference only; current prices, availability and allergens to confirm."},menu:{currency:"GBP",menus:[{id:"restaurant-main",name:"Restaurant Main Menu",when:"Waiter-serviced restaurant; PDF Summer 2026; printed hours Sun\u2013Thu 12:00\u201320:00, Fri\u2013Sat 12:00\u201321:00",categories:[{name:"Starters",items:[{name:"Cullen Skink",description:"Creamy seafood chowder with potato, leek and locally smoked fish; ciabatta & butter",price:6.25,dietary:[]},{name:"Prawn Cocktail",description:"Prawns Marie Rose on crisp prawn crackers with shredded lettuce & lemon",price:5.95,dietary:[]},{name:"Mussels",description:"Mussels in white wine sauce (also available as main)",price:6.95,priceMain:13.9,dietary:[]},{name:"Soup",description:"Served with ciabatta & butter; ask for today's flavour",price:4.95,dietary:[]},{name:"Chicken Tempura",description:"Chicken breast in crispy batter with fresh chillies, spring onions & sweet chilli dip; GF ingredients available",price:5.95,dietary:["gf-option"]},{name:"Loaded Potato Boats \u2014 Bonnie Boat",description:"Twice cooked; haggis, cheese, peppercorn sauce, spring onions (veggie haggis available)",price:5.95,dietary:[]},{name:"Loaded Potato Boats \u2014 Seoul Boat",description:"Korean BBQ chicken, cheese, jalape\xf1os",price:5.95,dietary:[]},{name:"Loaded Potato Boats \u2014 Classic Boat",description:"Cheese, spring onions, Wastle's smoky mayo",price:5.95,dietary:[]}]},{name:"Mains",items:[{name:"Steak",description:"Ribeye or sirloin with onion rings, mushrooms, tomato & chunky chips",price:25.95,dietary:["gf"],addons:[{name:"Peppercorn sauce",price:2.5},{name:"Gravy",price:2.5}]},{name:"Braised Featherblade",description:"Slow braised beef on haggis, neeps & tatties with rich jus & green veg; GF option available",price:17.95,dietary:["gf-option"]},{name:"Chicken Fajitas",description:"Chicken, peppers, onions, flour tortillas, cheese, guacamole, salsa & sour cream",price:16.95,dietary:[]},{name:"Chicken Tempura",description:"Larger portion; seasoned fries & sweet chilli dip; GF option available",price:14.95,dietary:["gf-option"]},{name:"Steak Pie",description:"Braised beef in gravy topped with puff pastry; green veg and mash or seasoned fries; GF option available",price:15.95,dietary:["gf-option"]},{name:"Fish & Chips",description:"Fresh haddock in homemade batter or panko crumb; chunky chips, peas & tartare sauce; GF option available",price:15.95,dietary:["gf-option"]},{name:"Gammon Steak",description:"10oz with chunky chips, grilled tomato, and fried egg or grilled pineapple",price:15.95,dietary:["gf"]},{name:"Cajun Chicken Pasta",description:"Penne in cajun spice cream sauce; garlic ciabatta",price:13.95,dietary:[]},{name:"Mac & Cheese",description:"Scottish macaroni in cheese sauce topped with roasted cheddar; garlic ciabatta",price:11.95,dietary:["vegetarian"]},{name:"Wastle's Classic Burger",description:"Beef patty, toasted bun, cheddar, tomato, gherkin, lettuce, smoky mayo, seasoned fries",price:13.95,dietary:[]},{name:"Wastle's Vegan Burger",description:"Plant-based patty, vegan smoky mayo, tomato, gherkin, lettuce, seasoned fries",price:13.95,dietary:["vegan"]},{name:"Mediterranean Tart",description:"Vegetable & basil tart with roast veg, green veg & seasoned fries",price:13.95,dietary:["vegetarian"]}]},{name:"Dirty Fries & Sharing",items:[{name:"Dirty Fries",description:"Skinny fries with mature cheddar, red chillies, spring onions & smoky mayo",price:8,dietary:["vegetarian"]},{name:"The Doddie Box",description:"Sharing basket: cheesy garlic bread, seasoned fries, jalape\xf1o poppers, onion rings, crispy chicken & crispy beef; garlic mayo, ketchup & smoky mayo",price:20,dietary:[]}]},{name:"Load Them Up (Dirty Fries toppings)",items:[{name:"Crispy Chicken",price:4,dietary:[]},{name:"Crispy Beef",price:4,dietary:[]},{name:"Crispy Cauliflower",price:4,dietary:["vegetarian"]},{name:"Chicken Nuggets",price:4,dietary:[]},{name:"Mac & Cheese Bites",price:3,dietary:["vegetarian"]},{name:"Jalape\xf1o Poppers",price:3,dietary:[]},{name:"Mozzarella Sticks",price:3,dietary:["vegetarian"]},{name:"Onion Rings",price:3,dietary:["vegetarian"]}]},{name:"Sauces",items:[{name:"Peppercorn",price:2.5,dietary:[]},{name:"Chip Shop Curry",price:2.5,dietary:[]},{name:"Frank's Buffalo Hot Sauce",price:2.5,dietary:[]},{name:"BBQ Sauce",price:2.5,dietary:[]},{name:"Cajun Mayo",price:2.5,dietary:[]},{name:"Garlic Mayo",price:2.5,dietary:[]},{name:"Sweet Chilli",price:2.5,dietary:[]}]},{name:"Ultimate Salad",items:[{name:"Ultimate Salad (base)",description:"Mixed leaves, cherry tomatoes, carrot, cucumber, baby spinach, peppers, red onions",price:5.5,dietary:["vegetarian"]},{name:"Add Seared Tuna",price:7.25,dietary:[]},{name:"Add Grilled Chicken",price:7.25,dietary:[]},{name:"Add Prawns Marie Rose",price:7.25,dietary:[]},{name:"Add Cold Bacon",price:1.7,dietary:[]},{name:"Add Feta",price:2.5,dietary:["vegetarian"]},{name:"Add Parmesan",price:2.5,dietary:["vegetarian"]},{name:"Add Goat's Cheese",price:2.5,dietary:["vegetarian"]}]}],allergyNote:"Care taken but cross-contamination possible. Gluten-free ingredients used where stated may still contain traces."},{id:"bar",name:"Bar Menu",when:"Exclusively for the bar \u2014 grab your table number and order at the bar",categories:[{name:"Loyalty Rewards (credits)",items:[{name:"Can Soft Drink",description:"30 credits",price:null,dietary:[]},{name:"Dirty Fries",description:"100 credits",price:null,dietary:[]},{name:"Hot Snack",description:"40 credits",price:null,dietary:[]},{name:"Hot Dog",description:"30 credits",price:null,dietary:[]},{name:"\xa35 Off",description:"500 credits",price:null,dietary:[]}]},{name:"Dirty Fries & Sharing",items:[{name:"Dirty Fries",description:"Seasoned skinny fries, mature cheddar, red chillies, spring onions, smoky mayo",price:8,dietary:["vegetarian"]},{name:"The Doddie Box",description:"Cheesy garlic bread, skinny fries, jalape\xf1o poppers, onion rings, crispy chicken, crispy beef; garlic mayo, ketchup, smoky mayo",price:20,dietary:[]}]},{name:"Bar Plates",items:[{name:"Fish & Chips",description:"Haddock in homemade batter or panko; chunky chips, peas, tartare",price:15.95,dietary:[]},{name:"Chicken Tempura",description:"Crispy batter chicken, chillies, spring onions, seasoned fries, sweet chilli",price:13.95,dietary:[]},{name:"Nachos",description:"Tortilla chips, melted cheese, jalape\xf1os, salsa, sour cream",price:5.15,dietary:["vegetarian"]},{name:"Bar Burger",description:"Beef patty, lettuce, pickles, crispy onions, smoky mayo",price:4.5,dietary:[],addons:[{name:"Cheese",price:1},{name:"Bacon (2)",price:1.7},{name:"Beef Patty",price:3},{name:"Streaky Bacon (3)",price:2.7}]},{name:"Hot Dog",description:"Grilled hotdog, American mustard, ketchup, crispy onions",price:3.25,dietary:[]}]},{name:"Mini Pies",items:[{name:"Mini Steak Pie",price:3,dietary:[]},{name:"Mini Macaroni Pie",price:3,dietary:["vegetarian"]},{name:"Mini Crispy Chicken Curry Pie",price:3,dietary:[]},{name:"Mini Cheese & Beans Pie",price:3,dietary:["vegetarian"]}]},{name:"Hot Snacks",items:[{name:"Seasoned Fries",price:3.25,dietary:["vegetarian"]},{name:"Chunky Chips",price:3.5,dietary:["vegetarian"]},{name:"Onion Rings (8)",price:3,dietary:["vegetarian"]},{name:"Mac & Cheese Bites (4)",price:3,dietary:["vegetarian"]},{name:"Jalape\xf1o Poppers (4)",price:3,dietary:[]},{name:"Mozzarella Sticks (4)",price:3,dietary:["vegetarian"]},{name:"Garlic Bread (3)",price:2.5,dietary:["vegetarian"]},{name:"Cheesy Garlic Bread (3)",price:3.5,dietary:["vegetarian"]}]},{name:"Sides & Sauces",items:[{name:"Chip Shop Curry Sauce",price:2.5,dietary:[]},{name:"Steak Pie Gravy",price:2.5,dietary:[]},{name:"B\xe9arnaise Sauce",price:2.5,dietary:[]},{name:"3 Cheese Mix",price:1,dietary:["vegetarian"]},{name:"Sliced Cheddar",price:1,dietary:["vegetarian"]}]},{name:"Nibbles",items:[{name:"Taylors Crisps",description:"Aberdeen Angus, Haggis & Black Pepper, Cheddar & Onion, Sea Salt, Sea Salt & Vinegar, Pickled Onion, Chilli Kick",price:1.25,dietary:[]},{name:"KP Nuts",description:"Salted or Dry Roasted",price:.9,dietary:[]}]}]}],venueId:"williewastles",orderingEnabled:!1,orderable:!1,currentMenuConfirmed:!1,needsConfirmation:!0,status:"published-reference-to-confirm"}},rupeeroom:{venueId:"rupeeroom",databaseSlug:"rupeeroom",urlSlug:"rupeeroom",uuidReserved:"78bff97d-5f07-440a-bb99-f6a6118da7a3",name:"The Rupee Room",address:"26A Wellington Square, Ayr, KA7 1HH",phone:"01292 283002",email:"info@therupeeroom.com",website:"https://www.therupeeroom.com/",branding:{accent:"#94000D",accentSuggested:"#94000D",ink:"#0C0C0C",smallTextAccent:"#C77A81",onAccent:"#FFFFFF",testedDarkSurfaces:["#0C0C0C","#222222","#292929"],minimumSmallTextContrast:4.523264940373709,buttonLabelContrast:9.271557486398493,rawAccentOnInkContrast:2.109853762592372,logoRecoloured:!1,hasLogo:!0,logo:"assets/brand/rupeeroom.png",hero:"assets/brand/rupeeroom-hero.png",noDuplicateNameLine:!0},hours:{status:"to-confirm",days:{},sessionsByDay:null,needsConfirmation:!0,note:"Venue and kitchen hours to confirm. Unknown hours are not closed days."},kitchenSessionsByDay:null,booking:{mode:"in-app-manager-request",nativeDiary:!0,nativeRequests:!0,automaticConfirmation:!1,externalLinks:!1,requiresManager:!0,managerReady:!1,requiresConfirmedKitchenHours:!0,lastSittingMinutesBeforeClose:null,fields:["date","time","Covers","name","phone","email","notes"],sendMessages:!1},deposit:{on:!1,amount:null,perPersonPence:null,fromParty:null,policy:null,needsConfirmation:!0},features:{takeaway:!1,delivery:!1,payments:!1,loyalty:!1,orderAtTable:!1,hotel:!1,directOrdering:!1},clockArea:{on:!1,lat:null,lng:null,radius:150,offRotaPrompt:!1,needsConfirmation:!0},gatesToConfirm:["authorised manager and staff","table plan and Covers","deposit and booking terms","pay settings","ordering and delivery to set up","loyalty to set up","conflicting venue and kitchen hours","dine-in versus takeaway prices","partial menu options","allergen matrix","delivery fees","precise venue location"],menuServiceContext:null,allergenCaveat:null,emailNeedsConfirmation:!1,questionnaire:{version:1,venueId:"rupeeroom",source:"from-config",venue:{name:"The Rupee Room",tagline:"Ayrshire's Premier Indian Restaurant \xb7 Ayr",address:"26A Wellington Square, Ayr, KA7 1HH",phone:"01292 283002",email:"info@therupeeroom.com",website:"https://www.therupeeroom.com/",hasLogo:!0},team:[],suppliers:[],accounts:[],hours:{status:"to-confirm",days:{},sessionsByDay:null,needsConfirmation:!0,note:"Venue and kitchen hours to confirm. Unknown hours are not closed days."},tables:{template:"restaurant",tables:null,covers:null,areas:[],needsConfirmation:!0,note:"Table plan and Covers to confirm."},features:{bookings:!0,takeaway:!1,orderAtTable:!1,tips:!1,rota:!1,games:!1,specials:!1,loyalty:!1},notes:"Separate rupeeroom tenant. In-app manager-confirmed table requests only. Deposit terms to confirm; charging is off. Team empty. No payroll or connected accounts. Ordering, delivery and loyalty to set up. Published menu is reference only; current prices, availability and allergens to confirm."},menu:{venueId:"rupeeroom",venueName:"The Rupee Room",tradingName:"The Rupee Room",timezone:"Europe/London",currency:"GBP",categories:[{id:"cat_3",categoryId:3,name:"Starters",description:"All freshly prepared",nestedCategoryIds:null,itemCount:15,items:[{name:"LARGE Chicken Pakora",description:"more the merrier!",productId:142,price:12.99,priceLabel:"\xa312.99",options:null},{name:"Veg Pakora",description:"Crisp vegan bites.",productId:2,price:6.95,priceLabel:"\xa36.95",options:null},{name:"Mushroom Pakora",description:"Naturally-vegan prep.",productId:3,price:7.5,priceLabel:"\xa37.50",options:null},{name:"Gobi Pakora",description:"Delicious & crisp cauliflower pakora. Vegan",productId:4,price:7.95,priceLabel:"\xa37.95",options:null},{name:"Chicken Pakora",description:"Diced chicken breast bites, dipped in spiced batter, fried crisp!",productId:5,price:8.99,priceLabel:"\xa38.99",options:null},{name:"Chicken Tikka Pakora",description:"Marinated then deep fried.",productId:143,price:9.99,priceLabel:"\xa39.99",options:null},{name:"Mix Pakora",description:"Chicken & vegetables",productId:6,price:8.95,priceLabel:"\xa38.95",options:null},{name:"Chilli Cheese Pakora",description:"Deicious Paneer Pakora!",productId:7,price:8.95,priceLabel:"\xa38.95",options:null},{name:"Fish Pakora",description:"Haddock marinated with ginger & green chilli, fried crisp.",productId:8,price:9.5,priceLabel:"\xa39.50",options:null},{name:"Lamb Samosa x2",description:"x2 crisp pastries stuffed with minced lamb, onions and spices. Served with masala chickpeas.",productId:9,price:8.95,priceLabel:"\xa38.95",options:null},{name:"Onion Bhaji",description:"x2 Crisp onion bombs",productId:10,price:6.95,priceLabel:"\xa36.95",options:null},{name:"Vegetable Samosa x2",description:"X2 Crisp puffed pastries stuffed with spiced potato mash and green peas. Served with curried chickpeas",productId:11,price:7.99,priceLabel:"\xa37.99",options:null},{name:"Haggis Pakora",description:"Marinated haggis fried crisp. Aye!",productId:12,price:8.55,priceLabel:"\xa38.55",options:null},{name:"Chilli Cauliflower",description:"Tempura Cauliflower, with an oriental twist",productId:13,price:7.95,priceLabel:"\xa37.95",options:null},{name:"Chilli Chicken",description:"Tempura, with an oriental twist!",productId:14,price:8.95,priceLabel:"\xa38.95",options:null}]},{id:"cat_4",categoryId:4,name:"Starters cooked in our Clay oven",description:null,nestedCategoryIds:null,itemCount:10,items:[{name:"Chicken Chaat",description:"Barbecued Chicken Drumsticks.",productId:15,price:7.5,priceLabel:"\xa37.50",options:null},{name:"Chicken Tandoori",description:"Succulent chicken on the bone",productId:16,price:8.5,priceLabel:"\xa38.50",options:null},{name:"Chicken Tikka",description:"Diced chicken breast marinated then grilled.",productId:17,price:8.55,priceLabel:"\xa38.55",options:null},{name:"Mix Tikka (starter)",description:"Succulent boneless Chicken & Lamb grilled to perfection.",productId:18,price:10.95,priceLabel:"\xa310.95",options:null},{name:"Lamb Tikka",description:"Supreme diced lamb fillet.",productId:19,price:12.5,priceLabel:"\xa312.50",options:null},{name:"Lamb Zing Tikka",description:"Supreme diced lamb fillet marinated in lime & mango spices.",productId:20,price:13.9,priceLabel:"\xa313.90",options:null},{name:"Seekh Kebab",description:"tender lamb minced in a host of spices then chargrilled.",productId:21,price:7.95,priceLabel:"\xa37.95",options:null},{name:"Chicken Lasooni Tikka",description:"Grilled chicken roasted with garlic.",productId:22,price:9.95,priceLabel:"\xa39.95",options:null},{name:"Tandoori Platter Starter",description:"Succulent lamb and chicken tikka kebabs. Serves 2/3 persons",productId:23,price:15.95,priceLabel:"\xa315.95",options:null},{name:"King Prawn Tandoori",description:null,productId:24,price:13.95,priceLabel:"\xa313.95",options:null}]},{id:"cat_18",categoryId:18,name:"Desserts",description:null,nestedCategoryIds:null,itemCount:2,items:[{name:"KHEER",description:"Traditional Indian dessert which is like rice pudding(but much nicer)",productId:166,price:8,priceLabel:"\xa38.00",options:null},{name:"Gulab Jaman",description:"The ultimate Indian dessert. Syrupped milk dough balls, Serves 2/3 people.",productId:167,price:7.95,priceLabel:"\xa37.95",options:null}]},{id:"cat_5",categoryId:5,name:"Dosa & Poori",description:"Poori is a light pan fried bread, Dosa is a south indian crepe made from lentil & rice flour. Dosa is naturally GF. Have with any of the following fillings.",nestedCategoryIds:null,itemCount:13,items:[{name:"Aloo Chana Poori",description:"Potato & Chickpea, served on a puffed bread",productId:25,price:6.95,priceLabel:"\xa36.95",options:null},{name:"Aloo Chana DOSA",description:"Potato & Chickpea. Naturally made vegan.",productId:26,price:7.96,priceLabel:"\xa37.96",options:null},{name:"Chicken Masala Poori",description:"Shredded tandoori chicken cooked with masala curry, served on a puffed bread",productId:27,price:6.95,priceLabel:"\xa36.95",options:null},{name:"Chicken Masala DOSA",description:"Crispy south indian crepe. Delicious!",productId:28,price:8.55,priceLabel:"\xa38.55",options:null},{name:"Chicken Masala DOSA Main",description:"Served with Pilau Rice & lentil sauce.",productId:30,price:15.55,priceLabel:"\xa315.55",options:null},{name:"Potato & Spinach DOSA",description:"Potato & Baby spinach tucked in a light crisp crepe.",productId:31,price:7.99,priceLabel:"\xa37.99",options:null},{name:"Lamb DOSA",description:"Tender minced lamb tucked in a crispy crepe.",productId:32,price:8.55,priceLabel:"\xa38.55",options:null},{name:"Garlic Mushrooms Poori Starter",description:null,productId:33,price:7.95,priceLabel:"\xa37.95",options:null},{name:"Garlic Mushrooms Poori",description:"served with pilau rice & lentil sauce.",productId:34,price:12.45,priceLabel:"\xa312.45",options:null},{name:"Garlic Prawns Poori",description:null,productId:39,price:8.95,priceLabel:"\xa38.95",options:null},{name:"Garlic Prawns Poori",description:"served with pilau rice & lentil sauce.",productId:40,price:14.45,priceLabel:"\xa314.45",options:null},{name:"Chilli Prawns Poori Starter",description:null,productId:41,price:8.95,priceLabel:"\xa38.95",options:null},{name:"Chilli Prawns Poori Main",description:"served with pilau rice & lentil sauce.",productId:42,price:14.45,priceLabel:"\xa314.45",options:null}]},{id:"cat_19",categoryId:19,name:"Posh Kebab",description:"All served King with large Nan bread, Fresh Salad & choice of sauce.",nestedCategoryIds:null,itemCount:7,items:[{name:"Chicken Tikka Kebab",description:"Supreme diced Chicken breast",productId:178,price:12.95,priceLabel:"from \xa312.95",options:[{name:"From (choose options on site)",price:12.95,priceLabel:"\xa312.95"}]},{name:"Shish Roll Kebab",description:"Quality lamb kebab bursting with flavour!",productId:181,price:11.95,priceLabel:"from \xa311.95",options:[{name:"From (choose options on site)",price:11.95,priceLabel:"\xa311.95"}]},{name:"Loaded Lamb Kebab",description:"Premium lamb tikka marinated and cooked to perfection.",productId:182,price:15.5,priceLabel:"from \xa315.50",options:[{name:"From (choose options on site)",price:15.5,priceLabel:"\xa315.50"}]},{name:"Vegan Kebab",description:"Zingy masala chips & red onion",productId:183,price:11.95,priceLabel:"from \xa311.95",options:[{name:"From (choose options on site)",price:11.95,priceLabel:"\xa311.95"}]},{name:"King Prawn Kebab",description:"Barbecued succulent King Prawns.",productId:184,price:17.25,priceLabel:"from \xa317.25",options:[{name:"From (choose options on site)",price:17.25,priceLabel:"\xa317.25"}]},{name:"Chicken & Lamb Kebab",description:"Grilled chicken breast & tender lamb fillet.",productId:185,price:14.9,priceLabel:"from \xa314.90",options:[{name:"From (choose options on site)",price:14.9,priceLabel:"\xa314.90"}]},{name:"Trio Kebab",description:"Grilled chicken, tender lamb & juicy prawns",productId:186,price:17.25,priceLabel:"from \xa317.25",options:[{name:"From (choose options on site)",price:17.25,priceLabel:"\xa317.25"}]}]},{id:"cat_6",categoryId:6,name:"Korma",description:"A hugely popular creamy dish which is a must for the milder palate.",nestedCategoryIds:null,itemCount:6,items:[{name:"Korma",description:"with lashings of creamed coconut",productId:43,price:null,priceLabel:null,options:[{name:"Chicken Breast",price:13.95,priceLabel:"\xa313.95"},{name:"Tender Lamb",price:14.55,priceLabel:"\xa314.55"},{name:"King Prawn",price:18.5,priceLabel:"\xa318.50"},{name:"Mixed Vegetable",price:12.5,priceLabel:"\xa312.50"},{name:"Indian Veg",price:12.95,priceLabel:"\xa312.95"}]},{name:"Kashmiri",description:"Delicately spiced, fruity with plenty of yoghurt & cream.",productId:44,price:null,priceLabel:null,options:[{name:"Chicken Breast",price:13.95,priceLabel:"\xa313.95"},{name:"Chicken Breast Tandoori",price:14.95,priceLabel:"\xa314.95"},{name:"Tender Lamb",price:15.95,priceLabel:"\xa315.95"},{name:"King Prawn",price:17.95,priceLabel:"\xa317.95"},{name:"Mixed Vegetable",price:12.5,priceLabel:"\xa312.50"}]},{name:"Mughlai",description:"A rich smooth, creamy sauce",productId:45,price:null,priceLabel:null,options:[{name:"Chicken Breast",price:12.9,priceLabel:"\xa312.90"},{name:"Tender Lamb",price:13.95,priceLabel:"\xa313.95"},{name:"King Prawn",price:18.5,priceLabel:"\xa318.50"},{name:"Mixed Vegetable",price:11.5,priceLabel:"\xa311.50"}]},{name:"Sona Sanam",description:"Coconut cream, ground almonds & cashew nuts.",productId:46,price:null,priceLabel:null,options:[{name:"Chicken Breast",price:13.5,priceLabel:"\xa313.50"},{name:"Chicken Breast Tandoori",price:13.95,priceLabel:"\xa313.95"},{name:"Tender Lamb",price:14.95,priceLabel:"\xa314.95"},{name:"Tender Lamb Tandoori",price:15.95,priceLabel:"\xa315.95"},{name:"Keema (mince meat)",price:14.75,priceLabel:"\xa314.75"},{name:"Prawn",price:15.25,priceLabel:"\xa315.25"},{name:"King Prawn",price:18,priceLabel:"\xa318.00"},{name:"Machi (fish)",price:15.95,priceLabel:"\xa315.95"},{name:"Mixed Vegetable",price:11.9,priceLabel:"\xa311.90"},{name:"Indian Veg",price:12.55,priceLabel:"\xa312.55"}]},{name:"Punjabi Korma",description:"Cooked with tomato, coriander & lashings of coconut",productId:47,price:null,priceLabel:null,options:[{name:"Chicken Breast",price:12.5,priceLabel:"\xa312.50"},{name:"Tender Lamb",price:12.95,priceLabel:"\xa312.95"},{name:"King Prawn",price:17.5,priceLabel:"\xa317.50"},{name:"Mixed Vegetable",price:10.5,priceLabel:"\xa310.50"}]},{name:"Mirchi Korma",description:"Cooked with cream & green chillies",productId:48,price:null,priceLabel:null,options:[{name:"Chicken Breast Tandoori",price:13.9,priceLabel:"\xa313.90"},{name:"Tender Lamb",price:14.95,priceLabel:"\xa314.95"},{name:"King Prawn",price:18.5,priceLabel:"\xa318.50"},{name:"Machi (fish)",price:15.95,priceLabel:"\xa315.95"},{name:"Mixed Vegetable",price:11.5,priceLabel:"\xa311.50"},{name:"Indian Veg",price:11.95,priceLabel:"\xa311.95"}]}]},{id:"cat_17",categoryId:17,name:"Popular",description:null,nestedCategoryIds:null,itemCount:7,items:[{name:"Chicken Ruby",description:"Silky smooth sauce cooked with boneless tandoori chicken. Creamy sauce with a kick to it!",productId:165,price:14.55,priceLabel:"\xa314.55",options:null},{name:"Chicken Saag Karahi",description:"Freshly blizted spinach cooked with ginger, garlic, tempered with peppers and onions.",productId:156,price:14.9,priceLabel:"\xa314.90",options:null},{name:"Paneer Matar Makhani",description:"Deliciously creamy and rich with cheese and bubbly green peas.",productId:157,price:12.95,priceLabel:"\xa312.95",options:null},{name:"Chicken Massamam",description:"Legendary flavour! simmered in coconut milk, tempered with cinnamon, star anise and potato & cashew nuts.",productId:158,price:14.95,priceLabel:"\xa314.95",options:null},{name:"Veg Tikka",description:"Marinated mix veg and paneer roasted in the tandoor, served with curry sauce & rice.",productId:159,price:13.9,priceLabel:"\xa313.90",options:null},{name:"Chicken Rogan Josh",description:"Rich tomato & onion curry.",productId:160,price:13.95,priceLabel:"\xa313.95",options:null},{name:"Chicken Dopiaza",description:"Cooked with garlic, oodles of onions, tempered with aromatic black onion seed",productId:161,price:13.95,priceLabel:"\xa313.95",options:null}]},{id:"cat_8",categoryId:8,name:"Staff Favourites :",description:"Staff Favourites!",nestedCategoryIds:null,itemCount:4,items:[{name:"Chilli Chicken",description:"Tempura style Chicken cooked with garlic-ginger-soy-chilli. A firm Rupee favourite.",productId:54,price:13.95,priceLabel:"\xa313.95",options:null},{name:"House Chicken Curry",description:"Traditional home style, packed full of flavour!",productId:55,price:13.5,priceLabel:"\xa313.50",options:null},{name:"Salli Boti Lamb",description:"This is a 1st-rate Parsi classic, tender chunks of Lamb, braised in a rich flavoursome sauce finished with crunchy crisp-potato sticks",productId:56,price:14.95,priceLabel:"\xa314.95",options:null},{name:"All Butter Chicken",description:"Deliciously cooked with unsalted butter, smooth sauce with plum tomato, herbs & mild spices.",productId:57,price:13.95,priceLabel:"\xa313.95",options:null}]},{id:"cat_7",categoryId:7,name:"Traditional Dishes",description:null,nestedCategoryIds:null,itemCount:4,items:[{name:"Bhoona",description:"Condensed sauce with plenty of ginger, garlic & tomato",productId:50,price:null,priceLabel:null,options:[{name:"Chicken Breast",price:12.95,priceLabel:"\xa312.95"},{name:"Chicken Breast Tandoori",price:13.95,priceLabel:"\xa313.95"},{name:"Tender Lamb",price:14.95,priceLabel:"\xa314.95"},{name:"Keema (mince meat)",price:14.95,priceLabel:"\xa314.95"},{name:"King Prawn",price:18,priceLabel:"\xa318.00"},{name:"Machi (fish)",price:15.95,priceLabel:"\xa315.95"},{name:"Mixed Vegetable",price:12.55,priceLabel:"\xa312.55"},{name:"Indian Veg",price:12.95,priceLabel:"\xa312.95"}]},{name:"Dhansac",description:"Lashings of lentils and eastern spices",productId:51,price:null,priceLabel:null,options:[{name:"Chicken Breast",price:13.99,priceLabel:"\xa313.99"},{name:"Chicken Breast Tandoori",price:14.55,priceLabel:"\xa314.55"},{name:"Tender Lamb",price:14.99,priceLabel:"\xa314.99"},{name:"Keema (mince meat)",price:13.75,priceLabel:"\xa313.75"},{name:"King Prawn",price:18.5,priceLabel:"\xa318.50"},{name:"Mixed Vegetable",price:11.5,priceLabel:"\xa311.50"},{name:"Indian Veg",price:12.95,priceLabel:"\xa312.95"}]},{name:"Dopiaza",description:"Cooked with garlic, oodles of onions, tempered with aromatic black onion seed",productId:52,price:null,priceLabel:null,options:[{name:"Chicken Breast Tandoori",price:13.9,priceLabel:"\xa313.90"},{name:"Tender Lamb",price:14.95,priceLabel:"\xa314.95"},{name:"King Prawn",price:18.5,priceLabel:"\xa318.50"},{name:"Mixed Vegetable",price:11.5,priceLabel:"\xa311.50"},{name:"Indian Veg",price:11.95,priceLabel:"\xa311.95"}]},{name:"Patia",description:"Tangy sweet and sour",productId:53,price:null,priceLabel:null,options:[{name:"Chicken Breast",price:12.95,priceLabel:"\xa312.95"},{name:"Tender Lamb",price:13.95,priceLabel:"\xa313.95"},{name:"King Prawn",price:18.5,priceLabel:"\xa318.50"},{name:"Mixed Vegetable",price:11.95,priceLabel:"\xa311.95"}]}]},{id:"cat_9",categoryId:9,name:"Biryani",description:"Savoury rice cooked with your choice from below, served with a medium curry sauce",nestedCategoryIds:null,itemCount:3,items:[{name:"Chicken Biryani",description:null,productId:58,price:15.95,priceLabel:"\xa315.95",options:null},{name:"Tender Lamb Biryani",description:null,productId:59,price:17.95,priceLabel:"\xa317.95",options:null},{name:"Special Biryani",description:"with chicken, lamb & prawns",productId:60,price:18,priceLabel:"\xa318.00",options:null}]},{id:"cat_10",categoryId:10,name:"Vegetable Selection",description:null,nestedCategoryIds:null,itemCount:18,items:[{name:"Aloo Gobi Side Dish",description:"Potato and cauliflower",productId:61,price:7.95,priceLabel:"\xa37.95",options:null},{name:"Aloo Gobi Main",description:"Potato, cauliflower & green peas.",productId:62,price:12.55,priceLabel:"\xa312.55",options:null},{name:"Veg Rogan Josh",description:"Cauliflower, potato, bell peppers cooked with a heavenly blend or spices.",productId:63,price:12.95,priceLabel:"\xa312.95",options:null},{name:"Indian Veg",description:"Spiced Aubergine, baby pumpkin and Okra.",productId:64,price:12.55,priceLabel:"\xa312.55",options:null},{name:"Vegetable Kofta Side",description:"Vegetable meatballs",productId:65,price:7.95,priceLabel:"\xa37.95",options:null},{name:"Chilli Gobi",description:"Crispy tempura cauliflower smothered in a sweet 'n' spicy marinade",productId:177,price:7.95,priceLabel:"\xa37.95",options:null},{name:"Saag Paneer Side",description:"Spinach with diced cottage cheese",productId:67,price:7.95,priceLabel:"\xa37.95",options:null},{name:"Saag Paneer Main",description:"Spinach with diced cottage cheese",productId:68,price:12.55,priceLabel:"\xa312.55",options:null},{name:"Matar Paneer Side",description:"Peas with diced cottage cheese",productId:69,price:8.95,priceLabel:"\xa38.95",options:null},{name:"Matar Paneer Main",description:"Peas with diced cottage cheese",productId:70,price:13.55,priceLabel:"\xa313.55",options:null},{name:"Temple Daal Side",description:"The ultimate Indian home comfort food. Red lentil simmered with toasted cumin & coriander.",productId:71,price:8.55,priceLabel:"\xa38.55",options:null},{name:"Temple Daal Main",description:"The ultimate Indian home comfort food. Red lentil simmered with toasted cumin & coriander.",productId:72,price:12.55,priceLabel:"\xa312.55",options:null},{name:"Bhindi (Okra) Side",description:null,productId:73,price:8.5,priceLabel:"\xa38.50",options:null},{name:"Bhindi Main",description:"Spiced Okra.",productId:74,price:12.55,priceLabel:"\xa312.55",options:null},{name:"Bombay Potatoes Side",description:null,productId:75,price:7.5,priceLabel:"\xa37.50",options:null},{name:"Bombay Potatoes Main",description:null,productId:76,price:11.9,priceLabel:"\xa311.90",options:null},{name:"Chana Masala Side",description:null,productId:77,price:8.95,priceLabel:"\xa38.95",options:null},{name:"Chana Masala Main",description:null,productId:78,price:11.5,priceLabel:"\xa311.50",options:null}]},{id:"cat_11",categoryId:11,name:"Tandoori House",description:"The Rupee Room's speciality. Meat is marinated in various herbs & spices then cooked slowly in the tandoor to obtain the optimum in mouth watering taste. served with rice and curry sauce",nestedCategoryIds:null,itemCount:9,items:[{name:"Tandoori Chicken (on the bone)",description:"x2 succulent chicken breast on the bone.",productId:79,price:18,priceLabel:"from \xa318.00",options:[{name:"From (choose options on site)",price:18,priceLabel:"\xa318.00"}]},{name:"Chicken Tikka",description:null,productId:80,price:14.95,priceLabel:"from \xa314.95",options:[{name:"From (choose options on site)",price:14.95,priceLabel:"\xa314.95"}]},{name:"Lamb Tikka Main",description:"grilled, cooked to perfection. Served with pilau rice and gingery-garlic sauce.",productId:81,price:18.55,priceLabel:"from \xa318.55",options:[{name:"From (choose options on site)",price:18.55,priceLabel:"\xa318.55"}]},{name:"Mixed Tikka",description:"Boneless chicken & lamb - grilled to perfection.",productId:82,price:17.9,priceLabel:"from \xa317.90",options:[{name:"From (choose options on site)",price:17.9,priceLabel:"\xa317.90"}]},{name:"Chicken Lasooni Tikka",description:"Garlic grilled chicken.",productId:83,price:15.95,priceLabel:"from \xa315.95",options:[{name:"From (choose options on site)",price:15.95,priceLabel:"\xa315.95"}]},{name:"Chicken Zing Tikka",description:"Tantazling hot with lime & mango spices.",productId:84,price:15.95,priceLabel:"from \xa315.95",options:[{name:"From (choose options on site)",price:15.95,priceLabel:"\xa315.95"}]},{name:"Seekh Kebab",description:"Succulent lamb sausage kebabs",productId:85,price:13.5,priceLabel:"from \xa313.50",options:[{name:"From (choose options on site)",price:13.5,priceLabel:"\xa313.50"}]},{name:"King Prawns Jhinga",description:"Juicy grilled King Prawns, delicious!",productId:86,price:24.95,priceLabel:"from \xa324.95",options:[{name:"From (choose options on site)",price:24.95,priceLabel:"\xa324.95"}]},{name:"Tandoori Mix Grill",description:"Mouth watering feast - Served with Nan bread. Serves two.",productId:87,price:24.95,priceLabel:"from \xa324.95",options:[{name:"From (choose options on site)",price:24.95,priceLabel:"\xa324.95"}]}]},{id:"cat_12",categoryId:12,name:"Exciting Mains",description:null,nestedCategoryIds:null,itemCount:14,items:[{name:"Tikka Masala",description:"Rupee Room recipe since 1999. Deliciously creamy with slithers of sliced bell peppers.",productId:88,price:null,priceLabel:null,options:[{name:"Chicken Breast Tandoori",price:14.55,priceLabel:"\xa314.55"},{name:"Tender Lamb Tandoori",price:15.55,priceLabel:"\xa315.55"},{name:"King Prawn",price:18.5,priceLabel:"\xa318.50"},{name:"Mixed Vegetable",price:12.5,priceLabel:"\xa312.50"}]},{name:"Jaipuri",description:"Chopped peppers, mushrooms & onions",productId:89,price:null,priceLabel:null,options:[{name:"Chicken Breast",price:13.95,priceLabel:"\xa313.95"},{name:"Tender Lamb",price:14.55,priceLabel:"\xa314.55"},{name:"King Prawn",price:18.5,priceLabel:"\xa318.50"},{name:"Mixed Vegetable",price:12.5,priceLabel:"\xa312.50"},{name:"Indian Veg",price:12.95,priceLabel:"\xa312.95"}]},{name:"Achari",description:"Cooked with The Rupee Room tantalasing zingy masala marinade.",productId:90,price:null,priceLabel:null,options:[{name:"Chicken Breast",price:13.9,priceLabel:"\xa313.90"},{name:"Tender Lamb",price:14.95,priceLabel:"\xa314.95"},{name:"King Prawn",price:18.95,priceLabel:"\xa318.95"},{name:"Machi (fish)",price:15.95,priceLabel:"\xa315.95"},{name:"Mixed Vegetable",price:12.95,priceLabel:"\xa312.95"},{name:"Indian Veg",price:12.99,priceLabel:"\xa312.99"}]},{name:"Pardesi",description:"Cooked in a special Bhoona sauce with fried onions,mushroom,peppers & spinach.",productId:91,price:null,priceLabel:null,options:[{name:"Chicken Breast",price:12.95,priceLabel:"\xa312.95"},{name:"Tender Lamb",price:13.95,priceLabel:"\xa313.95"},{name:"King Prawn",price:18,priceLabel:"\xa318.00"},{name:"Machi (fish)",price:14.25,priceLabel:"\xa314.25"},{name:"Mixed Vegetable",price:11.55,priceLabel:"\xa311.55"},{name:"Indian Veg",price:11.95,priceLabel:"\xa311.95"}]},{name:"Masaledar",description:"Zingy marinade, cooked with peppers,onions, medium-spiced",productId:92,price:null,priceLabel:null,options:[{name:"Chicken Breast",price:13.95,priceLabel:"\xa313.95"},{name:"Chicken Breast Tandoori",price:14.5,priceLabel:"\xa314.50"},{name:"Tender Lamb",price:14.95,priceLabel:"\xa314.95"},{name:"Tender Lamb Tandoori",price:15.95,priceLabel:"\xa315.95"},{name:"Keema (mince meat)",price:14.75,priceLabel:"\xa314.75"},{name:"King Prawn",price:18.5,priceLabel:"\xa318.50"},{name:"Machi (fish)",price:16.25,priceLabel:"\xa316.25"},{name:"Mixed Vegetable",price:12.9,priceLabel:"\xa312.90"},{name:"Indian Veg",price:12.95,priceLabel:"\xa312.95"}]},{name:"South Indian",description:"Lip-smacking tasty-hot curry!",productId:93,price:null,priceLabel:null,options:[{name:"Chicken Breast Tandoori",price:13.95,priceLabel:"\xa313.95"},{name:"Tender Lamb",price:14.95,priceLabel:"\xa314.95"},{name:"King Prawn",price:18.5,priceLabel:"\xa318.50"},{name:"Mixed Vegetable",price:12.99,priceLabel:"\xa312.99"}]},{name:"Pudina",description:"Cooked with tomatoes , crushed garlic, ginger, spring onions & crushed mint.",productId:94,price:null,priceLabel:null,options:[{name:"Chicken Breast Tandoori",price:12.95,priceLabel:"\xa312.95"},{name:"Tender Lamb",price:13.95,priceLabel:"\xa313.95"},{name:"King Prawn",price:18.5,priceLabel:"\xa318.50"}]},{name:"Karahi",description:"Cooked in a cast iron bowl with fried garlic, green chilli paste, herbs & spices.",productId:95,price:null,priceLabel:null,options:[{name:"Chicken Breast",price:13.99,priceLabel:"\xa313.99"},{name:"Tender Lamb",price:14.99,priceLabel:"\xa314.99"},{name:"King Prawn",price:18.5,priceLabel:"\xa318.50"},{name:"Machi (fish)",price:15.95,priceLabel:"\xa315.95"},{name:"Mixed Vegetable",price:12.5,priceLabel:"\xa312.50"},{name:"Indian Veg",price:12.95,priceLabel:"\xa312.95"}]},{name:"Chasni",description:"Smooth sweet and tangy",productId:96,price:null,priceLabel:null,options:[{name:"Chicken Breast",price:13.95,priceLabel:"\xa313.95"},{name:"Tender Lamb",price:14.95,priceLabel:"\xa314.95"},{name:"King Prawn",price:18.5,priceLabel:"\xa318.50"},{name:"Mixed Vegetable",price:12.95,priceLabel:"\xa312.95"},{name:"Indian Veg",price:13.55,priceLabel:"\xa313.55"}]},{name:"Jalfrezi",description:"Mildly spiced with cream, sliced peppers, & ground cashew nuts.",productId:98,price:null,priceLabel:null,options:[{name:"Chicken Breast Tandoori",price:13.9,priceLabel:"\xa313.90"},{name:"Tender Lamb",price:14.5,priceLabel:"\xa314.50"},{name:"King Prawn",price:18.5,priceLabel:"\xa318.50"},{name:"Mixed Vegetable",price:12.5,priceLabel:"\xa312.50"},{name:"Indian Veg",price:12.75,priceLabel:"\xa312.75"}]},{name:"Royal Rogan Josh",description:"A heavenly spiced tomato blend.",productId:97,price:null,priceLabel:null,options:[{name:"Chicken Breast Tandoori",price:12.9,priceLabel:"\xa312.90"},{name:"Tender Lamb",price:13.5,priceLabel:"\xa313.50"},{name:"King Prawn",price:17.5,priceLabel:"\xa317.50"},{name:"Mixed Vegetable",price:10.9,priceLabel:"\xa310.90"},{name:"Indian Veg",price:10.99,priceLabel:"\xa310.99"}]},{name:"Punjabi Masala",description:"Bhoona style dish prepared with chopped peppers and punjabi spices",productId:100,price:null,priceLabel:null,options:[{name:"Chicken Breast Tandoori",price:12.95,priceLabel:"\xa312.95"},{name:"Tender Lamb",price:13.5,priceLabel:"\xa313.50"},{name:"Keema (mince meat)",price:12.95,priceLabel:"\xa312.95"},{name:"King Prawn",price:18.5,priceLabel:"\xa318.50"}]},{name:"Makhani",description:"Rich silky creamy sauce. Redolent with spice and flavour",productId:101,price:null,priceLabel:null,options:[{name:"Chicken Breast",price:13.95,priceLabel:"\xa313.95"},{name:"Tender Lamb",price:14.95,priceLabel:"\xa314.95"},{name:"King Prawn",price:18.5,priceLabel:"\xa318.50"},{name:"Machi (fish)",price:16.25,priceLabel:"\xa316.25"},{name:"Mixed Vegetable",price:12.5,priceLabel:"\xa312.50"},{name:"Indian Veg",price:12.75,priceLabel:"\xa312.75"}]},{name:"Brilliant Balti",description:"Rupee Room crushed masala, onions & peppers.",productId:102,price:null,priceLabel:null,options:[{name:"Chicken Breast",price:13.95,priceLabel:"\xa313.95"},{name:"Chicken Breast Tandoori",price:14.5,priceLabel:"\xa314.50"},{name:"Tender Lamb",price:14.95,priceLabel:"\xa314.95"},{name:"Tender Lamb Tandoori",price:15.95,priceLabel:"\xa315.95"},{name:"Keema (mince meat)",price:13.95,priceLabel:"\xa313.95"},{name:"Prawn",price:15.95,priceLabel:"\xa315.95"},{name:"King Prawn",price:18.99,priceLabel:"\xa318.99"},{name:"Machi (fish)",price:14.95,priceLabel:"\xa314.95"},{name:"Mixed Vegetable",price:11.55,priceLabel:"\xa311.55"},{name:"Indian Veg",price:11.95,priceLabel:"\xa311.95"}]}]},{id:"cat_15",categoryId:15,name:"Just Sauce",description:null,nestedCategoryIds:null,itemCount:1,items:[{name:"Just Sauce",description:null,productId:140,price:null,priceLabel:null,options:[{name:"Korma Sauce",price:5.95,priceLabel:"\xa35.95"},{name:"Garlic Chilli Sauce",price:5.95,priceLabel:"\xa35.95"},{name:"Bhoona Sauce",price:5.95,priceLabel:"\xa35.95"},{name:"Chasni Sauce",price:5.95,priceLabel:"\xa35.95"},{name:"Goanese(Spiced Coconut)",price:5.95,priceLabel:"\xa35.95"},{name:"Rogan Josh Sauce",price:5.95,priceLabel:"\xa35.95"},{name:"Butter Masala Sauce",price:5.95,priceLabel:"\xa35.95"}]}]},{id:"cat_13",categoryId:13,name:"Sides",description:null,nestedCategoryIds:null,itemCount:31,items:[{name:"2X Popadom",description:"Lentil crisps. Gluten free & Vegan. Portion of x2.",productId:103,price:1.99,priceLabel:"\xa31.99",options:null},{name:"Spiced Onions",description:"Delicious!",productId:104,price:1.95,priceLabel:"\xa31.95",options:null},{name:"Mango Chutney",description:"With a hint of local honey",productId:105,price:2.49,priceLabel:"\xa32.49",options:null},{name:"Mint Yoghurt Dip",description:null,productId:146,price:1.95,priceLabel:"\xa31.95",options:null},{name:"Pakora Sauce",description:"Deliciously packed with a host of spices!",productId:144,price:1.95,priceLabel:"\xa31.95",options:null},{name:"Tamarind Dip",description:"Tasty sweet 'n' sour dip",productId:145,price:1.95,priceLabel:"\xa31.95",options:null},{name:"Lime Pickle",description:"tangy hot.",productId:106,price:2.55,priceLabel:"\xa32.55",options:null},{name:"Mixed Salad",description:null,productId:107,price:2.95,priceLabel:"\xa32.95",options:null},{name:"Raita",description:"delicate minty yoghurt, cool as a cucumber.",productId:108,price:3.5,priceLabel:"\xa33.50",options:null},{name:"NAN",description:"Traditional. Suitable for Vegans.",productId:109,price:4.9,priceLabel:"\xa34.90",options:null},{name:"Garlic Nan",description:"Brushed with garlic butter.",productId:110,price:4.95,priceLabel:"\xa34.95",options:null},{name:"Garlic & Chilli Nan",description:null,productId:111,price:4.95,priceLabel:"\xa34.95",options:null},{name:"Garlic & Coriander Nan",description:null,productId:112,price:4.95,priceLabel:"\xa34.95",options:null},{name:"Peshwari Nan",description:"Deliciously sweet and honey drizzle.",productId:113,price:5.95,priceLabel:"\xa35.95",options:null},{name:"Cheese Nan",description:"grilled with cheese",productId:114,price:6.5,priceLabel:"\xa36.50",options:null},{name:"Garlic Cheese Nan",description:"roasted with garlic butter and melted cheese.",productId:149,price:6.5,priceLabel:"\xa36.50",options:null},{name:"Keema Nan",description:"Nan stuffed with our finest minced lamb.",productId:115,price:6.5,priceLabel:"\xa36.50",options:null},{name:"Tandoori Chapati",description:"vegan",productId:116,price:2.5,priceLabel:"\xa32.50",options:null},{name:"x2 Poori",description:"deep fried puffy bread - delicious!",productId:117,price:5.5,priceLabel:"\xa35.50",options:null},{name:"Paratha",description:"traditional flat layered bread",productId:118,price:3.95,priceLabel:"\xa33.95",options:null},{name:"Vegetable Paratha",description:"flat bread stuffed with mashed veg.",productId:119,price:5.5,priceLabel:"\xa35.50",options:null},{name:"Keema Paratha",description:null,productId:120,price:5.5,priceLabel:"\xa35.50",options:null},{name:"Boiled Rice",description:"Steamed basmati(king of rice) richly kissed with cardamom spice.",productId:121,price:4.35,priceLabel:"\xa34.35",options:null},{name:"Almond Coconut Rice",description:"almond flakes",productId:150,price:5.55,priceLabel:"\xa35.55",options:null},{name:"Lemon & Coriander Rice",description:null,productId:152,price:4.45,priceLabel:"\xa34.45",options:null},{name:"Onion Coriander Rice",description:null,productId:151,price:4.55,priceLabel:"\xa34.55",options:null},{name:"Pilau Rice",description:"Steamed basmati(king of rice) enhanced with fragrant herbs.",productId:122,price:4.35,priceLabel:"\xa34.35",options:null},{name:"Vegetable Rice",description:null,productId:123,price:4.75,priceLabel:"\xa34.75",options:null},{name:"Mushroom Rice",description:null,productId:124,price:4.55,priceLabel:"\xa34.55",options:null},{name:"Chips",description:null,productId:125,price:4.35,priceLabel:"\xa34.35",options:null},{name:"Masala Chips",description:"sweet \u2018n\u2019 spicy masala",productId:154,price:4.5,priceLabel:"\xa34.50",options:null}]},{id:"cat_14",categoryId:14,name:"The Generous Meal Deal",description:"\xa334.99. 15% OFF not available on the Generous Meal Deal.",nestedCategoryIds:null,itemCount:2,items:[{name:"Vegan Set Meal",description:"(Serves 2-3 People) X2 Popadoms Spiced Onions Mix Veg Pakora , Aloo Jeera Achari, Chilli Cauliflower, Coconut Rice, Garlic Nan",productId:126,price:29.99,priceLabel:"\xa329.99",options:null},{name:"The Generous Meal Deal",description:"(Serves 2-3 People) includes: 2 Popadoms. Spiced Onions. 1 Starter. 2 Mains.1 Rice. 1 Naan.",productId:127,price:34.99,priceLabel:"from \xa334.99",options:[{name:"From (choose options on site)",price:34.99,priceLabel:"\xa334.99"}]}]},{id:"cat_21",categoryId:21,name:"Kids Menu",description:null,nestedCategoryIds:null,itemCount:8,items:[{name:"Cheese Nan & Chips",description:null,productId:217,price:9.5,priceLabel:"\xa39.50",options:null},{name:"Chicken Nuggets & Chips",description:null,productId:214,price:10.5,priceLabel:"\xa310.50",options:null},{name:"Chicken Pakora & Chips",description:null,productId:215,price:10.5,priceLabel:"\xa310.50",options:null},{name:"Mozzarella Sticks & Chips",description:null,productId:218,price:9.99,priceLabel:"\xa39.99",options:null},{name:"Veg Korma",description:null,productId:220,price:9.95,priceLabel:"from \xa39.95",options:[{name:"From (choose options on site)",price:9.95,priceLabel:"\xa39.95"}]},{name:"Veg Pakora & Chips",description:null,productId:216,price:8.99,priceLabel:"\xa38.99",options:null},{name:"Chicken Curry",description:null,productId:221,price:9.95,priceLabel:"from \xa39.95",options:[{name:"From (choose options on site)",price:9.95,priceLabel:"\xa39.95"}]},{name:"Chicken Korma",description:null,productId:219,price:9.95,priceLabel:"from \xa39.95",options:[{name:"From (choose options on site)",price:9.95,priceLabel:"\xa39.95"}]}]},{id:"cat_16",categoryId:16,name:"Wine Beer & Soft",description:"Challenge 25 applies - Proof of age. Wines 11% - 14% abv.",nestedCategoryIds:null,itemCount:8,items:[{name:"Drinks",description:null,productId:141,price:null,priceLabel:null,options:[{name:"Can Coke",price:1.99,priceLabel:"\xa31.99"},{name:"Can Diet Coke",price:1.99,priceLabel:"\xa31.99"},{name:"Can Irn Bru",price:1.99,priceLabel:"\xa31.99"},{name:"Can Diet Irn Bru",price:1.99,priceLabel:"\xa31.99"},{name:"Cobra Zero",price:2.99,priceLabel:"\xa32.99"}]},{name:"Appletiser",description:"275ml",productId:169,price:2.25,priceLabel:"\xa32.25",options:null},{name:"Kingfisher Beer",description:"Premium beer 5% abv 330 ml",productId:171,price:4.49,priceLabel:"\xa34.49",options:null},{name:"Cider",description:"Peacock Premium 500ml 4.2%",productId:172,price:null,priceLabel:null,options:[{name:"Peacock Apple",price:4.89,priceLabel:"\xa34.89"},{name:"Peacock Mango Lime",price:5.29,priceLabel:"\xa35.29"}]},{name:"White Wine 12-13% abv",description:null,productId:173,price:null,priceLabel:null,options:[{name:"El Molturo Air\xe9n, Verdejo Spain",price:15.99,priceLabel:"\xa315.99"},{name:"Pinot Grigio",price:16.99,priceLabel:"\xa316.99"},{name:"Big Bombora Chardonnay",price:17.99,priceLabel:"\xa317.99"},{name:"Fernlands Sauvignon Blanc",price:19.99,priceLabel:"\xa319.99"}]},{name:"Red Wine 12-13% abv",description:null,productId:174,price:null,priceLabel:null,options:[{name:"El Molturo Tempranillo",price:15.99,priceLabel:"\xa315.99"},{name:"Bresco Merlot",price:16.99,priceLabel:"\xa316.99"},{name:"Flor del Fuego Cabernet Sauvignon",price:17.99,priceLabel:"\xa317.99"},{name:"Big Bombora Shiraz",price:17.99,priceLabel:"\xa317.99"},{name:"Riscos Malbec Chile",price:19.99,priceLabel:"\xa319.99"}]},{name:"Rose Wine",description:"11.5%",productId:175,price:null,priceLabel:null,options:[{name:"Circus Zinfandel",price:15.99,priceLabel:"\xa315.99"}]},{name:"Prosecco",description:"11%",productId:176,price:null,priceLabel:null,options:[{name:"Corte Alta",price:22.99,priceLabel:"\xa322.99"}]}]}],totals:{categories:18,items:162},orderingEnabled:!1,orderable:!1,currentMenuConfirmed:!1,needsConfirmation:!0,status:"published-reference-to-confirm"}},smokinggoat:{venueId:"smokinggoat",databaseSlug:"smoking-goat-ayr",urlSlug:"smoking-goat-ayr",uuidReserved:"cd985ff5-2443-458d-ac8b-342d553628cf",name:"Smoking Goat",address:"2A Academy Street, Ayr KA7 1HS",phone:"01292 857137",email:"",website:"",branding:{accent:"#D1792F",ink:"#202023",hasLogo:!0,logo:"assets/brand/smokinggoat.png",hero:"assets/brand/smokinggoat-hero.png",smallTextAccent:"#D17A31",onAccent:"#0B0B0B"},hours:{status:"to-confirm",days:{},sessionsByDay:null,needsConfirmation:!0,note:"Opening and kitchen hours to confirm. No operational days are configured; unknown does not mean closed."},kitchenSessionsByDay:null,booking:{mode:"in-app-manager-request",nativeDiary:!0,nativeRequests:!0,automaticConfirmation:!1,requiresManager:!0,managerReady:!1,setupGates:["authorised manager","confirmed kitchen hours"],fields:["date","time","Covers","name","phone","email","notes"],requiresConfirmedKitchenHours:!0,sendMessages:!1},deposit:{on:!1,amount:null,perPersonPence:null,fromParty:null,policy:null,needsConfirmation:!0},features:{takeaway:!1,delivery:!1,payments:!1,loyalty:!1,orderAtTable:!1,hotel:!1,directOrdering:!1},clockArea:{on:!0,lat:55.464226,lng:-4.6326035,radius:150,offRotaPrompt:!1,source:"Public FSA establishment 1410398; exact name/address match"},gatesToConfirm:["authorised manager and staff","opening and kitchen hours","correct email","website unavailable in source research","takeaway and delivery","current food/drinks prices and availability","allergens","table plan and Covers","booking and deposit terms","brand permissions","access and family policy"],menuServiceContext:null,allergenCaveat:null,emailNeedsConfirmation:null,questionnaire:{version:1,venueId:"smokinggoat",source:"from-config",submittedAt:"2026-11-06",venue:{name:"Smoking Goat",tagline:"Bar and grill \xb7 Ayr",address:"2A Academy Street, Ayr, KA7 1HS",phone:"01292 857137",website:"",hasLogo:!0,email:""},hours:{days:{},note:"Opening and kitchen hours to confirm. No operational days are configured; unknown does not mean closed.",needsConfirmation:!0},tables:{template:"custom",tables:null,covers:null,areas:[],needsConfirmation:!0},team:[],suppliers:[],accounts:[],features:{bookings:!0,takeaway:!1,orderAtTable:!1,tips:!1,rota:!1,games:!1,specials:!1},notes:"Separate smokinggoat tenant, public URL smoking-goat-ayr. Empty hours mean to confirm, not closed. In-app manager-confirmed table requests only. Email and website unresolved. All food/drinks prices are unknown; no ordering, payment, takeaway, delivery or loyalty. No staff, payroll, connected accounts or personal links."},menu:{menus:[{name:"Food",content:{venueId:"smokinggoat",status:"unconfirmed-reference-only",orderingEnabled:!1,categories:[{name:"Burgers",items:[{name:"The Smoking Goat Double Burger",description:null,price:null,allergens:null,currentAvailability:null,orderable:!1},{name:"Beer Mac & Cheese Double Burger",description:null,price:null,allergens:null,currentAvailability:null,orderable:!1},{name:"Sticky Korean Fried Chicken Burger",description:null,price:null,allergens:null,currentAvailability:null,orderable:!1},{name:"Buttermilk Fried Chicken Burger",description:null,price:null,allergens:null,currentAvailability:null,orderable:!1},{name:"Cajun Halloumi Burger",description:null,price:null,allergens:null,currentAvailability:null,orderable:!1}]},{name:"Savoury waffles",items:[{name:"BBQ Pulled Chicken Waffle",description:"Published with charred sweetcorn and crispy onions.",price:null,allergens:null,currentAvailability:null,orderable:!1},{name:"Cheeseburger Waffle",description:"Published with two 4oz beef burgers, cheddar, bacon, gherkins and slaw.",price:null,allergens:null,currentAvailability:null,orderable:!1},{name:"Goat Waffle",description:"Published with goats cheese, spinach, sun-dried tomatoes and chilli jam; dietary classification not confirmed.",price:null,allergens:null,currentAvailability:null,orderable:!1}]},{name:"Hot dogs",items:[{name:"Loaded Chilli Cheese Dog",description:null,price:null,allergens:null,currentAvailability:null,orderable:!1}]},{name:"Pizza",items:[{name:"Classic Margherita",description:null,price:null,allergens:null,currentAvailability:null,orderable:!1},{name:"Pepperoni",description:null,price:null,allergens:null,currentAvailability:null,orderable:!1},{name:"Hawaiian",description:null,price:null,allergens:null,currentAvailability:null,orderable:!1},{name:"Meat Feast",description:null,price:null,allergens:null,currentAvailability:null,orderable:!1},{name:"Goats Cheese",description:null,price:null,allergens:null,currentAvailability:null,orderable:!1},{name:"Black Pudding & Chorizo",description:null,price:null,allergens:null,currentAvailability:null,orderable:!1}]},{name:"Loaded fries",items:[{name:"Loaded fries",description:"Magazine lists toppings including cheese and bacon, pulled BBQ chicken, chilli and parmesan; exact current combinations unknown.",price:null,allergens:null,currentAvailability:null,orderable:!1}]},{name:"Nachos",items:[]},{name:"Wings",items:[{name:"Chicken wings",description:null,price:null,allergens:null,currentAvailability:null,orderable:!1},{name:"Cauliflower wings",description:null,price:null,allergens:null,currentAvailability:null,orderable:!1}]},{name:"Desserts",items:[{name:"Alabama Chocolate Fudge Cake",description:null,price:null,allergens:null,currentAvailability:null,orderable:!1},{name:"Warm Mars Bar Brownie",description:null,price:null,allergens:null,currentAvailability:null,orderable:!1},{name:"Churros",description:null,price:null,allergens:null,currentAvailability:null,orderable:!1},{name:"Trio of Ice Creams",description:null,price:null,allergens:null,currentAvailability:null,orderable:!1}]},{name:"Children\u2019s menu",items:[]}]}},{name:"Drinks",content:{venueId:"smokinggoat",currency:"GBP",status:"reference-only; current range and prices unverified",categories:[{name:"Real ales / craft beer",price:null,currentAvailability:null},{name:"Draught lager",price:null,currentAvailability:null},{name:"Guinness",price:null,currentAvailability:null},{name:"Cider",price:null,currentAvailability:null},{name:"Wine by glass or bottle",price:null,currentAvailability:null},{name:"Cocktails",price:null,currentAvailability:null},{name:"Spirits and whisky",price:null,currentAvailability:null},{name:"Freshly brewed tea",price:null,currentAvailability:null},{name:"Coffee",price:null,currentAvailability:null}],unknowns:["Current brands, measures, ABVs and stock","Cocktail list","Soft drinks and alcohol-free range","All prices","Alcohol licensing and age-verification conditions for ordering"]}}]}},pizzaioli:{venueId:"pizzaioli",databaseSlug:"pizzaioli",urlSlug:"pizzaioli",uuidReserved:"35f870fc-772c-4aad-bb9e-09a9a16bc925",name:"Pizzaioli Italian Eatery",address:"37 Sandgate, Ayr, KA7 1BG",phone:"01292 502892",email:"",website:"https://www.thepizzaioli.com/",branding:{accent:"#C03010",accentSuggested:"#C03010",ink:"#121212",smallTextAccent:"#D57661",onAccent:"#FFFFFF",testedDarkSurfaces:["#121212","#222222","#292929"],minimumSmallTextContrast:4.567589544982805,buttonLabelContrast:5.719644929108585,rawAccentOnInkContrast:3.275319383474432,logoRecoloured:!1,hasLogo:!0,logo:"assets/brand/pizzaioli.png",hero:"assets/brand/pizzaioli-hero.png",noDuplicateNameLine:!0},hours:{status:"to-confirm",days:{},sessionsByDay:null,needsConfirmation:!0,note:"Venue and kitchen hours to confirm. Unknown hours are not closed days."},kitchenSessionsByDay:null,booking:{mode:"in-app-manager-request",nativeDiary:!0,nativeRequests:!0,automaticConfirmation:!1,externalLinks:!1,requiresManager:!0,managerReady:!1,requiresConfirmedKitchenHours:!0,lastSittingMinutesBeforeClose:null,fields:["date","time","Covers","name","phone","email","notes"],sendMessages:!1},deposit:{on:!1,amount:null,perPersonPence:null,fromParty:null,policy:null,needsConfirmation:!0},features:{takeaway:!1,delivery:!1,payments:!1,loyalty:!1,orderAtTable:!1,hotel:!1,directOrdering:!1},clockArea:{on:!1,lat:null,lng:null,radius:150,offRotaPrompt:!1,needsConfirmation:!0},gatesToConfirm:["authorised manager and staff","table plan and Covers","deposit and booking terms","pay settings","ordering and delivery to set up","loyalty to set up","dine-in and kitchen hours","takeaway address conflict","takeaway and delivery hours","public email","brand accent approval","allergen matrix","incomplete dessert and cocktail prices","serving sizes","precise dine-in location"],menuServiceContext:null,allergenCaveat:null,emailNeedsConfirmation:!0,questionnaire:{version:1,venueId:"pizzaioli",source:"from-config",venue:{name:"Pizzaioli Italian Eatery",tagline:"Modern Italian cuisine \xb7 Ayr",address:"37 Sandgate, Ayr, KA7 1BG",phone:"01292 502892",email:"",website:"https://www.thepizzaioli.com/",hasLogo:!0},team:[],suppliers:[],accounts:[],hours:{status:"to-confirm",days:{},sessionsByDay:null,needsConfirmation:!0,note:"Venue and kitchen hours to confirm. Unknown hours are not closed days."},tables:{template:"restaurant",tables:null,covers:null,areas:[],needsConfirmation:!0,note:"Table plan and Covers to confirm."},features:{bookings:!0,takeaway:!1,orderAtTable:!1,tips:!1,rota:!1,games:!1,specials:!1,loyalty:!1},notes:"Separate pizzaioli tenant. In-app manager-confirmed table requests only. Deposit terms to confirm; charging is off. Team empty. No payroll or connected accounts. Ordering, delivery and loyalty to set up. Published menu is reference only; current prices, availability and allergens to confirm."},menu:{venueId:"pizzaioli",currency:"GBP",menus:[{id:"dine-in",label:"Dine-in (restaurant, 37 Sandgate)",needsConfirmation:!0,content:{venue:"Pizzaioli Italian Eatery (dine-in)",tabs:[{name:"Food",categories:[{name:"Snacks",items:[{name:"Focaccia, sundried tomatoes tapenade, olive oil",priceGbp:5.25,description:null},{name:"Marinated Leccino & Cerignola olives, pickled giardiniera",priceGbp:5.75,description:null},{name:"Hand-cut San Daniele prosciutto, extra virgin olive oil",priceGbp:8.65,description:null}]},{name:"Antipasti",items:[{name:"Barbabietola",priceGbp:8.95,description:"Warm beetroot salad, glazed pistacchio, whipped ricotta, honey-mustard dressing."},{name:"Porpette",priceGbp:9.35,description:"Traditional minced beef & pork meatballs, served with their own sugo, warm bread."},{name:"Granchio",priceGbp:11.95,description:"Marinated white crab meat, lobster mayo, red apple, sourdough."},{name:"Fritto misto",priceGbp:9.75,description:"Crispy flour-coated squid and tiger prawns, lemon aioli dip, fresh parsley."},{name:"Insalata invernale",priceGbp:8.95,description:"Curly endive salad, chestnut and red apple, sliced pecorino, shallot vinaigrette."},{name:"Crostone",priceGbp:10.25,description:"Sourdough, hand-cut San Daniele prosciutto, sliced pecorino, caramelised figs."}]},{name:"Primi",items:[{name:"Barese",priceGbp:16.25,description:"Strozzapreti, cime di rapa broccolini, garlic-chilli oil, pangrattato."},{name:"Portocciolo",priceGbp:20.45,description:"Tagliatelle, poached white crab meat, lobster sauce, garlic-chilli mussels, pangrattato."},{name:"Carbonara",priceGbp:16.45,description:"Rigatoni, pan-fried guanciale (dry aged pork cheek), egg yolk emulsion, cracked black pepper, pecorino."},{name:"Maremma",priceGbp:16.45,description:"Strozzapreti, marjoram wild mushrooms, madeira wine cream, toasted chestnuts."},{name:"Mortacci",priceGbp:17.25,description:"Fettuccine, spicy n'duja and mascarpone sauce, fennel sausage ragu, lemon zest."},{name:"Lasagne verdi",priceGbp:16.95,description:"Just like Nonna used to make."}]},{name:"Secondi",items:[{name:"Ciuppin",priceGbp:24.65,description:"Hake fillet, steamed mussels and tender squid, tiger prawns, saffron-tomato broth, sourdough."},{name:"Tirolese",priceGbp:19.25,description:"Leek and potato gratin, baked taleggio cheese, pangrattato."},{name:"Guanciola",priceGbp:23.45,description:"Barolo-braised ox cheek, polenta, burnt shallot, beef bone jus."}]},{name:"Pinsa",items:[{name:"Regina Margherita",priceGbp:14.45,description:"Tomato & mozzarella base, parmesan, fresh basil."},{name:"Ape 50",priceGbp:16.95,description:"Tomato & mozzarella base, ventricina salame, n'duja sausage, chilli hot honey."},{name:"Pizzaioli",priceGbp:16.75,description:"Tomato & mozzarella base, slow cooked garlic chicken breast, spicy pepperoni, basil dressing."},{name:"Tropea",priceGbp:15.75,description:"Tomato & mozzarella base, roasted red onions, sundried tomatoes, fresh basil."},{name:"Bolgheri",priceGbp:16.95,description:"Tomato & mozzarella base, roasted fennel sausage, rosemary wild mushrooms, pecorino."},{name:"Trentina",priceGbp:16.75,description:"Tomato & mozzarella base, prosciutto speck, taleggio cheese, aged balsamic dressing."}]},{name:"Sides",items:[{name:"Fries",priceGbp:4.35,description:"Skin-on fries, sea salt."},{name:"Cesarina",priceGbp:5.95,description:"Crispy gems, anchovy dressing, parmesan."},{name:"Patate",priceGbp:5.75,description:"Garlic & herb crispy potatoes, parmesan."},{name:"Scarola",priceGbp:6.45,description:"Sauteed curly endive, black olives, raisins."},{name:"Rapini",priceGbp:6.45,description:"Garlic-chilli grilled broccolini, pangrattato."}]}]},{name:"Drink",categories:[{name:"Draught Beer",items:[{name:"Moretti Italiana",priceGbp:6.35,description:null}]},{name:"Premium Bottled Beers and Ciders",items:[{name:"Mela Rossa Italian Cider | 330ml (4.5%)",priceGbp:4.25,description:null},{name:"Birra Flea Adelaide APA | 330ml (4.9%)",priceGbp:6.35,description:"Umbria, Italy. A pale yellow, pure malt beer with a fresh, distinctly bitter flavour and excellent drinkability."},{name:"Birra Flea Constanza Blonde Ale | 330ml (5.2%)",priceGbp:6.45,description:"Umbria, Italy. A pale golden lager, brewed with 100% barley malt, clear with good effervescence."},{name:"Birra Flea Bastola Imperial Red Ale | 330ml (6.9%)",priceGbp:6.85,description:"Umbria, Italy. Roasted malt, caramel, toffee and dried fruit with resinous spicy hops."}]},{name:"Cocktails",items:[{name:"Negroni",priceGbp:9.75,description:"Malfy original gin, sweet vermouth, campari, orange peel."},{name:"Cosmopolitan",priceGbp:null,description:"Belvedere vodka, triple sec, lemon juice, cranberry juice, sugar syrup.",priceNeedsConfirmation:!0},{name:"Engine & Tonic",priceGbp:9.45,description:"Organic gin, tonic water, lime wedge."},{name:"Negroni Bianco",priceGbp:9.45,description:"Malfy original gin, italicus rosolio, dry martini, lemon peel."},{name:"Disaronno Sour",priceGbp:9.45,description:"Amaretto disaronno, pressed lemon, sugar syrup, whites, fresh thyme."},{name:"\"Ca Va\" Martini",priceGbp:9.95,description:"Belvedere vodka, chambord, pineapple juice, fresh raspberries."},{name:"Raspberry Mule",priceGbp:9.75,description:"Belvedere vodka, chambord, ginger beer, lime juice, raspberries."},{name:"Martinez",priceGbp:9.95,description:"Organic gin, sweet vermouth, maraschino liqueur, angostura, orange twist."}]},{name:"Spritz",items:[{name:"Aperol",priceGbp:9.45,description:"Prosecco doc, aperol, soda, fresh orange."},{name:"Campari",priceGbp:9.45,description:"Campari, prosecco doc, soda."},{name:"Hugo",priceGbp:9.45,description:"St Germain elderflower liqueur, prosecco doc, soda, fresh mint."},{name:"Amaretto",priceGbp:9.45,description:"Prosecco doc, amaretto disaronno, soda, fresh thyme."},{name:"Limoncello",priceGbp:9.45,description:"Limoncello, prosecco doc, soda, fresh lemon."},{name:"Americano",priceGbp:9.45,description:"Campari, red vermouth, soda, orange twist."},{name:"Bicicletta",priceGbp:9.45,description:"Pinot grigio, campari, soda, fresh orange."},{name:"Italico",priceGbp:9.45,description:"Italicus rosolio, prosecco doc, soda, green olive."}]},{name:"Non-Alcoholic",items:[{name:"Crodino Spritz",priceGbp:5.75,description:"Crodino bitter, soda, angostura, fresh orange."},{name:"\"Gin\" & Tonic",priceGbp:5.75,description:"Caleno light & zesty, tonic water, fresh lime."},{name:"Spasso",priceGbp:5.75,description:"Organic ginger beer, pineapple juice, fresh mint."}]},{name:"Soft drinks & hot drinks (partial)",items:[{name:"Ginger Beer, Bundaberg | 375ml",priceGbp:3.95,description:null},{name:"San Pellegrino | 330ml",priceGbp:3.25,description:"Choose from aranciata, limonata or orange & pomegranate."},{name:"Coke | 330ml",priceGbp:3.25,description:null},{name:"Diet Coke | 330ml",priceGbp:3.25,description:null},{name:"Flat White",priceGbp:null,description:"Size and price to confirm.",priceNeedsConfirmation:!0},{name:"Lichfields Tea",priceGbp:3.35,description:null}]},{name:"Spirits / Digestivo (price tiers published)",items:[{name:"Grappa La Trentina Tradizionale (41%)",priceGbp:4.95,description:"25ml \xa34.95 | 50ml \xa38.45. Other digestivi/gins/whiskies listed with 25ml/50ml tiers on site \u2014 full name list incomplete in scrape; see raw/menu.html."},{name:"Tanqueray | 10YO (43.1%)",priceGbp:4.35,description:"25ml \xa34.35 | 50ml \xa38.15"},{name:"Engine | Italian Organic (42%)",priceGbp:4.35,description:"25ml \xa34.35 | 50ml \xa38.15"},{name:"Malfy | Original (41%)",priceGbp:4.95,description:"25ml \xa34.95 | 50ml \xa38.45"},{name:"Talisker | 10YO (45.8%)",priceGbp:6.5,description:"25ml \xa36.50 | 50ml \xa311.15"},{name:"Glenlivet | 12YO (40%)",priceGbp:6.15,description:"25ml \xa36.15 | 50ml \xa310.65"}]}]},{name:"Wine",categories:[{name:"Rosso",items:[{name:"Nero d'Avola Sicilia DOC | 2024",priceGbp:25.5,description:"Trezanti, Sicily. 175ml \xa37.25 | 250ml \xa38.75 | Bottle \xa325.50"},{name:"Rosso di Puglia IGT | 2024",priceGbp:27.5,description:"Il Carretto, Puglia. 175ml \xa37.75 | 250ml \xa39.25 | Bottle \xa327.50"},{name:"Governo Uso Toscano | 2023",priceGbp:29.5,description:"Cipressi, Tuscany. 175ml \xa38.35 | 250ml \xa39.85 | Bottle \xa329.50"},{name:"Merlot DOC Friuli | 2024",priceGbp:30.45,description:"Cantina Rauscedo. 175ml \xa38.65 | 250ml \xa310.15 | Bottle \xa330.45"},{name:"Montepulciano d'Abruzzo OP | 2024",priceGbp:32.55,description:"Villa Diana. 175ml \xa38.35 | 250ml \xa310.85 | Bottle \xa332.55"},{name:"Appassimento Rosso IGT Onapiena | 2020",priceGbp:33.15,description:"Cantina Taia, Abruzzo. 175ml \xa39.55 | 250ml \xa311.05 | Bottle \xa333.15"},{name:"Mucchietto Primitivo IGT | 2023",priceGbp:34.25,description:"Pasqua Vigneti, Puglia. 175ml \xa39.95 | 250ml \xa311.45 | Bottle \xa334.25"},{name:"Pinot Nero di Tunella | 2023",priceGbp:38.15,description:"La Tunella, Friuli. 175ml \xa311.25 | 250ml \xa312.75 | Bottle \xa338.15"},{name:"Valpolicella Classico Superiore | 2020",priceGbp:49.95,description:"Cecilia Beretta, Veneto. 175ml \xa312.25 | 250ml \xa313.75 | Bottle \xa349.95"},{name:"Chianti Classico DOCG | 2022",priceGbp:42.45,description:"Rocca delle Macie, Tuscany. 175ml \xa312.65 | 250ml \xa314.15 | Bottle \xa342.45"}]},{name:"White",items:[{name:"Grillo Sicilia DOC | 2024",priceGbp:25.5,description:"Trezanti, Sicily. 175ml \xa37.25 | 250ml \xa38.75 | Bottle \xa325.50"},{name:"Sangiovese Bianco Toscana IGT | 2024",priceGbp:28.75,description:"Barbanera, Tuscany. 175ml \xa38.15 | 250ml \xa39.65 | Bottle \xa328.75"},{name:"Pecorino d'Abruzzo IGT Orapiena | 2024",priceGbp:29.35,description:"Cantina Tollo. 175ml \xa38.35 | 250ml \xa39.85 | Bottle \xa329.35"},{name:"Fiano IGT Puglia | 2024",priceGbp:31.85,description:"Mucchietto, Puglia. 175ml \xa39.35 | 250ml \xa310.85 | Bottle \xa331.85"},{name:"Pinot Grigio DOC | 2024",priceGbp:33.15,description:"Cantina Rauscedo. 175ml \xa39.55 | 250ml \xa311.05 | Bottle \xa333.15"},{name:"Incantesimo Falanghina Sannio DOC | 2024",priceGbp:34.45,description:"La Guardiense, Campania. 175ml \xa310.15 | 250ml \xa311.85 | Bottle \xa334.45"},{name:"Sauvignon Blanc | 2025",priceGbp:38.75,description:"Antonutti, Friuli. 175ml \xa310.75 | 250ml \xa312.25 | Bottle \xa338.75"},{name:"Appia Antica 400 Bianco | 2023",priceGbp:39.95,description:"Tenuta Principe Alberico, Lazio. 175ml \xa311.85 | 250ml \xa313.35 | Bottle \xa339.95"}]},{name:"Ros\xe9",items:[{name:"Rosato Maremma Toscana DOC | 2025",priceGbp:33.15,description:"Rocca delle Macie. 175ml \xa38.55 | 250ml \xa311.05 | Bottle \xa333.15"},{name:"Rosa Ros\xe9 DOC Venezia | 2025",priceGbp:33.15,description:"Borgo Molino. 175ml \xa38.55 | 250ml \xa311.05 | Bottle \xa333.15"}]},{name:"Sparkling",items:[{name:"Motivo DOCG Prosecco Superiore Millesimato Brut | 2022",priceGbp:34.25,description:"Borgo Molino, Veneto. 125ml \xa35.95 | Bottle \xa334.25"},{name:"Asti DOCG Dolce | 2024",priceGbp:29.75,description:"Perlino, Piedmont. 125ml \xa34.95 | Bottle \xa329.75"}]}]},{name:"Dessert",categories:[{name:"Dessert",items:[{name:"Torta Capri",priceGbp:9.75,description:"Traditional chocolate and almond cake, brandied cherries, mascarpone cream."},{name:"Pizzaioli's Tiramisu",priceGbp:9.45,description:"Famous and delicious."},{name:"Affogato",priceGbp:8.25,description:"Vanilla soft ice, espresso, amaretti biscuits. Boozy +\xa33.25 (Frangelico / Amaretto / Montenegro / Cointreau / Baileys)."},{name:"Vanilla Cr\xe8me Br\xfbl\xe9e",priceGbp:9.45,description:"Madagascan vanilla baked custard, torched caramel, biscotti."},{name:"Coppa Pistacchio",priceGbp:9.95,description:"Vanilla soft-serve, pistacchio sauce, caramel popcorn, dark chocolate."}]}]},{name:"Lunch",categories:[{name:"Snacks",items:[{name:"Focaccia, sundried tomatoes tapenade, olive oil",priceGbp:5.25,description:null},{name:"Marinated Leccino & Cerignola olives, pickled giardiniera",priceGbp:5.75,description:null},{name:"Hand-cut San Daniele prosciutto, extra virgin olive oil",priceGbp:6.65,description:"Lunch price differs from evening snacks (\xa38.65) \u2014 flagged."}]},{name:"Starters",items:[{name:"Calamari",priceGbp:7.95,description:"Crispy flour coated squid, roasted aioli dip, fresh lemon."},{name:"Zuppa del giorno",priceGbp:6.45,description:"Today's soup, served with warm bread, parmesan."},{name:"Broccolini",priceGbp:7.45,description:"Garlic-chilli tender broccoli, ricotta, pangrattato."},{name:"Norcino",priceGbp:8.65,description:"Hand-cut San Daniele prosciutto, taralli pugliesi, extra virgin olive oil."},{name:"Porpette",priceGbp:7.75,description:"Traditional minced beef & pork meatballs, served with their own sugo, parmesan."}]},{name:"Served with skin-on fries / soup (focaccia sandwiches)",items:[{name:"Piaggio",priceGbp:12.25,description:"Mascarpone, n'duja spread, rocket leaves, chilli hot honey."},{name:"Paesana",priceGbp:11.85,description:"Sundried tomato, melted mozzarella, green pesto dressing."},{name:"Sarda",priceGbp:11.85,description:"Sauteed curly endive, marinated olives, sliced pecorino, chilli oil."},{name:"Cesare",priceGbp:12.45,description:"Buttermilk chicken tenders, roasted garlic mayo, crispy gems, parmesan."},{name:"Muffoletta",priceGbp:12.25,description:"Melted mozzarella, ventricina, sundried tomatoes tapenade, rocket leaves."},{name:"Alpina",priceGbp:12.15,description:"Taleggio cheese, prosciutto speck, chilli hot honey."}]},{name:"Pasta",items:[{name:"Bello de Nonna",priceGbp:12.75,description:"Fettuccine, slow-cooked beef ragu, parmesan."},{name:"Cenaia",priceGbp:12.45,description:"Rigatoni, roasted fennel sausage, plum tomato sauce, pecorino."},{name:"Pivello",priceGbp:12.45,description:"Fettuccine, roasted wild mushrooms, brown butter sauce, fried sage."},{name:"Focene",priceGbp:15.25,description:"Strozzapreti, garlic-chilli squid, mussels, lobster bisque."},{name:"Trapani",priceGbp:12.75,description:"Strozzapreti, red pesto trapanese, ricotta, pangrattato."}]},{name:"Pinsetta",items:[{name:"Margherita",priceGbp:13.25,description:"Tomato base, mozzarella, fresh basil, parmesan."},{name:"Ortona",priceGbp:13.95,description:"Tomato base, mozzarella, garlic wild mushrooms, rocket leaves, parmesan."},{name:"Salentina",priceGbp:14.35,description:"Tomato base, mozzarella, spicy n'duja, sundried tomatoes."},{name:"Beppone",priceGbp:14.15,description:"Tomato base, mozzarella, ventricina, whipped ricotta, pecorino."},{name:"Rustica",priceGbp:14.15,description:"Tomato base, mozzarella, buttermilk chicken strips, chilli hot honey."}]},{name:"Sides",items:[{name:"Fries",priceGbp:4.35,description:"Skin-on fries, sea salt."},{name:"Cesarina",priceGbp:5.95,description:"Crispy gems, anchovy dressing, parmesan."},{name:"Patate",priceGbp:5.45,description:"Garlic & herb crispy potatoes, pecorino. (Lunch price \xa35.45 vs evening \xa35.75 \u2014 flagged.)"},{name:"Scarola",priceGbp:6.45,description:"Sauteed curly endive, black olives, raisins."},{name:"Rapini",priceGbp:6.45,description:"Garlic-chilli grilled broccolini, pangrattato."}]}]},{name:"Kids",categories:[{name:"Mains",items:[{name:"Pizza",priceGbp:7,description:"Cheese & tomato pizza, served with skin-on fries. Additional toppings 50p (Pepperoni, Roasted Chicken, Red Onions, Olives, Garlic Sausage)."},{name:"Pasta asciutta",priceGbp:7,description:"Rigatoni, parmesan. Choose from: Slow Cooked Sugo; Butter & Parmesan; Beef Ragu."},{name:"Lasagne",priceGbp:7,description:"Traditional beef ragu and bechamel lasagne, served with skin-on fries."},{name:"Pizzaioli's Chicken Tenders",priceGbp:7,description:"Buttermilk marinated chicken breast fillets, served with skin-on fries."}]},{name:"Treats",items:[{name:"Gelato",priceGbp:3,description:"Soft serve vanilla ice cream, sprinkles, chocolate wafer."},{name:"Frutta",priceGbp:null,description:"Seasonal fruit salad, served with ice cream. Price not clearly adjacent in scrape \u2014 confirm."},{name:"Biscotti",priceGbp:null,description:"Cookie ice cream sandwich, chocolate sauce. Price not clearly adjacent in scrape \u2014 confirm."}]}]}]}},{id:"takeaway",label:"Takeaway / delivery (The Pizzaioli Ayr)",needsConfirmation:!0,content:{venue:"The Pizzaioli Ayr (takeaway)",categories:[{name:"Christmas Hampers",items:[{name:"Small Hamper",priceGbp:34.95,description:"traditional Italian hamper basket filled with a curated selection of Italian gourmet foods and condiments, such as: 3 x luxury durum semolina pasta, 3 x pasta sauce jars, 1 x salame cacciatore, 1 x provolone dolce cheese, 1 x Italian olives jar, 1 x Ichnusa unfiltered 330ml bottle, 2 x mini panettone, various biscuits. Enjoy!"},{name:"Medium Hamper",priceGbp:45.95,description:null}]},{name:"Panzerotti",items:[{name:"Perbacco",priceGbp:12.95,description:"Filled with: sugo, garlic aubergine, sundried tomatoes, parmesan."},{name:"Spaccanapoli",priceGbp:12.95,description:"Filled with: ricotta cheese, Italian roast ham, mushrooms & fresh basil."},{name:"Calabrese",priceGbp:12.95,description:"Filled with: sugo, roasted nduja sausage, mozzarella, grated pecorino."}]},{name:"Pizza Club ( Sunday)",items:[{name:"Any Pizza \xa311.95",priceGbp:11.95,description:null}]},{name:"Meal for Two",items:[{name:"Arancini Party",priceGbp:31.45,description:"1x Any 12\" Pizza 3x Arancini"},{name:"IN CRUST WE TRUST",priceGbp:45.85,description:"2x 12\u201dPizzas1x Arancini1x Skin on fries ( add \xa30.50 for Cajun or Chilli & Parmesan or Truffle & Parmesan)2x Dips"},{name:"LOVELY JUBBLY",priceGbp:38.95,description:"Any 12\u201d Pizzas , 2 drinks of your choice, 2 dips"},{name:"LITTLE ITALY",priceGbp:32.45,description:"1x 12\u201dPizza1x Parmesan Chicken Tenders1x Mozzarella Dippers"}]},{name:"Meal for One",items:[{name:"EASY CHEESY",priceGbp:24.55,description:"1x 12\u201d pizza1x mozzarella dippers1x drink"},{name:"GOT AN EMPTY",priceGbp:22.45,description:"1x Panzerotti1x skin on fries ( extra 0.50 for Cajun fries or truffle & Parmesan or Chilli & Parmesan )2x dips1x drink (San pellegrino extra \xa30.50)"},{name:"ROMAN'S STYLE",priceGbp:21.95,description:"Any 1x 12\u201d Pizza, 1x Arancini and 1x drink"},{name:"MR TIRAMISU",priceGbp:21.65,description:"1x Any 12\" Pizza 1x Pizzaioli's Tiramisu"}]},{name:"Sunday Half Chicken",items:[{name:"Pizzaioli's half chicken ( SUNDAY ONLY)",priceGbp:11.5,description:"Girrarosto marinated half chicken, served with fried potatoes, side of green salad, & home made salsa verde sauce."}]},{name:"Thursday Deal (Dips day)",items:[{name:"Garlic & Parmesan chicken tenders",priceGbp:9.45,description:null},{name:"Mozzarella Dippers",priceGbp:8.15,description:"Giant crispy Mozzarella sticks oregano & Parmesan crumb"},{name:"Chilli & Parmesan fries",priceGbp:5.7,description:null},{name:"cajun fries",priceGbp:5.7,description:null},{name:"skin on fries",priceGbp:4.95,description:null},{name:"Macaroni bites",priceGbp:7.25,description:"Crispy mac & Cheese bites, mature cheddar glaze"},{name:"Arancini Ham speck & provola",priceGbp:5.65,description:"Breaded Risotto ball filled with smoked ham & Provola cheese"},{name:"Arancini Carbonara",priceGbp:5.65,description:"Breaded risotto ball filled with Italian guanciale & Pecorino cheese"},{name:"Arancini Cacio & Pepe",priceGbp:5.65,description:"Breaded risotto ball filled with Pecorino cheese and black pepper"},{name:"Arancini Tomato & basil",priceGbp:5.65,description:"Breaded Risotto ball filled with Tomato, basil and mozzarell cheese"}]},{name:"Pizzaioli Gift Voucher",items:[{name:"\xa350 Gift Voucher",priceGbp:50,description:null},{name:"\xa325 Gift Voucher",priceGbp:25,description:null},{name:"\xa315 Gift Voucher",priceGbp:15,description:null}]},{name:"November Specials",items:[{name:"Pizzaioli's Dirty fries",priceGbp:8.95,description:"Skin on fries, loaded with cheese sauce, crispy onions and chicken tenders."},{name:"Pizza Bello de Zia",priceGbp:15.95,description:"Tomato & Mozzarella base, house made meatball, spicy ricotta cheese & basil pesto"},{name:"Honey BBQ Chicken wings",priceGbp:8.5,description:"Baked chicken wings in a Honey BBQ marinate. (4PCS)"},{name:"Zucchini fritti",priceGbp:6.95,description:"Fried courgette, served with grated pecorino & lemon wedge"},{name:"Fiori di zucca",priceGbp:6.5,description:"Light battered courgette's flowers, sprinkled with grated pecorino cheese and a lemon wedge"},{name:"TORTA DELLA NONNA",priceGbp:5,description:"Thin crust pastry, filled with Italian lemon Curd, Toasted pine nuts"}]},{name:"Lunch Combo Deals",items:[{name:"Pizzame",priceGbp:18.55,description:"1x 12\u201d pizza1x dip1x drink ( San Pellegrino e xtra \xa30.70)"},{name:"Mamma Mia",priceGbp:16.45,description:"1x Panzerotti2x dip1x drink (San pellegrino extra \xa30.70)"},{name:"Stay Light",priceGbp:11.45,description:"1x Filled Focaccia1x Dip1x drink (San pellegrino extra \xa30.70)"}]},{name:"Wednesday Deal (buy one pizza get one half price)",items:[{name:"Buy 1 Get 1 Half Price",priceGbp:null,description:null}]},{name:"Create your own Pizza",items:[{name:"Create your own Pizza *IT COMES WITH MOZZARELLA AND TOMATO SUGO*",priceGbp:11.95,description:"Create your own Pizza - Add your toppings and dips! *IT COMES WITH MOZZARELLA AND TOMATO SUGO*"}]},{name:"Meat Pizzas",items:[{name:"Cerveteri",priceGbp:15.95,description:"Our Tomato sugo base, 100% Fior di latte Mozzarella, Roasted fennel sausage, gorgonzola cheese, red onions"},{name:"Barga",priceGbp:15.95,description:"Our Tomato sugo base, 100% Fior di latte Mozzarella, Tuscan fennel sausage, Friarelli Broccoli and chilli oil"},{name:"Campo de Fiori",priceGbp:15.95,description:"Our Tomato sugo, 100% Fior di latte Mozzarella, Leccino olives, prosciutto Crudo, bitter rocket leaves"},{name:"Portobello",priceGbp:15.95,description:"Our tomato base, 100% Fior di latte Mozzarella, Prosciutto cotto, Mushrooms and fresh ricotta cheese."},{name:"PIZZAIOLA",priceGbp:15.95,description:"Pepperoni, Chicken, pesto"}]},{name:"Vegetarian Pizza",items:[{name:"Ortona Pizza",priceGbp:14.65,description:"Tomato & Mozzarella base, Roasted Mushrooms, Rocket Leaves, truffle oil"},{name:"Fiorentina",priceGbp:14.65,description:"Our Tomato base sugo, 100% fior di latte cheese, Fried spinach, leccino olives, grated pecorino"},{name:"Verdone",priceGbp:14.65,description:"Our tomato sugo base, 100% Fior di latte mozzarella, Red onions, sundried tomato, fresh basil"},{name:"Parmigiana",priceGbp:14.65,description:"Our tomato sugo base, 100% Fior di latte cheese, Roasted Aubergine, Sundried tomato, fresh basil and parmigiano reggiano."},{name:"PEPERINA",priceGbp:14.65,description:"Our Tomato sugo base, 100% Fior di latte cheese, skinned red peppers, red onions, capers"}]},{name:"Spicy Pizzas",items:[{name:"Stallone",priceGbp:16.45,description:"Our tomato sugo base, 100% Fior di latte mozzarella cheese, Inferno chicken tenders strips, red onions, nduja sausage"},{name:"Uaglio'",priceGbp:16.45,description:"Our Tomato sugo, 100% Fior di latte cheese, Anchovies, Capers, Leccino Olives and fresh chillies."},{name:"Vespa",priceGbp:16.45,description:"Our Tomato Sugo, 100% Fior di latte mozzarella, Italian Pepperoni, Spicy nduja Sausage, fresh Ricotta cheese and chilli honey."},{name:"Quartaccio",priceGbp:16.45,description:"Ventricina salame, gorgonzola piccante & Fresh chillies"},{name:"MORTACCI",priceGbp:16.45,description:"ventricina salame, nduja, chilli oil"}]},{name:"\"For the wee ones\"",items:[{name:"Gelato",priceGbp:3.25,description:"1 scoop of artisanal vanilla gelato"},{name:"Mini Mozzarella Sticks & Fries",priceGbp:7.45,description:"Fried Mozzarella sticks Served with Fries & Tomato Ketchup"},{name:"Breaded Chicken Fillet & Fries",priceGbp:7.45,description:"Fried Chicken Fillet Served with Skin on Fries & Ketchup"},{name:"MARGHERITA",priceGbp:7.45,description:"9\" Pizza Tomato sauce & Mozzarella"}]},{name:"Favourite",items:[{name:"Pizzaioli's Lasagna",priceGbp:12.95,description:"Layered egg pasta sheets, slow cooked beef ragu, bechamel & pecorino cream, served with focaccia bread."},{name:"Pizzaioli's Lasagne",priceGbp:12.95,description:"Layered egg-pasta sheet, slow cooked beef Ragu', bechamel & Parmesan cream, served with warm focaccia bread."},{name:"Focaccia and Dips",priceGbp:6.95,description:"Our own sourdough In-house made Focaccia bread, served with olive oil & balsamic dressing."},{name:"Pizzaioli Antipasti",priceGbp:10.95,description:"Deliciously served with red onion & rocket salad, freshly sliced Prosciutto, Ventricina Salami, Bufala Mozzarella.. and of course Our Focaccia."},{name:"Garlic Pizza bread",priceGbp:6.45,description:"Hand-stretched 9\" Pizza bread finished with garlic herb oil."}]},{name:"From the Fryer",items:[{name:"Arancini ham speck & Provola",priceGbp:5.65,description:"Breaded risotto ball filled with smoked Ham & Provola cheese."},{name:"Arancini Carbonara",priceGbp:5.65,description:"Breaded risotto ball filled with Italian guanciale & pecorino cheese"},{name:"Arancini Cacio & pepe",priceGbp:5.65,description:"Breaded risotto ball filled with Pecorino cheese and black pepper"},{name:"Arancini Tomato & Mozzarella",priceGbp:5.65,description:"Breaded risotto ball filled with Tomato, Basil and mozzarella cheese"},{name:"Skin on Fries",priceGbp:4.95,description:null},{name:"Mozzarella Dippers",priceGbp:8.15,description:"Giant Crispy Mozzarella Sticks, Oregano & Parmesan Crumb."},{name:"Garlic & Parmesan Chicken Tenders",priceGbp:9.45,description:"Marinated chicken Breast Fillets fried in a golden crumb."}]},{name:"Dips",items:[{name:"Parmesan & Basil Pesto",priceGbp:2.15,description:null},{name:"Tomato Ketchup",priceGbp:2.15,description:null},{name:"Chilli Honey",priceGbp:2.15,description:null},{name:"SPICY CHIPOTLE MAYO",priceGbp:2.15,description:"What is Chipotle??? Particular type of Mexican pepper, with an amazing smokiness flavor."},{name:"GARLIC & HERB MAYO",priceGbp:2.15,description:"Soft herb & roasted garlic mayonnaise, just too good for any pizza!"},{name:"SPICY MARINARA SAUCE",priceGbp:2.15,description:"100% Italian Pomodoro seasoned with the finest of extra virgin olive oil, fresh parsley & basil, chilli flakes and oregano."}]},{name:"Salads",items:[{name:"Romana",priceGbp:6.95,description:"Bitter Rocket Leaves, Sundried Tomato & red Onion Salad, served with Balsamic & Olive Oil Dressing"},{name:"LA CESARINA",priceGbp:6.95,description:"Dressed crispy baby gems, sea salat focaccia croutons, grated Parmesan, served with garlic & herb drizzle."},{name:"Panzanella",priceGbp:6.95,description:"Marinated tomatoes, black olive & red onion salad, focaccia croutes, served with red wine vinegar and olive oil dressing."}]},{name:"Focacce",items:[{name:"ROMAGNOLA",priceGbp:7.95,description:"Dry cured Prosciutto crudo, Mozzarella di Bufala, rocket leaves, Olive oil & balsamic dressing."},{name:"TROPEA",priceGbp:7.95,description:"Fired roasted peppers, sliced red onions, rocket leaves, Olive oil & Balsamic vinegar dressing."},{name:"Caprese",priceGbp:7.95,description:"Beef Tomato, mozzarella di bufala, rocket leaves, basil pesto"},{name:"Tullio",priceGbp:7.95,description:"Breaded chicken tenders, crispy baby gems, parmesan and garlic & herb mayo"},{name:"GALLINA",priceGbp:7.95,description:"Roasted cajun pulled chicken breast, crispy baby gems, chipotle Mayo."},{name:"VENTRICE",priceGbp:7.95,description:"Spicy Ventricina Salame, melted Mozzarella cheese, rocket leaves."},{name:"PAESANA",priceGbp:7.95,description:"Melted Mozzarella cheese, sundried tomatoes, In-house made basil dressing."},{name:"PIAGGIO",priceGbp:7.95,description:"Mascarpone cheese spread, spicy n\u2019Duja sausage, chilli hot honey, rocket leaves."}]},{name:"Desserts",items:[{name:"Gelato Vanilla",priceGbp:3.75,description:"1 scoop of artisanal Italian gelato"},{name:"Gelato Stracciatella",priceGbp:3.75,description:"1 scoop of artisanal italian gelato"},{name:"Gelato Nocciola ( Hazelnut)",priceGbp:3.75,description:"1 scoop of artisanal Italian Gelato"},{name:"Gelato Pistacchio",priceGbp:3.75,description:"1 scoop of artisanal italian gelato"},{name:"Pannacotta",priceGbp:6.45,description:"Served with berries compote, biscotti crumb"},{name:"Zeppole",priceGbp:7.95,description:"Pillows of fried pizza dough, dusted with cinnamon sugar, served with nutella & White chocolate sauce"},{name:"SFOGLIATELLE AL Cioccolato",priceGbp:5.95,description:"Filo Pastry Parcels filled with Hazelnut & Cocoa Spread. 3for \xa35.95 Delicious!!"},{name:"Nonna's tiramisu",priceGbp:6.95,description:"Savoiardi biscuits soaked in Espresso Coffee, layered with Whipped Mascarpone Cheese cream & Cocoa Powder. This is a MUST!"}]},{name:"Drinks",items:[{name:"San Pellegrino Melograno & Arancia",priceGbp:2.65,description:null},{name:"San Pellegrino Aranciata",priceGbp:2.65,description:null},{name:"San Pellegrino Limonata",priceGbp:2.65,description:null},{name:"Irn-Bru",priceGbp:1.95,description:null},{name:"Sparkling Water 500ml",priceGbp:1.55,description:null},{name:"COKE",priceGbp:1.95,description:null},{name:"DIET COKE",priceGbp:1.95,description:"DIET COKE"},{name:"DIET IRNBRU",priceGbp:1.95,description:"DIET IRNBRU"},{name:"IRN-BRU",priceGbp:1.95,description:"IRN-BRU"},{name:"STILL WATER 500ML",priceGbp:1.55,description:"STILL WATER 500ML"}]},{name:"Extras",items:[{name:"Italian crisps San Carlo",priceGbp:1.5,description:"Wavey plain salted or tomato flavoured Italian crisps. Leave us a comment of which you prefer!"}]}]}}],orderingEnabled:!1,orderable:!1,currentMenuConfirmed:!1,needsConfirmation:!0,status:"published-reference-to-confirm"}},drunkencoo:{venueId:"drunkencoo",databaseSlug:"drunkencoo",urlSlug:"drunkencoo",uuidReserved:"f500ef12-b405-438b-9671-e54289bec5dd",name:"The Drunken Coo",address:"22 Beresford Terrace, Ayr KA7 2EG",phone:"01292 892570",email:"thedrunkencoo@yahoo.com",website:"https://www.thedrunkencoo.com/",branding:{accent:"#DFB15B",ink:"#000000",hasLogo:!0,logo:"assets/brand/drunkencoo.png",hero:"assets/brand/drunkencoo-hero.png",smallTextAccent:"#DFB15B",onAccent:"#0B0B0B"},hours:{status:"published-split-sessions",days:{},sessionsByDay:{0:[["09:00","14:00"],["16:00","20:45"]],1:[["09:00","14:00"],["16:00","20:45"]],2:[["09:00","14:00"],["16:00","20:45"]],3:[["09:00","14:00"],["16:00","20:45"]],4:[["09:00","14:00"],["16:00","20:45"]],5:[["09:00","14:00"],["16:00","20:45"]],6:[["09:00","14:00"],["16:00","20:45"]]},needsConfirmation:!0,note:"Published every day 09:00\u201314:00 and 16:00\u201320:45. The 14:00\u201316:00 break is not open. Holiday exceptions and last orders to confirm."},kitchenSessionsByDay:null,booking:{mode:"in-app-manager-request",nativeDiary:!0,nativeRequests:!0,automaticConfirmation:!1,requiresManager:!0,managerReady:!1,setupGates:["authorised manager","confirmed kitchen hours"],fields:["date","time","Covers","name","phone","email","notes"],requiresConfirmedKitchenHours:!0,sendMessages:!1},deposit:{on:!1,amount:null,perPersonPence:null,fromParty:null,policy:null,needsConfirmation:!0},features:{takeaway:!1,delivery:!1,payments:!1,loyalty:!1,orderAtTable:!1,hotel:!1,directOrdering:!1},clockArea:{on:!0,lat:55.4570308,lng:-4.6294663,radius:150,offRotaPrompt:!1,source:"Public FSA establishment 1842856; exact name/address match"},gatesToConfirm:["authorised manager and staff","takeaway fulfilment","booking terms","allergens and cross-contact","serving sizes and price/portion mapping","table plan and Covers","asset reuse permissions","last orders and holiday exceptions","deposit terms"],menuServiceContext:"Published dine-in prices only; takeaway prices and fulfilment unconfirmed",allergenCaveat:"GFO means adaptation may be possible; not a gluten-free-by-default or coeliac-safe guarantee. Cross-contact matrix unknown.",emailNeedsConfirmation:null,questionnaire:{version:1,venueId:"drunkencoo",source:"from-config",submittedAt:"2026-11-06",venue:{name:"The Drunken Coo",tagline:"All Day Kitchen & Steakhouse",address:"22 Beresford Terrace, Ayr KA7 2EG",phone:"01292 892570",email:"thedrunkencoo@yahoo.com",website:"https://www.thedrunkencoo.com/",hasLogo:!0},hours:{days:{},note:"Published every day 09:00\u201314:00 and 16:00\u201320:45. The 14:00\u201316:00 break is not open. Holiday exceptions and last orders to confirm.",needsConfirmation:!0,sessionsByDay:{0:[["09:00","14:00"],["16:00","20:45"]],1:[["09:00","14:00"],["16:00","20:45"]],2:[["09:00","14:00"],["16:00","20:45"]],3:[["09:00","14:00"],["16:00","20:45"]],4:[["09:00","14:00"],["16:00","20:45"]],5:[["09:00","14:00"],["16:00","20:45"]],6:[["09:00","14:00"],["16:00","20:45"]]}},tables:{template:"custom",tables:null,covers:null,areas:[],needsConfirmation:!0},team:[],suppliers:[],accounts:[],features:{bookings:!0,takeaway:!1,orderAtTable:!1,tips:!1,rota:!1,games:!1,specials:!1},notes:"Separate drunkencoo tenant. Both published daily sessions retained with the 14:00\u201316:00 break. In-app manager-confirmed table requests only; no automatic confirmation. Deposit unknown/null and charging off. Direct ordering, takeaway, delivery, loyalty and payments off. No staff or pay settings. Dine-in reference menu only; allergens, serving sizes, fulfilment, capacity, booking terms and asset permissions to confirm."},menu:{venueId:"drunkencoo",venueName:"The Drunken Coo",timezone:"Europe/London",currency:"GBP",serviceContext:"Published dine-in menus; not verified as takeaway prices",notes:["Visual transcription of all 12 pages of the four official PDFs linked from the venue home page; PDF text extraction is empty because lettering is outlined/image-based. Original PDFs and rendered pages retained in raw/.","Capitalisation and punctuation regularised to British English; no missing dietary tags inferred. GFO means an adaptation may be offered, NOT gluten-free by default or coeliac-safe. V and GF retained only as printed.","Not a live ordering feed. Availability, exact modifiers, portion mappings, operational hours, allergens and commercial-use permission require venue sign-off.","Sunday roast sharer board is P.O.A.; lobster with a grill dish is market rate and requires 3 days\u2019 advance order. Unknown prices remain null.","Drinks serving-size ambiguities and one apparent port-origin typo are preserved and flagged in category notes.","Chef Maria occurs in the published dessert name only; it is not evidence of a staff member to seed."],dietaryLegend:{GFO:"Gluten-free option/adaptation; brunch PDF states all dishes can be adapted to gluten-free and asks guests to make their server aware when ordering.",V:"V marker as printed; no detailed allergen matrix published.",GF:"GF marker printed on Peroni Nastro Azzurro."},categories:[{id:"evening-nibbles-to-begin",name:"Nibbles to begin",menu:"evening",items:[{name:"In-house baked focaccia bread",description:"Chef\u2019s freshly churned butter; dipping chutney",price:6,priceLabel:"\xa36.00",dietaryTags:["GFO"],dietaryTagsPublished:!0,allergens:null,options:null},{name:"Hot wok-fried edamame beans",description:"Add fresh chilli, dark soy & confit garlic \xa33",price:6,priceLabel:"\xa36.00",dietaryTags:["GFO"],dietaryTagsPublished:!0,allergens:null,options:[{name:"Fresh chilli, dark soy & confit garlic supplement",price:3,priceLabel:"\xa33.00"}]}],itemCount:2},{id:"evening-starters",name:"Starters",menu:"evening",items:[{name:"Classic Cullen skink velout\xe9",description:"Potato velout\xe9; smoked haddock; bay leeks; chive oil; crispy onions; sourdough bread",price:12,priceLabel:"\xa312.00",dietaryTags:["GFO"],dietaryTagsPublished:!0,allergens:null,options:null},{name:"Pan-seared Gressingham duck crown",description:"Parsnip pur\xe9e; local beetroots; wilted fennel; blackberry gel",price:15,priceLabel:"\xa315.00",dietaryTags:["GFO"],dietaryTagsPublished:!0,allergens:null,options:null},{name:"Slow-braised Ayrshire beef cheek risotto",description:"Parmesan; broad beans; wild mushrooms; truffle root crisps",price:14,priceLabel:"\xa314.00",dietaryTags:["GFO"],dietaryTagsPublished:!0,allergens:null,options:null},{name:"Pan-seared hand-dived Isle of Mull scallops",description:"Black pudding pur\xe9e; cider emulsion; dry-cured ham tuile; heritage carrot",price:17,priceLabel:"\xa317.00",dietaryTags:["GFO"],dietaryTagsPublished:!0,allergens:null,options:null},{name:"Pumpkin, Champagne & thyme gnocchi",description:"Candied pine nuts; gremolata; arugula; crumbled feta",price:13,priceLabel:"\xa313.00",dietaryTags:["GFO","V"],dietaryTagsPublished:!0,allergens:null,options:null},{name:"Drunken Coo mini surf & turf",description:"Toffee, chilli & ras el hanout pork belly; west coast native lobster; malt whisky demi",price:18,priceLabel:"\xa318.00",dietaryTags:["GFO"],dietaryTagsPublished:!0,allergens:null,options:null}],itemCount:6},{id:"evening-mains",name:"Mains",menu:"evening",items:[{name:"Pan-seared seabass fillet & king prawn tempura",description:"Saut\xe9ed baby potatoes; chorizo; sea herbs; chilli citrus butter",price:25,priceLabel:"\xa325.00",dietaryTags:["GFO"],dietaryTagsPublished:!0,allergens:null,options:null},{name:"Chargrilled venison tomahawk duo",description:"Pomme Anna; wild mushrooms; pickled beetroot; venison jus",price:35,priceLabel:"\xa335.00",dietaryTags:["GFO"],dietaryTagsPublished:!0,allergens:null,options:null},{name:"Soy & honey-glazed Gressingham duck breast",description:"Oriental pak choi; baked sweet potato; sesame seeds; five spice & redcurrant jus",price:28,priceLabel:"\xa328.00",dietaryTags:["GFO"],dietaryTagsPublished:!0,allergens:null,options:null},{name:"12hr braised Ayrshire short rib of beef",description:"Black garlic pomme pur\xe9e; heritage carrot; Romanesco; beef reduction; crispy onions",price:27,priceLabel:"\xa327.00",dietaryTags:["GFO"],dietaryTagsPublished:!0,allergens:null,options:null},{name:"9 grilled Troon Bay langoustines salad",description:"Chef\u2019s tossed salad leaf; baby boiled potatoes; house dressing",price:38,priceLabel:"\xa338.00",dietaryTags:["GFO"],dietaryTagsPublished:!0,allergens:null,options:null},{name:"Pumpkin, pimento peppers & sage risotto",description:"Asparagus; aged Parmesan; baby spinach",price:23,priceLabel:"\xa323.00",dietaryTags:["GFO"],dietaryTagsPublished:!0,allergens:null,options:null}],itemCount:6},{id:"evening-burgers",name:"Burgers",menu:"evening",items:[{name:"Highland venison burger",description:"Caramelised onion; Parma ham; Arran cheddar",price:23,priceLabel:"\xa323.00",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Scottish Wagyu beef burger",description:"Maple-glazed bacon; aioli; smoked Applewood cheese",price:26,priceLabel:"\xa326.00",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Blackened Cajun-spiced chicken breast burger",description:"Chilli jam; mozzarella cheese; crispy shallots",price:20,priceLabel:"\xa320.00",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Beetroot & halloumi burger",description:"Miso & wasabi mayo; pineapple & chilli salsa",price:18,priceLabel:"\xa318.00",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null}],note:"Served with cos leaf, skinny fries, beef tomato and a duo of onion rings.",itemCount:4},{id:"evening-sunday-roast-sharer-board",name:"Sunday roast sharer board",menu:"evening",items:[{name:"Sunday roast sharer board",description:"10 classic sides \u2013 P.O.A.",price:null,priceLabel:"P.O.A.",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null,priceUnknown:!0}],itemCount:1},{id:"evening-sides",name:"Sides",menu:"evening",items:[{name:"Autumn mixed-leaf tossed salad with house dressing",description:null,price:6,priceLabel:"\xa36.00",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Mature Arran cheddar cheese macaroni",description:"Add native fresh lobster \xa310 supplement",price:6,priceLabel:"\xa36.00",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:[{name:"Native fresh lobster supplement",price:10,priceLabel:"\xa310.00"}]},{name:"Battered onion rings",description:"Add salt & chilli \xa31",price:6,priceLabel:"\xa36.00",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:[{name:"Salt & chilli supplement",price:1,priceLabel:"\xa31.00"}]},{name:"Trio of Troon Bay langoustines with spicy Coo butter",description:null,price:18,priceLabel:"\xa318.00",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Confit garlic & parsley mushrooms",description:null,price:7,priceLabel:"\xa37.00",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Wagyu beef rag\xf9, mezzi rigatoni & Parmesan crust",description:null,price:8,priceLabel:"\xa38.00",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Chef\u2019s hand-cut chips",description:"Add black truffle aioli \xa32",price:7,priceLabel:"\xa37.00",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:[{name:"Black truffle aioli supplement",price:2,priceLabel:"\xa32.00"}]},{name:"Chilli & Parmesan skinny French fries",description:null,price:7,priceLabel:"\xa37.00",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Balsamic-roasted cherry vine tomatoes",description:null,price:4,priceLabel:"\xa34.00",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Chef\u2019s seasonal vegetable panach\xe9",description:null,price:7,priceLabel:"\xa37.00",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Roast garlic & parsley jumbo king prawns",description:null,price:9,priceLabel:"\xa39.00",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Buttery cheese & onion mash potato",description:null,price:6,priceLabel:"\xa36.00",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null}],itemCount:12},{id:"evening-sauces",name:"Sauces",menu:"evening",items:[{name:"Creamy pink peppercorn",description:null,price:5,priceLabel:"\xa35.00",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Confit garlic & parsley butter",description:null,price:5,priceLabel:"\xa35.00",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Classic steak Diane sauce",description:null,price:5,priceLabel:"\xa35.00",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Rich Roquefort blue cheese cream",description:null,price:5,priceLabel:"\xa35.00",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Chef\u2019s chimichurri",description:null,price:5,priceLabel:"\xa35.00",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Spicy cowboy butter",description:null,price:5,priceLabel:"\xa35.00",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null}],itemCount:6},{id:"evening-sweets",name:"Sweets",menu:"evening",items:[{name:"Caramelised pineapple tarte Tatin",description:"Golden pineapple; coconut & lemongrass ice cream",price:13,priceLabel:"\xa313.00",dietaryTags:["GFO"],dietaryTagsPublished:!0,allergens:null,options:null},{name:"Chef Maria\u2019s tropical blossom",description:"Mango; passion fruit; toasted coconut crumble; blackberry ice cream",price:13,priceLabel:"\xa313.00",dietaryTags:["GFO"],dietaryTagsPublished:!0,allergens:null,options:null},{name:"Dark chocolate fondant",description:"Smoked salted butterscotch sauce; cr\xe8me fra\xeeche ice cream",price:14,priceLabel:"\xa314.00",dietaryTags:["GFO"],dietaryTagsPublished:!0,allergens:null,options:null},{name:"The Drunken Coo cheese platter",description:"Cracker selection; celery; grapes; chutney",price:17,priceLabel:"\xa317.00",dietaryTags:["GFO"],dietaryTagsPublished:!0,allergens:null,options:null},{name:"Scottish blueberries frangipane tart",description:"Blueberry & lavender compote; elderflower ice cream",price:13,priceLabel:"\xa313.00",dietaryTags:["GFO"],dietaryTagsPublished:!0,allergens:null,options:null},{name:"Madagascan vanilla seed parfait",description:"Apple & ginger gel; honeycomb tuile; caramel mousse",price:12,priceLabel:"\xa312.00",dietaryTags:["GFO"],dietaryTagsPublished:!0,allergens:null,options:null}],itemCount:6},{id:"evening-jim-nisbet-sons-sorn-mains-farm-ayrshire-collection",name:"Jim Nisbet & Sons \u2013 Sorn Mains Farm Ayrshire Collection",menu:"evening",items:[{name:"Hand-cut sirloin steak",description:"Delicate flavour, lean steak & high protein",price:null,priceLabel:null,dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:[{name:"8oz",price:44,priceLabel:"\xa344.00"},{name:"10oz",price:49,priceLabel:"\xa349.00"},{name:"16oz",price:64,priceLabel:"\xa364.00"}],priceUnknown:!1},{name:"Hand-cut rib-eye steak",description:"Buttery flavour, tender texture & greater juiciness",price:null,priceLabel:null,dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:[{name:"8oz",price:46,priceLabel:"\xa346.00"},{name:"10oz",price:54,priceLabel:"\xa354.00"},{name:"16oz",price:68,priceLabel:"\xa368.00"}],priceUnknown:!1},{name:"Hand-cut fillet steak",description:"Most tender cut, moist, lean & soft flavours",price:null,priceLabel:null,dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:[{name:"8oz",price:49,priceLabel:"\xa349.00"},{name:"10oz",price:58,priceLabel:"\xa358.00"},{name:"16oz",price:84,priceLabel:"\xa384.00"}],priceUnknown:!1},{name:"16oz T-bone steak",description:"Mixture of tender fillet & firmer-texture sirloin",price:56,priceLabel:"\xa356.00",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"18oz Chateaubriand",description:"Large centre-cut fillet of tenderloin, perfect for sharing, cooked medium/rare",price:88,priceLabel:"\xa388.00",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"The Coo\u2019s ultimate mixed grill",description:"For 1 or for sharing; a mixture for meat lovers",price:null,priceLabel:null,dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:[{name:"First printed price \u2013 portion mapping unconfirmed",price:48,priceLabel:"\xa348.00"},{name:"Second printed price \u2013 portion mapping unconfirmed",price:78,priceLabel:"\xa378.00"}],priceUnknown:!1},{name:"Gammon steak",description:"Flame-grilled & finished with a honey-glazed pineapple",price:32,priceLabel:"\xa332.00",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null}],note:"35-day matured for flavour & tenderness. All grill items served with hand-cut, triple-cooked chips and garlic confit. Lobster with a dish requires pre-order 3 days in advance, price dependent on market rate. Mixed-grill \xa348/\xa378 is printed \u201c\xa348 or \xa378\u201d with \u201cfor 1 or for sharing\u201d; the price-to-portion pairing is not explicit and is left unassigned.",itemCount:7},{id:"evening-reared-wagyu-beef",name:"Reared Wagyu beef",menu:"evening",items:[{name:"250g rosemary & black garlic Wagyu flat iron steak",description:"Full-flavoured, firmer textures & juiciness",price:63,priceLabel:"\xa363.00",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"225g Wagyu hanger steak",description:"This butchers\u2019 steak is one of the most flavoursome cuts of meat",price:61,priceLabel:"\xa361.00",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Wagyu rib-eye steak",description:"Chef\u2019s choice served medium/rare, buttery flavour, fantastic texture, juicy & heavily marbled",price:null,priceLabel:null,dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:[{name:"8oz",price:63,priceLabel:"\xa363.00"},{name:"10oz",price:75,priceLabel:"\xa375.00"}],priceUnknown:!1},{name:"Wagyu sirloin steak",description:"Flavourful top sirloin, rich & beefy; due to Wagyu genetics, lean, tender & buttery",price:null,priceLabel:null,dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:[{name:"8oz",price:67,priceLabel:"\xa367.00"},{name:"10oz",price:80,priceLabel:"\xa380.00"}],priceUnknown:!1},{name:"Wagyu centre-cut fillet",description:"Heavily marbled with fat, giving it a luxurious flavour with soft & buttery textures",price:null,priceLabel:null,dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:[{name:"6oz",price:70,priceLabel:"\xa370.00"},{name:"8oz",price:85,priceLabel:"\xa385.00"}],priceUnknown:!1},{name:"500g Wagyu Chateaubriand",description:"Ideal for sharing & served with a choice of two sauces",price:185,priceLabel:"\xa3185.00",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null}],note:"42-day mature, heavy fatty marble, extremely tender, umami-rich flavoursome steaks, hand-cut to order by the kitchen team. Same grill accompaniments as the Sorn Mains collection. Page 2 repeats the six sauces at \xa35 each; not duplicated as products here.",itemCount:6},{id:"brunch-build-your-own",name:"Build your own",menu:"brunch",items:[{name:"Build your own breakfast",description:"Choose from link sausage, scrambled egg, fried egg, poached egg, bacon, streaky bacon, steak slice, mushrooms, tomato, baked beans, fruit pudding, haggis, black pudding, potato scone, fried onions, hash brown, fried bread, pancake, sourdough toast, morning roll, stealth fries, maple syrup, pot of Nutella, Hollandaise sauce",price:null,priceLabel:null,dietaryTags:["GFO"],dietaryTagsPublished:!0,allergens:null,options:[{name:"6 items",price:9,priceLabel:"\xa39.00"},{name:"9 items",price:12.5,priceLabel:"\xa312.50"},{name:"12 items",price:16,priceLabel:"\xa316.00"},{name:"15 items",price:19.5,priceLabel:"\xa319.50"},{name:"Additional item",price:1.6,priceLabel:"\xa31.60"}],priceUnknown:!1},{name:"Single-item filled roll",description:null,price:3.5,priceLabel:"\xa33.50",dietaryTags:["GFO"],dietaryTagsPublished:!0,allergens:null,options:null},{name:"Double-item filled roll",description:null,price:4.5,priceLabel:"\xa34.50",dietaryTags:["GFO"],dietaryTagsPublished:!0,allergens:null,options:null}],note:"Section headed GFO. Breakfast choices need venue confirmation of combinations and upcharges before live ordering.",itemCount:3},{id:"brunch-house-stacks",name:"House stacks",menu:"brunch",items:[{name:"Trio of chef\u2019s in-house-made pancakes",description:null,price:7,priceLabel:"\xa37.00",dietaryTags:["GFO"],dietaryTagsPublished:!0,allergens:null,options:null},{name:"Trio of chef\u2019s hand-sliced brioche French toast",description:null,price:7,priceLabel:"\xa37.00",dietaryTags:["GFO"],dietaryTagsPublished:!0,allergens:null,options:null},{name:"Three rashers of bacon & maple syrup",description:"Published ADD option",price:7,priceLabel:"\xa37.00",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Candied granola, blueberries, lemon curd & Greek yoghurt",description:"Published ADD option",price:6,priceLabel:"\xa36.00",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"SSK theatrical saucy toppings",description:"Choose: sliced banana, crushed Oreos & Nutella chocolate sauce; Scottish strawberries, Kinder Bueno & white chocolate sauce; Dubai chocolate poached pear, kataifi pastry & pistachio sauce; cinnamon apple crumble, Biscoff custard & crumb; mixed fresh berry compote, Chantilly cream & micro mint",price:8,priceLabel:"\xa38.00",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null}],note:"Base pancakes/French toast are GFO by section heading. ADD/toppings are modifiers, not standalone fulfilment items. No separate allergen tags published for toppings.",itemCount:5},{id:"brunch-ssk-signature-specials",name:"SSK signature specials",menu:"brunch",items:[{name:"Shredded Sorn Mains Farm beef cheek",description:"Seared asparagus with peppery paprika Hollandaise",price:18,priceLabel:"\xa318.00",dietaryTags:["GFO"],dietaryTagsPublished:!0,allergens:null,options:null},{name:"Vegetarian haggis & plant-based link",description:"Ayrshire potato scone, rocket & spicy Hollandaise",price:17,priceLabel:"\xa317.00",dietaryTags:["GFO"],dietaryTagsPublished:!0,allergens:null,options:null},{name:"Coo\u2019s locally sourced smoked salmon & langoustine tails",description:"Micro watercress & citrus-smoked Hollandaise",price:18,priceLabel:"\xa318.00",dietaryTags:["GFO"],dietaryTagsPublished:!0,allergens:null,options:null},{name:"The ultimate Wagyu flat iron steak",description:"Fermented black garlic, chilli tenderstem, crispy shallots & truffle sabayon",price:23,priceLabel:"\xa323.00",dietaryTags:["GFO"],dietaryTagsPublished:!0,allergens:null,options:null}],note:"Served on toasted sourdough with a duo of poached eggs & cherry vine tomatoes. GFO from section heading; \u201cvegetarian\u201d appears in one item\u2019s name, not an independent vegan claim.",itemCount:4},{id:"brunch-eggs-on-sourdough-toast",name:"Eggs on sourdough toast",menu:"brunch",items:[{name:"Scrambled, fried or poached eggs",description:null,price:8.5,priceLabel:"\xa38.50",dietaryTags:["GFO"],dietaryTagsPublished:!0,allergens:null,options:null},{name:"Add smoked salmon",description:"Published add-on",price:6,priceLabel:"\xa36.00",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Add smashed lime & chilli avocado",description:"Published add-on",price:6,priceLabel:"\xa36.00",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null}],note:"GFO from section heading for the base dish; add-ons are not standalone fulfilment items.",itemCount:3},{id:"brunch-ssk-twist-on-eggs-benedict",name:"SSK twist on eggs Benedict",menu:"brunch",items:[{name:"Classic maple-glazed back bacon",description:null,price:10,priceLabel:"\xa310.00",dietaryTags:["GFO"],dietaryTagsPublished:!0,allergens:null,options:null},{name:"Smoked haddock fillet & wilted baby spinach",description:null,price:13,priceLabel:"\xa313.00",dietaryTags:["GFO"],dietaryTagsPublished:!0,allergens:null,options:null},{name:"Locally made black pudding & smoked streaky bacon",description:null,price:12,priceLabel:"\xa312.00",dietaryTags:["GFO"],dietaryTagsPublished:!0,allergens:null,options:null},{name:"Hand-cut, locally made square sausage & haggis",description:null,price:12,priceLabel:"\xa312.00",dietaryTags:["GFO"],dietaryTagsPublished:!0,allergens:null,options:null},{name:"Smashed chilli & lime avocado & smoky streaky bacon",description:null,price:12,priceLabel:"\xa312.00",dietaryTags:["GFO"],dietaryTagsPublished:!0,allergens:null,options:null}],note:"Served on toasted muffin with a duo of poached eggs, cherry vine tomatoes & Hollandaise sauce. GFO from section heading.",itemCount:5},{id:"brunch-kids-breakfast",name:"Kids breakfast",menu:"brunch",items:[{name:"Kids mini breakfast",description:"Choose any 4 items",price:5.5,priceLabel:"\xa35.50",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Kids brioche French toast",description:"Two slices of brioche with berries or bacon",price:5,priceLabel:"\xa35.00",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Trio of pancakes",description:"Topped with one of: banana, strawberries, blueberries, chocolate sauce, white chocolate sauce, toffee sauce, whipped cream",price:5,priceLabel:"\xa35.00",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null}],note:"Strictly under 12s.",itemCount:3},{id:"brunch-ssk-signature-house-stacks",name:"SSK signature house stacks",menu:"brunch",items:[{name:"Chef\u2019s ultimate stack",description:"Two French toast, square sausage, streaky bacon, haggis, black pudding, potato scone, hash brown, two poached eggs & chef\u2019s secret-recipe spicy maple brown sauce",price:16,priceLabel:"\xa316.00",dietaryTags:["GFO"],dietaryTagsPublished:!0,allergens:null,options:null},{name:"Chef\u2019s spicy aioli stack",description:"Two French toast, two square sausage, two potato scones, two crispy hash browns, two poached eggs & spicy chipotle aioli sauce",price:15,priceLabel:"\xa315.00",dietaryTags:["GFO"],dietaryTagsPublished:!0,allergens:null,options:null},{name:"Chef\u2019s pancake stack",description:"Trio of buttermilk pancakes, duo Stornoway black pudding, smoked streaky bacon, two potato scones, two fried free-range eggs & hot Canadian maple syrup",price:16,priceLabel:"\xa316.00",dietaryTags:["GFO"],dietaryTagsPublished:!0,allergens:null,options:null},{name:"Chef\u2019s crumpet stack",description:"Two French-toast-style cinnamon crumpets, mixed Scottish berries & fruits, candied granola, natural Greek yoghurt, white chocolate sauce, micro mint & sweet sugar syrup",price:15,priceLabel:"\xa315.00",dietaryTags:["GFO"],dietaryTagsPublished:!0,allergens:null,options:null}],note:"GFO from section heading.",itemCount:4},{id:"brunch-ultimate-loaded-skinny-fries",name:"Ultimate loaded skinny fries",menu:"brunch",items:[{name:"6oz Sorn Farm rib-eye steak",description:"Confit garlic & parsley butter, scallions, chives & crispy shallots",price:17,priceLabel:"\xa317.00",dietaryTags:["GFO"],dietaryTagsPublished:!0,allergens:null,options:null},{name:"Shredded panko chicken",description:"Chef\u2019s creamy katsu curry sauce, chives, spring onions & crispy onions",price:15,priceLabel:"\xa315.00",dietaryTags:["GFO"],dietaryTagsPublished:!0,allergens:null,options:null},{name:"Wild mushroom, white wine & herb gratin",description:"Creamy tarragon sauce, chilli pimento pearls, trio of onion",price:15,priceLabel:"\xa315.00",dietaryTags:["GFO"],dietaryTagsPublished:!0,allergens:null,options:null}],note:"GFO from section heading.",itemCount:3},{id:"brunch-ssk-house-favourite-steak-frites-breakfast-style",name:"SSK house favourite steak frites breakfast style",menu:"brunch",items:[{name:"Grilled 6oz Sorn Farm sirloin steak",description:"Duo fried free-range egg, baked beans, pot of skinny fries & rocket garnish",price:28,priceLabel:"\xa328.00",dietaryTags:["GFO"],dietaryTagsPublished:!0,allergens:null,options:null}],note:"GFO from section heading.",itemCount:1},{id:"brunch-ssk-signature-breakfast-burger",name:"SSK signature breakfast burger",menu:"brunch",items:[{name:"SSK signature breakfast burger",description:"Double 6oz Ayrshire beef burger patty, fried pancake, streaky bacon jam, potato scone, Stornoway black pudding, Arran cheddar cheese, fried egg, heritage tomato, cos lettuce, crispy shallots, brioche bun, mini hash brown bites & spiced tomato baked beans pot",price:22,priceLabel:"\xa322.00",dietaryTags:["GFO"],dietaryTagsPublished:!0,allergens:null,options:null}],note:"GFO from heading.",itemCount:1},{id:"brunch-ssk-butter-fried-sourdough-stacks",name:"SSK butter-fried sourdough stacks",menu:"brunch",items:[{name:"Twist on classic croque madame",description:"Fried egg duo, Arran cheddar cheese, Ayrshire slow-cooked ham, b\xe9chamel sauce & Parmesan cheese",price:12,priceLabel:"\xa312.00",dietaryTags:["GFO"],dietaryTagsPublished:!0,allergens:null,options:null},{name:"Red chilli & Arran cheddar cheese scrambled egg",description:"Cured prosciutto ham, arugula & herb dressing",price:13,priceLabel:"\xa313.00",dietaryTags:["GFO"],dietaryTagsPublished:!0,allergens:null,options:null},{name:"Buttery west coast native lobster tail & claw",description:"Truffle baby spinach, poached egg duo & lobster-glazed egg yolk sauce",price:18,priceLabel:"\xa318.00",dietaryTags:["GFO"],dietaryTagsPublished:!0,allergens:null,options:null},{name:"The heirloom tomato & feta cheese",description:"Poached eggs, heirloom tomatoes, basil pesto, capers & citrus aioli",price:13,priceLabel:"\xa313.00",dietaryTags:["GFO"],dietaryTagsPublished:!0,allergens:null,options:null},{name:"The all-day breakfast munch",description:"Square sausage, black pudding, haggis, potato scone, hash brown, streaky bacon, poached eggs & spicy ketchup",price:16,priceLabel:"\xa316.00",dietaryTags:["GFO"],dietaryTagsPublished:!0,allergens:null,options:null},{name:"Cheesy baked bean & sausage dream",description:"Trio of pork sausages, baked beans, cheese & spicy hash brown bites",price:13,priceLabel:"\xa313.00",dietaryTags:["GFO"],dietaryTagsPublished:!0,allergens:null,options:null},{name:"24hr slow-braised Ayrshire pig belly lardons",description:"Scottish brie, date jam, shredded cos leaf, crumbled black pudding & hot honey",price:16,priceLabel:"\xa316.00",dietaryTags:["GFO"],dietaryTagsPublished:!0,allergens:null,options:null}],note:"Served with balsamic-roasted cherry vine tomatoes. GFO from section heading.",itemCount:7},{id:"brunch-ssk-signature-house-salads",name:"SSK signature house salads",menu:"brunch",items:[{name:"Teriyaki sticky Ayrshire beef strips with peppers & onions",description:null,price:19,priceLabel:"\xa319.00",dietaryTags:["GFO"],dietaryTagsPublished:!0,allergens:null,options:null},{name:"Sweet chilli & stem ginger crispy chicken strips",description:null,price:18,priceLabel:"\xa318.00",dietaryTags:["GFO"],dietaryTagsPublished:!0,allergens:null,options:null},{name:"Smoked salmon & chilli lime avocado smash",description:null,price:17,priceLabel:"\xa317.00",dietaryTags:["GFO"],dietaryTagsPublished:!0,allergens:null,options:null},{name:"Arran cheddar cheese & pineapple salsa",description:null,price:15,priceLabel:"\xa315.00",dietaryTags:["GFO","V"],dietaryTagsPublished:!0,allergens:null,options:null}],note:"Served with leaves, slaw, honey mustard dressing, baby boiled potatoes & mixed berries. GFO from section heading; V printed only on the cheddar & pineapple dish.",itemCount:4},{id:"kids-starters",name:"Starters",menu:"kids",items:[{name:"Soup of the day & bread roll",description:null,price:5.95,priceLabel:"\xa35.95",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Home-made cheesy garlic bread",description:null,price:5.95,priceLabel:"\xa35.95",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null}],itemCount:2},{id:"kids-mains",name:"Mains",menu:"kids",items:[{name:"Battered chicken goujons & fries",description:null,price:8.95,priceLabel:"\xa38.95",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Macaroni cheese & fries",description:null,price:8.95,priceLabel:"\xa38.95",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Cheese burger & fries",description:null,price:8.95,priceLabel:"\xa38.95",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Chorizo & cheese ciabatta sliced pizza + fries",description:null,price:8.95,priceLabel:"\xa38.95",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Mini-steak, fries, onion ring, grilled tomato & peppercorn sauce",description:null,price:11.95,priceLabel:"\xa311.95",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null}],itemCount:5},{id:"kids-sweets",name:"Sweets",menu:"kids",items:[{name:"Hot chocolate fudge cake",description:null,price:5.95,priceLabel:"\xa35.95",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"2 scoops of ice cream with wafer",description:null,price:5.95,priceLabel:"\xa35.95",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null}],itemCount:2},{id:"drinks-champagne-sparkling",name:"Champagne / sparkling",menu:"drinks",items:[{name:"Pierre Mignon Grande R\xe9serve Premier Cru",description:"Champagne, France. A crisp, well-balanced Champagne with citrus hints on the nose overlaid with touches of brioche and yeastiness.",price:null,priceLabel:null,dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:[{name:"125ml",price:11.25,priceLabel:"\xa311.25"},{name:"Bottle",price:66,priceLabel:"\xa366.00"}],priceUnknown:!1},{name:"Laurent Perrier Brut, La Cuv\xe9e",description:"Champagne, France. Delicate nose with hints of fresh citrus and white flowers followed by vine peach and white fruits on the palate.",price:null,priceLabel:null,dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:[{name:"Bottle",price:77,priceLabel:"\xa377.00"}],priceUnknown:!1},{name:"Laurent Perrier Ros\xe9",description:"Champagne, France. The fashion statement in Champagne! Elegant, crisp with soft, strawberry fruit and a long creamy finish.",price:null,priceLabel:null,dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:[{name:"Bottle",price:107,priceLabel:"\xa3107.00"}],priceUnknown:!1},{name:"Bollinger La Grande Ann\xe9e, Bollinger",description:"Champagne, France. The nose is expressive and complex. On the palate, La Grande Ann\xe9e stands out due to its exceptional texture and structure.",price:null,priceLabel:null,dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:[{name:"Bottle",price:223,priceLabel:"\xa3223.00"}],priceUnknown:!1},{name:"Prosecco Spumante DOC, Pasaparola, Pradio",description:"Friuli, Italy. Delicious sparkler with aromatic pear and apple flavours, crisp palate. Perfect for any occasion.",price:null,priceLabel:null,dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:[{name:"125ml",price:7.15,priceLabel:"\xa37.15"},{name:"Bottle",price:34.95,priceLabel:"\xa334.95"}],priceUnknown:!1}],itemCount:5},{id:"drinks-white-wine",name:"White wine",menu:"drinks",items:[{name:"Sauvignon Blanc, Los Espinos",description:"Central Valley, Chile. Vibrant zesty fruit and exotic guava from a single vineyard. Refreshing, crisp and aromatic.",price:null,priceLabel:null,dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:[{name:"125ml",price:4.5,priceLabel:"\xa34.50"},{name:"175ml",price:6.2,priceLabel:"\xa36.20"},{name:"250ml",price:8.8,priceLabel:"\xa38.80"},{name:"Bottle",price:26,priceLabel:"\xa326.00"}],priceUnknown:!1},{name:"Chardonnay, IGP Haute Vall\xe9e de L\u2019Aude, Montsabl\xe9",description:"Languedoc-Roussillon, France. Fresh and quite racy with delicate notes of apricot and white peach and a crisp refreshing citrus finish.",price:null,priceLabel:null,dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:[{name:"125ml",price:4.85,priceLabel:"\xa34.85"},{name:"175ml",price:6.8,priceLabel:"\xa36.80"},{name:"250ml",price:9.65,priceLabel:"\xa39.65"},{name:"Bottle",price:28.5,priceLabel:"\xa328.50"}],priceUnknown:!1},{name:"Pinot Grigio Bio, Delle Venezie DOC",description:"Macia Novapalma Cielo e Terra, Veneto, Italy. Aromatically complex, with beautifully integrated wildflower and ripe fruit notes.",price:null,priceLabel:null,dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:[{name:"125ml",price:5.05,priceLabel:"\xa35.05"},{name:"175ml",price:7.25,priceLabel:"\xa37.25"},{name:"250ml",price:10.15,priceLabel:"\xa310.15"},{name:"Bottle",price:29.95,priceLabel:"\xa329.95"}],priceUnknown:!1},{name:"Rioja Blanco, Bodegas Luis Ca\xf1as",description:"Rioja, Spain. Fresh and elegant. Pear & apple and some tropical fruit as well as hints of bush and fig tree leaves.",price:null,priceLabel:null,dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:[{name:"125ml",price:5.65,priceLabel:"\xa35.65"},{name:"175ml",price:8,priceLabel:"\xa38.00"},{name:"250ml",price:11.15,priceLabel:"\xa311.15"},{name:"Bottle",price:33,priceLabel:"\xa333.00"}],priceUnknown:!1},{name:"Sauvignon Blanc, Mayfly",description:"Marlborough, New Zealand. The Mayfly Sauvignon combines asparagus and mature peach notes with citrus fruits and bracing natural acidity.",price:null,priceLabel:null,dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:[{name:"125ml",price:6.5,priceLabel:"\xa36.50"},{name:"175ml",price:9.05,priceLabel:"\xa39.05"},{name:"250ml",price:12.9,priceLabel:"\xa312.90"},{name:"Bottle",price:38,priceLabel:"\xa338.00"}],priceUnknown:!1},{name:"Albari\xf1o, El Camar\xf3n",description:"Galicia, Spain. Capturing the purity of Albari\xf1o, with citrus, minerality and saline notes throughout. The palate is light and fresh.",price:null,priceLabel:null,dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:[{name:"Bottle",price:41,priceLabel:"\xa341.00"}],priceUnknown:!1},{name:"M\xe2con-Fuiss\xe9, Domaine de Fussiacus",description:"Burgundy, France. A real classy Chardonnay with citrus fruits and stone minerality. Round and smooth.",price:null,priceLabel:null,dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:[{name:"Bottle",price:50,priceLabel:"\xa350.00"}],priceUnknown:!1},{name:"Sancerre Blanc, Moulin Les Lys, Domaine Reverdy Ducroux",description:"Loire, France. Crisp crunchy green apple notes on the nose as well as fresh aromatic herbs. A long finish and perfectly dry.",price:null,priceLabel:null,dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:[{name:"Bottle",price:64,priceLabel:"\xa364.00"}],priceUnknown:!1}],itemCount:8},{id:"drinks-ros-wine",name:"Ros\xe9 wine",menu:"drinks",items:[{name:"White Zinfandel, Headlands Cove",description:"California, USA. Sweet raspberries and strawberries mingled with melon are abundant in this fruity medium-sweet ros\xe9.",price:null,priceLabel:null,dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:[{name:"125ml",price:4.5,priceLabel:"\xa34.50"},{name:"175ml",price:6.2,priceLabel:"\xa36.20"},{name:"250ml",price:8.8,priceLabel:"\xa38.80"},{name:"Bottle",price:26,priceLabel:"\xa326.00"}],priceUnknown:!1},{name:"Pinot Grigio Ros\xe9, DOC, Casa Defra",description:"Veneto, Italy. Delicate yet lively nose of fresh raspberries and wild strawberries, crisp, light and fragrant on the palate.",price:null,priceLabel:null,dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:[{name:"125ml",price:4.5,priceLabel:"\xa34.50"},{name:"175ml",price:6.2,priceLabel:"\xa36.20"},{name:"250ml",price:8.8,priceLabel:"\xa38.80"},{name:"Bottle",price:26,priceLabel:"\xa326.00"}],priceUnknown:!1},{name:"Pinot Noir Rosapasso, Biscardo",description:"Veneto, Italy. A brilliant ros\xe9 colour, the bouquet of elegant wild strawberry and cherry lead onto a fresh and harmonious palate.",price:null,priceLabel:null,dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:[{name:"125ml",price:5.65,priceLabel:"\xa35.65"},{name:"175ml",price:8.1,priceLabel:"\xa38.10"},{name:"250ml",price:11.3,priceLabel:"\xa311.30"},{name:"Bottle",price:33,priceLabel:"\xa333.00"}],priceUnknown:!1}],itemCount:3},{id:"drinks-red-wine",name:"Red wine",menu:"drinks",items:[{name:"Merlot Reserva, Los Espinos",description:"Central Valley, Chile. An easy-drinking Merlot with soft plum and black cherry notes. Very approachable, soft, super juicy.",price:null,priceLabel:null,dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:[{name:"125ml",price:4.5,priceLabel:"\xa34.50"},{name:"175ml",price:6.2,priceLabel:"\xa36.20"},{name:"250ml",price:8.8,priceLabel:"\xa38.80"},{name:"Bottle",price:26,priceLabel:"\xa326.00"}],priceUnknown:!1},{name:"Malbec, Man Meets Mountain",description:"Mendoza, Argentina. A harmonious Malbec, packed full of blueberry, blackcurrant and plum and a complex and delicious finish.",price:null,priceLabel:null,dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:[{name:"125ml",price:5.2,priceLabel:"\xa35.20"},{name:"175ml",price:7.55,priceLabel:"\xa37.55"},{name:"250ml",price:10.65,priceLabel:"\xa310.65"},{name:"Bottle",price:31,priceLabel:"\xa331.00"}],priceUnknown:!1},{name:"Electric Bee, IGT, Produttori Di Manduria",description:"Puglia, Italy. This beautifully crafted wine has an aroma of ripe cherry, plum and blackberry, yet retains a delicate freshness.",price:null,priceLabel:null,dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:[{name:"125ml",price:5.4,priceLabel:"\xa35.40"},{name:"175ml",price:7.85,priceLabel:"\xa37.85"},{name:"250ml",price:11.05,priceLabel:"\xa311.05"},{name:"Bottle",price:32,priceLabel:"\xa332.00"}],priceUnknown:!1},{name:"Rioja Crianza, 1890 Finca Manzanos, Bodegas Manzanos",description:"Rioja, Spain. Fresh, fruity and well balanced with sensations of raspberries, vanilla and cinnamon.",price:null,priceLabel:null,dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:[{name:"125ml",price:5.85,priceLabel:"\xa35.85"},{name:"175ml",price:8.65,priceLabel:"\xa38.65"},{name:"250ml",price:11.95,priceLabel:"\xa311.95"},{name:"Bottle",price:34,priceLabel:"\xa334.00"}],priceUnknown:!1},{name:"Nero D\u2019Avola\u2013Frappato U. Passimiento DOC",description:"Baglio Gibellina, Sicily, Italy. Made from partially dried grapes. A truly harmonious wine full of bright red fruits and warming palate.",price:null,priceLabel:null,dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:[{name:"125ml",price:5.85,priceLabel:"\xa35.85"},{name:"175ml",price:8.65,priceLabel:"\xa38.65"},{name:"250ml",price:11.95,priceLabel:"\xa311.95"},{name:"Bottle",price:34,priceLabel:"\xa334.00"}],priceUnknown:!1},{name:"Reserve Pinot Noir, IGP Haute Vall\xe9e de L\u2019Aude, Terres Fid\xe8les",description:"Roussillon, France. Dark cherry and blackberry plus a rich, round palate of red berry fruit complemented by toasty, vanilla notes.",price:null,priceLabel:null,dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:[{name:"125ml",price:6.3,priceLabel:"\xa36.30"},{name:"175ml",price:8.75,priceLabel:"\xa38.75"},{name:"250ml",price:12.6,priceLabel:"\xa312.60"},{name:"Bottle",price:37,priceLabel:"\xa337.00"}],priceUnknown:!1},{name:"Ribera del Duero, Finca Resalso, Bodegas Emilio Moro",description:"Castilla y Le\xf3n, Spain. Extraordinarily expressive and fresh, with the unique characteristics of the Tempranillo variety.",price:null,priceLabel:null,dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:[{name:"Bottle",price:39,priceLabel:"\xa339.00"}],priceUnknown:!1},{name:"Toscana, IGT, Monte Antico",description:"Tuscany, Italy. This super Tuscan has an elegant bouquet of leather, black cherries, liquorice and plums.",price:null,priceLabel:null,dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:[{name:"Bottle",price:38,priceLabel:"\xa338.00"}],priceUnknown:!1},{name:"Malbec, Felino, Vi\xf1a Cobos",description:"Mendoza, Argentina. Powerful and firmly structured, packed with layers and layers of fruit. Fine-grained tannins and a moreish fruity finish.",price:null,priceLabel:null,dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:[{name:"Bottle",price:44.5,priceLabel:"\xa344.50"}],priceUnknown:!1},{name:"Cunning Plan Shiraz, McLaren Vale, Thistledown",description:"South Australia, Australia. Great depth of ripe plum and blackberry flavours, full-bodied with lively spices and velvety tannins.",price:null,priceLabel:null,dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:[{name:"Bottle",price:48,priceLabel:"\xa348.00"}],priceUnknown:!1}],itemCount:10},{id:"drinks-red-wine-continued",name:"Red wine continued",menu:"drinks",items:[{name:"Cabernet Sauvignon, Stella Bella",description:"Margaret River, Australia. Vibrant raspberries, cherry fruits and hints of fresh cranberry are complemented by savoury forest floor, earthy notes.",price:null,priceLabel:null,dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:[{name:"Bottle",price:60,priceLabel:"\xa360.00"}],priceUnknown:!1},{name:"Chianti Classico, DOCG, Riecine",description:"Tuscany, Italy. Succulent, red fruit with fine, powerful tannins. This Sangiovese has taken on a Pinot Noir-like guise.",price:null,priceLabel:null,dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:[{name:"Bottle",price:68,priceLabel:"\xa368.00"}],priceUnknown:!1},{name:"Haut Medoc, Ch\xe2teau Lamothe-Cissac",description:"Bordeaux, France. A traditional style of Bordeaux that has great elegance and savoury fruit in abundance. A superb vintage.",price:null,priceLabel:null,dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:[{name:"Magnum",price:110,priceLabel:"\xa3110.00"}],priceUnknown:!1},{name:"Ch\xe2teau La Tour Baladoz",description:"Bordeaux, France. Dense purple-black with a nose of intense earthy black fruit, crushed and creamed, tactile with a tightly soured black fruit note.",price:null,priceLabel:null,dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:[{name:"Bottle",price:92,priceLabel:"\xa392.00"}],priceUnknown:!1},{name:"Gran Reserva, Bodegas Luis Ca\xf1as",description:"Rioja, Spain. Elegant and complex, aromas of thyme, rosemary, tobacco and leather. Sweet fruit, rounded palate, balanced and warm.",price:null,priceLabel:null,dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:[{name:"Bottle",price:100,priceLabel:"\xa3100.00"}],priceUnknown:!1}],itemCount:5},{id:"drinks-fortified-wine",name:"Fortified wine",menu:"drinks",items:[{name:"Fine Ruby Port, Delaforce",description:"Douro, Portugal. Smooth, silky, deliciously fresh sweet raspberry fruit flavours on the palate.",price:null,priceLabel:null,dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:[{name:"50ml",price:5,priceLabel:"\xa35.00"}],priceUnknown:!1},{name:"His Eminence\u2019s Choice, 10 Year Old Tawny Port, Delaforce",description:"Margaret River, Australia as printed (apparent source inconsistency; do not silently correct). A sumptuous and rich tawny port combines ripe jam fruit with elegant wood ageing.",price:null,priceLabel:null,dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:[{name:"50ml",price:6.5,priceLabel:"\xa36.50"}],priceUnknown:!1}],itemCount:2},{id:"drinks-hot-drinks",name:"Hot drinks",menu:"drinks",items:[{name:"Espresso",description:"Small & intense",price:2.45,priceLabel:"\xa32.45",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Double espresso",description:"Large & intense",price:3.25,priceLabel:"\xa33.25",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Macchiato",description:"Espresso stained with steamed milk",price:2.75,priceLabel:"\xa32.75",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Americano",description:"Double espresso topped with hot water",price:3.45,priceLabel:"\xa33.45",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Brown",description:"Americano topped with steamed milk",price:3.45,priceLabel:"\xa33.45",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Flat white",description:"Double espresso with steamed milk",price:3.45,priceLabel:"\xa33.45",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Latte",description:"Single espresso with steamed milk with a foamed milk top",price:3.25,priceLabel:"\xa33.25",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Cappuccino",description:"Double espresso served with equal amounts of steamed & foamed milk dusted with chocolate",price:3.45,priceLabel:"\xa33.45",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Mocha",description:"Double espresso with chocolate & steamed milk, dusted with chocolate",price:3.45,priceLabel:"\xa33.45",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Hot chocolate",description:"Chocolate blended together with steamed milk",price:3.45,priceLabel:"\xa33.45",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Coo\u2019s luxury hot chocolate",description:"With added marshmallows & whipped cream",price:3.95,priceLabel:"\xa33.95",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Add syrup",description:"Vanilla, caramel, hazelnut, amaretto or toffee nut",price:.5,priceLabel:"\xa30.50",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Extra shot",description:null,price:.8,priceLabel:"\xa30.80",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Everyday brew",description:null,price:2.95,priceLabel:"\xa32.95",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Flavoured teas",description:"Peppermint, Earl Grey, green or chamomile",price:2.95,priceLabel:"\xa32.95",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Irish",description:"Irish whiskey topped with black coffee & hand-whipped cream",price:6.95,priceLabel:"\xa36.95",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Gaelic",description:"Malt whiskey with black coffee & hand-whipped cream",price:6.95,priceLabel:"\xa36.95",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Irish cream",description:"Baileys topped with black coffee & hand-whipped cream",price:6.95,priceLabel:"\xa36.95",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Royal",description:"Martell VS with black coffee & hand-whipped cream",price:6.95,priceLabel:"\xa36.95",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null}],note:"Semi-skimmed milk is used as standard in all hot drinks. Ask your server for dairy alternatives.",itemCount:19},{id:"drinks-on-draught",name:"On draught",menu:"drinks",items:[{name:"Cruzcampo",description:"Spain, 4.4%",price:null,priceLabel:null,dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:[{name:"First printed price \u2013 half-pint/pint mapping unconfirmed",price:2.95,priceLabel:"\xa32.95"},{name:"Second printed price \u2013 half-pint/pint mapping unconfirmed",price:5.95,priceLabel:"\xa35.95"}],priceUnknown:!1},{name:"Inch\u2019s Cider",description:"England, 4.5%",price:null,priceLabel:null,dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:[{name:"First printed price \u2013 half-pint/pint mapping unconfirmed",price:3.1,priceLabel:"\xa33.10"},{name:"Second printed price \u2013 half-pint/pint mapping unconfirmed",price:5.95,priceLabel:"\xa35.95"}],priceUnknown:!1},{name:"Moretti Sale Di Mare",description:"Italy, 4.8%",price:null,priceLabel:null,dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:[{name:"First printed price \u2013 half-pint/pint mapping unconfirmed",price:3.75,priceLabel:"\xa33.75"},{name:"Second printed price \u2013 half-pint/pint mapping unconfirmed",price:7.5,priceLabel:"\xa37.50"}],priceUnknown:!1},{name:"Heineken Zero",description:"Netherlands, 0.0%",price:null,priceLabel:null,dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:[{name:"First printed price \u2013 half-pint/pint mapping unconfirmed",price:2.5,priceLabel:"\xa32.50"},{name:"Second printed price \u2013 half-pint/pint mapping unconfirmed",price:5,priceLabel:"\xa35.00"}],priceUnknown:!1}],note:"Source says served as pints or half pints but has no size column headings. Both published prices retained without guessing which is which; confirm before live ordering.",itemCount:4},{id:"drinks-by-the-bottle",name:"By the bottle",menu:"drinks",items:[{name:"Madri",description:"Spanish, 4.6%, 330ml",price:4.25,priceLabel:"\xa34.25",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Moretti",description:"Italy, 4.6%",price:4.25,priceLabel:"\xa34.25",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Peroni Nastro Azzurro",description:"Italian, 5%",price:4.25,priceLabel:"\xa34.25",dietaryTags:["GF"],dietaryTagsPublished:!0,allergens:null,options:null},{name:"Old Mout fruit ciders",description:"New Zealand, 4%; flavours as stocked",price:5.35,priceLabel:"\xa35.35",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Old Mout non-alcoholic",description:"New Zealand, 0%",price:4.35,priceLabel:"\xa34.35",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null}],itemCount:5},{id:"drinks-house-spirits",name:"House spirits",menu:"drinks",items:[{name:"Absolut vodka",description:"Sweden, 40%",price:3.95,priceLabel:"\xa33.95",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Tanqueray",description:"England, 47.3%",price:3.95,priceLabel:"\xa33.95",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Puerto de Indias strawberry",description:"Spain, 37.5%",price:3.95,priceLabel:"\xa33.95",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Bacardi Carta Blanca",description:"Cuba, 40%",price:3.95,priceLabel:"\xa33.95",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Captain Morgan spiced",description:"Puerto Rico, 35%",price:3.95,priceLabel:"\xa33.95",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Famous Grouse",description:"Scotland, 40%",price:3.95,priceLabel:"\xa33.95",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Jack Daniels",description:"America, 40%",price:3.95,priceLabel:"\xa33.95",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null}],note:"Served as 25ml measures; mixers not stated as included.",itemCount:7},{id:"drinks-gin",name:"Gin",menu:"drinks",items:[{name:"Whitley Neill gin",description:"41.3%\u201343%",price:4.7,priceLabel:"\xa34.70",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Bombay Sapphire",description:"Hampshire, 40%",price:4.7,priceLabel:"\xa34.70",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Brockmans",description:"London, 40%",price:4.7,priceLabel:"\xa34.70",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Caorunn",description:"Speyside, 40%",price:4.7,priceLabel:"\xa34.70",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Botanist",description:"Islay, 46%",price:4.95,priceLabel:"\xa34.95",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Hendricks",description:"Girvan, 41.4%",price:4.7,priceLabel:"\xa34.70",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Tanqueray No.10",description:"London, 47.3%",price:5.2,priceLabel:"\xa35.20",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null}],note:"Measure not separately repeated under heading; do not infer mixers or double prices.",itemCount:7},{id:"drinks-vodka",name:"Vodka",menu:"drinks",items:[{name:"Absolut Citron",description:"Sweden, 40%",price:4.2,priceLabel:"\xa34.20",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Absolut Raspberri",description:"Sweden, 40%",price:4.2,priceLabel:"\xa34.20",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Absolut Vanilj",description:"Sweden, 40%",price:4.2,priceLabel:"\xa34.20",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Grey Goose",description:"France, 40%",price:4.95,priceLabel:"\xa34.95",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Arbikie Scottish potato vodka",description:"43%",price:5.2,priceLabel:"\xa35.20",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null}],itemCount:5},{id:"drinks-rum",name:"Rum",menu:"drinks",items:[{name:"Kraken",description:"Trinidad, 40%",price:4.45,priceLabel:"\xa34.45",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Kraken Black Cherry",description:"Trinidad, 40%",price:4.45,priceLabel:"\xa34.45",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Havana Club Especial",description:"Cuba, 40%",price:4.7,priceLabel:"\xa34.70",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Havana Club 7",description:"Cuba, 40%",price:4.95,priceLabel:"\xa34.95",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Appletons 8 Year Old",description:null,price:4.7,priceLabel:"\xa34.70",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Appletons Estate Signature Blend",description:null,price:4.7,priceLabel:"\xa34.70",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Langs",description:"Guatemala, 37.5%. Pineapple, mango & ginger, or banana",price:4.45,priceLabel:"\xa34.45",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Ron Zacapa XO",description:"Guatemala, 40%. Subject to availability",price:13.4,priceLabel:"\xa313.40",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null}],itemCount:8},{id:"drinks-tequila-mezcal",name:"Tequila & mezcal",menu:"drinks",items:[{name:"Ocho",description:"40%",price:4.45,priceLabel:"\xa34.45",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Ojo de Tigre",description:"37%",price:4.45,priceLabel:"\xa34.45",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Don Julio Reposado",description:"Mexico, 38%",price:6.65,priceLabel:"\xa36.65",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null}],itemCount:3},{id:"drinks-blends",name:"Blends",menu:"drinks",items:[{name:"Johnnie Walker Black Label",description:"40%",price:4.4,priceLabel:"\xa34.40",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Monkey Shoulder",description:"40%",price:4.7,priceLabel:"\xa34.70",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Johnnie Walker Blue Label",description:"40%. Subject to availability",price:22.4,priceLabel:"\xa322.40",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null}],itemCount:3},{id:"drinks-malts",name:"Malts",menu:"drinks",items:[{name:"Aberlour",description:"12 y.o., 40%",price:5.4,priceLabel:"\xa35.40",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Bowmore",description:"12 y.o., 40%",price:6.2,priceLabel:"\xa36.20",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Bunnahabhain",description:"12 y.o., 46.3%",price:5.9,priceLabel:"\xa35.90",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Glenfiddich",description:"12 y.o., 40%",price:6.4,priceLabel:"\xa36.40",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Glenkinchie",description:"12 y.o., 43%",price:5.4,priceLabel:"\xa35.40",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Glenmorangie",description:"10 y.o., 40%",price:6.4,priceLabel:"\xa36.40",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Highland Park",description:"12 y.o., 40%",price:5.4,priceLabel:"\xa35.40",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Jura",description:"10 y.o., 40%",price:5.2,priceLabel:"\xa35.20",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Laphroaig",description:"10 y.o., 40%",price:5.4,priceLabel:"\xa35.40",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Talisker Skye",description:"45.8%",price:5.4,priceLabel:"\xa35.40",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Tamnavulin",description:"40%",price:5.4,priceLabel:"\xa35.40",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Glenlivet",description:"18 y.o., 40%",price:12.1,priceLabel:"\xa312.10",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Glengoyne",description:"40%\u201343%",price:null,priceLabel:null,dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:[{name:"10 y.o.",price:5.7,priceLabel:"\xa35.70"},{name:"12 y.o.",price:6.95,priceLabel:"\xa36.95"},{name:"21 y.o.",price:24.1,priceLabel:"\xa324.10"}],priceUnknown:!1},{name:"Lochlea",description:"46%",price:5.2,priceLabel:"\xa35.20",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null}],itemCount:14},{id:"drinks-world-whiskey",name:"World whiskey",menu:"drinks",items:[{name:"Jameson",description:"Ireland, 40%",price:4.4,priceLabel:"\xa34.40",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Woodford Reserve",description:"America, 43.2%",price:5.4,priceLabel:"\xa35.40",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Woodford Rye",description:"America, 45.2%",price:5.7,priceLabel:"\xa35.70",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Maker\u2019s Mark",description:"Kentucky, 45%",price:4.7,priceLabel:"\xa34.70",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Maker\u2019s Mark 46",description:"Kentucky, 47%",price:5.95,priceLabel:"\xa35.95",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null}],itemCount:5},{id:"drinks-liqueur",name:"Liqueur",menu:"drinks",items:[{name:"Midori",description:"20%",price:3.95,priceLabel:"\xa33.95",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Grand Marnier",description:"40%",price:4.4,priceLabel:"\xa34.40",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Teichenne Schnapps",description:"17%. Apple, peach, vanilla, raspberry or butterscotch",price:3.95,priceLabel:"\xa33.95",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Southern Comfort",description:"35%",price:3.95,priceLabel:"\xa33.95",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Aperol",description:"11%",price:4.4,priceLabel:"\xa34.40",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Campari",description:"25%",price:4.4,priceLabel:"\xa34.40",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Chambord",description:"16.5%",price:4.4,priceLabel:"\xa34.40",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Cointreau",description:"40%",price:4.4,priceLabel:"\xa34.40",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Limoncello",description:"30%",price:4.4,priceLabel:"\xa34.40",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Kahlua",description:"18%",price:4.4,priceLabel:"\xa34.40",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Samoa",description:"17%",price:4.4,priceLabel:"\xa34.40",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Baileys",description:"17%; served as 50ml",price:4.7,priceLabel:"\xa34.70",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Drambuie",description:"40%",price:4.7,priceLabel:"\xa34.70",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Disaronno",description:"28%",price:4.7,priceLabel:"\xa34.70",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Glayva",description:"35%",price:4.7,priceLabel:"\xa34.70",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null}],itemCount:15},{id:"drinks-cognac",name:"Cognac",menu:"drinks",items:[{name:"Martell VS",description:"40%",price:4.7,priceLabel:"\xa34.70",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Boulard VSOP Calvados",description:"40%",price:5.2,priceLabel:"\xa35.20",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"R\xe9my Martin VSOP",description:"40%",price:5.7,priceLabel:"\xa35.70",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Hennessy XO",description:"40%",price:18.4,priceLabel:"\xa318.40",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null}],note:"Calvados is printed within this heading; classification retained from source, not asserted as Cognac.",itemCount:4},{id:"drinks-soft-drinks",name:"Soft drinks",menu:"drinks",items:[{name:"Strathmore spring still water",description:"750ml",price:4.95,priceLabel:"\xa34.95",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Strathmore spring sparkling water",description:"750ml",price:4.95,priceLabel:"\xa34.95",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Appletiser",description:"275ml",price:3.7,priceLabel:"\xa33.70",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Coca-Cola Classic",description:"330ml",price:3.7,priceLabel:"\xa33.70",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Diet Coca-Cola",description:"330ml",price:3.7,priceLabel:"\xa33.70",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Coke Zero",description:"330ml",price:3.7,priceLabel:"\xa33.70",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Irn-Bru",description:"330ml",price:3.7,priceLabel:"\xa33.70",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Diet Irn-Bru",description:"330ml",price:3.7,priceLabel:"\xa33.70",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Fruit Shoot",description:"200ml",price:1.95,priceLabel:"\xa31.95",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Fanta",description:"330ml",price:3.4,priceLabel:"\xa33.40",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Fever-Tree",description:"200ml. Selected flavours available",price:2.05,priceLabel:"\xa32.05",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null}],itemCount:11},{id:"drinks-draught-drink",name:"Draught drink",menu:"drinks",items:[{name:"Pepsi Classic",description:null,price:null,priceLabel:null,dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:[{name:"First printed price \u2013 size unspecified",price:3.2,priceLabel:"\xa33.20"},{name:"Second printed price \u2013 size unspecified",price:4.2,priceLabel:"\xa34.20"}],priceUnknown:!1},{name:"Pepsi Max",description:null,price:null,priceLabel:null,dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:[{name:"First printed price \u2013 size unspecified",price:3.2,priceLabel:"\xa33.20"},{name:"Second printed price \u2013 size unspecified",price:4.2,priceLabel:"\xa34.20"}],priceUnknown:!1},{name:"Barr\u2019s Irn-Bru",description:null,price:null,priceLabel:null,dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:[{name:"First printed price \u2013 size unspecified",price:3.2,priceLabel:"\xa33.20"},{name:"Second printed price \u2013 size unspecified",price:4.2,priceLabel:"\xa34.20"}],priceUnknown:!1},{name:"Lemonade",description:null,price:null,priceLabel:null,dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:[{name:"First printed price \u2013 size unspecified",price:3.2,priceLabel:"\xa33.20"},{name:"Second printed price \u2013 size unspecified",price:4.2,priceLabel:"\xa34.20"}],priceUnknown:!1},{name:"Fresh fruit juices",description:null,price:null,priceLabel:null,dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:[{name:"First printed price \u2013 size unspecified",price:3.2,priceLabel:"\xa33.20"},{name:"Second printed price \u2013 size unspecified",price:4.2,priceLabel:"\xa34.20"}],priceUnknown:!1},{name:"Soda water",description:null,price:null,priceLabel:null,dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:[{name:"First printed price \u2013 size unspecified",price:1.75,priceLabel:"\xa31.75"},{name:"Second printed price \u2013 size unspecified",price:2.45,priceLabel:"\xa32.45"}],priceUnknown:!1}],note:"Two prices are printed without serving-size column headings. Do not invent serving sizes; confirm before ordering.",itemCount:6},{id:"drinks-coo-classics",name:"Coo classics",menu:"drinks",items:[{name:"Tiki Dreams",description:"A tropical, velvety, citrus delight",price:12.95,priceLabel:"\xa312.95",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Pornstar Mojito",description:"A vibrant refreshing twist on a crowd-pleasing classic",price:12.95,priceLabel:"\xa312.95",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Sandia En Fuego",description:"Tequila-forward with a balance of sweet watermelon and a hint of spice",price:12.95,priceLabel:"\xa312.95",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Velvet Orchard",description:"A bold combination of creamy pistachio, ripe pear, and velvety espresso",price:12.95,priceLabel:"\xa312.95",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Golden Blossom Sangria",description:"Rich, fruity, and intense",price:12.95,priceLabel:"\xa312.95",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Kiwi Hugo Spritz",description:"A crisp white sangria with delicate peach and bright lychee flavour",price:12.95,priceLabel:"\xa312.95",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null}],itemCount:6},{id:"drinks-mocktails",name:"Mocktails",menu:"drinks",items:[{name:"Sunset Freeze",description:"An icy layered blend of sweet mango and exotic dragonfruit",price:5.95,priceLabel:"\xa35.95",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Pornstar Nojito",description:"A virgin mojito with sweet vanilla, tart passionfruit, and fresh mint",price:5.95,priceLabel:"\xa35.95",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Refresher",description:"Light and floral lychee mixed with the tart sweetness of raspberry and refreshing mint",price:5.95,priceLabel:"\xa35.95",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Bubblegum Limeade",description:"A nostalgic candy-shop vibe with a light citrussy fizz",price:5.95,priceLabel:"\xa35.95",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null}],itemCount:4},{id:"drinks-coo-creations",name:"Coo creations",menu:"drinks",items:[{name:"Strawberry Fields",description:"Fresh cucumber, sweet strawberry, and floral elderflower in every sip",price:12.95,priceLabel:"\xa312.95",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Crimson Monsoon",description:"Bright tropical cocktail bursting with mango and dragonfruit",price:12.95,priceLabel:"\xa312.95",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Amalfi Sunset",description:"A crisp, bittersweet cocktail with a zesty finish",price:12.95,priceLabel:"\xa312.95",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Island Inferno",description:"A vibrant summery drink balancing sweet and sour, ending with a complex spicy finish",price:12.95,priceLabel:"\xa312.95",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Black Velvet",description:"A fruit-forward take on a classic bourbon smash combining sweet berries with notes of caramel on the finish",price:12.95,priceLabel:"\xa312.95",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null},{name:"Verde Botanica",description:"Sun-ripened pineapple combines with zesty lime, subtle spice, and herbaceous coriander",price:12.95,priceLabel:"\xa312.95",dietaryTags:[],dietaryTagsPublished:!1,allergens:null,options:null}],note:"If you cannot see your favourite cocktail, ask your server; the bartenders are classically trained (menu statement, not independently verified).",itemCount:6}],itemCount:273,orderable:!1,currentMenuConfirmed:!1,availabilityConfirmed:!1}}}},7,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ABBOTSFORD_UUID",{enumerable:!0,get:function(){return o.ABBOTSFORD_UUID}}),Object.defineProperty(e,"ABBOTSFORD_HOTEL",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"ABBOTSFORD_HOURS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"ABBOTSFORD_RESTAURANT",{enumerable:!0,get:function(){return l}});var o=r(d[0]);const n={enabled:!0,bedrooms:null,breakfast:"Inclusions and room details to confirm with the hotel",priceNote:"Prices to confirm with the hotel",roomTypes:[{id:"1",name:"The Br\xe8agha Suite",pricePence:null},{id:"2",name:"The Monarch Suite",pricePence:null},{id:"3",name:"The Whisky Room",pricePence:null},{id:"4",name:"The Thistle Room",pricePence:null},{id:"5",name:"The Equestrian Room",pricePence:null},{id:"6",name:"The Coastal Room",pricePence:null},{id:"7",name:"The Wee Lamb Room",pricePence:null},{id:"8",name:"The Rabbie Burns Room",pricePence:null},{id:"9",name:"The \u2018Hairy Coo\u2019 Room",pricePence:null},{id:"10",name:"The Bagpipe Room",pricePence:null},{id:"11",name:"The Scottie Dog Room",pricePence:null},{id:"12",name:"The Turnberry Room",pricePence:null},{id:"13",name:"The Postage Stamp Room",pricePence:null},{id:"14",name:"The Old Prestwick Room",pricePence:null},{id:"15",name:"The Belleisle Room",pricePence:null},{id:"16",name:"The Dundonald Links Room",pricePence:null}]},t={0:['10:00','20:30'],1:['10:00','20:30'],2:['10:00','20:30'],3:['10:00','20:30'],4:['10:00','20:30'],5:['10:00','20:30'],6:['10:00','20:30']},l={id:'abbotsford',name:'The Abbotsford Hotel',tagline:'Epicurious restaurant \xb7 The Copper Bar',location:'14 Corsehill Road, Ayr KA7 2ST',address:'14 Corsehill Road, Ayr KA7 2ST',phone:'01292 261506',email:'info@abbotsfordhotel.co.uk',website:'https://www.abbotsfordhotel.co.uk/',fictional:!1,kitchenHours:t,hoursNeedsConfirmation:!0,hoursNote:'Daily 10:00\u201320:30 \u2014 to confirm. Copper Bar hours to confirm.',sections:[],settings:{slotMinutes:15,slotCap:3,bufferMins:5,leadMins:20,takeawayPaused:!0,bookingCoversPerSlot:0,stampTarget:8,stampReward:'',stampMinSpend:0,capacityPerHour:0,walkInShare:0,turnMins:75,orderAtTable:!1,showTakeaway:!1,shortName:'The Abbotsford Hotel',reserveStock:!1,tableRequests:!0,hotel:n,deposit:{on:!1,perPersonPence:null,fromParty:null,refundable:null,cutoffHours:null,needsConfirmation:!0,wixLinksOn:!1,policy:'Deposit policy to confirm. No deposit or payment is taken in this app.'}}}},8,[5]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"KIRKTON_UUID",{enumerable:!0,get:function(){return n.KIRKTON_UUID}}),Object.defineProperty(e,"KIRKTON_UNKNOWN_HOURS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"KIRKTON_RESTAURANT",{enumerable:!0,get:function(){return o}});var n=r(d[0]);const t={0:null,1:null,2:null,3:null,4:null,5:null,6:null},o={id:'kirkton',name:'The Kirkton Inn',tagline:'Bar and restaurant in Dalrymple',location:'1-3 Main Street, Dalrymple, East Ayrshire KA6 6DF',address:'1-3 Main Street, Dalrymple, East Ayrshire KA6 6DF',phone:'',email:'',emailNeedsConfirmation:!0,phoneNeedsConfirmation:!0,hoursNeedsConfirmation:!0,takeawayNeedsConfirmation:!0,website:'',fictional:!1,kitchenHours:t,hoursNote:'Current venue and kitchen hours to confirm. No service times have been set.',sections:[],settings:{slotMinutes:15,slotCap:3,bufferMins:5,leadMins:20,takeawayPaused:!0,bookingCoversPerSlot:0,stampTarget:8,stampReward:'',stampMinSpend:0,capacityPerHour:0,walkInShare:0,turnMins:75,orderAtTable:!1,showTakeaway:!1,shortName:'The Kirkton Inn',reserveStock:!1,tableRequests:!1,deposit:{on:!1,perPersonPence:null,fromParty:null,refundable:null,cutoffHours:null,needsConfirmation:!0,wixLinksOn:!1,policy:'Deposit policy to confirm. No deposits or payments are taken in this app.'}}}},9,[5]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"WILDINGS_UUID",{enumerable:!0,get:function(){return t.WILDINGS_UUID}}),Object.defineProperty(e,"WILDINGS_BOOKING_PHONE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"WILDINGS_BOOKING_EMAIL",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"WILDINGS_SERVICE_HOURS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"WILDINGS_RESTAURANT",{enumerable:!0,get:function(){return u}});var n=r(d[0]),t=r(d[1]);const o='tel:01655331401',s='mailto:bookings@wildingsrestaurant-hotel.co.uk',l={lunch:{monSat:['12:00','14:00'],sun:['12:00','14:30']},dinner:{daily:['18:00','21:00']}},u={id:'wildings',name:'Wildings Hotel & Restaurant',tagline:'Coastal cuisine with character',location:'Maidens, KA26 9NR',address:'Maidens Road, Maidens, KA26 9NR',phone:'01655 331 401',email:'bookings@wildingsrestaurant-hotel.co.uk',website:'wildingshotel.com',fictional:!1,kitchenHours:{0:['12:00','21:00'],1:['12:00','21:00'],2:['12:00','21:00'],3:['12:00','21:00'],4:['12:00','21:00'],5:['12:00','21:00'],6:['12:00','21:00']},serviceHours:l,hoursNote:'Lunch Mon\u2013Sat 12:00\u201314:00, Sun 12:00\u201314:30; dinner daily 18:00\u201321:00. Kitchen closed between lunch and dinner. Bar hours to confirm.',sections:[],settings:{bookingRequests:!0,hotel:n.WILDINGS_HOTEL,slotMinutes:15,slotCap:3,bufferMins:5,leadMins:20,takeawayPaused:!0,bookingCoversPerSlot:0,stampTarget:8,stampReward:'',stampMinSpend:0,capacityPerHour:0,walkInShare:0,turnMins:75,orderAtTable:!1,showTakeaway:!1,shortName:'Wildings',reserveStock:!1,tableRequests:!1,deposit:{on:!1,perPersonPence:null,fromParty:null,refundable:null,cutoffHours:null,needsConfirmation:!0,wixLinksOn:!1,policy:'No published deposit policy \u2014 off until confirmed. Book by phone or email.'}}}},10,[11,5]); +__d(function(g,_r,_i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"WILDINGS_HOTEL",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"localDate",{enumerable:!0,get:function(){return n}}),e.requestSlots=r,e.requestError=function(t,o,i,c=new Date){if(o.name.trim().length<2||!/^[0-9 +()\-]{7,30}$/.test(o.phone)||o.phone.replace(/\D/g,'').length<7||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(o.email))return'Enter your name, phone number and email.';if(o.notes.length>2e3)return'Keep notes under 2000 characters.';const s=t=>!!t&&/^\d{4}-\d{2}-\d{2}$/.test(t)&&Number.isFinite(+new Date(t+'T12:00:00Z'))&&new Date(t+'T12:00:00Z').toISOString().slice(0,10)===t;if('table'===t){if(!s(o.date)||o.date200)return'Enter 1 to 200 Covers.'}else{if(!i?.enabled||!s(o.checkIn)||!s(o.checkOut)||o.checkIn60)return'Choose check-in and a later check-out, up to 60 nights.';if(!i.roomTypes.some(t=>t.id===o.roomType)||!Number.isInteger(o.guests)||o.guests<1||o.guests>12)return'Choose a room type and 1 to 12 guests.'}return''};const t={enabled:!0,bedrooms:11,breakfast:'including full Scottish breakfast',priceNote:'Prices to confirm with the hotel',roomTypes:[{id:'double',name:'Double Room',pricePence:16200},{id:'king',name:'King Room',pricePence:16200},{id:'twin',name:'Twin Room',pricePence:16200},{id:'family',name:'Family Room',pricePence:20500,from:!0}]},n=(t=new Date)=>new Intl.DateTimeFormat('en-CA',{timeZone:'Europe/London',year:'numeric',month:'2-digit',day:'2-digit'}).format(t);function r(t,n){if(!/^\d{4}-\d{2}-\d{2}$/.test(t))return[];const r=new Date(t+'T12:00:00Z');if(!Number.isFinite(+r)||r.toISOString().slice(0,10)!==t)return[];const o='Lunch'===n?720:1080,i='Lunch'===n?0===r.getUTCDay()?870:840:1260;return Array.from({length:(i-o)/15+1},(t,n)=>{const r=o+15*n;return`${String(Math.floor(r/60)).padStart(2,'0')}:${String(r%60).padStart(2,'0')}`})}},11,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"KIRKMICHAEL_UUID",{enumerable:!0,get:function(){return n.KIRKMICHAEL_UUID}}),Object.defineProperty(e,"KIRKMICHAEL_BOOKING_URL",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"KIRKMICHAEL_SITE_URL",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"KIRKMICHAEL_RESTAURANT",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"KIRKMICHAEL_CONTACTS",{enumerable:!0,get:function(){return l}});var n=r(d[0]);const t='',o='https://www.kirkmichaelarms.co.uk/',s={id:'kirkmichael',name:'The Kirkmichael Arms',tagline:'A Michelin-listed restaurant and bar in Kirkmichael, Ayrshire \u2014 honest and robust, romantic and gastronomic.',location:'Kirkmichael, South Ayrshire',address:'3-5 Straiton Road, Kirkmichael, South Ayrshire KA19 7PH',phone:'01655 750 200',website:'https://www.kirkmichaelarms.co.uk/',fictional:!1,kitchenHours:{0:['13:00','22:30'],1:null,2:null,3:null,4:['13:00','22:30'],5:['13:00','22:30'],6:['13:00','22:30']},hoursNote:'Closed Mon\u2013Wed; Thu\u2013Sun 13:00\u201322:30 from the venue website. Sunday conflict: Michelin says 12:30; confirm Sunday opening, kitchen last orders and bar closing with the venue. Pay & tips provisional.',sections:[],settings:{slotMinutes:15,slotCap:3,bufferMins:5,leadMins:20,takeawayPaused:!0,bookingCoversPerSlot:14,stampTarget:8,stampReward:'',stampMinSpend:0,capacityPerHour:56,walkInShare:.3,turnMins:75,orderAtTable:!1,showTakeaway:!1,shortName:'Kirkmichael',reserveStock:!1,tableRequests:!0,deposit:{on:!1,perPersonPence:null,fromParty:null,refundable:null,cutoffHours:null,needsConfirmation:!0,wixLinksOn:!1,policy:'Deposits are off. Confirm directly with the venue if needed.'}}},l=[{name:'Justin Galea',role:'owner',job:'Chef & Owner',email:'enquiries@thekirkmichaelarms.co.uk',phone:'01655 750 200'},{name:'Roy Hutchison',role:'manager',job:'Manager',email:null,phone:null}]},12,[5]); +__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEPOSIT_DEFAULT",{enumerable:!0,get:function(){return e}}),_e.depositOf=function(t){const n=t?.deposit;return n&&'object'==typeof n?{on:n.on??e.on,...!0===n.needsConfirmation?{needsConfirmation:!0}:{},perPersonPence:Number.isFinite(n.perPersonPence)?Math.max(0,Math.round(n.perPersonPence)):n.needsConfirmation?0:e.perPersonPence,fromParty:Number.isFinite(n.fromParty)?Math.max(1,Math.round(n.fromParty)):n.needsConfirmation?1:e.fromParty,refundable:'boolean'==typeof n.refundable?n.refundable:null,cutoffHours:Number.isFinite(n.cutoffHours)?Math.max(0,Math.round(n.cutoffHours)):null,policy:'string'==typeof n.policy?n.policy.slice(0,600):'',wixLinksOn:!0===n.wixLinksOn,wixLinkHours:Number.isFinite(n.wixLinkHours)?Math.max(1,Math.min(168,Math.round(n.wixLinkHours))):48}:{...e}},_e.depositDue=t,_e.depositWords=function(e,o,s){if(e.needsConfirmation&&!e.on)return[e.policy.trim()||'Deposit policy awaiting venue confirmation.'];if(e.needsConfirmation)return['Table deposit policy not set yet. Ticketed event deposits are separate and are not a table policy.'];const d=t(e,o);if(!d)return[];const p=[`A deposit of ${n(d)} (${n(e.perPersonPence)} per person) is needed for ${e.fromParty} or more guests.`];!0===e.refundable?p.push(e.cutoffHours?`Refundable if you cancel at least ${e.cutoffHours} hours before your booking.`:'Refundable if you cancel.'):!1===e.refundable?p.push('The deposit is not refundable.'):p.push(`Ask ${s} about refunds.`);e.policy.trim()&&p.push(e.policy.trim());return p.push(e.wixLinksOn?`${s} will send you a link to pay the deposit securely through website bookings.`:`No payment is taken in the app yet: ${s} will tell you how to pay the deposit.`),p},_e.depositState=o,_e.wixPayStatus=s,_e.knownPaid=d,_e.fromWixOrder=p,_e.estimatedWix=u,_e.depositBadge=l,_e.canTickDeposit=function(e){const t=s(e);return'NOT_PAID'!==t&&'PAID'!==t&&'FULLY_REFUNDED'!==t&&'PARTIALLY_REFUNDED'!==t&&('paid'!==e.depositLink?.state&&'due'===o(e))},_e.canSendDepositLink=function(e,t){return!(!t.wixLinksOn||s(e))&&(!e.walkIn&&!['cancelled','finished','noshow','declined'].includes(e.status??'')&&('due'===o(e)&&'paid'!==e.depositLink?.state))},_e.depositTerms=function(e){const t=[];!0===e.refundable?t.push(e.cutoffHours?`The deposit is refundable if you cancel at least ${e.cutoffHours} hours before.`:'The deposit is refundable if you cancel.'):!1===e.refundable&&t.push('The deposit is not refundable.');e.policy.trim()&&t.push(e.policy.trim());return t.join(' ')},_e.depositLinkMessage=function(e){const t=(e.name||'').trim().split(/\s+/)[0]||'there',[o,s,d]=e.date.split('-').map(Number),p=new Date(o,(s||1)-1,d||1).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'}),u=e.expiresAt?new Date(e.expiresAt).toLocaleString('en-GB',{timeZone:'Europe/London',weekday:'long',day:'numeric',month:'long',hour:'numeric',minute:'2-digit',hourCycle:'h12'}).replace(/\s?(am|pm)$/i,e=>e.trim().toLowerCase()):'',l=[`Hello ${t}, thank you for booking ${e.venue} for ${e.partySize} on ${p} at ${e.time.slice(0,5)}.`,`To hold your table, please pay the ${n(e.amountPence)} deposit here: ${e.url}`];u&&l.push(`The link works until ${u}.`);e.terms?.trim()&&l.push(e.terms.trim());return l.push(`Thank you, ${e.venue}`),l.join('\n')},_e.depositView=c,_e.depositShort=function(e){const t=c(e,!1);return t?t.a11y.split(',')[0]:null};const e={on:!0,perPersonPence:1e3,fromParty:6,refundable:null,cutoffHours:null,policy:''};function t(e,t){return!e.on||e.perPersonPence<=0||t`\xa3${(e/100).toFixed(e%100?2:0)}`;function o(e){if('deposit'!==e.security)return'none';const t=e.depositDue??e.depositPaid??0;return t?(e.depositPaid??0)>=t?'paid':'due':'none'}function s(e){const t=e.wix?.paymentStatus;return t&&['FREE','NOT_PAID','PAID','PARTIALLY_PAID','PARTIALLY_REFUNDED','FULLY_REFUNDED'].includes(t)?t:null}function d(e){return'paid'===e.depositLink?.state&&(e.depositLink.paidPence??0)>0?e.depositLink.paidPence:e.depositPaidBy&&'Wix'!==e.depositPaidBy&&(e.depositPaid??0)>0&&!e.wix?.depositEstimated||p(e)&&(e.depositPaid??0)>0?e.depositPaid:null}function p(e){return'wix-order'===e.wix?.amountSource||'wix-order'===e.depositSource}function u(e){if(p(e)||!e.wix?.depositEstimated&&'estimate'!==e.depositSource)return null;const t=e.depositPaid??0;if(t<=0)return null;const n=e.partySize??0;return{pence:t,perHead:e.wix?.perPersonPence??(n?Math.round(t/n):0),party:n}}function l(e,t=n){const p=s(e),l=d(e);if(p&&'FREE'!==p){if(e.depositPaidBy&&l)return{label:`Deposit paid \xb7 ${t(l)}`,kind:'gold'};if('PAID'===p){if(l)return{label:`Deposit paid \xb7 ${t(l)}`,kind:'gold'};const n=u(e);return n?{label:n.party&&n.perHead?`Deposit paid (about ${t(n.pence)}, ${n.party} \xd7 ${t(n.perHead)})`:`Deposit paid (about ${t(n.pence)})`,kind:'gold'}:{label:'Deposit paid on website bookings',kind:'gold'}}return'PARTIALLY_PAID'===p?{label:l&&(e.depositDue??0)>l?`Part paid on website bookings \xb7 ${t(l)} of ${t(e.depositDue)}`:'Part paid on website bookings',kind:'amber'}:'NOT_PAID'===p?{label:(e.depositDue??0)>0?`Deposit not paid \xb7 ${t(e.depositDue)} due`:'Deposit not paid',kind:'amber'}:'FULLY_REFUNDED'===p?{label:'Deposit refunded on website bookings',kind:'neutral'}:{label:'Deposit part refunded on website bookings',kind:'neutral'}}const c=o(e);if('none'===c)return null;const f=e.depositLink;return'paid'===f?.state?{label:l?`Deposit paid on website bookings \xb7 ${t(l)}`:'Deposit paid on website bookings',kind:'gold'}:'paid'===c?{label:l?`Deposit paid \xb7 ${t(l)}`:'Deposit paid',kind:'gold'}:'open'===f?.state?{label:`Deposit link sent \xb7 waiting \xb7 ${t(f.amountPence??e.depositDue??0)}`,kind:'amber'}:'expired'===f?.state?{label:'Deposit link ran out \xb7 send a new one',kind:'amber'}:{label:`Deposit due \xb7 ${t(e.depositDue??0)}`,kind:'amber'}}function c(e,t,o=n){const d=l(e,o);if(!d)return null;const c=s(e),f=d.label.startsWith('Deposit paid');if(!t)return f?{label:'\u2713 Deposit paid',kind:'gold',a11y:'Deposit paid',paid:f}:'PARTIALLY_PAID'===c?{label:'Deposit part paid',kind:'amber',a11y:'Deposit part paid',paid:f}:'FULLY_REFUNDED'===c||'PARTIALLY_REFUNDED'===c?{label:'Deposit refunded',kind:'neutral',a11y:'Deposit refunded',paid:f}:'NOT_PAID'===c?{label:'Deposit not paid',kind:'amber',a11y:'Deposit not paid yet',paid:f}:{label:'Deposit due',kind:'amber',a11y:'Deposit due, not paid yet',paid:f};const b='PAID'===c?u(e):null,m=b&&b.perHead?`Website bookings shows paid; amount worked out at ${o(b.perHead)} a head`:p(e)&&f?'Amount from the website bookings order':void 0,D=d.label.replace(/ \xb7 /g,', ').replace(/\xd7/g,'times').replace(/[()]/g,'')+(m?`. ${m}`:'');return{label:d.label,kind:d.kind,a11y:D,note:m,paid:f}}},13,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ROSTER_VERSION",{enumerable:!0,get:function(){return t.ROSTER_VERSION}}),Object.defineProperty(e,"ROSTER",{enumerable:!0,get:function(){return n}});var t=r(d[0]);const n=r(d[1]).IS_ISOLATED_VENUE?[]:t.ROSTER},14,[15,5]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ROSTER_VERSION",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"ROSTER",{enumerable:!0,get:function(){return t}});const n='42c3b21ce2b1',t=[{id:"st-tracy",name:"Tracy",level:"Owner",role:"owner",job:"Owner",dept:"Management",app:"owner",tokenHash:"0282340e0cd9049e4c6c65aad054567668ae171420f8232d01339f9b9a4f673e",hourlyPence:null,salaried:!0,noTax:!1,avatar:{bg:"#2A2520",ring:"#E9B949",skin:"#F1C7A5",hair:"#D9B26A",hairStyle:"beehive",suit:"#F2EAD8",antenna:"star"}},{id:"st-james",name:"James",level:"Owner",role:"owner",job:"Owner",dept:"Management",app:"owner",tokenHash:"22d4e0fa4684c4524d7e309f998698ee6a5f13cf45ce184f829535770122bc77",hourlyPence:null,salaried:!0,noTax:!1,avatar:{bg:"#4A3F35",ring:"#E9B949",skin:"#E8B48F",hair:"#2B1B12",hairStyle:"quiff",suit:"#F2EAD8",antenna:"ball"}},{id:"st-gordon",name:"Gordon",level:"Manager",role:"manager",job:"General Manager",dept:"Kitchen",app:"owner",tokenHash:"85f1379e164f05372f7b4c36a9a9eaeca53f702b2002b1e9ec2286b16754a123",hourlyPence:null,salaried:!1,noTax:!1,avatar:{bg:"#B89A72",ring:"#CFA45F",skin:"#F4D2B8",hair:"#7A4E2A",hairStyle:"crop",suit:"#FFFFFF",antenna:"ball",specs:!0}},{id:"st-bisto",name:"Bisto",level:"Head Chef",role:"staff",job:"Head Chef",dept:"Kitchen",app:"chef",nickname:"Preston",tokenHash:"a30424e45d351eaed9dfa126c9bb474aec456488cc5ff3e47160169d804589de",hourlyPence:null,salaried:!1,noTax:!1,avatar:{bg:"#D9A441",ring:"#B8913A",skin:"#C68B5E",hair:"#151515",hairStyle:"quiff",suit:"#FFFFFF",antenna:"star"}},{id:"st-lenny",name:"Lenny",level:"Staff",role:"staff",job:"Commis Chef",dept:"Kitchen",app:"staff",tokenHash:"3a2d450706725227a93f77e1bc53460ad863eadd4437bc6f6f87b51e67c14ee8",hourlyPence:null,salaried:!1,noTax:!1,avatar:{bg:"#8A6A3B",ring:"#E9B949",skin:"#F1C7A5",hair:"#C2462E",hairStyle:"curls",suit:"#FFFFFF",antenna:"none"}},{id:"st-agate",name:"Agate",level:"Staff",role:"staff",job:"Front of house",dept:"Front of house",app:"staff",tokenHash:"7abf5c5d9edc3a95f366e87be81612769e06dc42dee3b917845cd1de506d0474",hourlyPence:null,salaried:!1,noTax:!1,avatar:{bg:"#3A3029",ring:"#E9B949",skin:"#E8B48F",hair:"#151515",hairStyle:"bob",suit:"#F2EAD8",antenna:"star",specs:!0}},{id:"st-finn",name:"Finn",level:"Staff",role:"staff",job:"Bar staff",dept:"Bar",app:"staff",nickname:"Paddy",tokenHash:"8a8a3102bedf69cfb1463dcafeef8663ed7e6ef9c0b87b9129e872f6647689a1",hourlyPence:null,salaried:!1,noTax:!1,avatar:{bg:"#2A2520",ring:"#B8913A",skin:"#A86B45",hair:"#2B1B12",hairStyle:"quiff",suit:"#F2EAD8",antenna:"star"}},{id:"st-eilidh",name:"Eilidh",level:"Staff",role:"staff",job:"Front of house",dept:"Front of house",app:"staff",tokenHash:"38f1a41686f2990237e33147142714d1950775c37d3ca1e73a57d191704f5a43",hourlyPence:null,salaried:!1,noTax:!1,avatar:{bg:"#B89A72",ring:"#E9B949",skin:"#F4D2B8",hair:"#C2462E",hairStyle:"flip",suit:"#F2EAD8",antenna:"ball"}},{id:"st-emily",name:"Emily",level:"Staff",role:"staff",job:"Front of house",dept:"Front of house",app:"staff",tokenHash:"96a8d606148e6f160f1f56cbd10df7d40a102e9406a56a397043e08736e692d8",hourlyPence:null,salaried:!1,noTax:!1,avatar:{bg:"#4A3F35",ring:"#CFA45F",skin:"#F1C7A5",hair:"#D9B26A",hairStyle:"bob",suit:"#F2EAD8",antenna:"none"}},{id:"st-gabrielle",name:"Gabrielle",level:"Staff",role:"staff",job:"Front of house",dept:"Front of house",app:"staff",tokenHash:"49193baef50a9d51202dce5b7664264b87c89e59d2ab055573a02db85a6ee7a7",hourlyPence:null,salaried:!1,noTax:!1,avatar:{bg:"#3A3029",ring:"#CFA45F",skin:"#8D5B3E",hair:"#151515",hairStyle:"curls",suit:"#F2EAD8",antenna:"ball"}},{id:"st-cameron",name:"Cameron Mc",level:"Staff",role:"staff",job:"Front of house (temp)",dept:"Front of house",app:"staff",tokenHash:"aecb1b8c6c2be2446f6a70fd8fce49389821fbb77ccd7b49285807d4b984b127",hourlyPence:null,salaried:!1,noTax:!1,avatar:{bg:"#8A6A3B",ring:"#B8913A",skin:"#E8B48F",hair:"#7A4E2A",hairStyle:"crop",suit:"#F2EAD8",antenna:"star",specs:!0}},{id:"st-lillie",name:"Lillie",level:"Staff",role:"staff",job:"Kitchen porter (KP)",dept:"Kitchen",app:"staff",tokenHash:"cc3ba48d53dc896306b7130d7f1873fdee4b999f52c771822677993a30d0070c",hourlyPence:null,salaried:!1,noTax:!1,avatar:{bg:"#D9A441",ring:"#CFA45F",skin:"#F4D2B8",hair:"#2B1B12",hairStyle:"flip",suit:"#FFFFFF",antenna:"star"}},{id:"st-mia",name:"Mia",level:"Staff",role:"staff",job:"Kitchen porter (KP)",dept:"Kitchen",app:"staff",tokenHash:"b059384435aaf4f1b715a2d5ac271b3a319a328293727329aa3f0865113ce9db",hourlyPence:null,salaried:!1,noTax:!1,avatar:{bg:"#2A2520",ring:"#CFA45F",skin:"#C68B5E",hair:"#151515",hairStyle:"beehive",suit:"#FFFFFF",antenna:"ball"}},{id:"st-jack",name:"Jack",level:"Staff",role:"staff",job:"Kitchen porter (KP)",dept:"Kitchen",app:"staff",tokenHash:"4b3b1835012643aac15037450ba44ac26bb6b91ff17b26a0d46c7163435b1686",hourlyPence:null,salaried:!1,noTax:!1,avatar:{bg:"#B89A72",ring:"#E9B949",skin:"#F1C7A5",hair:"#D9B26A",hairStyle:"quiff",suit:"#FFFFFF",antenna:"none"}},{id:"st-harvey",name:"Harvey",level:"Staff",role:"staff",job:"Kitchen porter (KP)",dept:"Kitchen",app:"staff",tokenHash:"c5c4e71d1a9eea7116face538ddba4084037bf2f16eae4ba6910d1a1b8036127",hourlyPence:null,salaried:!1,noTax:!1,avatar:{bg:"#4A3F35",ring:"#B8913A",skin:"#A86B45",hair:"#7A4E2A",hairStyle:"curls",suit:"#FFFFFF",antenna:"star",specs:!0}}]},15,[]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PITCH_VENUE",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"PITCH_TEAM",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"PITCH_TEXT",{enumerable:!0,get:function(){return o}}),e.pitchText=function(a){let n=a;for(const[a,t]of o)a.test(n)?(a.lastIndex=0,n=n.replace(a,t)):a.lastIndex=0;return n};const a={name:'The Harbour Kitchen',tagline:'Harbourside seafood & seasonal plates',location:'12 Quay Street, Portmorran',phone:'01632 960 123',website:'harbourkitchen.example'},n={'st-tracy':{name:'Morgan',job:'Owner',hourlyPence:null,salaried:!0},'st-gordon':{name:'Alex',job:'General Manager',dept:'Management',hourlyPence:null,salaried:!0},'st-bisto':{name:'Ravi',job:'Head Chef',hourlyPence:null,salaried:!0},'st-agate':{name:'Priya',job:'Front of house supervisor',hourlyPence:1450},'st-lenny':{name:'Tom',job:'Commis Chef',hourlyPence:1325},'st-finn':{name:'Lewis',job:'Bar staff',hourlyPence:1290},'st-eilidh':{name:'Chloe',job:'Front of house',hourlyPence:1271},'st-emily':{name:'Ellie',job:'Front of house',hourlyPence:1271},'st-lillie':{name:'Jordan',job:'Kitchen porter (KP)',hourlyPence:1271},'st-jack':{name:'Sam',job:'Kitchen porter (KP)',hourlyPence:1271}},o=[['Harbour View, Dunure, South Ayrshire',a.location],['Harbour View, Dunure',a.location],['Harbour View mug','Harbour Kitchen mug'],['Harbour View','Quay Street'],['anchoragedunure.com',a.website],['01292 502826',a.phone],['Mini Anchors','Little Crew'],['The Anchorage',a.name],['Anchorage','Harbour Kitchen'],['ANCHORAGE','HARBOUR KITCHEN'],['South Ayrshire','the Firth coast'],['Ayrshire','the Firth coast'],['Dunure','Portmorran'],['Kittyfisher boat (Big Sean)','Coastal Fish Co'],['Kittyfisher','Coastal Fish Co'],['Big Sean','Coastal Fish Co'],['Example Fish Co.','Coastal Fish Co'],['Sample Dairy Ltd','Hillside Dairy'],['Sample Fruit & Veg','Fieldfare Veg'],['Mills milk','Hillside Dairy milk'],['Mills','Hillside Dairy'],['J. Pieroni & Sons','Fieldfare Veg'],["Pieroni's",'Fieldfare Veg'],['Pieroni','Fieldfare Veg'],['Alsons (drinks)','Drinks wholesaler'],['Alsons','the drinks wholesaler'],['Spes Bona','the deli wholesaler'],['Tarelgin','the butcher'],['Reids','the bakery'],['Reeds','the bakery'],['Example Butchers Ltd','Quayside Butchers'],['Example Dry Goods Wholesale','Dry goods wholesaler'],['Sample Brewing Co.','Harbourside Brewing'],['Example Cleaning Supplies','Cleaning supplies'],['Sample Packaging Ltd','Packaging supplier'],['Example Kitchen Repairs','Kitchen repairs'],['Preston','Ravi'],['Bisto','Ravi'],['Tracy','Morgan'],['James','Morgan'],['Gordon','Alex'],['Agate','Priya'],['Lenny','Tom'],['Finn','Lewis'],['Eilidh','Chloe'],['Emily','Ellie'],['Gabrielle','Ellie'],['Cameron Mc','Sam'],['Cameron','Sam'],['Lillie','Jordan'],['Mia','Jordan'],['Jack','Sam'],['Harvey','Jordan'],['Anna','the supplier'],['(preview)',''],[' (example)','']].map(([a,n])=>[new RegExp(`${/^[A-Za-z]/.test(a)?'(?g[`${__METRO_GLOBAL_PREFIX__}__loadBundleAsync`](_),globalThis.__webpack_require__=o=>{const t=ErrorUtils.reportFatalError;_&&(ErrorUtils.reportFatalError=_=>{throw _});try{return g[`${__METRO_GLOBAL_PREFIX__}__r`](o)}finally{_&&(ErrorUtils.reportFatalError=t)}}},22,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function n(){const t=r(d[0]);return n=function(){return t},t}function t(){const n=r(d[1]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"App",{enumerable:!0,get:function(){return c}}),r(d[2]);const o=r(d[3]),u=r(d[4]);function c(){return(0,n().jsx)(u.Head.Provider,{children:(0,n().jsx)(o.ExpoRoot,{context:t().ctx})})}r(d[5])},23,[24,26,30,32,770,773]); +__d(function(g,r,i,a,m,e,d){'use strict';m.exports=r(d[0])},24,[25]); +__d(function(g,r,i,a,m,e,d){ +/** + * @license React + * react-jsx-runtime.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +"use strict";var n=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function o(t,o,f){var l=null;if(void 0!==f&&(l=""+f),void 0!==o.key&&(l=""+o.key),"key"in o)for(var y in f={},o)"key"!==y&&(f[y]=o[y]);else f=o;return o=f.ref,{$$typeof:n,type:t,key:l,ref:void 0!==o?o:null,props:f}}e.Fragment=t,e.jsx=o,e.jsxs=o},25,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ctx",{enumerable:!0,get:function(){return t}});const t=r(d[0])},26,[27]); +__d(function(g,r,i,a,m,e,d){const t=Object.defineProperties({},{"./(chef)/kitchen/[section].tsx":{enumerable:!0,get:()=>r(d[1])(d[0],d.paths)},"./(chef)/kitchen/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[2],d.paths)},"./(customer)/customer/[rid]/book.tsx":{enumerable:!0,get:()=>r(d[1])(d[3],d.paths)},"./(customer)/customer/[rid]/dish/[did].tsx":{enumerable:!0,get:()=>r(d[1])(d[4],d.paths)},"./(customer)/customer/[rid]/feedback.tsx":{enumerable:!0,get:()=>r(d[1])(d[5],d.paths)},"./(customer)/customer/[rid]/gift.tsx":{enumerable:!0,get:()=>r(d[1])(d[6],d.paths)},"./(customer)/customer/[rid]/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[7],d.paths)},"./(customer)/customer/[rid]/lost.tsx":{enumerable:!0,get:()=>r(d[1])(d[8],d.paths)},"./(customer)/customer/[rid]/loyalty.tsx":{enumerable:!0,get:()=>r(d[1])(d[9],d.paths)},"./(customer)/customer/[rid]/merch.tsx":{enumerable:!0,get:()=>r(d[1])(d[10],d.paths)},"./(customer)/customer/[rid]/offers.tsx":{enumerable:!0,get:()=>r(d[1])(d[11],d.paths)},"./(customer)/customer/[rid]/refer.tsx":{enumerable:!0,get:()=>r(d[1])(d[12],d.paths)},"./(customer)/customer/[rid]/waitlist.tsx":{enumerable:!0,get:()=>r(d[1])(d[13],d.paths)},"./(customer)/customer/[rid]/whatson.tsx":{enumerable:!0,get:()=>r(d[1])(d[14],d.paths)},"./(customer)/customer/basket.tsx":{enumerable:!0,get:()=>r(d[1])(d[15],d.paths)},"./(customer)/customer/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[16],d.paths)},"./(customer)/customer/order/[oid].tsx":{enumerable:!0,get:()=>r(d[1])(d[17],d.paths)},"./(customer)/customer/profile.tsx":{enumerable:!0,get:()=>r(d[1])(d[18],d.paths)},"./(customer)/demo.tsx":{enumerable:!0,get:()=>r(d[1])(d[19],d.paths)},"./(customer)/table/[n].tsx":{enumerable:!0,get:()=>r(d[1])(d[20],d.paths)},"./(customer)/table/live/[token].tsx":{enumerable:!0,get:()=>r(d[1])(d[21],d.paths)},"./(display)/display/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[22],d.paths)},"./(display)/staff/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[23],d.paths)},"./(owner)/admin/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[24],d.paths)},"./(owner)/owner/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[25],d.paths)},"./(staff)/team/index.tsx":{enumerable:!0,get:()=>r(d[1])(d[26],d.paths)},"./+not-found.tsx":{enumerable:!0,get:()=>r(d[1])(d[27],d.paths)},"./_layout.tsx":{enumerable:!0,get:()=>r(d[1])(d[28],d.paths)},"./index.tsx":{enumerable:!0,get:()=>r(d[1])(d[29],d.paths)}});function s(s){return t[s]}s.keys=function(){return Object.keys(t)},s.resolve=function(t){throw new Error('Unimplemented Metro module context functionality')},m.exports=s},27,{"0":775,"1":28,"2":776,"3":777,"4":778,"5":779,"6":780,"7":781,"8":782,"9":783,"10":784,"11":785,"12":786,"13":787,"14":788,"15":789,"16":790,"17":791,"18":792,"19":793,"20":794,"21":795,"22":796,"23":797,"24":798,"25":799,"26":800,"27":801,"28":802,"29":803,"paths":{"775":"/wildings/chef-app/_expo/static/js/web/[section]-93e8e4ffe952e5b3c505e21ca771e570.js","776":"/wildings/chef-app/_expo/static/js/web/index-837efe1be9c39737e9750ae18a91c7cb.js","777":"/wildings/chef-app/_expo/static/js/web/book-b68aff7cd8daa9b5d327ece648db8831.js","778":"/wildings/chef-app/_expo/static/js/web/[did]-2a2aaaa129307f15140971a22b834cd3.js","779":"/wildings/chef-app/_expo/static/js/web/feedback-3a26c70c9f758c4e362493c3b124ff43.js","780":"/wildings/chef-app/_expo/static/js/web/gift-eb5daa22c1465e33034a87271e1b8b3b.js","781":"/wildings/chef-app/_expo/static/js/web/index-10b44538fce9f65ce117321a623552df.js","782":"/wildings/chef-app/_expo/static/js/web/lost-53fa50fd975a0e31c68fdd69575c2342.js","783":"/wildings/chef-app/_expo/static/js/web/loyalty-f6d17fe0987432e6c679359636231949.js","784":"/wildings/chef-app/_expo/static/js/web/merch-dcc4bf2e12c5c983cc8637b3dae25ae6.js","785":"/wildings/chef-app/_expo/static/js/web/offers-3f4e351ccaa73514bd508bf7bd2a3fa2.js","786":"/wildings/chef-app/_expo/static/js/web/refer-9cf3652c6de6015e443d52d85aa73db7.js","787":"/wildings/chef-app/_expo/static/js/web/waitlist-93752bc9a9a8df911b095d236fa3f385.js","788":"/wildings/chef-app/_expo/static/js/web/whatson-0608a899f634d91b081b758137ce1d33.js","789":"/wildings/chef-app/_expo/static/js/web/basket-4d740db9aeba1d77232a0091a5892917.js","790":"/wildings/chef-app/_expo/static/js/web/index-abf44c56ecfe3a6ee457b5a1c56cb955.js","791":"/wildings/chef-app/_expo/static/js/web/[oid]-7fa4f78cb447d1c659e81fff8893269f.js","792":"/wildings/chef-app/_expo/static/js/web/profile-7858c56bba02a864da6a44be8f8ce02f.js","793":"/wildings/chef-app/_expo/static/js/web/demo-6323990816bb686dcab3b33d7e6ec148.js","794":"/wildings/chef-app/_expo/static/js/web/[n]-ced785c534ba69ad6c9c35369d7ecc36.js","795":"/wildings/chef-app/_expo/static/js/web/[token]-bee6add88cca58f03680987578d45fcf.js","796":"/wildings/chef-app/_expo/static/js/web/index-4a8e84fd487a5f2cafba4c6915cad230.js","797":"/wildings/chef-app/_expo/static/js/web/index-3c5f820b3b21978c61372b3163c55b0a.js","798":"/wildings/chef-app/_expo/static/js/web/index-f9b07e7c25cec3623c10876ff1e01e58.js","799":"/wildings/chef-app/_expo/static/js/web/index-a234f55f1edf32204a015d4a1f3cfb17.js","800":"/wildings/chef-app/_expo/static/js/web/index-08b1a356fa4d0861778c41e3b0186d1f.js","801":"/wildings/chef-app/_expo/static/js/web/+not-found-585f3164ae74e5ff35af71a4ba7360a3.js","802":"/wildings/chef-app/_expo/static/js/web/_layout-ce40d6b7f030f3caa7a4b795d8321697.js","803":"/wildings/chef-app/_expo/static/js/web/index-a39af53b0c36f30a0cc27647d3da5a52.js"}}); +__d(function(g,r,i,a,m,e,d){m.exports=r(d[0])},28,[29]); +__d(function(g,r,i,a,m,e,d){function n(n,t){const o=globalThis[`${__METRO_GLOBAL_PREFIX__??''}__loadBundleAsync`];if(null!=o){const s=String(n);if(null!=t){const n=t[s];if(null!=n)return o(n)}}}function t(t,o,s){const u=()=>r.importAll(t,s);{const l=o?.[String(t)];if(Array.isArray(l)){const c=globalThis[`${__METRO_GLOBAL_PREFIX__??''}__loadBundleAsync`];if(c?.isReady?.(l))return u();const f=n(t,o);if(null!=f)return f.then(u);throw new Error(`Cannot import module ${s??t}: the async bundle loader is unavailable. Load the initial Expo bundle before importing these chunks: ${l.join(', ')}`)}try{return u()}catch(s){const l=n(t,o);if(null!=l)return l.then(u);throw s}}const l=n(t,o);return null!=l?l.then(u):u()}function o(n,o,s){const u=t(n,o,s),l=Promise.resolve(u);return l._result=u,l}o.unstable_importMaybeSync=function(n,o){return t(n,o)},o.prefetch=function(t,o,s){n(t,o)?.then(()=>{},()=>{})},o.unstable_resolve=function(n,t){if(!t)throw new Error('Bundle splitting is required for Web Worker imports');const o=t[n];if(!o)throw new Error('Worker import is missing from split bundle paths: '+o);return o},o.unstable_createWorker=function(n,t){if('undefined'==typeof crossOriginIsolated||!crossOriginIsolated)return new Worker(n,t);try{const s=(o=n,`\n const ASYNC_WORKER_BASE = ${JSON.stringify(o)};\n const IMPORT_SCRIPTS = importScripts;\n const FETCH = fetch;\n const fromBaseURL = (input) => new URL(input, ASYNC_WORKER_BASE).href;\n self.fetch = function(input, init) {\n return FETCH(typeof input === 'string' ? fromBaseURL(input) : input, init);\n };\n self.importScripts = function(...urls) {\n return IMPORT_SCRIPTS.apply(self, urls.map(fromBaseURL));\n };\n importScripts(ASYNC_WORKER_BASE);\n `);return n=URL.createObjectURL(new Blob([s],{type:'text/javascript'})),new Worker(n,t)}finally{URL.revokeObjectURL(n)}var o},m.exports=o},29,[]); +__d(function(g,r,i,a,m,e,d){'use strict';m.exports=r(d[0])},30,[31]); +__d(function(g,r,_i,a,m,e,d){ +/** + * @license React + * react.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +"use strict";var t=Symbol.for("react.transitional.element"),n=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),u=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),s=Symbol.for("react.consumer"),c=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),h=Symbol.for("react.activity"),v=Symbol.for("react.view_transition"),_=Symbol.iterator;var b={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,E={};function w(t,n,o){this.props=t,this.context=n,this.refs=E,this.updater=o||b}function j(){}function H(t,n,o){this.props=t,this.context=n,this.refs=E,this.updater=o||b}w.prototype.isReactComponent={},w.prototype.setState=function(t,n){if("object"!=typeof t&&"function"!=typeof t&&null!=t)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,n,"setState")},w.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")},j.prototype=w.prototype;var R=H.prototype=new j;R.constructor=H,S(R,w.prototype),R.isPureReactComponent=!0;var k=Array.isArray;function C(){}var $={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function O(n,o,u){var i=u.ref;return{$$typeof:t,type:n,key:o,ref:void 0!==i?i:null,props:u}}function x(n){return"object"==typeof n&&null!==n&&n.$$typeof===t}var A=/\/+/g;function I(t,n){return"object"==typeof t&&null!==t&&null!=t.key?(o=""+t.key,u={"=":"=0",":":"=2"},"$"+o.replace(/[=:]/g,function(t){return u[t]})):n.toString(36);var o,u}function P(t){switch(t.status){case"fulfilled":return t.value;case"rejected":throw t.reason;default:switch("string"==typeof t.status?t.then(C,C):(t.status="pending",t.then(function(n){"pending"===t.status&&(t.status="fulfilled",t.value=n)},function(n){"pending"===t.status&&(t.status="rejected",t.reason=n)})),t.status){case"fulfilled":return t.value;case"rejected":throw t.reason}}throw t}function N(o,u,i,s,c){var f=typeof o;"undefined"!==f&&"boolean"!==f||(o=null);var l,p,h=!1;if(null===o)h=!0;else switch(f){case"bigint":case"string":case"number":h=!0;break;case"object":switch(o.$$typeof){case t:case n:h=!0;break;case y:return N((h=o._init)(o._payload),u,i,s,c)}}if(h)return c=c(o),h=""===s?"."+I(o,0):s,k(c)?(i="",null!=h&&(i=h.replace(A,"$&/")+"/"),N(c,u,i,"",function(t){return t})):null!=c&&(x(c)&&(l=c,p=i+(null==c.key||o&&o.key===c.key?"":(""+c.key).replace(A,"$&/")+"/")+h,c=O(l.type,p,l.props)),u.push(c)),1;h=0;var v,b=""===s?".":s+":";if(k(o))for(var S=0;S{const n='string'==typeof u?(0,S.parseUrlUsingCustomBase)(u):u;if(n&&n instanceof URL)return`${n.pathname}${n.search}${n.hash}`},[]),{routerConfig:x,rootComponent:_}=(0,v.useRouterConfig)(o,j,O),{linking:N,routeNode:P}=x;return(0,s.useDomComponentNavigation)(),(0,n().jsx)(h.RouterConfigContext.Provider,{value:x,children:(0,n().jsx)(l.RemovalPreventionProvider,{children:(0,n().jsx)(f.NavigationContainer,{ref:p.navigationRef,linking:N,children:(0,n().jsx)(c,{children:(0,n().jsx)(U,{rootComponent:_})})})})})}function U({rootComponent:o}){const u=[(0,n().jsx)(_.Screen,{name:c.INTERNAL_SLOT_NAME,component:o},"SLOT")];(0,O.shouldAppendNotFound)()&&u.push((0,n().jsx)(_.Screen,{name:c.NOT_FOUND_ROUTE_NAME,component:y.RootUnmatched},"NOT-FOUND")),(0,O.shouldAppendSitemap)()&&u.push((0,n().jsx)(_.Screen,{name:c.SITEMAP_ROUTE_NAME,component:R.Sitemap},"SITEMAP"));const{state:s,descriptors:f,NavigationContent:p}=(0,N.useNavigationBuilder)(N.StackRouter,{children:u,id:c.INTERNAL_SLOT_NAME});return(0,t().useEffect)(()=>{(0,w.maybeHideSplashScreen)()},[]),(0,n().jsx)(p,{children:f[s.routes[s.index].key].render()})}},32,[24,30,33,288,295,296,380,356,392,381,375,689,407,676,524,427,768,668,355,769,757,667]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"unstable_createElement",{enumerable:!0,get:function(){return t.default}}),Object.defineProperty(_e,"findNodeHandle",{enumerable:!0,get:function(){return n.default}}),Object.defineProperty(_e,"processColor",{enumerable:!0,get:function(){return u.default}}),Object.defineProperty(_e,"render",{enumerable:!0,get:function(){return f.default}}),Object.defineProperty(_e,"unmountComponentAtNode",{enumerable:!0,get:function(){return o.default}}),Object.defineProperty(_e,"NativeModules",{enumerable:!0,get:function(){return l.default}}),Object.defineProperty(_e,"AccessibilityInfo",{enumerable:!0,get:function(){return c.default}}),Object.defineProperty(_e,"Alert",{enumerable:!0,get:function(){return b.default}}),Object.defineProperty(_e,"Animated",{enumerable:!0,get:function(){return p.default}}),Object.defineProperty(_e,"Appearance",{enumerable:!0,get:function(){return y.default}}),Object.defineProperty(_e,"AppRegistry",{enumerable:!0,get:function(){return P.default}}),Object.defineProperty(_e,"AppState",{enumerable:!0,get:function(){return O.default}}),Object.defineProperty(_e,"AssetRegistry",{enumerable:!0,get:function(){return j.default}}),Object.defineProperty(_e,"BackHandler",{enumerable:!0,get:function(){return s.default}}),Object.defineProperty(_e,"Clipboard",{enumerable:!0,get:function(){return h.default}}),Object.defineProperty(_e,"Dimensions",{enumerable:!0,get:function(){return A.default}}),Object.defineProperty(_e,"Easing",{enumerable:!0,get:function(){return v.default}}),Object.defineProperty(_e,"I18nManager",{enumerable:!0,get:function(){return S.default}}),Object.defineProperty(_e,"Keyboard",{enumerable:!0,get:function(){return I.default}}),Object.defineProperty(_e,"InteractionManager",{enumerable:!0,get:function(){return w.default}}),Object.defineProperty(_e,"LayoutAnimation",{enumerable:!0,get:function(){return B.default}}),Object.defineProperty(_e,"Linking",{enumerable:!0,get:function(){return k.default}}),Object.defineProperty(_e,"NativeEventEmitter",{enumerable:!0,get:function(){return x.default}}),Object.defineProperty(_e,"PanResponder",{enumerable:!0,get:function(){return C.default}}),Object.defineProperty(_e,"PixelRatio",{enumerable:!0,get:function(){return L.default}}),Object.defineProperty(_e,"Platform",{enumerable:!0,get:function(){return M.default}}),Object.defineProperty(_e,"Share",{enumerable:!0,get:function(){return T.default}}),Object.defineProperty(_e,"StyleSheet",{enumerable:!0,get:function(){return V.default}}),Object.defineProperty(_e,"UIManager",{enumerable:!0,get:function(){return _.default}}),Object.defineProperty(_e,"Vibration",{enumerable:!0,get:function(){return E.default}}),Object.defineProperty(_e,"ActivityIndicator",{enumerable:!0,get:function(){return N.default}}),Object.defineProperty(_e,"Button",{enumerable:!0,get:function(){return R.default}}),Object.defineProperty(_e,"CheckBox",{enumerable:!0,get:function(){return D.default}}),Object.defineProperty(_e,"FlatList",{enumerable:!0,get:function(){return F.default}}),Object.defineProperty(_e,"Image",{enumerable:!0,get:function(){return H.default}}),Object.defineProperty(_e,"ImageBackground",{enumerable:!0,get:function(){return K.default}}),Object.defineProperty(_e,"InputAccessoryView",{enumerable:!0,get:function(){return W.default}}),Object.defineProperty(_e,"KeyboardAvoidingView",{enumerable:!0,get:function(){return z.default}}),Object.defineProperty(_e,"Modal",{enumerable:!0,get:function(){return U.default}}),Object.defineProperty(_e,"Picker",{enumerable:!0,get:function(){return Y.default}}),Object.defineProperty(_e,"Pressable",{enumerable:!0,get:function(){return q.default}}),Object.defineProperty(_e,"ProgressBar",{enumerable:!0,get:function(){return G.default}}),Object.defineProperty(_e,"RefreshControl",{enumerable:!0,get:function(){return J.default}}),Object.defineProperty(_e,"SafeAreaView",{enumerable:!0,get:function(){return Q.default}}),Object.defineProperty(_e,"ScrollView",{enumerable:!0,get:function(){return X.default}}),Object.defineProperty(_e,"SectionList",{enumerable:!0,get:function(){return Z.default}}),Object.defineProperty(_e,"StatusBar",{enumerable:!0,get:function(){return $.default}}),Object.defineProperty(_e,"Switch",{enumerable:!0,get:function(){return ee.default}}),Object.defineProperty(_e,"Text",{enumerable:!0,get:function(){return te.default}}),Object.defineProperty(_e,"TextInput",{enumerable:!0,get:function(){return ne.default}}),Object.defineProperty(_e,"Touchable",{enumerable:!0,get:function(){return re.default}}),Object.defineProperty(_e,"TouchableHighlight",{enumerable:!0,get:function(){return ue.default}}),Object.defineProperty(_e,"TouchableNativeFeedback",{enumerable:!0,get:function(){return fe.default}}),Object.defineProperty(_e,"TouchableOpacity",{enumerable:!0,get:function(){return ae.default}}),Object.defineProperty(_e,"TouchableWithoutFeedback",{enumerable:!0,get:function(){return ie.default}}),Object.defineProperty(_e,"View",{enumerable:!0,get:function(){return oe.default}}),Object.defineProperty(_e,"VirtualizedList",{enumerable:!0,get:function(){return le.default}}),Object.defineProperty(_e,"YellowBox",{enumerable:!0,get:function(){return ce.default}}),Object.defineProperty(_e,"LogBox",{enumerable:!0,get:function(){return de.default}}),Object.defineProperty(_e,"DeviceEventEmitter",{enumerable:!0,get:function(){return be.default}}),Object.defineProperty(_e,"useColorScheme",{enumerable:!0,get:function(){return ge.default}}),Object.defineProperty(_e,"useLocaleContext",{enumerable:!0,get:function(){return pe.default}}),Object.defineProperty(_e,"useWindowDimensions",{enumerable:!0,get:function(){return me.default}});var t=e(r(d[0])),n=e(r(d[1])),u=e(r(d[2])),f=e(r(d[3])),o=e(r(d[4])),l=e(r(d[5])),c=e(r(d[6])),b=e(r(d[7])),p=e(r(d[8])),y=e(r(d[9])),P=e(r(d[10])),O=e(r(d[11])),j=e(r(d[12])),s=e(r(d[13])),h=e(r(d[14])),A=e(r(d[15])),v=e(r(d[16])),S=e(r(d[17])),I=e(r(d[18])),w=e(r(d[19])),B=e(r(d[20])),k=e(r(d[21])),x=e(r(d[22])),C=e(r(d[23])),L=e(r(d[24])),M=e(r(d[25])),T=e(r(d[26])),V=e(r(d[27])),_=e(r(d[28])),E=e(r(d[29])),N=e(r(d[30])),R=e(r(d[31])),D=e(r(d[32])),F=e(r(d[33])),H=e(r(d[34])),K=e(r(d[35])),W=e(r(d[36])),z=e(r(d[37])),U=e(r(d[38])),Y=e(r(d[39])),q=e(r(d[40])),G=e(r(d[41])),J=e(r(d[42])),Q=e(r(d[43])),X=e(r(d[44])),Z=e(r(d[45])),$=e(r(d[46])),ee=e(r(d[47])),te=e(r(d[48])),ne=e(r(d[49])),re=e(r(d[50])),ue=e(r(d[51])),fe=e(r(d[52])),ae=e(r(d[53])),ie=e(r(d[54])),oe=e(r(d[55])),le=e(r(d[56])),ce=e(r(d[57])),de=e(r(d[58])),be=e(r(d[59])),ge=e(r(d[60])),pe=e(r(d[61])),me=e(r(d[62]))},33,[34,103,53,104,111,112,118,119,120,227,228,231,232,233,234,152,224,235,236,159,237,239,240,241,199,122,244,46,113,245,246,247,251,125,196,252,253,255,256,261,263,268,150,269,151,202,270,271,206,273,274,278,279,248,280,127,281,282,283,284,285,286,287]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return o}});var t=e(r(d[0])),n=e(r(d[1])),l=e(r(d[2])),u=r(d[3]),o=(e,o,c)=>{var f;e&&e.constructor===String&&(f=t.default.propsToAccessibilityComponent(o));var s=f||e,_=(0,n.default)(s,o,c),p=l.default.createElement(s,_);return _.dir?l.default.createElement(u.LocaleProvider,{children:p,direction:_.dir,locale:_.lang}):p}},34,[35,39,30,101]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return n}});var t=e(r(d[0])),u=e(r(d[1])),o=e(r(d[2])),n={isDisabled:t.default,propsToAccessibilityComponent:u.default,propsToAriaRole:o.default}},35,[36,37,38]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}});var t=t=>t.disabled||Array.isArray(t.accessibilityStates)&&t.accessibilityStates.indexOf('disabled')>-1},36,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u}});var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},o={article:'article',banner:'header',blockquote:'blockquote',button:'button',code:'code',complementary:'aside',contentinfo:'footer',deletion:'del',emphasis:'em',figure:'figure',insertion:'ins',form:'form',list:'ul',listitem:'li',main:'main',navigation:'nav',paragraph:'p',region:'section',strong:'strong'},l={},u=function(e){if(void 0===e&&(e=l),'label'===(e.role||e.accessibilityRole))return'label';var t=(0,n.default)(e);if(t){if('heading'===t){var u=e.accessibilityLevel||e['aria-level'];return null!=u?"h"+u:'h1'}return o[t]}}},37,[38]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}});var n={adjustable:'slider',button:'button',header:'heading',image:'img',imagebutton:null,keyboardkey:null,label:null,link:'link',none:'presentation',search:'search',summary:'region',text:null},t=t=>{var l=t.accessibilityRole,u=t.role||l;if(u){var o=n[u];if(null!==o)return o||u}}},38,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";function l(l){return l&&l.__esModule?l:{default:l}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return f}});var e=l(r(d[0])),t=l(r(d[1])),s=l(r(d[2])),c=l(r(d[3])),n=["aria-activedescendant","accessibilityActiveDescendant","aria-atomic","accessibilityAtomic","aria-autocomplete","accessibilityAutoComplete","aria-busy","accessibilityBusy","aria-checked","accessibilityChecked","aria-colcount","accessibilityColumnCount","aria-colindex","accessibilityColumnIndex","aria-colspan","accessibilityColumnSpan","aria-controls","accessibilityControls","aria-current","accessibilityCurrent","aria-describedby","accessibilityDescribedBy","aria-details","accessibilityDetails","aria-disabled","accessibilityDisabled","aria-errormessage","accessibilityErrorMessage","aria-expanded","accessibilityExpanded","aria-flowto","accessibilityFlowTo","aria-haspopup","accessibilityHasPopup","aria-hidden","accessibilityHidden","aria-invalid","accessibilityInvalid","aria-keyshortcuts","accessibilityKeyShortcuts","aria-label","accessibilityLabel","aria-labelledby","accessibilityLabelledBy","aria-level","accessibilityLevel","aria-live","accessibilityLiveRegion","aria-modal","accessibilityModal","aria-multiline","accessibilityMultiline","aria-multiselectable","accessibilityMultiSelectable","aria-orientation","accessibilityOrientation","aria-owns","accessibilityOwns","aria-placeholder","accessibilityPlaceholder","aria-posinset","accessibilityPosInSet","aria-pressed","accessibilityPressed","aria-readonly","accessibilityReadOnly","aria-required","accessibilityRequired","role","accessibilityRole","aria-roledescription","accessibilityRoleDescription","aria-rowcount","accessibilityRowCount","aria-rowindex","accessibilityRowIndex","aria-rowspan","accessibilityRowSpan","aria-selected","accessibilitySelected","aria-setsize","accessibilitySetSize","aria-sort","accessibilitySort","aria-valuemax","accessibilityValueMax","aria-valuemin","accessibilityValueMin","aria-valuenow","accessibilityValueNow","aria-valuetext","accessibilityValueText","dataSet","focusable","id","nativeID","pointerEvents","style","tabIndex","testID"],u={},o=Object.prototype.hasOwnProperty,b=Array.isArray,y=/[A-Z]/g;function v(l){return'-'+l.toLowerCase()}function p(l){return l.replace(y,v)}function x(l){return b(l)?l.join(' '):l}var w=c.default.create({auto:{pointerEvents:'auto'},'box-none':{pointerEvents:'box-none'},'box-only':{pointerEvents:'box-only'},none:{pointerEvents:'none'}}),f=(l,b,y)=>{b||(b=u);var v=b,f=v['aria-activedescendant'],h=v.accessibilityActiveDescendant,S=v['aria-atomic'],C=v.accessibilityAtomic,I=v['aria-autocomplete'],R=v.accessibilityAutoComplete,D=v['aria-busy'],M=v.accessibilityBusy,O=v['aria-checked'],P=v.accessibilityChecked,k=v['aria-colcount'],A=v.accessibilityColumnCount,E=v['aria-colindex'],L=v.accessibilityColumnIndex,V=v['aria-colspan'],q=v.accessibilityColumnSpan,B=v['aria-controls'],_=v.accessibilityControls,z=v['aria-current'],T=v.accessibilityCurrent,j=v['aria-describedby'],H=v.accessibilityDescribedBy,N=v['aria-details'],F=v.accessibilityDetails,K=v['aria-disabled'],Z=v.accessibilityDisabled,G=v['aria-errormessage'],J=v.accessibilityErrorMessage,Q=v['aria-expanded'],U=v.accessibilityExpanded,W=v['aria-flowto'],X=v.accessibilityFlowTo,Y=v['aria-haspopup'],$=v.accessibilityHasPopup,aa=v['aria-hidden'],ia=v.accessibilityHidden,la=v['aria-invalid'],ea=v.accessibilityInvalid,ra=v['aria-keyshortcuts'],ta=v.accessibilityKeyShortcuts,sa=v['aria-label'],ca=v.accessibilityLabel,na=v['aria-labelledby'],ua=v.accessibilityLabelledBy,oa=v['aria-level'],ba=v.accessibilityLevel,da=v['aria-live'],ya=v.accessibilityLiveRegion,va=v['aria-modal'],pa=v.accessibilityModal,xa=v['aria-multiline'],ma=v.accessibilityMultiline,wa=v['aria-multiselectable'],fa=v.accessibilityMultiSelectable,ha=v['aria-orientation'],Sa=v.accessibilityOrientation,Ca=v['aria-owns'],Ia=v.accessibilityOwns,Ra=v['aria-placeholder'],Da=v.accessibilityPlaceholder,Ma=v['aria-posinset'],Oa=v.accessibilityPosInSet,Pa=v['aria-pressed'],ga=v.accessibilityPressed,ka=v['aria-readonly'],Aa=v.accessibilityReadOnly,Ea=v['aria-required'],La=v.accessibilityRequired,Va=(v.role,v.accessibilityRole,v['aria-roledescription']),qa=v.accessibilityRoleDescription,Ba=v['aria-rowcount'],_a=v.accessibilityRowCount,za=v['aria-rowindex'],Ta=v.accessibilityRowIndex,ja=v['aria-rowspan'],Ha=v.accessibilityRowSpan,Na=v['aria-selected'],Fa=v.accessibilitySelected,Ka=v['aria-setsize'],Za=v.accessibilitySetSize,Ga=v['aria-sort'],Ja=v.accessibilitySort,Qa=v['aria-valuemax'],Ua=v.accessibilityValueMax,Wa=v['aria-valuemin'],Xa=v.accessibilityValueMin,Ya=v['aria-valuenow'],$a=v.accessibilityValueNow,ai=v['aria-valuetext'],ii=v.accessibilityValueText,li=v.dataSet,ei=v.focusable,ri=v.id,ti=v.nativeID,si=v.pointerEvents,ci=v.style,ni=v.tabIndex,ui=v.testID,oi=(0,t.default)(v,n),bi=K||Z,di=s.default.propsToAriaRole(b),yi=null!=f?f:h;null!=yi&&(oi['aria-activedescendant']=yi);var vi=null!=S?f:C;null!=vi&&(oi['aria-atomic']=vi);var pi=null!=I?I:R;null!=pi&&(oi['aria-autocomplete']=pi);var xi=null!=D?D:M;null!=xi&&(oi['aria-busy']=xi);var mi=null!=O?O:P;null!=mi&&(oi['aria-checked']=mi);var wi=null!=k?k:A;null!=wi&&(oi['aria-colcount']=wi);var fi=null!=E?E:L;null!=fi&&(oi['aria-colindex']=fi);var hi=null!=V?V:q;null!=hi&&(oi['aria-colspan']=hi);var Si=null!=B?B:_;null!=Si&&(oi['aria-controls']=x(Si));var Ci=null!=z?z:T;null!=Ci&&(oi['aria-current']=Ci);var Ii=null!=j?j:H;null!=Ii&&(oi['aria-describedby']=x(Ii));var Ri=null!=N?N:F;null!=Ri&&(oi['aria-details']=Ri),!0===bi&&(oi['aria-disabled']=!0,'button'!==l&&'form'!==l&&'input'!==l&&'select'!==l&&'textarea'!==l||(oi.disabled=!0));var Di=null!=G?G:J;null!=Di&&(oi['aria-errormessage']=Di);var Mi=null!=Q?Q:U;null!=Mi&&(oi['aria-expanded']=Mi);var Oi=null!=W?W:X;null!=Oi&&(oi['aria-flowto']=x(Oi));var Pi=null!=Y?Y:$;null!=Pi&&(oi['aria-haspopup']=Pi);var gi=null!=aa?aa:ia;!0===gi&&(oi['aria-hidden']=gi);var ki=null!=la?la:ea;null!=ki&&(oi['aria-invalid']=ki);var Ai=null!=ra?ra:ta;null!=Ai&&(oi['aria-keyshortcuts']=x(Ai));var Ei=null!=sa?sa:ca;null!=Ei&&(oi['aria-label']=Ei);var Li=null!=na?na:ua;null!=Li&&(oi['aria-labelledby']=x(Li));var Vi=null!=oa?oa:ba;null!=Vi&&(oi['aria-level']=Vi);var qi=null!=da?da:ya;null!=qi&&(oi['aria-live']='none'===qi?'off':qi);var Bi=null!=va?va:pa;null!=Bi&&(oi['aria-modal']=Bi);var _i=null!=xa?xa:ma;null!=_i&&(oi['aria-multiline']=_i);var zi=null!=wa?wa:fa;null!=zi&&(oi['aria-multiselectable']=zi);var Ti=null!=ha?ha:Sa;null!=Ti&&(oi['aria-orientation']=Ti);var ji=null!=Ca?Ca:Ia;null!=ji&&(oi['aria-owns']=x(ji));var Hi=null!=Ra?Ra:Da;null!=Hi&&(oi['aria-placeholder']=Hi);var Ni=null!=Ma?Ma:Oa;null!=Ni&&(oi['aria-posinset']=Ni);var Fi=null!=Pa?Pa:ga;null!=Fi&&(oi['aria-pressed']=Fi);var Ki=null!=ka?ka:Aa;null!=Ki&&(oi['aria-readonly']=Ki,'input'!==l&&'select'!==l&&'textarea'!==l||(oi.readOnly=!0));var Zi=null!=Ea?Ea:La;null!=Zi&&(oi['aria-required']=Zi,'input'!==l&&'select'!==l&&'textarea'!==l||(oi.required=La)),null!=di&&(oi.role='none'===di?'presentation':di);var Gi=null!=Va?Va:qa;null!=Gi&&(oi['aria-roledescription']=Gi);var Ji=null!=Ba?Ba:_a;null!=Ji&&(oi['aria-rowcount']=Ji);var Qi=null!=za?za:Ta;null!=Qi&&(oi['aria-rowindex']=Qi);var Ui=null!=ja?ja:Ha;null!=Ui&&(oi['aria-rowspan']=Ui);var Wi=null!=Na?Na:Fa;null!=Wi&&(oi['aria-selected']=Wi);var Xi=null!=Ka?Ka:Za;null!=Xi&&(oi['aria-setsize']=Xi);var Yi=null!=Ga?Ga:Ja;null!=Yi&&(oi['aria-sort']=Yi);var $i=null!=Qa?Qa:Ua;null!=$i&&(oi['aria-valuemax']=$i);var al=null!=Wa?Wa:Xa;null!=al&&(oi['aria-valuemin']=al);var il=null!=Ya?Ya:$a;null!=il&&(oi['aria-valuenow']=il);var ll=null!=ai?ai:ii;if(null!=ll&&(oi['aria-valuetext']=ll),null!=li)for(var el in li)if(o.call(li,el)){var rl=p(el),tl=li[el];null!=tl&&(oi["data-"+rl]=tl)}0===ni||'0'===ni||-1===ni||'-1'===ni?oi.tabIndex=ni:(!1===ei&&(oi.tabIndex='-1'),'a'===l||'button'===l||'input'===l||'select'===l||'textarea'===l?!1!==ei&&!0!==Z||(oi.tabIndex='-1'):'button'===di||'checkbox'===di||'link'===di||'radio'===di||'textbox'===di||'switch'===di?!1!==ei&&(oi.tabIndex='0'):!0===ei&&(oi.tabIndex='0'));var sl=(0,c.default)([ci,si&&w[si]],(0,e.default)({writingDirection:'ltr'},y)),cl=sl[0],nl=sl[1];cl&&(oi.className=cl),nl&&(oi.style=nl);var ul=null!=ri?ri:ti;return null!=ul&&(oi.id=ul),null!=ui&&(oi['data-testid']=ui),null==oi.type&&'button'===l&&(oi.type='button'),oi}},39,[40,45,35,46]); +__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return o}});var e,t=_r(d[0]),r=(e=t)&&e.__esModule?e:{default:e};function n(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function o(e){for(var t=1;t{var e=t[0],n=t[1];null!=v&&e.forEach(t=>{v.insert(t,n)})})}function p(t,e){var n=(0,i.classic)(t,e),o=n[0];return h(n[1]),o}var b={position:'absolute',left:0,right:0,top:0,bottom:0},y=A({x:(0,e.default)({},b)}).x;function A(t){return Object.keys(t).forEach(e=>{var n,o,l,c,f=t[e];null!=f&&!0!==f.$$css&&(e.indexOf('$raw')>-1?n=p(f,e.split('$raw')[0]):(o=f,l=(0,i.atomic)((0,u.preprocess)(o,O)),c=l[0],h(l[1]),n=c),_.set(f,n))}),t}function E(t,e){void 0===e&&(e={});var n='rtl'===e.writingDirection,o=w(t,e);return Array.isArray(o)&&null!=o[1]&&(o[1]=(0,i.inline)(o[1],n)),o}E.absoluteFill=y,E.absoluteFillObject=b,E.create=A,E.compose=function(t,e){return[t,e]},E.flatten=function(){for(var t=arguments.length,e=new Array(t),n=0;n{var o=n[t];if(null!=o){var l;if(P.indexOf(t)>-1){var s=i(t,t,'left'),u=i(t,t,'right');'start'===o?l=[s,u]:'end'===o&&(l=[u,s])}var f=N[t];if(null!=f){var p=i(t,f,o),c=i(t,_[f],o);l=[p,c]}if('transitionProperty'===t){for(var b=Array.isArray(o)?o:[o],h=[],v=0;v0){var S=[...b],E=[...b];h.forEach(n=>{var e=S[n];if('string'==typeof e){var o=N[e],s=_[o];S[n]=o,E[n]=s;var u=i(t,t,S),f=i(t,t,E);l=[u,f]}})}}null==l?l=i(t,t,o):e.$$css$localize=!0,e[t]=l}}),[e,t]},_e.classic=function(n,i){var o,l={$$css:!0},s=[],u=n.animationKeyframes,p=(0,t.default)(n,f),c=T('css',i,JSON.stringify(n)),h="."+c;if(null!=u){var v=V(u),y=v[0],S=v[1];o=y.join(','),s.push(...S)}var E=M((0,e.default)((0,e.default)({},p),{},{animationName:o}));return s.push(""+h+E),l[c]=c,[l,[[s,b]]]},_e.inline=function(n,e){var t=n||c,o={},l={},s=function(){var n=t[u],i=u,s=n;if(!Object.prototype.hasOwnProperty.call(t,u)||null==n)return 1;P.indexOf(u)>-1&&('start'===n?s=e?'right':'left':'end'===n&&(s=e?'left':'right'));var f=N[u];if(null!=f&&(i=e?_[f]:f),'transitionProperty'===u){var p=Array.isArray(n)?n:[n];p.forEach((n,t)=>{if('string'==typeof n){var i=N[n];null!=i&&(p[t]=e?_[i]:i,s=p.join(' '))}})}o[i]||(l[i]=s),i===u&&(o[i]=!0)};for(var u in t)s();return(0,i.default)(l,!0)},_e.stringifyValueWithProperty=J;var e=n(r(d[0])),t=n(r(d[1])),i=n(r(d[2])),o=n(r(d[3])),l=n(r(d[4])),s=n(r(d[5])),u=n(r(d[6])),f=["animationKeyframes"],p=new Map,c={},b=1,h=3,v={borderColor:2,borderRadius:2,borderStyle:2,borderWidth:2,display:2,flex:2,inset:2,margin:2,overflow:2,overscrollBehavior:2,padding:2,insetBlock:2.1,insetInline:2.1,marginInline:2.1,marginBlock:2.1,paddingInline:2.1,paddingBlock:2.1,borderBlockStartColor:2.2,borderBlockStartStyle:2.2,borderBlockStartWidth:2.2,borderBlockEndColor:2.2,borderBlockEndStyle:2.2,borderBlockEndWidth:2.2,borderInlineStartColor:2.2,borderInlineStartStyle:2.2,borderInlineStartWidth:2.2,borderInlineEndColor:2.2,borderInlineEndStyle:2.2,borderInlineEndWidth:2.2,borderEndStartRadius:2.2,borderEndEndRadius:2.2,borderStartStartRadius:2.2,borderStartEndRadius:2.2,insetBlockEnd:2.2,insetBlockStart:2.2,insetInlineEnd:2.2,insetInlineStart:2.2,marginBlockStart:2.2,marginBlockEnd:2.2,marginInlineStart:2.2,marginInlineEnd:2.2,paddingBlockStart:2.2,paddingBlockEnd:2.2,paddingInlineStart:2.2,paddingInlineEnd:2.2},y='borderTopLeftRadius',S='borderTopRightRadius',E='borderBottomLeftRadius',I='borderBottomRightRadius',k='borderLeftColor',R='borderLeftStyle',B='borderLeftWidth',W='borderRightColor',j='borderRightStyle',C='borderRightWidth',O='right',w='marginLeft',A='marginRight',x='paddingLeft',L='paddingRight',$='left',_={[y]:S,[S]:y,[E]:I,[I]:E,[k]:W,[R]:j,[B]:C,[W]:k,[j]:R,[C]:B,[$]:O,[w]:A,[A]:w,[x]:L,[L]:x,[O]:$},N={borderStartStartRadius:y,borderStartEndRadius:S,borderEndStartRadius:E,borderEndEndRadius:I,borderInlineStartColor:k,borderInlineStartStyle:R,borderInlineStartWidth:B,borderInlineEndColor:W,borderInlineEndStyle:j,borderInlineEndWidth:C,insetInlineEnd:O,insetInlineStart:$,marginInlineStart:w,marginInlineEnd:A,paddingInlineStart:x,paddingInlineEnd:L},P=['clear','float','textAlign'];function J(n,e){var t=(0,s.default)(n,e);return'string'!=typeof t?JSON.stringify(t||''):t}function K(n,e,t){var i=[],o="."+n;switch(e){case'animationKeyframes':var l=V(t),s=l[0],u=l[1],f=M({animationName:s.join(',')});i.push(""+o+f,...u);break;case'placeholderTextColor':var p=M({color:t,opacity:1});i.push(o+"::-webkit-input-placeholder"+p,o+"::-moz-placeholder"+p,o+":-ms-input-placeholder"+p,o+"::placeholder"+p);break;case'pointerEvents':var c=t;if('auto'===t)c='auto!important';else if('none'===t){c='none!important';var b=M({pointerEvents:'none'});i.push(o+">* "+b)}else if('box-none'===t){c='none!important';var h=M({pointerEvents:'auto'});i.push(o+">* "+h)}else if('box-only'===t){c='auto!important';var v=M({pointerEvents:'none'});i.push(o+">* "+v)}var y=M({pointerEvents:c});i.push(""+o+y);break;case'scrollbarWidth':'none'===t&&i.push(o+"::-webkit-scrollbar{display:none}");var S=M({scrollbarWidth:t});i.push(""+o+S);break;default:var E=M({[e]:t});i.push(""+o+E)}return i}function M(n){var e=(0,u.default)((0,i.default)(n));return"{"+Object.keys(e).map(n=>{var t=e[n],i=(0,l.default)(n);return Array.isArray(t)?t.map(n=>i+":"+n).join(';'):i+":"+t}).sort().join(';')+";}"}function T(n,e,t){return n+"-"+(0,o.default)(e+t)}function z(n){var e=T('r','animation',JSON.stringify(n)),t='{'+Object.keys(n).map(e=>""+e+M(n[e])).join('')+'}',i=['-webkit-',''].map(n=>"@"+n+"keyframes "+e+t);return[e,i]}function V(n){if('number'==typeof n)throw new Error("Invalid CSS keyframes type: "+typeof n);var e=[],t=[];return(Array.isArray(n)?n:[n]).forEach(n=>{if('string'==typeof n)e.push(n);else{var i=z(n),o=i[0],l=i[1];e.push(o),t.push(...l)}}),[e,t]}},47,[40,45,48,56,57,49,58]); +__d(function(g,r,_i,a,m,_e,d){"use strict";function o(o){return o&&o.__esModule?o:{default:o}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return p}});var e=o(r(d[0])),t=o(r(d[1])),i={},n=!t.default||null!=window.CSS&&null!=window.CSS.supports&&(window.CSS.supports('text-decoration-line','none')||window.CSS.supports('-webkit-text-decoration-line','none')),l='-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif',b={borderColor:['borderTopColor','borderRightColor','borderBottomColor','borderLeftColor'],borderBlockColor:['borderTopColor','borderBottomColor'],borderInlineColor:['borderRightColor','borderLeftColor'],borderRadius:['borderTopLeftRadius','borderTopRightRadius','borderBottomRightRadius','borderBottomLeftRadius'],borderStyle:['borderTopStyle','borderRightStyle','borderBottomStyle','borderLeftStyle'],borderBlockStyle:['borderTopStyle','borderBottomStyle'],borderInlineStyle:['borderRightStyle','borderLeftStyle'],borderWidth:['borderTopWidth','borderRightWidth','borderBottomWidth','borderLeftWidth'],borderBlockWidth:['borderTopWidth','borderBottomWidth'],borderInlineWidth:['borderRightWidth','borderLeftWidth'],insetBlock:['top','bottom'],insetInline:['left','right'],marginBlock:['marginTop','marginBottom'],marginInline:['marginRight','marginLeft'],paddingBlock:['paddingTop','paddingBottom'],paddingInline:['paddingRight','paddingLeft'],overflow:['overflowX','overflowY'],overscrollBehavior:['overscrollBehaviorX','overscrollBehaviorY'],borderBlockStartColor:['borderTopColor'],borderBlockStartStyle:['borderTopStyle'],borderBlockStartWidth:['borderTopWidth'],borderBlockEndColor:['borderBottomColor'],borderBlockEndStyle:['borderBottomStyle'],borderBlockEndWidth:['borderBottomWidth'],borderEndStartRadius:['borderBottomLeftRadius'],borderEndEndRadius:['borderBottomRightRadius'],borderStartStartRadius:['borderTopLeftRadius'],borderStartEndRadius:['borderTopRightRadius'],insetBlockEnd:['bottom'],insetBlockStart:['top'],marginBlockStart:['marginTop'],marginBlockEnd:['marginBottom'],paddingBlockStart:['paddingTop'],paddingBlockEnd:['paddingBottom']},p=(o,t)=>{if(!o)return i;var p={},s=function(){var i=o[f];if(null==i)return 1;if('backgroundClip'===f)'text'===i&&(p.backgroundClip=i,p.WebkitBackgroundClip=i);else if('flex'===f)-1===i?(p.flexGrow=0,p.flexShrink=1,p.flexBasis='auto'):p.flex=i;else if('font'===f)p[f]=i.replace('System',l);else if('fontFamily'===f)if(i.indexOf('System')>-1){var s=i.split(/,\s*/);s[s.indexOf('System')]=l,p[f]=s.join(',')}else p[f]='monospace'===i?"monospace,monospace":i;else if('textDecorationLine'===f)n?p.textDecorationLine=i:p.textDecoration=i;else if('writingDirection'===f)p.direction=i;else{var c=(0,e.default)(o[f],f),u=b[f];t&&'inset'===f?(null==o.insetInline&&(p.left=c,p.right=c),null==o.insetBlock&&(p.top=c,p.bottom=c)):t&&'margin'===f?(null==o.marginInline&&(p.marginLeft=c,p.marginRight=c),null==o.marginBlock&&(p.marginTop=c,p.marginBottom=c)):t&&'padding'===f?(null==o.paddingInline&&(p.paddingLeft=c,p.paddingRight=c),null==o.paddingBlock&&(p.paddingTop=c,p.paddingBottom=c)):u?u.forEach((e,t)=>{null==o[e]&&(p[e]=c)}):p[f]=c}};for(var f in o)s();return p}},48,[49,55]); +__d(function(g,r,i,a,m,_e,d){"use strict";function o(o){return o&&o.__esModule?o:{default:o}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u}});var e=o(r(d[0])),t=o(r(d[1])),l={backgroundColor:!0,borderColor:!0,borderTopColor:!0,borderRightColor:!0,borderBottomColor:!0,borderLeftColor:!0,color:!0,shadowColor:!0,textDecorationColor:!0,textShadowColor:!0};function u(o,u){var n=o;return null!=u&&e.default[u]||'number'!=typeof o?null!=u&&l[u]&&(n=(0,t.default)(o)):n=o+"px",n}},49,[50,51]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return n}});var t={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,flex:!0,flexGrow:!0,flexOrder:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,fontWeight:!0,gridRow:!0,gridRowEnd:!0,gridRowGap:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnGap:!0,gridColumnStart:!0,lineClamp:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0,scale:!0,scaleX:!0,scaleY:!0,scaleZ:!0,shadowOpacity:!0},o=['ms','Moz','O','Webkit'],l=(t,o)=>t+o.charAt(0).toUpperCase()+o.substring(1);Object.keys(t).forEach(n=>{o.forEach(o=>{t[l(o,n)]=t[n]})});var n=t},50,[]); +__d(function(_g,_r,i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return n}});var t=e(_r(d[0])),u=e(_r(d[1])),n=function(e,n){if(void 0===n&&(n=1),null!=e){if('string'==typeof e&&(0,t.default)(e))return e;var r=(0,u.default)(e);if(null!=r)return"rgba("+(r>>16&255)+","+(r>>8&255)+","+(255&r)+","+((r>>24&255)/255*n).toFixed(2)+")"}}},51,[52,53]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}});var t=t=>'currentcolor'===t||'currentColor'===t||'inherit'===t||0===t.indexOf('var(')},52,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return n}});var e,t=r(d[0]),u=(e=t)&&e.__esModule?e:{default:e},n=e=>{if(null==e)return e;var t=(0,u.default)(e);return null!=t?t=(t<<24|t>>>8)>>>0:void 0}},53,[54]); +__d(function(_g,_r,i,a,m,e,d){'use strict';function r(r,n,t){return t<0&&(t+=1),t>1&&(t-=1),t<.16666666666666666?r+6*(n-r)*t:t<.5?n:t<.6666666666666666?r+(n-r)*(.6666666666666666-t)*6:r}function n(n,t,s){const u=s<.5?s*(1+t):s+t-s*t,c=2*s-u,l=r(c,u,n+.3333333333333333),o=r(c,u,n),g=r(c,u,n-.3333333333333333);return Math.round(255*l)<<24|Math.round(255*o)<<16|Math.round(255*g)<<8}function t(n,t,s){if(t+s>=1){const r=Math.round(255*t/(t+s));return r<<24|r<<16|r<<8}const u=r(0,1,n+.3333333333333333)*(1-t-s)+t,c=r(0,1,n)*(1-t-s)+t,l=r(0,1,n-.3333333333333333)*(1-t-s)+t;return Math.round(255*u)<<24|Math.round(255*c)<<16|Math.round(255*l)<<8}const s='[-+]?\\d*\\.?\\d+',u="[-+]?\\d*\\.?\\d+%";function c(...r){return'\\(\\s*('+r.join(')\\s*,?\\s*(')+')\\s*\\)'}function l(...r){return'\\(\\s*('+r.slice(0,r.length-1).join(')\\s*,?\\s*(')+')\\s*/\\s*('+r[r.length-1]+')\\s*\\)'}function o(...r){return'\\(\\s*('+r.join(')\\s*,\\s*(')+')\\s*\\)'}let g;function h(){return void 0===g&&(g={rgb:new RegExp('rgb'+c(s,s,s)),rgba:new RegExp('rgba('+o(s,s,s,s)+'|'+l(s,s,s,s)+')'),hsl:new RegExp('hsl'+c(s,u,u)),hsla:new RegExp('hsla('+o(s,u,u,s)+'|'+l(s,u,u,s)+')'),hwb:new RegExp('hwb'+c(s,u,u)),hex3:/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex4:/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#([0-9a-fA-F]{6})$/,hex8:/^#([0-9a-fA-F]{8})$/}),g}function b(r){const n=parseInt(r,10);return n<0?0:n>255?255:n}function p(r){return(parseFloat(r)%360+360)%360/360}function f(r){const n=parseFloat(r);return n<0?0:n>1?255:Math.round(255*n)}function y(r){const n=parseFloat(r);return n<0?0:n>100?1:n/100}function k(r){switch(r){case'transparent':return 0;case'aliceblue':return 4042850303;case'antiquewhite':return 4209760255;case'aqua':case'cyan':return 16777215;case'aquamarine':return 2147472639;case'azure':return 4043309055;case'beige':return 4126530815;case'bisque':return 4293182719;case'black':return 255;case'blanchedalmond':return 4293643775;case'blue':return 65535;case'blueviolet':return 2318131967;case'brown':return 2771004159;case'burlywood':return 3736635391;case'burntsienna':return 3934150143;case'cadetblue':return 1604231423;case'chartreuse':return 2147418367;case'chocolate':return 3530104575;case'coral':return 4286533887;case'cornflowerblue':return 1687547391;case'cornsilk':return 4294499583;case'crimson':return 3692313855;case'darkblue':return 35839;case'darkcyan':return 9145343;case'darkgoldenrod':return 3095792639;case'darkgray':case'darkgrey':return 2846468607;case'darkgreen':return 6553855;case'darkkhaki':return 3182914559;case'darkmagenta':return 2332068863;case'darkolivegreen':return 1433087999;case'darkorange':return 4287365375;case'darkorchid':return 2570243327;case'darkred':return 2332033279;case'darksalmon':return 3918953215;case'darkseagreen':return 2411499519;case'darkslateblue':return 1211993087;case'darkslategray':case'darkslategrey':return 793726975;case'darkturquoise':return 13554175;case'darkviolet':return 2483082239;case'deeppink':return 4279538687;case'deepskyblue':return 12582911;case'dimgray':case'dimgrey':return 1768516095;case'dodgerblue':return 512819199;case'firebrick':return 2988581631;case'floralwhite':return 4294635775;case'forestgreen':return 579543807;case'fuchsia':case'magenta':return 4278255615;case'gainsboro':return 3705462015;case'ghostwhite':return 4177068031;case'gold':return 4292280575;case'goldenrod':return 3668254975;case'gray':case'grey':return 2155905279;case'green':return 8388863;case'greenyellow':return 2919182335;case'honeydew':return 4043305215;case'hotpink':return 4285117695;case'indianred':return 3445382399;case'indigo':return 1258324735;case'ivory':return 4294963455;case'khaki':return 4041641215;case'lavender':return 3873897215;case'lavenderblush':return 4293981695;case'lawngreen':return 2096890111;case'lemonchiffon':return 4294626815;case'lightblue':return 2916673279;case'lightcoral':return 4034953471;case'lightcyan':return 3774873599;case'lightgoldenrodyellow':return 4210742015;case'lightgray':case'lightgrey':return 3553874943;case'lightgreen':return 2431553791;case'lightpink':return 4290167295;case'lightsalmon':return 4288707327;case'lightseagreen':return 548580095;case'lightskyblue':return 2278488831;case'lightslategray':case'lightslategrey':return 2005441023;case'lightsteelblue':return 2965692159;case'lightyellow':return 4294959359;case'lime':return 16711935;case'limegreen':return 852308735;case'linen':return 4210091775;case'maroon':return 2147483903;case'mediumaquamarine':return 1724754687;case'mediumblue':return 52735;case'mediumorchid':return 3126187007;case'mediumpurple':return 2473647103;case'mediumseagreen':return 1018393087;case'mediumslateblue':return 2070474495;case'mediumspringgreen':return 16423679;case'mediumturquoise':return 1221709055;case'mediumvioletred':return 3340076543;case'midnightblue':return 421097727;case'mintcream':return 4127193855;case'mistyrose':return 4293190143;case'moccasin':return 4293178879;case'navajowhite':return 4292783615;case'navy':return 33023;case'oldlace':return 4260751103;case'olive':return 2155872511;case'olivedrab':return 1804477439;case'orange':return 4289003775;case'orangered':return 4282712319;case'orchid':return 3664828159;case'palegoldenrod':return 4008225535;case'palegreen':return 2566625535;case'paleturquoise':return 2951671551;case'palevioletred':return 3681588223;case'papayawhip':return 4293907967;case'peachpuff':return 4292524543;case'peru':return 3448061951;case'pink':return 4290825215;case'plum':return 3718307327;case'powderblue':return 2967529215;case'purple':return 2147516671;case'rebeccapurple':return 1714657791;case'red':return 4278190335;case'rosybrown':return 3163525119;case'royalblue':return 1097458175;case'saddlebrown':return 2336560127;case'salmon':return 4202722047;case'sandybrown':return 4104413439;case'seagreen':return 780883967;case'seashell':return 4294307583;case'sienna':return 2689740287;case'silver':return 3233857791;case'skyblue':return 2278484991;case'slateblue':return 1784335871;case'slategray':case'slategrey':return 1887473919;case'snow':return 4294638335;case'springgreen':return 16744447;case'steelblue':return 1182971135;case'tan':return 3535047935;case'teal':return 8421631;case'thistle':return 3636451583;case'tomato':return 4284696575;case'turquoise':return 1088475391;case'violet':return 4001558271;case'wheat':return 4125012991;case'white':return 4294967295;case'whitesmoke':return 4126537215;case'yellow':return 4294902015;case'yellowgreen':return 2597139199}return null}m.exports=function(r){if('number'==typeof r)return r>>>0===r&&r>=0&&r<=4294967295?r:null;if('string'!=typeof r)return null;const s=h();let u;if(u=s.hex6.exec(r))return parseInt(u[1]+'ff',16)>>>0;const c=k(r);return null!=c?c:(u=s.rgb.exec(r))?(b(u[1])<<24|b(u[2])<<16|b(u[3])<<8|255)>>>0:(u=s.rgba.exec(r))?void 0!==u[6]?(b(u[6])<<24|b(u[7])<<16|b(u[8])<<8|f(u[9]))>>>0:(b(u[2])<<24|b(u[3])<<16|b(u[4])<<8|f(u[5]))>>>0:(u=s.hex3.exec(r))?parseInt(u[1]+u[1]+u[2]+u[2]+u[3]+u[3]+'ff',16)>>>0:(u=s.hex8.exec(r))?parseInt(u[1],16)>>>0:(u=s.hex4.exec(r))?parseInt(u[1]+u[1]+u[2]+u[2]+u[3]+u[3]+u[4]+u[4],16)>>>0:(u=s.hsl.exec(r))?(255|n(p(u[1]),y(u[2]),y(u[3])))>>>0:(u=s.hsla.exec(r))?void 0!==u[6]?(n(p(u[6]),y(u[7]),y(u[8]))|f(u[9]))>>>0:(n(p(u[2]),y(u[3]),y(u[4]))|f(u[5]))>>>0:(u=s.hwb.exec(r))?(255|t(p(u[1]),y(u[2]),y(u[3])))>>>0:null}},54,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return n}});var n=!('undefined'==typeof window||!window.document||!window.document.createElement)},55,[]); +__d(function(g,r,_i,a,m,e,d){"use strict";function t(t,c){for(var o,n=t.length,u=c^n,h=0;n>=4;)o=1540483477*(65535&(o=255&t.charCodeAt(h)|(255&t.charCodeAt(++h))<<8|(255&t.charCodeAt(++h))<<16|(255&t.charCodeAt(++h))<<24))+((1540483477*(o>>>16)&65535)<<16),u=1540483477*(65535&u)+((1540483477*(u>>>16)&65535)<<16)^(o=1540483477*(65535&(o^=o>>>24))+((1540483477*(o>>>16)&65535)<<16)),n-=4,++h;switch(n){case 3:u^=(255&t.charCodeAt(h+2))<<16;case 2:u^=(255&t.charCodeAt(h+1))<<8;case 1:u=1540483477*(65535&(u^=255&t.charCodeAt(h)))+((1540483477*(u>>>16)&65535)<<16)}return u=1540483477*(65535&(u^=u>>>13))+((1540483477*(u>>>16)&65535)<<16),(u^=u>>>15)>>>0}Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return c}});var c=c=>t(c,1).toString(36)},56,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return c}});var t=/[A-Z]/g,n=/^ms-/,u={};function o(t){return'-'+t.toLowerCase()}var c=function(c){if(c in u)return u[c];var f=c.replace(t,o);return u[c]=n.test(f)?'-'+f:f}},57,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return n}});var t=e(r(d[0])),u=e(r(d[1])),n=(0,t.default)(u.default)},58,[59,65]); +__d(function(g,r,_i,a,m,e,d){'use strict';Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(l){var i=l.prefixMap,o=l.plugins;return function l(s){for(var v in s){var c=s[v];if((0,n.default)(c))s[v]=l(c);else if(Array.isArray(c)){for(var _=[],p=0,y=c.length;p0&&(s[v]=_)}else{var h=(0,u.default)(o,v,c,s,i);h&&(s[v]=h),s=(0,t.default)(i,v,s)}}return s}};var t=l(r(d[0])),u=l(r(d[1])),f=l(r(d[2])),n=l(r(d[3]));function l(t){return t&&t.__esModule?t:{default:t}}},59,[60,62,63,64]); +__d(function(g,r,_i,a,m,e,d){'use strict';Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t,u,n){var l=t[u];if(l&&n.hasOwnProperty(u))for(var o=(0,f.default)(u),_=0;_t.length)&&(n=t.length);for(var o=0,i=new Array(n);o-1)return f.map(function(t){return u.replace(/image-set\(/g,t+'image-set(')})};var t,u=r(d[0]),n=(t=u)&&t.__esModule?t:{default:t};var f=['-webkit-','']},81,[82]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(n){return'string'==typeof n&&t.test(n)};var t=/-webkit-|-moz-|-ms-/},82,[]); +__d(function(g,r,_i,a,m,e,d){'use strict';Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(o,n,i){if(Object.prototype.hasOwnProperty.call(t,o))for(var l=t[o],b=0,B=l.length;b-1)return p;var v=l.split(/,(?![^()]*(?:\([^()]*\))?\))/g).filter(function(t){return!/-webkit-|-ms-/.test(t)}).join(',');return t.indexOf('Moz')>-1?v:(o['Webkit'+(0,n.default)(t)]=p,o['Moz'+(0,n.default)(t)]=v,l)}};var t=o(r(d[0])),i=o(r(d[1])),n=o(r(d[2]));function o(t){return t&&t.__esModule?t:{default:t}}var f={transition:!0,transitionProperty:!0,WebkitTransition:!0,WebkitTransitionProperty:!0,MozTransition:!0,MozTransitionProperty:!0},u={Webkit:'-webkit-',Moz:'-moz-',ms:'-ms-'};function s(n,o){if((0,i.default)(n))return n;for(var f=n.split(/,(?![^()]*(?:\([^()]*\))?\))/g),s=0,l=f.length;s-1&&'order'!==b)for(var k=o[c],z=0,M=k.length;z{h.insert(e,0)}),o.set(b,l.length),l.push(h);else{var p=o.get(b);if(null==p){var v=l[0],k=null!=v?v.getTextContent():'';h=(0,u.default)((0,n.default)(f,b,k)),o.set(b,l.length),l.push(h)}else h=l[p]}}else 0===l.length?(h=(0,u.default)((0,n.default)(f)),c.forEach(e=>{h.insert(e,0)}),l.push(h)):h=l[0];return{getTextContent:()=>h.getTextContent(),id:f,insert(e,t){l.forEach(n=>{n.insert(e,t)})}}};var t=e(r(d[0])),n=e(r(d[1])),u=e(r(d[2])),s='react-native-stylesheet',o=new WeakMap,l=[],c=['html{-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:rgba(0,0,0,0);}','body{margin:0;}','button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0;}','input::-webkit-search-cancel-button,input::-webkit-search-decoration,input::-webkit-search-results-button,input::-webkit-search-results-decoration{display:none;}']},88,[55,89,90]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u}});var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e};function u(e,t,u){if(n.default){var l=null!=t?t:document,o=l.getElementById(e);if(null==o)if((o=document.createElement('style')).setAttribute('id',e),'string'==typeof u&&o.appendChild(document.createTextNode(u)),l instanceof ShadowRoot)l.insertBefore(o,l.firstChild);else{var f=l.head;f&&f.insertBefore(o,f.firstChild)}return o.sheet}return null}},89,[55]); +__d(function(g,r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return e}});var t=Array.prototype.slice;function e(e){var u,a={},c={};null!=e&&t.call(e.cssRules).forEach((t,e)=>{var n=t.cssText;if(n.indexOf('stylesheet-group')>-1)u=l(t),a[u]={start:e,rules:[n]};else{var s=i(n);null!=s&&(c[s]=!0,a[u].rules.push(n))}});function f(t,e,n){var u=s(a),l=u.indexOf(e)+1,i=u[l],c=null!=i&&null!=a[i].start?a[i].start:t.cssRules.length,f=o(t,n,c);if(f){null==a[e].start&&(a[e].start=c);for(var v=l;vs(a).map(t=>{var e=a[t].rules,n=e.shift();return e.sort(),e.unshift(n),e.join('\n')}).join('\n'),insert(t,u){var l=Number(u);if(null==a[l]){var s=n(l);a[l]={start:null,rules:[s]},null!=e&&f(e,l,s)}var o=i(t);null!=o&&null==c[o]&&(c[o]=!0,a[l].rules.push(t),null!=e&&(f(e,l,t)||a[l].rules.pop()))}};return v}function n(t){return"[stylesheet-group=\""+t+"\"]{}"}var u=/["']/g;function l(t){return Number(t.selectorText.split(u)[1])}function s(t){return Object.keys(t).map(Number).sort((t,e)=>t>e?1:-1)}var a=/\s*([,])\s*/g;function i(t){var e=t.split('{')[0].trim();return''!==e?e.replace(a,'$1'):null}function o(t,e,n){try{return t.insertRule(e,n),!0}catch(t){return!1}}},90,[]); +__d(function(g,r,i,a,m,e,d){m.exports=r(d[0])},91,[92]); +__d(function(g,r,i,a,m,e,d){'use strict';Object.defineProperty(e,"__esModule",{value:!0}),e.localizeStyle=function(l,s){if(null!=l[t]){var c=s?1:0;if(n.has(l)){var f=n.get(l),o=f[c];return null==o&&(o=u(l,s),f[c]=o,n.set(l,f)),o}var v=u(l,s),y=new Array(2);return y[c]=v,n.set(l,y),v}return l};var n=new WeakMap,t='$$css$localize';function u(n,u){var l={};for(var s in n)if(s!==t){var c=n[s];Array.isArray(c)?l[s]=u?c[1]:c[0]:l[s]=c}return l}},92,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"createBoxShadowValue",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"createTextShadowValue",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"createBoxShadowArrayValue",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"createTransformValue",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"createTransformOriginValue",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"preprocess",{enumerable:!0,get:function(){return y}});var t=e(r(d[0])),n=e(r(d[1])),o={},l={height:0,width:0},u=e=>{var o=e.shadowColor,u=e.shadowOffset,f=e.shadowOpacity,s=e.shadowRadius,h=u||l,b=h.height,c=h.width,S=(0,n.default)(c),w=(0,n.default)(b),p=(0,n.default)(s||0),y=(0,t.default)(o||'black',f);if(null!=y&&null!=S&&null!=w&&null!=p)return S+" "+w+" "+p+" "+y},f=e=>{var t=e.textShadowColor,o=e.textShadowOffset,u=e.textShadowRadius,f=o||l,s=f.height,h=f.width,b=u||0,c=(0,n.default)(h),S=(0,n.default)(s),w=(0,n.default)(b),p=(0,n.default)(t,'textShadowColor');if(p&&(0!==s||0!==h||0!==b)&&null!=c&&null!=S&&null!=w)return c+" "+S+" "+w+" "+p},s=e=>{if('string'==typeof e)return e;var o=(0,n.default)(e.offsetX)||0,l=(0,n.default)(e.offsetY)||0,u=(0,n.default)(e.blurRadius)||0,f=(0,n.default)(e.spreadDistance)||0,s=(0,t.default)(e.color)||'black';return""+(e.inset?'inset ':'')+o+" "+l+" "+u+" "+f+" "+s},h=e=>e.map(s).join(', '),b=e=>{var t=Object.keys(e)[0],o=e[t];return'matrix'===t||'matrix3d'===t?t+"("+o.join(',')+")":t+"("+(0,n.default)(o,t)+")"},c=e=>e.map(b).join(' '),S=e=>e.map(e=>(0,n.default)(e)).join(' '),w={borderBottomEndRadius:'borderEndEndRadius',borderBottomStartRadius:'borderEndStartRadius',borderTopEndRadius:'borderStartEndRadius',borderTopStartRadius:'borderStartStartRadius',borderEndColor:'borderInlineEndColor',borderEndStyle:'borderInlineEndStyle',borderEndWidth:'borderInlineEndWidth',borderStartColor:'borderInlineStartColor',borderStartStyle:'borderInlineStartStyle',borderStartWidth:'borderInlineStartWidth',end:'insetInlineEnd',marginEnd:'marginInlineEnd',marginHorizontal:'marginInline',marginStart:'marginInlineStart',marginVertical:'marginBlock',paddingEnd:'paddingInlineEnd',paddingHorizontal:'paddingInline',paddingStart:'paddingInlineStart',paddingVertical:'paddingBlock',start:'insetInlineStart'},p={elevation:!0,overlayColor:!0,resizeMode:!0,tintColor:!0},y=function(e,t){void 0===t&&(t={});var n=e||o,l={};if(t.shadow,null!=n.shadowColor||null!=n.shadowOffset||null!=n.shadowOpacity||null!=n.shadowRadius){var s=u(n);null!=s&&(l.boxShadow=s)}if(t.textShadow,null!=n.textShadowColor||null!=n.textShadowOffset||null!=n.textShadowRadius){var b=f(n);if(null!=b&&null==l.textShadow){var y=n.textShadow,x=y?y+", "+b:b;l.textShadow=x}}for(var O in n)if(null==p[O]&&'shadowColor'!==O&&'shadowOffset'!==O&&'shadowOpacity'!==O&&'shadowRadius'!==O&&'textShadowColor'!==O&&'textShadowOffset'!==O&&'textShadowRadius'!==O){var v=n[O],E=w[O]||O,R=v;if(Object.prototype.hasOwnProperty.call(n,O)&&(E===O||null==n[E]))if('aspectRatio'===E&&'number'==typeof R)l[E]=R.toString();else if('boxShadow'===E){Array.isArray(R)&&(R=h(R));var j=l.boxShadow;l.boxShadow=j?R+", "+j:R}else'fontVariant'===E?(Array.isArray(R)&&R.length>0&&(R=R.join(' ')),l[E]=R):'textAlignVertical'===E?null==n.verticalAlign&&(l.verticalAlign='center'===R?'middle':R):'transform'===E?(Array.isArray(R)&&(R=c(R)),l.transform=R):'transformOrigin'===E?(Array.isArray(R)&&(R=S(R)),l.transformOrigin=R):l[E]=R}return l},x=y},93,[51,49]); +__d(function(g,r,_i2,a,m,e,d){'use strict';Object.defineProperty(e,"__esModule",{value:!0}),e.styleq=void 0;var l=new WeakMap;function n(n){var s,u,t;return null!=n&&(s=!0===n.disableCache,u=!0===n.disableMix,t=n.transform),function(){for(var n=[],i='',o=null,f=s?null:l,v=new Array(arguments.length),c=0;c0;){var p=v.pop();if(null!=p&&!1!==p)if(Array.isArray(p))for(var y=0;y-1)s("Invalid style declaration \""+u+":"+c+"\". Values cannot include \"!important\""),f=!0;else{var p='';'animation'===u||'animationName'===u?(p='Did you mean "animationKeyframes"?',f=!0):'direction'===u?(p='Did you mean "writingDirection"?',f=!0):t[u]?(p='Please use long-form properties.',f=!0):l[u]&&'string'==typeof c&&(0,o.default)(c).nodes.length>1&&(p="Value is \""+c+"\" but only single values are supported.",f=!0),''!==p&&s("Invalid style property of \""+u+"\". "+p)}f&&delete e[n]}}};var e,n=r(d[0]),o=(e=n)&&e.__esModule?e:{default:e},t={background:!0,borderBottom:!0,borderLeft:!0,borderRight:!0,borderTop:!0,font:!0,grid:!0,outline:!0,textDecoration:!0},l={flex:!0,margin:!0,padding:!0,borderColor:!0,borderRadius:!0,borderStyle:!0,borderWidth:!0,inset:!0,insetBlock:!0,insetInline:!0,marginBlock:!0,marginInline:!0,marginHorizontal:!0,marginVertical:!0,paddingBlock:!0,paddingInline:!0,paddingHorizontal:!0,paddingVertical:!0,overflow:!0,overscrollBehavior:!0,backgroundPosition:!0};function s(e){console.error(e)}},95,[96]); +__d(function(g,r,i,a,m,e,d){var t=r(d[0]),n=r(d[1]),o=r(d[2]);function s(n){return this instanceof s?(this.nodes=t(n),this):new s(n)}s.prototype.toString=function(){return Array.isArray(this.nodes)?o(this.nodes):""},s.prototype.walk=function(t,o){return n(this.nodes,t,o),this},s.unit=r(d[3]),s.walk=n,s.stringify=o,m.exports=s},96,[97,98,99,100]); +__d(function(g,r,i,a,m,e,d){var o="(".charCodeAt(0),n=")".charCodeAt(0),c="'".charCodeAt(0),t='"'.charCodeAt(0),s="\\".charCodeAt(0),u="/".charCodeAt(0),l=",".charCodeAt(0),h=":".charCodeAt(0),f="*".charCodeAt(0),p="u".charCodeAt(0),x="U".charCodeAt(0),A="+".charCodeAt(0),C=/^[a-f0-9?-]+$/i;m.exports=function(I){for(var v,E,y,w,O,b,_,q,U,$=[],j=I,k=0,z=j.charCodeAt(k),B=j.length,D=[{nodes:$}],F=0,G="",H="",J="";k=48&&A<=57)return!0;var n=h.charCodeAt(2);return A===c&&n>=48&&n<=57}return C===c?(A=h.charCodeAt(1))>=48&&A<=57:C>=48&&C<=57}m.exports=function(n){var f,u,v,l=0,s=n.length;if(0===s||!C(n))return!1;for((f=n.charCodeAt(l))!==o&&f!==t||l++;l57);)l+=1;if(f=n.charCodeAt(l),u=n.charCodeAt(l+1),f===c&&u>=48&&u<=57)for(l+=2;l57);)l+=1;if(f=n.charCodeAt(l),u=n.charCodeAt(l+1),v=n.charCodeAt(l+2),(f===h||f===A)&&(u>=48&&u<=57||(u===o||u===t)&&v>=48&&v<=57))for(l+=u===o||u===t?3:2;l57);)l+=1;return{number:n.slice(0,l),unit:n.slice(l)}}},100,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.getLocaleDirection=u,_e.LocaleProvider=function(e){var t=e.direction,o=e.locale,l=e.children;return t||o?n.default.createElement(c.Provider,{children:l,value:{direction:o?u(o):t,locale:o}}):l},_e.useLocaleContext=function(){return(0,t.useContext)(c)};var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},o=r(d[1]),l={direction:'ltr',locale:'en-US'},c=(0,t.createContext)(l);function u(e){return(0,o.isLocaleRTL)(e)?'rtl':'ltr'}},101,[30,102]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.isLocaleRTL=function(s){var l=c.get(s);if(l)return l;var o=!1;if(Intl.Locale)try{var u=new Intl.Locale(s).maximize().script;o=t.has(u)}catch(t){var h=s.split('-')[0];o=n.has(h)}else{var v=s.split('-')[0];o=n.has(v)}return c.set(s,o),o};var t=new Set(['Arab','Syrc','Samr','Mand','Thaa','Mend','Nkoo','Adlm','Rohg','Hebr']),n=new Set(['ae','ar','arc','bcc','bqi','ckb','dv','fa','far','glk','he','iw','khw','ks','ku','mzn','nqo','pnb','ps','sd','ug','ur','yi']),c=new Map},102,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}});var t=t=>{throw new Error("findNodeHandle is not supported on web. Use the ref property on the component instead.")}},103,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return u}}),e.hydrate=function(u,o){return(0,n.createSheet)(o),(0,t.hydrateRoot)(o,u)};var t=r(d[0]),n=r(d[1]);function u(u,o){(0,n.createSheet)(o);var c=(0,t.createRoot)(o);return c.render(u),c}},104,[105,88]); +__d(function(g,r,i,a,m,e,d){'use strict';!(function _(){if('undefined'!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&'function'==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(_)}catch(_){console.error(_)}})(),m.exports=r(d[0])},105,[106]); +__d(function(e,n,t,r,l,a,o){ +/** + * @license React + * react-dom-client.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +"use strict";var i=n(o[0]),u=n(o[1]),s=n(o[2]);function c(e){var n="https://react.dev/errors/"+e;if(1le||(e.current=re[le],re[le]=null,le--)}function ie(e,n){le++,re[le]=e.current,e.current=n}var ue,se,ce=ae(null),fe=ae(null),de=ae(null),pe=ae(null);function me(e,n){switch(ie(de,n),ie(fe,e),ie(ce,null),n.nodeType){case 9:case 11:e=(e=n.documentElement)&&(e=e.namespaceURI)?op(e):0;break;default:if(e=n.tagName,n=n.namespaceURI)e=ip(n=op(n),e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}oe(ce),ie(ce,e)}function he(){oe(ce),oe(fe),oe(de)}function ge(e){var n=e.memoizedState;null!==n&&(qm._currentValue=n.memoizedState,ie(pe,e));var t=ip(n=ce.current,e.type);n!==t&&(ie(fe,e),ie(ce,t))}function ve(e){fe.current===e&&(oe(ce),oe(fe)),pe.current===e&&(oe(pe),qm._currentValue=te)}function ye(e){if(void 0===ue)try{throw Error()}catch(e){var n=e.stack.trim().match(/\n( *(at )?)/);ue=n&&n[1]||"",se=-1)":-1--l||u[r]!==s[l]){var c="\n"+u[r].replace(" at new "," at ");return e.displayName&&c.includes("")&&(c=c.replace("",e.displayName)),c}}while(1<=r&&0<=l);break}}}finally{be=!1,Error.prepareStackTrace=t}return(t=e?e.displayName||e.name:"")?ye(t):""}function we(e,n){switch(e.tag){case 26:case 27:case 5:return ye(e.type);case 16:return ye("Lazy");case 13:return e.child!==n&&null!==n?ye("Suspense Fallback"):ye("Suspense");case 19:return ye("SuspenseList");case 0:case 15:return ke(e.type,!1);case 11:return ke(e.type.render,!1);case 1:return ke(e.type,!0);case 31:return ye("Activity");case 30:return ye("ViewTransition");default:return""}}function Se(e){try{var n="",t=null;do{n+=we(e,t),t=e,e=e.return}while(e);return n}catch(e){return"\nError generating stack: "+e.message+"\n"+e.stack}}var Ee=Object.prototype.hasOwnProperty,Ne=i.unstable_scheduleCallback,Ce=i.unstable_cancelCallback,ze=i.unstable_shouldYield,Pe=i.unstable_requestPaint,Te=i.unstable_now,xe=i.unstable_getCurrentPriorityLevel,_e=i.unstable_ImmediatePriority,Le=i.unstable_UserBlockingPriority,Oe=i.unstable_NormalPriority,Fe=i.unstable_LowPriority,De=i.unstable_IdlePriority,Ie=i.log,Me=i.unstable_setDisableYieldValue,Ae=null,Re=null;function Ue(e){if("function"==typeof Ie&&Me(e),Re&&"function"==typeof Re.setStrictMode)try{Re.setStrictMode(Ae,e)}catch(e){}}var Ve=Math.clz32?Math.clz32:function(e){return 0===(e>>>=0)?32:31-(Be(e)/je|0)|0},Be=Math.log,je=Math.LN2;var $e=256,He=262144,Qe=4194304;function We(e){var n=42&e;if(0!==n)return n;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&-e;case 262144:case 524288:case 1048576:case 2097152:return 3932160&e;case 4194304:case 8388608:case 16777216:case 33554432:return 62914560&e;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function qe(e,n,t){var r=e.pendingLanes;if(0===r)return 0;var l=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var i=134217727&r;return 0!==i?0!==(r=i&~a)?l=We(r):0!==(o&=i)?l=We(o):t||0!==(t=i&~e)&&(l=We(t)):0!==(i=r&~a)?l=We(i):0!==o?l=We(o):t||0!==(t=r&~e)&&(l=We(t)),0===l?0:0!==n&&n!==l&&0===(n&a)&&((a=l&-l)>=(t=n&-n)||32===a&&4194048&t)?n:l}function Ye(e,n){return 0===(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&n)}function Ke(e,n){8&n&&(n|=32&n);var t=e.entangledLanes;if(0!==t)for(e=e.entanglements,t&=n;0t;t++)n.push(e);return n}function Je(e,n){e.pendingLanes|=n,268435456!==n&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function en(e,n,t,r,l,a){var o=e.pendingLanes;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=t,e.entangledLanes&=t,e.errorRecoveryDisabledLanes&=t,e.shellSuspendCounter=0;var i=e.entanglements,u=e.expirationTimes,s=e.hiddenUpdates;for(t=o&~t;0=Jt),tr=String.fromCharCode(32),rr=!1;function lr(e,n){switch(e){case"keyup":return-1!==Xt.indexOf(n.keyCode);case"keydown":return 229!==n.keyCode;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ar(e){return"object"==typeof(e=e.detail)&&"data"in e?e.data:null}var or=!1;function ir(e,n){switch(e){case"compositionend":return ar(n);case"keypress":return 32!==n.which?null:(rr=!0,tr);case"textInput":return(e=n.data)===tr&&rr?null:e;default:return null}}function ur(e,n){if(or)return"compositionend"===e||!Zt&&lr(e,n)?(e=kt(),bt=yt=vt=null,or=!1,e):null;switch(e){case"paste":default:return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1=n)return{node:r,offset:n-e};e=t}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=_r(r)}}function Or(e,n){return!(!e||!n)&&(e===n||(!e||3!==e.nodeType)&&(n&&3===n.nodeType?Or(e,n.parentNode):"contains"in e?e.contains(n):!!e.compareDocumentPosition&&!!(16&e.compareDocumentPosition(n))))}function Fr(e){for(var n=xr((e=null!=e&&null!=e.ownerDocument&&null!=e.ownerDocument.defaultView?e.ownerDocument.defaultView:window).document);n instanceof e.HTMLIFrameElement;){try{var t="string"==typeof n.contentWindow.location.href}catch(e){t=!1}if(!t)break;n=xr((e=n.contentWindow).document)}return n}function Dr(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n&&("input"===n&&("text"===e.type||"search"===e.type||"tel"===e.type||"url"===e.type||"password"===e.type)||"textarea"===n||"true"===e.contentEditable)}var Ir=mt&&"documentMode"in document&&11>=document.documentMode,Mr=null,Ar=null,Rr=null,Ur=!1;function Vr(e,n,t){var r=t.window===t?t.document:9===t.nodeType?t:t.ownerDocument;Ur||null==Mr||Mr!==xr(r)||("selectionStart"in(r=Mr)&&Dr(r)?r={start:r.selectionStart,end:r.selectionEnd}:r={anchorNode:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection()).anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset},Rr&&Tr(Rr,r)||(Rr=r,0<(r=$d(Ar,"onSelect")).length&&(n=new xt("onSelect","select",null,n,t),e.push({event:n,listeners:r}),n.target=Mr)))}function Br(e,n){var t={};return t[e.toLowerCase()]=n.toLowerCase(),t["Webkit"+e]="webkit"+n,t["Moz"+e]="moz"+n,t}var jr={animationend:Br("Animation","AnimationEnd"),animationiteration:Br("Animation","AnimationIteration"),animationstart:Br("Animation","AnimationStart"),transitionrun:Br("Transition","TransitionRun"),transitionstart:Br("Transition","TransitionStart"),transitioncancel:Br("Transition","TransitionCancel"),transitionend:Br("Transition","TransitionEnd")},$r={},Hr={};function Qr(e){if($r[e])return $r[e];if(!jr[e])return e;var n,t=jr[e];for(n in t)if(t.hasOwnProperty(n)&&n in Hr)return $r[e]=t[n];return e}mt&&(Hr=document.createElement("div").style,"AnimationEvent"in window||(delete jr.animationend.animation,delete jr.animationiteration.animation,delete jr.animationstart.animation),"TransitionEvent"in window||delete jr.transitionend.transition);var Wr=Qr("animationend"),qr=Qr("animationiteration"),Yr=Qr("animationstart"),Kr=Qr("transitionrun"),Gr=Qr("transitionstart"),Xr=Qr("transitioncancel"),Zr=Qr("transitionend"),Jr=new Map,el="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error fullscreenChange fullscreenError gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function nl(e,n){Jr.set(e,n),Tn(n,[e])}el.push("scrollEnd");var tl=0;function rl(e,n){return null!=e.name&&"auto"!==e.name?e.name:null!==n.autoName?n.autoName:(e="_"+(e=gf.identifierPrefix)+"t_"+(tl++).toString(32)+"_",n.autoName=e)}function ll(e){if(null==e||"string"==typeof e)return e;var n=null,t=Nf;if(null!==t)for(var r=0;r>=o,l-=o,Ml=1<<32-Ve(n)+l|t<h?(g=f,f=null):g=f.sibling;var v=p(l,f,i[h],u);if(null===v){null===f&&(f=g);break}e&&f&&null===v.alternate&&n(l,f),o=a(v,o,h),null===c?s=v:c.sibling=v,c=v,f=g}if(h===i.length)return t(l,f),Ql&&Rl(l,h),s;if(null===f){for(;hg?(v=h,h=null):v=h.sibling;var b=p(l,h,y.value,u);if(null===b){null===h&&(h=v);break}e&&h&&null===b.alternate&&n(l,h),o=a(b,o,g),null===f?s=b:f.sibling=b,f=b,h=v}if(y.done)return t(l,h),Ql&&Rl(l,g),s;if(null===h){for(;!y.done;g++,y=i.next())null!==(y=d(l,y.value,u))&&(o=a(y,o,g),null===f?s=y:f.sibling=y,f=y);return Ql&&Rl(l,g),s}for(h=r(h);!y.done;g++,y=i.next())null!==(y=m(h,l,g,y.value,u))&&(e&&(null!==(v=y.alternate)&&h.delete(null===v.key?g:v.key)),o=a(y,o,g),null===f?s=y:f.sibling=y,f=y);return e&&h.forEach(function(e){return n(l,e)}),Ql&&Rl(l,g),s}function v(e,r,a,i){if("object"==typeof a&&null!==a&&a.type===D&&null===a.key&&void 0===a.props.ref&&(a=a.props.children),"object"==typeof a&&null!==a){switch(a.$$typeof){case O:e:{for(var u=a.key;null!==r;){if(r.key===u){if((u=a.type)===D){if(7===r.tag){t(e,r.sibling),Ya(i=l(r,a.props.children),a),i.return=e,e=i;break e}}else if(r.elementType===u||"object"==typeof u&&null!==u&&u.$$typeof===$&&Ba(u)===r.type){t(e,r.sibling),Ya(i=l(r,a.props),a),i.return=e,e=i;break e}t(e,r);break}n(e,r),r=r.sibling}a.type===D?(Ya(i=El(a.props.children,e.mode,i,a.key),a),i.return=e,e=i):(Ya(i=Sl(a.type,a.key,a.props,null,e.mode,i),a),i.return=e,e=i)}return o(e);case F:e:{for(u=a.key;null!==r;){if(r.key===u){if(4===r.tag&&r.stateNode.containerInfo===a.containerInfo&&r.stateNode.implementation===a.implementation){t(e,r.sibling),(i=l(r,a.children||[])).return=e,e=i;break e}t(e,r);break}n(e,r),r=r.sibling}(i=zl(a,e.mode,i)).return=e,e=i}return o(e);case $:return v(e,r,a=Ba(a),i)}if(J(a))return h(e,r,a,i);if(G(a)){if("function"!=typeof(u=G(a)))throw Error(c(150));return g(e,r,a=u.call(a),i)}if("function"==typeof a.then)return v(e,r,qa(a),i);if(a.$$typeof===R)return v(e,r,pa(e,a),i);Ka(e,a)}return"string"==typeof a&&""!==a||"number"==typeof a||"bigint"==typeof a?(a=""+a,null!==r&&6===r.tag?(t(e,r.sibling),(i=l(r,a)).return=e,e=i):(t(e,r),(i=Nl(a,e.mode,i)).return=e,e=i),o(e)):t(e,r)}return function(e,n,t,r){try{Wa=0;var l=v(e,n,t,r);return Qa=null,l}catch(n){if(n===Ia||n===Aa)throw n;var a=yl(29,n,null,e.mode);return a.lanes=r,a.return=e,a}}}var Xa=Ga(!0),Za=Ga(!1),Ja=!1;function eo(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function no(e,n){e=e.updateQueue,n.updateQueue===e&&(n.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function to(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function ro(e,n,t){var r=e.updateQueue;if(null===r)return null;if(r=r.shared,2&Hc){var l=r.pending;return null===l?n.next=n:(n.next=l.next,l.next=n),r.pending=n,n=hl(e),ml(e,null,t),n}return fl(e,r,n,t),hl(e)}function lo(e,n,t){if(null!==(n=n.updateQueue)&&(n=n.shared,4194048&t)){var r=n.lanes;t|=r&=e.pendingLanes,n.lanes=t,tn(e,t)}}function ao(e,n){var t=e.updateQueue,r=e.alternate;if(null!==r&&t===(r=r.updateQueue)){var l=null,a=null;if(null!==(t=t.firstBaseUpdate)){do{var o={lane:t.lane,tag:t.tag,payload:t.payload,callback:null,next:null};null===a?l=a=o:a=a.next=o,t=t.next}while(null!==t);null===a?l=a=n:a=a.next=n}else l=a=n;return t={baseState:r.baseState,firstBaseUpdate:l,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},void(e.updateQueue=t)}null===(e=t.lastBaseUpdate)?t.firstBaseUpdate=n:e.next=n,t.lastBaseUpdate=n}var oo=!1;function io(){if(oo){if(null!==Pa)throw Pa}}function uo(e,n,t,r){oo=!1;var l=e.updateQueue;Ja=!1;var a=l.firstBaseUpdate,o=l.lastBaseUpdate,i=l.shared.pending;if(null!==i){l.shared.pending=null;var u=i,s=u.next;u.next=null,null===o?a=s:o.next=s,o=u;var c=e.alternate;null!==c&&((i=(c=c.updateQueue).lastBaseUpdate)!==o&&(null===i?c.firstBaseUpdate=s:i.next=s,c.lastBaseUpdate=u))}if(null!==a){var f=l.baseState;for(o=0,c=s=u=null,i=a;;){var d=-536870913&i.lane,p=d!==i.lane;if(p?(qc&d)===d:(r&d)===d){0!==d&&d===za&&(oo=!0),null!==c&&(c=c.next={lane:0,tag:i.tag,payload:i.payload,callback:null,next:null});e:{var m=e,h=i;d=n;var g=t;switch(h.tag){case 1:if("function"==typeof(m=h.payload)){f=m.call(g,f,d);break e}f=m;break e;case 3:m.flags=-65537&m.flags|128;case 0:if(null==(d="function"==typeof(m=h.payload)?m.call(g,f,d):m))break e;f=_({},f,d);break e;case 2:Ja=!0}}null!==(d=i.callback)&&(e.flags|=64,p&&(e.flags|=8192),null===(p=l.callbacks)?l.callbacks=[d]:p.push(d))}else p={lane:d,tag:i.tag,payload:i.payload,callback:i.callback,next:null},null===c?(s=c=p,u=f):c=c.next=p,o|=d;if(null===(i=i.next)){if(null===(i=l.shared.pending))break;i=(p=i).next,p.next=null,l.lastBaseUpdate=p,l.shared.pending=null}}null===c&&(u=f),l.baseState=u,l.firstBaseUpdate=s,l.lastBaseUpdate=c,null===a&&(l.shared.lanes=0),nf|=o,e.lanes=o,e.memoizedState=f}}function so(e,n){if("function"!=typeof e)throw Error(c(191,e));e.call(n)}function co(e,n){var t=e.callbacks;if(null!==t)for(e.callbacks=null,e=0;ea?a:8;var o,i,u,s=ee.T,c={};c.types=null!==s?s.types:null,ee.T=c,Zi(e,!1,n,t);try{var f=l(),d=ee.S;if(null!==d&&d(c,f),null!==f&&"object"==typeof f&&"function"==typeof f.then)Xi(e,n,(o=r,i=[],u={status:"pending",value:null,reason:null,then:function(e){i.push(e)}},f.then(function(){u.status="fulfilled",u.value=o;for(var e=0;e<\/script>",a=a.removeChild(a.firstChild);break;case"select":a="string"==typeof r.is?o.createElement("select",{is:r.is}):o.createElement("select"),r.multiple?a.multiple=!0:r.size&&(a.size=r.size);break;default:a="string"==typeof r.is?o.createElement(l,{is:r.is}):o.createElement(l)}}a[cn]=n,a[fn]=r;e:for(o=n.child;null!==o;){if(5===o.tag||6===o.tag)a.appendChild(o.stateNode);else if(4!==o.tag&&27!==o.tag&&null!==o.child){o.child.return=o,o=o.child;continue}if(o===n)break e;for(;null===o.sibling;){if(null===o.return||o.return===n)break e;o=o.return}o.sibling.return=o.return,o=o.sibling}n.stateNode=a;e:switch(Zd(a,l,r),l){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}r&&ns(n)}}return os(n),n.subtreeFlags&=-33554433,ts(n,n.type,null===e?null:e.memoizedProps,n.pendingProps,t),null;case 6:if(e&&null!=n.stateNode)e.memoizedProps!==r&&ns(n);else{if("string"!=typeof r&&null===n.stateNode)throw Error(c(166));if(e=de.current,Zl(n)){if(e=n.stateNode,t=n.memoizedProps,r=null,null!==(l=$l))switch(l.tag){case 27:case 5:r=l.memoizedProps}e[cn]=n,(e=!!(e.nodeValue===t||null!==r&&!0===r.suppressHydrationWarning||Kd(e.nodeValue,t)))||Kl(n,!0)}else(e=ap(e).createTextNode(r))[cn]=n,n.stateNode=e}return os(n),null;case 31:if(t=n.memoizedState,null===e||null!==e.memoizedState){if(r=Zl(n),null!==t){if(null===e){if(!r)throw Error(c(318));if(!(e=null!==(e=n.memoizedState)?e.dehydrated:null))throw Error(c(557));e[cn]=n}else Jl(),!(128&n.flags)&&(n.memoizedState=null),n.flags|=4;os(n),e=!1}else t=ea(),null!==e&&null!==e.memoizedState&&(e.memoizedState.hydrationErrors=t),e=!0;if(!e)return 256&n.flags?(Eo(n),n):(Eo(n),null);if(128&n.flags)throw Error(c(558))}return os(n),null;case 13:if(r=n.memoizedState,null===e||null!==e.memoizedState&&null!==e.memoizedState.dehydrated){if(l=Zl(n),null!==r&&null!==r.dehydrated){if(null===e){if(!l)throw Error(c(318));if(!(l=null!==(l=n.memoizedState)?l.dehydrated:null))throw Error(c(317));l[cn]=n}else Jl(),!(128&n.flags)&&(n.memoizedState=null),n.flags|=4;os(n),l=!1}else l=ea(),null!==e&&null!==e.memoizedState&&(e.memoizedState.hydrationErrors=l),l=!0;if(!l)return 256&n.flags?(Eo(n),n):(Eo(n),null)}return Eo(n),128&n.flags?(n.lanes=t,n):(t=null!==r,e=null!==e&&null!==e.memoizedState,t&&(l=null,null!==(r=n.child).alternate&&null!==r.alternate.memoizedState&&null!==r.alternate.memoizedState.cachePool&&(l=r.alternate.memoizedState.cachePool.pool),a=null,null!==r.memoizedState&&null!==r.memoizedState.cachePool&&(a=r.memoizedState.cachePool.pool),a!==l&&(r.flags|=2048)),t!==e&&t&&(n.child.flags|=8192),ls(n,n.updateQueue),os(n),null);case 4:return he(),null===e&&Ud(n.stateNode.containerInfo),n.flags|=67108864,os(n),null;case 10:return oa(n.type),os(n),null;case 19:if(zo(n),null===(r=n.memoizedState))return os(n),null;if(l=!!(128&n.flags),null===(a=r.rendering))if(l)as(r,!1);else{if(0!==ef||null!==e&&128&e.flags)for(e=n.child;null!==e;){if(null!==(a=Po(e))){for(n.flags|=128,as(r,!1),e=a.updateQueue,n.updateQueue=e,ls(n,e),n.subtreeFlags=0,e=t,t=n.child;null!==t;)wl(t,e),t=t.sibling;return Co(0,1&No.current|2),Ql&&Rl(n,r.treeForkCount),n.child}e=e.sibling}null!==r.tail&&Te()>df&&(n.flags|=128,l=!0,as(r,!1),n.lanes=4194304)}else{if(!l)if(null!==(e=Po(a))){if(n.flags|=128,l=!0,e=e.updateQueue,n.updateQueue=e,ls(n,e),as(r,!0),null===r.tail&&"collapsed"!==r.tailMode&&"visible"!==r.tailMode&&!a.alternate&&!Ql)return os(n),null}else 2*Te()-r.renderingStartTime>df&&536870912!==t&&(n.flags|=128,l=!0,as(r,!1),n.lanes=4194304);r.isBackwards?(a.sibling=n.child,n.child=a):(null!==(e=r.last)?e.sibling=a:n.child=a,r.last=a)}if(null!==r.tail){e:{for(t=e=r.tail;null!==t;){if(null!==t.alternate){t=!1;break e}t=t.sibling}t=!0}return r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Te(),e.sibling=null,a=No.current,a=l?1&a|2:1&a,"visible"===r.tailMode||"collapsed"===r.tailMode||!t||Ql?Co(0,a):(t=a,ie(vo,n),ie(No,t),null===yo&&(yo=n)),Ql&&Rl(n,r.treeForkCount),e}return os(n),null;case 22:case 23:return Eo(n),go(),r=null!==n.memoizedState,null!==e?null!==e.memoizedState!==r&&(n.flags|=8192):r&&(n.flags|=8192),r?!!(536870912&t)&&!(128&n.flags)&&(os(n),6&n.subtreeFlags&&(n.flags|=8192)):os(n),null!==(t=n.updateQueue)&&ls(n,t.retryQueue),t=null,null!==e&&null!==e.memoizedState&&null!==e.memoizedState.cachePool&&(t=e.memoizedState.cachePool.pool),r=null,null!==n.memoizedState&&null!==n.memoizedState.cachePool&&(r=n.memoizedState.cachePool.pool),r!==t&&(n.flags|=2048),null!==e&&oe(La),null;case 24:return t=null,null!==e&&(t=e.memoizedState.cache),n.memoizedState.cache!==t&&(n.flags|=2048),oa(ya),os(n),null;case 25:return null;case 30:return n.flags|=33554432,os(n),null}throw Error(c(156,n.tag))}function us(e,n){switch(Bl(n),n.tag){case 1:return 65536&(e=n.flags)?(n.flags=-65537&e|128,n):null;case 3:return oa(ya),he(),65536&(e=n.flags)&&!(128&e)?(n.flags=-65537&e|128,n):null;case 26:case 27:case 5:return ve(n),null;case 31:if(null!==n.memoizedState){if(Eo(n),null===n.alternate)throw Error(c(340));Jl()}return 65536&(e=n.flags)?(n.flags=-65537&e|128,n):null;case 13:if(Eo(n),null!==(e=n.memoizedState)&&null!==e.dehydrated){if(null===n.alternate)throw Error(c(340));Jl()}return 65536&(e=n.flags)?(n.flags=-65537&e|128,n):null;case 19:return zo(n),65536&(e=n.flags)?(n.flags=-65537&e|128,null!==(e=n.memoizedState)&&(e.rendering=null,e.tail=null),n.flags|=4,n):null;case 4:return he(),null;case 10:return oa(n.type),null;case 22:case 23:return Eo(n),go(),null!==e&&oe(La),65536&(e=n.flags)?(n.flags=-65537&e|128,n):null;case 24:return oa(ya),null;default:return null}}function ss(e,n){switch(Bl(n),n.tag){case 3:oa(ya),he();break;case 26:case 27:case 5:ve(n);break;case 4:he();break;case 31:null!==n.memoizedState&&Eo(n);break;case 13:Eo(n);break;case 19:zo(n);break;case 10:oa(n.type);break;case 22:case 23:Eo(n),go(),null!==e&&oe(La);break;case 24:oa(ya)}}function cs(e,n){try{var t=n.updateQueue,r=null!==t?t.lastEffect:null;if(null!==r){var l=r.next;t=l;do{if((t.tag&e)===e){r=void 0;var a=t.create,o=t.inst;r=a(),o.destroy=r}t=t.next}while(t!==l)}}catch(e){sd(n,n.return,e)}}function fs(e,n,t){try{var r=n.updateQueue,l=null!==r?r.lastEffect:null;if(null!==l){var a=l.next;r=a;do{if((r.tag&e)===e){var o=r.inst,i=o.destroy;if(void 0!==i){o.destroy=void 0,l=n;var u=t,s=i;try{s()}catch(e){sd(l,u,e)}}}r=r.next}while(r!==a)}}catch(e){sd(n,n.return,e)}}function ds(e){var n=e.updateQueue;if(null!==n){var t=e.stateNode;try{co(n,t)}catch(n){sd(e,e.return,n)}}}function ps(e,n,t){t.props=cu(e.type,e.memoizedProps),t.state=e.memoizedState;try{t.componentWillUnmount()}catch(t){sd(e,n,t)}}function ms(e,n){try{var t=e.ref;if(null!==t){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:var l=e.stateNode,a=rl(e.memoizedProps,l);null!==l.ref&&l.ref.name===a||(l.ref=_p(a)),r=l.ref;break;case 7:if(null===e.stateNode){var o=new Lp(e);y(e.child,!1,Yp,o,void 0,void 0),e.stateNode=o}r=e.stateNode;break;default:r=e.stateNode}"function"==typeof t?e.refCleanup=t(r):t.current=r}}catch(t){sd(e,n,t)}}function hs(e,n){var t=e.ref,r=e.refCleanup;if(null!==t)if("function"==typeof r)try{r()}catch(t){sd(e,n,t)}finally{e.refCleanup=null,null!=(e=e.alternate)&&(e.refCleanup=null)}else if("function"==typeof t)try{t(null)}catch(t){sd(e,n,t)}else t.current=null}function gs(e,n){if((5===e.tag||27===e.tag||6===e.tag)&&null===e.alternate&&null!==n)for(var t=0;t title"))),Zd(r,n,t),r[cn]=e,Nn(r),n=r;break e;case"link":if(a=Lm("link","href",l).get(n+(t.href||"")))for(o=0;og&&(o=g,g=h,h=o);var v=Lr(i,h),y=Lr(i,g);if(v&&y&&(1!==p.rangeCount||p.anchorNode!==v.node||p.anchorOffset!==v.offset||p.focusNode!==y.node||p.focusOffset!==y.offset)){var b=f.createRange();b.setStart(v.node,v.offset),p.removeAllRanges(),h>g?(p.addRange(b),p.extend(y.node,y.offset)):(b.setEnd(y.node,y.offset),p.addRange(b))}}}}for(f=[],p=i;p=p.parentNode;)1===p.nodeType&&f.push({element:p,left:p.scrollLeft,top:p.scrollTop});for("function"==typeof i.focus&&i.focus(),i=0;it?32:t,ee.T=null,t=kf,kf=null;var a=gf,o=yf;if(hf=0,vf=gf=null,yf=0,6&Hc)throw Error(c(331));var i=Hc;if(Hc|=4,Uc(a.current),Lc(a,a.current,o,t),Hc=i,Sd(0,!1),Re&&"function"==typeof Re.onPostCommitFiberRoot)try{Re.onPostCommitFiberRoot(Ae,a)}catch(e){}return!0}finally{ne.p=l,ee.T=r,ad(e,n)}}function ud(e,n,t){n=Tl(t,n),null!==(e=ro(e,n=gu(e.stateNode,n,2),2))&&(Je(e,2),wd(e))}function sd(e,n,t){if(3===e.tag)ud(e,e,t);else for(;null!==n;){if(3===n.tag){ud(n,e,t);break}if(1===n.tag){var r=n.stateNode;if("function"==typeof n.type.getDerivedStateFromError||"function"==typeof r.componentDidCatch&&(null===mf||!mf.has(r))){e=Tl(t,e),null!==(r=ro(n,t=vu(2),2))&&(yu(t,r,n,e),Je(r,2),wd(r));break}}n=n.return}}function cd(e,n,t){var r=e.pingCache;if(null===r){r=e.pingCache=new $c;var l=new Set;r.set(n,l)}else void 0===(l=r.get(n))&&(l=new Set,r.set(n,l));l.has(t)||(Zc=!0,l.add(t),e=fd.bind(null,e,n,t),n.then(e,e))}function fd(e,n,t){var r=e.pingCache;null!==r&&r.delete(n),e.pingedLanes|=e.suspendedLanes&t,e.warmLanes&=~t,Qc===e&&(qc&t)===t&&(4===ef||3===ef&&(62914560&qc)===qc&&300>Te()-cf?2&Hc?rf|=t:Af(e,0):rf|=t,af===qc&&(af=0)),wd(e)}function dd(e,n){0===n&&(n=Xe()),null!==(e=pl(e,n))&&(Je(e,n),wd(e))}function pd(e){var n=e.memoizedState,t=0;null!==n&&(t=n.retryLane),dd(e,t)}function md(e,n){var t=0;switch(e.tag){case 31:case 13:var r=e.stateNode,l=e.memoizedState;null!==l&&(t=l.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(c(314))}null!==r&&r.delete(n),dd(e,t)}var hd=null,gd=null,vd=!1,yd=!1,bd=!1,kd=0;function wd(e){e!==gd&&null===e.next&&(null===gd?hd=gd=e:gd=gd.next=e),yd=!0,vd||(vd=!0,gp(function(){6&Hc?Ne(_e,Ed):Nd()}))}function Sd(e,n){if(!bd&&yd){bd=!0;do{for(var t=!1,r=hd;null!==r;){if(!n)if(0!==e){var l=r.pendingLanes;if(0===l)var a=0;else{var o=r.suspendedLanes,i=r.pingedLanes;a=(1<<31-Ve(42|e)+1)-1,a=201326741&(a&=l&~(o&~i))?201326741&a|1:a?2|a:0}0!==a&&(t=!0,Pd(r,a))}else a=qc,!(3&(a=qe(r,r===Qc?a:0,null!==r.cancelPendingCommit||-1!==r.timeoutHandle)))||Ye(r,a)||(t=!0,Pd(r,a));r=r.next}}while(t);bd=!1}}function Ed(){Nd()}function Nd(){yd=vd=!1;var e=0;0!==kd&&fp()&&(e=kd);for(var n=Te(),t=null,r=hd;null!==r;){var l=r.next,a=Cd(r,n);0===a?(r.next=null,null===t?hd=l:t.next=l,null===l&&(gd=t)):(t=r,(0!==e||3&a)&&(yd=!0)),r=l}0!==hf&&5!==hf||Sd(e,!1),0!==kd&&(kd=0)}function Cd(e,n){for(var t=e.suspendedLanes,r=e.pingedLanes,l=e.expirationTimes,a=-62914561&e.pendingLanes;0i)break;var c=u.transferSize,f=u.initiatorType;c&&np(f)&&(o+=c*((u=u.responseEnd)Um){i.length=o;break}d=new Promise(Pp.bind(d)),i.push(d)}}}return 0 title"):null)}function Fm(e,n,t){if(1===t||null!=n.itemProp)return!1;switch(e){case"meta":case"title":return!0;case"style":if("string"!=typeof n.precedence||"string"!=typeof n.href||""===n.href)break;return!0;case"link":if("string"!=typeof n.rel||"string"!=typeof n.href||""===n.href||n.onLoad||n.onError)break;return"stylesheet"!==n.rel||(e=n.disabled,"string"==typeof n.precedence&&null==e);case"script":if(n.async&&"function"!=typeof n.async&&"symbol"!=typeof n.async&&!n.onLoad&&!n.onError&&n.src&&"string"==typeof n.src)return!0}return!1}function Dm(e,n){return"img"===e&&null!=n.src&&""!==n.src&&null==n.onLoad&&"lazy"!==n.loading}function Im(e){return!!("stylesheet"!==e.type||3&e.state.loading)}function Mm(e){return(e.width||100)*(e.height||100)*("number"==typeof devicePixelRatio?devicePixelRatio:1)*.25}function Am(e,n){"function"==typeof n.decode&&(e.imgCount++,n.complete||(e.imgBytes+=Mm(n),e.suspenseyImages.push(n)),e=$m.bind(e),n.decode().then(e,e))}function Rm(e,n,t,r){if(!("stylesheet"!==t.type||"string"==typeof r.media&&!1===matchMedia(r.media).matches||4&t.state.loading)){if(null===t.instance){var l=km(r.href),a=n.querySelector(wm(l));if(a)return null!==(n=a._p)&&"object"==typeof n&&"function"==typeof n.then&&(e.count++,e=jm.bind(e),n.then(e,e)),t.state.loading|=4,t.instance=a,void Nn(a);a=n.ownerDocument||n,r=Sm(r),(l=pm.get(l))&&Tm(r,l),Nn(a=a.createElement("link"));var o=a;o._p=new Promise(function(e,n){o.onload=e,o.onerror=n}),Zd(a,"link",r),t.instance=a}null===e.stylesheets&&(e.stylesheets=new Map),e.stylesheets.set(t,n),(n=t.state.preload)&&!(3&t.state.loading)&&(e.count++,t=jm.bind(e),n.addEventListener("load",t),n.addEventListener("error",t))}}var Um=0;function Vm(e,n){return e.stylesheets&&0===e.count&&Qm(e,e.stylesheets),0Um?50:800)+n);return e.unsuspend=t,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(l)}}:null}function Bm(e){if(0===e.count&&(0===e.imgCount||!e.waitingForImages))if(e.stylesheets)Qm(e,e.stylesheets);else if(e.unsuspend){var n=e.unsuspend;e.unsuspend=null,n()}}function jm(){this.count--,Bm(this)}function $m(){this.imgCount--,Bm(this)}var Hm=null;function Qm(e,n){e.stylesheets=null,null!==e.unsuspend&&(e.count++,Hm=new Map,n.forEach(Wm,e),Hm=null,jm.call(e))}function Wm(e,n){if(!(4&n.state.loading)){var t=Hm.get(e);if(t)var r=t.get(null);else{t=new Map,Hm.set(e,t);for(var l=e.querySelectorAll("link[data-precedence],style[data-precedence]"),a=0;a>>1,u=n[o];if(!(0>>1;ol(c,a))bl(p,c)?(n[o]=p,n[b]=a,o=b):(n[o]=c,n[f]=a,o=f);else{if(!(bl(p,a)))break e;n[o]=p,n[b]=a,o=b}}}return t}function l(n,t){var a=n.sortIndex-t.sortIndex;return 0!==a?a:n.id-t.id}if(e.unstable_now=void 0,"object"==typeof performance&&"function"==typeof performance.now){var o=performance;e.unstable_now=function(){return o.now()}}else{var u=Date,s=u.now();e.unstable_now=function(){return u.now()-s}}var f=[],c=[],b=1,p=null,v=3,y=!1,_=!1,k=!1,w=!1,h="function"==typeof setTimeout?setTimeout:null,T="function"==typeof clearTimeout?clearTimeout:null,x="undefined"!=typeof setImmediate?setImmediate:null;function I(l){for(var o=t(c);null!==o;){if(null===o.callback)a(c);else{if(!(o.startTime<=l))break;a(c),o.sortIndex=o.expirationTime,n(f,o)}o=t(c)}}function P(n){if(k=!1,I(n),!_)if(null!==t(f))_=!0,L||(L=!0,C());else{var a=t(c);null!==a&&N(P,a.startTime-n)}}var C,L=!1,M=-1,j=5,F=-1;function R(){return!!w||!(e.unstable_now()-Fn&&R());){var u=p.callback;if("function"==typeof u){p.callback=null,v=p.priorityLevel;var s=u(p.expirationTime<=n);if(n=e.unstable_now(),"function"==typeof s){p.callback=s,I(n),l=!0;break n}p===t(f)&&a(f),I(n)}else a(f);p=t(f)}if(null!==p)l=!0;else{var b=t(c);null!==b&&N(P,b.startTime-n),l=!1}}break e}finally{p=null,v=o,y=!1}l=void 0}}finally{l?C():L=!1}}}if("function"==typeof x)C=function(){x(q)};else if("undefined"!=typeof MessageChannel){var B=new MessageChannel,D=B.port2;B.port1.onmessage=q,C=function(){D.postMessage(null)}}else C=function(){h(q,0)};function N(n,t){M=h(function(){n(e.unstable_now())},t)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(n){n.callback=null},e.unstable_forceFrameRate=function(n){0>n||125u?(a.sortIndex=o,n(c,a),null===t(f)&&a===t(c)&&(k?(T(M),M=-1):k=!0,N(P,o-u))):(a.sortIndex=s,n(f,a),_||y||(_=!0,L||(L=!0,C()))),a},e.unstable_shouldYield=R,e.unstable_wrapCallback=function(n){var t=v;return function(){var a=v;v=t;try{return n.apply(this,arguments)}finally{v=a}}}},108,[]); +__d(function(g,r,i,a,m,e,d){'use strict';!(function _(){if('undefined'!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&'function'==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(_)}catch(_){console.error(_)}})(),m.exports=r(d[0])},109,[110]); +__d(function(g,r,_i,_a,m,e,d){ +/** + * @license React + * react-dom.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ +"use strict";var t=r(d[0]);function i(t){var i="https://react.dev/errors/"+t;if(1{var t=e.offsetHeight,o=e.offsetWidth,s=e.offsetLeft,n=e.offsetTop;for(e=e.offsetParent;e&&1===e.nodeType;)s+=e.offsetLeft+e.clientLeft-e.scrollLeft,n+=e.offsetTop+e.clientTop-e.scrollTop,e=e.offsetParent;return{width:o,height:t,top:n-=window.scrollY,left:s-=window.scrollX}},n=(e,t,o)=>{var n=t||e&&e.parentNode;e&&n&&setTimeout(()=>{if(e.isConnected&&n.isConnected){var t=s(n),l=s(e),f=l.height,u=l.left,c=l.top,b=l.width,p=u-t.left,h=c-t.top;o(p,h,b,f,u,c)}},0)},l={A:!0,BODY:!0,INPUT:!0,SELECT:!0,TEXTAREA:!0},f={blur(e){try{e.blur()}catch(e){}},focus(e){try{var t=e.nodeName;null==e.getAttribute('tabIndex')&&!0!==e.isContentEditable&&null==l[t]&&e.setAttribute('tabIndex','-1'),e.focus()}catch(e){}},measure(e,t){n(e,null,t)},measureInWindow(e,o){e&&setTimeout(()=>{var s=(0,t.default)(e),n=s.height,l=s.left,f=s.top,u=s.width;o(l,f,u,n)},0)},measureLayout(e,t,o,s){n(e,t,s)},updateView(e,t){for(var s in t)if(Object.prototype.hasOwnProperty.call(t,s)){var n=t[s];switch(s){case'style':(0,o.default)(e,n);break;case'class':case'className':e.setAttribute('class',n);break;case'text':case'value':e.value=n;break;default:e.setAttribute(s,n)}}},configureNextLayoutAnimation(e,t){t()},setLayoutAnimationEnabledExperimental(){}}},113,[114,115]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}});var t=t=>{if(null!=t&&(1===t.nodeType&&'function'==typeof t.getBoundingClientRect))return t.getBoundingClientRect()}},114,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return f}});var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e};var f=function(e,t){var f=e.style;for(var o in t)if(t.hasOwnProperty(o)){var u=0===o.indexOf('--'),l=(0,n.default)(o,t[o],u);'float'===o&&(o='cssFloat'),u?f.setProperty(o,l):f[o]=l}}},115,[116]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return n}});var e,t=r(d[0]),u=(e=t)&&e.__esModule?e:{default:e};var n=function(e,t,n){return null==t||'boolean'==typeof t||''===t?'':n||'number'!=typeof t||0===t||u.default.hasOwnProperty(e)&&u.default[e]?(''+t).trim():t+'px'}},116,[117]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return n}});var t={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,flex:!0,flexGrow:!0,flexOrder:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,fontWeight:!0,gridRow:!0,gridRowEnd:!0,gridRowGap:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnGap:!0,gridColumnStart:!0,lineClamp:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0,scale:!0,scaleX:!0,scaleY:!0,scaleZ:!0,shadowOpacity:!0},o=['ms','Moz','O','Webkit'],l=(t,o)=>t+o.charAt(0).toUpperCase()+o.substring(1);Object.keys(t).forEach(n=>{o.forEach(o=>{t[l(o,n)]=t[n]})});var n=t},117,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return s}});var e,n=r(d[0]);function t(){return new Promise((e,n)=>{e(!0)})}var o=((e=n)&&e.__esModule?e:{default:e}).default&&'function'==typeof window.matchMedia?window.matchMedia('(prefers-reduced-motion: reduce)'):null;var u={},c={isScreenReaderEnabled:t,isReduceMotionEnabled:function(){return new Promise((e,n)=>{e(!o||o.matches)})},fetch:t,addEventListener:function(e,n){if('reduceMotionChanged'===e){if(!o)return;var t=e=>{n(e.matches)};s=t,null!=o&&(null!=o.addEventListener?o.addEventListener('change',s):o.addListener(s)),u[n]=t}var s;return{remove:()=>c.removeEventListener(e,n)}},setAccessibilityFocus:function(e){},announceForAccessibility:function(e){},removeEventListener:function(e,n){if('reduceMotionChanged'===e){var t=u[n];if(!t||!o)return;c=t,null!=o&&(null!=o.removeEventListener?o.removeEventListener('change',c):o.removeListener(c))}var c}},s=c},118,[55]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}});var t=class{static alert(){}}},119,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u}});var e,t=r(d[0]),u=((e=t)&&e.__esModule?e:{default:e}).default},120,[121]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return p}});var t=e(r(d[0])),u=e(r(d[1])),l=e(r(d[2])),f=e(r(d[3])),n=e(r(d[4])),o=e(r(d[5])),c=e(r(d[6])),s=e(r(d[7])),_=e(r(d[8])),b=e(r(d[9])),j=u.default.isTesting?_.default:b.default,p=(0,t.default)({FlatList:l.default,Image:f.default,ScrollView:n.default,SectionList:o.default,Text:c.default,View:s.default},j)},121,[40,122,123,195,200,201,205,207,208,209]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}});var t={OS:'web',select:t=>'web'in t?t.web:t.default,get isTesting(){return!1},get Version(){return'0.0.0'}}},122,[]); +__d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return l}});var t=e(r(_d[0])),n=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(n){if('default'!==n){var u=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,u.get?u:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,t})(r(_d[1])),u=e(r(_d[2])),f=e(r(_d[3])),o=n.forwardRef((e,f)=>n.createElement(u.default,(0,t.default)({scrollEventThrottle:1e-4},e,{ref:f}))),l=(0,f.default)(o)},123,[124,30,125,175]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(){return e=Object.assign?Object.assign.bind():function(e){for(var n=1;n{this._listRef=e},this._getItem=(e,t)=>{var s=b(this.props.numColumns);if(s>1){for(var n=[],l=0;l{if(null!=e&&v(e)){var t=b(this.props.numColumns);return t>1?Math.ceil(e.length/t):e.length}return 0},this._keyExtractor=(e,t)=>{var s,n=b(this.props.numColumns),l=null!==(s=this.props.keyExtractor)&&void 0!==s?s:d.keyExtractor;return n>1?((0,h.default)(Array.isArray(e),"FlatList: Encountered internal consistency error, expected each item to consist of an array with 1-%s columns; instead, received a single item.",n),e.map((e,s)=>l(e,t*n+s)).join(':')):l(e,t)},this._renderer=(e,t,s,n,o)=>{var u=b(n),f=s=>e?p.createElement(e,s):t?t(s):null,d=e=>{if(u>1){var t=e.item,n=e.index;return(0,h.default)(Array.isArray(t),'Expected array of items with numColumns > 1'),p.createElement(l.default,{style:[y.row,s]},t.map((t,s)=>{var l=f({item:t,index:n*u+s,separators:e.separators});return null!=l?p.createElement(p.Fragment,{key:s},l):null}))}return f(e)};return e?{ListItemComponent:d}:{renderItem:d}},this._memoizedRenderer=(0,c.default)(this._renderer),this._checkProps(this.props),this.props.viewabilityConfigCallbackPairs?this._virtualizedListPairs=this.props.viewabilityConfigCallbackPairs.map(e=>({viewabilityConfig:e.viewabilityConfig,onViewableItemsChanged:this._createOnViewableItemsChanged(e.onViewableItemsChanged)})):this.props.onViewableItemsChanged&&this._virtualizedListPairs.push({viewabilityConfig:this.props.viewabilityConfig,onViewableItemsChanged:this._createOnViewableItemsChanged(this.props.onViewableItemsChanged)})}componentDidUpdate(e){(0,h.default)(e.numColumns===this.props.numColumns,"Changing numColumns on the fly is not supported. Change the key prop on FlatList when changing the number of columns to force a fresh render of the component."),(0,h.default)(e.onViewableItemsChanged===this.props.onViewableItemsChanged,'Changing onViewableItemsChanged on the fly is not supported'),(0,h.default)(!(0,u.default)(e.viewabilityConfig,this.props.viewabilityConfig),'Changing viewabilityConfig on the fly is not supported'),(0,h.default)(e.viewabilityConfigCallbackPairs===this.props.viewabilityConfigCallbackPairs,'Changing viewabilityConfigCallbackPairs on the fly is not supported'),this._checkProps(this.props)}_checkProps(e){var t=e.getItem,s=e.getItemCount,n=e.horizontal,l=e.columnWrapperStyle,o=e.onViewableItemsChanged,u=e.viewabilityConfigCallbackPairs,p=b(this.props.numColumns);(0,h.default)(!t&&!s,'FlatList does not support custom data formats.'),p>1?(0,h.default)(!n,'numColumns does not support horizontal.'):(0,h.default)(!l,'columnWrapperStyle not supported for single column lists'),(0,h.default)(!(o&&u),"FlatList does not support setting both onViewableItemsChanged and viewabilityConfigCallbackPairs.")}_pushMultiColumnViewable(e,t){var s,l=b(this.props.numColumns),o=null!==(s=this.props.keyExtractor)&&void 0!==s?s:d.keyExtractor;t.item.forEach((s,u)=>{(0,h.default)(null!=t.index,'Missing index!');var p=t.index*l+u;e.push((0,n.default)((0,n.default)({},t),{},{item:s,key:o(s,p),index:p}))})}_createOnViewableItemsChanged(e){return t=>{var s=b(this.props.numColumns);if(e)if(s>1){var n=[],l=[];t.viewableItems.forEach(e=>this._pushMultiColumnViewable(l,e)),t.changed.forEach(e=>this._pushMultiColumnViewable(n,e)),e({viewableItems:l,changed:n})}else e(t)}}render(){var e,n=this.props,l=n.numColumns,o=n.columnWrapperStyle,u=n.removeClippedSubviews,h=n.strictMode,d=void 0!==h&&h,c=(0,s.default)(n,C),b=d?this._memoizedRenderer:this._renderer;return p.createElement(f.default,(0,t.default)({},c,{getItem:this._getItem,getItemCount:this._getItemCount,keyExtractor:this._keyExtractor,ref:this._captureRef,viewabilityConfigCallbackPairs:this._virtualizedListPairs,removeClippedSubviews:(e=u,null!=e&&e)},b(this.props.ListItemComponent,this.props.renderItem,o,l,this.props.extraData)))}}var y=o.default.create({row:{flexDirection:'row'}}),w=_},126,[124,45,40,127,46,144,122,145,30,146,172,174]); +__d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}function o(e){if(e&&e.__esModule)return e;var o={};return e&&Object.keys(e).forEach(function(n){if('default'!==n){var t=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(o,n,t.get?t:{enumerable:!0,get:function(){return e[n]}})}}),o.default=e,o}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return M}});var n=e(r(_d[0])),t=o(r(_d[1])),d=e(r(_d[2])),l=o(r(_d[3])),s=e(r(_d[4])),u=e(r(_d[5])),p=e(r(_d[6])),S=e(r(_d[7])),R=e(r(_d[8])),c=e(r(_d[9])),f=e(r(_d[10])),h=r(_d[11]),v=["hrefAttrs","onLayout","onMoveShouldSetResponder","onMoveShouldSetResponderCapture","onResponderEnd","onResponderGrant","onResponderMove","onResponderReject","onResponderRelease","onResponderStart","onResponderTerminate","onResponderTerminationRequest","onScrollShouldSetResponder","onScrollShouldSetResponderCapture","onSelectionChangeShouldSetResponder","onSelectionChangeShouldSetResponderCapture","onStartShouldSetResponder","onStartShouldSetResponderCapture"],C=Object.assign({},l.defaultProps,l.accessibilityProps,l.clickProps,l.focusProps,l.keyboardProps,l.mouseProps,l.touchProps,l.styleProps,{href:!0,lang:!0,onScroll:!0,onWheel:!0,pointerEvents:!0}),y=e=>(0,s.default)(e,C),b=t.forwardRef((e,o)=>{var l=e.hrefAttrs,s=e.onLayout,c=e.onMoveShouldSetResponder,C=e.onMoveShouldSetResponderCapture,b=e.onResponderEnd,M=e.onResponderGrant,P=e.onResponderMove,w=e.onResponderReject,_=e.onResponderRelease,j=e.onResponderStart,O=e.onResponderTerminate,k=e.onResponderTerminationRequest,T=e.onScrollShouldSetResponder,D=e.onScrollShouldSetResponderCapture,E=e.onSelectionChangeShouldSetResponder,L=e.onSelectionChangeShouldSetResponderCapture,q=e.onStartShouldSetResponder,A=e.onStartShouldSetResponderCapture,G=(0,n.default)(e,v),z=t.useContext(f.default),I=t.useRef(null),W=(0,h.useLocaleContext)().direction;(0,u.default)(I,s),(0,R.default)(I,{onMoveShouldSetResponder:c,onMoveShouldSetResponderCapture:C,onResponderEnd:b,onResponderGrant:M,onResponderMove:P,onResponderReject:w,onResponderRelease:_,onResponderStart:j,onResponderTerminate:O,onResponderTerminationRequest:k,onScrollShouldSetResponder:T,onScrollShouldSetResponderCapture:D,onSelectionChangeShouldSetResponder:E,onSelectionChangeShouldSetResponderCapture:L,onStartShouldSetResponder:q,onStartShouldSetResponderCapture:A});var $='div',B=null!=e.lang?(0,h.getLocaleDirection)(e.lang):null,H=e.dir||B,N=H||W,V=y(G);if(V.dir=H,V.style=[x.view$raw,z&&x.inline,e.style],null!=e.href&&($='a',null!=l)){var F=l.download,J=l.rel,K=l.target;null!=F&&(V.download=F),null!=J&&(V.rel=J),'string'==typeof K&&(V.target='_'!==K.charAt(0)?'_'+K:K)}var Q=(0,S.default)(V),U=(0,p.default)(I,Q,o);return V.ref=U,(0,d.default)($,V,{writingDirection:N})});b.displayName='View';var x=c.default.create({view$raw:{alignContent:'flex-start',alignItems:'stretch',backgroundColor:'transparent',border:'0 solid black',boxSizing:'border-box',display:'flex',flexBasis:'auto',flexDirection:'column',flexShrink:0,listStyle:'none',margin:0,minHeight:0,minWidth:0,padding:0,position:'relative',textDecoration:'none',zIndex:0},inline:{display:'inline-flex'}}),M=b},127,[45,30,34,128,129,130,132,134,136,46,143,101]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"defaultProps",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"accessibilityProps",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"clickProps",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"focusProps",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"keyboardProps",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"mouseProps",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"touchProps",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"styleProps",{enumerable:!0,get:function(){return b}});var t={children:!0,dataSet:!0,dir:!0,id:!0,ref:!0,suppressHydrationWarning:!0,tabIndex:!0,testID:!0,focusable:!0,nativeID:!0},c={'aria-activedescendant':!0,'aria-atomic':!0,'aria-autocomplete':!0,'aria-busy':!0,'aria-checked':!0,'aria-colcount':!0,'aria-colindex':!0,'aria-colspan':!0,'aria-controls':!0,'aria-current':!0,'aria-describedby':!0,'aria-details':!0,'aria-disabled':!0,'aria-errormessage':!0,'aria-expanded':!0,'aria-flowto':!0,'aria-haspopup':!0,'aria-hidden':!0,'aria-invalid':!0,'aria-keyshortcuts':!0,'aria-label':!0,'aria-labelledby':!0,'aria-level':!0,'aria-live':!0,'aria-modal':!0,'aria-multiline':!0,'aria-multiselectable':!0,'aria-orientation':!0,'aria-owns':!0,'aria-placeholder':!0,'aria-posinset':!0,'aria-pressed':!0,'aria-readonly':!0,'aria-required':!0,inert:!0,role:!0,'aria-roledescription':!0,'aria-rowcount':!0,'aria-rowindex':!0,'aria-rowspan':!0,'aria-selected':!0,'aria-setsize':!0,'aria-sort':!0,'aria-valuemax':!0,'aria-valuemin':!0,'aria-valuenow':!0,'aria-valuetext':!0,accessibilityActiveDescendant:!0,accessibilityAtomic:!0,accessibilityAutoComplete:!0,accessibilityBusy:!0,accessibilityChecked:!0,accessibilityColumnCount:!0,accessibilityColumnIndex:!0,accessibilityColumnSpan:!0,accessibilityControls:!0,accessibilityCurrent:!0,accessibilityDescribedBy:!0,accessibilityDetails:!0,accessibilityDisabled:!0,accessibilityErrorMessage:!0,accessibilityExpanded:!0,accessibilityFlowTo:!0,accessibilityHasPopup:!0,accessibilityHidden:!0,accessibilityInvalid:!0,accessibilityKeyShortcuts:!0,accessibilityLabel:!0,accessibilityLabelledBy:!0,accessibilityLevel:!0,accessibilityLiveRegion:!0,accessibilityModal:!0,accessibilityMultiline:!0,accessibilityMultiSelectable:!0,accessibilityOrientation:!0,accessibilityOwns:!0,accessibilityPlaceholder:!0,accessibilityPosInSet:!0,accessibilityPressed:!0,accessibilityReadOnly:!0,accessibilityRequired:!0,accessibilityRole:!0,accessibilityRoleDescription:!0,accessibilityRowCount:!0,accessibilityRowIndex:!0,accessibilityRowSpan:!0,accessibilitySelected:!0,accessibilitySetSize:!0,accessibilitySort:!0,accessibilityValueMax:!0,accessibilityValueMin:!0,accessibilityValueNow:!0,accessibilityValueText:!0},o={onClick:!0,onAuxClick:!0,onContextMenu:!0,onGotPointerCapture:!0,onLostPointerCapture:!0,onPointerCancel:!0,onPointerDown:!0,onPointerEnter:!0,onPointerMove:!0,onPointerLeave:!0,onPointerOut:!0,onPointerOver:!0,onPointerUp:!0},s={onBlur:!0,onFocus:!0},n={onKeyDown:!0,onKeyDownCapture:!0,onKeyUp:!0,onKeyUpCapture:!0},l={onMouseDown:!0,onMouseEnter:!0,onMouseLeave:!0,onMouseMove:!0,onMouseOver:!0,onMouseOut:!0,onMouseUp:!0},u={onTouchCancel:!0,onTouchCancelCapture:!0,onTouchEnd:!0,onTouchEndCapture:!0,onTouchMove:!0,onTouchMoveCapture:!0,onTouchStart:!0,onTouchStartCapture:!0},b={style:!0}},128,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(t,n){var u={};for(var o in t)t.hasOwnProperty(o)&&!0===n[o]&&(u[o]=t[o]);return u}Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}})},129,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return f}});var t=e(r(d[0])),n=e(r(d[1])),u=e(r(d[2])),l='__reactLayoutHandler',o=(u.default,null);function f(e,f){var v=(u.default&&void 0!==window.ResizeObserver&&null==o&&(o=new window.ResizeObserver(function(e){e.forEach(e=>{var t=e.target,u=t[l];'function'==typeof u&&n.default.measure(t,(t,n,l,o,f,v)=>{var c={nativeEvent:{layout:{x:t,y:n,width:l,height:o,left:f,top:v}},timeStamp:Date.now()};Object.defineProperty(c.nativeEvent,'target',{enumerable:!0,get:()=>e.target}),u(c)})})})),o);(0,t.default)(()=>{var t=e.current;null!=t&&(t[l]=f)},[e,f]),(0,t.default)(()=>{var t=e.current;return null!=t&&null!=v&&('function'==typeof t[l]?v.observe(t):v.unobserve(t)),()=>{null!=t&&null!=v&&v.unobserve(t)}},[e,v])}},130,[131,113,55]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return f}});var e,t=r(d[0]),u=r(d[1]),f=((e=u)&&e.__esModule?e:{default:e}).default?t.useLayoutEffect:t.useEffect},131,[30,55]); +__d(function(g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return f}});var e,t=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(n){if('default'!==n){var u=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,u.get?u:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,t})(r(_d[0])),n=r(_d[1]),u=(e=n)&&e.__esModule?e:{default:e};function f(){for(var e=arguments.length,n=new Array(e),f=0;f(0,u.default)(...n),[...n])}},132,[30,133]); +__d(function(g,r,i,a,m,e,d){"use strict";function n(){for(var n=arguments.length,t=new Array(n),o=0;o{null!=t&&('function'!=typeof t?'object'!=typeof t?console.error("mergeRefs cannot handle Refs of type boolean, number or string, received ref "+String(t)):t.current=n:t(n))})}}Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return n}}),r(d[0])},133,[30]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return n}});var u=e(r(d[0])),t=e(r(d[1]));function n(e){e.pointerEvents,e.style;return(0,t.default)(()=>e=>{null!=e&&(e.measure=t=>u.default.measure(e,t),e.measureLayout=(t,n,l)=>u.default.measureLayout(e,t,l,n),e.measureInWindow=t=>u.default.measureInWindow(e,t))})}},134,[113,135]); +__d(function(g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return n}});var e=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(n){if('default'!==n){var u=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,u.get?u:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,t})(r(_d[0])),t='function'==typeof Symbol&&'symbol'==typeof Symbol()?Symbol():Object.freeze({});function n(n){var u=e.useRef(t);return u.current===t&&(u.current=n()),u.current}},135,[30]); +__d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){if(e&&e.__esModule)return e;var n={};return e&&Object.keys(e).forEach(function(t){if('default'!==t){var u=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,u.get?u:{enumerable:!0,get:function(){return e[t]}})}}),n.default=e,n}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return l}});var n=e(r(_d[0])),t=e(r(_d[1])),u={},o=0;function l(e,l){void 0===l&&(l=u);var d,c,s=(d=()=>o++,null==(c=n.useRef(null)).current&&(c.current=d()),c.current),S=n.useRef(!1);n.useEffect(()=>(t.attachListeners(),()=>{t.removeNode(s)}),[s]),n.useEffect(()=>{var n=l,u=n.onMoveShouldSetResponder,o=n.onMoveShouldSetResponderCapture,d=n.onScrollShouldSetResponder,c=n.onScrollShouldSetResponderCapture,f=n.onSelectionChangeShouldSetResponder,p=n.onSelectionChangeShouldSetResponderCapture,h=n.onStartShouldSetResponder,R=n.onStartShouldSetResponderCapture,v=null!=u||null!=o||null!=d||null!=c||null!=f||null!=p||null!=h||null!=R,b=e.current;v?(t.addNode(s,b,l),S.current=!0):S.current&&(t.removeNode(s),S.current=!1)},[l,e,s]),n.useDebugValue({isResponder:e.current===t.getResponderNode()}),n.useDebugValue(l)}},136,[30,137]); +__d(function(g,r,_i2,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.attachListeners=function(){s.default&&null==window.__reactResponderSystemActive&&(window.addEventListener('blur',P),E.forEach(e=>{document.addEventListener(e,P)}),_.forEach(e=>{document.addEventListener(e,P,!0)}),window.__reactResponderSystemActive=!0)},_e.addNode=function(e,n,t){(0,o.setResponderId)(n,e),f.set(e,t)},_e.removeNode=function(e){S.id===e&&M();f.has(e)&&f.delete(e)},_e.terminateResponder=M,_e.getResponderNode=function(){return S.node};var n=e(r(d[0])),t=r(d[1]),o=r(d[2]),i=r(d[3]),s=e(r(d[4])),l={},u=['onStartShouldSetResponderCapture','onStartShouldSetResponder',{bubbles:!0}],c=['onMoveShouldSetResponderCapture','onMoveShouldSetResponder',{bubbles:!0}],p={touchstart:u,mousedown:u,touchmove:c,mousemove:c,scroll:['onScrollShouldSetResponderCapture','onScrollShouldSetResponder',{bubbles:!1}]},h={id:null,idPath:null,node:null},f=new Map,v=!1,R=0,S={id:null,node:null,idPath:null},b=new i.ResponderTouchHistoryStore;function T(e){S=e}function C(e){var n=f.get(e);return null!=n?n:l}function P(e){var i=e.type,s=e.target;if('touchstart'===i&&(v=!0),('touchmove'===i||R>1)&&(v=!1),!('mousedown'===i&&v||'mousemove'===i&&v||'mousemove'===i&&R<1))if(v&&'mouseup'===i)0===R&&(v=!1);else{var l=(0,t.isStartish)(i)&&(0,o.isPrimaryPointerDown)(e),u=(0,t.isMoveish)(i),c=(0,t.isEndish)(i),p=(0,t.isScroll)(i),f=(0,t.isSelectionChange)(i),P=(0,n.default)(e,b);(l||u||c)&&(e.touches?R=e.touches.length:l?R=1:c&&(R=0),b.recordTouchTrack(i,P.nativeEvent));var _,E=(0,o.getResponderPaths)(e),M=!1;if(l||u||p&&R>0){var y=S.idPath,x=E.idPath;if(null!=y&&null!=x){var L=(0,o.getLowestCommonAncestor)(y,x);if(null!=L){var q=x.indexOf(L)+(L===S.id?1:0);E={idPath:x.slice(q),nodePath:E.nodePath.slice(q)}}else E=null}null!=E&&null!=(_=w(E,e,P))&&(N(P,_),M=!0)}if(null!=S.id&&null!=S.node){var j=S,A=j.id,G=j.node,O=C(A),k=O.onResponderStart,D=O.onResponderMove,H=O.onResponderEnd,I=O.onResponderRelease,V=O.onResponderTerminate,z=O.onResponderTerminationRequest;if(P.bubbles=!1,P.cancelable=!1,P.currentTarget=G,l)null!=k&&(P.dispatchConfig.registrationName='onResponderStart',k(P));else if(u)null!=D&&(P.dispatchConfig.registrationName='onResponderMove',D(P));else{var B=(0,t.isCancelish)(i)||'contextmenu'===i||'blur'===i&&s===window||'blur'===i&&s.contains(G)&&e.relatedTarget!==G||p&&0===R||p&&s.contains(G)&&s!==G||f&&(0,o.hasValidSelection)(e),F=c&&!B&&!(0,o.hasTargetTouches)(G,e.touches);if(c&&null!=H&&(P.dispatchConfig.registrationName='onResponderEnd',H(P)),F&&(null!=I&&(P.dispatchConfig.registrationName='onResponderRelease',I(P)),T(h)),B){var J=!0;'contextmenu'!==i&&'scroll'!==i&&'selectionchange'!==i||(M?J=!1:null!=z&&(P.dispatchConfig.registrationName='onResponderTerminationRequest',!1===z(P)&&(J=!1))),J&&(null!=V&&(P.dispatchConfig.registrationName='onResponderTerminate',V(P)),T(h),v=!1,R=0)}}}}}function w(e,n,t){var o=p[n.type];if(null!=o){for(var i=e.idPath,s=e.nodePath,l=o[0],u=o[1],c=o[2].bubbles,h=function(e,n,o){var s=C(e)[o];if(null!=s&&(t.currentTarget=n,!0===s(t)))return{id:e,node:n,idPath:i.slice(i.indexOf(e))}},f=i.length-1;f>=0;f--){var v=h(i[f],s[f],l);if(null!=v)return v;if(!0===t.isPropagationStopped())return}if(c)for(var R=0;R{},o={},c=[];function l(e){return e>20?e%20:e}function f(e,t){var f,p,s,v=!1,y=e.changedTouches,h=e.type,X=!0===e.metaKey,Y=!0===e.shiftKey,P=y&&y[0].force||0,b=l(y&&y[0].identifier||0),T=y&&y[0].clientX||e.clientX,K=y&&y[0].clientY||e.clientY,_=y&&y[0].pageX||e.pageX,D=y&&y[0].pageY||e.pageY,S='function'==typeof e.preventDefault?e.preventDefault.bind(e):u,j=e.timeStamp;function H(e){return Array.prototype.slice.call(e).map(e=>({force:e.force,identifier:l(e.identifier),get locationX(){return A(e.clientX)},get locationY(){return C(e.clientY)},pageX:e.pageX,pageY:e.pageY,target:e.target,timestamp:j}))}if(null!=y)p=H(y),s=H(e.touches);else{var M=[{force:P,identifier:b,get locationX(){return A(T)},get locationY(){return C(K)},pageX:_,pageY:D,target:e.target,timestamp:j}];p=M,s='mouseup'===h||'dragstart'===h?c:M}var O={bubbles:!0,cancelable:!0,currentTarget:null,defaultPrevented:e.defaultPrevented,dispatchConfig:o,eventPhase:e.eventPhase,isDefaultPrevented:()=>e.defaultPrevented,isPropagationStopped:()=>v,isTrusted:e.isTrusted,nativeEvent:{altKey:!1,ctrlKey:!1,metaKey:X,shiftKey:Y,changedTouches:p,force:P,identifier:b,get locationX(){return A(T)},get locationY(){return C(K)},pageX:_,pageY:D,target:e.target,timestamp:j,touches:s,type:h},persist:u,preventDefault:S,stopPropagation(){v=!0},target:e.target,timeStamp:j,touchHistory:t.touchHistory};function A(e){if(f=f||(0,n.default)(O.currentTarget))return e-f.left}function C(e){if(f=f||(0,n.default)(O.currentTarget))return e-f.top}return O}},138,[114]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"BLUR",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"CONTEXT_MENU",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"FOCUS_OUT",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"MOUSE_DOWN",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"MOUSE_MOVE",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"MOUSE_UP",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"MOUSE_CANCEL",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"TOUCH_START",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"TOUCH_MOVE",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"TOUCH_END",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"TOUCH_CANCEL",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"SCROLL",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"SELECT",{enumerable:!0,get:function(){return C}}),Object.defineProperty(e,"SELECTION_CHANGE",{enumerable:!0,get:function(){return P}}),e.isStartish=function(t){return t===b||t===o},e.isMoveish=function(t){return t===l||t===c},e.isEndish=function(t){return t===s||t===f||j(t)},e.isCancelish=j,e.isScroll=function(t){return t===p},e.isSelectionChange=function(t){return t===C||t===P};var t='blur',n='contextmenu',u='focusout',o='mousedown',c='mousemove',f='mouseup',O='dragstart',b='touchstart',l='touchmove',s='touchend',E='touchcancel',p='scroll',C='select',P='selectionchange';function j(t){return t===E||t===O}},139,[]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.setResponderId=function(e,t){null!=e&&(e[o]=t)},_e.getResponderPaths=function(e){for(var t=[],n=[],o=u(e),l=0;l0&&(u=e[l=n-o],n=o);o-n>0&&(c=t[i=o-n],o=n);var s=n;for(;s--;){if(u===c)return u;u=e[l++],c=t[i++]}return null},_e.hasTargetTouches=function(e,t){if(!t||0===t.length)return!1;for(var n=0;n=1&&'\n'!==o&&c}Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return n}})},141,[]); +__d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ResponderTouchHistoryStore",{enumerable:!0,get:function(){return T}});var t=r(d[0]);function n(t){return t.timeStamp||t.timestamp}function i(t){return{touchActive:!0,startPageX:t.pageX,startPageY:t.pageY,startTimeStamp:n(t),currentPageX:t.pageX,currentPageY:t.pageY,currentTimeStamp:n(t),previousPageX:t.pageX,previousPageY:t.pageY,previousTimeStamp:n(t)}}function c(t,i){t.touchActive=!0,t.startPageX=i.pageX,t.startPageY=i.pageY,t.startTimeStamp=n(i),t.currentPageX=i.pageX,t.currentPageY=i.pageY,t.currentTimeStamp=n(i),t.previousPageX=i.pageX,t.previousPageY=i.pageY,t.previousTimeStamp=n(i)}function o(t){var n=t.identifier;return null==n&&console.error('Touch object is missing identifier.'),n}function u(t,u){var s=o(t),h=u.touchBank[s];h?c(h,t):u.touchBank[s]=i(t),u.mostRecentTimeStamp=n(t)}function s(t,i){var c=i.touchBank[o(t)];c?(c.touchActive=!0,c.previousPageX=c.currentPageX,c.previousPageY=c.currentPageY,c.previousTimeStamp=c.currentTimeStamp,c.currentPageX=t.pageX,c.currentPageY=t.pageY,c.currentTimeStamp=n(t),i.mostRecentTimeStamp=n(t)):console.warn('Cannot record touch move without a touch start.\n',"Touch Move: "+p(t)+"\n","Touch Bank: "+v(i))}function h(t,i){var c=i.touchBank[o(t)];c?(c.touchActive=!1,c.previousPageX=c.currentPageX,c.previousPageY=c.currentPageY,c.previousTimeStamp=c.currentTimeStamp,c.currentPageX=t.pageX,c.currentPageY=t.pageY,c.currentTimeStamp=n(t),i.mostRecentTimeStamp=n(t)):console.warn('Cannot record touch end without a touch start.\n',"Touch End: "+p(t)+"\n","Touch Bank: "+v(i))}function p(t){return JSON.stringify({identifier:t.identifier,pageX:t.pageX,pageY:t.pageY,timestamp:n(t)})}function v(t){var n=t.touchBank,i=JSON.stringify(n.slice(0,20));return n.length>20&&(i+=' (original size: '+n.length+')'),i}class T{constructor(){this._touchHistory={touchBank:[],numberActiveTouches:0,indexOfSingleActiveTouch:-1,mostRecentTimeStamp:0}}recordTouchTrack(n,i){var c=this._touchHistory;if((0,t.isMoveish)(n))i.changedTouches.forEach(t=>s(t,c));else if((0,t.isStartish)(n))i.changedTouches.forEach(t=>u(t,c)),c.numberActiveTouches=i.touches.length,1===c.numberActiveTouches&&(c.indexOfSingleActiveTouch=i.touches[0].identifier);else if((0,t.isEndish)(n)&&(i.changedTouches.forEach(t=>h(t,c)),c.numberActiveTouches=i.touches.length,1===c.numberActiveTouches))for(var o=c.touchBank,p=0;p2?t-2:0),s=2;s=0;s--)if(t(e[s]))return e[s];return null}class O extends _.default{scrollToEnd(e){var t=!e||e.animated,s=this.props.getItemCount(this.props.data)-1;if(!(s<0)){var r=this.__getFrameMetricsApprox(s,this.props),i=Math.max(0,r.offset+r.length+this._footerLength-this._scrollMetrics.visibleLength);null!=this._scrollRef&&(null!=this._scrollRef.scrollTo?this._scrollRef.scrollTo(w(this.props.horizontal)?{x:i,animated:t}:{y:i,animated:t}):console.warn("No scrollTo method provided. This may be because you have two nested VirtualizedLists with the same orientation, or because you are using a custom component that does not implement scrollTo."))}}scrollToIndex(e){var t=this.props,s=t.data,r=t.horizontal,i=t.getItemCount,o=t.getItemLayout,l=t.onScrollToIndexFailed,n=e.animated,h=e.index,d=e.viewOffset,c=e.viewPosition;if((0,b.default)(h>=0,"scrollToIndex out of range: requested index "+h+" but minimum is 0"),(0,b.default)(i(s)>=1,"scrollToIndex out of range: item length "+i(s)+" but minimum is 1"),(0,b.default)(hthis._highestMeasuredFrameIndex)return(0,b.default)(!!l,"scrollToIndex should be used in conjunction with getItemLayout or onScrollToIndexFailed, otherwise there is no way to know the location of offscreen indices or handle failures."),void l({averageItemLength:this._averageCellLength,highestMeasuredFrameIndex:this._highestMeasuredFrameIndex,index:h});var u=this.__getFrameMetricsApprox(Math.floor(h),this.props),p=Math.max(0,this._getOffsetApprox(h,this.props)-(c||0)*(this._scrollMetrics.visibleLength-u.length))-(d||0);null!=this._scrollRef&&(null!=this._scrollRef.scrollTo?this._scrollRef.scrollTo(r?{x:p,animated:n}:{y:p,animated:n}):console.warn("No scrollTo method provided. This may be because you have two nested VirtualizedLists with the same orientation, or because you are using a custom component that does not implement scrollTo."))}scrollToItem(e){for(var t=e.item,s=this.props,i=s.data,o=s.getItem,l=(0,s.getItemCount)(i),n=0;n{e.recordInteraction()}),this._viewabilityTuples.forEach(e=>{e.viewabilityHelper.recordInteraction()}),this._updateViewableItems(this.props,this.state.cellsAroundViewport)}flashScrollIndicators(){null!=this._scrollRef&&this._scrollRef.flashScrollIndicators()}getScrollResponder(){if(this._scrollRef&&this._scrollRef.getScrollResponder)return this._scrollRef.getScrollResponder()}getScrollableNode(){return this._scrollRef&&this._scrollRef.getScrollableNode?this._scrollRef.getScrollableNode():this._scrollRef}getScrollRef(){return this._scrollRef&&this._scrollRef.getScrollRef?this._scrollRef.getScrollRef():this._scrollRef}_getCellKey(){var e;return(null==(e=this.context)?void 0:e.cellKey)||'rootList'}hasMore(){return this._hasMore}constructor(e){var t;if(super(e),this._getScrollMetrics=()=>this._scrollMetrics,this._getOutermostParentListRef=()=>this._isNestedWithSameOrientation()?this.context.getOutermostParentListRef():this,this._registerAsNestedChild=e=>{this._nestedChildLists.add(e.ref,e.cellKey),this._hasInteracted&&e.ref.recordInteraction()},this._unregisterAsNestedChild=e=>{this._nestedChildLists.remove(e.ref)},this._onUpdateSeparators=(e,t)=>{e.forEach(e=>{var s=null!=e&&this._cellRefs[e];s&&s.updateSeparatorProps(t)})},this._getSpacerKey=e=>e?'height':'width',this._averageCellLength=0,this._cellRefs={},this._frames={},this._footerLength=0,this._hasTriggeredInitialScrollToIndex=!1,this._hasInteracted=!1,this._hasMore=!1,this._hasWarned={},this._headerLength=0,this._hiPriInProgress=!1,this._highestMeasuredFrameIndex=0,this._indicesToKeys=new Map,this._lastFocusedCellKey=null,this._nestedChildLists=new p.default,this._offsetFromParentVirtualizedList=0,this._prevParentOffset=0,this._scrollMetrics={contentLength:0,dOffset:0,dt:10,offset:0,timestamp:0,velocity:0,visibleLength:0,zoomScale:1},this._scrollRef=null,this._sentStartForContentLength=0,this._sentEndForContentLength=0,this._totalCellLength=0,this._totalCellsMeasured=0,this._viewabilityTuples=[],this._captureScrollRef=e=>{this._scrollRef=e},this._defaultRenderScrollComponent=e=>{var t,r=e.onRefresh;return this._isNestedWithSameOrientation()?M.createElement(l.default,e):r?((0,b.default)('boolean'==typeof e.refreshing,'`refreshing` prop must be set as a boolean in order to use `onRefresh`, but got `'+JSON.stringify(null!==(t=e.refreshing)&&void 0!==t?t:'undefined')+'`'),M.createElement(o.default,(0,s.default)({},e,{refreshControl:null==e.refreshControl?M.createElement(i.default,{refreshing:e.refreshing,onRefresh:r,progressViewOffset:e.progressViewOffset}):e.refreshControl}))):M.createElement(o.default,e)},this._onCellLayout=(e,t,s)=>{var r=e.nativeEvent.layout,i={offset:this._selectOffset(r),length:this._selectLength(r),index:s,inLayout:!0},o=this._frames[t];o&&i.offset===o.offset&&i.length===o.length&&s===o.index?this._frames[t].inLayout=!0:(this._totalCellLength+=i.length-(o?o.length:0),this._totalCellsMeasured+=o?0:1,this._averageCellLength=this._totalCellLength/this._totalCellsMeasured,this._frames[t]=i,this._highestMeasuredFrameIndex=Math.max(this._highestMeasuredFrameIndex,s),this._scheduleCellsToRenderUpdate()),this._triggerRemeasureForChildListsInCell(t),this._computeBlankness(),this._updateViewableItems(this.props,this.state.cellsAroundViewport)},this._onCellUnmount=e=>{delete this._cellRefs[e];var t=this._frames[e];t&&(this._frames[e]=(0,r.default)((0,r.default)({},t),{},{inLayout:!1}))},this._onLayout=e=>{this._isNestedWithSameOrientation()?this.measureLayoutRelativeToContainingList():this._scrollMetrics.visibleLength=this._selectLength(e.nativeEvent.layout),this.props.onLayout&&this.props.onLayout(e),this._scheduleCellsToRenderUpdate(),this._maybeCallOnEdgeReached()},this._onLayoutEmpty=e=>{this.props.onLayout&&this.props.onLayout(e)},this._onLayoutFooter=e=>{this._triggerRemeasureForChildListsInCell(this._getFooterCellKey()),this._footerLength=this._selectLength(e.nativeEvent.layout)},this._onLayoutHeader=e=>{this._headerLength=this._selectLength(e.nativeEvent.layout)},this._onContentSizeChange=(e,t)=>{e>0&&t>0&&null!=this.props.initialScrollIndex&&this.props.initialScrollIndex>0&&!this._hasTriggeredInitialScrollToIndex&&(null==this.props.contentOffset&&(this.props.initialScrollIndex{var t=e.offset-this._offsetFromParentVirtualizedList,s=e.visibleLength,r=t-this._scrollMetrics.offset;return{visibleLength:s,contentLength:this._scrollMetrics.contentLength,offset:t,dOffset:r}},this._onScroll=e=>{this._nestedChildLists.forEach(t=>{t._onScroll(e)}),this.props.onScroll&&this.props.onScroll(e);var t=e.timeStamp,s=this._selectLength(e.nativeEvent.layoutMeasurement),r=this._selectLength(e.nativeEvent.contentSize),i=this._selectOffset(e.nativeEvent.contentOffset),o=i-this._scrollMetrics.offset;if(this._isNestedWithSameOrientation()){if(0===this._scrollMetrics.contentLength)return;var l=this._convertParentScrollMetrics({visibleLength:s,offset:i});s=l.visibleLength,r=l.contentLength,i=l.offset,o=l.dOffset}var n=this._scrollMetrics.timestamp?Math.max(1,t-this._scrollMetrics.timestamp):1,h=o/n;n>500&&this._scrollMetrics.dt>500&&r>5*s&&!this._hasWarned.perf&&((0,c.default)("VirtualizedList: You have a large list that is slow to update - make sure your renderItem function renders components that follow React performance best practices like PureComponent, shouldComponentUpdate, etc.",{dt:n,prevDt:this._scrollMetrics.dt,contentLength:r}),this._hasWarned.perf=!0);var d=e.nativeEvent.zoomScale<0?1:e.nativeEvent.zoomScale;this._scrollMetrics={contentLength:r,dt:n,dOffset:o,offset:i,timestamp:t,velocity:h,visibleLength:s,zoomScale:d},this._updateViewableItems(this.props,this.state.cellsAroundViewport),this.props&&(this._maybeCallOnEdgeReached(),0!==h&&this._fillRateHelper.activate(),this._computeBlankness(),this._scheduleCellsToRenderUpdate())},this._onScrollBeginDrag=e=>{this._nestedChildLists.forEach(t=>{t._onScrollBeginDrag(e)}),this._viewabilityTuples.forEach(e=>{e.viewabilityHelper.recordInteraction()}),this._hasInteracted=!0,this.props.onScrollBeginDrag&&this.props.onScrollBeginDrag(e)},this._onScrollEndDrag=e=>{this._nestedChildLists.forEach(t=>{t._onScrollEndDrag(e)});var t=e.nativeEvent.velocity;t&&(this._scrollMetrics.velocity=this._selectOffset(t)),this._computeBlankness(),this.props.onScrollEndDrag&&this.props.onScrollEndDrag(e)},this._onMomentumScrollBegin=e=>{this._nestedChildLists.forEach(t=>{t._onMomentumScrollBegin(e)}),this.props.onMomentumScrollBegin&&this.props.onMomentumScrollBegin(e)},this._onMomentumScrollEnd=e=>{this._nestedChildLists.forEach(t=>{t._onMomentumScrollEnd(e)}),this._scrollMetrics.velocity=0,this._computeBlankness(),this.props.onMomentumScrollEnd&&this.props.onMomentumScrollEnd(e)},this._updateCellsToRender=()=>{this._updateViewableItems(this.props,this.state.cellsAroundViewport),this.setState((e,t)=>{var s=this._adjustCellsAroundViewport(t,e.cellsAroundViewport),r=O._createRenderMask(t,s,this._getNonViewportRenderRegions(t));return s.first===e.cellsAroundViewport.first&&s.last===e.cellsAroundViewport.last&&r.equals(e.renderMask)?null:{cellsAroundViewport:s,renderMask:r}})},this._createViewToken=(e,t,s)=>{var r=s.data,i=(0,s.getItem)(r,e);return{index:e,item:i,key:this._keyExtractor(i,e,s),isViewable:t}},this._getOffsetApprox=(e,t)=>{if(Number.isInteger(e))return this.__getFrameMetricsApprox(e,t).offset;var s=this.__getFrameMetricsApprox(Math.floor(e),t),r=e-Math.floor(e);return s.offset+r*s.length},this.__getFrameMetricsApprox=(e,t)=>{var s=this._getFrameMetrics(e,t);if(s&&s.index===e)return s;var r=t.data,i=t.getItemCount,o=t.getItemLayout;return(0,b.default)(e>=0&&e{var s=t.data,r=t.getItem,i=t.getItemCount,o=t.getItemLayout;(0,b.default)(e>=0&&e{if(!this._lastFocusedCellKey||!this._cellRefs[this._lastFocusedCellKey])return[];var t=this._cellRefs[this._lastFocusedCellKey].props.index,s=e.getItemCount(e.data);if(t>=s||this._keyExtractor(e.getItem(e.data,t),t,e)!==this._lastFocusedCellKey)return[];for(var r=t,i=0,o=r-1;o>=0&&i({viewabilityHelper:new v.default(e.viewabilityConfig),onViewableItemsChanged:e.onViewableItemsChanged}));else{var n=this.props,d=n.onViewableItemsChanged,u=n.viewabilityConfig;d&&this._viewabilityTuples.push({viewabilityHelper:new v.default(u),onViewableItemsChanged:d})}var _=O._initialRenderRegion(e);this.state={cellsAroundViewport:_,renderMask:O._createRenderMask(e,_)},this.invertedWheelEventHandler=e=>{var t=this.props.horizontal?e.target.scrollLeft:e.target.scrollTop,s=this.props.horizontal?e.target.scrollWidth:e.target.scrollHeight,r=this.props.horizontal?e.target.clientWidth:e.target.clientHeight,i=s>r,o=this.props.horizontal?e.deltaX||e.wheelDeltaX:e.deltaY||e.wheelDeltaY,l=o;i&&(l=o<0?Math.min(o+t,0):Math.max(o-(s-r-t),0));var n=o-l;if(this.props.inverted&&this._scrollRef&&this._scrollRef.getScrollableNode){var h=this._scrollRef.getScrollableNode();if(this.props.horizontal){e.target.scrollLeft+=n;var d=h.scrollLeft-l;h.scrollLeft=this.props.getItemLayout?d:Math.min(d,this._totalCellLength)}else{e.target.scrollTop+=n;var c=h.scrollTop-l;h.scrollTop=this.props.getItemLayout?c:Math.min(c,this._totalCellLength)}e.preventDefault()}}}_checkProps(e){var t=e.onScroll,s=e.windowSize,r=e.getItemCount,i=e.data,o=e.initialScrollIndex;(0,b.default)(!t||!t.__isNative,"Components based on VirtualizedList must be wrapped with Animated.createAnimatedComponent to support native onScroll events with useNativeDriver"),(0,b.default)(V(s)>0,'VirtualizedList: The windowSize prop must be present and set to a value greater than 0.'),(0,b.default)(r,'VirtualizedList: The "getItemCount" prop must be provided');var l=r(i);null==o||this._hasTriggeredInitialScrollToIndex||!(o<0||l>0&&o>=l)||this._hasWarned.initialScrollIndex||(console.warn("initialScrollIndex \""+o+"\" is not valid (list has "+l+" items)"),this._hasWarned.initialScrollIndex=!0)}static _createRenderMask(e,t,s){var r=e.getItemCount(e.data);(0,b.default)(t.first>=0&&t.last>=t.first-1&&t.last0){for(var o=0,l=[t,...null!=s?s:[]];o=0;o--)if(t.has(o+i)){s.addCells({first:o,last:o});break}}_adjustCellsAroundViewport(e,t){var s,r=e.data,i=e.getItemCount,o=T(e.onEndReachedThreshold),l=this._scrollMetrics,n=l.contentLength,h=l.offset,d=l.visibleLength,c=n-d-h;if(d<=0||n<=0)return t.last>=i(r)?O._constrainToItemCount(t,e):t;if(e.disableVirtualization){var u=c=Number.EPSILON)return t.last>=i(r)?O._constrainToItemCount(t,e):t;s=(0,L.computeWindowedRenderLimits)(e,x(e.maxToRenderPerBatch),V(e.windowSize),t,this.__getFrameMetricsApprox,this._scrollMetrics),(0,b.default)(s.last0){var p=this._findFirstChildWithMore(s.first,s.last);s.last=null!=p?p:s.last}return s}_findFirstChildWithMore(e,t){for(var s=e;s<=t;s++){var r=this._indicesToKeys.get(s);if(null!=r&&this._nestedChildLists.anyInCell(r,e=>e.hasMore()))return s}return null}componentDidMount(){this._isNestedWithSameOrientation()&&this.context.registerAsNestedChild({ref:this,cellKey:this.context.cellKey}),this.setupWebWheelHandler()}componentWillUnmount(){this._isNestedWithSameOrientation()&&this.context.unregisterAsNestedChild({ref:this}),this._updateCellsToRenderBatcher.dispose({abort:!0}),this._viewabilityTuples.forEach(e=>{e.viewabilityHelper.dispose()}),this._fillRateHelper.deactivateAndFlush(),this.teardownWebWheelHandler()}setupWebWheelHandler(){this._scrollRef&&this._scrollRef.getScrollableNode?this._scrollRef.getScrollableNode().addEventListener('wheel',this.invertedWheelEventHandler):setTimeout(()=>this.setupWebWheelHandler(),50)}teardownWebWheelHandler(){this._scrollRef&&this._scrollRef.getScrollableNode&&this._scrollRef.getScrollableNode().removeEventListener('wheel',this.invertedWheelEventHandler)}static getDerivedStateFromProps(e,t){if(e.getItemCount(e.data)===t.renderMask.numCells())return t;var s=O._constrainToItemCount(t.cellsAroundViewport,e);return{cellsAroundViewport:s,renderMask:O._createRenderMask(e,s)}}_pushCells(e,t,r,i,o,l){var n,h=this,d=this.props,c=d.CellRendererComponent,u=d.ItemSeparatorComponent,p=d.ListHeaderComponent,f=d.ListItemComponent,_=d.data,v=d.debug,C=d.getItem,L=d.getItemCount,b=d.getItemLayout,S=d.horizontal,I=d.renderItem,R=p?1:0,w=L(_)-1;o=Math.min(w,o);for(var x=function(){var i=C(_,E),o=h._keyExtractor(i,E,h.props);h._indicesToKeys.set(E,o),r.has(E+R)&&t.push(e.length);var d=null==b||v||h._fillRateHelper.enabled();e.push(M.createElement(y.default,(0,s.default)({CellRendererComponent:c,ItemSeparatorComponent:Eh._onCellFocusCapture(o),onUnmount:h._onCellUnmount,ref:e=>{h._cellRefs[o]=e},renderItem:I},d&&{onCellLayout:h._onCellLayout}))),n=o},E=i;E<=o;E++)x()}static _constrainToItemCount(e,t){var s=t.getItemCount(t.data),r=Math.min(s-1,e.last),i=x(t.maxToRenderPerBatch);return{first:(0,d.default)(0,s-1-i,e.first),last:r}}_isNestedWithSameOrientation(){var e=this.context;return!(!e||!!e.horizontal!==w(this.props.horizontal))}_keyExtractor(e,t,s){if(null!=s.keyExtractor)return s.keyExtractor(e,t);var r=(0,L.keyExtractor)(e,t);return r===String(t)&&(I=!0,e.type&&e.type.displayName&&(R=e.type.displayName)),r}render(){this._checkProps(this.props);var e=this.props,s=e.ListEmptyComponent,i=e.ListFooterComponent,o=e.ListHeaderComponent,n=this.props,h=n.data,c=n.horizontal,u=this.props.inverted?w(this.props.horizontal)?z.horizontallyInverted:z.verticallyInverted:null,p=[],f=new Set(this.props.stickyHeaderIndices),_=[];if(o){f.has(0)&&_.push(0);var v=M.isValidElement(o)?o:M.createElement(o,null);p.push(M.createElement(C.VirtualizedListCellContextProvider,{cellKey:this._getCellKey()+'-header',key:"$header"},M.createElement(l.default,{onLayout:this._onLayoutHeader,style:[u,this.props.ListHeaderComponentStyle]},v)))}var y=this.props.getItemCount(h);if(0===y&&s){var L=M.isValidElement(s)?s:M.createElement(s,null);p.push(M.createElement(C.VirtualizedListCellContextProvider,{cellKey:this._getCellKey()+'-empty',key:"$empty"},M.cloneElement(L,{onLayout:e=>{this._onLayoutEmpty(e),L.props.onLayout&&L.props.onLayout(e)},style:[u,L.props.style]})))}if(y>0){I=!1,R='';for(var b,S=this._getSpacerKey(!c),x=this.state.renderMask.enumerateRegions(),E=k(x,e=>e.isSpacer),T=(0,t.default)(x);!(b=T()).done;){var F=b.value;if(F.isSpacer){if(this.props.disableVirtualization)continue;var V=F===E&&!this.props.getItemLayout?(0,d.default)(F.first-1,F.last,this._highestMeasuredFrameIndex):F.last,O=this.__getFrameMetricsApprox(F.first,this.props),A=this.__getFrameMetricsApprox(V,this.props),P=A.offset+A.length-O.offset;p.push(M.createElement(l.default,{key:"$spacer-"+F.first,style:{[S]:P}}))}else this._pushCells(p,_,f,F.first,F.last,u)}!this._hasWarned.keys&&I&&(console.warn("VirtualizedList: missing keys for items, make sure to specify a key or id property on each item or provide a custom keyExtractor.",R),this._hasWarned.keys=!0)}if(i){var N=M.isValidElement(i)?i:M.createElement(i,null);p.push(M.createElement(C.VirtualizedListCellContextProvider,{cellKey:this._getFooterCellKey(),key:"$footer"},M.createElement(l.default,{onLayout:this._onLayoutFooter,style:[u,this.props.ListFooterComponentStyle]},N)))}var W,H=(0,r.default)((0,r.default)({},this.props),{},{onContentSizeChange:this._onContentSizeChange,onLayout:this._onLayout,onScroll:this._onScroll,onScrollBeginDrag:this._onScrollBeginDrag,onScrollEndDrag:this._onScrollEndDrag,onMomentumScrollBegin:this._onMomentumScrollBegin,onMomentumScrollEnd:this._onMomentumScrollEnd,scrollEventThrottle:(W=this.props.scrollEventThrottle,null!=W?W:50),invertStickyHeaders:void 0!==this.props.invertStickyHeaders?this.props.invertStickyHeaders:this.props.inverted,stickyHeaderIndices:_,style:u?[u,this.props.style]:this.props.style});this._hasMore=this.state.cellsAroundViewport.last{e.viewabilityHelper.resetViewableIndices()});var i=this._hiPriInProgress;this._scheduleCellsToRenderUpdate(),i&&(this._hiPriInProgress=!1)}_computeBlankness(){this._fillRateHelper.computeBlankness(this.props,this.state.cellsAroundViewport,this._scrollMetrics)}_onCellFocusCapture(e){this._lastFocusedCellKey=e,this._updateCellsToRender()}_triggerRemeasureForChildListsInCell(e){this._nestedChildLists.forEachInCell(e,e=>{e.measureLayoutRelativeToContainingList()})}measureLayoutRelativeToContainingList(){try{if(!this._scrollRef)return;this._scrollRef.measureLayout(this.context.getOutermostParentListRef().getScrollRef(),(e,t,s,r)=>{this._offsetFromParentVirtualizedList=this._selectOffset({x:e,y:t}),this._scrollMetrics.contentLength=this._selectLength({width:s,height:r});var i=this._convertParentScrollMetrics(this.context.getScrollMetrics());(this._scrollMetrics.visibleLength!==i.visibleLength||this._scrollMetrics.offset!==i.offset)&&(this._scrollMetrics.visibleLength=i.visibleLength,this._scrollMetrics.offset=i.offset,this._nestedChildLists.forEach(e=>{e.measureLayoutRelativeToContainingList()}))},e=>{console.warn("VirtualizedList: Encountered an error while measuring a list's offset from its containing VirtualizedList.")})}catch(e){console.warn('measureLayoutRelativeToContainingList threw an error',e.stack)}}_getFooterCellKey(){return this._getCellKey()+'-footer'}_renderDebugOverlay(){for(var e=this._scrollMetrics.visibleLength/(this._scrollMetrics.contentLength||1),t=[],s=this.props.getItemCount(this.props.data),r=0;rM.createElement(l.default,{key:'f'+s,style:[z.debugOverlayBase,z.debugOverlayFrame,{top:t.offset*e,height:t.length*e}]})),M.createElement(l.default,{style:[z.debugOverlayBase,z.debugOverlayFrameLast,{top:o*e,height:h*e}]}),M.createElement(l.default,{style:[z.debugOverlayBase,z.debugOverlayFrameVis,{top:d*e,height:c*e}]}))}_selectLength(e){return w(this.props.horizontal)?e.width:e.height}_selectOffset(e){return w(this.props.horizontal)?e.x:e.y}_maybeCallOnEdgeReached(){var e=this.props,t=e.data,s=e.getItemCount,r=e.onStartReached,i=e.onStartReachedThreshold,o=e.onEndReached,l=e.onEndReachedThreshold,n=e.initialScrollIndex,h=this._scrollMetrics,d=h.contentLength,c=h.visibleLength,u=h.offset,p=u,f=d-c-u;p<.001&&(p=0),f<.001&&(f=0);var _=p<=(null!=i?i*c:2),v=f<=(null!=l?l*c:2);o&&this.state.cellsAroundViewport.last===s(t)-1&&v&&this._scrollMetrics.contentLength!==this._sentEndForContentLength?(this._sentEndForContentLength=this._scrollMetrics.contentLength,o({distanceFromEnd:f})):null!=r&&0===this.state.cellsAroundViewport.first&&_&&this._scrollMetrics.contentLength!==this._sentStartForContentLength?n&&0===this._scrollMetrics.timestamp||(this._sentStartForContentLength=this._scrollMetrics.contentLength,r({distanceFromStart:p})):(this._sentStartForContentLength=_?this._sentStartForContentLength:0,this._sentEndForContentLength=v?this._sentEndForContentLength:0)}_scheduleCellsToRenderUpdate(){var e=this.state.cellsAroundViewport,t=e.first,s=e.last,r=this._scrollMetrics,i=r.offset,o=r.visibleLength,l=r.velocity,n=this.props.getItemCount(this.props.data),h=!1,d=E(this.props.onStartReachedThreshold),c=T(this.props.onEndReachedThreshold);if(t>0){var u=i-this.__getFrameMetricsApprox(t,this.props).offset;h=u<0||l<-2&&u=0&&s2&&p{s.viewabilityHelper.onUpdate(e,this._scrollMetrics.offset,this._scrollMetrics.visibleLength,this._getFrameMetrics,this._createViewToken,s.onViewableItemsChanged,t)})}}O.contextType=C.VirtualizedListContext;var z=n.default.create({verticallyInverted:{transform:'scaleY(-1)'},horizontallyInverted:{transform:'scaleX(-1)'},debug:{flex:1},debugOverlayBase:{position:'absolute',top:0,right:0},debugOverlay:{bottom:0,width:20,borderColor:'blue',borderWidth:1},debugOverlayFrame:{left:0,backgroundColor:'orange'},debugOverlayFrameLast:{left:0,borderColor:'green',borderWidth:2},debugOverlayFrameVis:{left:0,borderColor:'red',borderWidth:2}}),A=O},146,[147,124,40,150,151,127,46,158,163,164,165,166,167,168,169,170,171,172,145,173,30]); +__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return n}});var e,t=_r(d[0]),r=(e=t)&&e.__esModule?e:{default:e};function n(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=(0,r.default)(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0;return function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},147,[148]); +__d(function(g,_r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return n}});var e,t=_r(d[0]),r=(e=t)&&e.__esModule?e:{default:e};function n(e,t){if(e){if("string"==typeof e)return(0,r.default)(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?(0,r.default)(e,t):void 0}}},148,[149]); +__d(function(g,_r,i,_a,m,_e,d){"use strict";function e(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);nthis.isTouching,this.scrollResponderHandleStartShouldSetResponderCapture=e=>this.scrollResponderIsAnimating(),this.scrollResponderHandleTerminationRequest=()=>!this.observedScrollSinceBecomingResponder,this.scrollResponderHandleTouchEnd=e=>{var o=e.nativeEvent;this.isTouching=0!==o.touches.length,this.props.onTouchEnd&&this.props.onTouchEnd(e)},this.scrollResponderHandleResponderRelease=e=>{this.props.onResponderRelease&&this.props.onResponderRelease(e);var o=u.default.currentlyFocusedField();this.props.keyboardShouldPersistTaps||null==o||e.target===o||this.observedScrollSinceBecomingResponder||this.becameResponderWhileAnimating||(this.props.onScrollResponderKeyboardDismissed&&this.props.onScrollResponderKeyboardDismissed(e),u.default.blurTextInput(o))},this.scrollResponderHandleScroll=e=>{this.observedScrollSinceBecomingResponder=!0,this.props.onScroll&&this.props.onScroll(e)},this.scrollResponderHandleResponderGrant=e=>{this.observedScrollSinceBecomingResponder=!1,this.props.onResponderGrant&&this.props.onResponderGrant(e),this.becameResponderWhileAnimating=this.scrollResponderIsAnimating()},this.scrollResponderHandleScrollBeginDrag=e=>{this.props.onScrollBeginDrag&&this.props.onScrollBeginDrag(e)},this.scrollResponderHandleScrollEndDrag=e=>{this.props.onScrollEndDrag&&this.props.onScrollEndDrag(e)},this.scrollResponderHandleMomentumScrollBegin=e=>{this.lastMomentumScrollBeginTime=Date.now(),this.props.onMomentumScrollBegin&&this.props.onMomentumScrollBegin(e)},this.scrollResponderHandleMomentumScrollEnd=e=>{this.lastMomentumScrollEndTime=Date.now(),this.props.onMomentumScrollEnd&&this.props.onMomentumScrollEnd(e)},this.scrollResponderHandleTouchStart=e=>{this.isTouching=!0,this.props.onTouchStart&&this.props.onTouchStart(e)},this.scrollResponderHandleTouchMove=e=>{this.props.onTouchMove&&this.props.onTouchMove(e)},this.scrollResponderIsAnimating=()=>Date.now()-this.lastMomentumScrollEndTime<16||this.lastMomentumScrollEndTime{if('number'==typeof e)console.warn('`scrollResponderScrollTo(x, y, animated)` is deprecated. Use `scrollResponderScrollTo({x: 5, y: 5, animated: true})` instead.');else{var n=e||b;e=n.x,o=n.y,l=n.animated}var t=this.getScrollableNode(),s=e||0,i=o||0;null!=t&&('function'==typeof t.scroll?t.scroll({top:i,left:s,behavior:l?'smooth':'auto'}):(t.scrollLeft=s,t.scrollTop=i))},this.scrollResponderZoomTo=(e,o)=>{(0,i.default)('zoomToRect is not implemented')},this.scrollResponderScrollNativeHandleToKeyboard=(e,o,l)=>{this.additionalScrollOffset=o||0,this.preventNegativeScrollOffset=!!l,S.default.measureLayout(e,this.getInnerViewNode(),this.scrollResponderTextInputFocusError,this.scrollResponderInputMeasureAndScrollToKeyboard)},this.scrollResponderInputMeasureAndScrollToKeyboard=(e,o,l,n)=>{var s=t.default.get('window').height;this.keyboardWillOpenTo&&(s=this.keyboardWillOpenTo.endCoordinates.screenY);var i=o-s+n+this.additionalScrollOffset;this.preventNegativeScrollOffset&&(i=Math.max(0,i)),this.scrollResponderScrollTo({x:0,y:i,animated:!0}),this.additionalOffset=0,this.preventNegativeScrollOffset=!1},this.scrollResponderKeyboardWillShow=e=>{this.keyboardWillOpenTo=e,this.props.onKeyboardWillShow&&this.props.onKeyboardWillShow(e)},this.scrollResponderKeyboardWillHide=e=>{this.keyboardWillOpenTo=null,this.props.onKeyboardWillHide&&this.props.onKeyboardWillHide(e)},this.scrollResponderKeyboardDidShow=e=>{e&&(this.keyboardWillOpenTo=e),this.props.onKeyboardDidShow&&this.props.onKeyboardDidShow(e)},this.scrollResponderKeyboardDidHide=e=>{this.keyboardWillOpenTo=null,this.props.onKeyboardDidHide&&this.props.onKeyboardDidHide(e)},this.flashScrollIndicators=()=>{this.scrollResponderFlashScrollIndicators()},this.getScrollResponder=()=>this,this.getScrollableNode=()=>this._scrollNodeRef,this.getInnerViewRef=()=>this._innerViewRef,this.getInnerViewNode=()=>this._innerViewRef,this.getNativeScrollRef=()=>this._scrollNodeRef,this.scrollTo=(e,o,l)=>{if('number'==typeof e)console.warn('`scrollTo(y, x, animated)` is deprecated. Use `scrollTo({x: 5, y: 5, animated: true})` instead.');else{var n=e||b;o=n.x,e=n.y,l=n.animated}this.scrollResponderScrollTo({x:o||0,y:e||0,animated:!1!==l})},this.scrollToEnd=e=>{var o=!1!==(e&&e.animated),l=this.props.horizontal,n=this.getScrollableNode(),t=l?n.scrollWidth:0,s=l?0:n.scrollHeight;this.scrollResponderScrollTo({x:t,y:s,animated:o})},this._handleContentOnLayout=e=>{var o=e.nativeEvent.layout,l=o.width,n=o.height;this.props.onContentSizeChange(l,n)},this._handleScroll=e=>{'on-drag'===this.props.keyboardDismissMode&&(0,s.default)(),this.scrollResponderHandleScroll(e)},this._setInnerViewRef=e=>{this._innerViewRef=e},this._setScrollNodeRef=e=>{this._scrollNodeRef=e,null!=e&&(e.getScrollResponder=this.getScrollResponder,e.getInnerViewNode=this.getInnerViewNode,e.getInnerViewRef=this.getInnerViewRef,e.getNativeScrollRef=this.getNativeScrollRef,e.getScrollableNode=this.getScrollableNode,e.scrollTo=this.scrollTo,e.scrollToEnd=this.scrollToEnd,e.flashScrollIndicators=this.flashScrollIndicators,e.scrollResponderZoomTo=this.scrollResponderZoomTo,e.scrollResponderScrollNativeHandleToKeyboard=this.scrollResponderScrollNativeHandleToKeyboard),(0,c.default)(this.props.forwardedRef)(e)}}scrollResponderHandleStartShouldSetResponder(){return!1}scrollResponderHandleResponderReject(){(0,y.default)(!1,"ScrollView doesn't take rejection well - scrolls anyway")}scrollResponderFlashScrollIndicators(){}scrollResponderTextInputFocusError(e){console.error('Error measuring text field: ',e)}render(){var e=this.props,t=e.contentContainerStyle,s=e.horizontal,c=e.onContentSizeChange,p=e.refreshControl,u=e.stickyHeaderIndices,S=e.pagingEnabled,y=(e.forwardedRef,e.keyboardDismissMode,e.onScroll,e.centerContent),b=(0,n.default)(e,T),v={};c&&(v={onLayout:this._handleContentOnLayout});var H=!s&&Array.isArray(u),E=H||S?f.default.Children.map(this.props.children,(e,o)=>{var l=H&&u.indexOf(o)>-1;return null!=e&&(l||S)?f.default.createElement(R.default,{style:[l&&w.stickyHeader,S&&w.pagingEnabledChild]},e):e}):this.props.children,C=f.default.createElement(R.default,(0,l.default)({},v,{children:E,collapsable:!1,ref:this._setInnerViewRef,style:[s&&w.contentContainerHorizontal,y&&w.contentContainerCenterContent,t]})),M=s?w.baseHorizontal:w.baseVertical,D=s?w.pagingEnabledHorizontal:w.pagingEnabledVertical,I=(0,o.default)((0,o.default)({},b),{},{style:[M,S&&D,this.props.style],onTouchStart:this.scrollResponderHandleTouchStart,onTouchMove:this.scrollResponderHandleTouchMove,onTouchEnd:this.scrollResponderHandleTouchEnd,onScrollBeginDrag:this.scrollResponderHandleScrollBeginDrag,onScrollEndDrag:this.scrollResponderHandleScrollEndDrag,onMomentumScrollBegin:this.scrollResponderHandleMomentumScrollBegin,onMomentumScrollEnd:this.scrollResponderHandleMomentumScrollEnd,onStartShouldSetResponder:this.scrollResponderHandleStartShouldSetResponder,onStartShouldSetResponderCapture:this.scrollResponderHandleStartShouldSetResponderCapture,onScrollShouldSetResponder:this.scrollResponderHandleScrollShouldSetResponder,onScroll:this._handleScroll,onResponderGrant:this.scrollResponderHandleResponderGrant,onResponderTerminationRequest:this.scrollResponderHandleTerminationRequest,onResponderTerminate:this.scrollResponderHandleTerminate,onResponderRelease:this.scrollResponderHandleResponderRelease,onResponderReject:this.scrollResponderHandleResponderReject}),N=h.default;(0,i.default)(void 0!==N,'ScrollViewClass must not be undefined');var x=f.default.createElement(N,(0,l.default)({},I,{ref:this._setScrollNodeRef}),C);return p?f.default.cloneElement(p,{style:I.style},x):x}}var H={flexGrow:1,flexShrink:1,transform:'translateZ(0)',WebkitOverflowScrolling:'touch'},w=p.default.create({baseVertical:(0,o.default)((0,o.default)({},H),{},{flexDirection:'column',overflowX:'hidden',overflowY:'auto'}),baseHorizontal:(0,o.default)((0,o.default)({},H),{},{flexDirection:'row',overflowX:'auto',overflowY:'hidden'}),contentContainerHorizontal:{flexDirection:'row'},contentContainerCenterContent:{justifyContent:'center',flexGrow:1},stickyHeader:{position:'sticky',top:0,zIndex:10},pagingEnabledHorizontal:{scrollSnapType:'x mandatory'},pagingEnabledVertical:{scrollSnapType:'y mandatory'},pagingEnabledChild:{scrollSnapAlign:'start'}}),E=f.default.forwardRef((e,o)=>f.default.createElement(v,(0,l.default)({},e,{forwardedRef:o})));E.displayName='ScrollView';var C=E},151,[40,124,45,152,153,145,133,122,155,46,154,113,127,30,156]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return w}});var t=e(r(d[0])),n=e(r(d[1])),s={window:{fontScale:1,height:0,scale:1,width:0},screen:{fontScale:1,height:0,scale:1,width:0}},o={},c=n.default;function l(){if(n.default){var e,t,o=window;if(o.visualViewport){var c=o.visualViewport;e=Math.round(c.height*c.scale),t=Math.round(c.width*c.scale)}else{var l=o.document.documentElement;e=l.clientHeight,t=l.clientWidth}s.window={fontScale:1,height:e,scale:o.devicePixelRatio||1,width:t},s.screen={fontScale:1,height:o.screen.height,scale:o.devicePixelRatio||1,width:o.screen.width}}}function u(){l(),Array.isArray(o.change)&&o.change.forEach(e=>e(s))}class w{static get(e){return c&&(c=!1,l()),(0,t.default)(s[e],"No dimension set for key "+e),s[e]}static set(e){e&&(n.default?(0,t.default)(!1,'Dimensions cannot be set in the browser'):(null!=e.screen&&(s.screen=e.screen),null!=e.window&&(s.window=e.window)))}static addEventListener(e,t){return o[e]=o[e]||[],o[e].push(t),{remove:()=>{this.removeEventListener(e,t)}}}static removeEventListener(e,t){Array.isArray(o[e])&&(o[e]=o[e].filter(e=>e!==t))}}n.default&&(window.visualViewport?window.visualViewport.addEventListener('resize',u,!1):window.addEventListener('resize',u,!1))},152,[145,55]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return l}});var e,t=r(d[0]),u=(e=t)&&e.__esModule?e:{default:e},l=()=>{u.default.blurTextInput(u.default.currentlyFocusedField())}},153,[154]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return l}});var e,u=r(d[0]),t=(e=u)&&e.__esModule?e:{default:e},l={_currentlyFocusedNode:null,currentlyFocusedField(){return document.activeElement!==this._currentlyFocusedNode&&(this._currentlyFocusedNode=null),this._currentlyFocusedNode},focusTextInput(e){null!==e&&(this._currentlyFocusedNode=e,document.activeElement!==e&&t.default.focus(e))},blurTextInput(e){null!==e&&(this._currentlyFocusedNode=null,document.activeElement===e&&t.default.blur(e))}}},154,[113]); +__d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return v}});var t=e(r(_d[0])),o=e(r(_d[1])),n=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(o){if('default'!==o){var n=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,n.get?n:{enumerable:!0,get:function(){return e[o]}})}}),t.default=e,t})(r(_d[2])),l=e(r(_d[3])),c=e(r(_d[4])),u=e(r(_d[5])),s=["onScroll","onTouchMove","onWheel","scrollEnabled","scrollEventThrottle","showsHorizontalScrollIndicator","showsVerticalScrollIndicator","style"];function f(e){return{nativeEvent:{contentOffset:{get x(){return e.target.scrollLeft},get y(){return e.target.scrollTop}},contentSize:{get height(){return e.target.scrollHeight},get width(){return e.target.scrollWidth}},layoutMeasurement:{get height(){return e.target.offsetHeight},get width(){return e.target.offsetWidth}}},timeStamp:Date.now()}}var d=n.forwardRef((e,l)=>{var d=e.onScroll,v=e.onTouchMove,S=e.onWheel,b=e.scrollEnabled,w=void 0===b||b,T=e.scrollEventThrottle,p=void 0===T?0:T,y=e.showsHorizontalScrollIndicator,_=e.showsVerticalScrollIndicator,E=e.style,M=(0,o.default)(e,s),O=n.useRef({isScrolling:!1,scrollLastTick:0}),D=n.useRef(null),W=n.useRef(null);function j(e){return t=>{w&&e&&e(t)}}function P(e){O.current.isScrolling=!0,k(e)}function k(e){O.current.scrollLastTick=Date.now(),d&&d(f(e))}function H(e){O.current.isScrolling=!1,d&&d(f(e))}var I=!1===y||!1===_;return n.createElement(c.default,(0,t.default)({},M,{onScroll:function(e){var t,o,n;e.stopPropagation(),e.target===W.current&&(e.persist(),null!=D.current&&clearTimeout(D.current),D.current=setTimeout(()=>{H(e)},100),O.current.isScrolling?(t=O.current.scrollLastTick,o=p,n=Date.now()-t,o>0&&n>=o&&k(e)):P(e))},onTouchMove:j(v),onWheel:j(S),ref:(0,u.default)(W,l),style:[E,!w&&h.scrollDisabled,I&&h.hideScrollbar]}))}),h=l.default.create({scrollDisabled:{overflowX:'hidden',overflowY:'hidden',touchAction:'none'},hideScrollbar:{scrollbarWidth:'none'}}),v=d},155,[124,45,30,46,127,132]); +__d(function(g,r,i,a,m,e,d){'use strict';var t=r(d[0]);m.exports=t},156,[157]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(t){return function(){return t}}var n=function(){};n.thatReturns=t,n.thatReturnsFalse=t(!1),n.thatReturnsTrue=t(!0),n.thatReturnsNull=t(null),n.thatReturnsThis=function(){return this},n.thatReturnsArgument=function(t){return t},m.exports=n},157,[]); +__d(function(g,r,i,a,m,_e,d){'use strict';Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return s}});var e,t=r(d[0]),l=(e=t)&&e.__esModule?e:{default:e};var s=class{constructor(e,t){this._delay=t,this._callback=e}dispose(e){void 0===e&&(e={abort:!1}),this._taskHandle&&(this._taskHandle.cancel(),e.abort||this._callback(),this._taskHandle=null)}schedule(){if(!this._taskHandle){var e=setTimeout(()=>{this._taskHandle=l.default.runAfterInteractions(()=>{this._taskHandle=null,this._callback()})},this._delay);this._taskHandle={cancel:()=>clearTimeout(e)}}}}},158,[159]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return _}});var t=e(r(d[0])),n=e(r(d[1])),o=e(r(d[2])),s=e(r(d[3])),c=new o.default,u={Events:{interactionStart:'interactionStart',interactionComplete:'interactionComplete'},runAfterInteractions(e){var t=[],n=new Promise(n=>{S(),e&&t.push(e),t.push({run:n,name:'resolve '+(e&&e.name||'?')}),h.enqueueTasks(t)});return{then:n.then.bind(n),done:n.then.bind(n),cancel:()=>{h.cancelTasks(t)}}},createInteractionHandle(){S();var e=++w;return f.add(e),e},clearInteractionHandle(e){(0,t.default)(!!e,'Must provide a handle to clear.'),S(),f.delete(e),v.add(e)},addListener:c.addListener.bind(c),setDeadline(e){b=e}},l=new Set,f=new Set,v=new Set,h=new n.default({onMoreTasks:S}),p=0,w=0,b=-1;function S(){p||(p=b>0?setTimeout(T):(0,s.default)(T))}function T(){p=0;var e=l.size;f.forEach(e=>l.add(e)),v.forEach(e=>l.delete(e));var t=l.size;if(0!==e&&0===t?c.emit(u.Events.interactionComplete):0===e&&0!==t&&c.emit(u.Events.interactionStart),0===t)for(var n=Date.now();h.hasTasksToProcess();)if(h.processNext(),b>0&&Date.now()-n>=b){S();break}f.clear(),v.clear()}var _=u},159,[145,160,161,162]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u}});var t=e(r(d[0])),s=e(r(d[1]));var u=class{constructor(e){var t=e.onMoreTasks;this._onMoreTasks=t,this._queueStack=[{tasks:[],popable:!0}]}enqueue(e){this._getCurrentQueue().push(e)}enqueueTasks(e){e.forEach(e=>this.enqueue(e))}cancelTasks(e){this._queueStack=this._queueStack.map(s=>(0,t.default)((0,t.default)({},s),{},{tasks:s.tasks.filter(t=>-1===e.indexOf(t))})).filter((e,t)=>e.tasks.length>0||0===t)}hasTasksToProcess(){return this._getCurrentQueue().length>0}processNext(){var e=this._getCurrentQueue();if(e.length){var t=e.shift();try{'object'==typeof t&&t.gen?this._genPromise(t):'object'==typeof t&&t.run?t.run():((0,s.default)('function'==typeof t,'Expected Function, SimpleTask, or PromiseTask, but got:\n'+JSON.stringify(t,null,2)),t())}catch(e){throw e.message='TaskQueue: Error with task '+(t.name||'')+': '+e.message,e}}}_getCurrentQueue(){var e=this._queueStack.length-1,t=this._queueStack[e];return t.popable&&0===t.tasks.length&&e>0?(this._queueStack.pop(),this._getCurrentQueue()):t.tasks}_genPromise(e){var t=this._queueStack.push({tasks:[],popable:!1})-1,s=this._queueStack[t];e.gen().then(()=>{s.popable=!0,this.hasTasksToProcess()&&this._onMoreTasks()}).catch(t=>{setTimeout(()=>{throw t.message="TaskQueue: Error resolving Promise in task "+e.name+": "+t.message,t},0)})}}},160,[40,145]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}});class t{constructor(){this._registry={}}addListener(t,s,l){var u=n(this._registry,t),o={context:l,listener:s,remove(){u.delete(o)}};return u.add(o),o}emit(t){var n=this._registry[t];if(null!=n){for(var s=arguments.length,l=new Array(s>1?s-1:0),u=1;u{var t=Date.now();e({didTimeout:!1,timeRemaining:()=>Math.max(0,50-(Date.now()-t))})},1)},u=n?window.cancelIdleCallback:function(e){clearTimeout(e)},o=l},162,[55]); +__d(function(g,r,i,a,m,e,d){'use strict';Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}});var t=function(t,n,u){return nu?u:n}},163,[]); +__d(function(g,r,i,a,m,e,d){'use strict';Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}});var t=function(){return console.log(...arguments)}},164,[]); +__d(function(g,r,_i,a,m,_e,d){"use strict";function s(s){return s&&s.__esModule?s:{default:s}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"CellRenderMask",{enumerable:!0,get:function(){return i}});var e=s(r(d[0])),t=s(r(d[1]));class i{constructor(s){(0,t.default)(s>=0,'CellRenderMask must contain a non-negative number os cells'),this._numCells=s,this._regions=0===s?[]:[{first:0,last:s-1,isSpacer:!0}]}enumerateRegions(){return this._regions}addCells(s){if((0,t.default)(s.first>=0&&s.first=-1&&s.last=s.first-1,'CellRenderMask.addCells called with invalid cell range'),!(s.lasth.last&&(u.isSpacer?c.push({first:h.last+1,last:u.last,isSpacer:!0}):h.last=u.last);var p=[..._,h,...c],C=o-n+1;this._regions.splice(n,C,...p)}}}numCells(){return this._numCells}equals(s){return this._numCells===s._numCells&&this._regions.length===s._regions.length&&this._regions.every((e,t)=>e.first===s._regions[t].first&&e.last===s._regions[t].last&&e.isSpacer===s._regions[t].isSpacer)}_findRegion(s){for(var e=0,i=this._regions.length-1;e<=i;){var l=Math.floor((e+i)/2),n=this._regions[l];if(s>=n.first&&s<=n.last)return[n,l];sn.last&&(e=l+1)}(0,t.default)(!1,"A region was not found containing cellIdx "+s)}}},165,[40,145]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return n}});var l=e(r(d[0])),t=e(r(d[1]));class n{constructor(){this._cellKeyToChildren=new Map,this._childrenToCellKey=new Map}add(e,l){var n;(0,t.default)(!this._childrenToCellKey.has(e),'Trying to add already present child list');var o=null!==(n=this._cellKeyToChildren.get(l))&&void 0!==n?n:new Set;o.add(e),this._cellKeyToChildren.set(l,o),this._childrenToCellKey.set(e,l)}remove(e){var l=this._childrenToCellKey.get(e);(0,t.default)(null!=l,'Trying to remove non-present child list'),this._childrenToCellKey.delete(e);var n=this._cellKeyToChildren.get(l);(0,t.default)(n,'_cellKeyToChildren should contain cellKey'),n.delete(e),0===n.size&&this._cellKeyToChildren.delete(l)}forEach(e){for(var t,n=(0,l.default)(this._cellKeyToChildren.values());!(t=n()).done;)for(var o,h=t.value,s=(0,l.default)(h);!(o=s()).done;){e(o.value)}}forEachInCell(e,t){for(var n,o,h=null!==(n=this._cellKeyToChildren.get(e))&&void 0!==n?n:[],s=(0,l.default)(h);!(o=s()).done;){t(o.value)}}anyInCell(e,t){for(var n,o,h=null!==(n=this._cellKeyToChildren.get(e))&&void 0!==n?n:[],s=(0,l.default)(h);!(o=s()).done;){if(t(o.value))return!0}return!1}size(){return this._childrenToCellKey.size}}},166,[147,145]); +__d(function(g,r,i,a,m,_e,d){'use strict';Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return o}});var t,e=r(d[0]),s=(t=e)&&t.__esModule?t:{default:t};class n{constructor(){this.any_blank_count=0,this.any_blank_ms=0,this.any_blank_speed_sum=0,this.mostly_blank_count=0,this.mostly_blank_ms=0,this.pixels_blank=0,this.pixels_sampled=0,this.pixels_scrolled=0,this.total_time_spent=0,this.sample_count=0}}var l=[],_=10,h=null;var o=class{static addListener(t){return null===h&&console.warn('Call `FillRateHelper.setSampleRate` before `addListener`.'),l.push(t),{remove:()=>{l=l.filter(e=>t!==e)}}}static setSampleRate(t){h=t}static setMinSampleCount(t){_=t}constructor(t){this._anyBlankStartTime=null,this._enabled=!1,this._info=new n,this._mostlyBlankStartTime=null,this._samplesStartTime=null,this._getFrameMetrics=t,this._enabled=(h||0)>Math.random(),this._resetData()}activate(){this._enabled&&null==this._samplesStartTime&&(this._samplesStartTime=g.performance.now())}deactivateAndFlush(){if(this._enabled){var t=this._samplesStartTime;if(null!=t)if(this._info.sample_count<_)this._resetData();else{var e=g.performance.now()-t,n=(0,s.default)((0,s.default)({},this._info),{},{total_time_spent:e});l.forEach(t=>t(n)),this._resetData()}}}computeBlankness(t,e,s){if(!this._enabled||0===t.getItemCount(t.data)||e.last0&&(f=Math.min(h,Math.max(0,p.offset-l)));for(var b=0,y=e.last,k=this._getFrameMetrics(y,t);y>=e.first&&(!k||!k.inLayout);)k=this._getFrameMetrics(y,t),y--;if(k&&y0?(this._anyBlankStartTime=u,this._info.any_blank_speed_sum+=o,this._info.any_blank_count++,this._info.pixels_blank+=M,v>.5&&(this._mostlyBlankStartTime=u,this._info.mostly_blank_count++)):(o<.01||Math.abs(n)<1)&&this.deactivateAndFlush(),v}enabled(){return this._enabled}_resetData(){this._anyBlankStartTime=null,this._info=new n,this._mostlyBlankStartTime=null,this._samplesStartTime=null}}},167,[40]); +__d(function(g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u}});var t,e=r(_d[0]),s=(t=e)&&t.__esModule?t:{default:t},n=(function(t){if(t&&t.__esModule)return t;var e={};return t&&Object.keys(t).forEach(function(s){if('default'!==s){var n=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(e,s,n.get?n:{enumerable:!0,get:function(){return t[s]}})}}),e.default=t,e})(r(_d[1]));class u extends n.PureComponent{constructor(t){super(t),this._inAsyncStateUpdate=!1,this._installSetStateHooks()}setState(t,e){'function'==typeof t?super.setState((e,s)=>{var n;this._inAsyncStateUpdate=!0;try{n=t(e,s)}catch(t){throw t}finally{this._inAsyncStateUpdate=!1}return n},e):super.setState(t,e)}_installSetStateHooks(){var t=this,e=this.props,n=this.state;Object.defineProperty(this,'props',{get:()=>((0,s.default)(!t._inAsyncStateUpdate,'"this.props" should not be accessed during state updates'),e),set(t){e=t}}),Object.defineProperty(this,'state',{get:()=>((0,s.default)(!t._inAsyncStateUpdate,'"this.state" should not be acceessed during state updates'),n),set(t){n=t}})}}},168,[145,30]); +__d(function(g,r,i,a,m,_e,d){'use strict';function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u}});var t=e(r(d[0])),n=e(r(d[1])),s=e(r(d[2]));function l(e,t,n,s,l,u){if(h(n,s,l))return!0;var c=o(n,s,l);return 100*(e?c/l:c/u)>=t}function o(e,t,n){var s=Math.min(t,n)-Math.max(e,0);return Math.max(0,s)}function h(e,t,n){return e>=0&&t<=n&&t>e}var u=class{constructor(e){void 0===e&&(e={viewAreaCoveragePercentThreshold:0}),this._hasInteracted=!1,this._timers=new Set,this._viewableIndices=[],this._viewableItems=new Map,this._config=e}dispose(){this._timers.forEach(clearTimeout)}computeViewableItems(e,t,n,o,h){var u=e.getItemCount(e.data),c=this._config,f=c.itemVisiblePercentThreshold,v=c.viewAreaCoveragePercentThreshold,_=null!=v,w=_?v:f;(0,s.default)(null!=w&&null!=f!=(null!=v),'Must set exactly one of itemVisiblePercentThreshold or viewAreaCoveragePercentThreshold');var b=[];if(0===u)return b;var I=-1,p=h||{first:0,last:u-1},y=p.first,T=p.last;if(T>=u)return console.warn('Invalid render range computing viewability '+JSON.stringify({renderRange:h,itemCount:u})),[];for(var M=y;M<=T;M++){var V=o(M,e);if(V){var C=V.offset-t,P=C+V.length;if(C0)I=M,l(_,w,C,P,n,V.length)&&b.push(M);else if(I>=0)break}}return b}onUpdate(e,t,n,s,l,o,h){var u=e.getItemCount(e.data);if((!this._config.waitForInteraction||this._hasInteracted)&&0!==u&&s(0,e)){var c=[];if(u&&(c=this.computeViewableItems(e,t,n,s,h)),this._viewableIndices.length!==c.length||!this._viewableIndices.every((e,t)=>e===c[t]))if(this._viewableIndices=c,this._config.minimumViewTime){var f=setTimeout(()=>{this._timers.delete(f),this._onUpdateSync(e,c,o,l)},this._config.minimumViewTime);this._timers.add(f)}else this._onUpdateSync(e,c,o,l)}}resetViewableIndices(){this._viewableIndices=[]}recordInteraction(){this._hasInteracted=!0}_onUpdateSync(e,s,l,o){s=s.filter(e=>this._viewableIndices.includes(e));for(var h,u=this._viewableItems,c=new Map(s.map(t=>{var n=o(t,!0,e);return[n.key,n]})),f=[],v=(0,n.default)(c);!(h=v()).done;){var _=h.value,w=_[0],b=_[1];u.has(w)||f.push(b)}for(var I,p=(0,n.default)(u);!(I=p()).done;){var y=I.value,T=y[0],M=y[1];c.has(T)||f.push((0,t.default)((0,t.default)({},M),{},{isViewable:!1}))}f.length>0&&(this._viewableItems=c,l({viewableItems:Array.from(c.values()),changed:f,viewabilityConfig:this._config}))}}},169,[40,147,145]); +__d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return d}});var t=e(r(_d[0])),o=e(r(_d[1])),s=e(r(_d[2])),n=e(r(_d[3])),l=r(_d[4]),p=e(r(_d[5])),u=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(o){if('default'!==o){var s=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,s.get?s:{enumerable:!0,get:function(){return e[o]}})}}),t.default=e,t})(r(_d[6]));class d extends u.Component{constructor(){super(...arguments),this.state={separatorProps:{highlighted:!1,leadingItem:this.props.item}},this._separators={highlight:()=>{var e=this.props,t=e.cellKey,o=e.prevCellKey;this.props.onUpdateSeparators([t,o],{highlighted:!0})},unhighlight:()=>{var e=this.props,t=e.cellKey,o=e.prevCellKey;this.props.onUpdateSeparators([t,o],{highlighted:!1})},updateProps:(e,t)=>{var o=this.props,s=o.cellKey,n=o.prevCellKey;this.props.onUpdateSeparators(['leading'===e?n:s],t)}},this._onLayout=e=>{this.props.onCellLayout&&this.props.onCellLayout(e,this.props.cellKey,this.props.index)}}static getDerivedStateFromProps(e,t){return{separatorProps:(0,o.default)((0,o.default)({},t.separatorProps),{},{leadingItem:e.item})}}updateSeparatorProps(e){this.setState(t=>({separatorProps:(0,o.default)((0,o.default)({},t.separatorProps),e)}))}componentWillUnmount(){this.props.onUnmount(this.props.cellKey)}_renderElement(e,t,o,s){return e&&t&&console.warn("VirtualizedList: Both ListItemComponent and renderItem props are present. ListItemComponent will take precedence over renderItem."),t?u.createElement(t,{item:o,index:s,separators:this._separators}):e?e({item:o,index:s,separators:this._separators}):void(0,p.default)(!1,'VirtualizedList: Either ListItemComponent or renderItem props are required but none were found.')}render(){var e=this.props,o=e.CellRendererComponent,n=e.ItemSeparatorComponent,p=e.ListItemComponent,d=e.cellKey,h=e.horizontal,f=e.item,y=e.index,v=e.inversionStyle,C=e.onCellFocusCapture,_=e.onCellLayout,L=e.renderItem,P=this._renderElement(L,p,f,y),K=u.isValidElement(n)?n:n&&u.createElement(n,this.state.separatorProps),I=v?h?[c.rowReverse,v]:[c.columnReverse,v]:h?[c.row,v]:v,w=o?u.createElement(o,(0,t.default)({cellKey:d,index:y,item:f,style:I,onFocusCapture:C},_&&{onLayout:this._onLayout}),P,K):u.createElement(s.default,(0,t.default)({style:I,onFocusCapture:C},_&&{onLayout:this._onLayout}),P,K);return u.createElement(l.VirtualizedListCellContextProvider,{cellKey:this.props.cellKey},w)}}var c=n.default.create({row:{flexDirection:'row'},rowReverse:{flexDirection:'row-reverse'},columnReverse:{flexDirection:'column-reverse'}})},170,[124,40,127,46,171,145,30]); +__d(function(g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"VirtualizedListContext",{enumerable:!0,get:function(){return o}}),_e.VirtualizedListContextResetter=function(e){var t=e.children;return u.createElement(o.Provider,{value:null},t)},_e.VirtualizedListContextProvider=function(e){var t=e.children,l=e.value,s=(0,n.useMemo)(()=>({cellKey:null,getScrollMetrics:l.getScrollMetrics,horizontal:l.horizontal,getOutermostParentListRef:l.getOutermostParentListRef,registerAsNestedChild:l.registerAsNestedChild,unregisterAsNestedChild:l.unregisterAsNestedChild}),[l.getScrollMetrics,l.horizontal,l.getOutermostParentListRef,l.registerAsNestedChild,l.unregisterAsNestedChild]);return u.createElement(o.Provider,{value:s},t)},_e.VirtualizedListCellContextProvider=function(e){var t=e.cellKey,s=e.children,d=(0,n.useContext)(o),c=(0,n.useMemo)(()=>null==d?null:(0,l.default)((0,l.default)({},d),{},{cellKey:t}),[d,t]);return u.createElement(o.Provider,{value:c},s)};var e,t=r(_d[0]),l=(e=t)&&e.__esModule?e:{default:e},n=r(_d[1]),u=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(l){if('default'!==l){var n=Object.getOwnPropertyDescriptor(e,l);Object.defineProperty(t,l,n.get?n:{enumerable:!0,get:function(){return e[l]}})}}),t.default=e,t})(n),o=u.createContext(null)},171,[40,30]); +__d(function(g,r,i,a,m,e,d){'use strict';function t(t,n,f,o){void 0===o&&(o=1);for(var s=n.getItemCount(n.data),l=[],u=0;u>>1),b=f(M,n),x=b.offset*o,y=(b.offset+b.length)*o;if(0===M&&vy)){l[u]=M;break}c=M+1}}return l}function n(t,n){return n.last-n.first+1-Math.max(0,1+Math.min(n.last,t.last)-Math.max(n.first,t.first))}Object.defineProperty(e,'__esModule',{value:!0}),e.elementsThatOverlapOffsets=t,e.newRangeCount=n,e.computeWindowedRenderLimits=function(f,o,s,l,u,v){var c=f.getItemCount(f.data);if(0===c)return{first:0,last:-1};var h=v.offset,M=v.velocity,b=v.visibleLength,x=v.zoomScale,y=void 0===x?1:x,w=Math.max(0,h),k=w+b,p=(s-1)*b,C=M>1?'after':M<-1?'before':'none',O=Math.max(0,w-.5*p),_=Math.max(0,k+.5*p);if(u(c-1,f).offset*y=I);){var B=z>=o,F=S<=l.first||S>l.last,J=S>L&&(!B||!F),N=E>=l.last||E=S&&S>=0&&E=L&&E<=I&&S<=R.first&&E>=R.last))throw new Error('Bad window calculation '+JSON.stringify({first:S,last:E,itemCount:c,overscanFirst:L,overscanLast:I,visible:R}));return{first:S,last:E}},e.keyExtractor=function(t,n){if('object'==typeof t&&null!=(null==t?void 0:t.key))return t.key;if('object'==typeof t&&null!=(null==t?void 0:t.id))return t.id;return String(n)}},172,[]); +__d(function(g,r,i,a,m,e,d){'use strict';function t(t,o){if(null!=t)return t;var n=new Error(void 0!==o?o:'Got unexpected '+t);throw n.framesToPop=1,n}m.exports=t,m.exports.default=t,Object.defineProperty(m.exports,'__esModule',{value:!0})},173,[]); +__d(function(g,r,_i2,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return l}});var t=Number.isNaN||function(t){return'number'==typeof t&&t!=t};function n(n,u){return n===u||!(!t(n)||!t(u))}function u(t,u){if(t.length!==u.length)return!1;for(var l=0;l{var s=(0,n.default)(c),y=s[0],p=s[1],_=(0,f.default)(p,d),b=y.passthroughAnimatedPropExplicitValues,v=y.style,O=null!=b?b:{},j=O.style,P=(0,u.default)(O,o),h=[v,j];return l.createElement(e,(0,t.default)({},y,P,{style:h,ref:_}))})}},175,[124,45,176,194,46,127,30]); +__d(function(g,r,i,a,m,_e,d){'use strict';function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return _}});var t=e(r(d[0])),u=e(r(d[1])),n=r(d[2]),l=e(r(d[3])),c=e(r(d[4])),f=r(d[5]),o=e(r(d[6]));function _(e){var t=(0,f.useReducer)(e=>e+1,0)[1],c=(0,f.useRef)(null),o=(0,f.useMemo)(()=>new u.default(e,()=>null==c.current?void 0:c.current()),[e]);v(o);var _=(0,f.useCallback)(u=>{o.setNativeView(u),c.current=()=>{t()};var l=b(u),f=[];for(var _ in e){var s=e[_];s instanceof n.AnimatedEvent&&s.__isNative&&(s.__attach(l,_),f.push([_,s]))}return()=>{c.current=null;for(var e=0,t=f;e{c.default.API.flushQueue()}),(0,o.default)(()=>(u.current=!1,()=>{u.current=!0}),[]),(0,o.default)(()=>{if(e.__attach(),null!=t.current){var n=t.current;n.__restoreDefaultValues(),n.__detach(),t.current=null}return()=>{u.current?e.__detach():t.current=e}},[e])}function b(e){return'object'==typeof e&&'function'==typeof(null==e?void 0:e.getScrollableNode)?e.getScrollableNode():e}},176,[40,177,178,193,183,30,131]); +__d(function(g,r,i,a,m,_e,d){'use strict';function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return h}});var t=e(r(d[0])),_=r(d[1]),s=e(r(d[2])),n=e(r(d[3])),o=e(r(d[4])),l=e(r(d[5]));class u extends s.default{constructor(e,_){super(),e.style&&(e=(0,t.default)((0,t.default)({},e),{},{style:new n.default(e.style)})),this._props=e,this._callback=_}__getValue(){var e={};for(var t in this._props){var o=this._props[t];o instanceof s.default?(!o.__isNative||o instanceof n.default)&&(e[t]=o.__getValue()):o instanceof _.AnimatedEvent?e[t]=o.__getHandler():e[t]=o}return e}__getAnimatedValue(){var e={};for(var t in this._props){var _=this._props[t];_ instanceof s.default&&(e[t]=_.__getAnimatedValue())}return e}__attach(){for(var e in this._props){var t=this._props[e];t instanceof s.default&&t.__addChild(this)}}__detach(){for(var e in this.__isNative&&this._animatedView&&this.__disconnectAnimatedView(),this._animatedView=null,this._props){var t=this._props[e];t instanceof s.default&&t.__removeChild(this)}super.__detach()}update(){this._callback()}__makeNative(){if(!this.__isNative){for(var e in this.__isNative=!0,this._props){var t=this._props[e];t instanceof s.default&&t.__makeNative()}this._animatedView&&this.__connectAnimatedView()}}setNativeView(e){this._animatedView!==e&&(this._animatedView=e,this.__isNative&&this.__connectAnimatedView())}__connectAnimatedView(){(0,l.default)(this.__isNative,'Expected node to be marked as "native"');var e=this._animatedView;(0,l.default)(null!=e,'Unable to locate attached view in the native tree'),o.default.API.connectAnimatedNodeToView(this.__getNativeTag(),e)}__disconnectAnimatedView(){(0,l.default)(this.__isNative,'Expected node to be marked as "native"');var e=this._animatedView;(0,l.default)(null!=e,'Unable to locate attached view in the native tree'),o.default.API.disconnectAnimatedNodeFromView(this.__getNativeTag(),e)}__restoreDefaultValues(){this.__isNative&&o.default.API.restoreDefaultValues(this.__getNativeTag())}__getNativeConfig(){var e={};for(var t in this._props){var _=this._props[t];_ instanceof s.default&&(_.__makeNative(),e[t]=_.__getNativeTag())}return{type:'props',props:e}}}var h=u},177,[40,178,182,191,183,145]); +__d(function(g,r,i,a,m,_e,d){'use strict';function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.attachNativeEvent=v,Object.defineProperty(_e,"AnimatedEvent",{enumerable:!0,get:function(){return _}});var t=e(r(d[0])),n=r(d[1]),s=e(n),l=e(r(d[2]));function v(e,n,v){var _=[],o=(e,n)=>{if(e instanceof t.default)e.__makeNative(),_.push({nativeEventPath:n,animatedValueTag:e.__getNativeTag()});else if('object'==typeof e)for(var s in e)o(e[s],n.concat(s))};return(0,l.default)(v[0]&&v[0].nativeEvent,'Native driven events only support animated values contained inside `nativeEvent`.'),o(v[0].nativeEvent,[]),null!=e&&_.forEach(t=>{s.default.API.addAnimatedEventToView(e,n,t)}),{detach(){null!=e&&_.forEach(t=>{s.default.API.removeAnimatedEventFromView(e,n,t.animatedValueTag)})}}}class _{constructor(e,t){this._listeners=[],this._argMapping=e,null==t&&(console.warn('Animated.event now requires a second argument for options'),t={useNativeDriver:!1}),t.listener&&this.__addListener(t.listener),this._callListeners=this._callListeners.bind(this),this._attachedEvent=null,this.__isNative=(0,n.shouldUseNativeDriver)(t)}__addListener(e){this._listeners.push(e)}__removeListener(e){this._listeners=this._listeners.filter(t=>t!==e)}__attach(e,t){(0,l.default)(this.__isNative,'Only native driven events need to be attached.'),this._attachedEvent=v(e,t,this._argMapping)}__detach(e,t){(0,l.default)(this.__isNative,'Only native driven events need to be detached.'),this._attachedEvent&&this._attachedEvent.detach()}__getHandler(){var e=this;if(this.__isNative)return this._callListeners;return function(){for(var n=arguments.length,s=new Array(n),l=0;l{if(e instanceof t.default)'number'==typeof n&&e.setValue(n);else if('object'==typeof e)for(var l in e)v(e[l],n[l],l)};e._argMapping.forEach((e,t)=>{v(e,s[t],'arg'+t)}),e._callListeners(...s)}}_callListeners(){for(var e=arguments.length,t=new Array(e),n=0;ne(...t))}}},178,[179,183,145]); +__d(function(g,r,i,a,m,_e,d){'use strict';function t(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return h}});var e=t(r(d[0])),s=t(r(d[1])),n=t(r(d[2])),_=t(r(d[3])).default.API;class u extends s.default{constructor(t,e){if(super(),'number'!=typeof t)throw new Error('AnimatedValue: Attempting to set value to undefined');this._startingValue=this._value=t,this._offset=0,this._animation=null,e&&e.useNativeDriver&&this.__makeNative()}__detach(){this.__isNative&&_.getValue(this.__getNativeTag(),t=>{this._value=t-this._offset}),this.stopAnimation(),super.__detach()}__getValue(){return this._value+this._offset}setValue(t){var e,s;this._animation&&(this._animation.stop(),this._animation=null),this._updateValue(t,!this.__isNative),this.__isNative&&(e=this.__getNativeTag().toString(),s=()=>_.setAnimatedNodeValue(this.__getNativeTag(),t),_.setWaitingForIdentifier(e),s(),_.unsetWaitingForIdentifier(e))}setOffset(t){this._offset=t,this.__isNative&&_.setAnimatedNodeOffset(this.__getNativeTag(),t)}flattenOffset(){this._value+=this._offset,this._offset=0,this.__isNative&&_.flattenAnimatedNodeOffset(this.__getNativeTag())}extractOffset(){this._offset+=this._value,this._value=0,this.__isNative&&_.extractAnimatedNodeOffset(this.__getNativeTag())}stopAnimation(t){this.stopTracking(),this._animation&&this._animation.stop(),this._animation=null,t&&(this.__isNative?_.getValue(this.__getNativeTag(),t):t(this.__getValue()))}resetAnimation(t){this.stopAnimation(t),this._value=this._startingValue,this.__isNative&&_.setAnimatedNodeValue(this.__getNativeTag(),this._startingValue)}__onAnimatedValueUpdateReceived(t){this._updateValue(t,!1)}interpolate(t){return new e.default(this,t)}animate(t,e){var s=null;t.__isInteraction&&(s=n.default.createInteractionHandle());var _=this._animation;this._animation&&this._animation.stop(),this._animation=t,t.start(this._value,t=>{this._updateValue(t,!0)},t=>{this._animation=null,null!==s&&n.default.clearInteractionHandle(s),e&&e(t)},_,this)}stopTracking(){this._tracking&&this._tracking.__detach(),this._tracking=null}track(t){this.stopTracking(),this._tracking=t,this._tracking&&this._tracking.update()}_updateValue(t,e){if(void 0===t)throw new Error('AnimatedValue: Attempting to set value to undefined');var s,n;this._value=t,e&&(s=this,n=new Set,(function t(e){'function'==typeof e.update?n.add(e):e.__getChildren().forEach(t)})(s),n.forEach(t=>t.update())),super.__callListeners(this.__getValue())}__getNativeConfig(){return{type:'value',value:this._value,offset:this._offset}}}var h=u},179,[180,181,159,183]); +__d(function(_g,_r,_i,_a,m,_e,d){'use strict';function t(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return g}});var e=t(_r(d[0])),a=t(_r(d[1])),n=t(_r(d[2])),r=t(_r(d[3])),i=t(_r(d[4])),o=t=>t;function u(t){if(t.outputRange&&'string'==typeof t.outputRange[0])return _(t);var e=t.outputRange,a=t.inputRange,n=t.easing||o,i='extend';void 0!==t.extrapolateLeft?i=t.extrapolateLeft:void 0!==t.extrapolate&&(i=t.extrapolate);var u='extend';return void 0!==t.extrapolateRight?u=t.extrapolateRight:void 0!==t.extrapolate&&(u=t.extrapolate),t=>{(0,r.default)('number'==typeof t,'Cannot interpolation an input which is not a number');var o=s(t,a);return p(t,a[o],a[o+1],e[o],e[o+1],n,i,u)}}function p(t,e,a,n,r,i,o,u){var p=t;if(pa){if('identity'===u)return p;'clamp'===u&&(p=a)}return n===r?n:e===a?t<=e?n:r:(e===-1/0?p=-p:a===1/0?p-=e:p=(p-e)/(a-e),p=i(p),n===-1/0?p=-p:r===1/0?p+=n:p=p*(r-n)+n,p)}function l(t){var e=(0,i.default)(t);return null===e||'number'!=typeof e?t:"rgba("+((4278190080&(e=e||0))>>>24)+", "+((16711680&e)>>>16)+", "+((65280&e)>>>8)+", "+(255&e)/255+")"}var f=/[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?/g;function _(t){var a=t.outputRange;(0,r.default)(a.length>=2,'Bad output range'),h(a=a.map(l));var n=a[0].match(f).map(()=>[]);a.forEach(t=>{t.match(f).forEach((t,e)=>{n[e].push(+t)})});var i,o=a[0].match(f).map((a,r)=>u((0,e.default)((0,e.default)({},t),{},{outputRange:n[r]}))),p='string'==typeof(i=a[0])&&i.startsWith('rgb');return t=>{var e=0;return a[0].replace(f,()=>{var a=+o[e++](t);return p&&(a=e<4?Math.round(a):Math.round(1e3*a)/1e3),String(a)})}}function h(t){for(var e=t[0].replace(f,''),a=1;a=t);++a);return a-1}class c extends a.default{constructor(t,e){super(),this._parent=t,this._config=e,this._interpolation=u(e)}__makeNative(t){this._parent.__makeNative(t),super.__makeNative(t)}__getValue(){var t=this._parent.__getValue();return(0,r.default)('number'==typeof t,'Cannot interpolate an input which is not a number.'),this._interpolation(t)}interpolate(t){return new c(this,t)}__attach(){this._parent.__addChild(this)}__detach(){this._parent.__removeChild(this),super.__detach()}__transformDataType(t){return t.map(n.default.transformDataType)}__getNativeConfig(){return{inputRange:this._config.inputRange,outputRange:this.__transformDataType(this._config.outputRange),extrapolateLeft:this._config.extrapolateLeft||this._config.extrapolate||'extend',extrapolateRight:this._config.extrapolateRight||this._config.extrapolate||'extend',type:'interpolation'}}}c.__createInterpolation=u;var g=c},180,[40,181,183,145,54]); +__d(function(g,r,i,a,m,_e,d){'use strict';function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return l}});var t=e(r(d[0])),_=e(r(d[1])),s=e(r(d[2]));class n extends _.default{constructor(){super(),this._children=[]}__makeNative(e){if(!this.__isNative){this.__isNative=!0;for(var _,n=(0,t.default)(this._children);!(_=n()).done;){var l=_.value;l.__makeNative(e),s.default.API.connectAnimatedNodes(this.__getNativeTag(),l.__getNativeTag())}}super.__makeNative(e)}__addChild(e){0===this._children.length&&this.__attach(),this._children.push(e),this.__isNative&&(e.__makeNative(this.__getPlatformConfig()),s.default.API.connectAnimatedNodes(this.__getNativeTag(),e.__getNativeTag()))}__removeChild(e){var t=this._children.indexOf(e);-1!==t?(this.__isNative&&e.__isNative&&s.default.API.disconnectAnimatedNodes(this.__getNativeTag(),e.__getNativeTag()),this._children.splice(t,1),0===this._children.length&&this.__detach()):console.warn("Trying to remove a child that doesn't exist")}__getChildren(){return this._children}__callListeners(e){if(super.__callListeners(e),!this.__isNative)for(var _,s=(0,t.default)(this._children);!(_=s()).done;){var n=_.value;n.__getValue&&n.__callListeners(n.__getValue())}}}var l=n},181,[147,182,183]); +__d(function(g,r,i,a,m,_e,d){'use strict';function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return o}});var t=e(r(d[0])),s=e(r(d[1])),n=t.default.API,_=1;var o=class{__attach(){}__detach(){this.__isNative&&null!=this.__nativeTag&&(t.default.API.dropAnimatedNode(this.__nativeTag),this.__nativeTag=void 0)}__getValue(){}__getAnimatedValue(){return this.__getValue()}__addChild(e){}__removeChild(e){}__getChildren(){return[]}constructor(){this._listeners={}}__makeNative(e){if(!this.__isNative)throw new Error('This node cannot be made a "native" animated node');this._platformConfig=e,this.hasListeners()&&this._startListeningToNativeValueUpdates()}addListener(e){var t=String(_++);return this._listeners[t]=e,this.__isNative&&this._startListeningToNativeValueUpdates(),t}removeListener(e){delete this._listeners[e],this.__isNative&&!this.hasListeners()&&this._stopListeningForNativeValueUpdates()}removeAllListeners(){this._listeners={},this.__isNative&&this._stopListeningForNativeValueUpdates()}hasListeners(){return!!Object.keys(this._listeners).length}_startListeningToNativeValueUpdates(){this.__nativeAnimatedValueListener&&!this.__shouldUpdateListenersForNewNativeTag||(this.__shouldUpdateListenersForNewNativeTag&&(this.__shouldUpdateListenersForNewNativeTag=!1,this._stopListeningForNativeValueUpdates()),n.startListeningToAnimatedNodeValue(this.__getNativeTag()),this.__nativeAnimatedValueListener=t.default.nativeEventEmitter.addListener('onAnimatedValueUpdate',e=>{e.tag===this.__getNativeTag()&&this.__onAnimatedValueUpdateReceived(e.value)}))}__onAnimatedValueUpdateReceived(e){this.__callListeners(e)}__callListeners(e){for(var t in this._listeners)this._listeners[t]({value:e})}_stopListeningForNativeValueUpdates(){this.__nativeAnimatedValueListener&&(this.__nativeAnimatedValueListener.remove(),this.__nativeAnimatedValueListener=null,n.stopListeningToAnimatedNodeValue(this.__getNativeTag()))}__getNativeTag(){var e;t.default.assertNativeAnimatedModule(),(0,s.default)(this.__isNative,'Attempt to get native tag from node not marked as "native"');var n=null!==(e=this.__nativeTag)&&void 0!==e?e:t.default.generateNewNodeTag();if(null==this.__nativeTag){this.__nativeTag=n;var _=this.__getNativeConfig();this._platformConfig&&(_.platformConfig=this._platformConfig),t.default.API.createAnimatedNode(n,_),this.__shouldUpdateListenersForNewNativeTag=!0}return n}__getNativeConfig(){throw new Error('This JS animated node type cannot be used as native animated node')}toJSON(){return this.__getValue()}__getPlatformConfig(){return this._platformConfig}__setPlatformConfig(e){this._platformConfig=e}}},182,[183,145]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"API",{enumerable:!0,get:function(){return A}}),Object.defineProperty(_e,"isSupportedColorStyleProp",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"isSupportedStyleProp",{enumerable:!0,get:function(){return R}}),Object.defineProperty(_e,"isSupportedTransformProp",{enumerable:!0,get:function(){return I}}),Object.defineProperty(_e,"isSupportedInterpolationParam",{enumerable:!0,get:function(){return D}}),Object.defineProperty(_e,"addWhitelistedStyleProp",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"addWhitelistedTransformProp",{enumerable:!0,get:function(){return q}}),Object.defineProperty(_e,"addWhitelistedInterpolationParam",{enumerable:!0,get:function(){return V}}),Object.defineProperty(_e,"validateStyles",{enumerable:!0,get:function(){return E}}),Object.defineProperty(_e,"validateTransform",{enumerable:!0,get:function(){return C}}),Object.defineProperty(_e,"validateInterpolation",{enumerable:!0,get:function(){return F}}),Object.defineProperty(_e,"generateNewNodeTag",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"generateNewAnimationId",{enumerable:!0,get:function(){return L}}),Object.defineProperty(_e,"assertNativeAnimatedModule",{enumerable:!0,get:function(){return W}}),Object.defineProperty(_e,"shouldUseNativeDriver",{enumerable:!0,get:function(){return M}}),Object.defineProperty(_e,"transformDataType",{enumerable:!0,get:function(){return _}});var t=e(r(d[0])),n=e(r(d[1]));r(d[2]);var o=e(r(d[3]));r(d[4]);var u=e(r(d[5])),l=e(r(d[6]));r(d[7]);var s,f=n.default,p=1,c=1,v=new Set,b=!1,N=[],O=null,y=f,A={getValue:function(e,t){(0,l.default)(y,'Native animated module is not available'),A.queueOperation(y.getValue,e,t)},setWaitingForIdentifier:function(e){v.add(e),b=!0,u.default.animatedShouldDebounceQueueFlush()&&O&&clearTimeout(O)},unsetWaitingForIdentifier:function(e){v.delete(e),0===v.size&&(b=!1,A.disableQueue())},disableQueue:function(){((0,l.default)(y,'Native animated module is not available'),u.default.animatedShouldDebounceQueueFlush())?(clearImmediate(O),O=setImmediate(A.flushQueue)):A.flushQueue()},flushQueue:function(){},queueOperation:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;oe(...n)):e(...n)},createAnimatedNode:function(e,t){(0,l.default)(y,'Native animated module is not available'),A.queueOperation(y.createAnimatedNode,e,t)},updateAnimatedNodeConfig:function(e,t){(0,l.default)(y,'Native animated module is not available')},startListeningToAnimatedNodeValue:function(e){(0,l.default)(y,'Native animated module is not available'),A.queueOperation(y.startListeningToAnimatedNodeValue,e)},stopListeningToAnimatedNodeValue:function(e){(0,l.default)(y,'Native animated module is not available'),A.queueOperation(y.stopListeningToAnimatedNodeValue,e)},connectAnimatedNodes:function(e,t){(0,l.default)(y,'Native animated module is not available'),A.queueOperation(y.connectAnimatedNodes,e,t)},disconnectAnimatedNodes:function(e,t){(0,l.default)(y,'Native animated module is not available'),A.queueOperation(y.disconnectAnimatedNodes,e,t)},startAnimatingNode:function(e,t,n,o){(0,l.default)(y,'Native animated module is not available'),A.queueOperation(y.startAnimatingNode,e,t,n,o)},stopAnimation:function(e){(0,l.default)(y,'Native animated module is not available'),A.queueOperation(y.stopAnimation,e)},setAnimatedNodeValue:function(e,t){(0,l.default)(y,'Native animated module is not available'),A.queueOperation(y.setAnimatedNodeValue,e,t)},setAnimatedNodeOffset:function(e,t){(0,l.default)(y,'Native animated module is not available'),A.queueOperation(y.setAnimatedNodeOffset,e,t)},flattenAnimatedNodeOffset:function(e){(0,l.default)(y,'Native animated module is not available'),A.queueOperation(y.flattenAnimatedNodeOffset,e)},extractAnimatedNodeOffset:function(e){(0,l.default)(y,'Native animated module is not available'),A.queueOperation(y.extractAnimatedNodeOffset,e)},connectAnimatedNodeToView:function(e,t){(0,l.default)(y,'Native animated module is not available'),A.queueOperation(y.connectAnimatedNodeToView,e,t)},disconnectAnimatedNodeFromView:function(e,t){(0,l.default)(y,'Native animated module is not available'),A.queueOperation(y.disconnectAnimatedNodeFromView,e,t)},restoreDefaultValues:function(e){(0,l.default)(y,'Native animated module is not available'),null!=y.restoreDefaultValues&&A.queueOperation(y.restoreDefaultValues,e)},dropAnimatedNode:function(e){(0,l.default)(y,'Native animated module is not available'),A.queueOperation(y.dropAnimatedNode,e)},addAnimatedEventToView:function(e,t,n){(0,l.default)(y,'Native animated module is not available'),A.queueOperation(y.addAnimatedEventToView,e,t,n)},removeAnimatedEventFromView(e,t,n){(0,l.default)(y,'Native animated module is not available'),A.queueOperation(y.removeAnimatedEventFromView,e,t,n)}},P={backgroundColor:!0,borderBottomColor:!0,borderColor:!0,borderEndColor:!0,borderLeftColor:!0,borderRightColor:!0,borderStartColor:!0,borderTopColor:!0,color:!0,tintColor:!0},h=(0,t.default)((0,t.default)({},P),{},{borderBottomEndRadius:!0,borderBottomLeftRadius:!0,borderBottomRightRadius:!0,borderBottomStartRadius:!0,borderRadius:!0,borderTopEndRadius:!0,borderTopLeftRadius:!0,borderTopRightRadius:!0,borderTopStartRadius:!0,elevation:!0,opacity:!0,transform:!0,zIndex:!0,shadowOpacity:!0,shadowRadius:!0,scaleX:!0,scaleY:!0,translateX:!0,translateY:!0}),w={translateX:!0,translateY:!0,scale:!0,scaleX:!0,scaleY:!0,rotate:!0,rotateX:!0,rotateY:!0,rotateZ:!0,perspective:!0},T={inputRange:!0,outputRange:!0,extrapolate:!0,extrapolateRight:!0,extrapolateLeft:!0};function S(e){h[e]=!0}function q(e){w[e]=!0}function V(e){T[e]=!0}function j(e){return P.hasOwnProperty(e)}function R(e){return h.hasOwnProperty(e)}function I(e){return w.hasOwnProperty(e)}function D(e){return T.hasOwnProperty(e)}function C(e){e.forEach(e=>{if(!I(e.property))throw new Error("Property '"+e.property+"' is not supported by native animated module")})}function E(e){for(var t in e)if(!R(t))throw new Error("Style property '"+t+"' is not supported by native animated module")}function F(e){for(var t in e)if(!D(t))throw new Error("Interpolation property '"+t+"' is not supported by native animated module")}function x(){return p++}function L(){return c++}function W(){(0,l.default)(f,'Native animated module is not available')}var Q=!1;function M(e){return null==e.useNativeDriver&&console.warn("Animated: `useNativeDriver` was not specified. This is a required option and must be explicitly set to `true` or `false`"),!0!==e.useNativeDriver||f?e.useNativeDriver||!1:(Q||(console.warn("Animated: `useNativeDriver` is not supported because the native animated module is missing. Falling back to JS-based animation. To resolve this, add `RCTAnimation` module to this app, or remove `useNativeDriver`. Make sure to run `bundle exec pod install` first. Read more about autolinking: https://github.com/react-native-community/cli/blob/master/docs/autolinking.md"),Q=!0),!1)}function _(e){return'string'!=typeof e?e:/deg$/.test(e)?(parseFloat(e)||0)*Math.PI/180:e}var k={API:A,isSupportedColorStyleProp:j,isSupportedStyleProp:R,isSupportedTransformProp:I,isSupportedInterpolationParam:D,addWhitelistedStyleProp:S,addWhitelistedTransformProp:q,addWhitelistedInterpolationParam:V,validateStyles:E,validateTransform:C,validateInterpolation:F,generateNewNodeTag:x,generateNewAnimationId:L,assertNativeAnimatedModule:W,shouldUseNativeDriver:M,transformDataType:_,get nativeEventEmitter(){return s||(s=new o.default(null)),s}}},183,[40,184,186,187,189,190,145,188]); +__d(function(g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return e}});var e=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(n){if('default'!==n){var u=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,u.get?u:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,t})(r(_d[0])).get('NativeAnimatedModule')},184,[185]); +__d(function(g,r,i,a,m,_e,d){'use strict';Object.defineProperty(_e,'__esModule',{value:!0}),_e.get=u,_e.getEnforcing=function(e){var n=null;return(0,t.default)(null!=n,"TurboModuleRegistry.getEnforcing(...): '"+e+"' could not be found. Verify that a module by this name is registered in the native binary."),n};var e,n=r(d[0]),t=(e=n)&&e.__esModule?e:{default:e};function u(e){return null}},185,[145]); +__d(function(g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return e}});var e=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(n){if('default'!==n){var u=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,u.get?u:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,t})(r(_d[0])).get('NativeAnimatedTurboModule')},186,[185]); +__d(function(g,r,i,a,m,_e,d){'use strict';function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return l}}),r(d[0]);var t=e(r(d[1])),n=e(r(d[2]));class l{constructor(e){}addListener(e,n,l){var u;null==(u=this._nativeModule)||u.addListener(e);var s=t.default.addListener(e,n,l);return{remove:()=>{var e;null!=s&&(null==(e=this._nativeModule)||e.removeListeners(1),s.remove(),s=null)}}}removeListener(e,n){var l;null==(l=this._nativeModule)||l.removeListeners(1),t.default.removeListener(e,n)}emit(e){for(var n=arguments.length,l=new Array(n>1?n-1:0),u=1;u!0,shouldEmitW3CPointerEvents:()=>!1,shouldPressibilityUseW3CPointerEventsForHover:()=>!1,animatedShouldDebounceQueueFlush:()=>!1,animatedShouldUseSingleOp:()=>!1}},190,[]); +__d(function(g,r,i,a,m,_e,d){'use strict';function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return y}});var t=e(r(d[0])),s=e(r(d[1])),l=e(r(d[2])),n=e(r(d[3])),_=e(r(d[4])).default.flatten;function u(e){var l=_(e),n={};for(var f in l){var y=l[f];'transform'===f&&Array.isArray(y)?n[f]=new s.default(y):y instanceof t.default?n[f]=y:y&&!Array.isArray(y)&&'object'==typeof y&&(n[f]=u(y))}return n}class f extends l.default{constructor(e){super(),this._inputStyle=e,this._style=u(e)}_walkStyleAndGetValues(e){var s={};for(var l in e){var n=e[l];n instanceof t.default?n.__isNative||(s[l]=n.__getValue()):n&&!Array.isArray(n)&&'object'==typeof n?s[l]=this._walkStyleAndGetValues(n):s[l]=n}return s}__getValue(){return[this._inputStyle,this._walkStyleAndGetValues(this._style)]}_walkStyleAndGetAnimatedValues(e){var s={};for(var l in e){var n=e[l];n instanceof t.default?s[l]=n.__getAnimatedValue():n&&!Array.isArray(n)&&'object'==typeof n&&(s[l]=this._walkStyleAndGetAnimatedValues(n))}return s}__getAnimatedValue(){return this._walkStyleAndGetAnimatedValues(this._style)}__attach(){for(var e in this._style){var s=this._style[e];s instanceof t.default&&s.__addChild(this)}}__detach(){for(var e in this._style){var s=this._style[e];s instanceof t.default&&s.__removeChild(this)}super.__detach()}__makeNative(){for(var e in this._style){var s=this._style[e];s instanceof t.default&&s.__makeNative()}super.__makeNative()}__getNativeConfig(){var e={};for(var s in this._style)if(this._style[s]instanceof t.default){var l=this._style[s];l.__makeNative(),e[s]=l.__getNativeTag()}return n.default.validateStyles(e),{type:'style',style:e}}}var y=f},191,[182,192,181,183,46]); +__d(function(g,r,i,a,m,_e,d){'use strict';function t(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return o}});var e=t(r(d[0])),n=t(r(d[1])),s=t(r(d[2]));class f extends n.default{constructor(t){super(),this._transforms=t}__makeNative(){this._transforms.forEach(t=>{for(var n in t){var s=t[n];s instanceof e.default&&s.__makeNative()}}),super.__makeNative()}__getValue(){return this._transforms.map(t=>{var n={};for(var s in t){var f=t[s];f instanceof e.default?n[s]=f.__getValue():n[s]=f}return n})}__getAnimatedValue(){return this._transforms.map(t=>{var n={};for(var s in t){var f=t[s];f instanceof e.default?n[s]=f.__getAnimatedValue():n[s]=f}return n})}__attach(){this._transforms.forEach(t=>{for(var n in t){var s=t[n];s instanceof e.default&&s.__addChild(this)}})}__detach(){this._transforms.forEach(t=>{for(var n in t){var s=t[n];s instanceof e.default&&s.__removeChild(this)}}),super.__detach()}__getNativeConfig(){var t=[];return this._transforms.forEach(n=>{for(var f in n){var o=n[f];o instanceof e.default?t.push({type:'animated',property:f,nodeTag:o.__getNativeTag()}):t.push({type:'static',property:f,value:s.default.transformDataType(o)})}}),s.default.validateTransform(t),{type:'transform',transforms:t}}}var o=f},192,[182,181,183]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return u}});var t=r(d[0]);function u(u){var n=(0,t.useRef)(void 0);return(0,t.useCallback)(t=>{n.current&&(n.current(),n.current=void 0),null!=t&&(n.current=u(t))},[u])}},193,[30]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}});var n=r(d[0]);function t(){for(var t=arguments.length,u=new Array(t),f=0;f{for(var t=0,f=u;t0&&(p=b.join(' ')),[d,p,s]}function R(e){if('number'==typeof e){var t=(0,d.getAssetByID)(e);return{height:t.height,width:t.width}}if(null!=e&&!Array.isArray(e)&&'object'==typeof e)return{height:e.height,width:e.width}}function I(e){var t=null;if('number'==typeof e){var n=(0,d.getAssetByID)(e);if(null==n)throw new Error("Image: asset with ID \""+e+"\" could not be found. Please check the image source or packager.");var o=n.scales[0];if(n.scales.length>1){var u=s.default.get();o=n.scales.reduce((e,t)=>Math.abs(t-u){var d=e['aria-label'],c=e.accessibilityLabel,s=e.blurRadius,h=e.defaultSource,S=e.draggable,O=e.onError,x=e.onLayout,j=e.onLoad,D=e.onLoadEnd,P=e.onLoadStart,_=e.pointerEvents,A=e.source,B=e.style,F=(0,o.default)(e,y),H=d||c,W=u.useState(()=>{var e=I(A);if(null!=e&&f.default.has(e))return E;return"IDLE"}),q=W[0],N=W[1],$=u.useState({}),G=$[0],U=$[1],V=u.useContext(b.default),J=u.useRef(null),K=u.useRef(w++),Q=u.useRef(null),T=q===E||q===L&&null==h,X=z(B,s,K.current,e.tintColor),Y=X[0],Z=X[1],ee=X[2],te=e.resizeMode||Y||'cover',re=e.tintColor||ee,ne=T?A:h,ae=I(ne),oe=R(ne),ue=ae?"url(\""+ae+"\")":null,le=(function(){if(null!=J.current&&('center'===te||'repeat'===te)){var e=J.current,t=e.naturalHeight,n=e.naturalWidth,o=G.height,u=G.width;if(t&&n&&o&&u){var l=Math.min(1,u/n,o/t);return Math.ceil(l*n)+"px "+Math.ceil(l*t)+"px"}}})(),ie=ae?(0,l.default)('img',{alt:H||'',style:C.accessibilityImage$raw,draggable:S||!1,ref:J,src:ae}):null;var de=u.useRef({onError:O,onLoad:j,onLoadEnd:D,onLoadStart:P});(0,p.default)(()=>{de.current={onError:O,onLoad:j,onLoadEnd:D,onLoadStart:P}});var ce=I(A);return u.useEffect(()=>{if(t(),null!=ce){N(L);var e=de.current.onLoadStart;e&&e(),Q.current=f.default.load(ce,function(e){N(E);var t=de.current,n=t.onLoad,o=t.onLoadEnd;n&&n(e),o&&o()},function(){N("ERRORED");var e=de.current,t=e.onError,n=e.onLoadEnd;t&&t({nativeEvent:{error:"Failed to load resource "+ce}}),n&&n()})}function t(){null!=Q.current&&(f.default.abort(Q.current),Q.current=null)}return t},[ce,Q,N]),u.createElement(v.default,(0,n.default)({},F,{"aria-label":H,onLayout:function(e){if('center'===te||'repeat'===te||x){var t=e.nativeEvent.layout;x&&x(e),U(t)}},pointerEvents:_,ref:t,style:[C.root,V&&C.inline,oe,B,C.undo,{boxShadow:null}]}),u.createElement(v.default,{style:[C.image,M[te],{backgroundImage:ue,filter:Z},null!=le&&{backgroundSize:le}],suppressHydrationWarning:!0}),ie,k(re,K.current))});O.displayName='Image';var x=O;x.getSize=function(e,t,n){f.default.getSize(e,t,n)},x.prefetch=function(e){return f.default.prefetch(e)},x.queryCache=function(e){return f.default.queryCache(e)};var C=h.default.create({root:{flexBasis:'auto',overflow:'hidden',zIndex:0},inline:{display:'inline-flex'},undo:{blurRadius:null,shadowColor:null,shadowOpacity:null,shadowOffset:null,shadowRadius:null,tintColor:null,overlayColor:null,resizeMode:null},image:(0,t.default)((0,t.default)({},h.default.absoluteFillObject),{},{backgroundColor:'transparent',backgroundPosition:'center',backgroundRepeat:'no-repeat',backgroundSize:'cover',height:'100%',width:'100%',zIndex:-1}),accessibilityImage$raw:(0,t.default)((0,t.default)({},h.default.absoluteFillObject),{},{height:'100%',opacity:0,width:'100%',zIndex:-1})}),M=h.default.create({center:{backgroundSize:'auto'},contain:{backgroundSize:'contain'},cover:{backgroundSize:'cover'},none:{backgroundPosition:'0',backgroundSize:'auto'},repeat:{backgroundPosition:'0',backgroundRepeat:'repeat',backgroundSize:'auto'},stretch:{backgroundSize:'100% 100%'}}),j=x},196,[40,124,45,30,34,197,93,198,199,46,143,131,127]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.registerAsset=function(t){return o.push(t)},e.getAssetByID=function(t){return o[t-1]};var t='undefined'!=typeof globalThis?globalThis:void 0!==g?g:'undefined'!=typeof window?window:{},n=Symbol.for('react-native-web.AssetRegistry');t[n]||(t[n]=[]);var o=t[n]},197,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"ImageUriCache",{enumerable:!0,get:function(){return t}});var e=/^data:/;class t{static has(n){var o=t._entries;return e.test(n)||Boolean(o[n])}static add(e){var n=t._entries,o=Date.now();n[e]?(n[e].lastUsedTimestamp=o,n[e].refCount+=1):n[e]={lastUsedTimestamp:o,refCount:1}}static remove(e){var n=t._entries;n[e]&&(n[e].refCount-=1),t._cleanUpIfNeeded()}static _cleanUpIfNeeded(){var e,n,o=t._entries,s=Object.keys(o);s.length+1>t._maximumEntries&&(s.forEach(t=>{var s=o[t];(!n||s.lastUsedTimestampt.has(e),load(e,t,s){n+=1;var l=new window.Image;return l.onerror=s,l.onload=e=>{var n=()=>t({nativeEvent:e});'function'==typeof l.decode?l.decode().then(n,n):setTimeout(n,0)},l.src=e,o[""+n]=l,n},prefetch:e=>new Promise((n,o)=>{s.load(e,()=>{t.add(e),t.remove(e),n()},o)}),queryCache(e){var n={};return e.forEach(e=>{t.has(e)&&(n[e]='disk/memory')}),Promise.resolve(n)}},l=s},198,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return n}});var e,t=r(d[0]),u=(e=t)&&e.__esModule?e:{default:e};class n{static get(){return u.default.get('window').scale}static getFontScale(){return u.default.get('window').fontScale||n.get()}static getPixelSizeForLayoutSize(e){return Math.round(e*n.get())}static roundToNearestPixel(e){var t=n.get();return Math.round(e*t)/t}}},199,[152]); +__d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return l}});var t=e(r(_d[0])),n=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(n){if('default'!==n){var u=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,u.get?u:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,t})(r(_d[1])),u=e(r(_d[2])),f=e(r(_d[3])),o=n.forwardRef((e,f)=>n.createElement(u.default,(0,t.default)({scrollEventThrottle:1e-4},e,{ref:f}))),l=(0,f.default)(o)},200,[124,30,151,175]); +__d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return l}});var t=e(r(_d[0])),n=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(n){if('default'!==n){var u=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,u.get?u:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,t})(r(_d[1])),u=e(r(_d[2])),f=e(r(_d[3])),o=n.forwardRef((e,f)=>n.createElement(u.default,(0,t.default)({scrollEventThrottle:1e-4},e,{ref:f}))),l=(0,f.default)(o)},201,[124,30,202,175]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u}});var e,t=r(d[0]),u=((e=t)&&e.__esModule?e:{default:e}).default},202,[203]); +__d(function(g,r,i,a,m,_e,_d){'use strict';function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return c}});var t=e(r(_d[0])),s=e(r(_d[1]));r(_d[2]);var n=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(s){if('default'!==s){var n=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,n.get?n:{enumerable:!0,get:function(){return e[s]}})}}),t.default=e,t})(r(_d[3])),o=e(r(_d[4])),l=["stickySectionHeadersEnabled"];class c extends n.PureComponent{constructor(){super(...arguments),this._captureRef=e=>{this._wrapperListRef=e}}scrollToLocation(e){null!=this._wrapperListRef&&this._wrapperListRef.scrollToLocation(e)}recordInteraction(){var e=this._wrapperListRef&&this._wrapperListRef.getListRef();e&&e.recordInteraction()}flashScrollIndicators(){var e=this._wrapperListRef&&this._wrapperListRef.getListRef();e&&e.flashScrollIndicators()}getScrollResponder(){var e=this._wrapperListRef&&this._wrapperListRef.getListRef();if(e)return e.getScrollResponder()}getScrollableNode(){var e=this._wrapperListRef&&this._wrapperListRef.getListRef();if(e)return e.getScrollableNode()}render(){var e=this.props,c=e.stickySectionHeadersEnabled,f=(0,s.default)(e,l),u=null!=c&&c;return n.createElement(o.default,(0,t.default)({},f,{stickySectionHeadersEnabled:u,ref:this._captureRef,getItemCount:e=>e.length,getItem:(e,t)=>e[t]}))}}},203,[124,45,122,30,204]); +__d(function(g,r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return S}});var t=e(r(_d[0])),i=e(r(_d[1])),n=e(r(_d[2])),o=e(r(_d[3])),l=e(r(_d[4])),s=e(r(_d[5])),d=r(_d[6]),p=e(r(_d[7])),u=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(i){if('default'!==i){var n=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(t,i,n.get?n:{enumerable:!0,get:function(){return e[i]}})}}),t.default=e,t})(r(_d[8])),c=["ItemSeparatorComponent","SectionSeparatorComponent","renderItem","renderSectionFooter","renderSectionHeader","sections","stickySectionHeadersEnabled"];class h extends u.PureComponent{constructor(){super(...arguments),this._keyExtractor=(e,t)=>{var i=this._subExtractor(t);return i&&i.key||String(t)},this._convertViewable=e=>{var t;(0,p.default)(null!=e.index,'Received a broken ViewToken');var i=this._subExtractor(e.index);if(!i)return null;var n=i.section.keyExtractor,l=this.props.keyExtractor||d.keyExtractor,s=null!=n?n(e.item,i.index):l(e.item,null!==(t=i.index)&&void 0!==t?t:0);return(0,o.default)((0,o.default)({},e),{},{index:i.index,key:s,section:i.section})},this._onViewableItemsChanged=e=>{var t=e.viewableItems,i=e.changed,n=this.props.onViewableItemsChanged;null!=n&&n({viewableItems:t.map(this._convertViewable,this).filter(Boolean),changed:i.map(this._convertViewable,this).filter(Boolean)})},this._renderItem=e=>t=>{var i=t.item,n=t.index,o=this._subExtractor(n);if(!o)return null;var l=o.index;if(null==l){var s=o.section;if(!0===o.header){var d=this.props.renderSectionHeader;return d?d({section:s}):null}var c=this.props.renderSectionFooter;return c?c({section:s}):null}var h=o.section.renderItem||this.props.renderItem,S=this._getSeparatorComponent(n,o,e);return(0,p.default)(h,'no renderItem!'),u.createElement(f,{SeparatorComponent:S,LeadingSeparatorComponent:0===l?this.props.SectionSeparatorComponent:void 0,cellKey:o.key,index:l,item:i,leadingItem:o.leadingItem,leadingSection:o.leadingSection,prevCellKey:(this._subExtractor(n-1)||{}).key,setSelfHighlightCallback:this._setUpdateHighlightFor,setSelfUpdatePropsCallback:this._setUpdatePropsFor,updateHighlightFor:this._updateHighlightFor,updatePropsFor:this._updatePropsFor,renderItem:h,section:o.section,trailingItem:o.trailingItem,trailingSection:o.trailingSection,inverted:!!this.props.inverted})},this._updatePropsFor=(e,t)=>{var i=this._updatePropsMap[e];null!=i&&i(t)},this._updateHighlightFor=(e,t)=>{var i=this._updateHighlightMap[e];null!=i&&i(t)},this._setUpdateHighlightFor=(e,t)=>{null!=t?this._updateHighlightMap[e]=t:delete this._updateHighlightFor[e]},this._setUpdatePropsFor=(e,t)=>{null!=t?this._updatePropsMap[e]=t:delete this._updatePropsMap[e]},this._updateHighlightMap={},this._updatePropsMap={},this._captureRef=e=>{this._listRef=e}}scrollToLocation(e){for(var t=e.itemIndex,i=0;i0&&this.props.stickySectionHeadersEnabled)n+=this._listRef.__getFrameMetricsApprox(t-e.itemIndex,this._listRef.props).length;var l=(0,o.default)((0,o.default)({},e),{},{viewOffset:n,index:t});this._listRef.scrollToIndex(l)}}getListRef(){return this._listRef}render(){for(var e,o=this.props,l=(o.ItemSeparatorComponent,o.SectionSeparatorComponent,o.renderItem,o.renderSectionFooter,o.renderSectionHeader,o.sections,o.stickySectionHeadersEnabled,(0,n.default)(o,c)),d=this.props.ListHeaderComponent?1:0,p=this.props.stickySectionHeadersEnabled?[]:void 0,h=0,f=(0,i.default)(this.props.sections);!(e=f()).done;){var S=e.value;null!=p&&p.push(h+d),h+=2,h+=this.props.getItemCount(S.data)}var _=this._renderItem(h);return u.createElement(s.default,(0,t.default)({},l,{keyExtractor:this._keyExtractor,stickyHeaderIndices:p,renderItem:_,data:this.props.sections,getItem:(e,t)=>this._getItem(this.props,e,t),getItemCount:()=>h,onViewableItemsChanged:this.props.onViewableItemsChanged?this._onViewableItemsChanged:void 0,ref:this._captureRef}))}_getItem(e,t,i){if(!t)return null;for(var n=i-1,o=0;o=o(c)+1))return-1===t?{section:u,key:h+':header',index:null,header:!0,trailingSection:s[p+1]}:t===o(c)?{section:u,key:h+':footer',index:null,header:!1,trailingSection:s[p+1]}:{section:u,key:h+':'+(u.keyExtractor||l||d.keyExtractor)(n(c,t),t),index:t,leadingItem:n(c,t-1),leadingSection:s[p-1],trailingItem:n(c,t+1),trailingSection:s[p+1]};t-=o(c)+1}}_getSeparatorComponent(e,t,i){if(!(t=t||this._subExtractor(e)))return null;var n=t.section.ItemSeparatorComponent||this.props.ItemSeparatorComponent,o=this.props.SectionSeparatorComponent,l=e===i-1,s=t.index===this.props.getItemCount(t.section.data)-1;return o&&s?o:!n||s||l?null:n}}function f(e){var i=e.LeadingSeparatorComponent,n=e.SeparatorComponent,s=e.cellKey,d=e.prevCellKey,p=e.setSelfHighlightCallback,c=e.updateHighlightFor,h=e.setSelfUpdatePropsCallback,f=e.updatePropsFor,S=e.item,_=e.index,I=e.section,v=e.inverted,x=u.useState(!1),C=x[0],b=x[1],y=u.useState(!1),k=y[0],E=y[1],H=u.useState({leadingItem:e.leadingItem,leadingSection:e.leadingSection,section:e.section,trailingItem:e.item,trailingSection:e.trailingSection}),P=H[0],F=H[1],w=u.useState({leadingItem:e.item,leadingSection:e.leadingSection,section:e.section,trailingItem:e.trailingItem,trailingSection:e.trailingSection}),M=w[0],R=w[1];u.useEffect(()=>(p(s,E),h(s,R),()=>{h(s,null),p(s,null)}),[s,p,R,h]);var V={highlight:()=>{b(!0),E(!0),null!=d&&c(d,!0)},unhighlight:()=>{b(!1),E(!1),null!=d&&c(d,!1)},updateProps:(e,t)=>{'leading'===e?null!=i?F((0,o.default)((0,o.default)({},P),t)):null!=d&&f(d,(0,o.default)((0,o.default)({},P),t)):'trailing'===e&&null!=n&&R((0,o.default)((0,o.default)({},M),t))}},O=e.renderItem({item:S,index:_,section:I,separators:V}),U=null!=i&&u.createElement(i,(0,t.default)({highlighted:C},P)),j=null!=n&&u.createElement(n,(0,t.default)({highlighted:k},M));return U||j?u.createElement(l.default,null,!1===v?U:j,O,!1===v?j:U):O}var S=h},204,[124,147,45,40,127,146,172,145,30]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u}}),r(d[0]);var t=e(r(d[1])),u=(0,e(r(d[2])).default)(t.default)},205,[30,206,175]); +__d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}function o(e){if(e&&e.__esModule)return e;var o={};return e&&Object.keys(e).forEach(function(n){if('default'!==n){var t=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(o,n,t.get?t:{enumerable:!0,get:function(){return e[n]}})}}),o.default=e,o}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return k}});var n=e(r(_d[0])),t=e(r(_d[1])),l=o(r(_d[2])),d=e(r(_d[3])),s=o(r(_d[4])),u=e(r(_d[5])),p=e(r(_d[6])),S=e(r(_d[7])),c=e(r(_d[8])),R=e(r(_d[9])),f=e(r(_d[10])),h=e(r(_d[11])),b=r(_d[12]),v=["hrefAttrs","numberOfLines","onClick","onLayout","onPress","onMoveShouldSetResponder","onMoveShouldSetResponderCapture","onResponderEnd","onResponderGrant","onResponderMove","onResponderReject","onResponderRelease","onResponderStart","onResponderTerminate","onResponderTerminationRequest","onScrollShouldSetResponder","onScrollShouldSetResponderCapture","onSelectionChangeShouldSetResponder","onSelectionChangeShouldSetResponderCapture","onStartShouldSetResponder","onStartShouldSetResponderCapture","selectable"],C=Object.assign({},s.defaultProps,s.accessibilityProps,s.clickProps,s.focusProps,s.keyboardProps,s.mouseProps,s.touchProps,s.styleProps,{href:!0,lang:!0,pointerEvents:!0}),x=e=>(0,u.default)(e,C),w=l.forwardRef((e,o)=>{var n=e.hrefAttrs,s=e.numberOfLines,u=e.onClick,f=e.onLayout,C=e.onPress,w=e.onMoveShouldSetResponder,y=e.onMoveShouldSetResponderCapture,k=e.onResponderEnd,M=e.onResponderGrant,O=e.onResponderMove,L=e.onResponderReject,_=e.onResponderRelease,j=e.onResponderStart,A=e.onResponderTerminate,T=e.onResponderTerminationRequest,E=e.onScrollShouldSetResponder,W=e.onScrollShouldSetResponderCapture,D=e.onSelectionChangeShouldSetResponder,$=e.onSelectionChangeShouldSetResponderCapture,q=e.onStartShouldSetResponder,G=e.onStartShouldSetResponderCapture,H=e.selectable,z=(0,t.default)(e,v),B=l.useContext(h.default),N=l.useRef(null),F=(0,b.useLocaleContext)().direction;(0,p.default)(N,f),(0,R.default)(N,{onMoveShouldSetResponder:w,onMoveShouldSetResponderCapture:y,onResponderEnd:k,onResponderGrant:M,onResponderMove:O,onResponderReject:L,onResponderRelease:_,onResponderStart:j,onResponderTerminate:A,onResponderTerminationRequest:T,onScrollShouldSetResponder:E,onScrollShouldSetResponderCapture:W,onSelectionChangeShouldSetResponder:D,onSelectionChangeShouldSetResponderCapture:$,onStartShouldSetResponder:q,onStartShouldSetResponderCapture:G});var I=l.useCallback(e=>{null!=u?u(e):null!=C&&(e.stopPropagation(),C(e))},[u,C]),J=B?'span':'div',K=null!=e.lang?(0,b.getLocaleDirection)(e.lang):null,Q=e.dir||K,U=Q||F,V=x(z);if(V.dir=Q,B||(V.dir=null!=Q?Q:'auto'),(u||C)&&(V.onClick=I),V.style=[null!=s&&s>1&&{WebkitLineClamp:s},!0===B?P.textHasAncestor$raw:P.text$raw,1===s&&P.textOneLine,null!=s&&s>1&&P.textMultiLine,e.style,!0===H&&P.selectable,!1===H&&P.notSelectable,C&&P.pressable],null!=e.href&&(J='a',null!=n)){var X=n.download,Y=n.rel,Z=n.target;null!=X&&(V.download=X),null!=Y&&(V.rel=Y),'string'==typeof Z&&(V.target='_'!==Z.charAt(0)?'_'+Z:Z)}var ee=(0,c.default)(V),oe=(0,S.default)(N,ee,o);V.ref=oe;var ne=(0,d.default)(J,V,{writingDirection:U});return B?ne:l.createElement(h.default.Provider,{value:!0},ne)});w.displayName='Text';var y={backgroundColor:'transparent',border:'0 solid black',boxSizing:'border-box',color:'black',display:'inline',font:'14px System',listStyle:'none',margin:0,padding:0,position:'relative',textAlign:'start',textDecoration:'none',whiteSpace:'pre-wrap',wordWrap:'break-word'},P=f.default.create({text$raw:y,textHasAncestor$raw:(0,n.default)((0,n.default)({},y),{},{color:'inherit',font:'inherit',textAlign:'inherit',whiteSpace:'inherit'}),textOneLine:{maxWidth:'100%',overflow:'hidden',textOverflow:'ellipsis',whiteSpace:'nowrap',wordWrap:'normal'},textMultiLine:{display:'-webkit-box',maxWidth:'100%',overflow:'clip',textOverflow:'ellipsis',WebkitBoxOrient:'vertical'},notSelectable:{userSelect:'none'},selectable:{userSelect:'text'},pressable:{cursor:'pointer'}}),k=w},206,[40,45,30,34,128,129,130,132,134,136,46,143,101]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u}}),r(d[0]);var t=e(r(d[1])),u=(0,e(r(d[2])).default)(t.default)},207,[30,127,175]); +__d(function(g,r,i,a,m,_e,d){'use strict';function t(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return h}});var e=t(r(d[0])),n=r(d[1]),u=t(r(d[2])),l=t(r(d[3])),f=t(r(d[4])),o=t(r(d[5])),c=t(r(d[6])),s=t(r(d[7])),v=t(r(d[8])),p=!1;function E(t){return e=>{var n=null==e?e:function(){if(p)console.warn('Ignoring recursive animation callback when running mock animations');else{p=!0;try{e(...arguments)}finally{p=!1}}};t(n)}}var y={start:()=>{},stop:()=>{},reset:()=>{},_startNativeLoop:()=>{},_isUsingNativeDriver:()=>!1},_=t=>(0,e.default)((0,e.default)({},y),{},{start:E(e=>{t.forEach(t=>t.start()),null==e||e({finished:!0})})}),h={Value:o.default,ValueXY:c.default,Color:v.default,Interpolation:l.default,Node:f.default,decay:function(t,e){return y},timing:function(t,n){var u=t;return(0,e.default)((0,e.default)({},y),{},{start:E(t=>{u.setValue(n.toValue),null==t||t({finished:!0})})})},spring:function(t,n){var u=t;return(0,e.default)((0,e.default)({},y),{},{start:E(t=>{u.setValue(n.toValue),null==t||t({finished:!0})})})},add:u.default.add,subtract:u.default.subtract,divide:u.default.divide,multiply:u.default.multiply,modulo:u.default.modulo,diffClamp:u.default.diffClamp,delay:function(t){return y},sequence:function(t){return _(t)},parallel:function(t,e){return _(t)},stagger:function(t,e){return _(e)},loop:function(t,e){(void 0===e?{}:e).iterations;return y},event:u.default.event,createAnimatedComponent:s.default,attachNativeEvent:n.attachNativeEvent,forkEvent:u.default.forkEvent,unforkEvent:u.default.unforkEvent,Event:n.AnimatedEvent}},208,[40,178,209,180,182,179,217,175,222]); +__d(function(_g,_r,_i,_a,m,_e,d){'use strict';function t(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return V}});var n=t(_r(d[0])),e=_r(d[1]),i=t(_r(d[2])),r=t(_r(d[3])),a=t(_r(d[4])),o=t(_r(d[5])),u=t(_r(d[6])),f=t(_r(d[7])),s=t(_r(d[8]));_r(d[9]);var c=t(_r(d[10])),v=t(_r(d[11])),l=t(_r(d[12])),p=t(_r(d[13])),g=t(_r(d[14])),_=t(_r(d[15])),h=t(_r(d[16])),N=t(_r(d[17])),w=t(_r(d[18])),E=function(t,n){return t&&n.onComplete?function(){n.onComplete&&n.onComplete(...arguments),t&&t(...arguments)}:t||n.onComplete},A=function(t,e,i){if(t instanceof p.default){var r=(0,n.default)({},e),a=(0,n.default)({},e);for(var o in e){var u=e[o],f=u.x,s=u.y;void 0!==f&&void 0!==s&&(r[o]=f,a[o]=s)}var c=i(t.x,r),v=i(t.y,a);return k([c,v],{stopTogether:!1})}if(t instanceof w.default){var l=(0,n.default)({},e),g=(0,n.default)({},e),_=(0,n.default)({},e),h=(0,n.default)({},e);for(var N in e){var E=e[N],A=E.r,D=E.g,L=E.b,y=E.a;void 0!==A&&void 0!==D&&void 0!==L&&void 0!==y&&(l[N]=A,g[N]=D,_[N]=L,h[N]=y)}var U=i(t.r,l),C=i(t.g,g),V=i(t.b,_),b=i(t.a,h);return k([U,C,V,b],{stopTogether:!1})}return null},D=function(t,e){var i=function(t,n,e){e=E(e,n);var i=t,r=n;i.stopTracking(),n.toValue instanceof s.default?i.track(new v.default(i,n.toValue,_.default,r,e)):i.animate(new _.default(r),e)};return A(t,e,D)||{start:function(n){i(t,e,n)},stop:function(){t.stopAnimation()},reset:function(){t.resetAnimation()},_startNativeLoop:function(r){var a=(0,n.default)((0,n.default)({},e),{},{iterations:r});i(t,a)},_isUsingNativeDriver:function(){return e.useNativeDriver||!1}}},L=function(t,e){var i=function(t,n,e){e=E(e,n);var i=t,r=n;i.stopTracking(),n.toValue instanceof s.default?i.track(new v.default(i,n.toValue,h.default,r,e)):i.animate(new h.default(r),e)};return A(t,e,L)||{start:function(n){i(t,e,n)},stop:function(){t.stopAnimation()},reset:function(){t.resetAnimation()},_startNativeLoop:function(r){var a=(0,n.default)((0,n.default)({},e),{},{iterations:r});i(t,a)},_isUsingNativeDriver:function(){return e.useNativeDriver||!1}}},y=function(t,e){var i=function(t,n,e){e=E(e,n);var i=t,r=n;i.stopTracking(),i.animate(new g.default(r),e)};return A(t,e,y)||{start:function(n){i(t,e,n)},stop:function(){t.stopAnimation()},reset:function(){t.resetAnimation()},_startNativeLoop:function(r){var a=(0,n.default)((0,n.default)({},e),{},{iterations:r});i(t,a)},_isUsingNativeDriver:function(){return e.useNativeDriver||!1}}},U=function(t){var n=0;return{start:function(e){var i=function(r){if(r.finished){if(++n===t.length)return n=0,void(e&&e(r));t[n].start(i)}else e&&e(r)};0===t.length?e&&e({finished:!0}):t[n].start(i)},stop:function(){n{e<=n&&t.reset()}),n=0},_startNativeLoop:function(){throw new Error('Loops run using the native driver cannot contain Animated.sequence animations')},_isUsingNativeDriver:function(){return!1}}},k=function(t,n){var e=0,i={},r=!(n&&!1===n.stopTogether),a={start:function(n){e!==t.length?t.forEach((o,u)=>{var f=function(o){if(i[u]=!0,++e===t.length)return e=0,void(n&&n(o));!o.finished&&r&&a.stop()};o?o.start(f):f({finished:!0})}):n&&n({finished:!0})},stop:function(){t.forEach((t,n)=>{!i[n]&&t.stop(),i[n]=!0})},reset:function(){t.forEach((t,n)=>{t.reset(),i[n]=!1,e=0})},_startNativeLoop:function(){throw new Error('Loops run using the native driver cannot contain Animated.parallel animations')},_isUsingNativeDriver:function(){return!1}};return a},C=function(t){return L(new l.default(0),{toValue:0,delay:t,duration:0,useNativeDriver:!1})};var V={Value:l.default,ValueXY:p.default,Color:w.default,Interpolation:o.default,Node:s.default,decay:y,timing:L,spring:D,add:function(t,n){return new i.default(t,n)},subtract:function(t,n){return new c.default(t,n)},divide:function(t,n){return new a.default(t,n)},multiply:function(t,n){return new f.default(t,n)},modulo:function(t,n){return new u.default(t,n)},diffClamp:function(t,n,e){return new r.default(t,n,e)},delay:C,sequence:U,parallel:k,stagger:function(t,n){return k(n.map((n,e)=>U([C(t*e),n])))},loop:function(t,n){var e=void 0===n?{}:n,i=e.iterations,r=void 0===i?-1:i,a=e.resetBeforeIteration,o=void 0===a||a,u=!1,f=0;return{start:function(n){var e=function(i){void 0===i&&(i={finished:!0}),u||f===r||!1===i.finished?n&&n(i):(f++,o&&t.reset(),t.start(e))};t&&0!==r?t._isUsingNativeDriver()?t._startNativeLoop(r):e():n&&n({finished:!0})},stop:function(){u=!0,t.stop()},reset:function(){f=0,u=!1,t.reset()},_startNativeLoop:function(){throw new Error('Loops run using the native driver cannot contain Animated.loop animations')},_isUsingNativeDriver:function(){return t._isUsingNativeDriver()}}},event:function(t,n){var i=new e.AnimatedEvent(t,n);return i.__isNative?i:i.__getHandler()},createAnimatedComponent:N.default,attachNativeEvent:e.attachNativeEvent,forkEvent:function(t,n){return t?t instanceof e.AnimatedEvent?(t.__addListener(n),t):function(){'function'==typeof t&&t(...arguments),n(...arguments)}:n},unforkEvent:function(t,n){t&&t instanceof e.AnimatedEvent&&t.__removeListener(n)},Event:e.AnimatedEvent}},209,[40,178,210,211,212,180,213,214,182,177,215,216,179,217,218,220,223,175,222]); +__d(function(g,r,i,_a,m,_e,d){'use strict';function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return s}});var t=e(r(d[0])),_=e(r(d[1])),a=e(r(d[2]));class u extends a.default{constructor(e,t){super(),this._a='number'==typeof e?new _.default(e):e,this._b='number'==typeof t?new _.default(t):t}__makeNative(e){this._a.__makeNative(e),this._b.__makeNative(e),super.__makeNative(e)}__getValue(){return this._a.__getValue()+this._b.__getValue()}interpolate(e){return new t.default(this,e)}__attach(){this._a.__addChild(this),this._b.__addChild(this)}__detach(){this._a.__removeChild(this),this._b.__removeChild(this),super.__detach()}__getNativeConfig(){return{type:'addition',input:[this._a.__getNativeTag(),this._b.__getNativeTag()]}}}var s=u},210,[180,179,181]); +__d(function(g,r,i,_a,m,_e,d){'use strict';function t(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return s}});var e=t(r(d[0])),a=t(r(d[1]));class _ extends a.default{constructor(t,e,a){super(),this._a=t,this._min=e,this._max=a,this._value=this._lastValue=this._a.__getValue()}__makeNative(t){this._a.__makeNative(t),super.__makeNative(t)}interpolate(t){return new e.default(this,t)}__getValue(){var t=this._a.__getValue(),e=t-this._lastValue;return this._lastValue=t,this._value=Math.min(Math.max(this._value+e,this._min),this._max),this._value}__attach(){this._a.__addChild(this)}__detach(){this._a.__removeChild(this),super.__detach()}__getNativeConfig(){return{type:'diffclamp',input:this._a.__getNativeTag(),min:this._min,max:this._max}}}var s=_},211,[180,181]); +__d(function(g,r,i,_a,m,_e,d){'use strict';function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return o}});var t=e(r(d[0])),_=e(r(d[1])),a=e(r(d[2])),n=e(r(d[3]));class s extends n.default{constructor(e,t){super(),this._warnedAboutDivideByZero=!1,(0===t||t instanceof _.default&&0===t.__getValue())&&console.error('Detected potential division by zero in AnimatedDivision'),this._a='number'==typeof e?new a.default(e):e,this._b='number'==typeof t?new a.default(t):t}__makeNative(e){this._a.__makeNative(e),this._b.__makeNative(e),super.__makeNative(e)}__getValue(){var e=this._a.__getValue(),t=this._b.__getValue();return 0===t?(this._warnedAboutDivideByZero||(console.error('Detected division by zero in AnimatedDivision'),this._warnedAboutDivideByZero=!0),0):(this._warnedAboutDivideByZero=!1,e/t)}interpolate(e){return new t.default(this,e)}__attach(){this._a.__addChild(this),this._b.__addChild(this)}__detach(){this._a.__removeChild(this),this._b.__removeChild(this),super.__detach()}__getNativeConfig(){return{type:'division',input:[this._a.__getNativeTag(),this._b.__getNativeTag()]}}}var o=s},212,[180,182,179,181]); +__d(function(g,r,i,_a,m,_e,d){'use strict';function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return a}});var t=e(r(d[0])),_=e(r(d[1]));class u extends _.default{constructor(e,t){super(),this._a=e,this._modulus=t}__makeNative(e){this._a.__makeNative(e),super.__makeNative(e)}__getValue(){return(this._a.__getValue()%this._modulus+this._modulus)%this._modulus}interpolate(e){return new t.default(this,e)}__attach(){this._a.__addChild(this)}__detach(){this._a.__removeChild(this),super.__detach()}__getNativeConfig(){return{type:'modulus',input:this._a.__getNativeTag(),modulus:this._modulus}}}var a=u},213,[180,181]); +__d(function(g,r,i,_a,m,_e,d){'use strict';function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return s}});var t=e(r(d[0])),_=e(r(d[1])),a=e(r(d[2]));class u extends a.default{constructor(e,t){super(),this._a='number'==typeof e?new _.default(e):e,this._b='number'==typeof t?new _.default(t):t}__makeNative(e){this._a.__makeNative(e),this._b.__makeNative(e),super.__makeNative(e)}__getValue(){return this._a.__getValue()*this._b.__getValue()}interpolate(e){return new t.default(this,e)}__attach(){this._a.__addChild(this),this._b.__addChild(this)}__detach(){this._a.__removeChild(this),this._b.__removeChild(this),super.__detach()}__getNativeConfig(){return{type:'multiplication',input:[this._a.__getNativeTag(),this._b.__getNativeTag()]}}}var s=u},214,[180,179,181]); +__d(function(g,r,i,_a,m,_e,d){'use strict';function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return s}});var t=e(r(d[0])),_=e(r(d[1])),a=e(r(d[2]));class u extends a.default{constructor(e,t){super(),this._a='number'==typeof e?new _.default(e):e,this._b='number'==typeof t?new _.default(t):t}__makeNative(e){this._a.__makeNative(e),this._b.__makeNative(e),super.__makeNative(e)}__getValue(){return this._a.__getValue()-this._b.__getValue()}interpolate(e){return new t.default(this,e)}__attach(){this._a.__addChild(this),this._b.__addChild(this)}__detach(){this._a.__removeChild(this),this._b.__removeChild(this),super.__detach()}__getNativeConfig(){return{type:'subtraction',input:[this._a.__getNativeTag(),this._b.__getNativeTag()]}}}var s=u},215,[180,179,181]); +__d(function(g,r,i,a,m,_e,d){'use strict';function t(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u}});var e=t(r(d[0]));r(d[1]);var _=t(r(d[2])),n=r(d[3]);class s extends _.default{constructor(t,e,_,s,u){super(),this._value=t,this._parent=e,this._animationClass=_,this._animationConfig=s,this._useNativeDriver=(0,n.shouldUseNativeDriver)(s),this._callback=u,this.__attach()}__makeNative(){this.__isNative=!0,this._parent.__makeNative(),super.__makeNative(),this._value.__makeNative()}__getValue(){return this._parent.__getValue()}__attach(){this._parent.__addChild(this),this._useNativeDriver&&this.__makeNative()}__detach(){this._parent.__removeChild(this),super.__detach()}update(){this._value.animate(new this._animationClass((0,e.default)((0,e.default)({},this._animationConfig),{},{toValue:this._animationConfig.toValue.__getValue()})),this._callback)}__getNativeConfig(){var t=new this._animationClass((0,e.default)((0,e.default)({},this._animationConfig),{},{toValue:void 0})).__getNativeAnimationConfig();return{type:'tracking',animationId:(0,n.generateNewAnimationId)(),animationConfig:t,toValue:this._parent.__getNativeTag(),value:this._value.__getNativeTag()}}}var u=s},216,[40,179,182,183]); +__d(function(g,r,i,a,m,_e,d){'use strict';function t(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u}});var e=t(r(d[0])),s=t(r(d[1])),n=t(r(d[2])),l=1;class f extends s.default{constructor(t){super();var s=t||{x:0,y:0};'number'==typeof s.x&&'number'==typeof s.y?(this.x=new e.default(s.x),this.y=new e.default(s.y)):((0,n.default)(s.x instanceof e.default&&s.y instanceof e.default,"AnimatedValueXY must be initialized with an object of numbers or AnimatedValues."),this.x=s.x,this.y=s.y),this._listeners={}}setValue(t){this.x.setValue(t.x),this.y.setValue(t.y)}setOffset(t){this.x.setOffset(t.x),this.y.setOffset(t.y)}flattenOffset(){this.x.flattenOffset(),this.y.flattenOffset()}extractOffset(){this.x.extractOffset(),this.y.extractOffset()}__getValue(){return{x:this.x.__getValue(),y:this.y.__getValue()}}resetAnimation(t){this.x.resetAnimation(),this.y.resetAnimation(),t&&t(this.__getValue())}stopAnimation(t){this.x.stopAnimation(),this.y.stopAnimation(),t&&t(this.__getValue())}addListener(t){var e=String(l++),s=e=>{e.value;t(this.__getValue())};return this._listeners[e]={x:this.x.addListener(s),y:this.y.addListener(s)},e}removeListener(t){this.x.removeListener(this._listeners[t].x),this.y.removeListener(this._listeners[t].y),delete this._listeners[t]}removeAllListeners(){this.x.removeAllListeners(),this.y.removeAllListeners(),this._listeners={}}getLayout(){return{left:this.x,top:this.y}}getTranslateTransform(){return[{translateX:this.x},{translateY:this.y}]}}var u=f},217,[179,181,145]); +__d(function(g,r,i,a,m,_e,d){'use strict';Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return _}});var t,e=r(d[0]),s=(t=e)&&t.__esModule?t:{default:t},n=r(d[1]);class o extends s.default{constructor(t){var e,s,o;super(),this._deceleration=null!==(e=t.deceleration)&&void 0!==e?e:.998,this._velocity=t.velocity,this._useNativeDriver=(0,n.shouldUseNativeDriver)(t),this.__isInteraction=null!==(s=t.isInteraction)&&void 0!==s?s:!this._useNativeDriver,this.__iterations=null!==(o=t.iterations)&&void 0!==o?o:1}__getNativeAnimationConfig(){return{type:'decay',deceleration:this._deceleration,velocity:this._velocity,iterations:this.__iterations}}start(t,e,s,n,o){this.__active=!0,this._lastValue=t,this._fromValue=t,this._onUpdate=e,this.__onEnd=s,this._startTime=Date.now(),this._useNativeDriver?this.__startNativeAnimation(o):this._animationFrame=requestAnimationFrame(this.onUpdate.bind(this))}onUpdate(){var t=Date.now(),e=this._fromValue+this._velocity/(1-this._deceleration)*(1-Math.exp(-(1-this._deceleration)*(t-this._startTime)));this._onUpdate(e),Math.abs(this._lastValue-e)<.1?this.__debouncedOnEnd({finished:!0}):(this._lastValue=e,this.__active&&(this._animationFrame=requestAnimationFrame(this.onUpdate.bind(this))))}stop(){super.stop(),this.__active=!1,g.cancelAnimationFrame(this._animationFrame),this.__debouncedOnEnd({finished:!1})}}var _=o},218,[219,183]); +__d(function(g,r,i,a,m,_e,d){'use strict';Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return _}});var t,e=r(d[0]),n=(t=e)&&t.__esModule?t:{default:t},o=1;var _=class{start(t,e,n,o,_){}stop(){this.__nativeId&&n.default.API.stopAnimation(this.__nativeId)}__getNativeAnimationConfig(){throw new Error('This animation type cannot be offloaded to native')}__debouncedOnEnd(t){var e=this.__onEnd;this.__onEnd=null,e&&e(t)}__startNativeAnimation(t){var e=o+":startAnimation";o+=1,n.default.API.setWaitingForIdentifier(e);try{var _=this.__getNativeAnimationConfig();t.__makeNative(_.platformConfig),this.__nativeId=n.default.generateNewAnimationId(),n.default.API.startAnimatingNode(this.__nativeId,t.__getNativeTag(),_,this.__debouncedOnEnd.bind(this))}catch(t){throw t}finally{n.default.API.unsetWaitingForIdentifier(e)}}}},219,[183]); +__d(function(g,r,i,a,_m,_e,d){'use strict';function t(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return l}});var s=t(r(d[0])),e=t(r(d[1])),n=t(r(d[2])),o=r(d[3]);r(d[4]);class h extends s.default{constructor(t){var s,h,l,_,f,u,m,v,c,p,V;if(super(),this._overshootClamping=null!==(s=t.overshootClamping)&&void 0!==s&&s,this._restDisplacementThreshold=null!==(h=t.restDisplacementThreshold)&&void 0!==h?h:.001,this._restSpeedThreshold=null!==(l=t.restSpeedThreshold)&&void 0!==l?l:.001,this._initialVelocity=null!==(_=t.velocity)&&void 0!==_?_:0,this._lastVelocity=null!==(f=t.velocity)&&void 0!==f?f:0,this._toValue=t.toValue,this._delay=null!==(u=t.delay)&&void 0!==u?u:0,this._useNativeDriver=(0,o.shouldUseNativeDriver)(t),this._platformConfig=t.platformConfig,this.__isInteraction=null!==(m=t.isInteraction)&&void 0!==m?m:!this._useNativeDriver,this.__iterations=null!==(v=t.iterations)&&void 0!==v?v:1,void 0!==t.stiffness||void 0!==t.damping||void 0!==t.mass)(0,n.default)(void 0===t.bounciness&&void 0===t.speed&&void 0===t.tension&&void 0===t.friction,'You can define one of bounciness/speed, tension/friction, or stiffness/damping/mass, but not more than one'),this._stiffness=null!==(c=t.stiffness)&&void 0!==c?c:100,this._damping=null!==(p=t.damping)&&void 0!==p?p:10,this._mass=null!==(V=t.mass)&&void 0!==V?V:1;else if(void 0!==t.bounciness||void 0!==t.speed){var T,y;(0,n.default)(void 0===t.tension&&void 0===t.friction&&void 0===t.stiffness&&void 0===t.damping&&void 0===t.mass,'You can define one of bounciness/speed, tension/friction, or stiffness/damping/mass, but not more than one');var b=e.default.fromBouncinessAndSpeed(null!==(T=t.bounciness)&&void 0!==T?T:8,null!==(y=t.speed)&&void 0!==y?y:12);this._stiffness=b.stiffness,this._damping=b.damping,this._mass=1}else{var M,P,D=e.default.fromOrigamiTensionAndFriction(null!==(M=t.tension)&&void 0!==M?M:40,null!==(P=t.friction)&&void 0!==P?P:7);this._stiffness=D.stiffness,this._damping=D.damping,this._mass=1}(0,n.default)(this._stiffness>0,'Stiffness value must be greater than 0'),(0,n.default)(this._damping>0,'Damping value must be greater than 0'),(0,n.default)(this._mass>0,'Mass value must be greater than 0')}__getNativeAnimationConfig(){var t;return{type:'spring',overshootClamping:this._overshootClamping,restDisplacementThreshold:this._restDisplacementThreshold,restSpeedThreshold:this._restSpeedThreshold,stiffness:this._stiffness,damping:this._damping,mass:this._mass,initialVelocity:null!==(t=this._initialVelocity)&&void 0!==t?t:this._lastVelocity,toValue:this._toValue,iterations:this.__iterations,platformConfig:this._platformConfig}}start(t,s,e,n,o){if(this.__active=!0,this._startPosition=t,this._lastPosition=this._startPosition,this._onUpdate=s,this.__onEnd=e,this._lastTime=Date.now(),this._frameTime=0,n instanceof h){var l=n.getInternalState();this._lastPosition=l.lastPosition,this._lastVelocity=l.lastVelocity,this._initialVelocity=this._lastVelocity,this._lastTime=l.lastTime}var _=()=>{this._useNativeDriver?this.__startNativeAnimation(o):this.onUpdate()};this._delay?this._timeout=setTimeout(_,this._delay):_()}getInternalState(){return{lastPosition:this._lastPosition,lastVelocity:this._lastVelocity,lastTime:this._lastTime}}onUpdate(){var t=Date.now();t>this._lastTime+64&&(t=this._lastTime+64);var s=(t-this._lastTime)/1e3;this._frameTime+=s;var e=this._damping,n=this._mass,o=this._stiffness,h=-this._initialVelocity,l=e/(2*Math.sqrt(o*n)),_=Math.sqrt(o/n),f=_*Math.sqrt(1-l*l),u=this._toValue-this._startPosition,m=0,v=0,c=this._frameTime;if(l<1){var p=Math.exp(-l*_*c);m=this._toValue-p*((h+l*_*u)/f*Math.sin(f*c)+u*Math.cos(f*c)),v=l*_*p*(Math.sin(f*c)*(h+l*_*u)/f+u*Math.cos(f*c))-p*(Math.cos(f*c)*(h+l*_*u)-f*u*Math.sin(f*c))}else{var V=Math.exp(-_*c);m=this._toValue-V*(u+(h+_*u)*c),v=V*(h*(c*_-1)+c*u*(_*_))}if(this._lastTime=t,this._lastPosition=m,this._lastVelocity=v,this._onUpdate(m),this.__active){var T=!1;this._overshootClamping&&0!==this._stiffness&&(T=this._startPositionthis._toValue:m18&&v<=44?p(v):M(v),s(2*w-w*w,l,.01));return{stiffness:n(b),damping:t(O)}}}},221,[]); +__d(function(_g,_r,i,_a,m,_e,d){'use strict';function t(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return f}});var e=t(_r(d[0])),s=t(_r(d[1])),a=t(_r(d[2])),r=t(_r(d[3])).default.API,n={r:0,g:0,b:0,a:1},h=1;function l(t){if(null==t)return null;if(_(t))return t;var e=(0,a.default)(t);if(null==e)return null;if('object'==typeof e){if(null!=e)return e}else if('number'==typeof e){return{r:(4278190080&e)>>>24,g:(16711680&e)>>>16,b:(65280&e)>>>8,a:(255&e)/255}}return null}function _(t){return t&&'number'==typeof t.r&&'number'==typeof t.g&&'number'==typeof t.b&&'number'==typeof t.a}function o(t){return t&&t.r instanceof e.default&&t.g instanceof e.default&&t.b instanceof e.default&&t.a instanceof e.default}class f extends s.default{constructor(t,s){super(),this._listeners={};var a=null!=t?t:n;if(o(a)){var r=a;this.r=r.r,this.g=r.g,this.b=r.b,this.a=r.a}else{var h,f=null!==(h=l(a))&&void 0!==h?h:n,u=n;_(f)?u=f:this.nativeColor=f,this.r=new e.default(u.r),this.g=new e.default(u.g),this.b=new e.default(u.b),this.a=new e.default(u.a)}(this.nativeColor||s&&s.useNativeDriver)&&this.__makeNative()}setValue(t){var e,s=!1;if(this.__isNative){var a=this.__getNativeTag();r.setWaitingForIdentifier(a.toString())}var h=null!==(e=l(t))&&void 0!==e?e:n;if(_(h)){var o=h;this.r.setValue(o.r),this.g.setValue(o.g),this.b.setValue(o.b),this.a.setValue(o.a),null!=this.nativeColor&&(this.nativeColor=null,s=!0)}else{var f=h;this.nativeColor!==f&&(this.nativeColor=f,s=!0)}if(this.__isNative){var u=this.__getNativeTag();s&&r.updateAnimatedNodeConfig(u,this.__getNativeConfig()),r.unsetWaitingForIdentifier(u.toString())}}setOffset(t){this.r.setOffset(t.r),this.g.setOffset(t.g),this.b.setOffset(t.b),this.a.setOffset(t.a)}flattenOffset(){this.r.flattenOffset(),this.g.flattenOffset(),this.b.flattenOffset(),this.a.flattenOffset()}extractOffset(){this.r.extractOffset(),this.g.extractOffset(),this.b.extractOffset(),this.a.extractOffset()}addListener(t){var e=String(h++),s=e=>{e.value;t(this.__getValue())};return this._listeners[e]={r:this.r.addListener(s),g:this.g.addListener(s),b:this.b.addListener(s),a:this.a.addListener(s)},e}removeListener(t){this.r.removeListener(this._listeners[t].r),this.g.removeListener(this._listeners[t].g),this.b.removeListener(this._listeners[t].b),this.a.removeListener(this._listeners[t].a),delete this._listeners[t]}removeAllListeners(){this.r.removeAllListeners(),this.g.removeAllListeners(),this.b.removeAllListeners(),this.a.removeAllListeners(),this._listeners={}}stopAnimation(t){this.r.stopAnimation(),this.g.stopAnimation(),this.b.stopAnimation(),this.a.stopAnimation(),t&&t(this.__getValue())}resetAnimation(t){this.r.resetAnimation(),this.g.resetAnimation(),this.b.resetAnimation(),this.a.resetAnimation(),t&&t(this.__getValue())}__getValue(){return null!=this.nativeColor?this.nativeColor:"rgba("+this.r.__getValue()+", "+this.g.__getValue()+", "+this.b.__getValue()+", "+this.a.__getValue()+")"}__attach(){this.r.__addChild(this),this.g.__addChild(this),this.b.__addChild(this),this.a.__addChild(this),super.__attach()}__detach(){this.r.__removeChild(this),this.g.__removeChild(this),this.b.__removeChild(this),this.a.__removeChild(this),super.__detach()}__makeNative(t){this.r.__makeNative(t),this.g.__makeNative(t),this.b.__makeNative(t),this.a.__makeNative(t),super.__makeNative(t)}__getNativeConfig(){return{type:'color',r:this.r.__getNativeTag(),g:this.g.__getNativeTag(),b:this.b.__getNativeTag(),a:this.a.__getNativeTag(),nativeColor:this.nativeColor}}}},222,[179,181,54,183]); +__d(function(g,r,i,a,m,_e,d){'use strict';function t(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return h}}),r(d[0]),r(d[1]),r(d[2]);var e,s=t(r(d[3])),n=t(r(d[4])),o=r(d[5]);r(d[6]);class _ extends n.default{constructor(t){var n,_,h,u,l;super(),this._toValue=t.toValue,this._easing=null!==(n=t.easing)&&void 0!==n?n:(e||(e=s.default.inOut(s.default.ease)),e),this._duration=null!==(_=t.duration)&&void 0!==_?_:500,this._delay=null!==(h=t.delay)&&void 0!==h?h:0,this.__iterations=null!==(u=t.iterations)&&void 0!==u?u:1,this._useNativeDriver=(0,o.shouldUseNativeDriver)(t),this._platformConfig=t.platformConfig,this.__isInteraction=null!==(l=t.isInteraction)&&void 0!==l?l:!this._useNativeDriver}__getNativeAnimationConfig(){for(var t=[],e=Math.round(this._duration/16.666666666666668),s=0;s{0!==this._duration||this._useNativeDriver?(this._startTime=Date.now(),this._useNativeDriver?this.__startNativeAnimation(o):this._animationFrame=requestAnimationFrame(this.onUpdate.bind(this))):(this._onUpdate(this._toValue),this.__debouncedOnEnd({finished:!0}))};this._delay?this._timeout=setTimeout(_,this._delay):_()}onUpdate(){var t=Date.now();if(t>=this._startTime+this._duration)return 0===this._duration?this._onUpdate(this._toValue):this._onUpdate(this._fromValue+this._easing(1)*(this._toValue-this._fromValue)),void this.__debouncedOnEnd({finished:!0});this._onUpdate(this._fromValue+this._easing((t-this._startTime)/this._duration)*(this._toValue-this._fromValue)),this.__active&&(this._animationFrame=requestAnimationFrame(this.onUpdate.bind(this)))}stop(){super.stop(),this.__active=!1,clearTimeout(this._timeout),g.cancelAnimationFrame(this._animationFrame),this.__debouncedOnEnd({finished:!1})}}var h=_},223,[179,217,180,224,219,183,222]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u}});var e,t=r(d[0]),u=((e=t)&&e.__esModule?e:{default:e}).default},224,[225]); +__d(function(g,r,i,a,m,_e,d){'use strict';Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return s}});var t,e,u=r(d[0]),c=(t=u)&&t.__esModule?t:{default:t};class n{static step0(t){return t>0?1:0}static step1(t){return t>=1?1:0}static linear(t){return t}static ease(t){return e||(e=n.bezier(.42,0,1,1)),e(t)}static quad(t){return t*t}static cubic(t){return t*t*t}static poly(t){return e=>Math.pow(e,t)}static sin(t){return 1-Math.cos(t*Math.PI/2)}static circle(t){return 1-Math.sqrt(1-t*t)}static exp(t){return Math.pow(2,10*(t-1))}static elastic(t){void 0===t&&(t=1);var e=t*Math.PI;return t=>1-Math.pow(Math.cos(t*Math.PI/2),3)*Math.cos(t*e)}static back(t){return void 0===t&&(t=1.70158),e=>e*e*((t+1)*e-t)}static bounce(t){if(t<.36363636363636365)return 7.5625*t*t;if(t<.7272727272727273){var e=t-.5454545454545454;return 7.5625*e*e+.75}if(t<.9090909090909091){var u=t-.8181818181818182;return 7.5625*u*u+.9375}var c=t-.9545454545454546;return 7.5625*c*c+.984375}static bezier(t,e,u,n){return(0,c.default)(t,e,u,n)}static in(t){return t}static out(t){return e=>1-t(1-e)}static inOut(t){return e=>e<.5?t(2*e)/2:1-t(2*(1-e))/2}}var s=n},225,[226]); +__d(function(g,r,_i,a,m,e,d){ +/** + * BezierEasing - use bezier curve for transition easing function + * https://github.com/gre/bezier-easing + * @copyright 2014-2015 Gaëtan Renaudeau. MIT License. + */ +'use strict';Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return h}});var n=4,t=.001,u=1e-7,o=10,f=11,i=.1,c='function'==typeof Float32Array;function v(n,t){return 1-3*t+3*n}function l(n,t){return 3*t-6*n}function b(n){return 3*n}function s(n,t,u){return((v(t,u)*n+l(t,u))*n+b(t))*n}function y(n,t,u){return 3*v(t,u)*n*n+2*l(t,u)*n+b(t)}function w(n,t,f,i,c){var v,l,b=0,y=t,w=f;do{(v=s(l=y+(w-y)/2,i,c)-n)>0?w=l:y=l}while(Math.abs(v)>u&&++b=0&&n<=1&&o>=0&&o<=1))throw new Error('bezier x values must be in [0, 1] range');var l=c?new Float32Array(f):new Array(f);if(n!==u||o!==v)for(var b=0;b=t?_(u,v,n,o):0===b?v:w(u,f,f+i,n,o)}return function(t){return n===u&&o===v?t:0===t?0:1===t?1:s(h(t),u,v)}}},226,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return o}});var e,t=r(d[0]);var n=((e=t)&&e.__esModule?e:{default:e}).default&&null!=window.matchMedia?window.matchMedia('(prefers-color-scheme: dark)'):null,l=new WeakMap,o={getColorScheme:()=>n&&n.matches?'dark':'light',addChangeListener(e){var t=l.get(e);return t||(t=t=>{var n=t.matches;e({colorScheme:n?'dark':'light'})},l.set(e,t)),n&&n.addListener(t),{remove:function(){var t=l.get(e);n&&t&&n.removeListener(t),l.delete(e)}}}}},227,[55]); +__d(function(g,r,i,a,m,_e,d){"use strict";function t(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return f}}),r(d[0]);var e,n=t(r(d[1])),o=t(r(d[2])),p=r(d[3]),s=t(p),u={},l={},c=t=>t();class f{static getAppKeys(){return Object.keys(l)}static getApplication(t,e){return(0,n.default)(l[t]&&l[t].getApplication,"Application "+t+" has not been registered. This is either due to an import error during initialization or failure to call AppRegistry.registerComponent."),l[t].getApplication(e)}static registerComponent(t,n){return l[t]={getApplication:t=>(0,p.getApplication)(c(n),t?t.initialProps:u,e&&e(t)),run:t=>(0,s.default)(c(n),e&&e(t),t.callback,{hydrate:t.hydrate||!1,initialProps:t.initialProps||u,mode:t.mode||'concurrent',rootTag:t.rootTag})},t}static registerConfig(t){t.forEach(t=>{var e=t.appKey,o=t.component,p=t.run;p?f.registerRunnable(e,p):((0,n.default)(o,'No component provider passed in'),f.registerComponent(e,o))})}static registerRunnable(t,e){return l[t]={run:e},t}static runApplication(t,e){return(0,n.default)(l[t]&&l[t].run,"Application \""+t+"\" has not been registered. This is either due to an import error during initialization or failure to call AppRegistry.registerComponent."),l[t].run(e)}static setComponentProviderInstrumentationHook(t){c=t}static setWrapperComponentProvider(t){e=t}static unmountApplicationComponentAtRootTag(t){(0,o.default)(t)}}},228,[40,145,111,229]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return p}}),_e.getApplication=function(e,l,u){return{element:c.default.createElement(n.default,{WrapperComponent:u,rootTag:{}},c.default.createElement(e,l)),getStyleElement:e=>{var n=f.default.getSheet();return c.default.createElement("style",(0,t.default)({},e,{dangerouslySetInnerHTML:{__html:n.textContent},id:n.id}))}}};var t=e(r(d[0])),n=e(r(d[1])),l=e(r(d[2])),u=r(d[3]),o=e(u),f=e(r(d[4])),c=e(r(d[5]));function p(e,t,f,p){var s=p.hydrate,_=p.initialProps,y=p.rootTag,E=s?u.hydrate:o.default;return(0,l.default)(y,'Expect to have a valid rootTag, instead got ',y),E(c.default.createElement(n.default,{WrapperComponent:t,ref:f,rootTag:y},c.default.createElement(e,_)),y)}},229,[124,230,145,104,46,30]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}});var t=function({children:t}){return t}},230,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return h}});var t=e(r(d[0])),n=e(r(d[1])),u=e(r(d[2])),c=u.default&&!document.hasOwnProperty('hidden')&&document.hasOwnProperty('webkitHidden'),s=['change','memoryWarning'],l=c?'webkitvisibilitychange':'visibilitychange',o=c?'webkitVisibilityState':'visibilityState',b='background',f='active',v=null;class h{static get currentState(){if(!h.isAvailable)return f;switch(document[o]){case'hidden':case'prerender':case'unloaded':return b;default:return f}}static addEventListener(e,u){if(h.isAvailable&&((0,t.default)(-1!==s.indexOf(e),'Trying to subscribe to unknown event: "%s"',e),'change'===e))return v||(v=new n.default,document.addEventListener(l,()=>{v&&v.emit('change',h.currentState)},!1)),v.addListener(e,u)}}h.isAvailable=u.default&&!!document[o]},231,[145,161,55]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return s}});var t=r(d[0]),s={registerAsset:t.registerAsset,getAssetByID:t.getAssetByID}},232,[197]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){}Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return n}});var n={exitApp:t,addEventListener:()=>({remove:t}),removeEventListener:t}},233,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";var e;Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return t}});class t{static isAvailable(){return void 0===e&&(e='function'==typeof document.queryCommandSupported&&document.queryCommandSupported('copy')),e}static getString(){return Promise.resolve('')}static setString(e){var t=!1,n=document.body;if(n){var o=document.createElement('span');o.textContent=e,o.style.opacity='0',o.style.position='absolute',o.style.whiteSpace='pre-wrap',o.style.userSelect='auto',n.appendChild(o);var c=window.getSelection();c.removeAllRanges();var u=document.createRange();u.selectNodeContents(o),c.addRange(u);try{document.execCommand('copy'),t=!0}catch(e){}c.removeAllRanges(),n.removeChild(o)}return t}}},234,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}});var t={allowRTL(){},forceRTL(){},getConstants:()=>({isRTL:!1})}},235,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return n}});var e,t=r(d[0]),s=(e=t)&&e.__esModule?e:{default:e},n={isVisible:()=>!1,addListener:()=>({remove:()=>{}}),dismiss(){(0,s.default)()},removeAllListeners(){},removeListener(){}}},236,[153]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u}});var e,t=r(d[0]),u=((e=t)&&e.__esModule?e:{default:e}).default},237,[238]); +__d(function(g,r,i,a,m,_e,d){'use strict';function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return c}});var t=e(r(d[0])),n=e(r(d[1]));function s(e,s){t.default.isTesting||n.default.configureNextLayoutAnimation(e,null!=s?s:function(){},function(){})}function u(e,t,n){return{duration:e,create:{type:t,property:n},update:{type:t},delete:{type:t,property:n}}}var o={easeInEaseOut:u(300,'easeInEaseOut','opacity'),linear:u(500,'linear','opacity'),spring:{duration:700,create:{type:'linear',property:'opacity'},update:{type:'spring',springDamping:.4},delete:{type:'linear',property:'opacity'}}},c={configureNext:s,create:u,Types:Object.freeze({spring:'spring',linear:'linear',easeInEaseOut:'easeInEaseOut',easeIn:'easeIn',easeOut:'easeOut',keyboard:'keyboard'}),Properties:Object.freeze({opacity:'opacity',scaleX:'scaleX',scaleY:'scaleY',scaleXY:'scaleXY'}),checkConfig(){console.error('LayoutAnimation.checkConfig(...) has been disabled.')},Presets:o,easeInEaseOut:s.bind(null,o.easeInEaseOut),linear:s.bind(null,o.linear),spring:s.bind(null,o.spring)}},238,[122,113]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return s}});var t=e(r(d[0])),n=e(r(d[1])),l=n.default?window.location.href:'';var o=(e,t)=>{if(n.default){var l=new URL(e,window.location).toString();0===l.indexOf('tel:')?window.location=l:window.open(l,t,'noopener')}},s=new class{constructor(){this._eventCallbacks={}}_dispatchEvent(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),l=1;l{e(...n)})}addEventListener(e,t){var n=this;return n._eventCallbacks[e]||(n._eventCallbacks[e]=[t]),n._eventCallbacks[e].push(t),{remove(){var l=n._eventCallbacks[e].filter(e=>e.toString()!==t.toString());n._eventCallbacks[e]=l}}}removeEventListener(e,t){console.error("Linking.removeEventListener('"+e+"', ...): Method has been deprecated. Please instead use `remove()` on the subscription returned by `Linking.addEventListener`.");var n=this._eventCallbacks[e].filter(e=>e.toString()!==t.toString());this._eventCallbacks[e]=n}canOpenURL(){return Promise.resolve(!0)}getInitialURL(){return Promise.resolve(l)}openURL(e,t){1===arguments.length&&(t='_blank');try{return o(e,t),this._dispatchEvent('onOpen',e),Promise.resolve()}catch(e){return Promise.reject(e)}}_validateURL(e){(0,t.default)('string'==typeof e,'Invalid URL: should be a string. Was: '+e),(0,t.default)(e,'Invalid URL: cannot be empty')}}},239,[145,55]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u}});var e,t=r(d[0]),u=((e=t)&&e.__esModule?e:{default:e}).default},240,[187]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u}});var e,t=r(d[0]),u=((e=t)&&e.__esModule?e:{default:e}).default},241,[242]); +__d(function(g,r,i,a,m,_e,d){'use strict';function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return T}});var o=e(r(d[0])),n=e(r(d[1])),t=n.default.currentCentroidXOfTouchesChangedAfter,u=n.default.currentCentroidYOfTouchesChangedAfter,s=n.default.previousCentroidXOfTouchesChangedAfter,c=n.default.previousCentroidYOfTouchesChangedAfter,l=n.default.currentCentroidX,p=n.default.currentCentroidY,v={_initializeGestureState(e){e.moveX=0,e.moveY=0,e.x0=0,e.y0=0,e.dx=0,e.dy=0,e.vx=0,e.vy=0,e.numberActiveTouches=0,e._accountsForMovesUpTo=0},_updateGestureStateOnMove(e,o){e.numberActiveTouches=o.numberActiveTouches,e.moveX=t(o,e._accountsForMovesUpTo),e.moveY=u(o,e._accountsForMovesUpTo);var n=e._accountsForMovesUpTo,l=s(o,n),p=t(o,n),v=c(o,n),h=u(o,n),S=e.dx+(p-l),R=e.dy+(h-v),T=o.mostRecentTimeStamp-e._accountsForMovesUpTo;e.vx=(S-e.dx)/T,e.vy=(R-e.dy)/T,e.dx=S,e.dy=R,e._accountsForMovesUpTo=o.mostRecentTimeStamp},create(e){var n={handle:null,shouldCancelClick:!1,timeout:null},t={stateID:Math.random(),moveX:0,moveY:0,x0:0,y0:0,dx:0,dy:0,vx:0,vy:0,numberActiveTouches:0,_accountsForMovesUpTo:0};return{panHandlers:{onStartShouldSetResponder:o=>null!=e.onStartShouldSetPanResponder&&e.onStartShouldSetPanResponder(o,t),onMoveShouldSetResponder:o=>null!=e.onMoveShouldSetPanResponder&&e.onMoveShouldSetPanResponder(o,t),onStartShouldSetResponderCapture:o=>(1===o.nativeEvent.touches.length&&v._initializeGestureState(t),t.numberActiveTouches=o.touchHistory.numberActiveTouches,null!=e.onStartShouldSetPanResponderCapture&&e.onStartShouldSetPanResponderCapture(o,t)),onMoveShouldSetResponderCapture(o){var n=o.touchHistory;return t._accountsForMovesUpTo!==n.mostRecentTimeStamp&&(v._updateGestureStateOnMove(t,n),!!e.onMoveShouldSetPanResponderCapture&&e.onMoveShouldSetPanResponderCapture(o,t))},onResponderGrant:u=>(n.handle||(n.handle=o.default.createInteractionHandle()),n.timeout&&S(n),n.shouldCancelClick=!0,t.x0=l(u.touchHistory),t.y0=p(u.touchHistory),t.dx=0,t.dy=0,e.onPanResponderGrant&&e.onPanResponderGrant(u,t),null==e.onShouldBlockNativeResponder||e.onShouldBlockNativeResponder(u,t)),onResponderReject(o){h(n,e.onPanResponderReject,o,t)},onResponderRelease(o){h(n,e.onPanResponderRelease,o,t),R(n),v._initializeGestureState(t)},onResponderStart(o){var n=o.touchHistory;t.numberActiveTouches=n.numberActiveTouches,e.onPanResponderStart&&e.onPanResponderStart(o,t)},onResponderMove(o){var n=o.touchHistory;t._accountsForMovesUpTo!==n.mostRecentTimeStamp&&(v._updateGestureStateOnMove(t,n),e.onPanResponderMove&&e.onPanResponderMove(o,t))},onResponderEnd(o){var u=o.touchHistory;t.numberActiveTouches=u.numberActiveTouches,h(n,e.onPanResponderEnd,o,t)},onResponderTerminate(o){h(n,e.onPanResponderTerminate,o,t),R(n),v._initializeGestureState(t)},onResponderTerminationRequest:o=>null==e.onPanResponderTerminationRequest||e.onPanResponderTerminationRequest(o,t),onClickCapture:e=>{!0===n.shouldCancelClick&&(e.stopPropagation(),e.preventDefault())}},getInteractionHandle:()=>n.handle}}};function h(e,n,t,u){e.handle&&(o.default.clearInteractionHandle(e.handle),e.handle=null),n&&n(t,u)}function S(e){clearTimeout(e.timeout)}function R(e){e.timeout=setTimeout(()=>{e.shouldCancelClick=!1},250)}var T=v},242,[159,243]); +__d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}});var n={centroidDimension:function(t,i,o,u){var c=t.touchBank,f=0,s=0,h=1===t.numberActiveTouches?t.touchBank[t.indexOfSingleActiveTouch]:null;if(null!==h)h.touchActive&&h.currentTimeStamp>i&&(f+=u&&o?h.currentPageX:u&&!o?h.currentPageY:!u&&o?h.previousPageX:h.previousPageY,s=1);else for(var v=0;v=i){f+=u&&o?l.currentPageX:u&&!o?l.currentPageY:!u&&o?l.previousPageX:l.previousPageY,s++}}return s>0?f/s:n.noCentroid},currentCentroidXOfTouchesChangedAfter:function(t,i){return n.centroidDimension(t,i,!0,!0)},currentCentroidYOfTouchesChangedAfter:function(t,i){return n.centroidDimension(t,i,!1,!0)},previousCentroidXOfTouchesChangedAfter:function(t,i){return n.centroidDimension(t,i,!0,!1)},previousCentroidYOfTouchesChangedAfter:function(t,i){return n.centroidDimension(t,i,!1,!1)},currentCentroidX:function(t){return n.centroidDimension(t,0,!0,!0)},currentCentroidY:function(t){return n.centroidDimension(t,0,!1,!0)},noCentroid:-1},t=n},243,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return o}});var e,t=r(d[0]),s=(e=t)&&e.__esModule?e:{default:e};var o=class{static share(e,t){return void 0===t&&(t={}),(0,s.default)('object'==typeof e&&null!==e,'Content to share must be a valid object'),(0,s.default)('string'==typeof e.url||'string'==typeof e.message,'At least one of URL and message is required'),(0,s.default)('object'==typeof t&&null!==t,'Options must be a valid object'),(0,s.default)(!e.title||'string'==typeof e.title,'Invalid title: title should be a string.'),void 0!==window.navigator.share?window.navigator.share({title:e.title,text:e.message,url:e.url}):Promise.reject(new Error('Share is not supported in this browser'))}static get sharedAction(){return'sharedAction'}static get dismissedAction(){return'dismissedAction'}}},244,[145]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return n}});var t=t=>{'vibrate'in window.navigator&&window.navigator.vibrate(t)},n={cancel(){t(0)},vibrate(n){void 0===n&&(n=400),t(n)}}},245,[]); +__d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return y}});var t=e(r(_d[0])),n=e(r(_d[1])),o=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(n){if('default'!==n){var o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,t})(r(_d[2])),l=e(r(_d[3])),d=e(r(_d[4])),s=["animating","color","hidesWhenStopped","size","style"],u=e=>o.createElement("circle",{cx:"16",cy:"16",fill:"none",r:"14",strokeWidth:"4",style:e}),c=o.forwardRef((e,l)=>{var c=e.animating,y=void 0===c||c,p=e.color,v=void 0===p?'#1976D2':p,b=e.hidesWhenStopped,_=void 0===b||b,w=e.size,P=void 0===w?'small':w,j=e.style,k=(0,n.default)(e,s),O=o.createElement("svg",{height:"100%",viewBox:"0 0 32 32",width:"100%"},u({stroke:v,opacity:.2}),u({stroke:v,strokeDasharray:80,strokeDashoffset:60}));return o.createElement(d.default,(0,t.default)({},k,{"aria-valuemax":1,"aria-valuemin":0,ref:l,role:"progressbar",style:[f.container,j]}),o.createElement(d.default,{children:O,style:['number'==typeof P?{height:P,width:P}:h[P],f.animation,!y&&f.animationPause,!y&&_&&f.hidesWhenStopped]}))});c.displayName='ActivityIndicator';var f=l.default.create({container:{alignItems:'center',justifyContent:'center'},hidesWhenStopped:{visibility:'hidden'},animation:{animationDuration:'0.75s',animationKeyframes:[{'0%':{transform:'rotate(0deg)'},'100%':{transform:'rotate(360deg)'}}],animationTimingFunction:'linear',animationIterationCount:'infinite'},animationPause:{animationPlayState:'paused'}}),h=l.default.create({small:{width:20,height:20},large:{width:36,height:36}}),y=c},246,[124,45,30,46,127]); +__d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return c}});var t=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(o){if('default'!==o){var n=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,n.get?n:{enumerable:!0,get:function(){return e[o]}})}}),t.default=e,t})(r(_d[0])),o=e(r(_d[1])),n=e(r(_d[2])),l=e(r(_d[3])),u=t.forwardRef((e,o)=>{var u=e.accessibilityLabel,c=e.color,s=e.disabled,f=e.onPress,b=e.testID,y=e.title;return t.createElement(n.default,{accessibilityLabel:u,accessibilityRole:"button",disabled:s,focusable:!s,onPress:f,ref:o,style:[d.button,c&&{backgroundColor:c},s&&d.buttonDisabled],testID:b},t.createElement(l.default,{style:[d.text,s&&d.textDisabled]},y))});u.displayName='Button';var d=o.default.create({button:{backgroundColor:'#2196F3',borderRadius:2},text:{color:'#fff',fontWeight:'500',padding:8,textAlign:'center',textTransform:'uppercase'},buttonDisabled:{backgroundColor:'#dfdfdf'},textDisabled:{color:'#a1a1a1'}}),c=u},247,[30,46,248,206]); +__d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return p}});var t=e(r(_d[0])),n=e(r(_d[1])),s=r(_d[2]),o=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(n){if('default'!==n){var s=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,s.get?s:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,t})(s),l=e(r(_d[3])),u=e(r(_d[4])),c=e(r(_d[5])),d=e(r(_d[6])),f=["activeOpacity","delayPressIn","delayPressOut","delayLongPress","disabled","focusable","onLongPress","onPress","onPressIn","onPressOut","rejectResponderTermination","style"];function y(e,c){var y=e.activeOpacity,b=e.delayPressIn,p=e.delayPressOut,O=e.delayLongPress,v=e.disabled,_=e.focusable,j=e.onLongPress,L=e.onPress,h=e.onPressIn,k=e.onPressOut,C=e.rejectResponderTermination,E=e.style,R=(0,n.default)(e,f),S=(0,s.useRef)(null),D=(0,l.default)(c,S),I=(0,s.useState)('0s'),M=I[0],w=I[1],T=(0,s.useState)(null),N=T[0],x=T[1],A=(0,s.useCallback)((e,t)=>{x(e),w(t?t/1e3+"s":'0s')},[x,w]),G=(0,s.useCallback)(e=>{A(null!=y?y:.2,e)},[y,A]),q=(0,s.useCallback)(e=>{A(null,e)},[A]),z=(0,s.useMemo)(()=>({cancelable:!C,disabled:v,delayLongPress:O,delayPressStart:b,delayPressEnd:p,onLongPress:j,onPress:L,onPressStart(e){var t=null!=e.dispatchConfig?'onResponderGrant'===e.dispatchConfig.registrationName:'keydown'===e.type;G(t?0:150),null!=h&&h(e)},onPressEnd(e){q(250),null!=k&&k(e)}}),[O,b,p,v,j,L,h,k,C,G,q]),B=(0,u.default)(S,z);return o.createElement(d.default,(0,t.default)({},R,B,{accessibilityDisabled:v,focusable:!v&&!1!==_,pointerEvents:v?'box-none':void 0,ref:D,style:[P.root,!v&&P.actionable,E,null!=N&&{opacity:N},{transitionDuration:M}]}))}var P=c.default.create({root:{transitionProperty:'opacity',transitionDuration:'0.15s',userSelect:'none'},actionable:{cursor:'pointer',touchAction:'manipulation'}}),b=o.memo(o.forwardRef(y));b.displayName='TouchableOpacity';var p=b},248,[124,45,30,132,249,46,127]); +__d(function(g,r,i,a,m,_e,d){'use strict';Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return f}});var e,u=r(d[0]),t=(e=u)&&e.__esModule?e:{default:e},n=r(d[1]);function f(e,u){var f=(0,n.useRef)(null);null==f.current&&(f.current=new t.default(u));var l=f.current;return(0,n.useEffect)(()=>{l.configure(u)},[u,l]),(0,n.useEffect)(()=>()=>{l.reset()},[l]),(0,n.useDebugValue)(u),l.getEventHandlers()}},249,[250,30]); +__d(function(g,r,i,a,m,e,d){'use strict';Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return N}});var t='DELAY',s='ERROR',n='LONG_PRESS_DETECTED',o='NOT_RESPONDER',l='RESPONDER_ACTIVE_LONG_PRESS_START',_='RESPONDER_ACTIVE_PRESS_START',E='RESPONDER_INACTIVE_PRESS_START',u='RESPONDER_RELEASE',h='RESPONDER_TERMINATED',c=Object.freeze({NOT_RESPONDER:{DELAY:s,RESPONDER_GRANT:E,RESPONDER_RELEASE:s,RESPONDER_TERMINATED:s,LONG_PRESS_DETECTED:s},RESPONDER_INACTIVE_PRESS_START:{DELAY:_,RESPONDER_GRANT:s,RESPONDER_RELEASE:o,RESPONDER_TERMINATED:o,LONG_PRESS_DETECTED:s},RESPONDER_ACTIVE_PRESS_START:{DELAY:s,RESPONDER_GRANT:s,RESPONDER_RELEASE:o,RESPONDER_TERMINATED:o,LONG_PRESS_DETECTED:l},RESPONDER_ACTIVE_LONG_PRESS_START:{DELAY:s,RESPONDER_GRANT:s,RESPONDER_RELEASE:o,RESPONDER_TERMINATED:o,LONG_PRESS_DETECTED:l},ERROR:{DELAY:o,RESPONDER_GRANT:E,RESPONDER_RELEASE:o,RESPONDER_TERMINATED:o,LONG_PRESS_DETECTED:o}}),R=t=>t.getAttribute('role'),T=t=>t.tagName.toLowerCase(),P=t=>t===_||t===l,S=t=>'button'===R(t),D=t=>t===E||t===_||t===l,v=t=>t===h||t===u,p=t=>{var s=t.key,n=t.target,o=' '===s||'Spacebar'===s,l='button'===T(n)||S(n);return'Enter'===s||o&&l};class N{constructor(t){this._eventHandlers=null,this._isPointerTouch=!1,this._longPressDelayTimeout=null,this._longPressDispatched=!1,this._pressDelayTimeout=null,this._pressOutDelayTimeout=null,this._touchState=o,this._responderElement=null,this.configure(t)}configure(t){this._config=t}reset(){this._cancelLongPressDelayTimeout(),this._cancelPressDelayTimeout(),this._cancelPressOutDelayTimeout()}getEventHandlers(){return null==this._eventHandlers&&(this._eventHandlers=this._createEventHandlers()),this._eventHandlers}_createEventHandlers(){var s=(s,n)=>{s.persist(),this._cancelPressOutDelayTimeout(),this._longPressDispatched=!1,this._selectionTerminated=!1,this._touchState=o,this._isPointerTouch='touchstart'===s.nativeEvent.type,this._receiveSignal("RESPONDER_GRANT",s);var l=O(this._config.delayPressStart,0,50);!1!==n&&l>0?this._pressDelayTimeout=setTimeout(()=>{this._receiveSignal(t,s)},l):this._receiveSignal(t,s);var _=O(this._config.delayLongPress,10,450);this._longPressDelayTimeout=setTimeout(()=>{this._handleLongPress(s)},_+l)},n=t=>{this._receiveSignal(u,t)},l=t=>{var s=this._config.onPress,_=t.target;if(this._touchState!==o&&p(t)){n(t),document.removeEventListener('keyup',l);var E=_.getAttribute('role'),u=T(_),h='link'===E||'a'===u||'button'===u||'input'===u||'select'===u||'textarea'===u,c=this._responderElement===_;null!=s&&!h&&c&&s(t),this._responderElement=null}};return{onStartShouldSetResponder:t=>{var s=this._config.disabled;return s&&S(t.currentTarget)&&t.stopPropagation(),null==s||!s},onKeyDown:t=>{var n=this._config.disabled,_=t.key,E=t.target;if(!n&&p(t)){this._touchState===o&&(s(t,!1),this._responderElement=E,document.addEventListener('keyup',l));var u=' '===_||'Spacebar'===_,h=R(E);u&&('button'===h||'menuitem'===h)&&'button'!==T(E)&&t.preventDefault(),t.stopPropagation()}},onResponderGrant:t=>s(t),onResponderMove:t=>{null!=this._config.onPressMove&&this._config.onPressMove(t);var s=f(t);if(null!=this._touchActivatePosition){var n=this._touchActivatePosition.pageX-s.pageX,o=this._touchActivatePosition.pageY-s.pageY;Math.hypot(n,o)>10&&this._cancelLongPressDelayTimeout()}},onResponderRelease:t=>n(t),onResponderTerminate:t=>{'selectionchange'===t.nativeEvent.type&&(this._selectionTerminated=!0),this._receiveSignal(h,t)},onResponderTerminationRequest:t=>{var s=this._config,n=s.cancelable,o=s.disabled,l=s.onLongPress;return!(!o&&null!=l&&this._isPointerTouch&&'contextmenu'===t.nativeEvent.type)&&(null==n||n)},onClick:t=>{var s=this._config,n=s.disabled,o=s.onPress;n?S(t.currentTarget)&&t.stopPropagation():(t.stopPropagation(),this._longPressDispatched||this._selectionTerminated?t.preventDefault():null!=o&&!1===t.altKey&&o(t))},onContextMenu:t=>{var s=this._config,n=s.disabled,o=s.onLongPress;n?S(t.currentTarget)&&t.stopPropagation():null!=o&&this._isPointerTouch&&!t.defaultPrevented&&(t.preventDefault(),t.stopPropagation())}}}_receiveSignal(t,n){var l=this._touchState,_=null;null!=c[l]&&(_=c[l][t]),this._touchState===o&&t===u||(null==_||_===s?console.error("PressResponder: Invalid signal "+t+" for state "+l+" on responder"):l!==_&&(this._performTransitionSideEffects(l,_,t,n),this._touchState=_))}_performTransitionSideEffects(t,s,o,_){if(v(o)&&(setTimeout(()=>{this._isPointerTouch=!1},0),this._touchActivatePosition=null,this._cancelLongPressDelayTimeout()),D(t)&&o===n){var E=this._config.onLongPress;null!=E&&null==_.nativeEvent.key&&(E(_),this._longPressDispatched=!0)}var h=P(t),c=P(s);if(!h&&c?this._activate(_):h&&!c&&this._deactivate(_),D(t)&&o===u){var R=this._config,T=R.onLongPress;if(null!=R.onPress)null!=T&&t===l||c||h||(this._activate(_),this._deactivate(_))}this._cancelPressDelayTimeout()}_activate(t){var s=this._config,n=s.onPressChange,o=s.onPressStart,l=f(t);this._touchActivatePosition={pageX:l.pageX,pageY:l.pageY},null!=o&&o(t),null!=n&&n(!0)}_deactivate(t){var s=this._config,n=s.onPressChange,o=s.onPressEnd;function l(){null!=o&&o(t),null!=n&&n(!1)}var _=O(this._config.delayPressEnd);_>0?this._pressOutDelayTimeout=setTimeout(()=>{l()},_):l()}_handleLongPress(t){this._touchState!==_&&this._touchState!==l||this._receiveSignal(n,t)}_cancelLongPressDelayTimeout(){null!=this._longPressDelayTimeout&&(clearTimeout(this._longPressDelayTimeout),this._longPressDelayTimeout=null)}_cancelPressDelayTimeout(){null!=this._pressDelayTimeout&&(clearTimeout(this._pressDelayTimeout),this._pressDelayTimeout=null)}_cancelPressOutDelayTimeout(){null!=this._pressOutDelayTimeout&&(clearTimeout(this._pressOutDelayTimeout),this._pressOutDelayTimeout=null)}}function O(t,s,n){return void 0===s&&(s=0),void 0===n&&(n=0),Math.max(s,null!=t?t:n)}function f(t){var s=t.nativeEvent,n=s.changedTouches,o=s.touches;return null!=o&&o.length>0?o[0]:null!=n&&n.length>0?n[0]:t.nativeEvent}},250,[]); +__d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return y}});var o=e(r(_d[0])),t=e(r(_d[1])),l=e(r(_d[2])),n=(function(e){if(e&&e.__esModule)return e;var o={};return e&&Object.keys(e).forEach(function(t){if('default'!==t){var l=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(o,t,l.get?l:{enumerable:!0,get:function(){return e[t]}})}}),o.default=e,o})(r(_d[3])),d=e(r(_d[4])),c=e(r(_d[5])),u=e(r(_d[6])),C=["aria-readonly","color","disabled","onChange","onValueChange","readOnly","style","value"],M=n.forwardRef((e,o)=>{var c=e['aria-readonly'],M=e.color,y=e.disabled,I=e.onChange,s=e.onValueChange,f=e.readOnly,v=e.style,h=e.value,k=(0,l.default)(e,C);var j=n.createElement(u.default,{style:[b.fakeControl,h&&b.fakeControlChecked,h&&M&&{backgroundColor:M,borderColor:M},y&&b.fakeControlDisabled,h&&y&&b.fakeControlCheckedAndDisabled]}),z=(0,d.default)('input',{checked:h,disabled:y,onChange:function(e){var o=e.nativeEvent.target.checked;e.nativeEvent.value=o,I&&I(e),s&&s(o)},readOnly:!0===f||!0===c||!0===k.accessibilityReadOnly,ref:o,style:[b.nativeControl,b.cursorInherit],type:'checkbox'});return n.createElement(u.default,(0,t.default)({},k,{"aria-disabled":y,"aria-readonly":c,style:[b.root,v,y&&b.cursorDefault]}),j,z)});M.displayName='CheckBox';var b=c.default.create({root:{cursor:'pointer',height:16,userSelect:'none',width:16},cursorDefault:{cursor:'default'},cursorInherit:{cursor:'inherit'},fakeControl:{alignItems:'center',backgroundColor:'#fff',borderColor:'#657786',borderRadius:2,borderStyle:'solid',borderWidth:2,height:'100%',justifyContent:'center',width:'100%'},fakeControlChecked:{backgroundColor:'#009688',backgroundImage:'url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcKICAgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIgogICB4bWxuczpjYz0iaHR0cDovL2NyZWF0aXZlY29tbW9ucy5vcmcvbnMjIgogICB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiCiAgIHhtbG5zOnN2Zz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciCiAgIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIKICAgdmVyc2lvbj0iMS4xIgogICB2aWV3Qm94PSIwIDAgMSAxIgogICBwcmVzZXJ2ZUFzcGVjdFJhdGlvPSJ4TWluWU1pbiBtZWV0Ij4KICA8cGF0aAogICAgIGQ9Ik0gMC4wNDAzODA1OSwwLjYyNjc3NjcgMC4xNDY0NDY2MSwwLjUyMDcxMDY4IDAuNDI5Mjg5MzIsMC44MDM1NTMzOSAwLjMyMzIyMzMsMC45MDk2MTk0MSB6IE0gMC4yMTcxNTcyOSwwLjgwMzU1MzM5IDAuODUzNTUzMzksMC4xNjcxNTcyOSAwLjk1OTYxOTQxLDAuMjczMjIzMyAwLjMyMzIyMzMsMC45MDk2MTk0MSB6IgogICAgIGlkPSJyZWN0Mzc4MCIKICAgICBzdHlsZT0iZmlsbDojZmZmZmZmO2ZpbGwtb3BhY2l0eToxO3N0cm9rZTpub25lIiAvPgo8L3N2Zz4K")',backgroundRepeat:'no-repeat',borderColor:'#009688'},fakeControlDisabled:{borderColor:'#CCD6DD'},fakeControlCheckedAndDisabled:{backgroundColor:'#AAB8C2',borderColor:'#AAB8C2'},nativeControl:(0,o.default)((0,o.default)({},c.default.absoluteFillObject),{},{height:'100%',margin:0,appearance:'none',padding:0,width:'100%'})}),y=M},251,[40,124,45,30,34,46,127]); +__d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return h}});var t=e(r(_d[0])),l=e(r(_d[1])),n=r(_d[2]),u=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(l){if('default'!==l){var n=Object.getOwnPropertyDescriptor(e,l);Object.defineProperty(t,l,n.get?n:{enumerable:!0,get:function(){return e[l]}})}}),t.default=e,t})(n),f=e(r(_d[3])),d=e(r(_d[4])),c=e(r(_d[5])),o=["children","style","imageStyle","imageRef"],s={},y=(0,n.forwardRef)((e,n)=>{var y=e.children,h=e.style,b=void 0===h?s:h,_=e.imageStyle,v=e.imageRef,p=(0,l.default)(e,o),O=d.default.flatten(b),j=O.height,w=O.width;return u.createElement(c.default,{ref:n,style:b},u.createElement(f.default,(0,t.default)({},p,{ref:v,style:[{width:w,height:j,zIndex:-1},d.default.absoluteFill,_]})),y)});y.displayName='ImageBackground';var h=y},252,[124,45,30,196,46,127]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u}});var e,t=r(d[0]),u=((e=t)&&e.__esModule?e:{default:e}).default},253,[254]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return o}});var t=e(r(d[0])),u=e(r(d[1])),n=e(r(d[2])),l=e(r(d[3])),f=["style"];var c={},o=function(e){var o=e.style,s=(0,u.default)(e,f);return l.default.createElement(n.default,(0,t.default)({},s,{style:[c,o]}))}},254,[124,45,127,30]); +__d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return c}});var t=e(r(_d[0])),n=e(r(_d[1])),o=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(n){if('default'!==n){var o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,t})(r(_d[2])),u=e(r(_d[3])),f=["behavior","contentContainerStyle","keyboardVerticalOffset"];class s extends o.Component{constructor(){super(...arguments),this.frame=null,this.onLayout=e=>{this.frame=e.nativeEvent.layout}}relativeKeyboardHeight(e){var t=this.frame;if(!t||!e)return 0;var n=e.screenY-(this.props.keyboardVerticalOffset||0);return Math.max(t.y+t.height-n,0)}onKeyboardChange(e){}render(){var e=this.props,s=(e.behavior,e.contentContainerStyle,e.keyboardVerticalOffset,(0,n.default)(e,f));return o.createElement(u.default,(0,t.default)({onLayout:this.onLayout},s))}}var c=s},255,[124,45,30,127]); +__d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return _}});var t=e(r(_d[0])),n=e(r(_d[1])),u=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(n){if('default'!==n){var u=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,u.get?u:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,t})(r(_d[2])),o=e(r(_d[3])),l=e(r(_d[4])),s=e(r(_d[5])),f=e(r(_d[6])),c=["animationType","children","onDismiss","onRequestClose","onShow","transparent","visible"],d=0,v=[],p={};function b(){if(0!==v.length){var e=v[v.length-1];v.forEach(t=>{t in p&&p[t](t===e)})}}function h(e){e in p&&(p[e](!1),delete p[e]);var t=v.indexOf(e);-1!==t&&(v.splice(t,1),b())}function y(e,t){h(e),v.push(e),p[e]=t,b()}var _=u.forwardRef((e,v)=>{var p=e.animationType,b=e.children,_=e.onDismiss,E=e.onRequestClose,O=e.onShow,j=e.transparent,w=e.visible,C=void 0===w||w,D=(0,n.default)(e,c),M=u.useMemo(()=>d++,[]),P=u.useState(!1),R=P[0],S=P[1],k=u.useCallback(()=>{h(M),_&&_()},[M,_]),q=u.useCallback(()=>{y(M,S),O&&O()},[M,O]);return u.useEffect(()=>()=>h(M),[M]),u.createElement(o.default,null,u.createElement(l.default,{animationType:p,onDismiss:k,onShow:q,visible:C},u.createElement(f.default,{active:R},u.createElement(s.default,(0,t.default)({},D,{active:R,onRequestClose:E,ref:v,transparent:j}),b))))})},256,[124,45,30,257,258,259,260]); +__d(function(g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return d}});var e,t=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(u){if('default'!==u){var n=Object.getOwnPropertyDescriptor(e,u);Object.defineProperty(t,u,n.get?n:{enumerable:!0,get:function(){return e[u]}})}}),t.default=e,t})(r(_d[0])),u=r(_d[1]),n=r(_d[2]),c=(e=n)&&e.__esModule?e:{default:e};var d=function(e){var n=e.children,d=t.useRef(null);if(c.default&&!d.current){var o=document.createElement('div');o&&document.body&&(document.body.appendChild(o),d.current=o)}return t.useEffect(()=>{if(c.default)return()=>{document.body&&d.current&&(document.body.removeChild(d.current),d.current=null)}},[]),d.current&&c.default?(0,u.createPortal)(n,d.current):null}},257,[30,109,55]); +__d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return y}});var n=(function(e){if(e&&e.__esModule)return e;var n={};return e&&Object.keys(e).forEach(function(t){if('default'!==t){var o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,o.get?o:{enumerable:!0,get:function(){return e[t]}})}}),n.default=e,n})(r(_d[0])),t=e(r(_d[1])),o=e(r(_d[2]));function u(e,n){return'slide'===e?n?f:s:'fade'===e?n?d:l:n?c.container:c.hidden}var c=t.default.create({container:{position:'fixed',top:0,right:0,bottom:0,left:0,zIndex:9999},animatedIn:{animationDuration:"250ms",animationTimingFunction:'cubic-bezier(0.215, 0.61, 0.355, 1)'},animatedOut:{pointerEvents:'none',animationDuration:"250ms",animationTimingFunction:'cubic-bezier(0.47, 0, 0.745, 0.715)'},fadeIn:{opacity:1,animationKeyframes:{'0%':{opacity:0},'100%':{opacity:1}}},fadeOut:{opacity:0,animationKeyframes:{'0%':{opacity:1},'100%':{opacity:0}}},slideIn:{transform:'translateY(0%)',animationKeyframes:{'0%':{transform:'translateY(100%)'},'100%':{transform:'translateY(0%)'}}},slideOut:{transform:'translateY(100%)',animationKeyframes:{'0%':{transform:'translateY(0%)'},'100%':{transform:'translateY(100%)'}}},hidden:{opacity:0}}),f=[c.container,c.animatedIn,c.slideIn],s=[c.container,c.animatedOut,c.slideOut],d=[c.container,c.animatedIn,c.fadeIn],l=[c.container,c.animatedOut,c.fadeOut],y=function(e){var t=e.animationType,f=e.children,s=e.onDismiss,d=e.onShow,l=e.visible,y=n.useState(!1),p=y[0],b=y[1],O=n.useRef(!1),v=n.useRef(!1),h=t&&'none'!==t,I=n.useCallback(e=>{e&&e.currentTarget!==e.target||(l?d&&d():b(!1))},[d,l]);return n.useEffect(()=>{v.current&&!p&&s&&s(),v.current=p},[p,s]),n.useEffect(()=>{l&&b(!0),l===O.current||h||I(),O.current=l},[h,l,I]),p||l?(0,o.default)('div',{style:p?u(t,l):c.hidden,onAnimationEnd:I,children:f}):null}},258,[30,46,34]); +__d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return p}});var t=e(r(_d[0])),n=e(r(_d[1])),o=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(n){if('default'!==n){var o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,t})(r(_d[2])),u=e(r(_d[3])),l=e(r(_d[4])),d=e(r(_d[5])),f=["active","children","onRequestClose","transparent"],c=o.forwardRef((e,l)=>{var c=e.active,p=e.children,v=e.onRequestClose,b=e.transparent,y=(0,n.default)(e,f);o.useEffect(()=>{if(d.default){var e=e=>{c&&'Escape'===e.key&&(e.stopPropagation(),v&&v())};return document.addEventListener('keyup',e,!1),()=>document.removeEventListener('keyup',e,!1)}},[c,v]);var O=o.useMemo(()=>[s.modal,b?s.modalTransparent:s.modalOpaque],[b]);return o.createElement(u.default,(0,t.default)({},y,{"aria-modal":!0,ref:l,role:c?'dialog':null,style:O}),o.createElement(u.default,{style:s.container},p))}),s=l.default.create({modal:{position:'fixed',top:0,right:0,bottom:0,left:0},modalTransparent:{backgroundColor:'transparent'},modalOpaque:{backgroundColor:'white'},container:{top:0,flex:1}}),p=c},259,[124,45,30,127,46,55]); +__d(function(g,r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return v}});var t=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(n){if('default'!==n){var u=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,u.get?u:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,t})(r(_d[0])),n=e(r(_d[1])),u=e(r(_d[2])),c=e(r(_d[3])),o=e(r(_d[4])),l=e(r(_d[5])),f=()=>(0,u.default)('div',{role:'none',tabIndex:0,style:E.focusBracket});function d(e){if(!l.default)return!1;try{e.focus()}catch(e){}return document.activeElement===e}function i(e){for(var t=0;t=0;t--){var n=e.childNodes[t];if(d(n)||s(n))return!0}return!1}var v=e=>{var u=e.active,c=e.children,d=t.useRef(),v=t.useRef({trapFocusInProgress:!1,lastFocusedElement:null});return t.useEffect(()=>{if(l.default){var e=()=>{if(null!=d.current&&!v.current.trapFocusInProgress&&u){try{if(v.current.trapFocusInProgress=!0,document.activeElement instanceof Node&&!d.current.contains(document.activeElement)){var e=i(d.current);v.current.lastFocusedElement===document.activeElement&&(e=s(d.current)),!e&&null!=d.current&&document.activeElement&&o.default.focus(d.current)}}finally{v.current.trapFocusInProgress=!1}v.current.lastFocusedElement=document.activeElement}};return e(),document.addEventListener('focus',e,!0),()=>document.removeEventListener('focus',e,!0)}},[u]),t.useEffect(function(){if(l.default){var e=document.activeElement;return function(){e&&document.contains(e)&&o.default.focus(e)}}},[]),t.createElement(t.Fragment,null,t.createElement(f,null),t.createElement(n.default,{ref:d},c),t.createElement(f,null))},E=c.default.create({focusBracket:{outlineStyle:'none'}})},260,[30,127,34,46,113,55]); +__d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return b}});var t=e(r(_d[0])),n=e(r(_d[1])),l=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(n){if('default'!==n){var l=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,l.get?l:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,t})(r(_d[2])),u=e(r(_d[3])),d=e(r(_d[4])),f=e(r(_d[5])),o=e(r(_d[6])),c=e(r(_d[7])),s=["children","enabled","onValueChange","selectedValue","style","testID","itemStyle","mode","prompt"],y=l.forwardRef((e,o)=>{var c=e.children,y=e.enabled,b=e.onValueChange,p=e.selectedValue,h=e.style,_=e.testID,O=(e.itemStyle,e.mode,e.prompt,(0,n.default)(e,s)),j=l.useRef(null);var I=(0,t.default)({children:c,disabled:!1===y||void 0,onChange:function(e){var t=e.target,n=t.selectedIndex,l=t.value;b&&b(l,n)},style:[v.initial,h],testID:_,value:p},O),D=(0,f.default)(I),P=(0,d.default)(j,D,o);return I.ref=P,(0,u.default)('select',I)});y.Item=o.default;var v=c.default.create({initial:{fontFamily:'System',fontSize:'inherit',margin:0}}),b=y},261,[40,45,30,34,132,134,262,46]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u}});var e,t=r(d[0]),l=(e=t)&&e.__esModule?e:{default:e};function u(e){var t=e.color,u=e.label,n=e.testID,o=e.value,c={color:t};return(0,l.default)('option',{children:u,style:c,testID:n,value:o})}},262,[34]); +__d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return p}});var n=e(r(_d[0])),t=e(r(_d[1])),o=r(_d[2]),s=(function(e){if(e&&e.__esModule)return e;var n={};return e&&Object.keys(e).forEach(function(t){if('default'!==t){var o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,o.get?o:{enumerable:!0,get:function(){return e[t]}})}}),n.default=e,n})(o),l=e(r(_d[3])),u=e(r(_d[4])),d=e(r(_d[5])),c=e(r(_d[6])),f=e(r(_d[7])),v=["children","delayLongPress","delayPressIn","delayPressOut","disabled","onBlur","onContextMenu","onFocus","onHoverIn","onHoverOut","onKeyDown","onLongPress","onPress","onPressMove","onPressIn","onPressOut","style","tabIndex","testOnly_hovered","testOnly_pressed"];function P(e,c){var P=e.children,O=e.delayLongPress,p=e.delayPressIn,_=e.delayPressOut,M=e.disabled,C=e.onBlur,h=e.onContextMenu,I=e.onFocus,x=e.onHoverIn,E=e.onHoverOut,H=e.onKeyDown,w=e.onLongPress,L=e.onPress,j=e.onPressMove,k=e.onPressIn,D=e.onPressOut,K=e.style,S=e.tabIndex,B=e.testOnly_hovered,F=e.testOnly_pressed,R=(0,t.default)(e,v),A=y(!0===B),N=A[0],q=A[1],z=y(!1),G=z[0],J=z[1],Q=y(!0===F),T=Q[0],U=Q[1],V=(0,o.useRef)(null),W=(0,l.default)(c,V),X=(0,o.useMemo)(()=>({delayLongPress:O,delayPressStart:p,delayPressEnd:_,disabled:M,onLongPress:w,onPress:L,onPressChange:U,onPressStart:k,onPressMove:j,onPressEnd:D}),[O,p,_,M,w,L,k,j,D,U]),Y=(0,d.default)(V,X),Z=Y.onContextMenu,$=Y.onKeyDown;(0,u.default)(V,{contain:!0,disabled:M,onHoverChange:q,onHoverStart:x,onHoverEnd:E});var ee,ne={hovered:N,focused:G,pressed:T},te=s.useCallback(e=>{e.nativeEvent.target===V.current&&(J(!1),null!=C&&C(e))},[V,J,C]),oe=s.useCallback(e=>{e.nativeEvent.target===V.current&&(J(!0),null!=I&&I(e))},[V,J,I]),re=s.useCallback(e=>{null!=Z&&Z(e),null!=h&&h(e)},[h,Z]),se=s.useCallback(e=>{null!=$&&$(e),null!=H&&H(e)},[H,$]);return ee=void 0!==S?S:M?-1:0,s.createElement(f.default,(0,n.default)({},R,Y,{"aria-disabled":M,onBlur:te,onContextMenu:re,onFocus:oe,onKeyDown:se,ref:W,style:[M?b.disabled:b.active,'function'==typeof K?K(ne):K],tabIndex:ee}),'function'==typeof P?P(ne):P)}function y(e){var n=(0,o.useState)(!1);return[n[0]||e,n[1]]}var b=c.default.create({active:{cursor:'pointer',touchAction:'manipulation'},disabled:{pointerEvents:'box-none'}}),O=(0,o.memo)((0,o.forwardRef)(P));O.displayName='Pressable';var p=O},263,[124,45,30,132,264,249,46,127]); +__d(function(g,r,i,a,m,_e,d){"use strict";function n(n){return n&&n.__esModule?n:{default:n}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return b}});var e=r(d[0]),t=n(r(d[1])),u=n(r(d[2])),l={},o={passive:!0},c='react-gui:hover:lock',f='react-gui:hover:unlock',v=()=>!('undefined'==typeof window||null==window.PointerEvent);function s(n,e,t){var u=document.createEvent('CustomEvent'),o=t||l,c=o.bubbles,f=void 0===c||c,v=o.cancelable,s=void 0===v||v,p=o.detail;u.initCustomEvent(e,f,s,p),n.dispatchEvent(u)}function p(n){var t=n.pointerType;return null!=t?t:(0,e.getModality)()}function b(n,e){var l=e.contain,b=e.disabled,h=e.onHoverStart,y=e.onHoverChange,E=e.onHoverUpdate,_=e.onHoverEnd,w=v(),H=(0,t.default)(w?'pointermove':'mousemove',o),C=(0,t.default)(w?'pointerenter':'mouseenter',o),M=(0,t.default)(w?'pointerleave':'mouseleave',o),P=(0,t.default)(c,o),j=(0,t.default)(f,o);(0,u.default)(()=>{var e=n.current;if(null!==e){var t=function(n){null!=_&&_(n),null!=y&&y(!1),H(e,null),M(e,null)},u=function(e){var u=n.current;null!=u&&'touch'!==p(e)&&(l&&s(u,f),t(e))},o=function(n){'touch'!==p(n)&&null!=E&&(null==n.x&&(n.x=n.clientX),null==n.y&&(n.y=n.clientY),E(n))},v=function(n){null!=h&&h(n),null!=y&&y(!0),null!=E&&H(e,b?null:o),M(e,b?null:u)};C(e,b?null:function(e){var u=n.current;if(null!=u&&'touch'!==p(e)){l&&s(u,c),v(e);P(u,b?null:function(n){n.target!==u&&t(e)}),j(u,b?null:function(n){n.target!==u&&v(e)})}})}},[C,H,M,P,j,l,b,h,y,E,_,n])}},264,[265,267,131]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.getActiveModality=function(){return s},_e.getModality=function(){return l},_e.addModalityListener=function(e){return y.add(e),()=>{y.delete(e)}},_e.testOnly_resetActiveModality=function(){v=!1,s=f,l=f};var e,t,n,o=r(d[0]),u=r(d[1]),c=(e=u)&&e.__esModule?e:{default:e},s='keyboard',l='keyboard',v=!1,y=new Set,f='keyboard',p='mouse',E='touch',L='contextmenu',w='mousedown',h='mousemove',b='mouseup',M='pointerdown',_='pointermove',T='scroll',k='selectionchange',K='touchcancel',A='touchmove',O='touchstart',P={passive:!0},S={capture:!0,passive:!0};function j(){null==t&&null==n||(null!=t&&(l=t,t=null),null!=n&&(s=n,n=null),q())}function x(e){var t=e.type;if('undefined'!=typeof window&&null!=window.PointerEvent){if(t===M)return void(s!==e.pointerType&&(l=e.pointerType,s=e.pointerType,q()));if(t===_)return void(l!==e.pointerType&&(l=e.pointerType,q()))}else{if(v||(t===w&&s!==p&&(l=p,s=p,q()),t===h&&l!==p&&(l=p,q())),t===O)return v=!0,e.touches&&e.touches.length>1&&(v=!1),void(s!==E&&(l=E,s=E,q()));t!==L&&t!==b&&t!==k&&t!==T&&t!==K&&t!==A||(v=!1)}}function q(){var e={activeModality:s,modality:l};y.forEach(t=>{t(e)})}c.default&&((0,o.addEventListener)(window,'blur',function(){t=l,n=s,s=f,l=f,q(),v=!1},P),(0,o.addEventListener)(window,'focus',function(){j()},P),(0,o.addEventListener)(document,'keydown',function(e){e.metaKey||e.altKey||e.ctrlKey||l!==f&&(l=f,s=f,q())},S),(0,o.addEventListener)(document,'visibilitychange',function(){'hidden'!==document.visibilityState&&j()},S),(0,o.addEventListener)(document,M,x,S),(0,o.addEventListener)(document,_,x,S),(0,o.addEventListener)(document,L,x,S),(0,o.addEventListener)(document,w,x,S),(0,o.addEventListener)(document,h,x,S),(0,o.addEventListener)(document,b,x,S),(0,o.addEventListener)(document,K,x,S),(0,o.addEventListener)(document,A,x,S),(0,o.addEventListener)(document,O,x,S),(0,o.addEventListener)(document,k,x,S),(0,o.addEventListener)(document,T,x,S))},265,[266,55]); +__d(function(g,r,i,a,m,_e,d){'use strict';Object.defineProperty(_e,'__esModule',{value:!0}),_e.addEventListener=function(e,t,n,u){var o=s(u),l=e=>n(c(e));return e.addEventListener(t,l,o),function(){null!=e&&e.removeEventListener(t,l,o)}};var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},u=()=>{};var o=(function(){var e=!1;if(n.default)try{var t={};Object.defineProperty(t,'passive',{get:()=>(e=!0,!1)}),window.addEventListener('test',null,t),window.removeEventListener('test',null,t)}catch(e){}return e})();function s(e){return null!=e&&(o?e:Boolean(e.capture))}function l(){return this.cancelBubble}function v(){return this.defaultPrevented}function c(e){return e.nativeEvent=e,e.persist=u,e.isDefaultPrevented=v,e.isPropagationStopped=l,e}},266,[55]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return l}});var t=r(d[0]),n=e(r(d[1])),u=e(r(d[2]));function l(e,l){var f=(0,u.default)(()=>new Map),c=(0,u.default)(()=>(n,u)=>{var c=f.get(n);null!=c&&c(),null==u&&(f.delete(n),u=()=>{});var o=(0,t.addEventListener)(n,e,u,l);return f.set(n,o),o});return(0,n.default)(()=>()=>{f.forEach(e=>{e()}),f.clear()},[f]),c}},267,[266,131,135]); +__d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return c}});var t=e(r(_d[0])),n=e(r(_d[1])),o=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(n){if('default'!==n){var o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,t})(r(_d[2])),l=e(r(_d[3])),u=e(r(_d[4])),d=["color","indeterminate","progress","trackColor","style"],s=o.forwardRef((e,l)=>{var s=e.color,c=void 0===s?'#1976D2':s,v=e.indeterminate,p=void 0!==v&&v,y=e.progress,b=void 0===y?0:y,_=e.trackColor,h=void 0===_?'transparent':_,j=e.style,k=(0,n.default)(e,d),C=100*b,O=p?'25%':C+"%";return o.createElement(u.default,(0,t.default)({},k,{"aria-valuemax":100,"aria-valuemin":0,"aria-valuenow":p?null:C,ref:l,role:"progressbar",style:[f.track,j,{backgroundColor:h}]}),o.createElement(u.default,{style:[{backgroundColor:c,width:O},f.progress,p&&f.animation]}))});s.displayName='ProgressBar';var f=l.default.create({track:{forcedColorAdjust:'none',height:5,overflow:'hidden',userSelect:'none',zIndex:0},progress:{forcedColorAdjust:'none',height:'100%',zIndex:-1},animation:{animationDuration:'1s',animationKeyframes:[{'0%':{transform:'translateX(-100%)'},'100%':{transform:'translateX(400%)'}}],animationTimingFunction:'linear',animationIterationCount:'infinite'}}),c=s},268,[124,45,30,46,127]); +__d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return w}});var t=e(r(_d[0])),n=e(r(_d[1])),o=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(n){if('default'!==n){var o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,t})(r(_d[2])),f=e(r(_d[3])),u=e(r(_d[4])),d=e(r(_d[5])),s=["style"],l=d.default&&window.CSS&&window.CSS.supports&&window.CSS.supports('top: constant(safe-area-inset-top)')?'constant':'env',c=o.forwardRef((e,f)=>{var d=e.style,l=(0,n.default)(e,s);return o.createElement(u.default,(0,t.default)({},l,{ref:f,style:[p.root,d]}))});c.displayName='SafeAreaView';var p=f.default.create({root:{paddingTop:l+"(safe-area-inset-top)",paddingRight:l+"(safe-area-inset-right)",paddingBottom:l+"(safe-area-inset-bottom)",paddingLeft:l+"(safe-area-inset-left)"}}),w=c},269,[124,45,30,46,127,55]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return u}});var t=()=>{};function n(){return null}n.setBackgroundColor=t,n.setBarStyle=t,n.setHidden=t,n.setNetworkActivityIndicatorVisible=t,n.setTranslucent=t;var u=n},270,[]); +__d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return j}});var t=e(r(_d[0])),l=e(r(_d[1])),o=e(r(_d[2])),u=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(l){if('default'!==l){var o=Object.getOwnPropertyDescriptor(e,l);Object.defineProperty(t,l,o.get?o:{enumerable:!0,get:function(){return e[l]}})}}),t.default=e,t})(r(_d[3])),n=e(r(_d[4])),c=e(r(_d[5])),d=e(r(_d[6])),f=e(r(_d[7])),s=["aria-label","accessibilityLabel","activeThumbColor","activeTrackColor","disabled","onValueChange","style","thumbColor","trackColor","value"],b={},h='0px 1px 3px rgba(0,0,0,0.5)',p='#D5D5D5',v='#BDBDBD',y=u.forwardRef((e,t)=>{var y=e['aria-label'],j=e.accessibilityLabel,k=e.activeThumbColor,x=e.activeTrackColor,D=e.disabled,w=void 0!==D&&D,A=e.onValueChange,O=e.style,_=void 0===O?b:O,F=e.thumbColor,S=e.trackColor,E=e.value,B=void 0!==E&&E,P=(0,o.default)(e,s),R=u.useRef(null);function T(e){var t='focus'===e.nativeEvent.type?"0px 1px 3px rgba(0,0,0,0.5), 0 0 0 10px rgba(0,0,0,0.1)":h;null!=R.current&&(R.current.style.boxShadow=t)}var I=d.default.flatten(_),M=I.height,L=I.width,V=M||'20px',N=(0,c.default)(V,2),Z=L>N?L:N,q=(0,c.default)(V,.5),z=!0===B?null!=S&&'object'==typeof S?S.true:null!=x?x:"#A3D3CF":null!=S&&'object'==typeof S?S.false:null!=S?S:"#939393",G=B?null!=k?k:"#009688":null!=F?F:"#FAFAFA",H=V,J=H,K=[C.root,_,w&&C.cursorDefault,{height:V,width:Z}],Q=!0===B?'string'==typeof x&&null!=x||'object'==typeof S&&null!=S&&S.true?z:p:'string'==typeof S&&null!=S||'object'==typeof S&&null!=S&&S.false?z:p,U=!0===B?null==k?v:G:null==F?v:G,W=[C.track,{backgroundColor:w?Q:z,borderRadius:q}],X=[C.thumb,B&&C.thumbActive,{backgroundColor:w?U:G,height:H,marginStart:B?(0,c.default)(J,-1):0,width:J}],Y=(0,n.default)('input',{'aria-label':y||j,checked:B,disabled:w,onBlur:T,onChange:function(e){null!=A&&A(e.nativeEvent.target.checked)},onFocus:T,ref:t,style:[C.nativeControl,C.cursorInherit],type:'checkbox',role:'switch'});return u.createElement(f.default,(0,l.default)({},P,{style:K}),u.createElement(f.default,{style:W}),u.createElement(f.default,{ref:R,style:X}),Y)});y.displayName='Switch';var C=d.default.create({root:{cursor:'pointer',userSelect:'none'},cursorDefault:{cursor:'default'},cursorInherit:{cursor:'inherit'},track:(0,t.default)((0,t.default)({forcedColorAdjust:'none'},d.default.absoluteFillObject),{},{height:'70%',margin:'auto',transitionDuration:'0.1s',width:'100%'}),thumb:{forcedColorAdjust:'none',alignSelf:'flex-start',borderRadius:'100%',boxShadow:h,start:'0%',transform:'translateZ(0)',transitionDuration:'0.1s'},thumbActive:{insetInlineStart:'100%'},nativeControl:(0,t.default)((0,t.default)({},d.default.absoluteFillObject),{},{height:'100%',margin:0,appearance:'none',padding:0,width:'100%'})}),j=y},271,[40,124,45,30,34,272,46,127]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return n}});var t=/^[+-]?\d*(?:\.\d+)?(?:[Ee][+-]?\d+)?(%|\w*)/,n=(n,o)=>{var u;return'string'==typeof n?""+parseFloat(n)*o+n.match(t)[1]:(u=n,!isNaN(parseFloat(u))&&isFinite(u)?n*o:void 0)}},272,[]); +__d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(n){if('default'!==n){var o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,t}function t(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return w}});var n=e(r(_d[0])),o=t(r(_d[1])),l=e(r(_d[2])),u=t(r(_d[3])),d=t(r(_d[4])),c=t(r(_d[5])),s=t(r(_d[6])),p=t(r(_d[7])),h=t(r(_d[8])),v=r(_d[9]),f=t(r(_d[10])),S=t(r(_d[11])),R=(e,t)=>{var n=e.selectionEnd,o=e.selectionStart,l=t.start,u=t.end;return l!==o||u!==n},C=(e,t)=>{if(R(e,t)){var n=t.start,o=t.end;try{e.setSelectionRange(n,o||n)}catch(e){}}},y=Object.assign({},l.defaultProps,l.accessibilityProps,l.clickProps,l.focusProps,l.keyboardProps,l.mouseProps,l.touchProps,l.styleProps,{autoCapitalize:!0,autoComplete:!0,autoCorrect:!0,autoFocus:!0,defaultValue:!0,disabled:!0,lang:!0,maxLength:!0,onChange:!0,onScroll:!0,placeholder:!0,pointerEvents:!0,readOnly:!0,rows:!0,spellCheck:!0,value:!0,type:!0}),b=e=>(0,u.default)(e,y);function x(e){return e.isComposing||229===e.keyCode}var k=null,E=n.forwardRef((e,t)=>{var l,u,f=e.autoCapitalize,R=void 0===f?'sentences':f,y=e.autoComplete,E=e.autoCompleteType,w=e.autoCorrect,O=void 0===w||w,P=e.blurOnSubmit,M=e.caretHidden,F=e.clearTextOnFocus,_=e.dir,j=e.editable,z=e.enterKeyHint,D=e.inputMode,H=e.keyboardType,K=e.multiline,L=void 0!==K&&K,N=e.numberOfLines,q=e.onBlur,A=e.onChange,B=e.onChangeText,G=e.onContentSizeChange,I=e.onFocus,W=e.onKeyPress,$=e.onLayout,V=e.onMoveShouldSetResponder,J=e.onMoveShouldSetResponderCapture,Q=e.onResponderEnd,U=e.onResponderGrant,X=e.onResponderMove,Y=e.onResponderReject,Z=e.onResponderRelease,ee=e.onResponderStart,te=e.onResponderTerminate,ne=e.onResponderTerminationRequest,re=e.onScrollShouldSetResponder,oe=e.onScrollShouldSetResponderCapture,ae=e.onSelectionChange,le=e.onSelectionChangeShouldSetResponder,ue=e.onSelectionChangeShouldSetResponderCapture,de=e.onStartShouldSetResponder,ie=e.onStartShouldSetResponderCapture,ce=e.onSubmitEditing,se=e.placeholderTextColor,pe=e.readOnly,he=void 0!==pe&&pe,ve=e.returnKeyType,fe=e.rows,Se=e.secureTextEntry,Re=void 0!==Se&&Se,ge=e.selection,Ce=e.selectTextOnFocus,ye=e.showSoftInputOnFocus,me=e.spellCheck;if(null!=D)u=D,l='email'===D?'email':'tel'===D?'tel':'search'===D?'search':'url'===D?'url':'text';else if(null!=H)switch(H){case'email-address':l='email';break;case'number-pad':case'numeric':u='numeric';break;case'decimal-pad':u='decimal';break;case'phone-pad':l='tel';break;case'search':case'web-search':l='search';break;case'url':l='url';break;default:l='text'}Re&&(l='password');var be=n.useRef({height:null,width:null}),xe=n.useRef(null),ke=n.useRef(null),Ee=n.useRef(!1);n.useEffect(()=>{xe.current&&ke.current&&C(xe.current,ke.current),Ee.current=Re},[Re]);var Te=n.useCallback(e=>{if(L&&G&&null!=e){var t=e.scrollHeight,n=e.scrollWidth;t===be.current.height&&n===be.current.width||(be.current.height=t,be.current.width=n,G({nativeEvent:{contentSize:{height:be.current.height,width:be.current.width}}}))}},[L,G]),we=n.useMemo(()=>e=>{null!=e&&(e.clear=function(){null!=e&&(e.value='')},e.isFocused=function(){return null!=e&&S.default.currentlyFocusedField()===e},Te(e))},[Te]);(0,c.default)(()=>{var e=xe.current;null!=e&&null!=ge&&C(e,ge),document.activeElement===e&&(S.default._currentlyFocusedNode=e)},[xe,ge]);var Oe=L?'textarea':'input';(0,d.default)(xe,$),(0,h.default)(xe,{onMoveShouldSetResponder:V,onMoveShouldSetResponderCapture:J,onResponderEnd:Q,onResponderGrant:U,onResponderMove:X,onResponderReject:Y,onResponderRelease:Z,onResponderStart:ee,onResponderTerminate:te,onResponderTerminationRequest:ne,onScrollShouldSetResponder:re,onScrollShouldSetResponderCapture:oe,onSelectionChangeShouldSetResponder:le,onSelectionChangeShouldSetResponderCapture:ue,onStartShouldSetResponder:de,onStartShouldSetResponderCapture:ie});var Pe=(0,v.useLocaleContext)().direction,Me=b(e);Me.autoCapitalize=R,Me.autoComplete=y||E||'on',Me.autoCorrect=O?'on':'off',Me.dir=void 0!==_?_:'auto',Me.enterKeyHint=z||ve,Me.inputMode=u,Me.onBlur=function(e){S.default._currentlyFocusedNode=null,q&&(e.nativeEvent.text=e.target.value,q(e))},Me.onChange=function(e){var t=e.target,n=t.value;e.nativeEvent.text=n,Te(t),A&&A(e),B&&B(n)},Me.onFocus=function(e){var t=e.target;I&&(e.nativeEvent.text=t.value,I(e)),null!=t&&(S.default._currentlyFocusedNode=t,F&&(t.value=''),Ce&&(null!=k&&clearTimeout(k),k=setTimeout(()=>{null!=t&&document.activeElement===t&&t.select()},0)))},Me.onKeyDown=function(e){var t=e.target;e.stopPropagation();var n=null==P?!L:P,o=e.nativeEvent,l=x(o);W&&W(e),'Enter'!==e.key||e.shiftKey||l||e.isDefaultPrevented()||(!P&&L||!ce||(e.preventDefault(),o.text=e.target.value,ce(e)),n&&null!=t&&setTimeout(()=>t.blur(),0))},Me.onSelect=function(e){try{var t=e.target,n={start:t.selectionStart,end:t.selectionEnd};ae&&(e.nativeEvent.selection=n,e.nativeEvent.text=e.target.value,ae(e)),Ee.current===Re&&(ke.current=n)}catch(e){}},Me.readOnly=!0===he||!1===j,Me.rows=L?null!=fe?fe:N:1,Me.spellCheck=null!=me?me:O,Me.style=[{'--placeholderTextColor':se},T.textinput$raw,T.placeholder,e.style,M&&T.caretHidden],Me.type=L?void 0:l,Me.virtualkeyboardpolicy=!1===ye?'manual':'auto';var Fe=(0,p.default)(Me),je=(0,s.default)(xe,Fe,we,t);Me.ref=je;var ze=null!=e.lang?(0,v.getLocaleDirection)(e.lang):null,De=e.dir||ze||Pe;return(0,o.default)(Oe,Me,{writingDirection:De})});E.displayName='TextInput',E.State=S.default;var T=f.default.create({textinput$raw:{MozAppearance:'textfield',WebkitAppearance:'none',backgroundColor:'transparent',border:'0 solid black',borderRadius:0,boxSizing:'border-box',font:'14px System',margin:0,padding:0,resize:'none'},placeholder:{placeholderTextColor:'var(--placeholderTextColor)'},caretHidden:{caretColor:'transparent'}}),w=E},273,[30,34,128,129,130,131,132,134,136,101,46,154]); +__d(function(g,r,i,a,m,_e,d){'use strict';function t(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return w}});var e=t(r(d[0])),o=t(r(d[1])),s=t(r(d[2])),E=t(r(d[3])),n=t(r(d[4])),l=t(r(d[5])),h=t(r(d[6])),u=t(r(d[7])),R=t(r(d[8])),c=t=>{var e=t.touches,o=t.changedTouches,s=e&&e.length>0,E=o&&o.length>0;return!s&&E?o[0]:s?e[0]:t},_='NOT_RESPONDER',S='RESPONDER_INACTIVE_PRESS_IN',T='RESPONDER_INACTIVE_PRESS_OUT',P='RESPONDER_ACTIVE_PRESS_IN',D='RESPONDER_ACTIVE_PRESS_OUT',N='RESPONDER_ACTIVE_LONG_PRESS_IN',b='RESPONDER_ACTIVE_LONG_PRESS_OUT',O='ERROR',A={NOT_RESPONDER:!1,RESPONDER_INACTIVE_PRESS_IN:!1,RESPONDER_INACTIVE_PRESS_OUT:!1,RESPONDER_ACTIVE_PRESS_IN:!1,RESPONDER_ACTIVE_PRESS_OUT:!1,RESPONDER_ACTIVE_LONG_PRESS_IN:!1,RESPONDER_ACTIVE_LONG_PRESS_OUT:!1,ERROR:!1},p=(0,o.default)((0,o.default)({},A),{},{RESPONDER_ACTIVE_PRESS_OUT:!0,RESPONDER_ACTIVE_PRESS_IN:!0}),f=(0,o.default)((0,o.default)({},A),{},{RESPONDER_INACTIVE_PRESS_IN:!0,RESPONDER_ACTIVE_PRESS_IN:!0,RESPONDER_ACTIVE_LONG_PRESS_IN:!0}),v=(0,o.default)((0,o.default)({},A),{},{RESPONDER_ACTIVE_LONG_PRESS_IN:!0}),L='DELAY',I='RESPONDER_GRANT',y='RESPONDER_RELEASE',C='RESPONDER_TERMINATED',G='ENTER_PRESS_RECT',H='LEAVE_PRESS_RECT',V='LONG_PRESS_DETECTED',M={NOT_RESPONDER:{DELAY:O,RESPONDER_GRANT:S,RESPONDER_RELEASE:O,RESPONDER_TERMINATED:O,ENTER_PRESS_RECT:O,LEAVE_PRESS_RECT:O,LONG_PRESS_DETECTED:O},RESPONDER_INACTIVE_PRESS_IN:{DELAY:P,RESPONDER_GRANT:O,RESPONDER_RELEASE:_,RESPONDER_TERMINATED:_,ENTER_PRESS_RECT:S,LEAVE_PRESS_RECT:T,LONG_PRESS_DETECTED:O},RESPONDER_INACTIVE_PRESS_OUT:{DELAY:D,RESPONDER_GRANT:O,RESPONDER_RELEASE:_,RESPONDER_TERMINATED:_,ENTER_PRESS_RECT:S,LEAVE_PRESS_RECT:T,LONG_PRESS_DETECTED:O},RESPONDER_ACTIVE_PRESS_IN:{DELAY:O,RESPONDER_GRANT:O,RESPONDER_RELEASE:_,RESPONDER_TERMINATED:_,ENTER_PRESS_RECT:P,LEAVE_PRESS_RECT:D,LONG_PRESS_DETECTED:N},RESPONDER_ACTIVE_PRESS_OUT:{DELAY:O,RESPONDER_GRANT:O,RESPONDER_RELEASE:_,RESPONDER_TERMINATED:_,ENTER_PRESS_RECT:P,LEAVE_PRESS_RECT:D,LONG_PRESS_DETECTED:O},RESPONDER_ACTIVE_LONG_PRESS_IN:{DELAY:O,RESPONDER_GRANT:O,RESPONDER_RELEASE:_,RESPONDER_TERMINATED:_,ENTER_PRESS_RECT:N,LEAVE_PRESS_RECT:b,LONG_PRESS_DETECTED:N},RESPONDER_ACTIVE_LONG_PRESS_OUT:{DELAY:O,RESPONDER_GRANT:O,RESPONDER_RELEASE:_,RESPONDER_TERMINATED:_,ENTER_PRESS_RECT:N,LEAVE_PRESS_RECT:b,LONG_PRESS_DETECTED:O},error:{DELAY:_,RESPONDER_GRANT:S,RESPONDER_RELEASE:_,RESPONDER_TERMINATED:_,ENTER_PRESS_RECT:_,LEAVE_PRESS_RECT:_,LONG_PRESS_DETECTED:_}},U={componentDidMount:function(){var t=this.getTouchableNode&&this.getTouchableNode();t&&t.addEventListener&&(this._touchableBlurListener=t=>{this._isTouchableKeyboardActive&&(this.state.touchable.touchState&&this.state.touchable.touchState!==_&&this.touchableHandleResponderTerminate({nativeEvent:t}),this._isTouchableKeyboardActive=!1)},t.addEventListener('blur',this._touchableBlurListener))},componentWillUnmount:function(){var t=this.getTouchableNode&&this.getTouchableNode();t&&t.addEventListener&&t.removeEventListener('blur',this._touchableBlurListener),this.touchableDelayTimeout&&clearTimeout(this.touchableDelayTimeout),this.longPressDelayTimeout&&clearTimeout(this.longPressDelayTimeout),this.pressOutDelayTimeout&&clearTimeout(this.pressOutDelayTimeout),this.pressInLocation=null,this.state.touchable.responderID=null},touchableGetInitialState:function(){return{touchable:{touchState:void 0,responderID:null}}},touchableHandleResponderTerminationRequest:function(){return!this.props.rejectResponderTermination},touchableHandleStartShouldSetResponder:function(){return!this.props.disabled},touchableLongPressCancelsPress:function(){return!0},touchableHandleResponderGrant:function(t){var e=t.currentTarget;t.persist(),this.pressOutDelayTimeout&&clearTimeout(this.pressOutDelayTimeout),this.pressOutDelayTimeout=null,this.state.touchable.touchState=_,this.state.touchable.responderID=e,this._receiveSignal(I,t);var o=void 0!==this.touchableGetHighlightDelayMS?Math.max(this.touchableGetHighlightDelayMS(),0):130;0!==(o=isNaN(o)?130:o)?this.touchableDelayTimeout=setTimeout(this._handleDelay.bind(this,t),o):this._handleDelay(t);var s=void 0!==this.touchableGetLongPressDelayMS?Math.max(this.touchableGetLongPressDelayMS(),10):370;s=isNaN(s)?370:s,this.longPressDelayTimeout=setTimeout(this._handleLongDelay.bind(this,t),s+o)},touchableHandleResponderRelease:function(t){this.pressInLocation=null,this._receiveSignal(y,t)},touchableHandleResponderTerminate:function(t){this.pressInLocation=null,this._receiveSignal(C,t)},touchableHandleResponderMove:function(t){if(this.state.touchable.positionOnActivate){var e=this.state.touchable.positionOnActivate,o=this.state.touchable.dimensionsOnActivate,s=this.touchableGetPressRectOffset?this.touchableGetPressRectOffset():{left:20,right:20,top:20,bottom:20},E=s.left,n=s.top,l=s.right,h=s.bottom,u=this.touchableGetHitSlop?this.touchableGetHitSlop():null;u&&(E+=u.left||0,n+=u.top||0,l+=u.right||0,h+=u.bottom||0);var R=c(t.nativeEvent),_=R&&R.pageX,T=R&&R.pageY;if(this.pressInLocation)this._getDistanceBetweenPoints(_,T,this.pressInLocation.pageX,this.pressInLocation.pageY)>10&&this._cancelLongPressDelayTimeout();if(_>e.left-E&&T>e.top-n&&_{this.touchableHandleActivePressOut(t)},this.touchableGetPressOutDelayMS()):this.touchableHandleActivePressOut(t))},touchableHandleKeyEvent:function(t){var e=t.type,o=t.key;'Enter'!==o&&' '!==o||('keydown'===e?this._isTouchableKeyboardActive||this.state.touchable.touchState&&this.state.touchable.touchState!==_||(this.touchableHandleResponderGrant(t),this._isTouchableKeyboardActive=!0):'keyup'===e&&this._isTouchableKeyboardActive&&this.state.touchable.touchState&&this.state.touchable.touchState!==_&&(this.touchableHandleResponderRelease(t),this._isTouchableKeyboardActive=!1),t.stopPropagation(),'Enter'===o&&'link'===s.default.propsToAriaRole(this.props)||t.preventDefault())},withoutDefaultFocusAndBlur:{}},Y=(U.touchableHandleFocus,U.touchableHandleBlur,(0,e.default)(U,["touchableHandleFocus","touchableHandleBlur"]));U.withoutDefaultFocusAndBlur=Y;var B={Mixin:U,TOUCH_TARGET_DEBUG:!1,renderDebugView:t=>{var e=t.color,s=t.hitSlop;if(!B.TOUCH_TARGET_DEBUG)return null;var E={};for(var l in s=s||{top:0,bottom:0,left:0,right:0})E[l]=-s[l];var u=(0,n.default)(e);if('number'!=typeof u)return null;var c='#'+('00000000'+u.toString(16)).substr(-8);return h.default.createElement(R.default,{pointerEvents:"none",style:(0,o.default)({position:'absolute',borderColor:c.slice(0,-2)+'55',borderWidth:1,borderStyle:'dashed',backgroundColor:c.slice(0,-2)+'0F'},E)})}},w=B},274,[45,40,35,275,54,277,30,113,127]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return l}});var e,t=r(d[0]),o=(e=t)&&e.__esModule?e:{default:e},n=o.default.twoArgumentPooler;function u(e,t){this.width=e,this.height=t}u.prototype.destructor=function(){this.width=null,this.height=null},u.getPooledFromElement=function(e){return u.getPooled(e.offsetWidth,e.offsetHeight)},o.default.addPoolingTo(u,n);var l=u},275,[276]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return l}}),r(d[0]);var o=function(o,n){var t=this;if(t.instancePool.length){var l=t.instancePool.pop();return t.call(l,o,n),l}return new t(o,n)},n=function(o){var n=this;o.destructor(),n.instancePool.length{P(e)&&(q(f(b,H)),null!=w&&w())},[b,w,e,H]),B=(0,s.useCallback)(()=>{!0!==U&&P(e)&&(q(null),null!=C&&C())},[C,e,U]),F=(0,s.useMemo)(()=>({cancelable:!M,disabled:j,delayLongPress:_,delayPressStart:h,delayPressEnd:v,onLongPress:E,onPress:S,onPressStart(e){z(),null!=k&&k(e)},onPressEnd(e){B(),null!=I&&I(e)}}),[_,h,v,j,E,S,k,I,M,z,B]),G=(0,u.default)(D,F),J=t.Children.only(O);return t.createElement(c.default,(0,n.default)({},T,G,{accessibilityDisabled:j,focusable:!j&&!1!==L,pointerEvents:j?'box-none':void 0,ref:x,style:[p.root,R,!j&&p.actionable,N&&N.underlay]}),t.cloneElement(J,{style:[J.props.style,N&&N.child]}))}var p=d.default.create({root:{userSelect:'none'},actionable:{cursor:'pointer',touchAction:'manipulation'}}),O=t.memo(t.forwardRef(b));O.displayName='TouchableHighlight';var h=O},278,[124,45,30,132,249,46,127]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u}});var e,t=r(d[0]),u=((e=t)&&e.__esModule?e:{default:e}).default},279,[254]); +__d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return b}});var s=r(_d[0]),t=(function(e){if(e&&e.__esModule)return e;var s={};return e&&Object.keys(e).forEach(function(t){if('default'!==t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(s,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})}}),s.default=e,s})(s),n=e(r(_d[1])),l=e(r(_d[2])),o=e(r(_d[3])),c={accessibilityDisabled:!0,accessibilityLabel:!0,accessibilityLiveRegion:!0,accessibilityRole:!0,accessibilityState:!0,accessibilityValue:!0,children:!0,disabled:!0,focusable:!0,nativeID:!0,onBlur:!0,onFocus:!0,onLayout:!0,testID:!0},u=e=>(0,n.default)(e,c);function d(e,n){var c=e.delayPressIn,d=e.delayPressOut,f=e.delayLongPress,b=e.disabled,y=e.focusable,P=e.onLongPress,v=e.onPress,p=e.onPressIn,O=e.onPressOut,_=e.rejectResponderTermination,h=(0,s.useRef)(null),j=(0,s.useMemo)(()=>({cancelable:!_,disabled:b,delayLongPress:f,delayPressStart:c,delayPressEnd:d,onLongPress:P,onPress:v,onPressStart:p,onPressEnd:O}),[b,c,d,f,P,v,p,O,_]),L=(0,o.default)(h,j),D=t.Children.only(e.children),R=[D.props.children],E=u(e);E.accessibilityDisabled=b,E.focusable=!b&&!1!==y,E.ref=(0,l.default)(n,h,D.ref);var I=Object.assign(E,L);return t.cloneElement(D,I,...R)}var f=t.memo(t.forwardRef(d));f.displayName='TouchableWithoutFeedback';var b=f},280,[30,129,132,249]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u}});var e,t=r(d[0]),u=((e=t)&&e.__esModule?e:{default:e}).default},281,[146]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return f}});var t=e(r(d[0])),n=e(r(d[1]));function u(e){return t.default.createElement(n.default,e)}u.ignoreWarnings=()=>{};var f=u},282,[30,254]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return n}});var n={ignoreLogs(){},ignoreAllLogs(){},uninstall(){},install(){}}},283,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u}});var e,t=r(d[0]),u=((e=t)&&e.__esModule?e:{default:e}).default},284,[188]); +__d(function(g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return f}});var e,t=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(n){if('default'!==n){var u=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,u.get?u:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,t})(r(_d[0])),n=r(_d[1]),u=(e=n)&&e.__esModule?e:{default:e};function f(){var e=t.useState(u.default.getColorScheme()),n=e[0],f=e[1];return t.useEffect(()=>u.default.addChangeListener(function(e){f(e.colorScheme)}).remove,[]),n}},285,[30,227]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}});var t=r(d[0]).useLocaleContext},286,[101]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return f}});var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},u=r(d[1]);function f(){var e=(0,u.useState)(()=>n.default.get('window')),t=e[0],f=e[1];return(0,u.useEffect)(()=>{function e(e){var t=e.window;null!=t&&f(t)}return n.default.addEventListener('change',e),f(n.default.get('window')),()=>{n.default.removeEventListener('change',e)}},[]),t}},287,[152,30]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}function n(){const t=r(d[1]);return n=function(){return t},t}function c(){const t=r(d[2]);return c=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"SafeAreaProvider",{enumerable:!0,get:function(){return f}});const o=Object.freeze({top:0,right:0,bottom:0,left:0}),u=Object.freeze({x:0,y:0,width:0,height:0});const f=function({children:f,initialMetrics:l,initialSafeAreaInsets:h,style:j,...x}){return(0,t().jsx)(n().View,{...x,style:[s.container,j],children:(0,t().jsx)(c().SafeAreaFrameContext.Provider,{value:u,children:(0,t().jsx)(c().SafeAreaInsetsContext.Provider,{value:o,children:f})})})},s=n().StyleSheet.create({container:{flex:1}})},288,[24,33,289]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0});var t=r(d[0]);Object.keys(t).forEach(function(n){'default'===n||Object.prototype.hasOwnProperty.call(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[n]}})});var n=r(d[1]);Object.keys(n).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})});var c=r(d[2]);Object.keys(c).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return c[t]}})});var o=r(d[3]);Object.keys(o).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return o[t]}})})},289,[290,292,293,294]); +__d(function(g,_r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"SafeAreaInsetsContext",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"SafeAreaFrameContext",{enumerable:!0,get:function(){return l}}),_e.SafeAreaProvider=function({children:e,initialMetrics:r,initialSafeAreaInsets:c,style:d,ref:h,...v}){const b=t.useContext(f),y=t.useContext(l),[p,w]=t.useState(r?.insets??c??b??null),[S,C]=t.useState(r?.frame??y??{x:0,y:0,width:n.default.get('window').width,height:n.default.get('window').height}),A=t.useCallback(e=>{const{nativeEvent:{frame:t,insets:n}}=e;C(e=>!t||t.height===e.height&&t.width===e.width&&t.x===e.x&&t.y===e.y?e:t),w(e=>e&&n.bottom===e.bottom&&n.left===e.left&&n.right===e.right&&n.top===e.top?e:n)},[]);return t.createElement(o.NativeSafeAreaProvider,u({ref:h,style:[s.fill,d],onInsetsChange:A},v),null!=p?t.createElement(l.Provider,{value:S},t.createElement(f.Provider,{value:p},e)):null)},_e.SafeAreaListener=function({onChange:e,style:n,children:r,...f}){return t.createElement(o.NativeSafeAreaProvider,u({},f,{style:[s.fill,n],onInsetsChange:t=>{e({insets:t.nativeEvent.insets,frame:t.nativeEvent.frame})}}),r)},_e.useSafeAreaInsets=d,_e.useSafeAreaFrame=function(){const e=t.useContext(l);if(null==e)throw new Error(c);return e},_e.withSafeAreaInsets=function(e){return t.forwardRef((n,r)=>{const o=d();return t.createElement(e,u({},n,{insets:o,ref:r}))})},_e.useSafeArea=function(){return d()},Object.defineProperty(_e,"SafeAreaConsumer",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"SafeAreaContext",{enumerable:!0,get:function(){return v}});var t=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(n){if('default'!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,t})(_r(_d[0])),n=e(_r(_d[1])),r=e(_r(_d[2])),o=_r(_d[3]);function u(){return u=Object.assign?Object.assign.bind():function(e){for(var t=1;t{if(f.current=t,'function'==typeof s)return s(t);null!=s&&(s.current=t)},[s]);return e.useEffect(()=>{if('undefined'==typeof document)return;const t=f.current,e='undefined'!=typeof ResizeObserver&&null!=t&&'function'==typeof t.getBoundingClientRect,n=p();document.body.appendChild(n);const o=()=>{const{paddingTop:o,paddingBottom:s,paddingLeft:u,paddingRight:f}=window.getComputedStyle(n),l={top:o?parseInt(o,10):0,bottom:s?parseInt(s,10):0,left:u?parseInt(u,10):0,right:f?parseInt(f,10):0};let c=l,p={x:0,y:0,width:document.documentElement.offsetWidth,height:document.documentElement.offsetHeight};if(e){const e=t.getBoundingClientRect();c={top:Math.max(0,l.top-e.top),bottom:Math.max(0,l.bottom-(window.innerHeight-e.bottom)),left:Math.max(0,l.left-e.left),right:Math.max(0,l.right-(window.innerWidth-e.right))},p={x:e.left,y:e.top,width:e.width,height:e.height}}d({nativeEvent:{insets:c,frame:p}})};n.addEventListener(u(),o),window.addEventListener('resize',o),o();let s=null;return e&&(s=new ResizeObserver(o),s.observe(t)),()=>{n.removeEventListener(u(),o),window.removeEventListener('resize',o),s?.disconnect(),n.remove()}},[d]),e.createElement(o.default,{ref:l,style:n},t)};var t,e=(function(t){if(t&&t.__esModule)return t;var e={};return t&&Object.keys(t).forEach(function(n){if('default'!==n){var o=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,o.get?o:{enumerable:!0,get:function(){return t[n]}})}}),e.default=t,e})(r(_d[0])),n=r(_d[1]),o=(t=n)&&t.__esModule?t:{default:t};const d={WebkitTransition:'webkitTransitionEnd',Transition:'transitionEnd',MozTransition:'transitionend',MSTransition:'msTransitionEnd',OTransition:'oTransitionEnd'};let s=null;function u(){if(null!=s)return s;const t=document.createElement('invalidtype');s=d.Transition;for(const e in d)if(void 0!==t.style[e]){s=d[e];break}return s}let f=null;function l(){if(null!==f)return f;const{CSS:t}=window;return f=t&&t.supports&&t.supports('top: constant(safe-area-inset-top)')?'constant':'env',f}function c(t){return`${l()}(safe-area-inset-${t})`}function p(){const t=document.createElement('div'),{style:e}=t;return e.position='fixed',e.left='0',e.top='0',e.width='0',e.height='0',e.zIndex='-1',e.overflow='hidden',e.visibility='hidden',e.transitionDuration='0.05s',e.transitionProperty='padding',e.transitionDelay='0s',e.paddingTop=c('top'),e.paddingBottom=c('bottom'),e.paddingLeft=c('left'),e.paddingRight=c('right'),t}},291,[30,127]); +__d(function(g,_r,i,a,m,_e,_d){"use strict";function t(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"SafeAreaView",{enumerable:!0,get:function(){return l}});var e=(function(t){if(t&&t.__esModule)return t;var e={};return t&&Object.keys(t).forEach(function(r){if('default'!==r){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})}}),e.default=t,e})(_r(_d[0])),r=t(_r(_d[1])),n=t(_r(_d[2])),o=_r(_d[3]);function d(){return d=Object.assign?Object.assign.bind():function(t){for(var e=1;e{const b=(0,o.useSafeAreaInsets)(),h=e.useMemo(()=>null==c?u:Array.isArray(c)?c.reduce((t,e)=>(t[e]='additive',t),{}):c,[c]),v=e.useMemo(()=>{const e=r.default.flatten(t);if('margin'===l){const{margin:r=0,marginVertical:n=r,marginHorizontal:o=r,marginTop:d=n,marginRight:u=o,marginBottom:l=n,marginLeft:c=o}=e,p={marginTop:f(b.top,d,h.top),marginRight:f(b.right,u,h.right),marginBottom:f(b.bottom,l,h.bottom),marginLeft:f(b.left,c,h.left)};return[t,p]}{const{padding:r=0,paddingVertical:n=r,paddingHorizontal:o=r,paddingTop:d=n,paddingRight:u=o,paddingBottom:l=n,paddingLeft:c=o}=e,p={paddingTop:f(b.top,d,h.top),paddingRight:f(b.right,u,h.right),paddingBottom:f(b.bottom,l,h.bottom),paddingLeft:f(b.left,c,h.left)};return[t,p]}},[h.bottom,h.left,h.right,h.top,b.bottom,b.left,b.right,b.top,l,t]);return e.createElement(n.default,d({style:v},p,{ref:s}))})},292,[30,46,127,290]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"initialWindowMetrics",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"initialWindowSafeAreaInsets",{enumerable:!0,get:function(){return t}});const n=null,t=null},293,[]); +__d(function(g,r,i,a,m,e,d){},294,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var _ in n)Object.defineProperty(t,_,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,_).get})})(e,{get INTERNAL_SLOT_NAME(){return t},get NOT_FOUND_ROUTE_NAME(){return n},get SITEMAP_ROUTE_NAME(){return _}});const t='__root',n='+not-found',_='_sitemap'},295,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=u(r(d[1]));return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"useDomComponentNavigation",{enumerable:!0,get:function(){return o}});const n=r(d[2]);r(d[3]);function u(t){return t&&t.__esModule?t:{default:t}}function o(){const u=(0,n.useRouterActions)();t().default.useEffect(()=>()=>{},[u])}},296,[297,30,298,352]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e._emitGlobalEvent=function(n){t.forEach(t=>t(n))},Object.defineProperty(e,"addGlobalDomEventListener",{enumerable:!0,get:function(){return n}});const t=new Set;const n=n=>(t.add(n),()=>{t.delete(n)})},297,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"useRouterActions",{enumerable:!0,get:function(){return o}});const n=r(d[1]),u=r(d[2]);function o(){const o=(0,u.useEnqueueRoutingIntent)(),c=(0,u.useSetRoutingTransitionMode)();return(0,t().useMemo)(()=>(0,n.createImperativeRouter)(o,c),[o,c])}},298,[30,299,375]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=v(r(d[0]));return t=function(){return n},n}function n(){const t=r(d[1]);return n=function(){return t},t}function o(){const t=r(d[2]);return o=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get canDismiss(){return E},get canGoBack(){return A},get createImperativeRouter(){return j},get dismiss(){return N},get dismissAll(){return U},get dismissTo(){return V},get getDefaultTransitionMode(){return L},get goBack(){return K},get linkTo(){return q},get navigate(){return x},get prefetch(){return $},get push(){return C},get reload(){return O},get replace(){return F},get router(){return W},get setParams(){return M},get unboundRouter(){return I}});const s=r(d[3]),u=r(d[4]),c=r(d[5]),f=r(d[6]),l=r(d[7]);function p(t){if("function"!=typeof WeakMap)return null;var n=new WeakMap,o=new WeakMap;return(p=function(t){return t?o:n})(t)}function v(t,n){if(!n&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var o=p(n);if(o&&o.has(t))return o.get(t);var s={__proto__:null},u=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var c in t)if("default"!==c&&Object.prototype.hasOwnProperty.call(t,c)){var f=u?Object.getOwnPropertyDescriptor(t,c):null;f&&(f.get||f.set)?Object.defineProperty(s,c,f):s[c]=t[c]}return s.default=t,o&&o.set(t,s),s}function h(){if(null==l.navigationRef.current)throw new Error('Attempted to navigate before mounting the Root Layout component. Ensure the Root Layout component is rendering a Slot, or other navigator on the first render.')}function y(t,n,o){return B(t,(0,u.resolveHref)(n),{...o,event:'NAVIGATE'})}function O(){throw new Error('The reload method is not implemented in the client-side router yet.')}function T(t,n,o){return B(t,(0,u.resolveHref)(n),{...o,event:'PRELOAD'})}function P(t,n,o){return B(t,(0,u.resolveHref)(n),{...o,event:'PUSH'})}function k(t,n,o){t({type:'ACTION',payload:{action:n},inTransition:o})}function D(t,n=1,o){(0,s.emitDomDismiss)(n,o)||k(t,{type:'POP',payload:{count:n}},o?.inTransition)}function _(t,n,o){return B(t,(0,u.resolveHref)(n),{...o,event:'POP_TO'})}function b(t,n,o){return B(t,(0,u.resolveHref)(n),{...o,event:'REPLACE'})}function w(t,n){(0,s.emitDomDismissAll)(n)||k(t,{type:'POP_TO_TOP'},n?.inTransition)}function R(t,n){(0,s.emitDomGoBack)(n)||k(t,{type:'GO_BACK'},n?.inTransition)}function A(){if(n().IS_DOM)throw new Error('canGoBack imperative method is not supported. Pass the property to the DOM component instead.');return null!=l.navigationRef.current&&l.navigationRef.current.canGoBack()}function E(){if(n().IS_DOM)throw new Error('canDismiss imperative method is not supported. Pass the property to the DOM component instead.');if(null==l.navigationRef.current)return!1;let t=l.navigationRef.getRootState();for(;t;){if('stack'===t.type&&(0,c.getHistoryLength)(t)>1)return!0;if(void 0===t.index)return!1;t=t.routes?.[t.index]?.state}return!1}function M(t={}){if(!(0,s.emitDomSetParams)(t))return h(),l.navigationRef.current.setParams(t)}function B(n,c,l={}){const{inTransition:p,...v}=l;let h='string'==typeof c?c:(0,u.resolveHref)(c);if((0,s.emitDomLinkEvent)(h,l))return;if((0,f.shouldLinkExternally)(h))return h.startsWith('//')&&'web'!==o().Platform.OS&&(h=`https:${h}`),void t().openURL(h);if('..'===h||'../'===h)return R(n,{inTransition:p});n({type:'NAVIGATE_TO_HREF',payload:{href:h,options:v},inTransition:p})}function j(t,n){return{navigate:(n,o)=>y(t,n,o),push:(n,o)=>P(t,n,o),dismiss:(n,o)=>D(t,n,o),dismissAll:n=>w(t,n),dismissTo:(n,o)=>_(t,n,o),canDismiss:E,replace:(n,o)=>b(t,n,o),back:n=>R(t,n),goBack:n=>R(t,n),canGoBack:A,reload:O,prefetch:(n,o)=>T(t,n,o),setTransitionMode:t=>{S(t),n(t)},setParams:M,linkTo:(n,o)=>B(t,n,o)}}const G=()=>{throw new Error('The imperative router is unavailable before the first render has finished.')};let H='preload-only';function L(){return H}function S(t){H=t}const I={navigate:G,push:G,dismiss:G,dismissAll:G,dismissTo:G,canDismiss:G,replace:G,back:G,goBack:G,canGoBack:G,reload:G,prefetch:G,setTransitionMode:S,setParams:G,linkTo:G},W={...I},x=(...t)=>W.navigate(...t),C=(...t)=>W.push(...t),N=(...t)=>W.dismiss(...t),U=(...t)=>W.dismissAll(...t),V=(...t)=>W.dismissTo(...t),F=(...t)=>W.replace(...t),K=(...t)=>W.goBack(...t),$=(...t)=>W.prefetch(...t),q=(...t)=>W.linkTo(...t)},299,[300,346,33,351,353,354,355,356]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"parse",{enumerable:!0,get:function(){return l.parse}}),Object.defineProperty(_e,"createURL",{enumerable:!0,get:function(){return l.createURL}}),Object.defineProperty(_e,"unwrapDevLaunchURL",{enumerable:!0,get:function(){return L.unwrapDevLaunchURL}}),_e.addEventListener=p,_e.parseInitialURLAsync=async function(){const e=await c.default.getInitialURL();if(!e)return{scheme:null,hostname:null,path:null,queryParams:null};return(0,l.parse)(e)},_e.sendIntent=async function(e,t){throw new n.UnavailabilityError('Linking','sendIntent')},_e.openSettings=async function(){throw new n.UnavailabilityError('Linking','openSettings')},_e.getInitialURL=U,_e.getLinkingURL=function(){return u.default.getLinkingURL()},_e.clearInitialURL=function(){u.default.clearInitialURL?.()},_e.openURL=R,_e.canOpenURL=async function(e){return(0,o.validateURL)(e),await c.default.canOpenURL(e)},_e.useURL=function(){const[e,n]=(0,t.useState)(null);function u(e){n(e.url)}return(0,t.useEffect)(()=>{U().then(e=>n(e));const e=p('url',u);return()=>e.remove()},[]),e},_e.useLinkingURL=function(){const[e,n]=(0,t.useState)(u.default.getLinkingURL);function c(e){n(e.url)}return(0,t.useEffect)(()=>{const e=u.default.addListener('onURLReceived',c);return()=>e.remove()},[]),e??null};var n=r(d[0]),t=r(d[1]);r(d[2]);var u=e(r(d[3])),c=e(r(d[4])),l=r(d[5]),o=r(d[6]),f=r(d[7]);Object.keys(f).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return f[e]}})});var s=r(d[8]);Object.keys(s).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return s[e]}})});var L=r(d[9]);function p(e,n){return c.default.addEventListener(e,n)}async function U(){return await c.default.getInitialURL()??null}async function R(e){return(0,o.validateURL)(e),await c.default.openURL(e)}},300,[301,30,122,339,340,341,342,343,344,345]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"EventEmitter",{enumerable:!0,get:function(){return t.EventEmitter}}),Object.defineProperty(_e,"NativeModule",{enumerable:!0,get:function(){return n.NativeModule}}),Object.defineProperty(_e,"SharedObject",{enumerable:!0,get:function(){return o.SharedObject}}),Object.defineProperty(_e,"SharedRef",{enumerable:!0,get:function(){return u.SharedRef}}),Object.defineProperty(_e,"Platform",{enumerable:!0,get:function(){return c.default}}),Object.defineProperty(_e,"uuid",{enumerable:!0,get:function(){return f.default}}),Object.defineProperty(_e,"requireNativeViewManager",{enumerable:!0,get:function(){return l.requireNativeViewManager}}),Object.defineProperty(_e,"CodedError",{enumerable:!0,get:function(){return E.CodedError}}),Object.defineProperty(_e,"UnavailabilityError",{enumerable:!0,get:function(){return w.UnavailabilityError}}),Object.defineProperty(_e,"LegacyEventEmitter",{enumerable:!0,get:function(){return k.LegacyEventEmitter}}),Object.defineProperty(_e,"NativeModulesProxy",{enumerable:!0,get:function(){return M.default}}),Object.defineProperty(_e,"installOnUIRuntime",{enumerable:!0,get:function(){return _.installOnUIRuntime}}),r(d[0]),r(d[1]),r(d[2]);var t=r(d[3]),n=r(d[4]),o=r(d[5]),u=r(d[6]),c=e(r(d[7])),f=e(r(d[8])),l=r(d[9]),b=r(d[10]);Object.keys(b).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return b[e]}})});var y=r(d[11]);Object.keys(y).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return y[e]}})});var O=r(d[12]);Object.keys(O).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return O[e]}})});var p=r(d[13]);Object.keys(p).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return p[e]}})});var j=r(d[14]);Object.keys(j).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return j[e]}})});var P=r(d[15]);Object.keys(P).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return P[e]}})});var s=r(d[16]);Object.keys(s).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return s[e]}})});var h=r(d[17]);Object.keys(h).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return h[e]}})});var v=r(d[18]);Object.keys(v).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return v[e]}})});var E=r(d[19]),w=r(d[20]),k=r(d[21]),M=e(r(d[22])),_=r(d[23])},301,[302,307,308,316,318,319,320,321,310,323,326,327,328,329,330,331,332,333,334,325,324,335,337,338]); +__d(function(g,r,i,a,m,e,d){"use strict";r(d[0]),r(d[1]),r(d[2]),r(d[3])},302,[303,304,305,306]); +__d(function(g,r,i,a,m,e,d){},303,[]); +__d(function(g,r,i,a,m,e,d){},304,[]); +__d(function(g,r,i,a,m,e,d){},305,[]); +__d(function(g,r,i,a,m,e,d){},306,[]); +__d(function(g,r,i,a,m,e,d){},307,[]); +__d(function(g,r,i,a,m,e,d){"use strict";(0,r(d[0]).installExpoGlobalPolyfill)()},308,[309]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.installExpoGlobalPolyfill=function(){if(globalThis.expo)return;globalThis.expo={EventEmitter:n.EventEmitter,NativeModule:n.NativeModule,SharedObject:n.SharedObject,SharedRef:n.SharedRef,modules:globalThis.ExpoDomWebView?.expoModulesProxy??{},uuidv4:t.default.v4,uuidv5:t.default.v5,getViewConfig:()=>{throw new Error('Method not implemented.')},reloadAppAsync:async()=>{window.location.reload()},expoModulesCoreVersion:void 0,cacheDir:void 0,documentsDir:void 0,isRunningOnQuest:!1,installOnUIRuntime:e=>{throw new Error('Method not implemented.')}}};var e,o=r(d[0]),t=(e=o)&&e.__esModule?e:{default:e},n=r(d[1]),l=r(d[2]);Object.keys(l).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return l[e]}})})},309,[310,315,302]); +__d(function(g,r,i,a,m,_e,d){"use strict";function _interopDefault(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return _default}});var _libSha=r(d[0]),sha1=_interopDefault(_libSha),_libV=r(d[1]),v35=_interopDefault(_libV),_uuidTypes=r(d[2]);function uuidv4(){return'undefined'==typeof crypto&&'undefined'==typeof window?eval('require')('node:crypto').randomUUID():crypto.randomUUID()}const uuid={v4:uuidv4,v5:(0,v35.default)('v5',80,sha1.default),namespace:_uuidTypes.Uuidv5Namespace};var _default=uuid},310,[311,312,314]); +__d(function(g,r,_i,_a,m,_e,_d){'use strict';function e(e,t,n,o){switch(e){case 0:return t&n^~t&o;case 1:case 3:return t^n^o;case 2:return t&n^t&o^n&o;default:return 0}}function t(e,t){return e<>>32-t}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return n}});var n=function(n){const o=[1518500249,1859775393,2400959708,3395469782],c=[1732584193,4023233417,2562383102,271733878,3285377520];if('string'==typeof n){const e=unescape(encodeURIComponent(n));n=new Array(e.length);for(let t=0;t>>0;i=h,h=s,s=t(a,30)>>>0,a=f,f=u}c[0]=c[0]+f>>>0,c[1]=c[1]+a>>>0,c[2]=c[2]+s>>>0,c[3]=c[3]+h>>>0,c[4]=c[4]+i>>>0}return[c[0]>>24&255,c[0]>>16&255,c[0]>>8&255,255&c[0],c[1]>>24&255,c[1]>>16&255,c[1]>>8&255,255&c[1],c[2]>>24&255,c[2]>>16&255,c[2]>>8&255,255&c[2],c[3]>>24&255,c[3]>>16&255,c[3]>>8&255,255&c[3],c[4]>>24&255,c[4]>>16&255,c[4]>>8&255,255&c[4]]}},311,[]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u}});var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e};function o(e){const t=[];return e.replace(/[a-fA-F0-9]{2}/g,e=>(t.push(parseInt(e,16)),'')),t}function c(e){e=unescape(encodeURIComponent(e));const t=new Array(e.length);for(let n=0;n{this.removeListener(t,s)}}}removeListener(t,s){const n=this.listeners?.get(t)?.delete(s);0===this.listenerCount(t)&&n&&this.stopObserving(t)}removeAllListeners(t){const s=this.listenerCount(t);this.listeners?.get(t)?.clear(),s>0&&this.stopObserving(t)}emit(t,...s){new Set(this.listeners?.get(t)).forEach(t=>{try{t(...s)}catch(t){console.error(t)}})}listenerCount(t){return this.listeners?.get(t)?.size??0}startObserving(t){}stopObserving(t){}}class s extends t{}class n extends t{release(){}}class o extends n{nativeRefType='unknown'}},315,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"EventEmitter",{enumerable:!0,get:function(){return t}}),(0,r(d[0]).ensureNativeModulesAreInstalled)();const t=globalThis.expo.EventEmitter},316,[317]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.ensureNativeModulesAreInstalled=function(){},r(d[0])},317,[308]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"NativeModule",{enumerable:!0,get:function(){return t}}),(0,r(d[0]).ensureNativeModulesAreInstalled)();const t=globalThis.expo.NativeModule},318,[317]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SharedObject",{enumerable:!0,get:function(){return t}}),(0,r(d[0]).ensureNativeModulesAreInstalled)();const t=globalThis.expo.SharedObject},319,[317]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SharedRef",{enumerable:!0,get:function(){return t}}),(0,r(d[0]).ensureNativeModulesAreInstalled)();const t=globalThis.expo.SharedRef},320,[317]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u}});var e,n=r(d[0]),t=(e=n)&&e.__esModule?e:{default:e},s=r(d[1]);var u={OS:"web",select:'undefined'!=typeof window?t.default.select:function(e){return e.hasOwnProperty("web")?e.web:e.hasOwnProperty('default')?e.default:void 0},isDOMAvailable:s.isDOMAvailable,canUseEventListeners:s.canUseEventListeners,canUseViewport:s.canUseViewport,isAsyncDebugging:s.isAsyncDebugging,isQuest:globalThis.expo?.isRunningOnQuest??!1}},321,[122,322]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"isDOMAvailable",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"canUseEventListeners",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"canUseViewport",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"isAsyncDebugging",{enumerable:!0,get:function(){return c}});const n='undefined'!=typeof window&&!!window.document?.createElement,t=n&&!(!window.addEventListener&&!window.attachEvent),o=n&&!!window.screen,c=!1},322,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.requireNativeViewManager=function(n,o){throw new t.UnavailabilityError('expo-modules-core','requireNativeViewManager')};var t=r(d[0])},323,[324]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"UnavailabilityError",{enumerable:!0,get:function(){return o}}),r(d[0]);var t=r(d[1]);class o extends t.CodedError{constructor(t,o){super('ERR_UNAVAILABLE',`The method or property ${t}.${o} is not available on web, are you sure you've linked all the native dependencies properly?`)}}},324,[321,325]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CodedError",{enumerable:!0,get:function(){return t}});class t extends Error{constructor(t,o){super(o),this.code=t}}},325,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function o(o){return'object'==typeof globalThis.ExpoDomWebView&&null!=globalThis?.expo?.modules?globalThis.expo?.modules?.[o]??null:null}Object.defineProperty(e,'__esModule',{value:!0}),e.requireNativeModule=function(n){const l=o(n);if(null!=l)return l;if('undefined'==typeof window)return{};throw new Error(`Cannot find native module '${n}'`)},e.requireOptionalNativeModule=o},326,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.registerWebModule=function(s,l){if((0,o.ensureNativeModulesAreInstalled)(),!(l=l??s.name))throw new Error('Web module implementation is missing a name - it is either not a class or has been minified. Pass the name as a second argument to the `registerWebModule` function.');globalThis?.expo?.modules||(globalThis.expo.modules={});if(globalThis.expo.modules[l])return globalThis.expo.modules[l];return globalThis.expo.modules[l]=new s,globalThis.expo.modules[l]};var o=r(d[0])},327,[317]); +__d(function(g,r,i,a,m,e,d){},328,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PermissionStatus",{enumerable:!0,get:function(){return n}});var n=(function(n){return n.GRANTED="granted",n.UNDETERMINED="undetermined",n.DENIED="denied",n})({})},329,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.createPermissionHook=function(t){return n=>u(t,n)};var t=r(d[0]);function u(u,n){const c=(0,t.useRef)(!0),[s,o]=(0,t.useState)(null),{get:l=!0,request:f=!1,...h}=n||{},M=(0,t.useCallback)(async()=>{let t;return t=Object.keys(h).length>0?await u.getMethod(h):await u.getMethod(),c.current&&o(t),t},[u.getMethod]),b=(0,t.useCallback)(async()=>{let t;return t=Object.keys(h).length>0?await u.requestMethod(h):await u.requestMethod(),c.current&&o(t),t},[u.requestMethod]);return(0,t.useEffect)(function(){f&&b(),!f&&l&&M()},[l,f,b,M]),(0,t.useEffect)(function(){return c.current=!0,()=>{c.current=!1}},[]),[s,b,M]}},330,[30]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.createSnapshotFriendlyRef=function(){return(0,t.createRef)()};var t=r(d[0])},331,[30]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useReleasingSharedObject=function(c,n){return(0,t.useReleasingSharedObjectWithLifecycle)({factory:c},n)};var t=r(d[0])},332,[333]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useReleasingSharedObjectWithLifecycle=function(c,o){const u=(0,t.useRef)({}),p=n(c,o,u.current.candidate,u.current.committed);u.current.candidate=p;const h=p.resource;return(0,t.useInsertionEffect)(()=>(h.release=c.release??(t=>t?.release()),h.retain())),(0,t.useEffect)(()=>h.retain(),[h]),(0,t.useEffect)(()=>{const t=u.current.committed;u.current.committed=p,t?.resource!==h||s(t.dependencies,p.dependencies)||h.track(c.update?.(h.object,{previousDependencies:t.dependencies,dependencies:p.dependencies}))}),h.object};var t=r(d[0]);function s(t,s){return t.length===s.length&&s.every((s,n)=>Object.is(s,t[n]))}function n(t,n,o,u){if(o&&!o.resource.isDisposed&&s(o.dependencies,n))return o;const p=u?.resource.isDisposed?void 0:u;return p&&s(p.dependencies,n)?p:p&&null!=p.resource.object&&!1===t.shouldRecreate?.(p.resource.object,{previousDependencies:p.dependencies,dependencies:n})?{resource:p.resource,dependencies:[...n]}:{resource:new c(t.factory()),dependencies:[...n]}}class c{retainCount=0;disposed=!1;release=t=>t?.release();constructor(t){this.object=t}get isDisposed(){return this.disposed}retain(){if(this.disposed)throw new Error('Cannot reuse a released shared object. Remount the component to create a new one.');return this.retainCount++,()=>{--this.retainCount>0||Promise.resolve().then(()=>{0!==this.retainCount||this.disposed||(this.disposed=!0,null!=this.object&&this.release(this.object))}).catch(t=>console.error(t))}}track(t){if(!t)return;const s=this.retain();Promise.resolve(t).catch(t=>console.error(t)).then(s)}}},333,[30]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.reloadAppAsync=async function(o="Reloaded from JS call"){await(globalThis.expo?.reloadAppAsync(o))}},334,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"LegacyEventEmitter",{enumerable:!0,get:function(){return o}});var t=e(r(d[0])),n=e(r(d[1]));r(d[2]);const s='@@nativeEmitterSubscription@@';class o{_listenerCount=0;constructor(e){if(e.__expo_module_name__)return e;this._nativeModule=e,this._eventEmitter=new n.default(e)}addListener(e,t){!this._listenerCount&&this._nativeModule.startObserving&&this._nativeModule.startObserving(),this._listenerCount++;const n=this._eventEmitter.addListener(e,t),o={[s]:n,remove:()=>{this.removeSubscription(o)}};return o}removeAllListeners(e){const n=this._eventEmitter.listenerCount?this._eventEmitter.listenerCount(e):this._eventEmitter.listeners(e).length;this._eventEmitter.removeAllListeners(e),this._listenerCount-=n,(0,t.default)(this._listenerCount>=0,"EventEmitter must have a non-negative number of listeners"),!this._listenerCount&&this._nativeModule.stopObserving&&this._nativeModule.stopObserving()}removeSubscription(e){const t=e,n=t[s];n&&('remove'in n&&n.remove?.(),this._listenerCount--,delete t[s],e.remove=()=>{},!this._listenerCount&&this._nativeModule.stopObserving&&this._nativeModule.stopObserving())}emit(e,...t){this._eventEmitter.emit(e,...t)}}},335,[336,240,122]); +__d(function(g,r,i,_a,m,_e,_d){'use strict';m.exports=function(e,n,o,t,a,f,s,d){if(!e){var u;if(void 0===n)u=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[o,t,a,f,s,d],l=0;(u=new Error(n.replace(/%s/g,function(){return c[l++]}))).name='Invariant Violation'}throw u.framesToPop=1,u}}},336,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}});var t={}},337,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.installOnUIRuntime=function(t){const o=globalThis?.expo?.installOnUIRuntime;if(!o)throw Error("Native method to install Expo Modules on the worklets UI runtime wasn't found in `expo-modules-core`.");o(t)}},338,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return o}});var e,n=r(d[0]),t=(e=n)&&e.__esModule?e:{default:e},o={addListener(e,n){if((0,t.default)('onURLReceived'===e,`Linking.addListener(): ${e} is not a valid event`),'undefined'==typeof window)return{remove(){}};const o=e=>n({url:window.location.href,nativeEvent:e});return window.addEventListener('message',o,!1),{remove:()=>{window.removeEventListener('message',o)}}},getLinkingURL:()=>'undefined'==typeof window?'':window.location.href,clearInitialURL(){}}},339,[336]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return s}});var e,n=r(d[0]),t=(e=n)&&e.__esModule?e:{default:e};const o=[];var s={addEventListener(e,n){if('undefined'==typeof window)return{remove(){}};(0,t.default)('url'===e,`Linking.addEventListener(): ${e} is not a valid event`);const s=e=>n({url:window.location.href,nativeEvent:e});return o.push({listener:n,nativeListener:s}),window.addEventListener('message',s,!1),{remove:()=>{this.removeEventListener(e,n)}}},removeEventListener(e,n){if('undefined'==typeof window)return;(0,t.default)('url'===e,`Linking.addEventListener(): ${e} is not a valid event`);const s=o.findIndex(e=>e.listener===n);(0,t.default)(-1!==s,'Linking.removeEventListener(): cannot remove an unregistered event listener.');const v=o[s]?.nativeListener;null!=v&&(window.removeEventListener('message',v,!1),o.splice(s,1))},canOpenURL:async()=>!0,getInitialURL:async()=>'undefined'==typeof window?'':window.location.href,async openURL(e){'undefined'!=typeof window&&(window.location=new URL(e,window.location).toString())}}},340,[336]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.createURL=function(n,{queryParams:t={}}={}){if('undefined'==typeof window)return'';const o=new URL(n,window.location.origin);return Object.entries(t).forEach(([n,t])=>{'string'==typeof t?o.searchParams.set(n,encodeURIComponent(t)):null!=t&&o.searchParams.set(n,t)}),o.toString().replace(/\/$/,'')},e.parse=function(n){let t;try{t=new URL(n)}catch{return'undefined'==typeof window?{hostname:null,path:n,queryParams:{},scheme:null}:{hostname:'localhost',path:n,queryParams:{},scheme:'http'}}const o={};return t.searchParams.forEach((n,t)=>{o[t]=n}),{hostname:t.hostname||null,path:t.hostname||t.pathname?''===t.pathname?null:t.pathname.replace(/^\//,''):null,queryParams:o,scheme:t.protocol.replace(/:$/,'')}}},341,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.validateURL=function(e){(0,n.default)('string'==typeof e,'Invalid URL: should be a string. Was: '+e),(0,n.default)(e,'Invalid URL: cannot be empty')};var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e}},342,[336]); +__d(function(g,r,i,a,m,e,d){},343,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.hasCustomScheme=function(){return!0},e.collectManifestSchemes=function(){return[]},e.hasConstantsManifest=function(){return!1},e.resolveScheme=function(){return'https'}},344,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.unwrapDevLaunchURL=function(c){let u;try{u=new URL(c)}catch{return c}const o=u.hostname===s,l=u.searchParams.get(n)??(o?u.searchParams.get('url'):null);if(null!=l)return l;if(o)return'';const f=[...u.searchParams.keys()].filter(n=>n.startsWith(t));if(!f.length)return c;for(const t of f)u.searchParams.delete(t);return u.toString()};const t='__expo_',n=`${t}url`,s='expo-development-client'},345,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0});var t=r(d[0]);Object.keys(t).forEach(function(n){'default'===n||Object.prototype.hasOwnProperty.call(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[n]}})})},346,[347]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IS_DOM",{enumerable:!0,get:function(){return n}});var t=r(d[0]);Object.keys(t).forEach(function(n){'default'===n||Object.prototype.hasOwnProperty.call(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[n]}})});const n='undefined'!=typeof $$EXPO_INITIAL_PROPS},347,[348]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useDOMImperativeHandle=function(_,l,n){const P=!(0,t.hasWebViewBridge)()&&void 0===window.$$EXPO_INITIAL_PROPS,f=(0,o.useCallback)(()=>({}),n??[]);(0,o.useImperativeHandle)(_,P?l:f,n),(0,o.useEffect)(()=>(P||(globalThis._domRefProxy=l(),(0,t.getWebViewBridge)().postMessage(JSON.stringify({type:s.REGISTER_DOM_IMPERATIVE_HANDLE_PROPS,data:Object.keys(globalThis._domRefProxy)}))),()=>{P||(globalThis._domRefProxy=void 0)}),n)};var o=r(d[0]),s=r(d[1]),t=r(d[2])},348,[30,349,350]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"NATIVE_ACTION",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"NATIVE_ACTION_RESULT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"DOM_EVENT",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"MATCH_CONTENTS_EVENT",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"REGISTER_DOM_IMPERATIVE_HANDLE_PROPS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"DOM_READY",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"getInjectEventScript",{enumerable:!0,get:function(){return b}}),e.getInjectBodySizeObserverScript=function(){return`;(function observeDocumentBodySize() {\n if (window.ReactNativeWebView == null) {\n throw new Error(\n 'window.ReactNativeWebView is not defined. This script should only be injected in a WebView environment.'\n );\n }\n\n function registerObserver() {\n new ResizeObserver(entries => {\n const { width, height } = entries[0].contentRect;\n window.ReactNativeWebView.postMessage(JSON.stringify({\n type: '${c}',\n data: {\n width,\n height,\n },\n }));\n })\n .observe(document.body);\n window.ReactNativeWebView.postMessage(JSON.stringify({\n type: '${c}',\n data: {\n width: document.body.clientWidth,\n height: document.body.clientHeight,\n },\n }));\n }\n\n if (document.readyState !== 'loading') {\n registerObserver();\n return;\n }\n window.addEventListener('DOMContentLoaded', () => {\n registerObserver();\n });\n })();\n true;`};const n='$$native_action',t='$$native_action_result',o='$$dom_event',c='$$match_contents_event',u='$$register_dom_imperative_handle_props',s='$$dom_ready',b=n=>`;(function() {\n try {\n window.dispatchEvent(new CustomEvent("${o}",${JSON.stringify({detail:n})}));\n } catch (e) {}\n })();\n true;`},349,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function n(){return'undefined'!=typeof window?window.ReactNativeWebView:void 0}Object.defineProperty(e,'__esModule',{value:!0}),e.hasWebViewBridge=function(){return null!=n()},e.getWebViewBridge=function(){const t=n();if(!t)throw new Error("The react-native-webview bridge (window.ReactNativeWebView) is not available. This module must only be called from code running inside a DOM Component WebView. Guard the call with hasWebViewBridge() when the caller may also run on web or React Native.");return t}},350,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get emitDomDismiss(){return u},get emitDomDismissAll(){return c},get emitDomGoBack(){return s},get emitDomLinkEvent(){return _},get emitDomSetParams(){return o}});const t=r(d[0]);function n(t,n={}){return'undefined'!=typeof $$EXPO_INITIAL_PROPS&&'undefined'!=typeof ReactNativeWebView&&(window.ReactNativeWebView.postMessage(JSON.stringify({type:t,data:n})),!0)}function o(o={}){return n(t.ROUTER_SET_PARAMS_TYPE,{params:o})}function u(o,u){return n(t.ROUTER_DISMISS_TYPE,{count:o,options:u})}function s(o){return n(t.ROUTER_BACK_TYPE,{options:o})}function c(o){return n(t.ROUTER_DISMISS_ALL_TYPE,{options:o})}function _(o,u){return n(t.ROUTER_LINK_TYPE,{href:o,options:u})}},351,[352]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),(function(t,_){for(var n in _)Object.defineProperty(t,n,{enumerable:!0,get:Object.getOwnPropertyDescriptor(_,n).get})})(e,{get ROUTER_BACK_TYPE(){return u},get ROUTER_DISMISS_ALL_TYPE(){return _},get ROUTER_DISMISS_TYPE(){return n},get ROUTER_LINK_TYPE(){return t},get ROUTER_SET_PARAMS_TYPE(){return o}});const t='$$router_link',_='$$router_dismissAll',n='$$router_dismiss',u='$$router_goBack',o='$$router_setParams'},352,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get resolveHref(){return t},get resolveHrefStringWithSegments(){return n}});const t=t=>{if('string'==typeof t)return t;const n=t.pathname??'';if(!t?.params)return n;const{pathname:s,params:u}=o(n,{...t.params}),p=c(u);return s+(p?`?${p}`:'')};function n(t,{segments:n=[],params:o={}}={},{relativeToDirectory:s}={}){if(t.startsWith('.')){let c=n?.map(t=>{if(!t.startsWith('['))return t;if(t.startsWith('[...')){t=t.slice(4,-1);const n=o[t];return Array.isArray(n)?n.join('/'):n?.split(',')?.join('/')??''}return t=t.slice(1,-1),o[t]}).filter(Boolean).join('/')??'/';s&&(c=`${c}/`);const u=new URL(t,`http://hostname/${c}`);t=`${u.pathname}${u.search}`}return t.replace(/^\/+/,'/')}function o(t,n){for(const[o,c=""]of Object.entries(n)){const u=`[${o}]`,p=`[...${o}]`;if(t.includes(u))t=t.replace(u,s(c));else{if(!t.includes(p))continue;t=t.replace(p,s(c))}delete n[o]}return{pathname:t,params:n}}function s(t){return Array.isArray(t)?t.map(t=>s(t)).join('/'):encodeURIComponent(t.toString())}function c(t){return Object.entries(t).filter(([,t])=>null!=t).map(([t,n])=>`${t}=${encodeURIComponent(n.toString())}`).join('&')}},353,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(t){return t.history?t.history.length:'stack'===t.type?void 0===t.index?1:t.index+1:t.routes.length}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"getHistoryLength",{enumerable:!0,get:function(){return t}})},354,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(t){return/^([\w\d_+.-]+:)?\/\//.test(t)}function n(t){return/^(https?|mailto|tel|sms|geo|maps|market|itmss?|itms-apps|content|file):/.test(t)}function o(o){return!o.startsWith('.')&&(t(o)||n(o))}function s(t){return new URL(t,'file:')}function u(t){try{return'string'==typeof t?decodeURIComponent(t):t}catch{return t}}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get hasUrlProtocolPrefix(){return t},get isWellKnownUri(){return n},get parseUrlUsingCustomBase(){return s},get safeDecodeURIComponent(){return u},get shouldLinkExternally(){return o}})},355,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"navigationRef",{enumerable:!0,get:function(){return t}});const t=(0,r(d[0]).createNavigationContainerRef)()},356,[357]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get NOT_INITIALIZED_ERROR(){return n},get createNavigationContainerRef(){return o}});const t=r(d[0]),n="The 'navigation' object hasn't been initialized yet. This might happen if you don't have a navigator mounted, or if the navigator hasn't finished mounting. In Expo Router, mount a navigator in a route layout before using navigation methods.";function o(){const o=[...Object.keys(t.CommonActions),'addListener','removeListener','dispatch','dispatchSync','isFocused','canGoBack','getRootState','getState','getParent','getCurrentRoute','getCurrentOptions'],s={},u=(t,n)=>{s[t]&&(s[t]=s[t].filter(t=>t!==n))};let c=null;return{get current(){return c},set current(t){c=t,null!=t&&Object.entries(s).forEach(([n,o])=>{o.forEach(o=>{t.addListener(n,o)})})},isReady:()=>null!=c&&c.isReady(),...o.reduce((t,o)=>(t[o]=(...t)=>{if(null!=c)return c[o](...t);switch(o){case'addListener':{const[n,o]=t;return s[n]=s[n]||[],s[n].push(o),()=>u(n,o)}case'removeListener':{const[n,o]=t;u(n,o);break}default:console.error(n)}},t),{})}}},357,[358]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get BaseRouter(){return n.BaseRouter},get CommonActions(){return t},get DrawerActions(){return u.DrawerActions},get DrawerRouter(){return u.DrawerRouter},get StackActions(){return f.StackActions},get StackRouter(){return f.StackRouter},get TabActions(){return s.TabActions},get TabRouter(){return s.TabRouter},get attachRouteState(){return o.attachRouteState},get extendRouter(){return c.extendRouter},get extendRouterActions(){return c.extendRouterActions},get isActionHandled(){return b.isActionHandled}});const t=O(r(d[0])),n=r(d[1]),o=r(d[2]),u=r(d[3]),c=r(d[4]),f=r(d[5]),s=r(d[6]);var p,l;p=r(d[7]),l=e,Object.keys(p).forEach(function(t){"default"===t||Object.prototype.hasOwnProperty.call(l,t)||Object.defineProperty(l,t,{enumerable:!0,get:function(){return p[t]}})});const b=r(d[8]);function y(t){if("function"!=typeof WeakMap)return null;var n=new WeakMap,o=new WeakMap;return(y=function(t){return t?o:n})(t)}function O(t,n){if(!n&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var o=y(n);if(o&&o.has(t))return o.get(t);var u={__proto__:null},c=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var f in t)if("default"!==f&&Object.prototype.hasOwnProperty.call(t,f)){var s=c?Object.getOwnPropertyDescriptor(t,f):null;s&&(s.get||s.set)?Object.defineProperty(u,f,s):u[f]=t[f]}return u.default=t,o&&o.set(t,u),u}},358,[359,360,367,369,363,374,370,362,366]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){return{type:'GO_BACK'}}function n(...t){if('string'==typeof t[0]){const[n,o,p]=t;return'boolean'==typeof p&&console.warn("Passing a boolean as the third argument to 'navigate' is deprecated. Pass '{ merge: true }' instead."),{type:'NAVIGATE',payload:{name:n,params:o,merge:'boolean'==typeof p?p:p?.merge,pop:p?.pop}}}{const n=t[0]||{};if(!('name'in n))throw new Error("You need to specify a name when calling navigate with an object as the argument. Pass a route name, for example navigate({ name: 'home' }).");return{type:'NAVIGATE',payload:n}}}function o(t){return{type:'RESET',payload:t}}function p(t){return{type:'SET_PARAMS',payload:{params:t}}}function u(t){return{type:'REPLACE_PARAMS',payload:{params:t}}}function s(t,n){return{type:'PRELOAD',payload:{name:t,params:n}}}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get goBack(){return t},get navigate(){return n},get preload(){return s},get replaceParams(){return u},get reset(){return o},get setParams(){return p}})},359,[]); +__d(function(g,_r,_i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"BaseRouter",{enumerable:!0,get:function(){return u}});const t=_r(d[0]),n=_r(d[1]),o=_r(d[2]),r=_r(d[3]),u=(0,n.extendRouter)(t.NoopRouter,({baseRouter:t})=>({getStateForDeclaredRoutes(t,n){const o=new Set(n),r=t.routes.filter(t=>o.has(t.name));if(r.length===t.routes.length)return t;const u=t.routes[t.index]?.key,s=0===r.length?-1:Math.max(0,r.findIndex(t=>t.key===u));return{...t,routes:r,index:s}},getStateForAction(t,n,u){switch(n.type){case'SET_PARAMS':case'REPLACE_PARAMS':{const o=n.source?t.routes.findIndex(t=>t.key===n.source):t.index;return-1===o?r.RouterActionHandling.Unhandled:{state:{...t,routes:t.routes.map((t,r)=>r===o?{...t,params:'REPLACE_PARAMS'===n.type?n.payload.params:{...t.params,...n.payload.params}}:t)},affectedRouteKey:t.routes[o].key}}case'RESET':{const u=n.payload;if(0===u.routes.length||u.routes.some(n=>!t.routeNames.includes(n.name)))return r.RouterActionHandling.Unhandled;if(!1===u.stale){if(t.routeNames.length!==u.routeNames.length||u.routeNames.some(n=>!t.routeNames.includes(n)))return r.RouterActionHandling.Unhandled;const n=(0,o.createRouteKeyMinter)({key:t.key,routeKeySeq:Math.max(t.routeKeySeq,u.routeKeySeq??0)}),s={...u,routes:u.routes.map(t=>t.key?t:{...t,key:n.mint(t.name)}),routeKeySeq:n.routeKeySeq};return{state:s,affectedRouteKey:s.routes[s.index]?.key}}return console.warn('The RESET action payload must contain a complete navigation state. Partial states can no longer be completed during render. Include `key`, `index`, `routeNames`, `routeKeySeq`, and `stale: false` when resetting.'),r.RouterActionHandling.Unhandled}default:return r.RouterActionHandling.Delegate}},shouldActionChangeFocus:t=>'PUSH'===t.type||'NAVIGATE'===t.type}))},360,[361,363,365,362]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"NoopRouter",{enumerable:!0,get:function(){return o}});const t=r(d[0]),o=()=>({getStateForDeclaredRoutes:t=>t,getStateForRouteFocus:t=>t,getStateForAction:()=>t.RouterActionHandling.Unhandled,shouldActionChangeFocus:()=>!1})},361,[362]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"RouterActionHandling",{enumerable:!0,get:function(){return n}});var n=(function(n){return n.Delegate="DELEGATE",n.Unhandled="UNHANDLED",n})({})},362,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),(function(t,o){for(var n in o)Object.defineProperty(t,n,{enumerable:!0,get:Object.getOwnPropertyDescriptor(o,n).get})})(e,{get extendRouter(){return s},get extendRouterActions(){return c}});const t=r(d[0]),o=r(d[1]),n=r(d[2]),u=r(d[3]);function s(s,c,{type:y}={}){return S=>{const l=s(S),f=y??l.type,A=o=>void 0===f?o:(0,t.ensureStateType)(o,f);let p={key:'',routeKeySeq:0};const F=(t,o)=>(p={key:t.key,routeKeySeq:t.routeKeySeq,config:o},t),K=t=>t.routeKeySeq{const u=K(o),s=void 0===n?u:(0,t.ensureStateType)(u,n);return h?h(s):s},q={...l,getStateForAction(t,o,s=p.config){if(void 0===s)throw new Error('`baseRouter.getStateForAction` needs the `config` argument when it is called outside of `getStateForAction`, because only that method receives one from the navigator. Pass the config explicitly.');const c=l.getStateForAction(K(t),o,s);return(0,u.isActionHandled)(c)?(p.routeKeySeq=Math.max(p.routeKeySeq,c.state.routeKeySeq),c):n.RouterActionHandling.Unhandled}},b={...q,...c({baseRouter:q,options:S,nextKey:t=>{const n=(0,o.createRouteKeyMinter)(p),u=n.mint(t);return p.routeKeySeq=n.routeKeySeq,u}}),type:f},{normalizeState:h}=b;return{...b,getStateForDeclaredRoutes:(t,o)=>R(b.getStateForDeclaredRoutes(F(t),o),t.type),getStateForRouteFocus(t,o){const n=A(F(t));return R(b.getStateForRouteFocus(n,o),n.type)},getStateForAction(t,o,s){const c=A(F(t,s)),y=b.getStateForAction(c,o,s);const S=y===n.RouterActionHandling.Delegate?q.getStateForAction(c,o,s):y;if(!(0,u.isActionHandled)(S))return n.RouterActionHandling.Unhandled;const l=R(S.state,c.type);if(b.getBrowserHistoryForAction){const t=b.getBrowserHistoryForAction(c,l,o);if(t!==S.browserHistory)return{...S,state:l,browserHistory:t}}return l===S.state?S:{...S,state:l}}}}}function c(t,o){return s(t,({baseRouter:t,options:u,nextKey:s})=>({getStateForAction(c,y,S){const l=o(c,y,{...S,baseRouter:t,options:u,nextKey:s});return void 0!==l?l:n.RouterActionHandling.Delegate}}))}},363,[364,365,362,366]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(t,n){return null!=t.type?t:{...t,type:n}}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"ensureStateType",{enumerable:!0,get:function(){return t}})},364,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get ROOT_CHAIN(){return t},get createNavigatorStateKey(){return n},get createRouteKeyMinter(){return c},get getChainFromRouteKey(){return o},get getChainFromStateKey(){return u}});const t='root';function n(t){return`navigator:${t}`}function o(t){const n=t.lastIndexOf(':');return t.slice(n+1)}function u(t){return t.slice(10)}function c(n){const o=u(n.key);let c=n.routeKeySeq;return{mint(n){const u=o===t?`${c}`:`${o}-${c}`;return c+=1,`${n}:${u}`},get routeKeySeq(){return c}}}},365,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"isActionHandled",{enumerable:!0,get:function(){return t}});const n=r(d[0]);function t(t){return null!==t&&t!==n.RouterActionHandling.Unhandled}},366,[362]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const u=n(r(d[0]));return t=function(){return u},u}function n(t){return t&&t.__esModule?t:{default:t}}function u(n,u){const c=u.payload?.state;if(null==c)return n;if(!0!==c.__internal__routerActionState)return n;const s=o(c);return void 0!==n.state&&(0,t().default)(n.state,s)?n:{...n,state:s}}function o(t){const{__internal__routerActionState:n,...u}=t;return{...u,routes:t.routes.map(t=>void 0===t.state?t:{...t,state:o(t.state)})}}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"attachRouteState",{enumerable:!0,get:function(){return u}})},367,[368]); +__d(function(g,r,_i,_a,m,e,d){var t='undefined'!=typeof Element,n='function'==typeof Map,f='function'==typeof Set,o='function'==typeof ArrayBuffer&&!!ArrayBuffer.isView;function i(u,a){if(u===a)return!0;if(u&&a&&'object'==typeof u&&'object'==typeof a){if(u.constructor!==a.constructor)return!1;var c,s,l,p;if(Array.isArray(u)){if((c=u.length)!=a.length)return!1;for(s=c;0!==s--;)if(!i(u[s],a[s]))return!1;return!0}if(n&&u instanceof Map&&a instanceof Map){if(u.size!==a.size)return!1;for(p=u.entries();!(s=p.next()).done;)if(!a.has(s.value[0]))return!1;for(p=u.entries();!(s=p.next()).done;)if(!i(s.value[1],a.get(s.value[0])))return!1;return!0}if(f&&u instanceof Set&&a instanceof Set){if(u.size!==a.size)return!1;for(p=u.entries();!(s=p.next()).done;)if(!a.has(s.value[0]))return!1;return!0}if(o&&ArrayBuffer.isView(u)&&ArrayBuffer.isView(a)){if((c=u.length)!=a.length)return!1;for(s=c;0!==s--;)if(u[s]!==a[s])return!1;return!0}if(u.constructor===RegExp)return u.source===a.source&&u.flags===a.flags;if(u.valueOf!==Object.prototype.valueOf&&'function'==typeof u.valueOf&&'function'==typeof a.valueOf)return u.valueOf()===a.valueOf();if(u.toString!==Object.prototype.toString&&'function'==typeof u.toString&&'function'==typeof a.toString)return u.toString()===a.toString();if((c=(l=Object.keys(u)).length)!==Object.keys(a).length)return!1;for(s=c;0!==s--;)if(!Object.prototype.hasOwnProperty.call(a,l[s]))return!1;if(t&&u instanceof Element)return!1;for(s=c;0!==s--;)if(('_owner'!==l[s]&&'__v'!==l[s]&&'__o'!==l[s]||!u.$$typeof)&&!i(u[l[s]],a[l[s]]))return!1;return!0}return u!=u&&a!=a}m.exports=function(t,n){try{return i(t,n)}catch(t){if((t.message||'').match(/stack|recursion/i))return console.warn('react-fast-compare cannot handle circular refs'),!1;throw t}}},368,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),(function(t,o){for(var s in o)Object.defineProperty(t,s,{enumerable:!0,get:Object.getOwnPropertyDescriptor(o,s).get})})(e,{get DrawerActions(){return u},get DrawerRouter(){return y}});const t=r(d[0]),o=r(d[1]),s=r(d[2]),n=r(d[3]),c=r(d[4]),u={...t.TabActions,openDrawer:()=>({type:'OPEN_DRAWER'}),closeDrawer:()=>({type:'CLOSE_DRAWER'}),toggleDrawer:()=>({type:'TOGGLE_DRAWER'})};const y=(0,o.extendRouter)(t.TabRouter,function({baseRouter:o,options:{defaultStatus:y="closed",backBehavior:R="firstRoute",initialRouteName:A}}){const f=o=>(0,t.ensureStateHistory)(o,R,A),p=t=>Boolean(t.history?.some(t=>'drawer'===t.type)),E=t=>p(t)?t:{...t,history:[...t.history??[],{type:'drawer',status:'open'===y?'closed':'open'}]},l=t=>p(t)?{...t,history:(t.history??[]).filter(t=>'drawer'!==t.type)}:t,w=t=>'open'===y?l(t):E(t),O=t=>'open'===y?E(t):l(t);return{getBrowserHistoryForAction(t,n,c){switch(c.type){case'OPEN_DRAWER':case'CLOSE_DRAWER':case'TOGGLE_DRAWER':return(0,s.getBrowserHistoryForHistoryChange)(f(t),n);case'PUSH':case'NAVIGATE':case'JUMP_TO':if(p(t)&&('history'===R||'fullHistory'===R)&&t.routes[t.index]?.key!==n.routes[n.index]?.key)return}return o.getBrowserHistoryForAction?.(t,n,c)},getBrowserHistoryForRouteFocus:(t,o,n)=>!p(t)||p(o)||'push'!==n?.type&&t.routes[t.index]?.key===o.routes[o.index]?.key?(0,s.getBrowserHistoryForHistoryChange)(f(t),o):{type:'replace'},getStateForRouteFocus(t,s){const n=o.getStateForRouteFocus(f(t),s);return O(n)},getStateForAction(t,s,u){const y=f(t),R=y.routes[y.index]?.key;switch(s.type){case'OPEN_DRAWER':return{state:w(y),affectedRouteKey:R};case'CLOSE_DRAWER':return{state:O(y),affectedRouteKey:R};case'TOGGLE_DRAWER':return p(y)?{state:l(y),affectedRouteKey:R}:{state:E(y),affectedRouteKey:R};case'PUSH':case'REPLACE':case'JUMP_TO':case'NAVIGATE':{const t=o.getStateForAction(y,s,u);if((0,c.isActionHandled)(t)){const o=t.state;return o.index===y.index?t:{...t,state:O(o)}}return n.RouterActionHandling.Unhandled}case'GO_BACK':return p(y)?{state:l(y),affectedRouteKey:R}:o.getStateForAction(y,s,u);default:return o.getStateForAction(y,s,u)}},actionCreators:u}},{type:'drawer'})},369,[370,363,373,362,366]); +__d(function(g,_r,_i,a,m,e,d){"use strict";function t(){const r=c(_r(d[0]));return t=function(){return r},r}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,r){for(var o in r)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(r,o).get})})(e,{get TabActions(){return x},get TabRouter(){return I},get ensureStateHistory(){return N}});const r=_r(d[1]),o=_r(d[2]),n=_r(d[3]),s=_r(d[4]),i=_r(d[5]),u=_r(d[6]),y=_r(d[7]),l=_r(d[8]);function c(t){return t&&t.__esModule?t:{default:t}}const f='route';function p(t){const r=t.routes[t.index];if(!r?.isPreloaded)return t;const{isPreloaded:o,...n}=r,s=[...t.routes];return s[t.index]=n,{...t,routes:s}}function h(t,r){if(r===t.key)return t;const{state:o,...n}=t;return n}const k=(t,r,o,n)=>{if(t.length>0||0===r.length)return t;const s=void 0!==o&&r.includes(o)?o:r[0];return[{name:s,key:n(s)}]},R=(t,r,o)=>{const n=t.findIndex(t=>t.name===r);return-1!==n?{routes:t,index:n}:{routes:[...t,o()],index:t.length}},x={jumpTo:(t,r)=>({type:'JUMP_TO',payload:{name:t,params:r}}),replace:(t,r)=>({type:'REPLACE',payload:{name:t,params:r}})},A=(t,r,o,n)=>{if(0===t.length)return[];const s=[{type:f,key:t[r].key}];let i;switch(o){case'order':for(let o=r;o>0;o--)s.unshift({type:f,key:t[o-1].key});break;case'firstRoute':0!==r&&s.unshift({type:f,key:t[0].key});break;case'initialRoute':i=t.findIndex(t=>t.name===n),i=-1===i?0:i,r!==i&&s.unshift({type:f,key:t[i].key})}return s},H=(t,r)=>r.map(r=>t.find(t=>t.name===r)??{name:r,key:r}),N=(t,r,o)=>{if(null!=t.history)return t;const n=H(t.routes,t.routeNames),s=t.routes[t.index],i=n.findIndex(t=>t.key===s?.key),u=-1===i?void 0===s?[]:[{type:f,key:s.key}]:A(n,i,r,o);return'fullHistory'===r&&void 0!==s&&(u[u.length-1]={...u[u.length-1],params:s.params}),{...t,history:u}},E=(t,r,o,n)=>{if(0===t.routes.length)return{...t,index:-1,history:[]};let s=t.history;if('history'===o||'fullHistory'===o){const n=t.routes[r];if('history'===o)s=s.filter(t=>'route'===t.type&&t.key!==n.key);else if('fullHistory'===o){const t=s.findLastIndex(t=>'route'===t.type);n.key===s[t]?.key&&(s=[...s.slice(0,t),...s.slice(t+1)])}s=s.concat({type:f,key:n.key,params:'fullHistory'===o?n.params:void 0})}else{const i=H(t.routes,t.routeNames),u=i.findIndex(o=>o.key===t.routes[r].key);s=A(i,u,o,n)}return{...t,index:r,history:s}};const I=(0,i.extendRouter)(o.BaseRouter,function({baseRouter:o,nextKey:i,options:{initialRouteName:c,backBehavior:I="firstRoute"}}){const S=r=>{if('history'===I||'fullHistory'===I)return N(r,I,c);const o=[...N({...r,history:void 0},I,c).history,...r.history?.filter(t=>'route'!==t.type)??[]];return(0,t().default)(o,r.history)?r:{...r,history:o}},v=(t,r,o)=>{switch(o.type){case'PUSH':case'NAVIGATE':case'JUMP_TO':if(('history'===I||'fullHistory'===I)&&t.routes[t.index]?.key!==r.routes[r.index]?.key)return{type:'push'};break;case'GO_BACK':break;default:return}return(0,u.getBrowserHistoryForHistoryChange)(N(t,I,c),r)};return{normalizeState:p,getStateForDeclaredRoutes(t,n){const s=o.getStateForDeclaredRoutes(t,n);return null!=s.history&&(0,r.isArrayEqual)(s.routeNames,n)?s:S((0,r.isArrayEqual)(s.routeNames,n)?s:{...s,routeNames:n})},getBrowserHistoryForAction:v,getBrowserHistoryForRouteFocus:(t,r)=>v(t,r,{type:'JUMP_TO'}),getStateForRouteFocus(t,r){const o=N(t,I,c),n=o.routes.findIndex(t=>t.key===r);return-1===n||n===o.index?o:E(o,n,I,c)},getStateForAction(t,u,p){const{routeGetIdList:x}=p,v=N(t,I,c);if(u.target&&u.target!==v.key)return y.RouterActionHandling.Unhandled;switch(u.type){case'ROUTE_NAMES_CHANGED':{const t=u.payload.routeNames;if((0,r.isArrayEqual)(v.routeNames,t))return{state:S(v),affectedRouteKey:v.routes[v.index]?.key};const o=k(v.routes.filter(r=>t.includes(r.name)),t,c,i);if(0===o.length)return{state:{...v,routeNames:t,routes:o,index:-1,history:[]},affectedRouteKey:void 0};const n=v.routes[v.index]?.key,s=o.findIndex(t=>t.key===n),y=Math.max(s,0),l=o.map(t=>t.key);let p=v.history.filter(t=>'route'!==t.type||l.includes(t.key));if(-1===s&&('history'===I||'fullHistory'===I)){const t=o[y],r=p.filter(t=>'route'!==t.type);let n=p.filter(t=>'route'===t.type);'history'===I?n=n.filter(r=>r.key!==t.key):n[n.length-1]?.key===t.key&&(n=n.slice(0,-1)),p=[...n,{type:f,key:t.key,params:'fullHistory'===I?t.params:void 0},...r]}if('firstRoute'===I||'initialRoute'===I||'order'===I){const r=H(o,t),n=r.findIndex(t=>t.key===o[y].key);p=[...A(r,n,I,c),...p.filter(t=>'route'!==t.type)]}else p.some(t=>'route'===t.type)||(p=[...A(o,y,I,c),...p.filter(t=>'route'!==t.type)]);return{state:S({...v,history:p,routeNames:t,routes:o,index:y}),affectedRouteKey:o[y].key}}case'PUSH':case'REPLACE':case'JUMP_TO':case'NAVIGATE':{if(!v.routeNames.includes(u.payload.name))return y.RouterActionHandling.Unhandled;const{routes:t,index:r}=R(v.routes,u.payload.name,()=>{const t=(0,s.createRouteFromAction)({action:u,key:i(u.payload.name)});return'NAVIGATE'===u.type&&null!=u.payload.path?{...t,path:u.payload.path}:t}),o=E({...v,routes:t.map(t=>{if(t.name!==u.payload.name)return t;const r=x[t.name],o=r?.({params:t.params}),s=r?.({params:u.payload.params}),y=o===s?t.key:i(t.name);let l;l='NAVIGATE'===u.type&&u.payload.merge&&o===s?void 0!==u.payload.params?{...t.params,...u.payload.params}:t.params:u.payload.params;const c='NAVIGATE'===u.type&&null!=u.payload.path?u.payload.path:t.path,f=l!==t.params||c!==t.path?{...h(t,y),key:y,path:c,params:l}:t;return(0,n.attachRouteState)(f,u)})},r,I,c),l='REPLACE'===u.type?P(v,o):o;return{state:l,affectedRouteKey:l.routes[l.index]?.key}}case'SET_PARAMS':case'REPLACE_PARAMS':{const t=o.getStateForAction(v,u,p);if((0,l.isActionHandled)(t)){const r=t.state,o=r.index;if(null!=o){const n=r.routes[o],s=v.history.findLastIndex(t=>t.key===n.key);let i=v.history;return-1!==s&&(i=[...v.history],i[s]={...i[s],params:n.params}),{...t,state:{...r,history:i}}}}return t}case'GO_BACK':{if('none'===I)return y.RouterActionHandling.Unhandled;const t=v.routes[v.index];if(!t)return y.RouterActionHandling.Unhandled;let r;if('firstRoute'===I)r=v.routeNames[0];else if('initialRoute'===I)r=void 0!==c&&v.routeNames.includes(c)?c:v.routeNames[0];else if('order'===I){const o=v.routeNames.indexOf(t.name);r=o>0?v.routeNames[o-1]:void 0}if(void 0!==r&&r!==t.name){const{routes:t,index:o}=R(v.routes,r,()=>({name:r,key:i(r)}));if(t!==v.routes){const r=E({...v,routes:t},o,I,c);return{state:r,affectedRouteKey:r.routes[r.index]?.key}}}if(1===v.history.length)return y.RouterActionHandling.Unhandled;const o=v.history[v.history.length-2],n=o?.key,s=v.routes.findLastIndex(t=>t.key===n);if(-1===s)return y.RouterActionHandling.Unhandled;let u=v.routes;return'fullHistory'===I&&u[s].params!==o.params&&(u=[...v.routes],u[s]={...u[s],params:o.params}),{state:{...v,routes:u,history:v.history.slice(0,-1),index:s},affectedRouteKey:u[s].key}}case'PRELOAD':{if(!v.routeNames.includes(u.payload.name))return y.RouterActionHandling.Unhandled;const t=v.routes.findIndex(t=>t.name===u.payload.name);let r,o,l;if(-1===t){const t=(0,n.attachRouteState)({...(0,s.createRouteFromAction)({action:u,key:i(u.payload.name)}),isPreloaded:!0},u);l=[...v.routes,t],r=t.key}else{const s=v.routes[t],y=x[s.name],c=y?.({params:s.params}),f=y?.({params:u.payload.params}),p=c===f?s.key:i(s.name),k=u.payload.params,R=(0,n.attachRouteState)(k!==s.params?{...h(s,p),key:p,params:k,...p!==s.key&&{isPreloaded:!0}}:s,u);o=p===s.key?void 0:s.key,l=v.routes.map((r,o)=>o===t?R:r),r=R.key}let p=v.history;if('history'===I||'fullHistory'===I){if(void 0!==o){const r=l[t],n=p.findLastIndex(t=>t.type===f&&t.key===o);p=p.map((t,s)=>t.type===f&&t.key===o?{...t,key:r.key,params:'fullHistory'===I&&s===n?r.params:t.params}:t)}}else{const t=H(l,v.routeNames),r=l[v.index]?.key,o=t.findIndex(t=>t.key===r);p=[...-1===o?[]:A(t,o,I,c),...p.filter(t=>'route'!==t.type)]}return{state:{...v,routes:l,history:p},affectedRouteKey:r}}default:{const t=o.getStateForAction(v,u,p);return(0,l.isActionHandled)(t)?{...t,state:N(t.state,I,c)}:t}}},actionCreators:x}},{type:'tab'});function P(t,r){const o=t.routes[t.index]?.key,n=r.routes[r.index]?.key;if(!o||o===n)return r;const s=r.history.findLastIndex(t=>t.key===o);return-1===s?r:{...r,history:r.history.filter((t,r)=>r!==s)}}},370,[368,371,360,367,372,363,373,362,366]); +__d(function(g,r,i,_a,m,e,d){"use strict";function t(t,n){return t===n||t.length===n.length&&t.every((t,u)=>Object.is(t,n[u]))}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"isArrayEqual",{enumerable:!0,get:function(){return t}})},371,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function t({action:t,key:n}){const{name:o,params:c}=t.payload;return{key:n,name:o,params:c}}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"createRouteFromAction",{enumerable:!0,get:function(){return t}})},372,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"getBrowserHistoryForHistoryChange",{enumerable:!0,get:function(){return o}});const t=t=>t.history?.filter(o=>'route'!==o.type||t.routes.some(t=>t.key===o.key)).length??0;function o(o,n){const u=t(n)-t(o);return u>0?{type:'push'}:u<0?{type:'pop',count:-u,target:{navigatorKey:n.key,routeKey:n.routes[n.index].key}}:void 0}},373,[]); +__d(function(g,_r,_i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),(function(t,o){for(var n in o)Object.defineProperty(t,n,{enumerable:!0,get:Object.getOwnPropertyDescriptor(o,n).get})})(e,{get StackActions(){return y},get StackRouter(){return f},get getStackBrowserHistoryAction(){return l},get getStackRoutes(){return i}});const t=_r(d[0]),o=_r(d[1]),n=_r(d[2]),r=_r(d[3]),s=_r(d[4]),p=_r(d[5]);function i(t){return{activeRoutes:t.routes.slice(0,t.index+1),preloadedRoutes:t.routes.slice(t.index+1)}}function u(t){let o=!1;const n=t.routes.map((n,r)=>{if(r>t.index)return n.isPreloaded?n:(o=!0,{...n,isPreloaded:!0});if(n.isPreloaded){o=!0;const{isPreloaded:t,...r}=n;return r}return n});return o?{...t,routes:n}:t}function c(t,o,n=i(t).preloadedRoutes){const r=new Set(o.map(t=>t.key));return{...t,index:o.length-1,routes:o.concat(n.filter(t=>!r.has(t.key)))}}function l(t,o,n){switch(n.type){case'NAVIGATE':if(!(n.payload&&'pop'in n.payload&&n.payload.pop))return o.routes[o.index]?.key!==t.routes[t.index]?.key?{type:'push'}:void 0;break}const r=o.index-t.index;return r>0?{type:'push'}:r<0?{type:'pop',count:-r,target:{navigatorKey:o.key,routeKey:o.routes[o.index].key}}:void 0}const y={replace:(t,o)=>({type:'REPLACE',payload:{name:t,params:o}}),push:(t,o)=>({type:'PUSH',payload:{name:t,params:o}}),pop:(t=1)=>({type:'POP',payload:{count:t}}),popToTop:()=>({type:'POP_TO_TOP'}),popTo:(t,o,n)=>('boolean'==typeof n&&console.warn("Passing a boolean as the third argument to 'popTo' is deprecated. Pass '{ merge: true }' instead."),{type:'POP_TO',payload:{name:t,params:o,merge:'boolean'==typeof n?n:n?.merge}})};const f=(0,s.extendRouter)(o.BaseRouter,function({baseRouter:o,nextKey:s,options:{initialRouteName:f}}){const h={normalizeState:u,getBrowserHistoryForAction:l,getBrowserHistoryForRouteFocus:(t,o)=>l(t,o,{type:'POP'}),getStateForDeclaredRoutes(t,n){const r=o.getStateForDeclaredRoutes(t,n);if(r===t||0===r.routes.length)return r;const s=new Set(n),p=i(t).activeRoutes.filter(t=>s.has(t.name)).length;return{...r,index:Math.max(0,p-1)}},getStateForRouteFocus(t,o){const{activeRoutes:n}=i(t),r=n.findIndex(t=>t.key===o);return-1===r||r===t.index?t:{...t,index:r,routes:n.slice(0,r+1).concat(t.routes.slice(t.index+1))}},getStateForAction(o,u,l){const{activeRoutes:y,preloadedRoutes:k}=i(o);switch(u.type){case'ROUTE_NAMES_CHANGED':{const n=u.payload.routeNames;if((0,t.isArrayEqual)(o.routeNames,n))return{state:o,affectedRouteKey:y[o.index]?.key};const r=y.filter(t=>n.includes(t.name)),p=k.filter(t=>n.includes(t.name));if(0===r.length){const t=void 0!==f&&n.includes(f)?f:n[0],o=p.findIndex(o=>o.name===t),i=-1===o?{key:s(t),name:t}:p[o];r.push(i)}const i={...c(o,r,p),routeNames:n};return{state:i,affectedRouteKey:i.routes[i.index]?.key}}case'REPLACE':{const t=u.target===o.key&&u.source?y.findIndex(t=>t.key===u.source):o.index;if(-1===t)return p.RouterActionHandling.Unhandled;if(!o.routeNames.includes(u.payload.name))return p.RouterActionHandling.Unhandled;const i=l.routeGetIdList[u.payload.name],f=i?.({params:u.payload.params});let h=k.find(t=>t.name===u.payload.name&&f===i?.({params:t.params}));return h||(h=(0,r.createRouteFromAction)({action:u,key:s(u.payload.name)})),h=(0,n.attachRouteState)(h,u),{state:{...c(o,y.map((o,n)=>n===t?h:o),k.filter(t=>t.key!==h.key))},affectedRouteKey:h.key}}case'PUSH':case'NAVIGATE':{if(!o.routeNames.includes(u.payload.name))return p.RouterActionHandling.Unhandled;const t=l.routeGetIdList[u.payload.name],r=t?.({params:u.payload.params});let i,f,h;if(void 0!==r)i=y.findLast(o=>o.name===u.payload.name&&r===t?.({params:o.params}));else if('NAVIGATE'===u.type){const t=y[o.index];u.payload.name===t.name?i=t:u.payload.pop&&(i=y.findLast(t=>t.name===u.payload.name))}if(i||(i=k.find(o=>o.name===u.payload.name&&r===t?.({params:o.params}))),i&&(i=(0,n.attachRouteState)(i,u)),f='NAVIGATE'===u.type&&u.payload.merge&&i?void 0!==u.payload.params?{...i.params,...u.payload.params}:i.params:u.payload.params,i)if('NAVIGATE'===u.type&&u.payload.pop){h=[];for(const t of y){if(t.key===i.key){h.push({...i,path:void 0!==u.payload.path?u.payload.path:i.path,params:f});break}h.push(t)}h.some(t=>t.key===i.key)||h.push({...i,path:void 0!==u.payload.path?u.payload.path:i.path,params:f})}else h=y.filter(t=>t.key!==i.key),h.push({...i,path:'NAVIGATE'===u.type&&void 0!==u.payload.path?u.payload.path:i.path,params:f});else h=[...y,(0,n.attachRouteState)({key:s(u.payload.name),name:u.payload.name,path:'NAVIGATE'===u.type?u.payload.path:void 0,params:f},u)];const R=h[h.length-1].key;return{state:{...c(o,h,k.filter(t=>R!==t.key))},affectedRouteKey:R}}case'REMOVE_ROUTES':{const t=y[o.index],n=y.filter(o=>o.key===t.key||!u.payload.routeNames.includes(o.name)),r=k.filter(t=>!u.payload.routeNames.includes(t.name));return n.length===y.length&&r.length===k.length?{state:o,affectedRouteKey:t.key}:{state:c(o,n,r),affectedRouteKey:t.key}}case'POP':{const t=u.target===o.key&&u.source?y.findIndex(t=>t.key===u.source):o.index;if(t>0){const n=Math.max(t-u.payload.count+1,1),r=c(o,y.slice(0,n).concat(y.slice(t+1)));return{state:r,affectedRouteKey:r.routes[r.index]?.key}}return p.RouterActionHandling.Unhandled}case'POP_TO_TOP':return h.getStateForAction(o,{type:'POP',payload:{count:o.index}},l);case'POP_TO':{const t=u.target===o.key&&u.source?y.findLastIndex(t=>t.key===u.source):o.index;if(-1===t)return p.RouterActionHandling.Unhandled;if(!o.routeNames.includes(u.payload.name))return p.RouterActionHandling.Unhandled;let i=-1;const f=l.routeGetIdList[u.payload.name],h=f?.({params:u.payload.params});if(void 0!==h)i=y.findIndex(t=>t.name===u.payload.name&&h===f?.({params:t.params}));else if(y[t].name===u.payload.name)i=t;else for(let o=t;o>=0;o--)if(y[o].name===u.payload.name){i=o;break}if(-1===i){let p=k.find(t=>t.name===u.payload.name&&h===f?.({params:t.params}));p||(p=(0,r.createRouteFromAction)({action:u,key:s(u.payload.name)})),p=(0,n.attachRouteState)(p,u);return{state:{...c(o,y.slice(0,t).concat(p),k.filter(t=>t.key!==p.key))},affectedRouteKey:p.key}}const R=(0,n.attachRouteState)(y[i],u);let A;return A=u.payload.merge?void 0!==u.payload.params?{...R.params,...u.payload.params}:R.params:u.payload.params,{state:c(o,[...y.slice(0,i),A!==R.params?{...R,params:A}:R]),affectedRouteKey:R.key}}case'GO_BACK':return o.index>0?h.getStateForAction(o,{type:'POP',payload:{count:1},target:u.target,source:u.source},l):p.RouterActionHandling.Unhandled;case'PRELOAD':{const t=l.routeGetIdList[u.payload.name],p=t?.({params:u.payload.params});let i;if(void 0!==p&&(i=y.find(o=>o.name===u.payload.name&&p===t?.({params:o.params}))),i)return{state:{...o,routes:o.routes.map(t=>t.key!==i?.key?t:(0,n.attachRouteState)({...t,params:u.payload.params},u))},affectedRouteKey:i.key};{const i=(0,n.attachRouteState)((0,r.createRouteFromAction)({action:u,key:s(u.payload.name)}),u);return{state:{...c(o,y,k.filter(o=>o.name!==u.payload.name||p!==t?.({params:o.params})).concat(i))},affectedRouteKey:i.key}}}default:return p.RouterActionHandling.Delegate}},actionCreators:y};return h},{type:'stack'})},374,[371,360,367,372,363,362]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}function n(){const t=r(d[1]);return n=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get ImperativeRoutingQueueBridge(){return b},get NavigationPendingContext(){return v},get PendingIntentsContext(){return l},get RoutingQueueApiContext(){return f},get RoutingQueueProvider(){return h},get useEnqueueRoutingIntent(){return x},get useSetRoutingTransitionMode(){return R}});const o=r(d[2]),u=r(d[3]),s=r(d[4]),c=[];const p=()=>{throw new Error('Attempted to navigate from a component rendered outside the Expo Router root. Render the component inside `ExpoRoot`. If this happened inside `ExpoRoot`, please report a bug at https://github.com/expo/expo/issues.')},f=(0,n().createContext)(void 0),l=(0,n().createContext)(c),v=(0,n().createContext)(!1);function h({children:o}){const[p,h]=(0,n().useState)(c),[x,R]=(0,n().useTransition)(),[b,P]=(0,n().useState)(u.getDefaultTransitionMode),j=(0,n().useMemo)(()=>({enqueue:t=>{const n={...t,actionId:(0,s.markActionEnqueuedAndReturnId)()};h(t=>[...t,n])},dequeue:t=>h(n=>{const o=new Set(t),u=n.filter(t=>!o.has(t));return 0===u.length?c:u}),startTransition:R,transitionMode:b,setTransitionMode:P}),[R,b]);return(0,t().jsx)(f.Provider,{value:j,children:(0,t().jsx)(v.Provider,{value:x||p.length>0,children:(0,t().jsx)(l.Provider,{value:p,children:o})})})}function x(){const t=(0,n().use)(f);return void 0===t?p:t.enqueue}function R(){const t=(0,n().use)(f);return void 0===t?p:t.setTransitionMode}function b({enqueue:t,setTransitionMode:n}){return(0,o.useClientLayoutEffect)(()=>(Object.assign(u.router,(0,u.createImperativeRouter)(t,n)),()=>{Object.assign(u.router,u.unboundRouter)}),[t,n]),null}},375,[24,30,376,299,377]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=u(r(d[0]));return t=function(){return n},n}function n(t){if("function"!=typeof WeakMap)return null;var u=new WeakMap,o=new WeakMap;return(n=function(t){return t?o:u})(t)}function u(t,u){if(!u&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var o=n(u);if(o&&o.has(t))return o.get(t);var f={__proto__:null},c=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var p in t)if("default"!==p&&Object.prototype.hasOwnProperty.call(t,p)){var l=c?Object.getOwnPropertyDescriptor(t,p):null;l&&(l.get||l.set)?Object.defineProperty(f,p,l):f[p]=t[p]}return f.default=t,o&&o.set(t,f),f}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"useClientLayoutEffect",{enumerable:!0,get:function(){return o}});const o='undefined'!=typeof document||'undefined'!=typeof navigator&&'ReactNative'===navigator.product?t().useLayoutEffect:t().useEffect},376,[30]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"markActionEnqueuedAndReturnId",{enumerable:!0,get:function(){return u}});const n=r(d[0]);let t=0;function u(){const u=++t;return(0,n.mark)('expo-router:action-enqueued',{actionId:u}),u}},377,[378]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),(function(n,t){for(var o in t)Object.defineProperty(n,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(t,o).get})})(e,{get isEnabled(){return n.isEnabled},get mark(){return t},get unstable_PerformanceObserver(){return c},get unstable_enablePerformanceIntegration(){return n.unstable_enablePerformanceIntegration},get unstable_performance(){return o}});const n=r(d[0]);function t(t,o){if((0,n.isEnabled)())try{performance.mark?.(t,{detail:o})}catch{}}const o=globalThis.performance,c=globalThis.PerformanceObserver},378,[379]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get isEnabled(){return o},get unstable_enablePerformanceIntegration(){return n}});let t=!1;function n(){t=!0}function o(){return t}},379,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}function n(){const t=x(r(d[1]));return n=function(){return t},t}function o(){const t=r(d[2]);return o=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"NavigationContainer",{enumerable:!0,get:function(){return P}});const u=r(d[3]),s=r(d[4]),l=r(d[5]),c=r(d[6]),f=r(d[7]),h=r(d[8]),p=r(d[9]),v=r(d[10]);function x(t){return t&&t.__esModule?t:{default:t}}function S({initialState:o,linking:u,routeNode:l,containerRef:h,ref:p,...v}){const x='object'==typeof(S=o)&&null!==S&&'then'in S&&'function'==typeof S.then?n().default.use(o):o;var S;if(n().default.useImperativeHandle(p,()=>h.current),n().default.useEffect(()=>{h.current&&REACT_NAVIGATION_DEVTOOLS.set(h.current,{get linking(){return{...u,prefixes:u?.prefixes??[],getStateFromPath:u?.getStateFromPath??f.getStateFromPath,getPathFromState:u?.getPathFromState??c.getPathFromState}}})}),void 0===x)throw new Error('Linking did not produce an initial navigation state. Expo Router always seeds a complete initial state before rendering the navigation container, so this is most likely a bug in expo-router. Please report it at https://github.com/expo/expo/issues.');return(0,t().jsx)(s.BaseNavigationContainer,{...v,initialState:x,UNSTABLE_routeNode:l,ref:h})}globalThis.REACT_NAVIGATION_DEVTOOLS=new WeakMap;const P=function({direction:s=(o().I18nManager.getConstants().isRTL?'rtl':'ltr'),theme:c=l.DefaultTheme,linking:f,fallback:x=null,ref:P,...k}){const N=n().default.use(u.RouterConfigContext);f?.config&&(0,v.validatePathConfig)(f.config);const T=n().default.useRef(null);(0,h.useBackButton)(T);const{getInitialState:_}=(0,p.useLinking)(T,{prefixes:[],...f}),b=n().default.useMemo(()=>({options:f}),[f]),[C]=n().default.useState(_);return(0,t().jsx)(n().default.Suspense,{fallback:(0,t().jsx)(l.ThemeProvider,{value:c,children:x}),children:(0,t().jsx)(l.LocaleDirContext.Provider,{value:s,children:(0,t().jsx)(l.LinkingContext.Provider,{value:b,children:(0,t().jsx)(S,{...k,initialState:C,linking:f,theme:c,routeNode:N?.routeNode??void 0,containerRef:T,ref:P})})})})}},380,[24,30,33,381,382,427,412,414,687,688,413]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"RouterConfigContext",{enumerable:!0,get:function(){return n}});const n=(0,t().createContext)(null)},381,[30]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}function n(){const t=G(r(d[1]));return n=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"BaseNavigationContainer",{enumerable:!0,get:function(){return L}});const o=r(d[2]),s=r(d[3]),u=r(d[4]),c=r(d[5]),l=r(d[6]),f=r(d[7]),v=r(d[8]),p=r(d[9]),h=r(d[10]),x=r(d[11]),y=r(d[12]),C=r(d[13]),R=T(r(d[14])),j=r(d[15]),N=r(d[16]),O=r(d[17]),P=r(d[18]),w=r(d[19]),E=r(d[20]),M=r(d[21]),S=(r(d[22]),r(d[23]),r(d[24])),b=r(d[25]),_=r(d[26]),k=r(d[27]),I=r(d[28]),B=r(d[29]);function T(t){return t&&t.__esModule?t:{default:t}}function A(t){if("function"!=typeof WeakMap)return null;var n=new WeakMap,o=new WeakMap;return(A=function(t){return t?o:n})(t)}function G(t,n){if(!n&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var o=A(n);if(o&&o.has(t))return o.get(t);var s={__proto__:null},u=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var c in t)if("default"!==c&&Object.prototype.hasOwnProperty.call(t,c)){var l=u?Object.getOwnPropertyDescriptor(t,c):null;l&&(l.get||l.set)?Object.defineProperty(s,c,l):s[c]=t[c]}return s.default=t,o&&o.set(t,s),s}function L(T){const{ref:A,initialState:G,UNSTABLE_routeNode:L,theme:W,children:D}=T,F=(0,n().use)(E.NavigationStateContext),q=(0,n().use)(v.RouteInfoContext),H=(0,n().use)(p.RouterConfigContext),Q=(0,n().use)(x.RoutingQueueApiContext),U=(0,n().use)(x.NavigationPendingContext),Z=(0,n().use)(f.GlobalRoutesWithRemovalPreventedContext);if(!F.isDefault)throw new Error("Looks like you have nested a 'NavigationContainer' inside another. Normally you need only one container at the root of the app, so this was probably an error. If you need to render an isolated navigation tree inside a screen, install '@react-navigation/native' and use its NavigationContainer instead.");if(void 0===Q||void 0===Z)throw new Error('The navigation container requires the shared routing state provided by `ExpoRoot`. Render the navigation container inside `ExpoRoot`.');const z=(0,I.useEventEmitter)(),[J,K]=n().useState(()=>new Map),{state:V,isWaitingForLayouts:X,report:Y,consumeReportEvents:$,resetNavigator:ee,handleAction:te,processIntent:ne}=(0,y.useNavigationTreeReducer)({initialState:G,routeNode:L,registry:J,routesWithRemovalPrevented:Z,linking:H?.linking,redirects:H?.redirects}),[re]=n().useState(c.createBrowserHistoryAdapter);(0,C.useNavigationTreeReportEvents)(Y,$,re);const oe=n().useMemo(()=>({register(t,n){K(o=>o.get(t)===n?o:new Map(o).set(t,n))},unregister(t,n){K(o=>{if(o.get(t)!==n)return o;const s=new Map(o);return s.delete(t),s})}}),[]),{listeners:ie,addListener:ae}=(0,_.useChildListeners)(),se=(0,R.default)(t=>{null==ie.focus[0]?console.error(S.NOT_INITIALIZED_ERROR):ie.focus[0](n=>n.dispatch(t))}),ue=(0,R.default)(t=>{te(t)}),de=(0,R.default)(()=>{if(null==ie.focus[0])return!1;const{result:t,handled:n}=ie.focus[0](t=>t.canGoBack());return!!n&&t}),ce=(0,R.default)(()=>V),le=(0,N.getFocusedCanGoBack)(V),fe=(0,R.default)(()=>{const t=ce();if(null==t)return;return(0,o.findFocusedRoute)(t)}),{addOptionsGetter:ve,getCurrentOptions:ge}=(0,B.useOptionsGetters)({}),pe=n().useMemo(()=>({...Object.keys(j.CommonActions).reduce((t,n)=>(t[n]=(...t)=>se(j.CommonActions[n](...t)),t),{}),...z.create('root'),dispatch:se,dispatchSync:ue,isFocused:()=>!0,canGoBack:de,getParent:()=>{},getState:ce,getRootState:ce,getCurrentRoute:fe,getCurrentOptions:ge,isReady:()=>!0,setOptions:()=>{throw new Error('Cannot call setOptions outside a screen')}}),[de,se,ue,z,ge,fe,ce]);n().useImperativeHandle(A,()=>pe,[pe]);const he=n().useMemo(()=>({addListener:ae,handleAction:te,resetNavigator:ee}),[ae,te,ee]),xe=n().useMemo(()=>({state:V,addOptionsGetter:ve}),[V,ve]),ye=n().useMemo(()=>L?(0,l.getRouteInfoFromState)(V):q,[V,L,q]),[Ce,Re]=n().useState(ye);return(0,l.areUrlObjectsEqual)(Ce,ye)||Re(ye),n().useEffect(()=>{ce()},[ce,V]),(0,k.useClientLayoutEffect)(()=>{z.emit({type:'state',data:{state:V}})},[z,V]),(0,t().jsx)(w.NavigationContainerRefContext.Provider,{value:pe,children:(0,t().jsx)(P.NavigationBuilderContext.Provider,{value:he,children:(0,t().jsx)(E.NavigationStateContext.Provider,{value:xe,children:(0,t().jsx)(v.RouteInfoContext.Provider,{value:Ce,children:(0,t().jsxs)(M.RootNavigationStateContext.Provider,{value:V,children:[(0,t().jsx)(N.CanGoBackContext,{value:le,children:(0,t().jsx)(h.RouterRegistrySettersContext.Provider,{value:oe,children:(0,t().jsx)(O.EnsureSingleNavigator,{children:(0,t().jsx)(x.NavigationPendingContext,{value:U||X,children:(0,t().jsx)(b.ThemeProvider,{value:W,children:D})})})})}),(0,t().jsx)(x.ImperativeRoutingQueueBridge,{enqueue:Q.enqueue,setTransitionMode:Q.setTransitionMode}),(0,t().jsx)(u.RoutingQueueDrainer,{processIntent:ne}),(0,t().jsx)(s.BrowserHistorySync,{adapter:re})]})})})})})}},382,[24,30,383,384,385,386,387,392,394,381,395,375,396,684,400,358,425,462,455,439,456,423,685,686,357,447,457,376,468,465]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(t){let n=t;for(;null!=n?.routes[n.index??0]?.state;)n=n.routes[n.index??0].state;const u=n?.routes[n?.index??0];return u}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"findFocusedRoute",{enumerable:!0,get:function(){return t}})},383,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function n(){const t=r(d[0]);return n=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"BrowserHistorySync",{enumerable:!0,get:function(){return u}});const t=r(d[1]);function u({adapter:u}){const o=(0,t.useEnqueueRoutingIntent)();return(0,n().useEffect)(()=>u.listen(n=>{o({type:'BROWSER_HISTORY_CHANGED',payload:n})}),[u,o]),null}},384,[30,375]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=u(r(d[0]));return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get RoutingQueueDrainer(){return f},get shouldUseTransition(){return c}});const n=r(d[1]);function o(t){if("function"!=typeof WeakMap)return null;var n=new WeakMap,u=new WeakMap;return(o=function(t){return t?u:n})(t)}function u(t,n){if(!n&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var u=o(n);if(u&&u.has(t))return u.get(t);var c={__proto__:null},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var f in t)if("default"!==f&&Object.prototype.hasOwnProperty.call(t,f)){var l=s?Object.getOwnPropertyDescriptor(t,f):null;l&&(l.get||l.set)?Object.defineProperty(c,f,l):c[f]=t[f]}return c.default=t,u&&u.set(t,c),c}function c(t,n){return'never'!==n&&(!t.some(t=>!1===t.inTransition)&&('always'===n||t.every(t=>!0===t.inTransition||s(t))))}function s(t){return'NAVIGATE_TO_HREF'===t.type&&'PRELOAD'===t.payload.options.event}function f({processIntent:o}){const u=t().use(n.PendingIntentsContext),{dequeue:s,startTransition:f,transitionMode:l}=t().use(n.RoutingQueueApiContext),p=t().useRef(void 0);return t().useEffect(()=>{if(0===u.length||p.current===u)return;p.current=u,s(u);const t=c(u,l),n=()=>{for(const n of u)try{o(n,t)}catch(t){const o='object'==typeof t&&null!=t&&'message'in t?t.message:t;console.warn(`An error occurred when trying to handle navigation action ${JSON.stringify(n)}: ${o}`)}};t?f(n):n()},[s,u,o,f,l]),null}},385,[30,375]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const t=window.history.state?.id,{pathname:n,search:o,hash:s}=window.location;return{id:'string'==typeof t?t:null,path:n+o+s}}function n(){const n=[],o=(t,n)=>{window.history.replaceState({id:t},'',n)};let s=Promise.resolve();return{apply:t=>{s=s.then(()=>{switch(t.op){case'push':return p=t.entryId,c=t.path,void(window.history.state?.id!==p?window.history.pushState({id:p},'',c):window.history.replaceState({id:p},'',c));case'replace':return void o(t.entryId,t.path);case'go':return 0===(s=t.delta)?Promise.resolve():new Promise(t=>{const o=()=>{clearTimeout(p),window.removeEventListener('popstate',c);const s=n.indexOf(o);s>-1&&n.splice(s,1),t()};n.push(o);const p=setTimeout(o,100),c=()=>o();window.addEventListener('popstate',c),window.history.go(s)})}var s,p,c})},listen:o=>{const s=()=>{n.length||o(t())};return window.addEventListener('popstate',s),()=>window.removeEventListener('popstate',s)}}}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"createBrowserHistoryAdapter",{enumerable:!0,get:function(){return n}})},386,[]); +__d(function(g,r,i,_a,m,e,d){"use strict";function t(){const a=u(r(d[0]));return t=function(){return a},a}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,a){for(var n in a)Object.defineProperty(t,n,{enumerable:!0,get:Object.getOwnPropertyDescriptor(a,n).get})})(e,{get areUrlObjectsEqual(){return c},get defaultRouteInfo(){return f},get getRouteInfoFromState(){return l},get getRouteSegmentsFromState(){return h}});const a=r(d[1]),n=r(d[2]),s=r(d[3]),o=r(d[4]),p=r(d[5]);function u(t){return t&&t.__esModule?t:{default:t}}const f={unstable_globalHref:'',searchParams:new URLSearchParams,pathname:'/',params:{},segments:[],pathnameWithParams:'/',isIndex:!1};function c(a,n){return a.pathname===n.pathname&&a.pathnameWithParams===n.pathnameWithParams&&a.unstable_globalHref===n.unstable_globalHref&&(0,o.isArrayEqual)(a.segments,n.segments)&&(0,t().default)(a.params,n.params)}function l(t){if(!t)return f;const o='index'in t?t.index??0:0,p=t.routes[o];if((0,s.warnIfNestedParams)(p.params),p.name===a.NOT_FOUND_ROUTE_NAME||p.name===a.SITEMAP_ROUTE_NAME){const t=p.path||(p.name===a.NOT_FOUND_ROUTE_NAME?'/':`/${p.name}`);return{...f,unstable_globalHref:(0,n.appendBaseUrl)(t),pathname:t,pathnameWithParams:t,segments:[p.name]}}if(p.name!==a.INTERNAL_SLOT_NAME)throw new Error(`Expected the first route to be ${a.INTERNAL_SLOT_NAME}, but got ${p.name}`);const{segments:u,params:c}=N(p.state),l=_(c),{pathname:h,pathParams:O}=E(u,l),{searchParams:A,pathnameWithParams:P}=b(h,l,O);return{segments:u,pathname:h,params:l,unstable_globalHref:(0,n.appendBaseUrl)(P),searchParams:A,pathnameWithParams:P,isIndex:!1}}function h(t){if(!t)return[];const n='index'in t?t.index??0:0;let o=t.routes[n];if((0,s.warnIfNestedParams)(o.params),o.name===a.NOT_FOUND_ROUTE_NAME||o.name===a.SITEMAP_ROUTE_NAME)return[o.name];if(o.name!==a.INTERNAL_SLOT_NAME)throw new Error(`Expected the first route to be ${a.INTERNAL_SLOT_NAME}, but got ${o.name}`);const p=[];for(t=o.state;t;){o=t.routes['index'in t&&t.index?t.index:0],(0,s.warnIfNestedParams)(o.params);const a=o.name.startsWith('/')?o.name.slice(1):o.name;p.push(...a.split('/')),t=o.state}return'index'===p[p.length-1]&&p.pop(),p}function N(t){const a=[],n=Object.create(null);for(;t;){const o=t.routes['index'in t&&t.index?t.index:0];(0,s.warnIfNestedParams)(o.params),Object.assign(n,o.params);let p=o.name;p.startsWith('/')&&(p=p.slice(1)),a.push(...p.split('/')),t=o.state}return'index'===a[a.length-1]&&a.pop(),{segments:a,params:n}}function _(t){return Object.fromEntries(Object.entries(t).map(([t,a])=>'string'==typeof a?[t,(0,p.safeDecodeURIComponent)(a)]:Array.isArray(a)?[t,a.map(t=>'string'==typeof t?(0,p.safeDecodeURIComponent)(t):t)]:[t,a]))}function E(t,a){const n=t.filter(t=>!(t.startsWith('(')&&t.endsWith(')'))).map(t=>{if('+not-found'===t){const t=a['not-found'];return void 0===t?{parts:[],paramName:'not-found'}:Array.isArray(t)?{parts:t.map(String),paramName:'not-found'}:{parts:[String(t)],paramName:'not-found'}}if(t.startsWith('[...')&&t.endsWith(']')){let n=t.slice(4,-1);n.endsWith('?')&&(n=n.slice(0,-1));const s=a[n];return{parts:Array.isArray(s)?s.filter(O).map(String):O(s)&&s?[String(s)]:[],paramName:n}}if(t.startsWith('[')&&t.endsWith(']')){const n=t.slice(1,-1),s=a[n];return{parts:O(s)&&s?[String(s)]:[],paramName:n}}return{parts:[t]}});return{pathname:'/'+n.flatMap(({parts:t})=>t).join('/'),pathParams:new Set(n.map(({paramName:t})=>t).filter(t=>void 0!==t))}}function b(t,a,n){const s=new URLSearchParams(Object.entries(a).flatMap(([t,a])=>n.has(t)?[]:Array.isArray(a)?a.filter(O).map(a=>[t,String(a)]):O(a)?[[t,String(a)]]:[]));let o;s.has('#')&&(o=s.get('#')||void 0,s.delete('#'));const p=s.toString();let u=p?t+'?'+p:t;return u=o?u+'#'+o:u,{searchParams:s,pathnameWithParams:u}}function O(t){return null==t||'object'!=typeof t}},387,[368,295,388,391,371,355]); +__d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var i in n)Object.defineProperty(t,i,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,i).get})})(e,{get appendBaseUrl(){return o},get appendQueryAndHash(){return s},get fixCurrentParams(){return i},get getParamName(){return c},get getPathWithConventionsCollapsed(){return u},get isDynamicPart(){return p}});const t=r(d[0]),n=r(d[1]);function i(t,n,i){const s=Object.fromEntries(Object.entries(n.params).flatMap(([t,n])=>void 0===n?[]:[[t,i?.[t]?i[t](n):Array.isArray(n)?n.map(String):String(n)]]));return Object.assign(t,s),s}function s(t,{'#':i,...s}){const o=(0,n.stringifySearchParams)(s);return o&&(t+=`?${o}`),i&&(t+=`#${i}`),t}function o(t,n="/wildings/chef-app"){return n?`/${n.replace(/^\/+/,'').replace(/\/$/,'')}${t}`:t}function u({pattern:n,route:i,params:s,preserveGroups:o,preserveDynamicRoutes:u,shouldEncodeURISegment:p=!0,initialRouteName:f}){const h=n.split('/');return h.map((n,y)=>{const v=c(n);if(n.startsWith('*'))return u?'not-found'===v?'+not-found':`[...${v}]`:s[v]?Array.isArray(s[v])?s[v].join('/'):s[v]:i.name.startsWith('[')&&i.name.endsWith(']')||'*not-found'===n?'':i.name;if(n.startsWith(':')){if(u)return`[${v}]`;const t=s[v];if(void 0===t&&n.endsWith('?'))return;return(p?l(t):t)??'undefined'}return o||null==(0,t.matchGroupName)(n)?p?l(n,{preserveBrackets:!0}):n:h.length-1===y&&f?'index'===($=f)||null!=(0,t.matchGroupName)($)||null!=(0,t.matchDynamicName)($)?'':p?l(f,{preserveBrackets:!0}):f:'';var $}).map(t=>t??'').join('/')}const c=t=>t.replace(/^[:*]/,'').replace(/\?$/,'');function p(t){return t.startsWith(':')||t.startsWith('*')}function l(t,{preserveBrackets:n=!1}={}){return t=String(t).replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]/g,t=>encodeURIComponent(t)),n&&(t=t.replace(/%5B/g,'[').replace(/%5D/g,']')),t}},388,[389,390]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var u in n)Object.defineProperty(t,u,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,u).get})})(e,{get VALID_PLATFORMS(){return n},get getContextKey(){return h},get getNameFromFilePath(){return p},get getPlatformFromFilePath(){return f},get isTypedRoute(){return $},get matchArrayGroupName(){return l},get matchDynamicName(){return u},get matchGroupName(){return c},get matchLastGroupName(){return s},get removeFileSystemDots(){return v},get removeFileSystemExtensions(){return F},get removeSupportedExtensions(){return y},get stripGroupSegmentsFromPath(){return P},get stripInvisibleSegmentsFromPath(){return x},get testNotFound(){return o}});const t=/^\[([^[\]]+?)\]$/,n=new Set(['android','ios','native','web']);function u(n){const u=n.match(t)?.[1];return null==u?void 0:u.startsWith('...')?{name:u.slice(3),deep:!0}:{name:u,deep:!1}}function o(t){return/\+not-found$/.test(t)}function c(t){return t.match(/^(?:[^\\()])*?\(([^\\/]+)\)/)?.[1]}function s(t){return t.match(/.*(?:\/|^)\(([^\\/]+)\)[^\s]*$/)?.[1]}function l(t){return t.match(/(?:[^\\()])*?\(([^\\/]+,[^\\/]+)\)/)?.[1]}function p(t){return y(v(t))}function f(t){const u=p(t).split('/').pop(),o=u.lastIndexOf('.');if(o<0)return;const c=u.slice(o+1);return n.has(c)?c:void 0}function h(t){const n=p(t),u=f(t),o='/'+(u?n.slice(0,-(u.length+1)):n);return o.endsWith('_layout')?o.replace(/\/?_layout$/,''):o}function y(t){return t.replace(/(\+api)?\.[jt]sx?$/g,'')}function F(t){return t.replace(/\.[jt]sx?$/g,'')}function v(t){return t.replace(/^(?:\.\.?\/)+/g,'')}function P(t){return t.split('/').reduce((t,n)=>(null==c(n)&&t.push(n),t),[]).join('/')}function x(t){return P(t).replace(/(^|\/)index$/,'')}function $(t){return!t.startsWith('+')&&null===t.match(/(_layout|[^/]*?\+[^/]*?)\.[tj]sx?$/)}},389,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function n(n){const t=new URLSearchParams;for(const[o,c]of Object.entries(n))if(Array.isArray(c))for(const n of c)void 0!==n&&t.append(o,null===n?'':String(n));else void 0!==c&&t.append(o,null===c?'':String(c));return t.toString()}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"stringifySearchParams",{enumerable:!0,get:function(){return n}})},390,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var _ in n)Object.defineProperty(t,_,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,_).get})})(e,{get INTERNAL_EXPO_ROUTER_GESTURE_ENABLED_OPTION_NAME(){return E},get INTERNAL_EXPO_ROUTER_IS_PREVIEW_NAVIGATION_PARAM_NAME(){return n},get INTERNAL_EXPO_ROUTER_NO_ANIMATION_PARAM_NAME(){return t},get INTERNAL_EXPO_ROUTER_PREVIEW_ID_PARAM_NAME(){return u},get INTERNAL_EXPO_ROUTER_ZOOM_TRANSITION_SCREEN_ID_PARAM_NAME(){return o},get INTERNAL_EXPO_ROUTER_ZOOM_TRANSITION_SOURCE_ID_PARAM_NAME(){return _},get appendInternalExpoRouterParams(){return A},get getInternalExpoRouterParams(){return c},get hasParam(){return I},get removeInternalExpoRouterParams(){return f},get removeParams(){return s},get warnIfNestedParams(){return O},get warnIfScreenParam(){return N}});const t='__internal_expo_router_no_animation',n='__internal__expo_router_is_preview_navigation',_='__internal_expo_router_zoom_transition_source_id',o='__internal_expo_router_zoom_transition_screen_id',u='__internal_expo_router_preview_id',E='internal_gestureEnabled',R=[t,n,_,o,u];new WeakSet,new WeakSet;function N(t){}function O(t){}function A(t,n){const _={...t,...n};if(0!==Object.keys(_).length||void 0!==t)return _}function c(t){const n={},_=t||{};for(const t of R)t in _&&(n[t]=_[t]);return n}function I(t,n){if(t&&'object'==typeof t){if(void 0!==t[n])return!0}return!1}function s(t,n){if(t)return Object.fromEntries(Object.entries(t).filter(([t])=>!n.includes(t)))}function f(t){if(t)return s(t,R)}},391,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}function n(){const t=l(r(d[1]));return n=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get GlobalRemovalEventEmitterRegistryContext(){return v},get GlobalRoutesWithRemovalPreventedContext(){return s},get PreventRemovalProvider(){return j},get RemovalPreventionProvider(){return R},get ScreenRemovalPreventionSetterContext(){return p},get useRoutesWithRemovalPrevented(){return x}});const o=r(d[2]),u=r(d[3]);function c(t){if("function"!=typeof WeakMap)return null;var n=new WeakMap,o=new WeakMap;return(c=function(t){return t?o:n})(t)}function l(t,n){if(!n&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var o=c(n);if(o&&o.has(t))return o.get(t);var u={__proto__:null},l=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if("default"!==s&&Object.prototype.hasOwnProperty.call(t,s)){var f=l?Object.getOwnPropertyDescriptor(t,s):null;f&&(f.get||f.set)?Object.defineProperty(u,s,f):u[s]=t[s]}return u.default=t,o&&o.set(t,u),u}const s=(0,n().createContext)(void 0),f=(0,n().createContext)(null),v=(0,n().createContext)(null),p=(0,n().createContext)(void 0);function P({children:o}){const u=n().useRef(new Map),c=(0,n().useMemo)(()=>({registerRouteEmitter(t,n){u.current.set(t,n)},unregisterRouteEmitter(t,n){queueMicrotask(()=>{u.current.get(t)===n&&u.current.delete(t)})},emitRemovalEvent(t,n,o){u.current.get(t)?.(n,o)}}),[]);return(0,t().jsx)(v.Provider,{value:c,children:o})}function y({children:o}){const[u,c]=(0,n().useState)(()=>new Map),l=n().useCallback((t,n,o)=>{c(u=>{const c=u.get(t)??new Set;if(c.has(n)===o)return u;const l=new Set(c);o?l.add(n):l.delete(n);const s=new Map(u);return l.size>0?s.set(t,l):s.delete(t),s})},[]),v=(0,n().useMemo)(()=>new Set(u.keys()),[u]);return(0,t().jsx)(f.Provider,{value:l,children:(0,t().jsx)(s.Provider,{value:v,children:o})})}function R({children:n}){return(0,t().jsx)(P,{children:(0,t().jsx)(y,{children:n})})}function b(t,o){const c=(0,n().use)(v),l=n().useCallback((n,u)=>o?.(t,n,u),[o,t]);(0,u.useClientLayoutEffect)(()=>{if(o&&c)return c.registerRouteEmitter(t,l),()=>c.unregisterRouteEmitter(t,l)},[o,c,l,t])}function h(t){const u=(0,n().use)(f),c=(0,n().use)(p),l=(0,n().use)(o.IsPreloadedContext);return n().useCallback((n,o,s=!1)=>{l&&!s||(u?.(t,n,o),c?.(`${t}:${n}`,o,s))},[l,c,u,t])}function j({routeKey:n,emitRemovalEvent:o,children:u}){b(n,o);const c=h(n);return(0,t().jsx)(p.Provider,{value:c,children:u})}function x(){return(0,n().use)(s)??w}const w=new Set},392,[24,30,393,376]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"IsPreloadedContext",{enumerable:!0,get:function(){return n}});const n=(0,t().createContext)(!1)},393,[30]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"RouteInfoContext",{enumerable:!0,get:function(){return o}});const n=r(d[1]),o=(0,t().createContext)(n.defaultRouteInfo)},394,[30,387]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get RouterRegistrySettersContext(){return o},get useRegisterRouter(){return u}});const n=r(d[1]),o=(0,t().createContext)(void 0);function u(u,c){const s=(0,t().use)(o);(0,n.useClientLayoutEffect)(()=>{if(void 0!==s)return s.register(u,c),()=>s.unregister(u,c)},[c,s,u])}},395,[30,376]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}function n(){const t=A(r(d[1]));return n=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get replaceNavigationState(){return k},get useNavigationTreeReducer(){return P}});const o=r(d[2]),s=r(d[3]),u=r(d[4]),c=r(d[5]),l=O(r(d[6])),y=r(d[7]),f=r(d[8]),p=r(d[9]),v=r(d[10]),h=r(d[11]),N=r(d[12]);function O(t){return t&&t.__esModule?t:{default:t}}function S(t){if("function"!=typeof WeakMap)return null;var n=new WeakMap,o=new WeakMap;return(S=function(t){return t?o:n})(t)}function A(t,n){if(!n&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var o=S(n);if(o&&o.has(t))return o.get(t);var s={__proto__:null},u=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var c in t)if("default"!==c&&Object.prototype.hasOwnProperty.call(t,c)){var l=u?Object.getOwnPropertyDescriptor(t,c):null;l&&(l.get||l.set)?Object.defineProperty(s,c,l):s[c]=t[c]}return s.default=t,o&&o.set(t,s),s}const T=(0,t().nanoid)(),E=new Set(['ROUTE_NAMES_CHANGED']);function R(t,n,s){if('RESUME'===n.type){if(!t.deferred)return t;const o=new Set(n.failed);return t.deferred.operations.reduce((t,n)=>_(t,n,s,o),{...t,deferred:void 0})}if('BROWSER_HISTORY_CHANGED'===n.type){const{commitedTreeResult:o,...u}=n;return _(t=o?{...o,eventSeq:t.eventSeq,deferred:void 0}:{...t,deferred:void 0},u,s)}if('deferrable'in n&&n.deferrable)return _(t,n,s);const{value:u,missing:c}=(0,o.collectMissingLayouts)(()=>w(t,n,s));return c.length,u}function _(t,n,s,u){const c=n.deferrable?.inTransition??!1;if(t.deferred){const{operations:o,missing:s}=t.deferred;return{...t,deferred:{operations:[...o,n],missing:s,inTransition:t.deferred.inTransition&&c}}}const{value:l,missing:y}=(0,o.collectMissingLayouts)(()=>w(t,n,s),u);return 0===y.length?l:{...t,deferred:{operations:[n],missing:y,inTransition:c}}}function w(t,n,o){if('BROWSER_HISTORY_CHANGED'===n.type){if(!t.history)return t;const s=(0,y.restoreNavigationFromBrowser)(t.history,t,n.payload,o,(t,s)=>I(t,{...s,actionId:n.actionId},o));return K({...s.result,history:s.history},s.events)}const s=I({...t,browserHistoryAction:void 0},n,o);if(s.state===t.state||!s.history)return s;const u='NAVIGATOR_UNMOUNTED'===n.type||'NAVIGATOR_CHANGED'===n.type?(0,y.updateCurrentHistoryEntry)(s.history,s.state,o):(0,y.applyRouterHistoryAction)(s.history,s.state,o,s.browserHistoryAction);return K({...s,history:u.history},u.events)}function I(t,n,o){const s=t.state;switch(n.type){case'NAVIGATE_TO_HREF':{const{href:u,options:c}=n.payload;let l;try{l=(0,p.getNavigateAction)(u,c,o,c.event,c.withAnchor,c.dangerouslySingular,c.__internal__PreviewKey,s)}catch(o){const s='object'==typeof o&&null!=o&&'message'in o?o.message:o;return console.warn(`An error occurred when trying to handle navigation action ${JSON.stringify(n)}: ${s}`),t}if('invalid'===l.status){const o=n.payload.originalHref??l.href;return console.warn(`Could not generate a valid navigation state for the given path: ${o}`),t}return I(t,{type:'ACTION',payload:{action:l.action},actionId:n.actionId},o)}case'COMPUTED_ACTION':{let u;try{u=n.payload.compute(s,o.registry)}catch(o){const s='object'==typeof o&&null!=o&&'message'in o?o.message:o;return console.warn(`An error occurred when trying to handle navigation action ${JSON.stringify(n)}: ${s}`),t}return u?I(t,{type:'ACTION',payload:{action:u,originKey:n.payload.originKey},actionId:n.actionId},o):t}case'ACTION':{const c=(0,v.indexNavigationTree)(s),l=(0,v.resolveOrigin)(c.rootNode,c.nodes,o.registry,n.payload.originKey);if(!l)return b(t,n.payload.action);const y=(0,v.reduceNavigationTree)(n.payload.action,o.registry,{origin:l,tree:c});if(!y.handled)return b(t,n.payload.action);const p=o.routeNode?(0,f.completeNavigationState)(y.nextState,o.routeNode):y.nextState;if(p===s)return t;const h=C(s,p),N=E.has(n.payload.action.type)?[]:h.filter(t=>o.routesWithRemovalPrevented.has(t)),O=N.length>0?s:(0,u.deepFreeze)(p),S=N.length>0?[{type:'prevented-routes',routeKeys:N,action:n.payload.action}]:[...h.length>0?[{type:'removed-routes',routeKeys:h,action:n.payload.action}]:[],...'PRELOAD'===n.payload.action.type&&void 0!==y.affectedRouteKey?[{type:'route-preloaded',routeKey:y.affectedRouteKey,state:O}]:[],{type:'action-dispatched',action:n.payload.action,state:O,actionId:n.actionId}];return K({...t,state:O,browserHistoryAction:y.browserHistory},S)}case'NAVIGATOR_UNMOUNTED':{if(o.registry.has(n.stateKey)||!(0,N.findStateByKey)(s,n.stateKey))return t;const l=(0,f.createSeededNavigationState)(void 0,n.routeNode,(0,c.getChainFromStateKey)(n.stateKey)),y=k(s,n.stateKey,l),p=o.routeNode?(0,f.completeNavigationState)(y,o.routeNode):y;return{...t,state:(0,u.deepFreeze)(p)}}case'NAVIGATOR_CHANGED':{const c=(0,N.findStateByKey)(s,n.stateKey);if(!c)return t;const l=(0,N.resetNavigatorState)(c,n.routerType),y=k(s,n.stateKey,l),p=o.routeNode?(0,f.completeNavigationState)(y,o.routeNode):y;return{...t,state:(0,u.deepFreeze)(p)}}case'REPORT_CONSUMED':{if(!t.report)return t;const o=new Set(n.eventIds),s=t.report.events.filter(t=>!o.has(t.id));return s.length===t.report.events.length?t:{...t,report:s.length>0?{events:s}:void 0}}}}function b(t,n){return t}function K(t,n){if(0===n.length)return t;const o=n.map((n,o)=>({...n,id:t.eventSeq+o}));return{...t,report:{events:t.report?[...t.report.events,...o]:o},eventSeq:t.eventSeq+o.length}}function P({initialState:t,routeNode:c,registry:f,routesWithRemovalPrevented:p=H,linking:v,redirects:N}){const O={registry:f,routesWithRemovalPrevented:p,routeNode:c,linking:v,redirects:N,browserHistoryIdPrefix:`${T}:${n().useId()}`},[S,A]=n().useReducer((t,n)=>R(t,n,O),t,t=>{if(M(t),null==t)throw new Error('The navigation container is missing its initial state. Expo Router always seeds a complete initial state before rendering the navigation container, so this is most likely a bug in expo-router. Please report it at https://github.com/expo/expo/issues.');const n=(0,u.deepFreeze)(t),o=(0,y.createBrowserHistory)(n,O);return K({state:n,report:void 0,eventSeq:0,history:o.history},o.events)}),[E,_]=n().useState(f);if(E!==f){_(f);for(const[t,n]of E)!f.has(t)&&n.routeNode&&A({type:'NAVIGATOR_UNMOUNTED',stateKey:t,routeNode:n.routeNode})}const w=(0,l.default)((t,n)=>{const o='object'==typeof t.payload&&null!==t.payload?t.payload:void 0,u=o&&'params'in o&&'object'==typeof o.params&&null!==o.params?o.params:void 0;(0,s.warnIfScreenParam)(u),A({type:'ACTION',payload:{action:t,originKey:n},actionId:(0,h.markActionEnqueuedAndReturnId)()})}),I=(0,l.default)((t,n)=>{A({type:'NAVIGATOR_CHANGED',stateKey:t,routerType:n})}),b=(0,l.default)(t=>{A({type:'REPORT_CONSUMED',eventIds:t})}),P=(0,l.default)((t,n=!1)=>{const o={inTransition:n};'BROWSER_HISTORY_CHANGED'!==t.type?A({...t,deferrable:o}):A({...t,commitedTreeResult:S,deferrable:o})}),C=n().useEffectEvent(t=>{const o=()=>A({type:'RESUME',failed:t});S.deferred?.inTransition?n().startTransition(o):o()}),D=S.deferred?.missing;return n().useEffect(()=>{if(!D)return;let t=!1;return(0,o.loadLayouts)(D).then(n=>{t||C(n)}),()=>{t=!0}},[D]),n().useInsertionEffect(()=>{S.state},[S.state]),{state:S.state,isWaitingForLayouts:void 0!==S.deferred,report:S.report,consumeReportEvents:b,resetNavigator:I,handleAction:w,processIntent:P}}const H=new Set;function C(t,n){const o=new Set;D(n,!0,t=>o.add(t));const s=[];return D(t,!0,t=>{o.has(t)||s.push(t)}),s}function D(t,n,o){const s=n?t.routes.filter(t=>!t.isPreloaded):t.routes;for(let t=s.length-1;t>=0;t--){const u=s[t];!1===u.state?.stale&&D(u.state,n,o),o(u.key)}}function M(t){if(void 0===t)return;const n='index'in t?t.index:void 0,o='routeNames'in t?t.routeNames:void 0,s='routeKeySeq'in t?t.routeKeySeq:void 0;if(!('stale'in t)||!1!==t.stale||!('key'in t)||'string'!=typeof t.key||!Number.isInteger(n)||!Number.isInteger(s)||s<0||!Array.isArray(o)||t.routes.some(t=>!('key'in t)||'string'!=typeof t.key||!o?.includes(t.name))||(0===t.routes.length?-1!==n:n<0||n>=t.routes.length))throw new Error('The navigation container received an incomplete initial state. Expo Router always seeds a complete initial state with valid `key`, `routeKeySeq`, `index`, `routeNames`, route keys, and `stale: false` at every level, so this is most likely a bug in expo-router. Please report it at https://github.com/expo/expo/issues.');for(const n of t.routes)M(n.state)}function k(t,n,o){if(t.key===n)return o;let s=!1;const u=t.routes.map(t=>{if(!1!==t.state?.stale)return t;const u=k(t.state,n,o);return u===t.state?t:(s=!0,{...t,state:u})});return s?{...t,routes:u}:t}},396,[397,30,398,391,399,365,400,401,402,417,683,377,454]); +__d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"nanoid",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"customAlphabet",{enumerable:!0,get:function(){return t}});let t=(t,n=21)=>(o=n)=>{let u='',l=0|o;for(;l-- >0;)u+=t[Math.random()*t.length|0];return u},n=(t=21)=>{let n='',o=0|t;for(;o-- >0;)n+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[64*Math.random()|0];return n}},397,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get collectMissingLayouts(){return u},get getLayoutAnchor(){return o},get loadLayouts(){return s},get withLoadedLayouts(){return y}});const t=new WeakMap;let n;function o(o){if('layout'!==o.type)return;if(t.has(o))return t.get(o);if(n?.skipped.has(o))return;const u=h(o);if(u instanceof Promise)return void n?.missing.add(o);const s=p(o,u?.unstable_settings);return t.set(o,s),s}function u(t,o=new Set){const u=n,s=new Set;n={missing:s,skipped:o};try{return{value:t(),missing:[...s]}}finally{n=u}}async function s(t){const n=await Promise.all(t.map(c));return t.filter((t,o)=>!n[o])}async function c(t){try{return await h(t),!0}catch(t){return!1}}const f=new WeakMap,l=new WeakMap;function h(t){if(f.has(t))return f.get(t);const n=l.get(t);if(n)return n;const o=t.loadRoute();if('object'!=typeof(u=o)||null===u||!('then'in u)||'function'!=typeof u.then)return o;var u;const s=Promise.resolve(o).then(n=>(f.set(t,n),l.delete(t),n),n=>{throw l.delete(t),n});return s.catch(()=>{}),l.set(t,s),s}function y(t,n=new Set){const{value:o,missing:c}=u(t,n);return 0===c.length?o:s(c).then(o=>y(t,new Set([...n,...o])))}function p(t,n){const o=t.groupName,u=w(n),s=o?w(n?.[o]):void 0,c=s??u;if(!c)return;const f=t.children.find(t=>t.route===c)??t.children.find(t=>t.route===`${c}/index`);if(!f)throw new Error(`The initial route name "${c}"${s?` for group "${o}"`:''} was not found in the layout at "${t.contextKey}". Available routes are: ${t.children.map(({route:t})=>`"${t}"`).join(', ')}. Set \`unstable_settings.anchor\` to the name of a route in this layout.`);return f.route}function w(t){if(t)try{return t.anchor??t.initialRouteName}catch(t){if(t instanceof Error&&!t.message.match(/You cannot dot into a client module/))throw t;return}}},398,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),(function(t,o){for(var n in o)Object.defineProperty(t,n,{enumerable:!0,get:Object.getOwnPropertyDescriptor(o,n).get})})(e,{get deepFreeze(){return o},get isPlainObject(){return t}});const t=t=>'object'==typeof t&&null!==t&&Object.getPrototypeOf(t)===Object.prototype,o=t=>t},399,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=u(r(d[0]));return t=function(){return n},n}function n(t){if("function"!=typeof WeakMap)return null;var u=new WeakMap,o=new WeakMap;return(n=function(t){return t?o:u})(t)}function u(t,u){if(!u&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var o=n(u);if(o&&o.has(t))return o.get(t);var f={__proto__:null},c=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var p in t)if("default"!==p&&Object.prototype.hasOwnProperty.call(t,p)){var l=c?Object.getOwnPropertyDescriptor(t,p):null;l&&(l.get||l.set)?Object.defineProperty(f,p,l):f[p]=t[p]}return f.default=t,o&&o.set(t,f),f}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return f}});const o='undefined'!=typeof document||'undefined'!=typeof navigator&&'ReactNative'===navigator.product?t().useInsertionEffect:t().useEffect;function f(n){const u=t().useRef(n),f=t().useRef(function(...t){return u.current.apply(this,t)}).current;return o(()=>{u.current=n},[n]),f}},400,[30]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get applyRouterHistoryAction(){return y},get createBrowserHistory(){return c},get restoreNavigationFromBrowser(){return P},get updateCurrentHistoryEntry(){return v}});const t=r(d[0]),n=r(d[1]),o=r(d[2]),s=r(d[3]),u=r(d[4]);function c(t,n){const s=`${n.browserHistoryIdPrefix}:0`,u=(0,o.getPathForState)(t,n.linking);return{history:{entries:[{id:s,path:u,state:t}],index:0,idPrefix:n.browserHistoryIdPrefix,entrySeq:1},events:[p(s,u)]}}function p(t,n){return{type:'browser-history',op:'replace',entryId:t,path:n}}function y(t,n,s,u){const c=(0,o.getPathForState)(n,s.linking);if('push'===u?.type)return f(t,n,c,'push');if('pop'===u?.type){return x(t,h(t,u),n,c)}return x(t,t.index,n,c)}function f(t,n,o,s){const u=`${t.idPrefix}:${t.entrySeq}`,c=[...t.entries.slice(0,t.index+1),{id:u,path:o,state:n}];return{history:{...t,entries:c,index:c.length-1,entrySeq:t.entrySeq+1},events:[{type:'browser-history',op:s,entryId:u,path:o}]}}function h(t,n){const o=Math.max(0,t.index-n.count),{target:s}=n;if(!s)return o;const u=t.entries.findLastIndex((n,o)=>o=t.entries.length)throw new Error(`Invalid browser history index ${n} for ${t.entries.length} entries.`);const u=[...t.entries];return u[n]={...u[n],path:s,state:o},{...t,entries:u,index:n}}function v(t,n,o){return y(t,n,o)}function P(t,n,o,s,u){const c=t.entries.find(t=>t.id===o.id);return c?b(t,c,n,o,s,u):N(t,n,o,s,u)}function b(t,n,s,u,c,y){const f=t.entries.indexOf(n),h=n.path===u.path?y(s,w(n.state)):k(t,n.path,s,u.path,c,y);if(h.state===s.state)return{result:h,history:t,events:f===t.index?[]:[{type:'browser-history',op:'go',delta:t.index-f}]};const l=(0,o.getPathForState)(h.state,c.linking);return{result:h,history:S(t,f,h.state,l),events:l===u.path?[]:[p(n.id,l)]}}function w(t){return{type:'ACTION',payload:{action:{type:'RESET',payload:t,target:t.key}}}}function k(t,n,o,s,u,c){if(I(s)===I(n))return c(o,{type:'NAVIGATE_TO_HREF',payload:{href:s,options:{event:'NAVIGATE'}}});return c(o,w(O(s,o.state,u)??t.entries[0].state))}function I(t){const n=t.indexOf('#');return-1===n?t:t.slice(0,n)}function O(c,p,y){const f=(0,o.resolvePathLinking)(y.linking).getStateFromPath(c,y.linking?.config,(0,s.getRouteSegmentsFromState)(p)),h=(0,u.getRootStackRouteNames)();if(f&&f.routes.every(t=>h.includes(t.name)))return y.routeNode?(0,n.createSeededRootState)(f,y.routeNode):(0,n.completeParsedState)(f,t.ROOT_CHAIN)}function N(t,n,s,u,c){const y=k(t,t.entries[t.index].path,n,s.path,u,c),h=(0,o.getPathForState)(y.state,u.linking);return null===s.id?{result:y,...f(t,y.state,h,'replace')}:{result:y,history:{...t,entries:[{id:s.id,path:h,state:y.state}],index:0},events:[p(s.id,h)]}}},401,[365,402,411,387,407]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get completeNavigationState(){return y},get completeParsedState(){return h},get createSeededNavigationState(){return N},get createSeededRootState(){return l}});const t=r(d[0]),n=r(d[1]),o=r(d[2]),u=r(d[3]),s=r(d[4]),c=r(d[5]);function l(t,o){return v({targetState:t,routeNames:(0,c.getRootStackRouteNames)(),initialRouteName:void 0,anchorParams:void 0,parentChain:u.ROOT_CHAIN,findChildNode:t=>t===n.INTERNAL_SLOT_NAME?o:void 0})}function y(t,o){return S(t,(0,c.getRootStackRouteNames)(),u.ROOT_CHAIN,t=>t===n.INTERNAL_SLOT_NAME?o:void 0)}function h(t,n){if(!t)return;const o=t.key??(0,u.createNavigatorStateKey)(n),s=(0,u.createRouteKeyMinter)({key:o,routeKeySeq:t.routeKeySeq??0}),c=t.routes.map(t=>{const n=t.key??s.mint(t.name);return{...t,key:n,...t.state?{state:h(t.state,(0,u.getChainFromRouteKey)(n))}:void 0}});return{...t,stale:!1,key:o,routeKeySeq:s.routeKeySeq,index:t.index??c.length-1,routeNames:t.routeNames??[...new Set(c.map(t=>t.name))],routes:c}}function N(n,o,u,c){const l=(0,s.getValidInitialRouteName)(o);return v({targetState:n,routeNames:[...o.children].sort((0,t.sortRoutesWithInitial)(l)).map(t=>t.route),initialRouteName:l,anchorParams:c,parentChain:u,findChildNode:t=>(0,s.findRouteNodeByName)(o,t)})}function S(n,o,c,l){const y=n.key??(0,u.createNavigatorStateKey)(c),h=(0,u.createRouteKeyMinter)({key:y,routeKeySeq:n.routeKeySeq??0});let v=!1;const p=n.routes.map(n=>{const o=l(n.name),c=n.key??h.mint(n.name),y=void 0===n.key?{...n,key:c}:n;if(void 0===n.key&&(v=!0),!o||0===o.children.length)return y;const p=(0,s.getValidInitialRouteName)(o),R=[...o.children].sort((0,t.sortRoutesWithInitial)(p)).map(t=>t.route),f=n.state?S(n.state,R,(0,u.getChainFromRouteKey)(c),t=>(0,s.findRouteNodeByName)(o,t)):N(void 0,o,(0,u.getChainFromRouteKey)(c));return f===n.state&&c===n.key?y:(v=!0,{...y,state:f})});return v||!1!==n.stale||void 0===n.key||n.routeKeySeq!==h.routeKeySeq||void 0===n.index||void 0===n.routeNames?{...n,stale:!1,key:y,routeKeySeq:h.routeKeySeq,index:n.index??p.length-1,routeNames:n.routeNames??o,routes:p}:n}function v({targetState:t,routeNames:n,initialRouteName:s,anchorParams:c,parentChain:l,findChildNode:y}){const h=(0,o.createInitialState)({routeNames:[],parentChain:l});let S=t?.routes??[];const v=S.find(t=>!n.includes(t.name));v&&(console.warn(`The initial navigation state contains the unknown route "${v.name}". The route is not registered by its navigator, so Expo Router will use the navigator's initial route instead. Check that your linking configuration only returns registered routes.`),S=[]);const R=p(S,n,s,c),f=(0,u.createRouteKeyMinter)(h),K=R.map(t=>{const n=f.mint(t.name),o=y(t.name),s=o&&o.children.length>0?N('state'in t?t.state:void 0,o,(0,u.getChainFromRouteKey)(n),'params'in t?t.params:void 0):void 0;return{key:n,name:t.name,...'path'in t?{path:t.path}:void 0,...'params'in t?{params:t.params}:void 0,...s?{state:s}:void 0}});let k=-1;if(S.length>0){k=K.length-S.length+(t?.index??S.length-1)}else K.length>0&&(k=0);return{...h,routeKeySeq:f.routeKeySeq,routeNames:n,index:k,routes:K}}function p(t,n,o,u){if(0===t.length){const t=o??n[0];return void 0===t?[]:[{name:t}]}return o&&!t.some(t=>t.name===o)?[{name:o,params:u},...t]:t}},402,[403,295,405,365,406,407]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}function n(){const t=r(d[1]);return n=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get LocalRouteParamsContext(){return f},get Route(){return v},get ScreenErrorBoundaryContext(){return l},get SuspenseFallbackContext(){return s},get sortRoutes(){return u.sortRoutes},get sortRoutesWithInitial(){return u.sortRoutesWithInitial},get useContextKey(){return C},get useRouteNode(){return x}});const o=r(d[2]),u=r(d[3]),c=(0,n().createContext)(null),s=(0,n().createContext)(void 0),l=(0,n().createContext)(void 0),f=(0,n().createContext)({});function x(){return(0,n().use)(c)}function C(){const t=x();if(null==t)throw new Error('No filename found. This is likely a bug in expo-router.');return(0,o.getContextKey)(t.contextKey)}function v({children:n,node:o,params:u}){return(0,t().jsx)(f.Provider,{value:u,children:(0,t().jsx)(c.Provider,{value:o,children:n})})}},403,[24,30,389,404]); +__d(function(g,r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),(function(n,t){for(var u in t)Object.defineProperty(n,u,{enumerable:!0,get:Object.getOwnPropertyDescriptor(t,u).get})})(e,{get sortRoutes(){return u},get sortRoutesWithInitial(){return o}});const n=r(d[0]);function t(n,t){return n.deep&&!t.deep?1:!n.deep&&t.deep?-1:0}function u(u,o){if(u.dynamic&&!o.dynamic)return 1;if(!u.dynamic&&o.dynamic)return-1;if(u.dynamic&&o.dynamic){if(u.dynamic.length!==o.dynamic.length)return o.dynamic.length-u.dynamic.length;for(let n=0;n{if(n){if(t.route===n)return-1;if(o.route===n)return 1}return u(t,o)}}},404,[389]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"createInitialState",{enumerable:!0,get:function(){return n}});const t=r(d[0]);function n({routeNames:n,initialRouteName:o,parentChain:u}){const c=void 0!==o&&n.includes(o)?o:n[0],s=[],y=(0,t.createNavigatorStateKey)(u),l=(0,t.createRouteKeyMinter)({key:y,routeKeySeq:0});return void 0!==c&&s.push({key:l.mint(c),name:c}),{stale:!1,key:y,routeKeySeq:l.routeKeySeq,index:s.length-1,routeNames:n,routes:s}}},405,[365]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get findRouteNodeAndParamsForState(){return o},get findRouteNodeByName(){return n},get getValidInitialRoute(){return u},get getValidInitialRouteName(){return c}});const t=r(d[0]);function n(t,n){return t?.children.find(t=>t.route===n)}function o(t,o){const u={};if(!o)return{routeNode:void 0,params:u};let c=t??void 0;for(;o;){const t=o.routes[o.index??o.routes.length-1];Object.assign(u,t?.params),c=n(c,t?.name),o=t?.state}return{routeNode:c,params:u}}function u(o){return o?n(o,(0,t.getLayoutAnchor)(o)):void 0}const c=n=>n?(0,t.getLayoutAnchor)(n):void 0},406,[398]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=u(r(d[0]));return t=function(){return n},n}function n(){const t=r(d[1]);return n=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get getRootStackRouteNames(){return l},get shouldAppendNotFound(){return s},get shouldAppendSitemap(){return c},get shouldReactToColorSchemeChanges(){return f},get useColorSchemeChangesIfNeeded(){return p}});const o=r(d[2]);function u(t){return t&&t.__esModule?t:{default:t}}function c(){const n=t().default.expoConfig?.extra?.router;return!1!==n?.sitemap}function s(){const n=t().default.expoConfig?.extra?.router;return!1!==n?.notFound}function f(){const n=t().default.expoConfig?.extra?.router;return!1!==n?.adaptiveColors}const p=f()?n().useColorScheme:function(){};function l(){const t=[o.INTERNAL_SLOT_NAME];return s()&&t.push(o.NOT_FOUND_ROUTE_NAME),c()&&t.push(o.SITEMAP_ROUTE_NAME),t}},407,[408,33,295]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"AppOwnership",{enumerable:!0,get:function(){return u.AppOwnership}}),Object.defineProperty(_e,"ExecutionEnvironment",{enumerable:!0,get:function(){return u.ExecutionEnvironment}}),Object.defineProperty(_e,"UserInterfaceIdiom",{enumerable:!0,get:function(){return u.UserInterfaceIdiom}}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return h}});var n=r(d[0]);r(d[1]);var t=e(r(d[2])),u=r(d[3]),l=e(r(d[4]));l.default||console.warn("No native ExponentConstants module found, are you sure the expo-constants's module is linked properly?");const o=(0,n.requireOptionalNativeModule)('ExpoUpdates');let s=null;if(o){let e;o.manifest?e=o.manifest:o.manifestString&&(e=JSON.parse(o.manifestString)),e&&Object.keys(e).length>0&&(s=e)}let f=null;if(t.default.EXDevLauncher){let e;t.default.EXDevLauncher.manifestString&&(e=JSON.parse(t.default.EXDevLauncher.manifestString)),e&&Object.keys(e).length>0&&(f=e)}let c=null;if(l.default&&l.default.manifest){const e=l.default.manifest;c='string'==typeof e?JSON.parse(e):e}let p=s??f??c;const{name:E,appOwnership:b,...x}=l.default||{},v={...x,appOwnership:b??null};function O(e){return!_(e)}function _(e){return'metadata'in e}function S(e=!1){if(!p){const e=null===p?'null':'undefined';if(x.executionEnvironment,u.ExecutionEnvironment.Bare,x.executionEnvironment===u.ExecutionEnvironment.StoreClient||x.executionEnvironment===u.ExecutionEnvironment.Standalone)throw new n.CodedError('ERR_CONSTANTS_MANIFEST_UNAVAILABLE',`Constants.manifest is ${e}, must be an object.`)}return p}Object.defineProperties(v,{__unsafeNoWarnManifest:{get(){const e=S(!0);return e&&O(e)?e:null},enumerable:!1},__unsafeNoWarnManifest2:{get(){const e=S(!0);return e&&_(e)?e:null},enumerable:!1},manifest:{get(){const e=S();return e&&O(e)?e:null},enumerable:!0},manifest2:{get(){const e=S();return e&&_(e)?e:null},enumerable:!0},expoConfig:{get(){const e=S(!0);return e?o&&o.isEmbeddedLaunch?c:_(e)?e.extra?.expoClient??null:O(e)?e:null:null},enumerable:!0},expoGoConfig:{get(){const e=S(!0);return e?_(e)?e.extra?.expoGo??null:O(e)?e:null:null},enumerable:!0},easConfig:{get(){const e=S(!0);return e?_(e)?e.extra?.eas??null:O(e)?e:null:null},enumerable:!0},__rawManifest_TEST:{get:()=>p,set(e){p=e},enumerable:!1}});var h=v},408,[301,122,112,409,410]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"AppOwnership",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"ExecutionEnvironment",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"UserInterfaceIdiom",{enumerable:!0,get:function(){return o}});var t=(function(t){return t.Expo="expo",t})({}),n=(function(t){return t.Bare="bare",t.Standalone="standalone",t.StoreClient="storeClient",t})({}),o=(function(t){return t.Handset="handset",t.Tablet="tablet",t.Desktop="desktop",t.TV="tv",t.Unsupported="unsupported",t})({})},409,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return s}});var n=r(d[0]);const t=(Date.now()+'-'+Math.floor(1e9*Math.random())).toString();function o(){if('undefined'!=typeof navigator&&'string'==typeof navigator.userAgent){const n=navigator.userAgent.toLowerCase();if(n.includes('edge'))return'Edge';if(n.includes('edg'))return'Chromium Edge';if(n.includes('opr')&&'opr'in window&&window.opr)return'Opera';if(n.includes('chrome')&&'chrome'in window&&window.chrome)return'Chrome';if(n.includes('trident'))return'IE';if(n.includes('firefox'))return'Firefox';if(n.includes('safari'))return'Safari'}}var s={get appOwnership(){return null},get executionEnvironment(){return n.ExecutionEnvironment.Bare},get sessionId(){return t},get isHeadless(){return'undefined'==typeof navigator||/\bHeadlessChrome\//.test(navigator.userAgent)},get expoVersion(){return this.manifest.sdkVersion||null},get linkingUri(){return'undefined'!=typeof location?location.origin:''},get expoRuntimeVersion(){return this.expoVersion},get deviceName(){return o()},get systemFonts(){return[]},get statusBarHeight(){return 0},get deviceYearClass(){return null},get manifest(){return"{\"name\":\"The Anchorage \xb7 Head Chef\",\"slug\":\"covercharge\",\"version\":\"0.1.13\",\"orientation\":\"default\",\"icon\":\"./assets/variants/chef/icon.png\",\"userInterfaceStyle\":\"dark\",\"web\":{\"favicon\":\"./assets/favicon.png\",\"output\":\"single\",\"bundler\":\"metro\",\"name\":\"The Anchorage \xb7 Head Chef (prototype)\",\"shortName\":\"Head Chef \xb7 Anchorage\",\"backgroundColor\":\"#0B0B0B\"},\"scheme\":\"covercharge-chef\",\"experiments\":{\"typedRoutes\":false,\"baseUrl\":\"/wildings/chef-app\"},\"backgroundColor\":\"#0B0B0B\",\"sdkVersion\":\"58.0.0\",\"platforms\":[\"ios\",\"android\",\"web\"],\"extra\":{\"appVariant\":\"chef\",\"router\":{\"asyncRoutes\":{\"web\":true}}}}"},get manifest2(){return null},get experienceUrl(){return'undefined'!=typeof location?location.origin:''},get debugMode(){return!1},getWebViewUserAgentAsync:async()=>'undefined'!=typeof navigator?navigator.userAgent:null}},410,[409]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=f(r(d[0]));return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get getPathForState(){return h},get resolvePathLinking(){return s}});const n=r(d[1]),o=r(d[2]),u=r(d[3]),c=r(d[4]);function f(t){return t&&t.__esModule?t:{default:t}}function s(t){return{getStateFromPath:t?.getStateFromPath??u.getStateFromPath,getPathFromState:t?.getPathFromState??o.getPathFromState}}function h(u,f){const{getStateFromPath:h,getPathFromState:P}=s(f),F=(0,n.findFocusedRoute)(u);if(F?.path){const s=h(F.path,f?.config,(0,c.getRouteSegmentsFromState)(u)),P=s?(0,n.findFocusedRoute)(s):void 0;if(P&&P.name===F.name&&(0,t().default)({...P.params},{...F.params}))return(0,o.appendBaseUrl)(F.path)}return P(u,f?.config)}},411,[368,383,412,414,387]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get appendBaseUrl(){return b},get getPathDataFromState(){return h},get getPathFromState(){return l}});const t=r(d[0]),n=r(d[1]),o=p(r(d[2])),s=r(d[3]);function c(t){if("function"!=typeof WeakMap)return null;var n=new WeakMap,o=new WeakMap;return(c=function(t){return t?o:n})(t)}function p(t,n){if(!n&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var o=c(n);if(o&&o.has(t))return o.get(t);var s={__proto__:null},p=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var u in t)if("default"!==u&&Object.prototype.hasOwnProperty.call(t,u)){var f=p?Object.getOwnPropertyDescriptor(t,u):null;f&&(f.get||f.set)?Object.defineProperty(s,u,f):s[u]=t[u]}return s.default=t,o&&o.set(t,s),s}const u=t=>{const n=null!=t.index?t.routes[t.index]:t.routes[t.routes.length-1];return n.state?u(n.state):n};let f=[void 0,{}];function l(t,n){return h(t,n).path}function h(c,p){if(null==c)throw Error("Got 'undefined' for the navigation state. You must pass a valid state object.");p&&(0,s.validatePathConfig)(p),f[0]!==p?.screens&&(f=[p?.screens,p?.screens?P(p.screens):{}]);const l=f[1];let h='/',v=c;const b={};for(;v;){let s,f,y='number'==typeof v.index?v.index:0,P=v.routes[y];const j=u(c);let O=l;const w=[];let x=!0;for(;P.name in O&&x;){if(s=O[P.name].pattern,w.push(P.name),P.params){const t=O[P.name]?.stringify,n=o.fixCurrentParams(b,P,t);j===P&&(f={...n},s?.split('/').filter(t=>o.isDynamicPart(t)).forEach(t=>{const n=o.getParamName(t);f&&delete f[n]}))}if(O[P.name].screens&&void 0!==P.state){y=null!=P.state.index?P.state.index:P.state.routes.length-1;const t=P.state.routes[y],n=O[P.name].screens;n&&t.name in n?(P=t,O=n):x=!1}else x=!1}if(void 0===s&&(s=w.join('/')),void 0!==O[P.name]?h+=o.getPathWithConventionsCollapsed({...p,pattern:s,route:P,params:b,initialRouteName:l[P.name]?.initialRouteName}):P.name.startsWith('+')||(h+=encodeURIComponent(P.name)),f||(f=j.params?{...j.params}:void 0),P.state)h+='/';else if(f){for(const t in f)'undefined'===f[t]&&delete f[t];delete f['#'],f=(0,t.removeInternalExpoRouterParams)(f);const o=(0,n.stringifySearchParams)(f);o&&(h+=`?${o}`)}v=P.state}return h=h.replace(/\/+/g,'/'),h=h.length>1?h.replace(/\/$/,''):h,p?.path&&(h=y(p.path,h)),h=o.appendBaseUrl(h),b['#']&&(h+=`#${b['#']}`),{path:h,params:b}}const y=(...t)=>[].concat(...t.map(t=>t.split('/'))).filter(Boolean).join('/'),v=(t,n)=>{if('string'==typeof t){return{pattern:n?y(n,t):t}}if(t.exact&&void 0===t.path)throw new Error("A 'path' needs to be specified when specifying 'exact: true'. If you don't want this screen in the URL, specify it as empty string, e.g. `path: ''`.");const o=!0!==t.exact?y(n||'',t.path||''):t.path||'',s=t.screens?P(t.screens,o):void 0;return{pattern:o?.split('/').filter(Boolean).join('/'),stringify:t.stringify,screens:s}},P=(t,n)=>Object.fromEntries(Object.entries(t).map(([t,o])=>[t,v(o,n)]));function b(t,n="/wildings/chef-app"){return n?`/${n.replace(/^\/+/,'').replace(/\/$/,'')}${t}`:t}},412,[391,390,388,413]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"validatePathConfig",{enumerable:!0,get:function(){return o}});const t=t=>Object.entries(t).map(([t,n])=>`- ${t} (${n})`).join('\n'),n=new Set(['preserveDynamicRoutes','preserveGroups','shouldEncodeURISegment']);function o(s,c=!0){const p={path:'string',initialRouteName:'string',screens:'object',...c?null:{_route:'object',exact:'boolean',stringify:'object',parse:'object'}};if('object'!=typeof s||null===s)throw new Error(`Expected the configuration to be an object, but got ${JSON.stringify(s)}.`);const f=Object.fromEntries(Object.keys(s).filter(t=>!c||!n.has(t)).map(t=>{if(!(t in p))return[t,'extraneous'];{const n=p[t],o=s[t];if(void 0!==o&&typeof o!==n)return[t,`expected '${n}', got '${typeof o}'`]}return null}).filter(Boolean));if(Object.keys(f).length)throw new Error(`Found invalid properties in the configuration:\n${t(f)}\n\nYou can only specify the following properties:\n${t(p)}\n\nIf you want to specify configuration for screens, you need to specify them under a 'screens' property.\n\nExpo Router generates its linking configuration from files in the app directory.`);if(c&&'path'in s&&'string'==typeof s.path&&s.path.includes(':'))throw new Error(`Found invalid path '${s.path}'. The 'path' in the top-level configuration cannot contain patterns for params.`);'screens'in s&&s.screens&&Object.entries(s.screens).forEach(([t,n])=>{'string'!=typeof n&&o(n,!1)})}},413,[]); +__d(function(g,r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"getStateFromPath",{enumerable:!0,get:function(){return p}});const t=r(d[0]),n=r(d[1]),a=r(d[2]),o=c(r(d[3])),s=r(d[4]);function i(t){if("function"!=typeof WeakMap)return null;var n=new WeakMap,a=new WeakMap;return(i=function(t){return t?a:n})(t)}function c(t,n){if(!n&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var a=i(n);if(a&&a.has(t))return a.get(t);var o={__proto__:null},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var c in t)if("default"!==c&&Object.prototype.hasOwnProperty.call(t,c)){var p=s?Object.getOwnPropertyDescriptor(t,c):null;p&&(p.get||p.set)?Object.defineProperty(o,c,p):o[c]=t[c]}return o.default=t,a&&a.set(t,o),o}function p(t,n,a=[]){const{initialRoutes:s,configs:i,configWithRegexes:c}=l(n,a),p=n?.screens,u=o.getUrlWithReactNavigationConcessions(t);let f=o.cleanPath(u.nonstandardPathname);const h=n?.path?.replace(/^\//,'');if(h){const t=h.endsWith('/')?h:`${h}/`;if(!f.startsWith(t))return;f=f.replace(t,'')}if(void 0===p){const t=f.split('/').filter(Boolean).map(t=>({name:decodeURIComponent(t)}));return t.length?_(u,t,s,[],u.hash):void 0}if('/'===f){const t=o.matchForEmptyPath(c);return t?_(u,t.routeNames.map(t=>({name:t})),s,i,u.hash):void 0}let y,P;const{routes:b,remainingPath:R}=j(f,c);if(void 0!==b&&(P=_(u,b,s,i,u.hash),f=R,y=P),null!=P&&null!=y)return y}let u=[void 0,f()];function l(t,n){return u=[t,f(t,n)],u[1]}function f(t,n){t&&(0,s.validatePathConfig)(t);const a=h(t),o=y(a,t?.screens,n);P(o);return{initialRoutes:a,configs:o,configWithRegexes:b(o)}}function h(t){const n=[];return t?.initialRouteName&&n.push({initialRouteName:t.initialRouteName,parentScreens:[]}),n}function y(t,n={},a){return[].concat(...Object.keys(n).map(a=>v(a,n,[],t,[]))).map(o.appendIsInitial(t)).sort(o.getRouteConfigSorter(a))}function P(t){t.reduce((t,n)=>{if(t[n.pattern]){const a=t[n.pattern].routeNames,o=n.routeNames;if(!(a.length>o.length?o.every((t,n)=>a[n]===t):a.every((t,n)=>o[n]===t)))throw new Error(`Found conflicting screens with the same pattern. The pattern '${n.pattern}' resolves to both '${a.join(' > ')}' and '${o.join(' > ')}'. Patterns must be unique and cannot resolve to more than one screen.`)}return Object.assign(t,{[n.pattern]:n})},{})}function b(t){return t.map(t=>({...t,regex:o.configRegExp(t)}))}const R=(...t)=>[].concat(...t.map(t=>t.split('/'))).filter(Boolean).join('/'),j=(t,a)=>{let s,i=t;const c=Object.create(null);for(const t of a){if(!t.regex)continue;const p=i.match(t.regex);if(p){const u=t.pattern?.split('/').reduce((t,n,a)=>{if(!o.isDynamicPart(n))return t;t.pos+=1;const s=o.safelyDecodeURIComponent(p[2*(t.pos+1)].replace(/\/$/,''));return Object.assign(t.matchedParams,{[n]:Object.assign(t.matchedParams[n]||{},{[a]:s})}),t},{pos:-1,matchedParams:{}}),l=u.matchedParams||{};s=t.routeNames.map(s=>{const i=a.find(n=>n.screen===s&&t.pattern.startsWith(n.pattern)),p=i?.path.split('/').filter(Boolean).join('/'),u=i?.pattern.replace(new RegExp(`${(0,n.escapeStringRegexp)(p)}$`),'')?.split('/').length,f=p?.split('/').reduce((t,n,a)=>{if(!o.isDynamicPart(n))return t;const s=u?u-1:0,c=o.getParamValue(n,l[n]?.[a+s]);if(c){const a=o.replacePart(n);t[a]=i?.parse?.[a]?i.parse[a](c):c}return t},{});return f&&Object.keys(f).length?(Object.assign(c,f),{name:s,params:f}):{name:s}}),i=i.replace(p[1],'');break}}return o.populateParams(s,c),{routes:s,remainingPath:i}},v=(n,a,o=[],s,i,c)=>{const p=[];o.push(n),i.push(n);const u=a[n];if('string'==typeof u){const t=c?R(c,u):u;p.push(N(n,o,t,u))}else if('object'==typeof u){let a;if('string'==typeof u.path){if(u.exact&&void 0===u.path)throw new Error("A 'path' needs to be specified when specifying 'exact: true'. If you don't want this screen in the URL, specify it as empty string, e.g. `path: ''`.");a=!0!==u.exact?R(c||'',u.path||''):u.path||'',n!==t.INTERNAL_SLOT_NAME&&p.push(N(n,o,a,u.path,u.parse,u))}u.screens&&(u.initialRouteName&&s.push({initialRouteName:u.initialRouteName,parentScreens:i}),Object.keys(u.screens).forEach(t=>{const n=v(t,u.screens,o,s,[...i],a??c);p.push(...n)}))}return o.pop(),p},N=(t,n,a,s,i=void 0,c={})=>({screen:t,regex:(a=a.split('/').filter(Boolean).join('/'))?o.routePatternToRegex(a):void 0,pattern:a,path:s,routeNames:[...n],parse:i,...o.createConfig(t,a,n,c)}),O=(t,n)=>{for(const a of n)if(t===a.routeNames[a.routeNames.length-1])return a.parse},x=(t,n,a)=>{for(const o of a)if(n.length===o.parentScreens.length){let a=!0;for(let t=0;ta?t?{index:1,routes:[{name:t,params:n.params},n]}:{routes:[n]}:t?{index:1,routes:[{name:t,params:n.params},{...n,state:{routes:[]}}]}:{routes:[{...n,state:{routes:[]}}]},_=({path:t,...n},s,i,c,p)=>{let u=s.shift();const l=[];let f=x(u.name,l,i);l.push(u.name);const h=w(f,u,0===s.length);if(s.length>0){let t=h;for(;u=s.shift();){f=x(u.name,l,i);const n=t.index??t.routes.length-1;t.routes[n].state=w(f,u,0===s.length),s.length>0&&(t=t.routes[n].state),l.push(u.name)}}u=(0,a.findFocusedRoute)(h),u.path=n.pathWithoutGroups;const y=o.parseQueryParams(t,u,c?O(u.name,c):void 0,p);return y&&(u.params={...u.params,...y}),h}},414,[295,415,383,416,413]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(t){return t.replace(/[|\\{}()[\]^$+*?.]/g,'\\$&').replace(/-/g,'\\x2d')}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"escapeStringRegexp",{enumerable:!0,get:function(){return t}})},415,[]); +__d(function(g,r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var s in n)Object.defineProperty(t,s,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,s).get})})(e,{get appendIsInitial(){return R},get assertScreens(){return c},get cleanPath(){return I},get configRegExp(){return p},get createConfig(){return u},get getParamValue(){return f},get getRouteConfigSorter(){return j},get getUrlWithReactNavigationConcessions(){return o},get isDynamicPart(){return l},get matchForEmptyPath(){return y},get parseQueryParams(){return C},get populateParams(){return a},get replacePart(){return h},get routePatternToRegex(){return b},get safelyDecodeURIComponent(){return i},get spreadParamsAcrossAllStates(){return x},get stripBaseUrl(){return P}});const t=r(d[0]),n=r(d[1]),s=r(d[2]);function a(t,n){if(t&&n&&0!==Object.keys(n).length){for(const s of t)s.params={...n,...s.params};return t}}function i(t){try{return decodeURIComponent(t)}catch{return t}}function o(n,a="/wildings/chef-app"){const i=(0,t.stripGroupSegmentsFromPath)(P(n,a));let o='',u='';try{const t=(0,s.parseUrlUsingCustomBase)(n);o=t.pathname,u=t.hash}catch{}return{path:n,nonstandardPathname:P(o,a).replace(/^\/+/g,'').replace(/\/+$/g,'')+'/',hash:u,pathWithoutGroups:i}}function u(n,s,a,i={}){const o=[];let u=!1;const c='index'===n||n.endsWith('/index');let p=0;for(const n of s.split('/'))if(n){const s=n.startsWith(':')||n.startsWith('*')||n.includes('*not-found');u||=s,(0,t.matchGroupName)(n)||(o.push(n),s||p++)}const l=!!i.screens&&!!Object.keys(i.screens)?.length,h=l?'layout':u?'dynamic':'static';return c&&(o.push('index'),p++),{type:h,isIndex:c,hasChildren:l,parts:o,staticPartCount:p,userReadableName:[...a.slice(0,-1),i.path||n].join('/'),expandedRouteNames:a.slice(1).flatMap(t=>t.split('/'))}}function c(t){if(!t?.screens)throw Error("You must pass a 'screens' object to 'getStateFromPath' to generate a path.")}function p(t){return t.pattern?new RegExp(`^(${t.pattern.split('/').map(W).join('')})$`):void 0}function l(t){return t.length>1&&(t.startsWith(':')||t.startsWith('*'))}function h(t){return t.replace(/^[:*]/,'').replace(/\?$/,'')}function f(t,n){if(t.startsWith('*')){const s=n.split('/').filter(t=>''!==t);return 0===s.length&&t.endsWith('?')?void 0:s}return n}function W(s){return(s=s.replace(/ /g,'%20')).startsWith(':')?`(([^/]+\\/)${s.endsWith('?')?'?':''})`:s.startsWith('*')?`((.*\\/)${s.endsWith('?')?'?':''})`:null!=(0,t.matchGroupName)(s)?`(?:${(0,n.escapeStringRegexp)(s)}\\/)?`:(0,n.escapeStringRegexp)(s)+"\\/"}function x(t,n){for(;t;){const s=t.routes[0];s.params=Object.assign({},s.params,n)}}function P(t,s="/wildings/chef-app"){return s?t.replace(/^\/+/g,'/').replace(new RegExp(`^\\/?${(0,n.escapeStringRegexp)(s)}`,'g'),''):t}function y(n){const s=n.filter(t=>!t.hasChildren).map(n=>({...n,path:(0,t.stripGroupSegmentsFromPath)(n.path)}));return s.find(t=>''===t.path&&(!t.regex||t.regex.test('')))??s.find(t=>t.path.startsWith(':')&&t.regex.test(''))??s.find(t=>t.path.startsWith('*')&&t.regex.test('/'))}function R(t){const n=t.map(t=>$(...t.parentScreens,t.initialRouteName));return function(t){return t.isInitial=n.includes(t.routeNames.join('/')),t}}const $=(...t)=>[].concat(...t.map(t=>t.split('/'))).filter(Boolean).join('/');function j(t=[]){return function(n,s){if(n.pattern===s.pattern)return s.routeNames.join('>').localeCompare(n.routeNames.join('>'));if(n.pattern.startsWith(s.pattern)&&!s.isIndex)return-1;if(s.pattern.startsWith(n.pattern)&&!n.isIndex)return 1;if('static'===n.type&&'static'!==s.type)return-1;if('static'!==n.type&&'static'===s.type)return 1;if(n.staticPartCount!==s.staticPartCount)return s.staticPartCount-n.staticPartCount;const a=t.filter((t,s)=>t===n.expandedRouteNames[s]&&t.startsWith('(')&&t.endsWith(')')),i=t.filter((t,n)=>t===s.expandedRouteNames[n]&&t.startsWith('(')&&t.endsWith(')'));if((a.length>0||i.length>0)&&a.length!==i.length)return i.length-a.length;for(let t=0;ta[t](n)):o.getAll(t);u[t]=1===n.length?n[0]:n}return Object.keys(u).length?u:void 0}function I(t){return(t=t.replace(/\/+/g,'/').replace(/^\//,'').replace(/\?.*$/,'')).endsWith('/')?t:`${t}/`}function b(t){return new RegExp(`^(${t.split('/').map(t=>t.startsWith('(')&&t.endsWith(')')?`${t}?`:t.startsWith(':')?`(([^/]+\\/)${t.endsWith('?')?'?':''})`:`${'*'===t?'.*':(0,n.escapeStringRegexp)(t)}\\/`).join('')})`)}},416,[389,415,355]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"getNavigateAction",{enumerable:!0,get:function(){return u}});const t=r(d[0]),n=r(d[1]),o=r(d[2]),_=r(d[3]),s=r(d[4]);function u(u,l,c,p,v,f,N,A){if(!c.linking||!c.routeNode)throw new Error('Attempted to link to route when no routes are present');const h=(0,_.getRouteInfoFromState)(A),y=(0,t.applyRedirects)((0,n.resolveHrefStringWithSegments)(u,h,l),c.redirects),E=c.linking.getStateFromPath(y,c.linking.config,h.segments);if(!E||0===E.routes.length)return{status:'invalid',href:y};const P={...void 0!==l.__internal__previewId?{[o.INTERNAL_EXPO_ROUTER_PREVIEW_ID_PARAM_NAME]:l.__internal__previewId}:{}};return{status:'action',action:(0,s.resolveNavigationDestination)({targetState:E,navigationState:A,routeNode:c.routeNode,registry:c.registry,action:{type:p??'NAVIGATE',payload:{singular:f,__internal__PreviewKey:N,...l.__internal__popToNavigator?{pop:!0}:void 0}},withAnchor:v,internalParams:P})}}},417,[418,353,391,387,682]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=s(r(d[0]));return t=function(){return n},n}function n(){const t=r(d[1]);return n=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get applyRedirects(){return l},get convertRedirect(){return y},get getRedirectModule(){return p},get mergeVariablesWithPath(){return b}});const o=r(d[2]),u=r(d[3]),c=r(d[4]);function f(t){if("function"!=typeof WeakMap)return null;var n=new WeakMap,o=new WeakMap;return(f=function(t){return t?o:n})(t)}function s(t,n){if(!n&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var o=f(n);if(o&&o.has(t))return o.get(t);var u={__proto__:null},c=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if("default"!==s&&Object.prototype.hasOwnProperty.call(t,s)){var l=c?Object.getOwnPropertyDescriptor(t,s):null;l&&(l.get||l.set)?Object.defineProperty(u,s,l):u[s]=t[s]}return u.default=t,o&&o.set(t,u),u}function l(n,u){if('string'!=typeof n||!u)return n;const c=(0,o.cleanPath)(n),f=u.find(([t])=>t.test(c));if(!f)return n;if(f[2]){let n=f[1].destination;return n.startsWith('//'),t().openURL(n),n}return l(y(n,f[1]),u)}function p(o){return{default:function(){const u=r(d[5]).usePathname(),f=(0,c.shouldLinkExternally)(o.destination);if((0,n().useEffect)(()=>{if(f){let n=o.destination;n.startsWith('//'),0,t().openURL(n)}},[]),f)return null;const s=y(u,o);return(0,n().createElement)(r(d[6]).Redirect,{href:s})}}}function y(t,n){const o={},c=t.split('/'),f=n.source.split('/');for(const[t,n]of f.entries()){const f=(0,u.matchDynamicName)(n);if(f){if(f.deep){o[f.name]=c.slice(t);break}o[f.name]=c[t]}else;}return b(n.destination,o)}function b(t,n){return t.split('/').map(t=>{const o=(0,u.matchDynamicName)(t);if(o){const t=n[o.name];return delete n[o.name],t}return t}).filter(Boolean).join('/')}},418,[300,30,416,389,355,419,508]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),(function(t,u){for(var n in u)Object.defineProperty(t,n,{enumerable:!0,get:Object.getOwnPropertyDescriptor(u,n).get})})(e,{get useCanGoBack(){return n.useCanGoBack},get useCurrentRouteInfo(){return v.useCurrentRouteInfo},get useGlobalSearchParams(){return P.useGlobalSearchParams},get useLoaderData(){return h.useLoaderData},get useLocalSearchParams(){return b.useLocalSearchParams},get useNavigationContainerRef(){return s.useNavigationContainerRef},get usePathname(){return R.usePathname},get useRootNavigation(){return o.useRootNavigation},get useRootNavigationState(){return u.useRootNavigationState},get useRouteInfo(){return t.useRouteInfo},get useRouter(){return c.useRouter},get useSearchParams(){return S.useSearchParams},get useSegments(){return f.useSegments},get useUnstableGlobalHref(){return l.useUnstableGlobalHref}});const t=r(d[0]),u=r(d[1]),n=r(d[2]),o=r(d[3]),s=r(d[4]),c=r(d[5]),l=r(d[6]),f=r(d[7]),R=r(d[8]),P=r(d[9]),b=r(d[10]),S=r(d[11]),h=r(d[12]),v=r(d[13])},419,[420,422,424,426,490,491,492,493,494,495,496,497,498,507]); +__d(function(g,r,i,a,m,e,d){"use strict";function n(){const t=r(d[0]);return n=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"useRouteInfo",{enumerable:!0,get:function(){return u}});const t=r(d[1]),s=r(d[2]);function u(){const u=(0,n().use)(s.RouteInfoContext),{isPreview:o,segments:c,params:f,pathname:p}=(0,t.usePreviewInfo)();return o?{pathname:p??'',segments:c??[],unstable_globalHref:'',params:f??{},searchParams:new URLSearchParams,pathnameWithParams:p??'',isIndex:!1}:u}},420,[30,421,394]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get PreviewRouteContext(){return n},get useIsPreview(){return u},get usePreviewInfo(){return o}});const n=(0,t().createContext)(void 0);function o(){const o=(0,t().use)(n);return{isPreview:!!o,...o}}function u(){const{isPreview:t}=o();return t}},421,[30]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const o=r(d[0]);return t=function(){return o},o}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"useRootNavigationState",{enumerable:!0,get:function(){return n}});const o=r(d[1]);function n(){const n=(0,t().use)(o.RootNavigationStateContext);if(void 0===n)throw new Error('useRootNavigationState was called from a generated route. This is likely a bug in Expo Router.');return n}},422,[30,423]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"RootNavigationStateContext",{enumerable:!0,get:function(){return n}});const n=(0,t().createContext)(void 0)},423,[30]); +__d(function(g,r,i,a,m,e,d){"use strict";function n(){const o=r(d[0]);return n=function(){return o},o}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"useCanGoBack",{enumerable:!0,get:function(){return t}});const o=r(d[1]);function t(){const t=(0,n().use)(o.CanGoBackContext);if(void 0===t)throw new Error('`useCanGoBack` was called from a component rendered outside the Expo Router root. Render the component inside `ExpoRoot`.');return t}},424,[30,425]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get CanGoBackContext(){return n},get getFocusedCanGoBack(){return u},get hasBackTarget(){return o}});const n=(0,t().createContext)(void 0);function o(t){return null!=t.history?t.history.length>1:(t.index??0)>0}function u(t){let n=t;for(;n;){if(o(n))return!0;n=n.routes[n.index??0]?.state}return!1}},425,[30]); +__d(function(g,r,i,a,m,e,d){"use strict";function n(){const t=r(d[0]);return n=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"useRootNavigation",{enumerable:!0,get:function(){return o}});const t=r(d[1]);function o(){return(0,n().use)(t.NavigationContainerRefContext)??null}},426,[30,427]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var u in n)Object.defineProperty(t,u,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,u).get})})(e,{get DarkTheme(){return o.DarkTheme},get DefaultTheme(){return c.DefaultTheme},get LinkingContext(){return t.LinkingContext},get LocaleDirContext(){return n.LocaleDirContext},get ServerContainer(){return u.ServerContainer},get useLinkBuilder(){return l.useLinkBuilder},get useLinkTo(){return s.useLinkTo},get useLocale(){return f.useLocale},get useRoutePath(){return p.useRoutePath},get useScrollToTop(){return L.useScrollToTop}});const t=r(d[0]),n=r(d[1]),u=r(d[2]),o=r(d[3]),c=r(d[4]);T(r(d[5]),e);const l=r(d[6]),s=r(d[7]),f=r(d[8]),p=r(d[9]),L=r(d[10]);function T(t,n){return Object.keys(t).forEach(function(u){"default"===u||Object.prototype.hasOwnProperty.call(n,u)||Object.defineProperty(n,u,{enumerable:!0,get:function(){return t[u]}})}),t}T(r(d[11]),e)},427,[428,429,430,481,483,484,485,486,487,488,489,431]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=o(r(d[0]));return t=function(){return n},n}function n(t){if("function"!=typeof WeakMap)return null;var o=new WeakMap,u=new WeakMap;return(n=function(t){return t?u:o})(t)}function o(t,o){if(!o&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var u=n(o);if(u&&u.has(t))return u.get(t);var f={__proto__:null},c=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var p in t)if("default"!==p&&Object.prototype.hasOwnProperty.call(t,p)){var l=c?Object.getOwnPropertyDescriptor(t,p):null;l&&(l.get||l.set)?Object.defineProperty(f,p,l):f[p]=t[p]}return f.default=t,u&&u.set(t,f),f}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"LinkingContext",{enumerable:!0,get:function(){return u}});const u=t().createContext({get options(){throw new Error("Couldn't find a LinkingContext context.")}});u.displayName='LinkingContext'},428,[30]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=o(r(d[0]));return t=function(){return n},n}function n(t){if("function"!=typeof WeakMap)return null;var o=new WeakMap,u=new WeakMap;return(n=function(t){return t?u:o})(t)}function o(t,o){if(!o&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var u=n(o);if(u&&u.has(t))return u.get(t);var c={__proto__:null},f=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in t)if("default"!==l&&Object.prototype.hasOwnProperty.call(t,l)){var p=f?Object.getOwnPropertyDescriptor(t,l):null;p&&(p.get||p.set)?Object.defineProperty(c,l,p):c[l]=t[l]}return c.default=t,u&&u.set(t,c),c}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"LocaleDirContext",{enumerable:!0,get:function(){return u}});const u=t().createContext('ltr');u.displayName='LocaleDirContext'},429,[30]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}function n(){const t=f(r(d[1]));return n=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"ServerContainer",{enumerable:!0,get:function(){return l}});const o=r(d[2]),u=r(d[3]);function c(t){if("function"!=typeof WeakMap)return null;var n=new WeakMap,o=new WeakMap;return(c=function(t){return t?o:n})(t)}function f(t,n){if(!n&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var o=c(n);if(o&&o.has(t))return o.get(t);var u={__proto__:null},f=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in t)if("default"!==l&&Object.prototype.hasOwnProperty.call(t,l)){var s=f?Object.getOwnPropertyDescriptor(t,l):null;s&&(s.get||s.set)?Object.defineProperty(u,l,s):u[l]=t[l]}return u.default=t,o&&o.set(t,u),u}function l({ref:c,children:f,location:l}){n().useEffect(()=>{console.error("'ServerContainer' should only be used on the server with 'react-dom/server' for SSR.")},[]);const s={};if(c){const t={getCurrentOptions:()=>s.options};'function'==typeof c?c(t):c.current=t}return(0,t().jsx)(u.ServerContext.Provider,{value:{location:l},children:(0,t().jsx)(o.CurrentRenderContext.Provider,{value:s,children:f})})}},430,[24,30,431,480]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get CurrentRenderContext(){return o.CurrentRenderContext},get NavigationContainerRefContext(){return N.NavigationContainerRefContext},get NavigationContext(){return C.NavigationContext},get NavigationHelpersContext(){return f.NavigationHelpersContext},get NavigationMetaContext(){return R.NavigationMetaContext},get NavigationProvider(){return F.NavigationProvider},get NavigationRouteContext(){return F.NavigationRouteContext},get NavigatorTypeContext(){return P.NavigatorTypeContext},get ThemeContext(){return h.ThemeContext},get ThemeProvider(){return x.ThemeProvider},get createNavigationContainerRef(){return t.createNavigationContainerRef},get createNavigatorFactory(){return n.createNavigatorFactory},get findFocusedRoute(){return u.findFocusedRoute},get getFocusedRouteNameFromRoute(){return s.getFocusedRouteNameFromRoute},get getPathFromState(){return v.getPathFromState},get getStateFromPath(){return c.getStateFromPath},get useFocusEffect(){return p.useFocusEffect},get useIsFocused(){return y.useIsFocused},get useNavigation(){return b.useNavigation},get useNavigationBuilder(){return O.useNavigationBuilder},get useNavigationContainerRef(){return S.useNavigationContainerRef},get useNavigationState(){return T.useNavigationState},get usePreventRemove(){return j.usePreventRemove},get useRoute(){return _.useRoute},get useStateForPath(){return E.useStateForPath},get useTheme(){return l.useTheme},get validatePathConfig(){return M.validatePathConfig}});const t=r(d[0]),n=r(d[1]),o=r(d[2]),u=r(d[3]),s=r(d[4]),v=r(d[5]),c=r(d[6]),N=r(d[7]),C=r(d[8]),f=r(d[9]),R=r(d[10]),P=r(d[11]),F=r(d[12]),h=r(d[13]),x=r(d[14]),l=r(d[15]);w(r(d[16]),e);const p=r(d[17]),y=r(d[18]),b=r(d[19]),O=r(d[20]),S=r(d[21]),T=r(d[22]),j=r(d[23]),_=r(d[24]),E=r(d[25]),M=r(d[26]);function w(t,n){return Object.keys(t).forEach(function(o){"default"===o||Object.prototype.hasOwnProperty.call(n,o)||Object.defineProperty(n,o,{enumerable:!0,get:function(){return t[o]}})}),t}w(r(d[27]),e)},431,[357,432,435,383,436,412,414,439,440,441,442,443,444,446,447,448,449,450,445,451,452,475,473,476,478,479,413,358]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"createNavigatorFactory",{enumerable:!0,get:function(){return o}});const t=r(d[0]),n=r(d[1]);function o(o){return function(){return{Navigator:o,Screen:n.Screen,Group:t.Group}}}},432,[433,434]); +__d(function(g,r,i,a,m,e,d){"use strict";function n(n){return null}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"Group",{enumerable:!0,get:function(){return n}})},433,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function n(n){return null}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"Screen",{enumerable:!0,get:function(){return n}})},434,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=o(r(d[0]));return t=function(){return n},n}function n(t){if("function"!=typeof WeakMap)return null;var o=new WeakMap,u=new WeakMap;return(n=function(t){return t?u:o})(t)}function o(t,o){if(!o&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var u=n(o);if(u&&u.has(t))return u.get(t);var f={__proto__:null},c=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var p in t)if("default"!==p&&Object.prototype.hasOwnProperty.call(t,p)){var l=c?Object.getOwnPropertyDescriptor(t,p):null;l&&(l.get||l.set)?Object.defineProperty(f,p,l):f[p]=t[p]}return f.default=t,u&&u.set(t,f),f}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"CurrentRenderContext",{enumerable:!0,get:function(){return u}});const u=t().createContext(void 0)},435,[30]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"getFocusedRouteNameFromRoute",{enumerable:!0,get:function(){return n}});const t=r(d[0]);function n(n){const o=n[t.CHILD_STATE]??n.state;return o?o.routes[o.index??('string'==typeof o.type&&'stack'!==o.type?0:o.routes.length-1)].name:void 0}},436,[437]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=o(r(d[0]));return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var u in n)Object.defineProperty(t,u,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,u).get})})(e,{get CHILD_STATE(){return c},get useRouteCache(){return f}});const n=r(d[1]);function u(t){if("function"!=typeof WeakMap)return null;var n=new WeakMap,o=new WeakMap;return(u=function(t){return t?o:n})(t)}function o(t,n){if(!n&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var o=u(n);if(o&&o.has(t))return o.get(t);var c={__proto__:null},f=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in t)if("default"!==l&&Object.prototype.hasOwnProperty.call(t,l)){var p=f?Object.getOwnPropertyDescriptor(t,l):null;p&&(p.get||p.set)?Object.defineProperty(c,l,p):c[l]=t[l]}return c.default=t,o&&o.set(t,c),c}const c=Symbol('CHILD_STATE');function f(u){const o=t().useMemo(()=>({current:new Map}),[]);return o.current=u.reduce((t,u)=>{const f=o.current.get(u.key),{state:l,...p}=u;let s;return s=f&&(0,n.isRecordEqual)(f,p)?f:p,Object.defineProperty(s,c,{enumerable:!1,configurable:!0,value:l}),t.set(u.key,s),t},new Map),Array.from(o.current.values())}},437,[30,438]); +__d(function(g,r,i,_a,m,e,d){"use strict";function t(t,n){if(t===n)return!0;const c=Object.keys(t),u=Object.keys(n);return c.length===u.length&&c.every(c=>Object.is(t[c],n[c]))}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"isRecordEqual",{enumerable:!0,get:function(){return t}})},438,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=o(r(d[0]));return t=function(){return n},n}function n(t){if("function"!=typeof WeakMap)return null;var o=new WeakMap,u=new WeakMap;return(n=function(t){return t?u:o})(t)}function o(t,o){if(!o&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var u=n(o);if(u&&u.has(t))return u.get(t);var f={__proto__:null},c=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var p in t)if("default"!==p&&Object.prototype.hasOwnProperty.call(t,p)){var l=c?Object.getOwnPropertyDescriptor(t,p):null;l&&(l.get||l.set)?Object.defineProperty(f,p,l):f[p]=t[p]}return f.default=t,u&&u.set(t,f),f}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"NavigationContainerRefContext",{enumerable:!0,get:function(){return u}});const u=t().createContext(void 0)},439,[30]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=o(r(d[0]));return t=function(){return n},n}function n(t){if("function"!=typeof WeakMap)return null;var o=new WeakMap,u=new WeakMap;return(n=function(t){return t?u:o})(t)}function o(t,o){if(!o&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var u=n(o);if(u&&u.has(t))return u.get(t);var f={__proto__:null},c=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var p in t)if("default"!==p&&Object.prototype.hasOwnProperty.call(t,p)){var l=c?Object.getOwnPropertyDescriptor(t,p):null;l&&(l.get||l.set)?Object.defineProperty(f,p,l):f[p]=t[p]}return f.default=t,u&&u.set(t,f),f}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"NavigationContext",{enumerable:!0,get:function(){return u}});const u=t().createContext(void 0)},440,[30]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=o(r(d[0]));return t=function(){return n},n}function n(t){if("function"!=typeof WeakMap)return null;var o=new WeakMap,u=new WeakMap;return(n=function(t){return t?u:o})(t)}function o(t,o){if(!o&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var u=n(o);if(u&&u.has(t))return u.get(t);var f={__proto__:null},c=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var p in t)if("default"!==p&&Object.prototype.hasOwnProperty.call(t,p)){var l=c?Object.getOwnPropertyDescriptor(t,p):null;l&&(l.get||l.set)?Object.defineProperty(f,p,l):f[p]=t[p]}return f.default=t,u&&u.set(t,f),f}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"NavigationHelpersContext",{enumerable:!0,get:function(){return u}});const u=t().createContext(void 0)},441,[30]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=o(r(d[0]));return t=function(){return n},n}function n(t){if("function"!=typeof WeakMap)return null;var o=new WeakMap,u=new WeakMap;return(n=function(t){return t?u:o})(t)}function o(t,o){if(!o&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var u=n(o);if(u&&u.has(t))return u.get(t);var f={__proto__:null},c=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var p in t)if("default"!==p&&Object.prototype.hasOwnProperty.call(t,p)){var l=c?Object.getOwnPropertyDescriptor(t,p):null;l&&(l.get||l.set)?Object.defineProperty(f,p,l):f[p]=t[p]}return f.default=t,u&&u.set(t,f),f}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"NavigationMetaContext",{enumerable:!0,get:function(){return u}});const u=t().createContext(void 0)},442,[30]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"NavigatorTypeContext",{enumerable:!0,get:function(){return n}});const n=(0,t().createContext)(void 0)},443,[30]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}function n(){const t=f(r(d[1]));return n=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get NamedRouteContextListContext(){return l},get NavigationProvider(){return p},get NavigationRouteContext(){return s}});const o=r(d[2]),u=r(d[3]);function c(t){if("function"!=typeof WeakMap)return null;var n=new WeakMap,o=new WeakMap;return(c=function(t){return t?o:n})(t)}function f(t,n){if(!n&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var o=c(n);if(o&&o.has(t))return o.get(t);var u={__proto__:null},f=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if("default"!==s&&Object.prototype.hasOwnProperty.call(t,s)){var l=f?Object.getOwnPropertyDescriptor(t,s):null;l&&(l.get||l.set)?Object.defineProperty(u,s,l):u[s]=t[s]}return u.default=t,o&&o.set(t,u),u}const s=n().createContext(void 0),l=n().createContext(void 0);function p({route:n,navigation:c,children:f}){const l=(0,u.useIsRouteFocused)(n.key);return(0,t().jsx)(s.Provider,{value:n,children:(0,t().jsx)(o.NavigationContext.Provider,{value:c,children:(0,t().jsx)(u.IsFocusedContext.Provider,{value:l,children:f})})})}},444,[24,30,440,445]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=o(r(d[0]));return t=function(){return n},n}function n(t){if("function"!=typeof WeakMap)return null;var o=new WeakMap,u=new WeakMap;return(n=function(t){return t?u:o})(t)}function o(t,o){if(!o&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var u=n(o);if(u&&u.has(t))return u.get(t);var s={__proto__:null},c=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var f in t)if("default"!==f&&Object.prototype.hasOwnProperty.call(t,f)){var p=c?Object.getOwnPropertyDescriptor(t,f):null;p&&(p.get||p.set)?Object.defineProperty(s,f,p):s[f]=t[f]}return s.default=t,u&&u.set(t,s),s}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get FocusedRouteKeyContext(){return u},get IsFocusedContext(){return s},get useIsFocused(){return f},get useIsRouteFocused(){return c}});const u=t().createContext(void 0),s=t().createContext(void 0);function c(n){const o=(0,t().use)(s),c=(0,t().use)(u);return void 0===n?o??!0:!(null!=o&&!o)&&c===n}function f(){const n=(0,t().use)(s);if(void 0===n)throw new Error("Couldn't find a focus context. Make sure the component is rendered inside your app's route tree. This is most likely a bug in expo-router. Please report it at https://github.com/expo/expo/issues.");return n}},445,[30]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=o(r(d[0]));return t=function(){return n},n}function n(t){if("function"!=typeof WeakMap)return null;var o=new WeakMap,u=new WeakMap;return(n=function(t){return t?u:o})(t)}function o(t,o){if(!o&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var u=n(o);if(u&&u.has(t))return u.get(t);var f={__proto__:null},c=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var p in t)if("default"!==p&&Object.prototype.hasOwnProperty.call(t,p)){var l=c?Object.getOwnPropertyDescriptor(t,p):null;l&&(l.get||l.set)?Object.defineProperty(f,p,l):f[p]=t[p]}return f.default=t,u&&u.set(t,f),f}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"ThemeContext",{enumerable:!0,get:function(){return u}});const u=t().createContext(void 0);u.displayName='ThemeContext'},446,[30]); +__d(function(g,r,i,a,m,e,d){"use strict";function n(){const t=r(d[0]);return n=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"ThemeProvider",{enumerable:!0,get:function(){return u}});const t=r(d[1]);function u({value:u,children:o}){return(0,n().jsx)(t.ThemeContext.Provider,{value:u,children:o})}},447,[24,446]); +__d(function(g,r,i,a,m,e,d){"use strict";function n(){const t=r(d[0]);return n=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"useTheme",{enumerable:!0,get:function(){return o}});const t=r(d[1]);function o(){const o=(0,n().use)(t.ThemeContext);if(null==o)throw new Error("Couldn't find a theme. Is your component inside NavigationContainer or does it have a theme?");return o}},448,[30,446]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"PrivateValueStore",{enumerable:!0,get:function(){return t}});class t{}},449,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=u(r(d[0]));return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"useFocusEffect",{enumerable:!0,get:function(){return c}});const n=r(d[1]);function o(t){if("function"!=typeof WeakMap)return null;var n=new WeakMap,u=new WeakMap;return(o=function(t){return t?u:n})(t)}function u(t,n){if(!n&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var u=o(n);if(u&&u.has(t))return u.get(t);var c={__proto__:null},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var f in t)if("default"!==f&&Object.prototype.hasOwnProperty.call(t,f)){var p=s?Object.getOwnPropertyDescriptor(t,f):null;p&&(p.get||p.set)?Object.defineProperty(c,f,p):c[f]=t[f]}return c.default=t,u&&u.set(t,c),c}function c(o){const u=(0,n.useNavigation)();if(void 0!==arguments[1]){const t="You passed a second argument to 'useFocusEffect', but it only accepts one argument. If you want to pass a dependency array, you can use 'React.useCallback':\n\nuseFocusEffect(\n React.useCallback(() => {\n // Your code here\n }, [depA, depB])\n);\n\nSee usage guide: https://docs.expo.dev/versions/latest/sdk/router/#usefocuseffecteffect-do_not_pass_a_second_prop";console.error(t)}t().useEffect(()=>{let t,n=!1;const c=()=>{const t=o();if(void 0===t||'function'==typeof t)return t};u.isFocused()&&(t=c(),n=!0);const s=u.addListener('focus',()=>{n||(void 0!==t&&t(),t=c(),n=!0)}),f=u.addListener('blur',()=>{void 0!==t&&t(),t=void 0,n=!1});return()=>{void 0!==t&&t(),s(),f()}},[o,u])}},450,[30,451]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"useNavigation",{enumerable:!0,get:function(){return o}});const n=r(d[1]);function o(){const o=(0,t().use)(n.NavigationContext);if(void 0===o)throw new Error("Couldn't find a navigation object. Make sure the component is rendered inside your app's route tree. This is most likely a bug in expo-router. Please report it at https://github.com/expo/expo/issues.");return o}},451,[30,440]); +__d(function(g,r,_i,a,m,_e,d){"use strict";function e(){const t=r(d[0]);return e=function(){return t},t}function t(){const e=D(r(d[1]));return t=function(){return e},e}Object.defineProperty(_e,"__esModule",{value:!0}),Object.defineProperty(_e,"useNavigationBuilder",{enumerable:!0,get:function(){return H}});const n=r(d[2]),o=r(d[3]),i=r(d[4]),s=r(d[5]),u=r(d[6]),c=M(r(d[7])),p=r(d[8]),l=r(d[9]),y=r(d[10]),f=r(d[11]),v=r(d[12]),h=r(d[13]),N=r(d[14]),E=r(d[15]),w=r(d[16]),b=r(d[17]),C=r(d[18]),O=r(d[19]),j=r(d[20]),R=r(d[21]),A=r(d[22]),S=r(d[23]),k=r(d[24]),F=r(d[25]),x=r(d[26]),L=r(d[27]),_=r(d[28]),P=r(d[29]);function M(e){return e&&e.__esModule?e:{default:e}}function $(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return($=function(e){return e?n:t})(e)}function D(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=$(t);if(n&&n.has(e))return n.get(e);var o={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&Object.prototype.hasOwnProperty.call(e,s)){var u=i?Object.getOwnPropertyDescriptor(e,s):null;u&&(u.get||u.set)?Object.defineProperty(o,s,u):o[s]=e[s]}return o.default=e,n&&n.set(e,o),o}b.PrivateValueStore;const G=e=>e.type===E.Screen,T=e=>e.type===t().Fragment||e.type===p.Group,B=(e,n,o)=>t().Children.toArray(e).reduce((e,i)=>{if(t().isValidElement(i)){if(G(i)){if('object'!=typeof i.props||null===i.props)throw new Error("Got an invalid element for screen.");if('string'!=typeof i.props.name||''===i.props.name)throw new Error(`Got an invalid name (${JSON.stringify(i.props.name)}) for the screen. It must be a non-empty string.`);return e.push({options:n,layout:o,props:i.props}),e}if(T(i))return e.push(...B(i.props.children,i.type!==p.Group?n:null!=n?[...n,i.props.screenOptions]:[i.props.screenOptions],'function'==typeof i.props.screenLayout?i.props.screenLayout:o)),e}throw new Error(`A navigator can only contain 'Screen', 'Group' or 'React.Fragment' as its direct children (found ${t().isValidElement(i)?`'${'string'==typeof i.type?i.type:i.type?.name}'${null!=i.props&&'object'==typeof i.props&&'name'in i.props&&i.props?.name?` for the screen '${i.props.name}'`:''}`:'object'==typeof i?JSON.stringify(i):`'${String(i)}'`}). To render this component in the navigator, pass it in the 'component' prop to 'Screen'.`)},[]);function H(p,E,{activityDefaultThreshold:b=1}={}){(0,P.useRegisterNavigator)();const M=(0,n.useRouteNode)(),$=(0,s.useEnqueueRoutingIntent)(),{children:D,activityEnabled:G,layout:T,screenOptions:H,screenLayout:I,screenListeners:q,UNSTABLE_router:V,...K}=E,W=B(D),J=(0,x.useLazyValue)(()=>{if(null!=K.initialRouteName&&W.every(e=>e.props.name!==K.initialRouteName))throw new Error(`Couldn't find a screen named '${K.initialRouteName}' to use as 'initialRouteName'.`);const e=p(K);if(null!=V){const t=V(e);return{...e,...t}}return e}),U=W.reduce((e,t)=>{if(t.props.name in e)throw new Error(`A navigator cannot contain multiple 'Screen' components with the same name (found duplicate screen named '${t.props.name}')`);return e[t.props.name]=t,e},{}),z=W.map(e=>e.props.name),Q=z.reduce((e,t)=>Object.assign(e,{[t]:U[t].props.getId}),{});if(!z.length)throw new Error("Couldn't find any screens for the navigator. Have you defined any screens as its children?");const X=z.join('\0'),{state:Y}=(0,t().use)(v.NavigationStateContext),Z=(0,t().use)(N.RootNavigationStateContext),{resetNavigator:ee,handleAction:te}=(0,t().use)(l.NavigationBuilderContext);if(void 0===Y||!1!==Y.stale||'string'!=typeof Y.key||!Array.isArray(Y.routeNames))throw new Error('A navigator received a missing, partial, or incompatible navigation state. Navigation state is created globally now, so the container must provide a complete seeded state for every mounted navigator.');const re=Z?(0,u.findStateByKey)(Z,Y.key)??Y:Y,ne=void 0!==re.type&&re.type!==J.type,oe=ne?(0,u.resetNavigatorState)(re,J.type):re,ie=t().useMemo(()=>{const e=J.getStateForDeclaredRoutes(oe,z);return(0,w.isArrayEqual)(e.routeNames,z)?e:{...e,routeNames:z}},[oe,X,J]),ae=(0,c.default)((e,t)=>J.getStateForAction(e,t,{routeNames:z,routeGetIdList:Q})),se=(0,A.useEventEmitter)(e=>{const t=[];let n,o=!1;if(e.target){n=ie.routes.find(t=>t.key===e.target);const i=U[e.target];!n&&i&&(n={key:e.target,name:e.target},o=!0),n?.name&&t.push(n.name)}else n=ie.routes[ie.index],t.push(...Object.keys(U).filter(e=>n?.name===e));if(null==n)return;const i=(o?fe({...n,key:void 0}):ve[n.key]).navigation;[].concat(...[q,...t.map(e=>{const{listeners:t}=U[e].props;return t})].map(t=>{const o='function'==typeof t?t({route:n,navigation:i}):t;return o?Object.keys(o).filter(t=>t===e.type).map(e=>o?.[e]):void 0})).filter((e,t,n)=>e&&n.lastIndexOf(e)===t).forEach(t=>t?.(e))});(0,S.useFocusEvents)({state:ie,emitter:se});const{listeners:ue,addListener:ce}=(0,C.useChildListeners)(),pe=(0,c.default)(e=>te(e,oe.key)),le=t().useMemo(()=>({reduce:ae,shouldActionChangeFocus:J.shouldActionChangeFocus,getStateForRouteFocus:(e,t)=>J.getStateForRouteFocus(e,t),getBrowserHistoryForRouteFocus:(e,t,n)=>J.getBrowserHistoryForRouteFocus?.(e,t,n),routeNode:M??void 0}),[ae,M,J]);(0,i.useRegisterRouter)(oe.key,le),(0,O.useClientLayoutEffect)(()=>{ne&&ee(oe.key,J.type)});const de=t().useRef(void 0);(0,O.useClientLayoutEffect)(()=>{if(ne)return;const e=oe;(0,w.isArrayEqual)(e.routeNames,z)?de.current=void 0:(0,w.isArrayEqual)(de.current??[],z)||(de.current=z,$({type:'ACTION',payload:{action:{type:'ROUTE_NAMES_CHANGED',payload:{routeNames:z},target:e.key},originKey:e.key}}))});const ye=(0,L.useNavigationHelpers)({id:E.id,handleAction:pe,state:oe,emitter:se,router:J});t().useEffect(()=>{se.emit({type:'state',data:{state:ie}})},[se,ie]),(0,k.useFocusedListenersChildrenAdapter)({navigation:ye,focusedListeners:ue.focus});const{describe:fe,descriptors:ve}=(0,R.useDescriptors)({routes:ie.routes,routeNames:ie.routeNames,screens:U,activityEnabled:G,activityDefaultThreshold:b,navigation:ye,screenOptions:H,screenLayout:I,state:oe,addListener:ce,router:J,emitter:se});(0,j.useCurrentRender)({state:ie,descriptors:ve});const ge=(0,o.useComponent)(t=>{const n=null!=T?T({state:ie,descriptors:ve,navigation:ye,children:t}):t;return(0,e().jsx)(f.NavigationMetaContext.Provider,{value:void 0,children:(0,e().jsx)(y.NavigationHelpersContext.Provider,{value:ye,children:(0,e().jsx)(_.NavigatorStateContext.Provider,{value:ie,children:(0,e().jsx)(F.FocusedRouteKeyContext.Provider,{value:ie.routes[ie.index]?.key,children:(0,e().jsx)(h.NavigatorTypeContext.Provider,{value:J.type,children:n})})})})})});return{state:ie,navigation:ye,describe:fe,descriptors:ve,NavigationContent:ge}}},452,[24,30,403,453,395,375,454,400,433,455,441,442,456,443,423,434,371,449,457,376,458,459,468,469,470,445,471,472,473,474]); +__d(function(g,r,i,a,m,e,d){"use strict";function n(){const t=r(d[0]);return n=function(){return t},t}function t(){const n=r(d[1]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"useComponent",{enumerable:!0,get:function(){return c}});const u=({render:n,children:t})=>n(t);function c(c){const o=(0,t().useRef)(c);return o.current=c,(0,t().useEffect)(()=>{o.current=null}),(0,t().useRef)(({children:t})=>{const c=o.current;if(null===c)throw new Error('The returned component must be rendered in the same render phase as the hook.');return(0,n().jsx)(u,{render:c,children:t})}).current}},453,[24,30]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(n,o){if(n.key===o)return n;for(const u of n.routes)if(!1===u.state?.stale){const n=t(u.state,o);if(n)return n}}function n(t,n){const o=t.routes[t.index];return{stale:t.stale,key:t.key,routeKeySeq:t.routeKeySeq,type:n,routeNames:t.routeNames,routes:o?[o]:[],index:o?0:-1}}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get findStateByKey(){return t},get resetNavigatorState(){return n}})},454,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=o(r(d[0]));return t=function(){return n},n}function n(t){if("function"!=typeof WeakMap)return null;var o=new WeakMap,u=new WeakMap;return(n=function(t){return t?u:o})(t)}function o(t,o){if(!o&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var u=n(o);if(u&&u.has(t))return u.get(t);var c={__proto__:null},f=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in t)if("default"!==l&&Object.prototype.hasOwnProperty.call(t,l)){var p=f?Object.getOwnPropertyDescriptor(t,l):null;p&&(p.get||p.set)?Object.defineProperty(c,l,p):c[l]=t[l]}return c.default=t,u&&u.set(t,c),c}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"NavigationBuilderContext",{enumerable:!0,get:function(){return u}});const u=t().createContext({handleAction:()=>{},resetNavigator:()=>{}})},455,[30]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=o(r(d[0]));return t=function(){return n},n}function n(t){if("function"!=typeof WeakMap)return null;var o=new WeakMap,u=new WeakMap;return(n=function(t){return t?u:o})(t)}function o(t,o){if(!o&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var u=n(o);if(u&&u.has(t))return u.get(t);var f={__proto__:null},c=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in t)if("default"!==l&&Object.prototype.hasOwnProperty.call(t,l)){var p=c?Object.getOwnPropertyDescriptor(t,l):null;p&&(p.get||p.set)?Object.defineProperty(f,l,p):f[l]=t[l]}return f.default=t,u&&u.set(t,f),f}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"NavigationStateContext",{enumerable:!0,get:function(){return u}});const u=t().createContext({isDefault:!0})},456,[30]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=u(r(d[0]));return t=function(){return n},n}function n(t){if("function"!=typeof WeakMap)return null;var u=new WeakMap,o=new WeakMap;return(n=function(t){return t?o:u})(t)}function u(t,u){if(!u&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var o=n(u);if(o&&o.has(t))return o.get(t);var c={__proto__:null},f=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if("default"!==s&&Object.prototype.hasOwnProperty.call(t,s)){var l=f?Object.getOwnPropertyDescriptor(t,s):null;l&&(l.get||l.set)?Object.defineProperty(c,s,l):c[s]=t[s]}return c.default=t,o&&o.set(t,c),c}function o(){const{current:n}=t().useRef({focus:[]}),u=t().useCallback((t,u)=>{n[t].push(u);let o=!1;return()=>{const c=n[t].indexOf(u);!o&&c>-1&&(o=!0,n[t].splice(c,1))}},[n]);return{listeners:n,addListener:u}}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"useChildListeners",{enumerable:!0,get:function(){return o}})},457,[30]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"useCurrentRender",{enumerable:!0,get:function(){return u}});const n=r(d[1]),o=r(d[2]);function u({state:u,descriptors:s}){const c=(0,t().use)(n.CurrentRenderContext),f=u.routes[u.index],p=(0,o.useIsRouteFocused)(void 0);c&&f&&p&&(c.options=s[f.key]?.options)}},458,[30,435,445]); +__d(function(g,r,_i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}function n(){const t=v(r(d[1]));return n=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"useDescriptors",{enumerable:!0,get:function(){return y}});const o=r(d[2]),i=r(d[3]),u=r(d[4]),s=r(d[5]),c=r(d[6]),l=r(d[7]),f=r(d[8]);function p(t){if("function"!=typeof WeakMap)return null;var n=new WeakMap,o=new WeakMap;return(p=function(t){return t?o:n})(t)}function v(t,n){if(!n&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var o=p(n);if(o&&o.has(t))return o.get(t);var i={__proto__:null},u=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if("default"!==s&&Object.prototype.hasOwnProperty.call(t,s)){var c=u?Object.getOwnPropertyDescriptor(t,s):null;c&&(c.get||c.set)?Object.defineProperty(i,s,c):i[s]=t[s]}return i.default=t,o&&o.set(t,i),i}function y({routes:p,routeNames:v,screens:y,activityEnabled:b,activityDefaultThreshold:k,navigation:O,screenOptions:j,screenLayout:N,state:P,addListener:_,router:w,emitter:x}){const C=(0,n().use)(c.ThemeContext),[M,S]=n().useState({}),{handleAction:D,resetNavigator:E}=(0,n().use)(i.NavigationBuilderContext),A=n().useMemo(()=>({navigation:O,handleAction:D,resetNavigator:E,addListener:_}),[O,D,E,_]),B=(0,l.useNavigationCache)({routes:p,routeNames:v,navigation:O,setOptions:S,router:w,emitter:x}),L=(0,f.useRouteCache)(p),T=n().useCallback((t,n,o)=>x.emit({type:n,target:t,data:{action:o}}),[x]),W=(t,n,o)=>{const i=y[t.name],u=i.props;return[j,...i.options?i.options.filter(Boolean):[],u.options,o].reduce((o,i)=>Object.assign(o,'function'!=typeof i?i:i({route:t,navigation:n,theme:C})),{})},R=(n,c,l,f)=>{const p=y[n.name],v=p.props,O=v.layout??p.layout??N;let j=(0,t().jsx)(s.SceneView,{navigation:c,route:n,screen:v,routeState:f,options:l,clearOptions:()=>S(t=>{if(n.key in t){const{[n.key]:o,...i}=t;return i}return t}),emitRemovalEvent:T});null!=O&&(j=O({route:n,navigation:c,options:l,theme:C,children:j}));const P=h(v.activityEnabled??b,k);return(0,t().jsx)(o.NavigationActivityProvider,{activityThreshold:P,children:(0,t().jsx)(i.NavigationBuilderContext.Provider,{value:A,children:(0,t().jsx)(u.NavigationProvider,{route:n,navigation:c,children:j})})},n.key)},V=L.reduce((t,n,o)=>{const i=B(n,!0===n.isPreloaded);if(void 0===y[n.name])return t[n.key]={route:n,navigation:i,options:{},render:()=>null},t;const u=W(n,i,M[n.key]),s=R(n,i,u,p[o].state);return t[n.key]={route:n,navigation:i,render:()=>s,options:u,routeSource:y[n.name]?.props.routeSource},t},{});return{describe:t=>{if(void 0!==t.key){const n=V[t.key];if(!n)throw new Error(`Couldn't find a route with the key ${t.key}.`);return n}const n=y[t.name];if(!n)return{route:t,navigation:B({key:t.name,name:t.name},!1),options:{},render:()=>null};const o=B({key:t.name,name:t.name},!1);return{route:t,navigation:o,options:W(t,o,{}),render:()=>null,routeSource:n.props.routeSource}},descriptors:V}}function h(t,n){if('number'==typeof t){if(Number.isNaN(t)||t<=0)return;return t}if(t)return Math.max(1,n)}},459,[24,30,460,455,444,461,446,466,437]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}function n(){const t=r(d[1]);return n=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get NavigationActivityProvider(){return u},get useActivityThreshold(){return c}});const o=(0,n().createContext)(void 0);function u({activityThreshold:n,children:u}){return(0,t().jsx)(o,{value:n,children:u})}function c(){return(0,n().use)(o)}},460,[24,30]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}function n(){const t=y(r(d[1]));return n=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"SceneView",{enumerable:!0,get:function(){return j}});const o=r(d[2]),u=r(d[3]),s=r(d[4]),c=r(d[5]),l=r(d[6]),p=r(d[7]),f=r(d[8]);function v(t){if("function"!=typeof WeakMap)return null;var n=new WeakMap,o=new WeakMap;return(v=function(t){return t?o:n})(t)}function y(t,n){if(!n&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var o=v(n);if(o&&o.has(t))return o.get(t);var u={__proto__:null},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var c in t)if("default"!==c&&Object.prototype.hasOwnProperty.call(t,c)){var l=s?Object.getOwnPropertyDescriptor(t,c):null;l&&(l.get||l.set)?Object.defineProperty(u,c,l):u[c]=t[c]}return u.default=t,o&&o.set(t,u),u}function j({screen:v,route:y,navigation:j,routeState:h,options:O,clearOptions:P,emitRemovalEvent:x}){const{addOptionsGetter:_}=(0,f.useOptionsGetters)({key:y.key,options:O});n().useEffect(()=>P,[]);const b=(0,n().use)(c.NavigationFocusedRouteStateContext),k=(0,n().use)(s.IsPreloadedContext)||!0===y.isPreloaded,C=n().useMemo(()=>{const t={routes:[{key:y.key,name:y.name,params:y.params,path:y.path}]},n=o=>{const u=o?.routes[0];return u?{routes:[{...u,state:n(u.state)}]}:t};return n(b)},[b,y.key,y.name,y.params,y.path]),M=n().useMemo(()=>({state:h,addOptionsGetter:_}),[h,_]),S=v.getComponent?v.getComponent():v.component;return(0,t().jsx)(s.IsPreloadedContext,{value:k,children:(0,t().jsx)(o.PreventRemovalProvider,{routeKey:y.key,emitRemovalEvent:x,children:(0,t().jsx)(l.NavigationStateContext.Provider,{value:M,children:(0,t().jsx)(c.NavigationFocusedRouteStateContext.Provider,{value:C,children:(0,t().jsx)(u.EnsureSingleNavigator,{children:(0,t().jsx)(p.StaticContainer,{name:v.name,render:S||v.children,navigation:j,route:y,children:void 0!==S?(0,t().jsx)(S,{navigation:j,route:y}):void 0!==v.children?v.children({navigation:j,route:y}):null})})})})})})}},461,[24,30,392,462,393,463,456,464,465]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}function n(){const t=u(r(d[1]));return n=function(){return t},t}function o(t){if("function"!=typeof WeakMap)return null;var n=new WeakMap,u=new WeakMap;return(o=function(t){return t?u:n})(t)}function u(t,n){if(!n&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var u=o(n);if(u&&u.has(t))return u.get(t);var c={__proto__:null},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var f in t)if("default"!==f&&Object.prototype.hasOwnProperty.call(t,f)){var l=s?Object.getOwnPropertyDescriptor(t,f):null;l&&(l.get||l.set)?Object.defineProperty(c,f,l):c[f]=t[f]}return c.default=t,u&&u.set(t,c),c}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get EnsureSingleNavigator(){return f},get SingleNavigatorContext(){return s}});const c="Another navigator is already registered for this container. You likely have multiple navigators under a single \"NavigationContainer\" or \"Screen\". Make sure each navigator is under a separate \"Screen\" container. See https://docs.expo.dev/router/advanced/nesting-navigators/ for a guide on nesting.",s=n().createContext(void 0);function f({children:o}){const u=n().useRef(void 0),f=n().useMemo(()=>({register(t){const n=u.current;if(void 0!==n&&t!==n)throw new Error(c);u.current=t},unregister(t){t===u.current&&(u.current=void 0)}}),[]);return(0,t().jsx)(s.Provider,{value:f,children:o})}},462,[24,30]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=o(r(d[0]));return t=function(){return n},n}function n(t){if("function"!=typeof WeakMap)return null;var o=new WeakMap,u=new WeakMap;return(n=function(t){return t?u:o})(t)}function o(t,o){if(!o&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var u=n(o);if(u&&u.has(t))return u.get(t);var c={__proto__:null},f=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var p in t)if("default"!==p&&Object.prototype.hasOwnProperty.call(t,p)){var l=f?Object.getOwnPropertyDescriptor(t,p):null;l&&(l.get||l.set)?Object.defineProperty(c,p,l):c[p]=t[p]}return c.default=t,u&&u.set(t,c),c}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"NavigationFocusedRouteStateContext",{enumerable:!0,get:function(){return u}});const u=t().createContext(void 0)},463,[30]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=o(r(d[0]));return t=function(){return n},n}function n(t){if("function"!=typeof WeakMap)return null;var o=new WeakMap,u=new WeakMap;return(n=function(t){return t?u:o})(t)}function o(t,o){if(!o&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var u=n(o);if(u&&u.has(t))return u.get(t);var c={__proto__:null},f=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in t)if("default"!==l&&Object.prototype.hasOwnProperty.call(t,l)){var p=f?Object.getOwnPropertyDescriptor(t,l):null;p&&(p.get||p.set)?Object.defineProperty(c,l,p):c[l]=t[l]}return c.default=t,u&&u.set(t,c),c}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"StaticContainer",{enumerable:!0,get:function(){return u}});const u=t().memo(function(t){return t.children},(t,n)=>{const o=Object.keys(t),u=Object.keys(n);if(o.length!==u.length)return!1;for(const u of o)if('children'!==u&&t[u]!==n[u])return!1;return!0})},464,[30]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=l(r(d[0]));return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"useOptionsGetters",{enumerable:!0,get:function(){return s}});const n=c(r(d[1])),u=r(d[2]),o=r(d[3]);function c(t){return t&&t.__esModule?t:{default:t}}function f(t){if("function"!=typeof WeakMap)return null;var n=new WeakMap,u=new WeakMap;return(f=function(t){return t?u:n})(t)}function l(t,n){if(!n&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var u=f(n);if(u&&u.has(t))return u.get(t);var o={__proto__:null},c=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in t)if("default"!==l&&Object.prototype.hasOwnProperty.call(t,l)){var s=c?Object.getOwnPropertyDescriptor(t,l):null;s&&(s.get||s.set)?Object.defineProperty(o,l,s):o[l]=t[l]}return o.default=t,u&&u.set(t,o),o}function s({key:c,options:f}){const l=t().useRef({}),{addOptionsGetter:s}=(0,t().use)(u.NavigationStateContext),p=(0,o.useIsRouteFocused)(c),O=t().useCallback(()=>{for(const t in l.current)if(t in l.current){const n=l.current[t]?.();if(null!==n)return n}return null},[]),y=(0,n.default)(()=>{if(!p)return null;const t=O();return null!==t?t:f});t().useEffect(()=>s?.(c,y),[y,s,c]);const _=t().useCallback((t,n)=>(l.current[t]=n,()=>{delete l.current[t]}),[]);return{addOptionsGetter:_,getCurrentOptions:y}}},465,[30,400,456,445]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=c(r(d[0]));return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"useNavigationCache",{enumerable:!0,get:function(){return u}});const n=r(d[1]);r(d[2]);function o(t){if("function"!=typeof WeakMap)return null;var n=new WeakMap,c=new WeakMap;return(o=function(t){return t?c:n})(t)}function c(t,n){if(!n&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var c=o(n);if(c&&c.has(t))return c.get(t);var u={__proto__:null},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var f in t)if("default"!==f&&Object.prototype.hasOwnProperty.call(t,f)){var p=s?Object.getOwnPropertyDescriptor(t,f):null;p&&(p.get||p.set)?Object.defineProperty(u,f,p):u[f]=t[f]}return u.default=t,c&&c.set(t,u),u}function u({routes:o,routeNames:c,navigation:u,setOptions:s,router:f,emitter:p}){const y=t().useMemo(()=>({current:{}}),[u,s,p]),l=[...o.map(t=>t.key),...c],O=new Set(l.flatMap(t=>[t,`p\0${t}`]));y.current=Object.fromEntries(Object.entries(y.current).filter(([t])=>O.has(t)));const k=(t,o)=>{const c=n=>{o||u.dispatch({source:t.key,...n})},y={...f.actionCreators,...n.CommonActions},l=Object.keys(y).reduce((t,n)=>(t[n]=(...t)=>c(y[n](...t)),t),{}),{emit:O,...k}=u,b={...k,...l,...p.create(t.key),dispatch:c,dispatchSync:n=>{o||u.dispatchSync({source:t.key,...n})},getParent:t=>void 0!==t&&t===k.getId()?b:k.getParent(t),setOptions:n=>{s(o=>({...o,[t.key]:{...o[t.key],...n}}))},isFocused:()=>{const n=k.getState();return n.routes[n.index]?.key===t.key&&(!u||u.isFocused())}};return b};return(t,n)=>{const o=`${n?'p\0':''}${t.key}`,c=y.current[o];if(c)return c;const u=k(t,n);return y.current[o]=u,u}}},466,[30,358,467]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=o(r(d[0]));return t=function(){return n},n}function n(t){if("function"!=typeof WeakMap)return null;var o=new WeakMap,u=new WeakMap;return(n=function(t){return t?u:o})(t)}function o(t,o){if(!o&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var u=n(o);if(u&&u.has(t))return u.get(t);var f={__proto__:null},c=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var _ in t)if("default"!==_&&Object.prototype.hasOwnProperty.call(t,_)){var l=c?Object.getOwnPropertyDescriptor(t,_):null;l&&(l.get||l.set)?Object.defineProperty(f,_,l):f[_]=t[_]}return f.default=t,u&&u.set(t,f),f}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"isRenderingComponent",{enumerable:!0,get:function(){return f}});const u=t().__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function f(){return null!=u?.A?.getOwner?.()}},467,[30]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(){const t=c(r(d[0]));return e=function(){return t},t}Object.defineProperty(_e,"__esModule",{value:!0}),Object.defineProperty(_e,"useEventEmitter",{enumerable:!0,get:function(){return o}});const t=n(r(d[1]));function n(e){return e&&e.__esModule?e:{default:e}}function u(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(u=function(e){return e?n:t})(e)}function c(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=u(t);if(n&&n.has(e))return n.get(e);var c={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in e)if("default"!==l&&Object.prototype.hasOwnProperty.call(e,l)){var f=o?Object.getOwnPropertyDescriptor(e,l):null;f&&(f.get||f.set)?Object.defineProperty(c,l,f):c[l]=e[l]}return c.default=e,n&&n.set(e,c),c}function o(n){const u=(0,t.default)(e=>n?.(e)),c=e().useRef(Object.create(null)),o=e().useCallback(e=>{const t=(t,n)=>{const u=c.current[t]?c.current[t][e]:void 0;u&&u.delete(n)};return{addListener:(n,u)=>{c.current[n]=c.current[n]||{},c.current[n][e]=c.current[n][e]||new Set,c.current[n][e].add(u);let o=!1;return()=>{o||(o=!0,t(n,u))}},removeListener:t}},[]),l=e().useCallback(({type:e,data:t,target:n,canPreventDefault:o,preventDefault:l})=>{const f=c.current[e]||{},p=void 0!==n?[...f[n]??[]]:[...new Set(Object.keys(f).flatMap(e=>[...f[e]]))],s={get type(){return e}};if(void 0!==n&&Object.defineProperty(s,'target',{enumerable:!0,get:()=>n}),void 0!==t&&Object.defineProperty(s,'data',{enumerable:!0,get:()=>t}),o){let e=!1;Object.defineProperties(s,{defaultPrevented:{enumerable:!0,get:()=>e},preventDefault:{enumerable:!0,value(){e=!0}}})}else l&&Object.defineProperties(s,{defaultPrevented:{enumerable:!0,value:!1},preventDefault:{enumerable:!0,value:l}});return u(s),p?.forEach(e=>e(s)),s},[u]);return e().useMemo(()=>({create:o,emit:l}),[o,l])}},468,[30,400]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=o(r(d[0]));return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"useFocusEvents",{enumerable:!0,get:function(){return c}});const n=r(d[1]);function u(t){if("function"!=typeof WeakMap)return null;var n=new WeakMap,o=new WeakMap;return(u=function(t){return t?o:n})(t)}function o(t,n){if(!n&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var o=u(n);if(o&&o.has(t))return o.get(t);var c={__proto__:null},f=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if("default"!==s&&Object.prototype.hasOwnProperty.call(t,s)){var p=f?Object.getOwnPropertyDescriptor(t,s):null;p&&(p.get||p.set)?Object.defineProperty(c,s,p):c[s]=t[s]}return c.default=t,o&&o.set(t,c),c}function c({state:u,emitter:o}){const c=(0,t().use)(n.NavigationContext),f=t().useRef(void 0),s=t().useRef(!1),p=u.routes[u.index]?.key;t().useEffect(()=>{if(void 0!==p)return c?.addListener('focus',()=>{s.current&&f.current===p||(f.current=p,s.current=!0,o.emit({type:'focus',target:p}))})},[p,o,c]),t().useEffect(()=>{if(void 0!==p)return c?.addListener('blur',()=>{f.current=void 0,s.current=!1,o.emit({type:'blur',target:p})})},[p,o,c]),t().useEffect(()=>{const t=f.current;void 0!==p&&(f.current=p,void 0!==t||c&&!c.isFocused()||(s.current=!0,o.emit({type:'focus',target:p})),t===p||c&&!c.isFocused()||void 0!==t&&(o.emit({type:'blur',target:t}),s.current=!0,o.emit({type:'focus',target:p})))},[p,o,c])}},469,[30,440]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=o(r(d[0]));return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"useFocusedListenersChildrenAdapter",{enumerable:!0,get:function(){return f}});const n=r(d[1]);function u(t){if("function"!=typeof WeakMap)return null;var n=new WeakMap,o=new WeakMap;return(u=function(t){return t?o:n})(t)}function o(t,n){if(!n&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var o=u(n);if(o&&o.has(t))return o.get(t);var f={__proto__:null},c=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if("default"!==s&&Object.prototype.hasOwnProperty.call(t,s)){var l=c?Object.getOwnPropertyDescriptor(t,s):null;l&&(l.get||l.set)?Object.defineProperty(f,s,l):f[s]=t[s]}return f.default=t,o&&o.set(t,f),f}function f({navigation:u,focusedListeners:o}){const{addListener:f}=(0,t().use)(n.NavigationBuilderContext),c=t().useCallback(t=>{if(u.isFocused()){for(const n of o){const{handled:u,result:o}=n(t);if(u)return{handled:u,result:o}}return{handled:!0,result:t(u)}}return{handled:!1,result:null}},[o,u]);t().useEffect(()=>f?.('focus',c),[f,c])}},470,[30,455]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=u(r(d[0]));return t=function(){return n},n}function n(t){if("function"!=typeof WeakMap)return null;var u=new WeakMap,o=new WeakMap;return(n=function(t){return t?o:u})(t)}function u(t,u){if(!u&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var o=n(u);if(o&&o.has(t))return o.get(t);var c={__proto__:null},f=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in t)if("default"!==l&&Object.prototype.hasOwnProperty.call(t,l)){var p=f?Object.getOwnPropertyDescriptor(t,l):null;p&&(p.get||p.set)?Object.defineProperty(c,l,p):c[l]=t[l]}return c.default=t,o&&o.set(t,c),c}function o(n){const u=t().useRef(void 0);return void 0===u.current&&(u.current=n()),u.current}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"useLazyValue",{enumerable:!0,get:function(){return o}})},471,[30]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=p(r(d[0]));return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"useNavigationHelpers",{enumerable:!0,get:function(){return y}});const n=r(d[1]),o=f(r(d[2])),u=r(d[3]),c=r(d[4]),s=r(d[5]);function f(t){return t&&t.__esModule?t:{default:t}}function l(t){if("function"!=typeof WeakMap)return null;var n=new WeakMap,o=new WeakMap;return(l=function(t){return t?o:n})(t)}function p(t,n){if(!n&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var o=l(n);if(o&&o.has(t))return o.get(t);var u={__proto__:null},c=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if("default"!==s&&Object.prototype.hasOwnProperty.call(t,s)){var f=c?Object.getOwnPropertyDescriptor(t,s):null;f&&(f.get||f.set)?Object.defineProperty(u,s,f):u[s]=t[s]}return u.default=t,o&&o.set(t,u),u}function y({id:f,handleAction:l,state:p,emitter:y,router:O}){const _=(0,t().use)(s.NavigationContext),b=(0,n.useEnqueueRoutingIntent)(),v=(0,o.default)(()=>p);return t().useMemo(()=>{const t=t=>{b({type:'ACTION',payload:{action:t,originKey:v().key}})},n={...O.actionCreators,...u.CommonActions},o=Object.keys(n).reduce((o,u)=>(o[u]=(...o)=>t(n[u](...o)),o),{}),s={..._,...o,dispatch:t,dispatchSync:t=>{l(t)},emit:y.emit,isFocused:_?_.isFocused:()=>!0,canGoBack:()=>{const t=v(),n=O.getStateForAction(t,u.CommonActions.goBack(),{routeNames:t.routeNames,routeGetIdList:{}});return(0,c.isActionHandled)(n)||_?.canGoBack()||!1},getId:()=>f,getParent:t=>{if(void 0!==t){let n=s;for(;n&&t!==n.getId();)n=n.getParent();return n}return _},getState:()=>v()};return s},[b,O,_,y.emit,l,f])}r(d[6]).PrivateValueStore},472,[30,375,400,358,366,440,449]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=o(r(d[0]));return t=function(){return n},n}function n(t){if("function"!=typeof WeakMap)return null;var o=new WeakMap,u=new WeakMap;return(n=function(t){return t?u:o})(t)}function o(t,o){if(!o&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var u=n(o);if(u&&u.has(t))return u.get(t);var c={__proto__:null},f=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in t)if("default"!==l&&Object.prototype.hasOwnProperty.call(t,l)){var p=f?Object.getOwnPropertyDescriptor(t,l):null;p&&(p.get||p.set)?Object.defineProperty(c,l,p):c[l]=t[l]}return c.default=t,u&&u.set(t,c),c}function u(n){const o=(0,t().use)(c);if(null==o)throw new Error("Couldn't get the navigation state. Is your component inside a navigator?");return n(o)}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get NavigatorStateContext(){return c},get useNavigationState(){return u}});const c=t().default.createContext(void 0)},473,[30]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}function n(){const t=c(r(d[1]));return n=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"useRegisterNavigator",{enumerable:!0,get:function(){return f}});const o=r(d[2]);function u(t){if("function"!=typeof WeakMap)return null;var n=new WeakMap,o=new WeakMap;return(u=function(t){return t?o:n})(t)}function c(t,n){if(!n&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var o=u(n);if(o&&o.has(t))return o.get(t);var c={__proto__:null},f=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if("default"!==s&&Object.prototype.hasOwnProperty.call(t,s)){var p=f?Object.getOwnPropertyDescriptor(t,s):null;p&&(p.get||p.set)?Object.defineProperty(c,s,p):c[s]=t[s]}return c.default=t,o&&o.set(t,c),c}function f(){const[u]=n().useState(()=>(0,t().nanoid)()),c=(0,n().use)(o.SingleNavigatorContext);if(void 0===c)throw new Error("Couldn't register the navigator. Have you wrapped your app with 'NavigationContainer'?\n\nThis can also happen if there are multiple copies of '@react-navigation' packages installed.");n().useEffect(()=>{const{register:t,unregister:n}=c;return t(u),()=>n(u)},[c,u])}},474,[397,30,462]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=o(r(d[0]));return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"useNavigationContainerRef",{enumerable:!0,get:function(){return c}});const n=r(d[1]);function u(t){if("function"!=typeof WeakMap)return null;var n=new WeakMap,o=new WeakMap;return(u=function(t){return t?o:n})(t)}function o(t,n){if(!n&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var o=u(n);if(o&&o.has(t))return o.get(t);var c={__proto__:null},f=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in t)if("default"!==l&&Object.prototype.hasOwnProperty.call(t,l)){var p=f?Object.getOwnPropertyDescriptor(t,l):null;p&&(p.get||p.set)?Object.defineProperty(c,l,p):c[l]=t[l]}return c.default=t,o&&o.set(t,c),c}function c(){const u=t().useRef(null);return null==u.current&&(u.current=(0,n.createNavigationContainerRef)()),u.current}},475,[30,357]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=v(r(d[0]));return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"usePreventRemove",{enumerable:!0,get:function(){return _}});const n=r(d[1]),o=l(r(d[2])),u=r(d[3]),f=r(d[4]),c=r(d[5]),s=r(d[6]);function l(t){return t&&t.__esModule?t:{default:t}}function p(t){if("function"!=typeof WeakMap)return null;var n=new WeakMap,o=new WeakMap;return(p=function(t){return t?o:n})(t)}function v(t,n){if(!n&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var o=p(n);if(o&&o.has(t))return o.get(t);var u={__proto__:null},f=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var c in t)if("default"!==c&&Object.prototype.hasOwnProperty.call(t,c)){var s=f?Object.getOwnPropertyDescriptor(t,c):null;s&&(s.get||s.set)?Object.defineProperty(u,c,s):u[c]=t[c]}return u.default=t,o&&o.set(t,u),u}const y=()=>{},P=()=>y;function _(l,p,v){const y=t().useId(),_=(0,c.useNavigation)(),O=t().use(n.ScreenRemovalPreventionSetterContext),b=t().use(u.IsPreloadedContext),j=P(l),w=v?.preventInPreloadedRoutes??!1,M=l&&(!b||w),h=(0,s.usePreventBeforeUnload)(M);if(void 0===O)throw new Error("Couldn't find the prevent remove context. Is your component inside Screen or Layout?");(0,f.useClientLayoutEffect)(()=>(O(y,l,w),()=>{O(y,!1,w)}),[y,w,l,O]);const C=(0,o.default)(()=>{h(),O(y,!1,w),j()}),I=(0,o.default)(t=>{l&&p&&p({data:t.data,repeat:()=>{C(),_.dispatch(t.data.action)}})});return t().useEffect(()=>_.addListener('removePrevented',I),[_,I]),C}},476,[30,392,400,393,376,451,477]); +__d(function(g,r,i,a,m,e,d){"use strict";function n(){const t=r(d[0]);return n=function(){return t},t}function t(t){const u=(0,n().useRef)(!1),o=(0,n().useEffectEvent)(n=>{t&&!u.current&&(n.preventDefault(),n.returnValue=!0)});return(0,n().useEffect)(()=>{if(u.current=!1,!t)return;const n=n=>o(n);return window.addEventListener('beforeunload',n),()=>window.removeEventListener('beforeunload',n)},[t]),(0,n().useCallback)(()=>{u.current=!0},[])}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"usePreventBeforeUnload",{enumerable:!0,get:function(){return t}})},477,[30]); +__d(function(g,r,i,a,m,e,d){"use strict";function n(){const t=r(d[0]);return n=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"useRoute",{enumerable:!0,get:function(){return o}});const t=r(d[1]);function o(){const o=(0,n().use)(t.NavigationRouteContext);if(void 0===o)throw new Error("Couldn't find a route object. Is your component inside a screen in a navigator?");return o}},478,[30,444]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"useStateForPath",{enumerable:!0,get:function(){return u}});const n=r(d[1]);function u(){return(0,t().use)(n.NavigationFocusedRouteStateContext)}},479,[30,463]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=o(r(d[0]));return t=function(){return n},n}function n(t){if("function"!=typeof WeakMap)return null;var o=new WeakMap,u=new WeakMap;return(n=function(t){return t?u:o})(t)}function o(t,o){if(!o&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var u=n(o);if(u&&u.has(t))return u.get(t);var f={__proto__:null},c=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var p in t)if("default"!==p&&Object.prototype.hasOwnProperty.call(t,p)){var l=c?Object.getOwnPropertyDescriptor(t,p):null;l&&(l.get||l.set)?Object.defineProperty(f,p,l):f[p]=t[p]}return f.default=t,u&&u.set(t,f),f}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"ServerContext",{enumerable:!0,get:function(){return u}});const u=t().createContext(void 0)},480,[30]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"DarkTheme",{enumerable:!0,get:function(){return t}});const t={dark:!0,colors:{primary:'rgb(10, 132, 255)',background:'rgb(1, 1, 1)',card:'rgb(18, 18, 18)',text:'rgb(229, 229, 231)',border:'rgb(39, 39, 41)',notification:'rgb(255, 69, 58)'},fonts:r(d[0]).fonts}},481,[482]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const o=r(d[0]);return t=function(){return o},o}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"fonts",{enumerable:!0,get:function(){return n}});const o='system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',n=t().Platform.select({web:{regular:{fontFamily:o,fontWeight:'400'},medium:{fontFamily:o,fontWeight:'500'},bold:{fontFamily:o,fontWeight:'600'},heavy:{fontFamily:o,fontWeight:'700'}},ios:{regular:{fontFamily:'System',fontWeight:'400'},medium:{fontFamily:'System',fontWeight:'500'},bold:{fontFamily:'System',fontWeight:'600'},heavy:{fontFamily:'System',fontWeight:'700'}},default:{regular:{fontFamily:'sans-serif',fontWeight:'normal'},medium:{fontFamily:'sans-serif-medium',fontWeight:'normal'},bold:{fontFamily:'sans-serif',fontWeight:'600'},heavy:{fontFamily:'sans-serif',fontWeight:'700'}}})},482,[33]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"DefaultTheme",{enumerable:!0,get:function(){return t}});const t={dark:!1,colors:{primary:'rgb(0, 122, 255)',background:'rgb(242, 242, 242)',card:'rgb(255, 255, 255)',text:'rgb(28, 28, 30)',border:'rgb(216, 216, 216)',notification:'rgb(255, 59, 48)'},fonts:r(d[0]).fonts}},483,[482]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},484,[]); +__d(function(g,_r,i,a,m,e,d){"use strict";function t(){const n=s(_r(d[0]));return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var r in n)Object.defineProperty(t,r,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,r).get})})(e,{get useBuildAction(){return f},get useBuildHref(){return c},get useLinkBuilder(){return h}});const n=_r(d[1]),r=_r(d[2]),o=_r(d[3]);function u(t){if("function"!=typeof WeakMap)return null;var n=new WeakMap,r=new WeakMap;return(u=function(t){return t?r:n})(t)}function s(t,n){if(!n&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var r=u(n);if(r&&r.has(t))return r.get(t);var o={__proto__:null},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var c in t)if("default"!==c&&Object.prototype.hasOwnProperty.call(t,c)){var f=s?Object.getOwnPropertyDescriptor(t,c):null;f&&(f.get||f.set)?Object.defineProperty(o,c,f):o[c]=t[c]}return o.default=t,r&&r.set(t,o),o}function c(){const u=(0,t().use)(n.NavigationHelpersContext),s=(0,t().use)(n.NavigationRouteContext),c=(0,t().use)(r.NavigatorStateContext),{options:f}=(0,t().use)(o.LinkingContext),l=(0,n.useStateForPath)(),p=f?.getPathFromState??n.getPathFromState;return t().useCallback((t,r)=>{const o=!!(u&&s?.key&&l)&&(s.key===(0,n.findFocusedRoute)(l)?.key&&c?.routes.some(t=>t.key===s.key)),y={routes:[{name:t,params:r}]},h=t=>{if(t){const n=t.routes[0];return o&&!n.state?y:{routes:[{...n,state:h(n.state)}]}}return y},v=h(l);return p(v,f?.config)},[f?.config,s?.key,u,c,l,p])}const f=()=>{const{options:r}=(0,t().use)(o.LinkingContext),u=r?.getStateFromPath??n.getStateFromPath;return t().useCallback(t=>{if(!t.startsWith('/'))throw new Error(`The href must start with '/' (${t}).`);const n=u(t,r?.config);if(n){const t=r?.config?y(r.config):void 0,o=null!=n.index?n.routes.slice(0,n.index+1):n.routes;if(1!==o.length&&(2!==o.length||o[0].name!==t?.initialRouteName))return{type:'RESET',payload:l(n)};const u=o[o.length-1];if(!u)throw new Error('Failed to parse the href to a navigation state.');return{type:'NAVIGATE',payload:{name:u.name,...void 0!==u.params?{params:u.params}:void 0,...void 0!==u.path?{path:u.path}:void 0,...void 0!==u.state?{state:l(u.state)}:void 0,...void 0!==u.state||p(r?.config,u.name)?{pop:!0}:void 0}}}throw new Error('Failed to parse the href to a navigation state.')},[r?.config,u])};function l(t){return{...t,__internal__routerActionState:!0}}function p(t,n){const r=t?.screens?.[n];return'object'==typeof r&&void 0!==r.screens&&Object.keys(r.screens).length>0}function y(t){return'object'==typeof t&&null!==t?{initialRouteName:t.initialRouteName,screens:t.screens?(n=t.screens,Object.fromEntries(Object.entries(n).map(([t,n])=>[t,y('string'==typeof n||'object'==typeof n&&null!==n?n:'')]))):void 0}:{};var n}function h(){return{buildHref:c(),buildAction:f()}}},485,[30,431,473,428]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=c(r(d[0]));return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"useLinkTo",{enumerable:!0,get:function(){return f}});const n=r(d[1]),o=r(d[2]);function u(t){if("function"!=typeof WeakMap)return null;var n=new WeakMap,o=new WeakMap;return(u=function(t){return t?o:n})(t)}function c(t,n){if(!n&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var o=u(n);if(o&&o.has(t))return o.get(t);var c={__proto__:null},f=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in t)if("default"!==l&&Object.prototype.hasOwnProperty.call(t,l)){var s=f?Object.getOwnPropertyDescriptor(t,l):null;s&&(s.get||s.set)?Object.defineProperty(c,l,s):c[l]=t[l]}return c.default=t,o&&o.set(t,c),c}function f(){const u=t().useContext(n.NavigationContainerRefContext),c=(0,o.useBuildAction)();return t().useCallback(t=>{if(void 0===u)throw new Error("Couldn't find a navigation object. Is your component inside NavigationContainer?");const n=c(t);u.dispatch(n)},[c,u])}},486,[30,431,485]); +__d(function(g,r,i,a,m,e,d){"use strict";function n(){const t=r(d[0]);return n=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"useLocale",{enumerable:!0,get:function(){return o}});const t=r(d[1]);function o(){const o=(0,n().use)(t.LocaleDirContext);if(void 0===o)throw new Error("Couldn't determine the text direction. Is your component inside NavigationContainer?");return{direction:o}}},487,[30,429]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=f(r(d[0]));return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"useRoutePath",{enumerable:!0,get:function(){return s}});const n=r(d[1]),o=r(d[2]),u=r(d[3]);function c(t){if("function"!=typeof WeakMap)return null;var n=new WeakMap,o=new WeakMap;return(c=function(t){return t?o:n})(t)}function f(t,n){if(!n&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var o=c(n);if(o&&o.has(t))return o.get(t);var u={__proto__:null},f=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if("default"!==s&&Object.prototype.hasOwnProperty.call(t,s)){var p=f?Object.getOwnPropertyDescriptor(t,s):null;p&&(p.get||p.set)?Object.defineProperty(u,s,p):u[s]=t[s]}return u.default=t,o&&o.set(t,u),u}function s(){const{options:c}=(0,t().use)(u.LinkingContext),f=(0,o.useStateForPath)();if(void 0===f)throw new Error("Couldn't find a state for the route object. Is your component inside a screen in a navigator?");const s=c?.getPathFromState??n.getPathFromState;return t().useMemo(()=>s(f,c?.config),[c?.config,f,s])}},488,[30,412,431,428]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(){const t=c(r(d[0]));return e=function(){return t},t}Object.defineProperty(_e,"__esModule",{value:!0}),Object.defineProperty(_e,"useScrollToTop",{enumerable:!0,get:function(){return l}});const t=r(d[1]),n=r(d[2]);function o(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(o=function(e){return e?n:t})(e)}function c(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=o(t);if(n&&n.has(e))return n.get(e);var c={__proto__:null},u=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in e)if("default"!==l&&Object.prototype.hasOwnProperty.call(e,l)){var s=u?Object.getOwnPropertyDescriptor(e,l):null;s&&(s.get||s.set)?Object.defineProperty(c,l,s):c[l]=e[l]}return c.default=e,n&&n.set(e,c),c}function u(e){return null==e.current?null:'scrollToTop'in e.current||'scrollTo'in e.current||'scrollToOffset'in e.current||'scrollResponderScrollTo'in e.current?e.current:'getScrollResponder'in e.current?e.current.getScrollResponder():'getNode'in e.current?e.current.getNode():e.current}function l(o){const c=(0,e().use)(t.NavigationContext),l=(0,e().use)(n.NavigatorStateContext),s=(0,t.useRoute)(),f='tab'===l?.type,p=l?.routes[0]?.key;if(void 0===c)throw new Error("Couldn't find a navigation object. Is your component inside NavigationContainer?");e().useEffect(()=>{const e=e=>{const t=c.isFocused(),n=f||p===s.key;requestAnimationFrame(()=>{const c=u(o);t&&n&&c&&!e.defaultPrevented&&('scrollToTop'in c?c.scrollToTop():'scrollTo'in c?c.scrollTo({y:0,animated:!0}):'scrollToOffset'in c?c.scrollToOffset({offset:0,animated:!0}):'scrollResponderScrollTo'in c&&c.scrollResponderScrollTo({y:0,animated:!0}))})},t=[];let n=c;for(;n;)t.push(n.addListener('tabPress',e)),n=n.getParent();return()=>{t.forEach(e=>e())}},[p,f,c,o,s.key])}},489,[30,431,473]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"useNavigationContainerRef",{enumerable:!0,get:function(){return t}});const n=r(d[0]);function t(){return n.navigationRef}},490,[356]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"useRouter",{enumerable:!0,get:function(){return o}});const s=r(d[0]),t=r(d[1]),n={back:()=>{},canGoBack:()=>!1,push:()=>{},navigate:()=>{},replace:()=>{},dismiss:()=>{},dismissTo:()=>{},dismissAll:()=>{},canDismiss:()=>!1,setParams:()=>{},reload:()=>{},prefetch:()=>{},setTransitionMode:()=>{}};function o(){const{isPreview:o}=(0,t.usePreviewInfo)(),c=(0,s.useRouterActions)();return o?n:c}},491,[298,421]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"useUnstableGlobalHref",{enumerable:!0,get:function(){return n}});const t=r(d[0]);function n(){return(0,t.useRouteInfo)().unstable_globalHref}},492,[420]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"useSegments",{enumerable:!0,get:function(){return n}});const t=r(d[0]);function n(){return(0,t.useRouteInfo)().segments}},493,[420]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"usePathname",{enumerable:!0,get:function(){return n}});const t=r(d[0]);function n(){return(0,t.useRouteInfo)().pathname}},494,[420]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"useGlobalSearchParams",{enumerable:!0,get:function(){return n}});const t=r(d[0]);function n(){return(0,t.useRouteInfo)().params}},495,[420]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=o(r(d[0]));return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"useLocalSearchParams",{enumerable:!0,get:function(){return c}});const n=r(d[1]),u=r(d[2]);function o(t){return t&&t.__esModule?t:{default:t}}function c(){const o=t().default.use(n.LocalRouteParamsContext)??{},{params:c}=(0,u.usePreviewInfo)();return Object.fromEntries(Object.entries(c??o).map(([t,n])=>{if(null==n)return[t,n];if(Array.isArray(n))return[t,n.map(t=>{try{return decodeURIComponent(t)}catch{return t}})];try{return[t,decodeURIComponent(n)]}catch{return[t,n]}}))}},496,[30,403,421]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=o(r(d[0]));return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"useSearchParams",{enumerable:!0,get:function(){return c}});const n=r(d[1]),s=r(d[2]);function o(t){return t&&t.__esModule?t:{default:t}}function c({global:o=!1}={}){const[c]=t().default.useState(o),l=o?(0,n.useGlobalSearchParams)():(0,s.useLocalSearchParams)(),h=Object.entries(l).flatMap(([t,n])=>void 0===n?[]:Array.isArray(n)?n.map(n=>[t,n]):[[t,n]]);return new u(h)}class u extends URLSearchParams{set(){throw new Error('The URLSearchParams object return from useSearchParams is read-only')}append(){throw new Error('The URLSearchParams object return from useSearchParams is read-only')}delete(){throw new Error('The URLSearchParams object return from useSearchParams is read-only')}}},497,[30,495,496]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const o=r(d[0]);return t=function(){return o},o}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"useLoaderData",{enumerable:!0,get:function(){return _}});const o=r(d[1]),n=r(d[2]),s=r(d[3]),u=r(d[4]),c=r(d[5]),f=r(d[6]),l=r(d[7]);function _(){const _=(0,t().use)(n.LoaderContext),L=(0,t().use)(s.ServerDataLoaderContext),{client:h,store:b}=_,v=(0,l.useCurrentRouteInfo)(),P=(0,o.useContextKey)(),D=(0,t().useMemo)(()=>(0,c.resolveLoaderPath)(P,v),[P,v]),[,O]=(0,t().useState)(0);if(!L){const t=globalThis.__EXPO_ROUTER_LOADER_DATA__;t&&D in t&&(b.seed(D,t[D]),delete t[D])}const C=b.get(D);if((0,t().useEffect)(()=>{h.registerFetcher(D,f.fetchLoader);const t=h.subscribeLoader(D,(t,o)=>{o&&(b.set(D,t),O(t=>t+1))},{committed:!0});return b.get(D)!==C&&O(t=>t+1),()=>{b.dispose(D),t(()=>b.teardown(D))}},[h,D,b]),L)return L[D];const E=(0,u.readLoaderData)(_,D,f.fetchLoader);return(0,t().use)(E instanceof Promise?E:{status:'fulfilled',value:R=E,then:t=>Promise.resolve(R).then(t)});var R}},498,[30,403,499,503,504,505,502,507]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get LoaderContext(){return s},get createLoaderContextValue(){return u},get defaultLoaderContextValue(){return c}});const n=r(d[1]),o=r(d[2]);r(d[3]);function u(t){return{client:t,store:new o.LoaderSuspenseStore}}const c=u(new n.LoaderClient),s=(0,t().createContext)(c)},499,[30,500,501,502]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"LoaderClient",{enumerable:!0,get:function(){return t}});class t{active=new Map;fetchers=new Map;subscribeLoader(t,s=()=>{},{committed:o=!1}={}){const c=this.getOrCreateSource(t),n={callback:s,committed:o};c.onTeardown=void 0,c.subscribers.add(n);let l=!0;return s=>{l&&(l=!1,c.subscribers.delete(n),0===c.subscribers.size&&this.scheduleTeardown(t,c,s))}}registerFetcher(t,s){this.fetchers.set(t,s)}abort(t){const s=this.active.get(t);if(!s)return!1;return![...s.subscribers].some(t=>t.committed)&&(this.active.delete(t),s.onTeardown=void 0,s.subscribers.clear(),this.abortSourceRequest(s),!0)}execute(t,s){s&&this.fetchers.set(t,s);const o=this.active.get(t),c=this.fetchers.get(t);if(!o||!c||o.controller)return;const n=new AbortController;let l;o.controller=n;try{l=c(t,{signal:n.signal})}catch(t){l=Promise.reject(t)}l.then(s=>this.settle(t,o,n,{data:s}),s=>this.settle(t,o,n,{error:new Error(`Failed to load loader data for route: ${t}`,{cause:s})}))}revalidate(){const t=new Set;for(const[s,o]of this.active)o.subscribers.size>0?(t.add(s),this.abortSourceRequest(o),this.execute(s)):(this.active.delete(s),o.onTeardown=void 0,o.subscribers.clear(),this.abortSourceRequest(o));return t}clear(){const t=[...this.active.values()];this.active.clear(),this.fetchers.clear();for(const s of t)s.onTeardown=void 0,s.subscribers.clear(),this.abortSourceRequest(s)}getOrCreateSource(t){let s=this.active.get(t);return s||(s={subscribers:new Set,controller:null},this.active.set(t,s)),s}scheduleTeardown(t,s,o){const c=()=>{s.onTeardown===c&&0===s.subscribers.size&&this.active.get(t)===s&&(this.active.delete(t),s.onTeardown=void 0,this.abortSourceRequest(s),o?.())};s.onTeardown=c,queueMicrotask(c)}abortSourceRequest(t){const s=t.controller;t.controller=null,s?.abort()}settle(t,s,o,c){if(s.controller===o&&(s.controller=null),o.signal.aborted)return;const n=this.active.get(t)===s;for(const{callback:t}of s.subscribers)t(c,n)}}},500,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"LoaderSuspenseStore",{enumerable:!0,get:function(){return t}});class t{entries=new Map;reclaim=new Set;get(t){return this.entries.get(t)}set(t,s){this.reclaim.delete(t),this.entries.set(t,s)}seed(t,s){this.entries.has(t)||this.set(t,{data:s})}clear(t){this.reclaim.delete(t),this.entries.delete(t)}dispose(t){this.reclaim.add(t)}teardown(t){this.reclaim.delete(t)&&this.entries.delete(t)}retain(t){for(const s of this.entries.keys())t.has(s)||this.clear(s)}reset(){this.entries.clear(),this.reclaim.clear()}}},501,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get bumpDevLoaderRevision(){return o},get fetchLoader(){return c},get getLoaderModulePath(){return n}});const t=r(d[0]);function n(n){const{pathname:o,search:c}=(0,t.parseUrlUsingCustomBase)(n),s='/'===o?'/':o.replace(/\/$/,'');return`/_expo/loaders${'/'===s?'/index':s}${c}`}function o(){0}async function c(t,o={}){let c=n(t);const s=new Headers(o.headers);s.set('Accept','application/json');const u=await fetch(c,{...o,headers:s});if(!u.ok)throw new Error(`Failed to fetch loader data: ${u.status}`);try{return await u.json()}catch(t){throw new Error(`Failed to parse loader data: ${t}`)}}},502,[355]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"ServerDataLoaderContext",{enumerable:!0,get:function(){return n}});const n=(0,t().createContext)(null)},503,[30]); +__d(function(g,r,i,a,m,e,d){"use strict";function t({client:t,store:n},o,c){const s=n.get(o);if(s instanceof Promise)return s;if(s){if('error'in s)throw queueMicrotask(()=>{n.get(o)===s&&n.clear(o)}),s.error;return s.data}const u=new Promise((s,f)=>{const b=t.subscribeLoader(o,(t,c)=>{c&&n.get(o)===u&&n.set(o,t),b(),'error'in t?f(t.error):s(t.data)});t.execute(o,c)});return n.set(o,u),u}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"readLoaderData",{enumerable:!0,get:function(){return t}})},504,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"resolveLoaderPath",{enumerable:!0,get:function(){return n}});const t=r(d[0]);function n(n,s){const o=n.startsWith('/')?n.slice(1):n,c=`/${(0,t.getSingularId)(o,{params:s?.params??{}})}`,u=s?.searchParams?.toString()||'';return u?`${c}?${u}`:c}},505,[506]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(t,n={}){return t.split('/').map(t=>t.startsWith('[...')?n.params?.[t.slice(4,-1)]?.join('/')||t:t.startsWith('[')&&t.endsWith(']')&&n.params?.[t.slice(1,-1)]||t).join('/')}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"getSingularId",{enumerable:!0,get:function(){return t}})},506,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"useCurrentRouteInfo",{enumerable:!0,get:function(){return u}});const n=r(d[1]),o=r(d[2]);function u(){const u=(0,o.useStateForPath)();return(0,t().useMemo)(()=>u?(0,n.getRouteInfoFromState)(u):void 0,[u])}},507,[30,387,427]); +__d(function(g,r,i,a,m,e,d){"use strict";function n(){const t=r(d[0]);return n=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),(function(n,t){for(var o in t)Object.defineProperty(n,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(t,o).get})})(e,{get Link(){return f},get Redirect(){return s.Redirect}});const t=r(d[1]),o=r(d[2]),u=r(d[3]),c=r(d[4]),p=r(d[5]),s=r(d[6]),f=Object.assign(function(o){return(0,n().jsx)(t.ExpoLink,{...o})},{resolveHref:u.resolveHref,Menu:o.LinkMenu,Trigger:o.LinkTrigger,Preview:o.LinkPreview,MenuAction:o.LinkMenuAction,AppleZoom:c.LinkAppleZoom,AppleZoomTarget:p.LinkAppleZoomTarget})},508,[24,509,523,353,674,681,536]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}function n(){const t=p(r(d[1]));return n=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"ExpoLink",{enumerable:!0,get:function(){return y}});r(d[2]);const o=r(d[3]),u=(r(d[4]),r(d[5])),c=r(d[6]),f=r(d[7]),l=r(d[8]);function s(t){if("function"!=typeof WeakMap)return null;var n=new WeakMap,o=new WeakMap;return(s=function(t){return t?o:n})(t)}function p(t,n){if(!n&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var o=s(n);if(o&&o.has(t))return o.get(t);var u={__proto__:null},c=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var f in t)if("default"!==f&&Object.prototype.hasOwnProperty.call(t,f)){var l=c?Object.getOwnPropertyDescriptor(t,f):null;l&&(l.get||l.set)?Object.defineProperty(u,f,l):u[f]=t[f]}return u.default=t,o&&o.set(t,u),u}function y(n){return(0,t().jsx)(l.ZoomTransitionSourceContextProvider,{linkProps:n,children:(0,t().jsx)(h,{...n})})}function h(l){(0,c.useIsPreview)();const s=(0,f.useZoomHref)(l);let p=l.children;if(n().default.Children.count(l.children)>1){const t=n().default.Children.toArray(l.children).filter(t=>!(0,n().isValidElement)(t)||t.type!==u.LinkPreview&&t.type!==u.LinkMenu);p=1===t.length?t[0]:l.children}return(0,t().jsx)(o.BaseExpoRouterLink,{...l,href:s,children:p})}},509,[24,30,355,510,519,523,421,680,539]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(){const t=r(d[0]);return e=function(){return t},t}function t(){const e=p(r(d[1]));return t=function(){return e},e}function n(){const e=r(d[2]);return n=function(){return e},e}Object.defineProperty(_e,"__esModule",{value:!0}),Object.defineProperty(_e,"BaseExpoRouterLink",{enumerable:!0,get:function(){return P}});const o=r(d[3]),u=r(d[4]),s=r(d[5]),l=r(d[6]),c=f(r(d[7]));function f(e){return e&&e.__esModule?e:{default:e}}function h(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(h=function(e){return e?n:t})(e)}function p(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=h(t);if(n&&n.has(e))return n.get(e);var o={__proto__:null},u=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&Object.prototype.hasOwnProperty.call(e,s)){var l=u?Object.getOwnPropertyDescriptor(e,s):null;l&&(l.get||l.set)?Object.defineProperty(o,s,l):o[s]=e[s]}return o.default=e,n&&n.set(e,o),o}function P({href:f,replace:h,push:p,dismissTo:P,relativeToDirectory:y,asChild:w,rel:_,target:O,download:j,withAnchor:v,dangerouslySingular:b,prefetch:k,...C}){const M=(0,l.useInteropClassName)(C),x=(0,l.useHrefAttrs)({asChild:w,rel:_,target:O,download:j}),E=(0,t().useMemo)(()=>{if(null==f)throw new Error('Link: href is required');return(0,s.resolveHref)(f)},[f]);let T;p&&(T='PUSH'),h&&(T='REPLACE'),P&&(T='POP_TO');const A=(0,c.default)({href:E,event:T,relativeToDirectory:y,withAnchor:v,dangerouslySingular:b}),D=e=>{'onPress'in C&&C.onPress?.(e),A.onPress(e)},L=w?u.Slot:n().Text;if(w&&t().default.Children.count(C.children)>1)throw new Error('Link: When using `asChild`, you must pass a single child element that will emit the `onPress` event.');const S=(0,e().jsx)(L,{...A,...x,...C,style:M,...n().Platform.select({web:{onClick:D},default:{onPress:D}})});return k?(0,e().jsxs)(e().Fragment,{children:[(0,e().jsx)(o.Prefetch,{href:f}),S]}):S}},510,[24,30,33,511,514,353,517,518]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"Prefetch",{enumerable:!0,get:function(){return o}});const n=r(d[1]),u=r(d[2]);function o(o){const c=(0,u.useOptionalNavigation)();return(0,t().useLayoutEffect)(()=>{c?.isFocused()&&n.router.prefetch(o.href)},[c,o.href]),null}},511,[30,512,513]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"router",{enumerable:!0,get:function(){return t}});const t=r(d[0]).router},512,[299]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var u in n)Object.defineProperty(t,u,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,u).get})})(e,{get useLoadedNavigation(){return u},get useOptionalNavigation(){return c}});const n=r(d[1]);function u(){const u=(0,n.useNavigation)(),c=(0,t().use)(n.NavigationContainerRefContext),o=(0,t().useRef)(!0),s=(0,t().useRef)([]);(0,t().useEffect)(()=>(o.current=!0,()=>{o.current=!1}),[]);const f=(0,t().useCallback)(()=>{if(o.current){const t=s.current;s.current=[],t.forEach(t=>{t(u)})}},[u]);(0,t().useEffect)(()=>{c&&f()},[f,c]);return(0,t().useCallback)(t=>{s.current.push(t),c&&f()},[f,c])}function c(){const[n,c]=(0,t().useState)(null),o=u();return(0,t().useEffect)(()=>{o(t=>c(t))},[]),n}},513,[30,427]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}function n(){const t=r(d[1]);return n=function(){return t},t}function o(){const t=c(r(d[2]));return o=function(){return t},t}function u(){const t=r(d[3]);return u=function(){return t},t}function f(t){if("function"!=typeof WeakMap)return null;var n=new WeakMap,o=new WeakMap;return(f=function(t){return t?o:n})(t)}function c(t,n){if(!n&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var o=f(n);if(o&&o.has(t))return o.get(t);var u={__proto__:null},c=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in t)if("default"!==l&&Object.prototype.hasOwnProperty.call(t,l)){var s=c?Object.getOwnPropertyDescriptor(t,l):null;s&&(s.get||s.set)?Object.defineProperty(u,l,s):u[l]=t[l]}return u.default=t,o&&o.set(t,u),u}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"Slot",{enumerable:!0,get:function(){return l}});const l=(s=n().Slot,(0,o().forwardRef)(function({style:n,...f},c){const l=(0,o().useMemo)(()=>u().StyleSheet.flatten(n),[n]);return(0,t().jsx)(s,{ref:c,...f,style:l})}));var s},514,[24,515,30,33]); +__d(function(g,r,i,a,m,e,d){"use strict";var t,o=Object.create,n=Object.defineProperty,l=Object.getOwnPropertyDescriptor,c=Object.getOwnPropertyNames,s=Object.getPrototypeOf,p=Object.prototype.hasOwnProperty,f=(t,o)=>n(t,"name",{value:o,configurable:!0}),u=(t,o,s,f)=>{if(o&&"object"==typeof o||"function"==typeof o)for(let u of c(o))p.call(t,u)||u===s||n(t,u,{get:()=>o[u],enumerable:!(f=l(o,u))||f.enumerable});return t},y={};((t,o)=>{for(var l in o)n(t,l,{get:o[l],enumerable:!0})})(y,{Root:()=>_,Slot:()=>_,Slottable:()=>O,createSlot:()=>h,createSlottable:()=>E}),m.exports=(t=y,u(n({},"__esModule",{value:!0}),t));var b=((t,l,c)=>(c=null!=t?o(s(t)):{},u(!l&&t&&t.__esModule?c:n(c,"default",{value:t,enumerable:!0}),t)))(r(d[0])),S=r(d[1]);function h(t){const o=b.forwardRef((o,n)=>{let{children:l,...c}=o,s=null,p=!1;const f=[];l=C(l),b.Children.forEach(l,t=>{if(P(t)){p=!0;const o=t;let n="child"in o.props?o.props.child:o.props.children;for(;x(n)&&"function"==typeof W;)n=W(n._payload);s=j(o,n),f.push(s?.props?.children)}else f.push(t)}),s?s=b.cloneElement(s,void 0,f):!p&&1===b.Children.count(l)&&b.isValidElement(l)&&(s=l);const u=s?R(s):void 0,y=(0,S.useComposedRefs)(n,u);if(!s){if(l||0===l)throw new Error(p?V(t):N(t));return l}const h=w(c,s.props??{});return s.type!==b.Fragment&&(h.ref=n?y:u),b.cloneElement(s,h)});return o.displayName=`${t}.Slot`,o}f(h,"createSlot");var _=h("Slot"),v=Symbol.for("radix.slottable");function E(t){const o=f(t=>"child"in t?t.children(t.child):t.children,"Slottable");return o.displayName=`${t}.Slottable`,o.__radixId=v,o}f(E,"createSlottable");var O=E("Slottable"),j=f((t,o)=>"child"in t.props?b.isValidElement(o)?b.cloneElement(o,void 0,t.props.children(o.props.children)):null:b.isValidElement(o)?o:null,"getSlottableElementFromSlottable");function w(t,o){const n={...o};for(const l in o){const c=t[l],s=o[l];/^on[A-Z]/.test(l)?c&&s?n[l]=(...t)=>{const o=s(...t);return c(...t),o}:c&&(n[l]=c):"style"===l?n[l]={...c,...s}:"className"===l?n[l]=[c,s].filter(Boolean).join(" "):"aria-describedby"===l&&(n[l]=D(s,c))}return{...t,...n}}function R(t){let o=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=o&&"isReactWarning"in o&&o.isReactWarning;return n?t.ref:(o=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=o&&"isReactWarning"in o&&o.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}function P(t){return b.isValidElement(t)&&"function"==typeof t.type&&"__radixId"in t.type&&t.type.__radixId===v}f(w,"mergeProps"),f(R,"getElementRef"),f(P,"isSlottable");var $=Symbol.for("react.lazy");function x(t){return null!=t&&"object"==typeof t&&"$$typeof"in t&&t.$$typeof===$&&"_payload"in t&&z(t._payload)}function z(t){return"object"==typeof t&&null!==t&&"then"in t}function C(t){let o=t;for(;x(o)&&"function"==typeof W;)o=W(o._payload);return o}function D(...t){const o=new Set;for(const n of t)if("string"==typeof n)for(const t of String(n).trim().split(/\s+/))t&&o.add(t);return o.size>0?Array.from(o).join(" "):void 0}f(x,"isLazyComponent"),f(z,"isPromiseLike"),f(C,"useUnwrappedLazy"),f(D,"concatAriaDescribedby");var N=f(t=>`${t} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),V=f(t=>`${t} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),W=b[" use ".trim().toString()]},515,[30,516]); +__d(function(g,r,_i,a,m,e,d){"use strict";var t,o=Object.create,n=Object.defineProperty,u=Object.getOwnPropertyDescriptor,f=Object.getOwnPropertyNames,c=Object.getPrototypeOf,l=Object.prototype.hasOwnProperty,s=(t,o)=>n(t,"name",{value:o,configurable:!0}),p=(t,o,c,s)=>{if(o&&"object"==typeof o||"function"==typeof o)for(let p of f(o))l.call(t,p)||p===c||n(t,p,{get:()=>o[p],enumerable:!(s=u(o,p))||s.enumerable});return t},i={};((t,o)=>{for(var u in o)n(t,u,{get:o[u],enumerable:!0})})(i,{composeRefs:()=>O,useComposedRefs:()=>j}),m.exports=(t=i,p(n({},"__esModule",{value:!0}),t));var b=((t,u,f)=>(f=null!=t?o(c(t)):{},p(!u&&t&&t.__esModule?f:n(f,"default",{value:t,enumerable:!0}),t)))(r(d[0]));function y(t,o){if("function"==typeof t)return t(o);null!=t&&(t.current=o)}function O(...t){return o=>{let n=!1;const u=t.map(t=>{const u=y(t,o);return n||"function"!=typeof u||(n=!0),u});if(n)return()=>{for(let o=0;o{if(null==s.className)return s.style;const t={$$css:!0,__routerLinkClassName:s.className};return Array.isArray(s.style)?[...s.style,t]:[s.style,t]},[s.style,s.className])}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var s in n)Object.defineProperty(t,s,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,s).get})})(e,{get useHrefAttrs(){return u},get useInteropClassName(){return s}});const u=n().Platform.select({web:function({asChild:n,rel:s,target:u,download:o}){return(0,t().useMemo)(()=>{const t={rel:s,target:u,download:o};return n?t:{hrefAttrs:t}},[n,s,u,o])},default:function(){return{}}})},517,[30,33]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(){const t=r(d[0]);return e=function(){return t},t}Object.defineProperty(_e,"__esModule",{value:!0}),(function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:Object.getOwnPropertyDescriptor(t,n).get})})(_e,{get default(){return f},get shouldHandleMouseEvent(){return s}});const t=r(d[1]),n=r(d[2]),u=r(d[3]),o=r(d[4]),l=r(d[5]);function f({href:e,...f}){const c=(0,u.useRouterActions)();let p=(0,o.stripGroupSegmentsFromPath)(e)||'/';return(0,l.shouldLinkExternally)(p)||(p=(0,n.appendBaseUrl)(p)),{href:p,role:'link',onPress:n=>{if(s(n)){if((0,t.emitDomLinkEvent)(e,f))return;c.linkTo(e,f)}}}}function s(t){return'web'!==e().Platform.OS?!t?.defaultPrevented:!(!t||(n=t,n?.defaultPrevented||!('button'in n)||n.metaKey||n.altKey||n.ctrlKey||n.shiftKey||null!=n.button&&0!==n.button||![void 0,null,'','self'].includes(n.currentTarget.target)))&&(t.preventDefault(),!0);var n}},518,[33,351,388,298,389,355]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}function n(){const t=_(r(d[1]));return n=function(){return t},t}function o(){const t=r(d[2]);return o=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"LinkWithPreview",{enumerable:!0,get:function(){return b}});const u=r(d[3]),s=r(d[4]),l=r(d[5]),c=r(d[6]),f=r(d[7]),p=r(d[8]),v=r(d[9]),h=r(d[10]),w=r(d[11]),P=r(d[12]),y=r(d[13]);function k(t){if("function"!=typeof WeakMap)return null;var n=new WeakMap,o=new WeakMap;return(k=function(t){return t?o:n})(t)}function _(t,n){if(!n&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var o=k(n);if(o&&o.has(t))return o.get(t);var u={__proto__:null},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in t)if("default"!==l&&Object.prototype.hasOwnProperty.call(t,l)){var c=s?Object.getOwnPropertyDescriptor(t,l):null;c&&(c.get||c.set)?Object.defineProperty(u,l,c):u[l]=t[l]}return u.default=t,o&&o.set(t,u),u}const O='ios'===o().Platform.OS&&o().Platform.isPad;function b({children:o,...k}){const _=(0,u.useRouter)(),{setOpenPreviewKey:b}=(0,w.useLinkPreviewContext)(),[j,L]=(0,n().useState)(!1),M=(0,h.resolveHref)(k.hrefForPreviewNavigation).split('?')[0],x=(0,n().useRef)(M);(0,n().useEffect)(()=>{if(j){if(x.current!==M)throw new Error('Link does not support changing the href prop after the preview has been opened. Please ensure that the href prop is stable and does not change between renders.')}else x.current=M},[M]);const[C,E,F]=(0,y.usePreviewActivationPath)();(0,n().useEffect)(()=>{k.replace&&console.warn('Using replace links with preview is not supported')},[k.href,k.replace]);const T=n().default.useMemo(()=>(0,s.getFirstChildOfType)(o,v.LinkTrigger),[o]),W=n().default.useMemo(()=>(0,s.getFirstChildOfType)(o,v.LinkMenu),[o]),R=n().default.useMemo(()=>(0,s.getFirstChildOfType)(o,v.LinkPreview),[o]);!R&&!W||T||console.warn('When you use Link.Preview, you must use Link.Trigger to specify the trigger element.');const N=n().default.useMemo(()=>T??(0,t().jsx)(v.LinkTrigger,{children:o}),[T,o]),D=n().default.useMemo(()=>(0,l.shouldLinkExternally)(String(k.href))||!R?null:R,[R,k.href]),K=(0,n().useRef)(!1),S=(0,n().useRef)(void 0),A=(0,n().useMemo)(()=>C?{path:C}:void 0,[C]),B=!!R;return k.replace?(0,t().jsx)(c.BaseExpoRouterLink,{children:o,...k}):(0,t().jsx)(P.NativeLinkPreview,{previewActivationPath:A,onWillPreviewOpen:()=>{B&&(K.current=!1,S.current=void 0,E(k.href),L(!0))},onPreviewWillClose:()=>{B&&(L(!1),F(),K.current&&!O||b(void 0))},onPreviewDidClose:()=>{B&&K.current&&O&&_.navigate(k.href,{__internal__PreviewKey:S.current})},onPreviewTapped:({nativeEvent:{screenId:t}})=>{K.current=!0,S.current=t,void 0!==t&&b(t),O||_.navigate(k.href,{__internal__PreviewKey:t})},style:{display:'contents'},disableForceFlatten:!0,children:(0,t().jsx)(p.NativeMenuContext,{value:!0,children:(0,t().jsxs)(f.InternalLinkPreviewContext,{value:{isVisible:j,href:k.hrefForPreviewNavigation},children:[(0,t().jsx)(c.BaseExpoRouterLink,{...k,children:N,ref:k.ref}),D,W]})})})}},519,[24,30,33,419,520,355,510,521,522,523,353,676,673,678]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}function n(n,l){return(0,t().isValidElement)(n)&&n.type===l}function l(l,u){return t().Children.toArray(l).find(t=>n(t,u))}function u(l,u){return t().Children.toArray(l).filter(t=>n(t,u))}function o(l,u){return t().Children.toArray(l).filter(t=>!n(t,u))}function f(n,l){return t().Children.toArray(n).filter(n=>(0,t().isValidElement)(n)&&l.includes(n.type))}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var l in n)Object.defineProperty(t,l,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,l).get})})(e,{get filterAllowedChildrenElements(){return f},get getAllChildrenNotOfType(){return o},get getAllChildrenOfType(){return u},get getFirstChildOfType(){return l},get isChildOfType(){return n}})},520,[30]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"InternalLinkPreviewContext",{enumerable:!0,get:function(){return n}});const n=(0,t().createContext)(void 0)},521,[30]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"NativeMenuContext",{enumerable:!0,get:function(){return n}});const n=(0,t().createContext)(!1)},522,[30]); +__d(function(g,r,i,a,m,e,d){"use strict";function n(){const t=r(d[0]);return n=function(){return t},t}function t(){const n=f(r(d[1]));return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),(function(n,t){for(var u in t)Object.defineProperty(n,u,{enumerable:!0,get:Object.getOwnPropertyDescriptor(t,u).get})})(e,{get LinkMenu(){return w},get LinkMenuAction(){return p},get LinkPreview(){return y},get LinkTrigger(){return P}});r(d[2]);const u=r(d[3]),o=(r(d[4]),r(d[5])),c=(r(d[6]),r(d[7]),r(d[8])),l=(r(d[9]),r(d[10]));function s(n){if("function"!=typeof WeakMap)return null;var t=new WeakMap,u=new WeakMap;return(s=function(n){return n?u:t})(n)}function f(n,t){if(!t&&n&&n.__esModule)return n;if(null===n||"object"!=typeof n&&"function"!=typeof n)return{default:n};var u=s(t);if(u&&u.has(n))return u.get(n);var o={__proto__:null},c=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in n)if("default"!==l&&Object.prototype.hasOwnProperty.call(n,l)){var f=c?Object.getOwnPropertyDescriptor(n,l):null;f&&(f.get||f.set)?Object.defineProperty(o,l,f):o[l]=n[l]}return o.default=n,u&&u.set(n,o),o}function p(n){(0,t().useId)();return(0,c.useIsPreview)(),null}const w=n=>{(0,t().useId)();return(0,c.useIsPreview)(),null};function y(n){const{children:u,style:l}=n;(0,t().use)(o.InternalLinkPreviewContext);return(0,c.useIsPreview)(),null}function P({withAppleZoom:o,...c}){if(t().default.Children.count(c.children)>1||!(0,t().isValidElement)(c.children)){if(c&&'object'==typeof c&&'onPress'in c)throw new Error('When using Link.Trigger in an asChild Link, you must pass a single child element that will emit onPress event.');return c.children}const s=(0,n().jsx)(u.Slot,{...c});return o?(0,n().jsx)(l.LinkAppleZoom,{children:s}):s}},523,[24,30,524,514,520,521,522,528,421,673,674]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get Group(){return t.Group},get Screen(){return t.Screen}});const t=r(d[0]);function n(t,n){return Object.keys(t).forEach(function(o){"default"===o||Object.prototype.hasOwnProperty.call(n,o)||Object.defineProperty(n,o,{enumerable:!0,get:function(){return t[o]}})}),t}n(r(d[1]),e),n(r(d[2]),e)},524,[525,526,527]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get Group(){return o},get Screen(){return n}});const t=r(d[0]),{Screen:n,Group:o}=(0,t.createNavigatorFactory)({})()},525,[427]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},526,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function n(n){return null}function t(n){return null}function u(n){return null}function o(n){return null}Object.defineProperty(e,"__esModule",{value:!0}),(function(n,t){for(var u in t)Object.defineProperty(n,u,{enumerable:!0,get:Object.getOwnPropertyDescriptor(t,u).get})})(e,{get Badge(){return n},get Icon(){return t},get Label(){return o},get VectorIcon(){return u}})},527,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}function n(){const t=r(d[1]);return n=function(){return t},t}function o(){const t=r(d[2]);return o=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"HrefPreview",{enumerable:!0,get:function(){return P}});const s=r(d[3]),u=r(d[4]),c=r(d[5]),f=r(d[6]),l=r(d[7]),p=r(d[8]),x=r(d[9]),h=r(d[10]),v=r(d[11]),N=r(d[12]),S=r(d[13]),j=r(d[14]),R=r(d[15]),C=r(d[16]);function P({href:o}){const{segments:u}=(0,f.useRouteInfo)(),{linking:l,routeNode:p}=(0,n().use)(c.RouterConfigContext)??{},h=(0,n().use)(x.RootNavigationStateContext),v=(0,n().useMemo)(()=>(0,j.getStateForHref)(o,{segments:u},l),[o,u,l]),N=v?.index??0;let S=!1;if(v?.routes[N]?.name===s.INTERNAL_SLOT_NAME){let n=v,s=h;for(;n&&s;){const t=n.routes[0];if(!1===s.stale&&!s.routeNames?.includes(t.name)){S=!0;break}const o=s.routes.findIndex(n=>n.name===t.name);if(-1===o)break;n=t.state,s=s.routes[o]?.state}if(!S)return(0,t().jsx)(y,{hrefState:v,href:o,rootRouteNode:p})}const R=o.toString(),P=R.split('/').filter(Boolean);return(0,t().jsx)(C.PreviewRouteContext.Provider,{value:{params:{},pathname:R,segments:P},children:(0,t().jsx)(k,{})})}function y({hrefState:o,href:s,rootRouteNode:c}){const f=(0,N.useNavigation)(),{routeNode:l,params:p,state:x}=w(o,c),v=x?(0,R.getPathFromState)(x):void 0,j=(0,n().useMemo)(()=>({params:p,pathname:s.toString(),segments:v?.split('/').filter(Boolean)||[]}),[p,s]);if(!l)return null;const P=(0,S.getQualifiedRouteComponent)(l);return(0,t().jsx)(C.PreviewRouteContext,{value:j,children:(0,t().jsx)(u.CompositionContext,{value:{set:()=>{},unset:()=>{}},children:(0,t().jsx)(h.NavigationContext,{value:T,children:(0,t().jsx)(P,{navigation:f})})})})}function k(){const n=(0,p.usePathname)();return(0,t().jsxs)(o().View,{style:{flex:1,justifyContent:'center',alignItems:'center',gap:8,backgroundColor:'white'},children:[(0,t().jsx)(o().Text,{style:{fontWeight:'600',fontSize:24},children:"Invalid preview"}),(0,t().jsx)(o().Text,{style:{fontWeight:'200',fontSize:14},children:n})]})}function w(t,n){const o=t?.index??0;if(t?.routes[o]&&t.routes[o].name!==s.INTERNAL_SLOT_NAME){const t=`Expo Router Error: Expected navigation state to begin with one of [${(0,l.getRootStackRouteNames)().join(', ')}] routes`;console.warn(t)}const u=t?.routes[o]?.state,{routeNode:c,params:f}=(0,v.findRouteNodeAndParamsForState)(n,u);return{params:f,routeNode:c,state:u}}const T={setParams:()=>{},setOptions:()=>{},addListener:()=>()=>{},removeListener:()=>{},isFocused:()=>!0,canGoBack:()=>!1,dispatch:()=>{},navigate:()=>{},goBack:()=>{},reset:()=>{},push:()=>{},pop:()=>{},popToTop:()=>{},preload:()=>{},getId:()=>'',getParent:()=>{},getState:()=>({key:'',routeKeySeq:0,index:0,routeNames:[],routes:[],type:'',stale:!1})}},528,[24,30,33,295,529,381,420,407,419,423,427,406,533,534,669,670,421]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),(function(t,o){for(var n in o)Object.defineProperty(t,n,{enumerable:!0,get:Object.getOwnPropertyDescriptor(o,n).get})})(e,{get CompositionContext(){return o.CompositionContext},get mergeOptions(){return t.mergeOptions},get useCompositionOption(){return o.useCompositionOption},get useCompositionRegistry(){return o.useCompositionRegistry}});const t=r(d[0]),o=r(d[1])},529,[530,531]); +__d(function(g,r,i,a,m,e,d){"use strict";function n(n,t,o){const s={},c=o.routes.slice(0,o.index+1),u=o.routes.slice(o.index+1),f=c[o.index]?.key;for(const o in n){const c=n[o],l=t[o];if(!l||0===l.length){s[o]=c;continue}if(u.some(n=>n.key===o)&&o!==f){s[o]=c;continue}const p=Object.assign({},c.options,...l),b={...c,options:p};s[o]=b}return s}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"mergeOptions",{enumerable:!0,get:function(){return n}})},530,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get CompositionContext(){return u},get registryReducer(){return s},get useCompositionOption(){return p},get useCompositionRegistry(){return c}});const n=r(d[1]),o=r(d[2]),u=(0,t().createContext)(null);function s(t,n){if('set'===n.type){const{routeKey:o,options:u}=n;return t[o]?.includes(u)?t:{...t,[o]:[...t[o]??[],u]}}if('unset'===n.type){const{routeKey:o,options:u}=n,s=t[o],c=s?.filter(t=>t!==u);if(!s||c?.length===s.length)return t;if(!c?.length){const{[o]:n,...u}=t;return u}return{...t,[o]:c}}return t}function c(){const[n,o]=(0,t().useReducer)(s,{}),u=(0,t().useCallback)((t,n)=>{o({type:'set',routeKey:t,options:n})},[]),c=(0,t().useCallback)((t,n)=>{o({type:'unset',routeKey:t,options:n})},[]);return{registry:n,contextValue:(0,t().useMemo)(()=>({set:u,unset:c}),[u,c])}}function p(s){const c=(0,t().use)(u);if(!c)throw new Error('useCompositionOption must be used within a RouterCompositionOptionsProvider. This is likely a bug in Expo Router.');const p=(0,n.useRoute)(),{set:f,unset:y}=c;(0,o.useSafeLayoutEffect)(()=>(f(p.key,s),()=>{y(p.key,s)}),[p.key,f,y,s])}},531,[30,427,532]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"useSafeLayoutEffect",{enumerable:!0,get:function(){return n}});const n='undefined'!=typeof window?t().useLayoutEffect:function(){}},532,[30]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"useNavigation",{enumerable:!0,get:function(){return s}});const t=r(d[0]),n=r(d[1]),o=r(d[2]);function s(s){let u=(0,o.useNavigation)(),l=(0,o.useStateForPath)();if(void 0===s)return u;const c=u.getId();if(''===c||"/expo-router/build/views/Navigator"===c)return u;if('object'==typeof s&&(s=(0,n.resolveHref)(s)),'/'===s)return u.getParent("/expo-router/build/views/Navigator")??u.getParent("");if(s?.startsWith('../')){const n=[];for(;l;){const t=l.routes[0];l=t.state,l&&n.push(t.name)}const o=s;s.endsWith('/')&&(s=s.slice(0,-1));const u=s.split('/');if(!u.every(t=>'..'===t))throw new Error(`Invalid parent path "${o}". Only "../" segments are allowed when using relative paths.`);const c=u.length,f=n.length-1-c;if(f<0)throw new Error(`Invalid parent path "${o}". Cannot go up ${c} levels from the current route.`);(s=n[f])&&!(0,t.getRootStackRouteNames)().includes(s)&&(s=`/${s}`)}return u=u.getParent(s),u}},533,[407,353,427]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(){const t=r(d[0]);return e=function(){return t},t}function t(){const e=A(r(d[1]));return t=function(){return e},e}Object.defineProperty(_e,"__esModule",{value:!0}),(function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:Object.getOwnPropertyDescriptor(t,n).get})})(_e,{get getQualifiedRouteComponent(){return L},get getSingularId(){return b.getSingularId},get routeToScreen(){return $},get screenOptionsFactory(){return B},get useSortedScreens(){return T}});const n=r(d[2]),o=r(d[3]),s=r(d[4]),u=r(d[5]),c=r(d[6]),l=r(d[7]),p=r(d[8]),f=r(d[9]),h=r(d[10]),y=r(d[11]),x=r(d[12]),v=r(d[13]),I=r(d[14]),E=r(d[15]),R=r(d[16]),S=r(d[17]),b=r(d[18]),j=r(d[19]),O=r(d[20]),_=r(d[21]),k=r(d[22]),N=r(d[23]);function P(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(P=function(e){return e?n:t})(e)}function A(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=P(t);if(n&&n.has(e))return n.get(e);var o={__proto__:null},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var u in e)if("default"!==u&&Object.prototype.hasOwnProperty.call(e,u)){var c=s?Object.getOwnPropertyDescriptor(e,u):null;c&&(c.get||c.set)?Object.defineProperty(o,u,c):o[u]=e[u]}return o.default=e,n&&n.set(e,o),o}function M(e,t=[],o){if(!t?.length)return e.sort((0,n.sortRoutesWithInitial)(o)).map(e=>({route:e,props:{},routeSource:'filesystem'}));const s=[...e],u=t.map(({name:t,listeners:n,options:o,getId:u,dangerouslySingular:c,activityEnabled:l})=>{if(!s.length)return console.warn(`[Layout children]: Too many screens defined. Route "${t}" is extraneous.`),null;const p=s.find(e=>e.route===t||e.route===`${t}/index`);return p?(s.splice(s.indexOf(p),1),u?(console.warn(`Deprecated: prop 'getId' on screen ${t} is deprecated. Please rename the prop to 'dangerouslySingular'`),c&&console.warn(`Screen ${t} cannot use both getId and dangerouslySingular together.`)):c&&('string'==typeof c?u=()=>c:'function'==typeof c&&t?u=e=>c(t,e.params||{}):!0===c&&t&&(u=e=>(0,b.getSingularId)(t,e))),{route:p,props:{listeners:n,options:o,getId:u,activityEnabled:l},routeSource:'layout'}):(console.warn(`[Layout children]: No route named "${t}" exists in nested children:`,e.map(({route:e})=>e)),null)}).filter(Boolean);return u.push(...s.sort((0,n.sortRoutesWithInitial)(o)).map(e=>({route:e,props:{},routeSource:'filesystem'}))),u}function T(e,o=new Map){const s=(0,n.useRouteNode)(),c=s?.children??[],l=c.length?M(c,e,(0,R.getValidInitialRouteName)(s)):[];return t().default.useMemo(()=>l.map(e=>{const t=e.route.route;return{...e,isGuarded:(0,u.isRouteGuarded)(t,o)}}).map(e=>$(e.route,e.props,e.isGuarded,e.routeSource)),[l,o])}function w(o,{ErrorBoundary:s,SuspenseFallback:u,unstable_settings:c,...l}){const p=c?.screenErrorBoundary;if(s||'layout'===o.type&&void 0!==p){return{default:t().default.forwardRef((u,c)=>{const f=(0,t().use)(n.ScreenErrorBoundaryContext);let h=t().default.createElement(l.default||j.EmptyRoute,{...u,ref:c});return s&&(h=(0,e().jsx)(N.Try,{catch:s,children:h})),'layout'===o.type&&void 0!==p&&(h=(0,e().jsx)(n.ScreenErrorBoundaryContext,{value:p??void 0,children:h}),null===p&&f&&(h=(0,e().jsx)(N.Try,{catch:f,children:h}))),h}),SuspenseFallback:u}}return{default:l.default,SuspenseFallback:u}}const C=new WeakMap;function L(I){if(C.has(I))return C.get(I);let R;R=t().default.lazy(()=>{const e=I.loadRoute();return'then'in e?e.then(w.bind(null,I)):{then(t){const n=w(I,e);return Promise.resolve(t?t(n):n)}}});const S=t=>((0,o.useColorSchemeChangesIfNeeded)(),(0,e().jsx)(R,{...t}));function b({route:o,navigation:R,...b}){const j=(0,s.useCurrentRouteInfo)(),P=(0,t().use)(n.SuspenseFallbackContext),A=(0,t().use)(n.ScreenErrorBoundaryContext),M=(0,O.useActivityThreshold)(),T=(0,u.useGuardRedirect)(I.route),w=void 0!==T,C='route'===I.type,L=(0,t().useMemo)(()=>!C||w?null:(0,h.resolveLoaderPath)((0,y.getContextKey)(I.contextKey),j),[w,C,j]),B=k.SuspenseFallback,$=(I.type,P);(0,t().useEffect)(()=>R.addListener('transitionEnd',e=>{e?.data?.closing||(0,x.hasParam)(o?.params,x.INTERNAL_EXPO_ROUTER_NO_ANIMATION_PARAM_NAME)&&R.dispatchSync(E.CommonActions.replaceParams((0,x.removeParams)(o?.params,[x.INTERNAL_EXPO_ROUTER_NO_ANIMATION_PARAM_NAME])))}),[R]);const D=!!o?.key;if(w)return(0,e().jsx)(n.Route,{node:I,params:o?.params,children:null!=T?(0,e().jsx)(c.Redirect,{href:T}):(0,e().jsx)(F,{})});const G=(0,e().jsx)(S,{...b,segment:I.route}),K=A&&C?(0,e().jsx)(N.Try,{catch:A,children:G}):G;return(0,e().jsx)(n.Route,{node:I,params:o?.params,children:(0,e().jsxs)(n.SuspenseFallbackContext,{value:$,children:[L&&(0,e().jsx)(f.LoaderRouteLifecycle,{path:L}),(0,v.isEnabled)()&&C&&D&&(0,e().jsx)(W,{navigation:R,screenId:o.key}),(0,e().jsxs)(p.ZoomTransitionTargetContextProvider,{route:o,children:[(0,e().jsx)(l.ZoomTransitionEnabler,{route:o}),(0,e().jsx)(t().default.Suspense,{name:o?`Route(${o.name})`:void 0,fallback:(0,e().jsx)(B,{route:I.contextKey,params:o?.params??{}}),children:C&&'number'==typeof M?(0,e().jsx)(_.NavigationAwareActivity,{hideWhenNestedAtLevel:M,children:K}):K})]})]})})}return C.set(I,b),b}function F(){const e=(0,S.useIsFocused)();return(0,t().useEffect)(()=>{},[e]),null}function W({navigation:e,screenId:n}){const o=t().default.useRef(!1),u=t().default.useRef(!0),c=(0,s.useCurrentRouteInfo)(),l=(0,S.useIsFocused)(),p=t().default.useEffectEvent(()=>{c&&!l&&(0,v.mark)('expo-router:page-preloaded',{pathname:c.pathname,params:c.params,segments:c.segments,screenId:n})});return(0,t().useEffect)(()=>{o.current||(o.current=!0,p())},[]),(0,t().useEffect)(()=>c?()=>{(0,v.mark)('expo-router:page-removed',{pathname:c.pathname,params:c.params,segments:c.segments,screenId:n})}:()=>{},[c?.params,c?.pathname,c?.segments,n]),(0,t().useEffect)(()=>{l&&c&&u.current&&((0,v.mark)('expo-router:page-focused',{pathname:c.pathname,params:c.params,segments:c.segments,screenId:n}),u.current=!1)},[l,c?.pathname,c?.params,c?.segments,n]),(0,t().useEffect)(()=>{if(c){const t=e.addListener('focus',()=>{u.current&&((0,v.mark)('expo-router:page-focused',{pathname:c.pathname,params:c.params,segments:c.segments,screenId:n}),u.current=!1)}),o=e.addListener('blur',()=>{(0,v.mark)('expo-router:page-blurred',{pathname:c.pathname,params:c.params,segments:c.segments,screenId:n}),u.current=!0});return()=>{t(),o()}}return()=>{}},[e,c?.pathname,c?.params,c?.segments,n]),null}function B(e,t,n){return o=>{const s=e.generated?e.loadRoute()?.getNavOptions:null,u={...'function'==typeof s?s(o):s,...'function'==typeof t?t?.(o):t};return(e.internal||n)&&(u.hidden=!0),u}}function $(e,{options:n,getId:o,...s}={},u,c){return(0,t().createElement)(I.Screen,{...s,name:e.route,key:e.route,getId:o,routeSource:c,options:B(e,n,u),getComponent:()=>L(e)})}},534,[24,30,403,407,507,535,536,538,539,540,505,389,391,378,524,427,406,542,506,543,460,662,664,665]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}function n(){const t=r(d[1]);return n=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var u in n)Object.defineProperty(t,u,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,u).get})})(e,{get GuardContext(){return s},get GuardContextProvider(){return f},get isRouteGuarded(){return v},get normalizeRouteName(){return y},get useGuardRedirect(){return h}});const u=r(d[2]),o=r(d[3]),c=r(d[4]),s=(0,n().createContext)(null),l=(0,n().createContext)([]);function f({node:o,guardedRedirects:c,children:f}){const h=(0,n().use)(l),y=(0,n().use)(u.LocalRouteParamsContext),R=b(c),{fallbacks:C,resolvedGuards:p}=(0,n().useMemo)(()=>x(o,c,y,h),[o,o?.children,o?.contextKey,y,h,R]);return(0,t().jsx)(l,{value:C,children:(0,t().jsx)(s,{value:p,children:f})})}function x(t,n,u,o){const c=R(t,n,u),s=C(o,t),l=c?[c,...s]:s;return{fallbacks:l,resolvedGuards:K(n,l[0]?.href)}}function h(t){const u=(0,n().use)(s);if(!u)return;if(u.has(t))return u.get(t)??null;const o=y(t);return u.has(o)?u.get(o)??null:void 0}function y(t){return t.replace(/\/index$/,'')}function R(t,n,u){if(!t)return{href:'/',targetRouteContextKey:null};const c=p(t,n);if(!c)return;const s=y((0,o.getContextKey)(c.contextKey))||'/';return{href:Object.keys(u??{}).length?{pathname:s,params:u}:s,targetRouteContextKey:c.contextKey}}function C(t,n){return t.filter(t=>t.targetRouteContextKey!==n?.contextKey)}function p(t,n){const o=(0,c.getValidInitialRoute)(t),s=[...t.children].sort((0,u.sortRoutesWithInitial)(o?.route));return o&&!v(o.route,n)?o:s.find(t=>!v(t.route,n))}function v(t,n){return n.has(t)||n.has(y(t))}function K(t,n){return new Map(Array.from(t,([t,u])=>[t,u??n??null]))}function b(t){return JSON.stringify(Array.from(t.entries()))}},535,[24,30,403,389,406]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"Redirect",{enumerable:!0,get:function(){return n}});const t=r(d[0]),c=r(d[1]),o=r(d[2]);function n({href:n,relativeToDirectory:u,withAnchor:s}){const f=(0,t.useRouter)(),l=(0,o.useIsPreview)();return(0,c.useFocusEffect)(()=>{if(!l)try{f.replace(n,{relativeToDirectory:u,withAnchor:s})}catch(t){console.error(t)}}),null}},536,[491,537,421]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=c(r(d[0]));return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"useFocusEffect",{enumerable:!0,get:function(){return s}});const n=r(d[1]),o=r(d[2]);function u(t){if("function"!=typeof WeakMap)return null;var n=new WeakMap,o=new WeakMap;return(u=function(t){return t?o:n})(t)}function c(t,n){if(!n&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var o=u(n);if(o&&o.has(t))return o.get(t);var c={__proto__:null},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var f in t)if("default"!==f&&Object.prototype.hasOwnProperty.call(t,f)){var p=s?Object.getOwnPropertyDescriptor(t,f):null;p&&(p.get||p.set)?Object.defineProperty(c,f,p):c[f]=t[f]}return c.default=t,o&&o.set(t,c),c}function s(u,c){const s=(0,n.useOptionalNavigation)(),f=(0,o.useNavigation)();if(void 0!==c){const t="You passed a second argument to 'useFocusEffect', but it only accepts one argument. If you want to pass a dependency array, you can use 'React.useCallback':\n\nuseFocusEffect(\n React.useCallback(() => {\n // Your code here\n }, [depA, depB])\n);\n\nSee usage guide: https://docs.expo.dev/router/reference/focus-handling/#pass-dependencies-to-usefocuseffect";console.error(t)}t().useEffect(()=>{if(!f||!s)return;let t,n=!1;const o=()=>{const t=u();if(void 0===t||'function'==typeof t)return t};f.isFocused()&&(t=o(),n=!0);const c=f.addListener('focus',()=>{n||(void 0!==t&&t(),t=o(),n=!0)}),p=f.addListener('blur',()=>{void 0!==t&&t(),t=void 0,n=!1});return()=>{void 0!==t&&t(),c(),p()}},[u,f,s])}},537,[30,513,533]); +__d(function(g,r,i,a,m,e,d){"use strict";function n(){}function t(){return!1}function o(n){return null}Object.defineProperty(e,"__esModule",{value:!0}),(function(n,t){for(var o in t)Object.defineProperty(n,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(t,o).get})})(e,{get ZoomTransitionEnabler(){return o},get disableZoomTransition(){return n},get isZoomTransitionEnabled(){return t}})},538,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function t({children:t}){return t}function n({children:t}){return t}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get ZoomTransitionSourceContextProvider(){return t},get ZoomTransitionTargetContextProvider(){return n}})},539,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"LoaderRouteLifecycle",{enumerable:!0,get:function(){return f}});const n=r(d[1]),c=r(d[2]),o=new Map;function u(t){const n=o.get(t);n&&(n.cancel(),o.delete(t))}function s(t,n){u(n);const s={cancel:(0,c.scheduleAbandonLoaderPath)(t,n)};o.set(n,s),queueMicrotask(()=>{o.get(n)===s&&o.delete(n)})}function f({path:c}){const o=(0,t().use)(n.LoaderContext);return(0,t().useEffect)(()=>(u(c),()=>{s(o,c)}),[o,c]),null}},540,[30,499,541]); +__d(function(g,r,i,a,m,e,d){"use strict";function t({client:t,store:n},o){const c=n.get(o);c instanceof Promise&&t.abort(o)&&n.get(o)===c&&n.clear(o)}function n(n,o){let c=!1;return queueMicrotask(()=>{c||t(n,o)}),()=>{c=!0}}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get abandonLoaderPath(){return t},get scheduleAbandonLoaderPath(){return n}})},541,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"useIsFocused",{enumerable:!0,get:function(){return t.useIsFocused}});const t=r(d[0])},542,[427]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"EmptyRoute",{enumerable:!0,get:function(){return u}});const n=r(d[1]),o=r(d[2]);function u(){const u=(0,n.useRouteNode)();return(0,t().jsx)(o.ToastWrapper,{children:(0,t().jsx)(o.Toast,{warning:!0,filename:u?.contextKey,children:"Missing default export"})})}},543,[24,403,544]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}function n(){const t=u(r(d[1]));return n=function(){return t},t}function o(){const t=r(d[2]);return o=function(){return t},t}function c(){const t=r(d[3]);return c=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get CODE_FONT(){return s},get Toast(){return h},get ToastWrapper(){return b}});const l=r(d[4]);function u(t){return t&&t.__esModule?t:{default:t}}const s=o().Platform.select({default:'Courier',ios:'Courier New',android:'monospace'});function f(){const[t]=n().default.useState(()=>new(o().Animated.Value)(0));return n().default.useEffect(()=>{o().Animated.timing(t,{toValue:1,duration:200,useNativeDriver:'web'!==o().Platform.OS}).start()},[]),t}function b({children:u}){const s=n().default.use(l.BottomTabBarHeightContext)?o().View:c().SafeAreaView;return(0,t().jsx)(s,{collapsable:!1,style:{flex:1},children:u})}function h({children:c,filename:l,warning:u}){const s=n().default.useMemo(()=>{if(l)return'app'+l.replace(/^\./,'')},[l]),b=f();return(0,t().jsx)(o().View,{style:p.container,children:(0,t().jsxs)(o().Animated.View,{style:[p.toast,{position:o().Platform.select({web:'fixed',default:'absolute'}),opacity:b}],children:[!u&&(0,t().jsx)(o().ActivityIndicator,{color:"white"}),u&&(0,t().jsx)(o().Image,{source:r(d[5]),style:p.icon}),(0,t().jsxs)(o().View,{style:{marginLeft:8},children:[(0,t().jsx)(o().Text,{style:p.text,children:c}),s&&(0,t().jsx)(o().Text,{style:p.filename,children:s})]})]})})}const p=o().StyleSheet.create({container:{backgroundColor:'transparent',flex:1},icon:{width:20,height:20,resizeMode:'contain'},toast:{alignItems:'center',borderWidth:1,borderColor:'rgba(255,255,255,0.2)',flexDirection:'row',bottom:8,left:8,paddingVertical:8,paddingHorizontal:12,borderRadius:4,backgroundColor:'black'},text:{color:'white',fontSize:16},filename:{fontFamily:s,opacity:.8,color:'white',fontSize:12},code:{fontFamily:s}})},544,[24,30,33,289,545,661]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),(function(t,o){for(var n in o)Object.defineProperty(t,n,{enumerable:!0,get:Object.getOwnPropertyDescriptor(o,n).get})})(e,{get BottomTabBar(){return u.BottomTabBar},get BottomTabBarHeightCallbackContext(){return b.BottomTabBarHeightCallbackContext},get BottomTabBarHeightContext(){return f.BottomTabBarHeightContext},get BottomTabView(){return c.BottomTabView},get SceneStyleInterpolators(){return t},get TransitionPresets(){return o},get TransitionSpecs(){return n},get createStandardBottomTabNavigator(){return p.createStandardBottomTabNavigator},get useBottomTabBarHeight(){return l.useBottomTabBarHeight}});const t=B(r(d[0])),o=B(r(d[1])),n=B(r(d[2])),u=r(d[3]),c=r(d[4]),b=r(d[5]),f=r(d[6]),l=r(d[7]),p=r(d[8]);function s(t){if("function"!=typeof WeakMap)return null;var o=new WeakMap,n=new WeakMap;return(s=function(t){return t?n:o})(t)}function B(t,o){if(!o&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var n=s(o);if(n&&n.has(t))return n.get(t);var u={__proto__:null},c=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var b in t)if("default"!==b&&Object.prototype.hasOwnProperty.call(t,b)){var f=c?Object.getOwnPropertyDescriptor(t,b):null;f&&(f.get||f.set)?Object.defineProperty(u,b,f):u[b]=t[b]}return u.default=t,n&&n.set(t,u),u}},545,[546,547,548,549,620,616,621,651,652]); +__d(function(g,r,i,a,m,e,d){"use strict";function t({current:t}){return{sceneStyle:{opacity:t.progress.interpolate({inputRange:[-1,0,1],outputRange:[0,1,0]})}}}function n({current:t}){return{sceneStyle:{opacity:t.progress.interpolate({inputRange:[-1,0,1],outputRange:[0,1,0]}),transform:[{translateX:t.progress.interpolate({inputRange:[-1,0,1],outputRange:[-50,0,50]})}]}}}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get forFade(){return t},get forShift(){return n}})},546,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get FadeTransition(){return o},get ShiftTransition(){return c}});const t=r(d[0]),n=r(d[1]),o={transitionSpec:n.FadeSpec,sceneStyleInterpolator:t.forFade},c={transitionSpec:n.ShiftSpec,sceneStyleInterpolator:t.forShift}},547,[546,548]); +__d(function(g,r,i,a,m,e,d){"use strict";function n(){const t=r(d[0]);return n=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),(function(n,t){for(var o in t)Object.defineProperty(n,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(t,o).get})})(e,{get FadeSpec(){return t},get ShiftSpec(){return o}});const t={animation:'timing',config:{duration:150,get easing(){return n().Easing.in(n().Easing.linear)}}},o={animation:'timing',config:{duration:150,get easing(){return n().Easing.inOut(n().Easing.ease)}}}},548,[33]); +__d(function(g,r,i,a,m,_e,d){"use strict";function t(){const e=r(d[0]);return t=function(){return e},e}function e(){const t=h(r(d[1]));return e=function(){return t},t}function o(){const t=r(d[2]);return o=function(){return t},t}Object.defineProperty(_e,"__esModule",{value:!0}),(function(t,e){for(var o in e)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(e,o).get})})(_e,{get BottomTabBar(){return w},get getTabBarHeight(){return S}});const n=r(d[3]),s=r(d[4]),l=r(d[5]),u=r(d[6]),c=r(d[7]);function b(t){if("function"!=typeof WeakMap)return null;var e=new WeakMap,o=new WeakMap;return(b=function(t){return t?o:e})(t)}function h(t,e){if(!e&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var o=b(e);if(o&&o.has(t))return o.get(t);var n={__proto__:null},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in t)if("default"!==l&&Object.prototype.hasOwnProperty.call(t,l)){var u=s?Object.getOwnPropertyDescriptor(t,l):null;u&&(u.get||u.set)?Object.defineProperty(n,l,u):n[l]=t[l]}return n.default=t,o&&o.set(t,n),n}const f=15,p=12,y=!1,B=({state:t,descriptors:e,dimensions:n})=>{const{tabBarLabelPosition:s}=e[t.routes[t.index].key].options;if(s)switch(s){case'beside-icon':return!0;case'below-icon':return!1}if(n.width>=768){return t.routes.reduce((t,n)=>{const{tabBarItemStyle:s}=e[n.key].options,l=o().StyleSheet.flatten(s);if(l){if('number'==typeof l.width)return t+l.width;if('number'==typeof l.maxWidth)return t+l.maxWidth}return t+125},0)<=n.width}return n.width>n.height},v=({state:t,descriptors:e,dimensions:n})=>{const{tabBarPosition:s,tabBarVariant:l}=e[t.routes[t.index].key].options;if('left'===s||'right'===s||'material'===l)return!1;const u=n.width>n.height,c=B({state:t,descriptors:e,dimensions:n});return!('ios'!==o().Platform.OS||o().Platform.isPad||!u||!c)},S=({state:t,descriptors:e,dimensions:n,insets:s,style:l})=>{const{tabBarPosition:u}=e[t.routes[t.index].key].options,c=o().StyleSheet.flatten(l),b=c&&'height'in c?c.height:void 0;if('number'==typeof b)return b;const h=s['top'===u?'top':'bottom'];return v({state:t,descriptors:e,dimensions:n})?32+h:49+h};function w({state:b,descriptors:h,emitter:w,navigateToTab:k,insets:x,style:L}){const{colors:C}=(0,s.useTheme)(),{direction:T}=(0,s.useLocale)(),{buildHref:W}=(0,s.useLinkBuilder)(),j=b.routes[b.index],O=h[j.key].options,{tabBarPosition:A="bottom",tabBarShowLabel:I,tabBarLabelPosition:D,tabBarHideOnKeyboard:E=!1,tabBarVisibilityAnimationConfig:V,tabBarVariant:_="uikit",tabBarStyle:z,tabBarBackground:F,tabBarActiveTintColor:M,tabBarInactiveTintColor:H,tabBarActiveBackgroundColor:N,tabBarInactiveBackgroundColor:R}=O;if('material'===_&&'left'!==A&&'right'!==A)throw new Error("The 'material' variant for tab bar is only supported when 'tabBarPosition' is set to 'left' or 'right'.");if('below-icon'===D&&'uikit'===_&&('left'===A||'right'===A))throw new Error("The 'below-icon' label position for tab bar is only supported when 'tabBarPosition' is set to 'top' or 'bottom' when using the 'uikit' variant.");const K=(0,u.useIsKeyboardShown)(),Y=(0,e().use)(l.BottomTabBarHeightCallbackContext),q=!(E&&K),G=e().default.useEffectEvent(()=>V),[J,Q]=e().default.useState(!q),[U]=e().default.useState(()=>new(o().Animated.Value)(q?1:0));e().default.useEffect(()=>{const t=G();if(q){('spring'===t?.show?.animation?o().Animated.spring:o().Animated.timing)(U,{toValue:1,useNativeDriver:y,duration:250,...t?.show?.config}).start(({finished:t})=>{t&&Q(!1)})}else{Q(!0);('spring'===t?.hide?.animation?o().Animated.spring:o().Animated.timing)(U,{toValue:0,useNativeDriver:y,duration:200,...t?.hide?.config}).start()}return()=>U.stopAnimation()},[U,q]);const[X,Z]=e().default.useState({height:0}),{routes:$}=b,tt=(0,n.useFrameSize)(t=>S({state:b,descriptors:h,insets:x,dimensions:t,style:[z,L]})),et=(0,n.useFrameSize)(t=>B({state:b,descriptors:h,dimensions:t})),ot=(0,n.useFrameSize)(t=>v({state:b,descriptors:h,dimensions:t})),it='left'===A||'right'===A,rt='material'===_?p:f,nt=(0,n.useFrameSize)(t=>it&&et?(0,n.getDefaultSidebarWidth)(t):0),at=F?.();return(0,t().jsxs)(o().Animated.View,{style:[{pointerEvents:J?'none':'auto'},'left'===A?P.start:'right'===A?P.end:P.bottom,'right'===A?{borderLeftWidth:o().StyleSheet.hairlineWidth}:'left'===A?{borderRightWidth:o().StyleSheet.hairlineWidth}:'top'===A?{borderBottomWidth:o().StyleSheet.hairlineWidth}:{borderTopWidth:o().StyleSheet.hairlineWidth},{backgroundColor:null!=at?'transparent':C.card,borderColor:C.border},it?{paddingTop:(et?rt:rt/2)+x.top,paddingBottom:(et?rt:rt/2)+x.bottom,paddingStart:rt+('left'===A?x.left:0),paddingEnd:rt+('right'===A?x.right:0),minWidth:nt}:[{transform:[{translateY:U.interpolate({inputRange:[0,1],outputRange:[X.height+x['top'===A?'top':'bottom']+o().StyleSheet.hairlineWidth,0]})}],position:J?'absolute':void 0},{height:tt,paddingBottom:'bottom'===A?x.bottom:0,paddingTop:'top'===A?x.top:0,paddingHorizontal:Math.max(x.left,x.right)}],z],onLayout:it?void 0:t=>{const{height:e}=t.nativeEvent.layout;Y?.(e),Z(t=>e===t.height?t:{height:e})},children:[(0,t().jsx)(o().View,{style:[o().StyleSheet.absoluteFill,P.pointerEventsNone],children:at}),(0,t().jsx)(o().View,{role:"tablist",style:it?P.sideContent:P.bottomContent,children:$.map((e,o)=>{const l=o===b.index,u=h[e.key],{options:f}=u,p='function'==typeof f.tabBarLabel?f.tabBarLabel:(0,n.getLabel)({label:f.tabBarLabel,title:f.title},e.name),y=void 0!==f.tabBarAccessibilityLabel?f.tabBarAccessibilityLabel:void 0;return(0,t().jsx)(s.NavigationProvider,{route:e,navigation:u.navigation,children:(0,t().jsx)(c.BottomTabItem,{href:W(e.name,e.params),route:e,descriptor:u,focused:l,horizontal:et,compact:ot,sidebar:it,variant:_,onPress:()=>{const t=w.emit({type:'tabPress',target:e.key,canPreventDefault:!0});l||t.defaultPrevented||k(e.key)},onLongPress:()=>{w.emit({type:'tabLongPress',target:e.key})},accessibilityLabel:y,testID:f.tabBarButtonTestID,allowFontScaling:f.tabBarAllowFontScaling,activeTintColor:M,inactiveTintColor:H,activeBackgroundColor:N,inactiveBackgroundColor:R,button:f.tabBarButton,icon:f.tabBarIcon??(({color:e,size:o})=>(0,t().jsx)(n.MissingIcon,{color:e,size:o})),badge:f.tabBarBadge,badgeStyle:f.tabBarBadgeStyle,label:p,showLabel:I,labelStyle:f.tabBarLabelStyle,iconStyle:f.tabBarIconStyle,style:[it?{marginVertical:et?'material'===_?0:1:rt/2}:P.bottomItem,f.tabBarItemStyle]})},e.name)})})]})}const P=o().StyleSheet.create({start:{top:0,bottom:0,start:0},end:{top:0,bottom:0,end:0},bottom:{start:0,end:0,bottom:0,elevation:8},bottomContent:{flex:1,flexDirection:'row'},sideContent:{flex:1,flexDirection:'column'},bottomItem:{flex:1},pointerEventsNone:{pointerEvents:'none'}})},549,[24,30,33,550,427,616,617,618]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var u in n)Object.defineProperty(t,u,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,u).get})})(e,{get Assets(){return V},get Background(){return l.Background},get Badge(){return H.Badge},get Button(){return s.Button},get Header(){return h.Header},get HeaderBackButton(){return S.HeaderBackButton},get HeaderBackContext(){return P.HeaderBackContext},get HeaderBackground(){return p.HeaderBackground},get HeaderButton(){return k.HeaderButton},get HeaderHeightContext(){return y.HeaderHeightContext},get HeaderShownContext(){return x.HeaderShownContext},get HeaderTitle(){return C.HeaderTitle},get Label(){return j.Label},get Lazy(){return w.Lazy},get MissingIcon(){return L.MissingIcon},get PlatformPressable(){return T.PlatformPressable},get ResourceSavingView(){return _.ResourceSavingView},get SafeAreaProviderCompat(){return D.SafeAreaProviderCompat},get Screen(){return z.Screen},get Text(){return M.Text},get getDefaultHeaderHeight(){return b.getDefaultHeaderHeight},get getDefaultSidebarWidth(){return f.getDefaultSidebarWidth},get getHeaderTitle(){return B.getHeaderTitle},get getLabel(){return v.getLabel},get useFrameSize(){return A.useFrameSize},get useHeaderHeight(){return O.useHeaderHeight}});const t=R(r(d[0])),n=R(r(d[1])),u=R(r(d[2])),o=R(r(d[3])),c=R(r(d[4])),l=r(d[5]),H=r(d[6]),s=r(d[7]),f=r(d[8]),b=r(d[9]),B=r(d[10]),h=r(d[11]),S=r(d[12]),P=r(d[13]),p=r(d[14]),k=r(d[15]),y=r(d[16]),x=r(d[17]),C=r(d[18]),O=r(d[19]),v=r(d[20]),j=r(d[21]),w=r(d[22]),L=r(d[23]),T=r(d[24]),_=r(d[25]),D=r(d[26]),z=r(d[27]),M=r(d[28]),A=r(d[29]);var F,I;function R(t){return t&&t.__esModule?t:{default:t}}F=r(d[30]),I=e,Object.keys(F).forEach(function(t){"default"===t||Object.prototype.hasOwnProperty.call(I,t)||Object.defineProperty(I,t,{enumerable:!0,get:function(){return F[t]}})});const V=[n.default,t.default,c.default,o.default,u.default]},550,[551,552,553,554,555,556,557,560,563,564,565,566,595,605,599,597,606,601,603,607,608,609,610,611,561,612,613,614,562,593,615]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png",width:50,height:85,toString(){return this.uri}}},551,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png",width:96,height:96,toString(){return this.uri}}},552,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png",width:64,height:64,toString(){return this.uri}}},553,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png",width:96,height:96,toString(){return this.uri}}},554,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png",width:96,height:96,toString(){return this.uri}}},555,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function n(){const t=r(d[0]);return n=function(){return t},t}function t(){const n=r(d[1]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"Background",{enumerable:!0,get:function(){return u}});const o=r(d[2]);function u({style:u,...c}){const{colors:s}=(0,o.useTheme)();return(0,n().jsx)(t().Animated.View,{...c,style:[{flex:1,backgroundColor:s.background},u]})}},556,[24,33,427]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}function n(){const t=l(r(d[1]));return n=function(){return t},t}function o(){const t=r(d[2]);return o=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"Badge",{enumerable:!0,get:function(){return p}});const u=r(d[3]),c=r(d[4]);function f(t){if("function"!=typeof WeakMap)return null;var n=new WeakMap,o=new WeakMap;return(f=function(t){return t?o:n})(t)}function l(t,n){if(!n&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var o=f(n);if(o&&o.has(t))return o.get(t);var u={__proto__:null},c=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in t)if("default"!==l&&Object.prototype.hasOwnProperty.call(t,l)){var s=c?Object.getOwnPropertyDescriptor(t,l):null;s&&(s.get||s.set)?Object.defineProperty(u,l,s):u[l]=t[l]}return u.default=t,o&&o.set(t,u),u}const s='web'!==o().Platform.OS;function p({children:f,style:l,visible:p=!0,size:h=18,...y}){const[O]=n().useState(()=>new(o().Animated.Value)(p?1:0)),[v,_]=n().useState(p),{colors:j,fonts:w}=(0,c.useTheme)();if(n().useEffect(()=>{if(v)return o().Animated.timing(O,{toValue:p?1:0,duration:150,useNativeDriver:s}).start(({finished:t})=>{t&&!p&&_(!1)}),()=>O.stopAnimation()},[O,v,p]),!v){if(!p)return null;_(!0)}const{backgroundColor:S=j.notification,...P}=o().StyleSheet.flatten(l)||{},k=(0,u.isLight)(S)?'black':'white',M=h/2,A=Math.floor(3*h/4);return(0,t().jsx)(o().Animated.Text,{numberOfLines:1,style:[{transform:[{scale:O.interpolate({inputRange:[0,1],outputRange:[.5,1]})}],color:k,lineHeight:h-1,height:h,minWidth:h,opacity:O,backgroundColor:S,fontSize:A,borderRadius:M,borderCurve:'continuous'},w.regular,b.container,P],...y,children:f})}const b=o().StyleSheet.create({container:{alignSelf:'flex-end',textAlign:'center',paddingHorizontal:4,overflow:'hidden'}})},557,[24,30,33,558,427]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const u=n(r(d[0]));return t=function(){return u},u}function n(t){return t&&t.__esModule?t:{default:t}}function u(n){const u=(0,t().default)(n);if(null!=u)return[u>>>24,u>>>16&255,u>>>8&255,255&u]}function o([t,n,u,o]){return`rgba(${t}, ${n}, ${u}, ${o/255})`}function c(t){const n=u(t);if(!n)return;const[o,c,f]=n;return(2126*o+7152*c+722*f)/1e4<128}function f(t){const n=c(t);return void 0===n?void 0:!n}function s(t,n){if(Number.isNaN(n))return;const c=u(t);return c?void 0===n?c[3]/255:(c[3]=255*Math.max(0,Math.min(1,n)),o(c)):void 0}function h(t,n){if(Number.isNaN(n))return;const c=u(t);if(!c)return;const[f,s,h,M]=c,l=[f/255,s/255,h/255],b=Math.max(...l),v=Math.min(...l),N=(b+v)/2,_=b-v;let p=0,O=0;0!==_&&(O=_/(1-Math.abs(2*N-1)),p=b===l[0]?((l[1]-l[2])/_+(l[1]{const n=(t+1)%1;return n<.16666666666666666?x+6*(j-x)*n:n<.5?j:n<.6666666666666666?x+(j-x)*(.6666666666666666-n)*6:x};return o([Math.round(255*y(p+.3333333333333333)),Math.round(255*y(p)),Math.round(255*y(p-.3333333333333333)),M])}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var u in n)Object.defineProperty(t,u,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,u).get})})(e,{get alpha(){return s},get darken(){return h},get isDark(){return c},get isLight(){return f}})},558,[559]); +__d(function(_g,_r,i,a,m,e,d){'use strict';const r=new Map;function n(r){const n=p();let t;if(t=n.hex6.exec(r))return parseInt(t[1]+'ff',16)>>>0;const c=v(r);return null!=c?c:(t=n.rgba.exec(r)||n.rgb.exec(r))?void 0!==t[9]?(y(t[9])<<24|y(t[10])<<16|y(t[11])<<8|w(t[12]))>>>0:void 0!==t[5]?(y(t[5])<<24|y(t[6])<<16|y(t[7])<<8|w(t[8]))>>>0:(y(t[2])<<24|y(t[3])<<16|y(t[4])<<8|255)>>>0:(t=n.hex3.exec(r))?parseInt(t[1]+t[1]+t[2]+t[2]+t[3]+t[3]+'ff',16)>>>0:(t=n.hex8.exec(r))?parseInt(t[1],16)>>>0:(t=n.hex4.exec(r))?parseInt(t[1]+t[1]+t[2]+t[2]+t[3]+t[3]+t[4]+t[4],16)>>>0:(t=n.hsl.exec(r))?(255|s(k(t[1]),x(t[2]),x(t[3])))>>>0:(t=n.hsla.exec(r))?void 0!==t[6]?(s(k(t[6]),x(t[7]),x(t[8]))|w(t[9]))>>>0:(s(k(t[2]),x(t[3]),x(t[4]))|w(t[5]))>>>0:(t=n.hwb.exec(r))?void 0!==t[5]?(u(k(t[5]),x(t[6]),x(t[7]))|w(t[8]))>>>0:(255|u(k(t[2]),x(t[3]),x(t[4])))>>>0:null}function t(r,n,t){return t<0&&(t+=1),t>1&&(t-=1),t<.16666666666666666?r+6*(n-r)*t:t<.5?n:t<.6666666666666666?r+(n-r)*(.6666666666666666-t)*6:r}function s(r,n,s){const u=s<.5?s*(1+n):s+n-s*n,c=2*s-u,l=t(c,u,r+.3333333333333333),o=t(c,u,r),g=t(c,u,r-.3333333333333333);return Math.round(255*l)<<24|Math.round(255*o)<<16|Math.round(255*g)<<8}function u(r,n,s){if(n+s>=1){const r=Math.round(255*n/(n+s));return r<<24|r<<16|r<<8}const u=t(0,1,r+.3333333333333333)*(1-n-s)+n,c=t(0,1,r)*(1-n-s)+n,l=t(0,1,r-.3333333333333333)*(1-n-s)+n;return Math.round(255*u)<<24|Math.round(255*c)<<16|Math.round(255*l)<<8}const c='[-+]?\\d*\\.?\\d+',l="[-+]?\\d*\\.?\\d+%";function o(...r){return'\\(\\s*('+r.join(')\\s*,?\\s*(')+')\\s*\\)'}function g(...r){return'\\(\\s*('+r.join(')\\s*(')+')\\s*\\)'}function h(...r){return'\\(\\s*('+r.slice(0,r.length-1).join(')\\s*,?\\s*(')+')\\s*/\\s*('+r[r.length-1]+')\\s*\\)'}function f(...r){return'\\(\\s*('+r.join(')\\s*,\\s*(')+')\\s*\\)'}let b;function p(){if(void 0===b){const r=o(c,c,c)+'|'+f(c,c,c,c)+'|'+h(c,c,c,c);b={rgb:new RegExp('rgb('+r+')'),rgba:new RegExp('rgba('+r+')'),hsl:new RegExp('hsl'+o(c,l,l)),hsla:new RegExp('hsla('+f(c,l,l,c)+'|'+h(c,l,l,c)+')'),hwb:new RegExp('hwb('+g(c,l,l)+'|'+h(c,l,l,c)+')'),hex3:/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex4:/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#([0-9a-fA-F]{6})$/,hex8:/^#([0-9a-fA-F]{8})$/}}return b}function y(r){const n=parseInt(r,10);return n<0?0:n>255?255:n}function k(r){return(parseFloat(r)%360+360)%360/360}function w(r){const n=parseFloat(r);return n<0?0:n>1?255:Math.round(255*n)}function x(r){const n=parseFloat(r);return n<0?0:n>100?1:n/100}function v(r){switch(r){case'transparent':return 0;case'aliceblue':return 4042850303;case'antiquewhite':return 4209760255;case'aqua':case'cyan':return 16777215;case'aquamarine':return 2147472639;case'azure':return 4043309055;case'beige':return 4126530815;case'bisque':return 4293182719;case'black':return 255;case'blanchedalmond':return 4293643775;case'blue':return 65535;case'blueviolet':return 2318131967;case'brown':return 2771004159;case'burlywood':return 3736635391;case'burntsienna':return 3934150143;case'cadetblue':return 1604231423;case'chartreuse':return 2147418367;case'chocolate':return 3530104575;case'coral':return 4286533887;case'cornflowerblue':return 1687547391;case'cornsilk':return 4294499583;case'crimson':return 3692313855;case'darkblue':return 35839;case'darkcyan':return 9145343;case'darkgoldenrod':return 3095792639;case'darkgray':case'darkgrey':return 2846468607;case'darkgreen':return 6553855;case'darkkhaki':return 3182914559;case'darkmagenta':return 2332068863;case'darkolivegreen':return 1433087999;case'darkorange':return 4287365375;case'darkorchid':return 2570243327;case'darkred':return 2332033279;case'darksalmon':return 3918953215;case'darkseagreen':return 2411499519;case'darkslateblue':return 1211993087;case'darkslategray':case'darkslategrey':return 793726975;case'darkturquoise':return 13554175;case'darkviolet':return 2483082239;case'deeppink':return 4279538687;case'deepskyblue':return 12582911;case'dimgray':case'dimgrey':return 1768516095;case'dodgerblue':return 512819199;case'firebrick':return 2988581631;case'floralwhite':return 4294635775;case'forestgreen':return 579543807;case'fuchsia':case'magenta':return 4278255615;case'gainsboro':return 3705462015;case'ghostwhite':return 4177068031;case'gold':return 4292280575;case'goldenrod':return 3668254975;case'gray':case'grey':return 2155905279;case'green':return 8388863;case'greenyellow':return 2919182335;case'honeydew':return 4043305215;case'hotpink':return 4285117695;case'indianred':return 3445382399;case'indigo':return 1258324735;case'ivory':return 4294963455;case'khaki':return 4041641215;case'lavender':return 3873897215;case'lavenderblush':return 4293981695;case'lawngreen':return 2096890111;case'lemonchiffon':return 4294626815;case'lightblue':return 2916673279;case'lightcoral':return 4034953471;case'lightcyan':return 3774873599;case'lightgoldenrodyellow':return 4210742015;case'lightgray':case'lightgrey':return 3553874943;case'lightgreen':return 2431553791;case'lightpink':return 4290167295;case'lightsalmon':return 4288707327;case'lightseagreen':return 548580095;case'lightskyblue':return 2278488831;case'lightslategray':case'lightslategrey':return 2005441023;case'lightsteelblue':return 2965692159;case'lightyellow':return 4294959359;case'lime':return 16711935;case'limegreen':return 852308735;case'linen':return 4210091775;case'maroon':return 2147483903;case'mediumaquamarine':return 1724754687;case'mediumblue':return 52735;case'mediumorchid':return 3126187007;case'mediumpurple':return 2473647103;case'mediumseagreen':return 1018393087;case'mediumslateblue':return 2070474495;case'mediumspringgreen':return 16423679;case'mediumturquoise':return 1221709055;case'mediumvioletred':return 3340076543;case'midnightblue':return 421097727;case'mintcream':return 4127193855;case'mistyrose':return 4293190143;case'moccasin':return 4293178879;case'navajowhite':return 4292783615;case'navy':return 33023;case'oldlace':return 4260751103;case'olive':return 2155872511;case'olivedrab':return 1804477439;case'orange':return 4289003775;case'orangered':return 4282712319;case'orchid':return 3664828159;case'palegoldenrod':return 4008225535;case'palegreen':return 2566625535;case'paleturquoise':return 2951671551;case'palevioletred':return 3681588223;case'papayawhip':return 4293907967;case'peachpuff':return 4292524543;case'peru':return 3448061951;case'pink':return 4290825215;case'plum':return 3718307327;case'powderblue':return 2967529215;case'purple':return 2147516671;case'rebeccapurple':return 1714657791;case'red':return 4278190335;case'rosybrown':return 3163525119;case'royalblue':return 1097458175;case'saddlebrown':return 2336560127;case'salmon':return 4202722047;case'sandybrown':return 4104413439;case'seagreen':return 780883967;case'seashell':return 4294307583;case'sienna':return 2689740287;case'silver':return 3233857791;case'skyblue':return 2278484991;case'slateblue':return 1784335871;case'slategray':case'slategrey':return 1887473919;case'snow':return 4294638335;case'springgreen':return 16744447;case'steelblue':return 1182971135;case'tan':return 3535047935;case'teal':return 8421631;case'thistle':return 3636451583;case'tomato':return 4284696575;case'turquoise':return 1088475391;case'violet':return 4001558271;case'wheat':return 4125012991;case'white':return 4294967295;case'whitesmoke':return 4126537215;case'yellow':return 4294902015;case'yellowgreen':return 2597139199}return null}m.exports=function(t){if('number'==typeof t)return t>>>0===t&&t>=0&&t<=4294967295?t:null;if('string'!=typeof t)return null;if(r.has(t)){const n=r.get(t);return r.delete(t),r.set(t,n),n}const s=n(t);return r.size>=1024&&r.delete(r.keys().next().value),r.set(t,s),s}},559,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}function n(){const t=r(d[1]);return n=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"Button",{enumerable:!0,get:function(){return v}});const o=r(d[2]),l=r(d[3]),s=p(r(d[4])),c=r(d[5]),u=r(d[6]),f=r(d[7]),h=r(d[8]);function p(t){return t&&t.__esModule?t:{default:t}}const b=40;function v({href:n,...o}){return null!=n?(0,t().jsx)(x,{...o,href:n}):(0,t().jsx)(P,{...o})}function x({href:c,onPress:u,...f}){const{href:h}=(0,s.default)({href:(0,l.resolveHref)(c)});return(0,t().jsx)(P,{...f,href:h,onPress:t=>{u?.(t),'web'!==n().Platform.OS&&t?.defaultPrevented||o.router.navigate(c)}})}function P({variant:o="tinted",color:l,android_ripple:s,style:p,children:v,...x}){const{colors:P,fonts:_}=(0,u.useTheme)(),j=l??P.primary,S=(0,c.alpha)(j);let k,O;switch(o){case'plain':k='transparent',O=j;break;case'tinted':k=(void 0===S?void 0:(0,c.alpha)(j,.15*S))??j,O=j;break;case'filled':k=j,O=(0,c.isDark)(j)?'white':(0,c.darken)(j,.71)??j}return(0,t().jsx)(f.PlatformPressable,{...x,android_ripple:{radius:b,color:(0,c.alpha)(O,.15*((0,c.alpha)(O)??1))??O,...s},pressOpacity:'ios'===n().Platform.OS?void 0:1,hoverEffect:{color:O},style:[{backgroundColor:k},y.button,p],children:(0,t().jsx)(h.Text,{style:[{color:O},_.regular,y.text],children:v})})}const y=n().StyleSheet.create({button:{paddingHorizontal:24,paddingVertical:10,borderRadius:b,borderCurve:'continuous'},text:{fontSize:14,lineHeight:20,letterSpacing:.1,textAlign:'center'}})},560,[24,33,512,353,518,558,427,561,562]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(){const t=r(d[0]);return e=function(){return t},t}function t(){const e=s(r(d[1]));return t=function(){return e},e}function n(){const e=r(d[2]);return n=function(){return e},e}Object.defineProperty(_e,"__esModule",{value:!0}),Object.defineProperty(_e,"PlatformPressable",{enumerable:!0,get:function(){return p}});const o=r(d[3]);function l(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(l=function(e){return e?n:t})(e)}function s(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=l(t);if(n&&n.has(e))return n.get(e);var o={__proto__:null},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var c in e)if("default"!==c&&Object.prototype.hasOwnProperty.call(e,c)){var u=s?Object.getOwnPropertyDescriptor(e,c):null;u&&(u.get||u.set)?Object.defineProperty(o,c,u):o[c]=e[c]}return o.default=e,n&&n.set(e,o),o}const c=n().Animated.createAnimatedComponent(n().Pressable),u='android'===n().Platform.OS&&n().Platform.Version>=21,f='web'!==n().Platform.OS;const p=function({ref:l,disabled:s,onPress:p,onPressIn:y,onPressOut:v,android_ripple:b,pressColor:O,pressOpacity:h=.3,hoverEffect:_,style:j,children:w,...S}){const{dark:K}=(0,o.useTheme)(),[k]=t().useState(()=>new(n().Animated.Value)(1)),x=(e,t)=>{u||n().Animated.timing(k,{toValue:e,duration:t,easing:n().Easing.inOut(n().Easing.quad),useNativeDriver:f}).start()};return(0,e().jsxs)(c,{ref:l,accessible:!0,role:'web'===n().Platform.OS&&null!=S.href?'link':'button',onPress:s?void 0:e=>{if('web'===n().Platform.OS&&null!==S.href){const t='metaKey'in e&&e.metaKey||'altKey'in e&&e.altKey||'ctrlKey'in e&&e.ctrlKey||'shiftKey'in e&&e.shiftKey,n=!('button'in e)||(null==e.button||0===e.button),o=!e.currentTarget||!('target'in e.currentTarget)||[void 0,null,'','self'].includes(e.currentTarget.target);!t&&n&&o&&(e.preventDefault(),p?.(e))}else p?.(e)},onPressIn:s?void 0:e=>{x(h,0),y?.(e)},onPressOut:s?void 0:e=>{x(1,200),v?.(e)},android_ripple:u&&!s?{color:void 0!==O?O:K?'rgba(255, 255, 255, .32)':'rgba(0, 0, 0, .32)',...b}:void 0,style:[{cursor:'web'!==n().Platform.OS&&'ios'!==n().Platform.OS||s?'auto':'pointer',opacity:u||s?1:k},j],...S,children:[s?null:(0,e().jsx)(P,{..._}),w]})},y=String.raw,v="__react-navigation_elements_Pressable_hover",b=y` + .${v} { + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + border-radius: inherit; + background-color: var(--overlay-color); + opacity: 0; + transition: opacity 0.15s; + pointer-events: none; + } + + a:hover > .${v}, button:hover > .${v} { + opacity: var(--overlay-hover-opacity); + } + + a:active > .${v}, button:active > .${v} { + opacity: var(--overlay-active-opacity); + } +`,P=({color:t,hoverOpacity:o=.08,activeOpacity:l=.16})=>'web'!==n().Platform.OS||null==t?null:(0,e().jsxs)(e().Fragment,{children:[(0,e().jsx)("style",{href:v,precedence:"elements",children:b}),(0,e().jsx)("div",{className:v,style:{'--overlay-color':t,'--overlay-hover-opacity':o,'--overlay-active-opacity':l}})]})},561,[24,30,33,427]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}function n(){const t=r(d[1]);return n=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"Text",{enumerable:!0,get:function(){return u}});const o=r(d[2]);function u({style:u,...c}){const{colors:s,fonts:f}=(0,o.useTheme)();return(0,t().jsx)(n().Text,{...c,style:[{color:s.text},f.regular,u]})}},562,[24,33,427]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"getDefaultSidebarWidth",{enumerable:!0,get:function(){return t}});const t=({width:t})=>t-56<=360?t-56:360},563,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}function n(n,o,u){let f;const c='ios'===t().Platform.OS&&u>50?u-(5+1/t().PixelRatio.get()):u,l=n.width>n.height;return f='ios'===t().Platform.OS?t().Platform.isPad||t().Platform.isTV?o?56:50:l?32:o?56:44:64,f+c}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"getDefaultHeaderHeight",{enumerable:!0,get:function(){return n}})},564,[33]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(t,n){return'string'==typeof t.headerTitle?t.headerTitle:void 0!==t.title?t.title:n}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"getHeaderTitle",{enumerable:!0,get:function(){return t}})},565,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(){const t=r(d[0]);return e=function(){return t},t}function t(){const e=r(d[1]);return t=function(){return e},e}function o(){const e=v(r(d[2]));return o=function(){return e},e}function n(){const e=r(d[3]);return n=function(){return e},e}function l(){const e=r(d[4]);return l=function(){return e},e}Object.defineProperty(_e,"__esModule",{value:!0}),Object.defineProperty(_e,"Header",{enumerable:!0,get:function(){return k}});const s=R(r(d[5])),u=r(d[6]),c=r(d[7]),h=r(d[8]),b=r(d[9]),f=r(d[10]),p=r(d[11]),y=r(d[12]),S=r(d[13]),C=r(d[14]),x=r(d[15]),B=r(d[16]),w=r(d[17]);function R(e){return e&&e.__esModule?e:{default:e}}function E(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,o=new WeakMap;return(E=function(e){return e?o:t})(e)}function v(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var o=E(t);if(o&&o.has(e))return o.get(e);var n={__proto__:null},l=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&Object.prototype.hasOwnProperty.call(e,s)){var u=l?Object.getOwnPropertyDescriptor(e,s):null;u&&(u.get||u.set)?Object.defineProperty(n,s,u):n[s]=e[s]}return n.default=e,o&&o.set(e,n),n}function k(R){const E=(0,l().useSafeAreaInsets)(),v=(0,t().useVerticalBarEdgeIOS)(),k=(0,h.useFrameSize)(e=>e,!0),{colors:O}=(0,c.useTheme)(),T=(0,c.useNavigation)(),H=(0,o().use)(C.HeaderShownContext),[W,L]=o().useState(!1),[P,_]=o().useState(void 0),{layout:M=k,modal:V=!1,back:A,title:D,headerTitle:I,headerTitleAlign:N="left",headerLeft:F=(A?t=>(0,e().jsx)(b.HeaderBackButton,{...t}):void 0),headerSearchBarOptions:z,headerTransparent:G,headerTintColor:q,headerBackground:J,headerRight:K,headerTitleAllowFontScaling:Q,headerTitleStyle:U,headerLeftContainerStyle:X,headerRightContainerStyle:Y,headerTitleContainerStyle:Z,headerBackButtonDisplayMode:$="minimal",headerBackTitleStyle:ee,headerBackgroundContainerStyle:te,headerStyle:re,headerShadowVisible:oe,headerPressColor:ne,headerPressOpacity:ae,headerStatusBarHeight:ie=(H?0:(0,w.getHeaderStatusBarHeight)(E,v))}=R,de=(0,B.getDefaultHeaderHeight)(M,V,ie),{height:le=de,maxHeight:se,minHeight:ue,backfaceVisibility:ce,backgroundColor:he,borderBlockColor:be,borderBlockEndColor:fe,borderBlockStartColor:pe,borderBottomColor:ge,borderBottomEndRadius:ye,borderBottomLeftRadius:Se,borderBottomRightRadius:me,borderBottomStartRadius:Ce,borderBottomWidth:xe,borderColor:Be,borderCurve:we,borderEndColor:Re,borderEndEndRadius:Ee,borderEndStartRadius:ve,borderEndWidth:ke,borderLeftColor:je,borderLeftWidth:Oe,borderRadius:Te,borderRightColor:He,borderRightWidth:We,borderStartColor:Le,borderStartEndRadius:Pe,borderStartStartRadius:Me,borderStartWidth:Ve,borderStyle:Ae,borderTopColor:De,borderTopEndRadius:Ie,borderTopLeftRadius:Ne,borderTopRightRadius:Fe,borderTopStartRadius:ze,borderTopWidth:Ge,borderWidth:qe,boxShadow:Je,elevation:Ke,filter:Qe,mixBlendMode:Ue,opacity:Xe,shadowColor:Ye,shadowOffset:Ze,shadowOpacity:$e,shadowRadius:et,transform:tt,transformOrigin:rt,...ot}=n().StyleSheet.flatten(re||{}),nt={backfaceVisibility:ce,backgroundColor:he,borderBlockColor:be,borderBlockEndColor:fe,borderBlockStartColor:pe,borderBottomColor:ge,borderBottomEndRadius:ye,borderBottomLeftRadius:Se,borderBottomRightRadius:me,borderBottomStartRadius:Ce,borderBottomWidth:xe,borderColor:Be,borderCurve:we,borderEndColor:Re,borderEndEndRadius:Ee,borderEndStartRadius:ve,borderEndWidth:ke,borderLeftColor:je,borderLeftWidth:Oe,borderRadius:Te,borderRightColor:He,borderRightWidth:We,borderStartColor:Le,borderStartEndRadius:Pe,borderStartStartRadius:Me,borderStartWidth:Ve,borderStyle:Ae,borderTopColor:De,borderTopEndRadius:Ie,borderTopLeftRadius:Ne,borderTopRightRadius:Fe,borderTopStartRadius:ze,borderTopWidth:Ge,borderWidth:qe,boxShadow:Je,elevation:Ke,filter:Qe,mixBlendMode:Ue,opacity:Xe,shadowColor:Ye,shadowOffset:Ze,shadowOpacity:$e,shadowRadius:et,transform:tt,transformOrigin:rt};for(const e in nt)void 0===nt[e]&&delete nt[e];const at={...G&&{backgroundColor:'transparent'},...(G||!1===oe)&&{borderBottomWidth:0,...n().Platform.select({android:{elevation:0},web:{boxShadow:'none'},default:{shadowOpacity:0}})},...nt},it=q??n().Platform.select({ios:O.primary,default:O.text}),dt=F?F({tintColor:it,pressColor:ne,pressOpacity:ae,displayMode:$,titleLayout:P,screenLayout:M,canGoBack:Boolean(A),onPress:A?T.goBack:void 0,label:A?.title,labelStyle:ee,href:A?.href}):null,lt=K?K({tintColor:it,pressColor:ne,pressOpacity:ae,canGoBack:Boolean(A)}):null,st='function'!=typeof I?t=>(0,e().jsx)(x.HeaderTitle,{...t}):I;return(0,e().jsxs)(n().Animated.View,{style:[j.boxNone,{height:le,minHeight:ue,maxHeight:se,opacity:Xe,transform:tt}],children:[(0,e().jsx)(n().Animated.View,{style:[n().StyleSheet.absoluteFill,j.boxNone,te],children:J?J({style:at}):(0,e().jsx)(f.HeaderBackground,{style:[{pointerEvents:G&&('transparent'===at.backgroundColor||at.backgroundColor&&0===(0,u.alpha)(at.backgroundColor))?'none':'auto'},at]})}),(0,e().jsx)(n().View,{style:[j.pointerEventsNone,{height:ie}]}),(0,e().jsxs)(n().View,{style:[j.content,null],children:[(0,e().jsx)(n().Animated.View,{style:[j.start,!W&&'center'===N&&j.expand,{marginStart:E.left},X],children:dt}),W?null:(0,e().jsxs)(e().Fragment,{children:[(0,e().jsx)(n().Animated.View,{style:[j.title,{maxWidth:'center'===N?M.width-2*((dt?'minimal'!==$?80:32:16)+(lt||z?16:0)+Math.max(E.left,E.right)):M.width-((dt?52:16)+(lt||z?52:16)+E.left-E.right)},'left'===N&&dt?{marginStart:4}:{marginHorizontal:16},Z],children:st({children:D,allowFontScaling:Q,tintColor:q,onLayout:e=>{const{height:t,width:o}=e.nativeEvent.layout;_(e=>e&&t===e.height&&o===e.width?e:{height:t,width:o})},style:U})}),(0,e().jsxs)(n().Animated.View,{style:[j.end,j.expand,{marginEnd:E.right},Y],children:[lt,z?(0,e().jsx)(p.HeaderButton,{tintColor:it,pressColor:ne,pressOpacity:ae,onPress:()=>{L(!0),z?.onOpen?.()},children:(0,e().jsx)(y.HeaderIcon,{source:s.default,tintColor:it})}):null]})]}),W?(0,e().jsx)(S.HeaderSearchBar,{...z,visible:W,onClose:()=>{L(!1),z?.onClose?.()},tintColor:q,style:[!dt&&{marginStart:8}]}):null]})]})}const j=n().StyleSheet.create({content:{flex:1,flexDirection:'row',alignItems:'stretch',pointerEvents:'box-none'},large:{marginHorizontal:5},title:{pointerEvents:'box-none',justifyContent:'center'},start:{pointerEvents:'box-none',flexDirection:'row',alignItems:'center',justifyContent:'flex-start'},end:{pointerEvents:'box-none',flexDirection:'row',alignItems:'center',justifyContent:'flex-end'},expand:{flexGrow:1,flexBasis:0},boxNone:{pointerEvents:'box-none'},pointerEventsNone:{pointerEvents:'none'}})},566,[24,567,30,33,289,555,558,427,593,595,599,597,598,600,601,603,564,604]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"StatusBar",{enumerable:!0,get:function(){return t.StatusBar}}),Object.defineProperty(e,"setStatusBarStyle",{enumerable:!0,get:function(){return t.setStatusBarStyle}}),Object.defineProperty(e,"setStatusBarHidden",{enumerable:!0,get:function(){return t.setStatusBarHidden}}),Object.defineProperty(e,"useVerticalBarEdgeIOS",{enumerable:!0,get:function(){return t.useVerticalBarEdgeIOS}});var t=r(d[0])},567,[568]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StatusBar=s,Object.defineProperty(_e,"setStatusBarStyle",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e,"setStatusBarHidden",{enumerable:!0,get:function(){return y}}),_e.useVerticalBarEdgeIOS=function(){return n.default.useSyncExternalStore(V,_,_)};var t=r(d[0]),n=e(r(d[1])),u=e(r(d[2])),l=e(r(d[3])),o=e(r(d[4])),c=e(r(d[5]));function s({style:e,hideTransitionAnimation:u,animated:c,hidden:s,verticalBarBehaviorIOS:h}){const S=(0,o.default)(),B=n.default.useMemo(()=>p(e,S??void 0),[e,S]),y=n.default.useRef({});return n.default.useEffect(()=>{const e=y.current;return f.push(e),()=>{f.splice(f.indexOf(e),1),v()}},[]),n.default.useEffect(()=>{y.current.behavior=h,v()},[h]),(0,t.jsx)(l.default,{animated:c,hidden:s,barStyle:B,showHideTransition:'none'===u?void 0:u})}const f=[];let h='automatic',S='automatic';function v(){let e=h;for(const t of f)e=t.behavior??e;e!==S&&(S=e,c.default?.setVerticalBarBehavior(e))}s.setStyle=(e,t)=>l.default.setBarStyle(p(e),t);const B=s.setStyle;s.setHidden=(e,t)=>l.default.setHidden(e,t);const y=s.setHidden;let E;s.getVerticalBarEdgeIOS=()=>c.default?.getVerticalBarEdge()??null,s.setVerticalBarBehaviorIOS=e=>{h=e,v()};let O=null;const b=new Set;function V(e){return b.add(e),c.default&&!O&&(O=c.default.addListener('onVerticalBarEdgeChange',e=>{E=e.edge,b.forEach(e=>e())}),E=void 0),()=>{b.delete(e),0===b.size&&(O?.remove(),O=null,E=void 0)}}function _(){return void 0===E&&(E=s.getVerticalBarEdgeIOS()),E}function p(e="auto",t=u.default?.getColorScheme()??'light'){t||(t='light');let n=e;return'auto'===e?n='light'===t?'dark':'light':'inverted'===e&&(n='light'===t?'light':'dark'),'light'===n?'light-content':'dark-content'}},568,[24,30,227,270,285,569]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}});var t=(0,r(d[0]).requireOptionalNativeModule)('ExpoStatusBar')},569,[570]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"disableErrorHandling",{enumerable:!0,get:function(){return t.disableErrorHandling}}),Object.defineProperty(_e,"registerRootComponent",{enumerable:!0,get:function(){return u.default}}),Object.defineProperty(_e,"isRunningInExpoGo",{enumerable:!0,get:function(){return o.isRunningInExpoGo}}),Object.defineProperty(_e,"getExpoGoProjectConfig",{enumerable:!0,get:function(){return o.getExpoGoProjectConfig}}),Object.defineProperty(_e,"EventEmitter",{enumerable:!0,get:function(){return c.EventEmitter}}),Object.defineProperty(_e,"SharedObject",{enumerable:!0,get:function(){return c.SharedObject}}),Object.defineProperty(_e,"SharedRef",{enumerable:!0,get:function(){return c.SharedRef}}),Object.defineProperty(_e,"NativeModule",{enumerable:!0,get:function(){return c.NativeModule}}),Object.defineProperty(_e,"UnavailabilityError",{enumerable:!0,get:function(){return c.UnavailabilityError}}),Object.defineProperty(_e,"CodedError",{enumerable:!0,get:function(){return c.CodedError}}),Object.defineProperty(_e,"requireNativeModule",{enumerable:!0,get:function(){return c.requireNativeModule}}),Object.defineProperty(_e,"requireOptionalNativeModule",{enumerable:!0,get:function(){return c.requireOptionalNativeModule}}),Object.defineProperty(_e,"requireNativeView",{enumerable:!0,get:function(){return c.requireNativeViewManager}}),Object.defineProperty(_e,"registerWebModule",{enumerable:!0,get:function(){return c.registerWebModule}}),Object.defineProperty(_e,"reloadAppAsync",{enumerable:!0,get:function(){return c.reloadAppAsync}}),Object.defineProperty(_e,"installOnUIRuntime",{enumerable:!0,get:function(){return c.installOnUIRuntime}}),Object.defineProperty(_e,"Platform",{enumerable:!0,get:function(){return c.Platform}}),Object.defineProperty(_e,"uuid",{enumerable:!0,get:function(){return c.uuid}}),Object.defineProperty(_e,"createSnapshotFriendlyRef",{enumerable:!0,get:function(){return c.createSnapshotFriendlyRef}}),Object.defineProperty(_e,"useReleasingSharedObject",{enumerable:!0,get:function(){return c.useReleasingSharedObject}}),Object.defineProperty(_e,"useReleasingSharedObjectWithLifecycle",{enumerable:!0,get:function(){return c.useReleasingSharedObjectWithLifecycle}}),Object.defineProperty(_e,"PermissionStatus",{enumerable:!0,get:function(){return c.PermissionStatus}}),Object.defineProperty(_e,"createPermissionHook",{enumerable:!0,get:function(){return c.createPermissionHook}}),Object.defineProperty(_e,"useEvent",{enumerable:!0,get:function(){return f.useEvent}}),Object.defineProperty(_e,"useEventListener",{enumerable:!0,get:function(){return f.useEventListener}}),r(d[0]);var e,t=r(d[1]),n=r(d[2]),u=(e=n)&&e.__esModule?e:{default:e},o=r(d[3]),c=r(d[4]),f=r(d[5])},570,[571,588,589,591,301,592]); +__d(function(g,r,i,a,m,e,d){"use strict";r(d[0]),r(d[1]),r(d[2])},571,[572,577,587]); +__d(function(g,r,i,a,m,e,d){"use strict";r(d[0])},572,[573]); +__d(function(g,r,i,a,m,e,d){"use strict";r(d[0]),r(d[1]),Object.defineProperty(globalThis,'__ExpoImportMetaRegistry',{value:r(d[2]).ImportMetaRegistry,enumerable:!1,writable:!0})},573,[574,575,576]); +__d(function(g,r,i,a,m,e,d){},574,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.getBundleUrl=function(){let t=n;'undefined'==typeof window&&(t='file://'+__filename);if(null==t)return null;const o=new URL(t);return`${o.protocol}//${o.host}${o.pathname}`};const n='undefined'!=typeof window?document.currentScript?.src:null},575,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ImportMetaRegistry",{enumerable:!0,get:function(){return n}});var t=r(d[0]);const n={get url(){return(0,t.getBundleUrl)()}}},576,[575]); +__d(function(g,r,i,a,m,e,d){"use strict";var _=r(d[0]);globalThis[`${globalThis.__METRO_GLOBAL_PREFIX__??''}__loadBundleAsync`]=(0,_.buildAsyncRequire)()},577,[578]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.buildAsyncRequire=function(){const o=new Map,s=globalThis,u=`${s.__METRO_GLOBAL_PREFIX__??''}__expo_chunk_completion__`,c=s[u]??=new Set,l=t=>{if(!c)return t;const o=(0,n.buildUrlForBundle)(t);return'undefined'==typeof document?o:new URL(o,document.baseURI).href};async function f(n,s=!1){const u=l(n);if(c?.has(u))return;let f=o.get(u);if(f||(f=(0,t.loadBundleAsync)(n).catch(n=>{throw o.get(u)===f&&o.delete(u),n}),o.set(u,f)),await f,s&&c&&!c.has(u))throw o.get(u)===f&&o.delete(u),new Error(`Chunk ${u} did not finish registering its modules. Check the console for an earlier script error. If none is present, report this as an Expo bug.`)}const _=async function(n){if('string'==typeof n)return f(n);await Promise.all(n.map(n=>f(n,!0)))};c&&(_.isReady=n=>n.every(n=>c.has(l(n))));return _};var n=r(d[0]),t=r(d[1])},578,[579,582]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.buildUrlForBundle=function(e){if(/^https?:\/\//.test(e))return e;const{url:t}=(0,u.default)();return t?new URL(e,t).toString():`//${e.replace(/^\/+/,'')}`};var e,t=r(d[0]),u=(e=t)&&e.__esModule?e:{default:e}},579,[580]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return n}});var l=r(d[0]);var n=()=>'undefined'==typeof window?{bundleLoadedFromServer:!0,fullBundleUrl:'',url:''}:{bundleLoadedFromServer:!0,get fullBundleUrl(){return(0,l.getFullBundlerUrl)()},url:location.origin+location.pathname}},580,[581]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.getFullBundlerUrl=function(){const t=document?.currentScript,n=new URL(t&&'src'in t?t.src:location.href,location.href);n.searchParams.has('platform')||n.searchParams.set('platform',"web");return n.toString()}},581,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.loadBundleAsync=async function(t){const u=(0,n.buildUrlForBundle)(t);return(0,c.fetchThenEvalAsync)(u)};var n=r(d[0]),c=r(d[1])},582,[579,583]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.fetchThenEvalAsync=function(o,{scriptType:c,nonce:s,crossOrigin:u}={}){if('undefined'==typeof window)return r(d[0]).fetchThenEvalAsync(o);return new Promise((p,l)=>{const f=document.createElement('script');c&&(f.type=c),s&&f.setAttribute('nonce',s),f.src=o,u&&0!==f.src.indexOf(window.location.origin+'/')&&(f.crossOrigin=u),f.onload=()=>{f.parentNode&&f.parentNode.removeChild(f),p()};const y=new t;f.onerror=n=>{let t;t='string'==typeof n?{type:'error',target:{src:t}}:n;const c=t&&('load'===t.type?'missing':t.type),s=t?.target?.src;y.message='Loading module '+o+' failed.\n('+c+': '+s+')',y.type=c,y.request=s,f.parentNode&&f.parentNode.removeChild(f),l(y)},f.src===n?p():document.head.appendChild(f)})};const n='undefined'!=typeof document&&document.currentScript&&'src'in document.currentScript&&document.currentScript.src||null;class t extends Error{name='AsyncRequireError'}},583,[584]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.fetchThenEvalAsync=fetchThenEvalAsync,r(d[0]);var _fetchAsync=r(d[1]);function fetchThenEvalAsync(url){return(0,_fetchAsync.fetchAsync)(url).then(({body:body,status:status,headers:headers})=>{if(null!=headers?.has?.('Content-Type')&&headers.get('Content-Type').includes('application/json'))throw new Error(JSON.parse(body).message||`Unknown error fetching '${url}'`);if(200===status)return eval(body);throw new Error(`Failed to load split bundle from URL: ${url}\n${body}`)})}},584,[585,586]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"MetroServerError",{enumerable:!0,get:function(){return t}});class t extends Error{code='METRO_SERVER_ERROR';constructor(t,o){super(t.message),this.name='MetroServerError',this.url=o;for(const o in t)this[o]=t[o]}}},585,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.fetchAsync=async function(t){const s=await fetch(t,{method:'GET',headers:{'expo-platform':'web'}});return{body:await s.text(),status:s.status,headers:s.headers}}},586,[]); +__d(function(g,r,i,a,m,e,d){},587,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.createErrorHandler=function(n){return(t,o)=>n(t,o)},e.disableErrorHandling=function(){}},588,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return o}}),r(d[0]);var e,t=r(d[1]),n=(e=t)&&e.__esModule?e:{default:e};function o(e){let t=e;if(n.default.registerComponent('main',()=>t),'undefined'!=typeof window){const e=document.getElementById('root');n.default.runApplication('main',{rootTag:e,hydrate:globalThis.__EXPO_ROUTER_HYDRATE__})}}},589,[571,590]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return c}});var t=r(d[0]);const n={};function o(){try{return r(d[1],"react-native-web/dist/exports/StyleSheet")}catch{return null}}function s(){try{const t=r(d[2],"react-native-web/dist/exports/StyleSheet/dom");return t?.createSheet??null}catch{return null}}var c={registerComponent:function(c,u){return n[c]={getApplication:n=>{const s=u(),c=n?.initialProps??{};return{element:(0,t.jsx)(s,{...c}),getStyleElement:n=>{const s=o();if(!s?.getSheet)return(0,t.jsx)("style",{...n});const c=s.getSheet();return(0,t.jsx)("style",{...n,dangerouslySetInnerHTML:{__html:c.textContent},id:c.id})}}},run:n=>{const{hydrate:o,initialProps:l={},rootTag:p,callback:h}=n;if(!p)throw new Error(`"rootTag" was not provided for appKey "${c}".`);const f=u(),y=(0,t.jsx)(f,{...l}),w=s();w?.(p);const{createRoot:S,hydrateRoot:b}=r(d[3]);if(o){const t=b(p,y);return h&&h(),t}{const t=S(p);return t.render(y),h&&h(),t}}},c},getApplication:function(t,o){const s=n[t];if(!s)throw new Error(`Application "${t}" has not been registered. This is either due to an import error during initialization or failure to call AppRegistry.registerComponent.`);return s.getApplication(o)},runApplication:function(t,o){const s=n[t];if(!s)throw new Error(`Application "${t}" has not been registered. This is either due to an import error during initialization or failure to call AppRegistry.registerComponent.`);return s.run(o)}}},590,[24,46,88,105]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.isRunningInExpoGo=function(){return!1},e.getExpoGoProjectConfig=function(){return null}},591,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useEvent=function(u,s,c=null){const[o,f]=(0,t.useState)(c);return n(u,s,t=>f(t)),o},e.useEventListener=n;var t=r(d[0]);function n(n,u,s){const c=(0,t.useRef)(s);c.current=s,(0,t.useEffect)(()=>{const t=n.addListener(u,(...t)=>c.current(...t));return()=>t.remove()},[n,u,c])}},592,[30]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}function n(){const t=l(r(d[1]));return n=function(){return t},t}function u(){const t=r(d[2]);return u=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var u in n)Object.defineProperty(t,u,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,u).get})})(e,{get FrameSizeProvider(){return w},get useFrameSize(){return b}});const o=s(r(d[3])),c=r(d[4]);function s(t){return t&&t.__esModule?t:{default:t}}function f(t){if("function"!=typeof WeakMap)return null;var n=new WeakMap,u=new WeakMap;return(f=function(t){return t?u:n})(t)}function l(t,n){if(!n&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var u=f(n);if(u&&u.has(t))return u.get(t);var o={__proto__:null},c=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if("default"!==s&&Object.prototype.hasOwnProperty.call(t,s)){var l=c?Object.getOwnPropertyDescriptor(t,s):null;l&&(l.get||l.set)?Object.defineProperty(o,s,l):o[s]=t[s]}return o.default=t,u&&u.set(t,o),o}const h=n().createContext(void 0);function b(t,u){const o=(0,n().use)(h);if(null==o)throw new Error('useFrameSize must be used within a FrameSizeProvider');return(0,c.useSyncExternalStoreWithSelector)(u?o.subscribeThrottled:o.subscribe,o.getCurrent,o.getCurrent,t)}function w({initialFrame:c,render:s}){const f=n().useRef({width:c.width,height:c.height}),l=n().useRef(new Set),b=(0,o.default)(()=>f.current),w=(0,o.default)(t=>(l.current.add(t),()=>{l.current.delete(t)})),v=(0,o.default)(t=>{let n,u=!1,o=!1;const c=w(()=>{clearTimeout(n),u=!0,o?n=setTimeout(()=>{u&&(u=!1,t())},100):(o=!0,setTimeout(function(){o=!1},100),u=!1,t())});return()=>{c(),clearTimeout(n)}}),y=n().useMemo(()=>({getCurrent:b,subscribe:w,subscribeThrottled:v}),[w,v,b]),O=(0,o.default)(t=>{f.current.height===t.height&&f.current.width===t.width||(f.current={width:t.width,height:t.height},l.current.forEach(t=>t()))}),P=n().useRef(null);n().useEffect(()=>{'web'!==u().Platform.OS&&P.current?.measure((t,n,u,o)=>{O({width:u,height:o})})},[O]);return(0,t().jsxs)(h.Provider,{value:y,children:['web'===u().Platform.OS?(0,t().jsx)(p,{onChange:O}):null,s({ref:P,onLayout:t=>{const{width:n,height:u}=t.nativeEvent.layout;O({width:n,height:u})}})]})}function p({onChange:u}){const o=n().useRef(null);return n().useEffect(()=>{if(null==o.current)return;if('function'!=typeof o.current.getBoundingClientRect)return;const t=o.current.getBoundingClientRect();u({width:t.width,height:t.height});const n=new ResizeObserver(t=>{const n=t[0];if(n){const{width:t,height:o}=n.contentRect;u({width:t,height:o})}});return n.observe(o.current),()=>{n.disconnect()}},[u]),(0,t().jsx)("div",{ref:o,style:{position:'absolute',left:0,right:0,top:0,bottom:0,pointerEvents:'none',visibility:'hidden'}})}},593,[24,30,33,400,594]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}function n(n,u,c,l,o){const s=(0,t().useRef)(null);let f;null===s.current?(f={hasValue:!1,value:null},s.current=f):f=s.current;const[v,b]=(0,t().useMemo)(()=>{let t,n,s=!1;const v=u=>{if(!s){s=!0,t=u;const c=l(u);if(void 0!==o&&f.hasValue){const t=f.value;if(o(t,c))return n=t,t}return n=c,c}const c=t,v=n;if(Object.is(c,u))return v;const b=l(u);return void 0!==o&&o(v,b)?(t=u,v):(t=u,n=b,b)};return[()=>v(u()),null==c?void 0:()=>v(c())]},[u,c,l,o]),S=(0,t().useSyncExternalStore)(n,v,b);return(0,t().useEffect)(()=>{f.hasValue=!0,f.value=S},[S]),(0,t().useDebugValue)(S),S}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"useSyncExternalStoreWithSelector",{enumerable:!0,get:function(){return n}})},594,[30]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(){const t=r(d[0]);return e=function(){return t},t}function t(){const e=b(r(d[1]));return t=function(){return e},e}function n(){const e=r(d[2]);return n=function(){return e},e}Object.defineProperty(_e,"__esModule",{value:!0}),Object.defineProperty(_e,"HeaderBackButton",{enumerable:!0,get:function(){return h}});const l=y(r(d[3])),o=y(r(d[4])),s=r(d[5]),c=r(d[6]),u=r(d[7]),f=r(d[8]);function y(e){return e&&e.__esModule?e:{default:e}}function p(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(p=function(e){return e?n:t})(e)}function b(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=p(t);if(n&&n.has(e))return n.get(e);var l={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&Object.prototype.hasOwnProperty.call(e,s)){var c=o?Object.getOwnPropertyDescriptor(e,s):null;c&&(c.get||c.set)?Object.defineProperty(l,s,c):l[s]=e[s]}return l.default=e,n&&n.set(e,l),l}function h({disabled:y,allowFontScaling:p,backImage:b,label:h,labelStyle:j,displayMode:x=('ios'===n().Platform.OS?'default':'minimal'),onLabelLayout:k,onPress:S,pressColor:M,pressOpacity:L,screenLayout:P,tintColor:_,titleLayout:C,truncatedLabel:v="Back",accessibilityLabel:I=(h&&'Back'!==h?`${h}, back`:'Go back'),testID:W,style:A,href:D}){const{colors:E,fonts:F}=(0,s.useTheme)(),{direction:V}=(0,s.useLocale)(),[B,H]=t().useState(null),[z,N]=t().useState(null);return(0,e().jsx)(u.HeaderButton,{disabled:y,href:D,accessibilityLabel:I,testID:W,onPress:()=>{S&&requestAnimationFrame(()=>S())},pressColor:M,pressOpacity:L,style:[w.container,A],children:(0,e().jsxs)(e().Fragment,{children:[b?b({tintColor:_??E.text}):(0,e().jsx)(f.HeaderIcon,{source:o.default,tintColor:_,style:[w.icon,'minimal'!==x&&w.iconWithLabel]}),(()=>{if('minimal'===x)return null;const t=C&&P?(P.width-C.width)/2-(O+f.ICON_MARGIN):null,o='default'===x?h:v,s=t&&B&&z?t>B?o:t>z?v:null:o,u=[F.regular,w.label,j],y=[u,{position:'absolute',top:0,left:0,opacity:0}],S=(0,e().jsxs)(n().View,{style:w.labelWrapper,children:[h&&'default'===x?(0,e().jsx)(n().Animated.Text,{style:y,numberOfLines:1,onLayout:e=>H(e.nativeEvent.layout.width),children:h}):null,v?(0,e().jsx)(n().Animated.Text,{style:y,numberOfLines:1,onLayout:e=>N(e.nativeEvent.layout.width),children:v}):null,s?(0,e().jsx)(n().Animated.Text,{accessible:!1,onLayout:k,style:[_?{color:_}:null,u],numberOfLines:1,allowFontScaling:!!p,children:s}):null]});return b||'ios'!==n().Platform.OS?S:(0,e().jsx)(c.MaskedView,{maskElement:(0,e().jsxs)(n().View,{style:[w.iconMaskContainer,P?{minWidth:P.width/2-27}:null],children:[(0,e().jsx)(n().Image,{source:l.default,resizeMode:"contain",style:[w.iconMask,'rtl'===V&&w.flip]}),(0,e().jsx)(n().View,{style:w.iconMaskFillerRect})]}),children:S})})()]})})}const O='ios'===n().Platform.OS?13:24,j='ios'===n().Platform.OS?22:3,w=n().StyleSheet.create({container:{paddingHorizontal:0,minWidth:n().StyleSheet.hairlineWidth,...n().Platform.select({ios:null,default:{marginVertical:3,marginHorizontal:11}})},label:{fontSize:17,letterSpacing:.35},labelWrapper:{flexDirection:'row',alignItems:'flex-start',marginEnd:f.ICON_MARGIN},icon:{width:O,marginEnd:j},iconWithLabel:'ios'===n().Platform.OS?{marginEnd:6}:{},iconMaskContainer:{flex:1,flexDirection:'row',justifyContent:'center'},iconMaskFillerRect:{flex:1,backgroundColor:'#000'},iconMask:{height:21,width:13,marginStart:-14.5,marginVertical:12,alignSelf:'center'},flip:{transform:'scaleX(-1)'}})},595,[24,30,33,551,552,427,596,597,598]); +__d(function(g,r,i,a,m,e,d){"use strict";function n({children:n}){return n}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"MaskedView",{enumerable:!0,get:function(){return n}})},596,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const o=r(d[0]);return t=function(){return o},o}function o(){const t=r(d[1]);return o=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"HeaderButton",{enumerable:!0,get:function(){return s}});const n=r(d[2]);const s=function({ref:s,disabled:u,onPress:f,pressColor:b,pressOpacity:p,accessibilityLabel:y,testID:P,style:h,href:O,children:_}){return(0,t().jsx)(n.PlatformPressable,{ref:s,disabled:u,href:O,"aria-label":y,testID:P,onPress:f,pressColor:b,pressOpacity:p,android_ripple:l,style:[c.container,u&&c.disabled,h],hitSlop:o().Platform.select({ios:void 0,default:{top:16,right:16,bottom:16,left:16}}),children:_})},l={borderless:!0,foreground:'android'===o().Platform.OS&&o().Platform.Version>=23,radius:20},c=o().StyleSheet.create({container:{flexDirection:'row',alignItems:'center',paddingHorizontal:8,borderRadius:10,borderCurve:'continuous'},disabled:{opacity:.5}})},597,[24,33,561]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}function n(){const t=r(d[1]);return n=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get HeaderIcon(){return c},get ICON_MARGIN(){return s},get ICON_SIZE(){return u}});const o=r(d[2]);function c({source:c,style:u,...s}){const{colors:l}=(0,o.useTheme)(),{direction:O}=(0,o.useLocale)();return(0,t().jsx)(n().Image,{source:c,resizeMode:"contain",fadeDuration:0,tintColor:l.text,style:[f.icon,'rtl'===O&&f.flip,u],...s})}const u='ios'===n().Platform.OS?21:24,s='ios'===n().Platform.OS?8:3,f=n().StyleSheet.create({icon:{width:u,height:u,margin:s},flip:{transform:'scaleX(-1)'}})},598,[24,33,427]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const o=r(d[0]);return t=function(){return o},o}function o(){const t=r(d[1]);return o=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"HeaderBackground",{enumerable:!0,get:function(){return c}});const n=r(d[2]);function c({style:c,...u}){const{colors:l,dark:h}=(0,n.useTheme)();return(0,t().jsx)(o().Animated.View,{style:[s.container,{backgroundColor:l.card,borderBottomColor:l.border,...'ios'===o().Platform.OS&&{shadowColor:h?'rgba(255, 255, 255, 0.45)':'rgba(0, 0, 0, 1)'}},c],...u})}const s=o().StyleSheet.create({container:{flex:1,...o().Platform.select({android:{elevation:4},ios:{shadowOpacity:.3,shadowRadius:0,shadowOffset:{width:0,height:o().StyleSheet.hairlineWidth}},default:{borderBottomWidth:o().StyleSheet.hairlineWidth}})}})},599,[24,33,427]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}function n(){const t=C(r(d[1]));return n=function(){return t},t}function o(){const t=r(d[2]);return o=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"HeaderSearchBar",{enumerable:!0,get:function(){return O}});const l=x(r(d[3])),u=x(r(d[4])),s=x(r(d[5])),c=r(d[6]),f=r(d[7]),p=r(d[8]),h=r(d[9]),b=r(d[10]),y=r(d[11]);function x(t){return t&&t.__esModule?t:{default:t}}function P(t){if("function"!=typeof WeakMap)return null;var n=new WeakMap,o=new WeakMap;return(P=function(t){return t?o:n})(t)}function C(t,n){if(!n&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var o=P(n);if(o&&o.has(t))return o.get(t);var l={__proto__:null},u=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if("default"!==s&&Object.prototype.hasOwnProperty.call(t,s)){var c=u?Object.getOwnPropertyDescriptor(t,s):null;c&&(c.get||c.set)?Object.defineProperty(l,s,c):l[s]=t[s]}return l.default=t,o&&o.set(t,l),l}const v={text:'text',number:'numeric',phone:'tel',email:'email'},j='web'!==o().Platform.OS;const S=o().StyleSheet.create({container:{flex:1,flexDirection:'row',alignItems:'stretch'},inputSearchIcon:{position:'absolute',opacity:.5,left:o().Platform.select({ios:16,default:4}),top:o().Platform.select({ios:-1,default:17}),...o().Platform.select({ios:{height:18,width:18},default:{}})},closeButton:{position:'absolute',opacity:.5,right:o().Platform.select({ios:0,default:8}),top:o().Platform.select({ios:-2,default:17})},clearButton:{position:'absolute',right:0,top:-7,bottom:0,justifyContent:'center',padding:8},clearIcon:{height:16,width:16,opacity:.5},cancelButton:{alignSelf:'center',top:-4},cancelText:{fontSize:17,marginHorizontal:12},searchbarContainer:{flex:1},searchbar:o().Platform.select({ios:{flex:1,fontSize:17,paddingHorizontal:32,marginLeft:16,marginTop:-1,marginBottom:4,borderRadius:8,borderCurve:'continuous'},default:{flex:1,fontSize:18,paddingHorizontal:36,marginRight:8,marginTop:8,marginBottom:8,borderBottomWidth:1}})}),O=function({ref:x,visible:P,inputType:C,autoFocus:O=!0,autoCapitalize:T,placeholder:w="Search",cancelButtonText:B="Cancel",enterKeyHint:_="search",onChangeText:H,onClose:I,tintColor:z,style:k,...M}){const A=(0,f.useNavigation)(),{dark:D,colors:V,fonts:E}=(0,f.useTheme)(),[R,N]=n().useState(''),[W,F]=n().useState(P),[K]=n().useState(()=>new(o().Animated.Value)(P?1:0)),[L]=n().useState(()=>new(o().Animated.Value)(0)),q=n().useRef(P),G=n().useRef(!1),J=n().useRef(null);n().useEffect(()=>{if(P!==q.current)return o().Animated.timing(K,{toValue:P?1:0,duration:100,useNativeDriver:j}).start(({finished:t})=>{t&&(F(P),q.current=P)}),()=>{K.stopAnimation()}},[P,K]);const Q=''!==R;n().useEffect(()=>{G.current!==Q&&o().Animated.timing(L,{toValue:Q?1:0,duration:100,useNativeDriver:j}).start(({finished:t})=>{t&&(G.current=Q)})},[L,Q]);const U=n().useCallback(()=>{J.current?.clear(),J.current?.focus(),N('')},[]),X=n().useCallback(()=>{U(),H?.({nativeEvent:{text:''}})},[U,H]),Y=n().useCallback(()=>{X(),I()},[X,I]);if(n().useEffect(()=>A?.addListener('blur',Y),[Y,A]),n().useImperativeHandle(x,()=>({focus:()=>{J.current?.focus()},blur:()=>{J.current?.blur()},setText:t=>{J.current?.setNativeProps({text:t}),N(t)},clearText:U,cancelSearch:Y}),[Y,U]),!P&&!W)return null;const Z=z??V.text;return(0,t().jsxs)(o().Animated.View,{"aria-live":"polite","aria-hidden":!P,style:[S.container,{pointerEvents:P?'auto':'none',opacity:K},k],children:[(0,t().jsxs)(o().View,{style:S.searchbarContainer,children:[(0,t().jsx)(y.HeaderIcon,{source:s.default,tintColor:Z,style:S.inputSearchIcon}),(0,t().jsx)(o().TextInput,{...M,ref:J,onChange:H,onChangeText:N,autoFocus:O,autoCapitalize:'systemDefault'===T?void 0:T,inputMode:v[C??'text'],enterKeyHint:_,placeholder:w,placeholderTextColor:(0,c.alpha)(Z,.5),cursorColor:V.primary,selectionHandleColor:V.primary,selectionColor:(0,c.alpha)(V.primary,.3),style:[E.regular,S.searchbar,{backgroundColor:o().Platform.select({ios:D?'rgba(255, 255, 255, 0.1)':'rgba(0, 0, 0, 0.1)',default:'transparent'}),color:Z,borderBottomColor:(0,c.alpha)(Z,.2)??(D?'rgba(255, 255, 255, 0.2)':'rgba(0, 0, 0, 0.2)')}]}),'ios'===o().Platform.OS?(0,t().jsx)(p.PlatformPressable,{onPress:X,style:[{opacity:L,transform:[{scale:L}]},S.clearButton],children:(0,t().jsx)(o().Image,{source:l.default,resizeMode:"contain",tintColor:Z,style:S.clearIcon})}):null]}),'ios'!==o().Platform.OS?(0,t().jsx)(b.HeaderButton,{onPress:()=>{R?X():I()},style:S.closeButton,children:(0,t().jsx)(y.HeaderIcon,{source:u.default,tintColor:Z})}):null,'ios'===o().Platform.OS?(0,t().jsx)(p.PlatformPressable,{onPress:Y,style:S.cancelButton,children:(0,t().jsx)(h.Text,{style:[E.regular,{color:z??V.primary},S.cancelText],children:B})}):null]})}},600,[24,30,33,553,554,555,558,427,561,562,597,598]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"HeaderShownContext",{enumerable:!0,get:function(){return t}});const t=(0,r(d[0]).getNamedContext)('HeaderShownContext',!1)},601,[602]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=o(r(d[0]));return t=function(){return n},n}function n(t){if("function"!=typeof WeakMap)return null;var o=new WeakMap,u=new WeakMap;return(n=function(t){return t?u:o})(t)}function o(t,o){if(!o&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var u=n(o);if(u&&u.has(t))return u.get(t);var l={__proto__:null},c=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var f in t)if("default"!==f&&Object.prototype.hasOwnProperty.call(t,f)){var p=c?Object.getOwnPropertyDescriptor(t,f):null;p&&(p.get||p.set)?Object.defineProperty(l,f,p):l[f]=t[f]}return l.default=t,u&&u.set(t,l),l}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"getNamedContext",{enumerable:!0,get:function(){return l}});const u='__react_navigation__elements_contexts';function l(n,o){let l=globalThis[u].get(n);return l||(l=t().createContext(o),l.displayName=n,globalThis[u].set(n,l),l)}globalThis[u]=globalThis[u]??new Map},602,[30]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}function n(){const t=r(d[1]);return n=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"HeaderTitle",{enumerable:!0,get:function(){return l}});const o=r(d[2]);function l({tintColor:l,style:c,...s}){const{colors:f,fonts:b}=(0,o.useTheme)();return(0,t().jsx)(n().Animated.Text,{role:"heading","aria-level":"1",numberOfLines:1,...s,style:[{color:void 0===l?f.text:l},n().Platform.select({ios:b.bold,default:b.medium}),u.title,c]})}const u=n().StyleSheet.create({title:n().Platform.select({ios:{fontSize:17},android:{fontSize:20},default:{fontSize:18}})})},603,[24,33,427]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"getHeaderStatusBarHeight",{enumerable:!0,get:function(){return n}});const t=24;function n(n,u){return 0===n.top&&null!=u?t:n.top}},604,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"HeaderBackContext",{enumerable:!0,get:function(){return t}});const t=(0,r(d[0]).getNamedContext)('HeaderBackContext',void 0)},605,[602]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"HeaderHeightContext",{enumerable:!0,get:function(){return t}});const t=(0,r(d[0]).getNamedContext)('HeaderHeightContext',void 0)},606,[602]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"useHeaderHeight",{enumerable:!0,get:function(){return o}});const n=r(d[1]);function o(){const o=(0,t().use)(n.HeaderHeightContext);if(void 0===o)throw new Error("Couldn't find the header height. Are you inside a screen in a navigator with a header?");return o}},607,[30,606]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(t,n){return void 0!==t.label?t.label:void 0!==t.title?t.title:n}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"getLabel",{enumerable:!0,get:function(){return t}})},608,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}function n(){const t=r(d[1]);return n=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"Label",{enumerable:!0,get:function(){return u}});const o=r(d[2]);function u({tintColor:n,style:u,...l}){return(0,t().jsx)(o.Text,{numberOfLines:1,...l,style:[c.label,null!=n&&{color:n},u]})}const c=n().StyleSheet.create({label:{textAlign:'center',backgroundColor:'transparent'}})},609,[24,33,562]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=u(r(d[0]));return t=function(){return n},n}function n(t){if("function"!=typeof WeakMap)return null;var u=new WeakMap,o=new WeakMap;return(n=function(t){return t?o:u})(t)}function u(t,u){if(!u&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var o=n(u);if(o&&o.has(t))return o.get(t);var c={__proto__:null},f=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in t)if("default"!==l&&Object.prototype.hasOwnProperty.call(t,l)){var p=f?Object.getOwnPropertyDescriptor(t,l):null;p&&(p.get||p.set)?Object.defineProperty(c,l,p):c[l]=t[l]}return c.default=t,o&&o.set(t,c),c}function o({enabled:n,visible:u,children:o}){const[c,f]=t().useState(!!n&&u),l=!(n||u||c);return t().useEffect(()=>{if(!1===l)return;const t=requestIdleCallback(()=>{f(!0)});return()=>cancelIdleCallback(t)},[l]),u&&!1===c?(f(!0),o):c?o:null}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"Lazy",{enumerable:!0,get:function(){return o}})},610,[30]); +__d(function(g,r,i,a,m,e,d){"use strict";function n(){const t=r(d[0]);return n=function(){return t},t}function t(){const n=r(d[1]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"MissingIcon",{enumerable:!0,get:function(){return c}});const o=r(d[2]);function c({color:t,size:c,style:s}){return(0,n().jsx)(o.Text,{style:[u.icon,{color:t,fontSize:c},s],children:"\u23f7"})}const u=t().StyleSheet.create({icon:{backgroundColor:'transparent'}})},611,[24,33,562]); +__d(function(g,r,i,a,m,e,d){"use strict";function n(){const t=r(d[0]);return n=function(){return t},t}function t(){const n=r(d[1]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"ResourceSavingView",{enumerable:!0,get:function(){return o}});function o({visible:o,children:l,style:s,...u}){return'web'===t().Platform.OS?(0,n().jsx)(t().View,{hidden:!o,style:[{pointerEvents:o?'auto':'none',display:o?'flex':'none'},c.container,s],...u,children:l}):(0,n().jsx)(t().View,{style:[{pointerEvents:o?'auto':'none'},c.container,s],children:(0,n().jsx)(t().View,{collapsable:!1,removeClippedSubviews:'ios'!==t().Platform.OS&&'macos'!==t().Platform.OS||!o,style:[{pointerEvents:o?'auto':'none'},o?c.attached:c.detached],children:l})})}const c=t().StyleSheet.create({container:{flex:1,overflow:'hidden'},attached:{flex:1},detached:{flex:1,top:3e4}})},612,[24,33]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}function n(){const t=l(r(d[1]));return n=function(){return t},t}function o(){const t=r(d[2]);return o=function(){return t},t}function u(){const t=r(d[3]);return u=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"SafeAreaProviderCompat",{enumerable:!0,get:function(){return w}});const c=r(d[4]),f=r(d[5]);function s(t){if("function"!=typeof WeakMap)return null;var n=new WeakMap,o=new WeakMap;return(s=function(t){return t?o:n})(t)}function l(t,n){if(!n&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var o=s(n);if(o&&o.has(t))return o.get(t);var u={__proto__:null},c=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var f in t)if("default"!==f&&Object.prototype.hasOwnProperty.call(t,f)){var l=c?Object.getOwnPropertyDescriptor(t,f):null;l&&(l.get||l.set)?Object.defineProperty(u,f,l):u[f]=t[f]}return u.default=t,o&&o.set(t,u),u}const{width:h,height:p}=(function(){if('web'===o().Platform.OS)return{width:0,height:0};const{width:t=0,height:n=0}=o().Dimensions.get('window');return{width:t,height:n}})(),y='web'===o().Platform.OS||null==u().initialWindowMetrics?{frame:{x:0,y:0,width:h,height:p},insets:{top:0,left:0,right:0,bottom:0}}:u().initialWindowMetrics;function w({children:s,style:l}){const h=(0,n().use)(u().SafeAreaInsetsContext);return(0,t().jsx)(f.FrameSizeProvider,{initialFrame:y.frame,render:({ref:n,onLayout:u})=>h?(0,t().jsx)(o().View,{ref:n,onLayout:u,style:[b.container,l],children:s}):(0,t().jsx)(c.SafeAreaProvider,{initialMetrics:y,style:l,onLayout:u,children:s})})}w.initialMetrics=y;const b=o().StyleSheet.create({container:{flex:1}})},613,[24,30,33,289,288,593]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(){const t=r(d[0]);return e=function(){return t},t}function t(){const e=r(d[1]);return t=function(){return e},e}function n(){const e=b(r(d[2]));return n=function(){return e},e}function o(){const e=r(d[3]);return o=function(){return e},e}function u(){const e=r(d[4]);return u=function(){return e},e}Object.defineProperty(_e,"__esModule",{value:!0}),Object.defineProperty(_e,"Screen",{enumerable:!0,get:function(){return j}});const c=r(d[5]),s=r(d[6]),l=r(d[7]),f=r(d[8]),h=r(d[9]),p=r(d[10]),y=r(d[11]);function v(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(v=function(e){return e?n:t})(e)}function b(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=v(t);if(n&&n.has(e))return n.get(e);var o={__proto__:null},u=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var c in e)if("default"!==c&&Object.prototype.hasOwnProperty.call(e,c)){var s=u?Object.getOwnPropertyDescriptor(e,c):null;s&&(s.get||s.set)?Object.defineProperty(o,c,s):o[c]=e[c]}return o.default=e,n&&n.set(e,o),o}function j(v){const b=(0,u().useSafeAreaInsets)(),j=(0,t().useVerticalBarEdgeIOS)(),S=(0,n().use)(f.HeaderShownContext),H=(0,n().use)(l.HeaderHeightContext),{focused:O,modal:w=!1,header:P,headerShown:_=!0,headerTransparent:M,headerStatusBarHeight:k=(S?0:(0,p.getHeaderStatusBarHeight)(b,j)),navigation:B,route:C,children:E,style:D}=v,I=(0,y.useFrameSize)(e=>(0,h.getDefaultHeaderHeight)(e,w,k)),V=n().useRef(null),[W,z]=n().useState(I);return n().useLayoutEffect(()=>{V.current?.measure((e,t,n,o)=>{z(o)})},[C.name]),(0,e().jsxs)(s.Background,{"aria-hidden":!O,style:[x.container,D],collapsable:!1,children:[_?(0,e().jsx)(c.NavigationProvider,{route:C,navigation:B,children:(0,e().jsx)(o().View,{ref:V,onLayout:e=>{const{height:t}=e.nativeEvent.layout;z(t)},style:[x.header,M?x.absolute:null],children:P})}):null,(0,e().jsx)(o().View,{style:x.content,children:(0,e().jsx)(f.HeaderShownContext.Provider,{value:S||!1!==_,children:(0,e().jsx)(l.HeaderHeightContext.Provider,{value:_?W:H??0,children:E})})})]})}const x=o().StyleSheet.create({container:{flex:1},content:{flex:1},header:{zIndex:1,pointerEvents:'box-none'},absolute:{position:'absolute',top:0,start:0,end:0}})},614,[24,567,30,33,289,427,556,606,601,564,604,593]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},615,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=o(r(d[0]));return t=function(){return n},n}function n(t){if("function"!=typeof WeakMap)return null;var o=new WeakMap,u=new WeakMap;return(n=function(t){return t?u:o})(t)}function o(t,o){if(!o&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var u=n(o);if(u&&u.has(t))return u.get(t);var c={__proto__:null},f=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in t)if("default"!==l&&Object.prototype.hasOwnProperty.call(t,l)){var p=f?Object.getOwnPropertyDescriptor(t,l):null;p&&(p.get||p.set)?Object.defineProperty(c,l,p):c[l]=t[l]}return c.default=t,u&&u.set(t,c),c}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"BottomTabBarHeightCallbackContext",{enumerable:!0,get:function(){return u}});const u=t().createContext(void 0)},616,[30]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=u(r(d[0]));return t=function(){return n},n}function n(){const t=r(d[1]);return n=function(){return t},t}function o(t){if("function"!=typeof WeakMap)return null;var n=new WeakMap,u=new WeakMap;return(o=function(t){return t?u:n})(t)}function u(t,n){if(!n&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var u=o(n);if(u&&u.has(t))return u.get(t);var f={__proto__:null},c=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in t)if("default"!==l&&Object.prototype.hasOwnProperty.call(t,l)){var s=c?Object.getOwnPropertyDescriptor(t,l):null;s&&(s.get||s.set)?Object.defineProperty(f,l,s):f[l]=t[l]}return f.default=t,u&&u.set(t,f),f}function f(){const[o,u]=t().useState(!1);return t().useEffect(()=>{const t=()=>u(!0),o=()=>u(!1);let f;return f='ios'===n().Platform.OS?[n().Keyboard.addListener('keyboardWillShow',t),n().Keyboard.addListener('keyboardWillHide',o)]:[n().Keyboard.addListener('keyboardDidShow',t),n().Keyboard.addListener('keyboardDidHide',o)],()=>{f.forEach(t=>t.remove())}},[]),o}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"useIsKeyboardShown",{enumerable:!0,get:function(){return f}})},617,[30,33]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const l=r(d[0]);return t=function(){return l},l}function l(){const t=r(d[1]);return l=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"BottomTabItem",{enumerable:!0,get:function(){return f}});const n=r(d[2]),o=r(d[3]),s=r(d[4]),c=r(d[5]),b=l=>(0,t().jsx)(o.PlatformPressable,{...l}),u='ios'===l().Platform.OS&&parseInt(l().Platform.Version,10)>=13;function f({route:f,href:S,focused:y,descriptor:h,label:v,icon:x,badge:B,badgeStyle:C,button:w=b,accessibilityLabel:U,testID:k,onPress:j,onLongPress:P,horizontal:V,compact:I,sidebar:L,variant:z,activeTintColor:K,inactiveTintColor:M,activeBackgroundColor:T,inactiveBackgroundColor:D="transparent",showLabel:O=!0,allowFontScaling:_=!u&&void 0,labelStyle:F,iconStyle:H,style:E}){const{colors:R,fonts:q}=(0,s.useTheme)(),A=K??('uikit'===z&&L&&V?(0,n.isDark)(R.primary)?'white':(0,n.darken)(R.primary,.71):void 0)??R.primary,G=M??('material'===z?(0,n.alpha)(R.text,.68):(0,n.alpha)(R.text,.5))??R.text,J=T??('material'===z?(0,n.alpha)(A,.12):L&&V?R.primary:'transparent')??'transparent',{options:N}=h,Q=(0,o.getLabel)({label:'string'==typeof N.tabBarLabel?N.tabBarLabel:void 0,title:N.title},f.name);let W=G,X=G;'uikit'===z&&L&&V&&void 0===M&&(X=R.primary,W=R.text);const Y={route:f,focused:y},Z=y?J:D,{flex:$}=l().StyleSheet.flatten(E||{}),ee='material'===z?V?56:16:L&&V?10:0;return(0,t().jsx)(l().View,{style:[{borderRadius:ee,overflow:'material'===z?'hidden':'visible'},E],children:w({href:S,onPress:j,onLongPress:P,testID:k,'aria-label':U,accessibilityLargeContentTitle:Q,accessibilityShowsLargeContentViewer:!0,role:l().Platform.select({ios:'button',default:'tab'}),'aria-selected':y,android_ripple:{borderless:!0},hoverEffect:'material'===z||L&&V?{color:R.text}:void 0,pressOpacity:1,style:[p.tab,{flex:$,backgroundColor:Z,borderRadius:ee},L?'material'===z?V?p.tabBarSidebarMaterial:p.tabVerticalMaterial:V?p.tabBarSidebarUiKit:p.tabVerticalUiKit:'material'===z?p.tabVerticalMaterial:V?p.tabHorizontalUiKit:p.tabVerticalUiKit],children:(0,t().jsxs)(t().Fragment,{children:[(({focused:l})=>{if(void 0===x)return null;const n=l?1:0,o=l?0:1;return(0,t().jsx)(c.TabBarIcon,{route:f,variant:z,size:I?'compact':'regular',badge:B,badgeStyle:C,activeOpacity:n,allowFontScaling:_,inactiveOpacity:o,activeTintColor:A,inactiveTintColor:X,renderIcon:x,style:H})})(Y),(({focused:l})=>{if(!1===O)return null;const n=l?A:W;return'string'!=typeof v?v({focused:l,color:n,position:V?'beside-icon':'below-icon',children:Q}):(0,t().jsx)(o.Label,{style:[V?[p.labelBeside,'material'===z?p.labelSidebarMaterial:L?p.labelSidebarUiKit:I?p.labelBesideUikitCompact:p.labelBesideUikit,null==x&&{marginStart:0}]:p.labelBeneath,I||'uikit'===z&&L&&V?q.regular:q.medium,F],allowFontScaling:_,tintColor:n,children:v})})(Y)]})})})}const p=l().StyleSheet.create({tab:{alignItems:'center',borderRadius:10,borderCurve:'continuous'},tabVerticalUiKit:{justifyContent:'flex-start',flexDirection:'column',padding:5},tabVerticalMaterial:{padding:10},tabHorizontalUiKit:{justifyContent:'center',alignItems:'center',flexDirection:'row',padding:5},tabBarSidebarUiKit:{justifyContent:'flex-start',alignItems:'center',flexDirection:'row',paddingVertical:7,paddingHorizontal:5},tabBarSidebarMaterial:{justifyContent:'flex-start',alignItems:'center',flexDirection:'row',paddingVertical:15,paddingStart:16,paddingEnd:24},labelSidebarMaterial:{marginStart:12},labelSidebarUiKit:{fontSize:17,marginStart:10},labelBeneath:{fontSize:10},labelBeside:{marginEnd:12,lineHeight:24},labelBesideUikit:{fontSize:13,marginStart:5},labelBesideUikitCompact:{fontSize:12,marginStart:5}})},618,[24,33,558,550,427,619]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}function n(){const t=r(d[1]);return n=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"TabBarIcon",{enumerable:!0,get:function(){return p}});const o=r(d[2]),c=25,l=18,s=24;function p({route:p,variant:h,size:w,badge:y,badgeStyle:f,activeOpacity:b,inactiveOpacity:j,activeTintColor:v,inactiveTintColor:S,renderIcon:C,allowFontScaling:k,style:x}){const z='material'===h?s:'compact'===w?l:c;return(0,t().jsxs)(n().View,{style:['material'===h?u.wrapperMaterial:'compact'===w?u.wrapperUikitCompact:u.wrapperUikit,x],children:[(0,t().jsx)(n().View,{style:[u.icon,{opacity:b,minWidth:z}],children:C({focused:!0,size:z,color:v})}),(0,t().jsx)(n().View,{style:[u.icon,{opacity:j}],children:C({focused:!1,size:z,color:S})}),(0,t().jsx)(o.Badge,{visible:null!=y,size:.75*z,allowFontScaling:k,style:[u.badge,f],children:y})]})}const u=n().StyleSheet.create({icon:{position:'absolute',alignSelf:'center',alignItems:'center',justifyContent:'center',height:'100%',width:'100%'},wrapperUikit:{width:31,height:28},wrapperUikitCompact:{width:23,height:20},wrapperMaterial:{width:s,height:s},badge:{position:'absolute',end:-3,top:-3}})},619,[24,33,550]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}function n(){const t=b(r(d[1]));return n=function(){return t},t}function o(){const t=r(d[2]);return o=function(){return t},t}function s(){const t=r(d[3]);return s=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"BottomTabView",{enumerable:!0,get:function(){return O}});const c=r(d[4]),u=r(d[5]),l=r(d[6]),p=r(d[7]),f=r(d[8]),y=r(d[9]),h=r(d[10]);function S(t){if("function"!=typeof WeakMap)return null;var n=new WeakMap,o=new WeakMap;return(S=function(t){return t?o:n})(t)}function b(t,n){if(!n&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var o=S(n);if(o&&o.has(t))return o.get(t);var s={__proto__:null},c=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var u in t)if("default"!==u&&Object.prototype.hasOwnProperty.call(t,u)){var l=c?Object.getOwnPropertyDescriptor(t,u):null;l&&(l.get||l.set)?Object.defineProperty(s,u,l):s[u]=t[u]}return s.default=t,o&&o.set(t,s),s}const v=0,x=1,T=2,k={fade:u.FadeTransition,shift:u.ShiftTransition,none:{sceneStyleInterpolator:void 0,transitionSpec:{animation:'timing',config:{duration:0}}}},j='web'!==o().Platform.OS,P=t=>{const{animation:n,transitionSpec:o}=t;return n?'none'!==n:Boolean(o)},B=n=>(0,t().jsx)(y.BottomTabBar,{...n});function O(u){const{tabBar:S=B,state:b,descriptors:O,emitter:M,navigateToTab:_,popNestedStackToTop:A,safeAreaInsets:C,detachInactiveScreens:H='web'===o().Platform.OS||'android'===o().Platform.OS||'ios'===o().Platform.OS}=u,I=b.routes[b.index].key,D=n().useRef(I),W=(0,f.useAnimatedHashMap)(b),[E,F]=n().useState({current:I,animating:!1});E.current!==I&&F({current:I,previous:E.current,animating:!0}),n().useEffect(()=>{const t=D.current,n=t!==I&&!!O[t]?.options.popToTopOnBlur;let s;return t!==I&&M.emit({type:'transitionStart',target:I}),o().Animated.parallel(b.routes.map((n,s)=>{const{options:c}=O[n.key],{animation:u="none",transitionSpec:l=k[u].transitionSpec}=c;let p=l;n.key!==t&&n.key!==I&&(p=k.none.transitionSpec),p=p??k.none.transitionSpec;const f=s===b.index?0:s>=b.index?1:-1;return o().Animated[p.animation](W[n.key],{...p.config,toValue:f,useNativeDriver:j})}).filter(Boolean)).start(({finished:o})=>{o&&n&&A(t),t!==I&&M.emit({type:'transitionEnd',target:I}),o&&(s=setTimeout(()=>{F(t=>t.animating?{...t,animating:!1}:t)},32))}),D.current=I,()=>{void 0!==s&&clearTimeout(s)}},[O,I,M,A,b.index,b.routes,W]);const N=c.SafeAreaProviderCompat.initialMetrics.frame,[V,z]=n().useState(()=>(0,y.getTabBarHeight)({state:b,descriptors:O,dimensions:N,insets:{...c.SafeAreaProviderCompat.initialMetrics.insets,...u.safeAreaInsets},style:O[b.routes[b.index].key].options.tabBarStyle})),{routes:R}=b,q=!R.some(t=>P(O[t.key].options)),{tabBarPosition:G="bottom"}=O[I].options,J=(0,t().jsx)(l.BottomTabBarHeightCallbackContext.Provider,{value:z,children:(0,t().jsx)(s().SafeAreaInsetsContext.Consumer,{children:t=>S({state:b,descriptors:O,emitter:M,navigateToTab:_,insets:{top:C?.top??t?.top??0,right:C?.right??t?.right??0,bottom:C?.bottom??t?.bottom??0,left:C?.left??t?.left??0}})})},"tabbar");return(0,t().jsxs)(c.SafeAreaProviderCompat,{style:{flexDirection:'left'===G||'right'===G?'row':'column'},children:['top'===G||'left'===G?J:null,(0,t().jsx)(h.MaybeScreenContainer,{enabled:H,hasTwoStates:q,style:w.screens,children:R.map((n,s)=>{const u=O[n.key],{animation:l="none",sceneStyleInterpolator:f=k[l].sceneStyleInterpolator}=u.options,y=b.index===s;if(void 0===u.route.key)return null;const{header:S=({layout:o,options:s})=>(0,t().jsx)(c.Header,{...s,layout:o,title:(0,c.getHeaderTitle)(s,n.name)}),headerShown:j,headerStatusBarHeight:B,headerTransparent:w,sceneStyle:M}=u.options,{sceneStyle:_}=f?.({current:{progress:W[n.key]}})??{},A=P(u.options),C=E.animating&&(E.previous===n.key||E.current===n.key),I=y?T:A&&C?x:v;return(0,t().jsx)(h.MaybeScreen,{style:[o().StyleSheet.absoluteFill,{zIndex:y?0:-1}],active:I,enabled:H,children:(0,t().jsx)(p.BottomTabBarHeightContext.Provider,{value:'bottom'===G?V:0,children:(0,t().jsx)(c.Screen,{focused:y,route:n,navigation:u.navigation,headerShown:j,headerStatusBarHeight:B,headerTransparent:w,header:S({layout:N,route:n,navigation:u.navigation,options:u.options}),style:[M,A&&_],children:u.render()})})},n.key)})},"screens"),'bottom'===G||'right'===G?J:null]})}const w=o().StyleSheet.create({screens:{flex:1,overflow:'hidden'}})},620,[24,30,33,289,550,547,616,621,622,549,623]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=o(r(d[0]));return t=function(){return n},n}function n(t){if("function"!=typeof WeakMap)return null;var o=new WeakMap,u=new WeakMap;return(n=function(t){return t?u:o})(t)}function o(t,o){if(!o&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var u=n(o);if(u&&u.has(t))return u.get(t);var f={__proto__:null},c=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var p in t)if("default"!==p&&Object.prototype.hasOwnProperty.call(t,p)){var l=c?Object.getOwnPropertyDescriptor(t,p):null;l&&(l.get||l.set)?Object.defineProperty(f,p,l):f[p]=t[p]}return f.default=t,u&&u.set(t,f),f}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"BottomTabBarHeightContext",{enumerable:!0,get:function(){return u}});const u=t().createContext(void 0)},621,[30]); +__d(function(g,r,_i,a,m,e,d){"use strict";function t(){const n=o(r(d[0]));return t=function(){return n},n}function n(){const t=r(d[1]);return n=function(){return t},t}function u(t){if("function"!=typeof WeakMap)return null;var n=new WeakMap,o=new WeakMap;return(u=function(t){return t?o:n})(t)}function o(t,n){if(!n&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var o=u(n);if(o&&o.has(t))return o.get(t);var c={__proto__:null},f=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in t)if("default"!==i&&Object.prototype.hasOwnProperty.call(t,i)){var l=f?Object.getOwnPropertyDescriptor(t,i):null;l&&(l.get||l.set)?Object.defineProperty(c,i,l):c[i]=t[i]}return c.default=t,o&&o.set(t,c),c}function c({routes:u,index:o}){const c=t().useRef({}),f=c.current,i=Object.keys(f);return u.length===i.length&&u.every(t=>i.includes(t.key))?f:(c.current={},u.forEach(({key:t},u)=>{c.current[t]=f[t]??new(n().Animated.Value)(u===o?0:u>=o?1:-1)}),c.current)}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"useAnimatedHashMap",{enumerable:!0,get:function(){return c}})},622,[30,33]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(){const n=r(d[0]);return e=function(){return n},n}function n(){const e=r(d[1]);return n=function(){return e},e}let t;Object.defineProperty(_e,"__esModule",{value:!0}),(function(e,n){for(var t in n)Object.defineProperty(e,t,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,t).get})})(_e,{get MaybeScreen(){return u},get MaybeScreenContainer(){return c}});try{t=r(d[2],"react-native-screens")}catch(e){}const c=({enabled:c,...u})=>t?.screensEnabled?.()?(0,e().jsx)(t.ScreenContainer,{enabled:c,...u}):(0,e().jsx)(n().View,{...u});function u({enabled:c,active:u,...o}){return t?.screensEnabled?.()?(0,e().jsx)(t.Screen,{...o,enabled:c,activityState:u,freezeOnBlur:!1}):(0,e().jsx)(n().View,{...o})}},623,[24,33,624]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"enableScreens",{enumerable:!0,get:function(){return t.enableScreens}}),Object.defineProperty(_e,"enableFreeze",{enumerable:!0,get:function(){return t.enableFreeze}}),Object.defineProperty(_e,"screensEnabled",{enumerable:!0,get:function(){return t.screensEnabled}}),Object.defineProperty(_e,"freezeEnabled",{enumerable:!0,get:function(){return t.freezeEnabled}}),Object.defineProperty(_e,"Screen",{enumerable:!0,get:function(){return c.default}}),Object.defineProperty(_e,"InnerScreen",{enumerable:!0,get:function(){return n.InnerScreen}}),Object.defineProperty(_e,"ScreenContext",{enumerable:!0,get:function(){return n.ScreenContext}}),Object.defineProperty(_e,"ScreenStackHeaderConfig",{enumerable:!0,get:function(){return u.ScreenStackHeaderConfig}}),Object.defineProperty(_e,"ScreenStackHeaderSubview",{enumerable:!0,get:function(){return u.ScreenStackHeaderSubview}}),Object.defineProperty(_e,"ScreenStackHeaderLeftView",{enumerable:!0,get:function(){return u.ScreenStackHeaderLeftView}}),Object.defineProperty(_e,"ScreenStackHeaderCenterView",{enumerable:!0,get:function(){return u.ScreenStackHeaderCenterView}}),Object.defineProperty(_e,"ScreenStackHeaderRightView",{enumerable:!0,get:function(){return u.ScreenStackHeaderRightView}}),Object.defineProperty(_e,"ScreenStackHeaderBackButtonImage",{enumerable:!0,get:function(){return u.ScreenStackHeaderBackButtonImage}}),Object.defineProperty(_e,"ScreenStackHeaderSearchBarView",{enumerable:!0,get:function(){return u.ScreenStackHeaderSearchBarView}}),Object.defineProperty(_e,"SearchBar",{enumerable:!0,get:function(){return o.default}}),Object.defineProperty(_e,"ScreenContainer",{enumerable:!0,get:function(){return f.default}}),Object.defineProperty(_e,"ScreenStack",{enumerable:!0,get:function(){return b.default}}),Object.defineProperty(_e,"ScreenStackItem",{enumerable:!0,get:function(){return l.default}}),Object.defineProperty(_e,"FullWindowOverlay",{enumerable:!0,get:function(){return S.default}}),Object.defineProperty(_e,"ScreenFooter",{enumerable:!0,get:function(){return p.default}}),Object.defineProperty(_e,"ScreenContentWrapper",{enumerable:!0,get:function(){return y.default}}),Object.defineProperty(_e,"isSearchBarAvailableForCurrentPlatform",{enumerable:!0,get:function(){return P.isSearchBarAvailableForCurrentPlatform}}),Object.defineProperty(_e,"executeNativeBackPress",{enumerable:!0,get:function(){return P.executeNativeBackPress}}),Object.defineProperty(_e,"compatibilityFlags",{enumerable:!0,get:function(){return O.compatibilityFlags}}),Object.defineProperty(_e,"featureFlags",{enumerable:!0,get:function(){return O.featureFlags}}),Object.defineProperty(_e,"useTransitionProgress",{enumerable:!0,get:function(){return j.default}}),r(d[0]);var t=r(d[1]),n=r(d[2]),c=e(n),u=r(d[3]),o=e(r(d[4])),f=e(r(d[5])),b=e(r(d[6])),l=e(r(d[7])),S=e(r(d[8])),p=e(r(d[9])),y=e(r(d[10])),P=r(d[11]),O=r(d[12]),j=e(r(d[13])),s=r(d[14]);Object.keys(s).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return s[e]}})})},624,[625,626,627,628,629,630,631,632,642,637,635,643,639,644,646]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}});var t={}},625,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"isNativePlatformSupported",{enumerable:!0,get:function(){return t}}),_e.enableScreens=function(e=!0){return void(u=e)},_e.enableFreeze=function(e=!0){return},_e.screensEnabled=function(){return u},_e.freezeEnabled=function(){return o},r(d[0]);var e,n=r(d[1]);(e=n)&&e.__esModule;const t=!1;let u=t;let o=!1},626,[122,113]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"InnerScreen",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"NativeScreen",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"ScreenContext",{enumerable:!0,get:function(){return s}});var t=e(_r(d[0])),n=e(_r(d[1])),r=e(_r(d[2])),u=_r(d[3]);function l(){return l=Object.assign?Object.assign.bind():function(e){for(var t=1;tn.default.createElement(r.default,null,n.default.createElement(t.default,u({resizeMode:"center",fadeDuration:0},e))),l=e=>n.default.createElement(r.default,e),f=e=>n.default.createElement(r.default,e),o=e=>n.default.createElement(r.default,e),b=e=>n.default.createElement(r.default,e),S=e=>n.default.createElement(r.default,e),p=r.default},628,[196,127,30]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u}});var e,t=r(d[0]);var u=((e=t)&&e.__esModule?e:{default:e}).default},629,[127]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u}});var e,t=r(d[0]);var u=((e=t)&&e.__esModule?e:{default:e}).default},630,[127]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u}});var e,t=r(d[0]);var u=((e=t)&&e.__esModule?e:{default:e}).default},631,[127]); +__d(function(g,_r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return E}});var t=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(n){if('default'!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,t})(_r(_d[0]));_r(_d[1]);var n=e(_r(_d[2])),r=e(_r(_d[3])),o=e(_r(_d[4])),l=_r(_d[5]),s=e(_r(_d[6])),c=e(_r(_d[7])),u=_r(_d[8]),d=_r(_d[9]),f=_r(_d[10]);_r(_d[11]);var h=_r(_d[12]),p=_r(_d[13]);function b(){return b=Object.assign?Object.assign.bind():function(e){for(var t=1;tL.current);const T=C??'push',z=v?.hidden??!1,B='push'!==T&&!1===z,V=t.useRef(z);t.useEffect(()=>{(0,r.default)('push'!==T&&V.current!==z,"Dynamically changing header's visibility in modals will result in remounting the screen and losing all local state."),V.current=z},[z,T]);const W=void 0===P||Object.values(P).some(e=>'hidden'!==e),U=void 0!==v?.blurEffect&&'none'!==v.blurEffect;(0,r.default)(W&&U&&h.isIOS26OrHigher,'[RNScreens] Using both `blurEffect` and `scrollEdgeEffects` simultaneously may cause overlapping effects.');const q=y(I,T);let G;const J=h.isIOS26OrHigher,K=t.createElement(t.Fragment,null,t.createElement(p.EdgeInsetApplicationContext.Provider,{value:D},t.createElement(o.default,{contentStyle:k,style:q,stackPresentation:T},J?t.createElement(f.SafeAreaView,{edges:S(v,j)},e):e)),t.createElement(l.ScreenStackHeaderConfig,v),'formSheet'===T&&R&&t.createElement(d.FooterComponent,null,R()));return t.createElement(s.default,b({ref:e=>{if(L.current=e,null===M)return void console.warn('Looks like RNSScreensRefContext is missing. Make sure the ScreenStack component is wrapped in it');const t=M.current;null===e?delete t[_]:t[_]={current:e}},enabled:!0,isNativeStack:!0,activityState:E,shouldFreeze:O,screenId:_,stackPresentation:T,hasLargeHeader:v?.largeTitle??!1,sheetAllowedDetents:I,style:[A,G],scrollEdgeEffects:B?void 0:P,onHeaderHeightChange:B?void 0:w},x),B?t.createElement(c.default,{style:H.container},t.createElement(s.default,{enabled:!0,isNativeStack:!0,activityState:E,shouldFreeze:O,hasLargeHeader:v?.largeTitle??!1,scrollEdgeEffects:P,style:n.default.absoluteFill,onHeaderHeightChange:w},K)):K)}var E=t.forwardRef(v);function y(e,t){return'formSheet'!==t?H.container:'fitToContents'===e?H.absoluteWithNoBottom:H.container}function S(e,t){if(!h.isIOS26OrHigher)return{};const n=e?.translucent||e?.hidden?{}:{top:!0};if(t)for(const e of O){const r=t[e];void 0!==r&&(n[e]=r)}return n}const O=['top','right','bottom','left'],H=n.default.create({container:{flex:1},absoluteWithNoBottom:{position:'absolute',top:0,start:0,end:0}})},632,[30,122,46,633,634,628,627,631,636,637,638,639,640,641]); +__d(function(g,r,i,a,m,e,d){new Set;m.exports=function(n,...t){}},633,[]); +__d(function(g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return f}});var e,t=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(n){if('default'!==n){var u=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,u.get?u:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,t})(r(_d[0])),n=r(_d[1]),u=(e=n)&&e.__esModule?e:{default:e};function f(e){return t.createElement(u.default,e)}},634,[30,635]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u}});var e,t=r(d[0]);var u=((e=t)&&e.__esModule?e:{default:e}).default},635,[127]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"GHContext",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"RNSScreensRefContext",{enumerable:!0,get:function(){return l}});var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e};const u=n.default.createContext(e=>n.default.createElement(n.default.Fragment,null,e.children)),l=n.default.createContext(null)},636,[30]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"FooterComponent",{enumerable:!0,get:function(){return o}});var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e};const u=n.default,o=n.default;var f=u},637,[127]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"SafeAreaView",{enumerable:!0,get:function(){return u}});var e,t=r(d[0]);const u=((e=t)&&e.__esModule?e:{default:e}).default},638,[127]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return H}}),Object.defineProperty(e,"compatibilityFlags",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"featureFlags",{enumerable:!0,get:function(){return U}});const t=!0,n=!0,s=!0,o=!1,c=!0,u=!0,l=!1,b={isNewBackTitleImplementation:!0,usesHeaderFlexboxImplementation:!0,usesNewAndroidHeaderHeightImplementation:!0,usesStableTabsApi:!0},h={experiment:{synchronousScreenUpdatesEnabled:t,synchronousHeaderConfigUpdatesEnabled:n,synchronousHeaderSubviewUpdatesEnabled:s,androidLegacyTopInsetBehavior:o,androidResetScreenShadowStateOnOrientationChangeEnabled:c,iosOrientationInheritanceFixEnabled:u},stable:{debugLogging:l}},p=(t,n)=>({get:()=>h.experiment[t],set(s){s!==h.experiment[t]&&h.experiment[t]!==n&&console.error(`[RNScreens] ${t} feature flag modified for a second time; this might lead to unexpected effects`),h.experiment[t]=s}}),f=p('synchronousScreenUpdatesEnabled',t),S=p('synchronousHeaderConfigUpdatesEnabled',n),y=p('synchronousHeaderSubviewUpdatesEnabled',s),E=p('androidLegacyTopInsetBehavior',o),O=p('androidResetScreenShadowStateOnOrientationChangeEnabled',c),v=p('iosOrientationInheritanceFixEnabled',u),x=(I='debugLogging',w=l,{get:()=>h.stable[I],set(t){t!==h.stable[I]&&h.stable[I]!==w&&console.error(`[RNScreens] ${I} feature flag modified for a second time; this might lead to unexpected effects`),h.stable[I]=t}});var I,w;const U={experiment:{get synchronousScreenUpdatesEnabled(){return f.get()},set synchronousScreenUpdatesEnabled(t){f.set(t)},get synchronousHeaderConfigUpdatesEnabled(){return S.get()},set synchronousHeaderConfigUpdatesEnabled(t){S.set(t)},get synchronousHeaderSubviewUpdatesEnabled(){return y.get()},set synchronousHeaderSubviewUpdatesEnabled(t){y.set(t)},get androidLegacyTopInsetBehavior(){return E.get()},set androidLegacyTopInsetBehavior(t){E.set(t)},get androidResetScreenShadowStateOnOrientationChangeEnabled(){return O.get()},set androidResetScreenShadowStateOnOrientationChangeEnabled(t){O.set(t)},get iosOrientationInheritanceFixEnabled(){return v.get()},set iosOrientationInheritanceFixEnabled(t){v.set(t)},get iosPreventReattachmentOfDismissedScreens(){return!0},set iosPreventReattachmentOfDismissedScreens(t){},get iosPreventReattachmentOfDismissedModals(){return!0},set iosPreventReattachmentOfDismissedModals(t){},get ios26AllowInteractionsDuringTransition(){return!0},set ios26AllowInteractionsDuringTransition(t){}},stable:{get debugLogging(){return x.get()},set debugLogging(t){x.set(t)}}};var H=U},639,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"isIOS26OrHigher",{enumerable:!0,get:function(){return t}}),r(d[0]);const t=!1},640,[122]); +__d(function(g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"EdgeInsetApplicationContext",{enumerable:!0,get:function(){return o}}),_e.useEdgeInsetApplication=function(n,s,l,u,d){const{topAlreadyApplied:c,leftDisabled:p,rightDisabled:b,bottomDisabled:f}=e.useContext(o),y=t.featureFlags.experiment?.androidLegacyTopInsetBehavior??!1,D=y||!c&&n,A=D&&!s,h=p||l,I=b||u,v=f||d,x=e.useMemo(()=>({topAlreadyApplied:c||D,leftDisabled:h,rightDisabled:I,bottomDisabled:v}),[c,D,h,I,v]);return{appliesTopInset:A,consumeLeftInset:!h,consumeRightInset:!I,consumeBottomInset:!v,useLegacyBehavior:y,nextContextValue:x}};var e=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(n){if('default'!==n){var o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,t})(r(_d[0])),t=r(_d[1]);const n={topAlreadyApplied:!1,leftDisabled:!1,rightDisabled:!1,bottomDisabled:!1},o=e.createContext(n)},641,[30,639]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u}});var e,t=r(d[0]),u=((e=t)&&e.__esModule?e:{default:e}).default},642,[127]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"isSearchBarAvailableForCurrentPlatform",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"isHeaderBarButtonsAvailableForCurrentPlatform",{enumerable:!0,get:function(){return u}}),_e.executeNativeBackPress=function(){return n.default.exitApp(),!0},_e.parseBooleanToOptionalBooleanNativeProp=function(e){switch(e){case void 0:return'undefined';case!0:return'true';case!1:return'false'}};var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e};r(d[1]);const o=['ios','android'].includes("web"),u=!1},643,[233,122]); +__d(function(g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return o}});var e,t=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(n){if('default'!==n){var u=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,u.get?u:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,t})(r(_d[0])),n=r(_d[1]),u=(e=n)&&e.__esModule?e:{default:e};function o(){const e=t.useContext(u.default);if(void 0===e)throw new Error("Couldn't find values for transition progress. Are you inside a screen in Native Stack?");return e}},644,[30,645]); +__d(function(g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return e}});var e=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(n){if('default'!==n){var u=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,u.get?u:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,t})(r(_d[0])).createContext(void 0)},645,[30]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"Tabs",{enumerable:!0,get:function(){return s}});var t=r(d[0]),n=r(d[1]);const s={Host:t.TabsHost,Screen:n.TabsScreen}},646,[647,649]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"TabsHost",{enumerable:!0,get:function(){return u.default}});var e,t=r(d[0]),u=(e=t)&&e.__esModule?e:{default:e}},647,[648]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u}});var e,t=r(d[0]);var u=((e=t)&&e.__esModule?e:{default:e}).default},648,[127]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"TabsScreen",{enumerable:!0,get:function(){return u.default}});var e,t=r(d[0]),u=(e=t)&&e.__esModule?e:{default:e}},649,[650]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u}});var e,t=r(d[0]);var u=((e=t)&&e.__esModule?e:{default:e}).default},650,[127]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"useBottomTabBarHeight",{enumerable:!0,get:function(){return o}});const n=r(d[1]);function o(){const o=(0,t().use)(n.BottomTabBarHeightContext);if(void 0===o)throw new Error("Couldn't find the bottom tab bar height. Are you inside a screen in Bottom Tab Navigator?");return o}},651,[30,621]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const o=r(d[0]);return t=function(){return o},o}function o(){const t=r(d[1]);return o=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"createStandardBottomTabNavigator",{enumerable:!0,get:function(){return p}});const n=r(d[2]),s=r(d[3]),u=r(d[4]),c=r(d[5]),l=r(d[6]);const p=(0,o().createStandardNavigator)(function({state:o,descriptors:p,actions:f,emitter:b,isPreloaded:T,isRemovalPrevented:v,routeNames:y,popNestedStackToTop:k,preload:N,backBehavior:R,...P}){(0,n.useNonStackAnchorWarning)(R),(0,u.useReconcileTabHistory)();const{visibleRoutes:h,focusedIndex:S,focusedFallbackRoute:x}=(0,c.useVisibleTabsWithRedirect)({routes:o.routes,routeNames:y,focusedRouteKey:o.routes[o.index]?.key,descriptors:p}),B=p;return(0,s.usePreloadPlaceholderRoutes)({routes:h,descriptors:B,preload:N,lazyByDefault:!0}),x?p[x.key]?.render()??null:0===h.length||S<0?null:(0,t().jsx)(l.BottomTabView,{...P,state:{...o,routes:h,index:S},descriptors:B,emitter:b,navigateToTab:t=>{const n=o.routes.find(o=>o.key===t);n&&f.navigate(n.name,n.params)},popNestedStackToTop:k})})},652,[24,653,654,656,657,658,620]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.createStandardNavigator=function(t){return{type:'standard',version:1,NavigatorContent:t}},r(d[0])},653,[30]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"useNonStackAnchorWarning",{enumerable:!0,get:function(){return n}});r(d[0]),r(d[1]),r(d[2]);const n=n=>{}},654,[403,406,655]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}function n(){const t=r(d[1]);return n=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var u in n)Object.defineProperty(t,u,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,u).get})})(e,{get useDeprecated(){return f},get useWarnOnce(){return c}});const u=n().Platform.select({native:!1,default:!1}),o=new Set;function c(n,c=!0,f=n){(0,t().useLayoutEffect)(()=>{c&&u&&!o.has(f)&&(o.add(f),console.warn(n))},[c])}function f(t,n=!0,u=t){return c(u,n,`Expo Router: ${t}`)}},655,[30,33]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const o=r(d[0]);return t=function(){return o},o}function o({routes:o,descriptors:n,preload:u,lazyByDefault:c}){(0,t().useEffect)(()=>{for(const t of o){const o=n[t.key],s=o?.options?.lazy;void 0!==o?.route?.key||(s??c)||u(t.name)}},[n,c,u,o])}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"usePreloadPlaceholderRoutes",{enumerable:!0,get:function(){return o}})},656,[30]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"useReconcileTabHistory",{enumerable:!0,get:function(){return f}});const n=r(d[1]),o=r(d[2]),s=r(d[3]),u=r(d[4]),c=r(d[5]),l=r(d[6]),y=r(d[7]);function f(f){const b=f?.state??(0,t().use)(y.NavigatorStateContext),h=f?.navigation??(0,t().use)(s.NavigationHelpersContext),p=(0,t().use)(u.RootNavigationStateContext);if(!b||!h)throw new Error("Could not reconcile the tab history because `unstable_useReconcileTabHistory` found no navigator. Call it inside the content of a tab navigator, or pass the navigator `state` and `navigation`.");const v=p&&(0,n.findStateByKey)(p,b.key);(0,l.useClientLayoutEffect)(()=>{v&&v.type===b.type&&(0,c.isArrayEqual)(v.routeNames,b.routeNames)&&null==v.history&&((0,o.hasBackTarget)(v)||(0,o.hasBackTarget)(b))&&h.dispatch({type:'ROUTE_NAMES_CHANGED',payload:{routeNames:b.routeNames},target:v.key})},[v,h,b])}},657,[30,454,425,441,423,371,376,473]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const u=r(d[0]);return t=function(){return u},u}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"useVisibleTabsWithRedirect",{enumerable:!0,get:function(){return b}});const u=r(d[1]),n=r(d[2]),o=r(d[3]),s=r(d[4]),c=r(d[5]),f=r(d[6]),l=r(d[7]),R=r(d[8]),y=r(d[9]);function b({routes:b,routeNames:_,focusedRouteKey:v,descriptors:p}){const I=(0,y.useBuildHref)(),M=(0,o.useRouterActions)(),O=(0,c.useIsPreview)(),k=(0,f.useIsFocused)(),E=(0,u.useRouteNode)(),h=b.find(t=>t.key===v),x=(0,s.useGuardRedirect)(h?.name??''),F=(0,t().useMemo)(()=>(0,R.orderRoutesByRouteNames)(b,_).filter(t=>{const u=p[t.key];return N(u)&&!0!==u?.options?.hidden}),[b,_,p]),P=(0,t().useMemo)(()=>F.findIndex(t=>t.key===v),[v,F]),T=P<0&&h?.name===n.NOT_FOUND_ROUTE_NAME?h:void 0,j=P,A=(0,l.getValidInitialRouteName)(E),B=(0,t().useMemo)(()=>{if(void 0!==x)return x;const t=F.find(t=>t.name===A)??F[0];return t?I(t):null},[I,x,A,F]);return(0,t().useEffect)(()=>{},[x,E?.contextKey,F.length]),(0,t().useEffect)(()=>{!O&&k&&P<0&&void 0===T&&null!=B&&M.replace(B)},[T,k,O,B,M,P]),{visibleRoutes:F,focusedIndex:j,focusedFallbackRoute:T}}function N(t){return'layout'===t?.routeSource}},658,[30,403,295,298,535,421,427,406,659,660]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(t,n){const u=n.flatMap(n=>{const u=t.find(t=>t.name===n);return u?[u]:[]});return u.length===t.length&&u.every((n,u)=>n===t[u])?t:u}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"orderRoutesByRouteNames",{enumerable:!0,get:function(){return t}})},659,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"useBuildHref",{enumerable:!0,get:function(){return o}});const n=r(d[1]),u=r(d[2]);function o(){const o=(0,u.useStateForPath)();return(0,t().useMemo)(()=>{const t=new WeakMap;return u=>{const s=t.get(u);if(void 0!==s)return s;const c={routes:[{name:u.name,params:u.params}]},f=t=>{const n=t?.routes[0];return n?{routes:[{...n,state:f(n.state)}]}:c},p=(0,n.getRouteInfoFromState)(f(o)).pathnameWithParams;return t.set(u,p),p}},[o])}},660,[30,387,431]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/chef-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png",width:48,height:48,toString(){return this.uri}}},661,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get NavigationAwareActivity(){return s},get useActivityMode(){return c}});const n=r(d[1]),o=r(d[2]),u=r(d[3]);function c(t=2){const n=(0,o.useRoute)(),u=(0,o.useIsFocused)(),c=(0,o.useNavigationState)(t=>{if('stack'!==t.type)return 0;const o=t.routes.findIndex(({key:t})=>t===n.key);return o<0?0:Math.max(0,t.index-o)});return t<=1?u?'visible':'hidden':c>=t?'hidden':'visible'}function s({hideWhenNestedAtLevel:o=2,children:u}){const c=(0,n.useRouteNode)();if('route'!==c?.type)throw new Error('NavigationAwareActivity must be rendered inside a screen component.');return(0,t().jsx)(h,{hideWhenNestedAtLevel:o,children:u})}function h({hideWhenNestedAtLevel:n,children:o}){const s=c(n);return(0,t().jsx)(u.ActivityContents,{mode:s,children:o})}},662,[24,403,427,663]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}function n(){const t=r(d[1]);return n=function(){return t},t}function s(t){if(null===t)return;const n=t.firstElementChild;if(!(n instanceof HTMLElement))return;const s=()=>{'none'===n.style.display&&(n.style.display='contents')},c=new MutationObserver(s);return c.observe(n,{attributes:!0,attributeFilter:['style']}),s(),()=>c.disconnect()}function c({mode:c,children:o}){return(0,t().jsx)("div",{ref:s,style:{display:'contents'},children:(0,t().jsx)(n().Activity,{mode:c,children:(0,t().jsx)("div",{style:{display:'contents'},children:o})})})}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"ActivityContents",{enumerable:!0,get:function(){return c}})},663,[24,30]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"SuspenseFallback",{enumerable:!0,get:function(){return n}});r(d[0]);function n({route:n}){return null}},664,[544]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}function n(){const t=r(d[1]);return n=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"Try",{enumerable:!0,get:function(){return s}});r(d[2]);const o=c(r(d[3]));function u(t){if("function"!=typeof WeakMap)return null;var n=new WeakMap,o=new WeakMap;return(u=function(t){return t?o:n})(t)}function c(t,n){if(!n&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var o=u(n);if(o&&o.has(t))return o.get(t);var c={__proto__:null},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var f in t)if("default"!==f&&Object.prototype.hasOwnProperty.call(t,f)){var p=s?Object.getOwnPropertyDescriptor(t,f):null;p&&(p.get||p.set)?Object.defineProperty(c,f,p):c[f]=t[f]}return c.default=t,o&&o.set(t,c),c}class s extends n().Component{state={error:void 0};static getDerivedStateFromError(t){return o.hideAsync(),{error:t}}retry=()=>new Promise(t=>{this.setState({error:void 0},()=>{t()})});render(){const{error:n}=this.state,{catch:o,children:u}=this.props;return n?(0,t().jsx)(o,{error:n,retry:this.retry}):u}}},665,[24,30,666,667]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),(function(t,s){for(var o in s)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(s,o).get})})(e,{get MetroServerError(){return t},get NetworkError(){return o},get ReactServerError(){return s}});class t extends Error{code='METRO_SERVER_ERROR';constructor(t,s){super(t.message),this.url=s,this.name='MetroServerError';for(const s in t)this[s]=t[s]}}class s extends Error{code='REACT_SERVER_ERROR';constructor(t,s,o,n){super(t),this.url=s,this.statusCode=o,this.headers=n,this.name='ReactServerError'}}class o extends Error{code='NETWORK_ERROR';constructor(t,s){super(t),this.url=s,this.name='NetworkError'}}},666,[]); +__d(function(g,r,i,a,m,e,d){"use strict";var t,n;Object.defineProperty(e,"__esModule",{value:!0}),t=r(d[0]),n=e,Object.keys(t).forEach(function(c){"default"===c||Object.prototype.hasOwnProperty.call(n,c)||Object.defineProperty(n,c,{enumerable:!0,get:function(){return t[c]}})})},667,[668]); +__d(function(g,r,i,a,m,e,d){"use strict";function n(){const t=r(d[0]);return n=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),(function(n,t){for(var c in t)Object.defineProperty(n,c,{enumerable:!0,get:Object.getOwnPropertyDescriptor(t,c).get})})(e,{get _internal_maybeHideAsync(){return H},get _internal_preventAutoHideAsync(){return p},get cancelSplashScreenAnimationFrame(){return s},get hide(){return y},get hideAsync(){return f},get maybeHideSplashScreen(){return l},get preventAutoHideAsync(){return A}});const t=(0,n().requireOptionalNativeModule)('ExpoSplashScreen');let c,o=!1,u=!1;function l(){u||(u=!0,c=requestAnimationFrame(()=>{H()}))}function s(){void 0!==c&&(cancelAnimationFrame(c),c=void 0)}function y(){t&&t.hide()}async function f(){y()}async function A(){if(t)return t.preventAutoHideAsync()}async function p(){if(!t||!t.internalPreventAutoHideAsync)return!1;if(!o){if(ErrorUtils?.getGlobalHandler){const n=ErrorUtils.getGlobalHandler();ErrorUtils.setGlobalHandler((t,c)=>{y(),n(t,c)})}o=!0}return t.internalPreventAutoHideAsync()}async function H(){return!(!t||!t.internalMaybeHideAsync)&&t.internalMaybeHideAsync()}},668,[570]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"getStateForHref",{enumerable:!0,get:function(){return n}});const t=r(d[0]);function n(n,o,f,s){return n=(0,t.resolveHref)(n),n=(0,t.resolveHrefStringWithSegments)(n,o,s),f?.getStateFromPath(n,f.config,o.segments)}},669,[353]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=p(r(d[0]));return t=function(){return n},n}function n(){const t=r(d[1]);return n=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get getInitialURL(){return P},get getPathFromState(){return c.getPathFromState},get getRootURL(){return b},get getStateFromPath(){return f.getStateFromPath},get subscribe(){return O}});const o=r(d[2]),u=r(d[3]),c=r(d[4]),f=r(d[5]),l=r(d[6]);function s(t){if("function"!=typeof WeakMap)return null;var n=new WeakMap,o=new WeakMap;return(s=function(t){return t?o:n})(t)}function p(t,n){if(!n&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var o=s(n);if(o&&o.has(t))return o.get(t);var u={__proto__:null},c=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var f in t)if("default"!==f&&Object.prototype.hasOwnProperty.call(t,f)){var l=c?Object.getOwnPropertyDescriptor(t,f):null;l&&(l.get||l.set)?Object.defineProperty(u,f,l):u[f]=t[f]}return u.default=t,o&&o.set(t,u),u}const y='undefined'!=typeof expo&&globalThis.expo?.modules?.ExpoGo;function P(){if('undefined'==typeof window)return'';if('web'===n().Platform.OS&&window.location?.href)return window.location.href;if('ios'===n().Platform.OS){return w(t().getLinkingURL())??b()}return Promise.resolve((0,u.getInitialURLWithTimeout)()).then(t=>w(t)??b())}let h;function b(){if(void 0===h){try{h=t().createURL('/')}catch{return h='/',h}y&&(h=(0,o.parsePathFromExpoGoLink)(h))}return h}function w(t){if(!t||!y)return t;const{pathname:n,queryString:u}=(0,o.parsePathAndParamsFromExpoGoLink)(t);return n&&'/'!==n?t:b()+u}function O(n,o){return u=>{let c;const f=n?.legacy_subscribe?.(u);c=y?async({url:t})=>{let c=w(t);c=(0,l.applyRedirects)(c,o),c&&n?.redirectSystemPath&&(c=await n.redirectSystemPath({path:c,initial:!1})),c&&u(c)}:async({url:t})=>{let c=(0,l.applyRedirects)(t,o);c&&n?.redirectSystemPath&&(c=await n.redirectSystemPath({path:c,initial:!1})),c&&u(c)};const s=t().addEventListener('url',c);return()=>{s?.remove?.(),f?.()}}}},670,[300,33,671,672,412,414,418]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get extractExpoPathFromURL(){return p},get parsePathAndParamsFromExpoGoLink(){return o},get parsePathFromExpoGoLink(){return c}});const n=r(d[1]);function o(t){const n=c(t).match(/([^?]*)(\?.*)?/);return{pathname:n?.[1]??'',queryString:n?.[2]??''}}function c(t){return t.match(/exps?:\/\/.*?\/--\/(.*)/)?.[1]??''}function u(n){if((n=(0,t().unwrapDevLaunchURL)(n)).match(/^https?:\/\//)){const{origin:t,href:o,hostname:c}=new URL(n);return'exp.host'===c||'u.expo.dev'===c?'':o.replace(t,'')}if('undefined'!=typeof expo&&globalThis.expo?.modules?.ExpoGo&&n.match(/^exp(s)?:\/\//)){const t=c(n);if(t)return s('a://'+t);const o=n.match(/exps?:\/\/.*\?(.*)/)?.[1];return o?s('a://?'+o):''}return s(n)}function s(t){let o;try{o=new URL(t)}catch{return t.startsWith('/')?t:t.replace(/^[^:]+:\/\//,'')}let c='';o.host&&(c+=o.host),o.pathname&&(c+=o.pathname);const u=o.search?[...o.searchParams.entries()].map(([t,o])=>`${t}=${(0,n.safeDecodeURIComponent)(o)}`).join('&'):'';return u&&(c+='?'+u),c}function p(t,n=""){return u(n).replace(/^\//,'')}},671,[300,355]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=u(r(d[0]));return t=function(){return n},n}function n(){const t=r(d[1]);return n=function(){return t},t}function o(t){if("function"!=typeof WeakMap)return null;var n=new WeakMap,u=new WeakMap;return(o=function(t){return t?u:n})(t)}function u(t,n){if(!n&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var u=o(n);if(u&&u.has(t))return u.get(t);var f={__proto__:null},c=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in t)if("default"!==l&&Object.prototype.hasOwnProperty.call(t,l)){var p=c?Object.getOwnPropertyDescriptor(t,l):null;p&&(p.get||p.set)?Object.defineProperty(f,l,p):f[l]=t[l]}return f.default=t,u&&u.set(t,f),f}function f(){return'undefined'==typeof window?'':'ios'===n().Platform.OS?t().getLinkingURL():Promise.race([n().Linking.getInitialURL(),new Promise(t=>setTimeout(()=>t(null),150))])}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"getInitialURLWithTimeout",{enumerable:!0,get:function(){return f}})},672,[300,33]); +__d(function(g,r,i,a,m,e,d){"use strict";function n(){const t=r(d[0]);return n=function(){return t},t}function t(){const n=r(d[1]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),(function(n,t){for(var u in t)Object.defineProperty(n,u,{enumerable:!0,get:Object.getOwnPropertyDescriptor(t,u).get})})(e,{get LinkZoomTransitionAlignmentRectDetector(){return b},get LinkZoomTransitionEnabler(){return l},get LinkZoomTransitionSource(){return s},get NativeLinkPreview(){return o},get NativeLinkPreviewAction(){return u},get NativeLinkPreviewContent(){return c}});function u(n){return null}function o(n){return null}function c(n){return null}function l(n){return null}function s(n){return null}const f=t().Fragment;function b(t){return f?(0,n().jsx)(f,{...t,disableForceFlatten:!0,collapsable:!1,collapsableChildren:!1,style:{display:'contents'}}):null}},673,[24,30,33]); +__d(function(g,r,i,a,m,e,d){"use strict";function n(){const t=r(d[0]);return n=function(){return t},t}function t(){const n=r(d[1]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"LinkAppleZoom",{enumerable:!0,get:function(){return f}});const o=r(d[2]),u=r(d[3]),c=r(d[4]),s=r(d[5]);function f(t){return(0,c.isZoomTransitionEnabled)()?(0,n().jsx)(l,{...t}):(0,n().jsx)(o.Slot,{...t})}function l({children:c,alignmentRect:f,...l}){const h=(0,t().use)(s.ZoomTransitionSourceContext);if(!h)throw new Error('[expo-router] Link.ZoomTransitionSource must be used within a Link');const{identifier:S,addSource:j,removeSource:p}=h;(0,t().useEffect)(()=>(j(),p),[j,p]);const x=t().Children.count(c)>1;return(0,t().useEffect)(()=>{},[x]),x?null:(0,n().jsx)(u.LinkZoomTransitionSource,{identifier:S,alignment:f,animateAspectRatioChange:!0,children:(0,n().jsx)(o.Slot,{...l,children:c})})}},674,[24,30,514,673,538,675]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get ZoomTransitionSourceContext(){return n},get ZoomTransitionTargetContext(){return o}});const n=(0,t().createContext)(void 0),o=(0,t().createContext)({identifier:null,dismissalBoundsRect:null,setDismissalBoundsRect:()=>{},addEnabler:()=>{},removeEnabler:()=>{},hasEnabler:!1})},675,[30]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}function n(){const t=r(d[1]);return n=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get LinkPreviewContextProvider(){return l},get useLinkPreviewContext(){return v}});const o=r(d[2]);function s(t,n){return('stack'===t.type?t.routes.slice(0,(t.index??0)+1):t.routes).some(t=>t.key===n||t.state&&s(t.state,n))}const u=(0,n().createContext)(void 0);function c(){let t;const n=new Set;return{getSnapshot:()=>t,subscribe:t=>(n.add(t),()=>{n.delete(t)}),set:o=>{t!==o&&(t=o,n.forEach(t=>t()))}}}function l({children:l}){const[v]=(0,n().useState)(c),f=(0,n().useSyncExternalStore)(v.subscribe,v.getSnapshot,v.getSnapshot),p=(0,n().useCallback)(t=>{v.set(t)},[v]);(0,n().useEffect)(()=>o.internalNavigationEvents.addListener('actionDispatched',({payload:t,state:n})=>{const o=v.getSnapshot();void 0!==o&&t&&'__internal__PreviewKey'in t&&t.__internal__PreviewKey===o&&!s(n,o)&&p(void 0)}),[p,v]);const P=void 0!==f;return(0,t().jsx)(u.Provider,{value:{isStackAnimationDisabled:P,openPreviewKey:f,getOpenPreviewKey:v.getSnapshot,setOpenPreviewKey:p},children:l})}const v=()=>{const t=(0,n().use)(u);if(null==t)throw new Error('useLinkPreviewContext must be used within a LinkPreviewContextProvider. This is likely a bug in Expo Router.');return t}},676,[24,30,677]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"internalNavigationEvents",{enumerable:!0,get:function(){return n}});const t={actionDispatched:new Set,routePreloaded:new Set},n={addListener:(n,o)=>(t[n].add(o),()=>{t[n].delete(o)}),emit(n,o){for(const c of t[n])c(o)}}},677,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"usePreviewActivationPath",{enumerable:!0,get:function(){return o}});const n=r(d[1]),u=r(d[2]),c=r(d[3]);function o(){const o=(0,u.useRouter)(),s=(0,t().useId)(),f=(0,t().useRef)(0),v=(0,t().useRef)(void 0),[l,_]=(0,t().useState)(),P=(0,t().useEffectEvent)(({routeKey:t,state:n})=>{const u=v.current;if(void 0===u)return;const o=(0,c.findPreviewActivationPath)(n,t,u);o&&setTimeout(()=>{v.current===u&&_(o)})});(0,t().useEffect)(()=>n.internalNavigationEvents.addListener('routePreloaded',P),[]);const b=(0,t().useCallback)(()=>{v.current=void 0,_(void 0)},[]);return[l,(0,t().useCallback)(t=>{_(void 0);const n=`${s}:${++f.current}`;v.current=n,o.prefetch(t,{__internal__previewId:n})},[s,o.prefetch]),b]}},678,[30,677,419,679]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=o(r(d[0]));return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"findPreviewActivationPath",{enumerable:!0,get:function(){return u}});const n=r(d[1]);function o(t){return t&&t.__esModule?t:{default:t}}function u(t,o,f){const c=t.routes.findIndex(t=>t.key===o);if(-1!==c){const o=t.routes[c];if((0,n.getInternalExpoRouterParams)(o.params)[n.INTERNAL_EXPO_ROUTER_PREVIEW_ID_PARAM_NAME]!==f||s(t,c))return;return[{key:o.key}]}for(const n of t.routes)if(!1===n.state?.stale){const t=u(n.state,o,f);if(t)return[{key:n.key},...t]}}function s(o,u){const s=o.routes[u],f=o.routes[o.index];return u!==o.index&&f?.name===s.name&&(0,t().default)((0,n.removeInternalExpoRouterParams)(f.params??{}),(0,n.removeInternalExpoRouterParams)(s.params??{}))}},679,[368,391]); +__d(function(g,r,i,a,m,e,d){"use strict";function t({href:t}){return t}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"useZoomHref",{enumerable:!0,get:function(){return t}})},680,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function n(){const t=r(d[0]);return n=function(){return t},t}function t(){const n=r(d[1]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"LinkAppleZoomTarget",{enumerable:!0,get:function(){return u}});const o=r(d[2]),c=r(d[3]);function u({children:u}){if(t().Children.count(u)>1)return console.warn('[expo-router] Link.AppleZoomTarget only accepts a single child component. Please wrap multiple children in a View or another container component.'),null;const{identifier:l}=(0,t().use)(c.ZoomTransitionTargetContext);return l?(0,n().jsx)(o.LinkZoomTransitionAlignmentRectDetector,{identifier:l,children:u}):u}},681,[24,30,673,675]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=h(r(d[0]));return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"resolveNavigationDestination",{enumerable:!0,get:function(){return v}});const n=r(d[1]),o=r(d[2]),u=r(d[3]),s=r(d[4]),c=r(d[5]),p=r(d[6]),l=r(d[7]),y=r(d[8]),f=r(d[9]);function h(t){return t&&t.__esModule?t:{default:t}}const N=new Set(['NAVIGATE','PUSH','REPLACE','POP_TO','PRELOAD','JUMP_TO']);function v({targetState:t,navigationState:n,routeNode:o,registry:s,action:c,withAnchor:p=!1,internalParams:l={}}){if(!N.has(c.type))throw new Error(`Unsupported destination action type: ${c.type}`);let y=t,f=n,h=o,v=!1;for(;;){const t=P(y),n='tab'===f.type&&'PRELOAD'===c.type?f.routes.find(n=>n.name===t?.name):f.routes[f.index],o=w(h,t?.name),p=t?.state,N=n?.state;if(!(t&&o&&n&&A(t,n)&&p&&!1===N?.stale&&s.has(N.key)))break;const R=P(p);if(!R)break;const S={type:'NAVIGATE',payload:{name:R.name,params:(0,u.appendInternalExpoRouterParams)(R.params,l)}};if(void 0===E(s.get(N.key)?.reduce(N,S)))break;y=p,f=N,h=o,v=!0}const S={...c,target:f.key};return v&&delete S.source,R({targetState:y,navigationState:f,routeNode:h,rootRouteNode:o,registry:s,action:S,withAnchor:p,internalParams:l})}function R({targetState:t,navigationState:n,routeNode:o,rootRouteNode:s,registry:p,action:l,withAnchor:y=!1,internalParams:f={}}){const h=P(t);if(!h)return l;const N=(0,u.appendInternalExpoRouterParams)(h.params,f)??{},v=h.state,R=w(o,h.name),{pop:_,...A}=l.payload,K={...A,...!0===_&&k({targetRoute:h,navigationState:n,routeNode:o,rootRouteNode:s,childNode:R})?{pop:_}:void 0,name:h.name,params:N,...void 0!==h.path?{path:h.path}:void 0},T={...l,payload:K},O=p.get(n.key)?.reduce(n,T),C=E(O)?.route;if(!v||!R)return T;const b=(0,c.getChainFromRouteKey)(C?.key??(0,c.createRouteKeyMinter)(n).mint(h.name)),L=S({targetState:v,navigationState:C?.state,routeNode:R,rootRouteNode:s,registry:p,withAnchor:y,internalParams:f,parentChain:b,previewKey:l.payload.__internal__PreviewKey,pop:!0===_||'POP_TO'===l.type});return{...T,payload:{...K,state:I(L)}}}function S({targetState:n,navigationState:o,routeNode:u,rootRouteNode:s,registry:c,withAnchor:p,internalParams:l,parentChain:y,previewKey:f,pop:h}){if(!1!==o?.stale||!c.has(o.key))return _(n,u,p,l,y);if(!P(n))return o;const N=R({targetState:n,navigationState:o,routeNode:u,rootRouteNode:s,registry:c,action:{type:'NAVIGATE',payload:{__internal__PreviewKey:f,...h?{pop:h}:void 0}},withAnchor:p,internalParams:l}),v=c.get(o.key)?.reduce(o,N),S=E(v);return S?(0,t().default)(S.state,o)?o:S.state:_(n,u,p,l,y)}function _(t,n,o,p,f){const h=P(t),N=(0,l.getValidInitialRouteName)(n),v=[...n.children].sort((0,y.sortRoutesWithInitial)(N)).map(t=>t.route);if(!h)return I((0,s.createInitialState)({routeNames:v,initialRouteName:N,parentChain:f}));if(!v.includes(h.name))return console.warn(`The navigation destination contains the unknown route "${h.name}". The route is not registered by its navigator, so Expo Router will use the navigator's initial route instead. Check that your linking configuration only returns registered routes.`),I((0,s.createInitialState)({routeNames:v,initialRouteName:N,parentChain:f}));const R=o&&N&&N!==h.name,S=(0,s.createInitialState)({routeNames:v,initialRouteName:R?N:h.name,parentChain:f}),A=(0,c.createRouteKeyMinter)(S),k=R?A.mint(h.name):S.routes[0].key,w=(0,l.findRouteNodeByName)(n,h.name),E=h.state&&w?_(h.state,w,o,p,(0,c.getChainFromRouteKey)(k)):void 0,K={...S.routes[0],key:k,name:h.name,...void 0!==h.path?{path:h.path}:void 0,params:(0,u.appendInternalExpoRouterParams)(h.params,p)??{},...void 0!==E?{state:E}:void 0};return I(R?{...S,routeKeySeq:A.routeKeySeq,index:1,routes:[S.routes[0],K]}:{...S,routes:[K]})}function P(t){return t.routes[t.index??t.routes.length-1]}function A(t,n){if(t.name!==n.name)return!1;const u=(0,o.matchDynamicName)(t.name);return!u||t.params?.[u.name]===n.params?.[u.name]}function k({targetRoute:t,navigationState:o,routeNode:u,rootRouteNode:s,childNode:c}){const p=u===s&&t.name!==n.INTERNAL_SLOT_NAME,l=void 0!==t.state||(c?.children.length??0)>0;if(p&&!l)return!1;const y=o.routes.findLast(n=>n.name===t.name);return!y||(0,f.getSingularId)(t.name,{params:t.params})===(0,f.getSingularId)(y.name,{params:y.params})}function w(t,o){return o===n.INTERNAL_SLOT_NAME?t:(0,l.findRouteNodeByName)(t,o)}function E(t){if(void 0===t||!(0,p.isActionHandled)(t)||!1!==t.state.stale||void 0===t.affectedRouteKey)return;const n=t.state.routes.find(n=>n.key===t.affectedRouteKey);return n&&{state:t.state,route:n}}function I(t){return{...t,__internal__routerActionState:!0}}},682,[368,295,389,391,405,365,366,406,404,506]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),(function(t,o){for(var n in o)Object.defineProperty(t,n,{enumerable:!0,get:Object.getOwnPropertyDescriptor(o,n).get})})(e,{get indexNavigationTree(){return o},get reduceNavigationTree(){return c},get resolveOrigin(){return n}});const t=r(d[0]);function o(t){f(t);const o=new Map,n=(t,s,u)=>{const c={state:t,parent:s,parentRouteIndex:u};return o.set(t.key,c),t.routes.forEach((t,o)=>{t.state&&(f(t.state),n(t.state,c,o))}),c};return{nodes:o,rootNode:n(t)}}function n(t,o,n,s){if(void 0!==s){const t=o.get(s);return t&&n.has(t.state.key)?t:void 0}let u,c=t;for(;c;){n.has(c.state.key)&&(u=c);const t=c.state.routes[c.state.index]?.state;c=t?o.get(t.key):void 0}return u}function s(o,n,s,u){let c;const f=o=>{const n=u.get(o.state.key);if(!n)return!1;const f=n.reduce(o.state,s),l=(0,t.isActionHandled)(f)?f:void 0;if(!l&&s.target!==o.state.key)return!1;const y=l?.state??o.state;return c={node:o,nextSlice:y,browserHistory:l?.browserHistory,shouldFocus:n.shouldActionChangeFocus?.(s)??!1,affectedRouteKey:l?.affectedRouteKey},!0};if('string'==typeof s.target){const t=n.get(s.target);return t&&f(t)?c:void 0}for(let t=o;t;t=t.parent)if(f(t))return c}function u(t,o){let n=t.browserHistory,s=t.nextSlice,u=t.node;for(;u.parent;){const c=u.parent,f=u.parentRouteIndex,l=c.state.routes[f];let y=l.state===s?c.state:{...c.state,routes:c.state.routes.map((t,o)=>o===f?{...t,state:s}:t)};if(t.shouldFocus){const t=o.get(c.state.key);if(t?.getStateForRouteFocus){const o=y;y=t.getStateForRouteFocus(y,l.key);const s=t.getBrowserHistoryForRouteFocus?.(o,y,n);n=s??n}}s=y,u=c}return{nextState:s,...n&&{browserHistory:n}}}function c(t,o,{origin:n,tree:c}){const f=s(n,c.nodes,t,o);return f?{handled:!0,...u(f,o),affectedRouteKey:f.affectedRouteKey}:{handled:!1}}function f(t){if(!1!==t.stale)throw new Error('Cannot reduce a stale navigation state. Expo Router requires a complete state tree before handling actions, so this is most likely a bug in expo-router. Please report it at https://github.com/expo/expo/issues.')}},683,[366]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=f(r(d[0]));return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"useNavigationTreeReportEvents",{enumerable:!0,get:function(){return p}});const n=r(d[1]),o=r(d[2]),c=r(d[3]),s=r(d[4]);function u(t){if("function"!=typeof WeakMap)return null;var n=new WeakMap,o=new WeakMap;return(u=function(t){return t?o:n})(t)}function f(t,n){if(!n&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var o=u(n);if(o&&o.has(t))return o.get(t);var c={__proto__:null},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var f in t)if("default"!==f&&Object.prototype.hasOwnProperty.call(t,f)){var l=s?Object.getOwnPropertyDescriptor(t,f):null;l&&(l.get||l.set)?Object.defineProperty(c,f,l):c[f]=t[f]}return c.default=t,o&&o.set(t,c),c}new WeakSet;function l(t){}function p(u,f,p){const y=t().use(s.GlobalRemovalEventEmitterRegistryContext),v=t().useRef(new Set);(0,o.useClientLayoutEffect)(()=>{const t=new Set(u?.events.map(t=>t.id));for(const n of v.current)t.has(n)||v.current.delete(n);if(void 0===u)return;const o=[];for(const t of u.events)if(!v.current.has(t.id)){v.current.add(t.id),o.push(t.id);try{switch(t.type){case'unhandled-action':l(t.action);break;case'prevented-routes':for(const n of t.routeKeys)y.emitRemovalEvent(n,'removePrevented',t.action);break;case'removed-routes':for(const n of t.routeKeys)y.emitRemovalEvent(n,'removed',t.action);break;case'action-dispatched':(0,n.mark)('expo-router:action-dispatched',{actionType:t.action.type,actionId:t.actionId}),c.internalNavigationEvents.emit('actionDispatched',{actionType:t.action.type,payload:t.action.payload,state:t.state});break;case'browser-history':p.apply(t);break;case'route-preloaded':c.internalNavigationEvents.emit('routePreloaded',{routeKey:t.routeKey,state:t.state})}}catch(n){const o='object'==typeof n&&null!=n&&'message'in n?n.message:n;console.warn(`An error occurred in a navigation event listener while handling ${t.type}: ${o}`)}}o.length>0&&f(o)},[p,f,y,u])}},684,[30,378,376,677,392]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(t){const n=[],u=(t,c)=>{c.routes.forEach(c=>{const o=t?`${t} > ${c.name}`:c.name;c.state?.routeNames?.forEach(t=>{t===c.name&&n.push([o,`${o} > ${c.name}`])}),c.state&&u(o,c.state)})};return u('',t),n}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"checkDuplicateRouteNames",{enumerable:!0,get:function(){return t}})},685,[]); +__d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"checkSerializable",{enumerable:!0,get:function(){return n}});const t=(n,i,o)=>{if(null==n||'boolean'==typeof n||'number'==typeof n||'string'==typeof n)return{serializable:!0};if('[object Object]'!==Object.prototype.toString.call(n)&&!Array.isArray(n))return{serializable:!1,location:o,reason:'function'==typeof n?'Function':String(n)};if(i.has(n))return{serializable:!1,reason:'Circular reference',location:o};if(i.add(n),Array.isArray(n))for(let l=0;l{},[]);return{getInitialState:()=>{const t=t=>{let o=t?(0,s.extractExpoPathFromURL)(h,t):void 0;void 0===o||o.startsWith('/')||(o=`/${o}`);const c=o?y(o,P):void 0,l=L?.routeNode;return l?(0,u.withLoadedLayouts)(()=>(0,n.createSeededRootState)(c,l)):(0,n.completeParsedState)(c,f.ROOT_CHAIN)},o=w();return'string'!=typeof o&&null!=o?o.then(t):t(o)}}}function p(){return'undefined'==typeof window?'':window.location.href}},688,[30,402,381,398,427,365,671]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=k(r(d[0]));return t=function(){return n},n}function n(){const t=r(d[1]);return n=function(){return t},t}function o(){const t=r(d[2]);return o=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"useRouterConfig",{enumerable:!0,get:function(){return y}});const u=r(d[3]),s=r(d[4]),c=r(d[5]),f=r(d[6]),l=r(d[7]),p=r(d[8]),R=r(d[9]);function k(t){return t&&t.__esModule?t:{default:t}}function y(k,y,C){const _=t().default.expoConfig?.extra?.router,O=(0,n().useMemo)(()=>{let t,p=n().Fragment;const O=(0,f.getRoutes)(k,{..._,skipGenerated:!0,ignoreEntryPoints:!0,platform:o().Platform.OS,preserveRedirectAndRewrites:!0}),P=[_?.redirects,_?.rewrites].filter(Boolean).flat().map(t=>[(0,u.routePatternToRegex)((0,c.parseRouteSegments)(t.source)),t,(0,R.shouldLinkExternally)(t.destination)]);if(!O)throw new Error('No routes found');return t=(0,s.getLinkingConfig)(O,k,{metaOnly:y.metaOnly,serverUrl:C,redirects:P,skipGenerated:_?.skipGenerated??!1,sitemap:_?.sitemap??!0,notFound:_?.notFound??!0}),p=(0,l.getQualifiedRouteComponent)(O),{routerConfig:{linking:t,redirects:P,routeNode:O},rootComponent:p}},[_,k,y,C]);return(0,n().useEffect)(()=>p.cancelSplashScreenAnimationFrame,[]),O}},689,[408,30,33,416,690,691,692,534,668,355]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get getLinkingConfig(){return f},get getNavigationConfig(){return u}});const n=r(d[1]),o=r(d[2]),s=r(d[3]),c=r(d[4]);function u(t,s,{sitemap:c,notFound:u}){const f=(0,o.getReactNavigationConfig)(t,s),l=(()=>{const t='_sitemap';return!1===c||p(f,t)?{}:h(n.SITEMAP_ROUTE_NAME,t,s)})(),y=(()=>{const t='*not-found';return!1===u||p(f,t)?{}:h(n.NOT_FOUND_ROUTE_NAME,t,s)})();return{screens:{[n.INTERNAL_SLOT_NAME]:{path:'',...f},...l,...y}}}function f(n,o,{metaOnly:f=!0,serverUrl:p,redirects:h,skipGenerated:l,sitemap:y,notFound:P}){let O,_=!1;const S=o.keys().find(t=>t.match(/^\.\/\+native-intent\.[tj]sx?$/)),b=S?o(S):void 0,N=u(n,f,{sitemap:!l&&y,notFound:!l&&P});return{prefixes:[],config:N,getInitialURL:()=>(_||('web'===t().Platform.OS?O=p??(0,c.getInitialURL)():(O=p??(0,c.getInitialURL)(),'string'==typeof O?(O=(0,s.applyRedirects)(O,h),O&&'function'==typeof b?.redirectSystemPath&&(O=b.redirectSystemPath({path:O,initial:!0}))):O&&(O=O.then(t=>(t=(0,s.applyRedirects)(t,h))&&'function'==typeof b?.redirectSystemPath?b.redirectSystemPath({path:t,initial:!0}):t))),_=!0),O),subscribe:(0,c.subscribe)(b,h),getStateFromPath:c.getStateFromPath,getPathFromState:(t,n)=>(0,c.getPathFromState)(t,{...N,...n,screens:N.screens??n?.screens??{}})??'/'}}function p(t,n){return Object.values(t.screens).some(t=>'string'==typeof t?t===n:t.path===n)}function h(t,n,o){return o?{[t]:n}:{[t]:{path:n}}}},690,[570,295,691,418,670]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get getReactNavigationConfig(){return f},get getReactNavigationScreensConfig(){return c},get parseRouteSegments(){return o}});const t=r(d[0]);function n(n){if('index'===n)return'';if('+not-found'===n)return'*not-found';const o=(0,t.matchDynamicName)(n);return o&&!o.deep?`:${o.name}`:o?.deep?'*'+o.name:n}function o(t){return t.split('/').map(n).filter(Boolean).join('/')}function u(t,n){const u=o(t.route);if(!t.children.length)return n?u:{path:u,screens:{},_route:t};const f={path:u,screens:c(t.children,n)};return n||(f._route=t),f}function c(t,n){return Object.fromEntries(t.map(t=>[t.route,u(t,n)]))}function f(t,n){return{initialRouteName:void 0,screens:t?c(t.children,n):{}}}},691,[389]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get extrapolateGroups(){return t.extrapolateGroups},get generateDynamic(){return t.generateDynamic},get getExactRoutes(){return o},get getRoutes(){return n}});const t=r(d[0]);function n(n,o={}){return(0,t.getRoutes)(n,{getSystemRoute({route:t,type:o,defaults:u,redirectConfig:l,rewriteConfig:c}){if(''===t&&'layout'===o)return{type:'layout',loadRoute:()=>({default:r(d[1]).DefaultNavigator}),contextKey:'expo-router/build/views/Navigator.js',route:'',generated:!0,dynamic:null,children:[]};if('_sitemap'===t&&'route'===o)return{loadRoute(){const{Sitemap:t,getNavOptions:n}=r(d[2]);return{default:t,getNavOptions:n}},route:'_sitemap',type:'route',contextKey:'expo-router/build/views/Sitemap.js',generated:!0,internal:!0,dynamic:null,children:[]};if('+not-found'===t&&'route'===o)return{loadRoute:()=>({default:r(d[3]).Unmatched}),type:'route',route:'+not-found',contextKey:'expo-router/build/views/Unmatched.js',generated:!0,internal:!0,dynamic:[{name:'+not-found',deep:!0,notFound:!0}],children:[]};if('redirect'===o&&l&&u)return{...u,loadRoute:()=>r(d[4]).getRedirectModule(l)};if('rewrite'===o&&c&&u)return{...u,loadRoute:()=>({default:n(c.destinationContextKey).default})};throw new Error(`Unknown system route: ${t} and type: ${o} and redirectConfig: ${l} and rewriteConfig: ${c}`)},...o})}function o(t,o={}){return n(t,{...o,skipGenerated:!0})}},692,[693,694,757,766,418]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),(function(t,o){for(var n in o)Object.defineProperty(t,n,{enumerable:!0,get:Object.getOwnPropertyDescriptor(o,n).get})})(e,{get extrapolateGroups(){return w},get generateDynamic(){return R},get getRoutes(){return s}});const t=r(d[0]),o=r(d[1]),n=r(d[2]);function s(t,o){const n=u(t,o),s=l(t,o);if(!s)return null;const c=y(s,o);o.importMode;return n&&(c.middleware=n),o.ignoreEntryPoints||E(c,o),c}function u(t,o){const n=t.keys().filter(t=>t.includes('+middleware')),s=n.filter(t=>/^\.\/\+middleware\.[tj]sx?$/.test(t)),u=n.filter(t=>!s.includes(t));if(u.length>0)throw new Error(`The middleware file can only be placed at the root level. Remove the following files: ${u.join(', ')}`);if(0===s.length)return null;s.length;const l=s[0],c={loadRoute(){if(!o.ignoreRequireErrors)return t(l);try{return t(l)}catch{return{}}},contextKey:l};return o.internal_stripLoadRoute&&delete c.loadRoute,c}function l(o,s){const u=s.importMode||"lazy",l=[/^\.\/\+(html|native-intent)\.[tj]sx?$/];s.ignore&&l.push(...s.ignore),s.preserveApiRoutes||l.push(/\+api$/,/\+api\.[tj]sx?$/),l.push(/\+middleware$/,/\+middleware\.[tj]sx?$/);const y={files:new Map,subdirectories:new Map};let R=!1,E=!1;const S=o.keys(),b={},K={};let _;const j=()=>(_??=S.map(o=>({contextKey:o,nameWithoutInvisible:f((0,t.removeSupportedExtensions)(o))})),_);if(s.preserveRedirectAndRewrites){if(s.redirects)for(const t of s.redirects){const o=p(t.source),u=c(t.source),y=(0,n.shouldLinkExternally)(t.destination),h=y?t.destination:f(t.destination);if(l.some(t=>t.test(o)))continue;const w=y?void 0:j().find(t=>t.nameWithoutInvisible===h),R=y?h:w?.nameWithoutInvisible,x=y?h:w?.contextKey;if(x&&void 0!==R)S.push(o),b[u]={source:u,destination:R,destinationContextKey:x,permanent:Boolean(t.permanent),external:y,methods:t.methods};else if(s.preserveApiRoutes)throw new Error(`Redirect destination "${t.destination}" does not exist.`)}if(s.rewrites)for(const t of s.rewrites){const o=p(t.source),n=c(t.source),u=S.includes(o)?c(t.destination):f(t.destination);if(l.some(t=>t.test(o)))continue;const y=j().find(t=>t.nameWithoutInvisible===u),h=y?.nameWithoutInvisible,w=y?.contextKey;if(w&&void 0!==h)S.push(o),K[n]={source:n,destination:h,destinationContextKey:w,methods:t.methods};else if(s.preserveApiRoutes)throw new Error(`Rewrite destination "${t.destination}" does not exist.`)}}const I=new Set;for(const t of S){if(l.some(o=>o.test(t)))continue;E=!0;const n=h(t,s,b,K);if(n.specificity<0)continue;let c={type:n.isApi?'api':n.isLayout?'layout':'route',loadRoute(){let n;if(s.ignoreRequireErrors)try{n=o(t)}catch{n={}}else n=o(t);return'lazy'!==u&&'lazy-once'!==u||(n='_result'in n&&null!=n._result?n._result:n),n},contextKey:t,route:'',dynamic:null,children:[]};if(n.isRedirect){if(I.has(n.route))continue;const t=b[n.route];c.destinationContextKey=t.destinationContextKey,c.permanent=t.permanent,c.generated=!0,'route'===c.type&&(c=s.getSystemRoute({type:'redirect',route:t.destination,defaults:c,redirectConfig:t})),t.methods&&(c.methods=t.methods),c.type='redirect',I.add(n.route)}if(n.isRewrite){if(I.has(n.route))continue;const t=K[n.route];c.destinationContextKey=t.destinationContextKey,c.generated=!0,'route'===c.type&&(c=s.getSystemRoute({type:'rewrite',route:t.destination,defaults:c,rewriteConfig:t})),t.methods&&(c.methods=t.methods),c.type='rewrite',I.add(n.route)}for(const t of w(n.route)){const o=t.split('/').slice(0,-1);let s=y;for(const t of o){let o=s.subdirectories.get(t);o||(o={files:new Map,subdirectories:new Map},s.subdirectories.set(t,o)),s=o}if(c={...c,route:t},n.isLayout){s.layout??=[];s.layout[n.specificity]||(c=$(c),s.layout[n.specificity]=c)}else if(n.isApi){const o=`${t}+api`;let n=s.files.get(o);n||(n=[],s.files.set(o,n));n[0]||(n[0]=c)}else{let o=s.files.get(t);o||(o=[],s.files.set(t,o));o[n.specificity]||(R||=!0,o[n.specificity]=c)}}}return E?(y.layout||(y.layout=[s.getSystemRoute({type:'layout',route:''})]),s.skipGenerated||(R&&!1!==s.sitemap&&x(y,s),!1!==s.notFound&&v(y,s)),y):null}function c(o){return(0,t.removeFileSystemExtensions)((0,t.removeFileSystemDots)(o)).replace(/^\//,'')}function f(o){return(0,t.stripInvisibleSegmentsFromPath)(c(o))}function p(t){const o=c(t);return`./${o}${/\.[tj]sx?$/.test(o)?'':'.js'}`}function y(t,o,n,s=""){if(t.layout){const u=n;n=S(t.layout),u&&u.children.push(n),o.internal_stripLoadRoute&&delete n.loadRoute;const l=n.route.replace(s,'');s=n.route?`${n.route}/`:'',n.route=l,n.dynamic=R(n.contextKey.slice(0))}if(!n)throw new Error('Expo Router Internal Error: No nearest layout');for(const u of t.files.values()){const t=S(u);t.route=t.route.replace(s,''),t.dynamic=R(t.route),o.internal_stripLoadRoute&&delete t.loadRoute,n.children.push(t)}for(const u of t.subdirectories.values())y(u,o,n,s);return n}function h(o,n,s,u){const l=(0,t.removeSupportedExtensions)((0,t.removeFileSystemDots)(o));let c=l;const f=(0,t.removeFileSystemDots)(o).split('/'),p=f[f.length-1],y=(0,t.removeSupportedExtensions)(p),h=(0,t.getPlatformFromFilePath)(p),w=h?y.slice(0,-(h.length+1)):y,R='_layout'===w,x=o.match(/\+api\.(\w+\.)?[jt]sx?$/);if(w.startsWith('(')&&w.endsWith(')'))throw new Error(`Invalid route ${o}. Routes cannot end with '(group)' syntax`);if(!x&&p.startsWith('+')&&'+not-found'!==w){const t=[...f.slice(0,-1),p.slice(1)].join('/');throw new Error(`Invalid route ${o}. Route nodes cannot start with the '+' character. "Rename it to ${t}"`)}let v=0;const $=null!=h,E=n.platformRoutes??!0;if($){if(E&&n.platform?h===n.platform?v=2:'native'===h&&'web'!==n.platform?v=1:h!==n.platform&&(v=-1):v=-1,x&&0!==v)throw new Error(`API routes cannot have platform extensions. Remove '.${h}' from '${o}'`);c=c.slice(0,-(h.length+1))}return{route:c,specificity:v,isLayout:R,isApi:x,isRedirect:l in s,isRewrite:l in u}}function w(o,n=new Set){const s=(0,t.matchArrayGroupName)(o);if(!s)return n.add(o),n;const u=s.split(',');if(new Set(u).size!==u.length)throw new Error(`Array syntax cannot contain duplicate group name "${u}" in "${o}".`);if(1===u.length)return n.add(o),n;for(const t of u)w(o.replace(s,t.trim()),n);return n}function R(o){const n=o.split('/').map(o=>'+not-found'===o?{name:'+not-found',deep:!0,notFound:!0}:(0,t.matchDynamicName)(o)??null).filter(t=>!!t);return 0===n.length?null:n}function x(t,o){!t.files.has('_sitemap')&&o.getSystemRoute&&t.files.set('_sitemap',[o.getSystemRoute({type:'route',route:'_sitemap'})])}function v(t,o){!t.files.has('+not-found')&&o.getSystemRoute&&t.files.set('+not-found',[o.getSystemRoute({type:'route',route:'+not-found'})])}function $(o){return{...o,route:o.route.replace(/\/?_layout$/,''),children:[],groupName:(0,t.matchLastGroupName)(o.route)}}function E(t,n,s=[]){if('route'===t.type)t.entryPoints=[...new Set([...s,t.contextKey])];else if('redirect'===t.type)t.entryPoints=[...new Set([...s,t.destinationContextKey])];else if('layout'===t.type){if(!t.children)throw new Error(`Layout "${t.contextKey}" does not contain any child routes`);if(s=[...s,t.contextKey],!n.internal_stripLoadRoute)for(let n=(0,o.getValidInitialRoute)(t);n;n=(0,o.getValidInitialRoute)(n))s.push(n.contextKey);for(const o of t.children)E(o,n,s)}}function S(t){const o=t[t.length-1];if(!t[0])throw new Error(`The file ${o.contextKey} does not have a fallback sibling file without a platform extension.`);return o}},693,[389,406,355]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}function n(){const t=j(r(d[1]));return n=function(){return t},t}function o(){const t=r(d[2]);return o=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get DefaultNavigator(){return _},get Navigator(){return b},get NavigatorContext(){return O},get Slot(){return w},get useNavigatorContext(){return N}});const u=r(d[3]),c=r(d[4]),s=r(d[5]),l=r(d[6]),f=r(d[7]),y=r(d[8]),v=r(d[9]),p=r(d[10]),x=r(d[11]);function h(t){if("function"!=typeof WeakMap)return null;var n=new WeakMap,o=new WeakMap;return(h=function(t){return t?o:n})(t)}function j(t,n){if(!n&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var o=h(n);if(o&&o.has(t))return o.get(t);var u={__proto__:null},c=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if("default"!==s&&Object.prototype.hasOwnProperty.call(t,s)){var l=c?Object.getOwnPropertyDescriptor(t,s):null;l&&(l.get||l.set)?Object.defineProperty(u,s,l):u[s]=t[s]}return u.default=t,o&&o.set(t,u),u}const O=n().createContext(null);function b({screenOptions:n,children:o,activityEnabled:v,activityDefaultThreshold:h=2,router:j,routerOptions:b,unstable_screenErrorBoundary:N}){const S=(0,u.useContextKey)(),w=(0,u.useRouteNode)(),{screens:C,children:_,guardedRedirects:P}=(0,l.useFilterScreenChildren)(o,{isCustomNavigator:!0,contextKey:S}),R=(0,p.useSortedScreens)(C??[],P);j||=s.StackRouter;const k=(0,f.useNavigationBuilder)(j,{...b,id:S,children:R||[(0,t().jsx)(x.Screen,{},"default")],activityEnabled:v,screenOptions:n,initialRouteName:(0,y.getValidInitialRouteName)(w)},{activityDefaultThreshold:h});if(!R.length)return console.warn(`Navigator at "${S}" has no children.`),null;const D=(0,t().jsx)(c.GuardContextProvider,{node:w,guardedRedirects:P,children:_});return(0,t().jsx)(O.Provider,{value:{...k,contextKey:S,router:j},children:N?(0,t().jsx)(u.ScreenErrorBoundaryContext,{value:N,children:D}):D})}function N(){const t=n().use(O);if(!t)throw new Error('useNavigatorContext must be used within a ');return t}const S=(0,v.createStandardRouterNavigator)(function({state:t,descriptors:n}){const o=t.routes[t.index]?.key;return o?n[o]?.render()??null:null},s.StackRouter,{activityDefaultThreshold:1});function w(o){const c=(0,u.useContextKey)(),s=n().use(O);return s?.contextKey!==c?(0,t().jsx)(S,{...o}):(0,t().jsx)(C,{})}function C(){const t=N(),{state:n,descriptors:o}=t,u=n.routes[n.index]?.key;return u?o[u]?.render()??null:null}function _(){return(0,t().jsx)(o().SafeAreaView,{style:{flex:1},children:(0,t().jsx)(S,{})})}b.Slot=C,b.useContext=N,b.Screen=x.Screen},694,[24,30,289,403,535,695,712,427,406,711,534,719]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}function n(){const t=r(d[1]);return n=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get StackRouter(){return f.StackRouter},get default(){return v},get stackRouterOverride(){return f.stackRouterOverride}});const o=r(d[2]),c=r(d[3]),s=r(d[4]),u=r(d[5]),p=r(d[6]),l=r(d[7]),S=r(d[8]),f=r(d[9]),O=r(d[10]),k=(0,u.integrateWithRouter)(o.createStandardNativeStackNavigator,f.StackRouter,{activityDefaultThreshold:2,createProps:S.createNativeStackProps});function h(t,n){return t&&'function'==typeof t?o=>{const c=t(o);return n(o.route)?{...c,animation:'none'}:c??{}}:o=>n(o.route)?{...t??{},animation:'none'}:t??{}}function P(t){return!!(0,s.getInternalExpoRouterParams)(t.params)[s.INTERNAL_EXPO_ROUTER_NO_ANIMATION_PARAM_NAME]}const v=Object.assign(o=>{const{isStackAnimationDisabled:s}=(0,c.useLinkPreviewContext)(),l=(0,n().useMemo)(()=>{const t=n().Children.toArray(o.children).find(t=>(0,p.isChildOfType)(t,O.StackHeader));if(t){const n={children:t},c=o.screenOptions;return c?'function'==typeof c?(...t)=>{const o=c(...t);return(0,O.appendScreenStackPropsToOptions)(o,n)}:(0,O.appendScreenStackPropsToOptions)(c,n):(0,O.appendScreenStackPropsToOptions)({},n)}if(o.screenOptions){const t=o.screenOptions;return(0,O.validateStackPresentation)(t)}return o.screenOptions},[o.screenOptions,o.children]),S=(0,n().useMemo)(()=>h(l,s?()=>!0:P),[l,s]),f=(0,n().useMemo)(()=>(0,O.mapProtectedScreen)({guard:!0,children:o.children}).children,[o.children]);return(0,t().jsx)(u.IsWithinNativeNavigator,{value:!0,children:(0,t().jsx)(k,{...o,children:f,screenOptions:S})})},{Screen:O.StackScreen,Protected:l.Protected,Header:O.StackHeader,SearchBar:O.StackSearchBar,Title:O.StackTitle,Toolbar:O.StackToolbar})},695,[24,30,696,676,391,711,520,718,724,727,728]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}function n(){const t=r(d[1]);return n=function(){return t},t}function o(){const t=P(r(d[2]));return o=function(){return t},t}function s(){const t=r(d[3]);return s=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"createStandardNativeStackNavigator",{enumerable:!0,get:function(){return O}});const u=r(d[4]),c=r(d[5]),l=r(d[6]),f=r(d[7]),p=r(d[8]),v=r(d[9]);function b(t){if("function"!=typeof WeakMap)return null;var n=new WeakMap,o=new WeakMap;return(b=function(t){return t?o:n})(t)}function P(t,n){if(!n&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var o=b(n);if(o&&o.has(t))return o.get(t);var s={__proto__:null},u=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var c in t)if("default"!==c&&Object.prototype.hasOwnProperty.call(t,c)){var l=u?Object.getOwnPropertyDescriptor(t,c):null;l&&(l.get||l.set)?Object.defineProperty(s,c,l):s[c]=t[c]}return s.default=t,o&&o.set(t,s),s}const _=(0,n().isLiquidGlassAvailable)();const O=(0,s().createStandardNavigator)(function({state:n,descriptors:s,emitter:b,isPreloaded:P,isRemovalPrevented:O,pop:y,removeRoutes:j,subscribePopToTopOnParentTabPress:h,unstable_nativeProps:E}){const S=s,{computedState:T,emit:w,isPreloaded:M}=(0,v.usePreviewTransition)(n,b.emit,P);(0,u.useClearGuardedRoutes)(j),o().useEffect(()=>h(),[h]);const N=o().useMemo(()=>{let t=!1;const n={};for(const o of Object.keys(S)){const s=S[o],u=s.options,l=u?.[c.INTERNAL_EXPO_ROUTER_GESTURE_ENABLED_OPTION_NAME],f=void 0!==l,p=_&&'formSheet'===u?.presentation;if(f||p){t=!0;const c={...u};f&&(c.gestureEnabled=l),p&&(c.headerTransparent??=!0,c.contentStyle??={backgroundColor:'transparent'},c.headerShadowVisible??=!1,c.headerLargeTitleShadowVisible??=!1),n[o]={...s,options:c}}else n[o]=s}return t?n:S},[S]),{registry:R,contextValue:k}=(0,f.useCompositionRegistry)(),x=o().useMemo(()=>(0,f.mergeOptions)(N,R,T),[N,T,R]),C=o().useMemo(()=>{const t=T.routes.map(t=>t.key).filter(M);if(0===t.length)return x;const n={...x};for(const o of t){const t=n[o];t&&(n[o]={...t,options:{...t.options,animation:'none'}})}return n},[x,T,M]);return(0,t().jsx)(p.DescriptorsContext,{value:S,children:(0,t().jsx)(f.CompositionContext,{value:k,children:(0,t().jsx)(l.NativeStackView,{state:T,descriptors:C,emit:w,isPreloaded:M,isRemovalPrevented:O,pop:y,unstable_nativeProps:E})})})})},696,[24,697,30,653,702,391,703,529,709,710]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"GlassView",{enumerable:!0,get:function(){return t.default}}),Object.defineProperty(_e,"GlassContainer",{enumerable:!0,get:function(){return n.default}}),Object.defineProperty(_e,"isLiquidGlassAvailable",{enumerable:!0,get:function(){return l.isLiquidGlassAvailable}}),Object.defineProperty(_e,"isGlassEffectAPIAvailable",{enumerable:!0,get:function(){return u.isGlassEffectAPIAvailable}});var t=e(r(d[0])),n=e(r(d[1])),l=r(d[2]),u=r(d[3])},697,[698,699,700,701]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return f}});var e,t=r(d[0]),u=r(d[1]),n=(e=u)&&e.__esModule?e:{default:e};function f(e){return(0,t.jsx)(n.default,{...e})}},698,[24,127]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return f}});var e,t=r(d[0]),u=r(d[1]),n=(e=u)&&e.__esModule?e:{default:e};function f(e){return(0,t.jsx)(n.default,{...e})}},699,[24,127]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.isLiquidGlassAvailable=function(){return!1}},700,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.isGlassEffectAPIAvailable=function(){return!1}},701,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"useClearGuardedRoutes",{enumerable:!0,get:function(){return u}});const n=r(d[1]);function u(u){const o=(0,t().use)(n.GuardContext),c=(0,t().useEffectEvent)(u);(0,t().useEffect)(()=>{if(!o?.size)return;const t=Array.from(o.keys()).flatMap(t=>{const u=(0,n.normalizeRouteName)(t);return[u,`${u}/index`]});c(t)},[o])}},702,[30,535]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var c in n)Object.defineProperty(t,c,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,c).get})})(e,{get NativeStackView(){return n.NativeStackView},get createNativeStackNavigator(){return t.createNativeStackNavigator},get useAnimatedHeaderHeight(){return c.useAnimatedHeaderHeight}});const t=r(d[0]),n=r(d[1]),c=r(d[2])},703,[704,706,707]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(){const t=r(d[0]);return e=function(){return t},t}function t(){const e=f(r(d[1]));return t=function(){return e},e}Object.defineProperty(_e,"__esModule",{value:!0}),Object.defineProperty(_e,"createNativeStackNavigator",{enumerable:!0,get:function(){return l}});const n=r(d[2]),o=r(d[3]),u=r(d[4]),c=r(d[5]);function s(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(s=function(e){return e?n:t})(e)}function f(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=s(t);if(n&&n.has(e))return n.get(e);var o={__proto__:null},u=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var c in e)if("default"!==c&&Object.prototype.hasOwnProperty.call(e,c)){var f=u?Object.getOwnPropertyDescriptor(e,c):null;f&&(f.get||f.set)?Object.defineProperty(o,c,f):o[c]=e[c]}return o.default=e,n&&n.set(e,o),o}function p({id:s,initialRouteName:f,children:p,layout:l,screenListeners:y,screenOptions:v,screenLayout:P,UNSTABLE_router:k,...O}){const{state:_,descriptors:b,navigation:N,NavigationContent:j}=(0,o.useNavigationBuilder)(o.StackRouter,{id:s,initialRouteName:f,children:p,layout:l,screenListeners:y,screenOptions:v,screenLayout:P,UNSTABLE_router:k}),h=(0,t().use)(o.NavigationMetaContext),L=(0,n.useRoutesWithRemovalPrevented)();t().useEffect(()=>{if(!h||!('type'in h)||'native-tabs'!==h.type)return N?.addListener?.('tabPress',e=>{const t=N.isFocused();requestAnimationFrame(()=>{_.index>0&&t&&!e.defaultPrevented&&N.dispatch({...o.StackActions.popToTop(),target:_.key})})})},[h,N,_.index,_.key]);const S=(0,u.makePopAction)(N.dispatchSync,_.key);return(0,e().jsx)(j,{children:(0,e().jsx)(c.NativeStackView,{...O,state:_,descriptors:b,emit:N.emit,isPreloaded:e=>!0===_.routes.find(t=>t.key===e)?.isPreloaded,isRemovalPrevented:e=>L.has(e),pop:S})})}function l(){return(0,o.createNavigatorFactory)(p)()}},704,[24,30,392,427,705,706]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"makePopAction",{enumerable:!0,get:function(){return n}});const t=r(d[0]);function n(n,o){return(c,u)=>{n({...t.StackActions.pop(c),source:u,target:o})}}},705,[427]); +__d(function(g,r,_i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}function n(){const t=f(r(d[1]));return n=function(){return t},t}function o(){const t=r(d[2]);return o=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"NativeStackView",{enumerable:!0,get:function(){return h}});const i=r(d[3]),l=r(d[4]),u=r(d[5]),c=r(d[6]);function s(t){if("function"!=typeof WeakMap)return null;var n=new WeakMap,o=new WeakMap;return(s=function(t){return t?o:n})(t)}function f(t,n){if(!n&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var o=s(n);if(o&&o.has(t))return o.get(t);var i={__proto__:null},l=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var u in t)if("default"!==u&&Object.prototype.hasOwnProperty.call(t,u)){var c=l?Object.getOwnPropertyDescriptor(t,u):null;c&&(c.get||c.set)?Object.defineProperty(i,u,c):i[u]=t[u]}return i.default=t,o&&o.set(t,i),i}const p=['transparentModal','containedTransparentModal'];function h({state:u,descriptors:s,isPreloaded:f,isRemovalPrevented:h}){const v=(0,n().use)(i.HeaderBackContext),{buildHref:b}=(0,l.useLinkBuilder)(),j=u.routes.filter(t=>!f(t.key));return(0,t().jsx)(i.SafeAreaProviderCompat,{children:u.routes.map((n,l)=>{const h=u.index===l,x=j.findIndex(t=>t.key===n.key),P=x>0?j[x-1]?.key:void 0,H=x>=0?j[x+1]?.key:void 0,S=P?s[P]:void 0,w=H?s[H]:void 0,{options:C,navigation:O,render:_}=s[n.key],B=S?{title:(0,i.getHeaderTitle)(S.options,S.route.name),href:b(S.route.name,S.route.params)}:v,M=null!=B,{header:T,headerShown:I,headerBackIcon:V,headerBackImageSource:A,headerLeft:L,headerTransparent:W,headerBackTitle:D,presentation:z,contentStyle:E,...F}=C,N=(0,c.getPlatformHeaderTransparent)(W),R=w?.options.presentation,q=f(n.key);return(0,t().jsx)(i.Screen,{focused:h,route:n,navigation:O,headerShown:I,headerTransparent:N,header:void 0!==T?T({back:B,options:C,route:n,navigation:O}):(0,t().jsx)(i.Header,{...F,back:B,title:(0,i.getHeaderTitle)(C,n.name),headerLeft:'function'==typeof L?({label:t,...n})=>L({...n,label:D??t}):void 0===L&&M?({tintColor:n,label:l,...u})=>(0,t().jsx)(i.HeaderBackButton,{...u,label:D??l,tintColor:n,backImage:void 0!==V||void 0!==A?()=>(0,t().jsx)(o().Image,{source:V?.source??A,resizeMode:"contain",tintColor:n,style:k.backImage}):void 0,onPress:O.goBack}):L,headerTransparent:N}),style:[o().StyleSheet.absoluteFill,{display:(h||null!=R&&p.includes(R))&&!q?'flex':'none'},null!=z&&p.includes(z)?{backgroundColor:'transparent'}:null],children:(0,t().jsx)(i.HeaderBackContext.Provider,{value:B,children:(0,t().jsx)(y,{children:(0,t().jsx)(o().View,{style:[k.contentContainer,E],children:_()})})})},n.key)})})}const y=({children:l})=>{const c=(0,i.useHeaderHeight)(),[s]=n().useState(()=>new(o().Animated.Value)(c));return n().useEffect(()=>{s.setValue(c)},[s,c]),(0,t().jsx)(u.AnimatedHeaderHeightContext.Provider,{value:s,children:l})},k=o().StyleSheet.create({contentContainer:{flex:1},backImage:{height:24,width:24,margin:3}})},706,[24,30,33,550,427,707,708]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=o(r(d[0]));return t=function(){return n},n}function n(t){if("function"!=typeof WeakMap)return null;var o=new WeakMap,u=new WeakMap;return(n=function(t){return t?u:o})(t)}function o(t,o){if(!o&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var u=n(o);if(u&&u.has(t))return u.get(t);var c={__proto__:null},f=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var p in t)if("default"!==p&&Object.prototype.hasOwnProperty.call(t,p)){var s=f?Object.getOwnPropertyDescriptor(t,p):null;s&&(s.get||s.set)?Object.defineProperty(c,p,s):c[p]=t[p]}return c.default=t,u&&u.set(t,c),c}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get AnimatedHeaderHeightContext(){return u},get useAnimatedHeaderHeight(){return c}});const u=t().createContext(void 0);function c(){const n=t().useContext(u);if(void 0===n)throw new Error("Couldn't find the header height. Are you inside a screen in a native stack navigator?");return n}},707,[30]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var c in n)Object.defineProperty(t,c,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,c).get})})(e,{get enableLegacyHeaderAppearance(){return c},get getPlatformHeaderTransparent(){return u},get isLegacyHeaderAppearanceEnabled(){return o}});let n=!1;function c(){n=!0}function o(){return n}function u(n){return'object'==typeof n?t().Platform.select(n):n}},708,[33]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"DescriptorsContext",{enumerable:!0,get:function(){return n}});const n=(0,t().createContext)({})},709,[30]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=u(r(d[0]));return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"usePreviewTransition",{enumerable:!0,get:function(){return s}});const n=r(d[1]);function o(t){if("function"!=typeof WeakMap)return null;var n=new WeakMap,u=new WeakMap;return(o=function(t){return t?u:n})(t)}function u(t,n){if(!n&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var u=o(n);if(u&&u.has(t))return u.get(t);var s={__proto__:null},c=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var f in t)if("default"!==f&&Object.prototype.hasOwnProperty.call(t,f)){var l=c?Object.getOwnPropertyDescriptor(t,f):null;l&&(l.get||l.set)?Object.defineProperty(s,f,l):s[f]=t[f]}return s.default=t,u&&u.set(t,s),s}function s(o,u,s){const{getOpenPreviewKey:c,setOpenPreviewKey:f}=(0,n.useLinkPreviewContext)(),[l,p]=t().useState();t().useEffect(()=>{if(l){const t=o.routes.findIndex(t=>t.key===l);t>=0&&t<=o.index&&p(void 0)}},[o,l]);const y=t().useCallback(t=>{const{target:n,type:o,data:s}=t,l=c();return void 0!==l&&n===l&&s&&'closing'in s&&!s.closing&&('transitionStart'===o?p(l):'transitionEnd'===o&&f(void 0)),u(t)},[c,u,f]),v=t().useMemo(()=>{if(l){const t=o.routes.findIndex(t=>t.key===l);if(t>o.index){const n=o.routes[t];if(t===o.index+1)return{...o,index:o.index+1};const u=o.routes.filter(t=>t.key!==l);return u.splice(o.index+1,0,n),{...o,routes:u,index:o.index+1}}}return o},[o,l]),x=t().useCallback(t=>v.routes[v.index]?.key!==t&&s(t),[v,s]);return{computedState:v,emit:y,isPreloaded:x}}},710,[30,676]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}function n(){const t=r(d[1]);return n=function(){return t},t}function o(){const t=r(d[2]);return o=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get IsWithinNativeNavigator(){return y.IsWithinNativeNavigator},get createStandardRouterNavigator(){return b},get integrateWithRouter(){return w},get unstable_createStandardRouterNavigator(){return P},get unstable_integrateWithRouter(){return R}});const s=r(d[3]),u=r(d[4]),c=r(d[5]),v=r(d[6]),l=r(d[7]),h=r(d[8]),p=r(d[9]),f=r(d[10]),y=r(d[11]),N=1,S='standard';function b(t,n,...s){return w((0,o().createStandardNavigator)(t),n,...s)}function w(o,y,...[N]){C(o);const{NavigatorContent:S}=o;return(0,c.withLayoutContext)(function(o){const{unstable_screenErrorBoundary:c,...b}=o,w=b,P=(0,s.useRouteNode)(),{extraProps:R,useNavigationBuilderProps:C}=x(w,(0,l.getValidInitialRouteName)(P)),{state:E,navigation:_,describe:j,descriptors:k,NavigationContent:B}=(0,v.useNavigationBuilder)(y,C,{activityDefaultThreshold:N?.activityDefaultThreshold}),{dispatch:L,dispatchSync:O}=_,T=(0,u.useRoutesWithRemovalPrevented)(),W=(0,n().useMemo)(()=>N?.processDescriptors?.(k,E,j)??k,[E,k,j,N]),D=(0,n().useMemo)(()=>N?.processState?.(E,W,j)??E,[E,W,j,N]),I=(0,n().useMemo)(()=>N?.createProps?.({state:D,dispatch:L,dispatchSync:O,navigation:_,isPreloaded:t=>!0===D.routes.find(n=>n.key===t)?.isPreloaded,isRemovalPrevented:t=>T.has(t)})??{},[D,L,O,_,N,T]),M={state:(0,f.useStandardState)(D),descriptors:W,actions:(0,h.useStandardActions)(_,E.key),emitter:(0,p.useStandardEmitter)(_)},A=(0,t().jsx)(B,{children:(0,t().jsx)(S,{...R,...I,...M})});return c?(0,t().jsx)(s.ScreenErrorBoundaryContext,{value:c,children:A}):A},N?.processScreens)}const P=b,R=w;function x(t,n){const{id:o,children:s,activityEnabled:u,initialRouteName:c,layout:v,ref:l,screenLayout:h,screenListeners:p,screenOptions:f,UNSTABLE_router:y,...N}=t,S={id:o,children:s,activityEnabled:u,initialRouteName:n,layout:v,screenLayout:h,screenListeners:p,screenOptions:f,UNSTABLE_router:y};return{extraProps:N,useNavigationBuilderProps:{...N,...S}}}function C(t){if(null==t)throw new Error("Could not integrate a standard navigator because no navigator was provided. Pass the object returned by `createStandardNavigator(...)` from the `standard-navigation` package, or use `createStandardRouterNavigator(NavigatorContent, router)` which creates it for you.");const{type:n,version:o}=t;if(n!==S)throw new Error(`Could not integrate a standard navigator because its \`type\` is ${JSON.stringify(n)}, not "standard". This value is likely not a standard-navigation navigator. Create it with \`createStandardNavigator(...)\` from the \`standard-navigation\` package, or use \`createStandardRouterNavigator(NavigatorContent, router)\`.`);o!==N&&console.warn(`This standard navigator targets the standard-navigation v${o} contract, but this version of expo-router was built against v${N}. Integration may still work, but if you hit unexpected navigation behavior, align the installed \`standard-navigation\` version with your expo-router version, or check the standard-navigation release notes for migration steps.`)}},711,[24,30,653,403,392,712,427,406,720,721,722,723]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}function n(){const t=r(d[1]);return n=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get useFilterScreenChildren(){return f},get withLayoutContext(){return h}});const o=r(d[2]),s=r(d[3]),c=r(d[4]),u=r(d[5]),p=r(d[6]),l=r(d[7]);function f(t,{isCustomNavigator:o,contextKey:c}={}){return(0,n().useMemo)(()=>{const l=[],f=[],h=new Map;function y(t,v=!1,S){if((0,p.isScreen)(t,c))return f.push(t.props),void(v&&h.set(t.props.name,S));if((0,s.isNativeTabTrigger)(t,c)){const n=(0,s.convertTabPropsToOptions)(t.props);return f.push({...t.props,options:v?{...n,hidden:!0}:n}),void(v&&h.set(t.props.name,S))}if((0,u.isProtectedReactElement)(t)){const o=!t.props.guard,s=v||o,c=o?t.props.redirectTo:S;return void n().Children.forEach(t.props.children,t=>{y(t,s,c)})}return o?(l.push(t),null):(console.warn(`Layout children must be of type Screen, all other children are ignored. To use custom children, create a custom . Update Layout Route at: "app${c}/_layout"`),null)}return n().Children.forEach(t,t=>y(t)),{screens:f,children:l,guardedRedirects:h}},[t])}function h(s,h){return Object.assign((0,n().forwardRef)(({children:n,...u},p)=>{const y=(0,o.useContextKey)(),v=(0,o.useRouteNode)(),{screens:S,guardedRedirects:b}=f(n,{contextKey:y}),w=void 0,x=h?h(S??[]):S;if(w&&x){const t=x.map(({name:t})=>t);if(t.length!==w.size||new Set(t).size!==w.size||!t.every(t=>w.has(t)))throw new Error(`\`processScreens\` must not add, remove, rename, or duplicate screens. Received: ${JSON.stringify(t)}. Expected: ${JSON.stringify([...w])}.`)}const O=(0,c.useSortedScreens)(x??[],b);return O.length?(0,t().jsx)(l.GuardContextProvider,{node:v,guardedRedirects:b,children:(0,t().jsx)(s,{...u,id:y,ref:p,children:O})}):null}),{Screen:p.Screen,Protected:u.Protected})}},712,[24,30,403,713,534,718,719,535]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const o=r(d[0]);return t=function(){return o},o}function o(){const t=r(d[1]);return o=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,o){for(var n in o)Object.defineProperty(t,n,{enumerable:!0,get:Object.getOwnPropertyDescriptor(o,n).get})})(e,{get NativeTabTrigger(){return T},get convertTabPropsToOptions(){return v},get isNativeTabTrigger(){return y}});const n=r(d[2]),l=r(d[3]),s=r(d[4]),c=r(d[5]),b=r(d[6]),u=r(d[7]),p=r(d[8]);const T=Object.assign(function(o){const b=(0,s.useRoute)(),u=(0,s.useNavigation)(),p=(0,n.useIsPreview)(),T=(0,t().use)(l.NavigatorTypeContext);return(0,c.useFocusEffect)((0,t().useCallback)(()=>{if(!p){if('tab'!==T)throw new Error(`Trigger component can only be used in the tab screen. Current route: ${b.name}`);const t=v(o,!0);u.setOptions(t)}},[o,p,T])),null},{Label:u.NativeTabsTriggerLabel,Icon:u.NativeTabsTriggerIcon,Badge:u.NativeTabsTriggerBadge,VectorIcon:u.NativeTabsTriggerVectorIcon});function v({hidden:t,children:o,role:n,prominent:l,disableAutomaticSearchActivation:s,disablePopToTop:c,disableScrollToTop:T,unstable_nativeProps:v,disableAutomaticContentInsets:y,contentStyle:I,disableTransparentOnScrollEdge:C,disabled:S,rippleColor:O,indicatorColor:N,disableIndicator:A,labelVisibilityMode:B,testID:L,accessibilityLabel:P},w=!1){const E=w?{...v?{nativeProps:v}:{},...void 0!==C?{disableTransparentOnScrollEdge:C}:{},...void 0!==s?{disableAutomaticSearchActivation:s}:{},...void 0!==S?{disabled:S}:{},...void 0!==O?{rippleColor:O}:{},...void 0!==N?{indicatorColor:N}:{},...void 0!==A?{disableIndicator:A}:{},...void 0!==B?{labelVisibilityMode:B}:{},...void 0!==L?{tabBarItemTestID:L}:{},...void 0!==P?{tabBarItemAccessibilityLabel:P}:{}}:{hidden:!!t,specialEffects:{repeatedTabSelection:{popToRoot:!c,scrollToTop:!T}},contentStyle:I,role:n,...void 0!==l?{prominent:l}:{},nativeProps:v,disableAutomaticContentInsets:y,...void 0!==C?{disableTransparentOnScrollEdge:C}:{},...void 0!==s?{disableAutomaticSearchActivation:s}:{},...void 0!==S?{disabled:S}:{},...void 0!==O?{rippleColor:O}:{},...void 0!==N?{indicatorColor:N}:{},...void 0!==A?{disableIndicator:A}:{},...void 0!==B?{labelVisibilityMode:B}:{},...void 0!==L?{tabBarItemTestID:L}:{},...void 0!==P?{tabBarItemAccessibilityLabel:P}:{}};return(0,b.filterAllowedChildrenElements)(o,[u.NativeTabsTriggerBadge,u.NativeTabsTriggerLabel,u.NativeTabsTriggerIcon]).reduce((t,o)=>((0,b.isChildOfType)(o,u.NativeTabsTriggerBadge)?f(t,o.props):(0,b.isChildOfType)(o,u.NativeTabsTriggerLabel)?h(t,o.props):(0,b.isChildOfType)(o,u.NativeTabsTriggerIcon)&&(0,p.appendIconOptions)(t,o.props),t),{...E})}function f(t,o){o.children?(t.badgeValue=String(o.children),t.selectedBadgeBackgroundColor=o.selectedBackgroundColor):o.hidden||(t.badgeValue=' ')}function h(t,n){n.hidden?t.title='':(t.title=n.children,n.selectedStyle&&(t.selectedLabelStyle=o().StyleSheet.flatten(n.selectedStyle)))}function y(t,o){if((0,b.isChildOfType)(t,T)){if('name'in t.props&&!t.props.name)throw new Error(` component in \`default export\` at \`app${o}/_layout\` must have a \`name\` prop when used as a child of a Layout Route.`);return!0}return!1}},713,[30,33,421,431,427,537,520,714,715]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get NativeTabsBottomAccessory(){return b},get NativeTabsTriggerBadge(){return s},get NativeTabsTriggerIcon(){return o},get NativeTabsTriggerLabel(){return n},get NativeTabsTriggerPromiseIcon(){return u},get NativeTabsTriggerVectorIcon(){return c}});const t=r(d[0]),n=t.Label,o=t.Icon,c=t.VectorIcon,u=function(t){return null},s=t.Badge,b=()=>null},714,[524]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),(function(n,t){for(var o in t)Object.defineProperty(n,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(t,o).get})})(e,{get appendIconOptions(){return t},get convertOptionsIconToScreensPropsIcon(){return o},get resolveIconRenderingMode(){return c}});const n=r(d[0]);function t(t,o){'src'in o&&o.src&&(0,n.applyIconSrcOptions)(t,o),(0,n.applySelectedColor)(t,o.selectedColor)}function o(n,t){}function c(n,t){}},715,[716]); +__d(function(g,r,i,a,m,e,d){"use strict";function n(){const t=r(d[0]);return n=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),(function(n,t){for(var c in t)Object.defineProperty(n,c,{enumerable:!0,get:Object.getOwnPropertyDescriptor(t,c).get})})(e,{get applyIconSrcOptions(){return c},get applySelectedColor(){return o}});const t=r(d[1]);function c(n,t){const c=s(t);n.icon=c?.icon,n.selectedIcon=c?.selectedIcon}function o(n,t){t&&(n.selectedIconColor=t)}function s(n){if(n&&n.src){const{defaultIcon:t,selected:c}='object'==typeof n.src&&'selected'in n.src?{defaultIcon:n.src.default,selected:n.src.selected}:{defaultIcon:n.src},o={};return o.icon=u(t,{renderingMode:n.renderingMode}),o.selectedIcon=u(c,{renderingMode:n.renderingMode}),o}}function u(c,o){if(c)return(0,n().isValidElement)(c)?(0,t.convertComponentSrcToImageSource)(c,o.renderingMode):{src:c,renderingMode:o.renderingMode}}},716,[30,717]); +__d(function(g,r,i,a,m,e,d){"use strict";function n(){const t=r(d[0]);return n=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),(function(n,t){for(var o in t)Object.defineProperty(n,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(t,o).get})})(e,{get convertComponentSrcToImageSource(){return f},get convertIconColorPropToObject(){return c},get useAwaitedScreensIcon(){return s}});const t=r(d[1]),o=r(d[2]);function c(n){return n?'object'==typeof n&&('default'in n||'selected'in n)?n:{default:n}:{}}function s(t){const o=t&&'object'==typeof t&&'src'in t?t.src:void 0,c=t&&'object'==typeof t&&'renderingMode'in t?t.renderingMode:void 0,[s,f]=(0,n().useState)(void 0);return(0,n().useEffect)(()=>{(async()=>{if(o&&o instanceof Promise){const n=await o;n&&f({src:n})}})()},[o]),(0,n().useMemo)(()=>{const n=u(t)?t:s;return n&&c&&'src'in n?{...n,renderingMode:c}:n},[s,t,c])}function u(n){return!n||!('src'in n&&n.src instanceof Promise)}function f(n,c){let s;if((0,t.isChildOfType)(n,o.NativeTabsTriggerVectorIcon)){const t=n.props;s={src:t.family.getImageSource(t.name,24,'white')}}else{if(!(0,t.isChildOfType)(n,o.NativeTabsTriggerPromiseIcon))return void console.warn('Only VectorIcon is supported as a React element in Icon.src');s={src:n.props.loader()}}return c&&(s={...s,renderingMode:c}),s}},717,[30,520,714]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get Protected(){return o},get isProtectedReactElement(){return u}});const n=r(d[1]),o=n.Group;function u(o){return Boolean((0,t().isValidElement)(o)&&o.type===n.Group&&o.props&&'guard'in o.props)}},718,[30,524]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get Screen(){return u},get isScreen(){return p}});const n=r(d[1]),o=r(d[2]);function u({name:t,options:u}){if(t)throw new Error("The name prop on the Screen component may only be used when it is inside a Layout route");const p=(0,n.useNavigation)();return(0,o.useSafeLayoutEffect)(()=>{u&&Object.keys(u).length&&p.setOptions(u)},[p,u]),null}function p(n,o){if((0,t().isValidElement)(n)&&n&&n.type===u){if('object'==typeof n.props&&n.props&&'name'in n.props&&!n.props.name)throw new Error(` component in \`default export\` at \`app${o}/_layout\` must have a \`name\` prop when used as a child of a Layout Route.`);return!0}return!1}},719,[30,533,532]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}function n(n,u){return(0,t().useMemo)(()=>({back:()=>{n.dispatch({type:'GO_BACK',target:u})},navigate:(t,c)=>{n.dispatch({type:'NAVIGATE',payload:{name:t,params:c},target:u})}}),[n,u])}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"useStandardActions",{enumerable:!0,get:function(){return n}})},720,[30]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}function n(n){return(0,t().useMemo)(()=>({emit(t){const u=n.emit(t),f={type:t.type,data:t.data,target:t.target};return'defaultPrevented'in u?Object.defineProperties(f,{defaultPrevented:{enumerable:!0,get:()=>u.defaultPrevented},preventDefault:{enumerable:!0,value:u.preventDefault}}):f}}),[n])}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"useStandardEmitter",{enumerable:!0,get:function(){return n}})},721,[30]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"useStandardState",{enumerable:!0,get:function(){return u}});const n=r(d[1]);function u(u){const s=(0,n.useBuildHref)();return(0,t().useMemo)(()=>({index:u.index,routes:u.routes.map(t=>({href:s(t),key:t.key,name:t.name,params:t.params,path:t.path,state:t.state}))}),[u,s])}},722,[30,660]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"IsWithinNativeNavigator",{enumerable:!0,get:function(){return n}});const n=(0,t().createContext)(!1)},723,[30]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"createNativeStackProps",{enumerable:!0,get:function(){return o}});const t=r(d[0]);function o(o){return{...(0,t.createBaseStackProps)(o),removeRoutes:t=>o.dispatch({type:'REMOVE_ROUTES',payload:{routeNames:t}})}}},724,[725]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"createBaseStackProps",{enumerable:!0,get:function(){return o}});const t=r(d[0]),n=r(d[1]);function o({dispatchSync:o,isPreloaded:s,isRemovalPrevented:c,navigation:P,state:p}){return{isPreloaded:s,isRemovalPrevented:c,pop:(0,t.makePopAction)(o,p.key),subscribePopToTopOnParentTabPress:()=>(0,n.subscribePopToTopOnParentTabPress)(P,p)}}},725,[705,726]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"subscribePopToTopOnParentTabPress",{enumerable:!0,get:function(){return n}});const t=r(d[0]);function n(n,s){return n.addListener?.('tabPress',o=>{const c=n.isFocused();requestAnimationFrame(()=>{s.index>0&&c&&!o.defaultPrevented&&'native'!==o.data?.__internalTabsType&&n.dispatch({...t.StackActions.popToTop(),target:s.key})})})}},726,[427]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),(function(t,r){for(var n in r)Object.defineProperty(t,n,{enumerable:!0,get:Object.getOwnPropertyDescriptor(r,n).get})})(e,{get StackRouter(){return E},get stackRouterOverride(){return f}});const t=_r(d[0]),r=_r(d[1]),n=_r(d[2]),o=_r(d[3]),s=_r(d[4]),p=_r(d[5]),u=_r(d[6]),y=_r(d[7]);function c(t){return'PUSH'===t.type||'NAVIGATE'===t.type||'POP'===t.type||'POP_TO_TOP'===t.type||'REPLACE'===t.type||'PRELOAD'===t.type}const l=t=>{const r=t.payload;return r&&'__internal__PreviewKey'in r&&'string'==typeof r.__internal__PreviewKey?r.__internal__PreviewKey:void 0},_=r=>{const n=r.payload&&'params'in r.payload&&'object'==typeof r.payload.params?r.payload.params:void 0,o=(0,t.getInternalExpoRouterParams)(n??void 0)[t.INTERNAL_EXPO_ROUTER_ZOOM_TRANSITION_SOURCE_ID_PARAM_NAME];if(o&&'string'==typeof o)return o},f=f=>({getStateForAction:(E,I,O)=>{if(E=(0,s.ensureStateType)(E,'stack'),I.target&&I.target!==E.key)return r.RouterActionHandling.Unhandled;if(!c(I))return f.getStateForAction(E,I,O);const N=I.payload&&'singular'in I.payload?I.payload.singular:void 0;switch(I.type){case'PUSH':case'NAVIGATE':{if(!E.routeNames.includes(I.payload.name))return r.RouterActionHandling.Unhandled;const s=(function(){if(!('payload'in I)||!I.payload||!('name'in I.payload)||'string'!=typeof I.payload.name)return;const t=I.payload.name;return A(N,t)||O.routeGetIdList[t]})(),c=s?.({params:I.payload.params}),S=E.routes.slice(0,E.index+1),P=E.routes.slice(E.index+1),T=l(I),h=P.find(t=>t.key===T&&t.name===I.payload.name),x=S[E.index],k='NAVIGATE'===I.type&&!h&&void 0===c&&x.name===I.payload.name&&(0,y.getSingularId)(x.name,{params:x.params})!==(0,y.getSingularId)(I.payload.name,{params:I.payload.params}),v={...O.routeGetIdList};let M;if(s&&(v[I.payload.name]=s),h){const r=(0,o.attachRouteState)({...h,path:('NAVIGATE'===I.type?I.payload.path:void 0)??h.path,params:{...'NAVIGATE'===I.type&&I.payload.merge?h.params:{},...I.payload.params,[t.INTERNAL_EXPO_ROUTER_IS_PREVIEW_NAVIGATION_PARAM_NAME]:!0}},I);M={state:{...E,index:S.length,routes:S.concat(r,P.filter(t=>t.key!==T))},affectedRouteKey:r.key}}else if(k){const t=(0,p.createRouteKeyMinter)(E),r=I.payload.merge?{...x.params,...I.payload.params}:I.payload.params,n=(0,o.attachRouteState)({key:t.mint(I.payload.name),name:x.name,path:I.payload.path??x.path,params:r},I);M={state:{...E,routeKeySeq:t.routeKeySeq,index:S.length,routes:S.concat(n,P)},affectedRouteKey:n.key,browserHistory:{type:'push'}}}else M=f.getStateForAction(E,I,{...O,routeGetIdList:v});if(!(0,u.isActionHandled)(M))return M;const K=M.affectedRouteKey,H=M.state;if(N){const t=R(H,s);return{...M,state:t,browserHistory:(0,n.getStackBrowserHistoryAction)(E,t,I)}}if(_(I)){const r=H.routes[H.index],n={...r,params:{...r.params,[t.INTERNAL_EXPO_ROUTER_ZOOM_TRANSITION_SCREEN_ID_PARAM_NAME]:K}};return{...M,state:{...H,routes:H.routes.map((t,r)=>r===H.index?n:t)},affectedRouteKey:K}}return M}case'PRELOAD':{if(!E.routeNames.includes(I.payload.name))return r.RouterActionHandling.Unhandled;const n=f.getStateForAction(E,I,O);if(!(0,u.isActionHandled)(n))return n;const o=n.affectedRouteKey,s=n.state.routes.findIndex(t=>t.key===o),p=_(I);let y=n.state.routes;if(s>E.index+1){const t=y[s];y=y.toSpliced(s,1).toSpliced(E.index+1,0,t)}return p&&(y=y.map(r=>r.key===o?{...r,params:{...r.params,[t.INTERNAL_EXPO_ROUTER_ZOOM_TRANSITION_SCREEN_ID_PARAM_NAME]:o}}:r)),{...n,state:y===n.state.routes?n.state:{...n.state,routes:y},affectedRouteKey:o}}default:return f.getStateForAction(E,I,O)}}});function A(t,r){return'function'==typeof t?n=>t(r,n.params??{}):!0===t?t=>(0,y.getSingularId)(r,t):void 0}function R(t,r){if(!t)return t;if(!t.routes)return t;const n=t.index??t.routes.length-1,o=t.routes.slice(0,n+1),s=t.routes.slice(n+1),p=o[n],u=p.name,y=r?.({params:p.params});if(!y)return t;let c=o;return c=c.filter((t,o)=>o===n||(u!==t.name||y!==r?.({params:t.params}))),{...t,index:c.length-1,routes:[...c,...s]}}const E=(0,r.extendRouter)(r.StackRouter,({baseRouter:t})=>f(t))},727,[391,427,374,367,364,365,366,506]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var c in n)Object.defineProperty(t,c,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,c).get})})(e,{get StackHeader(){return u},get StackScreen(){return o.StackScreen},get StackSearchBar(){return n.StackSearchBar},get StackTitle(){return c.StackTitle},get appendScreenStackPropsToOptions(){return o.appendScreenStackPropsToOptions},get appendStackTitlePropsToOptions(){return c.appendStackTitlePropsToOptions},get mapProtectedScreen(){return p.mapProtectedScreen},get validateStackPresentation(){return o.validateStackPresentation}});const t=r(d[0]),n=r(d[1]);S(r(d[2]),e),S(r(d[3]),e);const c=r(d[4]),o=r(d[5]),p=r(d[6]);function S(t,n){return Object.keys(t).forEach(function(c){"default"===c||Object.prototype.hasOwnProperty.call(n,c)||Object.defineProperty(n,c,{enumerable:!0,get:function(){return t[c]}})}),t}const u=t.StackHeaderComponent},728,[729,730,731,750,752,755,756]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}function n(){const t=r(d[1]);return n=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get StackHeaderComponent(){return l},get appendStackHeaderPropsToOptions(){return c}});const o=r(d[2]);function l({children:n,hidden:l,asChild:s,transparent:u,blurEffect:h,style:f,largeStyle:p}){const b=(0,t().useMemo)(()=>c({},{children:n,hidden:l,asChild:s,transparent:u,blurEffect:h,style:f,largeStyle:p}),[n,l,s,u,h,f,p]);return(0,o.useCompositionOption)(b),null}function c(t,o){const l=n().StyleSheet.flatten(o.style),c=n().StyleSheet.flatten(o.largeStyle);if(o.hidden)return{...t,headerShown:!1};if(o.asChild)return{...t,header:()=>o.children};o.children&&!o.asChild&&console.warn("To render a custom header, set the 'asChild' prop to true on Stack.Header.");const s='transparent'===l?.backgroundColor,u=void 0!==o.blurEffect,h=!0===o.transparent||!1!==o.transparent&&(s||u);return o.blurEffect&&!1===o.transparent&&console.warn("Stack.Header: 'blurEffect' requires 'transparent' to be enabled."),{...t,headerShown:!o.hidden,headerBlurEffect:o.blurEffect,...h&&{headerTransparent:!0},...!1===o.transparent&&{headerTransparent:!1},...l?.color&&{headerTintColor:l.color},headerStyle:{backgroundColor:l?.backgroundColor},headerLargeStyle:{backgroundColor:c?.backgroundColor},...'transparent'===l?.shadowColor&&{headerShadowVisible:!1},...'transparent'===c?.shadowColor&&{headerLargeTitleShadowVisible:!1}}}},729,[30,33,529]); +__d(function(g,r,i,a,m,e,d){"use strict";function o(){const n=r(d[0]);return o=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),(function(o,n){for(var t in n)Object.defineProperty(o,t,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,t).get})})(e,{get StackSearchBar(){return t},get appendStackSearchBarPropsToOptions(){return c}});const n=r(d[1]);function t({ref:t,autoCapitalize:l,autoFocus:u,barTintColor:s,tintColor:h,cancelButtonText:p,disableBackButtonOverride:B,hideNavigationBar:C,hideWhenScrolling:S,inputType:T,obscureBackground:b,onBlur:f,onCancelButtonPress:O,onChangeText:x,onClose:P,onFocus:k,onOpen:v,onSearchButtonPress:w,placeholder:I,placement:y,allowToolbarIntegration:F,textColor:_,hintTextColor:j,headerIconColor:z,shouldShowHintSearchIcon:H}){const M=(0,o().useMemo)(()=>c({},{ref:t,autoCapitalize:l,autoFocus:u,barTintColor:s,tintColor:h,cancelButtonText:p,disableBackButtonOverride:B,hideNavigationBar:C,hideWhenScrolling:S,inputType:T,obscureBackground:b,onBlur:f,onCancelButtonPress:O,onChangeText:x,onClose:P,onFocus:k,onOpen:v,onSearchButtonPress:w,placeholder:I,placement:y,allowToolbarIntegration:F,textColor:_,hintTextColor:j,headerIconColor:z,shouldShowHintSearchIcon:H}),[t,l,u,s,h,p,B,C,S,T,b,f,O,x,P,k,v,w,I,y,F,_,j,z,H]);return(0,n.useCompositionOption)(M),null}function c(o,n){return{...o,headerShown:!0,headerSearchBarOptions:{...n}}}},730,[30,529]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),(function(t,o){for(var c in o)Object.defineProperty(t,c,{enumerable:!0,get:Object.getOwnPropertyDescriptor(o,c).get})})(e,{get StackToolbar(){return o.StackToolbar},get StackToolbarBadge(){return t.StackToolbarBadge},get StackToolbarButton(){return n.StackToolbarButton},get StackToolbarIcon(){return t.StackToolbarIcon},get StackToolbarLabel(){return t.StackToolbarLabel},get StackToolbarMenu(){return l.StackToolbarMenu},get StackToolbarMenuAction(){return l.StackToolbarMenuAction},get StackToolbarSearchBarSlot(){return b.StackToolbarSearchBarSlot},get StackToolbarSpacer(){return S.StackToolbarSpacer},get StackToolbarView(){return T.StackToolbarView},get appendStackToolbarPropsToOptions(){return c.appendStackToolbarPropsToOptions}});const t=r(d[0]),o=r(d[1]),c=r(d[2]),n=r(d[3]),l=r(d[4]),b=r(d[5]),S=r(d[6]),T=r(d[7])},731,[732,733,739,734,741,743,745,747]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),(function(t,o){for(var n in o)Object.defineProperty(t,n,{enumerable:!0,get:Object.getOwnPropertyDescriptor(o,n).get})})(e,{get StackToolbarBadge(){return c},get StackToolbarIcon(){return n},get StackToolbarLabel(){return o}});const t=r(d[0]),o=t.Label,n=t.Icon,c=t.Badge},732,[524]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"StackToolbar",{enumerable:!0,get:function(){return o.default}});const t=r(d[0]),o=S(r(d[1])),l=r(d[2]),u=r(d[3]),c=r(d[4]),n=r(d[5]),f=r(d[6]);function S(t){return t&&t.__esModule?t:{default:t}}o.default.Button=t.StackToolbarButton,o.default.Menu=l.StackToolbarMenu,o.default.MenuAction=l.StackToolbarMenuAction,o.default.SearchBarSlot=u.StackToolbarSearchBarSlot,o.default.Spacer=c.StackToolbarSpacer,o.default.View=n.StackToolbarView,o.default.Label=f.StackToolbarLabel,o.default.Icon=f.StackToolbarIcon,o.default.Badge=f.StackToolbarBadge},733,[734,739,741,743,745,747,732]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const o=r(d[0]);return t=function(){return o},o}function o(){const t=r(d[1]);return o=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,o){for(var n in o)Object.defineProperty(t,n,{enumerable:!0,get:Object.getOwnPropertyDescriptor(o,n).get})})(e,{get StackToolbarButton(){return b},get convertStackToolbarButtonPropsToRNHeaderItem(){return f}});const n=r(d[2]),c=r(d[3]),s=r(d[4]),u=r(d[5]),l=r(d[6]),b=u=>{const b=(0,c.useToolbarPlacement)();(0,o().useMemo)(()=>(0,n.filterAllowedChildrenElements)(u.children,S),[u.children]);if(null==b)throw new Error('Stack.Toolbar.Button must be used inside a Stack.Toolbar');const f=(0,s.convertStackHeaderSharedPropsToRNSharedHeaderItem)(u,!0),T='sfSymbol'===f?.icon?.type?f.icon.name:void 0,p='image'===f?.icon?.type?f.icon.source:void 0,h=(0,s.extractXcassetName)(u),k=(0,s.extractIconRenderingMode)(u)??u.iconRenderingMode;return(0,t().jsx)(l.NativeToolbarButton,{...f,icon:T,source:p,xcassetName:h,image:u.image,imageRenderingMode:k})};function f(t){if(!t.hidden)return{...(0,s.convertStackHeaderSharedPropsToRNSharedHeaderItem)(t),type:'button',onPress:t.onPress??(()=>{}),selected:!!t.selected}}const S=[u.StackToolbarLabel,u.StackToolbarIcon,u.StackToolbarBadge]},734,[24,30,520,735,736,732,738]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get ToolbarColorContext(){return u},get ToolbarPlacementContext(){return n},get useToolbarColors(){return c},get useToolbarPlacement(){return o}});const n=(0,t().createContext)(null);function o(){return(0,t().useContext)(n)}const u=(0,t().createContext)({});function c(){return(0,t().useContext)(u)}},735,[30]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get areAllChildrenPrimitiveValues(){return f},get convertChildrenToString(){return p},get convertStackHeaderSharedPropsToRNSharedHeaderItem(){return y},get extractIconRenderingMode(){return l},get extractXcassetName(){return s}});const n=r(d[1]),o=r(d[2]),c=r(d[3]);function s(t){const o=(0,n.getFirstChildOfType)(t.children,c.StackToolbarIcon)?.props;if(o&&'xcasset'in o)return o.xcasset}function l(t){const o=(0,n.getFirstChildOfType)(t.children,c.StackToolbarIcon)?.props;if(o&&'renderingMode'in o)return o.renderingMode}const u=['string','number'];function f(n){const o=t().Children.toArray(n);return o.filter(t=>u.includes(typeof t)).length===o.length}function p(n){return t().Children.toArray(n).filter(t=>u.includes(typeof t)).join('')}function y(t,s=!1){const{children:l,style:u,separateBackground:f,icon:y,...h}=t,T=p(l),b=(0,n.getFirstChildOfType)(l,c.StackToolbarLabel),S=t.icon?'string'==typeof t.icon?{sf:t.icon}:{src:t.icon}:void 0,x=(0,n.getFirstChildOfType)(l,c.StackToolbarIcon)?.props??S,v=(0,n.getFirstChildOfType)(l,c.StackToolbarBadge),C=(()=>{if(x){if('xcasset'in x&&s)return{type:'xcasset',name:x.xcasset};if('src'in x||'xcasset'in x){return{type:'image',source:'src'in x?x.src:{uri:x.xcasset},tinted:'template'===(('renderingMode'in x?x.renderingMode:void 0)??t.iconRenderingMode??(t.tintColor?'template':'original'))}}return{type:'sfSymbol',name:x.sf}}})(),O={...h,label:b?.props.children??T,sharesBackground:!f};if(u){const t=(0,o.convertTextStyleToRNTextStyle)(u)??{};O.labelStyle=t}if(v){O.badge={value:v.props.children??''};const t=(0,o.convertTextStyleToRNTextStyle)(v.props.style);t&&(O.badge.style=t)}return C&&(O.icon=C),O}},736,[30,520,737,732]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}function n(n){const o=t().StyleSheet.flatten(n);if(o)return'fontWeight'in o?{...o,fontWeight:'number'==typeof o.fontWeight?String(o.fontWeight):o.fontWeight}:o}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get convertFontWeightToComposeFontWeight(){return u},get convertTextStyleToRNTextStyle(){return n}});const o=new Set(['100','200','300','400','500','600','700','800','900','normal','bold']);function u(t){if(null==t)return;const n=String(t);return o.has(n)?n:void 0}},737,[33]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"NativeToolbarButton",{enumerable:!0,get:function(){return t}});const t=()=>null},738,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function o(){const t=r(d[0]);return o=function(){return t},t}function t(){const o=r(d[1]);return t=function(){return o},o}Object.defineProperty(e,"__esModule",{value:!0}),(function(o,t){for(var n in t)Object.defineProperty(o,n,{enumerable:!0,get:Object.getOwnPropertyDescriptor(t,n).get})})(e,{get StackToolbar(){return p},get appendStackToolbarPropsToOptions(){return v},get default(){return x}});const n=r(d[2]),l=r(d[3]),c=r(d[4]),u=r(d[5]),b=r(d[6]),s=r(d[7]),h=r(d[8]),C=r(d[9]),k=r(d[10]),S=r(d[11]),f=r(d[12]),p=n=>{if((0,k.useToolbarPlacement)())throw new Error("Stack.Toolbar cannot be nested inside another Stack.Toolbar.");return'bottom'!==n.placement&&n.placement?(0,t().createElement)(P,{...n,key:n.placement}):(0,o().jsx)(T,{...n})},T=({children:n,disableImePadding:u,tintColor:b,backgroundColor:s})=>{const h=(0,t().useMemo)(()=>({tintColor:b,backgroundColor:s}),[b,s]);return(0,o().jsx)(k.ToolbarPlacementContext.Provider,{value:"bottom",children:(0,o().jsx)(k.ToolbarColorContext.Provider,{value:h,children:(0,o().jsx)(l.NativeMenuContext,{value:!0,children:(0,o().jsx)(c.RouterToolbarHost,{withImePadding:!u,backgroundColor:s,children:n})})})})},P=({children:o,placement:l,asChild:c,disableImePadding:u,tintColor:b,backgroundColor:s})=>{if('left'!==l&&'right'!==l)throw new Error(`Invalid placement "${l}" for Stack.Toolbar. Expected "left" or "right".`);const h=(0,t().useMemo)(()=>v({},{children:o,placement:l,asChild:c,disableImePadding:u,tintColor:b,backgroundColor:s}),[o,l,c,u,b,s]);return(0,n.useCompositionOption)(h),null};function v(t,n){const{children:l,placement:c="bottom",asChild:u}=n;if('bottom'===c)return t;const b={tintColor:n.tintColor,backgroundColor:n.backgroundColor};if(u){const n=(0,o().jsx)(k.ToolbarColorContext.Provider,{value:b,children:l});return'left'===c?{...t,headerShown:!0,headerLeft:()=>n}:{...t,headerShown:!0,headerRight:()=>n}}return{...t,...(0,S.processHeaderItemsForPlatform)(l,c,b)??{}}}p.Button=u.StackToolbarButton,p.Menu=b.StackToolbarMenu,p.MenuAction=b.StackToolbarMenuAction,p.SearchBarSlot=s.StackToolbarSearchBarSlot,p.Spacer=h.StackToolbarSpacer,p.View=C.StackToolbarView,p.Label=f.StackToolbarLabel,p.Icon=f.StackToolbarIcon,p.Badge=f.StackToolbarBadge;const x=p},739,[24,30,529,522,740,734,741,743,745,747,735,749,732]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(t){return null}function n(t){return null}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get RouterToolbarHost(){return t},get RouterToolbarItem(){return n}})},740,[]); +__d(function(g,r,_i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}function n(){const t=r(d[1]);return n=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get StackToolbarMenu(){return p},get StackToolbarMenuAction(){return T},get convertStackToolbarMenuActionPropsToRNHeaderItem(){return h},get convertStackToolbarMenuPropsToRNHeaderItem(){return b}});const o=r(d[2]),i=r(d[3]),c=r(d[4]),l=r(d[5]),s=r(d[6]);function u(t,n){const i=(0,o.getFirstChildOfType)(t,l.StackToolbarLabel),c=i?.props.children;return{label:c??n??'',menuTitle:n??''}}const p=l=>{if(null==(0,i.useToolbarPlacement)())throw new Error('Stack.Toolbar.Menu must be used inside a Stack.Toolbar');const p=(0,n().useMemo)(()=>(0,o.filterAllowedChildrenElements)(l.children,v),[l.children]),b=(0,c.convertStackHeaderSharedPropsToRNSharedHeaderItem)(l,!0),{label:f,menuTitle:T}=u(l.children,l.title),h='sfSymbol'===b?.icon?.type?b.icon.name:void 0,S='image'===b?.icon?.type?b.icon.source:void 0,y=(0,c.extractXcassetName)(l),M=(0,c.extractIconRenderingMode)(l)??l.iconRenderingMode;return(0,t().jsx)(s.NativeToolbarMenu,{...l,icon:h,source:S,xcassetName:y,image:l.image,imageRenderingMode:M,label:f,title:T,badge:b?.badge,children:p})};function b(t,i=!1){if(t.hidden)return;const{title:l,...s}=t,b=n().Children.toArray(t.children).filter(t=>(0,o.isChildOfType)(t,T)||(0,o.isChildOfType)(t,p)),{label:v,menuTitle:S}=u(t.children,l),y={...(0,c.convertStackHeaderSharedPropsToRNSharedHeaderItem)(s,i),label:v,type:'menu',menu:{multiselectable:!0,items:b.map(t=>(0,o.isChildOfType)(t,p)?f(t.props):h(t.props)).filter(t=>!!t)}};return S&&(y.menu.title=S),y}function f(t){if(t.hidden)return;const i=(0,c.convertStackHeaderSharedPropsToRNSharedHeaderItem)(t),l={type:'submenu',items:n().Children.toArray(t.children).filter(t=>(0,o.isChildOfType)(t,T)||(0,o.isChildOfType)(t,p)).map(t=>(0,o.isChildOfType)(t,p)?f(t.props):h(t.props)).filter(t=>!!t),label:i.label||t.title||'',multiselectable:!0};return void 0!==t.inline&&(l.inline=t.inline),void 0!==t.palette&&(l.layout=t.palette?'palette':'default'),void 0!==t.destructive&&(l.destructive=t.destructive),i.icon&&(l.icon=i.icon),l}const T=n=>{(0,i.useToolbarPlacement)();const o='string'==typeof n.icon?n.icon:void 0,c='string'!=typeof n.icon?n.icon:void 0;return(0,t().jsx)(s.NativeToolbarMenuAction,{...n,icon:o,source:c,image:n.image,imageRenderingMode:n.iconRenderingMode})};function h(t){const{children:n,isOn:o,unstable_keepPresented:i,icon:l,...s}=t,u=(0,c.convertStackHeaderSharedPropsToRNSharedHeaderItem)(t),p={...s,description:t.subtitle,type:'action',label:u.label,state:o?'on':'off',onPress:t.onPress??(()=>{})};return void 0!==i&&(p.keepsMenuPresented=i),u.icon&&(p.icon=u.icon),p}const v=[p,T,s.NativeToolbarMenu,s.NativeToolbarMenuAction,l.StackToolbarLabel,l.StackToolbarIcon,l.StackToolbarBadge]},741,[24,30,520,735,736,732,742]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get NativeToolbarMenu(){return t},get NativeToolbarMenuAction(){return n}});const t=()=>null,n=()=>null},742,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const o=r(d[0]);return t=function(){return o},o}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"StackToolbarSearchBarSlot",{enumerable:!0,get:function(){return c}});const o=r(d[1]),n=r(d[2]),c=c=>{if('bottom'!==(0,o.useToolbarPlacement)())throw new Error('Stack.Toolbar.SearchBarSlot must be used inside a Stack.Toolbar');return(0,t().jsx)(n.NativeToolbarSearchBarSlot,{...c})}},743,[24,735,744]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"NativeToolbarSearchBarSlot",{enumerable:!0,get:function(){return t}});const t=()=>null},744,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get StackToolbarSpacer(){return c},get convertStackToolbarSpacerPropsToRNHeaderItem(){return u}});const n=r(d[1]),o=r(d[2]),c=c=>{if(null==(0,n.useToolbarPlacement)())throw new Error('Stack.Toolbar.Spacer must be used inside a Stack.Toolbar');return(0,t().jsx)(o.NativeToolbarSpacer,{...c,hidesSharedBackground:!c.sharesBackground})};function u(t){const{hidden:n,width:o}=t;if(!n&&void 0!==o)return{type:'spacing',spacing:o??0}}},745,[24,735,746]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"NativeToolbarSpacer",{enumerable:!0,get:function(){return t}});const t=()=>null},746,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get StackToolbarView(){return c},get convertStackToolbarViewPropsToRNHeaderItem(){return u}});const n=r(d[1]),o=r(d[2]),c=c=>{if(null==(0,n.useToolbarPlacement)())throw new Error('Stack.Toolbar.View must be used inside a Stack.Toolbar');return(0,t().jsx)(o.NativeToolbarView,{...c,children:c.children})};function u(n){if(n.hidden)return;const{children:o,hidesSharedBackground:c}=n;o||console.warn('Stack.Toolbar.View requires a child element to render custom content in the toolbar.');return{type:'custom',element:o||(0,t().jsx)(t().Fragment,{}),hidesSharedBackground:c}}},747,[24,735,748]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"NativeToolbarView",{enumerable:!0,get:function(){return t}});const t=()=>null},748,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(t,n,u){return null}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"processHeaderItemsForPlatform",{enumerable:!0,get:function(){return t}})},749,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var c in n)Object.defineProperty(t,c,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,c).get})})(e,{get StackScreenBackButton(){return n.StackScreenBackButton},get StackScreenTitle(){return t.StackScreenTitle},get appendStackScreenBackButtonPropsToOptions(){return n.appendStackScreenBackButtonPropsToOptions},get appendStackScreenTitlePropsToOptions(){return t.appendStackScreenTitlePropsToOptions}});const t=r(d[0]),n=r(d[1])},750,[751,754]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get StackScreenTitle(){return n},get appendStackScreenTitlePropsToOptions(){return o}});const t=r(d[0]),n=t.StackTitle,o=t.appendStackTitlePropsToOptions},751,[752]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}function n(){const t=r(d[1]);return n=function(){return t},t}function l(){const t=r(d[2]);return l=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var l in n)Object.defineProperty(t,l,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,l).get})})(e,{get StackTitle(){return u},get appendStackTitlePropsToOptions(){return s}});const o=r(d[3]),c=r(d[4]),h=r(d[5]);function u({children:t,asChild:l,style:c,largeStyle:h,large:u}){const f=(0,n().useMemo)(()=>s({},{children:t,asChild:l,style:c,largeStyle:h,large:u}),[t,l,c,h,u]);return(0,o.useCompositionOption)(f),null}function s(n,o){const u=l().StyleSheet.flatten(o.style),s=l().StyleSheet.flatten(o.largeStyle);let f=o.asChild?{headerTitle:()=>(0,t().jsx)(t().Fragment,{children:o.children})}:{title:(0,h.convertChildrenToString)(o.children)};return o.asChild&&'string'==typeof o.children&&(f={}),o.asChild||null==o.children||(0,h.areAllChildrenPrimitiveValues)(o.children)||(f={}),{...n,...f,headerLargeTitle:o.large,...void 0!==u?.textAlign?{headerTitleAlign:u.textAlign}:{},headerTitleStyle:{...u,...u?.fontWeight?{fontWeight:(0,c.convertFontWeightToStringFontWeight)(u?.fontWeight)}:{}},headerLargeTitleStyle:{...s,...s?.fontWeight?{fontWeight:(0,c.convertFontWeightToStringFontWeight)(s?.fontWeight)}:{}}}}},752,[24,30,33,529,753,736]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(t){return'number'==typeof t?String(t):t}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"convertFontWeightToStringFontWeight",{enumerable:!0,get:function(){return t}})},753,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var c in n)Object.defineProperty(t,c,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,c).get})})(e,{get StackScreenBackButton(){return c},get appendStackScreenBackButtonPropsToOptions(){return o}});const n=r(d[1]);function c({children:c,style:u,withMenu:s,displayMode:l,hidden:h,src:p}){const B=(0,t().useMemo)(()=>o({},{children:c,style:u,withMenu:s,displayMode:l,hidden:h,src:p}),[c,u,s,l,h,p]);return(0,n.useCompositionOption)(B),null}function o(t,n){return{...t,headerBackTitle:n.children,headerBackTitleStyle:n.style,headerBackImageSource:n.src,headerBackButtonDisplayMode:n.displayMode,headerBackButtonMenuEnabled:n.withMenu,headerBackVisible:!n.hidden}}},754,[30,529]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}function n(){const t=r(d[1]);return n=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get StackScreen(){return f},get appendScreenStackPropsToOptions(){return T},get validateStackPresentation(){return k}});const o=r(d[2]),c=r(d[3]),p=r(d[4]),s=r(d[5]),u=r(d[6]),l=r(d[7]),f=Object.assign(function({children:o,options:p,...s}){const u=(0,n().useMemo)(()=>k('function'==typeof p?{}:p??{}),[p]);return(0,t().jsxs)(t().Fragment,{children:[(0,t().jsx)(c.Screen,{...s,options:u}),o]})},{Title:s.StackTitle,BackButton:u.StackScreenBackButton}),S=['card','modal','transparentModal','containedModal','containedTransparentModal','fullScreenModal','formSheet','pageSheet'];function k(t){if('function'==typeof t)return(...n)=>{const o=t(...n);return k(o),o};const n=t.presentation;if(n&&!S.includes(n))throw new Error(`Invalid presentation value "${n}" passed to Stack.Screen. Valid values are: ${S.map(t=>`"${t}"`).join(', ')}.`);return t}function T(t,c){let f={...t,...c.options};function S(t,n){if((0,o.isChildOfType)(t,p.StackHeaderComponent))return(0,p.appendStackHeaderPropsToOptions)(n,t.props);if((0,o.isChildOfType)(t,s.StackTitle))return(0,s.appendStackTitlePropsToOptions)(n,t.props);if((0,o.isChildOfType)(t,u.StackScreenBackButton))return(0,u.appendStackScreenBackButtonPropsToOptions)(n,t.props);if((0,o.isChildOfType)(t,l.StackToolbar)){if('bottom'===(t.props.placement??'bottom'))throw new Error("Stack.Toolbar with placement=\"bottom\" cannot be used inside Stack.Screen.");return(0,l.appendStackToolbarPropsToOptions)(n,t.props)}const c='function'==typeof t.type?t.type.name||'Unknown':String(t.type);return console.warn(`Unknown child element passed to Stack.Screen: ${c}`),n}return k(f),n().Children.forEach(c.children,t=>{(0,n().isValidElement)(t)&&(f=S(t,f))}),f}},755,[24,30,520,719,729,752,750,731]); +__d(function(g,r,i,a,m,e,d){"use strict";function n(){const t=r(d[0]);return n=function(){return t},t}function t(){const n=s(r(d[1]));return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"mapProtectedScreen",{enumerable:!0,get:function(){return y}});const o=r(d[2]),c=r(d[3]),u=r(d[4]),p=r(d[5]),l=r(d[6]);function f(n){if("function"!=typeof WeakMap)return null;var t=new WeakMap,o=new WeakMap;return(f=function(n){return n?o:t})(n)}function s(n,t){if(!t&&n&&n.__esModule)return n;if(null===n||"object"!=typeof n&&"function"!=typeof n)return{default:n};var o=f(t);if(o&&o.has(n))return o.get(n);var c={__proto__:null},u=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var p in n)if("default"!==p&&Object.prototype.hasOwnProperty.call(n,p)){var l=u?Object.getOwnPropertyDescriptor(n,p):null;l&&(l.get||l.set)?Object.defineProperty(c,p,l):c[p]=n[p]}return c.default=n,o&&o.set(n,c),c}function y(f){return{...f,children:t().Children.toArray(f.children).map((s,O)=>{if((0,o.isChildOfType)(s,l.StackScreen)){const{children:t,options:o,...c}=s.props,p='function'==typeof o?(...n)=>(0,l.appendScreenStackPropsToOptions)(o(...n),{children:t}):(0,l.appendScreenStackPropsToOptions)(o??{},{children:t});return(0,n().jsx)(u.Screen,{...c,options:p},c.name)}return(0,o.isChildOfType)(s,c.Protected)?(0,n().jsx)(c.Protected,{...y(s.props)},`${O}-${f.guard}`):((0,o.isChildOfType)(s,p.StackHeaderComponent)||(t().default.isValidElement(s)?console.warn(`Unknown child element passed to Stack: ${s.type}`):console.warn(`Unknown child element passed to Stack: ${s}`)),null)}).filter(Boolean)}}},756,[24,30,520,718,719,729,755]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}function n(){const t=x(r(d[1]));return n=function(){return t},t}function o(){const t=x(r(d[2]));return o=function(){return t},t}function l(){const t=r(d[3]);return l=function(){return t},t}function s(){const t=r(d[4]);return s=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get Sitemap(){return p},get getNavOptions(){return y}});const c=r(d[5]),u=r(d[6]),f=r(d[7]),h=r(d[8]);function x(t){return t&&t.__esModule?t:{default:t}}function y(){return{title:'sitemap',presentation:'modal',headerLargeTitle:!1,headerTitleStyle:{color:'white'},headerShown:!0,headerTintColor:'white',headerLargeTitleStyle:{color:'white'},headerStyle:{backgroundColor:'black',borderBottomColor:'#323232'},header:()=>{const n='android'===l().Platform.OS?s().SafeAreaView:l().View;return(0,t().jsx)(n,{style:T.header,children:(0,t().jsxs)(l().View,{style:T.headerContent,children:[(0,t().jsx)(l().View,{style:T.headerIcon,children:(0,t().jsx)(k,{})}),(0,t().jsx)(l().Text,{role:"heading","aria-level":1,style:T.title,children:"Sitemap"})]})})}}}const p=()=>(0,t().jsx)(u.NoSSR,{children:(0,t().jsx)(j,{})});function j(){const n=(0,h.useSitemap)(),c=o().default.useMemo(()=>n?.children.filter(({isInternal:t})=>!t)??[],[n]),u='android'===l().Platform.OS?s().SafeAreaView:l().View;return(0,t().jsx)(u,{style:T.container,testID:"expo-router-sitemap",children:(0,t().jsxs)(l().ScrollView,{contentContainerStyle:T.scroll,automaticallyAdjustContentInsets:!0,contentInsetAdjustmentBehavior:"automatic",children:[c.map(n=>(0,t().jsx)(l().View,{testID:"sitemap-item-container",style:T.itemContainer,children:(0,t().jsx)(b,{node:n})},n.contextKey)),(0,t().jsx)(P,{})]})})}function b({node:n,level:l=0}){const s=o().default.useMemo(()=>n.children.length>0||n.contextKey.match(/_layout\.[jt]sx?$/),[n]),c=n.isGenerated?'Generated':'';return s?(0,t().jsx)(w,{node:n,level:l,info:c}):(0,t().jsx)(I,{node:n,level:l,info:c})}function w({node:n,level:s,info:c}){const[u,f]=o().default.useState(!0);return(0,t().jsxs)(l().View,{style:T.itemInnerContainer,children:[(0,t().jsx)(C,{style:{opacity:.4},leftIcon:(0,t().jsx)(V,{}),rightIcon:(0,t().jsx)(z,{rotation:u?0:180}),filename:n.filename,level:s,info:c,onPress:()=>f(t=>!t)}),!u&&n.children.map(o=>(0,t().jsx)(b,{node:o,level:s+(n.isGenerated?0:1)},o.contextKey))]})}function I({node:n,info:o,level:l}){return(0,t().jsx)(c.Link,{accessibilityLabel:n.contextKey,href:n.href,asChild:!0,replace:!0,children:(0,t().jsx)(C,{leftIcon:(0,t().jsx)(S,{}),rightIcon:(0,t().jsx)(v,{}),filename:n.filename,level:l,info:o})})}function C({style:n,leftIcon:o,rightIcon:s,filename:c,level:u,info:h,...x}){return(0,t().jsx)(f.Pressable,{...x,children:({pressed:f,hovered:x})=>(0,t().jsxs)(l().View,{testID:"sitemap-item",style:[T.itemInnerContainer,T.itemPressable,{paddingLeft:20+20*u,backgroundColor:x?'#202425':'#151718'},f&&{backgroundColor:'#26292b'},n],children:[(0,t().jsxs)(l().View,{style:{flexDirection:'row',alignItems:'center'},children:[o,(0,t().jsx)(l().Text,{style:T.filename,children:c})]}),(0,t().jsxs)(l().View,{style:{flexDirection:'row',alignItems:'center'},children:[!!h&&(0,t().jsx)(l().Text,{style:[T.virtual,{marginRight:8}],children:h}),s]})]})})}function S(){return(0,t().jsx)(l().Image,{style:T.image,source:r(d[9])})}function V(){return(0,t().jsx)(l().Image,{style:T.image,source:r(d[10])})}function v(){return(0,t().jsx)(l().Image,{style:T.image,source:r(d[11])})}function k(){return(0,t().jsx)(l().Image,{style:T.image,source:r(d[12])})}function z({rotation:n=0}){return(0,t().jsx)(l().Image,{style:[T.image,{transform:[{rotate:`${n}deg`}]}],source:r(d[13])})}function P(){const o=window.location.origin,s=n().default.expoConfig?.sdkVersion||'Unknown',c=(()=>{if(!g.HermesInternal)return null;const t=g.HermesInternal?.getRuntimeProperties?.()??{},n=t['OSS Release Version'],o=t['Static Hermes'];return t?o?`${n} (shermes)`:n:null})();return(0,t().jsxs)(l().View,{testID:"sitemap-system-info",style:{gap:8,marginTop:16},children:[(0,t().jsx)(l().Text,{style:T.systemInfoTitle,children:"System Information"}),(0,t().jsxs)(l().View,{style:T.systemInfoContainer,children:[(0,t().jsx)(D,{right:"production",children:"Mode"}),(0,t().jsx)(D,{right:s,children:"Expo SDK"}),c&&(0,t().jsx)(D,{right:c,children:"Hermes version"}),o&&(0,t().jsx)(D,{right:o,children:"Location origin"})]})]})}function D({children:n,right:o}){return(0,t().jsxs)(l().View,{style:T.systemInfoItem,children:[(0,t().jsx)(l().Text,{style:T.systemInfoLabel,numberOfLines:1,ellipsizeMode:"tail",children:n}),(0,t().jsx)(l().View,{style:{flex:1}}),(0,t().jsx)(l().Text,{selectable:!0,style:[T.systemInfoValue,T.code],numberOfLines:1,ellipsizeMode:"tail",children:o})]})}const T=l().StyleSheet.create({container:{backgroundColor:'black',flex:1,alignItems:'stretch'},header:{backgroundColor:'#151718',paddingVertical:16,borderBottomWidth:1,borderColor:'#313538',boxShadow:'0px 3px 3px rgba(0, 0, 0, 0.33)'},headerContent:{flexDirection:'row',alignItems:'center',gap:14,paddingHorizontal:'5%',...l().Platform.select({web:{width:'100%',maxWidth:960,marginHorizontal:'auto'}})},title:{color:'white',fontSize:28,fontWeight:'bold'},scroll:{gap:12,paddingHorizontal:'5%',paddingVertical:16,...l().Platform.select({ios:{paddingBottom:24},web:{width:'100%',maxWidth:960,marginHorizontal:'auto',paddingBottom:24},default:{paddingBottom:12}})},itemContainer:{borderWidth:1,borderColor:'#313538',backgroundColor:'#151718',borderRadius:12,borderCurve:'continuous'},itemInnerContainer:{backgroundColor:'#151718',borderRadius:12,borderCurve:'continuous',gap:12},itemPressable:{paddingHorizontal:20,paddingVertical:16,flexDirection:'row',justifyContent:'space-between',alignItems:'center',...l().Platform.select({web:{transitionDuration:'100ms'}})},filename:{color:'white',fontSize:20,marginLeft:12},virtual:{textAlign:'right',color:'white'},image:{width:24,height:24,resizeMode:'contain',opacity:.6},headerIcon:{width:40,height:40,backgroundColor:'#202425',borderRadius:8,flexDirection:'row',alignItems:'center',justifyContent:'center'},systemInfoContainer:{borderWidth:1,borderColor:'#313538',backgroundColor:'#151718',borderRadius:12,gap:8,borderCurve:'continuous',padding:20},systemInfoTitle:{color:'white',fontSize:18,fontWeight:'600',marginBottom:12,paddingHorizontal:20},systemInfoItem:{flexDirection:'row',gap:8,alignItems:'center',flexWrap:'wrap'},systemInfoLabel:{color:'white',fontSize:16,lineHeight:24},systemInfoValue:{color:'white',fontSize:16,opacity:.7,flexShrink:1,letterSpacing:.5},code:{fontVariant:['tabular-nums'],fontFamily:l().Platform.select({default:"SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace",ios:'ui-monospace',android:'monospace'}),fontWeight:'500'}})},757,[24,408,30,33,289,508,758,759,760,761,762,763,764,765]); +__d(function(g,r,i,a,m,e,d){"use strict";function n(){const t=r(d[0]);return n=function(){return t},t}function t(){const n=u(r(d[1]));return t=function(){return n},n}function u(n){return n&&n.__esModule?n:{default:n}}function c({children:u}){const[c,o]=t().default.useState(!1);return t().default.useEffect(()=>{o(!0)},[]),c?(0,n().jsx)(n().Fragment,{children:u}):null}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"NoSSR",{enumerable:!0,get:function(){return c}})},758,[24,30]); +__d(function(g,r,i,a,m,e,d){"use strict";function n(){const t=r(d[0]);return n=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"Pressable",{enumerable:!0,get:function(){return t}});const t=n().Pressable},759,[33]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"useSitemap",{enumerable:!0,get:function(){return p}});const n=r(d[1]),o=r(d[2]),u=r(d[3]),c=(t,n)=>[...n,...t.route.split('/')],s=(t,n)=>'/'+c(t,n).map(t=>(0,u.matchDynamicName)(t)?.deep?t+'/'+Date.now():'index'===t?'':t).filter(Boolean).join('/'),l=t=>{const n=t.contextKey.split('/');if(t.contextKey.match(/_layout\.[jt]sx?$/))return n[n.length-2]+'/'+n[n.length-1];const o=t.route.split('/').length;return n.slice(-o).join('/')},f=(t,o)=>({contextKey:t.contextKey,filename:l(t),href:s(t,o),isInternal:t.internal??!1,isGenerated:t.generated??!1,children:[...t.children].sort(n.sortRoutes).map(n=>f(n,c(t,o)))});function p(){const n=(0,t().use)(o.RouterConfigContext)?.routeNode;return(0,t().useMemo)(()=>n?f(n,[]):null,[n])}},760,[30,403,381,389]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/chef-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png",width:48,height:48,toString(){return this.uri}}},761,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/chef-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png",width:48,height:48,toString(){return this.uri}}},762,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/chef-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png",width:48,height:48,toString(){return this.uri}}},763,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/chef-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png",width:48,height:48,toString(){return this.uri}}},764,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/chef-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png",width:48,height:48,toString(){return this.uri}}},765,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}function n(){const t=r(d[1]);return n=function(){return t},t}function o(){const t=p(r(d[2]));return o=function(){return t},t}function c(){const t=r(d[3]);return c=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"Unmatched",{enumerable:!0,get:function(){return y}});const l=r(d[4]),s=r(d[5]),u=r(d[6]),f=r(d[7]),h=r(d[8]),x=r(d[9]);function p(t){return t&&t.__esModule?t:{default:t}}function y(){return(0,t().jsx)(h.NoSSR,{children:(0,t().jsx)(b,{})})}function b(){const[h,p]=o().default.useState(!1),y=(0,l.useRouter)(),b=(0,u.useNavigation)(),P=(0,l.usePathname)(),S=(0,n().createURL)(P);return o().default.useEffect(()=>{p(!0)},[]),(0,x.useSafeLayoutEffect)(()=>{b.setOptions({title:'Not Found'})},[b]),(0,t().jsxs)(c().View,{testID:"expo-router-unmatched",style:k.container,children:[(0,t().jsx)(j,{}),(0,t().jsx)(c().Text,{role:"heading","aria-level":1,style:k.title,children:"Unmatched Route"}),(0,t().jsx)(c().Text,{role:"heading","aria-level":2,style:[k.subtitle,k.secondaryText],children:"Page could not be found."}),h?(0,t().jsx)(s.Link,{href:P,replace:!0,...c().Platform.select({native:{asChild:!0}}),children:(0,t().jsx)(f.Pressable,{children:({hovered:n,pressed:o})=>(0,t().jsx)(c().Text,{style:[k.pageLink,k.secondaryText,c().Platform.select({web:{transitionDuration:'200ms',opacity:1}}),n&&{opacity:.8,textDecorationLine:'underline'},o&&{opacity:.8}],children:S})})}):(0,t().jsx)(c().View,{style:[k.pageLink,k.placeholder]}),(0,t().jsxs)(c().View,{style:k.linkContainer,children:[(0,t().jsx)(f.Pressable,{children:({hovered:n,pressed:o})=>(0,t().jsx)(c().Text,{onPress:()=>{y.canGoBack()?y.back():y.replace('/')},style:[k.link,c().Platform.select({web:{transitionDuration:'200ms',opacity:1}}),n&&{opacity:.8,textDecorationLine:'underline'},o&&{opacity:.8}],children:"Go back"})}),(0,t().jsx)(c().Text,{style:[k.linkSeparator,k.secondaryText],children:"\u2022"}),(0,t().jsx)(s.Link,{href:"/_sitemap",replace:!0,...c().Platform.select({native:{asChild:!0}}),children:(0,t().jsx)(f.Pressable,{children:({hovered:n,pressed:o})=>(0,t().jsx)(c().Text,{style:[k.link,c().Platform.select({web:{transitionDuration:'200ms',opacity:1}}),n&&{opacity:.8,textDecorationLine:'underline'},o&&{opacity:.8}],children:"Sitemap"})})})]})]})}function j(){return(0,t().jsx)(c().Image,{source:r(d[10]),style:k.image})}const k=c().StyleSheet.create({container:{flex:1,backgroundColor:'black',padding:24,paddingBottom:64,alignItems:'center',justifyContent:'center'},image:{width:270,height:168,resizeMode:'contain',marginBottom:28},title:{...c().Platform.select({web:{fontSize:64,lineHeight:64},default:{fontSize:56,lineHeight:56}}),color:'#fff',fontWeight:'800',textAlign:'center'},subtitle:{fontSize:34,marginTop:4,marginBottom:12,fontWeight:'200',textAlign:'center'},pageLink:{minHeight:20},secondaryText:{color:'#9ba1a6'},placeholder:{backgroundColor:'#9ba1a644',minWidth:180,borderRadius:5},linkContainer:{marginTop:28,flexDirection:'row',gap:12},link:{fontSize:20,textAlign:'center',color:'#52a9ff'},linkSeparator:{fontSize:20}})},766,[24,300,30,33,419,508,533,759,758,532,767]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/chef-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png",width:436,height:266,toString(){return this.uri}}},767,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function n(){const t=u(r(d[0]));return n=function(){return t},t}function t(){const n=r(d[1]);return t=function(){return n},n}function u(n){return n&&n.__esModule?n:{default:n}}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"initScreensFeatureFlags",{enumerable:!0,get:function(){return c}});const s=!!n().default.expoConfig?.extra?.router?.disableSynchronousScreensUpdates;let o=!1;function c(){o||(o=!0,t().featureFlags.experiment.synchronousScreenUpdatesEnabled=!s,t().featureFlags.experiment.synchronousHeaderConfigUpdatesEnabled=!s,t().featureFlags.experiment.synchronousHeaderSubviewUpdatesEnabled=!s)}t().featureFlags.experiment.iosPreventReattachmentOfDismissedScreens=!0},768,[408,624]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}function n(){const t=r(d[1]);return n=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"RootUnmatched",{enumerable:!0,get:function(){return p}});const u=f(r(d[2])),o=r(d[3]);function c(t){if("function"!=typeof WeakMap)return null;var n=new WeakMap,u=new WeakMap;return(c=function(t){return t?u:n})(t)}function f(t,n){if(!n&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var u=c(n);if(u&&u.has(t))return u.get(t);var o={__proto__:null},f=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var p in t)if("default"!==p&&Object.prototype.hasOwnProperty.call(t,p)){var l=f?Object.getOwnPropertyDescriptor(t,p):null;l&&(l.get||l.set)?Object.defineProperty(o,p,l):o[p]=t[p]}return o.default=t,u&&u.set(t,o),o}function p(){return(0,n().useEffect)(()=>{u.hideAsync()},[]),(0,t().jsx)(o.Unmatched,{})}},769,[24,30,668,766]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t.Head}});const t=(n=r(d[0]),c=e,Object.keys(n).forEach(function(t){"default"===t||Object.prototype.hasOwnProperty.call(c,t)||Object.defineProperty(c,t,{enumerable:!0,get:function(){return n[t]}})}),n);var n,c},770,[771]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var c in n)Object.defineProperty(t,c,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,c).get})})(e,{get Head(){return u},get default(){return s}});const n=r(d[1]),c=r(d[2]);function o({children:c}){return(0,t().jsx)(n.Helmet,{children:c})}const u=({children:n})=>(0,c.useIsFocused)()?(0,t().jsx)(o,{children:n}):null;u.Provider=n.HelmetProvider;const s=u},771,[24,772,542]); +__d(function(g,r,_i,a,m,e,d){"use strict";var t,n=Object.create,s=Object.defineProperty,i=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,l=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty,p=(t,n,l,p)=>{if(n&&"object"==typeof n||"function"==typeof n)for(let u of o(n))c.call(t,u)||u===l||s(t,u,{get:()=>n[u],enumerable:!(p=i(n,u))||p.enumerable});return t},u=(t,i,o)=>(o=null!=t?n(l(t)):{},p(!i&&t&&t.__esModule?o:s(o,"default",{value:t,enumerable:!0}),t)),h={};((t,n)=>{for(var i in n)s(t,i,{get:n[i],enumerable:!0})})(h,{Helmet:()=>fe,HelmetData:()=>se,HelmetProvider:()=>oe}),m.exports=(t=h,p(s({},"__esModule",{value:!0}),t));var y=u(r(d[0])),f=u(r(d[1])),b=u(r(d[0])),T=u(r(d[0])),A=(t=>(t.BASE="base",t.BODY="body",t.HEAD="head",t.HTML="html",t.LINK="link",t.META="meta",t.NOSCRIPT="noscript",t.SCRIPT="script",t.STYLE="style",t.TITLE="title",t.FRAGMENT="Symbol(react.fragment)",t))(A||{}),O={rel:["amphtml","canonical","alternate"]},C={type:["application/ld+json"]},w={charset:"",name:["generator","robots","description"],property:["og:type","og:title","og:url","og:image","og:image:alt","og:description","twitter:url","twitter:title","twitter:description","twitter:image","twitter:image:alt","twitter:card","twitter:site"]},x=Object.values(A),v={accesskey:"accessKey",charset:"charSet",class:"className",contenteditable:"contentEditable",contextmenu:"contextMenu","http-equiv":"httpEquiv",itemprop:"itemProp",tabindex:"tabIndex"},$=Object.entries(v).reduce((t,[n,s])=>(t[s]=n,t),{}),j="data-rh",k="defaultTitle",S="defer",E="encodeSpecialCharacters",M="onChangeClientState",P="titleTemplate",H="prioritizeSeoTags",D=(t,n)=>{for(let s=t.length-1;s>=0;s-=1){const i=t[s];if(Object.prototype.hasOwnProperty.call(i,n))return i[n]}return null},L=t=>{let n=D(t,"title");const s=D(t,P);if(Array.isArray(n)&&(n=n.join("")),s&&n)return s.replace(/%s/g,()=>n);const i=D(t,k);return n||i||void 0},I=t=>D(t,M)||(()=>{}),U=(t,n)=>n.filter(n=>void 0!==n[t]).map(n=>n[t]).reduce((t,n)=>({...t,...n}),{}),N=(t,n)=>n.filter(t=>void 0!==t.base).map(t=>t.base).reverse().reduce((n,s)=>{if(!n.length){const i=Object.keys(s);for(let o=0;o{const i={};return s.filter(n=>{return!!Array.isArray(n[t])||(void 0!==n[t]&&(s=`Helmet: ${t} should be of type "Array". Instead found type "${typeof n[t]}"`,console&&"function"==typeof console.warn&&console.warn(s)),!1);var s}).map(n=>n[t]).reverse().reduce((t,s)=>{const o={};s.filter(t=>{let s;const l=Object.keys(t);for(let i=0;it.push(n));const l=Object.keys(o);for(let t=0;t{if(Array.isArray(t)&&t.length)for(let s=0;sArray.isArray(t)?t.join(""):t,z=(t,n)=>{const s=Object.keys(t);for(let i=0;iArray.isArray(t)?t.reduce((t,s)=>(z(s,n)?t.priority.push(s):t.default.push(s),t),{priority:[],default:[]}):{default:t,priority:[]},F=(t,n)=>({...t,[n]:void 0}),Y=["noscript","script","style"],K=(t,n=!0)=>!1===n?String(t):String(t).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'"),G=t=>Object.keys(t).reduce((n,s)=>{const i=void 0!==t[s]?`${s}="${K(t[s])}"`:`${s}`;return n?`${n} ${i}`:i},""),W=(t,n,s,i)=>{const o=G(s),l=R(n);return o?`<${t} ${j}="true" ${o}>${K(l,i)}`:`<${t} ${j}="true">${K(l,i)}`},J=(t,n,s=!0)=>n.reduce((n,i)=>{const o=i,l=Object.keys(o).filter(t=>!("innerHTML"===t||"cssText"===t)).reduce((t,n)=>{const i=void 0===o[n]?n:`${n}="${K(o[n],s)}"`;return t?`${t} ${i}`:i},""),c=o.innerHTML||o.cssText||"",p=-1===Y.indexOf(t);return`${n}<${t} ${j}="true" ${l}${p?"/>":`>${c}`}`},""),Q=(t,n={})=>Object.keys(t).reduce((n,s)=>(n[v[s]||s]=t[s],n),n),V=(t,n,s)=>{const i=Q(s,{key:n,[j]:!0});return[T.default.createElement("title",i,n)]},X=(t,n)=>n.map((n,s)=>{const i={key:s,[j]:!0};return Object.keys(n).forEach(t=>{const s=v[t]||t;if("innerHTML"===s||"cssText"===s){const t=n.innerHTML||n.cssText;i.dangerouslySetInnerHTML={__html:t}}else i[s]=n[t]}),T.default.createElement(t,i)}),Z=(t,n,s=!0)=>{switch(t){case"title":return{toComponent:()=>V(0,n.title,n.titleAttributes),toString:()=>W(t,n.title,n.titleAttributes,s)};case"bodyAttributes":case"htmlAttributes":return{toComponent:()=>Q(n),toString:()=>G(n)};default:return{toComponent:()=>X(t,n),toString:()=>J(t,n,s)}}},ee=({metaTags:t,linkTags:n,scriptTags:s,encode:i})=>{const o=B(t,w),l=B(n,O),c=B(s,C);return{priorityMethods:{toComponent:()=>[...X("meta",o.priority),...X("link",l.priority),...X("script",c.priority)],toString:()=>`${Z("meta",o.priority,i)} ${Z("link",l.priority,i)} ${Z("script",c.priority,i)}`},metaTags:o.default,linkTags:l.default,scriptTags:c.default}},te=t=>{const{baseTag:n,bodyAttributes:s,encode:i=!0,htmlAttributes:o,noscriptTags:l,styleTags:c,title:p="",titleAttributes:u,prioritizeSeoTags:h}=t;let{linkTags:y,metaTags:f,scriptTags:b}=t,T={toComponent:()=>{},toString:()=>""};return h&&({priorityMethods:T,linkTags:y,metaTags:f,scriptTags:b}=ee(t)),{priority:T,base:Z("base",n,i),bodyAttributes:Z("bodyAttributes",s,i),htmlAttributes:Z("htmlAttributes",o,i),link:Z("link",y,i),meta:Z("meta",f,i),noscript:Z("noscript",l,i),script:Z("script",b,i),style:Z("style",c,i),title:Z("title",{title:p,titleAttributes:u},i)}},re=[],ne=!("undefined"==typeof window||!window.document||!window.document.createElement),se=class{instances=[];canUseDOM=ne;value={setHelmet:t=>{this.context.helmet=t},helmetInstances:{get:()=>this.canUseDOM?re:this.instances,add:t=>{(this.canUseDOM?re:this.instances).push(t)},remove:t=>{const n=(this.canUseDOM?re:this.instances).indexOf(t);(this.canUseDOM?re:this.instances).splice(n,1)}}};constructor(t,n){this.context=t,this.canUseDOM=n||!1,n||(t.helmet=te({baseTag:[],bodyAttributes:{},encodeSpecialCharacters:!0,htmlAttributes:{},linkTags:[],metaTags:[],noscriptTags:[],scriptTags:[],styleTags:[],title:"",titleAttributes:{}}))}},ie=b.default.createContext({}),oe=class t extends b.Component{static canUseDOM=ne;constructor(n){super(n),this.helmetData=new se(this.props.context||{},t.canUseDOM)}render(){return b.default.createElement(ie.Provider,{value:this.helmetData.value},this.props.children)}},ae=r(d[0]),le=(t,n)=>{if(t===n)return!0;if("object"!=typeof t||!t||"object"!=typeof n||!n)return!1;const s=Object.keys(t),i=Object.keys(n);return s.length===i.length&&s.every(s=>Object.prototype.hasOwnProperty.call(n,s)&&t[s]===n[s])},ce=(t,n)=>{const s=document.head||document.querySelector("head"),i=s.querySelectorAll(`${t}[${j}]`),o=[].slice.call(i),l=[];let c;return n&&n.length&&n.forEach(n=>{const s=document.createElement(t);for(const t in n)if(Object.prototype.hasOwnProperty.call(n,t))if("innerHTML"===t)s.innerHTML=n.innerHTML;else if("cssText"===t)s.styleSheet?s.styleSheet.cssText=n.cssText:s.appendChild(document.createTextNode(n.cssText));else{const i=t,o=void 0===n[i]?"":n[i];s.setAttribute(t,o)}s.setAttribute(j,"true"),o.some((t,n)=>(c=n,s.isEqualNode(t)))?o.splice(c,1):l.push(s)}),o.forEach(t=>t.parentNode?.removeChild(t)),l.forEach(t=>s.appendChild(t)),{oldTags:o,newTags:l}},pe=(t,n)=>{const s=document.getElementsByTagName(t)[0];if(!s)return;const i=s.getAttribute(j),o=i?i.split(","):[],l=[...o],c=Object.keys(n);for(const t of c){const i=n[t]||"";s.getAttribute(t)!==i&&s.setAttribute(t,i),-1===o.indexOf(t)&&o.push(t);const c=l.indexOf(t);-1!==c&&l.splice(c,1)}for(let t=l.length-1;t>=0;t-=1)s.removeAttribute(l[t]);o.length===l.length?s.removeAttribute(j):s.getAttribute(j)!==c.join(",")&&s.setAttribute(j,c.join(","))},ue=(t,n)=>{void 0!==t&&document.title!==t&&(document.title=R(t)),pe("title",n)},de=(t,n)=>{const{baseTag:s,bodyAttributes:i,htmlAttributes:o,linkTags:l,metaTags:c,noscriptTags:p,onChangeClientState:u,scriptTags:h,styleTags:y,title:f,titleAttributes:b}=t;pe("body",i),pe("html",o),ue(f,b);const T={baseTag:ce("base",s),linkTags:ce("link",l),metaTags:ce("meta",c),noscriptTags:ce("noscript",p),scriptTags:ce("script",h),styleTags:ce("style",y)},A={},O={};Object.keys(T).forEach(t=>{const{newTags:n,oldTags:s}=T[t];n.length&&(A[t]=n),s.length&&(O[t]=T[t].oldTags)}),n&&n(),u(t,A,O)},he=null,me=t=>{he&&cancelAnimationFrame(he),t.defer?he=requestAnimationFrame(()=>{de(t,()=>{he=null})}):(de(t),he=null)},ye=class extends ae.Component{rendered=!1;shouldComponentUpdate(t){return!le(t,this.props)}componentDidUpdate(){this.emitChange()}componentWillUnmount(){const{helmetInstances:t}=this.props.context;t.remove(this),this.emitChange()}emitChange(){const{helmetInstances:t,setHelmet:n}=this.props.context;let s=null;const i=(o=t.get().map(t=>{const n={...t.props};return delete n.context,n}),{baseTag:N(["href"],o),bodyAttributes:U("bodyAttributes",o),defer:D(o,S),encode:D(o,E),htmlAttributes:U("htmlAttributes",o),linkTags:q("link",["rel","href"],o),metaTags:q("meta",["name","charset","http-equiv","property","itemprop"],o),noscriptTags:q("noscript",["innerHTML"],o),onChangeClientState:I(o),scriptTags:q("script",["src","innerHTML"],o),styleTags:q("style",["cssText"],o),title:L(o),titleAttributes:U("titleAttributes",o),prioritizeSeoTags:_(o,H)});var o;oe.canUseDOM?me(i):te&&(s=te(i)),n(s)}init(){if(this.rendered)return;this.rendered=!0;const{helmetInstances:t}=this.props.context;t.add(this),this.emitChange()}render(){return this.init(),null}},fe=class extends y.Component{static defaultProps={defer:!0,encodeSpecialCharacters:!0,prioritizeSeoTags:!1};shouldComponentUpdate(t){return!(0,f.default)(F(this.props,"helmetData"),F(t,"helmetData"))}mapNestedChildrenToProps(t,n){if(!n)return null;switch(t.type){case"script":case"noscript":return{innerHTML:n};case"style":return{cssText:n};default:throw new Error(`<${t.type} /> elements are self-closing and can not contain children. Refer to our API for more information.`)}}flattenArrayTypeChildren(t,n,s,i){return{...n,[t.type]:[...n[t.type]||[],{...s,...this.mapNestedChildrenToProps(t,i)}]}}mapObjectTypeChildren(t,n,s,i){switch(t.type){case"title":return{...n,[t.type]:i,titleAttributes:{...s}};case"body":return{...n,bodyAttributes:{...s}};case"html":return{...n,htmlAttributes:{...s}};default:return{...n,[t.type]:{...s}}}}mapArrayTypeChildrenToProps(t,n){let s={...n};return Object.keys(t).forEach(n=>{s={...s,[n]:t[n]}}),s}warnOnInvalidChildren(t,n){if(!x.some(n=>t.type===n))throw new Error("function"==typeof t.type?"You may be attempting to nest components within each other, which is not allowed. Refer to our API for more information.":`Only elements types ${x.join(", ")} are allowed. Helmet does not support rendering <${t.type}> elements. Refer to our API for more information.`);if(n&&"string"!=typeof n&&(!Array.isArray(n)||n.some(t=>"string"!=typeof t)))throw new Error(`Helmet expects a string as a child of <${t.type}>. Did you forget to wrap your children in braces? ( <${t.type}>{\`\`} ) Refer to our API for more information.`);return!0}mapChildrenToProps(t,n){let s={};return y.default.Children.forEach(t,t=>{if(!t||!t.props)return;const{children:i,...o}=t.props,l=Object.keys(o).reduce((t,n)=>(t[$[n]||n]=o[n],t),{});let{type:c}=t;switch("symbol"==typeof c?c=c.toString():this.warnOnInvalidChildren(t,i),c){case"Symbol(react.fragment)":n=this.mapChildrenToProps(i,n);break;case"link":case"meta":case"noscript":case"script":case"style":s=this.flattenArrayTypeChildren(t,s,l,i);break;default:n=this.mapObjectTypeChildren(t,n,l,i)}}),this.mapArrayTypeChildrenToProps(s,n)}render(){const{children:t,...n}=this.props;let s={...n},{helmetData:i}=n;if(t&&(s=this.mapChildrenToProps(t,s)),i&&!(i instanceof se)){i=new se(i.context,!0),delete s.helmetData}return i?y.default.createElement(ye,{...s,context:i.value}):y.default.createElement(ie.Consumer,null,t=>y.default.createElement(ye,{...s,context:t}))}}},772,[30,368]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},773,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";function t(){const e=r(d[0]);return t=function(){return e},e}function e(){const t=r(d[1]);return e=function(){return t},t}function n(){const t=f(r(d[2]));return n=function(){return t},t}function o(){const t=r(d[3]);return o=function(){return t},t}Object.defineProperty(_e,"__esModule",{value:!0}),Object.defineProperty(_e,"renderRootComponent",{enumerable:!0,get:function(){return y}});const u=f(r(d[4]));function c(t){if("function"!=typeof WeakMap)return null;var e=new WeakMap,n=new WeakMap;return(c=function(t){return t?n:e})(t)}function f(t,e){if(!e&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var n=c(e);if(n&&n.has(t))return n.get(t);var o={__proto__:null},u=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var f in t)if("default"!==f&&Object.prototype.hasOwnProperty.call(t,f)){var s=u?Object.getOwnPropertyDescriptor(t,f):null;s&&(s.get||s.set)?Object.defineProperty(o,f,s):o[f]=t[f]}return o.default=t,n&&n.set(t,o),o}function s(t){if('[object Object]'!==Object.prototype.toString.call(t))return!1;const e=Object.getPrototypeOf(t);return null===e||e===Object.prototype}function p(t){return t&&'object'==typeof t&&'string'==typeof t.name&&'string'==typeof t.message}function l(t){return p(t)?t:s(t)?new Error(JSON.stringify(t)):new Error(String(t))}function y(c){try{setTimeout(()=>{u._internal_preventAutoHideAsync?.()}),n().startTransition(()=>{(0,e().registerRootComponent)(c)})}catch(n){u.hideAsync();const c=l(n);(0,e().registerRootComponent)(()=>(0,t().jsx)(o().View,{})),console.error(c),console.error("A runtime error has occurred while rendering the root component."),setTimeout(()=>{throw c})}}},774,[24,570,30,33,668]); +__r(572); +__r(20); +__r(0); \ No newline at end of file diff --git a/wildings/chef-app/_expo/static/js/web/index-a234f55f1edf32204a015d4a1f3cfb17.js b/wildings/chef-app/_expo/static/js/web/index-a234f55f1edf32204a015d4a1f3cfb17.js new file mode 100644 index 0000000000000000000000000000000000000000..b9ddaa313e3ee356d788bf3ad4a639cbd6fe841f --- /dev/null +++ b/wildings/chef-app/_expo/static/js/web/index-a234f55f1edf32204a015d4a1f3cfb17.js @@ -0,0 +1,2 @@ +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return f}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]),c=r(d[4]);function f(){return'owner'!==u.APP_VARIANT?(0,c.jsx)(t.Redirect,{href:u.ENTRY[u.APP_VARIANT]}):(0,c.jsx)(n.OwnerApp,{})}},799,[804,30,960,806,24]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.OwnerApp=function(){return null}},960,[]); \ No newline at end of file diff --git a/wildings/chef-app/_expo/static/js/web/index-a39af53b0c36f30a0cc27647d3da5a52.js b/wildings/chef-app/_expo/static/js/web/index-a39af53b0c36f30a0cc27647d3da5a52.js new file mode 100644 index 0000000000000000000000000000000000000000..be88522d8019ae68d9900cda44c8cc2587130292 --- /dev/null +++ b/wildings/chef-app/_expo/static/js/web/index-a39af53b0c36f30a0cc27647d3da5a52.js @@ -0,0 +1 @@ +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return c}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]);function c(){return(0,u.jsx)(t.Redirect,{href:n.ENTRY[n.APP_VARIANT]})}},803,[804,30,806,24]); \ No newline at end of file diff --git a/wildings/chef-app/_expo/static/js/web/index-abf44c56ecfe3a6ee457b5a1c56cb955.js b/wildings/chef-app/_expo/static/js/web/index-abf44c56ecfe3a6ee457b5a1c56cb955.js new file mode 100644 index 0000000000000000000000000000000000000000..b437631027993f4525348e397e843877968f755f --- /dev/null +++ b/wildings/chef-app/_expo/static/js/web/index-abf44c56ecfe3a6ee457b5a1c56cb955.js @@ -0,0 +1 @@ +__d(function(g,_r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return f}});var e=_r(d[0]);_r(d[1]);var s,r=_r(d[2]),n=(s=r)&&s.__esModule?s:{default:s},t=_r(d[3]),l=_r(d[4]),o=_r(d[5]),a=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),j=_r(d[10]),x=_r(d[11]);function f(){const s=(0,u.useStore)(e=>e.restaurants),r=(0,u.useCustomer)(),f=(0,u.useNow)(3e4);return(0,x.jsxs)(l.Screen,{title:"Restaurants",subtitle:"Book, order and pay at local restaurants",right:(0,x.jsxs)(l.Row,{children:[(0,x.jsx)(t.BasketButton,{}),(0,x.jsx)(l.Button,{small:!0,kind:"ghost",label:"Profile",onPress:()=>e.router.push('/customer/profile')})]}),children:[(0,x.jsxs)(l.Card,{onPress:()=>e.router.push('/customer/profile'),children:[(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.T,{weight:"semibold",children:r.name?`Hello, ${r.name.split(' ')[0]}`:'Add your profile'}),(0,x.jsx)(l.Muted,{children:"Edit profile \u203a"})]}),(0,x.jsx)(l.Muted,{children:"Your allergies (stored once, confirmed on every order and booking):"}),(0,x.jsx)(l.Row,{wrap:!0,gap:6,children:r.allergies.length?r.allergies.map(e=>(0,x.jsx)(l.Badge,{kind:"red",label:`${(0,o.allergenLabel)(e.allergen)} \u2014 ${(0,o.severityLabel)(e.severity)}`},e.allergen)):(0,x.jsx)(l.Muted,{children:"None declared"})})]}),s.map(s=>{const r=(0,a.hoursFor)(s,f);return(0,x.jsxs)(l.Card,{onPress:()=>e.router.push(`/customer/${s.id}`),highlight:s.id===j.VENUE_RID?c.colours.gold:void 0,children:[(0,x.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(l.H2,{style:{flex:1},children:s.name}),s.fictional?(0,x.jsx)(l.Badge,{kind:"amber",label:"FICTIONAL DEMO"}):(0,x.jsx)(l.Badge,{kind:"gold",label:"PILOT"})]}),(0,x.jsx)(l.Muted,{children:s.tagline}),(0,x.jsx)(l.Muted,{children:s.location}),(0,x.jsx)(l.T,{size:14,colour:r?c.colours.ok:c.colours.amber,children:r?`Kitchen today ${(0,a.kitchenHoursOn)(s,f)[0]}\u2013${(0,a.kitchenHoursOn)(s,f)[1]}`:'Kitchen closed today (hours not listed)'})]},s.id)}),(0,x.jsx)(l.Banner,{kind:"info",children:"Each venue uses only its own saved menu, cards and booking details."}),(0,x.jsx)(h.LauncherLine,{}),(0,x.jsx)(n.default,{style:{height:8}})]})}},790,[804,30,127,830,813,814,815,819,821,853,5,24]); \ No newline at end of file diff --git a/wildings/chef-app/_expo/static/js/web/index-f9b07e7c25cec3623c10876ff1e01e58.js b/wildings/chef-app/_expo/static/js/web/index-f9b07e7c25cec3623c10876ff1e01e58.js new file mode 100644 index 0000000000000000000000000000000000000000..4d9a73d71ffd62c3089157ea2588c631ec337d88 --- /dev/null +++ b/wildings/chef-app/_expo/static/js/web/index-f9b07e7c25cec3623c10876ff1e01e58.js @@ -0,0 +1 @@ +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return c}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]);function c(){return(0,u.jsx)(t.Redirect,{href:n.ENTRY[n.APP_VARIANT]})}},798,[804,30,806,24]); \ No newline at end of file diff --git a/wildings/chef-app/_expo/static/js/web/lost-53fa50fd975a0e31c68fdd69575c2342.js b/wildings/chef-app/_expo/static/js/web/lost-53fa50fd975a0e31c68fdd69575c2342.js new file mode 100644 index 0000000000000000000000000000000000000000..a534e34d23b28c8163bfa4753865db324a0513e1 --- /dev/null +++ b/wildings/chef-app/_expo/static/js/web/lost-53fa50fd975a0e31c68fdd69575c2342.js @@ -0,0 +1 @@ +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return u}});var t=_r(d[0]),n=_r(d[1]),s=_r(d[2]),r=_r(d[3]),l=_r(d[4]),o=_r(d[5]);function u(){const{rid:u}=(0,t.useLocalSearchParams)(),h=(0,r.useRestaurant)(u),c=(0,r.useCustomer)(),x=(0,r.useNow)(6e4),j=(0,l.useOwner)(t=>t.lost),p=(0,l.useOwner)(t=>t.lostReports),[f,y]=(0,n.useState)(''),[w,b]=(0,n.useState)(''),[S,C]=(0,n.useState)(''),[R,v]=(0,n.useState)(!1);if(!h)return(0,o.jsx)(s.Screen,{title:"Not found",children:(0,o.jsx)(s.T,{children:"Restaurant not found."})});const O=p.filter(t=>t.contact.includes(c.email));return(0,o.jsxs)(s.Screen,{title:"Lost property",subtitle:h.name,children:[(0,o.jsxs)(s.Card,{children:[(0,o.jsx)(s.H2,{children:"Recently handed in"}),j.filter(t=>'held'===t.status).map(t=>(0,o.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,o.jsx)(s.T,{style:{flex:1},children:t.item}),(0,o.jsx)(s.Muted,{children:t.foundAt.slice(0,10)})]},t.id)),j.some(t=>'held'===t.status)?null:(0,o.jsx)(s.Muted,{children:"Nothing handed in right now."}),(0,o.jsx)(s.Muted,{children:"To collect, bring ID or describe the item to staff. Items are kept for 3 months."})]}),R?(0,o.jsxs)(s.Banner,{kind:"success",children:["Report sent to ",h.name,". They'll be in touch if it turns up (sent to the venue on this device only: messaging is not set up yet)."]}):null,(0,o.jsxs)(s.Card,{children:[(0,o.jsx)(s.H2,{children:"Lost something?"}),(0,o.jsx)(s.Field,{label:"What did you lose?",value:f,onChangeText:y,placeholder:"e.g. Grey scarf"}),(0,o.jsx)(s.Field,{label:"When were you in?",value:w,onChangeText:b,placeholder:"e.g. Saturday evening"}),(0,o.jsx)(s.Field,{label:"Where were you sitting? (optional)",value:S,onChangeText:C,placeholder:"e.g. By the window"}),(0,o.jsxs)(s.Muted,{children:["We'll share your name and email (",c.email,") with ",h.name," for this report only."]}),(0,o.jsx)(s.Button,{label:"Send report",disabled:f.trim().length<2||w.trim().length<2,onPress:()=>{l.useOwner.getState().setOwner({lostReports:[{id:`lr-${Date.now()}`,item:f.trim(),when:w.trim(),where:S.trim()||'Not sure',contact:`${c.name} \xb7 ${c.email}`,at:x.toISOString(),status:'open'},...l.useOwner.getState().lostReports]}),y(''),b(''),C(''),v(!0)}})]}),O.length?(0,o.jsxs)(s.Card,{children:[(0,o.jsx)(s.H2,{children:"Your reports"}),O.map(t=>(0,o.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,o.jsxs)(s.T,{style:{flex:1},children:[t.item," \xb7 ",t.when]}),(0,o.jsx)(s.Badge,{kind:'matched'===t.status?'ok':'open'===t.status?'amber':'neutral',label:'matched'===t.status?'Found!':'open'===t.status?'Looking':'Closed'})]},t.id))]}):null]})}},782,[804,30,813,819,854,24]); \ No newline at end of file diff --git a/wildings/chef-app/_expo/static/js/web/loyalty-f6d17fe0987432e6c679359636231949.js b/wildings/chef-app/_expo/static/js/web/loyalty-f6d17fe0987432e6c679359636231949.js new file mode 100644 index 0000000000000000000000000000000000000000..3ab717191bcd90764a474563c7290eb5929d59d2 --- /dev/null +++ b/wildings/chef-app/_expo/static/js/web/loyalty-f6d17fe0987432e6c679359636231949.js @@ -0,0 +1 @@ +__d(function(g,_r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return j}});var e=_r(d[0]),r=_r(d[1]);_r(d[2]);var s,t=_r(d[3]),n=(s=t)&&s.__esModule?s:{default:s},i=_r(d[4]),o=_r(d[5]),l=_r(d[6]),c=_r(d[7]),u=_r(d[8]),h=_r(d[9]),p=_r(d[10]),f=_r(d[11]);function j(){const{rid:s}=(0,r.useLocalSearchParams)(),t=(0,c.useRestaurant)(s);return e.LIVE_VENUE_BUILD||(0,p.guestServer)()?t?(0,f.jsx)(h.LoyaltyLive,{slug:s,venue:t.name}):(0,f.jsx)(o.Screen,{title:"Not found",children:(0,f.jsx)(o.T,{children:"Restaurant not found."})}):(0,f.jsx)(x,{})}function x(){const{rid:e}=(0,r.useLocalSearchParams)(),s=(0,c.useRestaurant)(e),t=(0,c.useCustomer)(),h=(0,c.useStampCard)(e);if(!s)return(0,f.jsx)(o.Screen,{title:"Not found",children:(0,f.jsx)(o.T,{children:"Restaurant not found."})});const p=s.settings.stampTarget,j=h?.stamps??0;return(0,f.jsxs)(o.Screen,{title:"Stamp card",subtitle:`${s.name} \u2014 this card is just for ${s.name}`,children:[(0,f.jsx)(o.Banner,{kind:"example",title:"Example card (demo)",children:"On a real venue your card is saved by the venue and is the same on any phone."}),(0,f.jsxs)(o.Card,{highlight:u.colours.gold,children:[(0,f.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(o.H2,{children:[j," of ",p," stamps"]}),(0,f.jsxs)(o.T,{colour:u.colours.gold,weight:"semibold",children:["Reward: ",s.settings.stampReward]})]}),(0,f.jsx)(n.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:10,justifyContent:'center',paddingVertical:8},children:Array.from({length:p}).map((e,r)=>(0,f.jsx)(n.default,{accessibilityLabel:r1?'s':''} ready: ${s.settings.stampReward}`,children:(0,f.jsx)(o.Button,{small:!0,label:"Use reward (show staff)",onPress:()=>c.repo.loyalty.redeemReward(s.id,t.id)})}):null]}),(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Show this to staff"}),(0,f.jsx)(o.Muted,{children:"Staff scan this on the tablet to add a stamp for dine-in visits not paid by table QR."}),(0,f.jsx)(i.QR,{value:`covercharge:stamp:${s.id}:${t.id}`,size:190}),(0,f.jsx)(o.T,{center:!0,weight:"semibold",children:t.name})]}),(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Bring a friend"}),(0,f.jsx)(o.T,{children:"Your referral code"}),(0,f.jsx)(o.T,{size:28,weight:"bold",colour:u.colours.gold,center:!0,children:t.referralCode}),(0,f.jsx)(o.Muted,{children:"When a friend completes their first qualifying paid visit or order, you both get a stamp. One referral reward per new account, phone and card; monthly cap applies."})]}),(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"History"}),(h?.history??[]).length?h.history.slice(0,10).map((e,r)=>(0,f.jsxs)(o.Muted,{children:[e.at.slice(0,10)," \xb7 ",e.source]},r)):(0,f.jsx)(o.Muted,{children:"No stamps yet."})]}),(0,f.jsx)(o.Muted,{children:"Rewards are kept on food (Scottish licensing rules restrict drinks promotions). Stamps are never given for reviews."})]})}},783,[833,804,30,127,867,813,816,819,821,859,836,24]); \ No newline at end of file diff --git a/wildings/chef-app/_expo/static/js/web/merch-dcc4bf2e12c5c983cc8637b3dae25ae6.js b/wildings/chef-app/_expo/static/js/web/merch-dcc4bf2e12c5c983cc8637b3dae25ae6.js new file mode 100644 index 0000000000000000000000000000000000000000..ea3361d55a8675d860bd00d378b50912a5428b0e --- /dev/null +++ b/wildings/chef-app/_expo/static/js/web/merch-dcc4bf2e12c5c983cc8637b3dae25ae6.js @@ -0,0 +1 @@ +__d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return y}});var e,t=_r(d[0]),n=_r(d[1]),s=_r(d[2]),l=_r(d[3]),r=(e=l)&&e.__esModule?e:{default:e},u=_r(d[4]),o=_r(d[5]),c=_r(d[6]),m=_r(d[7]),h=_r(d[8]),j=_r(d[9]),x=_r(d[10]),f=_r(d[11]),b=_r(d[12]),p=_r(d[13]);function y(){const{rid:e}=(0,n.useLocalSearchParams)(),s=(0,c.useRestaurant)(e),l=(0,c.useCustomer)();return t.LIVE_VENUE_BUILD||(0,b.guestServer)()?s?(0,p.jsx)(f.ShopLive,{slug:e,venue:s.name,guestName:l.name}):(0,p.jsx)(o.Screen,{title:"Not found",children:(0,p.jsx)(o.T,{children:"Restaurant not found."})}):(0,p.jsx)(S,{})}function S(){const{rid:e}=(0,n.useLocalSearchParams)(),t=(0,c.useRestaurant)(e),l=(0,c.useCustomer)(),f=(0,c.useNow)(6e4),b=(0,m.useOwner)(e=>e.merch),[y,S]=(0,s.useState)({}),[k,w]=(0,s.useState)(null),[v,C]=(0,s.useState)(null);if(!t)return(0,p.jsx)(o.Screen,{title:"Not found",children:(0,p.jsx)(o.T,{children:"Restaurant not found."})});const $=b.find(e=>e.id===k),O=e=>y[e]??1;return(0,p.jsxs)(o.Screen,{title:"Shop",subtitle:`${t.name} merch \xb7 collect in the restaurant`,children:[v?(0,p.jsxs)(o.Banner,{kind:"success",title:"Order noted (no payment taken)",children:[v," Collect it at the bar on your next visit."]}):null,b.filter(e=>e.live||0===e.stock).map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsxs)(r.default,{style:{flex:1},children:[(0,p.jsx)(o.T,{weight:"semibold",children:e.name}),(0,p.jsx)(o.T,{colour:x.colours.gold,weight:"semibold",children:(0,h.gbp)(e.price)})]}),0!==e.stock&&e.live?e.stock<8?(0,p.jsx)(o.Badge,{kind:"amber",label:`${e.stock} left`}):null:(0,p.jsx)(o.Badge,{kind:"neutral",label:"Sold out"})]}),e.live&&e.stock>0?(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.Stepper,{value:O(e.id),min:1,max:Math.min(5,e.stock),onChange:t=>S({...y,[e.id]:t}),label:`${e.name} quantity`}),(0,p.jsx)(o.Button,{small:!0,label:`Buy \xb7 ${(0,h.gbp)(e.price*O(e.id))}`,onPress:()=>w(e.id)})]}):null]},e.id)),(0,p.jsxs)(o.Muted,{children:["Collection only. Prices set by ",t.name,"."]}),$?(0,p.jsx)(u.MockPay,{visible:!0,onClose:()=>w(null),amount:$.price*O($.id),restaurantId:t.id,allowGiftCard:!1,title:`Buy ${$.name}`,onPaid:()=>{const e=m.useOwner.getState();e.setOwner({merch:e.merch.map(e=>e.id===$.id?{...e,stock:Math.max(0,e.stock-O($.id))}:e),merchOrders:[{id:`mo-${Date.now()}`,productId:$.id,qty:O($.id),customer:l.name,at:(0,j.ymd)(f),status:'new'},...e.merchOrders]}),C(`${O($.id)} \xd7 ${$.name}, ${(0,h.gbp)($.price*O($.id))}.`),w(null)}}):null]})}},784,[833,804,30,127,834,813,819,854,816,818,821,835,836,24]); \ No newline at end of file diff --git a/wildings/chef-app/_expo/static/js/web/offers-3f4e351ccaa73514bd508bf7bd2a3fa2.js b/wildings/chef-app/_expo/static/js/web/offers-3f4e351ccaa73514bd508bf7bd2a3fa2.js new file mode 100644 index 0000000000000000000000000000000000000000..7bfbd86f471e6c28562bfd7ecbbd06fb9e2bc062 --- /dev/null +++ b/wildings/chef-app/_expo/static/js/web/offers-3f4e351ccaa73514bd508bf7bd2a3fa2.js @@ -0,0 +1 @@ +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return j}});var n=_r(d[0]),t=_r(d[1]);_r(d[2]);var s=_r(d[3]),r=_r(d[4]),o=_r(d[5]),l=_r(d[6]),c=_r(d[7]),u=_r(d[8]),f=_r(d[9]),h=_r(d[10]);function j(){const{rid:o}=(0,t.useLocalSearchParams)(),l=(0,r.useRestaurant)(o);return n.LIVE_VENUE_BUILD||(0,f.guestServer)()?l?(0,h.jsx)(u.OffersLive,{slug:o,venue:l.name}):(0,h.jsx)(s.Screen,{title:"Not found",children:(0,h.jsx)(s.T,{children:"Restaurant not found."})}):(0,h.jsx)(x,{})}function x(){const{rid:n}=(0,t.useLocalSearchParams)(),u=(0,r.useRestaurant)(n),f=(0,r.useCustomer)(),j=(0,o.useOwner)(n=>n.offers);if(!u)return(0,h.jsx)(s.Screen,{title:"Not found",children:(0,h.jsx)(s.T,{children:"Restaurant not found."})});const x=!!f.marketingOptIn[u.id],b=j.filter(n=>n.live),p=b.filter(n=>'special'===n.kind),y=b.filter(n=>'offer'===n.kind);return(0,h.jsxs)(s.Screen,{title:"Specials & offers",subtitle:u.name,children:[(0,h.jsxs)(s.Card,{highlight:x?c.colours.ok:c.colours.gold,children:[(0,h.jsx)(s.Toggle,{label:`Send me offers from ${u.name}`,value:x,onChange:n=>r.repo.customers.update({marketingOptIn:{...f.marketingOptIn,[u.id]:n}})}),(0,h.jsx)(s.Muted,{children:x?'You can switch this off any time. We only use it for this restaurant.':'Off by default. Turn on to see member offers and get the occasional notification (max one a week). You can switch it off any time.'})]}),(0,h.jsx)(s.H2,{children:"Today's specials"}),p.length?p.map(n=>(0,h.jsxs)(s.Card,{children:[(0,h.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(s.T,{weight:"semibold",style:{flex:1},children:n.title}),(0,h.jsx)(s.Badge,{kind:"gold",label:"Special"})]}),(0,h.jsx)(s.Muted,{children:n.body})]},n.id)):(0,h.jsx)(s.Muted,{children:"No specials on the board right now."}),(0,h.jsx)(s.H2,{children:"Member offers"}),x?y.length?y.map(n=>(0,h.jsxs)(s.Card,{children:[(0,h.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(s.T,{weight:"semibold",style:{flex:1},children:n.title}),(0,h.jsx)(s.Badge,{kind:"ok",label:"Offer"})]}),(0,h.jsx)(s.Muted,{children:n.body}),n.until?(0,h.jsxs)(s.Muted,{children:["Until ",(0,l.niceDate)((0,l.parseYmd)(n.until))]}):null]},n.id)):(0,h.jsx)(s.Muted,{children:"No offers right now."}):(0,h.jsxs)(s.Banner,{kind:"info",children:["Turn on offers above to see ",y.length," member offer",1===y.length?'':'s',"."]}),(0,h.jsxs)(s.Muted,{children:["Offers are set by ",u.name,". Drinks promotions follow Scottish licensing rules. Demo: no notifications are sent."]})]})}},785,[833,804,30,813,819,854,818,821,859,836,24]); \ No newline at end of file diff --git a/wildings/chef-app/_expo/static/js/web/profile-7858c56bba02a864da6a44be8f8ce02f.js b/wildings/chef-app/_expo/static/js/web/profile-7858c56bba02a864da6a44be8f8ce02f.js new file mode 100644 index 0000000000000000000000000000000000000000..800311dcfb451004ce8b256207faf0bc18c1ac2e --- /dev/null +++ b/wildings/chef-app/_expo/static/js/web/profile-7858c56bba02a864da6a44be8f8ce02f.js @@ -0,0 +1 @@ +__d(function(g,_r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return y}});var e=_r(d[0]),r=_r(d[1]),s=_r(d[2]);_r(d[3]);var t,l=_r(d[4]),n=(t=l)&&t.__esModule?t:{default:t},a=_r(d[5]),o=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),p=_r(d[10]),b=_r(d[11]);function y(){const t=(0,h.useCustomer)(),l=(0,h.useStore)((0,p.useShallow)(e=>e.orders.filter(r=>r.customerId===e.customer.id))),y=(0,h.useStore)((0,p.useShallow)(e=>e.bookings.filter(r=>r.customerId===e.customer.id))),x=(0,h.useStore)(e=>e.restaurants),j=e=>x.find(r=>r.id===e)?.name??e;return(0,b.jsxs)(a.Screen,{title:"Your account",subtitle:"One CoverCharge account for every restaurant",children:[(0,b.jsxs)(a.Card,{children:[(0,b.jsx)(a.Field,{label:"Name",value:t.name,onChangeText:e=>h.repo.customers.update({name:e})}),(0,b.jsx)(a.Field,{label:"Email",value:t.email,keyboardType:"email-address",onChangeText:e=>h.repo.customers.update({email:e})}),(0,b.jsx)(a.Field,{label:"Mobile",value:t.phone,keyboardType:"phone-pad",onChangeText:e=>h.repo.customers.update({phone:e})}),(0,b.jsx)(a.Muted,{children:(0,r.guestServer)()?'Your bring-a-friend code is on each restaurant\u2019s stamp card.':`Referral code: ${t.referralCode}`})]}),(0,b.jsxs)(a.Card,{children:[(0,b.jsx)(a.H2,{children:"Allergies & severity"}),(0,b.jsx)(a.Muted,{children:"Stored once and shared with a restaurant only when you order or book there. You confirm them on every order, table session and booking."}),(0,b.jsx)(a.Toggle,{label:"I consent to CoverCharge storing my allergy information (health data, UK GDPR)",value:t.allergyConsent,onChange:e=>h.repo.customers.update({allergyConsent:e})}),t.allergyConsent?null:(0,b.jsx)(a.Banner,{kind:"warn",children:"Without consent your allergies won\u2019t be stored \u2014 tell staff directly."}),o.ALLERGENS.map(e=>{const r=t.allergies.find(r=>r.allergen===e.id);return(0,b.jsxs)(n.default,{style:{gap:6,paddingVertical:6},children:[(0,b.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(a.T,{weight:r?'semibold':'regular',children:e.label}),r?(0,b.jsx)(a.Badge,{kind:"red",label:"Declared"}):null]}),(0,b.jsxs)(a.Row,{wrap:!0,gap:6,children:[(0,b.jsx)(a.Chip,{label:"None",selected:!r,onPress:()=>h.repo.customers.setAllergy(e.id,null),disabled:!t.allergyConsent&&!r}),o.SEVERITIES.map(s=>(0,b.jsx)(a.Chip,{label:s.label,selected:r?.severity===s.id,disabled:!t.allergyConsent,onPress:()=>h.repo.customers.setAllergy(e.id,s.id)},s.id))]})]},e.id)})]}),(0,b.jsxs)(a.Card,{children:[(0,b.jsx)(a.H2,{children:"Your orders"}),l.length?l.map(r=>(0,b.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsxs)(a.T,{style:{flex:1},children:[r.ref," \xb7 ",j(r.restaurantId)," \xb7 ",'table'===r.type?`${(0,e.tableNumbers)(r.tableNo)}`:'Takeaway']}),(0,b.jsx)(a.Button,{small:!0,kind:"secondary",label:`${r.status} \xb7 ${(0,u.gbp)(r.subtotal+r.tip)}`,onPress:()=>s.router.push(`/customer/order/${r.id}`)})]},r.id)):(0,b.jsx)(a.Muted,{children:"No orders yet."})]}),(0,b.jsxs)(a.Card,{children:[(0,b.jsx)(a.H2,{children:"Your bookings"}),y.length?y.map(e=>(0,b.jsxs)(a.T,{children:[e.ref," \xb7 ",j(e.restaurantId)," \xb7 ",(0,c.niceDate)((0,c.parseYmd)(e.date))," ",e.time," \xb7 ",e.partySize," people \xb7 ",e.status]},e.id)):(0,b.jsx)(a.Muted,{children:"No bookings yet."})]}),(0,b.jsx)(a.Muted,{children:"Account deletion and data export would live here (Apple 5.1.1(v); Google web deletion link)."})]})}},792,[808,836,804,30,127,813,814,816,818,819,871,24]); \ No newline at end of file diff --git a/wildings/chef-app/_expo/static/js/web/refer-9cf3652c6de6015e443d52d85aa73db7.js b/wildings/chef-app/_expo/static/js/web/refer-9cf3652c6de6015e443d52d85aa73db7.js new file mode 100644 index 0000000000000000000000000000000000000000..9b0d57b1966cd21e63f1a8d5d559c2dde5583bff --- /dev/null +++ b/wildings/chef-app/_expo/static/js/web/refer-9cf3652c6de6015e443d52d85aa73db7.js @@ -0,0 +1 @@ +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return j}});var r=_r(d[0]),n=_r(d[1]),s=_r(d[2]),t=_r(d[3]),l=_r(d[4]),o=_r(d[5]),u=_r(d[6]),c=_r(d[7]),h=_r(d[8]),f=_r(d[9]);function j(){const{rid:s}=(0,n.useLocalSearchParams)(),o=(0,l.useRestaurant)(s);return r.LIVE_VENUE_BUILD||(0,h.guestServer)()?o?(0,f.jsx)(c.ReferLive,{slug:s,venue:o.name}):(0,f.jsx)(t.Screen,{title:"Not found",children:(0,f.jsx)(t.T,{children:"Restaurant not found."})}):(0,f.jsx)(x,{})}function x(){const{rid:r}=(0,n.useLocalSearchParams)(),c=(0,l.useRestaurant)(r),h=(0,l.useCustomer)(),j=(0,o.useOwner)(r=>r.referral),x=(0,o.useOwner)(r=>r.referrals),[p,w]=(0,s.useState)(!1);if(!c)return(0,f.jsx)(t.Screen,{title:"Not found",children:(0,f.jsx)(t.T,{children:"Restaurant not found."})});const b=x.filter(r=>r.referrer===h.name);return(0,f.jsxs)(t.Screen,{title:"Bring a friend",subtitle:c.name,children:[j.active?null:(0,f.jsxs)(t.Banner,{kind:"info",children:[c.name," isn't running referrals right now."]}),(0,f.jsxs)(t.Card,{highlight:u.colours.gold,children:[(0,f.jsxs)(t.H2,{children:["You get: ",j.giverReward]}),(0,f.jsxs)(t.T,{children:["Your friend gets: ",j.friendReward]}),(0,f.jsx)(t.Muted,{children:"When your friend makes their first paid visit or order."}),(0,f.jsx)(t.T,{size:30,weight:"bold",colour:u.colours.gold,center:!0,children:h.referralCode}),(0,f.jsx)(t.Button,{label:"Share my code",disabled:!j.active,onPress:()=>w(!0)}),p?(0,f.jsx)(t.Muted,{center:!0,children:"Demo: in the real app this opens your phone's share sheet. Nothing is sent from here."}):null]}),(0,f.jsxs)(t.Card,{children:[(0,f.jsx)(t.H2,{children:"Your referrals"}),b.length?b.map(r=>(0,f.jsxs)(t.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(t.T,{style:{flex:1},children:r.friend}),(0,f.jsx)(t.Badge,{kind:'rewarded'===r.status?'ok':'amber',label:r.status})]},r.id)):(0,f.jsx)(t.Muted,{children:"No referrals yet."})]}),(0,f.jsx)(t.Muted,{children:"One reward per new account, phone and card. Monthly cap applies. Rewards are on food, not drinks."})]})}},786,[833,804,30,813,819,854,821,859,836,24]); \ No newline at end of file diff --git a/wildings/chef-app/_expo/static/js/web/waitlist-93752bc9a9a8df911b095d236fa3f385.js b/wildings/chef-app/_expo/static/js/web/waitlist-93752bc9a9a8df911b095d236fa3f385.js new file mode 100644 index 0000000000000000000000000000000000000000..0e02e37f4afff03dd2b7a53da0e5ea294dec6428 --- /dev/null +++ b/wildings/chef-app/_expo/static/js/web/waitlist-93752bc9a9a8df911b095d236fa3f385.js @@ -0,0 +1 @@ +__d(function(g,_r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return h}});var t=_r(d[0]),s=_r(d[1]),n=_r(d[2]),a=_r(d[3]),r=_r(d[4]),o=_r(d[5]),u=_r(d[6]),l=_r(d[7]),c=_r(d[8]);function h(){const{rid:h}=(0,t.useLocalSearchParams)(),j=(0,u.useRestaurant)(h),x=(0,u.useCustomer)(),b=(0,u.useWaitlist)(h),y=(0,u.useBookings)(h),f=(0,u.useOrders)(h),w=(0,u.useEvents)(h),p=(0,u.useNow)(15e3),[M,S]=(0,s.useState)(2),[v,P]=(0,s.useState)(x.name);if(!j)return(0,c.jsx)(n.Screen,{title:"Not found",children:(0,c.jsx)(n.T,{children:"Restaurant not found."})});const T=b.filter(t=>'waiting'===t.status||'notified'===t.status).sort((t,s)=>t.number-s.number),k=T.find(t=>t.customerId===x.id),B=(0,r.forecastToday)(j,y,f,w,p),C=B.nextHour?Math.min(1.6,Math.max(.8,B.nextHour.covers/(.75*j.settings.capacityPerHour))):1;if(k){const t=T.indexOf(k)+1;return(0,c.jsxs)(n.Screen,{title:"You\u2019re on the waitlist",subtitle:j.name,children:[(0,c.jsxs)(n.Card,{highlight:l.colours.gold,children:[(0,c.jsx)(n.Muted,{children:"Your queue number"}),(0,c.jsxs)(n.T,{size:56,weight:"bold",colour:l.colours.gold,children:["#",k.number]}),(0,c.jsx)(n.T,{children:1===t?'You\u2019re next':`${t-1} part${t-1==1?'y':'ies'} ahead of you`}),(0,c.jsxs)(n.T,{weight:"semibold",children:["Estimated wait: about ",(0,o.estimateWait)(t,j.settings.turnMins,C)," minutes"]}),(0,c.jsxs)(n.Muted,{children:["Estimate only \u2014 based on tables in use, typical turn times and today\u2019s forecast. Joined ",(0,a.minsBetween)(new Date(k.joinedAt),p)," min ago."]})]}),'notified'===k.status?(0,c.jsx)(n.Banner,{kind:"success",title:"Your table is ready!",children:"Please come to the door within 5 minutes to keep your table."}):(0,c.jsx)(n.Banner,{kind:"info",children:"We\u2019ll notify you when your table is ready (push/SMS simulated in this prototype)."}),(0,c.jsx)(n.Button,{kind:"secondary",label:"Leave the waitlist",onPress:()=>u.repo.waitlist.setStatus(k.id,'removed')})]})}return(0,c.jsxs)(n.Screen,{title:"Join the waitlist",subtitle:j.name,children:[(0,c.jsxs)(n.Card,{children:[(0,c.jsxs)(n.H2,{children:[T.length," part",1===T.length?'y':'ies'," waiting"]}),(0,c.jsxs)(n.Muted,{children:["Estimated wait if you join now: about ",(0,o.estimateWait)(T.length+1,j.settings.turnMins,C)," minutes (estimate)."]})]}),(0,c.jsx)(n.Field,{label:"Name",value:v,onChangeText:P}),(0,c.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(n.T,{weight:"semibold",children:"Party size"}),(0,c.jsx)(n.Stepper,{value:M,onChange:S,min:1,max:12,label:"party size"})]}),(0,c.jsx)(n.Button,{label:"Join the queue",disabled:v.trim().length<2,onPress:()=>u.repo.waitlist.join(j.id,v,M,x.id),testID:"join-waitlist"}),(0,c.jsx)(n.Muted,{children:"Waitlist messages are service messages only \u2014 no marketing."})]})}},787,[804,30,813,818,868,869,819,821,24]); \ No newline at end of file diff --git a/wildings/chef-app/_expo/static/js/web/whatson-0608a899f634d91b081b758137ce1d33.js b/wildings/chef-app/_expo/static/js/web/whatson-0608a899f634d91b081b758137ce1d33.js new file mode 100644 index 0000000000000000000000000000000000000000..abf259f4e2342c74ccd15500939171c44aad5f27 --- /dev/null +++ b/wildings/chef-app/_expo/static/js/web/whatson-0608a899f634d91b081b758137ce1d33.js @@ -0,0 +1 @@ +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return h}});var t=_r(_d[0]),l=_r(_d[1]),n=_r(_d[2]),s=e(_r(_d[3])),o=e(_r(_d[4])),a=_r(_d[5]),r=_r(_d[6]),d=_r(_d[7]),i=_r(_d[8]),u=_r(_d[9]);const c=e=>'bank-holiday'===e.kind?(0,u.jsx)(a.Badge,{kind:"blue",label:"Scottish bank holiday"}):'school-holiday'===e.kind?(0,u.jsx)(a.Badge,{kind:"neutral",label:"School holiday"}):'occasion'===e.kind?(0,u.jsx)(a.Badge,{kind:"gold",label:"Key dining date"}):(0,u.jsx)(a.Badge,{kind:"ok",label:"Restaurant event"});function h(){const{rid:e}=(0,t.useLocalSearchParams)(),h=(0,d.useRestaurant)(e),x=(0,d.useEvents)(e),y=(0,d.useNow)(6e4),[j,f]=(0,n.useState)(()=>new Date(y.getFullYear(),y.getMonth(),1)),[b,k]=(0,n.useState)(null);if(!h)return(0,u.jsx)(a.Screen,{title:"Not found",children:(0,u.jsx)(a.T,{children:"Restaurant not found."})});const p=(new Date(j).getDay()+6)%7,w=new Date(j.getFullYear(),j.getMonth()+1,0).getDate(),M=[...Array(p).fill(null),...Array.from({length:w},(e,t)=>new Date(j.getFullYear(),j.getMonth(),t+1))];for(;M.length%7;)M.push(null);const D=e=>x.filter(t=>t.date===e),v=x.filter(e=>e.date>=(0,r.ymd)(y)).sort((e,t)=>e.date.localeCompare(t.date)),S=b?D(b):v.slice(0,20);return(0,u.jsxs)(a.Screen,{title:"What\u2019s on",subtitle:`${h.name} \xb7 holidays, key dates and events`,children:[(0,u.jsxs)(a.Card,{children:[(0,u.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(a.Button,{small:!0,kind:"ghost",label:"\u2039 Prev",onPress:()=>f(new Date(j.getFullYear(),j.getMonth()-1,1))}),(0,u.jsxs)(a.H2,{children:[(0,r.monthLong)(j.getMonth())," ",j.getFullYear()]}),(0,u.jsx)(a.Button,{small:!0,kind:"ghost",label:"Next \u203a",onPress:()=>f(new Date(j.getFullYear(),j.getMonth()+1,1))})]}),(0,u.jsx)(o.default,{style:{flexDirection:'row'},children:['Mon','Tue','Wed','Thu','Fri','Sat','Sun'].map(e=>(0,u.jsx)(a.T,{size:13,colour:i.colours.muted,style:{flex:1,textAlign:'center'},children:e},e))}),Array.from({length:M.length/7}).map((e,t)=>(0,u.jsx)(o.default,{style:{flexDirection:'row'},children:M.slice(7*t,7*t+7).map((e,t)=>{if(!e)return(0,u.jsx)(o.default,{style:{flex:1,height:44}},t);const l=(0,r.ymd)(e),n=D(l),d=l===(0,r.ymd)(y);return(0,u.jsxs)(s.default,{accessibilityLabel:`${l}${n.length?`, ${n.length} events`:''}`,onPress:()=>k(b===l?null:l),style:{flex:1,height:44,alignItems:'center',justifyContent:'center',borderRadius:8,backgroundColor:b===l?i.colours.goldTint:'transparent',borderWidth:d?1:0,borderColor:i.colours.gold},children:[(0,u.jsx)(a.T,{size:15,colour:n.length?i.colours.text:i.colours.muted,weight:n.length?'semibold':'regular',children:e.getDate()}),(0,u.jsx)(a.Row,{gap:2,children:n.slice(0,3).map(e=>(0,u.jsx)(o.default,{style:{width:6,height:6,borderRadius:3,backgroundColor:'bank-holiday'===e.kind?i.colours.blue:'event'===e.kind?i.colours.ok:i.colours.gold}},e.id))})]},t)})},t))]}),(0,u.jsx)(a.H2,{children:b?(0,r.niceDateYear)((0,r.parseYmd)(b)):'Coming up'}),0===S.length?(0,u.jsx)(a.Muted,{children:"Nothing on this day."}):S.map(e=>(0,u.jsxs)(a.Card,{children:[(0,u.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(a.T,{weight:"semibold",style:{flex:1},children:(0,l.holidayName)(e.title)}),c(e)]}),(0,u.jsxs)(a.Muted,{children:[(0,r.niceDateYear)((0,r.parseYmd)(e.date)),e.source?` \xb7 source: ${e.source}`:'']}),(0,u.jsx)(a.T,{size:15,children:e.description}),e.example?(0,u.jsx)(a.Badge,{kind:"amber",label:"EXAMPLE EVENT"}):null,e.date>=(0,r.ymd)(y)?(0,u.jsx)(a.Button,{small:!0,kind:"secondary",label:"Book for this date",onPress:()=>t.router.push({pathname:'/customer/[rid]/book',params:{rid:h.id,date:e.date}})}):null]},e.id)),(0,u.jsx)(a.Muted,{children:"Bank holidays from gov.uk (Scotland division). Easter Monday is not a Scottish bank holiday; local council holidays vary."})]})}},788,[804,828,30,263,127,813,818,819,821,24]); \ No newline at end of file diff --git a/wildings/chef-app/assets/assets/brand/3idiots-hero.e5dfd53739f05086b1956e72d585a66a.png b/wildings/chef-app/assets/assets/brand/3idiots-hero.e5dfd53739f05086b1956e72d585a66a.png new file mode 100644 index 0000000000000000000000000000000000000000..2e446272d0a845beb3088e0cee34196647e29c23 Binary files /dev/null and b/wildings/chef-app/assets/assets/brand/3idiots-hero.e5dfd53739f05086b1956e72d585a66a.png differ diff --git a/wildings/chef-app/assets/assets/brand/3idiots.df4a76d2130f0e5b0042f06a8c88693a.png b/wildings/chef-app/assets/assets/brand/3idiots.df4a76d2130f0e5b0042f06a8c88693a.png new file mode 100644 index 0000000000000000000000000000000000000000..b1c9eb1238803902dadd5dea27bc70e2534fe9c9 Binary files /dev/null and b/wildings/chef-app/assets/assets/brand/3idiots.df4a76d2130f0e5b0042f06a8c88693a.png differ diff --git a/wildings/chef-app/assets/assets/brand/cecchinis-hero.f77780fcc94fd668cf35d66d6dc52d81.png b/wildings/chef-app/assets/assets/brand/cecchinis-hero.f77780fcc94fd668cf35d66d6dc52d81.png new file mode 100644 index 0000000000000000000000000000000000000000..eaa9f86fe6bf1d3686094aade77c5affd33a83e9 Binary files /dev/null and b/wildings/chef-app/assets/assets/brand/cecchinis-hero.f77780fcc94fd668cf35d66d6dc52d81.png differ diff --git a/wildings/chef-app/assets/assets/brand/cecchinis.ebf752fef363247848ae7c0d91938765.png b/wildings/chef-app/assets/assets/brand/cecchinis.ebf752fef363247848ae7c0d91938765.png new file mode 100644 index 0000000000000000000000000000000000000000..b8f03a0d4fc5f27c9e12ed2c9608768e4ea99b13 Binary files /dev/null and b/wildings/chef-app/assets/assets/brand/cecchinis.ebf752fef363247848ae7c0d91938765.png differ diff --git a/wildings/chef-app/assets/assets/brand/drunkencoo-hero.65c21c4da9e466cf4bffc969639a1427.png b/wildings/chef-app/assets/assets/brand/drunkencoo-hero.65c21c4da9e466cf4bffc969639a1427.png new file mode 100644 index 0000000000000000000000000000000000000000..d8d873eb2a092b421971a45e74cc781ac1e662ce --- /dev/null +++ b/wildings/chef-app/assets/assets/brand/drunkencoo-hero.65c21c4da9e466cf4bffc969639a1427.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d34dbfb5dfa4bdf53dd8568f4e380376d4375719d06b2eb4fb853c4f81d7fdfd +size 698721 diff --git a/wildings/chef-app/assets/assets/brand/drunkencoo.f6d92af3b14e4205a3deaf4434754c51.png b/wildings/chef-app/assets/assets/brand/drunkencoo.f6d92af3b14e4205a3deaf4434754c51.png new file mode 100644 index 0000000000000000000000000000000000000000..1bc0d9301938d1b596ec309c50666999e6d21f91 --- /dev/null +++ b/wildings/chef-app/assets/assets/brand/drunkencoo.f6d92af3b14e4205a3deaf4434754c51.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a5f471d9fff5a9b0c15f7b3b77567d29b54601833bdb27a8b15dcd3472c61d54 +size 269636 diff --git a/wildings/chef-app/assets/assets/brand/mrbasrais-hero.4ce74641cfcf52d099157c84005b9d2a.png b/wildings/chef-app/assets/assets/brand/mrbasrais-hero.4ce74641cfcf52d099157c84005b9d2a.png new file mode 100644 index 0000000000000000000000000000000000000000..590e0a14d8a11a4c7dfca5af0fff386f6a3745cf --- /dev/null +++ b/wildings/chef-app/assets/assets/brand/mrbasrais-hero.4ce74641cfcf52d099157c84005b9d2a.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:84d351c73f9c25516cf14074839d0105a9b9ba3ae3e478662f30b8921c347ec1 +size 1112647 diff --git a/wildings/chef-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png b/wildings/chef-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png new file mode 100644 index 0000000000000000000000000000000000000000..72c07bb4c5de417a700e024030f077064d431eca --- /dev/null +++ b/wildings/chef-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f158faa60673366b326c53447113ca34e67686fa64f1844e42f4f6d88b65e65d +size 277639 diff --git a/wildings/chef-app/assets/assets/brand/pizzaioli-hero.1896657c08264cefb49b401891d5448d.png b/wildings/chef-app/assets/assets/brand/pizzaioli-hero.1896657c08264cefb49b401891d5448d.png new file mode 100644 index 0000000000000000000000000000000000000000..1fef9aa933df510cfa5ba55cbfbc5cbff8650358 Binary files /dev/null and b/wildings/chef-app/assets/assets/brand/pizzaioli-hero.1896657c08264cefb49b401891d5448d.png differ diff --git a/wildings/chef-app/assets/assets/brand/pizzaioli.db8c000b62ee407121aa8b90ce45e170.png b/wildings/chef-app/assets/assets/brand/pizzaioli.db8c000b62ee407121aa8b90ce45e170.png new file mode 100644 index 0000000000000000000000000000000000000000..5d69e071543c661a62c2867a9d18caf668fcabfd Binary files /dev/null and b/wildings/chef-app/assets/assets/brand/pizzaioli.db8c000b62ee407121aa8b90ce45e170.png differ diff --git a/wildings/chef-app/assets/assets/brand/rupeeroom-hero.969fa372add526aaacf3a6c009b8ac92.png b/wildings/chef-app/assets/assets/brand/rupeeroom-hero.969fa372add526aaacf3a6c009b8ac92.png new file mode 100644 index 0000000000000000000000000000000000000000..1a9cfd3eb85d39201414d471e3b0fdd04fa6fc0a --- /dev/null +++ b/wildings/chef-app/assets/assets/brand/rupeeroom-hero.969fa372add526aaacf3a6c009b8ac92.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:78d996318f4f42b1487cd98a0388afeed74b203f0affd751b560c4800d7245fc +size 202873 diff --git a/wildings/chef-app/assets/assets/brand/rupeeroom.689e6fb536dc0845eeb174a1ec7bd346.png b/wildings/chef-app/assets/assets/brand/rupeeroom.689e6fb536dc0845eeb174a1ec7bd346.png new file mode 100644 index 0000000000000000000000000000000000000000..ea53304d845f739a27d457d23301c62c0251dc30 --- /dev/null +++ b/wildings/chef-app/assets/assets/brand/rupeeroom.689e6fb536dc0845eeb174a1ec7bd346.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9e5d3c42d7bad91f89b6f8fa5175690af0715c0a3530e9cb29f03711c5485584 +size 328985 diff --git a/wildings/chef-app/assets/assets/brand/smokinggoat-hero.0588f17ef0eed7f757f22916cd4d37db.png b/wildings/chef-app/assets/assets/brand/smokinggoat-hero.0588f17ef0eed7f757f22916cd4d37db.png new file mode 100644 index 0000000000000000000000000000000000000000..41eb90d496d436c5a1c9bd75a7a7d582a87cf8b2 --- /dev/null +++ b/wildings/chef-app/assets/assets/brand/smokinggoat-hero.0588f17ef0eed7f757f22916cd4d37db.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4b1263d88572831916951be4a5b260227e50a601141e9889db8e65c6bf50442f +size 798774 diff --git a/wildings/chef-app/assets/assets/brand/smokinggoat.20a3a1970596ab43c5d6468d4ed549a7.png b/wildings/chef-app/assets/assets/brand/smokinggoat.20a3a1970596ab43c5d6468d4ed549a7.png new file mode 100644 index 0000000000000000000000000000000000000000..a3469248aaae9eddb25cb731a5c97aa238999047 --- /dev/null +++ b/wildings/chef-app/assets/assets/brand/smokinggoat.20a3a1970596ab43c5d6468d4ed549a7.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:29ea131dc0b9d445629c5ebda6e750672d99eb6b4861c5a4d9bfb7c0ff676802 +size 1039758 diff --git a/wildings/chef-app/assets/assets/brand/williewastles-hero.b9d53d27b66f903b5618a7177b2ffad4.png b/wildings/chef-app/assets/assets/brand/williewastles-hero.b9d53d27b66f903b5618a7177b2ffad4.png new file mode 100644 index 0000000000000000000000000000000000000000..adbf5b12d5896e877b06bb17e331b9fd5bb78b3b --- /dev/null +++ b/wildings/chef-app/assets/assets/brand/williewastles-hero.b9d53d27b66f903b5618a7177b2ffad4.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2f3522fa2a95138059db94eb1261b0b023811e86c5162d78943fe05ebfa8a08f +size 261822 diff --git a/wildings/chef-app/assets/assets/brand/williewastles.055a77893ced99bf3a6c5402ba5baac6.png b/wildings/chef-app/assets/assets/brand/williewastles.055a77893ced99bf3a6c5402ba5baac6.png new file mode 100644 index 0000000000000000000000000000000000000000..850387113149eb9b7d42f28791bbd7240675b494 --- /dev/null +++ b/wildings/chef-app/assets/assets/brand/williewastles.055a77893ced99bf3a6c5402ba5baac6.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e14330774bff07ba32b1bb88e7cf88578cc9f7a0a36e8a636d4bc31fc3fc2a3d +size 318451 diff --git a/wildings/chef-app/assets/assets/brand/yasmins-hero.a5aef62e37dfcecbe0afc056186f4ad9.png b/wildings/chef-app/assets/assets/brand/yasmins-hero.a5aef62e37dfcecbe0afc056186f4ad9.png new file mode 100644 index 0000000000000000000000000000000000000000..399d860a2021715fdd9dbe901ac330ab234aa2b2 --- /dev/null +++ b/wildings/chef-app/assets/assets/brand/yasmins-hero.a5aef62e37dfcecbe0afc056186f4ad9.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:31ad6818e24c7174f3946950cdad27a1ea249e5c5d19c12be21af0381f40fc3f +size 1392386 diff --git a/wildings/chef-app/assets/assets/brand/yasmins.8482602e9f0a965655924835625cb02b.png b/wildings/chef-app/assets/assets/brand/yasmins.8482602e9f0a965655924835625cb02b.png new file mode 100644 index 0000000000000000000000000000000000000000..47d980eaa2835e4895b50488e62f23708063ce30 --- /dev/null +++ b/wildings/chef-app/assets/assets/brand/yasmins.8482602e9f0a965655924835625cb02b.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:feb6e0b270e345c68a3ba54e53b50d0f553e1b706c95abe54a212f773e407dba +size 556650 diff --git a/wildings/chef-app/index.html b/wildings/chef-app/index.html index 09e225f8882687f0bdf4bbb82abb8a38c44040b8..6272cb6a3dbc04582b953507d04a27aaeaf9472d 100644 --- a/wildings/chef-app/index.html +++ b/wildings/chef-app/index.html @@ -35,6 +35,6 @@
Wildings Hotel & Restaurant
- + diff --git a/wildings/chef-app/kitchen.html b/wildings/chef-app/kitchen.html index 09e225f8882687f0bdf4bbb82abb8a38c44040b8..6272cb6a3dbc04582b953507d04a27aaeaf9472d 100644 --- a/wildings/chef-app/kitchen.html +++ b/wildings/chef-app/kitchen.html @@ -35,6 +35,6 @@
Wildings Hotel & Restaurant
- + diff --git a/wildings/chef-app/sw.js b/wildings/chef-app/sw.js index 2028e5fdfa9e7188ac7290bb89af4d6d74275b41..317c7a58d7c3c222d897b34e2ae835fcb5250e2d 100644 --- a/wildings/chef-app/sw.js +++ b/wildings/chef-app/sw.js @@ -1,4 +1,4 @@ -const V="cc-wildings-chef-eb145da2fc55",B="/wildings/chef-app/",P=["/wildings/chef-app/apple-touch-icon.png", "/wildings/chef-app/favicon.ico", "/wildings/chef-app/icon-192.png", "/wildings/chef-app/icon-512.png", "/wildings/chef-app/brand-logo.png", "/wildings/chef-app/index.html", "/wildings/chef-app/manifest.webmanifest", "/wildings/chef-app/brand-hero.png", "/wildings/chef-app/kitchen.html", "/wildings/chef-app/_expo/static/js/web/[section]-7680005b9f9a2edf6bc1f22af6918f1c.js", "/wildings/chef-app/_expo/static/js/web/waitlist-0320ee6701e15c6f75e009195ede6649.js", "/wildings/chef-app/_expo/static/js/web/index-374f32ca8b3acd4c473cb67f0be4a5c1.js", "/wildings/chef-app/_expo/static/js/web/basket-b8721424d77f8fff3bcb7938bf6f00a9.js", "/wildings/chef-app/_expo/static/js/web/index-973ada74f56035815426979f31f74d4e.js", "/wildings/chef-app/_expo/static/js/web/lost-8f9c0dd7edb0230b1a7643d0a4db9b94.js", "/wildings/chef-app/_expo/static/js/web/index-211547d129e0d3caec0f08222b2568b5.js", "/wildings/chef-app/_expo/static/js/web/index-0994a8297a116c063b7c5486cd93f4cf.js", "/wildings/chef-app/_expo/static/js/web/__common-d67e9bed3f0a087866fa007729175cfb.js", "/wildings/chef-app/_expo/static/js/web/whatson-9d1e33597e23613f788dd1a65097d805.js", "/wildings/chef-app/_expo/static/js/web/index-aa80a45d20901c92ac80bce3e7f15e09.js", "/wildings/chef-app/_expo/static/js/web/_layout-5559338e770db3d62870f656f29aa03f.js", "/wildings/chef-app/_expo/static/js/web/feedback-d9f2534b23e5222df62036cf5c589115.js", "/wildings/chef-app/_expo/static/js/web/historicalBookingApi-62d8e1e37769091c643c5a7d45233992.js", "/wildings/chef-app/_expo/static/js/web/demo-83f3a2ec0a7b15fde8c581deca3aacba.js", "/wildings/chef-app/_expo/static/js/web/profile-8ee64849d80e5e4fbc355334da657495.js", "/wildings/chef-app/_expo/static/js/web/book-e85de1237680ea1ed22194e431f4aae4.js", "/wildings/chef-app/_expo/static/js/web/[did]-227a2f79a620251d29d8f8e716ee8bdb.js", "/wildings/chef-app/_expo/static/js/web/__expo-metro-runtime-8c088df87a31e4e6accd81c554ec290d.js", "/wildings/chef-app/_expo/static/js/web/gift-816d52e2568f34226fab48f95bd8cd2d.js", "/wildings/chef-app/_expo/static/js/web/index-7f576d06daba45ac2e688bdb3e419638.js", "/wildings/chef-app/_expo/static/js/web/refer-e81d5904668ca019b14c4a55cb5fe496.js", "/wildings/chef-app/_expo/static/js/web/index-9b73737315d8d526628ed6b975f9a47d.js", "/wildings/chef-app/_expo/static/js/web/loyalty-839ff8850648a9e774e292154875f015.js", "/wildings/chef-app/_expo/static/js/web/index-6ff9008e6ddc971ef1cd72c414e77874.js", "/wildings/chef-app/_expo/static/js/web/[n]-3078b1d37581aff4da1ffebe18afde8a.js", "/wildings/chef-app/_expo/static/js/web/index-fce41716c537fda80103664215263619.js", "/wildings/chef-app/_expo/static/js/web/offers-9686678f09e067586de55260ff3a98e5.js", "/wildings/chef-app/_expo/static/js/web/[token]-162c6a07a8527299beace11ffd4eb896.js", "/wildings/chef-app/_expo/static/js/web/index-1b9fb56cba80809b86d77e037bccff9c.js", "/wildings/chef-app/_expo/static/js/web/[oid]-79da5afa34641052ac0acd9d446a2fdc.js", "/wildings/chef-app/_expo/static/js/web/merch-f6c0131852806f70f1f5125fabbb0386.js", "/wildings/chef-app/_expo/static/js/web/+not-found-a9acde932f0ed95cf1e7409e88874f97.js", "/wildings/chef-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/wildings/chef-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/wildings/chef-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/wildings/chef-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/wildings/chef-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/wildings/chef-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/wildings/chef-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/wildings/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/wildings/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/wildings/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/wildings/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/wildings/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/wildings/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/wildings/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/wildings/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/wildings/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/wildings/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/wildings/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/wildings/chef-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/wildings/chef-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/wildings/chef-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/wildings/chef-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/wildings/chef-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/wildings/chef-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/wildings/chef-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/wildings/chef-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/wildings/chef-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/wildings/chef-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/wildings/chef-app/assets/assets/brand/wildings.076f4fcd06d19a0af0205c410f461b14.png", "/wildings/chef-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/wildings/chef-app/assets/assets/brand/kirkmichael.63b13cde7fd82eb622622b39ac80c394.png", "/wildings/chef-app/assets/assets/brand/brae.8de9e89ac30966c6669de990370d8e40.png", "/wildings/chef-app/assets/assets/brand/kirkmichael-hero.63b13cde7fd82eb622622b39ac80c394.png", "/wildings/chef-app/assets/assets/brand/greenside.9d1556db97dcb903a3c57e2063ee2255.png", "/wildings/chef-app/assets/assets/brand/abbotsford-hero.78fcb8ee06ee22c4ca659c9254db7512.png", "/wildings/chef-app/assets/assets/brand/kirkton.bcf8d846df4861474d224a7a77f498fb.png", "/wildings/chef-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/wildings/chef-app/assets/assets/brand/wildings-hero-logo-text.4661e4b935726f2511f9c17a1567c89a.png", "/wildings/chef-app/assets/assets/brand/kirkton-hero.9d0837b292c2f4f30f4521d806bb28c3.png", "/wildings/chef-app/assets/assets/brand/saltmarsh.85a6a65732635e5148478d743d9ca884.png", "/wildings/chef-app/assets/assets/brand/souters.f4c58d9349b6e1700fe5abcc9e9b665c.png", "/wildings/chef-app/assets/assets/brand/greenside-hero.1caec5a6cb939434cccb5f3a613b50f8.png", "/wildings/chef-app/assets/assets/brand/abbotsford.b26602bba5ce4969733c5422a45ad053.png"]; +const V="cc-wildings-chef-ac4092aad6ab",B="/wildings/chef-app/",P=["/wildings/chef-app/apple-touch-icon.png", "/wildings/chef-app/favicon.ico", "/wildings/chef-app/icon-192.png", "/wildings/chef-app/icon-512.png", "/wildings/chef-app/brand-logo.png", "/wildings/chef-app/index.html", "/wildings/chef-app/manifest.webmanifest", "/wildings/chef-app/brand-hero.png", "/wildings/chef-app/kitchen.html", "/wildings/chef-app/_expo/static/js/web/feedback-3a26c70c9f758c4e362493c3b124ff43.js", "/wildings/chef-app/_expo/static/js/web/[n]-ced785c534ba69ad6c9c35369d7ecc36.js", "/wildings/chef-app/_expo/static/js/web/index-f9b07e7c25cec3623c10876ff1e01e58.js", "/wildings/chef-app/_expo/static/js/web/[section]-93e8e4ffe952e5b3c505e21ca771e570.js", "/wildings/chef-app/_expo/static/js/web/index-a39af53b0c36f30a0cc27647d3da5a52.js", "/wildings/chef-app/_expo/static/js/web/offers-3f4e351ccaa73514bd508bf7bd2a3fa2.js", "/wildings/chef-app/_expo/static/js/web/[oid]-7fa4f78cb447d1c659e81fff8893269f.js", "/wildings/chef-app/_expo/static/js/web/index-4a8e84fd487a5f2cafba4c6915cad230.js", "/wildings/chef-app/_expo/static/js/web/index-9ab206088a709796371257b9528a09bc.js", "/wildings/chef-app/_expo/static/js/web/[did]-2a2aaaa129307f15140971a22b834cd3.js", "/wildings/chef-app/_expo/static/js/web/demo-6323990816bb686dcab3b33d7e6ec148.js", "/wildings/chef-app/_expo/static/js/web/__common-93af529389481e03a464b9d90c2a0dbe.js", "/wildings/chef-app/_expo/static/js/web/index-08b1a356fa4d0861778c41e3b0186d1f.js", "/wildings/chef-app/_expo/static/js/web/book-b68aff7cd8daa9b5d327ece648db8831.js", "/wildings/chef-app/_expo/static/js/web/index-a234f55f1edf32204a015d4a1f3cfb17.js", "/wildings/chef-app/_expo/static/js/web/index-abf44c56ecfe3a6ee457b5a1c56cb955.js", "/wildings/chef-app/_expo/static/js/web/waitlist-93752bc9a9a8df911b095d236fa3f385.js", "/wildings/chef-app/_expo/static/js/web/__expo-metro-runtime-8c088df87a31e4e6accd81c554ec290d.js", "/wildings/chef-app/_expo/static/js/web/merch-dcc4bf2e12c5c983cc8637b3dae25ae6.js", "/wildings/chef-app/_expo/static/js/web/refer-9cf3652c6de6015e443d52d85aa73db7.js", "/wildings/chef-app/_expo/static/js/web/profile-7858c56bba02a864da6a44be8f8ce02f.js", "/wildings/chef-app/_expo/static/js/web/_layout-ce40d6b7f030f3caa7a4b795d8321697.js", "/wildings/chef-app/_expo/static/js/web/historicalBookingApi-ff0d2cc94233829c958f76620e3eefde.js", "/wildings/chef-app/_expo/static/js/web/gift-eb5daa22c1465e33034a87271e1b8b3b.js", "/wildings/chef-app/_expo/static/js/web/lost-53fa50fd975a0e31c68fdd69575c2342.js", "/wildings/chef-app/_expo/static/js/web/index-3c5f820b3b21978c61372b3163c55b0a.js", "/wildings/chef-app/_expo/static/js/web/+not-found-585f3164ae74e5ff35af71a4ba7360a3.js", "/wildings/chef-app/_expo/static/js/web/loyalty-f6d17fe0987432e6c679359636231949.js", "/wildings/chef-app/_expo/static/js/web/index-10b44538fce9f65ce117321a623552df.js", "/wildings/chef-app/_expo/static/js/web/basket-4d740db9aeba1d77232a0091a5892917.js", "/wildings/chef-app/_expo/static/js/web/index-837efe1be9c39737e9750ae18a91c7cb.js", "/wildings/chef-app/_expo/static/js/web/whatson-0608a899f634d91b081b758137ce1d33.js", "/wildings/chef-app/_expo/static/js/web/[token]-bee6add88cca58f03680987578d45fcf.js", "/wildings/chef-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/wildings/chef-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/wildings/chef-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/wildings/chef-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/wildings/chef-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/wildings/chef-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/wildings/chef-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/wildings/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/wildings/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/wildings/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/wildings/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/wildings/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/wildings/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/wildings/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/wildings/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/wildings/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/wildings/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/wildings/chef-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/wildings/chef-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/wildings/chef-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/wildings/chef-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/wildings/chef-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/wildings/chef-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/wildings/chef-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/wildings/chef-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/wildings/chef-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/wildings/chef-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/wildings/chef-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/wildings/chef-app/assets/assets/brand/wildings.076f4fcd06d19a0af0205c410f461b14.png", "/wildings/chef-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/wildings/chef-app/assets/assets/brand/3idiots-hero.e5dfd53739f05086b1956e72d585a66a.png", "/wildings/chef-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png", "/wildings/chef-app/assets/assets/brand/cecchinis.ebf752fef363247848ae7c0d91938765.png", "/wildings/chef-app/assets/assets/brand/kirkmichael.63b13cde7fd82eb622622b39ac80c394.png", "/wildings/chef-app/assets/assets/brand/3idiots.df4a76d2130f0e5b0042f06a8c88693a.png", "/wildings/chef-app/assets/assets/brand/brae.8de9e89ac30966c6669de990370d8e40.png", "/wildings/chef-app/assets/assets/brand/rupeeroom-hero.969fa372add526aaacf3a6c009b8ac92.png", "/wildings/chef-app/assets/assets/brand/kirkmichael-hero.63b13cde7fd82eb622622b39ac80c394.png", "/wildings/chef-app/assets/assets/brand/williewastles.055a77893ced99bf3a6c5402ba5baac6.png", "/wildings/chef-app/assets/assets/brand/drunkencoo-hero.65c21c4da9e466cf4bffc969639a1427.png", "/wildings/chef-app/assets/assets/brand/pizzaioli-hero.1896657c08264cefb49b401891d5448d.png", "/wildings/chef-app/assets/assets/brand/drunkencoo.f6d92af3b14e4205a3deaf4434754c51.png", "/wildings/chef-app/assets/assets/brand/smokinggoat.20a3a1970596ab43c5d6468d4ed549a7.png", "/wildings/chef-app/assets/assets/brand/greenside.9d1556db97dcb903a3c57e2063ee2255.png", "/wildings/chef-app/assets/assets/brand/abbotsford-hero.78fcb8ee06ee22c4ca659c9254db7512.png", "/wildings/chef-app/assets/assets/brand/rupeeroom.689e6fb536dc0845eeb174a1ec7bd346.png", "/wildings/chef-app/assets/assets/brand/kirkton.bcf8d846df4861474d224a7a77f498fb.png", "/wildings/chef-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/wildings/chef-app/assets/assets/brand/williewastles-hero.b9d53d27b66f903b5618a7177b2ffad4.png", "/wildings/chef-app/assets/assets/brand/pizzaioli.db8c000b62ee407121aa8b90ce45e170.png", "/wildings/chef-app/assets/assets/brand/yasmins-hero.a5aef62e37dfcecbe0afc056186f4ad9.png", "/wildings/chef-app/assets/assets/brand/wildings-hero-logo-text.4661e4b935726f2511f9c17a1567c89a.png", "/wildings/chef-app/assets/assets/brand/yasmins.8482602e9f0a965655924835625cb02b.png", "/wildings/chef-app/assets/assets/brand/kirkton-hero.9d0837b292c2f4f30f4521d806bb28c3.png", "/wildings/chef-app/assets/assets/brand/saltmarsh.85a6a65732635e5148478d743d9ca884.png", "/wildings/chef-app/assets/assets/brand/souters.f4c58d9349b6e1700fe5abcc9e9b665c.png", "/wildings/chef-app/assets/assets/brand/greenside-hero.1caec5a6cb939434cccb5f3a613b50f8.png", "/wildings/chef-app/assets/assets/brand/abbotsford.b26602bba5ce4969733c5422a45ad053.png", "/wildings/chef-app/assets/assets/brand/smokinggoat-hero.0588f17ef0eed7f757f22916cd4d37db.png", "/wildings/chef-app/assets/assets/brand/cecchinis-hero.f77780fcc94fd668cf35d66d6dc52d81.png", "/wildings/chef-app/assets/assets/brand/mrbasrais-hero.4ce74641cfcf52d099157c84005b9d2a.png"]; self.addEventListener('install',e=>e.waitUntil(caches.open(V).then(c=>Promise.all(P.map(u=>fetch(u).then(r=>r.blob().then(b=>c.put(u,new Response(b,{status:200,headers:{'Content-Type':r.headers.get('Content-Type')||b.type}}))))))).then(()=>self.skipWaiting()))); self.addEventListener('activate',e=>e.waitUntil(caches.keys().then(ks=>Promise.all(ks.filter(k=>k.startsWith('cc-wildings-chef-')&&k!==V).map(k=>caches.delete(k)))).then(()=>self.clients.claim()))); self.addEventListener('fetch',e=>{const u=new URL(e.request.url);if(e.request.method!=='GET'||u.origin!==location.origin||!u.pathname.startsWith(B))return;if(e.request.mode==='navigate'){e.respondWith(fetch(e.request).then(r=>r.ok?r:caches.match(B+'index.html')).catch(()=>caches.match(B+'index.html')));return;}e.respondWith(caches.match(e.request,{ignoreSearch:true}).then(r=>r||fetch(e.request)));}); \ No newline at end of file diff --git a/wildings/customer-app/_expo/static/js/web/+not-found-585f3164ae74e5ff35af71a4ba7360a3.js b/wildings/customer-app/_expo/static/js/web/+not-found-585f3164ae74e5ff35af71a4ba7360a3.js new file mode 100644 index 0000000000000000000000000000000000000000..cf2e6d94e8ca98606e0f8533c347ea51139bfdb7 --- /dev/null +++ b/wildings/customer-app/_expo/static/js/web/+not-found-585f3164ae74e5ff35af71a4ba7360a3.js @@ -0,0 +1 @@ +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return c}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]);function c(){return(0,u.jsx)(t.Redirect,{href:n.ENTRY[n.APP_VARIANT]})}},801,[804,30,806,24]); \ No newline at end of file diff --git a/wildings/customer-app/_expo/static/js/web/[did]-2a2aaaa129307f15140971a22b834cd3.js b/wildings/customer-app/_expo/static/js/web/[did]-2a2aaaa129307f15140971a22b834cd3.js new file mode 100644 index 0000000000000000000000000000000000000000..1f0ffb8d5093d5a183dc2a9c0fb7062951faa5c1 --- /dev/null +++ b/wildings/customer-app/_expo/static/js/web/[did]-2a2aaaa129307f15140971a22b834cd3.js @@ -0,0 +1 @@ +__d(function(_g,_r,i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return f}});var t=_r(_d[0]),n=_r(_d[1]),l=e(_r(_d[2])),s=e(_r(_d[3])),r=_r(_d[4]),a=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),g=_r(_d[11]),p=_r(_d[12]);function f(){const{rid:e,did:f}=(0,t.useLocalSearchParams)(),b=(0,u.useRestaurant)(e),j=(0,u.useMenu)(e).find(e=>e.id===f),x=(0,u.useCustomer)(),m=(0,u.useRecipeCards)(e).find(e=>e.id===j?.recipeCardId),y=m?.signOff&&m.photo?(0,h.recipeCards)().photoSource(m.photo):null,k=(0,u.useStore)(e=>e.addLine),[v,w]=(0,n.useState)(()=>(j?.optionGroups??[]).filter(e=>e.required).map(e=>e.choices[0].id)),[S,C]=(0,n.useState)(1),[B,$]=(0,n.useState)(''),[I,P]=(0,n.useState)(!1),[L,T]=(0,n.useState)(!1),[D,O]=(0,n.useState)(!1),[A,M]=(0,n.useState)(!1),R=(0,n.useMemo)(()=>j?(0,d.effectiveAllergens)(j,v):{},[j,v]);if(!b||!j)return(0,p.jsx)(o.Screen,{title:"Not found",children:(0,p.jsx)(o.T,{children:"Dish not found."})});const q=(0,d.conflictsFor)(R,x.allergies),_=(j.price??0)+(j.optionGroups??[]).flatMap(e=>e.choices).filter(e=>v.includes(e.id)).reduce((e,t)=>e+t.priceDelta,0),N=j.soldOut||!j.signOff||null===j.price,G=(e,t)=>{const n=j.optionGroups.find(t=>t.id===e);w(e=>{const l=n.choices.map(e=>e.id);return n.multi?e.includes(t)?e.filter(e=>e!==t):[...e,t]:e.includes(t)&&!n.required?e.filter(e=>e!==t):[...e.filter(e=>!l.includes(e)),t]})},z=e=>{u.useStore.getState().basket.restaurantId!==b.id&&u.useStore.getState().startBasket(b.id,'takeaway'),k({itemId:j.id,qty:S,choiceIds:v,notes:B,override:e?{allergens:q.contains,at:(new Date).toISOString()}:void 0}),P(!1),M(!0)};return(0,p.jsxs)(o.Screen,{title:j.name,subtitle:b.name,right:(0,p.jsx)(a.BasketButton,{}),children:[y?(0,p.jsx)(l.default,{testID:"dish-photo",source:y,accessibilityLabel:`${j.name}${'example'===m?.origin?' (example photo)':''}`,style:{width:'100%',height:200,borderRadius:12},resizeMode:"cover"}):null,(0,p.jsxs)(o.Row,{wrap:!0,gap:6,children:[(0,p.jsx)(o.T,{weight:"bold",size:20,colour:g.colours.gold,children:null===j.price?j.priceNote:(0,c.gbp)(_)}),j.dietary.map(e=>(0,p.jsx)(o.Badge,{kind:"ok",label:e},e))]}),(0,p.jsx)(o.T,{children:j.description}),q.contains.length?(0,p.jsx)(o.Banner,{kind:"danger",title:`Blocked: contains ${q.contains.map(d.allergenLabel).join(', ')}`,children:`You\u2019ve told us: ${x.allergies.filter(e=>q.contains.includes(e.allergen)).map(e=>`${(0,d.allergenLabel)(e.allergen)} \u2014 ${(0,d.severityLabel)(e.severity)}`).join('; ')}. This dish can\u2019t be added unless you deliberately override (for example, ordering for someone else).`}):null,q.may.length?(0,p.jsx)(o.Banner,{kind:"warn",title:`Warning: may contain ${q.may.map(d.allergenLabel).join(', ')}`,children:"Cross-contact is possible (e.g. shared fryer). Please speak to staff before ordering."}):null,(j.optionGroups??[]).map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsxs)(o.T,{weight:"semibold",children:[e.name,e.required?' (required)':' (optional)']}),(0,p.jsx)(o.Row,{wrap:!0,gap:6,children:e.choices.map(t=>(0,p.jsx)(o.Chip,{label:t.label,sub:t.priceDelta?`+${(0,c.gbp)(t.priceDelta)}`:void 0,selected:v.includes(t.id),onPress:()=>G(e.id,t.id)},t.id))})]},e.id)),(0,p.jsx)(o.Card,{children:(0,p.jsx)(r.AllergenPanel,{item:j,map:R,declared:x.allergies})}),b.fictional?null:(0,p.jsx)(o.ExampleAllergenNotice,{}),(0,p.jsx)(o.Field,{label:"Notes for the kitchen (optional)",placeholder:"e.g. no gherkins",value:B,onChangeText:$}),(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Quantity"}),(0,p.jsx)(o.Stepper,{value:S,onChange:C,label:"quantity"})]}),A?(0,p.jsx)(o.Banner,{kind:"success",title:"Added to basket",children:q.contains.length?'Allergy override recorded \u2014 the kitchen will see a large allergy alert.':'Carry on browsing or go to your basket.'}):null,N?(0,p.jsx)(o.Banner,{kind:"warn",children:j.soldOut?'Sold out today.':j.signOff?'Price on the specials board \u2014 ask staff.':'Not available to order online until the head chef signs off its allergens.'}):q.contains.length?(0,p.jsxs)(s.default,{style:{gap:8},children:[(0,p.jsx)(o.Button,{kind:"secondary",label:"Choose something else",onPress:()=>t.router.back()}),(0,p.jsx)(o.Button,{kind:"danger",label:"Override and add anyway\u2026",onPress:()=>{T(!1),O(!1),P(!0)},testID:"override-open"})]}):(0,p.jsxs)(o.Row,{gap:8,children:[(0,p.jsx)(o.Button,{style:{flex:1},label:`Add ${S} to basket \xb7 ${(0,c.gbp)(_*S)}`,onPress:()=>z(!1),testID:"add-to-basket"}),A?(0,p.jsx)(o.Button,{kind:"secondary",label:"Basket",onPress:()=>t.router.push('/customer/basket')}):null]}),(0,p.jsxs)(o.Sheet,{visible:I,onClose:()=>P(!1),title:"Allergy override",children:[(0,p.jsx)(o.Banner,{kind:"danger",title:`${j.name} contains ${q.contains.map(d.allergenLabel).join(', ')}`,children:`Your profile says: ${x.allergies.filter(e=>q.contains.includes(e.allergen)).map(e=>`${(0,d.allergenLabel)(e.allergen)} \u2014 ${(0,d.severityLabel)(e.severity)}`).join('; ')}.`}),(0,p.jsx)(o.Toggle,{label:"I understand this dish contains an allergen I have declared",value:L,onChange:T}),(0,p.jsx)(o.Toggle,{label:"It is for someone without this allergy, or I have spoken to staff",value:D,onChange:O}),(0,p.jsx)(o.Muted,{children:"The override is logged and shown to the kitchen as an allergy alert that must be acknowledged."}),(0,p.jsx)(o.Button,{kind:"danger",disabled:!L||!D,label:"Confirm override and add",onPress:()=>z(!0),testID:"override-confirm"})]})]})}},778,[804,30,196,127,829,830,813,814,816,819,831,821,24]); \ No newline at end of file diff --git a/wildings/customer-app/_expo/static/js/web/[n]-ced785c534ba69ad6c9c35369d7ecc36.js b/wildings/customer-app/_expo/static/js/web/[n]-ced785c534ba69ad6c9c35369d7ecc36.js new file mode 100644 index 0000000000000000000000000000000000000000..c1ced89e3ab9de89839af726f375c95f9fe94a33 --- /dev/null +++ b/wildings/customer-app/_expo/static/js/web/[n]-ced785c534ba69ad6c9c35369d7ecc36.js @@ -0,0 +1 @@ +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return f}});var t=_r(d[0]),r=_r(d[1]),n=_r(d[2]),o=_r(d[3]),u=_r(d[4]),c=_r(d[5]),s=_r(d[6]),l=_r(d[7]);function f(){const{n:f,r:b}=(0,r.useLocalSearchParams)(),E=(0,u.useStore)(t=>t.startBasket),[_,h]=(0,n.useState)(!1),S=b??c.VENUE_RID,j=(0,u.useOrderAtTable)(S),I=(0,s.guestServer)();return(0,n.useEffect)(()=>{t.LIVE_VENUE_BUILD||I||(j&&E(S,'table',String(f)),h(!0))},[S,f,j,I]),t.LIVE_VENUE_BUILD||I?(0,l.jsx)(o.Screen,{title:"Order at the table",children:(0,l.jsx)(o.Banner,{kind:"demo",title:"Scan the code on your table",children:"To order from your table, scan the QR code printed on it. Or order at the bar."})}):_?(0,l.jsx)(r.Redirect,{href:`/customer/${S}`}):null}},794,[833,804,30,813,819,5,836,24]); \ No newline at end of file diff --git a/wildings/customer-app/_expo/static/js/web/[oid]-7fa4f78cb447d1c659e81fff8893269f.js b/wildings/customer-app/_expo/static/js/web/[oid]-7fa4f78cb447d1c659e81fff8893269f.js new file mode 100644 index 0000000000000000000000000000000000000000..f0fcaabb7a82273cae61ec240fcab227e980b17e --- /dev/null +++ b/wildings/customer-app/_expo/static/js/web/[oid]-7fa4f78cb447d1c659e81fff8893269f.js @@ -0,0 +1 @@ +__d(function(g,_r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return f}});var e,t=_r(d[0]),s=_r(d[1]),l=_r(d[2]),r=_r(d[3]),n=(e=r)&&e.__esModule?e:{default:e},o=_r(d[4]),i=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]),p=_r(d[9]),b=_r(d[10]),y=_r(d[11]),j=_r(d[12]);const x=[['new','Placed'],['acknowledged','Accepted'],['preparing','Cooking'],['ready','Ready to collect'],['collected','Collected']],w=[['new','Sent'],['acknowledged','Accepted'],['preparing','Cooking'],['served','Food out'],['closed','Paid']];function f(){const{oid:e}=(0,s.useLocalSearchParams)(),r=(0,b.useOrder)(e),f=(0,b.useRestaurant)(r?.restaurantId),[C,S]=(0,l.useState)(0),[k,T]=(0,l.useState)(''),[v,P]=(0,l.useState)(!1),[M,$]=(0,l.useState)(!1),[R,A]=(0,l.useState)(1),[I,N]=(0,l.useState)(0),[O,B]=(0,l.useState)(r?.split?.ways??1);if(!r||!f)return(0,j.jsx)(c.Screen,{title:"Order",children:(0,j.jsx)(c.T,{children:"Order not found."})});const H='takeaway'===r.type?x:w,_=Math.max(0,H.findIndex(([e])=>e===r.status)),D=Math.round(r.subtotal*I/100),F='table'===r.type?r.subtotal+(r.split?r.tip:D):r.total,q=F-r.paid,L=r.split?.ways??O,W=r.split?.paidShares??0,Y=Math.ceil(F/L),E='collected'===r.status||'closed'===r.status;return(0,j.jsxs)(c.Screen,{title:`Order ${r.ref}`,subtitle:`${f.name} \xb7 ${'table'===r.type?`${(0,t.tableNumbers)(r.tableNo)}`:`Collection at ${r.slotTime?(0,p.hm)(new Date(r.slotTime)):'\u2014'}`}`,children:['takeaway'===r.type?(0,j.jsx)(c.Banner,{kind:"success",title:'ready'===r.status?'Your order is ready!':'Order placed',children:'ready'===r.status?'Head to the bar and give your order number. Staff will check allergies with you at handover.':`Show order number ${r.ref} at the bar when you arrive.`}):null,(0,j.jsxs)(c.Card,{children:[(0,j.jsx)(c.H2,{children:"Status"}),H.map(([e,t],s)=>(0,j.jsxs)(c.Row,{gap:10,children:[(0,j.jsx)(n.default,{style:{width:22,height:22,borderRadius:11,backgroundColor:s<=_?y.colours.gold:y.colours.surface2,borderWidth:1,borderColor:y.colours.gold}}),(0,j.jsx)(c.T,{weight:s===_?'semibold':'regular',colour:s<=_?y.colours.text:y.colours.muted,children:t})]},e)),r.allergyAck?(0,j.jsxs)(c.Muted,{children:["Kitchen signed off your allergies (",r.allergyAck.by,", ",(0,p.hm)(new Date(r.allergyAck.at)),")"]}):r.allergies.length?(0,j.jsx)(c.Muted,{children:"Waiting for the kitchen to sign off your allergies\u2026"}):null,'takeaway'!==r.type||E?null:(0,j.jsxs)(c.Row,{gap:8,children:[(0,j.jsx)(c.Button,{small:!0,kind:'on-my-way'===r.customerSignal?'primary':'secondary',label:"On my way",onPress:()=>b.repo.orders.customerSignal(r.id,'on-my-way')}),(0,j.jsx)(c.Button,{small:!0,kind:'here'===r.customerSignal?'primary':'secondary',label:"I\u2019m here",onPress:()=>b.repo.orders.customerSignal(r.id,'here')})]})]}),(0,j.jsxs)(c.Card,{children:[(0,j.jsx)(c.H2,{children:"Items"}),r.lines.map((e,t)=>(0,j.jsxs)(n.default,{children:[(0,j.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(c.T,{style:{flex:1},children:[e.qty,"\xd7 ",e.name]}),(0,j.jsx)(c.T,{children:(0,h.gbp)(e.unitPrice*e.qty)})]}),e.choices.length?(0,j.jsx)(c.Muted,{children:e.choices.join(' \xb7 ')}):null,e.overridden?(0,j.jsx)(c.Badge,{kind:"red",label:`Allergy override: ${e.contains.map(u.allergenLabel).join(', ')}`}):null]},t)),(0,j.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(c.Muted,{children:"Subtotal"}),(0,j.jsx)(c.T,{children:(0,h.gbp)(r.subtotal)})]}),r.giftCardApplied?(0,j.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(c.Muted,{children:"Of which gift card"}),(0,j.jsxs)(c.T,{colour:y.colours.ok,children:["\u2212",(0,h.gbp)(r.giftCardApplied)]})]}):null,r.tip?(0,j.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(c.Muted,{children:"Tip"}),(0,j.jsx)(c.T,{children:(0,h.gbp)(r.tip)})]}):null,(0,j.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(c.T,{weight:"semibold",children:"Paid (test, no real money)"}),(0,j.jsx)(c.T,{weight:"semibold",colour:y.colours.gold,children:(0,h.gbp)(r.paid)})]})]}),'table'===r.type&&'closed'!==r.status&&'cancelled'!==r.status?(0,j.jsxs)(c.Card,{highlight:y.colours.gold,children:[(0,j.jsxs)(c.H2,{children:["Your bill \u2014 ",(0,t.tableNumbers)(r.tableNo)]}),r.split?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(c.T,{children:["Total ",(0,h.gbp)(F)," \xb7 split ",L," way",L>1?'s':''," \xb7 ",(0,h.gbp)(Y)," each"]}),(0,j.jsxs)(c.T,{children:["Shares paid: ",W," of ",L," \xb7 remaining ",(0,h.gbp)(q)]}),L>1?(0,j.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(c.T,{children:"Shares to pay now"}),(0,j.jsx)(c.Stepper,{value:R,onChange:A,min:1,max:L-W,label:"shares"})]}):null,(0,j.jsx)(c.Button,{label:`Pay ${L>1?`${R} share${R>1?'s':''}`:'bill'} \xb7 ${(0,h.gbp)(Math.min(q,Y*R))}`,onPress:()=>$(!0),testID:"pay-bill"})]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(c.T,{weight:"semibold",children:"Add a tip?"}),(0,j.jsx)(c.Row,{wrap:!0,children:[0,10,12.5,15].map(e=>(0,j.jsx)(c.Chip,{label:e?`${e}%`:'No tip',selected:I===e,onPress:()=>N(e)},e))}),(0,j.jsx)(c.Muted,{children:"Tips go to staff under the restaurant\u2019s tipping policy (Employment (Allocation of Tips) Act 2023)."}),(0,j.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(c.T,{weight:"semibold",children:"Split evenly between"}),(0,j.jsx)(c.Stepper,{value:O,onChange:B,min:1,max:8,label:"people"})]}),(0,j.jsxs)(c.T,{children:["Total ",(0,h.gbp)(r.subtotal+D),O>1?` \xb7 ${(0,h.gbp)(Math.ceil((r.subtotal+D)/O))} each`:'']}),(0,j.jsx)(c.Button,{label:"Get the bill",onPress:()=>b.repo.orders.setSplit(r.id,O,D),testID:"get-bill"})]})]}):null,!E||r.rated||v?null:(0,j.jsxs)(c.Card,{highlight:y.colours.gold,children:[(0,j.jsx)(c.H2,{children:"How was everything?"}),(0,j.jsxs)(c.Muted,{children:["One tap \u2014 this goes privately to ",f.name," only, never published."]}),(0,j.jsx)(i.Stars,{value:C,onChange:S}),C?(0,j.jsx)(c.Field,{label:"Anything to add? (optional)",value:k,onChangeText:T}):null,(0,j.jsx)(c.Button,{label:"Send feedback",disabled:!C,onPress:()=>{b.repo.feedback.add({restaurantId:f.id,orderId:r.id,customerId:r.customerId,customerName:r.customerName,stars:C,comment:k,context:'table'===r.type?`${(0,t.tableNumbers)(r.tableNo)}`:`Takeaway ${r.ref}`}),P(!0)},testID:"send-rating"})]}),v||r.rated?(0,j.jsx)(c.Banner,{kind:"success",children:"Thanks \u2014 your feedback went privately to the restaurant."}):null,E?(0,j.jsx)(c.Button,{kind:"secondary",label:"View stamp card",onPress:()=>s.router.push(`/customer/${f.id}/loyalty`)}):null,(0,j.jsx)(o.MockPay,{visible:M,onClose:()=>$(!1),amount:Math.min(q,Y*R),restaurantId:f.id,title:`Pay \u2014 ${(0,t.tableNumbers)(r.tableNo)}`,onPaid:e=>{b.repo.orders.payTable(r.id,{shares:R,giftCardCode:e.giftCardCode}),$(!1),A(1)}})]})}},791,[808,804,30,127,834,832,813,814,816,818,819,821,24]); \ No newline at end of file diff --git a/wildings/customer-app/_expo/static/js/web/[section]-93e8e4ffe952e5b3c505e21ca771e570.js b/wildings/customer-app/_expo/static/js/web/[section]-93e8e4ffe952e5b3c505e21ca771e570.js new file mode 100644 index 0000000000000000000000000000000000000000..11f3bab84de38d8d8874b5ec2723dd3ea24b04a1 --- /dev/null +++ b/wildings/customer-app/_expo/static/js/web/[section]-93e8e4ffe952e5b3c505e21ca771e570.js @@ -0,0 +1 @@ +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return s}});var t=r(d[0]);r(d[1]);var n=r(d[2]),c=r(d[3]),o=r(d[4]),f=r(d[5]);function s(){const{section:s}=(0,t.useLocalSearchParams)();return(0,c.canShow)('chef')?s&&(0,o.chefSectionAllowed)(String(s))?(0,f.jsx)(n.ChefApp,{section:String(s)},String(s)):(0,f.jsx)(t.Redirect,{href:"/kitchen"}):(0,f.jsx)(t.Redirect,{href:c.ENTRY[c.APP_VARIANT]})}},775,[804,30,805,806,807,24]); \ No newline at end of file diff --git a/wildings/customer-app/_expo/static/js/web/[token]-6c815095a584dc0399e5918b52874b98.js b/wildings/customer-app/_expo/static/js/web/[token]-6c815095a584dc0399e5918b52874b98.js new file mode 100644 index 0000000000000000000000000000000000000000..bbb9c120ac56fbfa8ba9e0a1c2e306f6558c994f --- /dev/null +++ b/wildings/customer-app/_expo/static/js/web/[token]-6c815095a584dc0399e5918b52874b98.js @@ -0,0 +1,3 @@ +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return u}});var t=r(d[0]);r(d[1]);var n=r(d[2]),o=r(d[3]),c=r(d[4]),s=r(d[5]),l=r(d[6]);function u(){const{token:u}=(0,t.useLocalSearchParams)(),h=(0,c.cleanToken)(u);return h?(0,s.guestServer)()?(0,l.jsx)(o.TableOrderLive,{token:h}):(0,l.jsx)(n.Screen,{title:"Order at the table",children:(0,l.jsx)(n.Banner,{kind:"demo",title:"Not connected",children:"This preview isn't connected to a venue, so table orders can't be sent from here."})}):(0,l.jsx)(n.Screen,{title:"Order at the table",children:(0,l.jsx)(n.Banner,{kind:"warn",title:"This code isn't working",children:"Please scan the QR code on your table again, or ask a member of staff."})})}},795,[804,30,813,874,876,836,24]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TableOrderLive=function({token:e}){const[s,b]=(0,n.useState)(null),[m,f]=(0,n.useState)(null),[j,y]=(0,n.useState)([]),[k,w]=(0,n.useState)(null),T=(0,h.useCustomer)(),[C,S]=(0,n.useState)(()=>(T?.allergies??[]).map(e=>e.allergen)),[v,P]=(0,n.useState)(''),[O,N]=(0,n.useState)(''),[B,I]=(0,n.useState)(!1),[L,M]=(0,n.useState)(null),[R,$]=(0,n.useState)([]),A=(0,n.useCallback)(async()=>{try{b(await(0,c.tablePublic)(e)),f(null)}catch(e){f(e?.message??'Could not load the menu.')}},[e]),D=(0,n.useCallback)(async()=>{try{$(await(0,c.myTableOrders)(e))}catch{}},[e]);(0,n.useEffect)(()=>{A(),D();const e=setInterval(()=>{D(),A()},8e3);return()=>clearInterval(e)},[A,D]);const _=s?.menu??[];(0,n.useEffect)(()=>{y(e=>e.filter(e=>_.some(t=>t.id===e.id&&!t.soldOut)))},[s]);const q=(0,n.useMemo)(()=>{const e=new Map;for(const t of _)e.set(t.section,[...e.get(t.section)??[],t]);return[...e.entries()]},[s]),Y=(0,d.cartTotal)(j,_),W='yes'===k?C.map(e=>({allergen:e,severity:T?.allergies?.find(t=>t.allergen===e)?.severity??'allergy'})):[],E=(0,d.allergyClashes)(j,_,W.map(e=>e.allergen)),z=e=>j.find(t=>t.id===e)?.qty??0,G=(e,t)=>y(l=>t<=0?l.filter(t=>t.id!==e):l.some(t=>t.id===e)?l.map(l=>l.id===e?{...l,qty:t}:l):[...l,{id:e,qty:t,note:''}]),H=(e,t)=>y(l=>l.map(l=>l.id===e?{...l,note:t}:l)),V=async()=>{I(!0),M(null);try{const t=await(0,c.sendTableOrder)(e,j,{note:O,name:v,allergies:W});y([]),N(''),M({kind:'success',text:t.held?`Order ${t.ref} sent. A member of staff will check it, then it goes to the kitchen.`:`Order ${t.ref} sent to the kitchen.`}),D()}catch(e){M({kind:'warn',text:e?.message??'The order was not sent. Please try again or ask a member of staff.'}),A()}finally{I(!1)}};if(m)return(0,x.jsxs)(r.Screen,{title:"Order at the table",children:[(0,x.jsx)(r.Banner,{kind:"warn",title:"Couldn't open the menu",children:m}),(0,x.jsx)(r.Button,{label:"Try again",onPress:()=>{A()}})]});if(!s)return(0,x.jsx)(r.Screen,{title:"Order at the table",children:(0,x.jsx)(r.Muted,{children:"Opening the menu\u2026"})});if(!s.ok)return(0,x.jsx)(r.Screen,{title:"Order at the table",children:(0,x.jsx)(r.Banner,{kind:"warn",title:"This code isn't working",children:s.reason??'Please ask a member of staff.'})});const F=s.open&&j.length>0&&null!==k&&('none'===k||C.length>0)&&!B;return(0,x.jsxs)(r.Screen,{title:`${(0,l.tableNumbers)(s.table)}`,subtitle:s.venueName,footer:s.open?(0,x.jsx)(r.Button,{label:B?'Sending\u2026':j.length?`Send order to the kitchen (${(0,o.gbp)(Y)})`:'Add a dish to order',disabled:!F,onPress:()=>{V()},testID:"send-table-order-live"}):void 0,children:[(0,x.jsxs)(r.Muted,{children:["Tip: add dishes, answer the allergy question, then send. Staff bring it to ",(0,l.tableNumbers)(s.table),". ",d.PAY_WORDS]}),s.tip?(0,x.jsx)(r.Banner,{kind:"demo",children:s.tip}):null,s.open?null:(0,x.jsx)(r.Banner,{kind:"warn",title:"Not taking table orders right now",children:s.reason}),s.open&&s.staffAccept&&!R.some(e=>e.accepted)?(0,x.jsx)(r.Muted,{children:"The first order from your phone is checked by a member of staff before it goes to the kitchen."}):null,L?(0,x.jsx)(r.Banner,{kind:L.kind,children:L.text}):null,R.length?(0,x.jsx)(a.default,{testID:"my-table-orders",children:(0,x.jsxs)(r.Card,{children:[(0,x.jsx)(r.T,{weight:"semibold",children:"Your orders at this table"}),R.map(e=>(0,x.jsxs)(a.default,{style:{gap:2,paddingVertical:4},children:[(0,x.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(r.T,{children:e.ref}),(0,x.jsx)(r.T,{size:13,colour:'cancelled'===e.status?u.colours.amber:u.colours.gold,children:(0,d.guestStatusWords)(e)})]}),(0,x.jsxs)(r.Muted,{children:[e.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')," \xb7 ",(0,o.gbp)(e.totalPence)," to pay at the bar or till"]})]},e.id))]})}):null,s.open?q.map(([e,t])=>(0,x.jsxs)(a.default,{style:{gap:8},children:[(0,x.jsx)(r.H2,{children:e}),t.map(e=>(0,x.jsxs)(r.Card,{children:[(0,x.jsxs)(r.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,x.jsxs)(a.default,{style:{flex:1,gap:2},children:[(0,x.jsx)(r.T,{weight:"semibold",children:e.name}),e.description?(0,x.jsx)(r.Muted,{children:e.description}):null,(0,x.jsxs)(r.T,{size:13,colour:u.colours.muted,children:[e.allergens.length?`Contains: ${e.allergens.map(i.allergenLabel).join(', ')}`:'No allergens listed: ask staff if unsure',e.mayContain.length?` \xb7 May contain: ${e.mayContain.map(i.allergenLabel).join(', ')}`:'']})]}),(0,x.jsx)(r.T,{weight:"semibold",colour:u.colours.gold,children:(0,o.gbp)(e.pricePence)})]}),e.soldOut?(0,x.jsx)(r.Badge,{kind:"amber",label:"Sold out today"}):z(e.id)?(0,x.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(r.Stepper,{value:z(e.id),min:0,max:20,onChange:t=>G(e.id,t),label:e.name}),(0,x.jsx)(r.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>G(e.id,0)})]}):(0,x.jsx)(r.Button,{small:!0,kind:"secondary",label:"Add",accessibilityLabel:`Add ${e.name}`,onPress:()=>G(e.id,1)})]},e.id))]},e)):null,s.open&&!_.length?(0,x.jsx)(r.Banner,{kind:"demo",title:"No dishes to order yet",children:"The venue hasn't put any priced dishes on the table menu yet. Please order at the bar."}):null,s.open&&j.length?(0,x.jsx)(a.default,{testID:"table-cart",children:(0,x.jsxs)(r.Card,{children:[(0,x.jsx)(r.T,{weight:"semibold",children:"Your order"}),j.map(e=>{const l=_.find(t=>t.id===e.id);return(0,x.jsxs)(a.default,{style:{gap:4},children:[(0,x.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsxs)(r.T,{children:[e.qty,"\xd7 ",l?.name]}),(0,x.jsx)(r.T,{children:(0,o.gbp)(e.qty*(l?.pricePence??0))})]}),(0,x.jsx)(t.TextInput,{style:p,value:e.note,onChangeText:t=>H(e.id,t),placeholder:"Note for the kitchen (optional), e.g. no onions",placeholderTextColor:u.colours.muted,maxLength:140,accessibilityLabel:`Note for ${l?.name}`,testID:`table-note-${e.id}`})]},e.id)}),(0,x.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(r.T,{weight:"semibold",children:"Total"}),(0,x.jsx)(r.T,{weight:"semibold",children:(0,o.gbp)(Y)})]})]})}):null,s.open?(0,x.jsx)(a.default,{testID:"table-allergy",children:(0,x.jsxs)(r.Card,{children:[(0,x.jsx)(r.T,{weight:"semibold",children:"Does anyone at the table have a food allergy?"}),(0,x.jsx)(r.Muted,{children:"We ask everyone, so the kitchen can keep you safe."}),(0,x.jsxs)(r.Row,{gap:8,children:[(0,x.jsx)(r.Chip,{label:"No allergies",selected:'none'===k,onPress:()=>w('none')}),(0,x.jsx)(r.Chip,{label:"Yes, allergies",selected:'yes'===k,onPress:()=>w('yes')})]}),'yes'===k?(0,x.jsx)(r.Row,{wrap:!0,gap:6,children:i.ALLERGENS.map(e=>(0,x.jsx)(r.Chip,{label:e.short,selected:C.includes(e.id),onPress:()=>S(t=>t.includes(e.id)?t.filter(t=>t!==e.id):[...t,e.id])},e.id))}):null,E.length?(0,x.jsxs)(r.Banner,{kind:"warn",title:"Check with staff",children:[E.map(e=>e.name).join(', ')," ",E.length>1?'contain':'contains'," or may contain an allergy you picked. The kitchen will see your allergies on the ticket."]}):null]})}):null,s.open?(0,x.jsxs)(r.Card,{children:[(0,x.jsx)(r.T,{weight:"semibold",children:"Anything else?"}),(0,x.jsx)(t.TextInput,{style:p,value:v,onChangeText:P,placeholder:"Your first name (optional)",placeholderTextColor:u.colours.muted,maxLength:40,accessibilityLabel:"Your first name (optional)"}),(0,x.jsx)(t.TextInput,{style:p,value:O,onChangeText:N,placeholder:"Note for the staff (optional)",placeholderTextColor:u.colours.muted,maxLength:300,accessibilityLabel:"Note for the staff (optional)"})]}):null,(0,x.jsx)(a.default,{testID:"pay-placeholder",children:(0,x.jsxs)(r.Card,{children:[(0,x.jsx)(r.T,{weight:"semibold",children:"Paying"}),(0,x.jsx)(r.T,{children:d.PAY_WORDS}),(0,x.jsx)(r.Muted,{children:"No card details are asked for or kept in this app."})]})})]})};var e,t=_r(_d[0]),l=_r(_d[1]),n=_r(_d[2]),s=_r(_d[3]),a=(e=s)&&e.__esModule?e:{default:e},r=_r(_d[4]),i=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),x=_r(_d[11]);const p={borderWidth:1,borderColor:u.colours.border,borderRadius:10,padding:10,color:u.colours.text,backgroundColor:u.colours.surface2}},874,[877,808,30,127,813,814,816,876,875,819,821,24]); +__d(function(g,_r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"tablePublic",{enumerable:!0,get:function(){return s}}),e.sendTableOrder=async function(t,r,a){if(!await(0,n.guestSession)())throw new Error('No connection. Try again when you are back online.');return(0,n.rpc)('guest_table_order',{p_token:t,p_lines:r.map(t=>({id:t.id,qty:t.qty,note:t.note.trim().slice(0,140)})),p_note:a.note.trim().slice(0,300)||null,p_allergies:a.allergies.map(t=>({allergen:t.allergen,severity:t.severity})),p_name:a.name.trim().slice(0,40)||null})},e.myTableOrders=async function(t){return await(0,n.guestSession)()?await(0,n.rpc)('guest_table_my_orders',{p_token:t})??[]:[]},e.loadTableSettings=async function(){const{data:t,error:n}=await a().from('table_order_settings').select('*').eq('venue_id',o()).maybeSingle();if(n)throw n;return(0,r.fromRow)(t)},e.saveTableSettings=async function(t,n){const{error:s}=await a().from('table_order_settings').upsert({venue_id:o(),...(0,r.toRow)(t),updated_at:(new Date).toISOString(),updated_by:n.slice(0,80)});if(s)throw s},e.listTableCodes=async function(){const{data:t,error:n}=await a().from('table_qr_codes').select('table_no, token, created_at').eq('venue_id',o()).eq('is_on',!0);if(n)throw n;return(t??[]).map(t=>({table:String(t.table_no),token:String(t.token),createdAt:String(t.created_at)})).sort((t,n)=>Number(t.table)-Number(n.table))},Object.defineProperty(e,"makeTableCodes",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"renewTableCode",{enumerable:!0,get:function(){return c}}),e.watchTableSettings=function(t){const r=n.useSync.getState().venueId;if(!r)return()=>{};const o=a().channel(`tos-${r}-${Math.random().toString(36).slice(2,8)}`).on('postgres_changes',{event:'*',schema:'public',table:'table_order_settings',filter:`venue_id=eq.${r}`},()=>t()).subscribe();return()=>{a().removeChannel(o)}};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]);const a=()=>(0,t.getSupabase)(),o=()=>{const t=n.useSync.getState().venueId;if(!t)throw new Error('Not connected to the venue yet.');return t},s=t=>(0,n.rpc)('table_public',{p_token:t});const l=t=>(0,n.rpc)('table_qr_make',{p_venue:o(),p_tables:t}),c=t=>(0,n.rpc)('table_qr_renew',{p_venue:o(),p_table:t})},875,[863,820,876]); \ No newline at end of file diff --git a/wildings/customer-app/_expo/static/js/web/__common-0ddd8478d5e84f31f7735bdf52109b59.js b/wildings/customer-app/_expo/static/js/web/__common-0ddd8478d5e84f31f7735bdf52109b59.js new file mode 100644 index 0000000000000000000000000000000000000000..babf59bad64b6406c91cfe46666b81855ed2c87c --- /dev/null +++ b/wildings/customer-app/_expo/static/js/web/__common-0ddd8478d5e84f31f7735bdf52109b59.js @@ -0,0 +1,458 @@ +__d(function(g,r,i,a,m,e,d){"use strict";function t(t,n){return Object.keys(t).forEach(function(c){"default"===c||Object.prototype.hasOwnProperty.call(n,c)||Object.defineProperty(n,c,{enumerable:!0,get:function(){return t[c]}})}),t}Object.defineProperty(e,"__esModule",{value:!0}),r(d[0]),t(r(d[1]),e),t(r(d[2]),e),t(r(d[3]),e),t(r(d[4]),e)},804,[1183,1184,1194,1195,1197]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ChefApp=function({section:e}={}){const{r:s,rid:t,me:i,now:$}=(0,G.useChef)(3e4),_=(0,W.useSignedIn)(),K=_?.id??G.CHEF_ID;(0,o.useSoldOutLink)(!0,(_?.name??i).replace(' (example)',''));const V=e?me[e]:void 0,[ue,je]=(0,P.useState)(V?.tab??'home'),[we,Ce]=(0,P.useState)(V?.k??null),[Te,ve]=(0,P.useState)(V?.stock??'levels'),[Se,Pe]=(0,P.useState)(void 0),[Ie,Re]=(0,P.useState)(V?.gp??'dishes'),Be=(0,P.useRef)(null),He=(0,f.ymd)($),Ae=(0,f.ymd)(new Date($.getTime()+864e5));(0,u.useTipsPosted)(t,He);const Oe=(0,Q.useTravelDay)('chef',He),De='home'===ue&&!Oe;(0,v.useKitchenTodoChime)(t,He,()=>Fe('kitchen','bookings')),(0,de.useAlertWatcher)(t,{kinds:['takeaway']}),(0,P.useEffect)(()=>{(0,W.ensureAttendance)((new Date).toISOString().slice(0,10),$)},[]);const Le=(0,P.useRef)({t:'home',k:null});Le.current={t:ue,k:we};const Ee=(0,P.useRef)([]),$e=(0,n.useScrollMemory)(Be),Fe=(0,P.useCallback)((e,s=null)=>{const t=Le.current;t.t===e&&t.k===s||(Ee.current=[...Ee.current,{...t,y:$e.leave()}].slice(-30),$e.restore(0)),je(e),Ce(s)},[]),We=(0,P.useCallback)(()=>{if((0,l.runBackLayer)())return!0;const e=Le.current;let s=Ee.current.pop();for(;s&&s.t===e.t&&s.k===e.k;)s=Ee.current.pop();if(!s&&'home'===e.t&&!e.k)return!1;const t=s??{t:'home',k:null};return $e.leave(),je(t.t),Ce(t.k),$e.restore(t.y??0),!0},[]);(0,l.useWebBack)(We);const Ge=(0,l.useInnerBackShown)();(0,P.useEffect)(()=>{d.PITCH&&(globalThis.__pitchGo=(e,s=null,t)=>{'stock'===e&&t&&ve(t),'gp'===e&&t&&Re(t),Fe(e,s)})},[Fe]),(0,p.useShiftReminders)({rid:t,staffId:K,name:i,kitchen:!0}),(0,C.useScheduledNotices)({rid:t,staffId:_?.id??'',name:i,onOpen:()=>Fe('kitchen','orderlists')}),(0,T.useOffRotaPrompt)({rid:t,staffId:_?.id??''}),(0,P.useEffect)(()=>{const e=I.default.addEventListener('hardwareBackPress',We);return()=>e.remove()},[We]);const Me=we?ye.find(e=>e.id===we):null,Ne=(0,H.default)().width<430,ze=Me?Me.title:{home:'Today in the kitchen',stock:'Stock',gp:'GP & costing',creator:ie.CREATOR_TITLE,orders:'Ordering',kitchen:'Kitchen'}[ue];return(0,be.jsxs)(O.SafeAreaView,{style:{flex:1,backgroundColor:F.colours.bg},edges:['top','bottom'],children:[(0,be.jsxs)(A.default,{style:{paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:F.colours.border,gap:6},children:[(0,be.jsx)(A.default,{style:{alignItems:'center'},children:(0,be.jsx)(A.default,{testID:"header-me",accessibilityLabel:`Signed in as ${i.replace(' (example)','')}, Head Chef`,style:{borderWidth:1,borderColor:F.colours.gold,borderRadius:16,paddingHorizontal:10,paddingVertical:4,maxWidth:'86%'},children:(0,be.jsxs)(E.Row,{gap:6,children:[(0,be.jsx)(se.StaffAvatar,{id:G.CHEF_ID,size:24,ring:!1}),(0,be.jsxs)(E.T,{size:13,weight:"semibold",colour:F.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[i.replace(' (example)','')," \xb7 Head Chef"]})]})})}),(0,be.jsxs)(E.Row,{gap:10,children:[(0,be.jsx)(D.RestaurantLogo,{rid:t,size:Ne?36:44}),(0,be.jsxs)(A.default,{style:{flex:1,minWidth:0},children:[(0,be.jsxs)(E.Row,{gap:6,children:[(0,be.jsx)(E.T,{weight:"semibold",size:Ne?15:17,numberOfLines:1,style:{flexShrink:1},children:s.name}),(0,be.jsx)(w.AppBadge,{label:"CHEF"})]}),(0,be.jsx)(E.T,{size:12,colour:F.colours.muted,numberOfLines:1,children:"Head Chef app"}),(0,be.jsx)(D.PoweredBy,{})]}),(0,be.jsx)(R.default,{accessibilityRole:"button",accessibilityLabel:"Open CoverCharge for Staff",onPress:()=>{const e=(0,te.appUrl)('staff');e&&window.location.assign(e)},style:{borderWidth:1,borderColor:F.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:3,minHeight:44,justifyContent:'center'},children:(0,be.jsx)(E.T,{size:13,colour:F.colours.gold,children:"Staff app \u203a"})}),(0,be.jsx)(L.VoiceSlot,{})]})]}),(0,be.jsxs)(B.default,{ref:Be,...$e.props,contentContainerStyle:{padding:14,paddingBottom:60,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:[(0,be.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:['home'===ue&&!we||Ge?null:(0,be.jsx)(l.BackButton,{onPress:We}),(0,be.jsx)(E.T,{size:22,weight:"bold",style:{flex:1,textAlign:'home'===ue&&!we||Ge?'left':'right'},children:ze})]}),'home'===ue?(0,be.jsx)(Q.DayBar,{app:"chef",today:He}):null,'home'===ue&&Oe?(0,be.jsx)(Q.DayView,{rid:t,day:Oe,today:He,app:"chef"}):null,'home'===ue?(0,be.jsx)(ee.WhoBar,{}):null,De&&_?(0,be.jsx)(h.MyTasksToday,{rid:t,staffId:_.id,name:_.name,onShift:(0,p.shiftNow)(_.id,$.getTime()).on}):null,De?(0,be.jsx)(u.TodaysTipsCard,{rid:t,today:He}):null,De?(0,be.jsx)(u.TipsPotCard,{rid:t,today:He}):null,De?(0,be.jsx)(b.CoversToday,{rid:t,onPress:()=>Fe('kitchen','bookings')}):null,De?(0,be.jsx)(k.LastFoodBanner,{rid:t,now:$}):null,De?(0,be.jsx)(y.NextTableFreeCard,{rid:t,now:$}):null,De?(0,be.jsx)(x.KitchenSignoffs,{rid:t,today:He,by:i,app:"chef"}):null,De?(0,be.jsxs)(A.default,{style:{gap:4},children:[(0,be.jsx)(x.PlattersBooked,{rid:t,date:He,label:"Platters booked today"}),(0,be.jsx)(x.PlattersBooked,{rid:t,date:Ae,label:"Platters booked tomorrow"})]}):null,De?(0,be.jsx)(pe.ChefAssistantButton,{}):null,De?(0,be.jsx)(xe,{go:(e,s)=>{'stock'===e&&s&&ve(s),'gp'===e&&s&&Re(s),'orders'===e&&Pe(s),Fe(e,'kitchen'===e?s??null:null)}}):null,'stock'===ue?(0,be.jsx)(U.StockScreen,{initial:Te},Te):null,'gp'===ue?(0,be.jsx)(M.GpScreen,{initial:Ie},Ie):null,'creator'===ue?(0,be.jsx)(ie.DishCreator,{rid:t,canPublish:!1}):null,'orders'===ue?(0,be.jsx)(z.OrdersScreen,{focus:Se},Se??'all'):null,'kitchen'!==ue||Me?null:(0,be.jsxs)(A.default,{style:{gap:10},children:[(0,be.jsx)(A.default,{style:{borderRadius:14,borderWidth:1,borderColor:F.colours.border,backgroundColor:F.colours.surface,overflow:'hidden'},children:ye.map((e,s)=>(0,be.jsx)(R.default,{accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>Fe(ue,e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:F.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,be.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,be.jsxs)(A.default,{style:{flex:1},children:[(0,be.jsx)(E.T,{weight:"medium",children:e.title}),(0,be.jsx)(E.Muted,{children:e.sub})]}),(0,be.jsx)(E.T,{colour:F.colours.muted,children:"\u203a"})]})},e.id))}),(0,be.jsx)(E.Muted,{children:"Head Chef sees kitchen, stock, food costs and GP. Payroll, wages and the restaurant's billing stay in CoverCharge for Managers."}),(0,be.jsxs)(E.Muted,{center:!0,children:["Head Chef app \xb7 ",r.APP_VERSION," \xb7 ",'live'===ge.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),'myshift'===we&&K?(0,be.jsxs)(A.default,{style:{gap:10},testID:"chef-myshift",children:[(0,be.jsx)(X.ClockInOut,{}),(0,be.jsx)(Z.MyUpcomingShifts,{staffId:K})]}):null,'mypay'===we?(0,be.jsxs)(A.default,{style:{gap:10},testID:"chef-mypay",children:[(0,be.jsx)(Y.MyPeriods,{staffId:K}),(0,be.jsx)(q.MyHoursPay,{staffId:K}),(0,be.jsx)(J.MyTips,{staffId:K}),(0,be.jsxs)(E.Card,{children:[(0,be.jsx)(E.T,{weight:"semibold",children:"Phone notifications"}),(0,be.jsx)(E.Muted,{children:"Get reminders like \u201cMills milk order\u201d on this phone, even with the app closed (once your manager switches phone notifications on). iPhone: add the app to your Home Screen first (iOS 16.4 or later)."}),(0,be.jsx)(c.PushButton,{})]})]}):null,'bookings'===we?(0,be.jsx)(S.TodaysBookings,{rid:t,today:He,by:i,app:"chef"}):null,'specials'===we?(0,be.jsx)(le.SpecialsEditor,{rid:t,me:i,app:"chef",now:$}):null,'prep'===we?(0,be.jsx)(N.PrepScreen,{}):null,'live'===we?(0,be.jsx)(N.TeamScreen,{}):null,'waste'===we?(0,be.jsx)(N.WasteScreen,{}):null,'recipes'===we?(0,be.jsx)(ce.RecipeCards,{rid:t,actor:{name:i,role:'head-chef'},mode:"edit"}):null,'allergens'===we?(0,be.jsx)(N.AllergenScreen,{openCards:()=>Fe('kitchen','recipes')}):null,'compliance'===we?(0,be.jsx)(N.ComplianceScreen,{}):null,'takings'===we?(0,be.jsx)(u.CashUpScreen,{rid:t,today:He,canEdit:!1,chartsOnly:!0,who:{id:K,name:i.replace(' (example)','')}}):null,'board'===we?(0,be.jsx)(he.QuestionBoard,{rid:t,today:He,manager:!1,by:""}):null,'teamtasks'===we?(0,be.jsx)(h.KitchenTeamTasks,{rid:t,actor:_}):null,'orderlists'===we?(0,be.jsx)(j.OrderListsScreen,{rid:t,today:He,editor:!0,who:{id:K,name:i.replace(' (example)','')}}):null,'foodsafety'===we?(0,be.jsx)(c.FoodSafetyCard,{children:(0,be.jsx)(R.default,{accessibilityRole:"button",onPress:()=>Fe('kitchen','haccp'),children:(0,be.jsx)(E.T,{colour:F.colours.gold,children:"Today\u2019s temperature log \u203a"})})}):null,'haccp'===we?(0,be.jsx)(ne.HaccpLog,{mode:"chef",me:i,meId:G.CHEF_ID,now:$}):null,'accidents'===we?(0,be.jsx)(oe.AccidentBook,{app:"chef",me:i,meId:G.CHEF_ID,now:$,seeAll:!1}):null]}),(0,be.jsx)(A.default,{accessibilityRole:"tablist",style:{flexDirection:'row',borderTopWidth:1,borderColor:F.colours.border,backgroundColor:F.colours.surface},children:ke.map(e=>{const s=ue===e.id;return(0,be.jsxs)(R.default,{accessibilityRole:"tab",accessibilityState:{selected:s},accessibilityLabel:e.label,onPress:()=>Fe(e.id),style:{flex:1,alignItems:'center',paddingVertical:8,paddingHorizontal:2,minHeight:52,gap:2},children:[(0,be.jsx)(fe.Icon,{name:e.icon,colour:s?F.colours.gold:F.colours.muted}),(0,be.jsx)(E.T,{size:e.label.length>10?10:11,weight:s?'semibold':'regular',colour:s?F.colours.gold:F.colours.muted,center:!0,children:e.label})]},e.id)})}),(0,be.jsx)(pe.ChefAssistantSheet,{go:(e,s)=>{'orders'===e?(Pe(s),Fe('orders')):'gp'===e?Fe('gp'):Fe('kitchen',e)}}),(0,be.jsx)(re.AlertHost,{variant:"chef",rid:t,skipTakeaway:!0}),(0,be.jsx)(ae.KitchenFlash,{rid:t,me:i})]})};var s=_r(_d[0]),t=_r(_d[1]),o=_r(_d[2]),i=_r(_d[3]),n=_r(_d[4]),l=_r(_d[5]),r=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]),f=_r(_d[12]),b=_r(_d[13]),k=_r(_d[14]),y=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),w=_r(_d[18]),C=_r(_d[19]),T=_r(_d[20]),v=_r(_d[21]),S=_r(_d[22]),P=_r(_d[23]),I=e(_r(_d[24]));_r(_d[25]);var R=e(_r(_d[26])),B=e(_r(_d[27])),H=e(_r(_d[28])),A=e(_r(_d[29])),O=_r(_d[30]),D=_r(_d[31]),L=_r(_d[32]),E=_r(_d[33]),$=_r(_d[34]),F=_r(_d[35]),W=_r(_d[36]),_=_r(_d[37]),G=_r(_d[38]),M=_r(_d[39]),N=_r(_d[40]),z=_r(_d[41]),K=_r(_d[42]),V=_r(_d[43]),U=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),Y=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),se=_r(_d[52]),te=_r(_d[53]),oe=_r(_d[54]),ie=_r(_d[55]),ne=_r(_d[56]),le=_r(_d[57]),re=_r(_d[58]),ae=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),he=_r(_d[62]),ue=_r(_d[63]),pe=_r(_d[64]),ge=_r(_d[65]),fe=_r(_d[66]),be=_r(_d[67]);s.LIVE_HEAD_CHEF&&(0,t.requireRealData)();const ke=[{id:'home',label:'Home',icon:'home'},{id:'stock',label:'Stock',icon:'box'},{id:'gp',label:'GP',icon:'forecast'},{id:'creator',label:ie.CREATOR_TITLE,icon:'sparkle'},{id:'orders',label:'Orders',icon:'orders'},{id:'kitchen',label:'Kitchen',icon:'platter'}],ye=[{id:'myshift',title:'My shifts & clock in',sub:'Clock in and out (checks you are at the venue), breaks, and your shifts on the rota'},{id:'mypay',title:'My pay & tips',sub:'Your hours, tips share, tip goal, paydays and payslip info. Only you see this'},{id:'takings',title:'Takings & tips graphs',sub:'Daily cash ups, weekly sales, this week vs last, categories and the Tips pot (view only)'},{id:'bookings',title:'Today\u2019s bookings',sub:'Covers, allergens to sign off, platters and other reservations, dogs, access and vegan/vegetarian'},{id:'recipes',title:'Recipe cards',sub:'Plating photo, ingredients, method, allergens, section and price; you sign each card off before it goes live'},{id:'specials',title:'Specials board',sub:'Photo of the chalkboard or typed specials with allergens; shown in the customer app'},{id:'board',title:'Question board',sub:'Ask the team anything anonymously, and vote'},{id:'teamtasks',title:'Kitchen team tasks',sub:'Daily tasks for your chefs, commis and KPs'},{id:'orderlists',title:'Order lists',sub:'Alsons drinks, Cash and carry: add items, tick on the day, finish and carry over'},{id:'foodsafety',title:'Food safety (CookSafe)',sub:'Based on CookSafe (Food Standards Scotland). Full logs coming in the next update'},{id:'haccp',title:'Food safety log (HACCP)',sub:'Temperatures, cleaning and allergen checks; voice entry; limits; EHO export'},{id:'accidents',title:'Accident book',sub:'Accidents and near misses; you see your own entries'},{id:'prep',title:'Prep list',sub:'From the forecast and bookings, tick off as you go'},{id:'live',title:'Live tickets, sold out, team & chat',sub:'Orders, readiness alerts, sold out, who\u2019s on, rota, team chat and private messages'},{id:'waste',title:'Waste log',sub:'Item, quantity, reason and cost; weekly total and % of sales'},{id:'allergens',title:'Allergens',sub:'14-allergen matrix from the recipe cards, costing cross-check and audit log'},{id:'compliance',title:'Kitchen compliance',sub:'Fridge, freezer, cooking and cooling temps; cleaning; daily checks'}],me={stock:{tab:'stock',stock:'levels'},'stock-take':{tab:'stock',stock:'take'},deliveries:{tab:'stock',stock:'deliveries'},gp:{tab:'gp',gp:'dishes'},'price-changes':{tab:'gp',gp:'changes'},'gp-week':{tab:'gp',gp:'week'},'menu-engineering':{tab:'gp',gp:'engineering'},orders:{tab:'orders'},prep:{tab:'kitchen',k:'prep'},live:{tab:'kitchen',k:'live'},waste:{tab:'kitchen',k:'waste'},recipes:{tab:'kitchen',k:'recipes'},'recipe-cards':{tab:'kitchen',k:'recipes'},allergens:{tab:'kitchen',k:'allergens'},compliance:{tab:'kitchen',k:'compliance'},haccp:{tab:'kitchen',k:'haccp'},specials:{tab:'kitchen',k:'specials'},accidents:{tab:'kitchen',k:'accidents'},'new-dish':{tab:'creator'}};function xe({go:e}){const{k:s,c:t,menu:o,now:n,rid:l,me:r}=(0,G.useChef)(3e4),d=(0,K.useSheetReminders)(),c=(0,G.useWeek)(),{covers:h,label:u,enough:p,booked:f}=(0,G.useForecast)(),b=(0,z.useSuggestions)(),k=s.ingredients.filter(e=>e.onHand<=0||(0,G.isLow)(e.onHand,e.par)),y=b.filter(e=>e.ordersToday&&!e.placedToday),x=(0,_.priceImpacts)(o,s.recipes,s.ingredients,s.targetGp).filter(e=>e.dropped.length),j=s.deliveries.filter(e=>'expected'===e.status),w=!s.recipes.length||!s.ingredients.length,C=w?[]:t.filter(e=>e.below),T=(0,i.useLiveState)(),v=(0,ue.useRecipeCards)(l).filter(e=>!e.signOff);return(0,be.jsxs)(A.default,{style:{gap:12},testID:"chef-dashboard",children:[(0,be.jsx)(ne.MissedBanner,{mode:"chef",now:n,onPress:()=>e('kitchen','haccp')}),d.map(s=>(0,be.jsx)(R.default,{accessibilityRole:"button",onPress:()=>e('orders',s.supplierId),children:(0,be.jsxs)(E.Banner,{kind:'red'===s.tone?'danger':'warn',title:`\u23f0 ${s.text}`,children:["Tap to open the ",s.name," order sheet. Nothing is sent until you press Send."]})},s.supplierId)),v.length?(0,be.jsx)(R.default,{testID:"cards-awaiting",accessibilityRole:"button",onPress:()=>e('kitchen','recipes'),children:(0,be.jsxs)(E.Banner,{kind:"warn",title:`${v.length} recipe card${1===v.length?'':'s'} awaiting your sign-off`,children:[v.slice(0,4).map(e=>e.dish).join(', '),". Guests see \"awaiting allergen sign-off\" and cannot order these until you sign them off."]})}):null,(0,be.jsx)(V.ShellfishTile,{rid:l,by:r,app:"chef",onOrder:()=>e('orders','os-kittyfisher')}),(0,be.jsxs)(E.Row,{wrap:!0,gap:10,children:[w?(0,be.jsx)(G.Tile,{testID:"tile-gp",label:"GP this week vs target",value:"Nothing yet",sub:"Add ingredients and recipe costs to see GP",onPress:()=>e('gp','week')}):(0,be.jsx)(G.Tile,{testID:"tile-gp",label:"GP this week vs target",value:(0,G.pct1)(c.theo),sub:`Target ${s.targetGp}% \xb7 actual ${(0,G.pct1)(c.actual)}`,tone:c.theoe('gp','week')}),(0,be.jsx)(G.Tile,{testID:"tile-stock",label:"Stock value",value:s.ingredients.length?(0,$.gbp)((0,G.stockValue)(s.ingredients)):'Nothing yet',sub:s.ingredients.length?'At cost':'No stock counted yet',onPress:()=>e('stock','levels')}),(0,be.jsx)(G.Tile,{label:"Items low or out",value:s.ingredients.length?`${k.length}`:'Nothing yet',sub:s.ingredients.length?k.slice(0,3).map(e=>e.name).join(', '):'No stock counted yet',tone:k.some(e=>e.onHand<=0)?'red':k.length?'amber':'ok',onPress:()=>e('stock','levels')}),(0,be.jsx)(G.Tile,{label:"Waste this week",value:s.waste.length?(0,$.gbp)(c.wasteWeek):'Nothing yet',sub:c.sales?`${(0,G.pct1)(c.wasteWeek/c.sales*100)} of food sales`:'',onPress:()=>e('kitchen','waste')}),p?(0,be.jsx)(G.Tile,{label:"Covers forecast today",value:`${h}`,sub:u,onPress:()=>e('kitchen','prep')}):(0,be.jsx)(G.Tile,{label:"Booked so far today",value:'ready'===T?`${f}`:'connecting'===T?'Connecting\u2026':'Not connected',sub:"Not enough history for a forecast yet",onPress:()=>e('kitchen','prep')}),(0,be.jsx)(G.Tile,{label:"Orders due today",value:`${y.length}`,sub:y.map(e=>`${e.s.name} by ${e.s.cutoff}`).join(' \xb7 ')||'None',tone:y.some(e=>e.cutPassed)?'red':y.length?'amber':'ok',onPress:()=>e('orders')})]}),x.map(e=>(0,be.jsxs)(E.Banner,{kind:"danger",title:`${e.ing.name} ${e.pct>0?'+':''}${e.pct.toFixed(0)}%: ${e.dropped.length} dish${1===e.dropped.length?'':'es'} drop below target`,children:[e.dropped.map(e=>e.item.name).join(', '),". Open GP \u203a Price changes."]},e.ing.id)),j.length?(0,be.jsx)(R.default,{accessibilityRole:"button",onPress:()=>e('stock','deliveries'),children:(0,be.jsx)(E.Banner,{kind:"info",title:`${j.length} deliver${1===j.length?'y':'ies'} to check in today`,children:"Count in against the order, flag shorts and price changes."})}):null,C.length?(0,be.jsx)(R.default,{accessibilityRole:"button",onPress:()=>e('gp','dishes'),children:(0,be.jsxs)(E.Banner,{kind:"warn",title:`${C.length} dishes below ${s.targetGp}% GP`,children:[C.slice(0,4).map(e=>e.item.name).join(', '),C.length>4?'\u2026':'']})}):null,(0,be.jsx)(E.Row,{wrap:!0,gap:8,children:[['Recipe cards','recipes'],['Food safety log','haccp'],['Specials board','specials'],[ie.CREATOR_TITLE,'creator'],['Prep list','prep'],['Live tickets & sold out','live'],['Allergens','allergens'],['Accident book','accidents']].map(([s,t])=>(0,be.jsx)(R.default,{accessibilityRole:"button",accessibilityLabel:s,onPress:()=>'creator'===t?e('creator'):e('kitchen',t),style:{flexGrow:1,flexBasis:140,padding:12,borderRadius:12,borderWidth:1.5,borderColor:F.colours.gold,backgroundColor:F.colours.surface},children:(0,be.jsxs)(E.T,{weight:"semibold",children:[s," \u203a"]})},t))}),(0,be.jsx)(E.Badge,{kind:"neutral",label:"Nothing is ordered or sent from here"})]})}},805,[1204,1081,918,1205,991,992,994,2,1004,995,996,959,818,921,1269,1270,950,1003,920,1001,1002,924,1274,30,233,122,263,151,287,127,289,861,925,813,816,821,927,1279,1283,1286,1287,1314,1315,938,1316,1008,922,1009,1011,1010,1324,990,953,859,1012,1325,1013,1326,932,1334,934,998,999,819,1335,820,1007,24]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"APP_VARIANT",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"ENTRY",{enumerable:!0,get:function(){return s}}),_e.isAllowedPath=function(e,n=c){return!(t.IS_ISOLATED_VENUE&&/^\/(customer|table)(\/|$)/.test(e)&&![`/customer/${t.VENUE_RID}`,`/customer/${t.VENUE_RID}/`].includes(e))&&('/'===e||''===e||f[n].test(e))},_e.canShow=function(e,t=c){return t===e||'owner'===t&&'customer'===e};var e,t=r(d[0]),n=r(d[1]),o=(e=n)&&e.__esModule?e:{default:e};const u=o.default.expoConfig?.extra?.appVariant??void 0??'owner',c=['owner','staff','customer','display','chef'].includes(u)?u:'owner',s={owner:'/owner',staff:'/team',customer:`/customer/${t.VENUE_RID}`,display:'/display',chef:'/kitchen'},f={owner:/^\/(owner|customer|table)(\/|$)/,customer:/^\/(customer|table)(\/|$)/,staff:/^\/team(\/|$)/,display:/^\/display(\/|$)/,chef:/^\/kitchen(\/|$)/}},806,[5,408]); +__d(function(g,r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"PERMISSIONS",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"can",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"CHEF_SECTIONS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"chefSectionAllowed",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"rotaView",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"chatView",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"ticketView",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"supplierView",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"auditView",{enumerable:!0,get:function(){return p}});const e={owner:'all',manager:'all',staff:new Set(['rota-shifts','tickets','eighty-six','allergens']),chef:new Set(['stock','costing','gp','waste','dish-sales','prep','ordering','allergens','compliance','rota-shifts','kitchen-chat','tickets','eighty-six','specials'])},t=(t,n)=>{const a=e[t];return'all'===a||a.has(n)},n={stock:'stock','stock-take':'stock',deliveries:'stock',gp:'gp','price-changes':'gp','gp-week':'gp','menu-engineering':'dish-sales',orders:'ordering',prep:'prep',live:'tickets',waste:'waste',allergens:'allergens',compliance:'compliance',haccp:'compliance',accidents:'compliance','new-dish':'gp',specials:'specials',recipes:'allergens','recipe-cards':'allergens'},a=e=>e in n&&t('chef',n[e]),s=(e,n,a)=>t(e,'staff-personal')?{staff:n,shifts:a}:{staff:n.filter(e=>e.active).map(e=>({id:e.id,name:e.name,...e.nickname?{nickname:e.nickname}:{},job:e.job})),shifts:a.filter(e=>e.published).map(({id:e,staffId:t,date:n,day:a,start:s,end:c,published:l})=>({id:e,staffId:t,date:n,day:a,start:s,end:c,published:l}))},c=(e,t)=>'chef'===e?t.filter(e=>'kitchen'===e.ch&&!e.removed):t,l=(e,n)=>t(e,'customer-personal')?n:n.map(({id:e,ref:t,type:n,tableNo:a,slotTime:s,lines:c,status:l,allergies:o,allergyAck:p,handoverCheck:f,allergyChain:u,bookingId:m,readiness:h,createdAt:b,restaurantId:k,notes:y,accepted:w,allergyTicks:j})=>({id:e,ref:t,type:n,tableNo:a,slotTime:s,lines:c,status:l,allergies:o,allergyAck:p,handoverCheck:f,allergyChain:u,bookingId:m,readiness:h,createdAt:b,restaurantId:k,notes:y,accepted:w,allergyTicks:j})),o=(e,n)=>t(e,'supplier-email')?n:n.map(e=>({...e,email:''})),p=(e,n)=>t(e,'audit-all')?n:n.filter(e=>'menu'===e.kind&&/allergen|sign-off|recipe card/i.test(e.text))},807,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(t){const n=String(t??'').trim(),l=n.match(/\d+/g);return 1===l?.length?l[0].replace(/^0+(?=\d)/,''):n}Object.defineProperty(e,'__esModule',{value:!0}),e.plainTableNumber=t,Object.defineProperty(e,"tableNumbers",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"tableListNumbers",{enumerable:!0,get:function(){return l}}),e.tableNumbersA11y=function(t){const l=n(t).split('+').filter(Boolean);return l.length?`${1===l.length?'Table':'Tables'} ${l.join(', ')}`:'No table'};const n=n=>String(n??'').split('+').map(t).filter(Boolean).join('+'),l=(t,l=" + ")=>t.map(n).filter(Boolean).join(l)},808,[]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEFAULT_DWELL",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"dwellBands",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"bandLabel",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"fmtMins",{enumerable:!0,get:function(){return o}}),_e.dwellFor=function(e,t,r=[]){const o=n(e),i=Math.max(0,o.findIndex(e=>t<=e.upTo)),s=o[i]??o[o.length-1];if(!1===e?.settings.dwellLearn)return{mins:s.mins,learned:!1,samples:0};const a=0===i?1:o[i-1].upTo+1,u=r.filter(e=>'finished'===e.status&&e.seatedAt&&e.finishedAt&&e.partySize>=a&&e.partySize<=s.upTo).map(e=>(new Date(e.finishedAt).getTime()-new Date(e.seatedAt).getTime())/6e4).filter(e=>e>=20&&e<=360).sort((e,t)=>e-t);if(u.length<8)return{mins:s.mins,learned:!1,samples:u.length};const l=u[Math.floor(u.length/2)];return{mins:5*Math.round((s.mins+l)/2/5),learned:!0,samples:u.length}},Object.defineProperty(_e,"DAYS",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"ruleText",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"ANCHORAGE_EVENTS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"regularEventsOf",{enumerable:!0,get:function(){return l}}),_e.occursOn=m,_e.nextOccurrence=function(e,t){const n=f(t);for(let t=0;t<400;t++){const r=c(new Date(n.getFullYear(),n.getMonth(),n.getDate()+t));if(m(e,r))return r}return null},_e.expandEvents=function(e,t,n,r){const o=[];if(!t.some(e=>e.active))return o;const i=f(n),s=f(r);for(let n=i;n<=s;n=new Date(n.getFullYear(),n.getMonth(),n.getDate()+1)){const r=c(n);for(const n of t)m(n,r)&&o.push({id:`${n.id}:${r}`,restaurantId:e,date:r,title:n.name,kind:'event',example:!1,source:'regular',description:[n.time?`from ${n.time}`:'',n.lastFood?`last food orders ${n.lastFood}`:'',n.notes??''].filter(Boolean).join(' \xb7 '),busier:n.busier,lastFood:n.lastFood,time:n.time})}return o},_e.lastFoodOn=function(t,n){if(!t)return null;const r=f(n).getDay(),o=t.settings.lastFoodByDay?.[r],s=(0,e.kitchenHoursOn)(t,f(n));let a=s?{time:s[1],reason:'kitchen closes'}:null;o&&(!a||oe?.settings.dwellBands?.length?e.settings.dwellBands:t,r=(e,t)=>{const n=0===t?1:e[t-1].upTo+1,r=e[t].upTo;return r>=9999?`${n} or more covers`:n===r?`${n} cover${1===n?'':'s'}`:`${n}\u2013${r} covers`},o=e=>e%60==0?`${e/60} hour${60===e?'':'s'}`:e>60?`${Math.floor(e/60)} h ${e%60} min`:`${e} min`;const i=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],s=['','first','second','third','fourth'],a=e=>'last'===e.kind?`Last ${i[e.weekday]} of every month`:'nth'===e.kind?`${s[e.n][0].toUpperCase()}${s[e.n].slice(1)} ${i[e.weekday]} of every month`:'weekly'===e.kind?`Every ${i[e.weekday]}`:`One-off: ${e.date}`,u=[{id:'ev-music-night',name:'Open Mic Night',rule:{kind:'last',weekday:0},time:'20:00',notes:'Live music from 8pm.',busier:!0,lastFood:'19:00',active:!0}],l=e=>e?.settings.regularEvents??('anchorage'===e?.id?u:[]),d=e=>String(e).padStart(2,'0'),c=e=>`${e.getFullYear()}-${d(e.getMonth()+1)}-${d(e.getDate())}`,f=e=>new Date(Number(e.slice(0,4)),Number(e.slice(5,7))-1,Number(e.slice(8,10)));function m(e,t){if(!e.active)return!1;const n=e.rule;if('once'===n.kind)return n.date===t;const r=f(t);return r.getDay()===n.weekday&&('weekly'===n.kind||('nth'===n.kind?Math.ceil(r.getDate()/7)===n.n:new Date(r.getFullYear(),r.getMonth(),r.getDate()+7).getMonth()!==r.getMonth()))}const b=e=>e?.settings.afterLastFood??'drinks',p=e=>{const[t,n]=e.split(':').map(Number);return`${t%12||12}${n?`:${d(n)}`:''}${t<12?'am':'pm'}`},y=e=>e?.settings.showTakeaway??'anchorage'!==e?.id,h=e=>!1!==e?.settings.coversCounter,O=e=>!1!==e?.settings.nextTableFree,$=e=>!1!==e?.settings.dogQuestion,w=e=>!1!==e?.settings.dietQuestion,F=e=>!1!==e?.settings.accessQuestion,k=(e,t)=>e?.settings.holidayFullNames?t:t.replace(/\s*\(substitute day\)/gi,'').trim()},809,[815]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Honeypot=function({value:t,onChange:n}){return(0,l.jsx)(o.default,{"aria-hidden":!0,pointerEvents:"none",style:{position:'absolute',left:-1e4,top:0,width:1,height:1,overflow:'hidden',opacity:0},children:(0,l.jsx)(e.TextInput,{testID:"hp-field",accessibilityLabel:"Leave this empty",value:t,onChangeText:n,tabIndex:-1,autoComplete:'off',name:'cc_extra_info','aria-hidden':!0})})};var e=r(d[0]);r(d[1]),r(d[2]);var t,n=r(d[3]),o=(t=n)&&t.__esModule?t:{default:t},l=r(d[4])},810,[877,30,122,127,24]); +__d(function(_g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.startForm=function(t=Date.now()){return{openedAt:t,hp:''}},e.guardFor=function(t,n=Date.now()){return{hp:t.hp,formMs:Math.max(0,Math.round(n-t.openedAt))}},e.rememberGuard=function(n,o){t.set(n,o)},e.takeGuard=function(n){const o=t.get(n);return o?(t.delete(n),o):{}};const t=new Map},811,[]); +__d(function(g,r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"NOTES_PLACEHOLDER",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"WIX_EDIT_NOTE",{enumerable:!0,get:function(){return o}}),e.canEditBooking=function(t){return'customer'!==t.variant&&('staff'===t.variant||t.inStaffApp?!!t.shiftManager:'display'===t.variant||'chef'===t.variant||'staff'!==t.role)},Object.defineProperty(e,"isWixBooking",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"EDIT_FIELDS",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"FIELD_WORDS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"draftOf",{enumerable:!0,get:function(){return c}}),e.changedFields=f,e.editPatch=function(t,n,o,s=(new Date).toISOString()){const d=f(t,n);if(!d.length)return{};const l={};for(const t of d){const o=u(t,n[t]);l[t]='partySize'===t?Math.max(1,Math.min(200,o)):'phone'===t||'email'===t||'table'===t?o||void 0:o}d.includes('table')&&(l.tableSetHere=!0);const c=t;return l.locallyEdited=!0,l.editedFields=[...new Set([...c.editedFields??[],...d])],l.editLog=[...c.editLog??[],{at:s,by:o.by.slice(0,80),app:o.app,fields:d}].slice(-50),l},e.editWarnings=function(n,o,s,d,l=90){const c=[],u={...n,date:o.date,time:o.time,partySize:o.partySize};if(o.table){const n=(0,t.tableOverlaps)(u,o.table,s.filter(t=>t.date===o.date),l);n.length&&c.push(`The table already has a booking at about the same time: ${n.map(t=>`${t.time} ${t.walkIn?'walk-in':t.name}`).join(', ')}.`)}d&&c.push(`Bookings are paused ${d.from} to ${d.to}${d.reason?` (${d.reason})`:''}.`);return c},Object.defineProperty(e,"editedWords",{enumerable:!0,get:function(){return b}});var t=r(_d[0]);const n='For example: birthday, high chair, dog, window seat',o='This booking came from the website. Changes here are not sent to website bookings yet.';const s=t=>{const n=t;return'Wix'===n.importedFrom||!!n.wix||(t.tags??[]).includes('Wix')},d=['date','time','partySize','name','phone','email','notes','table'],l={date:'date',time:'time',partySize:'covers',name:'name',phone:'phone',email:'email',notes:'notes',table:'table'},c=t=>({date:t.date,time:t.time,partySize:t.partySize,name:t.name,phone:t.phone??'',email:t.email??'',notes:t.notes??'',table:t.table??''}),u=(t,n)=>'partySize'===t?Number(n):String(n??'').trim();function f(t,n){const o=c(t);return d.filter(t=>u(t,o[t])!==u(t,n[t]))}const b=t=>t.map(t=>l[t]).join(', ')},812,[1275]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"webLine",{enumerable:!0,get:function(){return j.webLine}}),_e.T=I,Object.defineProperty(_e,"H1",{enumerable:!0,get:function(){return R}}),Object.defineProperty(_e,"H2",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"Muted",{enumerable:!0,get:function(){return W}}),_e.BrandBar=D,_e.Screen=function({children:e,title:t,subtitle:o,back:l=!0,right:n,maxWidth:s=640,footer:u,scroll:b=!0}){const f=(0,w.jsx)(h.default,{style:{width:'100%',maxWidth:s,alignSelf:'center',padding:16,gap:12,alignItems:'stretch'},children:e});return(0,w.jsxs)(y.SafeAreaView,{style:{flex:1,backgroundColor:p.colours.bg},edges:['top','left','right'],children:[(0,w.jsx)(h.default,{style:{width:'100%',maxWidth:s,alignSelf:'center'},children:(0,w.jsx)(D,{title:t,subtitle:o,back:l,right:n})}),b?(0,w.jsx)(c.default,{contentContainerStyle:{paddingBottom:40},children:f}):(0,w.jsx)(h.default,{style:{flex:1},children:f}),u?(0,w.jsx)(h.default,{style:H.footer,children:(0,w.jsx)(h.default,{style:{width:'100%',maxWidth:s,alignSelf:'center'},children:u})}):null]})},_e.Button=function({label:e,sub:t,onPress:o,kind:l="primary",disabled:n,small:c,style:u,accessibilityLabel:b,testID:h}){const f={primary:p.colours.gold,secondary:p.colours.tile,danger:p.colours.redSolid,ghost:'transparent',success:p.colours.accentBg}[l],y={primary:p.colours.onGold,secondary:p.colours.text,danger:'#FFFFFF',ghost:p.colours.gold,success:p.colours.goldLight}[l],j={primary:'transparent',secondary:p.colours.hairline,danger:'transparent',ghost:'transparent',success:p.colours.accentBorder}[l];return(0,w.jsxs)(s.default,{testID:h,accessibilityRole:"button",accessibilityLabel:b??e,accessibilityState:{disabled:!!n},disabled:n,onPress:o,style:({pressed:e})=>[H.btn,{backgroundColor:e&&'secondary'===l?p.colours.tilePressed:f,borderColor:j,opacity:n?.4:e?.85:1},c&&{paddingVertical:8,paddingHorizontal:14,minHeight:x.control.min,minWidth:44},u],children:[(0,w.jsx)(I,{weight:"semibold",size:c?p.font.small:p.font.body,colour:y,center:!0,children:e}),t?(0,w.jsx)(I,{size:c?p.font.small-2:p.font.small,colour:y,center:!0,testID:h?`${h}-sub`:void 0,children:t}):null]})},_e.Card=function({children:e,style:t,onPress:o,highlight:l}){const n=l===p.colours.gold||l===p.colours.accentBorder,c=(0,w.jsx)(h.default,{style:[H.card,{alignItems:'center'},l?{borderColor:n?p.colours.accentBorder:l,borderWidth:n?1:2}:null,t],children:e});return o?(0,w.jsx)(s.default,{accessibilityRole:"button",onPress:o,style:({pressed:e})=>({opacity:e?.85:1}),children:c}):c},_e.Badge=function({label:e,kind:t="neutral"}){const o={neutral:[p.colours.surface2,p.colours.muted,p.colours.border],gold:[p.colours.goldTint,p.colours.goldLight,p.colours.gold],red:[p.colours.redBg,'#FFD9D4',p.colours.red],amber:[p.colours.amberBg,'#FFE2A8',p.colours.amber],ok:[p.colours.okBg,p.colours.goldLight,p.colours.ok],blue:[p.colours.blueBg,p.colours.goldLight,p.colours.blue]}[t];return(0,w.jsx)(h.default,{style:[H.badge,{backgroundColor:o[0],borderColor:o[2],maxWidth:'100%'}],children:(0,w.jsx)(I,{size:13,weight:"medium",colour:o[1],style:{flexShrink:1},children:e})})},_e.Banner=F,Object.defineProperty(_e,"ExampleAllergenNotice",{enumerable:!0,get:function(){return z}}),Object.defineProperty(_e,"DemoPaymentNotice",{enumerable:!0,get:function(){return P}}),_e.Row=L,Object.defineProperty(_e,"Divider",{enumerable:!0,get:function(){return v}}),_e.Field=function({label:e,...o}){return(0,w.jsxs)(h.default,{style:{gap:4,alignSelf:'stretch',width:'100%'},children:[(0,w.jsx)(I,{size:p.font.small,weight:"medium",colour:p.colours.muted,center:!0,children:e}),(0,w.jsx)(t.TextInput,{accessibilityLabel:e,placeholderTextColor:"#7D776C",...o,style:[H.input,o.multiline&&{minHeight:70,textAlignVertical:'top'},o.style]})]})},_e.Chip=function({label:e,selected:t,onPress:o,disabled:l,sub:n,testID:c}){return(0,w.jsxs)(s.default,{testID:c,accessibilityRole:"button",accessibilityState:{selected:!!t,disabled:!!l},accessibilityLabel:`${e}${n?`, ${n}`:''}${t?', selected':''}`,'aria-pressed':!!t,disabled:l,onPress:o,style:[H.chip,t&&{backgroundColor:p.colours.gold,borderColor:p.colours.gold},l&&{opacity:.35}],children:[(0,w.jsx)(I,{size:p.font.small,weight:"medium",colour:t?p.colours.onGold:p.colours.text,center:!0,children:e}),n?(0,w.jsx)(I,{size:12,colour:t?p.colours.onGold:p.colours.muted,center:!0,children:n}):null]})},_e.Toggle=function({value:e,onChange:t,label:o,testID:l,disabled:n,a11y:s}){return(0,w.jsxs)(L,{style:{justifyContent:'space-between',flexShrink:1,minWidth:0},children:[(0,w.jsx)(I,{style:{flex:1,flexShrink:1},children:o}),(0,w.jsx)(b.default,{testID:l,disabled:n,accessibilityLabel:s??o,value:e,onValueChange:t,trackColor:{true:p.colours.gold,false:'#444'},thumbColor:e?'#FFF6E0':'#BBB',activeThumbColor:'#FFF6E0',activeTrackColor:p.colours.gold})]})},_e.Stepper=function({value:e,onChange:t,min:o=1,max:l=20,label:n,step:c=1,format:u,testID:b}){const f=u?u(e):String(e),y=e=>Math.round(e/c)*c;return(0,w.jsxs)(L,{gap:10,children:[(0,w.jsx)(s.default,{testID:b?`${b}-down`:void 0,accessibilityRole:"button",accessibilityLabel:`Decrease ${n??''}`,disabled:e<=o,onPress:()=>t(Math.max(o,y(e-c))),style:[H.stepBtn,e<=o?{opacity:.4}:null],children:(0,w.jsx)(I,{size:20,colour:p.colours.gold,children:"\u2212"})}),(0,w.jsx)(h.default,{testID:b?`${b}-value`:void 0,accessibilityLabel:n?`${n}: ${f}`:f,children:(0,w.jsx)(I,{weight:"semibold",size:p.font.large,style:{minWidth:u?64:28,textAlign:'center'},children:f})}),(0,w.jsx)(s.default,{testID:b?`${b}-up`:void 0,accessibilityRole:"button",accessibilityLabel:`Increase ${n??''}`,disabled:e>=l,onPress:()=>t(Math.min(l,y(e+c))),style:[H.stepBtn,e>=l?{opacity:.4}:null],children:(0,w.jsx)(I,{size:20,colour:p.colours.gold,children:"+"})})]})},_e.Sheet=function({visible:e,onClose:t,title:o,children:u,maxWidth:b,testID:x,footer:j}){const{height:C}=(0,f.default)(),k=l.default.useContext(y.SafeAreaInsetsContext)??{top:0,bottom:0,left:0,right:0},B=Math.max(320,C-k.top-k.bottom-24);return(0,w.jsx)(n.default,{visible:e,transparent:!0,animationType:"fade",onRequestClose:t,children:(0,w.jsx)(h.default,{style:[H.overlay,{padding:12,paddingTop:12+k.top,paddingBottom:12+k.bottom}],children:(0,w.jsxs)(h.default,{style:[H.sheet,{maxHeight:B},b?{maxWidth:b}:null],testID:x,children:[(0,w.jsxs)(L,{style:{justifyContent:'space-between',marginBottom:8,gap:8},children:[(0,w.jsx)(T,{style:{flex:1},children:o}),(0,w.jsx)(s.default,{accessibilityRole:"button",accessibilityLabel:"Close",onPress:t,hitSlop:8,testID:"sheet-close",style:{minWidth:48,minHeight:48,width:S?72:48,alignItems:'center',justifyContent:'center',marginRight:-8,marginTop:-6},children:(0,w.jsx)(I,{size:S?18:24,colour:p.colours.text,children:S?'Close':'\u2715'})})]}),(0,w.jsx)(c.default,{style:{flexShrink:1},contentContainerStyle:{gap:12,paddingTop:2,paddingBottom:4},children:u}),j?(0,w.jsx)(h.default,{style:{borderTopWidth:1,borderTopColor:p.colours.border,paddingTop:10,marginTop:8},testID:x?`${x}-footer`:void 0,children:j}):null]})})})},_e.SectionTitle=function({children:e}){return(0,w.jsx)(I,{weight:"semibold",size:12,colour:p.colours.goldMuted,center:!0,style:{textTransform:'uppercase',letterSpacing:1.6,marginTop:8},children:e})},Object.defineProperty(_e,"styles",{enumerable:!0,get:function(){return H}});var t=r(d[0]),o=r(d[1]),l=e(r(d[2])),n=e(r(d[3])),s=e(r(d[4])),c=e(r(d[5])),u=e(r(d[6])),b=e(r(d[7])),h=e(r(d[8])),f=e(r(d[9])),y=r(d[10]),p=r(d[11]),x=r(d[12]),j=r(d[13]),C=r(d[14]),k=r(d[15]),B=r(d[16]),w=r(d[17]);const S=['kirkton','abbotsford'].includes(C.VENUE_RID);function I({children:e,style:o,size:l=p.font.body,weight:n="regular",colour:s=p.colours.text,numberOfLines:c,center:u,testID:b,accessibilityRole:h}){return(0,w.jsx)(t.Text,{testID:b,accessibilityRole:h,numberOfLines:c,style:[{fontFamily:p.fonts[n],fontSize:l,color:s,lineHeight:(0,x.lineFor)(l)},u&&{textAlign:'center'},o,(0,j.webLine)(o,l)],children:e})}const R=e=>(0,w.jsx)(I,{size:p.font.title,weight:"semibold",center:!0,...e}),T=e=>(0,w.jsx)(I,{size:p.font.large,weight:"semibold",center:!0,...e}),W=e=>(0,w.jsx)(I,{colour:p.colours.muted,size:p.font.small,...e});function D({title:e,back:t=!0,right:l,subtitle:n}){return(0,w.jsxs)(h.default,{style:H.brandBar,children:[(0,w.jsxs)(h.default,{style:H.row,children:[(0,w.jsx)(h.default,{style:H.brandSide,children:t?(0,w.jsx)(s.default,{accessibilityRole:"button",accessibilityLabel:"Back",onPress:()=>o.router.canGoBack()?o.router.back():o.router.replace(k.ENTRY[k.APP_VARIANT]),style:H.backBtn,hitSlop:10,children:(0,w.jsx)(I,{size:18,weight:"semibold",colour:p.colours.gold,children:"\u2039 Back"})}):null}),(0,w.jsx)(s.default,{onPress:()=>o.router.push(k.ENTRY[k.APP_VARIANT]),accessibilityLabel:"Home",style:H.brandCenter,children:(0,w.jsx)(B.RestaurantBrand,{size:B.HEADER_LOGO})}),(0,w.jsx)(h.default,{style:[H.brandSide,{alignItems:'flex-end'}],children:l?(0,w.jsx)(h.default,{style:{flexShrink:0},children:l}):null})]}),e?(0,w.jsx)(R,{style:{marginTop:10,alignSelf:'stretch'},children:e}):null,n?(0,w.jsx)(W,{center:!0,style:{alignSelf:'stretch'},children:n}):null]})}function F({kind:e="info",title:t,children:o}){const n={info:[p.colours.surface,p.colours.gold,p.colours.text],warn:[p.colours.amberBg,p.colours.amber,'#FFE2A8'],danger:[p.colours.redBg,p.colours.red,'#FFE3DF'],success:[p.colours.okBg,p.colours.ok,p.colours.goldLight],example:[p.colours.amberBg,p.colours.amber,'#FFE2A8'],demo:[p.colours.goldTint,p.colours.gold,p.colours.goldLight]}[e];return(0,w.jsxs)(h.default,{accessibilityRole:"summary",style:[H.banner,{backgroundColor:n[0],borderLeftColor:n[1]}],children:[t?(0,w.jsx)(I,{weight:"semibold",colour:n[2],center:!0,children:t}):null,l.default.Children.toArray(o).every(e=>'string'==typeof e||'number'==typeof e)?(0,w.jsx)(I,{size:p.font.small,colour:n[2],center:!0,children:o}):o]})}const z=()=>(0,w.jsx)(F,{kind:"example",title:"Allergens awaiting kitchen verification",children:"This allergen information has not been verified by the kitchen. Head chef sign-off is required. Always speak to staff about allergies."}),P=()=>(0,w.jsx)(F,{kind:"demo",title:"Card payments: not set up yet",children:"No card is charged and no payment provider is contacted."});function L({children:e,style:t,gap:o=8,wrap:l}){return(0,w.jsx)(h.default,{style:[H.row,{gap:o},l&&{flexWrap:'wrap',justifyContent:'center'},t],children:e})}const v=()=>(0,w.jsx)(h.default,{style:{height:1,backgroundColor:p.colours.border,marginVertical:4}});const H=u.default.create({row:{flexDirection:'row',alignItems:'center'},brandBar:{paddingHorizontal:16,paddingTop:8,paddingBottom:8,borderBottomWidth:1,borderBottomColor:p.colours.border},brandSide:{width:96,minHeight:48,justifyContent:'center'},brandCenter:{flex:1,alignItems:'center',justifyContent:'center',minHeight:48},backBtn:{paddingRight:12,minHeight:48,minWidth:88,justifyContent:'center'},btn:{borderRadius:x.radii.button,paddingVertical:12,paddingHorizontal:18,borderWidth:1,alignItems:'center',justifyContent:'center',minHeight:x.control.min,alignSelf:'stretch'},card:{backgroundColor:p.colours.surface,borderRadius:p.radius.l,padding:16,borderWidth:1,borderColor:p.colours.hairline,gap:8},badge:{borderRadius:999,paddingHorizontal:9,paddingVertical:2,borderWidth:1,alignSelf:'flex-start'},banner:{borderRadius:p.radius.m,padding:12,borderLeftWidth:5,gap:2},input:{minWidth:0,backgroundColor:p.colours.surface2,borderColor:p.colours.border,borderWidth:1,borderRadius:p.radius.m,paddingHorizontal:12,paddingVertical:10,color:p.colours.text,fontSize:p.font.body,fontFamily:p.fonts.regular},chip:{borderWidth:1,borderColor:p.colours.border,borderRadius:p.radius.m,paddingHorizontal:12,paddingVertical:8,backgroundColor:p.colours.surface2,minWidth:64,minHeight:44,justifyContent:'center'},stepBtn:{width:44,height:44,borderRadius:22,borderWidth:1.5,borderColor:p.colours.gold,alignItems:'center',justifyContent:'center'},overlay:{flex:1,backgroundColor:'rgba(0,0,0,0.7)',justifyContent:'center',alignItems:'center',padding:16},sheet:{backgroundColor:p.colours.surface,borderRadius:x.radii.xl,padding:18,width:'100%',maxWidth:520,maxHeight:'90%',borderWidth:1,borderColor:p.colours.gold},footer:{borderTopWidth:1,borderTopColor:p.colours.border,backgroundColor:p.colours.surface,padding:12}})},813,[877,804,30,256,263,151,46,271,127,287,289,821,1209,1211,5,806,861,24]); +__d(function(_g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ALLERGENS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"allergenLabel",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"SEVERITIES",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"severityLabel",{enumerable:!0,get:function(){return s}}),e.effectiveAllergens=function(l,n=[]){const t={...l.allergens};for(const s of l.optionGroups??[])for(const l of s.choices)if(n.includes(l.id)&&l.allergens)for(const[n,s]of Object.entries(l.allergens))'contains'!==t[n]&&(t[n]=s);return t},e.conflictsFor=function(l,n){const t=[],s=[];for(const a of n)'contains'===l[a.allergen]?t.push(a.allergen):'may'===l[a.allergen]&&s.push(a.allergen);return{contains:t,may:s}},Object.defineProperty(e,"hasConflict",{enumerable:!0,get:function(){return a}});const l=[{id:'gluten',label:'Cereals containing gluten',short:'Gluten'},{id:'crustaceans',label:'Crustaceans',short:'Crustaceans'},{id:'molluscs',label:'Molluscs',short:'Molluscs'},{id:'eggs',label:'Eggs',short:'Eggs'},{id:'fish',label:'Fish',short:'Fish'},{id:'peanuts',label:'Peanuts',short:'Peanuts'},{id:'treenuts',label:'Tree nuts',short:'Tree nuts'},{id:'soya',label:'Soya',short:'Soya'},{id:'milk',label:'Milk',short:'Milk'},{id:'celery',label:'Celery',short:'Celery'},{id:'mustard',label:'Mustard',short:'Mustard'},{id:'sesame',label:'Sesame',short:'Sesame'},{id:'sulphites',label:'Sulphur dioxide / sulphites',short:'Sulphites'},{id:'lupin',label:'Lupin',short:'Lupin'}],n=n=>l.find(l=>l.id===n)?.short??n,t=[{id:'intolerance',label:'Intolerance'},{id:'allergy',label:'Allergy'},{id:'coeliac',label:'Coeliac disease'},{id:'anaphylaxis',label:'Severe \u2014 anaphylaxis risk'}],s=l=>t.find(n=>n.id===l)?.label??l;const a=l=>l.contains.length>0||l.may.length>0},814,[]); +__d(function(g,_r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ANCHORAGE_SEASONS",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"hourSetsOf",{enumerable:!0,get:function(){return n}}),e.seasonOn=s,e.kitchenHoursOn=l,e.hoursFor=function(r,n){const u=l(r,n);return u?{open:(0,t.atTime)(n,u[0]),close:(0,t.atTime)(n,u[1])}:null};var t=_r(_d[0]);const r=[{id:'winter',name:'Winter',hours:{0:['12:30','19:00'],1:null,2:null,3:['12:00','19:00'],4:['12:00','19:00'],5:['12:00','20:00'],6:['12:00','20:00']}},{id:'summer',name:'Summer',hours:null}],n=t=>t.settings.hourSets??('anchorage'===t.id?r:[]),u=t=>`${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`,o=t=>`${t.getFullYear()}-${u(t)}`;function s(t,r){const o=n(t).filter(t=>t.hours);if(!o.length)return null;const s=o.filter(t=>t.start).sort((t,r)=>t.start.localeCompare(r.start));if(s.length<2)return s[0]??o[0];const l=u(r);return[...s].reverse().find(t=>t.start<=l)??s[s.length-1]}function l(t,r){const n=(t.settings.hourOverrides??[]).find(t=>t.date===o(r));if(n)return n.hours;const u=s(t,r);return u?.hours?u.hours[r.getDay()]??null:t.kitchenHours[r.getDay()]??null}},815,[818]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"gbp",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"pounds",{enumerable:!0,get:function(){return n}});const t=t=>`\xa3${(t/100).toFixed(2)}`,n=t=>Math.round(100*t)},816,[]); +__d(function(g,_r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.takeawaySlots=function(s,o,r){const l=(0,t.hoursFor)(s,r);if(!l)return[];const d=s.settings.slotMinutes,u=(0,n.addMins)(r,s.settings.leadMins),c=[];for(let t=new Date(l.open);t<=l.close;t=(0,n.addMins)(t,d)){if(tn.restaurantId===s.id&&'takeaway'===n.type&&'cancelled'!==n.status&&n.slotTime&&new Date(n.slotTime).getTime()===t.getTime()).length;c.push({time:new Date(t),label:(0,n.hm)(t),taken:r,cap:s.settings.slotCap,full:r>=s.settings.slotCap})}return c},e.bookingSlots=function(r,l,d,u,c){const f=(0,t.hoursFor)(r,l);if(!f)return[];const p=[],M=(0,n.addMins)(f.close,-60),h=(0,s.lastFoodOn)(r,o(l)),k=h?(0,n.addMins)((0,n.atTime)(l,h.time),-60):M,S='drinks'===(0,s.afterLastFood)(r);for(let t=new Date(f.open);t<=M;t=(0,n.addMins)(t,30)){const s=(0,n.hm)(t),o=t>k;if(o&&!S)continue;const l=r.settings.bookingCoversPerSlot-d(s),f=t.getTime()=u,...o?{drinksOnly:!0}:{}})}return p};var t=_r(_d[0]),n=_r(_d[1]),s=_r(_d[2]);const o=t=>`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`},817,[815,818,809]); +__d(function(g,r,i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"pad",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"ymd",{enumerable:!0,get:function(){return n}}),e.venueYmd=function(t,u="Europe/London"){try{const n=new Intl.DateTimeFormat('en-CA',{timeZone:u,year:'numeric',month:'2-digit',day:'2-digit'}).format(t);if(/^\d{4}-\d{2}-\d{2}$/.test(n))return n}catch{}return n(t)},Object.defineProperty(e,"hm",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"parseYmd",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"toMins",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"fromMins",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"atTime",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"addMins",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"dayShort",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"dayLong",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"monthLong",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"niceDate",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"niceDateYear",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"minsBetween",{enumerable:!0,get:function(){return P}});const t=t=>String(t).padStart(2,'0'),n=n=>`${n.getFullYear()}-${t(n.getMonth()+1)}-${t(n.getDate())}`;const u=n=>`${t(n.getHours())}:${t(n.getMinutes())}`,a=t=>{const[n,u,a]=t.split('-').map(Number);return new Date(n,u-1,a)},o=t=>{const[n,u]=t.split(':').map(Number);return 60*n+u},c=n=>`${t(Math.floor(n/60))}:${t(n%60)}`,d=(t,n)=>{const u=new Date(t);return u.setHours(0,0,0,0),u.setMinutes(o(n)),u},m=(t,n)=>new Date(t.getTime()+6e4*n),b=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],y=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],f=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],l=['January','February','March','April','May','June','July','August','September','October','November','December'],p=t=>b[t.getDay()],s=t=>y[t.getDay()],O=t=>l[t],M=t=>`${b[t.getDay()]} ${t.getDate()} ${f[t.getMonth()]}`,j=t=>`${M(t)} ${t.getFullYear()}`,P=(t,n)=>Math.round((n.getTime()-t.getTime())/6e4)},818,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"repo",{enumerable:!0,get:function(){return o}});var t=r(d[0]),n=r(d[1]);Object.keys(n).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})});const o=t.localRepositories},819,[1212,1022]); +__d(function(_g,_r2,_i2,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"inviteRefusal",{enumerable:!0,get:function(){return p.inviteRefusal}}),Object.defineProperty(_e,"keysToWipe",{enumerable:!0,get:function(){return p.keysToWipe}}),Object.defineProperty(_e,"changedFields",{enumerable:!0,get:function(){return m.changedFields}}),Object.defineProperty(_e,"useSync",{enumerable:!0,get:function(){return re}}),Object.defineProperty(_e,"can",{enumerable:!0,get:function(){return de}}),Object.defineProperty(_e,"isLive",{enumerable:!0,get:function(){return ue}}),_e.setTempManagerAccess=async function(e,t,a){const s=re.getState().venueId;if(!s||'staff'!==re.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{error:i}=await ne().rpc('set_staff_manager_access',{p_venue:s,p_staff_ref:e,p_on:t,p_reason:a.trim()||null});return i?{ok:!1,message:/owner/i.test(i.message)?'Only an owner can change this.':'Could not save. Try again.'}:(P.useOwner.setState(a=>({staff:a.staff.map(a=>a.id===e?{...a,...t?{role:'manager',managerAccess:!0}:{role:'staff',managerAccess:void 0}}:a)})),{ok:!0})}catch{return{ok:!1,message:'Could not save. Try again when the app is online.'}}},_e.setTempOwnerAccess=async function(e,t,a){const s=re.getState().venueId;if(!s||'staff'!==re.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{error:i}=await ne().rpc('set_staff_owner_access',{p_venue:s,p_staff_ref:e,p_on:t,p_reason:a.trim()||null});if(i)return{ok:!1,message:/owner/i.test(i.message)?'Only an owner can change this.':'Could not save. Try again.'};const n=e=>'Manager'===e.level||'Supervisor'===e.level?'manager':'staff';return P.useOwner.setState(a=>({staff:a.staff.map(a=>a.id===e?{...a,...t?{role:'owner',ownerAccess:!0}:{role:a.managerAccess?'manager':n(a),ownerAccess:void 0}}:a)})),{ok:!0}}catch{return{ok:!1,message:'Could not save. Try again when the app is online.'}}},_e.setManagerAccess=async function(e,t){const a=re.getState().venueId;if(!a||'staff'!==re.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:s,error:i}=await ne().rpc('set_manager_access',{p_venue:a,p_staff_ref:e,p_on:t});if(i)return{ok:!1,message:i.message.replace(/^.*?:\s*/,'')||'Not allowed'};const n=String(s??'');return P.useOwner.setState(t=>({staff:t.staff.map(t=>t.id===e?{...t,...Ge(n)}:t)})),{ok:!0,role:n}}catch(e){return{ok:!1,message:String(e?.message??e)}}},_e.unlockCashUp=async function(e,t,a){if(H.PITCH)return Q.unlockCashUp(e,t,a);const s=re.getState().venueId;if(!s||'staff'!==re.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:i,error:n}=await ne().rpc('unlock_cash_up',{p_venue:s,p_kind:e,p_id:t,p_reason:a});if(n)return{ok:!1,message:n.message};const r=String(i);return'cashup'===e?B.useCashUp.setState(e=>({cashUps:e.cashUps.map(e=>e.id===t?{...e,unlockedUntil:r}:e)})):B.useCashUp.setState(e=>({sales:e.sales.map(e=>e.id===t?{...e,unlockedUntil:r}:e)})),{ok:!0,until:r}}catch(e){return{ok:!1,message:String(e?.message??e)}}},_e.readCashAudit=async function(e){if(H.PITCH)return Q.cashAudit(e);const t=re.getState().venueId;if(!t)return[];let a=ne().from('cash_up_audit').select('at, action, changed_by_name, tbl, for_date, reason, old_row, new_row').eq('venue_id',t).order('at',{ascending:!1}).limit(50);e&&(a=a.eq('row_id',e));const{data:s,error:i}=await a;return i||!Array.isArray(s)?[]:s.map(e=>({at:String(e.at),action:String(e.action),by:String(e.changed_by_name??'\u2014'),tbl:String(e.tbl),forDate:e.for_date??void 0,reason:e.reason??void 0,changed:(0,m.changedFields)(e.old_row,e.new_row)}))},_e.setPushLive=async function(e){const t=re.getState().venueId;if(!t)return{ok:!1,message:'Connect to the venue first.'};const{data:a,error:s}=await ne().rpc('set_push_live',{p_venue:t,p_on:e});return s?{ok:!1,message:s.message}:(qt.setState({live:!!a,known:!0}),{ok:!0})},_e.readPushLive=Kt,_e.readAccessLog=async function(){const e=re.getState().venueId;if(!e)return[];try{const{data:t}=await ne().from('staff_access_log').select('*').eq('venue_id',e).order('changed_at',{ascending:!1}).limit(30);return t??[]}catch{return[]}},Object.defineProperty(_e,"ORDER_LOGO_BUCKET",{enumerable:!0,get:function(){return xt}}),_e.uploadOrderLogo=async function(e,t){const a=re.getState().venueId;if(!a||'staff'!==re.getState().kind)return{ok:!1,message:'offline'};try{const s=await(await fetch(t)).blob(),i=`${a}/${e}-${Date.now()}.jpg`,{error:n}=await ne().storage.from(xt).upload(i,s,{upsert:!0,contentType:'image/jpeg'});return n?{ok:!1,message:n.message}:{ok:!0,path:i}}catch(e){return{ok:!1,message:String(e?.message??e)}}},_e.orderLogoUrl=async function(e){const t=Lt.get(e);if(t&&t.until>Date.now())return t.url;try{const{data:t}=await ne().storage.from(xt).createSignedUrl(e,3600);if(t?.signedUrl)return Lt.set(e,{url:t.signedUrl,until:Date.now()+3e6}),t.signedUrl}catch{}return null},_e.removeOrderLogo=async function(e){try{await ne().storage.from(xt).remove([e])}catch{}},Object.defineProperty(_e,"usePushLive",{enumerable:!0,get:function(){return qt}}),_e.claimInvite=Zt,_e.signedInHereAs=async function(e){fe();const t=await k.kv.get(Ht,null);return!!t&&'staff'===t.kind&&t.staffRef===e},_e.rememberedInviteHere=async function(e){return fe(),await k.kv.get(Gt,null)===e},_e.kirkmichaelStaffAppUrl=async function(){const t=re.getState();if(!e.IS_KIRKMICHAEL||'staff'!==t.kind||t.venueId!==e.VENUE_UUID||t.staffRef!==g.useSession.getState().meId)return null;fe();const a=await k.kv.get(Gt,null);return a?(0,g.appUrl)('staff',a):null},_e.wildingsStaffAppUrl=async function(){const t=re.getState();if(!e.IS_WILDINGS||'staff'!==t.kind||t.venueId!==e.VENUE_UUID||t.staffRef!==g.useSession.getState().meId)return null;fe();const a=await k.kv.get(Gt,null);return a?(0,g.appUrl)('staff',a):null},_e.forgetSignInHere=async function(){fe(),await k.kv.remove(Ht),await k.kv.remove(Gt),oe({mode:'signin',perms:[]});try{await ta()}catch{}},_e.approveShiftSwap=async function(e,t,a){const s=re.getState().venueId;if(H.PITCH||!s||'staff'!==re.getState().kind)return{ok:!0};if(!(0,$.isUuid)(e))return{ok:!1,message:'This shift isn\u2019t on the shared rota yet.'};try{return await Yt('approve_shift_swap',{p_venue:s,p_shift:e,p_to_ref:t,p_kind:a}),{ok:!0}}catch(e){return{ok:!1,message:String(e?.message??e).replace(/^.*?:\s*/,'')||'Not allowed'}}},_e.claimInviteForSync=async function(e){const t=await Zt(e);return'ok'===t.status?t.id:null},_e.reissueInvite=async function(e){if(H.PITCH)return Q.reissueInvite(e);const t=re.getState().venueId;if(!t||'staff'!==re.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:a,error:s}=await ne().rpc('reissue_invite',{p_venue:t,p_staff_ref:e});if(s)return{ok:!1,message:s.message.replace(/^.*?:\s*/,'')||'Not allowed'};const i=a,n=String(i.app??'staff');return{ok:!0,token:String(i.token),expiresAt:String(i.expiresAt),app:'owner'===n||'chef'===n?n:'staff'}}catch(e){return{ok:!1,message:String(e?.message??e)}}},_e.ensureStaffAppLinks=async function(e){const t=re.getState().venueId;if(!t||'staff'!==re.getState().kind)throw new Error('Connect to the venue first.');return Yt('ensure_staff_app_links',{p_venue:t,p_staff_ref:e})},_e.staffAppLinkHistory=async function(e){return Yt('staff_app_link_history',{p_venue:re.getState().venueId,p_staff_ref:e})},_e.revokeStaffAppLink=async function(e){await Yt('revoke_staff_app_link',{p_venue:re.getState().venueId,p_link_id:e})},_e.readInviteStatus=async function(){if(H.PITCH)return Q.inviteStatus();const e=re.getState().venueId;if(!e)return{};const{data:t,error:a}=await ne().rpc('invite_status',{p_venue:e});if(a||!Array.isArray(t))return{};const s={};for(const e of t)s[String(e.staff_ref)]={state:e.state,expiresAt:e.expires_at??void 0,usedAt:e.used_at??void 0,devices:Number(e.devices??0)};return s},_e.pairWithCode=async function(t){if(!(0,v.isSupabaseConfigured)())return{ok:!1,error:'This build has no shared backend.'};try{await zt();const{data:a,error:s}=await ne().rpc(e.IS_QUEUED_VENUE?'claim_'+e.VENUE_RID+'_pairing_code':e.IS_GREENSIDE?'claim_greenside_pairing_code':e.IS_ABBOTSFORD?'claim_abbotsford_pairing_code':e.IS_KIRKTON?'claim_kirkton_pairing_code':e.IS_WILDINGS?'claim_wildings_pairing_code':e.IS_KIRKMICHAEL?'claim_kirkmichael_pairing_code':e.IS_ISOLATED_VENUE?'claim_souters_pairing_code':'claim_pairing_code',{p_code:t});if(s)throw s;const i=a?.[0];if(!i)return{ok:!1,error:'That code was not accepted. It may have expired. Ask a manager for a new one.'};const n={kind:'device',venueId:i.venue_id,venueSlug:i.venue_slug,venueName:i.venue_name,canWrite:i.can_write,label:i.label};return await k.kv.set(Vt,n),aa(),{ok:!0,venueName:i.venue_name}}catch(e){const t=String(e?.message??e);return/fetch|network/i.test(t)?{ok:!1,error:'No connection. Check the tablet\u2019s Wi-Fi and try again.'}:/rate|too many/i.test(t)?{ok:!1,error:'Too many tries from this network. Wait a little and try again.'}:{ok:!1,error:/valid|switched off/i.test(t)?t:`Couldn\u2019t pair: ${t}`}}},_e.unpairDisplay=async function(){await k.kv.remove(Vt),await ta();try{await ne().auth.signOut()}catch{}oe({mode:'unpaired',venueId:void 0,venueName:void 0,perms:[]})},_e.disconnectStaff=async function(){await k.kv.remove(Ht),await k.kv.remove(Gt),await ta();try{await ne().auth.signOut()}catch{}oe({mode:'signin',venueId:void 0,venueName:void 0,perms:[],kind:void 0,role:void 0,staffRef:void 0,message:'Disconnected. Open your personal invite link to connect again.'})},_e.wipeThisDevice=async function(t={}){try{await ta()}catch{}try{(0,v.isSupabaseConfigured)()&&await ne().auth.signOut({scope:'local'})}catch{}let a=0;try{const e='undefined'!=typeof navigator?navigator:null,t=await(e?.serviceWorker?.getRegistration?.()),a=await(t?.pushManager?.getSubscription?.());a&&await a.unsubscribe()}catch{}for(const t of['undefined'!=typeof localStorage?localStorage:null,'undefined'!=typeof sessionStorage?sessionStorage:null])if(t)try{const s=[];for(let e=0;et.startsWith(`cc-venue:${e.VENUE_RID}:`)):(0,p.keysToWipe)(s).filter(e=>!e.startsWith('cc-venue:')))t.removeItem(i),a++}catch{}try{const t='undefined'!=typeof caches?caches:null;if(t)for(const a of await t.keys())!e.IS_ISOLATED_VENUE&&/data|api|photo/i.test(a)&&await t.delete(a)}catch{}oe({mode:'signin',venueId:void 0,venueName:void 0,perms:[],kind:void 0,role:void 0,staffRef:void 0,message:'This device has been wiped.'}),!1!==t.reload&&'undefined'!=typeof window&&window.location&&window.location.replace(window.location.pathname);return a},_e.guestSession=Xt,Object.defineProperty(_e,"rpc",{enumerable:!0,get:function(){return Yt}}),_e.startAppSync=async function(t=e.VENUE_RID){if(e.IS_ISOLATED_VENUE&&t!==e.VENUE_RID)return;if(ge)return;ge=!0,sa=t,'customer'===le&&'live'!==U.useStore.getState().clock.mode&&U.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}});if(fe(),'customer'!==le){const e=e=>new Promise(t=>{try{if(!e?.persist||e.persist.hasHydrated())return t();const a=e.persist.onFinishHydration(()=>{a?.(),t()});setTimeout(t,3e3)}catch{t()}}),a='chef'===le&&(0,d.isAnchorage)(t)?[U.useStore,P.useOwner,L.useKitchen,q.useSafety,N.useCardStore,r.useGpCalc,M.useOrderSheets,o.useSpecials,_.useHr]:[U.useStore,P.useOwner,L.useKitchen];if(await Promise.all(a.map(e)),'chef'===le&&(0,d.isAnchorage)(t)&&a.some(e=>!e.persist.hasHydrated()))return void oe({mode:'offline',message:'Saved kitchen data could not be backed up. Nothing was cleared. Free some device storage, then reopen.',lastError:'Legacy kitchen archive not ready'});try{await wa(t)}catch{if(s.LIVE_VENUE_BUILD&&(0,s.isLiveVenue)(t))return void oe({mode:'offline',message:'Device backup failed. Nothing was cleared. Free some storage, then reopen.',lastError:'Legacy kitchen archive failed'})}'live'!==U.useStore.getState().clock.mode&&U.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}})}if(!(0,v.isSupabaseConfigured)())return void oe({mode:'off'});R.mutationQueue.subscribe(()=>{const e=R.mutationQueue.waiting,t=e[0];oe({pending:R.mutationQueue.pending.length,failed:R.mutationQueue.failed.length,waiting:e.length,waitingWhat:t?`${(0,O.describeWrite)(t)}: ${(0,O.plainReason)({...t.lastErr},'retry')}`:void 0})}),R.mutationQueue.onFailed(e=>oe({lastError:`${e.table}: ${e.lastError??'rejected'}`,failed:R.mutationQueue.failed.length,refused:{what:(0,O.describeWrite)(e),why:'conflict'===e.reason?(0,O.plainReason)({code:'conflict'},'refused'):(0,O.plainReason)({...e.lastErr,message:e.lastErr?.message??e.lastError},'refused'),at:e.failedAt}})),me.push((0,b.onConnectivity)(e=>oe({mode:e?re.getState().venueId?'live':re.getState().mode:re.getState().venueId?'offline':re.getState().mode}))),await ia()},Object.defineProperty(_e,"syncInternals",{enumerable:!0,get:function(){return fa}}),_e.goLive=ma,Object.defineProperty(_e,"usePublicDayStore",{enumerable:!0,get:function(){return Ca}}),_e.publicDay=function(e,a){const s=`${e}|${a}`,i=Ea.get(s);if('customer'!==le||!(0,v.isSupabaseConfigured)())return null;(!i||Date.now()-i.at>6e4)&&(i?i.at=Date.now():Ea.set(s,{at:Date.now(),v:{bookings:[],blocks:[]}}),Yt('public_day',{p_venue_slug:(0,t.queuedDatabaseSlug)(e),p_date:a}).then(t=>{const i=[],n=[];(t??[]).forEach((t,s)=>{'booking'===t.kind?i.push({id:`pub-${a}-${s}`,ref:'',restaurantId:e,customerId:null,name:'',date:a,time:ye(t.booking_time),partySize:Number(t.covers)||0,table:(t.table_ids??[]).join('+')||void 0,durationMins:t.duration_mins??void 0,status:'confirmed',allergies:[],createdAt:''}):n.push({id:`pubblk-${a}-${s}`,rid:e,date:a,from:ye(t.from_time),to:ye(t.to_time),areaId:t.area_id??void 0,tables:Array.isArray(t.table_ids)&&t.table_ids.length?t.table_ids.map(String):void 0,by:'',createdAt:''})}),Ea.set(s,{at:Date.now(),v:{bookings:i,blocks:n},ok:!0}),Ca.setState(e=>({n:e.n+1}))}).catch(()=>{const e=Ea.get(s);e&&!e.ok&&Ea.delete(s)}));const n=Ea.get(s);return n?.ok?n.v:null};var e=_r2(_d[0]),t=_r2(_d[1]),a=_r2(_d[2]),s=_r2(_d[3]),i=_r2(_d[4]),n=_r2(_d[5]),r=_r2(_d[6]),o=_r2(_d[7]),d=_r2(_d[8]),u=_r2(_d[9]),l=_r2(_d[10]),c=_r2(_d[11]),f=_r2(_d[12]),p=_r2(_d[13]),m=_r2(_d[14]),g=_r2(_d[15]),_=_r2(_d[16]),S=_r2(_d[17]),h=_r2(_d[18]),y=_r2(_d[19]),w=_r2(_d[20]),v=_r2(_d[21]),b=_r2(_d[22]),k=_r2(_d[23]),I=_r2(_d[24]),O=_r2(_d[25]),R=_r2(_d[26]),A=_r2(_d[27]),U=_r2(_d[28]),D=_r2(_d[29]),E=_r2(_d[30]),C=_r2(_d[31]),T=_r2(_d[32]),N=_r2(_d[33]),M=_r2(_d[34]),K=_r2(_d[35]),x=_r2(_d[36]),L=_r2(_d[37]),q=_r2(_d[38]),P=_r2(_d[39]),$=_r2(_d[40]),j=_r2(_d[41]),B=_r2(_d[42]),F=_r2(_d[43]),W=_r2(_d[44]),V=_r2(_d[45]),H=_r2(_d[46]),G=_r2(_d[47]),Q=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(a){if('default'!==a){var s=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(t,a,s.get?s:{enumerable:!0,get:function(){return e[a]}})}}),t.default=e,t})(G),J=_r2(_d[48]),z=_r2(_d[49]),Z=_r2(_d[50]),X=_r2(_d[51]),Y=_r2(_d[52]),ee=_r2(_d[53]),te=_r2(_d[54]),ae=_r2(_d[55]),se=_r2(_d[56]),ie=_r2(_d[57]);const ne=()=>(0,w.getSupabase)();R.mutationQueue.setExecutor(I.executeMutation);const re=(0,y.create)(()=>({mode:'off',perms:[],pending:0,failed:0})),oe=e=>re.setState(e),de=e=>{const t=re.getState().perms;return t.includes('*')||t.includes(e)},ue=()=>{const e=re.getState().mode;return'live'===e||'offline'===e||'connecting'===e};re.subscribe(()=>(0,ae.setLiveData)(ue()));let le=D.APP_VARIANT,ce=!1;const fe=()=>{ce||((0,k.setSyncNamespace)(le),ce=!0)};let pe=[],me=[],ge=!1;const Se=()=>(new Date).toISOString().slice(0,10),he=e=>new Date(Date.now()-864e5*e).toISOString().slice(0,10),ye=e=>e?e.slice(0,5):'',we=e=>Array.isArray(e)?e.filter(e=>e&&'object'==typeof e&&'string'==typeof e.allergen&&['gluten','crustaceans','molluscs','eggs','fish','peanuts','treenuts','soya','milk','celery','mustard','sesame','sulphites','lupin'].includes(e.allergen)&&(!e.severity||['intolerance','allergy','coeliac','anaphylaxis'].includes(e.severity))):[],ve=e=>JSON.parse(JSON.stringify(e));function be(e,t){const a=he(120);return{name:t?'walk_ins':'bookings',table:t?'walk_ins':'bookings',list:()=>U.useStore.getState().bookings.filter(a=>a.restaurantId===e&&!!a.walkIn===t),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id),writable:()=>'guest'!==re.getState().kind,filter:e=>e.gte(t?'walk_date':'booking_date',a),inWindow:e=>e.date>=a,toRow:(e,a)=>{const s=ve(e);return t?{id:e.id,venue_id:a,walk_date:e.date,arrived_at:e.seatedAt??e.createdAt,covers:Math.max(1,Math.min(200,e.partySize)),table_ids:e.table?e.table.split('+').map(e=>e.trim()).filter(Boolean):[],dog:!!e.dog,allergies:we(e.allergies),note:e.notes??'',status:'finished'===e.status?'left':'cancelled'===e.status||'noshow'===e.status?'undone':'seated',created_at:e.createdAt,doc:s}:{id:e.id,venue_id:a,ref:e.ref,customer_id:(0,$.isUuid)(e.customerId)?e.customerId:null,guest_name:e.name||'Guest',phone:e.phone??null,email:e.email??null,booking_date:e.date,booking_time:e.time,duration_mins:e.durationMins&&e.durationMins>=15&&e.durationMins<=720?e.durationMins:null,covers:Math.max(1,Math.min(200,e.partySize)),table_ids:e.table?e.table.split('+').map(e=>e.trim()).filter(Boolean):[],dog:!!e.dog,allergies:we(e.allergies),allergy_ack_by:e.allergyAck?.by??null,allergy_ack_at:e.allergyAck?.at??null,notes:e.notes??'',tags:e.tags??[],occasion:e.occasion??null,status:e.status,source:e.source??'in-person',security:e.security??'none',deposit_paid:e.depositPaid??0,seated_at:e.seatedAt??null,finished_at:e.finishedAt??null,created_at:e.createdAt,doc:s}},fromRow:a=>{if(!a.doc||'object'!=typeof a.doc)return null;const s={...a.doc,id:String(a.id),restaurantId:e};return!t&&a.status&&'declined'!==a.status&&(s.status=a.status),t&&(s.walkIn=!0),'saved-card'===s.security&&(s.security='none'),s},apply:(e,t)=>U.useStore.setState(a=>{const s=new Set(t),i=new Map(e.map(e=>[e.id,e])),n=a.bookings.filter(e=>!s.has(e.id)).map(e=>i.get(e.id)??e),r=new Set(n.map(e=>e.id));return{bookings:[...n,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>U.useStore.subscribe((t,a)=>{t.bookings!==a.bookings&&e()}),protect:!0}}function ke(e){const t=new Date(Date.now()-18144e5).toISOString();return{name:'orders',table:'takeaway_orders',list:()=>U.useStore.getState().orders.filter(t=>t.restaurantId===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id),writable:()=>'guest'!==re.getState().kind,filter:e=>e.gte('created_at',t),inWindow:e=>e.createdAt>=t,toRow:(e,t)=>({id:e.id,venue_id:t,ref:e.ref,customer_id:(0,$.isUuid)(e.customerId)?e.customerId:null,customer_name:e.customerName||'Guest',phone:e.phone??null,email:e.email??null,items:ve(e.lines??[]),allergies:we(e.allergies),notes:e.notes??null,slot_time:e.slotTime??null,ready_by:e.readyBy??null,subtotal:Math.round(e.subtotal??0),tip:Math.round(e.tip??0),total:Math.round(e.total??0),paid:Math.round(e.paid??0),status:e.status,channel:e.channel??null,confirmed_by:e.accepted?e.accepted.by:null,confirmed_at:e.accepted?e.accepted.at:null,created_at:e.createdAt,allergy_chain:ve(e.allergyChain??{}),readiness:ve(e.readiness??{}),allergy_ticks:ve(e.allergyTicks??{}),handover_check:e.handoverCheck?ve(e.handoverCheck):null,accepted:e.accepted?ve(e.accepted):null,doc:ve(e)}),fromRow:t=>t.doc&&'object'==typeof t.doc?{...t.doc,id:String(t.id),restaurantId:e,status:t.status??t.doc.status}:null,apply:(e,t)=>U.useStore.setState(a=>{const s=new Set(t),i=new Map(e.map(e=>[e.id,e])),n=a.orders.filter(e=>!s.has(e.id)).map(e=>i.get(e.id)??e),r=new Set(n.map(e=>e.id));return{orders:[...e.filter(e=>!r.has(e.id)),...n]}}),subscribe:e=>U.useStore.subscribe((t,a)=>{t.orders!==a.orders&&e()})}}function Ie(e){const t=he(60);return{protect:!0,name:'blocks',table:'blocks',list:()=>[...E.useBlocks.getState().blocks,...E.useBlocks.getState().removed].filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id)&&e.to>e.from,writable:()=>'guest'!==re.getState().kind,filter:e=>e.gte('block_date',t),inWindow:e=>e.date>=t,toRow:(e,t)=>({id:e.id,venue_id:t,block_date:e.date,from_time:e.from,to_time:e.to,reason:e.reason??null,note:e.note??null,area_id:e.areaId??null,area_name:e.areaName??null,created_by:e.by,created_at:e.createdAt,doc:ve(e)}),fromRow:t=>t.doc?{...t.doc,id:String(t.id),rid:e}:{id:String(t.id),rid:e,date:t.block_date,from:ye(t.from_time),to:ye(t.to_time),reason:t.reason??void 0,note:t.note??void 0,by:t.created_by??'',createdAt:t.created_at,areaId:t.area_id??void 0,areaName:t.area_name??void 0},apply:(e,t)=>E.useBlocks.setState(a=>{const s=new Set(t),i=new Map(e.map(e=>[e.id,e])),n=[...a.blocks,...a.removed].filter(e=>!s.has(e.id)).map(e=>i.get(e.id)??e),r=new Set(n.map(e=>e.id)),o=[...n,...e.filter(e=>!r.has(e.id))];return{blocks:o.filter(e=>!e.removedAt),removed:o.filter(e=>!!e.removedAt)}}),subscribe:e=>E.useBlocks.subscribe((t,a)=>{t.blocks===a.blocks&&t.removed===a.removed||e()})}}let Oe=null;function Re(e){const t=e=>ve({areas:e.areas??[],tables:e.tables??[],joins:e.joins??[],sections:e.sections??[],fixtures:e.fixtures??[]});return{name:'table_plan',table:'table_plans',list:()=>[t(C.useFloor.getState().plans[e]??(0,C.planOf)(e))],key:()=>'plan',rowKey:()=>'plan',syncable:()=>!0,writable:()=>de('floor.manage'),filter:e=>e.eq('is_active',!0),deletes:!1,toRow:(e,a)=>({id:Oe??(0,se.uuidFrom)(`plan:${a}`),venue_id:a,name:'Main',is_active:!0,...t(e),updated_by:re.getState().staffRef??le}),fromRow:e=>(Oe=String(e.id),t({areas:e.areas,tables:e.tables,joins:e.joins,sections:e.sections,fixtures:e.fixtures})),apply:t=>{const a=t[0]?(0,ie.withSeedBest)(e,t[0]):void 0;a&&C.useFloor.setState(t=>({plans:{...t.plans,[e]:a}}))},subscribe:e=>C.useFloor.subscribe((t,a)=>{t.plans!==a.plans&&e()})}}function Ae(e){return{protect:!0,name:'stock_items',table:'stock_items',conflict:'venue_id,key',list:()=>T.useShellStore.getState().items[e]??[],key:e=>e.key,rowKey:e=>String(e.key),syncable:()=>!0,writable:()=>de('stock.manage'),matchKey:e=>({key:e}),toRow:(e,t)=>({venue_id:t,key:e.key,name:e.name,plural:e.plural,unit:e.unit,low_at:e.lowAt,supplier_id:e.supplierId?(0,$.isUuid)(e.supplierId)?e.supplierId:(0,se.uuidFrom)(`sup:${t}:${e.supplierId}`):null,icon:e.icon,sort:e.sort,active:e.active}),fromRow:e=>{return{key:e.key,name:e.name,plural:e.plural,unit:e.unit,lowAt:Number(e.low_at),icon:e.icon??'\u2022',sort:e.sort??0,active:!1!==e.active,...e.supplier_id?{supplierId:(t=String(e.supplier_id),Le.get(t)??t)}:{}};var t},apply:(t,a)=>T.useShellStore.setState(s=>{const i=new Set(a),n=new Map(t.map(e=>[e.key,e])),r=(s.items[e]??[]).filter(e=>!i.has(e.key)).map(e=>n.get(e.key)??e),o=new Set(r.map(e=>e.key));return{items:{...s.items,[e]:[...r,...t.filter(e=>!o.has(e.key))]}}}),subscribe:e=>T.useShellStore.subscribe((t,a)=>{t.items!==a.items&&e()})}}const Ue=new Set;function De(e){const t=new Date(Date.now()-2592e5).toISOString();return{name:'stock_events',table:'stock_events',mode:'insert',list:()=>T.useShellStore.getState().events.filter(t=>t.rid===e&&(0,$.isUuid)(t.id)),key:e=>e.id,rowKey:e=>String(e.id),syncable:t=>(0,$.isUuid)(t.id)&&!!(T.useShellStore.getState().items[e]??[]).find(e=>e.key===t.kind),writable:()=>'guest'!==re.getState().kind&&('device'!==re.getState().kind||de('device.write')),filter:e=>e.gte('at',t).order('at',{ascending:!1}),inWindow:e=>e.at>=t,toRow:(e,t)=>({id:e.id,venue_id:t,item:e.kind,delta:e.delta,reason:e.reason,undoes:e.undoes&&(0,$.isUuid)(e.undoes)?e.undoes:null,by_name:e.by||'Team',app:e.app,at:e.at}),fromRow:t=>(Ue.add(String(t.id)),{id:String(t.id),rid:e,kind:t.item,delta:Number(t.delta),reason:t.reason,by:t.by_name??'',app:t.app??'',at:new Date(t.at).toISOString(),...t.undoes?{undoes:String(t.undoes)}:{}}),apply:(e,t)=>T.useShellStore.setState(a=>{const s=new Set(t),i=new Map(e.map(e=>[e.id,e])),n=a.events.filter(e=>!s.has(e.id)).map(e=>i.get(e.id)??e),r=new Set(n.map(e=>e.id));return{events:[...e.filter(e=>!r.has(e.id)),...n].sort((e,t)=>t.at.localeCompare(e.at)).slice(0,500)}}),subscribe:e=>T.useShellStore.subscribe((t,a)=>{t.events!==a.events&&e()})}}function Ee(e){let t={};return{name:'stock_counts',table:'stock_counts',list:()=>Object.entries(T.useShellStore.getState().server[e]?.counts??{}).map(([e,t])=>({item:e,quantity:t})),key:e=>e.item,rowKey:e=>String(e.item),syncable:()=>!1,writable:()=>!1,toRow:()=>({}),fromRow:e=>({item:String(e.item),quantity:Number(e.quantity)}),apply:(a,s)=>{t={...T.useShellStore.getState().server[e]?.counts??{}};for(const e of s)delete t[e];for(const e of a)t[e.item]=e.quantity;T.useShellStore.setState(a=>({server:{...a.server,[e]:{counts:t,seen:[...Ue]}}}))},afterRead:()=>{T.useShellStore.getState().server[e]||T.useShellStore.setState(t=>({server:{...t.server,[e]:{counts:{},seen:[...Ue]}}}))},subscribe:()=>()=>{}}}const Ce=new Set;function Te(e){return{name:'recipe_cards',table:'recipe_cards',list:()=>{const t=U.useStore.getState().menu;return N.useCardStore.getState().cards.filter(t=>t.restaurantId===e).map(e=>({card:e,item:t.find(t=>t.id===e.menuItemId)}))},key:e=>e.card.id,rowKey:e=>String(e.id),syncable:t=>(0,$.isUuid)(t.card.id)&&!((0,d.isAnchorage)(e)&&(0,d.isDemoCard)(t.card)),writable:()=>de('recipes.edit'),toRow:(t,a)=>{let s=t.card;(0,d.isAnchorage)(e)&&(s={...s,signOff:(0,d.demoActor)(s.signOff?.by)?null:s.signOff,allergensConfirmed:(0,d.demoActor)(s.allergensConfirmed?.by)?void 0:s.allergensConfirmed});const i=t.item&&(0,d.isAnchorage)(e)&&(0,d.demoActor)(t.item.signOff?.by)?{...t.item,signOff:null}:t.item;if(s.photo?.startsWith('local:')){const e=(0,se.photoPath)(a,s),t=Ne(s.photo);t&&((0,N.cachePhotoAs)(e,t),Me(e,t)),s={...s,photo:e}}const{row:n,extra:r}=(0,se.cardToRow)(s,a);return{...n,...r,doc:ve({card:s,item:i})}},fromRow:t=>{const a=t.doc;if(!a?.card)return null;const s=t.signed_off_by&&t.signed_off_at?{by:t.signed_off_by,at:new Date(t.signed_off_at).toISOString()}:null;return{card:{...a.card,id:String(t.id),restaurantId:e,signOff:s&&a.card.signOff?a.card.signOff:s,...t.photo_url?{photo:t.photo_url}:{}},item:a.item?{...a.item,restaurantId:e,signOff:(0,d.isAnchorage)(e)&&(0,d.demoActor)(a.item.signOff?.by)?null:a.item.signOff}:void 0}},supersededBy:(e,t)=>t.some(t=>t.card.menuItemId===e.card.menuItemId&&t.card.id!==e.card.id),apply:(e,t)=>{if(!de('recipes.edit')&&t.length){const e=new Set(t);N.useCardStore.setState(t=>({cards:t.cards.map(t=>e.has(t.id)&&t.signOff?{...t,signOff:null}:t)})),t=[]}const a=new Set(t);N.useCardStore.setState(t=>{const s=new Map(e.map(e=>[e.card.id,e.card])),i=new Set(e.map(e=>e.card.menuItemId)),n=t.cards.filter(e=>a.has(e.id)).map(e=>e.menuItemId),r=t.cards.filter(e=>!a.has(e.id)&&(s.has(e.id)||!i.has(e.menuItemId))).map(e=>s.get(e.id)??e),o=new Set(r.map(e=>e.id));return n.length&&U.useStore.setState(e=>({menu:e.menu.map(e=>n.includes(e.id)?{...e,hidden:!0}:e)})),{cards:[...r,...e.filter(e=>!o.has(e.card.id)).map(e=>e.card)],removed:[...t.removed,...n]}});const s=e.map(e=>e.item).filter(Boolean);s.length&&U.useStore.setState(e=>{const t=new Map(s.map(e=>[e.id,e])),a=e.menu.map(e=>t.get(e.id)??e),i=new Set(a.map(e=>e.id));return{menu:[...a,...s.filter(e=>!i.has(e.id))]}})},subscribe:e=>{const t=N.useCardStore.subscribe((t,a)=>{t.cards!==a.cards&&e()}),a=U.useStore.subscribe((t,a)=>{t.menu!==a.menu&&e()});return()=>{t(),a()}}}}const Ne=e=>(0,N.readLocalPhoto)(e);async function Me(e,t){if(!Ce.has(e)){Ce.add(e);try{const a=await(await fetch(t)).blob(),{error:s}=await ne().storage.from(se.RECIPE_PHOTO_BUCKET).upload(e,a,{upsert:!0,contentType:a.type||'image/jpeg'});if(s)throw s}catch(t){Ce.delete(e),oe({lastError:`Photo upload: ${String(t?.message??t)}`})}}}const Ke=new Map,xe=(0,y.create)(()=>({n:0}));(0,N.setStoragePhotoResolver)(e=>{const t=Ke.get(e);return t&&Date.now()-t.at<3e6?t.url:(0,v.isSupabaseConfigured)()&&'off'!==re.getState().mode?(t||(Ke.set(e,{url:'',at:Date.now()}),ne().storage.from(se.RECIPE_PHOTO_BUCKET).createSignedUrl(e,3600).then(({data:t})=>{t?.signedUrl&&(Ke.set(e,{url:t.signedUrl,at:Date.now()}),xe.setState(e=>({n:e.n+1})),N.useCardStore.setState(e=>({cards:[...e.cards]})))}).catch(()=>{})),t?.url||null):null});const Le=new Map;const qe=(e,t)=>{const a=(0,$.isUuid)(t)?t:(0,se.uuidFrom)(`sup:${e}:${t}`);return Le.set(a,t),a};function Pe(e){return{name:'order_sheets',table:'suppliers',list:()=>M.useOrderSheets.getState().sheets[e]??[],key:e=>e.id,rowKey:e=>String(e.doc?.localId??e.id),syncable:t=>!((0,d.isAnchorage)(e)&&'os-veg'===t.id&&t.placeholder),writable:()=>de('suppliers.manage'),toRow:(e,t)=>({id:qe(t,e.id),venue_id:t,name:e.name||'Supplier',category:e.goods||null,contact:e.contact??null,phones:e.number?[e.number]:[],website:e.url||null,cutoff:e.cutoff||null,order_days:e.orderDays,delivery_days:e.deliveryDays,notes:e.notes||null,doc:{kind:'sheet',localId:e.id,sheet:ve(e)}}),fromRow:e=>'sheet'!==e.doc?.kind?null:(Le.set(String(e.id),String(e.doc.localId)),e.doc.sheet),apply:(t,a)=>M.useOrderSheets.setState(s=>{const i=new Set(a),n=new Map(t.map(e=>[e.id,e])),r=(s.sheets[e]??[]).filter(e=>!i.has(e.id)).map(e=>n.get(e.id)??e),o=new Set(r.map(e=>e.id));return{sheets:{...s.sheets,[e]:[...r,...t.filter(e=>!o.has(e.id))]}}}),subscribe:e=>M.useOrderSheets.subscribe((t,a)=>{t.sheets!==a.sheets&&e()}),matchKey:e=>({id:(0,$.isUuid)(e)?e:(0,se.uuidFrom)(`sup:${re.getState().venueId}:${e}`)})}}let $e=!1,je=!1;const Be=new Map,Fe=new Map,We=new Map,Ve=new Map,He=e=>'owner'===e.role?'owner':'manager'===e.role?'Supervisor'===e.level?'supervisor':'manager':'Head Chef'===e.level?'head_chef':'staff',Ge=e=>'owner'===e?{role:'owner',level:'Owner'}:'manager'===e?{role:'manager',level:'Manager'}:'supervisor'===e?{role:'manager',level:'Supervisor'}:'head_chef'===e?{role:'staff',level:'Head Chef'}:{role:'staff',level:'Staff'},Qe=(e,t)=>t&&'owner'!==e.role&&'manager'!==e.role?{role:'manager',level:e.level,managerAccess:!0}:{...e,managerAccess:void 0},Je=e=>ve({id:e.id,name:e.name,role:e.role,job:e.job,active:e.active,level:e.level??Ge(He(e)).level,dept:e.dept??'',nickname:e.nickname,displayClock:e.displayClock,temp:e.temp,tempUntil:e.tempUntil,managerAccess:e.managerAccess||void 0,ownerAccess:e.ownerAccess||void 0,...e.temp&&e.tempUntil&&e.tempUntil(new Date).toLocaleDateString('en-CA',{timeZone:'Europe/London'});const Ze=(e=new Date)=>{const t=new Date(e);return t.setDate(t.getDate()-(t.getDay()+6)%7),t.toISOString().slice(0,10)},Xe=e=>{const t=Math.round(60*e)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`};function Ye(){return{name:'rota',table:'rota_shifts',list:()=>P.useOwner.getState().shifts,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id)&&Be.has(e.staffId),writable:()=>de('rota.manage'),toRow:(e,t)=>({id:e.id,venue_id:t,staff_id:Be.get(e.staffId),staff_ref:e.staffId,shift_date:e.date??(()=>{const t=new Date(Ze());return t.setDate(t.getDate()+(e.day??0)),t.toISOString().slice(0,10)})(),start_time:Xe(e.start),end_time:Xe(e.end),published:!!e.published,doc:ve(e)}),fromRow:e=>{if(!e.doc)return null;const t=e.doc,a=t.date??String(e.shift_date).slice(0,10),[s,i,n]=a.split('-').map(Number);return{...t,id:String(e.id),date:a,day:(new Date(s,i-1,n).getDay()+6)%7,published:!!e.published}},apply:(e,t)=>P.useOwner.setState(a=>{const s=new Set(t),i=new Map(e.map(e=>[e.id,e])),n=a.shifts.filter(e=>!s.has(e.id)).map(e=>i.get(e.id)??e),r=new Set(n.map(e=>e.id));return{shifts:[...n,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>P.useOwner.subscribe((t,a)=>{t.shifts!==a.shifts&&e()})}}function et(){const t=he(62),a=e=>de('rota.manage')||e.staffId===re.getState().staffRef;return{name:'attendance',table:'attendance',list:()=>P.useOwner.getState().attendance,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id)&&a(e),writable:()=>'staff'===re.getState().kind,filter:e=>e.gte('work_date',t),inWindow:e=>e.date>=t,toRow:(t,a)=>({id:t.id,venue_id:a,staff_id:Be.get(t.staffId)??null,staff_ref:t.staffId,work_date:t.date,clock_in:t.in??null,clock_out:t.out??null,breaks:ve(t.breaks??[]),break_mins:t.breakMins??0,doc:ve((0,u.privateAttendance)(e.VENUE_RID,t))}),fromRow:t=>{if(!t.doc)return null;const a=(0,u.privateAttendance)(e.VENUE_RID,{...t.doc,id:String(t.id)});return'confirmed'===t.status?a.signOff={by:String(t.confirmed_by_name??a.signOff?.by??'Manager'),byId:a.signOff?.byId??'',at:t.confirmed_at?new Date(t.confirmed_at).toISOString():a.signOff?.at??''}:delete a.signOff,a},apply:(e,t)=>P.useOwner.setState(a=>{const s=new Set(t),i=new Map(e.map(e=>[e.id,e])),n=a.attendance.filter(e=>!s.has(e.id)).map(e=>i.get(e.id)??e),r=new Set(n.map(e=>e.id));return{attendance:[...n,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>P.useOwner.subscribe((t,a)=>{t.attendance!==a.attendance&&e()})}}function tt(){const e=he(62);return{name:'time_requests',table:'time_requests',mode:'insert',deletes:!1,list:()=>P.useOwner.getState().timeRequests,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id)&&e.staffId===re.getState().staffRef&&'open'===e.status,writable:()=>'staff'===re.getState().kind,filter:t=>t.gte('work_date',e),inWindow:t=>t.date>=e,toRow:(e,t)=>({id:e.id,venue_id:t,staff_id:Be.get(e.staffId)??null,staff_ref:e.staffId,work_date:e.date,attendance_id:e.attendanceId&&(0,$.isUuid)(e.attendanceId)?e.attendanceId:null,kind:e.kind,suggested_in:e.suggestedIn??null,suggested_out:e.suggestedOut??null,note:(e.note??'').slice(0,300)||null,status:'open',doc:ve({...e,status:'open'})}),fromRow:e=>{const t=e.doc??{};return{...t,id:String(e.id),staffId:String(e.staff_ref),date:String(e.work_date).slice(0,10),attendanceId:e.attendance_id?String(e.attendance_id):t.attendanceId,kind:e.kind,suggestedIn:e.suggested_in?new Date(e.suggested_in).toISOString():void 0,suggestedOut:e.suggested_out?new Date(e.suggested_out).toISOString():void 0,note:e.note??'',at:t.at??new Date(e.created_at).toISOString(),status:e.status,resolvedBy:e.resolved_by_name??void 0,resolvedAt:e.resolved_at?new Date(e.resolved_at).toISOString():void 0}},apply:(e,t)=>P.useOwner.setState(a=>{const s=new Set(t),i=new Map(e.map(e=>[e.id,e])),n=a.timeRequests.filter(e=>!s.has(e.id)).map(e=>i.get(e.id)??e),r=new Set(n.map(e=>e.id));return{timeRequests:[...e.filter(e=>!r.has(e.id)),...n]}}),subscribe:e=>P.useOwner.subscribe((t,a)=>{t.timeRequests!==a.timeRequests&&e()})}}function at(t){P.timesheetRemote.send=(a,s)=>{if(!de('rota.manage')||!(0,$.isUuid)(s.id))return!1;if('time_request_resolve'===a){const e=s;return R.mutationQueue.enqueue({table:'time_requests',venueId:t,kind:'rpc',fn:a,rowKey:e.id,values:{p_id:e.id,p_status:e.status,p_doc:ve(e)}}),!0}const i=s;if('attendance_confirm'===a)return R.mutationQueue.enqueue({table:'attendance',venueId:t,kind:'rpc',fn:a,rowKey:i.id,values:{p_id:i.id,p_doc:ve((0,u.privateAttendance)(e.VENUE_RID,i))}}),!0;if(!i.in)return!1;const n=i.adjusted?.reason??'';return R.mutationQueue.enqueue({table:'attendance',venueId:t,kind:'rpc',fn:'attendance_override',rowKey:i.id,values:{p_id:i.id,p_venue:t,p_staff_ref:i.staffId,p_work_date:i.date,p_clock_in:i.in,p_clock_out:i.out??null,p_break_mins:i.breakMins??0,p_breaks:ve(i.breaks??[]),p_reason:n,p_doc:ve((0,u.privateAttendance)(e.VENUE_RID,i))}}),!0},me.push(()=>{P.timesheetRemote.send=null})}function st(e){return{name:'outbox',table:'outbox',mode:'insert',list:()=>U.useStore.getState().outbox.filter(t=>t.restaurantId===e),key:e=>e.id,rowKey:e=>String(e.local_id??e.id),syncable:()=>!0,writable:()=>'staff'===re.getState().kind,filter:e=>e.gte('created_at',new Date(Date.now()-2592e6).toISOString()),inWindow:()=>!1,toRow:(e,t)=>{return{id:(a=e.id,(0,$.isUuid)(a)?a:(0,se.uuidFrom)(`outbox:${a}`)),local_id:e.id,venue_id:t,channel:e.channel,kind:e.kind,to_address:e.to||'',to_name:e.toName||null,subject:e.subject??null,body:e.body,html:e.html??null,ref_type:e.refType,ref_id:(0,$.isUuid)(e.refId)?e.refId:null,ref:e.ref,status:e.status,provider:e.provider,error:e.error??null,created_at:e.at,doc:ve(e)};var a},fromRow:t=>t.doc?{...t.doc,restaurantId:e}:null,apply:e=>U.useStore.setState(t=>{const a=new Set(t.outbox.map(e=>e.id));return{outbox:[...e.filter(e=>!a.has(e.id)),...t.outbox].sort((e,t)=>t.at.localeCompare(e.at)).slice(0,300)}}),subscribe:e=>U.useStore.subscribe((t,a)=>{t.outbox!==a.outbox&&e()})}}const it=e=>U.useStore.getState().events.filter(t=>t.restaurantId===e&&!t.example);function nt(e,t){if(!Array.isArray(t))return;const a=t.filter(e=>e&&'string'==typeof e.id&&'string'==typeof e.date&&'string'==typeof e.title).map(t=>({...t,restaurantId:e,example:!1}));U.useStore.setState(t=>({events:[...t.events.filter(t=>!(t.restaurantId===e&&!t.example)),...a]}))}function rt(e){return{name:'venue',table:'venues',venueColumn:'id',mode:'update',list:()=>{const t=U.useStore.getState(),a=t.restaurants.find(t=>t.id===e);return[ve({restaurant:a,msgTemplates:t.msgTemplates[e]??{},display:C.useFloor.getState().settings[e]??{},games:!1!==a?.settings?.games,events:it(e)})]},key:()=>'venue',rowKey:()=>'venue',syncable:()=>!0,writable:()=>de('venue.settings'),matchKey:()=>({}),toRow:e=>({name:e.restaurant?.name,settings:{...dt??{},whatsapp:e.restaurant?.settings?.whatsapp||null,app:{...dt?.app??{},restaurant:e.restaurant,events:e.events??[]},ops:{...dt?.ops??{},msgTemplates:e.msgTemplates,display:e.display}},feature_flags:{...ot??{},games:e.games,takeaway:!e.restaurant?.settings?.takeawayPaused}}),fromRow:t=>{ot=t.feature_flags??{},dt=t.settings??{};const a=t.settings?.app?.restaurant;if(!a)return null;const s='string'==typeof t.settings?.whatsapp?t.settings.whatsapp:void 0;return s&&!a.settings?.whatsapp&&(a.settings={...a.settings,whatsapp:s}),ve({restaurant:{...a,id:e},msgTemplates:t.settings?.ops?.msgTemplates??{},display:t.settings?.ops?.display??{},games:!1!==t.feature_flags?.games,...Array.isArray(t.settings?.app?.events)?{events:t.settings.app.events}:{}})},apply:t=>{const s=t[0];s&&(U.useStore.setState(t=>({restaurants:t.restaurants.map(t=>t.id===e&&s.restaurant?(0,a.withWildingsAddress)({...s.restaurant,id:e,settings:{...s.restaurant.settings,games:s.games}}):t),msgTemplates:{...t.msgTemplates,[e]:s.msgTemplates??{}}})),s.display&&Object.keys(s.display).length&&C.useFloor.setState(t=>({settings:{...t.settings,[e]:s.display}})),s.events&&nt(e,s.events))},subscribe:e=>{const t=U.useStore.subscribe((t,a)=>{t.restaurants===a.restaurants&&t.msgTemplates===a.msgTemplates&&t.events===a.events||e()}),a=C.useFloor.subscribe((t,a)=>{t.settings!==a.settings&&e()});return()=>{t(),a()}}}}let ot=null,dt=null;const ut=()=>new Date(Date.now()-2592e6).toISOString(),lt=e=>{if(!e.startsWith('dm:'))return['all','kitchen','foh','managers'].includes(e)?e:null;const t=e.split(':').slice(1).map(e=>Be.get(e));return 2===t.length&&t[0]&&t[1]?`dm:${[t[0],t[1]].sort().join(':')}`:null},ct=e=>{if(!e.startsWith('dm:'))return e;const t=e.split(':').slice(1).map(e=>Fe.get(e));return 2===t.length&&t[0]&&t[1]?(0,X.dmId)(t[0],t[1]):null},ft=()=>re.getState().perms.includes('*');function pt(){const e=()=>re.getState().staffRef;return{name:'chat',table:'chat_messages',deletes:!1,list:()=>P.useOwner.getState().chat.filter(e=>(0,$.isUuid)(e.id)).map(e=>ve({id:e.id,ch:e.ch,from:e.from,text:e.text,photo:e.photo,at:e.at,removed:!!e.removed})),key:e=>e.id,rowKey:e=>String(e.id),syncable:t=>!!lt(t.ch)&&(t.from===e()||ft()&&!t.ch.startsWith('dm:')&&t.removed),writable:()=>'staff'===re.getState().kind,filter:e=>e.gte('created_at',ut()).order('created_at',{ascending:!1}),inWindow:e=>e.at>=ut(),toRow:(e,t)=>{const a=lt(e.ch);if(!a)throw new Error('chat: unknown person');const s='system'===e.from?null:Be.get(e.from)??null;return{id:e.id,venue_id:t,channel:a,from_staff:s,body:e.text??null,photo:e.photo??null,removed:e.removed,created_at:e.at}},fromRow:e=>{const t=ct(String(e.channel));if(!t)return null;const a=e.from_staff?Fe.get(String(e.from_staff)):'system';return a?ve({id:String(e.id),ch:t,from:a,text:e.body??void 0,photo:e.photo??void 0,at:new Date(e.created_at).toISOString(),removed:!!e.removed}):null},apply:(t,a)=>P.useOwner.setState(s=>{const i=new Set(a),n=new Map(t.map(e=>[e.id,e])),r=e(),o=s.chat.filter(e=>!i.has(e.id)).map(e=>n.has(e.id)?{...e,...n.get(e.id)}:e),d=new Set(o.map(e=>e.id)),u=t.filter(e=>!d.has(e.id)).map(e=>({...e,reactions:{},seenBy:e.from===r?[e.from]:[]}));return{chat:u.length?[...o,...u].sort((e,t)=>e.at.localeCompare(t.at)):o}}),subscribe:e=>P.useOwner.subscribe((t,a)=>{t.chat!==a.chat&&e()}),onRemote:(t,a)=>{if('upsert'!==a||t.removed)return;const s=t.from_staff?Fe.get(String(t.from_staff)):'system',i=ct(String(t.channel)),n=e();if(!i||!n||s===n||Date.now()-new Date(t.created_at).getTime()>12e4)return;const r=P.useOwner.getState();if((r.chatMuted[n]??[]).includes(i))return;if(!(0,X.inChannel)(i,r.staff.find(e=>e.id===n)))return;if((0,Y.soundAllowed)())try{(0,Y.chime)('soft')}catch{}const o=r.staff.find(e=>e.id===s)?.name?.replace(' (example)','')??'The team',d=i.startsWith('dm:')?'sent you a message':`in ${'all'===i?'Everyone':'foh'===i?'Front of house':'kitchen'===i?'Kitchen':'managers'===i?'Managers':i}`,u=String(t.body??t.text??'').slice(0,120);(0,c.notify)({id:`chat:${t.id}`,icon:'\ud83d\udcac',kicker:'NEW MESSAGE',title:`${o} ${d}`,body:u||void 0,timeoutMs:7e3,testID:'chat-notice'})}}}function mt(e){return{name:'reminders',table:'venue_reminders',list:()=>{const t=S.useReminders.getState(),a=t.reminders.filter(t=>t.rid===e&&(0,$.isUuid)(t.id)).map(e=>{const{rid:t,...a}=e;return{id:e.id,kind:'reminder',doc:ve(a)}}),s=t.rules[e];return s?[...a,{id:s.id,kind:'break_rules',doc:ve(s)}]:a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id),writable:()=>de('venue.settings'),toRow:(e,t)=>({id:e.id,venue_id:t,kind:e.kind,doc:e.doc,updated_at:(new Date).toISOString()}),fromRow:e=>({id:String(e.id),kind:'break_rules'===e.kind?'break_rules':'reminder',doc:e.doc??{}}),apply:(t,a)=>S.useReminders.setState(s=>{const i=new Set(a),n={...s.rules},r=t.filter(e=>'break_rules'===e.kind);for(const t of r)n[e]={...(0,h.clampRules)(t.doc),id:t.id,updatedAt:t.doc.updatedAt};n[e]&&i.has(n[e].id)&&delete n[e];const o=new Map(t.filter(e=>'reminder'===e.kind).map(t=>[t.id,{...t.doc,id:t.id,rid:e}])),d=s.reminders.filter(e=>!i.has(e.id)).map(e=>o.get(e.id)??e),u=new Set(d.map(e=>e.id));return{rules:n,reminders:[...d,...[...o.values()].filter(e=>!u.has(e.id))]}}),subscribe:e=>S.useReminders.subscribe((t,a)=>{t.reminders===a.reminders&&t.rules===a.rules||e()})}}function gt(e){const t=he(14);return{name:'reminder_done',table:'reminder_done',mode:'insert',deletes:!1,list:()=>S.useReminders.getState().done.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id)&&(0,$.isUuid)(e.reminderId)&&e.staffRef===re.getState().staffRef,writable:()=>'staff'===re.getState().kind,filter:e=>e.gte('for_date',t).order('done_at',{ascending:!1}),inWindow:e=>e.forDate>=t,toRow:(e,t)=>({id:e.id,venue_id:t,reminder_id:e.reminderId,for_date:e.forDate,staff_ref:e.staffRef,staff_name:e.staffName.slice(0,80),done_at:e.at}),fromRow:t=>({id:String(t.id),rid:e,reminderId:String(t.reminder_id),forDate:String(t.for_date).slice(0,10),staffRef:t.staff_ref??'',staffName:t.staff_name??'Team',at:new Date(t.done_at).toISOString()}),apply:(e,t)=>S.useReminders.setState(a=>{const s=new Set(t),i=new Map(e.map(e=>[e.id,e])),n=a.done.filter(e=>!s.has(e.id)).map(e=>i.get(e.id)??e),r=new Set(n.map(e=>e.id));return{done:[...e.filter(e=>!r.has(e.id)),...n].sort((e,t)=>t.at.localeCompare(e.at)).slice(0,400)}}),subscribe:e=>S.useReminders.subscribe((t,a)=>{t.done!==a.done&&e()})}}function _t(e,t,a,s=()=>!0){const i=new Set(a),n=new Map(t.map(e=>[e.id,e])),r=e.filter(e=>!s(e)||!i.has(e.id)).map(e=>s(e)&&n.has(e.id)?n.get(e.id):e),o=new Set(r.map(e=>e.id));return[...r,...t.filter(e=>!o.has(e.id))]}const St=e=>null==e||''===e?null:Number(e),ht=e=>e.filter(e=>!e.startsWith('data:'));function yt(e){return{name:'cash_ups',table:'cash_ups',list:()=>B.useCashUp.getState().cashUps.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id)&&!!e.confirmedAt,writable:()=>de('wages.manage')||(0,l.hasCashUpAccess)(),deletes:!1,filter:e=>e.gte('for_date',he(400)),toRow:(e,t)=>({id:e.id,venue_id:t,for_date:e.date,vals:ve(e.vals),cash_tips:'number'==typeof e.vals.cashTips?e.vals.cashTips:null,card_tips:'number'==typeof e.vals.cardTips?e.vals.cardTips:null,photos:ht(e.photos),read_by:e.readBy??null,confirmed_by:e.confirmedBy??null,confirmed_at:e.confirmedAt??null,updated_at:(new Date).toISOString()}),fromRow:t=>({id:String(t.id),rid:e,date:String(t.for_date),vals:t.vals??{},photos:t.photos??[],readBy:t.read_by??null,confirmedBy:t.confirmed_by??void 0,confirmedAt:t.confirmed_at??void 0,onServer:!0,unlockedUntil:t.unlocked_until??void 0,unlockedBy:t.unlocked_by??void 0}),apply:(t,a)=>B.useCashUp.setState(s=>({cashUps:_t(s.cashUps,t.map(e=>{const t=s.cashUps.find(t=>t.id===e.id);return t&&!e.photos.length?{...e,photos:t.photos}:e}),a,t=>t.rid===e)})),subscribe:e=>B.useCashUp.subscribe((t,a)=>{t.cashUps!==a.cashUps&&e()})}}function wt(e){return{name:'sales_reports',table:'sales_reports',list:()=>B.useCashUp.getState().sales.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id)&&!!e.confirmedAt,writable:()=>de('wages.manage')||(0,l.hasCashUpAccess)(),deletes:!1,toRow:(e,t)=>({id:e.id,venue_id:t,week_start:e.weekStart,vals:ve(e.vals),categories:e.categories,photos:ht(e.photos),read_by:e.readBy??null,confirmed_by:e.confirmedBy??null,confirmed_at:e.confirmedAt??null,updated_at:(new Date).toISOString()}),fromRow:t=>({id:String(t.id),rid:e,weekStart:String(t.week_start),vals:t.vals??{},categories:t.categories??[],photos:t.photos??[],readBy:t.read_by??null,confirmedBy:t.confirmed_by??void 0,confirmedAt:t.confirmed_at??void 0,onServer:!0,unlockedUntil:t.unlocked_until??void 0,unlockedBy:t.unlocked_by??void 0}),apply:(t,a)=>B.useCashUp.setState(s=>({sales:_t(s.sales,t.map(e=>{const t=s.sales.find(t=>t.id===e.id);return t&&!e.photos.length?{...e,photos:t.photos}:e}),a,t=>t.rid===e)})),subscribe:e=>B.useCashUp.subscribe((t,a)=>{t.sales!==a.sales&&e()})}}function vt(e){return{name:'cashup_settings',table:'cashup_settings',conflict:'venue_id',list:()=>{const t=B.useCashUp.getState().settings[e];return t?[t]:[]},key:e=>e.id,rowKey:()=>(0,B.cashSettingsId)(e),syncable:e=>!!e.updatedAt,writable:()=>de('wages.manage'),deletes:!1,toRow:(e,t)=>({venue_id:t,doc:ve({cashFields:e.cashFields,salesFields:e.salesFields}),updated_at:(new Date).toISOString()}),fromRow:t=>({...t.doc,id:(0,B.cashSettingsId)(e),updatedAt:t.updated_at??void 0}),apply:t=>B.useCashUp.setState(a=>t[0]?{settings:{...a.settings,[e]:t[0]}}:a),subscribe:e=>B.useCashUp.subscribe((t,a)=>{t.settings!==a.settings&&e()})}}function bt(e){return{name:'day_tips',table:'day_tips',list:()=>B.useCashUp.getState().tips.filter(t=>t.rid===e).map(e=>({...e,id:e.date})),key:e=>e.id,rowKey:e=>String(e.for_date),syncable:()=>!1,writable:()=>!1,deletes:!1,filter:e=>e.gte('for_date',he(120)),toRow:()=>({}),fromRow:t=>({id:String(t.for_date),rid:e,date:String(t.for_date),total:Number(t.total),postedAt:String(t.posted_at),postedBy:t.posted_by??void 0}),apply:t=>B.useCashUp.setState(a=>{const s=new Map(t.map(e=>[e.date,e])),i=a.tips.filter(t=>!(t.rid===e&&s.has(t.date)));return{tips:[...t.map(({id:e,...t})=>t),...i]}}),subscribe:e=>B.useCashUp.subscribe((t,a)=>{t.tips!==a.tips&&e()})}}function kt(e){return{name:'tips_pot_events',table:'tips_pot_events',mode:'insert',deletes:!1,list:()=>B.useCashUp.getState().pot.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id),writable:()=>de('wages.manage'),toRow:(e,t)=>({id:e.id,venue_id:t,kind:e.kind,for_date:e.forDate??null,through_date:e.throughDate??null,amount:e.amount,reason:e.reason??null,by_name:e.by,at:e.at}),fromRow:t=>({id:String(t.id),rid:e,kind:'payout'===t.kind?'payout':'correction',forDate:t.for_date??void 0,throughDate:t.through_date??void 0,amount:St(t.amount)??0,reason:t.reason??void 0,by:String(t.by_name),at:String(t.at)}),apply:(t,a)=>B.useCashUp.setState(s=>({pot:_t(s.pot,t,a,t=>t.rid===e)})),subscribe:e=>B.useCashUp.subscribe((t,a)=>{t.pot!==a.pot&&e()})}}function It(e){return{name:'tips_settings',table:'tips_settings',conflict:'venue_id',deletes:!1,list:()=>{const t=B.useCashUp.getState().show[e];return t?[{id:'show',...t}]:[]},key:e=>e.id,rowKey:()=>'show',syncable:()=>!0,writable:()=>de('wages.manage'),toRow:(e,t)=>({venue_id:t,show_today:e.showToday,show_pot:e.showPot,updated_at:(new Date).toISOString()}),fromRow:e=>({id:'show',showToday:!1!==e.show_today,showPot:!1!==e.show_pot}),apply:t=>B.useCashUp.setState(a=>t[0]?{show:{...a.show,[e]:{showToday:t[0].showToday,showPot:t[0].showPot}}}:a),subscribe:e=>B.useCashUp.subscribe((t,a)=>{t.show!==a.show&&e()})}}function Ot(e){return{name:'scheduled_notifications',table:'scheduled_notifications',list:()=>j.useNotifs.getState().items.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id),writable:()=>de('venue.settings'),deletes:!1,toRow:(e,t)=>{const{rid:a,...s}=e;return{id:e.id,venue_id:t,doc:ve(s),updated_at:(new Date).toISOString()}},fromRow:t=>({...t.doc,id:String(t.id),rid:e}),apply:(t,a)=>j.useNotifs.setState(s=>({items:_t(s.items,t,a,t=>t.rid===e)})),subscribe:e=>j.useNotifs.subscribe((t,a)=>{t.items!==a.items&&e()})}}function Rt(e){return{name:'order_lists',table:'order_lists',list:()=>{const t=F.useOrderLists.getState(),a=t.lists.filter(t=>t.rid===e&&(0,$.isUuid)(t.id)).map(e=>{const{rid:t,...a}=e;return{id:e.id,kind:'list',doc:ve(a)}}),s=t.settings[e];return s?[...a,{id:s.id,kind:'settings',doc:ve(s)}]:a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id),writable:()=>de('venue.settings')||de('suppliers.order'),deletes:!1,toRow:(e,t)=>({id:e.id,venue_id:t,kind:e.kind,doc:e.doc,updated_at:(new Date).toISOString()}),fromRow:e=>({id:String(e.id),kind:'settings'===e.kind?'settings':'list',doc:e.doc??{}}),apply:(t,a)=>F.useOrderLists.setState(s=>{const i={...s.settings};for(const a of t.filter(e=>'settings'===e.kind))i[e]={...W.DEFAULT_ORDER_LIST_SETTINGS,...a.doc,id:a.id};const n=t.filter(e=>'list'===e.kind).map(t=>({...t.doc,id:t.id,rid:e}));return{settings:i,lists:_t(s.lists,n,a,t=>t.rid===e)}}),subscribe:e=>F.useOrderLists.subscribe((t,a)=>{t.lists===a.lists&&t.settings===a.settings||e()})}}function At(e){const t=()=>de('venue.settings')||de('suppliers.order');return{name:'order_list_items',table:'order_list_items',list:()=>F.useOrderLists.getState().items.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:a=>(0,$.isUuid)(a.id)&&(0,$.isUuid)(a.listId)&&(t()||'open'===a.status&&(0,F.orderSettingsOf)(e).allowStaff),writable:()=>'staff'===re.getState().kind,deletes:!0,toRow:(e,a)=>{const{rid:s,...i}=e;return{id:e.id,venue_id:a,list_id:e.listId,status:e.status,added_by_ref:(t()?e.addedBy:re.getState().staffRef)||null,doc:ve(i),updated_at:(new Date).toISOString()}},fromRow:t=>({...t.doc,id:String(t.id),listId:String(t.list_id),status:t.status??'open',rid:e}),apply:(t,a)=>F.useOrderLists.setState(s=>({items:_t(s.items,t,a,t=>t.rid===e)})),subscribe:e=>F.useOrderLists.subscribe((t,a)=>{t.items!==a.items&&e()})}}function Ut(e){const t=he(400);return{name:'order_list_history',table:'order_list_history',mode:'insert',deletes:!1,list:()=>F.useOrderLists.getState().history.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id),writable:()=>de('venue.settings')||de('suppliers.order'),filter:e=>e.gte('finished_at',t).order('finished_at',{ascending:!1}).limit(300),toRow:(e,t)=>{const{rid:a,...s}=e;return{id:e.id,venue_id:t,list_id:e.listId,finished_at:e.finishedAt,finished_by:e.finishedByName.slice(0,80),doc:ve(s)}},fromRow:t=>({...t.doc,id:String(t.id),rid:e}),apply:(t,a)=>F.useOrderLists.setState(s=>({history:_t(s.history,t,a,t=>t.rid===e).sort((e,t)=>t.finishedAt.localeCompare(e.finishedAt)).slice(0,300)})),subscribe:e=>F.useOrderLists.subscribe((t,a)=>{t.history!==a.history&&e()})}}function Dt(e){return{name:'venue_clock_area',table:'venue_clock_area',conflict:'venue_id',deletes:!1,list:()=>{const t=V.useClockArea.getState().areas[e];return t&&t.updatedAt?[{id:'area',doc:ve(t)}]:[]},key:()=>'area',rowKey:()=>'area',syncable:()=>!0,matchKey:()=>({}),writable:()=>de('venue.settings'),toRow:(e,t)=>({venue_id:t,doc:e.doc,updated_at:(new Date).toISOString()}),fromRow:e=>({id:'area',doc:e.doc??{}}),apply:t=>{const a=t[0];a&&V.useClockArea.setState(t=>({areas:{...t.areas,[e]:{...(0,u.venueClockArea)(e,a.doc),updatedAt:a.doc.updatedAt,updatedBy:a.doc.updatedBy}}}))},subscribe:e=>V.useClockArea.subscribe((t,a)=>{t.areas!==a.areas&&e()})}}function Et(e){return{name:'daily_tasks',table:'daily_tasks',deletes:!1,list:()=>{const t=J.useDailyTasks.getState(),a=[],s=t.library[e];s?.updatedAt&&a.push({id:(0,J.libraryRowId)(e),kind:'library',doc:ve({items:s.items,updatedAt:s.updatedAt})});for(const[s,i]of Object.entries(t.people)){const[t,n]=s.split('|');t===e&&i.updatedAt&&a.push({id:(0,J.personRowId)(e,n),kind:'person',staffRef:n,doc:ve({tasks:i.tasks,updatedAt:i.updatedAt})})}return a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>{const t=P.useOwner.getState().staff.find(e=>e.id===re.getState().staffRef);if(!t)return!1;if('staff'!==t.role)return!0;if('person'!==e.kind)return!1;const a=P.useOwner.getState().staff.find(t=>t.id===e.staffRef);return!!a&&(0,z.canEditTasks)(t,a)},writable:()=>'staff'===re.getState().kind,toRow:(e,t)=>({id:e.id,venue_id:t,kind:e.kind,staff_ref:e.staffRef??null,doc:e.doc,updated_at:(new Date).toISOString()}),fromRow:e=>({id:String(e.id),kind:'library'===e.kind?'library':'person',staffRef:e.staff_ref??void 0,doc:e.doc??{}}),apply:t=>J.useDailyTasks.setState(a=>{const s={...a.library},i={...a.people};for(const a of t)'library'===a.kind?s[e]={items:a.doc.items??[],updatedAt:a.doc.updatedAt}:a.staffRef&&(i[(0,J.personKey)(e,a.staffRef)]={tasks:a.doc.tasks??[],updatedAt:a.doc.updatedAt});return{library:s,people:i}}),subscribe:e=>J.useDailyTasks.subscribe((t,a)=>{t.library===a.library&&t.people===a.people||e()})}}function Ct(e){const t=he(7);return{name:'daily_task_ticks',table:'daily_task_ticks',list:()=>J.useDailyTasks.getState().ticks.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>{const t=re.getState();return e.byRef===t.staffRef||de('staff.manage')},writable:()=>'staff'===re.getState().kind,filter:e=>e.gte('for_date',t),inWindow:e=>e.forDate>=t,toRow:(e,t)=>({id:e.id,venue_id:t,staff_ref:e.staffRef,task_id:e.taskId,for_date:e.forDate,ticked_by_ref:e.byRef,ticked_by_name:e.byName.slice(0,80),ticked_at:e.at}),fromRow:t=>({id:String(t.id),rid:e,staffRef:String(t.staff_ref),taskId:String(t.task_id),forDate:String(t.for_date).slice(0,10),byRef:String(t.ticked_by_ref??''),byName:String(t.ticked_by_name??''),at:String(t.ticked_at)}),apply:(t,a)=>J.useDailyTasks.setState(s=>({ticks:_t(s.ticks,t,a,t=>t.rid===e)})),subscribe:e=>J.useDailyTasks.subscribe((t,a)=>{t.ticks!==a.ticks&&e()})}}function Tt(e,t=!1){const a=he(14);return{name:'sold_out_items',table:'sold_out_items',conflict:'venue_id,item_id',list:()=>ee.useSoldOut.getState().entries.filter(t=>t.rid===e),key:e=>e.itemId,rowKey:e=>String(e.item_id),syncable:()=>!0,deletes:!1,writable:()=>'staff'===re.getState().kind,filter:e=>e.gte('marked_at',a),inWindow:e=>e.at.slice(0,10)>=a,toRow:(e,a)=>({id:(0,se.uuidFrom)(`soldout:${a}:${e.itemId}`),venue_id:a,item_id:e.itemId.slice(0,80),name:e.name.slice(0,120),is_on:e.on,marked_at:e.at,by_name:(e.by||'Staff').slice(0,80),clear_after:e.clearAfter??null,...t?{auto:!!e.auto,kept:!!e.kept}:{}}),fromRow:a=>({rid:e,itemId:String(a.item_id),name:String(a.name??''),on:!0===a.is_on,at:String(a.marked_at),by:String(a.by_name??''),clearAfter:a.clear_after?String(a.clear_after):void 0,...t?{auto:!0===a.auto,kept:!0===a.kept}:{}}),apply:(t,a)=>ee.useSoldOut.setState(s=>{const i=new Set(a);return{entries:[...s.entries.filter(a=>!(a.rid===e&&(i.has(a.itemId)||t.some(e=>{return s=a,(t=e).rid===s.rid&&t.itemId===s.itemId;var t,s})))),...t]}}),subscribe:e=>ee.useSoldOut.subscribe((t,a)=>{t.entries!==a.entries&&e()}),afterRead:()=>{te.autoSync.soldOutRead.add(e)}}}function Nt(e){return{name:'sold_out_links',table:'sold_out_links',conflict:'venue_id,item_id',list:()=>te.useSoldOutLinks.getState().links.filter(t=>t.rid===e),key:e=>e.itemId,rowKey:e=>String(e.item_id),syncable:()=>!0,deletes:!1,writable:()=>'staff'===re.getState().kind,toRow:(e,t)=>({id:(0,se.uuidFrom)(`soldoutlink:${t}:${e.itemId}`),venue_id:t,item_id:e.itemId.slice(0,80),uses:e.uses.slice(0,10).map(e=>({key:String(e.key).slice(0,40),qty:Math.max(0,Math.min(99,Number(e.qty)||0))})),auto:!!e.auto,updated_at:e.at,updated_by:(e.by||'Staff').slice(0,80)}),fromRow:t=>({rid:e,itemId:String(t.item_id),uses:(Array.isArray(t.uses)?t.uses:[]).map(e=>({key:String(e.key??''),qty:Number(e.qty)||0})).filter(e=>e.key&&e.qty>0),at:String(t.updated_at??''),by:String(t.updated_by??''),...!0===t.auto?{auto:!0}:{}}),apply:(t,a)=>te.useSoldOutLinks.setState(s=>{const i=new Set(a);return{links:[...s.links.filter(a=>!(a.rid===e&&(i.has(a.itemId)||t.some(e=>e.itemId===a.itemId)))),...t]}}),subscribe:e=>te.useSoldOutLinks.subscribe((t,a)=>{t.links!==a.links&&e()}),afterRead:()=>{te.autoSync.linksRead.add(e)}}}async function Mt(e,t="*"){const a='*'===t?`table:${e}`:`table:${e}.${t}`;try{const s=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:i}=await Promise.race([ne().from(e).select(t,{head:!0,count:'exact'}).limit(1),s]);return i?!!/fetch|network|Failed/i.test(i.message)&&k.kv.get(a,!1):(k.kv.set(a,!0),!0)}catch{return k.kv.get(a,!1)}}async function Kt(){const e=re.getState().venueId;if(e)try{const{data:t}=await ne().from('push_settings').select('push_live').eq('venue_id',e).maybeSingle();qt.setState({live:!!t?.push_live,known:!0})}catch{}}const xt='order-list-logos';const Lt=new Map;const qt=(0,y.create)(()=>({live:!1,known:!1}));async function Pt(){try{const e=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:t}=await Promise.race([ne().from('venue_reminders').select('id').limit(1),e]);return t?!!/fetch|network|Failed/i.test(t.message)&&k.kv.get('reminders:ok',!1):(k.kv.set('reminders:ok',!0),!0)}catch{return k.kv.get('reminders:ok',!1)}}async function $t(){try{const e=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:t}=await Promise.race([ne().from('chat_messages').select('id').limit(1),e]);return t?!!/fetch|network|Failed/i.test(t.message)&&k.kv.get('chat:ok',!1):(k.kv.set('chat:ok',!0),!0)}catch{return k.kv.get('chat:ok',!1)}}const jt=(e,t)=>ve({id:String(e.id),venue:t,body:String(e.body??''),kind:'yesno'===e.kind?'yesno':'up',up:Number(e.up_count??0),yes:Number(e.yes_count??0),no:Number(e.no_count??0),hidden:!!e.hidden,reply:e.reply??void 0,replyAt:e.reply_at??void 0,postedOn:String(e.posted_on??'').slice(0,10)}),Bt='id,body,kind,up_count,yes_count,no_count,hidden,reply,reply_at,posted_on';function Ft(e){return{name:'hr_questions',table:'hr_questions',deletes:!1,list:()=>_.useHr.getState().questions.filter(t=>t.venue===e&&(0,$.isUuid)(t.id)),key:e=>e.id,rowKey:e=>String(e.id),syncable:()=>!1,writable:()=>!1,toRow:e=>({id:e.id}),fromRow:t=>jt(t,e),filter:e=>e.gte('posted_on',new Date(Date.now()-10368e6).toISOString().slice(0,10)),apply:(e,t)=>{const a=new Set(t);_.useHr.setState(t=>{const s=new Map(e.map(e=>[e.id,e])),i=t.questions.filter(e=>!a.has(e.id)).map(e=>s.get(e.id)??e),n=new Set(i.map(e=>e.id));return{questions:[...i,...e.filter(e=>!n.has(e.id))]}})},subscribe:e=>_.useHr.subscribe((t,a)=>{t.questions!==a.questions&&e()})}}function Wt(e,t){const a=(t,a,s)=>{R.mutationQueue.enqueue({table:'hr_questions',venueId:e,kind:'rpc',fn:t,rowKey:a,values:s})};Object.assign(_.hrRemote,{live:!0,checkout:t=>a('hr_checkout',t.token,{p_venue:e,p_day:t.day,p_token:t.token,p_morale:t.morale,p_staffing:t.staffing,p_question:t.question??null,p_kind:t.kind??'up',p_shout_to:t.shoutTo??null,p_shout_body:t.shoutBody??null}),post:(t,s,i,n)=>a('hr_post_question',s,{p_venue:e,p_id:s,p_body:i,p_kind:n}),vote:(e,t,s)=>a('hr_vote',e,{p_question:e,p_token:t,p_vote:s}),moderate:(e,t,s)=>a('hr_moderate',e,{p_question:e,p_action:t,p_reason:s}),reply:(e,t)=>a('hr_reply',e,{p_question:e,p_reply:t}),trend:async(t,a,s)=>{try{const{data:t,error:i}=await ne().rpc('hr_trend',{p_venue:e,p_from:a,p_to:s});return i?null:(t??[]).map(e=>({day:String(e.day).slice(0,10),answers:Number(e.answers),morale:Number(e.morale),staffing:null==e.staffing?null:Number(e.staffing),short:Number(e.short),perfect:Number(e.perfect),over:Number(e.over)}))}catch{return null}},shouts:async(a,s)=>{try{const{data:a,error:i}=await ne().from('hr_shoutouts').select('id,day,to_name,body').eq('venue_id',e).gte('day',s).order('day',{ascending:!1}).limit(20);return i?null:(a??[]).map(e=>({id:String(e.id),venue:t,day:String(e.day).slice(0,10),to:String(e.to_name),body:e.body??void 0}))}catch{return null}},log:async()=>{try{const{data:a,error:s}=await ne().from('hr_mod_log').select('id,question_id,action,reason,by_name,at').eq('venue_id',e).order('at',{ascending:!1}).limit(30);return s?null:(a??[]).map(e=>({id:String(e.id),venue:t,questionId:String(e.question_id??''),action:e.action,reason:e.reason??void 0,by:String(e.by_name??'A manager'),at:String(e.at)}))}catch{return null}},refresh:async()=>{try{const{data:a,error:s}=await ne().from('hr_questions').select(Bt).eq('venue_id',e).order('posted_on',{ascending:!1}).limit(200);s||_.useHr.getState().setRemoteBoard(t,(a??[]).map(e=>jt(e,t)))}catch{}}}),me.push(()=>{Object.assign(_.hrRemote,{live:!1,checkout:null,post:null,vote:null,moderate:null,reply:null,trend:null,shouts:null,log:null,refresh:null})})}const Vt='pair:v1',Ht='staff:v1',Gt='staff:rejoin:v1';async function Qt(){if('display'===le||'customer'===le||H.PITCH)return'none';const t=await k.kv.get(Gt,null);if(!t)return'none';try{await zt();const{data:a,error:s}=await ne().rpc(e.IS_QUEUED_VENUE?'claim_'+e.VENUE_RID+'_invite':e.IS_GREENSIDE?'claim_greenside_invite':e.IS_ABBOTSFORD?'claim_abbotsford_invite':e.IS_KIRKTON?'claim_kirkton_invite':e.IS_WILDINGS?'claim_wildings_invite':e.IS_KIRKMICHAEL?'claim_kirkmichael_invite':e.IS_ISOLATED_VENUE?'claim_souters_invite':'claim_invite',{p_token:t,p_app:le,p_device:(0,g.deviceId)()});if(s)return(0,p.inviteRefusal)(s.message)?(await k.kv.remove(Gt),await k.kv.remove(Ht),'refused'):'offline';const i=a?.[0];return i?(await k.kv.set(Ht,{kind:'staff',venueId:i.venue_id,venueSlug:i.venue_slug,venueName:i.venue_name,staffRef:i.external_ref,staffUuid:i.staff_id,role:i.role_key,displayName:i.display_name}),'ok'):(await k.kv.remove(Gt),'refused')}catch{return'offline'}}const Jt=e=>/jwt|refresh|token|401|not authenticated|invalid claim|session/i.test(String(e?.message??e))&&!/fetch|network/i.test(String(e?.message??e));async function zt(){fe();const{data:e}=await ne().auth.getSession();if(!e.session)for(let e=0;;e++){const{error:t}=await ne().auth.signInAnonymously();if(!t)return;const a=429===t.status||/rate|too many/i.test(t.message);if(!a||e>=2){if(a)throw new Error('Too many people are connecting from this network right now. Wait a few minutes, or switch to mobile data, and open the link again.');throw t}oe({message:'Lots of people are connecting at once. Trying again in a moment\u2026'}),await new Promise(t=>setTimeout(t,0===e?15e3:45e3))}}async function Zt(t){if(H.PITCH)return{status:'refused',message:'This link has been replaced or switched off. Ask your manager for a new one.'};if(!(0,v.isSupabaseConfigured)())return{status:'off'};try{await zt();const{data:a,error:s}=await ne().rpc(e.IS_QUEUED_VENUE?'claim_'+e.VENUE_RID+'_invite':e.IS_GREENSIDE?'claim_greenside_invite':e.IS_ABBOTSFORD?'claim_abbotsford_invite':e.IS_KIRKTON?'claim_kirkton_invite':e.IS_WILDINGS?'claim_wildings_invite':e.IS_KIRKMICHAEL?'claim_kirkmichael_invite':e.IS_ISOLATED_VENUE?'claim_souters_invite':'claim_invite',{p_token:t,p_app:le,p_device:(0,g.deviceId)()});if(s){const t=(0,p.inviteRefusal)(s.message);if(t){try{localStorage.removeItem((0,e.venueKey)(`cc-pending-invite:${le}`))}catch{}return{status:'refused',message:t}}throw s}const i=a?.[0];if(!i)return{status:'refused',message:'This link has been replaced or switched off. Ask your manager for a new one.'};const n={kind:'staff',venueId:i.venue_id,venueSlug:i.venue_slug,venueName:i.venue_name,staffRef:i.external_ref,staffUuid:i.staff_id,role:i.role_key,displayName:i.display_name};return await k.kv.set(Ht,n),await k.kv.set(Gt,t),ge&&aa(),{status:'ok',id:n}}catch(e){const t=String(e?.message??e);return oe({lastError:`Sign-in: ${t}`}),{status:'offline',message:t}}}async function Xt(){if(!(0,v.isSupabaseConfigured)())return!1;try{return await zt(),!0}catch{return!1}}const Yt=async(e,t={})=>{if(H.PITCH)return(0,G.pitchRpc)(e,t);const{data:a,error:s}=await ne().rpc(e,t);if(s)throw s;return a};let ea=null;async function ta(){for(const e of me)try{e()}catch{}me=[],pe.forEach(e=>e.stop()),pe=[],ea&&(clearInterval(ea),ea=null)}async function aa(){await ta(),await ia()}let sa=e.VENUE_RID;async function ia(){try{const e='undefined'!=typeof navigator?navigator.storage:null;e?.persist&&e.persist()}catch{}try{const e='undefined'!=typeof window?window.CoverChargeNative:null;e&&'function'==typeof e.checkUpdate&&/CoverChargePhone\//.test(navigator.userAgent)&&e.checkUpdate()}catch{}const t=sa;try{if(oe({mode:'connecting'}),await R.mutationQueue.load(),'customer'===le)return void await da(t);const a=await k.kv.get(Vt,null);let s=await k.kv.get(Ht,null);if(e.IS_ISOLATED_VENUE&&(a&&!(0,e.venueIdentityAllowed)(a.venueId,a.venueSlug)||s&&!(0,e.venueIdentityAllowed)(s.venueId,s.venueSlug)))return void oe({mode:'display'===le?'unpaired':'signin',perms:[],message:'This sign-in belongs to a different venue.'});let{data:i}=await ne().auth.getSession();if('display'!==le&&s&&!i.session){const e=await Qt();if('offline'===e)return oe({venueId:s.venueId,venueSlug:s.venueSlug,venueName:s.venueName,kind:s.kind,role:s.role,staffRef:s.staffRef,staffUuid:s.staffUuid,mode:'offline'}),void setTimeout(()=>{sa===t&&aa()},6e4);'refused'===e&&s.staffRef&&g.useSession.getState().meId===s.staffRef&&g.useSession.getState().signOut(),s=await k.kv.get(Ht,null),({data:i}=await ne().auth.getSession())}const n='display'===le?a:s;if(!i.session||!n)return void oe({mode:'display'===le?'unpaired':'signin',perms:[]});let r=[];try{const e=(await Yt('whoami')??[]).filter(e=>e.venue_id===n.venueId);if(!e.length)return'display'===le?await k.kv.remove(Vt):(await k.kv.remove(Ht),await k.kv.remove(Gt)),'staff'===n.kind&&n.staffRef&&g.useSession.getState().meId===n.staffRef&&g.useSession.getState().signOut(),void oe({mode:'display'===le?'unpaired':'signin',perms:[],message:'display'===le?'This display was unpaired by a manager.':'Open your invite link again to connect.'});r=[...new Set(e.flatMap(e=>e.permissions??[]))],'device'===n.kind&&n.canWrite&&r.push('device.write')}catch(e){if(!(0,b.isOnline)()||/fetch|network/i.test(String(e?.message)))oe({mode:'offline'});else if(Jt(e)&&'display'!==le){const{error:e}=await ne().auth.refreshSession();e&&'ok'===await Qt()&&setTimeout(()=>{sa===t&&aa()},500)}r=re.getState().perms}oe({venueId:n.venueId,venueSlug:n.venueSlug,venueName:n.venueName,kind:n.kind,role:n.role,staffRef:n.staffRef,staffUuid:n.staffUuid,perms:r}),'staff'===n.kind&&n.staffRef&&g.useSession.getState().meId!==n.staffRef&&(g.useSession.getState().signIn(n.staffRef),P.useOwner.setState({staffAs:n.staffRef})),await ra(n.venueId,t,n.kind)}catch(e){oe({mode:'local',lastError:String(e?.message??e)})}}const na=new Set(['venues','staff','bookings','walk_ins','blocks','table_plans','takeaway_orders','stock_items','stock_events','stock_counts','recipe_cards','suppliers','supplier_orders','rota_shifts','attendance','time_requests','game_scores','floor_live','chat_messages','venue_reminders','reminder_done']);async function ra(t,a,s){if(!(0,e.venueIdentityAllowed)(t,a))throw new Error('Different venue: sync refused.');await ma(a),me.push(Da(t));try{const{data:e}=await ne().from('roles').select('id,key').eq('venue_id',t);for(const t of e??[])We.set(t.key,t.id),Ve.set(t.id,t.key)}catch{}const i=[rt(a),{protect:!0,name:'staff',table:'staff',conflict:'venue_id,external_ref',list:()=>P.useOwner.getState().staff.map(Je),key:e=>e.id,rowKey:e=>String(e.external_ref??e.id),syncable:e=>!e.name.includes('(example)'),writable:()=>de('staff.manage'),deletes:!1,toRow:(e,t)=>({venue_id:t,external_ref:e.id,display_name:e.name,...$e?{nickname:e.nickname?.trim()||null}:{},job_title:e.job||null,department:e.dept||null,active:e.active,...je?{display_clock:!!e.displayClock,temp:!!e.temp,temp_until:e.tempUntil||null}:{},...e.managerAccess||e.ownerAccess||!We.get(He(e))?{}:{role_id:We.get(He(e))}}),fromRow:e=>e.external_ref?(Be.set(String(e.external_ref),String(e.id)),Fe.set(String(e.id),String(e.external_ref)),Oa.set(String(e.external_ref),e.avatar_path??null),ve({id:String(e.external_ref),name:e.display_name,...$e&&'nickname'in e?{nickname:e.nickname??void 0}:{},job:e.job_title??'',active:!1!==e.active,dept:e.department??'',...je&&'display_clock'in e?{displayClock:!!e.display_clock,temp:!!e.temp||void 0,tempUntil:e.temp_until??void 0}:{},...Qe(Ge(Ve.get(String(e.role_id))),!0===e.manager_access),...!0===e.owner_access&&'owner'!==Ge(Ve.get(String(e.role_id))).role?{role:'owner',ownerAccess:!0}:{}})):null,apply:e=>P.useOwner.setState(t=>{const a=new Map(e.map(e=>[e.id,e])),s=t.staff.map(e=>a.has(e.id)?{...e,...a.get(e.id)}:e),i=new Set(s.map(e=>e.id));return{staff:[...s,...e.filter(e=>!i.has(e.id)).map(e=>({...e}))]}}),subscribe:e=>P.useOwner.subscribe((t,a)=>{t.staff!==a.staff&&e()}),afterRead:()=>{Ua()},onRemote:()=>{Ua()}},{name:'pay',table:'staff_private',conflict:'staff_id',list:()=>{const e=P.useOwner.getState(),t=x.useSetup.getState().sites[sa]?.staffGrade??{};return e.staff.filter(e=>Be.has(e.id)).map(a=>ve({id:a.id,hourly:e.hourly[a.id]??null,salaried:!!a.salaried,noTax:!!a.noTax,grade:t[a.id]||void 0}))},key:e=>e.id,rowKey:e=>Fe.get(String(e.staff_id))??String(e.staff_id),syncable:e=>Be.has(e.id),writable:()=>de('wages.manage'),deletes:!1,toRow:(e,t)=>({staff_id:Be.get(e.id),venue_id:t,hourly_rate:null==e.hourly?null:e.hourly/100,salaried:e.salaried,no_tax:e.noTax,pay_grade:e.grade??null}),fromRow:e=>{const t=Fe.get(String(e.staff_id));return t?ve({id:t,hourly:null==e.hourly_rate?null:Math.round(100*Number(e.hourly_rate)),salaried:!!e.salaried,noTax:!!e.no_tax,grade:e.pay_grade||void 0}):null},apply:e=>P.useOwner.setState(t=>{const a={...t.hourly},s=new Map(e.map(e=>[e.id,e]));for(const t of e)null==t.hourly?delete a[t.id]:a[t.id]=t.hourly;if(e.length){const t=x.useSetup.getState().sites[sa],a={...t?.staffGrade??{}};let s=!1;for(const t of e)(a[t.id]||void 0)!==t.grade&&(s=!0,t.grade?a[t.id]=t.grade:delete a[t.id]);s&&x.useSetup.getState().patch(sa,{staffGrade:a})}return{hourly:a,staff:t.staff.map(e=>s.has(e.id)?{...e,salaried:s.get(e.id).salaried,noTax:s.get(e.id).noTax}:e)}}),subscribe:e=>{const t=P.useOwner.subscribe((t,a)=>{t.hourly===a.hourly&&t.staff===a.staff||e()}),a=x.useSetup.subscribe((t,a)=>{t.sites[sa]?.staffGrade!==a.sites[sa]?.staffGrade&&e()});return()=>{t(),a()}}},be(a,!1),be(a,!0),Ie(a),Re(a),ke(a),Ae(a),De(a),Ee(a),Pe(a),{name:'supplier_directory',table:'suppliers',list:()=>P.useOwner.getState().suppliers,key:e=>e.id,rowKey:e=>String(e.doc?.localId??e.id),syncable:e=>(0,$.isUuid)(e.id),writable:()=>de('suppliers.manage'),toRow:(e,t)=>({id:e.id,venue_id:t,name:e.name||'Supplier',category:e.category,contact:e.contact||null,phones:e.phones.filter(Boolean),email:e.email||null,website:e.website||null,account_ref:e.account||null,cutoff:e.cutoff||null,order_days:e.orderDays,delivery_days:e.deliveryDays,doc:{kind:'directory',localId:e.id,supplier:ve(e)}}),fromRow:e=>'directory'===e.doc?.kind?e.doc.supplier:null,apply:(e,t)=>P.useOwner.setState(a=>{const s=new Set(t),i=new Map(e.map(e=>[e.id,e])),n=a.suppliers.filter(e=>!s.has(e.id)).map(e=>i.get(e.id)??e),r=new Set(n.map(e=>e.id));return{suppliers:[...n,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>P.useOwner.subscribe((t,a)=>{t.suppliers!==a.suppliers&&e()})},{name:'supplier_orders',table:'supplier_orders',list:()=>P.useOwner.getState().supplierOrders,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id)&&(0,$.isUuid)(e.supplierId),writable:()=>de('suppliers.order')||de('suppliers.manage'),toRow:(e,t)=>({id:e.id,venue_id:t,supplier_id:e.supplierId,order_date:e.date||Se(),items:[{text:e.items}],amount:Math.round(e.amount||0),status:'sent',by_name:e.by,doc:ve(e)}),fromRow:e=>e.doc?{...e.doc,id:String(e.id)}:null,apply:(e,t)=>P.useOwner.setState(a=>{const s=new Set(t),i=new Map(e.map(e=>[e.id,e])),n=a.supplierOrders.filter(e=>!s.has(e.id)).map(e=>i.get(e.id)??e),r=new Set(n.map(e=>e.id));return{supplierOrders:[...e.filter(e=>!r.has(e.id)),...n]}}),subscribe:e=>P.useOwner.subscribe((t,a)=>{t.supplierOrders!==a.supplierOrders&&e()})},Te(a),ba(a)];de('wages.view')&&i.push(ka(a)),'staff'===s&&(i.push(Ye(),et(),tt(),st(a)),at(t));const n='staff'===s&&await $t();if(Z.useChatSync.setState({synced:n,checked:!0}),me.push(()=>Z.useChatSync.setState({synced:!1})),n&&i.push(pt(),{name:'chat_extra',table:'chat_channel_extra',conflict:'venue_id,channel,staff_id',list:()=>Object.entries(X.useKitchenExtra.getState().extra).map(([e,t])=>({id:e,include:t})),key:e=>e.id,rowKey:e=>Fe.get(String(e.staff_id))??String(e.staff_id),syncable:e=>Be.has(e.id),writable:()=>de('staff.manage'),filter:e=>e.eq('channel','kitchen'),matchKey:e=>({channel:'kitchen',staff_id:Be.get(e)??e}),toRow:(e,t)=>({venue_id:t,channel:'kitchen',staff_id:Be.get(e.id),include:e.include}),fromRow:e=>{const t=Fe.get(String(e.staff_id));return t?{id:t,include:!!e.include}:null},apply:(e,t)=>X.useKitchenExtra.setState(a=>{const s={...a.extra};return t.forEach(e=>{delete s[e]}),e.forEach(e=>{s[e.id]=e.include}),{extra:s}}),subscribe:e=>X.useKitchenExtra.subscribe((t,a)=>{t.extra!==a.extra&&e()})}),'staff'===s&&await Mt('hr_questions')&&(i.push(Ft(a)),na.add('hr_questions'),Wt(t,a)),'guest'!==s&&await Mt('sold_out_items')?(i.push(Tt(a,await Mt('sold_out_items','auto'))),na.add('sold_out_items')):te.autoSync.soldOutRead.add(a),'guest'!==s&&await Mt('sold_out_links')?(i.push(Nt(a)),na.add('sold_out_links')):te.autoSync.linksRead.add(a),S.useReminders.getState().ensure(a),'guest'!==s&&await Pt()&&(i.push(mt(a)),'staff'===s&&i.push(gt(a))),j.useNotifs.getState().ensure(a),F.useOrderLists.getState().ensure(a),'staff'===s){$e=await Mt('staff','nickname'),je=await Mt('staff','display_clock');const[e,t,s,n]=await Promise.all([Mt('scheduled_notifications'),Mt('order_lists'),Mt('venue_clock_area'),Mt('daily_tasks')]);J.useDailyTasks.getState().ensure(a),n&&(i.push(Et(a),Ct(a)),na.add('daily_tasks'),na.add('daily_task_ticks')),e&&(i.push(Ot(a)),Kt()),t&&i.push(Rt(a),At(a),Ut(a)),s&&i.push(Dt(a));for(const[a,i]of[[e,'scheduled_notifications'],[t,'order_lists'],[t,'order_list_items'],[t,'order_list_history'],[s,'venue_clock_area']])a&&na.add(i)}if('guest'!==s&&await Mt('day_tips')){i.push(bt(a));for(const e of['day_tips','tips_pot_events','tips_settings'])na.add(e);await Mt('tips_pot_events')&&i.push(kt(a),It(a)),'staff'===s&&(i.push(yt(a),wt(a),vt(a)),na.add('cash_ups'),na.add('sales_reports'),_r2(_d[59])(_d[58],_d.paths).then(e=>e.refreshCashAccess()))}'device'===s&&(i.push(Ye(),et()),await Mt('scheduled_notifications')&&i.push(Ot(a)));let r=!1;const o={onActivity:()=>oe({lastSyncAt:(new Date).toISOString()}),onError:(e,t)=>oe({lastError:`${e}: ${t}`}),onSuspect:(e,s)=>{oe({lastError:`${e}: held back, ${s}`}),r||(r=!0,(async()=>{try{if(!(await Yt('whoami')??[]).some(e=>e.venue_id===t))return void(sa===a&&aa());for(const a of pe){if(a.spec.name!==e)continue;const{count:s,error:i}=await ne().from(a.spec.table).select('*',{count:'exact',head:!0}).eq(a.spec.venueColumn??'venue_id',t);!i&&(s??0)>0&&a.allowMassRemoveOnce()}}catch{}finally{r=!1}})())}};pe=i.map(e=>new A.EntityBridge(e,t,o)),await Promise.all(pe.map(e=>e.start()));const d=async()=>{if('staff'===s&&(0,b.isOnline)())try{const e=await Yt('whoami');if(!e?.some(e=>e.venue_id===t))return void(sa===a&&aa())}catch(e){if(Jt(e)){const e=await Qt();return void('ok'!==e&&'refused'!==e||sa===a&&aa())}}let e=0;for(const[t,a]of pe.entries()){const s='chat'===i[t]?.name;try{await a.read(),e++,s&&Z.useChatSync.getState().error&&Z.useChatSync.setState({error:void 0})}catch(e){const t=String(e?.message??e);if((s||/fetch|network|Failed/i.test(t))&&Z.useChatSync.setState({error:t||'unknown error'}),/fetch|network|Failed/i.test(t))break}}if(e?(oe({mode:(0,b.isOnline)()?'live':'offline',lastSyncAt:(new Date).toISOString()}),R.mutationQueue.flush()):oe({mode:'offline'}),!de('wages.view')){const e=re.getState().staffRef;P.useOwner.setState(t=>({hourly:e&&null!=t.hourly[e]?{[e]:t.hourly[e]}:{}}))}};await d();const u=new Map;for(const e of pe)u.set(e.spec.table,[...u.get(e.spec.table)??[],e]);const l=[...u.keys()].filter(e=>na.has(e)).map(e=>({table:e,venueColumn:u.get(e)[0].spec.venueColumn}));let c=!1;const f=(0,A.venueChannel)(t,l,(e,t,a)=>{for(const s of u.get(e)??[])s.remote(t,a);oe({lastSyncAt:(new Date).toISOString()})},e=>{oe({realtime:e}),'SUBSCRIBED'===e?(c&&d(),c=!1):'CHANNEL_ERROR'!==e&&'TIMED_OUT'!==e&&'CLOSED'!==e||(c=!0)});me.push(()=>{ne().removeChannel(f)}),ea=setInterval(()=>{d()},6e4),me.push((0,b.onConnectivity)(e=>{e&&d()}))}'undefined'!=typeof window&&(window.__ccSync=()=>({...re.getState(),queue:R.mutationQueue.pending.map(e=>e.table),failedTables:R.mutationQueue.failed.map(e=>`${e.table}: ${e.lastError??''}`.slice(0,200))}));const oa='guest:sent:v1';async function da(s){oe({kind:'guest',venueSlug:s,perms:[]});try{const i=(await Yt('public_venue',{p_venue_slug:(0,t.queuedDatabaseSlug)(s)}))?.[0];if(i&&(!e.IS_ISOLATED_VENUE||i.id===e.VENUE_UUID)){oe({venueId:i.id,venueName:i.name}),await ma(s);const e=i.app?.restaurant;e&&U.useStore.setState(t=>({restaurants:t.restaurants.map(t=>t.id===s?(0,a.withWildingsAddress)({...e,id:s}):t)})),nt(s,i.app?.events)}await ua(s),oe({mode:'live',lastSyncAt:(new Date).toISOString()})}catch{oe({mode:(0,b.isOnline)()?'local':'offline'})}const i=setInterval(()=>{ua(s).catch(()=>{})},6e4);me.push(()=>clearInterval(i)),e.IS_ISOLATED_VENUE||await la(s)}async function ua(e){const a=await Yt('public_menu',{p_venue_slug:(0,t.queuedDatabaseSlug)(e)})??[];if(a.length){const t=new Map(a.map(e=>[String(e.menu_item_id??e.doc?.item?.id??''),e]));N.useCardStore.setState(a=>({cards:a.cards.map(a=>{if(a.restaurantId!==e)return a;const s=t.get(a.menuItemId);if(!s)return a.signOff?{...a,signOff:null}:a;const i=s.updated_at?new Date(s.updated_at).toISOString():a.updatedAt;return{...a,photo:s.photo_url||void 0,signOff:a.signOff??{by:'Head chef',at:i}}})}))}const s=a.map(e=>e.doc?.item).filter(e=>!!e&&!!e.id).map(t=>({...t,restaurantId:e}));s.length&&U.useStore.setState(e=>{const t=new Map(s.map(e=>[e.id,e])),a=e.menu.map(e=>t.get(e.id)??e),i=new Set(a.map(e=>e.id));return{menu:[...a,...s.filter(e=>!i.has(e.id))]}})}async function la(e){let a=await k.kv.get(oa,{}),s=!1;const i=new Date(Date.now()-1728e5).toISOString(),n=async()=>{if(!s){s=!0;try{const s=U.useStore.getState(),n=s.bookings.filter(t=>t.restaurantId===e&&(0,$.isUuid)(t.id)&&!t.walkIn&&!a[t.id]&&t.createdAt>=i),r=s.orders.filter(t=>t.restaurantId===e&&(0,$.isUuid)(t.id)&&!a[t.id]&&t.createdAt>=i&&'table'!==t.type);if(n.length||r.length){if(!await Xt())return;for(const s of n)try{const i=(await Yt('guest_create_booking',{p_venue_slug:(0,t.queuedDatabaseSlug)(e),p_booking:{...ve(s),...(0,f.takeGuard)(s.id),allergies:we(s.allergies)}}))?.[0];a={...a,[s.id]:'booking'};const n={};i?.status&&i.status!==s.status&&(n.status=i.status),'string'==typeof i?.ref&&i.ref&&i.ref!==s.ref&&(n.ref=i.ref),Object.keys(n).length&&U.useStore.setState(e=>({bookings:e.bookings.map(e=>e.id===s.id?{...e,...n}:e)}))}catch(e){/fetch|network/i.test(String(e?.message))||(a={...a,[s.id]:'failed'},oe({lastError:`Booking: ${e?.message}`}))}for(const s of r)try{await Yt('guest_create_takeaway',{p_venue_slug:(0,t.queuedDatabaseSlug)(e),p_order:{...ve(s),...(0,f.takeGuard)(s.id),allergies:we(s.allergies)}}),a={...a,[s.id]:'order'}}catch(e){/fetch|network/i.test(String(e?.message))||(a={...a,[s.id]:'failed'},oe({lastError:`Order: ${e?.message}`}))}await k.kv.set(oa,a)}for(const e of s.bookings)if('booking'===a[e.id]&&'cancelled'===e.status)try{await Yt('guest_cancel_booking',{p_id:e.id}),a={...a,[e.id]:'cancelled'},await k.kv.set(oa,a)}catch{}if(Object.values(a).some(e=>'booking'===e||'order'===e)){const e=await Yt('guest_my_items')??[],t=new Map(e.map(e=>[String(e.id),e]));U.useStore.setState(e=>({bookings:e.bookings.map(e=>{const a=t.get(e.id);return a&&a.status&&a.status!==e.status&&'declined'!==a.status?{...e,status:a.status}:'declined'===a?.status&&'cancelled'!==e.status?{...e,status:'cancelled'}:e}),orders:e.orders.map(e=>{const a=t.get(e.id);if(!a)return e;const s=a.doc??{},i={...e,status:a.status??e.status,readyBy:s.readyBy??e.readyBy,accepted:s.accepted??e.accepted};return ca(i)===ca(e)?e:i})})),oe({mode:'live',lastSyncAt:(new Date).toISOString()})}}catch{oe({mode:(0,b.isOnline)()?re.getState().mode:'offline'})}finally{s=!1}}};me.push(U.useStore.subscribe((e,t)=>{e.bookings===t.bookings&&e.orders===t.orders||setTimeout(()=>{n()},200)})),ea=setInterval(()=>{n()},15e3),n()}const ca=e=>JSON.stringify([e.status,e.readyBy,e.accepted]),fa={bridges:()=>pe,restart:aa},pa='golive:v1:';async function ma(e){'live'!==U.useStore.getState().clock.mode&&U.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}}),s.LIVE_VENUE_BUILD&&(0,s.isLiveVenue)(e)?await wa(e):(await k.kv.get(pa+e,!1)||await wa(e),await k.kv.get(ha+e,!1)||(ya(e),await k.kv.set(ha+e,!0)),await k.kv.get(ga+e,!1)||(Sa(),await k.kv.set(ga+e,!0)))}const ga='golive:v3:';function Sa(){const e=e=>JSON.stringify(e).includes('(example)');try{L.useKitchen.setState(t=>({waste:t.waste.filter(t=>!e(t)),stockTakes:t.stockTakes.filter(t=>!e(t)),deliveries:t.deliveries.filter(e=>'dl-today-fish'!==e.id&&'dl-today-veg'!==e.id)}))}catch{}}const ha='golive:v2:';function ya(e){const t=e=>JSON.stringify(e).includes('(example)');U.useStore.setState(t=>({customer:{...t.customer,name:'',email:'',phone:'',allergies:[],allergyConsent:!1,marketingOptIn:{}},stampCards:t.stampCards.filter(t=>t.restaurantId!==e),giftCards:t.giftCards.filter(t=>t.restaurantId!==e),ratings:t.ratings.filter(t=>t.restaurantId!==e),events:t.events.filter(t=>!(t.example&&(t.restaurantId===e||null===t.restaurantId)))})),P.useOwner.setState(e=>({referrals:[],coats:[],merchOrders:[],lost:[],customerTags:{},offers:e.offers.filter(e=>!t(e)),changeRequests:e.changeRequests.filter(e=>!t(e)),campaigns:e.campaigns.filter(e=>!t(e)),supplierOrders:e.supplierOrders.filter(e=>!t(e)),chat:e.chat.filter(e=>e.id.startsWith('m-seed-')).map((e,t)=>({...e,at:new Date(Date.now()-6e4*(5-t)).toISOString()}))}))}async function wa(e){if(s.LIVE_VENUE_BUILD&&(0,s.isLiveVenue)(e)){const t=(0,i.stripCoreLiveSamples)(U.useStore.getState()),a=(0,L.stripKitchenExamples)(L.useKitchen.getState()),o=P.useOwner.getState(),u=(0,i.stripOwnerLiveSamples)(o),l={accidents:q.useSafety.getState().accidents.filter(e=>!(0,q.isSeedAccident)(e))},c=(e,t)=>Object.keys(t).some(a=>JSON.stringify(e[a])!==JSON.stringify(t[a]));c(U.useStore.getState(),t)&&(await(0,n.archiveChefCache)('core',U.useStore.getState()),U.useStore.setState(t)),c(L.useKitchen.getState(),a)&&(await(0,n.archiveChefCache)('kitchen',L.useKitchen.getState()),L.useKitchen.setState(a)),c(o,u)&&(await(0,n.archiveChefCache)('owner',o),P.useOwner.setState(u)),c(q.useSafety.getState(),l)&&(await(0,n.archiveChefCache)('safety',q.useSafety.getState()),q.useSafety.setState(l));const f=(0,_.stripHrSamples)(_.useHr.getState());c(_.useHr.getState(),f)&&(await(0,n.archiveChefCache)('hr',_.useHr.getState()),_.useHr.setState(f));const p=(0,r.stripGpSamples)(r.useGpCalc.getState());c(r.useGpCalc.getState(),p)&&(await(0,n.archiveChefCache)('gp',r.useGpCalc.getState()),r.useGpCalc.setState(p));const m=M.useOrderSheets.getState(),g={sheets:{...m.sheets,anchorage:(m.sheets.anchorage||[]).filter(e=>!('os-veg'===e.id&&e.placeholder))}};c(m,g)&&(await(0,n.archiveChefCache)('order-sheets',m),M.useOrderSheets.setState(g));const S=N.useCardStore.getState(),h={cards:S.cards.filter(e=>!(0,s.isLiveVenue)(e.restaurantId)||!(0,d.isDemoCard)(e)),log:S.log.filter(e=>!(0,d.demoActor)(e.by))};return c(S,h)&&(await(0,n.archiveChefCache)('recipe-cards',S),N.useCardStore.setState(h)),void await k.kv.set(pa+e,!0)}const t=t=>t.restaurantId===e&&!(0,$.isUuid)(t.id);U.useStore.setState(a=>({bookings:a.bookings.filter(e=>!t(e)),orders:a.orders.filter(e=>!t(e)),waitlist:a.waitlist.filter(t=>t.restaurantId!==e),walkIns:Object.fromEntries(Object.entries(a.walkIns).filter(([t])=>!t.includes(e)))})),E.useBlocks.setState(t=>({blocks:t.blocks.filter(t=>t.rid!==e||(0,$.isUuid)(t.id))})),C.useFloor.setState(t=>({live:{...t.live,[e]:{}}})),P.useOwner.setState(e=>({shifts:e.shifts.filter(e=>(0,$.isUuid)(e.id)),attendance:e.attendance.filter(e=>(0,$.isUuid)(e.id)),timeRequests:e.timeRequests.filter(e=>(0,$.isUuid)(e.id)),leave:[],swaps:[]}));try{L.useKitchen.setState(e=>(0,L.stripKitchenExamples)(e))}catch{}P.useOwner.setState(e=>({suppliers:e.suppliers.filter(e=>(0,$.isUuid)(e.id)),supplierOrders:e.supplierOrders.filter(e=>(0,$.isUuid)(e.id)&&(0,$.isUuid)(e.supplierId))}));try{q.useSafety.setState(e=>({accidents:e.accidents.filter(e=>{return!String(e.id).startsWith('acc-ex')&&(t=e,!JSON.stringify(t).includes('(example)'));var t})}))}catch{}await k.kv.set(pa+e,!0)}const va=(e,t)=>ve({name:e,stage:t.stage||void 0,dirty:t.dirty||void 0,blocked:t.blocked||void 0,note:t.note||void 0});function ba(e){return{name:'floor_live',table:'floor_live',conflict:'venue_id,table_name',list:()=>Object.entries(C.useFloor.getState().live[e]??{}).map(([e,t])=>va(e,t)),key:e=>e.name,rowKey:e=>String(e.table_name),syncable:e=>e.name.length>0&&e.name.length<=20,writable:()=>'staff'===re.getState().kind||de('device.write'),deletes:!1,matchKey:e=>({table_name:e}),toRow:(e,t)=>({venue_id:t,table_name:e.name,stage:e.stage??null,dirty:!!e.dirty,blocked:!!e.blocked,note:e.note?e.note.slice(0,200):null,updated_by:re.getState().staffRef??le}),fromRow:e=>va(String(e.table_name),{stage:e.stage??void 0,dirty:!!e.dirty,blocked:!!e.blocked,note:e.note??void 0}),apply:(t,a)=>C.useFloor.setState(s=>{const i={...s.live[e]??{}};for(const e of t){const{name:t,...a}=e;i[t]=a}for(const e of a)delete i[e];return{live:{...s.live,[e]:i}}}),subscribe:e=>C.useFloor.subscribe((t,a)=>{t.live!==a.live&&e()})}}function ka(e){return{name:'pay_grades',table:'pay_grades',conflict:'venue_id,grade_id',list:()=>(x.useSetup.getState().sites[e]?.grades??x.DEFAULT_GRADES).map((e,t)=>({id:e.id,name:e.name,pence:e.pence,sort:t})),key:e=>e.id,rowKey:e=>String(e.grade_id),syncable:e=>!!e.id&&!!e.name,writable:()=>de('wages.manage'),matchKey:e=>({grade_id:e}),toRow:(e,t)=>({venue_id:t,grade_id:e.id,name:e.name.slice(0,60),pence:Math.max(0,Math.min(1e5,Math.round(e.pence))),sort:e.sort}),fromRow:e=>({id:String(e.grade_id),name:String(e.name),pence:Number(e.pence),sort:Number(e.sort??0)}),apply:(t,a)=>{if(!t.length&&!a.length)return;const s=x.useSetup.getState().sites[e]?.grades??[],i=new Map(s.map((e,t)=>[e.id,{...e,sort:t}]));for(const e of t)i.set(e.id,e);for(const e of a)i.delete(e);const n=[...i.values()].sort((e,t)=>e.sort-t.sort).map(e=>({id:e.id,name:e.name,pence:e.pence}));x.useSetup.getState().patch(e,{grades:n})},subscribe:t=>x.useSetup.subscribe((a,s)=>{a.sites[e]?.grades!==s.sites[e]?.grades&&t()})}}const Ia='staff-avatars',Oa=new Map;let Ra=!1;const Aa=e=>new Promise((t,a)=>{const s=new FileReader;s.onload=()=>t(String(s.result)),s.onerror=a,s.readAsDataURL(e)});async function Ua(){if(!Ra){Ra=!0;try{for(const[e,t]of Oa){const a=K.useAvatars.getState().photos[e];if(!t){a?.path&&K.useAvatars.setState(t=>{const a={...t.photos};return delete a[e],{photos:a}});continue}if(a?.path===t)continue;if(a&&!a.path&&e===re.getState().staffRef)continue;const{data:s,error:i}=await ne().storage.from(Ia).download(t);if(i||!s)continue;const n=await Aa(s);n.startsWith('data:image/')&&K.useAvatars.setState(a=>({photos:{...a.photos,[e]:{dataUrl:n,at:(new Date).toISOString(),path:t}}}))}}catch{}finally{Ra=!1}}}function Da(e){const t=async()=>{const t=re.getState().staffRef,a=t?Be.get(t)??re.getState().staffUuid:void 0;if(!t||!a||'staff'!==re.getState().kind)return;const s=K.useAvatars.getState().photos[t];try{const i=Oa.get(t),n=t=>{t&&t.startsWith(`${e}/${a}-`)&&ne().storage.from(Ia).remove([t]).catch(()=>{})};if(!s)return void(i&&(await Yt('set_staff_avatar',{p_staff_ref:t,p_path:null}),Oa.set(t,null),n(i)));if(s.path)return;const r=await(await fetch(s.dataUrl)).blob();if(r.size>512e3)return void oe({lastError:'Avatar: picture too large to share'});const o='image/jpeg'===r.type?'jpg':'image/webp'===r.type?'webp':'png',d=`${e}/${a}-${Date.now().toString(36)}.${o}`,{error:u}=await ne().storage.from(Ia).upload(d,r,{upsert:!1,contentType:r.type||'image/png'});if(u)throw u;await Yt('set_staff_avatar',{p_staff_ref:t,p_path:d}),Oa.set(t,d),i!==d&&n(i),K.useAvatars.setState(e=>e.photos[t]?.dataUrl===s.dataUrl?{photos:{...e.photos,[t]:{...s,path:d}}}:e)}catch(e){oe({lastError:`Avatar: ${String(e?.message??e)}`})}},a={photos:K.useAvatars.getState().photos},s=K.useAvatars.subscribe(e=>{const s=a.photos;if(a.photos=e.photos,t(),de('staff.manage'))for(const t of Object.keys(s))if(!e.photos[t]&&s[t]?.path&&t!==re.getState().staffRef){const e=s[t].path;Oa.set(t,null),Yt('set_staff_avatar',{p_staff_ref:t,p_path:null}).then(()=>ne().storage.from(Ia).remove([e])).catch(()=>{})}});return t(),s}const Ea=new Map,Ca=(0,y.create)(()=>({n:0}))},820,{"0":5,"1":6,"2":1092,"3":833,"4":1093,"5":1096,"6":1114,"7":857,"8":1025,"9":989,"10":997,"11":947,"12":811,"13":1116,"14":1117,"15":859,"16":1118,"17":957,"18":1121,"19":952,"20":863,"21":1079,"22":1165,"23":1164,"24":1166,"25":1168,"26":1078,"27":1075,"28":872,"29":806,"30":824,"31":825,"32":1027,"33":1077,"34":1028,"35":1169,"36":1170,"37":1171,"38":1172,"39":856,"40":1034,"41":956,"42":1076,"43":1005,"44":1176,"45":1177,"46":2,"47":1178,"48":1179,"49":1180,"50":1181,"51":1182,"52":923,"53":918,"54":942,"55":1081,"56":1103,"57":945,"58":1018,"59":28,"paths":{}}); +__d(function(_g,_r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"colours",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"fonts",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"font",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"radius",{enumerable:!0,get:function(){return A}}),e.brandColour=function(I,S=n.gold){const r=/^#([0-9a-f]{6})$/i.exec(I??'');if(!r)return S;const _=parseInt(r[1],16),t=(_>>16)/255,E=(_>>8&255)/255,o=(255&_)/255,F=Math.max(t,E,o),A=Math.min(t,E,o),l=F-A;if(l<.12)return I;const D=F===t?((E-o)/l+6)%6*60:F===E?60*((o-t)/l+2):60*((t-E)/l+4);return D>65&&D<320?S:I};var I=_r(_d[0]),S=_r(_d[1]),r=_r(_d[2]),_=_r(_d[3]),t=_r(_d[4]),E=_r(_d[5]);const n={bg:I.IS_SOUTERS?'#56152A':I.IS_WILDINGS?'#272A2F':'#0B0B0B',surface:I.IS_SOUTERS?'#43122F':I.IS_WILDINGS?'#30343B':'#141414',surface2:I.IS_SOUTERS?'#43122F':I.IS_WILDINGS?'#363A42':'#1D1C1A',border:I.IS_SOUTERS?'#87435B':I.IS_WILDINGS?'#50545C':'#34302A',gold:I.IS_WILDINGS?'#FFE3A5':I.IS_KIRKMICHAEL?'#B87754':I.IS_SOUTERS?'#A4622E':'#CFA45F',goldLight:I.IS_WILDINGS?'#FFF0CF':I.IS_KIRKMICHAEL?'#D8AF95':I.IS_SOUTERS?'#D9AD8A':'#E2C489',goldTint:I.IS_WILDINGS?'#39352C':I.IS_KIRKMICHAEL?'#2C211B':I.IS_SOUTERS?'#43122F':'#2A2216',goldMuted:I.IS_WILDINGS?'#DDC694':I.IS_KIRKMICHAEL?'#C2937A':I.IS_SOUTERS?'#C18F67':'#BFA06C',hairline:'rgba(255,255,255,0.09)',tile:I.IS_SOUTERS?'#43122F':I.IS_WILDINGS?'#30343B':'#18171A',tilePressed:I.IS_SOUTERS?'#64223B':I.IS_WILDINGS?'#393D45':'#211F1C',accentBg:I.IS_WILDINGS?'rgba(255,227,165,0.13)':I.IS_KIRKMICHAEL?'rgba(184,119,84,0.13)':I.IS_SOUTERS?'rgba(164,98,46,0.13)':'rgba(207,164,95,0.13)',accentBorder:I.IS_WILDINGS?'rgba(255,227,165,0.38)':I.IS_KIRKMICHAEL?'rgba(184,119,84,0.38)':I.IS_SOUTERS?'rgba(164,98,46,0.38)':'rgba(207,164,95,0.38)',text:'#F5F1E8',muted:'#B8B0A0',onGold:I.IS_WILDINGS?'#272A2F':I.IS_KIRKMICHAEL?'#0B0B0B':I.IS_SOUTERS?'#FFFFFF':'#0B0B0B',red:'#FF6B5E',redBg:'#4A1310',redSolid:'#C62F22',amber:'#FFB547',amberBg:'#3F2C05',ok:I.IS_WILDINGS?'#FFF0CF':I.IS_KIRKMICHAEL?'#D8AF95':I.IS_SOUTERS?'#D9AD8A':'#E2C489',okBg:I.IS_WILDINGS?'#39352C':I.IS_KIRKMICHAEL?'#2C211B':I.IS_SOUTERS?'#43122F':'#2A2216',blue:I.IS_WILDINGS?'#FFF0CF':I.IS_KIRKMICHAEL?'#D8AF95':I.IS_SOUTERS?'#D9AD8A':'#E2C489',blueBg:I.IS_SOUTERS?'#43122F':I.IS_WILDINGS?'#39352C':'#1E1A12',...I.IS_GREENSIDE?r.GREENSIDE_PALETTE:{},...I.IS_QUEUED_VENUE?S.QUEUED_PALETTE:{},...I.IS_KIRKTON?t.KIRKTON_PALETTE:{},...I.IS_ABBOTSFORD?_.ABBOTSFORD_PALETTE:{}},o={regular:'Poppins_400Regular',medium:'Poppins_500Medium',semibold:'Poppins_600SemiBold',bold:'Poppins_700Bold'},F={small:E.type.small,body:E.type.body,large:E.type.large,title:E.type.title,hero:E.type.hero},A={s:E.radii.s,m:E.radii.m,l:E.radii.l}},821,[5,1206,1174,1207,1208,1209]); +__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.waNumber=o,_e.waMeLink=function(e,t){const n=o(e);return n?t?`https://wa.me/${n}?text=${encodeURIComponent(t)}`:`https://wa.me/${n}`:null},Object.defineProperty(_e,"guestWhatsAppText",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"staffWhatsAppTexts",{enumerable:!0,get:function(){return p}}),_e.openWhatsApp=async function(e){try{return await n.default.openURL(e),!0}catch{return!1}};var e,t=r(_d[0]),n=(e=t)&&e.__esModule?e:{default:e};function o(e,t="44"){if(!e)return null;let n=String(e).trim().replace(/[\s().\-]/g,'');return n.startsWith('+')?n=n.slice(1):n.startsWith('00')?n=n.slice(2):n.startsWith('0')&&(n=t+n.slice(1)),n=n.replace(/^440/,'44'),/^[1-9][0-9]{6,14}$/.test(n)?n:null}const s=e=>{const[t,n,o]=e.split('-').map(Number);return new Date(t,n-1,o).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',year:'numeric'})},u=e=>{const[t,n,o]=e.split('-').map(Number);return new Date(t,n-1,o).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'})},c=e=>e.slice(0,5),l=e=>e.replace(' (example)','').trim().split(/\s+/)[0]||'there',m=(e,t)=>`Hi ${t}, it's ${e.name.trim()} about my booking${e.ref?` ${e.ref}`:''}: ${s(e.date)} at ${c(e.time)}, table for ${e.partySize}. `,p=(e,t,n)=>({confirm:`Hi ${l(e.name)}, it's ${t}${n?` in ${n}`:''}. Just confirming your table for ${e.partySize} on ${u(e.date)} at ${c(e.time)}${e.ref?` (ref ${e.ref})`:''}. Any questions, just reply here.`,change:`Hi ${l(e.name)}, it's ${t} about your booking on ${u(e.date)} at ${c(e.time)}. `})},822,[239]); +__d(function(g,_r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.templatesFor=function(t){const n={...r.DEFAULT_TEMPLATES};for(const o of Object.keys(r.DEFAULT_TEMPLATES))n[o]={...r.DEFAULT_TEMPLATES[o],...t?.[o]??{}};return n},e.composeBooking=function(t,n,o,c,u){if(n.walkIn)return[];return s(t,'booking-confirmation'===t?'booking':'booking-request'===t?'request':'declined',(0,r.bookingVars)(n,o),{phone:n.phone,email:n.email,name:n.name},{refType:'booking',refId:n.id,ref:n.ref},o,c,u)},e.composeOrder=function(t,n,o,c){return'takeaway'!==t.type?[]:s('order-confirmation','order',(0,r.orderVars)(t,n),{phone:t.phone,email:t.email,name:t.customerName},{refType:'order',refId:t.id,ref:t.ref},n,o,c)},e.deliverQueued=async function(r,n){if(!(0,t.isLive)())return;const o=(0,t.activeProvider)();for(const t of r){const r=await o.deliver(t);n(t.id,r.ok?{status:'sent'}:{status:'failed',error:r.error})}},e.statusLabel=function(t){const r='sms'===t.channel?'Text':'Email';return'preview'===t.status?`${r}: Ready (preview mode)`:'queued'===t.status?`${r}: Sending\u2026`:'sent'===t.status?`${r} sent`:`${r}: Not sent (failed)`},Object.defineProperty(e,"PREVIEW_BANNER",{enumerable:!0,get:function(){return c}});var t=_r(d[0]);Object.keys(t).forEach(function(r){'default'===r||Object.prototype.hasOwnProperty.call(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[r]}})});var r=_r(d[1]);Object.keys(r).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return r[t]}})});var n=_r(d[2]);Object.keys(n).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})});const o=()=>`msg-${Math.random().toString(36).slice(2,8)}${Date.now().toString(36).slice(-4)}`;function s(s,c,u,l,f,m,p,b){const y=[],v=(0,t.isLive)()?'queued':'preview',h=(0,t.activeProvider)().id,k=(0,n.ukPhone)(l.phone);if(k.ok&&y.push({id:o(),restaurantId:m.id,at:b,channel:'sms',kind:s,to:k.pretty,toName:l.name,body:(0,r.toGsm)((0,r.fill)(p[c].sms,u.sms)),...f,status:v,provider:h}),l.email?.trim()){const t=(0,r.fillEmailText)(p[c].body,u.email),n=(0,r.fill)(p[c].subject,u.email);y.push({id:o(),restaurantId:m.id,at:b,channel:'email',kind:s,to:l.email.trim(),toName:l.name,subject:n,body:t,html:(0,r.emailHtml)(t,{venue:m.name,preheader:n}),...f,status:v,provider:h})}return y}const c='Preview mode, not sent yet. Connect a text and email service to go live.'},823,[1104,1105,1106]); +__d(function(g,r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"BLOCK_REASONS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"useBlocks",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"venueWide",{enumerable:!0,get:function(){return f}}),_e.blockedTablesAt=m,Object.defineProperty(_e,"blocksOn",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"areaBlocksOn",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"tableKey",{enumerable:!0,get:function(){return p}}),_e.closedAreasAt=function(e,t,o,n){const s=(0,l.toMins)(n),a=v(e,t,o).filter(e=>s>=(0,l.toMins)(e.from)&&s<(0,l.toMins)(e.to)).map(e=>e.areaId);return new Set([...a,...[...m(e,t,o,n)].map(p)])},_e.blockAt=M,_e.currentBlocks=function(e,t,o,n){return e.filter(e=>e.rid===t&&!e.removedAt&&(e.date>o||e.date===o&&(0,l.toMins)(e.to)>(0,l.toMins)(n))).sort((e,t)=>e.date===t.date?(0,l.toMins)(e.from)-(0,l.toMins)(t.from):e.date({blocks:[],removed:[],add:t=>{const o={...t,id:(0,s.uuid)(),createdAt:(new Date).toISOString(),source:'covercharge'};return e(e=>({blocks:[...e.blocks,o]})),o},addMany:t=>{const o=(new Date).toISOString(),n=t.map(e=>({...e,id:(0,s.uuid)(),createdAt:o,source:'covercharge'}));return e(e=>({blocks:[...e.blocks,...n]})),n},update:(t,o,n)=>e(e=>({blocks:e.blocks.map(e=>e.id===t?{...e,...o,id:t,editedAt:(new Date).toISOString(),editedBy:n}:e)})),remove:(t,o)=>e(e=>{const n=e.blocks.find(e=>e.id===t);return n?{blocks:e.blocks.filter(e=>e.id!==t),removed:[...e.removed,{...n,removedAt:(new Date).toISOString(),removedBy:o??n.by}]}:e}),put:t=>e(e=>{const o=e.blocks.filter(e=>e.id!==t.id),n=e.removed.filter(e=>e.id!==t.id);return t.removedAt?{blocks:o,removed:[...n,t]}:{blocks:[...o,t],removed:n}})}),{name:'covercharge-blocks-v1',storage:(0,c.createJSONStorage)(()=>n.default),version:2,migrate:e=>{const t=e??{};return{blocks:t.blocks??[],removed:t.removed??[]}}})),f=e=>!e.areaId&&!e.tables?.length;function m(e,t,o,n){const s=(0,l.toMins)(n);return new Set(e.filter(e=>e.rid===t&&e.date===o&&!e.removedAt&&e.tables?.length&&s>=(0,l.toMins)(e.from)&&s<(0,l.toMins)(e.to)).flatMap(e=>e.tables))}const k=(e,t,o)=>e.filter(e=>e.rid===t&&e.date===o&&!e.removedAt&&f(e)).sort((e,t)=>(0,l.toMins)(e.from)-(0,l.toMins)(t.from)),v=(e,t,o)=>e.filter(e=>e.rid===t&&e.date===o&&!e.removedAt&&!!e.areaId).sort((e,t)=>(0,l.toMins)(e.from)-(0,l.toMins)(t.from)),p=e=>`tbl:${e}`;function M(e,t,o,n){const s=(0,l.toMins)(n);return k(e,t,o).find(e=>s>=(0,l.toMins)(e.from)&&s<(0,l.toMins)(e.to))}const O=(e,t,o,n)=>M(e,t,o,n),y=e=>e.tables?.length?`${e.tables.map(t.tableNumbers).join(', ')} blocked until ${e.to}${e.reason?` \xb7 ${e.reason}`:''}`:e.areaId?`${e.areaName??'Area'} closed until ${e.to}${e.reason?` \xb7 ${e.reason}`:''}`:`Bookings paused until ${e.to}${e.reason?` \xb7 ${e.reason}`:''}`,A=(e,t)=>{const o=b(e=>e.blocks);return k(o,e,t)}},824,[808,1082,1034,952,1091,818]); +__d(function(g,r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEFAULT_SETTINGS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"seedPlan",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"useFloor",{enumerable:!0,get:function(){return p}}),_e.hashOldPins=f,Object.defineProperty(_e,"usePlan",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"useDisplaySettings",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"planOf",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"tablesOf",{enumerable:!0,get:function(){return j}}),_e.tablesLabel=function(e){const n=j((0,t.tableNumbers)(e));if(!n.length)return'';if(1===n.length)return n[0];const a=n.map(e=>/^\d+$/.test(e)?Number(e):NaN),s=a.every(e=>!Number.isNaN(e))?[...n].sort((e,n)=>Number(e)-Number(n)):n;return a.every(e=>!Number.isNaN(e))&&s.length>=3&&s.every((e,n)=>0===n||Number(e)===Number(s[n-1])+1)?`${s[0]}\u2013${s[s.length-1]}`:s.join(' + ')},Object.defineProperty(_e,"joinTables",{enumerable:!0,get:function(){return v}});var e,n=r(d[0]),t=r(d[1]),a=r(d[2]),s=(e=a)&&e.__esModule?e:{default:e},i=r(d[3]),l=r(d[4]),o=r(d[5]),c=r(d[6]);Object.keys(c).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return c[e]}})});const u={privacy:!0,idleMins:2,pinOn:!1,...i.DEFAULT_WAKE,tonightCards:!0},b=e=>'souters'===e||n.IS_ISOLATED_VENUE&&'souters'===n.VENUE_RID?{areas:[{id:'su-restaurant',name:'Restaurant'},{id:'su-bar',name:'Bar'},{id:'su-mezzanine',name:'Mezzanine / private dining'},{id:'su-garden',name:'Beer garden',outdoor:!0},{id:'su-icecream',name:'Ice cream & cake corner'}],tables:[],joins:[],sections:[],fixtures:[]}:'kirkmichael'===e||n.IS_ISOLATED_VENUE&&'kirkmichael'===n.VENUE_RID?{areas:[{id:'km-restaurant',name:'Restaurant'},{id:'km-bar',name:'Bar'},{id:'km-private',name:'Private dining',label:'The Room (about 18 covers) \u2014 table plan to confirm'}],tables:[],joins:[],sections:[],fixtures:[]}:['wildings','greenside'].includes(e)||n.IS_ISOLATED_VENUE?{areas:[],tables:[],joins:[],sections:[],fixtures:[]}:'anchorage'===e?(0,c.anchoragePlan)():(0,c.starterPlan)(),p=(0,l.create)()((0,o.persist)((e,t)=>{const a=e=>t().plans[e]??b(e);return{plans:n.IS_ISOLATED_VENUE?{[n.VENUE_RID]:b(n.VENUE_RID)}:{anchorage:(0,c.anchoragePlan)()},live:{},settings:{},smsLog:[],setPlan:(n,t)=>e(e=>({plans:{...e.plans,[n]:t}})),updateTable:(n,t,s)=>{const i=a(n);e(e=>({plans:{...e.plans,[n]:{...i,tables:i.tables.map(e=>e.id===t?{...e,...s}:e)}}}))},addTable:(n,t)=>{const s=a(n);e(e=>({plans:{...e.plans,[n]:{...s,tables:[...s.tables,t]}}}))},removeTable:(n,t)=>{const s=a(n),i=s.tables.find(e=>e.id===t);e(e=>({plans:{...e.plans,[n]:{...s,tables:s.tables.filter(e=>e.id!==t),joins:s.joins.filter(e=>!i||!e.tables.includes(i.name))}}}))},setLive:(n,t,a)=>e(e=>({live:{...e.live,[n]:{...e.live[n]??{},[t]:{...e.live[n]?.[t]??{},...a}}}})),setSettings:(n,t)=>e(e=>({settings:{...e.settings,[n]:{...u,...e.settings[n]??{},...t}}})),logSms:(n,t,a)=>e(e=>{return{smsLog:[{id:(s='sms',`${s}-${Date.now().toString(36)}${Math.random().toString(36).slice(2,6)}`),rid:n,at:t,text:a},...e.smsLog].slice(0,50)};var s}),resetPlan:n=>e(e=>({plans:{...e.plans,[n]:b(n)}}))}},{name:'covercharge-floor-v1',version:6,storage:(0,o.createJSONStorage)(()=>s.default),migrate:(e,n)=>{const t=e??{};let a=t;if(n<2){const e={};for(const[n,a]of Object.entries(t.plans??{}))e[n]='anchorage'===n?(0,c.anchoragePlan)():(0,c.normalisePlan)(a);e.anchorage=(0,c.anchoragePlan)(),a={...t,plans:e,live:{}}}else if(n<3)a={...t,plans:{...t.plans??{},anchorage:(0,c.anchoragePlan)()}};else if(n<4){const e=t.plans?.anchorage;e&&(a={...t,plans:{...t.plans,anchorage:{...e,joins:(e.joins??[]).filter(e=>!(2===e.tables.length&&e.tables.includes('1')&&e.tables.includes('2')))}}})}return n<5&&(a={...a,settings:f(a.settings)}),n<6&&a.plans?.anchorage&&(a={...a,plans:{...a.plans,anchorage:(0,c.withSeedBest)('anchorage',a.plans.anchorage)}}),a}}));function f(e){const n={};for(const[t,a]of Object.entries(e??{})){const{pin:e,...s}=a??{};n[t]={...u,...s,...'pinHash'in s?{}:(0,i.fromOldPin)(e)}}return n}const h=e=>p(n=>n.plans[e])??E(e),N={};function E(e){return N[e]??=b(e)}const O=e=>{const n=p(n=>n.settings[e]);return n?{...u,...n}:u},P=e=>p.getState().plans[e]??E(e),j=e=>e?e.split('+').map(e=>e.trim()).filter(Boolean):[];const v=e=>[...new Set(e)].sort((e,n)=>/^\d+$/.test(e)&&/^\d+$/.test(n)?Number(e)-Number(n):e.localeCompare(n)).join('+')},825,[5,808,1082,946,952,1091,945]); +__d(function(_g,r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"STATUS",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"STAGE_LABEL",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"STAGES",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"turnFor",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"startOf",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"durOf",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"endOf",{enumerable:!0,get:function(){return f}}),e.clashes=function(a,s=90){const n=new Set,l=a.filter(t=>g(t)&&t.table);for(let a=0;a(0,t.tablesOf)(d.table).includes(a))&&(u(o)t.date===n&&!['cancelled','noshow'].includes(t.status)).sort((t,a)=>t.time.localeCompare(a.time));for(const s of a.tables){const a=i.filter(a=>(0,t.tablesOf)(a.table).includes(s.name)),n=a[0],o=(0,t.tablesOf)(n?.table);l[s.name]={table:s,status:n?'soon':'free',next:n,covers:n?.partySize??0,dayBookings:a.length?a:void 0,group:o.length>1?o:void 0,allergy:!(!n?.allergies?.length&&!n?.allergyNote),vip:n?.tags?.find(t=>'VIP'===t)??n?.tags?.find(t=>'Regular'===t),occasion:n?.occasion??h(n?.notes)}}return l},e.floorView=function(a,n,l,i,o,d=90,c){const b={},g=n.filter(t=>t.date===O(o));for(const n of a.tables){const a=i[n.name]??{},y=g.filter(a=>(0,t.tablesOf)(a.table).includes(n.name)),O=y.find(t=>'seated'===(0,s.shownStatus)(t)),v=y.filter(t=>'confirmed'===t.status).sort((t,a)=>t.time.localeCompare(a.time)).find(t=>S(o,t)>=-20),T=v?Math.round(S(o,v)):void 0,w=O?void 0:p(y,o,d),F=l.find(t=>'table'===t.type&&t.tableNo===n.name&&!['closed','cancelled','collected'].includes(t.status));let j='free';a.blocked?j='blocked':O?j=a.stage??'seated':!c?.has(n.areaId)&&!c?.has(`tbl:${n.name}`)||F?a.dirty?j='dirty':F?j=a.stage??'seated':v&&void 0!==T&&T<=45&&(j='soon'):j='blocked';const A=O,P=A?.tags?.find(t=>'VIP'===t)??A?.tags?.find(t=>'Regular'===t)??(A?void 0:v?.tags?.[0]);b[n.name]={table:n,status:j,booking:A,next:v,due:w,nextIn:T,covers:A?.partySize??0,group:(()=>{const a=(0,t.tablesOf)((A??('soon'===j?v:void 0))?.table);return a.length>1?a:void 0})(),orderOnly:!A&&!!F,note:a.note,seatedMins:A?Math.max(0,Math.round((o.getTime()-u(A).getTime())/6e4)):void 0,freeAt:A?f(A,d):void 0,allergy:!!(A?.allergies?.length||A?.allergyNote||!A&&(v?.allergies?.length||v?.allergyNote)||F?.allergies?.length),vip:P,occasion:A?.occasion??(A?void 0:v?.occasion??h(v?.notes))??h(A?.notes)}}return b},e.dueOnTable=p,Object.defineProperty(e,"OCCASION_ICON",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"tableAllowed",{enumerable:!0,get:function(){return v}}),e.suggestTable=function(s,n,l,i,o,d,c=90,b,p){const h=[...s.tables.map(t=>({name:t.name,seats:t.maxSeats,min:t.minSeats,parts:[t.name]})),...s.joins.map(t=>{const a=s.tables.filter(a=>t.tables.includes(a.name));return{name:t.tables.join('+'),seats:a.reduce((t,a)=>t+a.maxSeats,0),min:a.reduce((t,a)=>t+a.minSeats,0),parts:t.tables}})].filter(t=>t.parts.every(t=>v(s,t,p))),y=o.getTime()+6e4*d,S=new Set((0,a.bestTables)(s));let O=null;for(const a of h){if(a.seats['blocked'].includes(l[t]?.status)))continue;const s=!!l&&a.parts.some(t=>['seated','mains','dessert','bill','dirty'].includes(l[t]?.status)),d=n.filter(s=>s.id!==b&&g(s)&&(0,t.tablesOf)(s.table).some(t=>a.parts.includes(t))&&u(s).getTime()o.getTime()).length,p=1===a.parts.length&&S.has(a.parts[0])?12:0,h=(s?1e3:0)+100*d+10*(a.seats-i)+(i({name:t.name,seats:t.maxSeats,parts:[t.name]})),...s.joins.map(t=>({name:t.tables.join('+'),seats:s.tables.filter(a=>t.tables.includes(a.name)).reduce((t,a)=>t+a.maxSeats,0),parts:t.tables}))].filter(t=>t.seats>=l&&t.parts.every(t=>v(s,t,c))).filter(a=>!n.some(s=>s.id!==b&&g(s)&&(0,t.tablesOf)(s.table).some(t=>a.parts.includes(t))&&u(s).getTime()i.getTime())),y=new Set((0,a.bestTables)(s)),S=t=>1===t.parts.length&&y.has(t.parts[0])?0:1;return h.sort((t,a)=>t.seats-a.seats||t.parts.length-a.parts.length||S(t)-S(a)).map(t=>({table:t.name,seats:t.seats,area:s.areas.find(a=>a.id===s.tables.find(a=>a.name===t.parts[0])?.areaId)?.name??''}))};var t=r(_d[0]),a=r(_d[1]),s=r(_d[2]);const n={colour:'#3A2F1E',fg:'#F1DDB0'},l={colour:'#CFA45F',fg:'#0B0B0B'},i={free:{label:'Free',...n},soon:{label:'Free',...n},seated:{label:'Seated',...l},mains:{label:'Seated',...l},dessert:{label:'Seated',...l},bill:{label:'Seated',...l},dirty:{label:'Needs clearing',colour:'#6E6555',fg:'#FFFFFF'},blocked:{label:'Blocked',...n}},o={seated:'Seated',mains:'Mains',dessert:'Dessert',bill:'Bill requested'},d=['seated','mains','dessert','bill'],c=(t,a=90)=>Math.min(a+60,a+15*Math.max(0,Math.ceil((t-2)/2))),u=t=>'seated'===(0,s.shownStatus)(t)&&t.seatedAt?new Date(t.seatedAt):new Date(`${t.date}T${t.time}:00`),b=(t,a=90)=>t.durationMins??c(t.partySize,a),f=(t,a=90)=>new Date(u(t).getTime()+6e4*b(t,a)),g=t=>!['cancelled','noshow','finished'].includes(t.status);function p(t,a,s=90){return t.filter(t=>'confirmed'===t.status&&S(a,t)<=45&&-S(a,t)t.time.localeCompare(a.time))[0]}const h=t=>t?/birthday/i.test(t)?'birthday':/anniversary/i.test(t)?'anniversary':void 0:void 0,y={birthday:'\ud83c\udf82',anniversary:'\ud83d\udc9d',celebration:'\ud83e\udd42'},S=(t,a)=>(new Date(`${a.date}T${a.time}:00`).getTime()-t.getTime())/6e4,O=t=>`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`,v=(t,a,s)=>{const n=t.tables.find(t=>t.name===a);if(!n)return!1;const l=t.areas.find(t=>t.id===n.areaId);return!(s?.dog&&!(void 0!==n.dogOk?n.dogOk:l?.dogs))&&(!s?.closed?.has(n.areaId)&&!s?.closed?.has(`tbl:${n.name}`))}},826,[825,945,828]); +__d(function(g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"emptyNeeds",{enumerable:!0,get:function(){return w}}),_e.needsMissing=function(e,l=[]){const s=[];null===e.allergy?s.push('Answer the allergy question first'):'yes'!==e.allergy||e.allergens.length||l.length||e.allergyNote.trim()||s.push('Pick the allergens or describe them');null===e.dog&&s.push('Say whether a dog is coming');return s},_e.needsPatch=function(e,l=[]){const s='yes'===e.allergy?e.allergens.filter(e=>!l.some(l=>l.allergen===e)).map(l=>({allergen:l,severity:e.severity})):[],t=Object.entries(e.holds).filter(([,e])=>e>0).map(([e,l])=>({kind:e.startsWith('item:')?'item':'stock',id:e.slice(5),qty:l})),a=e.dog?Math.max(1,e.dogs):0,n={...e.wheelchair?{wheelchair:e.wheelchair}:{},...e.stepFree?{stepFree:!0}:{},...e.toilet?{toilet:!0}:{},...e.assistDog?{assistDog:!0}:{},...e.accessNote.trim()?{note:e.accessNote.trim()}:{}},r={...e.vegan?{vegan:e.vegan}:{},...e.vegetarian?{vegetarian:e.vegetarian}:{}};return{allergies:[...l,...s],allergyNone:'none'===e.allergy&&!l.length||void 0,allergyPeople:'yes'===e.allergy?e.allergyPeople:void 0,allergyNote:'yes'===e.allergy&&e.allergyNote.trim()?e.allergyNote.trim():void 0,dog:a>0,dogs:a||void 0,access:Object.keys(n).length?n:void 0,diet:Object.keys(r).length?r:void 0,holds:t.length?t:void 0,tableReq:e.tableReq.length?e.tableReq:void 0}},_e.FirstQuestions=function({rid:e,value:l,onChange:a,party:r,audience:i,profile:o=[]}){const p=e=>a({...l,...e}),b=(0,y.usePlan)(e),[x,j]=(0,t.useState)(!1),k=(0,s.dogQuestionOn)((0,u.useRestaurant)(e));(0,t.useEffect)(()=>{k||null!==l.dog||a({...l,dog:!1})},[k,l.dog]);const w=x?m.ALLERGENS:m.ALLERGENS.filter(e=>['gluten','milk','peanuts','treenuts','crustaceans','molluscs','fish','eggs','sesame'].includes(e.id)||l.allergens.includes(e.id)),M=[...o.map(e=>e.allergen),...l.allergens],q=(0,f.dogSetUp)(b);return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)(R,{tone:"red",testID:"q-allergens",children:[(0,v.jsx)(C,{sub:'guest'===i?'We ask everyone first, so the kitchen can keep you safe.':'Ask every guest first. It goes to the kitchen in red.',children:"\u26a0\ufe0f Does anyone in the party have a food allergy?"}),o.length?(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:o.map(e=>(0,v.jsx)(h.Badge,{kind:"red",label:`${m.ALLERGENS.find(l=>l.id===e.allergen)?.short} (from your profile)`},e.allergen))}):null,(0,v.jsxs)(h.Row,{gap:8,children:[(0,v.jsx)(n.default,{style:{flex:1},children:(0,v.jsx)(h.Chip,{label:"No allergies",selected:'none'===l.allergy,onPress:()=>p({allergy:'none',allergens:[]})})}),(0,v.jsx)(n.default,{style:{flex:1},children:(0,v.jsx)(h.Chip,{label:"Yes, allergies",selected:'yes'===l.allergy,onPress:()=>p({allergy:'yes'})})})]}),'none'===l.allergy&&o.length?(0,v.jsx)(h.Muted,{children:"Your profile allergies above are still shared with the kitchen."}):null,'yes'===l.allergy?(0,v.jsxs)(n.default,{style:{gap:10},testID:"allergen-picker",children:[(0,v.jsx)(h.T,{size:14,weight:"semibold",children:"Which allergens? (the 14 UK allergens)"}),(0,v.jsxs)(h.Row,{wrap:!0,gap:6,children:[w.map(e=>(0,v.jsx)(h.Chip,{label:e.short,selected:l.allergens.includes(e.id)||o.some(l=>l.allergen===e.id),disabled:o.some(l=>l.allergen===e.id),onPress:()=>p({allergens:l.allergens.includes(e.id)?l.allergens.filter(l=>l!==e.id):[...l.allergens,e.id]})},e.id)),x?null:(0,v.jsx)(h.Chip,{label:"All 14\u2026",onPress:()=>j(!0)})]}),(0,v.jsx)(h.T,{size:14,weight:"semibold",children:"How serious?"}),(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:m.SEVERITIES.map(e=>(0,v.jsx)(h.Chip,{label:e.label,selected:l.severity===e.id,onPress:()=>p({severity:e.id})},e.id))}),(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.T,{size:14,children:"How many people with allergies?"}),(0,v.jsx)(h.Stepper,{value:Math.min(l.allergyPeople,r),onChange:e=>p({allergyPeople:e}),min:1,max:Math.max(1,r),label:"people with allergies"})]}),(0,v.jsx)(h.Field,{label:"Anything else the kitchen should know? (optional)",value:l.allergyNote,onChangeText:e=>p({allergyNote:e}),placeholder:"e.g. traces of sesame, one child with coeliac disease",testID:"allergy-note"}),M.length?(0,v.jsx)(c.MenuAllergyCheck,{rid:e,allergens:M,audience:i}):null]}):null]}),k?(0,v.jsxs)(R,{tone:"gold",testID:"q-dogs",children:[(0,v.jsx)(C,{sub:q?'Well-behaved dogs are welcome at our dog-friendly tables.':'staff'===i?'Dog-friendly tables aren\u2019t marked yet (Managers \u203a Booking options), so any table is offered for now.':void 0,children:"\ud83d\udc15 Are you bringing a dog?"}),(0,v.jsxs)(h.Row,{gap:8,children:[(0,v.jsx)(n.default,{style:{flex:1},children:(0,v.jsx)(h.Chip,{label:"No",selected:!1===l.dog,onPress:()=>p({dog:!1})})}),(0,v.jsx)(n.default,{style:{flex:1},children:(0,v.jsx)(h.Chip,{label:"Yes",selected:!0===l.dog,onPress:()=>p({dog:!0,dogs:Math.max(1,l.dogs)})})})]}),l.dog?(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.T,{size:14,children:"How many dogs?"}),(0,v.jsx)(h.Stepper,{value:l.dogs,onChange:e=>p({dogs:e}),min:1,max:4,label:"dogs"})]}):null]}):null]})},_e.useReserveAvailability=M,_e.MoreQuestions=function({rid:e,r:l,value:a,onChange:r,party:i,date:o,time:c,today:p,bookings:m,audience:b,showTables:x}){const j=e=>r({...a,...e}),w=l.settings,S=(0,u.useMenu)(e),P=(0,t.useMemo)(()=>S.filter(e=>/\((V|VG|Ve)\)|vegan|vegetarian/i.test(`${e.name} ${e.tags?.join(' ')??''}`)).slice(0,4),[S.length]),N=M(e,l,o,p,m,b),T=e=>a.holds[e]??0,$=(0,f.stockNeed)({holds:Object.entries(a.holds).map(([e,l])=>({kind:e.startsWith('item:')?'item':'stock',id:e.slice(5),qty:l}))},N.items),D=(e,l)=>Math.min(10,...e.map(e=>{const s=($[e.key]??0)-T(l)*e.qty;return Math.floor(((N.free[e.key]??0)-s)/e.qty)})),A=(e,l,s,t)=>{const r=T(e),i=t<=0&&0===r;return(0,v.jsxs)(n.default,{style:{flexDirection:'row',alignItems:'center',gap:10,opacity:i?.55:1},testID:`reserve-${e.replace(':','-')}`,children:[(0,v.jsxs)(n.default,{style:{flex:1,minWidth:0},children:[(0,v.jsx)(h.T,{weight:"semibold",children:l}),(0,v.jsx)(h.Muted,{children:i?'Unavailable \u2014 none left for this day':s})]}),i?(0,v.jsx)(h.Badge,{kind:"neutral",label:"Unavailable"}):(0,v.jsx)(h.Stepper,{value:r,onChange:l=>j({holds:{...a.holds,[e]:Math.max(0,Math.min(l,Math.max(r,t)))}}),min:0,max:Math.max(r,Math.min(10,t)),label:l})]},e)},I=N.items.length>0||!1!==w.reserveStock&&N.stock.length>0,O=(0,y.usePlan)(e);return(0,v.jsxs)(v.Fragment,{children:[(0,s.accessQuestionOn)(l)?(0,v.jsxs)(R,{tone:"plain",testID:"q-access",children:[(0,v.jsx)(C,{sub:"Optional. Tell us and we\u2019ll have the right table ready.",children:"\u267f Access needs"}),(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.T,{size:14,children:"Wheelchair users"}),(0,v.jsx)(h.Stepper,{value:a.wheelchair,onChange:e=>j({wheelchair:e}),min:0,max:Math.max(1,i),label:"wheelchair users"})]}),(0,v.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,v.jsx)(h.Chip,{label:"Step-free access",selected:a.stepFree,onPress:()=>j({stepFree:!a.stepFree})}),(0,v.jsx)(h.Chip,{label:"Accessible toilet",selected:a.toilet,onPress:()=>j({toilet:!a.toilet})}),(0,v.jsx)(h.Chip,{label:"Assistance dog",selected:a.assistDog,onPress:()=>j({assistDog:!a.assistDog})})]}),(0,v.jsx)(h.Field,{label:"Anything else? (optional)",value:a.accessNote,onChangeText:e=>j({accessNote:e}),placeholder:"e.g. needs a chair with arms"}),w.accessStatement?.trim()?(0,v.jsx)(h.Muted,{children:w.accessStatement.trim()}):null]}):null,(0,s.dietQuestionOn)(l)?(0,v.jsxs)(R,{tone:"plain",testID:"q-veg",children:[(0,v.jsx)(C,{sub:"We\u2019d love to look after you. Optional.",children:"\u24cb Any vegans or vegetarians?"}),(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.T,{size:14,children:"Vegan"}),(0,v.jsx)(h.Stepper,{value:a.vegan,onChange:e=>j({vegan:e}),min:0,max:Math.max(1,i),label:"vegans"})]}),(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.T,{size:14,children:"Vegetarian"}),(0,v.jsx)(h.Stepper,{value:a.vegetarian,onChange:e=>j({vegetarian:e}),min:0,max:Math.max(1,i),label:"vegetarians"})]}),!1!==w.vegTeaser&&P.length&&(a.vegan||a.vegetarian)?(0,v.jsxs)(h.Muted,{children:["On the menu: ",P.map(e=>e.name).join(' \xb7 ')]}):null]}):null,I?(0,v.jsxs)(R,{tone:"gold",testID:"q-reserve",children:[(0,v.jsx)(C,{sub:N.known?'Held for you from today\u2019s count.':o>p||'guest'===b?'Held for you; the kitchen confirms and orders in.':void 0,children:"\ud83e\udd9e Reserve with your table"}),N.items.map(e=>A(`item:${e.id}`,`${e.name}${k(e.price)}`,e.description||e.uses.map(e=>`${e.qty} ${N.stock.find(l=>l.key===e.key)?.name.toLowerCase()??e.key}`).join(' + '),D(e.uses,`item:${e.id}`))),!1!==w.reserveStock?N.stock.map(e=>A(`stock:${e.key}`,`Reserve ${e.name.toLowerCase()}`,N.known?`${N.free[e.key]} available today`:'Held for the kitchen to order',D([{key:e.key,qty:1}],`stock:${e.key}`))):null,'staff'===b&&N.known?(0,v.jsxs)(h.Muted,{children:["Today: ",N.stock.map(e=>`${N.free[e.key]} ${e.plural.toLowerCase()} free (${N.reserved[e.key]??0} reserved)`).join(' \xb7 ')]}):null]}):null,x&&!1!==w.tableRequests&&O.tables.length?(0,v.jsx)(q,{rid:e,value:a,onChange:r,party:i,hide:w.tableRequestHide??[]}):null]})},_e.dogTimeOk=function(e,l,s,t,a){if(!a)return!0;const n=e.settings.maxDogsPerSlot;return!n||(0,f.dogsAt)(l,s,t)+a<=n},Object.defineProperty(_e,"accessibleSetUp",{enumerable:!0,get:function(){return f.accessibleSetUp}});var e,l=_r(d[0]),s=_r(d[1]),t=_r(d[2]),a=_r(d[3]),n=(e=a)&&e.__esModule?e:{default:e},r=_r(d[4]),i=_r(d[5]),o=_r(d[6]),c=_r(d[7]),h=_r(d[8]),u=_r(d[9]),y=_r(d[10]),p=_r(d[11]),m=_r(d[12]),b=_r(d[13]),x=_r(d[14]),f=_r(d[15]),j=_r(d[16]),v=_r(d[17]);const k=e=>'display'===x.APP_VARIANT?'':` \xb7 ${(0,b.gbp)(e)}`,w=()=>({allergy:null,allergens:[],severity:'allergy',allergyPeople:1,allergyNote:'',dog:null,dogs:1,wheelchair:0,stepFree:!1,toilet:!1,assistDog:!1,accessNote:'',vegan:0,vegetarian:0,holds:{},tableReq:[]});const R=({children:e,tone:l,testID:s})=>(0,v.jsx)(n.default,{testID:s,style:{gap:10,padding:16,borderRadius:16,borderWidth:'plain'===l?1:1.5,borderColor:'red'===l?j.colours.red:'gold'===l?j.colours.accentBorder:j.colours.hairline,backgroundColor:'red'===l?'#1E1110':j.colours.surface},children:e}),C=({children:e,sub:l})=>(0,v.jsxs)(n.default,{style:{gap:2},children:[(0,v.jsx)(h.T,{weight:"semibold",size:17,children:e}),l?(0,v.jsx)(h.Muted,{children:l}):null]});function M(e,l,s,t,a,n,i){const o=(0,f.reservablesOf)(l),c=(0,p.useStockItems)(e),h=(0,p.useShellStore)((0,r.useShallow)(l=>(0,p.venueCounts)(l,e))),u=(0,p.useShellStore)(l=>!!l.server[e]),y=(0,f.reservedOn)(a,s,o,i),m=s===t&&('staff'===n||u),b={};for(const e of c)b[e.key]=m?Math.max(0,Math.floor((h[e.key]??0)-(y[e.key]??0))):1/0;return{items:o,stock:c,free:b,reserved:y,known:m}}function q({rid:e,value:s,onChange:a,party:r,hide:c}){const u=(0,y.usePlan)(e),p=u.areas.filter(e=>u.tables.some(l=>l.areaId===e.id&&!c.includes(l.name))),[m,b]=(0,t.useState)(p[0]?.id??''),x=s.dog?s.dogs:0,k=e=>c.includes(e)?'Not bookable':(0,f.tableBlockReason)(u,e,r,x,s.wheelchair>0||s.stepFree),w=Object.fromEntries(u.tables.map(e=>[e.name,{table:e,status:k(e.name)?'blocked':'free',covers:0,allergy:!1}])),M=e=>{if(k(e))return;const l=s.tableReq.includes(e)?s.tableReq.filter(l=>l!==e):[...s.tableReq,e].slice(-2);a({...s,tableReq:l})},q=u.tables.filter(e=>e.areaId===m&&!c.includes(e.name));return(0,v.jsxs)(R,{tone:"plain",testID:"q-table",children:[(0,v.jsx)(C,{sub:"Table requests aren\u2019t guaranteed, but we\u2019ll do our best.",children:"\ud83e\ude91 Request a table (optional)"}),p.length>1?(0,v.jsx)(i.AreaTabs,{plan:u,area:m,onPick:b}):null,(0,v.jsx)(n.default,{style:{borderRadius:12,overflow:'hidden',borderWidth:1,borderColor:j.colours.hairline},children:(0,v.jsx)(o.FloorCanvas,{plan:u,areaId:m,mode:"live",view:w,privacy:!0,fit:"contain",crop:!0,maxH:260,highlight:s.tableReq,onTap:e=>M(e.name)})}),(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:q.map(e=>{const t=k(e.name),a=s.tableReq.indexOf(e.name);return(0,v.jsx)(h.Chip,{label:`${(0,l.tableNumbers)(e.name)}`,sub:t||(0===a?'1st choice':1===a?'2nd choice':`${e.maxSeats} seats`),selected:a>=0,disabled:!!t,onPress:()=>M(e.name)},e.name)})}),s.tableReq.length?(0,v.jsxs)(h.T,{size:14,colour:j.colours.goldLight,children:["Requested: ",s.tableReq.map((e,s)=>`${(0,l.tableNumbers)(e)}${s?' (2nd choice)':''}`).join(', ')]}):(0,v.jsx)(h.Muted,{children:"Tap a table; tap another for a second choice."})]})}},827,[808,809,30,127,873,929,928,1277,813,819,825,1027,814,816,806,828,821,24]); +__d(function(g,_r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ACTIVE",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"ANCHORAGE_RESERVABLES",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"reservablesOf",{enumerable:!0,get:function(){return i}}),e.stockNeed=s,e.reservedOn=a,e.usedOn=function(t,r,n){const o={};for(const i of t)if(i.date===r)for(const t of i.holds??[])if(t.served)for(const[r,a]of Object.entries(s({...i,holds:[{...t,served:void 0}]},n)))o[r]=(o[r]??0)+a;return o},e.heldSummary=function(t,r,o){const i={},s={};for(const o of t)if(o.date===r&&n(o))for(const t of o.holds??[])t.served||('item'===t.kind?i[t.id]=(i[t.id]??0)+t.qty:s[t.id]=(s[t.id]??0)+t.qty);return{platters:Object.values(i).reduce((t,r)=>t+r,0),byItem:i,single:s,stock:a(t,r,o)}},e.holdsText=function(t,r,n){return(t.holds??[]).filter(t=>t.qty>0).map(t=>`${'item'===t.kind?c(r.find(r=>r.id===t.id)?.name??'Reserved item'):n.find(r=>r.key===t.id)?.name??t.id} x${t.qty}${t.served?' (served)':''}`).join(', ')},Object.defineProperty(e,"shortItem",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"needsAllergenSeen",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"needsHoldOk",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"hasAllergens",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"allergenText",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"dogCount",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"hasAccess",{enumerable:!0,get:function(){return y}}),e.accessText=function(t){const r=t.access;return r?[r.wheelchair?`${r.wheelchair} wheelchair user${1===r.wheelchair?'':'s'}`:'',r.stepFree?'step-free access':'',r.toilet?'accessible toilet':'',r.assistDog?'assistance dog':'',r.note?.trim()??''].filter(Boolean).join(', '):''},Object.defineProperty(e,"dietText",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"accessibleSetUp",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"dogSetUp",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"isAccessible",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"isDogOk",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"dogsAt",{enumerable:!0,get:function(){return P}}),e.tableBlockReason=function(t,n,o,i,s){const a=t.tables.find(t=>t.name===n);return a?a.maxSeats0&&O(t)&&!(0,r.tableDogOk)(t,a)?'No dogs here':s&&h(t)&&!a.accessible?'Not step-free':'':'Not available'},Object.defineProperty(e,"holidayName",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"coverDone",{enumerable:!0,get:function(){return A}}),e.shownStatus=S,e.coversToday=function(t,r){const o=t.filter(t=>t.date===r&&n(t)),i=o.filter(A),s=o.filter(t=>!A(t)&&['confirmed','pending','seated'].includes(S(t))),a=t=>t.reduce((t,r)=>t+r.partySize,0);return{done:a(i),toCome:a(s),total:a(i)+a(s)}};var t=_r(_d[0]),r=_r(_d[1]);const n=t=>!['cancelled','noshow'].includes(t.status),o=[{id:'seafood-platter-2',name:'Seafood Platter for 2',price:16e3,description:'Whole crab and lobster with all the trimmings, for two to share.',uses:[{key:'crab',qty:1},{key:'lobster',qty:1}],active:!0}],i=t=>(t?.settings.reservables??('anchorage'===t?.id?o:[])).filter(t=>t.active);function s(t,r,n=!1){const o={};for(const i of t.holds??[])if(!i.served||n)if('stock'===i.kind)o[i.id]=(o[i.id]??0)+i.qty;else for(const t of r.find(t=>t.id===i.id)?.uses??[])o[t.key]=(o[t.key]??0)+t.qty*i.qty;return o}function a(t,r,o,i){const a={};for(const c of t)if(c.date===r&&n(c)&&'finished'!==c.status&&c.id!==i)for(const[t,r]of Object.entries(s(c,o)))a[t]=(a[t]??0)+r;return a}const c=t=>/platter/i.test(t)?'Platter':t.replace(/ for \d+$/i,''),l=t=>n(t)&&(t.allergies.length>0||!!t.allergyNote?.trim())&&!t.allergyAck,d=t=>n(t)&&(t.holds??[]).some(t=>t.qty>0&&!t.served)&&!t.holdOk,f=t=>t.allergies.length>0||!!t.allergyNote?.trim(),u=r=>[r.allergies.map(r=>(0,t.allergenLabel)(r.allergen)).join(', '),r.allergyNote?.trim()].filter(Boolean).join(' \xb7 ')+(r.allergyPeople?` (${r.allergyPeople} ${1===r.allergyPeople?'person':'people'})`:''),b=t=>t.dogs??(t.dog?1:0),y=t=>!(!t.access||!(t.access.wheelchair||t.access.stepFree||t.access.toilet||t.access.assistDog||t.access.note?.trim()));const p=t=>[t.diet?.vegan?`${t.diet.vegan} vegan`:'',t.diet?.vegetarian?`${t.diet.vegetarian} vegetarian`:''].filter(Boolean).join(', '),h=t=>t.tables.some(t=>t.accessible),O=t=>t.tables.some(t=>void 0!==t.dogOk)||t.areas.some(t=>t.dogs),v=(t,r)=>r.split('+').every(r=>!!t.tables.find(t=>t.name===r.trim())?.accessible),j=(t,n)=>n.split('+').every(n=>{const o=t.tables.find(t=>t.name===n.trim());return!!o&&(0,r.tableDogOk)(t,o)}),P=(t,r,o,i)=>t.filter(t=>t.id!==i&&t.date===r&&t.time===o&&n(t)).reduce((t,r)=>t+b(r),0);const k=t=>t.replace(/\s*\(substitute day\)/gi,'').trim(),A=t=>'finished'===t.status;function S(t){if('seated'===t.status&&t.seatedAt){const r=new Date(t.seatedAt);if((isNaN(r.getTime())?t.date:r.toLocaleDateString('en-CA',{timeZone:'Europe/London'})){const l=n[e.id],c=u.find(l=>l.allergen===e.id),f='contains'===l?t.colours.redBg:'may'===l?t.colours.amberBg:t.colours.surface2,h='contains'===l?'#FFD9D4':'may'===l?'#FFE2A8':t.colours.muted;return(0,d.jsxs)(s.default,{style:{width:'48%',flexGrow:1,backgroundColor:f,borderRadius:8,padding:8,borderWidth:c?2:1,borderColor:c?t.colours.red:t.colours.border},children:[(0,d.jsx)(o.T,{size:14,weight:"medium",colour:l?h:t.colours.text,children:e.label}),(0,d.jsxs)(o.T,{size:13,colour:h,children:['contains'===l?'Contains':'may'===l?'May contain':'Not listed',c?` \xb7 YOUR ALLERGY (${(0,a.severityLabel)(c.severity)})`:'']})]},e.id)})}),e.allergenNotes?(0,d.jsxs)(o.Muted,{children:["Notes: ",e.allergenNotes]}):null,(0,d.jsx)(s.default,{testID:"allergen-signoff",children:(0,d.jsx)(o.Muted,{children:e.signOff?`From the dish's recipe card. Signed off by ${e.signOff.by} on ${c(e.signOff.at)}.`:"Awaiting the head chef's allergen sign-off: not available to order online."})}),(0,d.jsx)(o.Muted,{children:"Always tell staff about allergies when you order or arrive."})]})},_e.AllergenChips=function({map:e,declared:l}){const n=Object.entries(e);return n.length?(0,d.jsx)(o.Row,{wrap:!0,gap:5,children:n.sort((e,l)=>e[1]===l[1]?0:'contains'===e[1]?-1:1).map(([e,n])=>{const s=l.some(l=>l.allergen===e);return(0,d.jsx)(o.Badge,{label:`${s?'\u26a0 ':''}${(0,a.allergenLabel)(e)}${'may'===n?' (may)':''}`,kind:s?'contains'===n?'red':'amber':'neutral'},e)})}):(0,d.jsx)(o.Muted,{children:"No listed allergens"})},r(_d[0]);var e,l=r(_d[1]),n=r(_d[2]),s=(e=n)&&e.__esModule?e:{default:e},a=r(_d[3]),t=r(_d[4]),o=r(_d[5]),d=r(_d[6]);const c=e=>{const l=new Date(`${e.slice(0,10)}T12:00:00`);return isNaN(+l)?e:l.toLocaleDateString('en-GB',{day:'numeric',month:'long',year:'numeric'})}},829,[30,1033,127,814,821,813,24]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BasketButton=function(){const s=(0,l.useBasket)().lines.reduce((e,s)=>e+s.qty,0);return s?(0,c.jsx)(o.default,{accessibilityRole:"button",accessibilityLabel:`Basket, ${s} items`,onPress:()=>e.router.push('/customer/basket'),style:{backgroundColor:u.colours.gold,borderRadius:999,paddingHorizontal:12,paddingVertical:6},children:(0,c.jsxs)(n.T,{weight:"semibold",colour:u.colours.onGold,size:14,children:["Basket \xb7 ",s]})}):null};var e=r(d[0]);r(d[1]);var s,t=r(d[2]),o=(s=t)&&s.__esModule?s:{default:s},l=r(d[3]),u=r(d[4]),n=r(d[5]),c=r(d[6])},830,[804,30,263,819,821,813,24]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.setRecipeCardRepository=function(n){t=n,r.forEach(t=>t())},e.recipeCards=function(){if(!t)throw new Error('Recipe card repository not set up');return t},Object.defineProperty(e,"hasRecipeCards",{enumerable:!0,get:function(){return n}}),e.onRepositorySwap=function(t){return r.add(t),()=>{r.delete(t)}};let t=null;const r=new Set;const n=()=>!!t},831,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Stars=function({value:e,onChange:s,size:n=36}){return(0,c.jsx)(t.Row,{gap:6,children:[1,2,3,4,5].map(u=>(0,c.jsx)(l.default,{disabled:!s,accessibilityRole:"button",accessibilityLabel:`${u} star${u>1?'s':''}`,onPress:()=>s?.(u),hitSlop:4,children:(0,c.jsx)(t.T,{size:n,colour:u<=e?o.colours.gold:'#555',children:"\u2605"})},u))})},r(d[0]);var e,s=r(d[1]),l=(e=s)&&e.__esModule?e:{default:e},o=r(d[2]),t=r(d[3]),c=r(d[4])},832,[30,263,821,813,24]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"LIVE_VENUE_SLUGS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"LIVE_VENUE_BUILD",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"isLiveVenue",{enumerable:!0,get:function(){return n}});var c=r(d[0]);const b=['anchorage','souters','kirkmichael','wildings','kirkton','abbotsford','greenside',"3idiots","cecchinis","mrbasrais","yasmins","williewastles","rupeeroom","smokinggoat","pizzaioli","drunkencoo"],f=b.includes(c.VENUE_RID),n=c=>b.includes(c)||['6349aa07-3fec-46e9-8c69-7b1b08494793','41ce63ca-ae46-432d-a5ba-25e1b801e64d','43c8da91-b8b8-4ce9-9ab7-f00c84c5f4f6','47f86b36-4c99-466a-be9c-30eb3d79f1e1','e0afad1d-cbc1-414a-add6-92e47d302139','24624ea5-d1e3-4182-b0d1-73402b8a1532','1bc2a056-2ef6-4585-abfd-b7d21c84f215',"59766322-119e-4036-a18a-f6909f60a8d2","596c6f7e-9797-4e16-84fe-db4a99fa1bdc","5d500571-e205-4ead-bb58-60e986b6f40e","f43f20ad-55d0-4008-88c8-7738dc1698df","6abc2793-93ab-4e23-a705-b4011a5cc011","78bff97d-5f07-440a-bb99-f6a6118da7a3","cd985ff5-2443-458d-ac8b-342d553628cf","35f870fc-772c-4aad-bb9e-09a9a16bc925","f500ef12-b405-438b-9671-e54289bec5dd"].includes(c)},833,[5]); +__d(function(_g,r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.MockPay=function({visible:e,onClose:j,amount:p,restaurantId:b,allowGiftCard:x=!0,onPaid:f,title:g="Pay"}){const y=(0,o.useGiftCards)(b).filter(e=>e.balance>0),[m,w]=(0,s.useState)(),[P,C]=(0,s.useState)('Test card \u2022\u2022\u2022\u2022 4242'),[T,M]=(0,s.useState)(!1),_=y.find(e=>e.code===m),v=_?Math.min(_.balance,p):0,R=p-v;return(0,h.jsxs)(u.Sheet,{visible:e,onClose:j,title:g,children:[(0,h.jsx)(u.DemoPaymentNotice,{}),x&&y.length>0?(0,h.jsxs)(l.default,{style:{gap:6},children:[(0,h.jsx)(u.T,{weight:"semibold",children:"Use a gift card"}),(0,h.jsxs)(u.Row,{wrap:!0,children:[(0,h.jsx)(u.Chip,{label:"None",selected:!m,onPress:()=>w(void 0)}),y.map(e=>(0,h.jsx)(u.Chip,{label:`${e.code.slice(0,8)}\u2026`,sub:`${(0,n.gbp)(e.balance)} left`,selected:m===e.code,onPress:()=>w(e.code)},e.id))]})]}):null,(0,h.jsx)(u.T,{weight:"semibold",children:"Payment method"}),(0,h.jsx)(u.Row,{wrap:!0,children:['Test card \u2022\u2022\u2022\u2022 4242','Apple Pay (test)','Google Pay (test)'].map(e=>(0,h.jsx)(u.Chip,{label:e,selected:P===e,onPress:()=>C(e)},e))}),(0,h.jsxs)(l.default,{style:{gap:2},children:[(0,h.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(u.Muted,{children:"Amount"}),(0,h.jsx)(u.T,{children:(0,n.gbp)(p)})]}),v?(0,h.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(u.Muted,{children:"Gift card"}),(0,h.jsxs)(u.T,{colour:c.colours.ok,children:["\u2212",(0,n.gbp)(v)]})]}):null,(0,h.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(u.T,{weight:"semibold",children:"To pay now"}),(0,h.jsx)(u.T,{weight:"bold",size:20,colour:c.colours.gold,children:(0,n.gbp)(R)})]})]}),T?(0,h.jsx)(t.default,{color:c.colours.gold}):(0,h.jsx)(u.Button,{label:`Pay ${(0,n.gbp)(R)} \u2014 demo`,onPress:()=>{M(!0),setTimeout(()=>{M(!1),f({giftCardCode:m,giftApplied:v,method:P})},700)},testID:"mock-pay-confirm"})]})};var s=r(d[0]),t=e(r(d[1])),l=e(r(d[2])),o=r(d[3]),n=r(d[4]),c=r(d[5]),u=r(d[6]),h=r(d[7])},834,[30,246,127,819,816,821,813,24]); +__d(function(_g,_r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.GiftLive=function({slug:e,venue:n}){const{info:x,mine:b,err:S,load:w,pay:k}=j(e),[T,P]=(0,t.useState)(null),[D,C]=(0,t.useState)(''),[O,$]=(0,t.useState)(''),[v,B]=(0,t.useState)(''),[I,M]=(0,t.useState)(''),[E,L]=(0,t.useState)(!1),[R,A]=(0,t.useState)(''),[_,H]=(0,t.useState)(null),F=f(e);if(!x)return(0,h.jsx)(a.Screen,{title:"Gift cards",subtitle:n,children:S?(0,h.jsx)(a.Banner,{kind:"warn",title:S}):(0,h.jsx)(a.Muted,{children:"Loading\u2026"})});const N=D?(0,o.poundsToPence)(D)??0:T??x.amounts[1]??x.amounts[0]??0;return(0,h.jsxs)(a.Screen,{title:"Gift cards",subtitle:`${n}: used only at ${n}`,children:[_?(0,h.jsx)(s.default,{testID:"gift-made",children:(0,h.jsx)(a.Card,{highlight:u.colours.gold,children:(0,h.jsxs)(s.default,{style:{gap:6},children:[(0,h.jsx)(a.H2,{children:"Your gift card code"}),(0,h.jsx)(a.T,{size:26,weight:"bold",colour:u.colours.gold,center:!0,children:_.code}),(0,h.jsxs)(a.Muted,{center:!0,children:["Shown once and kept on this phone. Write it down or take a screenshot to give it to ",O||'them',"."]}),(0,h.jsxs)(a.Banner,{kind:"warn",title:`Pay ${(0,l.gbp)(_.pence)} at the bar or till`,children:["Show reference ",_.ref,". The card works once staff mark it paid.",k.cardOn?'':' Card payment in the app is coming soon.']}),(0,h.jsx)(m,{slug:e,kind:"gift",id:_.id,pay:k})]})})}):null,(0,h.jsx)(g,{onDone:w}),(0,h.jsx)(s.default,{testID:"gift-mine",children:(0,h.jsx)(a.Card,{children:(0,h.jsxs)(s.default,{style:{gap:6},children:[(0,h.jsx)(a.H2,{children:"Your gift cards"}),b.cards.length?b.cards.map(t=>(0,h.jsxs)(s.default,{style:{gap:2},children:[(0,h.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(a.T,{style:{flex:1},children:F[t.id]??`\u2022\u2022\u2022\u2022 ${t.last4}`}),(0,h.jsxs)(a.T,{weight:"semibold",colour:u.colours.gold,children:[(0,l.gbp)(t.balancePence)," of ",(0,l.gbp)(t.initialPence)]})]}),(0,h.jsxs)(a.Muted,{size:12,children:[o.STATUS_WORDS[t.status]??t.status,t.expiresAt?` \xb7 use by ${p(t.expiresAt)}`:'','waiting-payment'===t.status?` \xb7 reference ${t.ref}`:'']}),'waiting-payment'===t.status&&_?.id!==t.id?(0,h.jsx)(m,{slug:e,kind:"gift",id:t.id,pay:k}):null]},t.id)):(0,h.jsx)(a.Muted,{children:"None yet."})]})})}),x.giftsOn?(0,h.jsx)(s.default,{testID:"gift-buy",children:(0,h.jsx)(a.Card,{children:(0,h.jsxs)(s.default,{style:{gap:8},children:[(0,h.jsx)(a.H2,{children:"Buy a gift card"}),(0,h.jsx)(a.Row,{wrap:!0,children:x.amounts.map(e=>(0,h.jsx)(a.Chip,{label:(0,l.gbp)(e),selected:!D&&N===e,onPress:()=>{C(''),P(e)}},e))}),(0,h.jsx)(a.Field,{label:`Or another amount (\xa3${x.minPence/100} to \xa3${x.maxPence/100})`,keyboardType:"decimal-pad",value:D,onChangeText:C,placeholder:"e.g. 40",testID:"gift-custom"}),(0,h.jsx)(a.Field,{label:"Who it\u2019s for",value:O,onChangeText:$,testID:"gift-recipient"}),(0,h.jsx)(a.Field,{label:"From",value:v,onChangeText:B}),(0,h.jsx)(a.Field,{label:"Message",value:I,onChangeText:M,multiline:!0,placeholder:"Happy birthday!"}),(0,h.jsxs)(a.Muted,{size:12,children:["Use within ",(0,o.expiryWords)(x.expiryMonths)," of paying. Part-use leaves a balance.",x.terms?` ${x.terms}`:'']}),(0,h.jsx)(s.default,{testID:"gift-pay-placeholder",children:(0,h.jsx)(a.Banner,{kind:"demo",title:"Payment",children:o.PAY_PLACEHOLDER})}),R?(0,h.jsx)(a.Banner,{kind:"warn",title:R}):null,(0,h.jsx)(a.Button,{label:E?'Saving\u2026':`Get a ${(0,l.gbp)(N)} gift card, pay at the till`,testID:"gift-buy-btn",disabled:E||Nx.maxPence,onPress:async()=>{L(!0),A('');try{const t=await(0,c.buyGift)(e,{amount:N,recipient:O,from:v,message:I});t.code&&y(e,t.id,t.code),H({id:t.id,code:t.code??'',ref:t.ref,pence:t.initialPence}),w()}catch(e){A((0,r.plainError)(e))}finally{L(!1)}}})]})})}):(0,h.jsx)(a.Banner,{kind:"demo",title:`${n} isn\u2019t selling gift cards in the app yet`,children:"Ask at the bar."})]})},_e.ShopLive=function({slug:e,venue:n,guestName:p}){const{info:x,mine:f,err:y,load:b,pay:S}=j(e),[w,k]=(0,t.useState)({}),[T,P]=(0,t.useState)(p),[D,C]=(0,t.useState)(!1),[O,$]=(0,t.useState)(''),[v,B]=(0,t.useState)(null);if(!x)return(0,h.jsx)(a.Screen,{title:"Shop",subtitle:n,children:y?(0,h.jsx)(a.Banner,{kind:"warn",title:y}):(0,h.jsx)(a.Muted,{children:"Loading\u2026"})});const I=Object.entries(w).filter(([,e])=>e>0).map(([e,t])=>({id:e,qty:t})),M=(0,o.basketTotal)(I,x.products);return(0,h.jsxs)(a.Screen,{title:"Shop",subtitle:`${n}: collect at the venue`,children:[v?(0,h.jsxs)(s.default,{testID:"shop-done",children:[(0,h.jsxs)(a.Banner,{kind:"warn",title:`Order ${v.ref}: pay ${(0,l.gbp)(v.total)} at the bar or till`,children:["Staff will have it ready to collect once it\u2019s paid.",S.cardOn?'':' Card payment in the app is coming soon.']}),(0,h.jsx)(m,{slug:e,kind:"shop",id:v.id,pay:S})]}):null,(0,h.jsx)(g,{onDone:b}),x.shopOn?(0,h.jsxs)(h.Fragment,{children:[x.products.length?x.products.map(e=>(0,h.jsx)(s.default,{testID:`shop-item-${e.id}`,children:(0,h.jsx)(a.Card,{children:(0,h.jsxs)(s.default,{style:{gap:4},children:[(0,h.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(a.T,{weight:"semibold",style:{flex:1},children:e.name}),(0,h.jsx)(a.T,{colour:u.colours.gold,children:(0,l.gbp)(e.pricePence)})]}),e.details?(0,h.jsx)(a.Muted,{children:e.details}):null,e.soldOut?(0,h.jsx)(a.Badge,{kind:"amber",label:"Sold out"}):(0,h.jsxs)(a.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,h.jsx)(a.Muted,{children:"How many"}),(0,h.jsx)(a.Stepper,{value:w[e.id]??0,min:0,max:20,label:`${e.name} quantity`,onChange:t=>k({...w,[e.id]:t})})]})]})})},e.id)):(0,h.jsx)(a.Muted,{children:"Nothing in the shop yet."}),I.length?(0,h.jsx)(s.default,{testID:"shop-basket",children:(0,h.jsx)(a.Card,{children:(0,h.jsxs)(s.default,{style:{gap:6},children:[(0,h.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(a.T,{weight:"semibold",children:"Total"}),(0,h.jsx)(a.T,{weight:"semibold",colour:u.colours.gold,children:(0,l.gbp)(M)})]}),(0,h.jsx)(a.Field,{label:"Name for collection",value:T,onChangeText:P,testID:"shop-name"}),(0,h.jsx)(a.Banner,{kind:"demo",title:"Payment",children:o.PAY_PLACEHOLDER}),O?(0,h.jsx)(a.Banner,{kind:"warn",title:O}):null,(0,h.jsx)(a.Button,{label:D?'Sending\u2026':'Order, pay at the till',testID:"shop-order-btn",disabled:D||!T.trim(),onPress:async()=>{C(!0),$('');try{const t=await(0,c.shopOrder)(e,I,T);B({id:t.id,ref:t.ref,total:t.totalPence}),k({}),b()}catch(e){$((0,r.plainError)(e))}finally{C(!1)}}})]})})}):null]}):(0,h.jsx)(a.Banner,{kind:"demo",title:`${n}\u2019s shop isn\u2019t open in the app yet`,children:"Ask at the bar."}),f.orders.length?(0,h.jsx)(s.default,{testID:"shop-mine",children:(0,h.jsx)(a.Card,{children:(0,h.jsxs)(s.default,{style:{gap:4},children:[(0,h.jsx)(a.H2,{children:"Your shop orders"}),f.orders.map(e=>(0,h.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsxs)(a.T,{style:{flex:1},children:[e.ref," \xb7 ",e.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')]}),(0,h.jsx)(a.Muted,{children:o.STATUS_WORDS[e.status]??e.status})]},e.ref))]})})}):null]})};var e,t=_r(d[0]),n=_r(d[1]),s=(e=n)&&e.__esModule?e:{default:e},a=_r(d[2]),l=_r(d[3]),r=_r(d[4]),o=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]);const p=e=>{if(!e)return'';try{return new Date(e).toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric',timeZone:'Europe/London'})}catch{return e.slice(0,10)}},x=e=>`cc-gift-codes:${e}:v1`;function f(e){try{return JSON.parse(globalThis.localStorage?.getItem(x(e))||'{}')}catch{return{}}}function y(e,t,n){try{const s=f(e);s[t]=n,globalThis.localStorage?.setItem(x(e),JSON.stringify(s))}catch{}}function j(e){const[n,s]=(0,t.useState)(null),[a,l]=(0,t.useState)({cards:[],orders:[]}),[o,u]=(0,t.useState)(''),[h,p]=(0,t.useState)({provider:'none',cardOn:!1,testMode:!0}),x=(0,t.useCallback)(()=>{u(''),(0,c.shopPublic)(e).then(s).catch(e=>u((0,r.plainError)(e))),(0,c.myShop)(e).then(l).catch(()=>{}),(0,c.payPublic)(e).then(p)},[e]);return(0,t.useEffect)(()=>{x()},[x]),{info:n,mine:a,err:o,load:x,pay:h}}function g({onDone:e}){const[n,l]=(0,t.useState)('');return(0,t.useEffect)(()=>{const t='undefined'!=typeof window?new URLSearchParams(window.location.search).get('paid'):null;if(!t||!/^[0-9a-f-]{36}$/.test(t))return;let n=0;const s=()=>(0,c.payStatus)(t).then(t=>{l(t.status),'paid'===t.status?e():n++<10&&setTimeout(s,2e3)}).catch(()=>{});s()},[e]),n?(0,h.jsx)(s.default,{testID:"pay-back",children:(0,h.jsx)(a.Banner,{kind:'paid'===n?'success':'warn',title:'paid'===n?'Paid by card (TEST MODE: no real money)':'expired'===n?'The card payment timed out. Pay at the bar or till.':'Checking the card payment\u2026'})}):null}function m({slug:e,kind:n,id:l,pay:o}){const[u,p]=(0,t.useState)(!1),[x,f]=(0,t.useState)('');return o.cardOn?(0,h.jsxs)(s.default,{testID:`pay-card-${n}`,style:{gap:4},children:[(0,h.jsx)(a.Button,{label:u?'Opening card payment\u2026':'Pay by card (TEST MODE)',kind:"secondary",disabled:u,onPress:async()=>{p(!0),f('');try{const t=await(0,c.payStart)(e,n,l);window.location.assign(t.url)}catch(e){f((0,r.plainError)(e))}finally{p(!1)}}}),(0,h.jsx)(a.Muted,{size:12,children:"Test mode: use a Stripe test card. No real money is taken."}),x?(0,h.jsx)(a.Banner,{kind:"warn",title:x}):null]}):null}},835,[30,127,813,816,1015,1016,1017,821,24]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"guestServer",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"staffServer",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"useGuestLoyalty",{enumerable:!0,get:function(){return _}}),e.refreshGuest=async function(t){if(!c())return;_.setState(n=>({loading:{...n.loading,[t]:!0}}));try{const n=await(0,o.rpc)('loyalty_public',{p_venue_slug:t});if(_.setState(r=>({info:{...r.info,[t]:n}})),await(0,o.guestSession)()){const n=await(0,o.rpc)('loyalty_my_card',{p_venue_slug:t});_.setState(r=>({card:{...r.card,[t]:n??null}}))}}finally{_.setState(n=>({loading:{...n.loading,[t]:!1}}))}},e.guestJoin=async function(t,n){if(!await(0,o.guestSession)())throw new Error('No connection. Try again when you are back online.');const r=await(0,o.rpc)('loyalty_guest_join',{p_venue_slug:t,p_name:n.name.trim(),p_phone:n.phone.trim()||null,p_email:n.email.trim()||null,p_consent:n.consent,p_consent_text:n.consentText,p_referral:n.referral?(0,l.cleanCode)(n.referral):null});return p(t,r),r},e.guestClaim=async function(t,n){if(!await(0,o.guestSession)())return{ok:!1,error:'No connection. Try again when you are back online.'};const r=await(0,o.rpc)('loyalty_guest_claim',{p_venue_slug:t,p_code:(0,l.cleanCode)(n)});return r?.error?{ok:!1,error:String(r.error)}:(p(t,r),{ok:!0,card:r,linked:!!r.linked})},e.guestLinkCode=async function(t){return(0,o.rpc)('loyalty_guest_link_code',{p_venue_slug:t})},e.guestLeave=async function(t){await(0,o.rpc)('loyalty_guest_leave',{p_venue_slug:t}),p(t,null)},Object.defineProperty(e,"staffFind",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"staffCard",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"staffStamp",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"staffRedeem",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"staffJoin",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"staffCode",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"staffRemove",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"loyaltySummary",{enumerable:!0,get:function(){return P}}),e.readSettings=async function(){const{data:t,error:n}=await u().from('loyalty_settings').select('*').eq('venue_id',y()).maybeSingle();if(n)throw n;return(0,l.settingsFromRow)(t)},e.saveSettings=async function(t){const{error:n}=await u().from('loyalty_settings').upsert({venue_id:y(),...(0,l.settingsToRow)(t),updated_by:(o.useSync.getState().staffRef??'').slice(0,80)||'manager',updated_at:(new Date).toISOString()},{onConflict:'venue_id'});if(n)throw n},e.readOffers=k,e.saveOffer=C,e.watchLoyalty=function(t){if(!f())return()=>{};const n=y();let r=u().channel(`cc-loyalty:${n}:${Math.random().toString(36).slice(2,8)}`);for(const o of['loyalty_settings','loyalty_offers','loyalty_guests','loyalty_stamps','loyalty_rewards','loyalty_referrals'])r=r.on('postgres_changes',{event:'*',schema:'public',table:o,filter:`venue_id=eq.${n}`},()=>t());return r.subscribe(),()=>{try{u().removeChannel(r)}catch{}}},e.migrateLocalOnce=async function(t,n,r){if(!f())return 0;const o=`loyalty:migrated:${y()}`;if(await n(o))return 0;let s=0;if(!(await k()).length)for(const n of t.offers.filter(t=>'offer'===t.kind&&!JSON.stringify(t).includes('(example)')))await C({title:n.title.slice(0,80),details:(n.body??'').slice(0,500),startsOn:null,endsOn:n.until??null,isOn:!!n.live}),s++;return await r(o),s};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]),o=_r(d[3]),s=_r(d[4]),l=_r(d[5]);const u=()=>(0,n.getSupabase)(),c=()=>(0,r.isSupabaseConfigured)()&&!s.PITCH,f=()=>c()&&'staff'===o.useSync.getState().kind&&!!o.useSync.getState().venueId,y=()=>{const t=o.useSync.getState().venueId;if(!t)throw new Error('Not connected to the venue yet.');return t},_=(0,t.create)(()=>({info:{},card:{},loading:{}}));const p=(t,n)=>_.setState(r=>({card:{...r.card,[t]:n}}));const b=t=>(0,o.rpc)('loyalty_staff_find',{p_venue:y(),p_q:t}),w=t=>(0,o.rpc)('loyalty_staff_card',{p_guest:t}),v=t=>(0,o.rpc)('loyalty_staff_stamp',{p_guest:t}),S=t=>(0,o.rpc)('loyalty_staff_redeem',{p_reward:t}),O=t=>(0,o.rpc)('loyalty_staff_join',{p_venue:y(),p_name:t.name.trim(),p_phone:t.phone.trim()||null,p_email:t.email.trim()||null,p_consent:t.consent,p_consent_text:t.consentText}),h=(t,n)=>(0,o.rpc)('loyalty_staff_code',{p_venue:y(),p_kind:t,p_guest:n??null}),j=t=>(0,o.rpc)('loyalty_staff_remove',{p_guest:t}),P=()=>(0,o.rpc)('loyalty_summary',{p_venue:y()});async function k(){const{data:t,error:n}=await u().from('loyalty_offers').select('*').eq('venue_id',y()).order('created_at');if(n)throw n;return(t??[]).map(l.offerFromRow)}async function C(t){const n={venue_id:y(),title:t.title.trim(),details:t.details.trim(),starts_on:t.startsOn||null,ends_on:t.endsOn||null,is_on:t.isOn,updated_at:(new Date).toISOString()},{error:r}=t.id?await u().from('loyalty_offers').update(n).eq('id',t.id):await u().from('loyalty_offers').insert(n);if(r)throw r}},836,[952,863,1079,820,2,1015]); +__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.SoutersCustomerHome=function(){const[e,n]=(0,t.useState)(!1),[p,m]=(0,t.useState)(!1),[b,y]=(0,t.useState)('All'),S=(0,h.useMenu)('souters'),M=(0,t.useMemo)(()=>['All',...Array.from(new Set(S.map(e=>e.section)))],[S]),k=S.filter(e=>'All'===b||e.section===b);if(e)return(0,j.jsx)(u.Screen,{title:"Souter's Inn",back:!1,children:(0,j.jsx)(c.VenueRequestForm,{rid:"souters",kind:"table",onClose:()=>n(!1)})});if(p)return(0,j.jsxs)(u.Screen,{title:"Menu",subtitle:"Souter's Inn",back:!1,children:[(0,j.jsx)(u.Button,{kind:"ghost",label:"\u2039 Back",onPress:()=>m(!1)}),(0,j.jsxs)(u.Muted,{children:[x.SOUTERS_MENU_COUNT," dishes. Please speak to staff about allergens \u2014 nothing is signed off for ordering yet."]}),(0,j.jsx)(u.Row,{wrap:!0,gap:6,children:M.slice(0,12).map(e=>(0,j.jsx)(u.Chip,{label:e,selected:b===e,onPress:()=>y(e)},e))}),k.map(e=>(0,j.jsx)(o.default,{testID:`souters-dish-${e.id}`,children:(0,j.jsxs)(u.Card,{children:[(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,j.jsx)(u.T,{weight:"semibold",style:{flex:1},children:e.name}),(0,j.jsx)(u.T,{children:null==e.price?e.priceNote||'Ask staff':(0,f.gbp)(e.price)})]}),e.description?(0,j.jsx)(u.Muted,{children:e.description}):null,(0,j.jsx)(u.Muted,{children:"Awaiting allergen sign-off \xb7 not orderable yet"})]})},e.id))]});return(0,j.jsxs)(u.Screen,{title:"Souter's Inn",subtitle:"Kirkoswald \xb7 Southern Ayr",children:[(0,j.jsx)(l.RestaurantHero,{rid:"souters",size:160}),(0,j.jsx)(s.FindPub,{rid:"souters"}),(0,j.jsx)(u.Card,{children:(0,j.jsxs)(o.default,{testID:"souters-book-table",style:{gap:8},children:[(0,j.jsx)(u.T,{weight:"bold",children:"Book a table"}),(0,j.jsx)(u.Muted,{children:"Send a request to the venue. No deposit and no payment here \u2014 staff will confirm."}),(0,j.jsx)(u.Button,{label:"Book a table",onPress:()=>n(!0)})]})}),(0,j.jsx)(u.Card,{children:(0,j.jsxs)(o.default,{testID:"souters-menu-card",style:{gap:8},children:[(0,j.jsx)(u.T,{weight:"bold",children:"Menu"}),(0,j.jsxs)(u.Muted,{children:[x.SOUTERS_MENU_COUNT," dishes from the venue menus. Allergen information is not signed off yet \u2014 please speak to staff about allergens. Ordering stays off until the Head Chef signs each dish off."]}),(0,j.jsx)(u.Button,{kind:"secondary",label:"Browse the menu",onPress:()=>m(!0)})]})}),(0,j.jsx)(u.Muted,{children:"Table deposits are not set. Closing time (9pm or 10pm) to confirm. No payment is taken here."})]})},_e.SoutersStaffHome=function({app:e}){return(0,j.jsxs)(o.default,{testID:"souters-setup-home",style:{flex:1,padding:24,justifyContent:'center',gap:16,maxWidth:680,width:'100%',alignSelf:'center'},children:[(0,j.jsx)(l.RestaurantHero,{rid:"souters",size:180}),(0,j.jsx)(u.T,{size:24,weight:"bold",center:!0,children:e}),(0,j.jsxs)(u.Card,{children:[(0,j.jsx)(u.T,{weight:"bold",children:"Ready for venue setup"}),(0,j.jsx)(u.Muted,{children:"Contact: souters@southernayr.com \xb7 01655 760653. No named manager or staff list yet \u2014 no personal links have been created."})]}),(0,j.jsx)(u.Muted,{center:!0,children:"Areas are set (Restaurant, Bar, Mezzanine, Beer garden, Ice cream & cake corner). Table plan to confirm \u2014 no sample tables. Menu seeded without allergen sign-off."}),(0,j.jsx)(u.Muted,{center:!0,children:"Guests request a table in the Customer app. Proposed closing time to confirm."})]})};var e,s=r(d[0]),t=r(d[1]),n=r(d[2]),o=(e=n)&&e.__esModule?e:{default:e},l=r(d[3]),u=r(d[4]),c=r(d[5]),h=r(d[6]),f=r(d[7]),x=r(d[8]),j=r(d[9])},854,[862,30,127,861,813,864,819,816,1099,24]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"LAUNCHER_LINE",{enumerable:!0,get:function(){return u}}),_e.LauncherLine=function(){return(0,c.jsx)(l.default,{style:{borderTopWidth:1,borderColor:n.colours.border,paddingTop:10,marginTop:4},children:(0,c.jsx)(s.Muted,{center:!0,children:u})})},_e.HubTile=function({icon:e,label:u,sub:h,onPress:p,badge:f}){return(0,c.jsxs)(o.default,{accessibilityRole:"button",accessibilityLabel:u,onPress:p,style:({pressed:e})=>({flexBasis:'30%',flexGrow:1,maxWidth:'31.5%',minWidth:96,backgroundColor:e?'#1d1a14':n.colours.surface,borderRadius:14,borderWidth:1,borderColor:n.colours.border,padding:10,gap:2,alignItems:'center'}),children:[b.includes(e)?(0,c.jsx)(t.Icon,{name:e,size:24,colour:n.colours.gold}):(0,c.jsx)(s.T,{size:22,children:e}),(0,c.jsx)(s.T,{size:13,weight:"semibold",center:!0,children:u}),h?(0,c.jsx)(s.T,{size:11,colour:n.colours.muted,center:!0,children:h}):null,f?(0,c.jsx)(l.default,{style:{position:'absolute',top:6,right:6,backgroundColor:n.colours.gold,borderRadius:8,paddingHorizontal:5},children:(0,c.jsx)(s.T,{size:10,weight:"bold",colour:n.colours.onGold,children:f})}):null]})},r(d[0]);var o=e(r(d[1])),l=e(r(d[2])),s=r(d[3]),n=r(d[4]),t=r(d[5]),c=r(d[6]);const u='Card payments: not set up yet';const b=['bag','phone','box','calendarPlus','clock','star','userPlus','gift','alert','tag','sparkle','chat','hanger']},855,[30,263,127,813,821,1007,24]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"attStatus",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"isConfirmed",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"timesheetRemote",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"weekdayOf",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"addDays",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"mondayOfDate",{enumerable:!0,get:function(){return I}}),Object.defineProperty(_e,"shiftsOn",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"shiftOf",{enumerable:!0,get:function(){return E}}),Object.defineProperty(_e,"visibleShifts",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"SUPPLIER_CATS",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"NLW_PENCE",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"MAX_CUSTOM_LINKS",{enumerable:!0,get:function(){return R}}),Object.defineProperty(_e,"WIX_IDS",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"isWixLink",{enumerable:!0,get:function(){return L}}),Object.defineProperty(_e,"DEFAULT_QUICK_LINKS",{enumerable:!0,get:function(){return T}}),_e.openShiftOf=$,_e.loggedBreakMins=D,Object.defineProperty(_e,"isOnBreak",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"DISPLAY_CLOCK_DEFAULT",{enumerable:!0,get:function(){return N}}),Object.defineProperty(_e,"useOwner",{enumerable:!0,get:function(){return V}}),Object.defineProperty(_e,"wageLabel",{enumerable:!0,get:function(){return q}}),Object.defineProperty(_e,"ROLE_LABEL",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"CAN",{enumerable:!0,get:function(){return K}}),_e.staffLabel=function(e){const t=e.nickname?.trim(),n=e.name.replace(/\s*\(([^)]*)\)\s*$/,(e,n)=>t&&n.trim().toLowerCase()===t.toLowerCase()?'':e);return t?`${n} (${t})`:n},Object.defineProperty(_e,"staffCalls",{enumerable:!0,get:function(){return W}}),Object.defineProperty(_e,"staffCalled",{enumerable:!0,get:function(){return F}}),Object.defineProperty(_e,"staffMatches",{enumerable:!0,get:function(){return G}});var e,t=_r(_d[0]),n=_r(_d[1]),a=_r(_d[2]),i=_r(_d[3]),s=_r(_d[4]),r=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),c=(e=d)&&e.__esModule?e:{default:e},u=_r(_d[8]),f=_r(_d[9]),l=_r(_d[10]),p=_r(_d[11]);const m=e=>e.out?e.signOff?'confirmed':'awaiting':'open',g=e=>!!e.out&&!!e.signOff,h={send:null},b=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`,k=e=>{const[t,n,a]=e.split('-').map(Number);return(new Date(t,n-1,a).getDay()+6)%7},y=(e,t)=>{const[n,a,i]=e.split('-').map(Number);return b(new Date(n,a-1,i+t))},I=e=>y(e,-k(e)),w=(e,t)=>e.filter(e=>e.date===t),E=(e,t,n)=>e.find(e=>e.staffId===t&&e.date===n),S=(e,t)=>t?e:e.filter(e=>e.published),O=['Fish & seafood','Meat','Fruit & veg','Dairy','Dry goods','Drinks/brewery','Cleaning','Packaging','Equipment/maintenance'],v=1271,R=6,_=['ql-wix-view','ql-wix-edit'],L=e=>_.includes(e.id)||'Website bookings'===e.group,T=[{id:'ql-gmail',label:'Work email (Gmail)',url:'',icon:'\u2709\ufe0f',kind:'gmail',staff:!1,builtIn:!0},{id:'ql-wix-view',label:'View site',url:'https://www.anchoragedunure.com',icon:'\ud83c\udf10',kind:'link',group:'Website bookings',staff:!1,builtIn:!0},{id:'ql-wix-edit',label:'Edit site',url:'https://manage.wix.com',icon:'\ud83d\udd8a\ufe0f',kind:'link',group:'Website bookings',staff:!1,builtIn:!0}];function $(e,t,n){const a=new Date(n).getTime();return e.filter(e=>e.staffId===t&&e.in&&!e.out&&a-new Date(e.in).getTime()<72e6).sort((e,t)=>t.in.localeCompare(e.in))[0]}function D(e,t=new Date){const n=new Date(t).getTime();return Math.round((e.breaks??[]).reduce((e,t)=>e+Math.max(0,(t.end?new Date(t.end).getTime():n)-new Date(t.start).getTime()),0)/6e4)}const P=e=>!!e?.breaks?.some(e=>!e.end),A=e=>`${e}-${Math.random().toString(36).slice(2,8)}`,M=['#2A3B4C','#4A3A22','#40362A','#3E2A2A','#2E2E40'];function j(){return l.ROSTER.map(e=>({id:e.id,name:e.name,...e.nickname?{nickname:e.nickname}:{},role:e.role,job:e.job,active:!0,level:e.level,dept:e.dept,salaried:e.salaried,noTax:e.noTax,...N.includes(e.id)?{displayClock:!0}:{}}))}const N=['st-jack'];function C(){return Object.fromEntries(l.ROSTER.filter(e=>null!=e.hourlyPence).map(e=>[e.id,e.hourlyPence]))}const U=()=>{const e={tronc:{method:'hours',points:{FOH:1,Bar:1,Kitchen:.8,KP:.6,Manager:1},includeManagers:!0,includeOwner:!1,custom:{},text:'The Anchorage tipping policy (template)\n\n1. 100% of tips paid by card and cash tips put in the tip jar go to staff. Nothing is deducted.\n2. Tips are pooled and shared by paid hours worked in each pay period (breaks excluded).\n3. The owner does not take a share. Managers share only for hours worked on the floor or in the kitchen.\n4. Tips are paid with wages, no later than the end of the month after the tip was paid.\n5. Tip records are kept for 3 years. Ask a manager for your records at any time.'},troncCash:{},troncHistory:[],troncLog:[],chat:[],chatMuted:{},referral:{giverReward:'Free dessert',friendReward:'\xa35 off first order',active:!0},referrals:[],reminders:{h24:!0,h2:!0,confirmText:!0},coats:[],merch:[],merchOrders:[],marketingDraft:void 0,socialAccounts:{facebook:!0,instagram:!0,tiktok:!0,youtube:!0},socialPosts:[],socialDraft:void 0,quickLinks:T.map(e=>({...e})),workEmail:'',staff:j(),rosterVersion:l.ROSTER_VERSION,previewRole:'owner',staffAs:l.ROSTER.find(e=>'staff'===e.app)?.id??l.ROSTER[0]?.id??'',offers:[],photos:[],changeRequests:[],changesUsed:2,site:t.VENUE_RID,branding:{},checks:{},lost:[],lostReports:[],campaigns:[],shifts:[],rotaPublished:void 0,leave:[],swaps:[],availability:{},attendance:[],attLog:[],timeRequests:[],geofence:{lat:55.4047,lng:-4.7606,radius:100},simLocation:'venue',consent:{},hourly:C(),payPeriod:'weekly',suppliers:[],supplierOrders:[],staffCanViewSuppliers:!1,readNotes:{},customerTags:{'cust-demo':['Allergy','Regular'],'cr-2':['VIP'],'cr-5':['Takeaway']}};if(s.LIVE_VENUE_BUILD&&!t.IS_ISOLATED_VENUE)return{...e,changesUsed:0,customerTags:{},socialAccounts:{facebook:!1,instagram:!1,tiktok:!1,youtube:!1},referral:{...e.referral,active:!1}};if(!t.IS_ISOLATED_VENUE)return e;for(const t of Object.keys(e))Array.isArray(e[t])&&(e[t]=[]);return{...e,site:t.VENUE_RID,staffAs:'',hourly:{},customerTags:{},geofence:{lat:0,lng:0,radius:100},tronc:{...e.tronc,text:t.IS_QUEUED_VENUE?n.queuedVenues[t.VENUE_RID].name+' tipping policy \u2014 to confirm.':t.IS_ABBOTSFORD?'The Abbotsford Hotel tipping policy \u2014 awaiting venue confirmation.':t.IS_KIRKTON?'The Kirkton Inn tipping policy \u2014 awaiting venue confirmation.':t.IS_GREENSIDE?'The Greenside Restaurant tipping policy \u2014 awaiting venue confirmation.':t.IS_WILDINGS?'Wildings Hotel & Restaurant tipping policy \u2014 awaiting venue confirmation.':t.IS_KIRKMICHAEL?"The Kirkmichael Arms tipping policy \u2014 awaiting venue confirmation.":"Souter's Inn tipping policy \u2014 awaiting venue confirmation."},changesUsed:0,socialAccounts:{facebook:!1,instagram:!1,tiktok:!1,youtube:!1},referral:{...e.referral,active:!1},quickLinks:t.IS_QUEUED_VENUE||t.IS_ABBOTSFORD||t.IS_KIRKTON?[]:t.IS_GREENSIDE?[{id:'greenside-phone',label:'Call 01655 889685',url:'tel:01655889685',icon:'',kind:'link',group:'Bookings',staff:!0,builtIn:!0}]:t.IS_WILDINGS?[{id:'wildings-phone',label:'Call to book',url:'tel:01655331401',icon:'\ud83c\udf10',kind:'link',group:'Bookings',staff:!0,builtIn:!0},{id:'wildings-email',label:'Email to book',url:'mailto:bookings@wildingsrestaurant-hotel.co.uk',icon:'\ud83c\udf10',kind:'link',group:'Bookings',staff:!0,builtIn:!0}]:t.IS_KIRKMICHAEL?[{id:'kirkmichael-site',label:'Venue website',url:'https://www.kirkmichaelarms.co.uk/',icon:'\ud83c\udf10',kind:'link',group:'Website',staff:!0,builtIn:!0}]:[{id:'souters-book',label:'Guest table requests',url:'https://covercharge-apps.static.hf.space/souters/customer-app/',icon:'\ud83c\udf10',kind:'link',group:'Bookings',staff:!0,builtIn:!0}],branding:{[t.VENUE_RID]:{accent:t.IS_QUEUED_VENUE?n.queuedVenues[t.VENUE_RID].branding.accent:t.IS_ABBOTSFORD?'#B89362':t.IS_KIRKTON?'#B46C54':t.IS_GREENSIDE?a.GREENSIDE_PALETTE.gold:t.IS_WILDINGS?'#FFE3A5':t.IS_KIRKMICHAEL?'#B87754':'#A4622E'}}}},V=(0,u.create)()((0,f.persist)((e,n)=>({...U(),setPreviewRole:t=>e({previewRole:t}),addStaff:(t,n,a)=>e(e=>({staff:[...e.staff,{id:A('st'),name:t,role:n,job:a,active:!0,level:x[n]}]})),saveSupplier:t=>e(e=>({suppliers:e.suppliers.some(e=>e.id===t.id)?e.suppliers.map(e=>e.id===t.id?t:e):[...e.suppliers,t]})),setRate:(t,n)=>e(e=>({hourly:{...e.hourly,[t]:Math.max(0,Math.round(n))}})),clearRate:t=>e(e=>{const n={...e.hourly};return delete n[t],{hourly:n}}),updateStaff:(t,n)=>e(e=>({staff:e.staff.map(e=>e.id===t?{...e,...n}:e)})),addOffer:t=>e(e=>({offers:[{...t,id:A('of')},...e.offers]})),updateOffer:(t,n)=>e(e=>({offers:e.offers.map(e=>e.id===t?{...e,...n}:e)})),addPhoto:t=>e(e=>({photos:[...e.photos,{id:A('ph'),caption:t,tone:M[e.photos.length%M.length]}]})),removePhoto:t=>e(e=>({photos:e.photos.filter(e=>e.id!==t)})),requestChange:(t,n)=>e(e=>e.changesUsed>=5?e:{changesUsed:e.changesUsed+1,changeRequests:[{id:A('cr'),text:t,at:n,status:'requested'},...e.changeRequests]}),setSite:n=>e({site:t.IS_ISOLATED_VENUE?t.VENUE_RID:n}),setBranding:(t,n)=>e(e=>{const a={...e.branding};return n?a[t]={...a[t],...n}:delete a[t],{branding:a}}),setOwner:t=>e(t),addSocialPost:t=>e(e=>({socialPosts:[{...t,id:A('sp')},...e.socialPosts]})),setSocialPost:(t,n)=>e(e=>({socialPosts:e.socialPosts.map(e=>e.id===t?{...e,...n}:e)})),chatSend:t=>e(e=>({chat:[...e.chat,{...t,id:(0,p.uuid)(),reactions:{},seenBy:t.seenBy??('system'===t.from?[]:[t.from])}]})),chatReact:(t,n,a)=>e(e=>({chat:e.chat.map(e=>{if(e.id!==t)return e;const i=e.reactions[n]??[];return{...e,reactions:{...e.reactions,[n]:i.includes(a)?i.filter(e=>e!==a):[...i,a]}}})})),chatSeen:(t,n)=>e(e=>e.chat.some(e=>e.ch===t&&!e.seenBy.includes(n))?{chat:e.chat.map(e=>e.ch!==t||e.seenBy.includes(n)?e:{...e,seenBy:[...e.seenBy,n]})}:e),chatPatch:(t,n)=>e(e=>({chat:e.chat.map(e=>e.id===t?{...e,...n}:e)})),chatMute:(t,n)=>e(e=>{const a=e.chatMuted[t]??[];return{chatMuted:{...e.chatMuted,[t]:a.includes(n)?a.filter(e=>e!==n):[...a,n]}}}),sys:(t,n,a)=>e(e=>({chat:[...e.chat,{id:A('m'),ch:t,from:'system',text:n,at:a,reactions:{},seenBy:[]}]})),tick:(t,n,a,i)=>e(e=>({checks:{...e.checks,[t]:{by:n,at:a,value:i}}})),untick:t=>e(e=>{const n={...e.checks};return delete n[t],{checks:n}}),addLost:t=>e(e=>({lost:[{...t,id:A('lp'),status:'held'},...e.lost]})),setLost:(t,n)=>e(e=>({lost:e.lost.map(e=>e.id===t?{...e,...n}:e)})),addCampaign:t=>e(e=>({campaigns:[{...t,id:A('cp')},...e.campaigns]})),setCampaign:(t,n)=>e(e=>({campaigns:e.campaigns.map(e=>e.id===t?{...e,...n}:e)})),setShifts:t=>e({shifts:t.map(e=>e.date?{...e,day:k(e.date)}:e)}),addShift:t=>e(e=>({shifts:[...e.shifts,{...t,day:k(t.date),published:!1,id:(0,p.uuid)()}]})),copyWeek:(t,a)=>{const i=n(),s=new Set(i.staff.filter(e=>e.active).map(e=>e.id)),r=[];for(let e=0;e<7;e++){const n=y(t,e),o=y(a,e);i.shifts.filter(e=>e.date===n&&s.has(e.staffId)&&!i.shifts.some(t=>t.staffId===e.staffId&&t.date===o)&&!r.some(t=>t.staffId===e.staffId&&t.date===o)).forEach(e=>r.push({id:(0,p.uuid)(),staffId:e.staffId,date:o,day:k(o),start:e.start,end:e.end,note:e.note,published:!1}))}return r.length&&e({shifts:[...i.shifts,...r]}),r.length},publishWeek:t=>{const n=y(t,6);let a=0;return e(e=>({shifts:e.shifts.map(e=>e.daten||e.published&&!e.changed?e:(a++,{...e,published:!0,changed:!1})),rotaPublished:(new Date).toISOString()})),a},removeShift:t=>e(e=>({shifts:e.shifts.filter(e=>e.id!==t)})),markRead:t=>e(e=>({readNotes:{...e.readNotes,...Object.fromEntries(t.map(e=>[e,!0]))}})),toggleTag:(t,n)=>e(e=>{const a=e.customerTags[t]??[];return{customerTags:{...e.customerTags,[t]:a.includes(n)?a.filter(e=>e!==n):[...a,n]}}}),publishRota:t=>e({rotaPublished:t}),addLeave:t=>e(e=>({leave:[{...t,id:A('lv'),status:'pending'},...e.leave]})),setLeave:(t,n)=>e(e=>({leave:e.leave.map(e=>e.id===t?{...e,status:n}:e)})),addSwap:t=>e(e=>({swaps:[{...t,id:A('sw'),status:'open'},...e.swaps]})),setSwap:(t,n)=>e(e=>{const a=e.swaps.find(e=>e.id===t);return{shifts:'approved'===n&&a?.toId?e.shifts.map(e=>e.id===a.shiftId?{...e,staffId:a.toId}:e):e.shifts,swaps:e.swaps.map(e=>e.id===t?{...e,status:n}:e)}}),toggleAvail:(t,n)=>e(e=>{const a=e.availability[t]??[];return{availability:{...e.availability,[t]:a.includes(n)?a.filter(e=>e!==n):[...a,n]}}}),clock:(t,n,a,i,s,r)=>e(e=>{const o=e.attendance.filter(e=>e.staffId===t&&e.in&&!e.out&&new Date(i).getTime()-new Date(e.in).getTime()<72e6).sort((e,t)=>t.in.localeCompare(e.in))[0];if('in'===a)return o?e:{attendance:[...e.attendance,{id:(0,p.uuid)(),staffId:t,date:n,in:i,inSite:s}]};const d=e=>e?.map(e=>e.end?e:{...e,end:i});return o?{attendance:e.attendance.map(e=>e.id===o.id?{...e,out:i,outSite:s,breakMins:r??D({...e,breaks:d(e.breaks)}),breaks:d(e.breaks)}:e)}:e}),adjustClock:(t,n,a,i,s,r)=>e(e=>{const o=e.attendance.find(e=>e.id===t),d=e.staff.find(e=>e.id===o?.staffId),c=o?.[n]?new Date(o[n]).toTimeString().slice(0,5):'none';return{attendance:e.attendance.map(e=>e.id===t?{...e,[n]:a,adjusted:{by:i,at:r,reason:s}}:e),attLog:[{id:A('al'),at:r,text:`${i} changed ${d?.name??'staff'} clock-${n} from ${c} to ${new Date(a).toTimeString().slice(0,5)}: ${s}`},...e.attLog]}}),patchAttendance:(t,n,a)=>e(e=>({attendance:e.attendance.map(e=>e.id===t?{...e,...n,geo:a?[...e.geo??[],a].slice(-20):e.geo}:e)})),breakToggle:(t,a,i)=>{const s=n(),r=$(s.attendance,t,i);if(!r)return!1;const o=r.breaks??[],d=o.some(e=>!e.end);if('start'===a?d:!d)return!1;const c='start'===a?[...o,{start:i}]:o.map(e=>e.end?e:{...e,end:i});return e({attendance:s.attendance.map(e=>e.id===r.id?{...e,breaks:c,breakMins:D({breaks:c})}:e)}),!0},adjustBreak:(t,n,a,i,s)=>e(e=>{const r=e.attendance.find(e=>e.id===t),o=e.staff.find(e=>e.id===r?.staffId);return{attendance:e.attendance.map(e=>e.id===t?{...e,breakMins:n,adjusted:{by:a,at:s,reason:i}}:e),attLog:[{id:A('al'),at:s,text:`${a} changed ${o?.name??'staff'} break from ${r?.breakMins??0}m to ${n}m: ${i}`},...e.attLog]}}),overrideEntry:t=>{const a=n(),i=t.id?a.attendance.find(e=>e.id===t.id):void 0,s=t.reason.trim();if(s.length<3)return null;if(t.out&&t.out<=t.in)return null;const r=e=>e?new Date(e).toTimeString().slice(0,5):'none',o=(e,n,a)=>({at:t.now,by:t.by,byId:t.byId,action:e,from:n,to:a,reason:s}),d=a.staff.find(e=>e.id===t.staffId)?.name??'staff';let c;const u=[];if(i){const e=[...i.audit??[]];if(i.signOff&&(e.push(o('reopened','Confirmed','Awaiting sign-off')),u.push(`${t.by} reopened ${d}'s confirmed ${i.date} entry`)),i.in!==t.in&&(e.push(o('clock_in',r(i.in),r(t.in))),u.push(`${t.by} changed ${d} clock-in from ${r(i.in)} to ${r(t.in)}: ${s}`)),(i.out??'')!==(t.out??'')&&(e.push(o('clock_out',r(i.out),r(t.out))),u.push(`${t.by} changed ${d} clock-out from ${r(i.out)} to ${r(t.out)}: ${s}`)),(i.breakMins??0)!==t.breakMins&&(e.push(o('break',`${i.breakMins??0}m`,`${t.breakMins}m`)),u.push(`${t.by} changed ${d} break from ${i.breakMins??0}m to ${t.breakMins}m: ${s}`)),e.length===(i.audit??[]).length)return i;const n=t.out?i.breaks?.map(e=>e.end?e:{...e,end:t.out}):i.breaks;c={...i,in:t.in,out:t.out,breakMins:t.breakMins,breaks:n,signOff:void 0,adjusted:{by:t.by,at:t.now,reason:s},audit:e}}else c={id:t.id??(0,p.uuid)(),staffId:t.staffId,date:t.date,in:t.in,out:t.out,breakMins:t.breakMins,added:!0,adjusted:{by:t.by,at:t.now,reason:s},audit:[o('added',void 0,`${r(t.in)}\u2013${t.out?r(t.out):'open'}, break ${t.breakMins}m`)]},u.push(`${t.by} added ${d}'s ${t.date} entry ${r(t.in)}\u2013${t.out?r(t.out):'open'} (break ${t.breakMins}m): ${s}`);return t.request&&(c={...c,audit:[...c.audit??[],o('request_applied')]}),h.send?.('attendance_override',c,{reason:s}),e(e=>({attendance:i?e.attendance.map(e=>e.id===i.id?c:e):[...e.attendance,c],attLog:[...u.reverse().map(e=>({id:A('al'),at:t.now,text:e})),...e.attLog]})),c},confirmEntries:(t,a,i,s)=>{const r=n(),o=new Set(t),d=[],c=r.attendance.map(e=>{if(!o.has(e.id)||!e.out||e.signOff)return e;const t={...e,signOff:{by:a,byId:i,at:s},audit:[...e.audit??[],{at:s,by:a,byId:i,action:'confirmed',from:'Awaiting sign-off',to:'Confirmed'}]};return d.push(t),t});return d.length?(d.forEach(e=>h.send?.('attendance_confirm',e)),e({attendance:c,attLog:[{id:A('al'),at:s,text:`${a} confirmed ${d.length} ${1===d.length?'entry':'entries'} (${[...new Set(d.map(e=>e.date))].join(', ')})`},...r.attLog]}),d.length):0},addTimeRequest:t=>e(e=>({timeRequests:[{...t,id:(0,p.uuid)(),status:'open'},...e.timeRequests]})),resolveTimeRequest:(t,a,i,s)=>{const r=n().timeRequests.find(e=>e.id===t);if(!r||'open'!==r.status)return;const o={...r,status:a,resolvedBy:i,resolvedAt:s};h.send?.('time_request_resolve',o),e(e=>({timeRequests:e.timeRequests.map(e=>e.id===t?o:e)}))},setGeofence:t=>e(e=>({geofence:{...e.geofence,...t}})),setSimLocation:t=>e({simLocation:t}),giveConsent:(t,n)=>e(e=>({consent:{...e.consent,[t]:n}})),resetOwner:()=>e(U()),syncRoster:()=>e(e=>{if(t.IS_ISOLATED_VENUE||e.rosterVersion===l.ROSTER_VERSION)return e;const n=new Map(e.staff.map(e=>[e.id,e]));return{staff:[...j().map(e=>({...e,active:n.get(e.id)?.active??!0})),...e.staff.filter(e=>!l.ROSTER.some(t=>t.id===e.id)&&!B.includes(e.id))],hourly:{...e.hourly,...C()},rosterVersion:l.ROSTER_VERSION}})}),{name:'covercharge-owner-v1',version:6,storage:(0,f.createJSONStorage)(()=>c.default),migrate:async(e,t)=>{if(s.LIVE_VENUE_BUILD&&e)return await(0,o.archiveChefCache)('owner',e),{...e,...(0,i.stripOwnerLiveSamples)(e)};if(e&&t<2&&Array.isArray(e.quickLinks)&&(e.quickLinks=e.quickLinks.map(e=>_.includes(e.id)||'Website bookings'===e.group?{...e,staff:!1}:e)),e&&t<3){const t=U();Object.assign(e,{staff:t.staff,hourly:t.hourly,shifts:t.shifts,leave:t.leave,swaps:t.swaps,availability:t.availability,attendance:[],attLog:[],consent:{},chat:[],chatMuted:{},troncHistory:[],staffAs:t.staffAs,previewRole:'owner',rosterVersion:l.ROSTER_VERSION,rotaPublished:void 0})}if(e&&t<4){const t=I(b(new Date));e.shifts=(e.shifts??[]).map(e=>e.date?e:{...e,date:y(t,e.day??0),published:!0}),e.timeRequests=e.timeRequests??[]}return s.LIVE_VENUE_BUILD&&e&&(Object.assign(e,(0,i.stripOwnerLiveSamples)(e)),e.chat=(e.chat||[]).filter(e=>!(0,r.isSeedChefChat)(e)),e.suppliers=(e.suppliers||[]).filter(e=>!/^sup-[1-9]$/.test(e.id)||!/^(Example|Sample)\b/.test(e.name)),e.supplierOrders=(e.supplierOrders||[]).filter(e=>!/\(example\)/i.test(e.by||''))),e}})),q=(e,t,n)=>e?.salaried&&null==t?'Owner, no hourly wage':null==t?'Not set':`${n(t)}/h`,B=['st-2','st-3','st-4','st-5'],x={owner:'Owner',manager:'Manager',staff:'Staff'},K={forecasts:e=>'staff'!==e,manage:e=>'staff'!==e,staffAdmin:e=>'owner'===e,billing:e=>'owner'===e,takings:e=>'staff'!==e,publishSocial:e=>'staff'!==e};const W=e=>[e.name.replace(/\s*\([^)]*\)\s*$/,'').replace(' (example)',''),e.nickname??''].map(e=>e.trim().toLowerCase()).filter(Boolean).flatMap(e=>[e,e.split(' ')[0]]).filter((e,t,n)=>n.indexOf(e)===t),F=(e,t)=>{const n=t.trim().toLowerCase();if(!n)return!1;const a=W(e);return a.includes(n)||a.includes(n.split(' ')[0])},G=(e,t)=>{const n=t.trim().toLowerCase();return!n||[e.name,e.nickname,e.job,e.dept].some(e=>(e??'').toLowerCase().includes(n))}},856,[5,6,1174,1093,833,1025,1096,1082,952,1091,14,1034]); +__d(function(g,r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useSpecials",{enumerable:!0,get:function(){return _}});var e,t=r(_d[0]),s=r(_d[1]),i=r(_d[2]),n=r(_d[3]),o=r(_d[4]),c=(e=o)&&e.__esModule?e:{default:e},l=r(_d[5]),d=r(_d[6]),h=r(_d[7]),u=r(_d[8]),y=r(_d[9]);const p=()=>{try{return(0,u.nowFrom)(u.useStore.getState().clock)}catch{return new Date}};let S=0;const f=()=>`sb-${Date.now().toString(36)}${(S++).toString(36)}`,b=(e,t)=>u.useStore.setState(s=>({audit:[{id:`au-${f()}`,restaurantId:e,at:p().toISOString(),kind:'allergy',text:t},...s.audit].slice(0,300)})),_=(0,l.create)()((0,d.persist)((e,t)=>({...n.IS_ISOLATED_VENUE||s.LIVE_VENUE_BUILD?{current:{},history:[]}:(0,h.seedSpecials)(p()),post:(t,s,i,n)=>{e(e=>(0,h.postBoard)(e,t,s,i,n,p(),f())),s.items.length&&b(t,`Specials board: allergens for ${s.items.length} typed special${1===s.items.length?'':'s'} checked and signed off by ${i}`)},clear:(t,s)=>{e(e=>(0,h.clearBoard)(e,t)),b(t,`Specials board cleared by ${s}`)},reuse:(s,i,n,o)=>{const c=t().history.find(e=>e.id===i);e(e=>(0,h.reuseBoard)(e,s,i,n,o,p(),f())),c?.items.length&&b(s,`Specials board re-used: ${c.items.length} typed special${1===c.items.length?'':'s'}, allergens as previously checked, signed off by ${n}`)},remove:t=>e(e=>(0,h.deleteFromHistory)(e,t))}),{name:'covercharge-specials-v1',storage:(0,d.createJSONStorage)(()=>c.default),version:1,partialize:e=>({current:e.current,history:e.history})})),E=async()=>{if(!(0,y.liveData)())return;const e=_.getState(),n=e=>String(e.id).startsWith('sb-seed')&&(!s.LIVE_VENUE_BUILD||(0,t.demoActor)(e.postedBy)&&(!e.allergenCheck||(0,t.demoActor)(e.allergenCheck.by))&&(!e.photo||e.photo===h.SAMPLE_PHOTO)&&e.items.every(e=>/\(sample\)/i.test(e.name))),o=Object.fromEntries(Object.entries(e.current).filter(([,e])=>!(e&&n(e)))),c=e.history.filter(e=>!n(e));Object.keys(o).length===Object.keys(e.current).length&&c.length===e.history.length||(s.LIVE_VENUE_BUILD&&await(0,i.archiveChefCache)('specials',{current:e.current,history:e.history}),_.setState({current:o,history:c}))};(0,y.onDataModeChange)(E);try{_.persist?.onFinishHydration?.(E)}catch{}E()},857,[1025,833,1096,5,1082,952,1091,858,872,1081]); +__d(function(g,r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SAMPLE_PHOTO",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"HISTORY_MAX",{enumerable:!0,get:function(){return n}}),e.parsePrice=function(t){const n=t.trim().replace(/^\xa3\s*/,'');return n?/^\d{1,3}(\.\d{1,2})?$/.test(n)?Math.round(100*parseFloat(n)):NaN:null},Object.defineProperty(e,"priceText",{enumerable:!0,get:function(){return s}}),e.itemProblems=a,e.draftProblems=i,e.cycleAllergen=function(t,n){const s={...t};s[n]?'contains'===s[n]?s[n]='may':delete s[n]:s[n]='contains';return s},e.postBoard=function(t,n,s,a,l,c,d){const u=i(s);if(u.length)throw new Error(u[0]);const p={id:d,restaurantId:n,photo:s.photo,app:l,postedBy:a,postedAt:c.toISOString(),items:s.items.map(t=>({...t,name:t.name.trim(),description:t.description.trim()})),allergenCheck:s.items.length?{by:a,at:c.toISOString()}:null};return{current:{...t.current,[n]:p},history:o(t.history,t.current[n],n)}},e.clearBoard=function(t,n){return{current:{...t.current,[n]:null},history:o(t.history,t.current[n],n)}},e.reuseBoard=function(t,n,s,a,i,l,c){const d=t.history.find(t=>t.id===s&&t.restaurantId===n);if(!d)return t;const u={...d,id:c,app:i,postedBy:a,postedAt:l.toISOString(),reusedFrom:d.id,allergenCheck:d.items.length?{by:a,at:l.toISOString()}:null},p={...t,history:t.history.filter(t=>t.id!==s)};return{current:{...t.current,[n]:u},history:o(p.history,t.current[n],n)}},e.deleteFromHistory=function(t,n){return{...t,history:t.history.filter(t=>t.id!==n)}},Object.defineProperty(e,"historyFor",{enumerable:!0,get:function(){return l}}),e.whenText=h,Object.defineProperty(e,"isToday",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"freshness",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"lastUpdated",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"boardSummary",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"SAMPLE_ITEMS",{enumerable:!0,get:function(){return k}}),e.seedSpecials=function(n){const s=60*n.getHours()+n.getMinutes()>=702?S(n,0,11,42):new Date(n.getTime()-6e5),a=S(n,1,11,20),i=S(n,3,12,5);return{current:{anchorage:{id:'sb-seed-today',restaurantId:'anchorage',photo:null,items:k,postedAt:s.toISOString(),postedBy:'Head Chef (example)',app:'chef',allergenCheck:{by:'Head Chef (example)',at:s.toISOString()}}},history:[{id:'sb-seed-yday',restaurantId:'anchorage',photo:null,postedAt:a.toISOString(),postedBy:'Duty Manager (example)',app:'managers',allergenCheck:{by:'Duty Manager (example)',at:a.toISOString()},items:[{id:'sp-y1',name:'Pan-fried sea bass, samphire, brown shrimp butter (sample)',description:'Sample dish.',price:2100,allergens:{fish:'contains',crustaceans:'contains',milk:'contains'}},{id:'sp-y2',name:'Smoked haddock fishcake, poached egg (sample)',description:'Sample dish: with wholegrain mustard sauce.',price:1250,allergens:{fish:'contains',eggs:'contains',gluten:'contains',milk:'contains',mustard:'contains'}},{id:'sp-y3',name:'Lemon posset, shortbread (sample)',description:'Sample pudding.',price:750,allergens:{milk:'contains',gluten:'contains'}}]},{id:'sb-seed-photo',restaurantId:'anchorage',photo:t,items:[],postedAt:i.toISOString(),postedBy:'Head Chef (example)',app:'chef',allergenCheck:null}]}};const t='sample:chalkboard',n=8;const s=t=>null===t?'Ask your server':`\xa3${(t/100).toFixed(2)}`;function a(t){const n=[];t.name.trim().length<3&&n.push('Add a dish name'),null!==t.price&&(!Number.isFinite(t.price)||t.price<=0||t.price>5e4)&&n.push('Check the price');const s=Object.keys(t.allergens).length;return s||t.noAllergens||n.push('Choose its allergens, or tick \u201cNone of the 14\u201d'),s&&t.noAllergens&&n.push('Allergens chosen and \u201cNone of the 14\u201d both ticked'),n}function i(t){const n=[];return t.photo||t.items.length||n.push('Add a photo of the board or type at least one special'),t.items.forEach((t,s)=>a(t).forEach(t=>n.push(`Special ${s+1}: ${t}`))),t.items.length&&!t.allergensChecked&&n.push('Confirm you have checked the allergens'),n}const o=(t,s,a)=>{if(!s)return t;return[...[s,...t.filter(t=>t.restaurantId===a&&t.id!==s.id)].slice(0,n),...t.filter(t=>t.restaurantId!==a)]};const l=(t,n)=>t.history.filter(t=>t.restaurantId===n),c=t=>String(t).padStart(2,'0'),d=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],u=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],p=(t,n)=>t.getFullYear()===n.getFullYear()&&t.getMonth()===n.getMonth()&&t.getDate()===n.getDate();function h(t,n){const s=new Date(t),a=`${c(s.getHours())}:${c(s.getMinutes())}`;if(p(s,n))return`today at ${a}`;const i=new Date(n);return i.setDate(i.getDate()-1),p(s,i)?`yesterday at ${a}`:`${d[s.getDay()]} ${s.getDate()} ${u[s.getMonth()]} at ${a}`}const m=(t,n)=>p(new Date(t),n),y=(t,n)=>`Updated ${h(t.postedAt,n)}`,f=(t,n)=>`Last updated ${h(t.postedAt,n)} by ${t.postedBy}`,b=t=>[t.photo?'Photo':'',t.items.length?`${t.items.length} typed special${1===t.items.length?'':'s'}`:''].filter(Boolean).join(' + '),S=(t,n,s,a)=>{const i=new Date(t);return i.setDate(i.getDate()-n),i.setHours(s,a,0,0),i},k=[{id:'sp-hake',name:'Grilled hake, crushed new potatoes, salsa verde (sample)',description:'Sample dish: day-boat hake, lemon and caper salsa verde.',price:1950,allergens:{fish:'contains',mustard:'contains',sulphites:'may'}},{id:'sp-scallops',name:'Half-shell scallops, garlic and herb butter (sample)',description:'Sample dish: three scallops grilled in the shell, crusty bread.',price:1400,allergens:{molluscs:'contains',milk:'contains',gluten:'contains'}},{id:'sp-crab',name:'Crab and chilli linguine (sample)',description:'Sample dish: brown and white crab meat, chilli, parsley, lemon.',price:1850,allergens:{crustaceans:'contains',gluten:'contains',eggs:'contains',molluscs:'may'}},{id:'sp-mussels',name:'Mussels in cider and leek cream (sample)',description:'Sample dish: rope-grown mussels, dry cider, leeks, cream. Main with chips.',price:1300,allergens:{molluscs:'contains',milk:'contains',sulphites:'contains',celery:'may'}}]},858,[]); +__d(function(g,r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"addressWithoutInvite",{enumerable:!0,get:function(){return u.addressWithoutInvite}}),Object.defineProperty(_e,"inviteFromLocation",{enumerable:!0,get:function(){return u.inviteFromLocation}}),Object.defineProperty(_e,"useSession",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"rosterPerson",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"APP_NAME",{enumerable:!0,get:function(){return w}}),_e.sha256Hex=h,_e.inviteFromText=function(e){const t=e.trim(),n=t.match(/[?&#](?:invite|i)=([A-Za-z0-9_-]{10,})/);return n?n[1]:/^[A-Za-z0-9_-]{10,}$/.test(t)?t:null},_e.personForInvite=async function(e){if(a.IS_ISOLATED_VENUE)return;const t=await h(e);return t?l.ROSTER.find(e=>e.tokenHash===t):void 0},Object.defineProperty(_e,"DEVICE_KEY",{enumerable:!0,get:function(){return m}}),_e.deviceId=function(){try{if('undefined'==typeof localStorage)return null;let e=localStorage.getItem(m);if(!e||!/^[A-Za-z0-9_-]{16,64}$/.test(e)){const t=new Uint8Array(18);if(globalThis.crypto?.getRandomValues?.(t),!t.some(e=>e))for(let e=0;ee.toString(16).padStart(2,'0')).join(''),localStorage.setItem(m,e)}return e}catch{return null}},Object.defineProperty(_e,"START_INVITE",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"START_GO",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"START_LOYALTY_CODE",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"START_TABLE_TOKEN",{enumerable:!0,get:function(){return v}}),_e.appUrl=function(e,t){if('undefined'==typeof window||!window.location)return null;const{origin:n,pathname:o}=window.location,i=o.match(/^(.*?\/)(owner|staff|chef|display|customer)-app(\/|$)/),a=i?i[1]:'/';return`${n}${a}${e}-app/index.html${t?`#invite=${encodeURIComponent(t)}`:''}`},_e.levelJob=function(e,t){const n=(e??'').trim(),o=(t??'').trim();return n?!o||o.toLowerCase().startsWith(n.toLowerCase())?o||n:`${n} \xb7 ${o}`:o};var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},o=r(d[1]),i=r(d[2]),a=r(d[3]),c=r(d[4]),l=r(d[5]),u=r(d[6]);const s=(0,o.create)()((0,i.persist)(e=>({meId:null,welcomed:{},signIn:t=>e({meId:t,signedInAt:(new Date).toISOString()}),signOut:()=>e({meId:null,signedInAt:void 0}),markWelcomed:t=>e(e=>({welcomed:{...e.welcomed,[t]:(new Date).toISOString()}}))}),{name:'covercharge-session-v1',storage:(0,i.createJSONStorage)(()=>n.default),version:1})),f=e=>!a.IS_ISOLATED_VENUE&&e?l.ROSTER.find(t=>t.id===e):void 0,w={owner:'CoverCharge for Managers',staff:'CoverCharge for Staff',chef:'CoverCharge for Head Chef'};async function h(e){const t=globalThis.crypto?.subtle;if(!t)return null;const n=await t.digest('SHA-256',(new TextEncoder).encode(e));return Array.from(new Uint8Array(n)).map(e=>e.toString(16).padStart(2,'0')).join('')}const m=(0,a.venueKey)('covercharge-device-id');const p=(()=>{try{if('undefined'==typeof window||!window.location)return null;const e=(0,a.venueKey)(`cc-pending-invite:${c.APP_VARIANT}`);let t=(0,u.inviteFromLocation)(window.location.search,window.location.hash);try{t?localStorage.setItem(e,t):t=localStorage.getItem(e)}catch{}if(t&&!/^[A-Za-z0-9_-]{10,64}$/.test(t)&&(t=null),t&&window.history?.replaceState){const e=()=>{try{/[?&#]invite=/.test(window.location.href)&&window.history.replaceState(window.history.state,'',(0,u.addressWithoutInvite)(window.location.href))}catch{}};e();try{const e=window.history;for(const t of['pushState','replaceState']){const n=e[t].bind(e);e[t]=(e,t,o)=>n(e,t,null==o?o:/[?&#]invite=/.test(String(o))?(0,u.addressWithoutInvite)(new URL(String(o),window.location.href).toString()):o)}}catch{}for(const t of[300,1e3,2500,5e3,1e4,2e4])setTimeout(e,t)}return t}catch{return null}})(),y=(()=>{try{return'undefined'!=typeof window&&window.location?new URLSearchParams(window.location.search).get('go'):null}catch{return null}})(),S=(()=>{try{const e='undefined'!=typeof window&&window.location?new URLSearchParams(window.location.search).get('loyalty'):null;return e&&/^[A-Za-z0-9-]{4,12}$/.test(e)?e.toUpperCase():null}catch{return null}})(),v=(()=>{try{const e='undefined'!=typeof window&&window.location?new URLSearchParams(window.location.search).get('table'):null;return e&&/^[A-Za-z2-9]{16}$/.test(e)?e.toUpperCase():null}catch{return null}})()},859,[1082,952,1091,5,806,14,1116]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.LoyaltyLive=function({slug:e,venue:r}){const{info:t,card:l,loading:i,err:u,load:y}=p(e),[S,v]=(0,n.useState)('');return t?t.cardOn||l?(0,f.jsxs)(o.Screen,{title:"Stamp card",subtitle:`${r}. This card is just for ${r}.`,children:[S?(0,f.jsx)(o.Banner,{kind:"success",title:S}):null,t.cardOn?null:(0,f.jsxs)(o.Banner,{kind:"info",children:[r," has paused the stamp card. Your stamps and rewards are kept."]}),l?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(o.H2,{children:[l.stamps," of ",l.needed," stamps"]}),(0,f.jsxs)(o.T,{colour:h.colours.gold,weight:"semibold",children:["Reward: ",l.reward]})]}),(0,f.jsx)(w,{n:l.stamps,of:l.needed}),(0,f.jsxs)(o.Muted,{children:["Staff add a stamp when you visit. ",t.stampExpiryDays?`Stamps last ${t.stampExpiryDays} days.`:'']})]}),l.rewards.length?(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsx)(o.H2,{children:"Ready to use"}),l.rewards.map(e=>(0,f.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(o.T,{weight:"semibold",style:{flex:1},children:e.title}),(0,f.jsx)(o.Muted,{children:e.expiresAt?`Use by ${x(e.expiresAt)}`:''})]},e.id)),(0,f.jsx)(o.Muted,{children:"Show this screen or your card to staff when you'd like to use a reward. Staff mark it used; each one works once."})]}):null,(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Your card"}),(0,f.jsx)(o.Muted,{children:"Staff scan this, or look you up by name, to add a stamp."}),(0,f.jsx)(s.QR,{value:(0,c.cardQr)(e,l.cardNo),size:170}),(0,f.jsx)(o.T,{center:!0,weight:"semibold",children:l.name}),(0,f.jsx)(o.T,{center:!0,size:20,weight:"bold",colour:h.colours.gold,children:(0,c.prettyCardNo)(l.cardNo)})]}),(0,f.jsx)(b,{slug:e,joined:!0,onDone:v}),t.referralOn?(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Bring a friend"}),(0,f.jsx)(o.T,{children:"Your code"}),(0,f.jsx)(o.T,{size:28,weight:"bold",colour:h.colours.gold,center:!0,children:l.referralCode}),(0,f.jsxs)(o.Muted,{children:["Your friend types it when they join. After their first stamp you get: ",t.referralGiver,". They get: ",t.referralFriend,"."]}),(0,f.jsxs)(o.Muted,{children:["Waiting: ",l.referrals.waiting," \xb7 Rewarded: ",l.referrals.rewarded]})]}):null,(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"History"}),l.history.length?l.history.map((e,n)=>(0,f.jsxs)(o.Muted,{children:[x(e.at)," ",j(e.at)," \xb7 ",e.what]},n)):(0,f.jsx)(o.Muted,{children:"No stamps yet."})]}),(0,f.jsx)(C,{slug:e}),(0,f.jsx)(k,{slug:e})]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsxs)(o.H2,{children:[t.needed," stamps = ",t.reward]}),(0,f.jsx)(w,{n:0,of:t.needed})]}),(0,f.jsx)(T,{slug:e,venue:r,referralOn:t.referralOn,onJoined:e=>v(e.note?`You're in. ${e.note}`:"You're in. Show your card to staff on your next visit.")}),(0,f.jsx)(b,{slug:e,joined:!1,onDone:v})]}),(0,f.jsxs)(o.Muted,{children:["Tip: your card is saved by ",r,", not on this phone, so you won't lose it. Rewards are kept on food, not drinks."]})]}):(0,f.jsxs)(o.Screen,{title:"Stamp card",subtitle:r,children:[(0,f.jsx)(o.Banner,{kind:"info",title:`${r} hasn't started a stamp card yet`,children:"When they do, you can join here."}),(0,f.jsxs)(o.Muted,{children:["Tip: offers from ",r," are under Offers on the home screen."]})]}):(0,f.jsxs)(o.Screen,{title:"Stamp card",subtitle:r,children:[u?(0,f.jsx)(o.Banner,{kind:"warn",title:"Couldn't load the stamp card",children:u}):(0,f.jsx)(o.Muted,{children:i?'Loading your card\u2026':'Loading\u2026'}),u?(0,f.jsx)(o.Button,{kind:"secondary",label:"Try again",onPress:y}):null,(0,f.jsxs)(o.Muted,{children:["Tip: your card is saved by ",r,", so it's the same on any phone once you sign in with a code."]})]})},_e.OffersLive=function({slug:e,venue:n}){const{info:r,err:t,load:s}=p(e);return(0,f.jsxs)(o.Screen,{title:"Offers",subtitle:n,children:[!r&&t?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(o.Banner,{kind:"warn",title:"Couldn't load offers",children:t}),(0,f.jsx)(o.Button,{kind:"secondary",label:"Try again",onPress:s})]}):null,r?r.offers.length?r.offers.map(e=>(0,f.jsxs)(o.Card,{children:[(0,f.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(o.T,{weight:"semibold",style:{flex:1},children:e.title}),(0,f.jsx)(o.Badge,{kind:"gold",label:"Offer"})]}),e.details?(0,f.jsx)(o.Muted,{children:e.details}):null,e.endsOn?(0,f.jsxs)(o.Muted,{children:["Until ",x(e.endsOn+'T12:00:00Z')]}):null]},e.id)):(0,f.jsxs)(o.Muted,{children:["No offers from ",n," right now."]}):t?null:(0,f.jsx)(o.Muted,{children:"Loading\u2026"}),(0,f.jsxs)(o.Muted,{children:["Tip: offers are set by ",n," and shown here only. Nothing is sent to your phone. Drinks promotions follow Scottish licensing rules."]})]})},_e.ReferLive=function({slug:e,venue:n}){const{info:r,card:t}=p(e);return(0,f.jsxs)(o.Screen,{title:"Bring a friend",subtitle:n,children:[r?r.referralOn?(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsxs)(o.H2,{children:["You get: ",r.referralGiver]}),(0,f.jsxs)(o.T,{children:["Your friend gets: ",r.referralFriend]}),(0,f.jsx)(o.Muted,{children:"Your friend joins the stamp card with your code. You both get your reward after their first stamp."}),t?(0,f.jsx)(o.T,{size:30,weight:"bold",colour:h.colours.gold,center:!0,children:t.referralCode}):(0,f.jsx)(o.Banner,{kind:"info",children:"Join the stamp card first to get your code."}),t?(0,f.jsxs)(o.Muted,{children:["Waiting: ",t.referrals.waiting," \xb7 Rewarded: ",t.referrals.rewarded]}):null]}):(0,f.jsxs)(o.Banner,{kind:"info",children:[n," isn't running Bring a friend right now."]}):(0,f.jsx)(o.Muted,{children:"Loading\u2026"}),(0,f.jsxs)(o.Muted,{children:["Tip: tell your friend the code yourself. One reward per friend; it doesn't work on your own card, and ",n," may cap it each month."]})]})},_e.useLiveTile=function(e){const r=(0,u.useGuestLoyalty)(n=>n.info[e]),t=(0,u.useGuestLoyalty)(n=>n.card[e]);return(0,n.useEffect)(()=>{(0,u.refreshGuest)(e).catch(()=>{})},[e]),{stamps:r?t?`${t.stamps} of ${t.needed}`:r.cardOn?'Join':void 0:void 0,offers:r?.offers.length}};var n=_r(d[0]),r=e(n),t=e(_r(d[1])),s=_r(d[2]),o=_r(d[3]),l=_r(d[4]),i=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]),f=_r(d[9]);const x=e=>{try{return new Date(e).toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric',timeZone:'Europe/London'})}catch{return e.slice(0,10)}},j=e=>{try{return new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return''}};let y=!1;function p(e){const t=(0,u.useGuestLoyalty)(n=>n.info[e]),s=(0,u.useGuestLoyalty)(n=>n.card[e]),o=(0,u.useGuestLoyalty)(n=>!!n.loading[e]),[l,i]=(0,n.useState)(''),h=r.default.useCallback(()=>{i(''),(0,u.refreshGuest)(e).catch(e=>i((0,c.plainError)(e)))},[e]);return(0,n.useEffect)(()=>{h();const e=setInterval(h,3e4);return()=>clearInterval(e)},[h]),{info:t,card:s,loading:o,err:l,load:h}}function w({n:e,of:n}){return(0,f.jsx)(t.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:10,justifyContent:'center',paddingVertical:8},children:Array.from({length:n}).map((n,r)=>(0,f.jsx)(t.default,{accessibilityLabel:r!y&&i.START_LOYALTY_CODE?(y=!0,i.START_LOYALTY_CODE):''),[h,x]=(0,n.useState)(!1),[j,p]=(0,n.useState)('');return(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:r?'Got a code from staff?':'Already have a card?'}),(0,f.jsx)(o.Muted,{children:r?'Staff can give you a one-time code for a stamp. Type it here.':'Ask staff for a sign-in code, or make one on your other phone (Stamp card \u203a Use on another phone). Type it here to open your card.'}),(0,f.jsx)(o.Field,{label:"Code",value:s,onChangeText:e=>l(e.toUpperCase()),autoCapitalize:"characters",maxLength:9,placeholder:"e.g. 7KQ2MX",testID:"loyalty-code"}),j?(0,f.jsx)(o.Banner,{kind:"warn",children:j}):null,(0,f.jsx)(o.Button,{label:h?'Checking\u2026':'Use code',disabled:h||s.replace(/[^A-Za-z0-9]/g,'').length<6,onPress:async()=>{x(!0),p('');try{const n=await(0,u.guestClaim)(e,s);n.ok?(l(''),t(n.linked?'This phone now shows your card.':n.card.newReward?`Stamp added. You've earned: ${n.card.rewards[n.card.rewards.length-1]?.title??'a reward'}!`:'Stamp added.')):p(n.error)}catch(e){p((0,c.plainError)(e))}finally{x(!1)}},testID:"loyalty-use-code"})]})}function T({slug:e,venue:r,referralOn:t,onJoined:s}){const i=(0,l.useCustomer)(),[x,j]=(0,n.useState)(i.name??''),[y,p]=(0,n.useState)(i.phone??''),[w,b]=(0,n.useState)(i.email??''),[T,C]=(0,n.useState)(''),[k,S]=(0,n.useState)(!1),[v,L]=(0,n.useState)(!1),[M,B]=(0,n.useState)('');return(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsx)(o.H2,{children:"Join the stamp card"}),(0,f.jsx)(o.Muted,{children:"Only your name is needed. A phone number or email helps staff find your card if you lose this phone. Nothing is sent to you."}),(0,f.jsx)(o.Field,{label:"Your name",value:x,onChangeText:j,maxLength:60,testID:"loyalty-name"}),(0,f.jsx)(o.Field,{label:"Phone (optional)",value:y,onChangeText:p,keyboardType:"phone-pad",maxLength:20}),(0,f.jsx)(o.Field,{label:"Email (optional)",value:w,onChangeText:b,keyboardType:"email-address",autoCapitalize:"none",maxLength:120}),t?(0,f.jsx)(o.Field,{label:"Friend's code (optional)",value:T,onChangeText:e=>C(e.toUpperCase()),autoCapitalize:"characters",maxLength:8}):null,(0,f.jsx)(o.Toggle,{label:(0,c.consentText)(r),value:k,onChange:S,testID:"loyalty-consent"}),M?(0,f.jsx)(o.Banner,{kind:"warn",children:M}):null,(0,f.jsx)(o.Button,{label:v?'Joining\u2026':'Join',disabled:v||!k||!x.trim(),onPress:async()=>{L(!0),B('');try{s(await(0,u.guestJoin)(e,{name:x,phone:y,email:w,consent:k,consentText:(0,c.consentText)(r),referral:T}))}catch(e){B((0,c.plainError)(e))}finally{L(!1)}},testID:"loyalty-join"})]})}function C({slug:e}){const[r,t]=(0,n.useState)(null),[s,l]=(0,n.useState)('');return(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Use on another phone"}),(0,f.jsxs)(o.Muted,{children:["Make a code here, then on the other phone open ","the stamp card"," and type it under \"Already have a card?\". The code works once, for 15 minutes."]}),r?(0,f.jsx)(o.T,{size:30,weight:"bold",colour:h.colours.gold,center:!0,children:r.code}):null,r?(0,f.jsxs)(o.Muted,{center:!0,children:["Works until ",j(r.expiresAt)]}):null,s?(0,f.jsx)(o.Banner,{kind:"warn",children:s}):null,(0,f.jsx)(o.Button,{kind:"secondary",label:r?'Make a new code':'Make a code',onPress:()=>{l(''),(0,u.guestLinkCode)(e).then(t).catch(e=>l((0,c.plainError)(e)))}})]})}function k({slug:e}){const[r,t]=(0,n.useState)(!1),[s,l]=(0,n.useState)('');return(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Leave the stamp card"}),(0,f.jsx)(o.Muted,{children:"Your name, phone and email are removed and your stamps and rewards go. This can't be undone."}),s?(0,f.jsx)(o.Banner,{kind:"warn",children:s}):null,r?(0,f.jsxs)(o.Row,{gap:8,children:[(0,f.jsx)(o.Button,{kind:"danger",label:"Yes, remove me",onPress:()=>(0,u.guestLeave)(e).catch(e=>l((0,c.plainError)(e)))}),(0,f.jsx)(o.Button,{kind:"ghost",label:"Keep my card",onPress:()=>t(!1)})]}):(0,f.jsx)(o.Button,{kind:"ghost",label:"Leave the stamp card",onPress:()=>t(!0)})]})}},860,[30,127,869,813,819,859,1015,836,821,24]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"BUILTIN_LOGOS",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"HERO_LOGOS",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"HEADER_LOGO",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"ACCENTS",{enumerable:!0,get:function(){return z}}),_e.useBrandRid=k,_e.useBrand=L,_e.PoweredBy=O,_e.RestaurantLogo=S,_e.RestaurantHero=function({rid:e,size:o=200,showPlace:r=!0}){const c=L(e),u='wildings'===c.rid||'greenside'===c.rid||'kirkton'===c.rid||'abbotsford'===c.rid||(0,t.isQueuedVenue)(c.rid),b='yasmins'===c.rid?c.logo:u?w[c.rid]:c.custom?c.logo:w[c.rid]??c.logo;return(0,j.jsxs)(l.default,{testID:"restaurant-hero",style:{alignItems:'center',gap:6},children:[b?(0,j.jsx)(s.default,{source:b,accessibilityLabel:`${c.name} logo`,style:{width:o,height:o,borderRadius:!u&&c.custom?o/2:0},resizeMode:"contain"}):(0,j.jsx)(S,{rid:c.rid,size:o}),u?null:(0,j.jsx)(n.Text,{testID:"restaurant-hero-name",style:[{fontFamily:f.fonts.semibold,fontSize:26,lineHeight:34,color:f.colours.text,textAlign:'center'},(0,h.webLine)({lineHeight:34},26)],children:c.name}),r&&c.place?(0,j.jsx)(n.Text,{style:[{fontFamily:f.fonts.regular,fontSize:14,lineHeight:20,color:c.accentText,textAlign:'center'},(0,h.webLine)({lineHeight:20},14)],children:c.place}):null]})},_e.RestaurantBrand=function({rid:e,sub:t,size:o=T,nameSuffix:r}){const s=L(e);return(0,j.jsxs)(l.default,{style:{gap:2,flexShrink:1},children:[(0,j.jsx)(O,{}),(0,j.jsxs)(l.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,j.jsx)(S,{rid:s.rid,size:o}),(0,j.jsxs)(l.default,{style:{flexShrink:1},children:[(0,j.jsxs)(n.Text,{numberOfLines:1,style:[{fontFamily:f.fonts.semibold,fontSize:17,lineHeight:22,color:f.colours.text},(0,h.webLine)({lineHeight:22},17)],children:[s.name,r??'']}),t?(0,j.jsx)(n.Text,{numberOfLines:1,style:[{fontFamily:f.fonts.regular,fontSize:12,lineHeight:16,color:s.accentText},(0,h.webLine)({lineHeight:16},12)],children:t}):null]})]})]})};var t=_r(d[0]),n=_r(d[1]),o=_r(d[2]),r=e(_r(d[3])),s=e(_r(d[4])),l=e(_r(d[5])),c=_r(d[6]),u=_r(d[7]),f=_r(d[8]),h=_r(d[9]),b=_r(d[10]),x=_r(d[11]),y=_r(d[12]),j=_r(d[13]);const p={"3idiots":_r(d[14]),cecchinis:_r(d[15]),mrbasrais:_r(d[16]),yasmins:_r(d[17]),williewastles:_r(d[18]),rupeeroom:_r(d[19]),smokinggoat:_r(d[20]),pizzaioli:_r(d[21]),drunkencoo:_r(d[22]),abbotsford:_r(d[23]),kirkton:_r(d[24]),greenside:_r(d[25]),wildings:_r(d[26]),kirkmichael:_r(d[27]),souters:_r(d[28]),anchorage:_r(d[29]),saltmarsh:_r(d[30]),brae:_r(d[31])},w={"3idiots":_r(d[32]),cecchinis:_r(d[33]),mrbasrais:_r(d[34]),yasmins:_r(d[35]),williewastles:_r(d[36]),rupeeroom:_r(d[37]),smokinggoat:_r(d[38]),pizzaioli:_r(d[39]),drunkencoo:_r(d[40]),abbotsford:_r(d[41]),kirkton:_r(d[42]),greenside:_r(d[43]),wildings:_r(d[44]),kirkmichael:_r(d[45]),souters:_r(d[28]),anchorage:_r(d[46])};x.PITCH&&(delete p.anchorage,delete w.anchorage);const T=48,z=['#CFA45F','#D4AF61','#C9A24A','#E2C489','#F2EDE4','#A88B5A','#B08D57','#D9774B'];function k(e){const t=(0,o.useGlobalSearchParams)(),n=(0,u.useOwner)(e=>e.site),r='string'==typeof t.rid?t.rid:void 0;return b.IS_ISOLATED_VENUE?b.VENUE_RID:e??r??n??b.VENUE_RID}function L(e){const t=k(e),n=(0,c.useStore)(e=>e.restaurants.find(e=>e.id===t)),o=(0,u.useOwner)(e=>e.branding[t]),s=o?.logoUri?{uri:o.logoUri}:p[t],l=o?.accent??f.colours.gold,h=r.default.useMemo(()=>(0,y.checkAccent)(l,f.colours.bg,f.colours.onGold,f.colours.text),[l]);return{rid:t,name:n?.name??'Restaurant',place:n?.location??'',logo:s,accent:l,accentText:h.accentText,onAccent:h.onAccent,custom:!!o?.logoUri}}function O({size:e=10}){return(0,j.jsxs)(n.Text,{accessibilityLabel:"powered by CoverCharge",style:[{fontFamily:f.fonts.regular,fontSize:e,lineHeight:Math.round(1.35*e),color:f.colours.muted},(0,h.webLine)({lineHeight:Math.round(1.35*e)},e)],children:["powered by ",(0,j.jsx)(n.Text,{style:{fontFamily:f.fonts.semibold,color:f.colours.text},children:"Cover"}),(0,j.jsx)(n.Text,{style:{fontFamily:f.fonts.semibold,color:f.colours.gold},children:"Charge"})]})}function S({rid:e,size:t=T}){const o=L(e);if(o.logo)return(0,j.jsx)(s.default,{source:o.logo,accessibilityLabel:`${o.name} logo`,style:{width:t,height:t,borderRadius:o.custom?t/2:0},resizeMode:"contain"});const r=o.name.replace(/^The /,'').split(/\s+/).map(e=>e[0]).join('').slice(0,2).toUpperCase();return(0,j.jsx)(l.default,{accessibilityLabel:`${o.name} logo`,style:{width:t,height:t,borderRadius:t/2,borderWidth:2,borderColor:o.accentText,alignItems:'center',justifyContent:'center'},children:(0,j.jsx)(n.Text,{style:{fontFamily:f.fonts.bold,color:o.accentText,fontSize:.36*t},children:r})})}},861,[6,877,804,30,196,127,819,856,821,1211,5,2,1210,24,1214,1215,1216,1217,1218,1219,1220,1221,1222,1223,1224,1225,1226,1227,1228,1229,1230,1231,1232,1233,1234,1235,1236,1237,1238,1239,1240,1241,1242,1243,1244,1245,1246]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.FindPub=function({rid:e}){const p=(0,l.pubLocation)(e),[b,y]=(0,n.useState)(!1),[f,x]=(0,n.useState)(!1),[j,w]=(0,n.useState)(null),[I,v]=(0,n.useState)(null);if(!p)return null;const D=async()=>{y(!1),x(!0),v(null);const e=await(0,u.getFix)();x(!1),'object'==typeof e?(w(Math.round((0,c.distanceM)(p,e))),v(null)):(w(null),v('Your location was not shared. You can still use the address and open directions.'))};return(0,h.jsx)(o.Card,{children:(0,h.jsxs)(t.default,{testID:"find-pub",style:{gap:10},children:[(0,h.jsx)(o.T,{accessibilityRole:"header",weight:"bold",children:"Find us"}),(0,h.jsx)(o.T,{children:p.address}),(0,h.jsx)(o.Muted,{children:"See your approximate distance, or open directions. Location is optional and is never saved."}),(0,h.jsx)(o.Button,{testID:"find-pub-distance",label:f?'Finding your distance\u2026':'Find us \u2014 show my distance',accessibilityLabel:`Find ${p.name}, show my distance using my location once`,disabled:f,onPress:()=>y(!0)}),(0,h.jsxs)(t.default,{accessibilityLiveRegion:"polite",testID:"find-pub-result",children:[null!=j?(0,h.jsxs)(o.T,{children:["About ",j<1e3?`${j} m`:`${(j/1e3).toFixed(1)} km`," away, in a straight line."]}):null,I?(0,h.jsx)(o.T,{children:I}):null]}),(0,h.jsx)(o.Button,{testID:"find-pub-directions",kind:"secondary",label:"Open directions in Maps",accessibilityLabel:`Open directions to ${p.name}, ${p.address}, without sharing my location with CoverCharge`,onPress:()=>{s.default.openURL(`https://www.google.com/maps/dir/?api=1&destination=${encodeURIComponent(p.address)}`)}}),(0,h.jsx)(o.Sheet,{visible:b,onClose:()=>y(!1),title:"Use your location for distance?",testID:"find-pub-reason",children:(0,h.jsxs)(t.default,{style:{gap:12},children:[(0,h.jsxs)(o.T,{children:["We use your phone\u2019s location once to estimate how far you are from ",p.name,". Your position stays on this screen only: it is not stored or sent to the pub."]}),(0,h.jsx)(o.T,{children:"You can refuse location and still see the address and use directions."}),(0,h.jsx)(o.Button,{testID:"find-pub-allow",label:"Use my location once",onPress:()=>{D()}}),(0,h.jsx)(o.Button,{testID:"find-pub-cancel",kind:"secondary",label:"Not now \u2014 keep the address",onPress:()=>y(!1)})]})})]})})};var n=r(d[0]),s=e(r(d[1])),t=e(r(d[2])),o=r(d[3]),l=r(d[4]),c=r(d[5]),u=r(d[6]),h=r(d[7])},862,[30,239,127,813,989,954,1247,24]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.getSupabase=function(){if(_)return _;if(!(0,u.isSupabaseConfigured)())throw new Error('Supabase is not configured: set EXPO_PUBLIC_SUPABASE_URL and EXPO_PUBLIC_SUPABASE_ANON_KEY in .env.local');return _=(0,s.createClient)(u.SUPABASE_URL,u.SUPABASE_ANON_KEY,{auth:{storage:n.default,persistSession:!0,autoRefreshToken:!0,detectSessionInUrl:!1,storageKey:`${(0,o.syncNamespace)()}auth`},realtime:{params:{eventsPerSecond:10}}}),_},_e.setSupabaseClient=function(e){_=e};var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},s=r(d[1]),u=r(d[2]),o=r(d[3]);let _=null},863,[1082,1122,1079,1164]); +__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.VenueRequestForm=function({rid:e,kind:l,hotel:c,allDayHours:j,sessionHours:q,onClose:T}){const[D,f]=(0,o.useState)({name:'',phone:'',email:'',notes:'',date:(0,p.localDate)(),service:(0,t.isQueuedVenue)(e)||'greenside'===e?void 0:'Lunch',time:j||'greenside'===e?'10:00':'12:00',covers:2,checkIn:(0,p.localDate)(),checkOut:'',roomType:c?.roomTypes[0]?.id,guests:2,addDinner:!1}),v=e=>f(t=>({...t,...e})),[C,I]=(0,o.useState)(''),[S,w]=(0,o.useState)(''),[B,P]=(0,o.useState)(null),[R,Y]=(0,o.useState)(''),[M,N]=(0,o.useState)(!1),[$,V]=(0,o.useState)(!1),z=(0,o.useRef)(!1);(0,o.useEffect)(()=>{let s=!0;return(0,b.requestChallenge)(e,l).then(e=>{s&&P(e)}).catch(n=>{s&&Y((0,t.isQueuedVenue)(e)||['greenside','kirkton'].includes(e)?(0,b.requestMessage)(n).replace(/the hotel/g,'the restaurant'):(0,b.requestMessage)(n))}),()=>{s=!1}},[e,l]);const L=async()=>{if(z.current)return;const o=(0,t.isQueuedVenue)(e)?(0,s.queuedRequestError)(e,D,q):j&&'table'===l?(0,r.allDayRequestError)(D,j):(0,n.errorForVenue)(e,l,D,c);if(o)Y(o);else if(B&&C.trim()){z.current=!0,V(!0),Y('');try{await(0,b.sendVenueRequest)(e,l,D,B.id,C,S),N(!0)}catch(s){Y((0,t.isQueuedVenue)(e)||['greenside','kirkton'].includes(e)?(0,b.requestMessage)(s).replace(/the hotel/g,'the restaurant'):(0,b.requestMessage)(s))}finally{z.current=!1,V(!1)}}else Y('Complete the security check.')},F={minHeight:48,fontSize:18,color:y.colours.text};return(0,x.jsxs)(u.default,{testID:`venue-${l}-form`,style:{gap:16,alignItems:'stretch'},children:[(0,x.jsx)(h.H2,{children:'table'===l?'Book a table':'Book a room'}),(0,x.jsx)(h.T,{size:18,center:!0,children:'greenside'===e?'No payment is taken for this request. Deposit terms to confirm. This is a request, not an instant confirmation.':'No deposit. No payment. This is a request, not an instant confirmation.'}),M?(0,x.jsx)(h.Banner,{kind:"info",title:'greenside'===e?'Request sent. A Greenside manager must confirm your table.':c?.enabled?'Request sent. The hotel will contact you to confirm.':'Request sent. The venue will contact you to confirm.',children:"Nothing has been charged. No email or text is sent by this app."}):(0,x.jsxs)(x.Fragment,{children:['table'===l?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(k,{label:"Date (YYYY-MM-DD)",testID:"request-date",value:D.date,onChangeText:e=>v({date:e}),placeholder:"2026-11-20",style:F}),(0,t.isQueuedVenue)(e)||'greenside'===e||j?null:(0,x.jsx)(h.Row,{wrap:!0,children:['Lunch','Dinner'].map(e=>(0,x.jsx)(h.Button,{testID:`request-service-${e.toLowerCase()}`,label:e+(D.service===e?' \xb7 selected':''),kind:D.service===e?'primary':'secondary',onPress:()=>v({service:e,time:'Lunch'===e?'12:00':'18:00'}),style:{alignSelf:'auto'}},e))}),(0,x.jsx)(h.T,{size:18,weight:"semibold",center:!0,children:"Time within kitchen hours"}),(0,x.jsx)(h.Row,{wrap:!0,children:((0,t.isQueuedVenue)(e)?(0,s.queuedRequestSlots)(e,D.date||'',q):j?(0,r.allDaySlots)(D.date||'',j):(0,n.slotsForVenue)(e,D.date||'',D.service||'Lunch')).map(e=>(0,x.jsx)(h.Button,{testID:`request-time-${e.replace(':','')}`,label:e+(D.time===e?' \xb7 selected':''),kind:D.time===e?'primary':'secondary',onPress:()=>v({time:e}),style:{alignSelf:'auto'}},e))}),(0,x.jsx)(k,{label:"Covers",testID:"request-covers",keyboardType:"number-pad",value:String(D.covers??''),onChangeText:e=>v({covers:Number(e)}),style:F})]}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(h.T,{size:18,center:!0,children:[null==c?.bedrooms?'':`${c.bedrooms} bedrooms. `,c?.priceNote,"."]}),(0,x.jsx)(k,{label:"Check-in date (YYYY-MM-DD)",testID:"request-check-in",value:D.checkIn,onChangeText:e=>v({checkIn:e}),style:F}),(0,x.jsx)(k,{label:"Check-out date (YYYY-MM-DD)",testID:"request-check-out",value:D.checkOut,onChangeText:e=>v({checkOut:e}),style:F}),(0,x.jsx)(h.T,{size:18,weight:"semibold",center:!0,children:"Room type"}),c?.roomTypes.map(e=>(0,x.jsx)(h.Button,{testID:`request-room-${e.id}`,label:`${e.name} \xb7 ${null==e.pricePence?'Price to confirm with the hotel':`${e.from?'from ':''}\xa3${e.pricePence/100}`} \xb7 ${c.breakfast}${D.roomType===e.id?' \xb7 selected':''}`,kind:D.roomType===e.id?'primary':'secondary',onPress:()=>v({roomType:e.id})},e.id)),(0,x.jsx)(k,{label:"Guests",testID:"request-guests",keyboardType:"number-pad",value:String(D.guests??''),onChangeText:e=>v({guests:Number(e)}),style:F}),(0,x.jsx)(h.Button,{testID:"request-add-dinner",label:"Add dinner \xb7 "+(D.addDinner?'Yes':'No'),kind:D.addDinner?'primary':'secondary',onPress:()=>v({addDinner:!D.addDinner})}),(0,x.jsx)(h.T,{size:18,center:!0,children:"The hotel will arrange dinner details with you."})]}),(0,x.jsx)(k,{label:"Name",testID:"request-name",autoComplete:"name",value:D.name,onChangeText:e=>v({name:e}),style:F}),(0,x.jsx)(k,{label:"Phone",testID:"request-phone",keyboardType:"phone-pad",autoComplete:"tel",value:D.phone,onChangeText:e=>v({phone:e}),style:F}),(0,x.jsx)(k,{label:"Email",testID:"request-email",keyboardType:"email-address",autoCapitalize:"none",autoComplete:"email",value:D.email,onChangeText:e=>v({email:e}),style:F}),(0,x.jsx)(k,{label:'table'===l?'Notes (allergies, occasion)':'Notes',testID:"request-notes",multiline:!0,maxLength:2e3,value:D.notes,onChangeText:e=>v({notes:e}),style:F}),(0,x.jsx)(u.default,{style:{display:'none'},accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",children:(0,x.jsx)(k,{label:"Leave this empty",value:S,onChangeText:w})}),B?(0,x.jsx)(k,{label:`Security check: ${B.question} = ?`,testID:"request-answer",keyboardType:"number-pad",value:C,onChangeText:I,style:F}):(0,x.jsx)(h.T,{size:18,center:!0,children:"Preparing security check\u2026"}),R?(0,x.jsx)(h.Banner,{kind:"warn",title:"Please check your request",children:R}):null,(0,x.jsx)(h.Button,{testID:"request-submit",label:$?'Sending request\u2026':'Send request',disabled:$||!B,onPress:()=>{L()}})]}),(0,x.jsx)(h.Button,{kind:"secondary",label:M?'greenside'===e?'Back to the restaurant':c?.enabled?'Back to the hotel':'Back to Customer home':'Back to Customer home',onPress:T})]})};var e,t=_r(d[0]),s=_r(d[1]),n=_r(d[2]),r=_r(d[3]),o=_r(d[4]),l=_r(d[5]),u=(e=l)&&e.__esModule?e:{default:e},c=_r(d[6]),h=_r(d[7]),y=_r(d[8]),p=_r(d[9]),b=_r(d[10]),x=_r(d[11]);function k({label:e,...t}){return(0,x.jsxs)(u.default,{style:{gap:6,alignSelf:'stretch',width:'100%'},children:[(0,x.jsx)(h.T,{size:18,weight:"semibold",center:!0,children:e}),(0,x.jsx)(c.TextInput,{accessibilityLabel:e,placeholderTextColor:y.colours.muted,...t,style:[{minHeight:48,fontSize:18,color:y.colours.text,backgroundColor:y.colours.surface2,borderWidth:1,borderColor:y.colours.border,borderRadius:12,padding:12},t.multiline?{minHeight:96,textAlignVertical:'top'}:null,t.style]})]})}},864,[6,941,1371,1372,30,127,877,813,821,11,1021,24]); +__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"STEP_IDS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"STEP_TITLE",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"TEMPLATE_LABEL",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"DAY_NAMES",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"WEEK_ORDER",{enumerable:!0,get:function(){return u}}),e.cleanQuestionnaire=function(t,s){if(!t||'object'!=typeof t)return null;const o=t,n=o.venue??{},u=l(n.name,80);if(!u)return null;const b={};for(let a=0;a<7;a++){const t=o.hours?.days?.[a],s=Array.isArray(t)?p(t[0]):null,n=Array.isArray(t)?p(t[1]):null;b[a]=s&&n?[s,n]:null}const y=['cafe','bistro','restaurant','custom'].includes(o.tables?.template)?o.tables.template:'custom',f=(a,t)=>'number'==typeof a&&a>=0&&a<=t?Math.round(a):void 0,h=o.features??{};return{version:1,venueId:l(s??o.venueId,60)||'venue',source:'signup-form'===o.source||'from-config'===o.source?o.source:'imported',submittedAt:l(o.submittedAt,10),onboardedAt:l(o.onboardedAt,10),venue:{name:u,tagline:l(n.tagline,120),address:l(n.address,200),phone:l(n.phone,30),email:l(n.email,120),website:l(n.website,120),hasLogo:!!n.hasLogo},hours:{days:b,note:l(o.hours?.note,300)},tables:{template:y,tables:f(o.tables?.tables,300),covers:f(o.tables?.covers,2e3),areas:Array.isArray(o.tables?.areas)?o.tables.areas.map(a=>l(a,40)).filter(Boolean).slice(0,12):void 0},team:Array.isArray(o.team)?o.team.map(a=>({name:l(a?.name,60)??'',role:d.includes(a?.role)?a.role:'staff',job:l(a?.job,60),email:l(a?.email,120),phone:l(a?.phone,30)})).filter(a=>a.name).slice(0,200):[],suppliers:Array.isArray(o.suppliers)?o.suppliers.map(a=>({name:l(a?.name,80)??'',category:l(a?.category,40),phone:l(a?.phone,30),email:l(a?.email,120)})).filter(a=>a.name).slice(0,100):[],pay:o.pay&&'object'==typeof o.pay?(0,a.cleanPay)(o.pay):void 0,accounts:Array.isArray(o.accounts)?o.accounts.map(a=>({provider:l(a?.provider,40)??'',handle:l(a?.handle,120)})).filter(a=>/^[a-z0-9-]+$/.test(a.provider)).slice(0,40):void 0,features:{bookings:c(h.bookings,!0),takeaway:c(h.takeaway,!0),orderAtTable:c(h.orderAtTable,!1),tips:c(h.tips,!0),rota:c(h.rota,!0),games:c(h.games,!0),specials:c(h.specials,!0)},notes:l(o.notes,1e3)}},e.questionnaireFromFacts=function(a,t){const s=a.tables??0,o=0===s?'custom':s<=9?'cafe':s<=16?'bistro':'restaurant';return{version:1,venueId:a.id,source:'from-config',venue:{name:a.name,tagline:a.tagline,address:a.address,phone:a.phone,website:a.website,hasLogo:a.hasLogo},hours:{days:{...a.hours},note:a.hoursNote},tables:{template:a.tables?'custom':o,tables:a.tables,covers:a.covers,areas:a.areas},team:a.team,suppliers:a.suppliers,pay:a.pay,features:{bookings:!0,takeaway:!1!==a.takeaway,orderAtTable:!!a.orderAtTable,tips:!0,rota:!0,games:!1!==a.games,specials:!0},...t}},e.mergeQuestionnaire=function(a,t){if(!t)return a;const s={},o=Object.values(t.hours?.days??{}).some(Boolean);for(let n=0;n<7;n++)s[n]=o?t.hours.days[n]??null:a.hours.days[n]??null;return{...a,...t,venue:{...a.venue,...Object.fromEntries(Object.entries(t.venue).filter(([,a])=>void 0!==a&&''!==a))},hours:{days:s,note:t.hours?.note??a.hours.note},tables:{...a.tables,...Object.fromEntries(Object.entries(t.tables).filter(([,a])=>void 0!==a))},team:t.team.length?t.team:a.team,suppliers:t.suppliers.length?t.suppliers:a.suppliers,pay:t.pay??a.pay,accounts:t.accounts?.length?t.accounts:a.accounts,features:{...a.features,...t.features}}},e.hoursLines=function(a){return u.map(t=>({day:n[t],text:a[t]?`${a[t][0]} to ${a[t][1]}`:'Closed'}))},Object.defineProperty(e,"EXAMPLE_QUESTIONNAIRE",{enumerable:!0,get:function(){return b}});var a=r(_d[0]);const t=['venue','hours','tables','team','suppliers','accounts','pay','features'],s={venue:'Your venue',hours:'Opening hours',tables:'Table plan',team:'Your team',suppliers:'Suppliers',accounts:'Connected accounts',pay:'Pay & tips',features:'Features'},o={cafe:'Small caf\xe9 (about 8 tables)',bistro:'Bistro (about 14 tables)',restaurant:'Restaurant (about 24 tables, 2 areas)',custom:'My own layout'},n=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],u=[1,2,3,4,5,6,0],l=(a,t=200)=>'string'==typeof a?a.trim().slice(0,t):void 0,c=(a,t)=>'boolean'==typeof a?a:t,p=a=>'string'==typeof a&&/^([01]\d|2[0-3]):[0-5]\d$/.test(a)?a:null,d=['owner','manager','staff'];const b={version:1,venueId:'example',source:'signup-form',submittedAt:'2026-10-20',venue:{name:'Example Harbour Caf\xe9',tagline:'Coffee, cakes and crab rolls',address:'1 Example Quay, Exampletown',phone:'01632 960000',email:'hello@example.com',website:'example.com',hasLogo:!1},hours:{days:{0:['10:00','16:00'],1:null,2:['09:00','16:00'],3:['09:00','16:00'],4:['09:00','16:00'],5:['09:00','20:00'],6:['09:00','20:00']},note:'Shorter hours in winter'},tables:{template:'cafe',tables:8,covers:30,areas:['Inside','Terrace']},team:[{name:'Alex Example',role:'owner'},{name:'Sam Example',role:'manager',job:'Front of house manager'},{name:'Jo Example',role:'staff',job:'Barista'}],suppliers:[{name:'Example Dairy',category:'Dairy'},{name:'Example Fish Co',category:'Fish & seafood'}],pay:{tipsFrequency:'fortnightly',tipsAnchorPayday:'2026-11-02',tipsEndsDaysBefore:1,wagePayDay:28,wageCutoffDay:23,weekendRule:'none'},features:{bookings:!0,takeaway:!0,orderAtTable:!1,tips:!0,rota:!0,games:!0,specials:!0}}},865,[1249]); +__d(function(e,a,i,n,r,o,s){r.exports={version:1,venueId:"kirkmichael",source:"from-config",submittedAt:"2026-11-05",onboardedAt:"2026-11-05",venue:{name:"The Kirkmichael Arms",tagline:"Michelin-listed restaurant and bar in Kirkmichael, Ayrshire",address:"3-5 Straiton Road, Kirkmichael, South Ayrshire KA19 7PH",phone:"01655 750 200",email:"enquiries@thekirkmichaelarms.co.uk",website:"https://www.kirkmichaelarms.co.uk/",hasLogo:!0},hours:{days:{0:["13:00","22:30"],1:null,2:null,3:null,4:["13:00","22:30"],5:["13:00","22:30"],6:["13:00","22:30"]},note:"Thu\u2013Sun from 1pm; schema close 22:30. Michelin lists Sunday from 12:30 \u2014 confirm. Closed Mon\u2013Wed."},tables:{template:"restaurant",tables:null,covers:56,areas:["Restaurant","Bar","Private dining (The Room)"],needsConfirmation:!0,note:"56 covers from historical sale listing; private dining about 18. Table count unknown \u2014 ask Gordon/Justin."},team:[{name:"Justin Galea",role:"owner",job:"Chef & Owner",email:"enquiries@thekirkmichaelarms.co.uk",phone:"01655 750 200"}],suppliers:[],accounts:[{provider:"instagram",handle:"@kirkmichaelarms_unfiltered"},{provider:"facebook",handle:"kirkmichaelarms"},{provider:"gmail",handle:"enquiries@thekirkmichaelarms.co.uk"},{provider:"tripadvisor",handle:"The Kirkmichael Arms"},{provider:"google-business",handle:"The Kirkmichael Arms"}],pay:{tipsFrequency:"fortnightly",tipsAnchorPayday:"2026-11-07",tipsEndsDaysBefore:1,wagePayDay:28,wageCutoffDay:23,weekendRule:"none"},features:{bookings:!0,takeaway:!1,orderAtTable:!1,tips:!0,rota:!0,games:!0,specials:!0},notes:"Seed as venue_id kirkmichael (separate tenant). Chef-owner Justin Galea. Brand accent #B87754 (whisky amber); lion emblem + wordmark in branding/. Deposit amount unknown \u2014 leave off until Gordon confirms. Bookings currently via own site /booking (own website booking page noted in research only). Menu from live Sample menus 2026-11-05; specials board changes often. Never blend with other venues' data."}},866,[]); +__d(function(e,n,a,o,s,t,i){s.exports={version:1,venueId:"wildings",source:"from-config",submittedAt:"2026-11-05",venue:{name:"Wildings Hotel & Restaurant",tagline:"Coastal cuisine with character",address:"Maidens Road, Maidens, KA26 9NR",phone:"01655 331 401",email:"bookings@wildingsrestaurant-hotel.co.uk",website:"https://www.wildingshotel.com/",hasLogo:!0},hours:{days:{0:["12:00","21:00"],1:["12:00","21:00"],2:["12:00","21:00"],3:["12:00","21:00"],4:["12:00","21:00"],5:["12:00","21:00"],6:["12:00","21:00"]},note:"Lunch Mon\u2013Sat 12:00\u201314:00, Sun 12:00\u201314:30; dinner daily 18:00\u201321:00 (closed 14:00\u201318:00). Bar hours not published. Sunday lunch end time to confirm."},tables:{template:"restaurant",tables:null,covers:null,areas:["Dining room 1","Dining room 2"],needsConfirmation:!0,note:"Two dining rooms per website; names, tables and covers unknown."},team:[],suppliers:[],accounts:[{provider:"facebook",handle:"profile.php?id=100057663900963"},{provider:"instagram",handle:"@wildingsmaidens"}],pay:{tipsFrequency:"fortnightly",tipsAnchorPayday:"2026-11-07",tipsEndsDaysBefore:1,wagePayDay:28,wageCutoffDay:23,weekendRule:"none"},features:{bookings:!0,takeaway:!1,orderAtTable:!1,tips:!0,rota:!0,games:!0,specials:!0},notes:"Separate tenant, venue id wildings. Accent #FFE3A5 (logo star gold) on ink #272A2F. No demo/local roster. Authorised real team is loaded from this venue\u2019s server; remaining staff list and personal manager contacts are to confirm. Deposit off until confirmed. Bookings are by phone/email today; site is Duda, so no Wix sync. Pay settings are app defaults, to confirm. Never blend with other venues' data.",onboardedAt:"2026-11-05"}},867,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SOUTERS_BG",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"SOUTERS_SURFACE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"SOUTERS_TYPE_SCALE",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"soutersFont",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"soutersSurface",{enumerable:!0,get:function(){return f}}),e.soutersInk=function(o){if(!t.IS_SOUTERS)return o;const c=(0,n.normaliseHex)(o);return c?'#A4622E'===c?'#D9AD8A':(0,n.contrast)(c,u)<4.5?'#FFFFFF':o:o};var t=r(d[0]),n=r(d[1]);const u='#56152A',o='#43122F',c=.88,S=n=>t.IS_SOUTERS?Math.round(n*c*100)/100:n,f=n=>t.IS_SOUTERS?o:n},868,[5,1210]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.QR=function({value:e,size:t=180}){return(0,n.jsx)(o.default,{style:{padding:12,backgroundColor:'#FFFFFF',borderRadius:12,alignSelf:'center',borderWidth:3,borderColor:u.colours.gold},children:(0,n.jsx)(l.default,{value:e,size:t,color:"#0B0B0B",backgroundColor:"#FFFFFF"})})},r(d[0]);var o=e(r(d[1])),l=e(r(d[2])),u=r(d[3]),n=r(d[4])},869,[30,127,1337,821,24]); +__d(function(g,_r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.forecastToday=function(i,u,l,h,f,y){const v=(0,s.examplesAllowed)(),k=(0,a.clampWeeks)(i.settings.forecastMinWeeks),M=v?null:y??(0,a.buildHistory)(i.id,u,l,[],f,k),w=v||!!M?.enough,b=(0,o.hoursFor)(i,f),H=[],O=(0,r.ymd)(f);let S=1;for(const e of h.filter(e=>e.date===O&&(null===e.restaurantId||e.restaurantId===i.id)))H.push(e.title.replace(/\s*\(substitute day\)/gi,'')),!1!==e.busier&&(S*='bank-holiday'===e.kind?1.25:'event'===e.kind?1.15:1.1);if(!b)return{open:!1,hours:[],restOfDay:{covers:0,low:0,high:0,takeaway:0,booked:0},flags:H,suggestions:['Kitchen closed today (per listed hours).'],multiplier:S,example:v,enough:w,minWeeks:k};const I=v?t.EXAMPLE_HISTORY[i.id]??t.EXAMPLE_HISTORY.default:w&&M?M:{covers:{},takeaway:{}},x=f.getDay(),E=c(i,f),C=(0,e.lastFoodOn)(i,O);let N=b.close.getMinutes()>0?b.close.getHours():b.close.getHours()-1;if(C){const[e,t]=C.time.split(':').map(Number);N=Math.min(N,t>0?e:e-1),'kitchen closes'!==C.reason&&H.push(`Last food orders ${C.time} (${C.reason})`)}const $=u.filter(e=>e.restaurantId===i.id&&e.date===O&&['confirmed','seated','finished'].includes(e.status)),_=$.filter(e=>!e.walkIn&&'finished'!==e.status).map(e=>Number(e.time.slice(0,2))),P=Math.min(E[0],b.open.getHours(),..._),T=Math.max(E[1],N,..._),A=[];for(let e=P;e<=T;e++){const t=e>=b.open.getHours()&&e<=N,o=I.covers[x]?.[e]??0,s=I.takeaway[x]?.[e]??0,a=$.filter(t=>!t.walkIn&&'finished'!==t.status&&Number(t.time.slice(0,2))===e).reduce((e,t)=>e+t.partySize,0),n=$.filter(t=>t.walkIn&&['seated','finished'].includes(t.status)&&Number(t.time.slice(0,2))===e).reduce((e,t)=>e+t.partySize,0),u=t?Math.round(o*i.settings.walkInShare*S):0,c=w&&t?Math.max(0,Math.round(o*S*(1-i.settings.walkInShare))-a):0,h=Math.max(n,u)+c,f=a+h,p=l.filter(t=>t.restaurantId===i.id&&'takeaway'===t.type&&'cancelled'!==t.status&&t.slotTime&&new Date(t.slotTime).getHours()===e&&(0,r.ymd)(new Date(t.slotTime))===O).length,y=t?Math.max(p,Math.round(s*S)):p;A.push({hour:e,booked:a,walkIns:h,covers:f,coversLow:w?Math.round(.8*f):f,coversHigh:w?Math.round(1.2*f):f,takeawayPlaced:p,takeaway:y,historicalCovers:o})}const L=p(i,x);if(w&&L){const e=L-A.reduce((e,t)=>e+t.covers,0),t=A.filter(e=>e.hour>=b.open.getHours()&&e.hour<=N);if(e>0&&t.length){const o=t.map(e=>e.historicalCovers),r=n(e,o.reduce((e,t)=>e+t,0)>0?o:t.map(()=>1));t.forEach((e,t)=>{const o=r[t];o&&(e.floorAdded=o,e.walkIns+=o,e.covers+=o,e.coversHigh=Math.max(e.coversHigh,Math.round(1.2*e.covers)))})}const o=A.reduce((e,t)=>e+t.coversLow,0);if(oMath.max(1,e.covers)));t.forEach((t,o)=>{t.coversLow=Math.min(t.covers,t.coversLow+e[o])})}}const R=f.getHours()+(f.getMinutes()>=30?1:0),D=A.filter(e=>e.hour>=R),j=D[0],W=e=>D.reduce((t,o)=>t+e(o),0),F={covers:W(e=>e.covers),low:W(e=>e.coversLow),high:W(e=>e.coversHigh),takeaway:W(e=>e.takeaway),booked:W(e=>e.booked)},G=[],z=i.settings.capacityPerHour,B=D.reduce((e,t)=>!e||t.covers>e.covers?t:e,void 0);B&&B.covers>=.85*z&&G.push(`Dining room near capacity around ${String(B.hour).padStart(2,'0')}:00 (about ${B.covers} of ${z} covers) \u2014 consider pausing or capping takeaway slots then.`);const V=D.find(e=>e.historicalCovers>0&&e.covers>1.1*e.historicalCovers);V&&G.push(`Busier than a usual ${['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'][x]} from ${String(V.hour).padStart(2,'0')}:00 \u2014 consider one more on the floor.`);F.takeaway>=10&&G.push(`About ${F.takeaway} takeaway orders expected \u2014 prep extra haddock and chips.`);w||G.unshift(`Not enough history yet. ${(0,s.notEnoughTip)(k)}`);G.length||G.push('Looks like a normal service \u2014 no action suggested.');return{open:!0,nextHour:j,hours:A,restOfDay:F,flags:H,suggestions:G,multiplier:S,example:v,enough:w,minWeeks:k,minCovers:L??void 0}},_e.spread=n,Object.defineProperty(_e,"ANCHORAGE_FORECAST_HOURS",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"forecastHoursOf",{enumerable:!0,get:function(){return u}}),_e.forecastWindow=c,Object.defineProperty(_e,"ANCHORAGE_MIN_COVERS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"MIN_COVERS_NOTE",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"minCoversOf",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"minCoversOn",{enumerable:!0,get:function(){return p}}),_e.coversRange=function(e,t,o=!0){const r=Math.min(e,t),s=Math.max(e,t),a=r===s?String(r):`${r} to ${s}`;return o?`${a} ${1===s?'cover':'covers'}`:a};var e=_r(d[0]),t=_r(d[1]),o=_r(d[2]),r=_r(d[3]),s=_r(d[4]),a=_r(d[5]);function n(e,t){const o=t.reduce((e,t)=>e+t,0)||1,r=t.map(t=>e*t/o),s=r.map(Math.floor);let a=e-s.reduce((e,t)=>e+t,0);return r.map((e,t)=>[e-Math.floor(e),t]).sort((e,t)=>t[0]-e[0]).forEach(([,e])=>{a>0&&(s[e]++,a--)}),s}const i={0:['12:00','22:00'],1:null,2:null,3:['12:00','22:00'],4:['12:00','22:00'],5:['12:00','22:00'],6:['12:00','22:00']},u=e=>e.settings.forecastHours??('anchorage'===e.id?i:{});function c(e,t){const r=(0,o.hoursFor)(e,t),s=r.close.getMinutes()>0?r.close.getHours():r.close.getHours()-1,a=u(e)[t.getDay()];if(!a)return[r.open.getHours(),s];const[n]=a[0].split(':').map(Number),[i,c]=a[1].split(':').map(Number);return[Math.min(n,r.open.getHours()),Math.max(c>0?i:i-1,s)]}const l={0:50,6:50},h='Gordon, 4 Nov 2026',f=e=>e.settings.minCoversByDay??('anchorage'===e.id?l:{}),p=(e,t)=>{const o=f(e)[t];return o&&o>0?Math.round(o):null}},870,[809,1281,815,818,1081,1282]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.estimateWait=function(t,n,u){const o=Math.max(6,Math.round(n/6*u));return t*o}},871,[]); +__d(function(_g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"uuid",{enumerable:!0,get:function(){return y.uuid}}),_e.nowFrom=S,_e.linesFromBasket=w,Object.defineProperty(_e,"useStore",{enumerable:!0,get:function(){return C}}),Object.defineProperty(_e,"DEMO_CUSTOMER_ID",{enumerable:!0,get:function(){return u.DEMO_CUSTOMER_ID}});var e,t=_r(d[0]),a=_r(d[1]),r=_r(d[2]),n=_r(d[3]),s=_r(d[4]),i=_r(d[5]),o=(e=i)&&e.__esModule?e:{default:e},l=_r(d[6]),c=_r(d[7]),u=_r(d[8]),g=_r(d[9]),m=_r(d[10]),p=_r(d[11]),b=_r(d[12]),f=_r(d[13]),k=_r(d[14]),y=_r(d[15]);const $=(e,t,a)=>e.reduce((e,a)=>a.startsWith(t)?Math.max(e,Number(a.slice(t.length))||0):e,a)+1,I=e=>`${e}-${Math.random().toString(36).slice(2,8)}${Date.now().toString(36).slice(-3)}`;function S(e){return'live'===e.mode?new Date:new Date(e.simStartMs+(Date.now()-e.anchorRealMs))}function h(){const e=(0,u.defaultSimStart)();return{clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()},...(0,u.buildSeed)(e),outbox:[],msgTemplates:{}}}function w(e,t,a){return e.lines.flatMap(e=>{const r=t.find(t=>t.id===e.itemId);if(!r)return[];const n=(0,b.resolveItem)(r),s=(n.optionGroups??[]).flatMap(t=>t.choices.filter(t=>e.choiceIds.includes(t.id))),i=(n.price??0)+s.reduce((e,t)=>e+t.priceDelta,0),o=(0,p.conflictsFor)((0,p.effectiveAllergens)(n,e.choiceIds),a);return[{itemId:n.id,name:n.name,qty:e.qty,unitPrice:i,choices:s.map(e=>e.label),notes:e.notes,contains:o.contains,may:o.may,overridden:!!e.override&&o.contains.every(t=>e.override.allergens.includes(t)),prepMins:n.prepMins}]})}const O=e=>{const t='ABCDEFGHJKLMNPQRSTUVWXYZ23456789',a=()=>Array.from({length:4},()=>t[Math.floor(32*Math.random())]).join('');return`${e}-${a()}-${a()}-${a()}`},C=(0,l.create)()((0,c.persist)((e,t)=>{const a=()=>S(t().clock),r=(t,r,n)=>e(e=>({audit:[{id:I('au'),restaurantId:t,at:a().toISOString(),kind:r,text:n},...e.audit].slice(0,300)})),n=(a,n,s)=>{if(!a||s<=0)return 0;const i=t().giftCards.find(e=>e.code===a&&e.restaurantId===n);if(!i||i.balance<=0)return 0;const o=Math.min(i.balance,s);return e(e=>({giftCards:e.giftCards.map(e=>e.id===i.id?{...e,balance:e.balance-o}:e)})),r(n,'giftcard',`Gift card ${a.slice(0,8)}\u2026 redeemed \xa3${(o/100).toFixed(2)} (balance \xa3${((i.balance-o)/100).toFixed(2)})`),o},s=e=>{const a=t().restaurants.find(t=>t.id===e.restaurantId);a&&e.customerId===t().customer.id&&e.subtotal>=a.settings.stampMinSpend&&t().addStamp(e.restaurantId,e.customerId,'takeaway'===e.type?'Takeaway (auto on collection)':'Table QR bill (auto on payment)')},i=e=>(0,f.templatesFor)(t().msgTemplates[e]),o=a=>{a.length&&(e(e=>({outbox:[...a,...e.outbox].slice(0,300)})),(0,f.deliverQueued)(a.filter(e=>'queued'===e.status),(e,a)=>t().updateOutbox(e,a)))},l=(e,r)=>{const n=t().restaurants.find(e=>e.id===r.restaurantId);n&&o((0,f.composeBooking)(e,r,n,i(n.id),a().toISOString()))},c=e=>{const r=t().restaurants.find(t=>t.id===e.restaurantId);r&&o((0,f.composeOrder)(e,r,i(r.id),a().toISOString()))};return{...h(),resetDemo:()=>e(h()),setClockMode:()=>e({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}}),skipMinutes:()=>{},updateCustomer:t=>e(e=>({customer:{...e.customer,...t}})),setAllergy:(t,a)=>e(e=>{const r=e.customer.allergies.filter(e=>e.allergen!==t);return{customer:{...e.customer,allergies:a?[...r,{allergen:t,severity:a}]:r}}}),startBasket:(t,a,r)=>e(e=>{const n=e.basket.restaurantId===t&&e.basket.mode===a&&e.basket.tableNo===r;return{basket:{restaurantId:t,mode:a,tableNo:r,lines:n?e.basket.lines:[]}}}),addLine:t=>e(e=>({basket:{...e.basket,lines:[...e.basket.lines,{...t,key:I('ln')}]}})),setLineQty:(t,a)=>e(e=>({basket:{...e.basket,lines:a<=0?e.basket.lines.filter(e=>e.key!==t):e.basket.lines.map(e=>e.key===t?{...e,qty:a}:e)}})),overrideLine:(t,r)=>e(e=>({basket:{...e.basket,lines:e.basket.lines.map(e=>e.key===t?{...e,override:{allergens:r,at:a().toISOString()}}:e)}})),clearBasket:()=>e(e=>({basket:{...e.basket,lines:[]}})),placeOrder:({slotTime:s,tip:i,giftCardCode:o,notes:l,paidNow:u,phone:g,email:m})=>{const p=t(),b=p.basket,f=b.restaurantId,k=w(b,p.menu,p.customer.allergies),I=k.reduce((e,t)=>e+t.unitPrice*t.qty,0),S='table'===b.mode,h=$(p.orders.filter(e=>e.restaurantId===f).map(e=>e.ref),S?'Q-':'T-',S?p.counters.table:p.counters.order),O=u?n(o,f,I+i):0,C=I+i,v={id:(0,y.uuid)(),ref:`${S?'Q':'T'}-${h}`,restaurantId:f,customerId:p.customer.id,customerName:p.customer.name,type:b.mode,tableNo:b.tableNo,slotTime:s,lines:k,subtotal:I,tip:i,giftCardApplied:O,giftCardCode:O?o:void 0,total:C,paid:u?C:0,status:'new',createdAt:a().toISOString(),allergies:p.customer.allergies,readiness:{},notes:l,channel:'app',...'takeaway'===b.mode?{phone:g??p.customer.phone,email:m??p.customer.email}:{}};e(e=>({orders:[v,...e.orders],basket:{...e.basket,lines:[]},counters:S?{...e.counters,table:h}:{...e.counters,order:h}}));const A=k.filter(e=>e.overridden);return r(f,'order',`Order ${v.ref} placed (${S?`Table ${b.tableNo}`:'takeaway'})${A.length?` \u2014 ALLERGY OVERRIDE on ${A.map(e=>e.name).join(', ')}`:''}`),v.allergies.length&&r(f,'allergy',`Allergies declared and confirmed by customer on ${v.ref}: ${v.allergies.map(e=>`${e.allergen} (${e.severity})`).join(', ')}`),c(v),v},setOrderStatus:(a,n,i)=>{const o=t().orders.find(e=>e.id===a);o&&((0,k.statusBlock)(o,n,(0,k.linkedBooking)(o,t().bookings))||(e(e=>({orders:e.orders.map(e=>e.id===a?{...e,status:n}:e)})),r(o.restaurantId,'order',`${o.ref} \u2192 ${n}${i?` by ${i}`:''}`),'collected'===n&&'takeaway'===o.type&&s(o)))},ackOrderAllergy:(n,s)=>{const i=t().orders.find(e=>e.id===n);if(!i||!(0,k.canSign)(i,'kitchen',(0,k.linkedBooking)(i,t().bookings)))return;const o={by:s,at:a().toISOString()};e(e=>({orders:e.orders.map(e=>e.id===n?{...e,allergyAck:o,status:'new'===e.status?'acknowledged':e.status}:e)})),r(i.restaurantId,'allergy',`Allergen sign-off 3/5 Kitchen on ${i.ref}: ${s} (chef signed off before cooking)`)},tickOrderAllergy:(n,s,i,o=!0)=>{const l=t().orders.find(e=>e.id===n);if(!l)return;const c={...l.allergyTicks??{}};o?c[s]={by:i,at:a().toISOString()}:delete c[s],e(e=>({orders:e.orders.map(e=>e.id===n?{...e,allergyTicks:c}:e)})),r(l.restaurantId,'allergy',`${l.ref}: kitchen ${o?'confirmed':'unticked'} ${s} (${i})`)},ackReadiness:(n,s,i)=>{const o=t().orders.find(e=>e.id===n);o&&('cook'===s&&(0,k.statusBlock)(o,'preparing',(0,k.linkedBooking)(o,t().bookings))||(e(e=>({orders:e.orders.map(e=>e.id===n?{...e,readiness:{...e.readiness,[s]:{by:i,at:a().toISOString()}},status:'cook'===s&&['new','acknowledged'].includes(e.status)?'preparing':e.status}:e)})),r(o.restaurantId,'order',`${o.ref}: ${'cook'===s?'started cooking':'bagged'} (${i})`)))},handoverCheck:(n,s)=>{const i=t().orders.find(e=>e.id===n);i&&(0,k.canSign)(i,'table',(0,k.linkedBooking)(i,t().bookings))&&(e(e=>({orders:e.orders.map(e=>e.id===n?{...e,handoverCheck:{by:s,at:a().toISOString()}}:e)})),r(i.restaurantId,'allergy',`Allergen sign-off 5/5 Table on ${i.ref}: ${s} (served and checked with the guest; chain complete)`))},signAllergyStep:(n,s,i)=>{const o=t().orders.find(e=>e.id===n);if(!o||!i.trim())return!1;const l=(0,k.linkedBooking)(o,t().bookings);if(!(0,k.canSign)(o,s,l))return!1;if('kitchen'===s)return t().ackOrderAllergy(n,i),!0;if('table'===s)return t().handoverCheck(n,i),!0;const c={by:i,at:a().toISOString()};'booked'===s&&l&&l.allergies.length&&!l.allergyAck?e(e=>({bookings:e.bookings.map(e=>e.id===l.id?{...e,allergyAck:c}:e)})):e(e=>({orders:e.orders.map(e=>e.id===n?{...e,allergyChain:{...e.allergyChain,[s]:c}}:e)}));const u=(0,k.stepInfo)(s);return r(o.restaurantId,'allergy',`Allergen sign-off ${u.n}/5 ${u.label} on ${o.ref}: ${i} (${u.what.toLowerCase()})`),!0},customerSignal:(t,a)=>e(e=>({orders:e.orders.map(e=>e.id===t?{...e,customerSignal:a}:e)})),setSplit:(t,a,r)=>e(e=>({orders:e.orders.map(e=>e.id===t?{...e,tip:r,total:e.subtotal+r,split:{ways:a,paidShares:e.split?.paidShares??0}}:e)})),payTable:(a,{shares:i,giftCardCode:o})=>{const l=t().orders.find(e=>e.id===a);if(!l)return;const c=l.split?.ways??1,u=Math.ceil(l.total/c),g=Math.min(c,(l.split?.paidShares??0)+i),m=g>=c,p=m?l.total-l.paid:Math.min(l.total-l.paid,u*i),b=n(o,l.restaurantId,p),f={...l,giftCardApplied:l.giftCardApplied+b,giftCardCode:b?o:l.giftCardCode,paid:l.paid+p,split:{ways:c,paidShares:g},status:m?'closed':l.status};e(e=>({orders:e.orders.map(e=>e.id===a?f:e)})),r(l.restaurantId,'order',`${l.ref} (Table ${l.tableNo}) ${m?'bill paid in full':`share ${g}/${c} paid`} (paid at the till)`),m&&s(f)},createBooking:n=>{const s=$(t().bookings.filter(e=>e.restaurantId===n.restaurantId).map(e=>e.ref),'BK-',t().counters.booking),i=t().restaurants.find(e=>e.id===n.restaurantId)?.settings,o='online'===n.source&&!!i&&(n.partySize>(i.autoAcceptUpTo??7)||!!i.reviewRequests&&!!n.notes.trim()),c={...n,id:(0,y.uuid)(),ref:`BK-${s}`,status:o?'pending':'confirmed',createdAt:a().toISOString()};return e(e=>({bookings:[...e.bookings,c],counters:{...e.counters,booking:s}})),r(c.restaurantId,'booking',`Booking ${o?'request ':''}${c.ref}: ${c.name}, ${c.partySize} on ${c.date} ${c.time}${c.source?` (${c.source})`:''}${c.allergies.length?' \u2014 allergies declared':''}`),l(o?'booking-request':'booking-confirmation',c),c},decideBooking:(n,s,i)=>{const o=t().bookings.find(e=>e.id===n);if(!o||'pending'!==o.status)return;const c={by:i,at:a().toISOString(),outcome:s},u='confirmed'===s?'confirmed':'cancelled';e(e=>({bookings:e.bookings.map(e=>e.id===n?{...e,status:u,decided:c}:e)})),r(o.restaurantId,'booking',`Booking request ${o.ref} (${o.name}, ${o.partySize}) ${s} by ${i}`),l('confirmed'===s?'booking-confirmation':'booking-declined',{...o,status:u})},addOutbox:t=>e(e=>({outbox:[...t,...e.outbox].slice(0,300)})),updateOutbox:(t,a)=>e(e=>({outbox:e.outbox.map(e=>e.id===t?{...e,...a}:e)})),clearOutbox:t=>e(e=>({outbox:e.outbox.filter(e=>e.restaurantId!==t)})),setTemplate:(t,a,r)=>e(e=>{const n={...e.msgTemplates[t]??{}};return null===r?delete n[a]:n[a]={...n[a]??{},...r},{msgTemplates:{...e.msgTemplates,[t]:n}}}),acceptOrder:(n,s,i)=>{const o=t().orders.find(e=>e.id===n);if(!o)return!1;const l='new'===o.status&&!!(0,k.statusBlock)(o,'acknowledged',(0,k.linkedBooking)(o,t().bookings)),c=a(),u=i?new Date(c.getTime()+6e4*i).toISOString():o.readyBy;return e(e=>({orders:e.orders.map(e=>e.id===n?{...e,status:'new'!==e.status||l?e.status:'acknowledged',accepted:e.accepted??{by:s,at:c.toISOString()},readyBy:u}:e)})),r(o.restaurantId,'order',`${o.ref} accepted by ${s}${i?`, ready by ${String(new Date(u).getHours()).padStart(2,'0')}:${String(new Date(u).getMinutes()).padStart(2,'0')}`:''}`),!l},setBookingStatus:(n,s)=>{const i=t().bookings.find(e=>e.id===n),o=a().toISOString();e(e=>({bookings:e.bookings.map(e=>e.id===n?{...e,status:s,...'seated'===s?{seatedAt:o}:'finished'===s?{finishedAt:o}:{}}:e)})),i&&r(i.restaurantId,'booking',`${i.ref} ${i.name} \u2192 ${s}`)},seatWalkIn:(n,s,i,o)=>{const l=a(),c=`${l.getFullYear()}-${String(l.getMonth()+1).padStart(2,'0')}-${String(l.getDate()).padStart(2,'0')}`,u=`${String(l.getHours()).padStart(2,'0')}:${String(l.getMinutes()).padStart(2,'0')}`,g=t().bookings.filter(e=>e.restaurantId===n&&e.walkIn&&e.date===c).reduce((e,t)=>Math.max(e,Number(t.ref.slice(2))||0),0)+1,m={id:(0,y.uuid)(),ref:`W-${g}`,restaurantId:n,customerId:null,name:'Walk-in',partySize:s,date:c,time:u,table:i||void 0,allergies:[],notes:(o??'').trim(),status:'seated',security:'none',depositPaid:0,createdAt:l.toISOString(),seatedAt:l.toISOString(),walkIn:!0,source:'walk-in'};return e(e=>({bookings:[...e.bookings,m]})),r(n,'walkin',`Walk-in ${m.ref} seated: ${s} cover(s)${i?`, Table ${i}`:', table to assign'}`),m},setBookingTable:(a,n)=>{const s=t().bookings.find(e=>e.id===a);e(e=>({bookings:e.bookings.map(e=>e.id===a?{...e,table:n}:e)})),s&&r(s.restaurantId,'booking',`${s.ref} ${s.name} \u2192 ${n?n.includes('+')?`Tables ${n.split('+').join(' + ')}`:`Table ${n}`:'no table'}`)},updateBooking:(a,n)=>{const s=t().bookings.find(e=>e.id===a);e(e=>({bookings:e.bookings.map(e=>e.id===a?{...e,...n}:e)})),s&&r(s.restaurantId,'booking',`${s.ref} ${s.walkIn?'Walk-in':s.name} moved/updated${n.table?` \u2192 Table ${n.table}`:''}${n.time?` at ${n.time}`:''}${n.durationMins?` for ${n.durationMins} min`:''}`)},undoWalkIn:a=>{const n=t().bookings.find(e=>e.id===a);n&&n.walkIn&&(e(e=>({bookings:e.bookings.filter(e=>e.id!==a)})),r(n.restaurantId,'walkin',`Walk-in ${n.ref} undone`))},ackBookingAllergy:(n,s)=>{const i=t().bookings.find(e=>e.id===n);i&&!i.allergyAck&&(e(e=>({bookings:e.bookings.map(e=>e.id===n?{...e,allergyAck:{by:s,at:a().toISOString()}}:e)})),r(i.restaurantId,'allergy',`Allergen sign-off 1/5 Booked on ${i.ref} (${i.name}): ${s} (allergy recorded)`))},joinWaitlist:(n,s,i,o)=>{const l=t().waitlist.filter(e=>e.restaurantId===n).reduce((e,t)=>Math.max(e,t.number),0)+1,c={id:I('wl'),restaurantId:n,number:l,name:s,partySize:i,joinedAt:a().toISOString(),status:'waiting',customerId:o};return e(e=>({waitlist:[...e.waitlist,c]})),r(n,'waitlist',`${s} (${i}) joined the waitlist as #${l}`),c},setWaitlistStatus:(a,n)=>{const s=t().waitlist.find(e=>e.id===a);e(e=>({waitlist:e.waitlist.map(e=>e.id===a?{...e,status:n}:e)})),s&&(r(s.restaurantId,'waitlist',`Waitlist #${s.number} ${s.name} \u2192 ${n}`),'seated'===n&&t().addWalkIn(s.restaurantId,s.partySize))},addWalkIn:(t,a)=>{e(e=>({walkIns:{...e.walkIns,[t]:(e.walkIns[t]??0)+a}})),r(t,'walkin',`Walk-in seated: ${a} cover(s)`)},addStamp:(n,s,i)=>{const o=t().restaurants.find(e=>e.id===n);o&&(e(e=>{const t=e.stampCards.find(e=>e.restaurantId===n&&e.customerId===s),r=t??{restaurantId:n,customerId:s,stamps:0,rewardsAvailable:0,history:[]};let l=r.stamps+1,c=r.rewardsAvailable;l>=o.settings.stampTarget&&(l=0,c+=1);const u={...r,stamps:l,rewardsAvailable:c,history:[{at:a().toISOString(),source:i},...r.history]};return{stampCards:t?e.stampCards.map(e=>e===t?u:e):[...e.stampCards,u]}}),r(n,'stamp',`Stamp added (${i})`))},redeemReward:(t,a)=>{e(e=>({stampCards:e.stampCards.map(e=>e.restaurantId===t&&e.customerId===a&&e.rewardsAvailable>0?{...e,rewardsAvailable:e.rewardsAvailable-1}:e)})),r(t,'stamp','Loyalty reward redeemed')},buyGiftCard:(n,s,i,o)=>{const l=n.slice(0,3).toUpperCase(),c={id:I('gc'),code:O(l),restaurantId:n,initial:s,balance:s,ownerId:t().customer.id,recipientName:i,message:o,createdAt:a().toISOString()};return e(e=>({giftCards:[c,...e.giftCards]})),r(n,'giftcard',`Gift card sold \xa3${(s/100).toFixed(2)} (demo payment)`),c},redeemGiftCard:(a,n,s)=>{const i=t().giftCards.find(e=>e.code.toUpperCase()===a.trim().toUpperCase());return!(!i||n<=0||n>i.balance)&&(e(e=>({giftCards:e.giftCards.map(e=>e.id===i.id?{...e,balance:e.balance-n}:e)})),r(i.restaurantId,'giftcard',`Gift card ${i.code} redeemed \xa3${(n/100).toFixed(2)} by ${s}`),!0)},honourLegacyCard:(t,n,s,i)=>{const o={id:I('gc'),code:n.trim().toUpperCase(),restaurantId:t,initial:s,balance:s,ownerId:'legacy',recipientName:'Legacy website bookings gift card',message:`Honoured by ${i}`,createdAt:a().toISOString().slice(0,10),legacy:!0};return e(e=>({giftCards:[o,...e.giftCards]})),r(t,'giftcard',`Legacy website bookings gift card ${o.code} honoured (\xa3${(s/100).toFixed(2)}) by ${i}`),o},addEvent:t=>e(e=>({events:[...e.events,{...t,id:I('ev')}]})),addRating:t=>{e(e=>({ratings:[{...t,id:I('rt'),createdAt:a().toISOString()},...e.ratings],orders:t.orderId?e.orders.map(e=>e.id===t.orderId?{...e,rated:!0}:e):e.orders})),r(t.restaurantId,'rating',`Private rating ${t.stars}/5 from ${t.customerName}`)},updateMenuItem:(a,n)=>{const{name:s,section:i,price:o,allergens:l,allergenNotes:c,...u}=n,g={};void 0!==s&&(g.dish=s),void 0!==i&&(g.section=i),'price'in n&&(g.price=o??null),void 0!==l&&(g.allergens=l),'allergenNotes'in n&&(g.allergenNotes=c);const m='optionGroups'in n,p=(0,b.menuCardBridge)();p&&(Object.keys(g).length||m)&&p.menuEdited(a,g,'CoverCharge for Managers',m);const f=p?u:n;Object.keys(f).length&&e(e=>({menu:e.menu.map(e=>e.id===a?{...e,...f}:e)}));const k=t().menu.find(e=>e.id===a);k&&Object.keys(f).length&&r(k.restaurantId,'menu',`Menu: ${(0,b.resolveItem)(k).name} updated`)},setSignOff:(t,r)=>{const n=(0,b.menuCardBridge)();n?r?n.signOff(t,r):n.menuEdited(t,{},'CoverCharge for Managers',!0):e(e=>({menu:e.menu.map(e=>e.id===t?{...e,signOff:r?{by:r,at:a().toISOString().slice(0,10)}:null}:e)}))},addAudit:(e,t,a)=>r(e,t,a),updateSettings:(t,a)=>{e(e=>({restaurants:e.restaurants.map(e=>e.id===t?{...e,settings:{...e.settings,...a}}:e)})),'takeawayPaused'in a&&r(t,'order',"Takeaway slots "+(a.takeawayPaused?'PAUSED':'resumed'))},addMenuItem:t=>{const a=I('m');return e(e=>({menu:[...e.menu,{...t,id:a}]})),(0,b.menuCardBridge)()?.menuItemAdded({...t,id:a}),r(t.restaurantId,'menu',`Menu: ${t.name} added (recipe card awaiting head chef sign-off)`),a},updateRestaurant:(t,a)=>{e(e=>({restaurants:e.restaurants.map(e=>e.id===t?{...e,...a}:e)})),r(t,'menu',`Restaurant info updated (${Object.keys(a).join(', ')})`)},placeManualOrder:({restaurantId:n,type:s,channel:i,customerName:o,phone:l,email:u,tableNo:g,slotTime:m,lines:f,allergies:k,notes:I,by:S})=>{const h=t(),w=f.flatMap(({itemId:e,qty:t})=>{const a=h.menu.find(t=>t.id===e);if(!a||t<=0)return[];const r=(0,b.resolveItem)(a),n=(0,p.conflictsFor)((0,p.effectiveAllergens)(r),k);return[{itemId:e,name:r.name,qty:t,unitPrice:r.price??0,choices:[],notes:'',contains:n.contains,may:n.may,overridden:!1,prepMins:r.prepMins}]}),O=w.reduce((e,t)=>e+t.unitPrice*t.qty,0),C='table'===s,v=$(h.orders.filter(e=>e.restaurantId===n).map(e=>e.ref),C?'Q-':'T-',C?h.counters.table:h.counters.order),A={id:(0,y.uuid)(),ref:`${C?'Q':'T'}-${v}`,restaurantId:n,customerId:`manual-${i}`,customerName:o||(C?`Table ${g}`:'Walk-in'),type:s,tableNo:g,slotTime:m,lines:w,subtotal:O,tip:0,giftCardApplied:0,total:O,paid:0,status:'new',createdAt:a().toISOString(),allergies:k,readiness:{},notes:I,channel:i,...l?{phone:l}:{},...u?{email:u}:{},...k.length?{allergyChain:{booked:{by:S,at:a().toISOString()}}}:{}};return e(e=>({orders:[A,...e.orders],counters:C?{...e.counters,table:v}:{...e.counters,order:v}})),r(n,'order',`Order ${A.ref} taken by ${S} (${'phone'===i?'phone':'walk-in'===i?'walk-in takeaway':`Table ${g}`})`),k.length&&r(n,'allergy',`Allergen sign-off 1/5 Booked on ${A.ref}: ${S} recorded ${k.map(e=>`${e.allergen} (${e.severity})`).join(', ')}`),(l||u)&&c(A),A},ackAlert:(t,r)=>e(e=>({alertAcks:{...e.alertAcks,[t]:{by:r,at:a().toISOString()}}}))}},{name:'covercharge-demo-v1',version:9,migrate:async(e,t)=>{if(!e)return e;if(n.LIVE_VENUE_BUILD)return await(0,s.archiveChefCache)('core',e),Object.assign(e,(0,r.stripCoreLiveSamples)(e)),e.clock={mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()},e;if(e.clock={mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()},t<6){try{e.restaurants=(e.restaurants??[]).map(e=>'saltmarsh'===e?.id?{...e,name:'The Venue'}:e)}catch{}try{e.restaurants=(e.restaurants??[]).map(e=>'anchorage'===e?.id&&JSON.stringify(e.kitchenHours)===JSON.stringify(g.ANCHORAGE_KITCHEN_OLD)?{...e,kitchenHours:g.ANCHORAGE_KITCHEN,hoursNote:'Kitchen (food) hours from Gordon, 30 Oct 2026: closed Mon\u2013Tue. The closing time is last food orders. Bar hours not set.'}:e)}catch{}}if(t<5)try{e.events=(e.events??[]).map(e=>'string'==typeof e?.title&&/\(substitute day\)/i.test(e.title)?{...e,title:e.title.replace(/\s*\(substitute day\)/gi,'').trim()}:e)}catch{}if(t<4)try{e.restaurants=(e.restaurants??[]).map(e=>'anchorage'===e.id&&e.settings&&!e.settings.pay?{...e,settings:{...e.settings,pay:g.ANCHORAGE_PAY}}:e)}catch{}if(t<3)try{e.restaurants=(e.restaurants??[]).map(e=>'anchorage'===e.id?{...e,settings:{...e.settings,orderAtTable:!1}}:e),e.orders=(e.orders??[]).filter(e=>'ord-seed-3'!==e.id&&'Q-2018'!==e.ref),e.audit=(e.audit??[]).filter(e=>!String(e.text??'').includes('Q-2018'))}catch{}if(t>=2)return e;try{const t=(0,u.buildSeed)((0,u.defaultSimStart)()),a=new Map(t.bookings.map(e=>[e.id,e])),r=new Set((0,m.anchoragePlan)().tables.map(e=>e.name)),n=e=>!e||e.split('+').every(e=>r.has(e));e.bookings=(e.bookings??[]).map(e=>{const t=a.get(e.id);return t?{...e,table:t.table,dog:t.dog,notes:t.notes}:'anchorage'!==e.restaurantId||n(e.table)?e:{...e,table:void 0}})}catch{}return e},merge:(e,r)=>{const n={...r,...e};return a.IS_WILDINGS&&(n.restaurants=n.restaurants.map(t.withWildingsAddress)),n},storage:(0,c.createJSONStorage)(()=>o.default)}))},872,[1092,5,1093,833,1096,1082,952,1091,1097,3,945,814,1102,823,940,1034]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useShallow",{enumerable:!0,get:function(){return o}});var e,t=r(d[0]),u=(e=t)&&e.__esModule?e:{default:e},n=r(d[1]);function o(e){const t=u.default.useRef(void 0);return u=>{const o=e(u);return(0,n.shallow)(t.current,o)?t.current:t.current=o}}},873,[30,1107]); +__d(function(g,_r,i,_a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TABLE_ORDER_DEFAULT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"cleanToken",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"isTableNo",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"fromRow",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"toRow",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"hm",{enumerable:!0,get:function(){return s}}),e.openAt=function(t,r){const n=a(r),o=t.openFrom?a(t.openFrom):null,l=t.lastOrders?a(t.lastOrders):null;return null!==o&&null!==l?o<=l?n>=o&&n=o||n=o:null===l||n{const r=(t??'').trim().toUpperCase();return/^[A-Z2-9]{16}$/.test(r)?r:null},n=t=>/^[0-9]{1,4}$/.test(t),o=r=>r?{on:!!r.is_on,tables:Array.isArray(r.tables)?r.tables.map(String):null,staffAccept:!1!==r.staff_accept,openFrom:r.open_from?String(r.open_from).slice(0,5):null,lastOrders:r.last_orders?String(r.last_orders).slice(0,5):null,guestTip:r.guest_tip??''}:{...t},l=t=>({is_on:t.on,tables:t.tables&&t.tables.length?t.tables.filter(n):null,staff_accept:t.staffAccept,open_from:t.openFrom,last_orders:t.lastOrders,guest_tip:t.guestTip.slice(0,300)}),a=t=>{const[r,n]=t.split(':').map(Number);return 60*r+n},s=t=>`${String(Math.floor(t/60)%24).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`;const c=(t,r)=>t.reduce((t,n)=>t+n.qty*(r.find(t=>t.id===n.id)?.pricePence??0),0),u=(t,r,n)=>t.map(t=>r.find(r=>r.id===t.id)).filter(t=>!!t&&(t.allergens.some(t=>n.includes(t))||t.mayContain.some(t=>n.includes(t)))),f=(t,r)=>`${t.replace(/\/$/,'')}/customer-app/index.html?table=${r}`,p=t=>'table'===t.type&&'table-qr'===t.channel,b=t=>p(t)&&!!t.held&&!t.accepted&&'cancelled'!==t.status,m=t=>!b(t),y=t=>'cancelled'===t.status?t.cancelReason?`Cancelled: ${t.cancelReason}`:'Cancelled by the staff.':t.held&&!t.accepted?'Sent. Waiting for a member of staff to accept it.':'served'===t.status||'collected'===t.status||'closed'===t.status?'Served. Enjoy!':'ready'===t.status?'Ready: on its way to your table.':'Accepted: the kitchen has your order.',O=['Sold out','Wrong table','Sent twice','Kitchen closed','Guest asked to cancel'],h='Please pay at the bar or till. Paying by card from your phone is coming later.'},876,[]); +__d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.venueTextStyle=d,Object.defineProperty(_e,"Text",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"TextInput",{enumerable:!0,get:function(){return h}});var t=r(_d[0]),n=r(_d[1]),o=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(n){if('default'!==n){var o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,t})(r(_d[2])),f=e(r(_d[3])),u=e(r(_d[4])),l=e(r(_d[5])),c=r(_d[6]),s=r(_d[7]);function d(e){if(!t.IS_SOUTERS)return e;const n=l.default.flatten(e)||{};return{...n,...'number'==typeof n.fontSize?{fontSize:(0,c.soutersFont)(n.fontSize)}:{},...'number'==typeof n.lineHeight?{lineHeight:(0,c.soutersFont)(n.lineHeight)}:{},...'string'==typeof n.color?{color:(0,c.soutersInk)(n.color)}:{}}}const y=o.forwardRef(function({style:e,...t},n){return(0,s.jsx)(f.default,{...t,ref:n,style:d(e)})}),p=o.forwardRef(function({style:e,placeholderTextColor:t,...n},o){const f=d([{fontSize:14,color:'#F5F1E8'},e]),y=l.default.flatten(f)||{};return(0,s.jsx)(u.default,{...n,ref:o,placeholderTextColor:'string'==typeof t?(0,c.soutersInk)(t):'#B8B0A0',style:[f,{minHeight:Math.max(44,'number'==typeof y.minHeight?y.minHeight:44),minWidth:Math.max(44,'number'==typeof y.minWidth?y.minWidth:44)}]})}),S=o.forwardRef(function({style:e,...t},o){const u=l.default.flatten(e)||{};return(0,s.jsx)(f.default,{...t,ref:o,style:[u,{color:u.color===n.QUEUED_BRAND?.accent?n.QUEUED_BRAND.smallTextAccent:u.color}]})}),_=t.IS_QUEUED_VENUE?S:t.IS_SOUTERS?y:f.default,h=t.IS_SOUTERS?p:u.default},877,[5,1206,30,206,273,46,868,24]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.TableNumberWarning=function({plan:u}){const c=(0,n.numberClashes)(u.tables),o=[...new Set([...c.acrossAreas,...u.tables.filter(n=>c.sameArea.has(n.name)).map(n.tableNumber)])];return o.length?(0,l.jsxs)(t.T,{testID:"duplicate-table-numbers",size:16,colour:s.colours.goldLight,children:["Duplicate table numbers: ",o.join(', '),". Kept unchanged. Ask a manager to check the areas before assigning."]}):null},r(d[0]);var n=r(d[1]),s=r(d[2]),t=r(d[3]),l=r(d[4])},914,[30,945,821,813,24]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingTableButton=function({rid:e,booking:l,readOnly:y,turnBase:B=90,testID:f}){const[h,j]=(0,t.useState)(!1),k=(0,s.tableButtonLabel)(l.table),x=f??`table-btn-${l.id}`;if(y)return(0,c.jsx)(n.default,{testID:x,accessible:!0,accessibilityLabel:(0,s.tableButtonA11y)(l.table,!0),style:{minHeight:44,justifyContent:'center'},children:(0,c.jsx)(b.T,{size:16,weight:"semibold",colour:o.colours.goldLight,children:k})});return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(b.Button,{kind:"secondary",label:k,testID:x,accessibilityLabel:(0,s.tableButtonA11y)(l.table),onPress:()=>j(!0),style:{minHeight:44}}),h?(0,c.jsx)(u.TablePicker,{rid:e,booking:l,name:l.walkIn?'Walk-in':(l.name??'').replace(' (example)',''),turnBase:B,onClose:()=>j(!1)}):null]})};var e,t=r(d[0]),l=r(d[1]),n=(e=l)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),u=r(d[4]),b=r(d[5]),c=r(d[6])},915,[30,127,1275,821,930,813,24]); +__d(function(g,_r,i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingEditButton=function({rid:e,booking:a,who:l,role:s,inStaffApp:o,shiftManager:n,big:d,testID:h}){const[u,b]=(0,t.useState)(!1);return a.walkIn||!(0,c.canEditBooking)({variant:r.APP_VARIANT,inStaffApp:o,role:s,shiftManager:n})?null:(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(p.Button,{kind:"secondary",small:!d,label:"Edit booking",testID:h??`edit-booking-${a.id}`,accessibilityLabel:`Edit booking, ${a.name}, ${a.time}`,onPress:()=>b(!0),style:{minHeight:d?64:44}}),u?(0,x.jsx)(j,{rid:e,id:a.id,who:l,onClose:()=>b(!1)}):null]})},_e.EditBookingPicker=function({rid:e,today:a,who:l,onClose:o,hidePrivate:n}){const[d,r]=(0,t.useState)(null),c=(0,s.useBookings)(e).filter(e=>!e.walkIn&&e.date>=a&&!['cancelled','noshow','finished'].includes(e.status)).sort((e,t)=>e.date.localeCompare(t.date)||e.time.localeCompare(t.time)).slice(0,60);return d?(0,x.jsx)(j,{rid:e,id:d,who:l,hidePrivate:n,onClose:o}):(0,x.jsxs)(p.Sheet,{visible:!0,onClose:o,title:"Edit booking \xb7 pick a booking",maxWidth:640,testID:"edit-booking-picker",children:[(0,x.jsx)(p.T,{size:16,colour:u.colours.text,children:"Tip: tap the booking you want to change."}),c.length?c.map(e=>(0,x.jsx)(p.Button,{kind:"secondary",testID:`edit-pick-${e.id}`,label:`${e.date===a?'Today':e.date} ${e.time} \xb7 ${e.name} \xb7 ${e.partySize} ${1===e.partySize?'cover':'covers'}`,sub:e.notes?`Notes: ${e.notes}`:void 0,accessibilityLabel:`Edit booking, ${e.name}, ${e.date===a?'today':e.date}, ${e.time}, ${e.partySize} covers`,onPress:()=>r(e.id),style:{minHeight:56,alignItems:'flex-start'}},e.id)):(0,x.jsx)(p.Muted,{children:"No bookings to edit from today on."}),(0,x.jsx)(p.Button,{kind:"ghost",label:"Close",onPress:o,style:{minHeight:44}})]})},_e.EditBookingSheet=j;var e,t=_r(_d[0]),a=_r(_d[1]),l=(e=a)&&e.__esModule?e:{default:e},s=_r(_d[2]),o=_r(_d[3]),n=_r(_d[4]),d=_r(_d[5]),r=_r(_d[6]),c=_r(_d[7]),h=_r(_d[8]),u=_r(_d[9]),b=_r(_d[10]),m=_r(_d[11]),p=_r(_d[12]),x=_r(_d[13]);const y=/^([01]\d|2[0-3]):[0-5]\d$/,k=e=>{const t=e.trim().replace('.',':').match(/^(\d{1,2}):?(\d{2})$/);return t?`${t[1].padStart(2,'0')}:${t[2]}`:e.trim()};function j({rid:e,id:a,who:j,onClose:f,hidePrivate:v='display'===r.APP_VARIANT}){const T=(0,s.useBookings)(e),I=T.find(e=>e.id===a),C=(0,d.useRestaurant)(e),D=(0,o.usePlan)(e),P=(0,n.useBlocks)(e=>e.blocks),[$,w]=(0,t.useState)(I?(0,c.draftOf)(I):null),[B,S]=(0,t.useState)(null),[E,A]=(0,t.useState)(null);if(!I||!$||!C)return null;const z=e=>{S(null),A(null),w({...$,...e})},L=k($.time),_=y.test(L),F=(0,h.tableOptions)(D,T.filter(e=>e.date===$.date),$.table),N=(0,c.changedFields)(I,{...$,time:L}),W=C.settings.turnMins??90,R=async()=>{const t=(0,c.editPatch)(I,{...$,time:L},{by:j||'Team member',app:r.APP_VARIANT});if(Object.keys(t).length&&await s.repo.bookings.update(I.id,t),'seated'===I.status&&'table'in t&&t.table!==I.table){const a=e=>e?e.split('+').map(e=>e.trim()).filter(Boolean):[],l=a(I.table),s=a(t.table),n=o.useFloor.getState(),d=l.map(t=>n.live[e]?.[t]?.stage).find(Boolean)??'seated';l.filter(e=>!s.includes(e)).forEach(t=>n.setLive(e,t,{stage:void 0,dirty:!0})),s.forEach(t=>n.setLive(e,t,{stage:d,dirty:!1}))}A(`Saved. Changed: ${(0,c.editedWords)(N)}.`),S(null),f()};return(0,x.jsxs)(p.Sheet,{visible:!0,onClose:f,title:`Edit booking \xb7 ${I.name} \xb7 ${I.ref}`,maxWidth:760,testID:"edit-booking-sheet",children:[(0,x.jsx)(m.DepositChip,{b:I,money:!0,big:!0,testID:"edit-deposit"}),(0,c.isWixBooking)(I)?(0,x.jsx)(l.default,{testID:"edit-wix-note",accessible:!0,accessibilityLabel:c.WIX_EDIT_NOTE,style:{padding:12,borderRadius:12,borderWidth:1,borderColor:u.colours.gold},children:(0,x.jsx)(p.T,{size:16,colour:u.colours.goldLight,children:c.WIX_EDIT_NOTE})}):null,(0,x.jsx)(p.T,{size:16,colour:u.colours.text,children:"Tip: change what you need, then press Save changes."}),(0,x.jsx)(b.BookingDatePicker,{r:C,today:new Date,value:$.date,onChange:e=>z({date:e})}),(0,x.jsx)(p.Field,{label:"Time (24-hour, for example 19:30)",value:$.time,onChangeText:e=>z({time:e}),testID:"edit-time"}),_?null:(0,x.jsx)(p.T,{size:15,colour:u.colours.amber,children:"Write the time like 19:30."}),(0,x.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(p.T,{size:18,children:"Covers"}),(0,x.jsx)(p.Stepper,{value:$.partySize,onChange:e=>z({partySize:e}),min:1,max:60,label:"covers",testID:"edit-covers"})]}),(0,x.jsx)(p.Field,{label:"Name",value:$.name,onChangeText:e=>z({name:e}),testID:"edit-name"}),v?(0,x.jsx)(p.Muted,{children:"Phone and email can be changed in the Managers app; the Display never shows them."}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(p.Field,{label:"Phone",value:$.phone,onChangeText:e=>z({phone:e}),keyboardType:"phone-pad",testID:"edit-phone"}),(0,x.jsx)(p.Field,{label:"Email",value:$.email,onChangeText:e=>z({email:e}),keyboardType:"email-address",autoCapitalize:"none",testID:"edit-email"})]}),(0,x.jsx)(p.Field,{label:"Notes",value:$.notes,onChangeText:e=>z({notes:e}),placeholder:c.NOTES_PLACEHOLDER,multiline:!0,numberOfLines:3,testID:"edit-notes"}),I.allergies.length||I.allergyNote?(0,x.jsx)(p.Muted,{children:"Allergies are kept separately and are not changed here."}):null,(0,x.jsx)(p.T,{size:18,weight:"semibold",children:(0,h.tableButtonLabel)($.table)}),(0,x.jsxs)(p.Row,{gap:8,wrap:!0,children:[(0,x.jsx)(p.Button,{kind:$.table?'secondary':'primary',label:"No table",accessibilityLabel:"No table"+($.table?'':', chosen'),onPress:()=>z({table:''}),style:{minHeight:44,minWidth:96},testID:"edit-table-none"}),F.map(e=>(0,x.jsx)(p.Button,{kind:e===$.table?'primary':'secondary',label:(0,h.tableButtonLabel)(e),accessibilityLabel:`Table ${(0,h.tableButtonLabel)(e)}${e===$.table?', chosen':''}`,onPress:()=>z({table:e}),style:{minHeight:44,minWidth:64},testID:`edit-table-${e}`},e))]}),B?(0,x.jsxs)(l.default,{testID:"edit-warn",style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:u.colours.amber,backgroundColor:u.colours.amberBg},children:[B.map(e=>(0,x.jsx)(p.T,{size:16,colour:"#FFE2A8",children:e},e)),(0,x.jsx)(p.T,{size:16,colour:"#FFE2A8",children:"You can still save."})]}):null,E?(0,x.jsx)(p.T,{size:16,colour:u.colours.goldLight,children:E}):null,(0,x.jsxs)(p.Row,{gap:8,wrap:!0,children:[(0,x.jsx)(p.Button,{label:B?'Save anyway':'Save changes',testID:"edit-save",disabled:!_||$.name.trim().length<1||!N.length,onPress:()=>{const t=_?(0,n.blockAt)(P,e,$.date,L):void 0,a=(0,c.editWarnings)(I,{...$,time:L},T,t,W);!a.length||B?R():S(a)},style:{minHeight:56,flex:1}}),(0,x.jsx)(p.Button,{kind:"ghost",label:"Cancel",onPress:f,style:{minHeight:56}})]})]})}},916,[30,127,819,825,824,1022,806,812,1275,821,1276,951,813,24]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useScreensaverAsleep",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"useDisplayToolsH",{enumerable:!0,get:function(){return s}});var t=r(d[0]);const n=(0,t.create)(t=>({asleep:!1,set:n=>t({asleep:n})})),s=(0,t.create)(()=>({h:65}))},917,[952]); +__d(function(g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useSoldOut",{enumerable:!0,get:function(){return f}}),_e.setSoldOutBy=m,_e.setSoldOut=function(e,t,n){if(!s.useStore.getState().menu.find(t=>t.id===e))return;n&&m(n);s.useStore.getState().updateMenuItem(e,{soldOut:t})},_e.soldOutNow=function(e,t=c()){return(0,o.activeSoldOut)(f.getState().entries,e,t)},_e.linkSoldOut=O,_e.useSoldOutLink=function(e,t,n=!0){const r=_r(d[9]);r.useEffect(()=>{n&&O({adopt:e})},[e,n]),r.useEffect(()=>{n&&m(t)},[t,n])};var e,t=_r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},r=_r(d[1]),a=_r(d[2]),o=_r(d[3]),i=_r(d[4]),s=_r(d[5]),u=_r(d[6]),l=_r(d[7]);const c=()=>{try{return(0,s.nowFrom)(s.useStore.getState().clock)}catch{return new Date}},f=(0,r.create)()((0,a.persist)((e,t)=>({entries:[],adopted:{},mark:(t,n,r,a)=>{const u=c(),l=s.useStore.getState().restaurants.find(e=>e.id===t),f=(0,o.soldOutSettingsOf)(l?.settings?.soldOut),S=l?(0,i.hoursFor)(l,u)?.close??null:null,m=(0,o.clearAfterFor)(u,f,S),p={rid:t,itemId:n,name:r.slice(0,120),on:!0,at:u.toISOString(),by:a.slice(0,80),clearAfter:m?.toISOString(),auto:!1,kept:!1};e(e=>({entries:[...e.entries.filter(e=>!(e.rid===t&&e.itemId===n)),p]}))},back:(n,r,a)=>{const o=t().entries.find(e=>e.rid===n&&e.itemId===r);o&&o.on&&e(e=>({entries:e.entries.map(e=>e===o?{...e,on:!1,at:c().toISOString(),by:a.slice(0,80),clearAfter:void 0,kept:!!e.auto}:e)}))},expire:(n,r)=>{const a=(0,o.expiredSoldOut)(t().entries,n,r);if(!a.length)return 0;const i=new Set(a.map(e=>e.itemId));return e(e=>({entries:e.entries.map(e=>e.rid===n&&i.has(e.itemId)?{...e,on:!1,by:'Cleared automatically',clearAfter:void 0}:e)})),a.length}}),{name:'covercharge-soldout-v1',version:1,storage:(0,a.createJSONStorage)(()=>n.default),partialize:e=>({entries:e.entries.slice(-500),adopted:e.adopted})}));let S='Staff';function m(e){e&&(S=e.replace(' (example)',''))}let p=null;function O(e){if(p)return p;let t=!1;const n=(e=s.useStore.getState().menu)=>new Map(e.map(e=>[e.id,e.soldOut]));let r=n();if(e.adopt){const e={...f.getState().adopted},t=[];for(const t of s.useStore.getState().menu)e[t.restaurantId];for(const t of s.useStore.getState().menu)e[t.restaurantId]=!0;f.setState(n=>({entries:[...n.entries,...t],adopted:e}))}const a=()=>{const e=c(),a=f.getState().entries,o=s.useStore.getState().menu,i=new Map;for(const t of a){const n=t.on&&(!t.clearAfter||new Date(t.clearAfter).getTime()>e.getTime());i.set(`${t.rid}|${t.itemId}`,n)}const u=o.filter(e=>i.has(`${e.restaurantId}|${e.id}`)&&i.get(`${e.restaurantId}|${e.id}`)!==e.soldOut);if(u.length){t=!0;try{const e=new Map(u.map(e=>[e.id,i.get(`${e.restaurantId}|${e.id}`)]));s.useStore.setState(t=>({menu:t.menu.map(t=>e.has(t.id)?{...t,soldOut:e.get(t.id)}:t)}))}finally{t=!1,r=n()}}},o=s.useStore.subscribe((e,a)=>{if(e.menu===a.menu)return;const o=n(e.menu);if(!t)for(const t of e.menu){const e=r.get(t.id);void 0!==e&&e!==t.soldOut&&(t.soldOut?f.getState().mark(t.restaurantId,t.id,t.name,S):f.getState().back(t.restaurantId,t.id,S))}r=o}),i=f.subscribe((e,t)=>{e.entries!==t.entries&&a()}),u=()=>{const e=c(),t=new Set(f.getState().entries.filter(e=>e.on).map(e=>e.rid));for(const n of t)f.getState().expire(n,e)};u(),a();const l=setInterval(u,3e4);let m=null;if(e.adopt)try{m=_r(d[8],"./autoSoldOutStore").startAutoSoldOut()}catch{m=null}return p=()=>{o(),i(),clearInterval(l),m&&m(),p=null},p}u.PITCH&&'undefined'!=typeof globalThis&&(globalThis.__pitchLive=e=>(0,l.setLiveData)(!!e),globalThis.__pitchSoldOut=e=>{const t=s.useStore.getState(),n=t.restaurants[0]?.id;if(!n)return;const r=t.menu.filter(e=>e.restaurantId===n&&!e.hidden),a=['Sticky toffee pudding','Cullen skink','Fish supper','Steak pie','Haggis bon bons','Cranachan','Lemon tart','Mussels','Scampi','Venison burger','Chips (large)','Oysters','Lobster thermidor','Crab claws','Tablet ice cream','Beef shin','Smoked salmon','Cheeseboard','Halibut','Clootie dumpling'],o=(new Date).toISOString(),i=Array.from({length:e},(e,t)=>r[t]?{id:r[t].id,name:r[t].name}:{id:`pitch-so-${t}`,name:a[t%a.length]});f.setState(e=>({entries:[...e.entries.filter(e=>e.rid!==n||!i.some(t=>t.id===e.itemId)).map(e=>e.rid===n?{...e,on:!1}:e),...i.map(e=>({rid:n,itemId:e.id,name:e.name,on:!0,at:o,by:'Chef'}))]}))})},918,[1082,952,1091,944,815,872,2,1081,942,30]); +__d(function(g,r,i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"dismissNotice",{enumerable:!0,get:function(){return u.dismissNotice}}),Object.defineProperty(_e,"notify",{enumerable:!0,get:function(){return u.notify}}),Object.defineProperty(_e,"useSliders",{enumerable:!0,get:function(){return u.useSliders}}),Object.defineProperty(_e,"SLIDER",{enumerable:!0,get:function(){return y}}),_e.SliderButton=w,_e.SliderCard=S,_e.SliderHost=function(){x();const e=(0,u.useSliders)(e=>e.queue),n=e[0],o=(0,t.useRef)(null);if((0,t.useEffect)(()=>{if(f)return window.ccSlider=e=>(0,u.notify)(e),()=>{delete window.ccSlider}},[]),(0,t.useEffect)(()=>{if(o.current&&clearTimeout(o.current),!n)return;const e=void 0!==n.timeoutMs?n.timeoutMs:n.actions?.length||n.content?null:6e3;return e&&(o.current=setTimeout(()=>u.useSliders.getState().dismiss(n.id),e)),()=>{o.current&&clearTimeout(o.current)}},[n?.id,n?.timeoutMs]),!n)return null;const s=f?'fixed':'absolute';return(0,b.jsxs)(b.Fragment,{children:[n.modal?(0,b.jsx)(l.default,{...h('dim'),style:{position:s,left:0,right:0,top:0,bottom:0,zIndex:2147482990,backgroundColor:'rgba(0,0,0,0.72)'}}):null,(0,b.jsx)(l.default,{testID:"cc-slider-host",pointerEvents:"box-none",style:{position:s,left:12,right:12,bottom:12,zIndex:2147483e3,alignItems:'center',...f?{bottom:'calc(12px + env(safe-area-inset-bottom))'}:{}},children:(0,b.jsx)(S,{n:n,waiting:e.length-1,onClose:()=>u.useSliders.getState().dismiss(n.id)},n.id+':'+(n.seq??0))})]})};var t=r(d[0]);r(d[1]);var n=e(r(d[2])),o=e(r(d[3])),l=e(r(d[4])),s=e(r(d[5])),c=r(d[6]),a=r(d[7]),u=r(d[8]),b=r(d[9]);const f='undefined'!=typeof document,p="\n[data-ccsl=\"in\"]{animation:ccsl-in .45s cubic-bezier(.2,1,.3,1) both}\n@keyframes ccsl-in{from{opacity:0;transform:translate3d(0,110%,0)}to{opacity:1;transform:none}}\n[data-ccsl=\"urgent\"]{animation:ccsl-in .45s cubic-bezier(.2,1,.3,1) both,ccsl-red 1.6s ease-in-out .45s infinite}\n@keyframes ccsl-red{0%,100%{box-shadow:0 10px 30px rgba(0,0,0,.6),0 0 0 1px rgba(255,107,94,.55)}50%{box-shadow:0 10px 40px rgba(0,0,0,.6),0 0 0 2px #FF6B5E,0 0 34px rgba(255,107,94,.45)}}\n[data-ccsl=\"dim\"]{animation:ccsl-dim .3s ease both}\n@keyframes ccsl-dim{from{opacity:0}to{opacity:1}}\n@media (prefers-reduced-motion: reduce){[data-ccsl]{animation:none !important}}\n",h=e=>f?{dataSet:{ccsl:e}}:{};function x(){(0,t.useEffect)(()=>{if(!f||document.getElementById('cc-slider-css'))return;const e=document.createElement('style');e.id='cc-slider-css',e.textContent=p,document.head.appendChild(e)},[])}const y={bg:'#17140F',border:'rgba(207,164,95,.55)',text:'#F5F1E8',quiet:'#A89A80',gold:c.colours.gold,ink:'#17130D'},j=(e="normal")=>'urgent'===e?c.colours.red:'warn'===e?c.colours.amber:c.colours.gold,k=(e="normal")=>'urgent'===e?'rgba(255,107,94,.75)':'warn'===e?'rgba(255,181,71,.65)':y.border;function w({a:e,onDone:t,big:o}){const l=e.kind??'primary';return(0,b.jsx)(n.default,{testID:e.testID,accessibilityRole:"button",accessibilityLabel:e.label,onPress:()=>{try{e.onPress?.()}finally{e.keepOpen||t()}},style:({pressed:e})=>({minHeight:o?56:44,minWidth:44,paddingHorizontal:'ghost'===l?10:o?24:18,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:'primary'===l?y.gold:'transparent',borderWidth:'danger'===l?1:0,borderColor:c.colours.red,opacity:e?.8:1}),children:(0,b.jsx)(a.T,{size:o?18:'ghost'===l?14:15,weight:'primary'===l?'bold':'medium',colour:'primary'===l?y.ink:'danger'===l?c.colours.red:y.quiet,children:e.label})})}function S({n:e,onClose:t,waiting:n=0,maxWidth:c=520}){x();const u=e.tone??'normal',p=j(u),S=e.content,C=!!e.big,{height:I}=(0,s.default)(),D=e.actions??[];return(0,b.jsxs)(l.default,{testID:e.testID??'cc-slider',accessibilityRole:"summary",accessibilityLabel:`${e.kicker?e.kicker+': ':''}${e.title}`,...h('urgent'===u?'urgent':'in'),style:{width:'100%',maxWidth:C?Math.max(c,900):c,alignSelf:'center',borderRadius:14,backgroundColor:y.bg,borderWidth:1,borderColor:k(u),overflow:'hidden',...f?{boxShadow:'0 10px 30px rgba(0,0,0,.6)'}:{elevation:12}},children:['normal'!==u?(0,b.jsx)(l.default,{style:{position:'absolute',left:0,top:0,bottom:0,width:5,backgroundColor:p}}):null,(0,b.jsxs)(o.default,{style:{maxHeight:Math.max(220,I-40)},contentContainerStyle:{paddingVertical:C?18:12,paddingLeft:'normal'!==u?C?24:18:C?20:14,paddingRight:C?20:14,gap:C?10:6},children:[(0,b.jsxs)(l.default,{style:{flexDirection:'row',alignItems:'center',gap:12},children:[e.icon?(0,b.jsx)(a.T,{size:C?34:22,children:e.icon}):null,(0,b.jsxs)(l.default,{style:{flex:1,gap:2},children:[e.kicker?(0,b.jsx)(a.T,{size:C?15:11,weight:"bold",colour:p,style:{letterSpacing:1.4},children:e.kicker}):null,(0,b.jsx)(a.T,{size:C?24:15,weight:"medium",colour:y.text,children:e.title}),e.body?(0,b.jsx)(a.T,{size:C?18:13,colour:y.quiet,children:e.body}):null]}),D.length||S?null:(0,b.jsx)(w,{a:{label:'OK',kind:'ghost',testID:'cc-slider-ok'},onDone:t,big:C})]}),S?(0,b.jsx)(S,{close:t}):null,D.length?(0,b.jsx)(l.default,{style:{flexDirection:'row',flexWrap:'wrap',alignItems:'center',gap:8,justifyContent:'flex-end'},children:D.map(e=>(0,b.jsx)(w,{a:e,onDone:t,big:C},e.label))}):null,n>0?(0,b.jsxs)(a.T,{size:C?14:11,colour:y.quiet,children:[n," more waiting"]}):null]})]})}},919,[30,122,263,151,127,287,821,813,947,24]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AppBadge=function({label:o}){return(0,c.jsx)(t.default,{testID:"app-badge",accessibilityLabel:`${o} app`,style:{borderWidth:1,borderColor:s.colours.gold,borderRadius:6,paddingHorizontal:6,paddingVertical:1,backgroundColor:(0,e.soutersSurface)('#1c1a16')},children:(0,c.jsx)(u.T,{size:10,weight:"bold",colour:s.colours.gold,children:o})})};var e=r(d[0]);r(d[1]);var o,l=r(d[2]),t=(o=l)&&o.__esModule?o:{default:o},s=r(d[3]),u=r(d[4]),c=r(d[5])},920,[868,30,127,821,813,24]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.CoversToday=function({rid:e,onPress:v,big:$,sound:p,testID:x="covers-today",day:C,compact:j=!1}){const w=(0,c.useBookings)(e),k=(0,c.useNow)(3e4),T=(0,h.venueYmd)(k),D=C&&C!==T?C:T,I=D!==T,L=I?(0,y.dayCovers)(w,D,T):(0,u.coversToday)(w,T),_=(0,y.dayWord)(D,T),M=/^(Today|Yesterday|Tomorrow)$/.test(_),R=`COVERS ${_.toUpperCase()}`,S=I?`${M?`${_}\u2019s`:_} bookings \u203a`:'Today\u2019s bookings \u203a',O=I?`${M?`${_}, `:''}${(0,y.dayLong)(D)}`:'today',P=(0,o.useLiveState)();if('ready'!==P)return(0,f.jsx)(o.LiveWait,{state:P,title:"Covers today",testID:`${x}-wait`});const W=$?64:44,z=L.total?Math.min(1,L.done/L.total):0,B=(e,o,t,c)=>(0,f.jsxs)(s.default,{style:{flex:1,alignItems:'center',gap:6,minWidth:0},children:[(0,f.jsx)(l.SplitFlap,{value:o,height:W,colour:t,testID:`covers-${c}`,sound:p}),(0,f.jsx)(n.T,{size:$||j?14:12,weight:"semibold",colour:b.colours.muted,numberOfLines:j?void 0:1,center:j,style:{letterSpacing:.4},children:e})]});return(0,f.jsxs)(t.default,{testID:x,accessibilityRole:"button",disabled:!v,onPress:v,accessibilityLabel:`Covers ${O}: ${L.done} done, ${L.toCome} ${D({backgroundColor:e?b.colours.tilePressed:b.colours.surface,borderRadius:16,borderWidth:1,borderColor:b.colours.hairline,padding:16,gap:12}),children:[(0,f.jsxs)(s.default,{style:{flexDirection:j?'column':'row',justifyContent:'space-between',alignItems:'center',gap:j?6:void 0},children:[(0,f.jsx)(n.T,{center:j,size:j?16:12,weight:"semibold",colour:b.colours.goldMuted,style:{letterSpacing:1.6},children:R}),v?(0,f.jsx)(n.T,{center:j,size:j?14:12,colour:b.colours.muted,children:S}):null]}),(0,f.jsxs)(s.default,{style:{flexDirection:'row',gap:8},children:[B('Done',L.done,b.colours.text,'done'),B(De.set),d=a??t,[n,u]=j[e];return(0,r.useEffect)(()=>{if('display'!==e||!a)return;const t=setTimeout(()=>o(e,null),12e4);return()=>clearTimeout(t)},[e,a,o]),(0,D.jsxs)(l.default,{testID:"day-bar",style:{gap:8},children:[(0,D.jsx)(s.DaySwitch,{day:d,today:t,onDay:t=>o(e,t),back:-n,ahead:u,idPrefix:"day"}),a?(0,D.jsx)(c.Button,{testID:"day-today",kind:"secondary",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>o(e,null),style:{minHeight:48}}):null]})},_e.DayView=function({rid:e,day:s,today:r,app:d}){const n=(0,u.useRestaurant)(e),x=(0,u.useBookings)(e),j=(0,u.useEvents)(e),_=(0,p.parseYmd)(s),B=se.date===s),O=(0,f.regularEventsOf)(n).filter(e=>(0,f.occursOn)(e,s)),T=x.filter(e=>e.date===s).sort((e,t)=>e.time.localeCompare(t.time)).filter(y.ACTIVE),E='display'===d;return(0,D.jsxs)(l.default,{testID:"day-view",style:{gap:12},children:[(0,D.jsxs)(c.Card,{children:[(0,D.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,D.jsxs)(c.T,{weight:"semibold",colour:b.colours.gold,children:[(0,p.niceDate)(_),$?` \xb7 ${$.name} hours`:'']}),(0,D.jsx)(c.Badge,{kind:"gold",label:B?'LOOKING BACK':'LOOKING AHEAD'})]}),(0,D.jsxs)(c.T,{size:E?18:15,children:[C?`Kitchen ${k(C[0])}\u2013${k(C[1])}`:'Kitchen closed',C&&v&&'kitchen closes'!==v.reason?` \xb7 last food orders ${k(v.time)} (${v.reason})`:'']}),O.map(e=>(0,D.jsxs)(c.T,{size:14,colour:b.colours.goldLight,children:["\u266a ",e.name,e.time?` from ${k(e.time)}`:'',e.busier?' \xb7 expect busier':'']},e.id)),w.map(e=>(0,D.jsxs)(c.T,{size:14,colour:b.colours.goldLight,children:["\u2605 ",(0,y.holidayName)(e.title)]},e.id)),(0,D.jsx)(c.Muted,{children:"Read-only. Nothing here changes today\u2019s service."})]}),(0,D.jsx)(a.CoversToday,{rid:e,day:s}),(0,D.jsx)(m.PlattersBooked,{rid:e,date:s,label:B?'Platters that day':'Platters booked'}),T.length?T.map(s=>(0,D.jsxs)(l.default,{style:{gap:6,padding:14,borderRadius:16,borderWidth:1,borderColor:b.colours.hairline,backgroundColor:b.colours.surface},children:[(0,D.jsxs)(c.T,{weight:"semibold",children:[s.time," \xb7 ",s.walkIn?`Walk-in ${s.ref}`:s.name," \xb7 ",s.partySize," covers",s.table?` \xb7 ${(0,t.tableNumbers)(s.table)}`:'']}),(0,D.jsx)(o.DepositChip,{b:s,money:!0,testID:`day-deposit-${s.id}`}),(0,D.jsx)(m.BookingNeeds,{b:s}),'display'!==d&&!B&&['confirmed','pending'].includes(s.status)?(0,D.jsx)(l.default,{style:{flexDirection:'row'},children:(0,D.jsx)(A.WhatsAppGuest,{b:s,rid:e,kind:"auto"})}):null]},s.id)):(0,D.jsx)(c.Muted,{children:B?'No bookings that day.':'No bookings yet for this day.'})]})};var e,t=_r(_d[0]),s=_r(_d[1]),a=_r(_d[2]),o=_r(_d[3]),r=_r(_d[4]),d=_r(_d[5]),l=(e=d)&&e.__esModule?e:{default:e},n=_r(_d[6]),c=_r(_d[7]),u=_r(_d[8]),y=_r(_d[9]),h=_r(_d[10]),f=_r(_d[11]),p=_r(_d[12]),b=_r(_d[13]),m=_r(_d[14]),A=_r(_d[15]),D=_r(_d[16]);const x=(0,n.create)(e=>({day:{},set:(t,s)=>e(e=>({day:{...e.day,[t]:s??void 0}}))})),j={owner:[-s.DAY_BACK,s.DAY_AHEAD],chef:[-s.DAY_BACK,s.DAY_AHEAD],display:[-s.DAY_BACK,s.DAY_AHEAD],staff:[-s.DAY_BACK,s.DAY_AHEAD]},k=e=>{const[t,s]=e.split(':').map(Number);return`${t%12||12}${s?`:${String(s).padStart(2,'0')}`:''}${t<12?'am':'pm'}`};function _(e,t){const s=x(t=>t.day[e]);return s&&s!==t?s:null}},922,[808,936,921,951,30,127,952,813,819,828,815,809,818,821,950,1020,24]); +__d(function(_g,r,_i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"setDisplaySilent",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"soundAllowed",{enumerable:!0,get:function(){return u}}),e.chime=function(t="bright"){if(!u())return void l('__ccChimesBlocked');try{const n=o();if(!n)return;('bright'===t?[880,1318.5]:[659.3]).forEach((o,c)=>{const i=n.currentTime+.16*c,u=n.createOscillator(),l=n.createGain();u.type='sine',u.frequency.value=o,l.gain.setValueAtTime(1e-4,i),l.gain.exponentialRampToValueAtTime('bright'===t?.12:.07,i+.02),l.gain.exponentialRampToValueAtTime(1e-4,i+.9),u.connect(l).connect(n.destination),u.start(i),u.stop(i+.95)}),l('__ccChimes')}catch{}},Object.defineProperty(e,"LOW_CHIME_MIN",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"LOW_CHIME_MAX",{enumerable:!0,get:function(){return d}}),e.lowChime=function(t=0){if(!u())return void l('__ccChimesBlocked');const n=s+.095*Math.max(0,Math.min(1,t));'undefined'!=typeof window&&(window.__ccLowChimeLevels=[...window.__ccLowChimeLevels??[],Math.round(1e3*n)/1e3].slice(-40));try{const t=o();if(!t)return;[220,164.8].forEach((o,c)=>{const i=t.currentTime+.42*c,u=t.createOscillator(),l=t.createGain(),s=t.createBiquadFilter?.();u.type='triangle',u.frequency.value=o,l.gain.setValueAtTime(1e-4,i),l.gain.exponentialRampToValueAtTime(n,i+.12),l.gain.exponentialRampToValueAtTime(1e-4,i+1.6),s?(s.type='lowpass',s.frequency.value=900,u.connect(s).connect(l).connect(t.destination)):u.connect(l).connect(t.destination),u.start(i),u.stop(i+1.7)}),l('__ccLowChimes')}catch{}},Object.defineProperty(e,"flapSoundOn",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"setFlapSound",{enumerable:!0,get:function(){return w}}),e.flapClick=function(){if('display'!==t.APP_VARIANT&&!c)return;if(!p())return;try{const t=o();if(!t)return;const n=t.currentTime,c=Math.floor(.03*t.sampleRate),i=t.createBuffer(1,c,t.sampleRate),u=i.getChannelData(0);for(let t=0;t{if('undefined'==typeof window)return null;const t=window.AudioContext||window.webkitAudioContext;return t?(n||(n=new t),'suspended'===n.state&&n.resume?.().catch?.(()=>{}),n):null};if('undefined'!=typeof window){const t=()=>{try{o()}catch{}window.removeEventListener('pointerdown',t)};window.addEventListener('pointerdown',t)}let c=!1;const i=t=>{c=t},u=()=>'display'!==t.APP_VARIANT&&!c,l=t=>{'undefined'!=typeof window&&(window[t]=(window[t]??0)+1)};const s=.015,d=.11;const f='cc-flap-sound',p=()=>{try{return'undefined'!=typeof localStorage&&'1'===localStorage.getItem(f)}catch{return!1}},w=t=>{try{localStorage.setItem(f,t?'1':'0')}catch{}}},923,[122,806]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.SeatAllergenReminder=function({rid:c}){const u=(0,n.useRef)(new Set);return(0,n.useEffect)(()=>s.useStore.subscribe((n,s)=>{if(n.bookings===s.bookings)return;const h=new Map(s.bookings.map(t=>[t.id,t.status]));for(const s of n.bookings){if(s.restaurantId!==c||'seated'!==s.status||!(0,l.hasAllergens)(s)||u.current.has(s.id))continue;const n=h.get(s.id);n&&'seated'!==n&&(u.current.add(s.id),(0,o.notify)({id:`seat-allergen:${s.id}`,tone:'urgent',testID:'seat-allergen-reminder',icon:'\u26a0\ufe0f',kicker:'RE-CONFIRM ALLERGENS AT THE TABLE',title:`${s.name} \xb7 ${s.partySize} covers${s.table?` \xb7 ${(0,t.tableNumbers)(s.table)}`:''}`,body:`${(0,l.allergenText)(s)}. Before taking the order, check the allergens with the guests again and tell the kitchen about any change.`,actions:[{label:'Done, re-confirmed with the guests',testID:'seat-allergen-ok'}]}))}}),[c]),null},e.useKitchenTodoChime=function(t,u,h){const f=(0,s.useStore)(n=>n.bookings.filter(n=>n.restaurantId===t&&n.date>=u&&!n.walkIn&&((0,l.needsAllergenSeen)(n)||(0,l.needsHoldOk)(n))).map(t=>t.id).sort().join(',')),k=f?f.split(',').length:0,b=(0,n.useRef)(null);return(0,n.useEffect)(()=>{const t=s.useStore.getState().bookings.filter(t=>f.split(',').includes(t.id)),n=b.current;if(b.current=t.map(t=>t.id),null===n)return;const k=t.filter(t=>!n.includes(t.id));if(k.length){(0,c.soundAllowed)()&&(0,c.chime)('bright');for(const t of k){const n=(0,l.needsAllergenSeen)(t);(0,o.notify)({id:`kitchen-todo:${t.id}`,tone:n?'urgent':'warn',testID:'kitchen-todo-notice',icon:n?'\u26a0\ufe0f':'\ud83c\udf7d\ufe0f',kicker:n?'ALLERGENS TO SIGN OFF':'PLATTER TO SIGN OFF',title:`${t.name} \xb7 ${t.partySize} covers \xb7 ${t.date===u?'today':t.date} ${t.time}`,body:n?`${(0,l.allergenText)(t)}. Tap Allergens seen on the booking once the kitchen has read it.`:'A platter is booked. Tap Platter OK on the booking once the kitchen can do it.',actions:[...h?[{label:'Open bookings',onPress:h}]:[],{label:'Later',kind:'ghost'}]})}}},[f]),k};var t=r(d[0]),n=r(d[1]),o=r(d[2]),s=r(d[3]),l=r(d[4]),c=r(d[5])},924,[808,30,947,819,828,923]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useVoiceSlot",{enumerable:!0,get:function(){return w}}),_e.voiceAppFor=S,_e.useVoiceTarget=p,_e.VoiceSlot=function({size:e=56}){const t=p(),u=(0,n.useRef)(null),c=(0,n.useRef)(y++).current,{width:l,height:f}=(0,o.default)(),S=()=>u.current?.measureInWindow((e,t,n)=>{n&&w.setState({rect:{x:e,y:t,size:n},owner:c})});return(0,n.useEffect)(()=>{const e=setTimeout(S,50);return()=>clearTimeout(e)},[l,f,t?.on]),(0,n.useEffect)(()=>()=>{w.getState().owner===c&&w.setState({rect:null,owner:0})},[]),(0,n.useEffect)(()=>{t?.on||w.getState().owner!==c||w.setState({rect:null,owner:0})},[t?.on]),t?.on?(0,h.jsx)(s.default,{ref:u,testID:"voice-slot",onLayout:S,style:{width:e,height:e,flexShrink:0}}):null};var t=r(d[0]),n=r(d[1]),o=e(r(d[2])),s=e(r(d[3])),u=r(d[4]),c=r(d[5]),l=r(d[6]),f=r(d[7]),h=r(d[8]);const w=(0,u.create)(()=>({rect:null,owner:0}));function S(e){return'customer'===c.APP_VARIANT||/^\/(customer|table|demo)/.test(e)?null:e.startsWith('/owner')||e.startsWith('/admin')?'owner':e.startsWith('/team')?'staff':e.startsWith('/kitchen')?'chef':e.startsWith('/display')?'display':null}function p(){const e=(0,t.usePathname)()||'/',n=(0,l.useCtx)(6e4),o=(0,f.useVoiceSettings)(e=>e.enabled),s=S(e);if(!s)return null;const u='owner'===s?'owner'===n.role?'owner':'manager'===n.role?'manager':'staff':s;return{app:s,role:u,actions:'staff'===u?'staff':s,on:(0,f.voiceOn)(o,n.rid,u)}}let y=1},925,[804,30,287,127,952,806,927,1278,24]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"TABLES",{enumerable:!0,get:function(){return P}}),_e.useTableNames=O,_e.resetTableLive=z,_e.seatBookingNow=async function(e,t){await h.repo.bookings.setStatus(t.id,'seated'),z(e,t.table)},_e.finishBookingNow=async function(e,t){await h.repo.bookings.setStatus(t.id,'finished'),(0,w.tablesOf)(t.table).forEach(t=>w.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!0}))},_e.useTableUse=B,Object.defineProperty(_e,"walkInLabel",{enumerable:!0,get:function(){return M}}),_e.TablePicker=N,_e.WalkInSheet=F,_e.AssignTableSheet=A,_e.undoNotice=L,_e.NewBookingSheet=W,_e.useFrontDoor=function(e,t){const[s,o]=(0,a.useState)(!1),[l,i]=(0,a.useState)(!1),[r,d]=(0,a.useState)(null);return{openWalkIn:()=>o({}),openWalkInAt:e=>o({table:e}),openBooking:()=>i(!0),assignTable:e=>d({b:e}),combineTables:e=>d({b:e,combine:!0}),elements:(0,I.jsxs)(I.Fragment,{children:[s?(0,I.jsx)(F,{wide:t,initialTable:s.table,onClose:()=>o(!1),onSeated:L}):null,l?(0,I.jsx)(W,{wide:t,date:e,onClose:()=>i(!1),onSaved:e=>(0,n.notify)({id:`booked:${Date.now()}`,testID:'booking-saved-toast',timeoutMs:5e3,icon:'\u2713',title:`Booked: ${e.name} \xb7 ${(0,y.niceDate)((0,y.parseYmd)(e.date))} at ${e.time}`})}):null,r?(0,I.jsx)(A,{booking:r.b,combine:r.combine,onClose:()=>d(null)}):null]})}};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),n=_r(_d[4]),a=_r(_d[5]),i=e(a),r=_r(_d[6]),d=e(_r(_d[7])),u=e(_r(_d[8])),c=_r(_d[9]),b=_r(_d[10]),h=_r(_d[11]),p=_r(_d[12]),f=_r(_d[13]),y=_r(_d[14]),x=_r(_d[15]),k=_r(_d[16]),j=_r(_d[17]),w=_r(_d[18]),T=_r(_d[19]),S=_r(_d[20]),C=_r(_d[21]),v=_r(_d[22]),D=_r(_d[23]),$=_r(_d[24]),I=_r(_d[25]);const P=Array.from({length:12},(e,t)=>String(t+1));function O(e){const t=(0,w.usePlan)(e);return t.areas.flatMap(e=>t.tables.filter(t=>t.areaId===e.id).map(e=>e.name))}function z(e,t){(0,w.tablesOf)(t).forEach(t=>w.useFloor.getState().setLive(e,t,{stage:'seated',dirty:!1}))}function B(e,t){const s=(0,h.useBookings)(e),o=(0,h.useOrders)(e),l=O(e),n=(0,w.useFloor)(t=>t.live[e])??{},a=(0,w.usePlan)(e),i=(0,T.useBlocks)(e=>e.blocks),r=(0,y.ymd)(t),d=(0,T.closedAreasAt)(i,e,r,(0,y.hm)(t)),u={};for(const e of l)u[e]=n[e]?.blocked||d.has(`tbl:${e}`)?{busy:!0,label:'Blocked'}:d.has(a.tables.find(t=>t.name===e)?.areaId??'')?{busy:!0,label:'Closed'}:n[e]?.dirty?{busy:!0,label:'Needs clearing'}:{busy:!1,label:'Free'};for(const e of s)if(e.date===r&&e.table)for(const s of(0,w.tablesOf)(e.table))if(u[s])if('seated'===e.status)u[s]={busy:!0,label:`${e.walkIn?'Walk-in':`${e.name.slice(0,1)}.`} \xb7 ${e.partySize}`};else if('confirmed'===e.status&&!u[s].busy){const o=(0,y.minsBetween)(t,new Date(`${e.date}T${e.time}:00`));o>=-15&&o<=90&&(u[s]={...u[s],soon:`Booked ${e.time}`})}for(const e of o)'table'===e.type&&e.tableNo&&u[e.tableNo]&&!['closed','cancelled','collected'].includes(e.status)&&!u[e.tableNo].busy&&(u[e.tableNo]={busy:!0,label:'Open order'});return u}const M=e=>e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;function N({use:e,value:t,onPick:o,big:l,best:n,dense:i,bestSet:r,picked:c}){const b=Object.keys(e),[h,p]=(0,a.useState)(0),f=i?6:8,y=i?64:l?92:76,k=h?Math.max(3,Math.floor((h+f)/(y+f))):0,T=k?Math.floor((h-f*(k-1))/k):y,S=new Set(r??[]),C=n?(0,w.tablesOf)(n)[0]:null;return(0,I.jsx)(u.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:f},testID:"table-picker",onLayout:e=>p(Math.floor(e.nativeEvent.layout.width)),children:b.map(l=>{const n=e[l],a=t===l||!!c?.includes(l),r=S.has(l),b=C===l&&!a,h=n.busy?['Blocked','Needs clearing','Closed'].includes(n.label)?n.label:'In use':n.soon??'Free';return(0,I.jsxs)(d.default,{accessibilityRole:"button",testID:`pick-table-${l}`,accessibilityLabel:`Table ${(0,s.tableNumbers)(l)}${c?a?', picked':', not picked':''}, ${n.busy?`in use (${n.label})`:n.soon?`free, ${n.soon}`:'free'}${r?', best table':''}${b?', suggested for this party':''}`,accessibilityState:{selected:a,disabled:'Closed'===n.label},disabled:'Closed'===n.label,onPress:()=>o(l),style:{width:T,minHeight:i?58:64,borderRadius:12,borderWidth:a||b?2.5:1.5,paddingVertical:i?3:6,paddingHorizontal:4,alignItems:'center',justifyContent:'center',gap:2,borderColor:a||b?x.colours.gold:n.busy?x.colours.red:x.colours.ok,backgroundColor:a?x.colours.goldTint:n.busy?x.colours.redBg:x.colours.surface2,opacity:'Closed'!==n.label||a?1:.55},children:[(0,I.jsxs)(u.default,{style:{flexDirection:'row',alignItems:'center',gap:4},children:[(0,I.jsx)(j.T,{weight:"bold",size:22,colour:a?x.colours.goldLight:x.colours.text,children:(0,s.tableNumbers)(l)}),r?(0,I.jsx)(u.default,{testID:"best-table",style:{backgroundColor:x.colours.gold,borderRadius:5,paddingHorizontal:4,paddingVertical:1},children:(0,I.jsx)(j.T,{size:11,weight:"bold",colour:x.colours.onGold,children:"BEST"})}):null]}),(0,I.jsx)(j.T,{size:i?13:14,colour:n.busy?'#FFD9D4':n.soon?'#FFE2A8':'#E2C489',center:!0,numberOfLines:1,children:h})]},l)})})}const R=[1,2,3,4,5,6,7,8];function F({onClose:e,onSeated:o,wide:l,initialTable:n}){const{rid:p,r:k,now:S}=(0,b.useCtx)(15e3),C=B(p,S),[v,D]=(0,a.useState)(2),[$,P]=(0,a.useState)(!1),[O,M]=(0,a.useState)(n??null),F=(0,w.usePlan)(p),A=(0,h.useBookings)(p),L=(0,T.useBlocks)(e=>e.blocks),W=(0,T.closedAreasAt)(L,p,(0,y.ymd)(S),(0,y.hm)(S)),E=i.default.useMemo(()=>{const e=Object.fromEntries(Object.entries(C).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,f.suggestTable)(F,A.filter(e=>e.date===(0,y.ymd)(S)),e,v,S,(0,f.turnFor)(v,k.settings.turnMins),90,void 0,{closed:W})?.table??null},[F,A,C,v,W.size,S.getTime()]);(0,a.useEffect)(()=>{O&&(0,w.tablesOf)(O).some(e=>'Closed'===C[e]?.label)&&M(null)},[O,W.size]);const[H,_]=(0,a.useState)(!1),[U,q]=(0,a.useState)(''),V=(e,t=String(e),s=()=>{P(!1),D(e)})=>{const o='9+'===t?$:!$&&v===e;return(0,I.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:'9+'===t?'Party of 9 or more':`Party of ${e}`,accessibilityState:{selected:o},onPress:s,style:{width:l?58:60,height:l?58:56,borderRadius:14,borderWidth:2,borderColor:x.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:o?x.colours.gold:'transparent'},children:(0,I.jsx)(j.T,{weight:"bold",size:22,colour:o?x.colours.onGold:x.colours.gold,children:t})},t)},G=(0,I.jsxs)(j.Row,{gap:12,style:{justifyContent:'center'},children:[(0,I.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:"One fewer",onPress:()=>D(e=>Math.max(9,e-1)),style:{width:56,height:56,borderRadius:28,borderWidth:2,borderColor:x.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,I.jsx)(j.T,{size:26,colour:x.colours.gold,children:"\u2212"})}),(0,I.jsx)(j.T,{weight:"bold",size:26,children:v}),(0,I.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:"One more",onPress:()=>D(e=>Math.min(40,e+1)),style:{width:56,height:56,borderRadius:28,borderWidth:2,borderColor:x.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,I.jsx)(j.T,{size:26,colour:x.colours.gold,children:"+"})})]}),K=(0,I.jsxs)(u.default,{style:{gap:8,width:l?256:void 0},children:[(0,I.jsx)(j.T,{weight:"semibold",children:"How many people?"}),(0,I.jsxs)(u.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"walkin-party",children:[R.map(e=>V(e)),V(9,'9+',()=>{P(!0),D(e=>e>=9?e:9)})]}),$?G:null]}),[Q,Y]=(0,a.useState)(!1),J=async(t=O)=>{if(!Q){Y(!0);try{const s=await h.repo.bookings.seatWalkIn(p,v,t??void 0,U);z(p,t??void 0),o(s),e()}finally{Y(!1)}}},X=(0,I.jsxs)(u.default,{style:{gap:8,flex:l?1:void 0,minWidth:0},children:[(0,I.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,I.jsxs)(j.T,{weight:"semibold",children:["Table ",(0,I.jsx)(j.T,{colour:x.colours.muted,size:14,children:"(optional)"})]}),O?(0,I.jsx)(j.Button,{small:!0,kind:"ghost",label:"Clear table",onPress:()=>M(null)}):null]}),(0,I.jsx)(N,{use:C,value:O,onPick:e=>{C[e]&&!C[e].busy?J(e):M(O===e?null:e)},big:l,dense:l,best:E,bestSet:(0,r.bestTables)(F)}),(0,I.jsxs)(j.Muted,{children:["Tap a free table to seat them there",E&&!O?` (suggested for ${v}: ${(0,s.tableNumbers)(E)})`:'',", or Seat for no table yet. BEST marks the venue\u2019s best tables."]})]});return(0,I.jsxs)(j.Sheet,{visible:!0,onClose:e,title:`Walk-in \xb7 ${(0,y.hm)(S)}`,maxWidth:l?1100:void 0,testID:"walkin-sheet",children:[(0,I.jsx)(j.Button,{label:`Seat walk-in \xb7 ${v} ${1===v?'person':'people'}${O?` \xb7 ${(0,s.tableNumbers)(O)}`:''}`,disabled:Q,onPress:()=>{J()},testID:"seat-walkin",style:{minHeight:52}}),l?(0,I.jsxs)(j.Row,{gap:16,style:{alignItems:'flex-start'},children:[K,X]}):(0,I.jsxs)(I.Fragment,{children:[K,X]}),(0,I.jsxs)(j.Row,{gap:10,wrap:!0,style:{alignItems:'center'},children:[H?(0,I.jsx)(t.TextInput,{accessibilityLabel:"Walk-in note",placeholder:"Note (optional), e.g. high chair",placeholderTextColor:"#7D776C",value:U,onChangeText:q,style:[j.styles.input,{flex:1,minWidth:220}],autoFocus:!0}):(0,I.jsx)(j.Button,{small:!0,kind:"ghost",label:"Add a note (optional)",onPress:()=>_(!0)}),(0,I.jsx)(u.default,{style:{flex:1,minWidth:220},children:(0,I.jsxs)(j.Muted,{children:["No name needed. Counts in today's covers.",'staff'!==c.APP_VARIANT?' Using website bookings too? Mark the table there as well.':'']})})]})]})}function A({booking:e,onClose:t,combine:o}){const{rid:l,r:n,now:d}=(0,b.useCtx)(15e3),c=B(l,d),p=(0,w.usePlan)(l),k=(0,h.useBookings)(l),T=(0,w.tablesOf)(e.table),S=i.default.useMemo(()=>Object.fromEntries(Object.entries(c).map(([e,t])=>[e,T.includes(e)?{busy:!1,label:'This party',soon:'This party'}:t])),[c,e.table]),C=i.default.useMemo(()=>{const t=Object.fromEntries(Object.entries(S).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,f.suggestTable)(p,k.filter(e=>e.date===(0,y.ymd)(d)),t,e.partySize,d,(0,f.turnFor)(e.partySize,n.settings.turnMins),90,e.id)?.table??null},[p,k,S,e.partySize,d.getTime()]),[v,D]=(0,a.useState)(!!o||T.length>1),[$,P]=(0,a.useState)(T),O=e=>p.tables.find(t=>t.name===e)?.maxSeats??0,R=$.reduce((e,t)=>e+O(t),0),F=$.length>0&&R{const o=(0,w.joinTables)(s);await h.repo.bookings.assignTable(e.id,o);T.filter(e=>!s.includes(e)).forEach(t=>w.useFloor.getState().setLive(l,t,{stage:void 0,dirty:'seated'===e.status})),'seated'===e.status&&z(l,o),t()},L=v?(0,I.jsxs)(u.default,{style:{gap:8},testID:"assign-table-tip",children:[(0,I.jsx)(u.default,{accessibilityLiveRegion:"polite",children:(0,I.jsx)(j.T,{size:17,weight:"semibold",colour:x.colours.text,children:$.length?`${(0,w.tablesLabel)((0,w.joinTables)($))} \xb7 ${R} seats for ${e.partySize} covers`:'No tables picked yet'})}),F?(0,I.jsx)(u.default,{testID:"combine-short",children:(0,I.jsxs)(j.T,{size:15,weight:"semibold",colour:"#FFD9D4",children:["Not enough seats yet: ",e.partySize-R," more needed. Add another table."]})}):null,(0,I.jsx)(j.T,{size:15,colour:x.colours.text,children:"Tap each table to add or remove it, then tap Done. All of them show as taken until the party has finished."}),(0,I.jsxs)(j.Row,{gap:8,wrap:!0,children:[(0,I.jsx)(j.Button,{label:"Done",testID:"combine-done",disabled:!$.length,accessibilityLabel:$.length?`Done, save ${(0,w.tablesLabel)((0,w.joinTables)($))}`:'Done',onPress:()=>A($)}),(0,I.jsx)(j.Button,{kind:"ghost",label:"Cancel",onPress:t})]})]}):(0,I.jsx)(u.default,{style:{gap:8},testID:"assign-table-tip",children:(0,I.jsx)(j.T,{size:15,colour:x.colours.text,children:"Red tables are in use right now; you can still pick one (e.g. joining a table). BEST marks the venue\u2019s best tables. Big party? Tap Combine tables."})});return(0,I.jsxs)(j.Sheet,{visible:!0,onClose:t,title:`${v?'Combine tables':'Assign table'} \xb7 ${M(e)}`,testID:"assign-table-sheet",footer:L,children:[C&&!v?(0,I.jsx)(u.default,{testID:"assign-suggested",children:(0,I.jsxs)(j.T,{size:16,weight:"semibold",colour:x.colours.goldLight,children:["Suggested for ",e.partySize,": ",(0,s.tableNumbers)(C)]})}):null,v?null:(0,I.jsx)(j.Button,{kind:"secondary",label:"Combine tables",testID:"combine-start",accessibilityLabel:"Combine tables: pick several tables for this party",onPress:()=>D(!0)}),(0,I.jsx)(N,{use:S,best:v?null:C,bestSet:(0,r.bestTables)(p),picked:v?$:void 0,onPick:v?e=>P(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]):async e=>{await A([e])}})]})}function L(e){(0,n.notify)({id:`walkin:${e.id}`,testID:'walkin-toast',timeoutMs:6e3,title:`${M(e)} seated \xb7 ${e.table?`${(0,s.tableNumbers)(e.table)}`:'table to assign'} (${e.ref})`,actions:[{label:'Undo',testID:'undo-walkin',onPress:()=>h.repo.bookings.undoWalkIn(e.id)},{label:'OK',kind:'ghost'}]})}function W({date:e,onClose:t,wide:n,onSaved:i}){const{rid:r,r:d,now:c,role:P,meId:O}=(0,b.useCtx)(6e4),z=(0,y.ymd)(c),[B,M]=(0,a.useState)(ee.blocks),[F,A]=(0,a.useState)(!1),[L,W]=(0,a.useState)(''),[E,H]=(0,a.useState)(2),[_,U]=(0,a.useState)(null),[q,V]=(0,a.useState)(''),[G,K]=(0,a.useState)(''),[Q,Y]=(0,a.useState)(''),[J,X]=(0,a.useState)('phone'),[Z,ee]=(0,a.useState)((0,C.emptyNeeds)()),te=(0,C.needsMissing)(Z),[se,oe]=(0,a.useState)(null),le=(0,w.usePlan)(r),ne=(0,$.dogSetUp)(le),ae=!0===Z.dog&&ne,ie=Z.dog?Z.dogs:0,re=(0,y.parseYmd)(B),de=(0,f.turnFor)(E,d.settings.turnMins),ue=N.filter(e=>e.date===B),ce=e=>(0,f.freeTablesAt)(le,ue,E,new Date(`${B}${(0,s.tableNumbers)(e)}:00`),de,d.settings.turnMins,{dog:!0,closed:(0,T.closedAreasAt)(R,r,B,e)}),be=ae&&_?ce(_):[];(0,a.useEffect)(()=>{oe(null)},[ae,_,E]);const he=(0,p.bookingSlots)(d,re,e=>N.filter(t=>t.date===B&&t.time===e&&'cancelled'!==t.status&&!t.walkIn).reduce((e,t)=>e+t.partySize,0),E,B===(0,y.ymd)(c)?c:(0,y.addMins)(re,0)),ge=(0,k.ukPhone)(G),pe=_?(0,T.blockAt)(R,r,B,_):void 0,me='staff'!==P,fe=!!_&&!(0,C.dogTimeOk)(d,N,B,_,ie),ye=!te.length&&L.trim().length>=2&&!!_&&ge.ok&&(0,k.emailOk)(Q)&&(!pe||me&&F)&&(!ae||be.length>0)&&!fe,xe=Z.wheelchair>0||Z.stepFree;return(0,I.jsxs)(j.Sheet,{visible:!0,onClose:t,title:`New booking \xb7 ${(0,y.niceDate)(re)}`,maxWidth:n?760:void 0,testID:"booking-sheet",children:[(0,I.jsx)(C.FirstQuestions,{rid:r,value:Z,onChange:ee,party:E,audience:"staff"}),Z.dog&&!ne?(0,I.jsx)(j.T,{size:13,colour:x.colours.amber,children:"Dog-friendly tables aren\u2019t marked yet. Managers \u203a Booking options \u203a Tables. Booking is allowed; check where the dog can sit."}):null,(0,I.jsx)(S.BookingDatePicker,{r:d,today:c,value:B,onChange:e=>{e!==B&&(M(e),U(null),A(!1))}}),(0,I.jsxs)(j.Row,{gap:6,children:[(0,I.jsx)(j.Chip,{label:"Phone",selected:'phone'===J,onPress:()=>X('phone')}),(0,I.jsx)(j.Chip,{label:"In person",selected:'in-person'===J,onPress:()=>X('in-person')})]}),(0,I.jsx)(j.Field,{label:"Name",value:L,onChangeText:W,placeholder:"e.g. Reid",testID:"nb-name"}),(0,I.jsx)(j.Field,{label:"Mobile or phone number (needed)",value:G,onChangeText:K,keyboardType:"phone-pad",placeholder:"e.g. 07700 900123",testID:"nb-phone"}),!ge.ok&&G?(0,I.jsx)(j.T,{size:13,colour:x.colours.amber,children:ge.error}):null,(0,I.jsx)(j.Field,{label:"Email (optional)",value:Q,onChangeText:Y,keyboardType:"email-address",autoCapitalize:"none",placeholder:"For an email confirmation too",testID:"nb-email"}),(0,k.emailOk)(Q)?null:(0,I.jsx)(j.T,{size:13,colour:x.colours.amber,children:"That email doesn\u2019t look quite right."}),(0,I.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,I.jsx)(j.T,{children:"Covers"}),(0,I.jsx)(j.Stepper,{value:E,onChange:H,min:1,max:20,label:"covers"})]}),(0,I.jsx)(j.Row,{wrap:!0,gap:6,children:he.map(e=>{const t=ae&&e.available&&!ce(e.time).length||!(0,C.dogTimeOk)(d,N,B,e.time,ie);return(0,I.jsx)(j.Chip,{label:e.time,sub:(0,T.blockAt)(R,r,B,e.time)?'Paused':t?'Dogs full':e.drinksOnly?'Drinks only':`${e.left} left`,disabled:!e.available||t,selected:_===e.time,onPress:()=>{U(e.time),A(!1)}},e.time)})}),ae&&_?(0,I.jsxs)(u.default,{style:{gap:6},testID:"nb-dog-tables",children:[(0,I.jsxs)(j.T,{size:14,weight:"semibold",children:["Dog-friendly table ",(0,I.jsxs)(j.T,{size:13,colour:x.colours.muted,children:["(",le.areas.filter(e=>e.dogs).map(e=>e.name).join(' or '),")"]})]}),be.length?(0,I.jsx)(j.Row,{wrap:!0,gap:6,children:be.slice(0,10).map((e,t)=>(0,I.jsx)(j.Chip,{label:`${(0,s.tableNumbers)(e.table)}`,sub:`${e.area} \xb7 ${e.seats}${0===t?' \xb7 best':''}${xe&&(0,$.accessibleSetUp)(le)&&!(0,$.isAccessible)(le,e.table)?' \xb7 not step-free':''}`,selected:(se??be[0].table)===e.table,onPress:()=>oe(e.table)},e.table))}):(0,I.jsxs)(j.T,{size:14,colour:x.colours.amber,children:["No dog-friendly table free for ",E," at ",_,". Try another time."]})]}):null,pe?(0,I.jsxs)(u.default,{testID:"nb-block-warning",style:{borderWidth:1.5,borderColor:x.colours.amber,backgroundColor:x.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[(0,I.jsxs)(j.T,{weight:"semibold",colour:x.colours.amber,children:["Bookings are paused ",pe.from,"\u2013",pe.to,pe.reason?` (${pe.reason})`:'']}),me?(0,I.jsx)(j.Chip,{label:F?'Manager override on':'Override and book anyway',selected:F,onPress:()=>A(e=>!e)}):(0,I.jsx)(j.Muted,{children:"Ask a manager to override, or pick another time."})]}):null,he.length?null:(0,I.jsx)(u.default,{testID:"nb-closed",children:(0,I.jsxs)(j.T,{size:14,weight:"semibold",colour:x.colours.amber,children:["Closed on ",(0,y.niceDate)(re)," (per the venue\u2019s opening hours). Pick another date."]})}),(0,I.jsx)(C.MoreQuestions,{rid:r,r:d,value:Z,onChange:ee,party:E,date:B,time:_,today:(0,y.ymd)(c),bookings:N,audience:"staff",showTables:!1!==d.settings.tableRequests}),xe&&!(0,$.accessibleSetUp)(le)?(0,I.jsx)(j.T,{size:13,colour:x.colours.amber,children:"Step-free tables aren\u2019t marked yet (Managers \u203a Booking options \u203a Tables). Check the table works for a wheelchair."}):null,(0,I.jsx)(j.Field,{label:"Notes (optional)",value:q,onChangeText:V,placeholder:v.NOTES_PLACEHOLDER,multiline:!0,numberOfLines:3,testID:"nb-notes"}),(0,l.depositDue)((0,l.depositOf)(d.settings),E)?(0,I.jsxs)(j.Muted,{children:["Deposit due: ",(0,o.gbp)((0,l.depositDue)((0,l.depositOf)(d.settings),E))," (",(0,o.gbp)((0,l.depositOf)(d.settings).perPersonPence)," per person for ",(0,l.depositOf)(d.settings).fromParty,"+). Deposits are paid through website bookings or to you, never in CoverCharge: tick Deposit paid on the booking once the guest has paid."]}):null,(0,I.jsxs)(j.Muted,{children:["The guest gets a confirmation text",Q.trim()?' and email':''," automatically (preview mode: shown in the Outbox, not sent)."]}),fe?(0,I.jsxs)(j.T,{size:14,colour:x.colours.amber,children:["We already have the most dogs we can look after at ",_,". Try another time: dogs are very welcome then."]}):null,(0,I.jsx)(j.Button,{label:te.length?te[0]:'Save booking',testID:"nb-save",disabled:!ye,onPress:()=>{if(B<(0,y.ymd)(c))return;const e=(0,C.needsPatch)(Z),s=Z.tableReq.find(e=>!ae||be.some(t=>t.table===e));h.repo.bookings.create({restaurantId:r,customerId:null,name:L.trim(),partySize:E,date:B,time:_,notes:q.trim(),security:(0,l.depositDue)((0,l.depositOf)(d.settings),E)?'deposit':'none',depositPaid:0,...(0,l.depositDue)((0,l.depositOf)(d.settings),E)?{depositDue:(0,l.depositDue)((0,l.depositOf)(d.settings),E),depositPolicy:(0,l.depositWords)((0,l.depositOf)(d.settings),E,d.name).join(' '),depositRefundable:(0,l.depositOf)(d.settings).refundable,depositCutoffHours:(0,l.depositOf)(d.settings).cutoffHours}:{},phone:ge.pretty,email:Q.trim()||void 0,source:J,...e,...he.find(e=>e.time===_)?.drinksOnly?{drinksOnly:!0}:{},allergies:e.allergies??[],...ae?{table:se??s??be[0]?.table}:{}}).then(e=>(0,D.postNewBookingToKitchen)(e,O)).catch(()=>{}),i?.({date:B,time:_,name:L.trim()}),t()}})]})}},926,[877,808,816,13,919,30,945,263,127,806,927,819,817,826,818,821,823,813,825,824,1276,827,812,950,828,24]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"fmtH",{enumerable:!0,get:function(){return d.fmtH}}),Object.defineProperty(_e,"fmtHDay",{enumerable:!0,get:function(){return d.fmtHDay}}),Object.defineProperty(_e,"clampRole",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"StaffAppCtx",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"useInStaffApp",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"ShiftMgrScope",{enumerable:!0,get:function(){return y}}),_e.useShiftManager=D,_e.useSignedIn=b,_e.useCtx=function(e=1e4){const o=(0,t.useContext)(p),u=(0,r.useOwner)(e=>e.site),i=(0,r.useOwner)(e=>e.previewRole),f=(0,r.useOwner)(e=>e.staffAs),d=b(),m=o||'staff'===s.APP_VARIANT,w=(0,t.useContext)(y),h=D(),O=m?w&&h?'manager':'staff':d?l(i,d.role):i,S=(0,r.useOwner)(e=>e.staff),M=(0,n.useRestaurant)(u),A=(0,n.useNow)(e),I=d?d.id:m&&f?f:c[O],P=S.find(e=>e.id===I)?.name??'Team member';return{rid:u,r:M,now:A,role:O,me:P,meId:I,today:(0,a.venueYmd)(A),signedIn:!!d}},Object.defineProperty(_e,"weekday",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"DAY3",{enumerable:!0,get:function(){return O}}),_e.ensureAttendance=function(t,n){if(e.LIVE_VENUE_BUILD||(0,o.isLive)())return;const s=r.useOwner.getState(),u=[],i=s.staff.find(e=>e.active&&'manager'===e.role)??s.staff.find(e=>e.active&&'owner'===e.role),f=new Date(n);f.setDate(n.getDate()-h(n));const d=(0,a.ymd)(f),c=(0,a.ymd)(new Date(f.getFullYear(),f.getMonth(),f.getDate()+6)),m=(e,t,n)=>{const r=new Date(e);return r.setHours(0,0,0,0),r.setMinutes(Math.round(60*t)+n),r.toISOString()};for(let e=42;e>=1;e--){const t=new Date(n);t.setDate(t.getDate()-e);const r=(0,a.ymd)(t);if(s.attendance.some(e=>e.date===r))continue;const o=s.shifts.filter(e=>e.date===r&&!1!==e.published);(o.length?o:s.shifts.filter(e=>e.day===h(t)&&e.date>=d&&e.date<=c&&!1!==e.published)).forEach((n,a)=>{const s=e=>Math.round((7*r.charCodeAt(9)+13*a+e)%17-5),o=n.end-n.start,f=o>8?30:o>6?20:0,d=e>2&&i?{signOff:{by:i.name,byId:i.id,at:m(t,34,a)}}:{};u.push({id:`at-${r}-${n.staffId}`,staffId:n.staffId,date:r,in:m(t,n.start,s(1)),out:m(t,n.end,s(2)),inSite:!0,outSite:!0,breakMins:f,...d})})}u.length&&r.useOwner.setState({attendance:[...r.useOwner.getState().attendance,...u]})},_e.paidMins=function(e,t){if(!e.in)return{worked:0,brk:0,paid:0};const n=Math.max(0,Math.round(((e.out?new Date(e.out):t).getTime()-new Date(e.in).getTime())/6e4)),r=e.breakMins??0;return{worked:n,brk:r,paid:Math.max(0,n-r)}},Object.defineProperty(_e,"hmDur",{enumerable:!0,get:function(){return S}}),_e.payRange=function(e,t,n){const r=new Date(n);if(r.setHours(0,0,0,0),'monthly'===e){const e=new Date(r.getFullYear(),r.getMonth()+t,1),n=new Date(e.getFullYear(),e.getMonth()+1,0);return{s:e,e:n,key:`m-${(0,a.ymd)(e)}`}}const s='weekly'===e?7:14,o=new Date(r);o.setDate(r.getDate()-h(r));let u=new Date(o);if('fortnightly'===e){const e=new Date(2026,0,5);(Math.round((o.getTime()-e.getTime())/6048e5)%2+2)%2==1&&u.setDate(u.getDate()-7)}u.setDate(u.getDate()+t*s);const i=new Date(u);return i.setDate(u.getDate()+s-1),{s:u,e:i,key:`${e[0]}-${(0,a.ymd)(u)}`}},_e.useHourly=function(){const e=b(),t=(0,r.useOwner)(e=>e.hourly);return e?t:M};var e=_r(_d[0]),t=_r(_d[1]),n=_r(_d[2]),r=_r(_d[3]),a=_r(_d[4]),s=_r(_d[5]),o=_r(_d[6]),u=_r(_d[7]),i=_r(_d[8]),f=_r(_d[9]),d=_r(_d[10]);const c={owner:f.ROSTER.find(e=>'owner'===e.role)?.id??'',manager:f.ROSTER.find(e=>'manager'===e.role)?.id??'',staff:f.ROSTER.find(e=>'staff'===e.app)?.id??''},m={staff:0,manager:1,owner:2},l=(e,t)=>m[e]>m[t]?t:e,p=(0,t.createContext)(!1),w=()=>(0,t.useContext)(p),y=(0,t.createContext)(!1);function D(){const e=(0,t.useContext)(p)||'staff'===s.APP_VARIANT,n=b(),r=(0,o.useSync)(e=>!!e.venueId&&'staff'===e.kind),a=(0,o.useSync)(e=>e.perms);return(0,u.shiftManagerOn)({inStaffApp:e,managerAccess:n?.managerAccess,role:n?.role,app:(0,i.rosterPerson)(n?.id)?.app,live:r,perms:a})}function b(){const e=(0,i.useSession)(e=>e.meId),t=(0,r.useOwner)(e=>e.staff);return e?t.find(t=>t.id===e&&t.active):void 0}const h=e=>(e.getDay()+6)%7,O=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'];const S=e=>`${Math.floor(e/60)}h ${String(e%60).padStart(2,'0')}m`;const M={}},927,[833,30,819,856,818,806,820,1032,859,14,1031]); +__d(function(_g,_r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"snap",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"fitLabel",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"BIG_LABEL_MIN",{enumerable:!0,get:function(){return y}}),_e.areaBounds=w,_e.minReadableScale=function(e,t){return Math.max(0,...e.tables.filter(e=>e.areaId===t).map(e=>{const t='round'===e.shape?.85:1,o=(7.4399999999999995*Math.max(1,(0,c.tableNumber)(e).length)+6)/(e.w*t),n=22/Math.min(e.w,e.h);return Math.max(o,n)}))},_e.seatSpots=M,_e.FixtureShape=j,_e.FloorCanvas=function(e){const[v,k]=(0,n.useState)({w:0,h:0}),C=e.plan.tables.filter(t=>t.areaId===e.areaId),I=e.crop&&C.length?w(e.plan,e.areaId):{x:0,y:0,w:s.PLAN_W,h:s.PLAN_H},z={x:I.x,y:I.y,r:I.x+I.w,b:I.y+I.h},R=v.w?'width'===e.fit?Math.min(v.w/s.PLAN_W,e.maxH?e.maxH/s.PLAN_H:9):Math.min(v.w/I.w,v.h/I.h):0,S=e.fill&&'contain'===e.fit&&R>0&&v.h>0,$=S?(v.w/R-I.w)/2:0,A=S?(v.h/R-I.h)/2:0,T={x:z.x-$,y:z.y-A,r:z.r+$,b:z.b+A},L=T.r-T.x,E=T.b-T.y,[N,F]=(0,n.useState)(null),_=(0,n.useRef)(null),B=t=>e.plan.sections.find(e=>e.id===t.sectionId),P=t=>e.plan.joins.find(e=>e.tables.includes(t.name)),D=r.default.useMemo(()=>(0,c.numberClashes)(e.plan.tables).sameArea,[e.plan.tables]),O=(t,o)=>({onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>!0,onResponderTerminationRequest:()=>!1,onResponderGrant:e=>{_.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY,id:t.id,kind:o}},onResponderMove:n=>{const r=_.current;if(!r)return;const i=n.nativeEvent.pageX-r.x,s=n.nativeEvent.pageY-r.y;Math.abs(i)+Math.abs(s)<6&&!N||('live'!==e.mode||e.onDrop&&e.view&&['seated','mains','dessert','bill'].includes(e.view[t.name]?.status)&&e.view[t.name]?.booking)&&F({id:t.id,dx:i,dy:s,kind:o})},onResponderRelease:n=>{const r=_.current;_.current=null;const i=n.nativeEvent.pageX-(r?.x??0),a=n.nativeEvent.pageY-(r?.y??0);if(F(null),Math.abs(i)+Math.abs(a)<6||!R)return void('move'===o&&e.onTap?.(t));const l=i/R,u=a/R;if('edit'===e.mode&&'move'===o)e.onMove?.(t,p(g(t.x+l,e.snapOn),0,s.PLAN_W-t.w),p(g(t.y+u,e.snapOn),0,s.PLAN_H-t.h));else if('edit'===e.mode&&'resize'===o)e.onResize?.(t,p(g(t.w+l,e.snapOn),50,400),p(g(t.h+u,e.snapOn),50,300));else if('live'===e.mode&&e.onDrop){const o=t.x+t.w/2+l,n=t.y+t.h/2+u,r=C.find(e=>e.id!==t.id&&o>=e.x-10&&o<=e.x+e.w+10&&n>=e.y-10&&n<=e.y+e.h+10);r&&e.onDrop(t,r)}}}),W=e=>e*R,H='width'===e.fit?s.PLAN_H*R||200:void 0;return(0,b.jsx)(i.default,{testID:"floor-canvas",onLayout:e=>k({w:e.nativeEvent.layout.width,h:e.nativeEvent.layout.height}),style:[{width:'100%',borderRadius:16,overflow:'hidden'},'contain'===e.fit?{flex:1}:{height:H}],children:R?(0,b.jsx)(i.default,{style:{width:W(L),height:W(E),alignSelf:'center',backgroundColor:(0,t.soutersSurface)('#0F0E0C'),borderRadius:16,borderWidth:1,borderColor:l.colours.border,overflow:'hidden'},children:(0,b.jsxs)(i.default,{style:{position:'absolute',left:-W(T.x),top:-W(T.y),width:W(s.PLAN_W),height:W(s.PLAN_H)},children:['edit'===e.mode?Array.from({length:s.PLAN_W/(2*s.GRID)},(e,o)=>(0,b.jsx)(i.default,{style:{position:'absolute',left:W(o*s.GRID*2),top:0,bottom:0,width:1,backgroundColor:(0,t.soutersSurface)('#1E1B16')}},`v${o}`)):null,'edit'===e.mode?Array.from({length:s.PLAN_H/(2*s.GRID)},(e,o)=>(0,b.jsx)(i.default,{style:{position:'absolute',top:W(o*s.GRID*2),left:0,right:0,height:1,backgroundColor:(0,t.soutersSurface)('#1E1B16')}},`h${o}`)):null,(e.plan.fixtures??[]).filter(t=>t.areaId===e.areaId).map(t=>(0,b.jsx)(j,{f:t,S:W,live:'live'===e.mode},t.id)),e.plan.joins.map(e=>{const t=C.filter(t=>e.tables.includes(t.name));if(t.length<2)return null;const[o,n]=t,r=o.x+o.w/2,s=o.y+o.h/2,a=n.x+n.w/2,l=n.y+n.h/2,u=Math.hypot(a-r,l-s),h=Math.atan2(l-s,a-r);return(0,b.jsx)(i.default,{testID:`join-${e.tables.join('+')}`,style:{position:'absolute',left:W((r+a)/2-u/2),top:W((s+l)/2)-3,width:W(u),height:6,borderRadius:3,backgroundColor:'rgba(207,164,95,0.55)',transform:[{rotate:`${h}rad`}]}},e.id)}),C.map(n=>{const g=e.view?.[n.name],p=g?a.STATUS[g.status]:a.STATUS.free,v=N?.id===n.id,w=v&&'resize'===N.kind?Math.max(50,n.w+N.dx/R):n.w,j=v&&'resize'===N.kind?Math.max(50,n.h+N.dy/R):n.h,k=v&&'move'===N.kind?n.x+N.dx/R:n.x,C=v&&'move'===N.kind?n.y+N.dy/R:n.y,I=e.selected===n.id||e.highlight?.includes(n.name),z=B(n),S='edit'===e.mode?'#2A2419':p.colour,$='edit'===e.mode?l.colours.text:p.fg,A='round'===n.shape?W(Math.min(w,j))/2:W(10),T='live'===e.mode?(0,c.liveTableLabel)(n,D):(0,s.tableLabel)(n),L=W(Math.min(w,j))<64,E=f(e.big?Math.max(13,Math.min(34,W(Math.min(w,j))/3)):Math.max(11,Math.min(22,W(Math.min(w,j))/4)),T,W(w)*('round'===n.shape?.85:1),e.big?y:9),F=Math.max(e.big?11:12,Math.round(.62*E)),_=(W(j)-6-1.4*E)/(1.4*F),H=_>=2&&W(w)>=5*F?2:_>=1?1:0,G=g?g.booking&&void 0!==g.seatedMins?g.booking.time:g.next?.time:void 0,X='edit'===e.mode?`${(0,o.tableNumbers)(T)}, ${(0,s.shapeLabel)(n.shape).toLowerCase()}, ${n.minSeats}\u2013${n.maxSeats} seats${n.online?', bookable online':''}`:`${(0,o.tableNumbers)(T)}, ${p.label}${void 0!==g?.seatedMins?`, seated ${g.seatedMins} min`:''}${g?.covers?`, ${g.covers} covers`:''}${void 0!==g?.nextIn&&'seated'!==g.status?`, next booking ${g.next?.time}`:''}${g?.dayBookings?.length?`, booked: ${g.dayBookings.map(e=>`${e.time}, ${e.partySize} Covers`).join('; ')}`:''}${g?.group?`, combined with ${g.group.filter(e=>e!==n.name).map(e=>`table ${e}`).join(', ')}`:''}`,Y=void 0!==g?.seatedMins&&g.booking?Math.min(1.2,g.seatedMins/(g.booking.durationMins??(0,a.turnFor)(g.booking.partySize,e.turnBase))):null;return(0,b.jsxs)(r.default.Fragment,{children:[M({...n,w:w,h:j}).map((t,o)=>(0,b.jsx)(i.default,{pointerEvents:"none",style:[{position:'absolute',left:W(k+t.x)-Math.max(4,W(8)),top:W(C+t.y)-Math.max(4,W(8)),width:Math.max(8,W(16)),height:Math.max(8,W(16)),borderRadius:99,backgroundColor:'edit'===e.mode?'#5A4C33':'rgba(255,255,255,0.16)',borderWidth:1,borderColor:'edit'===e.mode?l.colours.gold:'rgba(255,255,255,0.25)'},x()]},o)),'live'===e.mode&&(W(w)<44||W(j)<44)?(0,b.jsx)(i.default,{accessible:!1,importantForAccessibility:"no-hide-descendants",'aria-hidden':!0,...O(n,'move'),style:{position:'absolute',left:W(k+w/2)-Math.max(44,W(w))/2,top:W(C+j/2)-Math.max(44,W(j))/2,width:Math.max(44,W(w)),height:Math.max(44,W(j)),zIndex:2}}):null,(0,b.jsxs)(i.default,{testID:`table-${n.name}`,accessibilityRole:"button",accessibilityLabel:X,onAccessibilityTap:()=>e.onTap?.(n),onKeyDown:t=>{'Enter'!==t?.key&&' '!==t?.key||e.onTap?.(n)},tabIndex:0,...O(n,'move'),style:[{position:'absolute',left:W(k),top:W(C),width:W(w),height:W(j),borderRadius:A,backgroundColor:S,alignItems:'center',justifyContent:'center',padding:2,borderWidth:I?3:e.sectionColours&&z?2.5:1.5,borderColor:I?'#FFFFFF':e.sectionColours&&z?(0,l.brandColour)(z.colour):'edit'===e.mode?l.colours.gold:'rgba(0,0,0,0.35)',transform:[{scale:v?1.06:1}],zIndex:v?50:3,opacity:v&&'live'===e.mode?.85:1,shadowColor:'#000',shadowOpacity:v?.6:.3,shadowRadius:v?14:6,cursor:'edit'===e.mode?'grab':'pointer',touchAction:'none'},v?null:x()],children:[(0,b.jsxs)(i.default,{style:{alignItems:'center'},pointerEvents:"none",children:[(0,b.jsx)(u.T,{weight:"bold",size:E,colour:$,center:!0,numberOfLines:1,children:T}),'live'===e.mode&&'blocked'===g?.status?(0,b.jsx)(u.T,{size:Math.max(10,Math.round(.5*E)),weight:"semibold",colour:$,center:!0,numberOfLines:1,children:"Blocked"}):null,e.big&&'live'===e.mode&&g&&1===H?g.covers||G?(0,b.jsx)(u.T,{size:F,weight:"bold",colour:$,center:!0,numberOfLines:1,children:'free'===g.status||'soon'===g.status?G?`${g.dayBookings?'Booked':'Next'} ${G}`:'':[g.covers?`${g.covers}`:'',G??''].filter(Boolean).join(' \xb7 ')}):null:e.big&&'live'===e.mode&&g&&2===H?(0,b.jsxs)(b.Fragment,{children:[g.covers?(0,b.jsxs)(u.T,{size:F,weight:"semibold",colour:$,center:!0,children:[g.covers," cover",1===g.covers?'':'s']}):'free'!==g.status||L?null:(0,b.jsxs)(u.T,{size:F,colour:$,center:!0,children:[n.minSeats,"\u2013",n.maxSeats]}),G?(0,b.jsx)(u.T,{size:F,weight:"bold",colour:$,center:!0,children:'free'===g.status||'soon'===g.status?`${g.dayBookings?'Booked':'Next'} ${G}`:G}):'dirty'===g.status?(0,b.jsx)(u.T,{size:F,colour:$,center:!0,children:"Clear"}):null]}):e.big&&'live'===e.mode?null:'edit'===e.mode?L?null:(0,b.jsxs)(u.T,{size:11,colour:l.colours.muted,center:!0,children:[n.minSeats,"\u2013",n.maxSeats,n.online?' \xb7 online':'']}):g?(0,b.jsxs)(b.Fragment,{children:['free'!==g.status||L?null:(0,b.jsxs)(u.T,{size:11,colour:$,center:!0,children:[n.minSeats,"\u2013",n.maxSeats," seats"]}),void 0!==g.seatedMins?(0,b.jsxs)(u.T,{size:12,weight:"semibold",colour:$,center:!0,children:[g.seatedMins,"m \xb7 ",g.covers,"\ud83d\udc65"]}):g.orderOnly?(0,b.jsx)(u.T,{size:11,colour:$,center:!0,children:"Open order"}):null,'soon'===g.status&&g.next?(0,b.jsxs)(u.T,{size:11,weight:"semibold",colour:$,center:!0,children:[g.next.time," \xb7 ",void 0===g.nextIn?`${g.next.partySize} Covers`:g.nextIn<=0?'due':`${g.nextIn}m`]}):null,'dirty'!==g.status||L?null:(0,b.jsx)(u.T,{size:11,colour:$,center:!0,children:"Clear"}),!L||g.allergy||g.vip?(0,b.jsxs)(u.T,{size:11,colour:$,center:!0,children:[g.allergy?'\u26a0':'',g.vip?'VIP'===g.vip?'\u2605':'\u2665':'',g.occasion?a.OCCASION_ICON[g.occasion]:'',g.note?'\u270e':'']}):null]}):null]}),null,'live'===e.mode&&g&&!L&&(g.booking??g.next)&&(0,h.needsIcons)(g.booking??g.next).replace('\u26a0\ufe0f','').trim()?(0,b.jsx)(i.default,{pointerEvents:"none",testID:`needs-${n.name}`,style:{position:'absolute',bottom:e.big?-Math.max(9,.55*F):2,right:e.big?-6:4,backgroundColor:(0,t.soutersSurface)('rgba(11,11,11,0.85)'),borderRadius:8,paddingHorizontal:4,borderWidth:1,borderColor:'rgba(255,255,255,0.15)'},children:(0,b.jsx)(u.T,{size:e.big?Math.max(11,.75*F):10,children:(0,h.needsIcons)(g.booking??g.next).replace('\u26a0\ufe0f','').trim()})}):null,z&&'live'===e.mode&&e.sectionColours&&!L&&!e.big?(0,b.jsx)(i.default,{pointerEvents:"none",style:{position:'absolute',top:3,right:6,backgroundColor:(0,l.brandColour)(z.colour),borderRadius:6,paddingHorizontal:3},children:(0,b.jsx)(u.T,{size:9,weight:"bold",colour:"#0B0B0B",children:z.server})}):null,null===Y||L?null:(0,b.jsx)(i.default,{pointerEvents:"none",style:{position:'absolute',left:'15%',right:'15%',bottom:5,height:4,borderRadius:2,backgroundColor:'rgba(0,0,0,0.25)'},children:(0,b.jsx)(i.default,{style:{width:`${Math.min(100,100*Y)}%`,height:4,borderRadius:2,backgroundColor:Y>=1?'#B3261E':'rgba(0,0,0,0.6)'}})}),'live'===e.mode&&g?.group?(0,b.jsx)(i.default,{pointerEvents:"none",testID:`group-${n.name}`,style:{position:'absolute',top:e.big?-Math.max(10,.6*F):2,right:e.big?-6:3,backgroundColor:(0,t.soutersSurface)('#0B0B0B'),borderRadius:8,paddingHorizontal:5,borderWidth:1.5,borderColor:l.colours.gold},children:(0,b.jsxs)(u.T,{size:e.big?Math.max(12,.8*F):10,weight:"bold",colour:l.colours.goldLight,children:["\u26d3 ",(U=g.group,(0,s.tablesLabel)(U.join('+')).replace(/^Tables? /,'').replace(/ \+ /g,'+'))]})}):null,P(n)&&'edit'===e.mode?(0,b.jsx)(i.default,{pointerEvents:"none",style:{position:'absolute',bottom:2,left:4},children:(0,b.jsx)(u.T,{size:10,colour:l.colours.gold,children:"\u26d3"})}):null]}),'edit'===e.mode&&e.selected===n.id?(0,b.jsx)(i.default,{testID:"resize-handle",accessibilityLabel:"Resize table",...O(n,'resize'),style:{position:'absolute',left:W(k+w)-14,top:W(C+j)-14,width:28,height:28,borderRadius:14,backgroundColor:l.colours.gold,borderWidth:2,borderColor:'#fff',zIndex:60,cursor:'nwse-resize',touchAction:'none'}}):null]},n.id);var U}),0===C.length?(0,b.jsx)(i.default,{style:{position:'absolute',left:0,right:0,top:'45%'},children:(0,b.jsxs)(u.T,{center:!0,colour:l.colours.muted,children:["No tables in this area yet",'edit'===e.mode?' \u2014 add some in Tables':'',"."]})}):null]})}):null})};var t=_r(d[0]),o=_r(d[1]),n=_r(d[2]),r=e(n);_r(d[3]);var i=e(_r(d[4])),s=_r(d[5]),a=_r(d[6]),l=_r(d[7]),u=_r(d[8]),h=_r(d[9]),c=_r(d[10]),b=_r(d[11]);const x=(e=250)=>({transitionProperty:'background-color, border-color, transform, left, top, width, height',transitionDuration:`${e}ms`}),g=(e,t=!0)=>t?Math.round(e/s.GRID)*s.GRID:Math.round(e),p=(e,t,o)=>Math.max(t,Math.min(o,e)),f=(e,t,o,n=9)=>Math.max(n,Math.min(e,(o-6)/(.62*Math.max(1,t.length)))),y=12,v=46;function w(e,t){const o=e.tables.filter(e=>e.areaId===t);if(!o.length)return{x:0,y:0,w:s.PLAN_W,h:s.PLAN_H};const n=Math.max(0,Math.min(...o.map(e=>e.x))-v),r=Math.max(0,Math.min(...o.map(e=>e.y))-v);return{x:n,y:r,w:Math.min(s.PLAN_W,Math.max(...o.map(e=>e.x+e.w))+v)-n,h:Math.min(s.PLAN_H,Math.max(...o.map(e=>e.y+e.h))+v)-r}}function M(e){const t=Math.max(1,e.maxSeats),o=[];if('round'===e.shape){const n=e.w/2+9.6,r=e.h/2+9.6;for(let i=0;ie.w,r=Math.ceil(t/2),i=t-r;if(n){for(let t=0;te.w,a=n?{borderColor:'#FFFFFF',borderWidth:2}:null;return'bar'===e.kind?(0,b.jsx)(i.default,{pointerEvents:"none",style:[r,{backgroundColor:o?'#2A2216':'#3A2E1C',borderRadius:8,borderWidth:1.5,borderColor:o?'#5A4A30':l.colours.gold},a],children:(0,b.jsx)(u.T,{size:Math.max(9,Math.min(14,t(e.h)/2.4)),weight:"semibold",colour:l.colours.goldLight,children:"BAR"})}):'wall'===e.kind?(0,b.jsx)(i.default,{pointerEvents:"none",style:[r,{backgroundColor:o?'#3A3631':'#5C574F',borderRadius:2},a]}):'window'===e.kind?(0,b.jsx)(i.default,{pointerEvents:"none",style:[r,{backgroundColor:'rgba(226,196,137,0.16)',borderColor:'rgba(226,196,137,0.6)',borderWidth:1,borderRadius:2},a],children:!o&&t(s?e.h:e.w)>60?(0,b.jsx)(u.T,{size:9,colour:"#BFDDFF",style:s?{transform:[{rotate:'90deg'}]}:void 0,children:"WINDOW"}):null}):(0,b.jsx)(i.default,{pointerEvents:"none",style:[r,{borderColor:o?'#7A6440':l.colours.gold,borderWidth:1.5,borderStyle:'dashed',borderRadius:3,backgroundColor:'rgba(207,164,95,0.08)'},a],children:t(s?e.h:e.w)>40?(0,b.jsx)(u.T,{size:9,colour:l.colours.goldLight,style:s?{transform:[{rotate:'90deg'}]}:void 0,children:"DOOR"}):null})}},928,[868,808,30,122,127,825,826,821,813,950,945,24]); +__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"areaMarks",{enumerable:!0,get:function(){return u}}),_e.AreaTabs=function({plan:o,area:e,onPick:n,counts:a,closed:b}){return(0,c.jsx)(t.Row,{wrap:!0,gap:6,style:{alignItems:'center'},children:o.areas.map(o=>{const f=o.id===e,h=b?.has(o.id);return(0,c.jsx)(l.default,{testID:`area-${o.id}`,accessibilityRole:"tab",accessibilityLabel:`Area ${o.name}${o.dogs?', dogs allowed':''}${o.outdoor?', outdoor':''}${h?', closed for weather':''}`,accessibilityState:{selected:f},onPress:()=>n(o.id),style:{minHeight:48,paddingHorizontal:16,borderRadius:24,borderWidth:1.5,borderColor:f?s.colours.gold:h?s.colours.blue:s.colours.border,backgroundColor:f?s.colours.gold:s.colours.surface,justifyContent:'center'},children:(0,c.jsxs)(t.T,{weight:"semibold",size:15,colour:f?s.colours.onGold:s.colours.text,children:[o.name,u(o),h?(0,c.jsx)(t.T,{size:12,colour:f?s.colours.onGold:s.colours.blue,children:" closed"}):null,a?.[o.id]?(0,c.jsxs)(t.T,{size:12,colour:f?s.colours.onGold:s.colours.muted,children:[" ",a[o.id]]}):null]})},o.id)})})},r(d[0]);var o,e=r(d[1]),l=(o=e)&&o.__esModule?o:{default:o},s=r(d[2]),t=r(d[3]),c=r(d[4]);const u=o=>`${o.dogs?' \ud83d\udc3e':''}${o.outdoor?' \ud83c\udf26':''}`},929,[30,263,821,813,24]); +__d(function(_g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.saveBookingTables=j,_e.TablePicker=function({rid:e,booking:u,name:p,turnBase:f=90,onClose:v,onSaved:w,onPickOnPlan:T}){const $=(0,b.usePlan)(e),C=(0,c.useBookings)(e),[L,P]=(0,s.useState)(()=>(0,b.tablesOf)((0,h.tableKey)((0,b.tablesOf)(u.table)))),S=(0,s.useMemo)(()=>(0,h.pickGroups)($),[$]),W=C.filter(e=>e.date===u.date),z=(0,h.seatsOf)($,L),O=(0,h.seatLine)(z.total,u.partySize),D=(0,h.pickClashes)(u,L,W,f),I=e=>(0,h.pickClashes)(u,[e],W,f)[0]?.with,B=(0,h.tableKey)(L)!==(0,h.tableKey)((0,b.tablesOf)(u.table)),_=e=>P(l=>(0,h.toggleTable)(l,e)),M=async l=>{await j(e,u,l),w?.((0,h.savedWords)(p,u.partySize,l,(0,h.seatsOf)($,l).total)),v()},R=(0,k.jsxs)(n.default,{style:{gap:8},children:[(0,k.jsxs)(n.default,{testID:"table-pick-total",accessible:!0,accessibilityLabel:`${(0,h.tablesWords)(L)} picked. ${O.text}.`,children:[(0,k.jsx)(y.T,{size:18,weight:"semibold",colour:g.colours.goldLight,children:(0,h.tablesWords)(L)}),(0,k.jsx)(y.T,{size:17,colour:g.colours.text,children:O.text})]}),D.length?(0,k.jsx)(n.default,{testID:"table-pick-clash",accessible:!0,accessibilityLabel:`Warning. ${(0,h.clashWords)(D)} You can still save.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:g.colours.gold},children:(0,k.jsxs)(y.T,{size:16,weight:"semibold",colour:g.colours.goldLight,children:[(0,h.clashWords)(D)," You can still save."]})}):null,(0,k.jsxs)(y.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(y.Button,{testID:"table-pick-save",label:D.length?'Save anyway':'Save tables',disabled:!B||!L.length,accessibilityLabel:`${D.length?'Save anyway, ':'Save, '}${(0,h.tablesWords)(L)} for ${p}. ${O.text}.${D.length?` ${(0,h.clashWords)(D)}`:''}`,onPress:()=>M(L),style:[x,{flexGrow:1}]}),(0,b.tablesOf)(u.table).length?(0,k.jsx)(y.Button,{testID:"table-pick-clear",kind:"secondary",label:"Clear table",accessibilityLabel:`Clear table, take ${(0,h.tablesWords)((0,b.tablesOf)(u.table)).toLowerCase()} off ${p}`,onPress:()=>M([]),style:x}):null,(0,k.jsx)(y.Button,{testID:"table-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",onPress:v,style:x})]})]});return(0,k.jsxs)(y.Sheet,{visible:!0,onClose:v,title:`Tables \xb7 ${u.time} ${p} \xb7 ${u.partySize} Covers`,maxWidth:760,testID:"table-picker",footer:R,children:[(0,k.jsx)(l.TableNumberWarning,{plan:$}),(0,k.jsx)(y.T,{size:16,colour:g.colours.text,children:"Tap one table, or several to join them. Tap again to take one off."}),T?(0,k.jsx)(y.Button,{kind:"secondary",testID:"table-pick-on-plan",label:"Pick on the table plan",accessibilityLabel:`Pick on the table plan instead, for ${p}`,onPress:()=>T(L),style:x}):null,S.map(e=>(0,k.jsxs)(n.default,{style:{gap:6},accessibilityLabel:e.area,children:[(0,k.jsx)(y.T,{size:15,weight:"semibold",colour:g.colours.gold,children:e.area}),(0,k.jsx)(y.Row,{gap:8,wrap:!0,children:e.tables.map(e=>{const l=L.includes(e.name),s=I(e.name);return(0,k.jsxs)(o.default,{testID:`table-pick-${e.name}`,accessibilityRole:"checkbox",accessibilityState:{checked:l},'aria-checked':l,accessibilityLabel:(0,h.pickA11y)(e.name,e.seats,l,s),onPress:()=>_(e.name),style:({pressed:e})=>({minWidth:92,minHeight:64,paddingHorizontal:10,paddingVertical:6,borderRadius:12,alignItems:'center',justifyContent:'center',borderWidth:l?2:1,borderColor:l?g.colours.gold:s?g.colours.goldMuted:g.colours.hairline,borderStyle:s&&!l?'dashed':'solid',backgroundColor:l?g.colours.gold:e?g.colours.tilePressed:g.colours.tile}),children:[(0,k.jsx)(y.T,{size:18,weight:"semibold",colour:l?g.colours.onGold:g.colours.text,children:(0,t.tableNumbers)(e.name)}),(0,k.jsxs)(y.T,{size:14,colour:l?g.colours.onGold:g.colours.muted,children:[e.seats," seats",s?' \xb7 booked':'']})]},e.name)})})]},e.area)),S.length?null:(0,k.jsx)(y.Muted,{children:"No tables on the plan yet. Add them in Setup \u203a Table plan."})]})};var l=r(d[0]),t=r(d[1]),s=r(d[2]),o=e(r(d[3])),n=e(r(d[4])),c=r(d[5]),b=r(d[6]),u=r(d[7]),h=r(d[8]),g=r(d[9]),p=r(d[10]),y=r(d[11]),f=r(d[12]),k=r(d[13]);const x={minHeight:56};async function j(e,l,t){const s=(0,h.tableKey)(t),o=(0,b.tablesOf)(l.table);await c.repo.bookings.update(l.id,(0,u.tablePatch)(s||null)),'seated'===l.status&&l.date===(0,p.venueYmd)(new Date)&&(o.filter(e=>!(0,b.tablesOf)(s).includes(e)).forEach(l=>b.useFloor.getState().setLive(e,l,{stage:void 0,dirty:!0})),s&&(0,f.resetTableLive)(e,s))}},930,[914,808,30,263,127,819,825,1275,931,821,818,813,926,24]); +__d(function(_g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"byNum",{enumerable:!0,get:function(){return s}}),e.tableKey=o,e.toggleTable=function(t,n){return t.includes(n)?t.filter(t=>t!==n):a(o([...t,n]))},e.seatsOf=function(t,n){const a={};for(const s of n)a[s]=t.tables.find(t=>t.name===s)?.maxSeats??0;return{per:a,total:Object.values(a).reduce((t,n)=>t+n,0)}},e.seatLine=function(t,n){const a=Math.max(0,n-t);return{text:`${t} ${1===t?'seat':'seats'} for ${l(n)}${a?`: ${a} short`:''}`,short:a,fits:0===a&&t>0}},e.pickClashes=function(t,l,u,c=90){if(!l.length)return[];const f={...t,table:o(l)},b=[];for(const s of u)if(s.id!==t.id&&s.date===t.date&&!['cancelled','noshow','finished'].includes(s.status)&&(0,n.startOf)(f)<(0,n.endOf)(s,c)&&(0,n.startOf)(s)<(0,n.endOf)(f,c))for(const t of a(s.table))l.includes(t)&&b.push({table:t,with:s});return b.sort((t,n)=>s(t.table,n.table))},e.clashWords=function(n){return n.map(n=>`${(0,t.tableNumbers)(n.table)} has ${n.with.walkIn?'a walk-in':(n.with.name||'a booking').replace(' (example)','')} at ${n.with.time}`).join('. ')+(n.length?'.':'')},e.tablesWords=u,e.pickA11y=function(n,a,s,l){return`Table ${(0,t.tableNumbers)(n)}, ${a} ${1===a?'seat':'seats'}${s?', selected':''}${l?`, has ${l.walkIn?'a walk-in':l.name} at ${l.time}`:''}`},e.pickGroups=function(t){return t.areas.map(n=>({area:n.name,tables:t.tables.filter(t=>t.areaId===n.id).map(t=>({name:t.name,seats:t.maxSeats})).sort((t,n)=>s(t.name,n.name))})).filter(t=>t.tables.length)},e.savedWords=function(t,n,a,s){return a.length?`${t}, ${l(n)}: ${u(a)} (${s} seats).`:`${t}: table taken off.`},e.tableActions=function(t,n){const s=a(t.table);if(['cancelled','noshow'].includes(t.status))return[];const o=[s.length?{id:'assign',label:'Change table',a11y:`Change table for ${n}, ${l(t.partySize)}, now ${u(s).toLowerCase()}. You can pick several tables to join.`}:{id:'assign',label:'Assign table',a11y:`Assign table for ${n}, ${l(t.partySize)}. You can pick several tables to join.`}];s.length&&o.push({id:'clear',label:'Clear table',a11y:`Clear table for ${n}, take ${u(s).toLowerCase()} off this booking`});return o},e.dragTables=function(t,n,s){if(!s||'__none'===s||s===n)return null;const l=a(t);if(l.includes(s))return null;return o('__none'!==n&&l.includes(n)?l.map(t=>t===n?s:t):[s])};var t=r(d[0]),n=r(d[1]);const a=t=>t?t.split('+').map(t=>t.trim()).filter(Boolean):[],s=(t,n)=>t.localeCompare(n,'en-GB',{numeric:!0}),l=t=>`${t} ${1===t?'person':'people'}`;function o(t){return[...new Set(t.map(t=>String(t).trim()).filter(Boolean))].sort(s).join('+')}function u(n){const s=a(o(n));return s.length?(0,t.tableListNumbers)(s):'No table'}},931,[808,826]); +__d(function(g,r,i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ds",{enumerable:!0,get:function(){return h}}),_e.useCss=function(){(0,n.useEffect)(()=>{if(!x||document.getElementById('cc-alert-css'))return;const e=document.createElement('style');e.id='cc-alert-css',e.textContent=k,document.head.appendChild(e)},[])},_e.KindIcon=function({kind:e,size:t=22,colour:n}){const a={stroke:n??m.KIND_META[e].colour,strokeWidth:2,fill:'none',strokeLinecap:'round',strokeLinejoin:'round'};return(0,b.jsxs)(l.default,{width:t,height:t,viewBox:"0 0 24 24",children:['booking'===e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...a}),(0,b.jsx)(o.Path,{d:"M3 10h18M8 3v4M16 3v4M9 15l2 2 4-4",...a})]}):null,'pending'===e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Circle,{cx:"12",cy:"13",r:"8",...a}),(0,b.jsx)(o.Path,{d:"M12 9v4l2.5 2M9 2h6",...a})]}):null,'takeaway'===e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Path,{d:"M5 8h14l-1.2 12H6.2z",...a}),(0,b.jsx)(o.Path,{d:"M9 8V6a3 3 0 0 1 6 0v2",...a})]}):null,'email'===e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Rect,{x:"3",y:"5",width:"18",height:"14",rx:"2",...a}),(0,b.jsx)(o.Path,{d:"M3 7l9 6 9-6",...a})]}):null,'test'===e?(0,b.jsx)(o.Path,{d:"M12 2l2.4 6.6L21 9l-5.2 4.3L17.5 20 12 16.3 6.5 20l1.7-6.7L3 9l6.6-.4z",...a}):null]})},_e.SoundToggle=function({big:e}){const t=(0,m.useAlerts)(e=>e.prefs.muted);return(0,b.jsx)(a.default,{accessibilityRole:"switch",accessibilityState:{checked:!t},accessibilityLabel:t?'Alert sound off, tap to turn on':'Alert sound on, tap to mute',onPress:()=>m.useAlerts.getState().setPrefs({muted:!t}),style:{alignSelf:'flex-end',paddingHorizontal:12,paddingVertical:e?8:5,borderRadius:999,backgroundColor:'rgba(0,0,0,0.75)',borderWidth:1,borderColor:d.colours.border},children:(0,b.jsx)(u.T,{size:e?15:12,colour:t?d.colours.muted:d.colours.gold,children:t?'Sound off':'Sound on'})})},_e.AlertHost=function({variant:e,rid:t,me:a,onOpen:s,skipTakeaway:o}){const l=(0,m.useAlerts)(e=>e.live).filter(n=>!(n.rid!==t||'chef'===e&&'takeaway'!==n.kind||o&&'takeaway'===n.kind&&!n.test)),c=e=>'booking'===e.kind||'pending'===e.kind,d=l.filter(c),u=l.filter(e=>!c(e));A('managers'===e);const x=u.map(e=>e.id+':'+e.at).join('|'),h=(0,n.useRef)({me:a,onOpen:s});return h.current={me:a,onOpen:s},(0,n.useEffect)(()=>{const t=new Set(u.map(e=>`alert:${e.id}`));f.useSliders.getState().dismissWhere(e=>e.id.startsWith('alert:')&&!t.has(e.id)&&!e.id.startsWith('alert-keep:'));for(const t of u){const n=m.KIND_META[t.kind],a='display'===e;(0,f.notify)({id:`alert:${t.id}`,tone:T(t),big:a,testID:'alert-slider',kicker:`${n.kicker}${t.test?' \xb7 TEST':''}${t.nag?` \xb7 REMINDER ${t.nag}`:''} \xb7 ${y(t.at)}`,title:t.name,timeoutMs:S(t,e),content:({close:n})=>(0,b.jsx)(I,{a:t,variant:e,big:a,me:h.current.me,onOpen:h.current.onOpen,close:n}),onClose:()=>m.useAlerts.getState().dismiss(t.id)})}},[x,e]),(0,n.useEffect)(()=>()=>f.useSliders.getState().dismissWhere(e=>e.id.startsWith('alert:')),[]),(0,b.jsx)(p.BookingBanners,{alerts:d,big:'display'===e,managers:'managers'===e,me:a,onOpen:s,onClose:e=>m.useAlerts.getState().dismiss(e.id)})};var t=r(_d[0]),n=r(_d[1]);r(_d[2]);var a=e(r(_d[3])),s=e(r(_d[4])),o=r(_d[5]),l=e(o),c=r(_d[6]),d=r(_d[7]),u=r(_d[8]),p=r(_d[9]),f=r(_d[10]),m=r(_d[11]),b=r(_d[12]);const x='undefined'!=typeof document,h=e=>({dataSet:{ccal:e}}),k="\n[data-ccal=\"drop\"]{animation:ccal-drop .62s cubic-bezier(.16,1.1,.3,1) both}\n@keyframes ccal-drop{0%{opacity:0;transform:translate3d(0,-70px,0) scale(.94)}60%{opacity:1}100%{opacity:1;transform:none}}\n[data-ccal=\"big\"]{animation:ccal-big .8s cubic-bezier(.16,1.05,.3,1) both}\n@keyframes ccal-big{0%{opacity:0;transform:translate3d(0,-120px,0) scale(.86)}100%{opacity:1;transform:none}}\n[data-ccal=\"fade\"]{animation:ccal-fade .5s ease both}\n@keyframes ccal-fade{from{opacity:0}to{opacity:1}}\n[data-ccal=\"glow-gold\"]{animation:ccal-glow-gold 2.4s ease-in-out infinite}\n[data-ccal=\"glow-amber\"]{animation:ccal-glow-amber 1.6s ease-in-out infinite}\n[data-ccal=\"glow-ok\"]{animation:ccal-glow-ok 2.4s ease-in-out infinite}\n[data-ccal=\"glow-blue\"]{animation:ccal-glow-blue 2.4s ease-in-out infinite}\n@keyframes ccal-glow-gold{0%,100%{box-shadow:0 0 0 1.5px rgba(207,164,95,.9),0 10px 40px rgba(207,164,95,.28)}50%{box-shadow:0 0 0 1.5px #CFA45F,0 10px 70px rgba(207,164,95,.6)}}\n@keyframes ccal-glow-amber{0%,100%{box-shadow:0 0 0 1.5px rgba(255,181,71,.9),0 10px 40px rgba(255,181,71,.25)}50%{box-shadow:0 0 0 1.5px #FFB547,0 10px 70px rgba(255,181,71,.6)}}\n@keyframes ccal-glow-ok{0%,100%{box-shadow:0 0 0 1.5px rgba(207,164,95,.9),0 10px 40px rgba(207,164,95,.22)}50%{box-shadow:0 0 0 1.5px #CFA45F,0 10px 70px rgba(207,164,95,.5)}}\n@keyframes ccal-glow-blue{0%,100%{box-shadow:0 0 0 1.5px rgba(226,196,137,.9),0 10px 40px rgba(226,196,137,.22)}50%{box-shadow:0 0 0 1.5px #E2C489,0 10px 70px rgba(226,196,137,.5)}}\n[data-ccal=\"stars\"]{position:absolute;top:0;left:0;right:0;bottom:0;pointer-events:none;background-image:radial-gradient(1.2px 1.2px at 23px 41px,#fff,transparent),radial-gradient(1px 1px at 97px 13px,#fff9,transparent),radial-gradient(1.4px 1.4px at 151px 120px,#f5e6c8,transparent),radial-gradient(1px 1px at 61px 163px,#fffa,transparent),radial-gradient(1.6px 1.6px at 183px 77px,#CFA45F,transparent);background-size:211px 199px;opacity:.55;animation:ccal-drift 50s linear infinite}\n@keyframes ccal-drift{to{background-position:-211px 199px}}\n[data-ccal=\"space\"]{background:radial-gradient(ellipse at 50% 120%,#2a1f0c 0%,#0a0805 40%,#000 72%)}\n[data-ccal=\"sheen\"]{position:absolute;top:0;bottom:0;width:35%;left:-50%;pointer-events:none;background:linear-gradient(100deg,transparent,rgba(255,255,255,.09),transparent);animation:ccal-sheen 3.6s ease-in-out .5s infinite}\n@keyframes ccal-sheen{0%{left:-50%}40%,100%{left:130%}}\n[data-ccal=\"dot\"]{animation:ccal-dot 1s ease-in-out infinite alternate}\n@keyframes ccal-dot{from{opacity:.25}to{opacity:1}}\n[data-ccal=\"bar\"]{animation-name:ccal-bar;animation-timing-function:linear;animation-fill-mode:both}\n@keyframes ccal-bar{from{transform:scaleX(1)}to{transform:scaleX(0)}}\n[data-ccal=\"ring\"]{animation:ccal-ring 1.4s ease-out infinite}\n@keyframes ccal-ring{0%{transform:scale(1);opacity:.7}100%{transform:scale(1.9);opacity:0}}\n[data-ccal=\"phase-gold\"]{animation:ccal-phase 1.8s ease-in-out infinite}\n@keyframes ccal-phase{0%,100%{background-color:rgba(40,28,6,.92)}50%{background-color:rgba(255,181,71,.55)}}\n[data-ccal=\"flash-red\"]{animation:ccal-red 1s steps(2,jump-none) infinite}\n@keyframes ccal-red{0%{background-color:#5A0E08}100%{background-color:#D9302A}}\n[data-ccal=\"pulse-btn\"]{animation:ccal-pulse 1.2s ease-in-out infinite}\n@keyframes ccal-pulse{0%,100%{transform:scale(1)}50%{transform:scale(1.04)}}\n@media (prefers-reduced-motion: reduce){[data-ccal]{animation:none !important;transition:none !important}}\n";const y=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`};function w({label:e,value:t,big:n}){return(0,b.jsxs)(s.default,{style:{minWidth:n?130:66,flexGrow:1,paddingVertical:n?10:6,paddingHorizontal:n?14:10,borderRadius:10,backgroundColor:'rgba(255,255,255,0.04)',borderWidth:1,borderColor:'rgba(207,164,95,0.22)'},children:[(0,b.jsx)(u.T,{size:n?13:10,weight:"semibold",colour:f.SLIDER.quiet,style:{letterSpacing:1.4},children:e}),(0,b.jsx)(u.T,{size:n?28:16,weight:"bold",numberOfLines:1,children:t})]})}function j({label:e,onPress:t,kind:n="primary",testID:a,big:s}){return(0,b.jsx)(f.SliderButton,{a:{label:e,kind:n,testID:a,onPress:t,keepOpen:!0},onDone:()=>{},big:s})}const S=(e,t)=>'display'===t?12e3:'chef'===t?15e3:'pending'===e.kind||'takeaway'===e.kind?null:1e4,T=e=>e.allergy?'urgent':'pending'===e.kind?'warn':'normal';function I({a:e,variant:a,big:o,me:l,onOpen:p,close:m}){const[x,h]=(0,n.useState)(!1),[k,y]=(0,n.useState)(null),S=e=>{y(e),setTimeout(m,1800)},T='managers'===a,I=l??'Manager',A='takeaway'===e.kind?[['ORDER',e.orderNo??''],['ITEMS',String(e.items??'')],['TOTAL',e.total??''],['COLLECT',e.collect??'']]:'email'===e.kind?[]:[['TIME',e.when??''],['COVERS',String(e.covers??'')],...e.table?[['TABLE',(0,t.tableNumbers)(e.table)]]:[],['SOURCE',e.source??'']];return(0,b.jsxs)(s.default,{testID:`alert-${e.kind}`,style:{gap:o?12:8},children:['email'===e.kind?(0,b.jsx)(u.T,{size:o?22:14,numberOfLines:2,children:e.subject}):null,A.length?(0,b.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:o?10:6},children:A.map(([e,t])=>(0,b.jsx)(w,{label:e,value:t,big:o},e))}):null,e.allergy?(0,b.jsxs)(s.default,{testID:"alert-allergy",style:{flexDirection:'row',gap:10,alignItems:'center',borderLeftWidth:4,borderColor:d.colours.red,backgroundColor:'rgba(255,107,94,0.10)',borderRadius:8,padding:o?12:8},children:[(0,b.jsx)(u.T,{size:o?16:11,weight:"bold",colour:d.colours.red,style:{letterSpacing:1.6},children:"ALLERGY"}),(0,b.jsxs)(s.default,{style:{flex:1},children:[(0,b.jsx)(u.T,{size:o?22:14,weight:"semibold",colour:"#FFE1DC",children:e.allergy}),e.allergyStep?(0,b.jsx)(u.T,{size:o?15:11,colour:"#FFC4BB",children:e.allergyStep}):null]})]}):null,'pending'===e.kind&&'managers'!==a?(0,b.jsx)(u.T,{size:o?18:13,colour:d.colours.amber,children:"Waiting for a manager to confirm it in the Managers app."}):null,'email'===e.kind&&e.test?(0,b.jsx)(u.T,{size:12,colour:f.SLIDER.quiet,children:"Test only. No venue email is connected yet."}):null,k?(0,b.jsx)(u.T,{size:14,weight:"semibold",colour:d.colours.goldLight,children:k}):null,(0,b.jsxs)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'flex-end',alignItems:'center'},children:[T&&!k?'pending'===e.kind?x?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(u.T,{size:14,colour:"#FFE1DC",style:{flexBasis:'100%'},children:["Decline this booking? We\u2019ll let ",e.name," know by text",e.test?' (test: nothing happens)':' (preview mode)',"."]}),(0,b.jsx)(j,{kind:"danger",label:"Yes, decline it",testID:"alert-decline-yes",onPress:()=>{e.refId&&!e.test&&c.repo.bookings.decide(e.refId,'declined',I),S('Declined. The guest\u2019s message is in the Outbox.')}}),(0,b.jsx)(j,{kind:"ghost",label:"Keep it",onPress:()=>h(!1)})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(j,{label:"Confirm",testID:"alert-confirm",onPress:()=>{e.refId&&!e.test&&c.repo.bookings.decide(e.refId,'confirmed',I),S(e.test?'Test alert: nothing to confirm.':'Confirmed. Their confirmation is ready in the Outbox.')}}),(0,b.jsx)(j,{kind:"danger",label:"Decline",testID:"alert-decline",onPress:()=>h(!0)})]}):'takeaway'===e.kind?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(j,{label:"Accept",testID:"alert-accept",onPress:async()=>{const t=!(e.refId&&!e.test)||await c.repo.orders.accept(e.refId,I);S(t?'Accepted.':'Accepted. The allergy sign-off is still needed before cooking.')}}),[15,20,30].map(t=>(0,b.jsx)(j,{kind:"ghost",label:`Ready in ${t}`,onPress:async()=>{const n=!(e.refId&&!e.test)||await c.repo.orders.accept(e.refId,I,t);S(`Accepted, ready in ${t} minutes.${n?'':' Allergy sign-off still needed.'}`)}},t))]}):'booking'===e.kind&&p?(0,b.jsx)(j,{kind:"ghost",label:"View bookings",onPress:()=>{m(),p(e)}}):null:null,k?null:(0,b.jsx)(j,{kind:"ghost",label:!T||'pending'!==e.kind&&'takeaway'!==e.kind?'Close':'Later',testID:"alert-close",onPress:m})]})]})}function A(e){const t=(0,m.useAlerts)(e=>e.askedSystem);(0,n.useEffect)(()=>{if(!e||t||'default'!==(0,m.systemSupport)())return;const n=setTimeout(()=>(0,f.notify)({id:'notify-prompt',testID:'notify-prompt',icon:'\ud83d\udd14',title:'Get booking alerts on this device?',body:'We\u2019ll let you know about new bookings, requests to confirm and takeaway orders, even when the app is in the background. You can change this any time in More, Alerts and sounds.',actions:[{label:'Turn on alerts',testID:'notify-allow',onPress:()=>{(0,m.requestSystemPermission)().then(()=>m.useAlerts.getState().setAsked())}},{label:'Not now',kind:'ghost',onPress:()=>m.useAlerts.getState().setAsked()}]}),2500);return()=>clearTimeout(n)},[e,t])}},932,[808,30,122,263,127,948,819,821,813,1327,919,934,24]); +__d(function(g,r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"unconfirmedTakeaways",{enumerable:!0,get:function(){return x}}),_e.useBuildingChime=function(e,s=4e3,i=6e4){const o=(0,a.useAlerts)(e=>e.prefs.muted);(0,t.useEffect)(()=>{if(!e||o)return;const t=Date.now(),l=()=>(0,c.lowChime)(Math.min(1,(Date.now()-t)/i));l();const n=setInterval(l,s);return()=>clearInterval(n)},[e,o,s,i])},_e.TakeawayFacts=b,_e.TakeawayTakeover=function({rid:e,me:i}){const o=(0,l.useOrders)(e),n=x(o),a=n[0],c=s.default.useRef(i);return c.current=i,(0,t.useEffect)(()=>{a?(0,f.notify)({id:'takeaway-takeover',tone:a.allergies.length?'urgent':'warn',modal:!0,big:!0,testID:'takeaway-takeover',icon:'\ud83e\udd61',kicker:'NEW TAKEAWAY ORDER',title:`Order ${a.ref}: read it, then tap Confirm`,body:"This stays on screen until someone confirms."+(n.length>1?` ${n.length-1} more waiting.`:''),timeoutMs:null,content:()=>(0,j.jsx)(y,{rid:e,id:a.id,me:c.current})}):(0,f.dismissNotice)('takeaway-takeover')},[a?.id,n.length,e]),(0,t.useEffect)(()=>()=>(0,f.dismissNotice)('takeaway-takeover'),[]),null};var t=r(d[0]),s=e(t),i=e(r(d[1])),o=e(r(d[2])),l=r(d[3]),n=r(d[4]),a=r(d[5]),c=r(d[6]),u=r(d[7]),h=r(d[8]),f=r(d[9]),j=r(d[10]);const w=e=>e?new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}):'As soon as possible',x=e=>e.filter(e=>'takeaway'===e.type&&'new'===e.status&&!e.accepted).sort((e,t)=>e.createdAt.localeCompare(t.createdAt));function b({o:e,big:t,personal:s=!0}){const o=t?1:.8;return(0,j.jsxs)(i.default,{style:{gap:10},children:[(0,j.jsxs)(i.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:18},children:[(0,j.jsxs)(i.default,{children:[(0,j.jsx)(h.T,{size:13*o+2,colour:u.colours.muted,children:"Collection"}),(0,j.jsx)(h.T,{size:34*o,weight:"bold",colour:u.colours.goldLight,children:w(e.slotTime)})]}),s?(0,j.jsxs)(i.default,{children:[(0,j.jsx)(h.T,{size:13*o+2,colour:u.colours.muted,children:"Customer"}),(0,j.jsx)(h.T,{size:26*o,weight:"semibold",children:e.customerName})]}):null,s?(0,j.jsxs)(i.default,{children:[(0,j.jsx)(h.T,{size:13*o+2,colour:u.colours.muted,children:"Phone"}),(0,j.jsx)(h.T,{size:26*o,weight:"semibold",children:e.phone??'Not given'})]}):null,(0,j.jsxs)(i.default,{children:[(0,j.jsx)(h.T,{size:13*o+2,colour:u.colours.muted,children:"Order"}),(0,j.jsx)(h.T,{size:26*o,weight:"semibold",children:e.ref})]})]}),e.allergies.length?(0,j.jsxs)(i.default,{testID:"takeover-allergy",style:{backgroundColor:'#7A140D',borderRadius:12,padding:12,borderWidth:2,borderColor:'#FFB3AB'},children:[(0,j.jsxs)(h.T,{size:22*o,weight:"bold",colour:"#FFFFFF",children:["\u26a0 ALLERGY: ",e.allergies.map(e=>`${(0,n.allergenLabel)(e.allergen)} (${(0,n.severityLabel)(e.severity)})`).join(', ')]}),e.lines.filter(e=>e.overridden).map((e,t)=>(0,j.jsxs)(h.T,{size:16*o,weight:"semibold",colour:"#FFE3DF",children:["Customer overrode a warning: ",e.name," contains ",e.contains.map(n.allergenLabel).join(', ')]},t))]}):(0,j.jsx)(h.T,{size:16*o,colour:u.colours.ok,children:"No allergies declared"}),(0,j.jsx)(i.default,{style:{gap:4},children:e.lines.map((e,t)=>(0,j.jsxs)(h.T,{size:22*o,weight:"semibold",children:[e.qty," \xd7 ",e.name,e.choices.length?` (${e.choices.join(', ')})`:'',e.notes?` \xb7 \u201c${e.notes}\u201d`:'']},t))})]})}function y({rid:e,id:t,me:s}){const n=(0,l.useOrders)(e).find(e=>e.id===t),{width:a}=(0,o.default)();return n?(0,j.jsxs)(i.default,{style:{gap:12},children:[(0,j.jsx)(b,{o:n,big:a>=700}),(0,j.jsx)(h.Button,{label:`Confirm order ${n.ref}`,testID:"takeover-confirm",onPress:()=>{l.repo.orders.accept(n.id,s)},style:{minHeight:72,borderRadius:14}})]}):null}},933,[30,127,287,819,814,934,923,821,813,919,24]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"chime",{enumerable:!0,get:function(){return l.chime}}),e.sendTestAlert=function(t,a){const o={rid:t,at:Date.now(),test:!0},c='pending'===a?{...o,id:`test-pending:${Date.now()}`,kind:'pending',name:'Test guest',when:'Today 19:30',covers:10,source:'Online'}:'takeaway'===a?{...o,id:`test-takeaway:${Date.now()}`,kind:'takeaway',name:'Test guest',orderNo:'T-TEST',items:3,total:'\xa324.50',collect:'18:45',source:'Online',allergy:'Milk (allergy)',allergyStep:'Test only: no sign-off needed'}:'email'===a?{...o,id:`test-email:${Date.now()}`,kind:'email',name:'CoverCharge test',subject:'This is a test alert. No real email was received.'}:{...o,id:`test-booking:${Date.now()}`,kind:'test'===a?'test':'booking',name:'Test guest',when:'Today 19:30',covers:4,table:'7',source:'Phone',allergy:'Peanuts (allergy)',allergyStep:'Test only: no sign-off needed'};n.useAlerts.getState().raise(c)};var t=r(d[0]);Object.keys(t).forEach(function(n){'default'===n||Object.prototype.hasOwnProperty.call(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[n]}})});var n=r(d[1]);Object.keys(n).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})});var a=r(d[2]);Object.keys(a).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return a[t]}})});var o=r(d[3]);Object.keys(o).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return o[t]}})});var c=r(d[4]);Object.keys(c).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return c[t]}})});var l=r(d[5]),s=r(d[6]);Object.keys(s).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return s[t]}})})},934,[1328,1329,1331,1330,1332,923,1333]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BlockList=p,_e.BlockBookingsSheet=B,_e.BlocksBanner=function({rid:e,now:o,big:s,by:l="staff"}){const t=(0,i.useBlocks)(e=>e.blocks),r=(0,i.useBlocks)(e=>e.remove),a=(0,i.activeBlock)(t,e,(0,c.ymd)(o),(0,c.hm)(o));return a?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(M,{rid:e,now:o,big:s}),(0,f.jsxs)(n.default,{testID:"blocks-banner",accessibilityRole:"summary",style:{flexDirection:'row',alignItems:'center',gap:10,backgroundColor:u.colours.amberBg,borderColor:u.colours.amber,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[(0,f.jsx)(b.T,{size:s?20:16,children:"\u23f8"}),(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",colour:u.colours.amber,style:{flex:1},children:(0,i.pausedLine)(a)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Undo",testID:"blocks-undo",onPress:()=>{r(a.id,l),(0,m.pushBlocksToWix)(e,[a.id],'remove')}})]})]}):(0,f.jsx)(M,{rid:e,now:o,big:s})},_e.BlockBookingsButton=function({rid:e,r:o,now:a,by:d,wide:m,big:x,quiet:j,tile:k,display:p}){const[y,w]=(0,s.useState)(!1),C=(0,i.useBlocks)(e=>e.blocks),v=(0,i.currentBlocks)(C,e,(0,c.ymd)(a),(0,c.hm)(a)).length;return k?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(l.ActionTile,{testID:"block-bookings",icon:"pause",label:"Block bookings",sub:v?`${v} block${1===v?'':'s'} on now`:'Pause online times',count:v||void 0,onPress:()=>w(!0),accessibilityLabel:"Block bookings"}),y?(0,f.jsx)(B,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>w(!1)}):null]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(r.default,{testID:"block-bookings",accessibilityRole:"button",accessibilityLabel:"Block bookings",onPress:()=>w(!0),style:({pressed:e})=>j?{...t.look.quiet(e),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:u.colours.gold,borderRadius:16,paddingVertical:x?14:10,paddingHorizontal:18,backgroundColor:e?u.colours.goldTint:'transparent'},children:[j?null:(0,f.jsx)(b.T,{size:x?22:17,colour:u.colours.gold,children:"\u23f8"}),(0,f.jsx)(b.T,{size:j?15:x?22:17,weight:"semibold",colour:j?u.colours.goldLight:u.colours.gold,children:"Block bookings"}),v?(0,f.jsx)(n.default,{style:{backgroundColor:u.colours.amber,borderRadius:10,minWidth:22,paddingHorizontal:6},children:(0,f.jsx)(b.T,{size:13,weight:"bold",colour:u.colours.onGold,center:!0,children:v})}):null]}),y?p?(0,f.jsx)(h.DisplayBlocksMenu,{rid:e,r:o,now:a,by:d,onClose:()=>w(!1)}):(0,f.jsx)(B,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>w(!1)}):null]})},_e.closeOutdoor=C,_e.useOutdoor=v,_e.CloseGardenButton=function({rid:e,r:o,now:s,by:n,big:a,quiet:d,short:c,tile:h}){const m=v(e,s);if(!m.outdoor.length)return null;const x=m.allClosed;return h?(0,f.jsx)(l.ActionTile,{testID:x?'reopen-garden':'close-garden',icon:x?'sun':'rain',tone:x?'blue':'gold',label:x?'Reopen garden':'Close garden',sub:x?'Closed for weather':'For weather',accessibilityLabel:x?'Reopen garden':'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):C(e,o,s,n,m.outdoor.filter(e=>!m.closed.has(e.id)))}):(0,f.jsxs)(r.default,{testID:x?'reopen-garden':'close-garden',accessibilityRole:"button",accessibilityLabel:x?'Reopen garden':'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):C(e,o,s,n,m.outdoor.filter(e=>!m.closed.has(e.id))),style:({pressed:e})=>d?{...t.look.quiet(e,x?'blue':'gold'),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:x?u.colours.blue:u.colours.gold,borderRadius:16,paddingVertical:a?14:10,paddingHorizontal:16,minHeight:48,backgroundColor:e?u.colours.goldTint:x?u.colours.blueBg:'transparent'},children:[d?null:(0,f.jsx)(b.T,{size:a?22:17,children:x?'\u2600\ufe0f':'\ud83c\udf27'}),(0,f.jsx)(b.T,{size:d?15:a?20:16,weight:"semibold",colour:x?u.colours.blue:d?u.colours.goldLight:u.colours.gold,children:x?'Reopen garden':c?'Close garden':'Close garden for weather'})]})},_e.GardenBanner=M;var o=_r(_d[0]),s=_r(_d[1]),l=_r(_d[2]),t=_r(_d[3]),r=e(_r(_d[4])),n=e(_r(_d[5])),i=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),b=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),f=_r(_d[14]);const x=e=>(0,c.fromMins)(15*Math.floor((60*e.getHours()+e.getMinutes())/15)),j=(e,o)=>e.date===o?'Today':(0,c.niceDate)((0,c.parseYmd)(e.date));function k({title:e,sub:o,onPress:s,testID:l,disabled:t}){return(0,f.jsxs)(r.default,{testID:l,accessibilityRole:"button",accessibilityLabel:e,disabled:t,onPress:s,style:({pressed:e})=>({borderWidth:1.5,borderColor:u.colours.gold,borderRadius:16,padding:16,backgroundColor:e?u.colours.goldTint:u.colours.surface2,opacity:t?.4:1}),children:[(0,f.jsx)(b.T,{size:20,weight:"semibold",colour:u.colours.gold,children:e}),o?(0,f.jsx)(b.Muted,{children:o}):null]})}function p({rid:e,now:l,by:t="staff"}){const r=(0,i.useBlocks)(e=>e.blocks),a=(0,i.useBlocks)(e=>e.remove),[d,h]=(0,s.useState)(null),x=(0,c.ymd)(l),k=(0,i.currentBlocks)(r,e,x,(0,c.hm)(l));return k.length?(0,f.jsxs)(n.default,{style:{gap:8},testID:"block-list",children:[k.map(e=>{const s=e.date===x&&(0,c.toMins)(e.from)<=(0,c.toMins)((0,c.hm)(l));return(0,f.jsxs)(b.Row,{style:{justifyContent:'space-between',borderWidth:1,borderColor:s?u.colours.amber:u.colours.border,borderRadius:12,padding:10},children:[(0,f.jsxs)(n.default,{style:{flex:1},children:[(0,f.jsxs)(b.T,{weight:"semibold",children:[e.areaId?`${e.areaName??'Area'} closed \xb7 `:'',e.tables?.length?`${e.tables.map(o.tableNumbers).join(', ')} \xb7 `:'',j(e,x)," \xb7 ",e.from,"\u2013",e.to,s?' \xb7 now':'']}),(0,f.jsxs)(b.Muted,{children:[e.reason??'No reason given'," \xb7 by ",e.by,e.areaId?' \xb7 the rest of the venue stays open':'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Remove",testID:`block-remove-${e.id}`,onPress:()=>h(e)})]},e.id)}),d?(0,f.jsxs)(b.Sheet,{visible:!0,onClose:()=>h(null),title:"Remove this block?",testID:"block-remove-confirm",children:[(0,f.jsx)(b.T,{children:`${j(d,x)}, ${d.from}\u2013${d.to}. Bookings open again for that time.`}),(0,f.jsx)(b.Button,{testID:"block-remove-yes",label:"Remove block",onPress:()=>{a(d.id,t),(0,m.pushBlocksToWix)(e,[d.id],'remove'),h(null)}}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Keep it",onPress:()=>h(null)})]}):null]}):(0,f.jsx)(b.Muted,{children:"No bookings paused. Online and staff bookings are open as normal."})}function y({value:e,onChange:o}){return(0,f.jsxs)(n.default,{style:{gap:6},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Reason (optional)"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:i.BLOCK_REASONS.map(s=>(0,f.jsx)(b.Chip,{label:s,selected:e===s,onPress:()=>o(e===s?void 0:s)},s))})]})}function w({label:e,value:o,onChange:s,min:l,max:t}){return(0,f.jsxs)(b.Row,{gap:8,children:[(0,f.jsx)(b.T,{style:{width:52},children:e}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"\u221230",accessibilityLabel:`${e} 30 minutes earlier`,onPress:()=>s(Math.max(l,o-30))}),(0,f.jsx)(b.T,{size:22,weight:"semibold",colour:u.colours.gold,style:{minWidth:70,textAlign:'center'},children:(0,c.fromMins)(o)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"+30",accessibilityLabel:`${e} 30 minutes later`,onPress:()=>s(Math.min(t,o+30))})]})}function B({rid:e,r:o,now:l,by:t,onClose:r,wide:a}){const u=(0,i.useBlocks)(e=>e.add),[h,m]=(0,s.useState)('menu'),[j,B]=(0,s.useState)(),C=(0,c.ymd)(l),v=(0,d.hoursFor)(o,l),M=v?(0,c.hm)(v.close):null,P=x(l),T=!!v&&(0,c.toMins)(P)<(0,c.toMins)(M),I=(0,c.fromMins)((0,c.toMins)(P)+60),R=(0,s.useMemo)(()=>{const e=[];for(let s=1;s<=28;s++){const t=new Date(l);t.setHours(12,0,0,0),t.setDate(t.getDate()+s),(0,d.hoursFor)(o,t)&&e.push(t)}return e},[C,o.id]),[$,z]=(0,s.useState)(R[0]?(0,c.ymd)(R[0]):C),S=(0,d.hoursFor)(o,(0,c.parseYmd)($)),L=S?(0,c.toMins)((0,c.hm)(S.open)):720,F=S?(0,c.toMins)((0,c.hm)(S.close)):1260,[W,A]=(0,s.useState)(null),N=W??{from:L,to:F},H=(o,s,l)=>{u({rid:e,date:o,from:s,to:l,reason:j,by:t}),r()};return(0,f.jsx)(b.Sheet,{visible:!0,onClose:r,title:"Block bookings",maxWidth:a?720:void 0,testID:"block-sheet",children:'menu'===h?(0,f.jsxs)(n.default,{style:{gap:10},children:[(0,f.jsx)(b.Muted,{children:"Pause new bookings for a while. The customer app stops offering those times, and staff get a warning."}),(0,f.jsx)(k,{testID:"block-today",title:"Today",sub:T?`Now until close (${M}) or for 1 hour`:'Closed for the rest of today',disabled:!T,onPress:()=>m('today')}),(0,f.jsx)(k,{testID:"block-future",title:"Future dates",sub:"Pick a date and a time window",onPress:()=>m('future')}),(0,f.jsx)(D,{rid:e,r:o,now:l,by:t,onDone:r}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Active and upcoming"}),(0,f.jsx)(p,{rid:e,now:l})]}):'today'===h?(0,f.jsxs)(n.default,{style:{gap:10},children:[(0,f.jsx)(y,{value:j,onChange:B}),(0,f.jsx)(k,{testID:"block-until-close",title:"From now until close",sub:`${P} to ${M} (kitchen close, from opening hours)`,onPress:()=>H(C,P,M)}),(0,f.jsx)(k,{testID:"block-one-hour",title:"From now for 1 hour",sub:`${P} to ${I}`,onPress:()=>H(C,P,I)}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]}):(0,f.jsxs)(n.default,{style:{gap:10},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Date"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:R.map(e=>(0,f.jsx)(b.Chip,{label:(0,c.niceDate)(e),selected:$===(0,c.ymd)(e),onPress:()=>{z((0,c.ymd)(e)),A(null)}},(0,c.ymd)(e)))}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Time window"}),(0,f.jsxs)(b.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(b.Chip,{label:"All day",selected:N.from===L&&N.to===F,onPress:()=>A({from:L,to:F})}),L<1020?(0,f.jsx)(b.Chip,{label:`Lunch ${(0,c.fromMins)(L)}\u201317:00`,selected:N.from===L&&1020===N.to,onPress:()=>A({from:L,to:Math.min(1020,F)})}):null,F>1020?(0,f.jsx)(b.Chip,{label:`Evening 17:00\u2013${(0,c.fromMins)(F)}`,selected:1020===N.from&&N.to===F,onPress:()=>A({from:Math.max(1020,L),to:F})}):null]}),(0,f.jsx)(w,{label:"From",value:N.from,min:L,max:N.to-30,onChange:e=>A({...N,from:e})}),(0,f.jsx)(w,{label:"To",value:N.to,min:N.from+30,max:F,onChange:e=>A({...N,to:e})}),(0,f.jsx)(y,{value:j,onChange:B}),(0,f.jsx)(b.Button,{testID:"block-save-future",label:`Block ${(0,c.niceDate)((0,c.parseYmd)($))} ${(0,c.fromMins)(N.from)}\u2013${(0,c.fromMins)(N.to)}`,disabled:!R.length,onPress:()=>H($,(0,c.fromMins)(N.from),(0,c.fromMins)(N.to))}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]})})}function C(e,o,s,l,t){const r=(0,d.hoursFor)(o,s),n=x(s),a=r?(0,c.hm)(r.close):null,u=a&&(0,c.toMins)(a)>(0,c.toMins)(n)?a:'23:59';return t.map(o=>i.useBlocks.getState().add({rid:e,date:(0,c.ymd)(s),from:n,to:u,reason:'Weather',by:l,areaId:o.id,areaName:o.name}))}function v(e,o){const s=(0,a.usePlan)(e),l=(0,i.useBlocks)(e=>e.blocks),t=s.areas.filter(e=>e.outdoor),r=(0,i.closedAreasAt)(l,e,(0,c.ymd)(o),(0,c.hm)(o)),n=l.filter(s=>s.rid===e&&s.areaId&&s.date===(0,c.ymd)(o)&&(0,c.toMins)((0,c.hm)(o))>=(0,c.toMins)(s.from)&&(0,c.toMins)((0,c.hm)(o))<(0,c.toMins)(s.to));return{plan:s,outdoor:t,closed:r,active:n,allClosed:t.length>0&&t.every(e=>r.has(e.id))}}function D({rid:e,r:o,now:s,by:l,onDone:t}){const r=v(e,s);return!r.outdoor.length||r.allClosed?null:(0,f.jsx)(k,{testID:"block-garden",title:"Close garden for weather",sub:`${r.outdoor.map(e=>e.name).join(', ')} only \xb7 the rest of the venue stays bookable`,onPress:()=>{C(e,o,s,l,r.outdoor.filter(e=>!r.closed.has(e.id))),t()}})}function M({rid:e,now:o,big:s}){const l=v(e,o);if(!l.active.length)return null;const t=[...new Set(l.active.map(e=>e.areaName??'Garden'))].join(', '),r=l.active.map(e=>e.to).sort().slice(-1)[0],a=l.plan.areas.filter(e=>e.dogs&&!l.closed.has(e.id)).map(e=>e.name);return(0,f.jsxs)(n.default,{testID:"garden-banner",accessibilityRole:"summary",style:{flexDirection:'row',alignItems:'center',gap:10,backgroundColor:u.colours.blueBg,borderColor:u.colours.blue,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[(0,f.jsx)(b.T,{size:s?20:16,children:"\ud83c\udf27"}),(0,f.jsxs)(n.default,{style:{flex:1},children:[(0,f.jsxs)(b.T,{size:s?20:16,weight:"semibold",colour:u.colours.blue,children:[t," closed for weather until ",r]}),(0,f.jsxs)(b.T,{size:13,colour:"#E2C489",children:["No bookings or walk-ins are offered there.",a.length?` Dogs can still sit in the ${a.join(' or ')}.`:'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Reopen",testID:"garden-reopen",onPress:()=>l.active.forEach(e=>i.useBlocks.getState().remove(e.id))})]})}},935,[808,30,1318,937,263,127,824,825,815,818,821,813,1024,1374,24]); +__d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DAY_BACK",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"DAY_AHEAD",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"DAY_IDLE_MS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"dayOffset",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"shiftDay",{enumerable:!0,get:function(){return h}}),_e.dayWord=p,Object.defineProperty(_e,"dayLong",{enumerable:!0,get:function(){return x}}),_e.bookingsForDay=D,_e.dayCovers=function(e,t,o){if(t>=o)return(0,s.coversToday)(e,t);const n=D(e,t,o),d=(c=n.filter(e=>(0,s.coverDone)(e)||'seated'===(0,s.shownStatus)(e)),c.reduce((e,t)=>e+t.partySize,0)),l=(0,s.coversToday)(e,t).total;var c;return{done:d,toCome:Math.max(0,l-d),total:l}},_e.DaySwitch=function({day:e,today:s,onDay:b,back:D=u,ahead:j=y,idPrefix:$="display-day",stacked:P=!1}){const T=f(e,s),v=t=>{const o=h(e,t);b(o===s?null:o)},w=h(e,-1),C=h(e,1),Y=0!==T,I=(e,o,s,d,u)=>(0,c.jsx)(t.default,{testID:u,accessibilityRole:"button",accessibilityLabel:o,accessibilityState:{disabled:d},disabled:d,onPress:s,style:({pressed:e})=>({minHeight:44,minWidth:P?0:92,flex:P?1:void 0,paddingHorizontal:P?6:12,borderRadius:12,alignItems:'center',justifyContent:'center',borderWidth:1,borderColor:l.colours.hairline,opacity:d?.35:1,backgroundColor:e?l.colours.tilePressed:'rgba(255,255,255,0.03)'}),children:(0,c.jsx)(n.T,{center:P,size:P?16:14,weight:"semibold",colour:l.colours.goldLight,numberOfLines:P?void 0:1,children:e})}),L=p(e,s);return P?(0,c.jsxs)(o.default,{testID:`${$}-switch`,style:{gap:10,padding:12,borderRadius:14,borderWidth:1,borderColor:Y?l.colours.gold:l.colours.hairline,backgroundColor:Y?l.colours.goldTint:l.colours.surface},children:[(0,c.jsxs)(o.default,{testID:`${$}-label`,accessible:!0,accessibilityRole:"header",accessibilityLabel:`Showing ${L}, ${x(e)}`,style:{gap:2,alignItems:'center'},children:[(0,c.jsx)(n.T,{center:!0,size:20,weight:"semibold",colour:l.colours.goldLight,children:L}),(0,c.jsx)(n.T,{center:!0,size:16,children:x(e)})]}),(0,c.jsxs)(o.default,{style:{flexDirection:'row',gap:8,justifyContent:'center'},children:[I('\u2039 Previous',`Previous day, ${x(w)}`,()=>v(-1),T<=-D,`${$}-prev`),I('Today','Back to today',()=>b(null),!1,'back-to-today'),I('Next \u203a',`Next day, ${x(C)}`,()=>v(1),T>=j,`${$}-next`)]})]}):(0,c.jsxs)(o.default,{testID:`${$}-switch`,style:{flexDirection:'row',alignItems:'center',gap:8},children:[I('\u2039 Previous',`Previous day, ${x(w)}`,()=>v(-1),T<=-D,`${$}-prev`),(0,c.jsxs)(t.default,{testID:`${$}-label`,accessibilityRole:Y?'button':'text',disabled:!Y,onPress:()=>b(null),accessibilityLabel:Y?`Showing ${L===(0,d.niceDate)((0,d.parseYmd)(e))?'':`${L}, `}${x(e)}. Back to today`:`Showing today, ${x(e)}`,style:({pressed:e})=>({flex:1,minWidth:0,minHeight:44,borderRadius:12,alignItems:'center',justifyContent:'center',paddingHorizontal:6,borderWidth:Y?1:0,borderColor:l.colours.gold,backgroundColor:e?l.colours.tilePressed:Y?l.colours.goldTint:'transparent'}),children:[(0,c.jsx)(n.T,{size:15,weight:"semibold",colour:Y?l.colours.gold:l.colours.text,numberOfLines:1,children:Y&&L!==(0,d.niceDate)((0,d.parseYmd)(e))?`${L} \xb7 ${(0,d.niceDate)((0,d.parseYmd)(e))}`:L}),Y?(0,c.jsx)(n.T,{size:11,colour:l.colours.muted,numberOfLines:1,children:"Tap for today"}):null]}),I('Next \u203a',`Next day, ${x(C)}`,()=>v(1),T>=j,`${$}-next`)]})},r(_d[0]);var t=e(r(_d[1])),o=e(r(_d[2])),n=r(_d[3]),s=r(_d[4]),d=r(_d[5]),l=r(_d[6]),c=r(_d[7]);const u=365,y=365,b=12e4,f=(e,t)=>Math.round(((0,d.parseYmd)(e).getTime()-(0,d.parseYmd)(t).getTime())/864e5),h=(e,t)=>(0,d.ymd)((0,d.addMins)((0,d.parseYmd)(e),1440*t+120));function p(e,t){const o=f(e,t);return 0===o?'Today':-1===o?'Yesterday':1===o?'Tomorrow':(0,d.niceDate)((0,d.parseYmd)(e))}const x=e=>(0,d.parseYmd)(e).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'});function D(e,t,o){return e.filter(e=>e.date===t&&(0,s.ACTIVE)(e))}},936,[30,263,127,813,828,818,821,24]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"look",{enumerable:!0,get:function(){return D}});var E=r(d[0]),I=r(d[1]),S=r(d[2]),o=r(d[3]);r(d[4]);var _=r(d[5]);const b=E=>E,D={panel:{backgroundColor:E.IS_QUEUED_VENUE?I.QUEUED_BRAND.ink:E.IS_ABBOTSFORD?'#2A2F34':E.IS_KIRKTON?'#141414':E.IS_GREENSIDE?'#222222':E.IS_WILDINGS?'#30343B':(0,o.soutersSurface)('#121110'),borderRadius:_.radii.xl,borderWidth:1,borderColor:'rgba(255,255,255,0.07)',boxShadow:'0 1px 0 rgba(255,255,255,0.04) inset, 0 12px 28px rgba(0,0,0,0.45)'},quiet:(o,b="gold")=>({minHeight:_.control.tall,borderRadius:_.radii.button,borderWidth:1,borderColor:E.IS_QUEUED_VENUE?I.QUEUED_BRAND.smallTextAccent:E.IS_ABBOTSFORD?'rgba(229,208,141,0.65)':E.IS_KIRKTON?'rgba(180,108,84,0.55)':E.IS_GREENSIDE?S.GREENSIDE_DISPLAY.quietBorder:E.IS_WILDINGS?'rgba(255,227,165,0.55)':E.IS_KIRKMICHAEL?'rgba(184,119,84,0.55)':E.IS_ISOLATED_VENUE?'rgba(164,98,46,0.55)':'blue'===b?'rgba(226,196,137,0.55)':'rgba(207,164,95,0.38)',backgroundColor:E.IS_ISOLATED_VENUE?o?E.IS_ABBOTSFORD?'rgba(184,147,98,0.16)':E.IS_KIRKTON?'rgba(180,108,84,0.16)':E.IS_GREENSIDE?S.GREENSIDE_DISPLAY.quietPressed:E.IS_WILDINGS?'rgba(255,227,165,0.16)':E.IS_KIRKMICHAEL?'rgba(184,119,84,0.16)':'rgba(164,98,46,0.16)':'rgba(255,255,255,0.035)':o?'rgba(207,164,95,0.16)':'blue'===b?'rgba(226,196,137,0.10)':'rgba(255,255,255,0.035)',paddingHorizontal:14,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,boxShadow:'0 1px 0 rgba(255,255,255,0.05) inset',transition:'background-color 120ms ease'}),primary:o=>E.IS_ISOLATED_VENUE?{backgroundColor:E.IS_QUEUED_VENUE?I.QUEUED_BRAND.accent:E.IS_ABBOTSFORD?'#B89362':E.IS_KIRKTON?'#B46C54':E.IS_GREENSIDE?o?S.GREENSIDE_DISPLAY.primaryPressed:S.GREENSIDE_PALETTE.gold:E.IS_WILDINGS?o?'#E6CC94':'#FFE3A5':E.IS_KIRKMICHAEL?o?'#A66949':'#B87754':o?'#8C5226':'#A4622E',borderWidth:1,borderColor:E.IS_QUEUED_VENUE?I.QUEUED_BRAND.smallTextAccent:E.IS_ABBOTSFORD?'#E5D08D':E.IS_KIRKTON?'#D6A28E':E.IS_GREENSIDE?S.GREENSIDE_PALETTE.goldLight:E.IS_WILDINGS?'#FFF0CF':E.IS_KIRKMICHAEL?'#C2937A':'#C18F67',backgroundImage:'none',boxShadow:'0 4px 12px rgba(0,0,0,0.35)'}:{backgroundColor:o?'#B8904F':'#CFA45F',borderWidth:1,borderColor:'rgba(255,226,170,0.55)',backgroundImage:o?'linear-gradient(180deg, #BE9552 0%, #A88143 100%)':'linear-gradient(180deg, #E0BA77 0%, #C69A55 100%)',boxShadow:o?'0 2px 8px rgba(0,0,0,0.4)':'0 1px 0 rgba(255,255,255,0.28) inset, 0 10px 24px rgba(207,164,95,0.22), 0 4px 10px rgba(0,0,0,0.45)',transition:'box-shadow 120ms ease'},onPrimary:E.IS_QUEUED_VENUE?I.QUEUED_BRAND.onAccent:E.IS_ABBOTSFORD||E.IS_KIRKTON?'#0B0B0B':E.IS_GREENSIDE?'#1A1A1A':E.IS_WILDINGS?'#272A2F':E.IS_KIRKMICHAEL?'#0B0B0B':E.IS_ISOLATED_VENUE?'#FFFFFF':'#17130D',web:b}},937,[5,1206,1174,868,122,1209]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useReservedToday=k,_e.ShellfishTile=function({rid:e,by:t,app:l,big:c,onOrder:h,style:b}){const y=(0,d.useShellfish)(e,t,l),p=k(e),[w,C]=(0,s.useState)(!1),S=x(e,y.items.find(e=>e.supplierId)?.supplierId),L=(0,o.useLiveState)();if('ready'!==L)return(0,f.jsx)(o.LiveWait,{state:L,title:"Lobsters & crabs",testID:"shellfish-wait"});if(!y.items.length)return null;const $=y.items.filter(e=>y.isLow(e.key)),T=y.items.length<=3?y.items.map(e=>e.plural.toUpperCase()).join(' & '):'LIVE STOCK';return(0,f.jsxs)(r.default,{testID:"shellfish-tile",style:[{borderRadius:16,borderWidth:1.5,borderColor:$.length?u.colours.amber:u.colours.border,backgroundColor:u.colours.surface,padding:c?10:12,gap:6},b],children:[(0,f.jsxs)(i.default,{accessibilityRole:"button",accessibilityLabel:`${y.items.map(t=>`${t.plural} ${(0,a.fmtStockCount)(e,t,y.counts[t.key]??0)}`).join(', ')}. Tap to update`,onPress:()=>C(!0),style:{gap:4,flex:c?1:void 0},children:[(0,f.jsxs)(n.Row,{wrap:!0,gap:6,style:{justifyContent:'space-between'},children:[(0,f.jsxs)(n.T,{size:12,weight:"semibold",colour:u.colours.gold,children:["LIVE \xb7 ",T]}),(0,f.jsx)(n.T,{size:12,colour:u.colours.muted,children:"Tap to update \u203a"})]}),(0,f.jsx)(n.Row,{gap:c?14:18,style:{flex:c?1:void 0,alignItems:'center'},children:y.items.map(t=>{const s=y.counts[t.key]??0,o=y.isLow(t.key);return(0,f.jsxs)(r.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,a.speakStockCount)(e,t,s)}`,style:{flex:1,alignItems:'center'},children:[(0,f.jsx)(n.T,{size:c?42:34,weight:"bold",colour:s<=0?u.colours.red:o?u.colours.amber:u.colours.text,style:{lineHeight:c?50:42},children:(0,a.fmtStockCount)(e,t,s)}),(0,f.jsxs)(n.T,{size:13,colour:o?u.colours.amber:u.colours.muted,children:[t.icon," ",t.plural,s<=0?' \xb7 out':o?' \xb7 low':'']}),p[t.key]?(0,f.jsxs)(n.T,{size:12,weight:"semibold",colour:u.colours.goldLight,children:["Reserved: ",(0,a.fmtStockCount)(e,t,p[t.key])," \xb7 free ",(0,a.fmtStockCount)(e,t,Math.max(0,s-p[t.key]))]}):null]},t.key)})})]}),!c&&$.length?(0,f.jsxs)(r.default,{testID:"shellfish-low",style:{backgroundColor:u.colours.amberBg,borderRadius:10,padding:8,gap:6},children:[(0,f.jsxs)(n.T,{size:13,weight:"semibold",colour:"#FFE2A8",children:["Low stock: ",$.map(t=>`${(0,a.fmtStockCount)(e,t,y.counts[t.key]??0)} ${t.plural.toLowerCase()} (warns at ${(0,a.fmtStockCount)(e,t,t.lowAt)})`).join(', ')]}),h?(0,f.jsx)(n.Button,{small:!0,label:S?`Order from ${S} \u203a`:'Order sheets \u203a',testID:"shellfish-order",onPress:h}):null]}):null,c||$.length||!h?null:(0,f.jsx)(i.default,{accessibilityRole:"button",onPress:h,style:{minHeight:44,justifyContent:'center'},children:(0,f.jsx)(n.T,{size:13,colour:u.colours.gold,children:S?`${S} order sheet \u203a`:'Order sheets \u203a'})}),w?(0,f.jsx)(j,{rid:e,by:t,app:l,onClose:()=>C(!1),onOrder:h?()=>{C(!1),h()}:void 0}):null]})},_e.ShellfishStrip=function({rid:e,by:t,app:o,height:c=76}){const h=(0,d.useShellfish)(e,t,o),b=k(e),[y,p]=(0,s.useState)(!1);if(!h.items.length)return null;const x=c>=80,w=Math.max(28,Math.min(52,Math.round(.6*c))),C=Math.max(22,Math.min(34,Math.round(.42*c)));return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(i.default,{testID:"shellfish-tile",accessibilityRole:"button",accessibilityLabel:`${h.items.map(t=>`${t.plural} ${(0,a.fmtStockCount)(e,t,h.counts[t.key]??0)}`).join(', ')}. Tap to update`,onPress:()=>p(!0),style:({pressed:e})=>({flexDirection:'row',alignItems:'stretch',height:c,backgroundColor:e?'#181612':'#100F0D',borderBottomWidth:1,borderBottomColor:'rgba(207,164,95,0.12)',borderTopWidth:1,borderTopColor:'rgba(255,255,255,0.04)',...l.look.web({backgroundImage:'linear-gradient(180deg, rgba(207,164,95,0.07) 0%, rgba(207,164,95,0.015) 100%)',cursor:'pointer'})}),children:h.items.map((t,s)=>{const o=h.counts[t.key]??0,i=b[t.key]??0,d=Math.max(0,o-i),y=d<=0,p=y||h.isLow(t.key);return(0,f.jsxs)(r.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,a.speakStockCount)(e,t,d)}`,style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:x?16:12,borderLeftWidth:s?1:0,borderLeftColor:'rgba(207,164,95,0.16)',backgroundColor:p?'rgba(255,107,94,0.07)':'transparent',...l.look.web(p?{backgroundImage:'linear-gradient(180deg, rgba(255,107,94,0.11) 0%, rgba(255,107,94,0.035) 100%)'}:{})},children:[(0,f.jsx)(n.T,{size:C,children:t.icon}),(0,f.jsx)(n.T,{size:w,weight:"bold",colour:p?'#FF8E82':u.colours.text,style:{lineHeight:Math.round(1.15*w),letterSpacing:-.5,minWidth:Math.round(.85*w),textAlign:'center'},children:(0,a.fmtStockCount)(e,t,d)}),(0,f.jsxs)(r.default,{style:{gap:0},children:[(0,f.jsx)(n.T,{size:x?15:13,weight:"semibold",colour:p?'#FFB3AA':u.colours.goldLight,style:{letterSpacing:2},children:t.plural.toUpperCase()}),p&&c>=60?(0,f.jsx)(n.T,{size:11,weight:"semibold",colour:"#FF8E82",style:{letterSpacing:1.5},children:y?'NONE LEFT':`LOW \xb7 WARNS AT ${(0,a.fmtStockCount)(e,t,t.lowAt)}`}):null,(0,f.jsxs)(n.T,{size:x?14:12,weight:"semibold",colour:i?u.colours.goldLight:'#857D6E',style:{letterSpacing:.5},children:["Reserved: ",(0,a.fmtStockCount)(e,t,i)]})]})]},t.key)})}),y?(0,f.jsx)(j,{rid:e,by:t,app:o,onClose:()=>p(!1)}):null]})},_e.ShellfishPanel=j,_e.ShellfishChip=function({rid:e,by:t,app:o,size:c="m"}){const h=(0,d.useShellfish)(e,t,o),b=k(e),[y,p]=(0,s.useState)(!1);if(!h.items.length)return null;const x='s'===c?17:20;return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(i.default,{testID:"shellfish-tile",accessibilityRole:"button",accessibilityLabel:`${h.items.map(t=>`${t.plural} ${(0,a.fmtStockCount)(e,t,Math.max(0,(h.counts[t.key]??0)-(b[t.key]??0)))} available`).join(', ')}. Tap to update`,onPress:()=>p(!0),style:({pressed:e})=>({flexDirection:'row',alignItems:'center',minHeight:44,borderRadius:14,borderWidth:1,borderColor:'rgba(207,164,95,0.30)',overflow:'hidden',backgroundColor:e?'#1C1913':'rgba(207,164,95,0.06)',...l.look.web({cursor:'pointer'})}),children:h.items.map((t,s)=>{const o=h.counts[t.key]??0,l=b[t.key]??0,i=Math.max(0,o-l),d=i<=0,c=d||h.isLow(t.key);return(0,f.jsxs)(r.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,a.speakStockCount)(e,t,i)}`,style:{flexDirection:'row',alignItems:'center',gap:6,paddingHorizontal:9,paddingVertical:3,borderLeftWidth:s?1:0,borderLeftColor:'rgba(207,164,95,0.18)',backgroundColor:c?'rgba(255,107,94,0.10)':'transparent'},children:[(0,f.jsx)(n.T,{size:x-2,children:t.icon}),(0,f.jsx)(n.T,{size:x,weight:"bold",colour:d?u.colours.red:c?u.colours.amber:u.colours.text,style:{lineHeight:x+4},children:(0,a.fmtStockCount)(e,t,i)}),l||d||c?(0,f.jsx)(n.T,{size:10,weight:"semibold",colour:d||c?'#FFB3AA':u.colours.goldLight,children:d?'none left':l?`${(0,a.fmtStockCount)(e,t,l)} res`:'low'}):null]},t.key)})}),y?(0,f.jsx)(j,{rid:e,by:t,app:o,onClose:()=>p(!1)}):null]})};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),i=e(_r(_d[4])),r=e(_r(_d[5])),n=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),y=_r(_d[13]),f=_r(_d[14]);const p=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'});function k(e){const t=(0,h.useBookings)(e),s=(0,h.useRestaurant)(e),o=(0,y.ymd)((0,h.useNow)(6e4));return(0,b.reservedOn)(t,o,(0,b.reservablesOf)(s))}function x(e,t){const s=(0,c.useSheets)(e);return t?s.find(e=>e.id===t)?.name:void 0}function j({rid:e,by:o,app:l,onClose:i,onOrder:c}){const h=(0,d.useShellfish)(e,o,l),[b,y]=(0,s.useState)({}),[k,j]=(0,s.useState)(null),w=x(e,h.items.find(e=>e.supplierId)?.supplierId),C=(s,o)=>{const l=h.itemOf(s);l&&y(i=>({...i,[s]:(0,t.fishInStone)(e,l)?(0,t.stepQuantity)(e,l,i[s]||0,o):Math.max(0,Math.min(99,(i[s]||0)+o))}))},S=(e,t=!1)=>{const s=h.itemOf(e);h.sell(e,t)&&j(('kg'===s?.unit?`Half a stone ${s.name.toLowerCase()}`:t?`Half ${s?.name.toLowerCase()}`:`1 ${s?.name.toLowerCase()}`)+" sold.")},L=Object.values(b).reduce((e,t)=>e+t,0);return(0,f.jsxs)(n.Sheet,{visible:!0,onClose:i,title:h.items.map(e=>e.plural).join(' & ')||'Tracked stock',maxWidth:620,testID:"shellfish-panel",children:[(0,f.jsx)(n.Row,{gap:10,wrap:!0,style:{alignItems:'stretch'},children:h.items.map(s=>{const o=h.counts[s.key]??0;return(0,f.jsxs)(r.default,{style:{flex:1,minWidth:160,gap:8,padding:10,borderRadius:14,borderWidth:1,borderColor:h.isLow(s.key)?u.colours.amber:u.colours.border,backgroundColor:u.colours.surface2},children:[(0,f.jsxs)(n.T,{center:!0,size:13,colour:u.colours.muted,children:[s.icon," ",s.plural]}),(0,f.jsx)(n.T,{center:!0,size:48,weight:"bold",colour:h.isLow(s.key)?u.colours.amber:u.colours.text,style:{lineHeight:56},children:(0,a.fmtStockCount)(e,s,o)}),(0,f.jsx)(n.Button,{label:(0,t.fishInStone)(e,s)?`Sold half a stone ${s.name.toLowerCase()}`:`Sold 1 ${s.name.toLowerCase()} \u22121`,testID:`sell-${s.key}`,disabled:o<((0,t.fishInStone)(e,s)?t.HALF_STONE_KG:1),onPress:()=>S(s.key),style:{minHeight:56}}),'half'===s.unit?(0,f.jsx)(n.Button,{kind:"secondary",label:"Sold a half \u2212\xbd",testID:`sell-${s.key}-half`,disabled:o<.5,onPress:()=>S(s.key,!0),style:{minHeight:52}}):(0,f.jsx)(r.default,{style:{minHeight:52}})]},s.key)})}),(0,f.jsx)(n.Button,{kind:"ghost",label:h.undoable?`\u21b6 Undo: ${(0,a.describe)(h.undoable,h.itemOf(h.undoable.kind))}`:'\u21b6 Nothing to undo',testID:"shellfish-undo",disabled:!h.undoable,onPress:()=>{const e=h.undoable;h.undoLast(),e&&j(`Undone: ${(0,a.describe)(e,h.itemOf(e.kind))}.`)}}),k?(0,f.jsx)(n.Banner,{kind:"success",title:k}):null,(0,f.jsxs)(r.default,{testID:"delivery-in",style:{gap:8,padding:10,borderRadius:14,borderWidth:1,borderColor:u.colours.gold,backgroundColor:u.colours.goldTint},children:[(0,f.jsx)(n.T,{weight:"semibold",colour:u.colours.goldLight,children:"Delivery in"}),h.items.map(s=>(0,f.jsxs)(n.Row,{gap:10,children:[(0,f.jsxs)(n.T,{style:{flex:1},children:[s.icon," ",s.plural]}),(0,f.jsx)(n.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:`${(0,t.fishInStone)(e,s)?'Half a stone less':'Fewer'} ${s.plural.toLowerCase()} in`,onPress:()=>C(s.key,-1),style:{minWidth:48,minHeight:48}}),(0,f.jsx)(n.T,{size:24,weight:"bold",style:{minWidth:76,textAlign:'center'},children:(0,a.fmtStockCount)(e,s,b[s.key]||0)}),(0,f.jsx)(n.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:`${(0,t.fishInStone)(e,s)?'Half a stone more':'More'} ${s.plural.toLowerCase()} in`,testID:`in-plus-${s.key}`,onPress:()=>C(s.key,1),style:{minWidth:48,minHeight:48}}),(0,t.fishInStone)(e,s)?null:(0,f.jsx)(n.Button,{small:!0,kind:"ghost",label:"Add five",onPress:()=>C(s.key,5)})]},s.key)),(0,f.jsx)(n.Button,{kind:"success",label:L?`Add to stock: ${h.items.filter(e=>b[e.key]).map(t=>`${(0,a.fmtStockCount)(e,t,b[t.key])} ${(1===b[t.key]?t.name:t.plural).toLowerCase()}`).join(' and ')}`:'Add to stock',testID:"delivery-add",disabled:!L,onPress:()=>{h.items.forEach(e=>h.deliver(e.key,b[e.key]??0)),j('Delivery added to the count.'),y({})},style:{minHeight:54}})]}),c?(0,f.jsx)(n.Button,{kind:"secondary",label:w?`${w} order sheet \u203a`:'Order sheets \u203a',onPress:c}):null,(0,f.jsxs)(r.default,{style:{gap:2},children:[(0,f.jsx)(n.T,{size:12,weight:"semibold",colour:u.colours.gold,children:"RECENT"}),h.events.slice(0,6).map(e=>(0,f.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(n.T,{size:13,style:{flex:1},children:(0,a.describe)(e,h.itemOf(e.kind))}),(0,f.jsxs)(n.Muted,{children:[p(e.at)," \xb7 ",e.by.replace(' (example)','')]})]},e.id))]}),(0,f.jsx)(n.Row,{wrap:!0,gap:6,children:h.synced?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(n.Badge,{kind:"ok",label:"Shared live"}),(0,f.jsx)(n.Muted,{children:"Every paired device sees the same count."})]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(n.Badge,{kind:"neutral",label:"Saved on this device"}),(0,f.jsx)(n.Muted,{children:"Not connected to the shared venue yet."})]})})]})}},938,[1026,30,1205,937,263,127,813,1029,1027,1028,821,819,828,818,24]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AllergyChain=j,_e.BookingAllergyChain=function({b:l,me:s,readOnly:k}){const p=(0,i.useOrders)(l.restaurantId),A=(0,n.useStore)(e=>e.ackBookingAllergy);if(!l.allergies.length)return null;const S=p.find(e=>e.allergies.length&&!['cancelled','closed'].includes(e.status)&&(e.bookingId===l.id||!e.bookingId&&(0,c.linkedBooking)(e,[l])?.id===l.id));if(S)return(0,h.jsx)(j,{o:S,me:s,readOnly:k,compact:!0});const w={booked:l.allergyAck,ordered:void 0,kitchen:void 0,pass:void 0,table:void 0};return(0,h.jsxs)(t.default,{testID:`allergy-chain-${l.ref}`,style:{gap:6,padding:8,borderRadius:10,borderWidth:1,borderColor:l.allergyAck?u.colours.border:u.colours.red,backgroundColor:(0,e.soutersSurface)('#140f0e')},children:[(0,h.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsxs)(o.T,{size:13,weight:"semibold",colour:"#FFD9D4",children:["Allergen sign-off \xb7 ",l.ref]}),(0,h.jsx)(o.Badge,{kind:l.allergyAck?'amber':'red',label:(l.allergyAck?1:0)+" of 5"})]}),(0,h.jsx)(y,{chain:w,next:l.allergyAck?null:'booked',testID:`allergy-steps-${l.ref}`}),l.allergyAck?(0,h.jsxs)(o.Row,{gap:6,children:[(0,h.jsx)(f.StaffAvatar,{name:l.allergyAck.by,size:20,ring:!1}),(0,h.jsxs)(o.Muted,{style:{flex:1},children:["1. Booked: ",x(l.allergyAck.by)," at ",b(l.allergyAck.at),". Steps 2 to 5 are signed on the table's order."]})]}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(o.T,{size:13,children:"Next: 1. Booked. Allergy recorded (who took it)."}),k?null:(0,h.jsxs)(o.Row,{wrap:!0,gap:8,children:[(0,h.jsx)(o.Button,{small:!0,kind:"danger",label:"Sign off",testID:`sign-off-${l.ref}`,accessibilityLabel:`Sign off Booked on ${l.ref}`,disabled:!s.trim(),onPress:()=>A(l.id,s)}),(0,h.jsxs)(o.Muted,{children:["as ",x(s)]})]})]})]})};var e=r(d[0]);r(d[1]);var l,s=r(d[2]),t=(l=s)&&l.__esModule?l:{default:l},o=r(d[3]),i=r(d[4]),n=r(d[5]),c=r(d[6]),u=r(d[7]),f=r(d[8]),h=r(d[9]);const b=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}),x=e=>e.replace(' (example)','');function y({chain:e,next:l,testID:s}){return(0,h.jsx)(t.default,{testID:s,accessibilityLabel:`Allergen sign-off ${c.CHAIN_STEPS.filter(l=>e[l.id]).length} of 5`,style:{flexDirection:'row',alignItems:'flex-start'},children:c.CHAIN_STEPS.map((s,i)=>{const n=!!e[s.id],c=l===s.id,f=n?u.colours.ok:c?u.colours.gold:u.colours.border;return(0,h.jsxs)(t.default,{style:{flex:1,alignItems:'center'},children:[(0,h.jsxs)(t.default,{style:{flexDirection:'row',alignItems:'center',width:'100%'},children:[(0,h.jsx)(t.default,{style:{flex:1,height:2,backgroundColor:i?n||c?f:u.colours.border:'transparent'}}),(0,h.jsx)(t.default,{style:{width:26,height:26,borderRadius:13,borderWidth:2,borderColor:f,backgroundColor:n?u.colours.ok:'transparent',alignItems:'center',justifyContent:'center'},children:(0,h.jsx)(o.T,{size:12,weight:"bold",colour:n?'#0B0B0B':c?u.colours.gold:u.colours.muted,children:n?'\u2713':String(s.n)})}),(0,h.jsx)(t.default,{style:{flex:1,height:2,backgroundColor:i<4?n?u.colours.ok:u.colours.border:'transparent'}})]}),(0,h.jsx)(o.T,{size:11,weight:c?'semibold':'regular',colour:n?u.colours.text:c?u.colours.gold:u.colours.muted,center:!0,children:s.label}),e[s.id]?(0,h.jsxs)(o.T,{size:10,colour:u.colours.muted,center:!0,numberOfLines:2,children:[x(e[s.id].by).split(' ')[0]," ",b(e[s.id].at)]}):null]},s.id)})})}function j({o:l,me:s,readOnly:j,compact:k}){const p=(0,i.useBookings)(l.restaurantId),A=(0,n.useStore)(e=>e.signAllergyStep);if(!l.allergies.length)return null;const S=(0,c.linkedBooking)(l,p),w=(0,c.orderChain)(l,S),I=(0,c.nextStep)(l,S),C=c.CHAIN_STEPS.filter(e=>w[e.id]).length,B=I?(0,c.stepInfo)(I):null,D='table'===I&&!['ready','served','collected'].includes(l.status);return(0,h.jsxs)(t.default,{testID:`allergy-chain-${l.ref}`,style:{gap:6,padding:8,borderRadius:10,borderWidth:1,borderColor:I?u.colours.red:u.colours.ok,backgroundColor:(0,e.soutersSurface)('#140f0e')},children:[(0,h.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsxs)(o.T,{size:13,weight:"semibold",colour:I?'#FFD9D4':'#E2C489',children:["Allergen sign-off \xb7 ",l.ref]}),(0,h.jsx)(o.Badge,{kind:I?'red':'ok',label:I?`${C} of 5`:'Complete'})]}),(0,h.jsx)(y,{chain:w,next:I,testID:`allergy-steps-${l.ref}`}),k?null:c.CHAIN_STEPS.filter(e=>w[e.id]).map(e=>(0,h.jsxs)(o.Row,{gap:6,children:[(0,h.jsx)(f.StaffAvatar,{name:w[e.id].by,size:20,ring:!1}),(0,h.jsxs)(o.Muted,{style:{flex:1},children:[e.n,". ",e.label,": ",x(w[e.id].by)," at ",b(w[e.id].at)]})]},e.id)),B?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(o.T,{size:13,children:["Next: ",B.n,". ",B.label,". ",B.what,"."]}),j?null:(0,h.jsxs)(o.Row,{wrap:!0,gap:8,children:[(0,h.jsx)(o.Button,{small:!0,kind:"danger",label:"Sign off",testID:`sign-off-${l.ref}`,accessibilityLabel:`Sign off ${B.label} on ${l.ref}`,disabled:!s.trim()||D,onPress:()=>A(l.id,I,s)}),(0,h.jsxs)(o.Muted,{children:["as ",x(s)]})]}),D?(0,h.jsx)(o.Muted,{children:"Signed off at the pass. The table step is signed when the dish is served."}):(0,h.jsx)(o.Muted,{children:"The ticket can't move on until this step is signed off."})]}):(0,h.jsx)(o.Muted,{children:"All five steps signed off. The full chain is in the allergen audit log."})]})}},939,[868,30,127,813,1022,872,940,821,953,24]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CHAIN_STEPS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"stepInfo",{enumerable:!0,get:function(){return t}}),e.linkedBooking=l,e.orderChain=o,e.nextStep=s,Object.defineProperty(e,"doneCount",{enumerable:!0,get:function(){return c}}),e.canSign=function(n,t,l){return s(n,l)===t},e.statusBlock=function(n,l,s){if(!n.allergies.length||'cancelled'===l)return null;const c=o(n,s),u=n=>c[n]?null:`${t(n).n}. ${t(n).label} needs signing off first`;return'acknowledged'===l||'preparing'===l||'ready'===l?u('booked')??u('ordered')??u('kitchen'):'served'===l?u('booked')??u('ordered')??u('kitchen')??u('pass'):'collected'===l||'closed'===l?u('booked')??u('ordered')??u('kitchen')??u('pass')??u('table'):null},e.chainNeedsAction=function(n,t){const o=s(n,l(n,t));return!(!o||'table'===o&&!['ready','served'].includes(n.status))},e.bookingNeedsAction=function(n,t){return n.allergies.length>0&&!n.allergyAck&&!t.some(t=>t.allergies.length&&l(t,[n])?.id===n.id)};const n=[{id:'booked',n:1,label:'Booked',what:'Allergy recorded (who took it)'},{id:'ordered',n:2,label:'Ordered',what:'Server confirms with the guest'},{id:'kitchen',n:3,label:'Kitchen',what:'Chef signs off before cooking'},{id:'pass',n:4,label:'Pass',what:'Checked before it leaves the pass'},{id:'table',n:5,label:'Table',what:'Server signs off when served'}],t=t=>n.find(n=>n.id===t);function l(n,t){return n.bookingId?t.find(t=>t.id===n.bookingId):'table'===n.type&&n.tableNo?t.find(t=>t.restaurantId===n.restaurantId&&'seated'===t.status&&!!t.table&&t.table.split('+').includes(String(n.tableNo))):void 0}function o(n,t){return{booked:n.allergyChain?.booked??(t?.allergies.length?t.allergyAck:void 0),ordered:n.allergyChain?.ordered,kitchen:n.allergyAck,pass:n.allergyChain?.pass,table:n.handoverCheck}}function s(t,l){if(!t.allergies.length)return null;const s=o(t,l);return n.find(n=>!s[n.id])?.id??null}const c=(t,l)=>{const s=o(t,l);return n.filter(n=>s[n.id]).length}},940,[]); +__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.queuedSessions=o,e.queuedRequestSlots=u,e.queuedRequestError=function(t,o,s,a=new Date){if(o.name.trim().length<2||o.name.trim().length>100||!/^[0-9 +()\-]{7,30}$/.test(o.phone)||!/^[0-9]{7,15}$/.test(o.phone.replace(/\D/g,''))||o.email.length>254||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(o.email))return'Enter your name, phone number and email.';if(o.notes.length>2e3)return'Keep notes under 2000 characters.';const c=(0,n.localDate)(a),d=(0,n.localDate)(new Date(+a+63072e6));if(!o.date||o.dated||!u(t,o.date,s).includes(o.time||''))return'Choose a future date and a time within confirmed kitchen service hours.';const l=new Intl.DateTimeFormat('en-GB',{timeZone:'Europe/London',hour:'2-digit',minute:'2-digit',hour12:!1}).format(a);return o.date===c&&(o.time||'')<=l?'Choose a future time.':!Number.isInteger(o.covers)||o.covers<1||o.covers>200?'Enter 1 to 200 Covers.':''};var t=r(_d[0]),n=r(_d[1]);function o(n){const o=t.queuedVenues[n];return o?.kitchenSessionsByDay??o?.hours.sessionsByDay??void 0}const s=t=>60*+t.slice(0,2)+ +t.slice(3);function u(n,u,a){if(!/^\d{4}-\d{2}-\d{2}$/.test(u))return[];const c=new Date(u+'T12:00:00Z');if(!Number.isFinite(+c)||c.toISOString().slice(0,10)!==u)return[];const d=(a??o(n))?.[c.getUTCDay()];if(!Array.isArray(d))return[];const l=[],f=t.queuedVenues[n]?.booking.lastSittingMinutesBeforeClose??0;for(const t of d){if(!Array.isArray(t)||2!==t.length||!t.every(t=>'string'==typeof t&&/^([01]\d|2[0-3]):[0-5]\d$/.test(t)))continue;const n=s(t[0]),o=s(t[1]);if(!(n>=o))for(let t=n;te.id===t)?.uses??[],r=O(e),i=c.useStore.getState().menu.find(e=>e.id===t)?.name??'';return(0,u.dishReason)(i,(0,u.shortOf)(s,r),r,b(e))},_e.runAutoSoldOut=y,_e.startAutoSoldOut=function(){if(w)return w;let e=null;const t=()=>{e||(e=setTimeout(()=>{e=null,y()},400))},n=[d.useShellStore.subscribe((e,n)=>{e.events===n.events&&e.server===n.server&&e.items===n.items||t()}),h.subscribe(t),S.useCardStore.subscribe((e,n)=>{e.cards!==n.cards&&t()}),c.useStore.subscribe((e,n)=>{e.menu===n.menu&&e.restaurants===n.restaurants||t()}),f.useSoldOut.subscribe((e,n)=>{e.entries!==n.entries&&t()})],s=setInterval(t,6e4);return t(),w=()=>{n.forEach(e=>e()),clearInterval(s),e&&clearTimeout(e),w=null},w},_e.useAutoSoldOutView=function(e){const t=(0,c.useStore)(e=>e.menu),n=h(e=>e.links),s=(0,S.useCardStore)(e=>e.cards),r=(0,d.useShellStore)(t=>t.items[e]);(0,d.useShellStore)(e=>e.events),(0,d.useShellStore)(t=>t.server[e]);const i=(r??[]).filter(e=>e.active).map(e=>({key:e.key,name:e.name,plural:e.plural,unit:e.unit,active:e.active})),o=p(e,t,n,s,i),l=O(e);return{dishes:o,counts:l,items:i,reason:e=>{const t=o.find(t=>t.id===e);return t?(0,u.dishReason)(t.name,(0,u.shortOf)(t.uses,l),l,i):''},links:n}};var e,t=_r(_d[0]),n=(e=t)&&e.__esModule?e:{default:e},s=_r(_d[1]),r=_r(_d[2]),u=_r(_d[3]),i=_r(_d[4]),o=_r(_d[5]),l=_r(_d[6]),c=_r(_d[7]),d=_r(_d[8]),S=_r(_d[9]),f=_r(_d[10]);const m=()=>{try{return(0,c.nowFrom)(c.useStore.getState().clock)}catch{return new Date}},h=(0,s.create)()((0,r.persist)(e=>({links:[],setLink:(t,n,s,r)=>e(e=>{const u=e.links.filter(e=>!(e.rid===t&&e.itemId===n));return{links:[...u,{rid:t,itemId:n,uses:s?s.filter(e=>e.qty>0).slice(0,10):[],at:m().toISOString(),by:r.slice(0,80),...s?{}:{auto:!0}}]}})}),{name:'covercharge-soldout-links-v1',version:1,storage:(0,r.createJSONStorage)(()=>n.default)})),k=e=>!!e&&!0===e.auto,v={soldOutRead:new Set,linksRead:new Set};function b(e){return(d.useShellStore.getState().items[e]??[]).filter(e=>e.active).map(e=>({key:e.key,name:e.name,plural:e.plural,unit:e.unit,active:e.active}))}function p(e,t=c.useStore.getState().menu,n=h.getState().links,s=S.useCardStore.getState().cards,r=b(e)){const i=[];for(const o of t){if(o.restaurantId!==e||o.hidden)continue;const t=s.find(t=>t.restaurantId===e&&t.menuItemId===o.id),l=n.find(t=>t.rid===e&&t.itemId===o.id),c=(0,u.inferUses)(o,t,r),d=k(l)?c:(0,u.usesFor)(o,l,t,r);i.push({id:o.id,name:o.name,uses:d.uses,source:d.source,guess:c.uses})}return i}function O(e){return(0,d.venueCounts)(d.useShellStore.getState(),e)}function I(e){const t={};for(const n of d.useShellStore.getState().events)n.rid===e&&(!t[n.kind]||n.at>t[n.kind])&&(t[n.kind]=n.at);return t}function y(e=m()){const t=c.useStore.getState();let n=0;for(const s of t.restaurants){const t=s.id;if((0,o.liveData)()&&(!d.useShellStore.getState().server[t]||!v.soldOutRead.has(t)||!v.linksRead.has(t)))continue;const r=(0,i.soldOutSettingsOf)(s.settings?.soldOut).auto,l=p(t),c=(0,u.planAuto)({rid:t,enabled:r,dishes:l,counts:O(t),entries:f.useSoldOut.getState().entries,lastChange:I(t),now:e});if(!c.mark.length&&!c.clear.length)continue;const S=e.toISOString();f.useSoldOut.setState(e=>{const n=new Set(c.clear),s=new Map(c.mark.map(e=>[e.itemId,e.name])),r=e.entries.filter(e=>!(e.rid===t&&s.has(e.itemId))).map(e=>e.rid===t&&n.has(e.itemId)?{...e,on:!1,at:S,by:'Count back up',kept:!1,clearAfter:void 0}:e);return{entries:[...r,...c.mark.map(e=>({rid:t,itemId:e.itemId,name:e.name.slice(0,120),on:!0,at:S,by:'Live count',auto:!0,kept:!1}))]}}),n+=c.mark.length+c.clear.length}return n}let w=null;l.PITCH&&'undefined'!=typeof globalThis&&(globalThis.__pitchCounts=e=>{const t=c.useStore.getState().restaurants[0]?.id;if(!t)return;const n=O(t),s=m().toISOString(),r=Object.entries(e).filter(([e,t])=>(n[e]??0)!==t).map(([e,r],u)=>({id:`pitch-count-${Date.now()}-${u}`,rid:t,kind:e,delta:r-(n[e]??0),reason:'count',by:'Chef',app:'chef',at:s}));return r.length&&d.useShellStore.setState(e=>({events:[...e.events,...r]})),y()})},942,[1082,952,1091,943,944,1081,2,872,1027,1077,918]); +__d(function(_g,r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.parseQty=i,_e.inferUses=u,_e.usesFor=function(e,t,n,o){const s=new Set(o.filter(e=>!1!==e.active).map(e=>e.key));return t?{uses:t.uses.filter(e=>s.has(e.key)&&e.qty>0),source:t.uses.length?'link':'none'}:u(e,n,o)},_e.shortOf=c,_e.shortReason=f,_e.dishReason=function(e,t,n,o){if(!t.length)return'';const i=e.replace(/\([^)]*\)/g,'').trim(),a=e=>{const t=o.find(t=>t.key===e);return!!t&&new RegExp(`\\b(${s(t)})$`,'i').test(i)},l=t.filter(e=>!a(e.key));return l.length?f(l,n,o):t.some(e=>(n[e.key]??0)>0)?'not enough left':'none left'},Object.defineProperty(_e,"withReason",{enumerable:!0,get:function(){return h}}),_e.usesText=function(e,t){return e.length?e.map(e=>{const n=t.find(t=>t.key===e.key),o=(n?.name??e.key).toLowerCase(),s=(n?.plural??`${o}s`).toLowerCase();return`${.5===e.qty?'\xbd':Number.isInteger(e.qty)?String(e.qty):`${Math.floor(e.qty)}\xbd`} ${e.qty>1?s:o}`}).join(', '):'Not linked to the counts'},_e.planAuto=function(e){const{rid:t,enabled:n,dishes:o,counts:s,entries:i,lastChange:a,now:l}=e,u={mark:[],clear:[]},f=new Map(i.filter(e=>e.rid===t).map(e=>[e.itemId,e])),h=l.getTime(),m=e=>e.on&&(!e.clearAfter||new Date(e.clearAfter).getTime()>h),d=new Set;for(const e of o){d.add(e.id);const t=f.get(e.id),o=n?c(e.uses,s):[];if(o.length){if(t&&m(t))continue;if(t&&t.kept){const e=o.map(e=>a[e.key]??'').sort().pop()??'';if(!e||e<=t.at)continue}u.mark.push({itemId:e.id,name:e.name})}else t&&t.auto&&m(t)&&u.clear.push(e.id)}for(const e of f.values())e.auto&&m(e)&&!d.has(e.itemId)&&u.clear.push(e.itemId);return u};const e='meat|bisque|stock|cakes?|claws?|sauce|butter|oil|paste|salad|mayo|mayonnaise|thermidor|tails?|bon|croquettes?|p\xe2t\xe9|pate|rolls?|soup|linguine|ravioli',t=/^(g|kg|gram|grams|ml|l|litre|litres|oz|lb|lbs|cl)$/i,n={a:1,an:1,one:1,two:2,three:3,four:4,five:5,six:6,half:.5,'\xbd':.5},o=e=>e.replace(/[.*+?^${}()|[\]\\]/g,'\\$&'),s=e=>{const t=new Set([e.name,e.plural].map(e=>e.trim().toLowerCase()).filter(Boolean));for(const e of[...t])e.endsWith('s')?t.add(e.slice(0,-1)):t.add(e+'s');return[...t].sort((e,t)=>t.length-e.length).map(o).join('|')};function i(e){const t=(e||'').trim().toLowerCase();if(!t)return 1;if(/^\xbd$|^half\b/.test(t))return.5;const o=t.match(/^(\d+(?:\.\d+)?)\s*(\xbd)?/);if(o)return Number(o[1])+(o[2]?.5:0);const s=t.split(/\s+/)[0];return n[s]??1}const a=(e,t)=>'half'===e.unit?Math.max(.5,Math.round(2*t)/2):Math.max(1,Math.round(t)),l=e=>(e.optionGroups??[]).some(e=>e.choices.some(e=>/\bhalf\b/i.test(e.label)));function u(n,o,u){const c=u.filter(e=>!1!==e.active&&'kg'!==e.unit),f=(e,t)=>({source:e,uses:t.map(t=>{const o=c.find(e=>e.key===t.key),s='half'===o.unit&&l(n)&&'description'!==e?.5:t.qty;return{key:t.key,qty:a(o,s)}})});if(o){const e=[];for(const n of c){const a=new RegExp(`\\b(${s(n)})\\b`,'i'),l=o.ingredients.find(e=>a.test(e.name)&&!t.test((e.unit||'').trim())&&!/\b(meat|stock|bisque|oil|butter|paste)\b/i.test(e.name));l&&e.push({key:n.key,qty:i(`${l.qty} ${l.unit}`)})}if(e.length)return f('card',e)}const h=n.description??'';{const t=[];for(const n of c){const o=new RegExp(`\\b(half an?|a|an|one|two|three|four|five|six|\\d+(?:\\.\\d+)?|\xbd)\\s+(?:(?:whole|fresh|live|dressed|local)\\s+)?(?:[A-Za-z'\u2019-]+\\s+){0,2}?(${s(n)})\\b(?!\\s+(?:${e}))`,'i'),a=h.match(o);a&&t.push({key:n.key,qty:i(a[1])})}if(t.length)return f('description',t)}{const e=n.name.replace(/\([^)]*\)/g,'').trim(),t=[];for(const n of c)new RegExp(`\\b(${s(n)})$`,'i').test(e)&&t.push({key:n.key,qty:1});if(t.length)return f('name',t)}return{uses:[],source:'none'}}function c(e,t){return e.filter(e=>(t[e.key]??0)(n.find(t=>t.key===e)?.name??e).toLowerCase(),s=e.filter(e=>(t[e.key]??0)<=0).map(e=>o(e.key)),i=e.filter(e=>(t[e.key]??0)>0).map(e=>o(e.key)),a=e=>e.length<=2?e.join(' or '):`${e.slice(0,-1).join(', ')} or ${e[e.length-1]}`;return[s.length?`no ${a(s)}`:'',i.length?`not enough ${a(i)}`:''].filter(Boolean).join(', ')}const h=(e,t)=>t?`${e.replace(/\s*\([^)]*\)\s*$/,'').trim()||e} (${t})`:e},943,[]); +__d(function(g,r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEFAULT_SOLD_OUT",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"SOLD_OUT_CLEAR_LABEL",{enumerable:!0,get:function(){return t}}),_e.soldOutSettingsOf=function(t){const n='morning'===t?.clear||'manual'===t?.clear||'close'===t?.clear?t.clear:e.clear,o=/^([01]\d|2[0-3]):[0-5]\d$/.test(t?.morningAt??'')?t.morningAt:e.morningAt;return{clear:n,morningAt:o,auto:!1!==t?.auto}},_e.clearAfterFor=function(e,t,o){if('manual'===t.clear)return;const c=(()=>{const o=n(e,t.morningAt);return ee.getTime()?o:c},_e.activeSoldOut=function(e,t,n){const o=n.getTime();return e.filter(e=>e.rid===t&&e.on&&(!e.clearAfter||new Date(e.clearAfter).getTime()>o)).sort((e,t)=>t.at.localeCompare(e.at)||e.name.localeCompare(t.name))},_e.expiredSoldOut=function(e,t,n){const o=n.getTime();return e.filter(e=>e.rid===t&&e.on&&!!e.clearAfter&&new Date(e.clearAfter).getTime()<=o)},_e.stripText=o,_e.stripNeedsTicker=function(e,t,n){return o(e).length*n*.56>Math.max(0,t-150)},_e.soldOutCount=function(e){return 1===e?'1 dish sold out':`${e} dishes sold out`};const e={clear:'close',morningAt:'05:00',auto:!0},t={close:'When the kitchen closes',morning:'Next morning',manual:'Only when someone taps Back on'};const n=(e,t,n=0)=>{const[o,c]=t.split(':').map(Number);return new Date(e.getFullYear(),e.getMonth(),e.getDate()+n,o,c,0,0)};function o(e){return e.join(' \xb7 ')}},944,[]); +__d(function(_g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"SHAPES",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"shapeLabel",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"tableLabel",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"tableNumber",{enumerable:!0,get:function(){return u}}),_e.numberClashes=function(e){const t=new Map;for(const n of e){const e=u(n);t.set(e,[...t.get(e)??[],{name:n.name,areaId:n.areaId}])}const n=new Set,r=[];for(const[e,a]of t){if(a.length<2)continue;const t=new Map;a.forEach(e=>t.set(e.areaId,[...t.get(e.areaId)??[],e.name]));for(const e of t.values())e.length>1&&e.forEach(e=>n.add(e));t.size>1&&r.push(e)}return{sameArea:n,acrossAreas:r}},Object.defineProperty(_e,"liveTableLabel",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"FIXTURES",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"PLAN_W",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"PLAN_H",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"GRID",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"snap",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"clamp",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"fid",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"slug",{enumerable:!0,get:function(){return w}}),_e.sizeFor=y,Object.defineProperty(_e,"minFor",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"numOf",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"byNumber",{enumerable:!0,get:function(){return P}}),_e.newTable=j,_e.autoArrange=M,_e.placeNew=S,_e.rotate90=function(e){const t=e.x+e.w/2,n=e.y+e.h/2;return{...e,w:e.h,h:e.w,x:h(f(t-e.h/2),0,c-e.h),y:h(f(n-e.w/2),0,b-e.w)}},_e.normalisePlan=function(e){return{...e,fixtures:e.fixtures??[],tables:e.tables.map(e=>{const t=e.shape;let n='booth'===t||'rect'===t?'rect':'round'===t?'round':'square',{w:r,h:a}=e;if('square'===n||'round'===n){const e=Math.max(r,a);r=e,a=e}if(90===e.rot||270===e.rot){const e=r;r=a,a=e}return'rect'===n&&r===a&&(n='square'),{...e,shape:n,w:r,h:a,rot:0}})}},Object.defineProperty(_e,"SECTION_COLOURS",{enumerable:!0,get:function(){return I}}),_e.buildPlan=k,_e.anchoragePlan=$,_e.starterPlan=function(){return k({areas:[{name:'Main room',tables:[[1,2],[2,4],[3,6],[4,4],[5,2],[6,6]],fixtures:[A(450,600)]}]},['SV'])},Object.defineProperty(_e,"TEMPLATES",{enumerable:!0,get:function(){return v}}),_e.parseTableList=function(e){const t=[],n=[];let r;for(const a of e.split(/\r?\n/)){const e=a.trim();if(!e)continue;if(!/\d/.test(e)){r=e.replace(/[:\-\u2013]+$/,'').trim()||r;continue}const o=e.match(/^(?:table|tbl|tab|t)?\s*(?:no\.?|number|#)?\s*([a-z]?\d+[a-z]?)\b[^\d]*?(\d+)/i);if(!o){n.push(e);continue}const s=parseInt(o[2],10);!s||s>30?n.push(e):t.push({area:r,name:o[1].toUpperCase(),seats:s})}return{items:t,skipped:n}},Object.defineProperty(_e,"planCounts",{enumerable:!0,get:function(){return C}}),Object.defineProperty(_e,"tableDogOk",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e,"dogTables",{enumerable:!0,get:function(){return L}}),Object.defineProperty(_e,"areaOfTable",{enumerable:!0,get:function(){return q}}),_e.bestTables=E,Object.defineProperty(_e,"isBestTable",{enumerable:!0,get:function(){return _}}),_e.withSeedBest=function(e,t){if('anchorage'!==e||!t?.areas?.some(e=>void 0===e.best))return t;const n=$();return{...t,areas:t.areas.map(e=>{if(void 0!==e.best)return e;const r=n.areas.find(t=>t.id===e.id||t.name===e.name),a=(r?.best??[]).filter(n=>t.tables.some(t=>t.name===n&&t.areaId===e.id));return a.length?{...e,best:a}:e})}};var e,t=_r(d[0]),n=_r(d[1]),r=(e=n)&&e.__esModule?e:{default:e};const a=[{id:'square',label:'Square'},{id:'rect',label:'Rectangle'},{id:'round',label:'Round'}],o=e=>'rect'===e?'Rectangle':'round'===e?'Round':'Square',s=e=>/\d/.test(e.name)?(0,t.plainTableNumber)(e.name):(0,t.plainTableNumber)(e.label?.trim()||e.name),u=s;const l=(e,t)=>u(e),i=[{id:'bar',label:'Bar',w:300,h:50},{id:'wall',label:'Wall',w:250,h:25},{id:'door',label:'Door',w:100,h:25},{id:'window',label:'Window',w:200,h:25}],c=1e3,b=625,m=25,f=e=>Math.round(e/m)*m,h=(e,t,n)=>Math.max(t,Math.min(n,e));let p=0;const g=e=>`${e}-${Date.now().toString(36)}${(p++).toString(36)}`,w=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,'-').replace(/^-|-$/g,'')||'area';function y(e){return e<=2?{shape:'square',w:75,h:75}:e<=4?{shape:'square',w:100,h:100}:e<=6?{shape:'rect',w:150,h:100}:e<=8?{shape:'rect',w:200,h:100}:e<=10?{shape:'rect',w:250,h:100}:{shape:'rect',w:300,h:100}}const x=e=>e<=2?1:Math.max(2,Math.ceil(e/2)),O=e=>{const t=e.match(/\d+/);return t?parseInt(t[0],10):9999},P=(e,t)=>O(e.name)-O(t.name)||e.name.localeCompare(t.name);function j(e,t,n,r){const a=y(n);return{id:`t-${e}-${g('x').slice(2)}`,name:e,areaId:t,shape:a.shape,minSeats:x(n),maxSeats:n,x:0,y:0,w:a.w,h:a.h,rot:0,online:!0,sectionId:r}}function M(e,t=125,n=75){const r=[...e].sort(P);if(!r.length)return r;let a=75;const o=e=>{const t=[];let n=[],a=0;for(const o of r){const r=(n.length?e:0)+o.w;n.length&&a+r>850&&(t.push(n),n=[],a=0),n.push(o),a+=(n.length>1?e:0)+o.w}return n.length&&t.push(n),t};let s=o(a);const u=(e,t)=>e.reduce((e,t)=>e+Math.max(...t.map(e=>e.h)),0)+t*(e.length-1);for(;u(s,a)>b-t-n&&a>25;)a-=25,s=o(a);const l=u(s,a),i=b-t-n,p=s.length>1?Math.min(150,a+Math.max(0,Math.floor((i-l)/(s.length-1)/m)*m)):0,g=s.reduce((e,t)=>e+Math.max(...t.map(e=>e.h)),0)+p*(s.length-1);let w=f(t+Math.max(0,(i-g)/2));const y=[];for(const e of s){const t=Math.max(...e.map(e=>e.h)),n=e.reduce((e,t)=>e+t.w,0)+a*(e.length-1);let r=f((c-n)/2);for(const n of e)y.push({...n,x:h(r,0,c-n.w),y:h(f(w+(t-n.h)/2),0,b-n.h),rot:0}),r+=n.w+a;w+=t+p}return y}function S(e,t,n=[]){const r=[...e,...n].map(e=>({x:e.x,y:e.y,w:e.w,h:e.h})),a=[];for(const e of t){let t=null;for(let n=50;n<=b-e.h-25&&!t;n+=m)for(let a=50;a<=c-e.w-25&&!t;a+=m){const o=50;r.some(t=>at.x&&nt.y)||(t={x:a,y:n})}const n=t??{x:50,y:50},o={...e,x:n.x,y:n.y};r.push({x:o.x,y:o.y,w:o.w,h:o.h}),a.push(o)}return a}const I=['#CFA45F','#E2C489','#A88B5A','#8C6A3A','#FFB547','#D9B98A'];function k(e,t=[]){const n=[],r=[],a=[],o=[];e.areas.forEach((e,s)=>{const u=w(e.name),l=e.best?e.best.map(String).filter(t=>e.tables.some(([e])=>String(e)===t)):void 0;n.push({id:u,name:e.name,dogs:!!e.dogs,outdoor:!!e.outdoor,...e.label?{label:e.label}:{},...e.colour?{colour:e.colour}:{},...l?{best:l}:{}});const i=`s-${u}`;o.push({id:i,name:e.name,colour:e.colour??I[s%I.length],server:t[s]??''});const m=(e.fixtures??[]).map((e,t)=>({...e,id:`fx-${u}-${t}`,areaId:u}));a.push(...m);const f=m.some(e=>e.y<100&&('bar'===e.kind||e.w>=300))?150:100,p=e.tables.map(([e,t])=>({...j(String(e),u,t,i),id:`t-${e}`})),g=e.layout??{},y=p.filter(e=>g[e.name]).map(e=>{const t=g[e.name],n=t.shape??(t.w===t.h?'square':'rect'),r=h(Math.round(t.w),50,c),a=h(Math.round('rect'===n?t.h:t.w),50,b);return{...e,shape:n,w:r,h:a,x:h(Math.round(t.x),0,c-r),y:h(Math.round(t.y),0,b-a),...t.label?{label:t.label}:{}}}),x=p.filter(e=>!g[e.name]);y.length?r.push(...y,...S(y,x,m)):r.push(...M(p,f,75))});const s=new Set(r.map(e=>e.name)),u=(e.joins??[]).filter(e=>e.every(e=>s.has(e))).map(e=>({id:`j-${e.join('-')}`,tables:e}));return{areas:n,tables:r,joins:u,sections:o,fixtures:a}}const T=(e,t,n=0,r=25)=>({kind:'window',x:e,y:n,w:t,h:r}),A=(e,t,n=100,r=25)=>({kind:'door',x:e,y:t,w:n,h:r});function $(){const e=r.default;return k({areas:e.areas.map(e=>({name:e.name,dogs:!!e.dogFriendly,outdoor:!(!e.outdoor&&!e.weatherDependent),label:e.label,colour:e.colour,tables:e.tables.map(([e,t])=>[e,t]),layout:e.layout,fixtures:[],best:e.best?.map(String)})),joins:e.joins??[]},e.areas.map(e=>e.server??''))}const v=[{id:'anchorage',name:'The Anchorage',sub:'4 areas \xb7 29 tables \xb7 119 seats',make:$},{id:'cafe',name:'Small caf\xe9',sub:'1 room \xb7 8 tables \xb7 dogs welcome',make:()=>k({areas:[{name:'Caf\xe9',dogs:!0,tables:[[1,2],[2,2],[3,4],[4,4],[5,2],[6,4],[7,2],[8,6]],fixtures:[{kind:'bar',x:300,y:25,w:400,h:50},A(450,600)]}]})},{id:'pub',name:'Pub with garden',sub:'Bar, lounge and beer garden',make:()=>k({areas:[{name:'Bar',dogs:!0,tables:[[1,2],[2,4],[3,4],[4,2],[5,4],[6,6]],fixtures:[{kind:'bar',x:250,y:25,w:500,h:75}]},{name:'Lounge',tables:[[7,4],[8,4],[9,2],[10,6],[11,4],[12,2],[13,4],[14,8]],fixtures:[T(150,700)]},{name:'Beer garden',dogs:!0,outdoor:!0,tables:[[20,6],[21,6],[22,4],[23,4],[24,6],[25,6]]}]})},{id:'restaurant',name:'Restaurant and terrace',sub:'Dining room with an outdoor terrace',make:()=>k({areas:[{name:'Dining room',tables:[[1,2],[2,2],[3,4],[4,4],[5,4],[6,6],[7,2],[8,2],[9,4],[10,4],[11,6],[12,8]],fixtures:[T(100,800),A(450,600)]},{name:'Terrace',outdoor:!0,tables:[[20,2],[21,4],[22,4],[23,2]]}]})},{id:'blank',name:'Blank',sub:'One empty room to start from',make:()=>k({areas:[{name:'Main room',tables:[]}]})}];const C=(e,t)=>{const n=t?e.tables.filter(e=>e.areaId===t):e.tables;return{tables:n.length,seats:n.reduce((e,t)=>e+t.maxSeats,0)}},B=(e,t)=>void 0!==t.dogOk?t.dogOk:!!e.areas.find(e=>e.id===t.areaId)?.dogs,L=e=>new Set(e.tables.filter(t=>B(e,t)).map(e=>e.name)),q=(e,t)=>e.areas.find(n=>n.id===e.tables.find(e=>e.name===t)?.areaId);function E(e,t){return e.areas.filter(e=>!t||e.id===t).flatMap(t=>(t.best??[]).filter(n=>e.tables.some(e=>e.name===n&&e.areaId===t.id)))}const _=(e,t)=>E(e).includes(t)},945,[808,17]); +__d(function(g,r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DEFAULT_WAKE_PIN",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"DEFAULT_WAKE_SALT",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"hashWakePin",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"DEFAULT_WAKE",{enumerable:!0,get:function(){return o}}),e.newSalt=u,e.wakePinProblem=function(n){return/^\d{6,8}$/.test(n)?/^(\d)\1+$/.test(n)||'0123456789012'.includes(n)||'9876543210987'.includes(n)?'Pick a PIN that is harder to guess (not all the same digit or a run like 123456).':n===t?'Pick a new PIN, not the starting one.':null:'The wake PIN must be 6 to 8 digits.'},e.makeWakePin=function(n,t=u()){return{pinHash:a(n,t),pinSalt:t,pinLen:n.length,pinDefault:!1}},Object.defineProperty(e,"wakePinMatches",{enumerable:!0,get:function(){return l}}),e.fromOldPin=function(n){const i='string'==typeof n&&/^\d{4,8}$/.test(n)?n:t;if(i===t)return{...o};const l=u();return{pinHash:a(i,l),pinSalt:l,pinLen:i.length,pinDefault:!1}};var n=r(d[0]);const t='2580',i='cc-wake-default',a=(t,i)=>(0,n.sha256HexSync)(`cc-wake:${i}:${t}`),o={pinHash:a(t,i),pinSalt:i,pinLen:4,pinDefault:!0};function u(){const n=globalThis.crypto,t=new Uint8Array(12);if(n?.getRandomValues)n.getRandomValues(t);else for(let n=0;nn.toString(16).padStart(2,'0')).join('')}const l=(n,t)=>a(t,n.pinSalt)===n.pinHash},946,[1120]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useSliders",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"notify",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"dismissNotice",{enumerable:!0,get:function(){return c}});var t=r(d[0]);let u=0;const s=t=>'urgent'===t.tone?0:'warn'===t.tone?1:2,n=(0,t.create)()((t,n)=>({queue:[],push:n=>t(t=>{const o=t.queue.find(t=>t.id===n.id),c=o?t.queue.map(t=>t.id===n.id?{...n,seq:o.seq}:t):[...t.queue,{...n,seq:++u}];return{queue:(f=c,[...f].sort((t,u)=>s(t)-s(u)||(t.seq??0)-(u.seq??0))).slice(0,40)};var f}),dismiss:u=>{const s=n().queue.find(t=>t.id===u);if(s){t(t=>({queue:t.queue.filter(t=>t.id!==u)}));try{s.onClose?.()}catch{}}},dismissWhere:t=>{for(const u of n().queue.filter(t))n().dismiss(u.id)}})),o=t=>n.getState().push(t),c=t=>n.getState().dismiss(t)},947,[952]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return n.default}});var e=r(d[0]);Object.keys(e).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(_e,t)||Object.defineProperty(_e,t,{enumerable:!0,get:function(){return e[t]}})});var t,n=(t=e)&&t.__esModule?t:{default:t}},948,[1290]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"canCancelWalkIn",{enumerable:!0,get:function(){return w}}),_e.cancelWalkInWords=y,_e.cancelWalkInNow=$,_e.CancelWalkInButton=function({rid:e,b:l,onDone:t,small:s}){const[c,o]=(0,n.useState)(!1);return w(l)?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(u.Button,{kind:"secondary",small:s,label:"Cancel walk-in",testID:`cancel-walkin-${l.id}`,accessibilityLabel:`Cancel walk-in ${l.ref}, ${l.partySize} Covers`,onPress:()=>o(!0),style:s?{minHeight:44}:k}),c?(0,f.jsx)(h,{rid:e,b:l,onClose:()=>o(!1),onDone:t}):null]}):null},_e.CancelWalkInConfirm=h;var e,n=r(d[0]),l=r(d[1]),t=(e=l)&&e.__esModule?e:{default:e},s=r(d[2]),c=r(d[3]),o=r(d[4]),b=r(d[5]),u=r(d[6]),f=r(d[7]);const k={minHeight:56},w=e=>!!e.walkIn&&('seated'===e.status||'confirmed'===e.status);function y(e){const n=(0,c.tablesOf)(e.table),l=(0,o.tablesWords)(n);return`Cancel walk-in ${e.ref}, ${e.partySize} Covers${n.length?` at ${l}`:''}, arrived ${e.time}? It comes off the Covers${n.length?` and ${l} ${n.length>1?'go':'goes'} back to Free`:''}.`}async function $(e,n){await s.repo.bookings.setStatus(n.id,'cancelled'),(0,c.tablesOf)(n.table).forEach(n=>c.useFloor.getState().setLive(e,n,{stage:void 0,dirty:!1}))}function h({rid:e,b:n,onClose:l,onDone:s}){const w=y(n);return(0,f.jsxs)(u.Sheet,{visible:!0,onClose:l,title:"Cancel walk-in?",maxWidth:560,testID:"cancel-walkin-confirm",children:[(0,f.jsx)(t.default,{accessible:!0,accessibilityLabel:w,children:(0,f.jsx)(u.T,{size:18,colour:b.colours.text,children:w})}),(0,f.jsxs)(u.Row,{gap:8,wrap:!0,children:[(0,f.jsx)(u.Button,{label:"Yes, cancel walk-in",testID:"cancel-walkin-yes",accessibilityLabel:`Yes, cancel walk-in ${n.ref}`,style:[k,{flexGrow:1}],onPress:async()=>{await $(e,n),l(),s?.(`Walk-in ${n.ref} cancelled.${(0,c.tablesOf)(n.table).length?` ${(0,o.tablesWords)((0,c.tablesOf)(n.table))} free.`:''}`)}}),(0,f.jsx)(u.Button,{kind:"secondary",label:"Keep walk-in",testID:"cancel-walkin-no",accessibilityLabel:`Keep walk-in ${n.ref}`,onPress:l,style:k})]})]})}},949,[30,127,819,825,931,821,813,24]); +__d(function(g,_r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AllergenBar=p,_e.NeedsPills=k,_e.BookingNeeds=x,Object.defineProperty(_e,"needsIcons",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"confirmHolds",{enumerable:!0,get:function(){return S}}),_e.serveHolds=y,_e.postNewBookingToKitchen=function(e,t){if(!t||'system'===t)return;const s=o.useStore.getState().restaurants.find(t=>t.id===e.restaurantId),l=[],r=`${e.name}, ${(0,c.niceDate)((0,c.parseYmd)(e.date)).slice(0,3)} ${e.time}${e.table?`, table ${e.table}`:''}`;if((e.holds??[]).filter(e=>e.qty>0).length){const t=I(e.restaurantId);l.push(`${(0,u.holdsText)(e,(0,u.reservablesOf)(s),t)} reserved: ${r}. Tap Platter OK in the Head Chef app.`)}(0,u.hasAllergens)(e)&&l.push(`\u26a0\ufe0f Allergens: ${(0,u.allergenText)(e)} \u2014 ${r}. Please sign \u2018Allergens seen\u2019.`);if(!l.length)return;a.useOwner.getState().chatSend({ch:'kitchen',from:t,text:l.join('\n'),at:(new Date).toISOString()})},_e.useKitchenTodo=D,_e.KitchenSignoffs=function({rid:t,today:s,by:a,app:f,canConfirm:p=!0,showAll:k}){const j=D(t,s),I=(0,o.useBookings)(t),T=(0,o.useRestaurant)(t),O=(0,n.useStockItems)(t),$=(0,u.reservablesOf)(T),A=I.filter(e=>e.date===s&&!['cancelled','noshow'].includes(e.status)&&(e.holds??[]).some(e=>e.qty>0)),v=k?[...j,...A.filter(e=>!j.includes(e))]:j;return v.length?(0,b.jsxs)(l.default,{testID:"kitchen-signoffs",style:{gap:10,padding:16,borderRadius:16,borderWidth:1.5,borderColor:j.length?h.colours.amber:h.colours.hairline,backgroundColor:h.colours.surface},children:[(0,b.jsx)(r.T,{size:12,weight:"semibold",colour:j.length?h.colours.amber:h.colours.goldMuted,style:{letterSpacing:1.6},children:j.length?`KITCHEN SIGN-OFF NEEDED (${j.length})`:'RESERVED TODAY'}),v.map(t=>(0,b.jsxs)(l.default,{style:{gap:6,paddingTop:8,borderTopWidth:1,borderColor:h.colours.hairline},testID:`signoff-${t.ref}`,children:[(0,b.jsxs)(r.T,{weight:"semibold",children:[t.name," \xb7 ",t.partySize," covers \xb7 ",t.date===s?'Today':(0,c.niceDate)((0,c.parseYmd)(t.date))," ",t.time,t.table?` \xb7 ${(0,e.tableNumbers)(t.table)}`:'']}),(0,b.jsx)(x,{b:t}),p?(0,b.jsxs)(r.Row,{wrap:!0,gap:8,children:[(0,u.needsAllergenSeen)(t)?(0,b.jsx)(r.Button,{small:!0,kind:"danger",label:"Allergens seen",testID:`allergens-seen-${t.ref}`,onPress:()=>o.useStore.getState().ackBookingAllergy(t.id,a)}):null,(0,u.needsHoldOk)(t)?(0,b.jsx)(r.Button,{small:!0,kind:"success",label:/platter/i.test((0,u.holdsText)(t,$,O))?'Platter OK':'Reservation OK',testID:`platter-ok-${t.ref}`,onPress:()=>S(t.id,a)}):null,t.date===s&&t.holdOk&&(t.holds??[]).some(e=>!e.served)&&['seated','confirmed'].includes(t.status)?(0,b.jsx)(r.Button,{small:!0,kind:"secondary",label:"Served",testID:`served-${t.ref}`,onPress:()=>y(t,a,f)}):null]}):(0,b.jsx)(r.Muted,{children:"The kitchen signs these off."})]},t.id))]}):null},_e.PlattersBooked=function({rid:e,date:t,label:s}){const a=(0,o.useBookings)(e),c=(0,o.useRestaurant)(e),f=(0,n.useStockItems)(e),p=(0,u.heldSummary)(a,t,(0,u.reservablesOf)(c)),k=Object.entries(p.stock).filter(([,e])=>e>0).map(([e,t])=>`${t} ${(f.find(t=>t.key===e)?.name??e).toLowerCase()}`);return p.platters||k.length?(0,b.jsx)(l.default,{testID:"platters-booked",children:(0,b.jsxs)(r.T,{weight:"semibold",colour:h.colours.goldLight,children:[s??'Platters booked',": ",p.platters,k.length?` (${k.join(', ')})`:'']})}):null};var e=_r(d[0]);_r(d[1]);var t,s=_r(d[2]),l=(t=s)&&t.__esModule?t:{default:t},r=_r(d[3]),o=_r(d[4]),n=_r(d[5]),a=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),b=_r(d[10]);const f=({label:e,bg:t,fg:s,border:o,testID:n})=>(0,b.jsx)(l.default,{testID:n,style:{backgroundColor:t,borderColor:o,borderWidth:1,borderRadius:999,paddingHorizontal:9,paddingVertical:2},children:(0,b.jsx)(r.T,{size:13,weight:"semibold",colour:s,children:e})});function p({b:e,big:t}){return(0,u.hasAllergens)(e)?(0,b.jsxs)(l.default,{testID:`allergen-bar-${e.ref}`,style:{backgroundColor:h.colours.redSolid,borderRadius:10,paddingHorizontal:10,paddingVertical:t?8:5,gap:2},children:[(0,b.jsxs)(r.T,{size:t?16:13,weight:"bold",colour:"#FFFFFF",children:["\u26a0\ufe0f ALLERGENS: ",(0,u.allergenText)(e)]}),e.allergyAck?(0,b.jsxs)(r.T,{size:12,colour:"#FFE3DF",children:["Seen by kitchen: ",e.allergyAck.by]}):(0,b.jsx)(r.T,{size:12,colour:"#FFE3DF",children:"Kitchen hasn\u2019t signed \u2018Allergens seen\u2019 yet"})]}):null}function k({b:t,r:s}){const l=(0,n.useStockItems)(t.restaurantId),o=(0,u.reservablesOf)(s),a=(t.holds??[]).some(e=>e.qty>0),c=[];return t.drinksOnly&&c.push((0,b.jsx)(f,{testID:"pill-drinks",label:"\ud83c\udf77 Drinks only (after last food orders)",bg:h.colours.surface2,fg:h.colours.goldLight,border:h.colours.accentBorder},"x")),(0,u.hasAccess)(t)&&c.push((0,b.jsx)(f,{testID:"pill-access",label:`\u267f ${(0,u.accessText)(t)}`,bg:h.colours.blueBg,fg:"#E2C489",border:h.colours.blue},"a")),(0,u.dogCount)(t)&&c.push((0,b.jsx)(f,{testID:"pill-dog",label:"\ud83d\udc15 "+((0,u.dogCount)(t)>1?`${(0,u.dogCount)(t)} dogs`:'Dog'),bg:h.colours.surface2,fg:h.colours.text,border:h.colours.hairline},"d")),(0,u.dietText)(t)&&c.push((0,b.jsx)(f,{testID:"pill-veg",label:`\u24cb ${(0,u.dietText)(t)}`,bg:"#2A2216",fg:"#E2C489",border:"#CFA45F"},"v")),a&&c.push(t.holdOk?(0,b.jsx)(f,{testID:"pill-platter",label:`\u2713 ${(0,u.holdsText)(t,o,l)} \xb7 confirmed`,bg:h.colours.okBg,fg:"#E2C489",border:h.colours.ok},"h"):(0,b.jsx)(f,{testID:"pill-platter",label:`\ud83e\udd9e ${(0,u.holdsText)(t,o,l)} \xb7 awaiting kitchen`,bg:h.colours.amberBg,fg:"#FFE2A8",border:h.colours.amber},"h")),t.tableReq?.length&&c.push((0,b.jsx)(f,{testID:"pill-request",label:`Requested: ${t.tableReq.map(t=>`${(0,e.tableNumbers)(t)}`).join(' or ')}`,bg:h.colours.goldTint,fg:h.colours.goldLight,border:h.colours.accentBorder},"t")),c.length?(0,b.jsx)(r.Row,{wrap:!0,gap:6,children:c}):null}function x({b:e,big:t}){const s=(0,o.useRestaurant)(e.restaurantId);return(0,b.jsxs)(l.default,{style:{gap:6},children:[(0,b.jsx)(p,{b:e,big:t}),(0,b.jsx)(k,{b:e,r:s})]})}const j=e=>[(0,u.hasAllergens)(e)?'\u26a0\ufe0f':'',(0,u.hasAccess)(e)?'\u267f':'',(0,u.dogCount)(e)?'\ud83d\udc15':'',(0,u.dietText)(e)?'\u24cb':'',(e.holds??[]).some(e=>e.qty>0)?e.holdOk?'\ud83e\udd9e\u2713':'\ud83e\udd9e':''].filter(Boolean).join(' '),S=(e,t)=>o.useStore.getState().updateBooking(e,{holdOk:{by:t,at:(new Date).toISOString()}});function y(e,t,s){const l=o.useStore.getState().restaurants.find(t=>t.id===e.restaurantId),r=(0,u.stockNeed)(e,(0,u.reservablesOf)(l));for(const[l,o]of Object.entries(r))o>0&&n.shellfish.append({rid:e.restaurantId,kind:l,delta:-o,reason:'sold',by:t,app:s});const a=(new Date).toISOString();o.useStore.getState().updateBooking(e.id,{holds:(e.holds??[]).map(e=>e.served?e:{...e,served:{by:t,at:a}})})}const I=e=>n.useShellStore.getState().items[e]??[];function D(e,t){return(0,o.useBookings)(e).filter(e=>e.date>=t&&!e.walkIn&&((0,u.needsAllergenSeen)(e)||(0,u.needsHoldOk)(e))).sort((e,t)=>(e.date+e.time).localeCompare(t.date+t.time))}},950,[808,30,127,813,819,1027,856,828,818,821,24]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.DepositChip=function({b:e,money:o,big:n,testID:b}){const f=(0,s.depositView)(e,o);if(!f)return null;const h={gold:[t.colours.goldTint,t.colours.goldLight,t.colours.gold],amber:[t.colours.amberBg,'#FFE2A8',t.colours.amber],red:[t.colours.redBg,'#FFD9D4',t.colours.red],neutral:[t.colours.surface2,t.colours.muted,t.colours.border]}[f.kind];return(0,u.jsxs)(l.default,{accessible:!0,accessibilityRole:"text",accessibilityLabel:f.a11y,testID:b??'deposit-chip',style:{alignSelf:'flex-start',maxWidth:'100%'},children:[(0,u.jsx)(l.default,{style:{backgroundColor:h[0],borderColor:h[2],borderWidth:n?2:1,borderRadius:8,paddingHorizontal:n?12:8,paddingVertical:n?6:3},children:(0,u.jsx)(c.T,{size:16,weight:"semibold",colour:h[1],children:f.label})}),f.note?(0,u.jsx)(c.Muted,{size:12,children:f.note}):null]})},r(d[0]);var e,o=r(d[1]),l=(e=o)&&e.__esModule?e:{default:e},s=r(d[2]),t=r(d[3]),c=r(d[4]),u=r(d[5])},951,[30,127,13,821,813,24]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0});var t=r(d[0]);Object.keys(t).forEach(function(n){'default'===n||Object.prototype.hasOwnProperty.call(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[n]}})});var n=r(d[1]);Object.keys(n).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})})},952,[1089,1090]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";function i(i){return i&&i.__esModule?i:{default:i}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEFAULT_AVATARS",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"AVATAR_BGS",{enumerable:!0,get:function(){return F}}),Object.defineProperty(_e,"AVATAR_RINGS",{enumerable:!0,get:function(){return u}}),_e.specFor=E,_e.AvatarArt=$,_e.useStaffMember=v,_e.StaffAvatar=function({id:i,name:t,size:s=34,ring:c=!0}){const f=v(i,t),y=f?.id??i,F=(0,n.useAvatars)(i=>y?i.photos[y]:void 0),u=(0,o.useSetup)(i=>y?i.looks[y]:void 0),j=`${(f?.name??t??'Team member').replace(' (example)','')}'s avatar`;return(0,h.jsx)(r.default,{testID:y?`avatar-${y}`:'avatar',accessibilityLabel:j,accessibilityRole:"image",style:{width:s,height:s,borderRadius:s/2,overflow:'hidden',borderWidth:c?Math.max(1,s/22):0,borderColor:x.colours.gold,backgroundColor:(0,l.soutersSurface)('#111')},children:F?(0,h.jsx)(e.default,{source:{uri:F.dataUrl},style:{width:'100%',height:'100%'},accessibilityIgnoresInvertColors:!0}):(0,h.jsx)($,{spec:null!=u?E(`${y}#look${u}`):E(y,f?.name??t),size:s-(c?2*Math.max(1,s/22):0)})})};var l=_r(d[0]);_r(d[1]);var e=i(_r(d[2])),r=i(_r(d[3])),t=_r(d[4]),s=i(t),c=_r(d[5]),n=_r(d[6]),o=_r(d[7]),x=_r(d[8]),f=_r(d[9]),h=_r(d[10]);const y=Object.fromEntries(f.ROSTER.map(i=>[i.id,i.avatar])),F=['#2A2520','#B89A72','#D9A441','#4A3F35','#3A3029','#8A6A3B'],u=['#E9B949','#CFA45F'],j=F,C=['#F1C7A5','#E8B48F','#C68B5E','#8D5B3E','#F4D2B8','#A86B45'],p=['#2B1B12','#7A4E2A','#151515','#C2462E','#D9B26A'],A=['quiff','flip','crop','beehive','bob','curls'],b=i=>{let l=7;for(const e of i)l=31*l+e.charCodeAt(0)>>>0;return l};function E(i,l){if(i&&y[i])return y[i];const e=b(i||l||'crew');return{bg:j[e%6],ring:u[e%2],skin:C[(e>>3)%6],hair:p[(e>>6)%5],hairStyle:A[(e>>9)%6],suit:'#F2EAD8',antenna:['ball','star','none'][(e>>12)%3]}}const k=(i,l,e)=>`M${i} ${l-e} Q${i+.18*e} ${l-.18*e} ${i+e} ${l} Q${i+.18*e} ${l+.18*e} ${i} ${l+e} Q${i-.18*e} ${l+.18*e} ${i-e} ${l} Q${i-.18*e} ${l-.18*e} ${i} ${l-e}Z`;function $({spec:i,size:l=40}){const e=i,r='#1B1B1B',c='flip'===e.hairStyle?(0,h.jsx)(t.Path,{d:"M29 50 C26 30 40 22 50 22 C60 22 74 30 71 50 C75 56 79 60 76 65 C72 60 69 58 66 57 L34 57 C31 58 28 60 24 65 C21 60 25 56 29 50Z",fill:e.hair}):'bob'===e.hairStyle?(0,h.jsx)(t.Path,{d:"M30 58 C27 32 40 24 50 24 C60 24 73 32 70 58 L66 60 L34 60Z",fill:e.hair}):'beehive'===e.hairStyle?(0,h.jsxs)(t.G,{children:[(0,h.jsx)(t.Ellipse,{cx:50,cy:25,rx:15,ry:14,fill:e.hair}),(0,h.jsx)(t.Path,{d:"M31 54 C28 34 40 27 50 27 C60 27 72 34 69 54 Z",fill:e.hair})]}):'curls'===e.hairStyle?(0,h.jsx)(t.G,{children:[[34,34],[40,27],[50,24],[60,27],[66,34],[69,43],[31,43]].map(([i,l],r)=>(0,h.jsx)(t.Circle,{cx:i,cy:l,r:7,fill:e.hair},r))}):null,n='quiff'===e.hairStyle?(0,h.jsxs)(t.G,{children:[(0,h.jsx)(t.Path,{d:"M32 42 C31 27 43 23 51 25 C61 22 70 30 68 42 C63 35 57 33 50 34 C43 34 37 37 32 42Z",fill:e.hair}),(0,h.jsx)(t.Path,{d:"M46 26 C51 14 66 14 66 23 C61 20 54 21 50 28Z",fill:e.hair})]}):'crop'===e.hairStyle?(0,h.jsx)(t.Path,{d:"M32 42 C31 28 42 25 50 25 C58 25 69 28 68 42 C64 36 58 33 50 33 C42 33 36 36 32 42Z",fill:e.hair}):'curls'===e.hairStyle?null:(0,h.jsx)(t.Path,{d:"M32 43 C33 30 42 27 50 27 C58 27 67 30 68 43 C61 38 57 33 51 33 C47 37 39 41 32 43Z",fill:e.hair});return(0,h.jsxs)(s.default,{width:l,height:l,viewBox:"0 0 100 100",children:[(0,h.jsx)(t.Circle,{cx:50,cy:50,r:50,fill:e.bg}),(0,h.jsx)(t.Ellipse,{cx:50,cy:50,rx:46,ry:13,fill:"none",stroke:"#FFF4E0",strokeOpacity:.28,strokeWidth:1.6,transform:"rotate(-28 50 50)"}),(0,h.jsx)(t.Path,{d:k(16,24,6),fill:"#FFF4E0",fillOpacity:.85}),(0,h.jsx)(t.Path,{d:k(84,34,4),fill:"#FFF4E0",fillOpacity:.7}),(0,h.jsx)(t.Circle,{cx:80,cy:16,r:1.6,fill:"#FFF4E0",fillOpacity:.8}),(0,h.jsx)(t.Circle,{cx:22,cy:70,r:1.3,fill:"#FFF4E0",fillOpacity:.6}),(0,h.jsx)(t.Path,{d:"M12 100 C14 82 31 74 50 74 C69 74 86 82 88 100 Z",fill:e.suit}),(0,h.jsx)(t.Path,{d:"M36 100 L40 84 L50 90 L60 84 L64 100Z",fill:e.ring,fillOpacity:.35}),(0,h.jsx)(t.Rect,{x:44,y:60,width:12,height:12,fill:e.skin}),c,(0,h.jsx)(t.Ellipse,{cx:50,cy:46,rx:17,ry:18.5,fill:e.skin}),n,e.specs?(0,h.jsxs)(t.G,{stroke:r,strokeWidth:1.6,fill:"#FFFFFF",fillOpacity:.25,children:[(0,h.jsx)(t.Rect,{x:37,y:42,width:11,height:8,rx:4}),(0,h.jsx)(t.Rect,{x:52,y:42,width:11,height:8,rx:4}),(0,h.jsx)(t.Line,{x1:48,y1:45,x2:52,y2:45})]}):null,(0,h.jsx)(t.Ellipse,{cx:42.5,cy:46.5,rx:2.1,ry:2.7,fill:r}),(0,h.jsx)(t.Ellipse,{cx:57.5,cy:46.5,rx:2.1,ry:2.7,fill:r}),(0,h.jsx)(t.Circle,{cx:43.3,cy:45.5,r:.8,fill:"#FFFFFF"}),(0,h.jsx)(t.Circle,{cx:58.3,cy:45.5,r:.8,fill:"#FFFFFF"}),(0,h.jsx)(t.Circle,{cx:38,cy:53,r:3,fill:"#F08A7E",fillOpacity:.55}),(0,h.jsx)(t.Circle,{cx:62,cy:53,r:3,fill:"#F08A7E",fillOpacity:.55}),(0,h.jsx)(t.Path,{d:"M44.5 55 Q50 60 55.5 55",stroke:r,strokeWidth:1.8,fill:"none",strokeLinecap:"round"}),(0,h.jsx)(t.Ellipse,{cx:50,cy:74,rx:21,ry:5.5,fill:e.ring}),(0,h.jsx)(t.Ellipse,{cx:50,cy:73,rx:16,ry:3,fill:"#000000",fillOpacity:.18}),(0,h.jsx)(t.Circle,{cx:50,cy:88,r:4,fill:e.ring}),(0,h.jsx)(t.Circle,{cx:50,cy:88,r:1.6,fill:e.bg}),(0,h.jsx)(t.Circle,{cx:50,cy:45,r:29,fill:"#FFF4E0",fillOpacity:.1,stroke:"#FFF4E0",strokeOpacity:.85,strokeWidth:2}),(0,h.jsx)(t.Path,{d:"M29 36 A23 23 0 0 1 41 22",stroke:"#FFFFFF",strokeOpacity:.85,strokeWidth:3.2,fill:"none",strokeLinecap:"round"}),(0,h.jsx)(t.Circle,{cx:28.5,cy:42,r:1.5,fill:"#FFFFFF",fillOpacity:.85}),'none'!==e.antenna?(0,h.jsx)(t.Line,{x1:50,y1:16,x2:50,y2:8,stroke:e.ring,strokeWidth:2}):null,'ball'===e.antenna?(0,h.jsx)(t.Circle,{cx:50,cy:6.5,r:3.3,fill:e.ring}):'star'===e.antenna?(0,h.jsx)(t.Path,{d:k(50,6.5,4.5),fill:e.ring}):null]})}const O=i=>(i??'').replace(' (example)','').trim().toLowerCase();function v(i,l){const e=(0,c.useOwner)(i=>i.staff);return i?e.find(l=>l.id===i):l?e.find(i=>O(i.name)===O(l)):void 0}},953,[868,30,196,127,948,856,1169,1170,821,14,24]); +__d(function(g,_r,i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"MIN_RADIUS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"MAX_RADIUS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"ACCURACY_CAP",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"DEFAULT_BREAK_OPTIONS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"DEFAULT_CLOCK_AREA",{enumerable:!0,get:function(){return r}}),e.distanceM=s,Object.defineProperty(e,"validLat",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"validLng",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"areaSet",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"clampRadius",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"accuracyAllowance",{enumerable:!0,get:function(){return p}}),e.isInside=h,e.cleanArea=function(t){const n=(t.breakOptions??a).map(t=>Math.round(Number(t))).filter(t=>Number.isFinite(t)&&t>0&&t<=180);return{...r,...t,lat:c(t.lat)?t.lat:null,lng:l(t.lng)?t.lng:null,radius:f(t.radius??r.radius),on:!1!==t.on,offRotaPrompt:!1!==t.offRotaPrompt,breakOptions:[...new Set(n)].sort((t,n)=>t-n).slice(0,12),offRotaTitle:(t.offRotaTitle??'').trim().slice(0,80)||r.offRotaTitle,offRotaBody:(t.offRotaBody??'').trim().slice(0,160)||r.offRotaBody}},Object.defineProperty(e,"ACTION_WORD",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"DENIED_TEXT",{enumerable:!0,get:function(){return m}}),e.gate=function(t,n,o,a,r="browser"){if(!t.on||!d(t)){const r={action:n,at:a,inside:null,unchecked:!0};return'object'==typeof o&&Object.assign(r,{lat:y(o.lat),lng:y(o.lng),acc:Math.round(o.acc)}),{allowed:!0,geo:r,warn:t.on?'The clock-in area isn\u2019t set yet, so location isn\u2019t checked.':void 0}}if('object'!=typeof o){const t='app-phone-off'===r?m['app-phone-off']:'denied'===o?m[r]:'timeout'===o?'Your phone couldn\u2019t find your location in time. Step outside or near a window and try again.':'unsupported'===o?'This phone or browser can\u2019t share its location. Ask a manager to record it for you.':'Your phone couldn\u2019t find your location. Check Location is on, then try again.';return{allowed:!1,message:`You need to be at the venue to ${b[n]}. ${t}`,geo:{action:n,at:a,inside:!1}}}const u=h(t,o),s={action:n,at:a,lat:y(o.lat),lng:y(o.lng),acc:Math.round(o.acc),dist:u.dist,inside:u.inside};if(u.inside)return{allowed:!0,geo:s};const c=u.dist>=1e3?`${(u.dist/1e3).toFixed(1)} km`:`${u.dist} m`;return{allowed:!1,geo:s,message:`You need to be at the venue to ${b[n]}. You look to be about ${c} away (allowed ${u.limit} m). If you\u2019re at the venue, try again in a moment or ask a manager to record it for you.`}},e.overrideGeo=function(t,n,o,a){const r=a.trim();return r.length<3?null:{action:t,at:n,inside:null,override:{by:o.name,byId:o.id,reason:r.slice(0,200)}}},e.offRotaDue=function(t){return!(!(t.area.offRotaPrompt&&d(t.area)&&t.inside)||t.clockedIn||t.dismissedToday)&&!t.shifts.some(n=>t.nowHours>=n.start-1&&t.nowHours<(n.end<=n.start?n.end+24:n.end))},Object.defineProperty(e,"breakLabel",{enumerable:!0,get:function(){return O}});const t=50,n=2e3,o=50,a=[5,10,15,20,30,45,60],r={lat:null,lng:null,radius:100,on:!0,breakOptions:[...a],offRotaPrompt:!0,offRotaTitle:'Do you want to sign in?',offRotaBody:'Should you be on the rota?'},u=t=>t*Math.PI/180;function s(t,n){const o=u(n.lat-t.lat),a=u(n.lng-t.lng),r=Math.sin(o/2)**2+Math.cos(u(t.lat))*Math.cos(u(n.lat))*Math.sin(a/2)**2;return 12742017.6*Math.asin(Math.min(1,Math.sqrt(r)))}const c=t=>'number'==typeof t&&Number.isFinite(t)&&t>=-90&&t<=90,l=t=>'number'==typeof t&&Number.isFinite(t)&&t>=-180&&t<=180,d=t=>c(t.lat)&&l(t.lng),f=o=>Number.isFinite(o)?Math.min(n,Math.max(t,Math.round(o))):r.radius,p=t=>Number.isFinite(t)&&t>0?Math.min(t,o):0;function h(t,n){const o=s({lat:t.lat,lng:t.lng},n),a=f(t.radius)+p(n.acc);return{inside:o<=a,dist:Math.round(o),limit:Math.round(a)}}const b={in:'clock in',out:'clock out',break_start:'start a break',break_end:'end your break'},m={browser:'Location is turned off for this browser. Turn it on in your phone\u2019s settings (Location \u203a allow for this browser), then try again.',iphone:'Location is turned off for this app. On your iPhone open Settings \u203a Privacy & Security \u203a Location Services \u203a Safari Websites and choose While Using the App, then try again.',app:'Location is turned off for this app. Tap Open app settings, then Permissions \u203a Location \u203a Allow only while using the app. Then come back and try again.','app-old':'This version of the app can\u2019t use location. Tap Update the app at the bottom of the screen, then tap Allow when your phone asks.','app-phone-off':'Location is switched off on your phone. Tap Open location settings, turn on Use location, then come back and try again.'};const y=t=>Math.round(1e6*t)/1e6;const O=t=>60===t?'1 hour':t%60==0?t/60+" hours":t>60?`${Math.floor(t/60)} h ${t%60} min`:`${t} min`},954,[]); +__d(function(g,_r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"pinProblem",{enumerable:!0,get:function(){return r.pinProblem}}),Object.defineProperty(_e,"ERROR_TEXT",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"errorText",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"useDisplayTiles",{enumerable:!0,get:function(){return u}}),_e.refreshTiles=async function(){const e=await l('display_staff_list',{});Array.isArray(e)&&u.setState({tiles:e,at:Date.now()});const t=await l('display_pin_lengths',{});t&&'object'==typeof t&&!('ok'in t)&&u.setState({lens:t})},_e.refreshManagers=async function(){const e=await l('display_managers',{});Array.isArray(e)&&u.setState({managers:e})},Object.defineProperty(_e,"displayClock",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"displayChangePin",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"displayAddTemp",{enumerable:!0,get:function(){return y}}),_e.setStaffPin=async function(e,n,a=4){const o=_();if(!o)return{ok:!1,error:'Sign in to the venue to set PINs (they are kept on the server only).'};const s=(0,r.pinProblem)(n,a);if(s)return{ok:!1,error:s};try{const{error:r}=await(0,t.getSupabase)().rpc('set_staff_pin',{p_venue:o,p_staff_ref:e,p_pin:n});return r?{ok:!1,error:r.message.replace(/^.*?:\s*(?=The PIN|Pick a PIN)/,'')}:{ok:!0}}catch{return{ok:!1,error:'No connection. Try again in a moment.'}}},_e.addTempStaff=async function(e){const n=_();if(!n)return{ok:!1,error:'Sign in to the venue to add temp staff (the code is made and kept on the server).'};try{const{data:r,error:a}=await(0,t.getSupabase)().rpc('add_temp_staff',{p_venue:n,p_name:e.name,p_dept:e.dept??null,p_rate:e.rate??null,p_until:e.until||null});return a?{ok:!1,error:a.message}:{ok:!0,...r}}catch{return{ok:!1,error:'No connection. Try again in a moment.'}}},Object.defineProperty(_e,"usePinStatus",{enumerable:!0,get:function(){return k}}),_e.refreshPinStatus=async function(){const e=_();if(!e)return;try{const{data:n}=await(0,t.getSupabase)().rpc('staff_pin_status',{p_venue:e});Array.isArray(n)&&k.setState(Object.fromEntries(n.map(e=>[e.staff_ref,{hasPin:e.has_pin,locked:e.locked}])),!0)}catch{}},_e.localTiles=function(e,t){return e.filter(e=>e.active&&e.displayClock&&!(e.temp&&e.tempUntil&&e.tempUntil({ref:e.id,name:e.name,nickname:e.nickname,dept:e.dept,temp:!!e.temp})).sort((e,t)=>Number(!!e.temp)-Number(!!t.temp)||e.name.localeCompare(t.name))},Object.defineProperty(_e,"displayBlockChange",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"displayBlockEdit",{enumerable:!0,get:function(){return h}});var e=_r(d[0]),t=_r(d[1]),n=_r(d[2]),r=_r(d[3]),a=_r(d[4]),o=_r(d[5]);const s={wrong:'That PIN is not right. Try again.',locked:'Too many wrong tries. Locked for 15 minutes, or ask a manager to reset your PIN.',nopin:'No PIN set yet. Ask a manager to set one in Staff & roles.',notallowed:'This person can\u2019t clock in at the Display. A manager can turn it on in Staff & roles.',already:'Already clocked in.',notin:'Not clocked in yet.',onbreak:'Already on a break.',notmanager:'Only an owner or manager can add temp staff.',format:'The new PIN must be 4 to 8 digits (6 or more for managers and owners).',weak:'Pick a PIN that is harder to guess (not all the same digit or a run like 1234).',devicelocked:'Too many wrong PINs on this Display. Wait 15 minutes, then try again.',unpaired:'Pair this Display first (Settings \u203a Devices on the Managers app), then try again.',offline:'No connection. Try again in a moment.'},c=(e,t)=>'format'===e&&t?.min?`The new PIN must be ${t.min} to 8 digits.`:s[e??'']??(e||'Something went wrong. Try again.'),p=()=>'device'===n.useSync.getState().kind&&!!n.useSync.getState().venueId;async function l(e,n){if(a.PITCH)return(0,o.pitchClock)(e,n);if(!p())return{ok:!1,error:'unpaired'};try{const{data:r,error:a}=await(0,t.getSupabase)().rpc(e,n);return a?{ok:!1,error:/paired Display/.test(a.message)?'unpaired':a.message}:r}catch{return{ok:!1,error:'offline'}}}const u=(0,e.create)(()=>({tiles:null,managers:[],lens:{}}));const f=(e,t,n,r={})=>l('display_clock',{p_staff_ref:e,p_pin:t,p_action:n,p_break_mins:r.breakMins??null,p_off_rota:!!r.offRota}),m=(e,t,n)=>l('display_change_pin',{p_staff_ref:e,p_old:t,p_new:n}),y=(e,t,n)=>l('display_add_temp',{p_manager_ref:e,p_manager_pin:t,p_name:n.name,p_dept:n.dept??null,p_rate:n.rate??null,p_until:n.until||null}),_=()=>'staff'===n.useSync.getState().kind?n.useSync.getState().venueId:void 0;const k=(0,e.create)(()=>({}));const b=(e,t,n,r,a)=>l('display_block_change',{p_manager_ref:e,p_manager_pin:t,p_block_id:n,p_action:r,p_doc:a}),h=(e,t,n,r)=>l('display_block_edit',{p_block_id:e,p_action:t,p_doc:n,p_by:r})},955,[952,863,820,1375,2,1376]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"notifSeedId",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"headChefId",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"gmId",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"seedsFor",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"useNotifs",{enumerable:!0,get:function(){return v}});var e,t=r(d[0]),i=(e=t)&&e.__esModule?e:{default:e},s=r(d[1]),n=r(d[2]),o=r(d[3]),u=r(d[4]),p=r(d[5]),f=r(d[6]),c=r(d[7]);const l=(e,t)=>(0,o.uuidFrom)(`sched-notif:${t}:${e}`),S=()=>p.ROSTER.find(e=>'Head Chef'===e.level)?.id??p.ROSTER.find(e=>'chef'===e.app)?.id??'',b=()=>p.ROSTER.find(e=>'Manager'===e.level)?.id??'',h=e=>'anchorage'===e?(0,u.anchorageSeeds)(t=>l(e,t),S(),b()):[],O=()=>(new Date).toISOString(),v=(0,s.create)()((0,n.persist)((e,t)=>({items:[],snooze:{},ensure:i=>{const s=t().items,n=s.map(e=>(0,c.fixSupplierNames)(e.title)!==e.title||(0,c.fixSupplierNames)(e.message)!==e.message?{...e,title:(0,c.fixSupplierNames)(e.title),message:(0,c.fixSupplierNames)(e.message),updatedAt:O()}:e);n.some((e,t)=>e!==s[t])&&e({items:n});const o=new Set(t().items.map(e=>e.id)),u=h(i).filter(e=>!o.has(e.id)).map(e=>({...e,rid:i}));u.length&&e(e=>({items:[...e.items,...u]}))},add:(t,i)=>{const s=(0,f.uuid)();return e(e=>({items:[...e.items,{...i,id:s,rid:t,updatedAt:O()}]})),s},update:(t,i)=>e(e=>({items:e.items.map(e=>e.id===t?{...e,...i,updatedAt:O()}:e)})),remove:t=>e(e=>({items:e.items.flatMap(e=>e.id!==t?[e]:e.seed?[{...e,removed:!0,paused:!0,updatedAt:O()}]:[])})),resetSeeds:t=>{const i=new Map(h(t).map(e=>[e.id,e]));e(e=>{const s=e.items.map(e=>i.has(e.id)?{...i.get(e.id),rid:t,updatedAt:O()}:e),n=new Set(s.map(e=>e.id));return{items:[...s,...[...i.values()].filter(e=>!n.has(e.id)).map(e=>({...e,rid:t,updatedAt:O()}))]}})},setSnooze:(t,i)=>e(e=>({snooze:Object.fromEntries([...Object.entries(e.snooze).filter(([,e])=>e>Date.now()-864e5),[t,i]])}))}),{name:'covercharge-sched-notifs-v1',version:1,storage:(0,n.createJSONStorage)(()=>i.default)}))},956,[1082,952,1091,1103,958,14,1034,1175]); +__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"chairsId",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"rulesId",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"useReminders",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"rulesOf",{enumerable:!0,get:function(){return A}});var e,r=_r(d[0]),t=(e=r)&&e.__esModule?e:{default:e},n=_r(d[1]),s=_r(d[2]),u=_r(d[3]),o=_r(d[4]),l=_r(d[5]);const c=e=>(0,u.uuidFrom)(`reminder:chairs:${e}`),p=e=>(0,u.uuidFrom)(`break-rules:${e}`),f=()=>(new Date).toISOString(),b=(0,n.create)()((0,s.persist)((e,r)=>({reminders:[],rules:{},done:[],snooze:{},ensure:t=>{const n=r(),s={};n.reminders.some(e=>e.id===c(t))||(s.reminders=[...n.reminders,{...(0,o.defaultChairs)(c(t)),rid:t}]),n.rules[t]||(s.rules={...n.rules,[t]:{...o.DEFAULT_BREAK_RULES,id:p(t)}}),Object.keys(s).length&&e(s)},add:(r,t)=>{const n=(0,l.uuid)();return e(e=>({reminders:[...e.reminders,{...t,id:n,rid:r,updatedAt:f()}]})),n},update:(r,t)=>e(e=>({reminders:e.reminders.map(e=>e.id===r?{...e,...t,updatedAt:f()}:e)})),remove:r=>e(e=>({reminders:e.reminders.flatMap(e=>e.id!==r?[e]:e.builtIn?[{...e,removed:!0,paused:!0,updatedAt:f()}]:[])})),resetReminder:r=>e(e=>({reminders:e.reminders.map(e=>e.id===r&&'chairs'===e.builtIn?{...(0,o.defaultChairs)(r),rid:e.rid,updatedAt:f()}:e)})),setRules:(r,t)=>e(e=>({rules:{...e.rules,[r]:{...(0,o.clampRules)({...e.rules[r]??o.DEFAULT_BREAK_RULES,...t}),id:p(r),updatedAt:f()}}})),resetRules:r=>e(e=>({rules:{...e.rules,[r]:{...o.DEFAULT_BREAK_RULES,id:p(r),updatedAt:f()}}})),markDone:r=>e(e=>({done:[{...r,id:(0,l.uuid)(),at:r.at??f()},...e.done].slice(0,400)})),setSnooze:(r,t)=>e(e=>({snooze:Object.fromEntries([...Object.entries(e.snooze).filter(([,e])=>e>Date.now()-864e5),[r,t]])}))}),{name:'covercharge-reminders-v1',version:1,storage:(0,s.createJSONStorage)(()=>t.default)})),A=e=>(0,o.clampRules)(b.getState().rules[e]??o.DEFAULT_BREAK_RULES)},957,[1082,952,1091,1103,1121,1034]); +__d(function(_g,_r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SHIFT_FILTER_LABEL",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"NOTIF_DAY_NAMES",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"NOTIF_GROUP_LABEL",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"IN_APP_WINDOW_MINS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"PUSH_WINDOW_MINS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"KITCHEN_OPEN_DAYS",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"TITLE_MAX",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"MESSAGE_MAX",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"validHm",{enumerable:!0,get:function(){return u}}),e.ukNow=p,Object.defineProperty(e,"timeOn",{enumerable:!0,get:function(){return m}}),e.notifDue=function(t,n,r=s){const o=p(n),d=m(t,o.dow);if(t.paused||t.removed||!u(d)||!t.days.includes(o.dow))return{due:!1,forDate:o.ymd,at:d};const f=l(d);return{due:o.mins>=f&&o.minst.days.includes(n));if(!r.length)return'No days ticked';const s=new Map;for(const n of r){const r=m(t,n);s.set(r,[...s.get(r)??[],n])}const o=t=>7===t.length?'Every day':t.map(t=>n[t]).join(', ');return[...s.entries()].map(([t,n])=>`${o(n)} at ${t}`).join('; ')+' (UK time)'},e.validateNotif=function(t){if(!t.title.trim())return'Give it a name.';if(t.title.length>f)return`Keep the name under ${f} letters.`;if(!t.message.trim())return'Type the message people will see.';if(t.message.length>c)return`Keep the message under ${c} letters.`;if(!u(t.time))return'Type the time as HH:MM, e.g. 21:00.';for(const n of Object.values(t.dayTimes??{}))if(!u(n))return'Type each day\u2019s time as HH:MM.';return t.days.length?t.recipients.staff.length||t.recipients.groups.length||(t.recipients.onShiftIn??[]).length?t.sendBy.inApp||t.sendBy.push?null:'Choose how to send it.':'Tick at least one person or group.':'Tick at least one day.'},e.anchorageSeeds=function(t,n,r){const s={staff:[n,r].filter(Boolean),groups:[]},o={inApp:!0,push:!0};return[{id:t('mills-milk'),seed:'mills-milk',title:'Mills milk order',message:'Make sure an order before 9:30',days:[...d],time:'21:00',dayTimes:{5:'20:55',0:'20:55'},recipients:s,sendBy:o},{id:t('peronis'),seed:'peronis',title:"Pieroni's order",message:"order Pieroni's by phone",days:[...d],time:'21:05',recipients:s,sendBy:o},{id:t('veg-second'),seed:'veg-second',title:'Veg order',message:'Order veg on the app before 11 PM',days:[...d],time:'21:15',recipients:s,sendBy:o},{id:t('reeds'),seed:'reeds',title:'Reeds order',message:'Order reeds',days:[3,4],time:'21:25',recipients:s,sendBy:o},{id:t('spezbona'),seed:'spezbona',title:'Spes Bona order',message:'Do we need anything from Spes Bona for this week? Message Anna if we do for Friday delivery.',days:[3],time:'15:00',recipients:s,sendBy:o},{id:t('olsens'),seed:'olsens',title:"Olsen's order",message:"Place Olsen's order before 3:30 PM. By phone.",days:[2],time:'13:00',recipients:{staff:[r],groups:[]},sendBy:o},{id:t('allsons-list'),seed:'allsons-list',title:'Alsons drinks list',message:'Add anything extra to the Alsons drinks list.',days:[0],time:'20:00',recipients:{staff:['st-finn'],groups:[]},sendBy:o,open:{page:'orderlists',list:'allsons'}},{id:t('tea-towels'),seed:'tea-towels',title:'Tea towels',message:'Put a load of tea towels on to wash.',days:[...d],time:'15:00',recipients:{staff:[],groups:[],onShiftIn:['kp'],fallback:{staff:[],groups:['head_chef']}},sendBy:o},{id:t('rota-upload'),seed:'rota-upload',title:'Rota upload',message:"Make sure you have uploaded next week's rota.",days:[0],time:'20:50',recipients:s,sendBy:o}]};const t={kitchen:'On shift: Kitchen',foh:'On shift: Front of house',bar:'On shift: Bar',kp:'On shift: KPs',chefs:'On shift: Chefs'},n=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],r={on_shift:'Everyone on shift',everyone:'Everyone',managers:'Owners and managers',head_chef:'Head Chef',kitchen:'Kitchen team',foh:'Front of house'},s=120,o=15,d=[3,4,5,6,0],f=60,c=160,u=t=>/^([01]\d|2[0-3]):[0-5]\d$/.test(t),l=t=>60*Number(t.slice(0,2))+Number(t.slice(3,5));function p(t){const r='number'==typeof t?new Date(t):t,s={};for(const t of new Intl.DateTimeFormat('en-GB',{timeZone:'Europe/London',weekday:'short',year:'numeric',month:'2-digit',day:'2-digit',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}).formatToParts(r))s[t.type]=t.value;return{dow:n.indexOf(String(s.weekday).slice(0,3)),mins:60*Number(s.hour)+Number(s.minute),ymd:`${s.year}-${s.month}-${s.day}`}}const m=(t,n)=>{const r=t.dayTimes?.[String(n)];return r&&u(r)?r:t.time};const h=t=>t.open?`./?open=${t.open.page}${t.open.list?`&list=${encodeURIComponent(t.open.list)}`:''}`:'./',y=(t,n)=>`${t.id}:${n}`,g=t=>(t??'').toLowerCase(),b=t=>t.level?['owner','manager'].includes(g(t.level)):['owner','manager'].includes(g(t.role)),O=t=>'head_chef'===g(t.role)||'head chef'===g(t.level)||'chef'===g(t.app)||/head chef/.test(g(t.job)),P=t=>'kitchen'===g(t.department)||/chef|kitchen|kp|porter/.test(g(t.job))||O(t),k=t=>/\bkp\b|kitchen porter/.test(g(t.job));function j(t,n){const r=g(n.department);return'kitchen'===t?P(n):'kp'===t?k(n):'chefs'===t?O(n)||/chef|commis/.test(g(n.job)):'bar'===t?'bar'===r||/\bbar/.test(g(n.job)):'front of house'===r||!r&&!P(n)&&!b(n)}function _(t,n,r=[]){const s=v(t.recipients,n,r),o=t.recipients.fallback;return s.length||!o?s:v({staff:o.staff,groups:o.groups},n,r)}const w=(t,n,r=[])=>!!t.recipients.fallback&&!v(t.recipients,n,r).length;function v(t,n,r){const s=t,o=n.filter(t=>!1!==t.active),d=new Set;for(const t of s.staff)o.some(n=>n.id===t)&&d.add(t);for(const t of s.groups)for(const n of o)('everyone'===t||'on_shift'===t&&r.includes(n.id)||'managers'===t&&b(n)||'head_chef'===t&&O(n)||'kitchen'===t&&P(n)||'foh'===t&&!P(n)&&!b(n))&&d.add(n.id);for(const t of s.onShiftIn??[])for(const n of o)r.includes(n.id)&&j(t,n)&&d.add(n.id);return[...d].sort()}const M=t=>({id:t.external_ref,role:t.roles?.key??void 0,job:t.job_title??'',department:t.department??'',active:!1!==t.active}),T=(t,n,r,s=[])=>_(t,r,s).includes(n)},958,[]); +__d(function(g,_r,i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.shiftNow=l,e.useShiftReminders=function({rid:c,staffId:k,name:h,kitchen:b,onStartBreak:S}){const D=(0,t.useRef)(S);D.current=S;const I=(0,t.useRef)(h);I.current=h;const v=(0,s.useReminders)(t=>`${t.reminders.length}:${t.done.length}:${JSON.stringify(t.rules[c]??{})}:${t.reminders.map(t=>t.updatedAt??'').join()}`),w=(0,r.useOwner)(t=>`${t.attendance.length}:${t.shifts.length}`);(0,t.useEffect)(()=>{s.useReminders.getState().ensure(c);const t=()=>{const t=u(),{att:h,shift:S,on:v}=l(k,t),w=s.useReminders.getState();if(!v||!k)return w.reminders.forEach(t=>(0,a.dismissNotice)(`rem:${t.id}`)),void(0,a.dismissNotice)('break-reminder');const R=(0,s.rulesOf)(c),$=h?.in?new Date(h.in).getTime():void 0,p=!!h?.breaks?.length,y=`break:${h?.id??S?.id??''}`,M=(0,o.breakDue)({now:t,clockIn:$,shiftStart:S?m(S.date,S.start):void 0,shiftEnd:S?m(S.date,S.end):void 0,rotaBreak:void 0!==S?.breakAt?m(S.date,S.breakAt):void 0,hadBreak:p,rules:R},w.snooze[y]??0);if(M){const r=$??(S?m(S.date,S.start):t);(0,a.notify)({id:'break-reminder',tone:3===M.stage?'warn':'normal',icon:'\ud83e\uded6',kicker:'BREAK REMINDER',testID:'break-reminder',timeoutMs:null,title:M.label,body:`${$?'Clocked in':'Shift started'} at ${f(r)}. ${3===M.stage?'':'Over 6 hours needs a 20-minute break.'}`.trim(),actions:[{label:'Start break',testID:'break-reminder-start',onPress:()=>{if(!h)return D.current?.(),void(0,a.notify)({id:'break-clock-first',title:'Clock in first, then tap Start break.',body:'Your break is started from the clock screen.',timeoutMs:6e3});const t=new Date(u()).toISOString();(0,n.clockAction)('break_start',{rid:c,staffId:k,date:t.slice(0,10),at:t}).then(t=>{t.ok||(0,a.notify)({id:'break-blocked',tone:'warn',title:'Break not started',body:t.message,timeoutMs:1e4}),D.current?.()})}},{label:'Later',kind:'ghost',testID:'break-reminder-later',onPress:()=>s.useReminders.getState().setSnooze(y,u()+6e4*R.snoozeMins)}]})}else(0,a.dismissNotice)('break-reminder');const N=r.useOwner.getState().staff.find(t=>t.id===k),O=b??(0,d.inKitchen)(N);for(const n of w.reminders){if(n.rid!==c)continue;const r=`rem:${n.id}`;if(n.removed||!(0,o.audienceMatch)(n.audience,O)){(0,a.dismissNotice)(r);continue}const{due:d,forDate:f}=(0,o.reminderDue)(n,t),m=w.done.find(t=>t.reminderId===n.id&&t.forDate===f),l=`rem:${n.id}:${f}`;!d||m||(w.snooze[l]??0)>t?(0,a.dismissNotice)(r):(0,a.notify)({id:r,icon:'\ud83e\ude91',kicker:'REMINDER',title:n.text,testID:'venue-reminder',timeoutMs:null,body:`For everyone on shift${'all'===n.audience?'':'kitchen'===n.audience?' in the kitchen':' front of house'}. Tap Done once it\u2019s done.`,actions:[{label:'Done',testID:'venue-reminder-done',onPress:()=>s.useReminders.getState().markDone({rid:c,reminderId:n.id,forDate:f,at:new Date(u()).toISOString(),staffRef:k,staffName:I.current.replace(' (example)','')})},{label:'Later',kind:'ghost',onPress:()=>s.useReminders.getState().setSnooze(l,u()+6e4*R.snoozeMins)}]})}};t();const h=setInterval(t,2e4);return()=>clearInterval(h)},[c,k,v,w,b])};var t=_r(_d[0]),n=_r(_d[1]),r=_r(_d[2]),s=_r(_d[3]),o=_r(_d[4]),a=_r(_d[5]),d=_r(_d[6]),c=_r(_d[7]);const u=()=>{try{return(0,c.nowFrom)(c.useStore.getState().clock).getTime()}catch{return Date.now()}},f=t=>new Date(t).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}),m=(t,n)=>{const[r,s,o]=t.split('-').map(Number);return new Date(r,s-1,o,Math.floor(n),Math.round(n%1*60)).getTime()};function l(t,n){const s=r.useOwner.getState(),a=(0,r.openShiftOf)(s.attendance,t,new Date(n)),d=(0,o.ukClock)(n).ymd,c=s.shifts.find(r=>r.staffId===t&&r.date===d&&!1!==r.published&&m(r.date,r.start)<=n&&nn.staffId===t&&n.date===d&&!1!==n.published):void 0),u=!a&&!!c&&s.attendance.some(n=>n.staffId===t&&n.date===d&&!!n.out&&new Date(n.out).getTime()>=m(c.date,c.start));return{att:a,shift:c,on:!!a||!!c&&!u}}},959,[30,1266,856,957,1121,947,1182,872]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"START_PAIR",{enumerable:!0,get:function(){return t}});const t=(()=>{try{if('undefined'==typeof window||!window.location)return null;const t=new URL(window.location.href),n=new URLSearchParams(t.hash.replace(/^#/,'')),c=t.searchParams.get('pair')||n.get('pair');if(!c)return null;t.searchParams.delete('pair'),n.delete('pair');const o=n.toString();return window.history.replaceState(null,'',t.pathname+(t.search?t.search:'')+(o?`#${o}`:'')),c}catch{return null}})()},960,[]); +__d(function(_g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PUB_LOCATIONS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"privateClockVenue",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"pubLocation",{enumerable:!0,get:function(){return s}}),e.venueClockArea=function(a,o={}){if((0,t.isQueuedVenue)(a)&&!t.queuedVenues[a].clockArea.on)return(0,n.cleanArea)({...o,on:!0===o.on&&'number'==typeof o.lat&&'number'==typeof o.lng,offRotaPrompt:!1});const l=s(a);if(!l)return(0,n.cleanArea)(o);const c=(0,n.cleanArea)({lat:l.lat,lng:l.lng,radius:150,...o});return{...c,lat:c.lat??l.lat,lng:c.lng??l.lng,on:!0,offRotaPrompt:!1}},e.venueClockGeo=l,e.privateAttendance=function(n,a){if(!o(n)&&!(0,t.isQueuedVenue)(n))return a;const s={...a};for(const t of['lat','lng','latitude','longitude','coords','position','location','acc','dist','accuracy','distance','outSite'])delete s[t];a.geo&&(s.geo=a.geo.map(t=>l(n,t)).filter(t=>!!t));return s};var t=r(d[0]),n=r(d[1]);const a={"3idiots":{name:"3 Idiots",address:"10 George Street, Ayr, KA8 0BL",lat:55.4650286,lng:-4.6283062,source:"Verified exact-address venue pack"},cecchinis:{name:"Cecchinis",address:"72 Fort Street, Wellington Square, Ayr, South Ayrshire KA7 1EH",lat:55.461505,lng:-4.6345736,source:"Verified exact-address venue pack"},williewastles:{name:"Willie Wastle's",address:"16-18 New Bridge Street, Ayr, South Ayrshire, KA7 1JX",lat:55.4646261,lng:-4.6323929,source:"Verified exact-address venue pack"},smokinggoat:{name:"Smoking Goat",address:"2A Academy Street, Ayr KA7 1HS",lat:55.464226,lng:-4.6326035,source:"Verified exact-address venue pack"},drunkencoo:{name:"The Drunken Coo",address:"22 Beresford Terrace, Ayr KA7 2EG",lat:55.4570308,lng:-4.6294663,source:"Verified exact-address venue pack"},abbotsford:{name:'The Abbotsford Hotel',address:'14 Corsehill Road, Ayr KA7 2ST',lat:55.4488797,lng:-4.6314856,source:'Official FSA1696388, exact address match verified6 Nov2026'},kirkton:{name:'The Kirkton Inn',address:'1-3 Main Street, Dalrymple, East Ayrshire KA6 6DF',lat:55.3971215,lng:-4.5920177,source:'Public FSA establishment1955433 verified6 November2026'},greenside:{name:'The Greenside Restaurant',address:'5 Greenside, Maybole, South Ayrshire KA19 7DG',lat:55.3542369,lng:-4.6851418,source:'Official Find us Google Maps link, place point, verified 6 November 2026'},kirkmichael:{name:'The Kirkmichael Arms',address:'3-5 Straiton Road, Kirkmichael, South Ayrshire KA19 7PH',lat:55.3458202,lng:-4.6180793,source:'venue-profile.json geo, matched to the venue address'},souters:{name:"Souter\u2019s Inn",address:'47 Main Road, Kirkoswald, South Ayrshire KA19 8HY',lat:55.3297218,lng:-4.7772979,source:'Food Standards Agency establishment 1863840, address matched'}},o=t=>Object.prototype.hasOwnProperty.call(a,t),s=t=>o(t)?a[t]:void 0;function l(n,a){return o(n)||(0,t.isQueuedVenue)(n)?'in'===a.action?{action:'in',at:a.at,inside:a.inside,...a.override?{override:{by:a.override.by,byId:a.override.byId,reason:a.override.reason}}:{}}:void 0:a}},989,[6,954]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.WhoBar=function(){const e=(0,n.useSignedIn)();if(!e)return null;const l=`Signed in as ${e.name.replace(' (example)','')}${e.level?` \xb7 ${e.level}`:''}`;return(0,o.jsx)(s.default,{testID:"who-bar",accessible:!0,accessibilityLabel:l,style:{paddingVertical:4},children:(0,o.jsx)(c.T,{size:18,weight:"semibold",colour:t.colours.gold,children:l})})},r(d[0]);var e,l=r(d[1]),s=(e=l)&&e.__esModule?e:{default:e},n=r(d[2]),t=r(d[3]),c=r(d[4]),o=r(d[5])},990,[30,127,927,821,813,24]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"currentScrollY",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"screenGeneration",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"restoreScroll",{enumerable:!0,get:function(){return o}}),_e.useScrollMemory=function(u){const c=(0,e.useRef)(0),o=(0,e.useRef)(0),l=(0,e.useRef)(0),s=(0,e.useRef)(0),f=(0,e.useRef)(0),v=(0,e.useRef)(null),y=(0,e.useRef)([]),h=()=>{y.current.forEach(clearTimeout),y.current=[]},b=()=>{const e=v.current;null!=e&&(u.current?.scrollTo({y:e,animated:!1}),f.current-s.current>=e-2&&(c.current=e,o.current=e,v.current=null,h()))},p=(0,e.useCallback)(e=>{if(h(),v.current=Math.max(0,e),e<=0)return v.current=null,u.current?.scrollTo({y:0,animated:!1}),c.current=0,void(o.current=0);for(const e of[0,30,80,160,320,600,1e3,1600,2500])y.current.push(setTimeout(b,e));y.current.push(setTimeout(()=>{v.current=null},2600))},[]);t={y:()=>o.current,restore:p};const R=(0,e.useCallback)(()=>{n++;return o.current},[]);return{props:{scrollEventThrottle:32,onScroll:e=>{const t=e.nativeEvent.contentOffset.y;c.current=t,s.current=e.nativeEvent.layoutMeasurement.height,f.current=e.nativeEvent.contentSize.height,Date.now()-l.current>250&&null==v.current&&(o.current=t)},onScrollBeginDrag:()=>{v.current=null,h()},onContentSizeChange:(e,t)=>{f.current=t,l.current=Date.now(),b()},onLayout:e=>{s.current=e.nativeEvent.layout.height}},restore:p,leave:R}};var e=r(d[0]);let t=null,n=0;const u=()=>t?t.y():0,c=()=>n,o=e=>t?.restore(e)},991,[30]); +__d(function(_g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useBackLayers",{enumerable:!0,get:function(){return y}}),_e.runBackLayer=function(){const e=y.getState().layers,t=e[e.length-1];return!!t&&(t.fn(),!0)},_e.useBackLayer=function(t,n,s=!0){const o=(0,e.useRef)(n);o.current=n,(0,e.useEffect)(()=>{if(!t)return;const e=++w,n=(0,l.currentScrollY)(),c=(0,l.screenGeneration)();return y.setState(t=>({layers:[...t.layers,{id:e,fn:()=>o.current(),own:s}]})),()=>{y.setState(t=>({layers:t.layers.filter(t=>t.id!==e)})),(0,l.screenGeneration)()===c&&(0,l.restoreScroll)(n)}},[t,s])},Object.defineProperty(_e,"useInnerBackShown",{enumerable:!0,get:function(){return h}}),_e.BackButton=function({onPress:e,testID:t="screen-back",label:n="Back"}){return(0,f.jsx)(s.default,{testID:t,accessibilityRole:"button",accessibilityLabel:n,onPress:e,hitSlop:8,style:({pressed:e})=>({minHeight:48,minWidth:96,justifyContent:'center',paddingRight:12,opacity:e?.6:1,alignSelf:'flex-start'}),children:(0,f.jsxs)(u.T,{size:18,weight:"semibold",colour:c.colours.gold,children:["\u2039 ",n]})})},_e.useWebBack=function(t){const n=(0,e.useRef)(t);n.current=t,(0,e.useEffect)(()=>{if('undefined'==typeof window||!window.history?.pushState)return;const e=()=>{try{window.history.pushState({...window.history.state??{},ccBack:Date.now()},'',window.location.href)}catch{}};e();const t=t=>{n.current()&&(t.stopImmediatePropagation?.(),e())};return window.addEventListener('popstate',t,!0),()=>window.removeEventListener('popstate',t,!0)},[])};var e=r(d[0]);r(d[1]);var t,n=r(d[2]),s=(t=n)&&t.__esModule?t:{default:t},o=r(d[3]),c=r(d[4]),u=r(d[5]),l=r(d[6]),f=r(d[7]);const y=(0,o.create)(()=>({layers:[]}));let w=0;const h=()=>y(e=>e.layers.some(e=>e.own))},992,[30,122,263,952,821,813,991,24]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.SoldOutList=function({rid:e,by:n,canMark:a=!0}){const f=(0,r.useSoldOut)(e=>e.entries),b=(0,i.useStore)(e=>e.clock),j=(0,i.useStore)(e=>e.menu),w=(0,i.useStore)(t=>t.restaurants.find(t=>t.id===e)),[S,I]=(0,s.useState)(''),$=(0,h.nowFrom)(b),C=(0,d.activeSoldOut)(f,e,$),D=new Set(C.map(e=>e.itemId)),M=(0,d.soldOutSettingsOf)(w?.settings?.soldOut),T=(0,u.useAutoSoldOutView)(e),L=f.filter(t=>t.rid===e&&!t.on&&t.kept&&T.reason(t.itemId)),v=(0,s.useMemo)(()=>j.filter(t=>t.restaurantId===e&&!t.hidden&&!D.has(t.id)&&(!S.trim()||t.name.toLowerCase().includes(S.trim().toLowerCase()))).sort((e,t)=>e.name.localeCompare(t.name)),[j,e,S,C.length]),B=(t,s)=>{const o=f.some(s=>s.rid===e&&s.itemId===t&&s.auto&&T.reason(t));j.some(e=>e.id===t)?(0,r.setSoldOut)(t,!1,n):r.useSoldOut.getState().back(e,t,n),x(`Back on: ${s}${o?' (kept on until the count changes)':''}`)};return(0,y.jsxs)(o.default,{testID:"soldout-list",style:{gap:10},children:[(0,y.jsx)(l.Muted,{children:"A reminder for staff. Dishes you mark sold out show on the Display and in the Sold out list in every staff app, within seconds. It doesn't change your till."}),(0,y.jsxs)(l.Card,{children:[(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'center'},wrap:!0,children:[(0,y.jsx)(l.T,{weight:"semibold",size:17,children:"Sold out now"}),(0,y.jsx)(l.T,{size:13,colour:C.length?m.colours.amber:m.colours.muted,children:C.length?(0,d.soldOutCount)(C.length):'Nothing sold out'})]}),C.length?C.map(e=>(0,y.jsxs)(o.default,{testID:`soldout-row-${e.itemId}`,style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'space-between',alignItems:'center',paddingVertical:6,borderTopWidth:1,borderTopColor:m.colours.border},children:[(0,y.jsxs)(o.default,{style:{flexShrink:1,flexGrow:1,flexBasis:160,gap:2},children:[(0,y.jsx)(l.T,{weight:"semibold",children:(0,c.withReason)(e.name,T.reason(e.itemId))}),(0,y.jsxs)(l.Muted,{children:["Since ",k(e.at),e.auto?' \xb7 Auto, from the counts \xb7 clears when the count is back up':`${e.by?` \xb7 ${e.by}`:''}${e.clearAfter?` \xb7 clears at ${k(e.clearAfter)}`:''}`]})]}),a?(0,y.jsx)(l.Button,{small:!0,kind:"secondary",label:"Back on",testID:`soldout-back-${e.itemId}`,accessibilityLabel:`Back on: ${e.name}`,onPress:()=>B(e.itemId,e.name)}):null]},e.itemId)):(0,y.jsx)(l.Muted,{children:"When a dish runs out, mark it here so everyone knows."}),L.length?(0,y.jsx)(o.default,{testID:"soldout-kept",children:(0,y.jsxs)(l.Muted,{children:["Kept on by hand while the count is short: ",L.map(e=>e.name).join(', '),". They stay on until the count changes."]})}):null,(0,y.jsxs)(l.Muted,{children:["Clears by itself: ",d.SOLD_OUT_CLEAR_LABEL[M.clear].toLowerCase(),". ",M.auto?'Dishes marked from the counts clear when the count is back up. ':'',"Managers can change this in Settings \u203a Advanced."]})]}),T.items.length?(0,y.jsx)(p,{rid:e,by:n,canEdit:a,auto:M.auto,view:T}):null,a?(0,y.jsxs)(l.Card,{children:[(0,y.jsx)(l.T,{weight:"semibold",size:17,children:"Mark a dish sold out"}),(0,y.jsx)(t.TextInput,{testID:"soldout-search",value:S,onChangeText:I,placeholder:"Find a dish",placeholderTextColor:m.colours.muted,accessibilityLabel:"Find a dish",style:{minHeight:46,borderRadius:12,borderWidth:1,borderColor:m.colours.accentBorder,backgroundColor:m.colours.surface2,color:m.colours.text,paddingHorizontal:12,fontSize:16}}),v.slice(0,60).map(e=>(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingVertical:4},wrap:!0,children:[(0,y.jsxs)(o.default,{style:{flexShrink:1,flexGrow:1,flexBasis:160},children:[(0,y.jsx)(l.T,{children:e.name}),(0,y.jsx)(l.Muted,{children:e.section})]}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"Mark sold out",testID:`soldout-mark-${e.id}`,accessibilityLabel:`Mark sold out: ${e.name}`,onPress:()=>{return t=e.id,s=e.name,(0,r.setSoldOut)(t,!0,n),void x(`Sold out: ${s}`);var t,s}})]},e.id)),v.length?null:(0,y.jsx)(l.Muted,{children:S?'No dish matches that.':'Every dish is marked sold out.'})]}):null]})};var e,t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),o=(e=n)&&e.__esModule?e:{default:e},l=_r(_d[3]),i=_r(_d[4]),r=_r(_d[5]),a=_r(_d[6]),d=_r(_d[7]),u=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),m=_r(_d[11]),y=_r(_d[12]);const k=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`},x=e=>{const t=new Date(globalThis.__ccNow??Date.now()).toISOString();for(const s of['kitchen','foh'])a.useOwner.getState().sys(s,e,t)};const f={link:'set by staff',card:'from its recipe card',description:'from its description',name:'from its name',none:''},b=e=>.5===e?'\xbd':Number.isInteger(e)?String(e):`${Math.floor(e)}\xbd`;function p({rid:e,by:t,canEdit:n,auto:i,view:r}){const[a,d]=(0,s.useState)(!1),[h,k]=(0,s.useState)(null),[x,p]=(0,s.useState)([]),j=r.dishes.filter(t=>t.uses.length||'none'===t.source&&r.links.some(s=>s.rid===e&&s.itemId===t.id&&!s.auto)),w=(a?r.dishes:j).slice().sort((e,t)=>e.name.localeCompare(t.name)),S=r.items.map(e=>`${e.name.toLowerCase()} ${b(r.counts[e.key]??0)}`).join(', '),I=(e,t,s)=>p(n=>n.map(n=>n.key===e?{...n,qty:Math.max(0,Math.min(20,n.qty+s*('half'===t.unit?.5:1)))}:n)),$=(s,n)=>{u.useSoldOutLinks.getState().setLink(e,s,n,t),k(null)};return(0,y.jsx)(o.default,{testID:"soldout-links",children:(0,y.jsxs)(l.Card,{children:[(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'center'},wrap:!0,children:[(0,y.jsx)(l.T,{weight:"semibold",size:17,children:"Dishes linked to the counts"}),(0,y.jsx)(o.default,{testID:"soldout-links-counts",children:(0,y.jsxs)(l.T,{size:13,colour:m.colours.muted,children:["Counts now: ",S]})})]}),(0,y.jsx)(l.Muted,{children:i?'When a count runs out, or drops below what a dish needs, the dish is marked sold out by itself, and put back on when the count is back up. Dishes you mark by hand are left alone.':'Marking dishes from the counts is off for this venue (Settings \u203a Advanced \u203a Sold out reminders).'}),w.map(e=>(0,y.jsxs)(o.default,{testID:`soldout-link-${e.id}`,style:{paddingVertical:6,borderTopWidth:1,borderTopColor:m.colours.border,gap:6},children:[(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'center'},wrap:!0,children:[(0,y.jsxs)(o.default,{style:{flexShrink:1,flexGrow:1,flexBasis:160},children:[(0,y.jsx)(l.T,{weight:"semibold",children:e.name}),(0,y.jsxs)(l.Muted,{children:[e.uses.length?`Uses ${(0,c.usesText)(e.uses,r.items)}`:'Not linked to the counts',f[e.source]?` \xb7 ${f[e.source]}`:'']})]}),n&&h!==e.id?(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"Change",testID:`soldout-link-edit-${e.id}`,accessibilityLabel:`Change what ${e.name} uses`,onPress:()=>{return t=e.id,s=e.uses,k(t),void p(r.items.map(e=>({key:e.key,qty:s.find(t=>t.key===e.key)?.qty??0})));var t,s}}):null]}),h===e.id?(0,y.jsxs)(o.default,{style:{gap:6},children:[r.items.map(t=>{const s=x.find(e=>e.key===t.key)?.qty??0;return(0,y.jsxs)(l.Row,{style:{alignItems:'center',gap:8},children:[(0,y.jsx)(l.T,{style:{flexGrow:1},children:t.name}),(0,y.jsx)(l.Button,{small:!0,kind:"secondary",label:"\u2013",testID:`soldout-link-${e.id}-${t.key}-minus`,accessibilityLabel:`Fewer ${t.plural.toLowerCase()}`,onPress:()=>I(t.key,t,-1)}),(0,y.jsx)(o.default,{testID:`soldout-link-${e.id}-${t.key}-qty`,style:{minWidth:28},children:(0,y.jsx)(l.T,{weight:"semibold",style:{textAlign:'center'},children:b(s)})}),(0,y.jsx)(l.Button,{small:!0,kind:"secondary",label:"+",testID:`soldout-link-${e.id}-${t.key}-plus`,accessibilityLabel:`More ${t.plural.toLowerCase()}`,onPress:()=>I(t.key,t,1)})]},t.key)}),(0,y.jsxs)(l.Muted,{children:["Per portion. ",x.some(e=>e.qty>0)?`Uses ${(0,c.usesText)(x.filter(e=>e.qty>0),r.items)}.`:'Not linked: never marked from the counts.']}),(0,y.jsxs)(l.Row,{style:{gap:8},wrap:!0,children:[(0,y.jsx)(l.Button,{small:!0,label:"Save",testID:`soldout-link-save-${e.id}`,onPress:()=>$(e.id,x.filter(e=>e.qty>0))}),(0,y.jsx)(l.Button,{small:!0,kind:"secondary",label:"Back to automatic",testID:`soldout-link-reset-${e.id}`,accessibilityLabel:`Back to automatic: ${e.guess.length?(0,c.usesText)(e.guess,r.items):'not linked'}`,onPress:()=>$(e.id,null)}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>k(null)})]}),(0,y.jsxs)(l.Muted,{children:["Automatic: ",e.guess.length?(0,c.usesText)(e.guess,r.items):'not linked'," (from the recipe card, description or name)."]})]}):null]},e.id)),w.length?null:(0,y.jsx)(l.Muted,{children:"No dish is linked yet."}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:a?'Show linked dishes only':'Link another dish',testID:"soldout-links-all",onPress:()=>d(!a)})]})})}},993,[877,30,127,813,819,918,856,944,942,943,872,821,24]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"APP_VERSION",{enumerable:!0,get:function(){return t}});const t='v0.3.12.77'},994,[]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useTasksProgress=function(e,s){const t=(0,d.useDailyTasks)(t=>t.people[(0,d.personKey)(e,s)]?.tasks)??[],i=(0,d.useDailyTasks)(e=>e.ticks),{ymd:l,dow:o}=b();return(0,r.progress)(t,i,s,l,o)},_e.DailyTasksEditor=T,_e.MyTasksToday=function({rid:e,staffId:s,name:t,onShift:c}){const u=(0,d.useDailyTasks)(t=>t.people[(0,d.personKey)(e,s)]?.tasks)??[],h=(0,d.useDailyTasks)(e=>e.ticks),{ymd:y,dow:k}=b(),p=(0,r.tasksFor)(u,k);if(!s||!p.length)return null;const T=(0,r.progress)(u,h,s,y,k);return(0,x.jsx)(l.default,{testID:"my-tasks-today",children:(0,x.jsxs)(o.Card,{children:[(0,x.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(o.T,{weight:"semibold",colour:n.colours.gold,children:"My tasks today"}),(0,x.jsx)(o.Badge,{kind:T.done===T.total?'gold':'neutral',label:`${T.done} of ${T.total}`})]}),c?null:(0,x.jsx)(o.Muted,{size:12,children:"You\u2019re not on shift right now. You can still tick these when you are."}),p.map(r=>{const u=h.find(t=>t.id===(0,d.tickId)(e,s,r.id,y));return(0,x.jsxs)(i.default,{testID:`my-task-${r.id}`,accessibilityRole:"checkbox",accessibilityState:{checked:!!u},disabled:!c,onPress:()=>d.useDailyTasks.getState().toggleTick(e,s,r.id,y,{id:s,name:t.replace(' (example)','')}),style:{flexDirection:'row',alignItems:'center',gap:10,paddingVertical:8,opacity:c?1:.6},children:[(0,x.jsx)(l.default,{style:{width:24,height:24,borderRadius:6,borderWidth:1.5,borderColor:n.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:u?'#2a2414':'transparent'},children:u?(0,x.jsx)(o.T,{colour:n.colours.gold,children:"\u2713"}):null}),(0,x.jsxs)(l.default,{style:{flex:1},children:[(0,x.jsx)(o.T,{style:{textDecorationLine:u?'line-through':'none'},children:r.text}),u?(0,x.jsxs)(o.Muted,{size:12,children:["Done at ",f(u.at)]}):null]})]},r.id)}),(0,x.jsx)(o.Muted,{size:12,children:"Tip: tick each one as you finish it. Your manager sees how you\u2019re getting on. They start fresh every day."})]})})},_e.TaskLibrarySettings=function({rid:e}){(0,t.useEffect)(()=>{d.useDailyTasks.getState().ensure(e)},[e]);const i=(0,d.useDailyTasks)(s=>s.library[e]?.items)??[],[c,u]=(0,t.useState)(''),[y,p]=(0,t.useState)({}),f=d.useDailyTasks.getState(),b=s=>f.setLibrary(e,s);return(0,x.jsxs)(l.default,{style:{gap:8},testID:"task-library",children:[(0,x.jsx)(o.Muted,{size:13,children:"Tip: these are quick picks when you add someone\u2019s daily tasks (Staff & roles \u203a a person \u203a Daily tasks). You can always type a new one there too."}),i.map((e,t)=>(0,x.jsxs)(o.Row,{gap:6,style:{opacity:e.archived?.5:1},children:[(0,x.jsx)(s.TextInput,{accessibilityLabel:`Rename ${e.text}`,value:y[e.id]??e.text,onChangeText:s=>p(t=>({...t,[e.id]:s})),onBlur:()=>{const s=(0,r.cleanTaskText)(y[e.id]??'');s&&s!==e.text&&b(i.map(t=>t.id===e.id?{...t,text:s}:t))},style:{...k,flex:1,minWidth:0}}),(0,x.jsx)(o.Button,{small:!0,kind:"ghost",label:"\u2191",disabled:0===t,onPress:()=>b((0,r.move)(i,t,-1))}),(0,x.jsx)(o.Button,{small:!0,kind:"ghost",label:"\u2193",disabled:t===i.length-1,onPress:()=>b((0,r.move)(i,t,1))}),(0,x.jsx)(o.Button,{small:!0,kind:"ghost",label:e.archived?'Bring back':'Archive',onPress:()=>b(i.map(s=>s.id===e.id?{...s,archived:!s.archived}:s))})]},e.id)),(0,x.jsxs)(o.Row,{gap:6,children:[(0,x.jsx)(s.TextInput,{accessibilityLabel:"New library task",testID:"task-lib-new",value:c,onChangeText:u,placeholder:"e.g. Check the beer garden",placeholderTextColor:n.colours.muted,style:{...k,flex:1}}),(0,x.jsx)(o.Button,{small:!0,label:"Add",disabled:!(0,r.cleanTaskText)(c),onPress:()=>{b([...i,{id:(0,h.uuid)(),text:(0,r.cleanTaskText)(c)}]),u('')}})]})]})},_e.KitchenTeamTasks=function({rid:e,actor:s}){const t=(0,y.useOwner)(e=>e.staff).filter(e=>e.active&&s&&(0,r.canEditTasks)(s,e));return(0,x.jsxs)(l.default,{style:{gap:10},testID:"kitchen-team-tasks",children:[(0,x.jsx)(o.Muted,{size:13,children:"Tip: set the daily tasks for your kitchen team here. They see them as \u2018My tasks today\u2019 when they\u2019re on shift and tick them off. Your own list and front of house lists are set by a manager."}),s?null:(0,x.jsx)(o.Muted,{children:"Sign in to change your team\u2019s tasks."}),s&&!t.length?(0,x.jsx)(o.Muted,{children:"No kitchen staff found. A manager can set each person\u2019s department in Staff & roles."}):null,t.map(t=>(0,x.jsxs)(o.Card,{children:[(0,x.jsx)(o.T,{weight:"semibold",children:(0,y.staffLabel)(t).replace(' (example)','')}),(0,x.jsxs)(o.Muted,{size:12,children:[t.job,t.dept?` \xb7 ${t.dept}`:'']}),(0,x.jsx)(T,{rid:e,person:t,actor:s})]},t.id))]})};var s=_r(_d[0]),t=_r(_d[1]),i=e(_r(_d[2])),l=e(_r(_d[3])),o=_r(_d[4]),n=_r(_d[5]),d=_r(_d[6]),r=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),y=_r(_d[11]),x=_r(_d[12]);const k={minHeight:42,borderRadius:10,borderWidth:1,borderColor:n.colours.hairline,backgroundColor:n.colours.surface2,color:n.colours.text,paddingHorizontal:10,fontSize:15},p=[1,2,3,4,5,6,0],f=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}),b=(e=Date.now())=>{const s=(0,c.ukClock)(e);return{ymd:s.ymd,dow:new Date(`${s.ymd}T12:00:00Z`).getUTCDay()}};function T({rid:e,person:c,actor:h}){(0,t.useEffect)(()=>{d.useDailyTasks.getState().ensure(e)},[e]);const y=(0,d.useDailyTasks)(s=>s.people[(0,d.personKey)(e,c.id)]?.tasks)??[],T=((0,d.useDailyTasks)(s=>s.library[e]?.items)??[]).filter(e=>!e.archived),j=(0,d.useDailyTasks)(e=>e.ticks),[w,D]=(0,t.useState)(!1),[v,S]=(0,t.useState)(''),[C,$]=(0,t.useState)(null),I=d.useDailyTasks.getState(),M=(0,r.canEditTasks)(h,c),{ymd:P,dow:R}=b(),L=(0,r.progress)(y,j,c.id,P,R),B=s=>I.setTasks(e,c.id,s),z=e=>{const s=y;B(y.filter(s=>s.id!==e.id)),(0,u.notify)({id:`task-undo-${e.id}`,title:`Removed \u201c${e.text}\u201d`,timeoutMs:8e3,actions:[{label:'Undo',testID:'task-undo',onPress:()=>B(s)}]})};return(0,x.jsxs)(l.default,{testID:`tasks-${c.id}`,style:{gap:6},children:[(0,x.jsx)(i.default,{accessibilityRole:"button",testID:`tasks-open-${c.id}`,onPress:()=>D(!w),children:(0,x.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsxs)(o.T,{weight:"semibold",colour:n.colours.gold,children:["Daily tasks ",w?'\u25b4':'\u25be']}),(0,x.jsx)(o.Muted,{size:12,children:y.length?`${L.done} of ${L.total} done today`:'None yet'})]})}),w?(0,x.jsxs)(l.default,{style:{gap:6},children:[y.map((s,t)=>{const i=j.find(t=>t.id===(0,d.tickId)(e,c.id,s.id,P));return(0,x.jsxs)(l.default,{testID:`task-row-${t}`,style:{borderTopWidth:1,borderColor:n.colours.hairline,paddingTop:6,gap:4},children:[(0,x.jsxs)(o.Row,{gap:6,children:[(0,x.jsxs)(o.T,{style:{flex:1},colour:i?n.colours.gold:n.colours.text,children:[i?'\u2713 ':'',s.text]}),M?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(o.Button,{small:!0,kind:"ghost",label:"\u2191",accessibilityLabel:`Move ${s.text} up`,disabled:0===t,onPress:()=>B((0,r.move)(y,t,-1))}),(0,x.jsx)(o.Button,{small:!0,kind:"ghost",label:"\u2193",accessibilityLabel:`Move ${s.text} down`,disabled:t===y.length-1,onPress:()=>B((0,r.move)(y,t,1))}),(0,x.jsx)(o.Button,{small:!0,kind:"ghost",label:"Days",onPress:()=>$(C===s.id?null:s.id)}),(0,x.jsx)(o.Button,{small:!0,kind:"ghost",testID:`task-remove-${t}`,label:"\u2715",accessibilityLabel:`Remove ${s.text}`,onPress:()=>z(s)})]}):null]}),(0,x.jsxs)(o.Muted,{size:12,children:[s.days?.length?s.days.map(e=>r.TASK_DAY_NAMES[e]).join(', '):'Every day',i?` \xb7 ticked by ${i.byName.split(' ')[0]} at ${f(i.at)}`:'']}),C===s.id?(0,x.jsx)(o.Row,{wrap:!0,gap:4,children:p.map(e=>{const t=!!s.days?.includes(e);return(0,x.jsx)(o.Chip,{label:r.TASK_DAY_NAMES[e],selected:t,onPress:()=>B(y.map(i=>i.id===s.id?{...i,days:t?(i.days??[]).filter(s=>s!==e):[...i.days??[],e].sort()}:i))},e)})}):null]},s.id)}),M?(0,x.jsxs)(l.default,{style:{gap:6},children:[(0,x.jsx)(o.Row,{wrap:!0,gap:4,children:T.filter(e=>!y.some(s=>s.text.toLowerCase()===e.text.toLowerCase())).slice(0,12).map(s=>(0,x.jsx)(o.Chip,{testID:"task-lib-chip",label:`${s.text}`,onPress:()=>I.addTask(e,c.id,s.text,s.id)},s.id))}),(0,x.jsxs)(o.Row,{gap:6,children:[(0,x.jsx)(s.TextInput,{accessibilityLabel:"New task",testID:`task-new-${c.id}`,value:v,onChangeText:S,placeholder:"Type a task, e.g. Restock the bar fridges",placeholderTextColor:n.colours.muted,style:{...k,flex:1},onSubmitEditing:()=>{(0,r.cleanTaskText)(v)&&(I.addTask(e,c.id,v),S(''))}}),(0,x.jsx)(o.Button,{small:!0,testID:`task-add-${c.id}`,label:"Add",disabled:!(0,r.cleanTaskText)(v),onPress:()=>{I.addTask(e,c.id,v),S('')}})]})]}):(0,x.jsx)(o.Muted,{size:12,children:'staff'===h?.role?'You can\u2019t change this list.':''})]}):null]})}},995,[877,30,263,127,813,821,1179,1180,1121,947,1034,856,24]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.readBack=S,_e.ReviewSheet=I,_e.Bars=P,_e.CashCharts=M,_e.CashUpScreen=function({rid:e,today:t,canEdit:s,who:l,chartsOnly:n}){const r=(0,p.useCashSettings)(e),h=(0,p.useCashUp)(e=>e.cashUps).filter(t=>t.rid===e).sort((e,t)=>t.date.localeCompare(e.date)),m=(0,p.useCashUp)(e=>e.sales).filter(t=>t.rid===e).sort((e,t)=>t.weekStart.localeCompare(e.weekStart)),[f,x]=(0,a.useState)(null),[D,P]=(0,a.useState)(null),$=(0,w.useLockedFor)(e),[B,R]=(0,a.useState)(!1),[L,A]=(0,a.useState)(null),z=async(e,s,a,o)=>{const l=a??('cashup'===e?t:(0,y.weekStartOf)((0,y.addDaysYmd)(t,-7)));if($(e,l))return void P((0,w.lockedMessage)(e,l));const n=s?await(0,k.pickPhotos)({source:s}):[];if(s&&!n.length)return void P('No photo taken. Try again, choose one from the gallery, or type the figures by hand.');const i='cashup'===e?r.cashFields:r.salesFields;let d,u={vals:{},reader:null,note:'Type the figures from the sheet.',categories:[]};n.length&&(R(!0),P('Reading the photo\u2026'),d=await Promise.all(n.map((t,s)=>(0,k.uploadPhoto)(e,l,t,s))),u=await(0,j.readSheet)(e,d.filter(e=>!!e),i),R(!1),P(null));const c=o&&'cashup'===e?h.find(e=>e.date===l)?.vals:void 0;x({kind:e,key:l,photos:n,vals:c?{...u.vals,...c}:u.vals,categories:u.categories??[],unread:(0,y.missing)(i,u.vals),note:u.note,reader:o?'edit':u.reader,uploaded:d,only:o})},E=[0,1,2].map(e=>({label:0===e?'Today':1===e?'Yesterday':v((0,y.addDaysYmd)(t,-e)),value:(0,y.addDaysYmd)(t,-e)})),N=[0,1,2].map(e=>{const s=(0,y.weekStartOf)((0,y.addDaysYmd)(t,-7*e));return{label:0===e?'This week':1===e?'Last week':`w/c ${v(s)}`,value:s}});return(0,C.jsxs)(d.default,{testID:"cashup-screen",style:{gap:12},children:[(0,C.jsx)(u.Muted,{children:"Tip: at the end of the night, tap Take a picture of the taking sheet: the figures are filled in from the photo for you to check beside it, then Confirm. Bigger venues can Upload a spreadsheet (CSV or Excel) for one night or several. Gross takings feed Spend per head. Head Chefs can see the graphs."}),D?(0,C.jsx)(u.Banner,{kind:"info",children:D}):null,(0,C.jsx)(U,{rid:e,today:t,manage:s,who:l}),s&&!n?(0,C.jsxs)(u.Card,{highlight:c.colours.gold,children:[(0,C.jsx)(u.T,{weight:"semibold",children:"End of night cash up"}),(0,C.jsx)(i.default,{testID:"upload-cashup",accessibilityRole:"button",accessibilityLabel:"Take a picture of the taking sheet. Opens the camera; the figures are filled in for you to check.",disabled:B,onPress:()=>{z('cashup','camera')},style:({pressed:e})=>({minHeight:64,borderRadius:16,backgroundColor:e?c.colours.goldLight:c.colours.gold,alignItems:'center',justifyContent:'center',paddingHorizontal:18,opacity:B?.5:1}),children:(0,C.jsx)(u.T,{size:20,weight:"semibold",colour:c.colours.onGold,children:B?'Reading the photo\u2026':'Take a picture of the taking sheet'})}),(0,C.jsxs)(u.Row,{wrap:!0,gap:8,children:[(0,C.jsx)(u.Button,{testID:"cashup-gallery",kind:"secondary",label:"Choose from gallery",accessibilityLabel:"Choose a photo of the cash up from the gallery",onPress:()=>{z('cashup','gallery')}}),(0,C.jsx)(u.Button,{testID:"cashup-by-hand",kind:"secondary",label:"Type it in",onPress:()=>{z('cashup',null)}}),(0,C.jsx)(u.Button,{testID:"cashup-sheet",kind:"secondary",label:"Upload a spreadsheet",accessibilityLabel:"Upload a spreadsheet of takings, CSV or Excel, for one night or several",onPress:async()=>{const e=await(0,b.pickSpreadsheet)();e&&('error'in e?P(e.error):A(e))}}),(0,C.jsx)(u.Button,{testID:"cashup-takings",kind:"secondary",label:"Enter takings",accessibilityLabel:"Enter tonight's takings: gross, and food and drink if you have them",onPress:()=>{z('cashup',null,t,y.TAKINGS_KEYS)}})]}),(0,C.jsx)(u.T,{weight:"semibold",style:{marginTop:8},children:"Weekly sales report"}),(0,C.jsxs)(u.Row,{wrap:!0,gap:8,children:[(0,C.jsx)(u.Button,{testID:"upload-sales",label:"Upload weekly sales report",onPress:()=>{z('sales','camera')}}),(0,C.jsx)(u.Button,{testID:"sales-gallery",kind:"secondary",label:"Choose from gallery",onPress:()=>{z('sales','gallery')}}),(0,C.jsx)(u.Button,{testID:"sales-by-hand",kind:"secondary",label:"Type it in",onPress:()=>{z('sales',null)}})]}),(0,C.jsx)(u.Muted,{children:"Several pages? Pick them all at once. Fields can be changed in Settings \u203a Advanced \u203a Cash up."})]}):null,(0,C.jsx)(M,{rid:e,today:t}),(0,C.jsxs)(u.Card,{children:[(0,C.jsx)(u.T,{weight:"semibold",children:"Recent cash ups"}),h.length?h.slice(0,10).map(e=>(0,C.jsxs)(d.default,{testID:`cashup-row-${e.date}`,style:{paddingVertical:6,borderTopWidth:1,borderTopColor:'rgba(255,255,255,0.06)',gap:2},children:[(0,C.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsx)(u.T,{weight:"semibold",children:v(e.date)}),(0,C.jsx)(u.T,{colour:c.colours.goldLight,children:T((0,y.takings)(e.vals))})]}),(0,C.jsx)(u.Muted,{children:r.cashFields.filter(e=>'text'!==e.kind&&'card'!==e.key&&'cash'!==e.key).map(t=>`${t.label} ${(0,y.isBlank)(e.vals[t.key])?'\u2014':'money'===t.kind?T(e.vals[t.key]):e.vals[t.key]}`).join(' \xb7 ')}),(0,C.jsxs)(u.Muted,{children:["Confirmed by ",e.confirmedBy??'\u2014',e.photos.length?` \xb7 ${e.photos.length} photo${e.photos.length>1?'s':''}`:'']}),s&&!$('cashup',e.date)?(0,C.jsxs)(u.Row,{gap:6,children:[(0,C.jsx)(u.Button,{small:!0,kind:"ghost",label:"Edit",onPress:()=>x({kind:'cashup',key:e.date,photos:e.photos,vals:e.vals,categories:[],unread:[],note:'',reader:'edit'})}),(0,C.jsx)(u.Button,{small:!0,kind:"ghost",testID:`takings-edit-${e.date}`,label:null==(0,y.grossOf)(e.vals)?'Add takings':'Edit takings',onPress:()=>x({kind:'cashup',key:e.date,photos:[],vals:e.vals,categories:[],unread:[],note:'',reader:'edit',only:y.TAKINGS_KEYS})})]}):null,s?(0,C.jsx)(w.CashLockControls,{kind:"cashup",item:e,label:v(e.date)}):null]},e.id)):(0,C.jsx)(u.Muted,{children:"None yet."})]}),(0,C.jsxs)(u.Card,{children:[(0,C.jsx)(u.T,{weight:"semibold",children:"Weekly sales reports"}),m.length?m.slice(0,8).map(e=>(0,C.jsxs)(d.default,{style:{paddingVertical:6,borderTopWidth:1,borderTopColor:'rgba(255,255,255,0.06)'},children:[(0,C.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsxs)(u.T,{weight:"semibold",children:["w/c ",v(e.weekStart)]}),(0,C.jsx)(u.T,{colour:c.colours.goldLight,children:T('number'==typeof e.vals.net?e.vals.net:null)})]}),(0,C.jsx)(u.Muted,{children:r.salesFields.filter(e=>'net'!==e.key).map(t=>`${t.label} ${(0,y.isBlank)(e.vals[t.key])?'\u2014':'money'===t.kind?T(e.vals[t.key]):e.vals[t.key]}`).join(' \xb7 ')}),s?(0,C.jsx)(w.CashLockControls,{kind:"sales",item:e,label:`w/c ${v(e.weekStart)}`}):null]},e.id)):(0,C.jsx)(u.Muted,{children:"None yet."})]}),L?(0,C.jsx)(b.SpreadsheetImport,{rid:e,file:L,who:l,locked:e=>$('cashup',e),onClose:()=>A(null),onSaved:e=>{P(e),A(null)}}):null,f?(0,C.jsx)(I,{draft:f,fields:'cashup'===f.kind?r.cashFields:r.salesFields,onClose:()=>x(null),onConfirm:async(t,s)=>{if(!f)return;if($(f.kind,f.key))return P((0,w.lockedMessage)(f.kind,f.key)),void x(null);const a=f.uploaded&&f.uploaded.length===f.photos.length?f.uploaded:await Promise.all(f.photos.map((e,t)=>(0,k.uploadPhoto)(f.kind,f.key,e,t))),n=f.photos.map((e,t)=>a[t]??e),r=(new Date).toISOString();if('cashup'===f.kind){const s=h.find(e=>e.date===f.key),a=f.only&&s?{...s.vals,...t}:t;p.useCashUp.getState().saveCashUp({rid:e,date:f.key,vals:a,photos:f.only&&s?s.photos:n,confirmedBy:l.name,confirmedAt:r,readBy:f.reader});const i=(0,y.combinedTips)(a),d=S(a);P(`Cash up for ${v(f.key)} saved${d?`: ${d}`:''}${null==i||f.only?'':`. Today\u2019s tips (${T(i)}) are now showing in the staff apps`}.`);try{o.default.announceForAccessibility?.(`Saved. ${d}`)}catch{}}else p.useCashUp.getState().saveSales({rid:e,weekStart:f.key,vals:t,categories:s,photos:n,confirmedBy:l.name,confirmedAt:r,readBy:f.reader}),P(`Weekly sales for the week of ${v(f.key)} saved.`);a.some(e=>null==e)&&f.photos.length&&P(e=>`${e??''} The photo is kept on this device only (not signed in or offline).`),x(null)},keyLabel:'cashup'===f.kind?'Day':'Week starting',keyChoices:'cashup'===f.kind?E:N,onKey:e=>x({...f,key:e})},`${f.kind}-${f.photos.length}`):null]})},_e.TodaysTipsCard=function({rid:e,today:t,big:s}){const a=(0,p.useTipsShow)(e),o=(0,p.useCashUp)(e=>e.tips).filter(s=>s.rid===e&&(s.date===t||s.date===(0,y.addDaysYmd)(t,-1))).sort((e,t)=>t.date.localeCompare(e.date))[0],l=R(o?.total??0);return a.showToday&&o?(0,C.jsx)(u.Card,{highlight:c.colours.gold,children:(0,C.jsxs)(d.default,{testID:"todays-tips",style:{flexDirection:'row',alignItems:'center',gap:14},children:[(0,C.jsx)($,{n:Math.ceil(o.total/25)}),(0,C.jsxs)(d.default,{style:{flex:1,gap:2},children:[(0,C.jsx)(u.T,{size:12,weight:"semibold",colour:c.colours.gold,style:{letterSpacing:1.5},children:o.date===t?'TODAY\u2019S TIPS':'LAST NIGHT\u2019S TIPS'}),(0,C.jsx)(u.T,{size:s?40:32,weight:"bold",colour:c.colours.goldLight,children:T(l)}),(0,C.jsxs)(u.Muted,{children:["Cash + card tips for the whole team \xb7 ",v(o.date),". Thank you, everyone."]})]})]})}):null},_e.TipsPotCard=U,_e.useTipsPosted=function(e,t,s=!0){const o=(0,p.useCashUp)(e=>e.tips),l=(0,p.useTipsShow)(e);(0,a.useEffect)(()=>{if(!s||!l.showToday)return;const a=o.filter(s=>s.rid===e&&s.date>=(0,y.addDaysYmd)(t,-1)&&s.date<=t).sort((e,t)=>t.date.localeCompare(e.date))[0];if(!a)return;const n=`${e}:${a.date}`;p.useCashUp.getState().seen[n]!==a.total&&(p.useCashUp.getState().markSeen(n,a.total),(0,x.notify)({id:`tips-${n}`,icon:'\ud83e\ude99',kicker:'TIPS',title:`${a.date===t?'Today\u2019s':'Last night\u2019s'} tips: ${T(a.total)}`,body:'Cash + card tips for the whole team. Added to the Tips pot. Thank you, everyone.',testID:'tips-notice',timeoutMs:12e3,actions:[{label:'Nice',testID:'tips-notice-ok',onPress:()=>{}}]}))},[e,t,o,l.showToday,s])},_e.CashUpSettings=function({rid:e}){const t=(0,p.useCashSettings)(e),a=(t,s)=>p.useCashUp.getState().setFields(e,t,s),o=(e,o)=>(0,C.jsxs)(d.default,{style:{gap:6},children:[(0,C.jsx)(u.T,{weight:"semibold",children:o}),t[e].map((o,l)=>(0,C.jsxs)(u.Row,{gap:6,children:[(0,C.jsx)(s.TextInput,{testID:`cf-${e}-${o.key}`,value:o.label,onChangeText:s=>a(e,t[e].map((e,t)=>t===l?{...e,label:s.slice(0,40)}:e)),style:{flex:1,minHeight:38,borderRadius:8,borderWidth:1,borderColor:'rgba(255,255,255,0.15)',color:c.colours.text,paddingHorizontal:8}}),(0,C.jsx)(u.Muted,{children:'money'===o.kind?'\xa3':'number'===o.kind?'#':'text'}),o.fixed?(0,C.jsx)(u.Muted,{children:"needed"}):(0,C.jsx)(u.Button,{small:!0,kind:"ghost",label:"\u2715",accessibilityLabel:`Remove ${o.label}`,onPress:()=>a(e,t[e].filter((e,t)=>t!==l))})]},o.key)),(0,C.jsxs)(u.Row,{gap:6,children:[(0,C.jsx)(u.Button,{small:!0,kind:"secondary",label:"Money figure",onPress:()=>a(e,[...t[e],{key:`f${Date.now().toString(36)}`,label:'New figure',kind:'money'}])}),(0,C.jsx)(u.Button,{small:!0,kind:"secondary",label:"Number",onPress:()=>a(e,[...t[e],{key:`n${Date.now().toString(36)}`,label:'New number',kind:'number'}])})]})]});return(0,C.jsxs)(d.default,{testID:"cashup-settings",style:{gap:12},children:[(0,C.jsx)(u.Muted,{children:"Tip: match these to the boxes on your paper cash up sheet and till printout. Cash tips total and Card tips total are needed for Today\u2019s tips and the Tips pot."}),o('cashFields','Cash up sheet'),o('salesFields','Weekly sales report')]})},_e.TipsSettings=function({rid:e}){const t=(0,p.useTipsShow)(e);return(0,C.jsxs)(d.default,{testID:"tips-settings",style:{gap:8},children:[(0,C.jsx)(u.Muted,{children:"Staff only ever see the team total: never anyone\u2019s share or pay. The Display never shows tips or money."}),(0,C.jsx)(u.Toggle,{testID:"tips-show-today",label:"Show Today\u2019s tips in the staff apps",value:t.showToday,onChange:t=>p.useCashUp.getState().setShow(e,{showToday:t})}),(0,C.jsx)(u.Toggle,{testID:"tips-show-pot",label:"Show the Tips pot in the staff apps",value:t.showPot,onChange:t=>p.useCashUp.getState().setShow(e,{showPot:t})})]})};var t=_r(_d[0]),s=_r(_d[1]),a=_r(_d[2]),o=e(_r(_d[3])),l=e(_r(_d[4])),n=e(_r(_d[5])),r=e(_r(_d[6])),i=e(_r(_d[7])),d=e(_r(_d[8])),h=e(_r(_d[9])),u=_r(_d[10]),c=_r(_d[11]),p=_r(_d[12]),y=_r(_d[13]),m=_r(_d[14]),f=_r(_d[15]),x=_r(_d[16]),k=_r(_d[17]),j=_r(_d[18]),b=_r(_d[19]),w=_r(_d[20]),C=_r(_d[21]);const T=e=>null==e?'\u2014':`\xa3${e.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`,v=e=>new Date(`${e}T12:00:00Z`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'UTC'});function S(e){const t=t=>'number'==typeof e[t]?e[t]:null,s=(0,y.combinedTips)(e);return[['Gross',t('gross')],['card',t('card')],['cash',t('cash')],['tips',s],['food',t('food')],['drink',t('drink')]].filter(([,e])=>null!=e).map(([e,t])=>`${e} ${T(t)}`).join(', ')}function D({p:e,h:s}){const[o,l]=(0,a.useState)(e.startsWith('data:')?e:null);return(0,a.useEffect)(()=>{o||(0,k.photoUrl)(e).then(l)},[e]),o?(0,C.jsx)(r.default,{source:{uri:o},style:{width:'100%',height:s,borderRadius:10,backgroundColor:(0,t.soutersSurface)('#111')},resizeMode:"contain"}):(0,C.jsx)(d.default,{style:{height:s,borderRadius:10,backgroundColor:(0,t.soutersSurface)('#1B1A18'),alignItems:'center',justifyContent:'center'},children:(0,C.jsx)(u.Muted,{children:"Photo"})})}function I({draft:e,fields:t,onClose:o,onConfirm:l,keyLabel:n,onKey:r,keyChoices:i}){const{width:p,height:m}=(0,h.default)(),f=p>=820;e.only&&(t=t.filter(t=>e.only.includes(t.key)));const[x,k]=(0,a.useState)(()=>Object.fromEntries(t.map(t=>[t.key,(0,y.isBlank)(e.vals[t.key])?'':String(e.vals[t.key])]))),[j,b]=(0,a.useState)(()=>e.categories.map(e=>({name:e.name,amount:String(e.amount)}))),[w,T]=(0,a.useState)(!1),v=Object.fromEntries(t.map(e=>[e.key,'text'===e.kind?x[e.key]?.trim()||null:(0,y.parseAmount)(x[e.key]??'',e.kind)])),S=t.filter(e=>'text'!==e.kind&&(x[e.key]??'').trim()&&null==v[e.key]).map(e=>e.key),I=(0,y.missing)(t,v),P=j.map(e=>({name:e.name.trim(),amount:(0,y.parseAmount)(e.amount)})).filter(e=>e.name),M=P.some(e=>null==e.amount),$=e=>({minHeight:42,borderRadius:10,borderWidth:e?2:1,borderColor:e?c.colours.amber:'rgba(255,255,255,0.15)',backgroundColor:e?'rgba(232,168,56,0.08)':'#141312',color:c.colours.text,paddingHorizontal:10,fontSize:17}),B=(0,C.jsx)(d.default,{testID:"review-photos",style:{gap:8,flex:f?1:void 0},children:e.photos.length?e.photos.map((t,s)=>(0,C.jsx)(D,{p:t,h:f?Math.max(300,.62*m/Math.min(2,e.photos.length)):260},s)):(0,C.jsx)(u.Muted,{children:"No photo: typed by hand."})}),R=(0,C.jsxs)(d.default,{testID:"review-fields",style:{gap:8,flex:f?1:void 0},children:[(0,C.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,C.jsx)(u.Muted,{children:n}),i.map(t=>(0,C.jsx)(u.Chip,{label:t.label,selected:e.key===t.value,onPress:()=>r(t.value)},t.value))]}),t.map(e=>{const t='text'!==e.kind&&!(x[e.key]??'').trim()||S.includes(e.key);return(0,C.jsxs)(d.default,{style:{gap:3},children:[(0,C.jsxs)(u.Row,{gap:6,children:[(0,C.jsx)(u.T,{weight:"semibold",size:14,children:e.label}),t&&'text'!==e.kind?(0,C.jsx)(u.Badge,{kind:"amber",label:S.includes(e.key)?'Check this':'Not read: type it'}):null]}),(0,C.jsx)(s.TextInput,{testID:`review-${e.key}`,value:x[e.key]??'',onChangeText:t=>k(s=>({...s,[e.key]:t})),keyboardType:'text'===e.kind?'default':'decimal-pad',placeholder:'money'===e.kind?'\xa3':'number'===e.kind?'Number':'Optional',placeholderTextColor:"#777",style:$(t)})]},e.key)}),'sales'===e.kind?(0,C.jsxs)(d.default,{testID:"review-categories",style:{gap:6},children:[(0,C.jsx)(u.T,{weight:"semibold",size:14,children:"Sales by category (if the printout has them)"}),j.map((e,t)=>(0,C.jsxs)(u.Row,{gap:6,children:[(0,C.jsx)(s.TextInput,{value:e.name,onChangeText:e=>b(s=>s.map((s,a)=>a===t?{...s,name:e}:s)),placeholder:"e.g. Food",placeholderTextColor:"#777",style:[$(!1),{flex:2}]}),(0,C.jsx)(s.TextInput,{value:e.amount,onChangeText:e=>b(s=>s.map((s,a)=>a===t?{...s,amount:e}:s)),placeholder:"\xa3",placeholderTextColor:"#777",keyboardType:"decimal-pad",style:[$(!e.amount.trim()||null==(0,y.parseAmount)(e.amount)),{flex:1}]}),(0,C.jsx)(u.Button,{small:!0,kind:"ghost",label:"\u2715",accessibilityLabel:"Remove category",onPress:()=>b(e=>e.filter((e,s)=>s!==t))})]},t)),(0,C.jsx)(u.Button,{small:!0,kind:"secondary",testID:"review-add-cat",label:"Add a category",onPress:()=>b(e=>[...e,{name:'',amount:''}])})]}):null]});return(0,C.jsxs)(u.Sheet,{visible:!0,onClose:o,title:'cashup'===e.kind?'Check the cash up':'Check the weekly sales',maxWidth:1100,testID:"review-sheet",children:[(0,C.jsx)(u.Muted,{children:"Tip: check each figure against the photo. Nothing is saved until you tap Confirm. Amber boxes weren\u2019t read: type them, or leave them blank if the sheet doesn\u2019t have them."}),'edit'===e.reader||e.only?null:e.reader?(0,C.jsx)(u.Banner,{kind:"info",title:"Read from the photo",children:e.note}):e.photos.length?(0,C.jsx)(u.Banner,{kind:"info",title:"Type it from the photo",children:e.note}):null,f?(0,C.jsxs)(d.default,{style:{flexDirection:'row',gap:14},children:[B,R]}):(0,C.jsxs)(C.Fragment,{children:[B,R]}),I.length?(0,C.jsxs)(u.Muted,{children:[I.length," figure",1===I.length?'':'s'," still blank. Blank means \u201cnot on the sheet\u201d, never zero."]}):null,(0,C.jsxs)(u.Row,{gap:8,children:[(0,C.jsx)(u.Button,{testID:"review-confirm",label:w?'Saving\u2026':'Confirm and save',disabled:w||!!S.length||M||!t.some(e=>'text'!==e.kind&&null!=v[e.key]),onPress:async()=>{T(!0),await l(v,P.map(e=>({name:e.name,amount:e.amount}))),T(!1)}}),(0,C.jsx)(u.Button,{kind:"secondary",label:"Cancel",onPress:o})]})]})}function P({data:e,height:t=140,testID:s,fmt:a=T}){const o=Math.max(1,...e.map(e=>e.value??0));return(0,C.jsxs)(d.default,{testID:s,style:{gap:4},children:[(0,C.jsx)(d.default,{style:{flexDirection:'row',alignItems:'flex-end',gap:4,height:t},children:e.map((e,s)=>(0,C.jsxs)(d.default,{style:{flex:1,alignItems:'center',justifyContent:'flex-end',height:t},children:[null!=e.value?(0,C.jsx)(u.T,{size:9,colour:c.colours.muted,children:a(e.value).replace('.00','')}):null,(0,C.jsx)(d.default,{style:{width:'80%',height:null==e.value?2:Math.max(3,e.value/o*(t-16)),borderRadius:4,backgroundColor:null==e.value?'#333':e.hi?c.colours.goldLight:c.colours.gold,opacity:null==e.value?.6:1}})]},s))}),(0,C.jsx)(d.default,{style:{flexDirection:'row',gap:4},children:e.map((e,t)=>(0,C.jsx)(u.T,{size:9,colour:c.colours.muted,style:{flex:1,textAlign:'center'},children:e.label},t))})]})}function M({rid:e,today:s}){const a=(0,p.useCashUp)(e=>e.cashUps).filter(t=>t.rid===e),o=(0,p.useCashUp)(e=>e.sales).filter(t=>t.rid===e),l=(0,y.dailySeries)(a,s,14),n=(0,y.dailySeries)(a,s,14,y.combinedTips),r=(0,y.weekStartOf)(s),i=Array.from({length:8},(e,t)=>(0,y.addDaysYmd)(r,7*(t-7))).map(e=>{const t=o.find(t=>t.weekStart===e&&t.confirmedAt),s=t?.vals.net;return{label:v(e).split(' ').slice(1).join(' '),value:'number'==typeof s?s:null,hi:e===r}}),h=[...o].filter(e=>e.confirmedAt).sort((e,t)=>t.weekStart.localeCompare(e.weekStart))[0],m=h?(0,y.weekCompare)(o,h.weekStart):null,f=h?.categories??[],x=Math.max(1,...f.map(e=>e.amount)),k=h?(0,y.weekCompare)(o,h.weekStart,'covers'):null;return(0,C.jsxs)(d.default,{testID:"cash-charts",style:{gap:12},children:[(0,C.jsxs)(u.Card,{children:[(0,C.jsx)(u.T,{weight:"semibold",children:"Takings, last 14 days"}),(0,C.jsx)(u.Muted,{children:"Card + cash from confirmed cash ups. A grey line means no cash up that day."}),(0,C.jsx)(P,{testID:"chart-daily",data:l.map(e=>({label:v(e.date).split(' ')[1],value:e.value,hi:e.date===s}))})]}),(0,C.jsxs)(u.Card,{children:[(0,C.jsx)(u.T,{weight:"semibold",children:"Tips, last 14 days"}),(0,C.jsx)(u.Muted,{children:"Cash + card tips, team total."}),(0,C.jsx)(P,{testID:"chart-tips",height:100,data:n.map(e=>({label:v(e.date).split(' ')[1],value:e.value,hi:e.date===s}))})]}),(0,C.jsxs)(u.Card,{children:[(0,C.jsx)(u.T,{weight:"semibold",children:"Weekly net sales"}),m&&null!=m.now?(0,C.jsx)(d.default,{testID:"week-compare",children:(0,C.jsxs)(u.T,{size:15,children:["Week of ",v(h.weekStart),": ",T(m.now),null!=m.prev?` \xb7 week before ${T(m.prev)}`:'',null!=m.change?` \xb7 ${m.change>=0?'\u25b2':'\u25bc'} ${Math.abs(m.change)}%`:'']})}):(0,C.jsx)(u.Muted,{children:"No weekly sales report yet."}),k&&null!=k.now?(0,C.jsxs)(u.Muted,{children:["Covers ",k.now,null!=k.prev?` (week before ${k.prev})`:'']}):null,(0,C.jsx)(P,{testID:"chart-weekly",data:i})]}),f.length?(0,C.jsxs)(u.Card,{children:[(0,C.jsxs)(u.T,{weight:"semibold",children:["By category, week of ",v(h.weekStart)]}),(0,C.jsx)(d.default,{testID:"chart-categories",style:{gap:6},children:f.map(e=>(0,C.jsxs)(d.default,{style:{gap:2},children:[(0,C.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsx)(u.T,{size:14,children:e.name}),(0,C.jsx)(u.T,{size:14,colour:c.colours.goldLight,children:T(e.amount)})]}),(0,C.jsx)(d.default,{style:{height:10,borderRadius:5,backgroundColor:(0,t.soutersSurface)('#2A2826')},children:(0,C.jsx)(d.default,{style:{width:e.amount/x*100+"%",height:10,borderRadius:5,backgroundColor:c.colours.gold}})})]},e.name))})]}):null]})}function $({n:e,testID:t}){const s=Math.max(1,Math.min(14,e));return(0,C.jsx)(d.default,{testID:t,style:{width:64,height:114,justifyContent:'flex-end'},children:Array.from({length:s}).map((e,t)=>(0,C.jsx)(B,{delay:50*t},t))})}function B({delay:e}){const t=(0,a.useRef)(new l.default.Value(1)).current;return(0,a.useEffect)(()=>{l.default.timing(t,{toValue:0,duration:420,delay:e,easing:n.default.out(n.default.back(1.6)),useNativeDriver:!1}).start()},[]),(0,C.jsx)(l.default.View,{style:{height:7,transform:[{translateY:t.interpolate({inputRange:[0,1],outputRange:[0,-120]})}],opacity:t.interpolate({inputRange:[0,1],outputRange:[1,0]})},children:(0,C.jsx)(d.default,{style:{width:60,height:12,borderRadius:30,backgroundColor:c.colours.gold,borderWidth:1,borderColor:c.colours.goldLight}})})}function R(e){const[t,s]=(0,a.useState)(e),o=(0,a.useRef)(e);return(0,a.useEffect)(()=>{const t=o.current,a=e;if(t===a)return;const l=Date.now(),n=setInterval(()=>{const e=Math.min(1,(Date.now()-l)/1200);s(Math.round(100*(t+(a-t)*(1-Math.pow(1-e,3))))/100),e>=1&&(clearInterval(n),o.current=a)},40);return()=>clearInterval(n)},[e]),t}function U({rid:e,today:t,manage:s,who:o,big:l}){const n=(0,p.useTipsShow)(e),r=(0,p.useCashUp)(e=>e.tips).filter(t=>t.rid===e),i=(0,p.useCashUp)(e=>e.pot).filter(t=>t.rid===e),h=(0,f.useVenuePay)(e).pay,x=(0,m.tipsPeriod)(h,t),k=(0,a.useMemo)(()=>(0,y.tipsPot)(r,i,x.start,t),[r,i,x.start,t]),j=R(k.total),[b,w]=(0,a.useState)(null);return n.showPot||s?(0,C.jsxs)(u.Card,{highlight:c.colours.gold,children:[(0,C.jsxs)(d.default,{testID:"tips-pot",style:{flexDirection:'row',alignItems:'center',gap:14},children:[(0,C.jsx)($,{n:Math.ceil(k.total/100),testID:"tips-pot-coins"},k.total),(0,C.jsxs)(d.default,{style:{flex:1,gap:2},children:[(0,C.jsx)(u.T,{size:12,weight:"semibold",colour:c.colours.gold,style:{letterSpacing:1.5},children:"TIPS POT"}),(0,C.jsx)(u.T,{size:l?40:32,weight:"bold",colour:c.colours.goldLight,children:T(j)}),(0,C.jsxs)(u.Muted,{children:["Tips held for the team since ",v(k.from),x.payday?` \xb7 next tip payday ${v(x.payday)}`:'',". Confirmed cash ups only.",n.showPot?'':' (Hidden from staff.)']})]})]}),s?(0,C.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,C.jsx)(u.Button,{small:!0,kind:"secondary",testID:"pot-payout",label:"Mark payout done",onPress:()=>w('payout')}),(0,C.jsx)(u.Button,{small:!0,kind:"ghost",testID:"pot-correct",label:"Correct an entry",onPress:()=>w('correct')}),(0,C.jsx)(u.Button,{small:!0,kind:"ghost",testID:"pot-history",label:"Past pots",onPress:()=>w('history')})]}):null,'payout'===b?(0,C.jsxs)(u.Sheet,{visible:!0,onClose:()=>w(null),title:"Mark payout done",maxWidth:520,testID:"pot-payout-sheet",children:[(0,C.jsxs)(u.T,{children:["Pay out ",T(k.total)," (tips from ",v(k.from)," to ",v(t),")?"]}),(0,C.jsx)(u.Muted,{children:"The pot goes back to \xa30.00 for the next period. This is logged and kept in Past pots. No money is moved by the app."}),(0,C.jsx)(u.Button,{testID:"pot-payout-confirm",label:"Yes, payout done",onPress:()=>{p.useCashUp.getState().addPotEvent({rid:e,kind:'payout',throughDate:t,amount:k.total,by:o?.name??'Manager'}),w(null)}})]}):null,'correct'===b?(0,C.jsx)(L,{rid:e,today:t,who:o,onClose:()=>w(null)}):null,'history'===b?(0,C.jsxs)(u.Sheet,{visible:!0,onClose:()=>w(null),title:"Past pots and corrections",maxWidth:560,testID:"pot-history-sheet",children:[k.history.length||i.some(e=>'correction'===e.kind)?null:(0,C.jsx)(u.Muted,{children:"No payouts or corrections yet."}),i.slice().sort((e,t)=>t.at.localeCompare(e.at)).map(e=>(0,C.jsxs)(d.default,{style:{paddingVertical:4},children:[(0,C.jsx)(u.T,{weight:"semibold",children:'payout'===e.kind?`Paid out ${T(e.amount)}`:`Correction ${e.amount>=0?'+':'\u2212'}${T(Math.abs(e.amount))} for ${v(e.forDate)}`}),(0,C.jsxs)(u.Muted,{children:['payout'===e.kind?`Tips to ${v(e.throughDate)}`:`\u201c${e.reason}\u201d`," \xb7 ",e.by," \xb7 ",new Date(e.at).toLocaleString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})]})]},e.id))]}):null]}):null}function L({rid:e,today:o,who:l,onClose:n}){const[r,i]=(0,a.useState)(o),[d,h]=(0,a.useState)(''),[m,f]=(0,a.useState)(''),x=(0,y.parseAmount)(d),k={minHeight:42,borderRadius:10,borderWidth:1,borderColor:'rgba(255,255,255,0.15)',backgroundColor:(0,t.soutersSurface)('#141312'),color:c.colours.text,paddingHorizontal:10,fontSize:16};return(0,C.jsxs)(u.Sheet,{visible:!0,onClose:n,title:"Correct an entry",maxWidth:520,testID:"pot-correct-sheet",children:[(0,C.jsx)(u.Muted,{children:"Tip: add or take off an amount for a day (use a minus for less, e.g. -5). Every correction is logged with your name and the reason."}),(0,C.jsx)(u.Row,{wrap:!0,gap:6,children:[0,1,2,3].map(e=>{const t=(0,y.addDaysYmd)(o,-e);return(0,C.jsx)(u.Chip,{label:0===e?'Today':v(t),selected:r===t,onPress:()=>i(t)},t)})}),(0,C.jsx)(s.TextInput,{testID:"pot-correct-amount",value:d,onChangeText:h,placeholder:"\xa3 e.g. -5.00",placeholderTextColor:"#777",keyboardType:"numbers-and-punctuation",style:k}),(0,C.jsx)(s.TextInput,{testID:"pot-correct-reason",value:m,onChangeText:f,placeholder:"Reason (required)",placeholderTextColor:"#777",maxLength:200,style:k}),(0,C.jsx)(u.Button,{testID:"pot-correct-save",label:"Save correction",disabled:null==x||0===x||!m.trim(),onPress:()=>{p.useCashUp.getState().addPotEvent({rid:e,kind:'correction',forDate:r,amount:x,reason:m.trim(),by:l?.name??'Manager'}),n()}})]})}},996,[868,877,30,118,120,224,196,263,127,287,813,821,1076,1117,1249,1250,947,1257,1261,1262,1265,24]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useCashAccess",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"hasCashUpAccess",{enumerable:!0,get:function(){return n}});const t=(0,r(d[0]).create)(()=>({byRef:{},mine:null,loaded:!1})),n=()=>!0===t.getState().mine},997,[952]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"fmtDate",{enumerable:!0,get:function(){return m}}),_e.SignOffLine=b,_e.CardView=w,_e.CardEditor=I,_e.RecipeCards=function({rid:e,actor:n,mode:d}){const f=(0,o.useRecipeCards)(e),[j,b]=(0,t.useState)(''),[C,k]=(0,t.useState)([]),[D,v]=(0,t.useState)('free-from'),[T,S]=(0,t.useState)('all'),[B,$]=(0,t.useState)(null),[P,R]=(0,t.useState)(null),L='edit'===d&&(0,h.canEditCards)(n.role),A=L?f:f.filter(e=>!!e.signOff),M=(0,t.useMemo)(()=>{const e='all'===T?A:A.filter(e=>(0,h.cardState)(e)===T);return(0,h.filterCards)(e,j,C,D).slice().sort((e,s)=>e.section.localeCompare(s.section)||e.dish.localeCompare(s.dish))},[A,j,C,D,T]),E=f.filter(e=>!e.signOff).length,N=B?f.find(e=>e.id===B):void 0,O=P&&'new'!==P?f.find(e=>e.id===P)??null:null,H=e=>k(s=>s.includes(e)?s.filter(s=>s!==e):[...s,e]);return(0,p.jsxs)(l.default,{testID:"recipe-cards",style:{gap:12},children:['read'===d?(0,p.jsx)(a.Banner,{kind:"info",title:"Read-only",children:"Signed-off recipe cards only. The head chef keeps these up to date."}):(0,p.jsx)(a.Muted,{children:(0,h.canSignOffCards)(n.role)?'You can add, edit and sign off cards. A card only goes live once you sign it off; any edit sets it back to Awaiting sign-off.':'You can add and edit cards. The head chef signs them off before they go live; any edit sets a card back to Awaiting sign-off.'}),f.some(e=>'example'===e.origin)?(0,p.jsx)(a.Banner,{kind:"example",title:"Example data",children:"Cards marked \u201cExample data\u201d are made-up examples to show how recipe cards work. Replace them with your own dishes."}):null,L?(0,p.jsx)(a.Button,{testID:"new-card",label:"New recipe card",onPress:()=>R('new')}):null,(0,p.jsx)(s.TextInput,{testID:"card-search",accessibilityLabel:"Search recipe cards",value:j,onChangeText:b,placeholder:"Search dishes or ingredients",placeholderTextColor:"#7D776C",style:a.styles.input}),(0,p.jsxs)(a.Row,{gap:6,wrap:!0,children:[(0,p.jsx)(a.T,{size:r.font.small,colour:r.colours.muted,children:"Allergens:"}),(0,p.jsx)(a.Chip,{label:"Free from",selected:'free-from'===D,onPress:()=>v('free-from')}),(0,p.jsx)(a.Chip,{label:"Contains",selected:'contains'===D,onPress:()=>v('contains')}),C.length?(0,p.jsx)(a.Chip,{label:"Clear",onPress:()=>k([])}):null]}),(0,p.jsx)(a.Row,{gap:6,wrap:!0,children:c.ALLERGENS.map(e=>(0,p.jsx)(i.default,{testID:`filter-${e.id}`,accessibilityRole:"button",accessibilityState:{selected:C.includes(e.id)},onPress:()=>H(e.id),style:{paddingVertical:5,paddingHorizontal:10,minHeight:44,minWidth:44,justifyContent:'center',borderRadius:14,borderWidth:1,borderColor:C.includes(e.id)?r.colours.gold:r.colours.border,backgroundColor:C.includes(e.id)?r.colours.gold:'transparent'},children:(0,p.jsx)(a.T,{size:13,colour:C.includes(e.id)?r.colours.onGold:r.colours.text,children:e.short})},e.id))}),L?(0,p.jsxs)(a.Row,{gap:6,wrap:!0,children:[(0,p.jsx)(a.Chip,{label:`All (${f.length})`,selected:'all'===T,onPress:()=>S('all')}),(0,p.jsx)(a.Chip,{label:`Awaiting sign-off (${E})`,selected:'awaiting'===T,onPress:()=>S('awaiting')}),(0,p.jsx)(a.Chip,{label:`Signed off (${f.length-E})`,selected:'signed-off'===T,onPress:()=>S('signed-off')})]}):null,(0,p.jsx)(l.default,{testID:"card-count",children:(0,p.jsxs)(a.Muted,{children:[M.length," ",1===M.length?'card':'cards',C.length?` ${'free-from'===D?'free from':'containing'} ${C.map(c.allergenLabel).join('free-from'===D?' and ':' or ')}`:'']})}),M.map(e=>(0,p.jsx)(i.default,{testID:`card-${e.menuItemId}`,accessibilityRole:"button",accessibilityLabel:`${e.dish}, ${e.signOff?'signed off':'awaiting sign-off'}`,onPress:()=>$(e.id),children:(0,p.jsx)(a.Card,{highlight:!e.signOff&&L?r.colours.amber:void 0,children:(0,p.jsxs)(a.Row,{gap:12,style:{alignItems:'flex-start'},children:[(0,p.jsx)(l.default,{style:{width:84},children:(0,p.jsx)(y,{card:e,height:64})}),(0,p.jsxs)(l.default,{style:{flex:1,gap:4},children:[(0,p.jsx)(a.T,{weight:"semibold",children:e.dish}),(0,p.jsxs)(a.Muted,{children:[e.section," \xb7 ",x(e.price),'example'===e.origin?` \xb7 ${u.EXAMPLE_TAG}`:'']}),(0,p.jsxs)(a.Row,{gap:4,wrap:!0,children:[e.signOff?(0,p.jsx)(a.Badge,{label:`\u2713 ${m(e.signOff.at)}`,kind:"ok"}):(0,p.jsx)(a.Badge,{label:h.STATE_LABEL.awaiting,kind:"amber"}),c.ALLERGENS.filter(s=>e.allergens[s.id]).map(s=>(0,p.jsx)(a.Badge,{label:'may'===e.allergens[s.id]?`${s.short}?`:s.short,kind:'may'===e.allergens[s.id]?'amber':'red'},s.id))]})]})]})})},e.id)),M.length?null:(0,p.jsx)(a.Muted,{children:"No cards match."}),(0,p.jsx)(a.Sheet,{visible:!!N&&!P,onClose:()=>$(null),title:N?.dish??'',maxWidth:640,testID:"card-sheet",children:N?(0,p.jsx)(w,{card:N,actor:'read'===d?{...n,role:'staff'}:n,onEdit:L?()=>R(N.id):void 0}):null}),(0,p.jsx)(a.Sheet,{visible:!!P,onClose:()=>R(null),title:'new'===P?'New recipe card':`Edit: ${O?.dish??''}`,maxWidth:680,testID:"editor-sheet",children:P?(0,p.jsx)(I,{rid:e,card:O,actor:n,onDone:e=>{R(null),$(e)}},P):null})]})};var s=_r(_d[0]),t=_r(_d[1]),n=e(_r(_d[2])),i=e(_r(_d[3])),l=e(_r(_d[4])),r=_r(_d[5]),a=_r(_d[6]),o=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),u=_r(_d[11]),f=_r(_d[12]),p=_r(_d[13]);const m=e=>{const s=new Date(e.length<=10?`${e}T12:00:00`:e);return isNaN(+s)?e:s.toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric'})},x=e=>null==e?'Price on the board':`\xa3${(e/100).toFixed(2)}`,j={example:u.EXAMPLE_TAG,imported:'Imported from the menu',new:null};function b({card:e,testID:s}){return e.signOff?(0,p.jsxs)(l.default,{testID:s,style:{gap:2},children:[(0,p.jsx)(a.Badge,{label:`\u2713 ${h.STATE_LABEL['signed-off']}`,kind:"ok"}),(0,p.jsxs)(a.T,{size:r.font.small,colour:r.colours.ok,children:["Signed off by ",e.signOff.by," on ",m(e.signOff.at)]})]}):(0,p.jsxs)(l.default,{testID:s,style:{gap:2},children:[(0,p.jsx)(a.Badge,{label:h.STATE_LABEL.awaiting,kind:"amber"}),(0,p.jsx)(a.T,{size:r.font.small,colour:r.colours.amber,children:e.wasLive?'Edited since the last sign-off. The dish shows "awaiting allergen sign-off" to guests and cannot be ordered until the head chef signs it off.':'New dish: it stays off the menu until the head chef signs it off.'})]})}function y({card:e,height:s=180,pending:t}){const i=t?{uri:t}:e.photo?(0,d.recipeCards)().photoSource(e.photo):null;return i?(0,p.jsx)(n.default,{testID:"card-photo",accessibilityLabel:`Plating photo: ${e.dish}`,source:i,style:{width:'100%',height:s,borderRadius:12,backgroundColor:r.colours.surface2},resizeMode:"cover"}):(0,p.jsx)(l.default,{style:{height:s,borderRadius:12,backgroundColor:r.colours.surface2,alignItems:'center',justifyContent:'center',borderWidth:1,borderColor:r.colours.border},children:(0,p.jsx)(a.Muted,{children:"No plating photo yet"})})}function C({map:e}){const s=c.ALLERGENS.filter(s=>e[s.id]).map(e=>e.id);return s.length?(0,p.jsx)(a.Row,{wrap:!0,gap:6,children:s.map(s=>(0,p.jsx)(a.Badge,{label:'may'===e[s]?`May contain ${(0,c.allergenLabel)(s).toLowerCase()}`:(0,c.allergenLabel)(s),kind:'may'===e[s]?'amber':'red'},s))}):(0,p.jsx)(a.Muted,{children:"None of the UK 14 allergens."})}function w({card:e,actor:s,onEdit:n}){const[i,o]=(0,t.useState)(null),c=(0,h.signOffBlock)(e),u=j[e.origin];return(0,p.jsxs)(l.default,{testID:"card-view",style:{gap:12},children:[(0,p.jsx)(y,{card:e,height:200}),(0,p.jsxs)(a.Row,{wrap:!0,gap:6,children:[u?(0,p.jsx)(a.Badge,{label:u,kind:'example'===e.origin?'blue':'neutral'}):null,(0,p.jsx)(a.Badge,{label:e.section,kind:"gold"}),(0,p.jsx)(a.Badge,{label:x(e.price)})]}),(0,p.jsx)(b,{card:e,testID:"card-status"}),(0,p.jsx)(a.Divider,{}),(0,p.jsx)(a.H2,{children:"Allergens"}),(0,p.jsx)(l.default,{testID:"card-allergens",children:(0,p.jsx)(C,{map:e.allergens})}),e.allergenNotes?(0,p.jsx)(a.Muted,{children:e.allergenNotes}):null,e.allergensConfirmed?(0,p.jsxs)(a.Muted,{children:["Allergen list confirmed by ",e.allergensConfirmed.by," on ",m(e.allergensConfirmed.at),"."]}):null,(0,p.jsx)(a.Divider,{}),(0,p.jsx)(a.H2,{children:"Ingredients"}),e.ingredients.length?e.ingredients.map(e=>(0,p.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(a.T,{style:{flex:1},children:e.name}),(0,p.jsx)(a.T,{colour:r.colours.goldLight,children:[e.qty,e.unit].filter(Boolean).join(' ')})]},e.id)):(0,p.jsx)(a.Muted,{children:"No ingredients on this card yet."}),(0,p.jsx)(a.Divider,{}),(0,p.jsx)(a.H2,{children:"Method"}),e.steps.length?e.steps.map((e,s)=>(0,p.jsxs)(a.Row,{gap:10,style:{alignItems:'flex-start'},children:[(0,p.jsx)(l.default,{style:{width:26,height:26,borderRadius:13,backgroundColor:r.colours.goldTint,alignItems:'center',justifyContent:'center'},children:(0,p.jsx)(a.T,{size:r.font.small,colour:r.colours.gold,children:s+1})}),(0,p.jsx)(a.T,{style:{flex:1},children:e})]},s)):(0,p.jsxs)(a.Muted,{children:["No method yet.",(0,h.canEditCards)(s.role)?' Tap Edit to add the steps.':'']}),(0,p.jsxs)(a.Muted,{children:["Version ",e.version," \xb7 last changed ",m(e.updatedAt)," by ",e.updatedBy]}),(0,h.canEditCards)(s.role)&&n?(0,p.jsx)(a.Button,{testID:"edit-card",kind:"secondary",label:"Edit card",onPress:n}):null,(0,h.canSignOffCards)(s.role)&&!e.signOff?(0,p.jsxs)(l.default,{style:{gap:6},children:[c?(0,p.jsx)(a.Banner,{kind:"warn",title:"Not ready to sign off",children:c}):null,(0,p.jsx)(a.Button,{testID:"sign-off",kind:"success",label:`Sign off as ${s.name}`,disabled:!!c,onPress:async()=>{try{await(0,d.recipeCards)().signOff(e.id,s),o(null)}catch(e){o(e?.message??'Could not sign off.')}}})]}):null,!(0,h.canEditCards)(s.role)||(0,h.canSignOffCards)(s.role)||e.signOff?null:(0,p.jsx)(a.Banner,{kind:"info",title:"Head chef sign-off",children:"Only the head chef can sign off a recipe card, in the Head Chef app."}),i?(0,p.jsx)(a.Banner,{kind:"danger",children:i}):null]})}const k=()=>`i-${Math.random().toString(36).slice(2,9)}`,D=(e,s)=>e?{id:e.id,dish:e.dish,section:e.section,price:null==e.price?'':(e.price/100).toFixed(2),description:'',ingredients:e.ingredients.map(e=>({...e})),steps:[...e.steps],allergens:{...e.allergens},dismissed:[...e.dismissed],allergenNotes:e.allergenNotes??'',photo:e.photo,pending:null,confirm:!!e.allergensConfirmed}:{id:(0,h.uuid)(),dish:'',section:s,price:'',description:'',ingredients:[{id:k(),name:'',qty:'',unit:''}],steps:[''],allergens:{},dismissed:[],allergenNotes:'',pending:null,confirm:!1},v=e=>{const s=e.replace(/[\xa3\s]/g,'');if(!s)return null;const t=Number(s);return isFinite(t)&&t>=0?Math.round(100*t):'bad'};function I({rid:e,card:n,actor:u,onDone:m}){const x=(0,o.useRestaurant)(e),j=x?.sections??['Mains'],[b,C]=(0,t.useState)(()=>D(n,j[0]??'Mains')),[w,I]=(0,t.useState)(null),[T,S]=(0,t.useState)(null),[B,$]=(0,t.useState)(!1),P=e=>C(s=>({...s,...e})),R=b.ingredients.filter(e=>e.name.trim()),L={ingredients:R,allergens:b.allergens,dismissed:b.dismissed},A=(0,h.suggestAllergens)(R),M=(0,h.unresolved)(L),E=e=>{const s=b.allergens[e],t={...b.allergens};s?'contains'===s?t[e]='may':delete t[e]:t[e]='contains',P({allergens:t,dismissed:b.dismissed.filter(s=>s!==e),confirm:!1})},N=e=>{const s={...b.allergens};delete s[e],P({allergens:s,dismissed:[...new Set([...b.dismissed,e])],confirm:!1})},O=(e,s)=>P({ingredients:b.ingredients.map((t,n)=>n===e?{...t,...s}:t),confirm:!1}),H=(e,s)=>P({steps:b.steps.map((t,n)=>n===e?s:t)}),F=(e,s)=>{const t=[...b.steps],n=e+s;n<0||n>=t.length||([t[e],t[n]]=[t[n],t[e]],P({steps:t}))},_=async e=>{S(null);try{const s=await(0,f.capturePlatingPhoto)(e);s&&(P({pending:s}),S(`Compressed on this device: ${s.width}\xd7${s.height}, ${(0,f.kb)(s.bytes)}${s.originalBytes?` (was ${(0,f.kb)(s.originalBytes)})`:''}.`))}catch(e){S(e?.message??'Could not read that photo.')}},[z,W]=(0,t.useState)(!1),G=n??{id:b.id,dish:b.dish,photo:b.photo};return(0,p.jsxs)(l.default,{testID:"card-editor",style:{gap:12},children:[n?.signOff?(0,p.jsx)(a.Banner,{kind:"warn",title:"Saving a change resets the sign-off",children:"This card is signed off. Any change you save sets it back to \"Awaiting sign-off\" until the head chef signs it off again."}):null,(0,p.jsx)(a.Field,{testID:"dish-name",label:"Dish name",value:b.dish,onChangeText:e=>P({dish:e}),placeholder:"e.g. Cullen skink"}),n?null:(0,p.jsx)(a.Field,{testID:"dish-description",label:"Menu description (optional)",value:b.description,onChangeText:e=>P({description:e}),placeholder:"What guests read on the menu"}),(0,p.jsx)(a.T,{size:r.font.small,weight:"medium",colour:r.colours.muted,children:"Menu section"}),(0,p.jsx)(a.Row,{wrap:!0,gap:6,children:j.map(e=>(0,p.jsx)(a.Chip,{label:e,selected:b.section===e,onPress:()=>P({section:e})},e))}),(0,p.jsx)(a.Field,{testID:"dish-price",label:"Price (\xa3)",value:b.price,onChangeText:e=>P({price:e}),placeholder:"Blank = price on the board",keyboardType:"decimal-pad"}),(0,p.jsx)(a.Divider,{}),(0,p.jsx)(a.H2,{children:"Plating photo"}),(0,p.jsx)(y,{card:G,pending:b.pending?.dataUrl??null,height:170}),(0,p.jsxs)(a.Row,{gap:8,wrap:!0,children:[(0,p.jsx)(a.Button,{testID:"photo-camera",small:!0,kind:"secondary",label:b.pending||b.photo?'Retake photo':'Take photo',onPress:()=>_('camera')}),(0,p.jsx)(a.Button,{testID:"photo-library",small:!0,kind:"secondary",label:b.pending||b.photo?'Replace photo':'Choose photo',onPress:()=>_('library')}),b.pending||b.photo?(0,p.jsx)(a.Button,{testID:"photo-remove",small:!0,kind:"ghost",label:"Remove photo",onPress:()=>P({pending:null,photo:void 0})}):null]}),T?(0,p.jsx)(l.default,{testID:"photo-info",children:(0,p.jsx)(a.Muted,{children:T})}):(0,p.jsx)(a.Muted,{children:'shared'===(0,d.recipeCards)().mode?'Photos are shrunk on this device, then shared with the team. Staff and guests only see the photo once the card is signed off.':'Photos are shrunk on this device before they are saved.'}),(0,p.jsx)(a.Divider,{}),(0,p.jsx)(a.H2,{children:"Ingredients"}),(0,p.jsx)(a.Muted,{children:"Quantity, unit and ingredient. We suggest allergens from the ingredient names."}),b.ingredients.map((e,t)=>{const n=e.name.trim()?(0,h.suggestAllergens)([e]):[];return(0,p.jsxs)(l.default,{style:{gap:4},children:[(0,p.jsxs)(a.Row,{gap:6,children:[(0,p.jsx)(s.TextInput,{testID:`ing-qty-${t}`,accessibilityLabel:`Quantity ${t+1}`,value:e.qty,onChangeText:e=>O(t,{qty:e}),placeholder:"Qty",placeholderTextColor:"#7D776C",style:[a.styles.input,{width:64}]}),(0,p.jsx)(s.TextInput,{testID:`ing-unit-${t}`,accessibilityLabel:`Unit ${t+1}`,value:e.unit,onChangeText:e=>O(t,{unit:e}),placeholder:"g / ml / each",placeholderTextColor:"#7D776C",style:[a.styles.input,{width:92}]}),(0,p.jsx)(s.TextInput,{testID:`ing-name-${t}`,accessibilityLabel:`Ingredient ${t+1}`,value:e.name,onChangeText:e=>O(t,{name:e}),placeholder:"Ingredient",placeholderTextColor:"#7D776C",style:[a.styles.input,{flex:1}]}),(0,p.jsx)(i.default,{accessibilityLabel:`Remove ingredient ${t+1}`,onPress:()=>P({ingredients:b.ingredients.filter((e,s)=>s!==t)}),hitSlop:8,children:(0,p.jsx)(a.T,{colour:r.colours.muted,children:"\u2715"})})]}),n.length?(0,p.jsxs)(a.Muted,{children:["Suggests: ",n.map(c.allergenLabel).join(', ')]}):null]},e.id)}),(0,p.jsx)(a.Button,{testID:"ing-add",small:!0,kind:"ghost",label:"Add ingredient",onPress:()=>P({ingredients:[...b.ingredients,{id:k(),name:'',qty:'',unit:''}]})}),(0,p.jsx)(a.Divider,{}),(0,p.jsx)(a.H2,{children:"Method"}),b.steps.map((e,t)=>(0,p.jsxs)(a.Row,{gap:6,style:{alignItems:'flex-start'},children:[(0,p.jsx)(a.T,{colour:r.colours.gold,style:{width:20,paddingTop:10},children:t+1}),(0,p.jsx)(s.TextInput,{testID:`step-${t}`,accessibilityLabel:`Step ${t+1}`,value:e,onChangeText:e=>H(t,e),multiline:!0,placeholder:"Describe this step",placeholderTextColor:"#7D776C",style:[a.styles.input,{flex:1,minHeight:56,textAlignVertical:'top'}]}),(0,p.jsxs)(l.default,{style:{gap:4},children:[(0,p.jsx)(i.default,{accessibilityLabel:`Move step ${t+1} up`,onPress:()=>F(t,-1),hitSlop:6,children:(0,p.jsx)(a.T,{colour:r.colours.muted,children:"\u25b2"})}),(0,p.jsx)(i.default,{accessibilityLabel:`Move step ${t+1} down`,onPress:()=>F(t,1),hitSlop:6,children:(0,p.jsx)(a.T,{colour:r.colours.muted,children:"\u25bc"})}),(0,p.jsx)(i.default,{accessibilityLabel:`Remove step ${t+1}`,onPress:()=>P({steps:b.steps.filter((e,s)=>s!==t)}),hitSlop:6,children:(0,p.jsx)(a.T,{colour:r.colours.muted,children:"\u2715"})})]})]},t)),(0,p.jsx)(a.Button,{testID:"step-add",small:!0,kind:"ghost",label:"Add step",onPress:()=>P({steps:[...b.steps,'']})}),(0,p.jsx)(a.Divider,{}),(0,p.jsx)(a.H2,{children:"Allergens (UK 14)"}),(0,p.jsx)(a.Muted,{children:"Tap to cycle: contains \u2192 may contain \u2192 none. Suggested allergens are marked \u201c?\u201d until you add or rule them out."}),M.length?(0,p.jsxs)(l.default,{testID:"allergen-suggestions",style:{gap:6},children:[(0,p.jsx)(a.Banner,{kind:"warn",title:`Check ${M.length} suggested allergen${1===M.length?'':'s'}`,children:M.map(e=>`${(0,c.allergenLabel)(e)} (from ${(0,h.suggestedBy)(R,e).join(', ')})`).join('; ')}),M.map(e=>(0,p.jsxs)(a.Row,{gap:6,wrap:!0,children:[(0,p.jsx)(a.T,{style:{flex:1},children:(0,c.allergenLabel)(e)}),(0,p.jsx)(a.Button,{testID:`suggest-add-${e}`,small:!0,label:"Contains",onPress:()=>P({allergens:{...b.allergens,[e]:'contains'},confirm:!1})}),(0,p.jsx)(a.Button,{testID:`suggest-may-${e}`,small:!0,kind:"secondary",label:"May contain",onPress:()=>P({allergens:{...b.allergens,[e]:'may'},confirm:!1})}),(0,p.jsx)(a.Button,{testID:`suggest-dismiss-${e}`,small:!0,kind:"ghost",label:"Not in this dish",onPress:()=>N(e)})]},e)),(0,p.jsx)(a.Button,{testID:"apply-suggestions",small:!0,kind:"secondary",label:"Add all suggestions as \u2018contains\u2019",onPress:()=>{const e={...b.allergens};M.forEach(s=>{e[s]='contains'}),P({allergens:e,confirm:!1})}})]}):null,(0,p.jsx)(a.Row,{wrap:!0,gap:6,children:c.ALLERGENS.map(e=>{const s=b.allergens[e.id],t=A.includes(e.id)&&!s&&!b.dismissed.includes(e.id),n='contains'===s?r.colours.redBg:'may'===s?r.colours.amberBg:r.colours.surface2,l='contains'===s?r.colours.red:'may'===s?r.colours.amber:t?r.colours.gold:r.colours.border;return(0,p.jsx)(i.default,{testID:`allergen-${e.id}`,accessibilityRole:"button",accessibilityLabel:`${e.short}: ${'contains'===s?'contains':'may'===s?'may contain':'not marked'}`,onPress:()=>E(e.id),style:{paddingVertical:6,paddingHorizontal:10,borderRadius:16,borderWidth:t?2:1,borderStyle:t?'dashed':'solid',borderColor:l,backgroundColor:n},children:(0,p.jsxs)(a.T,{size:r.font.small,colour:'contains'===s?'#FFD9D4':'may'===s?'#FFE2A8':r.colours.text,children:[e.short,'may'===s?' (may)':'',t?' ?':'']})},e.id)})}),b.dismissed.length?(0,p.jsxs)(a.Muted,{children:["Ruled out: ",b.dismissed.map(c.allergenLabel).join(', ')]}):null,(0,p.jsx)(a.Field,{testID:"allergen-notes",label:"Allergen notes (optional)",value:b.allergenNotes,onChangeText:e=>P({allergenNotes:e}),placeholder:"e.g. Cooked in the shared fryer"}),(0,p.jsxs)(i.default,{testID:"confirm-allergens",accessibilityRole:"checkbox",accessibilityState:{checked:b.confirm,disabled:M.length>0},disabled:M.length>0,onPress:()=>P({confirm:!b.confirm}),style:{flexDirection:'row',gap:10,alignItems:'center',padding:10,borderRadius:10,borderWidth:1,borderColor:b.confirm?r.colours.ok:r.colours.border,opacity:M.length?.5:1},children:[(0,p.jsx)(l.default,{style:{width:22,height:22,borderRadius:4,borderWidth:2,borderColor:b.confirm?r.colours.ok:r.colours.muted,alignItems:'center',justifyContent:'center',backgroundColor:b.confirm?r.colours.okBg:'transparent'},children:b.confirm?(0,p.jsx)(a.T,{colour:r.colours.ok,children:"\u2713"}):null}),(0,p.jsx)(a.T,{style:{flex:1},children:M.length?'Check the suggested allergens above first':`I have checked the allergen list against the ingredients (${u.name})`})]}),w?(0,p.jsx)(a.Banner,{kind:"danger",children:w}):null,(0,p.jsx)(a.Button,{testID:"card-save",label:z?'Saving\u2026':n?'Save changes':'Save card',disabled:z,onPress:async()=>{I(null);const s=v(b.price);if(!b.dish.trim())return I('Give the dish a name.');if('bad'===s)return I('Price should be in pounds, e.g. 14.50 (or leave it blank for "price on the board").');const t=(0,d.recipeCards)();W(!0);try{let i=b.photo;b.pending&&(i=await t.savePhoto(e,b.id,b.pending));const l=b.steps.map(e=>e.trim()).filter(Boolean),r={dish:b.dish.trim(),section:b.section,price:s,ingredients:R.map(e=>({...e,name:e.name.trim(),qty:e.qty.trim(),unit:e.unit.trim()})),steps:l,allergens:b.allergens,dismissed:b.dismissed,allergenNotes:b.allergenNotes.trim()||void 0,photo:i};if(n)await t.update(n.id,{...r,confirmAllergens:b.confirm},u),m(n.id);else{const s=await t.create(e,{...r,id:b.id,description:b.description.trim()||void 0},u);b.confirm&&await t.update(s.id,{confirmAllergens:!0},u),m(s.id)}}catch(e){I(e?.message??'Could not save the card.')}finally{W(!1)}}}),(0,p.jsx)(a.Muted,{children:(0,h.canSignOffCards)(u.role)?'After saving, sign the card off so it goes live.':'After saving, the head chef signs it off in the Head Chef app before it goes live.'}),n?B?(0,p.jsxs)(a.Row,{gap:8,children:[(0,p.jsx)(a.Button,{testID:"card-delete-yes",small:!0,kind:"danger",label:"Yes, remove this dish",onPress:async()=>{if(n)try{await(0,d.recipeCards)().remove(n.id,u),m(null)}catch(e){I(e?.message??'Could not remove the card.')}}}),(0,p.jsx)(a.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>$(!1)})]}):(0,p.jsx)(a.Button,{testID:"card-delete",small:!0,kind:"ghost",label:"Remove card and dish from the menu",onPress:()=>$(!0)}):null]})}},998,[877,30,196,263,127,821,813,819,831,814,1103,1108,1272,24]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useHrSettings",{enumerable:!0,get:function(){return f}}),_e.MoraleScale=b,_e.StaffingSlider=j,_e.ShiftCheckout=function({rid:e,shiftKey:o,day:a,meId:d,onClose:y}){const w=f(e),S=w.wording,k=(0,i.useOwner)(e=>e.staff),C=(0,i.useOwner)(e=>e.attendance),[v,T]=(0,s.useState)(null),[R,M]=(0,s.useState)(null),[I,D]=(0,s.useState)(''),[H,L]=(0,s.useState)('up'),[z,P]=(0,s.useState)(null),[W,A]=(0,s.useState)(''),[q,B]=(0,s.useState)(null),[N,E]=(0,s.useState)(!1),$=(0,s.useMemo)(()=>{const e=new Set(C.filter(e=>e.date===a&&e.staffId!==d).map(e=>e.staffId)),t=k.filter(e=>e.active&&e.id!==d&&!e.temp);return[...t.filter(t=>e.has(t.id)),...t.filter(t=>!e.has(t.id))].slice(0,14)},[k,C,a,d]),O=()=>{u.useHr.getState().skip(e,o),y()};return(0,c.jsx)(n.Sheet,{visible:!0,onClose:O,title:"How was today?",testID:"hr-checkout",children:N?(0,c.jsxs)(l.default,{testID:"hr-checkout-thanks",style:{gap:6,paddingVertical:10},children:[(0,c.jsx)(n.T,{size:18,weight:"semibold",colour:r.colours.goldLight,center:!0,children:"Thanks. Sent anonymously."}),(0,c.jsx)(n.Muted,{center:!0,children:"Have a good evening."})]}):(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(n.Muted,{size:13,children:S.intro}),(0,c.jsxs)(l.default,{style:{gap:8},children:[(0,c.jsx)(n.T,{weight:"semibold",children:S.morale}),(0,c.jsx)(b,{value:v,onChange:T,w:S})]}),(0,c.jsxs)(l.default,{style:{gap:8},children:[(0,c.jsx)(n.T,{weight:"semibold",children:S.staffing}),(0,c.jsx)(j,{value:R,onChange:M,w:S})]}),w.askQuestion||w.askShout?(0,c.jsxs)(n.Row,{wrap:!0,gap:6,children:[w.askQuestion?(0,c.jsx)(n.Chip,{testID:"hr-more-question",label:"\uff0b Ask the team a question",selected:'q'===q,onPress:()=>B('q'===q?null:'q')}):null,w.askShout?(0,c.jsx)(n.Chip,{testID:"hr-more-shout",label:"\uff0b Shout out a teammate",selected:'shout'===q,onPress:()=>B('shout'===q?null:'shout')}):null]}):null,'q'===q&&w.askQuestion?(0,c.jsxs)(l.default,{style:{gap:6},children:[(0,c.jsxs)(n.Muted,{size:13,children:[S.question," Optional."]}),(0,c.jsx)(t.TextInput,{testID:"hr-question",accessibilityLabel:"Your question",value:I,onChangeText:D,maxLength:280,multiline:!0,placeholder:"e.g. Could we start staff meals earlier?",placeholderTextColor:r.colours.muted,style:[x,{minHeight:64}]}),(0,c.jsxs)(n.Row,{wrap:!0,gap:6,children:[(0,c.jsx)(n.Chip,{label:"Vote up",selected:'up'===H,onPress:()=>L('up')}),(0,c.jsx)(n.Chip,{label:"Yes / No",selected:'yesno'===H,onPress:()=>L('yesno')})]})]}):null,'shout'===q&&w.askShout?(0,c.jsxs)(l.default,{style:{gap:6},children:[(0,c.jsxs)(n.Muted,{size:13,children:[S.shout," Optional. Your name isn\u2019t shown."]}),(0,c.jsx)(n.Row,{wrap:!0,gap:6,children:$.map(e=>(0,c.jsx)(n.Chip,{testID:`hr-shout-${e.id}`,label:p(e.nickname||e.name).split(' ')[0],selected:z===p(e.nickname||e.name).split(' ')[0],onPress:()=>{const t=p(e.nickname||e.name).split(' ')[0];P(z===t?null:t)}},e.id))}),z?(0,c.jsx)(t.TextInput,{testID:"hr-shout-note",accessibilityLabel:"What for (optional)",value:W,onChangeText:A,maxLength:140,placeholder:"What for? (optional)",placeholderTextColor:r.colours.muted,style:x}):null]}):null,(0,c.jsxs)(n.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(n.Button,{testID:"hr-checkout-send",label:"Send anonymously",disabled:null==v&&null==R,onPress:()=>{u.useHr.getState().submit({rid:e,shiftKey:o,day:a,morale:v??3,staffing:R,question:w.askQuestion&&I.trim()?I:void 0,kind:H,shoutTo:w.askShout&&z?z:void 0,shoutBody:W||void 0}),E(!0),setTimeout(y,2400)},style:{flexGrow:1}}),(0,c.jsx)(n.Button,{testID:"hr-checkout-skip",kind:"ghost",label:"Skip",onPress:O})]}),(0,c.jsxs)(n.Muted,{size:12,children:["No name, no staff number and no clock time is saved with these answers. Managers only see a day once ",h.MIN_ANSWERS," or more people have answered."]})]})})},_e.QuestionBoard=function({rid:e,today:i,manager:a,by:d}){const p=f(e);(0,s.useEffect)(()=>{u.useHr.getState().ensure(e,i),u.hrRemote.live&&u.hrRemote.refresh&&u.hrRemote.refresh()},[e,i]);const y=(0,u.useHr)(e=>e.questions),b=(0,u.useHr)(e=>e.voted),j=(0,u.useHr)(e=>e.log),[S,k]=(0,s.useState)(''),[C,v]=(0,s.useState)('up'),[T,R]=(0,s.useState)(null),[M,I]=(0,s.useState)(null),[D,H]=(0,s.useState)(''),[L,z]=(0,s.useState)(null),[P,W]=(0,s.useState)(''),[A,q]=(0,s.useState)(!1),[B,N]=(0,s.useState)(null);(0,s.useEffect)(()=>{a&&A&&u.hrRemote.live&&u.hrRemote.log&&u.hrRemote.log(e).then(e=>N(e))},[a,A,e,j.length]);const E=(0,h.boardOrder)(y.filter(t=>t.venue===e),a),$=(B??j.filter(t=>t.venue===e)).slice(0,30);if(!p.board)return(0,c.jsx)(n.Card,{children:(0,c.jsxs)(n.Muted,{children:["The question board is switched off for this venue.",a?' Turn it on in Settings \u203a Advanced \u203a Shift check-out & question board.':'']})});return(0,c.jsxs)(l.default,{style:{gap:10},testID:"hr-board",children:[(0,c.jsx)(n.Muted,{children:"Ask anything about work. No names are shown or saved, not even to managers. Vote on what matters to you."}),(0,c.jsxs)(n.Card,{children:[(0,c.jsx)(n.T,{weight:"semibold",children:"Post a question"}),(0,c.jsx)(t.TextInput,{testID:"hr-board-input",accessibilityLabel:"Your question",value:S,onChangeText:e=>{k(e),R(null)},maxLength:280,multiline:!0,placeholder:"e.g. Can the rota go up by Thursday?",placeholderTextColor:r.colours.muted,style:[x,{minHeight:64}]}),(0,c.jsxs)(n.Row,{wrap:!0,gap:6,style:{justifyContent:'space-between'},children:[(0,c.jsxs)(n.Row,{wrap:!0,gap:6,children:[(0,c.jsx)(n.Chip,{label:"Vote up",selected:'up'===C,onPress:()=>v('up')}),(0,c.jsx)(n.Chip,{label:"Yes / No",selected:'yesno'===C,onPress:()=>v('yesno')})]}),(0,c.jsx)(n.Button,{small:!0,testID:"hr-board-post",label:"Post anonymously",disabled:!(0,h.cleanQuestion)(S),onPress:()=>{u.useHr.getState().post(e,S,C,i)?(k(''),R('Posted anonymously.')):R('Write a few more words first.')}})]}),T?(0,c.jsx)(n.Muted,{size:13,children:T}):null]}),E.length?E.map(e=>(0,c.jsx)(w,{q:e,mine:b[e.id],manager:a,onHide:()=>{I(e),H('')},onReply:()=>{z(e),W(e.reply??'')},by:d},e.id)):(0,c.jsx)(n.Muted,{center:!0,children:"No questions yet. Be the first."}),a?(0,c.jsxs)(n.Card,{children:[(0,c.jsx)(o.default,{testID:"hr-log-toggle",accessibilityRole:"button",onPress:()=>q(!A),children:(0,c.jsxs)(n.Row,{style:{justifyContent:'space-between',minHeight:44},children:[(0,c.jsx)(n.T,{weight:"semibold",style:{flex:1},children:"Moderation log"}),(0,c.jsx)(n.T,{colour:r.colours.gold,children:A?'Hide':'Show'})]})}),(0,c.jsx)(n.Muted,{size:13,children:"Every hide, unhide and reply is logged with who did it and when. Questions never show who asked."}),A?$.length?$.map(e=>(0,c.jsxs)(l.default,{testID:"hr-log-row",style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:6},children:[(0,c.jsxs)(n.T,{size:14,children:['hide'===e.action?'Hidden':'unhide'===e.action?'Shown again':'Replied'," by ",e.by]}),(0,c.jsxs)(n.Muted,{size:12,children:[new Date(e.at).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'}),e.reason?` \xb7 ${e.reason}`:'']})]},e.id)):(0,c.jsx)(n.Muted,{children:"Nothing logged yet."}):null]}):null,(0,c.jsxs)(n.Sheet,{visible:!!M,onClose:()=>I(null),title:"Hide this question?",testID:"hr-hide-sheet",children:[(0,c.jsx)(n.Muted,{children:"It disappears for staff straight away. You can show it again later. This is logged with your name."}),(0,c.jsx)(t.TextInput,{testID:"hr-hide-reason",accessibilityLabel:"Reason",value:D,onChangeText:H,maxLength:140,placeholder:"Reason, e.g. rude or names someone",placeholderTextColor:r.colours.muted,style:x}),(0,c.jsxs)(n.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(n.Button,{testID:"hr-hide-confirm",kind:"danger",label:"Hide",disabled:D.trim().length<3,onPress:()=>{M&&u.useHr.getState().moderate(M.id,'hide',D,d),I(null)}}),(0,c.jsx)(n.Button,{kind:"ghost",label:"Cancel",onPress:()=>I(null)})]})]}),(0,c.jsxs)(n.Sheet,{visible:!!L,onClose:()=>z(null),title:"Reply to the team",testID:"hr-reply-sheet",children:[L?(0,c.jsxs)(n.Muted,{children:["\u201c",L.body,"\u201d"]}):null,(0,c.jsx)(t.TextInput,{testID:"hr-reply-input",accessibilityLabel:"Your reply",value:P,onChangeText:W,maxLength:600,multiline:!0,placeholder:"Your reply, shown under the question",placeholderTextColor:r.colours.muted,style:[x,{minHeight:80}]}),(0,c.jsx)(n.Muted,{size:12,children:"Shown as \u201cReply from the managers\u201d. Your name is kept in the moderation log only."}),(0,c.jsxs)(n.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(n.Button,{testID:"hr-reply-save",label:"Post reply",disabled:!P.trim(),onPress:()=>{L&&u.useHr.getState().reply(L.id,P,d),z(null)}}),(0,c.jsx)(n.Button,{kind:"ghost",label:"Cancel",onPress:()=>z(null)})]})]})]})},_e.coversByDay=k,_e.exampleCovers=C,_e.MoraleTrend=function({rid:e,today:t}){const o=f(e).wording;(0,s.useEffect)(()=>{u.useHr.getState().ensure(e,t)},[e,t]);const[i,a]=(0,s.useState)(14),p=(0,u.useHr)(e=>e.checkins),x=(0,u.useHr)(e=>e.shouts),b=(0,d.useBookings)(e),j=(0,s.useMemo)(()=>k(b),[b]),w=e=>j[e]??(z?C(e):void 0),v=S(t,-i),[T,R]=(0,s.useState)(null),[M,I]=(0,s.useState)(null);(0,s.useEffect)(()=>{let s=!0;return u.hrRemote.live&&u.hrRemote.trend&&u.hrRemote.trend(e,v,t).then(e=>{s&&R(e)}),u.hrRemote.live&&u.hrRemote.shouts&&u.hrRemote.shouts(e,S(t,-30)).then(e=>{s&&I(e)}),()=>{s=!1}},[e,v,t]);const D=(0,s.useMemo)(()=>(0,h.dayResults)(p.filter(s=>s.venue===e&&s.day>=v&&s.day<=t)),[p,e,v,t]),H=u.hrRemote.live,L=H?T??[]:D.shown,z=!H&&p.some(t=>t.venue===e&&t.example),P=(H?M??[]:x.filter(t=>t.venue===e)).slice().sort((e,t)=>t.day.localeCompare(e.day)).slice(0,8),W=L.length?Math.round(L.reduce((e,t)=>e+t.morale,0)/L.length*10)/10:null,A=Array.from({length:i},(e,s)=>S(t,1-i+s)),q=new Map(L.map(e=>[e.day,e]));return(0,c.jsxs)(l.default,{style:{gap:10},testID:"hr-trend",children:[(0,c.jsxs)(n.Muted,{children:["From the anonymous check-out when people clock out. A day only shows once ",h.MIN_ANSWERS," or more people have answered."]}),z?(0,c.jsx)(n.Banner,{kind:"example",title:"Example answers",children:"These are made-up answers so you can see how it looks. Real answers replace them once your team is signed in."}):null,(0,c.jsx)(n.Row,{wrap:!0,gap:6,children:[14,28,56].map(e=>(0,c.jsx)(n.Chip,{label:14===e?'2 weeks':28===e?'4 weeks':'8 weeks',selected:i===e,onPress:()=>a(e)},e))}),(0,c.jsxs)(n.Card,{children:[(0,c.jsxs)(n.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,c.jsx)(n.T,{weight:"semibold",style:{flexShrink:1},children:"Team morale"}),null!=W?(0,c.jsx)(n.Badge,{kind:"gold",label:`AVERAGE ${W} \xb7 ${(0,h.moraleWord)(Math.round(W),o).toUpperCase()}`}):null]}),(0,c.jsx)(l.default,{testID:"hr-trend-chart",accessibilityLabel:`Morale over the last ${i} days`,style:{height:110,flexDirection:'row',alignItems:'flex-end',gap:i>30?1:3,borderBottomWidth:1,borderColor:r.colours.border},children:A.map(e=>{const t=q.get(e);return(0,c.jsx)(l.default,{style:{flex:1,minWidth:0,height:'100%',justifyContent:'flex-end',alignItems:'center'},children:t?(0,c.jsx)(l.default,{style:{width:'100%',maxWidth:22,height:t.morale/5*100+"%",borderTopLeftRadius:4,borderTopRightRadius:4,backgroundColor:t.morale<2.5?r.colours.amber:r.colours.gold}}):(0,c.jsx)(l.default,{style:{width:4,height:4,borderRadius:2,backgroundColor:r.colours.border,marginBottom:2}})},e)})}),(0,c.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(n.Muted,{size:12,children:y(A[0])}),(0,c.jsx)(n.Muted,{size:12,children:y(A[A.length-1])})]}),(0,c.jsxs)(n.Muted,{size:12,children:["Bar height: average morale (1 low to 5 high). Amber: below 2.5. A dot: fewer than ",h.MIN_ANSWERS," answers or none."]})]}),(0,c.jsxs)(n.Card,{children:[(0,c.jsx)(n.T,{weight:"semibold",children:"Staffing vs covers, night by night"}),L.length?L.slice().reverse().map(e=>(0,c.jsxs)(l.default,{testID:"hr-trend-row",style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:8,gap:4},children:[(0,c.jsxs)(n.Row,{style:{justifyContent:'space-between'},gap:6,wrap:!0,children:[(0,c.jsx)(n.T,{weight:"semibold",style:{flexShrink:1},children:y(e.day)}),(0,c.jsx)(n.T,{size:14,colour:r.colours.goldLight,style:{flexShrink:1},children:null!=w(e.day)?`${w(e.day)} covers`:'No bookings'})]}),(0,c.jsxs)(n.Row,{gap:8,style:{alignItems:'center'},children:[(0,c.jsxs)(l.default,{style:{flex:1,minWidth:60,height:6,borderRadius:3,backgroundColor:r.colours.border},children:[null!=e.staffing?(0,c.jsx)(l.default,{style:{position:'absolute',left:`${e.staffing}%`,marginLeft:-6,top:-3,width:12,height:12,borderRadius:6,backgroundColor:r.colours.gold}}):null,(0,c.jsx)(l.default,{style:{position:'absolute',left:'50%',marginLeft:-1,top:-4,width:2,height:14,backgroundColor:r.colours.goldMuted}})]}),(0,c.jsx)(n.T,{size:13,style:{flexShrink:1,maxWidth:'55%'},children:null!=e.staffing?(0,h.staffingWord)(e.staffing,o):'\u2014'})]}),(0,c.jsxs)(n.Muted,{size:12,children:["Morale ",e.morale," \xb7 ",e.answers," answers \xb7 ",e.short," said short, ",e.perfect," perfect, ",e.over," over"]})]},e.day)):(0,c.jsxs)(n.Muted,{children:["No days with ",h.MIN_ANSWERS," or more answers yet."]}),!H&&D.held?(0,c.jsxs)(n.Muted,{size:12,children:[D.held," day",1===D.held?'':'s'," held back (fewer than ",h.MIN_ANSWERS," answers)."]}):null,(0,c.jsx)(n.Muted,{size:12,children:"Covers come from that day\u2019s bookings (cancelled and no-shows left out)."})]}),(0,c.jsxs)(n.Card,{children:[(0,c.jsx)(n.T,{weight:"semibold",children:"Shout-outs"}),P.length?P.map(e=>(0,c.jsxs)(l.default,{testID:"hr-shout-row",style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:6},children:[(0,c.jsxs)(n.T,{size:14,children:[(0,c.jsx)(n.T,{size:14,weight:"semibold",colour:r.colours.goldLight,children:e.to}),e.body?`: ${e.body}`:'']}),(0,c.jsxs)(n.Muted,{size:12,children:[y(e.day)," \xb7 from a teammate"]})]},e.id)):(0,c.jsx)(n.Muted,{children:"No shout-outs yet."})]})]})},_e.HrSettingsCard=function({rid:e}){const o=(0,a.useStore)(t=>t.restaurants.find(t=>t.id===e)?.settings?.hr),i=(0,h.hrSettingsOf)(o),d=t=>a.useStore.getState().updateSettings(e,{hr:{...i,...t}}),[u,f]=(0,s.useState)({});return(0,c.jsxs)(l.default,{style:{gap:8},testID:"hr-settings",children:[(0,c.jsx)(n.Toggle,{testID:"hr-set-on",label:"Ask a quick check-out when people clock out",value:i.on,onChange:e=>d({on:e})}),(0,c.jsx)(n.Toggle,{label:"Let them post a question for the board",value:i.askQuestion,onChange:e=>d({askQuestion:e})}),(0,c.jsx)(n.Toggle,{label:"Let them shout out a teammate",value:i.askShout,onChange:e=>d({askShout:e})}),(0,c.jsx)(n.Toggle,{testID:"hr-set-board",label:"Question board in the Staff, Head Chef and Managers apps",value:i.board,onChange:e=>d({board:e})}),(0,c.jsx)(n.Muted,{size:13,children:"Tip: it only shows after Clock out, never at clock in, and anyone can tap Skip. It\u2019s a card in the app, not a phone notification."}),(0,c.jsxs)(n.Muted,{size:13,children:["Tip: answers are anonymous. No name or staff number is saved, and a day\u2019s results only show once ",h.MIN_ANSWERS," people have answered."]}),(0,c.jsx)(n.T,{weight:"semibold",style:{marginTop:4},children:"Wording"}),v.map(({k:e,label:s})=>(0,c.jsxs)(l.default,{style:{gap:4},children:[(0,c.jsx)(n.Muted,{size:13,children:s}),(0,c.jsx)(t.TextInput,{testID:`hr-word-${e}`,accessibilityLabel:s,value:u[e]??i.wording[e],onChangeText:t=>f({...u,[e]:t}),onBlur:()=>{null!=u[e]&&(d({wording:{...i.wording,[e]:u[e].trim()||h.DEFAULT_HR.wording[e]}}),f(t=>{const s={...t};return delete s[e],s}))},maxLength:'intro'===e||'staffing'===e||'question'===e?160:60,multiline:'intro'===e||'staffing'===e||'question'===e,placeholderTextColor:r.colours.muted,style:[x,'intro'===e||'staffing'===e||'question'===e?{minHeight:92,textAlignVertical:'top'}:null]})]},e)),(0,c.jsx)(n.Muted,{size:13,children:"Tip: keep it short and plain. Leave a box empty to go back to the standard words."})]})};var t=_r(_d[0]),s=_r(_d[1]),o=e(_r(_d[2])),l=e(_r(_d[3])),n=_r(_d[4]),r=_r(_d[5]),i=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),c=_r(_d[11]);const f=e=>(0,h.hrSettingsOf)((0,a.useStore)(t=>t.restaurants.find(t=>t.id===e)?.settings?.hr)),p=e=>e.replace(' (example)','').trim(),x={minHeight:46,borderRadius:12,borderWidth:1,borderColor:r.colours.accentBorder,backgroundColor:r.colours.surface2,color:r.colours.text,paddingHorizontal:12,paddingVertical:10,fontSize:16},y=e=>new Date(`${e}T12:00:00`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'});function b({value:e,onChange:t,w:s}){return(0,c.jsxs)(l.default,{style:{gap:6},testID:"hr-morale",children:[(0,c.jsx)(n.Row,{gap:6,style:{justifyContent:'space-between'},children:h.MORALE_STEPS.map(l=>{const i=e===l;return(0,c.jsx)(o.default,{testID:`hr-morale-${l}`,accessibilityRole:"button",accessibilityState:{selected:i},accessibilityLabel:`Morale ${l} of 5: ${(0,h.moraleWord)(l,s)}`,onPress:()=>t(l),hitSlop:4,style:{flex:1,minWidth:0,minHeight:48,borderRadius:12,borderWidth:1,borderColor:i?r.colours.gold:r.colours.border,backgroundColor:i?r.colours.goldTint:r.colours.surface2,alignItems:'center',justifyContent:'center'},children:(0,c.jsx)(n.T,{size:18,weight:"bold",colour:i?r.colours.goldLight:r.colours.text,children:l})},l)})}),(0,c.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(n.Muted,{size:13,style:{flexShrink:1},children:s.moraleLow}),e?(0,c.jsx)(n.T,{size:13,weight:"semibold",colour:r.colours.goldLight,style:{flexShrink:1,textAlign:'center'},children:(0,h.moraleWord)(e,s)}):null,(0,c.jsx)(n.Muted,{size:13,style:{flexShrink:1,textAlign:'right'},children:s.moraleHigh})]})]})}function j({value:e,onChange:t,w:i}){const a=(0,s.useRef)(null),d=(0,s.useRef)(0),u=(0,s.useRef)(1),f=()=>{a.current?.measureInWindow?.((e,t,s)=>{d.current=e,u.current=Math.max(1,s)})},p=e=>t((0,h.snapStaffing)((e-d.current)/u.current*100)),x=e??50,y=null!=e;return(0,c.jsxs)(l.default,{style:{gap:6},children:[(0,c.jsx)(l.default,{testID:"hr-staffing",accessible:!0,accessibilityRole:"adjustable",accessibilityLabel:`Staffing: ${y?(0,h.staffingWord)(x,i):'not answered'}`,accessibilityActions:[{name:'increment'},{name:'decrement'}],onAccessibilityAction:e=>{const s=h.STAFF_STOPS.indexOf((0,h.snapStaffing)(x)),o='increment'===e.nativeEvent.actionName?Math.min(8,s+1):Math.max(0,s-1);t(h.STAFF_STOPS[o])},onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>!0,onResponderGrant:e=>{f(),p(e.nativeEvent.pageX)},onResponderMove:e=>p(e.nativeEvent.pageX),style:{height:48,justifyContent:'center',paddingHorizontal:15},children:(0,c.jsxs)(l.default,{ref:a,onLayout:f,style:{height:48,justifyContent:'center'},children:[(0,c.jsx)(l.default,{style:{height:6,borderRadius:3,backgroundColor:r.colours.border}}),(0,c.jsx)(l.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:0,bottom:0,flexDirection:'row',justifyContent:'space-between',alignItems:'center'},children:h.STAFF_STOPS.map(e=>(0,c.jsx)(l.default,{style:{width:e%50==0?4:2,height:e%50==0?18:10,borderRadius:2,backgroundColor:e%50==0?r.colours.goldMuted:r.colours.muted}},e))}),(0,c.jsx)(l.default,{pointerEvents:"none",style:{position:'absolute',left:`${x}%`,top:10,marginLeft:-14,width:28,height:28,borderRadius:14,borderWidth:2,borderColor:y?r.colours.gold:r.colours.muted,backgroundColor:y?r.colours.gold:r.colours.surface}})]})}),(0,c.jsx)(n.Row,{style:{justifyContent:'space-between',gap:8},children:[[0,i.staffLow],[50,i.staffMid],[100,i.staffHigh]].map(([e,s],l)=>(0,c.jsx)(o.default,{testID:`hr-staffing-${e}`,accessibilityRole:"button",accessibilityLabel:s,onPress:()=>t(e),hitSlop:6,style:{flexShrink:1,flexGrow:0,minWidth:0},children:(0,c.jsx)(n.T,{size:13,colour:y&&(0,h.snapStaffing)(x)===e?r.colours.goldLight:r.colours.muted,weight:y&&(0,h.snapStaffing)(x)===e?'semibold':'regular',style:{textAlign:0===l?'left':1===l?'center':'right'},children:s})},e))}),y&&(0,h.snapStaffing)(x)%50!=0?(0,c.jsx)(n.T,{size:13,colour:r.colours.goldLight,center:!0,children:(0,h.staffingWord)(x,i)}):null]})}function w({q:e,mine:t,manager:s,onHide:o,onReply:i,by:a}){const d=e.yes+e.no,h=d?Math.round(e.yes/d*100):0;return(0,c.jsx)(n.Card,{style:e.hidden?{opacity:.75}:void 0,children:(0,c.jsxs)(l.default,{testID:"hr-question-card",style:{gap:8},children:[(0,c.jsxs)(n.Row,{gap:8,style:{alignItems:'flex-start'},children:[(0,c.jsx)(n.T,{style:{flex:1,minWidth:0},children:e.body}),e.hidden?(0,c.jsx)(n.Badge,{kind:"amber",label:"HIDDEN"}):null]}),(0,c.jsxs)(n.Muted,{size:12,children:["Asked ",y(e.postedOn)," \xb7 anonymous"]}),'up'===e.kind?(0,c.jsx)(n.Row,{gap:8,wrap:!0,children:(0,c.jsx)(n.Button,{small:!0,testID:"hr-vote-up",kind:t?'success':'secondary',label:t?`\u25b2 Voted \xb7 ${e.up}`:`\u25b2 Vote up \xb7 ${e.up}`,disabled:!!t||e.hidden,onPress:()=>u.useHr.getState().vote(e.id,1)})}):(0,c.jsxs)(l.default,{style:{gap:6},children:[(0,c.jsxs)(n.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(n.Button,{small:!0,testID:"hr-vote-yes",kind:1===t?'success':'secondary',label:`Yes \xb7 ${e.yes}`,disabled:!!t||e.hidden,onPress:()=>u.useHr.getState().vote(e.id,1)}),(0,c.jsx)(n.Button,{small:!0,testID:"hr-vote-no",kind:-1===t?'success':'secondary',label:`No \xb7 ${e.no}`,disabled:!!t||e.hidden,onPress:()=>u.useHr.getState().vote(e.id,-1)})]}),d?(0,c.jsx)(l.default,{style:{height:6,borderRadius:3,backgroundColor:r.colours.border,overflow:'hidden'},children:(0,c.jsx)(l.default,{style:{width:`${h}%`,height:6,backgroundColor:r.colours.gold}})}):null,d?(0,c.jsxs)(n.Muted,{size:12,children:[h,"% yes from ",d," vote",1===d?'':'s']}):null]}),t?(0,c.jsx)(n.Muted,{size:12,children:"You\u2019ve voted. Votes are anonymous."}):null,e.reply?(0,c.jsxs)(l.default,{style:{borderLeftWidth:3,borderColor:r.colours.gold,paddingLeft:10,gap:2},children:[(0,c.jsx)(n.T,{size:13,weight:"semibold",colour:r.colours.goldLight,children:"Reply from the managers"}),(0,c.jsx)(n.T,{size:14,children:e.reply})]}):null,s?(0,c.jsxs)(n.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(n.Button,{small:!0,kind:"ghost",testID:"hr-reply",label:e.reply?'Edit reply':'Reply',onPress:i}),e.hidden?(0,c.jsx)(n.Button,{small:!0,kind:"ghost",testID:"hr-unhide",label:"Show again",onPress:()=>u.useHr.getState().moderate(e.id,'unhide','',a)}):(0,c.jsx)(n.Button,{small:!0,kind:"ghost",testID:"hr-hide",label:"Hide",onPress:o})]}):null]})})}const S=(e,t)=>{const s=new Date(`${e}T12:00:00Z`);return s.setUTCDate(s.getUTCDate()+t),s.toISOString().slice(0,10)};function k(e){const t={};for(const s of e)'cancelled'!==s.status&&'noshow'!==s.status&&(t[s.date]=(t[s.date]??0)+(s.partySize||0));return t}function C(e){let t=0;for(const s of e)t=(31*t+s.charCodeAt(0))%997;return 40+t%90}const v=[{k:'intro',label:'Opening line'},{k:'morale',label:'Morale question'},{k:'moraleLow',label:'Morale: low end'},{k:'moraleHigh',label:'Morale: high end'},{k:'staffing',label:'Staffing question'},{k:'staffLow',label:'Staffing: left'},{k:'staffMid',label:'Staffing: middle'},{k:'staffHigh',label:'Staffing: right'},{k:'question',label:'Question prompt'},{k:'shout',label:'Shout-out prompt'}]},999,[877,30,263,127,813,821,856,872,1022,1118,1119,24]); +__d(function(g,r,_i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ChatAsCtx",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"CHANNELS",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"dmId",{enumerable:!0,get:function(){return p.dmId}}),Object.defineProperty(_e,"inChannel",{enumerable:!0,get:function(){return p.inChannel}}),_e.autoPost=function(e,t){const n=new Date(globalThis.__ccNow??Date.now()).toISOString();(Array.isArray(e)?e:[e]).forEach(e=>u.useOwner.getState().sys(e,t,n))},_e.ensureChat=O,_e.useChatUnread=R,_e.Chat=function({go:e}){return(0,y.jsx)(M,{children:(0,y.jsx)(z,{go:e})})};var t=r(d[0]),n=r(d[1]),s=r(d[2]),a=r(d[3]),o=r(d[4]),i=r(d[5]),l=e(r(d[6])),c=e(r(d[7])),h=r(d[8]),u=r(d[9]),m=r(d[10]),f=r(d[11]),x=r(d[12]),b=r(d[13]),p=r(d[14]),j=r(d[15]),y=r(d[16]);const w=(0,o.createContext)(null);function C(e){const t=(0,x.useCtx)(e),n=(0,o.useContext)(w);return n?{...t,meId:n.meId,role:n.role}:t}const v=[{id:'all',name:'Team',icon:'\ud83d\udce2'},{id:'kitchen',name:'Kitchen',icon:'\ud83c\udf73',pinned:!0},{id:'foh',name:'Front of house',icon:'\ud83c\udf7d\ufe0f'},{id:'managers',name:'Managers',icon:'\ud83d\udd11'}],S=[],k=e=>(e??'').replace(' (example)','');function O(e){if(s.LIVE_VENUE_BUILD)return;if(a.IS_WILDINGS)return;const t=u.useOwner.getState();if(t.chat.some(e=>'m-seed-all'===e.id&&/this phone only/.test(e.text??''))&&u.useOwner.getState().chatPatch('m-seed-all',{text:'Welcome to the team chat on CoverCharge.'}),t.chat.length)return;const n=(t,n,s,a={})=>{return{id:`m-seed-${t}`,ch:t,from:'system',text:s,at:(o=n,new Date(e.getTime()-6e4*o).toISOString()),reactions:{},seenBy:[],...a};var o};u.useOwner.setState({chat:[n('all',5,'Welcome to the team chat on CoverCharge.',{pinned:!0}),n('kitchen',4,'Kitchen channel: Head Chef, kitchen team and managers.'),n('foh',3,'Front of house channel: front of house, bar and managers.'),n('managers',2,'Managers channel: owners, managers and the supervisor only.')]})}function R(){const{meId:e}=C(3e4),{role:t}=C(3e4),n=(0,u.useOwner)(e=>e.chat),s=(0,u.useOwner)(e=>e.staff),a=(0,u.useOwner)(t=>t.chatMuted[e]??S),i=(0,o.useMemo)(()=>T(s,e,t),[s,e,t]);return(0,o.useMemo)(()=>{const t={};return n.forEach(n=>{n.removed||n.from===e||n.seenBy.includes(e)||!(0,p.inChannel)(n.ch,i)||(t[n.ch]=(t[n.ch]??0)+1)}),{by:t,total:Object.entries(t).filter(([e])=>!a.includes(e)).reduce((e,[,t])=>e+t,0)}},[n,e,a,i])}function T(e,t,n){const s=e.find(e=>e.id===t);return s||!t?s:{id:t,name:'You',role:n,job:'',active:!0,level:'owner'===n?'Owner':'manager'===n?'Manager':'Staff',dept:''}}class M extends o.Component{state={err:null};static getDerivedStateFromError(e){return{err:String(e?.message??e)}}componentDidUpdate(e){e.resetKey!==this.props.resetKey&&this.state.err&&this.setState({err:null})}render(){return this.state.err?(0,y.jsxs)(c.default,{style:{gap:10},testID:"chat-error",children:[(0,y.jsx)(h.Banner,{kind:"warn",title:"Chat couldn\u2019t open",children:"Something went wrong showing this chat. Your messages are still saved on this phone. Go back and try again; if it keeps happening, close and reopen the app."}),(0,y.jsx)(h.Button,{kind:"secondary",label:"Back to chats",onPress:()=>{this.setState({err:null}),this.props.onBack?.()}})]}):this.props.children}}const I={owner:f.colours.gold,manager:f.colours.blue,staff:'#7a6f5c'};function P({s:e,size:n=34}){return e?(0,y.jsx)(b.StaffAvatar,{id:e.id,size:n}):(0,y.jsx)(c.default,{style:{width:n,height:n,borderRadius:n/2,backgroundColor:(0,t.soutersSurface)('#333'),alignItems:'center',justifyContent:'center'},children:(0,y.jsx)(h.T,{size:.38*n,weight:"bold",colour:"#111",children:"CC"})})}const B=[{caption:'Specials board',tone:'#4A3A22'},{caption:'Plating: Cullen skink',tone:'#3E2A2A'},{caption:'Delivery arrived',tone:'#40362A'},{caption:'Spillage by the bar',tone:'#2E2E40'}],D=['\ud83d\udc4d','\u2764\ufe0f','\ud83d\ude04','\ud83d\udc4f','\ud83d\udd25'];function E({ch:e,go:s,back:a}){const{now:b,meId:w,role:S,today:O}=C(1e4),R=(0,u.useOwner)(e=>e.staff),T=(0,u.useOwner)(e=>e.chat),M=(0,u.useOwner)(e=>e.shifts),E=T.filter(t=>t.ch===e).sort((e,t)=>e.at.localeCompare(t.at)),[z,A]=(R.find(e=>e.id===w),(0,o.useState)('')),[L,$]=(0,o.useState)(null),[N,_]=(0,o.useState)(!1),[W,H]=(0,o.useState)(!1),K=e.startsWith('dm:')?e.split(':').slice(1).length:R.filter(t=>t.active&&(0,p.inChannel)(e,t)).length;(0,o.useEffect)(()=>{u.useOwner.getState().chatSeen(e,w)},[e,w,E.length]);const U=t=>u.useOwner.getState().chatSend({ch:e,from:w,at:b.toISOString(),...t});(0,i.useBackLayer)(!0,a);const Y=E.filter(e=>e.pinned&&!e.removed),V=e.startsWith('dm:')?k(R.find(t=>t.id===e.split(':').slice(1).find(e=>e!==w))?.name):v.find(t=>t.id===e)?.name,F=(0,j.useChatSync)(e=>e.synced),q=M.filter(e=>e.staffId===w&&e.published&&e.date>=O).sort((e,t)=>e.date.localeCompare(t.date)).slice(0,10);return(0,y.jsxs)(c.default,{style:{gap:8},children:[(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(i.BackButton,{onPress:a,testID:"chat-thread-back"}),(0,y.jsxs)(c.default,{style:{flex:1,alignItems:'flex-end'},children:[(0,y.jsx)(h.T,{weight:"semibold",size:18,children:V}),(0,y.jsxs)(h.Muted,{children:[K," members"]})]})]}),Y.map(e=>(0,y.jsxs)(h.Card,{highlight:f.colours.gold,children:[(0,y.jsxs)(h.T,{size:12,colour:f.colours.gold,children:["\ud83d\udccc ",'system'===e.from?'Pinned note':`Pinned by ${k(R.find(t=>t.id===e.from)?.name)}`]}),(0,y.jsx)(h.T,{size:14,children:e.text})]},e.id)),E.map((n,a)=>{const o=R.find(e=>e.id===n.from),i=n.from===w,x=n.seenBy.filter(e=>e!==n.from).length,b=0===a||n.at.slice(0,10)!==E[a-1].at.slice(0,10);return'system'===n.from?(0,y.jsxs)(c.default,{style:{alignItems:'center',gap:2},children:[b?(0,y.jsx)(h.Muted,{children:(0,m.niceDate)(new Date(n.at))}):null,(0,y.jsx)(c.default,{style:{backgroundColor:(0,t.soutersSurface)('#1c1a14'),borderRadius:10,paddingHorizontal:10,paddingVertical:5,borderWidth:1,borderColor:f.colours.border},children:(0,y.jsxs)(h.T,{size:13,colour:/Allergy|86|Sold out/.test(n.text??'')?f.colours.amber:f.colours.muted,children:["CoverCharge \xb7 ",n.text," \xb7 ",(0,m.hm)(new Date(n.at))]})})]},n.id):(0,y.jsxs)(c.default,{style:{gap:2},children:[b?(0,y.jsx)(h.Muted,{center:!0,children:(0,m.niceDate)(new Date(n.at))}):null,(0,y.jsxs)(h.Row,{style:{alignItems:'flex-start',flexDirection:i?'row-reverse':'row'},children:[(0,y.jsx)(P,{s:o}),(0,y.jsxs)(l.default,{accessibilityRole:"button",accessibilityLabel:`Message from ${o?.name}`,onPress:()=>$(L===n.id?null:n.id),style:{maxWidth:'78%',backgroundColor:i?'#3a2f12':f.colours.surface,borderRadius:14,padding:9,borderWidth:1,borderColor:n.pinned?f.colours.gold:f.colours.border,gap:3},children:[(0,y.jsxs)(h.Row,{gap:6,children:[(0,y.jsx)(h.T,{size:12,weight:"semibold",colour:o?I[o.role]:f.colours.muted,children:k(o?.name)}),(0,y.jsxs)(h.T,{size:11,colour:f.colours.muted,children:[o?u.ROLE_LABEL[o.role]:''," \xb7 ",(0,m.hm)(new Date(n.at))]})]}),n.removed?(0,y.jsx)(h.T,{size:14,colour:f.colours.muted,children:"Message removed by the owner"}):(0,y.jsxs)(y.Fragment,{children:[n.photo?(0,y.jsx)(c.default,{style:{width:200,height:120,borderRadius:10,backgroundColor:n.photo.tone,justifyContent:'flex-end',padding:6},children:(0,y.jsxs)(h.T,{size:12,children:[n.photo.caption," (example image)"]})}):null,n.text?(0,y.jsx)(h.T,{size:15,children:n.text}):null,'cover'===n.action?(0,y.jsx)(h.Button,{small:!0,kind:"secondary",label:"Open cover requests on the rota",onPress:()=>s('more','rota')}):null]}),Object.entries(n.reactions).filter(([,e])=>e.length).length?(0,y.jsx)(h.Row,{wrap:!0,gap:4,children:Object.entries(n.reactions).filter(([,e])=>e.length).map(([e,t])=>(0,y.jsx)(c.default,{style:{borderRadius:10,paddingHorizontal:6,backgroundColor:t.includes(w)?'#4a3c16':'#222'},children:(0,y.jsxs)(h.T,{size:12,children:[e," ",t.length]})},e))}):null,i?(0,y.jsx)(h.T,{size:11,colour:f.colours.muted,children:x?`Seen by ${x}`:'Sent'}):null]})]}),L!==n.id||n.removed?null:(0,y.jsxs)(h.Row,{wrap:!0,gap:6,style:{justifyContent:i?'flex-end':'flex-start',paddingLeft:i?0:40},children:[D.map(e=>(0,y.jsx)(l.default,{accessibilityLabel:`React ${e}`,onPress:()=>{u.useOwner.getState().chatReact(n.id,e,w),$(null)},style:{padding:4},children:(0,y.jsx)(h.T,{size:20,children:e})},e)),'staff'===S||e.startsWith('dm:')?null:(0,y.jsx)(h.Button,{small:!0,kind:"ghost",label:n.pinned?'Unpin':'Pin',onPress:()=>{u.useOwner.getState().chatPatch(n.id,{pinned:!n.pinned}),$(null)}}),'owner'!==S||i?null:(0,y.jsx)(h.Button,{small:!0,kind:"danger",label:"Remove",onPress:()=>{u.useOwner.getState().chatPatch(n.id,{removed:!0,pinned:!1}),$(null)}})]})]},n.id)}),(0,y.jsxs)(h.Row,{gap:6,children:[(0,y.jsx)(l.default,{accessibilityRole:"button",accessibilityLabel:"Send a photo",onPress:()=>_(!0),style:{padding:8},children:(0,y.jsx)(h.T,{size:20,children:"\ud83c\udf9e\ufe0f"})}),(0,y.jsx)(n.TextInput,{accessibilityLabel:"Message",placeholder:`Message ${V}`,placeholderTextColor:"#7D776C",value:z,onChangeText:A,style:[h.styles.input,{flex:1}]}),(0,y.jsx)(h.Button,{small:!0,label:"Send",disabled:!z.trim(),onPress:()=>{U({text:z.trim()}),A('')}})]}),(0,y.jsx)(h.Row,{wrap:!0,gap:6,children:(0,y.jsx)(h.Button,{small:!0,kind:"secondary",label:"Ask for shift cover",onPress:()=>H(!0)})}),F?null:(0,y.jsx)(h.Muted,{center:!0,children:"Not shared yet: this message stays on this phone only. Nobody else will see it."}),(0,y.jsx)(h.Sheet,{visible:N,onClose:()=>_(!1),title:"Send a photo",children:(0,y.jsx)(h.Row,{wrap:!0,gap:8,children:B.map(e=>(0,y.jsx)(l.default,{accessibilityRole:"button",accessibilityLabel:e.caption,onPress:()=>{U({photo:e}),_(!1)},style:{width:'47%',height:100,borderRadius:10,backgroundColor:e.tone,justifyContent:'flex-end',padding:6},children:(0,y.jsx)(h.T,{size:12,children:e.caption})},e.caption))})}),(0,y.jsxs)(h.Sheet,{visible:W,onClose:()=>H(!1),title:"Ask for shift cover",children:[q.length?null:(0,y.jsx)(h.Muted,{children:"You have no shifts on the rota this week."}),q.map(e=>(0,y.jsx)(h.Button,{kind:"secondary",label:`${x.DAY3[e.day]} ${Number(e.date.slice(8))} ${(0,x.fmtH)(e.start)}\u2013${(0,x.fmtH)(e.end)}`,onPress:()=>{const t=`${x.DAY3[e.day]} ${Number(e.date.slice(8))} ${(0,x.fmtH)(e.start)}\u2013${(0,x.fmtH)(e.end)}`;u.useOwner.getState().addSwap({shiftId:e.id,fromId:w,kind:'cover',note:`Cover asked in chat for ${t}`}),U({text:`Can anyone cover my ${t} shift? I\u2019ve added a cover request on the rota.`,action:'cover'}),H(!1)}},e.id)),(0,y.jsx)(h.Muted,{children:"Creates a cover request in Rota \u203a Swaps & leave for a manager to approve."})]})]})}function z({go:e}){const{now:n,meId:s,role:a}=C(3e4),i=(0,u.useOwner)(e=>e.staff),x=(0,u.useOwner)(e=>e.chat),b=(0,u.useOwner)(e=>e.chatMuted[s]??S),{by:w}=R(),I=(0,j.useChatSync)(e=>e.synced),B=(0,j.useChatSync)(e=>e.error),D=(0,p.useKitchenExtra)(e=>e.extra),[z,A]=(0,o.useState)(null),[L,$]=(0,o.useState)(!1),[N,_]=(0,o.useState)(!1);(0,o.useEffect)(()=>{O(n)},[]),(0,o.useEffect)(()=>{A(null)},[s]);const W=T(i,s,a);if(z)return(0,y.jsx)(M,{resetKey:z,onBack:()=>A(null),children:(0,y.jsx)(E,{ch:z,go:e,back:()=>A(null)})});const H=e=>x.filter(t=>t.ch===e).sort((e,t)=>t.at.localeCompare(e.at))[0],K=i.filter(e=>e.active&&e.id!==s).map(e=>{const t=(0,p.dmId)(s,e.id);return{x:e,id:t,u:w[t]??0,l:H(t)?.at??''}}).sort((e,t)=>t.u-e.u||t.l.localeCompare(e.l)||k(e.x.name).localeCompare(k(t.x.name))),U='owner'===a||'manager'===a,Y=({id:e,name:n,icon:s,avatar:a})=>{const o=H(e),u=w[e]??0,x=b.includes(e);return(0,y.jsx)(l.default,{accessibilityRole:"button",accessibilityLabel:`Open ${n}`,onPress:()=>A(e),style:{padding:12,borderTopWidth:1,borderColor:f.colours.border},children:(0,y.jsxs)(h.Row,{children:[a?(0,y.jsx)(P,{s:a}):(0,y.jsx)(c.default,{style:{width:34,height:34,borderRadius:17,backgroundColor:(0,t.soutersSurface)('#222'),alignItems:'center',justifyContent:'center'},children:(0,y.jsx)(h.T,{size:16,children:s})}),(0,y.jsxs)(c.default,{style:{flex:1},children:[(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsxs)(h.T,{weight:u?'bold':'medium',children:[n,x?' \ud83d\udd15':'']}),o?(0,y.jsx)(h.Muted,{children:(0,m.hm)(new Date(o.at))}):null]}),(0,y.jsx)(h.Muted,{numberOfLines:1,children:o?o.removed?'Message removed':`${'system'===o.from?'CoverCharge':k(i.find(e=>e.id===o.from)?.name)}: ${o.text??'Photo'}`:'No messages yet'})]}),u?(0,y.jsx)(c.default,{style:{backgroundColor:x?'#555':f.colours.red,borderRadius:10,minWidth:20,height:20,alignItems:'center',justifyContent:'center',paddingHorizontal:5},children:(0,y.jsx)(h.T,{size:11,weight:"bold",children:u})}):null]})})};return(0,y.jsxs)(c.default,{style:{gap:10},children:[I?(0,y.jsx)(c.default,{testID:"chat-synced",children:(0,y.jsx)(h.Muted,{children:"\u2713 Shared with the team: messages reach everyone in the chat on their own phone."})}):(0,y.jsx)(h.Banner,{kind:"warn",title:"On this device only for now",children:"You\u2019re not connected with your personal link (or chat sharing isn\u2019t switched on yet), so anything you send stays on this device and nobody else will see it. Open your personal invite link to share chat with the team. Use your usual group chat for anything urgent."}),I&&B?(0,y.jsx)(c.default,{testID:"chat-sync-error",children:(0,y.jsx)(h.Banner,{kind:"warn",title:"Can\u2019t reach the server right now",children:"Showing the messages on this phone. New messages will be sent and others\u2019 messages will appear when the connection is back; it retries automatically."})}):null,(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsxs)(h.Muted,{children:["Signed in as ",k(W?.name)," (",'Head Chef'===W?.level?'Head Chef':u.ROLE_LABEL[a],")"]}),(0,y.jsx)(h.Button,{small:!0,kind:"ghost",label:"Chat settings",onPress:()=>_(!0)})]}),(0,y.jsxs)(c.default,{style:{borderRadius:14,borderWidth:1,borderColor:f.colours.border,backgroundColor:f.colours.surface,overflow:'hidden'},children:[(0,y.jsx)(h.T,{size:12,weight:"semibold",colour:f.colours.gold,style:{padding:10},children:"TEAM CHATS"}),v.filter(e=>'all'===e.id||(0,p.inChannel)(e.id,W)).map(e=>(0,y.jsx)(Y,{id:e.id,name:e.pinned?`${e.name} \ud83d\udccc`:e.name,icon:e.icon},e.id))]}),(0,y.jsxs)(c.default,{style:{borderRadius:14,borderWidth:1,borderColor:f.colours.border,backgroundColor:f.colours.surface,overflow:'hidden'},children:[(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between',padding:10},children:[(0,y.jsx)(h.T,{size:12,weight:"semibold",colour:f.colours.gold,children:"PRIVATE MESSAGES"}),(0,y.jsx)(h.Button,{small:!0,kind:"success",label:"New message",testID:"chat-new-pm",onPress:()=>$(!0)})]}),K.map(e=>(0,y.jsx)(Y,{id:e.id,name:k(e.x.name),avatar:e.x},e.id)),K.length?null:(0,y.jsx)(h.Muted,{style:{padding:10},children:"Nobody else on the team yet."})]}),(0,y.jsx)(h.Muted,{children:"Private messages can only be read by the two people in them; owners and managers can\u2019t read other people\u2019s private messages. The Kitchen chat is for owners, managers, head chefs and kitchen staff, and can\u2019t be left."}),(0,y.jsx)(h.Sheet,{visible:L,onClose:()=>$(!1),title:"New private message",children:i.filter(e=>e.active&&e.id!==s).map(e=>(0,y.jsx)(l.default,{accessibilityRole:"button",accessibilityLabel:`Message ${e.name}`,onPress:()=>{$(!1),A((0,p.dmId)(s,e.id))},style:{paddingVertical:8},children:(0,y.jsxs)(h.Row,{children:[(0,y.jsx)(P,{s:e}),(0,y.jsxs)(c.default,{children:[(0,y.jsx)(h.T,{children:k(e.name)}),(0,y.jsxs)(h.Muted,{children:[u.ROLE_LABEL[e.role]," \xb7 ",e.job]})]})]})},e.id))}),(0,y.jsxs)(h.Sheet,{visible:N,onClose:()=>_(!1),title:"Chat settings",children:[(0,y.jsx)(h.Banner,{kind:"info",title:"Privacy",children:"Chat is for work. Managers and the owner see messages in the channels they belong to and the owner can remove messages in group chats. Private messages can only be read by the two people in them: the server enforces this, so nobody else (not even the owner) can read them. Don\u2019t share customer card or health details beyond what\u2019s needed for service."}),(0,y.jsx)(h.T,{weight:"semibold",children:"Mute channels"}),v.filter(e=>(0,p.inChannel)(e.id,W)).map(e=>(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsxs)(h.T,{children:[e.icon," ",e.name]}),(0,y.jsx)(h.Toggle,{label:`Mute ${e.name}`,value:b.includes(e.id),onChange:()=>u.useOwner.getState().chatMute(s,e.id)})]},e.id)),(0,y.jsx)(h.Muted,{children:"Muted channels don\u2019t count towards the tab badge. The Kitchen chat can be muted but not left."}),U?(0,y.jsxs)(c.default,{style:{gap:6},testID:"kitchen-members",children:[(0,y.jsx)(h.T,{weight:"semibold",children:"Kitchen chat members"}),(0,y.jsxs)(h.Muted,{children:["Automatic: owners, managers, head chefs and kitchen staff (chefs, kitchen porters). Change who else is in it here",I?'':'; saved on this device for now',"."]}),i.filter(e=>e.active).map(e=>{const t=D[e.id]??(0,p.kitchenByRule)(e);return(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsxs)(h.T,{children:[k(e.name),null!=D[e.id]?' (changed)':'']}),(0,y.jsx)(h.Toggle,{label:`Kitchen chat: ${k(e.name)}`,value:t,onChange:t=>p.useKitchenExtra.getState().set(e.id,t===(0,p.kitchenByRule)(e)?null:t)})]},e.id)})]}):null]})]})}},1000,[868,877,833,5,30,992,263,127,813,856,818,821,927,953,1182,1181,24]); +__d(function(g,r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SNOOZE_MINS",{enumerable:!0,get:function(){return S}}),e.useScheduledNotices=function({rid:d,staffId:S,name:h,onOpen:w}){const D=(0,t.useRef)(h);D.current=h;const I=(0,t.useRef)(w);I.current=w,(0,t.useEffect)(()=>{if('undefined'==typeof window||!window.location?.search)return;const t=new URLSearchParams(window.location.search);'orderlists'===t.get('open')&&(o.useListOpen.getState().request(t.get('list')??void 0),setTimeout(()=>I.current?.('orderlists'),0))},[]);const N=(0,s.useNotifs)(t=>t.items.map(t=>`${t.id}:${t.updatedAt??''}`).join()),v=(0,c.useReminders)(t=>t.done.length);(0,t.useEffect)(()=>{s.useNotifs.getState().ensure(d);const t=()=>{const t=p(),h=s.useNotifs.getState(),w=n.useOwner.getState().staff.map(t=>({id:t.id,role:t.role,level:t.level,job:t.job,department:t.dept,active:t.active})),N=w.filter(s=>!1!==s.active&&(0,l.shiftNow)(s.id,t).on).map(t=>t.id);for(const n of h.items){if(n.rid!==d)continue;const l=`sched:${n.id}`;if(!S||n.removed||n.paused||!n.sendBy.inApp||!(0,u.isRecipient)(n,S,w,N)){(0,f.dismissNotice)(l);continue}const{due:v,forDate:O}=(0,u.notifDue)(n,t),b=c.useReminders.getState().done.find(t=>t.reminderId===n.id&&t.forDate===O),R=`sched:${n.id}:${O}`;!v||b||(h.snooze[R]??0)>t?(0,f.dismissNotice)(l):(0,f.notify)({id:l,icon:'\ud83d\udd14',kicker:'NOTICE',title:n.title,body:n.message,testID:'sched-notice',timeoutMs:null,actions:[{label:'Done',testID:'sched-notice-done',onPress:()=>c.useReminders.getState().markDone({rid:d,reminderId:n.id,forDate:O,at:new Date(p()).toISOString(),staffRef:S,staffName:D.current.replace(' (example)','')})},...'orderlists'===n.open?.page&&I.current?[{label:'Open list',testID:'sched-notice-open',onPress:()=>{o.useListOpen.getState().request(n.open?.list),I.current?.('orderlists')}}]:[],{label:'Later',kind:'ghost',testID:'sched-notice-later',onPress:()=>s.useNotifs.getState().setSnooze(R,p()+9e5)}]})}};t();const h=setInterval(t,2e4);return()=>clearInterval(h)},[d,S,N,v])};var t=r(_d[0]),s=r(_d[1]),n=r(_d[2]),o=r(_d[3]),c=r(_d[4]),d=r(_d[5]),u=r(_d[6]),f=r(_d[7]),l=r(_d[8]);const p=()=>{try{return(0,d.nowFrom)(d.useStore.getState().clock).getTime()}catch{return Date.now()}},S=15},1001,[30,956,856,1005,957,872,958,947,959]); +__d(function(g,_r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useOffRotaPrompt=function({rid:r,staffId:k}){const w=(0,o.useRef)(!1),h=(0,n.useClockArea)(o=>{const n=o.areas[r];return!(0,t.privateClockVenue)(r)&&!!n&&!1!==n.offRotaPrompt&&null!=n.lat});(0,o.useEffect)(()=>{if(!h||!k)return;const t=async()=>{if(w.current||'undefined'!=typeof document&&'hidden'===document.visibilityState)return;const t=(0,n.areaOf)(r);if(!(0,a.areaSet)(t)||!t.offRotaPrompt)return;const o=l(),y=(0,f.ukClock)(o).ymd,h=`${y}:${k}`,b=s.useOwner.getState();if(n.useClockArea.getState().visiting[h]||(0,s.openShiftOf)(b.attendance,k,new Date(o)))return void(0,d.dismissNotice)('off-rota');if(!await(0,c.locationAllowed)())return;w.current=!0;const v=await(0,c.getFix)();if(w.current=!1,'object'!=typeof v)return;const S=new Date(o),I=b.shifts.filter(t=>t.staffId===k&&t.date===y&&!1!==t.published);(0,a.offRotaDue)({area:t,inside:(0,a.isInside)(t,v).inside,clockedIn:!1,shifts:I,nowHours:S.getHours()+S.getMinutes()/60,dismissedToday:!1})?(0,d.notify)({id:'off-rota',icon:'\ud83d\udccd',kicker:'AT THE VENUE',title:t.offRotaTitle,body:t.offRotaBody,testID:'off-rota',timeoutMs:null,actions:[{label:'Yes, clock me in',testID:'off-rota-yes',onPress:()=>{(0,u.clockAction)('in',{rid:r,staffId:k,date:y,at:new Date(l()).toISOString(),offRota:!0}).then(t=>{(0,d.notify)(t.ok?{id:'off-rota-done',title:'Clocked in',body:'Your manager will see you weren\u2019t on the rota today.',timeoutMs:6e3}:{id:'off-rota-done',tone:'warn',title:'Not clocked in',body:t.message,timeoutMs:9e3})})}},{label:'No, just visiting',kind:'ghost',testID:'off-rota-no',onPress:()=>n.useClockArea.getState().setVisiting(h)}]}):(0,d.dismissNotice)('off-rota')};t();const o=setInterval(()=>{t()},y),b=()=>{'visible'===document.visibilityState&&t()};return'undefined'!=typeof document&&document.addEventListener('visibilitychange',b),()=>{clearInterval(o),'undefined'!=typeof document&&document.removeEventListener('visibilitychange',b)}},[r,k,h])},e.useOffRotaAlerts=function({enabled:t}){const n=(0,o.useRef)(new Set),r=(0,s.useOwner)(t=>t.attendance);(0,o.useEffect)(()=>{if(!t)return;const o=(0,f.ukClock)(l()).ymd;for(const t of r){if(!t.offRota||t.date!==o||n.current.has(t.id))continue;n.current.add(t.id);const r=s.useOwner.getState().staff.find(o=>o.id===t.staffId)?.name??'Someone',a=t.in?new Date(t.in).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}):'';(0,d.notify)({id:`off-rota-mgr:${t.id}`,icon:'\ud83d\udccd',kicker:'NOT ON THE ROTA',title:`${r} clocked in at ${a}`,body:'They weren\u2019t on today\u2019s rota. Check Hours if that\u2019s not right.',timeoutMs:null,actions:[{label:'OK',testID:'off-rota-mgr-ok',onPress:()=>{}}]})}},[r,t])};var t=_r(_d[0]),o=_r(_d[1]),n=_r(_d[2]),s=_r(_d[3]),r=_r(_d[4]),a=_r(_d[5]),f=_r(_d[6]),c=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]);const l=()=>{try{return(0,r.nowFrom)(r.useStore.getState().clock).getTime()}catch{return Date.now()}},y=24e4},1002,[989,30,1177,856,872,954,1121,1247,947,1266]); +__d(function(g,r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ListBadge=C,_e.OrderListsScreen=function({rid:e,who:t,editor:s,today:i}){(0,o.useEffect)(()=>{x.useOrderLists.getState().ensure(e)},[e]);const d=(0,x.useOrderLists)(e=>e.lists).filter(t=>t.rid===e&&!t.archived),n=(0,x.useOrderLists)(e=>e.items);(0,x.useOrderLists)(t=>t.settings[e]);const l=(0,x.orderSettingsOf)(e).allowStaff,h=(0,x.useListOpen)(e=>e.seed),[y,j]=(0,o.useState)(null);(0,o.useEffect)(()=>{if(!h)return;const e=d.find(e=>e.seed===h);e&&(j(e.id),x.useListOpen.getState().request(void 0))},[h,d.length]);const f=s||l;if(!s&&!l)return(0,w.jsxs)(c.Card,{children:[(0,w.jsx)(c.T,{children:"Order lists are for managers and the Head Chef here."}),(0,w.jsx)(c.Muted,{children:"Ask a manager to switch on \u201cLet all staff add items\u201d."})]});const b=d.find(e=>e.id===y);if(b)return(0,w.jsx)($,{rid:e,list:b,editor:s,canAdd:f,who:t,today:i,onBack:()=>j(null)});const I=(0,x.orderSettingsOf)(e).defaultTripDay;return(0,w.jsxs)(u.default,{style:{gap:10},testID:"order-lists",children:[(0,w.jsxs)(c.Muted,{size:13,children:["Tip: add what\u2019s running low as you notice it. ",s?'On the day, tick what you got, then Finish order.':'A manager or the Head Chef places the order.']}),d.map(t=>{const s=(0,p.liveItems)(n.filter(t=>t.rid===e),t.id).filter(e=>'open'===e.status).length;return(0,w.jsx)(c.Card,{onPress:()=>j(t.id),children:(0,w.jsx)(u.default,{testID:`order-list-card-${t.seed??t.id}`,children:(0,w.jsxs)(c.Row,{gap:10,children:[(0,w.jsx)(C,{list:t}),(0,w.jsxs)(u.default,{style:{flex:1},children:[(0,w.jsx)(c.T,{weight:"semibold",children:t.name}),(0,w.jsx)(c.Muted,{size:12,children:(0,p.tripText)(t,i,I)})]}),(0,w.jsx)(c.Badge,{kind:s?'gold':'neutral',label:`${s} to get`})]})})},t.id)}),d.length?null:(0,w.jsx)(c.Muted,{children:"No order lists yet. Add one in Settings \u203a Advanced \u203a Order lists."})]})};var t=r(_d[0]),s=r(_d[1]),i=r(_d[2]),o=r(_d[3]),d=e(r(_d[4])),n=e(r(_d[5]));r(_d[6]);var l=e(r(_d[7])),u=e(r(_d[8])),c=r(_d[9]),h=r(_d[10]),x=r(_d[11]),p=r(_d[12]),y=r(_d[13]),j=r(_d[14]),f=r(_d[15]),b=r(_d[16]),w=r(_d[17]);const I={minHeight:44,borderRadius:10,borderWidth:1,borderColor:h.colours.hairline,backgroundColor:h.colours.surface2,color:h.colours.text,paddingHorizontal:10,fontSize:15},L=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'}):'',v=e=>e.replace(' (example)','').split(' ')[0];function C({list:e,size:s=40}){const i=(0,f.useLogoCache)(t=>t.byList[e.id]),[n,l]=(0,o.useState)(null);(0,o.useEffect)(()=>{let t=!0;return!i&&e.logo&&(0,b.orderLogoUrl)(e.logo).then(e=>{t&&l(e)}),()=>{t=!1}},[e.logo,i]);const x=i??n;return x?(0,w.jsx)(d.default,{testID:`list-logo-${e.seed??e.id}`,source:{uri:x},accessibilityLabel:`${e.name} logo`,style:{width:s,height:s,borderRadius:s/2,borderWidth:1,borderColor:h.colours.gold}}):(0,w.jsx)(u.default,{testID:`list-initials-${e.seed??e.id}`,accessibilityLabel:`${e.name}`,style:{width:s,height:s,borderRadius:s/2,backgroundColor:(0,t.soutersSurface)('#1c1a16'),borderWidth:1,borderColor:h.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,w.jsx)(c.T,{size:.38*s,weight:"bold",colour:h.colours.gold,children:(0,p.initials)(e.name)})})}function D({phone:e}){const t=(0,p.telHref)(e);if(!e||!t)return null;return'undefined'!=typeof navigator&&/Android|iPhone|iPad|iPod/i.test(navigator.userAgent)?(0,w.jsx)(l.default,{testID:"list-phone",accessibilityRole:"link",onPress:()=>{n.default.openURL(t)},children:(0,w.jsxs)(c.T,{colour:h.colours.gold,children:["\ud83d\udcde Call ",e]})}):(0,w.jsxs)(c.Row,{gap:8,children:[(0,w.jsx)(u.default,{testID:"list-phone",children:(0,w.jsxs)(c.T,{children:["\ud83d\udcde ",e]})}),(0,w.jsx)(c.Button,{small:!0,kind:"ghost",testID:"list-phone-copy",label:"Copy",onPress:()=>{navigator.clipboard?.writeText(e).then(()=>(0,y.notify)({id:'copied',title:'Number copied',timeoutMs:3e3}))}})]})}function T({list:e}){const t=x.useOrderLists.getState(),s=(0,f.useLogoCache)(t=>!!t.byList[e.id])||!!e.logo,i=async s=>{try{const i=await(0,j.capturePlatingPhoto)(s);if(!i)return;const o=await(0,f.squareLogo)(i.dataUrl,256);f.useLogoCache.getState().put(e.id,o);const d=await(0,b.uploadOrderLogo)(e.id,o);if(d.ok){const s=e.logo;t.updateList(e.id,{logo:d.path}),s&&(0,b.removeOrderLogo)(s)}else'offline'!==d.message&&(0,y.notify)({id:'logo',tone:'warn',title:'Logo saved on this device only',body:d.message,timeoutMs:7e3})}catch(e){(0,y.notify)({id:'logo',tone:'warn',title:'Couldn\u2019t use that picture',body:String(e.message),timeoutMs:7e3})}};return(0,w.jsxs)(c.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(c.Button,{small:!0,kind:"secondary",testID:"logo-camera",label:s?'Replace: take photo':'Logo: take photo',onPress:()=>{i('camera')}}),(0,w.jsx)(c.Button,{small:!0,kind:"secondary",testID:"logo-library",label:s?'Replace: choose':'Logo: choose image',onPress:()=>{i('library')}}),s?(0,w.jsx)(c.Button,{small:!0,kind:"ghost",testID:"logo-remove",label:"Remove logo",onPress:()=>{f.useLogoCache.getState().drop(e.id),e.logo&&(0,b.removeOrderLogo)(e.logo),t.updateList(e.id,{logo:void 0})}}):null]})}function S({rid:e,list:t,who:i}){const[d,n]=(0,o.useState)(''),[l,y]=(0,o.useState)('1'),[j,f]=(0,o.useState)(''),[b,L]=(0,o.useState)(''),[C,D]=(0,o.useState)(null),T=x.useOrderLists.getState(),S=Number(l.replace(',','.')),B=d.trim().length>0&&(0,p.validQty)(S),$=()=>{n(''),y('1'),L(''),D(null)};return(0,w.jsxs)(u.default,{testID:"order-add",style:{gap:6},children:[(0,w.jsxs)(c.Row,{gap:6,children:[(0,w.jsx)(s.TextInput,{accessibilityLabel:"Item",testID:"order-add-name",value:d,onChangeText:n,placeholder:"Item, e.g. Tennent\u2019s",placeholderTextColor:h.colours.muted,style:{...I,flex:1}}),(0,w.jsx)(s.TextInput,{accessibilityLabel:"Quantity",testID:"order-add-qty",value:l,onChangeText:y,keyboardType:"decimal-pad",style:{...I,width:64,borderColor:(0,p.validQty)(S)?h.colours.hairline:h.colours.red}})]}),(0,w.jsx)(c.Row,{wrap:!0,gap:4,children:p.UNITS.map(e=>(0,w.jsx)(c.Chip,{label:e||'no unit',selected:j===e,onPress:()=>f(e)},e||'none'))}),(0,w.jsxs)(c.Row,{gap:6,children:[(0,w.jsx)(s.TextInput,{accessibilityLabel:"Note",testID:"order-add-note",value:b,onChangeText:L,placeholder:"Note (optional)",placeholderTextColor:h.colours.muted,style:{...I,flex:1}}),(0,w.jsx)(c.Button,{testID:"order-add-save",label:"Add",disabled:!B,onPress:()=>{const s=(0,p.findDuplicate)(T.items.filter(t=>t.rid===e),t.id,d,j);s?D(s):(T.addItem(e,{listId:t.id,name:d.trim(),qty:S,unit:j,note:b.trim()||void 0,addedBy:i.id,addedByName:i.name}),$())}})]}),(0,w.jsxs)(c.Sheet,{visible:!!C,onClose:()=>D(null),title:"Already on the list",testID:"order-dup",children:[(0,w.jsx)(c.T,{children:C?`${C.name}: ${(0,p.qtyText)(C)} (added by ${v(C.addedByName)})`:''}),(0,w.jsxs)(c.Row,{gap:8,children:[(0,w.jsx)(c.Button,{testID:"order-dup-bump",label:`Add ${l} more`,onPress:()=>{C&&T.bump(C.id,S,i),$()}}),(0,w.jsx)(c.Button,{kind:"ghost",label:"Add as separate item",onPress:()=>{T.addItem(e,{listId:t.id,name:d.trim(),qty:S,unit:j,note:b.trim()||void 0,addedBy:i.id,addedByName:i.name}),$()}})]})]})]})}function B({item:e,editor:t,who:s}){const i=x.useOrderLists.getState(),o='got'===e.status?h.colours.gold:'missing'===e.status?h.colours.amber:h.colours.text;return(0,w.jsxs)(u.default,{testID:`order-item-${e.id}`,style:{borderTopWidth:1,borderColor:h.colours.hairline,paddingVertical:8,gap:4},children:[(0,w.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(c.T,{weight:"semibold",colour:o,style:{flex:1,textDecorationLine:'got'===e.status?'line-through':'none'},children:e.name}),(0,w.jsx)(c.T,{weight:"semibold",children:(0,p.qtyText)(e)})]}),e.note?(0,w.jsxs)(c.Muted,{size:12,children:["Note: ",e.note]}):null,(0,w.jsxs)(c.Muted,{size:12,children:["Added by ",v(e.addedByName)," \xb7 ",L(e.addedAt),e.bumps?.length?` \xb7 +${e.bumps.map(e=>`${e.qty} ${v(e.name)}`).join(', ')}`:'',e.carried?' \xb7 carried over':'']}),'open'!==e.status?(0,w.jsxs)(c.Muted,{size:12,children:['got'===e.status?'Got / ordered':'Missing / not in stock'," \xb7 ",e.statusBy," ",L(e.statusAt)]}):null,t?(0,w.jsxs)(c.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(c.Chip,{testID:`order-got-${e.id}`,label:"\u2713 Got / ordered",selected:'got'===e.status,onPress:()=>i.setStatus(e.id,'got'===e.status?'open':'got',s)}),(0,w.jsx)(c.Chip,{testID:`order-missing-${e.id}`,label:"Missing / not in stock",selected:'missing'===e.status,onPress:()=>i.setStatus(e.id,'missing'===e.status?'open':'missing',s)}),(0,w.jsx)(c.Chip,{testID:`order-remove-${e.id}`,label:"Remove",onPress:()=>{i.removeItem(e.id),(0,y.notify)({id:`undo-${e.id}`,title:`Removed ${e.name}`,timeoutMs:8e3,actions:[{label:'Undo',testID:'order-undo',onPress:()=>i.undoRemove(e.id)}]})}})]}):null]})}function $({rid:e,list:t,editor:d,canAdd:n,who:l,today:j,onBack:f}){(0,i.useBackLayer)(!0,f);const b=(0,x.useOrderLists)(e=>e.items),$=(0,x.useOrderLists)(e=>e.history).filter(e=>e.listId===t.id),P=(0,p.liveItems)(b.filter(t=>t.rid===e),t.id),[k,R]=(0,o.useState)(!1),[O,M]=(0,o.useState)(!1),[A,z]=(0,o.useState)(t.phone??''),N=x.useOrderLists.getState(),q=P.filter(e=>'got'!==e.status).length,H=(0,x.orderSettingsOf)(e).defaultTripDay;return(0,w.jsxs)(u.default,{style:{gap:10},testID:`order-list-${t.seed??t.id}`,children:[(0,w.jsx)(i.BackButton,{onPress:f,testID:"order-list-back"}),(0,w.jsxs)(c.Card,{children:[(0,w.jsxs)(c.Row,{gap:10,children:[(0,w.jsx)(C,{list:t,size:48}),(0,w.jsxs)(u.default,{style:{flex:1},children:[(0,w.jsx)(c.T,{size:18,weight:"semibold",children:t.name}),(0,w.jsx)(c.Muted,{size:12,children:(0,p.tripText)(t,j,H)})]})]}),(0,w.jsx)(D,{phone:t.phone}),'trip'===t.kind&&d?(0,w.jsxs)(u.default,{style:{gap:4},children:[(0,w.jsx)(c.Muted,{size:12,children:"Trip day for this trip"}),(0,w.jsx)(c.Row,{wrap:!0,gap:4,children:[1,2,3,4,5,6,0].map(e=>(0,w.jsx)(c.Chip,{testID:`trip-day-${e}`,label:p.DAY_FULL[e].slice(0,3),selected:(t.tripDay??H)===e,onPress:()=>N.updateList(t.id,{tripDay:e})},e))})]}):null,d?(0,w.jsxs)(u.default,{style:{gap:6},children:[(0,w.jsx)(c.Row,{gap:6,children:(0,w.jsx)(s.TextInput,{accessibilityLabel:"Phone number",testID:"list-phone-edit",value:A,onChangeText:z,onBlur:()=>N.updateList(t.id,{phone:A.trim()||void 0}),placeholder:"Phone (optional)",placeholderTextColor:h.colours.muted,style:{...I,flex:1}})}),(0,w.jsx)(T,{list:t})]}):null]}),n?(0,w.jsxs)(c.Card,{children:[(0,w.jsx)(c.T,{weight:"semibold",children:"Add to this list"}),(0,w.jsx)(S,{rid:e,list:t,who:l})]}):null,(0,w.jsxs)(c.Card,{children:[(0,w.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(c.T,{weight:"semibold",children:"On the list"}),(0,w.jsx)(c.Badge,{kind:"neutral",label:`${P.length}`})]}),P.length?P.map(e=>(0,w.jsx)(B,{item:e,editor:d,who:l},e.id)):(0,w.jsx)(c.Muted,{children:"Nothing on this list yet."}),d&&P.length?(0,w.jsx)(c.Button,{testID:"order-finish",label:"Finish order",onPress:()=>R(!0)}):null]}),(0,w.jsx)(c.Button,{small:!0,kind:"ghost",testID:"order-history",label:O?'Hide history \u25b4':`History (${$.length}) \u25be`,onPress:()=>M(!O)}),O?$.map(e=>(0,w.jsxs)(c.Card,{children:[(0,w.jsxs)(c.T,{weight:"semibold",children:[L(e.finishedAt)," \xb7 ",v(e.finishedByName)]}),(0,w.jsx)(c.Muted,{size:12,children:e.items.map(e=>`${e.name} ${(0,p.qtyText)(e)}${'missing'===e.status?' (missing)':'open'===e.status?' (not got)':''}`).join(' \xb7 ')}),e.carried?(0,w.jsxs)(c.Muted,{size:12,children:[e.carried," carried over"]}):null]},e.id)):null,(0,w.jsxs)(c.Sheet,{visible:k,onClose:()=>R(!1),title:"Finish this order?",testID:"order-finish-sheet",children:[(0,w.jsxs)(c.T,{children:[P.length-q," got or ordered",q?`, ${q} not got (missing or still open)`:'',"."]}),(0,w.jsx)(c.Muted,{children:"It goes into History with today\u2019s date and your name."}),q?(0,w.jsxs)(c.T,{weight:"semibold",children:["Carry over the ",q," not got to the next order?"]}):null,(0,w.jsxs)(c.Row,{wrap:!0,gap:8,children:[q?(0,w.jsx)(c.Button,{testID:"order-finish-carry",label:"Finish and carry over",onPress:()=>{N.finish(e,t.id,!0,l),R(!1),(0,y.notify)({id:'order-done',title:`${t.name}: order finished`,body:`${q} carried over`,timeoutMs:6e3})}}):null,(0,w.jsx)(c.Button,{testID:"order-finish-clear",kind:q?'secondary':'primary',label:q?'Finish, don\u2019t carry over':'Finish order',onPress:()=>{N.finish(e,t.id,!1,l),R(!1),(0,y.notify)({id:'order-done',title:`${t.name}: order finished`,timeoutMs:6e3})}}),(0,w.jsx)(c.Button,{kind:"ghost",label:"Cancel",onPress:()=>R(!1)})]})]})]})}},1003,[868,877,992,30,196,239,122,263,127,813,821,1005,1176,947,1272,1273,820,24]); +__d(function(_g,_r,i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.NotificationsSettings=function({rid:e}){(0,n.useEffect)(()=>{c.useNotifs.getState().ensure(e),(0,j.readPushLive)()},[e]);const t=(0,c.useNotifs)(e=>e.items).filter(t=>t.rid===e&&!t.removed),s=(0,h.useOwner)(e=>e.staff),o=(0,j.usePushLive)(),[l,p]=(0,n.useState)(null),[f,g]=(0,n.useState)(null),[x,b]=(0,n.useState)(!1),y=c.useNotifs.getState(),T=s.map(e=>({id:e.id,role:e.role,level:e.level,job:e.job,department:e.dept,active:e.active})),v=e=>{const t=(0,u.resolveRecipients)(e,T,[]),n=[...e.recipients.groups.map(e=>u.NOTIF_GROUP_LABEL[e]),...(e.recipients.onShiftIn??[]).map(e=>u.SHIFT_FILTER_LABEL[e])];e.recipients.fallback&&n.push(`else ${[...e.recipients.fallback.groups.map(e=>u.NOTIF_GROUP_LABEL[e]),...e.recipients.fallback.staff.map(e=>I(s.find(t=>t.id===e)?.name??e))].join(', ')}`);const o=e.recipients.staff.map(e=>I(s.find(t=>t.id===e)?.name??e));return[...n,...o].join(', ')+(t.length||(e.recipients.onShiftIn??[]).length?'':' (nobody yet)')};return(0,k.jsxs)(a.default,{style:{gap:10},testID:"notif-settings",children:[(0,k.jsx)(r.Muted,{size:13,children:"Tip: these remind people at a set time, e.g. the Mills milk order. They show in the app as a gold slider with Done and Later. Done is logged with the name and time. Times are UK time."}),(0,k.jsxs)(a.default,{testID:"push-live-status",style:{borderWidth:1,borderColor:d.colours.accentBorder,borderRadius:10,padding:8,gap:4},children:[(0,k.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(r.T,{weight:"semibold",children:"Send to phones"}),(0,k.jsx)(r.Badge,{kind:o.live?'gold':'neutral',label:o.live?'ON':'OFF'})]}),(0,k.jsx)(r.Muted,{size:12,children:o.live?'Phone notifications go to people who turned them on.':'Off: nothing goes to anyone\u2019s phone yet. In-app reminders still work.'}),(0,k.jsx)(r.Button,{small:!0,kind:"secondary",testID:"push-live-toggle",label:o.live?'Switch phone notifications off':'Switch phone notifications on\u2026',onPress:()=>b(!0)})]}),(0,k.jsx)(R,{}),t.map(e=>l===e.id?(0,k.jsx)(D,{init:e,onCancel:()=>p(null),onSave:t=>{y.update(e.id,t),p(null)}},e.id):(0,k.jsxs)(a.default,{testID:`notif-${e.seed??e.id}`,style:{borderWidth:1,borderColor:d.colours.hairline,borderRadius:12,padding:10,gap:4,opacity:e.paused?.6:1},children:[(0,k.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(r.T,{weight:"semibold",style:{flex:1},children:e.title}),e.paused?(0,k.jsx)(r.Badge,{kind:"neutral",label:"Off"}):null]}),(0,k.jsx)(r.Muted,{size:13,children:e.message}),(0,k.jsxs)(r.Muted,{size:12,children:[(0,u.scheduleText)(e)," \xb7 ",v(e)," \xb7 ",[e.sendBy.inApp?'In app':'',e.sendBy.push?'Phone':''].filter(Boolean).join(' + ')]}),(0,k.jsxs)(r.Row,{gap:6,children:[(0,k.jsx)(r.Button,{small:!0,kind:"secondary",testID:`notif-edit-${e.seed??e.id}`,label:"Edit",onPress:()=>p(e.id)}),(0,k.jsx)(r.Button,{small:!0,kind:"ghost",label:e.paused?'Switch on':'Switch off',onPress:()=>y.update(e.id,{paused:!e.paused})}),(0,k.jsx)(r.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>g(e)})]})]},e.id)),'new'===l?(0,k.jsx)(D,{init:C,onCancel:()=>p(null),onSave:t=>{y.add(e,t),p(null)}}):(0,k.jsx)(r.Button,{small:!0,testID:"notif-add",label:"Add a notification",onPress:()=>p('new')}),(0,k.jsxs)(r.Sheet,{visible:!!f,onClose:()=>g(null),title:"Remove this notification?",children:[(0,k.jsx)(r.T,{children:f?.title}),(0,k.jsx)(r.Muted,{children:"Nobody gets it after this. Reset to default restores the configured rules."}),(0,k.jsxs)(r.Row,{gap:8,children:[(0,k.jsx)(r.Button,{label:"Remove",onPress:()=>{f&&y.remove(f.id),g(null)}}),(0,k.jsx)(r.Button,{kind:"ghost",label:"Cancel",onPress:()=>g(null)})]})]}),(0,k.jsxs)(r.Sheet,{visible:x,onClose:()=>b(!1),title:o.live?'Switch phone notifications off?':'Switch phone notifications on?',testID:"push-live-confirm",children:[(0,k.jsx)(r.T,{children:o.live?'Nothing more goes to phones. In-app reminders keep working.':'From the next scheduled time, everyone ticked on a notification with \u201cPhone notification\u201d gets it on any phone where they turned phone notifications on.'}),(0,k.jsxs)(r.Row,{gap:8,children:[(0,k.jsx)(r.Button,{testID:"push-live-yes",label:o.live?'Switch off':'Yes, switch on',onPress:()=>{(0,j.setPushLive)(!o.live).then(e=>(0,w.notify)({id:'push-live',tone:e.ok?'normal':'warn',title:e.ok?o.live?'Phone notifications are off':'Phone notifications are on':'Not changed',body:e.message??'',timeoutMs:7e3})),b(!1)}}),(0,k.jsx)(r.Button,{kind:"ghost",label:"Cancel",onPress:()=>b(!1)})]})]})]})},_e.PushButton=R,_e.OrderListsSettings=function({rid:e}){(0,n.useEffect)(()=>{p.useOrderLists.getState().ensure(e)},[e]);const s=(0,p.useOrderLists)(e=>e.lists).filter(t=>t.rid===e),o=(0,p.orderSettingsOf)(e);(0,p.useOrderLists)(t=>t.settings[e]);const l=p.useOrderLists.getState(),[c,u]=(0,n.useState)(''),[h,g]=(0,n.useState)({});return(0,k.jsxs)(a.default,{style:{gap:10},testID:"order-list-settings",children:[(0,k.jsx)(r.Muted,{size:13,children:"Tip: running lists (like Alsons drinks) collect items until you order; trip lists (like Cash and carry) are for one shopping day. Logos and phone numbers are set on each list."}),(0,k.jsx)(r.Toggle,{testID:"order-allow-staff",label:"Let all staff add items",value:o.allowStaff,onChange:t=>l.setSettings(e,{allowStaff:t})}),(0,k.jsx)(r.Muted,{size:12,children:"Staff can add items and see the lists. Only managers and the Head Chef tick, remove or finish an order."}),(0,k.jsx)(r.T,{weight:"semibold",children:"Default trip day"}),(0,k.jsx)(r.Row,{wrap:!0,gap:6,children:v.map(t=>(0,k.jsx)(r.Chip,{label:f.DAY_FULL[t].slice(0,3),selected:o.defaultTripDay===t,onPress:()=>l.setSettings(e,{defaultTripDay:t})},t))}),s.map(e=>(0,k.jsxs)(a.default,{testID:`order-list-row-${e.seed??e.id}`,style:{borderWidth:1,borderColor:d.colours.hairline,borderRadius:10,padding:8,gap:6,opacity:e.archived?.55:1},children:[(0,k.jsxs)(r.Row,{gap:6,children:[(0,k.jsx)(t.TextInput,{accessibilityLabel:`Rename ${e.name}`,value:h[e.id]??e.name,onChangeText:t=>g(s=>({...s,[e.id]:t})),onBlur:()=>{const t=(h[e.id]??'').trim();t&&t!==e.name&&l.updateList(e.id,{name:t})},style:{...T,flex:1,minWidth:0}}),(0,k.jsx)(r.Badge,{kind:"neutral",label:'trip'===e.kind?'Trip':'Running'})]}),'trip'===e.kind?(0,k.jsx)(r.Row,{wrap:!0,gap:6,children:v.map(t=>(0,k.jsx)(r.Chip,{label:f.DAY_FULL[t].slice(0,3),selected:(e.tripDay??o.defaultTripDay)===t,onPress:()=>l.updateList(e.id,{tripDay:t})},t))}):null,(0,k.jsx)(r.Row,{gap:6,children:(0,k.jsx)(r.Button,{small:!0,kind:"ghost",label:e.archived?'Bring back':'Archive',onPress:()=>l.updateList(e.id,{archived:!e.archived})})})]},e.id)),(0,k.jsxs)(r.Row,{gap:6,wrap:!0,children:[(0,k.jsx)(t.TextInput,{accessibilityLabel:"New list name",testID:"order-new-name",value:c,onChangeText:u,placeholder:"e.g. Butcher",placeholderTextColor:d.colours.muted,style:{...T,flexGrow:1,flexBasis:160,minWidth:0}}),(0,k.jsx)(r.Button,{small:!0,label:"Add running",disabled:c.trim().length<2,onPress:()=>{l.addList(e,{name:c.trim(),kind:'running'}),u('')}}),(0,k.jsx)(r.Button,{small:!0,kind:"secondary",label:"Add trip",disabled:c.trim().length<2,onPress:()=>{l.addList(e,{name:c.trim(),kind:'trip',tripDay:o.defaultTripDay}),u('')}})]})]})},Object.defineProperty(_e,"resetOrderLists",{enumerable:!0,get:function(){return B}}),_e.ClockAreaSettings=function({rid:e,me:c}){(0,g.useClockArea)(t=>t.areas[e]);const u=(0,g.areaOf)(e);const h=g.useClockArea.getState(),p=(0,s.privateClockVenue)(e),[f,j]=(0,n.useState)(null==u.lat?'':String(u.lat)),[y,w]=(0,n.useState)(null==u.lng?'':String(u.lng)),[v,S]=(0,n.useState)(!1),[I,C]=(0,n.useState)(''),[L,D]=(0,n.useState)(u.breakOptions.join(', ')),R=(t,s)=>{const n=Number(t),o=Number(s);t.trim()||s.trim()?Number.isFinite(n)&&Number.isFinite(o)&&Math.abs(n)<=90&&Math.abs(o)<=180&&h.set(e,{lat:n,lng:o},c):h.set(e,{lat:null,lng:null},c)},B=async()=>{if(p)return;S(!0),C('');const t=await(0,b.getFix)();if(S(!1),'object'!=typeof t)return void C('denied'===t?'Location is blocked for this app. Allow it in your browser or phone settings.':'Couldn\u2019t get your location. Try again outside or near a window.');const s=t.lat.toFixed(6),n=t.lng.toFixed(6);j(s),w(n),h.set(e,{lat:Number(s),lng:Number(n)},c),C(`Centre set to where you are (accurate to about ${Math.round(t.acc)} m).`)},P=(0,x.areaSet)(u);return(0,k.jsxs)(a.default,{style:{gap:10},testID:"clock-area-settings",children:[(0,k.jsx)(r.Muted,{size:13,children:p?'The address-matched pub centre is configured below. Only clock-in checks location; only pass/fail is saved. No background, clock-out or break checks. Change the radius or centre here; use a manager override for a refused check.':'Tip: stand in the middle of the venue and tap \u201cUse my current location\u201d. Clocking in, out and breaks then only work within the distance below. Rota and pay screens are never blocked.'}),P?null:(0,k.jsx)(r.Banner,{kind:"warn",title:"Clock-in area not set yet",children:"Until you set the centre, staff can clock in from anywhere."}),p?(0,k.jsx)(r.Muted,{children:"Clock-in at the pub is required. A manager can record an exception with a reason."}):(0,k.jsx)(r.Toggle,{testID:"clock-area-on",label:"Check people are at the venue",value:u.on,onChange:t=>h.set(e,{on:t},c)}),p?null:(0,k.jsx)(r.Button,{testID:"clock-area-here",label:v?'Finding you\u2026':'\ud83d\udccd Use my current location',disabled:v,onPress:()=>{B()}}),I?(0,k.jsx)(r.Muted,{size:13,children:I}):null,(0,k.jsxs)(r.Row,{wrap:!0,gap:8,children:[(0,k.jsxs)(a.default,{style:{gap:2},children:[(0,k.jsx)(r.Muted,{size:12,children:"Latitude"}),(0,k.jsx)(t.TextInput,{accessibilityLabel:"Latitude",testID:"clock-area-lat",value:f,onChangeText:j,onBlur:()=>R(f,y),placeholder:"55.40\u2026",placeholderTextColor:d.colours.muted,style:{...T,width:130}})]}),(0,k.jsxs)(a.default,{style:{gap:2},children:[(0,k.jsx)(r.Muted,{size:12,children:"Longitude"}),(0,k.jsx)(t.TextInput,{accessibilityLabel:"Longitude",testID:"clock-area-lng",value:y,onChangeText:w,onBlur:()=>R(f,y),placeholder:"-4.75\u2026",placeholderTextColor:d.colours.muted,style:{...T,width:130}})]})]}),P?(0,k.jsx)(l.default,{accessibilityRole:"link",testID:"clock-area-map",onPress:()=>{o.default.openURL(`https://www.openstreetmap.org/?mlat=${u.lat}&mlon=${u.lng}#map=18/${u.lat}/${u.lng}`)},children:(0,k.jsx)(r.T,{size:13,colour:d.colours.gold,children:"See the pin on a map \u203a"})}):null,(0,k.jsx)(r.T,{weight:"semibold",children:"How far from the centre"}),(0,k.jsxs)(r.Row,{gap:8,children:[(0,k.jsx)(r.Button,{small:!0,kind:"secondary",label:"\u2212",onPress:()=>h.set(e,{radius:(0,x.clampRadius)(u.radius-10)},c)}),(0,k.jsxs)(r.T,{weight:"semibold",style:{minWidth:70,textAlign:'center'},children:[u.radius," m"]}),(0,k.jsx)(r.Button,{small:!0,kind:"secondary",label:"+",onPress:()=>h.set(e,{radius:(0,x.clampRadius)(u.radius+10)},c)})]}),(0,k.jsxs)(r.Muted,{size:12,children:["At least ",x.MIN_RADIUS," m. Phones aren\u2019t exact, so up to 50 m of the phone\u2019s own accuracy is added on top."]}),(0,k.jsx)(r.T,{weight:"semibold",children:"Forgotten break: lengths to offer at clock-out"}),(0,k.jsx)(t.TextInput,{accessibilityLabel:"Break lengths in minutes",testID:"clock-break-options",value:L,onChangeText:D,onBlur:()=>{const t=L.split(/[ ,]+/).map(Number).filter(e=>Number.isFinite(e)&&e>0&&e<=180);t.length&&h.set(e,{breakOptions:[...new Set(t)].sort((e,t)=>e-t)},c),D((0,g.areaOf)(e).breakOptions.join(', '))},style:T}),(0,k.jsxs)(r.Muted,{size:12,children:["Minutes, e.g. 5, 10, 15, 20, 30, 45, 60. Shows as ",u.breakOptions.map(x.breakLabel).join(', ')," and \u201cNo break\u201d."]}),p?(0,k.jsx)(r.Muted,{children:"No automatic arrival checks: staff location is used only at clock-in."}):(0,k.jsxs)(k.Fragment,{children:[" ",(0,k.jsx)(r.T,{weight:"semibold",children:"Not on the rota"}),(0,k.jsx)(r.Toggle,{testID:"clock-offrota-on",label:"Ask people at the venue who aren\u2019t on the rota if they want to clock in",value:u.offRotaPrompt,onChange:t=>h.set(e,{offRotaPrompt:t},c)}),(0,k.jsx)(t.TextInput,{accessibilityLabel:"Off-rota question",testID:"clock-offrota-title",value:u.offRotaTitle,onChangeText:t=>h.set(e,{offRotaTitle:t||x.DEFAULT_CLOCK_AREA.offRotaTitle},c),style:T}),(0,k.jsx)(t.TextInput,{accessibilityLabel:"Off-rota second line",testID:"clock-offrota-body",value:u.offRotaBody,onChangeText:t=>h.set(e,{offRotaBody:t||x.DEFAULT_CLOCK_AREA.offRotaBody},c),style:T}),(0,k.jsx)(r.Muted,{size:12,children:"This only checks while the app is open (web apps can\u2019t watch location in the background; that would need a native app)."})]})]})},Object.defineProperty(_e,"resetClockArea",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"COOKSAFE_URL",{enumerable:!0,get:function(){return O}}),_e.FoodSafetyCard=function({children:e}){return(0,k.jsx)(r.Card,{children:(0,k.jsxs)(a.default,{testID:"food-safety",style:{gap:6},children:[(0,k.jsx)(r.T,{size:17,weight:"semibold",children:"Food safety"}),(0,k.jsxs)(r.T,{children:["Based on ",(0,k.jsx)(r.T,{weight:"bold",colour:d.colours.gold,children:"CookSafe"})," (Food Standards Scotland)"]}),(0,k.jsx)(r.Muted,{size:12,children:"CoverCharge is not endorsed by Food Standards Scotland."}),(0,k.jsx)(l.default,{accessibilityRole:"link",testID:"cooksafe-link",onPress:()=>{o.default.openURL(O)},children:(0,k.jsx)(r.T,{size:14,colour:d.colours.gold,children:"Open the CookSafe guidance \u203a"})}),(0,k.jsx)(r.Muted,{size:13,children:"Full logs coming in the next update."}),e]})})};var t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),o=e(_r(_d[3])),l=e(_r(_d[4])),a=e(_r(_d[5])),r=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),f=_r(_d[12]),g=_r(_d[13]),x=_r(_d[14]),b=_r(_d[15]),j=_r(_d[16]),y=_r(_d[17]),w=_r(_d[18]),k=_r(_d[19]);const T={minHeight:44,borderRadius:10,borderWidth:1,borderColor:d.colours.hairline,backgroundColor:d.colours.surface2,color:d.colours.text,paddingHorizontal:10,fontSize:15},v=[1,2,3,4,5,6,0],S=['on_shift','everyone','managers','head_chef','kitchen','foh'],I=e=>e.replace(' (example)',''),C={title:'',message:'',days:[3,4,5,6,0],time:'21:00',recipients:{staff:[],groups:[]},sendBy:{inApp:!0,push:!1}};function L({value:e,onChange:t}){const s=(0,h.useOwner)(e=>e.staff).filter(e=>e.active);return(0,k.jsxs)(a.default,{style:{gap:6},testID:"notif-recipients",children:[(0,k.jsx)(r.T,{weight:"semibold",children:"Who gets it"}),(0,k.jsx)(r.Muted,{size:12,children:"Tick people, or pick a group (groups follow the team as it changes)."}),(0,k.jsx)(r.Row,{wrap:!0,gap:6,children:S.map(s=>(0,k.jsx)(r.Chip,{testID:`notif-group-${s}`,label:u.NOTIF_GROUP_LABEL[s],selected:e.groups.includes(s),onPress:()=>t({...e,groups:e.groups.includes(s)?e.groups.filter(e=>e!==s):[...e.groups,s]})},s))}),(0,k.jsx)(r.Muted,{size:12,children:"Only people on shift when it goes, in:"}),(0,k.jsx)(r.Row,{wrap:!0,gap:6,children:Object.keys(u.SHIFT_FILTER_LABEL).map(s=>{const n=(e.onShiftIn??[]).includes(s);return(0,k.jsx)(r.Chip,{testID:`notif-onshift-${s}`,label:u.SHIFT_FILTER_LABEL[s],selected:n,onPress:()=>t({...e,onShiftIn:n?(e.onShiftIn??[]).filter(e=>e!==s):[...e.onShiftIn??[],s]})},s)})}),(0,k.jsx)(a.default,{style:{gap:2},children:s.map(s=>{const n=e.staff.includes(s.id);return(0,k.jsxs)(l.default,{testID:`notif-tick-${s.id}`,accessibilityRole:"checkbox",accessibilityState:{checked:n},onPress:()=>t({...e,staff:n?e.staff.filter(e=>e!==s.id):[...e.staff,s.id]}),style:{flexDirection:'row',alignItems:'center',gap:10,paddingVertical:6},children:[(0,k.jsx)(a.default,{style:{width:22,height:22,borderRadius:5,borderWidth:1.5,borderColor:d.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:n?'#2a2414':'transparent'},children:n?(0,k.jsx)(r.T,{size:14,colour:d.colours.gold,children:"\u2713"}):null}),(0,k.jsx)(r.T,{style:{flex:1},children:(0,h.staffLabel)({name:I(s.name),nickname:s.nickname})}),(0,k.jsx)(r.Muted,{size:12,children:'Head Chef'===s.level?'Head Chef':s.job})]},s.id)})}),(0,k.jsx)(r.Muted,{size:12,children:"If nobody above matches when it goes, send it to:"}),(0,k.jsxs)(r.Row,{wrap:!0,gap:6,children:[S.filter(e=>'on_shift'!==e).map(s=>{const n=e.fallback??{staff:[],groups:[]},o=n.groups.includes(s);return(0,k.jsx)(r.Chip,{testID:`notif-fallback-${s}`,label:u.NOTIF_GROUP_LABEL[s],selected:o,onPress:()=>{const l=o?n.groups.filter(e=>e!==s):[...n.groups,s];t({...e,fallback:l.length||n.staff.length?{...n,groups:l}:void 0})}},s)}),s.map(s=>{const n=e.fallback??{staff:[],groups:[]},o=n.staff.includes(s.id);return(0,k.jsx)(r.Chip,{testID:`notif-fallback-${s.id}`,label:I(s.name),selected:o,onPress:()=>{const l=o?n.staff.filter(e=>e!==s.id):[...n.staff,s.id];t({...e,fallback:l.length||n.groups.length?{...n,staff:l}:void 0})}},s.id)})]})]})}function D({init:e,onSave:s,onCancel:o}){const[l,c]=(0,n.useState)(e),[h,p]=(0,n.useState)(!!e.dayTimes&&Object.keys(e.dayTimes).length>0),f=(0,u.validateNotif)(l),g=e=>c(t=>({...t,...e}));return(0,k.jsxs)(a.default,{testID:"notif-editor",style:{gap:8,borderWidth:1,borderColor:d.colours.accentBorder,borderRadius:12,padding:10},children:[(0,k.jsx)(r.T,{weight:"semibold",children:"Title"}),(0,k.jsx)(t.TextInput,{accessibilityLabel:"Notification title",testID:"notif-title",value:l.title,onChangeText:e=>g({title:e}),maxLength:60,style:T}),(0,k.jsx)(r.T,{weight:"semibold",children:"Message"}),(0,k.jsx)(t.TextInput,{accessibilityLabel:"Notification message",testID:"notif-message",value:l.message,onChangeText:e=>g({message:e}),maxLength:160,style:T}),(0,k.jsx)(r.T,{weight:"semibold",children:"Days"}),(0,k.jsx)(r.Row,{wrap:!0,gap:6,children:v.map(e=>(0,k.jsx)(r.Chip,{testID:`notif-day-${e}`,label:u.NOTIF_DAY_NAMES[e],selected:l.days.includes(e),onPress:()=>g({days:l.days.includes(e)?l.days.filter(t=>t!==e):[...l.days,e]})},e))}),(0,k.jsxs)(r.Row,{gap:8,children:[(0,k.jsx)(r.T,{weight:"semibold",children:"Time (UK)"}),(0,k.jsx)(t.TextInput,{accessibilityLabel:"Time",testID:"notif-time",value:l.time,onChangeText:e=>g({time:e}),placeholder:"21:00",style:{...T,width:90,borderColor:(0,u.validHm)(l.time)?d.colours.hairline:d.colours.red}})]}),(0,k.jsx)(r.Toggle,{label:"A different time on some days",value:h,onChange:e=>{p(e),e||g({dayTimes:void 0})}}),h?(0,k.jsx)(r.Row,{wrap:!0,gap:8,children:v.filter(e=>l.days.includes(e)).map(e=>(0,k.jsxs)(r.Row,{gap:4,children:[(0,k.jsx)(r.T,{size:13,children:u.NOTIF_DAY_NAMES[e]}),(0,k.jsx)(t.TextInput,{accessibilityLabel:`${u.NOTIF_DAY_NAMES[e]} time`,testID:`notif-daytime-${e}`,value:l.dayTimes?.[String(e)]??'',placeholder:l.time,onChangeText:t=>{const s={...l.dayTimes??{}};t.trim()?s[String(e)]=t.trim():delete s[String(e)],g({dayTimes:s})},style:{...T,width:74}})]},e))}):null,(0,k.jsx)(L,{value:l.recipients,onChange:e=>g({recipients:e})}),(0,k.jsx)(r.T,{weight:"semibold",children:"Send by"}),(0,k.jsx)(r.Toggle,{testID:"notif-inapp",label:"In the app (gold slider, Done / Later)",value:l.sendBy.inApp,onChange:e=>g({sendBy:{...l.sendBy,inApp:e}})}),(0,k.jsx)(r.Toggle,{testID:"notif-push",label:"Phone notification (when phones are switched on)",value:l.sendBy.push,onChange:e=>g({sendBy:{...l.sendBy,push:e}})}),f?(0,k.jsx)(r.Muted,{size:13,children:f}):null,(0,k.jsxs)(r.Row,{gap:8,style:{justifyContent:'flex-end'},children:[(0,k.jsx)(r.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:o}),(0,k.jsx)(r.Button,{small:!0,testID:"notif-save",label:"Save",disabled:!!f,onPress:()=>s({...l,title:l.title.trim(),message:l.message.trim(),days:[...l.days].sort()})})]})]})}function R(){const[e,t]=(0,n.useState)(null),[s,o]=(0,n.useState)('');return(0,n.useEffect)(()=>{(0,y.pushState)().then(t)},[]),e&&'unsupported'!==e?(0,k.jsxs)(a.default,{testID:"push-button",style:{gap:4},children:[(0,k.jsx)(r.Button,{small:!0,kind:'on'===e?'ghost':'secondary',testID:"push-turn-on",label:'on'===e?'Phone notifications are on for this phone \xb7 Turn off':'\ud83d\udd14 Turn on phone notifications',onPress:()=>{('on'===e?(0,y.turnOffPush)():(0,y.turnOnPush)()).then(e=>{o(e.message),(0,y.pushState)().then(t)})}}),(0,k.jsx)(r.Muted,{size:12,children:s||('ios-home-screen'===e?'iPhone: add this app to your Home Screen first (iOS 16.4 or later).':'For this phone only. Each person turns it on on their own phone.')})]}):null}const B=e=>p.useOrderLists.getState().resetSettings(e);const P=(e,t)=>g.useClockArea.getState().reset(e,t),O='https://www.foodstandards.gov.scot/publications-and-research/publications/cooksafe-manual'},1004,[877,989,30,239,263,127,813,821,956,958,856,1005,1176,1177,954,1247,820,1080,947,24]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"orderListSeedId",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"orderListSettingsId",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"orderListSeeds",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"useOrderLists",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"orderSettingsOf",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"useListOpen",{enumerable:!0,get:function(){return y}});var e,t=r(d[0]),s=(e=t)&&e.__esModule?e:{default:e},i=r(d[1]),n=r(d[2]),u=r(d[3]),o=r(d[4]),p=r(d[5]),l=r(d[6]);const c=(e,t)=>(0,u.uuidFrom)(`order-list:${t}:${e}`),S=e=>(0,u.uuidFrom)(`order-list-settings:${e}`),f=e=>'anchorage'===e?[{id:c(e,'allsons'),seed:'allsons',name:'Alsons (drinks)',kind:'running'},{id:c(e,'cash-carry'),seed:'cash-carry',name:'Cash and carry',kind:'trip',tripDay:5}]:[],A=()=>(new Date).toISOString(),O=(0,i.create)()((0,n.persist)((e,t)=>({lists:[],items:[],history:[],settings:{},ensure:s=>{const i=t(),n=new Set(i.lists.map(e=>e.id)),u=f(s).filter(e=>!n.has(e.id)).map(e=>({...e,rid:s})),p={},c=i.lists.map(e=>(0,l.fixSupplierNames)(e.name)!==e.name?{...e,name:(0,l.fixSupplierNames)(e.name),updatedAt:A()}:e);c.some((e,t)=>e!==i.lists[t])&&(p.lists=c),u.length&&(p.lists=[...p.lists??i.lists,...u]),i.settings[s]||(p.settings={...i.settings,[s]:{...o.DEFAULT_ORDER_LIST_SETTINGS,id:S(s)}}),Object.keys(p).length&&e(p)},addList:(t,s)=>{const i=(0,p.uuid)();return e(e=>({lists:[...e.lists,{...s,id:i,rid:t,updatedAt:A()}]})),i},updateList:(t,s)=>e(e=>({lists:e.lists.map(e=>e.id===t?{...e,...s,updatedAt:A()}:e)})),addItem:(t,s)=>{const i=(0,p.uuid)(),n=s.addedAt??A();return e(e=>({items:[...e.items,{...s,id:i,rid:t,status:'open',addedAt:n,updatedAt:n}]})),i},bump:(t,s,i)=>e(e=>({items:e.items.map(e=>e.id===t?{...(0,o.bumpQty)(e,s,i.id,i.name,A()),rid:e.rid}:e)})),updateItem:(t,s)=>e(e=>({items:e.items.map(e=>e.id===t?{...e,...s,updatedAt:A()}:e)})),setStatus:(t,s,i)=>e(e=>({items:e.items.map(e=>e.id===t?{...e,status:s,statusBy:'open'===s?void 0:i.name,statusAt:'open'===s?void 0:A(),updatedAt:A()}:e)})),removeItem:t=>e(e=>({items:e.items.map(e=>e.id===t?{...e,removed:!0,updatedAt:A()}:e)})),undoRemove:t=>e(e=>({items:e.items.map(e=>e.id===t?{...e,removed:!1,updatedAt:A()}:e)})),finish:(s,i,n,u)=>{const l=t().lists.find(e=>e.id===i);if(!l)return null;const c=A(),{round:S,drop:f,carriedOver:O}=(0,o.finishOrder)(l,t().items,n,u,c,p.uuid),_=new Set(f),y=new Map(O.map(e=>[e.id,e])),T={...S,rid:s};return e(e=>({items:e.items.filter(e=>!_.has(e.id)).map(e=>y.has(e.id)?{...y.get(e.id),rid:e.rid}:e),history:[T,...e.history].slice(0,300),lists:e.lists.map(e=>e.id===i?{...e,nextTrip:void 0,updatedAt:c}:e)})),T},setSettings:(t,s)=>e(e=>({settings:{...e.settings,[t]:{...o.DEFAULT_ORDER_LIST_SETTINGS,...e.settings[t],...s,id:S(t),updatedAt:A()}}})),resetSettings:t=>e(e=>({settings:{...e.settings,[t]:{...o.DEFAULT_ORDER_LIST_SETTINGS,id:S(t),updatedAt:A()}}}))}),{name:'covercharge-order-lists-v1',version:1,storage:(0,n.createJSONStorage)(()=>s.default)})),_=e=>({...o.DEFAULT_ORDER_LIST_SETTINGS,...O.getState().settings[e]}),y=(0,i.create)()(e=>({request:t=>e({seed:t})}))},1005,[1082,952,1091,1103,1176,1034,1175]); +__d(function(g,_r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"APP_USED_TEXT",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"APP_NOT_SET_UP_TEXT",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"allowedHere",{enumerable:!0,get:function(){return C}}),Object.defineProperty(_e,"movedMessage",{enumerable:!0,get:function(){return N}}),_e.personFromStaff=E,_e.signInWithText=z,_e.SignInWithLink=M,_e.useSignedOutGate=function(){const e=(0,m.useSession)(e=>e.meId);return _.includes(b.APP_VARIANT)&&!A.PITCH&&!e},_e.InviteGate=function(){const[e,R]=(0,f.useState)(m.useSession.persist.hasHydrated()),[E,z]=(0,f.useState)(m.START_INVITE?'checking':'done'),[V,F]=(0,f.useState)(null),[W,D]=(0,f.useState)(0),[K,U]=(0,f.useState)(!1),[G,Y]=(0,f.useState)(null),B=(0,m.useSession)(e=>e.meId),$=(0,m.useSession)(e=>!B||!!e.welcomed[B]);if((0,f.useEffect)(()=>{const e=m.useSession.persist.onFinishHydration(()=>R(!0));return m.useSession.persist.hasHydrated()&&R(!0),e},[]),(0,f.useEffect)(()=>{if(!e||!_.includes(b.APP_VARIANT))return;let n,t=!0;return(async()=>{const e=m.useSession.getState().meId;if(m.START_INVITE&&!(e&&await(0,I.signedInHereAs)(e)&&await(0,I.rememberedInviteHere)(m.START_INVITE))){const e=await H(m.START_INVITE,e=>{t&&F(e)});if(!t)return;if('refused'===e.kind)return F(e.message),void z('done');if('offline'===e.kind)return U(!0),void(n=setTimeout(()=>{t&&D(e=>e+1)},1e4));if(U(!1),'bad'===e.kind)return void z('bad')}const s=O(m.useSession.getState().meId),o=s&&!1!==P.useOwner.getState().staff.find(e=>e.id===s.id)?.active;if(s&&!o)m.useSession.getState().signOut();else if(s&&!C(s)&&!m.START_INVITE&&await(0,I.signedInHereAs)(s.id)){if(await(0,I.forgetSignInHere)(),!t)return;m.useSession.getState().signOut(),Y(N(s.app))}else if(s&&!C(s)){const e=(0,m.appUrl)(s.app,m.START_INVITE);if(e)return void window.location.replace(e)}z('done')})(),()=>{t=!1,n&&clearTimeout(n)}},[e,W]),!_.includes(b.APP_VARIANT))return null;if(n.IS_QUEUED_VENUE&&!B)return(0,x.jsx)(h.default,{style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(t.QueuedVenueWelcome,{app:m.APP_NAME[b.APP_VARIANT]??'Team',message:V?'This link cannot be used here. Ask your authorised manager.':K?'Waiting for a connection.':void 0})});if(n.IS_GREENSIDE&&!B)return(0,x.jsx)(h.default,{style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(s.GreensideStaffHome,{app:m.APP_NAME[b.APP_VARIANT]??'Team',message:V?`This link can\u2019t be used here. ${V}`:K?'Waiting for a connection.':e&&'checking'!==E?'bad'===E?'This link is not recognised. Ask the authorised manager for access after setup.':void 0:'Opening your Greenside app\u2026'})});if(n.IS_ABBOTSFORD&&!B)return(0,x.jsx)(h.default,{style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(l.AbbotsfordStaffHome,{app:m.APP_NAME[b.APP_VARIANT]??'Team',message:V?'This link cannot be used here. Ask your authorised manager.':K?'Waiting for a connection.':void 0})});if(n.IS_KIRKTON&&!B)return(0,x.jsx)(h.default,{style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(u.KirktonStaffHome,{app:m.APP_NAME[b.APP_VARIANT]??'Team',message:V?`This link can\u2019t be used here. ${V}`:K?'Waiting for a connection.':e&&'checking'!==E?'bad'===E?'This link is not recognised. Ask the authorised manager for access after setup.':void 0:'Opening your Kirkton app\u2026'})});if(n.IS_WILDINGS&&!B)return(0,x.jsx)(h.default,{style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(o.WildingsStaffHome,{app:m.APP_NAME[b.APP_VARIANT]??'Team',message:V?`This link can\u2019t be used here. ${V}`:K?'Waiting for a connection. Your personal app signs you in automatically when it returns.':e&&'checking'!==E?'bad'===E?'This link is not recognised. Open the complete private link your manager gave you.':void 0:'Opening your personal Wildings app\u2026'})});if(n.IS_KIRKMICHAEL&&!B)return(0,x.jsx)(h.default,{style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(r.KirkmichaelStaffHome,{app:m.APP_NAME[b.APP_VARIANT]??'Team',message:V?`This link can\u2019t be used here. ${V}`:K?'Waiting for a connection. Your personal app signs you in automatically when it returns.':e&&'checking'!==E?'bad'===E?'This link is not recognised. Open the complete private link your manager gave you.':void 0:'Opening your personal Kirkmichael app\u2026'})});if(n.IS_SOUTERS&&!B)return(0,x.jsx)(h.default,{style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(c.SoutersStaffHome,{app:m.APP_NAME[b.APP_VARIANT]??'Team'})});if(K)return w('Waiting for a connection. Your app will sign you in automatically.','invite-waiting');if(!e||'checking'===E)return(0,x.jsx)(h.default,{style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}]});if((0,S.inPhoneApp)()&&!B&&!A.PITCH)return V&&/already been used/i.test(V)?w(j,'invite-app-used'):V?w(V,'invite-app-refused'):w(v,'invite-app-notsetup');if('bad'===E)return(0,x.jsxs)(h.default,{testID:"invite-bad",style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,x.jsx)(T.T,{size:22,weight:"bold",center:!0,children:"This link isn\u2019t recognised"}),(0,x.jsx)(T.Muted,{center:!0,children:"Part of the link may be missing. Go back to the message from your manager and tap the whole link, rather than copying part of it. If it still doesn't work, ask your manager for your personal CoverCharge link."}),(0,x.jsx)(T.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>z('done')}),(0,x.jsx)(T.Muted,{center:!0,children:"Offline, CoverCharge uses made-up data, and nothing you do there is shared with the team."})]});if(V&&!B)return(0,x.jsxs)(h.default,{testID:"invite-refused",style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,x.jsx)(T.T,{size:22,weight:"bold",center:!0,children:"This link can\u2019t be used here"}),(0,x.jsx)(T.Muted,{center:!0,children:V}),(0,x.jsx)(T.Muted,{center:!0,children:"Each personal link works on one phone only and lasts 30 days before first use, so nobody else can sign in as you."}),(0,x.jsx)(T.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>F(null)})]});if(G&&!B)return(0,x.jsxs)(h.default,{testID:"invite-moved",style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,x.jsx)(T.T,{size:22,weight:"bold",center:!0,children:"This app is signed out"}),(0,x.jsx)(T.Muted,{center:!0,children:G}),(0,x.jsx)(M,{})]});if(!B&&!A.PITCH)return(0,x.jsxs)(h.default,{testID:"invite-signin",style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,x.jsx)(T.T,{size:22,weight:"bold",center:!0,children:V?'This link can\u2019t be used here':'Sign in to CoverCharge'}),V?(0,x.jsx)(T.Muted,{center:!0,children:V}):null,(0,x.jsx)(T.Muted,{center:!0,children:"Open the personal link your manager sent you on this phone. Each link signs in one person on one phone and lasts 30 days before first use. If it has already been used on another phone or browser, ask your manager for a new one."}),(0,x.jsx)(M,{})]});const L=(0,m.rosterPerson)(B);return L&&!$&&C(L)?(0,x.jsx)(y.LaunchWelcome,{p:L,onDone:()=>m.useSession.getState().markWelcomed(L.id)}):null};var n=_r(d[0]),t=_r(d[1]),s=_r(d[2]),o=_r(d[3]),r=_r(d[4]),l=_r(d[5]),u=_r(d[6]),c=_r(d[7]),f=_r(d[8]);_r(d[9]);var p=e(_r(d[10])),h=e(_r(d[11])),b=_r(d[12]),m=_r(d[13]),k=_r(d[14]),y=_r(d[15]),T=_r(d[16]),I=_r(d[17]),A=_r(d[18]),S=_r(d[19]),P=_r(d[20]),x=_r(d[21]);const j='This app copy has already been set up on another phone. Ask your manager for a new link.',v='This app copy isn\u2019t set up for anyone yet. Ask your manager for your link, and download the app from it.',w=(e,n)=>(0,x.jsx)(h.default,{testID:n,style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:(0,x.jsx)(T.T,{size:22,weight:"bold",center:!0,children:e})}),_=['owner','staff','chef'],C=e=>'staff'===b.APP_VARIANT||e.app===b.APP_VARIANT,N=e=>`You now use ${m.APP_NAME[e]??'another CoverCharge app'}. This app is signed out on this phone. Open the new personal link your manager sent you.`;function R(e){m.useSession.getState().signIn(e.id);const n=P.useOwner.getState();P.useOwner.setState({staffAs:e.id,previewRole:'staff'===e.role?n.previewRole:e.role})}function E(e){const n='owner'===e.role?'Owner':'manager'===e.role?'Manager':'Head Chef'===e.level?'Head Chef':'Staff';return{id:e.id,name:e.name,level:n,role:e.role,job:e.job,nickname:e.nickname,dept:e.dept??'',app:'staff'===e.role?'Head Chef'===n?'chef':'staff':'owner',tokenHash:'',hourlyPence:null,salaried:!!e.salaried,noTax:!!e.noTax,avatar:void 0}}const O=e=>{const n=(0,m.rosterPerson)(e);if(n)return n;const t=e?P.useOwner.getState().staff.find(n=>n.id===e):void 0;return t?E(t):void 0};async function H(e,n){const t=await(0,m.personForInvite)(e);if(t)return R(t),C(t)?((0,I.claimInvite)(e).then(e=>{if('refused'===e.status&&m.useSession.getState().meId===t.id&&(m.useSession.getState().signOut(),n(e.message)),'ok'===e.status&&e.id.staffRef&&e.id.staffRef!==m.useSession.getState().meId){const n=O(e.id.staffRef);n&&R(n)}}),{kind:'ok',p:t}):{kind:'ok',p:t};const s=await(0,I.claimInvite)(e);if('refused'===s.status)return{kind:'refused',message:s.message};if('offline'===s.status)return{kind:'offline'};if('ok'!==s.status||!s.id.staffRef)return{kind:'bad'};const o=O(s.id.staffRef)??E({id:s.id.staffRef,name:s.id.displayName||s.id.staffRef,role:'owner'===s.id.role?'owner':'manager'===s.id.role?'manager':'staff',level:'head_chef'===s.id.role?'Head Chef':void 0,job:'',active:!0});return R(o),{kind:'ok',p:o}}async function z(e,n=()=>{}){const t=(0,m.inviteFromText)(e);if(!t)return'bad';const s=await H(t,n);if('refused'===s.kind)return{refused:s.message};if('bad'===s.kind||'offline'===s.kind)return'bad';const o=s.p;if(!C(o)){const e=(0,m.appUrl)(o.app,t);if(e)return window.location.replace(e),'moved'}return'ok'}function M(){const[e,n]=(0,f.useState)(''),[t,s]=(0,f.useState)('');return(0,x.jsxs)(h.default,{style:{gap:6},children:[(0,x.jsx)(T.Field,{label:"Your personal link (paste it here)",value:e,onChangeText:n,placeholder:"Your complete Android or iPhone link",autoCapitalize:"none",autoCorrect:!1}),(0,x.jsx)(T.Button,{label:"Sign in",disabled:!e.trim(),onPress:async()=>{const t=await z(e,s);s('bad'===t?'That link was not recognised. Check you copied all of it, or ask your manager for a new one.':'object'==typeof t?t.refused:''),'ok'===t&&n('')}}),t?(0,x.jsx)(T.T,{size:13,colour:k.colours.red,children:t}):null]})}},1006,[5,1377,1378,1379,1380,1381,1382,854,30,122,46,127,806,859,821,1383,813,820,2,1267,856,24]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Icon=function({name:l,size:x=22,colour:t}){const n={stroke:t,strokeWidth:2,fill:'none',strokeLinecap:'round',strokeLinejoin:'round'};return(0,e.jsxs)(h.default,{width:x,height:x,viewBox:"0 0 24 24",children:['home'===l?(0,e.jsx)(s.Path,{d:"M3 11l9-7 9 7v9a1 1 0 0 1-1 1h-5v-6H9v6H4a1 1 0 0 1-1-1z",...n}):null,'orders'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"5",y:"3",width:"14",height:"18",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M9 8h6M9 12h6M9 16h4",...n})]}):null,'bookings'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4",...n})]}):null,'forecast'===l?(0,e.jsx)(s.Path,{d:"M4 20V10M10 20V4M16 20v-7M22 20H2",...n}):null,'more'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"5",cy:"12",r:"1.6",fill:t}),(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"1.6",fill:t}),(0,e.jsx)(s.Circle,{cx:"19",cy:"12",r:"1.6",fill:t})]}):null,'search'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"11",r:"7",...n}),(0,e.jsx)(s.Path,{d:"M20 20l-4-4",...n})]}):null,'bell'===l?(0,e.jsx)(s.Path,{d:"M6 16V11a6 6 0 0 1 12 0v5l2 2H4zM10 20a2 2 0 0 0 4 0",...n}):null,'chat'===l?(0,e.jsx)(s.Path,{d:"M4 5h16v11H9l-5 4z",...n}):null,'clock'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M12 7v5l3 2",...n})]}):null,'user'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"8",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M4 21a8 8 0 0 1 16 0",...n})]}):null,'walkin'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"13",cy:"4.5",r:"1.8",...n}),(0,e.jsx)(s.Path,{d:"M10 21l2-6 3 3v3M9 12l2-4 4 1 2 3M11 8l-1 5",...n})]}):null,'calendarPlus'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4M12 13v5M9.5 15.5h5",...n})]}):null,'pause'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M10 9v6M14 9v6",...n})]}):null,'rain'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M7 15a4 4 0 0 1-.6-7.95A5.5 5.5 0 0 1 17 7.5a3.75 3.75 0 0 1 .5 7.5z",...n}),(0,e.jsx)(s.Path,{d:"M9 18l-1 2.5M13 18l-1 2.5M17 18l-1 2.5",...n})]}):null,'sun'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M12 2v2M12 20v2M2 12h2M20 12h2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4",...n})]}):null,'payroll'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"4",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M7 9h6M7 13h4M15 12.5a2 2 0 1 0 0 .01M7 17h10",...n})]}):null,'tips'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M14.5 9a2.5 2.5 0 0 0-5 0c0 2.5 0 4-1.5 6h7M9 12.5h4",...n})]}):null,'sparkle'===l?(0,e.jsx)(s.Path,{d:"M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8zM19 16l.7 1.8 1.8.7-1.8.7L19 21l-.7-1.8-1.8-.7 1.8-.7z",...n}):null,'platter'===l?(0,e.jsx)(e.Fragment,{children:(0,e.jsx)(s.Path,{d:"M3 15h18M5 15a7 7 0 0 1 14 0M12 6v2M2 18h20",...n})}):null,'check'===l?(0,e.jsx)(s.Path,{d:"M5 12.5l4.5 4.5L19 7.5",...n}):null,'alert'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M12 3l9.5 17h-19z",...n}),(0,e.jsx)(s.Path,{d:"M12 10v4M12 17.2v.1",...n})]}):null,'access'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"4.5",r:"1.8",...n}),(0,e.jsx)(s.Path,{d:"M11 7.5v6h5l2.5 5M11 10h5M8 11.5a5.5 5.5 0 1 0 7.5 6.5",...n})]}):null,'dog'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 10l1-5 3 3h4l3-3 1 5v4a5 5 0 0 1-5 5h-2a5 5 0 0 1-5-5z",...n}),(0,e.jsx)(s.Path,{d:"M10 13v.1M14 13v.1M11 16h2",...n})]}):null,'leaf'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 19c0-8 5-14 15-14 0 10-6 15-14 15",...n}),(0,e.jsx)(s.Path,{d:"M5 19l8-8",...n})]}):null,'table'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"4",y:"8",width:"16",height:"8",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M8 16v4M16 16v4M8 4v4M16 4v4",...n})]}):null,'bag'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 8h14l-1 12H6z",...n}),(0,e.jsx)(s.Path,{d:"M9 10V7a3 3 0 0 1 6 0v3",...n})]}):null,'phone'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"7",y:"2.5",width:"10",height:"19",rx:"2.5",...n}),(0,e.jsx)(s.Path,{d:"M11 18.5h2",...n})]}):null,'swap'===l?(0,e.jsx)(s.Path,{d:"M7 4L3 8l4 4M3 8h14M17 20l4-4-4-4M21 16H7",...n}):null,'box'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M3.5 8L12 4l8.5 4v8L12 20l-8.5-4z",...n}),(0,e.jsx)(s.Path,{d:"M3.5 8L12 12l8.5-4M12 12v8",...n})]}):null,'star'===l?(0,e.jsx)(s.Path,{d:"M12 3.5l2.6 5.4 5.9.8-4.3 4.1 1 5.8L12 16.8l-5.2 2.8 1-5.8L3.5 9.7l5.9-.8z",...n}):null,'userPlus'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"10",cy:"8",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M3 21a7 7 0 0 1 14 0M19 8v6M16 11h6",...n})]}):null,'gift'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3.5",y:"8.5",width:"17",height:"4",rx:"1",...n}),(0,e.jsx)(s.Path,{d:"M5 12.5V20h14v-7.5M12 8.5V20M12 8.5C10 8.5 7.5 7.8 7.5 5.8S10.5 4 12 8.5c1.5-4.5 4.5-4.7 4.5-2.7S14 8.5 12 8.5z",...n})]}):null,'tag'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M3.5 12.5V4h8.5l8.5 8.5-8.5 8.5z",...n}),(0,e.jsx)(s.Circle,{cx:"8",cy:"8.5",r:"1.4",...n})]}):null,'hanger'===l?(0,e.jsx)(s.Path,{d:"M12 7.5a2 2 0 1 1 2-2M12 7.5v2L3 16.5h18L12 9.5",...n}):null]})},r(d[0]);var l,s=r(d[1]),h=(l=s)&&l.__esModule?l:{default:l},e=r(d[2])},1007,[30,948,24]); +__d(function(g,_r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.usePay=j,_e.periodPay=T,_e.MyHoursPay=C,_e.Payroll=function(){const{role:e}=(0,y.useCtx)(6e4),r='owner'===e,c=!!(0,y.useSignedIn)(),p=c&&('owner'===e||'manager'===e),j=(0,a.useOwner)(e=>e.staff),k=(0,i.useMemo)(()=>j.filter(e=>e.active),[j]),D=(0,y.useHourly)(),R=(0,a.useOwner)(e=>e.attendance),z=(0,a.useOwner)(e=>e.troncHistory),{now:M,rid:N}=(0,y.useCtx)(6e4),v=(0,b.useVenuePay)(N).pay,[B,O]=(0,i.useState)(-1),[L,$]=(0,i.useState)(null),[S,H]=(0,i.useState)(''),[I,W]=(0,i.useState)(null),E=(0,i.useMemo)(()=>k.map(e=>({...T(e.id,B,M,R,D[e.id]??0,v,z),person:e})),[k,B,R,D,v,z]),_=E.reduce((e,s)=>({paid:e.paid+s.paid,gross:e.gross+s.gross,tips:e.tips+s.tips,total:e.total+s.total}),{paid:0,gross:0,tips:0,total:0}),V=E[0]?.label??'',F=k.find(e=>e.id===L),G=Math.round(100*Number(S));return(0,f.jsxs)(n.default,{style:{gap:10},children:[(0,f.jsx)(l.Muted,{children:"Periods follow your venue's pay dates (Settings \u203a Pay & tips). For hours to copy into a spreadsheet, use Payroll hours."}),(0,f.jsxs)(l.Muted,{children:["Pay period (venue setting",r?'':', owner only',"). Used for staff pay, the tip splitter and payroll."]}),(0,f.jsx)(P,{label:V,offset:B,setOffset:O,badge:0===B?'Current period':void 0}),(0,f.jsx)(t.WideTable,{children:(0,f.jsxs)(n.default,{children:[(0,f.jsx)(t.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:h.colours.border,paddingBottom:4},children:['Staff','Rate/h','Paid hrs','Gross','Tips','Total'].map((e,s)=>(0,f.jsx)(l.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{width:[120,96,64,72,64,76][s]},children:e},e))}),E.map(e=>(0,f.jsxs)(t.TRow,{heads:['Staff','Rate/h','Paid hrs','Gross','Tips','Total'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,f.jsxs)(o.default,{accessibilityRole:"button",accessibilityLabel:`Pay for ${e.person.name}`,onPress:()=>W(e.person.id),style:{width:120,minHeight:44,justifyContent:'center'},children:[(0,f.jsx)(l.T,{size:13,colour:h.colours.gold,numberOfLines:1,children:x(e.person.name)}),c&&e.person.noTax?(0,f.jsx)(l.T,{size:10,colour:h.colours.amber,children:"No tax deducted"}):null]}),(0,f.jsx)(o.default,{accessibilityRole:"button",accessibilityLabel:`Edit rate for ${e.person.name}`,disabled:!p,onPress:()=>{$(e.person.id),H(null==D[e.person.id]?'':(D[e.person.id]/100).toFixed(2))},style:{width:96,minHeight:44,justifyContent:'center'},children:(0,f.jsxs)(l.T,{size:13,colour:null==D[e.person.id]?h.colours.muted:'owner'!==e.person.role&&D[e.person.id]$(null),title:`Hourly rate: ${x(F?.name)}`,children:[(0,f.jsx)(l.Muted,{children:F?`${F.level??a.ROLE_LABEL[F.role]} \xb7 ${F.job}${F.noTax?' \xb7 No tax deducted':''} \xb7 now: ${(0,a.wageLabel)(F,D[F.id],u.gbp)}`:''}),(0,f.jsx)(s.TextInput,{accessibilityLabel:"Hourly rate \xa3",keyboardType:"decimal-pad",value:S,onChangeText:H,style:l.styles.input}),Number.isFinite(G)&&G>0&&G{a.useOwner.getState().setRate(L,G),$(null)}}),L&&null!=D[L]?(0,f.jsx)(l.Button,{kind:"secondary",label:"Clear (Not set)",onPress:()=>{a.useOwner.getState().clearRate(L),$(null)}}):null]}),(0,f.jsx)(l.Sheet,{visible:!!I,onClose:()=>W(null),title:`What ${x(k.find(e=>e.id===I)?.name)} sees`,children:I?(0,f.jsx)(C,{staffId:I}):null})]})};var s=_r(d[0]),t=_r(d[1]),i=_r(d[2]),o=e(_r(d[3])),n=e(_r(d[4])),r=e(_r(d[5])),l=_r(d[6]),a=_r(d[7]),u=_r(d[8]),c=_r(d[9]),h=_r(d[10]),p=_r(d[11]),y=_r(d[12]),b=_r(d[13]),f=_r(d[14]);const x=e=>(e??'').replace(' (example)',''),w='Before tax and deductions, estimate';function j(e,s){const{now:t,rid:o}=(0,y.useCtx)(6e4),n=(0,a.useOwner)(e=>e.attendance),r=(0,y.useHourly)()[e]??0,l=(0,b.useVenuePay)(o).pay,u=(0,a.useOwner)(e=>e.troncHistory);return(0,i.useMemo)(()=>T(e,s,t,n,r,l,u),[e,s,n,r,l,u,Math.floor(t.getTime()/6e4)])}function T(e,s,t,i,o,n,r){const{s:l,e:u,key:h}=(0,b.venueRange)(n,'wage',s,t),p=(0,c.ymd)(l),f=(0,c.ymd)(u),x=i.filter(s=>s.staffId===e&&s.date>=p&&s.date<=f&&s.in).sort((e,s)=>e.date.localeCompare(s.date)).map(e=>{const s=(0,y.paidMins)(e,t);return{a:e,...s,gross:Math.round(s.paid/60*o),open:!e.out,confirmed:(0,a.isConfirmed)(e)}}),w=x.filter(e=>e.confirmed),j=w.reduce((e,s)=>e+s.paid,0),T=w.reduce((e,s)=>e+s.gross,0),P=x.filter(e=>!e.open&&!e.confirmed).reduce((e,s)=>e+s.paid,0),C=r.filter(e=>e.end>=p&&e.end<=f).map(s=>({label:s.label,amount:s.rows.find(s=>s.staffId===e)?.amount??0})).filter(e=>e.amount>0),k=C.reduce((e,s)=>e+s.amount,0);return{s:l,e:u,key:h,label:`${(0,c.niceDate)(l)} \u2013 ${(0,c.niceDate)(u)} ${u.getFullYear()}`,shifts:x,paid:j,pending:P,gross:T,tips:k,tipItems:C,total:T+k,rate:o}}function P({label:e,offset:s,setOffset:t,badge:i}){return(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",disabled:s<=-12,onPress:()=>t(s-1)}),(0,f.jsxs)(n.default,{style:{alignItems:'center',flex:1},children:[(0,f.jsx)(l.T,{weight:"semibold",children:e}),i?(0,f.jsx)(l.Badge,{kind:0===s?'amber':'neutral',label:i}):null]}),(0,f.jsx)(l.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:s>=0,onPress:()=>t(s+1)})]})}function C({staffId:e}){const{meId:s,now:C,rid:k}=(0,y.useCtx)(6e4),D=e??s,R=(0,b.useVenuePay)(k).pay,z=(0,a.useOwner)(e=>e.staff).find(e=>e.id===D),M=(0,a.useOwner)(e=>e.attendance),N=(0,a.useOwner)(e=>e.troncHistory),v=(0,y.useHourly)(),B=v[D]??0,O=null!=v[D],[L,$]=(0,i.useState)(0),S=j(D,L),H=(0,r.default)().width<520,I=(0,i.useMemo)(()=>[-1,-2,-3,-4,-5,-6].map(e=>({o:e,...T(D,e,C,M,B,R,N)})),[D,M,B,R,N]);return(0,f.jsxs)(n.default,{style:{gap:10},children:[(0,f.jsx)(l.Banner,{kind:"info",title:w,children:"Gross pay from your clocked hours at your hourly rate, plus tips shared to you. Tax, National Insurance and pension come off in payroll."}),(0,f.jsxs)(l.Muted,{children:[x(z?.name)," \xb7 ",z?.job," \xb7 ",O?`${(0,u.gbp)(B)}/hour`:'Hourly rate not set yet'," \xb7 Paid on the ",R.wagePayDay,[1,21,31].includes(R.wagePayDay)?'st':[2,22].includes(R.wagePayDay)?'nd':[3,23].includes(R.wagePayDay)?'rd':'th',", cut-off the ",R.wageCutoffDay,[1,21].includes(R.wageCutoffDay)?'st':[2,22].includes(R.wageCutoffDay)?'nd':[3,23].includes(R.wageCutoffDay)?'rd':'th',e?'':' (set by your manager)']}),(0,f.jsx)(P,{label:S.label,offset:L,setOffset:$,badge:0===L?'Current period':void 0}),(0,f.jsxs)(l.Card,{children:[(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{children:"Confirmed paid hours"}),(0,f.jsx)(l.T,{weight:"semibold",children:(0,y.hmDur)(S.paid)})]}),S.pending?(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{colour:h.colours.amber,children:"Pending sign-off"}),(0,f.jsx)(l.T,{colour:h.colours.amber,children:(0,y.hmDur)(S.pending)})]}):null,(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{children:"Gross pay from hours"}),(0,f.jsx)(l.T,{weight:"semibold",children:(0,u.gbp)(S.gross)})]}),(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{children:"Tips allocated"}),(0,f.jsx)(l.T,{weight:"semibold",children:(0,u.gbp)(S.tips)})]}),S.tipItems.map(e=>(0,f.jsxs)(l.Muted,{children:[" Tips for ",e.label,": ",(0,u.gbp)(e.amount)]},e.label)),(0,f.jsx)(n.default,{style:{height:1,backgroundColor:h.colours.border}}),(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{weight:"bold",children:"Total gross"}),(0,f.jsx)(l.T,{size:20,weight:"bold",colour:h.colours.gold,children:(0,u.gbp)(S.total)})]}),(0,f.jsxs)(l.Muted,{children:[w,". Tips are shown separately and only once a tip period is approved."]})]}),(0,f.jsx)(p.SectionHead,{title:"Shifts",sub:"Paid hours = clock out \u2212 clock in \u2212 break"}),H?(0,f.jsxs)(n.default,{testID:"pay-shifts-list",children:[S.shifts.map(e=>(0,f.jsxs)(n.default,{style:{paddingVertical:8,borderBottomWidth:1,borderColor:'#222',gap:2},children:[(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{size:14,weight:"semibold",children:(0,c.niceDate)(new Date(e.a.date+'T12:00:00'))}),(0,f.jsx)(l.T,{size:14,weight:"semibold",colour:e.open||e.confirmed?void 0:h.colours.amber,children:e.open?'On now':e.confirmed?(0,u.gbp)(e.gross):'Pending'})]}),(0,f.jsxs)(l.Muted,{children:[(0,c.hm)(new Date(e.a.in)),"\u2013",e.a.out?(0,c.hm)(new Date(e.a.out)):'now',e.open?'':` \xb7 ${e.brk}m break \xb7 ${(0,y.hmDur)(e.paid)} paid`]})]},e.a.id)),S.shifts.length?null:(0,f.jsx)(l.Muted,{style:{paddingVertical:8},children:"No clocked shifts in this period."}),S.shifts.length?(0,f.jsxs)(l.Muted,{children:["At ",(0,u.gbp)(S.rate),"/hour."]}):null]}):(0,f.jsx)(t.WideTable,{children:(0,f.jsxs)(n.default,{children:[(0,f.jsx)(t.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:h.colours.border,paddingBottom:4},children:['Date','In','Out','Break','Paid','Rate','Gross'].map((e,s)=>(0,f.jsx)(l.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{width:[86,50,50,50,62,56,64][s]},children:e},e))}),S.shifts.map(e=>(0,f.jsxs)(t.TRow,{heads:['Date','In','Out','Break','Paid','Rate','Gross'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,f.jsx)(l.T,{size:13,style:{width:86},children:(0,c.niceDate)(new Date(e.a.date+'T12:00:00'))}),(0,f.jsx)(l.T,{size:13,style:{width:50},children:(0,c.hm)(new Date(e.a.in))}),(0,f.jsx)(l.T,{size:13,style:{width:50},children:e.a.out?(0,c.hm)(new Date(e.a.out)):'on now'}),(0,f.jsx)(l.T,{size:13,style:{width:50},children:e.open?'\u2013':`${e.brk}m`}),(0,f.jsx)(l.T,{size:13,style:{width:62},children:e.open?'\u2013':(0,y.hmDur)(e.paid)}),(0,f.jsx)(l.T,{size:13,style:{width:56},children:(0,u.gbp)(S.rate)}),(0,f.jsx)(l.T,{size:13,weight:"semibold",style:{width:64},colour:e.open||e.confirmed?void 0:h.colours.amber,children:e.open?'\u2013':e.confirmed?(0,u.gbp)(e.gross):'Pending'})]},e.a.id)),S.shifts.length?null:(0,f.jsx)(l.Muted,{style:{paddingVertical:8},children:"No clocked shifts in this period."})]})}),S.shifts.some(e=>e.open)?(0,f.jsx)(l.Muted,{children:"The shift you\u2019re on now is added once you clock out."}):null,S.pending?(0,f.jsx)(l.Muted,{children:"Hours marked Pending count once a manager signs them off."}):null,(0,f.jsx)(p.SectionHead,{title:"History"}),I.map(e=>(0,f.jsx)(o.default,{accessibilityRole:"button",accessibilityLabel:`Pay period ${e.label}`,onPress:()=>$(e.o),children:(0,f.jsxs)(l.Card,{children:[(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{weight:"semibold",children:e.label}),(0,f.jsx)(l.T,{weight:"bold",children:(0,u.gbp)(e.total)})]}),(0,f.jsxs)(l.Muted,{children:[(0,y.hmDur)(e.paid)," paid \xb7 ",(0,u.gbp)(e.gross)," from hours",e.tips?` + ${(0,u.gbp)(e.tips)} tips`:''," \xb7 ",w.toLowerCase()]})]})},e.o))]})}},1008,[877,1317,30,263,127,287,813,856,816,818,821,1019,927,1250,24]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"payFor",{enumerable:!0,get:function(){return b.payFor}}),Object.defineProperty(_e,"useVenuePay",{enumerable:!0,get:function(){return b.useVenuePay}}),_e.PayTipsSettings=function({go:e}){const{rid:s,today:t}=(0,x.useCtx)(6e4),{pay:n,source:r}=(0,b.useVenuePay)(s),[l,c]=(0,o.useState)(n),[p,y]=(0,o.useState)((0,u.ukDate)(n.tipsAnchorPayday)),[C,S]=(0,o.useState)(null),D=(0,u.parseUk)(p),M=(0,u.cleanPay)({...l,tipsAnchorPayday:D??l.tipsAnchorPayday}),B=JSON.stringify(M)!==JSON.stringify(n)||'settings'!==r,R=(0,u.nextToPay)(M,'tips',t).period,z=(0,u.nextToPay)(M,'wage',t).period,v=(0,u.tipsPeriod)(M,R.start,1),$=(0,u.wagePeriod)(M,z.start,1),O=e=>{c({...l,...e}),S(null)};return(0,j.jsxs)(d.default,{style:{gap:12},testID:"pay-settings",children:['none'===r?(0,j.jsx)(i.Banner,{kind:"warn",title:"Pay dates not set up yet",children:"Set your tips and wage dates here. Until then the app uses calendar months and weekly tips."}):null,'questionnaire'===r?(0,j.jsx)(i.Banner,{kind:"info",title:"From your sign-up answers",children:"These dates came from your questionnaire. Check them and tap Save to make them your venue's pay dates."}):null,(0,j.jsx)(f.SectionHead,{title:"Tips (tronc)",sub:"How often tips are paid out, and which days each payout covers."}),(0,j.jsxs)(i.Card,{children:[(0,j.jsx)(i.T,{weight:"semibold",children:"How often"}),(0,j.jsx)(i.Row,{wrap:!0,gap:6,children:['weekly','fortnightly','monthly'].map(e=>(0,j.jsx)(i.Chip,{label:w[e],selected:l.tipsFrequency===e,onPress:()=>O({tipsFrequency:e})},e))}),(0,j.jsx)(i.Field,{label:"A tips payday (DD/MM/YYYY). Every other one is worked out from it",value:p,onChangeText:e=>{y(e),S(null)},placeholder:"02/11/2026",keyboardType:"numbers-and-punctuation"}),D?(0,j.jsxs)(i.Muted,{children:[(0,u.dayMonth)(D)," ",D.slice(0,4)]}):(0,j.jsx)(i.T,{size:13,colour:h.colours.red,children:"Enter a date like 02/11/2026"}),(0,j.jsx)(i.T,{weight:"semibold",children:"Each tips period ends"}),(0,j.jsxs)(i.Row,{children:[(0,j.jsx)(i.Stepper,{label:"days before payday",value:l.tipsEndsDaysBefore,min:0,max:13,onChange:e=>O({tipsEndsDaysBefore:e})}),(0,j.jsx)(i.Muted,{style:{flex:1},children:0===l.tipsEndsDaysBefore?'on payday':1===l.tipsEndsDaysBefore?'day before payday (a Monday payday covers up to the Sunday)':'days before payday'})]})]}),(0,j.jsx)(f.SectionHead,{title:"Wages",sub:"Monthly pay: the cut-off starts each pay period."}),(0,j.jsxs)(i.Card,{children:[(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(i.T,{weight:"semibold",style:{flex:1},children:"Pay day of the month"}),(0,j.jsx)(i.Stepper,{label:"pay day",value:l.wagePayDay,min:1,max:31,onChange:e=>O({wagePayDay:e})})]}),(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(i.T,{weight:"semibold",style:{flex:1},children:"Cut-off (first day of each period)"}),(0,j.jsx)(i.Stepper,{label:"cut-off day",value:l.wageCutoffDay,min:1,max:28,onChange:e=>O({wageCutoffDay:e})})]}),(0,j.jsxs)(i.Muted,{children:["Period runs the ",P(l.wageCutoffDay)," to the ",P(1===l.wageCutoffDay?31:l.wageCutoffDay-1),1===l.wageCutoffDay?' (end of the month)':' of the next month',". A pay day past the month end uses the last day."]}),(0,j.jsx)(i.T,{weight:"semibold",children:"A pay day on a weekend"}),(0,j.jsx)(i.Row,{wrap:!0,gap:6,children:['none','before','after'].map(e=>(0,j.jsx)(i.Chip,{label:T[e],selected:(l.weekendRule??'none')===e,onPress:()=>O({weekendRule:e})},e))})]}),(0,j.jsx)(f.SectionHead,{title:"Preview"}),(0,j.jsxs)(i.Card,{highlight:h.colours.gold,children:[(0,j.jsx)(k,{label:"Next tips payday",day:R.payday,period:R}),(0,j.jsx)(k,{label:"Then",day:v.payday,period:v}),(0,j.jsx)(d.default,{style:{height:1,backgroundColor:h.colours.border}}),(0,j.jsx)(k,{label:"Next payday",day:z.payday,period:z}),(0,j.jsx)(k,{label:"Then",day:$.payday,period:$})]}),(0,j.jsx)(i.Button,{kind:"success",label:'settings'===r?'Save pay dates':'Save as our pay dates',disabled:!D||!B,testID:"save-pay",onPress:()=>{a.useStore.getState().updateSettings(s,{pay:M}),S('Saved. Everyone in the venue sees these dates.')}}),C?(0,j.jsx)(i.Banner,{kind:"success",title:C}):null,(0,j.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Payroll hours",onPress:()=>e('more','hours')}),(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Tips day",onPress:()=>e('more','tipsday')})]})]})},_e.hoursIn=S,Object.defineProperty(_e,"toTsv",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"toCsv",{enumerable:!0,get:function(){return $}}),_e.summaryTable=O,_e.detailTable=H,_e.copyText=I,_e.periodOptions=W,_e.PayrollHours=function({go:e}){const{rid:s,today:n,now:a,r:y}=(0,x.useCtx)(6e4),{pay:f,source:w}=(0,b.useVenuePay)(s),T=(0,l.useOwner)(e=>e.staff),P=(0,l.useOwner)(e=>e.attendance),k=(0,x.useHourly)(),C=(0,o.useMemo)(()=>W(f,n),[f,n]),[B,R]=(0,o.useState)('wage'),[z,F]=(0,o.useState)(null),[V,A]=(0,o.useState)(!1),[E,Y]=(0,o.useState)({}),[G,U]=(0,o.useState)(null),_='custom'===B&&z?z:(C.find(e=>e.id===B)??C[0]).period,q=(0,o.useMemo)(()=>S(_,T,P,a,k),[_.key,T,P,k,Math.floor(a.getTime()/6e4)]),J=q.some(e=>null!=e.rate),K='tips'===_.kind,Q=q.reduce((e,s)=>({c:e.c+s.confirmed,p:e.p+s.pending,s:e.s+s.shifts,g:e.g+(s.gross??0)}),{c:0,p:0,s:0,g:0}),X=q.filter(e=>e.pending>0).length,Z=`${y.name}: hours ${(0,u.rangeText)(_.start,_.end)}`,ee=`hours-${_.start}-to-${_.end}`,se=e=>{U(e),setTimeout(()=>U(null),6e3)};return(0,j.jsxs)(d.default,{style:{gap:10},testID:"payroll-hours",children:['none'===w?(0,j.jsxs)(i.Banner,{kind:"warn",title:"Pay dates not set up",children:[(0,j.jsx)(i.Muted,{children:"Using calendar months for now."}),(0,j.jsx)(i.Button,{small:!0,kind:"ghost",label:"Set your pay dates \u203a",onPress:()=>e('more','paysettings')})]}):null,(0,j.jsxs)(i.Row,{wrap:!0,gap:6,children:[C.map(e=>(0,j.jsx)(i.Chip,{label:e.label,sub:e.sub,selected:B===e.id,onPress:()=>{R(e.id),A(!1)}},e.id)),(0,j.jsx)(i.Chip,{label:"Custom dates",sub:z&&'custom'===B?(0,u.rangeText)(z.start,z.end):'Pick any range',selected:'custom'===B,onPress:()=>A(!V)})]}),V?(0,j.jsx)(N,{onSet:e=>{F(e),R('custom'),A(!1)}}):null,(0,j.jsx)(i.Card,{highlight:h.colours.gold,children:(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,j.jsxs)(d.default,{style:{flexShrink:1,minWidth:0},children:[(0,j.jsxs)(i.T,{weight:"bold",size:18,children:[(0,u.rangeText)(_.start,_.end)," ",_.end.slice(0,4)]}),(0,j.jsxs)(i.Muted,{children:[(0,u.ukDate)(_.start)," to ",(0,u.ukDate)(_.end),_.payday?` \xb7 ${_.payday>=n?'pays':'paid'} ${(0,u.dayMonth)(_.payday)}`:'',K?' \xb7 tips period':'wage'===_.kind?' \xb7 wage period':'']})]}),(0,j.jsxs)(d.default,{style:{alignItems:'flex-end'},children:[(0,j.jsxs)(i.T,{size:22,weight:"bold",colour:h.colours.gold,children:[(0,u.decH)(Q.c)," h"]}),(0,j.jsxs)(i.Muted,{children:["confirmed (",(0,u.hMm)(Q.c),")"]})]})]})}),X?(0,j.jsx)(r.default,{accessibilityRole:"button",accessibilityLabel:"Sign off pending hours",onPress:()=>e('more','signoff'),testID:"pending-banner",children:(0,j.jsxs)(d.default,{style:{backgroundColor:h.colours.amberBg,borderRadius:12,padding:12,borderLeftWidth:6,borderLeftColor:h.colours.amber,gap:4},children:[(0,j.jsxs)(i.T,{weight:"bold",colour:h.colours.amber,children:["\u26a0 ",(0,u.decH)(Q.p)," h still waiting for sign-off (",X," ",1===X?'person':'people',")"]}),(0,j.jsx)(i.T,{size:14,children:"Pending hours are not in the totals or the exports' confirmed columns. Sign them off first so everyone is paid in full."}),(0,j.jsx)(i.T,{weight:"semibold",colour:h.colours.gold,children:"Sign off hours \u203a"})]})}):(0,j.jsx)(i.Banner,{kind:"success",title:"All hours in this period are signed off"}),(0,j.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(i.Button,{small:!0,kind:"success",label:"Copy for spreadsheet",testID:"copy-tsv",onPress:async()=>{const e=await I(v(O(q,_,J,K)));se(e?`Copied ${q.length} rows. Paste into the first cell of your spreadsheet.`:'Copy is not available here. Use Download CSV.')}}),(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Download CSV",onPress:()=>{(0,p.downloadText)(`${ee}.csv`,$(O(q,_,J,K))),se('CSV downloaded (summary).')}}),(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Download CSV (daily detail)",onPress:()=>{(0,p.downloadText)(`${ee}-daily.csv`,$(H(q))),se('CSV downloaded (one line per shift).')}}),(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Print / PDF",onPress:()=>{const e=O(q,_,J,K);(0,p.printTable)(Z,`${(0,u.ukDate)(_.start)} to ${(0,u.ukDate)(_.end)} \xb7 confirmed hours only in the totals \xb7 printed ${(0,u.ukDate)(n)}`,e[0],e.slice(1))}})]}),G?(0,j.jsx)(i.Banner,{kind:"success",title:G}):null,(0,j.jsx)(t.WideTable,{children:(0,j.jsxs)(d.default,{testID:"hours-table",children:[(0,j.jsx)(t.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:h.colours.border,paddingBottom:4},children:['Name','Shifts','Confirmed','Pending',K?'Tips h':'h:mm',J?'Rate':'',J?'Gross':''].map((e,s)=>(0,j.jsx)(i.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{width:L[s]},children:e},s))}),q.map(e=>{const s=!!E[e.person.id];return(0,j.jsxs)(d.default,{style:{borderBottomWidth:1,borderColor:'#222'},children:[(0,j.jsx)(r.default,{accessibilityRole:"button",accessibilityLabel:`${M(e.person)} daily hours`,onPress:()=>Y({...E,[e.person.id]:!s}),style:{paddingVertical:7},children:(0,j.jsxs)(t.TRow,{heads:['Name','Shifts','Confirmed','Pending',K?'Tips h':'h:mm',J?'Rate':'',J?'Gross':''],children:[(0,j.jsxs)(d.default,{style:{width:L[0]},children:[(0,j.jsxs)(i.T,{size:14,weight:"semibold",numberOfLines:1,children:[s?'\u25be':'\u25b8'," ",M(e.person)]}),(0,j.jsx)(i.Muted,{numberOfLines:1,children:D(e.person)})]}),(0,j.jsx)(i.T,{size:14,style:{width:L[1]},children:e.shifts}),(0,j.jsx)(i.T,{size:14,weight:"semibold",style:{width:L[2]},children:(0,u.decH)(e.confirmed)}),(0,j.jsx)(i.T,{size:14,weight:e.pending?'bold':'regular',colour:e.pending?h.colours.amber:h.colours.muted,style:{width:L[3]},children:e.pending?`\u26a0 ${(0,u.decH)(e.pending)}`:'0.00'}),(0,j.jsx)(i.T,{size:14,style:{width:L[4]},children:K?(0,u.decH)(e.confirmed):(0,u.hMm)(e.confirmed)}),(0,j.jsx)(i.T,{size:14,colour:h.colours.muted,style:{width:L[5]},children:J?null!=e.rate?(0,c.gbp)(e.rate):'\u2013':''}),(0,j.jsx)(i.T,{size:14,weight:"semibold",style:{width:L[6]},children:J?null!=e.gross?(0,c.gbp)(e.gross):'\u2013':''})]})}),s?(0,j.jsxs)(d.default,{style:{backgroundColor:h.colours.surface2,borderRadius:8,padding:8,marginBottom:8,gap:2},testID:`daily-${e.person.id}`,children:[(0,j.jsx)(t.TRow,{head:!0,children:['Date','In','Out','Break','Paid','Status'].map((e,s)=>(0,j.jsx)(i.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{width:[96,52,52,52,56,90][s]},children:e},e))}),e.days.map(e=>(0,j.jsxs)(t.TRow,{heads:['Date','In','Out','Break','Paid','Status'],children:[(0,j.jsx)(i.T,{size:13,style:{width:96},children:(0,u.dayMonth)(e.date)}),(0,j.jsx)(i.T,{size:13,style:{width:52},children:e.inT}),(0,j.jsx)(i.T,{size:13,style:{width:52},children:e.outT||'\u2013'}),(0,j.jsx)(i.T,{size:13,style:{width:52},children:'On now'===e.status?'\u2013':`${e.brk}m`}),(0,j.jsx)(i.T,{size:13,style:{width:56},children:'On now'===e.status?'\u2013':(0,u.hMm)(e.paid)}),(0,j.jsx)(i.T,{size:13,weight:"semibold",style:{width:90},colour:'Confirmed'===e.status?h.colours.ok:'Pending'===e.status?h.colours.amber:h.colours.blue,children:e.status})]},e.a.id)),e.days.length?null:(0,j.jsx)(i.Muted,{children:"No clocked shifts in this period."})]}):null]},e.person.id)}),(0,j.jsxs)(t.TRow,{heads:['','Shifts','Confirmed','Pending',K?'Tips h':'h:mm','',J?'Gross':''],style:{paddingVertical:8,borderTopWidth:2,borderColor:h.colours.gold},children:[(0,j.jsxs)(i.T,{size:14,weight:"bold",style:{width:L[0]},children:["Total (",q.length,")"]}),(0,j.jsx)(i.T,{size:14,weight:"bold",style:{width:L[1]},children:Q.s}),(0,j.jsx)(i.T,{size:14,weight:"bold",colour:h.colours.gold,style:{width:L[2]},children:(0,u.decH)(Q.c)}),(0,j.jsx)(i.T,{size:14,weight:"bold",colour:Q.p?h.colours.amber:h.colours.muted,style:{width:L[3]},children:(0,u.decH)(Q.p)}),(0,j.jsx)(i.T,{size:14,weight:"bold",style:{width:L[4]},children:K?(0,u.decH)(Q.c):(0,u.hMm)(Q.c)}),(0,j.jsx)(i.T,{size:14,style:{width:L[5]},children:" "}),(0,j.jsx)(i.T,{size:14,weight:"bold",style:{width:L[6]},children:J?(0,c.gbp)(Q.g):''})]})]})}),(0,j.jsxs)(i.Muted,{children:["Tap a name for each day. Hours are decimal (37.50 = 37 hours 30 minutes); h:mm is also in the export. Paid hours = clock out \u2212 clock in \u2212 break. ",J?'Gross is before tax, from confirmed hours only.':'Rates and gross show once you sign in with your personal link.']}),K?(0,j.jsx)(i.Button,{kind:"success",label:"Tips day: split tips for this period \u203a",onPress:()=>e('more','tipsday')}):null]})},_e.TipsDay=function({go:e}){const{rid:n,today:a,now:f}=(0,x.useCtx)(6e4),{pay:w,source:T}=(0,b.useVenuePay)(n),P=(0,l.useOwner)(e=>e.staff),k=(0,l.useOwner)(e=>e.attendance),C=(0,l.useOwner)(e=>e.tronc),R=(0,u.nextToPay)(w,'tips',a),[z,O]=(0,o.useState)(0),H=(0,u.tipsPeriod)(w,R.period.start,z),[W,N]=(0,o.useState)(''),[L,F]=(0,o.useState)({}),[V,A]=(0,o.useState)(null),E=(0,o.useMemo)(()=>S(H,P,k,f,{}),[H.key,P,k]),Y=e=>'owner'===e.role&&!C.includeOwner||'manager'===e.role&&!C.includeManagers,G=e=>L[e.id]??Y(e),U=E.filter(e=>e.confirmed>0||e.pending>0),_=Math.round(100*Number(W.replace(/[\xa3,\s]/g,''))),q=Number.isFinite(_)&&_>0&&_<=1e8&&/^\s*\xa3?\s*[\d,]+(\.\d{0,2})?\s*$/.test(W),J=U.filter(e=>!G(e.person)&&e.confirmed>0),{amounts:K}=(0,y.allocate)(q?_:0,J.map(e=>e.confirmed)),Q={};J.forEach((e,s)=>{Q[e.person.id]=K[s]});const X=J.reduce((e,s)=>e+s.confirmed,0),Z=Object.values(Q).reduce((e,s)=>e+s,0),ee=U.filter(e=>e.pending>0&&!G(e.person)),se=ee.reduce((e,s)=>e+s.pending,0),te=()=>[['Name','Role','Period start','Period end','Payday','Confirmed hours','Confirmed h:mm','Share %','Tips \xa3'],...U.map(e=>{const s=!G(e.person)&&e.confirmed>0;return[M(e.person),D(e.person),(0,u.ukDate)(H.start),(0,u.ukDate)(H.end),H.payday?(0,u.ukDate)(H.payday):'',(0,u.decH)(e.confirmed),(0,u.hMm)(e.confirmed),s&&X?(e.confirmed/X*100).toFixed(2):'0.00',s?B(Q[e.person.id]??0):G(e.person)?'excluded':'0.00']}),['TOTAL','',(0,u.ukDate)(H.start),(0,u.ukDate)(H.end),H.payday?(0,u.ukDate)(H.payday):'',(0,u.decH)(X),(0,u.hMm)(X),X?'100.00':'0.00',B(Z)]],oe=e=>{A(e),setTimeout(()=>A(null),6e3)};return(0,j.jsxs)(d.default,{style:{gap:10},testID:"tips-day",children:[(0,j.jsx)(i.Banner,{kind:"info",title:"Saving payouts and notifying staff are coming next",children:"For now this works out the split and exports it. Nothing is saved to the team, sent or paid."}),'none'===T?(0,j.jsxs)(i.Banner,{kind:"warn",title:"Tips dates not set up",children:[(0,j.jsx)(i.Muted,{children:"Using weekly tips for now."}),(0,j.jsx)(i.Button,{small:!0,kind:"ghost",label:"Set your pay dates \u203a",onPress:()=>e('more','paysettings')})]}):null,(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(i.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",disabled:z<=-6,onPress:()=>O(z-1)}),(0,j.jsxs)(d.default,{style:{alignItems:'center',flex:1},children:[(0,j.jsx)(i.T,{weight:"bold",size:18,children:(0,u.rangeText)(H.start,H.end)}),(0,j.jsxs)(i.Muted,{children:[(0,u.ukDate)(H.start)," to ",(0,u.ukDate)(H.end)," \xb7 ",H.payday>=a?'paid':'was paid'," ",(0,u.dayMonth)(H.payday)]}),0===z?(0,j.jsx)(i.Badge,{kind:"gold",label:"Paid next"}):null]}),(0,j.jsx)(i.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:z>=1,onPress:()=>O(z+1)})]}),(0,j.jsxs)(i.Card,{highlight:h.colours.gold,children:[(0,j.jsx)(i.T,{weight:"semibold",children:"Total tips to share"}),(0,j.jsxs)(i.Row,{style:{alignItems:'center'},children:[(0,j.jsx)(i.T,{size:28,weight:"bold",colour:h.colours.gold,children:"\xa3"}),(0,j.jsx)(s.TextInput,{testID:"tips-total",accessibilityLabel:"Total tips in pounds",value:W,onChangeText:N,placeholder:"0.00",placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",style:[i.styles.input,{flex:1,fontSize:26,fontWeight:'700'}]})]}),W&&!q?(0,j.jsx)(i.T,{size:13,colour:h.colours.red,children:"Enter an amount like 1250.00"}):(0,j.jsx)(i.Muted,{children:"Shared by confirmed hours: share = total \xd7 (their hours \xf7 everyone's hours). Rounded to the penny; leftover pennies go to the largest shares so it adds up exactly."})]}),ee.length?(0,j.jsx)(r.default,{accessibilityRole:"button",onPress:()=>e('more','signoff'),testID:"tips-pending",children:(0,j.jsxs)(d.default,{style:{backgroundColor:h.colours.redBg,borderRadius:12,padding:12,borderLeftWidth:6,borderLeftColor:h.colours.red,gap:4},children:[(0,j.jsxs)(i.T,{weight:"bold",colour:h.colours.red,children:["\u26a0 Don't pay out yet: ",(0,u.decH)(se)," h not signed off"]}),(0,j.jsxs)(i.T,{size:14,children:[ee.map(e=>`${M(e.person)} (${(0,u.decH)(e.pending)} h)`).join(', '),". Pending hours are left out of the split, so these people would get less than they should."]}),(0,j.jsx)(i.T,{weight:"semibold",colour:h.colours.gold,children:"Sign off hours \u203a"})]})}):U.length?(0,j.jsx)(i.Banner,{kind:"success",title:"All hours in this fortnight are signed off"}):null,(0,j.jsx)(t.WideTable,{children:(0,j.jsxs)(d.default,{testID:"tips-table",children:[(0,j.jsx)(t.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:h.colours.border,paddingBottom:4},children:['Include','Name','Confirmed','Share','Tips'].map((e,s)=>(0,j.jsx)(i.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{width:[64,150,80,64,84][s]},children:e},e))}),U.map(e=>{const s=G(e.person),o=Q[e.person.id]??0;return(0,j.jsxs)(t.TRow,{heads:['Include','Name','Confirmed','Share','Tips'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222',opacity:s?.5:1},children:[(0,j.jsx)(r.default,{accessibilityRole:"checkbox",accessibilityState:{checked:!s},accessibilityLabel:`Include ${M(e.person)}`,onPress:()=>F({...L,[e.person.id]:!s}),style:{width:64,minHeight:44,justifyContent:'center'},children:(0,j.jsx)(d.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:s?h.colours.muted:h.colours.ok,backgroundColor:s?'transparent':h.colours.okBg,alignItems:'center',justifyContent:'center'},children:(0,j.jsx)(i.T,{size:14,colour:h.colours.ok,children:s?'':'\u2713'})})}),(0,j.jsxs)(d.default,{style:{width:150},children:[(0,j.jsx)(i.T,{size:14,weight:"semibold",numberOfLines:1,children:M(e.person)}),(0,j.jsxs)(i.Muted,{numberOfLines:1,children:[s?'Excluded':D(e.person),e.pending?` \xb7 \u26a0 ${(0,u.decH)(e.pending)} h pending`:'']})]}),(0,j.jsxs)(i.T,{size:14,style:{width:80},children:[(0,u.decH)(e.confirmed)," h"]}),(0,j.jsx)(i.T,{size:14,colour:h.colours.muted,style:{width:64},children:!s&&X?`${(e.confirmed/X*100).toFixed(1)}%`:'\u2013'}),(0,j.jsx)(i.T,{size:15,weight:"bold",colour:s?h.colours.muted:h.colours.gold,style:{width:84},children:s?'\u2013':(0,c.gbp)(o)})]},e.person.id)}),(0,j.jsxs)(t.TRow,{heads:['','','Confirmed','Share','Tips'],style:{paddingVertical:8,borderTopWidth:2,borderColor:h.colours.gold},children:[(0,j.jsx)(i.T,{size:14,style:{width:64},children:" "}),(0,j.jsxs)(i.T,{size:14,weight:"bold",style:{width:150},children:["Total (",J.length," people)"]}),(0,j.jsxs)(i.T,{size:14,weight:"bold",style:{width:80},children:[(0,u.decH)(X)," h"]}),(0,j.jsx)(i.T,{size:14,style:{width:64},children:X?'100%':'\u2013'}),(0,j.jsx)(i.T,{size:15,weight:"bold",colour:q&&Z===_?h.colours.ok:h.colours.text,style:{width:84},children:(0,c.gbp)(Z)})]})]})}),U.length?null:(0,j.jsx)(i.Muted,{children:"No clocked hours in this fortnight yet."}),q&&X?(0,j.jsxs)(i.Muted,{children:["Check: ",J.length," shares add up to ",(0,c.gbp)(Z)," of ",(0,c.gbp)(_)," ",Z===_?'\u2713':'',". \xa3",(_/100/(X/60)).toFixed(4)," per confirmed hour."]}):null,(0,j.jsxs)(i.Muted,{children:["Owner ",C.includeOwner?'included':'left out'," and managers ",C.includeManagers?'included':'left out'," by default (your tipping policy in Tips (tronc)). Tick or untick anyone for this split."]}),(0,j.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(i.Button,{small:!0,kind:"success",label:"Copy for spreadsheet",testID:"tips-copy",disabled:!q,onPress:async()=>{const e=await I(v(te()));oe(e?'Copied. Paste into the first cell of your spreadsheet.':'Copy is not available here. Use Download CSV.')}}),(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Download CSV",disabled:!q,onPress:()=>{(0,p.downloadText)(`tips-${H.start}-to-${H.end}.csv`,$(te())),oe('CSV downloaded.')}}),(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Print / PDF",disabled:!q,onPress:()=>{const e=te();(0,p.printTable)(`Tips ${(0,u.rangeText)(H.start,H.end)} (paid ${(0,u.dayMonth)(H.payday)})`,`Total ${(0,c.gbp)(_)} shared by confirmed hours${ee.length?` \xb7 WARNING ${(0,u.decH)(se)} h not signed off`:''}`,e[0],e.slice(1))}})]}),V?(0,j.jsx)(i.Banner,{kind:"success",title:V}):null]})},_e.PaydaysCard=function({go:e}){const{rid:s,today:t}=(0,x.useCtx)(6e4),{pay:o,source:r}=(0,b.useVenuePay)(s),a=(0,u.nextToPay)(o,'tips',t).period,l=(0,u.nextToPay)(o,'wage',t).period;return(0,j.jsxs)(d.default,{testID:"paydays-card",style:{backgroundColor:h.colours.surface,borderRadius:16,borderWidth:1,borderColor:h.colours.hairline,padding:16,gap:8},children:[(0,j.jsx)(n.CardHeading,{right:'none'===r?(0,j.jsx)(i.Badge,{kind:"amber",label:"Not set up"}):null,children:"Paydays"}),(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,j.jsxs)(i.T,{children:["Next tips payday: ",(0,j.jsx)(i.T,{weight:"semibold",colour:h.colours.goldLight,children:a.payday===t?'today':(0,u.dayMonth)(a.payday)})]}),(0,j.jsx)(i.Muted,{children:(0,u.rangeText)(a.start,a.end)})]}),(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,j.jsxs)(i.T,{children:["Next payday: ",(0,j.jsx)(i.T,{weight:"semibold",colour:h.colours.goldLight,children:l.payday===t?'today':(0,u.dayMonth)(l.payday)})]}),(0,j.jsxs)(i.Muted,{children:["period ",(0,u.rangeText)(l.start,l.end)]})]}),(0,j.jsxs)(n.ActionGrid,{testID:"paydays-actions",children:[(0,j.jsx)(n.ActionTile,{primary:!0,icon:"payroll",label:"Payroll hours",sub:"Copy or export",onPress:()=>e('more','hours'),testID:"paydays-hours"}),(0,j.jsx)(n.ActionTile,{icon:"tips",label:"Tips day",sub:"Share out tips",onPress:()=>e('more','tipsday'),testID:"paydays-tips"})]}),'settings'!==r?(0,j.jsx)(i.Button,{small:!0,kind:"ghost",label:"Pay & tips settings",onPress:()=>e('more','paysettings'),style:{alignSelf:'flex-start'}}):null]})},_e.MyPeriods=function({staffId:e}){const{rid:s,today:t,now:o,meId:n}=(0,x.useCtx)(6e4),r=e??n,{pay:a}=(0,b.useVenuePay)(s),c=(0,l.useOwner)(e=>e.attendance),p=(0,l.useOwner)(e=>e.staff.find(e=>e.id===r)),y=(0,u.wagePeriod)(a,t,0),f=(0,u.tipsPeriod)(a,t,0),w=e=>p?S(e,[p],c,o,{})[0]??null:null,T=(e,s,o)=>(0,j.jsxs)(d.default,{style:{flexGrow:1,flexBasis:160,backgroundColor:h.colours.surface,borderRadius:14,borderWidth:1,borderColor:h.colours.border,padding:12,gap:2},children:[(0,j.jsx)(i.T,{size:13,weight:"semibold",colour:h.colours.gold,children:e.toUpperCase()}),(0,j.jsxs)(i.Muted,{children:[(0,u.rangeText)(s.start,s.end)," \xb7 ",s.payday>=t?'paid':'was paid'," ",(0,u.dayMonth)(s.payday)]}),(0,j.jsxs)(i.T,{size:24,weight:"bold",children:[(0,u.decH)(o?.confirmed??0)," h"]}),(0,j.jsxs)(i.Muted,{children:["confirmed (",(0,u.hMm)(o?.confirmed??0),") \xb7 ",o?.shifts??0," shifts"]}),o?.pending?(0,j.jsxs)(i.T,{size:13,colour:h.colours.amber,children:["+ ",(0,u.decH)(o.pending)," h waiting for sign-off"]}):null]},e);return(0,j.jsx)(i.Row,{wrap:!0,gap:8,style:{alignItems:'stretch'},children:[T('This pay period',y,w(y)),T('This tips fortnight',f,w(f))]})};var s=_r(_d[0]),t=_r(_d[1]),o=_r(_d[2]),n=_r(_d[3]);_r(_d[4]);var r=e(_r(_d[5])),d=e(_r(_d[6])),i=_r(_d[7]),a=_r(_d[8]),l=_r(_d[9]),c=_r(_d[10]),u=_r(_d[11]),h=_r(_d[12]),p=_r(_d[13]),y=_r(_d[14]),f=_r(_d[15]),x=_r(_d[16]),b=_r(_d[17]),j=_r(_d[18]);const w={weekly:'Weekly',fortnightly:'Fortnightly',monthly:'Monthly'},T={none:'Keep the date',before:'Friday before',after:'Monday after'};const P=e=>`${e}${e%10==1&&11!==e?'st':e%10==2&&12!==e?'nd':e%10==3&&13!==e?'rd':'th'}`;function k({label:e,day:s,period:t}){return(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,j.jsxs)(i.T,{children:[e,": ",(0,j.jsx)(i.T,{weight:"bold",colour:h.colours.gold,children:(0,u.dayMonth)(s)})]}),(0,j.jsx)(i.Muted,{children:(0,u.rangeText)(t.start,t.end)})]})}const C=e=>{if(!e)return'';const s=new Date(e);return`${String(s.getHours()).padStart(2,'0')}:${String(s.getMinutes()).padStart(2,'0')}`};function S(e,s,t,o,n){const r=t.filter(s=>s.in&&s.date>=e.start&&s.date<=e.end);return s.map(e=>{const s=r.filter(s=>s.staffId===e.id).sort((e,s)=>e.date.localeCompare(s.date)||(e.in??'').localeCompare(s.in??'')).map(e=>{const s=(0,x.paidMins)(e,o),t=(0,l.attStatus)(e);return{a:e,date:e.date,inT:C(e.in),outT:C(e.out),brk:s.brk,paid:s.paid,status:'open'===t?'On now':'awaiting'===t?'Pending':'Confirmed'}}),t=e=>s.filter(s=>s.status===e).reduce((e,s)=>e+s.paid,0),d=t('Confirmed'),i=n[e.id];return{person:e,confirmed:d,pending:t('Pending'),open:t('On now'),shifts:s.filter(e=>'On now'!==e.status).length,days:s,rate:i,gross:null!=i?Math.round(d/60*i):void 0}}).filter(e=>e.days.length>0||e.person.active&&'owner'!==e.person.role)}const D=e=>`${l.ROLE_LABEL[e.role]}${e.job?` \xb7 ${e.job}`:''}`,M=e=>e.name.replace(' (example)',''),B=e=>null==e?'':(e/100).toFixed(2),R=e=>e.replace(/[\t\r\n]+/g,' '),z=e=>/[",\n]/.test(e)?`"${e.replace(/"/g,'""')}"`:e,v=e=>e.map(e=>e.map(R).join('\t')).join('\n'),$=e=>e.map(e=>e.map(z).join(',')).join('\r\n');function O(e,s,t,o){const n=['Name','Role','Period start','Period end','Confirmed hours','Confirmed h:mm','Pending hours','Pending h:mm','Shifts',...o?['Tips hours']:[],...t?['Rate \xa3/h','Gross \xa3']:[]],r=e.map(e=>[M(e.person),D(e.person),(0,u.ukDate)(s.start),(0,u.ukDate)(s.end),(0,u.decH)(e.confirmed),(0,u.hMm)(e.confirmed),(0,u.decH)(e.pending),(0,u.hMm)(e.pending),String(e.shifts),...o?[(0,u.decH)(e.confirmed)]:[],...t?[B(e.rate),B(e.gross)]:[]]),d=e.reduce((e,s)=>({c:e.c+s.confirmed,p:e.p+s.pending,s:e.s+s.shifts,g:e.g+(s.gross??0)}),{c:0,p:0,s:0,g:0});return[n,...r,['TOTAL','',(0,u.ukDate)(s.start),(0,u.ukDate)(s.end),(0,u.decH)(d.c),(0,u.hMm)(d.c),(0,u.decH)(d.p),(0,u.hMm)(d.p),String(d.s),...o?[(0,u.decH)(d.c)]:[],...t?['',B(d.g)]:[]]]}function H(e){return[['Name','Role','Date','In','Out','Break mins','Paid hours','Paid h:mm','Status'],...e.flatMap(e=>e.days.map(s=>[M(e.person),D(e.person),(0,u.ukDate)(s.date),s.inT,s.outT,'On now'===s.status?'':String(s.brk),'On now'===s.status?'':(0,u.decH)(s.paid),'On now'===s.status?'':(0,u.hMm)(s.paid),s.status]))]}async function I(e){if('undefined'==typeof document)return!1;try{if(navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}try{const s=document.createElement('textarea');s.value=e,s.style.position='fixed',s.style.opacity='0',document.body.appendChild(s),s.select();const t=document.execCommand('copy');return s.remove(),t}catch{return!1}}function W(e,s){const t=(0,u.nextToPay)(e,'wage',s),o=(0,u.nextToPay)(e,'tips',s),n=(0,u.wagePeriod)(e,t.period.start,-1),r=(0,u.tipsPeriod)(e,o.period.start,-1),d=e=>e.payday>=s?e.payday===s?'Pays today':`Pays ${(0,u.dayMonth)(e.payday)}`:`Paid ${(0,u.dayMonth)(e.payday)}`;return[{id:'wage',label:`Wages ${(0,u.rangeText)(t.period.start,t.period.end)}`,sub:d(t.period),period:t.period},{id:'wagePrev',label:`Wages ${(0,u.rangeText)(n.start,n.end)}`,sub:d(n),period:n},{id:'tips',label:`Tips ${(0,u.rangeText)(o.period.start,o.period.end)}`,sub:d(o.period),period:o.period},{id:'tipsPrev',label:`Tips ${(0,u.rangeText)(r.start,r.end)}`,sub:d(r),period:r}]}function N({onSet:e}){const[s,t]=(0,o.useState)(''),[n,r]=(0,o.useState)(''),a=(0,u.parseUk)(s),l=(0,u.parseUk)(n),c=!!a&&!!l&&l>=a&&(0,u.plusDays)(a,92)>=l;return(0,j.jsxs)(i.Row,{wrap:!0,gap:6,style:{alignItems:'flex-end'},children:[(0,j.jsx)(d.default,{style:{flexBasis:130,flexGrow:1},children:(0,j.jsx)(i.Field,{label:"From (DD/MM/YYYY)",value:s,onChangeText:t,placeholder:"23/10/2026"})}),(0,j.jsx)(d.default,{style:{flexBasis:130,flexGrow:1},children:(0,j.jsx)(i.Field,{label:"To (DD/MM/YYYY)",value:n,onChangeText:r,placeholder:"22/11/2026"})}),(0,j.jsx)(i.Button,{small:!0,kind:"success",label:"Show",disabled:!c,onPress:()=>c&&e((0,u.customPeriod)(a,l))}),s&&n&&!c?(0,j.jsx)(i.T,{size:13,colour:h.colours.red,children:"Use two dates, the second on or after the first, up to 3 months apart."}):null]})}const L=[150,54,62,62,48,62,70]},1009,[877,1317,30,1318,122,263,127,813,872,856,816,1249,821,1319,1011,1019,927,1250,24]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useWeekSales=F,_e.Rota=function(){const{now:e,role:t,meId:n}=(0,C.useCtx)(6e4),o=(0,f.useOwner)(e=>e.staff).filter(e=>e.active),i=(0,f.useOwner)(e=>e.shifts),h=(0,C.useHourly)(),m=(0,f.useOwner)(e=>e.availability),p=(0,f.useOwner)(e=>e.leave),x=(0,f.useOwner)(e=>e.swaps),[I,v]=(0,l.useState)(0),[D,T]=(0,l.useState)(null),[$,M]=(0,l.useState)(null),[R,P]=(0,l.useState)('week'),[z,H]=(0,l.useState)(''),[W,E]=(0,l.useState)(''),[_,q]=(0,l.useState)(''),K='staff'!==t,U=(0,b.addMins)(L(e),7*I*1440);U.setHours(0,0,0,0);const V=F(U),G=V.sales,X='none'===V.mode,J=Array.from({length:7},(e,t)=>{const s=new Date(U);return s.setDate(U.getDate()+t),(0,b.ymd)(s)}),Q=(0,f.visibleShifts)(i,K).filter(e=>e.date>=J[0]&&e.date<=J[6]),Z=(()=>{const e=new Date(U);return e.setDate(e.getDate()-7),(0,b.ymd)(e)})(),ee=Q.filter(e=>!e.published||e.changed).length,te=i.filter(e=>e.date>=Z&&e.datep.some(s=>s.staffId===e&&'approved'===s.status&&s.from<=t&&t<=s.to),ne=J.map(e=>Q.filter(t=>t.date===e).reduce((e,t)=>{return e+(A(s=t)-Y(A(s)))*(h[s.staffId]??0);var s},0)),ae=ne.reduce((e,t)=>e+t,0),oe=G.reduce((e,t)=>e+t,0),ie=(e,t)=>t?Math.round(e/t*100):0,le=K?o:o.filter(e=>e.id===n),re=(0,a.useNarrow)(),de=Math.max(0,J.indexOf((0,b.ymd)(e))),[ce,ue]=(0,l.useState)(null),he=ce??de,fe=(e,t)=>!re||t===he,me=re?150:74;return(0,B.jsxs)(c.default,{style:{gap:10},children:[(0,B.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,B.jsx)(u.Chip,{label:"Week",selected:'week'===R,onPress:()=>P('week')}),(0,B.jsx)(u.Chip,{label:`Swaps & leave (${x.filter(e=>'open'===e.status).length+p.filter(e=>'pending'===e.status).length})`,selected:'requests'===R,onPress:()=>P('requests')}),(0,B.jsx)(u.Chip,{label:"Availability",selected:'availability'===R,onPress:()=>P('availability')})]}),'week'===R?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsx)(u.Button,{small:!0,kind:"ghost",label:"\u2039 Prev",accessibilityLabel:"Previous week",onPress:()=>{v(I-1),T(null)}}),(0,B.jsxs)(c.default,{style:{alignItems:'center',flex:1},children:[(0,B.jsxs)(u.T,{weight:"semibold",children:["Week of ",(0,b.niceDate)(U)]}),(0,B.jsxs)(u.Muted,{children:[0===I?'This week':1===I?'Next week':-1===I?'Last week':I>0?`In ${I} weeks`:-I+" weeks ago",K?' \xb7 tap a cell to add or edit':' \xb7 your shifts']})]}),(0,B.jsx)(u.Button,{small:!0,kind:"ghost",label:"Next \u203a",accessibilityLabel:"Next week",onPress:()=>{v(I+1),T(null)}})]}),K?(0,B.jsxs)(u.Row,{wrap:!0,gap:8,style:{alignItems:'center'},children:[(0,B.jsx)(u.Button,{small:!0,kind:"secondary",label:"Copy last week"+(te?` (${te})`:''),disabled:!te,testID:"rota-copy",onPress:()=>{const e=f.useOwner.getState().copyWeek(Z,J[0]);T(e?`Copied ${e} ${1===e?'shift':'shifts'} from last week as drafts. Check them, then publish.`:'Nothing to copy: those days are already filled.')}}),(0,B.jsx)(u.Button,{small:!0,kind:"success",label:ee?`Publish ${ee} ${1===ee?'change':'changes'}`:'Week published',disabled:!ee,testID:"rota-publish",onPress:()=>{const e=f.useOwner.getState().publishWeek(J[0]);T(`Published ${e} ${1===e?'shift':'shifts'}. Staff see them in their app.`)}}),ee?(0,B.jsx)(u.Badge,{kind:"amber",label:`${ee} unpublished`}):Q.length?(0,B.jsx)(u.Badge,{kind:"ok",label:"Visible to staff"}):null]}):null,D?(0,B.jsx)(u.Banner,{kind:"success",title:D}):null,re?(0,B.jsx)(u.Row,{wrap:!0,gap:6,children:C.DAY3.map((e,t)=>(0,B.jsx)(u.Chip,{label:`${e} ${(0,b.parseYmd)(J[t]).getDate()}`,selected:t===he,onPress:()=>ue(t)},e))}):null,(0,B.jsx)(d.default,{horizontal:!re,showsHorizontalScrollIndicator:!0,children:(0,B.jsxs)(c.default,{style:{gap:4},children:[(0,B.jsxs)(u.Row,{gap:4,children:[(0,B.jsx)(c.default,{style:{width:126}}),C.DAY3.map((t,s)=>(0,B.jsx)(c.default,{style:{width:me,alignItems:'center'},children:(0,B.jsxs)(u.T,{size:12,weight:"semibold",colour:J[s]===(0,b.ymd)(e)?w.colours.gold:w.colours.text,children:[t," ",(0,b.parseYmd)(J[s]).getDate()]})},t)).filter(fe)]}),le.map(e=>(0,B.jsxs)(u.Row,{gap:4,children:[(0,B.jsxs)(u.Row,{gap:6,style:{width:126},children:[(0,B.jsx)(S.StaffAvatar,{id:e.id,size:26}),(0,B.jsxs)(c.default,{style:{flex:1},children:[(0,B.jsx)(u.T,{size:12,numberOfLines:1,children:e.name.replace(' (example)','')}),(0,B.jsx)(u.Muted,{numberOfLines:1,children:e.job})]})]}),C.DAY3.map((t,s)=>{const n=(0,f.shiftOf)(Q,e.id,J[s]),a=(m[e.id]??[]).includes(s),o=se(e.id,J[s]);return(0,B.jsxs)(r.default,{accessibilityRole:"button",accessibilityLabel:`${e.name} ${C.DAY3[s]} ${n?`${(0,C.fmtH)(n.start)} to ${(0,C.fmtH)(n.end)}`:'no shift'}`,disabled:!K,onPress:()=>M({staffId:e.id,date:J[s],shift:n}),style:{width:me,height:48,borderRadius:10,borderWidth:1,borderStyle:n&&!n.published?'dashed':'solid',borderColor:n?n.published?w.colours.gold:w.colours.amber:w.colours.border,backgroundColor:n?n.published?'#2b2414':'#241f14':o?'#1d2a3a':a?'#2a1d1d':'transparent',alignItems:'center',justifyContent:'center'},children:[n?(0,B.jsxs)(u.T,{size:11,weight:"semibold",children:[(0,C.fmtH)(n.start),"\u2013",(0,C.fmtH)(n.end)]}):(0,B.jsx)(u.T,{size:11,colour:w.colours.muted,children:o?'Leave':a?'Unavail.':K?'Add':'\u2013'}),n&&(a||o)?(0,B.jsx)(u.T,{size:9,colour:w.colours.red,children:o?'on leave!':'unavailable'}):n&&K&&(!n.published||n.changed)?(0,B.jsx)(u.T,{size:9,colour:w.colours.amber,children:n.published?'changed':'draft'}):null]},s)}).filter(fe)]},e.id)),K?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(u.Row,{gap:4,children:[(0,B.jsx)(c.default,{style:{width:96},children:(0,B.jsx)(u.Muted,{children:"Labour"})}),ne.map((e,t)=>(0,B.jsx)(c.default,{style:{width:me,alignItems:'center'},children:(0,B.jsx)(u.T,{size:11,children:(0,j.gbp)(e).replace('.00','')})},t)).filter(fe)]}),X?null:(0,B.jsxs)(u.Row,{gap:4,children:[(0,B.jsx)(c.default,{style:{width:96},children:(0,B.jsx)(u.Muted,{children:'example'===V.mode?'Fcst sales (ex.)':'Fcst sales'})}),G.map((e,t)=>(0,B.jsx)(c.default,{style:{width:me,alignItems:'center'},children:(0,B.jsx)(u.T,{size:11,colour:w.colours.muted,children:e?`\xa3${Math.round(e/100)}`:'shut'})},t)).filter(fe)]}),X?null:(0,B.jsxs)(u.Row,{gap:4,children:[(0,B.jsx)(c.default,{style:{width:96},children:(0,B.jsx)(u.Muted,{children:"Labour %"})}),ne.map((e,t)=>{const s=ie(e,G[t]);return(0,B.jsx)(c.default,{style:{width:me,alignItems:'center'},children:(0,B.jsx)(u.T,{size:11,weight:"semibold",colour:G[t]?s>32?w.colours.red:s>26?w.colours.amber:w.colours.ok:w.colours.muted,children:G[t]?`${s}%`:'\u2013'})},t)}).filter(fe)]})]}):null]})}),K&&X?(0,B.jsx)(u.Card,{children:(0,B.jsxs)(c.default,{testID:"labour-no-forecast",style:{gap:6},children:[(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsx)(u.T,{weight:"semibold",children:"Labour this week"}),(0,B.jsx)(c.default,{testID:"labour-week-cost",children:(0,B.jsx)(u.T,{weight:"semibold",children:(0,j.gbp)(ae)})})]}),(0,B.jsxs)(u.Muted,{children:[(0,j.gbp)(ae)," labour from the rota (paid hours \xd7 hourly rates, owner salaries excluded)."]}),(0,B.jsx)(u.T,{weight:"semibold",colour:w.colours.gold,children:"Not enough history yet for labour vs sales"}),(0,B.jsx)(u.Muted,{children:`Forecasts start once CoverCharge has ${1===V.weeks?'1 week':`${V.weeks} weeks`} of your bookings and cash-ups. Until then no sales forecast or labour % is shown.`}),V.booked?(0,B.jsx)(c.default,{testID:"labour-booked",children:(0,B.jsxs)(u.T,{children:["Booked so far: ",V.booked," covers this week"]})}):null]})}):null,K&&!X?(0,B.jsxs)(u.Card,{children:[(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsx)(u.T,{weight:"semibold",children:"Labour vs forecast sales"}),(0,B.jsxs)(u.Row,{gap:6,children:['example'===V.mode?(0,B.jsx)(O.ExampleBadge,{}):null,(0,B.jsx)(u.Badge,{kind:ie(ae,oe)>30?'red':'ok',label:`${ie(ae,oe)}% this week`})]})]}),(0,B.jsxs)(u.Muted,{children:[(0,j.gbp)(ae)," labour (paid hours \xd7 hourly rates, owner salaries excluded) vs about ",(0,j.gbp)(oe)," forecast sales. Target 25\u201330%. ",'example'===V.mode?'Example figures: forecast sales use an example spend per cover.':'Forecast sales are your average takings for each weekday from your cash-ups.']}),(()=>{const e=ie(ne[5],G[5]);return e&&e<24?(0,B.jsxs)(u.T,{size:14,colour:w.colours.gold,children:["Tip: Saturday is forecast busy and labour is only ",e,"%. Consider an extra server 18:00\u201321:00."]}):null})()]}):null,K?(0,B.jsx)(u.Muted,{center:!0,children:"New and copied shifts are drafts (dashed) until you publish. Publishing only makes shifts visible in the Staff app and on the Display. Nothing is sent by text or email."}):null]}):null,'requests'===R?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(k.SectionHead,{title:"Shift swaps & cover"}),x.filter(e=>K||e.fromId===n||e.toId===n).map(e=>{const t=i.find(t=>t.id===e.shiftId),s=o.find(t=>t.id===e.fromId),n=o.find(t=>t.id===e.toId);return(0,B.jsxs)(u.Card,{children:[(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsxs)(u.T,{weight:"semibold",style:{flex:1},children:['swap'===e.kind?'Swap':'Cover needed',": ",s?.name]}),(0,B.jsx)(u.Badge,{kind:'open'===e.status?'amber':'approved'===e.status?'ok':'neutral',label:e.status})]}),(0,B.jsxs)(u.Muted,{children:[t?`${C.DAY3[t.day]} ${(0,C.fmtH)(t.start)}\u2013${(0,C.fmtH)(t.end)}`:'Shift',n?` \u2192 ${n.name}`:''," \xb7 ",e.note]}),'open'===e.status&&K?(0,B.jsxs)(u.Row,{gap:6,children:['cover'!==e.kind||e.toId?null:o.filter(t=>t.id!==e.fromId&&'owner'!==t.role).map(t=>(0,B.jsx)(u.Chip,{label:`Give to ${t.name.split(' ')[0]}`,onPress:()=>{f.useOwner.setState(s=>({swaps:s.swaps.map(s=>s.id===e.id?{...s,toId:t.id}:s)}))}},t.id)),(0,B.jsx)(u.Button,{small:!0,label:"Approve",disabled:!e.toId,onPress:()=>{f.useOwner.getState().setSwap(e.id,'approved');const s=e=>(o.find(t=>t.id===e)?.name??'').replace(' (example)','');(0,y.autoPost)('all','swap'===e.kind?`Shift swap: ${s(e.fromId)} \u2194 ${s(e.toId)} approved`:`Cover approved: ${s(e.toId)} covers ${s(e.fromId)}${t?` (${C.DAY3[t.day]} ${(0,C.fmtH)(t.start)}\u2013${(0,C.fmtH)(t.end)})`:''}`)}}),(0,B.jsx)(u.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>f.useOwner.getState().setSwap(e.id,'declined')})]}):null]},e.id)}),K?null:(0,B.jsxs)(u.Card,{children:[(0,B.jsx)(u.T,{weight:"semibold",children:"Ask for a swap or cover"}),(0,B.jsx)(u.Muted,{children:"Your shifts this week. Your manager approves every swap."}),Q.filter(e=>e.staffId===n).sort((e,t)=>e.date.localeCompare(t.date)).map(e=>{const t=x.some(t=>t.shiftId===e.id&&'open'===t.status);return(0,B.jsxs)(c.default,{style:{gap:4,paddingVertical:4},children:[(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsxs)(u.T,{size:14,weight:"medium",children:[C.DAY3[e.day]," ",(0,C.fmtH)(e.start),"\u2013",(0,C.fmtH)(e.end)]}),t?(0,B.jsx)(u.Badge,{kind:"amber",label:"Request open"}):null]}),t?null:(0,B.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,B.jsx)(u.Chip,{label:"Ask for cover",onPress:()=>{f.useOwner.getState().addSwap({shiftId:e.id,fromId:n,kind:'cover',note:'Can anyone cover?'}),(0,y.autoPost)('all',`Cover needed: ${C.DAY3[e.day]} ${(0,C.fmtH)(e.start)}\u2013${(0,C.fmtH)(e.end)} (${(o.find(e=>e.id===n)?.name??'').replace(' (example)','')})`)}}),o.filter(e=>e.id!==n&&'staff'===e.role).map(t=>(0,B.jsx)(u.Chip,{label:`Swap with ${t.name.replace(' (example)','')}`,onPress:()=>f.useOwner.getState().addSwap({shiftId:e.id,fromId:n,toId:t.id,kind:'swap',note:'Agreed between us'})},t.id))]})]},e.id)}),Q.some(e=>e.staffId===n)?null:(0,B.jsx)(u.Muted,{children:"No shifts on the rota this week."})]}),(0,B.jsx)(k.SectionHead,{title:"Holiday & leave"}),p.filter(e=>K||e.staffId===n).map(e=>(0,B.jsxs)(u.Card,{children:[(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsx)(u.T,{weight:"semibold",children:o.find(t=>t.id===e.staffId)?.name}),(0,B.jsx)(u.Badge,{kind:'pending'===e.status?'amber':'approved'===e.status?'ok':'red',label:e.status})]}),(0,B.jsxs)(u.Muted,{children:[(0,b.niceDate)((0,b.parseYmd)(e.from))," \u2013 ",(0,b.niceDate)((0,b.parseYmd)(e.to))," \xb7 ",e.reason]}),'pending'===e.status&&K?(0,B.jsxs)(u.Row,{gap:6,children:[(0,B.jsx)(u.Button,{small:!0,label:"Approve",onPress:()=>f.useOwner.getState().setLeave(e.id,'approved')}),(0,B.jsx)(u.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>f.useOwner.getState().setLeave(e.id,'declined')})]}):null]},e.id)),(0,B.jsxs)(u.Card,{children:[(0,B.jsxs)(u.T,{weight:"semibold",children:["Request leave",K?' (as yourself)':'']}),(0,B.jsxs)(u.Row,{gap:6,children:[(0,B.jsx)(s.TextInput,{accessibilityLabel:"From date",placeholder:"From YYYY-MM-DD",placeholderTextColor:"#7D776C",value:z,onChangeText:H,style:[u.styles.input,{flex:1}]}),(0,B.jsx)(s.TextInput,{accessibilityLabel:"To date",placeholder:"To YYYY-MM-DD",placeholderTextColor:"#7D776C",value:W,onChangeText:E,style:[u.styles.input,{flex:1}]})]}),(0,B.jsx)(u.Field,{label:"Reason",value:_,onChangeText:q}),(0,B.jsx)(u.Button,{small:!0,label:"Send request",disabled:!/^\d{4}-\d{2}-\d{2}$/.test(z)||!/^\d{4}-\d{2}-\d{2}$/.test(W)||W{f.useOwner.getState().addLeave({staffId:n,from:z,to:W,reason:_.trim()||'Holiday'}),H(''),E(''),q('')}})]})]}):null,'availability'===R?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(u.Muted,{children:["Days each person can\u2019t work. ",K?'Tap to toggle.':'Tap to set your own.'," The rota flags clashes."]}),le.filter(e=>'owner'!==e.role||!K).map(e=>(0,B.jsxs)(u.Card,{children:[(0,B.jsxs)(u.Row,{gap:8,children:[(0,B.jsx)(S.StaffAvatar,{id:e.id,size:30}),(0,B.jsx)(u.T,{weight:"semibold",children:e.name})]}),(0,B.jsx)(u.Row,{wrap:!0,gap:4,children:C.DAY3.map((t,s)=>{const n=(m[e.id]??[]).includes(s);return(0,B.jsx)(u.Chip,{label:`${t} ${n?'\u2715':'\u2713'}`,selected:!n,onPress:()=>f.useOwner.getState().toggleAvail(e.id,s)},t)})})]},e.id))]}):null,$?(0,B.jsx)(N,{init:$,onClose:()=>M(null)}):null]})},_e.ClockInOut=function(){const{now:e,today:t,role:s,meId:a,me:d,r:h,rid:m}=(0,C.useCtx)(5e3),x=((0,I.useClockArea)(e=>e.areas[m]),(0,I.areaOf)(m));const j=(0,v.privateClockVenue)(m),[k,y]=(0,l.useState)(!1),O=(0,f.useOwner)(e=>e.consent[a]),R=(0,f.useOwner)(e=>e.attendance),P=(0,f.useOwner)(e=>e.shifts),[z,H]=(0,l.useState)(!1),[A,Y]=(0,l.useState)(null),[L,F]=(0,l.useState)(null),[N,_]=(0,l.useState)(void 0),[q,K]=(0,l.useState)(null),[U,V]=(0,l.useState)(!1),[G,X]=(0,l.useState)(null),J=R.filter(t=>t.staffId===a&&t.in&&!t.out&&e.getTime()-new Date(t.in).getTime()<72e6).sort((e,t)=>t.in.localeCompare(e.in))[0],Q=J&&(0,f.isOnBreak)(J)?J.breaks[J.breaks.length-1]:void 0,Z=(0,f.visibleShifts)(P,'staff'!==s).find(e=>e.staffId===a&&e.date===t),ee='staff'!==s,te=J?(0,C.paidMins)({in:J.in},e).worked:0,se=x.on&&(0,D.areaSet)(x),ne=J?.geo?.[J.geo.length-1],ae=async(s,n={})=>{Y(s),F(null),_(void 0);const l=await(0,T.clockAction)(s,{rid:m,staffId:a,date:t,at:new Date(e.getTime()).toISOString(),...n});return Y(null),l.ok?('out'===s&&l.att&&(K(l.att),(0,i.hrSettingsOf)(h.settings?.hr).on&&!o.useHr.getState().hasAnswered(m,l.att.id)&&X(l.att)),'in'===s&&K(null),!0):(F(l.message),_(l.fix),(0,$.notify)({id:'clock-blocked',tone:'warn',icon:'\ud83d\udccd',kicker:'CLOCK',title:l.message.split('. ')[0]+'.',body:l.message.split('. ').slice(1).join('. '),timeoutMs:9e3,testID:'clock-blocked'}),!1)};return O?(0,B.jsxs)(c.default,{style:{gap:10},children:[(0,B.jsxs)(u.Card,{highlight:w.colours.gold,children:[(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsxs)(u.Row,{gap:10,style:{flex:1},children:[(0,B.jsx)(S.StaffAvatar,{id:a,size:48}),(0,B.jsx)(u.T,{weight:"semibold",style:{flex:1},children:d})]}),(0,B.jsx)(u.Badge,{kind:J?'ok':'neutral',label:J?`On shift since ${(0,b.hm)(new Date(J.in))}`:'Not clocked in'})]}),(0,B.jsx)(u.Muted,{children:Z?`Today's shift: ${(0,C.fmtH)(Z.start)}\u2013${(0,C.fmtH)(Z.end)}`:'No shift on the rota today'}),(0,B.jsx)(c.default,{testID:"clock-area-line",children:(0,B.jsx)(u.T,{size:14,colour:w.colours.muted,children:se?j?`Location is checked only when you choose Clock in, at ${h.name}. Only pass or fail is saved.`:`\ud83d\udccd Your location is checked when you tap a button. You need to be at ${h.name}.`:x.on?'\ud83d\udccd The clock-in area isn\u2019t set yet, so location isn\u2019t checked.':'\ud83d\udccd Location checks are switched off for this venue.'})}),ne&&!0===ne.inside&&null!=ne.dist?(0,B.jsxs)(u.Muted,{children:["Last check: at the venue (about ",ne.dist," m from the centre)."]}):null,J?(0,B.jsx)(u.T,{size:30,weight:"bold",center:!0,children:(0,C.hmDur)(te)}):null,J&&Q?(0,B.jsx)(c.default,{testID:"on-break",children:(0,B.jsxs)(u.T,{size:15,weight:"semibold",colour:w.colours.gold,center:!0,children:["On a break since ",(0,b.hm)(new Date(Q.start))," \xb7 ",(0,f.loggedBreakMins)(J,e)," min so far"]})}):null,J?(0,B.jsxs)(B.Fragment,{children:[Q?(0,B.jsx)(u.Button,{testID:"break-end",kind:"success",label:'break_end'===A?'Checking your location\u2026':'End break',disabled:!!A,onPress:()=>{ae('break_end')}}):(0,B.jsx)(u.Button,{testID:"break-start",kind:"secondary",label:'break_start'===A?'Checking your location\u2026':'Start break',disabled:!!A,onPress:()=>{ae('break_start')}}),(0,B.jsx)(u.Button,{testID:"clock-out",kind:"danger",label:'out'===A?'Checking your location\u2026':'Clock out',disabled:!!A,onPress:()=>{J.breaks?.length?ae('out'):(F(null),H(!0))}})]}):(0,B.jsx)(u.Button,{testID:"clock-in",kind:"success",label:'in'===A?'Checking your location\u2026':'Clock in',disabled:!!A,onPress:()=>{j?y(!0):ae('in')}}),J?.breaks?.length?(0,B.jsxs)(u.Muted,{center:!0,children:["Breaks today: ",J.breaks.map(e=>`${(0,b.hm)(new Date(e.start))}\u2013${e.end?(0,b.hm)(new Date(e.end)):'now'}`).join(', ')," (",(0,f.loggedBreakMins)(J,e)," min)"]}):null,L?(0,B.jsx)(c.default,{testID:"clock-message",children:(0,B.jsx)(u.Banner,{kind:"warn",title:"Not recorded",children:L})}):null,L&&'settings'===N?(0,B.jsx)(u.Button,{testID:"clock-open-settings",label:"Open app settings",accessibilityLabel:"Open app settings, to allow location",onPress:M.openAppSettings}):null,L&&'location'===N?(0,B.jsx)(u.Button,{testID:"clock-open-location",label:"Open location settings",accessibilityLabel:"Open location settings, to turn on location",onPress:M.openLocationSettings}):null,L&&'update'===N?(0,B.jsx)(u.Button,{testID:"clock-check-update",label:"Look for the app update",accessibilityLabel:"Look for the app update",onPress:M.checkAppUpdate}):null]}),ee&&!(0,D.areaSet)(x)?(0,B.jsx)(c.default,{testID:"clock-area-warning",children:(0,B.jsx)(u.Banner,{kind:"warn",title:"Set the clock-in area",children:"Location isn\u2019t checked until a manager sets the venue\u2019s centre. Stand at the venue and go to Settings \u203a Advanced \u203a Clock-in area \u203a Use my current location."})}):null,(0,B.jsx)(r.default,{testID:"forgot-link",accessibilityRole:"button",onPress:()=>V(!0),style:{alignSelf:'center',padding:6},children:(0,B.jsx)(u.T,{size:14,colour:w.colours.gold,children:"Forgot to clock in or out?"})}),U?(0,B.jsx)(E,{onClose:()=>V(!1)}):null,(0,B.jsx)(p.BreakRoomCard,{staffId:a,name:d,now:e}),q?(()=>{const t=(0,C.paidMins)(q,e);return(0,B.jsxs)(u.Card,{highlight:w.colours.gold,children:[(0,B.jsxs)(u.T,{weight:"semibold",colour:w.colours.gold,children:["Clocked out at ",(0,b.hm)(new Date(q.out))]}),(0,B.jsxs)(u.T,{size:18,weight:"bold",children:["Clocked ",(0,C.hmDur)(t.worked),", break ",t.brk,"m, paid ",(0,C.hmDur)(t.paid)]}),(0,B.jsxs)(u.Muted,{children:["In ",(0,b.hm)(new Date(q.in))," \xb7 out ",(0,b.hm)(new Date(q.out))," \xb7 paid hours = (out \u2212 in) \u2212 break",q.breakAddedAtClockOut?' \xb7 break added at clock-out':'']}),t.worked>360&&0===t.brk?(0,B.jsx)(u.Banner,{kind:"info",title:"A note on breaks",children:"UK workers are generally entitled to a 20-minute rest break when working more than 6 hours. Your clock-out is saved; have a word with your manager if you didn\u2019t get one."}):null]})})():null,(0,B.jsx)(u.Sheet,{visible:k,onClose:()=>y(!1),title:"Why we ask for location",testID:"clock-location-reason",children:(0,B.jsxs)(c.default,{style:{gap:12},children:[(0,B.jsxs)(u.T,{children:["We check once that you are at ",h.name,", within about ",x.radius," m, when you clock in. Only pass or fail is saved, not your position. We never track you in the background."]}),(0,B.jsx)(u.T,{children:"If you refuse or are too far away, no clock-in is made. A manager can override it with a recorded reason."}),(0,B.jsx)(u.Button,{testID:"clock-location-continue",label:"Check my location and clock in",accessibilityLabel:"Check my location once and clock in at the pub",onPress:()=>{y(!1),ae('in')}}),(0,B.jsx)(u.Button,{testID:"clock-location-cancel",kind:"secondary",label:"Not now",onPress:()=>y(!1)})]})}),ee?(0,B.jsx)(W,{rid:m,today:t,now:e}):null,G?(0,B.jsx)(n.ShiftCheckout,{rid:m,shiftKey:G.id,day:G.date,meId:a,onClose:()=>X(null)}):null,(0,B.jsx)(u.Sheet,{visible:z,onClose:()=>H(!1),title:"Did you take a break? If so, how long?",children:(0,B.jsxs)(c.default,{testID:"forgot-break-prompt",style:{gap:10},children:[(0,B.jsx)(u.Muted,{children:"No break was recorded on this shift. Pick how long it was, or No break. Your manager can change it later in Hours."}),(0,B.jsx)(u.Row,{wrap:!0,gap:6,children:x.breakOptions.map(e=>(0,B.jsx)(u.Chip,{testID:`forgot-break-${e}`,label:(0,D.breakLabel)(e),disabled:e>=te,onPress:()=>{H(!1),ae('out',{addedBreak:e})}},e))}),(0,B.jsx)(u.Button,{testID:"forgot-break-none",kind:"secondary",label:"No break",onPress:()=>{H(!1),ae('out',{breakMins:0})}}),te>360?(0,B.jsx)(u.Muted,{children:"UK workers are generally entitled to a 20-minute rest break when working more than 6 hours."}):null,(0,B.jsx)(u.Muted,{children:j?'Clock-out and breaks do not use your location.':'Tip: your location is checked when you clock out, like clocking in.'})]})})]}):(0,B.jsx)(c.default,{style:{gap:10},children:(0,B.jsxs)(u.Card,{highlight:w.colours.gold,children:[(0,B.jsx)(u.T,{weight:"semibold",colour:w.colours.gold,children:"Before you clock in: location & your privacy"}),j?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(u.T,{size:14,children:["When you choose Clock in, we ask once for your phone\u2019s location to check you are at ",h.name,", within about ",x.radius," m."]}),(0,B.jsx)(u.T,{size:14,children:"Only pass or fail is kept with your clock-in time. Your map position, accuracy and distance are not saved. No location trails, background checks, clock-out checks or break checks."})]}):(0,B.jsxs)(B.Fragment,{children:[" ",(0,B.jsxs)(u.T,{size:14,children:["CoverCharge checks your phone\u2019s location ",(0,B.jsx)(u.T,{size:14,weight:"bold",children:"only at the moment you tap Clock in, Clock out, Start break or End break"}),", to confirm you are at ",h.name," (within about ",x.radius," m)."]}),(0,B.jsx)(u.T,{size:14,children:"\u2022 Your location is never tracked continuously or in the background."}),(0,B.jsx)(u.T,{size:14,children:"\u2022 With each clock record we keep that one reading (map position and how accurate the phone said it was), whether it was inside the area, and the time."}),(0,B.jsx)(u.T,{size:14,children:"\u2022 If the app is open while you\u2019re at the venue and you\u2019re not on the rota, it may ask whether you want to clock in (only if you have already allowed location)."})]}),(0,B.jsx)(u.T,{size:14,children:"\u2022 Your employer uses this for timesheets and pay (UK GDPR lawful basis: contract / legitimate interests)."}),(0,B.jsx)(u.T,{size:14,children:"\u2022 If your phone can\u2019t share its location, a manager can record it for you instead. You can see your own records anytime."}),(0,B.jsx)(u.T,{size:14,children:"\u2022 Records are kept for payroll (6 years, HMRC) and then deleted."}),(0,B.jsx)(u.Button,{label:"I understand \u2014 continue",onPress:()=>f.useOwner.getState().giveConsent(a,e.toISOString())})]})})},_e.Timesheets=function(){const{now:e,today:t,role:s,meId:n}=(0,C.useCtx)(3e4);return s!=='staff'?(0,B.jsx)(q,{now:e,today:t,meId:n}):(0,B.jsx)(_,{})};var t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),a=_r(_d[3]),o=_r(_d[4]),i=_r(_d[5]),l=_r(_d[6]),r=e(_r(_d[7])),d=e(_r(_d[8])),c=e(_r(_d[9])),u=_r(_d[10]),h=_r(_d[11]),f=_r(_d[12]),m=_r(_d[13]),p=_r(_d[14]),x=_r(_d[15]),j=_r(_d[16]),b=_r(_d[17]),w=_r(_d[18]),k=_r(_d[19]),y=_r(_d[20]),C=_r(_d[21]),S=_r(_d[22]),I=_r(_d[23]),v=_r(_d[24]),D=_r(_d[25]),T=_r(_d[26]),$=_r(_d[27]),M=_r(_d[28]),O=_r(_d[29]),R=_r(_d[30]),P=_r(_d[31]),B=_r(_d[32]);const z=2650,H=1900,A=e=>e.end-e.start,Y=e=>e>8?.5:e>6?.3333333333333333:0,L=e=>{const t=new Date(e);return t.setHours(0,0,0,0),t.setDate(t.getDate()-(0,C.weekday)(e)),t};function F(e){const{rid:t,r:s,now:n}=(0,C.useCtx)(6e4),a=(0,h.useBookings)(t),o=(0,h.useOrders)(t),i=(0,h.useEvents)(t),r=(0,O.useRealHistory)(t,n);return(0,l.useMemo)(()=>{const t=Array.from({length:7},(t,s)=>{const n=(0,b.addMins)(e,1440*s);return n.setHours(11,0,0,0),n}),n=a.filter(e=>!e.walkIn&&'confirmed'===e.status&&t.some(t=>(0,b.ymd)(t)===e.date)).reduce((e,t)=>e+t.partySize,0),l=(0,R.clampWeeks)(s.settings.forecastMinWeeks);return r?r.salesEnough?{mode:'real',weeks:l,booked:n,sales:t.map(e=>s.kitchenHours[e.getDay()]?r.takingsByDay[e.getDay()]??0:0)}:{mode:'none',weeks:l,booked:n,sales:t.map(()=>0)}:{mode:'example',weeks:l,booked:n,sales:t.map(e=>{const t=(0,x.forecastToday)(s,a,o,i,e);return t.open?t.restOfDay.covers*z+t.restOfDay.takeaway*H:0})}},[s,a,o,i,r,(0,b.ymd)(e)])}function N({init:e,onClose:t}){const s=(0,f.useOwner)(e=>e.staff),[n,a]=(0,l.useState)(e.shift?.start??12),[o,i]=(0,l.useState)(e.shift?.end??20),[r,d]=(0,l.useState)(e.shift?.breakAt),h=void 0===r||r>n&&rt.id===e.staffId);return(0,B.jsxs)(u.Sheet,{visible:!0,onClose:t,title:(0,P.shiftTitle)(m?.name??'',e.date),testID:"shift-sheet",children:[(0,B.jsx)(u.Row,{wrap:!0,gap:6,children:[['Lunch',11,16],['Dinner',16.5,22.5],['Double',11,21],['Close',17,23.5],['Late close',18,25]].map(([e,t,s])=>(0,B.jsx)(u.Chip,{label:`${e} ${(0,C.fmtH)(t)}\u2013${(0,C.fmtH)(s)}`,selected:n===t&&o===s,onPress:()=>{a(t),i(s)}},e))}),(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsx)(u.T,{children:"Start"}),(0,B.jsx)(u.Stepper,{testID:"shift-start",value:n,step:.5,min:P.SHIFT_MIN_START,max:o-1,onChange:a,format:C.fmtH,label:"Start time"})]}),(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,B.jsx)(u.T,{children:"End"}),(0,B.jsxs)(c.default,{style:{alignItems:'flex-end'},children:[(0,B.jsx)(u.Stepper,{testID:"shift-end",value:o,step:.5,min:n+1,max:P.SHIFT_MAX_END,onChange:i,format:C.fmtH,label:"End time"}),o>=24?(0,B.jsx)(u.Muted,{children:"next day"}):null]})]}),(0,B.jsxs)(u.Muted,{children:[(o-n).toFixed(1),"h scheduled",Y(o-n)?`, ${Math.round(60*Y(o-n))}m planned break`:'']}),(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,B.jsx)(u.T,{children:void 0===r?'Break: not set':'Break at'}),void 0===r?(0,B.jsx)(u.Chip,{label:"Set a break time",onPress:()=>d(Math.min(o-.5,Math.max(n+.5,Math.round(4*(n+Math.min(4,(o-n)/2)))/4)))}):(0,B.jsxs)(u.Row,{gap:6,children:[(0,B.jsx)(u.Stepper,{testID:"shift-break",value:r,step:.25,min:n+.25,max:o-.25,onChange:d,format:C.fmtH,label:"Break time"}),(0,B.jsx)(u.Chip,{label:"No set time",onPress:()=>d(void 0)})]})]}),(0,B.jsx)(u.Muted,{children:"Tip: with a break time, the person on this shift gets a break reminder at that time. Without one, they get it 4 hours after clocking in (change this in Settings, Advanced, Reminders)."}),(0,B.jsx)(u.Button,{label:e.shift?'Save shift':'Add shift',onPress:()=>{const s=f.useOwner.getState();e.shift?s.setShifts(s.shifts.map(t=>t.id===e.shift.id?{...t,start:n,end:o,breakAt:h?r:void 0,changed:!!t.published||t.changed}:t)):s.addShift({staffId:e.staffId,date:e.date,start:n,end:o,...void 0!==r&&h?{breakAt:r}:{}}),t()}}),(0,B.jsx)(u.Muted,{children:e.shift?.published?'Published: the change shows in the Staff app straight away and is marked as changed until you publish the week again.':'Draft: staff see it once you publish the week.'}),e.shift?(0,B.jsx)(u.Button,{kind:"danger",label:"Remove shift",onPress:()=>{f.useOwner.getState().removeShift(e.shift.id),t()}}):null]})}function W({rid:e,today:t,now:s}){const n=(0,f.useOwner)(e=>e.staff).filter(e=>e.active),a=(0,f.useOwner)(e=>e.attendance),o=(0,C.useSignedIn)(),{me:i,meId:r}=(0,C.useCtx)(3e4),[d,c]=(0,l.useState)(null),[h,m]=(0,l.useState)(''),[p,x]=(0,l.useState)(null),j=d?a.filter(e=>e.staffId===d&&e.in&&!e.out&&s.getTime()-new Date(e.in).getTime()<72e6)[0]:void 0,b=!!j&&(0,f.isOnBreak)(j),k=s=>{if(!d)return;const a=(0,T.managerClockAction)(s,{rid:e,staffId:d,date:t,at:(new Date).toISOString()},{id:o?.id??r,name:o?.name??i},h);if(!a.ok)return void x(a.message);const l=n.find(e=>e.id===d)?.name??'them';(0,$.notify)({id:'mgr-clock',title:`Recorded for ${l}`,body:`Reason kept with the record: ${h.trim()}`,timeoutMs:6e3}),m(''),x(null)};return(0,B.jsxs)(u.Card,{children:[(0,B.jsx)(u.T,{weight:"semibold",children:"Record it for someone"}),(0,B.jsx)(u.Muted,{children:"If someone\u2019s phone can\u2019t share its location, you can clock them in or out, or start or end their break. No location check; your reason is kept with the record."}),(0,B.jsx)(u.Row,{wrap:!0,gap:6,children:n.map(e=>(0,B.jsx)(u.Chip,{label:e.name,selected:d===e.id,onPress:()=>c(e.id)},e.id))}),d?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(u.Field,{label:"Reason (kept with the record)",value:h,onChangeText:m,placeholder:"e.g. Phone out of battery"}),(0,B.jsx)(u.Row,{wrap:!0,gap:6,children:j?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(u.Button,{kind:"secondary",label:b?'End their break':'Start their break',onPress:()=>k(b?'break_end':'break_start')}),(0,B.jsx)(u.Button,{kind:"secondary",label:"Clock them out",onPress:()=>k('out')})]}):(0,B.jsx)(u.Button,{testID:"mgr-clock-in",kind:"secondary",label:"Clock them in",onPress:()=>k('in')})}),p?(0,B.jsx)(u.T,{size:13,colour:w.colours.red,children:p}):null]}):null]})}function E({onClose:e}){const{now:t,today:s,meId:n}=(0,C.useCtx)(3e4),a=(0,f.useOwner)(e=>e.attendance),o=(0,f.useOwner)(e=>e.shifts),i=Array.from({length:7},(e,t)=>(0,b.ymd)((0,b.addMins)((0,b.parseYmd)(s),1440*-t))),[r,d]=(0,l.useState)(s),c=a.filter(e=>e.staffId===n&&e.date===r&&e.in).sort((e,t)=>t.in.localeCompare(e.in))[0],h=(0,f.visibleShifts)(o,!1).find(e=>e.staffId===n&&e.date===r),[p,x]=(0,l.useState)(c&&!c.out?'out':'in'),[j,k]=(0,l.useState)(h?Math.round(60*h.start):720),[y,S]=(0,l.useState)(h?Math.round(60*h.end):1200),[I,v]=(0,l.useState)(''),[D,T]=(0,l.useState)(!1),$=e=>`${String(Math.floor(e%1440/60)).padStart(2,'0')}:${String(e%60).padStart(2,'0')}`,M='out'!==p,O='in'!==p,R=M&&O&&y<=j,P=(e,t)=>(0,B.jsx)(u.Row,{gap:4,children:[-15,-5,5,15].map(s=>(0,B.jsx)(u.Button,{small:!0,kind:"ghost",label:s>0?`+${s}`:`${s}`,onPress:()=>e(Math.max(0,Math.min(2160,t+s)))},s))});return D?(0,B.jsxs)(u.Sheet,{visible:!0,onClose:e,title:"Request sent",children:[(0,B.jsx)(u.Banner,{kind:"success",title:"Sent to your manager",children:"They\u2019ll see it on the sign-off screen and fix the time. You\u2019ll see the change on your timesheet. Nothing is sent by text or email."}),(0,B.jsx)(u.Button,{label:"Done",onPress:e})]}):(0,B.jsxs)(u.Sheet,{visible:!0,onClose:e,title:"I forgot to clock in or out",testID:"request-sheet",children:[(0,B.jsx)(u.Muted,{children:"Pick the day and suggest the right time. Your manager checks it before it counts."}),(0,B.jsx)(u.Row,{wrap:!0,gap:6,children:i.map(e=>(0,B.jsx)(u.Chip,{label:e===s?'Today':(0,b.niceDate)((0,b.parseYmd)(e)).slice(0,10),selected:r===e,onPress:()=>d(e)},e))}),(0,B.jsxs)(u.Muted,{children:[h?`Your rota that day: ${(0,C.fmtH)(h.start)}\u2013${(0,C.fmtH)(h.end)}`:'Not on the rota that day',c?` \xb7 clocked ${(0,b.hm)(new Date(c.in))}\u2013${c.out?(0,b.hm)(new Date(c.out)):'no clock-out'}`:' \xb7 no clock record']}),(0,B.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,B.jsx)(u.Chip,{label:"Forgot to clock in",selected:'in'===p,onPress:()=>x('in')}),(0,B.jsx)(u.Chip,{label:"Forgot to clock out",selected:'out'===p,onPress:()=>x('out')}),(0,B.jsx)(u.Chip,{label:"Forgot both",selected:'both'===p,onPress:()=>x('both')})]}),M?(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsxs)(u.T,{size:18,weight:"bold",children:["In ",$(j)]}),P(k,j)]}):null,O?(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsxs)(u.T,{size:18,weight:"bold",children:["Out ",$(y),y>=1440?' (next day)':'']}),P(S,y)]}):null,R?(0,B.jsx)(u.T,{size:13,colour:w.colours.red,children:"Clock-out must be after clock-in."}):null,(0,B.jsx)(u.Field,{label:"Note for your manager (optional)",value:I,onChangeText:v,placeholder:"e.g. phone died",maxLength:200}),(0,B.jsx)(u.Button,{testID:"request-send",kind:"success",label:"Send to my manager",disabled:R,onPress:()=>{f.useOwner.getState().addTimeRequest({staffId:n,date:r,attendanceId:c?.id,kind:p,suggestedIn:M?(0,m.isoAt)(r,j):void 0,suggestedOut:O?(0,m.isoAt)(r,y):void 0,note:I.trim(),at:t.toISOString()}),T(!0)}})]})}function _(){const{now:e,today:t,meId:s}=(0,C.useCtx)(3e4),n=(0,f.useOwner)(e=>e.attendance),a=(0,f.useOwner)(e=>e.shifts),o=(0,f.useOwner)(e=>e.timeRequests),[i,r]=(0,l.useState)(!1),[d,h]=(0,l.useState)(null),p=(0,b.ymd)(L(e)),x=n.filter(e=>e.staffId===s&&e.in&&e.date>=(0,b.ymd)((0,b.addMins)((0,b.parseYmd)(t),-38880))).sort((e,t)=>t.date.localeCompare(e.date)||t.in.localeCompare(e.in)),j=x.filter(e=>e.date>=p),y=j.filter(f.isConfirmed).reduce((t,s)=>t+(0,C.paidMins)(s,e).paid,0),S=j.filter(e=>!(0,f.isConfirmed)(e)).reduce((t,s)=>t+(0,C.paidMins)(s,e).paid,0),I=o.filter(e=>e.staffId===s).sort((e,t)=>t.at.localeCompare(e.at)).slice(0,6);return(0,B.jsxs)(c.default,{style:{gap:10},testID:"my-timesheet",children:[(0,B.jsxs)(u.Card,{children:[(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between',alignItems:'flex-end'},children:[(0,B.jsxs)(c.default,{children:[(0,B.jsx)(u.T,{size:12,colour:w.colours.muted,children:"CONFIRMED THIS WEEK"}),(0,B.jsx)(u.T,{size:28,weight:"bold",colour:w.colours.ok,children:(0,C.hmDur)(y)})]}),(0,B.jsxs)(c.default,{style:{alignItems:'flex-end'},children:[(0,B.jsx)(u.T,{size:12,colour:w.colours.muted,children:"PENDING SIGN-OFF"}),(0,B.jsx)(u.T,{size:18,weight:"semibold",colour:S?w.colours.amber:w.colours.muted,children:(0,C.hmDur)(S)})]})]}),(0,B.jsx)(u.Muted,{children:"Your manager signs off your hours. Only confirmed hours count for pay. You can\u2019t change your own times; ask for a correction instead."})]}),(0,B.jsx)(u.Button,{testID:"forgot-clock",kind:"secondary",label:"I forgot to clock in or out",onPress:()=>r(!0)}),I.length?(0,B.jsx)(k.SectionHead,{title:"My correction requests"}):null,I.map(e=>(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between',paddingVertical:4},children:[(0,B.jsxs)(c.default,{style:{flex:1},children:[(0,B.jsxs)(u.T,{size:14,children:[(0,b.niceDate)((0,b.parseYmd)(e.date))," \xb7 ",'in'===e.kind?'Forgot to clock in':'out'===e.kind?'Forgot to clock out':'Forgot both']}),(0,B.jsxs)(u.Muted,{children:[e.suggestedIn?`in ${(0,b.hm)(new Date(e.suggestedIn))} `:'',e.suggestedOut?`out ${(0,b.hm)(new Date(e.suggestedOut))}`:'',e.resolvedBy?` \xb7 ${'applied'===e.status?'applied':'declined'} by ${e.resolvedBy.replace(' (example)','')}`:'']})]}),(0,B.jsx)(u.Badge,{kind:'open'===e.status?'blue':'applied'===e.status?'ok':'neutral',label:'open'===e.status?'Waiting':'applied'===e.status?'Applied':'Declined'})]},e.id)),(0,B.jsx)(k.SectionHead,{title:"My shifts",sub:"Last 4 weeks"}),x.map(t=>{const s=(0,f.shiftOf)((0,f.visibleShifts)(a,!1),t.staffId,t.date),n=(0,C.paidMins)(t,e),o=t.audit?.filter(e=>'confirmed'!==e.action).slice(-1)[0];return(0,B.jsxs)(u.Card,{onPress:()=>h(d===t.id?null:t.id),children:[(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsxs)(c.default,{style:{flex:1},children:[(0,B.jsx)(u.T,{weight:"semibold",children:(0,b.niceDate)((0,b.parseYmd)(t.date))}),(0,B.jsxs)(u.Muted,{children:[(0,b.hm)(new Date(t.in)),"\u2013",t.out?(0,b.hm)(new Date(t.out)):'on now',t.out?` \xb7 ${n.brk}m break \xb7 ${(0,C.hmDur)(n.paid)} paid`:'',s?` \xb7 rota ${(0,C.fmtH)(s.start)}\u2013${(0,C.fmtH)(s.end)}`:'']})]}),(0,B.jsx)(u.Badge,{kind:(0,m.statusKind)(t),label:'awaiting'===(0,f.attStatus)(t)?t.adjusted?'Adjusted \xb7 pending':'Pending':(0,m.statusLabel)(t)})]}),o?(0,B.jsxs)(u.T,{size:13,colour:w.colours.gold,children:["Adjusted by ",o.by.replace(' (example)',''),o.reason?`: ${o.reason}`:'']}):null,t.signOff?(0,B.jsxs)(u.Muted,{children:["Confirmed by ",t.signOff.by.replace(' (example)','')]}):null,d===t.id?(0,B.jsx)(m.AuditTrail,{a:t}):null]},t.id)}),x.length?null:(0,B.jsx)(u.Muted,{children:"No clocked shifts yet."}),i?(0,B.jsx)(E,{onClose:()=>r(!1)}):null]})}function q({now:e,today:s}){const n=(0,f.useOwner)(e=>e.staff),o=(0,f.useOwner)(e=>e.shifts),i=(0,C.useHourly)(),d=(0,f.useOwner)(e=>e.attendance),h=(0,f.useOwner)(e=>e.timeRequests),p=(0,f.useOwner)(e=>e.attLog),[x,y]=(0,l.useState)(s),[I,v]=(0,l.useState)(null),[D,T]=(0,l.useState)(!1),$=!!(0,C.useSignedIn)(),M=Array.from({length:7},(e,t)=>(0,b.ymd)((0,b.addMins)((0,b.parseYmd)(s),1440*-t))),O=d.filter(e=>e.date===x&&e.in),R=o.filter(e=>e.date===x&&!1!==e.published).filter(e=>!O.some(t=>t.staffId===e.staffId)),P=d.filter(e=>M.includes(e.date)&&e.out),z=P.filter(f.isConfirmed),H=z.reduce((t,s)=>t+(0,C.paidMins)(s,e).paid,0),A=P.filter(e=>!(0,f.isConfirmed)(e)).reduce((t,s)=>t+(0,C.paidMins)(s,e).paid,0),Y=z.reduce((t,s)=>t+(0,C.paidMins)(s,e).paid/60*(i[s.staffId]??0),0),L=['Staff,Date,Rostered,In,Out,Break (min),Paid hours,Rate,Pay,Status,Confirmed by,Tax note'].concat(z.sort((e,t)=>e.date.localeCompare(t.date)).map(t=>{const s=n.find(e=>e.id===t.staffId),a=(0,f.shiftOf)(o,t.staffId,t.date),l=(0,C.paidMins)(t,e),r=i[t.staffId]??0;return`${s?.name},${t.date},${a?`${(0,C.fmtH)(a.start)}-${(0,C.fmtH)(a.end)}`:'-'},${(0,b.hm)(new Date(t.in))},${(0,b.hm)(new Date(t.out))},${l.brk},${(l.paid/60).toFixed(2)},${(r/100).toFixed(2)},${(l.paid/60*r/100).toFixed(2)},${t.adjusted?'Confirmed (adjusted)':'Confirmed'},${t.signOff?.by??''},${s?.salaried?'Owner, no hourly wage':null==i[t.staffId]?'Rate not set':s?.noTax&&$?'No tax deducted':''}`}));return(0,B.jsxs)(c.default,{style:{gap:10},children:[(0,B.jsx)(u.Row,{wrap:!0,gap:6,children:M.map(e=>(0,B.jsx)(u.Chip,{label:e===s?'Today':(0,b.niceDate)((0,b.parseYmd)(e)).slice(0,6),selected:x===e,onPress:()=>y(e)},e))}),(0,B.jsxs)(u.Card,{children:[(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsx)(u.T,{weight:"semibold",children:"Last 7 days"}),(0,B.jsx)(u.Badge,{kind:"ok",label:`${(0,C.hmDur)(H)} confirmed`})]}),A?(0,B.jsxs)(u.T,{size:13,colour:w.colours.amber,children:[(0,C.hmDur)(A)," pending sign-off (not counted yet)"]}):null,(0,B.jsxs)(u.Muted,{children:["Labour cost ",(0,j.gbp)(Math.round(Y))," from confirmed hours (paid hours \xd7 hourly rates; owner salaries excluded). Sign off in Team \u203a Sign off hours."]})]}),(0,B.jsx)(a.WideTable,{children:(0,B.jsxs)(c.default,{style:{gap:2},children:[(0,B.jsx)(a.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:w.colours.border,paddingBottom:4},children:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''].map((e,t)=>(0,B.jsx)(u.T,{size:12,weight:"semibold",colour:w.colours.gold,style:{width:[110,86,52,52,52,74,120,140,50][t]},children:e},e+t))}),O.map(t=>{const i=n.find(e=>e.id===t.staffId),l=(0,f.shiftOf)(o,t.staffId,x),d=(0,C.paidMins)(t,e),c=(0,m.flagsFor)(t,l,e,s,h).map(e=>e.label);return(0,B.jsxs)(a.TRow,{heads:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,B.jsxs)(u.Row,{gap:4,style:{width:110},children:[(0,B.jsx)(S.StaffAvatar,{id:t.staffId,size:20,ring:!1}),(0,B.jsx)(u.T,{size:12,style:{flex:1},numberOfLines:1,children:i?.name.replace(' (example)','')})]}),(0,B.jsx)(u.T,{size:12,style:{width:86},colour:w.colours.muted,children:l?`${(0,C.fmtH)(l.start)}\u2013${(0,C.fmtH)(l.end)}`:'\u2013'}),(0,B.jsx)(u.T,{size:12,style:{width:52},children:(0,b.hm)(new Date(t.in))}),(0,B.jsx)(u.T,{size:12,style:{width:52},children:t.out?(0,b.hm)(new Date(t.out)):'on'}),(0,B.jsx)(u.T,{size:12,style:{width:52},children:t.out?`${d.brk}m`:'\u2013'}),(0,B.jsx)(u.T,{size:12,weight:"semibold",style:{width:74},children:t.out?(0,C.hmDur)(d.paid):`${(0,C.hmDur)(d.worked)}\u2026`}),(0,B.jsx)(u.T,{size:11,style:{width:120},colour:'confirmed'===(0,f.attStatus)(t)?w.colours.ok:'open'===(0,f.attStatus)(t)?w.colours.blue:w.colours.amber,children:(0,m.statusLabel)(t)}),(0,B.jsx)(u.T,{size:11,style:{width:140},colour:c.length?w.colours.amber:w.colours.ok,children:c.join(', ')||'OK'}),(0,B.jsx)(r.default,{accessibilityRole:"button",accessibilityLabel:`Edit ${i?.name}`,onPress:()=>v(t),style:{width:50,minHeight:44,justifyContent:'center'},children:(0,B.jsx)(u.T,{size:12,colour:w.colours.gold,children:"Edit"})})]},t.id)}),R.map(t=>(0,B.jsxs)(a.TRow,{heads:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''],style:{paddingVertical:6},children:[(0,B.jsx)(u.T,{size:12,style:{width:110},children:n.find(e=>e.id===t.staffId)?.name.replace(' (example)','')}),(0,B.jsxs)(u.T,{size:12,style:{width:86},colour:w.colours.muted,children:[(0,C.fmtH)(t.start),"\u2013",(0,C.fmtH)(t.end)]}),(0,B.jsx)(u.T,{size:12,colour:x===s&&60*t.start>60*e.getHours()+e.getMinutes()?w.colours.muted:w.colours.red,children:x===s&&60*t.start>60*e.getHours()+e.getMinutes()?'Not started yet':'No clock-in'})]},t.id))]})}),O.length||R.length?null:(0,B.jsx)(u.Muted,{children:"No shifts or clock records for this day."}),(0,B.jsx)(u.Muted,{children:"Paid hours = (clock-out \u2212 clock-in) \u2212 break. Only confirmed hours count for pay, tips and the export."}),(0,B.jsx)(u.Button,{kind:"secondary",label:"Payroll export (CSV preview)",onPress:()=>T(!0)}),(0,B.jsx)(k.SectionHead,{title:"Audit log",sub:"Every manual change and sign-off"}),p.length?p.slice(0,12).map(e=>(0,B.jsxs)(u.Muted,{children:[(0,b.niceDate)(new Date(e.at))," ",(0,b.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,B.jsx)(u.Muted,{children:"No manual changes yet."}),I?(0,B.jsx)(m.OverrideSheet,{a:I,staffId:I.staffId,date:I.date,onClose:()=>v(null)}):null,(0,B.jsxs)(u.Sheet,{visible:D,onClose:()=>T(!1),title:"Payroll export",children:[(0,B.jsxs)(u.Banner,{kind:"demo",title:"Preview: nothing is sent",children:["Confirmed hours only. ",A?`${(0,C.hmDur)(A)} still pending sign-off is left out.`:'']}),(0,B.jsxs)(c.default,{style:{backgroundColor:(0,t.soutersSurface)('#111'),borderRadius:8,padding:8},children:[L.slice(0,14).map((e,t)=>(0,B.jsx)(u.T,{size:10,colour:t?w.colours.text:w.colours.gold,children:e},t)),L.length>14?(0,B.jsxs)(u.Muted,{children:["\u2026 ",L.length-14," more rows"]}):null]}),(0,B.jsxs)(u.Muted,{children:[L.length-1," confirmed rows \xb7 paid hours (after breaks)."]})]})]})}},1010,[868,877,999,1317,1118,1119,30,263,151,127,813,819,856,1323,1030,870,816,818,821,1019,1000,927,953,1177,989,954,1266,947,1267,1284,1282,1031,24]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"category",{enumerable:!0,get:function(){return C}}),_e.allocate=S,_e.Tips=function({go:e}={}){const{rid:w,now:M,today:v,role:$,meId:P,me:B}=(0,x.useCtx)(6e4),I=(0,a.useOwner)(e=>e.staff),R=(0,a.useOwner)(e=>e.attendance),A=(0,a.useOwner)(e=>e.shifts),F=(0,a.useOwner)(e=>e.tronc),D=(0,a.useOwner)(e=>e.troncCash),E=(0,a.useOwner)(e=>e.troncHistory),z=(0,a.useOwner)(e=>e.troncLog),L=(0,d.useOrders)(w),q=(0,f.useVenuePay)(w).pay,[V,N]=(0,n.useState)(-1),[H,_]=(0,n.useState)(''),[Y,K]=(0,n.useState)(!1),[W,U]=(0,n.useState)(!1),[G,Q]=(0,n.useState)(F.text),[J,X]=(0,n.useState)(null),Z='staff'!==$,ee='owner'===$,{s:te,e:se,key:oe}=(0,f.venueRange)(q,'tips',V,M),ne=`${(0,u.niceDate)(te)} \u2013 ${(0,u.niceDate)(se)} ${se.getFullYear()}`,ie=E.find(e=>e.key===oe),re=e=>a.useOwner.getState().setOwner({tronc:{...F,...e}}),le=(0,j.useSync)(e=>!!e.venueId&&'guest'!==e.kind),de=Math.round((se.getTime()-te.getTime())/864e5)+1,ae=(0,n.useMemo)(()=>{let e=L.filter(e=>e.createdAt.slice(0,10)>=(0,u.ymd)(te)&&e.createdAt.slice(0,10)<=(0,u.ymd)(se)).reduce((e,t)=>e+(t.tip??0),0);if(!o.LIVE_VENUE_BUILD&&!le)for(let t=0;tM)break;const o=(0,x.weekday)(s);0!==o&&1!==o&&(e+=Math.round(6e3+9e3*(0,y.hash)((0,u.ymd)(s)+'tip')))}return e},[oe,L.length,le]),ce=D[oe]??0,ue=ie?ie.pot:ae+ce,he=(0,n.useMemo)(()=>{const e={};for(let t=0;tv)break;const o=(0,u.ymd)(s);I.forEach(t=>{const s=R.filter(e=>e.staffId===t.id&&e.date===o&&e.out),n=s.filter(a.isConfirmed).reduce((e,t)=>e+(0,x.paidMins)(t,M).paid,0),i=s.filter(e=>!(0,a.isConfirmed)(e)).reduce((e,t)=>e+(0,x.paidMins)(t,M).paid,0);(n||i)&&(e[t.id]={paid:(e[t.id]?.paid??0)+n,est:(e[t.id]?.est??!1)||i>0})})}return e},[oe,R.length,A.length,I.length]),pe=I.filter(e=>e.active&&('staff'===e.role||'manager'===e.role&&F.includeManagers||'owner'===e.role&&F.includeOwner)),me=(0,n.useMemo)(()=>{if(ie)return ie.rows;const e=pe.map(e=>{const t=(he[e.id]?.paid??0)/60,s=F.points[C(e)]??1;return'hours'===F.method?t:'points'===F.method?t*s:'equal'===F.method?t>0?1:0:F.custom[e.id]??0}),{amounts:t}=S(ue,e),s=e.reduce((e,t)=>e+t,0);return pe.map((o,n)=>({staffId:o.id,hours:(he[o.id]?.paid??0)/60,points:F.points[C(o)]??1,pct:s?e[n]/s*100:0,amount:t[n]}))},[ie,pe.map(e=>e.id).join(),he,F,ue]),ge=me.reduce((e,t)=>e+t.amount,0),xe=ie?0:(()=>{const e=me.map(e=>e.pct);return S(ue,e).remainder})(),fe=Object.entries(F.custom).filter(([e])=>pe.some(t=>t.id===e)).reduce((e,[,t])=>e+t,0),ye='custom'===F.method&&Math.abs(fe-100)>.01,je=new Date(se.getFullYear(),se.getMonth()+2,0),we=[...E].sort((e,t)=>t.end.localeCompare(e.end))[0],be=0!==E.length&&(0,u.parseYmd)(we.end)<(0,u.addMins)(M,-89280),Te=['Staff,Category,Paid hours,Points,Share %,Amount \xa3'].concat(me.map(e=>{const t=I.find(t=>t.id===e.staffId);return`${k(t.name)},${C(t)},${e.hours.toFixed(2)},${e.points},${e.pct.toFixed(2)},${(e.amount/100).toFixed(2)}`}),[`TOTAL,,,,100.00,${(ge/100).toFixed(2)}`]);return Z?(0,b.jsxs)(r.default,{style:{gap:10},children:[(0,b.jsxs)(l.Card,{highlight:h.colours.gold,children:[(0,b.jsx)(l.T,{weight:"semibold",children:"Quick split: Tips day"}),(0,b.jsx)(l.Muted,{children:"Enter the total and it's shared by confirmed hours for the fortnight, to the penny. Tips periods follow your pay dates (Settings \u203a Pay & tips)."}),(0,b.jsxs)(l.Row,{wrap:!0,gap:6,children:[(0,b.jsx)(l.Button,{small:!0,kind:"success",label:"Open Tips day",onPress:()=>e?.('more','tipsday')}),(0,b.jsx)(l.Button,{small:!0,kind:"ghost",label:"Pay & tips settings",onPress:()=>e?.('more','paysettings')})]})]}),(0,b.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(l.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",onPress:()=>N(V-1)}),(0,b.jsxs)(r.default,{style:{alignItems:'center',flex:1},children:[(0,b.jsx)(l.T,{weight:"semibold",children:ne}),ie?(0,b.jsx)(l.Badge,{kind:"ok",label:`Approved & locked ${ie.lockedAt}`}):V>=0?(0,b.jsx)(l.Badge,{kind:"amber",label:"Period in progress"}):(0,b.jsx)(l.Badge,{kind:"neutral",label:"Not yet approved"})]}),(0,b.jsx)(l.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:V>=0,onPress:()=>N(V+1)})]}),(0,b.jsxs)(l.Card,{children:[(0,b.jsx)(l.T,{weight:"semibold",children:"Tip pot"}),(0,b.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(l.T,{children:"Card tips on orders"}),(0,b.jsx)(l.T,{children:(0,c.gbp)(ie?ie.card:ae)})]}),(0,b.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(l.T,{children:"Cash tips"}),(0,b.jsx)(l.T,{children:(0,c.gbp)(ie?ie.cash:ce)})]}),ie?null:(0,b.jsxs)(l.Row,{gap:6,children:[(0,b.jsx)(s.TextInput,{accessibilityLabel:"Cash tips \xa3",placeholder:"Cash tips \xa3",placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",value:H,onChangeText:_,style:[l.styles.input,{flex:1}]}),(0,b.jsx)(l.Button,{small:!0,kind:"secondary",label:"Set cash",disabled:!(Number(H)>=0)||''===H.trim(),onPress:()=>{a.useOwner.getState().setOwner({troncCash:{...D,[oe]:Math.round(100*Number(H))}}),_('')}})]}),(0,b.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(l.T,{weight:"bold",children:"Total pot"}),(0,b.jsx)(l.T,{size:20,weight:"bold",colour:h.colours.gold,children:(0,c.gbp)(ue)})]}),(0,b.jsx)(l.Muted,{children:le?'Card tips are the tips taken on orders in CoverCharge. Add cash tips above.':'Card tips are the tips on orders saved on this device (not connected to your venue yet).'})]}),ie?(0,b.jsxs)(l.Muted,{children:["Locked with method: ",T[ie.method],"."]}):(0,b.jsxs)(l.Card,{children:[(0,b.jsx)(l.T,{weight:"semibold",children:"Split method (venue policy)"}),(0,b.jsx)(l.Row,{wrap:!0,gap:6,children:Object.keys(T).map(e=>(0,b.jsx)(l.Chip,{label:T[e],selected:F.method===e,onPress:()=>ee&&re({method:e})},e))}),ee?null:(0,b.jsx)(l.Muted,{children:"Only the owner can change the policy."}),'points'===F.method?Object.entries(F.points).map(([e,t])=>(0,b.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(l.T,{children:e}),(0,b.jsx)(l.Row,{gap:6,children:(0,b.jsx)(l.Stepper,{value:t,step:.1,min:0,max:2,onChange:t=>ee&&re({points:{...F.points,[e]:Math.round(10*t)/10}}),format:e=>e.toFixed(1),label:`${e} points`})})]},e)):null,'custom'===F.method?(0,b.jsxs)(b.Fragment,{children:[pe.map(e=>(0,b.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(l.T,{style:{flex:1},children:k(e.name)}),(0,b.jsx)(s.TextInput,{accessibilityLabel:`${e.name} percent`,keyboardType:"decimal-pad",defaultValue:String(F.custom[e.id]??''),placeholder:"%",placeholderTextColor:"#7D776C",onEndEditing:t=>re({custom:{...F.custom,[e.id]:Number(t.nativeEvent.text)||0}}),onBlur:t=>{const s=Number(t?.target?.value??t?.nativeEvent?.text);Number.isFinite(s)&&re({custom:{...a.useOwner.getState().tronc.custom,[e.id]:s}})},style:[l.styles.input,{width:80,paddingVertical:4}]})]},e.id)),(0,b.jsxs)(l.T,{size:13,colour:ye?h.colours.red:h.colours.ok,children:["Total ",fe.toFixed(1),"%",ye?' (must be 100%)':' \u2713']})]}):null,(0,b.jsx)(l.Toggle,{label:"Include managers",value:F.includeManagers,onChange:e=>ee&&re({includeManagers:e})}),(0,b.jsx)(l.Toggle,{label:"Include owner",value:F.includeOwner,onChange:e=>ee&&re({includeOwner:e})}),F.includeOwner?(0,b.jsx)(l.Banner,{kind:"warn",title:"Owner included",children:"Employers must not keep tips. An owner may only share in tips for qualifying work they personally do; check the statutory Code of Practice before including yourself."}):null]}),(0,b.jsx)(i.default,{horizontal:!0,children:(0,b.jsxs)(r.default,{children:[(0,b.jsx)(l.Row,{gap:0,style:{borderBottomWidth:1,borderColor:h.colours.border,paddingBottom:4},children:['Staff','Paid hrs','Points','Share','Amount'].map((e,t)=>(0,b.jsx)(l.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{width:[130,70,54,64,80][t]},children:e},e))}),me.map(e=>{const t=I.find(t=>t.id===e.staffId);return(0,b.jsxs)(l.Row,{gap:0,style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,b.jsxs)(l.T,{size:13,style:{width:130},numberOfLines:1,children:[k(t?.name),he[e.staffId]?.est&&!ie?'*':'']}),(0,b.jsx)(l.T,{size:13,style:{width:70},children:e.hours.toFixed(2)}),(0,b.jsx)(l.T,{size:13,style:{width:54},children:'points'===F.method||'points'===ie?.method?e.points.toFixed(1):'\u2013'}),(0,b.jsxs)(l.T,{size:13,style:{width:64},children:[e.pct.toFixed(1),"%"]}),(0,b.jsx)(l.T,{size:13,weight:"semibold",style:{width:80},children:(0,c.gbp)(e.amount)})]},e.staffId)}),(0,b.jsxs)(l.Row,{gap:0,style:{paddingVertical:6},children:[(0,b.jsx)(l.T,{size:13,weight:"bold",style:{width:318},children:"Total"}),(0,b.jsx)(l.T,{size:13,weight:"bold",colour:ge===ue?h.colours.ok:h.colours.red,style:{width:80},children:(0,c.gbp)(ge)})]})]})}),(0,b.jsxs)(l.Muted,{children:[ge===ue?`\u2713 Total equals the pot (${(0,c.gbp)(ue)}).`:'\u2717 Total does not equal the pot.',xe?` Rounding: ${xe}p left after rounding down went to the largest fractions, 1p each.`:''," * has hours still awaiting sign-off, which don\u2019t count until a manager confirms them. Paid hours already exclude breaks."]}),ie?null:(0,b.jsx)(l.Button,{label:"Approve & lock period",disabled:!ee||V>=0||ye||ge!==ue||ue<=0,onPress:()=>{const e=`${(0,u.niceDate)(M)} ${M.toTimeString().slice(0,5)}`,t={id:`tp-${oe}`,key:oe,label:ne,end:(0,u.ymd)(se),pot:ue,card:ae,cash:ce,method:F.method,rows:me,lockedAt:e,by:B};a.useOwner.getState().setOwner({troncHistory:[t,...E],troncLog:[{id:`tl-${Date.now()}`,at:M.toISOString(),text:`${B} approved & locked tips for ${ne}: ${(0,c.gbp)(ue)} split ${T[F.method].toLowerCase()} between ${me.filter(e=>e.amount>0).length} staff`},...z]})}}),!ie&&V>=0?(0,b.jsx)(l.Muted,{center:!0,children:"The current period can be approved once it has ended."}):null,ee||ie?null:(0,b.jsx)(l.Muted,{center:!0,children:"Only the owner can approve tips."}),(0,b.jsxs)(l.Row,{wrap:!0,gap:6,children:[(0,b.jsx)(l.Button,{small:!0,kind:"secondary",label:"Export CSV / PDF summary",onPress:()=>K(!0)}),ie?(0,b.jsx)(l.Button,{small:!0,kind:"secondary",label:ie.shared?'Shared \u2713':'Share with staff (chat)',disabled:!!ie.shared,onPress:()=>{(0,p.autoPost)('all',`Tips for ${ne} approved: ${(0,c.gbp)(ie.pot)} shared between ${ie.rows.filter(e=>e.amount>0).length} staff. See your own share in Team \u203a Tips.`),a.useOwner.getState().setOwner({troncHistory:E.map(e=>e.id===ie.id?{...e,shared:(0,u.niceDate)(M)}:e)}),X('Posted to All staff chat. Demo, nothing is sent.')}}):null]}),J?(0,b.jsx)(l.Banner,{kind:"demo",title:J}):null,(0,b.jsx)(m.SectionHead,{title:"Compliance checklist",sub:"Employment (Allocation of Tips) Act 2023, in force since 1 Oct 2024. Summary only, not legal advice."}),(0,b.jsxs)(l.Card,{children:[[[!0,'100% of qualifying tips passed to workers, no deductions',`Pot ${(0,c.gbp)(ue)} = allocated ${(0,c.gbp)(ge)}`],[F.text.trim().length>40,'Written tipping policy, available to staff','Stored in the app (template below)'],[!be,'Tips allocated by the end of the following month',`This period: by ${(0,u.niceDate)(je)} ${je.getFullYear()}`],[!0,'Tip records kept for 3 years',`${E.length} approved period(s) in the history`],[!0,'Staff can request their tip records',`${z.filter(e=>/requested/.test(e.text)).length} request(s) logged`]].map(([e,t,s])=>(0,b.jsxs)(l.Row,{style:{alignItems:'flex-start'},children:[(0,b.jsx)(l.T,{colour:e?h.colours.ok:h.colours.red,children:e?'\u2713':'\u2717'}),(0,b.jsxs)(r.default,{style:{flex:1},children:[(0,b.jsx)(l.T,{size:14,children:t}),(0,b.jsx)(l.Muted,{children:s})]})]},String(t))),(0,b.jsx)(l.Button,{small:!0,kind:"ghost",label:"View / edit tipping policy",onPress:()=>{Q(F.text),U(!0)}})]}),(0,b.jsx)(m.SectionHead,{title:"Tip history & audit log"}),E.map(e=>(0,b.jsxs)(l.Card,{children:[(0,b.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(l.T,{weight:"semibold",children:e.label}),(0,b.jsx)(l.T,{weight:"bold",children:(0,c.gbp)(e.pot)})]}),(0,b.jsxs)(l.Muted,{children:[T[e.method]," \xb7 ",e.rows.filter(e=>e.amount>0).length," staff \xb7 locked ",e.lockedAt," by ",e.by,e.shared?` \xb7 shared ${e.shared}`:'']})]},e.id)),z.map(e=>(0,b.jsxs)(l.Muted,{children:[(0,u.niceDate)(new Date(e.at))," \xb7 ",e.text]},e.id)),E.length||z.length?null:(0,b.jsx)(l.Muted,{children:"No approved periods yet."}),(0,b.jsxs)(l.Sheet,{visible:Y,onClose:()=>K(!1),title:"Tips summary export",children:[(0,b.jsx)(l.Banner,{kind:"demo",title:"Payroll export: not set up yet",children:"Nothing is sent. This will download a CSV or PDF payslip summary for payroll."}),(0,b.jsx)(r.default,{style:{backgroundColor:(0,t.soutersSurface)('#111'),borderRadius:8,padding:8},children:Te.map((e,t)=>(0,b.jsx)(l.T,{size:11,colour:t?h.colours.text:h.colours.gold,children:e},t))}),(0,b.jsxs)(l.Muted,{children:[ne," \xb7 ",T[ie?.method??F.method]]})]}),(0,b.jsxs)(l.Sheet,{visible:W,onClose:()=>U(!1),title:"Tipping policy",children:[(0,b.jsx)(s.TextInput,{accessibilityLabel:"Tipping policy",multiline:!0,editable:ee,value:G,onChangeText:Q,style:[l.styles.input,{minHeight:220,textAlignVertical:'top'}]}),ee?(0,b.jsx)(l.Button,{label:"Save policy",onPress:()=>{re({text:G}),U(!1)}}):null,(0,b.jsx)(l.Muted,{children:"Template only. Adapt it to your business."})]})]}):(0,b.jsx)(O,{})},_e.MyTips=O;var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),n=_r(_d[3]),i=e(_r(_d[4])),r=e(_r(_d[5])),l=_r(_d[6]),d=_r(_d[7]),a=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),p=_r(_d[12]),m=_r(_d[13]),x=_r(_d[14]),f=_r(_d[15]),y=_r(_d[16]),j=_r(_d[17]),w=_r(_d[18]),b=_r(_d[19]);const T={hours:'By paid hours',points:'Hours \xd7 role points',equal:'Equal share',custom:'Custom %'},C=e=>'staff'!==e.role?'Manager':/porter|KP/i.test(e.job)?'KP':/kitchen|chef/i.test(e.job)?'Kitchen':/bar/i.test(e.job)?'Bar':'FOH',k=e=>(e??'').replace(' (example)','');function S(e,t){const s=t.reduce((e,t)=>e+t,0);if(!s||e<=0)return{amounts:t.map(()=>0),remainder:0};const o=t.map(t=>e*t/s),n=o.map(Math.floor);let i=e-n.reduce((e,t)=>e+t,0);const r=i;return o.map((e,t)=>({i:t,f:e-Math.floor(e)})).sort((e,t)=>t.f-e.f).forEach(({i:e})=>{i>0&&(n[e]+=1,i-=1)}),{amounts:n,remainder:r}}function O({staffId:e}={}){const t=(0,x.useCtx)(6e4),{now:s,me:o}=t,i=e??t.meId,d=(0,a.useOwner)(e=>e.tronc),u=(0,a.useOwner)(e=>e.troncHistory),p=(0,a.useOwner)(e=>e.troncLog),[m,f]=(0,n.useState)(!1),[y,j]=(0,n.useState)(null),C=u.flatMap(e=>e.rows.filter(e=>e.staffId===i).map(t=>({h:e,r:t})));return(0,b.jsxs)(r.default,{style:{gap:10},children:[(0,b.jsx)(w.TipGoalCard,{staffId:i}),(0,b.jsxs)(l.Card,{children:[(0,b.jsx)(l.T,{weight:"semibold",children:"My tips"}),(0,b.jsx)(l.Muted,{children:"Only your own tip history is shown. 100% of tips go to staff; nothing is deducted."})]}),C.map(({h:e,r:t})=>(0,b.jsxs)(l.Card,{children:[(0,b.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(l.T,{weight:"semibold",children:e.label}),(0,b.jsx)(l.T,{weight:"bold",colour:h.colours.gold,children:(0,c.gbp)(t.amount)})]}),(0,b.jsxs)(l.Muted,{children:[(0,x.hmDur)(Math.round(60*t.hours))," paid \xb7 ",t.pct.toFixed(1),"% share \xb7 ",T[e.method]," \xb7 approved ",e.lockedAt]})]},e.id)),C.length?null:(0,b.jsx)(l.Muted,{children:"No approved tip periods yet. (Preview: approve a period in the Owner view first.)"}),(0,b.jsx)(l.Button,{kind:"secondary",label:"Request my tip records",onPress:()=>{a.useOwner.getState().setOwner({troncLog:[{id:`tl-${Date.now()}`,at:s.toISOString(),text:`${o} requested their tip records`},...p]}),j('Request logged for your manager (demo, nothing is sent).')}}),y?(0,b.jsx)(l.Banner,{kind:"success",title:y}):null,(0,b.jsx)(l.Button,{kind:"ghost",label:"Read the tipping policy",onPress:()=>f(!0)}),(0,b.jsx)(l.Sheet,{visible:m,onClose:()=>f(!1),title:"Tipping policy",children:(0,b.jsx)(l.T,{size:14,children:d.text})})]})}},1011,[868,877,833,30,151,127,813,819,856,816,818,821,1000,1019,927,1250,1280,820,1322,24]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.AccidentBook=function(n){return null}},1012,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.MissedBanner=function(n){return null},e.HaccpLog=function(n){return null}},1013,[]); +__d(function(_g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.styliseOnDevice=p,_e.pickPhoto=b,_e.AvatarMaker=function({meId:e,me:h}){const u=(0,n.useAvatars)(t=>t.photos[e]),[g,f]=(0,t.useState)(null),[v,y]=(0,t.useState)(null),[x,j]=(0,t.useState)(!1),[w,I]=(0,t.useState)(!1),[k,P]=(0,t.useState)('');(0,t.useEffect)(()=>()=>{g&&URL.revokeObjectURL(g)},[g]);const M='undefined'!=typeof document,R=async e=>{P('');const t=await b(e);if(t){I(!0),j(!1);try{const e=await p(t);g&&URL.revokeObjectURL(g),f(URL.createObjectURL(t)),y(e)}catch{P("That photo couldn't be opened. Try a different one (JPEG or PNG).")}finally{I(!1)}}},S=()=>{g&&URL.revokeObjectURL(g),f(null),y(null),j(!1)},B=h.replace(' (example)','');return(0,c.jsxs)(o.default,{style:{gap:12},testID:"avatar-maker",children:[(0,c.jsxs)(d.Box,{children:[(0,c.jsxs)(s.Row,{gap:14,children:[(0,c.jsx)(l.StaffAvatar,{id:e,size:88}),(0,c.jsxs)(o.default,{style:{flex:1,gap:4},children:[(0,c.jsx)(s.T,{weight:"semibold",size:17,children:B}),(0,c.jsxs)(s.Muted,{children:[u?`Your avatar from a photo (made ${new Date(u.at).toLocaleDateString('en-GB')}).`:'Your default space-age avatar.'," It shows on rotas, chat, clock-in and sign-offs."]})]})]}),u?(0,c.jsx)(s.Button,{small:!0,kind:"secondary",label:"Back to my default avatar",testID:"avatar-own-reset",onPress:()=>{n.useAvatars.getState().reset(e,{id:e,role:'staff',name:B}),P('Back to your default avatar.')}}):null]}),(0,c.jsxs)(d.Box,{testID:"avatar-create",children:[(0,c.jsx)(s.T,{weight:"semibold",size:17,children:"Create my avatar from a photo"}),(0,c.jsx)(s.Muted,{children:"Upload a photo or take a selfie. Your phone turns it into a retro space-age avatar. The photo never leaves this device and isn't saved: only the finished avatar is kept."}),M?v?(0,c.jsxs)(o.default,{style:{gap:10},testID:"avatar-preview",children:[(0,c.jsxs)(s.Row,{gap:12,style:{justifyContent:'center'},children:[(0,c.jsxs)(o.default,{style:{alignItems:'center',gap:4},children:[g?(0,c.jsx)(a.default,{source:{uri:g},style:{width:96,height:96,borderRadius:12},accessibilityLabel:"Your photo"}):null,(0,c.jsx)(s.Muted,{children:"Your photo"})]}),(0,c.jsx)(s.T,{size:22,colour:i.colours.gold,children:"\u2192"}),(0,c.jsxs)(o.default,{style:{alignItems:'center',gap:4},children:[(0,c.jsx)(a.default,{source:{uri:v},style:{width:120,height:120,borderRadius:60,borderWidth:3,borderColor:i.colours.gold},accessibilityLabel:"Your new avatar preview",testID:"avatar-result"}),(0,c.jsx)(s.Muted,{children:"Your avatar"})]})]}),(0,c.jsxs)(r.default,{accessibilityRole:"checkbox",accessibilityState:{checked:x},accessibilityLabel:"I agree to use this avatar",testID:"avatar-consent",onPress:()=>j(!x),style:{flexDirection:'row',gap:10,alignItems:'flex-start',padding:10,borderRadius:12,borderWidth:1,borderColor:x?i.colours.gold:i.colours.border},children:[(0,c.jsx)(o.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:i.colours.gold,backgroundColor:x?i.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:x?(0,c.jsx)(s.T,{size:15,weight:"bold",colour:"#111",children:"\u2713"}):null}),(0,c.jsx)(s.T,{size:14,style:{flex:1},children:"I\u2019m happy for this avatar, made from my photo, to be shown to my team in CoverCharge. Only the finished avatar is shared; my photo isn\u2019t uploaded or kept, and a manager can reset my avatar."})]}),(0,c.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,c.jsx)(s.Button,{label:"Use as my avatar",testID:"avatar-save",disabled:!x,onPress:()=>{const t=n.useAvatars.getState().setOwn(e,e,v,B);P(t?'Saved: this is your avatar now.':"Couldn't save the avatar."),t&&S()}}),(0,c.jsx)(s.Button,{kind:"secondary",label:"Try another photo",onPress:S})]})]}):(0,c.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,c.jsx)(s.Button,{label:w?'Making your avatar\u2026':'Upload a photo',testID:"avatar-upload",disabled:w,onPress:()=>R(!1)}),(0,c.jsx)(s.Button,{kind:"secondary",label:"Take a selfie",testID:"avatar-selfie",disabled:w,onPress:()=>R(!0)})]}):(0,c.jsx)(s.Muted,{children:"Available in the web app."}),k?(0,c.jsx)(o.default,{testID:"avatar-msg",children:(0,c.jsx)(s.T,{size:14,colour:i.colours.ok,children:k})}):null,(0,c.jsx)(s.Banner,{kind:"info",title:"Coming soon: AI avatars",children:"A future version will use AI to draw you as a full cartoon in the same style. For now it's a simple filter that runs on your phone."})]})]})};var t=_r(_d[0]),a=e(_r(_d[1]));_r(_d[2]);var r=e(_r(_d[3])),o=e(_r(_d[4])),s=_r(_d[5]),l=_r(_d[6]),n=_r(_d[7]),i=_r(_d[8]),d=_r(_d[9]),c=_r(_d[10]);const h=['#1B1B1B','#4A3F35','#B89A72','#E9B949','#FFF4E0'].map(e=>[1,3,5].map(t=>parseInt(e.slice(t,t+2),16))),u=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5];function g(e){return new Promise((t,a)=>{const r=URL.createObjectURL(e),o=new window.Image;o.onload=()=>t({img:o,url:r}),o.onerror=()=>{URL.revokeObjectURL(r),a(new Error('bad image'))},o.src=r})}function f(e,t,a,r){e.beginPath(),e.moveTo(t,a-r),e.quadraticCurveTo(t+.18*r,a-.18*r,t+r,a),e.quadraticCurveTo(t+.18*r,a+.18*r,t,a+r),e.quadraticCurveTo(t-.18*r,a+.18*r,t-r,a),e.quadraticCurveTo(t-.18*r,a-.18*r,t,a-r),e.fill()}async function p(e){const{img:t,url:a}=await g(e);try{const e=112,a=256,r=document.createElement('canvas');r.width=e,r.height=e;const o=r.getContext('2d'),s=Math.min(t.width,t.height);o.drawImage(t,(t.width-s)/2,Math.max(0,(t.height-s)/2-.04*s),s,s,0,0,e,e);const l=o.getImageData(0,0,e,e),n=l.data,i=[];for(let e=0;ee-t),c=d[Math.floor(.04*d.length)],g=d[Math.floor(.96*d.length)]||255;for(let t=0;t{const a=document.createElement('input');a.type='file',a.accept='image/*',e&&a.setAttribute('capture','user'),a.onchange=()=>t(a.files?.[0]??null),a.click()})}},1014,[30,196,122,263,127,813,953,1169,821,1319,24]); +__d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEFAULT_LOYALTY",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"consentText",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"prettyCardNo",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"cleanCode",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"cardQr",{enumerable:!0,get:function(){return s}}),_e.readCardQr=function(e){const r=/^covercharge:card:[^:]+:([A-Za-z0-9-]{8,9})$/.exec(e.trim());return r?n(r[1]):null},Object.defineProperty(_e,"codeQr",{enumerable:!0,get:function(){return o}}),_e.checkSettings=function(e){return!Number.isInteger(e.stampsNeeded)||e.stampsNeeded<2||e.stampsNeeded>30?'Stamps needed must be between 2 and 30.':e.reward.trim()?e.reward.length>80?'Keep the reward under 80 letters.':e.gapMinutes<0||e.gapMinutes>1440?'Time between stamps must be 0 to 24 hours.':e.maxPerDay<1||e.maxPerDay>10?'Stamps a day must be 1 to 10.':!Number.isInteger(e.stampExpiryDays)||e.stampExpiryDays<0||e.stampExpiryDays>1095?'Stamps last 0 (never run out) to 1095 days.':!Number.isInteger(e.rewardExpiryDays)||e.rewardExpiryDays<0||e.rewardExpiryDays>1095?'Rewards last 0 (never run out) to 1095 days.':!e.referralOn||e.referralGiver.trim()&&e.referralFriend.trim()?e.referralMonthlyCap<0||e.referralMonthlyCap>50?'Friend rewards a month must be 0 to 50.':null:'Say what both people get before you switch Bring a friend on.':'Say what the reward is, for example Free dessert.'},_e.checkOffer=function(e){if(!e.title.trim())return'Give the offer a title.';if(e.title.length>80)return'Keep the title under 80 letters.';if(e.details.length>500)return'Keep the details under 500 letters.';const r=/^\d{4}-\d{2}-\d{2}$/;return e.startsOn&&!r.test(e.startsOn)?'Start date should look like 2026-11-30.':e.endsOn&&!r.test(e.endsOn)?'End date should look like 2026-11-30.':e.startsOn&&e.endsOn&&e.endsOn`I agree to ${e} keeping my name and the phone or email I give, only to run my stamp card and offers here. I can leave at any time and my details are removed.`,t=e=>e&&8===e.length?`${e.slice(0,4)}-${e.slice(4)}`:e,n=e=>e.toUpperCase().replace(/[^A-Z0-9]/g,''),s=(e,r)=>`covercharge:card:${e}:${r}`;const o=(e,r,t)=>`${e.replace(/\/$/,'')}/customer/${r}/loyalty?code=${t}`;const l=(e,r)=>e.isOn&&(!e.startsOn||e.startsOn<=r)&&(!e.endsOn||e.endsOn>=r),p=r=>r?{saved:!!r.updated_by,cardOn:!!r.card_on,stampsNeeded:r.stamps_needed??8,reward:r.reward??'',stampExpiryDays:r.stamp_expiry_days??0,rewardExpiryDays:r.reward_expiry_days??0,gapMinutes:r.gap_minutes??60,maxPerDay:r.max_per_day??1,referralOn:!!r.referral_on,referralGiver:r.referral_giver??'',referralFriend:r.referral_friend??'',referralMonthlyCap:r.referral_monthly_cap??5}:{...e},u=e=>({card_on:e.cardOn,stamps_needed:e.stampsNeeded,reward:e.reward.trim(),stamp_expiry_days:e.stampExpiryDays,reward_expiry_days:e.rewardExpiryDays,gap_minutes:e.gapMinutes,max_per_day:e.maxPerDay,referral_on:e.referralOn,referral_giver:e.referralGiver.trim(),referral_friend:e.referralFriend.trim(),referral_monthly_cap:e.referralMonthlyCap}),y=e=>({id:String(e.id),title:e.title??'',details:e.details??'',startsOn:e.starts_on??null,endsOn:e.ends_on??null,isOn:!1!==e.is_on})},1015,[]); +__d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SHOP_DEFAULT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"PAY_PLACEHOLDER",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"STATUS_WORDS",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"cleanGiftCode",{enumerable:!0,get:function(){return o}}),e.prettyGiftCode=function(t){const n=o(t);return 16===n.length?n.match(/.{4}/g).join('-'):n},e.poundsToPence=i,e.redeemKey=function(t=Math.random){const n='abcdefghijkmnpqrstuvwxyz23456789';let r='r-';for(let o=0;o<20;o++)r+=n[Math.floor(32*t())%32];return r},Object.defineProperty(e,"expiryWords",{enumerable:!0,get:function(){return c}}),e.amountsFromText=function(t){const n=t.split(/[,\s]+/).filter(Boolean).map(i);return!n.length||n.length>6||n.some(t=>null===t||t<100)?null:[...new Set(n)].sort((t,n)=>t-n)},e.basketTotal=function(t,n){return t.reduce((t,r)=>t+(n.find(t=>t.id===r.id)?.pricePence??0)*r.qty,0)},Object.defineProperty(e,"settingsFromRow",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"settingsToRow",{enumerable:!0,get:function(){return a}});const t={giftsOn:!1,shopOn:!1,expiryMonths:24,amounts:[2500,5e3,1e4],minPence:500,maxPence:25e3,terms:''},n='Gift cards are sold through your website. You can also pay at the bar or till.',r={'waiting-payment':'Waiting for payment at the till',active:'Ready to use',used:'Used up',expired:'Expired',void:'Cancelled',paid:'Paid',ready:'Ready to collect',collected:'Collected',cancelled:'Cancelled'},o=t=>(t??'').toUpperCase().replace(/[^A-Z0-9]/g,'');function i(t){const n=(t??'').trim().replace(/^\xa3/,'');return/^\d{1,4}(\.\d{1,2})?$/.test(n)?Math.round(100*Number(n)):null}const c=t=>t%12==0?`${t/12} year${12===t?'':'s'}`:`${t} months`;const s=n=>n?{giftsOn:!!n.gifts_on,shopOn:!!n.shop_on,expiryMonths:n.expiry_months??24,amounts:n.amounts??t.amounts,minPence:n.min_pence??500,maxPence:n.max_pence??25e3,terms:n.terms??''}:{...t},a=t=>({gifts_on:t.giftsOn,shop_on:t.shopOn,expiry_months:t.expiryMonths,amounts:t.amounts,min_pence:t.minPence,max_pence:t.maxPence,terms:t.terms})},1016,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"shopPublic",{enumerable:!0,get:function(){return p}}),e.myShop=async function(t){return await(0,n.guestSession)()?(0,n.rpc)('guest_my_shop',{p_slug:t}):{cards:[],orders:[]}},e.buyGift=async function(t,o){if(!await(0,n.guestSession)())throw new Error('No connection. Try again when you are back online.');return(0,n.rpc)('guest_gift_buy',{p_slug:t,p_amount:o.amount,p_recipient:o.recipient,p_from:o.from,p_message:o.message})},e.shopOrder=async function(t,o,c){if(!await(0,n.guestSession)())throw new Error('No connection. Try again when you are back online.');return(0,n.rpc)('guest_shop_order',{p_slug:t,p_lines:o,p_name:c})},Object.defineProperty(e,"giftCheck",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"giftRedeem",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"giftActivate",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"giftIssue",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"giftHonourWix",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"giftVoid",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"giftSummary",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"shopStatus",{enumerable:!0,get:function(){return v}}),e.waitingCards=async function(){const{data:t,error:n}=await c().from('gift_cards').select('id,last4,ref,initial_pence,balance_pence,status,source,recipient_name,issued_at,expires_at').eq('venue_id',s()).order('issued_at',{ascending:!1}).limit(60);if(n)throw n;return t??[]},e.shopOrders=async function(){const{data:t,error:n}=await c().from('shop_orders').select('*').eq('venue_id',s()).order('created_at',{ascending:!1}).limit(60);if(n)throw n;return t??[]},e.readShopSettings=async function(){const{data:t,error:n}=await c().from('shop_settings').select('*').eq('venue_id',s()).maybeSingle();if(n)throw n;return(0,o.settingsFromRow)(t)},e.saveShopSettings=async function(t){const{error:n}=await c().from('shop_settings').upsert({venue_id:s(),...(0,o.settingsToRow)(t),updated_by:u(),updated_at:(new Date).toISOString()},{onConflict:'venue_id'});if(n)throw n},e.readProducts=async function(){const{data:t,error:n}=await c().from('shop_products').select('*').eq('venue_id',s()).order('sort').order('name');if(n)throw n;return t??[]},e.saveProduct=async function(t){const n={venue_id:s(),name:t.name.trim(),details:t.details.trim(),price_pence:t.pricePence,stock:t.stock,is_live:t.live,updated_by:u(),updated_at:(new Date).toISOString()},{error:o}=t.id?await c().from('shop_products').update(n).eq('id',t.id):await c().from('shop_products').insert(n);if(o)throw o},Object.defineProperty(e,"payPublic",{enumerable:!0,get:function(){return S}}),e.payStart=async function(t,o,s){if(!await(0,n.guestSession)())throw new Error('No connection. Try again when you are back online.');const u='undefined'!=typeof window?window.location.href.split('?')[0]:'',{data:p,error:_}=await c().functions.invoke('pay-checkout',{body:{slug:t,kind:o,target:s,successUrl:u,cancelUrl:u}});if(_||!p?.url)throw new Error(p?.error??'Card payment isn\u2019t available yet. Pay at the bar or till.');if(!/^https:\/\/checkout\.stripe\.com\//.test(p.url))throw new Error('Card payment isn\u2019t available yet. Pay at the bar or till.');return p},Object.defineProperty(e,"payStatus",{enumerable:!0,get:function(){return P}}),e.readPaySettings=async function(){const{data:t,error:n}=await c().from('payment_settings').select('*').eq('venue_id',s()).maybeSingle();if(n)throw n;return{provider:t?.provider??'none',cardOn:!!t?.card_on,account:t?.stripe_account_id??''}},Object.defineProperty(e,"savePaySettings",{enumerable:!0,get:function(){return O}}),e.recentPayments=async function(){const{data:t,error:n}=await c().from('payments').select('id,kind,amount_pence,status,provider,created_at,paid_at').eq('venue_id',s()).order('created_at',{ascending:!1}).limit(20);if(n)throw n;return t??[]};var t=r(d[0]),n=r(d[1]),o=r(d[2]);const c=()=>(0,t.getSupabase)(),s=()=>{const t=n.useSync.getState().venueId;if(!t)throw new Error('Not connected to the venue yet.');return t},u=()=>(n.useSync.getState().staffRef??'').slice(0,80)||null,p=t=>(0,n.rpc)('shop_public',{p_slug:t});const _=t=>(0,n.rpc)('staff_gift_check',{p_venue:s(),p_code:t}),f=(t,o,c,u)=>(0,n.rpc)('staff_gift_redeem',{p_venue:s(),p_code:t,p_amount:o,p_key:c,p_by:u}),y=(t,o)=>(0,n.rpc)('staff_gift_activate',{p_card:t,p_by:o}),l=(t,o,c)=>(0,n.rpc)('staff_gift_issue',{p_venue:s(),p_amount:t,p_recipient:o,p_by:c}),b=(t,o,c)=>(0,n.rpc)('staff_gift_honour_wix',{p_venue:s(),p_code:t,p_balance:o,p_by:c}),w=(t,o,c)=>(0,n.rpc)('staff_gift_void',{p_card:t,p_reason:o,p_by:c}),h=()=>(0,n.rpc)('staff_gift_summary',{p_venue:s()}),v=(t,o,c,s)=>(0,n.rpc)('staff_shop_status',{p_order:t,p_status:o,p_reason:c,p_by:s});const S=async t=>{try{return await(0,n.rpc)('pay_public',{p_slug:t})}catch{return{provider:'none',cardOn:!1,testMode:!0}}};const P=t=>(0,n.rpc)('guest_pay_status',{p_payment:t});const O=t=>(0,n.rpc)('staff_payment_settings_save',{p_venue:s(),p_provider:t.provider,p_card_on:t.cardOn,p_account:t.account,p_by:u()})},1017,[863,820,1016]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.refreshCashAccess=r,e.setStaffCashUp=async function(c,o){const f=s.useSync.getState().venueId;if(!f)return{ok:!1,error:'Not connected. Try again when the app is online.'};const u=(0,t.getSupabase)();try{const{data:t}=await u.from('staff').select('id').eq('venue_id',f).eq('external_ref',c).maybeSingle();if(!t?.id)return{ok:!1,error:'This person isn\u2019t on the shared team list yet.'};const{error:s}=await u.rpc('set_staff_cash_up',{p_staff:t.id,p_on:o});return s?{ok:!1,error:/owner or manager/i.test(s.message)?'Only an owner or manager can change this.':'Could not save. Try again.'}:(n.useCashAccess.setState(t=>({byRef:{...t.byRef,[c]:o}})),r(),{ok:!0})}catch{return{ok:!1,error:'Could not save. Try again when the app is online.'}}};var t=_r(d[0]),s=_r(d[1]),n=_r(d[2]);async function r(){const r=s.useSync.getState().venueId;if(!r||'staff'!==s.useSync.getState().kind)return;const c=(0,t.getSupabase)();try{const[{data:t},{data:s}]=await Promise.all([c.rpc('my_cash_up_access',{p_venue:r}),c.from('staff').select('external_ref, can_cash_up').eq('venue_id',r)]),o={};if(Array.isArray(s))for(const t of s)t.external_ref&&(o[t.external_ref]=!!t.can_cash_up);n.useCashAccess.setState({mine:'boolean'==typeof t?t:n.useCashAccess.getState().mine,byRef:Array.isArray(s)?o:n.useCashAccess.getState().byRef,loaded:!0})}catch{}}},1018,[863,820,997]); +__d(function(g,_r,i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"RID",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"statusKind",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"statusLabel",{enumerable:!0,get:function(){return d}}),_e.nextStatus=function(e){return'new'===e.status||'acknowledged'===e.status?{to:'preparing',label:'Start preparing'}:'preparing'===e.status?{to:'ready',label:'takeaway'===e.type?'Mark ready (notify customer)':'Mark ready'}:'ready'===e.status?'takeaway'===e.type?{to:'collected',label:'Collected'}:{to:'served',label:'Served'}:null},Object.defineProperty(_e,"LIVE",{enumerable:!0,get:function(){return a}}),_e.busyLevel=b,_e.restOfDayLevel=function(e,r){const t=e.hours.filter(r=>!e.nextHour||r.hour>=e.nextHour.hour).reduce((e,r)=>!e||r.covers>e.covers?r:e,void 0);return{level:b(t?.covers??0,r.settings.capacityPerHour),peak:t}},_e.Tile=function({label:e,value:n,sub:c,onPress:u,accent:d,children:a}){const b=(0,s.jsxs)(t.default,{style:{flexGrow:1,flexBasis:150,backgroundColor:o.colours.surface,borderRadius:14,padding:12,borderWidth:1,borderColor:d??o.colours.border,gap:2},children:[(0,s.jsx)(l.T,{size:13,weight:"medium",colour:o.colours.muted,children:e}),(0,s.jsx)(l.T,{size:24,weight:"bold",colour:d??o.colours.text,children:n}),c?(0,s.jsx)(l.T,{size:13,colour:o.colours.muted,children:c}):null,a]});return u?(0,s.jsx)(r.default,{accessibilityRole:"button",accessibilityLabel:e,onPress:u,style:{flexGrow:1,flexBasis:150},children:b}):b},_e.SectionHead=function({title:e,right:r,sub:n}){return(0,s.jsxs)(t.default,{style:{gap:2,marginTop:6},children:[(0,s.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,s.jsx)(l.T,{weight:"semibold",size:o.font.large,colour:o.colours.gold,children:e}),r]}),n?(0,s.jsx)(l.Muted,{children:n}):null]})},_e.AlertBox=function({colour:e,title:r,children:n}){return(0,s.jsxs)(t.default,{style:{backgroundColor:o.colours.surface2,borderRadius:12,padding:10,borderLeftWidth:6,borderLeftColor:e,gap:6},children:[(0,s.jsx)(l.T,{weight:"bold",colour:e,children:r}),n]})},_e.Bars=function({data:e,max:r,highlight:n,height:c=110}){return(0,s.jsx)(l.Row,{gap:4,style:{alignItems:'flex-end'},children:e.map(e=>{const u=e.key===n,d=e.a+(e.b??0);return(0,s.jsxs)(t.default,{style:{alignItems:'center',flex:1,minWidth:26},children:[(0,s.jsx)(l.T,{size:11,colour:u?o.colours.gold:o.colours.muted,children:e.note??String(d)}),(0,s.jsxs)(t.default,{style:{height:c,width:'70%',justifyContent:'flex-end',borderBottomWidth:1,borderColor:o.colours.border},children:[e.b?(0,s.jsx)(t.default,{style:{height:Math.max(0,e.b/r*c),backgroundColor:u?o.colours.goldLight:'#6B5A3A'}}):null,(0,s.jsx)(t.default,{style:{height:Math.max(d?2:0,e.a/r*c),backgroundColor:u?o.colours.gold:'#9C7C45'}})]}),(0,s.jsx)(l.T,{size:11,colour:u?o.colours.gold:o.colours.muted,children:e.label})]},e.key)})})},Object.defineProperty(_e,"DemoTag",{enumerable:!0,get:function(){return f}}),_r(_d[0]);var r=e(_r(_d[1])),t=e(_r(_d[2])),l=_r(_d[3]),o=_r(_d[4]),n=_r(_d[5]),s=_r(_d[6]);const c=n.VENUE_RID,u=e=>'new'===e?'red':'ready'===e?'ok':'preparing'===e||'acknowledged'===e?'amber':'served'===e||'collected'===e?'blue':'neutral',d=e=>({new:'New',acknowledged:'Accepted',preparing:'Preparing',ready:'Ready',collected:'Collected',served:'Served',closed:'Closed',cancelled:'Cancelled'}[e.status]);const a=e=>!['collected','served','closed','cancelled'].includes(e.status);function b(e,r){const t=r?e/r:0;return t<.35?{label:'Quiet',colour:o.colours.ok,pct:t}:t<.6?{label:'Steady',colour:o.colours.blue,pct:t}:t<.85?{label:'Busy',colour:o.colours.amber,pct:t}:{label:'Very busy',colour:o.colours.red,pct:t}}const f=({label:e="DEMO"})=>(0,s.jsx)(l.Badge,{kind:"amber",label:e})},1019,[30,263,127,813,821,5,24]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.WhatsAppGuest=function({b:p,rid:o,kind:u="change"}){const c=(0,n.useRestaurant)(o);if(!c?.settings?.whatsapp||!(0,s.waNumber)(c.settings.whatsapp)||p.walkIn||!(0,s.waNumber)(p.phone))return null;const l=c.location?.split(',')[1]?.trim(),f=(0,s.staffWhatsAppTexts)({name:p.name,ref:p.ref,date:p.date,time:p.time,partySize:p.partySize},c.name,l&&!/fictional/i.test(l)?l:void 0),h='auto'===u?['confirmed','pending'].includes(p.status)?'confirm':'change':u,b=(0,s.waMeLink)(p.phone,'confirm'===h?f.confirm:f.change);return b?(0,r.jsx)(t.Button,{small:!0,kind:"secondary",label:"\ud83d\udcac WhatsApp guest",testID:`wa-guest-${p.ref}`,accessibilityLabel:`WhatsApp ${p.name}`,onPress:()=>{(0,s.openWhatsApp)(b)}}):null},_r(d[0]);var t=_r(d[1]),n=_r(d[2]),s=_r(d[3]),r=_r(d[4])},1020,[30,813,819,822,24]); +__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.requestChallenge=async function(t,s){const{data:u,error:o}=await n().rpc('venue_request_challenge',{p_slug:(0,e.queuedDatabaseSlug)(t),p_kind:s});if(o)throw o;return u},_e.sendVenueRequest=async function(t,s,u,o,c,l){const{data:_,error:p}=await n().rpc('submit_venue_request',{p_slug:(0,e.queuedDatabaseSlug)(t),p_kind:s,p_payload:u,p_challenge:o,p_answer:c,p_website:l});if(p)throw p;return _},_e.listVenueRequests=async function(e,t){const{data:s,error:u}=await n().from('venue_booking_requests').select('*').eq('venue_id',e).eq('kind',t).order('status',{ascending:!1}).order('created_at',{ascending:!1}).limit(100);if(u)throw u;return s||[]},_e.decideVenueRequest=async function(e,t){const{data:s,error:u}=await n().rpc('decide_venue_request',{p_id:e,p_decision:t});if(u)throw u;return s},Object.defineProperty(_e,"requestMessage",{enumerable:!0,get:function(){return s}});var e=r(d[0]),t=r(d[1]);const n=()=>(0,t.getSupabase)();const s=e=>{const t=String(e?.message||'');return/^(Requests are not enabled|Too many|Please complete|Enter your|Choose |This request|Only this venue)/.test(t)?t:'Unable to send or load requests. Check your connection and try again, or call the hotel.'}},1021,[6,863]); +__d(function(_g,_r,i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useStore",{enumerable:!0,get:function(){return n.useStore}}),_e.useNow=function(e=1e4){const r=(0,n.useStore)(e=>e.clock),[,u]=(0,t.useState)(0);return(0,t.useEffect)(()=>{const t=setInterval(()=>u(e=>e+1),e);return()=>clearInterval(t)},[e]),(0,n.nowFrom)(r)},Object.defineProperty(_e,"useRestaurant",{enumerable:!0,get:function(){return a}}),_e.useRecipeCards=c,_e.useAllMenu=f,_e.useMenu=function(e){const r=f(e);return(0,t.useMemo)(()=>r.filter(e=>!e.hidden),[r])},Object.defineProperty(_e,"useCustomer",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"useBasket",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"useOrders",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"useOrderAtTable",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"useOrder",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"useBookings",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"useWaitlist",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"useEvents",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"useStampCard",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"useGiftCards",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"useRatings",{enumerable:!0,get:function(){return M}}),Object.defineProperty(_e,"useAudit",{enumerable:!0,get:function(){return v}});var e=_r(_d[0]),t=_r(_d[1]),r=_r(_d[2]),n=_r(_d[3]),u=_r(_d[4]),s=_r(_d[5]),o=_r(_d[6]);_r(_d[7]);const a=e=>(0,n.useStore)(t=>t.restaurants.find(t=>t.id===e)),l=e=>(0,o.recipeCards)().subscribe(e),d=[];function c(e){return(0,t.useSyncExternalStore)(l,()=>e?(0,o.recipeCards)().list(e):d,()=>e?(0,o.recipeCards)().list(e):d)}function f(e){const u=(0,n.useStore)((0,r.useShallow)(t=>t.menu.filter(t=>t.restaurantId===e))),o=c(e);return(0,t.useMemo)(()=>(0,s.resolveMenu)(u),[u,o])}const b=()=>(0,n.useStore)(e=>e.customer),S=()=>(0,n.useStore)(e=>e.basket),g=(e,t)=>'table'!==t.type||(0,u.orderAtTableOn)(e.restaurants.find(e=>e.id===t.restaurantId)),m=e=>(0,n.useStore)((0,r.useShallow)(t=>t.orders.filter(r=>(!e||r.restaurantId===e)&&g(t,r)))),p=e=>(0,n.useStore)(t=>(0,u.orderAtTableOn)(t.restaurants.find(t=>t.id===e))),O=e=>(0,n.useStore)(t=>t.orders.find(t=>t.id===e)),y=e=>(0,n.useStore)((0,r.useShallow)(t=>e?t.bookings.filter(t=>t.restaurantId===e):t.bookings)),w=e=>(0,n.useStore)((0,r.useShallow)(t=>t.waitlist.filter(t=>t.restaurantId===e))),I=[],j=u=>{const s=(0,n.useStore)((0,r.useShallow)(e=>e.events.filter(e=>null===e.restaurantId||e.restaurantId===u))),o=(0,n.useStore)(e=>e.restaurants.find(e=>e.id===u)),a=o?(0,e.regularEventsOf)(o):I,l=(new Date).toISOString().slice(0,7);return(0,t.useMemo)(()=>{if(!u||!a.length)return s;const t=new Date,r=new Date(t.getFullYear(),t.getMonth()-2,1),n=new Date(t.getFullYear()+1,t.getMonth()+1,0),o=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`;return[...s,...(0,e.expandEvents)(u,a,o(r),o(n))]},[s,a,u,l])},P=e=>(0,n.useStore)(t=>t.stampCards.find(r=>r.restaurantId===e&&r.customerId===t.customer.id)),h=e=>(0,n.useStore)((0,r.useShallow)(t=>t.giftCards.filter(r=>(!e||r.restaurantId===e)&&r.ownerId===t.customer.id))),M=e=>(0,n.useStore)((0,r.useShallow)(t=>t.ratings.filter(t=>t.restaurantId===e))),v=e=>(0,n.useStore)((0,r.useShallow)(t=>t.audit.filter(t=>t.restaurantId===e)))},1022,[809,30,873,872,1213,1102,831,1077]); +__d(function(g,r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"METHOD_LABEL",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"DAY3",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"DAYS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"wd",{enumerable:!0,get:function(){return i}}),e.dayRange=function(t){const n=[...new Set(t)].sort((t,n)=>t-n);if(!n.length)return'';if(7===n.length)return'every day';return n.every((t,o)=>o===0||t===n[o-1]+1)&&n.length>=3?`${o[n[0]]} to ${o[n[n.length-1]]}`:n.map(t=>o[t]).join(', ')},e.nextDelivery=a,Object.defineProperty(e,"niceDay",{enumerable:!0,get:function(){return d}}),e.remindersFor=function(t,n,o={}){const d=i(n);return t.filter(t=>t.orderDays.includes(d)).flatMap(t=>{if(o[t.id]&&new Date(o[t.id]).toDateString()===n.toDateString())return[];let d=!1;if(/^\d\d:\d\d$/.test(t.cutoff)){const[o,s]=t.cutoff.split(':').map(Number),i=new Date(n);i.setHours(o,s,0,0),d=n>i}const l=a(t,n),c=t.reminder||`Order ${t.name} today${l?` for ${s[i(l)]}`:''}`;return[{supplierId:t.id,name:t.name,text:`${c}${t.cutoff?d?` (cut-off ${t.cutoff} passed)`:` by ${t.cutoff}`:''}`,tone:d?'red':'amber',cutoffPassed:d}]})},e.orderLines=function(n,o,s,i=""){const a=n.items.filter(t=>(o[t.id]??0)>0).map(n=>`${(0,t.fishInStone)(i,n)?(0,t.fishQtyText)(i,n,o[n.id]):`${l(o[n.id])} ${n.unit}`} ${n.name}`.replace(/\s+/g,' ').trim());return s.split('\n').map(t=>t.trim()).filter(Boolean).forEach(t=>a.push(t)),a},e.orderMessage=function(t,n,o,s,i,l){const c=a(t,l);return[`Hi ${t.contact||t.name.split(' (')[0]}, order from ${n}${o?`, ${o}`:''}${c?` for ${d(c)}`:''}:`,...s.map(t=>`- ${t}`),'',`Thanks, ${i}`].join('\n')},e.intlDigits=c,Object.defineProperty(e,"smsLink",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"waLink",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"telLink",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"sid",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"ANCHORAGE_SHEETS",{enumerable:!0,get:function(){return k}});var t=r(_d[0]);const n={online:'Online',phone:'Phone',text:'Text message',whatsapp:'WhatsApp',tbc:'To be decided'},o=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],s=['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'],i=t=>(t.getDay()+6)%7;function a(t,n){const o=null!=t.deliversOn?[t.deliversOn]:t.deliveryDays;if(!o.length)return null;for(let t=1;t<=7;t++){const s=new Date(n);if(s.setDate(s.getDate()+t),o.includes(i(s)))return s}return null}const d=t=>t.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'});const l=t=>Number.isInteger(t)?String(t):t.toFixed(1).replace(/\.0$/,'');function c(t){const n=t.replace(/[^\d+]/g,'').replace(/^\+/,'');return n.startsWith('00')?n.slice(2):n.startsWith('0')?`44${n.slice(1)}`:n}const u=(t,n)=>`sms:${t.replace(/[^\d+]/g,'')}?&body=${encodeURIComponent(n)}`,m=(t,n)=>`https://wa.me/${c(t)}?text=${encodeURIComponent(n)}`,f=t=>`tel:${t.replace(/[^\d+]/g,'')}`;let p=0;const h=(t="os")=>`${t}-${Date.now().toString(36)}${(p++).toString(36)}`,y=(t,n,o)=>({id:t,name:n,unit:o}),b=t=>({number:'',url:'',deliveryDays:[],orderDays:[],cutoff:'',frequency:'',reminder:'',priceCapPerKg:0,seller:'',items:[],notes:'',...t}),k=[b({id:'os-reids',name:'Reids',goods:'Dry goods and frozen',method:'online',urlLabel:'Open Coldweb',deliveryDays:[0,1,2,3,4],frequency:'Order on Coldweb',items:[y('rd-chips','Frozen chips','boxes'),y('rd-oil','Fryer oil','tubs'),y('rd-flour','Flour','bags'),y('rd-rice','Rice','bags'),y('rd-peas','Frozen peas','bags')],notes:'Order on their Coldweb ordering site. Add the Coldweb link in Managers \u203a Settings \u203a Supplier order sheets, or here.'}),b({id:'os-veg',name:'Veg',goods:'Fruit and veg (supplier to be added)',method:'tbc',placeholder:!0,frequency:'To be added by Gordon',notes:'Placeholder: Gordon will add the veg supplier, how to order and delivery days.'}),b({id:'os-peroni',name:'J. Pieroni & Sons',goods:'Seafood (fish merchant, Ayr)',method:'phone',url:'https://pieronis.com',urlLabel:'Open pieronis.com',deliveryDays:[0,1,2,3,4,5],frequency:'Phone order',items:[y('pa-haddock','Haddock fillets','kg'),y('pa-mussels','Mussels','kg'),y('pa-scallops','Scallops','kg'),y('pa-salmon','Salmon','kg')],notes:'Phone order. Press Call, then read the order from the screen.'}),b({id:'os-spesbona',name:'Spes Bona',goods:'Langoustines and smoked haddock',method:'text',orderDays:[2],deliversOn:4,deliveryDays:[4],frequency:'Text on Wednesday for Friday',reminder:'Text Spes Bona today for Friday\u2019s langoustines and smoked haddock',items:[y('sb-langs','Langoustines','kg'),y('sb-smoked','Smoked haddock','kg')]}),b({id:'os-tarelgin',name:'Tarelgin',goods:'Butcher',method:'text',frequency:'Text order',items:[y('tg-steak','Ribeye steaks',''),y('tg-mince','Steak mince','kg'),y('tg-chicken','Chicken breasts',''),y('tg-sausage','Sausages','kg')]}),b({id:'os-mills',name:'Mills',goods:'Milk',method:'whatsapp',frequency:'WhatsApp message',items:[y('ml-milk','Milk','litres'),y('ml-cream','Double cream','litres'),y('ml-butter','Butter','kg')]}),b({id:'os-kittyfisher',name:'Kittyfisher boat (Big Sean)',goods:'Lobsters and crabs',method:'text',contact:'Sean',frequency:'Whenever stock is low',shellfish:!0,items:[y('kf-lobster','Lobsters',''),y('kf-crab','Crabs','')],notes:'Text Big Sean whenever the lobster or crab count runs low.'}),b({id:'os-lionsmane',name:'Lion\u2019s mane mushroom',goods:'Lion\u2019s mane mushrooms',method:'online',urlLabel:'Open seller',frequency:'Weekly or fortnightly',priceCapPerKg:2500,seller:'Cheapest UK seller (to be chosen)',items:[y('lm-kg','Lion\u2019s mane mushroom','kg')],notes:'Order online from the cheapest UK seller under the price cap. Check the price per kg before you buy.'})]},1023,[1026]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BigText=D,_e.TimeGrid=v,_e.ScopePicker=I,_e.BlockNowSheet=B,_e.DatePicker=C,_e.AddBlockSheet=P,_e.FutureBlocksList=R,_e.BlocksScreen=L,_e.DisplayBlocksScreen=W,_e.DisplayBlocksMenu=function({rid:e,r:t,now:o,by:l,onClose:n}){const[a,i]=(0,s.useState)('menu');return'now'===a?(0,y.jsx)(B,{rid:e,r:t,now:o,by:l,wide:!0,onClose:n}):'future'===a?(0,y.jsx)(P,{rid:e,r:t,now:o,by:l,wide:!0,onClose:n}):'list'===a?(0,y.jsx)(W,{rid:e,r:t,now:o,by:l,onBack:n}):(0,y.jsxs)(m.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:560,testID:"display-blocks-menu",children:[(0,y.jsx)(D,{wide:!0,testID:"dbm-now",label:"Block now",sub:"Pause bookings today",onPress:()=>i('now')}),(0,y.jsx)(D,{wide:!0,testID:"dbm-future",label:"Block future",sub:"A future date, time or tables",onPress:()=>i('future')}),(0,y.jsx)(D,{wide:!0,testID:"dbm-list",label:"All blocked times",sub:"See, change or remove a block",onPress:()=>i('list')}),(0,y.jsx)(m.Muted,{children:"Tip: anyone on the Display can add, change or remove a block. Removing asks you to confirm, and every change is logged."})]})};var t=_r(_d[0]),s=_r(_d[1]),o=e(_r(_d[2])),l=e(_r(_d[3])),n=e(_r(_d[4])),a=e(_r(_d[5])),i=e(_r(_d[6])),d=_r(_d[7]),r=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),g=_r(_d[13]),m=_r(_d[14]),x=_r(_d[15]),p=_r(_d[16]),f=_r(_d[17]),y=_r(_d[18]);const k=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],w=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],j=e=>{try{o.default.announceForAccessibility?.(e)}catch{}};function D({label:e,sub:t,onPress:s,selected:o,disabled:l,testID:a,a11y:i,wide:d}){return(0,y.jsxs)(n.default,{testID:a,accessibilityRole:"button",accessibilityLabel:i??(t?`${e}, ${t}`:e),accessibilityState:{selected:!!o,disabled:!!l},disabled:l,onPress:s,style:({pressed:e})=>({minHeight:52,minWidth:d?void 0:84,flexGrow:d?1:0,paddingHorizontal:14,paddingVertical:8,borderRadius:14,borderWidth:1.5,borderColor:o?b.colours.gold:b.colours.border,backgroundColor:o?b.colours.gold:e?b.colours.goldTint:b.colours.surface2,opacity:l?.35:1,justifyContent:'center'}),children:[(0,y.jsx)(m.T,{size:18,weight:"semibold",colour:o?b.colours.onGold:b.colours.goldLight,center:!0,children:e}),t?(0,y.jsx)(m.T,{size:13,colour:o?b.colours.onGold:b.colours.muted,center:!0,children:t}):null]})}function v({from:e,to:t,min:o,max:l,onChange:n,testID:a="time-grid"}){const[d,r]=(0,s.useState)(e?'to':'from'),c=(0,u.quarterTimes)(o,l),g=t=>{if('from'===d||!e||(0,h.toMins)(t)<=(0,h.toMins)(e))return n(t,void 0),r('to'),void j(`From ${(0,u.rangeText)(t,t).split('\u2013')[0]}. Now pick the end time.`);n(e,t),r('from'),j(`Block ${(0,u.rangeText)(e,t)}`)};return c.length?(0,y.jsxs)(i.default,{testID:a,style:{gap:6},children:[(0,y.jsxs)(m.T,{size:15,weight:"semibold",colour:b.colours.gold,children:['from'!==d&&e?'Now tap the end time':'Tap the start time',e?` \xb7 ${(0,u.rangeText)(e,t??e)}`:'']}),(0,y.jsx)(i.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:6},children:c.map(s=>{const o=!!e&&!!t&&(0,h.toMins)(s)>=(0,h.toMins)(e)&&(0,h.toMins)(s)<=(0,h.toMins)(t);return(0,y.jsx)(D,{testID:`${a}-${s.replace(':','')}`,label:(0,u.rangeText)(s,s).split('\u2013')[0],a11y:`${'from'===d?'From':'To'} ${(0,u.rangeText)(s,s).split('\u2013')[0]}`,selected:s===e||s===t||o,onPress:()=>g(s)},s)})})]}):(0,y.jsx)(m.Muted,{children:"No times left today."})}function I({rid:e,value:o,onChange:l}){const n=(0,c.usePlan)(e),[a,d]=(0,s.useState)(!!o.tables?.length);return(0,y.jsxs)(i.default,{style:{gap:6},testID:"block-scope",children:[(0,y.jsx)(m.T,{size:15,weight:"semibold",children:"Where (optional)"}),(0,y.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,y.jsx)(m.Chip,{testID:"scope-all",label:"All areas",selected:!o.areaId&&!o.tables?.length&&!a,onPress:()=>{d(!1),l({})}}),n.areas.map(e=>(0,y.jsx)(m.Chip,{testID:`scope-area-${e.id}`,label:e.name,selected:o.areaId===e.id,onPress:()=>{d(!1),l({areaId:e.id,areaName:e.name})}},e.id)),(0,y.jsx)(m.Chip,{testID:"scope-tables",label:"Some tables",selected:a,onPress:()=>{d(!0),l({tables:o.tables??[]})}})]}),a?(0,y.jsx)(m.Row,{wrap:!0,gap:6,children:n.tables.map(e=>{const s=!!o.tables?.includes(e.name);return(0,y.jsx)(m.Chip,{testID:`scope-table-${e.name}`,label:(0,t.tableNumbers)(e.name),selected:s,onPress:()=>l({tables:s?(o.tables??[]).filter(t=>t!==e.name):[...o.tables??[],e.name]})},e.id)})}):null]})}function T({value:e,note:t,onChange:s,onNote:o}){return(0,y.jsxs)(i.default,{style:{gap:6},children:[(0,y.jsx)(m.T,{size:15,weight:"semibold",children:"Reason (optional)"}),(0,y.jsx)(m.Row,{wrap:!0,gap:6,children:r.BLOCK_REASONS.map(t=>(0,y.jsx)(m.Chip,{label:t,selected:e===t,onPress:()=>s(e===t?void 0:t)},t))}),(0,y.jsx)(m.Field,{label:"Note (optional)",value:t,onChangeText:e=>o(e.slice(0,120)),placeholder:"e.g. Christening party",testID:"block-note"})]})}function S({line:e,clashes:t,testID:o="block-confirm"}){return(0,s.useEffect)(()=>{j(`${e}. ${t?`${t} booking${1===t?' is':'s are'} already in this time and will be kept.`:''}`)},[e,t]),(0,y.jsxs)(i.default,{testID:o,accessibilityLiveRegion:"polite",style:{borderWidth:1.5,borderColor:b.colours.gold,borderRadius:14,padding:12,gap:6,backgroundColor:b.colours.goldTint},children:[(0,y.jsx)(m.T,{size:19,weight:"semibold",colour:b.colours.gold,children:e}),t?(0,y.jsx)(m.T,{size:15,colour:b.colours.amber,testID:"block-clash-warning",children:`${t} booking${1===t?' is':'s are'} already in this time. ${1===t?'It is':'They are'} kept: call the guest${1===t?'':'s'} if needed.`}):(0,y.jsx)(m.Muted,{children:"No bookings in this time yet."})]})}const $=e=>(0,u.roundUpQuarter)(60*e.getHours()+e.getMinutes())-(e.getMinutes()%15==0?0:15);function B({rid:e,r:t,now:o,by:l,onClose:n,wide:a}){const g=(0,h.ymd)(o),p=(0,c.useDisplaySettings)(e),f=(0,u.openWindow)(t,g),k=(0,u.servicesOn)(t,g,p.serviceWindows),w=Math.max(f?.from??0,$(o)),B=(0,d.useBookings)(e),C=(0,c.usePlan)(e),[P,M]=(0,s.useState)({}),[R,L]=(0,s.useState)(!1),[W,z]=(0,s.useState)({}),[N,E]=(0,s.useState)(),[A,F]=(0,s.useState)(''),[O,_]=(0,s.useState)('pick'),[G,Y]=(0,s.useState)(''),q=!!f&&we&&e.to>w?{from:(0,h.fromMins)(Math.max(e.from,w)),to:(0,h.fromMins)(e.to)}:null,U=H(k.lunch),K=H(k.dinner),Q=q?[{id:'rest',label:'Rest of today',w:{from:(0,h.fromMins)(w),to:(0,h.fromMins)(f.to)}},{id:'hour',label:'Next hour',w:{from:(0,h.fromMins)(w),to:(0,h.fromMins)(Math.min(f.to,w+60))}},{id:'lunch',label:'Lunch',w:U},{id:'dinner',label:'Dinner',w:K}]:[],V=!!P.from&&!!P.to&&(0,h.toMins)(P.to)>(0,h.toMins)(P.from)&&!(W.tables&&!W.tables.length),J=V?(0,u.confirmLine)({dates:[g],from:P.from,to:P.to,today:g,...W}):'',X=V?(0,u.bookingsInWindow)(B,[g],P.from,P.to,W,e=>C.tables.find(t=>t.name===e)?.areaId).length:0;return(0,y.jsx)(m.Sheet,{visible:!0,onClose:n,title:"Block now",maxWidth:a?760:void 0,testID:"block-now-sheet",children:'done'===O?(0,y.jsxs)(i.default,{style:{gap:10},accessibilityLiveRegion:"polite",children:[(0,y.jsx)(m.T,{size:19,weight:"semibold",colour:b.colours.gold,testID:"block-now-done",children:G}),(0,y.jsx)(m.Muted,{children:"The customer app stops offering these times. Staff see the block on the plan and the timeline."}),(0,y.jsx)(m.Button,{label:"Done",onPress:n,testID:"block-now-close"})]}):'confirm'===O?(0,y.jsxs)(i.default,{style:{gap:10},children:[(0,y.jsx)(S,{line:J,clashes:X}),(0,y.jsx)(m.Button,{testID:"block-now-save",label:"Save block",onPress:()=>{const t=r.useBlocks.getState().add({rid:e,date:g,from:P.from,to:P.to,reason:N,note:A.trim()||void 0,by:l,...W});(0,x.pushBlocksToWix)(e,[t.id],'add'),Y(`Saved. ${J.replace(/^Block/,'Blocked')}.`),j(`Saved. ${J}`),_('done')}}),(0,y.jsx)(m.Button,{kind:"ghost",label:"Change",onPress:()=>_('pick')})]}):(0,y.jsxs)(i.default,{style:{gap:12},children:[(0,y.jsx)(m.Muted,{children:"Tip: pick a time, then check the one-line summary before you save. Bookings already made are kept."}),q?(0,y.jsxs)(i.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"block-now-quick",children:[Q.map(e=>(0,y.jsx)(D,{wide:!0,testID:`block-now-${e.id}`,label:e.label,sub:e.w?(0,u.rangeText)(e.w.from,e.w.to):'Not today',disabled:!e.w,selected:!R&&P.label===e.id,onPress:()=>{L(!1),M({...e.w,label:e.id})}},e.id)),(0,y.jsx)(D,{wide:!0,testID:"block-now-custom",label:"From\u2013To",sub:"Pick the times",selected:R,onPress:()=>{L(!0),M({})}})]}):(0,y.jsx)(m.T,{colour:b.colours.amber,children:"Closed for the rest of today. Use Add a block for another day."}),q&&R?(0,y.jsx)(v,{min:w,max:f.to,from:P.from,to:P.to,onChange:(e,t)=>M({from:e,to:t}),testID:"block-now-grid"}):null,q?(0,y.jsx)(I,{rid:e,value:W,onChange:z}):null,q?(0,y.jsx)(T,{value:N,note:A,onChange:E,onNote:F}):null,V?(0,y.jsx)(m.T,{size:16,weight:"semibold",colour:b.colours.goldLight,testID:"block-now-line",children:J}):null,(0,y.jsx)(m.Button,{testID:"block-now-next",label:"Check and save",disabled:!V,onPress:()=>_('confirm')})]})})}function C({value:e,end:t,range:o,min:l,onPick:a,testID:d="block-cal"}){const[r,c]=(0,s.useState)(()=>(e??l).slice(0,7)),g=(0,h.parseYmd)(`${r}-01`),x=(g.getDay()+6)%7,p=[...Array(x).fill(null)];for(let e=new Date(g);e.getMonth()===g.getMonth();e.setDate(e.getDate()+1))p.push((0,h.ymd)(e));const f=e=>{const t=(0,h.parseYmd)(`${r}-01`);t.setMonth(t.getMonth()+e),c((0,h.ymd)(t).slice(0,7))},k=s=>{if(!o||!e||t||sf(-1)}),(0,y.jsx)(m.T,{size:18,weight:"semibold",colour:b.colours.gold,accessibilityRole:"header",children:(0,u.monthLabel)(`${r}-01`)}),(0,y.jsx)(m.Button,{small:!0,kind:"secondary",label:"Later \u203a",accessibilityLabel:"Next month",onPress:()=>f(1)})]}),(0,y.jsx)(i.default,{style:{flexDirection:'row'},children:['Mon','Tue','Wed','Thu','Fri','Sat','Sun'].map(e=>(0,y.jsx)(m.T,{size:13,colour:b.colours.muted,center:!0,style:{flex:1},children:e},e))}),(0,y.jsx)(i.default,{style:{flexDirection:'row',flexWrap:'wrap'},children:p.map((s,o)=>{if(!s)return(0,y.jsx)(i.default,{style:{width:"14.285714285714286%",height:48}},`e${o}`);const a=se&&sk(s),style:{height:46,borderRadius:10,alignItems:'center',justifyContent:'center',backgroundColor:r?b.colours.gold:b.colours.surface2,borderWidth:1,borderColor:r?b.colours.gold:b.colours.border,opacity:a?.3:1},children:(0,y.jsx)(m.T,{size:17,weight:"semibold",colour:r?b.colours.onGold:b.colours.text,children:String((0,h.parseYmd)(s).getDate())})})},s)})})]})}function P({rid:e,r:t,now:o,by:l,onClose:n,wide:a,edit:g,onEdit:p}){const f=(0,h.ymd)(o),$=(0,d.useBookings)(e),B=(0,c.usePlan)(e),[P,M]=(0,s.useState)(g?.date),[R,L]=(0,s.useState)(),[W,z]=(0,s.useState)(!1),[N,E]=(0,s.useState)(g?!!g.wholeDay:null),[A,F]=(0,s.useState)(g&&!g.wholeDay?g.from:void 0),[O,_]=(0,s.useState)(g&&!g.wholeDay?g.to:void 0),[G,Y]=(0,s.useState)(g?{areaId:g.areaId,areaName:g.areaName,tables:g.tables}:{}),[q,H]=(0,s.useState)(g?.reason),[U,K]=(0,s.useState)(g?.note??''),[Q,V]=(0,s.useState)('none'),[J,X]=(0,s.useState)([]),[Z,ee]=(0,s.useState)(),[te,se]=(0,s.useState)(!1),[oe,le]=(0,s.useState)('pick'),[ne,ae]=(0,s.useState)(''),ie=P?(0,u.openWindow)(t,P):null,de=ie?.from??540,re=ie?.to??1380,ce=P?(0,h.parseYmd)(P).getDay():0,ue='weekly'===Q?{kind:'weekly',days:J.length?J:[ce]}:'last'===Q?{kind:'last',weekday:ce}:{kind:'none'},he=P?g?[P]:(0,u.blockDates)(P,W?R:void 0,ue,Z):[],be=N?'00:00':A,ge=N?'23:59':O,me=!!P&&he.length>0&&null!=N&&!!be&&!!ge&&(0,h.toMins)(ge)>(0,h.toMins)(be)&&('none'===Q||!!Z)&&!(G.tables&&!G.tables.length),xe=(0,u.repeatText)(ue,Z),pe=me?(0,u.confirmLine)({dates:he,from:be,to:ge,wholeDay:!!N,today:f,repeat:xe,...G}):'',fe=me?(0,u.bookingsInWindow)($,he,be,ge,G,e=>B.tables.find(t=>t.name===e)?.areaId).filter(e=>e.id!==g?.id).length:0;return(0,y.jsx)(m.Sheet,{visible:!0,onClose:n,title:g?'Edit block':'Add a block',maxWidth:a?760:void 0,testID:"add-block-sheet",children:'done'===oe?(0,y.jsxs)(i.default,{style:{gap:10},accessibilityLiveRegion:"polite",children:[(0,y.jsx)(m.T,{size:19,weight:"semibold",colour:b.colours.gold,testID:"add-block-done",children:ne}),(0,y.jsx)(m.Muted,{children:"It shows in Future blocks. The customer app won't offer these times."}),(0,y.jsx)(m.Button,{label:"Done",onPress:n,testID:"add-block-close"})]}):'confirm'===oe?(0,y.jsxs)(i.default,{style:{gap:10},children:[(0,y.jsx)(S,{line:pe,clashes:fe,testID:"add-block-confirm"}),(0,y.jsx)(m.Button,{testID:"add-block-save",label:g?'Save changes':'Save block',onPress:()=>{const t={from:be,to:ge,wholeDay:!!N||void 0,reason:q,note:U.trim()||void 0,areaId:G.areaId,areaName:G.areaName,tables:G.tables?.length?G.tables:void 0};if(g)return p?.({...t,date:P}),ae(`Saved. ${pe.replace(/^Block/,'Blocked')}.`),void le('done');const s=he.length>1?`s-${Date.now().toString(36)}`:void 0,o=r.useBlocks.getState().addMany(he.map(o=>({rid:e,date:o,by:l,...t,seriesId:s,repeatText:xe??(he.length>1?`${(0,u.longDate)(he[0])} to ${(0,u.longDate)(he[he.length-1])}`:void 0),until:'none'!==Q?Z:void 0})));(0,x.pushBlocksToWix)(e,o.map(e=>e.id),'add'),ae(`Saved. ${pe.replace(/^Block/,'Blocked')}.`),j(`Saved. ${pe}`),le('done')}}),(0,y.jsx)(m.Button,{kind:"ghost",label:"Change",onPress:()=>le('pick')})]}):(0,y.jsxs)(i.default,{style:{gap:12},children:[(0,y.jsx)(m.Muted,{children:"Tip: tap a date (or a first and last date for a range), choose Whole day or the times, then check the summary."}),g?null:(0,y.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,y.jsx)(m.Chip,{testID:"add-single",label:"One date",selected:!W,onPress:()=>{z(!1),L(void 0)}}),(0,y.jsx)(m.Chip,{testID:"add-range",label:"A range of dates",selected:W,onPress:()=>{z(!0),V('none')}})]}),(0,y.jsx)(C,{value:P,end:R,range:W&&!g,min:f,onPick:(e,t)=>{M(e),L(t)}}),P?(0,y.jsx)(m.T,{size:16,weight:"semibold",colour:b.colours.goldLight,testID:"add-dates",children:W&&R?`${(0,u.longDate)(P)} to ${(0,u.longDate)(R)}`:(0,u.longDate)(P)}):null,P?(0,y.jsxs)(i.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,y.jsx)(D,{wide:!0,testID:"add-whole-day",label:"Whole day",selected:!0===N,onPress:()=>E(!0)}),(0,y.jsx)(D,{wide:!0,testID:"add-times",label:"From\u2013To",sub:ie?`Open ${(0,u.rangeText)((0,h.fromMins)(ie.from),(0,h.fromMins)(ie.to))}`:'Closed that day',selected:!1===N,onPress:()=>E(!1)})]}):null,P&&!1===N?(0,y.jsx)(v,{min:de,max:re,from:A,to:O,onChange:(e,t)=>{F(e),_(t)},testID:"add-grid"}):null,P?(0,y.jsx)(I,{rid:e,value:G,onChange:Y}):null,P?(0,y.jsx)(T,{value:q,note:U,onChange:H,onNote:K}):null,!P||g||W?null:(0,y.jsxs)(i.default,{style:{gap:6},testID:"add-repeat",children:[(0,y.jsx)(m.T,{size:15,weight:"semibold",children:"Repeat (optional)"}),(0,y.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,y.jsx)(m.Chip,{testID:"repeat-none",label:"Does not repeat",selected:'none'===Q,onPress:()=>V('none')}),(0,y.jsx)(m.Chip,{testID:"repeat-weekly",label:"Every week",selected:'weekly'===Q,onPress:()=>{V('weekly'),J.length||X([ce])}}),(0,y.jsx)(m.Chip,{testID:"repeat-last",label:`Last ${k[ce]} of the month`,selected:'last'===Q,onPress:()=>V('last')})]}),'weekly'===Q?(0,y.jsx)(m.Row,{wrap:!0,gap:6,children:w.map((e,t)=>(0,y.jsx)(m.Chip,{testID:`repeat-day-${t}`,label:e,selected:J.includes(t),onPress:()=>X(J.includes(t)?J.filter(e=>e!==t):[...J,t])},e))}):null,'none'!==Q?(0,y.jsxs)(i.default,{style:{gap:6},children:[(0,y.jsx)(m.T,{size:15,weight:"semibold",children:"Until (needed)"}),(0,y.jsxs)(m.Row,{wrap:!0,gap:6,children:[[1,3,6,12].map(e=>{const t=(0,h.parseYmd)(P);t.setMonth(t.getMonth()+e);const s=(0,h.ymd)(t);return(0,y.jsx)(m.Chip,{testID:`until-${e}`,label:12===e?'1 year':`${e} month${e>1?'s':''}`,selected:Z===s,onPress:()=>{ee(s),se(!1)}},e)}),(0,y.jsx)(m.Chip,{testID:"until-pick",label:"Pick a date",selected:te,onPress:()=>se(!0)})]}),te?(0,y.jsx)(C,{value:Z,min:(0,u.addDays)(P,1),onPick:e=>ee(e),testID:"until-cal"}):null,Z?(0,y.jsx)(m.Muted,{children:`${xe} \xb7 ${he.length} date${1===he.length?'':'s'}`}):null]}):null]}),me?(0,y.jsx)(m.T,{size:16,weight:"semibold",colour:b.colours.goldLight,testID:"add-line",children:pe}):null,(0,y.jsx)(m.Button,{testID:"add-block-next",label:"Check and save",disabled:!me,onPress:()=>le('confirm')})]})})}function M({b:e,onEdit:t,onRemove:s}){const o=(0,u.whatText)(e);return(0,y.jsxs)(i.default,{testID:`fb-${e.id}`,style:{borderWidth:1,borderColor:b.colours.border,borderRadius:12,padding:12,gap:4,backgroundColor:b.colours.surface2},accessible:!1,children:[(0,y.jsxs)(m.T,{size:17,weight:"semibold",colour:b.colours.goldLight,children:[(0,u.longDate)(e.date)," \xb7 ",(0,u.rangeText)(e.from,e.to,e.wholeDay)]}),(0,y.jsxs)(m.T,{children:[o,e.reason?` \xb7 ${e.reason}`:'',e.note?` \xb7 ${e.note}`:'']}),e.repeatText?(0,y.jsx)(m.Muted,{children:e.repeatText}):null,(0,y.jsxs)(m.Muted,{size:13,children:["Added by ",e.by||'staff',e.editedBy?` \xb7 changed by ${e.editedBy}`:'']}),(0,y.jsxs)(m.Row,{gap:8,children:[(0,y.jsx)(m.Button,{small:!0,kind:"secondary",label:"Edit",accessibilityLabel:`Edit the block on ${(0,u.longDate)(e.date)}`,testID:`fb-edit-${e.id}`,onPress:t}),(0,y.jsx)(m.Button,{small:!0,kind:"ghost",label:"Remove",accessibilityLabel:`Remove the block on ${(0,u.longDate)(e.date)}`,testID:`fb-remove-${e.id}`,onPress:s})]})]})}function R({rid:e,r:t,now:o,by:l,display:n,wide:a}){const d=(0,r.useBlocks)(e=>e.blocks),c=(0,h.ymd)(o),g=(0,u.groupByMonth)(d,e,c,(0,h.hm)(o)),k=(0,s.useMemo)(()=>(0,u.ruleRows)(t,c),[t.id,c]),[w,D]=(0,s.useState)(null),[v,I]=(0,s.useState)(null),[T,S]=(0,s.useState)(''),$=e=>e.seriesId?d.filter(t=>t.seriesId===e.seriesId&&t.date>=c):[e],B=t=>{const s=t.length>1?`${t.length} blocks removed`:`Block on ${(0,u.longDate)(t[0].date)} removed`;if(!n)return t.forEach(e=>r.useBlocks.getState().remove(e.id,l)),(0,x.pushBlocksToWix)(e,t.map(e=>e.id),'remove'),S(`${s}. Bookings are open again for that time.`),j(s),void I(null);(async()=>{for(const e of t){if(!((0,f.isLive)()?await(0,p.displayBlockEdit)(e.id,'remove',{},l):{ok:!0}).ok)return void S('Could not remove it. Try again.');(0,f.isLive)()||r.useBlocks.getState().remove(e.id,l)}(0,x.pushBlocksToWix)(e,t.map(e=>e.id),'remove'),S(`${s}. Bookings are open again for that time.`),j(s),I(null)})()},C=(t,s)=>{if(!n)return r.useBlocks.getState().update(t.id,s,l),void(0,x.pushBlocksToWix)(e,[t.id],'edit');(async()=>{((0,f.isLive)()?await(0,p.displayBlockEdit)(t.id,'edit',s,l):{ok:!0}).ok?((0,f.isLive)()||r.useBlocks.getState().update(t.id,s,l),(0,x.pushBlocksToWix)(e,[t.id],'edit'),S(`Block on ${(0,u.longDate)(s.date??t.date)} changed.`)):S('Could not change it. Try again.')})()},R=[...new Set([...g.map(e=>e.month),...k.map(e=>(0,u.monthLabel)(e.date))])].sort((e,t)=>Date.parse(`1 ${e}`)-Date.parse(`1 ${t}`));return(0,y.jsxs)(i.default,{style:{gap:12},testID:"future-blocks",children:[T?(0,y.jsx)(i.default,{accessibilityLiveRegion:"polite",children:(0,y.jsx)(m.T,{colour:b.colours.goldLight,testID:"fb-msg",children:T})}):null,g.length?null:(0,y.jsx)(m.Muted,{testID:"fb-empty",children:"No blocks coming up. Online and staff bookings are open as normal."}),R.map(e=>{const t=g.find(t=>t.month===e)?.items??[],s=k.filter(t=>(0,u.monthLabel)(t.date)===e);return(0,y.jsxs)(i.default,{style:{gap:8},children:[(0,y.jsx)(m.T,{size:18,weight:"semibold",colour:b.colours.gold,accessibilityRole:"header",children:e}),t.map(e=>(0,y.jsx)(M,{b:e,onEdit:()=>D(e),onRemove:()=>I(e)},e.id)),s.map(e=>(0,y.jsxs)(i.default,{testID:`fb-rule-${e.date}`,style:{borderWidth:1,borderStyle:'dashed',borderColor:b.colours.border,borderRadius:12,padding:10,gap:2},children:[(0,y.jsxs)(m.T,{weight:"semibold",children:[(0,u.longDate)(e.date)," \xb7 ",e.name]}),(0,y.jsxs)(m.Muted,{children:[e.text," \xb7 regular rule, set in Settings \u203a Advanced \u203a Regular events"]})]},`${e.name}-${e.date}`))]},e)}),w?(0,y.jsx)(P,{rid:e,r:t,now:o,by:l,wide:a,edit:w,onClose:()=>D(null),onEdit:e=>C(w,e)}):null,v?(0,y.jsxs)(m.Sheet,{visible:!0,onClose:()=>I(null),title:"Remove this block?",testID:"fb-remove-confirm",children:[(0,y.jsx)(m.T,{size:17,children:`${(0,u.longDate)(v.date)}, ${(0,u.rangeText)(v.from,v.to,v.wholeDay)}, ${(0,u.whatText)(v).toLowerCase()}.`}),(0,y.jsx)(m.Muted,{children:"Bookings open again for that time. The removal is kept in the log."}),(0,y.jsx)(m.Button,{testID:"fb-remove-one",label:$(v).length>1?'Remove this date only':'Remove block',onPress:()=>B([v])}),$(v).length>1?(0,y.jsx)(m.Button,{testID:"fb-remove-series",kind:"secondary",label:`Remove all ${$(v).length} in this series`,onPress:()=>B($(v))}):null,(0,y.jsx)(m.Button,{kind:"ghost",label:"Keep it",onPress:()=>I(null)})]}):null]})}function L({rid:e,r:t,now:o,by:l,display:n,wide:a}){const[d,r]=(0,s.useState)(null);return(0,y.jsxs)(i.default,{style:{gap:12},testID:"blocks-screen",children:[(0,y.jsx)(m.Muted,{children:"Tip: Block now pauses new bookings today. Add a block closes a future date, a time, an area or some tables, once or every week. Existing bookings are always kept."}),(0,y.jsxs)(i.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,y.jsx)(D,{wide:!0,testID:"blocks-now",label:"Block now",sub:"Today",onPress:()=>r('now')}),(0,y.jsx)(D,{wide:!0,testID:"blocks-add",label:"Add a block",sub:"Future dates",onPress:()=>r('add')})]}),(0,y.jsx)(m.T,{size:20,weight:"semibold",children:"Future blocks"}),(0,y.jsx)(R,{rid:e,r:t,now:o,by:l,display:n,wide:a}),'now'===d?(0,y.jsx)(B,{rid:e,r:t,now:o,by:l,wide:a,onClose:()=>r(null)}):null,'add'===d?(0,y.jsx)(P,{rid:e,r:t,now:o,by:l,wide:a,onClose:()=>r(null)}):null]})}function W({rid:e,r:t,now:s,by:o,onBack:n}){return(0,g.useBackLayer)(!0,n),(0,y.jsx)(l.default,{visible:!0,animationType:"fade",onRequestClose:n,children:(0,y.jsxs)(i.default,{style:{flex:1,backgroundColor:b.colours.bg,padding:16},testID:"display-blocks-screen",children:[(0,y.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(g.BackButton,{onPress:n,testID:"display-blocks-back"}),(0,y.jsx)(m.T,{size:22,weight:"semibold",colour:b.colours.gold,children:"Block bookings"}),(0,y.jsx)(i.default,{style:{width:96}})]}),(0,y.jsx)(a.default,{contentContainerStyle:{paddingBottom:40,maxWidth:900,width:'100%',alignSelf:'center'},children:(0,y.jsx)(L,{rid:e,r:t,now:s,by:o,display:!0,wide:!0})})]})})}},1024,[808,30,118,256,263,151,127,819,824,825,1373,818,821,992,813,1374,955,820,24]); +__d(function(g,_r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ANCHORAGE_ID",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"isAnchorage",{enumerable:!0,get:function(){return n}}),e.isBarFridge=r,Object.defineProperty(e,"chefCanSee",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"demoActor",{enumerable:!0,get:function(){return s}}),e.hasRealSignature=c,e.isDemoCard=function(t){return!c(t)&&(['example','sample','demo'].includes(t.origin||'')||s(t.updatedBy))},Object.defineProperty(e,"isSeedChefChat",{enumerable:!0,get:function(){return u}});const t='6349aa07-3fec-46e9-8c69-7b1b08494793',n=n=>'anchorage'===n||n===t;function r(t){if('string'==typeof t)return/\bbar[\s_-]*(?:fridge|refrigerat)|\b(?:fridge|refrigerator)[\s_-]*(?:in[\s_-]*the[\s_-]*)?bar\b|^cp-bar$/i.test(t);if(!t||'object'!=typeof t)return!1;const n=t;return!!r(['name','label','kind','unit','location','storage','storageLocation'].map(t=>n[t]).filter(t=>'string'==typeof t).join(' '))||['id','key','pointId','name','label','unit','location','storage','storageLocation','aliases'].some(t=>Array.isArray(n[t])?n[t].some(r):'string'==typeof n[t]&&r(n[t]))}const o=(t,o)=>!n(t)||!r(o),s=t=>'string'==typeof t&&/(?:\b(?:example|sample|demo)\b)/i.test(t);function c(t){return[t.signOff?.by,t.allergensConfirmed?.by].some(t=>!!t&&!s(t))}const f={'m-seed-all':'Welcome to the team chat on CoverCharge.','m-seed-kitchen':'Kitchen channel: Head Chef, kitchen team and managers.','m-seed-foh':'Front of house channel: front of house, bar and managers.','m-seed-managers':'Managers channel: owners, managers and the supervisor only.'},u=t=>'system'===t.from&&(!!f[t.id]&&f[t.id]===t.text||'m-seed-all'===t.id&&/this phone only/.test(t.text||''))},1025,[]); +__d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"KG_PER_STONE",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"HALF_STONE_KG",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"isFishName",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"fishInStone",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"halfStone",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"toStone",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"fromStone",{enumerable:!0,get:function(){return c}}),e.stoneText=b,e.stoneSpeech=h,Object.defineProperty(e,"fishQtyText",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"fishQtySpeech",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"quantityStep",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"stepQuantity",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"inputQuantity",{enumerable:!0,get:function(){return P}}),Object.defineProperty(e,"quantityUnit",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"displayedCost",{enumerable:!0,get:function(){return k}}),e.parseStoneAmount=function(t){if('number'==typeof t)return Number.isFinite(t)?t:void 0;const n=t.toLowerCase().trim();if(/\b(?:kg|kilos?|kilograms?|grams?)\b/.test(n))return;const i=n.match(/(?:^|\s)(\d+(?:[.,]\d+)?)(\xbd)?(?:\s*(?:stone|st)\b|$)/);if(i)return Number(i[1].replace(',','.'))+(i[2]?.5:0);const o=n.match(/\b(zero|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve|thirteen|fourteen|fifteen|sixteen|seventeen|eighteen|nineteen|twenty)(?: and a half)?(?: stone| st|$)/);return o?l.indexOf(o[1])+(/and a half/.test(o[0])?.5:0):/(?:^|\s)(?:\xbd|(?:a )?half(?: a)?)(?: stone| st|$)/.test(n)?.5:void 0};var t=r(d[0]);const n=6.35029318,i=3.17514659,o=(t="")=>!/\b(?:vegan|vegetarian|banana|blossom|mushroom|sauce|stock|oil)\b|\(vg\)/i.test(t)&&/\b(?:fish|haddock|salmon|cod|hake|halibut|plaice|sole|turbot|trout|mackerel|monkfish|seabass|sea bass|seabream|sea bream|tuna|pollock|coley|whiting|sardines?|anchov(?:y|ies)|herring)\b/i.test(t),u=(n,i)=>(0,t.isAnchorage)(n)&&/^(kg|kilos?|kilograms?|st|stone)$/i.test(i.unit||'')&&o(i.name),s=t=>Math.round(2*(t+Number.EPSILON))/2,f=(t,i="kg")=>/^(st|stone)$/i.test(i)?t:t/n,c=(t,i="kg")=>/^(st|stone)$/i.test(i)?t:t*n;function b(t){const n=s(Math.abs(t)),i=Math.floor(n);return`${t<0&&n?'\u2212':''}${n%1?`${i||''}\xbd`:i} stone`}const l=['zero','one','two','three','four','five','six','seven','eight','nine','ten','eleven','twelve','thirteen','fourteen','fifteen','sixteen','seventeen','eighteen','nineteen','twenty'];function h(t){const n=s(Math.abs(t)),i=Math.floor(n);return`${t<0&&n?'minus ':''}${n%1?i?`${l[i]||i} and a half`:'half a':l[i]||i} stone`}const y=(t,n,i)=>u(t,n)?b(f(i,n.unit)):`${i} ${n.unit||''}`.trim(),p=(t,n,i)=>u(t,n)?h(f(i,n.unit)):y(t,n,i),O=(t,n)=>u(t,n)?c(.5,n.unit):'kg'===n.unit?.5:1,v=(t,n,i,o)=>u(t,n)?c(Math.max(0,s(f(i,n.unit))+.5*o),n.unit):Math.max(0,i+o*O(t,n)),P=(t,n,i)=>u(t,n)?c(s(i),n.unit):i,j=(t,n)=>u(t,n)?'stone':n.unit||'',k=(t,n,i)=>u(t,n)?i*c(1,n.unit):i},1026,[1025]); +__d(function(g,r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useShellStore",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"localShellfish",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"shellfish",{enumerable:!0,get:function(){return E}}),Object.defineProperty(_e,"useStockItems",{enumerable:!0,get:function(){return I}}),_e.venueCounts=w,_e.useShellfish=function(e,t,s){const a=I(e).filter(t=>'chef'!==s||(0,n.chefCanSee)(e,t)),o=_(t=>!!t.server[e]),d=_((0,l.useShallow)(t=>t.events.filter(s=>s.rid===e&&(!t.server[e]||k(s))))),u=_((0,l.useShallow)(t=>w(t,e))),c=(0,f.lastUndoable)(d),v=e=>a.find(t=>t.key===e);return{items:a,events:d,counts:u,undoable:c,synced:o,itemOf:v,isLow:e=>(0,f.isLowItem)(v(e),u[e]??0),sell:(n,a=!1)=>{const o=v(n),d=o&&(0,i.fishInStone)(e,o)?i.HALF_STONE_KG:a?.5:1;return!((u[n]??0){i>0&&E.append({rid:e,kind:n,delta:i,reason:'delivery',by:t,app:s})},recount:(n,i)=>{const a=i-(u[n]??0);a&&E.append({rid:e,kind:n,delta:a,reason:'count',by:t,app:s})},undoLast:()=>{c&&E.append({rid:e,kind:c.kind,delta:-c.delta,reason:'undo',by:t,app:s,undoes:c.id})}}};var e,t=r(_d[0]),s=r(_d[1]),n=r(_d[2]),i=r(_d[3]),a=r(_d[4]),o=r(_d[5]),d=(e=o)&&e.__esModule?e:{default:e};r(_d[6]);var u=r(_d[7]),c=r(_d[8]),l=r(_d[9]),f=r(_d[10]),v=r(_d[11]),p=r(_d[12]);const S=()=>{try{return(0,p.nowFrom)(p.useStore.getState().clock)}catch{return new Date}},h='covercharge-shellfish-v1',y='anchorage',_=(0,u.create)()((0,c.persist)(e=>({events:[],items:a.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD?{}:{[y]:f.ANCHORAGE_STOCK.map(e=>({...e}))},server:{},saveItem:(t,s)=>e(e=>{const n=e.items[t]??[];return{items:{...e.items,[t]:n.some(e=>e.key===s.key)?n.map(e=>e.key===s.key?s:e):[...n,s]}}}),removeItem:(t,s)=>e(e=>({items:{...e.items,[t]:(e.items[t]??[]).filter(e=>e.key!==s)}}))}),{name:h,storage:(0,c.createJSONStorage)(()=>d.default),version:4,partialize:e=>({events:e.events,items:e.items,server:e.server}),migrate:async e=>{t.LIVE_VENUE_BUILD&&e&&await(0,s.archiveChefCache)('tracked-stock',e);const n=e??{};return{events:(i=n.events,(i??[]).filter(e=>!e.id.startsWith('sf-seed-'))),items:n.items??(a.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD?{}:{[y]:f.ANCHORAGE_STOCK.map(e=>({...e}))}),server:n.server??{}};var i}})),b={list:e=>_.getState().events.filter(t=>t.rid===e),append:e=>{const t={...e,id:(0,v.uuid)(),at:e.at??S().toISOString()};return _.setState(e=>({events:[t,...e.events].slice(0,500)})),t},subscribe:e=>_.subscribe(e)},E=b;'undefined'!=typeof window&&window.addEventListener('storage',e=>{e.key===h&&_.persist.rehydrate()});const O=[],I=(e,t=!1)=>{const s=_(t=>t.items[e])??O;return t?s:s.filter(e=>e.active).sort((e,t)=>e.sort-t.sort)},k=e=>!e.id.startsWith('sf-');function w(e,t){const s=e.items[t]??[],n=e.server[t],i=e.events.filter(e=>e.rid===t);if(!n)return(0,f.countsOf)(i,s);const a=new Set(n.seen),o=new Date(Date.now()-2592e5).toISOString();return(0,f.countsOf)(i.filter(e=>k(e)&&!a.has(e.id)&&e.at>=o),s,n.counts)}},1027,[833,1096,1025,1026,5,1082,122,952,1091,873,1029,1034,872]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useOrderSheets",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"useSheets",{enumerable:!0,get:function(){return f}});var e,s=r(d[0]),t=r(d[1]),h=r(d[2]),n=r(d[3]),o=(e=n)&&e.__esModule?e:{default:e},c=r(d[4]),i=r(d[5]),u=r(d[6]);const p=()=>h.IS_ISOLATED_VENUE||s.LIVE_VENUE_BUILD?{}:{anchorage:u.ANCHORAGE_SHEETS.filter(e=>!e.placeholder).map(e=>({...e,items:e.items.map(e=>({...e}))}))},l=(0,c.create)()((0,i.persist)(e=>({sheets:p(),opened:{},upsert:(s,t)=>e(e=>{const h=e.sheets[s]??[];return{sheets:{...e.sheets,[s]:h.some(e=>e.id===t.id)?h.map(e=>e.id===t.id?t:e):[...h,t]}}}),patch:(s,t,h)=>e(e=>({sheets:{...e.sheets,[s]:(e.sheets[s]??[]).map(e=>e.id===t?{...e,...h}:e)}})),remove:(s,t)=>e(e=>({sheets:{...e.sheets,[s]:(e.sheets[s]??[]).filter(e=>e.id!==t)}})),markOpened:(s,t)=>e(e=>({opened:{...e.opened,[s]:t}})),reset:s=>e(e=>({sheets:{...e.sheets,[s]:'anchorage'===s&&p().anchorage||[]}}))}),{name:'covercharge-ordersheets-v1',storage:(0,i.createJSONStorage)(()=>o.default),version:3,migrate:async e=>{const h=e;return s.LIVE_VENUE_BUILD?(await(0,t.archiveChefCache)('order-sheets',h),{...h,sheets:{...h.sheets,anchorage:(h.sheets.anchorage||[]).filter(e=>!('os-veg'===e.id&&e.placeholder))}}):h}})),_=[],f=e=>l(s=>s.sheets[e])??_},1028,[833,1096,5,1082,952,1091,1023]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ANCHORAGE_STOCK",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"stockKey",{enumerable:!0,get:function(){return n}}),_e.countsOf=function(e,t=[],n={}){const s={...n};for(const e of t)s[e.key]=s[e.key]??0;for(const t of e)s[t.kind]=(s[t.kind]??0)+t.delta;const i=new Map(t.map(e=>[e.key,e]));return Object.fromEntries(Object.entries(s).map(([e,t])=>[e,o(i.get(e),t)]))},_e.lastUndoable=function(e){const t=new Set(e.filter(e=>e.undoes).map(e=>e.undoes));return e.find(e=>'undo'!==e.reason&&'count'!==e.reason&&!t.has(e.id))},Object.defineProperty(_e,"fmtCount",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"fmtStockCount",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"speakStockCount",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"isLowItem",{enumerable:!0,get:function(){return c}}),_e.describe=function(e,t){const n=(t?.name??e.kind).toLowerCase(),o=(t?.plural??`${e.kind}s`).toLowerCase(),u=t?i(e.rid,t,Math.abs(e.delta)):s(Math.abs(e.delta));return'delivery'===e.reason?`Delivery in: +${u} ${1===Math.abs(e.delta)?n:o}`:'sold-half'===e.reason?`Sold: half ${n}`:'sold'===e.reason?`Sold: ${u} ${1===Math.abs(e.delta)?n:o}`:'undo'===e.reason?`Undo (${e.delta>0?'+':'\u2212'}${u} ${n})`:`Count: ${u} ${o}`};var e=r(d[0]);const t=[{key:'lobster',name:'Lobster',plural:'Lobsters',unit:'half',lowAt:4,supplierId:'os-kittyfisher',icon:'\ud83e\udd9e',sort:1,active:!0},{key:'crab',name:'Crab',plural:'Crabs',unit:'whole',lowAt:4,supplierId:'os-kittyfisher',icon:'\ud83e\udd80',sort:2,active:!0}],n=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,'-').replace(/^-|-$/g,'').slice(0,40)||'item',o=(e,t)=>Math.max(0,'kg'===e?.unit?t:'half'===e?.unit?Math.round(2*t)/2:Math.round(t));const s=e=>{const t=Math.floor(e);return e-t>=.5?t?`${t}\xbd`:'\xbd':String(t)},i=(t,n,o)=>'kg'===n.unit?(0,e.fishQtyText)(t,n,o):s(o),u=(t,n,o)=>'kg'===n.unit?(0,e.fishQtySpeech)(t,n,o):s(o),c=(e,t)=>t<=(e?.lowAt??4)},1029,[1026]); +__d(function(g,_r,i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.gamesOn=function(){const e=m.useStore.getState().restaurants.find(e=>e.id===p.VENUE_RID);return!1!==e?.settings?.games},_e.usePlayable=v,Object.defineProperty(_e,"LENNY_GAME_URL",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"validGameUrl",{enumerable:!0,get:function(){return I}}),_e.gameBase=function(){const e=m.useStore.getState().restaurants.find(e=>e.id===p.VENUE_RID);return I(e?.settings?.gameUrl)??j},_e.BreakRoomCard=function({staffId:e,name:t,now:s}){const n=(0,m.useStore)(e=>!1!==e.restaurants.find(e=>e.id===p.VENUE_RID)?.settings?.games),[o,l]=(0,r.useState)(!1),c=v(e,s);return n?(0,k.jsxs)(u.Card,{children:[(0,k.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(u.T,{weight:"semibold",children:"\ud83e\uded6 Break room"}),(0,k.jsx)(u.T,{size:13,colour:c?w.colours.ok:w.colours.muted,children:c?'Open':'Opens on your break'})]}),(0,k.jsx)(u.Muted,{children:"Lenny\u2019s Kitchen Chaos, with the team as characters and a shared leaderboard. Playable on a break or when you\u2019re not clocked in."}),(0,k.jsx)(u.Button,{testID:"break-room-open",kind:"secondary",label:"Open the Break room",onPress:()=>l(!0)}),o?(0,k.jsx)(R,{staffId:e,name:t,playable:c,onClose:()=>l(!1)}):null]}):null},Object.defineProperty(_e,"displayName",{enumerable:!0,get:function(){return S}}),_e.BreakRoom=R;var t=_r(_d[0]),r=_r(_d[1]),s=e(r),n=e(_r(_d[2]));_r(_d[3]);var o=e(_r(_d[4])),l=e(_r(_d[5])),c=_r(_d[6]),u=_r(_d[7]),d=_r(_d[8]),f=_r(_d[9]),y=_r(_d[10]),m=_r(_d[11]),p=_r(_d[12]),h=_r(_d[13]),b=_r(_d[14]),w=_r(_d[15]),k=_r(_d[16]);function v(e,t){const r=(0,f.useOwner)(e=>e.attendance);if(!e)return!0;const s=(0,f.openShiftOf)(r,e,t);return!s||(0,f.isOnBreak)(s)}const j='https://lennys-kitchen-chaos-13e285.deed.page/',I=e=>{try{const t=new URL(String(e??'').trim());return'https:'!==t.protocol||t.username||t.password?null:t.toString()}catch{return null}};function x(e){if('undefined'==typeof window)return null;const t=new URL(e);for(const e of['demo','unlock','name','staffId'])t.searchParams.delete(e);return t.searchParams.set('host','covercharge'),t.searchParams.set('hostOrigin',window.location.origin),{src:t.toString(),origin:t.origin}}const S=e=>String(e??'').replace(/\s*\(.*\)$/,'').replace(/\s+/g,' ').trim().slice(0,24).trim();function R({staffId:e,name:v,playable:R,onClose:E}){const C=(0,f.useOwner)(e=>e.staff),T=(0,d.useAvatars)(e=>e.photos),M=(0,y.useSetup)(e=>e.looks),P=(0,r.useRef)(null),[O,L]=(0,r.useState)({}),[U,N]=(0,r.useState)(!1),[_,B]=(0,r.useState)(null),D=(0,m.useStore)(e=>I(e.restaurants.find(e=>e.id===p.VENUE_RID)?.settings?.gameUrl)??j),$=(0,r.useMemo)(()=>x(D),[D]),q=$?.origin??'',A=(0,b.useSync)(e=>'staff'===e.kind?e.staffRef??null:null),z=!(!A||!e||A===e),G=z?null:A??e??null,V=S(v),[H,W]=(0,r.useState)(''),[F,K]=(0,r.useState)(null),Y=(0,r.useRef)(null),J=(0,r.useRef)(0),Q=(0,r.useRef)(null),X=(0,r.useRef)(R);X.current=R;const Z=(0,r.useMemo)(()=>C.filter(e=>e.active&&!e.name.includes('(example)')),[C]);(0,r.useEffect)(()=>{const e=setTimeout(()=>{const e={};for(const t of Z){const r=document.getElementById(`cc-av-${t.id}`)?.querySelector('svg');r&&(e[t.id]=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(r.outerHTML.includes('xmlns')?r.outerHTML:r.outerHTML.replace('clearTimeout(e)},[Z,M]);const ee=(0,r.useMemo)(()=>Z.map(e=>{const t=T[e.id]?.dataUrl??O[e.id],r={id:e.id,name:S(e.name),role:e.job||e.level||e.role};return t&&(r.avatarUrl=t),r}),[Z,T,O]),te=(0,r.useCallback)(e=>{try{q&&P.current?.contentWindow?.postMessage(e,q)}catch{}},[q]);return(0,r.useEffect)(()=>{const e=async e=>{if(!q||e.origin!==q||e.source!==P.current?.contentWindow)return;const t=e.data;if('string'!=typeof t?.type||!t.type.startsWith('lenny:'))return;if('lenny:ready'===t.type)return B('string'==typeof t.version?String(t.version).slice(0,12):null),void N(!0);const r=String(t.levelId??'').slice(0,40);if('lenny:scores:list'===t.type&&te({type:'lenny:scores:result',reqId:t.reqId,result:await(0,h.listScores)(r,Math.min(50,Number(t.limit)||10))}),'lenny:scores:submit'===t.type){const e=t.entry??{};if(!G||'string'==typeof e.staffId&&e.staffId!==G)return void te({type:'lenny:scores:result',reqId:t.reqId,result:{rank:null,entries:await(0,h.listScores)(r,10),id:null}});const s='string'==typeof e.characterId?e.characterId.slice(0,80):void 0;te({type:'lenny:scores:result',reqId:t.reqId,result:await(0,h.submitScore)(r,{score:Number(e.score)||0,stars:Number(e.stars)||0,badges:Array.isArray(e.badges)?e.badges.map(String).slice(0,30):[],stats:'object'==typeof e.stats&&e.stats?e.stats:{},characterId:s,character:'string'==typeof e.character?e.character.slice(0,60):void 0,staffId:G,name:V})})}'lenny:roundAbandoned'===t.type&&W('The last round was stopped because the player changed. No score was saved.'),'lenny:roundStart'===t.type&&W(''),'lenny:progress'===t.type&&G&&t.staffId===G&&(0,h.saveProgress)(G,t.progress),'lenny:gameComplete'===t.type&&G&&t.staffId===G&&W(!0===t.firstTime?'Game complete! Character select is now unlocked.':'Game complete again. Nice work!')};return window.addEventListener('message',e),()=>window.removeEventListener('message',e)},[te,G,V,q]),(0,r.useEffect)(()=>{N(!1),Y.current=null,Q.current=null},[$?.src]),(0,r.useEffect)(()=>{if(!U)return;const e=e=>{Q.current!==e&&(Q.current=e,te({type:'lenny:setPlayable',playable:e}))},t=z?null:`${G??''}|${V}`;if(t&&Y.current===t)return void e(R);const r=++J.current;Y.current=null,Q.current&&e(!1),t&&(0,h.loadProgress)(G).catch(()=>null).then(s=>{r===J.current&&(te({type:'lenny:setPlayer',name:V,staffId:G,...s?{progress:s}:{}}),Y.current=t,e(X.current))})},[U,z,G,V,R,te]),(0,r.useEffect)(()=>{U&&te({type:'lenny:setRoster',staff:ee})},[U,ee,te]),(0,r.useEffect)(()=>{U&&null!==F&&te({type:'lenny:setMuted',muted:F})},[U,F,te]),(0,k.jsx)(n.default,{visible:!0,animationType:"slide",onRequestClose:E,children:(0,k.jsxs)(l.default,{testID:"break-room",style:{flex:1,backgroundColor:(0,t.soutersSurface)('#000')},children:[(0,k.jsxs)(u.Row,{style:{justifyContent:'space-between',padding:10,backgroundColor:w.colours.bg},children:[(0,k.jsx)(u.T,{weight:"semibold",children:"\ud83e\uded6 Break room"}),(0,k.jsx)(l.default,{testID:R&&!z?'break-playable':'break-locked',accessibilityLabel:_?`Game version ${_}`:void 0,children:(0,k.jsx)(u.T,{size:13,colour:R?w.colours.ok:w.colours.gold,children:z?'Switching player\u2026':R?'On your break: enjoy!':'Back to work! Start a break to play.'})}),(0,k.jsxs)(u.Row,{gap:4,children:[(0,k.jsx)(o.default,{testID:"break-room-mute",accessibilityRole:"button",accessibilityLabel:F?'Turn sound and voice on':'Mute sound and voice',onPress:()=>K(!F),style:{padding:6},children:(0,k.jsx)(u.T,{weight:"semibold",colour:w.colours.gold,children:F?'Sound on':'Mute'})}),(0,k.jsx)(o.default,{testID:"break-room-close",accessibilityRole:"button",onPress:E,style:{padding:6},children:(0,k.jsx)(u.T,{weight:"semibold",colour:w.colours.gold,children:"Close"})})]})]}),H?(0,k.jsx)(l.default,{testID:"break-notice",style:{paddingHorizontal:10,paddingVertical:6,backgroundColor:w.colours.surface},children:(0,k.jsx)(u.T,{size:13,colour:w.colours.muted,children:H})}):null,$?s.default.createElement('iframe',{ref:P,src:$.src,key:$.src,title:'Lenny\u2019s Kitchen Chaos','data-testid':'break-game',allow:'autoplay; fullscreen',style:{flex:1,width:'100%',height:'100%',border:0,background:'#000'}}):(0,k.jsx)(l.default,{style:{flex:1,alignItems:'center',justifyContent:'center'},children:(0,k.jsx)(u.Muted,{children:"The Break room opens in the web app."})}),(0,k.jsx)(l.default,{style:{position:'absolute',left:-9999,top:0,width:64,height:64,opacity:0},pointerEvents:"none",children:Z.map(e=>(0,k.jsx)(l.default,{nativeID:`cc-av-${e.id}`,children:(0,k.jsx)(c.AvatarArt,{spec:null!=M[e.id]?(0,c.specFor)(`${e.id}#look${M[e.id]}`):(0,c.specFor)(e.id,e.name),size:96})},e.id))})]})})}},1030,[868,30,256,122,263,127,953,813,1169,856,1170,872,5,1313,820,821,24]); +__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"fmtH",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"fmtHDay",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"SHIFT_MIN_START",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"SHIFT_MAX_END",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"shiftTitle",{enumerable:!0,get:function(){return f}});var t=r(d[0]);const n=t=>{const n=(Math.round(60*t)%1440+1440)%1440;return`${String(Math.floor(n/60)).padStart(2,'0')}:${String(n%60).padStart(2,'0')}`},u=t=>`${n(t)}${t>=24?' (next day)':''}`,o=7,c=28,f=(n,u)=>`${n.replace(' (example)','')} \xb7 ${(0,t.niceDate)((0,t.parseYmd)(u))}`},1031,[818]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SHIFT_MANAGER_PERMS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"SHIFT_MANAGER_FEATURES",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"SHIFT_MANAGER_EXCLUDED",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"SHIFT_MANAGER_EXCLUDED_WORDS",{enumerable:!0,get:function(){return o}}),e.shiftManagerOn=function(n){return!(!n.inStaffApp||!n.managerAccess||'owner'===n.role)&&(n.live?n.perms.includes('shift.manager'):'staff'===n.app)},e.swapTargets=function(n,t){return n.filter(n=>n.active&&n.id!==t&&'owner'!==n.role)};const n=['bookings.manage','floor.manage','stock.manage','attendance.view','rota.swap','shift.manager'],t=['New, edit and cancel bookings; walk-ins; seat, move and finish tables; deposit status','Tables to clear','Block bookings and close the garden','Allergy checks','Sold out (86) and tracked stock','Who\u2019s clocked in','Approve shift swaps and cover'],s=['wages.view','wages.manage','orders.manage','staff.manage','roles.manage','venue.settings','devices.manage','rota.manage','suppliers.manage','suppliers.order','recipes.edit','recipes.signoff','outbox.view'],o='takings, wages, tips and payouts, HR, billing, venue settings and owner access'},1032,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"isLiveVenue",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"useLiveVenue",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"NOT_SET_UP",{enumerable:!0,get:function(){return f}});var t=r(d[0]),n=r(d[1]);const u=n=>!(t.PITCH||'live'!==n.mode&&'offline'!==n.mode||!n.venueId),o=()=>u(n.useSync.getState()),c=()=>(0,n.useSync)(t=>u(t)),f='Not set up yet'},1033,[2,820]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"uuid",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"isUuid",{enumerable:!0,get:function(){return t}});const x=()=>globalThis.crypto&&'randomUUID'in globalThis.crypto?globalThis.crypto.randomUUID():'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g,x=>{const t=16*Math.random()|0;return('x'===x?t:3&t|8).toString(16)}),t=x=>'string'==typeof x&&/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(x)},1034,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.getCameraPermissionsAsync=l,_e.getMediaLibraryPermissionsAsync=y,_e.requestCameraPermissionsAsync=f,_e.requestMediaLibraryPermissionsAsync=b,Object.defineProperty(_e,"useMediaLibraryPermissions",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"useCameraPermissions",{enumerable:!0,get:function(){return w}}),_e.getPendingResultAsync=async function(){if(s.default.getPendingResultAsync)return s.default.getPendingResultAsync();return null},_e.launchCameraAsync=async function(e={}){if(!s.default.launchCameraAsync)throw new n.UnavailabilityError('ImagePicker','launchCameraAsync');const t=(0,o.mapDeprecatedOptions)(e);return await s.default.launchCameraAsync(c(t))},_e.launchImageLibraryAsync=async function(e={}){const t=(0,o.mapDeprecatedOptions)(e);if(!s.default.launchImageLibraryAsync)throw new n.UnavailabilityError('ImagePicker','launchImageLibraryAsync');t?.allowsEditing&&t.allowsMultipleSelection&&console.warn("[expo-image-picker] `allowsEditing` is not supported when `allowsMultipleSelection` is enabled and will be ignored.Disable either 'allowsEditing' or 'allowsMultipleSelection' in 'launchImageLibraryAsync' to fix this warning.");return await s.default.launchImageLibraryAsync(t)},Object.defineProperty(_e,"PermissionStatus",{enumerable:!0,get:function(){return n.PermissionStatus}});var e,n=r(d[0]),t=r(d[1]),s=(e=t)&&e.__esModule?e:{default:e},o=r(d[2]),u=r(d[3]);function c(e){const{aspect:t,quality:s,videoMaxDuration:o}=e;if(null!=t){const[e,s]=t;if(e<=0||s<=0)throw new n.CodedError('ERR_INVALID_ARGUMENT',`Invalid aspect ratio values ${e}:${s}. Provide positive numbers.`)}if(s&&(s<0||s>1))throw new n.CodedError('ERR_INVALID_ARGUMENT',`Invalid 'quality' value ${s}. Provide a value between 0 and 1.`);if(o&&o<0)throw new n.CodedError('ERR_INVALID_ARGUMENT',`Invalid 'videoMaxDuration' value ${o}. Provide a non-negative number.`);return e}async function l(){return s.default.getCameraPermissionsAsync()}async function y(e=!1){return s.default.getMediaLibraryPermissionsAsync(e)}async function f(){return s.default.requestCameraPermissionsAsync()}async function b(e=!1){return(0,s.default.requestMediaLibraryPermissionsAsync)(e)}Object.keys(u).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return u[e]}})});const P=(0,n.createPermissionHook)({getMethod:e=>y(e?.writeOnly),requestMethod:e=>b(e?.writeOnly)}),w=(0,n.createPermissionHook)({getMethod:l,requestMethod:f})},1035,[570,1258,1260,1259]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"hashOf",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"MASS_REMOVE",{enumerable:!0,get:function(){return c}}),_e.quietly=async function(e){l++;try{await e()}finally{l--;for(const e of u)e.resnapshot()}},Object.defineProperty(_e,"isQuiet",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"EntityBridge",{enumerable:!0,get:function(){return f}}),_e.venueChannel=function(e,t,n,s){let o=i().channel(`cc-live:${e}:${Math.random().toString(36).slice(2,8)}`);for(const{table:s,venueColumn:i}of t)o=o.on('postgres_changes',{event:'*',schema:'public',table:s,filter:`${i??'venue_id'}=eq.${e}`},e=>{n(s,'DELETE'===e.eventType?'delete':'upsert','DELETE'===e.eventType?e.old:e.new)});return o.subscribe(e=>s(e)),o},Object.defineProperty(_e,"onConnectivity",{enumerable:!0,get:function(){return t.onConnectivity}});var e=r(d[0]),t=r(d[1]),n=r(d[2]),s=r(d[3]);const i=()=>(0,e.getSupabase)(),o=e=>{if(null===e||'object'!=typeof e)return JSON.stringify(e)??'null';if(Array.isArray(e))return`[${e.map(o).join(',')}]`;const t=e;return`{${Object.keys(t).filter(e=>void 0!==t[e]).sort().map(e=>`${JSON.stringify(e)}:${o(t[e])}`).join(',')}}`},h=e=>{const t=o(e);let n=2166136261;for(let e=0;e>>0;return`${n.toString(36)}.${t.length}`},c=5;let l=0;const u=new Set;const p=()=>l>0;class f{known={};last=new Map;reconciled=!1;applying=!1;massOk=!1;unsub=null;constructor(e,t,n={}){this.spec=e,this.venueId=t,this.ev=n,this.kvKey=`known:${t}:${e.name}`}async start(){this.known=await n.kv.get(this.kvKey,{}),this.snapshotLocal(),u.add(this),this.unsub=this.spec.subscribe(()=>{l>0?this.snapshotLocal():!this.applying&&this.reconciled&&this.pushLocalChanges()})}stop(){this.unsub?.(),this.unsub=null,u.delete(this)}resnapshot(){this.snapshotLocal()}allowMassRemoveOnce(){this.massOk=!0}snapshotLocal(){this.last=new Map(this.spec.list().map(e=>[this.spec.key(e),h(e)]))}saveKnown(){n.kv.set(this.kvKey,this.known)}pending(e){return s.mutationQueue.hasPending(this.spec.table,this.venueId,e)}async read(){let e=i().from(this.spec.table).select('*').eq(this.spec.venueColumn??'venue_id',this.venueId);this.spec.filter&&(e=this.spec.filter(e));const{data:t,error:n}=await e.limit(2e3);if(n)throw n;const s=t??[];this.merge(s,!this.reconciled),this.reconciled=!0,this.spec.afterRead?.(s)}merge(e,t){const n=this.spec,s=new Map(n.list().map(e=>[n.key(e),e])),i=new Set,o=[],l=[],u=[],p=[];for(const t of e){const e=n.rowKey(t),c=n.fromRow(t);if(!c)continue;i.add(e),p.push(c);const l=h(c),f=s.get(e);if(!this.pending(e)){if(f){const t=h(f);if(t===l){this.known[e]=l;continue}if(this.known[e]&&t!==this.known[e]&&n.writable()&&n.syncable(f)){u.push(f);continue}}o.push(c),this.known[e]=l}}for(const[e,t]of s)i.has(e)||this.pending(e)||!n.syncable(t)||n.inWindow&&!n.inWindow(t)||(this.known[e]?l.push(e):n.writable()&&!n.supersededBy?.(t,p)&&u.push(t));const f=this.massOk;if(this.massOk=!1,l.length>c&&!f)this.ev.onSuspect?.(n.name,`read would remove ${l.length} of ${s.size}`),l.length=0,u.length=0;else for(const e of l)delete this.known[e];this.applyRemote(o,l);for(const e of u)this.write(e);this.saveKnown()}applyRemote(e,t){if(e.length||t.length){this.applying=!0;try{this.spec.apply(e,t)}finally{this.applying=!1}this.snapshotLocal(),this.ev.onActivity?.()}}remote(e,t){if(!this.reconciled)return;const n=this.spec,s=n.rowKey(t);if(this.pending(s))return;if('delete'===e){if(!this.last.has(s))return;return delete this.known[s],this.applyRemote([],[s]),this.saveKnown(),void n.onRemote?.(t,e)}const i=n.fromRow(t);if(!i)return;const o=h(i);this.known[s]=o,this.saveKnown(),this.last.get(s)!==o&&this.applyRemote([i],[]),n.onRemote?.(t,e)}pushLocalChanges(){const e=this.spec,t=new Map(e.list().map(t=>[e.key(t),t]));for(const[n,s]of t){const t=h(s);this.last.get(n)!==t&&(this.last.set(n,t),e.syncable(s)&&e.writable()&&this.known[n]!==t&&this.write(s))}const n=[...this.last.keys()].filter(e=>!t.has(e));for(const e of n)this.last.delete(e);const i=e.writable()&&!1!==e.deletes&&'insert'!==e.mode&&'update'!==e.mode?n.filter(e=>this.known[e]):[];if(e.protect&&i.length>c)return this.ev.onSuspect?.(e.name,`${i.length} items vanished at once; not deleted`),void this.saveKnown();for(const t of i)delete this.known[t],s.mutationQueue.enqueue({table:e.table,venueId:this.venueId,kind:'delete',rowKey:t,match:{...this.deleteMatch(t),venue_id:this.venueId}});this.saveKnown()}deleteMatch(e){return this.spec.matchKey?this.spec.matchKey(e):{id:e}}write(e){const t=this.spec,n=t.key(e);let i;try{i=t.toRow(e,this.venueId)}catch(e){return void this.ev.onError?.(t.name,String(e?.message??e))}if(this.known[n]=h(e),'update'===t.mode){const e=t.venueColumn??'venue_id';s.mutationQueue.enqueue({table:t.table,venueId:this.venueId,kind:'update',rowKey:n,values:i,match:{...t.matchKey?t.matchKey(n):{},[e]:this.venueId}})}else s.mutationQueue.enqueue({table:t.table,venueId:this.venueId,kind:'insert'===t.mode?'insert':'upsert',rowKey:n,values:i,conflictKey:t.conflict??'id'});this.ev.onActivity?.()}}},1075,[863,1165,1164,1078]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"cashUpId",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"salesId",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"cashSettingsId",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"defaultCashSettings",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"useCashUp",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"useCashSettings",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"useTipsShow",{enumerable:!0,get:function(){return y}});var t=e(_r(d[0])),s=e(_r(d[1])),r=_r(d[2]),n=_r(d[3]),o=_r(d[4]),u=_r(d[5]),l=_r(d[6]);const c=(e,t)=>(0,o.uuidFrom)(`cashup:${e}:${t}`),p=(e,t)=>(0,o.uuidFrom)(`sales:${e}:${t}`),h=e=>(0,o.uuidFrom)(`cashup-settings:${e}`),f=e=>({id:h(e),cashFields:u.DEFAULT_CASHUP_FIELDS.map(e=>({...e})),salesFields:u.DEFAULT_SALES_FIELDS.map(e=>({...e}))}),S=e=>{const t='number'==typeof e.vals.cashTips?e.vals.cashTips:null,s='number'==typeof e.vals.cardTips?e.vals.cardTips:null;return!e.confirmedAt||null==t&&null==s?null:{rid:e.rid,date:e.date,total:Math.round(100*((t??0)+(s??0)))/100,postedAt:e.confirmedAt,postedBy:e.confirmedBy}},b=(0,r.create)()((0,n.persist)((e,t)=>({cashUps:[],sales:[],tips:[],pot:[],settings:{},show:{},seen:{},saveCashUp:t=>{const s={...t,id:c(t.rid,t.date)},r=S(s);return e(e=>({cashUps:[s,...e.cashUps.filter(e=>e.id!==s.id)],tips:r?[r,...e.tips.filter(e=>!(e.rid===r.rid&&e.date===r.date))]:e.tips})),s},saveSales:t=>{const s={...t,id:p(t.rid,t.weekStart)};return e(e=>({sales:[s,...e.sales.filter(e=>e.id!==s.id)]})),s},setFields:(t,s,r)=>e(e=>({settings:{...e.settings,[t]:{...e.settings[t]??f(t),[s]:r,updatedAt:(new Date).toISOString()}}})),resetFields:t=>e(e=>({settings:{...e.settings,[t]:{...f(t),updatedAt:(new Date).toISOString()}}})),setShow:(t,s)=>e(e=>({show:{...e.show,[t]:{...e.show[t]??{showToday:!0,showPot:!0},...s}}})),addPotEvent:t=>e(e=>({pot:[{...t,id:(0,l.uuid)(),at:(new Date).toISOString()},...e.pot]})),markSeen:(t,s)=>e(e=>({seen:{...e.seen,[t]:s}}))}),{name:'covercharge-cashup-v1',storage:(0,n.createJSONStorage)(()=>s.default),partialize:e=>({...e,cashUps:e.cashUps.map(e=>({...e,photos:e.photos.filter(e=>!e.startsWith('data:'))})),sales:e.sales.map(e=>({...e,photos:e.photos.filter(e=>!e.startsWith('data:'))}))})})),w=e=>{const s=b(t=>t.settings[e])??f(e);return t.default.useMemo(()=>({...s,cashFields:(0,u.withTakingsFields)(s.cashFields)}),[s])},y=e=>b(t=>t.show[e])??{showToday:!0,showPot:!0}},1076,[30,1082,952,1091,1103,1117,1034]); +__d(function(g,_r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useCardStore",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"photoStorageFull",{enumerable:!0,get:function(){return E}}),_e.setStoragePhotoResolver=function(e){j=e},_e.cachePhotoAs=function(e,t){if(C.getState().photos[e]===t)return;C.setState(r=>({photos:{...r.photos,[e]:t}}))},Object.defineProperty(_e,"readLocalPhoto",{enumerable:!0,get:function(){return M}}),Object.defineProperty(_e,"localRecipeCards",{enumerable:!0,get:function(){return $}}),_e.ensureCards=F;var e,t=_r(d[0]),r=_r(d[1]),n=_r(d[2]),s=_r(d[3]),o=_r(d[4]),a=_r(d[5]),c=(e=a)&&e.__esModule?e:{default:e};_r(d[6]);var u=_r(d[7]),l=_r(d[8]),f=_r(d[9]),m=_r(d[10]),h=_r(d[11]),p=_r(d[12]),S=_r(d[13]);const I='covercharge-recipecards-v1',y='covercharge-recipephotos-v1',O=()=>{try{return(0,S.nowFrom)(S.useStore.getState().clock)}catch{return new Date}},b=(0,u.create)()((0,l.persist)(()=>({cards:[],removed:[],log:[]}),{name:I,storage:(0,l.createJSONStorage)(()=>c.default),version:3,migrate:async e=>{const n=e;return t.LIVE_VENUE_BUILD?(await(0,r.archiveChefCache)('recipe-cards',n),{...n,cards:n.cards.filter(e=>!(0,s.isDemoCard)(e)),log:n.log.filter(e=>!(0,s.demoActor)(e.by))}):n}}));let w=!1;const v={getItem:e=>c.default.getItem(e),setItem:async(e,t)=>{try{await c.default.setItem(e,t),w=!1}catch{w=!0}},removeItem:e=>c.default.removeItem(e)},E=()=>w,C=(0,u.create)()((0,l.persist)(()=>({photos:{}}),{name:y,storage:(0,l.createJSONStorage)(()=>v),version:1})),_={lobster:_r(d[14]),skink:_r(d[15]),fishsupper:_r(d[16]),moules:_r(d[17]),stp:_r(d[18])};let A=0;const L=(e,t,r)=>{const n={id:`cl-${Date.now().toString(36)}${(A++).toString(36)}`,cardId:e.id,rid:e.restaurantId,at:O().toISOString(),by:t,text:r};b.setState(e=>({log:[n,...e.log].slice(0,300)}));try{S.useStore.getState().addAudit(e.restaurantId,'menu',`Recipe card: ${e.dish}: ${r} (${t})`)}catch{}},P=e=>b.setState(t=>({cards:t.cards.some(t=>t.id===e.id)?t.cards.map(t=>t.id===e.id?e:t):[...t.cards,e]}));let B=null,D=null;function U(){const e=b.getState().cards,r=t.LIVE_VENUE_BUILD?e.filter(e=>!(0,s.isDemoCard)(e)).map(e=>({...e,signOff:(0,s.demoActor)(e.signOff?.by)?null:e.signOff,allergensConfirmed:(0,s.demoActor)(e.allergensConfirmed?.by)?void 0:e.allergensConfirmed})):e;if(!D||B!==e){B=e;const t=new Map,n=new Map;for(const e of r)t.set(e.restaurantId,[...t.get(e.restaurantId)??[],e]),n.set(e.menuItemId,e);D={cards:r,byRid:t,byItem:n}}return D}const N=[];function V(e){if(!(0,f.canEditCards)(e.role))throw new Error('Only the head chef and managers can edit recipe cards.')}let j=null;const M=e=>C.getState().photos[e],$={mode:'local',list:e=>U().byRid.get(e)??N,get:e=>U().cards.find(t=>t.id===e),byMenuItem:e=>U().byItem.get(e),subscribe:e=>{const t=b.subscribe(e),r=C.subscribe(e);return()=>{t(),r()}},async create(e,t,r){V(r);const n=O().toISOString();k=!0;let s=t.menuItemId;try{s||(s=S.useStore.getState().addMenuItem({restaurantId:e,section:t.section,name:t.dish,description:t.description??'',price:t.price,dietary:[],allergens:t.allergens??{},prepMins:12,soldOut:!1,signOff:null}));const o={id:t.id??(0,f.uuid)(),restaurantId:e,menuItemId:s,dish:t.dish,section:t.section,price:t.price,photo:t.photo,ingredients:t.ingredients??[],steps:t.steps??[],allergens:t.allergens??{},dismissed:t.dismissed??[],allergenNotes:t.allergenNotes,signOff:null,wasLive:!1,origin:'new',version:1,createdAt:n,updatedAt:n,updatedBy:r.name};return b.setState(e=>({cards:[...e.cards.filter(e=>e.menuItemId!==o.menuItemId),o]})),L(o,r.name,'card created, awaiting sign-off'),o}finally{k=!1}},async update(e,t,r){V(r);const n=$.get(e);if(!n)throw new Error('Card not found');const s=(0,f.editCard)(n,t,r.name,O().toISOString());return s.changed&&(P(s.card),L(s.card,r.name,s.resetSignOff?'edited, sign-off reset to Awaiting sign-off':t.confirmAllergens&&1===Object.keys(t).length?'allergens confirmed':'edited')),s.card},async signOff(e,t){if(!(0,f.canSignOffCards)(t.role))throw new Error('Only the head chef can sign off a recipe card.');const r=$.get(e);if(!r)throw new Error('Card not found');const n=(0,f.signOffBlock)(r);if(n)throw new Error(n);const s=(0,f.signOffCard)(r,t.name,O().toISOString());return P(s),L(s,t.name,'signed off'),s},async remove(e,t){V(t);const r=$.get(e);r&&(b.setState(t=>({cards:t.cards.filter(t=>t.id!==e),removed:[...t.removed,r.menuItemId]})),S.useStore.setState(e=>({menu:e.menu.map(e=>e.id===r.menuItemId?{...e,hidden:!0}:e)})),L(r,t.name,'card removed (dish hidden from the menu)'))},async savePhoto(e,t,r){const n=`local:${t}:${Date.now().toString(36)}`;return C.setState(e=>({photos:{...Object.fromEntries(Object.entries(e.photos).filter(([e])=>!e.startsWith(`local:${t}:`))),[n]:r.dataUrl}})),n},photoSource(e){if(!e)return null;if(e.startsWith('asset:'))return _[e.slice(6)]??null;if(e.startsWith('local:')){const t=C.getState().photos[e];return t?{uri:t}:null}if(/^(https?:|data:)/.test(e))return{uri:e};const t=C.getState().photos[e];if(t)return{uri:t};const r=j?.(e);return r?{uri:r}:null}};let k=!1,R=!1;function F(){if(k)return;const e=S.useStore.getState().menu,{cards:r,removed:a}=b.getState(),c=new Set(r.map(e=>e.menuItemId)),u=e.filter(e=>!c.has(e.id)&&!a.includes(e.id));if(!u.length)return;const l=O().toISOString(),f=o.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD||!(0,n.examplesAllowed)()?[]:(0,p.exampleCards)(u),m=new Set(f.map(e=>e.menuItemId)),h=[...f,...u.filter(e=>!m.has(e.id)).map(e=>(0,p.importedCard)(t.LIVE_VENUE_BUILD&&(0,s.demoActor)(e.signOff?.by)?{...e,signOff:null}:e,l))];b.setState(e=>({cards:[...e.cards,...h]}))}(0,h.setMenuCardBridge)({cardFor:e=>U().byItem.get(e),menuItemAdded:e=>{if(k||!R)return;const t=O().toISOString(),r={...(0,p.importedCard)(e,t),id:(0,f.uuid)(),signOff:null,allergensConfirmed:void 0,wasLive:!1,origin:'new',updatedBy:'Added to the menu'};P(r),L(r,r.updatedBy,'card created from the menu, awaiting sign-off')},menuEdited:(e,t,r,n)=>{const s=U().byItem.get(e);if(!s)return;let o=(0,f.editCard)(s,t,r,O().toISOString()).card;n&&o.signOff&&(o={...o,signOff:null,version:o.version+1,updatedAt:O().toISOString(),updatedBy:r}),o!==s&&(P(o),L(o,r,s.signOff&&!o.signOff?'edited from the menu, sign-off reset':'edited from the menu'))},signOff:(e,t)=>{const r=U().byItem.get(e);r&&$.signOff(r.id,{name:t,role:'head-chef'}).catch(()=>{})}}),(0,m.setRecipeCardRepository)($);const x=e=>new Promise(t=>{e.hasHydrated()?t():e.onFinishHydration(()=>t())});Promise.all([x(S.useStore.persist),x(b.persist)]).then(()=>{R=!0,F(),S.useStore.subscribe((e,t)=>{e.menu!==t.menu&&F()})}),'undefined'!=typeof window&&window.addEventListener('storage',e=>{e.key===(0,o.venueKey)(I)&&b.persist.rehydrate(),e.key===(0,o.venueKey)(y)&&C.persist.rehydrate()})},1077,[833,1096,1081,1025,5,1082,122,952,1091,1103,831,1102,1108,872,1109,1110,1111,1112,1113]); +__d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"MutationQueue",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"mutationQueue",{enumerable:!0,get:function(){return l}});var t=_r(d[0]),e=_r(d[1]),s=_r(d[2]);const r='queue:v1',n='queue:failed:v1',h=t=>`${t.table}|${t.venueId}|${t.rowKey}`;class o{items=[];failedItems=[];loaded=null;flushing=null;exec=null;listeners=new Set;onFailure=new Set;onSaved=new Set;retryTimer=null;waitTimer=null;backoffMs=2e3;now=()=>Date.now();constructor(){(0,t.onConnectivity)(t=>{t&&this.flush()})}setExecutor(t){this.exec=t}load(){return this.loaded||(this.loaded=(async()=>{const t=await e.kv.get(r,[]);this.items=[...t.map(t=>({...t,nextAt:void 0})),...this.items],this.failedItems=await e.kv.get(n,[]),this.emit()})()),this.loaded}get pending(){return this.items}get waiting(){return this.items.filter(t=>t.attempts>0)}get failed(){return this.failedItems}hasPending(t,e,s){return this.items.some(r=>r.table===t&&r.venueId===e&&r.rowKey===s)}async enqueue(t){await this.load();const s={...t,id:(0,e.uuid)(),createdAt:(new Date).toISOString(),attempts:0};return this.items.push(s),await this.persist(),this.flush(),s}nextReady(){const t=new Set,e=this.now();for(const s of this.items){const r=h(s);if(!t.has(r)){if(!(s.nextAt&&s.nextAt>e))return s;t.add(r)}}}remove(t){this.items=this.items.filter(e=>e!==t)}flush(){return this.flushing||(this.flushing=(async()=>{for(await this.load();this.exec;){const e=this.nextReady();if(!e)break;if(!(0,t.isOnline)()){this.scheduleRetry();break}try{const t=await this.exec(e);this.remove(e),this.backoffMs=2e3,'conflict'===t?this.fail(e,'conflict','Row changed on the server (version conflict) or is not visible to you'):this.onSaved.forEach(t=>t(e))}catch(r){e.attempts+=1,e.lastError=String(r?.message??r);const n=r??{};e.lastErr={code:n.code?String(n.code):void 0,status:Number(n.status)||void 0,message:e.lastError.slice(0,300)};const h=(0,s.classifyWriteError)(r);if('network'===h){e.attempts-=1,(0,t.setOnline)(!1),this.scheduleRetry(),await this.persist();break}'retry'===h?e.nextAt=this.now()+(0,s.retryDelayMs)(e.attempts):(this.remove(e),this.fail(e,'rejected',e.lastError))}await this.persist()}this.flushing=null,this.scheduleWaiting()})()),this.flushing}retryNow(){for(const t of this.items)t.nextAt=void 0;return this.flush()}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}onFailed(t){return this.onFailure.add(t),()=>{this.onFailure.delete(t)}}onDone(t){return this.onSaved.add(t),()=>{this.onSaved.delete(t)}}async clearFailed(){this.failedItems=[],await e.kv.set(n,[]),this.emit()}fail(t,s,r){const h={...t,lastError:r,failedAt:(new Date).toISOString(),reason:s};this.failedItems=[h,...this.failedItems].slice(0,100),e.kv.set(n,this.failedItems),this.onFailure.forEach(t=>t(h))}scheduleWaiting(){this.waitTimer&&(clearTimeout(this.waitTimer),this.waitTimer=null);const t=this.items.map(t=>t.nextAt??0).filter(t=>t>0);if(!t.length)return;const e=Math.max(500,Math.min(...t)-this.now());this.waitTimer=setTimeout(()=>{this.waitTimer=null,this.flush()},e)}scheduleRetry(){if(this.retryTimer)return;const e=this.backoffMs;this.backoffMs=Math.min(2*this.backoffMs,6e4),this.retryTimer=setTimeout(()=>{this.retryTimer=null,(0,t.setOnline)(!0),this.flush()},e)}async persist(){await e.kv.set(r,this.items),this.emit()}emit(){this.listeners.forEach(t=>t())}}const l=new o},1078,[1165,1164,1168]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SUPABASE_URL",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"SUPABASE_ANON_KEY",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"isSupabaseConfigured",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"REALTIME_TABLES",{enumerable:!0,get:function(){return s}});var t=r(d[0]);const n="https://rowdoidkftriylijobuy.supabase.co",o="sb_publishable_rPm723MQz6FwmFVHy6e1SA_ko-_-6GR",u=()=>!t.PITCH&&n.startsWith('https://')&&o.length>20,s=['bookings','walk_ins','blocks','table_plans','takeaway_orders','stock_counts']},1079,[2]); +__d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.pushState=f,e.turnOnPush=async function(){const u=await f();if('ios-home-screen'===u)return{ok:!1,message:'On iPhone, add this app to your Home Screen first (Share \u203a Add to Home Screen, iOS 16.4 or later), then open it from there.'};if('unsupported'===u)return{ok:!1,message:'This browser can\u2019t get phone notifications. Try Chrome on Android, or the app from your iPhone Home Screen.'};if('blocked'===u)return{ok:!1,message:'Notifications are blocked for this app. Allow them in your phone\u2019s settings, then try again.'};const c=i.useSync.getState();if('staff'!==c.kind||!c.venueId||!c.staffRef)return{ok:!1,message:'Sign in from your personal link first.'};if('granted'!==await Notification.requestPermission())return{ok:!1,message:'You didn\u2019t allow notifications, so nothing changed.'};const p=await navigator.serviceWorker.ready,h=(await p.pushManager.getSubscription()??await p.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:s(n.VAPID_PUBLIC_KEY)})).toJSON();if(!h.endpoint||!h.keys?.p256dh||!h.keys?.auth)return{ok:!1,message:'Your browser didn\u2019t give a usable subscription. Try again.'};const l=(0,t.getSupabase)(),{error:y}=await l.from('push_subscriptions').upsert({venue_id:c.venueId,staff_ref:c.staffRef,app:o.APP_VARIANT,endpoint:h.endpoint,p256dh:h.keys.p256dh,auth:h.keys.auth,user_agent:navigator.userAgent.slice(0,200)},{onConflict:'user_id,endpoint'});return y?{ok:!1,message:`Couldn\u2019t save this phone: ${y.message}`}:{ok:!0,message:'Phone notifications are on for this device.'}},e.turnOffPush=async function(){const n=await(navigator.serviceWorker?.getRegistration()),i=await(n?.pushManager.getSubscription());if(!i)return{ok:!0,message:'Phone notifications are off for this device.'};const o=i.endpoint;await i.unsubscribe();try{const n=(0,t.getSupabase)();await n.from('push_subscriptions').delete().eq('endpoint',o)}catch{}return{ok:!0,message:'Phone notifications are off for this device.'}};var n=r(d[0]),t=r(d[1]),i=r(d[2]),o=r(d[3]);const s=n=>{const t=atob(n.replace(/-/g,'+').replace(/_/g,'/')+'='.repeat((4-n.length%4)%4)),i=new Uint8Array(t.length);for(let n=0;n'undefined'!=typeof navigator&&/iPhone|iPad|iPod/.test(navigator.userAgent),c=()=>'undefined'!=typeof window&&(window.matchMedia?.('(display-mode: standalone)').matches||!0===navigator.standalone);async function f(){if('undefined'==typeof window||!('serviceWorker'in navigator))return'unsupported';if(!('PushManager'in window)||'undefined'==typeof Notification)return u()&&!c()?'ios-home-screen':'unsupported';if('denied'===Notification.permission)return'blocked';const n=await navigator.serviceWorker.getRegistration();return await(n?.pushManager.getSubscription())?'on':'off'}},1080,[1248,863,820,806]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.setLiveData=c,e.requireRealData=function(){t=!0,c(!0)},Object.defineProperty(e,"liveData",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"examplesAllowed",{enumerable:!0,get:function(){return l}}),e.onDataModeChange=function(n){return s.add(n),()=>{s.delete(n)}},Object.defineProperty(e,"EXAMPLE_LABEL",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"notEnoughTip",{enumerable:!0,get:function(){return b}});const n=['anchorage','souters','kirkmichael','wildings','kirkton','abbotsford','greenside',"3idiots","cecchinis","mrbasrais","yasmins","williewastles","rupeeroom","smokinggoat","pizzaioli","drunkencoo"].includes("wildings");let t=n,o=n;const s=new Set;function c(n){o!==(n=t||n)&&(o=n,s.forEach(n=>n()))}const u=()=>o,l=()=>!o;const f='Example figures',b=n=>`Forecasts start once CoverCharge has ${1===n?'1 week':`${n} weeks`} of your bookings and cash-ups.`},1081,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return f}});var e,t=r(d[0]),u=(e=t)&&e.__esModule?e:{default:e},n=r(d[1]),f={getItem:e=>u.default.getItem((0,n.venueKey)(e)),setItem:(e,t)=>u.default.setItem((0,n.venueKey)(e),t),removeItem:e=>u.default.removeItem((0,n.venueKey)(e))}},1082,[1083,5]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useAsyncStorage",{enumerable:!0,get:function(){return n.useAsyncStorage}}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return o}});var e,t=r(d[0]),u=(e=t)&&e.__esModule?e:{default:e},n=r(d[1]),o=u.default},1083,[1084,1088]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return i}});var e,t=r(d[0]);const o=((e=t)&&e.__esModule?e:{default:e}).default.bind({concatArrays:!0,ignoreUndefined:!0});function n(e,t){const n=window.localStorage.getItem(e);if(n){const l=JSON.parse(n),c=JSON.parse(t),s=JSON.stringify(o(l,c));window.localStorage.setItem(e,s)}else window.localStorage.setItem(e,t)}function l(e,t){return new Promise((o,n)=>{try{const n=e();t?.(null,n),o(n)}catch(e){t?.(e),n(e)}})}function c(e,t,o){return Promise.all(e).then(e=>{const n=o?.(e)??null;return t?.(null,n),Promise.resolve(n)},e=>(t?.(e),Promise.reject(e)))}const s={getItem:(e,t)=>l(()=>window.localStorage.getItem(e),t),setItem:(e,t,o)=>l(()=>window.localStorage.setItem(e,t),o),removeItem:(e,t)=>l(()=>window.localStorage.removeItem(e),t),mergeItem:(e,t,o)=>l(()=>n(e,t),o),clear:e=>l(()=>window.localStorage.clear(),e),getAllKeys:e=>l(()=>{const e=window.localStorage.length,t=[];for(let o=0;o{},multiGet:(e,t)=>c(e.map(e=>s.getItem(e)),t,t=>t.map((t,o)=>[e[o],t])),multiSet:(e,t)=>c(e.map(e=>s.setItem(e[0],e[1])),t),multiRemove:(e,t)=>c(e.map(e=>s.removeItem(e)),t),multiMerge:(e,t)=>c(e.map(e=>s.mergeItem(e[0],e[1])),t)};var i=s},1084,[1085]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u}});var e,t=r(d[0]),u=((e=t)&&e.__esModule?e:{default:e}).default},1085,[1086]); +__d(function(g,r,i,a,m,e,d){'use strict';const t=r(d[0]),{hasOwnProperty:n}=Object.prototype,{propertyIsEnumerable:o}=Object,c=(t,n,o)=>Object.defineProperty(t,n,{value:o,writable:!0,enumerable:!0,configurable:!0}),s=this,f={concatArrays:!1,ignoreUndefined:!1},l=t=>{const c=[];for(const o in t)n.call(t,o)&&c.push(o);if(Object.getOwnPropertySymbols){const n=Object.getOwnPropertySymbols(t);for(const s of n)o.call(t,s)&&c.push(s)}return c};function u(n){return Array.isArray(n)?y(n):t(n)?p(n):n}function y(t){const n=t.slice(0,0);return l(t).forEach(o=>{c(n,o,u(t[o]))}),n}function p(t){const n=null===Object.getPrototypeOf(t)?Object.create(null):{};return l(t).forEach(o=>{c(n,o,u(t[o]))}),n}const b=(t,n,o,s)=>(o.forEach(o=>{void 0===n[o]&&s.ignoreUndefined||(o in t&&t[o]!==Object.getPrototypeOf(t)?c(t,o,h(t[o],n[o],s)):c(t,o,u(n[o])))}),t),O=(t,o,s)=>{let f=t.slice(0,0),y=0;return[t,o].forEach(o=>{const p=[];for(let s=0;s!p.includes(t)),s)}),f};function h(n,o,c){return c.concatArrays&&Array.isArray(n)&&Array.isArray(o)?O(n,o,c):t(o)&&t(n)?b(n,o,l(o),c):u(o)}m.exports=function(...n){const o=h(u(f),this!==s&&this||{},f);let c={_:{}};for(const s of n)if(void 0!==s){if(!t(s))throw new TypeError('`'+s+'` is not an Option Object');c=h(c,{_:s},o)}return c._}},1086,[1087]); +__d(function(g,r,i,a,m,e,d){'use strict';m.exports=t=>{if('[object Object]'!==Object.prototype.toString.call(t))return!1;const o=Object.getPrototypeOf(t);return null===o||o===Object.prototype}},1087,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.useAsyncStorage=function(e){return{getItem:(...t)=>u.default.getItem(e,...t),setItem:(...t)=>u.default.setItem(e,...t),mergeItem:(...t)=>u.default.mergeItem(e,...t),removeItem:(...t)=>u.default.removeItem(e,...t)}};var e,t=r(d[0]),u=(e=t)&&e.__esModule?e:{default:e}},1088,[1084]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"createStore",{enumerable:!0,get:function(){return n}});const t=t=>{let n;const c=new Set,o=(t,o)=>{const s="function"==typeof t?t(n):t;if(!Object.is(s,n)){const t=n;n=(null!=o?o:"object"!=typeof s||null===s)?s:Object.assign({},n,s),c.forEach(c=>c(n,t))}},s=()=>n,u={setState:o,getState:s,getInitialState:()=>l,subscribe:t=>(c.add(t),()=>c.delete(t))},l=n=t(o,s,u);return u},n=n=>n?t(n):t},1089,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"create",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"useStore",{enumerable:!0,get:function(){return o}});var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},u=r(d[1]);const c=e=>e;function o(e,t=c){const u=n.default.useSyncExternalStore(e.subscribe,n.default.useCallback(()=>t(e.getState()),[e,t]),()=>t(e.getInitialState()));return n.default.useDebugValue(u),u}const s=e=>{const t=(0,u.createStore)(e),n=e=>o(t,e);return Object.assign(n,t),n},l=e=>e?s(e):s},1090,[30,1089]); +__d(function(g,_r,i,_a3,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"combine",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"createJSONStorage",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"devtools",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"persist",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"redux",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"subscribeWithSelector",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"unstable_ssrSafe",{enumerable:!0,get:function(){return S}});const e=(e,t)=>(n,r,o)=>(o.dispatch=t=>(n(n=>e(n,t),!1,t),t),o.dispatchFromDevtools=!0,{dispatch:(...e)=>o.dispatch(...e),...t}),t=e=>!!e.dispatchFromDevtools&&"function"==typeof e.dispatch,n=new Map,r=e=>{const t=n.get(e);return t?Object.fromEntries(Object.entries(t.stores).map(([e,t])=>[e,t.getState()])):{}},o=(e,t,r)=>{if(void 0===e)return{type:"untracked",connection:t.connect(r)};const o=n.get(r.name);if(o)return{type:"tracked",store:e,...o};const s={connection:t.connect(r),stores:{}};return n.set(r.name,s),{type:"tracked",store:e,...s}},s=(e,t,r)=>{if(void 0===t)return;const o=n.get(e);(null==o?void 0:o.stores[t])===r&&(delete o.stores[t],0===Object.keys(o.stores).length&&n.delete(e))},a=/^at (?:new |async )?(.+?) \(/,l=/^([^@]+)@/;function c(e){var t,n,r;if(!e)return;const o=e.split("\n"),s=o.findIndex(e=>e.includes("api.setState"));if(s<0)return;const c=(null==(t=o[s+1])?void 0:t.trim())||"";return(null==(n=a.exec(c))?void 0:n[1])||(null==(r=l.exec(c))?void 0:r[1])}const u=(e,a={})=>(l,u,p)=>{const{enabled:f,anonymousActionType:y,store:h,...b}=a;let S;try{S=(null!=f?f:"production"!==(globalThis.__ExpoImportMetaRegistry.env?globalThis.__ExpoImportMetaRegistry.env.MODE:void 0))&&window.__REDUX_DEVTOOLS_EXTENSION__}catch(e){}if(!S)return e(l,u,p);const{connection:O,..._}=o(h,S,b);let w,E=!0;p.setState=(e,t,n)=>{const o=l(e,t);if(!E)return o;const s=void 0===n?{type:y||c((new Error).stack)||"anonymous"}:"string"==typeof n?{type:n}:n;return void 0===h?(null==O||O.send(s,u()),o):(null==O||O.send({...s,type:`${h}/${s.type}`},{...r(b.name),[h]:p.getState()}),o)},p.devtools={cleanup:()=>{null==w||w(),w=void 0,s(b.name,h,p),void 0!==h&&n.has(b.name)||!O||"function"!=typeof O.unsubscribe||O.unsubscribe()}};const I=(...e)=>{const t=E;E=!1,l(...e),E=t},j=e(p.setState,u,p);if("untracked"===_.type?null==O||O.init(j):(_.stores[_.store]=p,null==O||O.init(Object.fromEntries(Object.entries(_.stores).map(([e,t])=>[e,e===_.store?j:t.getState()])))),t(p)){let e=!1;const t=p.dispatch;p.dispatch=(...n)=>{"production"===(globalThis.__ExpoImportMetaRegistry.env?globalThis.__ExpoImportMetaRegistry.env.MODE:void 0)||"__setState"!==n[0].type||e||(console.warn('[zustand devtools middleware] "__setState" action type is reserved to set state from the devtools. Avoid using it.'),e=!0),t(...n)}}return w=O.subscribe(e=>{var n;const o="object"==typeof b.serialize?b.serialize.reviver:void 0;switch(e.type){case"ACTION":return"string"!=typeof e.payload?void console.error("[zustand devtools middleware] Unsupported action format"):v(e.payload,o,e=>{if("__setState"===e.type){if(void 0===h)return void I(e.state);1!==Object.keys(e.state).length&&console.error("\n [zustand devtools middleware] Unsupported __setState action format.\n When using 'store' option in devtools(), the 'state' should have only one key, which is a value of 'store' that was passed in devtools(),\n and value of this only key should be a state object. Example: { \"type\": \"__setState\", \"state\": { \"abc123Store\": { \"foo\": \"bar\" } } }\n ");const t=e.state[h];if(null==t)return;return void(JSON.stringify(p.getState())!==JSON.stringify(t)&&I(t))}t(p)&&p.dispatch(e)});case"DISPATCH":switch(e.payload.type){case"RESET":return I(j),void 0===h?null==O?void 0:O.init(p.getState()):null==O?void 0:O.init(r(b.name));case"COMMIT":return void 0===h?void(null==O||O.init(p.getState())):null==O?void 0:O.init(r(b.name));case"ROLLBACK":return v(e.state,o,e=>{if(void 0===h)return I(e),void(null==O||O.init(p.getState()));I(e[h]),null==O||O.init(r(b.name))});case"JUMP_TO_STATE":case"JUMP_TO_ACTION":return v(e.state,o,e=>{void 0!==h?JSON.stringify(p.getState())!==JSON.stringify(e[h])&&I(e[h]):I(e)});case"IMPORT_STATE":{const{nextLiftedState:t}=e.payload,r=null==(n=t.computedStates.slice(-1)[0])?void 0:n.state;if(!r)return;return I(void 0===h?r:r[h]),void(null==O||O.send(null,t))}case"PAUSE_RECORDING":return E=!E}return}}),j},v=(e,t,n)=>{let r;try{r=JSON.parse(e,t)}catch(e){console.error("[zustand devtools middleware] Could not parse the received json",e)}void 0!==r&&n(r)},p=e=>(t,n,r)=>{const o=r.subscribe;r.subscribe=(e,t,n)=>{let s=e;if(t){const o=(null==n?void 0:n.equalityFn)||Object.is;let a=e(r.getState());s=n=>{const r=e(n);if(!o(a,r)){const e=a;t(a=r,e)}},(null==n?void 0:n.fireImmediately)&&t(a,a)}return o(s)};return e(t,n,r)};function f(e,t){return(...n)=>Object.assign({},e,t(...n))}function y(e,t){let n;try{n=e()}catch(e){return}return{getItem:e=>{var r;const o=e=>null===e?null:JSON.parse(e,null==t?void 0:t.reviver),s=null!=(r=n.getItem(e))?r:null;return s instanceof Promise?s.then(o):o(s)},setItem:(e,r)=>n.setItem(e,JSON.stringify(r,null==t?void 0:t.replacer)),removeItem:e=>n.removeItem(e)}}const h=e=>t=>{try{const n=e(t);return n instanceof Promise?n:{then:e=>h(e)(n),catch(e){return this}}}catch(e){return{then(e){return this},catch:t=>h(t)(e)}}},b=(e,t)=>(n,r,o)=>{let s={storage:y(()=>window.localStorage),partialize:e=>e,version:0,merge:(e,t)=>({...t,...e}),...t},a=!1,l=0;const c=new Set,u=new Set;let v=s.storage;if(!v)return e((...e)=>{console.warn(`[zustand persist middleware] Unable to update item '${s.name}', the given storage is currently unavailable.`),n(...e)},r,o);const p=()=>{const e=s.partialize({...r()});return v.setItem(s.name,{state:e,version:s.version})},f=o.setState;o.setState=(...e)=>(f(...e),p());const b=e((...e)=>(n(...e),p()),r,o);let S;o.getInitialState=()=>b;const O=()=>{var e,t;if(!v)return;const o=++l;a=!1,c.forEach(e=>{var t;return e(null!=(t=r())?t:b)});const f=(null==(t=s.onRehydrateStorage)?void 0:t.call(s,null!=(e=r())?e:b))||void 0;return h(v.getItem.bind(v))(s.name).then(e=>{if(e){if("number"!=typeof e.version||e.version===s.version)return[!1,e.state];if(s.migrate){const t=s.migrate(e.state,e.version);return t instanceof Promise?t.then(e=>[!0,e]):[!0,t]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}return[!1,void 0]}).then(e=>{var t;if(o!==l)return;const[a,c]=e;return S=s.merge(c,null!=(t=r())?t:b),n(S,!0),a?p():void 0}).then(()=>{o===l&&(null==f||f(r(),void 0),S=r(),a=!0,u.forEach(e=>e(S)))}).catch(e=>{o===l&&(null==f||f(void 0,e))})};return o.persist={setOptions:e=>{s={...s,...e},e.storage&&(v=e.storage)},clearStorage:()=>{++l,null==v||v.removeItem(s.name)},getOptions:()=>s,rehydrate:()=>O(),hasHydrated:()=>a,onHydrate:e=>(c.add(e),()=>{c.delete(e)}),onFinishHydration:e=>(u.add(e),()=>{u.delete(e)})},s.skipHydration||O(),S||b};function S(e,t="undefined"==typeof window){return(n,r,o)=>{if(!t)return e(n,r,o);const s=()=>{throw new Error("Cannot set state of Zustand store in SSR")};return o.setState=s,e(s,r,o)}}},1091,[]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"WILDINGS_LOCATION",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"WILDINGS_ADDRESS",{enumerable:!0,get:function(){return t}}),e.withWildingsAddress=function(r){return'wildings'===r.id?{...r,location:n,address:t}:r},e.withWildingsQuestionnaireAddress=function(n,r){return'wildings'===n&&r?{...r,venue:{...r.venue,address:t}}:r};const n='Maidens, KA26 9NR',t='Maidens Road, Maidens, KA26 9NR'},1092,[]); +__d(function(g,r,_i,_a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.sampleFingerprint=i,e.stripOwnerLiveSamples=function(n){const a={};for(const[s,o]of Object.entries(t.OWNER_SAMPLE_HASHES)){const t=n[s]||[];a[s]=t.filter(t=>!o.includes(i(t)))}a.chat=(n.chat||[]).filter(t=>!(0,s.isSeedChefChat)(t));const o=(n.changeRequests||[]).length-a.changeRequests.length;o&&(a.changesUsed=Math.max(0,(n.changesUsed||0)-o));return a},e.stripCoreLiveSamples=function(a){const c={...(0,n.stripCoreChefSamples)(a)};c.giftCards=(a.giftCards||[]).filter(s=>!t.CORE_SAMPLE_HASHES.giftCards.includes(i(s))),c.stampCards=(a.stampCards||[]).filter(s=>!t.CORE_SAMPLE_HASHES.stampCards.includes(i(s))),c.ratings=(a.ratings||[]).filter(t=>!(/^rt-[123]$/.test(t.id)&&(0,s.demoActor)(t.customerName))),i(a.customer)===t.LEGACY_CUSTOMER_HASH&&(c.customer={...a.customer,id:'',name:'',email:'',phone:'',allergies:[],allergyConsent:!1,referralCode:'',marketingOptIn:{}});return c.restaurants=(a.restaurants||[]).filter(t=>!('saltmarsh'===t.id&&['The Venue','Saltmarsh Bistro'].includes(t.name))),c.menu=(c.menu||a.menu||[]).filter(t=>'saltmarsh'!==t.restaurantId).map(t=>t.signOff?t:o(t)),c};var t=r(d[0]),s=r(d[1]),n=r(d[2]);const a=t=>Array.isArray(t)?t.map(a):t&&'object'==typeof t?Object.fromEntries(Object.entries(t).filter(([,t])=>void 0!==t&&'function'!=typeof t).sort(([t],[s])=>ts?1:0).map(([t,s])=>[t,a(s)])):t;function i(t){const s=JSON.stringify(a(t))??"null";let n=2166136261;for(let t=0;t>>0).toString(16)}const o=t=>Array.isArray(t)?t.map(o):t&&'object'==typeof t?Object.fromEntries(Object.entries(t).map(([t,s])=>[t,'allergenNotes'===t&&'string'==typeof s&&/\(example\)/i.test(s)?'':o(s)])):t},1093,[1094,1025,1095]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"OWNER_SAMPLE_HASHES",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"CORE_SAMPLE_HASHES",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"LEGACY_CUSTOMER_HASH",{enumerable:!0,get:function(){return b}});const c={referrals:["43f09bc0","c438fbad","96bf8c62","3399d421"],coats:["f51097ad","2f7efa3a"],merch:["ef6e14e","dbbc0999","dc233c1d"],merchOrders:["13b15512","bc27f242"],offers:["ad0fcde0","59e6c0cf"],photos:["53a60fd9","ab778a74","95de43cd"],changeRequests:["81c5be12","6819542c"],lost:["5bbf0d77","7d3aa9ed","850c049e"],campaigns:["9cdf8346","82150e7"],suppliers:["41df06e7","466e32ac","fa3d8eea","dfafa674","1e26fbd0","c195b120","5fc49e74","6aa8b0af","602fc2e4"],supplierOrders:["22636226","464d6a6a"]},f={giftCards:["b1bba36d","f029bc0e"],stampCards:["e7bedf6f","a3c8404d"]},b="4b1e9971"},1094,[]); +__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.stripCoreChefSamples=function(n){return{bookings:(n.bookings||[]).filter(n=>!((0,e.isAnchorage)(n.restaurantId)&&t[n.id]===n.name)),orders:(n.orders||[]).filter(t=>!((0,e.isAnchorage)(t.restaurantId)&&('ord-seed-1'===t.id&&'R. Gilmour'===t.customerName||'ord-seed-2'===t.id&&'Table 3 guest'===t.customerName))),waitlist:(n.waitlist||[]).filter(t=>!((0,e.isAnchorage)(t.restaurantId)&&('wl-1'===t.id&&'Paterson'===t.name||'wl-2'===t.id&&'Duncan'===t.name))),menu:(n.menu||[]).map(t=>(0,e.isAnchorage)(t.restaurantId)&&(0,e.demoActor)(t.signOff?.by)?{...t,signOff:null}:t),events:(n.events||[]).filter(e=>!(e.example&&('anchorage'===e.restaurantId||null===e.restaurantId))),audit:(n.audit||[]).filter(e=>!('anchorage'===e.restaurantId&&/Example sign-off \(demo\)/i.test(e.text)))}};var e=r(d[0]);const t={'bk-101':'Campbell','bk-102':'Fraser','bk-103':'McLeod','bk-104':'Kerr','bk-105':'Wallace','bk-106':'Boyd','bk-107':'Hamilton','bk-108':'Stewart','bk-109':'Murray'}},1095,[1025]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.archiveChefCache=async function(e,t){const n=JSON.stringify(t);let o=2166136261;for(let e=0;e>>0).toString(16)}`;const c=await i.default.getItem(s);if(c){if(JSON.stringify(JSON.parse(c).rows)===n)return;s+=`:${Date.now()}`}await i.default.setItem(s,JSON.stringify({at:(new Date).toISOString(),store:e,rows:t}))};var e,t=r(d[0]),i=(e=t)&&e.__esModule?e:{default:e}},1096,[1082]); +__d(function(g,_r,_i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEMO_CUSTOMER_ID",{enumerable:!0,get:function(){return c}}),_e.defaultSimStart=function(e=new Date){const t=new Date(e),r=(5-t.getDay()+7)%7;return t.setDate(t.getDate()+r),t.setHours(17,30,0,0),t},_e.buildSeed=function(d){if(r.LIVE_VENUE_BUILD&&!t.IS_ISOLATED_VENUE){const e=u(d);return{...e,restaurants:e.restaurants.filter(e=>'anchorage'===e.id),menu:o.anchorageMenu.map(e=>({...e,signOff:null})),bookings:[],waitlist:[],orders:[],stampCards:[],giftCards:[],events:e.events.filter(e=>!e.example),ratings:[],walkIns:{},counters:{order:0,table:0,booking:0},customer:{...e.customer,id:'',referralCode:'',name:'',email:'',phone:'',allergies:[],allergyConsent:!1,marketingOptIn:{}}}}return t.IS_ISOLATED_VENUE?{restaurants:[t.IS_QUEUED_VENUE?(0,e.queuedRestaurant)(t.VENUE_RID):t.IS_ABBOTSFORD?n.ABBOTSFORD_RESTAURANT:t.IS_KIRKTON?n.KIRKTON_RESTAURANT:t.IS_GREENSIDE?n.GREENSIDE_RESTAURANT:t.IS_WILDINGS?n.WILDINGS_RESTAURANT:t.IS_KIRKMICHAEL?n.KIRKMICHAEL_RESTAURANT:s.SOUTERS_RESTAURANT],menu:t.IS_SOUTERS?i.SOUTERS_MENU:[],customer:{id:'',name:'',email:'',phone:'',allergies:[],allergyConsent:!1,referralCode:'',marketingOptIn:{}},bookings:[],waitlist:[],orders:[],stampCards:[],giftCards:[],events:[],ratings:[],audit:[],alertAcks:{},walkIns:{},basket:{restaurantId:null,mode:'takeaway',lines:[]},counters:{order:0,table:0,booking:0}}:u(d)};var e=_r(_d[0]),t=_r(_d[1]),r=_r(_d[2]),n=_r(_d[3]),s=_r(_d[4]),i=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),l=_r(_d[8]);const c='cust-demo';function u(e){const t=(0,l.ymd)(e),r=e=>e.toISOString(),s=n.restaurants.map(e=>'anchorage'===e.id?{...e,sections:o.ANCHORAGE_SECTIONS}:e),i={id:c,name:'Alex Morgan',email:'alex.demo@example.com',phone:'07700 900123',allergies:[{allergen:'crustaceans',severity:'anaphylaxis'},{allergen:'mustard',severity:'allergy'}],allergyConsent:!0,referralCode:'ALEX-7K2Q',marketingOptIn:{anchorage:!0}},u=(n,s,i,o,d={})=>({id:n,ref:`BK-${n.slice(-3).toUpperCase()}`,restaurantId:'anchorage',customerId:null,name:s,partySize:i,date:t,time:o,allergies:[],notes:'',status:'confirmed',security:i>=6?'deposit':'none',depositPaid:0,...i>=6?{depositDue:1e3*i}:{},createdAt:r((0,l.addMins)(e,-4320)),...d}),m=[u('bk-101','Campbell',2,'17:00',{table:'12',status:'seated',seatedAt:r((0,l.addMins)(e,-28)),tags:['Regular']}),u('bk-102','Fraser',4,'17:30',{table:'10',tags:['VIP']}),u('bk-103','McLeod',2,'18:00',{table:'11',allergies:[{allergen:'gluten',severity:'coeliac'}],notes:'Anniversary',occasion:'anniversary'}),u('bk-104','Kerr',6,'18:00',{table:'18'}),u('bk-105','Wallace',3,'18:30',{table:'13'}),u('bk-106','Boyd',8,'19:00',{table:'1+2',dog:!0,allergies:[{allergen:'peanuts',severity:'anaphylaxis'}],notes:'Birthday \u2014 bringing a dog',occasion:'birthday'}),u('bk-107','Hamilton',2,'19:00',{table:'5'}),u('bk-108','Stewart',4,'19:30',{table:'19',tags:['Regular']}),u('bk-109','Murray',2,'20:00',{table:'16'})],p=[{id:'wl-1',restaurantId:'anchorage',number:1,name:'Paterson',partySize:2,joinedAt:r((0,l.addMins)(e,-12)),status:'waiting'},{id:'wl-2',restaurantId:'anchorage',number:2,name:'Duncan',partySize:4,joinedAt:r((0,l.addMins)(e,-4)),status:'waiting'}],h=(0,l.atTime)(e,'17:45'),I=[{id:'ord-seed-1',ref:'T-1041',restaurantId:'anchorage',customerId:'cust-other',customerName:'R. Gilmour',type:'takeaway',slotTime:r(h),lines:[{itemId:'a-fishsupper',name:'Fish Supper',qty:2,unitPrice:1800,choices:['Beer-battered'],notes:'',contains:[],may:[],overridden:!1,prepMins:12},{itemId:'a-chips',name:'Triple-Cooked Chips (V)',qty:1,unitPrice:450,choices:[],notes:'Extra salt',contains:[],may:[],overridden:!1,prepMins:6}],subtotal:4050,tip:0,giftCardApplied:0,total:4050,paid:4050,status:'acknowledged',createdAt:r((0,l.addMins)(e,-50)),allergies:[],readiness:{}},{id:'ord-seed-2',ref:'Q-2017',restaurantId:'anchorage',customerId:'cust-other2',customerName:'Table 3 guest',type:'table',tableNo:'3',lines:[{itemId:'a-moules',name:'Moules Marini\xe8re',qty:1,unitPrice:2200,choices:['Main 500g with triple-cooked chips (\xa322.00)'],notes:'',contains:[],may:[],overridden:!1,prepMins:10},{itemId:'a-claymore',name:'The Claymore Burger',qty:1,unitPrice:1800,choices:[],notes:'No gherkins',contains:[],may:[],overridden:!1,prepMins:14}],subtotal:4e3,tip:0,giftCardApplied:0,total:4e3,paid:0,status:'preparing',createdAt:r((0,l.addMins)(e,-18)),allergies:[],readiness:{}}],y=[{restaurantId:'anchorage',customerId:c,stamps:5,rewardsAvailable:0,history:[{at:'2026-08-15',source:'Dine-in (staff scan)'},{at:'2026-08-29',source:'Takeaway'},{at:'2026-09-12',source:'Table QR bill'},{at:'2026-10-02',source:'Takeaway'},{at:'2026-10-16',source:'Referral \u2014 friend\u2019s first visit'}]},{restaurantId:'saltmarsh',customerId:c,stamps:2,rewardsAvailable:0,history:[{at:'2026-09-01',source:'Dine-in'},{at:'2026-10-01',source:'Dine-in'}]}],b=[{id:'gc-1',code:'ANC-G7QX-4M2P-9TRE',restaurantId:'anchorage',initial:5e3,balance:2500,ownerId:c,recipientName:'Alex',message:'Happy birthday! (example)',createdAt:'2026-09-20'},{id:'gc-2',code:'WEB-OLD-10-EXAMPLE',restaurantId:'anchorage',initial:1e3,balance:1e3,ownerId:'legacy',recipientName:'Legacy website bookings voucher (example)',message:'',createdAt:'2026-06-01',legacy:!0}],k=[...d.SCOTTISH_BANK_HOLIDAYS.map((e,t)=>({id:`bh-${t}`,restaurantId:null,date:e.date,title:e.title+(e.notes&&!/substitute/i.test(e.notes)?` (${e.notes.toLowerCase()})`:''),kind:'bank-holiday',description:'Scottish bank holiday',example:!1,source:d.BANK_HOLIDAY_SOURCE})),{id:'ev-halloween',restaurantId:'anchorage',date:(0,l.ymd)(new Date(e.getFullYear(),9,31)),title:'Halloween weekend (example)',kind:'event',description:'Example event \u2014 busy weekend flag for the forecast.',example:!0},{id:'ev-xmas-party',restaurantId:'anchorage',date:'2026-12-04',title:'Christmas party nights begin (example)',kind:'event',description:'Example: festive set menu, deposit required for parties of 8+.',example:!0},{id:'ev-hogmanay',restaurantId:null,date:'2026-12-31',title:'Hogmanay',kind:'occasion',description:'Key dining date.',example:!1},{id:'ev-burns',restaurantId:'anchorage',date:'2027-01-25',title:'Burns Night Supper (example)',kind:'event',description:'EXAMPLE event: haggis, neeps & tatties, address to the haggis, set menu \xa348pp. Booking opens via the app.',example:!0},{id:'ev-valentines',restaurantId:null,date:'2027-02-14',title:"Valentine's Day",kind:'occasion',description:'Key dining date.',example:!1},{id:'ev-mothering',restaurantId:null,date:'2027-03-07',title:'Mothering Sunday (UK)',kind:'occasion',description:'Key dining date.',example:!1},{id:'ev-live',restaurantId:'anchorage',date:'2026-11-14',title:'Live acoustic music (example)',kind:'event',description:'EXAMPLE: local folk duo from 7pm.',example:!0},{id:'ev-school-xmas',restaurantId:null,date:'2026-12-23',title:'South Ayrshire schools close for Christmas',kind:'school-holiday',description:'23 Dec 2026 \u2013 4 Jan 2027',example:!1},{id:'ev-salt-quiz',restaurantId:'saltmarsh',date:'2026-11-05',title:'Quiz night (fictional)',kind:'event',description:'Fictional demo restaurant event.',example:!0}];return{restaurants:s,menu:[...o.anchorageMenu,...n.demoMenus],customer:i,bookings:m,waitlist:p,orders:I,stampCards:y,giftCards:b,events:k,ratings:[{id:'rt-1',restaurantId:'anchorage',customerId:'cust-x1',customerName:'Fiona (example)',stars:5,comment:'Best fish supper on the coast, and the staff were brilliant with my son\u2019s nut allergy.',createdAt:r((0,l.addMins)(e,-1560)),context:'Takeaway T-1032'},{id:'rt-2',restaurantId:'anchorage',customerId:'cust-x2',customerName:'Iain (example)',stars:4,comment:'Lovely langoustines. Bit of a wait for a table at 7.',createdAt:r((0,l.addMins)(e,-3e3)),context:'Dine-in, Table 6'},{id:'rt-3',restaurantId:'anchorage',customerId:'cust-x3',customerName:'Morag (example)',stars:2,comment:'Chips were cold by the time we collected.',createdAt:r((0,l.addMins)(e,-4320)),context:'Takeaway T-1019'}],audit:[],alertAcks:{},walkIns:{anchorage:6},basket:{restaurantId:null,mode:'takeaway',lines:[]},counters:{order:1042,table:2018,booking:110}}}},1097,[6,5,833,3,1098,1099,1100,1101,818]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SOUTERS_RESTAURANT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"SOUTERS_BOOKING_URL",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"SOUTERS_CONTACTS",{enumerable:!0,get:function(){return n}});const t={id:'souters',name:"Souter's Inn",tagline:'Culinary excellence meets country hospitality in Kirkoswald',location:'Kirkoswald, South Ayrshire',address:'47 Main Road, Kirkoswald, South Ayrshire KA19 8HY',phone:'01655 760653',website:'https://www.soutersinn.com/',fictional:!1,kitchenHours:{0:['09:00','21:00'],1:['09:00','21:00'],2:['09:00','21:00'],3:['09:00','21:00'],4:['09:00','21:00'],5:['09:00','21:00'],6:['09:00','21:00']},hoursNote:'Public hours: daily from 9am; food listed to 9pm. Closing time (9pm or 10pm) to confirm with the venue. Breakfast until 11.45am; main food from noon.',sections:[],settings:{slotMinutes:15,slotCap:3,bufferMins:5,leadMins:20,takeawayPaused:!0,bookingCoversPerSlot:16,stampTarget:8,stampReward:'',stampMinSpend:1e3,capacityPerHour:0,walkInShare:.35,turnMins:75,orderAtTable:!1,showTakeaway:!1,tableRequests:!0,shortName:"Souter's",deposit:{on:!1,perPersonPence:null,fromParty:null,refundable:null,cutoffHours:null,needsConfirmation:!0,wixLinksOn:!1,policy:'Table deposit policy not set. Ticketed event deposits are separate and are not a table policy.'}}},o='',n={email:'souters@southernayr.com',phone:'01655 760653'}},1098,[]); +__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SOUTERS_MENU",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"SOUTERS_MENU_COUNT",{enumerable:!0,get:function(){return t}});const s=[{id:"su-breakfast-full-breakfast",section:"Breakfast",name:"Full Breakfast",description:"Ayrshire Bacon, Link Sausage, Black Pudding, Potato Scone, Beans, Tomato, Mushrooms & Two Eggs (Poached, Scrambled or Fried) with White or Wholemeal Toast",price:1195,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-eggs-benedict",section:"Breakfast",name:"Eggs Benedict",description:"Two Poached Eggs along with Ayrshire Bacon served on Toasted Muffin topped with Hollandaise Sauce",price:1050,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-french-toast",section:"Breakfast",name:"French Toast",description:"Two Slices of Bloomer Eggy Bread with Ayrshire Bacon and a side of Maple Syrup",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-light-breakfast",section:"Breakfast",name:"Light Breakfast",description:"Ayrshire Bacon, Link Sausage, Beans, Tomato and Two Eggs served Poached, Scrambled or Fried with White or Wholemeal Toast",price:950,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-eggs-royale",section:"Breakfast",name:"Eggs Royale",description:"Two Poached Eggs with Flaked Smoked Salmon served on Toasted Muffin topped with Hollandaise Sauce",price:1150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-fried-scottish-pancakes",section:"Breakfast",name:"Fried Scottish Pancakes",description:"Scottish Pancakes with Ayrshire Bacon and a side of Maple Syrup",price:950,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-add-banana-to-fried-scottish-pancakes",section:"Breakfast add-ons",name:"Add Banana (to Fried Scottish Pancakes)",description:"",price:150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-add-two-eggs-poached-fried-or-scrambled-",section:"Breakfast add-ons",name:"Add Two Eggs \u2013 Poached, Fried or Scrambled (to Fried Scottish Pancakes)",description:"",price:200,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-vegetarian-breakfast",section:"Breakfast",name:"Vegetarian Breakfast",description:"Potato Scone, Tomato, Mushrooms, Beans and Two Eggs served Poached, Scrambled or Fried with White or Wholemeal Toast",price:925,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-smashed-avocado-benedict",section:"Breakfast",name:"Smashed Avocado Benedict",description:"Smashed Avocado Guacamole, 2 Poached Eggs served on Toasted Muffin topped with Hollandaise Sauce",price:1095,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-granola-bowl",section:"Breakfast",name:"Granola Bowl",description:"Almond and Raisin Granola topped with Berries, Natural Yoghurt and Honey",price:895,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-breakfast-burrito",section:"Breakfast",name:"Breakfast Burrito",description:"Crispy Bacon, Two Fried Eggs, Jalape\xf1o Salsa, Guacamole, Cheddar Cheese, Salad & Sour Cream",price:1150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-pancake-stack",section:"Breakfast",name:"Pancake Stack",description:"American style pancakes with Biscoff, Nutella, Chocolate Sauce & Fresh Strawberries",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-breakfast-roll",section:"Breakfast",name:"Breakfast Roll",description:"with a choice of Ayrshire Bacon, Pork Link Sausage, Potato Scone or Egg; 2 Items \xa34.75 | 3 Items \xa35.50",price:425,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-kids-breakfast",section:"Junior / Kids",name:"Kids Breakfast",description:"Pork Link Sausage, Beans, Potato Scone, served with a Slice of Toast",price:495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-kids-pancakes",section:"Junior / Kids",name:"Kids Pancakes",description:"American Style Pancakes served with Syrup, Nutella or Butter & Jam",price:495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-add-banana-or-strawberries-to-kids-panca",section:"Junior / Kids add-ons",name:"Add Banana or Strawberries (to Kids Pancakes)",description:"",price:150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-black-pudding-add-on",section:"Add-ons",name:"Black Pudding (add-on)",description:"",price:150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-beans-add-on",section:"Add-ons",name:"Beans (add-on)",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-smashed-avocado-add-on",section:"Add-ons",name:"Smashed Avocado (add-on)",description:"",price:200,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-pork-link-sausage-add-on",section:"Add-ons",name:"Pork Link Sausage (add-on)",description:"",price:150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-mushrooms-add-on",section:"Add-ons",name:"Mushrooms (add-on)",description:"",price:150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-tomato-add-on",section:"Add-ons",name:"Tomato (add-on)",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-ayrshire-bacon-2-add-on",section:"Add-ons",name:"Ayrshire Bacon (2) (add-on)",description:"",price:150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-haggis-add-on",section:"Add-ons",name:"Haggis (add-on)",description:"",price:150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-egg-add-on",section:"Add-ons",name:"Egg (add-on)",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-potato-scone-add-on",section:"Add-ons",name:"Potato Scone (add-on)",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-bucket-of-chips",section:"Add-ons",name:"Bucket of Chips",description:"",price:425,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-toasted-white-or-wholemeal-bread",section:"Add-ons",name:"Toasted White or Wholemeal Bread",description:"served with Butter and Preserve",price:450,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-white-coffee",section:"Coffee",name:"White Coffee",description:"",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-latte",section:"Coffee",name:"Latte",description:"",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-espresso",section:"Coffee",name:"Espresso",description:"",price:325,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-cappuccino",section:"Coffee",name:"Cappuccino",description:"",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-americano",section:"Coffee",name:"Americano",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-double-espresso",section:"Coffee",name:"Double Espresso",description:"",price:395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-macchiato",section:"Coffee",name:"Macchiato",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-flavour-shot-add-on",section:"Coffee add-ons",name:"Flavour Shot (add-on)",description:"",price:75,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-extra-shot-of-coffee-add-on",section:"Coffee add-ons",name:"Extra Shot of Coffee (add-on)",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-breakfast-tea",section:"Tea",name:"Breakfast Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-camomile-tea",section:"Tea",name:"Camomile Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-earl-grey-tea",section:"Tea",name:"Earl Grey Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-green-tea",section:"Tea",name:"Green Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-peppermint-tea",section:"Tea",name:"Peppermint Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-red-berry-tea",section:"Tea",name:"Red Berry Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-lemon-ginger-tea",section:"Tea",name:"Lemon & Ginger Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-hot-chocolate",section:"Hot chocolate",name:"Hot Chocolate",description:"",price:425,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-luxury-hot-chocolate",section:"Hot chocolate",name:"Luxury Hot Chocolate",description:"with Cream & Marshmallows",price:475,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-freshly-baked-basket-of-bread-with-butte",section:"Starters / bread",name:"Freshly Baked Basket Of Bread With Butter",description:"",price:450,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-add-olive-oil-balsamic-vinegar",section:"Starters / bread",name:"Add Olive Oil & Balsamic Vinegar",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-soup-of-the-day",section:"Starters",name:"Soup of The Day",description:"served with Crusty Bread & Butter",price:650,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-a-la-carte-salad-of-poached-pear-blue-cheese",section:"Starters",name:"Salad Of Poached Pear & Blue Cheese",description:"with Candied Walnuts & French Vinaigrette",price:850,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-fresh-water-prawns",section:"Starters",name:"Fresh Water Prawns",description:"coated in Spicy Bang Bang Sauce, topped with Chopped Chilli, Peanuts & Coriander",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-sliced-melon-fresh-fruits",section:"Starters",name:"Sliced Melon & Fresh Fruits",description:"with Coulis & Raspberry Sorbet",price:850,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-chicken-liver-p-t",section:"Starters",name:"Chicken Liver P\xe2t\xe9",description:"with Oatcakes, Plum & Apple Chutney",price:850,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-crispy-salt-pepper-calamari",section:"Starters",name:"Crispy Salt & Pepper Calamari",description:"served with Garlic Mayo & Oriental Dressing",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-steamed-mussels",section:"Starters",name:"Steamed Mussels",description:"with White Wine, Garlic, Shallots & Cream, served with Garlic Bread",price:1150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-creamy-baked-garlic-mushrooms",section:"Starters",name:"Creamy Baked Garlic Mushrooms",description:"with a Cheddar Cheese Gratin",price:895,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-boiled-egg-crispy-bacon-caesar-salad",section:"Starters",name:"Boiled Egg & Crispy Bacon Caesar Salad",description:"with Parmesan & Croutons",price:850,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-grilled-honey-glazed-goat-s-cheese-salad",section:"Starters",name:"Grilled Honey Glazed Goat\u2019s Cheese Salad",description:"with Roquito Peppers & Chilli Jam",price:850,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-sticky-bbq-ribs-in-a-korean-gochujang-sa",section:"Starters",name:"Sticky BBQ Ribs in a Korean Gochujang Sauce",description:"with Onions, Peppers & Sesame Seeds",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-cioppino-fish-soup",section:"Starters",name:"Cioppino Fish Soup",description:"fired up with Fresh Chillies & Smoked Paprika, topped with Croutons & Parmesan",price:1095,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-8oz-fillet-steak",section:"From the grill",name:"8oz Fillet Steak",description:"All served with Tomatoes, Portobello Mushrooms, Onion Rings & your choice of Chips, Boiled or Mashed Potatoes. Includes choice of Peppercorn, Mustard or Red Wine Jus",price:3695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-10oz-sirloin-steak",section:"From the grill",name:"10oz Sirloin Steak",description:"All served with Tomatoes, Portobello Mushrooms, Onion Rings & your choice of Chips, Boiled or Mashed Potatoes. Includes choice of Peppercorn, Mustard or Red Wine Jus",price:3395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-rosemary-garlic-lamb-chops",section:"From the grill",name:"Rosemary & Garlic Lamb Chops",description:"All served with Tomatoes, Portobello Mushrooms, Onion Rings & your choice of Chips, Boiled or Mashed Potatoes. Includes choice of Peppercorn, Mustard or Red Wine Jus",price:2750,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-top-with-breaded-haggis-grill",section:"From the grill add-ons",name:"Top with Breaded Haggis (grill)",description:"",price:250,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-top-with-6-garlic-buttered-prawns-grill",section:"From the grill add-ons",name:"Top with 6 Garlic Buttered Prawns (grill)",description:"",price:750,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-steamed-fillet-of-salmon-with-cheese-gla",section:"Main courses",name:"Steamed Fillet of Salmon with Cheese Glaze",description:"served with Buttered Greens & Creamed Potatoes",price:2150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-breaded-haddock-chips",section:"Main courses",name:"Breaded Haddock & Chips",description:"with Homemade Tartare Sauce & Side Salad",price:1850,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-fish-of-the-day",section:"Main courses",name:"Fish of the Day",description:"Check Chef\u2019s Daily Specials",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,priceNote:"Ask staff",special:!0},{id:"su-a-la-carte-locally-caught-haggis-with-neeps-tatties",section:"Main courses",name:"Locally Caught Haggis with Neeps & Tatties",description:"served with Whisky Peppercorn Sauce & Greentails",price:1795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-breast-of-cajun-spiced-chicken",section:"Main courses",name:"Breast Of Cajun Spiced Chicken",description:"with Capsicums, Rice Pilaf & a Curried Coconut & Mango Chutney Sauce",price:1850,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-chicken-schnitzel",section:"Main courses",name:"Chicken Schnitzel",description:"Pan-Fried in Breadcrumbs, served with Crispy Bacon, Grilled Pineapple & Chips",price:1895,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-beef-steak-butcher-s-sausage-pie",section:"Main courses",name:"Beef Steak & Butcher\u2019s Sausage Pie",description:"with Creamed Potatoes & Buttered Carrots",price:1895,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-madras-spiced-lamb-curry",section:"Main courses",name:"Madras Spiced Lamb Curry",description:"with Chillies, Pineapple & Coriander, served with Aromatic Rice, Spiced Onions & a Poppadom",price:1895,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-pan-fried-lambs-liver",section:"Main courses",name:"Pan-Fried Lambs Liver",description:"with Saut\xe9ed Onions, Smoked Bacon, Grilled Tomato, Creamed Potatoes & Red Wine Gravy",price:1750,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-8oz-cheeseburger",section:"Main courses",name:"8oz Cheeseburger",description:"with Bacon, Peppered Mayo, Pickles & Tomato, served with Coleslaw & Chips",price:1795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-add-haggis-to-cheeseburger",section:"Main courses add-ons",name:"Add Haggis (to Cheeseburger)",description:"",price:250,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-panko-breaded-chicken-burger",section:"Main courses",name:"Panko Breaded Chicken Burger",description:"in a Toasted Brioche Bun, with Curried Slaw, Katsu Sauce & Chips",price:1795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-macaroni-cheese",section:"Main courses",name:"Macaroni Cheese",description:"with Leeks, English Mustard & Matured Cheddar, served with Garlic Bread",price:1795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-add-bacon-to-macaroni-cheese",section:"Main courses add-ons",name:"Add Bacon (to Macaroni Cheese)",description:"",price:150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-penne-pasta-arrabbiata",section:"Main courses",name:"Penne Pasta Arrabbiata",description:"with Peppers, Vine Tomatoes, Chilli & Basil, served with Garlic Bread",price:1795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-melon-prawn-salad",section:"Salads",name:"Melon & Prawn Salad",description:"with Marie Rose Cocktail Dressing; served with a choice of Chips or Boiled Potatoes",price:1795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-ploughman-s-salad",section:"Salads",name:"Ploughman\u2019s Salad",description:"Souter\u2019s Sausage Roll, Matured Cheddar, Pickle, Gammon, Boiled Egg & Crusty Bread; served with a choice of Chips or Boiled Potatoes",price:1695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-cajun-spiced-fillet-of-salmon",section:"Salads",name:"Cajun Spiced Fillet Of Salmon",description:"with Curried Coleslaw, Cashew Nuts & a Chilli, Ginger & Citrus Dressing; served with a choice of Chips or Boiled Potatoes",price:1850,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-garlic-chicken-caesar-salad",section:"Salads",name:"Garlic Chicken Caesar Salad",description:"with Croutons, Parmesan, Baby Gem Lettuce, Boiled Egg & Caesar Dressing; served with a choice of Chips or Boiled Potatoes",price:1795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-prawn-smoked-salmon-sandwich",section:"Sandwiches",name:"Prawn & Smoked Salmon Sandwich",description:"with Rocket & Marie Rose Sauce; served on White or Malted Bread with Kettle Chips, Coleslaw & Side Salad. Available 12 Noon\u20135pm",price:1195,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-tuna-mayonnaise-sandwich",section:"Sandwiches",name:"Tuna Mayonnaise Sandwich",description:"with Red Onion, Cucumber & Gem Lettuce; served on White or Malted Bread with Kettle Chips, Coleslaw & Side Salad. Available 12 Noon\u20135pm",price:1050,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-spicy-bang-bang-chicken-sandwich",section:"Sandwiches",name:"Spicy Bang Bang Chicken Sandwich",description:"with Sriracha Mayonnaise, Peppers & Coriander; served on White or Malted Bread with Kettle Chips, Coleslaw & Side Salad. Available 12 Noon\u20135pm",price:1195,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-basil-pesto-chicken-sandwich",section:"Sandwiches",name:"Basil Pesto Chicken Sandwich",description:"with Tomatoes, Red Onion & Mayonnaise; served on White or Malted Bread with Kettle Chips, Coleslaw & Side Salad. Available 12 Noon\u20135pm",price:1095,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-smoked-ham-matured-cheddar-cheese-sandwi",section:"Sandwiches",name:"Smoked Ham & Matured Cheddar Cheese Sandwich",description:"with Mustard Mayonnaise; served on White or Malted Bread with Kettle Chips, Coleslaw & Side Salad. Available 12 Noon\u20135pm",price:1095,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-egg-mayonnaise-sandwich",section:"Sandwiches",name:"Egg Mayonnaise Sandwich",description:"with Spring Onion & Chives; served on White or Malted Bread with Kettle Chips, Coleslaw & Side Salad. Available 12 Noon\u20135pm",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-add-a-cup-of-soup-with-any-sandwich",section:"Sandwiches add-ons",name:"Add a Cup of Soup (with any Sandwich)",description:"",price:395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-chips",section:"Sides",name:"Chips",description:"",price:425,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-cajun-chips",section:"Sides",name:"Cajun Chips",description:"",price:495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-creamed-potatoes",section:"Sides",name:"Creamed Potatoes",description:"",price:450,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-onion-rings",section:"Sides",name:"Onion Rings",description:"",price:495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-mac-cheese-side",section:"Sides",name:"Mac & Cheese (side)",description:"",price:595,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-seasonal-mixed-vegetables",section:"Sides",name:"Seasonal Mixed Vegetables",description:"",price:450,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-souter-s-coleslaw",section:"Sides",name:"Souter\u2019s Coleslaw",description:"",price:395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-curried-coleslaw",section:"Sides",name:"Curried Coleslaw",description:"",price:395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-souter-s-side-salad",section:"Sides",name:"Souter\u2019s Side Salad",description:"",price:425,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-garlic-bread",section:"Sides",name:"Garlic Bread",description:"",price:395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-garlic-bread-with-cheese",section:"Sides",name:"Garlic Bread with Cheese",description:"",price:450,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-fresh-fruit-salad-sorbet",section:"Starters",name:"Fresh Fruit Salad & Sorbet",description:"",price:300,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-soup-of-the-day",section:"Starters",name:"Soup of the Day",description:"",price:300,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-kids-garlic-bread-with-or-without-cheese",section:"Starters",name:"Garlic Bread (with or without Cheese)",description:"",price:300,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-macaroni-cheese",section:"Main courses",name:"Macaroni Cheese",description:"All main dishes served with carrots, peas and a choice of chips or mash",price:695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-breaded-goujons-of-chicken",section:"Main courses",name:"Breaded Goujons of Chicken",description:"All main dishes served with carrots, peas and a choice of chips or mash",price:695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-mini-breaded-fish",section:"Main courses",name:"Mini Breaded Fish",description:"All main dishes served with carrots, peas and a choice of chips or mash",price:695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-roast-chicken-salad",section:"Main courses",name:"Roast Chicken Salad",description:"All main dishes served with carrots, peas and a choice of chips or mash",price:695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-grilled-sausages-or-chicken-with-gravy",section:"Main courses",name:"Grilled Sausages or Chicken with Gravy",description:"All main dishes served with carrots, peas and a choice of chips or mash",price:695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-sticky-toffee-pudding",section:"Sweet treats",name:"Sticky Toffee Pudding",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-cone-from-the-counter",section:"Sweet treats",name:"Cone from the Counter",description:"",price:185,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-kids-ice-cream-sundae",section:"Sweet treats",name:"Kids Ice Cream Sundae",description:"Two scoops, Sprinkles, Flakes, along with a choice of Sauce \u2013 Chocolate / Strawberry",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-kids-juice-apple-orange-pineapple",section:"Drinks",name:"Juice \u2013 Apple / Orange / Pineapple",description:"",price:185,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-simply-fruit-shoot-orange-blackcurrant",section:"Drinks",name:"Simply Fruit Shoot \u2013 Orange / Blackcurrant",description:"",price:200,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-diluting-juice-orange-blackcurrant",section:"Drinks",name:"Diluting Juice \u2013 Orange / Blackcurrant",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-milk",section:"Drinks",name:"Milk",description:"",price:175,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-coke-diet-coke-lemonade",section:"Drinks",name:"Coke / Diet Coke / Lemonade",description:"",price:200,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-kids-milk-shake-chocolate-strawberry",section:"Drinks",name:"Kids Milk Shake \u2013 Chocolate / Strawberry",description:"",price:250,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-souter-s-sticky-toffee-pudding",section:"Dessert",name:"Souter\u2019s Sticky Toffee Pudding",description:"with Butterscotch Sauce & Vanilla Ice Cream",price:795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-cherry-almond-tart",section:"Dessert",name:"Cherry & Almond Tart",description:"with Cr\xe8me Anglaise & Wild Cherry Ripple Ice Cream",price:795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-individual-banoffee-pie",section:"Dessert",name:"Individual Banoffee Pie",description:"topped with Chocolate Shavings, served with Salted Caramel Sauce & Banana Ice Cream",price:795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-souter-s-cheesecake-of-the-day",section:"Dessert",name:"Souter\u2019s Cheesecake of the Day",description:"Please ask your Server for Today\u2019s Choice",price:795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-desserts-warm-chocolate-fudge-cake",section:"Dessert",name:"Warm Chocolate Fudge Cake",description:"with Fresh Berries & Honeycomb Ice Cream",price:795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-lemon-meringue-pie",section:"Dessert",name:"Lemon Meringue Pie",description:"with Raspberries & Raspberry Ripple Ice Cream",price:795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-fresh-fruit-salad",section:"Dessert",name:"Fresh Fruit Salad",description:"with Citrus Syrup served with Pouring Cream, Ice Cream or Sorbet",price:700,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-cheeseboard",section:"Dessert",name:"Cheeseboard",description:"A Selection of British & Continental Cheeses with Grapes, Fruit Chutney & Biscuits",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-affogato",section:"Dessert",name:"Affogato",description:"Vanilla Ice Cream with a Shot of Espresso",price:650,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-ice-cream-one-scoop",section:"Ice cream",name:"Ice Cream \u2013 One Scoop",description:"Please ask your Server for Today\u2019s Flavours",price:395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-desserts-ice-cream-two-scoops",section:"Ice cream",name:"Ice Cream \u2013 Two Scoops",description:"Please ask your Server for Today\u2019s Flavours",price:495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-desserts-ice-cream-three-scoops",section:"Ice cream",name:"Ice Cream \u2013 Three Scoops",description:"Please ask your Server for Today\u2019s Flavours",price:595,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-desserts-strawberry-snowball-delight",section:"Sundaes",name:"Strawberry Snowball Delight",description:"Vanilla & Strawberry Ice cream, Crushed Meringue, Fresh Strawberries, Strawberry Sauce, topped with a Snowball & a Wafer",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-biscoff-sundae",section:"Sundaes",name:"Biscoff Sundae",description:"Biscoff & Toffee Fudge Ice Cream, Whipped Cream, Crushed Lotus Biscoff Biscuits, Biscoff Topping Sauce & a Wafer",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-kinder-bueno-sundae",section:"Sundaes",name:"Kinder Bueno Sundae",description:"Kinder Bueno & Chocolate Ice Cream, Whipped Cream, Kinder Bueno Pieces, Chocolate Sauce & a Wafer",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-white-coffee",section:"Coffee",name:"White Coffee",description:"",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-latte",section:"Coffee",name:"Latte",description:"",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-cappuccino",section:"Coffee",name:"Cappuccino",description:"",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-macchiato",section:"Coffee",name:"Macchiato",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-americano",section:"Coffee",name:"Americano",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-espresso",section:"Coffee",name:"Espresso",description:"",price:325,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-double-espresso",section:"Coffee",name:"Double Espresso",description:"",price:395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-flavour-shot-add-on",section:"Coffee add-ons",name:"Flavour Shot (add-on)",description:"",price:75,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-extra-shot-of-coffee-add-on",section:"Coffee add-ons",name:"Extra Shot of Coffee (add-on)",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-breakfast-tea",section:"Tea",name:"Breakfast Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-camomile-tea",section:"Tea",name:"Camomile Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-earl-grey-tea",section:"Tea",name:"Earl Grey Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-green-tea",section:"Tea",name:"Green Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-peppermint-tea",section:"Tea",name:"Peppermint Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-red-berry-tea",section:"Tea",name:"Red Berry Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-lemon-ginger-tea",section:"Tea",name:"Lemon & Ginger Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-hot-chocolate",section:"Hot chocolate",name:"Hot Chocolate",description:"",price:425,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-luxury-hot-chocolate",section:"Hot chocolate",name:"Luxury Hot Chocolate",description:"with Cream & Marshmallows",price:475,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-chilled-melon-seasonal-fruits",section:"Starters",name:"Chilled Melon & Seasonal Fruits",description:"with Fruit Coulis & Sorbet",price:850,dietary:["V","VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-creamy-garlic-mushrooms",section:"Starters",name:"Creamy Garlic Mushrooms",description:"with Cheddar Cheese & Crusty Bread",price:895,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-mediterranean-tomato-chunky-vegetable-so",section:"Starters",name:"Mediterranean Tomato & Chunky Vegetable Soup",description:"with Crusty Bread",price:650,dietary:["V","VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-honey-glazed-goats-cheese",section:"Starters",name:"Honey Glazed Goats Cheese",description:"with Tomato & Rocket Salad, Basil Pesto & Balsamic Dressing",price:850,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-freshly-baked-basket-of-bread",section:"Starters",name:"Freshly Baked Basket of Bread",description:"with Butter",price:450,dietary:["V","VG"],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-vegetarian-vegan-add-olive-oil-balsamic",section:"Starters",name:"Add Olive Oil & Balsamic",description:"",price:100,dietary:["V","VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-boiled-egg-caesar-salad",section:"Starters",name:"Boiled Egg Caesar Salad",description:"with Croutons, Garlic Dressing & Vegetarian Cheese Shavings",price:795,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-salad-of-poached-pear-candied-walnuts",section:"Starters",name:"Salad of Poached Pear & Candied Walnuts",description:"with French Vinaigrette",price:795,dietary:["V","VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-stuffed-peppers",section:"Main courses",name:"Stuffed Peppers",description:"with Braised Rice, Tomatoes, Basil & Brie, served with a Side Salad & a Bucket of Chips; without Brie is vegan",price:1795,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-vegetable-cashew-nut-stir-fry",section:"Main courses",name:"Vegetable & Cashew Nut Stir Fry",description:"with Hoisin, Ginger & Garlic, served with Aromatic Rice",price:1795,dietary:["V","VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-macaroni-cheese",section:"Main courses",name:"Macaroni Cheese",description:"with Coleman\u2019s Mustard, Leeks & Matured Cheddar, served with Garlic Bread",price:1795,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-pasta-arrabbiata",section:"Main courses",name:"Pasta Arrabbiata",description:"with Peppers, Tomatoes, Chilli & Basil, served with Garlic Bread",price:1795,dietary:["V","VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-creamy-coconut-vegetable-curry",section:"Main courses",name:"Creamy Coconut Vegetable Curry",description:"with Almonds, Cashew Nuts & Coriander, served with Rice, Spiced Onions & a Poppadom",price:1795,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-katsu-vegetable-curry",section:"Main courses",name:"Katsu Vegetable Curry",description:"with Almonds, Cashew Nuts & Coriander, served with Rice, Spiced Onions & a Poppadom",price:1795,dietary:["VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-fresh-fruit-salad",section:"Desserts",name:"Fresh Fruit Salad",description:"with Sorbet",price:700,dietary:["V","VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-sticky-toffee-pudding",section:"Desserts",name:"Sticky Toffee Pudding",description:"with Hot Caramel Sauce & Vanilla Ice Cream",price:795,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-cherry-almond-tart",section:"Desserts",name:"Cherry & Almond Tart",description:"with Wild Cherry Ripple Ice Cream",price:795,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-trillionaire-tart",section:"Desserts",name:"Trillionaire Tart",description:"with Chocolate Pastry, Caramel Toffee & Chocolate Style Ganache, served with Vegan Vanilla Ice Cream",price:795,dietary:["VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-individual-banoffee-pie",section:"Desserts",name:"Individual Banoffee Pie",description:"topped with Chocolate Shavings, served with Salted Caramel Sauce & Banana Ice Cream",price:795,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-warm-chocolate-fudge-cake",section:"Desserts",name:"Warm Chocolate Fudge Cake",description:"with Fresh Berries & Honeycomb Ice Cream",price:795,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-cheeseboard",section:"Desserts",name:"Cheeseboard",description:"served with Oatcakes & Seasonal Chutney",price:995,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-affogato",section:"Desserts",name:"Affogato",description:"1 Scoop of Plain Ice Cream with a shot of Espresso Coffee",price:650,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-floured-bap-with-ayrshire-bacon",section:"Morning (9am\u201312pm)",name:"Floured Bap with Ayrshire Bacon",description:"Available 9am\u201312pm",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-floured-bap-with-pork-link-sausage",section:"Morning (9am\u201312pm)",name:"Floured Bap with Pork Link Sausage",description:"Available 9am\u201312pm",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-floured-bap-with-poached-scrambled-fried",section:"Morning (9am\u201312pm)",name:"Floured Bap with Poached / Scrambled / Fried Egg",description:"Available 9am\u201312pm",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-extra-item-on-floured-bap",section:"Morning (9am\u201312pm)",name:"Extra Item (on Floured Bap)",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-traybakes",section:"Sweet treats",name:"Traybakes",description:"",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-takeaway-freshly-baked-cakes",section:"Sweet treats",name:"Freshly Baked Cakes",description:"",price:450,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-freshly-baked-plain-fruit-scone",section:"Sweet treats",name:"Freshly Baked Plain / Fruit Scone",description:"",price:175,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-soup-of-the-day",section:"Hot food (12pm\u20139pm)",name:"Soup of the Day",description:"with Crusty Bread; available 12pm\u20139pm",price:450,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-takeaway-breaded-haddock-chips",section:"Hot food (12pm\u20139pm)",name:"Breaded Haddock & Chips",description:"with Tartare Sauce",price:1375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-steak-sausage-pie",section:"Hot food (12pm\u20139pm)",name:"Steak & Sausage Pie",description:"with Chips & Gravy",price:1375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-macaroni-cheese",section:"Hot food (12pm\u20139pm)",name:"Macaroni Cheese",description:"with Leeks, Mustard & Matured Cheddar, served with Chips",price:1375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-8oz-burger",section:"Hot food (12pm\u20139pm)",name:"8oz Burger",description:"with Bacon & Cheese, served with Chips",price:1375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-breaded-katsu-chicken-burger",section:"Hot food (12pm\u20139pm)",name:"Breaded Katsu Chicken Burger",description:"with Curried Slaw, served with Chips",price:1375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-cajun-chicken",section:"Hot food (12pm\u20139pm)",name:"Cajun Chicken",description:"with Rice & Coconut Curry Sauce",price:1375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-breaded-goat-s-cheese",section:"Hot food (12pm\u20139pm)",name:"Breaded Goat\u2019s Cheese",description:"with Tomato Salad, Pesto & Chutney, served with Chips",price:1375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-basil-pesto-chicken-sandwich",section:"Sandwiches (12pm\u20135pm)",name:"Basil Pesto Chicken Sandwich",description:"with Tomatoes, Red Onion & Mayonnaise; sandwiches 12pm\u20135pm",price:695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-spicy-bang-bang-chicken-sandwich",section:"Sandwiches (12pm\u20135pm)",name:"Spicy Bang Bang Chicken Sandwich",description:"with Sriracha Mayonnaise, Peppers & Coriander; sandwiches 12pm\u20135pm",price:695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-smoked-ham-matured-cheddar-cheese-sandwi",section:"Sandwiches (12pm\u20135pm)",name:"Smoked Ham & Matured Cheddar Cheese Sandwich",description:"with Mustard Mayonnaise; sandwiches 12pm\u20135pm",price:695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-tuna-mayonnaise-sandwich",section:"Sandwiches (12pm\u20135pm)",name:"Tuna Mayonnaise Sandwich",description:"with Red Onion, Cucumber & Gem Lettuce; sandwiches 12pm\u20135pm",price:595,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-egg-mayonnaise-sandwich",section:"Sandwiches (12pm\u20135pm)",name:"Egg Mayonnaise Sandwich",description:"with Spring Onion & Chives; sandwiches 12pm\u20135pm",price:595,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-pork-fillet-escalopes",section:"Choose your cut",name:"Pork Fillet Escalopes",description:"All served with Grilled Tomato, Portobello Mushroom & your choice of side & sauce",price:2e3,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-8oz-scotch-beef-fillet",section:"Choose your cut",name:"8oz Scotch Beef Fillet",description:"All served with Grilled Tomato, Portobello Mushroom & your choice of side & sauce",price:3e3,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-8oz-scotch-sirloin",section:"Choose your cut",name:"8oz Scotch Sirloin",description:"All served with Grilled Tomato, Portobello Mushroom & your choice of side & sauce",price:2500,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-10oz-scotch-ribeye",section:"Choose your cut",name:"10oz Scotch Ribeye",description:"All served with Grilled Tomato, Portobello Mushroom & your choice of side & sauce",price:3e3,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-scotch-lamb-chops",section:"Choose your cut",name:"Scotch Lamb Chops",description:"All served with Grilled Tomato, Portobello Mushroom & your choice of side & sauce",price:2500,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-600gm-scotch-t-bone-steak",section:"Choose your cut",name:"600gm Scotch T-Bone Steak",description:"All served with Grilled Tomato, Portobello Mushroom & your choice of side & sauce",price:4500,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-souter-s-mixed-grill",section:"Choose your cut",name:"Souter\u2019s Mixed Grill",description:"4oz Sirloin / Chicken Breast / Lamb Chop / Pork Escalope; served with Grilled Tomato, Portobello Mushroom & your choice of side & sauce",price:3500,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-chunky-chips-included-side-choice",section:"Side (included)",name:"Chunky Chips (included side choice)",description:"Included side choice with cut",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-baby-boiled-potatoes-included-side-choic",section:"Side (included)",name:"Baby Boiled Potatoes (included side choice)",description:"Included side choice with cut",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-mashed-potato-included-side-choice",section:"Side (included)",name:"Mashed Potato (included side choice)",description:"Included side choice with cut",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-red-wine-jus-included-sauce-choice",section:"Sauce (included)",name:"Red Wine Jus (included sauce choice)",description:"Included sauce choice with cut",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-peppercorn-included-sauce-choice",section:"Sauce (included)",name:"Peppercorn (included sauce choice)",description:"Included sauce choice with cut",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-mustard-included-sauce-choice",section:"Sauce (included)",name:"Mustard (included sauce choice)",description:"Included sauce choice with cut",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-onion-rings",section:"Upgrade extras",name:"Onion Rings",description:"",price:495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-garden-salad",section:"Upgrade extras",name:"Garden Salad",description:"",price:425,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-mixed-vegetables",section:"Upgrade extras",name:"Mixed Vegetables",description:"",price:450,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-haggis-cake",section:"Upgrade extras",name:"Haggis Cake",description:"",price:200,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-mac-cheese",section:"Upgrade extras",name:"Mac & Cheese",description:"",price:525,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-garlic-prawns",section:"Upgrade extras",name:"Garlic Prawns",description:"",price:750,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-souter-s-coleslaw",section:"Upgrade extras",name:"Souter\u2019s Coleslaw",description:"",price:395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0}].map(s=>({...s,restaurantId:"souters",soldOut:!1,signOff:null})),t=215},1099,[]); +__d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ANCHORAGE_SECTIONS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"anchorageMenu",{enumerable:!0,get:function(){return o}});const i=i=>({id:i,name:'Served with',required:!0,multi:!1,choices:[{id:`${i}-custard`,label:'Custard',priceDelta:0,allergens:{}},{id:`${i}-icecream`,label:'Ice cream',priceDelta:0,allergens:{}},{id:`${i}-cream`,label:'Cream',priceDelta:0,allergens:{}},{id:`${i}-vegan`,label:'Vegan ice cream (ask server)',priceDelta:0,allergens:{}}]}),s=(i,s,n)=>({id:i,name:'Portion',required:!0,multi:!1,choices:[{id:`${i}-starter`,label:'Starter',priceDelta:0},{id:`${i}-main`,label:n,priceDelta:s}]}),n=[{id:'a-soup',section:'Starters',name:"Chef's Soup of the Day",description:'A heartwarming bowl of seasonal homemade soup, served with warm crusty bread and butter.',price:600,dietary:[],allergens:{},allergenNotes:'Recipe changes daily \u2014 check the day\u2019s soup.',prepMins:0},{id:'a-skink',section:'Starters',name:'Cullen Skink',description:'Traditional creamy soup made with locally smoked haddock, potatoes and leeks, served with warm crusty bread and butter.',price:900,dietary:[],allergens:{},prepMins:0},{id:'a-salmon',section:'Starters',name:'Scottish Smoked Salmon Roulade',description:'Delicate Scottish smoked salmon rolled with herb-infused cream cheese, served with garlic & herb crostini and dressed salad.',price:900,dietary:[],allergens:{},prepMins:0},{id:'a-haggis',section:'Starters',name:'Haggis Bon Bons',description:'Crisp golden panko-fried haggis balls, finished with a velvety Scotch whisky sauce and caramelised apple gel.',price:800,dietary:[],allergens:{},allergenNotes:'',prepMins:0},{id:'a-crabcakes',section:'Starters',name:'Spiced Crab Cakes',description:'Golden crab cakes, delicately seasoned with herbs and spices, served with crisp seasonal salad and house-made Marie Rose sauce.',price:900,dietary:[],allergens:{},allergenNotes:'',prepMins:0},{id:'a-tempura',section:'Starters',name:'Deluxe Mixed Tempura',description:"King prawns, chicken and lion's mane mushrooms in a light, crispy tempura batter, served with a dressed seasonal salad and house dipping sauce.",price:1e3,dietary:[],allergens:{},allergenNotes:'',prepMins:0,optionGroups:[s('tempura',900,'Main with triple-cooked chips (\xa319.00)')]},{id:'a-kingoyster',section:'Starters',name:"Pan-Seared King Oyster Mushroom 'Scallops' (VG)",description:"King oyster mushroom 'scallops' prepared with the chef's special recipe of the day. Ask your server or see our specials board for today's garnish and accompaniments.",price:1e3,dietary:['VG'],allergens:{},allergenNotes:'Garnish changes daily \u2014 sign-off needed for each version.',prepMins:0,special:!0,unsigned:!0,optionGroups:[s('kingoyster',800,'Main (\xa318.00)')]},{id:'a-fishsupper',section:'Mains',name:'Fish Supper',description:'Locally landed haddock, available beer-battered or breaded, served with buttered peas, triple-cooked chips and homemade tartare sauce.',price:1800,dietary:['GF option'],allergens:{},allergenNotes:'',prepMins:0,optionGroups:[{id:'fs-coat',name:'Coating',required:!0,multi:!1,choices:[{id:'fs-batter',label:'Beer-battered',priceDelta:0},{id:'fs-bread',label:'Breaded',priceDelta:0}]}]},{id:'a-lionsmane',section:'Mains',name:"Southern Fried Lion's Mane Burger (VG)",description:"Crispy southern fried lion's mane mushroom, layered with vegan cheese and garlic aioli, served with triple-cooked chips and golden onion rings.",price:1800,dietary:['VG'],allergens:{},prepMins:0},{id:'a-pie',section:'Mains',name:'Steak & Ale Pie',description:'Slow-braised beef in a rich ale jus beneath golden all-butter puff pastry, served with buttered seasonal vegetables.',price:1800,dietary:[],allergens:{},prepMins:0,optionGroups:[{id:'pie-side',name:'Served with',required:!0,multi:!1,choices:[{id:'chips',label:'Triple-cooked chips',priceDelta:0},{id:'creamed',label:'Creamed potatoes',priceDelta:0,allergens:{}}]}]},{id:'a-bananablossom',section:'Mains',name:"Beer-Battered Banana Blossom 'Fish' Goujons (VG)",description:'Crisp beer-battered banana blossom goujons, dusted with locally foraged truffle seaweed seasoning, served with triple-cooked chips, garden peas and vegan tartare sauce.',price:1700,dietary:['VG'],allergens:{},allergenNotes:'',prepMins:0},{id:'a-chicken',section:'Mains',name:'Roasted Breast of Chicken',description:'Golden pan-roasted chicken breast, served with creamed potatoes, buttered seasonal primaryBtns, and a fragrant lemon & thyme bouillon.',price:1900,dietary:[],allergens:{},prepMins:0},{id:'a-maccheese',section:'Mains',name:'Macaroni Cheese (V)',description:'Rich mature Cheddar macaroni finished with a golden cheese glaze, served with two slices of garlic bread.',price:1700,dietary:['V'],allergens:{},prepMins:0},{id:'a-penne',section:'Mains',name:'Cajun Chicken & Chorizo Penne Pasta',description:'Tender Cajun-spiced chicken strips, mixed peppers, red onion and smoky chorizo, tossed in a bold, creamy Cajun sauce, served with two slices of garlic bread.',price:1700,dietary:[],allergens:{},prepMins:0},{id:'a-caesar',section:'Mains',name:'Chicken Caesar Salad',description:'Tender pan-roasted chicken breast served on a bed of baby gem lettuce with golden garlic croutons, Parmesan and a classic Caesar dressing.',price:1800,dietary:[],allergens:{},allergenNotes:'',prepMins:0,optionGroups:[{id:'caesar-add',name:'Optional extras',required:!1,multi:!0,choices:[{id:'caesar-bacon',label:'Add smoked Ayrshire bacon',priceDelta:150}]}]},{id:'a-moules',section:'Mains',name:'Moules Marini\xe8re',description:'Fresh Scottish mussels, steamed to perfection in a rich, creamy white wine and garlic sauce.',price:1200,dietary:[],allergens:{},prepMins:0,optionGroups:[s('moules',1e3,'Main 500g with triple-cooked chips (\xa322.00)')]},{id:'a-fillet',section:'From the Grill',name:'8oz Fillet Steak',description:'Prime 8oz fillet steak served with truffled woodland mushrooms, seasonal primaryBtns, golden onion rings and triple-cooked chips.',price:3800,dietary:[],allergens:{},prepMins:0,optionGroups:[{id:'steak-sauce',name:'Sauce',required:!1,multi:!1,choices:[{id:'sauce-pepper',label:'Peppercorn sauce',priceDelta:0,allergens:{}},{id:'sauce-garlic',label:'Garlic butter',priceDelta:0,allergens:{}}]},{id:'steak-surf',name:'Surf & turf add-on',required:!1,multi:!1,choices:[{id:'surf-prawns',label:'Garlic prawns',priceDelta:800,allergens:{}},{id:'surf-scallops',label:'Scottish West Coast scallops',priceDelta:1e3,allergens:{}}]}]},{id:'a-claymore',section:'From the Grill',name:'The Claymore Burger',description:'One juicy 6oz homemade Scottish beef burger in a brioche bun with baby gem lettuce, tomato and gherkins, topped with cheese, smoked Ayrshire bacon and onion rings. Served with triple-cooked chips.',price:1800,dietary:[],allergens:{},prepMins:0,optionGroups:[{id:'claymore-add',name:'Optional extras',required:!1,multi:!0,choices:[{id:'claymore-haggis',label:'Add haggis and whisky sauce',priceDelta:150,allergens:{}}]}]},{id:'a-langoustines',section:"Captain's Table",name:'Whole Scottish Grilled Langoustines',description:'Locally caught whole Scottish langoustines grilled in garlic butter, served with a vibrant side salad and burnt lemon.',price:1700,dietary:[],allergens:{},prepMins:0,optionGroups:[s('lang',1200,'Main 500g with triple-cooked chips (\xa329.00)')]},{id:'a-scallops',section:"Captain's Table",name:'Pan-Seared West Coast Scallops',description:"Scottish West Coast scallops prepared to the chef's recipe of the day. Starter and main portions \u2014 see price on Specials Board.",price:null,priceNote:'See specials board',dietary:[],allergens:{},prepMins:0,special:!0,unsigned:!0},{id:'a-lobster',section:"Captain's Table",name:'Grilled Dunure Lobster',description:'Fresh Dunure lobster, caught locally by "Kitty Fisher", finished in rich garlic butter and served with a vibrant side salad, triple-cooked chips and burnt lemon. When available.',price:3500,dietary:[],allergens:{},prepMins:0,optionGroups:[{id:'lobster-size',name:'Size',required:!0,multi:!1,choices:[{id:'lob-half',label:'Half',priceDelta:0},{id:'lob-whole',label:'Whole (\xa365.00)',priceDelta:3e3}]}]},{id:'a-crab',section:"Captain's Table",name:'Grilled Dunure Crab',description:'Freshly landed Dunure brown crab, caught locally by "Kitty Fisher", finished in rich garlic butter and served with a vibrant side salad, triple-cooked chips and burnt lemon. When available.',price:4e3,dietary:[],allergens:{},prepMins:0},{id:'a-smorgasbord',section:'Platters',name:'Seafood Smorgasbord (serves one)',description:"250g langoustines, 3 pan-seared West Coast scallops, 250g fresh mussels, 6 garlic prawns and a roll of Scottish smoked salmon, with dressed side salad and warm crusty bread.",price:5e3,dietary:[],allergens:{},prepMins:0},{id:'a-deluxe',section:'Platters',name:'Deluxe Seafood Platter (serves two)',description:'One whole Dunure lobster, one whole Dunure crab, 500g whole langoustines, 500g moules marini\xe8re, pan-seared scallops, Scottish smoked salmon and 6 garlic prawns, with two portions of chips, side salad and warm crusty bread.',price:16500,dietary:[],allergens:{},prepMins:0},{id:'a-onionrings',section:'Sides',name:'House Beer-Battered Onion Rings (V)',description:'Crisp house beer-battered onion rings, served golden and crunchy.',price:450,dietary:['V'],allergens:{},allergenNotes:'',prepMins:0},{id:'a-garlicbread',section:'Sides',name:'Garlic Bread (V)',description:'Warm toasted garlic bread, finished with garlic & parsley butter.',price:450,dietary:['V'],allergens:{},prepMins:0,optionGroups:[{id:'gb-add',name:'Optional extras',required:!1,multi:!0,choices:[{id:'gb-cheese',label:'Add cheese',priceDelta:100}]}]},{id:'a-chips',section:'Sides',name:'Triple-Cooked Chips (V)',description:'Golden triple-cooked chips, lightly tossed in Maldon sea salt.',price:450,dietary:['V'],allergens:{},allergenNotes:'',prepMins:0,optionGroups:[{id:'chips-add',name:'Optional extras',required:!1,multi:!0,choices:[{id:'chips-cajun',label:'Add Cajun seasoning',priceDelta:0,allergens:{}}]}]},{id:'a-truffle',section:'Sides',name:'Parmesan & Truffle Fries (V)',description:'Crispy fries topped with finely grated parmesan and tossed in a winter truffle infused oil.',price:500,dietary:['V'],allergens:{},allergenNotes:'',prepMins:0},{id:'a-salad',section:'Sides',name:'Side Salad (VG)',description:'Seasonal mixed leaves with cucumber, red onion and mixed peppers, finished with a light vinaigrette.',price:450,dietary:['VG'],allergens:{},prepMins:0},{id:'a-brulee',section:'Desserts',name:"Chef's Cr\xe8me Br\xfbl\xe9e of the Day (V)",description:"Smooth Madagascan custard with a delicately caramelised sugar crust. Ask your server or see our specials board for today's flavour.",price:800,dietary:['V'],allergens:{},prepMins:0},{id:'a-crumble',section:'Desserts',name:'Seasonal Fruit Crumble (V)',description:'Slow-cooked seasonal fruit topped with a golden buttery crumble.',price:800,dietary:['V'],allergens:{},prepMins:0,optionGroups:[i('crumble')]},{id:'a-stp',section:'Desserts',name:'Sticky Toffee Pudding (V)',description:'A rich, homemade steamed date pudding, drenched in our signature homemade butterscotch sauce.',price:800,dietary:['V'],allergens:{},prepMins:0,optionGroups:[i('stp')]},{id:'a-cheesecake',section:'Desserts',name:'Cheesecake of the Day (V)',description:'A smooth, creamy cheesecake on a buttery biscuit base. Gluten-free and vegan options available.',price:800,dietary:['V'],allergens:{},prepMins:0,optionGroups:[i('cheesecake')]},{id:'a-affogato',section:'Desserts',name:'Affogato (V)',description:'Two scoops of creamy vanilla ice cream with a freshly brewed shot of Italian espresso poured over. Vegan options available.',price:800,dietary:['V'],allergens:{},prepMins:0},{id:'a-mini',section:'Mini Anchors (under 12s)',name:'Mini Anchors meal',description:'Under 12s only. Served with peas or beans. Includes a diluting juice drink & 2 scoops of ice cream. GF options available.',price:900,dietary:['GF option'],allergens:{},prepMins:0,optionGroups:[{id:'mini-main',name:'Choose a meal',required:!0,multi:!1,choices:[{id:'mini-burger',label:'Cheeseburger & chips',priceDelta:0,allergens:{}},{id:'mini-fish',label:'Fish goujons & chips',priceDelta:0,allergens:{}},{id:'mini-mac',label:"Mac 'n' cheese & chips (V)",priceDelta:0,allergens:{}},{id:'mini-chicken',label:'Chicken goujons & chips',priceDelta:0,allergens:{}}]},{id:'mini-veg',name:'With',required:!0,multi:!1,choices:[{id:'mini-peas',label:'Peas',priceDelta:0},{id:'mini-beans',label:'Beans',priceDelta:0}]}]}],t=['Starters','Mains','From the Grill',"Captain's Table",'Platters','Sides','Desserts','Mini Anchors (under 12s)'],o=n.map(({unsigned:i,soldOut:s,...n})=>({...n,allergens:{},allergenNotes:'',prepMins:0,optionGroups:n.optionGroups?.map(i=>({...i,choices:i.choices.map(i=>({...i,allergens:{}}))})),restaurantId:"anchorage",soldOut:!!s,signOff:null}))},1100,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SCOTTISH_BANK_HOLIDAYS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"BANK_HOLIDAY_SOURCE",{enumerable:!0,get:function(){return n}});const t=[{date:"2026-11-30",title:"St Andrew\u2019s Day",notes:""},{date:"2026-12-25",title:"Christmas Day",notes:""},{date:"2026-12-28",title:"Boxing Day",notes:"Substitute day"},{date:"2027-01-01",title:"New Year\u2019s Day",notes:""},{date:"2027-01-04",title:"2nd January",notes:"Substitute day"},{date:"2027-03-26",title:"Good Friday",notes:""},{date:"2027-05-03",title:"Early May bank holiday",notes:""},{date:"2027-05-31",title:"Spring bank holiday",notes:""},{date:"2027-08-02",title:"Summer bank holiday",notes:""},{date:"2027-11-30",title:"St Andrew\u2019s Day",notes:""},{date:"2027-12-27",title:"Christmas Day",notes:"Substitute day"},{date:"2027-12-28",title:"Boxing Day",notes:"Substitute day"},{date:"2028-01-03",title:"New Year\u2019s Day",notes:"Substitute day"},{date:"2028-01-04",title:"2nd January",notes:"Substitute day"},{date:"2028-04-14",title:"Good Friday",notes:""},{date:"2028-05-01",title:"Early May bank holiday",notes:""},{date:"2028-05-29",title:"Spring bank holiday",notes:""},{date:"2028-08-07",title:"Summer bank holiday",notes:""},{date:"2028-11-30",title:"St Andrew\u2019s Day",notes:""},{date:"2028-12-25",title:"Christmas Day",notes:""},{date:"2028-12-26",title:"Boxing Day",notes:""}],n='gov.uk/bank-holidays.json (Scotland)'},1101,[]); +__d(function(g,r,_i,_a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"setMenuCardBridge",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"menuCardBridge",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"resolveItem",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"resolveMenu",{enumerable:!0,get:function(){return m}}),e.sortMenu=c;var t=r(d[0]);let n=null;const o=t=>{n=t},u=()=>n,i=o=>(0,t.overlayItem)(o,n?.cardFor(o.id)),m=t=>c(t.map(i));function c(t){return t.some(t=>'number'==typeof t.sort)?t.map((t,n)=>({m:t,i:n,k:'number'==typeof t.sort?t.sort:10*n})).sort((t,n)=>t.k-n.k||t.i-n.i).map(t=>t.m):t}},1102,[1103]); +__d(function(_g,_r,_i,_a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"canEditCards",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"canSignOffCards",{enumerable:!0,get:function(){return i}}),e.suggestForIngredient=a,e.suggestAllergens=o,Object.defineProperty(e,"suggestedBy",{enumerable:!0,get:function(){return l}}),e.unresolved=c,e.applySuggestions=function(n){const t={...n.allergens};for(const i of c(n))t[i]='contains';return t},Object.defineProperty(e,"cardState",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"STATE_LABEL",{enumerable:!0,get:function(){return f}}),e.signOffBlock=function(n){if(!n.dish.trim())return'Give the dish a name first.';const t=c(n);return t.length?`Check the suggested allergens first: ${t.map(g).join(', ')}.`:n.allergensConfirmed?null:'Confirm the allergen list first.'},Object.defineProperty(e,"allergenList",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"CONTENT_FIELDS",{enumerable:!0,get:function(){return p}}),e.editCard=function(n,t,i,r){const{confirmAllergens:s,...a}=t,l=Object.keys(a).filter(t=>!h(a[t],n[t]));let u={...n};for(const n of l)u[n]=a[n];const f=l.some(n=>'allergens'===n||'dismissed'===n||'ingredients'===n);f&&!h(o(u.ingredients),o(n.ingredients))&&(u.allergensConfirmed=void 0);f&&(l.includes('allergens')||l.includes('dismissed'))&&(u.allergensConfirmed=void 0);let g=!1;!s||u.allergensConfirmed||c(u).length||(u.allergensConfirmed={by:i,at:r},g=!0);const m=l.length>0||g,p=l.length>0&&!!n.signOff;if(!m)return{card:n,changed:!1,resetSignOff:!1};l.length&&(u={...u,signOff:null,version:n.version+1});return{card:{...u,updatedAt:r,updatedBy:i},changed:m,resetSignOff:p}},e.signOffCard=function(n,t,i){return{...n,signOff:{by:t,at:i},wasLive:!0,updatedAt:i,updatedBy:t}},e.overlayItem=function(n,t){return t?{...n,name:t.dish,section:t.section,price:t.price,allergens:t.allergens,allergenNotes:t.allergenNotes,signOff:t.signOff?{by:t.signOff.by,at:t.signOff.at.slice(0,10)}:null,hidden:n.hidden||!t.signOff&&!t.wasLive,recipeCardId:t.id}:n},e.dishesFor=function(n,t){const i=n.filter(n=>!n.hidden),r=i.filter(n=>t.some(t=>'contains'===n.allergens[t])),s=i.filter(n=>!r.includes(n)&&t.some(t=>'may'===n.allergens[t])),a=i.filter(n=>!r.includes(n)&&!s.includes(n));return{contains:r,may:s,free:a}},e.filterCards=function(n,t,i,r="free-from"){const s=t.toLowerCase().split(/\s+/).filter(Boolean);return n.filter(n=>{const t=[n.dish,n.section,...n.ingredients.map(n=>n.name)].join(' ').toLowerCase();return!!s.every(n=>t.includes(n))&&(!i.length||('free-from'===r?i.every(t=>!n.allergens[t]):i.some(t=>!!n.allergens[t])))})},e.uuid=function(){const n=globalThis.crypto;if(n?.randomUUID)return n.randomUUID();const t=Array.from({length:16},()=>Math.floor(256*Math.random()));t[6]=15&t[6]|64,t[8]=63&t[8]|128;const i=t.map(n=>n.toString(16).padStart(2,'0')).join('');return`${i.slice(0,8)}-${i.slice(8,12)}-${i.slice(12,16)}-${i.slice(16,20)}-${i.slice(20)}`},e.uuidFrom=function(n){let t='';for(let i=0;i<4;i++){let r=2166136261^2654435761*i;for(let t=0;t>>0;t+=r.toString(16).padStart(8,'0')}const i=t.slice(0,12)+'4'+t.slice(13,16)+(3&parseInt(t[16],16)|8).toString(16)+t.slice(17,32);return`${i.slice(0,8)}-${i.slice(8,12)}-${i.slice(12,16)}-${i.slice(16,20)}-${i.slice(20,32)}`},Object.defineProperty(e,"RECIPE_CARD_EXTRA_COLUMNS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"STEP_SEP",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"photoPath",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"RECIPE_PHOTO_BUCKET",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"RECIPE_CARD_TABLE",{enumerable:!0,get:function(){return v}}),e.cardToRow=function(n,t){return{row:{id:n.id,venue_id:t,dish:n.dish,ingredients:n.ingredients.map(({name:n,qty:t,unit:i,allergens:r})=>({name:n,qty:t,unit:i,...r?.length?{allergens:r}:{}})),method:n.steps.join(y),allergens:m(n.allergens,'contains'),may_contain:m(n.allergens,'may'),photo_url:!n.photo||n.photo.startsWith('local:')||n.photo.startsWith('asset:')?null:n.photo,signed_off_by:n.signOff?.by??null,signed_off_at:n.signOff?.at??null,updated_at:n.updatedAt},extra:{menu_item_id:n.menuItemId,section:n.section,price_pence:n.price,dismissed:n.dismissed,allergen_notes:n.allergenNotes??null,allergens_confirmed_by:n.allergensConfirmed?.by??null,allergens_confirmed_at:n.allergensConfirmed?.at??null,was_live:n.wasLive,origin:n.origin,version:n.version,updated_by:n.updatedBy}}},e.rowToCard=function(n,t,i={}){const r={};n.may_contain.forEach(n=>{r[n]='may'}),n.allergens.forEach(n=>{r[n]='contains'});const s=n.updated_at??(new Date).toISOString();return{id:n.id,restaurantId:t,menuItemId:i.menu_item_id??n.id,dish:n.dish,section:i.section??'Mains',price:i.price_pence??null,photo:n.photo_url??void 0,ingredients:n.ingredients.map((t,i)=>({id:`${n.id}-i${i}`,...t})),steps:n.method?n.method.split(y).filter(n=>n.trim()):[],allergens:r,dismissed:i.dismissed??[],allergenNotes:i.allergen_notes??void 0,allergensConfirmed:i.allergens_confirmed_by?{by:i.allergens_confirmed_by,at:i.allergens_confirmed_at}:void 0,signOff:n.signed_off_by&&n.signed_off_at?{by:n.signed_off_by,at:n.signed_off_at}:null,wasLive:i.was_live??!!n.signed_off_by,origin:i.origin??'new',version:i.version??1,createdAt:s,updatedAt:s,updatedBy:i.updated_by??''}};var n=_r(d[0]);const t=n=>'head-chef'===n||'manager'===n||'owner'===n,i=n=>'head-chef'===n,r=[[/\b(flour(?!y)|wheat|bread|crumb|panko|pastry|brioche|buns?\b|crouton|crostini|batter|beer|ale\b|lager|stout|barley|malt|rye|spelt|oat|couscous|semolina|pasta|penne|macaroni|spaghetti|noodle|biscuit|sponge|crumble|roux|tempura|digestive|self.raising)/i,['gluten']],[/\b(prawn|langoustine|lobster|crab|shrimp|crayfish|scampi|shellfish)/i,['crustaceans']],[/\b(mussel|scallop|clam|cockle|squid|calamari|octopus|whelk|winkle|oyster(?! mushroom)|oyster sauce)/i,['molluscs']],[/\b(egg|mayonnaise|mayo|aioli|tartare|hollandaise|meringue|custard|brioche|bearnaise)/i,['eggs']],[/\b(fish(?!er)|haddock|cod|salmon|hake|anchov|tuna|mackerel|trout|sea bass|monkfish|pollock|halibut|kipper|worcester|fish sauce|caesar)/i,['fish']],[/\b(peanut|groundnut|satay)/i,['peanuts']],[/\b(almond|hazelnut|walnut|cashew|pecan|pistachio|macadamia|brazil nut|praline|frangipane|marzipan|pesto)/i,['treenuts']],[/\b(soy|soya|tofu|edamame|miso|tamari|tempeh)/i,['soya']],[/\b(milk|butter(?!nut)|cream|cheese|cheddar|parmesan|mozzarella|brie|yoghurt|yogurt|cr[e\xe8]me|ghee|ice cream|custard|butterscotch|toffee|fudge|buttermilk|mascarpone|ricotta|whey)/i,['milk']],[/\b(celery|celeriac|stock cube|beef stock|chicken stock|veg(etable)? stock)/i,['celery']],[/\b(mustard|dijon|vinaigrette|piccalilli)/i,['mustard']],[/\b(sesame|tahini|hummus|houmous)/i,['sesame']],[/\b(wine|vinegar|dried apricot|dried fruit|sulphite|sulfite|prosecco|cider|port\b|sherry|dates?\b|raisin|sultana)/i,['sulphites']],[/\blupin/i,['lupin']]],s=[[/gluten.free|\bgf\b/i,'gluten'],[/dairy.free|vegan (butter|cheese|cream)|oat milk|plant.based/i,'milk'],[/egg.free|vegan mayo/i,'eggs']];function a(t){const i=new Set(t.allergens??[]);for(const[n,s]of r)n.test(t.name)&&s.forEach(n=>i.add(n));for(const[n,r]of s)n.test(t.name)&&!(t.allergens??[]).includes(r)&&i.delete(r);return n.ALLERGENS.map(n=>n.id).filter(n=>i.has(n))}function o(t){const i=new Set(t.flatMap(a));return n.ALLERGENS.map(n=>n.id).filter(n=>i.has(n))}const l=(n,t)=>n.filter(n=>a(n).includes(t)).map(n=>n.name);function c(n){return o(n.ingredients).filter(t=>!n.allergens[t]&&!n.dismissed.includes(t))}const u=n=>n.signOff?'signed-off':'awaiting',f={'signed-off':'Signed off',awaiting:'Awaiting sign-off'};const g=t=>n.ALLERGENS.find(n=>n.id===t)?.short??t,m=(t,i)=>n.ALLERGENS.filter(n=>i?t[n.id]===i:!!t[n.id]).map(n=>n.id),p=['dish','section','price','photo','ingredients','steps','allergens','dismissed','allergenNotes'],h=(n,t)=>JSON.stringify(n??null)===JSON.stringify(t??null);const b={menu_item_id:'text',section:'text',price_pence:'integer null',dismissed:'text[]',allergen_notes:'text',allergens_confirmed_by:'text',allergens_confirmed_at:'timestamptz',was_live:'boolean',origin:'text',version:'integer',updated_by:'text'},y='\n',_=(n,t)=>`${n}/${t.id}-v${t.version}.jpg`,O='recipe-photos',v='recipe_cards'},1103,[814]); +__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"MESSAGING_CONFIG",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"previewProvider",{enumerable:!0,get:function(){return t}}),_e.relayProvider=n,Object.defineProperty(_e,"isLive",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"activeProvider",{enumerable:!0,get:function(){return s}});const e={mode:'preview',endpoint:'',smsService:'Twilio',emailService:'Postmark',smsSenderId:'ANCHORAGE',fromEmail:'bookings@your-venue.co.uk'},t={id:'preview',label:'Preview mode (nothing is sent)',live:!1,deliver:async()=>({ok:!0})};function n(e){return{id:'relay',label:'Your messaging server',live:!0,deliver:async t=>{try{const n=await fetch(e,{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({channel:t.channel,to:t.to,subject:t.subject,body:t.body,html:t.html,ref:t.ref,kind:t.kind,restaurantId:t.restaurantId})});if(!n.ok)return{ok:!1,error:`Server said ${n.status}`};return{ok:!0,providerId:(await n.json().catch(()=>({}))).id}}catch(e){return{ok:!1,error:e?.message??'Network error'}}}}}const o=()=>'live'===e.mode&&!!e.endpoint,s=()=>o()?n(e.endpoint):t},1104,[]); +__d(function(g,_r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TEMPLATE_LABEL",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"DEFAULT_TEMPLATES",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"PLACEHOLDERS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"teamName",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"longDate",{enumerable:!0,get:function(){return u}}),e.bookingVars=function(n,r){const o=n.allergies.map(n=>`${(0,t.allergenLabel)(n.allergen).toLowerCase()}`).join(', '),a=n.allergies.map(n=>`${(0,t.allergenLabel)(n.allergen)} (${(0,t.severityLabel)(n.severity).toLowerCase()})`).join(', '),i=`${n.partySize} ${1===n.partySize?'person':'people'}`,s={...c(r),first:l(n.name),name:n.name.trim(),date:u(n.date),time:n.time,covers:i,ref:n.ref};return{sms:{...s,allergy:n.allergies.length?` We\u2019ve noted the allergy (${o}) and the team will check it with you when you arrive.`:'',note:'',details:''},email:{...s,allergy:n.allergies.length?`Thank you for telling us about: ${a}. Our team will go through this with you when you arrive, and every dish for your table is checked at each step, from the kitchen to your table.`:'',note:n.notes.trim()?`Your note to us: "${n.notes.trim()}". We\u2019ll make sure the team sees it.`:'',details:[`Date: ${u(n.date)}`,`Time: ${n.time}`,`Table for: ${i}`,`Reference: ${n.ref}`].join('\n')}}},e.orderVars=function(r,o){const a=r.lines.reduce((t,n)=>t+n.qty,0),i=r.readyBy??r.slotTime,s=i?`at ${m(i)}`:'time to be confirmed',d=r.allergies.map(n=>(0,t.allergenLabel)(n.allergen).toLowerCase()).join(', '),u=r.allergies.map(n=>`${(0,t.allergenLabel)(n.allergen)} (${(0,t.severityLabel)(n.severity).toLowerCase()})`).join(', '),y={...c(o),first:l(r.customerName),name:r.customerName,ref:r.ref,items:`${a} ${1===a?'item':'items'}`,total:(0,n.gbp)(r.total),collect:s,date:'',time:i?m(i):'',covers:''};return{sms:{...y,allergy:r.allergies.length?` We\u2019ve noted your allergy (${d}); the kitchen checks every item.`:'',itemList:'',details:'',note:''},email:{...y,allergy:r.allergies.length?`You told us about: ${u}. The kitchen signs off every item against it before your order leaves the pass.`:'',itemList:r.lines.map(t=>`${t.qty} \xd7 ${t.name}${t.choices.length?` (${t.choices.join(', ')})`:''}`).join('\n'),details:[`Order: ${r.ref}`,`Collection: ${i?m(i):'time to be confirmed'}`,`Items: ${a}`,`Total: ${(0,n.gbp)(r.total)}`].join('\n'),note:''}}},e.fill=y,Object.defineProperty(e,"fillEmailText",{enumerable:!0,get:function(){return h}}),e.emailHtml=function(t,n){const r=n.accent??'#B8893E',o=t.split(/\n{2,}/).map(t=>{const n=t.split('\n');return n.length>1&&n.every(t=>/^[^:]{2,22}:\s.+/.test(t))?`${n.map(t=>{const n=t.indexOf(':');return``}).join('')}
${p(t.slice(0,n))}${p(t.slice(n+1).trim())}
`:n.length>1&&n.every(t=>/^\d+ \xd7/.test(t))?`
    ${n.map(t=>`
  • ${p(t)}
  • `).join('')}
`:`

${n.map(p).join('
')}

`}).join('');return`${p(n.preheader??'')}
${p(n.venue.toUpperCase())}
${o}
You\u2019re getting this because you made a booking or order with ${p(n.venue)}. It\u2019s about your booking only, not marketing.
`},e.smsParts=function(t){const n=b(t),r=!f.test(n),o=n.length,a=r?o<=70?1:Math.ceil(o/67):o<=160?1:Math.ceil(o/153);return{chars:o,parts:a,unicode:r}},Object.defineProperty(e,"toGsm",{enumerable:!0,get:function(){return b}});var t=_r(_d[0]),n=_r(_d[1]);const r={booking:{title:'Booking confirmed',when:'Every booking: online, phone or in person (and when you confirm a request)'},request:{title:'Booking request received',when:'Online bookings that need you to confirm them first'},declined:{title:'Booking request declined',when:'When you decline a booking request'},order:{title:'Takeaway order confirmed',when:'Every takeaway order from the app (and phone orders with a number)'}},o={booking:{sms:'Hi {first}, you\u2019re booked in at {venue}: {date} at {time}, {covers}. Ref {ref}.{allergy} Need to change or cancel? Just call {venuePhone}. See you soon, {team}',subject:'You\u2019re booked in at {venue}: {date} at {time}',body:'Hi {first},\n\nThank you for booking with us. We\u2019re really looking forward to welcoming you.\n\n{details}\n\n{allergy}\n\n{note}\n\nIf your plans change, just give us a ring on {venuePhone} and we\u2019ll happily move or cancel it for you. Please quote {ref}.\n\nYou\u2019ll find us at {address}.\n\nWarm wishes,\n{team}'},request:{sms:'Hi {first}, thanks for your booking request at {venue} for {date} at {time}, {covers}. We\u2019ll text you shortly to confirm. Ref {ref}. Questions? Call {venuePhone}. {team}',subject:'We\u2019ve got your booking request for {date}',body:'Hi {first},\n\nThank you for your booking request. A member of the team will look at it and confirm with you very shortly.\n\n{details}\n\n{allergy}\n\n{note}\n\nIf you have any questions in the meantime, call us on {venuePhone} and quote {ref}.\n\nWarm wishes,\n{team}'},declined:{sms:'Hi {first}, we\u2019re so sorry, we can\u2019t fit {covers} in on {date} at {time}. Please call {venuePhone} and we\u2019ll do our best to find another time. {team}',subject:'About your booking request for {date}',body:'Hi {first},\n\nThank you for asking to book with us. We\u2019re really sorry, but we can\u2019t fit your party in on {date} at {time}.\n\nWe\u2019d love to find another time that works. Give us a ring on {venuePhone} and we\u2019ll do our best.\n\nWith apologies and warm wishes,\n{team}'},order:{sms:'Hi {first}, thanks for your order {ref} from {venue}: {items}, {total}. Collection {collect}.{allergy} Questions? Call {venuePhone}. {team}',subject:'Your {venue} order {ref}',body:'Hi {first},\n\nThank you for your order. The kitchen has it and we\u2019ll have it ready for you.\n\n{details}\n\n{itemList}\n\n{allergy}\n\nAny questions, or need to change something? Call us on {venuePhone} and quote {ref}.\n\nYou\u2019ll find us at {address}.\n\nEnjoy!\n{team}'}},a=[{key:'first',what:'Guest\u2019s first name'},{key:'name',what:'Name on the booking'},{key:'venue',what:'Venue name'},{key:'date',what:'Day and date'},{key:'time',what:'Time'},{key:'covers',what:'e.g. 4 people'},{key:'ref',what:'Reference'},{key:'venuePhone',what:'Venue phone'},{key:'address',what:'Venue address'},{key:'team',what:'e.g. The Anchorage team'},{key:'allergy',what:'Allergy reassurance (only if one was noted)'},{key:'note',what:'Their note (email only)'},{key:'details',what:'Details box (email only)'},{key:'items',what:'Orders: e.g. 3 items'},{key:'total',what:'Orders: total'},{key:'collect',what:'Orders: collection time'},{key:'itemList',what:'Orders: list of items (email)'}],i=t=>/^the\s/i.test(t.trim())?`${t.trim()} team`:`The ${t.trim()} team`,l=t=>t.trim().replace(/^(mr|mrs|ms|miss|dr)\.?\s+/i,'').split(/\s+/)[0]||'there',s=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],d=['January','February','March','April','May','June','July','August','September','October','November','December'],u=t=>{const[n,r,o]=t.split('-').map(Number),a=new Date(n,r-1,o,12);return`${s[a.getDay()]} ${o} ${d[r-1]}`},m=t=>{const n=new Date(t);return`${String(n.getHours()).padStart(2,'0')}:${String(n.getMinutes()).padStart(2,'0')}`};function c(t){return{venue:t.name,venuePhone:t.phone||'the restaurant',address:t.address||t.location,team:i(t.name)}}function y(t,n){return t.replace(/\{(\w+)\}/g,(t,r)=>r in n?n[r]:t).replace(/[ \t]{2,}/g,' ').replace(/ +([.,])/g,'$1').trim()}const h=(t,n)=>y(t,n).split(/\n{2,}/).map(t=>t.trim()).filter(Boolean).join('\n\n'),p=t=>t.replace(/&/g,'&').replace(//g,'>').replace(/"/g,'"');const f=/^[A-Za-z0-9 \r\n@\xa3$\xa5\xe8\xe9\xf9\xec\xf2\xc7\xd8\xf8\xc5\xe5\u0394_\u03a6\u0393\u039b\u03a9\u03a0\u03a8\u03a3\u0398\u039e\xc6\xe6\xdf\xc9!"#\xa4%&'()*+,\-./:;<=>?\xa1\xc4\xd6\xd1\xdc\xa7\xbf\xe4\xf6\xf1\xfc\xe0^{}\\[~\]|\u20ac]*$/;const b=t=>t.replace(/[\u2018\u2019]/g,"'").replace(/[\u201c\u201d]/g,'"').replace(/[\u2013\u2014]/g,'-').replace(/\u2026/g,'...').replace(/\xd7/g,'x')},1105,[814,816]); +__d(function(g,r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.ukPhone=function(t){const s=(t??'').trim();if(!s)return{ok:!1,error:'A phone number is needed so we can send the confirmation.'};let l=s.replace(/[\s\-().]/g,'');l.startsWith('+44')?l='0'+l.slice(3):l.startsWith('0044')?l='0'+l.slice(4):/^44\d{10}$/.test(l)&&(l='0'+l.slice(2));l.startsWith('0(0)')&&(l=l.replace('0(0)','0'));l.startsWith('00')&&(l=l.slice(1));if(!/^0\d+$/.test(l))return{ok:!1,error:'Please use numbers only, for example 07700 900123.'};const n=/^07\d{9}$/.test(l),o=/^0[1238]\d{8,9}$/.test(l);if(!n&&!o)return{ok:!1,error:'That doesn\u2019t look like a UK mobile or landline. For example 07700 900123 or 01292 502826.'};const c=n?`${l.slice(0,5)} ${l.slice(5)}`:/^02/.test(l)?`${l.slice(0,3)} ${l.slice(3,7)} ${l.slice(7)}`:/^0(3|8)/.test(l)?`${l.slice(0,4)} ${l.slice(4,7)} ${l.slice(7)}`:`${l.slice(0,5)} ${l.slice(5)}`;return{ok:!0,e164:'+44'+l.slice(1),pretty:c,kind:n?'mobile':'landline'}},e.emailOk=function(t){const s=(t??'').trim();return!s||/^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/.test(s)}},1106,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"shallow",{enumerable:!0,get:function(){return c}});const t=t=>Symbol.iterator in t,n=t=>"entries"in t,o=(t,n)=>{const o=t instanceof Map?t:new Map(t.entries()),s=n instanceof Map?n:new Map(n.entries());if(o.size!==s.size)return!1;for(const[t,n]of o)if(!s.has(t)||!Object.is(n,s.get(t)))return!1;return!0},s=(t,n)=>{const o=t[Symbol.iterator](),s=n[Symbol.iterator]();let c=o.next(),u=s.next();for(;!c.done&&!u.done;){if(!Object.is(c.value,u.value))return!1;c=o.next(),u=s.next()}return!!c.done&&!!u.done};function c(c,u){return!!Object.is(c,u)||"object"==typeof c&&null!==c&&"object"==typeof u&&null!==u&&(Object.getPrototypeOf(c)===Object.getPrototypeOf(u)&&(t(c)&&t(u)?n(c)&&n(u)?o(c,u):s(c,u):o({entries:()=>Object.entries(c)},{entries:()=>Object.entries(u)})))}},1107,[]); +__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"EXAMPLE_TAG",{enumerable:!0,get:function(){return t}}),_e.exampleCards=function(t){return l.flatMap(l=>{const h=t.find(e=>e.id===l.menuItemId);if(!h)return[];return[{id:(0,e.uuidFrom)(`card:${h.restaurantId}:${h.id}`),restaurantId:h.restaurantId,menuItemId:h.id,dish:h.name,section:h.section,price:h.price,photo:l.photo,ingredients:o(l.menuItemId,l.ings),steps:l.steps,allergens:l.allergens,dismissed:l.dismissed??[],allergenNotes:l.notes,allergensConfirmed:{by:s.by,at:s.at},signOff:l.awaiting?null:s,wasLive:!0,origin:'example',version:l.awaiting?2:1,createdAt:n,updatedAt:l.awaiting?'2026-10-28T15:20:00.000Z':n,updatedBy:l.awaiting?'Example edit (demo)':s.by}]})},_e.importedCard=function(t,s){return{id:(0,e.uuidFrom)(`card:${t.restaurantId}:${t.id}`),restaurantId:t.restaurantId,menuItemId:t.id,dish:t.name,section:t.section,price:t.price,ingredients:[],steps:[],allergens:{...t.allergens},dismissed:[],allergenNotes:t.allergenNotes,allergensConfirmed:t.signOff?{by:t.signOff.by,at:t.signOff.at}:void 0,signOff:t.signOff?{by:t.signOff.by,at:t.signOff.at}:null,wasLive:!t.hidden||!!t.signOff,origin:'imported',version:1,createdAt:s,updatedAt:s,updatedBy:'Imported from the menu'}};var e=r(d[0]);const t='Example data',s={by:'Example sign-off (demo)',at:'2026-10-26T10:00:00.000Z'},n='2026-10-26T09:00:00.000Z',o=(e,t)=>t.map(([t,s,n],o)=>({id:`${e}-i${o}`,qty:t,unit:s,name:n})),l=[{menuItemId:'a-lobster',photo:'asset:lobster',ings:[['1','whole','Live Dunure lobster (c. 600 g, Kitty Fisher)'],['60','g','Garlic butter'],['\xbd','','Lemon, charred'],['60','g','Mixed leaves, cucumber and red onion'],['15','ml','House vinaigrette (Dijon mustard)'],['200','g','Triple-cooked chips']],steps:['Chill the lobster for 20 minutes, then dispatch humanely and split lengthways. Remove the stomach sac and the intestinal tract.','Crack the claws. Season the flesh and spoon over half the garlic butter.','Grill flesh side up for 6\u20138 minutes until just opaque; baste with the rest of the butter.','Char the lemon on the grill. Dress the salad at the pass.','Plate on the long board: lobster, claws alongside, salad, chips in the cone, lemon and a pot of the pan butter.'],allergens:{crustaceans:'contains',milk:'contains',mustard:'contains',gluten:'may',fish:'may'},notes:'Chips are cooked in a shared fryer (gluten, fish, crustaceans may be present).'},{menuItemId:'a-skink',photo:'asset:skink',ings:[['120','g','Smoked haddock, undyed'],['200','ml','Whole milk'],['20','g','Butter'],['60','g','Leek, sliced'],['40','g','Onion, diced'],['120','g','Floury potato, diced'],['1','tbsp','Parsley, chopped'],['1','slice','Crusty bread'],['10','g','Butter (portion)']],steps:['Poach the haddock in the milk for 5 minutes. Lift out, flake and keep the milk.','Sweat the leek and onion in the butter until soft, with no colour.','Add the potato and the poaching milk; simmer for 15 minutes until the potato breaks down.','Crush a third of the potato for body, return the haddock and season with pepper.','Serve in the warm bowl, parsley on top, bread and butter on the side.'],allergens:{fish:'contains',milk:'contains',gluten:'contains'}},{menuItemId:'a-fishsupper',photo:'asset:fishsupper',ings:[['200','g','Haddock fillet, locally landed'],['80','g','Self-raising flour'],['100','ml','Beer (lager)'],['250','g','Triple-cooked chips'],['80','g','Garden peas'],['10','g','Butter'],['40','g','Tartare sauce (mayonnaise, capers, gherkins)'],['\xbc','','Lemon']],steps:['Whisk the flour and cold beer to a thick batter; rest for 10 minutes.','Dust the haddock in flour, dip in the batter and lower into the fryer at 180 \xb0C for 5\u20136 minutes.','Fry the chips at 190 \xb0C until golden.','Warm the peas with the butter.','Plate the fish on the chips, peas in the ramekin, tartare and lemon on the side.'],allergens:{fish:'contains',gluten:'contains',eggs:'contains',milk:'contains',mustard:'may',crustaceans:'may',sulphites:'may'},notes:'Shared fryer. Tartare is made with mayonnaise (egg, may contain mustard). The beer in the batter may contain sulphites.'},{menuItemId:'a-moules',photo:'asset:moules',ings:[['500','g','Scottish rope mussels, cleaned'],['30','g','Butter'],['1','','Shallot, finely diced'],['2','cloves','Garlic, sliced'],['100','ml','Dry white wine'],['60','ml','Double cream'],['1','tbsp','Parsley, chopped'],['2','slices','Crusty bread']],steps:['Check every mussel: discard any that are cracked or stay open when tapped.','Sweat the shallot and garlic in the butter for 2 minutes.','Add the mussels and wine, cover and steam on a high heat for 3\u20134 minutes until they open.','Discard any that stay shut. Stir in the cream and parsley.','Serve in the deep bowl with the bread and an empty-shell bowl.'],allergens:{molluscs:'contains',milk:'contains',sulphites:'contains',gluten:'contains'}},{menuItemId:'a-stp',photo:'asset:stp',awaiting:!0,ings:[['30','g','Medjool dates, chopped'],['40','ml','Boiling water'],['25','g','Butter'],['30','g','Dark muscovado sugar'],['1','','Egg (\xbd per portion)'],['35','g','Self-raising flour'],['60','ml','Butterscotch sauce (butter, cream, brown sugar)']],steps:['Soak the dates in the boiling water for 10 minutes, then blitz.','Cream the butter and sugar, beat in the egg, fold in the flour and the dates.','Steam in buttered moulds for 35 minutes.','Warm the butterscotch sauce.','Turn out, pour over the sauce and serve with the guest\u2019s choice of custard, ice cream or cream.'],allergens:{gluten:'contains',milk:'contains',eggs:'contains',sulphites:'may'},notes:'Dried dates may contain sulphites. Accompaniments are chosen at order (see the dish options).'}]},1108,[1103]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/customer-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg",width:800,height:600,toString(){return this.uri}}},1109,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/customer-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg",width:800,height:600,toString(){return this.uri}}},1110,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/customer-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg",width:800,height:600,toString(){return this.uri}}},1111,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/customer-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg",width:800,height:600,toString(){return this.uri}}},1112,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/customer-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg",width:800,height:600,toString(){return this.uri}}},1113,[]); +__d(function(g,r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"gid",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"SEED_CALC_INGREDIENTS",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"SEED_CALC_DISHES",{enumerable:!0,get:function(){return I}}),_e.stripGpSamples=y,Object.defineProperty(_e,"useGpCalc",{enumerable:!0,get:function(){return v}}),_e.useGpCalcView=function(){const e=v();return(0,t.useMemo)(()=>i.LIVE_VENUE_BUILD?{...e,...y(e)}:e,[e])};var e,i=r(_d[0]),t=r(_d[1]),s=r(_d[2]),a=r(_d[3]),n=r(_d[4]),c=(e=n)&&e.__esModule?e:{default:e},d=r(_d[5]),o=r(_d[6]),p=r(_d[7]);let l=0;const f=e=>`${e}-${Date.now().toString(36)}${(l++).toString(36)}`,h=(e,i,t,s,a,n=0,c=[])=>({id:e,name:i,packSize:t,packUnit:s,packPrice:a,wastePct:n,allergens:c}),u=e=>new Date(Date.now()-864e5*e).toISOString(),k={'gi-haddock':[8100,8700,8500],'gi-chicken':[4500,4600,4750],'gi-steak':[6200,5900,6e3],'gi-potato':[1450,1500,1600],'gi-oil':[3400,3300,3200]},S=[h('gi-haddock','Haddock fillet',5,'kg',8500,5,['fish']),h('gi-potato','Potatoes (chipping)',25,'kg',1600,20),h('gi-batter','Batter mix',3.5,'kg',770,0,['gluten']),h('gi-oil','Rapeseed oil',20,'L',3200),h('gi-peas','Garden peas (frozen)',2.5,'kg',450),h('gi-lemon','Lemons',80,'each',1600),h('gi-mayo','Mayonnaise',5,'L',1250,0,['eggs','mustard']),h('gi-capers','Capers',1,'kg',900,0,['sulphites']),h('gi-gherkin','Gherkins',2,'kg',700,0,['sulphites']),h('gi-steak','Braising steak',5,'kg',6e3,10),h('gi-pastry','Puff pastry',5,'kg',2250,0,['gluten','milk']),h('gi-onion','Onions',10,'kg',1e3,10),h('gi-stock','Beef stock',1,'L',350,0,['celery']),h('gi-chicken','Chicken breast',5,'kg',4750),h('gi-leaves','Cos lettuce',12,'each',960,15),h('gi-parmesan','Parmesan',1,'kg',1800,0,['milk']),h('gi-bread','Sourdough loaf',1,'each',300,0,['gluten']),h('gi-anchovy','Anchovies',.5,'kg',900,0,['fish']),h('gi-sponge','Date sponge (tray of 12)',1,'each',600,0,['gluten','eggs','milk']),h('gi-toffee','Toffee sauce',2,'L',1100,0,['milk']),h('gi-icecream','Vanilla ice cream',4,'L',1800,0,['milk','eggs'])].map(e=>({...e,prices:(k[e.id]??[e.packPrice]).map((e,i,t)=>({p:e,at:u(7*(t.length-i))}))})),P=(e,i,t,s,a,n,c,d="")=>({id:e,name:i,category:t,lines:s.map(([e,i,t])=>({ingId:e,qty:i,unit:t})),portions:a,target:70,menuPrice:n,status:c,description:d,allergens:[]}),I=[P('gd-chips','Chips (portion)','Sides',[['gi-potato',300,'g'],['gi-oil',50,'ml']],1,450,'ready','Hand-cut, twice-cooked chips.'),P('gd-tartare','Tartare sauce (batch of 20)','Sauces & extras',[['gi-mayo',1,'L'],['gi-capers',100,'g'],['gi-gherkin',150,'g'],['gi-lemon',2,'each']],20,void 0,'draft'),P('gd-fish','Fish & chips (example)','Mains',[['gi-haddock',220,'g'],['gi-batter',60,'g'],['dish:gd-chips',1,'each'],['gi-peas',80,'g'],['dish:gd-tartare',1,'each'],['gi-lemon',1,'each']],1,1695,'ready','Beer-battered haddock, chips, peas and tartare sauce.'),P('gd-pie','Steak pie (example)','Mains',[['gi-steak',2,'kg'],['gi-pastry',800,'g'],['gi-onion',500,'g'],['gi-stock',1,'L']],10,1595,'draft','Slow-braised steak under a puff pastry lid. Batch of 10.'),P('gd-caesar','Chicken Caesar (example)','Starters',[['gi-chicken',160,'g'],['gi-leaves',.5,'each'],['gi-parmesan',15,'g'],['gi-bread',.1,'each'],['gi-anchovy',8,'g']],1,1150,'draft'),P('gd-stp','Sticky toffee pudding (example)','Desserts',[['gi-sponge',.083,'each'],['gi-toffee',60,'ml'],['gi-icecream',70,'ml']],1,695,'ready','Warm date sponge, toffee sauce, vanilla ice cream.')];function y(e){const i=e=>I.some(i=>i.id===e.id&&JSON.stringify(i)===JSON.stringify(e))||/\(example\)/i.test(e.name),t=new Set(e.dishes.filter(e=>!i(e)).map(e=>e.id));let s=!0;for(;s;){s=!1;for(const i of e.dishes.filter(e=>t.has(e.id)))for(const e of i.lines)e.ingId.startsWith('dish:')&&!t.has(e.ingId.slice(5))&&(t.add(e.ingId.slice(5)),s=!0)}const a=e.dishes.filter(e=>t.has(e.id)),n=new Set(a.flatMap(e=>e.lines.map(e=>e.ingId))),c=e=>{const i=S.find(i=>i.id===e.id);if(!i)return!1;const t=({prices:e,...i})=>JSON.stringify(i);return t(i)===t(e)&&(!e.prices?.length||JSON.stringify(e.prices.map(e=>e.p))===JSON.stringify(i.prices?.map(e=>e.p)))};return{dishes:a,ingredients:e.ingredients.filter(e=>n.has(e.id)||!c(e))}}const v=(0,d.create)()((0,o.persist)((e,t)=>({ingredients:a.IS_ISOLATED_VENUE||i.LIVE_VENUE_BUILD?[]:S,dishes:a.IS_ISOLATED_VENUE||i.LIVE_VENUE_BUILD?[]:I,settings:{vatPct:20,pricePoints:!0,defaultTarget:70,multipleBasis:'inc',priceBasis:'latest',avgOf:5},alerts:[],saveIngredient:i=>{const s=t(),a=s.ingredients.find(e=>e.id===i.id),n=s.ingredients.map(e=>e.id===i.id?i:e);let c=s.alerts;if(a&&(a.packPrice!==i.packPrice||a.packSize!==i.packSize||a.wastePct!==i.wastePct)){const e=s.settings.vatPct,t=s.dishes.filter(e=>e.menuPrice).map(i=>{const t=(0,p.gpOf)((0,p.portionCost)(i,s.ingredients,s.dishes),i.menuPrice,e).gpPct,a=(0,p.gpOf)((0,p.portionCost)(i,n,s.dishes),i.menuPrice,e).gpPct;return{id:i.id,name:i.name,before:t,after:a,belowTarget:ae.aftere.packPrice/e.packSize/(1-(e.wastePct||0)/100),o=(d(i)-d(a))/d(a)*100;t.length&&(c=[{id:f('ma'),at:(new Date).toISOString(),ingredient:i.name,change:`${o>=0?'+':''}${o.toFixed(0)}%`,dishes:t},...c].slice(0,20))}e({ingredients:n,alerts:c})},addPricePaid:(e,i,s)=>{const a=t(),n=a.ingredients.find(i=>i.id===e);if(!(n&&i>0))return;const c=[...n.prices?.length?n.prices:[{p:n.packPrice,at:''}],{p:Math.round(i),at:s??(new Date).toISOString()}].slice(-20),d={...n,prices:c};t().saveIngredient({...d,packPrice:(0,p.costingPrice)(d,a.settings.priceBasis,a.settings.avgOf??5)})},addIngredient:i=>{const t=f('gi');return e(e=>({ingredients:[...e.ingredients,{...i,id:t}]})),t},saveDish:i=>e(e=>({dishes:e.dishes.some(e=>e.id===i.id)?e.dishes.map(e=>e.id===i.id?{...i,updatedAt:(new Date).toISOString()}:e):[{...i,updatedAt:(new Date).toISOString()},...e.dishes]})),removeDish:i=>e(e=>({dishes:e.dishes.filter(e=>e.id!==i)})),setSettings:i=>{const s={...t().settings,...i};if(e({settings:s}),void 0!==i.priceBasis||void 0!==i.avgOf)for(const e of t().ingredients){const i=(0,p.costingPrice)(e,s.priceBasis,s.avgOf??5);i!==e.packPrice&&t().saveIngredient({...e,packPrice:i})}},dismissAlert:i=>e(e=>({alerts:e.alerts.filter(e=>e.id!==i)}))}),{name:'covercharge-gpcalc-v1',storage:(0,o.createJSONStorage)(()=>c.default),version:4,migrate:async(e,t)=>(i.LIVE_VENUE_BUILD&&e&&(await(0,s.archiveChefCache)('gpcalc',e),e={...e,...y({...e,dishes:e.dishes||[],ingredients:e.ingredients||[]})}),t<2&&e&&(e.ingredients=(e.ingredients??[]).map(e=>e.prices?.length?e:{...e,prices:[{p:e.packPrice,at:(new Date).toISOString()}]}),e.settings={priceBasis:'latest',avgOf:5,...e.settings??{}}),e)}))},1114,[833,30,1096,5,1082,952,1091,1115]); +__d(function(g,r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DISH_CATEGORIES",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"pricesOf",{enumerable:!0,get:function(){return n}}),e.priceStats=i,Object.defineProperty(e,"costingPrice",{enumerable:!0,get:function(){return c}}),e.avgMenuPrice=function(t,n,i){const c=t.filter(t=>t.category===n&&t.menuPrice&&t.id!==i).map(t=>t.menuPrice);return c.length?{avg:Math.round(c.reduce((t,n)=>t+n,0)/c.length),count:c.length}:null},Object.defineProperty(e,"unitsFor",{enumerable:!0,get:function(){return a}}),e.lineCost=s,Object.defineProperty(e,"portionCost",{enumerable:!0,get:function(){return u}}),e.suggestAllergens=function t(n,i,c=[],o=0){const a=new Set;for(const s of n.lines)if(s.ingId.startsWith('dish:')){const n=c.find(t=>t.id===s.ingId.slice(5));n&&o<4&&((n.allergens??[]).forEach(t=>a.add(t)),t(n,i,c,o+1).forEach(t=>a.add(t)))}else i.find(t=>t.id===s.ingId)?.allergens?.forEach(t=>a.add(t));return[...a]},Object.defineProperty(e,"exVat",{enumerable:!0,get:function(){return d}}),e.gpOf=function(t,n,i){const c=d(n,i);return{ex:c,gpPct:c>0?(c-t)/c*100:0,cashGp:c-t,foodCostPct:c>0?t/c*100:0}},e.toPricePoint=f,e.suggestPrice=function(t,n,i,c){const o=Math.min(95,Math.max(0,n)),a=t/(1-o/100)*(1+i/100);return c?f(Math.ceil(a)):Math.ceil(a)},Object.defineProperty(e,"toneFor",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"money",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"pct",{enumerable:!0,get:function(){return p}}),e.multipleOf=function(t,n,i,c="inc"){return t<=0?0:('inc'===c?n:d(n,i))/t},Object.defineProperty(e,"fmtX",{enumerable:!0,get:function(){return h}}),e.suggestForMultiple=function(t,n,i,c,o){const a=t*Math.max(0,n)*('ex'===c?1+i/100:1);return o?f(Math.ceil(a)):Math.ceil(a)};const t=['Starters','Mains','From the Grill','Sides','Desserts','Specials','Kids','Sauces & extras'],n=t=>t.prices?.length?t.prices:[{p:t.packPrice,at:''}];function i(t,i=5){const c=n(t),o=c.slice(-Math.max(1,i)),a=Math.round(o.reduce((t,n)=>t+n.p,0)/o.length);return{latest:c[c.length-1].p,avg:a,count:o.length,min:Math.min(...o.map(t=>t.p)),max:Math.max(...o.map(t=>t.p))}}const c=(t,n="latest",c=5)=>'average'===n?i(t,c).avg:i(t,c).latest;const o={kg:{dim:'mass',f:1e3},g:{dim:'mass',f:1},L:{dim:'vol',f:1e3},ml:{dim:'vol',f:1},each:{dim:'each',f:1}},a=t=>'mass'===o[t].dim?['g','kg']:'vol'===o[t].dim?['ml','L']:['each'];function s(t,n,i=[],c=0){if(t.ingId.startsWith('dish:')){const o=i.find(n=>n.id===t.ingId.slice(5));return o&&c<4?u(o,n,i,c+1)*t.qty:0}const a=n.find(n=>n.id===t.ingId);if(!a||!a.packSize)return 0;const s=o[a.packUnit],d=o[t.unit];if(!d||s.dim!==d.dim)return 0;const f=a.packPrice/(a.packSize*s.f),l=Math.min(95,Math.max(0,t.wastePct??a.wastePct??0));return t.qty*d.f*f/(1-l/100)}const u=(t,n,i=[],c=0)=>t.lines.reduce((t,o)=>t+s(o,n,i,c),0)/Math.max(1,t.portions||1);const d=(t,n)=>t/(1+n/100);function f(t){const n=Math.floor(t/100),i=t-100*n;return i<=50?100*n+50:i<=95?100*n+95:100*(n+1)+50}const l=(t,n)=>t>=n-.05?'ok':t>=n-5?'amber':'red',m=t=>`\xa3${(Math.round(t)/100).toFixed(2)}`,p=t=>`${t.toFixed(1)}%`;const h=t=>`${t.toFixed(1)}x`},1115,[]); +__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.inviteFromLocation=function(n,t){const o=new URLSearchParams(n).get('invite');if(o)return o;const s=(t||'').match(/[#&]invite=([A-Za-z0-9_-]{10,})/);return s?s[1]:null},e.addressWithoutInvite=function(n){try{const t=new URL(n);t.searchParams.delete('invite');const o=t.hash.replace(/^#/,'').split('&').filter(n=>n&&!n.startsWith('invite=')).join('&');return t.hash=o?`#${o}`:'',t.toString()}catch{return n}},e.inviteRefusal=function(n){return/already been used/i.test(n)?'This link has already been used on another device. Ask your manager for a new one.':/expired/i.test(n)?'This link has expired. Ask your manager for a new one.':/replaced|switched off|not valid|invalid|unknown invite/i.test(n)?'This link has been replaced or switched off. Ask your manager for a new one.':/personal app link is incomplete/i.test(n)?'Open the complete personal iPhone link your manager sent.':/no longer active/i.test(n)?'This person is no longer on the team. Ask your manager if this is wrong.':null},Object.defineProperty(e,"WIPE_PREFIXES",{enumerable:!0,get:function(){return n}}),e.keysToWipe=function(t){return t.filter(t=>n.some(n=>t.startsWith(n)))};const n=['covercharge-','cc-sync:','cc-','sb-']},1116,[]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"TAKINGS_FIELDS",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"NO_SERVICE_SPLIT",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"TAKINGS_KEYS",{enumerable:!0,get:function(){return t}}),_e.withTakingsFields=function(t){t=t.filter(e=>!n.includes(e.key));const r=new Set(t.map(e=>e.key)),o=e.filter(e=>!r.has(e.key)).map(e=>({...e}));if(!o.length)return t;const l=t.findIndex(e=>'cash'===e.key),i=l<0?t.length:l+1;return[...t.slice(0,i),...o,...t.slice(i)]},Object.defineProperty(_e,"grossOf",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"DEFAULT_CASHUP_FIELDS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"DEFAULT_SALES_FIELDS",{enumerable:!0,get:function(){return l}}),_e.parseAmount=function(e,n="money"){const t=e.replace(/[\xa3,\s]/g,'');return t?'number'===n?/^\d{1,6}$/.test(t)?Number(t):null:/^-?\d{1,7}(\.\d{1,2})?$/.test(t)?Math.round(100*Number(t))/100:null:null},Object.defineProperty(_e,"isBlank",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"ymdUTC",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"addDaysYmd",{enumerable:!0,get:function(){return u}}),_e.weekStartOf=function(e){const n=(s(e).getUTCDay()+6)%7;return u(e,-n)},_e.combinedTips=function(e){const n='number'==typeof e.cashTips?e.cashTips:null,t='number'==typeof e.cardTips?e.cardTips:null;return null==n&&null==t?null:Math.round(100*((n??0)+(t??0)))/100},Object.defineProperty(_e,"takings",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"missing",{enumerable:!0,get:function(){return d}}),_e.dailySeries=function(e,n,t,r=c){const o=new Map(e.filter(e=>e.confirmedAt).map(e=>[e.date,e]));return Array.from({length:t},(e,l)=>{const i=u(n,l-t+1),a=o.get(i);return{date:i,value:a?r(a.vals):null}})},_e.weekCompare=function(e,n,t="net"){const r=n=>{const r=e.find(e=>e.weekStart===n&&e.confirmedAt),o=r?.vals[t];return'number'==typeof o?o:null},o=r(n),l=r(u(n,-7)),i=null!=o&&null!=l&&0!==l?Math.round((o-l)/l*1e3)/10:null;return{now:o,prev:l,change:i}},_e.tipsPot=function(e,n,t,r){const o=n.filter(e=>'payout'===e.kind&&e.throughDate).sort((e,n)=>e.at.localeCompare(n.at)),l=o[o.length-1],i=l?u(l.throughDate,1):t,a=e.filter(e=>e.date>=i&&e.date<=r).sort((e,n)=>e.date.localeCompare(n.date)),s=n.filter(e=>'correction'===e.kind&&e.forDate&&e.forDate>=i&&e.forDate<=r&&(!l||e.at>l.at)),c=Math.round(100*(a.reduce((e,n)=>e+n.total,0)+s.reduce((e,n)=>e+n.amount,0)))/100;return{from:i,total:Math.max(0,c),days:a,corrections:s,lastPayout:l??null,history:o.slice().reverse()}},_e.cashLocked=function(e,n=Date.now()){return!(!e.onServer||!e.confirmedAt)&&!(e.unlockedUntil&&Date.parse(e.unlockedUntil)>n)},_e.changedFields=function(e,n){const t=e??{},r=n??{},o=[],l=t.vals??{},i=r.vals??{};for(const e of new Set([...Object.keys(l),...Object.keys(i)]))JSON.stringify(l[e])!==JSON.stringify(i[e])&&o.push(e);JSON.stringify(t.categories??null)!==JSON.stringify(r.categories??null)&&(t.categories||r.categories)&&o.push('categories');JSON.stringify(t.photos??[])!==JSON.stringify(r.photos??[])&&e&&n&&o.push('photos');return o};const e=[{key:'gross',label:'Gross takings',kind:'money',fixed:!0,optional:!0},{key:'food',label:'Food takings (optional)',kind:'money',fixed:!0,optional:!0},{key:'drink',label:'Drink takings (optional)',kind:'money',fixed:!0,optional:!0}],n=['lunchGross','dinnerGross'],t=e.map(e=>e.key);const r=e=>'number'==typeof e.gross?e.gross:null,o=[{key:'card',label:'Card takings',kind:'money'},{key:'cash',label:'Cash takings',kind:'money'},...e,{key:'float',label:'Float (tills)',kind:'money'},{key:'cashTips',label:'Cash tips total',kind:'money',fixed:!0},{key:'cardTips',label:'Card tips total',kind:'money',fixed:!0},{key:'overUnder',label:'Over / under (discrepancy)',kind:'money'},{key:'notes',label:'Notes',kind:'text'}],l=[{key:'gross',label:'Gross sales',kind:'money'},{key:'net',label:'Net sales',kind:'money',fixed:!0},{key:'vat',label:'VAT',kind:'money'},{key:'covers',label:'Covers',kind:'number'},{key:'discounts',label:'Discounts',kind:'money'},{key:'refunds',label:'Refunds',kind:'money'}];const i=e=>null==e||''===e,a=e=>e.toISOString().slice(0,10),s=e=>new Date(`${e}T12:00:00Z`),u=(e,n)=>{const t=s(e);return t.setUTCDate(t.getUTCDate()+n),a(t)};const c=e=>{const n='number'==typeof e.card?e.card:null,t='number'==typeof e.cash?e.cash:null;return null==n&&null==t?null:(n??0)+(t??0)},d=(e,n)=>e.filter(e=>'text'!==e.kind&&!e.optional&&i(n[e.key])).map(e=>e.key)},1117,[]); +__d(function(g,r,_i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"hrRemote",{enumerable:!0,get:function(){return y}}),_e.exampleHr=f,_e.stripHrSamples=m,Object.defineProperty(_e,"useHr",{enumerable:!0,get:function(){return q}});var e,t=r(_d[0]),s=r(_d[1]),n=r(_d[2]),o=r(_d[3]),i=r(_d[4]),u=(e=i)&&e.__esModule?e:{default:e},d=r(_d[5]),l=r(_d[6]),c=r(_d[7]),h=r(_d[8]);const y={live:!1,checkout:null,post:null,vote:null,moderate:null,reply:null,trend:null,shouts:null,log:null,refresh:null},v=(e,t,s)=>(0,c.oneWayToken)(e,`shift:${t}:${s}`),p=(e,t)=>{const s=new Date(`${e}T12:00:00Z`);return s.setUTCDate(s.getUTCDate()+t),s.toISOString().slice(0,10)};function f(e,t){const s=[];for(let n=14;n>=1;n--){const o=p(t,-n),i=4===n?2:4+7*n%4;for(let t=0;t!((0,s.isAnchorage)(e.venue)&&e.example)),questions:e.questions.filter(e=>!((0,s.isAnchorage)(e.venue)&&/^hrq-ex-[123]$/.test(e.id))),shouts:e.shouts.filter(e=>!((0,s.isAnchorage)(e.venue)&&/^hrs-ex-[123]$/.test(e.id)))}}const q=(0,d.create)()((0,l.persist)((e,t)=>({secret:(0,c.newSecret)(),answered:[],voted:{},checkins:[],questions:[],shouts:[],log:[],seeded:{},ensure:(s,i)=>{if(n.LIVE_VENUE_BUILD||o.IS_ISOLATED_VENUE||['souters','kirkmichael','wildings'].includes(s)||t().seeded[s]||y.live)return;const u=f(s,i);e(e=>({seeded:{...e.seeded,[s]:!0},checkins:[...e.checkins,...u.checkins],questions:[...e.questions,...u.questions],shouts:[...e.shouts,...u.shouts]}))},hasAnswered:(e,s)=>t().answered.includes(v(t().secret,e,s)),submit:s=>{const n=t(),o=v(n.secret,s.rid,s.shiftKey);if(n.answered.includes(o))return'already';const i=(0,c.checkInPayload)({venue:s.rid,day:s.day,token:o,morale:s.morale,staffing:s.staffing}),u=s.question?(0,c.cleanQuestion)(s.question):null,d=s.shoutTo?.trim().slice(0,80)||void 0,l=s.shoutBody?.trim().slice(0,280)||void 0;return e({answered:[...n.answered,o].slice(-300)}),y.live&&y.checkout?(y.checkout({rid:s.rid,shiftKey:'',day:i.day,morale:i.morale,staffing:i.staffing,question:u??void 0,kind:s.kind??'up',shoutTo:d,shoutBody:l,token:o}),'queued'):(e(e=>({checkins:[...e.checkins,{venue:i.venue,day:i.day,morale:i.morale,staffing:i.staffing}],questions:u?[...e.questions,{id:(0,h.uuid)(),venue:s.rid,body:u,kind:s.kind??'up',up:0,yes:0,no:0,hidden:!1,postedOn:s.day}]:e.questions,shouts:d?[...e.shouts,{id:(0,h.uuid)(),venue:s.rid,day:s.day,to:d,body:l}]:e.shouts})),'ok')},skip:(s,n)=>{const o=t(),i=v(o.secret,s,n);o.answered.includes(i)||e({answered:[...o.answered,i].slice(-300)})},post:(t,s,n,o)=>{const i=(0,c.cleanQuestion)(s);if(!i)return null;const u=(0,h.uuid)();return e(e=>({questions:[...e.questions,{id:u,venue:t,body:i,kind:n,up:0,yes:0,no:0,hidden:!1,postedOn:o}]})),y.live&&y.post&&y.post(t,u,i,n),u},vote:(s,n)=>{const o=t();if(o.voted[s])return!1;const i=o.questions.find(e=>e.id===s);if(!i||i.hidden)return!1;const u='up'===i.kind?1:n;return e({voted:{...o.voted,[s]:u},questions:o.questions.map(e=>e.id===s?(0,c.applyVote)(e,u):e)}),y.live&&y.vote&&y.vote(s,(0,c.oneWayToken)(o.secret,`vote:${s}`),u),!0},moderate:(s,n,o,i)=>{const u=t().questions.find(e=>e.id===s);u&&(e(e=>({questions:e.questions.map(e=>e.id===s?{...e,hidden:'hide'===n}:e),log:[{id:(0,h.uuid)(),venue:u.venue,questionId:s,action:n,reason:o.trim()||void 0,by:i,at:(new Date).toISOString()},...e.log].slice(0,500)})),y.live&&y.moderate&&y.moderate(s,n,o.trim()))},reply:(s,n,o)=>{const i=n.trim().slice(0,600),u=t().questions.find(e=>e.id===s);if(!u)return;const d=(new Date).toISOString();e(e=>({questions:e.questions.map(e=>e.id===s?{...e,reply:i||void 0,replyAt:i?d:void 0}:e),log:[{id:(0,h.uuid)(),venue:u.venue,questionId:s,action:'reply',by:o,at:d},...e.log].slice(0,500)})),y.live&&y.reply&&y.reply(s,i)},setRemoteBoard:(t,s)=>e(e=>({questions:[...e.questions.filter(e=>e.venue!==t),...s]})),upsertRemote:t=>e(e=>({questions:e.questions.some(e=>e.id===t.id)?e.questions.map(e=>e.id===t.id?t:e):[...e.questions,t]}))}),{name:'covercharge-hr-v1',version:3,storage:(0,l.createJSONStorage)(()=>u.default),migrate:async e=>n.LIVE_VENUE_BUILD&&e?(await(0,t.archiveChefCache)('hr',e),{...e,...m(e)}):e}))},1118,[1096,1025,833,5,1082,952,1091,1119,1034]); +__d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"MIN_ANSWERS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"DEFAULT_WORDING",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"DEFAULT_HR",{enumerable:!0,get:function(){return r}}),e.hrSettingsOf=function(t){const n=t??{},r=n.wording??{},s=Object.fromEntries(Object.entries(o).map(([t,n])=>[t,a(r[t],'intro'===t||'staffing'===t||'question'===t?160:60,n)]));return{on:!1!==n.on,askQuestion:!1!==n.askQuestion,askShout:!1!==n.askShout,board:!1!==n.board,wording:s}},Object.defineProperty(e,"MORALE_STEPS",{enumerable:!0,get:function(){return s}}),e.moraleWord=function(t,n=o){return t<=1?n.moraleLow:t>=5?n.moraleHigh:2===t?'Fairly low':3===t?'OK':'Good'},Object.defineProperty(e,"STAFF_STOPS",{enumerable:!0,get:function(){return u}}),e.snapStaffing=i,e.staffingWord=function(t,n=o){const r=i(t);return r<=12?n.staffLow:r<45?"A bit short":r<=55?n.staffMid:r<88?"A bit over":n.staffHigh},e.oneWayToken=function(n,o){return(0,t.sha256HexSync)(`cc-hr:${n}:${o}`).slice(0,40)},e.newSecret=function(){let t='';const n=globalThis.crypto;if(n?.getRandomValues){return n.getRandomValues(new Uint8Array(24)).forEach(n=>{t+=n.toString(16).padStart(2,'0')}),t}for(let n=0;n<48;n++)t+=Math.floor(16*Math.random()).toString(16);return t},e.checkInPayload=function(t){const n=Math.max(1,Math.min(5,Math.round(t.morale)));return{venue:t.venue,day:t.day,token:t.token,morale:n,staffing:null==t.staffing?null:i(t.staffing)}},e.dayResults=function(t,o=n){const r=new Map;for(const n of t){const t=r.get(n.day)??[];t.push(n),r.set(n.day,t)}const a=[];let s=0;for(const[t,n]of[...r.entries()].sort(([t],[n])=>t.localeCompare(n))){if(n.lengtht.staffing).filter(t=>null!=t);a.push({day:t,answers:n.length,morale:Math.round(n.reduce((t,n)=>t+n.morale,0)/n.length*10)/10,staffing:r.length?Math.round(r.reduce((t,n)=>t+n,0)/r.length):null,short:r.filter(t=>t<45).length,perfect:r.filter(t=>t>=45&&t<=55).length,over:r.filter(t=>t>55).length})}return{shown:a,held:s}},Object.defineProperty(e,"QUESTION_MAX",{enumerable:!0,get:function(){return f}}),e.cleanQuestion=function(t){const n=t.replace(/\s+/g,' ').trim().slice(0,f);return n.length>=3?n:null},e.boardOrder=function(t,n){const o=t=>'up'===t.kind?t.up:t.yes+t.no;return t.filter(t=>n||!t.hidden).sort((t,n)=>Number(t.hidden)-Number(n.hidden)||o(n)-o(t)||n.postedOn.localeCompare(t.postedOn)||t.id.localeCompare(n.id))},e.applyVote=function(t,n){return'up'===t.kind?{...t,up:t.up+1}:1===n?{...t,yes:t.yes+1}:{...t,no:t.no+1}};var t=_r(d[0]);const n=3,o={intro:'Before you go: 3 quick taps, about 15 seconds. Your name is never saved with your answers.',morale:'How was team morale today?',moraleLow:'Low',moraleHigh:'High',staffing:'Was there enough staff on today for the number of customers?',staffLow:'Not enough',staffMid:'Perfect',staffHigh:'Overstaffed',question:'Got a question you\u2019d like to post anonymously for the team to vote on?',shout:'Shout out a teammate?'},r={on:!0,askQuestion:!0,askShout:!0,board:!0,wording:o},a=(t,n,o)=>('string'==typeof t?t.trim().slice(0,n):'')||o;const s=[1,2,3,4,5];const u=[0,12.5,25,37.5,50,62.5,75,87.5,100].map(t=>Math.round(t));function i(t){const n=Math.max(0,Math.min(100,Number.isFinite(t)?t:50));return u.reduce((t,o)=>Math.abs(o-n)>>0;o.push(c>>>24&255,c>>>16&255,c>>>8&255,255&c,h>>>24&255,h>>>16&255,h>>>8&255,255&h);const l=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),u=new Uint32Array(64),f=(t,n)=>t>>>n|t<<32-n;for(let n=0;n>>3,e=f(u[t-2],17)^f(u[t-2],19)^u[t-2]>>>10;u[t]=u[t-16]+n+u[t-7]+e>>>0}let e=l[0],s=l[1],c=l[2],h=l[3],a=l[4],i=l[5],p=l[6],d=l[7];for(let n=0;n<64;n++){const o=d+(f(a,6)^f(a,11)^f(a,25))+(a&i^~a&p)+t[n]+u[n]>>>0,l=(f(e,2)^f(e,13)^f(e,22))+(e&s^e&c^s&c)>>>0;d=p,p=i,i=a,a=h+o>>>0,h=c,c=s,s=e,e=o+l>>>0}l[0]=l[0]+e>>>0,l[1]=l[1]+s>>>0,l[2]=l[2]+c>>>0,l[3]=l[3]+h>>>0,l[4]=l[4]+a>>>0,l[5]=l[5]+i>>>0,l[6]=l[6]+p>>>0,l[7]=l[7]+d>>>0}return Array.from(l).map(t=>t.toString(16).padStart(8,'0')).join('')};const t=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function n(t){const n=[];for(let e=0;e=55296&&o<=56319&&e+1=56320&&n<=57343&&(o=65536+(o-55296<<10)+(n-56320),e++)}o<128?n.push(o):o<2048?n.push(192|o>>6,128|63&o):o<65536?n.push(224|o>>12,128|o>>6&63,128|63&o):n.push(240|o>>18,128|o>>12&63,128|o>>6&63,128|63&o)}return n}},1120,[]); +__d(function(g,_r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"LEGAL_LIMIT_MINS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"DEFAULT_BREAK_RULES",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"REMINDER_WINDOW_MINS",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"CHAIRS_TEXT",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"defaultChairs",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"DAY_NAMES",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"AUDIENCE_LABEL",{enumerable:!0,get:function(){return u}}),e.clampRules=s,Object.defineProperty(e,"validTime",{enumerable:!0,get:function(){return c}}),e.ukClock=d,e.reminderDue=function(t,n){const o=d(n);if(t.paused||!c(t.time)||!t.days.includes(o.dow))return{due:!1,forDate:o.ymd};const i=l(t.time);return{due:o.mins>=i&&o.mins=t.shiftEnd))return null;const r=m(t).filter(n=>n.at<=t.now),o=r.length?r[r.length-1]:null;if(!o)return null;if(t.nowr?o:null}return o};const t=360,n={on:!0,afterMins:240,repeatMins:30,snoozeMins:15},r=180,o='Time to put the chairs up on the tables',i=t=>({id:t,text:o,days:[5,0],time:'21:00',audience:'all',builtIn:'chairs'}),a=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],u={all:'Everyone on shift',foh:'Front of house',kitchen:'Kitchen'};function s(r){const o=(t,n,r,o)=>{const i=Math.round(Number(t));return Number.isFinite(i)?Math.min(o,Math.max(r,i)):n};return{on:!1!==r.on,afterMins:o(r.afterMins,n.afterMins,30,t),repeatMins:o(r.repeatMins,n.repeatMins,5,120),snoozeMins:o(r.snoozeMins,n.snoozeMins,5,60)}}const c=t=>/^([01]\d|2[0-3]):[0-5]\d$/.test(t);function d(t){const n='number'==typeof t?new Date(t):t,r=Object.fromEntries(new Intl.DateTimeFormat('en-GB',{timeZone:'Europe/London',weekday:'short',year:'numeric',month:'2-digit',day:'2-digit',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}).formatToParts(n).map(t=>[t.type,t.value]));return{dow:a.indexOf(String(r.weekday).slice(0,3)),mins:60*Number(r.hour)+Number(r.minute),ymd:`${r.year}-${r.month}-${r.day}`}}const l=t=>60*Number(t.slice(0,2))+Number(t.slice(3,5));const f=(t,n)=>'all'===t||('kitchen'===t?n:!n);function m(t){const n=s(t.rules),r=t.clockIn??t.shiftStart;if(!n.on||void 0===r||t.hadBreak)return[];const o=r+216e5,i=Math.min(void 0!==t.rotaBreak&&t.rotaBreak>r?t.rotaBreak:r+6e4*n.afterMins,o),a=[{stage:1,at:i,label:void 0!==t.rotaBreak&&t.rotaBreak>r&&t.rotaBreak<=o?'Your break on the rota is now.':'Time for your break.'}],u=i+6e4*n.repeatMins;return a.push({stage:2,at:u,label:'Reminder: you haven\u2019t had your break yet.'}),o>u&&a.push({stage:3,at:o,label:'You\u2019ve worked 6 hours without a break. You need a 20-minute break (UK law).'}),a}},1121,[]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"FunctionRegion",{enumerable:!0,get:function(){return e.FunctionRegion}}),Object.defineProperty(_e,"FunctionsError",{enumerable:!0,get:function(){return e.FunctionsError}}),Object.defineProperty(_e,"FunctionsFetchError",{enumerable:!0,get:function(){return e.FunctionsFetchError}}),Object.defineProperty(_e,"FunctionsHttpError",{enumerable:!0,get:function(){return e.FunctionsHttpError}}),Object.defineProperty(_e,"FunctionsRelayError",{enumerable:!0,get:function(){return e.FunctionsRelayError}}),Object.defineProperty(_e,"PostgrestError",{enumerable:!0,get:function(){return t.PostgrestError}}),Object.defineProperty(_e,"StorageApiError",{enumerable:!0,get:function(){return r.StorageApiError}}),Object.defineProperty(_e,"SupabaseClient",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"createClient",{enumerable:!0,get:function(){return N}});var e=_r(d[0]),t=_r(d[1]),n=_r(d[2]);Object.keys(n).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return n[e]}})});var r=_r(d[3]),s=_r(d[4]);Object.keys(s).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return s[e]}})});let o,i="";var c;if("undefined"!=typeof Deno)i="deno",o=null===(c=Deno.version)||void 0===c?void 0:c.deno;else if("undefined"!=typeof document)i="web";else if("undefined"!=typeof navigator&&"ReactNative"===navigator.product)i="react-native";else{var u;i="node",o="undefined"!=typeof process?null===(u=process.version)||void 0===u?void 0:u.replace(/^v/,""):void 0}const l=[`runtime=${i}`];o&&l.push(`runtime-version=${o}`);const h={headers:{"X-Client-Info":`supabase-js/2.109.0; ${l.join("; ")}`}},f={schema:"public"},p={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},b={},v={enabled:!1,respectSamplingDecision:!0};let y=null;function w(){return e=this,t=void 0,r=function*(){try{const e=yield(null===y&&(y=import("@opentelemetry/api").catch(()=>null)),y);if(!e||!e.propagation||!e.context)return null;const t={};e.propagation.inject(e.context.active(),t);const n=t.traceparent;return n?{traceparent:n,tracestate:t.tracestate,baggage:t.baggage}:null}catch(e){return null}},new((n=void 0)||(n=Promise))(function(s,o){function i(e){try{u(r.next(e))}catch(e){o(e)}}function c(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(i,c)}u((r=r.apply(e,t||[])).next())});var e,t,n,r}function k(e){if(!e||"string"!=typeof e)return null;const t=e.split("-");if(4!==t.length)return null;const[n,r,s,o]=t;if(2!==n.length||32!==r.length||16!==s.length||2!==o.length)return null;const i=/^[0-9a-f]+$/i;return i.test(n)&&i.test(r)&&i.test(s)&&i.test(o)?"00000000000000000000000000000000"===r||"0000000000000000"===s?null:{version:n,traceId:r,parentId:s,traceFlags:o,isSampled:!(1&~parseInt(o,16))}:null}function O(e,t){if(!e||!t||0===t.length)return!1;let n;if(e instanceof URL)n=e;else try{n=new URL(e)}catch(e){return!1}for(const e of t)try{if("string"==typeof e){if(T(n.hostname,e))return!0}else if(e instanceof RegExp){if(e.test(n.hostname))return!0}else if("function"==typeof e&&e(n))return!0}catch(e){continue}return!1}function T(e,t){if(t===e)return!0;if(t.startsWith("*.")){const n=t.slice(2);if(e.endsWith(n)&&(e===n||e.endsWith("."+n)))return!0}return!1}function P(e){const t=[];try{const n=new URL(e);t.push(n.hostname)}catch(e){}return t.push("*.supabase.co","*.supabase.in"),t.push("localhost","127.0.0.1","[::1]"),t}function S(e){return(S="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function j(e,t){if("object"!=S(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=S(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function E(e){var t=j(e,"string");return"symbol"==S(t)?t:t+""}function U(e,t,n){return(t=E(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function A(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function R(e){for(var t=1;te?(...t)=>e(...t):(...e)=>fetch(...e),F=(e,t,n,r,s)=>{const o=C(r),i=Headers,c=!0===(null==s?void 0:s.enabled),u=!1!==(null==s?void 0:s.respectSamplingDecision),l=c?P(t):null;return async(t,r)=>{var s;const c=null!==(s=await n())&&void 0!==s?s:e;let h=new i(null==r?void 0:r.headers);if(h.has("apikey")||h.set("apikey",e),h.has("Authorization")||h.set("Authorization",`Bearer ${c}`),l){const e=await _(t,l,u);e&&(e.traceparent&&!h.has("traceparent")&&h.set("traceparent",e.traceparent),e.tracestate&&!h.has("tracestate")&&h.set("tracestate",e.tracestate),e.baggage&&!h.has("baggage")&&h.set("baggage",e.baggage))}return o(t,R(R({},r),{},{headers:h}))}};async function _(e,t,n){if(!O("string"==typeof e||e instanceof URL?e:e.url,t))return null;const r=await w();if(!r||!r.traceparent)return null;if(n){const e=k(r.traceparent);if(e&&!e.isSampled)return null}return r}function L(e){return"boolean"==typeof e?{enabled:e}:e}function I(e,t){var n,r,s,o,i,c;const{db:u,auth:l,realtime:h,global:f}=e,{db:p,auth:b,realtime:v,global:y}=t,w=L(e.tracePropagation),k=L(t.tracePropagation),O={db:R(R({},p),u),auth:R(R({},b),l),realtime:R(R({},v),h),storage:{},global:R(R(R({},y),f),{},{headers:R(R({},null!==(n=null==y?void 0:y.headers)&&void 0!==n?n:{}),null!==(r=null==f?void 0:f.headers)&&void 0!==r?r:{})}),tracePropagation:{enabled:null!==(s=null!==(o=null==w?void 0:w.enabled)&&void 0!==o?o:null==k?void 0:k.enabled)&&void 0!==s&&s,respectSamplingDecision:null===(i=null!==(c=null==w?void 0:w.respectSamplingDecision)&&void 0!==c?c:null==k?void 0:k.respectSamplingDecision)||void 0===i||i},accessToken:async()=>""};return e.accessToken?O.accessToken=e.accessToken:delete O.accessToken,O}function D(e){const t=null==e?void 0:e.trim();if(!t)throw new Error("supabaseUrl is required.");if(!t.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL((n=t).endsWith("/")?n:n+"/")}catch(e){throw Error("Invalid supabaseUrl: Provided URL is malformed.")}var n}var K=class extends s.AuthClient{constructor(e){super(e)}},x=class{constructor(e,n,s){var o,i;this.supabaseUrl=e,this.supabaseKey=n;const c=D(e);if(!n)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",c),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",c),this.storageUrl=new URL("storage/v1",c),this.functionsUrl=new URL("functions/v1",c);const u=`sb-${c.hostname.split(".")[0]}-auth-token`,l=I(null!=s?s:{},{db:f,realtime:b,auth:R(R({},p),{},{storageKey:u}),global:h,tracePropagation:v});var y;(this.settings=l,this.storageKey=null!==(o=l.auth.storageKey)&&void 0!==o?o:"",this.headers=null!==(i=l.global.headers)&&void 0!==i?i:{},l.accessToken)?(this.accessToken=l.accessToken,this.auth=new Proxy({},{get:(e,t)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(t)} is not possible`)}})):this.auth=this._initSupabaseAuthClient(null!==(y=l.auth)&&void 0!==y?y:{},this.headers,l.global.fetch);this.fetch=F(n,e,this._getAccessToken.bind(this),l.global.fetch,l.tracePropagation),this.realtime=this._initRealtimeClient(R({headers:this.headers,accessToken:this._getAccessToken.bind(this),fetch:this.fetch},l.realtime)),this.accessToken&&Promise.resolve(this.accessToken()).then(e=>this.realtime.setAuth(e)).catch(e=>console.warn("Failed to set initial Realtime auth token:",e)),this.rest=new t.PostgrestClient(new URL("rest/v1",c).href,{headers:this.headers,schema:l.db.schema,fetch:this.fetch,timeout:l.db.timeout,urlLengthLimit:l.db.urlLengthLimit}),this.storage=new r.StorageClient(this.storageUrl.href,this.headers,this.fetch,null==s?void 0:s.storage),l.accessToken||this._listenForAuthEvents()}get functions(){return new e.FunctionsClient(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e,t={},n={head:!1,get:!1,count:void 0}){return this.rest.rpc(e,t,n)}channel(e,t={config:{}}){return this.realtime.channel(e,t)}getChannels(){return this.realtime.getChannels()}removeChannel(e){return this.realtime.removeChannel(e)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var e,t,n=this;if(n.accessToken)return await n.accessToken();const{data:r}=await n.auth.getSession();return null!==(e=null===(t=r.session)||void 0===t?void 0:t.access_token)&&void 0!==e?e:n.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:t,detectSessionInUrl:n,storage:r,userStorage:s,storageKey:o,flowType:i,lock:c,debug:u,throwOnError:l,experimental:h,lockAcquireTimeout:f,skipAutoInitialize:p},b,v){const y={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new K({url:this.authUrl.href,headers:R(R({},y),b),storageKey:o,autoRefreshToken:e,persistSession:t,detectSessionInUrl:n,storage:r,userStorage:s,flowType:i,lock:c,debug:u,throwOnError:l,experimental:h,fetch:v,lockAcquireTimeout:f,skipAutoInitialize:p,hasCustomAuthorizationHeader:Object.keys(this.headers).some(e=>"authorization"===e.toLowerCase())})}_initRealtimeClient(e){return new n.RealtimeClient(this.realtimeUrl.href,R(R({},e),{},{params:R(R({},{apikey:this.supabaseKey}),null==e?void 0:e.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((e,t)=>{this._handleTokenChanged(e,"CLIENT",null==t?void 0:t.access_token)})}_handleTokenChanged(e,t,n){"TOKEN_REFRESHED"!==e&&"SIGNED_IN"!==e||this.changedAccessToken===n?"SIGNED_OUT"===e&&(this.realtime.setAuth(),"STORAGE"==t&&this.auth.signOut(),this.changedAccessToken=void 0):(this.changedAccessToken=n,this.realtime.setAuth(n))}};const N=(e,t,n)=>new x(e,t,n);(function(){if("undefined"!=typeof window)return!1;const e=globalThis.process;if(!e)return!1;const t=e.version;if(null==t)return!1;const n=t.match(/^v(\d+)\./);return!!n&&parseInt(n[1],10)<=18})()&&console.warn("\u26a0\ufe0f Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217")},1122,[1123,1128,1129,1144,1146]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"FunctionsClient",{enumerable:!0,get:function(){return n.FunctionsClient}}),Object.defineProperty(e,"FunctionsError",{enumerable:!0,get:function(){return t.FunctionsError}}),Object.defineProperty(e,"FunctionsFetchError",{enumerable:!0,get:function(){return t.FunctionsFetchError}}),Object.defineProperty(e,"FunctionsHttpError",{enumerable:!0,get:function(){return t.FunctionsHttpError}}),Object.defineProperty(e,"FunctionsRelayError",{enumerable:!0,get:function(){return t.FunctionsRelayError}}),Object.defineProperty(e,"FunctionRegion",{enumerable:!0,get:function(){return t.FunctionRegion}});var n=r(d[0]),t=r(d[1])},1123,[1124,1127]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"FunctionsClient",{enumerable:!0,get:function(){return s}});var t=r(d[0]),n=r(d[1]),o=r(d[2]);class s{constructor(t,{headers:s={},customFetch:c,region:l=o.FunctionRegion.Any}={}){this.url=t,this.headers=s,this.region=l,this.fetch=(0,n.resolveFetch)(c)}setAuth(t){this.headers.Authorization=`Bearer ${t}`}invoke(n){return(0,t.__awaiter)(this,arguments,void 0,function*(t,n={}){var s;let c,l;try{const{headers:u,method:f,body:h,signal:p,timeout:y}=n;let b={},{region:F}=n;F||(F=this.region);const v=new URL(`${this.url}/${t}`);let w;F&&'any'!==F&&(b['x-region']=F,v.searchParams.set('forceFunctionRegion',F));const j=!!u&&Object.keys(u).some(t=>'content-type'===t.toLowerCase());h&&!j?'undefined'!=typeof Blob&&h instanceof Blob||h instanceof ArrayBuffer?(b['Content-Type']='application/octet-stream',w=h):'string'==typeof h?(b['Content-Type']='text/plain',w=h):'undefined'!=typeof FormData&&h instanceof FormData?w=h:(b['Content-Type']='application/json',w=JSON.stringify(h)):w=!h||'string'==typeof h||'undefined'!=typeof Blob&&h instanceof Blob||h instanceof ArrayBuffer||'undefined'!=typeof FormData&&h instanceof FormData?h:JSON.stringify(h);let O=p;y&&(l=new AbortController,c=setTimeout(()=>l.abort(),y),p?(O=l.signal,p.addEventListener('abort',()=>l.abort())):O=l.signal);const x=yield this.fetch(v.toString(),{method:f||'POST',headers:Object.assign(Object.assign(Object.assign({},b),this.headers),u),body:w,signal:O}).catch(t=>{throw new o.FunctionsFetchError(t)}),B=x.headers.get('x-relay-error');if(B&&'true'===B)throw new o.FunctionsRelayError(x);if(!x.ok)throw new o.FunctionsHttpError(x);let C,T=(null!==(s=x.headers.get('Content-Type'))&&void 0!==s?s:'text/plain').split(';')[0].trim();return C='application/json'===T?yield x.json():'application/octet-stream'===T||'application/pdf'===T?yield x.blob():'text/event-stream'===T?x:'multipart/form-data'===T?yield x.formData():yield x.text(),{data:C,error:null,response:x}}catch(t){return{data:null,error:t,response:t instanceof o.FunctionsHttpError||t instanceof o.FunctionsRelayError?t.context:void 0}}finally{c&&clearTimeout(c)}})}}},1124,[1125,1126,1127]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return G}}),_e.__extends=t,Object.defineProperty(_e,"__assign",{enumerable:!0,get:function(){return r}}),_e.__rest=n,_e.__decorate=o,_e.__param=a,_e.__esDecorate=i,_e.__runInitializers=c,_e.__propKey=u,_e.__setFunctionName=s,_e.__metadata=f,_e.__awaiter=l,_e.__generator=p,Object.defineProperty(_e,"__createBinding",{enumerable:!0,get:function(){return y}}),_e.__exportStar=_,_e.__values=d,_e.__read=h,_e.__spread=b,_e.__spreadArrays=v,_e.__spreadArray=w,_e.__await=m,_e.__asyncGenerator=g,_e.__asyncDelegator=O,_e.__asyncValues=j,_e.__makeTemplateObject=P,_e.__importStar=x,_e.__importDefault=T,_e.__classPrivateFieldGet=I,_e.__classPrivateFieldSet=D,_e.__classPrivateFieldIn=R,_e.__addDisposableResource=k,_e.__disposeResources=F,_e.__rewriteRelativeImportExtension=C;var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};function t(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}var r=function(){return r=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=0;c--)(o=e[c])&&(i=(a<3?o(i):a>3?o(t,r,i):o(t,r))||i);return a>3&&i&&Object.defineProperty(t,r,i),i}function a(e,t){return function(r,n){t(r,n,e)}}function i(e,t,r,n,o,a){function i(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var c,u=n.kind,s="getter"===u?"get":"setter"===u?"set":"value",f=!t&&e?n.static?e:e.prototype:null,l=t||(f?Object.getOwnPropertyDescriptor(f,n.name):{}),p=!1,y=r.length-1;y>=0;y--){var _={};for(var d in n)_[d]="access"===d?{}:n[d];for(var d in n.access)_.access[d]=n.access[d];_.addInitializer=function(e){if(p)throw new TypeError("Cannot add initializers after decoration has completed");a.push(i(e||null))};var h=(0,r[y])("accessor"===u?{get:l.get,set:l.set}:l[s],_);if("accessor"===u){if(void 0===h)continue;if(null===h||"object"!=typeof h)throw new TypeError("Object expected");(c=i(h.get))&&(l.get=c),(c=i(h.set))&&(l.set=c),(c=i(h.init))&&o.unshift(c)}else(c=i(h))&&("field"===u?o.unshift(c):l[s]=c)}f&&Object.defineProperty(f,n.name,l),p=!0}function c(e,t,r){for(var n=arguments.length>2,o=0;o0&&o[o.length-1])||6!==c[0]&&2!==c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function h(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,a=r.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)i.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(o)throw o.error}}return i}function b(){for(var e=[],t=0;t1||c(e,t)})},t&&(n[e]=t(n[e])))}function c(e,t){try{(r=o[e](t)).value instanceof m?Promise.resolve(r.value.v).then(u,s):f(a[0][2],r)}catch(e){f(a[0][3],e)}var r}function u(e){c("next",e)}function s(e){c("throw",e)}function f(e,t){e(t),a.shift(),a.length&&c(a[0][0],a[0][1])}}function O(e){var t,r;return t={},n("next"),n("throw",function(e){throw e}),n("return"),t[Symbol.iterator]=function(){return this},t;function n(n,o){t[n]=e[n]?function(t){return(r=!r)?{value:m(e[n](t)),done:!1}:o?o(t):t}:o}}function j(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=d(e),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise(function(n,a){o(n,a,(t=e[r](t)).done,t.value)})}}function o(e,t,r,n){Promise.resolve(n).then(function(t){e({value:t,done:r})},t)}}function P(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var S=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t},E=function(e){return E=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t},E(e)};function x(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r=E(e),n=0;nt?(...n)=>t(...n):(...t)=>fetch(...t)},1126,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"FunctionsError",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"FunctionsFetchError",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"FunctionsRelayError",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"FunctionsHttpError",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"FunctionRegion",{enumerable:!0,get:function(){return u}});class t extends Error{constructor(t,n="FunctionsError",s){super(t),this.name=n,this.context=s}toJSON(){return{name:this.name,message:this.message,context:this.context}}}class n extends t{constructor(t){super('Failed to send a request to the Edge Function','FunctionsFetchError',t)}}class s extends t{constructor(t){super('Relay Error invoking the Edge Function','FunctionsRelayError',t)}}class o extends t{constructor(t){super('Edge Function returned a non-2xx status code','FunctionsHttpError',t)}}var u;!(function(t){t.Any="any",t.ApNortheast1="ap-northeast-1",t.ApNortheast2="ap-northeast-2",t.ApSouth1="ap-south-1",t.ApSoutheast1="ap-southeast-1",t.ApSoutheast2="ap-southeast-2",t.CaCentral1="ca-central-1",t.EuCentral1="eu-central-1",t.EuWest1="eu-west-1",t.EuWest2="eu-west-2",t.EuWest3="eu-west-3",t.SaEast1="sa-east-1",t.UsEast1="us-east-1",t.UsWest1="us-west-1",t.UsWest2="us-west-2"})(u||(u={}))},1127,[]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"PostgrestBuilder",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"PostgrestClient",{enumerable:!0,get:function(){return $}}),Object.defineProperty(_e,"PostgrestError",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"PostgrestFilterBuilder",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"PostgrestQueryBuilder",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"PostgrestTransformBuilder",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return w}});const e=e=>Math.min(1e3*2**e,3e4),t=[520,503],r=["GET","HEAD","OPTIONS"];var s=class extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.code=e.code}toJSON(){return{name:this.name,message:this.message,details:this.details,hint:this.hint,code:this.code}}};function n(e,t){return new Promise(r=>{if(null==t?void 0:t.aborted)return void r();const s=setTimeout(()=>{null==t||t.removeEventListener("abort",n),r()},e);function n(){clearTimeout(s),r()}null==t||t.addEventListener("abort",n)})}function i(e,s,n,i){return!(!i||n>=3)&&(!!r.includes(e)&&!!t.includes(s))}var l=class{constructor(e){var t,r,s,n,i;this.shouldThrowOnError=!1,this.retryEnabled=!0,this.method=e.method,this.url=e.url,this.headers=new Headers(e.headers),this.schema=e.schema,this.body=e.body,this.shouldThrowOnError=null!==(t=e.shouldThrowOnError)&&void 0!==t&&t,this.signal=e.signal,this.isMaybeSingle=null!==(r=e.isMaybeSingle)&&void 0!==r&&r,this.shouldStripNulls=null!==(s=e.shouldStripNulls)&&void 0!==s&&s,this.urlLengthLimit=null!==(n=e.urlLengthLimit)&&void 0!==n?n:8e3,this.retryEnabled=null===(i=e.retry)||void 0===i||i,e.fetch?this.fetch=e.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}stripNulls(){if("text/csv"===this.headers.get("Accept"))throw new Error("stripNulls() cannot be used with csv()");return this.shouldStripNulls=!0,this}setHeader(e,t){return this.headers=new Headers(this.headers),this.headers.set(e,t),this}retry(e){return this.retryEnabled=e,this}then(t,s){var l=this;if(void 0===this.schema||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),"GET"!==this.method&&"HEAD"!==this.method&&this.headers.set("Content-Type","application/json"),this.shouldStripNulls){const e=this.headers.get("Accept");"application/vnd.pgrst.object+json"===e?this.headers.set("Accept","application/vnd.pgrst.object+json;nulls=stripped"):e&&"application/json"!==e||this.headers.set("Accept","application/vnd.pgrst.array+json;nulls=stripped")}const o=this.fetch;let h=(async()=>{let t=0;for(;;){const u={};let c;l.headers.forEach((e,t)=>{u[t]=e}),t>0&&(u["X-Retry-Count"]=String(t));try{c=await o(l.url.toString(),{method:l.method,headers:u,body:JSON.stringify(l.body,(e,t)=>"bigint"==typeof t?t.toString():t),signal:l.signal})}catch(s){if("AbortError"===(null==s?void 0:s.name)||"ABORT_ERR"===(null==s?void 0:s.code))throw s;if(!r.includes(l.method))throw s;if(l.retryEnabled&&t<3){const r=e(t);t++,await n(r,l.signal);continue}throw s}if(i(l.method,c.status,t,l.retryEnabled)){var s,h;const r=null!==(s=null===(h=c.headers)||void 0===h?void 0:h.get("Retry-After"))&&void 0!==s?s:null,i=null!==r?1e3*Math.max(0,parseInt(r,10)||0):e(t);await c.text(),t++,await n(i,l.signal);continue}return await l.processResponse(c)}})();return this.shouldThrowOnError||(h=h.catch(e=>{var t;let r="",s="",n="";const i=null==e?void 0:e.cause;if(i){var l,o,h,u;const t=null!==(l=null==i?void 0:i.message)&&void 0!==l?l:"",s=null!==(o=null==i?void 0:i.code)&&void 0!==o?o:"";r=`${null!==(h=null==e?void 0:e.name)&&void 0!==h?h:"FetchError"}: ${null==e?void 0:e.message}`,r+=`\n\nCaused by: ${null!==(u=null==i?void 0:i.name)&&void 0!==u?u:"Error"}: ${t}`,s&&(r+=` (${s})`),(null==i?void 0:i.stack)&&(r+=`\n${i.stack}`)}else{var c;r=null!==(c=null==e?void 0:e.stack)&&void 0!==c?c:""}const p=this.url.toString().length;return"AbortError"===(null==e?void 0:e.name)||"ABORT_ERR"===(null==e?void 0:e.code)?(n="",s="Request was aborted (timeout or manual cancellation)",p>this.urlLengthLimit&&(s+=`. Note: Your request URL is ${p} characters, which may exceed server limits. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [many IDs])), consider using an RPC function to pass values server-side.`)):"HeadersOverflowError"!==(null==i?void 0:i.name)&&"UND_ERR_HEADERS_OVERFLOW"!==(null==i?void 0:i.code)||(n="",s="HTTP headers exceeded server limits (typically 16KB)",p>this.urlLengthLimit&&(s+=`. Your request URL is ${p} characters. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [200+ IDs])), consider using an RPC function instead.`)),{success:!1,error:{message:`${null!==(t=null==e?void 0:e.name)&&void 0!==t?t:"FetchError"}: ${null==e?void 0:e.message}`,details:r,hint:s,code:n},data:null,count:null,status:0,statusText:""}})),h.then(t,s)}async processResponse(e){var t=this;let r=null,n=null,i=null,l=e.status,o=e.statusText;if(e.ok){var h,u;if("HEAD"!==t.method){var c;const i=await e.text();if(""===i);else if("text/csv"===t.headers.get("Accept"))n=i;else if(t.headers.get("Accept")&&(null===(c=t.headers.get("Accept"))||void 0===c?void 0:c.includes("application/vnd.pgrst.plan+text")))n=i;else try{n=JSON.parse(i)}catch(e){if(r={message:i},n=null,t.shouldThrowOnError)throw new s({message:i,details:"",hint:"",code:""})}}const p=null===(h=t.headers.get("Prefer"))||void 0===h?void 0:h.match(/count=(exact|planned|estimated)/),f=null===(u=e.headers.get("content-range"))||void 0===u?void 0:u.split("/");p&&f&&f.length>1&&(i=parseInt(f[1])),t.isMaybeSingle&&Array.isArray(n)&&(n.length>1?(r={code:"PGRST116",details:`Results contain ${n.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},n=null,i=null,l=406,o="Not Acceptable"):n=1===n.length?n[0]:null)}else{const i=await e.text();try{r=JSON.parse(i),Array.isArray(r)&&404===e.status&&(n=[],r=null,l=200,o="OK")}catch(t){404===e.status&&""===i?(l=204,o="No Content"):r={message:i}}if(r&&t.shouldThrowOnError)throw new s(r)}return{success:null===r,error:r,data:n,count:i,status:l,statusText:o}}returns(){return this}overrideTypes(){return this}},o=class extends l{throwOnError(){return super.throwOnError()}select(e){let t=!1;const r=(null!=e?e:"*").split("").map(e=>/\s/.test(e)&&!t?"":("\""===e&&(t=!t),e)).join("");return this.url.searchParams.set("select",r),this.headers.append("Prefer","return=representation"),this}order(e,{ascending:t=!0,nullsFirst:r,foreignTable:s,referencedTable:n=s}={}){const i=n?`${n}.order`:"order",l=this.url.searchParams.get(i);return this.url.searchParams.set(i,`${l?`${l},`:""}${e}.${t?"asc":"desc"}${void 0===r?"":r?".nullsfirst":".nullslast"}`),this}limit(e,{foreignTable:t,referencedTable:r=t}={}){const s=void 0===r?"limit":`${r}.limit`;return this.url.searchParams.set(s,`${e}`),this}range(e,t,{foreignTable:r,referencedTable:s=r}={}){const n=void 0===s?"offset":`${s}.offset`,i=void 0===s?"limit":`${s}.limit`;return this.url.searchParams.set(n,`${e}`),this.url.searchParams.set(i,""+(t-e+1)),this}abortSignal(e){return this.signal=e,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:e=!1,verbose:t=!1,settings:r=!1,buffers:s=!1,wal:n=!1,format:i="text"}={}){var l;const o=[e?"analyze":null,t?"verbose":null,r?"settings":null,s?"buffers":null,n?"wal":null].filter(Boolean).join("|"),h=null!==(l=this.headers.get("Accept"))&&void 0!==l?l:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${i}; for="${h}"; options=${o};`),this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(e){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${e}`),this}};const h=new RegExp("[,()]");var u=class extends o{throwOnError(){return super.throwOnError()}eq(e,t){return this.url.searchParams.append(e,`eq.${t}`),this}neq(e,t){return this.url.searchParams.append(e,`neq.${t}`),this}gt(e,t){return this.url.searchParams.append(e,`gt.${t}`),this}gte(e,t){return this.url.searchParams.append(e,`gte.${t}`),this}lt(e,t){return this.url.searchParams.append(e,`lt.${t}`),this}lte(e,t){return this.url.searchParams.append(e,`lte.${t}`),this}like(e,t){return this.url.searchParams.append(e,`like.${t}`),this}likeAllOf(e,t){return this.url.searchParams.append(e,`like(all).{${t.join(",")}}`),this}likeAnyOf(e,t){return this.url.searchParams.append(e,`like(any).{${t.join(",")}}`),this}ilike(e,t){return this.url.searchParams.append(e,`ilike.${t}`),this}ilikeAllOf(e,t){return this.url.searchParams.append(e,`ilike(all).{${t.join(",")}}`),this}ilikeAnyOf(e,t){return this.url.searchParams.append(e,`ilike(any).{${t.join(",")}}`),this}regexMatch(e,t){return this.url.searchParams.append(e,`match.${t}`),this}regexIMatch(e,t){return this.url.searchParams.append(e,`imatch.${t}`),this}is(e,t){return this.url.searchParams.append(e,`is.${t}`),this}isDistinct(e,t){return this.url.searchParams.append(e,`isdistinct.${t}`),this}in(e,t){const r=Array.from(new Set(t)).map(e=>"string"==typeof e&&h.test(e)?`"${e}"`:`${e}`).join(",");return this.url.searchParams.append(e,`in.(${r})`),this}notIn(e,t){const r=Array.from(new Set(t)).map(e=>"string"==typeof e&&h.test(e)?`"${e}"`:`${e}`).join(",");return this.url.searchParams.append(e,`not.in.(${r})`),this}contains(e,t){return"string"==typeof t?this.url.searchParams.append(e,`cs.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cs.{${t.join(",")}}`):this.url.searchParams.append(e,`cs.${JSON.stringify(t)}`),this}containedBy(e,t){return"string"==typeof t?this.url.searchParams.append(e,`cd.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cd.{${t.join(",")}}`):this.url.searchParams.append(e,`cd.${JSON.stringify(t)}`),this}rangeGt(e,t){return this.url.searchParams.append(e,`sr.${t}`),this}rangeGte(e,t){return this.url.searchParams.append(e,`nxl.${t}`),this}rangeLt(e,t){return this.url.searchParams.append(e,`sl.${t}`),this}rangeLte(e,t){return this.url.searchParams.append(e,`nxr.${t}`),this}rangeAdjacent(e,t){return this.url.searchParams.append(e,`adj.${t}`),this}overlaps(e,t){return"string"==typeof t?this.url.searchParams.append(e,`ov.${t}`):this.url.searchParams.append(e,`ov.{${t.join(",")}}`),this}textSearch(e,t,{config:r,type:s}={}){let n="";"plain"===s?n="pl":"phrase"===s?n="ph":"websearch"===s&&(n="w");const i=void 0===r?"":`(${r})`;return this.url.searchParams.append(e,`${n}fts${i}.${t}`),this}match(e){return Object.entries(e).filter(([e,t])=>void 0!==t).forEach(([e,t])=>{this.url.searchParams.append(e,`eq.${t}`)}),this}not(e,t,r){return this.url.searchParams.append(e,`not.${t}.${r}`),this}or(e,{foreignTable:t,referencedTable:r=t}={}){const s=r?`${r}.or`:"or";return this.url.searchParams.append(s,`(${e})`),this}filter(e,t,r){return this.url.searchParams.append(e,`${t}.${r}`),this}},c=class{constructor(e,{headers:t={},schema:r,fetch:s,urlLengthLimit:n=8e3,retry:i}){this.url=e,this.headers=new Headers(t),this.schema=r,this.fetch=s,this.urlLengthLimit=n,this.retry=i}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(e,t){const{head:r=!1,count:s}=null!=t?t:{},n=r?"HEAD":"GET";let i=!1;const l=(null!=e?e:"*").split("").map(e=>/\s/.test(e)&&!i?"":("\""===e&&(i=!i),e)).join(""),{url:o,headers:h}=this.cloneRequestState();return o.searchParams.set("select",l),s&&h.append("Prefer",`count=${s}`),new u({method:n,url:o,headers:h,schema:this.schema,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}insert(e,{count:t,defaultToNull:r=!0}={}){var s;const{url:n,headers:i}=this.cloneRequestState();if(t&&i.append("Prefer",`count=${t}`),r||i.append("Prefer","missing=default"),Array.isArray(e)){const t=e.reduce((e,t)=>e.concat(Object.keys(t)),[]);if(t.length>0){const e=[...new Set(t)].map(e=>`"${e}"`);n.searchParams.set("columns",e.join(","))}}return new u({method:"POST",url:n,headers:i,schema:this.schema,body:e,fetch:null!==(s=this.fetch)&&void 0!==s?s:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}upsert(e,{onConflict:t,ignoreDuplicates:r=!1,count:s,defaultToNull:n=!0}={}){var i;const{url:l,headers:o}=this.cloneRequestState();if(o.append("Prefer",`resolution=${r?"ignore":"merge"}-duplicates`),void 0!==t&&l.searchParams.set("on_conflict",t),s&&o.append("Prefer",`count=${s}`),n||o.append("Prefer","missing=default"),Array.isArray(e)){const t=e.reduce((e,t)=>e.concat(Object.keys(t)),[]);if(t.length>0){const e=[...new Set(t)].map(e=>`"${e}"`);l.searchParams.set("columns",e.join(","))}}return new u({method:"POST",url:l,headers:o,schema:this.schema,body:e,fetch:null!==(i=this.fetch)&&void 0!==i?i:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}update(e,{count:t}={}){var r;const{url:s,headers:n}=this.cloneRequestState();return t&&n.append("Prefer",`count=${t}`),new u({method:"PATCH",url:s,headers:n,schema:this.schema,body:e,fetch:null!==(r=this.fetch)&&void 0!==r?r:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}delete({count:e}={}){var t;const{url:r,headers:s}=this.cloneRequestState();return e&&s.append("Prefer",`count=${e}`),new u({method:"DELETE",url:r,headers:s,schema:this.schema,fetch:null!==(t=this.fetch)&&void 0!==t?t:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};function p(e){return(p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function f(e,t){if("object"!=p(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var s=r.call(e,t||"default");if("object"!=p(s))return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function y(e){var t=f(e,"string");return"symbol"==p(t)?t:t+""}function v(e,t,r){return(t=y(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function b(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,s)}return r}function P(e){for(var t=1;t0?(e,t)=>{const r=new AbortController,s=setTimeout(()=>r.abort(),n),i=null==t?void 0:t.signal;if(i){if(i.aborted)return clearTimeout(s),o(e,t);const n=()=>{clearTimeout(s),r.abort()};return i.addEventListener("abort",n,{once:!0}),o(e,P(P({},t),{},{signal:r.signal})).finally(()=>{clearTimeout(s),i.removeEventListener("abort",n)})}return o(e,P(P({},t),{},{signal:r.signal})).finally(()=>clearTimeout(s))}:o,this.retry=l}from(e){if(!e||"string"!=typeof e||""===e.trim())throw new Error("Invalid relation name: relation must be a non-empty string.");return new c(new URL(`${this.url}/${e}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}schema(t){return new e(this.url,{headers:this.headers,schema:t,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}rpc(e,t={},{head:r=!1,get:s=!1,count:n}={}){var i;let l;const o=new URL(`${this.url}/rpc/${e}`);let h;const c=e=>null!==e&&"object"==typeof e&&(!Array.isArray(e)||e.some(c)),p=r&&Object.values(t).some(c);p?(l="POST",h=t):r||s?(l=r?"HEAD":"GET",Object.entries(t).filter(([e,t])=>void 0!==t).map(([e,t])=>[e,Array.isArray(t)?`{${t.join(",")}}`:`${t}`]).forEach(([e,t])=>{o.searchParams.append(e,t)})):(l="POST",h=t);const f=new Headers(this.headers);return p?f.set("Prefer",n?`count=${n},return=minimal`:"return=minimal"):n&&f.set("Prefer",`count=${n}`),new u({method:l,url:o,headers:f,schema:this.schemaName,body:h,fetch:null!==(i=this.fetch)&&void 0!==i?i:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}},w={PostgrestClient:$,PostgrestQueryBuilder:c,PostgrestFilterBuilder:u,PostgrestTransformBuilder:o,PostgrestBuilder:l,PostgrestError:s}},1128,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"RealtimePresence",{enumerable:!0,get:function(){return o.default}}),Object.defineProperty(_e,"RealtimeChannel",{enumerable:!0,get:function(){return E.default}}),Object.defineProperty(_e,"RealtimeClient",{enumerable:!0,get:function(){return t.default}}),Object.defineProperty(_e,"RealtimePostgresFilterBuilder",{enumerable:!0,get:function(){return n.RealtimePostgresFilterBuilder}}),Object.defineProperty(_e,"postgresChangesFilter",{enumerable:!0,get:function(){return n.postgresChangesFilter}}),Object.defineProperty(_e,"REALTIME_LISTEN_TYPES",{enumerable:!0,get:function(){return n.REALTIME_LISTEN_TYPES}}),Object.defineProperty(_e,"REALTIME_POSTGRES_CHANGES_LISTEN_EVENT",{enumerable:!0,get:function(){return n.REALTIME_POSTGRES_CHANGES_LISTEN_EVENT}}),Object.defineProperty(_e,"REALTIME_PRESENCE_LISTEN_EVENTS",{enumerable:!0,get:function(){return u.REALTIME_PRESENCE_LISTEN_EVENTS}}),Object.defineProperty(_e,"REALTIME_SUBSCRIBE_STATES",{enumerable:!0,get:function(){return n.REALTIME_SUBSCRIBE_STATES}}),Object.defineProperty(_e,"REALTIME_CHANNEL_STATES",{enumerable:!0,get:function(){return n.REALTIME_CHANNEL_STATES}}),Object.defineProperty(_e,"WebSocketFactory",{enumerable:!0,get:function(){return l.default}});var t=e(r(d[0])),n=r(d[1]),E=e(n),u=r(d[2]),o=e(u),l=e(r(d[3]))},1129,[1130,1136,1137,1131]); +__d(function(g,r,i,a,m,_e2,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"default",{enumerable:!0,get:function(){return f}});var t=e(r(d[0])),n=r(d[1]),s=e(r(d[2])),o=r(d[3]),c=e(r(d[4])),l=e(r(d[5]));const h=25e3,u=[1e3,2e3,5e3,1e4];function k(){const e=new Map;return{get length(){return e.size},clear(){e.clear()},getItem:t=>e.has(t)?e.get(t):null,key(t){var n;return null!==(n=Array.from(e.keys())[t])&&void 0!==n?n:null},removeItem(t){e.delete(t)},setItem(t,n){e.set(t,String(n))}}}function p(){try{if('undefined'!=typeof globalThis&&globalThis.sessionStorage)return globalThis.sessionStorage}catch(e){}return k()}class f{get endPoint(){return this.socketAdapter.endPoint}get timeout(){return this.socketAdapter.timeout}get transport(){return this.socketAdapter.transport}get heartbeatCallback(){return this.socketAdapter.heartbeatCallback}get heartbeatIntervalMs(){return this.socketAdapter.heartbeatIntervalMs}get heartbeatTimer(){return this.worker?this._workerHeartbeatTimer:this.socketAdapter.heartbeatTimer}get pendingHeartbeatRef(){return this.worker?this._pendingWorkerHeartbeatRef:this.socketAdapter.pendingHeartbeatRef}get reconnectTimer(){return this.socketAdapter.reconnectTimer}get vsn(){return this.socketAdapter.vsn}get encode(){return this.socketAdapter.encode}get decode(){return this.socketAdapter.decode}get reconnectAfterMs(){return this.socketAdapter.reconnectAfterMs}get sendBuffer(){return this.socketAdapter.sendBuffer}get stateChangeCallbacks(){return this.socketAdapter.stateChangeCallbacks}constructor(e,t){var n;if(this.channels=new Array,this.accessTokenValue=null,this.accessToken=null,this.apiKey=null,this.httpEndpoint='',this.headers={},this.params={},this.ref=0,this.serializer=new s.default,this._manuallySetToken=!1,this._authPromise=null,this._workerHeartbeatTimer=void 0,this._pendingWorkerHeartbeatRef=null,this._pendingDisconnectTimer=null,this._disconnectOnEmptyChannelsAfterMs=0,this._resolveFetch=e=>e?(...t)=>e(...t):(...e)=>fetch(...e),!(null===(n=null==t?void 0:t.params)||void 0===n?void 0:n.apikey))throw new Error('API key is required to connect to Realtime');this.apiKey=t.params.apikey;const c=this._initializeOptions(t);this.socketAdapter=new l.default(e,c),this.httpEndpoint=(0,o.httpEndpointURL)(e),this.fetch=this._resolveFetch(null==t?void 0:t.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.isConnected())){this.accessToken&&!this._authPromise&&this._setAuthSafely('connect'),this._setupConnectionHandlers();try{this.socketAdapter.connect()}catch(e){const t=e.message;if(t.includes('Node.js'))throw new Error(`${t}\n\nTo use Realtime in Node.js, you need to provide a WebSocket implementation:\n\nOption 1: Use Node.js 22+ which has native WebSocket support\nOption 2: Install and provide the "ws" package:\n\n npm install ws\n\n import ws from "ws"\n const client = new RealtimeClient(url, {\n ...options,\n transport: ws\n })`);throw new Error(`WebSocket not available: ${t}`)}this._handleNodeJsRaceCondition()}}endpointURL(){return this.socketAdapter.endPointURL()}async disconnect(e,t){return this._cancelPendingDisconnect(),this.isDisconnecting()?'ok':await this.socketAdapter.disconnect(()=>{clearInterval(this._workerHeartbeatTimer),this._terminateWorker()},e,t)}getChannels(){return this.channels}async removeChannel(e){const t=await e.unsubscribe();return'ok'===t&&e.teardown(),t}async removeAllChannels(){const e=this.channels.map(async e=>{const t=await e.unsubscribe();return e.teardown(),t}),t=await Promise.all(e);return await this.disconnect(),t}log(e,t,n){this.socketAdapter.log(e,t,n)}connectionState(){return this.socketAdapter.connectionState()||n.CONNECTION_STATE.closed}isConnected(){return this.socketAdapter.isConnected()}isConnecting(){return this.socketAdapter.isConnecting()}isDisconnecting(){return this.socketAdapter.isDisconnecting()}channel(e,t={config:{}}){const n=`realtime:${e}`,s=this.getChannels().find(e=>e.topic===n);if(s)return s;{const n=new c.default(`realtime:${e}`,t,this);return this._cancelPendingDisconnect(),this.channels.push(n),n}}push(e){this.socketAdapter.push(e)}async setAuth(e=null){this._authPromise=this._performAuth(e);try{await this._authPromise}finally{this._authPromise=null}}_isManualToken(){return this._manuallySetToken}async sendHeartbeat(){this.socketAdapter.sendHeartbeat()}onHeartbeat(e){this.socketAdapter.heartbeatCallback=this._wrapHeartbeatCallback(e)}_makeRef(){return this.socketAdapter.makeRef()}_remove(e){this.channels=this.channels.filter(t=>t.topic!==e.topic),0===this.channels.length&&(this.log('transport','no channels remaining, scheduling disconnect'),this._schedulePendingDisconnect())}_schedulePendingDisconnect(){if(this._cancelPendingDisconnect(),0===this._disconnectOnEmptyChannelsAfterMs)return this.log('transport','disconnecting immediately - no channels'),void this.disconnect();this._pendingDisconnectTimer=setTimeout(()=>{this._pendingDisconnectTimer=null,0===this.channels.length&&(this.log('transport','deferred disconnect fired - no channels, disconnecting'),this.disconnect())},this._disconnectOnEmptyChannelsAfterMs),this.log('transport',`deferred disconnect scheduled in ${this._disconnectOnEmptyChannelsAfterMs}ms`)}_cancelPendingDisconnect(){null!==this._pendingDisconnectTimer&&(this.log('transport','pending disconnect cancelled - channel activity detected'),clearTimeout(this._pendingDisconnectTimer),this._pendingDisconnectTimer=null)}async _performAuth(e=null){let t,s=!1;if(e)t=e,s=!0;else if(this.accessToken)try{t=await this.accessToken()}catch(e){this.log('error','Error fetching access token from callback',e),t=this.accessTokenValue}else t=this.accessTokenValue;s?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=t&&(this.accessTokenValue=t,this.channels.forEach(e=>{const s={access_token:t,version:n.DEFAULT_VERSION};t&&e.updateJoinPayload(s),e.joinedOnce&&e.channelAdapter.isJoined()&&e.channelAdapter.push(n.CHANNEL_EVENTS.access_token,{access_token:t})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(e="general"){this._isManualToken()||this.setAuth().catch(t=>{this.log('error',`Error setting auth in ${e}`,t)})}_setupConnectionHandlers(){this.socketAdapter.onOpen(()=>{(this._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).catch(e=>{this.log('error','error waiting for auth on connect',e)}),this.worker&&!this.workerRef&&this._startWorkerHeartbeat()}),this.socketAdapter.onClose(()=>{this.worker&&this.workerRef&&this._terminateWorker()}),this.socketAdapter.onMessage(e=>{e.ref&&e.ref===this._pendingWorkerHeartbeatRef&&(this._pendingWorkerHeartbeatRef=null)})}_handleNodeJsRaceCondition(){this.socketAdapter.isConnected()&&this.socketAdapter.getSocket().onConnOpen()}_wrapHeartbeatCallback(e){return(t,n)=>{'sent'==t&&this._setAuthSafely(),e&&e(t,n)}}_startWorkerHeartbeat(){this.workerUrl?this.log('worker',`starting worker for from ${this.workerUrl}`):this.log('worker',"starting default worker");const e=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(e),this.workerRef.onerror=e=>{this.log('worker','worker error',e.message),this._terminateWorker(),this.disconnect()},this.workerRef.onmessage=e=>{'keepAlive'===e.data.event&&this.sendHeartbeat()},this.workerRef.postMessage({event:'start',interval:this.heartbeatIntervalMs})}_terminateWorker(){this.workerRef&&(this.log('worker','terminating worker'),this.workerRef.terminate(),this.workerRef=void 0)}_workerObjectUrl(e){let t;if(e)t=e;else{const e=new Blob(["\n addEventListener(\"message\", (e) => {\n if (e.data.event === \"start\") {\n setInterval(() => postMessage({ event: \"keepAlive\" }), e.data.interval);\n }\n });"],{type:'application/javascript'});t=URL.createObjectURL(e)}return t}_initializeOptions(e){var s,o,c,l,k,f,_,v,w,b,A,T;this.worker=null!==(s=null==e?void 0:e.worker)&&void 0!==s&&s,this.accessToken=null!==(o=null==e?void 0:e.accessToken)&&void 0!==o?o:null;const y={};let C,R;y.timeout=null!==(c=null==e?void 0:e.timeout)&&void 0!==c?c:n.DEFAULT_TIMEOUT,y.heartbeatIntervalMs=null!==(l=null==e?void 0:e.heartbeatIntervalMs)&&void 0!==l?l:h,this._disconnectOnEmptyChannelsAfterMs=null!==(k=null==e?void 0:e.disconnectOnEmptyChannelsAfterMs)&&void 0!==k?k:2*(null!==(f=null==e?void 0:e.heartbeatIntervalMs)&&void 0!==f?f:h),y.transport=null!==(_=null==e?void 0:e.transport)&&void 0!==_?_:t.default.getWebSocketConstructor(),y.params=null==e?void 0:e.params,y.logger=null==e?void 0:e.logger,y.heartbeatCallback=this._wrapHeartbeatCallback(null==e?void 0:e.heartbeatCallback),y.sessionStorage=null!==(v=null==e?void 0:e.sessionStorage)&&void 0!==v?v:p(),y.reconnectAfterMs=null!==(w=null==e?void 0:e.reconnectAfterMs)&&void 0!==w?w:e=>u[e-1]||1e4;const E=null!==(b=null==e?void 0:e.vsn)&&void 0!==b?b:n.DEFAULT_VSN;switch(E){case n.VSN_1_0_0:C=(e,t)=>t(JSON.stringify(e)),R=(e,t)=>t(JSON.parse(e));break;case n.VSN_2_0_0:C=this.serializer.encode.bind(this.serializer),R=this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${y.vsn}`)}if(y.vsn=E,y.encode=null!==(A=null==e?void 0:e.encode)&&void 0!==A?A:C,y.decode=null!==(T=null==e?void 0:e.decode)&&void 0!==T?T:R,y.beforeReconnect=this._reconnectAuth.bind(this),((null==e?void 0:e.logLevel)||(null==e?void 0:e.log_level))&&(this.logLevel=e.logLevel||e.log_level,y.params=Object.assign(Object.assign({},y.params),{log_level:this.logLevel})),this.worker){if('undefined'!=typeof window&&!window.Worker)throw new Error('Web Worker is not supported');this.workerUrl=null==e?void 0:e.workerUrl,y.autoSendHeartbeat=!this.worker}return y}async _reconnectAuth(){await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()}}},1130,[1131,1132,1134,1135,1136,1143]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"WebSocketFactory",{enumerable:!0,get:function(){return t}});class t{constructor(){}static detectEnvironment(){var t;if('undefined'!=typeof WebSocket)return{type:'native',wsConstructor:WebSocket};const o=globalThis;if('undefined'!=typeof globalThis&&void 0!==o.WebSocket)return{type:'native',wsConstructor:o.WebSocket};const n=void 0!==g?g:void 0;if(n&&void 0!==n.WebSocket)return{type:'native',wsConstructor:n.WebSocket};if('undefined'!=typeof globalThis&&void 0!==o.WebSocketPair&&void 0===globalThis.WebSocket)return{type:'cloudflare',error:'Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.',workaround:'Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime.'};if('undefined'!=typeof globalThis&&o.EdgeRuntime||'undefined'!=typeof navigator&&(null===(t=navigator.userAgent)||void 0===t?void 0:t.includes('Vercel-Edge')))return{type:'unsupported',error:'Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.',workaround:'Use serverless functions or a different deployment target for WebSocket functionality.'};const s=globalThis.process;if(s){const t=s.versions;if(t&&t.node){const o=t.node,n=parseInt(o.replace(/^v/,'').split('.')[0]);return n>=22?void 0!==globalThis.WebSocket?{type:'native',wsConstructor:globalThis.WebSocket}:{type:'unsupported',error:`Node.js ${n} detected but native WebSocket not found.`,workaround:'Provide a WebSocket implementation via the transport option.'}:{type:'unsupported',error:`Node.js ${n} detected without native WebSocket support.`,workaround:"For Node.js < 22, install \"ws\" package and provide it via the transport option:\nimport ws from \"ws\"\nnew RealtimeClient(url, { transport: ws })"}}}return{type:'unsupported',error:'Unknown JavaScript runtime without WebSocket support.',workaround:"Ensure you're running in a supported environment (browser, Node.js, Deno) or provide a custom WebSocket implementation."}}static getWebSocketConstructor(){const t=this.detectEnvironment();if(t.wsConstructor)return t.wsConstructor;let o=t.error||'WebSocket not supported in this environment.';throw t.workaround&&(o+=`\n\nSuggested solution: ${t.workaround}`),new Error(o)}static isWebSocketSupported(){try{const t=this.detectEnvironment();return'native'===t.type||'ws'===t.type}catch(t){return!1}}}var o=t},1131,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DEFAULT_VERSION",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"VSN_1_0_0",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"VSN_2_0_0",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"DEFAULT_VSN",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"VERSION",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"DEFAULT_TIMEOUT",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"WS_CLOSE_NORMAL",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"MAX_PUSH_BUFFER_SIZE",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"SOCKET_STATES",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"CHANNEL_STATES",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"CHANNEL_EVENTS",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"TRANSPORTS",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"CONNECTION_STATE",{enumerable:!0,get:function(){return E}});var n=r(d[0]);const t=`realtime-js/${n.version}`,o='1.0.0',c='2.0.0',u=c,l=n.version,b=1e4,_=1e3,f=100,p={connecting:0,open:1,closing:2,closed:3},s={closed:'closed',errored:'errored',joined:'joined',joining:'joining',leaving:'leaving'},O={close:'phx_close',error:'phx_error',join:'phx_join',reply:'phx_reply',leave:'phx_leave',access_token:'access_token'},j={websocket:'websocket'},E={connecting:'connecting',open:'open',closing:'closing',closed:'closed'}},1132,[1133]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"version",{enumerable:!0,get:function(){return t}});const t='2.109.0'},1133,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}});class t{constructor(t){this.HEADER_LENGTH=1,this.USER_BROADCAST_PUSH_META_LENGTH=6,this.KINDS={userBroadcastPush:3,userBroadcast:4},this.BINARY_ENCODING=0,this.JSON_ENCODING=1,this.BROADCAST_EVENT='broadcast',this.allowedMetadataKeys=[],this.allowedMetadataKeys=null!=t?t:[]}encode(t,n){if(t.event===this.BROADCAST_EVENT&&!(t.payload instanceof ArrayBuffer)&&'string'==typeof t.payload.event)return n(this._binaryEncodeUserBroadcastPush(t));let s=[t.join_ref,t.ref,t.topic,t.event,t.payload];return n(JSON.stringify(s))}_binaryEncodeUserBroadcastPush(t){var n;return this._isArrayBuffer(null===(n=t.payload)||void 0===n?void 0:n.payload)?this._encodeBinaryUserBroadcastPush(t):this._encodeJsonUserBroadcastPush(t)}_encodeBinaryUserBroadcastPush(t){var n,s;const o=null!==(s=null===(n=t.payload)||void 0===n?void 0:n.payload)&&void 0!==s?s:new ArrayBuffer(0);return this._encodeUserBroadcastPush(t,this.BINARY_ENCODING,o)}_encodeJsonUserBroadcastPush(t){var n,s;const o=null!==(s=null===(n=t.payload)||void 0===n?void 0:n.payload)&&void 0!==s?s:{},c=(new TextEncoder).encode(JSON.stringify(o)).buffer;return this._encodeUserBroadcastPush(t,this.JSON_ENCODING,c)}_encodeUserBroadcastPush(t,n,s){var o,c;const l=t.topic,h=null!==(o=t.ref)&&void 0!==o?o:'',u=null!==(c=t.join_ref)&&void 0!==c?c:'',f=t.payload.event,y=this.allowedMetadataKeys?this._pick(t.payload,this.allowedMetadataKeys):{},_=0===Object.keys(y).length?'':JSON.stringify(y);if(u.length>255)throw new Error(`joinRef length ${u.length} exceeds maximum of 255`);if(h.length>255)throw new Error(`ref length ${h.length} exceeds maximum of 255`);if(l.length>255)throw new Error(`topic length ${l.length} exceeds maximum of 255`);if(f.length>255)throw new Error(`userEvent length ${f.length} exceeds maximum of 255`);if(_.length>255)throw new Error(`metadata length ${_.length} exceeds maximum of 255`);const A=this.USER_BROADCAST_PUSH_META_LENGTH+u.length+h.length+l.length+f.length+_.length,E=new ArrayBuffer(this.HEADER_LENGTH+A);let U=new DataView(E),B=0;U.setUint8(B++,this.KINDS.userBroadcastPush),U.setUint8(B++,u.length),U.setUint8(B++,h.length),U.setUint8(B++,l.length),U.setUint8(B++,f.length),U.setUint8(B++,_.length),U.setUint8(B++,n),Array.from(u,t=>U.setUint8(B++,t.charCodeAt(0))),Array.from(h,t=>U.setUint8(B++,t.charCodeAt(0))),Array.from(l,t=>U.setUint8(B++,t.charCodeAt(0))),Array.from(f,t=>U.setUint8(B++,t.charCodeAt(0))),Array.from(_,t=>U.setUint8(B++,t.charCodeAt(0)));var N=new Uint8Array(E.byteLength+s.byteLength);return N.set(new Uint8Array(E),0),N.set(new Uint8Array(s),E.byteLength),N.buffer}decode(t,n){if(this._isArrayBuffer(t)){return n(this._binaryDecode(t))}if('string'==typeof t){const s=JSON.parse(t),[o,c,l,h,u]=s;return n({join_ref:o,ref:c,topic:l,event:h,payload:u})}return n({})}_binaryDecode(t){const n=new DataView(t),s=n.getUint8(0),o=new TextDecoder;if(s===this.KINDS.userBroadcast)return this._decodeUserBroadcast(t,n,o)}_decodeUserBroadcast(t,n,s){const o=n.getUint8(1),c=n.getUint8(2),l=n.getUint8(3),h=n.getUint8(4);let u=this.HEADER_LENGTH+4;const f=s.decode(t.slice(u,u+o));u+=o;const y=s.decode(t.slice(u,u+c));u+=c;const _=s.decode(t.slice(u,u+l));u+=l;const A=t.slice(u,t.byteLength),E=h===this.JSON_ENCODING?JSON.parse(s.decode(A)):A,U={type:this.BROADCAST_EVENT,event:y,payload:E};return l>0&&(U.meta=JSON.parse(_)),{join_ref:null,ref:null,topic:f,event:this.BROADCAST_EVENT,payload:U}}_isArrayBuffer(t){var n;return t instanceof ArrayBuffer||'ArrayBuffer'===(null===(n=null==t?void 0:t.constructor)||void 0===n?void 0:n.name)}_pick(t,n){return t&&'object'==typeof t?Object.fromEntries(Object.entries(t).filter(([t])=>n.includes(t))):{}}}},1134,[]); +__d(function(g,r,i,a,m,e,d){"use strict";var t;Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PostgresTypes",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"convertChangeData",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"convertColumn",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"convertCell",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"toBoolean",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"toNumber",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"toJson",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"toArray",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"toTimestampString",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"httpEndpointURL",{enumerable:!0,get:function(){return y}}),(function(t){t.abstime="abstime",t.bool="bool",t.date="date",t.daterange="daterange",t.float4="float4",t.float8="float8",t.int2="int2",t.int4="int4",t.int4range="int4range",t.int8="int8",t.int8range="int8range",t.json="json",t.jsonb="jsonb",t.money="money",t.numeric="numeric",t.oid="oid",t.reltime="reltime",t.text="text",t.time="time",t.timestamp="timestamp",t.timestamptz="timestamptz",t.timetz="timetz",t.tsrange="tsrange",t.tstzrange="tstzrange"})(t||(t={}));const n=(t,n,o={})=>{var s;const u=null!==(s=o.skipTypes)&&void 0!==s?s:[];return n?Object.keys(n).reduce((o,s)=>(o[s]=c(s,t,n,u),o),{}):{}},c=(t,n,c,u)=>{const p=n.find(n=>n.name===t),l=null==p?void 0:p.type,f=c[t];return l&&!u.includes(l)?o(l,f):s(f)},o=(n,c)=>{if('_'===n.charAt(0)){const t=n.slice(1,n.length);return f(c,t)}switch(n){case t.bool:return u(c);case t.float4:case t.float8:case t.int2:case t.int4:case t.int8:case t.numeric:case t.oid:return p(c);case t.json:case t.jsonb:return l(c);case t.timestamp:return b(c);case t.abstime:case t.date:case t.daterange:case t.int4range:case t.int8range:case t.money:case t.reltime:case t.text:case t.time:case t.timestamptz:case t.timetz:case t.tsrange:case t.tstzrange:default:return s(c)}},s=t=>t,u=t=>{switch(t){case't':return!0;case'f':return!1;default:return t}},p=t=>{if('string'==typeof t){const n=parseFloat(t);if(!Number.isNaN(n))return n}return t},l=t=>{if('string'==typeof t)try{return JSON.parse(t)}catch(n){return t}return t},f=(t,n)=>{if('string'!=typeof t)return t;const c=t.length-1,s=t[c];if('{'===t[0]&&'}'===s){let s;const u=t.slice(1,c);try{s=JSON.parse('['+u+']')}catch(t){s=u?u.split(','):[]}return s.map(t=>o(n,t))}return t},b=t=>'string'==typeof t?t.replace(' ','T'):t,y=t=>{const n=new URL(t);return n.protocol=n.protocol.replace(/^ws/i,'http'),n.pathname=n.pathname.replace(/\/+$/,'').replace(/\/socket\/websocket$/i,'').replace(/\/socket$/i,'').replace(/\/websocket$/i,''),''===n.pathname||'/'===n.pathname?n.pathname='/api/broadcast':n.pathname=n.pathname+'/api/broadcast',n.href}},1135,[]); +__d(function(g,_r,_i,a,m,_e2,_d2){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"RealtimePostgresFilterBuilder",{enumerable:!0,get:function(){return d.RealtimePostgresFilterBuilder}}),Object.defineProperty(_e2,"postgresChangesFilter",{enumerable:!0,get:function(){return d.postgresChangesFilter}}),Object.defineProperty(_e2,"default",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e2,"REALTIME_POSTGRES_CHANGES_LISTEN_EVENT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e2,"REALTIME_LISTEN_TYPES",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e2,"REALTIME_SUBSCRIBE_STATES",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e2,"REALTIME_CHANNEL_STATES",{enumerable:!0,get:function(){return h}});var t,n,i,s=_r(_d2[0]),r=e(_r(_d2[1])),o=_r(_d2[2]),c=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(n){if('default'!==n){var i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,t})(o),l=_r(_d2[3]),u=e(_r(_d2[4])),d=_r(_d2[5]);!(function(e){e.ALL="*",e.INSERT="INSERT",e.UPDATE="UPDATE",e.DELETE="DELETE"})(t||(t={})),(function(e){e.BROADCAST="broadcast",e.PRESENCE="presence",e.POSTGRES_CHANGES="postgres_changes",e.SYSTEM="system"})(n||(n={})),(function(e){e.SUBSCRIBED="SUBSCRIBED",e.TIMED_OUT="TIMED_OUT",e.CLOSED="CLOSED",e.CHANNEL_ERROR="CHANNEL_ERROR"})(i||(i={}));const h=s.CHANNEL_STATES;class p{get state(){return this.channelAdapter.state}set state(e){this.channelAdapter.state=e}get joinedOnce(){return this.channelAdapter.joinedOnce}get timeout(){return this.socket.timeout}get joinPush(){return this.channelAdapter.joinPush}get rejoinTimer(){return this.channelAdapter.rejoinTimer}constructor(e,t={config:{}},n){var i,s;if(this.topic=e,this.params=t,this.socket=n,this.bindings={},this.subTopic=e.replace(/^realtime:/i,''),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:'',enabled:!1},private:!1},t.config),this.channelAdapter=new u.default(this.socket.socketAdapter,e,this.params),this.presence=new r.default(this),this._onClose(()=>{this.socket._remove(this)}),this._updateFilterTransform(),this.broadcastEndpointURL=(0,o.httpEndpointURL)(this.socket.socketAdapter.endPointURL()),this.private=this.params.config.private||!1,!this.private&&(null===(s=null===(i=this.params.config)||void 0===i?void 0:i.broadcast)||void 0===s?void 0:s.replay))throw new Error(`tried to use replay on public channel '${this.topic}'. It must be a private channel.`)}subscribe(e,t=this.timeout){var r,o,c;if(this.socket.isConnected()||this.socket.connect(),this.channelAdapter.isClosed()){const{config:{broadcast:u,presence:d,private:h}}=this.params,p=null!==(o=null===(r=this.bindings.postgres_changes)||void 0===r?void 0:r.map(e=>e.filter))&&void 0!==o?o:[],E=!!this.bindings[n.PRESENCE]&&this.bindings[n.PRESENCE].length>0||!0===(null===(c=this.params.config.presence)||void 0===c?void 0:c.enabled),b={},f={broadcast:u,presence:Object.assign(Object.assign({},d),{enabled:E}),postgres_changes:p,private:h};this.socket.accessTokenValue&&(b.access_token=this.socket.accessTokenValue),this._onError(t=>{null==e||e(i.CHANNEL_ERROR,(0,l.normalizeChannelError)(t))}),this._onClose(()=>null==e?void 0:e(i.CLOSED)),this.updateJoinPayload(Object.assign({config:f},b)),this._updateFilterMessage(),this.channelAdapter.subscribe(t).receive('ok',async({postgres_changes:t})=>{this.socket._isManualToken()||this.socket.setAuth(),void 0!==t?this._updatePostgresBindings(t,e):null==e||e(i.SUBSCRIBED)}).receive('error',t=>{this.state=s.CHANNEL_STATES.errored;const n=Object.values(t).join(', ')||'error';null==e||e(i.CHANNEL_ERROR,new Error(n,{cause:t}))}).receive('timeout',()=>{null==e||e(i.TIMED_OUT)})}return this}_updatePostgresBindings(e,t){var n;const r=this.bindings.postgres_changes,o=null!==(n=null==r?void 0:r.length)&&void 0!==n?n:0,c=[];for(let n=0;n{var i,s,r;const o=this.channelAdapter.push(e.type,e,t.timeout||this.timeout);'broadcast'!==e.type||(null===(r=null===(s=null===(i=this.params)||void 0===i?void 0:i.config)||void 0===s?void 0:s.broadcast)||void 0===r?void 0:r.ack)||n('ok'),o.receive('ok',()=>n('ok')),o.receive('error',()=>n('error')),o.receive('timeout',()=>n('timed out'))});{console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated in the future. Please use httpSend() explicitly for REST delivery.");const{event:s,payload:r}=e,o={apikey:this.socket.apiKey?this.socket.apiKey:'','Content-Type':'application/json'};this.socket.accessTokenValue&&(o.Authorization=`Bearer ${this.socket.accessTokenValue}`);const c={method:'POST',headers:o,body:JSON.stringify({messages:[{topic:this.subTopic,event:s,payload:r,private:this.private}]})};try{const e=await this._fetchWithTimeout(this.broadcastEndpointURL,c,null!==(n=t.timeout)&&void 0!==n?n:this.timeout);return await(null===(i=e.body)||void 0===i?void 0:i.cancel()),e.ok?'ok':'error'}catch(e){return e instanceof Error&&'AbortError'===e.name?'timed out':'error'}}}updateJoinPayload(e){this.channelAdapter.updateJoinPayload(e)}async unsubscribe(e=this.timeout){return new Promise(t=>{this.channelAdapter.unsubscribe(e).receive('ok',()=>t('ok')).receive('timeout',()=>t('timed out')).receive('error',()=>t('error'))})}teardown(){this.channelAdapter.teardown()}async _fetchWithTimeout(e,t,n){const i=new AbortController,s=setTimeout(()=>i.abort(),n),r=await this.socket.fetch(e,Object.assign(Object.assign({},t),{signal:i.signal}));return clearTimeout(s),r}_on(e,t,n){const i=e.toLocaleLowerCase(),s=null==t?void 0:t.filter;(s instanceof d.RealtimePostgresFilterBuilder||'object'==typeof s&&null!==s&&'function'==typeof s.build)&&(t=Object.assign(Object.assign({},t),{filter:s.build()}));const r={type:i,filter:t,callback:n,ref:this.channelAdapter.on(e,n)};return this.bindings[i]?this.bindings[i].push(r):this.bindings[i]=[r],this._updateFilterMessage(),this}_onClose(e){this.channelAdapter.onClose(e)}_onError(e){this.channelAdapter.onError(e)}_updateFilterMessage(){this.channelAdapter.updateFilterBindings((e,t,n)=>{var i,s,r,o,c,l,u;const d=e.event.toLocaleLowerCase();if(this._notThisChannelEvent(d,n))return!1;const h=null===(i=this.bindings[d])||void 0===i?void 0:i.find(t=>t.ref===e.ref);if(!h)return!0;if(['broadcast','presence','postgres_changes'].includes(d)){if('id'in h){const e=h.id,n=null===(s=h.filter)||void 0===s?void 0:s.event;return e&&(null===(r=t.ids)||void 0===r?void 0:r.includes(e))&&('*'===n||(null==n?void 0:n.toLocaleLowerCase())===(null===(o=t.data)||void 0===o?void 0:o.type.toLocaleLowerCase()))}{const e=null===(l=null===(c=null==h?void 0:h.filter)||void 0===c?void 0:c.event)||void 0===l?void 0:l.toLocaleLowerCase();return'*'===e||e===(null===(u=null==t?void 0:t.event)||void 0===u?void 0:u.toLocaleLowerCase())}}return h.type.toLocaleLowerCase()===d})}_notThisChannelEvent(e,t){const{close:n,error:i,leave:r,join:o}=s.CHANNEL_EVENTS;return t&&[n,i,r,o].includes(e)&&t!==this.joinPush.ref}_updateFilterTransform(){this.channelAdapter.updatePayloadTransform((e,t,n)=>{if('object'==typeof t&&'ids'in t){const e=t.data,{schema:n,table:i,commit_timestamp:s,type:r,errors:o}=e,c={schema:n,table:i,commit_timestamp:s,eventType:r,new:{},old:{},errors:o};return Object.assign(Object.assign({},c),this._getPayloadRecords(e))}return t})}copyBindings(e){if(this.joinedOnce)throw new Error('cannot copy bindings into joined channel');for(const t in e.bindings)for(const n of e.bindings[t])this._on(n.type,n.filter,n.callback)}static isFilterValueEqual(e,t){return(null!=e?e:void 0)===(null!=t?t:void 0)}_getPayloadRecords(e){const t={new:{},old:{}};return'INSERT'!==e.type&&'UPDATE'!==e.type||(t.new=c.convertChangeData(e.columns,e.record)),'UPDATE'!==e.type&&'DELETE'!==e.type||(t.old=c.convertChangeData(e.columns,e.old_record)),t}}},1136,[1132,1137,1135,1140,1141,1142]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"REALTIME_PRESENCE_LISTEN_EVENTS",{enumerable:!0,get:function(){return t}});var e,t,n=r(d[0]),c=(e=n)&&e.__esModule?e:{default:e};!(function(e){e.SYNC="sync",e.JOIN="join",e.LEAVE="leave"})(t||(t={}));class u{get state(){return this.presenceAdapter.state}constructor(e,t){this.channel=e,this.presenceAdapter=new c.default(this.channel.channelAdapter,t)}}},1137,[1138]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}});var n=r(d[0]);class t{constructor(s,c){const u=o(c);this.presence=new n.Presence(s.getChannel(),u),this.presence.onJoin((n,c,o)=>{const u=t.onJoinPayload(n,c,o);s.getChannel().trigger('presence',u)}),this.presence.onLeave((n,c,o)=>{const u=t.onLeavePayload(n,c,o);s.getChannel().trigger('presence',u)}),this.presence.onSync(()=>{s.getChannel().trigger('presence',{event:'sync'})})}get state(){return t.transformState(this.presence.state)}static transformState(n){return n=c(n),Object.getOwnPropertyNames(n).reduce((t,c)=>{const o=n[c];return t[c]=s(o),t},{})}static onJoinPayload(n,t,c){return{event:'join',key:n,currentPresences:u(t),newPresences:s(c)}}static onLeavePayload(n,t,c){return{event:'leave',key:n,currentPresences:u(t),leftPresences:s(c)}}}function s(n){return n.metas.map(n=>(n.presence_ref=n.phx_ref,delete n.phx_ref,delete n.phx_ref_prev,n))}function c(n){return JSON.parse(JSON.stringify(n))}function o(n){return(null==n?void 0:n.events)&&{events:n.events}}function u(n){return(null==n?void 0:n.metas)?s(n):[]}},1138,[1139]); +__d(function(g,r,_i,a,_m,_e2,d){"use strict";Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"Channel",{enumerable:!0,get:function(){return A}}),Object.defineProperty(_e2,"LongPoll",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e2,"Presence",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e2,"Push",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e2,"Serializer",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e2,"Socket",{enumerable:!0,get:function(){return $}}),Object.defineProperty(_e2,"Timer",{enumerable:!0,get:function(){return w}});var e=e=>{if("function"==typeof e)return e;return function(){return e}},t="undefined"!=typeof self?self:null,s="undefined"!=typeof window?window:null,i=t||s||globalThis,n=0,o=1,h=2,c=3,l="closed",u="errored",f="joined",p="joining",m="leaving",b="phx_close",k="phx_error",T="phx_join",y="phx_reply",C="phx_leave",v="longpoll",R="websocket",j=4,E="base64url.bearer.phx.",S=class{constructor(e,t,s,i){this.channel=e,this.event=t,this.payload=s||function(){return{}},this.receivedResp=null,this.timeout=i,this.timeoutTimer=null,this.recHooks=[],this.sent=!1,this.ref=void 0}resend(e){this.timeout=e,this.reset(),this.send()}send(){this.hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload(),ref:this.ref,join_ref:this.channel.joinRef()}))}receive(e,t){return this.hasReceived(e)&&t(this.receivedResp.response),this.recHooks.push({status:e,callback:t}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}destroy(){this.cancelRefEvent(),this.cancelTimeout()}matchReceive({status:e,response:t,_ref:s}){this.recHooks.filter(t=>t.status===e).forEach(e=>e.callback(t))}cancelRefEvent(){this.refEvent&&this.channel.off(this.refEvent)}cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null}startTimeout(){this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,e=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=e,this.matchReceive(e)}),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}trigger(e,t){this.channel.trigger(this.refEvent,{status:e,response:t})}},w=class{constructor(e,t){this.callback=e,this.timerCalc=t,this.timer=void 0,this.tries=0}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}},A=class{constructor(t,s,i){this.state=l,this.topic=t,this.params=e(s||{}),this.socket=i,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new S(this,T,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new w(()=>{this.socket.isConnected()&&this.rejoin()},this.socket.rejoinAfterMs),this.stateChangeRefs.push(this.socket.onError(()=>this.rejoinTimer.reset())),this.stateChangeRefs.push(this.socket.onOpen(()=>{this.rejoinTimer.reset(),this.isErrored()&&this.rejoin()})),this.joinPush.receive("ok",()=>{this.state=f,this.rejoinTimer.reset(),this.pushBuffer.forEach(e=>e.send()),this.pushBuffer=[]}),this.joinPush.receive("error",e=>{this.state=u,this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,e),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.onClose(()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log("channel",`close ${this.topic}`),this.state=l,this.socket.remove(this)}),this.onError(e=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,e),this.isJoining()&&this.joinPush.reset(),this.state=u,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.joinPush.receive("timeout",()=>{this.socket.hasLogger()&&this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),new S(this,C,e({}),this.timeout).send(),this.state=u,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(y,(e,t)=>{this.trigger(this.replyEventName(t),e)})}join(e=this.timeout){if(this.joinedOnce)throw new Error("tried to join multiple times. 'join' can only be called a single time per channel instance");return this.timeout=e,this.joinedOnce=!0,this.rejoin(),this.joinPush}teardown(){this.pushBuffer.forEach(e=>e.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=l,this.bindings=[]}onClose(e){this.on(b,e)}onError(e){return this.on(k,t=>e(t))}on(e,t){let s=this.bindingRef++;return this.bindings.push({event:e,ref:s,callback:t}),s}off(e,t){this.bindings=this.bindings.filter(s=>!(s.event===e&&(void 0===t||t===s.ref)))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(e,t,s=this.timeout){if(t=t||{},!this.joinedOnce)throw new Error(`tried to push '${e}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let i=new S(this,e,function(){return t},s);return this.canPush()?i.send():(i.startTimeout(),this.pushBuffer.push(i)),i}leave(t=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=m;let s=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(b,"leave")},i=new S(this,C,e({}),t);return i.receive("ok",()=>s()).receive("timeout",()=>s()),i.send(),this.canPush()||i.trigger("ok",{}),i}onMessage(e,t,s){return t}filterBindings(e,t,s){return!0}isMember(e,t,s,i){return this.topic===e&&(!i||i===this.joinRef()||(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:e,event:t,payload:s,joinRef:i}),!1))}joinRef(){return this.joinPush.ref}rejoin(e=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=p,this.joinPush.resend(e))}trigger(e,t,s,i){let n=this.onMessage(e,t,s,i);if(t&&!n)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let o=this.bindings.filter(i=>i.event===e&&this.filterBindings(i,t,s));for(let e=0;eu.abort(),o);l.signal=u.signal}return i.fetch(t,l).then(e=>e.text()).then(e=>this.parseJSON(e)).then(e=>c&&c(e)).catch(e=>{"AbortError"===e.name&&h?h():c&&c(null)}),u}static xdomainRequest(e,t,s,i,n,o,h){return e.timeout=n,e.open(t,s),e.onload=()=>{let t=this.parseJSON(e.responseText);h&&h(t)},o&&(e.ontimeout=o),e.onprogress=()=>{},e.send(i),e}static xhrRequest(e,t,s,i,n,o,h,c){e.open(t,s,!0),e.timeout=o;for(let[t,s]of Object.entries(i))e.setRequestHeader(t,s);return e.onerror=()=>c&&c(null),e.onreadystatechange=()=>{if(e.readyState===j&&c){let t=this.parseJSON(e.responseText);c(t)}},h&&(e.ontimeout=h),e.send(n),e}static parseJSON(e){if(!e||""===e)return null;try{return JSON.parse(e)}catch{return console&&console.log("failed to parse JSON response",e),null}}static serialize(e,t){let s=[];for(var i in e){if(!Object.prototype.hasOwnProperty.call(e,i))continue;let n=t?`${t}[${i}]`:i,o=e[i];"object"==typeof o?s.push(this.serialize(o,n)):s.push(encodeURIComponent(n)+"="+encodeURIComponent(o))}return s.join("&")}static appendParams(e,t){if(0===Object.keys(t).length)return e;let s=e.match(/\?/)?"&":"?";return`${e}${s}${this.serialize(t)}`}},L=e=>{let t="",s=new Uint8Array(e),i=s.byteLength;for(let e=0;ethis.poll(),0)}normalizeEndpoint(e){return e.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+R),"$1/"+v)}endpointURL(){return H.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(e,t,s){this.close(e,t,s),this.readyState=n}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===o||this.readyState===n}poll(){const e={Accept:"application/json"};this.authToken&&(e["X-Phoenix-AuthToken"]=this.authToken),this.ajax("GET",e,null,()=>this.ontimeout(),e=>{if(e){var{status:t,token:s,messages:i}=e;if(410===t&&null!==this.token)return this.onerror(410),void this.closeAndRetry(3410,"session_gone",!1);this.token=s}else t=0;switch(t){case 200:i.forEach(e=>{setTimeout(()=>this.onmessage({data:e}),0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=o,this.onopen({}),this.poll();break;case 403:this.onerror(403),this.close(1008,"forbidden",!1);break;case 0:case 500:this.onerror(500),this.closeAndRetry(1011,"internal server error",500);break;default:throw new Error(`unhandled poll status ${t}`)}})}send(e){"string"!=typeof e&&(e=L(e)),this.currentBatch?this.currentBatch.push(e):this.awaitingBatchAck?this.batchBuffer.push(e):(this.currentBatch=[e],this.currentBatchTimer=setTimeout(()=>{this.batchSend(this.currentBatch),this.currentBatch=null},0))}batchSend(e){this.awaitingBatchAck=!0,this.ajax("POST",{"Content-Type":"application/x-ndjson"},e.join("\n"),()=>this.onerror("timeout"),e=>{this.awaitingBatchAck=!1,e&&200===e.status?this.batchBuffer.length>0&&(this.batchSend(this.batchBuffer),this.batchBuffer=[]):(this.onerror(e&&e.status),this.closeAndRetry(1011,"internal server error",!1))})}close(e,t,s){for(let e of this.reqs)e.abort();this.readyState=c;let i=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:e,reason:t,wasClean:s});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,"undefined"!=typeof CloseEvent?this.onclose(new CloseEvent("close",i)):this.onclose(i)}ajax(e,t,s,i,n){let o;o=H.request(e,this.endpointURL(),t,s,this.timeout,()=>{this.reqs.delete(o),i()},e=>{this.reqs.delete(o),this.isActive()&&n(e)}),this.reqs.add(o)}},B=class e{constructor(t,s={}){let i=s.events||{state:"presence_state",diff:"presence_diff"};this.state={},this.pendingDiffs=[],this.channel=t,this.joinRef=null,this.caller={onJoin:function(){},onLeave:function(){},onSync:function(){}},this.channel.on(i.state,t=>{let{onJoin:s,onLeave:i,onSync:n}=this.caller;this.joinRef=this.channel.joinRef(),this.state=e.syncState(this.state,t,s,i),this.pendingDiffs.forEach(t=>{this.state=e.syncDiff(this.state,t,s,i)}),this.pendingDiffs=[],n()}),this.channel.on(i.diff,t=>{let{onJoin:s,onLeave:i,onSync:n}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(t):(this.state=e.syncDiff(this.state,t,s,i),n())})}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}list(t){return e.list(this.state,t)}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel.joinRef()}static syncState(e,t,s,i){let n=this.clone(e),o={},h={};return this.map(n,(e,s)=>{t[e]||(h[e]=s)}),this.map(t,(e,t)=>{let s=n[e];if(s){let i=t.metas.map(e=>e.phx_ref),n=s.metas.map(e=>e.phx_ref),c=t.metas.filter(e=>n.indexOf(e.phx_ref)<0),l=s.metas.filter(e=>i.indexOf(e.phx_ref)<0);c.length>0&&(o[e]=t,o[e].metas=c),l.length>0&&(h[e]=this.clone(s),h[e].metas=l)}else o[e]=t}),this.syncDiff(n,{joins:o,leaves:h},s,i)}static syncDiff(e,t,s,i){let{joins:n,leaves:o}=this.clone(t);return s||(s=function(){}),i||(i=function(){}),this.map(n,(t,i)=>{let n=e[t];if(e[t]=this.clone(i),n){let s=e[t].metas.map(e=>e.phx_ref),i=n.metas.filter(e=>s.indexOf(e.phx_ref)<0);e[t].metas.unshift(...i)}s(t,n,i)}),this.map(o,(t,s)=>{let n=e[t];if(!n)return;let o=s.metas.map(e=>e.phx_ref);n.metas=n.metas.filter(e=>o.indexOf(e.phx_ref)<0),i(t,n,s),0===n.metas.length&&delete e[t]}),e}static list(e,t){return t||(t=function(e,t){return t}),this.map(e,(e,s)=>t(e,s))}static map(e,t){return Object.getOwnPropertyNames(e).map(s=>t(s,e[s]))}static clone(e){return JSON.parse(JSON.stringify(e))}},O={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(e,t){if(e.payload.constructor===ArrayBuffer)return t(this.binaryEncode(e));{let s=[e.join_ref,e.ref,e.topic,e.event,e.payload];return t(JSON.stringify(s))}},decode(e,t){if(e.constructor===ArrayBuffer)return t(this.binaryDecode(e));{let[s,i,n,o,h]=JSON.parse(e);return t({join_ref:s,ref:i,topic:n,event:o,payload:h})}},binaryEncode(e){let{join_ref:t,ref:s,event:i,topic:n,payload:o}=e,h=this.META_LENGTH+t.length+s.length+n.length+i.length,c=new ArrayBuffer(this.HEADER_LENGTH+h),l=new DataView(c),u=0;l.setUint8(u++,this.KINDS.push),l.setUint8(u++,t.length),l.setUint8(u++,s.length),l.setUint8(u++,n.length),l.setUint8(u++,i.length),Array.from(t,e=>l.setUint8(u++,e.charCodeAt(0))),Array.from(s,e=>l.setUint8(u++,e.charCodeAt(0))),Array.from(n,e=>l.setUint8(u++,e.charCodeAt(0))),Array.from(i,e=>l.setUint8(u++,e.charCodeAt(0)));var f=new Uint8Array(c.byteLength+o.byteLength);return f.set(new Uint8Array(c),0),f.set(new Uint8Array(o),c.byteLength),f.buffer},binaryDecode(e){let t=new DataView(e),s=t.getUint8(0),i=new TextDecoder;switch(s){case this.KINDS.push:return this.decodePush(e,t,i);case this.KINDS.reply:return this.decodeReply(e,t,i);case this.KINDS.broadcast:return this.decodeBroadcast(e,t,i)}},decodePush(e,t,s){let i=t.getUint8(1),n=t.getUint8(2),o=t.getUint8(3),h=this.HEADER_LENGTH+this.META_LENGTH-1,c=s.decode(e.slice(h,h+i));h+=i;let l=s.decode(e.slice(h,h+n));h+=n;let u=s.decode(e.slice(h,h+o));return h+=o,{join_ref:c,ref:null,topic:l,event:u,payload:e.slice(h,e.byteLength)}},decodeReply(e,t,s){let i=t.getUint8(1),n=t.getUint8(2),o=t.getUint8(3),h=t.getUint8(4),c=this.HEADER_LENGTH+this.META_LENGTH,l=s.decode(e.slice(c,c+i));c+=i;let u=s.decode(e.slice(c,c+n));c+=n;let f=s.decode(e.slice(c,c+o));c+=o;let p=s.decode(e.slice(c,c+h));c+=h;let m=e.slice(c,e.byteLength);return{join_ref:l,ref:u,topic:f,event:y,payload:{status:p,response:m}}},decodeBroadcast(e,t,s){let i=t.getUint8(1),n=t.getUint8(2),o=this.HEADER_LENGTH+2,h=s.decode(e.slice(o,o+i));o+=i;let c=s.decode(e.slice(o,o+n));return o+=n,{join_ref:null,ref:null,topic:h,event:c,payload:e.slice(o,e.byteLength)}}},$=class{constructor(t,n={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=n.timeout||1e4,this.transport=n.transport||i.WebSocket||P,this.conn=void 0,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=n.longPollFallbackMs,this.fallbackTimer=null;let o=null;try{o=i&&i.sessionStorage}catch{}this.sessionStore=n.sessionStorage||o,this.establishedConnections=0,this.defaultEncoder=O.encode.bind(O),this.defaultDecoder=O.decode.bind(O),this.closeWasClean=!0,this.disconnecting=!1,this.binaryType=n.binaryType||"arraybuffer",this.connectClock=1,this.pageHidden=!1,this.encode=void 0,this.decode=void 0,this.transport!==P?(this.encode=n.encode||this.defaultEncoder,this.decode=n.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let h=null;s&&s.addEventListener&&(s.addEventListener("pagehide",e=>{this.conn&&(this.disconnect(),h=this.connectClock)}),s.addEventListener("pageshow",e=>{h===this.connectClock&&(h=null,this.connect())}),s.addEventListener("visibilitychange",()=>{"hidden"===document.visibilityState?this.pageHidden=!0:(this.pageHidden=!1,this.isConnected()||this.closeWasClean||this.teardown(()=>this.connect()))})),this.heartbeatIntervalMs=n.heartbeatIntervalMs||3e4,this.autoSendHeartbeat=n.autoSendHeartbeat??!0,this.heartbeatCallback=n.heartbeatCallback??(()=>{}),this.rejoinAfterMs=e=>n.rejoinAfterMs?n.rejoinAfterMs(e):[1e3,2e3,5e3][e-1]||1e4,this.reconnectAfterMs=e=>n.reconnectAfterMs?n.reconnectAfterMs(e):[10,50,100,150,200,250,500,1e3,2e3][e-1]||5e3,this.logger=n.logger||null,!this.logger&&n.debug&&(this.logger=(e,t,s)=>{console.log(`${e}: ${t}`,s)}),this.longpollerTimeout=n.longpollerTimeout||2e4,this.params=e(n.params||{}),this.endPoint=`${t}/${R}`,this.vsn=n.vsn||"2.0.0",this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.heartbeatSentAt=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new w(()=>{if(this.pageHidden)return this.log("Not reconnecting as page is hidden!"),void this.teardown();this.teardown(async()=>{n.beforeReconnect&&await n.beforeReconnect(),this.connect()})},this.reconnectAfterMs),this.authToken=n.authToken}getLongPollTransport(){return P}replaceTransport(e){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.conn&&(this.conn.close(),this.conn=null),this.transport=e}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let e=H.appendParams(H.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return"/"!==e.charAt(0)?e:"/"===e.charAt(1)?`${this.protocol()}:${e}`:`${this.protocol()}://${location.host}${e}`}disconnect(e,t,s){this.connectClock++,this.disconnecting=!0,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(()=>{this.disconnecting=!1,e&&e()},t,s)}connect(t){t&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=e(t)),this.conn&&!this.disconnecting||(this.longPollFallbackMs&&this.transport!==P?this.connectWithFallback(P,this.longPollFallbackMs):this.transportConnect())}log(e,t,s){this.logger&&this.logger(e,t,s)}hasLogger(){return null!==this.logger}onOpen(e){let t=this.makeRef();return this.stateChangeCallbacks.open.push([t,e]),t}onClose(e){let t=this.makeRef();return this.stateChangeCallbacks.close.push([t,e]),t}onError(e){let t=this.makeRef();return this.stateChangeCallbacks.error.push([t,e]),t}onMessage(e){let t=this.makeRef();return this.stateChangeCallbacks.message.push([t,e]),t}onHeartbeat(e){this.heartbeatCallback=e}ping(e){if(!this.isConnected())return!1;let t=this.makeRef(),s=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:t});let i=this.onMessage(n=>{n.ref===t&&(this.off([i]),e(Date.now()-s))});return!0}transportName(e){return e===P?"LongPoll":e.name}transportConnect(){let e;this.connectClock++,this.closeWasClean=!1,this.authToken&&(e=["phoenix",`${E}${btoa(this.authToken).replace(/=/g,"")}`]),this.conn=new this.transport(this.endPointURL(),e),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=()=>this.onConnOpen(),this.conn.onerror=e=>this.onConnError(e),this.conn.onmessage=e=>this.onConnMessage(e),this.conn.onclose=e=>this.onConnClose(e)}getSession(e){return this.sessionStore&&this.sessionStore.getItem(e)}storeSession(e,t){this.sessionStore&&this.sessionStore.setItem(e,t)}connectWithFallback(e,t=2500){clearTimeout(this.fallbackTimer);let s,i=!1,n=!0,o=this.transportName(e),h=t=>{this.log("transport",`falling back to ${o}...`,t),this.off([void 0,s]),n=!1,this.replaceTransport(e),this.transportConnect()};if(this.getSession(`phx:fallback:${o}`))return h("memorized");this.fallbackTimer=setTimeout(h,t),s=this.onError(e=>{this.log("transport","error",e),n&&!i&&(clearTimeout(this.fallbackTimer),h(e))}),this.fallbackRef&&this.off([this.fallbackRef]),this.fallbackRef=this.onOpen(()=>{if(i=!0,!n){let t=this.transportName(e);return this.primaryPassedHealthCheck||this.storeSession(`phx:fallback:${t}`,"true"),this.log("transport",`established ${t} fallback`)}clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(h,t),this.ping(e=>{this.log("transport","connected to primary after",e),this.primaryPassedHealthCheck=!0,clearTimeout(this.fallbackTimer)})}),this.transportConnect()}clearHeartbeats(){clearTimeout(this.heartbeatTimer),clearTimeout(this.heartbeatTimeoutTimer)}onConnOpen(){this.hasLogger()&&this.log("transport",`connected to ${this.endPointURL()}`),this.closeWasClean=!1,this.disconnecting=!1,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.autoSendHeartbeat&&this.resetHeartbeat(),this.triggerStateCallbacks("open")}heartbeatTimeout(){if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.hasLogger()&&this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(e){this.log("error","error in heartbeat callback",e)}this.triggerChanError(new Error("heartbeat timeout")),this.closeWasClean=!1,this.teardown(()=>this.reconnectTimer.scheduleTimeout(),1e3,"heartbeat timeout")}}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}teardown(e,t,s){if(!this.conn)return e&&e();const i=this.conn;this.waitForBufferDone(i,()=>{t?i.close(t,s||""):i.close(),this.waitForSocketClosed(i,()=>{this.conn===i&&(this.conn.onopen=function(){},this.conn.onerror=function(){},this.conn.onmessage=function(){},this.conn.onclose=function(){},this.conn=null),e&&e()})})}waitForBufferDone(e,t,s=1){5!==s&&e.bufferedAmount?setTimeout(()=>{this.waitForBufferDone(e,t,s+1)},150*s):t()}waitForSocketClosed(e,t,s=1){5!==s&&e.readyState!==c?setTimeout(()=>{this.waitForSocketClosed(e,t,s+1)},150*s):t()}onConnClose(e){this.conn&&(this.conn.onclose=()=>{}),this.hasLogger()&&this.log("transport","close",e),this.triggerChanError(e),this.clearHeartbeats(),this.closeWasClean||this.reconnectTimer.scheduleTimeout(),this.triggerStateCallbacks("close",e)}onConnError(e){this.hasLogger()&&this.log("transport","error",e);let t=this.transport,s=this.establishedConnections;this.triggerStateCallbacks("error",e,t,s),(t===this.transport||s>0)&&this.triggerChanError(e)}triggerChanError(e){this.channels.forEach(t=>{t.isErrored()||t.isLeaving()||t.isClosed()||t.trigger(k,e)})}connectionState(){switch(this.conn&&this.conn.readyState){case n:return"connecting";case o:return"open";case h:return"closing";default:return"closed"}}isConnected(){return"open"===this.connectionState()}remove(e){this.off(e.stateChangeRefs),this.channels=this.channels.filter(t=>t!==e)}off(e){for(let t in this.stateChangeCallbacks)this.stateChangeCallbacks[t]=this.stateChangeCallbacks[t].filter(([t])=>-1===e.indexOf(t))}channel(e,t={}){let s=new A(e,t,this);return this.channels.push(s),s}push(e){if(this.hasLogger()){let{topic:t,event:s,payload:i,ref:n,join_ref:o}=e;this.log("push",`${t} ${s} (${o}, ${n})`,i)}this.isConnected()?this.encode(e,e=>this.conn.send(e)):this.sendBuffer.push(()=>this.encode(e,e=>this.conn.send(e)))}makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}sendHeartbeat(){if(this.isConnected())if(this.pendingHeartbeatRef)this.heartbeatTimeout();else{this.pendingHeartbeatRef=this.makeRef(),this.heartbeatSentAt=Date.now(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(e){this.log("error","error in heartbeat callback",e)}this.heartbeatTimeoutTimer=setTimeout(()=>this.heartbeatTimeout(),this.heartbeatIntervalMs)}else try{this.heartbeatCallback("disconnected")}catch(e){this.log("error","error in heartbeat callback",e)}}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}onConnMessage(e){this.decode(e.data,e=>{let{topic:t,event:s,payload:i,ref:n,join_ref:o}=e;if(n&&n===this.pendingHeartbeatRef){const e=this.heartbeatSentAt?Date.now()-this.heartbeatSentAt:void 0;this.clearHeartbeats();try{this.heartbeatCallback("ok"===i.status?"ok":"error",e)}catch(e){this.log("error","error in heartbeat callback",e)}this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.autoSendHeartbeat&&(this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}this.hasLogger()&&this.log("receive",`${i.status||""} ${t} ${s} ${n&&"("+n+")"||""}`.trim(),i);for(let e=0;e{try{i(...t)}catch(t){this.log("error",`error in ${e} callback`,t)}})}catch(t){this.log("error",`error triggering ${e} callbacks`,t)}}leaveOpenTopic(e){let t=this.channels.find(t=>t.topic===e&&(t.isJoined()||t.isJoining()));t&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${e}"`),t.leave())}}},1139,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.normalizeChannelError=function(n){if(n instanceof Error)return n;if('string'==typeof n)return new Error(n);if(n&&'object'==typeof n){const o=n;if('number'==typeof o.code){const t='string'==typeof o.reason&&o.reason?` (${o.reason})`:'';return new Error(`socket closed: ${o.code}${t}`,{cause:n})}return new Error('channel error: transport failure',{cause:n})}return new Error('channel error: connection lost')}},1140,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}});var n=r(d[0]);class t{constructor(n,t,s){const h=(o=s,{config:Object.assign({broadcast:{ack:!1,self:!1},presence:{key:'',enabled:!1},private:!1},o.config)});var o;this.channel=n.getSocket().channel(t,h),this.socket=n}get state(){return this.channel.state}set state(n){this.channel.state=n}get joinedOnce(){return this.channel.joinedOnce}get joinPush(){return this.channel.joinPush}get rejoinTimer(){return this.channel.rejoinTimer}on(n,t){return this.channel.on(n,t)}off(n,t){this.channel.off(n,t)}subscribe(n){return this.channel.join(n)}unsubscribe(n){return this.channel.leave(n)}teardown(){this.channel.teardown()}onClose(n){this.channel.onClose(n)}onError(n){return this.channel.onError(n)}push(t,s,h){let o;try{o=this.channel.push(t,s,h)}catch(n){throw new Error(`tried to push '${t}' to '${this.channel.topic}' before joining. Use channel.subscribe() before pushing events`)}if(this.channel.pushBuffer.length>n.MAX_PUSH_BUFFER_SIZE){const n=this.channel.pushBuffer.shift();n.cancelTimeout(),this.socket.log('channel',`discarded push due to buffer overflow: ${n.event}`,n.payload())}return o}updateJoinPayload(n){const t=this.channel.joinPush.payload();this.channel.joinPush.payload=()=>Object.assign(Object.assign({},t),n)}canPush(){return this.socket.isConnected()&&this.state===n.CHANNEL_STATES.joined}isJoined(){return this.state===n.CHANNEL_STATES.joined}isJoining(){return this.state===n.CHANNEL_STATES.joining}isClosed(){return this.state===n.CHANNEL_STATES.closed}isLeaving(){return this.state===n.CHANNEL_STATES.leaving}updateFilterBindings(n){this.channel.filterBindings=n}updatePayloadTransform(n){this.channel.onMessage=n}getChannel(){return this.channel}}},1141,[1132]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"RealtimePostgresFilterBuilder",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"postgresChangesFilter",{enumerable:!0,get:function(){return c}});const t=/[,()"\\]/,n=n=>t.test(n)||n!==n.trim(),s=t=>`"${t.replace(/\\/g,'\\\\').replace(/"/g,'\\"')}"`,u=t=>{const u=null===t?'null':String(t);return n(u)?s(u):u},l=t=>null===t?'null':String(t),h=(t,n)=>{if('in'===t){const t=Array.isArray(n)?n:[n];if(0===t.length)throw new Error('Realtime `in` filter requires at least one value.');return`in.(${Array.from(new Set(t)).map(t=>u(t)).join(',')})`}return'is'===t?`is.${l(n)}`:`${t}.${u(n)}`};class o{constructor(){this.filters=[]}add(t,n,s,u=!1){const l=u?'not.':'';return this.filters.push(`${t}=${l}${h(n,s)}`),this}eq(t,n){return this.add(t,'eq',n)}neq(t,n){return this.add(t,'neq',n)}gt(t,n){return this.add(t,'gt',n)}gte(t,n){return this.add(t,'gte',n)}lt(t,n){return this.add(t,'lt',n)}lte(t,n){return this.add(t,'lte',n)}in(t,n){return this.add(t,'in',n)}like(t,n){return this.add(t,'like',n)}ilike(t,n){return this.add(t,'ilike',n)}match(t,n){return this.add(t,'match',n)}imatch(t,n){return this.add(t,'imatch',n)}is(t,n){return this.add(t,'is',n)}isDistinct(t,n){return this.add(t,'isdistinct',n)}not(t,n,s){return this.add(t,n,s,!0)}build(){return this.filters.join(',')}toString(){return this.build()}}const c=()=>new o},1142,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return s}});var t=r(d[0]),n=r(d[1]);class s{constructor(n,s){this.socket=new t.Socket(n,s)}get timeout(){return this.socket.timeout}get endPoint(){return this.socket.endPoint}get transport(){return this.socket.transport}get heartbeatIntervalMs(){return this.socket.heartbeatIntervalMs}get heartbeatCallback(){return this.socket.heartbeatCallback}set heartbeatCallback(t){this.socket.heartbeatCallback=t}get heartbeatTimer(){return this.socket.heartbeatTimer}get pendingHeartbeatRef(){return this.socket.pendingHeartbeatRef}get reconnectTimer(){return this.socket.reconnectTimer}get vsn(){return this.socket.vsn}get encode(){return this.socket.encode}get decode(){return this.socket.decode}get reconnectAfterMs(){return this.socket.reconnectAfterMs}get sendBuffer(){return this.socket.sendBuffer}get stateChangeCallbacks(){return this.socket.stateChangeCallbacks}connect(){this.socket.connect()}disconnect(t,n,s,o=1e4){return new Promise(c=>{setTimeout(()=>c('timeout'),o),this.socket.disconnect(()=>{t(),c('ok')},n,s)})}push(t){this.socket.push(t)}log(t,n,s){this.socket.log(t,n,s)}makeRef(){return this.socket.makeRef()}onOpen(t){this.socket.onOpen(t)}onClose(t){this.socket.onClose(t)}onError(t){this.socket.onError(t)}onMessage(t){this.socket.onMessage(t)}isConnected(){return this.socket.isConnected()}isConnecting(){return this.socket.connectionState()==n.CONNECTION_STATE.connecting}isDisconnecting(){return this.socket.connectionState()==n.CONNECTION_STATE.closing}connectionState(){return this.socket.connectionState()}endPointURL(){return this.socket.endPointURL()}sendHeartbeat(){this.socket.sendHeartbeat()}getSocket(){return this.socket}}},1143,[1139,1132]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"StorageAnalyticsClient",{enumerable:!0,get:function(){return H}}),Object.defineProperty(_e,"StorageApiError",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"StorageClient",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(_e,"StorageError",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"StorageUnknownError",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"StorageVectorsApiError",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"StorageVectorsClient",{enumerable:!0,get:function(){return X}}),Object.defineProperty(_e,"StorageVectorsError",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"StorageVectorsErrorCode",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"StorageVectorsUnknownError",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"VectorBucketApi",{enumerable:!0,get:function(){return W}}),Object.defineProperty(_e,"VectorBucketScope",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(_e,"VectorDataApi",{enumerable:!0,get:function(){return G}}),Object.defineProperty(_e,"VectorIndexApi",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(_e,"VectorIndexScope",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(_e,"isStorageError",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"isStorageVectorsError",{enumerable:!0,get:function(){return f}});var e=_r(d[0]);function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(e,r){if("object"!=t(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,r||"default");if("object"!=t(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}function n(e){var n=r(e,"string");return"symbol"==t(n)?n:n+""}function o(e,t,r){return(t=n(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function c(e){for(var t=1;t{if("object"!=typeof e||null===e)return!1;const t=Object.getPrototypeOf(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},k=e=>{if(Array.isArray(e))return e.map(e=>k(e));if("function"==typeof e||e!==Object(e))return e;const t={};return Object.entries(e).forEach(([e,r])=>{const n=e.replace(/([-_][a-z])/gi,e=>e.toUpperCase().replace(/[-_]/g,""));t[n]=k(r)}),t},x=e=>!(!e||"string"!=typeof e)&&(!(0===e.length||e.length>100)&&(e.trim()===e&&(!e.includes("/")&&!e.includes("\\")&&/^[\w!.\*'() &$@=;:+,?-]+$/.test(e)))),$=e=>{if("object"==typeof e&&null!==e){const t=e;if("string"==typeof t.msg)return t.msg;if("string"==typeof t.message)return t.message;if("string"==typeof t.error_description)return t.error_description;if("string"==typeof t.error)return t.error;if("object"==typeof t.error&&null!==t.error){const e=t.error;if("string"==typeof e.message)return e.message}}return JSON.stringify(e)},j=async(e,t,r,n)=>{if(null!==e&&"object"==typeof e&&"json"in e&&"function"==typeof e.json){const r=e;let o=parseInt(String(r.status),10);Number.isFinite(o)||(o=500),r.json().then(e=>{const r=(null==e?void 0:e.statusCode)||(null==e?void 0:e.code)||o+"";t(new l($(e),o,r,n))}).catch(()=>{const e=o+"";t(new l(r.statusText||`HTTP ${o} error`,o,e,n))})}else t(new h($(e),e,n))},B=(e,t,r,n)=>{const o={method:e,headers:(null==t?void 0:t.headers)||{}};if("GET"===e||"HEAD"===e||!n)return c(c({},o),r);if(S(n)){var s;const e=(null==t?void 0:t.headers)||{};let r;for(const[t,n]of Object.entries(e))"content-type"===t.toLowerCase()&&(r=n);o.headers=w(e,"Content-Type",null!==(s=r)&&void 0!==s?s:"application/json"),o.body=JSON.stringify(n)}else o.body=n;return(null==t?void 0:t.duplex)&&(o.duplex=t.duplex),c(c({},o),r)};async function P(e,t,r,n,o,s,c){return new Promise((i,u)=>{e(r,B(t,n,o,s)).then(e=>{if(!e.ok)throw e;if(null==n?void 0:n.noResolveJson)return e;if("vectors"===c){const t=e.headers.get("content-type");if("0"===e.headers.get("content-length")||204===e.status)return{};if(!t||!t.includes("application/json"))return{}}return e.json()}).then(e=>i(e)).catch(e=>j(e,u,0,c))})}function N(e="storage"){return{get:async(t,r,n,o)=>P(t,"GET",r,n,o,void 0,e),post:async(t,r,n,o,s)=>P(t,"POST",r,o,s,n,e),put:async(t,r,n,o,s)=>P(t,"PUT",r,o,s,n,e),head:async(t,r,n,o)=>P(t,"HEAD",r,c(c({},n),{},{noResolveJson:!0}),o,void 0,e),remove:async(t,r,n,o,s)=>P(t,"DELETE",r,o,s,n,e)}}const E=N("storage"),{get:C,post:V,put:I,head:T,remove:U}=E,_=N("vectors");var F=class{constructor(e,t={},r,n="storage"){var o;this.shouldThrowOnError=!1,this.url=e,this.headers=O(t),this.fetch=(o=r)?(...e)=>o(...e):(...e)=>fetch(...e),this.namespace=n}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,t){return this.headers=w(this.headers,e,t),this}async handleOperation(e){try{return{data:await e(),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(u(e))return{data:null,error:e};throw e}}};let R;R=Symbol.toStringTag;var L=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[R]="StreamDownloadBuilder",this.promise=null}then(e,t){return this.getPromise().then(e,t)}catch(e){return this.getPromise().catch(e)}finally(e){return this.getPromise().finally(e)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){try{return{data:(await this.downloadFn()).body,error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(u(e))return{data:null,error:e};throw e}}};let D;D=Symbol.toStringTag;var A=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[D]="BlobDownloadBuilder",this.promise=null}asStream(){return new L(this.downloadFn,this.shouldThrowOnError)}then(e,t){return this.getPromise().then(e,t)}catch(e){return this.getPromise().catch(e)}finally(e){return this.getPromise().finally(e)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){try{return{data:await(await this.downloadFn()).blob(),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(u(e))return{data:null,error:e};throw e}}};const M={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},z={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var J=class extends F{constructor(e,t={},r,n){super(e,t,n,"storage"),this.bucketId=r}async uploadOrUpdate(e,t,r,n){var o=this;return o.handleOperation(async()=>{let s;const i=c(c({},z),n);let u=c(c({},o.headers),"POST"===e&&{"x-upsert":String(i.upsert)});const l=i.metadata;if("undefined"!=typeof Blob&&r instanceof Blob?(s=new FormData,s.append("cacheControl",i.cacheControl),l&&s.append("metadata",o.encodeMetadata(l)),s.append("",r)):"undefined"!=typeof FormData&&r instanceof FormData?(s=r,s.has("cacheControl")||s.append("cacheControl",i.cacheControl),l&&!s.has("metadata")&&s.append("metadata",o.encodeMetadata(l))):(s=r,u["cache-control"]=`max-age=${i.cacheControl}`,u["content-type"]=i.contentType,l&&(u["x-metadata"]=o.toBase64(o.encodeMetadata(l))),("undefined"!=typeof ReadableStream&&s instanceof ReadableStream||s&&"object"==typeof s&&"pipe"in s&&"function"==typeof s.pipe)&&!i.duplex&&(i.duplex="half")),null==n?void 0:n.headers)for(const[e,t]of Object.entries(n.headers))u=w(u,e,t);const h=o._removeEmptyFolders(t),p=o._getFinalPath(h),f=await("PUT"==e?I:V)(o.fetch,`${o.url}/object/${p}`,s,c({headers:u},(null==i?void 0:i.duplex)?{duplex:i.duplex}:{}));return{path:h,id:f.Id,fullPath:f.Key}})}async upload(e,t,r){return this.uploadOrUpdate("POST",e,t,r)}async uploadToSignedUrl(e,t,r,n){var o=this;const s=o._removeEmptyFolders(e),i=o._getFinalPath(s),u=new URL(o.url+`/object/upload/sign/${i}`);return u.searchParams.set("token",t),o.handleOperation(async()=>{let e;const t=c(c({},z),n);let i=c(c({},o.headers),{"x-upsert":String(t.upsert)});const l=t.metadata;if("undefined"!=typeof Blob&&r instanceof Blob?(e=new FormData,e.append("cacheControl",t.cacheControl),l&&e.append("metadata",o.encodeMetadata(l)),e.append("",r)):"undefined"!=typeof FormData&&r instanceof FormData?(e=r,e.has("cacheControl")||e.append("cacheControl",t.cacheControl),l&&!e.has("metadata")&&e.append("metadata",o.encodeMetadata(l))):(e=r,i["cache-control"]=`max-age=${t.cacheControl}`,i["content-type"]=t.contentType,l&&(i["x-metadata"]=o.toBase64(o.encodeMetadata(l))),("undefined"!=typeof ReadableStream&&e instanceof ReadableStream||e&&"object"==typeof e&&"pipe"in e&&"function"==typeof e.pipe)&&!t.duplex&&(t.duplex="half")),null==n?void 0:n.headers)for(const[e,t]of Object.entries(n.headers))i=w(i,e,t);return{path:s,fullPath:(await I(o.fetch,u.toString(),e,c({headers:i},(null==t?void 0:t.duplex)?{duplex:t.duplex}:{}))).Key}})}async createSignedUploadUrl(e,t){var r=this;return r.handleOperation(async()=>{let n=r._getFinalPath(e);const o=c({},r.headers);(null==t?void 0:t.upsert)&&(o["x-upsert"]="true");const s=await V(r.fetch,`${r.url}/object/upload/sign/${n}`,{},{headers:o}),u=new URL(r.url+s.url),l=u.searchParams.get("token");if(!l)throw new i("No token returned by API");return{signedUrl:u.toString(),path:e,token:l}})}async update(e,t,r){return this.uploadOrUpdate("PUT",e,t,r)}async move(e,t,r){var n=this;return n.handleOperation(async()=>await V(n.fetch,`${n.url}/object/move`,{bucketId:n.bucketId,sourceKey:e,destinationKey:t,destinationBucket:null==r?void 0:r.destinationBucket},{headers:n.headers}))}async copy(e,t,r){var n=this;return n.handleOperation(async()=>({path:(await V(n.fetch,`${n.url}/object/copy`,{bucketId:n.bucketId,sourceKey:e,destinationKey:t,destinationBucket:null==r?void 0:r.destinationBucket},{headers:n.headers})).Key}))}async createSignedUrl(e,t,r){var n=this;return n.handleOperation(async()=>{let o=n._getFinalPath(e);const s="object"==typeof(null==r?void 0:r.transform)&&null!==r.transform&&Object.keys(r.transform).length>0;let i=await V(n.fetch,`${n.url}/object/sign/${o}`,c({expiresIn:t},s?{transform:r.transform}:{}),{headers:n.headers});const u=new URLSearchParams;(null==r?void 0:r.download)&&u.set("download",!0===r.download?"":r.download),null!=(null==r?void 0:r.cacheNonce)&&u.set("cacheNonce",String(r.cacheNonce));const l=u.toString();return{signedUrl:encodeURI(`${n.url}${i.signedURL}${l?`&${l}`:""}`)}})}async createSignedUrls(e,t,r){var n=this;return n.handleOperation(async()=>{const o=await V(n.fetch,`${n.url}/object/sign/${n.bucketId}`,{expiresIn:t,paths:e},{headers:n.headers}),s=new URLSearchParams;(null==r?void 0:r.download)&&s.set("download",!0===r.download?"":r.download),null!=(null==r?void 0:r.cacheNonce)&&s.set("cacheNonce",String(r.cacheNonce));const i=s.toString();return o.map(e=>c(c({},e),{},{signedUrl:e.signedURL?encodeURI(`${n.url}${e.signedURL}${i?`&${i}`:""}`):null}))})}download(e,t,r){const n="object"==typeof(null==t?void 0:t.transform)&&null!==t.transform&&Object.keys(t.transform).length>0?"render/image/authenticated":"object",o=new URLSearchParams;(null==t?void 0:t.transform)&&this.applyTransformOptsToQuery(o,t.transform),null!=(null==t?void 0:t.cacheNonce)&&o.set("cacheNonce",String(t.cacheNonce));const s=o.toString(),c=this._getFinalPath(e);return new A(()=>C(this.fetch,`${this.url}/${n}/${c}${s?`?${s}`:""}`,{headers:this.headers,noResolveJson:!0},r),this.shouldThrowOnError)}async info(e){var t=this;const r=t._getFinalPath(e);return t.handleOperation(async()=>k(await C(t.fetch,`${t.url}/object/info/${r}`,{headers:t.headers})))}async exists(e){var t=this;const r=t._getFinalPath(e);try{return await T(t.fetch,`${t.url}/object/${r}`,{headers:t.headers}),{data:!0,error:null}}catch(e){if(t.shouldThrowOnError)throw e;if(u(e)){var n;const t=e instanceof l?e.status:e instanceof h?null===(n=e.originalError)||void 0===n?void 0:n.status:void 0;if(void 0!==t&&[400,404].includes(t))return{data:!1,error:e}}throw e}}getPublicUrl(e,t){const r=this._getFinalPath(e),n=new URLSearchParams;(null==t?void 0:t.download)&&n.set("download",!0===t.download?"":t.download),(null==t?void 0:t.transform)&&this.applyTransformOptsToQuery(n,t.transform),null!=(null==t?void 0:t.cacheNonce)&&n.set("cacheNonce",String(t.cacheNonce));const o=n.toString(),s="object"==typeof(null==t?void 0:t.transform)&&null!==t.transform&&Object.keys(t.transform).length>0?"render/image":"object";return{data:{publicUrl:encodeURI(`${this.url}/${s}/public/${r}`)+(o?`?${o}`:"")}}}async remove(e){var t=this;return t.handleOperation(async()=>await U(t.fetch,`${t.url}/object/${t.bucketId}`,{prefixes:e},{headers:t.headers}))}async purgeCache(e,t,r){var n=this;return n.handleOperation(async()=>{const o=n._getFinalPath(e),s=new URLSearchParams;(null==t?void 0:t.transformations)&&s.set("transformations","true");const c=s.toString();return await U(n.fetch,`${n.url}/cdn/${o}${c?`?${c}`:""}`,{},{headers:n.headers},r)})}async list(e,t,r){var n=this;return n.handleOperation(async()=>{const o=(null==t?void 0:t.sortBy)?c(c({},M.sortBy),t.sortBy):M.sortBy,s=c(c(c({},M),t),{},{sortBy:o,prefix:e||""});return await V(n.fetch,`${n.url}/object/list/${n.bucketId}`,s,{headers:n.headers},r)})}async listV2(e,t){var r=this;return r.handleOperation(async()=>{const n=c({},e);return await V(r.fetch,`${r.url}/object/list-v2/${r.bucketId}`,n,{headers:r.headers},t)})}encodeMetadata(e){return JSON.stringify(e)}toBase64(e){return"undefined"!=typeof Buffer?Buffer.from(e).toString("base64"):btoa(e)}_getFinalPath(e){return`${this.bucketId}/${e.replace(/^\/+/,"")}`}_removeEmptyFolders(e){return e.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}applyTransformOptsToQuery(e,t){return t.width&&e.set("width",t.width.toString()),t.height&&e.set("height",t.height.toString()),t.resize&&e.set("resize",t.resize),t.format&&e.set("format",t.format),t.quality&&e.set("quality",t.quality.toString()),e}};const K={"X-Client-Info":"storage-js/2.109.0"};var q=class extends F{constructor(e,t={},r,n){const o=new URL(e);(null==n?void 0:n.useNewHostname)&&/supabase\.(co|in|red)$/.test(o.hostname)&&!o.hostname.includes("storage.supabase.")&&(o.hostname=o.hostname.replace("supabase.","storage.supabase."));super(o.href.replace(/\/$/,""),c(c({},K),t),r,"storage")}async listBuckets(e){var t=this;return t.handleOperation(async()=>{const r=t.listBucketOptionsToQueryString(e);return await C(t.fetch,`${t.url}/bucket${r}`,{headers:t.headers})})}async getBucket(e){var t=this;return t.handleOperation(async()=>await C(t.fetch,`${t.url}/bucket/${e}`,{headers:t.headers}))}async createBucket(e,t={public:!1}){var r=this;return r.handleOperation(async()=>await V(r.fetch,`${r.url}/bucket`,{id:e,name:e,type:t.type,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:r.headers}))}async updateBucket(e,t){var r=this;return r.handleOperation(async()=>await I(r.fetch,`${r.url}/bucket/${e}`,{id:e,name:e,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:r.headers}))}async emptyBucket(e){var t=this;return t.handleOperation(async()=>await V(t.fetch,`${t.url}/bucket/${e}/empty`,{},{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await U(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}))}async purgeBucketCache(e,t,r){var n=this;return n.handleOperation(async()=>{const o=new URLSearchParams;(null==t?void 0:t.transformations)&&o.set("transformations","true");const s=o.toString();return await U(n.fetch,`${n.url}/cdn/${e}${s?`?${s}`:""}`,{},{headers:n.headers},r)})}listBucketOptionsToQueryString(e){const t={};return e&&("limit"in e&&(t.limit=String(e.limit)),"offset"in e&&(t.offset=String(e.offset)),e.search&&(t.search=e.search),e.sortColumn&&(t.sortColumn=e.sortColumn),e.sortOrder&&(t.sortOrder=e.sortOrder)),Object.keys(t).length>0?"?"+new URLSearchParams(t).toString():""}},H=class extends F{constructor(e,t={},r){super(e.replace(/\/$/,""),c(c({},K),t),r,"storage")}async createBucket(e){var t=this;return t.handleOperation(async()=>await V(t.fetch,`${t.url}/bucket`,{name:e},{headers:t.headers}))}async listBuckets(e){var t=this;return t.handleOperation(async()=>{const r=new URLSearchParams;void 0!==(null==e?void 0:e.limit)&&r.set("limit",e.limit.toString()),void 0!==(null==e?void 0:e.offset)&&r.set("offset",e.offset.toString()),(null==e?void 0:e.sortColumn)&&r.set("sortColumn",e.sortColumn),(null==e?void 0:e.sortOrder)&&r.set("sortOrder",e.sortOrder),(null==e?void 0:e.search)&&r.set("search",e.search);const n=r.toString(),o=n?`${t.url}/bucket?${n}`:`${t.url}/bucket`;return await C(t.fetch,o,{headers:t.headers})})}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await U(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}))}from(t){var r=this;if(!x(t))throw new i("Invalid bucket name: File, folder, and bucket names must follow AWS object key naming guidelines and should avoid the use of any other characters.");const n=new e.IcebergRestCatalog({baseUrl:this.url,catalogName:t,auth:{type:"custom",getHeaders:async()=>r.headers},fetch:this.fetch}),o=this.shouldThrowOnError;return new Proxy(n,{get(e,t){const r=e[t];return"function"!=typeof r?r:async(...t)=>{try{return{data:await r.apply(e,t),error:null}}catch(e){if(o)throw e;return{data:null,error:e}}}}})}},Q=class extends F{constructor(e,t={},r){super(e.replace(/\/$/,""),c(c({},K),{},{"Content-Type":"application/json"},t),r,"vectors")}async createIndex(e){var t=this;return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/CreateIndex`,e,{headers:t.headers})||{})}async getIndex(e,t){var r=this;return r.handleOperation(async()=>await _.post(r.fetch,`${r.url}/GetIndex`,{vectorBucketName:e,indexName:t},{headers:r.headers}))}async listIndexes(e){var t=this;return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/ListIndexes`,e,{headers:t.headers}))}async deleteIndex(e,t){var r=this;return r.handleOperation(async()=>await _.post(r.fetch,`${r.url}/DeleteIndex`,{vectorBucketName:e,indexName:t},{headers:r.headers})||{})}},G=class extends F{constructor(e,t={},r){super(e.replace(/\/$/,""),c(c({},K),{},{"Content-Type":"application/json"},t),r,"vectors")}async putVectors(e){var t=this;if(e.vectors.length<1||e.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/PutVectors`,e,{headers:t.headers})||{})}async getVectors(e){var t=this;return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/GetVectors`,e,{headers:t.headers}))}async listVectors(e){var t=this;if(void 0!==e.segmentCount){if(e.segmentCount<1||e.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(void 0!==e.segmentIndex&&(e.segmentIndex<0||e.segmentIndex>=e.segmentCount))throw new Error("segmentIndex must be between 0 and "+(e.segmentCount-1))}return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/ListVectors`,e,{headers:t.headers}))}async queryVectors(e){var t=this;return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/QueryVectors`,e,{headers:t.headers}))}async deleteVectors(e){var t=this;if(e.keys.length<1||e.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/DeleteVectors`,e,{headers:t.headers})||{})}},W=class extends F{constructor(e,t={},r){super(e.replace(/\/$/,""),c(c({},K),{},{"Content-Type":"application/json"},t),r,"vectors")}async createBucket(e){var t=this;return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}async getBucket(e){var t=this;return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/GetVectorBucket`,{vectorBucketName:e},{headers:t.headers}))}async listBuckets(e={}){var t=this;return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/ListVectorBuckets`,e,{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}},X=class extends W{constructor(e,t={}){super(e,t.headers||{},t.fetch)}from(e){return new Y(this.url,this.headers,e,this.fetch)}async createBucket(e){return(()=>super.createBucket)().call(this,e)}async getBucket(e){return(()=>super.getBucket)().call(this,e)}async listBuckets(e={}){return(()=>super.listBuckets)().call(this,e)}async deleteBucket(e){return(()=>super.deleteBucket)().call(this,e)}},Y=class extends Q{constructor(e,t,r,n){super(e,t,n),this.vectorBucketName=r}async createIndex(e){return(()=>super.createIndex)().call(this,c(c({},e),{},{vectorBucketName:this.vectorBucketName}))}async listIndexes(e={}){return(()=>super.listIndexes)().call(this,c(c({},e),{},{vectorBucketName:this.vectorBucketName}))}async getIndex(e){return(()=>super.getIndex)().call(this,this.vectorBucketName,e)}async deleteIndex(e){return(()=>super.deleteIndex)().call(this,this.vectorBucketName,e)}index(e){return new Z(this.url,this.headers,this.vectorBucketName,e,this.fetch)}},Z=class extends G{constructor(e,t,r,n,o){super(e,t,o),this.vectorBucketName=r,this.indexName=n}async putVectors(e){var t=this;return(()=>super.putVectors)().call(t,c(c({},e),{},{vectorBucketName:t.vectorBucketName,indexName:t.indexName}))}async getVectors(e){var t=this;return(()=>super.getVectors)().call(t,c(c({},e),{},{vectorBucketName:t.vectorBucketName,indexName:t.indexName}))}async listVectors(e={}){var t=this;return(()=>super.listVectors)().call(t,c(c({},e),{},{vectorBucketName:t.vectorBucketName,indexName:t.indexName}))}async queryVectors(e){var t=this;return(()=>super.queryVectors)().call(t,c(c({},e),{},{vectorBucketName:t.vectorBucketName,indexName:t.indexName}))}async deleteVectors(e){var t=this;return(()=>super.deleteVectors)().call(t,c(c({},e),{},{vectorBucketName:t.vectorBucketName,indexName:t.indexName}))}},ee=class extends q{constructor(e,t={},r,n){super(e,t,r,n)}from(e){return new J(this.url,this.headers,e,this.fetch)}get vectors(){return new X(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new H(this.url+"/iceberg",this.headers,this.fetch)}}},1144,[1145]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IcebergError",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"IcebergRestCatalog",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"getCurrentSchema",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"isDecimalType",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"isFixedType",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"parseDecimalType",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"parseFixedType",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"typesEqual",{enumerable:!0,get:function(){return x}});var t=class extends Error{constructor(t,a){super(t),this.name="IcebergError",this.status=a.status,this.icebergType=a.icebergType,this.icebergCode=a.icebergCode,this.details=a.details,this.isCommitStateUnknown="CommitStateUnknownException"===a.icebergType||[500,502,504].includes(a.status)&&!0===a.icebergType?.includes("CommitState")}isNotFound(){return 404===this.status}isConflict(){return 409===this.status}isAuthenticationTimeout(){return 419===this.status}};function a(t,a,s){const n=new URL(a,t);if(s)for(const[t,a]of Object.entries(s))void 0!==a&&n.searchParams.set(t,a);return n.toString()}async function s(t){return t&&"none"!==t.type?"bearer"===t.type?{Authorization:`Bearer ${t.token}`}:"header"===t.type?{[t.name]:t.value}:"custom"===t.type?await t.getHeaders():{}:{}}function n(n){const c=n.fetchImpl??globalThis.fetch;return{async request({method:o,path:p,query:u,body:l,headers:h}){const b=a(n.baseUrl,p,u),f=await s(n.auth),y=await c(b,{method:o,headers:{...l?{"Content-Type":"application/json"}:{},...f,...h},body:l?JSON.stringify(l):void 0}),T=await y.text(),w=(y.headers.get("content-type")||"").includes("application/json"),x=w&&T?JSON.parse(T):T;if(!y.ok){const a=w?x:void 0,s=a?.error;throw new t(s?.message??`Request failed with status ${y.status}`,{status:y.status,icebergType:s?.type,icebergCode:s?.code,details:a})}return{status:y.status,headers:y.headers,data:x}}}}function c(t){return t.join("\x1f")}var o=class{constructor(t,a=""){this.client=t,this.prefix=a}async listNamespaces(t){const a=t?{parent:c(t.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:a})).data.namespaces.map(t=>({namespace:t}))}async createNamespace(t,a){const s={namespace:t.namespace,properties:a?.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:s})).data}async dropNamespace(t){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${c(t.namespace)}`})}async loadNamespaceMetadata(t){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${c(t.namespace)}`})).data.properties}}async namespaceExists(a){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${c(a.namespace)}`}),!0}catch(a){if(a instanceof t&&404===a.status)return!1;throw a}}async createNamespaceIfNotExists(a,s){try{return await this.createNamespace(a,s)}catch(a){if(a instanceof t&&409===a.status)return;throw a}}};function p(t){return t.join("\x1f")}var u=class{constructor(t,a="",s){this.client=t,this.prefix=a,this.accessDelegation=s}async listTables(t){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${p(t.namespace)}/tables`})).data.identifiers}async createTable(t,a){const s={};this.accessDelegation&&(s["X-Iceberg-Access-Delegation"]=this.accessDelegation);return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${p(t.namespace)}/tables`,body:a,headers:s})).data.metadata}async updateTable(t,a){const s=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${p(t.namespace)}/tables/${t.name}`,body:a});return{"metadata-location":s.data["metadata-location"],metadata:s.data.metadata}}async dropTable(t,a){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${p(t.namespace)}/tables/${t.name}`,query:{purgeRequested:String(a?.purge??!1)}})}async loadTable(t){const a={};this.accessDelegation&&(a["X-Iceberg-Access-Delegation"]=this.accessDelegation);return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${p(t.namespace)}/tables/${t.name}`,headers:a})).data.metadata}async tableExists(a){const s={};this.accessDelegation&&(s["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${p(a.namespace)}/tables/${a.name}`,headers:s}),!0}catch(a){if(a instanceof t&&404===a.status)return!1;throw a}}async createTableIfNotExists(a,s){try{return await this.createTable(a,s)}catch(n){if(n instanceof t&&409===n.status)return await this.loadTable({namespace:a.namespace,name:s.name});throw n}}},l=class{constructor(t){let a="v1";t.catalogName&&(a+=`/${t.catalogName}`);const s=t.baseUrl.endsWith("/")?t.baseUrl:`${t.baseUrl}/`;this.client=n({baseUrl:s,auth:t.auth,fetchImpl:t.fetch}),this.accessDelegation=t.accessDelegation?.join(","),this.namespaceOps=new o(this.client,a),this.tableOps=new u(this.client,a,this.accessDelegation)}async listNamespaces(t){return this.namespaceOps.listNamespaces(t)}async createNamespace(t,a){return this.namespaceOps.createNamespace(t,a)}async dropNamespace(t){await this.namespaceOps.dropNamespace(t)}async loadNamespaceMetadata(t){return this.namespaceOps.loadNamespaceMetadata(t)}async listTables(t){return this.tableOps.listTables(t)}async createTable(t,a){return this.tableOps.createTable(t,a)}async updateTable(t,a){return this.tableOps.updateTable(t,a)}async dropTable(t,a){await this.tableOps.dropTable(t,a)}async loadTable(t){return this.tableOps.loadTable(t)}async namespaceExists(t){return this.namespaceOps.namespaceExists(t)}async tableExists(t){return this.tableOps.tableExists(t)}async createNamespaceIfNotExists(t,a){return this.namespaceOps.createNamespaceIfNotExists(t,a)}async createTableIfNotExists(t,a){return this.tableOps.createTableIfNotExists(t,a)}},h=/^decimal\s*\(\s*(\d+)\s*,\s*(\d+)\s*\)$/,b=/^fixed\s*\[\s*(\d+)\s*\]$/;function f(t){const a=t.match(h);return a?{precision:parseInt(a[1],10),scale:parseInt(a[2],10)}:null}function y(t){const a=t.match(b);return a?{length:parseInt(a[1],10)}:null}function T(t){return h.test(t)}function w(t){return b.test(t)}function x(t,a){const s=f(t),n=f(a);if(s&&n)return s.precision===n.precision&&s.scale===n.scale;const c=y(t),o=y(a);return c&&o?c.length===o.length:t===a}function O(t){return t.schemas.find(a=>a["schema-id"]===t["current-schema-id"])}},1145,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"navigatorLock",{enumerable:!0,get:function(){return l.navigatorLock}}),Object.defineProperty(_e,"NavigatorLockAcquireTimeoutError",{enumerable:!0,get:function(){return l.NavigatorLockAcquireTimeoutError}}),Object.defineProperty(_e,"lockInternals",{enumerable:!0,get:function(){return l.internals}}),Object.defineProperty(_e,"processLock",{enumerable:!0,get:function(){return l.processLock}}),Object.defineProperty(_e,"GoTrueAdminApi",{enumerable:!0,get:function(){return t.default}}),Object.defineProperty(_e,"GoTrueClient",{enumerable:!0,get:function(){return n.default}}),Object.defineProperty(_e,"AuthAdminApi",{enumerable:!0,get:function(){return o.default}}),Object.defineProperty(_e,"AuthClient",{enumerable:!0,get:function(){return u.default}});var t=e(r(d[0])),n=e(r(d[1])),o=e(r(d[2])),u=e(r(d[3])),c=r(d[4]);Object.keys(c).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return c[e]}})});var f=r(d[5]);Object.keys(f).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return f[e]}})});var l=r(d[6])},1146,[1147,1155,1162,1163,1154,1152,1157]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return u}});var t=r(d[0]),s=r(d[1]),n=r(d[2]),o=r(d[3]),h=r(d[4]);class u{constructor({url:t="",headers:s={},fetch:o,experimental:h}){this.url=t,this.headers=s,this.fetch=(0,n.resolveFetch)(o),this.experimental=null!=h?h:{},this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)},this.oauth={listClients:this._listOAuthClients.bind(this),createClient:this._createOAuthClient.bind(this),getClient:this._getOAuthClient.bind(this),updateClient:this._updateOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)},this.customProviders={listProviders:this._listCustomProviders.bind(this),createProvider:this._createCustomProvider.bind(this),getProvider:this._getCustomProvider.bind(this),updateProvider:this._updateCustomProvider.bind(this),deleteProvider:this._deleteCustomProvider.bind(this)},this.passkey={listPasskeys:this._adminListPasskeys.bind(this),deletePasskey:this._adminDeletePasskey.bind(this)}}async signOut(t,n=o.SIGN_OUT_SCOPES[0]){if(o.SIGN_OUT_SCOPES.indexOf(n)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${o.SIGN_OUT_SCOPES.join(', ')}`);try{return await(0,s._request)(this.fetch,'POST',`${this.url}/logout?scope=${n}`,{headers:this.headers,jwt:t,noResolveJson:!0}),{data:null,error:null}}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async inviteUserByEmail(t,n={}){try{return await(0,s._request)(this.fetch,'POST',`${this.url}/invite`,{body:{email:t,data:n.data},headers:this.headers,redirectTo:n.redirectTo,xform:s._userResponse})}catch(t){if((0,h.isAuthError)(t))return{data:{user:null},error:t};throw t}}async generateLink(n){try{const{options:o}=n,h=(0,t.__rest)(n,["options"]),u=Object.assign(Object.assign({},h),o);return'newEmail'in h&&(u.new_email=null==h?void 0:h.newEmail,delete u.newEmail),await(0,s._request)(this.fetch,'POST',`${this.url}/admin/generate_link`,{body:u,headers:this.headers,xform:s._generateLinkResponse,redirectTo:null==o?void 0:o.redirectTo})}catch(t){if((0,h.isAuthError)(t))return{data:{properties:null,user:null},error:t};throw t}}async createUser(t){try{return await(0,s._request)(this.fetch,'POST',`${this.url}/admin/users`,{body:t,headers:this.headers,xform:s._userResponse})}catch(t){if((0,h.isAuthError)(t))return{data:{user:null},error:t};throw t}}async listUsers(t){var n,o,u,l,c,f,_;try{const h={nextPage:null,lastPage:0,total:0},y=await(0,s._request)(this.fetch,'GET',`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:null!==(o=null===(n=null==t?void 0:t.page)||void 0===n?void 0:n.toString())&&void 0!==o?o:'',per_page:null!==(l=null===(u=null==t?void 0:t.perPage)||void 0===u?void 0:u.toString())&&void 0!==l?l:''},xform:s._noResolveJsonResponse});if(y.error)throw y.error;const v=await y.json(),p=null!==(c=y.headers.get('x-total-count'))&&void 0!==c?c:0,E=null!==(_=null===(f=y.headers.get('link'))||void 0===f?void 0:f.split(','))&&void 0!==_?_:[];return E.length>0&&(E.forEach(t=>{const s=parseInt(t.split(';')[0].split('=')[1].substring(0,1)),n=JSON.parse(t.split(';')[1].split('=')[1]);h[`${n}Page`]=s}),h.total=parseInt(p)),{data:Object.assign(Object.assign({},v),h),error:null}}catch(t){if((0,h.isAuthError)(t))return{data:{users:[]},error:t};throw t}}async getUserById(t){(0,n.validateUUID)(t);try{return await(0,s._request)(this.fetch,'GET',`${this.url}/admin/users/${t}`,{headers:this.headers,xform:s._userResponse})}catch(t){if((0,h.isAuthError)(t))return{data:{user:null},error:t};throw t}}async updateUserById(t,o){(0,n.validateUUID)(t);try{return await(0,s._request)(this.fetch,'PUT',`${this.url}/admin/users/${t}`,{body:o,headers:this.headers,xform:s._userResponse})}catch(t){if((0,h.isAuthError)(t))return{data:{user:null},error:t};throw t}}async deleteUser(t,o=!1){(0,n.validateUUID)(t);try{return await(0,s._request)(this.fetch,'DELETE',`${this.url}/admin/users/${t}`,{headers:this.headers,body:{should_soft_delete:o},xform:s._userResponse})}catch(t){if((0,h.isAuthError)(t))return{data:{user:null},error:t};throw t}}async _listFactors(t){(0,n.validateUUID)(t.userId);try{const{data:n,error:o}=await(0,s._request)(this.fetch,'GET',`${this.url}/admin/users/${t.userId}/factors`,{headers:this.headers,xform:t=>({data:{factors:t},error:null})});return{data:n,error:o}}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _deleteFactor(t){(0,n.validateUUID)(t.userId),(0,n.validateUUID)(t.id);try{return{data:await(0,s._request)(this.fetch,'DELETE',`${this.url}/admin/users/${t.userId}/factors/${t.id}`,{headers:this.headers}),error:null}}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _listOAuthClients(t){var n,o,u,l,c,f,_;try{const h={nextPage:null,lastPage:0,total:0},y=await(0,s._request)(this.fetch,'GET',`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:null!==(o=null===(n=null==t?void 0:t.page)||void 0===n?void 0:n.toString())&&void 0!==o?o:'',per_page:null!==(l=null===(u=null==t?void 0:t.perPage)||void 0===u?void 0:u.toString())&&void 0!==l?l:''},xform:s._noResolveJsonResponse});if(y.error)throw y.error;const v=await y.json(),p=null!==(c=y.headers.get('x-total-count'))&&void 0!==c?c:0,E=null!==(_=null===(f=y.headers.get('link'))||void 0===f?void 0:f.split(','))&&void 0!==_?_:[];return E.length>0&&(E.forEach(t=>{const s=parseInt(t.split(';')[0].split('=')[1].substring(0,1)),n=JSON.parse(t.split(';')[1].split('=')[1]);h[`${n}Page`]=s}),h.total=parseInt(p)),{data:Object.assign(Object.assign({},v),h),error:null}}catch(t){if((0,h.isAuthError)(t))return{data:{clients:[]},error:t};throw t}}async _createOAuthClient(t){try{return await(0,s._request)(this.fetch,'POST',`${this.url}/admin/oauth/clients`,{body:t,headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _getOAuthClient(t){try{return await(0,s._request)(this.fetch,'GET',`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _updateOAuthClient(t,n){try{return await(0,s._request)(this.fetch,'PUT',`${this.url}/admin/oauth/clients/${t}`,{body:n,headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _deleteOAuthClient(t){try{return await(0,s._request)(this.fetch,'DELETE',`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _regenerateOAuthClientSecret(t){try{return await(0,s._request)(this.fetch,'POST',`${this.url}/admin/oauth/clients/${t}/regenerate_secret`,{headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _listCustomProviders(t){try{const n={};return(null==t?void 0:t.type)&&(n.type=t.type),await(0,s._request)(this.fetch,'GET',`${this.url}/admin/custom-providers`,{headers:this.headers,query:n,xform:t=>{var s;return{data:{providers:null!==(s=null==t?void 0:t.providers)&&void 0!==s?s:[]},error:null}}})}catch(t){if((0,h.isAuthError)(t))return{data:{providers:[]},error:t};throw t}}async _createCustomProvider(t){try{return await(0,s._request)(this.fetch,'POST',`${this.url}/admin/custom-providers`,{body:t,headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _getCustomProvider(t){try{return await(0,s._request)(this.fetch,'GET',`${this.url}/admin/custom-providers/${t}`,{headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _updateCustomProvider(t,n){try{return await(0,s._request)(this.fetch,'PUT',`${this.url}/admin/custom-providers/${t}`,{body:n,headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _deleteCustomProvider(t){try{return await(0,s._request)(this.fetch,'DELETE',`${this.url}/admin/custom-providers/${t}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _adminListPasskeys(t){(0,n.assertPasskeyExperimentalEnabled)(this.experimental),(0,n.validateUUID)(t.userId);try{return await(0,s._request)(this.fetch,'GET',`${this.url}/admin/users/${t.userId}/passkeys`,{headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _adminDeletePasskey(t){(0,n.assertPasskeyExperimentalEnabled)(this.experimental),(0,n.validateUUID)(t.userId),(0,n.validateUUID)(t.passkeyId);try{return await(0,s._request)(this.fetch,'DELETE',`${this.url}/admin/users/${t.userId}/passkeys/${t.passkeyId}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}}},1147,[1125,1148,1151,1154,1152]); +__d(function(g,r,_i,_a2,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.handleError=i,_e._request=async function(e,o,t,n){var a;const i=Object.assign({},null==n?void 0:n.headers);i[s.API_VERSION_HEADER_NAME]||(i[s.API_VERSION_HEADER_NAME]=s.API_VERSIONS['2024-01-01'].name);(null==n?void 0:n.jwt)&&(i.Authorization=`Bearer ${n.jwt}`);const u=null!==(a=null==n?void 0:n.query)&&void 0!==a?a:{};(null==n?void 0:n.redirectTo)&&(u.redirect_to=n.redirectTo);const l=Object.keys(u).length?'?'+new URLSearchParams(u).toString():'',_=await c(e,o,t+l,{headers:i,noResolveJson:null==n?void 0:n.noResolveJson},{},null==n?void 0:n.body);return(null==n?void 0:n.xform)?null==n?void 0:n.xform(_):{data:Object.assign({},_),error:null}},_e._sessionResponse=l,_e._sessionResponsePassword=function(e){const s=l(e);!s.error&&e.weak_password&&'object'==typeof e.weak_password&&Array.isArray(e.weak_password.reasons)&&e.weak_password.reasons.length&&e.weak_password.message&&'string'==typeof e.weak_password.message&&e.weak_password.reasons.reduce((e,s)=>e&&'string'==typeof s,!0)&&(s.data.weak_password=e.weak_password);return s},_e._userResponse=function(e){var s;return{data:{user:null!==(s=e.user)&&void 0!==s?s:e},error:null}},_e._ssoResponse=function(e){return{data:e,error:null}},_e._generateLinkResponse=function(s){const{action_link:o,email_otp:t,hashed_token:n,redirect_to:a,verification_type:i}=s,u=(0,e.__rest)(s,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),c={action_link:o,email_otp:t,hashed_token:n,redirect_to:a,verification_type:i},l=Object.assign({},u);return{data:{properties:c,user:l},error:null}},_e._noResolveJsonResponse=function(e){return e};var e=r(d[0]),s=r(d[1]),o=r(d[2]),t=r(d[3]);const n=e=>{if('object'==typeof e&&null!==e){const s=e;if('string'==typeof s.msg)return s.msg;if('string'==typeof s.message)return s.message;if('string'==typeof s.error_description)return s.error_description;if('string'==typeof s.error)return s.error}return JSON.stringify(e)},a=[500,501,502,503,504,520,521,522,523,524,525,526,527,528,529,530];async function i(e){var i;if(!(0,o.looksLikeFetchResponse)(e))throw new t.AuthRetryableFetchError(n(e),0);if(a.includes(e.status))throw new t.AuthRetryableFetchError(n(e),e.status);let u,c;try{u=await e.json()}catch(e){throw new t.AuthUnknownError(n(e),e)}const l=(0,o.parseResponseAPIVersion)(e);if(l&&l.getTime()>=s.API_VERSIONS['2024-01-01'].timestamp&&'object'==typeof u&&u&&'string'==typeof u.code?c=u.code:'object'==typeof u&&u&&'string'==typeof u.error_code&&(c=u.error_code),c){if('weak_password'===c)throw new t.AuthWeakPasswordError(n(u),e.status,(null===(i=u.weak_password)||void 0===i?void 0:i.reasons)||[]);if('session_not_found'===c)throw new t.AuthSessionMissingError}else if('object'==typeof u&&u&&'object'==typeof u.weak_password&&u.weak_password&&Array.isArray(u.weak_password.reasons)&&u.weak_password.reasons.length&&u.weak_password.reasons.reduce((e,s)=>e&&'string'==typeof s,!0))throw new t.AuthWeakPasswordError(n(u),e.status,u.weak_password.reasons);throw new t.AuthApiError(n(u),e.status||500,c)}const u=(e,s,o,t)=>{const n={method:e,headers:(null==s?void 0:s.headers)||{}};return'GET'===e?n:(n.headers=Object.assign({'Content-Type':'application/json;charset=UTF-8'},null==s?void 0:s.headers),n.body=JSON.stringify(t),Object.assign(Object.assign({},n),o))};async function c(e,s,o,a,c,l){const _=u(s,a,c,l);let p;try{p=await e(o,Object.assign({},_))}catch(e){throw console.error(e),new t.AuthRetryableFetchError(n(e),0)}if(p.ok||await i(p),null==a?void 0:a.noResolveJson)return p;try{return await p.json()}catch(e){await i(e)}}function l(e){var s;let t=null;_(e)&&(t=Object.assign({},e),e.expires_at||(t.expires_at=(0,o.expiresAt)(e.expires_in)));return{data:{session:t,user:null!==(s=e.user)&&void 0!==s?s:'string'==typeof(null==e?void 0:e.id)?e:null},error:null}}function _(e){return!!e.access_token&&!!e.refresh_token&&!!e.expires_in}},1148,[1125,1149,1151,1152]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"AUTO_REFRESH_TICK_DURATION_MS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"AUTO_REFRESH_TICK_THRESHOLD",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"EXPIRY_MARGIN_MS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"REFRESH_FAILURE_COOLDOWN_MS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"GOTRUE_URL",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"STORAGE_KEY",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"AUDIENCE",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"DEFAULT_HEADERS",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"NETWORK_FAILURE",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"API_VERSION_HEADER_NAME",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"API_VERSIONS",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"BASE64URL_REGEX",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"JWKS_TTL",{enumerable:!0,get:function(){return A}});var t=r(d[0]);const n=3e4,u=3,o=9e4,c=6e4,E='http://localhost:9999',_='supabase.auth.token',b='',f={'X-Client-Info':`gotrue-js/${t.version}`},R={MAX_RETRIES:10,RETRY_INTERVAL:2},O='X-Supabase-Api-Version',p={'2024-01-01':{timestamp:Date.parse('2024-01-01T00:00:00.0Z'),name:'2024-01-01'}},l=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,A=6e5},1149,[1150]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"version",{enumerable:!0,get:function(){return t}});const t='2.109.0'},1150,[]); +__d(function(g,r,_i,a,m,_e2,d){"use strict";Object.defineProperty(_e2,'__esModule',{value:!0}),_e2.expiresAt=function(e){return Math.round(Date.now()/1e3)+e},_e2.generateCallbackId=function(){return Symbol('auth-callback')},Object.defineProperty(_e2,"isBrowser",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e2,"supportsLocalStorage",{enumerable:!0,get:function(){return i}}),_e2.parseParametersFromURL=function(e){const t={},n=new URL(e);if(n.hash&&'#'===n.hash[0])try{new URLSearchParams(n.hash.substring(1)).forEach((e,n)=>{t[n]=e})}catch(e){}return n.searchParams.forEach((e,n)=>{t[n]=e}),t},Object.defineProperty(_e2,"resolveFetch",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e2,"looksLikeFetchResponse",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e2,"setItemAsync",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e2,"getItemAsync",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e2,"removeItemAsync",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e2,"Deferred",{enumerable:!0,get:function(){return p}}),_e2.decodeJWT=function(o){const s=o.split('.');if(3!==s.length)throw new t.AuthInvalidJwtError('Invalid JWT structure');for(let n=0;n{setTimeout(()=>t(null),e)})},_e2.retryable=function(e,t){return new Promise((n,o)=>{(async()=>{for(let s=0;s<1/0;s++)try{const o=await e(s);if(!t(s,null,o))return void n(o)}catch(e){if(!t(s,e))return void o(e)}})()})},_e2.generatePKCEVerifier=b,_e2.generatePKCEChallenge=S,_e2.getCodeChallengeAndMethod=async function(e,t,n=!1){const o=b();let s=o;n&&(s+='/recovery');await l(e,`${t}-code-verifier`,s);const i=await S(o);return[i,o===i?'plain':'s256']},_e2.parseResponseAPIVersion=function(t){const n=t.headers.get(e.API_VERSION_HEADER_NAME);if(!n)return null;if(!n.match(P))return null;try{return new Date(`${n}T00:00:00.0Z`)}catch(e){return null}},_e2.validateExp=function(e){if(!e)throw new Error('Missing exp claim');const t=Math.floor(Date.now()/1e3);if(e<=t)throw new Error('JWT has expired')},_e2.getAlgorithm=function(e){switch(e){case'RS256':return{name:'RSASSA-PKCS1-v1_5',hash:{name:'SHA-256'}};case'ES256':return{name:'ECDSA',namedCurve:'P-256',hash:{name:'SHA-256'}};default:throw new Error('Invalid alg claim')}},_e2.validateUUID=function(e){if(!A.test(e))throw new Error('@supabase/auth-js: Expected parameter to be UUID but is not')},_e2.assertPasskeyExperimentalEnabled=function(e){if(!e.passkey)throw new Error('@supabase/auth-js: the passkey API is experimental and disabled by default. Enable it by passing `auth: { experimental: { passkey: true } }` to createClient (or to the GoTrueClient constructor).')},_e2.userNotAvailableProxy=function(){return new Proxy({},{get:(e,t)=>{if('__isUserNotAvailableProxy'===t)return!0;if('symbol'==typeof t){const e=t.toString();if('Symbol(Symbol.toPrimitive)'===e||'Symbol(Symbol.toStringTag)'===e||'Symbol(util.inspect.custom)'===e)return}throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${t}" property of the session object is not supported. Please use getUser() instead.`)},set:(e,t)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${t}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(e,t)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${t}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})},_e2.insecureUserWarningProxy=function(e,t){return new Proxy(e,{get:(e,n,o)=>{if('__isInsecureUserWarningProxy'===n)return!0;if('symbol'==typeof n){const t=n.toString();if('Symbol(Symbol.toPrimitive)'===t||'Symbol(Symbol.toStringTag)'===t||'Symbol(util.inspect.custom)'===t||'Symbol(nodejs.util.inspect.custom)'===t)return Reflect.get(e,n,o)}return t.value||'string'!=typeof n||(console.warn('Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server.'),t.value=!0),Reflect.get(e,n,o)}})},_e2.deepClone=function(e){return JSON.parse(JSON.stringify(e))};var e=r(d[0]),t=r(d[1]),n=r(d[2]);const o=()=>'undefined'!=typeof window&&'undefined'!=typeof document,s={tested:!1,writable:!1},i=()=>{if(!o())return!1;try{if('object'!=typeof globalThis.localStorage)return!1}catch(e){return!1}if(s.tested)return s.writable;const e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),s.tested=!0,s.writable=!0}catch(e){s.tested=!0,s.writable=!1}return s.writable};const u=e=>e?(...t)=>e(...t):(...e)=>fetch(...e),c=e=>'object'==typeof e&&null!==e&&'status'in e&&'ok'in e&&'json'in e&&'function'==typeof e.json,l=async(e,t,n)=>{await e.setItem(t,JSON.stringify(n))},f=async(e,t)=>{const n=await e.getItem(t);if(!n)return null;try{return JSON.parse(n)}catch(e){return null}},h=async(e,t)=>{await e.removeItem(t)};class p{constructor(){this.promise=new p.promiseConstructor((e,t)=>{this.resolve=e,this.reject=t})}}function y(e){return('0'+e.toString(16)).substr(-2)}function b(){const e=new Uint32Array(56);if('undefined'==typeof crypto){const e='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~',t=e.length;let n='';for(let o=0;o<56;o++)n+=e.charAt(Math.floor(Math.random()*t));return n}return crypto.getRandomValues(e),Array.from(e,y).join('')}async function w(e){const t=(new TextEncoder).encode(e),n=await crypto.subtle.digest('SHA-256',t),o=new Uint8Array(n);return Array.from(o).map(e=>String.fromCharCode(e)).join('')}async function S(e){if(!('undefined'!=typeof crypto&&void 0!==crypto.subtle&&'undefined'!=typeof TextEncoder))return console.warn('WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256.'),e;const t=await w(e);return btoa(t).replace(/\+/g,'-').replace(/\//g,'_').replace(/=+$/,'')}p.promiseConstructor=Promise;const P=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;const A=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/},1151,[1149,1152,1153]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"AuthError",{enumerable:!0,get:function(){return t}}),e.isAuthError=s,Object.defineProperty(e,"AuthApiError",{enumerable:!0,get:function(){return n}}),e.isAuthApiError=function(t){return s(t)&&'AuthApiError'===t.name},Object.defineProperty(e,"AuthUnknownError",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"CustomAuthError",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"AuthSessionMissingError",{enumerable:!0,get:function(){return c}}),e.isAuthSessionMissingError=function(t){return s(t)&&'AuthSessionMissingError'===t.name},Object.defineProperty(e,"AuthInvalidTokenResponseError",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"AuthInvalidCredentialsError",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"AuthImplicitGrantRedirectError",{enumerable:!0,get:function(){return f}}),e.isAuthImplicitGrantRedirectError=function(t){return s(t)&&'AuthImplicitGrantRedirectError'===t.name},Object.defineProperty(e,"AuthPKCEGrantCodeExchangeError",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"AuthPKCECodeVerifierMissingError",{enumerable:!0,get:function(){return A}}),e.isAuthPKCECodeVerifierMissingError=function(t){return s(t)&&'AuthPKCECodeVerifierMissingError'===t.name},Object.defineProperty(e,"AuthRetryableFetchError",{enumerable:!0,get:function(){return p}}),e.isAuthRetryableFetchError=function(t){return s(t)&&'AuthRetryableFetchError'===t.name},Object.defineProperty(e,"AuthRefreshDiscardedError",{enumerable:!0,get:function(){return b}}),e.isAuthRefreshDiscardedError=function(t){return s(t)&&'AuthRefreshDiscardedError'===t.name},Object.defineProperty(e,"AuthWeakPasswordError",{enumerable:!0,get:function(){return O}}),e.isAuthWeakPasswordError=function(t){return s(t)&&'AuthWeakPasswordError'===t.name},Object.defineProperty(e,"AuthInvalidJwtError",{enumerable:!0,get:function(){return P}});class t extends Error{constructor(t,s,n){super(t),this.__isAuthError=!0,this.name='AuthError',this.status=s,this.code=n}toJSON(){return{name:this.name,message:this.message,status:this.status,code:this.code}}}function s(t){return'object'==typeof t&&null!==t&&'__isAuthError'in t}class n extends t{constructor(t,s,n){super(t,s,n),this.name='AuthApiError',this.status=s,this.code=n}}class o extends t{constructor(t,s){super(t),this.name='AuthUnknownError',this.originalError=s}}class u extends t{constructor(t,s,n,o){super(t,n,o),this.name=s,this.status=n}}class c extends u{constructor(){super('Auth session missing!','AuthSessionMissingError',400,void 0)}}class h extends u{constructor(){super('Auth session or user missing','AuthInvalidTokenResponseError',500,void 0)}}class l extends u{constructor(t){super(t,'AuthInvalidCredentialsError',400,void 0)}}class f extends u{constructor(t,s=null){super(t,'AuthImplicitGrantRedirectError',500,void 0),this.details=null,this.details=s}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}class E extends u{constructor(t,s=null){super(t,'AuthPKCEGrantCodeExchangeError',500,void 0),this.details=null,this.details=s}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}class A extends u{constructor(){super("PKCE code verifier not found in storage. This can happen if the auth flow was initiated in a different browser or device, or if the storage was cleared. For SSR frameworks (Next.js, SvelteKit, etc.), use @supabase/ssr on both the server and client to store the code verifier in cookies.",'AuthPKCECodeVerifierMissingError',400,'pkce_code_verifier_not_found')}}class p extends u{constructor(t,s){super(t,'AuthRetryableFetchError',s,void 0)}}class b extends u{constructor(t="Refresh result discarded: session state changed mid-flight (e.g., concurrent signOut)"){super(t,'AuthRefreshDiscardedError',409,void 0)}}class O extends u{constructor(t,s,n){super(t,'AuthWeakPasswordError',s,'weak_password'),this.reasons=n}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{reasons:this.reasons})}}class P extends u{constructor(t){super(t,'AuthInvalidJwtError',400,'invalid_jwt')}}},1152,[]); +__d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.byteToBase64URL=o,e.byteFromBase64URL=i,e.stringToBase64URL=function(t){const u=[],n=t=>{u.push(t)},i={queue:0,queuedBits:0};return f(t,t=>{o(t,i,n)}),o(null,i,n),u.join('')},e.stringFromBase64URL=function(t){const u=[],n=t=>{u.push(String.fromCodePoint(t))},o={utf8seq:0,codepoint:0},s={queue:0,queuedBits:0},f=t=>{c(t,o,n)};for(let u=0;u{u.push(t)};for(let u=0;uu.push(t)),new Uint8Array(u)},e.bytesToBase64URL=function(t){const u=[],n={queue:0,queuedBits:0},i=t=>{u.push(t)};return t.forEach(t=>o(t,n,i)),o(null,n,i),u.join('')};const t='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_'.split(''),u=' \t\n\r='.split(''),n=(()=>{const n=new Array(128);for(let t=0;t=6;){const u=n.queue>>n.queuedBits-6&63;o(t[u]),n.queuedBits-=6}else if(n.queuedBits>0)for(n.queue=n.queue<<6-n.queuedBits,n.queuedBits=6;n.queuedBits>=6;){const u=n.queue>>n.queuedBits-6&63;o(t[u]),n.queuedBits-=6}}function i(t,u,o){const i=n[t];if(!(i>-1)){if(-2===i)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(t)}"`)}for(u.queue=u.queue<<6|i,u.queuedBits+=6;u.queuedBits>=8;)o(u.queue>>u.queuedBits-8&255),u.queuedBits-=8}function s(t,u){if(!(t<=127)){if(t<=2047)return u(192|t>>6),void u(128|63&t);if(t<=65535)return u(224|t>>12),u(128|t>>6&63),void u(128|63&t);if(t<=1114111)return u(240|t>>18),u(128|t>>12&63),u(128|t>>6&63),void u(128|63&t);throw new Error(`Unrecognized Unicode codepoint: ${t.toString(16)}`)}u(t)}function f(t,u){for(let n=0;n55295&&o<=56319){const u=1024*(o-55296)&65535;o=65536+(t.charCodeAt(n+1)-56320&65535|u),n+=1}s(o,u)}}function c(t,u,n){if(0===u.utf8seq){if(t<=127)return void n(t);for(let n=1;n<6;n+=1)if(!(t>>7-n&1)){u.utf8seq=n;break}if(2===u.utf8seq)u.codepoint=31&t;else if(3===u.utf8seq)u.codepoint=15&t;else{if(4!==u.utf8seq)throw new Error('Invalid UTF-8 sequence');u.codepoint=7&t}u.utf8seq-=1}else if(u.utf8seq>0){if(t<=127)throw new Error('Invalid UTF-8 sequence');u.codepoint=u.codepoint<<6|63&t,u.utf8seq-=1,0===u.utf8seq&&n(u.codepoint)}}},1153,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SIGN_OUT_SCOPES",{enumerable:!0,get:function(){return t}});const t=['global','local','others']},1154,[]); +__d(function(e,t,s,r,i,n,a){"use strict";Object.defineProperty(n,'__esModule',{value:!0}),Object.defineProperty(n,"default",{enumerable:!0,get:function(){return A}});var o,l=t(a[0]),u=(o=l)&&o.__esModule?o:{default:o},h=t(a[1]),c=t(a[2]),d=t(a[3]),_=t(a[4]),g=t(a[5]),w=t(a[6]),y=t(a[7]),f=t(a[8]),p=t(a[9]),v=t(a[10]),b=t(a[11]);(0,y.polyfillGlobalThis)();const k={url:h.GOTRUE_URL,storageKey:h.STORAGE_KEY,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:h.DEFAULT_HEADERS,flowType:'implicit',debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:5e3,skipAutoInitialize:!1,experimental:{}},m={};class R{get jwks(){var e,t;return null!==(t=null===(e=m[this.storageKey])||void 0===e?void 0:e.jwks)&&void 0!==t?t:{keys:[]}}set jwks(e){m[this.storageKey]=Object.assign(Object.assign({},m[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,t;return null!==(t=null===(e=m[this.storageKey])||void 0===e?void 0:e.cachedAt)&&void 0!==t?t:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){m[this.storageKey]=Object.assign(Object.assign({},m[this.storageKey]),{cachedAt:e})}constructor(e){var t,s,r;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.autoRefreshTickTimeout=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.lastRefreshFailure=null,this._sessionRemovalEpoch=0,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lock=null,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log;const i=Object.assign(Object.assign({},k),e);if(this.storageKey=i.storageKey,this.instanceID=null!==(t=R.nextInstanceID[this.storageKey])&&void 0!==t?t:0,R.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!i.debug,'function'==typeof i.debug&&(this.logger=i.debug),this.instanceID>0&&(0,_.isBrowser)()){const e=`${this._logPrefix()} Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.`;console.warn(e),this.logDebugMessages&&console.trace(e)}if(this.persistSession=i.persistSession,this.autoRefreshToken=i.autoRefreshToken,this.experimental=null!==(s=i.experimental)&&void 0!==s?s:{},this.admin=new u.default({url:i.url,headers:i.headers,fetch:i.fetch,experimental:this.experimental}),this.url=i.url,this.headers=i.headers,this.fetch=(0,_.resolveFetch)(i.fetch),this.detectSessionInUrl=i.detectSessionInUrl,this.flowType=i.flowType,this.hasCustomAuthorizationHeader=i.hasCustomAuthorizationHeader,this.throwOnError=i.throwOnError,this.lockAcquireTimeout=i.lockAcquireTimeout,null!=i.lock&&(this.lock=i.lock),this.jwks||(this.jwks={keys:[]},this.jwks_cached_at=Number.MIN_SAFE_INTEGER),this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this),webauthn:new b.WebAuthnApi(this)},this.oauth={getAuthorizationDetails:this._getAuthorizationDetails.bind(this),approveAuthorization:this._approveAuthorization.bind(this),denyAuthorization:this._denyAuthorization.bind(this),listGrants:this._listOAuthGrants.bind(this),revokeGrant:this._revokeOAuthGrant.bind(this)},this.passkey={startRegistration:this._startPasskeyRegistration.bind(this),verifyRegistration:this._verifyPasskeyRegistration.bind(this),startAuthentication:this._startPasskeyAuthentication.bind(this),verifyAuthentication:this._verifyPasskeyAuthentication.bind(this),list:this._listPasskeys.bind(this),update:this._updatePasskey.bind(this),delete:this._deletePasskey.bind(this)},this.persistSession?(i.storage?this.storage=i.storage:(0,_.supportsLocalStorage)()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=(0,g.memoryLocalStorageAdapter)(this.memoryStorage)),i.userStorage&&(this.userStorage=i.userStorage)):(this.memoryStorage={},this.storage=(0,g.memoryLocalStorageAdapter)(this.memoryStorage)),(0,_.isBrowser)()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(e){console.error('Failed to create a new BroadcastChannel, multi-tab state changes will not be available',e)}null===(r=this.broadcastChannel)||void 0===r||r.addEventListener('message',async e=>{this._debug('received broadcast notification from other tab or client',e),'TOKEN_REFRESHED'!==e.data.event&&'SIGNED_IN'!==e.data.event||(this.lastRefreshFailure=null);try{await this._notifyAllSubscribers(e.data.event,e.data.session,!1)}catch(e){this._debug('#broadcastChannel','error',e)}})}i.skipAutoInitialize||this.initialize().catch(e=>{this._debug('#initialize()','error',e)})}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(e){if(this.throwOnError&&e&&e.error)throw e.error;return e}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${f.version}) ${(new Date).toISOString()}`}_debug(...e){return this.logDebugMessages&&this.logger(this._logPrefix(),...e),this}async initialize(){return this.initializePromise||(this.initializePromise=(async()=>null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._initialize()):await this._initialize())()),await this.initializePromise}async _initialize(){var e;try{let t={},s='none';if((0,_.isBrowser)()&&(t=(0,_.parseParametersFromURL)(window.location.href),this._isImplicitGrantCallback(t)?s='implicit':await this._isPKCECallback(t)&&(s='pkce')),(0,_.isBrowser)()&&this.detectSessionInUrl&&'none'!==s){const{data:r,error:i}=await this._getSessionFromURL(t,s);if(i){if(this._debug('#_initialize()','error detecting session from URL',i),(0,c.isAuthImplicitGrantRedirectError)(i)){const t=null===(e=i.details)||void 0===e?void 0:e.code;if('identity_already_exists'===t||'identity_not_found'===t||'single_identity_not_deletable'===t)return{error:i}}return{error:i}}const{session:n,redirectType:a}=r;return this._debug('#_initialize()','detected session in URL',n,'redirect type',a),await this._saveSession(n),setTimeout(async()=>{'recovery'===a?await this._notifyAllSubscribers('PASSWORD_RECOVERY',n):await this._notifyAllSubscribers('SIGNED_IN',n)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(e){return(0,c.isAuthError)(e)?this._returnResult({error:e}):this._returnResult({error:new c.AuthUnknownError('Unexpected error during initialization',e)})}finally{await this._handleVisibilityChange(),this._debug('#_initialize()','end')}}async signInAnonymously(e){var t,s,r;try{const i=await(0,d._request)(this.fetch,'POST',`${this.url}/signup`,{headers:this.headers,body:{data:null!==(s=null===(t=null==e?void 0:e.options)||void 0===t?void 0:t.data)&&void 0!==s?s:{},gotrue_meta_security:{captcha_token:null===(r=null==e?void 0:e.options)||void 0===r?void 0:r.captchaToken}},xform:d._sessionResponse}),{data:n,error:a}=i;if(a||!n)return this._returnResult({data:{user:null,session:null},error:a});const o=n.session,l=n.user;return n.session&&(await this._saveSession(n.session),await this._notifyAllSubscribers('SIGNED_IN',o)),this._returnResult({data:{user:l,session:o},error:null})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signUp(e){var t,s,r;try{let i;if('email'in e){const{email:s,password:r,options:n}=e;let a=null,o=null;'pkce'===this.flowType&&([a,o]=await(0,_.getCodeChallengeAndMethod)(this.storage,this.storageKey)),i=await(0,d._request)(this.fetch,'POST',`${this.url}/signup`,{headers:this.headers,redirectTo:null==n?void 0:n.emailRedirectTo,body:{email:s,password:r,data:null!==(t=null==n?void 0:n.data)&&void 0!==t?t:{},gotrue_meta_security:{captcha_token:null==n?void 0:n.captchaToken},code_challenge:a,code_challenge_method:o},xform:d._sessionResponse})}else{if(!('phone'in e))throw new c.AuthInvalidCredentialsError('You must provide either an email or phone number and a password');{const{phone:t,password:n,options:a}=e;i=await(0,d._request)(this.fetch,'POST',`${this.url}/signup`,{headers:this.headers,body:{phone:t,password:n,data:null!==(s=null==a?void 0:a.data)&&void 0!==s?s:{},channel:null!==(r=null==a?void 0:a.channel)&&void 0!==r?r:'sms',gotrue_meta_security:{captcha_token:null==a?void 0:a.captchaToken}},xform:d._sessionResponse})}}const{data:n,error:a}=i;if(a||!n)return await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:a});const o=n.session,l=n.user;return n.session&&(await this._saveSession(n.session),await this._notifyAllSubscribers('SIGNED_IN',o)),this._returnResult({data:{user:l,session:o},error:null})}catch(e){if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),(0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signInWithPassword(e){try{let t;if('email'in e){const{email:s,password:r,options:i}=e;t=await(0,d._request)(this.fetch,'POST',`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:s,password:r,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken}},xform:d._sessionResponsePassword})}else{if(!('phone'in e))throw new c.AuthInvalidCredentialsError('You must provide either an email or phone number and a password');{const{phone:s,password:r,options:i}=e;t=await(0,d._request)(this.fetch,'POST',`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:s,password:r,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken}},xform:d._sessionResponsePassword})}}const{data:s,error:r}=t;if(r)return this._returnResult({data:{user:null,session:null},error:r});if(!s||!s.session||!s.user){const e=new c.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null},error:e})}return s.session&&(await this._saveSession(s.session),await this._notifyAllSubscribers('SIGNED_IN',s.session)),this._returnResult({data:Object.assign({user:s.user,session:s.session},s.weak_password?{weakPassword:s.weak_password}:null),error:r})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signInWithOAuth(e){var t,s,r,i;return await this._handleProviderSignIn(e.provider,{redirectTo:null===(t=e.options)||void 0===t?void 0:t.redirectTo,scopes:null===(s=e.options)||void 0===s?void 0:s.scopes,queryParams:null===(r=e.options)||void 0===r?void 0:r.queryParams,skipBrowserRedirect:null===(i=e.options)||void 0===i?void 0:i.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,null!=this.lock?this._acquireLock(this.lockAcquireTimeout,async()=>this._exchangeCodeForSession(e)):this._exchangeCodeForSession(e)}async signInWithWeb3(e){const{chain:t}=e;switch(t){case'ethereum':return await this.signInWithEthereum(e);case'solana':return await this.signInWithSolana(e);default:throw new Error(`@supabase/auth-js: Unsupported chain "${t}"`)}}async signInWithEthereum(e){var t,s,r,i,n,a,o,l,u,h,g;let w,y;if('message'in e)w=e.message,y=e.signature;else{const{chain:h,wallet:c,statement:d,options:g}=e;let f;if((0,_.isBrowser)())if('object'==typeof c)f=c;else{const e=window;if(!('ethereum'in e)||'object'!=typeof e.ethereum||!('request'in e.ethereum)||'function'!=typeof e.ethereum.request)throw new Error("@supabase/auth-js: No compatible Ethereum wallet interface on the window object (window.ethereum) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'ethereum', wallet: resolvedUserWallet }) instead.");f=e.ethereum}else{if('object'!=typeof c||!(null==g?void 0:g.url))throw new Error('@supabase/auth-js: Both wallet and url must be specified in non-browser environments.');f=c}const p=new URL(null!==(t=null==g?void 0:g.url)&&void 0!==t?t:window.location.href),b=await f.request({method:'eth_requestAccounts'}).then(e=>e).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!b||0===b.length)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const k=(0,v.getAddress)(b[0]);let m=null===(s=null==g?void 0:g.signInWithEthereum)||void 0===s?void 0:s.chainId;if(!m){const e=await f.request({method:'eth_chainId'});m=(0,v.fromHex)(e)}const R={domain:p.host,address:k,statement:d,uri:p.href,version:'1',chainId:m,nonce:null===(r=null==g?void 0:g.signInWithEthereum)||void 0===r?void 0:r.nonce,issuedAt:null!==(n=null===(i=null==g?void 0:g.signInWithEthereum)||void 0===i?void 0:i.issuedAt)&&void 0!==n?n:new Date,expirationTime:null===(a=null==g?void 0:g.signInWithEthereum)||void 0===a?void 0:a.expirationTime,notBefore:null===(o=null==g?void 0:g.signInWithEthereum)||void 0===o?void 0:o.notBefore,requestId:null===(l=null==g?void 0:g.signInWithEthereum)||void 0===l?void 0:l.requestId,resources:null===(u=null==g?void 0:g.signInWithEthereum)||void 0===u?void 0:u.resources};w=(0,v.createSiweMessage)(R),y=await f.request({method:'personal_sign',params:[(0,v.toHex)(w),k]})}try{const{data:t,error:s}=await(0,d._request)(this.fetch,'POST',`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:'ethereum',message:w,signature:y},(null===(h=e.options)||void 0===h?void 0:h.captchaToken)?{gotrue_meta_security:{captcha_token:null===(g=e.options)||void 0===g?void 0:g.captchaToken}}:null),xform:d._sessionResponse});if(s)throw s;if(!t||!t.session||!t.user){const e=new c.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null},error:e})}return t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers('SIGNED_IN',t.session)),this._returnResult({data:Object.assign({},t),error:s})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signInWithSolana(e){var t,s,r,i,n,a,o,l,u,h,g,w;let y,f;if('message'in e)y=e.message,f=e.signature;else{const{chain:c,wallet:d,statement:g,options:w}=e;let p;if((0,_.isBrowser)())if('object'==typeof d)p=d;else{const e=window;if(!('solana'in e)||'object'!=typeof e.solana||!('signIn'in e.solana&&'function'==typeof e.solana.signIn||'signMessage'in e.solana&&'function'==typeof e.solana.signMessage))throw new Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.");p=e.solana}else{if('object'!=typeof d||!(null==w?void 0:w.url))throw new Error('@supabase/auth-js: Both wallet and url must be specified in non-browser environments.');p=d}const v=new URL(null!==(t=null==w?void 0:w.url)&&void 0!==t?t:window.location.href);if('signIn'in p&&p.signIn){const e=await p.signIn(Object.assign(Object.assign(Object.assign({issuedAt:(new Date).toISOString()},null==w?void 0:w.signInWithSolana),{version:'1',domain:v.host,uri:v.href}),g?{statement:g}:null));let t;if(Array.isArray(e)&&e[0]&&'object'==typeof e[0])t=e[0];else{if(!(e&&'object'==typeof e&&'signedMessage'in e&&'signature'in e))throw new Error('@supabase/auth-js: Wallet method signIn() returned unrecognized value');t=e}if(!('signedMessage'in t&&'signature'in t&&('string'==typeof t.signedMessage||t.signedMessage instanceof Uint8Array)&&t.signature instanceof Uint8Array))throw new Error('@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields');y='string'==typeof t.signedMessage?t.signedMessage:(new TextDecoder).decode(t.signedMessage),f=t.signature}else{if(!('signMessage'in p&&'function'==typeof p.signMessage&&'publicKey'in p&&'object'==typeof p&&p.publicKey&&'toBase58'in p.publicKey&&'function'==typeof p.publicKey.toBase58))throw new Error('@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API');y=[`${v.host} wants you to sign in with your Solana account:`,p.publicKey.toBase58(),...g?['',g,'']:[''],'Version: 1',`URI: ${v.href}`,`Issued At: ${null!==(r=null===(s=null==w?void 0:w.signInWithSolana)||void 0===s?void 0:s.issuedAt)&&void 0!==r?r:(new Date).toISOString()}`,...(null===(i=null==w?void 0:w.signInWithSolana)||void 0===i?void 0:i.notBefore)?[`Not Before: ${w.signInWithSolana.notBefore}`]:[],...(null===(n=null==w?void 0:w.signInWithSolana)||void 0===n?void 0:n.expirationTime)?[`Expiration Time: ${w.signInWithSolana.expirationTime}`]:[],...(null===(a=null==w?void 0:w.signInWithSolana)||void 0===a?void 0:a.chainId)?[`Chain ID: ${w.signInWithSolana.chainId}`]:[],...(null===(o=null==w?void 0:w.signInWithSolana)||void 0===o?void 0:o.nonce)?[`Nonce: ${w.signInWithSolana.nonce}`]:[],...(null===(l=null==w?void 0:w.signInWithSolana)||void 0===l?void 0:l.requestId)?[`Request ID: ${w.signInWithSolana.requestId}`]:[],...(null===(h=null===(u=null==w?void 0:w.signInWithSolana)||void 0===u?void 0:u.resources)||void 0===h?void 0:h.length)?['Resources',...w.signInWithSolana.resources.map(e=>`- ${e}`)]:[]].join('\n');const e=await p.signMessage((new TextEncoder).encode(y),'utf8');if(!(e&&e instanceof Uint8Array))throw new Error('@supabase/auth-js: Wallet signMessage() API returned an recognized value');f=e}}try{const{data:t,error:s}=await(0,d._request)(this.fetch,'POST',`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:'solana',message:y,signature:(0,p.bytesToBase64URL)(f)},(null===(g=e.options)||void 0===g?void 0:g.captchaToken)?{gotrue_meta_security:{captcha_token:null===(w=e.options)||void 0===w?void 0:w.captchaToken}}:null),xform:d._sessionResponse});if(s)throw s;if(!t||!t.session||!t.user){const e=new c.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null},error:e})}return t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers('SIGNED_IN',t.session)),this._returnResult({data:Object.assign({},t),error:s})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async _exchangeCodeForSession(e){const t=await(0,_.getItemAsync)(this.storage,`${this.storageKey}-code-verifier`),[s,r]=(null!=t?t:'').split('/');try{if(!s&&'pkce'===this.flowType)throw new c.AuthPKCECodeVerifierMissingError;const{data:t,error:i}=await(0,d._request)(this.fetch,'POST',`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:s},xform:d._sessionResponse});if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),i)throw i;if(!t||!t.session||!t.user){const e=new c.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null,redirectType:null},error:e})}return t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers('recovery'===r?'PASSWORD_RECOVERY':'SIGNED_IN',t.session)),this._returnResult({data:Object.assign(Object.assign({},t),{redirectType:null!=r?r:null}),error:i})}catch(e){if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),(0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null,redirectType:null},error:e});throw e}}async signInWithIdToken(e){try{const{options:t,provider:s,token:r,access_token:i,nonce:n}=e,a=await(0,d._request)(this.fetch,'POST',`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:s,id_token:r,access_token:i,nonce:n,gotrue_meta_security:{captcha_token:null==t?void 0:t.captchaToken}},xform:d._sessionResponse}),{data:o,error:l}=a;if(l)return this._returnResult({data:{user:null,session:null},error:l});if(!o||!o.session||!o.user){const e=new c.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null},error:e})}return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers('SIGNED_IN',o.session)),this._returnResult({data:o,error:l})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signInWithOtp(e){var t,s,r,i,n;try{if('email'in e){const{email:r,options:i}=e;let n=null,a=null;'pkce'===this.flowType&&([n,a]=await(0,_.getCodeChallengeAndMethod)(this.storage,this.storageKey));const{error:o}=await(0,d._request)(this.fetch,'POST',`${this.url}/otp`,{headers:this.headers,body:{email:r,data:null!==(t=null==i?void 0:i.data)&&void 0!==t?t:{},create_user:null===(s=null==i?void 0:i.shouldCreateUser)||void 0===s||s,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken},code_challenge:n,code_challenge_method:a},redirectTo:null==i?void 0:i.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:o})}if('phone'in e){const{phone:t,options:s}=e,{data:a,error:o}=await(0,d._request)(this.fetch,'POST',`${this.url}/otp`,{headers:this.headers,body:{phone:t,data:null!==(r=null==s?void 0:s.data)&&void 0!==r?r:{},create_user:null===(i=null==s?void 0:s.shouldCreateUser)||void 0===i||i,gotrue_meta_security:{captcha_token:null==s?void 0:s.captchaToken},channel:null!==(n=null==s?void 0:s.channel)&&void 0!==n?n:'sms'}});return this._returnResult({data:{user:null,session:null,messageId:null==a?void 0:a.message_id},error:o})}throw new c.AuthInvalidCredentialsError('You must provide either an email or phone number.')}catch(e){if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),(0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async verifyOtp(e){var t,s;try{let r,i;'options'in e&&(r=null===(t=e.options)||void 0===t?void 0:t.redirectTo,i=null===(s=e.options)||void 0===s?void 0:s.captchaToken);const{data:n,error:a}=await(0,d._request)(this.fetch,'POST',`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:i}}),redirectTo:r,xform:d._sessionResponse});if(a)throw a;if(!n){throw new Error('An error occurred on token verification.')}const o=n.session,l=n.user;return(null==o?void 0:o.access_token)&&(await this._saveSession(o),await this._notifyAllSubscribers('recovery'==e.type?'PASSWORD_RECOVERY':'SIGNED_IN',o)),this._returnResult({data:{user:l,session:o},error:null})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signInWithSSO(e){var t,s,r,i,n;try{let a=null,o=null;'pkce'===this.flowType&&([a,o]=await(0,_.getCodeChallengeAndMethod)(this.storage,this.storageKey));const l=await(0,d._request)(this.fetch,'POST',`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},'providerId'in e?{provider_id:e.providerId}:null),'domain'in e?{domain:e.domain}:null),{redirect_to:null!==(s=null===(t=e.options)||void 0===t?void 0:t.redirectTo)&&void 0!==s?s:void 0}),(null===(r=null==e?void 0:e.options)||void 0===r?void 0:r.captchaToken)?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:a,code_challenge_method:o}),headers:this.headers,xform:d._ssoResponse});return(null===(i=l.data)||void 0===i?void 0:i.url)&&(0,_.isBrowser)()&&!(null===(n=e.options)||void 0===n?void 0:n.skipBrowserRedirect)&&window.location.assign(l.data.url),this._returnResult(l)}catch(e){if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),(0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async reauthenticate(){return await this.initializePromise,null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._reauthenticate()):await this._reauthenticate()}async _reauthenticate(){try{return await this._useSession(async e=>{const{data:{session:t},error:s}=e;if(s)throw s;if(!t)throw new c.AuthSessionMissingError;const{error:r}=await(0,d._request)(this.fetch,'GET',`${this.url}/reauthenticate`,{headers:this.headers,jwt:t.access_token});return this._returnResult({data:{user:null,session:null},error:r})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async resend(e){try{const t=`${this.url}/resend`;if('email'in e){const{email:s,type:r,options:i}=e;let n=null,a=null;'pkce'===this.flowType&&([n,a]=await(0,_.getCodeChallengeAndMethod)(this.storage,this.storageKey));const{error:o}=await(0,d._request)(this.fetch,'POST',t,{headers:this.headers,body:{email:s,type:r,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken},code_challenge:n,code_challenge_method:a},redirectTo:null==i?void 0:i.emailRedirectTo});return o&&await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:o})}if('phone'in e){const{phone:s,type:r,options:i}=e,{data:n,error:a}=await(0,d._request)(this.fetch,'POST',t,{headers:this.headers,body:{phone:s,type:r,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:null==n?void 0:n.message_id},error:a})}throw new c.AuthInvalidCredentialsError('You must provide either an email or phone number and a type')}catch(e){if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),(0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async getSession(){return await this.initializePromise,null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>this._useSession(async e=>e)):await this._useSession(async e=>e)}async _acquireLock(e,t){this._debug('#_acquireLock','begin',e);try{if(this.lockAcquired){const e=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),s=(async()=>(await e,await t()))();return this.pendingInLock.push((async()=>{try{await s}catch(e){}})()),s}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug('#_acquireLock','lock acquired for storage key',this.storageKey);try{this.lockAcquired=!0;const e=t();for(this.pendingInLock.push((async()=>{try{await e}catch(e){}})()),await e;this.pendingInLock.length;){const e=[...this.pendingInLock];await Promise.all(e),this.pendingInLock.splice(0,e.length)}return await e}finally{this._debug('#_acquireLock','lock released for storage key',this.storageKey),this.lockAcquired=!1}})}finally{this._debug('#_acquireLock','end')}}async _useSession(e){this._debug('#_useSession','begin');try{const t=await this.__loadSession();return await e(t)}finally{this._debug('#_useSession','end')}}async __loadSession(){this._debug('#__loadSession()','begin'),null==this.lock||this.lockAcquired||this._debug('#__loadSession()','used outside of an acquired lock!',(new Error).stack);try{let e=null;const t=await(0,_.getItemAsync)(this.storage,this.storageKey);if(this._debug('#getSession()','session from storage',t),null!==t&&(this._isValidSession(t)?e=t:(this._debug('#getSession()','session from storage is not valid'),await this._removeSession())),!e)return{data:{session:null},error:null};const s=!!e.expires_at&&1e3*e.expires_at-Date.now()Date.now())){const t=await(0,_.getItemAsync)(this.storage,this.storageKey);if(t&&t.refresh_token===e.refresh_token)return this._returnResult({data:{session:e},error:null})}return this._returnResult({data:{session:null},error:i})}return this._returnResult({data:{session:r},error:null})}finally{this._debug('#__loadSession()','end')}}async getUser(e){if(e)return await this._getUser(e);let t;return await this.initializePromise,t=null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser()):await this._getUser(),t.data.user&&(this.suppressGetSessionWarning=!0),t}async _getUser(e){try{return e?await(0,d._request)(this.fetch,'GET',`${this.url}/user`,{headers:this.headers,jwt:e,xform:d._userResponse}):await this._useSession(async e=>{var t,s,r;const{data:i,error:n}=e;if(n)throw n;return(null===(t=i.session)||void 0===t?void 0:t.access_token)||this.hasCustomAuthorizationHeader?await(0,d._request)(this.fetch,'GET',`${this.url}/user`,{headers:this.headers,jwt:null!==(r=null===(s=i.session)||void 0===s?void 0:s.access_token)&&void 0!==r?r:void 0,xform:d._userResponse}):{data:{user:null},error:new c.AuthSessionMissingError}})}catch(e){if((0,c.isAuthError)(e))return(0,c.isAuthSessionMissingError)(e)&&(await this._removeSession(),await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:e});throw e}}async updateUser(e,t={}){return await this.initializePromise,null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(e,t)):await this._updateUser(e,t)}async _updateUser(e,t={}){try{return await this._useSession(async s=>{const{data:r,error:i}=s;if(i)throw i;if(!r.session)throw new c.AuthSessionMissingError;const n=r.session;let a=null,o=null;'pkce'===this.flowType&&null!=e.email&&([a,o]=await(0,_.getCodeChallengeAndMethod)(this.storage,this.storageKey));const{data:l,error:u}=await(0,d._request)(this.fetch,'PUT',`${this.url}/user`,{headers:this.headers,redirectTo:null==t?void 0:t.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:a,code_challenge_method:o}),jwt:n.access_token,xform:d._userResponse});if(u)throw u;return n.user=l.user,await this._saveSession(n),await this._notifyAllSubscribers('USER_UPDATED',n),this._returnResult({data:{user:n.user},error:null})})}catch(e){if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),(0,c.isAuthError)(e))return this._returnResult({data:{user:null},error:e});throw e}}async setSession(e){return await this.initializePromise,null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._setSession(e)):await this._setSession(e)}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new c.AuthSessionMissingError;const t=Date.now()/1e3;let s=t,r=!0,i=null;const{payload:n}=(0,_.decodeJWT)(e.access_token);if(n.exp&&(s=n.exp,r=s<=t),r){const{data:t,error:s}=await this._callRefreshToken(e.refresh_token);if(s)return this._returnResult({data:{user:null,session:null},error:s});if(!t)return{data:{user:null,session:null},error:null};i=t}else{const{data:r,error:n}=await this._getUser(e.access_token);if(n)return this._returnResult({data:{user:null,session:null},error:n});i={access_token:e.access_token,refresh_token:e.refresh_token,user:r.user,token_type:'bearer',expires_in:s-t,expires_at:s},await this._saveSession(i),await this._notifyAllSubscribers('SIGNED_IN',i)}return this._returnResult({data:{user:i.user,session:i},error:null})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{session:null,user:null},error:e});throw e}}async refreshSession(e){return await this.initializePromise,null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._refreshSession(e)):await this._refreshSession(e)}async _refreshSession(e){try{return await this._useSession(async t=>{var s;if(!e){const{data:r,error:i}=t;if(i)throw i;e=null!==(s=r.session)&&void 0!==s?s:void 0}if(!(null==e?void 0:e.refresh_token))throw new c.AuthSessionMissingError;const{data:r,error:i}=await this._callRefreshToken(e.refresh_token);return i?this._returnResult({data:{user:null,session:null},error:i}):r?this._returnResult({data:{user:r.user,session:r},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async _getSessionFromURL(e,t){var s;try{if(!(0,_.isBrowser)())throw new c.AuthImplicitGrantRedirectError('No browser detected.');if(e.error||e.error_description||e.error_code)throw new c.AuthImplicitGrantRedirectError(e.error_description||'Error in URL with unspecified error_description',{error:e.error||'unspecified_error',code:e.error_code||'unspecified_code'});switch(t){case'implicit':if('pkce'===this.flowType)throw new c.AuthPKCEGrantCodeExchangeError('Not a valid PKCE flow url.');break;case'pkce':if('implicit'===this.flowType)throw new c.AuthImplicitGrantRedirectError('Not a valid implicit grant flow url.')}if('pkce'===t){if(this._debug('#_initialize()','begin','is PKCE flow',!0),!e.code)throw new c.AuthPKCEGrantCodeExchangeError('No code detected.');const{data:t,error:r}=await this._exchangeCodeForSession(e.code);if(r)throw r;const i=new URL(window.location.href);return i.searchParams.delete('code'),window.history.replaceState(window.history.state,'',i.toString()),{data:{session:t.session,redirectType:null!==(s=t.redirectType)&&void 0!==s?s:null},error:null}}const{provider_token:r,provider_refresh_token:i,access_token:n,refresh_token:a,expires_in:o,expires_at:l,token_type:u}=e;if(!(n&&o&&a&&u))throw new c.AuthImplicitGrantRedirectError('No session defined in URL');const d=Math.round(Date.now()/1e3),g=parseInt(o);let w=d+g;l&&(w=parseInt(l));const y=w-d;1e3*y<=h.AUTO_REFRESH_TICK_DURATION_MS&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${y}s, should have been closer to ${g}s`);const f=w-g;d-f>=120?console.warn('@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale',f,w,d):d-f<0&&console.warn('@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew',f,w,d);const{data:p,error:v}=await this._getUser(n);if(v)throw v;const b={provider_token:r,provider_refresh_token:i,access_token:n,expires_in:g,expires_at:w,refresh_token:a,token_type:u,user:p.user};return window.location.hash='',this._debug('#_getSessionFromURL()','clearing window.location.hash'),this._returnResult({data:{session:b,redirectType:e.type},error:null})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{session:null,redirectType:null},error:e});throw e}}_isImplicitGrantCallback(e){return'function'==typeof this.detectSessionInUrl?this.detectSessionInUrl(new URL(window.location.href),e):Boolean(e.access_token||e.error||e.error_description||e.error_code)}async _isPKCECallback(e){const t=await(0,_.getItemAsync)(this.storage,`${this.storageKey}-code-verifier`);return!(!e.code||!t)}async signOut(e={scope:'global'}){return await this.initializePromise,null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(e)):await this._signOut(e)}async _signOut({scope:e}={scope:'global'}){return await this._useSession(async t=>{var s;const{data:r,error:i}=t;if(i&&!(0,c.isAuthSessionMissingError)(i))return this._returnResult({error:i});const n=null===(s=r.session)||void 0===s?void 0:s.access_token;if(n){const{error:t}=await this.admin.signOut(n,e);if(t&&(!(0,c.isAuthApiError)(t)||404!==t.status&&401!==t.status&&403!==t.status)&&!(0,c.isAuthSessionMissingError)(t))return this._returnResult({error:t})}return'others'!==e&&(await this._removeSession(),await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(e){const t=(0,_.generateCallbackId)(),s={id:t,callback:e,unsubscribe:()=>{this._debug('#unsubscribe()','state change callback with id removed',t),this.stateChangeEmitters.delete(t)}};return this._debug('#onAuthStateChange()','registered callback with id',t),this.stateChangeEmitters.set(t,s),(async()=>{await this.initializePromise,null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(t)}):await this._emitInitialSession(t)})(),{data:{subscription:s}}}async _emitInitialSession(e){return await this._useSession(async t=>{var s,r;try{const{data:{session:r},error:i}=t;if(i)throw i;await(null===(s=this.stateChangeEmitters.get(e))||void 0===s?void 0:s.callback('INITIAL_SESSION',r)),this._debug('INITIAL_SESSION','callback id',e,'session',r)}catch(t){await(null===(r=this.stateChangeEmitters.get(e))||void 0===r?void 0:r.callback('INITIAL_SESSION',null)),this._debug('INITIAL_SESSION','callback id',e,'error',t),(0,c.isAuthSessionMissingError)(t)?console.warn(t):console.error(t)}})}async resetPasswordForEmail(e,t={}){let s=null,r=null;'pkce'===this.flowType&&([s,r]=await(0,_.getCodeChallengeAndMethod)(this.storage,this.storageKey,!0));try{return await(0,d._request)(this.fetch,'POST',`${this.url}/recover`,{body:{email:e,code_challenge:s,code_challenge_method:r,gotrue_meta_security:{captcha_token:t.captchaToken}},headers:this.headers,redirectTo:t.redirectTo})}catch(e){if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),(0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async getUserIdentities(){var e;try{const{data:t,error:s}=await this.getUser();if(s)throw s;return this._returnResult({data:{identities:null!==(e=t.user.identities)&&void 0!==e?e:[]},error:null})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async linkIdentity(e){return'token'in e?this.linkIdentityIdToken(e):this.linkIdentityOAuth(e)}async linkIdentityOAuth(e){var t;try{const{data:s,error:r}=await this._useSession(async t=>{var s,r,i,n,a;const{data:o,error:l}=t;if(l)throw l;const u=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:null===(s=e.options)||void 0===s?void 0:s.redirectTo,scopes:null===(r=e.options)||void 0===r?void 0:r.scopes,queryParams:null===(i=e.options)||void 0===i?void 0:i.queryParams,skipBrowserRedirect:!0});return await(0,d._request)(this.fetch,'GET',u,{headers:this.headers,jwt:null!==(a=null===(n=o.session)||void 0===n?void 0:n.access_token)&&void 0!==a?a:void 0})});if(r)throw r;return(0,_.isBrowser)()&&!(null===(t=e.options)||void 0===t?void 0:t.skipBrowserRedirect)&&window.location.assign(null==s?void 0:s.url),this._returnResult({data:{provider:e.provider,url:null==s?void 0:s.url},error:null})}catch(t){if((0,c.isAuthError)(t))return this._returnResult({data:{provider:e.provider,url:null},error:t});throw t}}async linkIdentityIdToken(e){return await this._useSession(async t=>{var s;try{const{error:r,data:{session:i}}=t;if(r)throw r;const{options:n,provider:a,token:o,access_token:l,nonce:u}=e,h=await(0,d._request)(this.fetch,'POST',`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:null!==(s=null==i?void 0:i.access_token)&&void 0!==s?s:void 0,body:{provider:a,id_token:o,access_token:l,nonce:u,link_identity:!0,gotrue_meta_security:{captcha_token:null==n?void 0:n.captchaToken}},xform:d._sessionResponse}),{data:_,error:g}=h;return g?this._returnResult({data:{user:null,session:null},error:g}):_&&_.session&&_.user?(_.session&&(await this._saveSession(_.session),await this._notifyAllSubscribers('USER_UPDATED',_.session)),this._returnResult({data:_,error:g})):this._returnResult({data:{user:null,session:null},error:new c.AuthInvalidTokenResponseError})}catch(e){if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),(0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}})}async unlinkIdentity(e){try{return await this._useSession(async t=>{var s,r;const{data:i,error:n}=t;if(n)throw n;return await(0,d._request)(this.fetch,'DELETE',`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:null!==(r=null===(s=i.session)||void 0===s?void 0:s.access_token)&&void 0!==r?r:void 0})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _refreshAccessToken(e){const t="#_refreshAccessToken()";this._debug(t,'begin');try{const s=Date.now();return await(0,_.retryable)(async s=>(s>0&&await(0,_.sleep)(200*Math.pow(2,s-1)),this._debug(t,'refreshing attempt',s),await(0,d._request)(this.fetch,'POST',`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:d._sessionResponse})),(e,t)=>{const r=200*Math.pow(2,e);return t&&(0,c.isAuthRetryableFetchError)(t)&&Date.now()+r-sDate.now())?this._debug(r,'proactive refresh failed, access token still valid \u2014 preserving session'):await this._removeSession()}return this.lastRefreshFailure={refreshToken:e,result:s,expiresAt:Date.now()+h.REFRESH_FAILURE_COOLDOWN_MS},null===(t=this.refreshingDeferred)||void 0===t||t.resolve(s),s}throw null===(s=this.refreshingDeferred)||void 0===s||s.reject(i),i}finally{this.refreshingDeferred=null,this._debug(r,'end')}}async _notifyAllSubscribers(e,t,s=!0){const r=`#_notifyAllSubscribers(${e})`;this._debug(r,'begin',t,`broadcast = ${s}`);try{this.broadcastChannel&&s&&this.broadcastChannel.postMessage({event:e,session:t});const r=[],i=Array.from(this.stateChangeEmitters.values()).map(async s=>{try{await s.callback(e,t)}catch(e){r.push(e)}});if(await Promise.all(i),r.length>0){for(let e=0;ethis._autoRefreshTokenTick(),h.AUTO_REFRESH_TICK_DURATION_MS);this.autoRefreshTicker=e,e&&'object'==typeof e&&'function'==typeof e.unref?e.unref():'undefined'!=typeof Deno&&'function'==typeof Deno.unrefTimer&&Deno.unrefTimer(e);const t=setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0);this.autoRefreshTickTimeout=t,t&&'object'==typeof t&&'function'==typeof t.unref?t.unref():'undefined'!=typeof Deno&&'function'==typeof Deno.unrefTimer&&Deno.unrefTimer(t)}async _stopAutoRefresh(){this._debug('#_stopAutoRefresh()');const e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e);const t=this.autoRefreshTickTimeout;this.autoRefreshTickTimeout=null,t&&clearTimeout(t)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async dispose(){var e;this._removeVisibilityChangedCallback(),await this._stopAutoRefresh(),null===(e=this.broadcastChannel)||void 0===e||e.close(),this.broadcastChannel=null,this.stateChangeEmitters.clear()}async _autoRefreshTokenTick(){if(this._debug('#_autoRefreshTokenTick()','begin'),null==this.lock)if(null===this.refreshingDeferred)try{const e=Date.now();try{await this._useSession(async t=>{const{data:{session:s}}=t;if(!s||!s.refresh_token||!s.expires_at)return void this._debug('#_autoRefreshTokenTick()','no session');const r=Math.floor((1e3*s.expires_at-e)/h.AUTO_REFRESH_TICK_DURATION_MS);this._debug('#_autoRefreshTokenTick()',`access token expires in ${r} ticks, a tick lasts ${h.AUTO_REFRESH_TICK_DURATION_MS}ms, refresh threshold is ${h.AUTO_REFRESH_TICK_THRESHOLD} ticks`),r<=h.AUTO_REFRESH_TICK_THRESHOLD&&await this._callRefreshToken(s.refresh_token)})}catch(e){console.error('Auto refresh tick failed with error. This is likely a transient error.',e)}}finally{this._debug('#_autoRefreshTokenTick()','end')}else this._debug('#_autoRefreshTokenTick()','refresh already in flight, skipping');else try{await this._acquireLock(0,async()=>{try{const e=Date.now();try{return await this._useSession(async t=>{const{data:{session:s}}=t;if(!s||!s.refresh_token||!s.expires_at)return void this._debug('#_autoRefreshTokenTick()','no session');const r=Math.floor((1e3*s.expires_at-e)/h.AUTO_REFRESH_TICK_DURATION_MS);this._debug('#_autoRefreshTokenTick()',`access token expires in ${r} ticks, a tick lasts ${h.AUTO_REFRESH_TICK_DURATION_MS}ms, refresh threshold is ${h.AUTO_REFRESH_TICK_THRESHOLD} ticks`),r<=h.AUTO_REFRESH_TICK_THRESHOLD&&await this._callRefreshToken(s.refresh_token)})}catch(e){console.error('Auto refresh tick failed with error. This is likely a transient error.',e)}}finally{this._debug('#_autoRefreshTokenTick()','end')}})}catch(e){if(!(e instanceof w.LockAcquireTimeoutError))throw e;this._debug('auto refresh token tick lock not available')}}async _handleVisibilityChange(){if(this._debug('#_handleVisibilityChange()'),!(0,_.isBrowser)()||!(null===window||void 0===window?void 0:window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>{try{await this._onVisibilityChanged(!1)}catch(e){this._debug('#visibilityChangedCallback','error',e)}},null===window||void 0===window||window.addEventListener('visibilitychange',this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error('_handleVisibilityChange',e)}}async _onVisibilityChanged(e){const t=`#_onVisibilityChanged(${e})`;if(this._debug(t,'visibilityState',document.visibilityState),'visible'===document.visibilityState){if(this.autoRefreshToken&&this._startAutoRefresh(),!e)if(await this.initializePromise,null!=this.lock)await this._acquireLock(this.lockAcquireTimeout,async()=>{'visible'===document.visibilityState?await this._recoverAndRefresh():this._debug(t,'acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting')});else{if('visible'!==document.visibilityState)return void this._debug(t,'visibilityState is no longer visible, skipping recovery');await this._recoverAndRefresh()}}else'hidden'===document.visibilityState&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(e,t,s){const r=[`provider=${encodeURIComponent(t)}`];if((null==s?void 0:s.redirectTo)&&r.push(`redirect_to=${encodeURIComponent(s.redirectTo)}`),(null==s?void 0:s.scopes)&&r.push(`scopes=${encodeURIComponent(s.scopes)}`),'pkce'===this.flowType){const[e,t]=await(0,_.getCodeChallengeAndMethod)(this.storage,this.storageKey),s=new URLSearchParams({code_challenge:`${encodeURIComponent(e)}`,code_challenge_method:`${encodeURIComponent(t)}`});r.push(s.toString())}if(null==s?void 0:s.queryParams){const e=new URLSearchParams(s.queryParams);r.push(e.toString())}return(null==s?void 0:s.skipBrowserRedirect)&&r.push(`skip_http_redirect=${s.skipBrowserRedirect}`),`${e}?${r.join('&')}`}async _unenroll(e){try{return await this._useSession(async t=>{var s;const{data:r,error:i}=t;return i?this._returnResult({data:null,error:i}):await(0,d._request)(this.fetch,'DELETE',`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:null===(s=null==r?void 0:r.session)||void 0===s?void 0:s.access_token})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _enroll(e){try{return await this._useSession(async t=>{var s,r;const{data:i,error:n}=t;if(n)return this._returnResult({data:null,error:n});const a=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},'phone'===e.factorType?{phone:e.phone}:'totp'===e.factorType?{issuer:e.issuer}:{}),{data:o,error:l}=await(0,d._request)(this.fetch,'POST',`${this.url}/factors`,{body:a,headers:this.headers,jwt:null===(s=null==i?void 0:i.session)||void 0===s?void 0:s.access_token});return l?this._returnResult({data:null,error:l}):('totp'===e.factorType&&'totp'===o.type&&(null===(r=null==o?void 0:o.totp)||void 0===r?void 0:r.qr_code)&&(o.totp.qr_code=`data:image/svg+xml;utf-8,${o.totp.qr_code}`),this._returnResult({data:o,error:null}))})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _verify(e){const t=async()=>{try{return await this._useSession(async t=>{var s;const{data:r,error:i}=t;if(i)return this._returnResult({data:null,error:i});const n=Object.assign({challenge_id:e.challengeId},'webauthn'in e?{webauthn:Object.assign(Object.assign({},e.webauthn),{credential_response:'create'===e.webauthn.type?(0,b.serializeCredentialCreationResponse)(e.webauthn.credential_response):(0,b.serializeCredentialRequestResponse)(e.webauthn.credential_response)})}:{code:e.code}),{data:a,error:o}=await(0,d._request)(this.fetch,'POST',`${this.url}/factors/${e.factorId}/verify`,{body:n,headers:this.headers,jwt:null===(s=null==r?void 0:r.session)||void 0===s?void 0:s.access_token});return o?this._returnResult({data:null,error:o}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+a.expires_in},a)),await this._notifyAllSubscribers('MFA_CHALLENGE_VERIFIED',a),this._returnResult({data:a,error:o}))})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}};return null!=this.lock?this._acquireLock(this.lockAcquireTimeout,t):t()}async _challenge(e){const t=async()=>{try{return await this._useSession(async t=>{var s;const{data:r,error:i}=t;if(i)return this._returnResult({data:null,error:i});const n=await(0,d._request)(this.fetch,'POST',`${this.url}/factors/${e.factorId}/challenge`,{body:e,headers:this.headers,jwt:null===(s=null==r?void 0:r.session)||void 0===s?void 0:s.access_token});if(n.error)return n;const{data:a}=n;if('webauthn'!==a.type)return{data:a,error:null};switch(a.webauthn.type){case'create':return{data:Object.assign(Object.assign({},a),{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_options:Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:(0,b.deserializeCredentialCreationOptions)(a.webauthn.credential_options.publicKey)})})}),error:null};case'request':return{data:Object.assign(Object.assign({},a),{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_options:Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:(0,b.deserializeCredentialRequestOptions)(a.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}};return null!=this.lock?this._acquireLock(this.lockAcquireTimeout,t):t()}async _challengeAndVerify(e){const{data:t,error:s}=await this._challenge({factorId:e.factorId});return s?this._returnResult({data:null,error:s}):await this._verify({factorId:e.factorId,challengeId:t.id,code:e.code})}async _listFactors(){var e;const{data:{user:t},error:s}=await this.getUser();if(s)return{data:null,error:s};const r={all:[],phone:[],totp:[],webauthn:[]};for(const s of null!==(e=null==t?void 0:t.factors)&&void 0!==e?e:[])r.all.push(s),'verified'===s.status&&r[s.factor_type].push(s);return{data:r,error:null}}async _getAuthenticatorAssuranceLevel(e){var t,s,r,i;if(e)try{const{payload:r}=(0,_.decodeJWT)(e);let i=null;r.aal&&(i=r.aal);let n=i;const{data:{user:a},error:o}=await this.getUser(e);if(o)return this._returnResult({data:null,error:o});(null!==(s=null===(t=null==a?void 0:a.factors)||void 0===t?void 0:t.filter(e=>'verified'===e.status))&&void 0!==s?s:[]).length>0&&(n='aal2');return{data:{currentLevel:i,nextLevel:n,currentAuthenticationMethods:r.amr||[]},error:null}}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}const{data:{session:n},error:a}=await this.getSession();if(a)return this._returnResult({data:null,error:a});if(!n)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:o}=(0,_.decodeJWT)(n.access_token);let l=null;o.aal&&(l=o.aal);let u=l;(null!==(i=null===(r=n.user.factors)||void 0===r?void 0:r.filter(e=>'verified'===e.status))&&void 0!==i?i:[]).length>0&&(u='aal2');return{data:{currentLevel:l,nextLevel:u,currentAuthenticationMethods:o.amr||[]},error:null}}async _getAuthorizationDetails(e){try{return await this._useSession(async t=>{const{data:{session:s},error:r}=t;return r?this._returnResult({data:null,error:r}):s?await(0,d._request)(this.fetch,'GET',`${this.url}/oauth/authorizations/${e}`,{headers:this.headers,jwt:s.access_token,xform:e=>({data:e,error:null})}):this._returnResult({data:null,error:new c.AuthSessionMissingError})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _approveAuthorization(e,t){try{return await this._useSession(async s=>{const{data:{session:r},error:i}=s;if(i)return this._returnResult({data:null,error:i});if(!r)return this._returnResult({data:null,error:new c.AuthSessionMissingError});const n=await(0,d._request)(this.fetch,'POST',`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:r.access_token,body:{action:'approve'},xform:e=>({data:e,error:null})});return n.data&&n.data.redirect_url&&(0,_.isBrowser)()&&!(null==t?void 0:t.skipBrowserRedirect)&&window.location.assign(n.data.redirect_url),n})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _denyAuthorization(e,t){try{return await this._useSession(async s=>{const{data:{session:r},error:i}=s;if(i)return this._returnResult({data:null,error:i});if(!r)return this._returnResult({data:null,error:new c.AuthSessionMissingError});const n=await(0,d._request)(this.fetch,'POST',`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:r.access_token,body:{action:'deny'},xform:e=>({data:e,error:null})});return n.data&&n.data.redirect_url&&(0,_.isBrowser)()&&!(null==t?void 0:t.skipBrowserRedirect)&&window.location.assign(n.data.redirect_url),n})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _listOAuthGrants(){try{return await this._useSession(async e=>{const{data:{session:t},error:s}=e;return s?this._returnResult({data:null,error:s}):t?await(0,d._request)(this.fetch,'GET',`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:t.access_token,xform:e=>({data:e,error:null})}):this._returnResult({data:null,error:new c.AuthSessionMissingError})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _revokeOAuthGrant(e){try{return await this._useSession(async t=>{const{data:{session:s},error:r}=t;return r?this._returnResult({data:null,error:r}):s?(await(0,d._request)(this.fetch,'DELETE',`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:s.access_token,query:{client_id:e.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new c.AuthSessionMissingError})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async fetchJwk(e,t={keys:[]}){let s=t.keys.find(t=>t.kid===e);if(s)return s;const r=Date.now();if(s=this.jwks.keys.find(t=>t.kid===e),s&&this.jwks_cached_at+h.JWKS_TTL>r)return s;const{data:i,error:n}=await(0,d._request)(this.fetch,'GET',`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(n)throw n;return i.keys&&0!==i.keys.length?(this.jwks=i,this.jwks_cached_at=r,s=i.keys.find(t=>t.kid===e),s||null):null}async getClaims(e,t={}){try{let s=e;if(!s){const{data:e,error:t}=await this.getSession();if(t||!e.session)return this._returnResult({data:null,error:t});s=e.session.access_token}const{header:r,payload:i,signature:n,raw:{header:a,payload:o}}=(0,_.decodeJWT)(s);if(!(null==t?void 0:t.allowExpired))try{(0,_.validateExp)(i.exp)}catch(e){throw new c.AuthInvalidJwtError(e instanceof Error?e.message:'JWT validation failed')}const l=r.alg&&!r.alg.startsWith('HS')&&r.kid&&'crypto'in globalThis&&'subtle'in globalThis.crypto?await this.fetchJwk(r.kid,(null==t?void 0:t.keys)?{keys:t.keys}:null==t?void 0:t.jwks):null;if(!l){const{error:e}=await this.getUser(s);if(e)throw e;return{data:{claims:i,header:r,signature:n},error:null}}const u=(0,_.getAlgorithm)(r.alg),h=await crypto.subtle.importKey('jwk',l,u,!0,['verify']);if(!await crypto.subtle.verify(u,h,n,(0,p.stringToUint8Array)(`${a}.${o}`)))throw new c.AuthInvalidJwtError('Invalid JWT signature');return{data:{claims:i,header:r,signature:n},error:null}}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async signInWithPasskey(e){var t,s,r;(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{if(!(0,b.browserSupportsWebAuthn)())return this._returnResult({data:null,error:new c.AuthUnknownError('Browser does not support WebAuthn',null)});const{data:i,error:n}=await this._startPasskeyAuthentication({options:{captchaToken:null===(t=null==e?void 0:e.options)||void 0===t?void 0:t.captchaToken}});if(n||!i)return this._returnResult({data:null,error:n});const a=(0,b.deserializeCredentialRequestOptions)(i.options),o=null!==(r=null===(s=null==e?void 0:e.options)||void 0===s?void 0:s.signal)&&void 0!==r?r:b.webAuthnAbortService.createNewAbortSignal(),{data:l,error:u}=await(0,b.getCredential)({publicKey:a,signal:o});if(u||!l)return this._returnResult({data:null,error:null!=u?u:new c.AuthUnknownError('WebAuthn ceremony failed',null)});const h=(0,b.serializeCredentialRequestResponse)(l);return this._verifyPasskeyAuthentication({challengeId:i.challenge_id,credential:h})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async registerPasskey(e){var t,s;(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{if(!(0,b.browserSupportsWebAuthn)())return this._returnResult({data:null,error:new c.AuthUnknownError('Browser does not support WebAuthn',null)});const{data:r,error:i}=await this._startPasskeyRegistration();if(i||!r)return this._returnResult({data:null,error:i});const n=(0,b.deserializeCredentialCreationOptions)(r.options),a=null!==(s=null===(t=null==e?void 0:e.options)||void 0===t?void 0:t.signal)&&void 0!==s?s:b.webAuthnAbortService.createNewAbortSignal(),{data:o,error:l}=await(0,b.createCredential)({publicKey:n,signal:a});if(l||!o)return this._returnResult({data:null,error:null!=l?l:new c.AuthUnknownError('WebAuthn ceremony failed',null)});const u=(0,b.serializeCredentialCreationResponse)(o);return this._verifyPasskeyRegistration({challengeId:r.challenge_id,credential:u})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _startPasskeyRegistration(){(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{return await this._useSession(async e=>{const{data:{session:t},error:s}=e;if(s)return this._returnResult({data:null,error:s});if(!t)return this._returnResult({data:null,error:new c.AuthSessionMissingError});const{data:r,error:i}=await(0,d._request)(this.fetch,'POST',`${this.url}/passkeys/registration/options`,{headers:this.headers,jwt:t.access_token,body:{}});return i?this._returnResult({data:null,error:i}):this._returnResult({data:r,error:null})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _verifyPasskeyRegistration(e){(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{return await this._useSession(async t=>{const{data:{session:s},error:r}=t;if(r)return this._returnResult({data:null,error:r});if(!s)return this._returnResult({data:null,error:new c.AuthSessionMissingError});const{data:i,error:n}=await(0,d._request)(this.fetch,'POST',`${this.url}/passkeys/registration/verify`,{headers:this.headers,jwt:s.access_token,body:{challenge_id:e.challengeId,credential:e.credential}});return n?this._returnResult({data:null,error:n}):this._returnResult({data:i,error:null})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _startPasskeyAuthentication(e){var t;(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{const{data:s,error:r}=await(0,d._request)(this.fetch,'POST',`${this.url}/passkeys/authentication/options`,{headers:this.headers,body:{gotrue_meta_security:{captcha_token:null===(t=null==e?void 0:e.options)||void 0===t?void 0:t.captchaToken}}});return r?this._returnResult({data:null,error:r}):this._returnResult({data:s,error:null})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _verifyPasskeyAuthentication(e){(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{const{data:t,error:s}=await(0,d._request)(this.fetch,'POST',`${this.url}/passkeys/authentication/verify`,{headers:this.headers,body:{challenge_id:e.challengeId,credential:e.credential},xform:d._sessionResponse});return s?this._returnResult({data:null,error:s}):(t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers('SIGNED_IN',t.session)),this._returnResult({data:t,error:null}))}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _listPasskeys(){(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{return await this._useSession(async e=>{const{data:{session:t},error:s}=e;if(s)return this._returnResult({data:null,error:s});if(!t)return this._returnResult({data:null,error:new c.AuthSessionMissingError});const{data:r,error:i}=await(0,d._request)(this.fetch,'GET',`${this.url}/passkeys`,{headers:this.headers,jwt:t.access_token,xform:e=>({data:e,error:null})});return i?this._returnResult({data:null,error:i}):this._returnResult({data:r,error:null})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _updatePasskey(e){(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{return await this._useSession(async t=>{const{data:{session:s},error:r}=t;if(r)return this._returnResult({data:null,error:r});if(!s)return this._returnResult({data:null,error:new c.AuthSessionMissingError});const{data:i,error:n}=await(0,d._request)(this.fetch,'PATCH',`${this.url}/passkeys/${e.passkeyId}`,{headers:this.headers,jwt:s.access_token,body:{friendly_name:e.friendlyName}});return n?this._returnResult({data:null,error:n}):this._returnResult({data:i,error:null})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _deletePasskey(e){(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{return await this._useSession(async t=>{const{data:{session:s},error:r}=t;if(r)return this._returnResult({data:null,error:r});if(!s)return this._returnResult({data:null,error:new c.AuthSessionMissingError});const{error:i}=await(0,d._request)(this.fetch,'DELETE',`${this.url}/passkeys/${e.passkeyId}`,{headers:this.headers,jwt:s.access_token,noResolveJson:!0});return i?this._returnResult({data:null,error:i}):this._returnResult({data:null,error:null})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}}R.nextInstanceID={};var A=R},1155,[1147,1149,1152,1148,1151,1156,1157,1158,1150,1153,1159,1160]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.memoryLocalStorageAdapter=function(t={}){return{getItem:o=>t[o]||null,setItem:(o,n)=>{t[o]=n},removeItem:o=>{delete t[o]}}}},1156,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"internals",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"LockAcquireTimeoutError",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"NavigatorLockAcquireTimeoutError",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"ProcessLockAcquireTimeoutError",{enumerable:!0,get:function(){return s}}),_e.navigatorLock=async function(e,t,s){o.debug&&console.log('@supabase/gotrue-js: navigatorLock: acquire lock',e,t);const c=new globalThis.AbortController;let l;t>0&&(l=setTimeout(()=>{c.abort(),o.debug&&console.log('@supabase/gotrue-js: navigatorLock acquire timed out',e)},t));await Promise.resolve();try{return await globalThis.navigator.locks.request(e,0===t?{mode:'exclusive',ifAvailable:!0}:{mode:'exclusive',signal:c.signal},async c=>{if(!c){if(0===t)throw o.debug&&console.log('@supabase/gotrue-js: navigatorLock: not immediately available',e),new n(`Acquiring an exclusive Navigator LockManager lock "${e}" immediately failed`);if(o.debug)try{const e=await globalThis.navigator.locks.query();console.log('@supabase/gotrue-js: Navigator LockManager state',JSON.stringify(e,null,' '))}catch(e){console.warn('@supabase/gotrue-js: Error when querying Navigator LockManager state',e)}return console.warn('@supabase/gotrue-js: Navigator LockManager returned a null lock when using #request without ifAvailable set to true, it appears this browser is not following the LockManager spec https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request'),clearTimeout(l),await s()}clearTimeout(l),o.debug&&console.log('@supabase/gotrue-js: navigatorLock: acquired',e,c.name);try{return await s()}finally{o.debug&&console.log('@supabase/gotrue-js: navigatorLock: released',e,c.name)}})}catch(u){if(t>0&&clearTimeout(l),null!==u&&'object'==typeof u&&'name'in u&&'AbortError'===u.name&&t>0){if(c.signal.aborted)return o.debug&&console.log('@supabase/gotrue-js: navigatorLock: acquire timeout, recovering by stealing lock',e),console.warn(`@supabase/gotrue-js: Lock "${e}" was not released within ${t}ms. This may indicate an orphaned lock from a component unmount (e.g., React Strict Mode). Forcefully acquiring the lock to recover.`),await Promise.resolve().then(()=>globalThis.navigator.locks.request(e,{mode:'exclusive',steal:!0},async t=>{if(!t)return console.warn('@supabase/gotrue-js: Navigator LockManager returned null lock even with steal: true'),await s();o.debug&&console.log('@supabase/gotrue-js: navigatorLock: recovered (stolen)',e,t.name);try{return await s()}finally{o.debug&&console.log('@supabase/gotrue-js: navigatorLock: released (stolen)',e,t.name)}}));throw o.debug&&console.log('@supabase/gotrue-js: navigatorLock: lock was stolen by another request',e),new n(`Lock "${e}" was released because another request stole it`)}throw u}},_e.processLock=async function(e,o,n){var l;const u=null!==(l=c[e])&&void 0!==l?l:Promise.resolve(),b=(async()=>{try{return await u,null}catch(e){return null}})(),k=(async()=>{let c=null;try{const t=o>=0?new Promise((t,n)=>{c=setTimeout(()=>{console.warn(`@supabase/gotrue-js: Lock "${e}" acquisition timed out after ${o}ms. This may be caused by another operation holding the lock. Consider increasing lockAcquireTimeout or checking for stuck operations.`),n(new s(`Acquiring process lock with name "${e}" timed out`))},o)}):null;await Promise.race([b,t].filter(e=>e)),null!==c&&clearTimeout(c)}catch(e){if(null!==c&&clearTimeout(c),e instanceof t)throw e}return await n()})();return c[e]=(async()=>{try{return await k}catch(e){if(e instanceof t){try{await u}catch(e){}return null}throw e}})(),await k};var e=r(d[0]);const o={debug:!!(globalThis&&(0,e.supportsLocalStorage)()&&globalThis.localStorage&&'true'===globalThis.localStorage.getItem('supabase.gotrue-js.locks.debug'))};class t extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class n extends t{}class s extends t{}const c={}},1157,[1151]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.polyfillGlobalThis=function(){if('object'==typeof globalThis)return;try{Object.defineProperty(Object.prototype,'__magic__',{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch(e){'undefined'!=typeof self&&(self.globalThis=self)}}},1158,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(t){if(!/^0x[a-fA-F0-9]{40}$/.test(t))throw new Error(`@supabase/auth-js: Address "${t}" is invalid.`);return t.toLowerCase()}Object.defineProperty(e,'__esModule',{value:!0}),e.getAddress=t,e.fromHex=function(t){return parseInt(t,16)},e.toHex=function(t){const n=(new TextEncoder).encode(t);return'0x'+Array.from(n,t=>t.toString(16).padStart(2,'0')).join('')},e.createSiweMessage=function(n){var s;const{chainId:o,domain:u,expirationTime:c,issuedAt:l=new Date,nonce:f,notBefore:I,requestId:v,resources:h,scheme:$,uri:w,version:E}=n;if(!Number.isInteger(o))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${o}`);if(!u)throw new Error("@supabase/auth-js: Invalid SIWE message field \"domain\". Domain must be provided.");if(f&&f.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${f}`);if(!w)throw new Error("@supabase/auth-js: Invalid SIWE message field \"uri\". URI must be provided.");if('1'!==E)throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${E}`);if(null===(s=n.statement)||void 0===s?void 0:s.includes('\n'))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${n.statement}`);const S=t(n.address),b=$?`${$}://${u}`:u,p=n.statement?`${n.statement}\n`:'',j=`${b} wants you to sign in with your Ethereum account:\n${S}\n\n${p}`;let x=`URI: ${w}\nVersion: ${E}\nChain ID: ${o}${f?`\nNonce: ${f}`:''}\nIssued At: ${l.toISOString()}`;c&&(x+=`\nExpiration Time: ${c.toISOString()}`);I&&(x+=`\nNot Before: ${I.toISOString()}`);v&&(x+=`\nRequest ID: ${v}`);if(h){let t='\nResources:';for(const n of h){if(!n||'string'!=typeof n)throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${n}`);t+=`\n- ${n}`}x+=t}return`${j}\n${x}`}},1159,[]); +__d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"WebAuthnError",{enumerable:!0,get:function(){return l.WebAuthnError}}),Object.defineProperty(e,"isWebAuthnError",{enumerable:!0,get:function(){return l.isWebAuthnError}}),Object.defineProperty(e,"identifyRegistrationError",{enumerable:!0,get:function(){return l.identifyRegistrationError}}),Object.defineProperty(e,"identifyAuthenticationError",{enumerable:!0,get:function(){return l.identifyAuthenticationError}}),Object.defineProperty(e,"WebAuthnAbortService",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"webAuthnAbortService",{enumerable:!0,get:function(){return u}}),e.deserializeCredentialCreationOptions=function(i){if(!i)throw new Error('Credential creation options are required');if('undefined'!=typeof PublicKeyCredential&&'parseCreationOptionsFromJSON'in PublicKeyCredential&&'function'==typeof PublicKeyCredential.parseCreationOptionsFromJSON)return PublicKeyCredential.parseCreationOptionsFromJSON(i);const{challenge:o,user:l,excludeCredentials:s}=i,u=(0,t.__rest)(i,["challenge","user","excludeCredentials"]),c=(0,n.base64UrlToUint8Array)(o).buffer,f=Object.assign(Object.assign({},l),{id:(0,n.base64UrlToUint8Array)(l.id).buffer}),h=Object.assign(Object.assign({},u),{challenge:c,user:f});if(s&&s.length>0){h.excludeCredentials=new Array(s.length);for(let t=0;t0){c.allowCredentials=new Array(l.length);for(let t=0;tnull!==t&&'object'==typeof t&&!Array.isArray(t),i=t=>t instanceof ArrayBuffer||ArrayBuffer.isView(t),o={};for(const l of t)if(l)for(const t in l){const s=l[t];if(void 0!==s)if(Array.isArray(s))o[t]=s;else if(i(s))o[t]=s;else if(n(s)){const i=o[t];n(i)?o[t]=p(i,s):o[t]=p(s)}else o[t]=s}return o}function w(t,n){return p(b,t,n||{})}function A(t,n){return p(y,t,n||{})}class O{constructor(t){this.client=t,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(t){return this.client.mfa.enroll(Object.assign(Object.assign({},t),{factorType:'webauthn'}))}async _challenge({factorId:t,webauthn:n,friendlyName:o,signal:l},s){var c;try{const{data:i,error:b}=await this.client.mfa.challenge({factorId:t,webauthn:n});if(!i)return{data:null,error:b};const y=null!=l?l:u.createNewAbortSignal();if('create'===i.webauthn.type){const{user:t}=i.webauthn.credential_options.publicKey;if(!t.name){const n=o;if(n)t.name=`${t.id}:${n}`;else{const n=(await this.client.getUser()).data.user,i=(null===(c=null==n?void 0:n.user_metadata)||void 0===c?void 0:c.name)||(null==n?void 0:n.email)||(null==n?void 0:n.id)||'User';t.name=`${t.id}:${i}`}}t.displayName||(t.displayName=t.name)}switch(i.webauthn.type){case'create':{const n=w(i.webauthn.credential_options.publicKey,null==s?void 0:s.create),{data:o,error:l}=await f({publicKey:n,signal:y});return o?{data:{factorId:t,challengeId:i.id,webauthn:{type:i.webauthn.type,credential_response:o}},error:null}:{data:null,error:l}}case'request':{const n=A(i.webauthn.credential_options.publicKey,null==s?void 0:s.request),{data:o,error:l}=await h(Object.assign(Object.assign({},i.webauthn.credential_options),{publicKey:n,signal:y}));return o?{data:{factorId:t,challengeId:i.id,webauthn:{type:i.webauthn.type,credential_response:o}},error:null}:{data:null,error:l}}}}catch(t){return(0,i.isAuthError)(t)?{data:null,error:t}:{data:null,error:new i.AuthUnknownError('Unexpected error in challenge',t)}}}async _verify({challengeId:t,factorId:n,webauthn:i}){return this.client.mfa.verify({factorId:n,challengeId:t,webauthn:i})}async _authenticate({factorId:t,webauthn:{rpId:n=('undefined'!=typeof window?window.location.hostname:void 0),rpOrigins:o=('undefined'!=typeof window?[window.location.origin]:void 0),signal:l}={}},s){if(!n)return{data:null,error:new i.AuthError('rpId is required for WebAuthn authentication')};try{if(!c())return{data:null,error:new i.AuthUnknownError('Browser does not support WebAuthn',null)};const{data:u,error:f}=await this.challenge({factorId:t,webauthn:{rpId:n,rpOrigins:o},signal:l},{request:s});if(!u)return{data:null,error:f};const{webauthn:h}=u;return this._verify({factorId:t,challengeId:u.challengeId,webauthn:{type:h.type,rpId:n,rpOrigins:o,credential_response:h.credential_response}})}catch(t){return(0,i.isAuthError)(t)?{data:null,error:t}:{data:null,error:new i.AuthUnknownError('Unexpected error in authenticate',t)}}}async _register({friendlyName:t,webauthn:{rpId:n=('undefined'!=typeof window?window.location.hostname:void 0),rpOrigins:o=('undefined'!=typeof window?[window.location.origin]:void 0),signal:l}={}},s){if(!n)return{data:null,error:new i.AuthError('rpId is required for WebAuthn registration')};try{if(!c())return{data:null,error:new i.AuthUnknownError('Browser does not support WebAuthn',null)};const{data:u,error:f}=await this._enroll({friendlyName:t});if(!u)return await this.client.mfa.listFactors().then(n=>{var i;return null===(i=n.data)||void 0===i?void 0:i.all.find(n=>'webauthn'===n.factor_type&&n.friendly_name===t&&'unverified'!==n.status)}).then(t=>t?this.client.mfa.unenroll({factorId:null==t?void 0:t.id}):void 0),{data:null,error:f};const{data:h,error:b}=await this._challenge({factorId:u.id,friendlyName:u.friendly_name,webauthn:{rpId:n,rpOrigins:o},signal:l},{create:s});return h?this._verify({factorId:u.id,challengeId:h.challengeId,webauthn:{rpId:n,rpOrigins:o,type:h.webauthn.type,credential_response:h.webauthn.credential_response}}):{data:null,error:b}}catch(t){return(0,i.isAuthError)(t)?{data:null,error:t}:{data:null,error:new i.AuthUnknownError('Unexpected error in register',t)}}}}},1160,[1125,1153,1152,1151,1161]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"WebAuthnError",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"WebAuthnUnknownError",{enumerable:!0,get:function(){return t}}),e.isWebAuthnError=function(n){return'object'==typeof n&&null!==n&&'__isWebAuthnError'in n},e.identifyRegistrationError=function({error:t,options:s}){var u,c,R;const{publicKey:E}=s;if(!E)throw Error('options was missing required publicKey property');if('AbortError'===t.name){if(s.signal instanceof AbortSignal)return new o({message:'Registration ceremony was sent an abort signal',code:'ERROR_CEREMONY_ABORTED',cause:t})}else if('ConstraintError'===t.name){if(!0===(null===(u=E.authenticatorSelection)||void 0===u?void 0:u.requireResidentKey))return new o({message:'Discoverable credentials were required but no available authenticator supported it',code:'ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT',cause:t});if('conditional'===s.mediation&&'required'===(null===(c=E.authenticatorSelection)||void 0===c?void 0:c.userVerification))return new o({message:'User verification was required during automatic registration but it could not be performed',code:'ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE',cause:t});if('required'===(null===(R=E.authenticatorSelection)||void 0===R?void 0:R.userVerification))return new o({message:'User verification was required but no available authenticator supported it',code:'ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT',cause:t})}else{if('InvalidStateError'===t.name)return new o({message:'The authenticator was previously registered',code:'ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED',cause:t});if('NotAllowedError'===t.name)return new o({message:t.message,code:'ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY',cause:t});if('NotSupportedError'===t.name){return 0===E.pubKeyCredParams.filter(n=>'public-key'===n.type).length?new o({message:'No entry in pubKeyCredParams was of type "public-key"',code:'ERROR_MALFORMED_PUBKEYCREDPARAMS',cause:t}):new o({message:'No available authenticator supported any of the specified pubKeyCredParams algorithms',code:'ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG',cause:t})}if('SecurityError'===t.name){const s=window.location.hostname;if(!(0,n.isValidDomain)(s))return new o({message:`${window.location.hostname} is an invalid domain`,code:'ERROR_INVALID_DOMAIN',cause:t});if(E.rp.id!==s)return new o({message:`The RP ID "${E.rp.id}" is invalid for this domain`,code:'ERROR_INVALID_RP_ID',cause:t})}else if('TypeError'===t.name){if(E.user.id.byteLength<1||E.user.id.byteLength>64)return new o({message:'User ID was not between 1 and 64 characters',code:'ERROR_INVALID_USER_ID_LENGTH',cause:t})}else if('UnknownError'===t.name)return new o({message:'The authenticator was unable to process the specified options, or could not create a new credential',code:'ERROR_AUTHENTICATOR_GENERAL_ERROR',cause:t})}return new o({message:'a Non-Webauthn related error has occurred',code:'ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY',cause:t})},e.identifyAuthenticationError=function({error:t,options:s}){const{publicKey:u}=s;if(!u)throw Error('options was missing required publicKey property');if('AbortError'===t.name){if(s.signal instanceof AbortSignal)return new o({message:'Authentication ceremony was sent an abort signal',code:'ERROR_CEREMONY_ABORTED',cause:t})}else{if('NotAllowedError'===t.name)return new o({message:t.message,code:'ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY',cause:t});if('SecurityError'===t.name){const s=window.location.hostname;if(!(0,n.isValidDomain)(s))return new o({message:`${window.location.hostname} is an invalid domain`,code:'ERROR_INVALID_DOMAIN',cause:t});if(u.rpId!==s)return new o({message:`The RP ID "${u.rpId}" is invalid for this domain`,code:'ERROR_INVALID_RP_ID',cause:t})}else if('UnknownError'===t.name)return new o({message:'The authenticator was unable to process the specified options, or could not create a new assertion signature',code:'ERROR_AUTHENTICATOR_GENERAL_ERROR',cause:t})}return new o({message:'a Non-Webauthn related error has occurred',code:'ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY',cause:t})};var n=r(d[0]);class o extends Error{constructor({message:n,code:o,cause:t,name:s}){var u;super(n,{cause:t}),this.__isWebAuthnError=!0,this.name=null!==(u=null!=s?s:t instanceof Error?t.name:void 0)&&void 0!==u?u:'Unknown Error',this.code=o}toJSON(){return{name:this.name,message:this.message,code:this.code}}}class t extends o{constructor(n,o){super({code:'ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY',cause:o,message:n}),this.name='WebAuthnUnknownError',this.originalError=o}}},1161,[1160]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u}});var e,t=r(d[0]);var u=((e=t)&&e.__esModule?e:{default:e}).default},1162,[1147]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u}});var e,t=r(d[0]);var u=((e=t)&&e.__esModule?e:{default:e}).default},1163,[1155]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.setSyncNamespace=function(e){s=t.IS_ISOLATED_VENUE?`cc-sync:${t.VENUE_RID}:${e}:`:`cc-sync:${e}:`},Object.defineProperty(_e,"syncNamespace",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"kv",{enumerable:!0,get:function(){return i}}),_e.uuid=function(){const e=globalThis.crypto;if(e?.randomUUID)return e.randomUUID();const t=new Uint8Array(16);if(e?.getRandomValues)e.getRandomValues(t);else for(let e=0;e<16;e++)t[e]=Math.floor(256*Math.random());t[6]=15&t[6]|64,t[8]=63&t[8]|128;const n=Array.from(t,e=>e.toString(16).padStart(2,'0')).join('');return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20)}`};var e,t=r(d[0]),n=r(d[1]),c=(e=n)&&e.__esModule?e:{default:e};let s=t.IS_ISOLATED_VENUE?`cc-sync:${t.VENUE_RID}:`:'cc-sync:';const o=()=>s,i={async get(e,t){try{const n=await c.default.getItem(s+e);return null==n?t:JSON.parse(n)}catch{return t}},async set(e,t){try{await c.default.setItem(s+e,JSON.stringify(t))}catch{}},async remove(e){try{await c.default.removeItem(s+e)}catch{}}}},1164,[5,1082]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"isOnline",{enumerable:!0,get:function(){return t}}),_e.setOnline=o,_e.onConnectivity=function(e){return n.add(e),()=>{n.delete(e)}},_e.isNetworkError=function(e){if(!e)return!1;const n=String(e.message??e).toLowerCase();return 0===e.status||/network|fetch failed|failed to fetch|timeout|timed out|offline|econn|enotfound|socket/.test(n)};let e=!0;const n=new Set,t=()=>e;function o(t){t!==e&&(e=t,n.forEach(n=>n(e)))}const s=globalThis.window;s?.addEventListener&&('boolean'==typeof s.navigator?.onLine&&(e=s.navigator.onLine),s.addEventListener('online',()=>o(!0)),s.addEventListener('offline',()=>o(!1)))},1165,[]); +__d(function(g,_r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TableRepository",{enumerable:!0,get:function(){return u}}),e.executeMutation=async function(t){const s=(t,s)=>{throw Object.assign(t,{status:s})};if('rpc'===t.kind){const{error:n,status:r}=await o().rpc(t.fn,t.values??{});return n&&s(n,r),'ok'}const n=o().from(t.table);if('upsert'===t.kind||'insert'===t.kind){const{error:r,status:o}=await n.upsert(t.values??{},{onConflict:t.conflictKey??'id',ignoreDuplicates:'insert'===t.kind});return r&&s(r,o),'ok'}let r='update'===t.kind?n.update(t.values??{}):n.delete();for(const[s,n]of Object.entries(t.match??{}))r=r.eq(s,n);const{data:u,error:c,status:h}=await r.select();c&&s(c,h);return'update'!==t.kind||u&&0!==u.length?'ok':'conflict'};var t=_r(d[0]),s=_r(d[1]),n=_r(d[2]),r=_r(d[3]);const o=()=>(0,s.getSupabase)();class u{constructor(t,s={}){this.table=t,this.opts=s,this.keyOf=s.keyOf??(t=>String(t.id)),this.keyColumns=s.keyColumns??['id'],this.venueCol=s.venueColumn??'venue_id'}rows(s){return t.cache.rows(this.table,s)}get(s,n){return t.cache.get(this.table,s,n)}subscribe(s,n){return t.cache.subscribe(this.table,s,n)}hydrate(s){return t.cache.hydrate(this.table,s)}async refresh(s,n={}){let u=o().from(this.table).select('*').eq(this.venueCol,s);this.opts.orderBy&&(u=u.order(this.opts.orderBy.column,{ascending:this.opts.orderBy.ascending??!0})),n.filter&&(u=n.filter(u));const{data:c,error:h}=await u.limit(this.opts.limit??1e3);if(h)throw h;const l=c??[];return t.cache.replace(this.table,s,l.map(t=>[this.keyOf(t),t]),t=>r.mutationQueue.hasPending(this.table,s,t)),l}async create(s,o){const u={...1===this.keyColumns.length&&'id'===this.keyColumns[0]?{id:(0,n.uuid)()}:{},...o,[this.venueCol]:s},c=this.keyOf(u);return t.cache.put(this.table,s,c,u),await r.mutationQueue.enqueue({table:this.table,venueId:s,kind:'insert'===this.opts.writeMode?'insert':'upsert',rowKey:c,values:u,conflictKey:this.opts.conflictKey??'id'}),u}async update(s,n,o,u={}){const c=t.cache.get(this.table,s,n),h={...this.matchFor(n,c),...u,[this.venueCol]:s};t.cache.patch(this.table,s,n,{...o,updated_at:(new Date).toISOString()}),await r.mutationQueue.enqueue({table:this.table,venueId:s,kind:'update',rowKey:n,values:o,match:h})}async remove(s,n){const o=t.cache.get(this.table,s,n),u={...this.matchFor(n,o),[this.venueCol]:s};t.cache.remove(this.table,s,n),await r.mutationQueue.enqueue({table:this.table,venueId:s,kind:'delete',rowKey:n,match:u})}matchFor(t,s){if(1===this.keyColumns.length&&'id'===this.keyColumns[0])return{id:t};const n={};for(const t of this.keyColumns)n[t]=s?.[t];return n}}},1166,[1167,863,1164,1078]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"cache",{enumerable:!0,get:function(){return w}});var t=r(d[0]);const n=new Map,s=new Map,c=new Map,o=new Map,u=new Set,l=(t,n)=>`cache:${t}:${n}`;function f(t){let s=n.get(t);return s||(s=new Map,n.set(t,s)),s}function p(n){s.delete(n),c.get(n)?.forEach(t=>t());const u=o.get(n);u&&clearTimeout(u),o.set(n,setTimeout(()=>{o.delete(n),t.kv.set(n,Array.from(f(n).entries()))},250))}const w={async hydrate(n,s){const c=l(n,s);if(u.has(c))return;u.add(c);const o=await t.kv.get(c,[]),w=f(c);let h=0;for(const[t,n]of o)w.has(t)||(w.set(t,n),h++);h&&p(c)},rows(t,n){const c=l(t,n);let o=s.get(c);return o||(o=Array.from(f(c).values()),s.set(c,o)),o},get:(t,n,s)=>f(l(t,n)).get(s),put(t,n,s,c){f(l(t,n)).set(s,c),p(l(t,n))},patch(t,n,s,c){const o=f(l(t,n)),u=o.get(s);u&&(o.set(s,{...u,...c}),p(l(t,n)))},remove(t,n,s){f(l(t,n)).delete(s)&&p(l(t,n))},replace(t,s,c,o=()=>!1){const u=l(t,s),w=f(u),h=new Map(c);w.forEach((t,n)=>{o(n)&&h.set(n,t)}),n.set(u,h),p(u)},subscribe(t,n,s){const o=l(t,n);let u=c.get(o);return u||(u=new Set,c.set(o,u)),u.add(s),()=>{u?.delete(s)}},async clearVenue(o,f){for(const p of f){const f=l(p,o);n.delete(f),s.delete(f),u.delete(f),await t.kv.remove(f),c.get(f)?.forEach(t=>t())}}}},1167,[1164]); +__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.classifyWriteError=function(o){if((0,e.isNetworkError)(o))return'network';const{code:n,status:c,msg:l}=t(o);return s(o)?'refused':/^(08|53|57|58)/.test(n)||['40001','40P01','55P03','23505','23503'].includes(n)||/^PGRST30[0-3]$/.test(n)||/jwt|token.*expired/i.test(l)||401===c||408===c||425===c||429===c||c>=500?'retry':409!==c||n?'refused':'retry'},Object.defineProperty(_e,"retryDelayMs",{enumerable:!0,get:function(){return o}}),_e.describeWrite=function(e){const t='rpc'===e.kind?(e.fn??'change').replace(/_/g,' '):n[e.table]??e.table.replace(/_/g,' ').replace(/s$/,''),s=e.values??{},o=s.guest_name??s.name??s.display_name??s.title??s.reason,c='string'==typeof o&&o.trim()?` for ${o.trim().slice(0,60)}`:'';return'delete'===e.kind?`deleting a ${t}${c}`:`the ${t}${c}`},_e.plainReason=function(e,o){const{code:n,status:c,msg:l}=t(e);if('refused'===o)return s(e)?'more than 20 deletes in 10 minutes from one sign-in are stopped to keep your data safe':'42501'===n||403===c||/row-level security|permission/i.test(l)?'your sign-in isn\u2019t allowed to change this':'conflict'===n?'it was changed or removed on another device first':/^(22|23)/.test(n)?'the shared system says some of the details aren\u2019t valid':'P0001'===n&&l?l.slice(0,140):l?`the shared system said: ${l.slice(0,120)}`:'the shared system refused it';return'23505'===n?'the shared system already has another copy of it':'23503'===n?'a related change has to save first':/^PGRST30/.test(n)||401===c||/jwt/i.test(l)?'your sign-in is being refreshed':'the shared system is busy'};var e=r(d[0]);const t=e=>{const t=e&&'object'==typeof e?e:{};return{msg:String(t.message??e??''),code:String(t.code??''),status:Number(t.status??0)||0,hint:String(t.hint??'')}},s=e=>{const s=t(e);return/delete guard/i.test(s.hint)||/too many .* deleted in 10 minutes/i.test(s.msg)};const o=e=>Math.min(5e3*Math.pow(3,Math.max(0,e-1)),3e5),n={bookings:'booking',walk_ins:'walk-in',blocks:'blocked time',sold_out_items:'sold-out mark',sold_out_links:'dish stock link',staff:'staff details',rota_shifts:'rota shift',stock_items:'stock item',stock_events:'stock count',stock_counts:'stock count',chat_messages:'chat message',recipe_cards:'recipe card',order_lists:'order list',order_list_items:'order list item',daily_task_ticks:'task tick',daily_tasks:'daily task',attendance:'clock in or out',cash_ups:'cash-up',table_plans:'table plan',guest_profiles:'guest profile',floor_live:'table status',venues:'venue settings',time_requests:'time-off request',scheduled_notifications:'reminder',suppliers:'supplier',supplier_orders:'supplier order',takeaway_orders:'takeaway order'}},1168,[1165]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useAvatars",{enumerable:!0,get:function(){return l}});var t,e=r(d[0]),o=(t=e)&&t.__esModule?t:{default:t},s=r(d[1]),n=r(d[2]);const l=(0,s.create)()((0,n.persist)((t,e)=>({photos:{},log:[],setOwn:(e,o,s,n)=>{if(!e||e!==o||!s.startsWith('data:image/'))return!1;const l=(new Date).toISOString();return t(t=>({photos:{...t.photos,[o]:{dataUrl:s,at:l}},log:[{id:`av-${Date.now().toString(36)}`,staffId:o,what:'made',by:n,at:l},...t.log].slice(0,100)})),!0},reset:(o,s)=>{if(s.id!==o&&'staff'===s.role)return!1;if(!e().photos[o])return!1;const n={...e().photos};return delete n[o],t(t=>({photos:n,log:[{id:`av-${Date.now().toString(36)}`,staffId:o,what:'reset',by:s.name,at:(new Date).toISOString()},...t.log].slice(0,100)})),!0}}),{name:'covercharge-avatars-v1',storage:(0,n.createJSONStorage)(()=>o.default),version:1}))},1169,[1082,952,1091]); +__d(function(_g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"SETUP_STEPS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"ACCESS_LEVELS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"ACCESS_ROLE",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"ACCESS_APP",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"accessOf",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"PERMS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"DEFAULT_PERMS",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"DEFAULT_GRADES",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"useSetup",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"useSiteSetup",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"setupProgress",{enumerable:!0,get:function(){return w}});var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},i=r(d[1]),s=r(d[2]);const o=[{id:'venue',title:'Venue details & logo',sub:'Name, address, phone, your logo and order at table'},{id:'hours',title:'Opening hours',sub:'When the kitchen is open each day'},{id:'plan',title:'Areas & table plan',sub:'Your areas, tables and seats'},{id:'paygrades',title:'Pay grades',sub:'Named hourly rates for your team'},{id:'staff',title:'Add staff',sub:'Name, role, access, pay and avatar'},{id:'permissions',title:'Permissions',sub:'What each access level can do'},{id:'email',title:'Link email',sub:'Your work email address'},{id:'website',title:'Link website',sub:'Your website and booking link'},{id:'invites',title:'Staff invite links',sub:'Personal links for each person'}],l=['Owner','Manager','Supervisor','Head Chef','Staff'],u={Owner:'owner',Manager:'manager',Supervisor:'manager','Head Chef':'staff',Staff:'staff'},c={Owner:'Managers',Manager:'Managers',Supervisor:'Managers','Head Chef':'Head Chef',Staff:'Staff'},f=(e,t)=>l.includes(e??'')?e:'owner'===t?'Owner':'manager'===t?'Manager':'Staff',b=[{id:'bookings',label:'Take and change bookings'},{id:'walkins',label:'Seat walk-ins'},{id:'block',label:'Block bookings and close the garden'},{id:'tableplan',label:'Edit the table plan'},{id:'kitchen',label:'Kitchen tickets and allergy ticks'},{id:'menu',label:'Edit the menu and allergens'},{id:'rota',label:'Make the rota'},{id:'timesheets',label:'Approve timesheets'},{id:'pay',label:'See pay and wages'},{id:'takings',label:'See takings and reports'},{id:'staff',label:'Add staff and change access'},{id:'settings',label:'Change venue settings'},{id:'billing',label:'Plan and billing'}],p=e=>Object.fromEntries(b.map(t=>[t.id,e])),g=e=>({...p(!1),...Object.fromEntries(e.map(e=>[e,!0]))}),h={Owner:p(!0),Manager:{...p(!0),staff:!1,billing:!1},Supervisor:g(['bookings','walkins','block','tableplan','kitchen','rota']),'Head Chef':g(['kitchen','menu','rota']),Staff:g(['bookings','walkins'])},S=[{id:'pg-foh',name:'Front of house',pence:1271},{id:'pg-bar',name:'Bar team',pence:1271},{id:'pg-kp',name:'Kitchen porter',pence:1271},{id:'pg-cdp',name:'Chef de partie',pence:1450},{id:'pg-sup',name:'Supervisor',pence:1400}],k=()=>({done:{},grades:S.map(e=>({...e})),staffGrade:{},perms:JSON.parse(JSON.stringify(h)),email:'',website:'',bookingUrl:'',invites:{}}),O=(0,i.create)()((0,s.persist)((e,t)=>({sites:{},looks:{},patch:(t,n)=>e(e=>({sites:{...e.sites,[t]:{...e.sites[t]??k(),...n}}})),markDone:(e,n,i=!0)=>{const s={...(t().sites[e]??k()).done};i?s[n]=(new Date).toISOString():delete s[n],t().patch(e,{done:s})},setPerm:(e,n,i,s)=>{const o=t().sites[e]??k();'Owner'!==n&&t().patch(e,{perms:{...o.perms,[n]:{...o.perms[n],[i]:s}}})},resetPerms:e=>t().patch(e,{perms:JSON.parse(JSON.stringify(h))}),setLook:(t,n)=>e(e=>{const i={...e.looks};return null==n?delete i[t]:i[t]=n,{looks:i}})}),{name:'covercharge-setup-v1',storage:(0,s.createJSONStorage)(()=>n.default),version:1})),P=e=>O(t=>t.sites[e])??y,y=k(),w=e=>{const t=o.filter(t=>e.done[t.id]).length;return{done:t,total:o.length,pct:t/o.length}}},1170,[1082,952,1091]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"SEED_INGREDIENTS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"SEED_RECIPES",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"WASTE_REASONS",{enumerable:!0,get:function(){return f}}),_e.stripKitchenExamples=S,Object.defineProperty(_e,"useKitchen",{enumerable:!0,get:function(){return w}});var e,t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),n=_r(_d[3]),r=_r(_d[4]),o=_r(_d[5]),d=(e=o)&&e.__esModule?e:{default:e},c=_r(_d[6]),l=_r(_d[7]);const p=(e,t,s,i,n,r,o,d=[],c)=>({id:e,name:t,unit:s,cost:i,supplierId:n,par:r,onHand:o,allergens:d,prevCost:c}),u=[p('haddock','Haddock fillet','kg',1848,'sup-1',14,9.5,['fish'],1650),p('smk-haddock','Smoked haddock','kg',1500,'sup-1',4,3.2,['fish']),p('smk-salmon','Smoked salmon','kg',2800,'sup-1',3,1.1,['fish']),p('crab','White and brown crab meat','kg',3800,'sup-1',3,2.4,['crustaceans']),p('mussels','Rope mussels','kg',450,'sup-1',12,0,['molluscs']),p('langoustine','Langoustines','kg',2600,'sup-1',6,4.5,['crustaceans']),p('lobster','Lobster (whole)','each',1800,'sup-1',6,4,['crustaceans']),p('prawns','Prawns (cooked, peeled)','kg',1400,'sup-1',3,2.6,['crustaceans']),p('beef-fillet','Beef fillet','kg',4800,'sup-2',4,2.9),p('steak','Braising steak','kg',1200,'sup-2',8,6.2),p('patty','Burger patty 6 oz','each',160,'sup-2',40,18),p('chicken','Chicken breast','kg',950,'sup-2',10,7.5),p('chorizo','Chorizo','kg',1400,'sup-2',2,1.6,['sulphites']),p('haggis','Haggis','kg',900,'sup-2',4,3.5,['gluten','celery']),p('potatoes','Potatoes (chipping)','kg',90,'sup-3',75,40),p('onions','Onions','kg',110,'sup-3',15,11),p('leaves','Salad leaves','kg',700,'sup-3',3,.8),p('lemons','Lemons','each',25,'sup-3',60,44),p('milk','Whole milk','L',110,'sup-4',20,14,['milk']),p('cream','Double cream','L',380,'sup-4',12,9,['milk']),p('butter','Butter','kg',850,'sup-4',6,4.5,['milk']),p('cheddar','Mature cheddar','kg',900,'sup-4',5,3.8,['milk']),p('parmesan','Parmesan','kg',1800,'sup-4',2,1.4,['milk']),p('eggs','Free-range eggs','each',28,'sup-4',120,90,['eggs']),p('ice-cream','Vanilla ice cream','L',450,'sup-4',10,7,['milk','eggs']),p('flour','Plain flour','kg',90,'sup-5',16,12,['gluten']),p('batter','Beer batter mix','kg',220,'sup-5',12,3.5,['gluten']),p('pastry','Puff pastry','kg',450,'sup-5',6,4.2,['gluten','milk']),p('macaroni','Macaroni','kg',180,'sup-5',6,5,['gluten']),p('penne','Penne','kg',180,'sup-5',6,4.5,['gluten']),p('buns','Brioche buns','each',45,'sup-5',40,30,['gluten','eggs','milk','sesame']),p('baguette','Garlic baguette','each',90,'sup-5',24,16,['gluten','milk']),p('oil','Rapeseed oil (fryer)','L',200,'sup-5',60,32),p('sponge','Sticky toffee sponge (portion)','each',95,'sup-5',30,22,['gluten','eggs','milk']),p('truffle-oil','Truffle oil','L',3e3,'sup-5',1,.6)],k=(e,t,s)=>({dishId:e,yield:t,lines:s.map(([e,t])=>({ing:e,qty:t}))}),h=[k('a-fishsupper','1 portion (220 g fillet)',[['haddock',.22],['batter',.06],['potatoes',.35],['oil',.05],['lemons',1]]),k('a-skink','1 bowl',[['smk-haddock',.08],['potatoes',.1],['milk',.15],['cream',.05],['onions',.03],['butter',.01]]),k('a-salmon','1 plate',[['smk-salmon',.07],['cream',.03],['leaves',.02],['lemons',1]]),k('a-haggis','1 plate',[['haggis',.1],['flour',.02],['eggs',1],['oil',.03]]),k('a-crabcakes','2 cakes',[['crab',.08],['potatoes',.06],['flour',.02],['eggs',1],['leaves',.02]]),k('a-tempura','1 plate',[['haddock',.07],['prawns',.05],['onions',.05],['batter',.06],['oil',.04],['lemons',1]]),k('a-mini','Kids fish & chips + ice cream',[['haddock',.1],['potatoes',.2],['batter',.03],['oil',.03],['ice-cream',.05]]),k('a-pie','1 pie',[['steak',.22],['pastry',.08],['onions',.05],['potatoes',.3],['oil',.03]]),k('a-chicken','1 plate',[['chicken',.22],['potatoes',.25],['cream',.05],['butter',.02]]),k('a-maccheese','1 bowl',[['macaroni',.12],['cheddar',.08],['milk',.2],['butter',.02],['flour',.015]]),k('a-penne','1 bowl',[['penne',.12],['chicken',.15],['chorizo',.04],['cream',.08],['parmesan',.01]]),k('a-caesar','1 plate',[['chicken',.16],['leaves',.08],['parmesan',.015],['eggs',1],['baguette',.25]]),k('a-moules','1 pot',[['mussels',.5],['cream',.08],['onions',.03],['baguette',.5]]),k('a-fillet','8 oz steak',[['beef-fillet',.227],['potatoes',.35],['onions',.05],['oil',.05],['butter',.02]]),k('a-claymore','1 burger',[['patty',1],['buns',1],['cheddar',.03],['potatoes',.3],['onions',.06],['batter',.03],['oil',.05]]),k('a-langoustines','1 plate',[['langoustine',.35],['butter',.03],['baguette',.5],['leaves',.03],['lemons',1]]),k('a-lobster','1 lobster',[['lobster',1],['butter',.04],['potatoes',.3],['oil',.04],['leaves',.03],['lemons',1]]),k('a-smorgasbord','Serves one',[['langoustine',.3],['mussels',.3],['crab',.08],['prawns',.1],['smk-salmon',.06],['leaves',.05],['lemons',2]]),k('a-deluxe','Serves two',[['lobster',1],['langoustine',.5],['crab',.15],['mussels',.5],['prawns',.15],['smk-salmon',.1],['leaves',.1],['lemons',3],['baguette',1]]),k('a-chips','1 side',[['potatoes',.35],['oil',.05]]),k('a-onionrings','1 side',[['onions',.15],['batter',.06],['oil',.04]]),k('a-garlicbread','1 side',[['baguette',.5],['butter',.02]]),k('a-truffle','1 side',[['potatoes',.35],['oil',.05],['parmesan',.015],['truffle-oil',.005]]),k('a-salad','1 side',[['leaves',.06],['lemons',.5]]),k('a-stp','1 portion',[['sponge',1],['cream',.05],['butter',.02],['ice-cream',.08]])],f=['Out of date','Spoiled','Over-production','Dropped / burnt','Returned by customer','Prep trim'],b=(e,t=10)=>{const s=new Date;return s.setDate(s.getDate()-e),s.setHours(t,0,0,0),s.toISOString()},y=e=>`${e}-${Math.random().toString(36).slice(2,8)}`;function v(){return{ingredients:u.map(e=>({...e})),recipes:h,targetGp:70,deliveries:[{id:'dl-today-fish',supplierId:'sup-1',due:'today',status:'expected',lines:[{ing:'haddock',ordered:10,received:8,price:1848},{ing:'mussels',ordered:12,received:12,price:450},{ing:'langoustine',ordered:3,received:3,price:2750},{ing:'smk-salmon',ordered:2,received:2,price:2800}]},{id:'dl-today-veg',supplierId:'sup-3',due:'today',status:'expected',lines:[{ing:'potatoes',ordered:50,received:50,price:90},{ing:'leaves',ordered:3,received:2,price:700},{ing:'lemons',ordered:30,received:30,price:25}]}],stockTakes:[{id:'stk-1',at:b(7,22),by:'Head Chef (example)',lines:[{ing:'haddock',expected:6,counted:5.4,cost:1650},{ing:'potatoes',expected:30,counted:28,cost:90},{ing:'cream',expected:8,counted:8,cost:380},{ing:'beef-fillet',expected:3.2,counted:3,cost:4800}]}],waste:[{id:'w1',at:b(1,21),by:'Head Chef (example)',item:'Haddock fillet',ing:'haddock',qty:.6,unit:'kg',reason:'Over-production',cost:1109},{id:'w2',at:b(2,15),by:'Head Chef (example)',item:'Salad leaves',ing:'leaves',qty:.5,unit:'kg',reason:'Spoiled',cost:350},{id:'w3',at:b(3,20),by:'Head Chef (example)',item:'Fish supper',qty:1,unit:'portion',reason:'Dropped / burnt',cost:517},{id:'w4',at:b(4,11),by:'Head Chef (example)',item:'Double cream',ing:'cream',qty:1,unit:'L',reason:'Out of date',cost:380},{id:'w5',at:b(5,22),by:'Head Chef (example)',item:'Chips',ing:'potatoes',qty:3,unit:'kg',reason:'Over-production',cost:270}],orders:[{id:'po-1',supplierId:'sup-1',at:b(1,13),by:'Head Chef (example)',status:'placed (by phone)',lines:[{ing:'haddock',qty:10,cost:1848},{ing:'mussels',qty:12,cost:450},{ing:'langoustine',qty:3,cost:2600},{ing:'smk-salmon',qty:2,cost:2800}],total:30520},{id:'po-2',supplierId:'sup-3',at:b(1,18),by:'Head Chef (example)',status:'placed (on website)',lines:[{ing:'potatoes',qty:50,cost:90},{ing:'leaves',qty:3,cost:700},{ing:'lemons',qty:30,cost:25}],total:7350}],prepTicks:{},temps:[{id:'t1',at:b(0,9),by:'Head Chef (example)',kind:'fridge',unit:'Walk-in fridge',temp:3},{id:'t2',at:b(0,9),by:'Head Chef (example)',kind:'freezer',unit:'Chest freezer',temp:-20}]}}function S(e){const t=v(),s=(e,t)=>t.some(t=>JSON.stringify(t)===JSON.stringify(e)),i=e.recipes.filter(e=>!s(e,t.recipes)),r=e.deliveries.filter(e=>!t.deliveries.some(t=>t.id===e.id&&t.supplierId===e.supplierId&&t.due===e.due&&'expected'===e.status&&!e.checkedBy&&!e.note&&JSON.stringify(t.lines)===JSON.stringify(e.lines))),o=e.stockTakes.filter(e=>!(0,n.demoActor)(e.by)),d=e.waste.filter(e=>!(0,n.demoActor)(e.by)),c=e.orders.filter(e=>!(0,n.demoActor)(e.by)),l=e.temps.filter(e=>!(0,n.demoActor)(e.by)),p=new Set([...i,...r,...o,...c].flatMap(e=>e.lines.map(e=>e.ing)));return d.forEach(e=>{e.ing&&p.add(e.ing)}),{ingredients:e.ingredients.filter(e=>p.has(e.id)||!s(e,t.ingredients)),recipes:i,deliveries:r,stockTakes:o,waste:d,orders:c,temps:l}}const w=(0,c.create)()((0,l.persist)(e=>({...r.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD?{targetGp:70,ingredients:[],recipes:[],deliveries:[],stockTakes:[],waste:[],orders:[],prepTicks:{},temps:[]}:v(),setTarget:t=>e({targetGp:Math.max(40,Math.min(90,Math.round(t)))}),setIngredient:(t,s)=>e(e=>({ingredients:e.ingredients.map(e=>e.id===t?{...e,...s}:e)})),setRecipeQty:(t,s,i)=>e(e=>({recipes:e.recipes.map(e=>e.dishId!==t?e:{...e,lines:i>0?e.lines.some(e=>e.ing===s)?e.lines.map(e=>e.ing===s?{...e,qty:i}:e):[...e.lines,{ing:s,qty:i}]:e.lines.filter(e=>e.ing!==s)})})),acceptDelivery:(t,i,n,o)=>e(e=>({deliveries:e.deliveries.map(e=>e.id===t?{...e,lines:i,status:'accepted',checkedBy:n,at:(new Date).toISOString(),note:o}:e),ingredients:e.ingredients.map(e=>{const t=i.find(t=>t.ing===e.id);return t?{...e,onHand:(0,s.fishInStone)(r.VENUE_RID,e)?e.onHand+t.received:Math.round(100*(e.onHand+t.received))/100,...t.price!==e.cost?{prevCost:e.cost,cost:t.price}:{}}:e})})),saveStockTake:(t,s)=>e(e=>({stockTakes:[{id:y('stk'),at:(new Date).toISOString(),by:s,lines:Object.entries(t).map(([t,s])=>{const i=e.ingredients.find(e=>e.id===t);return{ing:t,expected:i.onHand,counted:s,cost:i.cost}})},...e.stockTakes],ingredients:e.ingredients.map(e=>e.id in t?{...e,onHand:t[e.id]}:e)})),addWaste:t=>e(e=>({waste:[{...t,id:y('w'),at:(new Date).toISOString()},...e.waste],ingredients:t.ing?e.ingredients.map(e=>e.id===t.ing?{...e,onHand:Math.max(0,(0,s.fishInStone)(r.VENUE_RID,e)?e.onHand-t.qty:Math.round(100*(e.onHand-t.qty))/100)}:e):e.ingredients})),addOrder:t=>{const s=y('po');return e(e=>({orders:[{...t,id:s,at:(new Date).toISOString()},...e.orders]})),s},setOrderStatus:(t,s)=>e(e=>({orders:e.orders.map(e=>e.id===t?{...e,status:s}:e)})),tickPrep:(t,s)=>e(e=>{const i={...e.prepTicks};return s?i[t]={by:s,at:(new Date).toISOString()}:delete i[t],{prepTicks:i}}),addTemp:t=>e(e=>({temps:[{...t,id:y('t'),at:(new Date).toISOString()},...e.temps]})),reset:()=>e(r.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD?{targetGp:70,ingredients:[],recipes:[],deliveries:[],stockTakes:[],waste:[],orders:[],prepTicks:{},temps:[]}:v())}),{name:'covercharge-kitchen-v1',version:3,storage:(0,l.createJSONStorage)(()=>d.default),migrate:async e=>{const s=e;return t.LIVE_VENUE_BUILD?(await(0,i.archiveChefCache)('kitchen',s),{...s,...S(s)}):s}}))},1171,[833,1026,1096,1025,5,1082,952,1091]); +__d(function(g,r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ACCIDENT_CATEGORIES",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"RIDDOR_CATEGORIES",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"sid",{enumerable:!0,get:function(){return u}}),_e.isSeedAccident=w,Object.defineProperty(_e,"useSafety",{enumerable:!0,get:function(){return b}});var e,t=r(_d[0]),n=r(_d[1]),a=r(_d[2]),s=r(_d[3]),o=(e=s)&&e.__esModule?e:{default:e},d=r(_d[4]),c=r(_d[5]),l=r(_d[6]);const p=['Near miss','Slip, trip or fall','Cut','Burn or scald','Manual handling','Struck by an object','Allergic reaction','Fall from height','Fracture or dislocation','Taken to hospital','Lost consciousness','Off work more than 7 days','Other'],f=['Fall from height','Fracture or dislocation','Taken to hospital','Lost consciousness','Off work more than 7 days'];let y=0;const u=e=>`${e}-${Date.now().toString(36)}${(y++).toString(36)}`,h=(e,t,n)=>({id:e,when:t,location:'',person:'',personType:'Staff',category:'Near miss',what:'',injury:'None',firstAid:'None needed',witnesses:'',reportedBy:'',reportedById:'',app:'staff',createdAt:`${t}:00`,...n});function S(){const e=new Date,t=(t,n)=>{const a=new Date(e);return a.setDate(a.getDate()-t),`${a.toISOString().slice(0,10)}T${n}`};return[h('acc-ex1',t(3,'19:40'),{location:'Kitchen pass',person:'Server (example)',category:'Near miss',what:'Example: water on the floor by the pass after the glass washer leaked. Nobody slipped.',firstAid:'None needed',witnesses:'Bar (example)',reportedBy:'Server (example)',reportedById:'st-4',app:'staff'}),h('acc-ex2',t(6,'12:15'),{location:'Kitchen: fryer section',person:'Head Chef (example)',category:'Burn or scald',what:'Example: splash of hot oil on the back of the hand while changing the basket.',injury:'Small burn, back of left hand',firstAid:'Cooled under running water for 20 minutes, sterile dressing',witnesses:'None',reportedBy:'Head Chef (example)',reportedById:'st-3',app:'chef'})]}function w(e){const t=({when:e,createdAt:t,...n})=>JSON.stringify(n);return S().some(n=>n.id===e.id&&t(n)===t(e))}const b=(0,d.create)()((0,c.persist)(e=>({points:l.DEFAULT_POINTS,entries:[],accidents:a.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD?[]:S(),probes:[],diary:[],daySigns:[],weekly:[],addNote:t=>e(e=>({diary:[{...t,id:u('dn')},...e.diary??[]]})),signDay:t=>e(e=>({daySigns:[...(e.daySigns??[]).filter(e=>e.date!==t.date),t]})),signWeek:t=>e(e=>({weekly:[{...t,id:u('wk')},...(e.weekly??[]).filter(e=>e.week!==t.week)]})),addProbe:t=>e(e=>({probes:[...e.probes??[],{...t,id:u('pr'),status:'not-connected'}]})),removeProbe:t=>e(e=>({probes:(e.probes??[]).filter(e=>e.id!==t)})),addEntries:t=>e(e=>({entries:[...t.map(e=>({...e,id:u('hc')})),...e.entries]})),setPoint:(t,n)=>e(e=>({points:e.points.map(e=>e.id===t?{...e,...n}:e)})),addPoint:t=>e(e=>({points:[...e.points,{...t,id:u('cp')}]})),resetPoints:()=>e({points:l.DEFAULT_POINTS}),addAccident:t=>e(e=>({accidents:[{...t,id:u('acc'),createdAt:(new Date).toISOString()},...e.accidents]})),setRiddorNote:(t,n)=>e(e=>({accidents:e.accidents.map(e=>e.id===t?{...e,riddorNote:n}:e)}))}),{name:'covercharge-safety-v1',storage:(0,c.createJSONStorage)(()=>o.default),version:4,migrate:async(e,a)=>{if(t.LIVE_VENUE_BUILD&&e&&await(0,n.archiveChefCache)('safety',e),e&&a<2){const t=new Set((e.points??[]).map(e=>e.id));e.points=[...e.points??[],...l.DEFAULT_POINTS.filter(e=>!t.has(e.id))],e.diary=e.diary??[],e.daySigns=e.daySigns??[],e.weekly=e.weekly??[]}return t.LIVE_VENUE_BUILD&&e&&(e.accidents=(e.accidents||[]).filter(e=>!w(e))),e}}))},1172,[833,1096,5,1082,952,1091,1173]); +__d(function(g,_r,i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"KIND_LABEL",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"TEMP_KINDS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"isTempKind",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"SECTIONS",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"SECTION_LABEL",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"sectionOf",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"initialsOf",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"DEFAULT_POINTS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"limitText",{enumerable:!0,get:function(){return d}}),_e.inRange=u,_e.spokenNumber=p,_e.parseQuick=function(e,n){return e.split(/[,;\n]+|\s+and\s+|\.\s+/i).map(e=>e.trim()).filter(Boolean).map(e=>{const r=e.toLowerCase().replace(/[\u2010\u2013]/g,'-').replace(/-(?!\d)/g,' '),o=` ${r.replace(/[^a-z0-9.\- ]/g,' ').replace(/\s+/g,' ')} `;let a,l=0;for(const e of n)for(const n of[e.name.toLowerCase(),...e.aliases]){const t=n.replace(/-/g,' ').replace(/[^a-z0-9 ]/g,' ').replace(/\s+/g,' ').trim();t&&o.includes(` ${t} `)&&t.length>l&&(a=e,l=t.length)}const s=p(r);return a?t(a.kind)?null==s?{text:e,point:a,value:null,problem:'No temperature heard \u2014 type it in.'}:{text:e,point:a,value:s}:{text:e,point:a,value:null}:{text:e,value:s,problem:'Not sure which check this is \u2014 pick it below or type it.'}})},_e.missedChecks=function(e,n,t){const r=new Date(t);r.setHours(0,0,0,0);const o=60*t.getHours()+t.getMinutes(),a=[];for(const l of e){const e=l.due.filter(e=>f(e)<=o);if(!e.length)continue;const s=e[e.length-1],c=r.getTime()+6e4*f(e[0])-108e5,d=n.filter(e=>e.pointId===l.id&&new Date(e.at).getTime()>=c&&new Date(e.at).getTime()<=t.getTime()),u=e.length;d.lengthe.map(y).join(',')).join('\r\n')+'\r\n'},Object.defineProperty(_e,"SLOTS",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"SLOT_LABEL",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"SLOT_HINT",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"slotOf",{enumerable:!0,get:function(){return C}}),_e.todayTasks=function(e,n,t){const r=new Date(t);r.setHours(0,0,0,0);const o=60*t.getHours()+t.getMinutes(),a=[];for(const l of e){const e=[...l.due].sort();if(!e.length)continue;const s=r.getTime()+6e4*f(e[0])-108e5,c=n.filter(e=>e.pointId===l.id&&new Date(e.at).getTime()>=s&&new Date(e.at).getTime()<=t.getTime()).reverse().sort((e,n)=>e.at.localeCompare(n.at));e.forEach((e,n)=>{const t=c[n],r=f(e),s=t?'done':o>=r?'overdue':o>=r-60?'due':'upcoming';a.push({key:`${l.id}@${e}`,point:l,due:e,slot:C(e),status:s,entry:t})})}return a.sort((e,n)=>e.due.localeCompare(n.due)||e.point.name.localeCompare(n.point.name))},_e.unitStatus=function(e,n,t){const r=n.filter(n=>n.pointId===e.id&&null!=n.value).reverse().sort((e,n)=>e.at.localeCompare(n.at)),o=r[r.length-1];if(!o)return{rag:'none',history:r,why:'No readings yet'};const a=o.value;if(!u(e,a))return{rag:'red',latest:o,history:r,why:'Out of range'};const l=new Date(t);if(l.setHours(0,0,0,0),new Date(o.at).getTime()e.max-1||null!=e.min&&an.includes(e),r=['cross','cleaning','chilling','cooking','management'],o={cross:'Cross-contamination',cleaning:'Cleaning',chilling:'Chilling',cooking:'Cooking',management:'Management'},a={fridge:'chilling',freezer:'chilling',cool:'chilling',delivery:'chilling',cook:'cooking',hothold:'cooking',cleaning:'cleaning',allergen:'cross',check:'management'},l=e=>e.section??a[e.kind],s=e=>e.replace(' (example)','').split(/\s+/).filter(Boolean).map(e=>e[0]).join('').slice(0,3).toUpperCase(),c=[{id:'cp-walkin',name:'Walk-in fridge',kind:'fridge',max:5,due:['09:00','16:00'],aliases:['walk in fridge','walkin fridge','walk in','walk-in','walkin','cold room']},{id:'cp-prep',name:'Prep fridge',kind:'fridge',max:5,due:['09:00','16:00'],aliases:['prep fridge','prep']},{id:'cp-bar',name:'Bar fridge',kind:'fridge',max:5,due:['16:00'],aliases:['bar fridge','bar']},{id:'cp-freezer',name:'Freezer',kind:'freezer',max:-18,due:['09:00','16:00'],aliases:['freezer','chest freezer']},{id:'cp-cook',name:'Cooking: core temperature',kind:'cook',min:75,due:[],aliases:['core','cook','cooking','probe']},{id:'cp-cool',name:'Cooling: within 90 minutes',kind:'cool',max:8,due:[],aliases:['cooling','cool']},{id:'cp-hothold',name:'Hot hold: bain-marie',kind:'hothold',min:63,due:['18:00'],aliases:['hot hold','bain marie','bain-marie','hothold']},{id:'cp-del-chill',name:'Delivery: chilled',kind:'delivery',max:8,due:[],aliases:['chilled delivery','delivery chilled','delivery']},{id:'cp-del-frozen',name:'Delivery: frozen',kind:'delivery',max:-15,due:[],aliases:['frozen delivery','delivery frozen']},{id:'cp-clean',name:'Close-down clean signed off',kind:'cleaning',due:['23:00'],aliases:['cleaning','clean down','close down']},{id:'cp-allergen',name:'Allergen matrix checked against today\u2019s specials',kind:'allergen',due:['11:00'],aliases:['allergen','allergens']},{id:'cp-open-equip',name:'Fridges, freezers and other equipment working',kind:'check',section:'management',due:['09:00'],aliases:['equipment']},{id:'cp-open-staff',name:'Staff fit for work, in clean work clothes',kind:'check',section:'management',due:['09:00'],aliases:['staff fit']},{id:'cp-open-surfaces',name:'Prep areas, surfaces and utensils clean and disinfected',kind:'cleaning',due:['09:00'],aliases:['surfaces','prep areas']},{id:'cp-open-pests',name:'No signs of pests',kind:'check',section:'cleaning',due:['09:00'],aliases:['pests','pest']},{id:'cp-open-hands',name:'Hand-wash basins: hot water, soap and paper towels',kind:'check',section:'cross',due:['09:00'],aliases:['hand wash','handwash','soap']},{id:'cp-open-probe',name:'Probe thermometer working, probe wipes available',kind:'check',section:'management',due:['09:00'],aliases:['probe wipes','thermometer']},{id:'cp-mid-boards',name:'Raw and ready-to-eat kept apart; colour-coded boards in use',kind:'check',section:'cross',due:['12:00'],aliases:['boards','raw and ready to eat']},{id:'cp-close-stored',name:'Food covered, labelled, dated and put away',kind:'check',section:'chilling',due:['22:00'],aliases:['labelled','covered']},{id:'cp-close-useby',name:'Food past its use-by date thrown away',kind:'check',section:'chilling',due:['22:00'],aliases:['use by','use-by']},{id:'cp-close-waste',name:'Waste removed and bins relined',kind:'check',section:'cleaning',due:['22:00'],aliases:['waste','bins']}],d=e=>null!=e.min&&null!=e.max?`${e.min}\xb0C to ${e.max}\xb0C`:null!=e.max?`${e.max}\xb0C or colder`:null!=e.min?`${e.min}\xb0C or hotter`:'Done / not done';function u(e,n){return(null==e.min||n>=e.min)&&(null==e.max||n<=e.max)}const m={zero:0,nought:0,one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12,thirteen:13,fourteen:14,fifteen:15,sixteen:16,seventeen:17,eighteen:18,nineteen:19,twenty:20,thirty:30,forty:40,fifty:50,sixty:60,seventy:70,eighty:80,ninety:90};function p(e){const n=e.toLowerCase().replace(/\u2212/g,'-').replace(/degrees?|\xb0c?|celsius|centigrade/g,' '),t=/\b(minus|negative)\b/.test(n),r=n.match(/-?\d+(?:[.,]\d+)?/);if(r){const e=Number(r[0].replace(',','.'));return t&&e>0?-e:e}const o=n.split(/[^a-z]+/).filter(Boolean);let a=null,l=null,s=!1;for(const e of o)if('point'!==e){if(e in m){if(s){l=m[e];break}a=(a??0)+m[e]}}else s=!0;if(null==a)return null;const c=null!=l?Number(`${a}.${l}`):a;return t?-c:c}const f=e=>{const[n,t]=e.split(':').map(Number);return 60*n+t};const h=e=>null!=e.value?`${e.value}\xb0C`:e.done?'Done':'Not done',y=e=>{const n=null==e?'':String(e);return/[",\n]/.test(n)?`"${n.replace(/"/g,'""')}"`:n},k=['Date','Time','Check','Type','Reading','Safe limit','Result','Corrective action','Note','Recorded by','Entry'];function b(n,t){return n.map(n=>{const r=new Date(n.at),o=t.find(e=>e.id===n.pointId);return[r.toLocaleDateString('en-GB'),r.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}),n.name,e[n.kind],h(n),o?d(o):'',n.ok?'OK':'OUT OF RANGE',n.corrective??'',n.note??'',n.by,'probe'===n.source?'Wireless probe':'voice'===n.source?'Voice (confirmed)':'Typed']})}const w=['opening','midday','closing'],v={opening:'Opening',midday:'Midday',closing:'Closing'},O={opening:'until 11:00',midday:'11:00 to 16:00',closing:'from 16:00'},C=e=>{const n=f(e);return n<660?'opening':n<960?'midday':'closing'};const T=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`,x=['Opening and closing checks were done every day (or the reason is in the diary)','Every out-of-range reading has a corrective action','Probe thermometers checked (iced water / boiling water) this week','Allergen information is up to date for menu and special changes','Cleaning schedule followed; no signs of pests','Staff trained on any changed safe methods']},1173,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"GREENSIDE_PALETTE",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"GREENSIDE_DISPLAY",{enumerable:!0,get:function(){return o}});const t={bg:'#1A1A1A',surface:'#222222',surface2:'#292929',border:'#62675E',gold:'#7DB754',goldLight:'#AED28E',goldTint:'#25321E',goldMuted:'#A1C783',tile:'#222222',tilePressed:'#2D3428',accentBg:'rgba(125,183,84,0.13)',accentBorder:'rgba(125,183,84,0.55)',onGold:'#1A1A1A',ok:'#AED28E',okBg:'#25321E',blue:'#AED28E',blueBg:'#25321E'},o={quietBorder:'rgba(125,183,84,0.55)',quietPressed:'rgba(125,183,84,0.16)',primaryPressed:'#6D9F49'}},1174,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.fixSupplierNames=function(n){return n?s.reduce((s,[n,b])=>s.replace(n,b),n):n};const s=[[/\bAl{2}sons?'?s?\b|\bAlson's\b/g,'Alsons'],[/\bSpe[zs] ?[Bb]ona\b|\bSpezbona\b/g,'Spes Bona']]},1175,[]); +__d(function(g,r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DEFAULT_ORDER_LIST_SETTINGS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"UNITS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"DAY_FULL",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"normName",{enumerable:!0,get:function(){return a}}),e.findDuplicate=function(t,n,i,s){return t.find(t=>t.listId===n&&!t.removed&&'open'===t.status&&a(t.name)===a(i)&&u(t.unit)===u(s))},e.bumpQty=function(t,n,i,a,u){return{...t,qty:Math.round(100*(t.qty+n))/100,bumps:[...t.bumps??[],{by:i,name:a,qty:n,at:u}],updatedAt:u}},Object.defineProperty(e,"qtyText",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"validQty",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"liveItems",{enumerable:!0,get:function(){return d}}),e.finishOrder=function(t,n,i,a,u,s){const o=d(n,t.id),l=o.filter(t=>'got'!==t.status),c={id:s(),listId:t.id,listName:t.name,finishedAt:u,finishedBy:a.id,finishedByName:a.name,items:o.map(t=>({name:t.name,qty:t.qty,unit:t.unit,note:t.note,status:t.status,addedByName:t.addedByName})),carried:i?l.length:0},p=i?l.map(t=>({...t,status:'open',carried:'missing'===t.status?'missing':'not-got',statusBy:void 0,statusAt:void 0,updatedAt:u})):[],m=new Set(p.map(t=>t.id));return{round:c,drop:o.filter(t=>!m.has(t.id)).map(t=>t.id),carriedOver:p}},e.nextTripDate=p,e.tripText=function(t,n,a){const u=p(t,n,a);if(!u)return'Running list';const[,s,o]=u.split('-').map(Number);return"Next trip "+(u===n?'today':u===l(n,1)?'tomorrow':`${i[c(u)]} ${o} ${['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'][s-1]}`)},e.initials=function(t){const n=t.replace(/\(.*?\)/g,' ').split(/[^A-Za-z0-9]+/).filter(t=>t&&!['and','the','of','&'].includes(t.toLowerCase()));return n.length?(1===n.length?n[0].slice(0,2):n[0][0]+n[1][0]).toUpperCase():'?'},e.telHref=function(t){if(!t)return null;const n=t.trim().replace(/[^\d+]/g,'').replace(/(?!^)\+/g,'');return n.replace(/\D/g,'').length>=6?`tel:${n}`:null};const t={allowStaff:!0,defaultTripDay:5},n=['','cases','bottles','kegs','boxes','bags','packs','kg','litres','each'],i=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],a=t=>t.trim().toLowerCase().replace(/[\u2019']/g,"'").replace(/\s+/g,' ').replace(/s$/,''),u=t=>t.trim().toLowerCase().replace(/s$/,'');const s=t=>`${Number.isInteger(t.qty)?t.qty:t.qty.toFixed(2).replace(/0$/,'')}${t.unit?` ${t.unit}`:''}`,o=t=>Number.isFinite(t)&&t>0&&t<=9999,d=(t,n)=>t.filter(t=>t.listId===n&&!t.removed).sort((t,n)=>('open'===t.status?0:1)-('open'===n.status?0:1)||t.addedAt.localeCompare(n.addedAt));const l=(t,n)=>{const[i,a,u]=t.split('-').map(Number);return new Date(Date.UTC(i,a-1,u+n)).toISOString().slice(0,10)},c=t=>{const[n,i,a]=t.split('-').map(Number);return new Date(Date.UTC(n,i-1,a)).getUTCDay()};function p(n,i,a=t.defaultTripDay){if('trip'!==n.kind)return null;if(n.nextTrip&&n.nextTrip>=i)return n.nextTrip;const u=n.tripDay??a;return l(i,(u-c(i)+7)%7)}},1176,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useClockArea",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"areaOf",{enumerable:!0,get:function(){return _}});var e,t=r(d[0]),n=r(d[1]),s=r(d[2]),u=(e=s)&&e.__esModule?e:{default:e},c=r(d[3]),l=r(d[4]),E=r(d[5]);const o=(0,c.create)()((0,l.persist)(e=>({areas:(0,n.privateClockVenue)(t.VENUE_RID)?{[t.VENUE_RID]:(0,n.venueClockArea)(t.VENUE_RID)}:{},visiting:{},set:(s,u,c)=>e(e=>t.IS_ISOLATED_VENUE&&s!==t.VENUE_RID?e:{areas:{...e.areas,[s]:{...(0,n.venueClockArea)(s,{...e.areas[s]??{},...u}),updatedAt:(new Date).toISOString(),updatedBy:c}}}),reset:(s,u)=>e(e=>t.IS_ISOLATED_VENUE&&s!==t.VENUE_RID?e:{areas:{...e.areas,[s]:{...(0,n.venueClockArea)(s,{lat:e.areas[s]?.lat??null,lng:e.areas[s]?.lng??null}),updatedAt:(new Date).toISOString(),updatedBy:u}}}),setVisiting:t=>e(e=>({visiting:Object.fromEntries([...Object.entries(e.visiting).slice(-60),[t,!0]])}))}),{name:'covercharge-clock-area-v1',version:1,storage:(0,l.createJSONStorage)(()=>u.default)})),_=e=>t.IS_ISOLATED_VENUE&&e!==t.VENUE_RID?(0,E.cleanArea)(E.DEFAULT_CLOCK_AREA):(0,n.venueClockArea)(e,o.getState().areas[e]??{})},1177,[5,989,1082,952,1091,954]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.inviteStatus=function(){return{'st-tracy':{state:'used',usedAt:s(3e3),devices:2},'st-gordon':{state:'used',usedAt:s(2940),devices:2},'st-bisto':{state:'used',usedAt:s(1800),devices:1},'st-agate':{state:'used',usedAt:s(1680),devices:1},'st-lenny':{state:'used',usedAt:s(1560),devices:1},'st-finn':{state:'unused',expiresAt:a(52),devices:0},'st-eilidh':{state:'used',usedAt:s(1200),devices:1},'st-emily':{state:'expired',devices:0},'st-lillie':{state:'used',usedAt:s(480),devices:1},'st-jack':{state:'unused',expiresAt:a(70),devices:0}}},e.reissueInvite=async function(t){const s='st-bisto'===t?'chef':['st-tracy','st-gordon','st-agate'].includes(t)?'owner':'staff';return{ok:!0,token:'DEMO-link-not-real-0000',expiresAt:a(72),app:s}},e.unlockCashUp=async function(s,a,n){const c=new Date(Date.now()+18e5).toISOString();'cashup'===s?t.useCashUp.setState(t=>({cashUps:t.cashUps.map(t=>t.id===a?{...t,unlockedUntil:c}:t)})):t.useCashUp.setState(t=>({sales:t.sales.map(t=>t.id===a?{...t,unlockedUntil:c}:t)}));return{ok:!0,until:c}},e.cashAudit=async function(t){return[{at:s(780),action:'unlocked',by:'Morgan',tbl:'cash_ups',reason:'Card total keyed as 1,284 not 1,248',changed:[]},{at:s(768),action:'changed',by:'Alex',tbl:'cash_ups',changed:['card']},{at:s(840),action:'created',by:'Alex',tbl:'cash_ups',changed:[]}]},e.pitchRpc=function(t,s){switch(t){case'list_displays':return n;case'create_display_code':case'new_code_for_display':return[{code:'DEMO7K2QX',expires_at:a(24*Number(s.p_hours?Number(s.p_hours)/24:7))}];default:return[]}};var t=r(d[0]);const s=t=>new Date(Date.now()-6e4*t).toISOString(),a=t=>new Date(Date.now()+36e5*t).toISOString();const n=[{id:'pd-1',label:'Front desk tablet',can_write:!0,created_at:s(17280),last_seen_at:s(2),revoked_at:null,sessions:1,open_codes:0},{id:'pd-2',label:'Kitchen pass tablet',can_write:!1,created_at:s(12960),last_seen_at:s(5),revoked_at:null,sessions:1,open_codes:0}]},1178,[1076]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"libraryRowId",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"personRowId",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"tickId",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"personKey",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"useDailyTasks",{enumerable:!0,get:function(){return L}}),Object.defineProperty(_e,"tasksOf",{enumerable:!0,get:function(){return O}});var e,t=r(d[0]),i=(e=t)&&e.__esModule?e:{default:e},s=r(d[1]),n=r(d[2]),o=r(d[3]),u=r(d[4]),c=r(d[5]);const l=e=>(0,o.uuidFrom)(`daily-task-library:${e}`),y=(e,t)=>(0,o.uuidFrom)(`daily-tasks:${e}:${t}`),b=(e,t,i,s)=>(0,o.uuidFrom)(`daily-task-tick:${e}:${(0,u.tickKey)(t,i,s)}`),f=()=>(new Date).toISOString(),k=(e,t)=>`${e}|${t}`,p=e=>u.DEFAULT_LIBRARY.map((t,i)=>({id:(0,o.uuidFrom)(`daily-task-lib:${e}:${i}`),text:t})),L=(0,s.create)()((0,n.persist)((e,t)=>({library:{},people:{},ticks:[],ensure:i=>{t().library[i]||e(e=>({library:{...e.library,[i]:{items:p(i)}}}))},setLibrary:(t,i)=>e(e=>({library:{...e.library,[t]:{items:i,updatedAt:f()}}})),addLibrary:(e,i)=>{const s=(0,u.cleanTaskText)(i);if(!s)return;const n=t().library[e]?.items??p(e);n.some(e=>e.text.toLowerCase()===s.toLowerCase()&&!e.archived)||t().setLibrary(e,[...n,{id:(0,c.uuid)(),text:s}])},setTasks:(t,i,s)=>e(e=>({people:{...e.people,[k(t,i)]:{tasks:s,updatedAt:f()}}})),addTask:(e,i,s,n)=>{const o=(0,u.cleanTaskText)(s);if(!o)return;const l=t().people[k(e,i)]?.tasks??[];l.some(e=>e.text.toLowerCase()===o.toLowerCase())||t().setTasks(e,i,[...l,{id:(0,c.uuid)(),text:o,...n?{libraryId:n}:{}}])},toggleTick:(t,i,s,n,o)=>e(e=>{const u=b(t,i,s,n);if(e.ticks.some(e=>e.id===u))return{ticks:e.ticks.filter(e=>e.id!==u)};const c=new Date(Date.now()-12096e5).toISOString().slice(0,10);return{ticks:[...e.ticks.filter(e=>e.forDate>=c),{id:u,rid:t,staffRef:i,taskId:s,forDate:n,byRef:o.id,byName:o.name,at:f()}]}}),resetLibrary:e=>t().setLibrary(e,p(e))}),{name:'covercharge-daily-tasks-v1',version:1,storage:(0,n.createJSONStorage)(()=>i.default)})),O=(e,t)=>L.getState().people[k(e,t)]?.tasks??[]},1179,[1082,952,1091,1103,1180,1034]); +__d(function(g,r,_i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TASK_MAX",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"cleanTaskText",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"appliesOn",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"tasksFor",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"tickKey",{enumerable:!0,get:function(){return u}}),e.progress=function(t,n,o,u,c){const s=i(t,c),f=new Set(n.filter(t=>t.staffRef===o&&t.forDate===u).map(t=>t.taskId));return{done:s.filter(t=>f.has(t.id)).length,total:s.length}},e.move=function(t,n,o){const i=n+o;if(n<0||i<0||n>=t.length||i>=t.length)return t;const u=[...t];return[u[n],u[i]]=[u[i],u[n]],u},Object.defineProperty(e,"hasTask",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"DEFAULT_LIBRARY",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"TASK_DAY_NAMES",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"isHeadChefP",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"isKitchenP",{enumerable:!0,get:function(){return d}}),e.canEditTasks=function(t,n){return!!t&&('owner'===t.role||'manager'===t.role||!!l(t)&&(t.id!==n.id&&'staff'===n.role&&!l(n)&&d(n)))};const t=80,n=n=>n.replace(/\s+/g,' ').trim().slice(0,t),o=(t,n)=>!t.days||0===t.days.length||t.days.includes(n),i=(t,n)=>t.filter(t=>o(t,n)),u=(t,n,o)=>`${t}|${n}|${o}`;const c=(t,o)=>t.some(t=>t.text.toLowerCase()===n(o).toLowerCase()),s=['Restock the bar fridges','Wipe down the menus','Check the toilets','Set the tables','Polish glasses','Empty the bins','Clean the coffee machine','Take out the recycling'],f=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],l=t=>'staff'===t.role&&('Head Chef'===t.level||/^head chef/i.test(t.job??'')),d=t=>'kitchen'===(t.dept??'').trim().toLowerCase()},1180,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useChatSync",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"chatSynced",{enumerable:!0,get:function(){return n}});const t=(0,r(d[0]).create)(()=>({synced:!1,checked:!1})),n=()=>t.getState().synced},1181,[952]); +__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useKitchenExtra",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"isManagerish",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"isHeadChef",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"isKitchenStaff",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"kitchenByRule",{enumerable:!0,get:function(){return l}}),_e.inKitchen=b,_e.inChannel=function(e,t){return!!t&&(e.startsWith('dm:')?e.split(':').slice(1).includes(t.id):'all'===e||('kitchen'===e?b(t):'managers'===e?o(t):'foh'===e&&(o(t)||/front|bar|server|waiting/i.test(t.job))))},Object.defineProperty(_e,"dmId",{enumerable:!0,get:function(){return h}});var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},c=r(d[1]),a=r(d[2]);const u=(0,c.create)()((0,a.persist)(e=>({extra:{},set:(t,n)=>e(e=>{const c={...e.extra};return null==n?delete c[t]:c[t]=n,{extra:c}})}),{name:'covercharge-kitchen-chat-v1',version:1,storage:(0,a.createJSONStorage)(()=>n.default)})),o=e=>!!e&&'staff'!==e.role,s=e=>!!e&&/head chef/i.test((e.level??'')+' '+e.job),f=e=>!!e&&(/^kitchen$/i.test(e.dept??'')||/chef|kitchen|\bkp\b|porter/i.test(e.job)),l=e=>!!e&&(o(e)||s(e)||f(e));function b(e){if(!e||!e.active)return!1;return u.getState().extra[e.id]??l(e)}const h=(e,t)=>`dm:${[e,t].sort().join(':')}`},1182,[1082,952,1091]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1183,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var u in n)Object.defineProperty(t,u,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,u).get})})(e,{get Badge(){return x.Badge},get DarkTheme(){return y.DarkTheme},get DefaultTheme(){return _.DefaultTheme},get ErrorBoundary(){return v.ErrorBoundary},get ExperimentalStack(){return U.ExperimentalStack},get ExpoRoot(){return c.ExpoRoot},get Icon(){return x.Icon},get IsWithinNativeNavigator(){return B.IsWithinNativeNavigator},get Label(){return x.Label},get LocaleProvider(){return I.LocaleProvider},get NativeStackView(){return E.NativeStackView},get NavigationAwareActivity(){return R.NavigationAwareActivity},get Navigator(){return t.Navigator},get RouterActionHandling(){return C.RouterActionHandling},get Sitemap(){return b.Sitemap},get Slot(){return t.Slot},get SplashScreen(){return S},get StackRouter(){return C.StackRouter},get SuspenseFallback(){return f.SuspenseFallback},get TabRouter(){return C.TabRouter},get Tabs(){return M.Tabs},get ThemeProvider(){return T.ThemeProvider},get Unmatched(){return l.Unmatched},get VectorIcon(){return x.VectorIcon},get attachRouteState(){return C.attachRouteState},get createBaseStackProps(){return j.createBaseStackProps},get createBaseTabProps(){return D.createBaseTabProps},get createNativeStackProps(){return W.createNativeStackProps},get createStandardRouterNavigator(){return B.createStandardRouterNavigator},get enableLegacyHeaderAppearance(){return F.enableLegacyHeaderAppearance},get extendRouter(){return C.extendRouter},get extendRouterActions(){return C.extendRouterActions},get integrateWithRouter(){return B.integrateWithRouter},get isActionHandled(){return C.isActionHandled},get router(){return u.router},get unstable_PerformanceObserver(){return G.unstable_PerformanceObserver},get unstable_createStandardRouterNavigator(){return B.unstable_createStandardRouterNavigator},get unstable_enablePerformanceIntegration(){return G.unstable_enablePerformanceIntegration},get unstable_integrateWithRouter(){return B.unstable_integrateWithRouter},get unstable_performance(){return G.unstable_performance},get unstable_useIsNavigating(){return o.useIsNavigating},get unstable_useReconcileTabHistory(){return H.useReconcileTabHistory},get useCanGoBack(){return n.useCanGoBack},get useCurrentRouteInfo(){return n.useCurrentRouteInfo},get useFocusEffect(){return h.useFocusEffect},get useGlobalSearchParams(){return n.useGlobalSearchParams},get useIsFocused(){return N.useIsFocused},get useLoaderData(){return n.useLoaderData},get useLocalSearchParams(){return n.useLocalSearchParams},get useNavigation(){return P.useNavigation},get useNavigationContainerRef(){return n.useNavigationContainerRef},get usePathname(){return n.usePathname},get usePreventRemove(){return L.usePreventRemove},get useRootNavigation(){return n.useRootNavigation},get useRootNavigationState(){return n.useRootNavigationState},get useRoute(){return A.useRoute},get useRoutePath(){return O.useRoutePath},get useRouter(){return n.useRouter},get useScrollToTop(){return w.useScrollToTop},get useSegments(){return n.useSegments},get useSitemap(){return p.useSitemap},get useTheme(){return k.useTheme},get useUnstableGlobalHref(){return n.useUnstableGlobalHref},get withLayoutContext(){return s.withLayoutContext}});const t=r(d[0]),n=r(d[1]),u=r(d[2]),o=r(d[3]),s=r(d[4]),c=r(d[5]),l=r(d[6]),b=r(d[7]),p=r(d[8]),v=r(d[9]),f=r(d[10]),R=r(d[11]),S=q(r(d[12])),P=r(d[13]),h=r(d[14]),N=r(d[15]),y=r(d[16]),_=r(d[17]),T=r(d[18]),k=r(d[19]),I=r(d[20]),O=r(d[21]),w=r(d[22]),A=r(d[23]),L=r(d[24]),x=r(d[25]),B=r(d[26]),H=r(d[27]),j=r(d[28]),D=r(d[29]),W=r(d[30]),C=r(d[31]),E=r(d[32]),F=r(d[33]),G=r(d[34]),M=r(d[35]),U=r(d[36]);function V(t){if("function"!=typeof WeakMap)return null;var n=new WeakMap,u=new WeakMap;return(V=function(t){return t?u:n})(t)}function q(t,n){if(!n&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var u=V(n);if(u&&u.has(t))return u.get(t);var o={__proto__:null},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var c in t)if("default"!==c&&Object.prototype.hasOwnProperty.call(t,c)){var l=s?Object.getOwnPropertyDescriptor(t,c):null;l&&(l.get||l.set)?Object.defineProperty(o,c,l):o[c]=t[c]}return o.default=t,u&&u.set(t,o),o}},1184,[694,419,512,1185,712,32,766,757,760,1186,664,662,667,533,537,542,481,483,447,448,1187,488,489,478,476,524,711,657,725,1188,724,358,703,708,378,1189,1192]); +__d(function(g,r,i,a,m,e,d){"use strict";function n(){const t=r(d[0]);return n=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"useIsNavigating",{enumerable:!0,get:function(){return u}});const t=r(d[1]);function u(){return(0,n().use)(t.NavigationPendingContext)}},1185,[30,375]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const o=r(d[0]);return t=function(){return o},o}function o(){const t=r(d[1]);return o=function(){return t},t}function n(){const t=r(d[2]);return n=function(){return t},t}function l(){const t=r(d[3]);return l=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"ErrorBoundary",{enumerable:!0,get:function(){return f}});r(d[4]);const s=r(d[5]),c=r(d[6]),u=r(d[7]);function h({error:o}){return(0,t().jsxs)(n().View,{style:{marginBottom:12,gap:4,flexWrap:'wrap'},children:[(0,t().jsx)(n().Text,{role:"heading","aria-level":1,style:y.title,children:"Something went wrong"}),(0,t().jsxs)(n().Text,{testID:"router_error_message",role:"heading","aria-level":2,style:y.errorMessage,children:["Error: ",o.message]})]})}function f({error:f,retry:x}){const w=(0,o().use)(s.BottomTabBarHeightContext)?n().View:l().SafeAreaView,S=f instanceof c.ReactServerError;return(0,t().jsx)(n().View,{style:y.container,children:(0,t().jsxs)(w,{style:{flex:1,gap:8,maxWidth:720,marginHorizontal:'auto'},children:[S?(0,t().jsx)(b,{error:f}):(0,t().jsx)(h,{error:f}),(0,t().jsx)(n().View,{style:{flex:1}}),!1,(0,t().jsx)(u.Pressable,{testID:"router_error_retry",onPress:x,children:({hovered:o,pressed:l})=>(0,t().jsx)(n().View,{style:[y.buttonInner,(o||l)&&{backgroundColor:'white'}],children:(0,t().jsx)(n().Text,{style:[y.buttonText,{color:o||l?'black':'white'}],children:"Retry"})})})]})})}const x={404:'NOT_FOUND',500:'INTERNAL_SERVER_ERROR',503:'SERVICE_UNAVAILABLE',504:'GATEWAY_TIMEOUT'};function b({error:o}){let l=String(o.statusCode);l+=': '+(x[o.statusCode]??'Server Error');const s=o.headers.get('cf-ray'),c=o.headers.get('Date');return(0,t().jsxs)(n().View,{style:{padding:12,gap:8},children:[(0,t().jsx)(n().Text,{selectable:!0,allowFontScaling:!0,style:{fontSize:n().Platform.select({web:24,default:16}),fontWeight:'bold',marginBottom:4,color:'white'},children:l}),(0,t().jsx)(n().ScrollView,{style:{borderColor:'rgba(255,255,255,0.5)',borderTopWidth:n().StyleSheet.hairlineWidth,borderBottomWidth:n().StyleSheet.hairlineWidth,maxHeight:150},contentContainerStyle:{paddingVertical:4},children:(0,t().jsx)(n().Text,{testID:"router_error_message",selectable:!0,allowFontScaling:!0,style:{color:'white'},children:o.message})}),(0,t().jsx)(w,{title:"Code",right:o.statusCode}),s&&(0,t().jsx)(w,{title:"ID",right:s}),c&&(0,t().jsx)(w,{title:"Date",right:c}),o.url&&(0,t().jsx)(n().Text,{selectable:!0,allowFontScaling:!0,style:{fontSize:14,opacity:.5,color:'white'},children:o.url})]})}function w({title:o,right:l}){const s={fontSize:16,color:'white'};return(0,t().jsxs)(n().View,{style:{flexDirection:'row',justifyContent:'space-between'},children:[(0,t().jsx)(n().Text,{selectable:!0,allowFontScaling:!0,style:s,children:o}),l&&(0,t().jsx)(n().Text,{selectable:!0,allowFontScaling:!0,style:[s,y.code],children:l})]})}const y=n().StyleSheet.create({container:{flex:1,backgroundColor:'black',padding:24,alignItems:'stretch',justifyContent:'center'},title:{color:'white',fontSize:n().Platform.select({web:32,default:24}),fontWeight:'bold'},buttonText:{fontSize:18,fontWeight:'bold',color:'black',...n().Platform.select({web:{transitionDuration:'100ms'}})},buttonInner:{...n().Platform.select({web:{transitionDuration:'100ms'}}),paddingVertical:12,paddingHorizontal:24,borderColor:'white',borderWidth:2,marginLeft:8,justifyContent:'center',alignItems:'center'},code:{fontFamily:n().Platform.select({default:'Courier',ios:'Courier New',android:'monospace'}),fontWeight:'500'},errorMessage:{color:'white',fontSize:16},subtitle:{color:'white',fontSize:14,marginBottom:12},link:{color:'rgba(255,255,255,0.4)',textDecorationStyle:'solid',textDecorationLine:'underline',fontSize:14,textAlign:'center'}})},1186,[24,30,33,289,508,545,666,759]); +__d(function(g,r,i,a,m,e,d){"use strict";function n(){const t=r(d[0]);return n=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"LocaleProvider",{enumerable:!0,get:function(){return o}});const t=r(d[1]);function o({direction:o,children:c}){return(0,n().jsx)(t.LocaleDirContext.Provider,{value:o,children:c})}},1187,[24,429]); +__d(function(g,r,i,a,m,e,d){"use strict";function t({dispatch:t,isPreloaded:o,isRemovalPrevented:n,state:s}){return{isPreloaded:o,isRemovalPrevented:n,routeNames:s.routeNames,preload:o=>t({type:'PRELOAD',payload:{name:o}})}}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"createBaseTabProps",{enumerable:!0,get:function(){return t}})},1188,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),(function(t,o){for(var n in o)Object.defineProperty(t,n,{enumerable:!0,get:Object.getOwnPropertyDescriptor(o,n).get})})(e,{get BottomTabBar(){return n.BottomTabBar},get BottomTabBarHeightCallbackContext(){return n.BottomTabBarHeightCallbackContext},get BottomTabBarHeightContext(){return n.BottomTabBarHeightContext},get BottomTabView(){return n.BottomTabView},get SceneStyleInterpolators(){return u},get Tabs(){return n.default},get TransitionPresets(){return c},get TransitionSpecs(){return f},get createJSTabsProps(){return n.createJSTabsProps},get createStandardBottomTabNavigator(){return n.createStandardBottomTabNavigator},get default(){return s},get useBottomTabBarHeight(){return n.useBottomTabBarHeight}});const t=r(d[0]),o=r(d[1]),n=b(r(d[2])),u=b(r(d[3])),c=b(r(d[4])),f=b(r(d[5]));function l(t){if("function"!=typeof WeakMap)return null;var o=new WeakMap,n=new WeakMap;return(l=function(t){return t?n:o})(t)}function b(t,o){if(!o&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var n=l(o);if(n&&n.has(t))return n.get(t);var u={__proto__:null},c=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var f in t)if("default"!==f&&Object.prototype.hasOwnProperty.call(t,f)){var b=c?Object.getOwnPropertyDescriptor(t,f):null;b&&(b.get||b.set)?Object.defineProperty(u,f,b):u[f]=t[f]}return u.default=t,n&&n.set(t,u),u}n.default.Screen=o.Screen,n.default.Protected=t.Protected;const s=n.default},1189,[718,719,1190,546,547,548]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}function n(){const t=r(d[1]);return n=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get createJSTabsProps(){return h},get default(){return y}});const o=r(d[2]),s=r(d[3]),c=r(d[4]),u=r(d[5]),p=r(d[6]),f=r(d[7]);var l,b;function h(t){const{dispatch:n,state:o}=t;return{...(0,f.createBaseTabProps)(t),popNestedStackToTop:t=>{const s=o.routes.find(n=>n.key===t)?.state;s?.key&&n({...c.StackActions.popToTop(),target:s.key})}}}l=r(d[8]),b=e,Object.keys(l).forEach(function(t){"default"===t||Object.prototype.hasOwnProperty.call(b,t)||Object.defineProperty(b,t,{enumerable:!0,get:function(){return l[t]}})});const y=(0,u.integrateWithRouter)(s.createStandardBottomTabNavigator,c.TabRouter,{activityDefaultThreshold:1,processDescriptors:p.appendMissingPlaceholderTabDescriptors,processState:p.appendMissingPlaceholderTabRoutes,createProps:h,processScreens:s=>s.map(s=>{if('function'!=typeof s.options&&void 0!==s.options?.href){const{href:c,...u}=s.options;if(u.tabBarButton)throw new Error('Cannot use `href` and `tabBarButton` together.');return null===c?{...s,options:{...u,hidden:!0}}:{...s,options:{...u,tabBarButton:s=>{const u='web'===n().Platform.OS?s.children:(0,t().jsx)(n().Pressable,{children:s.children});return(0,t().jsx)(o.Link,{...s,style:[{display:'flex'},s.style],href:c,asChild:'web'!==n().Platform.OS,children:u})}}}}return s})})},1190,[24,33,508,652,427,711,1191,1188,545]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(t,n,o){const s=n.routeNames.filter(t=>!n.routes.some(n=>n.name===t));if(0===s.length)return t;const u=s.reduce((t,n)=>(t[n]=o({key:void 0,name:n}),t),{});return{...t,...u}}function n(t,n){if(!t.routeNames.some(n=>!t.routes.some(t=>t.name===n)))return t;const s=t.routes[t.index]?.key,u=t.routeNames.map(s=>{const u=t.routes.find(t=>t.name===s);return u||o(s,n)}),c=Math.max(0,u.findIndex(t=>t.key===s));return{...t,index:c,routes:u}}function o(t,n){const o=n[t];if(!o)throw new Error(`Could not find a descriptor for route "${t}". This is most likely a bug in expo-router. Please report it at https://github.com/expo/expo/issues.`);return{...o.route,key:t,name:t}}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get appendMissingPlaceholderTabDescriptors(){return t},get appendMissingPlaceholderTabRoutes(){return n}})},1191,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var u in n)Object.defineProperty(t,u,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,u).get})})(e,{get ExperimentalStack(){return c},get default(){return o}});const n=u(r(d[1]));function u(t){return t&&t.__esModule?t:{default:t}}const c=Object.assign(u=>(0,t().jsx)(n.default,{...u}),{Screen:n.default.Screen,Protected:n.default.Protected}),o=c},1192,[24,1193]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),(function(t,u){for(var n in u)Object.defineProperty(t,n,{enumerable:!0,get:Object.getOwnPropertyDescriptor(u,n).get})})(e,{get Stack(){return t.default},get default(){return l}});const t=c(r(d[0])),u=r(d[1]),n=r(d[2]);function c(t){return t&&t.__esModule?t:{default:t}}t.default.Screen=u.StackScreen,t.default.Header=u.StackHeader,t.default.Title=u.StackTitle,t.default.Toolbar=n.StackToolbar;const l=t.default},1193,[695,728,733]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t.default}});const t=o((n=r(d[0]),u=e,Object.keys(n).forEach(function(t){"default"===t||Object.prototype.hasOwnProperty.call(u,t)||Object.defineProperty(u,t,{enumerable:!0,get:function(){return n[t]}})}),n));var n,u;function o(t){return t&&t.__esModule?t:{default:t}}},1194,[1193]); +__d(function(g,r,i,a,m,e,d){"use strict";var t,n;Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get useIsPreview(){return s.useIsPreview},get usePreventZoomTransitionDismissal(){return o.usePreventZoomTransitionDismissal}}),t=r(d[0]),n=e,Object.keys(t).forEach(function(o){"default"===o||Object.prototype.hasOwnProperty.call(n,o)||Object.defineProperty(n,o,{enumerable:!0,get:function(){return t[o]}})});const o=r(d[1]),s=r(d[2])},1195,[508,1196,421]); +__d(function(g,r,i,a,m,e,d){"use strict";function n(n){}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"usePreventZoomTransitionDismissal",{enumerable:!0,get:function(){return n}})},1196,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"Color",{enumerable:!0,get:function(){return y}});r(d[0]);function t(t,n){return Object.keys(t).forEach(function(u){"default"===u||Object.prototype.hasOwnProperty.call(n,u)||Object.defineProperty(n,u,{enumerable:!0,get:function(){return t[u]}})}),t}t(r(d[1]),e),t(r(d[2]),e),t(r(d[3]),e),t(r(d[4]),e),t(r(d[5]),e);const n=new Proxy({},{get:(t,n)=>null}),u=new Proxy({},{get:(t,n)=>null}),o=new Proxy({},{get:(t,n)=>null}),l=new Proxy({},{get:(t,n)=>null}),c=new Proxy({get attr(){return u},get material(){return o},get dynamic(){return l}},{get:(t,n)=>n in t?t[n]:null}),y={get ios(){return n},get android(){return c}}},1197,[1198,1199,1200,1201,1202,1203]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(t){return null}function n(t){return null}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get Material3Color(){return n},get Material3DynamicColor(){return t}})},1198,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1199,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1200,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1201,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1202,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1203,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"LIVE_HEAD_CHEF",{enumerable:!0,get:function(){return o}});var t=r(d[0]),n=r(d[1]),c=r(d[2]),_=r(d[3]);const o='chef'===t.APP_VARIANT&&(0,c.isAnchorage)(_.VENUE_RID)&&!n.PITCH},1204,[806,2,1025,5]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.useLiveState=function(){const e=(0,s.useSync)(e=>e.mode),n=(0,s.useSync)(e=>e.venueId),o=(0,s.useSync)(e=>e.lastSyncAt);return l.PITCH||n&&o?'ready':'signin'===e||'local'===e||'off'===e||'unpaired'===e?'nolink':'offline'===e?'offline':'connecting'},_e.LiveWait=function({state:n,title:o,testID:s}){const l='nolink'===n&&'display'===e.APP_VARIANT?h:p[n];return(0,f.jsxs)(t.default,{testID:s,accessible:!0,accessibilityLabel:`${o}: ${l}`,style:{borderRadius:16,borderWidth:1,borderColor:c.colours.border,backgroundColor:c.colours.surface,padding:14,gap:4},children:[(0,f.jsx)(u.T,{size:12,weight:"semibold",colour:c.colours.goldMuted,children:o.toUpperCase()}),(0,f.jsx)(u.T,{size:18,weight:"semibold",children:l})]})};var e=r(d[0]);r(d[1]);var n,o=r(d[2]),t=(n=o)&&n.__esModule?n:{default:n},s=r(d[3]),l=r(d[4]),c=r(d[5]),u=r(d[6]),f=r(d[7]);const p={connecting:'Connecting\u2026',offline:'No connection. The live numbers show again when this phone is back online.',nolink:'Not connected to the venue. Open your personal link from your manager on this phone to see live numbers.'},h="This Display isn't paired yet. Tap Not paired to pair it."},1205,[806,30,127,820,2,821,813,24]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"QUEUED_BRAND",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"QUEUED_PALETTE",{enumerable:!0,get:function(){return l}});var t=r(d[0]),n=r(d[1]);const c=n.queuedVenues[t.VENUE_RID]?.branding,l={bg:c?.ink,surface:'#222222',surface2:'#292929',border:'#686868',gold:c?.accent,goldLight:c?.smallTextAccent,goldMuted:c?.smallTextAccent,onGold:c?.onAccent,goldTint:'#292929',tile:'#222222',tilePressed:'#292929',ok:c?.smallTextAccent,okBg:'#292929',blue:c?.smallTextAccent,blueBg:'#292929'}},1206,[5,6]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ABBOTSFORD_BRAND_ACCENT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"ABBOTSFORD_PALETTE",{enumerable:!0,get:function(){return n}});const t='#B89362',n={bg:'#32373C',surface:'#2A2F34',surface2:'#252A2F',tile:'#2A2F34',tilePressed:'#3D4349',border:'#777C81',gold:'#E5D08D',goldLight:'#F0DEA4',goldTint:'#3C372B',goldMuted:'#E5D08D',accentBg:'rgba(184,147,98,0.13)',accentBorder:'rgba(229,208,141,0.65)',onGold:'#0B0B0B',text:'#F8F4EA',muted:'#D7D1C7',ok:'#E5D08D',okBg:'#3C372B',blue:'#E5D08D',blueBg:'#3C372B'}},1207,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"KIRKTON_PALETTE",{enumerable:!0,get:function(){return t}});const t={bg:'#0B0B0B',surface:'#111111',surface2:'#141414',border:'#65554F',gold:'#B46C54',goldLight:'#D4A18E',goldTint:'#241A16',goldMuted:'#C99A86',tile:'#111111',tilePressed:'#141414',accentBg:'rgba(180,108,84,0.13)',accentBorder:'rgba(180,108,84,0.55)',onGold:'#0B0B0B',ok:'#D4A18E',okBg:'#241A16',blue:'#D4A18E',blueBg:'#241A16'}},1208,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"space",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"type",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"LINE",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"LINE_TIGHT",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"MIN_LINE",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"lineFor",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"radii",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"control",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"caps",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"layout",{enumerable:!0,get:function(){return y}});const t={xxs:2,xs:4,s:8,m:12,l:16,xl:24,xxl:32},n={micro:11,caption:12,small:14,body:16,large:18,title:22,hero:30,display:40},u=1.4,o=1.25,c=1.2,l=(t,n=u)=>Math.ceil(t*Math.max(n,c)),b={xs:4,s:8,m:12,button:14,l:16,xl:20,pill:999},f={min:48,tall:52,hero:56},p={letterSpacing:1.6},y={contentMax:640,headerSide:96}},1209,[]); +__d(function(_g,_r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.normaliseHex=n,e.hexToRgb=r,e.rgbToHex=o,e.hsvToRgb=s,Object.defineProperty(e,"hsvToHex",{enumerable:!0,get:function(){return a}}),e.hexToHsv=function(t){const{r:n,g:o,b:s}=r(t),a=n/255,c=o/255,u=s/255,i=Math.max(a,c,u),h=Math.min(a,c,u),l=i-h;let p=0;l&&(p=i===a?(c-u)/l%6:i===c?(u-a)/l+2:(a-c)/l+4);return{h:(60*p+360)%360,s:i?l/i:0,v:i}},e.luminance=c,e.contrast=u,e.shade=i,e.checkAccent=function(t,r,o,s){const a=n(t)??'#CFA45F',c=u(a,o),h=u(a,s),l=c>=h?o:s,p=[];Math.max(c,h)<4.5?p.push('Button text may be hard to read on this colour. We picked the clearer text colour for you, but a lighter or darker shade will read better.'):l===s&&p.push('This is a dark colour, so buttons use light text.');let b=a,d=0;for(;u(b,r)<4.5&&d<20;)b=i(a,.05*(d+1)),d++;b!==a&&p.push('This colour is hard to read on the dark background, so header text uses a lighter shade of it.');return{onAccent:l,accentText:b,tips:p}},e.pushRecent=function(t,r,o=8){const s=n(r);return s?[s,...(t??[]).filter(t=>t!==s)].slice(0,o):t??[]};const t=(t,n=0,r=1)=>Math.min(r,Math.max(n,t));function n(t){const n=t.trim().replace(/^#/,'');return/^[0-9a-fA-F]{3}$/.test(n)?'#'+n.split('').map(t=>t+t).join('').toUpperCase():/^[0-9a-fA-F]{6}$/.test(n)?'#'+n.toUpperCase():null}function r(t){const r=(n(t)??'#000000').slice(1);return{r:parseInt(r.slice(0,2),16),g:parseInt(r.slice(2,4),16),b:parseInt(r.slice(4,6),16)}}function o({r:n,g:r,b:o}){return'#'+[n,r,o].map(n=>Math.round(t(n,0,255)).toString(16).padStart(2,'0')).join('').toUpperCase()}function s({h:t,s:n,v:r}){const o=(t%360+360)%360/60,s=r*n,a=s*(1-Math.abs(o%2-1)),c=r-s,[u,i,h]=o<1?[s,a,0]:o<2?[a,s,0]:o<3?[0,s,a]:o<4?[0,a,s]:o<5?[a,0,s]:[s,0,a];return{r:255*(u+c),g:255*(i+c),b:255*(h+c)}}const a=t=>o(s(t));function c(t){const n=t=>{const n=t/255;return n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4)},{r:o,g:s,b:a}=r(t);return.2126*n(o)+.7152*n(s)+.0722*n(a)}function u(t,n){const r=c(t),o=c(n);return(Math.max(r,o)+.05)/(Math.min(r,o)+.05)}function i(t,n){const{r:s,g:a,b:c}=r(t),u=n>0?255:0,i=Math.abs(n);return o({r:s+(u-s)*i,g:a+(u-a)*i,b:c+(u-c)*i})}},1210,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.webLine=function(e,t){const u=n.default.flatten(e)||{},f='number'==typeof u.fontSize?u.fontSize:t,l='number'==typeof u.lineHeight?u.lineHeight:(0,o.lineFor)(f);return{lineHeight:String(Math.max(l/f,o.MIN_LINE))}},r(d[0]);var e,t=r(d[1]),n=(e=t)&&e.__esModule?e:{default:e},o=r(d[2])},1211,[122,46,1209]); +__d(function(g,_r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"localRepositories",{enumerable:!0,get:function(){return s}});var e=_r(d[0]);const a=()=>e.useStore.getState(),t=e=>Promise.resolve(e),s={customers:{update:async e=>a().updateCustomer(e),setAllergy:async(e,t)=>a().setAllergy(e,t)},menu:{updateItem:async(e,t)=>a().updateMenuItem(e,t),setSignOff:async(e,t)=>a().setSignOff(e,t)},orders:{placeFromBasket:e=>t(a().placeOrder(e)),accept:async(e,t,s)=>a().acceptOrder(e,t,s),setStatus:async(e,t,s)=>a().setOrderStatus(e,t,s),acknowledgeAllergy:async(e,t)=>a().ackOrderAllergy(e,t),acknowledgeReadiness:async(e,t,s)=>a().ackReadiness(e,t,s),recordHandoverCheck:async(e,t)=>a().handoverCheck(e,t),signAllergyStep:async(e,t,s)=>a().signAllergyStep(e,t,s),customerSignal:async(e,t)=>a().customerSignal(e,t),setSplit:async(e,t,s)=>a().setSplit(e,t,s),payTable:async(e,t)=>a().payTable(e,t)},bookings:{create:e=>t(a().createBooking(e)),setStatus:async(e,t)=>a().setBookingStatus(e,t),decide:async(e,t,s)=>a().decideBooking(e,t,s),acknowledgeAllergy:async(e,t)=>a().ackBookingAllergy(e,t),seatWalkIn:(e,s,n,c)=>t(a().seatWalkIn(e,s,n,c)),assignTable:async(e,t)=>a().setBookingTable(e,t),undoWalkIn:async e=>a().undoWalkIn(e),update:async(e,t)=>a().updateBooking(e,t)},waitlist:{join:(e,s,n,c)=>t(a().joinWaitlist(e,s,n,c)),setStatus:async(e,t)=>a().setWaitlistStatus(e,t),addWalkIn:async(e,t)=>a().addWalkIn(e,t)},loyalty:{addStamp:async(e,t,s)=>a().addStamp(e,t,s),redeemReward:async(e,t)=>a().redeemReward(e,t)},giftCards:{purchase:(e,s,n,c)=>t(a().buyGiftCard(e,s,n,c))},calendar:{addEvent:async e=>a().addEvent(e)},feedback:{add:async e=>a().addRating(e)},restaurants:{updateSettings:async(e,t)=>a().updateSettings(e,t)},alerts:{acknowledge:async(e,t)=>a().ackAlert(e,t)}}},1212,[872]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"orderAtTableOn",{enumerable:!0,get:function(){return t}});const t=t=>!!t&&(t.settings.orderAtTable??!0)},1213,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/customer-app/assets/assets/brand/3idiots.df4a76d2130f0e5b0042f06a8c88693a.png",width:1024,height:1024,toString(){return this.uri}}},1214,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/customer-app/assets/assets/brand/cecchinis.ebf752fef363247848ae7c0d91938765.png",width:1024,height:1024,toString(){return this.uri}}},1215,[]); +__d(function(s,t,i,r,c,e,a){"use strict";c.exports={uri:"/wildings/customer-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png",width:1024,height:1024,toString(){return this.uri}}},1216,[]); +__d(function(s,t,i,r,e,n,a){"use strict";e.exports={uri:"/wildings/customer-app/assets/assets/brand/yasmins.8482602e9f0a965655924835625cb02b.png",width:1024,height:1024,toString(){return this.uri}}},1217,[]); +__d(function(s,t,i,a,e,r,n){"use strict";e.exports={uri:"/wildings/customer-app/assets/assets/brand/williewastles.055a77893ced99bf3a6c5402ba5baac6.png",width:1024,height:1024,toString(){return this.uri}}},1218,[]); +__d(function(e,t,s,r,i,n,u){"use strict";i.exports={uri:"/wildings/customer-app/assets/assets/brand/rupeeroom.689e6fb536dc0845eeb174a1ec7bd346.png",width:1024,height:1024,toString(){return this.uri}}},1219,[]); +__d(function(t,s,i,a,r,e,n){"use strict";r.exports={uri:"/wildings/customer-app/assets/assets/brand/smokinggoat.20a3a1970596ab43c5d6468d4ed549a7.png",width:1024,height:1024,toString(){return this.uri}}},1220,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/customer-app/assets/assets/brand/pizzaioli.db8c000b62ee407121aa8b90ce45e170.png",width:1024,height:1024,toString(){return this.uri}}},1221,[]); +__d(function(t,s,e,i,r,n,a){"use strict";r.exports={uri:"/wildings/customer-app/assets/assets/brand/drunkencoo.f6d92af3b14e4205a3deaf4434754c51.png",width:1024,height:1024,toString(){return this.uri}}},1222,[]); +__d(function(t,s,i,r,a,e,n){"use strict";a.exports={uri:"/wildings/customer-app/assets/assets/brand/abbotsford.b26602bba5ce4969733c5422a45ad053.png",width:1024,height:1024,toString(){return this.uri}}},1223,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/customer-app/assets/assets/brand/kirkton.bcf8d846df4861474d224a7a77f498fb.png",width:1024,height:1024,toString(){return this.uri}}},1224,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/customer-app/assets/assets/brand/greenside.9d1556db97dcb903a3c57e2063ee2255.png",width:1024,height:1024,toString(){return this.uri}}},1225,[]); +__d(function(s,t,i,r,n,d,e){"use strict";n.exports={uri:"/wildings/customer-app/assets/assets/brand/wildings.076f4fcd06d19a0af0205c410f461b14.png",width:1024,height:1024,toString(){return this.uri}}},1226,[]); +__d(function(t,i,s,e,r,c,n){"use strict";r.exports={uri:"/wildings/customer-app/assets/assets/brand/kirkmichael.63b13cde7fd82eb622622b39ac80c394.png",width:1024,height:1024,toString(){return this.uri}}},1227,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/customer-app/assets/assets/brand/souters.f4c58d9349b6e1700fe5abcc9e9b665c.png",width:1024,height:1024,toString(){return this.uri}}},1228,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/customer-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png",width:512,height:512,toString(){return this.uri}}},1229,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/customer-app/assets/assets/brand/saltmarsh.85a6a65732635e5148478d743d9ca884.png",width:512,height:512,toString(){return this.uri}}},1230,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/customer-app/assets/assets/brand/brae.8de9e89ac30966c6669de990370d8e40.png",width:512,height:512,toString(){return this.uri}}},1231,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/customer-app/assets/assets/brand/3idiots-hero.e5dfd53739f05086b1956e72d585a66a.png",width:1024,height:1024,toString(){return this.uri}}},1232,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/customer-app/assets/assets/brand/cecchinis-hero.f77780fcc94fd668cf35d66d6dc52d81.png",width:1024,height:1024,toString(){return this.uri}}},1233,[]); +__d(function(s,t,r,i,e,a,c){"use strict";e.exports={uri:"/wildings/customer-app/assets/assets/brand/mrbasrais-hero.4ce74641cfcf52d099157c84005b9d2a.png",width:1024,height:1024,toString(){return this.uri}}},1234,[]); +__d(function(s,t,e,i,r,a,n){"use strict";r.exports={uri:"/wildings/customer-app/assets/assets/brand/yasmins-hero.a5aef62e37dfcecbe0afc056186f4ad9.png",width:1024,height:1024,toString(){return this.uri}}},1235,[]); +__d(function(s,t,i,e,r,a,d){"use strict";r.exports={uri:"/wildings/customer-app/assets/assets/brand/williewastles-hero.b9d53d27b66f903b5618a7177b2ffad4.png",width:1024,height:1024,toString(){return this.uri}}},1236,[]); +__d(function(t,r,s,a,e,i,n){"use strict";e.exports={uri:"/wildings/customer-app/assets/assets/brand/rupeeroom-hero.969fa372add526aaacf3a6c009b8ac92.png",width:1024,height:1024,toString(){return this.uri}}},1237,[]); +__d(function(t,s,e,i,r,d,n){"use strict";r.exports={uri:"/wildings/customer-app/assets/assets/brand/smokinggoat-hero.0588f17ef0eed7f757f22916cd4d37db.png",width:1600,height:900,toString(){return this.uri}}},1238,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/customer-app/assets/assets/brand/pizzaioli-hero.1896657c08264cefb49b401891d5448d.png",width:1024,height:1024,toString(){return this.uri}}},1239,[]); +__d(function(t,s,r,e,i,n,c){"use strict";i.exports={uri:"/wildings/customer-app/assets/assets/brand/drunkencoo-hero.65c21c4da9e466cf4bffc969639a1427.png",width:1600,height:900,toString(){return this.uri}}},1240,[]); +__d(function(t,s,e,r,i,c,n){"use strict";i.exports={uri:"/wildings/customer-app/assets/assets/brand/abbotsford-hero.78fcb8ee06ee22c4ca659c9254db7512.png",width:1024,height:1024,toString(){return this.uri}}},1241,[]); +__d(function(t,s,i,r,e,n,d){"use strict";e.exports={uri:"/wildings/customer-app/assets/assets/brand/kirkton-hero.9d0837b292c2f4f30f4521d806bb28c3.png",width:1024,height:1024,toString(){return this.uri}}},1242,[]); +__d(function(s,t,e,i,r,c,n){"use strict";r.exports={uri:"/wildings/customer-app/assets/assets/brand/greenside-hero.1caec5a6cb939434cccb5f3a613b50f8.png",width:1024,height:1024,toString(){return this.uri}}},1243,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/customer-app/assets/assets/brand/wildings-hero-logo-text.4661e4b935726f2511f9c17a1567c89a.png",width:1024,height:1024,toString(){return this.uri}}},1244,[]); +__d(function(t,i,s,e,r,c,n){"use strict";r.exports={uri:"/wildings/customer-app/assets/assets/brand/kirkmichael-hero.63b13cde7fd82eb622622b39ac80c394.png",width:1024,height:1024,toString(){return this.uri}}},1245,[]); +__d(function(t,s,r,e,i,n,a){"use strict";i.exports={uri:"/wildings/customer-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png",width:1024,height:1024,toString(){return this.uri}}},1246,[]); +__d(function(_g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.getFix=function(e=1e4){const t='undefined'!=typeof navigator?navigator.geolocation:void 0;return t?new Promise(o=>{let n=!1;const c=e=>{n||(n=!0,o(e))},u=setTimeout(()=>c('timeout'),e+1500);try{t.getCurrentPosition(e=>{clearTimeout(u),c({lat:e.coords.latitude,lng:e.coords.longitude,acc:e.coords.accuracy??999})},e=>{clearTimeout(u),c(1===e.code?'denied':3===e.code?'timeout':'unavailable')},{enableHighAccuracy:!0,timeout:e,maximumAge:0})}catch{clearTimeout(u),c('unsupported')}}):Promise.resolve('unsupported')},_e.locationAllowed=async function(){try{const e=await(navigator.permissions?.query({name:'geolocation'}));return'granted'===e?.state}catch{return!1}}},1247,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"VAPID_PUBLIC_KEY",{enumerable:!0,get:function(){return t}});const t='BC3MoXpycbFY4Nf3czfBMaiD0iaMd1ugc70iUWZUiaScERZibFBsI9cmPAiNrlPN0b2_wJR-wgutj4eC8suarQ0'},1248,[]); +__d(function(g,r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"FALLBACK_PAY",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"ymdOf",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"dateOf",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"plusDays",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"daysBetween",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"isValidYmd",{enumerable:!0,get:function(){return y}}),_e.cleanPay=function(t){const n={...e,...t??{}};return{tipsFrequency:['weekly','fortnightly','monthly'].includes(n.tipsFrequency)?n.tipsFrequency:'fortnightly',tipsAnchorPayday:y(String(n.tipsAnchorPayday))?n.tipsAnchorPayday:e.tipsAnchorPayday,tipsEndsDaysBefore:Math.max(0,Math.min(13,Math.round(Number(n.tipsEndsDaysBefore)||0))),wagePayDay:Math.max(1,Math.min(31,Math.round(Number(n.wagePayDay)||28))),wageCutoffDay:Math.max(1,Math.min(28,Math.round(Number(n.wageCutoffDay)||1))),weekendRule:'before'===n.weekendRule||'after'===n.weekendRule?n.weekendRule:'none'}},_e.adjustWeekend=s,_e.wagePeriod=f,_e.tipsPeriod=m,_e.nextToPay=function(e,t,n){for(let a=-2;a<=2;a++){const u='wage'===t?f(e,n,a):m(e,n,a);if((u.payday??u.end)>=n)return{period:u,offset:a}}return{period:'wage'===t?f(e,n,0):m(e,n,0),offset:0}},_e.customPeriod=function(e,t){return{kind:'custom',start:e,end:t,key:`c-${e}-${t}`}},Object.defineProperty(_e,"ukDate",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"dayMonth",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"dm",{enumerable:!0,get:function(){return M}}),Object.defineProperty(_e,"rangeText",{enumerable:!0,get:function(){return $}}),_e.parseUk=function(e){const n=e.trim();if(y(n))return n;const a=/^(\d{1,2})[/.-](\d{1,2})[/.-](\d{2}|\d{4})$/.exec(n);if(!a)return null;const u=`${2===a[3].length?2e3+Number(a[3]):Number(a[3])}-${t(Number(a[2]))}-${t(Number(a[1]))}`;return y(u)?u:null},Object.defineProperty(_e,"decH",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"hMm",{enumerable:!0,get:function(){return F}});const e={tipsFrequency:'weekly',tipsAnchorPayday:'2026-01-05',tipsEndsDaysBefore:1,wagePayDay:31,wageCutoffDay:1,weekendRule:'none'},t=e=>String(e).padStart(2,'0'),n=e=>`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}`,a=e=>{const[t,n,a]=e.split('-').map(Number);return new Date(t,n-1,a,12)},u=(e,t)=>{const u=a(e);return u.setDate(u.getDate()+t),n(u)},o=(e,t)=>Math.round((a(t).getTime()-a(e).getTime())/864e5),i=(e,t)=>new Date(e,t+1,0).getDate(),c=(e,t,a)=>{const u=new Date(e,t,1,12),o=u.getFullYear(),c=u.getMonth();return n(new Date(o,c,Math.min(a,i(o,c)),12))},y=e=>/^\d{4}-\d{2}-\d{2}$/.test(e)&&n(a(e))===e;function s(e,t="none"){if('none'===t)return e;const n=a(e).getDay();return 6===n?u(e,'before'===t?-1:2):0===n?u(e,'before'===t?-2:1):e}function d(e,t,n){const o=c(t,n,e.wageCutoffDay),i=u(c(t,n+1,e.wageCutoffDay),-1),y=a(i);let d=c(y.getFullYear(),y.getMonth(),e.wagePayDay);return dn.end))break;a++}}return a}function m(e,t,n=0){return p(e,h(e,t)+n)}const b=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],D=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],w=e=>{const[t,n,a]=e.split('-');return`${a}/${n}/${t}`},P=e=>{const t=a(e);return`${b[t.getDay()]} ${t.getDate()} ${D[t.getMonth()]}`},M=e=>{const t=a(e);return`${t.getDate()} ${D[t.getMonth()]}`},$=(e,t,n=" to ")=>e.slice(0,4)===t.slice(0,4)?`${M(e)}${n}${M(t)}`:`${M(e)} ${e.slice(0,4)}${n}${M(t)} ${t.slice(0,4)}`;const k=e=>(Math.round(e/60*100)/100).toFixed(2),F=e=>`${Math.floor(e/60)}:${t(Math.round(e)%60)}`},1249,[]); +__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.payFor=u,_e.useVenuePay=function(s){const r=(0,n.useRestaurant)(s),o=(0,t.useOnboard)(e=>e.answers);return(0,e.useMemo)(()=>u(s,r?.settings.pay,o),[s,r?.settings.pay,o])},_e.venueRange=function(e,n,t,s){const u='wage'===n?(0,r.wagePeriod)(e,(0,r.ymdOf)(s),t):(0,r.tipsPeriod)(e,(0,r.ymdOf)(s),t),o=(0,r.dateOf)(u.start);o.setHours(0,0,0,0);const y=(0,r.dateOf)(u.end);return y.setHours(0,0,0,0),{s:o,e:y,key:u.key,payday:u.payday}};var e=_r(d[0]),n=_r(d[1]),t=_r(d[2]),s=_r(d[3]),r=_r(d[4]);function u(e,n,t){if(n)return{pay:(0,r.cleanPay)(n),source:'settings'};const u=t[e]?.pay??s.SEEDED_ANSWERS[e]?.pay;return u?{pay:(0,r.cleanPay)(u),source:'questionnaire'}:{pay:r.FALLBACK_PAY,source:'none'}}},1250,[30,1022,1251,1252,1249]); +__d(function(_g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useOnboard",{enumerable:!0,get:function(){return l}});var e,s=r(_d[0]),t=(e=s)&&e.__esModule?e:{default:e},p=r(_d[1]),u=r(_d[2]);const n=()=>{const e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`},l=(0,p.create)()((0,u.persist)(e=>({setup:{},answers:{},goals:{},replay:null,markStep:(s,t,p)=>e(e=>({setup:{...e.setup,[s]:{...e.setup[s]??{steps:{}},steps:{...e.setup[s]?.steps??{},[t]:p}}}})),welcome:s=>e(e=>({setup:{...e.setup,[s]:{...e.setup[s]??{steps:{}},welcomed:n()}}})),finish:s=>e(e=>({replay:null,setup:{...e.setup,[s]:{...e.setup[s]??{steps:{}},welcomed:e.setup[s]?.welcomed??n(),finished:n()}}})),restart:s=>e(e=>({setup:{...e.setup,[s]:{steps:{}}}})),setReplay:s=>e({replay:s}),saveAnswers:(s,t)=>e(e=>({answers:{...e.answers,[s]:t}})),setGoal:(s,t)=>e(e=>{const p={...e.goals};return t?p[s]=t:delete p[s],{goals:p}})}),{name:'covercharge-onboard-v1',version:1,storage:(0,u.createJSONStorage)(()=>t.default),partialize:e=>({setup:e.setup,answers:e.answers,goals:e.goals})}))},1251,[1082,952,1091]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"SEEDED_ANSWERS",{enumerable:!0,get:function(){return f}});var n=r(d[0]),t=e(r(d[1])),l=e(r(d[2])),o=e(r(d[3])),s=e(r(d[4])),u=e(r(d[5])),p=e(r(d[6])),h=r(d[7]),c=r(d[8]);const f={...Object.fromEntries(Object.entries(n.queuedVenues).map(([e,n])=>[e,(0,h.cleanQuestionnaire)(n.questionnaire,e)??{}])),greenside:(0,h.cleanQuestionnaire)(t.default,'greenside')??{},abbotsford:(0,h.cleanQuestionnaire)(l.default,'abbotsford')??{},kirkton:(0,h.cleanQuestionnaire)(o.default,'kirkton')??{},wildings:(0,h.cleanQuestionnaire)(s.default,'wildings')??{},kirkmichael:(0,h.cleanQuestionnaire)(u.default,'kirkmichael')??{},souters:(0,h.cleanQuestionnaire)(p.default,'souters')??{},anchorage:{source:'from-config',submittedAt:'2026-10-01',onboardedAt:'2026-10-01',pay:c.ANCHORAGE_PAY},saltmarsh:{source:'signup-form',submittedAt:'2026-10-27',venue:{name:'The Venue',tagline:'Seasonal small plates by the harbour (fictional)',address:'4 Quay Street, Port Ailsa (fictional)',phone:'01632 960 418',email:'hello@thevenue.example',website:'thevenue.example'},tables:{template:'bistro',tables:14,covers:48,areas:['Inside','Terrace']},team:[{name:'Morven Reid (example)',role:'owner',job:'Owner',email:'morven@thevenue.example'},{name:'Callum Shaw (example)',role:'manager',job:'General manager',email:'callum@thevenue.example'},{name:'Isla Grant (example)',role:'staff',job:'Head chef'},{name:'Ruaridh Bell (example)',role:'staff',job:'Waiter',phone:'07700 900 311'},{name:'Ellie Muir (example)',role:'staff',job:'Waiter'}],suppliers:[{name:'Ailsa Fish Co (example)',category:'Fish',phone:'01632 960 101'},{name:'Hillside Dairy (example)',category:'Dairy',email:'orders@hillside.example'}],pay:{tipsFrequency:'fortnightly',tipsAnchorPayday:'2026-11-06',tipsEndsDaysBefore:5,wagePayDay:28,wageCutoffDay:20,weekendRule:'before'},accounts:[{provider:'gmail',handle:'hello@thevenue.example'},{provider:'wix',handle:'thevenue.example'},{provider:'instagram',handle:'@thevenue.demo'},{provider:'facebook',handle:'The Venue'},{provider:'google-business',handle:'The Venue'},{provider:'sumup',handle:'The Venue'},{provider:'xero',handle:'The Venue Ltd'}],features:{bookings:!0,takeaway:!0,orderAtTable:!0,tips:!0,rota:!0,games:!1,specials:!0},notes:'Fictional example answers for the demo venue.'}}},1252,[6,1253,1254,1255,867,866,1256,865,3]); +__d(function(e,a,n,s,o,r,t){o.exports={version:1,venueId:"greenside",source:"from-config",submittedAt:"2026-11-06",venue:{name:"The Greenside Restaurant",tagline:"Restaurant \u2022 Wood Fired Pizza \u2022 Maybole",address:"5 Greenside, Maybole, South Ayrshire KA19 7DG",phone:"01655 889685",email:"info@thegreensiderestaurant.co.uk",website:"https://thegreensiderestaurant.co.uk/",hasLogo:!0,emailNeedsConfirmation:!0},hours:{days:{0:["10:00","00:00"],1:null,2:null,3:["10:00","23:00"],4:["10:00","23:00"],5:["10:00","00:00"],6:["10:00","00:00"]},note:"Closed Monday and Tuesday. Venue Wednesday and Thursday 10:00\u201323:00, Friday to Sunday 10:00\u201300:00. Kitchen Wednesday, Thursday and Sunday 10:00\u201320:00; Friday and Saturday 10:00\u201321:00. Cash only."},tables:{template:"restaurant",tables:null,covers:null,areas:["Restaurant","Beer garden"],needsConfirmation:!0,note:"Historical figure about 50 covers inside and about 48 in seasonal beer garden (former GM LinkedIn). Names, tables and covers need Gordon's confirmation. Bar and restaurant only \u2014 no accommodation."},team:[],suppliers:[],accounts:[],features:{bookings:!0,takeaway:!1,orderAtTable:!1,tips:!0,rota:!0,games:!0,specials:!0},notes:"Separate greenside tenant. No staff, invites or table plan yet. Cash only; no card payments or deposits. CoverCharge manager-confirmed table requests only, with Call01655 889685 as backup. Menu, allergens, public email, pay settings and deposit policy need confirmation. No external booking or ordering links."}},1253,[]); +__d(function(e,o,a,t,r,n,s){r.exports={version:1,venueId:"abbotsford",source:"from-config",submittedAt:"2026-11-06",venue:{name:"The Abbotsford Hotel",tagline:"Get Hungry. Get Curious.",address:"14 Corsehill Road, Ayr KA7 2ST",phone:"01292 261506",email:"info@abbotsfordhotel.co.uk",website:"https://www.abbotsfordhotel.co.uk/",hasLogo:!0},hours:{days:{0:["10:00","20:30"],1:["10:00","20:30"],2:["10:00","20:30"],3:["10:00","20:30"],4:["10:00","20:30"],5:["10:00","20:30"],6:["10:00","20:30"]},note:"Daily 10:00\u201320:30 \u2014 to confirm with the hotel. Copper Bar hours to confirm."},tables:{template:"restaurant",tables:null,covers:null,areas:[],needsConfirmation:!0,note:"Rowan seats up to 120 (published). Restaurant and bar covers/tables unknown."},team:[],suppliers:[],accounts:[{provider:"facebook",handle:"TheAbbotsfordHotel"},{provider:"instagram",handle:"@abbotsfordhotelayr"},{provider:"tiktok",handle:"@the.abbotsford.hotel.ayr"}],features:{bookings:!0,takeaway:!1,orderAtTable:!1,tips:!0,rota:!0,games:!0,specials:!0},notes:"Separate abbotsford tenant. Epicurious restaurant and The Copper Bar. CoverCharge dining and room requests require manager confirmation. No external booking links, no room inventory module or external booking integrations. Zero staff/invites/sample data. Deposit, manager, team, table plan/covers, Copper Bar hours, dog policy and allergens to confirm."}},1254,[]); +__d(function(e,n,t,a,o,r,i){o.exports={version:1,venueId:"kirkton",source:"from-config",submittedAt:"2026-11-06",venue:{name:"The Kirkton Inn",tagline:"Bar and restaurant in Dalrymple, Ayrshire \u2014 Burns country hospitality",address:"1-3 Main Street, Dalrymple, East Ayrshire KA6 6DF",phone:"",email:"",website:"",hasLogo:!0},hours:{days:{0:null,1:null,2:null,3:null,4:null,5:null,6:null},note:"Current opening and kitchen hours to confirm. No service times set."},tables:{template:"restaurant",tables:null,covers:null,areas:[],needsConfirmation:!0,note:"Table plan and capacity to confirm."},team:[],suppliers:[],accounts:[],features:{bookings:!0,takeaway:!1,orderAtTable:!1,tips:!0,rota:!0,games:!0,specials:!0},notes:"Separate kirkton tenant. No staff or personal links. Room inventory and current letting to confirm; room functionality deferred. No external booking integrations. Phone, public email, website, current hours, capacity, table plan, takeaway, pay and deposit policy to confirm. Archived 2019 menus are provisional and not saleable stock."}},1255,[]); +__d(function(e,o,r,s,a,t,n){a.exports={version:1,venueId:"souters",source:"from-config",submittedAt:"2026-11-05",onboardedAt:"2026-11-05",venue:{name:"Souter's Inn",tagline:"Culinary excellence meets country hospitality in Kirkoswald",address:"47 Main Road, Kirkoswald, South Ayrshire KA19 8HY",phone:"01655 760653",email:"souters@southernayr.com",website:"https://www.soutersinn.com/",hasLogo:!0},hours:{days:{0:["09:00","21:00"],1:["09:00","21:00"],2:["09:00","21:00"],3:["09:00","21:00"],4:["09:00","21:00"],5:["09:00","21:00"],6:["09:00","21:00"]},note:"Open daily 9am\u20139pm. Breakfast 9\u201311.45am; main food service from noon. Confirm last orders with the venue."},tables:{template:"restaurant",tables:0,covers:130,areas:[]},team:[],suppliers:[{name:"Pollok Williamson Butchers",category:"Meat",phone:"",email:""}],accounts:[{provider:"instagram",handle:"@soutersinn"},{provider:"facebook",handle:"Souter's Inn"},{provider:"gmail",handle:"souters@southernayr.com"},{provider:"tripadvisor",handle:"Souter's Inn Kirkoswald"},{provider:"google-business",handle:"Souter's Inn"}],features:{bookings:!0,takeaway:!0,orderAtTable:!1,tips:!0,rota:!0,games:!0,specials:!0},notes:"Part of Southern Ayr Limited (Brian Daly). Sister venues: Abbotsford Hotel, The Brig, Bridges Bar, Wellingtons. Bookings: guests request a table in CoverCharge. Deposit default suggested \xa310pp from party of 6 \u2014 confirm with venue (published \xa310pp for some events). Regional Scottish Thistle Award Best Eating Experience 2026. Brand accent from official logo SVG fill #A4622E. Real table plan, manager contact, team, priced menu and deposit confirmation still required; no tables or staff seeded."}},1256,[]); +__d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.pickPhotos=function(t={}){const a=t.source??'camera';return'undefined'==typeof document?n(a):new Promise(t=>{const n=document.createElement('input');n.type='file',n.accept='image/*',n.multiple=!0,'camera'===a&&n.setAttribute('capture','environment'),n.setAttribute('data-testid','camera'===a?'photo-input':'gallery-input'),n.style.display='none',n.onchange=async()=>{const a=Array.from(n.files??[]).slice(0,8),o=[];for(const t of a)try{o.push(await r(t))}catch{}n.remove(),t(o)},document.body.appendChild(n),n.click()})},e.shrink=r,e.uploadPhoto=async function(n,r,o,c){const i=a.useSync.getState();if('staff'!==i.kind||!i.venueId)return null;try{const a=await(await fetch(o)).blob(),s=`${i.venueId}/${n}/${r}-${Date.now()}-${c}.jpg`,{error:u}=await(0,t.getSupabase)().storage.from('cashup-photos').upload(s,a,{contentType:'image/jpeg',upsert:!1});return u?null:s}catch{return null}},e.photoUrl=async function(a){if(a.startsWith('data:'))return a;try{const{data:n}=await(0,t.getSupabase)().storage.from('cashup-photos').createSignedUrl(a,600);return n?.signedUrl??null}catch{return null}},_r(d[0]);var t=_r(d[1]),a=_r(d[2]);async function n(t){try{const a=_r(d[3],"expo-image-picker"),n={mediaTypes:['images'],quality:.7,base64:!0,allowsMultipleSelection:'gallery'===t,selectionLimit:8};if('camera'===t){if(!(await a.requestCameraPermissionsAsync()).granted)return[]}const r='camera'===t?await a.launchCameraAsync(n):await a.launchImageLibraryAsync(n);return r.canceled?[]:r.assets.filter(t=>t.base64).map(t=>`data:image/jpeg;base64,${t.base64}`)}catch{return[]}}function r(t,a=1600){return new Promise((n,r)=>{const o=URL.createObjectURL(t),c=new Image;c.onload=()=>{const t=Math.min(1,a/Math.max(c.width,c.height)),r=document.createElement('canvas');r.width=Math.round(c.width*t),r.height=Math.round(c.height*t),r.getContext('2d').drawImage(c,0,0,r.width,r.height),URL.revokeObjectURL(o),n(r.toDataURL('image/jpeg',.78))},c.onerror=()=>{URL.revokeObjectURL(o),r(new Error('not an image'))},c.src=o})}},1257,[122,863,820,1035]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return c}});var t=r(d[0]),n=r(d[1]),s=r(d[2]);const o={images:'image/*',videos:'video/mp4,video/quicktime,video/x-m4v,video/*',livePhotos:''};var c={launchImageLibraryAsync:async({mediaTypes:t=['images'],allowsMultipleSelection:n=!1,base64:s=!1})=>'undefined'==typeof window||'undefined'==typeof document?{canceled:!0,assets:null}:await u({mediaTypes:t,allowsMultipleSelection:n,base64:s}),launchCameraAsync:async({mediaTypes:t=['images'],allowsMultipleSelection:n=!1,base64:s=!1,cameraType:o})=>'undefined'==typeof window||'undefined'==typeof document?{canceled:!0,assets:null}:await u({mediaTypes:t,allowsMultipleSelection:n,capture:o??!0,base64:s}),getCameraPermissionsAsync:async()=>l(),requestCameraPermissionsAsync:async()=>l(),getMediaLibraryPermissionsAsync:async t=>l(),requestMediaLibraryPermissionsAsync:async t=>l()};function l(){return{status:t.PermissionStatus.GRANTED,expires:'never',granted:!0,canAskAgain:!0}}function u({mediaTypes:t,capture:o=!1,allowsMultipleSelection:c=!1,base64:l}){const u=w((0,s.parseMediaTypes)(t)),p=document.createElement('input');if(p.style.display='none',p.setAttribute('type','file'),p.setAttribute('accept',u),p.setAttribute('id',String(Math.random())),p.setAttribute('data-testid','file-input'),c&&p.setAttribute('multiple','multiple'),o)switch(o){case!0:p.setAttribute('capture','camera');break;case n.CameraType.front:p.setAttribute('capture','user');break;case n.CameraType.back:p.setAttribute('capture','environment')}return document.body.appendChild(p),new Promise(t=>{p.addEventListener('change',async()=>{if(p.files?.length){const n=c?p.files:[p.files[0]];try{const s=await Promise.all(Array.from(n).filter(t=>null!=t).map(t=>f(t,{base64:l})));t({canceled:!1,assets:s})}catch(n){t(Promise.reject(n))}}else t({canceled:!0,assets:null});document.body.removeChild(p)}),p.addEventListener('cancel',()=>{p.dispatchEvent(new Event('change'))});const n=new MouseEvent('click');p.dispatchEvent(n)})}async function p(t){return new Promise(n=>{const s=new Image;s.onload=()=>{n({width:s.naturalWidth??s.width,height:s.naturalHeight??s.height})},s.onerror=()=>n({width:0,height:0}),s.src=t})}async function y(t){return new Promise(n=>{const s=document.createElement('video');s.preload='metadata',s.onloadedmetadata=()=>{n({width:s.videoWidth,height:s.videoHeight,duration:s.duration})},s.onerror=()=>n({width:0,height:0,duration:0}),s.src=t})}async function h(t){return new Promise((n,s)=>{const o=new FileReader;o.onerror=()=>{s(new Error('Failed to read the selected media because the operation failed.'))},o.onload=t=>{const o=t.target?.result;'string'==typeof o?n(o.split(',')?.[1]??''):s(new Error('Failed to read file as base64'))},o.readAsDataURL(t)})}async function f(t,n){const s=t.type,o=URL.createObjectURL(t);let c,l;if(s.startsWith('image/'))c=await p(o);else{if(!s.startsWith('video/'))throw new Error(`Unsupported file type: ${s}. Only images and videos are supported.`);c=await y(o)}return n.base64&&(l=await h(t)),{uri:o,width:c.width,height:c.height,type:s.startsWith('image/')?'image':'video',mimeType:s,fileName:t.name,fileSize:t.size,file:t,...void 0!==c.duration&&{duration:c.duration},...l&&{base64:l}}}function w(t){const n=t.filter(t=>'livePhotos'!==t);if(0===n.length)return'image/*';let s='';for(const t of n)s.includes(o[t])||(s=s.concat(',',o[t]));return s}},1258,[570,1259,1260]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"MediaTypeOptions",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"VideoExportPreset",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"UIImagePickerControllerQualityType",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"UIImagePickerPresentationStyle",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"UIImagePickerPreferredAssetRepresentationMode",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"CameraType",{enumerable:!0,get:function(){return l}});let t=(function(t){return t.All="All",t.Videos="Videos",t.Images="Images",t})({}),n=(function(t){return t[t.Passthrough=0]="Passthrough",t[t.LowQuality=1]="LowQuality",t[t.MediumQuality=2]="MediumQuality",t[t.HighestQuality=3]="HighestQuality",t[t.H264_640x480=4]="H264_640x480",t[t.H264_960x540=5]="H264_960x540",t[t.H264_1280x720=6]="H264_1280x720",t[t.H264_1920x1080=7]="H264_1920x1080",t[t.H264_3840x2160=8]="H264_3840x2160",t[t.HEVC_1920x1080=9]="HEVC_1920x1080",t[t.HEVC_3840x2160=10]="HEVC_3840x2160",t})({}),u=(function(t){return t[t.High=0]="High",t[t.Medium=1]="Medium",t[t.Low=2]="Low",t[t.VGA640x480=3]="VGA640x480",t[t.IFrame1280x720=4]="IFrame1280x720",t[t.IFrame960x540=5]="IFrame960x540",t})({}),o=(function(t){return t.FULL_SCREEN="fullScreen",t.PAGE_SHEET="pageSheet",t.FORM_SHEET="formSheet",t.CURRENT_CONTEXT="currentContext",t.OVER_FULL_SCREEN="overFullScreen",t.OVER_CURRENT_CONTEXT="overCurrentContext",t.POPOVER="popover",t.AUTOMATIC="automatic",t})({}),c=(function(t){return t.Automatic="automatic",t.Compatible="compatible",t.Current="current",t})({}),l=(function(t){return t.back="back",t.front="front",t})({})},1259,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.parseMediaTypes=p,e.mapDeprecatedOptions=function(s){if(!s.mediaTypes)return s;return{...s,mediaTypes:p(s.mediaTypes??[])}};var s=r(d[0]);function p(p){const n={Images:['images'],Videos:['videos'],All:['images','videos']};return p===s.MediaTypeOptions.Images||p===s.MediaTypeOptions.Videos||p===s.MediaTypeOptions.All?(console.warn('[expo-image-picker] `ImagePicker.MediaTypeOptions` have been deprecated. Use `ImagePicker.MediaType` or an array of `ImagePicker.MediaType` instead.'),n[p]):'string'==typeof p?[p]:p}},1260,[1259]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.readSheet=async function(l,u,c){const f=u.filter(t=>!t.startsWith('data:'));try{const u=n.useSync.getState();if('staff'!==u.kind||!u.venueId||!f.length)return{vals:o(c),reader:null,note:s};const{data:h,error:y}=await(0,t.getSupabase)().functions.invoke('cashup-read',{body:{kind:l,venueId:u.venueId,paths:f,fields:c.filter(t=>'text'!==t.kind).map(t=>({key:t.key,label:t.label,kind:t.kind}))}});if(y||!h||'object'!=typeof h||!h.vals)return{vals:o(c),reader:null,note:s};const p=o(c);for(const t of c){const n=h.vals[t.key];'number'==typeof n&&Number.isFinite(n)&&(p[t.key]=Math.round(100*n)/100)}const v=Object.values(p).filter(t=>null!=t).length;return v?{vals:p,categories:Array.isArray(h.categories)?h.categories:[],reader:String(h.reader??'photo reader'),note:`${v} figure${1===v?'':'s'} read from the photo. Check each one against the photo before you confirm.`}:{vals:p,reader:null,note:'The photo couldn\u2019t be read clearly, so type the figures from it.'}}catch{return{vals:o(c),reader:null,note:s}}};var t=r(d[0]),n=r(d[1]);const o=t=>Object.fromEntries(t.map(t=>[t.key,null])),s='Automatic reading isn\u2019t switched on yet, so type the figures from the photo. Nothing is filled in for you.'},1261,[863,820]); +__d(function(g,_r,_i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.pickSpreadsheet=function(){return'undefined'==typeof document?Promise.resolve({error:'Upload a spreadsheet from the Managers app in a web browser.'}):new Promise(e=>{const s=document.createElement('input');s.type='file',s.accept='.csv,.xlsx,text/csv,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',s.setAttribute('data-testid','sheet-input'),s.style.display='none',s.onchange=async()=>{const t=s.files?.[0];if(s.remove(),!t)return e(null);if(t.size>5242880)return e({error:'That file is over 5 MB. Export just the takings columns and try again.'});try{const s=/\.xlsx$/i.test(t.name)?await(0,c.readXlsx)(await t.arrayBuffer()):(0,r.parseCsv)(await t.text());e(s.length?{name:t.name,rows:s}:{error:'The file looks empty.'})}catch(s){e({error:s instanceof Error?s.message:'The file couldn\u2019t be read. Try saving it as CSV.'})}},document.body.appendChild(s),s.click()})},_e.SpreadsheetImport=function({rid:e,file:t,who:c,onClose:v,onSaved:w,locked:x}){const[y,$]=(0,s.useState)(!0),b=y?t.rows[0]:t.rows[0].map((e,s)=>`Column ${s+1}`),[j,k]=(0,s.useState)(()=>(0,r.guessMapping)(t.rows[0])),[C,T]=(0,s.useState)(!1),[D,S]=(0,s.useState)('map'),B=(0,n.useCashUp)(e=>e.cashUps),I=(0,s.useMemo)(()=>new Set(B.filter(s=>s.rid===e&&s.confirmedAt&&null!=(0,i.grossOf)(s.vals)).map(e=>e.date)),[B,e]),M=(0,s.useMemo)(()=>(0,r.buildPreview)(t.rows,j,y,I),[t.rows,j,y,I]),P=M.filter(e=>e.ok&&!(e.date&&x(e.date))),R=P.filter(e=>'saved'!==e.dup||C),z=P.filter(e=>'saved'===e.dup).length,L=M.filter(e=>!e.ok).length,U=M.filter(e=>e.ok&&e.date&&x(e.date)).length,E=null!=j.date&&null!=j.gross;return(0,u.jsxs)(l.Sheet,{visible:!0,onClose:v,title:"Upload a spreadsheet",maxWidth:1e3,testID:"sheet-import",children:[(0,u.jsx)(l.Muted,{children:`${t.name} \xb7 ${t.rows.length-(y?1:0)} row${t.rows.length-(y?1:0)==1?'':'s'}`}),'map'===D?(0,u.jsxs)(o.default,{style:{gap:10},testID:"sheet-map",children:[(0,u.jsx)(l.T,{size:17,weight:"semibold",children:"1. Which column is which?"}),(0,u.jsx)(l.Muted,{children:"Tip: Date and Gross takings are needed. Food, drink, card and cash are optional. Leave a column as \u201cNot in the file\u201d if you don\u2019t have it."}),(0,u.jsx)(l.Toggle,{testID:"sheet-header",label:"The first row is headings",value:y,onChange:$}),r.COLS.map(e=>(0,u.jsxs)(o.default,{style:{gap:4},testID:`sheet-col-${e.key}`,children:[(0,u.jsxs)(l.Row,{gap:6,children:[(0,u.jsx)(l.T,{weight:"semibold",children:e.label}),e.required?(0,u.jsx)(l.Badge,{kind:"gold",label:"NEEDED"}):(0,u.jsx)(l.Muted,{children:"optional"})]}),(0,u.jsxs)(l.Row,{wrap:!0,gap:6,children:[e.required?null:(0,u.jsx)(l.Chip,{label:"Not in the file",selected:null==j[e.key],onPress:()=>k({...j,[e.key]:void 0})}),b.map((s,o)=>(0,u.jsx)(l.Chip,{testID:`sheet-col-${e.key}-${o}`,label:s||`Column ${o+1}`,sub:y?void 0:t.rows[0][o],selected:j[e.key]===o,onPress:()=>{const s={...j};Object.keys(s).forEach(e=>{s[e]===o&&delete s[e]}),s[e.key]=o,k(s)}},o))]})]},e.key)),(0,u.jsx)(l.Button,{testID:"sheet-to-preview",label:"Preview",disabled:!E,onPress:()=>{S('preview'),f(`${M.filter(e=>e.ok).length} rows ready, ${L} with problems.`)}})]}):null,'preview'===D?(0,u.jsxs)(o.default,{style:{gap:10},testID:"sheet-preview",children:[(0,u.jsx)(l.T,{size:17,weight:"semibold",children:"2. Check the preview"}),(0,u.jsx)(o.default,{accessibilityLiveRegion:"polite",children:(0,u.jsx)(l.T,{testID:"sheet-summary",children:`${P.length} night${1===P.length?'':'s'} ready${L?` \xb7 ${L} row${1===L?'':'s'} with a problem (not saved)`:''}${U?` \xb7 ${U} signed off and locked (not changed)`:''}`})}),z?(0,u.jsx)(l.Banner,{kind:"warn",title:`${z} date${1===z?' already has':'s already have'} takings in CoverCharge`,children:(0,u.jsxs)(o.default,{style:{gap:6},children:[(0,u.jsx)(l.Toggle,{testID:"sheet-replace",label:"Replace those nights\u2019 takings with the spreadsheet",value:C,onChange:T}),(0,u.jsx)(l.Muted,{children:C?'Those nights will be replaced (the change is logged).':'Those nights are skipped; their saved takings are kept.'})]})}):null,M.slice(0,62).map(e=>{const s=e.ok&&'saved'===e.dup&&!C,t=e.ok&&!!e.date&&x(e.date),n=e.ok?t?'Locked: not changed':s?'Already saved: skipped':'saved'===e.dup?'Replaces saved takings':'Ready':e.errors.join('; ');return(0,u.jsxs)(o.default,{testID:`sheet-row-${e.line}`,accessible:!0,accessibilityLabel:`Row ${e.line}: ${e.date?m(e.date):'no date'}, gross ${p(e.vals.gross)}. ${n}`,style:{paddingVertical:8,gap:2,borderBottomWidth:1,borderBottomColor:h.colours.hairline,opacity:!e.ok||s||t?.75:1},children:[(0,u.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(l.T,{size:15,weight:"semibold",children:`Row ${e.line} \xb7 ${e.date?m(e.date):'no date'}`}),(0,u.jsx)(l.T,{size:15,weight:"semibold",colour:h.colours.goldLight,children:p(e.vals.gross)})]}),(()=>{const s=['food','drink','card','cash'].filter(s=>null!=j[s]&&null!=e.vals[s]).map(s=>`${s[0].toUpperCase()}${s.slice(1)} ${p(e.vals[s])}`);return s.length?(0,u.jsx)(l.T,{size:13,colour:h.colours.text,children:s.join(' \xb7 ')}):null})(),(0,u.jsx)(l.T,{size:13,colour:e.ok?h.colours.muted:h.colours.amber,children:n})]},e.line)}),M.length>62?(0,u.jsx)(l.Muted,{children:`\u2026and ${M.length-62} more rows.`}):null,(0,u.jsxs)(o.default,{style:{gap:8},children:[(0,u.jsx)(l.Button,{testID:"sheet-to-confirm",label:`Next: save ${R.length} night${1===R.length?'':'s'}`,disabled:!R.length,onPress:()=>S('confirm')}),(0,u.jsx)(l.Button,{kind:"secondary",label:"Change columns",onPress:()=>S('map')})]})]}):null,'confirm'===D?(0,u.jsxs)(o.default,{style:{gap:10},testID:"sheet-confirm",children:[(0,u.jsx)(l.T,{size:17,weight:"semibold",children:"3. Confirm"}),(0,u.jsxs)(o.default,{style:{borderWidth:1.5,borderColor:h.colours.gold,borderRadius:14,padding:12,gap:4,backgroundColor:h.colours.goldTint},accessibilityLiveRegion:"polite",children:[(0,u.jsx)(l.T,{size:18,weight:"semibold",colour:h.colours.gold,children:`Save takings for ${R.length} night${1===R.length?'':'s'}`}),(0,u.jsx)(l.T,{children:R.length?`${m(R.map(e=>e.date).sort()[0])} to ${m(R.map(e=>e.date).sort().slice(-1)[0])} \xb7 gross ${p(Math.round(100*R.reduce((e,s)=>e+(s.vals.gross??0),0))/100)} in total`:''}),(0,u.jsx)(l.Muted,{children:`Saved as confirmed by ${c.name}. Each night is logged. ${C&&z?`${z} saved night${1===z?' is':'s are'} replaced.`:z?`${z} already-saved night${1===z?' is':'s are'} skipped.`:''}`})]}),(0,u.jsx)(l.Button,{testID:"sheet-save",label:"Confirm and save",onPress:()=>{const s=(new Date).toISOString(),o=n.useCashUp.getState();for(const l of R){const n=o.cashUps.find(s=>s.rid===e&&s.date===l.date);o.saveCashUp({rid:e,date:l.date,vals:{...n?.vals??{},...(0,r.rowVals)(l)},photos:n?.photos??[],confirmedBy:c.name,confirmedAt:s,readBy:`spreadsheet: ${t.name}`.slice(0,80)})}const l=R.length,i=`Takings saved for ${l} night${1===l?'':'s'} from ${t.name}.`;f(i),w(i)}}),(0,u.jsx)(l.Button,{kind:"secondary",label:"Back to the preview",onPress:()=>S('preview')})]}):null]})};var s=_r(d[0]),t=e(_r(d[1]));_r(d[2]);var o=e(_r(d[3])),l=_r(d[4]),n=_r(d[5]),i=_r(d[6]),r=_r(d[7]),h=_r(d[8]),c=_r(d[9]),u=_r(d[10]);const p=e=>null==e?'\u2014':`\xa3${e.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`,m=e=>new Date(`${e}T12:00:00Z`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',year:'numeric',timeZone:'UTC'}),f=e=>{try{t.default.announceForAccessibility?.(e)}catch{}}},1262,[30,118,122,127,813,1076,1117,1263,821,1264,24]); +__d(function(g,_r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"COLS",{enumerable:!0,get:function(){return n}}),e.parseCsv=function(t){const n=t.replace(/^\uFEFF/,''),r=n.split(/\r?\n/,1)[0]??'',s=t=>r.split(t).length-1,a=[',',';','\t'].sort((t,n)=>s(n)-s(t))[0],o=[];let l=[],d='',i=!1;for(let t=0;tt.some(t=>''!==t.trim())).map(t=>t.map(t=>t.trim()))},e.guessMapping=function(t){const n={},s=new Set;for(const a of['date','food','drink','card','cash','gross']){const o=t.findIndex((t,n)=>!s.has(n)&&r[a].test(t)&&!('gross'===a&&/tips?/i.test(t))&&!('cash'===a&&/tips?|float/i.test(t)));o>=0&&(n[a]=o,s.add(o))}return n},e.parseDateCell=l,e.buildPreview=function(r,s,a,o){const d=a?r.slice(1):r,i=new Map,u=d.map((r,o)=>{const d=[],i=t=>null==s[t]?'':(r[s[t]]??'').trim(),u=null==s.date?null:l(i('date'));u||d.push(i('date')?`Date \u201c${i('date')}\u201d not understood`:'No date');const c={};for(const r of n){if('date'===r.key||null==s[r.key])continue;const n=i(r.key);if(!n){c[r.key]=null,r.required&&d.push(`No ${r.label.toLowerCase()}`);continue}const a=(0,t.parseAmount)(n.replace(/^\((.*)\)$/,'-$1'));null==a&&d.push(`${r.label} \u201c${n}\u201d not a \xa3 amount`),c[r.key]=a}return null==s.gross&&d.push('No gross column'),{line:o+(a?2:1),date:u,vals:c,errors:d,dup:null,ok:!1}});for(const t of u)t.date&&i.set(t.date,(i.get(t.date)??0)+1);for(const t of u)t.date&&(i.get(t.date)??0)>1?(t.dup='file',t.errors.push('This date is in the file more than once')):t.date&&o.has(t.date)&&(t.dup='saved'),t.ok=!t.errors.length;return u},e.rowVals=function(t){const n={};for(const r of['gross','food','drink','card','cash'])r in t.vals&&(n[r]=t.vals[r]??null);return n};var t=_r(_d[0]);const n=[{key:'date',label:'Date',required:!0},{key:'gross',label:'Gross takings',required:!0},{key:'food',label:'Food'},{key:'drink',label:'Drink'},{key:'card',label:'Card'},{key:'cash',label:'Cash'}];const r={date:/^(date|day|night|trading ?date|business ?date)\b/i,gross:/(gross|total ?takings|takings|total ?sales|sales ?total|turnover|^total$)/i,food:/\bfood\b|kitchen/i,drink:/\bdrinks?\b|\bbar\b|bev(erage)?s?|wet/i,card:/\bcard\b|pdq|debit|credit/i,cash:/\bcash\b/i};const s=['jan','feb','mar','apr','may','jun','jul','aug','sep','oct','nov','dec'],a=t=>String(t).padStart(2,'0'),o=(t,n,r)=>{const s=new Date(Date.UTC(t,n-1,r));return s.getUTCFullYear()===t&&s.getUTCMonth()===n-1&&s.getUTCDate()===r?`${t}-${a(n)}-${a(r)}`:null};function l(t){const n=t.trim();let r;if(r=n.match(/^(\d{4})-(\d{1,2})-(\d{1,2})(?:[ T].*)?$/))return o(+r[1],+r[2],+r[3]);if(r=n.match(/^(\d{1,2})[/.-](\d{1,2})[/.-](\d{2}|\d{4})(?: .*)?$/))return o(2===r[3].length?+r[3]+2e3:+r[3],+r[2],+r[1]);if(r=n.match(/^(?:[a-z]+,? )?(\d{1,2})(?:st|nd|rd|th)? ([a-z]{3})[a-z]*,? (\d{4})$/i)){const t=s.indexOf(r[2].toLowerCase());return t<0?null:o(+r[3],t+1,+r[1])}if(/^\d{5}(\.\d+)?$/.test(n)){const t=Math.floor(+n);if(t<36526||t>73050)return null;const r=new Date(Date.UTC(1899,11,30)+864e5*t);return o(r.getUTCFullYear(),r.getUTCMonth()+1,r.getUTCDate())}return null}},1263,[1117]); +__d(function(g,_r,_i,a,_m,e,_d){"use strict";async function t(t){const r=globalThis.DecompressionStream;if(!r)throw new Error('This browser can\u2019t open .xlsx files. Save the sheet as CSV and upload that.');const n=new Blob([t]).stream().pipeThrough(new r('deflate-raw'));return new Uint8Array(await new Response(n).arrayBuffer())}async function r(r,n){const s=new Uint8Array(r),o=new DataView(r),i={};let c=-1;for(let t=s.length-22;t>=Math.max(0,s.length-66e3);t--)if(101010256===o.getUint32(t,!0)){c=t;break}if(c<0)throw new Error('This isn\u2019t a readable .xlsx file.');const l=o.getUint16(c+10,!0);let h=o.getUint32(c+16,!0);const f=new TextDecoder;for(let r=0;r'xl/sharedStrings.xml'===t||/^xl\/worksheets\/sheet\d+\.xml$/.test(t)),i=Object.keys(o).filter(t=>t.startsWith('xl/worksheets/')).sort()[0];if(!i)throw new Error('No worksheet found in this file.');const c=[...(o['xl/sharedStrings.xml']??'').matchAll(/([\s\S]*?)<\/si>/g)].map(t=>n([...t[1].matchAll(/]*>([\s\S]*?)<\/t>/g)].map(t=>t[1]).join(''))),l=[];for(const t of o[i].matchAll(/]*>([\s\S]*?)<\/row>/g)){const r=[];for(const o of t[1].matchAll(/]*?)(?:\/>|>([\s\S]*?)<\/c>)/g)){const t=o[1],i=o[2]??'',l=t.match(/r="([A-Z]+\d+)"/)?.[1],h=t.match(/t="(\w+)"/)?.[1],f=i.match(/([\s\S]*?)<\/v>/)?.[1],w=i.match(/]*>([\s\S]*?)<\/t>/)?.[1],m='s'===h?c[Number(f)]??'':n('inlineStr'===h?w??'':f??'');r[l?s(l):r.length]=m}l.push(Array.from(r,t=>(t??'').trim()))}return l.filter(t=>t.some(t=>''!==t))};const n=t=>t.replace(/</g,'<').replace(/>/g,'>').replace(/"/g,'"').replace(/'/g,"'").replace(/&#(\d+);/g,(t,r)=>String.fromCharCode(+r)).replace(/&/g,'&'),s=t=>{const r=t.replace(/\d+/g,'');let n=0;for(const t of r)n=26*n+(t.charCodeAt(0)-64);return n-1}},1264,[]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.useLockedFor=function(e){const n=(0,c.useCashUp)(e=>e.cashUps),s=(0,c.useCashUp)(e=>e.sales);return(0,o.useCallback)((o,l)=>{const i='cashup'===o?n.find(n=>n.rid===e&&n.date===l):s.find(n=>n.rid===e&&n.weekStart===l);return!!i&&(0,h.cashLocked)(t.PITCH&&i.confirmedAt?{...i,onServer:!0}:i)},[n,s,e])},Object.defineProperty(_e,"lockedMessage",{enumerable:!0,get:function(){return y}}),_e.auditLine=j,_e.CashLockControls=function({kind:e,item:s,label:c}){const y=(0,k.useSync)(e=>'staff'===e.kind&&!!e.venueId)||t.PITCH,b=(0,k.useSync)(e=>e.perms.includes('*')||e.perms.includes('roles.manage')),x=(0,u.useOwner)(e=>e.previewRole),C=b||t.PITCH&&'owner'===x,[$,w]=(0,o.useState)(!1),[I,S]=(0,o.useState)(''),[P,L]=(0,o.useState)(!1),[T,U]=(0,o.useState)(null);if(!y||!(s.onServer||t.PITCH&&s.confirmedAt))return null;const v=(0,h.cashLocked)(t.PITCH?{...s,onServer:!0}:s),H=async()=>{L(!0);const n=await(0,k.unlockCashUp)(e,s.id,I.trim());L(!1),n.ok?(w(!1),S(''),(0,f.notify)({id:'cash-unlock',icon:'\ud83d\udd11',title:`${c} unlocked for 30 minutes`,body:'Correct it now. It locks again by itself, and the change is logged with your name.',timeoutMs:8e3})):(0,f.notify)({id:'cash-unlock',tone:'warn',title:'Not unlocked',body:n.message,timeoutMs:8e3})};return(0,p.jsxs)(l.default,{testID:`cash-lock-${s.id}`,style:{gap:4},children:[(0,p.jsxs)(i.Row,{gap:6,wrap:!0,children:[v?(0,p.jsx)(i.Badge,{kind:"gold",label:"Signed off"}):(0,p.jsx)(i.Badge,{kind:"neutral",label:`Unlocked until ${new Date(s.unlockedUntil??'').toLocaleTimeString('en-GB',{timeZone:'Europe/London',hour:'2-digit',minute:'2-digit'})}`}),v&&C&&!$?(0,p.jsx)(i.Button,{small:!0,kind:"ghost",testID:`cash-unlock-${s.id}`,label:"Unlock to correct",onPress:()=>w(!0)}):null,(0,p.jsx)(i.Button,{small:!0,kind:"ghost",testID:`cash-history-${s.id}`,label:T?'Hide history \u25b4':'History \u25be',onPress:()=>{T?U(null):(0,k.readCashAudit)(s.id).then(U)}})]}),v&&!C?(0,p.jsx)(i.Muted,{size:12,children:"Only an owner can unlock it to make a correction."}):null,$?(0,p.jsxs)(l.default,{style:{gap:4},children:[(0,p.jsx)(n.TextInput,{testID:`cash-unlock-reason-${s.id}`,value:I,onChangeText:S,placeholder:"Why does it need changing?",placeholderTextColor:r.colours.muted,maxLength:200,style:{minHeight:36,borderRadius:8,borderWidth:1,borderColor:r.colours.hairline,color:r.colours.text,paddingHorizontal:8}}),(0,p.jsxs)(i.Row,{gap:6,children:[(0,p.jsx)(i.Button,{small:!0,testID:`cash-unlock-yes-${s.id}`,label:P?'Unlocking\u2026':'Unlock for 30 minutes',disabled:P||I.trim().length<3,onPress:()=>{H()}}),(0,p.jsx)(i.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>{w(!1),S('')}})]})]}):null,T?T.length?T.map((e,n)=>(0,p.jsx)(i.Muted,{size:12,children:j(e)},n)):(0,p.jsx)(i.Muted,{size:12,children:"No history yet."}):null]})};var e,n=_r(d[0]),t=_r(d[1]),o=_r(d[2]),s=_r(d[3]),l=(e=s)&&e.__esModule?e:{default:e},i=_r(d[4]),r=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]),k=_r(d[9]),f=_r(d[10]),p=_r(d[11]);const y=(e,n)=>`The ${'cashup'===e?'cash up':'weekly sales report'} for ${n} is signed off and locked. An owner can tap \u201cUnlock to correct\u201d on it.`,b={created:'signed off',changed:'changed',unlocked:'unlocked',deleted:'removed'},x=e=>new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'});function j(e){const n=e.changed.length&&'changed'===e.action?` (${e.changed.slice(0,6).join(', ')}${e.changed.length>6?'\u2026':''})`:'';return`${x(e.at)} \xb7 ${e.by} ${b[e.action]??e.action}${n}${e.reason?`: \u201c${e.reason}\u201d`:''}`}},1265,[877,2,30,127,813,821,1076,856,1117,820,947,24]); +__d(function(_g,_r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.clockAction=async function(n,u){if((0,t.privateClockVenue)(u.rid)&&'in'!==n)return c(n,u,{action:n,at:u.at,inside:null,unchecked:!0});const f=(0,a.areaOf)(u.rid),k=f.on&&null!=f.lat&&null!=f.lng,l=k?await(u.fixFn??r.getFix)():'unavailable';if((0,t.privateClockVenue)(u.rid)&&'object'==typeof l&&(!Number.isFinite(l.acc)||l.acc>150))return{ok:!1,message:'Your phone\u2019s location is not accurate enough to confirm you are at the pub. Enable precise location, step near a window and try again, or ask a manager to record your clock-in with a reason.'};const g=k&&'object'!=typeof l?(0,s.locWhere)():'browser',p=(0,o.gate)(f,n,k?l:'unavailable',u.at,g);if(!p.allowed){const a='object'==typeof l?void 0:'app'===g&&'denied'===l?'settings':'app-phone-off'===g?'location':'app-old'===g&&'denied'===l?'update':void 0;return'update'===a&&(0,s.checkAppUpdate)(),{ok:!1,message:(p.message??'You need to be at the venue.')+((0,t.privateClockVenue)(u.rid)?' Ask a manager to record your clock-in with a reason using Record it for someone.':''),fix:a}}const w=c(n,u,p.geo);return w.ok&&p.warn?{...w,warn:p.warn}:w},e.managerClockAction=function(t,a,r,s){const u=(0,o.overrideGeo)(t,a.at,r,s);if(!u)return{ok:!1,message:'Type a short reason (at least 3 letters).'};const f=n.useOwner.getState().staff.find(t=>t.id===a.staffId)?.name??'staff',k=c(t,a,u,{adjusted:{by:r.name,at:a.at,reason:u.override.reason}});if(k.ok){const o={in:'clocked in',out:'clocked out',break_start:'started a break for',break_end:'ended a break for'}[t],s=`${r.name} ${o} ${f} (manager, no location check): ${u.override.reason}`;n.useOwner.setState(t=>({attLog:[{id:`al-${Date.now().toString(36)}`,at:a.at,text:s},...t.attLog]}))}return k};var t=_r(d[0]),a=_r(d[1]),n=_r(d[2]),o=_r(d[3]),r=_r(d[4]),s=_r(d[5]);function c(a,o,r,s={}){const c=(0,t.venueClockGeo)(o.rid,r),u=c?!1!==c.inside:void 0,f=n.useOwner.getState(),k=(0,n.openShiftOf)(f.attendance,o.staffId,o.at);if('in'===a){if(k)return{ok:!1,message:'You\u2019re already clocked in.'};f.clock(o.staffId,o.date,'in',o.at,u);const t=(0,n.openShiftOf)(n.useOwner.getState().attendance,o.staffId,o.at);return t&&n.useOwner.getState().patchAttendance(t.id,{...o.offRota?{offRota:!0}:{},...s},c),{ok:!0,att:t&&n.useOwner.getState().attendance.find(a=>a.id===t.id)}}if(!k)return{ok:!1,message:'You\u2019re not clocked in.'};if('out'===a){let t=o.breakMins;if(o.addedBreak&&o.addedBreak>0&&!k.breaks?.length){const a=new Date(o.at).getTime(),r=new Date(Math.max(new Date(k.in).getTime(),a-6e4*o.addedBreak)).toISOString();n.useOwner.getState().patchAttendance(k.id,{breaks:[{start:r,end:o.at}],breakAddedAtClockOut:o.addedBreak}),t=Math.round((a-new Date(r).getTime())/6e4)}return n.useOwner.getState().clock(o.staffId,o.date,'out',o.at,u,t),n.useOwner.getState().patchAttendance(k.id,s,c),{ok:!0,att:n.useOwner.getState().attendance.find(t=>t.id===k.id)}}return n.useOwner.getState().breakToggle(o.staffId,'break_start'===a?'start':'end',o.at)?(n.useOwner.getState().patchAttendance(k.id,s,c),{ok:!0,att:n.useOwner.getState().attendance.find(t=>t.id===k.id)}):{ok:!1,message:'break_start'===a?'You\u2019re already on a break.':'You\u2019re not on a break.'}}},1266,[989,1177,856,954,1247,1267]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"inPhoneApp",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"canOpenAppSettings",{enumerable:!0,get:function(){return c}}),e.openAppSettings=function(){try{t()?.openSettings?.()}catch{}},e.openLocationSettings=function(){try{t()?.openLocationSettings?.()}catch{}},e.appLocationPermission=function(){try{return t()?.locationPermission?.()??null}catch{return null}},e.phoneLocationOn=p,e.checkAppUpdate=function(){try{t()?.checkUpdate?.()}catch{}},e.locWhere=function(){if(!o()){const t=String(n()?.navigator?.userAgent??'');return/iPhone|iPad|iPod/.test(t)||/Macintosh/.test(t)&&(n()?.navigator?.maxTouchPoints??0)>1?'iphone':'browser'}return c()?p()?'app':'app-phone-off':'app-old'};const n=()=>'undefined'!=typeof window?window:void 0,t=()=>{const t=n()?.CoverChargeNative;return t&&'object'==typeof t?t:null},o=()=>/CoverChargePhone\//.test(String(n()?.navigator?.userAgent??'')),c=()=>'function'==typeof t()?.openSettings;function p(){try{const n=t()?.locationOn?.();return!1!==n}catch{return!0}}},1267,[]); +__d(function(g,r,_i,a,m,_e,d){"use strict";function t(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.SplitFlap=function({value:t,height:e=52,colour:o="#F5F1E8",min:i=2,sound:n,testID:u}){const s=String(Math.max(0,Math.round(t))).padStart(i,' '),h=Math.round(.68*e);return(0,c.jsx)(l.default,{testID:u,accessible:!0,accessibilityLabel:String(Math.max(0,Math.round(t))),style:{flexDirection:'row',gap:3},children:s.split('').map((t,i)=>(0,c.jsx)(x,{ch:' '===t?'':t,h:e,colour:o,size:h,sound:n&&i===s.length-1},s.length-i))})};var e=r(d[0]),o=t(r(d[1])),i=t(r(d[2])),n=t(r(d[3])),l=t(r(d[4])),u=r(d[5]),s=r(d[6]),c=r(d[7]);let h=!1;o.default.isReduceMotionEnabled?.().then(t=>{h=!!t}).catch(()=>{}),o.default.addEventListener?.('reduceMotionChanged',t=>{h=!!t});const f='#1B1A1D',p='#201F22';function b({ch:t,h:e,w:o,colour:n,part:u,size:h}){return(0,c.jsx)(l.default,{style:{height:e/2,width:o,overflow:'hidden',backgroundColor:'top'===u?p:f,borderTopLeftRadius:'top'===u?8:0,borderTopRightRadius:'top'===u?8:0,borderBottomLeftRadius:'bottom'===u?8:0,borderBottomRightRadius:'bottom'===u?8:0},children:(0,c.jsx)(i.default.Text,{allowFontScaling:!1,style:{position:'absolute',left:0,right:0,top:'top'===u?0:-e/2,height:e,lineHeight:e,textAlign:'center',fontSize:h,fontFamily:s.fonts.bold,color:n,includeFontPadding:!1},children:t})})}function x({ch:t,h:o,colour:s,size:f,sound:p}){const x=Math.round(.7*o),[j,v]=(0,e.useState)(t),[w,R]=(0,e.useState)(t),y=(0,e.useRef)(new i.default.Value(0)).current,M=(0,e.useRef)(new i.default.Value(1)).current,V=(0,e.useRef)(!0);(0,e.useEffect)(()=>{if(V.current)return V.current=!1,v(t),void R(t);if(t!==j){if(h)return R(t),void v(t);R(j),v(t),y.setValue(0),M.setValue(1),p&&(0,u.flapClick)(),i.default.sequence([i.default.timing(y,{toValue:1,duration:210,easing:n.default.in(n.default.quad),useNativeDriver:!0}),i.default.timing(M,{toValue:0,duration:210,easing:n.default.out(n.default.quad),useNativeDriver:!0})]).start(()=>R(t))}},[t]);const z=o/4,F=y.interpolate({inputRange:[0,1],outputRange:['0deg','-90deg']}),S=M.interpolate({inputRange:[0,1],outputRange:['0deg','90deg']}),D=w!==j;return(0,c.jsxs)(l.default,{style:{width:x,height:o},children:[(0,c.jsx)(b,{ch:j,h:o,w:x,colour:s,part:"top",size:f}),(0,c.jsx)(b,{ch:D?w:j,h:o,w:x,colour:s,part:"bottom",size:f}),D?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(i.default.View,{style:{position:'absolute',top:0,left:0,transform:[{perspective:400},{translateY:z},{rotateX:F},{translateY:-z}],backfaceVisibility:'hidden'},children:(0,c.jsx)(b,{ch:w,h:o,w:x,colour:s,part:"top",size:f})}),(0,c.jsx)(i.default.View,{style:{position:'absolute',top:o/2,left:0,transform:[{perspective:400},{translateY:-z},{rotateX:S},{translateY:z}],backfaceVisibility:'hidden'},children:(0,c.jsx)(b,{ch:j,h:o,w:x,colour:s,part:"bottom",size:f})})]}):null,(0,c.jsx)(l.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:o/2-.5,height:1,backgroundColor:'rgba(0,0,0,0.75)'}})]})}},1268,[30,118,120,224,127,923,821,24]); +__d(function(g,_r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.LastFoodBanner=function({rid:e,now:o,big:c}){const f=(0,l.useRestaurant)(e),h=u(o),$=(0,l.useEvents)(e).filter(e=>e.date===h&&'regular'===e.source),b=f?(0,s.lastFoodOn)(f,h):null;if(!b)return null;const T=new Date(`${h}T${b.time}:00`),p=Math.round((T.getTime()-o.getTime())/6e4),_=$[0],j=_?`${_.title}${_.time?` from ${(0,s.fmt12)(_.time)}`:''}`:'';if(p>90&&!_)return null;if(p<-60)return null;const w=p>=0&&p<=15,x=p<0,D=w?n.colours.redBg:x?n.colours.surface2:n.colours.goldTint,F=w?n.colours.red:x?n.colours.hairline:n.colours.accentBorder,M=w?'#FFD9D4':x?n.colours.muted:n.colours.goldLight,y=c?1.3:1,B=x?`Kitchen closed for food \xb7 last orders were ${(0,s.fmt12)(b.time)}`:w?`Last food orders in ${Math.max(0,p)} min (${(0,s.fmt12)(b.time)})`:`Last food orders ${(0,s.fmt12)(b.time)}`;return(0,d.jsxs)(t.default,{testID:w?'last-food-warning':'last-food-banner',accessibilityRole:"text",style:{borderRadius:14,borderWidth:w?2:1,borderColor:F,backgroundColor:D,paddingVertical:10*y,paddingHorizontal:14,gap:2},children:[(0,d.jsxs)(r.T,{size:17*y,weight:"bold",colour:M,children:[w?'\u23f0 ':'\ud83c\udf7d ',B]}),j||'kitchen closes'!==b.reason?(0,d.jsx)(r.T,{size:13*y,colour:n.colours.muted,children:[j?`Tonight: ${j}`:'','kitchen closes'!==b.reason&&b.reason!==_?.title?`Early last orders (${b.reason})`:''].filter(Boolean).join(' \xb7 ')}):null]})},_r(_d[0]);var e,o=_r(_d[1]),t=(e=o)&&e.__esModule?e:{default:e},r=_r(_d[2]),l=_r(_d[3]),s=_r(_d[4]),n=_r(_d[5]),d=_r(_d[6]);const u=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`},1269,[30,127,813,819,809,821,24]); +__d(function(_g,_r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.useNextFree=j,_e.NextTableFreeCard=function({rid:e,now:s,big:r,always:d}){const u=(0,n.useRestaurant)(e),c=j(e,s);if(!u||!c||!(0,h.nextTableOn)(u))return null;if(!c.full&&!d)return null;const T=c.list.slice(0,3),w=c.waitFor(2),p=c.waitFor(4),y=(0,h.lastFoodOn)(u,x(s)),M=r?1.25:1,F=(e,r)=>(0,g.jsxs)(l.default,{style:{flex:1,borderRadius:12,borderWidth:1,borderColor:f.colours.hairline,backgroundColor:f.colours.tile,padding:10},testID:`wait-for-${e}`,children:[(0,g.jsxs)(o.Muted,{children:["Wait for ",e]}),(0,g.jsx)(o.T,{size:20*M,weight:"bold",colour:f.colours.goldLight,children:r?`About ${Math.max(5,Math.round((r.at.getTime()-s.getTime())/6e4))} min`:'\u2014'}),(0,g.jsx)(o.Muted,{children:r?`${(0,t.tableNumbers)(r.table)} \xb7 ${r.confidence}`:'nothing due yet'})]});return(0,g.jsxs)(l.default,{testID:"next-table-free",accessibilityRole:"summary",style:{borderRadius:16,borderWidth:1,borderColor:f.colours.accentBorder,backgroundColor:f.colours.surface,padding:14,gap:8},children:[(0,g.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,g.jsx)(o.T,{size:12,weight:"semibold",colour:f.colours.goldMuted,style:{letterSpacing:1.4},children:c.full?'FULL \xb7 NEXT TABLE FREE':'NEXT TABLE FREE'}),(0,g.jsx)(o.Badge,{kind:"amber",label:"ESTIMATE"})]}),T.length?(0,g.jsxs)(o.T,{size:22*M,weight:"bold",children:["About ",(0,b.hhmm)(T[0].at)," ",(0,g.jsxs)(o.T,{size:16*M,colour:f.colours.muted,children:["(",(0,t.tableNumbers)(T[0].table),", ",T[0].seats," seats \xb7 ",T[0].confidence,")"]})]}):(0,g.jsx)(o.T,{size:18*M,weight:"semibold",children:c.freeNow.length?`Free now: ${c.freeNow.map(e=>`${(0,t.tableNumbers)(e)}`).join(', ')}`:'No table due to free up before its next booking'}),T.slice(1).map(e=>(0,g.jsxs)(o.Muted,{children:["Then about ",(0,b.hhmm)(e.at)," \xb7 ",(0,t.tableNumbers)(e.table)," (",e.seats," seats) \xb7 ",e.confidence," \xb7 ",e.why]},e.table)),T[0]?(0,g.jsxs)(o.Muted,{children:[(0,t.tableNumbers)(T[0].table),": ",T[0].why,"."]}):null,(0,g.jsxs)(o.Row,{gap:8,children:[F(2,w),F(4,p)]}),T.some(e=>e.drinksOnly)&&y?(0,g.jsxs)(o.T,{size:13,colour:f.colours.amber,children:["After last food orders (",(0,h.fmt12)(y.time),") a table is for drinks only."]}):null,(0,g.jsx)(o.Muted,{children:"Tap Bill requested or Table finished on the plan and this updates straight away."})]})};var e,t=_r(_d[0]),s=_r(_d[1]),r=_r(_d[2]),l=(e=r)&&e.__esModule?e:{default:e},o=_r(_d[3]),n=_r(_d[4]),d=_r(_d[5]),u=_r(_d[6]),c=_r(_d[7]),b=_r(_d[8]),h=_r(_d[9]),f=_r(_d[10]),g=_r(_d[11]);const x=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`,T=e=>(0,b.hhmm)(e);function j(e,t){const r=(0,n.useRestaurant)(e),l=(0,u.usePlan)(e),o=(0,n.useBookings)(e),h=(0,n.useOrders)(e),f=(0,u.useFloor)(t=>t.live[e]),g=(0,d.useBlocks)(e=>e.blocks),j=t.getTime()/6e4|0;return(0,s.useMemo)(()=>{if(!r)return null;const s=x(t),n=(0,d.closedAreasAt)(g,e,s,T(t)),u=(0,c.floorView)(l,o,h,f??{},t,r.settings.turnMins,n);return(0,b.nextTablesFree)(r,u,o.filter(e=>e.date===s),t,o)},[r,l,o,h,f,g,j])}},1270,[808,30,127,813,819,824,825,826,1271,809,821,24]); +__d(function(_g,_r,i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.nextTablesFree=function(t,r,o,l,u=[]){const m=`${l.getFullYear()}-${String(l.getMonth()+1).padStart(2,'0')}-${String(l.getDate()).padStart(2,'0')}`,f=(0,a.lastFoodOn)(t,m),d=f?new Date(`${m}T${f.time}:00`):null,b=t=>o.filter(a=>a.date===m&&'confirmed'===a.status&&(a.table??'').split('+').map(t=>t.trim()).includes(t)).map(t=>new Date(`${t.date}T${t.time}:00`)).filter(t=>t>=s(l,-20)).sort((t,a)=>t.getTime()-a.getTime())[0],c=[],g=[];for(const o of Object.values(r)){const r=o.table.name,m=b(r);if('free'===o.status){(!m||m>s(l,60))&&c.push(r);continue}if(!n.includes(o.status)||!o.booking)continue;const f=o.booking,h=f.seatedAt?new Date(f.seatedAt):new Date(`${f.date}T${f.time}:00`),$=(0,a.dwellFor)(t,f.partySize,u);let w=s(h,$.mins),T='maybe',p=`seated ${Math.max(0,Math.round((l.getTime()-h.getTime())/6e4))} min, usual ${$.mins} min`;'bill'===o.status?(w=s(l,10),T='likely',p='bill requested'):'dessert'===o.status?(w=new Date(Math.min(w.getTime(),s(l,25).getTime())),T='likely',p='on dessert'):'mains'===o.status&&(w=new Date(Math.min(Math.max(w.getTime(),s(l,35).getTime()),s(l,60).getTime())),p='mains out'),w=d?{drinksOnly:!0}:{}})}g.sort((t,a)=>t.at.getTime()-a.at.getTime());const h=Object.values(r).filter(t=>'blocked'!==t.status).length,$=h>0&&c.length<=Math.max(1,Math.round(.1*h));return{full:$,freeNow:c,list:g,waitFor:t=>g.find(a=>a.seats>=t)??null}},Object.defineProperty(e,"hhmm",{enumerable:!0,get:function(){return r}}),e.nextFreeSentence=function(a,n){if(a.freeNow.length&&!a.full)return`There are ${a.freeNow.length} tables free now: ${a.freeNow.slice(0,4).map(t=>`table ${t}`).join(', ')}.`;const s=a.list[0];if(!s)return a.freeNow.length?`${(0,t.tableNumbers)(a.freeNow[0])} is free now.`:'No table is due to free up before the bookings that follow; check the bookings list.';const o=Math.max(5,Math.round((s.at.getTime()-n.getTime())/6e4)),l=a.waitFor(2),u=a.waitFor(4);return`Next table free about ${r(s.at)} (table ${s.table}, ${s.seats} seats), ${s.confidence}, in about ${o} minutes.${l?` A table for 2: about ${r(l.at)}.`:''}${u?` A table for 4: about ${r(u.at)}.`:''}${s.drinksOnly?' That\u2019s after last food orders, so drinks only.':''}`};var t=_r(_d[0]),a=_r(_d[1]);const n=['seated','mains','dessert','bill'],s=(t,a)=>new Date(t.getTime()+6e4*a);const r=t=>`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`},1271,[808,809]); +__d(function(_g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"MAX",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"TARGET",{enumerable:!0,get:function(){return t}}),_e.compressOnWeb=r,_e.capturePlatingPhoto=async function(e){{const n=await(t='camera'===e,new Promise(e=>{const n=document.createElement('input');n.type='file',n.accept='image/*',t&&n.setAttribute('capture','environment'),n.style.display='none',n.setAttribute('data-testid',t?'photo-input-camera':'photo-input-library'),n.onchange=()=>{const t=n.files?.[0]??null;n.remove(),e(t)},n.oncancel=()=>{n.remove(),e(null)},document.body.appendChild(n),n.click()}));if(!n)return null;return{...await r(n),originalBytes:n.size}}var t},Object.defineProperty(_e,"kb",{enumerable:!0,get:function(){return a}});!(function(e){if(e&&e.__esModule)return e;var t={};e&&Object.keys(e).forEach(function(n){if('default'!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e})(_r(_d[0]));_r(_d[1]);const e=1024,t=225280,n=e=>Math.round(3*(e.length-e.indexOf(',')-1)/4);async function r(r,a=e,o=t){const i='string'==typeof r?r:URL.createObjectURL(r);try{const e=await new Promise((e,t)=>{const n=new window.Image;n.onload=()=>e(n),n.onerror=()=>t(new Error('That file is not a photo we can read.')),n.src=i}),t=Math.min(1,a/Math.max(e.naturalWidth,e.naturalHeight)),r=Math.max(1,Math.round(e.naturalWidth*t)),c=Math.max(1,Math.round(e.naturalHeight*t)),u=document.createElement('canvas');u.width=r,u.height=c;const l=u.getContext('2d');l.fillStyle='#ffffff',l.fillRect(0,0,r,c),l.drawImage(e,0,0,r,c);let f=.8,s=u.toDataURL('image/jpeg',f);for(;n(s)>o&&f>.4;)f-=.1,s=u.toDataURL('image/jpeg',f);return{dataUrl:s,width:r,height:c,bytes:n(s)}}finally{'string'!=typeof r&&URL.revokeObjectURL(i)}}const a=e=>`${Math.max(1,Math.round(e/1024))} KB`},1272,[1035,122]); +__d(function(_g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useLogoCache",{enumerable:!0,get:function(){return s}}),_e.squareLogo=async function(e,t=256){const n=await new Promise((t,n)=>{const o=new window.Image;o.onload=()=>t(o),o.onerror=()=>n(new Error('That file is not a picture we can read.')),o.src=e}),o=Math.min(n.naturalWidth,n.naturalHeight),i=(n.naturalWidth-o)/2,s=(n.naturalHeight-o)/2,c=document.createElement('canvas');c.width=t,c.height=t;const u=c.getContext('2d');return u.fillStyle='#ffffff',u.fillRect(0,0,t,t),u.drawImage(n,i,s,o,o,0,0,t,t),c.toDataURL('image/jpeg',.85)};var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},o=r(d[1]),i=r(d[2]);const s=(0,o.create)()((0,i.persist)(e=>({byList:{},put:(t,n)=>e(e=>({byList:{...e.byList,[t]:n}})),drop:t=>e(e=>{const n={...e.byList};return delete n[t],{byList:n}})}),{name:'covercharge-order-logos-v1',storage:(0,i.createJSONStorage)(()=>n.default)}))},1273,[1082,952,1091]); +__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TodaysBookings=function({rid:o,today:s,by:p,app:x}){const v=(0,l.useBookings)(o).filter(e=>e.date===s&&(0,u.ACTIVE)(e)).sort((e,t)=>e.time.localeCompare(t.time)),B=v.reduce((e,t)=>e+(t.diet?.vegan??0),0),C=v.reduce((e,t)=>e+(t.diet?.vegetarian??0),0);return(0,y.jsxs)(n.default,{style:{gap:12},testID:"todays-bookings",children:[(0,y.jsx)(j.CoversToday,{rid:o}),(0,y.jsx)(h.PlattersBooked,{rid:o,date:s,label:"Platters booked today"}),B||C?(0,y.jsxs)(a.T,{colour:c.colours.ok,children:["\u24cb ",B?`${B} vegan`:'',B&&C?' \xb7 ':'',C?`${C} vegetarian`:''," today"]}):null,(0,y.jsx)(h.KitchenSignoffs,{rid:o,today:s,by:p,app:x,showAll:!0}),v.length?v.map(s=>(0,y.jsxs)(n.default,{style:{gap:6,padding:14,borderRadius:16,borderWidth:1,borderColor:c.colours.hairline,backgroundColor:c.colours.surface},children:[(0,y.jsxs)(a.T,{weight:"semibold",children:[s.time," \xb7 ",s.walkIn?`Walk-in ${s.ref}`:s.name," \xb7 ",s.partySize," covers",s.table?` \xb7 ${(0,e.tableNumbers)(s.table)}`:'']}),(0,y.jsx)(t.DepositChip,{b:s,money:!0,testID:`kitchen-deposit-${s.id}`}),(0,y.jsx)(b.BookingTableButton,{rid:o,booking:s,readOnly:'chef'===x}),'chef'!==x&&s.walkIn?(0,y.jsx)(k.CancelWalkInButton,{rid:o,b:s,small:!0}):null,s.notes?(0,y.jsxs)(a.T,{size:16,testID:`kitchen-notes-${s.id}`,children:["Notes: ",s.notes]}):null,(0,y.jsx)(f.BookingEditButton,{rid:o,booking:s,who:p,inStaffApp:'staff'===x}),(0,y.jsx)(h.BookingNeeds,{b:s}),'seated'===(0,u.shownStatus)(s)?(0,y.jsx)(a.Muted,{children:"Seated"}):'finished'===s.status?(0,y.jsx)(a.Muted,{children:"Finished"}):null]},s.id)):(0,y.jsx)(a.Muted,{children:"No bookings today yet."})]})};var e=r(d[0]),t=r(d[1]);r(d[2]);var o,s=r(d[3]),n=(o=s)&&o.__esModule?o:{default:o},a=r(d[4]),l=r(d[5]),u=r(d[6]),c=r(d[7]),h=r(d[8]),b=r(d[9]),k=r(d[10]),f=r(d[11]),j=r(d[12]),y=r(d[13])},1274,[808,951,30,127,813,819,828,821,950,915,949,916,921,24]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"tableButtonLabel",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"tableButtonA11y",{enumerable:!0,get:function(){return s}}),e.tableOptions=function(t,n,o){const s=t.tables.map(t=>t.name).sort(l),c=new Set;return(t.joins??[]).forEach(t=>{t.tables.length>1&&c.add(t.tables.slice().sort(l).join('+'))}),[...n.map(t=>t.table),o].forEach(t=>{const n=a(t);n.length>1&&c.add(n.slice().sort(l).join('+'))}),[...s,...[...c].sort(l)]},e.tableOverlaps=function(t,l,o,s=90){const c=a(l);if(!c.length)return[];const b={...t,table:l};return o.filter(l=>l.id!==t.id&&l.date===t.date&&!['cancelled','noshow','finished'].includes(l.status)&&a(l.table).some(t=>c.includes(t))&&(0,n.startOf)(b)<(0,n.endOf)(l,s)&&(0,n.startOf)(l)<(0,n.endOf)(b,s))},Object.defineProperty(e,"tablePatch",{enumerable:!0,get:function(){return c}});var t=r(d[0]),n=r(d[1]);const a=t=>t?t.split('+').map(t=>t.trim()).filter(Boolean):[],l=(t,n)=>t.localeCompare(n,'en-GB',{numeric:!0}),o=n=>(0,t.tableNumbers)(n)||'No table',s=(n,a)=>`${(0,t.tableNumbersA11y)(n)}${a?'':', change table'}`;const c=t=>({table:t||void 0,tableSetHere:!0})},1275,[808,826]); +__d(function(g,_r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.nextDays=c,Object.defineProperty(_e,"openOn",{enumerable:!0,get:function(){return u}}),_e.BookingDatePicker=function({r:e,today:l,value:b,onChange:m}){const[f,x]=(0,t.useState)(!1),p=(0,r.ymd)(l),j=c(l,9),D=(e,t)=>0===t?'Today':1===t?'Tomorrow':`${(0,r.dayShort)(e)} ${e.getDate()}`,w=j.some(e=>(0,r.ymd)(e)===b),C=(0,r.parseYmd)(b),[P,T]=(0,t.useState)(()=>({y:C.getFullYear(),m:C.getMonth()})),v=(new Date(P.y,P.m,1,12).getDay()+6)%7,M=new Date(P.y,P.m+1,0).getDate(),R=[...Array.from({length:v},()=>null),...Array.from({length:M},(e,t)=>new Date(P.y,P.m,t+1,12))];for(;R.length%7;)R.push(null);const k=12*(P.y-l.getFullYear())+P.m-l.getMonth(),F=e=>T(({y:t,m:o})=>{const s=new Date(t,o+e,1);return{y:s.getFullYear(),m:s.getMonth()}});return(0,i.jsxs)(s.default,{testID:"nb-date",style:{gap:6},children:[(0,i.jsxs)(d.Row,{wrap:!0,gap:6,children:[j.map((t,o)=>(0,i.jsx)(d.Chip,{label:D(t,o),sub:u(e,t)?void 0:'Closed',selected:b===(0,r.ymd)(t),onPress:()=>{m((0,r.ymd)(t)),x(!1)}},(0,r.ymd)(t))),w?null:(0,i.jsx)(d.Chip,{label:(0,r.niceDate)(C),sub:u(e,C)?void 0:'Closed',selected:!0,onPress:()=>x(!0)}),(0,i.jsx)(d.Chip,{label:f?'Close calendar':'\ud83d\udcc5 Pick date',selected:f,onPress:()=>{f||T({y:C.getFullYear(),m:C.getMonth()}),x(!f)}})]}),f?(0,i.jsxs)(s.default,{testID:"nb-calendar",style:{borderWidth:1,borderColor:n.colours.border,borderRadius:14,padding:10,gap:6,backgroundColor:n.colours.surface2,maxWidth:420},children:[(0,i.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,i.jsx)(o.default,{accessibilityRole:"button",accessibilityLabel:"Previous month",disabled:k<=0,onPress:()=>F(-1),style:{padding:8,opacity:k<=0?.3:1},children:(0,i.jsx)(d.T,{size:20,colour:n.colours.gold,children:"\u2039"})}),(0,i.jsxs)(d.T,{weight:"semibold",children:[(0,r.monthLong)(P.m)," ",P.y]}),(0,i.jsx)(o.default,{accessibilityRole:"button",accessibilityLabel:"Next month",disabled:k>=h,onPress:()=>F(1),style:{padding:8,opacity:k>=h?.3:1},children:(0,i.jsx)(d.T,{size:20,colour:n.colours.gold,children:"\u203a"})})]}),(0,i.jsx)(s.default,{style:{flexDirection:'row'},children:y.map(e=>(0,i.jsx)(d.T,{size:12,colour:n.colours.muted,center:!0,style:{flex:1},children:e},e))}),Array.from({length:R.length/7},(t,l)=>(0,i.jsx)(s.default,{style:{flexDirection:'row',gap:4},children:R.slice(7*l,7*l+7).map((t,l)=>{if(!t)return(0,i.jsx)(s.default,{style:{flex:1,height:40}},l);const c=(0,r.ymd)(t),y=c{m(c),x(!1)},style:{flex:1,height:40,borderRadius:10,alignItems:'center',justifyContent:'center',borderWidth:c===p?1.5:0,borderColor:n.colours.gold,backgroundColor:h?n.colours.gold:'transparent',opacity:y?.3:1},children:(0,i.jsx)(d.T,{size:15,weight:h?'bold':'regular',colour:h?n.colours.onGold:f?n.colours.muted:n.colours.text,style:f&&!y?{textDecorationLine:'line-through'}:void 0,children:t.getDate()})},l)})},l)),(0,i.jsx)(d.Muted,{children:"Past dates can\u2019t be booked. Crossed-out days: closed (per the venue\u2019s hours)."})]}):null]})};var t=_r(_d[0]),o=e(_r(_d[1])),s=e(_r(_d[2])),l=_r(_d[3]),r=_r(_d[4]),n=_r(_d[5]),d=_r(_d[6]),i=_r(_d[7]);function c(e,t){const o=new Date(e);return o.setHours(12,0,0,0),Array.from({length:t},(e,t)=>{const s=new Date(o);return s.setDate(o.getDate()+t),s})}const u=(e,t)=>!!(0,l.hoursFor)(e,t),y=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],h=12},1276,[30,263,127,815,818,821,813,24]); +__d(function(g,r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.MenuAllergyCheck=function({rid:e,allergens:j,audience:m="guest"}){const b=(0,t.useMenu)(e),[x,y]=(0,s.useState)(!1);if(!j.length)return null;const{contains:p,may:M,free:k}=(0,c.dishesFor)(b,j),w=k.filter(e=>!e.signOff),S=k.filter(e=>e.signOff),_=j.map(o.allergenLabel).join(', '),C=e=>e.map(e=>e.name).join(', ')||'none';return(0,f.jsxs)(l.default,{testID:"menu-allergy-check",style:{gap:6,borderWidth:1,borderColor:p.length?h.colours.red:h.colours.border,borderRadius:12,padding:10,backgroundColor:h.colours.surface2},children:[(0,f.jsxs)(u.T,{weight:"semibold",children:["Allergy check against the menu (",_,")"]}),(0,f.jsxs)(u.T,{size:14,colour:h.colours.red,children:["Contains: ",p.length," dish",1===p.length?'':'es']}),(0,f.jsxs)(u.T,{size:14,colour:h.colours.amber,children:["May contain: ",M.length]}),(0,f.jsxs)(u.T,{size:14,colour:h.colours.ok,children:["Free from ",1===j.length?'it':'them'," (signed off): ",S.length]}),w.length?(0,f.jsxs)(u.Muted,{children:[w.length," more awaiting the head chef's sign-off, so not shown as safe."]}):null,(0,f.jsx)(n.default,{testID:"menu-allergy-details",accessibilityRole:"button",onPress:()=>y(!x),hitSlop:6,children:(0,f.jsx)(u.T,{size:14,colour:h.colours.gold,children:x?'Hide dishes':'Show dishes'})}),x?(0,f.jsxs)(l.default,{style:{gap:4},children:[(0,f.jsxs)(u.Muted,{children:["Contains: ",C(p)]}),(0,f.jsxs)(u.Muted,{children:["May contain: ",C(M)]}),(0,f.jsxs)(u.Muted,{children:["Free from: ",C(S)]})]}):null,(0,f.jsx)(u.Muted,{children:'guest'===m?'From the kitchen\u2019s signed-off recipe cards. Specials on the board are checked by staff on the day.':'From the signed-off recipe cards. Specials on the board have their own allergens. Still check with the guest and the kitchen.'})]})};var s=r(d[0]),n=e(r(d[1])),l=e(r(d[2])),t=r(d[3]),o=r(d[4]),c=r(d[5]),h=r(d[6]),u=r(d[7]),f=r(d[8])},1277,[30,263,127,819,814,1103,821,813,24]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"VOICE_ROLES",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"VOICE_ROLE_LABEL",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"useVoiceSettings",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"voiceOn",{enumerable:!0,get:function(){return f}}),_e.micExplainedFor=function(e){try{if('1'===b()?.getItem(s(e)))return!0}catch{}return u.getState().micExplained},_e.setMicExplainedFor=function(e){try{b()?.setItem(s(e),'1')}catch{}u.getState().setMicExplained(!0)};var e,n=r(d[0]),t=(e=n)&&e.__esModule?e:{default:e},c=r(d[1]),l=r(d[2]);const o=['owner','manager','staff','chef','display'],p={owner:'Owner (Managers app)',manager:'Managers (Managers app)',staff:'Staff app (full voice assistant, no money or HR)',chef:'Head Chef app',display:'Main Display'},u=(0,c.create)()((0,l.persist)(e=>({enabled:{},micExplained:!1,setEnabled:(n,t,c)=>e(e=>({enabled:{...e.enabled,[n]:{...e.enabled[n]??{},[t]:c}}})),setMicExplained:n=>e({micExplained:n})}),{name:'covercharge-voice-v1',version:4,storage:(0,l.createJSONStorage)(()=>t.default),migrate:(e,n)=>({enabled:n<2?{}:e?.enabled??{},micExplained:!!e?.micExplained}),merge:(e,n)=>({...n,enabled:e?.enabled??n.enabled,micExplained:e?.micExplained??n.micExplained}),partialize:e=>({enabled:e.enabled,micExplained:e.micExplained})})),f=(e,n,t)=>!1!==e[n]?.[t],s=e=>`cc-voice-mic-explained-${e}`,b=()=>{try{return'undefined'!=typeof window?window.localStorage:void 0}catch{return}}},1278,[1082,952,1091]); +__d(function(g,_r,_i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"VAT",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"exVat",{enumerable:!0,get:function(){return n}}),e.dishCost=i,Object.defineProperty(e,"gpPct",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"priceForTarget",{enumerable:!0,get:function(){return c}}),e.costings=function(r,c,s,u){const d=(0,t.dishStats)(r);return c.map(t=>{const c=r.find(r=>r.id===t.dishId);if(!c||null==c.price)return null;const p=i(t,s),l=n(c.price),f=o(p,c.price),b=d.find(t=>t.item.id===c.id)?.sold??0;return{item:c,recipe:t,cost:p,priceInc:c.price,priceEx:l,gp:f,cashGp:l-p,below:ft.prevCost&&t.prevCost!==t.cost).map(s=>{const u=(s.cost-(s.prevCost??s.cost))/(s.prevCost??1)*100,d=r.filter(t=>t.lines.some(t=>t.ing===s.id)).map(r=>{const u=t.find(t=>t.id===r.dishId);if(!u||null==u.price)return null;const d=o(i(r,n,{ing:s.id,cost:s.prevCost}),u.price),p=o(i(r,n),u.price);return{item:u,before:d,after:p,dropped:d>=c&&pt.dropped),below:d.filter(t=>t.below)}})},e.weekGp=function(t,r,n){const i=t.reduce((t,r)=>t+r.priceEx*r.soldWeek,0),o=t.reduce((t,r)=>t+r.cost*r.soldWeek,0),c=o+r+Math.max(0,n);return{sales:i,theoCost:o,actualCost:c,theo:i?(i-o)/i*100:0,actual:i?(i-c)/i*100:0}},Object.defineProperty(e,"fmtQty",{enumerable:!0,get:function(){return s}});var t=_r(_d[0]);const r=.2,n=t=>Math.round(t/1.2);function i(t,r,n){return Math.round(t.lines.reduce((t,i)=>{const o=r.find(t=>t.id===i.ing);return t+(n&&n.ing===i.ing?n.cost:o?.cost??0)*i.qty},0))}const o=(t,r)=>{const i=n(r);return i>0?(i-t)/i*100:0},c=(t,r)=>50*Math.ceil(t/(1-r/100)*1.2/50);const s=(t,r)=>`${Number.isInteger(t)?t:t.toFixed(t<1?3:2).replace(/0+$/,'').replace(/\.$/,'')} ${'each'===r?'':r}`.trim()},1279,[1280]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"hash",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"CHANNELS",{enumerable:!0,get:function(){return n}}),_e.revenueHistory=function(e,n,r=28){const s=[];if(!(0,o.examplesAllowed)())return s;for(let o=r;o>=1;o--){const r=(0,t.addMins)(n,1440*-o),i=!!e.kitchenHours[r.getDay()],d=[1.05,0,0,.6,.7,1,1.2][r.getDay()]*('anchorage'===e.id?1:.6),l=o=>.85+.3*a((0,t.ymd)(r)+o+e.id),u=i?Math.round(24e4*d*l('d')):0,c=i?Math.round(95e3*d*l('t')):0,p=i?Math.round(52e3*d*l('q')):0;s.push({date:r,label:(0,t.niceDate)(r).slice(0,6),byChannel:{'Dine-in':u,Takeaway:c,'Table QR':p},total:u+c+p,covers:i?Math.round(150*d*l('c')):0})}return s},_e.dishStats=function(e){return(0,o.examplesAllowed)()?e.filter(e=>null!=e.price).map(e=>{const t=Math.round(20+260*a(e.id+'s')),o=.24+.22*a(e.id+'c'),n=e.price??0,r=Math.round(n*(1-o));return{item:e,sold:t,revenue:t*n,costPct:o,margin:r,gp:r*t}}):[]},_e.quadrant=function(e,t,o,a){return e>=o?t>=a?'Star':'Plough horse':t>=a?'Puzzle':'Dog'},Object.defineProperty(_e,"QUADRANT_TIP",{enumerable:!0,get:function(){return r}}),_e.crmCustomers=function(){return(0,o.examplesAllowed)()?s.map((e,t)=>{const o=a(e+t);return{id:0===t?'cust-demo':`cr-${t}`,name:`${e} ${i[t]}${0===t?'':' (example)'}`,phone:`07700 900${String(100+7*t).slice(-3)}`,visits:1+Math.round(18*o),lastVisit:`${1+Math.round(27*o)} days ago`,spend:Math.round(3e3+6e4*o),allergies:0===t?['Crustaceans (anaphylaxis)','Mustard']:o>.8?['Gluten (coeliac)']:o<.1?['Peanuts']:[],stamps:0===t?5:Math.round(7*o),optIn:o>.25,channel:n[Math.floor(3*o)%3],birthday:o>.6?`${1+Math.round(27*o)} Nov`:void 0}}):[]},Object.defineProperty(_e,"STOCK",{enumerable:!0,get:function(){return d}}),Object.defineProperty(_e,"stockList",{enumerable:!0,get:function(){return l}}),_e.insights=function(a,n,r,s,i,l,c){const p=[];if(!(0,o.examplesAllowed)())return u(a,n,r,s,i,l,c);const h=new Date(l);h.setDate(h.getDate()+((6-h.getDay()+7)%7||7)),h.setHours(0,0,0,0);const b=(0,e.forecastToday)(a,n,r,s,h),m=Math.round(b.restOfDay.covers/Math.max(1,b.multiplier)),y=Math.max(35,Math.round(100*(b.multiplier-1))+35);p.push({id:'sat',icon:'\ud83d\udcc8',tone:'gold',title:`${(0,t.niceDate)(h)} forecast +${y}%: add 1 server 6\u20139pm`,body:`Example: about ${Math.round(m*(1+y/100))} covers expected vs about ${m} on a usual Saturday (bookings pace + Halloween weekend flag).`,action:{label:'Open rota',tab:'more',sub:'rota'}});const f=(0,e.forecastToday)(a,n,r,s,l),v=d[0],w=Math.ceil((f.restOfDay.covers+2*f.restOfDay.takeaway)*v.perCover);p.push({id:'haddock',icon:'\ud83d\udc1f',tone:'red',title:`Haddock low: ${v.onHand} portions left`,body:`Tonight\u2019s forecast needs about ${w}. Call the supplier before 18:00 or mark the fish supper sold out at ${v.onHand} sold.`,action:{label:'Prep list',tab:'more',sub:'prep'}});const k=s.find(e=>/Burns/.test(e.title));if(k){const e=Math.max(1,Math.round((new Date(k.date).getTime()-l.getTime())/6048e5));p.push({id:'burns',icon:'\ud83e\udd43',tone:'blue',title:`Burns Night in ${e} weeks: open bookings?`,body:'Last year\u2019s equivalent nights sold out about 3 weeks ahead (example). Publish the set menu and push to opted-in regulars.',action:{label:'Plan campaign',tab:'more',sub:'marketing'}})}const M=n.filter(e=>e.date===(0,t.venueYmd)(l)&&'noshow'===e.status).length;p.push({id:'noshow',icon:'\ud83e\ude91',tone:'amber',title:M?`${M} no-show today: deposits for 6+?`:'Deposits for bigger tables (example)',body:'Deposits are set per venue in Settings \u203a Advanced \u203a Deposits. Consider them on Fri/Sat after 19:00.',action:{label:'Bookings',tab:'bookings'}});const C=i.filter(e=>e.stars<=2).length;C&&p.push({id:'reviews',icon:'\ud83d\udcac',tone:'red',title:`${C} low rating this week: cold chips at collection`,body:'Readiness alerts now time bagging 5 min before pickup. Reply to say thanks and invite them back.',action:{label:'Reviews',tab:'more',sub:'reviews'}});return p.push({id:'commission',icon:'\ud83d\udcb7',tone:'ok',title:'You kept about \xa31,240 in commission this month',body:'Example: \xa34,140 of direct takeaway orders that would have cost about 30% on delivery apps.',action:{label:'Analytics',tab:'more',sub:'analytics'}}),p.push({id:'covers',icon:'\ud83c\udf7d\ufe0f',tone:'gold',title:`${c} covers so far today`,body:'Lobster special is the top add-on tonight. Suggest it with the scallops (example).'}),p};var e=_r(_d[0]),t=_r(_d[1]),o=_r(_d[2]);const a=e=>{let t=2166136261;for(let o=0;o>>0)/4294967295},n=['Dine-in','Takeaway','Table QR'];const r={Star:'Keep: high margin and popular. Feature it.','Plough horse':'Popular, low margin: nudge the price or trim the cost.',Puzzle:'High margin, few sales: promote it or rename it.',Dog:'Low margin, few sales: consider removing it.'},s=['Alex','Fiona','Iain','Morag','Callum','Eilidh','Ross','Kirsty','Euan','Shona','Hamish','Isla','Craig','Ailsa','Neil','Catriona'],i=['Morgan','Campbell','Fraser','McLeod','Kerr','Wallace','Boyd','Hamilton','Stewart','Murray','Paterson','Duncan','Gilmour','Reid','Ross','Grant'];const d=[{cat:'Fish & seafood',id:'haddock',name:'Haddock fillets',unit:'portions',onHand:8,perCover:.22,par:40},{cat:'Fruit & veg',id:'chips',name:'Chipping potatoes',unit:'kg',onHand:25,perCover:.18,par:40},{cat:'Fish & seafood',id:'langoustine',name:'Langoustines',unit:'kg',onHand:4,perCover:.03,par:6},{cat:'Fish & seafood',id:'mussels',name:'Mussels',unit:'kg',onHand:10,perCover:.05,par:12},{cat:'Fish & seafood',id:'scallops',name:'Scallops',unit:'portions',onHand:14,perCover:.06,par:20},{cat:'Meat',id:'beef',name:'Burger patties',unit:'each',onHand:30,perCover:.1,par:40},{cat:'Fruit & veg',id:'peas',name:'Garden peas',unit:'kg',onHand:6,perCover:.04,par:8},{cat:'Dairy',id:'tartare',name:'House tartare sauce',unit:'tubs',onHand:5,perCover:.05,par:10}],l=()=>(0,o.examplesAllowed)()?d:[];function u(o,a,n,r,s,i,d){const l=[],u=(0,e.forecastToday)(o,a,n,r,i);u.enough||l.push({id:'history',icon:'\ud83d\udcc5',tone:'gold',title:'Not enough history yet',body:u.suggestions[0]?.replace(/^Not enough history yet\. /,'')??'',action:{label:'Settings \u203a Advanced',tab:'more',sub:'advanced'}});const c=(0,t.ymd)(i),p=a.filter(e=>e.date===c&&'noshow'===e.status).length;p&&l.push({id:'noshow',icon:'\ud83e\ude91',tone:'amber',title:`${p} no-show${1===p?'':'s'} today`,body:'Think about a deposit for larger parties (Settings \u203a Advanced \u203a Deposits).',action:{label:'Bookings',tab:'bookings'}});const h=s.filter(e=>e.stars<=2).length;h&&l.push({id:'reviews',icon:'\ud83d\udcac',tone:'red',title:`${h} low rating${1===h?'':'s'} to read`,body:'Read what they said, reply to say thanks and invite them back.',action:{label:'Reviews',tab:'more',sub:'reviews'}});const b=r.filter(e=>e.date>=c).sort((e,t)=>e.date.localeCompare(t.date))[0];return b&&l.push({id:'event',icon:'\ud83d\udcc5',tone:'blue',title:`Coming up: ${b.title}`,body:`${(0,t.niceDate)(new Date(b.date+'T12:00:00'))}. Check your rota and think about a promo.`,action:{label:'Forecast',tab:'forecast'}}),l.push({id:'covers',icon:'\ud83c\udf7d\ufe0f',tone:'gold',title:`${d} covers so far today`,body:'Seated bookings and walk-ins recorded in CoverCharge today.'}),l}},1280,[870,818,1081]); +__d(function(g,r,i,a,m,e,_d){"use strict";function t(t,n){const o={};for(let c=0;c<7;c++){o[c]={};const u=n[c]??0;for(const[n,s]of Object.entries(t))o[c][Number(n)]=Math.round(s*u)}return o}Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"EXAMPLE_HISTORY",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"EXAMPLE_ACCURACY",{enumerable:!0,get:function(){return f}});const n={12:18,13:26,14:16,15:9,16:10,17:22,18:36,19:38,20:20},o={12:2,13:2,14:1,15:1,16:2,17:4,18:6,19:5,20:2},c={0:1.05,1:0,2:0,3:.6,4:.7,5:1,6:1.15},u={0:.6,1:.5,2:.5,3:.6,4:.7,5:.9,6:1},s={anchorage:{covers:t(n,c),takeaway:t(o,c)},default:{covers:t(n,u),takeaway:t(o,u)}},f='Example: last 4 weeks within \xb118% of actual covers'},1281,[]); +__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DEFAULT_MIN_WEEKS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"clampWeeks",{enumerable:!0,get:function(){return o}}),e.buildHistory=function(o,a,c,u,d,f=n){const l=(0,t.ymd)(d),y=(0,t.ymd)(new Date(d.getTime()-48384e5)),h=t=>t>=y&&tt.rid===o&&h(t.date));for(const t of k)D.add(t.date);const T=[...D].sort(),w=T.length?s(T[0],l):0,j=w>=7*f&&T.length>=2*f,O=t=>{const n={},o={};for(const t of T){const n=new Date(t+'T12:00:00').getDay();o[n]=(o[n]??0)+1}for(const[o,s]of Object.entries(t)){const t=new Date(o+'T12:00:00').getDay();n[t]??={};for(const[o,a]of Object.entries(s))n[t][Number(o)]=(n[t][Number(o)]??0)+a}for(const t of Object.keys(n))for(const s of Object.keys(n[+t]))n[+t][+s]=n[+t][+s]/(o[+t]||1);return n},M=Array.from({length:7},()=>[]);for(const t of k)'number'==typeof t.takings&&t.takings>0&&M[new Date(t.date+'T12:00:00').getDay()].push(Math.round(100*t.takings));const N=M.map(t=>t.length?Math.round(t.reduce((t,n)=>t+n,0)/t.length):null),_=k.filter(t=>'number'==typeof t.takings&&t.takings>0),E=(_.length?s(_.map(t=>t.date).sort()[0],l):0)>=7*f&&_.length>=2*f;return{covers:O(b),takeaway:O(p),days:T.length,spanDays:w,enough:j,minWeeks:f,takingsByDay:N,cashUps:_.length,salesEnough:E}};var t=r(_d[0]);const n=2,o=t=>{const o=Math.round(Number(t));return Number.isFinite(o)&&o>=1&&o<=8?o:n},s=(t,n)=>Math.round((new Date(n+'T12:00:00').getTime()-new Date(t+'T12:00:00').getTime())/864e5)},1282,[818]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"CHEF_ID",{enumerable:!0,get:function(){return x}}),_e.useChef=C,Object.defineProperty(_e,"isLow",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"stockValue",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"within7",{enumerable:!0,get:function(){return v}}),_e.useWeek=function(){const{k:e,c:r,now:t}=C(6e4),o=e.waste.filter(e=>v(e.at,t)).reduce((e,r)=>e+r.cost,0),n=e.stockTakes[0],s=n?n.lines.reduce((e,r)=>e+(r.expected-r.counted)*r.cost,0):0;return{...(0,b.weekGp)(r,o,s),wasteWeek:o,variance:Math.round(s)}},_e.useForecast=function(){const{r:e,rid:r,now:t}=C(6e4),o=(0,i.useBookings)(r),n=(0,i.useOrders)(r),s=(0,i.useEvents)(r),d=(0,u.useRealHistory)(r,t),c=(0,l.forecastToday)(e,o,n,s,t,d??void 0),f=c.hours.reduce((e,r)=>e+r.covers,0),b=c.hours.reduce((e,r)=>e+r.booked,0),p=c.hours.reduce((e,r)=>e+r.historicalCovers,0),y=c.enough&&p?Math.round((f-p)/p*100):0,w=['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'][(0,h.weekday)(t)],x=c.enough?`${w} ${y>=0?'+':''}${y}%${c.example?' (example figures)':''}`:'Not enough history yet';return{f:c,covers:f,booked:b,typical:p,pct:y,day:w,label:x,enough:c.enough,example:c.example}},_e.Tile=function({label:e,value:r,sub:t,tone:o,onPress:s,testID:i}){const d='red'===o?f.colours.red:'amber'===o?f.colours.amber:'ok'===o?f.colours.ok:f.colours.text;return(0,w.jsxs)(n.default,{testID:i,accessibilityRole:s?'button':void 0,accessibilityLabel:`${e}: ${r}`,onPress:s,style:({pressed:e})=>({flexGrow:1,flexBasis:150,minWidth:140,padding:12,borderRadius:14,borderWidth:1,borderColor:'red'===o?f.colours.red:f.colours.border,backgroundColor:e?'#1d1a14':f.colours.surface,gap:2}),children:[(0,w.jsx)(c.Muted,{children:e}),(0,w.jsx)(c.T,{size:22,weight:"bold",colour:d,children:r}),t?(0,w.jsx)(c.T,{size:12,colour:f.colours.muted,children:t}):null]})},_e.Seg=function({value:e,options:r,onChange:t}){return(0,w.jsx)(c.Row,{wrap:!0,gap:6,children:r.map(r=>(0,w.jsx)(n.default,{accessibilityRole:"tab",accessibilityState:{selected:e===r.id},accessibilityLabel:r.label,onPress:()=>t(r.id),style:{paddingHorizontal:12,paddingVertical:7,minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center',borderRadius:999,borderWidth:1,borderColor:e===r.id?f.colours.gold:f.colours.border,backgroundColor:e===r.id?f.colours.goldTint:'transparent'},children:(0,w.jsx)(c.T,{size:13,weight:e===r.id?'semibold':'regular',colour:e===r.id?f.colours.goldLight:f.colours.text,children:r.label})},r.id))})},_e.Bar=function({pct:e,colour:r=f.colours.gold}){return(0,w.jsx)(s.default,{style:{height:6,borderRadius:3,backgroundColor:f.colours.surface2,overflow:'hidden'},children:(0,w.jsx)(s.default,{style:{width:`${Math.max(0,Math.min(100,e))}%`,height:6,backgroundColor:r}})})},Object.defineProperty(_e,"pct1",{enumerable:!0,get:function(){return S}});var r=_r(_d[0]),t=e(_r(_d[1])),o=_r(_d[2]),n=e(_r(_d[3])),s=e(_r(_d[4])),i=_r(_d[5]),d=_r(_d[6]),u=_r(_d[7]),l=_r(_d[8]),c=_r(_d[9]),f=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),p=_r(_d[13]),y=_r(_d[14]),w=_r(_d[15]);const x=y.ROSTER.find(e=>'chef'===e.app)?.id??'';function C(e=3e4){const n=(0,d.useOwner)(e=>e.site),s=(0,i.useRestaurant)(n),u=(0,d.useOwner)(e=>e.staff),l=u.find(e=>e.id===x)?.name??'Head Chef',c=(0,i.useNow)(e),f=(0,i.useAllMenu)(n),h=(0,p.useKitchen)(),y=t.default.useMemo(()=>{const e=r.LIVE_HEAD_CHEF?{...h,...(0,p.stripKitchenExamples)(h)}:h,t=e.ingredients.filter(e=>(0,o.chefCanSee)(n,e)),s=new Set(e.ingredients.filter(e=>!(0,o.chefCanSee)(n,e)).map(e=>e.id));return{...e,ingredients:t,temps:e.temps.filter(e=>(0,o.chefCanSee)(n,e)),waste:e.waste.filter(e=>(0,o.chefCanSee)(n,e)&&!s.has(e.ing||'')),deliveries:e.deliveries.filter(e=>(0,o.chefCanSee)(n,e)).map(e=>({...e,lines:e.lines.filter(e=>!s.has(e.ing))})),orders:e.orders.filter(e=>(0,o.chefCanSee)(n,e)).map(e=>({...e,lines:e.lines.filter(e=>!s.has(e.ing))}))}},[h,n]),w=(0,b.costings)(f,y.recipes,y.ingredients,y.targetGp);return{rid:n,r:s,me:l,now:c,menu:f,k:y,c:w}}const k=(e,r)=>e>0&&e<.5*r,j=e=>Math.round(e.reduce((e,r)=>e+r.onHand*r.cost,0)),v=(e,r)=>r.getTime()-new Date(e).getTime()<6048e5;const S=e=>`${e.toFixed(1)}%`},1283,[1204,30,1025,263,127,819,856,1284,870,813,821,927,1279,1171,14,24]); +__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.useRealHistory=function(e,t){const o=(0,l.useExamples)(),n=(0,r.useBookings)(e),c=(0,r.useOrders)(e),f=(0,u.useCashUp)(e=>e.cashUps),y=(0,k.clampWeeks)((0,h.useStore)(s=>s.restaurants.find(s=>s.id===e)?.settings.forecastMinWeeks)),b=t.toDateString();return(0,s.useMemo)(()=>o?null:(0,k.buildHistory)(e,n,c,f.map(e=>({rid:e.rid,date:e.date,takings:(0,p.takings)(e.vals)})),t,y),[o,e,n,c,f,y,b])},Object.defineProperty(_e,"ExampleBadge",{enumerable:!0,get:function(){return b}}),_e.NotEnoughHistory=function({weeks:e,booked:s,what:t="Forecasts",testID:r="not-enough-history"}){return(0,y.jsx)(n.Card,{children:(0,y.jsxs)(o.default,{testID:r,style:{gap:6},children:[(0,y.jsx)(n.T,{weight:"semibold",colour:f.colours.gold,children:"Not enough history yet"}),(0,y.jsx)(n.Muted,{children:'Forecasts'===t?(0,c.notEnoughTip)(e):`${t} start once CoverCharge has ${1===e?'1 week':`${e} weeks`} of your bookings and cash-ups.`}),s?(0,y.jsx)(o.default,{testID:`${r}-booked`,children:(0,y.jsxs)(n.T,{children:["Booked so far: ",s," covers"]})}):null,(0,y.jsx)(n.Muted,{children:"Tip: upload or add your bookings and do the cash up each night. Managers can change how much history is needed in Settings \u203a Advanced."})]})})};var e,s=_r(d[0]),t=_r(d[1]),o=(e=t)&&e.__esModule?e:{default:e},n=_r(d[2]),r=_r(d[3]),u=_r(d[4]),c=_r(d[5]),l=_r(d[6]),h=_r(d[7]),p=_r(d[8]),k=_r(d[9]),f=_r(d[10]),y=_r(d[11]);const b=()=>(0,y.jsx)(n.Badge,{kind:"amber",label:c.EXAMPLE_LABEL.toUpperCase()})},1284,[30,127,813,819,1076,1081,1285,872,1117,1282,821,24]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useExamples",{enumerable:!0,get:function(){return l}});var t=r(d[0]),n=r(d[1]);const l=()=>(0,t.useSyncExternalStore)(n.onDataModeChange,n.examplesAllowed,n.examplesAllowed)},1285,[30,1081]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GpScreen=function({initial:e="dishes"}){const[t,l]=(0,s.useState)(e),{k:o}=(0,c.useChef)(),d=(0,a.useKitchen)(e=>e.setTarget);return(0,h.jsxs)(i.default,{style:{gap:12},children:[(0,h.jsx)(n.Card,{children:(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsxs)(i.default,{style:{flex:1},children:[(0,h.jsx)(n.T,{weight:"semibold",children:"Target GP"}),(0,h.jsx)(n.Muted,{children:"Dishes under target are flagged red."})]}),(0,h.jsx)(n.Button,{small:!0,kind:"secondary",label:"\u2212",accessibilityLabel:"Lower target",onPress:()=>d(o.targetGp-1)}),(0,h.jsxs)(n.T,{size:22,weight:"bold",colour:r.colours.gold,children:[o.targetGp,"%"]}),(0,h.jsx)(n.Button,{small:!0,kind:"secondary",label:"+",accessibilityLabel:"Raise target",onPress:()=>d(o.targetGp+1)})]})}),(0,h.jsx)(c.Seg,{value:t,onChange:l,options:[{id:'dishes',label:'Recipe cards & GP'},{id:'changes',label:'Price changes'},{id:'week',label:'Theoretical vs actual'},{id:'engineering',label:'Menu engineering'}]}),'dishes'===t?(0,h.jsx)(u,{}):'changes'===t?(0,h.jsx)(j,{}):'week'===t?(0,h.jsx)(b,{}):(0,h.jsx)(w,{})]})};var s=_r(_d[0]),t=e(_r(_d[1])),i=e(_r(_d[2])),n=_r(_d[3]),l=_r(_d[4]),r=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),a=_r(_d[9]),h=_r(_d[10]);function u(){const{c:e,k:t}=(0,c.useChef)(),[l,r]=(0,s.useState)(null),o=e.filter(e=>e.below),d=[...e].sort((e,s)=>e.gp-s.gp),a=e.find(e=>e.item.id===l);return e.length?(0,h.jsxs)(i.default,{style:{gap:10},children:[(0,h.jsx)(n.Muted,{children:"Menu prices include VAT (20%). GP is worked out on the price ex VAT: (price ex VAT \u2212 dish cost) \xf7 price ex VAT. VAT figures are for information only."}),o.length?(0,h.jsxs)(n.Banner,{kind:"danger",title:`${o.length} of ${e.length} dishes below ${t.targetGp}%`,children:[o.slice(0,6).map(e=>e.item.name).join(', '),o.length>6?'\u2026':'']}):(0,h.jsx)(n.Banner,{kind:"success",title:"All costed dishes on target"}),d.map(e=>(0,h.jsx)(p,{d:e,onPress:()=>r(e.item.id)},e.item.id)),(0,h.jsx)(n.Sheet,{visible:!!a,onClose:()=>r(null),title:a?.item.name??'',children:a?(0,h.jsx)(x,{d:a}):null})]}):(0,h.jsx)(n.Muted,{children:"No costed dishes yet. Add your real recipes and ingredient costs to see GP."})}function p({d:e,onPress:s}){return(0,h.jsxs)(t.default,{accessibilityRole:"button",accessibilityLabel:`${e.item.name}, GP ${e.gp.toFixed(1)} percent`,onPress:s,style:({pressed:s})=>({padding:12,borderRadius:12,borderWidth:1,borderColor:e.below?r.colours.red:r.colours.border,backgroundColor:s?'#1d1a14':e.below?r.colours.redBg:r.colours.surface,gap:2}),children:[(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{weight:"medium",style:{flex:1},children:e.item.name}),(0,h.jsx)(n.T,{weight:"bold",colour:e.below?r.colours.red:r.colours.ok,children:(0,c.pct1)(e.gp)})]}),(0,h.jsxs)(n.Muted,{children:["Cost ",(0,l.gbp)(e.cost)," \xb7 ",(0,l.gbp)(e.priceInc)," inc VAT (",(0,l.gbp)(e.priceEx)," ex) \xb7 cash GP ",(0,l.gbp)(e.cashGp)]}),e.below?(0,h.jsxs)(n.T,{size:12,colour:r.colours.red,children:["Below ",e.target,"%: price for target ",(0,l.gbp)((0,d.priceForTarget)(e.cost,e.target))," inc VAT"]}):null]})}function x({d:e}){const s=(0,a.useKitchen)(),t=s.recipes.find(s=>s.dishId===e.item.id);return(0,h.jsxs)(i.default,{style:{gap:8},children:[(0,h.jsxs)(n.Muted,{children:["Recipe card \xb7 ",t.yield]}),t.lines.map(t=>{const r=s.ingredients.find(e=>e.id===t.ing);if(!r)return null;const o='each'===r.unit?1:'kg'===r.unit&&t.qty<.1?.005:.01;return(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsxs)(i.default,{style:{flex:1},children:[(0,h.jsx)(n.T,{size:14,children:r.name}),(0,h.jsxs)(n.Muted,{children:[(0,l.gbp)(r.cost)," per ",r.unit]})]}),(0,h.jsx)(n.Button,{small:!0,kind:"ghost",label:"\u2212",accessibilityLabel:`Less ${r.name}`,onPress:()=>s.setRecipeQty(e.item.id,t.ing,Math.max(0,Math.round(1e3*(t.qty-o))/1e3))}),(0,h.jsx)(n.T,{size:13,style:{width:64,textAlign:'center'},children:(0,d.fmtQty)(t.qty,r.unit)}),(0,h.jsx)(n.Button,{small:!0,kind:"ghost",label:"+",accessibilityLabel:`More ${r.name}`,onPress:()=>s.setRecipeQty(e.item.id,t.ing,Math.round(1e3*(t.qty+o))/1e3)}),(0,h.jsx)(n.T,{size:13,style:{width:60,textAlign:'right'},children:(0,l.gbp)(Math.round(r.cost*t.qty))})]},t.ing)}),(0,h.jsxs)(i.default,{style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:8,gap:4},children:[(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{children:"Dish cost"}),(0,h.jsx)(n.T,{weight:"semibold",children:(0,l.gbp)(e.cost)})]}),(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{children:"Selling price inc VAT"}),(0,h.jsx)(n.T,{children:(0,l.gbp)(e.priceInc)})]}),(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.Muted,{children:"VAT (20%, for info)"}),(0,h.jsx)(n.Muted,{children:(0,l.gbp)(e.priceInc-e.priceEx)})]}),(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{children:"Price ex VAT"}),(0,h.jsx)(n.T,{children:(0,l.gbp)(e.priceEx)})]}),(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{children:"Cash GP"}),(0,h.jsx)(n.T,{weight:"semibold",children:(0,l.gbp)(e.cashGp)})]}),(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{children:"GP %"}),(0,h.jsx)(n.T,{weight:"bold",colour:e.below?r.colours.red:r.colours.ok,children:(0,c.pct1)(e.gp)})]}),(0,h.jsxs)(n.Banner,{kind:e.below?'warn':'info',title:`Price that hits ${e.target}%: ${(0,l.gbp)((0,d.priceForTarget)(e.cost,e.target))} inc VAT`,children:["Or bring the dish cost down to ",(0,l.gbp)(Math.floor(e.priceEx*(1-e.target/100))),". Prices are changed in CoverCharge for Managers (Menu & allergens)."]})]})]})}function j(){const{menu:e,k:s}=(0,c.useChef)(),t=(0,d.priceImpacts)(e,s.recipes,s.ingredients,s.targetGp);return t.length?(0,h.jsx)(i.default,{style:{gap:10},children:t.map(e=>(0,h.jsxs)(n.Card,{highlight:e.dropped.length?r.colours.red:void 0,children:[(0,h.jsxs)(n.T,{weight:"semibold",children:[e.ing.name," ",e.pct>0?'+':'',e.pct.toFixed(0),"%: ",e.dropped.length," dish",1===e.dropped.length?'':'es'," drop below target"]}),(0,h.jsxs)(n.Muted,{children:[(0,l.gbp)(e.ing.prevCost??0)," \u2192 ",(0,l.gbp)(e.ing.cost)," per ",e.ing.unit]}),e.dishes.map(e=>(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{size:14,style:{flex:1},children:e.item.name}),(0,h.jsxs)(n.T,{size:13,colour:r.colours.muted,children:[(0,c.pct1)(e.before)," \u2192 "]}),(0,h.jsx)(n.T,{size:13,weight:"semibold",colour:e.below?r.colours.red:r.colours.ok,children:(0,c.pct1)(e.after)}),e.dropped?(0,h.jsx)(n.Badge,{kind:"red",label:"NOW BELOW"}):null]},e.item.id))]},e.ing.id))}):(0,h.jsx)(n.Muted,{children:"No ingredient price changes since the last deliveries."})}function b(){const{k:e}=(0,c.useChef)(),s=(0,c.useWeek)();return s.sales?(0,h.jsxs)(i.default,{style:{gap:10},children:[(0,h.jsxs)(n.Row,{wrap:!0,gap:10,children:[(0,h.jsx)(c.Tile,{label:"Theoretical GP (recipes \xd7 sales)",value:(0,c.pct1)(s.theo),tone:s.theoe.soldWeek>0),t=s.reduce((e,s)=>e+s.soldWeek,0)/Math.max(1,s.length),r=s.reduce((e,s)=>e+s.cashGp,0)/Math.max(1,s.length),d={Star:[],'Plough horse':[],Puzzle:[],Dog:[]};return s.forEach(e=>d[(0,o.quadrant)(e.soldWeek,e.cashGp,t,r)].push(e)),(0,h.jsxs)(i.default,{style:{gap:10},children:[s.length?(0,h.jsx)(n.Muted,{children:"Popularity (sold per week) against cash GP per dish, using the live menu from CoverCharge for Managers. Example sales figures."}):(0,h.jsx)(n.Muted,{children:"Needs dish sales figures, which CoverCharge doesn't have on a real venue yet (no till link). Nothing is guessed."}),Object.keys(d).map(e=>(0,h.jsxs)(n.Card,{children:[(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{weight:"semibold",children:'Star'===e?'\u2b50 Stars':'Plough horse'===e?'\ud83d\udc0e Plough horses':'Puzzle'===e?'\u2754 Puzzles':'\ud83d\udc15 Dogs'}),(0,h.jsx)(n.Badge,{kind:"gold",label:`${d[e].length}`})]}),(0,h.jsx)(n.Muted,{children:o.QUADRANT_TIP[e]}),d[e].map(e=>(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{size:14,style:{flex:1},children:e.item.name}),(0,h.jsxs)(n.Muted,{children:[e.soldWeek,"/wk \xb7 ",(0,l.gbp)(e.cashGp)," \xb7 ",(0,c.pct1)(e.gp)]})]},e.item.id))]},e))]})}},1286,[30,263,127,813,816,821,1280,1279,1283,1171,24]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.PrepScreen=function(){const{k:e,menu:t,me:s,now:i}=(0,M.useChef)(),{covers:n,label:r,typical:l,enough:a,booked:o,f:c}=(0,M.useForecast)(),f=(0,w.ymd)(i),m=(0,T.dishStats)(t).filter(t=>e.recipes.some(e=>e.dishId===t.item.id)&&!['Sides','Desserts'].includes(t.item.section)),p=m.reduce((e,t)=>e+t.sold,0)||1,x=m.map(e=>({id:e.item.id,name:e.item.name,qty:Math.ceil(.85*n*(e.sold/p)*1.1)})).filter(e=>e.qty>0).sort((e,t)=>t.qty-e.qty),y={};x.forEach(t=>e.recipes.find(e=>e.dishId===t.id)?.lines.forEach(e=>{y[e.ing]=(y[e.ing]??0)+e.qty*t.qty}));const b=[{id:'haddock',text:`Portion ${x.filter(e=>['a-fishsupper','a-mini','a-tempura'].includes(e.id)).reduce((e,t)=>e+t.qty,0)} haddock portions (fish supper, tempura, Mini Anchors)`},{id:'chips',text:`Peel, cut and blanch ${(0,v.fmtQty)(Math.ceil(2*(y.potatoes??0))/2,'kg')} chipping potatoes`},{id:'batter',text:`Make up ${(0,v.fmtQty)(Math.ceil(10*(y.batter??0))/10+.5,'kg')} beer batter`},{id:'leaves',text:`Wash and spin ${(0,v.fmtQty)(Math.ceil(10*(y.leaves??0))/10,'kg')} salad leaves`},{id:'mussels',text:`Clean and debeard ${(0,v.fmtQty)(Math.ceil(2*(y.mussels??0))/2,'kg')} mussels (discard any open that don't close)`},{id:'sauce',text:'Garlic butter, tartare and Marie Rose: check, make and date-label'}],j=(0,B.useKitchen)(e=>e.tickPrep),C=[...b.map(e=>({key:`${f}:task:${e.id}`,text:e.text})),...x.map(e=>({key:`${f}:dish:${e.id}`,text:`${e.qty} \xd7 ${e.name}`}))],S=C.filter(t=>e.prepTicks[t.key]).length;return e.recipes.length&&e.ingredients.length?(0,D.jsxs)(h.default,{style:{gap:10},children:[a?null:(0,D.jsx)(u.Banner,{kind:"info",title:`Booked so far: ${o} covers`,children:`Not enough history yet. Forecasts start once CoverCharge has ${c.minWeeks} weeks of your bookings and cash-ups. Prep from what is booked and your own judgement.`}),a?(0,D.jsxs)(u.Banner,{kind:"info",title:`${r}: ${n} covers forecast`,children:["A typical ",r.split(' ')[0]," is about ",l," covers. Portions below are scaled from the forecast, bookings and the usual dish mix, plus 10% cover."]}):null,(0,D.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,D.jsx)(u.T,{weight:"semibold",children:"Prep list for today"}),(0,D.jsx)(u.Badge,{kind:S===C.length?'ok':'gold',label:`${S}/${C.length} done`})]}),C.map((t,i)=>{const n=e.prepTicks[t.key];return(0,D.jsxs)(d.default,{accessibilityRole:"checkbox",accessibilityState:{checked:!!n},accessibilityLabel:t.text,onPress:()=>j(t.key,n?null:s),style:{flexDirection:'row',gap:10,alignItems:'center',padding:10,borderRadius:10,borderWidth:1,borderColor:n?k.colours.ok:k.colours.border,backgroundColor:k.colours.surface,marginTop:i===b.length?8:0},children:[(0,D.jsx)(u.T,{size:18,colour:n?k.colours.ok:k.colours.muted,children:n?'\u2611':'\u2610'}),(0,D.jsxs)(h.default,{style:{flex:1},children:[(0,D.jsx)(u.T,{size:14,style:n?{textDecorationLine:'line-through',color:k.colours.muted}:void 0,children:t.text}),n?(0,D.jsxs)(u.Muted,{children:[n.by," \xb7 ",new Date(n.at).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})]}):null]})]},t.key)})]}):(0,D.jsx)(u.Muted,{children:"No prep list yet. Add your real recipe costs and ingredients to build it."})},_e.WasteScreen=function(){const{k:e,me:n,now:r,rid:l}=(0,M.useChef)(),a=(0,M.useWeek)(),d=(0,B.useKitchen)(e=>e.addWaste),[f,m]=(0,o.useState)(e.ingredients[0]?.id),[p,x]=(0,o.useState)(''),[y,j]=(0,o.useState)('Over-production'),w=e.ingredients.find(e=>e.id===f),C=Number(p.replace(',','.'))||0,S=C>=0&&(!w||!(0,s.fishInStone)(l,w)||Number.isInteger(2*C)),T=w&&S?(0,s.inputQuantity)(l,w,C):0,v=e.waste.filter(e=>(0,M.within7)(e.at,r));return w?(0,D.jsxs)(h.default,{style:{gap:10},children:[(0,D.jsxs)(u.Row,{wrap:!0,gap:10,children:[(0,D.jsx)(M.Tile,{label:"Waste this week",value:(0,b.gbp)(a.wasteWeek),sub:`${v.length} entries`,tone:a.sales&&a.wasteWeek/a.sales>.02?'amber':'ok'}),(0,D.jsx)(M.Tile,{label:"Waste as % of food sales",value:a.sales?(0,M.pct1)(a.wasteWeek/a.sales*100):'\u2014',sub:a.sales?'Food sales ex VAT, this week':'Needs dish sales (no till link yet)'})]}),(0,D.jsxs)(u.Card,{children:[(0,D.jsx)(u.T,{weight:"semibold",children:"Log waste"}),(0,D.jsx)(c.default,{horizontal:!0,showsHorizontalScrollIndicator:!1,children:(0,D.jsx)(u.Row,{gap:6,children:e.ingredients.map(e=>(0,D.jsx)(u.Chip,{label:e.name,selected:e.id===f,onPress:()=>m(e.id)},e.id))})}),(0,D.jsxs)(u.Row,{gap:8,children:[(0,D.jsx)(t.TextInput,{accessibilityLabel:`Waste quantity in ${(0,s.quantityUnit)(l,w)}`,accessibilityValue:{text:(0,i.ingredientSpeech)(l,w,T)},keyboardType:"decimal-pad",value:p,onChangeText:x,placeholder:`qty (${(0,s.quantityUnit)(l,w)})`,placeholderTextColor:k.colours.muted,style:{flex:1,minHeight:44,borderWidth:1,borderColor:k.colours.border,borderRadius:8,padding:8,color:k.colours.text}}),(0,D.jsx)(u.T,{children:(0,s.quantityUnit)(l,w)}),(0,D.jsx)(u.T,{weight:"semibold",colour:k.colours.gold,children:(0,b.gbp)(Math.round(T*w.cost))})]}),(0,s.fishInStone)(l,w)?(0,D.jsxs)(u.Row,{children:[(0,D.jsx)(u.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:`Waste half a stone less ${w.name}`,onPress:()=>x(String(Math.max(0,(0,s.halfStone)(C)-.5)))}),(0,D.jsx)(u.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:`Waste half a stone more ${w.name}`,onPress:()=>x(String((0,s.halfStone)(C)+.5))}),(0,D.jsx)(u.Muted,{children:"Half-stone amounts"})]}):null,(0,D.jsx)(u.Row,{wrap:!0,gap:6,children:B.WASTE_REASONS.map(e=>(0,D.jsx)(u.Chip,{label:e,selected:e===y,onPress:()=>j(e)},e))}),(0,D.jsx)(u.Button,{label:"Add to waste log",disabled:T<=0,onPress:()=>{d({by:n,item:w.name,ing:w.id,qty:T,unit:w.unit,reason:y,cost:Math.round(T*w.cost)}),x('')}}),(0,D.jsx)(u.Muted,{children:"Logged waste also comes off stock."})]}),e.waste.slice(0,20).map(e=>(0,D.jsxs)(u.Row,{style:{justifyContent:'space-between',paddingVertical:2},children:[(0,D.jsxs)(h.default,{style:{flex:1},children:[(0,D.jsxs)(u.T,{size:14,children:[e.item," \xb7 ",(0,i.ingredientQty)(l,{name:e.item,unit:e.unit},e.qty)]}),(0,D.jsxs)(u.Muted,{children:[e.reason," \xb7 ",new Date(e.at).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'})," \xb7 ",e.by]})]}),(0,D.jsx)(u.T,{size:14,children:(0,b.gbp)(e.cost)})]},e.id))]}):(0,D.jsx)(u.Muted,{children:"No stock items yet. Add your real ingredients before logging waste."})},_e.AllergenScreen=function({openCards:e}={}){const{k:t,me:s,rid:i}=(0,M.useChef)(),n=(0,f.useRecipeCards)(i),r=(0,x.auditView)('chef',(0,f.useAudit)(i)).filter(e=>/allergen|recipe card|sign/i.test(e.text)).slice(0,12),l=n.slice().sort((e,t)=>e.section.localeCompare(t.section)||e.dish.localeCompare(t.dish)).map(e=>{const s=t.recipes.find(t=>t.dishId===e.menuItemId),i=new Set(s?s.lines.flatMap(e=>t.ingredients.find(t=>t.id===e.ing)?.allergens??[]):[]),n=[...i].filter(t=>!e.allergens[t]);return{card:e,fromCosting:i,missing:n}}),a={name:s,role:'head-chef'};return(0,D.jsxs)(h.default,{style:{gap:10},testID:"allergen-matrix",children:[(0,D.jsx)(u.Muted,{children:"The 14 allergens from each recipe card (C contains, m may contain). These are what guests see on the menu, takeaway and the booking allergy check. A red cell means the costing recipe uses an ingredient with that allergen but the card doesn't list it."}),e?(0,D.jsx)(u.Button,{testID:"open-recipe-cards",small:!0,kind:"secondary",label:"Open recipe cards \u203a",onPress:e}):null,(0,D.jsx)(c.default,{horizontal:!0,children:(0,D.jsxs)(h.default,{children:[(0,D.jsxs)(u.Row,{gap:0,children:[(0,D.jsx)(h.default,{style:{width:150},children:(0,D.jsx)(u.Muted,{children:"Dish"})}),y.ALLERGENS.map(e=>(0,D.jsx)(h.default,{style:{width:34,alignItems:'center'},children:(0,D.jsx)(u.T,{size:10,colour:k.colours.muted,children:e.short})},e.id))]}),l.map(({card:e,fromCosting:t})=>(0,D.jsxs)(u.Row,{gap:0,style:{borderTopWidth:1,borderColor:k.colours.border,paddingVertical:4},children:[(0,D.jsx)(h.default,{style:{width:150},children:(0,D.jsx)(u.T,{size:12,numberOfLines:2,children:e.dish})}),y.ALLERGENS.map(s=>{const i=e.allergens[s.id],n=t.has(s.id)&&!i;return(0,D.jsx)(h.default,{accessibilityLabel:`${e.dish} ${s.label}: ${'contains'===i?'contains':'may'===i?'may contain':n?'in the costing recipe, not on the card':'no'}`,style:{width:34,height:24,alignItems:'center',justifyContent:'center',backgroundColor:n?k.colours.redBg:'transparent'},children:(0,D.jsx)(u.T,{size:11,weight:'contains'===i?'bold':'regular',colour:n?k.colours.red:'contains'===i?k.colours.gold:i?k.colours.muted:'#444',children:'contains'===i?'C':'may'===i?'m':n?'!':'\xb7'})},s.id)})]},e.id))]})}),(0,D.jsx)(u.Muted,{children:"C card says contains \xb7 m may contain \xb7 ! in the costing recipe but not on the card"}),l.filter(e=>e.missing.length||!e.card.signOff).map(({card:t,missing:s})=>(0,D.jsxs)(u.Card,{highlight:s.length?k.colours.red:k.colours.amber,children:[(0,D.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,D.jsx)(u.T,{weight:"semibold",style:{flex:1},children:t.dish}),t.signOff?(0,D.jsx)(u.Badge,{kind:"ok",label:"Signed off"}):(0,D.jsx)(u.Badge,{kind:"amber",label:"Awaiting sign-off"})]}),s.length?(0,D.jsxs)(u.T,{size:13,colour:k.colours.red,children:["Costing recipe has ",s.map(e=>y.ALLERGENS.find(t=>t.id===e)?.short).join(', '),", not on the card"]}):null,(0,D.jsxs)(u.Row,{wrap:!0,gap:8,children:[s.length?(0,D.jsx)(u.Button,{small:!0,label:"Add to the card",onPress:()=>{const e={...t.allergens};s.forEach(t=>{e[t]='contains'}),(0,m.recipeCards)().update(t.id,{allergens:e},a).catch(()=>{})}}):null,e?(0,D.jsx)(u.Button,{small:!0,kind:"secondary",label:"Check and sign off on the card",onPress:e}):null]})]},t.id)),(0,D.jsxs)(u.Card,{children:[(0,D.jsx)(u.T,{weight:"semibold",children:"Audit log"}),r.length?r.map(e=>(0,D.jsxs)(u.Muted,{children:[new Date(e.at).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})," \xb7 ",e.text]},e.id)):(0,D.jsx)(u.Muted,{children:"No allergen changes yet."})]})]})},_e.ComplianceScreen=function(){const{k:e,me:s,now:i,rid:r}=(0,M.useChef)(),l=(0,w.ymd)(i),a=(0,B.useKitchen)(e=>e.addTemp),c=(0,p.useOwner)(e=>e.checks),{tick:f,untick:m}=p.useOwner.getState(),[x,y]=(0,o.useState)('fridge'),b=A.find(e=>e.id===x),j={...b,units:b.units.filter(e=>(0,n.chefCanSee)(r,e))},[C,S]=(0,o.useState)(j.units[0]),[T,v]=(0,o.useState)(''),R=Number(T.replace(',','.')),$=T.trim()&&!Number.isNaN(R)?j.ok(R):null,I=e.temps.filter(e=>e.at.slice(0,10)===l),L=(e,t,i)=>{const n=c[e];return(0,D.jsxs)(d.default,{accessibilityRole:"checkbox",accessibilityState:{checked:!!n},accessibilityLabel:t,onPress:()=>n?m(e):f(e,s,(new Date).toISOString()),style:{flexDirection:'row',gap:10,alignItems:'center',paddingVertical:6},children:[(0,D.jsx)(u.T,{size:18,colour:n?k.colours.ok:k.colours.muted,children:n?'\u2611':'\u2610'}),(0,D.jsxs)(h.default,{style:{flex:1},children:[(0,D.jsx)(u.T,{size:14,children:t}),(0,D.jsx)(u.Muted,{children:n?`${n.by} \xb7 ${new Date(n.at).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})}`:i??''})]})]},e)};return(0,D.jsxs)(h.default,{style:{gap:10},children:[(0,D.jsxs)(u.Card,{children:[(0,D.jsx)(u.T,{weight:"semibold",children:"Record a temperature"}),(0,D.jsx)(u.Row,{wrap:!0,gap:6,children:A.map(e=>(0,D.jsx)(u.Chip,{label:e.label,selected:e.id===x,onPress:()=>{y(e.id),S(e.units.filter(e=>(0,n.chefCanSee)(r,e))[0])}},e.id))}),(0,D.jsx)(u.Row,{wrap:!0,gap:6,children:j.units.map(e=>(0,D.jsx)(u.Chip,{label:e,selected:e===C,onPress:()=>S(e)},e))}),(0,D.jsx)(u.Muted,{children:j.rule}),(0,D.jsxs)(u.Row,{gap:8,children:[(0,D.jsx)(t.TextInput,{accessibilityLabel:"Temperature in degrees C",keyboardType:"numbers-and-punctuation",value:T,onChangeText:v,placeholder:"\xb0C",placeholderTextColor:k.colours.muted,style:{width:90,borderWidth:1,borderColor:k.colours.border,borderRadius:8,padding:8,color:k.colours.text}}),null===$?null:(0,D.jsx)(u.Badge,{kind:!0===$?'ok':'warn'===$?'amber':'red',label:!0===$?'OK':'warn'===$?'CHECK':'OUT OF RANGE'}),(0,D.jsx)(u.Button,{small:!0,label:"Save",disabled:null===$,onPress:()=>{a({by:s,kind:x,unit:C,temp:R,note:!0===$?void 0:'Action needed'}),v('')}})]}),!1===$?(0,D.jsx)(u.Banner,{kind:"danger",title:"Out of range",children:"Record what you did (e.g. moved food, called the engineer, cooked longer) and re-check."}):null]}),(0,D.jsxs)(u.Card,{children:[(0,D.jsxs)(u.T,{weight:"semibold",children:["Today's readings (",I.length,")"]}),I.length?I.map(e=>{const t=A.find(t=>t.id===e.kind)?.ok(e.temp);return(0,D.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,D.jsx)(u.T,{size:14,style:{flex:1},children:e.unit}),(0,D.jsx)(u.Muted,{children:new Date(e.at).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})}),(0,D.jsxs)(u.T,{size:14,weight:"semibold",colour:!0===t?k.colours.ok:'warn'===t?k.colours.amber:k.colours.red,children:[e.temp,"\xb0C"]})]},e.id)}):(0,D.jsx)(u.Muted,{children:"None yet today."})]}),(0,D.jsxs)(u.Card,{children:[(0,D.jsx)(u.T,{weight:"semibold",children:"Opening and closing checks"}),(0,D.jsx)(u.Muted,{children:"Day-to-day checks in the style of a CookSafe diary. Your own CookSafe manual is the record that counts."}),P.map(e=>L(`${l}:kc-${e.id}`,e.text))]}),(0,D.jsxs)(u.Card,{children:[(0,D.jsx)(u.T,{weight:"semibold",children:"Cleaning schedule"}),N.map(e=>L('Daily'===e.freq?`${l}:kcl-${e.id}`:`wk${Math.floor(i.getTime()/6048e5)}:kcl-${e.id}`,e.text,e.freq))]})]})},_e.TeamScreen=function(){const{rid:e,r:t,me:s,now:i,menu:n}=(0,M.useChef)(15e3),[r,a]=(0,o.useState)('live'),d=(0,S.useSignedIn)(),c=(0,o.useMemo)(()=>({meId:d?.id??M.CHEF_ID,role:'staff'}),[d?.id]);return(0,D.jsx)(C.ChatAsCtx.Provider,{value:c,children:(0,D.jsxs)(h.default,{style:{gap:10},children:[(0,D.jsx)(q,{sub:r,setSub:a}),'live'===r?(0,D.jsx)(E,{}):'soldout'===r?(0,D.jsx)(l.SoldOutList,{rid:e,by:s}):'team'===r?(0,D.jsx)(G,{}):(0,D.jsx)(W,{}),void 0,void 0,void 0,void 0,void 0]})})};var t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),n=_r(_d[3]),r=_r(_d[4]),l=_r(_d[5]),a=_r(_d[6]),o=_r(_d[7]),d=e(_r(_d[8])),c=e(_r(_d[9])),h=e(_r(_d[10])),u=_r(_d[11]),f=_r(_d[12]),m=_r(_d[13]),p=_r(_d[14]),x=_r(_d[15]),y=_r(_d[16]),b=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),k=_r(_d[20]),C=_r(_d[21]),S=_r(_d[22]),T=_r(_d[23]),v=_r(_d[24]),R=_r(_d[25]),$=_r(_d[26]),M=_r(_d[27]),B=_r(_d[28]),I=_r(_d[29]),L=_r(_d[30]),O=_r(_d[31]),z=_r(_d[32]),D=_r(_d[33]);const A=[{id:'fridge',label:'Fridge',units:['Walk-in fridge','Prep fridge','Bar fridge'],rule:'Target 5\xb0C or below (8\xb0C maximum)',ok:e=>e<=5||e<=8&&'warn'},{id:'freezer',label:'Freezer',units:['Chest freezer','Upright freezer'],rule:'Target \u221218\xb0C or below',ok:e=>e<=-18||e<=-15&&'warn'},{id:'cook',label:'Cooking (core)',units:['Fish','Chicken','Pie','Burger'],rule:'Core 75\xb0C or above',ok:e=>e>=75},{id:'reheat',label:'Reheating',units:['Soup','Skink','Sauce'],rule:'Core 82\xb0C or above (Scotland)',ok:e=>e>=82},{id:'hot hold',label:'Hot holding',units:['Bain-marie','Soup kettle'],rule:'63\xb0C or above',ok:e=>e>=63},{id:'cool',label:'Cooling',units:['Stock','Rice','Braise'],rule:'Below 8\xb0C, cooled as quickly as possible (aim for 90 minutes)',ok:e=>e<8||'warn'}],N=[{id:'surfaces',text:'Work surfaces and boards cleaned and sanitised',freq:'Daily'},{id:'fryers',text:'Fryers filtered, oil checked',freq:'Daily'},{id:'floors',text:'Floors and drains',freq:'Daily'},{id:'handwash',text:'Wash-hand basins stocked (soap, towels)',freq:'Daily'},{id:'fridges',text:'Fridges emptied and cleaned',freq:'Weekly'},{id:'extract',text:'Extraction canopy filters',freq:'Weekly'}],P=[{id:'open-temps',text:'Opening: fridge and freezer temperatures recorded',when:'Opening'},{id:'open-fit',text:'Opening: staff fit for work (no sickness or diarrhoea in 48 hours)',when:'Opening'},{id:'open-probe',text:'Opening: probe thermometer checked and wiped',when:'Opening'},{id:'close-label',text:'Closing: food covered, labelled and dated',when:'Closing'},{id:'close-dates',text:'Closing: anything past its use-by removed',when:'Closing'},{id:'close-clean',text:'Closing: cleaning schedule done',when:'Closing'}];function q({sub:e,setSub:t}){const{total:s}=(0,C.useChatUnread)();return(0,D.jsx)(M.Seg,{value:e,onChange:t,options:[{id:'live',label:'Live tickets'},{id:'soldout',label:'Sold out'},{id:'team',label:"Who's on & rota"},{id:'chat',label:s?`Chat (${s})`:'Chat'}]})}function W(){return(0,D.jsx)(C.Chat,{go:()=>{}})}function E(){const{rid:e,r:t,me:s,now:i}=(0,M.useChef)(15e3),n=(0,f.useStore)(e=>e.bookings),l=(0,f.useOrders)(e),o=l.filter(e=>(0,a.waitingForStaff)(e)).length,d=l.filter(a.kitchenCanSee).filter(e=>['new','acknowledged','preparing'].includes(e.status)||'ready'===e.status&&'pass'===(0,$.nextStep)(e,(0,$.linkedBooking)(e,n))),c=(e,t)=>!!(0,$.statusBlock)(e,t,(0,$.linkedBooking)(e,n)),m=(0,x.ticketView)('chef',d),p=(0,f.useStore)(e=>e.setOrderStatus),b=(0,f.useStore)(e=>e.ackReadiness),w=d.flatMap(e=>(0,j.readinessFor)(e,t,i)).filter(e=>'due'===e.state||'overdue'===e.state);return(0,D.jsxs)(h.default,{style:{gap:8},children:[w.length?(0,D.jsx)(u.Banner,{kind:"warn",title:`${w.length} readiness alert${w.length>1?'s':''}`,children:w.map(e=>e.detail).join(' \xb7 ')}):(0,D.jsx)(u.Muted,{children:"No readiness alerts right now."}),o?(0,D.jsxs)(u.Muted,{children:[o," table order",o>1?'s':''," waiting for front of house to accept (the first order from a new phone). It shows here once accepted."]}):null,m.length?m.map(e=>(0,D.jsxs)(u.Card,{highlight:e.allergies.length&&(0,$.nextStep)(e,(0,$.linkedBooking)(e,n))&&'ready'!==e.status?k.colours.red:void 0,children:[(0,D.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,D.jsxs)(u.T,{weight:"semibold",children:['table'===e.type?`${(0,r.tableNumbers)(e.tableNo)}`:`Takeaway ${e.slotTime?new Date(e.slotTime).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}):''}`," \xb7 ",e.ref]}),(0,D.jsx)(u.Badge,{kind:'new'===e.status?'amber':'gold',label:e.status.toUpperCase()})]}),e.lines.map((e,t)=>(0,D.jsxs)(u.T,{size:14,children:[e.qty," \xd7 ",e.name]},t)),e.allergies.length?(0,D.jsxs)(u.T,{size:13,colour:k.colours.red,children:["\u26a0 Allergy: ",e.allergies.map(e=>`${y.ALLERGENS.find(t=>t.id===e.allergen)?.label} (${e.severity})`).join(', ')]}):null,'takeaway'===e.type&&e.accepted?(0,D.jsxs)(u.T,{size:13,colour:k.colours.ok,children:["\u2713 Confirmed by ",e.accepted.by,Object.keys(e.allergyTicks??{}).length?` \xb7 kitchen checked: ${Object.keys(e.allergyTicks).map(e=>y.ALLERGENS.find(t=>t.id===e)?.label??e).join(', ')}`:'']}):null,e.allergies.length?(0,D.jsx)(R.AllergyChain,{o:e,me:s}):null,(0,D.jsxs)(u.Row,{wrap:!0,gap:8,children:['preparing'!==e.status&&'ready'!==e.status?(0,D.jsx)(u.Button,{small:!0,label:"Start",testID:`start-${e.ref}`,disabled:c(e,'preparing'),onPress:()=>{p(e.id,'preparing',s),'takeaway'===e.type&&b(e.id,'cook',s)}}):null,'ready'!==e.status?(0,D.jsx)(u.Button,{small:!0,kind:"success",label:"Ready",testID:`ready-${e.ref}`,disabled:c(e,'ready'),onPress:()=>p(e.id,'ready',s)}):null]})]},e.id)):(0,D.jsx)(u.Muted,{children:"No live tickets. New orders from the customer app and the Staff app show here."})]})}const F=(e,t)=>{const[s,i,n]=e.split('-').map(Number);return(0,w.ymd)(new Date(s,i-1,n+t))};function G(){const{now:e,today:t}={...(0,M.useChef)(6e4),today:(0,w.ymd)(new Date)},{staff:s,shifts:i}=(0,x.rotaView)('chef',(0,p.useOwner)(e=>e.staff),(0,p.useOwner)(e=>e.shifts)),n=(0,p.useOwner)(e=>e.attendance).filter(e=>e.date===t&&e.in&&!e.out),r=(0,S.weekday)(e),l=s.filter(e=>/kitchen|chef|kp/i.test(e.job+e.name)),a=(0,O.useSession)(e=>e.meId),o=(0,z.useSync)(e=>e.staffRef),d=a??o??M.CHEF_ID,c=(0,p.useOwner)(e=>e.staff.find(e=>e.id===d)?.name??'Chef').replace(/\s*\(.*\)$/,'');return(0,D.jsxs)(h.default,{style:{gap:10},children:[(0,D.jsx)(L.BreakRoomCard,{staffId:d,name:c,now:e}),(0,D.jsxs)(u.Card,{children:[(0,D.jsx)(u.T,{weight:"semibold",children:"On now"}),n.length?n.map(e=>(0,D.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,D.jsxs)(u.Row,{gap:8,style:{flex:1},children:[(0,D.jsx)(I.StaffAvatar,{id:e.staffId,size:28}),(0,D.jsx)(u.T,{size:14,children:s.find(t=>t.id===e.staffId)?.name??e.staffId})]}),(0,D.jsxs)(u.Muted,{children:["since ",new Date(e.in).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})]})]},e.id)):(0,D.jsx)(u.Muted,{children:"Nobody clocked in yet."})]}),(0,D.jsxs)(u.Card,{children:[(0,D.jsxs)(u.T,{weight:"semibold",children:["Today on the rota (",S.DAY3[r],")"]}),i.filter(e=>e.date===t).map(e=>(0,D.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,D.jsxs)(u.Row,{gap:8,style:{flex:1},children:[(0,D.jsx)(I.StaffAvatar,{id:e.staffId,size:28}),(0,D.jsx)(u.T,{size:14,children:s.find(t=>t.id===e.staffId)?.name})]}),(0,D.jsxs)(u.Muted,{children:[(0,S.fmtH)(e.start),"\u2013",(0,S.fmtH)(e.end)]})]},e.id))]}),(0,D.jsxs)(u.Card,{children:[(0,D.jsx)(u.T,{weight:"semibold",children:"Kitchen rota this week"}),l.map(e=>(0,D.jsxs)(h.default,{style:{gap:4},children:[(0,D.jsx)(u.T,{size:14,children:e.name}),(0,D.jsx)(u.Row,{wrap:!0,gap:4,children:S.DAY3.map((s,n)=>{const l=i.find(s=>s.staffId===e.id&&s.date===F(t,n-r));return(0,D.jsxs)(h.default,{style:{width:44,padding:4,borderRadius:6,backgroundColor:l?k.colours.goldTint:k.colours.surface2,alignItems:'center'},children:[(0,D.jsx)(u.T,{size:10,colour:k.colours.muted,children:s}),(0,D.jsx)(u.T,{size:10,children:l?`${(0,S.fmtH)(l.start).slice(0,2)}\u2013${(0,S.fmtH)(l.end).slice(0,2)}`:'off'})]},s)})})]},e.id)),(0,D.jsx)(u.Muted,{children:"Rota changes, swaps and leave are made in CoverCharge for Managers. This view shows shifts only."})]})]})}},1287,[877,1026,1288,1025,808,993,876,30,263,151,127,813,819,831,856,807,814,816,1289,818,821,1000,927,1280,1279,939,940,1283,1171,953,1030,859,820,24]); +__d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ingredientQty",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"ingredientSpeech",{enumerable:!0,get:function(){return f}});var t=r(d[0]),n=r(d[1]);const i=(i,f,u)=>(0,n.fishInStone)(i,f)?(0,n.fishQtyText)(i,f,u):(0,t.fmtQty)(u,f.unit||''),f=(t,f,u)=>(0,n.fishInStone)(t,f)?(0,n.fishQtySpeech)(t,f,u):i(t,f,u)},1288,[1279,1026]); +__d(function(g,_r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.readinessFor=function(a,d,r){if('takeaway'!==a.type||!a.slotTime)return[];if(['collected','cancelled','closed'].includes(a.status))return[];const s=new Date(a.slotTime),n=d.settings.bufferMins,o=a.lines.map(a=>({name:a.name,qty:a.qty,at:(0,t.addMins)(s,-(a.prepMins+n))})),u=o.reduce((t,a)=>a.at{if(a)return'done';const d=r.getTime()-t.getTime();return d<0?'upcoming':d>3e5?'overdue':'due'},y=['ready','collected'].includes(a.status);return[{id:`${a.id}:cook`,orderId:a.id,stage:'cook',due:u,state:l(u,!!a.readiness.cook||y),detail:o.sort((t,a)=>t.at.getTime()-a.at.getTime()).map(t=>{return`${t.qty}\xd7 ${t.name} at ${a=t.at,`${String(a.getHours()).padStart(2,'0')}:${String(a.getMinutes()).padStart(2,'0')}`}`;var a}).join(' \xb7 ')},{id:`${a.id}:bag`,orderId:a.id,stage:'bag',due:c,state:l(c,!!a.readiness.bag||y),detail:'Bag, add sauces/drinks, check against ticket and allergy flags'},{id:`${a.id}:ready`,orderId:a.id,stage:'ready',due:s,state:l(s,y),detail:'Mark ready \u2014 sends the customer a "your order is ready" notification'}]};var t=_r(_d[0])},1289,[818]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"inlineStyles",{enumerable:!0,get:function(){return n.inlineStyles}}),Object.defineProperty(_e,"loadLocalRawResource",{enumerable:!0,get:function(){return n.loadLocalRawResource}}),Object.defineProperty(_e,"LocalSvg",{enumerable:!0,get:function(){return n.LocalSvg}}),Object.defineProperty(_e,"SvgCss",{enumerable:!0,get:function(){return n.SvgCss}}),Object.defineProperty(_e,"SvgCssUri",{enumerable:!0,get:function(){return n.SvgCssUri}}),Object.defineProperty(_e,"SvgWithCss",{enumerable:!0,get:function(){return n.SvgWithCss}}),Object.defineProperty(_e,"SvgWithCssUri",{enumerable:!0,get:function(){return n.SvgWithCssUri}}),Object.defineProperty(_e,"WithLocalSvg",{enumerable:!0,get:function(){return n.WithLocalSvg}}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return f.default}}),Object.defineProperty(_e,"camelCase",{enumerable:!0,get:function(){return e.camelCase}}),Object.defineProperty(_e,"fetchText",{enumerable:!0,get:function(){return t.fetchText}}),Object.defineProperty(_e,"parse",{enumerable:!0,get:function(){return e.parse}}),Object.defineProperty(_e,"SvgAst",{enumerable:!0,get:function(){return e.SvgAst}}),Object.defineProperty(_e,"SvgFromUri",{enumerable:!0,get:function(){return e.SvgFromUri}}),Object.defineProperty(_e,"SvgFromXml",{enumerable:!0,get:function(){return e.SvgFromXml}}),Object.defineProperty(_e,"SvgUri",{enumerable:!0,get:function(){return e.SvgUri}}),Object.defineProperty(_e,"SvgXml",{enumerable:!0,get:function(){return e.SvgXml}});var e=r(d[0]),t=r(d[1]),n=r(d[2]),u=r(d[3]);Object.keys(u).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return u[e]}})});var o=r(d[4]);Object.keys(o).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return o[e]}})});var c,f=(c=o)&&c.__esModule?c:{default:c}},1290,[1291,1292,1311,1312,1294]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.SvgAst=c,_e.SvgXml=l,_e.SvgUri=function(r){const{onError:o=i,uri:s,onLoad:c,fallback:u}=r,[f,p]=(0,t.useState)(null),[d,h]=(0,t.useState)(!1);if((0,t.useEffect)(()=>{s?(0,n.fetchText)(s).then(t=>{p(t),d&&h(!1),c?.()}).catch(t=>{o(t),h(!0)}):p(null)},[o,s,c]),d)return u??null;return e.createElement(l,{xml:f,override:r,fallback:u})},Object.defineProperty(_e,"SvgFromXml",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"SvgFromUri",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"camelCase",{enumerable:!0,get:function(){return d}}),_e.getStyle=h,_e.astToReact=x,_e.parse=j,Object.defineProperty(_e,"tags",{enumerable:!0,get:function(){return r.tags}});var t=_r(_d[0]),e=(function(t){if(t&&t.__esModule)return t;var e={};return t&&Object.keys(t).forEach(function(n){if('default'!==n){var r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:function(){return t[n]}})}}),e.default=t,e})(t),n=_r(_d[1]),r=_r(_d[2]);function o(){return o=Object.assign?Object.assign.bind():function(t){for(var e=1;enull!==o?j(o):null,[o]);return e.createElement(c,{ast:r,override:s||n})}catch(t){return r(t),l??null}}class u extends t.Component{state={ast:null};componentDidMount(){this.parse(this.props.xml)}componentDidUpdate(t){const{xml:e}=this.props;e!==t.xml&&this.parse(e)}parse(t){const{onError:e=i}=this.props;try{this.setState({ast:t?j(t):null})}catch(t){const n=t;e({...n,message:`[RNSVG] Couldn't parse SVG, reason: ${n.message}`})}}render(){const{props:t,state:{ast:n}}=this;return e.createElement(c,{ast:n,override:t.override||t})}}class f extends t.Component{state={xml:null};componentDidMount(){this.fetch(this.props.uri)}componentDidUpdate(t){const{uri:e}=this.props;e!==t.uri&&this.fetch(e)}async fetch(t){try{this.setState({xml:t?await(0,n.fetchText)(t):null})}catch(t){console.error(t)}}render(){const{props:t,state:{xml:n}}=this;return e.createElement(u,{xml:n,override:t,onError:t.onError})}}const p=(t,e)=>e.toUpperCase(),d=t=>t.replace(/[:-]([a-z])/g,p);function h(t){const e={},n=t.split(';').filter(t=>t.trim()),{length:r}=n;for(let t=0;tb(' ',t.length);function v(t,e){const n=t.split('\n'),r=n.length;let o=e,s=0;for(;s=t))break;o-=t}const c=t.slice(0,e).replace(/^\t+/,y),i=/(^|\n).*$/.exec(c),l=i&&i[0]||'',u=t.slice(e),f=/.*(\n|$)/.exec(u);return{line:s,column:o,snippet:`${l}${f&&f[0]}\n${b(' ',l.length)}^`}}const E=/[a-zA-Z0-9:_-]/,O=/
Wildings Hotel & Restaurant
- + diff --git a/wildings/customer-app/index.html b/wildings/customer-app/index.html index 74e8021a3fcd4faaf7fcb8d278c46034a9ad7e8a..c26b841cc8f3fdc888fd1c933671dc77003e1f80 100644 --- a/wildings/customer-app/index.html +++ b/wildings/customer-app/index.html @@ -35,6 +35,6 @@
Wildings Hotel & Restaurant
- + diff --git a/wildings/customer-app/sw.js b/wildings/customer-app/sw.js index 25ddb876cc7a4e8c358ca6921aa1dc50bd215a0b..b1fcae9c86490d3ee9339ba229163970f52d45d9 100644 --- a/wildings/customer-app/sw.js +++ b/wildings/customer-app/sw.js @@ -1,4 +1,4 @@ -const V="cc-wildings-customer-326a61be3a3d",B="/wildings/customer-app/",P=["/wildings/customer-app/apple-touch-icon.png", "/wildings/customer-app/favicon.ico", "/wildings/customer-app/icon-192.png", "/wildings/customer-app/icon-512.png", "/wildings/customer-app/brand-logo.png", "/wildings/customer-app/index.html", "/wildings/customer-app/manifest.webmanifest", "/wildings/customer-app/brand-hero.png", "/wildings/customer-app/customer/wildings.html", "/wildings/customer-app/_expo/static/js/web/basket-23b053a78600f85843ac913693772ec7.js", "/wildings/customer-app/_expo/static/js/web/[section]-7680005b9f9a2edf6bc1f22af6918f1c.js", "/wildings/customer-app/_expo/static/js/web/__common-033799d6a4d9974f420274e1f1bd3e3c.js", "/wildings/customer-app/_expo/static/js/web/index-a696887a353f7d51648c1e753887f562.js", "/wildings/customer-app/_expo/static/js/web/index-374f32ca8b3acd4c473cb67f0be4a5c1.js", "/wildings/customer-app/_expo/static/js/web/_layout-be07ad9c7518a35f2782e656e2aeb756.js", "/wildings/customer-app/_expo/static/js/web/index-973ada74f56035815426979f31f74d4e.js", "/wildings/customer-app/_expo/static/js/web/profile-1c74baad53640e29d41fc5c9e961f3e3.js", "/wildings/customer-app/_expo/static/js/web/index-f1ed5a09f89bcde96c7cd6aa863971b0.js", "/wildings/customer-app/_expo/static/js/web/lost-0a5d5326efc5a5dcb2110fd615779f07.js", "/wildings/customer-app/_expo/static/js/web/index-08029b0479f99a2d4c6b46f63ebe2bc0.js", "/wildings/customer-app/_expo/static/js/web/loyalty-bdba91e76a1977daa5ad4379cc66a275.js", "/wildings/customer-app/_expo/static/js/web/whatson-9d1e33597e23613f788dd1a65097d805.js", "/wildings/customer-app/_expo/static/js/web/index-aa80a45d20901c92ac80bce3e7f15e09.js", "/wildings/customer-app/_expo/static/js/web/feedback-d9f2534b23e5222df62036cf5c589115.js", "/wildings/customer-app/_expo/static/js/web/demo-83f3a2ec0a7b15fde8c581deca3aacba.js", "/wildings/customer-app/_expo/static/js/web/index-1184747fb013391b5c68f2bc5f74404d.js", "/wildings/customer-app/_expo/static/js/web/book-e85de1237680ea1ed22194e431f4aae4.js", "/wildings/customer-app/_expo/static/js/web/[did]-227a2f79a620251d29d8f8e716ee8bdb.js", "/wildings/customer-app/_expo/static/js/web/__expo-metro-runtime-8c088df87a31e4e6accd81c554ec290d.js", "/wildings/customer-app/_expo/static/js/web/gift-816d52e2568f34226fab48f95bd8cd2d.js", "/wildings/customer-app/_expo/static/js/web/index-c2e5595ff2606c756fa90389e35ce544.js", "/wildings/customer-app/_expo/static/js/web/index-3e01d7d615c04cbc74e8c5604bacb225.js", "/wildings/customer-app/_expo/static/js/web/index-6ff9008e6ddc971ef1cd72c414e77874.js", "/wildings/customer-app/_expo/static/js/web/refer-378e1e06d7d4e4950a522cf456508788.js", "/wildings/customer-app/_expo/static/js/web/[n]-3078b1d37581aff4da1ffebe18afde8a.js", "/wildings/customer-app/_expo/static/js/web/offers-3a70cae9a304021a06d107a723b85340.js", "/wildings/customer-app/_expo/static/js/web/[oid]-79da5afa34641052ac0acd9d446a2fdc.js", "/wildings/customer-app/_expo/static/js/web/merch-0c059175e625a9d65fea1c24c9fd49cb.js", "/wildings/customer-app/_expo/static/js/web/waitlist-ad8a10a700c4b24b6910dd9ba40f2c28.js", "/wildings/customer-app/_expo/static/js/web/[token]-71d704981c137007abc843f2f7737ebd.js", "/wildings/customer-app/_expo/static/js/web/+not-found-a9acde932f0ed95cf1e7409e88874f97.js", "/wildings/customer-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/wildings/customer-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/wildings/customer-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/wildings/customer-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/wildings/customer-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/wildings/customer-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/wildings/customer-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/wildings/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/wildings/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/wildings/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/wildings/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/wildings/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/wildings/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/wildings/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/wildings/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/wildings/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/wildings/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/wildings/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/wildings/customer-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/wildings/customer-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/wildings/customer-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/wildings/customer-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/wildings/customer-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/wildings/customer-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/wildings/customer-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/wildings/customer-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/wildings/customer-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/wildings/customer-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/wildings/customer-app/assets/assets/brand/wildings.076f4fcd06d19a0af0205c410f461b14.png", "/wildings/customer-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/wildings/customer-app/assets/assets/brand/kirkmichael.63b13cde7fd82eb622622b39ac80c394.png", "/wildings/customer-app/assets/assets/brand/brae.8de9e89ac30966c6669de990370d8e40.png", "/wildings/customer-app/assets/assets/brand/kirkmichael-hero.63b13cde7fd82eb622622b39ac80c394.png", "/wildings/customer-app/assets/assets/brand/greenside.9d1556db97dcb903a3c57e2063ee2255.png", "/wildings/customer-app/assets/assets/brand/abbotsford-hero.78fcb8ee06ee22c4ca659c9254db7512.png", "/wildings/customer-app/assets/assets/brand/kirkton.bcf8d846df4861474d224a7a77f498fb.png", "/wildings/customer-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/wildings/customer-app/assets/assets/brand/wildings-hero-logo-text.4661e4b935726f2511f9c17a1567c89a.png", "/wildings/customer-app/assets/assets/brand/kirkton-hero.9d0837b292c2f4f30f4521d806bb28c3.png", "/wildings/customer-app/assets/assets/brand/saltmarsh.85a6a65732635e5148478d743d9ca884.png", "/wildings/customer-app/assets/assets/brand/souters.f4c58d9349b6e1700fe5abcc9e9b665c.png", "/wildings/customer-app/assets/assets/brand/greenside-hero.1caec5a6cb939434cccb5f3a613b50f8.png", "/wildings/customer-app/assets/assets/brand/abbotsford.b26602bba5ce4969733c5422a45ad053.png"]; +const V="cc-wildings-customer-1383cd4c5608",B="/wildings/customer-app/",P=["/wildings/customer-app/apple-touch-icon.png", "/wildings/customer-app/favicon.ico", "/wildings/customer-app/icon-192.png", "/wildings/customer-app/icon-512.png", "/wildings/customer-app/brand-logo.png", "/wildings/customer-app/index.html", "/wildings/customer-app/manifest.webmanifest", "/wildings/customer-app/brand-hero.png", "/wildings/customer-app/customer/wildings.html", "/wildings/customer-app/_expo/static/js/web/feedback-3a26c70c9f758c4e362493c3b124ff43.js", "/wildings/customer-app/_expo/static/js/web/[n]-ced785c534ba69ad6c9c35369d7ecc36.js", "/wildings/customer-app/_expo/static/js/web/index-f9b07e7c25cec3623c10876ff1e01e58.js", "/wildings/customer-app/_expo/static/js/web/[section]-93e8e4ffe952e5b3c505e21ca771e570.js", "/wildings/customer-app/_expo/static/js/web/index-a39af53b0c36f30a0cc27647d3da5a52.js", "/wildings/customer-app/_expo/static/js/web/loyalty-679d7aa42c3cddfce82c3e1207d2d4cf.js", "/wildings/customer-app/_expo/static/js/web/[oid]-7fa4f78cb447d1c659e81fff8893269f.js", "/wildings/customer-app/_expo/static/js/web/index-5c634de6ad187be6c30eaf496c8cd727.js", "/wildings/customer-app/_expo/static/js/web/refer-01535dadf727412eb1a34a61dcc6d53d.js", "/wildings/customer-app/_expo/static/js/web/_layout-71dd5bf2c7e2ed834af09c5e339ba6f9.js", "/wildings/customer-app/_expo/static/js/web/index-a87fa345a0c01a0150c6e7893fe81768.js", "/wildings/customer-app/_expo/static/js/web/[did]-2a2aaaa129307f15140971a22b834cd3.js", "/wildings/customer-app/_expo/static/js/web/demo-6323990816bb686dcab3b33d7e6ec148.js", "/wildings/customer-app/_expo/static/js/web/book-b68aff7cd8daa9b5d327ece648db8831.js", "/wildings/customer-app/_expo/static/js/web/profile-b82887516ccba728915e95d502c0081a.js", "/wildings/customer-app/_expo/static/js/web/offers-eba5409c285b6031064e79e9f1ea19e0.js", "/wildings/customer-app/_expo/static/js/web/index-1ca3ee630447c7d027b33568fe68d67d.js", "/wildings/customer-app/_expo/static/js/web/merch-63634eac687774d71f27698748247bd2.js", "/wildings/customer-app/_expo/static/js/web/__expo-metro-runtime-8c088df87a31e4e6accd81c554ec290d.js", "/wildings/customer-app/_expo/static/js/web/[token]-6c815095a584dc0399e5918b52874b98.js", "/wildings/customer-app/_expo/static/js/web/gift-eb5daa22c1465e33034a87271e1b8b3b.js", "/wildings/customer-app/_expo/static/js/web/basket-b17831f04afc73d6dfc4107f720f1f19.js", "/wildings/customer-app/_expo/static/js/web/index-3c5f820b3b21978c61372b3163c55b0a.js", "/wildings/customer-app/_expo/static/js/web/+not-found-585f3164ae74e5ff35af71a4ba7360a3.js", "/wildings/customer-app/_expo/static/js/web/index-448819d41d567f962a0adfef24b51917.js", "/wildings/customer-app/_expo/static/js/web/lost-817d2886f8973bfa630e2a69674dc584.js", "/wildings/customer-app/_expo/static/js/web/index-837efe1be9c39737e9750ae18a91c7cb.js", "/wildings/customer-app/_expo/static/js/web/whatson-0608a899f634d91b081b758137ce1d33.js", "/wildings/customer-app/_expo/static/js/web/index-5b80ae2b78c999fccc1c0c3b2510599f.js", "/wildings/customer-app/_expo/static/js/web/__common-0ddd8478d5e84f31f7735bdf52109b59.js", "/wildings/customer-app/_expo/static/js/web/waitlist-119a5ba8531abfe81734f2106aefa476.js", "/wildings/customer-app/_expo/static/js/web/index-08f47ce9345574523241cee01d2a7020.js", "/wildings/customer-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/wildings/customer-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/wildings/customer-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/wildings/customer-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/wildings/customer-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/wildings/customer-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/wildings/customer-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/wildings/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/wildings/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/wildings/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/wildings/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/wildings/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/wildings/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/wildings/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/wildings/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/wildings/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/wildings/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/wildings/customer-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/wildings/customer-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/wildings/customer-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/wildings/customer-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/wildings/customer-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/wildings/customer-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/wildings/customer-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/wildings/customer-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/wildings/customer-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/wildings/customer-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/wildings/customer-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/wildings/customer-app/assets/assets/brand/wildings.076f4fcd06d19a0af0205c410f461b14.png", "/wildings/customer-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/wildings/customer-app/assets/assets/brand/3idiots-hero.e5dfd53739f05086b1956e72d585a66a.png", "/wildings/customer-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png", "/wildings/customer-app/assets/assets/brand/cecchinis.ebf752fef363247848ae7c0d91938765.png", "/wildings/customer-app/assets/assets/brand/kirkmichael.63b13cde7fd82eb622622b39ac80c394.png", "/wildings/customer-app/assets/assets/brand/3idiots.df4a76d2130f0e5b0042f06a8c88693a.png", "/wildings/customer-app/assets/assets/brand/brae.8de9e89ac30966c6669de990370d8e40.png", "/wildings/customer-app/assets/assets/brand/rupeeroom-hero.969fa372add526aaacf3a6c009b8ac92.png", "/wildings/customer-app/assets/assets/brand/kirkmichael-hero.63b13cde7fd82eb622622b39ac80c394.png", "/wildings/customer-app/assets/assets/brand/williewastles.055a77893ced99bf3a6c5402ba5baac6.png", "/wildings/customer-app/assets/assets/brand/drunkencoo-hero.65c21c4da9e466cf4bffc969639a1427.png", "/wildings/customer-app/assets/assets/brand/pizzaioli-hero.1896657c08264cefb49b401891d5448d.png", "/wildings/customer-app/assets/assets/brand/drunkencoo.f6d92af3b14e4205a3deaf4434754c51.png", "/wildings/customer-app/assets/assets/brand/smokinggoat.20a3a1970596ab43c5d6468d4ed549a7.png", "/wildings/customer-app/assets/assets/brand/greenside.9d1556db97dcb903a3c57e2063ee2255.png", "/wildings/customer-app/assets/assets/brand/abbotsford-hero.78fcb8ee06ee22c4ca659c9254db7512.png", "/wildings/customer-app/assets/assets/brand/rupeeroom.689e6fb536dc0845eeb174a1ec7bd346.png", "/wildings/customer-app/assets/assets/brand/kirkton.bcf8d846df4861474d224a7a77f498fb.png", "/wildings/customer-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/wildings/customer-app/assets/assets/brand/williewastles-hero.b9d53d27b66f903b5618a7177b2ffad4.png", "/wildings/customer-app/assets/assets/brand/pizzaioli.db8c000b62ee407121aa8b90ce45e170.png", "/wildings/customer-app/assets/assets/brand/yasmins-hero.a5aef62e37dfcecbe0afc056186f4ad9.png", "/wildings/customer-app/assets/assets/brand/wildings-hero-logo-text.4661e4b935726f2511f9c17a1567c89a.png", "/wildings/customer-app/assets/assets/brand/yasmins.8482602e9f0a965655924835625cb02b.png", "/wildings/customer-app/assets/assets/brand/kirkton-hero.9d0837b292c2f4f30f4521d806bb28c3.png", "/wildings/customer-app/assets/assets/brand/saltmarsh.85a6a65732635e5148478d743d9ca884.png", "/wildings/customer-app/assets/assets/brand/souters.f4c58d9349b6e1700fe5abcc9e9b665c.png", "/wildings/customer-app/assets/assets/brand/greenside-hero.1caec5a6cb939434cccb5f3a613b50f8.png", "/wildings/customer-app/assets/assets/brand/abbotsford.b26602bba5ce4969733c5422a45ad053.png", "/wildings/customer-app/assets/assets/brand/smokinggoat-hero.0588f17ef0eed7f757f22916cd4d37db.png", "/wildings/customer-app/assets/assets/brand/cecchinis-hero.f77780fcc94fd668cf35d66d6dc52d81.png", "/wildings/customer-app/assets/assets/brand/mrbasrais-hero.4ce74641cfcf52d099157c84005b9d2a.png"]; self.addEventListener('install',e=>e.waitUntil(caches.open(V).then(c=>Promise.all(P.map(u=>fetch(u).then(r=>r.blob().then(b=>c.put(u,new Response(b,{status:200,headers:{'Content-Type':r.headers.get('Content-Type')||b.type}}))))))).then(()=>self.skipWaiting()))); self.addEventListener('activate',e=>e.waitUntil(caches.keys().then(ks=>Promise.all(ks.filter(k=>k.startsWith('cc-wildings-customer-')&&k!==V).map(k=>caches.delete(k)))).then(()=>self.clients.claim()))); self.addEventListener('fetch',e=>{const u=new URL(e.request.url);if(e.request.method!=='GET'||u.origin!==location.origin||!u.pathname.startsWith(B))return;if(e.request.mode==='navigate'){e.respondWith(fetch(e.request).then(r=>r.ok?r:caches.match(B+'index.html')).catch(()=>caches.match(B+'index.html')));return;}e.respondWith(caches.match(e.request,{ignoreSearch:true}).then(r=>r||fetch(e.request)));}); \ No newline at end of file diff --git a/wildings/display-app/_expo/static/js/web/+not-found-585f3164ae74e5ff35af71a4ba7360a3.js b/wildings/display-app/_expo/static/js/web/+not-found-585f3164ae74e5ff35af71a4ba7360a3.js new file mode 100644 index 0000000000000000000000000000000000000000..cf2e6d94e8ca98606e0f8533c347ea51139bfdb7 --- /dev/null +++ b/wildings/display-app/_expo/static/js/web/+not-found-585f3164ae74e5ff35af71a4ba7360a3.js @@ -0,0 +1 @@ +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return c}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]);function c(){return(0,u.jsx)(t.Redirect,{href:n.ENTRY[n.APP_VARIANT]})}},801,[804,30,806,24]); \ No newline at end of file diff --git a/wildings/display-app/_expo/static/js/web/[did]-2a2aaaa129307f15140971a22b834cd3.js b/wildings/display-app/_expo/static/js/web/[did]-2a2aaaa129307f15140971a22b834cd3.js new file mode 100644 index 0000000000000000000000000000000000000000..1f0ffb8d5093d5a183dc2a9c0fb7062951faa5c1 --- /dev/null +++ b/wildings/display-app/_expo/static/js/web/[did]-2a2aaaa129307f15140971a22b834cd3.js @@ -0,0 +1 @@ +__d(function(_g,_r,i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return f}});var t=_r(_d[0]),n=_r(_d[1]),l=e(_r(_d[2])),s=e(_r(_d[3])),r=_r(_d[4]),a=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),g=_r(_d[11]),p=_r(_d[12]);function f(){const{rid:e,did:f}=(0,t.useLocalSearchParams)(),b=(0,u.useRestaurant)(e),j=(0,u.useMenu)(e).find(e=>e.id===f),x=(0,u.useCustomer)(),m=(0,u.useRecipeCards)(e).find(e=>e.id===j?.recipeCardId),y=m?.signOff&&m.photo?(0,h.recipeCards)().photoSource(m.photo):null,k=(0,u.useStore)(e=>e.addLine),[v,w]=(0,n.useState)(()=>(j?.optionGroups??[]).filter(e=>e.required).map(e=>e.choices[0].id)),[S,C]=(0,n.useState)(1),[B,$]=(0,n.useState)(''),[I,P]=(0,n.useState)(!1),[L,T]=(0,n.useState)(!1),[D,O]=(0,n.useState)(!1),[A,M]=(0,n.useState)(!1),R=(0,n.useMemo)(()=>j?(0,d.effectiveAllergens)(j,v):{},[j,v]);if(!b||!j)return(0,p.jsx)(o.Screen,{title:"Not found",children:(0,p.jsx)(o.T,{children:"Dish not found."})});const q=(0,d.conflictsFor)(R,x.allergies),_=(j.price??0)+(j.optionGroups??[]).flatMap(e=>e.choices).filter(e=>v.includes(e.id)).reduce((e,t)=>e+t.priceDelta,0),N=j.soldOut||!j.signOff||null===j.price,G=(e,t)=>{const n=j.optionGroups.find(t=>t.id===e);w(e=>{const l=n.choices.map(e=>e.id);return n.multi?e.includes(t)?e.filter(e=>e!==t):[...e,t]:e.includes(t)&&!n.required?e.filter(e=>e!==t):[...e.filter(e=>!l.includes(e)),t]})},z=e=>{u.useStore.getState().basket.restaurantId!==b.id&&u.useStore.getState().startBasket(b.id,'takeaway'),k({itemId:j.id,qty:S,choiceIds:v,notes:B,override:e?{allergens:q.contains,at:(new Date).toISOString()}:void 0}),P(!1),M(!0)};return(0,p.jsxs)(o.Screen,{title:j.name,subtitle:b.name,right:(0,p.jsx)(a.BasketButton,{}),children:[y?(0,p.jsx)(l.default,{testID:"dish-photo",source:y,accessibilityLabel:`${j.name}${'example'===m?.origin?' (example photo)':''}`,style:{width:'100%',height:200,borderRadius:12},resizeMode:"cover"}):null,(0,p.jsxs)(o.Row,{wrap:!0,gap:6,children:[(0,p.jsx)(o.T,{weight:"bold",size:20,colour:g.colours.gold,children:null===j.price?j.priceNote:(0,c.gbp)(_)}),j.dietary.map(e=>(0,p.jsx)(o.Badge,{kind:"ok",label:e},e))]}),(0,p.jsx)(o.T,{children:j.description}),q.contains.length?(0,p.jsx)(o.Banner,{kind:"danger",title:`Blocked: contains ${q.contains.map(d.allergenLabel).join(', ')}`,children:`You\u2019ve told us: ${x.allergies.filter(e=>q.contains.includes(e.allergen)).map(e=>`${(0,d.allergenLabel)(e.allergen)} \u2014 ${(0,d.severityLabel)(e.severity)}`).join('; ')}. This dish can\u2019t be added unless you deliberately override (for example, ordering for someone else).`}):null,q.may.length?(0,p.jsx)(o.Banner,{kind:"warn",title:`Warning: may contain ${q.may.map(d.allergenLabel).join(', ')}`,children:"Cross-contact is possible (e.g. shared fryer). Please speak to staff before ordering."}):null,(j.optionGroups??[]).map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsxs)(o.T,{weight:"semibold",children:[e.name,e.required?' (required)':' (optional)']}),(0,p.jsx)(o.Row,{wrap:!0,gap:6,children:e.choices.map(t=>(0,p.jsx)(o.Chip,{label:t.label,sub:t.priceDelta?`+${(0,c.gbp)(t.priceDelta)}`:void 0,selected:v.includes(t.id),onPress:()=>G(e.id,t.id)},t.id))})]},e.id)),(0,p.jsx)(o.Card,{children:(0,p.jsx)(r.AllergenPanel,{item:j,map:R,declared:x.allergies})}),b.fictional?null:(0,p.jsx)(o.ExampleAllergenNotice,{}),(0,p.jsx)(o.Field,{label:"Notes for the kitchen (optional)",placeholder:"e.g. no gherkins",value:B,onChangeText:$}),(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Quantity"}),(0,p.jsx)(o.Stepper,{value:S,onChange:C,label:"quantity"})]}),A?(0,p.jsx)(o.Banner,{kind:"success",title:"Added to basket",children:q.contains.length?'Allergy override recorded \u2014 the kitchen will see a large allergy alert.':'Carry on browsing or go to your basket.'}):null,N?(0,p.jsx)(o.Banner,{kind:"warn",children:j.soldOut?'Sold out today.':j.signOff?'Price on the specials board \u2014 ask staff.':'Not available to order online until the head chef signs off its allergens.'}):q.contains.length?(0,p.jsxs)(s.default,{style:{gap:8},children:[(0,p.jsx)(o.Button,{kind:"secondary",label:"Choose something else",onPress:()=>t.router.back()}),(0,p.jsx)(o.Button,{kind:"danger",label:"Override and add anyway\u2026",onPress:()=>{T(!1),O(!1),P(!0)},testID:"override-open"})]}):(0,p.jsxs)(o.Row,{gap:8,children:[(0,p.jsx)(o.Button,{style:{flex:1},label:`Add ${S} to basket \xb7 ${(0,c.gbp)(_*S)}`,onPress:()=>z(!1),testID:"add-to-basket"}),A?(0,p.jsx)(o.Button,{kind:"secondary",label:"Basket",onPress:()=>t.router.push('/customer/basket')}):null]}),(0,p.jsxs)(o.Sheet,{visible:I,onClose:()=>P(!1),title:"Allergy override",children:[(0,p.jsx)(o.Banner,{kind:"danger",title:`${j.name} contains ${q.contains.map(d.allergenLabel).join(', ')}`,children:`Your profile says: ${x.allergies.filter(e=>q.contains.includes(e.allergen)).map(e=>`${(0,d.allergenLabel)(e.allergen)} \u2014 ${(0,d.severityLabel)(e.severity)}`).join('; ')}.`}),(0,p.jsx)(o.Toggle,{label:"I understand this dish contains an allergen I have declared",value:L,onChange:T}),(0,p.jsx)(o.Toggle,{label:"It is for someone without this allergy, or I have spoken to staff",value:D,onChange:O}),(0,p.jsx)(o.Muted,{children:"The override is logged and shown to the kitchen as an allergy alert that must be acknowledged."}),(0,p.jsx)(o.Button,{kind:"danger",disabled:!L||!D,label:"Confirm override and add",onPress:()=>z(!0),testID:"override-confirm"})]})]})}},778,[804,30,196,127,829,830,813,814,816,819,831,821,24]); \ No newline at end of file diff --git a/wildings/display-app/_expo/static/js/web/[n]-ced785c534ba69ad6c9c35369d7ecc36.js b/wildings/display-app/_expo/static/js/web/[n]-ced785c534ba69ad6c9c35369d7ecc36.js new file mode 100644 index 0000000000000000000000000000000000000000..c1ced89e3ab9de89839af726f375c95f9fe94a33 --- /dev/null +++ b/wildings/display-app/_expo/static/js/web/[n]-ced785c534ba69ad6c9c35369d7ecc36.js @@ -0,0 +1 @@ +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return f}});var t=_r(d[0]),r=_r(d[1]),n=_r(d[2]),o=_r(d[3]),u=_r(d[4]),c=_r(d[5]),s=_r(d[6]),l=_r(d[7]);function f(){const{n:f,r:b}=(0,r.useLocalSearchParams)(),E=(0,u.useStore)(t=>t.startBasket),[_,h]=(0,n.useState)(!1),S=b??c.VENUE_RID,j=(0,u.useOrderAtTable)(S),I=(0,s.guestServer)();return(0,n.useEffect)(()=>{t.LIVE_VENUE_BUILD||I||(j&&E(S,'table',String(f)),h(!0))},[S,f,j,I]),t.LIVE_VENUE_BUILD||I?(0,l.jsx)(o.Screen,{title:"Order at the table",children:(0,l.jsx)(o.Banner,{kind:"demo",title:"Scan the code on your table",children:"To order from your table, scan the QR code printed on it. Or order at the bar."})}):_?(0,l.jsx)(r.Redirect,{href:`/customer/${S}`}):null}},794,[833,804,30,813,819,5,836,24]); \ No newline at end of file diff --git a/wildings/display-app/_expo/static/js/web/[oid]-7fa4f78cb447d1c659e81fff8893269f.js b/wildings/display-app/_expo/static/js/web/[oid]-7fa4f78cb447d1c659e81fff8893269f.js new file mode 100644 index 0000000000000000000000000000000000000000..f0fcaabb7a82273cae61ec240fcab227e980b17e --- /dev/null +++ b/wildings/display-app/_expo/static/js/web/[oid]-7fa4f78cb447d1c659e81fff8893269f.js @@ -0,0 +1 @@ +__d(function(g,_r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return f}});var e,t=_r(d[0]),s=_r(d[1]),l=_r(d[2]),r=_r(d[3]),n=(e=r)&&e.__esModule?e:{default:e},o=_r(d[4]),i=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]),p=_r(d[9]),b=_r(d[10]),y=_r(d[11]),j=_r(d[12]);const x=[['new','Placed'],['acknowledged','Accepted'],['preparing','Cooking'],['ready','Ready to collect'],['collected','Collected']],w=[['new','Sent'],['acknowledged','Accepted'],['preparing','Cooking'],['served','Food out'],['closed','Paid']];function f(){const{oid:e}=(0,s.useLocalSearchParams)(),r=(0,b.useOrder)(e),f=(0,b.useRestaurant)(r?.restaurantId),[C,S]=(0,l.useState)(0),[k,T]=(0,l.useState)(''),[v,P]=(0,l.useState)(!1),[M,$]=(0,l.useState)(!1),[R,A]=(0,l.useState)(1),[I,N]=(0,l.useState)(0),[O,B]=(0,l.useState)(r?.split?.ways??1);if(!r||!f)return(0,j.jsx)(c.Screen,{title:"Order",children:(0,j.jsx)(c.T,{children:"Order not found."})});const H='takeaway'===r.type?x:w,_=Math.max(0,H.findIndex(([e])=>e===r.status)),D=Math.round(r.subtotal*I/100),F='table'===r.type?r.subtotal+(r.split?r.tip:D):r.total,q=F-r.paid,L=r.split?.ways??O,W=r.split?.paidShares??0,Y=Math.ceil(F/L),E='collected'===r.status||'closed'===r.status;return(0,j.jsxs)(c.Screen,{title:`Order ${r.ref}`,subtitle:`${f.name} \xb7 ${'table'===r.type?`${(0,t.tableNumbers)(r.tableNo)}`:`Collection at ${r.slotTime?(0,p.hm)(new Date(r.slotTime)):'\u2014'}`}`,children:['takeaway'===r.type?(0,j.jsx)(c.Banner,{kind:"success",title:'ready'===r.status?'Your order is ready!':'Order placed',children:'ready'===r.status?'Head to the bar and give your order number. Staff will check allergies with you at handover.':`Show order number ${r.ref} at the bar when you arrive.`}):null,(0,j.jsxs)(c.Card,{children:[(0,j.jsx)(c.H2,{children:"Status"}),H.map(([e,t],s)=>(0,j.jsxs)(c.Row,{gap:10,children:[(0,j.jsx)(n.default,{style:{width:22,height:22,borderRadius:11,backgroundColor:s<=_?y.colours.gold:y.colours.surface2,borderWidth:1,borderColor:y.colours.gold}}),(0,j.jsx)(c.T,{weight:s===_?'semibold':'regular',colour:s<=_?y.colours.text:y.colours.muted,children:t})]},e)),r.allergyAck?(0,j.jsxs)(c.Muted,{children:["Kitchen signed off your allergies (",r.allergyAck.by,", ",(0,p.hm)(new Date(r.allergyAck.at)),")"]}):r.allergies.length?(0,j.jsx)(c.Muted,{children:"Waiting for the kitchen to sign off your allergies\u2026"}):null,'takeaway'!==r.type||E?null:(0,j.jsxs)(c.Row,{gap:8,children:[(0,j.jsx)(c.Button,{small:!0,kind:'on-my-way'===r.customerSignal?'primary':'secondary',label:"On my way",onPress:()=>b.repo.orders.customerSignal(r.id,'on-my-way')}),(0,j.jsx)(c.Button,{small:!0,kind:'here'===r.customerSignal?'primary':'secondary',label:"I\u2019m here",onPress:()=>b.repo.orders.customerSignal(r.id,'here')})]})]}),(0,j.jsxs)(c.Card,{children:[(0,j.jsx)(c.H2,{children:"Items"}),r.lines.map((e,t)=>(0,j.jsxs)(n.default,{children:[(0,j.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(c.T,{style:{flex:1},children:[e.qty,"\xd7 ",e.name]}),(0,j.jsx)(c.T,{children:(0,h.gbp)(e.unitPrice*e.qty)})]}),e.choices.length?(0,j.jsx)(c.Muted,{children:e.choices.join(' \xb7 ')}):null,e.overridden?(0,j.jsx)(c.Badge,{kind:"red",label:`Allergy override: ${e.contains.map(u.allergenLabel).join(', ')}`}):null]},t)),(0,j.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(c.Muted,{children:"Subtotal"}),(0,j.jsx)(c.T,{children:(0,h.gbp)(r.subtotal)})]}),r.giftCardApplied?(0,j.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(c.Muted,{children:"Of which gift card"}),(0,j.jsxs)(c.T,{colour:y.colours.ok,children:["\u2212",(0,h.gbp)(r.giftCardApplied)]})]}):null,r.tip?(0,j.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(c.Muted,{children:"Tip"}),(0,j.jsx)(c.T,{children:(0,h.gbp)(r.tip)})]}):null,(0,j.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(c.T,{weight:"semibold",children:"Paid (test, no real money)"}),(0,j.jsx)(c.T,{weight:"semibold",colour:y.colours.gold,children:(0,h.gbp)(r.paid)})]})]}),'table'===r.type&&'closed'!==r.status&&'cancelled'!==r.status?(0,j.jsxs)(c.Card,{highlight:y.colours.gold,children:[(0,j.jsxs)(c.H2,{children:["Your bill \u2014 ",(0,t.tableNumbers)(r.tableNo)]}),r.split?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(c.T,{children:["Total ",(0,h.gbp)(F)," \xb7 split ",L," way",L>1?'s':''," \xb7 ",(0,h.gbp)(Y)," each"]}),(0,j.jsxs)(c.T,{children:["Shares paid: ",W," of ",L," \xb7 remaining ",(0,h.gbp)(q)]}),L>1?(0,j.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(c.T,{children:"Shares to pay now"}),(0,j.jsx)(c.Stepper,{value:R,onChange:A,min:1,max:L-W,label:"shares"})]}):null,(0,j.jsx)(c.Button,{label:`Pay ${L>1?`${R} share${R>1?'s':''}`:'bill'} \xb7 ${(0,h.gbp)(Math.min(q,Y*R))}`,onPress:()=>$(!0),testID:"pay-bill"})]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(c.T,{weight:"semibold",children:"Add a tip?"}),(0,j.jsx)(c.Row,{wrap:!0,children:[0,10,12.5,15].map(e=>(0,j.jsx)(c.Chip,{label:e?`${e}%`:'No tip',selected:I===e,onPress:()=>N(e)},e))}),(0,j.jsx)(c.Muted,{children:"Tips go to staff under the restaurant\u2019s tipping policy (Employment (Allocation of Tips) Act 2023)."}),(0,j.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(c.T,{weight:"semibold",children:"Split evenly between"}),(0,j.jsx)(c.Stepper,{value:O,onChange:B,min:1,max:8,label:"people"})]}),(0,j.jsxs)(c.T,{children:["Total ",(0,h.gbp)(r.subtotal+D),O>1?` \xb7 ${(0,h.gbp)(Math.ceil((r.subtotal+D)/O))} each`:'']}),(0,j.jsx)(c.Button,{label:"Get the bill",onPress:()=>b.repo.orders.setSplit(r.id,O,D),testID:"get-bill"})]})]}):null,!E||r.rated||v?null:(0,j.jsxs)(c.Card,{highlight:y.colours.gold,children:[(0,j.jsx)(c.H2,{children:"How was everything?"}),(0,j.jsxs)(c.Muted,{children:["One tap \u2014 this goes privately to ",f.name," only, never published."]}),(0,j.jsx)(i.Stars,{value:C,onChange:S}),C?(0,j.jsx)(c.Field,{label:"Anything to add? (optional)",value:k,onChangeText:T}):null,(0,j.jsx)(c.Button,{label:"Send feedback",disabled:!C,onPress:()=>{b.repo.feedback.add({restaurantId:f.id,orderId:r.id,customerId:r.customerId,customerName:r.customerName,stars:C,comment:k,context:'table'===r.type?`${(0,t.tableNumbers)(r.tableNo)}`:`Takeaway ${r.ref}`}),P(!0)},testID:"send-rating"})]}),v||r.rated?(0,j.jsx)(c.Banner,{kind:"success",children:"Thanks \u2014 your feedback went privately to the restaurant."}):null,E?(0,j.jsx)(c.Button,{kind:"secondary",label:"View stamp card",onPress:()=>s.router.push(`/customer/${f.id}/loyalty`)}):null,(0,j.jsx)(o.MockPay,{visible:M,onClose:()=>$(!1),amount:Math.min(q,Y*R),restaurantId:f.id,title:`Pay \u2014 ${(0,t.tableNumbers)(r.tableNo)}`,onPaid:e=>{b.repo.orders.payTable(r.id,{shares:R,giftCardCode:e.giftCardCode}),$(!1),A(1)}})]})}},791,[808,804,30,127,834,832,813,814,816,818,819,821,24]); \ No newline at end of file diff --git a/wildings/display-app/_expo/static/js/web/[section]-93e8e4ffe952e5b3c505e21ca771e570.js b/wildings/display-app/_expo/static/js/web/[section]-93e8e4ffe952e5b3c505e21ca771e570.js new file mode 100644 index 0000000000000000000000000000000000000000..11f3bab84de38d8d8874b5ec2723dd3ea24b04a1 --- /dev/null +++ b/wildings/display-app/_expo/static/js/web/[section]-93e8e4ffe952e5b3c505e21ca771e570.js @@ -0,0 +1 @@ +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return s}});var t=r(d[0]);r(d[1]);var n=r(d[2]),c=r(d[3]),o=r(d[4]),f=r(d[5]);function s(){const{section:s}=(0,t.useLocalSearchParams)();return(0,c.canShow)('chef')?s&&(0,o.chefSectionAllowed)(String(s))?(0,f.jsx)(n.ChefApp,{section:String(s)},String(s)):(0,f.jsx)(t.Redirect,{href:"/kitchen"}):(0,f.jsx)(t.Redirect,{href:c.ENTRY[c.APP_VARIANT]})}},775,[804,30,805,806,807,24]); \ No newline at end of file diff --git a/wildings/display-app/_expo/static/js/web/[token]-6c815095a584dc0399e5918b52874b98.js b/wildings/display-app/_expo/static/js/web/[token]-6c815095a584dc0399e5918b52874b98.js new file mode 100644 index 0000000000000000000000000000000000000000..bbb9c120ac56fbfa8ba9e0a1c2e306f6558c994f --- /dev/null +++ b/wildings/display-app/_expo/static/js/web/[token]-6c815095a584dc0399e5918b52874b98.js @@ -0,0 +1,3 @@ +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return u}});var t=r(d[0]);r(d[1]);var n=r(d[2]),o=r(d[3]),c=r(d[4]),s=r(d[5]),l=r(d[6]);function u(){const{token:u}=(0,t.useLocalSearchParams)(),h=(0,c.cleanToken)(u);return h?(0,s.guestServer)()?(0,l.jsx)(o.TableOrderLive,{token:h}):(0,l.jsx)(n.Screen,{title:"Order at the table",children:(0,l.jsx)(n.Banner,{kind:"demo",title:"Not connected",children:"This preview isn't connected to a venue, so table orders can't be sent from here."})}):(0,l.jsx)(n.Screen,{title:"Order at the table",children:(0,l.jsx)(n.Banner,{kind:"warn",title:"This code isn't working",children:"Please scan the QR code on your table again, or ask a member of staff."})})}},795,[804,30,813,874,876,836,24]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TableOrderLive=function({token:e}){const[s,b]=(0,n.useState)(null),[m,f]=(0,n.useState)(null),[j,y]=(0,n.useState)([]),[k,w]=(0,n.useState)(null),T=(0,h.useCustomer)(),[C,S]=(0,n.useState)(()=>(T?.allergies??[]).map(e=>e.allergen)),[v,P]=(0,n.useState)(''),[O,N]=(0,n.useState)(''),[B,I]=(0,n.useState)(!1),[L,M]=(0,n.useState)(null),[R,$]=(0,n.useState)([]),A=(0,n.useCallback)(async()=>{try{b(await(0,c.tablePublic)(e)),f(null)}catch(e){f(e?.message??'Could not load the menu.')}},[e]),D=(0,n.useCallback)(async()=>{try{$(await(0,c.myTableOrders)(e))}catch{}},[e]);(0,n.useEffect)(()=>{A(),D();const e=setInterval(()=>{D(),A()},8e3);return()=>clearInterval(e)},[A,D]);const _=s?.menu??[];(0,n.useEffect)(()=>{y(e=>e.filter(e=>_.some(t=>t.id===e.id&&!t.soldOut)))},[s]);const q=(0,n.useMemo)(()=>{const e=new Map;for(const t of _)e.set(t.section,[...e.get(t.section)??[],t]);return[...e.entries()]},[s]),Y=(0,d.cartTotal)(j,_),W='yes'===k?C.map(e=>({allergen:e,severity:T?.allergies?.find(t=>t.allergen===e)?.severity??'allergy'})):[],E=(0,d.allergyClashes)(j,_,W.map(e=>e.allergen)),z=e=>j.find(t=>t.id===e)?.qty??0,G=(e,t)=>y(l=>t<=0?l.filter(t=>t.id!==e):l.some(t=>t.id===e)?l.map(l=>l.id===e?{...l,qty:t}:l):[...l,{id:e,qty:t,note:''}]),H=(e,t)=>y(l=>l.map(l=>l.id===e?{...l,note:t}:l)),V=async()=>{I(!0),M(null);try{const t=await(0,c.sendTableOrder)(e,j,{note:O,name:v,allergies:W});y([]),N(''),M({kind:'success',text:t.held?`Order ${t.ref} sent. A member of staff will check it, then it goes to the kitchen.`:`Order ${t.ref} sent to the kitchen.`}),D()}catch(e){M({kind:'warn',text:e?.message??'The order was not sent. Please try again or ask a member of staff.'}),A()}finally{I(!1)}};if(m)return(0,x.jsxs)(r.Screen,{title:"Order at the table",children:[(0,x.jsx)(r.Banner,{kind:"warn",title:"Couldn't open the menu",children:m}),(0,x.jsx)(r.Button,{label:"Try again",onPress:()=>{A()}})]});if(!s)return(0,x.jsx)(r.Screen,{title:"Order at the table",children:(0,x.jsx)(r.Muted,{children:"Opening the menu\u2026"})});if(!s.ok)return(0,x.jsx)(r.Screen,{title:"Order at the table",children:(0,x.jsx)(r.Banner,{kind:"warn",title:"This code isn't working",children:s.reason??'Please ask a member of staff.'})});const F=s.open&&j.length>0&&null!==k&&('none'===k||C.length>0)&&!B;return(0,x.jsxs)(r.Screen,{title:`${(0,l.tableNumbers)(s.table)}`,subtitle:s.venueName,footer:s.open?(0,x.jsx)(r.Button,{label:B?'Sending\u2026':j.length?`Send order to the kitchen (${(0,o.gbp)(Y)})`:'Add a dish to order',disabled:!F,onPress:()=>{V()},testID:"send-table-order-live"}):void 0,children:[(0,x.jsxs)(r.Muted,{children:["Tip: add dishes, answer the allergy question, then send. Staff bring it to ",(0,l.tableNumbers)(s.table),". ",d.PAY_WORDS]}),s.tip?(0,x.jsx)(r.Banner,{kind:"demo",children:s.tip}):null,s.open?null:(0,x.jsx)(r.Banner,{kind:"warn",title:"Not taking table orders right now",children:s.reason}),s.open&&s.staffAccept&&!R.some(e=>e.accepted)?(0,x.jsx)(r.Muted,{children:"The first order from your phone is checked by a member of staff before it goes to the kitchen."}):null,L?(0,x.jsx)(r.Banner,{kind:L.kind,children:L.text}):null,R.length?(0,x.jsx)(a.default,{testID:"my-table-orders",children:(0,x.jsxs)(r.Card,{children:[(0,x.jsx)(r.T,{weight:"semibold",children:"Your orders at this table"}),R.map(e=>(0,x.jsxs)(a.default,{style:{gap:2,paddingVertical:4},children:[(0,x.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(r.T,{children:e.ref}),(0,x.jsx)(r.T,{size:13,colour:'cancelled'===e.status?u.colours.amber:u.colours.gold,children:(0,d.guestStatusWords)(e)})]}),(0,x.jsxs)(r.Muted,{children:[e.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')," \xb7 ",(0,o.gbp)(e.totalPence)," to pay at the bar or till"]})]},e.id))]})}):null,s.open?q.map(([e,t])=>(0,x.jsxs)(a.default,{style:{gap:8},children:[(0,x.jsx)(r.H2,{children:e}),t.map(e=>(0,x.jsxs)(r.Card,{children:[(0,x.jsxs)(r.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,x.jsxs)(a.default,{style:{flex:1,gap:2},children:[(0,x.jsx)(r.T,{weight:"semibold",children:e.name}),e.description?(0,x.jsx)(r.Muted,{children:e.description}):null,(0,x.jsxs)(r.T,{size:13,colour:u.colours.muted,children:[e.allergens.length?`Contains: ${e.allergens.map(i.allergenLabel).join(', ')}`:'No allergens listed: ask staff if unsure',e.mayContain.length?` \xb7 May contain: ${e.mayContain.map(i.allergenLabel).join(', ')}`:'']})]}),(0,x.jsx)(r.T,{weight:"semibold",colour:u.colours.gold,children:(0,o.gbp)(e.pricePence)})]}),e.soldOut?(0,x.jsx)(r.Badge,{kind:"amber",label:"Sold out today"}):z(e.id)?(0,x.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(r.Stepper,{value:z(e.id),min:0,max:20,onChange:t=>G(e.id,t),label:e.name}),(0,x.jsx)(r.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>G(e.id,0)})]}):(0,x.jsx)(r.Button,{small:!0,kind:"secondary",label:"Add",accessibilityLabel:`Add ${e.name}`,onPress:()=>G(e.id,1)})]},e.id))]},e)):null,s.open&&!_.length?(0,x.jsx)(r.Banner,{kind:"demo",title:"No dishes to order yet",children:"The venue hasn't put any priced dishes on the table menu yet. Please order at the bar."}):null,s.open&&j.length?(0,x.jsx)(a.default,{testID:"table-cart",children:(0,x.jsxs)(r.Card,{children:[(0,x.jsx)(r.T,{weight:"semibold",children:"Your order"}),j.map(e=>{const l=_.find(t=>t.id===e.id);return(0,x.jsxs)(a.default,{style:{gap:4},children:[(0,x.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsxs)(r.T,{children:[e.qty,"\xd7 ",l?.name]}),(0,x.jsx)(r.T,{children:(0,o.gbp)(e.qty*(l?.pricePence??0))})]}),(0,x.jsx)(t.TextInput,{style:p,value:e.note,onChangeText:t=>H(e.id,t),placeholder:"Note for the kitchen (optional), e.g. no onions",placeholderTextColor:u.colours.muted,maxLength:140,accessibilityLabel:`Note for ${l?.name}`,testID:`table-note-${e.id}`})]},e.id)}),(0,x.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(r.T,{weight:"semibold",children:"Total"}),(0,x.jsx)(r.T,{weight:"semibold",children:(0,o.gbp)(Y)})]})]})}):null,s.open?(0,x.jsx)(a.default,{testID:"table-allergy",children:(0,x.jsxs)(r.Card,{children:[(0,x.jsx)(r.T,{weight:"semibold",children:"Does anyone at the table have a food allergy?"}),(0,x.jsx)(r.Muted,{children:"We ask everyone, so the kitchen can keep you safe."}),(0,x.jsxs)(r.Row,{gap:8,children:[(0,x.jsx)(r.Chip,{label:"No allergies",selected:'none'===k,onPress:()=>w('none')}),(0,x.jsx)(r.Chip,{label:"Yes, allergies",selected:'yes'===k,onPress:()=>w('yes')})]}),'yes'===k?(0,x.jsx)(r.Row,{wrap:!0,gap:6,children:i.ALLERGENS.map(e=>(0,x.jsx)(r.Chip,{label:e.short,selected:C.includes(e.id),onPress:()=>S(t=>t.includes(e.id)?t.filter(t=>t!==e.id):[...t,e.id])},e.id))}):null,E.length?(0,x.jsxs)(r.Banner,{kind:"warn",title:"Check with staff",children:[E.map(e=>e.name).join(', ')," ",E.length>1?'contain':'contains'," or may contain an allergy you picked. The kitchen will see your allergies on the ticket."]}):null]})}):null,s.open?(0,x.jsxs)(r.Card,{children:[(0,x.jsx)(r.T,{weight:"semibold",children:"Anything else?"}),(0,x.jsx)(t.TextInput,{style:p,value:v,onChangeText:P,placeholder:"Your first name (optional)",placeholderTextColor:u.colours.muted,maxLength:40,accessibilityLabel:"Your first name (optional)"}),(0,x.jsx)(t.TextInput,{style:p,value:O,onChangeText:N,placeholder:"Note for the staff (optional)",placeholderTextColor:u.colours.muted,maxLength:300,accessibilityLabel:"Note for the staff (optional)"})]}):null,(0,x.jsx)(a.default,{testID:"pay-placeholder",children:(0,x.jsxs)(r.Card,{children:[(0,x.jsx)(r.T,{weight:"semibold",children:"Paying"}),(0,x.jsx)(r.T,{children:d.PAY_WORDS}),(0,x.jsx)(r.Muted,{children:"No card details are asked for or kept in this app."})]})})]})};var e,t=_r(_d[0]),l=_r(_d[1]),n=_r(_d[2]),s=_r(_d[3]),a=(e=s)&&e.__esModule?e:{default:e},r=_r(_d[4]),i=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),x=_r(_d[11]);const p={borderWidth:1,borderColor:u.colours.border,borderRadius:10,padding:10,color:u.colours.text,backgroundColor:u.colours.surface2}},874,[877,808,30,127,813,814,816,876,875,819,821,24]); +__d(function(g,_r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"tablePublic",{enumerable:!0,get:function(){return s}}),e.sendTableOrder=async function(t,r,a){if(!await(0,n.guestSession)())throw new Error('No connection. Try again when you are back online.');return(0,n.rpc)('guest_table_order',{p_token:t,p_lines:r.map(t=>({id:t.id,qty:t.qty,note:t.note.trim().slice(0,140)})),p_note:a.note.trim().slice(0,300)||null,p_allergies:a.allergies.map(t=>({allergen:t.allergen,severity:t.severity})),p_name:a.name.trim().slice(0,40)||null})},e.myTableOrders=async function(t){return await(0,n.guestSession)()?await(0,n.rpc)('guest_table_my_orders',{p_token:t})??[]:[]},e.loadTableSettings=async function(){const{data:t,error:n}=await a().from('table_order_settings').select('*').eq('venue_id',o()).maybeSingle();if(n)throw n;return(0,r.fromRow)(t)},e.saveTableSettings=async function(t,n){const{error:s}=await a().from('table_order_settings').upsert({venue_id:o(),...(0,r.toRow)(t),updated_at:(new Date).toISOString(),updated_by:n.slice(0,80)});if(s)throw s},e.listTableCodes=async function(){const{data:t,error:n}=await a().from('table_qr_codes').select('table_no, token, created_at').eq('venue_id',o()).eq('is_on',!0);if(n)throw n;return(t??[]).map(t=>({table:String(t.table_no),token:String(t.token),createdAt:String(t.created_at)})).sort((t,n)=>Number(t.table)-Number(n.table))},Object.defineProperty(e,"makeTableCodes",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"renewTableCode",{enumerable:!0,get:function(){return c}}),e.watchTableSettings=function(t){const r=n.useSync.getState().venueId;if(!r)return()=>{};const o=a().channel(`tos-${r}-${Math.random().toString(36).slice(2,8)}`).on('postgres_changes',{event:'*',schema:'public',table:'table_order_settings',filter:`venue_id=eq.${r}`},()=>t()).subscribe();return()=>{a().removeChannel(o)}};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]);const a=()=>(0,t.getSupabase)(),o=()=>{const t=n.useSync.getState().venueId;if(!t)throw new Error('Not connected to the venue yet.');return t},s=t=>(0,n.rpc)('table_public',{p_token:t});const l=t=>(0,n.rpc)('table_qr_make',{p_venue:o(),p_tables:t}),c=t=>(0,n.rpc)('table_qr_renew',{p_venue:o(),p_table:t})},875,[863,820,876]); \ No newline at end of file diff --git a/wildings/display-app/_expo/static/js/web/__common-d94e71b33d3093ccc2225eba91947508.js b/wildings/display-app/_expo/static/js/web/__common-d94e71b33d3093ccc2225eba91947508.js new file mode 100644 index 0000000000000000000000000000000000000000..1012baa5941ff947ea5f7620de0ebb6dab9d8e21 --- /dev/null +++ b/wildings/display-app/_expo/static/js/web/__common-d94e71b33d3093ccc2225eba91947508.js @@ -0,0 +1,459 @@ +__d(function(g,r,i,a,m,e,d){"use strict";function t(t,n){return Object.keys(t).forEach(function(c){"default"===c||Object.prototype.hasOwnProperty.call(n,c)||Object.defineProperty(n,c,{enumerable:!0,get:function(){return t[c]}})}),t}Object.defineProperty(e,"__esModule",{value:!0}),r(d[0]),t(r(d[1]),e),t(r(d[2]),e),t(r(d[3]),e),t(r(d[4]),e)},804,[1210,1211,1221,1222,1224]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ChefApp=function({section:e}={}){const{r:s,rid:t,me:i,now:$}=(0,G.useChef)(3e4),_=(0,W.useSignedIn)(),K=_?.id??G.CHEF_ID;(0,o.useSoldOutLink)(!0,(_?.name??i).replace(' (example)',''));const V=e?me[e]:void 0,[ue,je]=(0,P.useState)(V?.tab??'home'),[we,Ce]=(0,P.useState)(V?.k??null),[Te,ve]=(0,P.useState)(V?.stock??'levels'),[Se,Pe]=(0,P.useState)(void 0),[Ie,Re]=(0,P.useState)(V?.gp??'dishes'),Be=(0,P.useRef)(null),He=(0,f.ymd)($),Ae=(0,f.ymd)(new Date($.getTime()+864e5));(0,u.useTipsPosted)(t,He);const Oe=(0,Q.useTravelDay)('chef',He),De='home'===ue&&!Oe;(0,v.useKitchenTodoChime)(t,He,()=>Fe('kitchen','bookings')),(0,de.useAlertWatcher)(t,{kinds:['takeaway']}),(0,P.useEffect)(()=>{(0,W.ensureAttendance)((new Date).toISOString().slice(0,10),$)},[]);const Le=(0,P.useRef)({t:'home',k:null});Le.current={t:ue,k:we};const Ee=(0,P.useRef)([]),$e=(0,n.useScrollMemory)(Be),Fe=(0,P.useCallback)((e,s=null)=>{const t=Le.current;t.t===e&&t.k===s||(Ee.current=[...Ee.current,{...t,y:$e.leave()}].slice(-30),$e.restore(0)),je(e),Ce(s)},[]),We=(0,P.useCallback)(()=>{if((0,l.runBackLayer)())return!0;const e=Le.current;let s=Ee.current.pop();for(;s&&s.t===e.t&&s.k===e.k;)s=Ee.current.pop();if(!s&&'home'===e.t&&!e.k)return!1;const t=s??{t:'home',k:null};return $e.leave(),je(t.t),Ce(t.k),$e.restore(t.y??0),!0},[]);(0,l.useWebBack)(We);const Ge=(0,l.useInnerBackShown)();(0,P.useEffect)(()=>{d.PITCH&&(globalThis.__pitchGo=(e,s=null,t)=>{'stock'===e&&t&&ve(t),'gp'===e&&t&&Re(t),Fe(e,s)})},[Fe]),(0,p.useShiftReminders)({rid:t,staffId:K,name:i,kitchen:!0}),(0,C.useScheduledNotices)({rid:t,staffId:_?.id??'',name:i,onOpen:()=>Fe('kitchen','orderlists')}),(0,T.useOffRotaPrompt)({rid:t,staffId:_?.id??''}),(0,P.useEffect)(()=>{const e=I.default.addEventListener('hardwareBackPress',We);return()=>e.remove()},[We]);const Me=we?ye.find(e=>e.id===we):null,Ne=(0,H.default)().width<430,ze=Me?Me.title:{home:'Today in the kitchen',stock:'Stock',gp:'GP & costing',creator:ie.CREATOR_TITLE,orders:'Ordering',kitchen:'Kitchen'}[ue];return(0,be.jsxs)(O.SafeAreaView,{style:{flex:1,backgroundColor:F.colours.bg},edges:['top','bottom'],children:[(0,be.jsxs)(A.default,{style:{paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:F.colours.border,gap:6},children:[(0,be.jsx)(A.default,{style:{alignItems:'center'},children:(0,be.jsx)(A.default,{testID:"header-me",accessibilityLabel:`Signed in as ${i.replace(' (example)','')}, Head Chef`,style:{borderWidth:1,borderColor:F.colours.gold,borderRadius:16,paddingHorizontal:10,paddingVertical:4,maxWidth:'86%'},children:(0,be.jsxs)(E.Row,{gap:6,children:[(0,be.jsx)(se.StaffAvatar,{id:G.CHEF_ID,size:24,ring:!1}),(0,be.jsxs)(E.T,{size:13,weight:"semibold",colour:F.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[i.replace(' (example)','')," \xb7 Head Chef"]})]})})}),(0,be.jsxs)(E.Row,{gap:10,children:[(0,be.jsx)(D.RestaurantLogo,{rid:t,size:Ne?36:44}),(0,be.jsxs)(A.default,{style:{flex:1,minWidth:0},children:[(0,be.jsxs)(E.Row,{gap:6,children:[(0,be.jsx)(E.T,{weight:"semibold",size:Ne?15:17,numberOfLines:1,style:{flexShrink:1},children:s.name}),(0,be.jsx)(w.AppBadge,{label:"CHEF"})]}),(0,be.jsx)(E.T,{size:12,colour:F.colours.muted,numberOfLines:1,children:"Head Chef app"}),(0,be.jsx)(D.PoweredBy,{})]}),(0,be.jsx)(R.default,{accessibilityRole:"button",accessibilityLabel:"Open CoverCharge for Staff",onPress:()=>{const e=(0,te.appUrl)('staff');e&&window.location.assign(e)},style:{borderWidth:1,borderColor:F.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:3,minHeight:44,justifyContent:'center'},children:(0,be.jsx)(E.T,{size:13,colour:F.colours.gold,children:"Staff app \u203a"})}),(0,be.jsx)(L.VoiceSlot,{})]})]}),(0,be.jsxs)(B.default,{ref:Be,...$e.props,contentContainerStyle:{padding:14,paddingBottom:60,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:[(0,be.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:['home'===ue&&!we||Ge?null:(0,be.jsx)(l.BackButton,{onPress:We}),(0,be.jsx)(E.T,{size:22,weight:"bold",style:{flex:1,textAlign:'home'===ue&&!we||Ge?'left':'right'},children:ze})]}),'home'===ue?(0,be.jsx)(Q.DayBar,{app:"chef",today:He}):null,'home'===ue&&Oe?(0,be.jsx)(Q.DayView,{rid:t,day:Oe,today:He,app:"chef"}):null,'home'===ue?(0,be.jsx)(ee.WhoBar,{}):null,De&&_?(0,be.jsx)(h.MyTasksToday,{rid:t,staffId:_.id,name:_.name,onShift:(0,p.shiftNow)(_.id,$.getTime()).on}):null,De?(0,be.jsx)(u.TodaysTipsCard,{rid:t,today:He}):null,De?(0,be.jsx)(u.TipsPotCard,{rid:t,today:He}):null,De?(0,be.jsx)(b.CoversToday,{rid:t,onPress:()=>Fe('kitchen','bookings')}):null,De?(0,be.jsx)(k.LastFoodBanner,{rid:t,now:$}):null,De?(0,be.jsx)(y.NextTableFreeCard,{rid:t,now:$}):null,De?(0,be.jsx)(x.KitchenSignoffs,{rid:t,today:He,by:i,app:"chef"}):null,De?(0,be.jsxs)(A.default,{style:{gap:4},children:[(0,be.jsx)(x.PlattersBooked,{rid:t,date:He,label:"Platters booked today"}),(0,be.jsx)(x.PlattersBooked,{rid:t,date:Ae,label:"Platters booked tomorrow"})]}):null,De?(0,be.jsx)(pe.ChefAssistantButton,{}):null,De?(0,be.jsx)(xe,{go:(e,s)=>{'stock'===e&&s&&ve(s),'gp'===e&&s&&Re(s),'orders'===e&&Pe(s),Fe(e,'kitchen'===e?s??null:null)}}):null,'stock'===ue?(0,be.jsx)(U.StockScreen,{initial:Te},Te):null,'gp'===ue?(0,be.jsx)(M.GpScreen,{initial:Ie},Ie):null,'creator'===ue?(0,be.jsx)(ie.DishCreator,{rid:t,canPublish:!1}):null,'orders'===ue?(0,be.jsx)(z.OrdersScreen,{focus:Se},Se??'all'):null,'kitchen'!==ue||Me?null:(0,be.jsxs)(A.default,{style:{gap:10},children:[(0,be.jsx)(A.default,{style:{borderRadius:14,borderWidth:1,borderColor:F.colours.border,backgroundColor:F.colours.surface,overflow:'hidden'},children:ye.map((e,s)=>(0,be.jsx)(R.default,{accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>Fe(ue,e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:F.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,be.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,be.jsxs)(A.default,{style:{flex:1},children:[(0,be.jsx)(E.T,{weight:"medium",children:e.title}),(0,be.jsx)(E.Muted,{children:e.sub})]}),(0,be.jsx)(E.T,{colour:F.colours.muted,children:"\u203a"})]})},e.id))}),(0,be.jsx)(E.Muted,{children:"Head Chef sees kitchen, stock, food costs and GP. Payroll, wages and the restaurant's billing stay in CoverCharge for Managers."}),(0,be.jsxs)(E.Muted,{center:!0,children:["Head Chef app \xb7 ",r.APP_VERSION," \xb7 ",'live'===ge.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),'myshift'===we&&K?(0,be.jsxs)(A.default,{style:{gap:10},testID:"chef-myshift",children:[(0,be.jsx)(X.ClockInOut,{}),(0,be.jsx)(Z.MyUpcomingShifts,{staffId:K})]}):null,'mypay'===we?(0,be.jsxs)(A.default,{style:{gap:10},testID:"chef-mypay",children:[(0,be.jsx)(Y.MyPeriods,{staffId:K}),(0,be.jsx)(q.MyHoursPay,{staffId:K}),(0,be.jsx)(J.MyTips,{staffId:K}),(0,be.jsxs)(E.Card,{children:[(0,be.jsx)(E.T,{weight:"semibold",children:"Phone notifications"}),(0,be.jsx)(E.Muted,{children:"Get reminders like \u201cMills milk order\u201d on this phone, even with the app closed (once your manager switches phone notifications on). iPhone: add the app to your Home Screen first (iOS 16.4 or later)."}),(0,be.jsx)(c.PushButton,{})]})]}):null,'bookings'===we?(0,be.jsx)(S.TodaysBookings,{rid:t,today:He,by:i,app:"chef"}):null,'specials'===we?(0,be.jsx)(le.SpecialsEditor,{rid:t,me:i,app:"chef",now:$}):null,'prep'===we?(0,be.jsx)(N.PrepScreen,{}):null,'live'===we?(0,be.jsx)(N.TeamScreen,{}):null,'waste'===we?(0,be.jsx)(N.WasteScreen,{}):null,'recipes'===we?(0,be.jsx)(ce.RecipeCards,{rid:t,actor:{name:i,role:'head-chef'},mode:"edit"}):null,'allergens'===we?(0,be.jsx)(N.AllergenScreen,{openCards:()=>Fe('kitchen','recipes')}):null,'compliance'===we?(0,be.jsx)(N.ComplianceScreen,{}):null,'takings'===we?(0,be.jsx)(u.CashUpScreen,{rid:t,today:He,canEdit:!1,chartsOnly:!0,who:{id:K,name:i.replace(' (example)','')}}):null,'board'===we?(0,be.jsx)(he.QuestionBoard,{rid:t,today:He,manager:!1,by:""}):null,'teamtasks'===we?(0,be.jsx)(h.KitchenTeamTasks,{rid:t,actor:_}):null,'orderlists'===we?(0,be.jsx)(j.OrderListsScreen,{rid:t,today:He,editor:!0,who:{id:K,name:i.replace(' (example)','')}}):null,'foodsafety'===we?(0,be.jsx)(c.FoodSafetyCard,{children:(0,be.jsx)(R.default,{accessibilityRole:"button",onPress:()=>Fe('kitchen','haccp'),children:(0,be.jsx)(E.T,{colour:F.colours.gold,children:"Today\u2019s temperature log \u203a"})})}):null,'haccp'===we?(0,be.jsx)(ne.HaccpLog,{mode:"chef",me:i,meId:G.CHEF_ID,now:$}):null,'accidents'===we?(0,be.jsx)(oe.AccidentBook,{app:"chef",me:i,meId:G.CHEF_ID,now:$,seeAll:!1}):null]}),(0,be.jsx)(A.default,{accessibilityRole:"tablist",style:{flexDirection:'row',borderTopWidth:1,borderColor:F.colours.border,backgroundColor:F.colours.surface},children:ke.map(e=>{const s=ue===e.id;return(0,be.jsxs)(R.default,{accessibilityRole:"tab",accessibilityState:{selected:s},accessibilityLabel:e.label,onPress:()=>Fe(e.id),style:{flex:1,alignItems:'center',paddingVertical:8,paddingHorizontal:2,minHeight:52,gap:2},children:[(0,be.jsx)(fe.Icon,{name:e.icon,colour:s?F.colours.gold:F.colours.muted}),(0,be.jsx)(E.T,{size:e.label.length>10?10:11,weight:s?'semibold':'regular',colour:s?F.colours.gold:F.colours.muted,center:!0,children:e.label})]},e.id)})}),(0,be.jsx)(pe.ChefAssistantSheet,{go:(e,s)=>{'orders'===e?(Pe(s),Fe('orders')):'gp'===e?Fe('gp'):Fe('kitchen',e)}}),(0,be.jsx)(re.AlertHost,{variant:"chef",rid:t,skipTakeaway:!0}),(0,be.jsx)(ae.KitchenFlash,{rid:t,me:i})]})};var s=_r(_d[0]),t=_r(_d[1]),o=_r(_d[2]),i=_r(_d[3]),n=_r(_d[4]),l=_r(_d[5]),r=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]),f=_r(_d[12]),b=_r(_d[13]),k=_r(_d[14]),y=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),w=_r(_d[18]),C=_r(_d[19]),T=_r(_d[20]),v=_r(_d[21]),S=_r(_d[22]),P=_r(_d[23]),I=e(_r(_d[24]));_r(_d[25]);var R=e(_r(_d[26])),B=e(_r(_d[27])),H=e(_r(_d[28])),A=e(_r(_d[29])),O=_r(_d[30]),D=_r(_d[31]),L=_r(_d[32]),E=_r(_d[33]),$=_r(_d[34]),F=_r(_d[35]),W=_r(_d[36]),_=_r(_d[37]),G=_r(_d[38]),M=_r(_d[39]),N=_r(_d[40]),z=_r(_d[41]),K=_r(_d[42]),V=_r(_d[43]),U=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),Y=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),se=_r(_d[52]),te=_r(_d[53]),oe=_r(_d[54]),ie=_r(_d[55]),ne=_r(_d[56]),le=_r(_d[57]),re=_r(_d[58]),ae=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),he=_r(_d[62]),ue=_r(_d[63]),pe=_r(_d[64]),ge=_r(_d[65]),fe=_r(_d[66]),be=_r(_d[67]);s.LIVE_HEAD_CHEF&&(0,t.requireRealData)();const ke=[{id:'home',label:'Home',icon:'home'},{id:'stock',label:'Stock',icon:'box'},{id:'gp',label:'GP',icon:'forecast'},{id:'creator',label:ie.CREATOR_TITLE,icon:'sparkle'},{id:'orders',label:'Orders',icon:'orders'},{id:'kitchen',label:'Kitchen',icon:'platter'}],ye=[{id:'myshift',title:'My shifts & clock in',sub:'Clock in and out (checks you are at the venue), breaks, and your shifts on the rota'},{id:'mypay',title:'My pay & tips',sub:'Your hours, tips share, tip goal, paydays and payslip info. Only you see this'},{id:'takings',title:'Takings & tips graphs',sub:'Daily cash ups, weekly sales, this week vs last, categories and the Tips pot (view only)'},{id:'bookings',title:'Today\u2019s bookings',sub:'Covers, allergens to sign off, platters and other reservations, dogs, access and vegan/vegetarian'},{id:'recipes',title:'Recipe cards',sub:'Plating photo, ingredients, method, allergens, section and price; you sign each card off before it goes live'},{id:'specials',title:'Specials board',sub:'Photo of the chalkboard or typed specials with allergens; shown in the customer app'},{id:'board',title:'Question board',sub:'Ask the team anything anonymously, and vote'},{id:'teamtasks',title:'Kitchen team tasks',sub:'Daily tasks for your chefs, commis and KPs'},{id:'orderlists',title:'Order lists',sub:'Alsons drinks, Cash and carry: add items, tick on the day, finish and carry over'},{id:'foodsafety',title:'Food safety (CookSafe)',sub:'Based on CookSafe (Food Standards Scotland). Full logs coming in the next update'},{id:'haccp',title:'Food safety log (HACCP)',sub:'Temperatures, cleaning and allergen checks; voice entry; limits; EHO export'},{id:'accidents',title:'Accident book',sub:'Accidents and near misses; you see your own entries'},{id:'prep',title:'Prep list',sub:'From the forecast and bookings, tick off as you go'},{id:'live',title:'Live tickets, sold out, team & chat',sub:'Orders, readiness alerts, sold out, who\u2019s on, rota, team chat and private messages'},{id:'waste',title:'Waste log',sub:'Item, quantity, reason and cost; weekly total and % of sales'},{id:'allergens',title:'Allergens',sub:'14-allergen matrix from the recipe cards, costing cross-check and audit log'},{id:'compliance',title:'Kitchen compliance',sub:'Fridge, freezer, cooking and cooling temps; cleaning; daily checks'}],me={stock:{tab:'stock',stock:'levels'},'stock-take':{tab:'stock',stock:'take'},deliveries:{tab:'stock',stock:'deliveries'},gp:{tab:'gp',gp:'dishes'},'price-changes':{tab:'gp',gp:'changes'},'gp-week':{tab:'gp',gp:'week'},'menu-engineering':{tab:'gp',gp:'engineering'},orders:{tab:'orders'},prep:{tab:'kitchen',k:'prep'},live:{tab:'kitchen',k:'live'},waste:{tab:'kitchen',k:'waste'},recipes:{tab:'kitchen',k:'recipes'},'recipe-cards':{tab:'kitchen',k:'recipes'},allergens:{tab:'kitchen',k:'allergens'},compliance:{tab:'kitchen',k:'compliance'},haccp:{tab:'kitchen',k:'haccp'},specials:{tab:'kitchen',k:'specials'},accidents:{tab:'kitchen',k:'accidents'},'new-dish':{tab:'creator'}};function xe({go:e}){const{k:s,c:t,menu:o,now:n,rid:l,me:r}=(0,G.useChef)(3e4),d=(0,K.useSheetReminders)(),c=(0,G.useWeek)(),{covers:h,label:u,enough:p,booked:f}=(0,G.useForecast)(),b=(0,z.useSuggestions)(),k=s.ingredients.filter(e=>e.onHand<=0||(0,G.isLow)(e.onHand,e.par)),y=b.filter(e=>e.ordersToday&&!e.placedToday),x=(0,_.priceImpacts)(o,s.recipes,s.ingredients,s.targetGp).filter(e=>e.dropped.length),j=s.deliveries.filter(e=>'expected'===e.status),w=!s.recipes.length||!s.ingredients.length,C=w?[]:t.filter(e=>e.below),T=(0,i.useLiveState)(),v=(0,ue.useRecipeCards)(l).filter(e=>!e.signOff);return(0,be.jsxs)(A.default,{style:{gap:12},testID:"chef-dashboard",children:[(0,be.jsx)(ne.MissedBanner,{mode:"chef",now:n,onPress:()=>e('kitchen','haccp')}),d.map(s=>(0,be.jsx)(R.default,{accessibilityRole:"button",onPress:()=>e('orders',s.supplierId),children:(0,be.jsxs)(E.Banner,{kind:'red'===s.tone?'danger':'warn',title:`\u23f0 ${s.text}`,children:["Tap to open the ",s.name," order sheet. Nothing is sent until you press Send."]})},s.supplierId)),v.length?(0,be.jsx)(R.default,{testID:"cards-awaiting",accessibilityRole:"button",onPress:()=>e('kitchen','recipes'),children:(0,be.jsxs)(E.Banner,{kind:"warn",title:`${v.length} recipe card${1===v.length?'':'s'} awaiting your sign-off`,children:[v.slice(0,4).map(e=>e.dish).join(', '),". Guests see \"awaiting allergen sign-off\" and cannot order these until you sign them off."]})}):null,(0,be.jsx)(V.ShellfishTile,{rid:l,by:r,app:"chef",onOrder:()=>e('orders','os-kittyfisher')}),(0,be.jsxs)(E.Row,{wrap:!0,gap:10,children:[w?(0,be.jsx)(G.Tile,{testID:"tile-gp",label:"GP this week vs target",value:"Nothing yet",sub:"Add ingredients and recipe costs to see GP",onPress:()=>e('gp','week')}):(0,be.jsx)(G.Tile,{testID:"tile-gp",label:"GP this week vs target",value:(0,G.pct1)(c.theo),sub:`Target ${s.targetGp}% \xb7 actual ${(0,G.pct1)(c.actual)}`,tone:c.theoe('gp','week')}),(0,be.jsx)(G.Tile,{testID:"tile-stock",label:"Stock value",value:s.ingredients.length?(0,$.gbp)((0,G.stockValue)(s.ingredients)):'Nothing yet',sub:s.ingredients.length?'At cost':'No stock counted yet',onPress:()=>e('stock','levels')}),(0,be.jsx)(G.Tile,{label:"Items low or out",value:s.ingredients.length?`${k.length}`:'Nothing yet',sub:s.ingredients.length?k.slice(0,3).map(e=>e.name).join(', '):'No stock counted yet',tone:k.some(e=>e.onHand<=0)?'red':k.length?'amber':'ok',onPress:()=>e('stock','levels')}),(0,be.jsx)(G.Tile,{label:"Waste this week",value:s.waste.length?(0,$.gbp)(c.wasteWeek):'Nothing yet',sub:c.sales?`${(0,G.pct1)(c.wasteWeek/c.sales*100)} of food sales`:'',onPress:()=>e('kitchen','waste')}),p?(0,be.jsx)(G.Tile,{label:"Covers forecast today",value:`${h}`,sub:u,onPress:()=>e('kitchen','prep')}):(0,be.jsx)(G.Tile,{label:"Booked so far today",value:'ready'===T?`${f}`:'connecting'===T?'Connecting\u2026':'Not connected',sub:"Not enough history for a forecast yet",onPress:()=>e('kitchen','prep')}),(0,be.jsx)(G.Tile,{label:"Orders due today",value:`${y.length}`,sub:y.map(e=>`${e.s.name} by ${e.s.cutoff}`).join(' \xb7 ')||'None',tone:y.some(e=>e.cutPassed)?'red':y.length?'amber':'ok',onPress:()=>e('orders')})]}),x.map(e=>(0,be.jsxs)(E.Banner,{kind:"danger",title:`${e.ing.name} ${e.pct>0?'+':''}${e.pct.toFixed(0)}%: ${e.dropped.length} dish${1===e.dropped.length?'':'es'} drop below target`,children:[e.dropped.map(e=>e.item.name).join(', '),". Open GP \u203a Price changes."]},e.ing.id)),j.length?(0,be.jsx)(R.default,{accessibilityRole:"button",onPress:()=>e('stock','deliveries'),children:(0,be.jsx)(E.Banner,{kind:"info",title:`${j.length} deliver${1===j.length?'y':'ies'} to check in today`,children:"Count in against the order, flag shorts and price changes."})}):null,C.length?(0,be.jsx)(R.default,{accessibilityRole:"button",onPress:()=>e('gp','dishes'),children:(0,be.jsxs)(E.Banner,{kind:"warn",title:`${C.length} dishes below ${s.targetGp}% GP`,children:[C.slice(0,4).map(e=>e.item.name).join(', '),C.length>4?'\u2026':'']})}):null,(0,be.jsx)(E.Row,{wrap:!0,gap:8,children:[['Recipe cards','recipes'],['Food safety log','haccp'],['Specials board','specials'],[ie.CREATOR_TITLE,'creator'],['Prep list','prep'],['Live tickets & sold out','live'],['Allergens','allergens'],['Accident book','accidents']].map(([s,t])=>(0,be.jsx)(R.default,{accessibilityRole:"button",accessibilityLabel:s,onPress:()=>'creator'===t?e('creator'):e('kitchen',t),style:{flexGrow:1,flexBasis:140,padding:12,borderRadius:12,borderWidth:1.5,borderColor:F.colours.gold,backgroundColor:F.colours.surface},children:(0,be.jsxs)(E.T,{weight:"semibold",children:[s," \u203a"]})},t))}),(0,be.jsx)(E.Badge,{kind:"neutral",label:"Nothing is ordered or sent from here"})]})}},805,[1231,1119,918,1232,991,992,994,2,1004,995,996,959,818,921,1292,1293,950,1003,920,1001,1002,924,1296,30,233,122,263,151,287,127,289,861,925,813,816,821,927,1300,1304,1307,1308,1335,1336,938,1337,1008,922,1009,1011,1010,1343,990,953,859,1012,1344,1013,1345,932,1353,934,998,999,819,1354,820,1007,24]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"APP_VARIANT",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"ENTRY",{enumerable:!0,get:function(){return s}}),_e.isAllowedPath=function(e,n=c){return!(t.IS_ISOLATED_VENUE&&/^\/(customer|table)(\/|$)/.test(e)&&![`/customer/${t.VENUE_RID}`,`/customer/${t.VENUE_RID}/`].includes(e))&&('/'===e||''===e||f[n].test(e))},_e.canShow=function(e,t=c){return t===e||'owner'===t&&'customer'===e};var e,t=r(d[0]),n=r(d[1]),o=(e=n)&&e.__esModule?e:{default:e};const u=o.default.expoConfig?.extra?.appVariant??void 0??'owner',c=['owner','staff','customer','display','chef'].includes(u)?u:'owner',s={owner:'/owner',staff:'/team',customer:`/customer/${t.VENUE_RID}`,display:'/display',chef:'/kitchen'},f={owner:/^\/(owner|customer|table)(\/|$)/,customer:/^\/(customer|table)(\/|$)/,staff:/^\/team(\/|$)/,display:/^\/display(\/|$)/,chef:/^\/kitchen(\/|$)/}},806,[5,408]); +__d(function(g,r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"PERMISSIONS",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"can",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"CHEF_SECTIONS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"chefSectionAllowed",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"rotaView",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"chatView",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"ticketView",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"supplierView",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"auditView",{enumerable:!0,get:function(){return p}});const e={owner:'all',manager:'all',staff:new Set(['rota-shifts','tickets','eighty-six','allergens']),chef:new Set(['stock','costing','gp','waste','dish-sales','prep','ordering','allergens','compliance','rota-shifts','kitchen-chat','tickets','eighty-six','specials'])},t=(t,n)=>{const a=e[t];return'all'===a||a.has(n)},n={stock:'stock','stock-take':'stock',deliveries:'stock',gp:'gp','price-changes':'gp','gp-week':'gp','menu-engineering':'dish-sales',orders:'ordering',prep:'prep',live:'tickets',waste:'waste',allergens:'allergens',compliance:'compliance',haccp:'compliance',accidents:'compliance','new-dish':'gp',specials:'specials',recipes:'allergens','recipe-cards':'allergens'},a=e=>e in n&&t('chef',n[e]),s=(e,n,a)=>t(e,'staff-personal')?{staff:n,shifts:a}:{staff:n.filter(e=>e.active).map(e=>({id:e.id,name:e.name,...e.nickname?{nickname:e.nickname}:{},job:e.job})),shifts:a.filter(e=>e.published).map(({id:e,staffId:t,date:n,day:a,start:s,end:c,published:l})=>({id:e,staffId:t,date:n,day:a,start:s,end:c,published:l}))},c=(e,t)=>'chef'===e?t.filter(e=>'kitchen'===e.ch&&!e.removed):t,l=(e,n)=>t(e,'customer-personal')?n:n.map(({id:e,ref:t,type:n,tableNo:a,slotTime:s,lines:c,status:l,allergies:o,allergyAck:p,handoverCheck:f,allergyChain:u,bookingId:m,readiness:h,createdAt:b,restaurantId:k,notes:y,accepted:w,allergyTicks:j})=>({id:e,ref:t,type:n,tableNo:a,slotTime:s,lines:c,status:l,allergies:o,allergyAck:p,handoverCheck:f,allergyChain:u,bookingId:m,readiness:h,createdAt:b,restaurantId:k,notes:y,accepted:w,allergyTicks:j})),o=(e,n)=>t(e,'supplier-email')?n:n.map(e=>({...e,email:''})),p=(e,n)=>t(e,'audit-all')?n:n.filter(e=>'menu'===e.kind&&/allergen|sign-off|recipe card/i.test(e.text))},807,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(t){const n=String(t??'').trim(),l=n.match(/\d+/g);return 1===l?.length?l[0].replace(/^0+(?=\d)/,''):n}Object.defineProperty(e,'__esModule',{value:!0}),e.plainTableNumber=t,Object.defineProperty(e,"tableNumbers",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"tableListNumbers",{enumerable:!0,get:function(){return l}}),e.tableNumbersA11y=function(t){const l=n(t).split('+').filter(Boolean);return l.length?`${1===l.length?'Table':'Tables'} ${l.join(', ')}`:'No table'};const n=n=>String(n??'').split('+').map(t).filter(Boolean).join('+'),l=(t,l=" + ")=>t.map(n).filter(Boolean).join(l)},808,[]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEFAULT_DWELL",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"dwellBands",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"bandLabel",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"fmtMins",{enumerable:!0,get:function(){return o}}),_e.dwellFor=function(e,t,r=[]){const o=n(e),i=Math.max(0,o.findIndex(e=>t<=e.upTo)),s=o[i]??o[o.length-1];if(!1===e?.settings.dwellLearn)return{mins:s.mins,learned:!1,samples:0};const a=0===i?1:o[i-1].upTo+1,u=r.filter(e=>'finished'===e.status&&e.seatedAt&&e.finishedAt&&e.partySize>=a&&e.partySize<=s.upTo).map(e=>(new Date(e.finishedAt).getTime()-new Date(e.seatedAt).getTime())/6e4).filter(e=>e>=20&&e<=360).sort((e,t)=>e-t);if(u.length<8)return{mins:s.mins,learned:!1,samples:u.length};const l=u[Math.floor(u.length/2)];return{mins:5*Math.round((s.mins+l)/2/5),learned:!0,samples:u.length}},Object.defineProperty(_e,"DAYS",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"ruleText",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"ANCHORAGE_EVENTS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"regularEventsOf",{enumerable:!0,get:function(){return l}}),_e.occursOn=m,_e.nextOccurrence=function(e,t){const n=f(t);for(let t=0;t<400;t++){const r=c(new Date(n.getFullYear(),n.getMonth(),n.getDate()+t));if(m(e,r))return r}return null},_e.expandEvents=function(e,t,n,r){const o=[];if(!t.some(e=>e.active))return o;const i=f(n),s=f(r);for(let n=i;n<=s;n=new Date(n.getFullYear(),n.getMonth(),n.getDate()+1)){const r=c(n);for(const n of t)m(n,r)&&o.push({id:`${n.id}:${r}`,restaurantId:e,date:r,title:n.name,kind:'event',example:!1,source:'regular',description:[n.time?`from ${n.time}`:'',n.lastFood?`last food orders ${n.lastFood}`:'',n.notes??''].filter(Boolean).join(' \xb7 '),busier:n.busier,lastFood:n.lastFood,time:n.time})}return o},_e.lastFoodOn=function(t,n){if(!t)return null;const r=f(n).getDay(),o=t.settings.lastFoodByDay?.[r],s=(0,e.kitchenHoursOn)(t,f(n));let a=s?{time:s[1],reason:'kitchen closes'}:null;o&&(!a||oe?.settings.dwellBands?.length?e.settings.dwellBands:t,r=(e,t)=>{const n=0===t?1:e[t-1].upTo+1,r=e[t].upTo;return r>=9999?`${n} or more covers`:n===r?`${n} cover${1===n?'':'s'}`:`${n}\u2013${r} covers`},o=e=>e%60==0?`${e/60} hour${60===e?'':'s'}`:e>60?`${Math.floor(e/60)} h ${e%60} min`:`${e} min`;const i=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],s=['','first','second','third','fourth'],a=e=>'last'===e.kind?`Last ${i[e.weekday]} of every month`:'nth'===e.kind?`${s[e.n][0].toUpperCase()}${s[e.n].slice(1)} ${i[e.weekday]} of every month`:'weekly'===e.kind?`Every ${i[e.weekday]}`:`One-off: ${e.date}`,u=[{id:'ev-music-night',name:'Open Mic Night',rule:{kind:'last',weekday:0},time:'20:00',notes:'Live music from 8pm.',busier:!0,lastFood:'19:00',active:!0}],l=e=>e?.settings.regularEvents??('anchorage'===e?.id?u:[]),d=e=>String(e).padStart(2,'0'),c=e=>`${e.getFullYear()}-${d(e.getMonth()+1)}-${d(e.getDate())}`,f=e=>new Date(Number(e.slice(0,4)),Number(e.slice(5,7))-1,Number(e.slice(8,10)));function m(e,t){if(!e.active)return!1;const n=e.rule;if('once'===n.kind)return n.date===t;const r=f(t);return r.getDay()===n.weekday&&('weekly'===n.kind||('nth'===n.kind?Math.ceil(r.getDate()/7)===n.n:new Date(r.getFullYear(),r.getMonth(),r.getDate()+7).getMonth()!==r.getMonth()))}const b=e=>e?.settings.afterLastFood??'drinks',p=e=>{const[t,n]=e.split(':').map(Number);return`${t%12||12}${n?`:${d(n)}`:''}${t<12?'am':'pm'}`},y=e=>e?.settings.showTakeaway??'anchorage'!==e?.id,h=e=>!1!==e?.settings.coversCounter,O=e=>!1!==e?.settings.nextTableFree,$=e=>!1!==e?.settings.dogQuestion,w=e=>!1!==e?.settings.dietQuestion,F=e=>!1!==e?.settings.accessQuestion,k=(e,t)=>e?.settings.holidayFullNames?t:t.replace(/\s*\(substitute day\)/gi,'').trim()},809,[815]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Honeypot=function({value:t,onChange:n}){return(0,l.jsx)(o.default,{"aria-hidden":!0,pointerEvents:"none",style:{position:'absolute',left:-1e4,top:0,width:1,height:1,overflow:'hidden',opacity:0},children:(0,l.jsx)(e.TextInput,{testID:"hp-field",accessibilityLabel:"Leave this empty",value:t,onChangeText:n,tabIndex:-1,autoComplete:'off',name:'cc_extra_info','aria-hidden':!0})})};var e=r(d[0]);r(d[1]),r(d[2]);var t,n=r(d[3]),o=(t=n)&&t.__esModule?t:{default:t},l=r(d[4])},810,[877,30,122,127,24]); +__d(function(_g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.startForm=function(t=Date.now()){return{openedAt:t,hp:''}},e.guardFor=function(t,n=Date.now()){return{hp:t.hp,formMs:Math.max(0,Math.round(n-t.openedAt))}},e.rememberGuard=function(n,o){t.set(n,o)},e.takeGuard=function(n){const o=t.get(n);return o?(t.delete(n),o):{}};const t=new Map},811,[]); +__d(function(g,r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"NOTES_PLACEHOLDER",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"WIX_EDIT_NOTE",{enumerable:!0,get:function(){return o}}),e.canEditBooking=function(t){return'customer'!==t.variant&&('staff'===t.variant||t.inStaffApp?!!t.shiftManager:'display'===t.variant||'chef'===t.variant||'staff'!==t.role)},Object.defineProperty(e,"isWixBooking",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"EDIT_FIELDS",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"FIELD_WORDS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"draftOf",{enumerable:!0,get:function(){return c}}),e.changedFields=f,e.editPatch=function(t,n,o,s=(new Date).toISOString()){const d=f(t,n);if(!d.length)return{};const l={};for(const t of d){const o=u(t,n[t]);l[t]='partySize'===t?Math.max(1,Math.min(200,o)):'phone'===t||'email'===t||'table'===t?o||void 0:o}d.includes('table')&&(l.tableSetHere=!0);const c=t;return l.locallyEdited=!0,l.editedFields=[...new Set([...c.editedFields??[],...d])],l.editLog=[...c.editLog??[],{at:s,by:o.by.slice(0,80),app:o.app,fields:d}].slice(-50),l},e.editWarnings=function(n,o,s,d,l=90){const c=[],u={...n,date:o.date,time:o.time,partySize:o.partySize};if(o.table){const n=(0,t.tableOverlaps)(u,o.table,s.filter(t=>t.date===o.date),l);n.length&&c.push(`The table already has a booking at about the same time: ${n.map(t=>`${t.time} ${t.walkIn?'walk-in':t.name}`).join(', ')}.`)}d&&c.push(`Bookings are paused ${d.from} to ${d.to}${d.reason?` (${d.reason})`:''}.`);return c},Object.defineProperty(e,"editedWords",{enumerable:!0,get:function(){return b}});var t=r(_d[0]);const n='For example: birthday, high chair, dog, window seat',o='This booking came from the website. Changes here are not sent to website bookings yet.';const s=t=>{const n=t;return'Wix'===n.importedFrom||!!n.wix||(t.tags??[]).includes('Wix')},d=['date','time','partySize','name','phone','email','notes','table'],l={date:'date',time:'time',partySize:'covers',name:'name',phone:'phone',email:'email',notes:'notes',table:'table'},c=t=>({date:t.date,time:t.time,partySize:t.partySize,name:t.name,phone:t.phone??'',email:t.email??'',notes:t.notes??'',table:t.table??''}),u=(t,n)=>'partySize'===t?Number(n):String(n??'').trim();function f(t,n){const o=c(t);return d.filter(t=>u(t,o[t])!==u(t,n[t]))}const b=t=>t.map(t=>l[t]).join(', ')},812,[1297]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"webLine",{enumerable:!0,get:function(){return j.webLine}}),_e.T=I,Object.defineProperty(_e,"H1",{enumerable:!0,get:function(){return R}}),Object.defineProperty(_e,"H2",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"Muted",{enumerable:!0,get:function(){return W}}),_e.BrandBar=D,_e.Screen=function({children:e,title:t,subtitle:o,back:l=!0,right:n,maxWidth:s=640,footer:u,scroll:b=!0}){const f=(0,w.jsx)(h.default,{style:{width:'100%',maxWidth:s,alignSelf:'center',padding:16,gap:12,alignItems:'stretch'},children:e});return(0,w.jsxs)(y.SafeAreaView,{style:{flex:1,backgroundColor:p.colours.bg},edges:['top','left','right'],children:[(0,w.jsx)(h.default,{style:{width:'100%',maxWidth:s,alignSelf:'center'},children:(0,w.jsx)(D,{title:t,subtitle:o,back:l,right:n})}),b?(0,w.jsx)(c.default,{contentContainerStyle:{paddingBottom:40},children:f}):(0,w.jsx)(h.default,{style:{flex:1},children:f}),u?(0,w.jsx)(h.default,{style:H.footer,children:(0,w.jsx)(h.default,{style:{width:'100%',maxWidth:s,alignSelf:'center'},children:u})}):null]})},_e.Button=function({label:e,sub:t,onPress:o,kind:l="primary",disabled:n,small:c,style:u,accessibilityLabel:b,testID:h}){const f={primary:p.colours.gold,secondary:p.colours.tile,danger:p.colours.redSolid,ghost:'transparent',success:p.colours.accentBg}[l],y={primary:p.colours.onGold,secondary:p.colours.text,danger:'#FFFFFF',ghost:p.colours.gold,success:p.colours.goldLight}[l],j={primary:'transparent',secondary:p.colours.hairline,danger:'transparent',ghost:'transparent',success:p.colours.accentBorder}[l];return(0,w.jsxs)(s.default,{testID:h,accessibilityRole:"button",accessibilityLabel:b??e,accessibilityState:{disabled:!!n},disabled:n,onPress:o,style:({pressed:e})=>[H.btn,{backgroundColor:e&&'secondary'===l?p.colours.tilePressed:f,borderColor:j,opacity:n?.4:e?.85:1},c&&{paddingVertical:8,paddingHorizontal:14,minHeight:x.control.min,minWidth:44},u],children:[(0,w.jsx)(I,{weight:"semibold",size:c?p.font.small:p.font.body,colour:y,center:!0,children:e}),t?(0,w.jsx)(I,{size:c?p.font.small-2:p.font.small,colour:y,center:!0,testID:h?`${h}-sub`:void 0,children:t}):null]})},_e.Card=function({children:e,style:t,onPress:o,highlight:l}){const n=l===p.colours.gold||l===p.colours.accentBorder,c=(0,w.jsx)(h.default,{style:[H.card,{alignItems:'center'},l?{borderColor:n?p.colours.accentBorder:l,borderWidth:n?1:2}:null,t],children:e});return o?(0,w.jsx)(s.default,{accessibilityRole:"button",onPress:o,style:({pressed:e})=>({opacity:e?.85:1}),children:c}):c},_e.Badge=function({label:e,kind:t="neutral"}){const o={neutral:[p.colours.surface2,p.colours.muted,p.colours.border],gold:[p.colours.goldTint,p.colours.goldLight,p.colours.gold],red:[p.colours.redBg,'#FFD9D4',p.colours.red],amber:[p.colours.amberBg,'#FFE2A8',p.colours.amber],ok:[p.colours.okBg,p.colours.goldLight,p.colours.ok],blue:[p.colours.blueBg,p.colours.goldLight,p.colours.blue]}[t];return(0,w.jsx)(h.default,{style:[H.badge,{backgroundColor:o[0],borderColor:o[2],maxWidth:'100%'}],children:(0,w.jsx)(I,{size:13,weight:"medium",colour:o[1],style:{flexShrink:1},children:e})})},_e.Banner=F,Object.defineProperty(_e,"ExampleAllergenNotice",{enumerable:!0,get:function(){return z}}),Object.defineProperty(_e,"DemoPaymentNotice",{enumerable:!0,get:function(){return P}}),_e.Row=L,Object.defineProperty(_e,"Divider",{enumerable:!0,get:function(){return v}}),_e.Field=function({label:e,...o}){return(0,w.jsxs)(h.default,{style:{gap:4,alignSelf:'stretch',width:'100%'},children:[(0,w.jsx)(I,{size:p.font.small,weight:"medium",colour:p.colours.muted,center:!0,children:e}),(0,w.jsx)(t.TextInput,{accessibilityLabel:e,placeholderTextColor:"#7D776C",...o,style:[H.input,o.multiline&&{minHeight:70,textAlignVertical:'top'},o.style]})]})},_e.Chip=function({label:e,selected:t,onPress:o,disabled:l,sub:n,testID:c}){return(0,w.jsxs)(s.default,{testID:c,accessibilityRole:"button",accessibilityState:{selected:!!t,disabled:!!l},accessibilityLabel:`${e}${n?`, ${n}`:''}${t?', selected':''}`,'aria-pressed':!!t,disabled:l,onPress:o,style:[H.chip,t&&{backgroundColor:p.colours.gold,borderColor:p.colours.gold},l&&{opacity:.35}],children:[(0,w.jsx)(I,{size:p.font.small,weight:"medium",colour:t?p.colours.onGold:p.colours.text,center:!0,children:e}),n?(0,w.jsx)(I,{size:12,colour:t?p.colours.onGold:p.colours.muted,center:!0,children:n}):null]})},_e.Toggle=function({value:e,onChange:t,label:o,testID:l,disabled:n,a11y:s}){return(0,w.jsxs)(L,{style:{justifyContent:'space-between',flexShrink:1,minWidth:0},children:[(0,w.jsx)(I,{style:{flex:1,flexShrink:1},children:o}),(0,w.jsx)(b.default,{testID:l,disabled:n,accessibilityLabel:s??o,value:e,onValueChange:t,trackColor:{true:p.colours.gold,false:'#444'},thumbColor:e?'#FFF6E0':'#BBB',activeThumbColor:'#FFF6E0',activeTrackColor:p.colours.gold})]})},_e.Stepper=function({value:e,onChange:t,min:o=1,max:l=20,label:n,step:c=1,format:u,testID:b}){const f=u?u(e):String(e),y=e=>Math.round(e/c)*c;return(0,w.jsxs)(L,{gap:10,children:[(0,w.jsx)(s.default,{testID:b?`${b}-down`:void 0,accessibilityRole:"button",accessibilityLabel:`Decrease ${n??''}`,disabled:e<=o,onPress:()=>t(Math.max(o,y(e-c))),style:[H.stepBtn,e<=o?{opacity:.4}:null],children:(0,w.jsx)(I,{size:20,colour:p.colours.gold,children:"\u2212"})}),(0,w.jsx)(h.default,{testID:b?`${b}-value`:void 0,accessibilityLabel:n?`${n}: ${f}`:f,children:(0,w.jsx)(I,{weight:"semibold",size:p.font.large,style:{minWidth:u?64:28,textAlign:'center'},children:f})}),(0,w.jsx)(s.default,{testID:b?`${b}-up`:void 0,accessibilityRole:"button",accessibilityLabel:`Increase ${n??''}`,disabled:e>=l,onPress:()=>t(Math.min(l,y(e+c))),style:[H.stepBtn,e>=l?{opacity:.4}:null],children:(0,w.jsx)(I,{size:20,colour:p.colours.gold,children:"+"})})]})},_e.Sheet=function({visible:e,onClose:t,title:o,children:u,maxWidth:b,testID:x,footer:j}){const{height:C}=(0,f.default)(),k=l.default.useContext(y.SafeAreaInsetsContext)??{top:0,bottom:0,left:0,right:0},B=Math.max(320,C-k.top-k.bottom-24);return(0,w.jsx)(n.default,{visible:e,transparent:!0,animationType:"fade",onRequestClose:t,children:(0,w.jsx)(h.default,{style:[H.overlay,{padding:12,paddingTop:12+k.top,paddingBottom:12+k.bottom}],children:(0,w.jsxs)(h.default,{style:[H.sheet,{maxHeight:B},b?{maxWidth:b}:null],testID:x,children:[(0,w.jsxs)(L,{style:{justifyContent:'space-between',marginBottom:8,gap:8},children:[(0,w.jsx)(T,{style:{flex:1},children:o}),(0,w.jsx)(s.default,{accessibilityRole:"button",accessibilityLabel:"Close",onPress:t,hitSlop:8,testID:"sheet-close",style:{minWidth:48,minHeight:48,width:S?72:48,alignItems:'center',justifyContent:'center',marginRight:-8,marginTop:-6},children:(0,w.jsx)(I,{size:S?18:24,colour:p.colours.text,children:S?'Close':'\u2715'})})]}),(0,w.jsx)(c.default,{style:{flexShrink:1},contentContainerStyle:{gap:12,paddingTop:2,paddingBottom:4},children:u}),j?(0,w.jsx)(h.default,{style:{borderTopWidth:1,borderTopColor:p.colours.border,paddingTop:10,marginTop:8},testID:x?`${x}-footer`:void 0,children:j}):null]})})})},_e.SectionTitle=function({children:e}){return(0,w.jsx)(I,{weight:"semibold",size:12,colour:p.colours.goldMuted,center:!0,style:{textTransform:'uppercase',letterSpacing:1.6,marginTop:8},children:e})},Object.defineProperty(_e,"styles",{enumerable:!0,get:function(){return H}});var t=r(d[0]),o=r(d[1]),l=e(r(d[2])),n=e(r(d[3])),s=e(r(d[4])),c=e(r(d[5])),u=e(r(d[6])),b=e(r(d[7])),h=e(r(d[8])),f=e(r(d[9])),y=r(d[10]),p=r(d[11]),x=r(d[12]),j=r(d[13]),C=r(d[14]),k=r(d[15]),B=r(d[16]),w=r(d[17]);const S=['kirkton','abbotsford'].includes(C.VENUE_RID);function I({children:e,style:o,size:l=p.font.body,weight:n="regular",colour:s=p.colours.text,numberOfLines:c,center:u,testID:b,accessibilityRole:h}){return(0,w.jsx)(t.Text,{testID:b,accessibilityRole:h,numberOfLines:c,style:[{fontFamily:p.fonts[n],fontSize:l,color:s,lineHeight:(0,x.lineFor)(l)},u&&{textAlign:'center'},o,(0,j.webLine)(o,l)],children:e})}const R=e=>(0,w.jsx)(I,{size:p.font.title,weight:"semibold",center:!0,...e}),T=e=>(0,w.jsx)(I,{size:p.font.large,weight:"semibold",center:!0,...e}),W=e=>(0,w.jsx)(I,{colour:p.colours.muted,size:p.font.small,...e});function D({title:e,back:t=!0,right:l,subtitle:n}){return(0,w.jsxs)(h.default,{style:H.brandBar,children:[(0,w.jsxs)(h.default,{style:H.row,children:[(0,w.jsx)(h.default,{style:H.brandSide,children:t?(0,w.jsx)(s.default,{accessibilityRole:"button",accessibilityLabel:"Back",onPress:()=>o.router.canGoBack()?o.router.back():o.router.replace(k.ENTRY[k.APP_VARIANT]),style:H.backBtn,hitSlop:10,children:(0,w.jsx)(I,{size:18,weight:"semibold",colour:p.colours.gold,children:"\u2039 Back"})}):null}),(0,w.jsx)(s.default,{onPress:()=>o.router.push(k.ENTRY[k.APP_VARIANT]),accessibilityLabel:"Home",style:H.brandCenter,children:(0,w.jsx)(B.RestaurantBrand,{size:B.HEADER_LOGO})}),(0,w.jsx)(h.default,{style:[H.brandSide,{alignItems:'flex-end'}],children:l?(0,w.jsx)(h.default,{style:{flexShrink:0},children:l}):null})]}),e?(0,w.jsx)(R,{style:{marginTop:10,alignSelf:'stretch'},children:e}):null,n?(0,w.jsx)(W,{center:!0,style:{alignSelf:'stretch'},children:n}):null]})}function F({kind:e="info",title:t,children:o}){const n={info:[p.colours.surface,p.colours.gold,p.colours.text],warn:[p.colours.amberBg,p.colours.amber,'#FFE2A8'],danger:[p.colours.redBg,p.colours.red,'#FFE3DF'],success:[p.colours.okBg,p.colours.ok,p.colours.goldLight],example:[p.colours.amberBg,p.colours.amber,'#FFE2A8'],demo:[p.colours.goldTint,p.colours.gold,p.colours.goldLight]}[e];return(0,w.jsxs)(h.default,{accessibilityRole:"summary",style:[H.banner,{backgroundColor:n[0],borderLeftColor:n[1]}],children:[t?(0,w.jsx)(I,{weight:"semibold",colour:n[2],center:!0,children:t}):null,l.default.Children.toArray(o).every(e=>'string'==typeof e||'number'==typeof e)?(0,w.jsx)(I,{size:p.font.small,colour:n[2],center:!0,children:o}):o]})}const z=()=>(0,w.jsx)(F,{kind:"example",title:"Allergens awaiting kitchen verification",children:"This allergen information has not been verified by the kitchen. Head chef sign-off is required. Always speak to staff about allergies."}),P=()=>(0,w.jsx)(F,{kind:"demo",title:"Card payments: not set up yet",children:"No card is charged and no payment provider is contacted."});function L({children:e,style:t,gap:o=8,wrap:l}){return(0,w.jsx)(h.default,{style:[H.row,{gap:o},l&&{flexWrap:'wrap',justifyContent:'center'},t],children:e})}const v=()=>(0,w.jsx)(h.default,{style:{height:1,backgroundColor:p.colours.border,marginVertical:4}});const H=u.default.create({row:{flexDirection:'row',alignItems:'center'},brandBar:{paddingHorizontal:16,paddingTop:8,paddingBottom:8,borderBottomWidth:1,borderBottomColor:p.colours.border},brandSide:{width:96,minHeight:48,justifyContent:'center'},brandCenter:{flex:1,alignItems:'center',justifyContent:'center',minHeight:48},backBtn:{paddingRight:12,minHeight:48,minWidth:88,justifyContent:'center'},btn:{borderRadius:x.radii.button,paddingVertical:12,paddingHorizontal:18,borderWidth:1,alignItems:'center',justifyContent:'center',minHeight:x.control.min,alignSelf:'stretch'},card:{backgroundColor:p.colours.surface,borderRadius:p.radius.l,padding:16,borderWidth:1,borderColor:p.colours.hairline,gap:8},badge:{borderRadius:999,paddingHorizontal:9,paddingVertical:2,borderWidth:1,alignSelf:'flex-start'},banner:{borderRadius:p.radius.m,padding:12,borderLeftWidth:5,gap:2},input:{minWidth:0,backgroundColor:p.colours.surface2,borderColor:p.colours.border,borderWidth:1,borderRadius:p.radius.m,paddingHorizontal:12,paddingVertical:10,color:p.colours.text,fontSize:p.font.body,fontFamily:p.fonts.regular},chip:{borderWidth:1,borderColor:p.colours.border,borderRadius:p.radius.m,paddingHorizontal:12,paddingVertical:8,backgroundColor:p.colours.surface2,minWidth:64,minHeight:44,justifyContent:'center'},stepBtn:{width:44,height:44,borderRadius:22,borderWidth:1.5,borderColor:p.colours.gold,alignItems:'center',justifyContent:'center'},overlay:{flex:1,backgroundColor:'rgba(0,0,0,0.7)',justifyContent:'center',alignItems:'center',padding:16},sheet:{backgroundColor:p.colours.surface,borderRadius:x.radii.xl,padding:18,width:'100%',maxWidth:520,maxHeight:'90%',borderWidth:1,borderColor:p.colours.gold},footer:{borderTopWidth:1,borderTopColor:p.colours.border,backgroundColor:p.colours.surface,padding:12}})},813,[877,804,30,256,263,151,46,271,127,287,289,821,1236,1238,5,806,861,24]); +__d(function(_g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ALLERGENS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"allergenLabel",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"SEVERITIES",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"severityLabel",{enumerable:!0,get:function(){return s}}),e.effectiveAllergens=function(l,n=[]){const t={...l.allergens};for(const s of l.optionGroups??[])for(const l of s.choices)if(n.includes(l.id)&&l.allergens)for(const[n,s]of Object.entries(l.allergens))'contains'!==t[n]&&(t[n]=s);return t},e.conflictsFor=function(l,n){const t=[],s=[];for(const a of n)'contains'===l[a.allergen]?t.push(a.allergen):'may'===l[a.allergen]&&s.push(a.allergen);return{contains:t,may:s}},Object.defineProperty(e,"hasConflict",{enumerable:!0,get:function(){return a}});const l=[{id:'gluten',label:'Cereals containing gluten',short:'Gluten'},{id:'crustaceans',label:'Crustaceans',short:'Crustaceans'},{id:'molluscs',label:'Molluscs',short:'Molluscs'},{id:'eggs',label:'Eggs',short:'Eggs'},{id:'fish',label:'Fish',short:'Fish'},{id:'peanuts',label:'Peanuts',short:'Peanuts'},{id:'treenuts',label:'Tree nuts',short:'Tree nuts'},{id:'soya',label:'Soya',short:'Soya'},{id:'milk',label:'Milk',short:'Milk'},{id:'celery',label:'Celery',short:'Celery'},{id:'mustard',label:'Mustard',short:'Mustard'},{id:'sesame',label:'Sesame',short:'Sesame'},{id:'sulphites',label:'Sulphur dioxide / sulphites',short:'Sulphites'},{id:'lupin',label:'Lupin',short:'Lupin'}],n=n=>l.find(l=>l.id===n)?.short??n,t=[{id:'intolerance',label:'Intolerance'},{id:'allergy',label:'Allergy'},{id:'coeliac',label:'Coeliac disease'},{id:'anaphylaxis',label:'Severe \u2014 anaphylaxis risk'}],s=l=>t.find(n=>n.id===l)?.label??l;const a=l=>l.contains.length>0||l.may.length>0},814,[]); +__d(function(g,_r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ANCHORAGE_SEASONS",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"hourSetsOf",{enumerable:!0,get:function(){return n}}),e.seasonOn=s,e.kitchenHoursOn=l,e.hoursFor=function(r,n){const u=l(r,n);return u?{open:(0,t.atTime)(n,u[0]),close:(0,t.atTime)(n,u[1])}:null};var t=_r(_d[0]);const r=[{id:'winter',name:'Winter',hours:{0:['12:30','19:00'],1:null,2:null,3:['12:00','19:00'],4:['12:00','19:00'],5:['12:00','20:00'],6:['12:00','20:00']}},{id:'summer',name:'Summer',hours:null}],n=t=>t.settings.hourSets??('anchorage'===t.id?r:[]),u=t=>`${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`,o=t=>`${t.getFullYear()}-${u(t)}`;function s(t,r){const o=n(t).filter(t=>t.hours);if(!o.length)return null;const s=o.filter(t=>t.start).sort((t,r)=>t.start.localeCompare(r.start));if(s.length<2)return s[0]??o[0];const l=u(r);return[...s].reverse().find(t=>t.start<=l)??s[s.length-1]}function l(t,r){const n=(t.settings.hourOverrides??[]).find(t=>t.date===o(r));if(n)return n.hours;const u=s(t,r);return u?.hours?u.hours[r.getDay()]??null:t.kitchenHours[r.getDay()]??null}},815,[818]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"gbp",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"pounds",{enumerable:!0,get:function(){return n}});const t=t=>`\xa3${(t/100).toFixed(2)}`,n=t=>Math.round(100*t)},816,[]); +__d(function(g,_r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.takeawaySlots=function(s,o,r){const l=(0,t.hoursFor)(s,r);if(!l)return[];const d=s.settings.slotMinutes,u=(0,n.addMins)(r,s.settings.leadMins),c=[];for(let t=new Date(l.open);t<=l.close;t=(0,n.addMins)(t,d)){if(tn.restaurantId===s.id&&'takeaway'===n.type&&'cancelled'!==n.status&&n.slotTime&&new Date(n.slotTime).getTime()===t.getTime()).length;c.push({time:new Date(t),label:(0,n.hm)(t),taken:r,cap:s.settings.slotCap,full:r>=s.settings.slotCap})}return c},e.bookingSlots=function(r,l,d,u,c){const f=(0,t.hoursFor)(r,l);if(!f)return[];const p=[],M=(0,n.addMins)(f.close,-60),h=(0,s.lastFoodOn)(r,o(l)),k=h?(0,n.addMins)((0,n.atTime)(l,h.time),-60):M,S='drinks'===(0,s.afterLastFood)(r);for(let t=new Date(f.open);t<=M;t=(0,n.addMins)(t,30)){const s=(0,n.hm)(t),o=t>k;if(o&&!S)continue;const l=r.settings.bookingCoversPerSlot-d(s),f=t.getTime()=u,...o?{drinksOnly:!0}:{}})}return p};var t=_r(_d[0]),n=_r(_d[1]),s=_r(_d[2]);const o=t=>`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`},817,[815,818,809]); +__d(function(g,r,i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"pad",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"ymd",{enumerable:!0,get:function(){return n}}),e.venueYmd=function(t,u="Europe/London"){try{const n=new Intl.DateTimeFormat('en-CA',{timeZone:u,year:'numeric',month:'2-digit',day:'2-digit'}).format(t);if(/^\d{4}-\d{2}-\d{2}$/.test(n))return n}catch{}return n(t)},Object.defineProperty(e,"hm",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"parseYmd",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"toMins",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"fromMins",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"atTime",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"addMins",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"dayShort",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"dayLong",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"monthLong",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"niceDate",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"niceDateYear",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"minsBetween",{enumerable:!0,get:function(){return P}});const t=t=>String(t).padStart(2,'0'),n=n=>`${n.getFullYear()}-${t(n.getMonth()+1)}-${t(n.getDate())}`;const u=n=>`${t(n.getHours())}:${t(n.getMinutes())}`,a=t=>{const[n,u,a]=t.split('-').map(Number);return new Date(n,u-1,a)},o=t=>{const[n,u]=t.split(':').map(Number);return 60*n+u},c=n=>`${t(Math.floor(n/60))}:${t(n%60)}`,d=(t,n)=>{const u=new Date(t);return u.setHours(0,0,0,0),u.setMinutes(o(n)),u},m=(t,n)=>new Date(t.getTime()+6e4*n),b=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],y=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],f=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],l=['January','February','March','April','May','June','July','August','September','October','November','December'],p=t=>b[t.getDay()],s=t=>y[t.getDay()],O=t=>l[t],M=t=>`${b[t.getDay()]} ${t.getDate()} ${f[t.getMonth()]}`,j=t=>`${M(t)} ${t.getFullYear()}`,P=(t,n)=>Math.round((n.getTime()-t.getTime())/6e4)},818,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"repo",{enumerable:!0,get:function(){return o}});var t=r(d[0]),n=r(d[1]);Object.keys(n).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})});const o=t.localRepositories},819,[1239,1022]); +__d(function(_g,_r2,_i2,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"inviteRefusal",{enumerable:!0,get:function(){return p.inviteRefusal}}),Object.defineProperty(_e,"keysToWipe",{enumerable:!0,get:function(){return p.keysToWipe}}),Object.defineProperty(_e,"changedFields",{enumerable:!0,get:function(){return m.changedFields}}),Object.defineProperty(_e,"useSync",{enumerable:!0,get:function(){return re}}),Object.defineProperty(_e,"can",{enumerable:!0,get:function(){return de}}),Object.defineProperty(_e,"isLive",{enumerable:!0,get:function(){return ue}}),_e.setTempManagerAccess=async function(e,t,a){const s=re.getState().venueId;if(!s||'staff'!==re.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{error:i}=await ne().rpc('set_staff_manager_access',{p_venue:s,p_staff_ref:e,p_on:t,p_reason:a.trim()||null});return i?{ok:!1,message:/owner/i.test(i.message)?'Only an owner can change this.':'Could not save. Try again.'}:(P.useOwner.setState(a=>({staff:a.staff.map(a=>a.id===e?{...a,...t?{role:'manager',managerAccess:!0}:{role:'staff',managerAccess:void 0}}:a)})),{ok:!0})}catch{return{ok:!1,message:'Could not save. Try again when the app is online.'}}},_e.setTempOwnerAccess=async function(e,t,a){const s=re.getState().venueId;if(!s||'staff'!==re.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{error:i}=await ne().rpc('set_staff_owner_access',{p_venue:s,p_staff_ref:e,p_on:t,p_reason:a.trim()||null});if(i)return{ok:!1,message:/owner/i.test(i.message)?'Only an owner can change this.':'Could not save. Try again.'};const n=e=>'Manager'===e.level||'Supervisor'===e.level?'manager':'staff';return P.useOwner.setState(a=>({staff:a.staff.map(a=>a.id===e?{...a,...t?{role:'owner',ownerAccess:!0}:{role:a.managerAccess?'manager':n(a),ownerAccess:void 0}}:a)})),{ok:!0}}catch{return{ok:!1,message:'Could not save. Try again when the app is online.'}}},_e.setManagerAccess=async function(e,t){const a=re.getState().venueId;if(!a||'staff'!==re.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:s,error:i}=await ne().rpc('set_manager_access',{p_venue:a,p_staff_ref:e,p_on:t});if(i)return{ok:!1,message:i.message.replace(/^.*?:\s*/,'')||'Not allowed'};const n=String(s??'');return P.useOwner.setState(t=>({staff:t.staff.map(t=>t.id===e?{...t,...Ge(n)}:t)})),{ok:!0,role:n}}catch(e){return{ok:!1,message:String(e?.message??e)}}},_e.unlockCashUp=async function(e,t,a){if(H.PITCH)return Q.unlockCashUp(e,t,a);const s=re.getState().venueId;if(!s||'staff'!==re.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:i,error:n}=await ne().rpc('unlock_cash_up',{p_venue:s,p_kind:e,p_id:t,p_reason:a});if(n)return{ok:!1,message:n.message};const r=String(i);return'cashup'===e?B.useCashUp.setState(e=>({cashUps:e.cashUps.map(e=>e.id===t?{...e,unlockedUntil:r}:e)})):B.useCashUp.setState(e=>({sales:e.sales.map(e=>e.id===t?{...e,unlockedUntil:r}:e)})),{ok:!0,until:r}}catch(e){return{ok:!1,message:String(e?.message??e)}}},_e.readCashAudit=async function(e){if(H.PITCH)return Q.cashAudit(e);const t=re.getState().venueId;if(!t)return[];let a=ne().from('cash_up_audit').select('at, action, changed_by_name, tbl, for_date, reason, old_row, new_row').eq('venue_id',t).order('at',{ascending:!1}).limit(50);e&&(a=a.eq('row_id',e));const{data:s,error:i}=await a;return i||!Array.isArray(s)?[]:s.map(e=>({at:String(e.at),action:String(e.action),by:String(e.changed_by_name??'\u2014'),tbl:String(e.tbl),forDate:e.for_date??void 0,reason:e.reason??void 0,changed:(0,m.changedFields)(e.old_row,e.new_row)}))},_e.setPushLive=async function(e){const t=re.getState().venueId;if(!t)return{ok:!1,message:'Connect to the venue first.'};const{data:a,error:s}=await ne().rpc('set_push_live',{p_venue:t,p_on:e});return s?{ok:!1,message:s.message}:(qt.setState({live:!!a,known:!0}),{ok:!0})},_e.readPushLive=Kt,_e.readAccessLog=async function(){const e=re.getState().venueId;if(!e)return[];try{const{data:t}=await ne().from('staff_access_log').select('*').eq('venue_id',e).order('changed_at',{ascending:!1}).limit(30);return t??[]}catch{return[]}},Object.defineProperty(_e,"ORDER_LOGO_BUCKET",{enumerable:!0,get:function(){return xt}}),_e.uploadOrderLogo=async function(e,t){const a=re.getState().venueId;if(!a||'staff'!==re.getState().kind)return{ok:!1,message:'offline'};try{const s=await(await fetch(t)).blob(),i=`${a}/${e}-${Date.now()}.jpg`,{error:n}=await ne().storage.from(xt).upload(i,s,{upsert:!0,contentType:'image/jpeg'});return n?{ok:!1,message:n.message}:{ok:!0,path:i}}catch(e){return{ok:!1,message:String(e?.message??e)}}},_e.orderLogoUrl=async function(e){const t=Lt.get(e);if(t&&t.until>Date.now())return t.url;try{const{data:t}=await ne().storage.from(xt).createSignedUrl(e,3600);if(t?.signedUrl)return Lt.set(e,{url:t.signedUrl,until:Date.now()+3e6}),t.signedUrl}catch{}return null},_e.removeOrderLogo=async function(e){try{await ne().storage.from(xt).remove([e])}catch{}},Object.defineProperty(_e,"usePushLive",{enumerable:!0,get:function(){return qt}}),_e.claimInvite=Zt,_e.signedInHereAs=async function(e){fe();const t=await k.kv.get(Ht,null);return!!t&&'staff'===t.kind&&t.staffRef===e},_e.rememberedInviteHere=async function(e){return fe(),await k.kv.get(Gt,null)===e},_e.kirkmichaelStaffAppUrl=async function(){const t=re.getState();if(!e.IS_KIRKMICHAEL||'staff'!==t.kind||t.venueId!==e.VENUE_UUID||t.staffRef!==g.useSession.getState().meId)return null;fe();const a=await k.kv.get(Gt,null);return a?(0,g.appUrl)('staff',a):null},_e.wildingsStaffAppUrl=async function(){const t=re.getState();if(!e.IS_WILDINGS||'staff'!==t.kind||t.venueId!==e.VENUE_UUID||t.staffRef!==g.useSession.getState().meId)return null;fe();const a=await k.kv.get(Gt,null);return a?(0,g.appUrl)('staff',a):null},_e.forgetSignInHere=async function(){fe(),await k.kv.remove(Ht),await k.kv.remove(Gt),oe({mode:'signin',perms:[]});try{await ta()}catch{}},_e.approveShiftSwap=async function(e,t,a){const s=re.getState().venueId;if(H.PITCH||!s||'staff'!==re.getState().kind)return{ok:!0};if(!(0,$.isUuid)(e))return{ok:!1,message:'This shift isn\u2019t on the shared rota yet.'};try{return await Yt('approve_shift_swap',{p_venue:s,p_shift:e,p_to_ref:t,p_kind:a}),{ok:!0}}catch(e){return{ok:!1,message:String(e?.message??e).replace(/^.*?:\s*/,'')||'Not allowed'}}},_e.claimInviteForSync=async function(e){const t=await Zt(e);return'ok'===t.status?t.id:null},_e.reissueInvite=async function(e){if(H.PITCH)return Q.reissueInvite(e);const t=re.getState().venueId;if(!t||'staff'!==re.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:a,error:s}=await ne().rpc('reissue_invite',{p_venue:t,p_staff_ref:e});if(s)return{ok:!1,message:s.message.replace(/^.*?:\s*/,'')||'Not allowed'};const i=a,n=String(i.app??'staff');return{ok:!0,token:String(i.token),expiresAt:String(i.expiresAt),app:'owner'===n||'chef'===n?n:'staff'}}catch(e){return{ok:!1,message:String(e?.message??e)}}},_e.ensureStaffAppLinks=async function(e){const t=re.getState().venueId;if(!t||'staff'!==re.getState().kind)throw new Error('Connect to the venue first.');return Yt('ensure_staff_app_links',{p_venue:t,p_staff_ref:e})},_e.staffAppLinkHistory=async function(e){return Yt('staff_app_link_history',{p_venue:re.getState().venueId,p_staff_ref:e})},_e.revokeStaffAppLink=async function(e){await Yt('revoke_staff_app_link',{p_venue:re.getState().venueId,p_link_id:e})},_e.readInviteStatus=async function(){if(H.PITCH)return Q.inviteStatus();const e=re.getState().venueId;if(!e)return{};const{data:t,error:a}=await ne().rpc('invite_status',{p_venue:e});if(a||!Array.isArray(t))return{};const s={};for(const e of t)s[String(e.staff_ref)]={state:e.state,expiresAt:e.expires_at??void 0,usedAt:e.used_at??void 0,devices:Number(e.devices??0)};return s},_e.pairWithCode=async function(t){if(!(0,v.isSupabaseConfigured)())return{ok:!1,error:'This build has no shared backend.'};try{await zt();const{data:a,error:s}=await ne().rpc(e.IS_QUEUED_VENUE?'claim_'+e.VENUE_RID+'_pairing_code':e.IS_GREENSIDE?'claim_greenside_pairing_code':e.IS_ABBOTSFORD?'claim_abbotsford_pairing_code':e.IS_KIRKTON?'claim_kirkton_pairing_code':e.IS_WILDINGS?'claim_wildings_pairing_code':e.IS_KIRKMICHAEL?'claim_kirkmichael_pairing_code':e.IS_ISOLATED_VENUE?'claim_souters_pairing_code':'claim_pairing_code',{p_code:t});if(s)throw s;const i=a?.[0];if(!i)return{ok:!1,error:'That code was not accepted. It may have expired. Ask a manager for a new one.'};const n={kind:'device',venueId:i.venue_id,venueSlug:i.venue_slug,venueName:i.venue_name,canWrite:i.can_write,label:i.label};return await k.kv.set(Vt,n),aa(),{ok:!0,venueName:i.venue_name}}catch(e){const t=String(e?.message??e);return/fetch|network/i.test(t)?{ok:!1,error:'No connection. Check the tablet\u2019s Wi-Fi and try again.'}:/rate|too many/i.test(t)?{ok:!1,error:'Too many tries from this network. Wait a little and try again.'}:{ok:!1,error:/valid|switched off/i.test(t)?t:`Couldn\u2019t pair: ${t}`}}},_e.unpairDisplay=async function(){await k.kv.remove(Vt),await ta();try{await ne().auth.signOut()}catch{}oe({mode:'unpaired',venueId:void 0,venueName:void 0,perms:[]})},_e.disconnectStaff=async function(){await k.kv.remove(Ht),await k.kv.remove(Gt),await ta();try{await ne().auth.signOut()}catch{}oe({mode:'signin',venueId:void 0,venueName:void 0,perms:[],kind:void 0,role:void 0,staffRef:void 0,message:'Disconnected. Open your personal invite link to connect again.'})},_e.wipeThisDevice=async function(t={}){try{await ta()}catch{}try{(0,v.isSupabaseConfigured)()&&await ne().auth.signOut({scope:'local'})}catch{}let a=0;try{const e='undefined'!=typeof navigator?navigator:null,t=await(e?.serviceWorker?.getRegistration?.()),a=await(t?.pushManager?.getSubscription?.());a&&await a.unsubscribe()}catch{}for(const t of['undefined'!=typeof localStorage?localStorage:null,'undefined'!=typeof sessionStorage?sessionStorage:null])if(t)try{const s=[];for(let e=0;et.startsWith(`cc-venue:${e.VENUE_RID}:`)):(0,p.keysToWipe)(s).filter(e=>!e.startsWith('cc-venue:')))t.removeItem(i),a++}catch{}try{const t='undefined'!=typeof caches?caches:null;if(t)for(const a of await t.keys())!e.IS_ISOLATED_VENUE&&/data|api|photo/i.test(a)&&await t.delete(a)}catch{}oe({mode:'signin',venueId:void 0,venueName:void 0,perms:[],kind:void 0,role:void 0,staffRef:void 0,message:'This device has been wiped.'}),!1!==t.reload&&'undefined'!=typeof window&&window.location&&window.location.replace(window.location.pathname);return a},_e.guestSession=Xt,Object.defineProperty(_e,"rpc",{enumerable:!0,get:function(){return Yt}}),_e.startAppSync=async function(t=e.VENUE_RID){if(e.IS_ISOLATED_VENUE&&t!==e.VENUE_RID)return;if(ge)return;ge=!0,sa=t,'customer'===le&&'live'!==U.useStore.getState().clock.mode&&U.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}});if(fe(),'customer'!==le){const e=e=>new Promise(t=>{try{if(!e?.persist||e.persist.hasHydrated())return t();const a=e.persist.onFinishHydration(()=>{a?.(),t()});setTimeout(t,3e3)}catch{t()}}),a='chef'===le&&(0,d.isAnchorage)(t)?[U.useStore,P.useOwner,L.useKitchen,q.useSafety,N.useCardStore,r.useGpCalc,M.useOrderSheets,o.useSpecials,_.useHr]:[U.useStore,P.useOwner,L.useKitchen];if(await Promise.all(a.map(e)),'chef'===le&&(0,d.isAnchorage)(t)&&a.some(e=>!e.persist.hasHydrated()))return void oe({mode:'offline',message:'Saved kitchen data could not be backed up. Nothing was cleared. Free some device storage, then reopen.',lastError:'Legacy kitchen archive not ready'});try{await wa(t)}catch{if(s.LIVE_VENUE_BUILD&&(0,s.isLiveVenue)(t))return void oe({mode:'offline',message:'Device backup failed. Nothing was cleared. Free some storage, then reopen.',lastError:'Legacy kitchen archive failed'})}'live'!==U.useStore.getState().clock.mode&&U.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}})}if(!(0,v.isSupabaseConfigured)())return void oe({mode:'off'});R.mutationQueue.subscribe(()=>{const e=R.mutationQueue.waiting,t=e[0];oe({pending:R.mutationQueue.pending.length,failed:R.mutationQueue.failed.length,waiting:e.length,waitingWhat:t?`${(0,O.describeWrite)(t)}: ${(0,O.plainReason)({...t.lastErr},'retry')}`:void 0})}),R.mutationQueue.onFailed(e=>oe({lastError:`${e.table}: ${e.lastError??'rejected'}`,failed:R.mutationQueue.failed.length,refused:{what:(0,O.describeWrite)(e),why:'conflict'===e.reason?(0,O.plainReason)({code:'conflict'},'refused'):(0,O.plainReason)({...e.lastErr,message:e.lastErr?.message??e.lastError},'refused'),at:e.failedAt}})),me.push((0,b.onConnectivity)(e=>oe({mode:e?re.getState().venueId?'live':re.getState().mode:re.getState().venueId?'offline':re.getState().mode}))),await ia()},Object.defineProperty(_e,"syncInternals",{enumerable:!0,get:function(){return fa}}),_e.goLive=ma,Object.defineProperty(_e,"usePublicDayStore",{enumerable:!0,get:function(){return Ca}}),_e.publicDay=function(e,a){const s=`${e}|${a}`,i=Ea.get(s);if('customer'!==le||!(0,v.isSupabaseConfigured)())return null;(!i||Date.now()-i.at>6e4)&&(i?i.at=Date.now():Ea.set(s,{at:Date.now(),v:{bookings:[],blocks:[]}}),Yt('public_day',{p_venue_slug:(0,t.queuedDatabaseSlug)(e),p_date:a}).then(t=>{const i=[],n=[];(t??[]).forEach((t,s)=>{'booking'===t.kind?i.push({id:`pub-${a}-${s}`,ref:'',restaurantId:e,customerId:null,name:'',date:a,time:ye(t.booking_time),partySize:Number(t.covers)||0,table:(t.table_ids??[]).join('+')||void 0,durationMins:t.duration_mins??void 0,status:'confirmed',allergies:[],createdAt:''}):n.push({id:`pubblk-${a}-${s}`,rid:e,date:a,from:ye(t.from_time),to:ye(t.to_time),areaId:t.area_id??void 0,tables:Array.isArray(t.table_ids)&&t.table_ids.length?t.table_ids.map(String):void 0,by:'',createdAt:''})}),Ea.set(s,{at:Date.now(),v:{bookings:i,blocks:n},ok:!0}),Ca.setState(e=>({n:e.n+1}))}).catch(()=>{const e=Ea.get(s);e&&!e.ok&&Ea.delete(s)}));const n=Ea.get(s);return n?.ok?n.v:null};var e=_r2(_d[0]),t=_r2(_d[1]),a=_r2(_d[2]),s=_r2(_d[3]),i=_r2(_d[4]),n=_r2(_d[5]),r=_r2(_d[6]),o=_r2(_d[7]),d=_r2(_d[8]),u=_r2(_d[9]),l=_r2(_d[10]),c=_r2(_d[11]),f=_r2(_d[12]),p=_r2(_d[13]),m=_r2(_d[14]),g=_r2(_d[15]),_=_r2(_d[16]),S=_r2(_d[17]),h=_r2(_d[18]),y=_r2(_d[19]),w=_r2(_d[20]),v=_r2(_d[21]),b=_r2(_d[22]),k=_r2(_d[23]),I=_r2(_d[24]),O=_r2(_d[25]),R=_r2(_d[26]),A=_r2(_d[27]),U=_r2(_d[28]),D=_r2(_d[29]),E=_r2(_d[30]),C=_r2(_d[31]),T=_r2(_d[32]),N=_r2(_d[33]),M=_r2(_d[34]),K=_r2(_d[35]),x=_r2(_d[36]),L=_r2(_d[37]),q=_r2(_d[38]),P=_r2(_d[39]),$=_r2(_d[40]),j=_r2(_d[41]),B=_r2(_d[42]),F=_r2(_d[43]),W=_r2(_d[44]),V=_r2(_d[45]),H=_r2(_d[46]),G=_r2(_d[47]),Q=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(a){if('default'!==a){var s=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(t,a,s.get?s:{enumerable:!0,get:function(){return e[a]}})}}),t.default=e,t})(G),J=_r2(_d[48]),z=_r2(_d[49]),Z=_r2(_d[50]),X=_r2(_d[51]),Y=_r2(_d[52]),ee=_r2(_d[53]),te=_r2(_d[54]),ae=_r2(_d[55]),se=_r2(_d[56]),ie=_r2(_d[57]);const ne=()=>(0,w.getSupabase)();R.mutationQueue.setExecutor(I.executeMutation);const re=(0,y.create)(()=>({mode:'off',perms:[],pending:0,failed:0})),oe=e=>re.setState(e),de=e=>{const t=re.getState().perms;return t.includes('*')||t.includes(e)},ue=()=>{const e=re.getState().mode;return'live'===e||'offline'===e||'connecting'===e};re.subscribe(()=>(0,ae.setLiveData)(ue()));let le=D.APP_VARIANT,ce=!1;const fe=()=>{ce||((0,k.setSyncNamespace)(le),ce=!0)};let pe=[],me=[],ge=!1;const Se=()=>(new Date).toISOString().slice(0,10),he=e=>new Date(Date.now()-864e5*e).toISOString().slice(0,10),ye=e=>e?e.slice(0,5):'',we=e=>Array.isArray(e)?e.filter(e=>e&&'object'==typeof e&&'string'==typeof e.allergen&&['gluten','crustaceans','molluscs','eggs','fish','peanuts','treenuts','soya','milk','celery','mustard','sesame','sulphites','lupin'].includes(e.allergen)&&(!e.severity||['intolerance','allergy','coeliac','anaphylaxis'].includes(e.severity))):[],ve=e=>JSON.parse(JSON.stringify(e));function be(e,t){const a=he(120);return{name:t?'walk_ins':'bookings',table:t?'walk_ins':'bookings',list:()=>U.useStore.getState().bookings.filter(a=>a.restaurantId===e&&!!a.walkIn===t),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id),writable:()=>'guest'!==re.getState().kind,filter:e=>e.gte(t?'walk_date':'booking_date',a),inWindow:e=>e.date>=a,toRow:(e,a)=>{const s=ve(e);return t?{id:e.id,venue_id:a,walk_date:e.date,arrived_at:e.seatedAt??e.createdAt,covers:Math.max(1,Math.min(200,e.partySize)),table_ids:e.table?e.table.split('+').map(e=>e.trim()).filter(Boolean):[],dog:!!e.dog,allergies:we(e.allergies),note:e.notes??'',status:'finished'===e.status?'left':'cancelled'===e.status||'noshow'===e.status?'undone':'seated',created_at:e.createdAt,doc:s}:{id:e.id,venue_id:a,ref:e.ref,customer_id:(0,$.isUuid)(e.customerId)?e.customerId:null,guest_name:e.name||'Guest',phone:e.phone??null,email:e.email??null,booking_date:e.date,booking_time:e.time,duration_mins:e.durationMins&&e.durationMins>=15&&e.durationMins<=720?e.durationMins:null,covers:Math.max(1,Math.min(200,e.partySize)),table_ids:e.table?e.table.split('+').map(e=>e.trim()).filter(Boolean):[],dog:!!e.dog,allergies:we(e.allergies),allergy_ack_by:e.allergyAck?.by??null,allergy_ack_at:e.allergyAck?.at??null,notes:e.notes??'',tags:e.tags??[],occasion:e.occasion??null,status:e.status,source:e.source??'in-person',security:e.security??'none',deposit_paid:e.depositPaid??0,seated_at:e.seatedAt??null,finished_at:e.finishedAt??null,created_at:e.createdAt,doc:s}},fromRow:a=>{if(!a.doc||'object'!=typeof a.doc)return null;const s={...a.doc,id:String(a.id),restaurantId:e};return!t&&a.status&&'declined'!==a.status&&(s.status=a.status),t&&(s.walkIn=!0),'saved-card'===s.security&&(s.security='none'),s},apply:(e,t)=>U.useStore.setState(a=>{const s=new Set(t),i=new Map(e.map(e=>[e.id,e])),n=a.bookings.filter(e=>!s.has(e.id)).map(e=>i.get(e.id)??e),r=new Set(n.map(e=>e.id));return{bookings:[...n,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>U.useStore.subscribe((t,a)=>{t.bookings!==a.bookings&&e()}),protect:!0}}function ke(e){const t=new Date(Date.now()-18144e5).toISOString();return{name:'orders',table:'takeaway_orders',list:()=>U.useStore.getState().orders.filter(t=>t.restaurantId===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id),writable:()=>'guest'!==re.getState().kind,filter:e=>e.gte('created_at',t),inWindow:e=>e.createdAt>=t,toRow:(e,t)=>({id:e.id,venue_id:t,ref:e.ref,customer_id:(0,$.isUuid)(e.customerId)?e.customerId:null,customer_name:e.customerName||'Guest',phone:e.phone??null,email:e.email??null,items:ve(e.lines??[]),allergies:we(e.allergies),notes:e.notes??null,slot_time:e.slotTime??null,ready_by:e.readyBy??null,subtotal:Math.round(e.subtotal??0),tip:Math.round(e.tip??0),total:Math.round(e.total??0),paid:Math.round(e.paid??0),status:e.status,channel:e.channel??null,confirmed_by:e.accepted?e.accepted.by:null,confirmed_at:e.accepted?e.accepted.at:null,created_at:e.createdAt,allergy_chain:ve(e.allergyChain??{}),readiness:ve(e.readiness??{}),allergy_ticks:ve(e.allergyTicks??{}),handover_check:e.handoverCheck?ve(e.handoverCheck):null,accepted:e.accepted?ve(e.accepted):null,doc:ve(e)}),fromRow:t=>t.doc&&'object'==typeof t.doc?{...t.doc,id:String(t.id),restaurantId:e,status:t.status??t.doc.status}:null,apply:(e,t)=>U.useStore.setState(a=>{const s=new Set(t),i=new Map(e.map(e=>[e.id,e])),n=a.orders.filter(e=>!s.has(e.id)).map(e=>i.get(e.id)??e),r=new Set(n.map(e=>e.id));return{orders:[...e.filter(e=>!r.has(e.id)),...n]}}),subscribe:e=>U.useStore.subscribe((t,a)=>{t.orders!==a.orders&&e()})}}function Ie(e){const t=he(60);return{protect:!0,name:'blocks',table:'blocks',list:()=>[...E.useBlocks.getState().blocks,...E.useBlocks.getState().removed].filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id)&&e.to>e.from,writable:()=>'guest'!==re.getState().kind,filter:e=>e.gte('block_date',t),inWindow:e=>e.date>=t,toRow:(e,t)=>({id:e.id,venue_id:t,block_date:e.date,from_time:e.from,to_time:e.to,reason:e.reason??null,note:e.note??null,area_id:e.areaId??null,area_name:e.areaName??null,created_by:e.by,created_at:e.createdAt,doc:ve(e)}),fromRow:t=>t.doc?{...t.doc,id:String(t.id),rid:e}:{id:String(t.id),rid:e,date:t.block_date,from:ye(t.from_time),to:ye(t.to_time),reason:t.reason??void 0,note:t.note??void 0,by:t.created_by??'',createdAt:t.created_at,areaId:t.area_id??void 0,areaName:t.area_name??void 0},apply:(e,t)=>E.useBlocks.setState(a=>{const s=new Set(t),i=new Map(e.map(e=>[e.id,e])),n=[...a.blocks,...a.removed].filter(e=>!s.has(e.id)).map(e=>i.get(e.id)??e),r=new Set(n.map(e=>e.id)),o=[...n,...e.filter(e=>!r.has(e.id))];return{blocks:o.filter(e=>!e.removedAt),removed:o.filter(e=>!!e.removedAt)}}),subscribe:e=>E.useBlocks.subscribe((t,a)=>{t.blocks===a.blocks&&t.removed===a.removed||e()})}}let Oe=null;function Re(e){const t=e=>ve({areas:e.areas??[],tables:e.tables??[],joins:e.joins??[],sections:e.sections??[],fixtures:e.fixtures??[]});return{name:'table_plan',table:'table_plans',list:()=>[t(C.useFloor.getState().plans[e]??(0,C.planOf)(e))],key:()=>'plan',rowKey:()=>'plan',syncable:()=>!0,writable:()=>de('floor.manage'),filter:e=>e.eq('is_active',!0),deletes:!1,toRow:(e,a)=>({id:Oe??(0,se.uuidFrom)(`plan:${a}`),venue_id:a,name:'Main',is_active:!0,...t(e),updated_by:re.getState().staffRef??le}),fromRow:e=>(Oe=String(e.id),t({areas:e.areas,tables:e.tables,joins:e.joins,sections:e.sections,fixtures:e.fixtures})),apply:t=>{const a=t[0]?(0,ie.withSeedBest)(e,t[0]):void 0;a&&C.useFloor.setState(t=>({plans:{...t.plans,[e]:a}}))},subscribe:e=>C.useFloor.subscribe((t,a)=>{t.plans!==a.plans&&e()})}}function Ae(e){return{protect:!0,name:'stock_items',table:'stock_items',conflict:'venue_id,key',list:()=>T.useShellStore.getState().items[e]??[],key:e=>e.key,rowKey:e=>String(e.key),syncable:()=>!0,writable:()=>de('stock.manage'),matchKey:e=>({key:e}),toRow:(e,t)=>({venue_id:t,key:e.key,name:e.name,plural:e.plural,unit:e.unit,low_at:e.lowAt,supplier_id:e.supplierId?(0,$.isUuid)(e.supplierId)?e.supplierId:(0,se.uuidFrom)(`sup:${t}:${e.supplierId}`):null,icon:e.icon,sort:e.sort,active:e.active}),fromRow:e=>{return{key:e.key,name:e.name,plural:e.plural,unit:e.unit,lowAt:Number(e.low_at),icon:e.icon??'\u2022',sort:e.sort??0,active:!1!==e.active,...e.supplier_id?{supplierId:(t=String(e.supplier_id),Le.get(t)??t)}:{}};var t},apply:(t,a)=>T.useShellStore.setState(s=>{const i=new Set(a),n=new Map(t.map(e=>[e.key,e])),r=(s.items[e]??[]).filter(e=>!i.has(e.key)).map(e=>n.get(e.key)??e),o=new Set(r.map(e=>e.key));return{items:{...s.items,[e]:[...r,...t.filter(e=>!o.has(e.key))]}}}),subscribe:e=>T.useShellStore.subscribe((t,a)=>{t.items!==a.items&&e()})}}const Ue=new Set;function De(e){const t=new Date(Date.now()-2592e5).toISOString();return{name:'stock_events',table:'stock_events',mode:'insert',list:()=>T.useShellStore.getState().events.filter(t=>t.rid===e&&(0,$.isUuid)(t.id)),key:e=>e.id,rowKey:e=>String(e.id),syncable:t=>(0,$.isUuid)(t.id)&&!!(T.useShellStore.getState().items[e]??[]).find(e=>e.key===t.kind),writable:()=>'guest'!==re.getState().kind&&('device'!==re.getState().kind||de('device.write')),filter:e=>e.gte('at',t).order('at',{ascending:!1}),inWindow:e=>e.at>=t,toRow:(e,t)=>({id:e.id,venue_id:t,item:e.kind,delta:e.delta,reason:e.reason,undoes:e.undoes&&(0,$.isUuid)(e.undoes)?e.undoes:null,by_name:e.by||'Team',app:e.app,at:e.at}),fromRow:t=>(Ue.add(String(t.id)),{id:String(t.id),rid:e,kind:t.item,delta:Number(t.delta),reason:t.reason,by:t.by_name??'',app:t.app??'',at:new Date(t.at).toISOString(),...t.undoes?{undoes:String(t.undoes)}:{}}),apply:(e,t)=>T.useShellStore.setState(a=>{const s=new Set(t),i=new Map(e.map(e=>[e.id,e])),n=a.events.filter(e=>!s.has(e.id)).map(e=>i.get(e.id)??e),r=new Set(n.map(e=>e.id));return{events:[...e.filter(e=>!r.has(e.id)),...n].sort((e,t)=>t.at.localeCompare(e.at)).slice(0,500)}}),subscribe:e=>T.useShellStore.subscribe((t,a)=>{t.events!==a.events&&e()})}}function Ee(e){let t={};return{name:'stock_counts',table:'stock_counts',list:()=>Object.entries(T.useShellStore.getState().server[e]?.counts??{}).map(([e,t])=>({item:e,quantity:t})),key:e=>e.item,rowKey:e=>String(e.item),syncable:()=>!1,writable:()=>!1,toRow:()=>({}),fromRow:e=>({item:String(e.item),quantity:Number(e.quantity)}),apply:(a,s)=>{t={...T.useShellStore.getState().server[e]?.counts??{}};for(const e of s)delete t[e];for(const e of a)t[e.item]=e.quantity;T.useShellStore.setState(a=>({server:{...a.server,[e]:{counts:t,seen:[...Ue]}}}))},afterRead:()=>{T.useShellStore.getState().server[e]||T.useShellStore.setState(t=>({server:{...t.server,[e]:{counts:{},seen:[...Ue]}}}))},subscribe:()=>()=>{}}}const Ce=new Set;function Te(e){return{name:'recipe_cards',table:'recipe_cards',list:()=>{const t=U.useStore.getState().menu;return N.useCardStore.getState().cards.filter(t=>t.restaurantId===e).map(e=>({card:e,item:t.find(t=>t.id===e.menuItemId)}))},key:e=>e.card.id,rowKey:e=>String(e.id),syncable:t=>(0,$.isUuid)(t.card.id)&&!((0,d.isAnchorage)(e)&&(0,d.isDemoCard)(t.card)),writable:()=>de('recipes.edit'),toRow:(t,a)=>{let s=t.card;(0,d.isAnchorage)(e)&&(s={...s,signOff:(0,d.demoActor)(s.signOff?.by)?null:s.signOff,allergensConfirmed:(0,d.demoActor)(s.allergensConfirmed?.by)?void 0:s.allergensConfirmed});const i=t.item&&(0,d.isAnchorage)(e)&&(0,d.demoActor)(t.item.signOff?.by)?{...t.item,signOff:null}:t.item;if(s.photo?.startsWith('local:')){const e=(0,se.photoPath)(a,s),t=Ne(s.photo);t&&((0,N.cachePhotoAs)(e,t),Me(e,t)),s={...s,photo:e}}const{row:n,extra:r}=(0,se.cardToRow)(s,a);return{...n,...r,doc:ve({card:s,item:i})}},fromRow:t=>{const a=t.doc;if(!a?.card)return null;const s=t.signed_off_by&&t.signed_off_at?{by:t.signed_off_by,at:new Date(t.signed_off_at).toISOString()}:null;return{card:{...a.card,id:String(t.id),restaurantId:e,signOff:s&&a.card.signOff?a.card.signOff:s,...t.photo_url?{photo:t.photo_url}:{}},item:a.item?{...a.item,restaurantId:e,signOff:(0,d.isAnchorage)(e)&&(0,d.demoActor)(a.item.signOff?.by)?null:a.item.signOff}:void 0}},supersededBy:(e,t)=>t.some(t=>t.card.menuItemId===e.card.menuItemId&&t.card.id!==e.card.id),apply:(e,t)=>{if(!de('recipes.edit')&&t.length){const e=new Set(t);N.useCardStore.setState(t=>({cards:t.cards.map(t=>e.has(t.id)&&t.signOff?{...t,signOff:null}:t)})),t=[]}const a=new Set(t);N.useCardStore.setState(t=>{const s=new Map(e.map(e=>[e.card.id,e.card])),i=new Set(e.map(e=>e.card.menuItemId)),n=t.cards.filter(e=>a.has(e.id)).map(e=>e.menuItemId),r=t.cards.filter(e=>!a.has(e.id)&&(s.has(e.id)||!i.has(e.menuItemId))).map(e=>s.get(e.id)??e),o=new Set(r.map(e=>e.id));return n.length&&U.useStore.setState(e=>({menu:e.menu.map(e=>n.includes(e.id)?{...e,hidden:!0}:e)})),{cards:[...r,...e.filter(e=>!o.has(e.card.id)).map(e=>e.card)],removed:[...t.removed,...n]}});const s=e.map(e=>e.item).filter(Boolean);s.length&&U.useStore.setState(e=>{const t=new Map(s.map(e=>[e.id,e])),a=e.menu.map(e=>t.get(e.id)??e),i=new Set(a.map(e=>e.id));return{menu:[...a,...s.filter(e=>!i.has(e.id))]}})},subscribe:e=>{const t=N.useCardStore.subscribe((t,a)=>{t.cards!==a.cards&&e()}),a=U.useStore.subscribe((t,a)=>{t.menu!==a.menu&&e()});return()=>{t(),a()}}}}const Ne=e=>(0,N.readLocalPhoto)(e);async function Me(e,t){if(!Ce.has(e)){Ce.add(e);try{const a=await(await fetch(t)).blob(),{error:s}=await ne().storage.from(se.RECIPE_PHOTO_BUCKET).upload(e,a,{upsert:!0,contentType:a.type||'image/jpeg'});if(s)throw s}catch(t){Ce.delete(e),oe({lastError:`Photo upload: ${String(t?.message??t)}`})}}}const Ke=new Map,xe=(0,y.create)(()=>({n:0}));(0,N.setStoragePhotoResolver)(e=>{const t=Ke.get(e);return t&&Date.now()-t.at<3e6?t.url:(0,v.isSupabaseConfigured)()&&'off'!==re.getState().mode?(t||(Ke.set(e,{url:'',at:Date.now()}),ne().storage.from(se.RECIPE_PHOTO_BUCKET).createSignedUrl(e,3600).then(({data:t})=>{t?.signedUrl&&(Ke.set(e,{url:t.signedUrl,at:Date.now()}),xe.setState(e=>({n:e.n+1})),N.useCardStore.setState(e=>({cards:[...e.cards]})))}).catch(()=>{})),t?.url||null):null});const Le=new Map;const qe=(e,t)=>{const a=(0,$.isUuid)(t)?t:(0,se.uuidFrom)(`sup:${e}:${t}`);return Le.set(a,t),a};function Pe(e){return{name:'order_sheets',table:'suppliers',list:()=>M.useOrderSheets.getState().sheets[e]??[],key:e=>e.id,rowKey:e=>String(e.doc?.localId??e.id),syncable:t=>!((0,d.isAnchorage)(e)&&'os-veg'===t.id&&t.placeholder),writable:()=>de('suppliers.manage'),toRow:(e,t)=>({id:qe(t,e.id),venue_id:t,name:e.name||'Supplier',category:e.goods||null,contact:e.contact??null,phones:e.number?[e.number]:[],website:e.url||null,cutoff:e.cutoff||null,order_days:e.orderDays,delivery_days:e.deliveryDays,notes:e.notes||null,doc:{kind:'sheet',localId:e.id,sheet:ve(e)}}),fromRow:e=>'sheet'!==e.doc?.kind?null:(Le.set(String(e.id),String(e.doc.localId)),e.doc.sheet),apply:(t,a)=>M.useOrderSheets.setState(s=>{const i=new Set(a),n=new Map(t.map(e=>[e.id,e])),r=(s.sheets[e]??[]).filter(e=>!i.has(e.id)).map(e=>n.get(e.id)??e),o=new Set(r.map(e=>e.id));return{sheets:{...s.sheets,[e]:[...r,...t.filter(e=>!o.has(e.id))]}}}),subscribe:e=>M.useOrderSheets.subscribe((t,a)=>{t.sheets!==a.sheets&&e()}),matchKey:e=>({id:(0,$.isUuid)(e)?e:(0,se.uuidFrom)(`sup:${re.getState().venueId}:${e}`)})}}let $e=!1,je=!1;const Be=new Map,Fe=new Map,We=new Map,Ve=new Map,He=e=>'owner'===e.role?'owner':'manager'===e.role?'Supervisor'===e.level?'supervisor':'manager':'Head Chef'===e.level?'head_chef':'staff',Ge=e=>'owner'===e?{role:'owner',level:'Owner'}:'manager'===e?{role:'manager',level:'Manager'}:'supervisor'===e?{role:'manager',level:'Supervisor'}:'head_chef'===e?{role:'staff',level:'Head Chef'}:{role:'staff',level:'Staff'},Qe=(e,t)=>t&&'owner'!==e.role&&'manager'!==e.role?{role:'manager',level:e.level,managerAccess:!0}:{...e,managerAccess:void 0},Je=e=>ve({id:e.id,name:e.name,role:e.role,job:e.job,active:e.active,level:e.level??Ge(He(e)).level,dept:e.dept??'',nickname:e.nickname,displayClock:e.displayClock,temp:e.temp,tempUntil:e.tempUntil,managerAccess:e.managerAccess||void 0,ownerAccess:e.ownerAccess||void 0,...e.temp&&e.tempUntil&&e.tempUntil(new Date).toLocaleDateString('en-CA',{timeZone:'Europe/London'});const Ze=(e=new Date)=>{const t=new Date(e);return t.setDate(t.getDate()-(t.getDay()+6)%7),t.toISOString().slice(0,10)},Xe=e=>{const t=Math.round(60*e)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`};function Ye(){return{name:'rota',table:'rota_shifts',list:()=>P.useOwner.getState().shifts,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id)&&Be.has(e.staffId),writable:()=>de('rota.manage'),toRow:(e,t)=>({id:e.id,venue_id:t,staff_id:Be.get(e.staffId),staff_ref:e.staffId,shift_date:e.date??(()=>{const t=new Date(Ze());return t.setDate(t.getDate()+(e.day??0)),t.toISOString().slice(0,10)})(),start_time:Xe(e.start),end_time:Xe(e.end),published:!!e.published,doc:ve(e)}),fromRow:e=>{if(!e.doc)return null;const t=e.doc,a=t.date??String(e.shift_date).slice(0,10),[s,i,n]=a.split('-').map(Number);return{...t,id:String(e.id),date:a,day:(new Date(s,i-1,n).getDay()+6)%7,published:!!e.published}},apply:(e,t)=>P.useOwner.setState(a=>{const s=new Set(t),i=new Map(e.map(e=>[e.id,e])),n=a.shifts.filter(e=>!s.has(e.id)).map(e=>i.get(e.id)??e),r=new Set(n.map(e=>e.id));return{shifts:[...n,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>P.useOwner.subscribe((t,a)=>{t.shifts!==a.shifts&&e()})}}function et(){const t=he(62),a=e=>de('rota.manage')||e.staffId===re.getState().staffRef;return{name:'attendance',table:'attendance',list:()=>P.useOwner.getState().attendance,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id)&&a(e),writable:()=>'staff'===re.getState().kind,filter:e=>e.gte('work_date',t),inWindow:e=>e.date>=t,toRow:(t,a)=>({id:t.id,venue_id:a,staff_id:Be.get(t.staffId)??null,staff_ref:t.staffId,work_date:t.date,clock_in:t.in??null,clock_out:t.out??null,breaks:ve(t.breaks??[]),break_mins:t.breakMins??0,doc:ve((0,u.privateAttendance)(e.VENUE_RID,t))}),fromRow:t=>{if(!t.doc)return null;const a=(0,u.privateAttendance)(e.VENUE_RID,{...t.doc,id:String(t.id)});return'confirmed'===t.status?a.signOff={by:String(t.confirmed_by_name??a.signOff?.by??'Manager'),byId:a.signOff?.byId??'',at:t.confirmed_at?new Date(t.confirmed_at).toISOString():a.signOff?.at??''}:delete a.signOff,a},apply:(e,t)=>P.useOwner.setState(a=>{const s=new Set(t),i=new Map(e.map(e=>[e.id,e])),n=a.attendance.filter(e=>!s.has(e.id)).map(e=>i.get(e.id)??e),r=new Set(n.map(e=>e.id));return{attendance:[...n,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>P.useOwner.subscribe((t,a)=>{t.attendance!==a.attendance&&e()})}}function tt(){const e=he(62);return{name:'time_requests',table:'time_requests',mode:'insert',deletes:!1,list:()=>P.useOwner.getState().timeRequests,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id)&&e.staffId===re.getState().staffRef&&'open'===e.status,writable:()=>'staff'===re.getState().kind,filter:t=>t.gte('work_date',e),inWindow:t=>t.date>=e,toRow:(e,t)=>({id:e.id,venue_id:t,staff_id:Be.get(e.staffId)??null,staff_ref:e.staffId,work_date:e.date,attendance_id:e.attendanceId&&(0,$.isUuid)(e.attendanceId)?e.attendanceId:null,kind:e.kind,suggested_in:e.suggestedIn??null,suggested_out:e.suggestedOut??null,note:(e.note??'').slice(0,300)||null,status:'open',doc:ve({...e,status:'open'})}),fromRow:e=>{const t=e.doc??{};return{...t,id:String(e.id),staffId:String(e.staff_ref),date:String(e.work_date).slice(0,10),attendanceId:e.attendance_id?String(e.attendance_id):t.attendanceId,kind:e.kind,suggestedIn:e.suggested_in?new Date(e.suggested_in).toISOString():void 0,suggestedOut:e.suggested_out?new Date(e.suggested_out).toISOString():void 0,note:e.note??'',at:t.at??new Date(e.created_at).toISOString(),status:e.status,resolvedBy:e.resolved_by_name??void 0,resolvedAt:e.resolved_at?new Date(e.resolved_at).toISOString():void 0}},apply:(e,t)=>P.useOwner.setState(a=>{const s=new Set(t),i=new Map(e.map(e=>[e.id,e])),n=a.timeRequests.filter(e=>!s.has(e.id)).map(e=>i.get(e.id)??e),r=new Set(n.map(e=>e.id));return{timeRequests:[...e.filter(e=>!r.has(e.id)),...n]}}),subscribe:e=>P.useOwner.subscribe((t,a)=>{t.timeRequests!==a.timeRequests&&e()})}}function at(t){P.timesheetRemote.send=(a,s)=>{if(!de('rota.manage')||!(0,$.isUuid)(s.id))return!1;if('time_request_resolve'===a){const e=s;return R.mutationQueue.enqueue({table:'time_requests',venueId:t,kind:'rpc',fn:a,rowKey:e.id,values:{p_id:e.id,p_status:e.status,p_doc:ve(e)}}),!0}const i=s;if('attendance_confirm'===a)return R.mutationQueue.enqueue({table:'attendance',venueId:t,kind:'rpc',fn:a,rowKey:i.id,values:{p_id:i.id,p_doc:ve((0,u.privateAttendance)(e.VENUE_RID,i))}}),!0;if(!i.in)return!1;const n=i.adjusted?.reason??'';return R.mutationQueue.enqueue({table:'attendance',venueId:t,kind:'rpc',fn:'attendance_override',rowKey:i.id,values:{p_id:i.id,p_venue:t,p_staff_ref:i.staffId,p_work_date:i.date,p_clock_in:i.in,p_clock_out:i.out??null,p_break_mins:i.breakMins??0,p_breaks:ve(i.breaks??[]),p_reason:n,p_doc:ve((0,u.privateAttendance)(e.VENUE_RID,i))}}),!0},me.push(()=>{P.timesheetRemote.send=null})}function st(e){return{name:'outbox',table:'outbox',mode:'insert',list:()=>U.useStore.getState().outbox.filter(t=>t.restaurantId===e),key:e=>e.id,rowKey:e=>String(e.local_id??e.id),syncable:()=>!0,writable:()=>'staff'===re.getState().kind,filter:e=>e.gte('created_at',new Date(Date.now()-2592e6).toISOString()),inWindow:()=>!1,toRow:(e,t)=>{return{id:(a=e.id,(0,$.isUuid)(a)?a:(0,se.uuidFrom)(`outbox:${a}`)),local_id:e.id,venue_id:t,channel:e.channel,kind:e.kind,to_address:e.to||'',to_name:e.toName||null,subject:e.subject??null,body:e.body,html:e.html??null,ref_type:e.refType,ref_id:(0,$.isUuid)(e.refId)?e.refId:null,ref:e.ref,status:e.status,provider:e.provider,error:e.error??null,created_at:e.at,doc:ve(e)};var a},fromRow:t=>t.doc?{...t.doc,restaurantId:e}:null,apply:e=>U.useStore.setState(t=>{const a=new Set(t.outbox.map(e=>e.id));return{outbox:[...e.filter(e=>!a.has(e.id)),...t.outbox].sort((e,t)=>t.at.localeCompare(e.at)).slice(0,300)}}),subscribe:e=>U.useStore.subscribe((t,a)=>{t.outbox!==a.outbox&&e()})}}const it=e=>U.useStore.getState().events.filter(t=>t.restaurantId===e&&!t.example);function nt(e,t){if(!Array.isArray(t))return;const a=t.filter(e=>e&&'string'==typeof e.id&&'string'==typeof e.date&&'string'==typeof e.title).map(t=>({...t,restaurantId:e,example:!1}));U.useStore.setState(t=>({events:[...t.events.filter(t=>!(t.restaurantId===e&&!t.example)),...a]}))}function rt(e){return{name:'venue',table:'venues',venueColumn:'id',mode:'update',list:()=>{const t=U.useStore.getState(),a=t.restaurants.find(t=>t.id===e);return[ve({restaurant:a,msgTemplates:t.msgTemplates[e]??{},display:C.useFloor.getState().settings[e]??{},games:!1!==a?.settings?.games,events:it(e)})]},key:()=>'venue',rowKey:()=>'venue',syncable:()=>!0,writable:()=>de('venue.settings'),matchKey:()=>({}),toRow:e=>({name:e.restaurant?.name,settings:{...dt??{},whatsapp:e.restaurant?.settings?.whatsapp||null,app:{...dt?.app??{},restaurant:e.restaurant,events:e.events??[]},ops:{...dt?.ops??{},msgTemplates:e.msgTemplates,display:e.display}},feature_flags:{...ot??{},games:e.games,takeaway:!e.restaurant?.settings?.takeawayPaused}}),fromRow:t=>{ot=t.feature_flags??{},dt=t.settings??{};const a=t.settings?.app?.restaurant;if(!a)return null;const s='string'==typeof t.settings?.whatsapp?t.settings.whatsapp:void 0;return s&&!a.settings?.whatsapp&&(a.settings={...a.settings,whatsapp:s}),ve({restaurant:{...a,id:e},msgTemplates:t.settings?.ops?.msgTemplates??{},display:t.settings?.ops?.display??{},games:!1!==t.feature_flags?.games,...Array.isArray(t.settings?.app?.events)?{events:t.settings.app.events}:{}})},apply:t=>{const s=t[0];s&&(U.useStore.setState(t=>({restaurants:t.restaurants.map(t=>t.id===e&&s.restaurant?(0,a.withWildingsAddress)({...s.restaurant,id:e,settings:{...s.restaurant.settings,games:s.games}}):t),msgTemplates:{...t.msgTemplates,[e]:s.msgTemplates??{}}})),s.display&&Object.keys(s.display).length&&C.useFloor.setState(t=>({settings:{...t.settings,[e]:s.display}})),s.events&&nt(e,s.events))},subscribe:e=>{const t=U.useStore.subscribe((t,a)=>{t.restaurants===a.restaurants&&t.msgTemplates===a.msgTemplates&&t.events===a.events||e()}),a=C.useFloor.subscribe((t,a)=>{t.settings!==a.settings&&e()});return()=>{t(),a()}}}}let ot=null,dt=null;const ut=()=>new Date(Date.now()-2592e6).toISOString(),lt=e=>{if(!e.startsWith('dm:'))return['all','kitchen','foh','managers'].includes(e)?e:null;const t=e.split(':').slice(1).map(e=>Be.get(e));return 2===t.length&&t[0]&&t[1]?`dm:${[t[0],t[1]].sort().join(':')}`:null},ct=e=>{if(!e.startsWith('dm:'))return e;const t=e.split(':').slice(1).map(e=>Fe.get(e));return 2===t.length&&t[0]&&t[1]?(0,X.dmId)(t[0],t[1]):null},ft=()=>re.getState().perms.includes('*');function pt(){const e=()=>re.getState().staffRef;return{name:'chat',table:'chat_messages',deletes:!1,list:()=>P.useOwner.getState().chat.filter(e=>(0,$.isUuid)(e.id)).map(e=>ve({id:e.id,ch:e.ch,from:e.from,text:e.text,photo:e.photo,at:e.at,removed:!!e.removed})),key:e=>e.id,rowKey:e=>String(e.id),syncable:t=>!!lt(t.ch)&&(t.from===e()||ft()&&!t.ch.startsWith('dm:')&&t.removed),writable:()=>'staff'===re.getState().kind,filter:e=>e.gte('created_at',ut()).order('created_at',{ascending:!1}),inWindow:e=>e.at>=ut(),toRow:(e,t)=>{const a=lt(e.ch);if(!a)throw new Error('chat: unknown person');const s='system'===e.from?null:Be.get(e.from)??null;return{id:e.id,venue_id:t,channel:a,from_staff:s,body:e.text??null,photo:e.photo??null,removed:e.removed,created_at:e.at}},fromRow:e=>{const t=ct(String(e.channel));if(!t)return null;const a=e.from_staff?Fe.get(String(e.from_staff)):'system';return a?ve({id:String(e.id),ch:t,from:a,text:e.body??void 0,photo:e.photo??void 0,at:new Date(e.created_at).toISOString(),removed:!!e.removed}):null},apply:(t,a)=>P.useOwner.setState(s=>{const i=new Set(a),n=new Map(t.map(e=>[e.id,e])),r=e(),o=s.chat.filter(e=>!i.has(e.id)).map(e=>n.has(e.id)?{...e,...n.get(e.id)}:e),d=new Set(o.map(e=>e.id)),u=t.filter(e=>!d.has(e.id)).map(e=>({...e,reactions:{},seenBy:e.from===r?[e.from]:[]}));return{chat:u.length?[...o,...u].sort((e,t)=>e.at.localeCompare(t.at)):o}}),subscribe:e=>P.useOwner.subscribe((t,a)=>{t.chat!==a.chat&&e()}),onRemote:(t,a)=>{if('upsert'!==a||t.removed)return;const s=t.from_staff?Fe.get(String(t.from_staff)):'system',i=ct(String(t.channel)),n=e();if(!i||!n||s===n||Date.now()-new Date(t.created_at).getTime()>12e4)return;const r=P.useOwner.getState();if((r.chatMuted[n]??[]).includes(i))return;if(!(0,X.inChannel)(i,r.staff.find(e=>e.id===n)))return;if((0,Y.soundAllowed)())try{(0,Y.chime)('soft')}catch{}const o=r.staff.find(e=>e.id===s)?.name?.replace(' (example)','')??'The team',d=i.startsWith('dm:')?'sent you a message':`in ${'all'===i?'Everyone':'foh'===i?'Front of house':'kitchen'===i?'Kitchen':'managers'===i?'Managers':i}`,u=String(t.body??t.text??'').slice(0,120);(0,c.notify)({id:`chat:${t.id}`,icon:'\ud83d\udcac',kicker:'NEW MESSAGE',title:`${o} ${d}`,body:u||void 0,timeoutMs:7e3,testID:'chat-notice'})}}}function mt(e){return{name:'reminders',table:'venue_reminders',list:()=>{const t=S.useReminders.getState(),a=t.reminders.filter(t=>t.rid===e&&(0,$.isUuid)(t.id)).map(e=>{const{rid:t,...a}=e;return{id:e.id,kind:'reminder',doc:ve(a)}}),s=t.rules[e];return s?[...a,{id:s.id,kind:'break_rules',doc:ve(s)}]:a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id),writable:()=>de('venue.settings'),toRow:(e,t)=>({id:e.id,venue_id:t,kind:e.kind,doc:e.doc,updated_at:(new Date).toISOString()}),fromRow:e=>({id:String(e.id),kind:'break_rules'===e.kind?'break_rules':'reminder',doc:e.doc??{}}),apply:(t,a)=>S.useReminders.setState(s=>{const i=new Set(a),n={...s.rules},r=t.filter(e=>'break_rules'===e.kind);for(const t of r)n[e]={...(0,h.clampRules)(t.doc),id:t.id,updatedAt:t.doc.updatedAt};n[e]&&i.has(n[e].id)&&delete n[e];const o=new Map(t.filter(e=>'reminder'===e.kind).map(t=>[t.id,{...t.doc,id:t.id,rid:e}])),d=s.reminders.filter(e=>!i.has(e.id)).map(e=>o.get(e.id)??e),u=new Set(d.map(e=>e.id));return{rules:n,reminders:[...d,...[...o.values()].filter(e=>!u.has(e.id))]}}),subscribe:e=>S.useReminders.subscribe((t,a)=>{t.reminders===a.reminders&&t.rules===a.rules||e()})}}function gt(e){const t=he(14);return{name:'reminder_done',table:'reminder_done',mode:'insert',deletes:!1,list:()=>S.useReminders.getState().done.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id)&&(0,$.isUuid)(e.reminderId)&&e.staffRef===re.getState().staffRef,writable:()=>'staff'===re.getState().kind,filter:e=>e.gte('for_date',t).order('done_at',{ascending:!1}),inWindow:e=>e.forDate>=t,toRow:(e,t)=>({id:e.id,venue_id:t,reminder_id:e.reminderId,for_date:e.forDate,staff_ref:e.staffRef,staff_name:e.staffName.slice(0,80),done_at:e.at}),fromRow:t=>({id:String(t.id),rid:e,reminderId:String(t.reminder_id),forDate:String(t.for_date).slice(0,10),staffRef:t.staff_ref??'',staffName:t.staff_name??'Team',at:new Date(t.done_at).toISOString()}),apply:(e,t)=>S.useReminders.setState(a=>{const s=new Set(t),i=new Map(e.map(e=>[e.id,e])),n=a.done.filter(e=>!s.has(e.id)).map(e=>i.get(e.id)??e),r=new Set(n.map(e=>e.id));return{done:[...e.filter(e=>!r.has(e.id)),...n].sort((e,t)=>t.at.localeCompare(e.at)).slice(0,400)}}),subscribe:e=>S.useReminders.subscribe((t,a)=>{t.done!==a.done&&e()})}}function _t(e,t,a,s=()=>!0){const i=new Set(a),n=new Map(t.map(e=>[e.id,e])),r=e.filter(e=>!s(e)||!i.has(e.id)).map(e=>s(e)&&n.has(e.id)?n.get(e.id):e),o=new Set(r.map(e=>e.id));return[...r,...t.filter(e=>!o.has(e.id))]}const St=e=>null==e||''===e?null:Number(e),ht=e=>e.filter(e=>!e.startsWith('data:'));function yt(e){return{name:'cash_ups',table:'cash_ups',list:()=>B.useCashUp.getState().cashUps.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id)&&!!e.confirmedAt,writable:()=>de('wages.manage')||(0,l.hasCashUpAccess)(),deletes:!1,filter:e=>e.gte('for_date',he(400)),toRow:(e,t)=>({id:e.id,venue_id:t,for_date:e.date,vals:ve(e.vals),cash_tips:'number'==typeof e.vals.cashTips?e.vals.cashTips:null,card_tips:'number'==typeof e.vals.cardTips?e.vals.cardTips:null,photos:ht(e.photos),read_by:e.readBy??null,confirmed_by:e.confirmedBy??null,confirmed_at:e.confirmedAt??null,updated_at:(new Date).toISOString()}),fromRow:t=>({id:String(t.id),rid:e,date:String(t.for_date),vals:t.vals??{},photos:t.photos??[],readBy:t.read_by??null,confirmedBy:t.confirmed_by??void 0,confirmedAt:t.confirmed_at??void 0,onServer:!0,unlockedUntil:t.unlocked_until??void 0,unlockedBy:t.unlocked_by??void 0}),apply:(t,a)=>B.useCashUp.setState(s=>({cashUps:_t(s.cashUps,t.map(e=>{const t=s.cashUps.find(t=>t.id===e.id);return t&&!e.photos.length?{...e,photos:t.photos}:e}),a,t=>t.rid===e)})),subscribe:e=>B.useCashUp.subscribe((t,a)=>{t.cashUps!==a.cashUps&&e()})}}function wt(e){return{name:'sales_reports',table:'sales_reports',list:()=>B.useCashUp.getState().sales.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id)&&!!e.confirmedAt,writable:()=>de('wages.manage')||(0,l.hasCashUpAccess)(),deletes:!1,toRow:(e,t)=>({id:e.id,venue_id:t,week_start:e.weekStart,vals:ve(e.vals),categories:e.categories,photos:ht(e.photos),read_by:e.readBy??null,confirmed_by:e.confirmedBy??null,confirmed_at:e.confirmedAt??null,updated_at:(new Date).toISOString()}),fromRow:t=>({id:String(t.id),rid:e,weekStart:String(t.week_start),vals:t.vals??{},categories:t.categories??[],photos:t.photos??[],readBy:t.read_by??null,confirmedBy:t.confirmed_by??void 0,confirmedAt:t.confirmed_at??void 0,onServer:!0,unlockedUntil:t.unlocked_until??void 0,unlockedBy:t.unlocked_by??void 0}),apply:(t,a)=>B.useCashUp.setState(s=>({sales:_t(s.sales,t.map(e=>{const t=s.sales.find(t=>t.id===e.id);return t&&!e.photos.length?{...e,photos:t.photos}:e}),a,t=>t.rid===e)})),subscribe:e=>B.useCashUp.subscribe((t,a)=>{t.sales!==a.sales&&e()})}}function vt(e){return{name:'cashup_settings',table:'cashup_settings',conflict:'venue_id',list:()=>{const t=B.useCashUp.getState().settings[e];return t?[t]:[]},key:e=>e.id,rowKey:()=>(0,B.cashSettingsId)(e),syncable:e=>!!e.updatedAt,writable:()=>de('wages.manage'),deletes:!1,toRow:(e,t)=>({venue_id:t,doc:ve({cashFields:e.cashFields,salesFields:e.salesFields}),updated_at:(new Date).toISOString()}),fromRow:t=>({...t.doc,id:(0,B.cashSettingsId)(e),updatedAt:t.updated_at??void 0}),apply:t=>B.useCashUp.setState(a=>t[0]?{settings:{...a.settings,[e]:t[0]}}:a),subscribe:e=>B.useCashUp.subscribe((t,a)=>{t.settings!==a.settings&&e()})}}function bt(e){return{name:'day_tips',table:'day_tips',list:()=>B.useCashUp.getState().tips.filter(t=>t.rid===e).map(e=>({...e,id:e.date})),key:e=>e.id,rowKey:e=>String(e.for_date),syncable:()=>!1,writable:()=>!1,deletes:!1,filter:e=>e.gte('for_date',he(120)),toRow:()=>({}),fromRow:t=>({id:String(t.for_date),rid:e,date:String(t.for_date),total:Number(t.total),postedAt:String(t.posted_at),postedBy:t.posted_by??void 0}),apply:t=>B.useCashUp.setState(a=>{const s=new Map(t.map(e=>[e.date,e])),i=a.tips.filter(t=>!(t.rid===e&&s.has(t.date)));return{tips:[...t.map(({id:e,...t})=>t),...i]}}),subscribe:e=>B.useCashUp.subscribe((t,a)=>{t.tips!==a.tips&&e()})}}function kt(e){return{name:'tips_pot_events',table:'tips_pot_events',mode:'insert',deletes:!1,list:()=>B.useCashUp.getState().pot.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id),writable:()=>de('wages.manage'),toRow:(e,t)=>({id:e.id,venue_id:t,kind:e.kind,for_date:e.forDate??null,through_date:e.throughDate??null,amount:e.amount,reason:e.reason??null,by_name:e.by,at:e.at}),fromRow:t=>({id:String(t.id),rid:e,kind:'payout'===t.kind?'payout':'correction',forDate:t.for_date??void 0,throughDate:t.through_date??void 0,amount:St(t.amount)??0,reason:t.reason??void 0,by:String(t.by_name),at:String(t.at)}),apply:(t,a)=>B.useCashUp.setState(s=>({pot:_t(s.pot,t,a,t=>t.rid===e)})),subscribe:e=>B.useCashUp.subscribe((t,a)=>{t.pot!==a.pot&&e()})}}function It(e){return{name:'tips_settings',table:'tips_settings',conflict:'venue_id',deletes:!1,list:()=>{const t=B.useCashUp.getState().show[e];return t?[{id:'show',...t}]:[]},key:e=>e.id,rowKey:()=>'show',syncable:()=>!0,writable:()=>de('wages.manage'),toRow:(e,t)=>({venue_id:t,show_today:e.showToday,show_pot:e.showPot,updated_at:(new Date).toISOString()}),fromRow:e=>({id:'show',showToday:!1!==e.show_today,showPot:!1!==e.show_pot}),apply:t=>B.useCashUp.setState(a=>t[0]?{show:{...a.show,[e]:{showToday:t[0].showToday,showPot:t[0].showPot}}}:a),subscribe:e=>B.useCashUp.subscribe((t,a)=>{t.show!==a.show&&e()})}}function Ot(e){return{name:'scheduled_notifications',table:'scheduled_notifications',list:()=>j.useNotifs.getState().items.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id),writable:()=>de('venue.settings'),deletes:!1,toRow:(e,t)=>{const{rid:a,...s}=e;return{id:e.id,venue_id:t,doc:ve(s),updated_at:(new Date).toISOString()}},fromRow:t=>({...t.doc,id:String(t.id),rid:e}),apply:(t,a)=>j.useNotifs.setState(s=>({items:_t(s.items,t,a,t=>t.rid===e)})),subscribe:e=>j.useNotifs.subscribe((t,a)=>{t.items!==a.items&&e()})}}function Rt(e){return{name:'order_lists',table:'order_lists',list:()=>{const t=F.useOrderLists.getState(),a=t.lists.filter(t=>t.rid===e&&(0,$.isUuid)(t.id)).map(e=>{const{rid:t,...a}=e;return{id:e.id,kind:'list',doc:ve(a)}}),s=t.settings[e];return s?[...a,{id:s.id,kind:'settings',doc:ve(s)}]:a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id),writable:()=>de('venue.settings')||de('suppliers.order'),deletes:!1,toRow:(e,t)=>({id:e.id,venue_id:t,kind:e.kind,doc:e.doc,updated_at:(new Date).toISOString()}),fromRow:e=>({id:String(e.id),kind:'settings'===e.kind?'settings':'list',doc:e.doc??{}}),apply:(t,a)=>F.useOrderLists.setState(s=>{const i={...s.settings};for(const a of t.filter(e=>'settings'===e.kind))i[e]={...W.DEFAULT_ORDER_LIST_SETTINGS,...a.doc,id:a.id};const n=t.filter(e=>'list'===e.kind).map(t=>({...t.doc,id:t.id,rid:e}));return{settings:i,lists:_t(s.lists,n,a,t=>t.rid===e)}}),subscribe:e=>F.useOrderLists.subscribe((t,a)=>{t.lists===a.lists&&t.settings===a.settings||e()})}}function At(e){const t=()=>de('venue.settings')||de('suppliers.order');return{name:'order_list_items',table:'order_list_items',list:()=>F.useOrderLists.getState().items.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:a=>(0,$.isUuid)(a.id)&&(0,$.isUuid)(a.listId)&&(t()||'open'===a.status&&(0,F.orderSettingsOf)(e).allowStaff),writable:()=>'staff'===re.getState().kind,deletes:!0,toRow:(e,a)=>{const{rid:s,...i}=e;return{id:e.id,venue_id:a,list_id:e.listId,status:e.status,added_by_ref:(t()?e.addedBy:re.getState().staffRef)||null,doc:ve(i),updated_at:(new Date).toISOString()}},fromRow:t=>({...t.doc,id:String(t.id),listId:String(t.list_id),status:t.status??'open',rid:e}),apply:(t,a)=>F.useOrderLists.setState(s=>({items:_t(s.items,t,a,t=>t.rid===e)})),subscribe:e=>F.useOrderLists.subscribe((t,a)=>{t.items!==a.items&&e()})}}function Ut(e){const t=he(400);return{name:'order_list_history',table:'order_list_history',mode:'insert',deletes:!1,list:()=>F.useOrderLists.getState().history.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id),writable:()=>de('venue.settings')||de('suppliers.order'),filter:e=>e.gte('finished_at',t).order('finished_at',{ascending:!1}).limit(300),toRow:(e,t)=>{const{rid:a,...s}=e;return{id:e.id,venue_id:t,list_id:e.listId,finished_at:e.finishedAt,finished_by:e.finishedByName.slice(0,80),doc:ve(s)}},fromRow:t=>({...t.doc,id:String(t.id),rid:e}),apply:(t,a)=>F.useOrderLists.setState(s=>({history:_t(s.history,t,a,t=>t.rid===e).sort((e,t)=>t.finishedAt.localeCompare(e.finishedAt)).slice(0,300)})),subscribe:e=>F.useOrderLists.subscribe((t,a)=>{t.history!==a.history&&e()})}}function Dt(e){return{name:'venue_clock_area',table:'venue_clock_area',conflict:'venue_id',deletes:!1,list:()=>{const t=V.useClockArea.getState().areas[e];return t&&t.updatedAt?[{id:'area',doc:ve(t)}]:[]},key:()=>'area',rowKey:()=>'area',syncable:()=>!0,matchKey:()=>({}),writable:()=>de('venue.settings'),toRow:(e,t)=>({venue_id:t,doc:e.doc,updated_at:(new Date).toISOString()}),fromRow:e=>({id:'area',doc:e.doc??{}}),apply:t=>{const a=t[0];a&&V.useClockArea.setState(t=>({areas:{...t.areas,[e]:{...(0,u.venueClockArea)(e,a.doc),updatedAt:a.doc.updatedAt,updatedBy:a.doc.updatedBy}}}))},subscribe:e=>V.useClockArea.subscribe((t,a)=>{t.areas!==a.areas&&e()})}}function Et(e){return{name:'daily_tasks',table:'daily_tasks',deletes:!1,list:()=>{const t=J.useDailyTasks.getState(),a=[],s=t.library[e];s?.updatedAt&&a.push({id:(0,J.libraryRowId)(e),kind:'library',doc:ve({items:s.items,updatedAt:s.updatedAt})});for(const[s,i]of Object.entries(t.people)){const[t,n]=s.split('|');t===e&&i.updatedAt&&a.push({id:(0,J.personRowId)(e,n),kind:'person',staffRef:n,doc:ve({tasks:i.tasks,updatedAt:i.updatedAt})})}return a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>{const t=P.useOwner.getState().staff.find(e=>e.id===re.getState().staffRef);if(!t)return!1;if('staff'!==t.role)return!0;if('person'!==e.kind)return!1;const a=P.useOwner.getState().staff.find(t=>t.id===e.staffRef);return!!a&&(0,z.canEditTasks)(t,a)},writable:()=>'staff'===re.getState().kind,toRow:(e,t)=>({id:e.id,venue_id:t,kind:e.kind,staff_ref:e.staffRef??null,doc:e.doc,updated_at:(new Date).toISOString()}),fromRow:e=>({id:String(e.id),kind:'library'===e.kind?'library':'person',staffRef:e.staff_ref??void 0,doc:e.doc??{}}),apply:t=>J.useDailyTasks.setState(a=>{const s={...a.library},i={...a.people};for(const a of t)'library'===a.kind?s[e]={items:a.doc.items??[],updatedAt:a.doc.updatedAt}:a.staffRef&&(i[(0,J.personKey)(e,a.staffRef)]={tasks:a.doc.tasks??[],updatedAt:a.doc.updatedAt});return{library:s,people:i}}),subscribe:e=>J.useDailyTasks.subscribe((t,a)=>{t.library===a.library&&t.people===a.people||e()})}}function Ct(e){const t=he(7);return{name:'daily_task_ticks',table:'daily_task_ticks',list:()=>J.useDailyTasks.getState().ticks.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>{const t=re.getState();return e.byRef===t.staffRef||de('staff.manage')},writable:()=>'staff'===re.getState().kind,filter:e=>e.gte('for_date',t),inWindow:e=>e.forDate>=t,toRow:(e,t)=>({id:e.id,venue_id:t,staff_ref:e.staffRef,task_id:e.taskId,for_date:e.forDate,ticked_by_ref:e.byRef,ticked_by_name:e.byName.slice(0,80),ticked_at:e.at}),fromRow:t=>({id:String(t.id),rid:e,staffRef:String(t.staff_ref),taskId:String(t.task_id),forDate:String(t.for_date).slice(0,10),byRef:String(t.ticked_by_ref??''),byName:String(t.ticked_by_name??''),at:String(t.ticked_at)}),apply:(t,a)=>J.useDailyTasks.setState(s=>({ticks:_t(s.ticks,t,a,t=>t.rid===e)})),subscribe:e=>J.useDailyTasks.subscribe((t,a)=>{t.ticks!==a.ticks&&e()})}}function Tt(e,t=!1){const a=he(14);return{name:'sold_out_items',table:'sold_out_items',conflict:'venue_id,item_id',list:()=>ee.useSoldOut.getState().entries.filter(t=>t.rid===e),key:e=>e.itemId,rowKey:e=>String(e.item_id),syncable:()=>!0,deletes:!1,writable:()=>'staff'===re.getState().kind,filter:e=>e.gte('marked_at',a),inWindow:e=>e.at.slice(0,10)>=a,toRow:(e,a)=>({id:(0,se.uuidFrom)(`soldout:${a}:${e.itemId}`),venue_id:a,item_id:e.itemId.slice(0,80),name:e.name.slice(0,120),is_on:e.on,marked_at:e.at,by_name:(e.by||'Staff').slice(0,80),clear_after:e.clearAfter??null,...t?{auto:!!e.auto,kept:!!e.kept}:{}}),fromRow:a=>({rid:e,itemId:String(a.item_id),name:String(a.name??''),on:!0===a.is_on,at:String(a.marked_at),by:String(a.by_name??''),clearAfter:a.clear_after?String(a.clear_after):void 0,...t?{auto:!0===a.auto,kept:!0===a.kept}:{}}),apply:(t,a)=>ee.useSoldOut.setState(s=>{const i=new Set(a);return{entries:[...s.entries.filter(a=>!(a.rid===e&&(i.has(a.itemId)||t.some(e=>{return s=a,(t=e).rid===s.rid&&t.itemId===s.itemId;var t,s})))),...t]}}),subscribe:e=>ee.useSoldOut.subscribe((t,a)=>{t.entries!==a.entries&&e()}),afterRead:()=>{te.autoSync.soldOutRead.add(e)}}}function Nt(e){return{name:'sold_out_links',table:'sold_out_links',conflict:'venue_id,item_id',list:()=>te.useSoldOutLinks.getState().links.filter(t=>t.rid===e),key:e=>e.itemId,rowKey:e=>String(e.item_id),syncable:()=>!0,deletes:!1,writable:()=>'staff'===re.getState().kind,toRow:(e,t)=>({id:(0,se.uuidFrom)(`soldoutlink:${t}:${e.itemId}`),venue_id:t,item_id:e.itemId.slice(0,80),uses:e.uses.slice(0,10).map(e=>({key:String(e.key).slice(0,40),qty:Math.max(0,Math.min(99,Number(e.qty)||0))})),auto:!!e.auto,updated_at:e.at,updated_by:(e.by||'Staff').slice(0,80)}),fromRow:t=>({rid:e,itemId:String(t.item_id),uses:(Array.isArray(t.uses)?t.uses:[]).map(e=>({key:String(e.key??''),qty:Number(e.qty)||0})).filter(e=>e.key&&e.qty>0),at:String(t.updated_at??''),by:String(t.updated_by??''),...!0===t.auto?{auto:!0}:{}}),apply:(t,a)=>te.useSoldOutLinks.setState(s=>{const i=new Set(a);return{links:[...s.links.filter(a=>!(a.rid===e&&(i.has(a.itemId)||t.some(e=>e.itemId===a.itemId)))),...t]}}),subscribe:e=>te.useSoldOutLinks.subscribe((t,a)=>{t.links!==a.links&&e()}),afterRead:()=>{te.autoSync.linksRead.add(e)}}}async function Mt(e,t="*"){const a='*'===t?`table:${e}`:`table:${e}.${t}`;try{const s=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:i}=await Promise.race([ne().from(e).select(t,{head:!0,count:'exact'}).limit(1),s]);return i?!!/fetch|network|Failed/i.test(i.message)&&k.kv.get(a,!1):(k.kv.set(a,!0),!0)}catch{return k.kv.get(a,!1)}}async function Kt(){const e=re.getState().venueId;if(e)try{const{data:t}=await ne().from('push_settings').select('push_live').eq('venue_id',e).maybeSingle();qt.setState({live:!!t?.push_live,known:!0})}catch{}}const xt='order-list-logos';const Lt=new Map;const qt=(0,y.create)(()=>({live:!1,known:!1}));async function Pt(){try{const e=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:t}=await Promise.race([ne().from('venue_reminders').select('id').limit(1),e]);return t?!!/fetch|network|Failed/i.test(t.message)&&k.kv.get('reminders:ok',!1):(k.kv.set('reminders:ok',!0),!0)}catch{return k.kv.get('reminders:ok',!1)}}async function $t(){try{const e=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:t}=await Promise.race([ne().from('chat_messages').select('id').limit(1),e]);return t?!!/fetch|network|Failed/i.test(t.message)&&k.kv.get('chat:ok',!1):(k.kv.set('chat:ok',!0),!0)}catch{return k.kv.get('chat:ok',!1)}}const jt=(e,t)=>ve({id:String(e.id),venue:t,body:String(e.body??''),kind:'yesno'===e.kind?'yesno':'up',up:Number(e.up_count??0),yes:Number(e.yes_count??0),no:Number(e.no_count??0),hidden:!!e.hidden,reply:e.reply??void 0,replyAt:e.reply_at??void 0,postedOn:String(e.posted_on??'').slice(0,10)}),Bt='id,body,kind,up_count,yes_count,no_count,hidden,reply,reply_at,posted_on';function Ft(e){return{name:'hr_questions',table:'hr_questions',deletes:!1,list:()=>_.useHr.getState().questions.filter(t=>t.venue===e&&(0,$.isUuid)(t.id)),key:e=>e.id,rowKey:e=>String(e.id),syncable:()=>!1,writable:()=>!1,toRow:e=>({id:e.id}),fromRow:t=>jt(t,e),filter:e=>e.gte('posted_on',new Date(Date.now()-10368e6).toISOString().slice(0,10)),apply:(e,t)=>{const a=new Set(t);_.useHr.setState(t=>{const s=new Map(e.map(e=>[e.id,e])),i=t.questions.filter(e=>!a.has(e.id)).map(e=>s.get(e.id)??e),n=new Set(i.map(e=>e.id));return{questions:[...i,...e.filter(e=>!n.has(e.id))]}})},subscribe:e=>_.useHr.subscribe((t,a)=>{t.questions!==a.questions&&e()})}}function Wt(e,t){const a=(t,a,s)=>{R.mutationQueue.enqueue({table:'hr_questions',venueId:e,kind:'rpc',fn:t,rowKey:a,values:s})};Object.assign(_.hrRemote,{live:!0,checkout:t=>a('hr_checkout',t.token,{p_venue:e,p_day:t.day,p_token:t.token,p_morale:t.morale,p_staffing:t.staffing,p_question:t.question??null,p_kind:t.kind??'up',p_shout_to:t.shoutTo??null,p_shout_body:t.shoutBody??null}),post:(t,s,i,n)=>a('hr_post_question',s,{p_venue:e,p_id:s,p_body:i,p_kind:n}),vote:(e,t,s)=>a('hr_vote',e,{p_question:e,p_token:t,p_vote:s}),moderate:(e,t,s)=>a('hr_moderate',e,{p_question:e,p_action:t,p_reason:s}),reply:(e,t)=>a('hr_reply',e,{p_question:e,p_reply:t}),trend:async(t,a,s)=>{try{const{data:t,error:i}=await ne().rpc('hr_trend',{p_venue:e,p_from:a,p_to:s});return i?null:(t??[]).map(e=>({day:String(e.day).slice(0,10),answers:Number(e.answers),morale:Number(e.morale),staffing:null==e.staffing?null:Number(e.staffing),short:Number(e.short),perfect:Number(e.perfect),over:Number(e.over)}))}catch{return null}},shouts:async(a,s)=>{try{const{data:a,error:i}=await ne().from('hr_shoutouts').select('id,day,to_name,body').eq('venue_id',e).gte('day',s).order('day',{ascending:!1}).limit(20);return i?null:(a??[]).map(e=>({id:String(e.id),venue:t,day:String(e.day).slice(0,10),to:String(e.to_name),body:e.body??void 0}))}catch{return null}},log:async()=>{try{const{data:a,error:s}=await ne().from('hr_mod_log').select('id,question_id,action,reason,by_name,at').eq('venue_id',e).order('at',{ascending:!1}).limit(30);return s?null:(a??[]).map(e=>({id:String(e.id),venue:t,questionId:String(e.question_id??''),action:e.action,reason:e.reason??void 0,by:String(e.by_name??'A manager'),at:String(e.at)}))}catch{return null}},refresh:async()=>{try{const{data:a,error:s}=await ne().from('hr_questions').select(Bt).eq('venue_id',e).order('posted_on',{ascending:!1}).limit(200);s||_.useHr.getState().setRemoteBoard(t,(a??[]).map(e=>jt(e,t)))}catch{}}}),me.push(()=>{Object.assign(_.hrRemote,{live:!1,checkout:null,post:null,vote:null,moderate:null,reply:null,trend:null,shouts:null,log:null,refresh:null})})}const Vt='pair:v1',Ht='staff:v1',Gt='staff:rejoin:v1';async function Qt(){if('display'===le||'customer'===le||H.PITCH)return'none';const t=await k.kv.get(Gt,null);if(!t)return'none';try{await zt();const{data:a,error:s}=await ne().rpc(e.IS_QUEUED_VENUE?'claim_'+e.VENUE_RID+'_invite':e.IS_GREENSIDE?'claim_greenside_invite':e.IS_ABBOTSFORD?'claim_abbotsford_invite':e.IS_KIRKTON?'claim_kirkton_invite':e.IS_WILDINGS?'claim_wildings_invite':e.IS_KIRKMICHAEL?'claim_kirkmichael_invite':e.IS_ISOLATED_VENUE?'claim_souters_invite':'claim_invite',{p_token:t,p_app:le,p_device:(0,g.deviceId)()});if(s)return(0,p.inviteRefusal)(s.message)?(await k.kv.remove(Gt),await k.kv.remove(Ht),'refused'):'offline';const i=a?.[0];return i?(await k.kv.set(Ht,{kind:'staff',venueId:i.venue_id,venueSlug:i.venue_slug,venueName:i.venue_name,staffRef:i.external_ref,staffUuid:i.staff_id,role:i.role_key,displayName:i.display_name}),'ok'):(await k.kv.remove(Gt),'refused')}catch{return'offline'}}const Jt=e=>/jwt|refresh|token|401|not authenticated|invalid claim|session/i.test(String(e?.message??e))&&!/fetch|network/i.test(String(e?.message??e));async function zt(){fe();const{data:e}=await ne().auth.getSession();if(!e.session)for(let e=0;;e++){const{error:t}=await ne().auth.signInAnonymously();if(!t)return;const a=429===t.status||/rate|too many/i.test(t.message);if(!a||e>=2){if(a)throw new Error('Too many people are connecting from this network right now. Wait a few minutes, or switch to mobile data, and open the link again.');throw t}oe({message:'Lots of people are connecting at once. Trying again in a moment\u2026'}),await new Promise(t=>setTimeout(t,0===e?15e3:45e3))}}async function Zt(t){if(H.PITCH)return{status:'refused',message:'This link has been replaced or switched off. Ask your manager for a new one.'};if(!(0,v.isSupabaseConfigured)())return{status:'off'};try{await zt();const{data:a,error:s}=await ne().rpc(e.IS_QUEUED_VENUE?'claim_'+e.VENUE_RID+'_invite':e.IS_GREENSIDE?'claim_greenside_invite':e.IS_ABBOTSFORD?'claim_abbotsford_invite':e.IS_KIRKTON?'claim_kirkton_invite':e.IS_WILDINGS?'claim_wildings_invite':e.IS_KIRKMICHAEL?'claim_kirkmichael_invite':e.IS_ISOLATED_VENUE?'claim_souters_invite':'claim_invite',{p_token:t,p_app:le,p_device:(0,g.deviceId)()});if(s){const t=(0,p.inviteRefusal)(s.message);if(t){try{localStorage.removeItem((0,e.venueKey)(`cc-pending-invite:${le}`))}catch{}return{status:'refused',message:t}}throw s}const i=a?.[0];if(!i)return{status:'refused',message:'This link has been replaced or switched off. Ask your manager for a new one.'};const n={kind:'staff',venueId:i.venue_id,venueSlug:i.venue_slug,venueName:i.venue_name,staffRef:i.external_ref,staffUuid:i.staff_id,role:i.role_key,displayName:i.display_name};return await k.kv.set(Ht,n),await k.kv.set(Gt,t),ge&&aa(),{status:'ok',id:n}}catch(e){const t=String(e?.message??e);return oe({lastError:`Sign-in: ${t}`}),{status:'offline',message:t}}}async function Xt(){if(!(0,v.isSupabaseConfigured)())return!1;try{return await zt(),!0}catch{return!1}}const Yt=async(e,t={})=>{if(H.PITCH)return(0,G.pitchRpc)(e,t);const{data:a,error:s}=await ne().rpc(e,t);if(s)throw s;return a};let ea=null;async function ta(){for(const e of me)try{e()}catch{}me=[],pe.forEach(e=>e.stop()),pe=[],ea&&(clearInterval(ea),ea=null)}async function aa(){await ta(),await ia()}let sa=e.VENUE_RID;async function ia(){try{const e='undefined'!=typeof navigator?navigator.storage:null;e?.persist&&e.persist()}catch{}try{const e='undefined'!=typeof window?window.CoverChargeNative:null;e&&'function'==typeof e.checkUpdate&&/CoverChargePhone\//.test(navigator.userAgent)&&e.checkUpdate()}catch{}const t=sa;try{if(oe({mode:'connecting'}),await R.mutationQueue.load(),'customer'===le)return void await da(t);const a=await k.kv.get(Vt,null);let s=await k.kv.get(Ht,null);if(e.IS_ISOLATED_VENUE&&(a&&!(0,e.venueIdentityAllowed)(a.venueId,a.venueSlug)||s&&!(0,e.venueIdentityAllowed)(s.venueId,s.venueSlug)))return void oe({mode:'display'===le?'unpaired':'signin',perms:[],message:'This sign-in belongs to a different venue.'});let{data:i}=await ne().auth.getSession();if('display'!==le&&s&&!i.session){const e=await Qt();if('offline'===e)return oe({venueId:s.venueId,venueSlug:s.venueSlug,venueName:s.venueName,kind:s.kind,role:s.role,staffRef:s.staffRef,staffUuid:s.staffUuid,mode:'offline'}),void setTimeout(()=>{sa===t&&aa()},6e4);'refused'===e&&s.staffRef&&g.useSession.getState().meId===s.staffRef&&g.useSession.getState().signOut(),s=await k.kv.get(Ht,null),({data:i}=await ne().auth.getSession())}const n='display'===le?a:s;if(!i.session||!n)return void oe({mode:'display'===le?'unpaired':'signin',perms:[]});let r=[];try{const e=(await Yt('whoami')??[]).filter(e=>e.venue_id===n.venueId);if(!e.length)return'display'===le?await k.kv.remove(Vt):(await k.kv.remove(Ht),await k.kv.remove(Gt)),'staff'===n.kind&&n.staffRef&&g.useSession.getState().meId===n.staffRef&&g.useSession.getState().signOut(),void oe({mode:'display'===le?'unpaired':'signin',perms:[],message:'display'===le?'This display was unpaired by a manager.':'Open your invite link again to connect.'});r=[...new Set(e.flatMap(e=>e.permissions??[]))],'device'===n.kind&&n.canWrite&&r.push('device.write')}catch(e){if(!(0,b.isOnline)()||/fetch|network/i.test(String(e?.message)))oe({mode:'offline'});else if(Jt(e)&&'display'!==le){const{error:e}=await ne().auth.refreshSession();e&&'ok'===await Qt()&&setTimeout(()=>{sa===t&&aa()},500)}r=re.getState().perms}oe({venueId:n.venueId,venueSlug:n.venueSlug,venueName:n.venueName,kind:n.kind,role:n.role,staffRef:n.staffRef,staffUuid:n.staffUuid,perms:r}),'staff'===n.kind&&n.staffRef&&g.useSession.getState().meId!==n.staffRef&&(g.useSession.getState().signIn(n.staffRef),P.useOwner.setState({staffAs:n.staffRef})),await ra(n.venueId,t,n.kind)}catch(e){oe({mode:'local',lastError:String(e?.message??e)})}}const na=new Set(['venues','staff','bookings','walk_ins','blocks','table_plans','takeaway_orders','stock_items','stock_events','stock_counts','recipe_cards','suppliers','supplier_orders','rota_shifts','attendance','time_requests','game_scores','floor_live','chat_messages','venue_reminders','reminder_done']);async function ra(t,a,s){if(!(0,e.venueIdentityAllowed)(t,a))throw new Error('Different venue: sync refused.');await ma(a),me.push(Da(t));try{const{data:e}=await ne().from('roles').select('id,key').eq('venue_id',t);for(const t of e??[])We.set(t.key,t.id),Ve.set(t.id,t.key)}catch{}const i=[rt(a),{protect:!0,name:'staff',table:'staff',conflict:'venue_id,external_ref',list:()=>P.useOwner.getState().staff.map(Je),key:e=>e.id,rowKey:e=>String(e.external_ref??e.id),syncable:e=>!e.name.includes('(example)'),writable:()=>de('staff.manage'),deletes:!1,toRow:(e,t)=>({venue_id:t,external_ref:e.id,display_name:e.name,...$e?{nickname:e.nickname?.trim()||null}:{},job_title:e.job||null,department:e.dept||null,active:e.active,...je?{display_clock:!!e.displayClock,temp:!!e.temp,temp_until:e.tempUntil||null}:{},...e.managerAccess||e.ownerAccess||!We.get(He(e))?{}:{role_id:We.get(He(e))}}),fromRow:e=>e.external_ref?(Be.set(String(e.external_ref),String(e.id)),Fe.set(String(e.id),String(e.external_ref)),Oa.set(String(e.external_ref),e.avatar_path??null),ve({id:String(e.external_ref),name:e.display_name,...$e&&'nickname'in e?{nickname:e.nickname??void 0}:{},job:e.job_title??'',active:!1!==e.active,dept:e.department??'',...je&&'display_clock'in e?{displayClock:!!e.display_clock,temp:!!e.temp||void 0,tempUntil:e.temp_until??void 0}:{},...Qe(Ge(Ve.get(String(e.role_id))),!0===e.manager_access),...!0===e.owner_access&&'owner'!==Ge(Ve.get(String(e.role_id))).role?{role:'owner',ownerAccess:!0}:{}})):null,apply:e=>P.useOwner.setState(t=>{const a=new Map(e.map(e=>[e.id,e])),s=t.staff.map(e=>a.has(e.id)?{...e,...a.get(e.id)}:e),i=new Set(s.map(e=>e.id));return{staff:[...s,...e.filter(e=>!i.has(e.id)).map(e=>({...e}))]}}),subscribe:e=>P.useOwner.subscribe((t,a)=>{t.staff!==a.staff&&e()}),afterRead:()=>{Ua()},onRemote:()=>{Ua()}},{name:'pay',table:'staff_private',conflict:'staff_id',list:()=>{const e=P.useOwner.getState(),t=x.useSetup.getState().sites[sa]?.staffGrade??{};return e.staff.filter(e=>Be.has(e.id)).map(a=>ve({id:a.id,hourly:e.hourly[a.id]??null,salaried:!!a.salaried,noTax:!!a.noTax,grade:t[a.id]||void 0}))},key:e=>e.id,rowKey:e=>Fe.get(String(e.staff_id))??String(e.staff_id),syncable:e=>Be.has(e.id),writable:()=>de('wages.manage'),deletes:!1,toRow:(e,t)=>({staff_id:Be.get(e.id),venue_id:t,hourly_rate:null==e.hourly?null:e.hourly/100,salaried:e.salaried,no_tax:e.noTax,pay_grade:e.grade??null}),fromRow:e=>{const t=Fe.get(String(e.staff_id));return t?ve({id:t,hourly:null==e.hourly_rate?null:Math.round(100*Number(e.hourly_rate)),salaried:!!e.salaried,noTax:!!e.no_tax,grade:e.pay_grade||void 0}):null},apply:e=>P.useOwner.setState(t=>{const a={...t.hourly},s=new Map(e.map(e=>[e.id,e]));for(const t of e)null==t.hourly?delete a[t.id]:a[t.id]=t.hourly;if(e.length){const t=x.useSetup.getState().sites[sa],a={...t?.staffGrade??{}};let s=!1;for(const t of e)(a[t.id]||void 0)!==t.grade&&(s=!0,t.grade?a[t.id]=t.grade:delete a[t.id]);s&&x.useSetup.getState().patch(sa,{staffGrade:a})}return{hourly:a,staff:t.staff.map(e=>s.has(e.id)?{...e,salaried:s.get(e.id).salaried,noTax:s.get(e.id).noTax}:e)}}),subscribe:e=>{const t=P.useOwner.subscribe((t,a)=>{t.hourly===a.hourly&&t.staff===a.staff||e()}),a=x.useSetup.subscribe((t,a)=>{t.sites[sa]?.staffGrade!==a.sites[sa]?.staffGrade&&e()});return()=>{t(),a()}}},be(a,!1),be(a,!0),Ie(a),Re(a),ke(a),Ae(a),De(a),Ee(a),Pe(a),{name:'supplier_directory',table:'suppliers',list:()=>P.useOwner.getState().suppliers,key:e=>e.id,rowKey:e=>String(e.doc?.localId??e.id),syncable:e=>(0,$.isUuid)(e.id),writable:()=>de('suppliers.manage'),toRow:(e,t)=>({id:e.id,venue_id:t,name:e.name||'Supplier',category:e.category,contact:e.contact||null,phones:e.phones.filter(Boolean),email:e.email||null,website:e.website||null,account_ref:e.account||null,cutoff:e.cutoff||null,order_days:e.orderDays,delivery_days:e.deliveryDays,doc:{kind:'directory',localId:e.id,supplier:ve(e)}}),fromRow:e=>'directory'===e.doc?.kind?e.doc.supplier:null,apply:(e,t)=>P.useOwner.setState(a=>{const s=new Set(t),i=new Map(e.map(e=>[e.id,e])),n=a.suppliers.filter(e=>!s.has(e.id)).map(e=>i.get(e.id)??e),r=new Set(n.map(e=>e.id));return{suppliers:[...n,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>P.useOwner.subscribe((t,a)=>{t.suppliers!==a.suppliers&&e()})},{name:'supplier_orders',table:'supplier_orders',list:()=>P.useOwner.getState().supplierOrders,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id)&&(0,$.isUuid)(e.supplierId),writable:()=>de('suppliers.order')||de('suppliers.manage'),toRow:(e,t)=>({id:e.id,venue_id:t,supplier_id:e.supplierId,order_date:e.date||Se(),items:[{text:e.items}],amount:Math.round(e.amount||0),status:'sent',by_name:e.by,doc:ve(e)}),fromRow:e=>e.doc?{...e.doc,id:String(e.id)}:null,apply:(e,t)=>P.useOwner.setState(a=>{const s=new Set(t),i=new Map(e.map(e=>[e.id,e])),n=a.supplierOrders.filter(e=>!s.has(e.id)).map(e=>i.get(e.id)??e),r=new Set(n.map(e=>e.id));return{supplierOrders:[...e.filter(e=>!r.has(e.id)),...n]}}),subscribe:e=>P.useOwner.subscribe((t,a)=>{t.supplierOrders!==a.supplierOrders&&e()})},Te(a),ba(a)];de('wages.view')&&i.push(ka(a)),'staff'===s&&(i.push(Ye(),et(),tt(),st(a)),at(t));const n='staff'===s&&await $t();if(Z.useChatSync.setState({synced:n,checked:!0}),me.push(()=>Z.useChatSync.setState({synced:!1})),n&&i.push(pt(),{name:'chat_extra',table:'chat_channel_extra',conflict:'venue_id,channel,staff_id',list:()=>Object.entries(X.useKitchenExtra.getState().extra).map(([e,t])=>({id:e,include:t})),key:e=>e.id,rowKey:e=>Fe.get(String(e.staff_id))??String(e.staff_id),syncable:e=>Be.has(e.id),writable:()=>de('staff.manage'),filter:e=>e.eq('channel','kitchen'),matchKey:e=>({channel:'kitchen',staff_id:Be.get(e)??e}),toRow:(e,t)=>({venue_id:t,channel:'kitchen',staff_id:Be.get(e.id),include:e.include}),fromRow:e=>{const t=Fe.get(String(e.staff_id));return t?{id:t,include:!!e.include}:null},apply:(e,t)=>X.useKitchenExtra.setState(a=>{const s={...a.extra};return t.forEach(e=>{delete s[e]}),e.forEach(e=>{s[e.id]=e.include}),{extra:s}}),subscribe:e=>X.useKitchenExtra.subscribe((t,a)=>{t.extra!==a.extra&&e()})}),'staff'===s&&await Mt('hr_questions')&&(i.push(Ft(a)),na.add('hr_questions'),Wt(t,a)),'guest'!==s&&await Mt('sold_out_items')?(i.push(Tt(a,await Mt('sold_out_items','auto'))),na.add('sold_out_items')):te.autoSync.soldOutRead.add(a),'guest'!==s&&await Mt('sold_out_links')?(i.push(Nt(a)),na.add('sold_out_links')):te.autoSync.linksRead.add(a),S.useReminders.getState().ensure(a),'guest'!==s&&await Pt()&&(i.push(mt(a)),'staff'===s&&i.push(gt(a))),j.useNotifs.getState().ensure(a),F.useOrderLists.getState().ensure(a),'staff'===s){$e=await Mt('staff','nickname'),je=await Mt('staff','display_clock');const[e,t,s,n]=await Promise.all([Mt('scheduled_notifications'),Mt('order_lists'),Mt('venue_clock_area'),Mt('daily_tasks')]);J.useDailyTasks.getState().ensure(a),n&&(i.push(Et(a),Ct(a)),na.add('daily_tasks'),na.add('daily_task_ticks')),e&&(i.push(Ot(a)),Kt()),t&&i.push(Rt(a),At(a),Ut(a)),s&&i.push(Dt(a));for(const[a,i]of[[e,'scheduled_notifications'],[t,'order_lists'],[t,'order_list_items'],[t,'order_list_history'],[s,'venue_clock_area']])a&&na.add(i)}if('guest'!==s&&await Mt('day_tips')){i.push(bt(a));for(const e of['day_tips','tips_pot_events','tips_settings'])na.add(e);await Mt('tips_pot_events')&&i.push(kt(a),It(a)),'staff'===s&&(i.push(yt(a),wt(a),vt(a)),na.add('cash_ups'),na.add('sales_reports'),_r2(_d[59])(_d[58],_d.paths).then(e=>e.refreshCashAccess()))}'device'===s&&(i.push(Ye(),et()),await Mt('scheduled_notifications')&&i.push(Ot(a)));let r=!1;const o={onActivity:()=>oe({lastSyncAt:(new Date).toISOString()}),onError:(e,t)=>oe({lastError:`${e}: ${t}`}),onSuspect:(e,s)=>{oe({lastError:`${e}: held back, ${s}`}),r||(r=!0,(async()=>{try{if(!(await Yt('whoami')??[]).some(e=>e.venue_id===t))return void(sa===a&&aa());for(const a of pe){if(a.spec.name!==e)continue;const{count:s,error:i}=await ne().from(a.spec.table).select('*',{count:'exact',head:!0}).eq(a.spec.venueColumn??'venue_id',t);!i&&(s??0)>0&&a.allowMassRemoveOnce()}}catch{}finally{r=!1}})())}};pe=i.map(e=>new A.EntityBridge(e,t,o)),await Promise.all(pe.map(e=>e.start()));const d=async()=>{if('staff'===s&&(0,b.isOnline)())try{const e=await Yt('whoami');if(!e?.some(e=>e.venue_id===t))return void(sa===a&&aa())}catch(e){if(Jt(e)){const e=await Qt();return void('ok'!==e&&'refused'!==e||sa===a&&aa())}}let e=0;for(const[t,a]of pe.entries()){const s='chat'===i[t]?.name;try{await a.read(),e++,s&&Z.useChatSync.getState().error&&Z.useChatSync.setState({error:void 0})}catch(e){const t=String(e?.message??e);if((s||/fetch|network|Failed/i.test(t))&&Z.useChatSync.setState({error:t||'unknown error'}),/fetch|network|Failed/i.test(t))break}}if(e?(oe({mode:(0,b.isOnline)()?'live':'offline',lastSyncAt:(new Date).toISOString()}),R.mutationQueue.flush()):oe({mode:'offline'}),!de('wages.view')){const e=re.getState().staffRef;P.useOwner.setState(t=>({hourly:e&&null!=t.hourly[e]?{[e]:t.hourly[e]}:{}}))}};await d();const u=new Map;for(const e of pe)u.set(e.spec.table,[...u.get(e.spec.table)??[],e]);const l=[...u.keys()].filter(e=>na.has(e)).map(e=>({table:e,venueColumn:u.get(e)[0].spec.venueColumn}));let c=!1;const f=(0,A.venueChannel)(t,l,(e,t,a)=>{for(const s of u.get(e)??[])s.remote(t,a);oe({lastSyncAt:(new Date).toISOString()})},e=>{oe({realtime:e}),'SUBSCRIBED'===e?(c&&d(),c=!1):'CHANNEL_ERROR'!==e&&'TIMED_OUT'!==e&&'CLOSED'!==e||(c=!0)});me.push(()=>{ne().removeChannel(f)}),ea=setInterval(()=>{d()},6e4),me.push((0,b.onConnectivity)(e=>{e&&d()}))}'undefined'!=typeof window&&(window.__ccSync=()=>({...re.getState(),queue:R.mutationQueue.pending.map(e=>e.table),failedTables:R.mutationQueue.failed.map(e=>`${e.table}: ${e.lastError??''}`.slice(0,200))}));const oa='guest:sent:v1';async function da(s){oe({kind:'guest',venueSlug:s,perms:[]});try{const i=(await Yt('public_venue',{p_venue_slug:(0,t.queuedDatabaseSlug)(s)}))?.[0];if(i&&(!e.IS_ISOLATED_VENUE||i.id===e.VENUE_UUID)){oe({venueId:i.id,venueName:i.name}),await ma(s);const e=i.app?.restaurant;e&&U.useStore.setState(t=>({restaurants:t.restaurants.map(t=>t.id===s?(0,a.withWildingsAddress)({...e,id:s}):t)})),nt(s,i.app?.events)}await ua(s),oe({mode:'live',lastSyncAt:(new Date).toISOString()})}catch{oe({mode:(0,b.isOnline)()?'local':'offline'})}const i=setInterval(()=>{ua(s).catch(()=>{})},6e4);me.push(()=>clearInterval(i)),e.IS_ISOLATED_VENUE||await la(s)}async function ua(e){const a=await Yt('public_menu',{p_venue_slug:(0,t.queuedDatabaseSlug)(e)})??[];if(a.length){const t=new Map(a.map(e=>[String(e.menu_item_id??e.doc?.item?.id??''),e]));N.useCardStore.setState(a=>({cards:a.cards.map(a=>{if(a.restaurantId!==e)return a;const s=t.get(a.menuItemId);if(!s)return a.signOff?{...a,signOff:null}:a;const i=s.updated_at?new Date(s.updated_at).toISOString():a.updatedAt;return{...a,photo:s.photo_url||void 0,signOff:a.signOff??{by:'Head chef',at:i}}})}))}const s=a.map(e=>e.doc?.item).filter(e=>!!e&&!!e.id).map(t=>({...t,restaurantId:e}));s.length&&U.useStore.setState(e=>{const t=new Map(s.map(e=>[e.id,e])),a=e.menu.map(e=>t.get(e.id)??e),i=new Set(a.map(e=>e.id));return{menu:[...a,...s.filter(e=>!i.has(e.id))]}})}async function la(e){let a=await k.kv.get(oa,{}),s=!1;const i=new Date(Date.now()-1728e5).toISOString(),n=async()=>{if(!s){s=!0;try{const s=U.useStore.getState(),n=s.bookings.filter(t=>t.restaurantId===e&&(0,$.isUuid)(t.id)&&!t.walkIn&&!a[t.id]&&t.createdAt>=i),r=s.orders.filter(t=>t.restaurantId===e&&(0,$.isUuid)(t.id)&&!a[t.id]&&t.createdAt>=i&&'table'!==t.type);if(n.length||r.length){if(!await Xt())return;for(const s of n)try{const i=(await Yt('guest_create_booking',{p_venue_slug:(0,t.queuedDatabaseSlug)(e),p_booking:{...ve(s),...(0,f.takeGuard)(s.id),allergies:we(s.allergies)}}))?.[0];a={...a,[s.id]:'booking'};const n={};i?.status&&i.status!==s.status&&(n.status=i.status),'string'==typeof i?.ref&&i.ref&&i.ref!==s.ref&&(n.ref=i.ref),Object.keys(n).length&&U.useStore.setState(e=>({bookings:e.bookings.map(e=>e.id===s.id?{...e,...n}:e)}))}catch(e){/fetch|network/i.test(String(e?.message))||(a={...a,[s.id]:'failed'},oe({lastError:`Booking: ${e?.message}`}))}for(const s of r)try{await Yt('guest_create_takeaway',{p_venue_slug:(0,t.queuedDatabaseSlug)(e),p_order:{...ve(s),...(0,f.takeGuard)(s.id),allergies:we(s.allergies)}}),a={...a,[s.id]:'order'}}catch(e){/fetch|network/i.test(String(e?.message))||(a={...a,[s.id]:'failed'},oe({lastError:`Order: ${e?.message}`}))}await k.kv.set(oa,a)}for(const e of s.bookings)if('booking'===a[e.id]&&'cancelled'===e.status)try{await Yt('guest_cancel_booking',{p_id:e.id}),a={...a,[e.id]:'cancelled'},await k.kv.set(oa,a)}catch{}if(Object.values(a).some(e=>'booking'===e||'order'===e)){const e=await Yt('guest_my_items')??[],t=new Map(e.map(e=>[String(e.id),e]));U.useStore.setState(e=>({bookings:e.bookings.map(e=>{const a=t.get(e.id);return a&&a.status&&a.status!==e.status&&'declined'!==a.status?{...e,status:a.status}:'declined'===a?.status&&'cancelled'!==e.status?{...e,status:'cancelled'}:e}),orders:e.orders.map(e=>{const a=t.get(e.id);if(!a)return e;const s=a.doc??{},i={...e,status:a.status??e.status,readyBy:s.readyBy??e.readyBy,accepted:s.accepted??e.accepted};return ca(i)===ca(e)?e:i})})),oe({mode:'live',lastSyncAt:(new Date).toISOString()})}}catch{oe({mode:(0,b.isOnline)()?re.getState().mode:'offline'})}finally{s=!1}}};me.push(U.useStore.subscribe((e,t)=>{e.bookings===t.bookings&&e.orders===t.orders||setTimeout(()=>{n()},200)})),ea=setInterval(()=>{n()},15e3),n()}const ca=e=>JSON.stringify([e.status,e.readyBy,e.accepted]),fa={bridges:()=>pe,restart:aa},pa='golive:v1:';async function ma(e){'live'!==U.useStore.getState().clock.mode&&U.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}}),s.LIVE_VENUE_BUILD&&(0,s.isLiveVenue)(e)?await wa(e):(await k.kv.get(pa+e,!1)||await wa(e),await k.kv.get(ha+e,!1)||(ya(e),await k.kv.set(ha+e,!0)),await k.kv.get(ga+e,!1)||(Sa(),await k.kv.set(ga+e,!0)))}const ga='golive:v3:';function Sa(){const e=e=>JSON.stringify(e).includes('(example)');try{L.useKitchen.setState(t=>({waste:t.waste.filter(t=>!e(t)),stockTakes:t.stockTakes.filter(t=>!e(t)),deliveries:t.deliveries.filter(e=>'dl-today-fish'!==e.id&&'dl-today-veg'!==e.id)}))}catch{}}const ha='golive:v2:';function ya(e){const t=e=>JSON.stringify(e).includes('(example)');U.useStore.setState(t=>({customer:{...t.customer,name:'',email:'',phone:'',allergies:[],allergyConsent:!1,marketingOptIn:{}},stampCards:t.stampCards.filter(t=>t.restaurantId!==e),giftCards:t.giftCards.filter(t=>t.restaurantId!==e),ratings:t.ratings.filter(t=>t.restaurantId!==e),events:t.events.filter(t=>!(t.example&&(t.restaurantId===e||null===t.restaurantId)))})),P.useOwner.setState(e=>({referrals:[],coats:[],merchOrders:[],lost:[],customerTags:{},offers:e.offers.filter(e=>!t(e)),changeRequests:e.changeRequests.filter(e=>!t(e)),campaigns:e.campaigns.filter(e=>!t(e)),supplierOrders:e.supplierOrders.filter(e=>!t(e)),chat:e.chat.filter(e=>e.id.startsWith('m-seed-')).map((e,t)=>({...e,at:new Date(Date.now()-6e4*(5-t)).toISOString()}))}))}async function wa(e){if(s.LIVE_VENUE_BUILD&&(0,s.isLiveVenue)(e)){const t=(0,i.stripCoreLiveSamples)(U.useStore.getState()),a=(0,L.stripKitchenExamples)(L.useKitchen.getState()),o=P.useOwner.getState(),u=(0,i.stripOwnerLiveSamples)(o),l={accidents:q.useSafety.getState().accidents.filter(e=>!(0,q.isSeedAccident)(e))},c=(e,t)=>Object.keys(t).some(a=>JSON.stringify(e[a])!==JSON.stringify(t[a]));c(U.useStore.getState(),t)&&(await(0,n.archiveChefCache)('core',U.useStore.getState()),U.useStore.setState(t)),c(L.useKitchen.getState(),a)&&(await(0,n.archiveChefCache)('kitchen',L.useKitchen.getState()),L.useKitchen.setState(a)),c(o,u)&&(await(0,n.archiveChefCache)('owner',o),P.useOwner.setState(u)),c(q.useSafety.getState(),l)&&(await(0,n.archiveChefCache)('safety',q.useSafety.getState()),q.useSafety.setState(l));const f=(0,_.stripHrSamples)(_.useHr.getState());c(_.useHr.getState(),f)&&(await(0,n.archiveChefCache)('hr',_.useHr.getState()),_.useHr.setState(f));const p=(0,r.stripGpSamples)(r.useGpCalc.getState());c(r.useGpCalc.getState(),p)&&(await(0,n.archiveChefCache)('gp',r.useGpCalc.getState()),r.useGpCalc.setState(p));const m=M.useOrderSheets.getState(),g={sheets:{...m.sheets,anchorage:(m.sheets.anchorage||[]).filter(e=>!('os-veg'===e.id&&e.placeholder))}};c(m,g)&&(await(0,n.archiveChefCache)('order-sheets',m),M.useOrderSheets.setState(g));const S=N.useCardStore.getState(),h={cards:S.cards.filter(e=>!(0,s.isLiveVenue)(e.restaurantId)||!(0,d.isDemoCard)(e)),log:S.log.filter(e=>!(0,d.demoActor)(e.by))};return c(S,h)&&(await(0,n.archiveChefCache)('recipe-cards',S),N.useCardStore.setState(h)),void await k.kv.set(pa+e,!0)}const t=t=>t.restaurantId===e&&!(0,$.isUuid)(t.id);U.useStore.setState(a=>({bookings:a.bookings.filter(e=>!t(e)),orders:a.orders.filter(e=>!t(e)),waitlist:a.waitlist.filter(t=>t.restaurantId!==e),walkIns:Object.fromEntries(Object.entries(a.walkIns).filter(([t])=>!t.includes(e)))})),E.useBlocks.setState(t=>({blocks:t.blocks.filter(t=>t.rid!==e||(0,$.isUuid)(t.id))})),C.useFloor.setState(t=>({live:{...t.live,[e]:{}}})),P.useOwner.setState(e=>({shifts:e.shifts.filter(e=>(0,$.isUuid)(e.id)),attendance:e.attendance.filter(e=>(0,$.isUuid)(e.id)),timeRequests:e.timeRequests.filter(e=>(0,$.isUuid)(e.id)),leave:[],swaps:[]}));try{L.useKitchen.setState(e=>(0,L.stripKitchenExamples)(e))}catch{}P.useOwner.setState(e=>({suppliers:e.suppliers.filter(e=>(0,$.isUuid)(e.id)),supplierOrders:e.supplierOrders.filter(e=>(0,$.isUuid)(e.id)&&(0,$.isUuid)(e.supplierId))}));try{q.useSafety.setState(e=>({accidents:e.accidents.filter(e=>{return!String(e.id).startsWith('acc-ex')&&(t=e,!JSON.stringify(t).includes('(example)'));var t})}))}catch{}await k.kv.set(pa+e,!0)}const va=(e,t)=>ve({name:e,stage:t.stage||void 0,dirty:t.dirty||void 0,blocked:t.blocked||void 0,note:t.note||void 0});function ba(e){return{name:'floor_live',table:'floor_live',conflict:'venue_id,table_name',list:()=>Object.entries(C.useFloor.getState().live[e]??{}).map(([e,t])=>va(e,t)),key:e=>e.name,rowKey:e=>String(e.table_name),syncable:e=>e.name.length>0&&e.name.length<=20,writable:()=>'staff'===re.getState().kind||de('device.write'),deletes:!1,matchKey:e=>({table_name:e}),toRow:(e,t)=>({venue_id:t,table_name:e.name,stage:e.stage??null,dirty:!!e.dirty,blocked:!!e.blocked,note:e.note?e.note.slice(0,200):null,updated_by:re.getState().staffRef??le}),fromRow:e=>va(String(e.table_name),{stage:e.stage??void 0,dirty:!!e.dirty,blocked:!!e.blocked,note:e.note??void 0}),apply:(t,a)=>C.useFloor.setState(s=>{const i={...s.live[e]??{}};for(const e of t){const{name:t,...a}=e;i[t]=a}for(const e of a)delete i[e];return{live:{...s.live,[e]:i}}}),subscribe:e=>C.useFloor.subscribe((t,a)=>{t.live!==a.live&&e()})}}function ka(e){return{name:'pay_grades',table:'pay_grades',conflict:'venue_id,grade_id',list:()=>(x.useSetup.getState().sites[e]?.grades??x.DEFAULT_GRADES).map((e,t)=>({id:e.id,name:e.name,pence:e.pence,sort:t})),key:e=>e.id,rowKey:e=>String(e.grade_id),syncable:e=>!!e.id&&!!e.name,writable:()=>de('wages.manage'),matchKey:e=>({grade_id:e}),toRow:(e,t)=>({venue_id:t,grade_id:e.id,name:e.name.slice(0,60),pence:Math.max(0,Math.min(1e5,Math.round(e.pence))),sort:e.sort}),fromRow:e=>({id:String(e.grade_id),name:String(e.name),pence:Number(e.pence),sort:Number(e.sort??0)}),apply:(t,a)=>{if(!t.length&&!a.length)return;const s=x.useSetup.getState().sites[e]?.grades??[],i=new Map(s.map((e,t)=>[e.id,{...e,sort:t}]));for(const e of t)i.set(e.id,e);for(const e of a)i.delete(e);const n=[...i.values()].sort((e,t)=>e.sort-t.sort).map(e=>({id:e.id,name:e.name,pence:e.pence}));x.useSetup.getState().patch(e,{grades:n})},subscribe:t=>x.useSetup.subscribe((a,s)=>{a.sites[e]?.grades!==s.sites[e]?.grades&&t()})}}const Ia='staff-avatars',Oa=new Map;let Ra=!1;const Aa=e=>new Promise((t,a)=>{const s=new FileReader;s.onload=()=>t(String(s.result)),s.onerror=a,s.readAsDataURL(e)});async function Ua(){if(!Ra){Ra=!0;try{for(const[e,t]of Oa){const a=K.useAvatars.getState().photos[e];if(!t){a?.path&&K.useAvatars.setState(t=>{const a={...t.photos};return delete a[e],{photos:a}});continue}if(a?.path===t)continue;if(a&&!a.path&&e===re.getState().staffRef)continue;const{data:s,error:i}=await ne().storage.from(Ia).download(t);if(i||!s)continue;const n=await Aa(s);n.startsWith('data:image/')&&K.useAvatars.setState(a=>({photos:{...a.photos,[e]:{dataUrl:n,at:(new Date).toISOString(),path:t}}}))}}catch{}finally{Ra=!1}}}function Da(e){const t=async()=>{const t=re.getState().staffRef,a=t?Be.get(t)??re.getState().staffUuid:void 0;if(!t||!a||'staff'!==re.getState().kind)return;const s=K.useAvatars.getState().photos[t];try{const i=Oa.get(t),n=t=>{t&&t.startsWith(`${e}/${a}-`)&&ne().storage.from(Ia).remove([t]).catch(()=>{})};if(!s)return void(i&&(await Yt('set_staff_avatar',{p_staff_ref:t,p_path:null}),Oa.set(t,null),n(i)));if(s.path)return;const r=await(await fetch(s.dataUrl)).blob();if(r.size>512e3)return void oe({lastError:'Avatar: picture too large to share'});const o='image/jpeg'===r.type?'jpg':'image/webp'===r.type?'webp':'png',d=`${e}/${a}-${Date.now().toString(36)}.${o}`,{error:u}=await ne().storage.from(Ia).upload(d,r,{upsert:!1,contentType:r.type||'image/png'});if(u)throw u;await Yt('set_staff_avatar',{p_staff_ref:t,p_path:d}),Oa.set(t,d),i!==d&&n(i),K.useAvatars.setState(e=>e.photos[t]?.dataUrl===s.dataUrl?{photos:{...e.photos,[t]:{...s,path:d}}}:e)}catch(e){oe({lastError:`Avatar: ${String(e?.message??e)}`})}},a={photos:K.useAvatars.getState().photos},s=K.useAvatars.subscribe(e=>{const s=a.photos;if(a.photos=e.photos,t(),de('staff.manage'))for(const t of Object.keys(s))if(!e.photos[t]&&s[t]?.path&&t!==re.getState().staffRef){const e=s[t].path;Oa.set(t,null),Yt('set_staff_avatar',{p_staff_ref:t,p_path:null}).then(()=>ne().storage.from(Ia).remove([e])).catch(()=>{})}});return t(),s}const Ea=new Map,Ca=(0,y.create)(()=>({n:0}))},820,{"0":5,"1":6,"2":1128,"3":833,"4":1129,"5":1132,"6":1148,"7":857,"8":1025,"9":989,"10":997,"11":947,"12":811,"13":1150,"14":1109,"15":859,"16":1151,"17":957,"18":1108,"19":952,"20":863,"21":1096,"22":1197,"23":1196,"24":1198,"25":1200,"26":1095,"27":1092,"28":872,"29":806,"30":824,"31":825,"32":1027,"33":1094,"34":1028,"35":1201,"36":1202,"37":1203,"38":1105,"39":856,"40":1034,"41":956,"42":1093,"43":1005,"44":1206,"45":1207,"46":2,"47":1208,"48":1106,"49":1107,"50":1209,"51":1118,"52":923,"53":918,"54":942,"55":1119,"56":1104,"57":945,"58":1018,"59":28,"paths":{}}); +__d(function(_g,_r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"colours",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"fonts",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"font",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"radius",{enumerable:!0,get:function(){return A}}),e.brandColour=function(I,S=n.gold){const r=/^#([0-9a-f]{6})$/i.exec(I??'');if(!r)return S;const _=parseInt(r[1],16),t=(_>>16)/255,E=(_>>8&255)/255,o=(255&_)/255,F=Math.max(t,E,o),A=Math.min(t,E,o),l=F-A;if(l<.12)return I;const D=F===t?((E-o)/l+6)%6*60:F===E?60*((o-t)/l+2):60*((t-E)/l+4);return D>65&&D<320?S:I};var I=_r(_d[0]),S=_r(_d[1]),r=_r(_d[2]),_=_r(_d[3]),t=_r(_d[4]),E=_r(_d[5]);const n={bg:I.IS_SOUTERS?'#56152A':I.IS_WILDINGS?'#272A2F':'#0B0B0B',surface:I.IS_SOUTERS?'#43122F':I.IS_WILDINGS?'#30343B':'#141414',surface2:I.IS_SOUTERS?'#43122F':I.IS_WILDINGS?'#363A42':'#1D1C1A',border:I.IS_SOUTERS?'#87435B':I.IS_WILDINGS?'#50545C':'#34302A',gold:I.IS_WILDINGS?'#FFE3A5':I.IS_KIRKMICHAEL?'#B87754':I.IS_SOUTERS?'#A4622E':'#CFA45F',goldLight:I.IS_WILDINGS?'#FFF0CF':I.IS_KIRKMICHAEL?'#D8AF95':I.IS_SOUTERS?'#D9AD8A':'#E2C489',goldTint:I.IS_WILDINGS?'#39352C':I.IS_KIRKMICHAEL?'#2C211B':I.IS_SOUTERS?'#43122F':'#2A2216',goldMuted:I.IS_WILDINGS?'#DDC694':I.IS_KIRKMICHAEL?'#C2937A':I.IS_SOUTERS?'#C18F67':'#BFA06C',hairline:'rgba(255,255,255,0.09)',tile:I.IS_SOUTERS?'#43122F':I.IS_WILDINGS?'#30343B':'#18171A',tilePressed:I.IS_SOUTERS?'#64223B':I.IS_WILDINGS?'#393D45':'#211F1C',accentBg:I.IS_WILDINGS?'rgba(255,227,165,0.13)':I.IS_KIRKMICHAEL?'rgba(184,119,84,0.13)':I.IS_SOUTERS?'rgba(164,98,46,0.13)':'rgba(207,164,95,0.13)',accentBorder:I.IS_WILDINGS?'rgba(255,227,165,0.38)':I.IS_KIRKMICHAEL?'rgba(184,119,84,0.38)':I.IS_SOUTERS?'rgba(164,98,46,0.38)':'rgba(207,164,95,0.38)',text:'#F5F1E8',muted:'#B8B0A0',onGold:I.IS_WILDINGS?'#272A2F':I.IS_KIRKMICHAEL?'#0B0B0B':I.IS_SOUTERS?'#FFFFFF':'#0B0B0B',red:'#FF6B5E',redBg:'#4A1310',redSolid:'#C62F22',amber:'#FFB547',amberBg:'#3F2C05',ok:I.IS_WILDINGS?'#FFF0CF':I.IS_KIRKMICHAEL?'#D8AF95':I.IS_SOUTERS?'#D9AD8A':'#E2C489',okBg:I.IS_WILDINGS?'#39352C':I.IS_KIRKMICHAEL?'#2C211B':I.IS_SOUTERS?'#43122F':'#2A2216',blue:I.IS_WILDINGS?'#FFF0CF':I.IS_KIRKMICHAEL?'#D8AF95':I.IS_SOUTERS?'#D9AD8A':'#E2C489',blueBg:I.IS_SOUTERS?'#43122F':I.IS_WILDINGS?'#39352C':'#1E1A12',...I.IS_GREENSIDE?r.GREENSIDE_PALETTE:{},...I.IS_QUEUED_VENUE?S.QUEUED_PALETTE:{},...I.IS_KIRKTON?t.KIRKTON_PALETTE:{},...I.IS_ABBOTSFORD?_.ABBOTSFORD_PALETTE:{}},o={regular:'Poppins_400Regular',medium:'Poppins_500Medium',semibold:'Poppins_600SemiBold',bold:'Poppins_700Bold'},F={small:E.type.small,body:E.type.body,large:E.type.large,title:E.type.title,hero:E.type.hero},A={s:E.radii.s,m:E.radii.m,l:E.radii.l}},821,[5,1233,1204,1234,1235,1236]); +__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.waNumber=o,_e.waMeLink=function(e,t){const n=o(e);return n?t?`https://wa.me/${n}?text=${encodeURIComponent(t)}`:`https://wa.me/${n}`:null},Object.defineProperty(_e,"guestWhatsAppText",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"staffWhatsAppTexts",{enumerable:!0,get:function(){return p}}),_e.openWhatsApp=async function(e){try{return await n.default.openURL(e),!0}catch{return!1}};var e,t=r(_d[0]),n=(e=t)&&e.__esModule?e:{default:e};function o(e,t="44"){if(!e)return null;let n=String(e).trim().replace(/[\s().\-]/g,'');return n.startsWith('+')?n=n.slice(1):n.startsWith('00')?n=n.slice(2):n.startsWith('0')&&(n=t+n.slice(1)),n=n.replace(/^440/,'44'),/^[1-9][0-9]{6,14}$/.test(n)?n:null}const s=e=>{const[t,n,o]=e.split('-').map(Number);return new Date(t,n-1,o).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',year:'numeric'})},u=e=>{const[t,n,o]=e.split('-').map(Number);return new Date(t,n-1,o).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'})},c=e=>e.slice(0,5),l=e=>e.replace(' (example)','').trim().split(/\s+/)[0]||'there',m=(e,t)=>`Hi ${t}, it's ${e.name.trim()} about my booking${e.ref?` ${e.ref}`:''}: ${s(e.date)} at ${c(e.time)}, table for ${e.partySize}. `,p=(e,t,n)=>({confirm:`Hi ${l(e.name)}, it's ${t}${n?` in ${n}`:''}. Just confirming your table for ${e.partySize} on ${u(e.date)} at ${c(e.time)}${e.ref?` (ref ${e.ref})`:''}. Any questions, just reply here.`,change:`Hi ${l(e.name)}, it's ${t} about your booking on ${u(e.date)} at ${c(e.time)}. `})},822,[239]); +__d(function(g,_r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.templatesFor=function(t){const n={...r.DEFAULT_TEMPLATES};for(const o of Object.keys(r.DEFAULT_TEMPLATES))n[o]={...r.DEFAULT_TEMPLATES[o],...t?.[o]??{}};return n},e.composeBooking=function(t,n,o,c,u){if(n.walkIn)return[];return s(t,'booking-confirmation'===t?'booking':'booking-request'===t?'request':'declined',(0,r.bookingVars)(n,o),{phone:n.phone,email:n.email,name:n.name},{refType:'booking',refId:n.id,ref:n.ref},o,c,u)},e.composeOrder=function(t,n,o,c){return'takeaway'!==t.type?[]:s('order-confirmation','order',(0,r.orderVars)(t,n),{phone:t.phone,email:t.email,name:t.customerName},{refType:'order',refId:t.id,ref:t.ref},n,o,c)},e.deliverQueued=async function(r,n){if(!(0,t.isLive)())return;const o=(0,t.activeProvider)();for(const t of r){const r=await o.deliver(t);n(t.id,r.ok?{status:'sent'}:{status:'failed',error:r.error})}},e.statusLabel=function(t){const r='sms'===t.channel?'Text':'Email';return'preview'===t.status?`${r}: Ready (preview mode)`:'queued'===t.status?`${r}: Sending\u2026`:'sent'===t.status?`${r} sent`:`${r}: Not sent (failed)`},Object.defineProperty(e,"PREVIEW_BANNER",{enumerable:!0,get:function(){return c}});var t=_r(d[0]);Object.keys(t).forEach(function(r){'default'===r||Object.prototype.hasOwnProperty.call(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[r]}})});var r=_r(d[1]);Object.keys(r).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return r[t]}})});var n=_r(d[2]);Object.keys(n).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})});const o=()=>`msg-${Math.random().toString(36).slice(2,8)}${Date.now().toString(36).slice(-4)}`;function s(s,c,u,l,f,m,p,b){const y=[],v=(0,t.isLive)()?'queued':'preview',h=(0,t.activeProvider)().id,k=(0,n.ukPhone)(l.phone);if(k.ok&&y.push({id:o(),restaurantId:m.id,at:b,channel:'sms',kind:s,to:k.pretty,toName:l.name,body:(0,r.toGsm)((0,r.fill)(p[c].sms,u.sms)),...f,status:v,provider:h}),l.email?.trim()){const t=(0,r.fillEmailText)(p[c].body,u.email),n=(0,r.fill)(p[c].subject,u.email);y.push({id:o(),restaurantId:m.id,at:b,channel:'email',kind:s,to:l.email.trim(),toName:l.name,subject:n,body:t,html:(0,r.emailHtml)(t,{venue:m.name,preheader:n}),...f,status:v,provider:h})}return y}const c='Preview mode, not sent yet. Connect a text and email service to go live.'},823,[1138,1139,1140]); +__d(function(g,r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"BLOCK_REASONS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"useBlocks",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"venueWide",{enumerable:!0,get:function(){return f}}),_e.blockedTablesAt=m,Object.defineProperty(_e,"blocksOn",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"areaBlocksOn",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"tableKey",{enumerable:!0,get:function(){return p}}),_e.closedAreasAt=function(e,t,o,n){const s=(0,l.toMins)(n),a=v(e,t,o).filter(e=>s>=(0,l.toMins)(e.from)&&s<(0,l.toMins)(e.to)).map(e=>e.areaId);return new Set([...a,...[...m(e,t,o,n)].map(p)])},_e.blockAt=M,_e.currentBlocks=function(e,t,o,n){return e.filter(e=>e.rid===t&&!e.removedAt&&(e.date>o||e.date===o&&(0,l.toMins)(e.to)>(0,l.toMins)(n))).sort((e,t)=>e.date===t.date?(0,l.toMins)(e.from)-(0,l.toMins)(t.from):e.date({blocks:[],removed:[],add:t=>{const o={...t,id:(0,s.uuid)(),createdAt:(new Date).toISOString(),source:'covercharge'};return e(e=>({blocks:[...e.blocks,o]})),o},addMany:t=>{const o=(new Date).toISOString(),n=t.map(e=>({...e,id:(0,s.uuid)(),createdAt:o,source:'covercharge'}));return e(e=>({blocks:[...e.blocks,...n]})),n},update:(t,o,n)=>e(e=>({blocks:e.blocks.map(e=>e.id===t?{...e,...o,id:t,editedAt:(new Date).toISOString(),editedBy:n}:e)})),remove:(t,o)=>e(e=>{const n=e.blocks.find(e=>e.id===t);return n?{blocks:e.blocks.filter(e=>e.id!==t),removed:[...e.removed,{...n,removedAt:(new Date).toISOString(),removedBy:o??n.by}]}:e}),put:t=>e(e=>{const o=e.blocks.filter(e=>e.id!==t.id),n=e.removed.filter(e=>e.id!==t.id);return t.removedAt?{blocks:o,removed:[...n,t]}:{blocks:[...o,t],removed:n}})}),{name:'covercharge-blocks-v1',storage:(0,c.createJSONStorage)(()=>n.default),version:2,migrate:e=>{const t=e??{};return{blocks:t.blocks??[],removed:t.removed??[]}}})),f=e=>!e.areaId&&!e.tables?.length;function m(e,t,o,n){const s=(0,l.toMins)(n);return new Set(e.filter(e=>e.rid===t&&e.date===o&&!e.removedAt&&e.tables?.length&&s>=(0,l.toMins)(e.from)&&s<(0,l.toMins)(e.to)).flatMap(e=>e.tables))}const k=(e,t,o)=>e.filter(e=>e.rid===t&&e.date===o&&!e.removedAt&&f(e)).sort((e,t)=>(0,l.toMins)(e.from)-(0,l.toMins)(t.from)),v=(e,t,o)=>e.filter(e=>e.rid===t&&e.date===o&&!e.removedAt&&!!e.areaId).sort((e,t)=>(0,l.toMins)(e.from)-(0,l.toMins)(t.from)),p=e=>`tbl:${e}`;function M(e,t,o,n){const s=(0,l.toMins)(n);return k(e,t,o).find(e=>s>=(0,l.toMins)(e.from)&&s<(0,l.toMins)(e.to))}const O=(e,t,o,n)=>M(e,t,o,n),y=e=>e.tables?.length?`${e.tables.map(t.tableNumbers).join(', ')} blocked until ${e.to}${e.reason?` \xb7 ${e.reason}`:''}`:e.areaId?`${e.areaName??'Area'} closed until ${e.to}${e.reason?` \xb7 ${e.reason}`:''}`:`Bookings paused until ${e.to}${e.reason?` \xb7 ${e.reason}`:''}`,A=(e,t)=>{const o=b(e=>e.blocks);return k(o,e,t)}},824,[808,1116,1034,952,1117,818]); +__d(function(g,r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEFAULT_SETTINGS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"seedPlan",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"useFloor",{enumerable:!0,get:function(){return p}}),_e.hashOldPins=f,Object.defineProperty(_e,"usePlan",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"useDisplaySettings",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"planOf",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"tablesOf",{enumerable:!0,get:function(){return j}}),_e.tablesLabel=function(e){const n=j((0,t.tableNumbers)(e));if(!n.length)return'';if(1===n.length)return n[0];const a=n.map(e=>/^\d+$/.test(e)?Number(e):NaN),s=a.every(e=>!Number.isNaN(e))?[...n].sort((e,n)=>Number(e)-Number(n)):n;return a.every(e=>!Number.isNaN(e))&&s.length>=3&&s.every((e,n)=>0===n||Number(e)===Number(s[n-1])+1)?`${s[0]}\u2013${s[s.length-1]}`:s.join(' + ')},Object.defineProperty(_e,"joinTables",{enumerable:!0,get:function(){return v}});var e,n=r(d[0]),t=r(d[1]),a=r(d[2]),s=(e=a)&&e.__esModule?e:{default:e},i=r(d[3]),l=r(d[4]),o=r(d[5]),c=r(d[6]);Object.keys(c).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return c[e]}})});const u={privacy:!0,idleMins:2,pinOn:!1,...i.DEFAULT_WAKE,tonightCards:!0},b=e=>'souters'===e||n.IS_ISOLATED_VENUE&&'souters'===n.VENUE_RID?{areas:[{id:'su-restaurant',name:'Restaurant'},{id:'su-bar',name:'Bar'},{id:'su-mezzanine',name:'Mezzanine / private dining'},{id:'su-garden',name:'Beer garden',outdoor:!0},{id:'su-icecream',name:'Ice cream & cake corner'}],tables:[],joins:[],sections:[],fixtures:[]}:'kirkmichael'===e||n.IS_ISOLATED_VENUE&&'kirkmichael'===n.VENUE_RID?{areas:[{id:'km-restaurant',name:'Restaurant'},{id:'km-bar',name:'Bar'},{id:'km-private',name:'Private dining',label:'The Room (about 18 covers) \u2014 table plan to confirm'}],tables:[],joins:[],sections:[],fixtures:[]}:['wildings','greenside'].includes(e)||n.IS_ISOLATED_VENUE?{areas:[],tables:[],joins:[],sections:[],fixtures:[]}:'anchorage'===e?(0,c.anchoragePlan)():(0,c.starterPlan)(),p=(0,l.create)()((0,o.persist)((e,t)=>{const a=e=>t().plans[e]??b(e);return{plans:n.IS_ISOLATED_VENUE?{[n.VENUE_RID]:b(n.VENUE_RID)}:{anchorage:(0,c.anchoragePlan)()},live:{},settings:{},smsLog:[],setPlan:(n,t)=>e(e=>({plans:{...e.plans,[n]:t}})),updateTable:(n,t,s)=>{const i=a(n);e(e=>({plans:{...e.plans,[n]:{...i,tables:i.tables.map(e=>e.id===t?{...e,...s}:e)}}}))},addTable:(n,t)=>{const s=a(n);e(e=>({plans:{...e.plans,[n]:{...s,tables:[...s.tables,t]}}}))},removeTable:(n,t)=>{const s=a(n),i=s.tables.find(e=>e.id===t);e(e=>({plans:{...e.plans,[n]:{...s,tables:s.tables.filter(e=>e.id!==t),joins:s.joins.filter(e=>!i||!e.tables.includes(i.name))}}}))},setLive:(n,t,a)=>e(e=>({live:{...e.live,[n]:{...e.live[n]??{},[t]:{...e.live[n]?.[t]??{},...a}}}})),setSettings:(n,t)=>e(e=>({settings:{...e.settings,[n]:{...u,...e.settings[n]??{},...t}}})),logSms:(n,t,a)=>e(e=>{return{smsLog:[{id:(s='sms',`${s}-${Date.now().toString(36)}${Math.random().toString(36).slice(2,6)}`),rid:n,at:t,text:a},...e.smsLog].slice(0,50)};var s}),resetPlan:n=>e(e=>({plans:{...e.plans,[n]:b(n)}}))}},{name:'covercharge-floor-v1',version:6,storage:(0,o.createJSONStorage)(()=>s.default),migrate:(e,n)=>{const t=e??{};let a=t;if(n<2){const e={};for(const[n,a]of Object.entries(t.plans??{}))e[n]='anchorage'===n?(0,c.anchoragePlan)():(0,c.normalisePlan)(a);e.anchorage=(0,c.anchoragePlan)(),a={...t,plans:e,live:{}}}else if(n<3)a={...t,plans:{...t.plans??{},anchorage:(0,c.anchoragePlan)()}};else if(n<4){const e=t.plans?.anchorage;e&&(a={...t,plans:{...t.plans,anchorage:{...e,joins:(e.joins??[]).filter(e=>!(2===e.tables.length&&e.tables.includes('1')&&e.tables.includes('2')))}}})}return n<5&&(a={...a,settings:f(a.settings)}),n<6&&a.plans?.anchorage&&(a={...a,plans:{...a.plans,anchorage:(0,c.withSeedBest)('anchorage',a.plans.anchorage)}}),a}}));function f(e){const n={};for(const[t,a]of Object.entries(e??{})){const{pin:e,...s}=a??{};n[t]={...u,...s,...'pinHash'in s?{}:(0,i.fromOldPin)(e)}}return n}const h=e=>p(n=>n.plans[e])??E(e),N={};function E(e){return N[e]??=b(e)}const O=e=>{const n=p(n=>n.settings[e]);return n?{...u,...n}:u},P=e=>p.getState().plans[e]??E(e),j=e=>e?e.split('+').map(e=>e.trim()).filter(Boolean):[];const v=e=>[...new Set(e)].sort((e,n)=>/^\d+$/.test(e)&&/^\d+$/.test(n)?Number(e)-Number(n):e.localeCompare(n)).join('+')},825,[5,808,1116,946,952,1117,945]); +__d(function(_g,r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"STATUS",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"STAGE_LABEL",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"STAGES",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"turnFor",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"startOf",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"durOf",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"endOf",{enumerable:!0,get:function(){return f}}),e.clashes=function(a,s=90){const n=new Set,l=a.filter(t=>g(t)&&t.table);for(let a=0;a(0,t.tablesOf)(d.table).includes(a))&&(u(o)t.date===n&&!['cancelled','noshow'].includes(t.status)).sort((t,a)=>t.time.localeCompare(a.time));for(const s of a.tables){const a=i.filter(a=>(0,t.tablesOf)(a.table).includes(s.name)),n=a[0],o=(0,t.tablesOf)(n?.table);l[s.name]={table:s,status:n?'soon':'free',next:n,covers:n?.partySize??0,dayBookings:a.length?a:void 0,group:o.length>1?o:void 0,allergy:!(!n?.allergies?.length&&!n?.allergyNote),vip:n?.tags?.find(t=>'VIP'===t)??n?.tags?.find(t=>'Regular'===t),occasion:n?.occasion??h(n?.notes)}}return l},e.floorView=function(a,n,l,i,o,d=90,c){const b={},g=n.filter(t=>t.date===O(o));for(const n of a.tables){const a=i[n.name]??{},y=g.filter(a=>(0,t.tablesOf)(a.table).includes(n.name)),O=y.find(t=>'seated'===(0,s.shownStatus)(t)),v=y.filter(t=>'confirmed'===t.status).sort((t,a)=>t.time.localeCompare(a.time)).find(t=>S(o,t)>=-20),T=v?Math.round(S(o,v)):void 0,w=O?void 0:p(y,o,d),F=l.find(t=>'table'===t.type&&t.tableNo===n.name&&!['closed','cancelled','collected'].includes(t.status));let j='free';a.blocked?j='blocked':O?j=a.stage??'seated':!c?.has(n.areaId)&&!c?.has(`tbl:${n.name}`)||F?a.dirty?j='dirty':F?j=a.stage??'seated':v&&void 0!==T&&T<=45&&(j='soon'):j='blocked';const A=O,P=A?.tags?.find(t=>'VIP'===t)??A?.tags?.find(t=>'Regular'===t)??(A?void 0:v?.tags?.[0]);b[n.name]={table:n,status:j,booking:A,next:v,due:w,nextIn:T,covers:A?.partySize??0,group:(()=>{const a=(0,t.tablesOf)((A??('soon'===j?v:void 0))?.table);return a.length>1?a:void 0})(),orderOnly:!A&&!!F,note:a.note,seatedMins:A?Math.max(0,Math.round((o.getTime()-u(A).getTime())/6e4)):void 0,freeAt:A?f(A,d):void 0,allergy:!!(A?.allergies?.length||A?.allergyNote||!A&&(v?.allergies?.length||v?.allergyNote)||F?.allergies?.length),vip:P,occasion:A?.occasion??(A?void 0:v?.occasion??h(v?.notes))??h(A?.notes)}}return b},e.dueOnTable=p,Object.defineProperty(e,"OCCASION_ICON",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"tableAllowed",{enumerable:!0,get:function(){return v}}),e.suggestTable=function(s,n,l,i,o,d,c=90,b,p){const h=[...s.tables.map(t=>({name:t.name,seats:t.maxSeats,min:t.minSeats,parts:[t.name]})),...s.joins.map(t=>{const a=s.tables.filter(a=>t.tables.includes(a.name));return{name:t.tables.join('+'),seats:a.reduce((t,a)=>t+a.maxSeats,0),min:a.reduce((t,a)=>t+a.minSeats,0),parts:t.tables}})].filter(t=>t.parts.every(t=>v(s,t,p))),y=o.getTime()+6e4*d,S=new Set((0,a.bestTables)(s));let O=null;for(const a of h){if(a.seats['blocked'].includes(l[t]?.status)))continue;const s=!!l&&a.parts.some(t=>['seated','mains','dessert','bill','dirty'].includes(l[t]?.status)),d=n.filter(s=>s.id!==b&&g(s)&&(0,t.tablesOf)(s.table).some(t=>a.parts.includes(t))&&u(s).getTime()o.getTime()).length,p=1===a.parts.length&&S.has(a.parts[0])?12:0,h=(s?1e3:0)+100*d+10*(a.seats-i)+(i({name:t.name,seats:t.maxSeats,parts:[t.name]})),...s.joins.map(t=>({name:t.tables.join('+'),seats:s.tables.filter(a=>t.tables.includes(a.name)).reduce((t,a)=>t+a.maxSeats,0),parts:t.tables}))].filter(t=>t.seats>=l&&t.parts.every(t=>v(s,t,c))).filter(a=>!n.some(s=>s.id!==b&&g(s)&&(0,t.tablesOf)(s.table).some(t=>a.parts.includes(t))&&u(s).getTime()i.getTime())),y=new Set((0,a.bestTables)(s)),S=t=>1===t.parts.length&&y.has(t.parts[0])?0:1;return h.sort((t,a)=>t.seats-a.seats||t.parts.length-a.parts.length||S(t)-S(a)).map(t=>({table:t.name,seats:t.seats,area:s.areas.find(a=>a.id===s.tables.find(a=>a.name===t.parts[0])?.areaId)?.name??''}))};var t=r(_d[0]),a=r(_d[1]),s=r(_d[2]);const n={colour:'#3A2F1E',fg:'#F1DDB0'},l={colour:'#CFA45F',fg:'#0B0B0B'},i={free:{label:'Free',...n},soon:{label:'Free',...n},seated:{label:'Seated',...l},mains:{label:'Seated',...l},dessert:{label:'Seated',...l},bill:{label:'Seated',...l},dirty:{label:'Needs clearing',colour:'#6E6555',fg:'#FFFFFF'},blocked:{label:'Blocked',...n}},o={seated:'Seated',mains:'Mains',dessert:'Dessert',bill:'Bill requested'},d=['seated','mains','dessert','bill'],c=(t,a=90)=>Math.min(a+60,a+15*Math.max(0,Math.ceil((t-2)/2))),u=t=>'seated'===(0,s.shownStatus)(t)&&t.seatedAt?new Date(t.seatedAt):new Date(`${t.date}T${t.time}:00`),b=(t,a=90)=>t.durationMins??c(t.partySize,a),f=(t,a=90)=>new Date(u(t).getTime()+6e4*b(t,a)),g=t=>!['cancelled','noshow','finished'].includes(t.status);function p(t,a,s=90){return t.filter(t=>'confirmed'===t.status&&S(a,t)<=45&&-S(a,t)t.time.localeCompare(a.time))[0]}const h=t=>t?/birthday/i.test(t)?'birthday':/anniversary/i.test(t)?'anniversary':void 0:void 0,y={birthday:'\ud83c\udf82',anniversary:'\ud83d\udc9d',celebration:'\ud83e\udd42'},S=(t,a)=>(new Date(`${a.date}T${a.time}:00`).getTime()-t.getTime())/6e4,O=t=>`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`,v=(t,a,s)=>{const n=t.tables.find(t=>t.name===a);if(!n)return!1;const l=t.areas.find(t=>t.id===n.areaId);return!(s?.dog&&!(void 0!==n.dogOk?n.dogOk:l?.dogs))&&(!s?.closed?.has(n.areaId)&&!s?.closed?.has(`tbl:${n.name}`))}},826,[825,945,828]); +__d(function(g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"emptyNeeds",{enumerable:!0,get:function(){return w}}),_e.needsMissing=function(e,l=[]){const s=[];null===e.allergy?s.push('Answer the allergy question first'):'yes'!==e.allergy||e.allergens.length||l.length||e.allergyNote.trim()||s.push('Pick the allergens or describe them');null===e.dog&&s.push('Say whether a dog is coming');return s},_e.needsPatch=function(e,l=[]){const s='yes'===e.allergy?e.allergens.filter(e=>!l.some(l=>l.allergen===e)).map(l=>({allergen:l,severity:e.severity})):[],t=Object.entries(e.holds).filter(([,e])=>e>0).map(([e,l])=>({kind:e.startsWith('item:')?'item':'stock',id:e.slice(5),qty:l})),a=e.dog?Math.max(1,e.dogs):0,n={...e.wheelchair?{wheelchair:e.wheelchair}:{},...e.stepFree?{stepFree:!0}:{},...e.toilet?{toilet:!0}:{},...e.assistDog?{assistDog:!0}:{},...e.accessNote.trim()?{note:e.accessNote.trim()}:{}},r={...e.vegan?{vegan:e.vegan}:{},...e.vegetarian?{vegetarian:e.vegetarian}:{}};return{allergies:[...l,...s],allergyNone:'none'===e.allergy&&!l.length||void 0,allergyPeople:'yes'===e.allergy?e.allergyPeople:void 0,allergyNote:'yes'===e.allergy&&e.allergyNote.trim()?e.allergyNote.trim():void 0,dog:a>0,dogs:a||void 0,access:Object.keys(n).length?n:void 0,diet:Object.keys(r).length?r:void 0,holds:t.length?t:void 0,tableReq:e.tableReq.length?e.tableReq:void 0}},_e.FirstQuestions=function({rid:e,value:l,onChange:a,party:r,audience:i,profile:o=[]}){const p=e=>a({...l,...e}),b=(0,y.usePlan)(e),[x,j]=(0,t.useState)(!1),k=(0,s.dogQuestionOn)((0,u.useRestaurant)(e));(0,t.useEffect)(()=>{k||null!==l.dog||a({...l,dog:!1})},[k,l.dog]);const w=x?m.ALLERGENS:m.ALLERGENS.filter(e=>['gluten','milk','peanuts','treenuts','crustaceans','molluscs','fish','eggs','sesame'].includes(e.id)||l.allergens.includes(e.id)),M=[...o.map(e=>e.allergen),...l.allergens],q=(0,f.dogSetUp)(b);return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)(R,{tone:"red",testID:"q-allergens",children:[(0,v.jsx)(C,{sub:'guest'===i?'We ask everyone first, so the kitchen can keep you safe.':'Ask every guest first. It goes to the kitchen in red.',children:"\u26a0\ufe0f Does anyone in the party have a food allergy?"}),o.length?(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:o.map(e=>(0,v.jsx)(h.Badge,{kind:"red",label:`${m.ALLERGENS.find(l=>l.id===e.allergen)?.short} (from your profile)`},e.allergen))}):null,(0,v.jsxs)(h.Row,{gap:8,children:[(0,v.jsx)(n.default,{style:{flex:1},children:(0,v.jsx)(h.Chip,{label:"No allergies",selected:'none'===l.allergy,onPress:()=>p({allergy:'none',allergens:[]})})}),(0,v.jsx)(n.default,{style:{flex:1},children:(0,v.jsx)(h.Chip,{label:"Yes, allergies",selected:'yes'===l.allergy,onPress:()=>p({allergy:'yes'})})})]}),'none'===l.allergy&&o.length?(0,v.jsx)(h.Muted,{children:"Your profile allergies above are still shared with the kitchen."}):null,'yes'===l.allergy?(0,v.jsxs)(n.default,{style:{gap:10},testID:"allergen-picker",children:[(0,v.jsx)(h.T,{size:14,weight:"semibold",children:"Which allergens? (the 14 UK allergens)"}),(0,v.jsxs)(h.Row,{wrap:!0,gap:6,children:[w.map(e=>(0,v.jsx)(h.Chip,{label:e.short,selected:l.allergens.includes(e.id)||o.some(l=>l.allergen===e.id),disabled:o.some(l=>l.allergen===e.id),onPress:()=>p({allergens:l.allergens.includes(e.id)?l.allergens.filter(l=>l!==e.id):[...l.allergens,e.id]})},e.id)),x?null:(0,v.jsx)(h.Chip,{label:"All 14\u2026",onPress:()=>j(!0)})]}),(0,v.jsx)(h.T,{size:14,weight:"semibold",children:"How serious?"}),(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:m.SEVERITIES.map(e=>(0,v.jsx)(h.Chip,{label:e.label,selected:l.severity===e.id,onPress:()=>p({severity:e.id})},e.id))}),(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.T,{size:14,children:"How many people with allergies?"}),(0,v.jsx)(h.Stepper,{value:Math.min(l.allergyPeople,r),onChange:e=>p({allergyPeople:e}),min:1,max:Math.max(1,r),label:"people with allergies"})]}),(0,v.jsx)(h.Field,{label:"Anything else the kitchen should know? (optional)",value:l.allergyNote,onChangeText:e=>p({allergyNote:e}),placeholder:"e.g. traces of sesame, one child with coeliac disease",testID:"allergy-note"}),M.length?(0,v.jsx)(c.MenuAllergyCheck,{rid:e,allergens:M,audience:i}):null]}):null]}),k?(0,v.jsxs)(R,{tone:"gold",testID:"q-dogs",children:[(0,v.jsx)(C,{sub:q?'Well-behaved dogs are welcome at our dog-friendly tables.':'staff'===i?'Dog-friendly tables aren\u2019t marked yet (Managers \u203a Booking options), so any table is offered for now.':void 0,children:"\ud83d\udc15 Are you bringing a dog?"}),(0,v.jsxs)(h.Row,{gap:8,children:[(0,v.jsx)(n.default,{style:{flex:1},children:(0,v.jsx)(h.Chip,{label:"No",selected:!1===l.dog,onPress:()=>p({dog:!1})})}),(0,v.jsx)(n.default,{style:{flex:1},children:(0,v.jsx)(h.Chip,{label:"Yes",selected:!0===l.dog,onPress:()=>p({dog:!0,dogs:Math.max(1,l.dogs)})})})]}),l.dog?(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.T,{size:14,children:"How many dogs?"}),(0,v.jsx)(h.Stepper,{value:l.dogs,onChange:e=>p({dogs:e}),min:1,max:4,label:"dogs"})]}):null]}):null]})},_e.useReserveAvailability=M,_e.MoreQuestions=function({rid:e,r:l,value:a,onChange:r,party:i,date:o,time:c,today:p,bookings:m,audience:b,showTables:x}){const j=e=>r({...a,...e}),w=l.settings,S=(0,u.useMenu)(e),P=(0,t.useMemo)(()=>S.filter(e=>/\((V|VG|Ve)\)|vegan|vegetarian/i.test(`${e.name} ${e.tags?.join(' ')??''}`)).slice(0,4),[S.length]),N=M(e,l,o,p,m,b),T=e=>a.holds[e]??0,$=(0,f.stockNeed)({holds:Object.entries(a.holds).map(([e,l])=>({kind:e.startsWith('item:')?'item':'stock',id:e.slice(5),qty:l}))},N.items),D=(e,l)=>Math.min(10,...e.map(e=>{const s=($[e.key]??0)-T(l)*e.qty;return Math.floor(((N.free[e.key]??0)-s)/e.qty)})),A=(e,l,s,t)=>{const r=T(e),i=t<=0&&0===r;return(0,v.jsxs)(n.default,{style:{flexDirection:'row',alignItems:'center',gap:10,opacity:i?.55:1},testID:`reserve-${e.replace(':','-')}`,children:[(0,v.jsxs)(n.default,{style:{flex:1,minWidth:0},children:[(0,v.jsx)(h.T,{weight:"semibold",children:l}),(0,v.jsx)(h.Muted,{children:i?'Unavailable \u2014 none left for this day':s})]}),i?(0,v.jsx)(h.Badge,{kind:"neutral",label:"Unavailable"}):(0,v.jsx)(h.Stepper,{value:r,onChange:l=>j({holds:{...a.holds,[e]:Math.max(0,Math.min(l,Math.max(r,t)))}}),min:0,max:Math.max(r,Math.min(10,t)),label:l})]},e)},I=N.items.length>0||!1!==w.reserveStock&&N.stock.length>0,O=(0,y.usePlan)(e);return(0,v.jsxs)(v.Fragment,{children:[(0,s.accessQuestionOn)(l)?(0,v.jsxs)(R,{tone:"plain",testID:"q-access",children:[(0,v.jsx)(C,{sub:"Optional. Tell us and we\u2019ll have the right table ready.",children:"\u267f Access needs"}),(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.T,{size:14,children:"Wheelchair users"}),(0,v.jsx)(h.Stepper,{value:a.wheelchair,onChange:e=>j({wheelchair:e}),min:0,max:Math.max(1,i),label:"wheelchair users"})]}),(0,v.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,v.jsx)(h.Chip,{label:"Step-free access",selected:a.stepFree,onPress:()=>j({stepFree:!a.stepFree})}),(0,v.jsx)(h.Chip,{label:"Accessible toilet",selected:a.toilet,onPress:()=>j({toilet:!a.toilet})}),(0,v.jsx)(h.Chip,{label:"Assistance dog",selected:a.assistDog,onPress:()=>j({assistDog:!a.assistDog})})]}),(0,v.jsx)(h.Field,{label:"Anything else? (optional)",value:a.accessNote,onChangeText:e=>j({accessNote:e}),placeholder:"e.g. needs a chair with arms"}),w.accessStatement?.trim()?(0,v.jsx)(h.Muted,{children:w.accessStatement.trim()}):null]}):null,(0,s.dietQuestionOn)(l)?(0,v.jsxs)(R,{tone:"plain",testID:"q-veg",children:[(0,v.jsx)(C,{sub:"We\u2019d love to look after you. Optional.",children:"\u24cb Any vegans or vegetarians?"}),(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.T,{size:14,children:"Vegan"}),(0,v.jsx)(h.Stepper,{value:a.vegan,onChange:e=>j({vegan:e}),min:0,max:Math.max(1,i),label:"vegans"})]}),(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.T,{size:14,children:"Vegetarian"}),(0,v.jsx)(h.Stepper,{value:a.vegetarian,onChange:e=>j({vegetarian:e}),min:0,max:Math.max(1,i),label:"vegetarians"})]}),!1!==w.vegTeaser&&P.length&&(a.vegan||a.vegetarian)?(0,v.jsxs)(h.Muted,{children:["On the menu: ",P.map(e=>e.name).join(' \xb7 ')]}):null]}):null,I?(0,v.jsxs)(R,{tone:"gold",testID:"q-reserve",children:[(0,v.jsx)(C,{sub:N.known?'Held for you from today\u2019s count.':o>p||'guest'===b?'Held for you; the kitchen confirms and orders in.':void 0,children:"\ud83e\udd9e Reserve with your table"}),N.items.map(e=>A(`item:${e.id}`,`${e.name}${k(e.price)}`,e.description||e.uses.map(e=>`${e.qty} ${N.stock.find(l=>l.key===e.key)?.name.toLowerCase()??e.key}`).join(' + '),D(e.uses,`item:${e.id}`))),!1!==w.reserveStock?N.stock.map(e=>A(`stock:${e.key}`,`Reserve ${e.name.toLowerCase()}`,N.known?`${N.free[e.key]} available today`:'Held for the kitchen to order',D([{key:e.key,qty:1}],`stock:${e.key}`))):null,'staff'===b&&N.known?(0,v.jsxs)(h.Muted,{children:["Today: ",N.stock.map(e=>`${N.free[e.key]} ${e.plural.toLowerCase()} free (${N.reserved[e.key]??0} reserved)`).join(' \xb7 ')]}):null]}):null,x&&!1!==w.tableRequests&&O.tables.length?(0,v.jsx)(q,{rid:e,value:a,onChange:r,party:i,hide:w.tableRequestHide??[]}):null]})},_e.dogTimeOk=function(e,l,s,t,a){if(!a)return!0;const n=e.settings.maxDogsPerSlot;return!n||(0,f.dogsAt)(l,s,t)+a<=n},Object.defineProperty(_e,"accessibleSetUp",{enumerable:!0,get:function(){return f.accessibleSetUp}});var e,l=_r(d[0]),s=_r(d[1]),t=_r(d[2]),a=_r(d[3]),n=(e=a)&&e.__esModule?e:{default:e},r=_r(d[4]),i=_r(d[5]),o=_r(d[6]),c=_r(d[7]),h=_r(d[8]),u=_r(d[9]),y=_r(d[10]),p=_r(d[11]),m=_r(d[12]),b=_r(d[13]),x=_r(d[14]),f=_r(d[15]),j=_r(d[16]),v=_r(d[17]);const k=e=>'display'===x.APP_VARIANT?'':` \xb7 ${(0,b.gbp)(e)}`,w=()=>({allergy:null,allergens:[],severity:'allergy',allergyPeople:1,allergyNote:'',dog:null,dogs:1,wheelchair:0,stepFree:!1,toilet:!1,assistDog:!1,accessNote:'',vegan:0,vegetarian:0,holds:{},tableReq:[]});const R=({children:e,tone:l,testID:s})=>(0,v.jsx)(n.default,{testID:s,style:{gap:10,padding:16,borderRadius:16,borderWidth:'plain'===l?1:1.5,borderColor:'red'===l?j.colours.red:'gold'===l?j.colours.accentBorder:j.colours.hairline,backgroundColor:'red'===l?'#1E1110':j.colours.surface},children:e}),C=({children:e,sub:l})=>(0,v.jsxs)(n.default,{style:{gap:2},children:[(0,v.jsx)(h.T,{weight:"semibold",size:17,children:e}),l?(0,v.jsx)(h.Muted,{children:l}):null]});function M(e,l,s,t,a,n,i){const o=(0,f.reservablesOf)(l),c=(0,p.useStockItems)(e),h=(0,p.useShellStore)((0,r.useShallow)(l=>(0,p.venueCounts)(l,e))),u=(0,p.useShellStore)(l=>!!l.server[e]),y=(0,f.reservedOn)(a,s,o,i),m=s===t&&('staff'===n||u),b={};for(const e of c)b[e.key]=m?Math.max(0,Math.floor((h[e.key]??0)-(y[e.key]??0))):1/0;return{items:o,stock:c,free:b,reserved:y,known:m}}function q({rid:e,value:s,onChange:a,party:r,hide:c}){const u=(0,y.usePlan)(e),p=u.areas.filter(e=>u.tables.some(l=>l.areaId===e.id&&!c.includes(l.name))),[m,b]=(0,t.useState)(p[0]?.id??''),x=s.dog?s.dogs:0,k=e=>c.includes(e)?'Not bookable':(0,f.tableBlockReason)(u,e,r,x,s.wheelchair>0||s.stepFree),w=Object.fromEntries(u.tables.map(e=>[e.name,{table:e,status:k(e.name)?'blocked':'free',covers:0,allergy:!1}])),M=e=>{if(k(e))return;const l=s.tableReq.includes(e)?s.tableReq.filter(l=>l!==e):[...s.tableReq,e].slice(-2);a({...s,tableReq:l})},q=u.tables.filter(e=>e.areaId===m&&!c.includes(e.name));return(0,v.jsxs)(R,{tone:"plain",testID:"q-table",children:[(0,v.jsx)(C,{sub:"Table requests aren\u2019t guaranteed, but we\u2019ll do our best.",children:"\ud83e\ude91 Request a table (optional)"}),p.length>1?(0,v.jsx)(i.AreaTabs,{plan:u,area:m,onPick:b}):null,(0,v.jsx)(n.default,{style:{borderRadius:12,overflow:'hidden',borderWidth:1,borderColor:j.colours.hairline},children:(0,v.jsx)(o.FloorCanvas,{plan:u,areaId:m,mode:"live",view:w,privacy:!0,fit:"contain",crop:!0,maxH:260,highlight:s.tableReq,onTap:e=>M(e.name)})}),(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:q.map(e=>{const t=k(e.name),a=s.tableReq.indexOf(e.name);return(0,v.jsx)(h.Chip,{label:`${(0,l.tableNumbers)(e.name)}`,sub:t||(0===a?'1st choice':1===a?'2nd choice':`${e.maxSeats} seats`),selected:a>=0,disabled:!!t,onPress:()=>M(e.name)},e.name)})}),s.tableReq.length?(0,v.jsxs)(h.T,{size:14,colour:j.colours.goldLight,children:["Requested: ",s.tableReq.map((e,s)=>`${(0,l.tableNumbers)(e)}${s?' (2nd choice)':''}`).join(', ')]}):(0,v.jsx)(h.Muted,{children:"Tap a table; tap another for a second choice."})]})}},827,[808,809,30,127,873,929,928,1299,813,819,825,1027,814,816,806,828,821,24]); +__d(function(g,_r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ACTIVE",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"ANCHORAGE_RESERVABLES",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"reservablesOf",{enumerable:!0,get:function(){return i}}),e.stockNeed=s,e.reservedOn=a,e.usedOn=function(t,r,n){const o={};for(const i of t)if(i.date===r)for(const t of i.holds??[])if(t.served)for(const[r,a]of Object.entries(s({...i,holds:[{...t,served:void 0}]},n)))o[r]=(o[r]??0)+a;return o},e.heldSummary=function(t,r,o){const i={},s={};for(const o of t)if(o.date===r&&n(o))for(const t of o.holds??[])t.served||('item'===t.kind?i[t.id]=(i[t.id]??0)+t.qty:s[t.id]=(s[t.id]??0)+t.qty);return{platters:Object.values(i).reduce((t,r)=>t+r,0),byItem:i,single:s,stock:a(t,r,o)}},e.holdsText=function(t,r,n){return(t.holds??[]).filter(t=>t.qty>0).map(t=>`${'item'===t.kind?c(r.find(r=>r.id===t.id)?.name??'Reserved item'):n.find(r=>r.key===t.id)?.name??t.id} x${t.qty}${t.served?' (served)':''}`).join(', ')},Object.defineProperty(e,"shortItem",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"needsAllergenSeen",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"needsHoldOk",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"hasAllergens",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"allergenText",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"dogCount",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"hasAccess",{enumerable:!0,get:function(){return y}}),e.accessText=function(t){const r=t.access;return r?[r.wheelchair?`${r.wheelchair} wheelchair user${1===r.wheelchair?'':'s'}`:'',r.stepFree?'step-free access':'',r.toilet?'accessible toilet':'',r.assistDog?'assistance dog':'',r.note?.trim()??''].filter(Boolean).join(', '):''},Object.defineProperty(e,"dietText",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"accessibleSetUp",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"dogSetUp",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"isAccessible",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"isDogOk",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"dogsAt",{enumerable:!0,get:function(){return P}}),e.tableBlockReason=function(t,n,o,i,s){const a=t.tables.find(t=>t.name===n);return a?a.maxSeats0&&O(t)&&!(0,r.tableDogOk)(t,a)?'No dogs here':s&&h(t)&&!a.accessible?'Not step-free':'':'Not available'},Object.defineProperty(e,"holidayName",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"coverDone",{enumerable:!0,get:function(){return A}}),e.shownStatus=S,e.coversToday=function(t,r){const o=t.filter(t=>t.date===r&&n(t)),i=o.filter(A),s=o.filter(t=>!A(t)&&['confirmed','pending','seated'].includes(S(t))),a=t=>t.reduce((t,r)=>t+r.partySize,0);return{done:a(i),toCome:a(s),total:a(i)+a(s)}};var t=_r(_d[0]),r=_r(_d[1]);const n=t=>!['cancelled','noshow'].includes(t.status),o=[{id:'seafood-platter-2',name:'Seafood Platter for 2',price:16e3,description:'Whole crab and lobster with all the trimmings, for two to share.',uses:[{key:'crab',qty:1},{key:'lobster',qty:1}],active:!0}],i=t=>(t?.settings.reservables??('anchorage'===t?.id?o:[])).filter(t=>t.active);function s(t,r,n=!1){const o={};for(const i of t.holds??[])if(!i.served||n)if('stock'===i.kind)o[i.id]=(o[i.id]??0)+i.qty;else for(const t of r.find(t=>t.id===i.id)?.uses??[])o[t.key]=(o[t.key]??0)+t.qty*i.qty;return o}function a(t,r,o,i){const a={};for(const c of t)if(c.date===r&&n(c)&&'finished'!==c.status&&c.id!==i)for(const[t,r]of Object.entries(s(c,o)))a[t]=(a[t]??0)+r;return a}const c=t=>/platter/i.test(t)?'Platter':t.replace(/ for \d+$/i,''),l=t=>n(t)&&(t.allergies.length>0||!!t.allergyNote?.trim())&&!t.allergyAck,d=t=>n(t)&&(t.holds??[]).some(t=>t.qty>0&&!t.served)&&!t.holdOk,f=t=>t.allergies.length>0||!!t.allergyNote?.trim(),u=r=>[r.allergies.map(r=>(0,t.allergenLabel)(r.allergen)).join(', '),r.allergyNote?.trim()].filter(Boolean).join(' \xb7 ')+(r.allergyPeople?` (${r.allergyPeople} ${1===r.allergyPeople?'person':'people'})`:''),b=t=>t.dogs??(t.dog?1:0),y=t=>!(!t.access||!(t.access.wheelchair||t.access.stepFree||t.access.toilet||t.access.assistDog||t.access.note?.trim()));const p=t=>[t.diet?.vegan?`${t.diet.vegan} vegan`:'',t.diet?.vegetarian?`${t.diet.vegetarian} vegetarian`:''].filter(Boolean).join(', '),h=t=>t.tables.some(t=>t.accessible),O=t=>t.tables.some(t=>void 0!==t.dogOk)||t.areas.some(t=>t.dogs),v=(t,r)=>r.split('+').every(r=>!!t.tables.find(t=>t.name===r.trim())?.accessible),j=(t,n)=>n.split('+').every(n=>{const o=t.tables.find(t=>t.name===n.trim());return!!o&&(0,r.tableDogOk)(t,o)}),P=(t,r,o,i)=>t.filter(t=>t.id!==i&&t.date===r&&t.time===o&&n(t)).reduce((t,r)=>t+b(r),0);const k=t=>t.replace(/\s*\(substitute day\)/gi,'').trim(),A=t=>'finished'===t.status;function S(t){if('seated'===t.status&&t.seatedAt){const r=new Date(t.seatedAt);if((isNaN(r.getTime())?t.date:r.toLocaleDateString('en-CA',{timeZone:'Europe/London'})){const l=n[e.id],c=u.find(l=>l.allergen===e.id),f='contains'===l?t.colours.redBg:'may'===l?t.colours.amberBg:t.colours.surface2,h='contains'===l?'#FFD9D4':'may'===l?'#FFE2A8':t.colours.muted;return(0,d.jsxs)(s.default,{style:{width:'48%',flexGrow:1,backgroundColor:f,borderRadius:8,padding:8,borderWidth:c?2:1,borderColor:c?t.colours.red:t.colours.border},children:[(0,d.jsx)(o.T,{size:14,weight:"medium",colour:l?h:t.colours.text,children:e.label}),(0,d.jsxs)(o.T,{size:13,colour:h,children:['contains'===l?'Contains':'may'===l?'May contain':'Not listed',c?` \xb7 YOUR ALLERGY (${(0,a.severityLabel)(c.severity)})`:'']})]},e.id)})}),e.allergenNotes?(0,d.jsxs)(o.Muted,{children:["Notes: ",e.allergenNotes]}):null,(0,d.jsx)(s.default,{testID:"allergen-signoff",children:(0,d.jsx)(o.Muted,{children:e.signOff?`From the dish's recipe card. Signed off by ${e.signOff.by} on ${c(e.signOff.at)}.`:"Awaiting the head chef's allergen sign-off: not available to order online."})}),(0,d.jsx)(o.Muted,{children:"Always tell staff about allergies when you order or arrive."})]})},_e.AllergenChips=function({map:e,declared:l}){const n=Object.entries(e);return n.length?(0,d.jsx)(o.Row,{wrap:!0,gap:5,children:n.sort((e,l)=>e[1]===l[1]?0:'contains'===e[1]?-1:1).map(([e,n])=>{const s=l.some(l=>l.allergen===e);return(0,d.jsx)(o.Badge,{label:`${s?'\u26a0 ':''}${(0,a.allergenLabel)(e)}${'may'===n?' (may)':''}`,kind:s?'contains'===n?'red':'amber':'neutral'},e)})}):(0,d.jsx)(o.Muted,{children:"No listed allergens"})},r(_d[0]);var e,l=r(_d[1]),n=r(_d[2]),s=(e=n)&&e.__esModule?e:{default:e},a=r(_d[3]),t=r(_d[4]),o=r(_d[5]),d=r(_d[6]);const c=e=>{const l=new Date(`${e.slice(0,10)}T12:00:00`);return isNaN(+l)?e:l.toLocaleDateString('en-GB',{day:'numeric',month:'long',year:'numeric'})}},829,[30,1033,127,814,821,813,24]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BasketButton=function(){const s=(0,l.useBasket)().lines.reduce((e,s)=>e+s.qty,0);return s?(0,c.jsx)(o.default,{accessibilityRole:"button",accessibilityLabel:`Basket, ${s} items`,onPress:()=>e.router.push('/customer/basket'),style:{backgroundColor:u.colours.gold,borderRadius:999,paddingHorizontal:12,paddingVertical:6},children:(0,c.jsxs)(n.T,{weight:"semibold",colour:u.colours.onGold,size:14,children:["Basket \xb7 ",s]})}):null};var e=r(d[0]);r(d[1]);var s,t=r(d[2]),o=(s=t)&&s.__esModule?s:{default:s},l=r(d[3]),u=r(d[4]),n=r(d[5]),c=r(d[6])},830,[804,30,263,819,821,813,24]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.setRecipeCardRepository=function(n){t=n,r.forEach(t=>t())},e.recipeCards=function(){if(!t)throw new Error('Recipe card repository not set up');return t},Object.defineProperty(e,"hasRecipeCards",{enumerable:!0,get:function(){return n}}),e.onRepositorySwap=function(t){return r.add(t),()=>{r.delete(t)}};let t=null;const r=new Set;const n=()=>!!t},831,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Stars=function({value:e,onChange:s,size:n=36}){return(0,c.jsx)(t.Row,{gap:6,children:[1,2,3,4,5].map(u=>(0,c.jsx)(l.default,{disabled:!s,accessibilityRole:"button",accessibilityLabel:`${u} star${u>1?'s':''}`,onPress:()=>s?.(u),hitSlop:4,children:(0,c.jsx)(t.T,{size:n,colour:u<=e?o.colours.gold:'#555',children:"\u2605"})},u))})},r(d[0]);var e,s=r(d[1]),l=(e=s)&&e.__esModule?e:{default:e},o=r(d[2]),t=r(d[3]),c=r(d[4])},832,[30,263,821,813,24]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"LIVE_VENUE_SLUGS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"LIVE_VENUE_BUILD",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"isLiveVenue",{enumerable:!0,get:function(){return n}});var c=r(d[0]);const b=['anchorage','souters','kirkmichael','wildings','kirkton','abbotsford','greenside',"3idiots","cecchinis","mrbasrais","yasmins","williewastles","rupeeroom","smokinggoat","pizzaioli","drunkencoo"],f=b.includes(c.VENUE_RID),n=c=>b.includes(c)||['6349aa07-3fec-46e9-8c69-7b1b08494793','41ce63ca-ae46-432d-a5ba-25e1b801e64d','43c8da91-b8b8-4ce9-9ab7-f00c84c5f4f6','47f86b36-4c99-466a-be9c-30eb3d79f1e1','e0afad1d-cbc1-414a-add6-92e47d302139','24624ea5-d1e3-4182-b0d1-73402b8a1532','1bc2a056-2ef6-4585-abfd-b7d21c84f215',"59766322-119e-4036-a18a-f6909f60a8d2","596c6f7e-9797-4e16-84fe-db4a99fa1bdc","5d500571-e205-4ead-bb58-60e986b6f40e","f43f20ad-55d0-4008-88c8-7738dc1698df","6abc2793-93ab-4e23-a705-b4011a5cc011","78bff97d-5f07-440a-bb99-f6a6118da7a3","cd985ff5-2443-458d-ac8b-342d553628cf","35f870fc-772c-4aad-bb9e-09a9a16bc925","f500ef12-b405-438b-9671-e54289bec5dd"].includes(c)},833,[5]); +__d(function(_g,r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.MockPay=function({visible:e,onClose:j,amount:p,restaurantId:b,allowGiftCard:x=!0,onPaid:f,title:g="Pay"}){const y=(0,o.useGiftCards)(b).filter(e=>e.balance>0),[m,w]=(0,s.useState)(),[P,C]=(0,s.useState)('Test card \u2022\u2022\u2022\u2022 4242'),[T,M]=(0,s.useState)(!1),_=y.find(e=>e.code===m),v=_?Math.min(_.balance,p):0,R=p-v;return(0,h.jsxs)(u.Sheet,{visible:e,onClose:j,title:g,children:[(0,h.jsx)(u.DemoPaymentNotice,{}),x&&y.length>0?(0,h.jsxs)(l.default,{style:{gap:6},children:[(0,h.jsx)(u.T,{weight:"semibold",children:"Use a gift card"}),(0,h.jsxs)(u.Row,{wrap:!0,children:[(0,h.jsx)(u.Chip,{label:"None",selected:!m,onPress:()=>w(void 0)}),y.map(e=>(0,h.jsx)(u.Chip,{label:`${e.code.slice(0,8)}\u2026`,sub:`${(0,n.gbp)(e.balance)} left`,selected:m===e.code,onPress:()=>w(e.code)},e.id))]})]}):null,(0,h.jsx)(u.T,{weight:"semibold",children:"Payment method"}),(0,h.jsx)(u.Row,{wrap:!0,children:['Test card \u2022\u2022\u2022\u2022 4242','Apple Pay (test)','Google Pay (test)'].map(e=>(0,h.jsx)(u.Chip,{label:e,selected:P===e,onPress:()=>C(e)},e))}),(0,h.jsxs)(l.default,{style:{gap:2},children:[(0,h.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(u.Muted,{children:"Amount"}),(0,h.jsx)(u.T,{children:(0,n.gbp)(p)})]}),v?(0,h.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(u.Muted,{children:"Gift card"}),(0,h.jsxs)(u.T,{colour:c.colours.ok,children:["\u2212",(0,n.gbp)(v)]})]}):null,(0,h.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(u.T,{weight:"semibold",children:"To pay now"}),(0,h.jsx)(u.T,{weight:"bold",size:20,colour:c.colours.gold,children:(0,n.gbp)(R)})]})]}),T?(0,h.jsx)(t.default,{color:c.colours.gold}):(0,h.jsx)(u.Button,{label:`Pay ${(0,n.gbp)(R)} \u2014 demo`,onPress:()=>{M(!0),setTimeout(()=>{M(!1),f({giftCardCode:m,giftApplied:v,method:P})},700)},testID:"mock-pay-confirm"})]})};var s=r(d[0]),t=e(r(d[1])),l=e(r(d[2])),o=r(d[3]),n=r(d[4]),c=r(d[5]),u=r(d[6]),h=r(d[7])},834,[30,246,127,819,816,821,813,24]); +__d(function(_g,_r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.GiftLive=function({slug:e,venue:n}){const{info:x,mine:b,err:S,load:w,pay:k}=j(e),[T,P]=(0,t.useState)(null),[D,C]=(0,t.useState)(''),[O,$]=(0,t.useState)(''),[v,B]=(0,t.useState)(''),[I,M]=(0,t.useState)(''),[E,L]=(0,t.useState)(!1),[R,A]=(0,t.useState)(''),[_,H]=(0,t.useState)(null),F=f(e);if(!x)return(0,h.jsx)(a.Screen,{title:"Gift cards",subtitle:n,children:S?(0,h.jsx)(a.Banner,{kind:"warn",title:S}):(0,h.jsx)(a.Muted,{children:"Loading\u2026"})});const N=D?(0,o.poundsToPence)(D)??0:T??x.amounts[1]??x.amounts[0]??0;return(0,h.jsxs)(a.Screen,{title:"Gift cards",subtitle:`${n}: used only at ${n}`,children:[_?(0,h.jsx)(s.default,{testID:"gift-made",children:(0,h.jsx)(a.Card,{highlight:u.colours.gold,children:(0,h.jsxs)(s.default,{style:{gap:6},children:[(0,h.jsx)(a.H2,{children:"Your gift card code"}),(0,h.jsx)(a.T,{size:26,weight:"bold",colour:u.colours.gold,center:!0,children:_.code}),(0,h.jsxs)(a.Muted,{center:!0,children:["Shown once and kept on this phone. Write it down or take a screenshot to give it to ",O||'them',"."]}),(0,h.jsxs)(a.Banner,{kind:"warn",title:`Pay ${(0,l.gbp)(_.pence)} at the bar or till`,children:["Show reference ",_.ref,". The card works once staff mark it paid.",k.cardOn?'':' Card payment in the app is coming soon.']}),(0,h.jsx)(m,{slug:e,kind:"gift",id:_.id,pay:k})]})})}):null,(0,h.jsx)(g,{onDone:w}),(0,h.jsx)(s.default,{testID:"gift-mine",children:(0,h.jsx)(a.Card,{children:(0,h.jsxs)(s.default,{style:{gap:6},children:[(0,h.jsx)(a.H2,{children:"Your gift cards"}),b.cards.length?b.cards.map(t=>(0,h.jsxs)(s.default,{style:{gap:2},children:[(0,h.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(a.T,{style:{flex:1},children:F[t.id]??`\u2022\u2022\u2022\u2022 ${t.last4}`}),(0,h.jsxs)(a.T,{weight:"semibold",colour:u.colours.gold,children:[(0,l.gbp)(t.balancePence)," of ",(0,l.gbp)(t.initialPence)]})]}),(0,h.jsxs)(a.Muted,{size:12,children:[o.STATUS_WORDS[t.status]??t.status,t.expiresAt?` \xb7 use by ${p(t.expiresAt)}`:'','waiting-payment'===t.status?` \xb7 reference ${t.ref}`:'']}),'waiting-payment'===t.status&&_?.id!==t.id?(0,h.jsx)(m,{slug:e,kind:"gift",id:t.id,pay:k}):null]},t.id)):(0,h.jsx)(a.Muted,{children:"None yet."})]})})}),x.giftsOn?(0,h.jsx)(s.default,{testID:"gift-buy",children:(0,h.jsx)(a.Card,{children:(0,h.jsxs)(s.default,{style:{gap:8},children:[(0,h.jsx)(a.H2,{children:"Buy a gift card"}),(0,h.jsx)(a.Row,{wrap:!0,children:x.amounts.map(e=>(0,h.jsx)(a.Chip,{label:(0,l.gbp)(e),selected:!D&&N===e,onPress:()=>{C(''),P(e)}},e))}),(0,h.jsx)(a.Field,{label:`Or another amount (\xa3${x.minPence/100} to \xa3${x.maxPence/100})`,keyboardType:"decimal-pad",value:D,onChangeText:C,placeholder:"e.g. 40",testID:"gift-custom"}),(0,h.jsx)(a.Field,{label:"Who it\u2019s for",value:O,onChangeText:$,testID:"gift-recipient"}),(0,h.jsx)(a.Field,{label:"From",value:v,onChangeText:B}),(0,h.jsx)(a.Field,{label:"Message",value:I,onChangeText:M,multiline:!0,placeholder:"Happy birthday!"}),(0,h.jsxs)(a.Muted,{size:12,children:["Use within ",(0,o.expiryWords)(x.expiryMonths)," of paying. Part-use leaves a balance.",x.terms?` ${x.terms}`:'']}),(0,h.jsx)(s.default,{testID:"gift-pay-placeholder",children:(0,h.jsx)(a.Banner,{kind:"demo",title:"Payment",children:o.PAY_PLACEHOLDER})}),R?(0,h.jsx)(a.Banner,{kind:"warn",title:R}):null,(0,h.jsx)(a.Button,{label:E?'Saving\u2026':`Get a ${(0,l.gbp)(N)} gift card, pay at the till`,testID:"gift-buy-btn",disabled:E||Nx.maxPence,onPress:async()=>{L(!0),A('');try{const t=await(0,c.buyGift)(e,{amount:N,recipient:O,from:v,message:I});t.code&&y(e,t.id,t.code),H({id:t.id,code:t.code??'',ref:t.ref,pence:t.initialPence}),w()}catch(e){A((0,r.plainError)(e))}finally{L(!1)}}})]})})}):(0,h.jsx)(a.Banner,{kind:"demo",title:`${n} isn\u2019t selling gift cards in the app yet`,children:"Ask at the bar."})]})},_e.ShopLive=function({slug:e,venue:n,guestName:p}){const{info:x,mine:f,err:y,load:b,pay:S}=j(e),[w,k]=(0,t.useState)({}),[T,P]=(0,t.useState)(p),[D,C]=(0,t.useState)(!1),[O,$]=(0,t.useState)(''),[v,B]=(0,t.useState)(null);if(!x)return(0,h.jsx)(a.Screen,{title:"Shop",subtitle:n,children:y?(0,h.jsx)(a.Banner,{kind:"warn",title:y}):(0,h.jsx)(a.Muted,{children:"Loading\u2026"})});const I=Object.entries(w).filter(([,e])=>e>0).map(([e,t])=>({id:e,qty:t})),M=(0,o.basketTotal)(I,x.products);return(0,h.jsxs)(a.Screen,{title:"Shop",subtitle:`${n}: collect at the venue`,children:[v?(0,h.jsxs)(s.default,{testID:"shop-done",children:[(0,h.jsxs)(a.Banner,{kind:"warn",title:`Order ${v.ref}: pay ${(0,l.gbp)(v.total)} at the bar or till`,children:["Staff will have it ready to collect once it\u2019s paid.",S.cardOn?'':' Card payment in the app is coming soon.']}),(0,h.jsx)(m,{slug:e,kind:"shop",id:v.id,pay:S})]}):null,(0,h.jsx)(g,{onDone:b}),x.shopOn?(0,h.jsxs)(h.Fragment,{children:[x.products.length?x.products.map(e=>(0,h.jsx)(s.default,{testID:`shop-item-${e.id}`,children:(0,h.jsx)(a.Card,{children:(0,h.jsxs)(s.default,{style:{gap:4},children:[(0,h.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(a.T,{weight:"semibold",style:{flex:1},children:e.name}),(0,h.jsx)(a.T,{colour:u.colours.gold,children:(0,l.gbp)(e.pricePence)})]}),e.details?(0,h.jsx)(a.Muted,{children:e.details}):null,e.soldOut?(0,h.jsx)(a.Badge,{kind:"amber",label:"Sold out"}):(0,h.jsxs)(a.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,h.jsx)(a.Muted,{children:"How many"}),(0,h.jsx)(a.Stepper,{value:w[e.id]??0,min:0,max:20,label:`${e.name} quantity`,onChange:t=>k({...w,[e.id]:t})})]})]})})},e.id)):(0,h.jsx)(a.Muted,{children:"Nothing in the shop yet."}),I.length?(0,h.jsx)(s.default,{testID:"shop-basket",children:(0,h.jsx)(a.Card,{children:(0,h.jsxs)(s.default,{style:{gap:6},children:[(0,h.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(a.T,{weight:"semibold",children:"Total"}),(0,h.jsx)(a.T,{weight:"semibold",colour:u.colours.gold,children:(0,l.gbp)(M)})]}),(0,h.jsx)(a.Field,{label:"Name for collection",value:T,onChangeText:P,testID:"shop-name"}),(0,h.jsx)(a.Banner,{kind:"demo",title:"Payment",children:o.PAY_PLACEHOLDER}),O?(0,h.jsx)(a.Banner,{kind:"warn",title:O}):null,(0,h.jsx)(a.Button,{label:D?'Sending\u2026':'Order, pay at the till',testID:"shop-order-btn",disabled:D||!T.trim(),onPress:async()=>{C(!0),$('');try{const t=await(0,c.shopOrder)(e,I,T);B({id:t.id,ref:t.ref,total:t.totalPence}),k({}),b()}catch(e){$((0,r.plainError)(e))}finally{C(!1)}}})]})})}):null]}):(0,h.jsx)(a.Banner,{kind:"demo",title:`${n}\u2019s shop isn\u2019t open in the app yet`,children:"Ask at the bar."}),f.orders.length?(0,h.jsx)(s.default,{testID:"shop-mine",children:(0,h.jsx)(a.Card,{children:(0,h.jsxs)(s.default,{style:{gap:4},children:[(0,h.jsx)(a.H2,{children:"Your shop orders"}),f.orders.map(e=>(0,h.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsxs)(a.T,{style:{flex:1},children:[e.ref," \xb7 ",e.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')]}),(0,h.jsx)(a.Muted,{children:o.STATUS_WORDS[e.status]??e.status})]},e.ref))]})})}):null]})};var e,t=_r(d[0]),n=_r(d[1]),s=(e=n)&&e.__esModule?e:{default:e},a=_r(d[2]),l=_r(d[3]),r=_r(d[4]),o=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]);const p=e=>{if(!e)return'';try{return new Date(e).toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric',timeZone:'Europe/London'})}catch{return e.slice(0,10)}},x=e=>`cc-gift-codes:${e}:v1`;function f(e){try{return JSON.parse(globalThis.localStorage?.getItem(x(e))||'{}')}catch{return{}}}function y(e,t,n){try{const s=f(e);s[t]=n,globalThis.localStorage?.setItem(x(e),JSON.stringify(s))}catch{}}function j(e){const[n,s]=(0,t.useState)(null),[a,l]=(0,t.useState)({cards:[],orders:[]}),[o,u]=(0,t.useState)(''),[h,p]=(0,t.useState)({provider:'none',cardOn:!1,testMode:!0}),x=(0,t.useCallback)(()=>{u(''),(0,c.shopPublic)(e).then(s).catch(e=>u((0,r.plainError)(e))),(0,c.myShop)(e).then(l).catch(()=>{}),(0,c.payPublic)(e).then(p)},[e]);return(0,t.useEffect)(()=>{x()},[x]),{info:n,mine:a,err:o,load:x,pay:h}}function g({onDone:e}){const[n,l]=(0,t.useState)('');return(0,t.useEffect)(()=>{const t='undefined'!=typeof window?new URLSearchParams(window.location.search).get('paid'):null;if(!t||!/^[0-9a-f-]{36}$/.test(t))return;let n=0;const s=()=>(0,c.payStatus)(t).then(t=>{l(t.status),'paid'===t.status?e():n++<10&&setTimeout(s,2e3)}).catch(()=>{});s()},[e]),n?(0,h.jsx)(s.default,{testID:"pay-back",children:(0,h.jsx)(a.Banner,{kind:'paid'===n?'success':'warn',title:'paid'===n?'Paid by card (TEST MODE: no real money)':'expired'===n?'The card payment timed out. Pay at the bar or till.':'Checking the card payment\u2026'})}):null}function m({slug:e,kind:n,id:l,pay:o}){const[u,p]=(0,t.useState)(!1),[x,f]=(0,t.useState)('');return o.cardOn?(0,h.jsxs)(s.default,{testID:`pay-card-${n}`,style:{gap:4},children:[(0,h.jsx)(a.Button,{label:u?'Opening card payment\u2026':'Pay by card (TEST MODE)',kind:"secondary",disabled:u,onPress:async()=>{p(!0),f('');try{const t=await(0,c.payStart)(e,n,l);window.location.assign(t.url)}catch(e){f((0,r.plainError)(e))}finally{p(!1)}}}),(0,h.jsx)(a.Muted,{size:12,children:"Test mode: use a Stripe test card. No real money is taken."}),x?(0,h.jsx)(a.Banner,{kind:"warn",title:x}):null]}):null}},835,[30,127,813,816,1015,1016,1017,821,24]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"guestServer",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"staffServer",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"useGuestLoyalty",{enumerable:!0,get:function(){return _}}),e.refreshGuest=async function(t){if(!c())return;_.setState(n=>({loading:{...n.loading,[t]:!0}}));try{const n=await(0,o.rpc)('loyalty_public',{p_venue_slug:t});if(_.setState(r=>({info:{...r.info,[t]:n}})),await(0,o.guestSession)()){const n=await(0,o.rpc)('loyalty_my_card',{p_venue_slug:t});_.setState(r=>({card:{...r.card,[t]:n??null}}))}}finally{_.setState(n=>({loading:{...n.loading,[t]:!1}}))}},e.guestJoin=async function(t,n){if(!await(0,o.guestSession)())throw new Error('No connection. Try again when you are back online.');const r=await(0,o.rpc)('loyalty_guest_join',{p_venue_slug:t,p_name:n.name.trim(),p_phone:n.phone.trim()||null,p_email:n.email.trim()||null,p_consent:n.consent,p_consent_text:n.consentText,p_referral:n.referral?(0,l.cleanCode)(n.referral):null});return p(t,r),r},e.guestClaim=async function(t,n){if(!await(0,o.guestSession)())return{ok:!1,error:'No connection. Try again when you are back online.'};const r=await(0,o.rpc)('loyalty_guest_claim',{p_venue_slug:t,p_code:(0,l.cleanCode)(n)});return r?.error?{ok:!1,error:String(r.error)}:(p(t,r),{ok:!0,card:r,linked:!!r.linked})},e.guestLinkCode=async function(t){return(0,o.rpc)('loyalty_guest_link_code',{p_venue_slug:t})},e.guestLeave=async function(t){await(0,o.rpc)('loyalty_guest_leave',{p_venue_slug:t}),p(t,null)},Object.defineProperty(e,"staffFind",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"staffCard",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"staffStamp",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"staffRedeem",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"staffJoin",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"staffCode",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"staffRemove",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"loyaltySummary",{enumerable:!0,get:function(){return P}}),e.readSettings=async function(){const{data:t,error:n}=await u().from('loyalty_settings').select('*').eq('venue_id',y()).maybeSingle();if(n)throw n;return(0,l.settingsFromRow)(t)},e.saveSettings=async function(t){const{error:n}=await u().from('loyalty_settings').upsert({venue_id:y(),...(0,l.settingsToRow)(t),updated_by:(o.useSync.getState().staffRef??'').slice(0,80)||'manager',updated_at:(new Date).toISOString()},{onConflict:'venue_id'});if(n)throw n},e.readOffers=k,e.saveOffer=C,e.watchLoyalty=function(t){if(!f())return()=>{};const n=y();let r=u().channel(`cc-loyalty:${n}:${Math.random().toString(36).slice(2,8)}`);for(const o of['loyalty_settings','loyalty_offers','loyalty_guests','loyalty_stamps','loyalty_rewards','loyalty_referrals'])r=r.on('postgres_changes',{event:'*',schema:'public',table:o,filter:`venue_id=eq.${n}`},()=>t());return r.subscribe(),()=>{try{u().removeChannel(r)}catch{}}},e.migrateLocalOnce=async function(t,n,r){if(!f())return 0;const o=`loyalty:migrated:${y()}`;if(await n(o))return 0;let s=0;if(!(await k()).length)for(const n of t.offers.filter(t=>'offer'===t.kind&&!JSON.stringify(t).includes('(example)')))await C({title:n.title.slice(0,80),details:(n.body??'').slice(0,500),startsOn:null,endsOn:n.until??null,isOn:!!n.live}),s++;return await r(o),s};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]),o=_r(d[3]),s=_r(d[4]),l=_r(d[5]);const u=()=>(0,n.getSupabase)(),c=()=>(0,r.isSupabaseConfigured)()&&!s.PITCH,f=()=>c()&&'staff'===o.useSync.getState().kind&&!!o.useSync.getState().venueId,y=()=>{const t=o.useSync.getState().venueId;if(!t)throw new Error('Not connected to the venue yet.');return t},_=(0,t.create)(()=>({info:{},card:{},loading:{}}));const p=(t,n)=>_.setState(r=>({card:{...r.card,[t]:n}}));const b=t=>(0,o.rpc)('loyalty_staff_find',{p_venue:y(),p_q:t}),w=t=>(0,o.rpc)('loyalty_staff_card',{p_guest:t}),v=t=>(0,o.rpc)('loyalty_staff_stamp',{p_guest:t}),S=t=>(0,o.rpc)('loyalty_staff_redeem',{p_reward:t}),O=t=>(0,o.rpc)('loyalty_staff_join',{p_venue:y(),p_name:t.name.trim(),p_phone:t.phone.trim()||null,p_email:t.email.trim()||null,p_consent:t.consent,p_consent_text:t.consentText}),h=(t,n)=>(0,o.rpc)('loyalty_staff_code',{p_venue:y(),p_kind:t,p_guest:n??null}),j=t=>(0,o.rpc)('loyalty_staff_remove',{p_guest:t}),P=()=>(0,o.rpc)('loyalty_summary',{p_venue:y()});async function k(){const{data:t,error:n}=await u().from('loyalty_offers').select('*').eq('venue_id',y()).order('created_at');if(n)throw n;return(t??[]).map(l.offerFromRow)}async function C(t){const n={venue_id:y(),title:t.title.trim(),details:t.details.trim(),starts_on:t.startsOn||null,ends_on:t.endsOn||null,is_on:t.isOn,updated_at:(new Date).toISOString()},{error:r}=t.id?await u().from('loyalty_offers').update(n).eq('id',t.id):await u().from('loyalty_offers').insert(n);if(r)throw r}},836,[952,863,1096,820,2,1015]); +__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.SoutersCustomerHome=function(){const[e,n]=(0,t.useState)(!1),[p,m]=(0,t.useState)(!1),[b,y]=(0,t.useState)('All'),S=(0,h.useMenu)('souters'),M=(0,t.useMemo)(()=>['All',...Array.from(new Set(S.map(e=>e.section)))],[S]),k=S.filter(e=>'All'===b||e.section===b);if(e)return(0,j.jsx)(u.Screen,{title:"Souter's Inn",back:!1,children:(0,j.jsx)(c.VenueRequestForm,{rid:"souters",kind:"table",onClose:()=>n(!1)})});if(p)return(0,j.jsxs)(u.Screen,{title:"Menu",subtitle:"Souter's Inn",back:!1,children:[(0,j.jsx)(u.Button,{kind:"ghost",label:"\u2039 Back",onPress:()=>m(!1)}),(0,j.jsxs)(u.Muted,{children:[x.SOUTERS_MENU_COUNT," dishes. Please speak to staff about allergens \u2014 nothing is signed off for ordering yet."]}),(0,j.jsx)(u.Row,{wrap:!0,gap:6,children:M.slice(0,12).map(e=>(0,j.jsx)(u.Chip,{label:e,selected:b===e,onPress:()=>y(e)},e))}),k.map(e=>(0,j.jsx)(o.default,{testID:`souters-dish-${e.id}`,children:(0,j.jsxs)(u.Card,{children:[(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,j.jsx)(u.T,{weight:"semibold",style:{flex:1},children:e.name}),(0,j.jsx)(u.T,{children:null==e.price?e.priceNote||'Ask staff':(0,f.gbp)(e.price)})]}),e.description?(0,j.jsx)(u.Muted,{children:e.description}):null,(0,j.jsx)(u.Muted,{children:"Awaiting allergen sign-off \xb7 not orderable yet"})]})},e.id))]});return(0,j.jsxs)(u.Screen,{title:"Souter's Inn",subtitle:"Kirkoswald \xb7 Southern Ayr",children:[(0,j.jsx)(l.RestaurantHero,{rid:"souters",size:160}),(0,j.jsx)(s.FindPub,{rid:"souters"}),(0,j.jsx)(u.Card,{children:(0,j.jsxs)(o.default,{testID:"souters-book-table",style:{gap:8},children:[(0,j.jsx)(u.T,{weight:"bold",children:"Book a table"}),(0,j.jsx)(u.Muted,{children:"Send a request to the venue. No deposit and no payment here \u2014 staff will confirm."}),(0,j.jsx)(u.Button,{label:"Book a table",onPress:()=>n(!0)})]})}),(0,j.jsx)(u.Card,{children:(0,j.jsxs)(o.default,{testID:"souters-menu-card",style:{gap:8},children:[(0,j.jsx)(u.T,{weight:"bold",children:"Menu"}),(0,j.jsxs)(u.Muted,{children:[x.SOUTERS_MENU_COUNT," dishes from the venue menus. Allergen information is not signed off yet \u2014 please speak to staff about allergens. Ordering stays off until the Head Chef signs each dish off."]}),(0,j.jsx)(u.Button,{kind:"secondary",label:"Browse the menu",onPress:()=>m(!0)})]})}),(0,j.jsx)(u.Muted,{children:"Table deposits are not set. Closing time (9pm or 10pm) to confirm. No payment is taken here."})]})},_e.SoutersStaffHome=function({app:e}){return(0,j.jsxs)(o.default,{testID:"souters-setup-home",style:{flex:1,padding:24,justifyContent:'center',gap:16,maxWidth:680,width:'100%',alignSelf:'center'},children:[(0,j.jsx)(l.RestaurantHero,{rid:"souters",size:180}),(0,j.jsx)(u.T,{size:24,weight:"bold",center:!0,children:e}),(0,j.jsxs)(u.Card,{children:[(0,j.jsx)(u.T,{weight:"bold",children:"Ready for venue setup"}),(0,j.jsx)(u.Muted,{children:"Contact: souters@southernayr.com \xb7 01655 760653. No named manager or staff list yet \u2014 no personal links have been created."})]}),(0,j.jsx)(u.Muted,{center:!0,children:"Areas are set (Restaurant, Bar, Mezzanine, Beer garden, Ice cream & cake corner). Table plan to confirm \u2014 no sample tables. Menu seeded without allergen sign-off."}),(0,j.jsx)(u.Muted,{center:!0,children:"Guests request a table in the Customer app. Proposed closing time to confirm."})]})};var e,s=r(d[0]),t=r(d[1]),n=r(d[2]),o=(e=n)&&e.__esModule?e:{default:e},l=r(d[3]),u=r(d[4]),c=r(d[5]),h=r(d[6]),f=r(d[7]),x=r(d[8]),j=r(d[9])},854,[862,30,127,861,813,864,819,816,1135,24]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"LAUNCHER_LINE",{enumerable:!0,get:function(){return u}}),_e.LauncherLine=function(){return(0,c.jsx)(l.default,{style:{borderTopWidth:1,borderColor:n.colours.border,paddingTop:10,marginTop:4},children:(0,c.jsx)(s.Muted,{center:!0,children:u})})},_e.HubTile=function({icon:e,label:u,sub:h,onPress:p,badge:f}){return(0,c.jsxs)(o.default,{accessibilityRole:"button",accessibilityLabel:u,onPress:p,style:({pressed:e})=>({flexBasis:'30%',flexGrow:1,maxWidth:'31.5%',minWidth:96,backgroundColor:e?'#1d1a14':n.colours.surface,borderRadius:14,borderWidth:1,borderColor:n.colours.border,padding:10,gap:2,alignItems:'center'}),children:[b.includes(e)?(0,c.jsx)(t.Icon,{name:e,size:24,colour:n.colours.gold}):(0,c.jsx)(s.T,{size:22,children:e}),(0,c.jsx)(s.T,{size:13,weight:"semibold",center:!0,children:u}),h?(0,c.jsx)(s.T,{size:11,colour:n.colours.muted,center:!0,children:h}):null,f?(0,c.jsx)(l.default,{style:{position:'absolute',top:6,right:6,backgroundColor:n.colours.gold,borderRadius:8,paddingHorizontal:5},children:(0,c.jsx)(s.T,{size:10,weight:"bold",colour:n.colours.onGold,children:f})}):null]})},r(d[0]);var o=e(r(d[1])),l=e(r(d[2])),s=r(d[3]),n=r(d[4]),t=r(d[5]),c=r(d[6]);const u='Card payments: not set up yet';const b=['bag','phone','box','calendarPlus','clock','star','userPlus','gift','alert','tag','sparkle','chat','hanger']},855,[30,263,127,813,821,1007,24]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"attStatus",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"isConfirmed",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"timesheetRemote",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"weekdayOf",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"addDays",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"mondayOfDate",{enumerable:!0,get:function(){return I}}),Object.defineProperty(_e,"shiftsOn",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"shiftOf",{enumerable:!0,get:function(){return E}}),Object.defineProperty(_e,"visibleShifts",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"SUPPLIER_CATS",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"NLW_PENCE",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"MAX_CUSTOM_LINKS",{enumerable:!0,get:function(){return R}}),Object.defineProperty(_e,"WIX_IDS",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"isWixLink",{enumerable:!0,get:function(){return L}}),Object.defineProperty(_e,"DEFAULT_QUICK_LINKS",{enumerable:!0,get:function(){return T}}),_e.openShiftOf=$,_e.loggedBreakMins=D,Object.defineProperty(_e,"isOnBreak",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"DISPLAY_CLOCK_DEFAULT",{enumerable:!0,get:function(){return N}}),Object.defineProperty(_e,"useOwner",{enumerable:!0,get:function(){return V}}),Object.defineProperty(_e,"wageLabel",{enumerable:!0,get:function(){return q}}),Object.defineProperty(_e,"ROLE_LABEL",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"CAN",{enumerable:!0,get:function(){return K}}),_e.staffLabel=function(e){const t=e.nickname?.trim(),n=e.name.replace(/\s*\(([^)]*)\)\s*$/,(e,n)=>t&&n.trim().toLowerCase()===t.toLowerCase()?'':e);return t?`${n} (${t})`:n},Object.defineProperty(_e,"staffCalls",{enumerable:!0,get:function(){return W}}),Object.defineProperty(_e,"staffCalled",{enumerable:!0,get:function(){return F}}),Object.defineProperty(_e,"staffMatches",{enumerable:!0,get:function(){return G}});var e,t=_r(_d[0]),n=_r(_d[1]),a=_r(_d[2]),i=_r(_d[3]),s=_r(_d[4]),r=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),c=(e=d)&&e.__esModule?e:{default:e},u=_r(_d[8]),f=_r(_d[9]),l=_r(_d[10]),p=_r(_d[11]);const m=e=>e.out?e.signOff?'confirmed':'awaiting':'open',g=e=>!!e.out&&!!e.signOff,h={send:null},b=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`,k=e=>{const[t,n,a]=e.split('-').map(Number);return(new Date(t,n-1,a).getDay()+6)%7},y=(e,t)=>{const[n,a,i]=e.split('-').map(Number);return b(new Date(n,a-1,i+t))},I=e=>y(e,-k(e)),w=(e,t)=>e.filter(e=>e.date===t),E=(e,t,n)=>e.find(e=>e.staffId===t&&e.date===n),S=(e,t)=>t?e:e.filter(e=>e.published),O=['Fish & seafood','Meat','Fruit & veg','Dairy','Dry goods','Drinks/brewery','Cleaning','Packaging','Equipment/maintenance'],v=1271,R=6,_=['ql-wix-view','ql-wix-edit'],L=e=>_.includes(e.id)||'Website bookings'===e.group,T=[{id:'ql-gmail',label:'Work email (Gmail)',url:'',icon:'\u2709\ufe0f',kind:'gmail',staff:!1,builtIn:!0},{id:'ql-wix-view',label:'View site',url:'https://www.anchoragedunure.com',icon:'\ud83c\udf10',kind:'link',group:'Website bookings',staff:!1,builtIn:!0},{id:'ql-wix-edit',label:'Edit site',url:'https://manage.wix.com',icon:'\ud83d\udd8a\ufe0f',kind:'link',group:'Website bookings',staff:!1,builtIn:!0}];function $(e,t,n){const a=new Date(n).getTime();return e.filter(e=>e.staffId===t&&e.in&&!e.out&&a-new Date(e.in).getTime()<72e6).sort((e,t)=>t.in.localeCompare(e.in))[0]}function D(e,t=new Date){const n=new Date(t).getTime();return Math.round((e.breaks??[]).reduce((e,t)=>e+Math.max(0,(t.end?new Date(t.end).getTime():n)-new Date(t.start).getTime()),0)/6e4)}const P=e=>!!e?.breaks?.some(e=>!e.end),A=e=>`${e}-${Math.random().toString(36).slice(2,8)}`,M=['#2A3B4C','#4A3A22','#40362A','#3E2A2A','#2E2E40'];function j(){return l.ROSTER.map(e=>({id:e.id,name:e.name,...e.nickname?{nickname:e.nickname}:{},role:e.role,job:e.job,active:!0,level:e.level,dept:e.dept,salaried:e.salaried,noTax:e.noTax,...N.includes(e.id)?{displayClock:!0}:{}}))}const N=['st-jack'];function C(){return Object.fromEntries(l.ROSTER.filter(e=>null!=e.hourlyPence).map(e=>[e.id,e.hourlyPence]))}const U=()=>{const e={tronc:{method:'hours',points:{FOH:1,Bar:1,Kitchen:.8,KP:.6,Manager:1},includeManagers:!0,includeOwner:!1,custom:{},text:'The Anchorage tipping policy (template)\n\n1. 100% of tips paid by card and cash tips put in the tip jar go to staff. Nothing is deducted.\n2. Tips are pooled and shared by paid hours worked in each pay period (breaks excluded).\n3. The owner does not take a share. Managers share only for hours worked on the floor or in the kitchen.\n4. Tips are paid with wages, no later than the end of the month after the tip was paid.\n5. Tip records are kept for 3 years. Ask a manager for your records at any time.'},troncCash:{},troncHistory:[],troncLog:[],chat:[],chatMuted:{},referral:{giverReward:'Free dessert',friendReward:'\xa35 off first order',active:!0},referrals:[],reminders:{h24:!0,h2:!0,confirmText:!0},coats:[],merch:[],merchOrders:[],marketingDraft:void 0,socialAccounts:{facebook:!0,instagram:!0,tiktok:!0,youtube:!0},socialPosts:[],socialDraft:void 0,quickLinks:T.map(e=>({...e})),workEmail:'',staff:j(),rosterVersion:l.ROSTER_VERSION,previewRole:'owner',staffAs:l.ROSTER.find(e=>'staff'===e.app)?.id??l.ROSTER[0]?.id??'',offers:[],photos:[],changeRequests:[],changesUsed:2,site:t.VENUE_RID,branding:{},checks:{},lost:[],lostReports:[],campaigns:[],shifts:[],rotaPublished:void 0,leave:[],swaps:[],availability:{},attendance:[],attLog:[],timeRequests:[],geofence:{lat:55.4047,lng:-4.7606,radius:100},simLocation:'venue',consent:{},hourly:C(),payPeriod:'weekly',suppliers:[],supplierOrders:[],staffCanViewSuppliers:!1,readNotes:{},customerTags:{'cust-demo':['Allergy','Regular'],'cr-2':['VIP'],'cr-5':['Takeaway']}};if(s.LIVE_VENUE_BUILD&&!t.IS_ISOLATED_VENUE)return{...e,changesUsed:0,customerTags:{},socialAccounts:{facebook:!1,instagram:!1,tiktok:!1,youtube:!1},referral:{...e.referral,active:!1}};if(!t.IS_ISOLATED_VENUE)return e;for(const t of Object.keys(e))Array.isArray(e[t])&&(e[t]=[]);return{...e,site:t.VENUE_RID,staffAs:'',hourly:{},customerTags:{},geofence:{lat:0,lng:0,radius:100},tronc:{...e.tronc,text:t.IS_QUEUED_VENUE?n.queuedVenues[t.VENUE_RID].name+' tipping policy \u2014 to confirm.':t.IS_ABBOTSFORD?'The Abbotsford Hotel tipping policy \u2014 awaiting venue confirmation.':t.IS_KIRKTON?'The Kirkton Inn tipping policy \u2014 awaiting venue confirmation.':t.IS_GREENSIDE?'The Greenside Restaurant tipping policy \u2014 awaiting venue confirmation.':t.IS_WILDINGS?'Wildings Hotel & Restaurant tipping policy \u2014 awaiting venue confirmation.':t.IS_KIRKMICHAEL?"The Kirkmichael Arms tipping policy \u2014 awaiting venue confirmation.":"Souter's Inn tipping policy \u2014 awaiting venue confirmation."},changesUsed:0,socialAccounts:{facebook:!1,instagram:!1,tiktok:!1,youtube:!1},referral:{...e.referral,active:!1},quickLinks:t.IS_QUEUED_VENUE||t.IS_ABBOTSFORD||t.IS_KIRKTON?[]:t.IS_GREENSIDE?[{id:'greenside-phone',label:'Call 01655 889685',url:'tel:01655889685',icon:'',kind:'link',group:'Bookings',staff:!0,builtIn:!0}]:t.IS_WILDINGS?[{id:'wildings-phone',label:'Call to book',url:'tel:01655331401',icon:'\ud83c\udf10',kind:'link',group:'Bookings',staff:!0,builtIn:!0},{id:'wildings-email',label:'Email to book',url:'mailto:bookings@wildingsrestaurant-hotel.co.uk',icon:'\ud83c\udf10',kind:'link',group:'Bookings',staff:!0,builtIn:!0}]:t.IS_KIRKMICHAEL?[{id:'kirkmichael-site',label:'Venue website',url:'https://www.kirkmichaelarms.co.uk/',icon:'\ud83c\udf10',kind:'link',group:'Website',staff:!0,builtIn:!0}]:[{id:'souters-book',label:'Guest table requests',url:'https://covercharge-apps.static.hf.space/souters/customer-app/',icon:'\ud83c\udf10',kind:'link',group:'Bookings',staff:!0,builtIn:!0}],branding:{[t.VENUE_RID]:{accent:t.IS_QUEUED_VENUE?n.queuedVenues[t.VENUE_RID].branding.accent:t.IS_ABBOTSFORD?'#B89362':t.IS_KIRKTON?'#B46C54':t.IS_GREENSIDE?a.GREENSIDE_PALETTE.gold:t.IS_WILDINGS?'#FFE3A5':t.IS_KIRKMICHAEL?'#B87754':'#A4622E'}}}},V=(0,u.create)()((0,f.persist)((e,n)=>({...U(),setPreviewRole:t=>e({previewRole:t}),addStaff:(t,n,a)=>e(e=>({staff:[...e.staff,{id:A('st'),name:t,role:n,job:a,active:!0,level:x[n]}]})),saveSupplier:t=>e(e=>({suppliers:e.suppliers.some(e=>e.id===t.id)?e.suppliers.map(e=>e.id===t.id?t:e):[...e.suppliers,t]})),setRate:(t,n)=>e(e=>({hourly:{...e.hourly,[t]:Math.max(0,Math.round(n))}})),clearRate:t=>e(e=>{const n={...e.hourly};return delete n[t],{hourly:n}}),updateStaff:(t,n)=>e(e=>({staff:e.staff.map(e=>e.id===t?{...e,...n}:e)})),addOffer:t=>e(e=>({offers:[{...t,id:A('of')},...e.offers]})),updateOffer:(t,n)=>e(e=>({offers:e.offers.map(e=>e.id===t?{...e,...n}:e)})),addPhoto:t=>e(e=>({photos:[...e.photos,{id:A('ph'),caption:t,tone:M[e.photos.length%M.length]}]})),removePhoto:t=>e(e=>({photos:e.photos.filter(e=>e.id!==t)})),requestChange:(t,n)=>e(e=>e.changesUsed>=5?e:{changesUsed:e.changesUsed+1,changeRequests:[{id:A('cr'),text:t,at:n,status:'requested'},...e.changeRequests]}),setSite:n=>e({site:t.IS_ISOLATED_VENUE?t.VENUE_RID:n}),setBranding:(t,n)=>e(e=>{const a={...e.branding};return n?a[t]={...a[t],...n}:delete a[t],{branding:a}}),setOwner:t=>e(t),addSocialPost:t=>e(e=>({socialPosts:[{...t,id:A('sp')},...e.socialPosts]})),setSocialPost:(t,n)=>e(e=>({socialPosts:e.socialPosts.map(e=>e.id===t?{...e,...n}:e)})),chatSend:t=>e(e=>({chat:[...e.chat,{...t,id:(0,p.uuid)(),reactions:{},seenBy:t.seenBy??('system'===t.from?[]:[t.from])}]})),chatReact:(t,n,a)=>e(e=>({chat:e.chat.map(e=>{if(e.id!==t)return e;const i=e.reactions[n]??[];return{...e,reactions:{...e.reactions,[n]:i.includes(a)?i.filter(e=>e!==a):[...i,a]}}})})),chatSeen:(t,n)=>e(e=>e.chat.some(e=>e.ch===t&&!e.seenBy.includes(n))?{chat:e.chat.map(e=>e.ch!==t||e.seenBy.includes(n)?e:{...e,seenBy:[...e.seenBy,n]})}:e),chatPatch:(t,n)=>e(e=>({chat:e.chat.map(e=>e.id===t?{...e,...n}:e)})),chatMute:(t,n)=>e(e=>{const a=e.chatMuted[t]??[];return{chatMuted:{...e.chatMuted,[t]:a.includes(n)?a.filter(e=>e!==n):[...a,n]}}}),sys:(t,n,a)=>e(e=>({chat:[...e.chat,{id:A('m'),ch:t,from:'system',text:n,at:a,reactions:{},seenBy:[]}]})),tick:(t,n,a,i)=>e(e=>({checks:{...e.checks,[t]:{by:n,at:a,value:i}}})),untick:t=>e(e=>{const n={...e.checks};return delete n[t],{checks:n}}),addLost:t=>e(e=>({lost:[{...t,id:A('lp'),status:'held'},...e.lost]})),setLost:(t,n)=>e(e=>({lost:e.lost.map(e=>e.id===t?{...e,...n}:e)})),addCampaign:t=>e(e=>({campaigns:[{...t,id:A('cp')},...e.campaigns]})),setCampaign:(t,n)=>e(e=>({campaigns:e.campaigns.map(e=>e.id===t?{...e,...n}:e)})),setShifts:t=>e({shifts:t.map(e=>e.date?{...e,day:k(e.date)}:e)}),addShift:t=>e(e=>({shifts:[...e.shifts,{...t,day:k(t.date),published:!1,id:(0,p.uuid)()}]})),copyWeek:(t,a)=>{const i=n(),s=new Set(i.staff.filter(e=>e.active).map(e=>e.id)),r=[];for(let e=0;e<7;e++){const n=y(t,e),o=y(a,e);i.shifts.filter(e=>e.date===n&&s.has(e.staffId)&&!i.shifts.some(t=>t.staffId===e.staffId&&t.date===o)&&!r.some(t=>t.staffId===e.staffId&&t.date===o)).forEach(e=>r.push({id:(0,p.uuid)(),staffId:e.staffId,date:o,day:k(o),start:e.start,end:e.end,note:e.note,published:!1}))}return r.length&&e({shifts:[...i.shifts,...r]}),r.length},publishWeek:t=>{const n=y(t,6);let a=0;return e(e=>({shifts:e.shifts.map(e=>e.daten||e.published&&!e.changed?e:(a++,{...e,published:!0,changed:!1})),rotaPublished:(new Date).toISOString()})),a},removeShift:t=>e(e=>({shifts:e.shifts.filter(e=>e.id!==t)})),markRead:t=>e(e=>({readNotes:{...e.readNotes,...Object.fromEntries(t.map(e=>[e,!0]))}})),toggleTag:(t,n)=>e(e=>{const a=e.customerTags[t]??[];return{customerTags:{...e.customerTags,[t]:a.includes(n)?a.filter(e=>e!==n):[...a,n]}}}),publishRota:t=>e({rotaPublished:t}),addLeave:t=>e(e=>({leave:[{...t,id:A('lv'),status:'pending'},...e.leave]})),setLeave:(t,n)=>e(e=>({leave:e.leave.map(e=>e.id===t?{...e,status:n}:e)})),addSwap:t=>e(e=>({swaps:[{...t,id:A('sw'),status:'open'},...e.swaps]})),setSwap:(t,n)=>e(e=>{const a=e.swaps.find(e=>e.id===t);return{shifts:'approved'===n&&a?.toId?e.shifts.map(e=>e.id===a.shiftId?{...e,staffId:a.toId}:e):e.shifts,swaps:e.swaps.map(e=>e.id===t?{...e,status:n}:e)}}),toggleAvail:(t,n)=>e(e=>{const a=e.availability[t]??[];return{availability:{...e.availability,[t]:a.includes(n)?a.filter(e=>e!==n):[...a,n]}}}),clock:(t,n,a,i,s,r)=>e(e=>{const o=e.attendance.filter(e=>e.staffId===t&&e.in&&!e.out&&new Date(i).getTime()-new Date(e.in).getTime()<72e6).sort((e,t)=>t.in.localeCompare(e.in))[0];if('in'===a)return o?e:{attendance:[...e.attendance,{id:(0,p.uuid)(),staffId:t,date:n,in:i,inSite:s}]};const d=e=>e?.map(e=>e.end?e:{...e,end:i});return o?{attendance:e.attendance.map(e=>e.id===o.id?{...e,out:i,outSite:s,breakMins:r??D({...e,breaks:d(e.breaks)}),breaks:d(e.breaks)}:e)}:e}),adjustClock:(t,n,a,i,s,r)=>e(e=>{const o=e.attendance.find(e=>e.id===t),d=e.staff.find(e=>e.id===o?.staffId),c=o?.[n]?new Date(o[n]).toTimeString().slice(0,5):'none';return{attendance:e.attendance.map(e=>e.id===t?{...e,[n]:a,adjusted:{by:i,at:r,reason:s}}:e),attLog:[{id:A('al'),at:r,text:`${i} changed ${d?.name??'staff'} clock-${n} from ${c} to ${new Date(a).toTimeString().slice(0,5)}: ${s}`},...e.attLog]}}),patchAttendance:(t,n,a)=>e(e=>({attendance:e.attendance.map(e=>e.id===t?{...e,...n,geo:a?[...e.geo??[],a].slice(-20):e.geo}:e)})),breakToggle:(t,a,i)=>{const s=n(),r=$(s.attendance,t,i);if(!r)return!1;const o=r.breaks??[],d=o.some(e=>!e.end);if('start'===a?d:!d)return!1;const c='start'===a?[...o,{start:i}]:o.map(e=>e.end?e:{...e,end:i});return e({attendance:s.attendance.map(e=>e.id===r.id?{...e,breaks:c,breakMins:D({breaks:c})}:e)}),!0},adjustBreak:(t,n,a,i,s)=>e(e=>{const r=e.attendance.find(e=>e.id===t),o=e.staff.find(e=>e.id===r?.staffId);return{attendance:e.attendance.map(e=>e.id===t?{...e,breakMins:n,adjusted:{by:a,at:s,reason:i}}:e),attLog:[{id:A('al'),at:s,text:`${a} changed ${o?.name??'staff'} break from ${r?.breakMins??0}m to ${n}m: ${i}`},...e.attLog]}}),overrideEntry:t=>{const a=n(),i=t.id?a.attendance.find(e=>e.id===t.id):void 0,s=t.reason.trim();if(s.length<3)return null;if(t.out&&t.out<=t.in)return null;const r=e=>e?new Date(e).toTimeString().slice(0,5):'none',o=(e,n,a)=>({at:t.now,by:t.by,byId:t.byId,action:e,from:n,to:a,reason:s}),d=a.staff.find(e=>e.id===t.staffId)?.name??'staff';let c;const u=[];if(i){const e=[...i.audit??[]];if(i.signOff&&(e.push(o('reopened','Confirmed','Awaiting sign-off')),u.push(`${t.by} reopened ${d}'s confirmed ${i.date} entry`)),i.in!==t.in&&(e.push(o('clock_in',r(i.in),r(t.in))),u.push(`${t.by} changed ${d} clock-in from ${r(i.in)} to ${r(t.in)}: ${s}`)),(i.out??'')!==(t.out??'')&&(e.push(o('clock_out',r(i.out),r(t.out))),u.push(`${t.by} changed ${d} clock-out from ${r(i.out)} to ${r(t.out)}: ${s}`)),(i.breakMins??0)!==t.breakMins&&(e.push(o('break',`${i.breakMins??0}m`,`${t.breakMins}m`)),u.push(`${t.by} changed ${d} break from ${i.breakMins??0}m to ${t.breakMins}m: ${s}`)),e.length===(i.audit??[]).length)return i;const n=t.out?i.breaks?.map(e=>e.end?e:{...e,end:t.out}):i.breaks;c={...i,in:t.in,out:t.out,breakMins:t.breakMins,breaks:n,signOff:void 0,adjusted:{by:t.by,at:t.now,reason:s},audit:e}}else c={id:t.id??(0,p.uuid)(),staffId:t.staffId,date:t.date,in:t.in,out:t.out,breakMins:t.breakMins,added:!0,adjusted:{by:t.by,at:t.now,reason:s},audit:[o('added',void 0,`${r(t.in)}\u2013${t.out?r(t.out):'open'}, break ${t.breakMins}m`)]},u.push(`${t.by} added ${d}'s ${t.date} entry ${r(t.in)}\u2013${t.out?r(t.out):'open'} (break ${t.breakMins}m): ${s}`);return t.request&&(c={...c,audit:[...c.audit??[],o('request_applied')]}),h.send?.('attendance_override',c,{reason:s}),e(e=>({attendance:i?e.attendance.map(e=>e.id===i.id?c:e):[...e.attendance,c],attLog:[...u.reverse().map(e=>({id:A('al'),at:t.now,text:e})),...e.attLog]})),c},confirmEntries:(t,a,i,s)=>{const r=n(),o=new Set(t),d=[],c=r.attendance.map(e=>{if(!o.has(e.id)||!e.out||e.signOff)return e;const t={...e,signOff:{by:a,byId:i,at:s},audit:[...e.audit??[],{at:s,by:a,byId:i,action:'confirmed',from:'Awaiting sign-off',to:'Confirmed'}]};return d.push(t),t});return d.length?(d.forEach(e=>h.send?.('attendance_confirm',e)),e({attendance:c,attLog:[{id:A('al'),at:s,text:`${a} confirmed ${d.length} ${1===d.length?'entry':'entries'} (${[...new Set(d.map(e=>e.date))].join(', ')})`},...r.attLog]}),d.length):0},addTimeRequest:t=>e(e=>({timeRequests:[{...t,id:(0,p.uuid)(),status:'open'},...e.timeRequests]})),resolveTimeRequest:(t,a,i,s)=>{const r=n().timeRequests.find(e=>e.id===t);if(!r||'open'!==r.status)return;const o={...r,status:a,resolvedBy:i,resolvedAt:s};h.send?.('time_request_resolve',o),e(e=>({timeRequests:e.timeRequests.map(e=>e.id===t?o:e)}))},setGeofence:t=>e(e=>({geofence:{...e.geofence,...t}})),setSimLocation:t=>e({simLocation:t}),giveConsent:(t,n)=>e(e=>({consent:{...e.consent,[t]:n}})),resetOwner:()=>e(U()),syncRoster:()=>e(e=>{if(t.IS_ISOLATED_VENUE||e.rosterVersion===l.ROSTER_VERSION)return e;const n=new Map(e.staff.map(e=>[e.id,e]));return{staff:[...j().map(e=>({...e,active:n.get(e.id)?.active??!0})),...e.staff.filter(e=>!l.ROSTER.some(t=>t.id===e.id)&&!B.includes(e.id))],hourly:{...e.hourly,...C()},rosterVersion:l.ROSTER_VERSION}})}),{name:'covercharge-owner-v1',version:6,storage:(0,f.createJSONStorage)(()=>c.default),migrate:async(e,t)=>{if(s.LIVE_VENUE_BUILD&&e)return await(0,o.archiveChefCache)('owner',e),{...e,...(0,i.stripOwnerLiveSamples)(e)};if(e&&t<2&&Array.isArray(e.quickLinks)&&(e.quickLinks=e.quickLinks.map(e=>_.includes(e.id)||'Website bookings'===e.group?{...e,staff:!1}:e)),e&&t<3){const t=U();Object.assign(e,{staff:t.staff,hourly:t.hourly,shifts:t.shifts,leave:t.leave,swaps:t.swaps,availability:t.availability,attendance:[],attLog:[],consent:{},chat:[],chatMuted:{},troncHistory:[],staffAs:t.staffAs,previewRole:'owner',rosterVersion:l.ROSTER_VERSION,rotaPublished:void 0})}if(e&&t<4){const t=I(b(new Date));e.shifts=(e.shifts??[]).map(e=>e.date?e:{...e,date:y(t,e.day??0),published:!0}),e.timeRequests=e.timeRequests??[]}return s.LIVE_VENUE_BUILD&&e&&(Object.assign(e,(0,i.stripOwnerLiveSamples)(e)),e.chat=(e.chat||[]).filter(e=>!(0,r.isSeedChefChat)(e)),e.suppliers=(e.suppliers||[]).filter(e=>!/^sup-[1-9]$/.test(e.id)||!/^(Example|Sample)\b/.test(e.name)),e.supplierOrders=(e.supplierOrders||[]).filter(e=>!/\(example\)/i.test(e.by||''))),e}})),q=(e,t,n)=>e?.salaried&&null==t?'Owner, no hourly wage':null==t?'Not set':`${n(t)}/h`,B=['st-2','st-3','st-4','st-5'],x={owner:'Owner',manager:'Manager',staff:'Staff'},K={forecasts:e=>'staff'!==e,manage:e=>'staff'!==e,staffAdmin:e=>'owner'===e,billing:e=>'owner'===e,takings:e=>'staff'!==e,publishSocial:e=>'staff'!==e};const W=e=>[e.name.replace(/\s*\([^)]*\)\s*$/,'').replace(' (example)',''),e.nickname??''].map(e=>e.trim().toLowerCase()).filter(Boolean).flatMap(e=>[e,e.split(' ')[0]]).filter((e,t,n)=>n.indexOf(e)===t),F=(e,t)=>{const n=t.trim().toLowerCase();if(!n)return!1;const a=W(e);return a.includes(n)||a.includes(n.split(' ')[0])},G=(e,t)=>{const n=t.trim().toLowerCase();return!n||[e.name,e.nickname,e.job,e.dept].some(e=>(e??'').toLowerCase().includes(n))}},856,[5,6,1204,1129,833,1025,1132,1116,952,1117,14,1034]); +__d(function(g,r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useSpecials",{enumerable:!0,get:function(){return _}});var e,t=r(_d[0]),s=r(_d[1]),i=r(_d[2]),n=r(_d[3]),o=r(_d[4]),c=(e=o)&&e.__esModule?e:{default:e},l=r(_d[5]),d=r(_d[6]),h=r(_d[7]),u=r(_d[8]),y=r(_d[9]);const p=()=>{try{return(0,u.nowFrom)(u.useStore.getState().clock)}catch{return new Date}};let S=0;const f=()=>`sb-${Date.now().toString(36)}${(S++).toString(36)}`,b=(e,t)=>u.useStore.setState(s=>({audit:[{id:`au-${f()}`,restaurantId:e,at:p().toISOString(),kind:'allergy',text:t},...s.audit].slice(0,300)})),_=(0,l.create)()((0,d.persist)((e,t)=>({...n.IS_ISOLATED_VENUE||s.LIVE_VENUE_BUILD?{current:{},history:[]}:(0,h.seedSpecials)(p()),post:(t,s,i,n)=>{e(e=>(0,h.postBoard)(e,t,s,i,n,p(),f())),s.items.length&&b(t,`Specials board: allergens for ${s.items.length} typed special${1===s.items.length?'':'s'} checked and signed off by ${i}`)},clear:(t,s)=>{e(e=>(0,h.clearBoard)(e,t)),b(t,`Specials board cleared by ${s}`)},reuse:(s,i,n,o)=>{const c=t().history.find(e=>e.id===i);e(e=>(0,h.reuseBoard)(e,s,i,n,o,p(),f())),c?.items.length&&b(s,`Specials board re-used: ${c.items.length} typed special${1===c.items.length?'':'s'}, allergens as previously checked, signed off by ${n}`)},remove:t=>e(e=>(0,h.deleteFromHistory)(e,t))}),{name:'covercharge-specials-v1',storage:(0,d.createJSONStorage)(()=>c.default),version:1,partialize:e=>({current:e.current,history:e.history})})),E=async()=>{if(!(0,y.liveData)())return;const e=_.getState(),n=e=>String(e.id).startsWith('sb-seed')&&(!s.LIVE_VENUE_BUILD||(0,t.demoActor)(e.postedBy)&&(!e.allergenCheck||(0,t.demoActor)(e.allergenCheck.by))&&(!e.photo||e.photo===h.SAMPLE_PHOTO)&&e.items.every(e=>/\(sample\)/i.test(e.name))),o=Object.fromEntries(Object.entries(e.current).filter(([,e])=>!(e&&n(e)))),c=e.history.filter(e=>!n(e));Object.keys(o).length===Object.keys(e.current).length&&c.length===e.history.length||(s.LIVE_VENUE_BUILD&&await(0,i.archiveChefCache)('specials',{current:e.current,history:e.history}),_.setState({current:o,history:c}))};(0,y.onDataModeChange)(E);try{_.persist?.onFinishHydration?.(E)}catch{}E()},857,[1025,833,1132,5,1116,952,1117,858,872,1119]); +__d(function(g,r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SAMPLE_PHOTO",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"HISTORY_MAX",{enumerable:!0,get:function(){return n}}),e.parsePrice=function(t){const n=t.trim().replace(/^\xa3\s*/,'');return n?/^\d{1,3}(\.\d{1,2})?$/.test(n)?Math.round(100*parseFloat(n)):NaN:null},Object.defineProperty(e,"priceText",{enumerable:!0,get:function(){return s}}),e.itemProblems=a,e.draftProblems=i,e.cycleAllergen=function(t,n){const s={...t};s[n]?'contains'===s[n]?s[n]='may':delete s[n]:s[n]='contains';return s},e.postBoard=function(t,n,s,a,l,c,d){const u=i(s);if(u.length)throw new Error(u[0]);const p={id:d,restaurantId:n,photo:s.photo,app:l,postedBy:a,postedAt:c.toISOString(),items:s.items.map(t=>({...t,name:t.name.trim(),description:t.description.trim()})),allergenCheck:s.items.length?{by:a,at:c.toISOString()}:null};return{current:{...t.current,[n]:p},history:o(t.history,t.current[n],n)}},e.clearBoard=function(t,n){return{current:{...t.current,[n]:null},history:o(t.history,t.current[n],n)}},e.reuseBoard=function(t,n,s,a,i,l,c){const d=t.history.find(t=>t.id===s&&t.restaurantId===n);if(!d)return t;const u={...d,id:c,app:i,postedBy:a,postedAt:l.toISOString(),reusedFrom:d.id,allergenCheck:d.items.length?{by:a,at:l.toISOString()}:null},p={...t,history:t.history.filter(t=>t.id!==s)};return{current:{...t.current,[n]:u},history:o(p.history,t.current[n],n)}},e.deleteFromHistory=function(t,n){return{...t,history:t.history.filter(t=>t.id!==n)}},Object.defineProperty(e,"historyFor",{enumerable:!0,get:function(){return l}}),e.whenText=h,Object.defineProperty(e,"isToday",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"freshness",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"lastUpdated",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"boardSummary",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"SAMPLE_ITEMS",{enumerable:!0,get:function(){return k}}),e.seedSpecials=function(n){const s=60*n.getHours()+n.getMinutes()>=702?S(n,0,11,42):new Date(n.getTime()-6e5),a=S(n,1,11,20),i=S(n,3,12,5);return{current:{anchorage:{id:'sb-seed-today',restaurantId:'anchorage',photo:null,items:k,postedAt:s.toISOString(),postedBy:'Head Chef (example)',app:'chef',allergenCheck:{by:'Head Chef (example)',at:s.toISOString()}}},history:[{id:'sb-seed-yday',restaurantId:'anchorage',photo:null,postedAt:a.toISOString(),postedBy:'Duty Manager (example)',app:'managers',allergenCheck:{by:'Duty Manager (example)',at:a.toISOString()},items:[{id:'sp-y1',name:'Pan-fried sea bass, samphire, brown shrimp butter (sample)',description:'Sample dish.',price:2100,allergens:{fish:'contains',crustaceans:'contains',milk:'contains'}},{id:'sp-y2',name:'Smoked haddock fishcake, poached egg (sample)',description:'Sample dish: with wholegrain mustard sauce.',price:1250,allergens:{fish:'contains',eggs:'contains',gluten:'contains',milk:'contains',mustard:'contains'}},{id:'sp-y3',name:'Lemon posset, shortbread (sample)',description:'Sample pudding.',price:750,allergens:{milk:'contains',gluten:'contains'}}]},{id:'sb-seed-photo',restaurantId:'anchorage',photo:t,items:[],postedAt:i.toISOString(),postedBy:'Head Chef (example)',app:'chef',allergenCheck:null}]}};const t='sample:chalkboard',n=8;const s=t=>null===t?'Ask your server':`\xa3${(t/100).toFixed(2)}`;function a(t){const n=[];t.name.trim().length<3&&n.push('Add a dish name'),null!==t.price&&(!Number.isFinite(t.price)||t.price<=0||t.price>5e4)&&n.push('Check the price');const s=Object.keys(t.allergens).length;return s||t.noAllergens||n.push('Choose its allergens, or tick \u201cNone of the 14\u201d'),s&&t.noAllergens&&n.push('Allergens chosen and \u201cNone of the 14\u201d both ticked'),n}function i(t){const n=[];return t.photo||t.items.length||n.push('Add a photo of the board or type at least one special'),t.items.forEach((t,s)=>a(t).forEach(t=>n.push(`Special ${s+1}: ${t}`))),t.items.length&&!t.allergensChecked&&n.push('Confirm you have checked the allergens'),n}const o=(t,s,a)=>{if(!s)return t;return[...[s,...t.filter(t=>t.restaurantId===a&&t.id!==s.id)].slice(0,n),...t.filter(t=>t.restaurantId!==a)]};const l=(t,n)=>t.history.filter(t=>t.restaurantId===n),c=t=>String(t).padStart(2,'0'),d=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],u=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],p=(t,n)=>t.getFullYear()===n.getFullYear()&&t.getMonth()===n.getMonth()&&t.getDate()===n.getDate();function h(t,n){const s=new Date(t),a=`${c(s.getHours())}:${c(s.getMinutes())}`;if(p(s,n))return`today at ${a}`;const i=new Date(n);return i.setDate(i.getDate()-1),p(s,i)?`yesterday at ${a}`:`${d[s.getDay()]} ${s.getDate()} ${u[s.getMonth()]} at ${a}`}const m=(t,n)=>p(new Date(t),n),y=(t,n)=>`Updated ${h(t.postedAt,n)}`,f=(t,n)=>`Last updated ${h(t.postedAt,n)} by ${t.postedBy}`,b=t=>[t.photo?'Photo':'',t.items.length?`${t.items.length} typed special${1===t.items.length?'':'s'}`:''].filter(Boolean).join(' + '),S=(t,n,s,a)=>{const i=new Date(t);return i.setDate(i.getDate()-n),i.setHours(s,a,0,0),i},k=[{id:'sp-hake',name:'Grilled hake, crushed new potatoes, salsa verde (sample)',description:'Sample dish: day-boat hake, lemon and caper salsa verde.',price:1950,allergens:{fish:'contains',mustard:'contains',sulphites:'may'}},{id:'sp-scallops',name:'Half-shell scallops, garlic and herb butter (sample)',description:'Sample dish: three scallops grilled in the shell, crusty bread.',price:1400,allergens:{molluscs:'contains',milk:'contains',gluten:'contains'}},{id:'sp-crab',name:'Crab and chilli linguine (sample)',description:'Sample dish: brown and white crab meat, chilli, parsley, lemon.',price:1850,allergens:{crustaceans:'contains',gluten:'contains',eggs:'contains',molluscs:'may'}},{id:'sp-mussels',name:'Mussels in cider and leek cream (sample)',description:'Sample dish: rope-grown mussels, dry cider, leeks, cream. Main with chips.',price:1300,allergens:{molluscs:'contains',milk:'contains',sulphites:'contains',celery:'may'}}]},858,[]); +__d(function(g,r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"addressWithoutInvite",{enumerable:!0,get:function(){return u.addressWithoutInvite}}),Object.defineProperty(_e,"inviteFromLocation",{enumerable:!0,get:function(){return u.inviteFromLocation}}),Object.defineProperty(_e,"useSession",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"rosterPerson",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"APP_NAME",{enumerable:!0,get:function(){return w}}),_e.sha256Hex=h,_e.inviteFromText=function(e){const t=e.trim(),n=t.match(/[?&#](?:invite|i)=([A-Za-z0-9_-]{10,})/);return n?n[1]:/^[A-Za-z0-9_-]{10,}$/.test(t)?t:null},_e.personForInvite=async function(e){if(a.IS_ISOLATED_VENUE)return;const t=await h(e);return t?l.ROSTER.find(e=>e.tokenHash===t):void 0},Object.defineProperty(_e,"DEVICE_KEY",{enumerable:!0,get:function(){return m}}),_e.deviceId=function(){try{if('undefined'==typeof localStorage)return null;let e=localStorage.getItem(m);if(!e||!/^[A-Za-z0-9_-]{16,64}$/.test(e)){const t=new Uint8Array(18);if(globalThis.crypto?.getRandomValues?.(t),!t.some(e=>e))for(let e=0;ee.toString(16).padStart(2,'0')).join(''),localStorage.setItem(m,e)}return e}catch{return null}},Object.defineProperty(_e,"START_INVITE",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"START_GO",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"START_LOYALTY_CODE",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"START_TABLE_TOKEN",{enumerable:!0,get:function(){return v}}),_e.appUrl=function(e,t){if('undefined'==typeof window||!window.location)return null;const{origin:n,pathname:o}=window.location,i=o.match(/^(.*?\/)(owner|staff|chef|display|customer)-app(\/|$)/),a=i?i[1]:'/';return`${n}${a}${e}-app/index.html${t?`#invite=${encodeURIComponent(t)}`:''}`},_e.levelJob=function(e,t){const n=(e??'').trim(),o=(t??'').trim();return n?!o||o.toLowerCase().startsWith(n.toLowerCase())?o||n:`${n} \xb7 ${o}`:o};var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},o=r(d[1]),i=r(d[2]),a=r(d[3]),c=r(d[4]),l=r(d[5]),u=r(d[6]);const s=(0,o.create)()((0,i.persist)(e=>({meId:null,welcomed:{},signIn:t=>e({meId:t,signedInAt:(new Date).toISOString()}),signOut:()=>e({meId:null,signedInAt:void 0}),markWelcomed:t=>e(e=>({welcomed:{...e.welcomed,[t]:(new Date).toISOString()}}))}),{name:'covercharge-session-v1',storage:(0,i.createJSONStorage)(()=>n.default),version:1})),f=e=>!a.IS_ISOLATED_VENUE&&e?l.ROSTER.find(t=>t.id===e):void 0,w={owner:'CoverCharge for Managers',staff:'CoverCharge for Staff',chef:'CoverCharge for Head Chef'};async function h(e){const t=globalThis.crypto?.subtle;if(!t)return null;const n=await t.digest('SHA-256',(new TextEncoder).encode(e));return Array.from(new Uint8Array(n)).map(e=>e.toString(16).padStart(2,'0')).join('')}const m=(0,a.venueKey)('covercharge-device-id');const p=(()=>{try{if('undefined'==typeof window||!window.location)return null;const e=(0,a.venueKey)(`cc-pending-invite:${c.APP_VARIANT}`);let t=(0,u.inviteFromLocation)(window.location.search,window.location.hash);try{t?localStorage.setItem(e,t):t=localStorage.getItem(e)}catch{}if(t&&!/^[A-Za-z0-9_-]{10,64}$/.test(t)&&(t=null),t&&window.history?.replaceState){const e=()=>{try{/[?&#]invite=/.test(window.location.href)&&window.history.replaceState(window.history.state,'',(0,u.addressWithoutInvite)(window.location.href))}catch{}};e();try{const e=window.history;for(const t of['pushState','replaceState']){const n=e[t].bind(e);e[t]=(e,t,o)=>n(e,t,null==o?o:/[?&#]invite=/.test(String(o))?(0,u.addressWithoutInvite)(new URL(String(o),window.location.href).toString()):o)}}catch{}for(const t of[300,1e3,2500,5e3,1e4,2e4])setTimeout(e,t)}return t}catch{return null}})(),y=(()=>{try{return'undefined'!=typeof window&&window.location?new URLSearchParams(window.location.search).get('go'):null}catch{return null}})(),S=(()=>{try{const e='undefined'!=typeof window&&window.location?new URLSearchParams(window.location.search).get('loyalty'):null;return e&&/^[A-Za-z0-9-]{4,12}$/.test(e)?e.toUpperCase():null}catch{return null}})(),v=(()=>{try{const e='undefined'!=typeof window&&window.location?new URLSearchParams(window.location.search).get('table'):null;return e&&/^[A-Za-z2-9]{16}$/.test(e)?e.toUpperCase():null}catch{return null}})()},859,[1116,952,1117,5,806,14,1150]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.LoyaltyLive=function({slug:e,venue:r}){const{info:t,card:l,loading:i,err:u,load:y}=p(e),[S,v]=(0,n.useState)('');return t?t.cardOn||l?(0,f.jsxs)(o.Screen,{title:"Stamp card",subtitle:`${r}. This card is just for ${r}.`,children:[S?(0,f.jsx)(o.Banner,{kind:"success",title:S}):null,t.cardOn?null:(0,f.jsxs)(o.Banner,{kind:"info",children:[r," has paused the stamp card. Your stamps and rewards are kept."]}),l?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(o.H2,{children:[l.stamps," of ",l.needed," stamps"]}),(0,f.jsxs)(o.T,{colour:h.colours.gold,weight:"semibold",children:["Reward: ",l.reward]})]}),(0,f.jsx)(w,{n:l.stamps,of:l.needed}),(0,f.jsxs)(o.Muted,{children:["Staff add a stamp when you visit. ",t.stampExpiryDays?`Stamps last ${t.stampExpiryDays} days.`:'']})]}),l.rewards.length?(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsx)(o.H2,{children:"Ready to use"}),l.rewards.map(e=>(0,f.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(o.T,{weight:"semibold",style:{flex:1},children:e.title}),(0,f.jsx)(o.Muted,{children:e.expiresAt?`Use by ${x(e.expiresAt)}`:''})]},e.id)),(0,f.jsx)(o.Muted,{children:"Show this screen or your card to staff when you'd like to use a reward. Staff mark it used; each one works once."})]}):null,(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Your card"}),(0,f.jsx)(o.Muted,{children:"Staff scan this, or look you up by name, to add a stamp."}),(0,f.jsx)(s.QR,{value:(0,c.cardQr)(e,l.cardNo),size:170}),(0,f.jsx)(o.T,{center:!0,weight:"semibold",children:l.name}),(0,f.jsx)(o.T,{center:!0,size:20,weight:"bold",colour:h.colours.gold,children:(0,c.prettyCardNo)(l.cardNo)})]}),(0,f.jsx)(b,{slug:e,joined:!0,onDone:v}),t.referralOn?(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Bring a friend"}),(0,f.jsx)(o.T,{children:"Your code"}),(0,f.jsx)(o.T,{size:28,weight:"bold",colour:h.colours.gold,center:!0,children:l.referralCode}),(0,f.jsxs)(o.Muted,{children:["Your friend types it when they join. After their first stamp you get: ",t.referralGiver,". They get: ",t.referralFriend,"."]}),(0,f.jsxs)(o.Muted,{children:["Waiting: ",l.referrals.waiting," \xb7 Rewarded: ",l.referrals.rewarded]})]}):null,(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"History"}),l.history.length?l.history.map((e,n)=>(0,f.jsxs)(o.Muted,{children:[x(e.at)," ",j(e.at)," \xb7 ",e.what]},n)):(0,f.jsx)(o.Muted,{children:"No stamps yet."})]}),(0,f.jsx)(C,{slug:e}),(0,f.jsx)(k,{slug:e})]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsxs)(o.H2,{children:[t.needed," stamps = ",t.reward]}),(0,f.jsx)(w,{n:0,of:t.needed})]}),(0,f.jsx)(T,{slug:e,venue:r,referralOn:t.referralOn,onJoined:e=>v(e.note?`You're in. ${e.note}`:"You're in. Show your card to staff on your next visit.")}),(0,f.jsx)(b,{slug:e,joined:!1,onDone:v})]}),(0,f.jsxs)(o.Muted,{children:["Tip: your card is saved by ",r,", not on this phone, so you won't lose it. Rewards are kept on food, not drinks."]})]}):(0,f.jsxs)(o.Screen,{title:"Stamp card",subtitle:r,children:[(0,f.jsx)(o.Banner,{kind:"info",title:`${r} hasn't started a stamp card yet`,children:"When they do, you can join here."}),(0,f.jsxs)(o.Muted,{children:["Tip: offers from ",r," are under Offers on the home screen."]})]}):(0,f.jsxs)(o.Screen,{title:"Stamp card",subtitle:r,children:[u?(0,f.jsx)(o.Banner,{kind:"warn",title:"Couldn't load the stamp card",children:u}):(0,f.jsx)(o.Muted,{children:i?'Loading your card\u2026':'Loading\u2026'}),u?(0,f.jsx)(o.Button,{kind:"secondary",label:"Try again",onPress:y}):null,(0,f.jsxs)(o.Muted,{children:["Tip: your card is saved by ",r,", so it's the same on any phone once you sign in with a code."]})]})},_e.OffersLive=function({slug:e,venue:n}){const{info:r,err:t,load:s}=p(e);return(0,f.jsxs)(o.Screen,{title:"Offers",subtitle:n,children:[!r&&t?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(o.Banner,{kind:"warn",title:"Couldn't load offers",children:t}),(0,f.jsx)(o.Button,{kind:"secondary",label:"Try again",onPress:s})]}):null,r?r.offers.length?r.offers.map(e=>(0,f.jsxs)(o.Card,{children:[(0,f.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(o.T,{weight:"semibold",style:{flex:1},children:e.title}),(0,f.jsx)(o.Badge,{kind:"gold",label:"Offer"})]}),e.details?(0,f.jsx)(o.Muted,{children:e.details}):null,e.endsOn?(0,f.jsxs)(o.Muted,{children:["Until ",x(e.endsOn+'T12:00:00Z')]}):null]},e.id)):(0,f.jsxs)(o.Muted,{children:["No offers from ",n," right now."]}):t?null:(0,f.jsx)(o.Muted,{children:"Loading\u2026"}),(0,f.jsxs)(o.Muted,{children:["Tip: offers are set by ",n," and shown here only. Nothing is sent to your phone. Drinks promotions follow Scottish licensing rules."]})]})},_e.ReferLive=function({slug:e,venue:n}){const{info:r,card:t}=p(e);return(0,f.jsxs)(o.Screen,{title:"Bring a friend",subtitle:n,children:[r?r.referralOn?(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsxs)(o.H2,{children:["You get: ",r.referralGiver]}),(0,f.jsxs)(o.T,{children:["Your friend gets: ",r.referralFriend]}),(0,f.jsx)(o.Muted,{children:"Your friend joins the stamp card with your code. You both get your reward after their first stamp."}),t?(0,f.jsx)(o.T,{size:30,weight:"bold",colour:h.colours.gold,center:!0,children:t.referralCode}):(0,f.jsx)(o.Banner,{kind:"info",children:"Join the stamp card first to get your code."}),t?(0,f.jsxs)(o.Muted,{children:["Waiting: ",t.referrals.waiting," \xb7 Rewarded: ",t.referrals.rewarded]}):null]}):(0,f.jsxs)(o.Banner,{kind:"info",children:[n," isn't running Bring a friend right now."]}):(0,f.jsx)(o.Muted,{children:"Loading\u2026"}),(0,f.jsxs)(o.Muted,{children:["Tip: tell your friend the code yourself. One reward per friend; it doesn't work on your own card, and ",n," may cap it each month."]})]})},_e.useLiveTile=function(e){const r=(0,u.useGuestLoyalty)(n=>n.info[e]),t=(0,u.useGuestLoyalty)(n=>n.card[e]);return(0,n.useEffect)(()=>{(0,u.refreshGuest)(e).catch(()=>{})},[e]),{stamps:r?t?`${t.stamps} of ${t.needed}`:r.cardOn?'Join':void 0:void 0,offers:r?.offers.length}};var n=_r(d[0]),r=e(n),t=e(_r(d[1])),s=_r(d[2]),o=_r(d[3]),l=_r(d[4]),i=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]),f=_r(d[9]);const x=e=>{try{return new Date(e).toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric',timeZone:'Europe/London'})}catch{return e.slice(0,10)}},j=e=>{try{return new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return''}};let y=!1;function p(e){const t=(0,u.useGuestLoyalty)(n=>n.info[e]),s=(0,u.useGuestLoyalty)(n=>n.card[e]),o=(0,u.useGuestLoyalty)(n=>!!n.loading[e]),[l,i]=(0,n.useState)(''),h=r.default.useCallback(()=>{i(''),(0,u.refreshGuest)(e).catch(e=>i((0,c.plainError)(e)))},[e]);return(0,n.useEffect)(()=>{h();const e=setInterval(h,3e4);return()=>clearInterval(e)},[h]),{info:t,card:s,loading:o,err:l,load:h}}function w({n:e,of:n}){return(0,f.jsx)(t.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:10,justifyContent:'center',paddingVertical:8},children:Array.from({length:n}).map((n,r)=>(0,f.jsx)(t.default,{accessibilityLabel:r!y&&i.START_LOYALTY_CODE?(y=!0,i.START_LOYALTY_CODE):''),[h,x]=(0,n.useState)(!1),[j,p]=(0,n.useState)('');return(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:r?'Got a code from staff?':'Already have a card?'}),(0,f.jsx)(o.Muted,{children:r?'Staff can give you a one-time code for a stamp. Type it here.':'Ask staff for a sign-in code, or make one on your other phone (Stamp card \u203a Use on another phone). Type it here to open your card.'}),(0,f.jsx)(o.Field,{label:"Code",value:s,onChangeText:e=>l(e.toUpperCase()),autoCapitalize:"characters",maxLength:9,placeholder:"e.g. 7KQ2MX",testID:"loyalty-code"}),j?(0,f.jsx)(o.Banner,{kind:"warn",children:j}):null,(0,f.jsx)(o.Button,{label:h?'Checking\u2026':'Use code',disabled:h||s.replace(/[^A-Za-z0-9]/g,'').length<6,onPress:async()=>{x(!0),p('');try{const n=await(0,u.guestClaim)(e,s);n.ok?(l(''),t(n.linked?'This phone now shows your card.':n.card.newReward?`Stamp added. You've earned: ${n.card.rewards[n.card.rewards.length-1]?.title??'a reward'}!`:'Stamp added.')):p(n.error)}catch(e){p((0,c.plainError)(e))}finally{x(!1)}},testID:"loyalty-use-code"})]})}function T({slug:e,venue:r,referralOn:t,onJoined:s}){const i=(0,l.useCustomer)(),[x,j]=(0,n.useState)(i.name??''),[y,p]=(0,n.useState)(i.phone??''),[w,b]=(0,n.useState)(i.email??''),[T,C]=(0,n.useState)(''),[k,S]=(0,n.useState)(!1),[v,L]=(0,n.useState)(!1),[M,B]=(0,n.useState)('');return(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsx)(o.H2,{children:"Join the stamp card"}),(0,f.jsx)(o.Muted,{children:"Only your name is needed. A phone number or email helps staff find your card if you lose this phone. Nothing is sent to you."}),(0,f.jsx)(o.Field,{label:"Your name",value:x,onChangeText:j,maxLength:60,testID:"loyalty-name"}),(0,f.jsx)(o.Field,{label:"Phone (optional)",value:y,onChangeText:p,keyboardType:"phone-pad",maxLength:20}),(0,f.jsx)(o.Field,{label:"Email (optional)",value:w,onChangeText:b,keyboardType:"email-address",autoCapitalize:"none",maxLength:120}),t?(0,f.jsx)(o.Field,{label:"Friend's code (optional)",value:T,onChangeText:e=>C(e.toUpperCase()),autoCapitalize:"characters",maxLength:8}):null,(0,f.jsx)(o.Toggle,{label:(0,c.consentText)(r),value:k,onChange:S,testID:"loyalty-consent"}),M?(0,f.jsx)(o.Banner,{kind:"warn",children:M}):null,(0,f.jsx)(o.Button,{label:v?'Joining\u2026':'Join',disabled:v||!k||!x.trim(),onPress:async()=>{L(!0),B('');try{s(await(0,u.guestJoin)(e,{name:x,phone:y,email:w,consent:k,consentText:(0,c.consentText)(r),referral:T}))}catch(e){B((0,c.plainError)(e))}finally{L(!1)}},testID:"loyalty-join"})]})}function C({slug:e}){const[r,t]=(0,n.useState)(null),[s,l]=(0,n.useState)('');return(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Use on another phone"}),(0,f.jsxs)(o.Muted,{children:["Make a code here, then on the other phone open ","the stamp card"," and type it under \"Already have a card?\". The code works once, for 15 minutes."]}),r?(0,f.jsx)(o.T,{size:30,weight:"bold",colour:h.colours.gold,center:!0,children:r.code}):null,r?(0,f.jsxs)(o.Muted,{center:!0,children:["Works until ",j(r.expiresAt)]}):null,s?(0,f.jsx)(o.Banner,{kind:"warn",children:s}):null,(0,f.jsx)(o.Button,{kind:"secondary",label:r?'Make a new code':'Make a code',onPress:()=>{l(''),(0,u.guestLinkCode)(e).then(t).catch(e=>l((0,c.plainError)(e)))}})]})}function k({slug:e}){const[r,t]=(0,n.useState)(!1),[s,l]=(0,n.useState)('');return(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Leave the stamp card"}),(0,f.jsx)(o.Muted,{children:"Your name, phone and email are removed and your stamps and rewards go. This can't be undone."}),s?(0,f.jsx)(o.Banner,{kind:"warn",children:s}):null,r?(0,f.jsxs)(o.Row,{gap:8,children:[(0,f.jsx)(o.Button,{kind:"danger",label:"Yes, remove me",onPress:()=>(0,u.guestLeave)(e).catch(e=>l((0,c.plainError)(e)))}),(0,f.jsx)(o.Button,{kind:"ghost",label:"Keep my card",onPress:()=>t(!1)})]}):(0,f.jsx)(o.Button,{kind:"ghost",label:"Leave the stamp card",onPress:()=>t(!0)})]})}},860,[30,127,869,813,819,859,1015,836,821,24]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"BUILTIN_LOGOS",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"HERO_LOGOS",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"HEADER_LOGO",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"ACCENTS",{enumerable:!0,get:function(){return z}}),_e.useBrandRid=k,_e.useBrand=L,_e.PoweredBy=O,_e.RestaurantLogo=S,_e.RestaurantHero=function({rid:e,size:o=200,showPlace:r=!0}){const c=L(e),u='wildings'===c.rid||'greenside'===c.rid||'kirkton'===c.rid||'abbotsford'===c.rid||(0,t.isQueuedVenue)(c.rid),b='yasmins'===c.rid?c.logo:u?w[c.rid]:c.custom?c.logo:w[c.rid]??c.logo;return(0,j.jsxs)(l.default,{testID:"restaurant-hero",style:{alignItems:'center',gap:6},children:[b?(0,j.jsx)(s.default,{source:b,accessibilityLabel:`${c.name} logo`,style:{width:o,height:o,borderRadius:!u&&c.custom?o/2:0},resizeMode:"contain"}):(0,j.jsx)(S,{rid:c.rid,size:o}),u?null:(0,j.jsx)(n.Text,{testID:"restaurant-hero-name",style:[{fontFamily:f.fonts.semibold,fontSize:26,lineHeight:34,color:f.colours.text,textAlign:'center'},(0,h.webLine)({lineHeight:34},26)],children:c.name}),r&&c.place?(0,j.jsx)(n.Text,{style:[{fontFamily:f.fonts.regular,fontSize:14,lineHeight:20,color:c.accentText,textAlign:'center'},(0,h.webLine)({lineHeight:20},14)],children:c.place}):null]})},_e.RestaurantBrand=function({rid:e,sub:t,size:o=T,nameSuffix:r}){const s=L(e);return(0,j.jsxs)(l.default,{style:{gap:2,flexShrink:1},children:[(0,j.jsx)(O,{}),(0,j.jsxs)(l.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,j.jsx)(S,{rid:s.rid,size:o}),(0,j.jsxs)(l.default,{style:{flexShrink:1},children:[(0,j.jsxs)(n.Text,{numberOfLines:1,style:[{fontFamily:f.fonts.semibold,fontSize:17,lineHeight:22,color:f.colours.text},(0,h.webLine)({lineHeight:22},17)],children:[s.name,r??'']}),t?(0,j.jsx)(n.Text,{numberOfLines:1,style:[{fontFamily:f.fonts.regular,fontSize:12,lineHeight:16,color:s.accentText},(0,h.webLine)({lineHeight:16},12)],children:t}):null]})]})]})};var t=_r(d[0]),n=_r(d[1]),o=_r(d[2]),r=e(_r(d[3])),s=e(_r(d[4])),l=e(_r(d[5])),c=_r(d[6]),u=_r(d[7]),f=_r(d[8]),h=_r(d[9]),b=_r(d[10]),x=_r(d[11]),y=_r(d[12]),j=_r(d[13]);const p={"3idiots":_r(d[14]),cecchinis:_r(d[15]),mrbasrais:_r(d[16]),yasmins:_r(d[17]),williewastles:_r(d[18]),rupeeroom:_r(d[19]),smokinggoat:_r(d[20]),pizzaioli:_r(d[21]),drunkencoo:_r(d[22]),abbotsford:_r(d[23]),kirkton:_r(d[24]),greenside:_r(d[25]),wildings:_r(d[26]),kirkmichael:_r(d[27]),souters:_r(d[28]),anchorage:_r(d[29]),saltmarsh:_r(d[30]),brae:_r(d[31])},w={"3idiots":_r(d[32]),cecchinis:_r(d[33]),mrbasrais:_r(d[34]),yasmins:_r(d[35]),williewastles:_r(d[36]),rupeeroom:_r(d[37]),smokinggoat:_r(d[38]),pizzaioli:_r(d[39]),drunkencoo:_r(d[40]),abbotsford:_r(d[41]),kirkton:_r(d[42]),greenside:_r(d[43]),wildings:_r(d[44]),kirkmichael:_r(d[45]),souters:_r(d[28]),anchorage:_r(d[46])};x.PITCH&&(delete p.anchorage,delete w.anchorage);const T=48,z=['#CFA45F','#D4AF61','#C9A24A','#E2C489','#F2EDE4','#A88B5A','#B08D57','#D9774B'];function k(e){const t=(0,o.useGlobalSearchParams)(),n=(0,u.useOwner)(e=>e.site),r='string'==typeof t.rid?t.rid:void 0;return b.IS_ISOLATED_VENUE?b.VENUE_RID:e??r??n??b.VENUE_RID}function L(e){const t=k(e),n=(0,c.useStore)(e=>e.restaurants.find(e=>e.id===t)),o=(0,u.useOwner)(e=>e.branding[t]),s=o?.logoUri?{uri:o.logoUri}:p[t],l=o?.accent??f.colours.gold,h=r.default.useMemo(()=>(0,y.checkAccent)(l,f.colours.bg,f.colours.onGold,f.colours.text),[l]);return{rid:t,name:n?.name??'Restaurant',place:n?.location??'',logo:s,accent:l,accentText:h.accentText,onAccent:h.onAccent,custom:!!o?.logoUri}}function O({size:e=10}){return(0,j.jsxs)(n.Text,{accessibilityLabel:"powered by CoverCharge",style:[{fontFamily:f.fonts.regular,fontSize:e,lineHeight:Math.round(1.35*e),color:f.colours.muted},(0,h.webLine)({lineHeight:Math.round(1.35*e)},e)],children:["powered by ",(0,j.jsx)(n.Text,{style:{fontFamily:f.fonts.semibold,color:f.colours.text},children:"Cover"}),(0,j.jsx)(n.Text,{style:{fontFamily:f.fonts.semibold,color:f.colours.gold},children:"Charge"})]})}function S({rid:e,size:t=T}){const o=L(e);if(o.logo)return(0,j.jsx)(s.default,{source:o.logo,accessibilityLabel:`${o.name} logo`,style:{width:t,height:t,borderRadius:o.custom?t/2:0},resizeMode:"contain"});const r=o.name.replace(/^The /,'').split(/\s+/).map(e=>e[0]).join('').slice(0,2).toUpperCase();return(0,j.jsx)(l.default,{accessibilityLabel:`${o.name} logo`,style:{width:t,height:t,borderRadius:t/2,borderWidth:2,borderColor:o.accentText,alignItems:'center',justifyContent:'center'},children:(0,j.jsx)(n.Text,{style:{fontFamily:f.fonts.bold,color:o.accentText,fontSize:.36*t},children:r})})}},861,[6,877,804,30,196,127,819,856,821,1238,5,2,1237,24,1241,1242,1243,1244,1245,1246,1247,1248,1249,1250,1251,1252,1253,1254,1255,1256,1257,1258,1259,1260,1261,1262,1263,1264,1265,1266,1267,1268,1269,1270,1271,1272,1273]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.FindPub=function({rid:e}){const p=(0,l.pubLocation)(e),[b,y]=(0,n.useState)(!1),[f,x]=(0,n.useState)(!1),[j,w]=(0,n.useState)(null),[I,v]=(0,n.useState)(null);if(!p)return null;const D=async()=>{y(!1),x(!0),v(null);const e=await(0,u.getFix)();x(!1),'object'==typeof e?(w(Math.round((0,c.distanceM)(p,e))),v(null)):(w(null),v('Your location was not shared. You can still use the address and open directions.'))};return(0,h.jsx)(o.Card,{children:(0,h.jsxs)(t.default,{testID:"find-pub",style:{gap:10},children:[(0,h.jsx)(o.T,{accessibilityRole:"header",weight:"bold",children:"Find us"}),(0,h.jsx)(o.T,{children:p.address}),(0,h.jsx)(o.Muted,{children:"See your approximate distance, or open directions. Location is optional and is never saved."}),(0,h.jsx)(o.Button,{testID:"find-pub-distance",label:f?'Finding your distance\u2026':'Find us \u2014 show my distance',accessibilityLabel:`Find ${p.name}, show my distance using my location once`,disabled:f,onPress:()=>y(!0)}),(0,h.jsxs)(t.default,{accessibilityLiveRegion:"polite",testID:"find-pub-result",children:[null!=j?(0,h.jsxs)(o.T,{children:["About ",j<1e3?`${j} m`:`${(j/1e3).toFixed(1)} km`," away, in a straight line."]}):null,I?(0,h.jsx)(o.T,{children:I}):null]}),(0,h.jsx)(o.Button,{testID:"find-pub-directions",kind:"secondary",label:"Open directions in Maps",accessibilityLabel:`Open directions to ${p.name}, ${p.address}, without sharing my location with CoverCharge`,onPress:()=>{s.default.openURL(`https://www.google.com/maps/dir/?api=1&destination=${encodeURIComponent(p.address)}`)}}),(0,h.jsx)(o.Sheet,{visible:b,onClose:()=>y(!1),title:"Use your location for distance?",testID:"find-pub-reason",children:(0,h.jsxs)(t.default,{style:{gap:12},children:[(0,h.jsxs)(o.T,{children:["We use your phone\u2019s location once to estimate how far you are from ",p.name,". Your position stays on this screen only: it is not stored or sent to the pub."]}),(0,h.jsx)(o.T,{children:"You can refuse location and still see the address and use directions."}),(0,h.jsx)(o.Button,{testID:"find-pub-allow",label:"Use my location once",onPress:()=>{D()}}),(0,h.jsx)(o.Button,{testID:"find-pub-cancel",kind:"secondary",label:"Not now \u2014 keep the address",onPress:()=>y(!1)})]})})]})})};var n=r(d[0]),s=e(r(d[1])),t=e(r(d[2])),o=r(d[3]),l=r(d[4]),c=r(d[5]),u=r(d[6]),h=r(d[7])},862,[30,239,127,813,989,954,1274,24]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.getSupabase=function(){if(_)return _;if(!(0,u.isSupabaseConfigured)())throw new Error('Supabase is not configured: set EXPO_PUBLIC_SUPABASE_URL and EXPO_PUBLIC_SUPABASE_ANON_KEY in .env.local');return _=(0,s.createClient)(u.SUPABASE_URL,u.SUPABASE_ANON_KEY,{auth:{storage:n.default,persistSession:!0,autoRefreshToken:!0,detectSessionInUrl:!1,storageKey:`${(0,o.syncNamespace)()}auth`},realtime:{params:{eventsPerSecond:10}}}),_},_e.setSupabaseClient=function(e){_=e};var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},s=r(d[1]),u=r(d[2]),o=r(d[3]);let _=null},863,[1116,1154,1096,1196]); +__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.VenueRequestForm=function({rid:e,kind:l,hotel:c,allDayHours:j,sessionHours:q,onClose:T}){const[D,f]=(0,o.useState)({name:'',phone:'',email:'',notes:'',date:(0,p.localDate)(),service:(0,t.isQueuedVenue)(e)||'greenside'===e?void 0:'Lunch',time:j||'greenside'===e?'10:00':'12:00',covers:2,checkIn:(0,p.localDate)(),checkOut:'',roomType:c?.roomTypes[0]?.id,guests:2,addDinner:!1}),v=e=>f(t=>({...t,...e})),[C,I]=(0,o.useState)(''),[S,w]=(0,o.useState)(''),[B,P]=(0,o.useState)(null),[R,Y]=(0,o.useState)(''),[M,N]=(0,o.useState)(!1),[$,V]=(0,o.useState)(!1),z=(0,o.useRef)(!1);(0,o.useEffect)(()=>{let s=!0;return(0,b.requestChallenge)(e,l).then(e=>{s&&P(e)}).catch(n=>{s&&Y((0,t.isQueuedVenue)(e)||['greenside','kirkton'].includes(e)?(0,b.requestMessage)(n).replace(/the hotel/g,'the restaurant'):(0,b.requestMessage)(n))}),()=>{s=!1}},[e,l]);const L=async()=>{if(z.current)return;const o=(0,t.isQueuedVenue)(e)?(0,s.queuedRequestError)(e,D,q):j&&'table'===l?(0,r.allDayRequestError)(D,j):(0,n.errorForVenue)(e,l,D,c);if(o)Y(o);else if(B&&C.trim()){z.current=!0,V(!0),Y('');try{await(0,b.sendVenueRequest)(e,l,D,B.id,C,S),N(!0)}catch(s){Y((0,t.isQueuedVenue)(e)||['greenside','kirkton'].includes(e)?(0,b.requestMessage)(s).replace(/the hotel/g,'the restaurant'):(0,b.requestMessage)(s))}finally{z.current=!1,V(!1)}}else Y('Complete the security check.')},F={minHeight:48,fontSize:18,color:y.colours.text};return(0,x.jsxs)(u.default,{testID:`venue-${l}-form`,style:{gap:16,alignItems:'stretch'},children:[(0,x.jsx)(h.H2,{children:'table'===l?'Book a table':'Book a room'}),(0,x.jsx)(h.T,{size:18,center:!0,children:'greenside'===e?'No payment is taken for this request. Deposit terms to confirm. This is a request, not an instant confirmation.':'No deposit. No payment. This is a request, not an instant confirmation.'}),M?(0,x.jsx)(h.Banner,{kind:"info",title:'greenside'===e?'Request sent. A Greenside manager must confirm your table.':c?.enabled?'Request sent. The hotel will contact you to confirm.':'Request sent. The venue will contact you to confirm.',children:"Nothing has been charged. No email or text is sent by this app."}):(0,x.jsxs)(x.Fragment,{children:['table'===l?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(k,{label:"Date (YYYY-MM-DD)",testID:"request-date",value:D.date,onChangeText:e=>v({date:e}),placeholder:"2026-11-20",style:F}),(0,t.isQueuedVenue)(e)||'greenside'===e||j?null:(0,x.jsx)(h.Row,{wrap:!0,children:['Lunch','Dinner'].map(e=>(0,x.jsx)(h.Button,{testID:`request-service-${e.toLowerCase()}`,label:e+(D.service===e?' \xb7 selected':''),kind:D.service===e?'primary':'secondary',onPress:()=>v({service:e,time:'Lunch'===e?'12:00':'18:00'}),style:{alignSelf:'auto'}},e))}),(0,x.jsx)(h.T,{size:18,weight:"semibold",center:!0,children:"Time within kitchen hours"}),(0,x.jsx)(h.Row,{wrap:!0,children:((0,t.isQueuedVenue)(e)?(0,s.queuedRequestSlots)(e,D.date||'',q):j?(0,r.allDaySlots)(D.date||'',j):(0,n.slotsForVenue)(e,D.date||'',D.service||'Lunch')).map(e=>(0,x.jsx)(h.Button,{testID:`request-time-${e.replace(':','')}`,label:e+(D.time===e?' \xb7 selected':''),kind:D.time===e?'primary':'secondary',onPress:()=>v({time:e}),style:{alignSelf:'auto'}},e))}),(0,x.jsx)(k,{label:"Covers",testID:"request-covers",keyboardType:"number-pad",value:String(D.covers??''),onChangeText:e=>v({covers:Number(e)}),style:F})]}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(h.T,{size:18,center:!0,children:[null==c?.bedrooms?'':`${c.bedrooms} bedrooms. `,c?.priceNote,"."]}),(0,x.jsx)(k,{label:"Check-in date (YYYY-MM-DD)",testID:"request-check-in",value:D.checkIn,onChangeText:e=>v({checkIn:e}),style:F}),(0,x.jsx)(k,{label:"Check-out date (YYYY-MM-DD)",testID:"request-check-out",value:D.checkOut,onChangeText:e=>v({checkOut:e}),style:F}),(0,x.jsx)(h.T,{size:18,weight:"semibold",center:!0,children:"Room type"}),c?.roomTypes.map(e=>(0,x.jsx)(h.Button,{testID:`request-room-${e.id}`,label:`${e.name} \xb7 ${null==e.pricePence?'Price to confirm with the hotel':`${e.from?'from ':''}\xa3${e.pricePence/100}`} \xb7 ${c.breakfast}${D.roomType===e.id?' \xb7 selected':''}`,kind:D.roomType===e.id?'primary':'secondary',onPress:()=>v({roomType:e.id})},e.id)),(0,x.jsx)(k,{label:"Guests",testID:"request-guests",keyboardType:"number-pad",value:String(D.guests??''),onChangeText:e=>v({guests:Number(e)}),style:F}),(0,x.jsx)(h.Button,{testID:"request-add-dinner",label:"Add dinner \xb7 "+(D.addDinner?'Yes':'No'),kind:D.addDinner?'primary':'secondary',onPress:()=>v({addDinner:!D.addDinner})}),(0,x.jsx)(h.T,{size:18,center:!0,children:"The hotel will arrange dinner details with you."})]}),(0,x.jsx)(k,{label:"Name",testID:"request-name",autoComplete:"name",value:D.name,onChangeText:e=>v({name:e}),style:F}),(0,x.jsx)(k,{label:"Phone",testID:"request-phone",keyboardType:"phone-pad",autoComplete:"tel",value:D.phone,onChangeText:e=>v({phone:e}),style:F}),(0,x.jsx)(k,{label:"Email",testID:"request-email",keyboardType:"email-address",autoCapitalize:"none",autoComplete:"email",value:D.email,onChangeText:e=>v({email:e}),style:F}),(0,x.jsx)(k,{label:'table'===l?'Notes (allergies, occasion)':'Notes',testID:"request-notes",multiline:!0,maxLength:2e3,value:D.notes,onChangeText:e=>v({notes:e}),style:F}),(0,x.jsx)(u.default,{style:{display:'none'},accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",children:(0,x.jsx)(k,{label:"Leave this empty",value:S,onChangeText:w})}),B?(0,x.jsx)(k,{label:`Security check: ${B.question} = ?`,testID:"request-answer",keyboardType:"number-pad",value:C,onChangeText:I,style:F}):(0,x.jsx)(h.T,{size:18,center:!0,children:"Preparing security check\u2026"}),R?(0,x.jsx)(h.Banner,{kind:"warn",title:"Please check your request",children:R}):null,(0,x.jsx)(h.Button,{testID:"request-submit",label:$?'Sending request\u2026':'Send request',disabled:$||!B,onPress:()=>{L()}})]}),(0,x.jsx)(h.Button,{kind:"secondary",label:M?'greenside'===e?'Back to the restaurant':c?.enabled?'Back to the hotel':'Back to Customer home':'Back to Customer home',onPress:T})]})};var e,t=_r(d[0]),s=_r(d[1]),n=_r(d[2]),r=_r(d[3]),o=_r(d[4]),l=_r(d[5]),u=(e=l)&&e.__esModule?e:{default:e},c=_r(d[6]),h=_r(d[7]),y=_r(d[8]),p=_r(d[9]),b=_r(d[10]),x=_r(d[11]);function k({label:e,...t}){return(0,x.jsxs)(u.default,{style:{gap:6,alignSelf:'stretch',width:'100%'},children:[(0,x.jsx)(h.T,{size:18,weight:"semibold",center:!0,children:e}),(0,x.jsx)(c.TextInput,{accessibilityLabel:e,placeholderTextColor:y.colours.muted,...t,style:[{minHeight:48,fontSize:18,color:y.colours.text,backgroundColor:y.colours.surface2,borderWidth:1,borderColor:y.colours.border,borderRadius:12,padding:12},t.multiline?{minHeight:96,textAlignVertical:'top'}:null,t.style]})]})}},864,[6,941,1390,1391,30,127,877,813,821,11,1021,24]); +__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"STEP_IDS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"STEP_TITLE",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"TEMPLATE_LABEL",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"DAY_NAMES",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"WEEK_ORDER",{enumerable:!0,get:function(){return u}}),e.cleanQuestionnaire=function(t,s){if(!t||'object'!=typeof t)return null;const o=t,n=o.venue??{},u=l(n.name,80);if(!u)return null;const b={};for(let a=0;a<7;a++){const t=o.hours?.days?.[a],s=Array.isArray(t)?p(t[0]):null,n=Array.isArray(t)?p(t[1]):null;b[a]=s&&n?[s,n]:null}const y=['cafe','bistro','restaurant','custom'].includes(o.tables?.template)?o.tables.template:'custom',f=(a,t)=>'number'==typeof a&&a>=0&&a<=t?Math.round(a):void 0,h=o.features??{};return{version:1,venueId:l(s??o.venueId,60)||'venue',source:'signup-form'===o.source||'from-config'===o.source?o.source:'imported',submittedAt:l(o.submittedAt,10),onboardedAt:l(o.onboardedAt,10),venue:{name:u,tagline:l(n.tagline,120),address:l(n.address,200),phone:l(n.phone,30),email:l(n.email,120),website:l(n.website,120),hasLogo:!!n.hasLogo},hours:{days:b,note:l(o.hours?.note,300)},tables:{template:y,tables:f(o.tables?.tables,300),covers:f(o.tables?.covers,2e3),areas:Array.isArray(o.tables?.areas)?o.tables.areas.map(a=>l(a,40)).filter(Boolean).slice(0,12):void 0},team:Array.isArray(o.team)?o.team.map(a=>({name:l(a?.name,60)??'',role:d.includes(a?.role)?a.role:'staff',job:l(a?.job,60),email:l(a?.email,120),phone:l(a?.phone,30)})).filter(a=>a.name).slice(0,200):[],suppliers:Array.isArray(o.suppliers)?o.suppliers.map(a=>({name:l(a?.name,80)??'',category:l(a?.category,40),phone:l(a?.phone,30),email:l(a?.email,120)})).filter(a=>a.name).slice(0,100):[],pay:o.pay&&'object'==typeof o.pay?(0,a.cleanPay)(o.pay):void 0,accounts:Array.isArray(o.accounts)?o.accounts.map(a=>({provider:l(a?.provider,40)??'',handle:l(a?.handle,120)})).filter(a=>/^[a-z0-9-]+$/.test(a.provider)).slice(0,40):void 0,features:{bookings:c(h.bookings,!0),takeaway:c(h.takeaway,!0),orderAtTable:c(h.orderAtTable,!1),tips:c(h.tips,!0),rota:c(h.rota,!0),games:c(h.games,!0),specials:c(h.specials,!0)},notes:l(o.notes,1e3)}},e.questionnaireFromFacts=function(a,t){const s=a.tables??0,o=0===s?'custom':s<=9?'cafe':s<=16?'bistro':'restaurant';return{version:1,venueId:a.id,source:'from-config',venue:{name:a.name,tagline:a.tagline,address:a.address,phone:a.phone,website:a.website,hasLogo:a.hasLogo},hours:{days:{...a.hours},note:a.hoursNote},tables:{template:a.tables?'custom':o,tables:a.tables,covers:a.covers,areas:a.areas},team:a.team,suppliers:a.suppliers,pay:a.pay,features:{bookings:!0,takeaway:!1!==a.takeaway,orderAtTable:!!a.orderAtTable,tips:!0,rota:!0,games:!1!==a.games,specials:!0},...t}},e.mergeQuestionnaire=function(a,t){if(!t)return a;const s={},o=Object.values(t.hours?.days??{}).some(Boolean);for(let n=0;n<7;n++)s[n]=o?t.hours.days[n]??null:a.hours.days[n]??null;return{...a,...t,venue:{...a.venue,...Object.fromEntries(Object.entries(t.venue).filter(([,a])=>void 0!==a&&''!==a))},hours:{days:s,note:t.hours?.note??a.hours.note},tables:{...a.tables,...Object.fromEntries(Object.entries(t.tables).filter(([,a])=>void 0!==a))},team:t.team.length?t.team:a.team,suppliers:t.suppliers.length?t.suppliers:a.suppliers,pay:t.pay??a.pay,accounts:t.accounts?.length?t.accounts:a.accounts,features:{...a.features,...t.features}}},e.hoursLines=function(a){return u.map(t=>({day:n[t],text:a[t]?`${a[t][0]} to ${a[t][1]}`:'Closed'}))},Object.defineProperty(e,"EXAMPLE_QUESTIONNAIRE",{enumerable:!0,get:function(){return b}});var a=r(_d[0]);const t=['venue','hours','tables','team','suppliers','accounts','pay','features'],s={venue:'Your venue',hours:'Opening hours',tables:'Table plan',team:'Your team',suppliers:'Suppliers',accounts:'Connected accounts',pay:'Pay & tips',features:'Features'},o={cafe:'Small caf\xe9 (about 8 tables)',bistro:'Bistro (about 14 tables)',restaurant:'Restaurant (about 24 tables, 2 areas)',custom:'My own layout'},n=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],u=[1,2,3,4,5,6,0],l=(a,t=200)=>'string'==typeof a?a.trim().slice(0,t):void 0,c=(a,t)=>'boolean'==typeof a?a:t,p=a=>'string'==typeof a&&/^([01]\d|2[0-3]):[0-5]\d$/.test(a)?a:null,d=['owner','manager','staff'];const b={version:1,venueId:'example',source:'signup-form',submittedAt:'2026-10-20',venue:{name:'Example Harbour Caf\xe9',tagline:'Coffee, cakes and crab rolls',address:'1 Example Quay, Exampletown',phone:'01632 960000',email:'hello@example.com',website:'example.com',hasLogo:!1},hours:{days:{0:['10:00','16:00'],1:null,2:['09:00','16:00'],3:['09:00','16:00'],4:['09:00','16:00'],5:['09:00','20:00'],6:['09:00','20:00']},note:'Shorter hours in winter'},tables:{template:'cafe',tables:8,covers:30,areas:['Inside','Terrace']},team:[{name:'Alex Example',role:'owner'},{name:'Sam Example',role:'manager',job:'Front of house manager'},{name:'Jo Example',role:'staff',job:'Barista'}],suppliers:[{name:'Example Dairy',category:'Dairy'},{name:'Example Fish Co',category:'Fish & seafood'}],pay:{tipsFrequency:'fortnightly',tipsAnchorPayday:'2026-11-02',tipsEndsDaysBefore:1,wagePayDay:28,wageCutoffDay:23,weekendRule:'none'},features:{bookings:!0,takeaway:!0,orderAtTable:!1,tips:!0,rota:!0,games:!0,specials:!0}}},865,[1110]); +__d(function(e,a,i,n,r,o,s){r.exports={version:1,venueId:"kirkmichael",source:"from-config",submittedAt:"2026-11-05",onboardedAt:"2026-11-05",venue:{name:"The Kirkmichael Arms",tagline:"Michelin-listed restaurant and bar in Kirkmichael, Ayrshire",address:"3-5 Straiton Road, Kirkmichael, South Ayrshire KA19 7PH",phone:"01655 750 200",email:"enquiries@thekirkmichaelarms.co.uk",website:"https://www.kirkmichaelarms.co.uk/",hasLogo:!0},hours:{days:{0:["13:00","22:30"],1:null,2:null,3:null,4:["13:00","22:30"],5:["13:00","22:30"],6:["13:00","22:30"]},note:"Thu\u2013Sun from 1pm; schema close 22:30. Michelin lists Sunday from 12:30 \u2014 confirm. Closed Mon\u2013Wed."},tables:{template:"restaurant",tables:null,covers:56,areas:["Restaurant","Bar","Private dining (The Room)"],needsConfirmation:!0,note:"56 covers from historical sale listing; private dining about 18. Table count unknown \u2014 ask Gordon/Justin."},team:[{name:"Justin Galea",role:"owner",job:"Chef & Owner",email:"enquiries@thekirkmichaelarms.co.uk",phone:"01655 750 200"}],suppliers:[],accounts:[{provider:"instagram",handle:"@kirkmichaelarms_unfiltered"},{provider:"facebook",handle:"kirkmichaelarms"},{provider:"gmail",handle:"enquiries@thekirkmichaelarms.co.uk"},{provider:"tripadvisor",handle:"The Kirkmichael Arms"},{provider:"google-business",handle:"The Kirkmichael Arms"}],pay:{tipsFrequency:"fortnightly",tipsAnchorPayday:"2026-11-07",tipsEndsDaysBefore:1,wagePayDay:28,wageCutoffDay:23,weekendRule:"none"},features:{bookings:!0,takeaway:!1,orderAtTable:!1,tips:!0,rota:!0,games:!0,specials:!0},notes:"Seed as venue_id kirkmichael (separate tenant). Chef-owner Justin Galea. Brand accent #B87754 (whisky amber); lion emblem + wordmark in branding/. Deposit amount unknown \u2014 leave off until Gordon confirms. Bookings currently via own site /booking (own website booking page noted in research only). Menu from live Sample menus 2026-11-05; specials board changes often. Never blend with other venues' data."}},866,[]); +__d(function(e,n,a,o,s,t,i){s.exports={version:1,venueId:"wildings",source:"from-config",submittedAt:"2026-11-05",venue:{name:"Wildings Hotel & Restaurant",tagline:"Coastal cuisine with character",address:"Maidens Road, Maidens, KA26 9NR",phone:"01655 331 401",email:"bookings@wildingsrestaurant-hotel.co.uk",website:"https://www.wildingshotel.com/",hasLogo:!0},hours:{days:{0:["12:00","21:00"],1:["12:00","21:00"],2:["12:00","21:00"],3:["12:00","21:00"],4:["12:00","21:00"],5:["12:00","21:00"],6:["12:00","21:00"]},note:"Lunch Mon\u2013Sat 12:00\u201314:00, Sun 12:00\u201314:30; dinner daily 18:00\u201321:00 (closed 14:00\u201318:00). Bar hours not published. Sunday lunch end time to confirm."},tables:{template:"restaurant",tables:null,covers:null,areas:["Dining room 1","Dining room 2"],needsConfirmation:!0,note:"Two dining rooms per website; names, tables and covers unknown."},team:[],suppliers:[],accounts:[{provider:"facebook",handle:"profile.php?id=100057663900963"},{provider:"instagram",handle:"@wildingsmaidens"}],pay:{tipsFrequency:"fortnightly",tipsAnchorPayday:"2026-11-07",tipsEndsDaysBefore:1,wagePayDay:28,wageCutoffDay:23,weekendRule:"none"},features:{bookings:!0,takeaway:!1,orderAtTable:!1,tips:!0,rota:!0,games:!0,specials:!0},notes:"Separate tenant, venue id wildings. Accent #FFE3A5 (logo star gold) on ink #272A2F. No demo/local roster. Authorised real team is loaded from this venue\u2019s server; remaining staff list and personal manager contacts are to confirm. Deposit off until confirmed. Bookings are by phone/email today; site is Duda, so no Wix sync. Pay settings are app defaults, to confirm. Never blend with other venues' data.",onboardedAt:"2026-11-05"}},867,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SOUTERS_BG",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"SOUTERS_SURFACE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"SOUTERS_TYPE_SCALE",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"soutersFont",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"soutersSurface",{enumerable:!0,get:function(){return f}}),e.soutersInk=function(o){if(!t.IS_SOUTERS)return o;const c=(0,n.normaliseHex)(o);return c?'#A4622E'===c?'#D9AD8A':(0,n.contrast)(c,u)<4.5?'#FFFFFF':o:o};var t=r(d[0]),n=r(d[1]);const u='#56152A',o='#43122F',c=.88,S=n=>t.IS_SOUTERS?Math.round(n*c*100)/100:n,f=n=>t.IS_SOUTERS?o:n},868,[5,1237]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.QR=function({value:e,size:t=180}){return(0,n.jsx)(o.default,{style:{padding:12,backgroundColor:'#FFFFFF',borderRadius:12,alignSelf:'center',borderWidth:3,borderColor:u.colours.gold},children:(0,n.jsx)(l.default,{value:e,size:t,color:"#0B0B0B",backgroundColor:"#FFFFFF"})})},r(d[0]);var o=e(r(d[1])),l=e(r(d[2])),u=r(d[3]),n=r(d[4])},869,[30,127,1356,821,24]); +__d(function(g,_r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.forecastToday=function(i,u,l,h,f,y){const v=(0,s.examplesAllowed)(),k=(0,a.clampWeeks)(i.settings.forecastMinWeeks),M=v?null:y??(0,a.buildHistory)(i.id,u,l,[],f,k),w=v||!!M?.enough,b=(0,o.hoursFor)(i,f),H=[],O=(0,r.ymd)(f);let S=1;for(const e of h.filter(e=>e.date===O&&(null===e.restaurantId||e.restaurantId===i.id)))H.push(e.title.replace(/\s*\(substitute day\)/gi,'')),!1!==e.busier&&(S*='bank-holiday'===e.kind?1.25:'event'===e.kind?1.15:1.1);if(!b)return{open:!1,hours:[],restOfDay:{covers:0,low:0,high:0,takeaway:0,booked:0},flags:H,suggestions:['Kitchen closed today (per listed hours).'],multiplier:S,example:v,enough:w,minWeeks:k};const I=v?t.EXAMPLE_HISTORY[i.id]??t.EXAMPLE_HISTORY.default:w&&M?M:{covers:{},takeaway:{}},x=f.getDay(),E=c(i,f),C=(0,e.lastFoodOn)(i,O);let N=b.close.getMinutes()>0?b.close.getHours():b.close.getHours()-1;if(C){const[e,t]=C.time.split(':').map(Number);N=Math.min(N,t>0?e:e-1),'kitchen closes'!==C.reason&&H.push(`Last food orders ${C.time} (${C.reason})`)}const $=u.filter(e=>e.restaurantId===i.id&&e.date===O&&['confirmed','seated','finished'].includes(e.status)),_=$.filter(e=>!e.walkIn&&'finished'!==e.status).map(e=>Number(e.time.slice(0,2))),P=Math.min(E[0],b.open.getHours(),..._),T=Math.max(E[1],N,..._),A=[];for(let e=P;e<=T;e++){const t=e>=b.open.getHours()&&e<=N,o=I.covers[x]?.[e]??0,s=I.takeaway[x]?.[e]??0,a=$.filter(t=>!t.walkIn&&'finished'!==t.status&&Number(t.time.slice(0,2))===e).reduce((e,t)=>e+t.partySize,0),n=$.filter(t=>t.walkIn&&['seated','finished'].includes(t.status)&&Number(t.time.slice(0,2))===e).reduce((e,t)=>e+t.partySize,0),u=t?Math.round(o*i.settings.walkInShare*S):0,c=w&&t?Math.max(0,Math.round(o*S*(1-i.settings.walkInShare))-a):0,h=Math.max(n,u)+c,f=a+h,p=l.filter(t=>t.restaurantId===i.id&&'takeaway'===t.type&&'cancelled'!==t.status&&t.slotTime&&new Date(t.slotTime).getHours()===e&&(0,r.ymd)(new Date(t.slotTime))===O).length,y=t?Math.max(p,Math.round(s*S)):p;A.push({hour:e,booked:a,walkIns:h,covers:f,coversLow:w?Math.round(.8*f):f,coversHigh:w?Math.round(1.2*f):f,takeawayPlaced:p,takeaway:y,historicalCovers:o})}const L=p(i,x);if(w&&L){const e=L-A.reduce((e,t)=>e+t.covers,0),t=A.filter(e=>e.hour>=b.open.getHours()&&e.hour<=N);if(e>0&&t.length){const o=t.map(e=>e.historicalCovers),r=n(e,o.reduce((e,t)=>e+t,0)>0?o:t.map(()=>1));t.forEach((e,t)=>{const o=r[t];o&&(e.floorAdded=o,e.walkIns+=o,e.covers+=o,e.coversHigh=Math.max(e.coversHigh,Math.round(1.2*e.covers)))})}const o=A.reduce((e,t)=>e+t.coversLow,0);if(oMath.max(1,e.covers)));t.forEach((t,o)=>{t.coversLow=Math.min(t.covers,t.coversLow+e[o])})}}const R=f.getHours()+(f.getMinutes()>=30?1:0),D=A.filter(e=>e.hour>=R),j=D[0],W=e=>D.reduce((t,o)=>t+e(o),0),F={covers:W(e=>e.covers),low:W(e=>e.coversLow),high:W(e=>e.coversHigh),takeaway:W(e=>e.takeaway),booked:W(e=>e.booked)},G=[],z=i.settings.capacityPerHour,B=D.reduce((e,t)=>!e||t.covers>e.covers?t:e,void 0);B&&B.covers>=.85*z&&G.push(`Dining room near capacity around ${String(B.hour).padStart(2,'0')}:00 (about ${B.covers} of ${z} covers) \u2014 consider pausing or capping takeaway slots then.`);const V=D.find(e=>e.historicalCovers>0&&e.covers>1.1*e.historicalCovers);V&&G.push(`Busier than a usual ${['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'][x]} from ${String(V.hour).padStart(2,'0')}:00 \u2014 consider one more on the floor.`);F.takeaway>=10&&G.push(`About ${F.takeaway} takeaway orders expected \u2014 prep extra haddock and chips.`);w||G.unshift(`Not enough history yet. ${(0,s.notEnoughTip)(k)}`);G.length||G.push('Looks like a normal service \u2014 no action suggested.');return{open:!0,nextHour:j,hours:A,restOfDay:F,flags:H,suggestions:G,multiplier:S,example:v,enough:w,minWeeks:k,minCovers:L??void 0}},_e.spread=n,Object.defineProperty(_e,"ANCHORAGE_FORECAST_HOURS",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"forecastHoursOf",{enumerable:!0,get:function(){return u}}),_e.forecastWindow=c,Object.defineProperty(_e,"ANCHORAGE_MIN_COVERS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"MIN_COVERS_NOTE",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"minCoversOf",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"minCoversOn",{enumerable:!0,get:function(){return p}}),_e.coversRange=function(e,t,o=!0){const r=Math.min(e,t),s=Math.max(e,t),a=r===s?String(r):`${r} to ${s}`;return o?`${a} ${1===s?'cover':'covers'}`:a};var e=_r(d[0]),t=_r(d[1]),o=_r(d[2]),r=_r(d[3]),s=_r(d[4]),a=_r(d[5]);function n(e,t){const o=t.reduce((e,t)=>e+t,0)||1,r=t.map(t=>e*t/o),s=r.map(Math.floor);let a=e-s.reduce((e,t)=>e+t,0);return r.map((e,t)=>[e-Math.floor(e),t]).sort((e,t)=>t[0]-e[0]).forEach(([,e])=>{a>0&&(s[e]++,a--)}),s}const i={0:['12:00','22:00'],1:null,2:null,3:['12:00','22:00'],4:['12:00','22:00'],5:['12:00','22:00'],6:['12:00','22:00']},u=e=>e.settings.forecastHours??('anchorage'===e.id?i:{});function c(e,t){const r=(0,o.hoursFor)(e,t),s=r.close.getMinutes()>0?r.close.getHours():r.close.getHours()-1,a=u(e)[t.getDay()];if(!a)return[r.open.getHours(),s];const[n]=a[0].split(':').map(Number),[i,c]=a[1].split(':').map(Number);return[Math.min(n,r.open.getHours()),Math.max(c>0?i:i-1,s)]}const l={0:50,6:50},h='Gordon, 4 Nov 2026',f=e=>e.settings.minCoversByDay??('anchorage'===e.id?l:{}),p=(e,t)=>{const o=f(e)[t];return o&&o>0?Math.round(o):null}},870,[809,1302,815,818,1119,1303]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.estimateWait=function(t,n,u){const o=Math.max(6,Math.round(n/6*u));return t*o}},871,[]); +__d(function(_g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"uuid",{enumerable:!0,get:function(){return y.uuid}}),_e.nowFrom=S,_e.linesFromBasket=w,Object.defineProperty(_e,"useStore",{enumerable:!0,get:function(){return C}}),Object.defineProperty(_e,"DEMO_CUSTOMER_ID",{enumerable:!0,get:function(){return u.DEMO_CUSTOMER_ID}});var e,t=_r(d[0]),a=_r(d[1]),r=_r(d[2]),n=_r(d[3]),s=_r(d[4]),i=_r(d[5]),o=(e=i)&&e.__esModule?e:{default:e},l=_r(d[6]),c=_r(d[7]),u=_r(d[8]),g=_r(d[9]),m=_r(d[10]),p=_r(d[11]),b=_r(d[12]),f=_r(d[13]),k=_r(d[14]),y=_r(d[15]);const $=(e,t,a)=>e.reduce((e,a)=>a.startsWith(t)?Math.max(e,Number(a.slice(t.length))||0):e,a)+1,I=e=>`${e}-${Math.random().toString(36).slice(2,8)}${Date.now().toString(36).slice(-3)}`;function S(e){return'live'===e.mode?new Date:new Date(e.simStartMs+(Date.now()-e.anchorRealMs))}function h(){const e=(0,u.defaultSimStart)();return{clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()},...(0,u.buildSeed)(e),outbox:[],msgTemplates:{}}}function w(e,t,a){return e.lines.flatMap(e=>{const r=t.find(t=>t.id===e.itemId);if(!r)return[];const n=(0,b.resolveItem)(r),s=(n.optionGroups??[]).flatMap(t=>t.choices.filter(t=>e.choiceIds.includes(t.id))),i=(n.price??0)+s.reduce((e,t)=>e+t.priceDelta,0),o=(0,p.conflictsFor)((0,p.effectiveAllergens)(n,e.choiceIds),a);return[{itemId:n.id,name:n.name,qty:e.qty,unitPrice:i,choices:s.map(e=>e.label),notes:e.notes,contains:o.contains,may:o.may,overridden:!!e.override&&o.contains.every(t=>e.override.allergens.includes(t)),prepMins:n.prepMins}]})}const O=e=>{const t='ABCDEFGHJKLMNPQRSTUVWXYZ23456789',a=()=>Array.from({length:4},()=>t[Math.floor(32*Math.random())]).join('');return`${e}-${a()}-${a()}-${a()}`},C=(0,l.create)()((0,c.persist)((e,t)=>{const a=()=>S(t().clock),r=(t,r,n)=>e(e=>({audit:[{id:I('au'),restaurantId:t,at:a().toISOString(),kind:r,text:n},...e.audit].slice(0,300)})),n=(a,n,s)=>{if(!a||s<=0)return 0;const i=t().giftCards.find(e=>e.code===a&&e.restaurantId===n);if(!i||i.balance<=0)return 0;const o=Math.min(i.balance,s);return e(e=>({giftCards:e.giftCards.map(e=>e.id===i.id?{...e,balance:e.balance-o}:e)})),r(n,'giftcard',`Gift card ${a.slice(0,8)}\u2026 redeemed \xa3${(o/100).toFixed(2)} (balance \xa3${((i.balance-o)/100).toFixed(2)})`),o},s=e=>{const a=t().restaurants.find(t=>t.id===e.restaurantId);a&&e.customerId===t().customer.id&&e.subtotal>=a.settings.stampMinSpend&&t().addStamp(e.restaurantId,e.customerId,'takeaway'===e.type?'Takeaway (auto on collection)':'Table QR bill (auto on payment)')},i=e=>(0,f.templatesFor)(t().msgTemplates[e]),o=a=>{a.length&&(e(e=>({outbox:[...a,...e.outbox].slice(0,300)})),(0,f.deliverQueued)(a.filter(e=>'queued'===e.status),(e,a)=>t().updateOutbox(e,a)))},l=(e,r)=>{const n=t().restaurants.find(e=>e.id===r.restaurantId);n&&o((0,f.composeBooking)(e,r,n,i(n.id),a().toISOString()))},c=e=>{const r=t().restaurants.find(t=>t.id===e.restaurantId);r&&o((0,f.composeOrder)(e,r,i(r.id),a().toISOString()))};return{...h(),resetDemo:()=>e(h()),setClockMode:()=>e({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}}),skipMinutes:()=>{},updateCustomer:t=>e(e=>({customer:{...e.customer,...t}})),setAllergy:(t,a)=>e(e=>{const r=e.customer.allergies.filter(e=>e.allergen!==t);return{customer:{...e.customer,allergies:a?[...r,{allergen:t,severity:a}]:r}}}),startBasket:(t,a,r)=>e(e=>{const n=e.basket.restaurantId===t&&e.basket.mode===a&&e.basket.tableNo===r;return{basket:{restaurantId:t,mode:a,tableNo:r,lines:n?e.basket.lines:[]}}}),addLine:t=>e(e=>({basket:{...e.basket,lines:[...e.basket.lines,{...t,key:I('ln')}]}})),setLineQty:(t,a)=>e(e=>({basket:{...e.basket,lines:a<=0?e.basket.lines.filter(e=>e.key!==t):e.basket.lines.map(e=>e.key===t?{...e,qty:a}:e)}})),overrideLine:(t,r)=>e(e=>({basket:{...e.basket,lines:e.basket.lines.map(e=>e.key===t?{...e,override:{allergens:r,at:a().toISOString()}}:e)}})),clearBasket:()=>e(e=>({basket:{...e.basket,lines:[]}})),placeOrder:({slotTime:s,tip:i,giftCardCode:o,notes:l,paidNow:u,phone:g,email:m})=>{const p=t(),b=p.basket,f=b.restaurantId,k=w(b,p.menu,p.customer.allergies),I=k.reduce((e,t)=>e+t.unitPrice*t.qty,0),S='table'===b.mode,h=$(p.orders.filter(e=>e.restaurantId===f).map(e=>e.ref),S?'Q-':'T-',S?p.counters.table:p.counters.order),O=u?n(o,f,I+i):0,C=I+i,v={id:(0,y.uuid)(),ref:`${S?'Q':'T'}-${h}`,restaurantId:f,customerId:p.customer.id,customerName:p.customer.name,type:b.mode,tableNo:b.tableNo,slotTime:s,lines:k,subtotal:I,tip:i,giftCardApplied:O,giftCardCode:O?o:void 0,total:C,paid:u?C:0,status:'new',createdAt:a().toISOString(),allergies:p.customer.allergies,readiness:{},notes:l,channel:'app',...'takeaway'===b.mode?{phone:g??p.customer.phone,email:m??p.customer.email}:{}};e(e=>({orders:[v,...e.orders],basket:{...e.basket,lines:[]},counters:S?{...e.counters,table:h}:{...e.counters,order:h}}));const A=k.filter(e=>e.overridden);return r(f,'order',`Order ${v.ref} placed (${S?`Table ${b.tableNo}`:'takeaway'})${A.length?` \u2014 ALLERGY OVERRIDE on ${A.map(e=>e.name).join(', ')}`:''}`),v.allergies.length&&r(f,'allergy',`Allergies declared and confirmed by customer on ${v.ref}: ${v.allergies.map(e=>`${e.allergen} (${e.severity})`).join(', ')}`),c(v),v},setOrderStatus:(a,n,i)=>{const o=t().orders.find(e=>e.id===a);o&&((0,k.statusBlock)(o,n,(0,k.linkedBooking)(o,t().bookings))||(e(e=>({orders:e.orders.map(e=>e.id===a?{...e,status:n}:e)})),r(o.restaurantId,'order',`${o.ref} \u2192 ${n}${i?` by ${i}`:''}`),'collected'===n&&'takeaway'===o.type&&s(o)))},ackOrderAllergy:(n,s)=>{const i=t().orders.find(e=>e.id===n);if(!i||!(0,k.canSign)(i,'kitchen',(0,k.linkedBooking)(i,t().bookings)))return;const o={by:s,at:a().toISOString()};e(e=>({orders:e.orders.map(e=>e.id===n?{...e,allergyAck:o,status:'new'===e.status?'acknowledged':e.status}:e)})),r(i.restaurantId,'allergy',`Allergen sign-off 3/5 Kitchen on ${i.ref}: ${s} (chef signed off before cooking)`)},tickOrderAllergy:(n,s,i,o=!0)=>{const l=t().orders.find(e=>e.id===n);if(!l)return;const c={...l.allergyTicks??{}};o?c[s]={by:i,at:a().toISOString()}:delete c[s],e(e=>({orders:e.orders.map(e=>e.id===n?{...e,allergyTicks:c}:e)})),r(l.restaurantId,'allergy',`${l.ref}: kitchen ${o?'confirmed':'unticked'} ${s} (${i})`)},ackReadiness:(n,s,i)=>{const o=t().orders.find(e=>e.id===n);o&&('cook'===s&&(0,k.statusBlock)(o,'preparing',(0,k.linkedBooking)(o,t().bookings))||(e(e=>({orders:e.orders.map(e=>e.id===n?{...e,readiness:{...e.readiness,[s]:{by:i,at:a().toISOString()}},status:'cook'===s&&['new','acknowledged'].includes(e.status)?'preparing':e.status}:e)})),r(o.restaurantId,'order',`${o.ref}: ${'cook'===s?'started cooking':'bagged'} (${i})`)))},handoverCheck:(n,s)=>{const i=t().orders.find(e=>e.id===n);i&&(0,k.canSign)(i,'table',(0,k.linkedBooking)(i,t().bookings))&&(e(e=>({orders:e.orders.map(e=>e.id===n?{...e,handoverCheck:{by:s,at:a().toISOString()}}:e)})),r(i.restaurantId,'allergy',`Allergen sign-off 5/5 Table on ${i.ref}: ${s} (served and checked with the guest; chain complete)`))},signAllergyStep:(n,s,i)=>{const o=t().orders.find(e=>e.id===n);if(!o||!i.trim())return!1;const l=(0,k.linkedBooking)(o,t().bookings);if(!(0,k.canSign)(o,s,l))return!1;if('kitchen'===s)return t().ackOrderAllergy(n,i),!0;if('table'===s)return t().handoverCheck(n,i),!0;const c={by:i,at:a().toISOString()};'booked'===s&&l&&l.allergies.length&&!l.allergyAck?e(e=>({bookings:e.bookings.map(e=>e.id===l.id?{...e,allergyAck:c}:e)})):e(e=>({orders:e.orders.map(e=>e.id===n?{...e,allergyChain:{...e.allergyChain,[s]:c}}:e)}));const u=(0,k.stepInfo)(s);return r(o.restaurantId,'allergy',`Allergen sign-off ${u.n}/5 ${u.label} on ${o.ref}: ${i} (${u.what.toLowerCase()})`),!0},customerSignal:(t,a)=>e(e=>({orders:e.orders.map(e=>e.id===t?{...e,customerSignal:a}:e)})),setSplit:(t,a,r)=>e(e=>({orders:e.orders.map(e=>e.id===t?{...e,tip:r,total:e.subtotal+r,split:{ways:a,paidShares:e.split?.paidShares??0}}:e)})),payTable:(a,{shares:i,giftCardCode:o})=>{const l=t().orders.find(e=>e.id===a);if(!l)return;const c=l.split?.ways??1,u=Math.ceil(l.total/c),g=Math.min(c,(l.split?.paidShares??0)+i),m=g>=c,p=m?l.total-l.paid:Math.min(l.total-l.paid,u*i),b=n(o,l.restaurantId,p),f={...l,giftCardApplied:l.giftCardApplied+b,giftCardCode:b?o:l.giftCardCode,paid:l.paid+p,split:{ways:c,paidShares:g},status:m?'closed':l.status};e(e=>({orders:e.orders.map(e=>e.id===a?f:e)})),r(l.restaurantId,'order',`${l.ref} (Table ${l.tableNo}) ${m?'bill paid in full':`share ${g}/${c} paid`} (paid at the till)`),m&&s(f)},createBooking:n=>{const s=$(t().bookings.filter(e=>e.restaurantId===n.restaurantId).map(e=>e.ref),'BK-',t().counters.booking),i=t().restaurants.find(e=>e.id===n.restaurantId)?.settings,o='online'===n.source&&!!i&&(n.partySize>(i.autoAcceptUpTo??7)||!!i.reviewRequests&&!!n.notes.trim()),c={...n,id:(0,y.uuid)(),ref:`BK-${s}`,status:o?'pending':'confirmed',createdAt:a().toISOString()};return e(e=>({bookings:[...e.bookings,c],counters:{...e.counters,booking:s}})),r(c.restaurantId,'booking',`Booking ${o?'request ':''}${c.ref}: ${c.name}, ${c.partySize} on ${c.date} ${c.time}${c.source?` (${c.source})`:''}${c.allergies.length?' \u2014 allergies declared':''}`),l(o?'booking-request':'booking-confirmation',c),c},decideBooking:(n,s,i)=>{const o=t().bookings.find(e=>e.id===n);if(!o||'pending'!==o.status)return;const c={by:i,at:a().toISOString(),outcome:s},u='confirmed'===s?'confirmed':'cancelled';e(e=>({bookings:e.bookings.map(e=>e.id===n?{...e,status:u,decided:c}:e)})),r(o.restaurantId,'booking',`Booking request ${o.ref} (${o.name}, ${o.partySize}) ${s} by ${i}`),l('confirmed'===s?'booking-confirmation':'booking-declined',{...o,status:u})},addOutbox:t=>e(e=>({outbox:[...t,...e.outbox].slice(0,300)})),updateOutbox:(t,a)=>e(e=>({outbox:e.outbox.map(e=>e.id===t?{...e,...a}:e)})),clearOutbox:t=>e(e=>({outbox:e.outbox.filter(e=>e.restaurantId!==t)})),setTemplate:(t,a,r)=>e(e=>{const n={...e.msgTemplates[t]??{}};return null===r?delete n[a]:n[a]={...n[a]??{},...r},{msgTemplates:{...e.msgTemplates,[t]:n}}}),acceptOrder:(n,s,i)=>{const o=t().orders.find(e=>e.id===n);if(!o)return!1;const l='new'===o.status&&!!(0,k.statusBlock)(o,'acknowledged',(0,k.linkedBooking)(o,t().bookings)),c=a(),u=i?new Date(c.getTime()+6e4*i).toISOString():o.readyBy;return e(e=>({orders:e.orders.map(e=>e.id===n?{...e,status:'new'!==e.status||l?e.status:'acknowledged',accepted:e.accepted??{by:s,at:c.toISOString()},readyBy:u}:e)})),r(o.restaurantId,'order',`${o.ref} accepted by ${s}${i?`, ready by ${String(new Date(u).getHours()).padStart(2,'0')}:${String(new Date(u).getMinutes()).padStart(2,'0')}`:''}`),!l},setBookingStatus:(n,s)=>{const i=t().bookings.find(e=>e.id===n),o=a().toISOString();e(e=>({bookings:e.bookings.map(e=>e.id===n?{...e,status:s,...'seated'===s?{seatedAt:o}:'finished'===s?{finishedAt:o}:{}}:e)})),i&&r(i.restaurantId,'booking',`${i.ref} ${i.name} \u2192 ${s}`)},seatWalkIn:(n,s,i,o)=>{const l=a(),c=`${l.getFullYear()}-${String(l.getMonth()+1).padStart(2,'0')}-${String(l.getDate()).padStart(2,'0')}`,u=`${String(l.getHours()).padStart(2,'0')}:${String(l.getMinutes()).padStart(2,'0')}`,g=t().bookings.filter(e=>e.restaurantId===n&&e.walkIn&&e.date===c).reduce((e,t)=>Math.max(e,Number(t.ref.slice(2))||0),0)+1,m={id:(0,y.uuid)(),ref:`W-${g}`,restaurantId:n,customerId:null,name:'Walk-in',partySize:s,date:c,time:u,table:i||void 0,allergies:[],notes:(o??'').trim(),status:'seated',security:'none',depositPaid:0,createdAt:l.toISOString(),seatedAt:l.toISOString(),walkIn:!0,source:'walk-in'};return e(e=>({bookings:[...e.bookings,m]})),r(n,'walkin',`Walk-in ${m.ref} seated: ${s} cover(s)${i?`, Table ${i}`:', table to assign'}`),m},setBookingTable:(a,n)=>{const s=t().bookings.find(e=>e.id===a);e(e=>({bookings:e.bookings.map(e=>e.id===a?{...e,table:n}:e)})),s&&r(s.restaurantId,'booking',`${s.ref} ${s.name} \u2192 ${n?n.includes('+')?`Tables ${n.split('+').join(' + ')}`:`Table ${n}`:'no table'}`)},updateBooking:(a,n)=>{const s=t().bookings.find(e=>e.id===a);e(e=>({bookings:e.bookings.map(e=>e.id===a?{...e,...n}:e)})),s&&r(s.restaurantId,'booking',`${s.ref} ${s.walkIn?'Walk-in':s.name} moved/updated${n.table?` \u2192 Table ${n.table}`:''}${n.time?` at ${n.time}`:''}${n.durationMins?` for ${n.durationMins} min`:''}`)},undoWalkIn:a=>{const n=t().bookings.find(e=>e.id===a);n&&n.walkIn&&(e(e=>({bookings:e.bookings.filter(e=>e.id!==a)})),r(n.restaurantId,'walkin',`Walk-in ${n.ref} undone`))},ackBookingAllergy:(n,s)=>{const i=t().bookings.find(e=>e.id===n);i&&!i.allergyAck&&(e(e=>({bookings:e.bookings.map(e=>e.id===n?{...e,allergyAck:{by:s,at:a().toISOString()}}:e)})),r(i.restaurantId,'allergy',`Allergen sign-off 1/5 Booked on ${i.ref} (${i.name}): ${s} (allergy recorded)`))},joinWaitlist:(n,s,i,o)=>{const l=t().waitlist.filter(e=>e.restaurantId===n).reduce((e,t)=>Math.max(e,t.number),0)+1,c={id:I('wl'),restaurantId:n,number:l,name:s,partySize:i,joinedAt:a().toISOString(),status:'waiting',customerId:o};return e(e=>({waitlist:[...e.waitlist,c]})),r(n,'waitlist',`${s} (${i}) joined the waitlist as #${l}`),c},setWaitlistStatus:(a,n)=>{const s=t().waitlist.find(e=>e.id===a);e(e=>({waitlist:e.waitlist.map(e=>e.id===a?{...e,status:n}:e)})),s&&(r(s.restaurantId,'waitlist',`Waitlist #${s.number} ${s.name} \u2192 ${n}`),'seated'===n&&t().addWalkIn(s.restaurantId,s.partySize))},addWalkIn:(t,a)=>{e(e=>({walkIns:{...e.walkIns,[t]:(e.walkIns[t]??0)+a}})),r(t,'walkin',`Walk-in seated: ${a} cover(s)`)},addStamp:(n,s,i)=>{const o=t().restaurants.find(e=>e.id===n);o&&(e(e=>{const t=e.stampCards.find(e=>e.restaurantId===n&&e.customerId===s),r=t??{restaurantId:n,customerId:s,stamps:0,rewardsAvailable:0,history:[]};let l=r.stamps+1,c=r.rewardsAvailable;l>=o.settings.stampTarget&&(l=0,c+=1);const u={...r,stamps:l,rewardsAvailable:c,history:[{at:a().toISOString(),source:i},...r.history]};return{stampCards:t?e.stampCards.map(e=>e===t?u:e):[...e.stampCards,u]}}),r(n,'stamp',`Stamp added (${i})`))},redeemReward:(t,a)=>{e(e=>({stampCards:e.stampCards.map(e=>e.restaurantId===t&&e.customerId===a&&e.rewardsAvailable>0?{...e,rewardsAvailable:e.rewardsAvailable-1}:e)})),r(t,'stamp','Loyalty reward redeemed')},buyGiftCard:(n,s,i,o)=>{const l=n.slice(0,3).toUpperCase(),c={id:I('gc'),code:O(l),restaurantId:n,initial:s,balance:s,ownerId:t().customer.id,recipientName:i,message:o,createdAt:a().toISOString()};return e(e=>({giftCards:[c,...e.giftCards]})),r(n,'giftcard',`Gift card sold \xa3${(s/100).toFixed(2)} (demo payment)`),c},redeemGiftCard:(a,n,s)=>{const i=t().giftCards.find(e=>e.code.toUpperCase()===a.trim().toUpperCase());return!(!i||n<=0||n>i.balance)&&(e(e=>({giftCards:e.giftCards.map(e=>e.id===i.id?{...e,balance:e.balance-n}:e)})),r(i.restaurantId,'giftcard',`Gift card ${i.code} redeemed \xa3${(n/100).toFixed(2)} by ${s}`),!0)},honourLegacyCard:(t,n,s,i)=>{const o={id:I('gc'),code:n.trim().toUpperCase(),restaurantId:t,initial:s,balance:s,ownerId:'legacy',recipientName:'Legacy website bookings gift card',message:`Honoured by ${i}`,createdAt:a().toISOString().slice(0,10),legacy:!0};return e(e=>({giftCards:[o,...e.giftCards]})),r(t,'giftcard',`Legacy website bookings gift card ${o.code} honoured (\xa3${(s/100).toFixed(2)}) by ${i}`),o},addEvent:t=>e(e=>({events:[...e.events,{...t,id:I('ev')}]})),addRating:t=>{e(e=>({ratings:[{...t,id:I('rt'),createdAt:a().toISOString()},...e.ratings],orders:t.orderId?e.orders.map(e=>e.id===t.orderId?{...e,rated:!0}:e):e.orders})),r(t.restaurantId,'rating',`Private rating ${t.stars}/5 from ${t.customerName}`)},updateMenuItem:(a,n)=>{const{name:s,section:i,price:o,allergens:l,allergenNotes:c,...u}=n,g={};void 0!==s&&(g.dish=s),void 0!==i&&(g.section=i),'price'in n&&(g.price=o??null),void 0!==l&&(g.allergens=l),'allergenNotes'in n&&(g.allergenNotes=c);const m='optionGroups'in n,p=(0,b.menuCardBridge)();p&&(Object.keys(g).length||m)&&p.menuEdited(a,g,'CoverCharge for Managers',m);const f=p?u:n;Object.keys(f).length&&e(e=>({menu:e.menu.map(e=>e.id===a?{...e,...f}:e)}));const k=t().menu.find(e=>e.id===a);k&&Object.keys(f).length&&r(k.restaurantId,'menu',`Menu: ${(0,b.resolveItem)(k).name} updated`)},setSignOff:(t,r)=>{const n=(0,b.menuCardBridge)();n?r?n.signOff(t,r):n.menuEdited(t,{},'CoverCharge for Managers',!0):e(e=>({menu:e.menu.map(e=>e.id===t?{...e,signOff:r?{by:r,at:a().toISOString().slice(0,10)}:null}:e)}))},addAudit:(e,t,a)=>r(e,t,a),updateSettings:(t,a)=>{e(e=>({restaurants:e.restaurants.map(e=>e.id===t?{...e,settings:{...e.settings,...a}}:e)})),'takeawayPaused'in a&&r(t,'order',"Takeaway slots "+(a.takeawayPaused?'PAUSED':'resumed'))},addMenuItem:t=>{const a=I('m');return e(e=>({menu:[...e.menu,{...t,id:a}]})),(0,b.menuCardBridge)()?.menuItemAdded({...t,id:a}),r(t.restaurantId,'menu',`Menu: ${t.name} added (recipe card awaiting head chef sign-off)`),a},updateRestaurant:(t,a)=>{e(e=>({restaurants:e.restaurants.map(e=>e.id===t?{...e,...a}:e)})),r(t,'menu',`Restaurant info updated (${Object.keys(a).join(', ')})`)},placeManualOrder:({restaurantId:n,type:s,channel:i,customerName:o,phone:l,email:u,tableNo:g,slotTime:m,lines:f,allergies:k,notes:I,by:S})=>{const h=t(),w=f.flatMap(({itemId:e,qty:t})=>{const a=h.menu.find(t=>t.id===e);if(!a||t<=0)return[];const r=(0,b.resolveItem)(a),n=(0,p.conflictsFor)((0,p.effectiveAllergens)(r),k);return[{itemId:e,name:r.name,qty:t,unitPrice:r.price??0,choices:[],notes:'',contains:n.contains,may:n.may,overridden:!1,prepMins:r.prepMins}]}),O=w.reduce((e,t)=>e+t.unitPrice*t.qty,0),C='table'===s,v=$(h.orders.filter(e=>e.restaurantId===n).map(e=>e.ref),C?'Q-':'T-',C?h.counters.table:h.counters.order),A={id:(0,y.uuid)(),ref:`${C?'Q':'T'}-${v}`,restaurantId:n,customerId:`manual-${i}`,customerName:o||(C?`Table ${g}`:'Walk-in'),type:s,tableNo:g,slotTime:m,lines:w,subtotal:O,tip:0,giftCardApplied:0,total:O,paid:0,status:'new',createdAt:a().toISOString(),allergies:k,readiness:{},notes:I,channel:i,...l?{phone:l}:{},...u?{email:u}:{},...k.length?{allergyChain:{booked:{by:S,at:a().toISOString()}}}:{}};return e(e=>({orders:[A,...e.orders],counters:C?{...e.counters,table:v}:{...e.counters,order:v}})),r(n,'order',`Order ${A.ref} taken by ${S} (${'phone'===i?'phone':'walk-in'===i?'walk-in takeaway':`Table ${g}`})`),k.length&&r(n,'allergy',`Allergen sign-off 1/5 Booked on ${A.ref}: ${S} recorded ${k.map(e=>`${e.allergen} (${e.severity})`).join(', ')}`),(l||u)&&c(A),A},ackAlert:(t,r)=>e(e=>({alertAcks:{...e.alertAcks,[t]:{by:r,at:a().toISOString()}}}))}},{name:'covercharge-demo-v1',version:9,migrate:async(e,t)=>{if(!e)return e;if(n.LIVE_VENUE_BUILD)return await(0,s.archiveChefCache)('core',e),Object.assign(e,(0,r.stripCoreLiveSamples)(e)),e.clock={mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()},e;if(e.clock={mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()},t<6){try{e.restaurants=(e.restaurants??[]).map(e=>'saltmarsh'===e?.id?{...e,name:'The Venue'}:e)}catch{}try{e.restaurants=(e.restaurants??[]).map(e=>'anchorage'===e?.id&&JSON.stringify(e.kitchenHours)===JSON.stringify(g.ANCHORAGE_KITCHEN_OLD)?{...e,kitchenHours:g.ANCHORAGE_KITCHEN,hoursNote:'Kitchen (food) hours from Gordon, 30 Oct 2026: closed Mon\u2013Tue. The closing time is last food orders. Bar hours not set.'}:e)}catch{}}if(t<5)try{e.events=(e.events??[]).map(e=>'string'==typeof e?.title&&/\(substitute day\)/i.test(e.title)?{...e,title:e.title.replace(/\s*\(substitute day\)/gi,'').trim()}:e)}catch{}if(t<4)try{e.restaurants=(e.restaurants??[]).map(e=>'anchorage'===e.id&&e.settings&&!e.settings.pay?{...e,settings:{...e.settings,pay:g.ANCHORAGE_PAY}}:e)}catch{}if(t<3)try{e.restaurants=(e.restaurants??[]).map(e=>'anchorage'===e.id?{...e,settings:{...e.settings,orderAtTable:!1}}:e),e.orders=(e.orders??[]).filter(e=>'ord-seed-3'!==e.id&&'Q-2018'!==e.ref),e.audit=(e.audit??[]).filter(e=>!String(e.text??'').includes('Q-2018'))}catch{}if(t>=2)return e;try{const t=(0,u.buildSeed)((0,u.defaultSimStart)()),a=new Map(t.bookings.map(e=>[e.id,e])),r=new Set((0,m.anchoragePlan)().tables.map(e=>e.name)),n=e=>!e||e.split('+').every(e=>r.has(e));e.bookings=(e.bookings??[]).map(e=>{const t=a.get(e.id);return t?{...e,table:t.table,dog:t.dog,notes:t.notes}:'anchorage'!==e.restaurantId||n(e.table)?e:{...e,table:void 0}})}catch{}return e},merge:(e,r)=>{const n={...r,...e};return a.IS_WILDINGS&&(n.restaurants=n.restaurants.map(t.withWildingsAddress)),n},storage:(0,c.createJSONStorage)(()=>o.default)}))},872,[1128,5,1129,833,1132,1116,952,1117,1133,3,945,814,1114,823,940,1034]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useShallow",{enumerable:!0,get:function(){return o}});var e,t=r(d[0]),u=(e=t)&&e.__esModule?e:{default:e},n=r(d[1]);function o(e){const t=u.default.useRef(void 0);return u=>{const o=e(u);return(0,n.shallow)(t.current,o)?t.current:t.current=o}}},873,[30,1141]); +__d(function(g,_r,i,_a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TABLE_ORDER_DEFAULT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"cleanToken",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"isTableNo",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"fromRow",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"toRow",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"hm",{enumerable:!0,get:function(){return s}}),e.openAt=function(t,r){const n=a(r),o=t.openFrom?a(t.openFrom):null,l=t.lastOrders?a(t.lastOrders):null;return null!==o&&null!==l?o<=l?n>=o&&n=o||n=o:null===l||n{const r=(t??'').trim().toUpperCase();return/^[A-Z2-9]{16}$/.test(r)?r:null},n=t=>/^[0-9]{1,4}$/.test(t),o=r=>r?{on:!!r.is_on,tables:Array.isArray(r.tables)?r.tables.map(String):null,staffAccept:!1!==r.staff_accept,openFrom:r.open_from?String(r.open_from).slice(0,5):null,lastOrders:r.last_orders?String(r.last_orders).slice(0,5):null,guestTip:r.guest_tip??''}:{...t},l=t=>({is_on:t.on,tables:t.tables&&t.tables.length?t.tables.filter(n):null,staff_accept:t.staffAccept,open_from:t.openFrom,last_orders:t.lastOrders,guest_tip:t.guestTip.slice(0,300)}),a=t=>{const[r,n]=t.split(':').map(Number);return 60*r+n},s=t=>`${String(Math.floor(t/60)%24).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`;const c=(t,r)=>t.reduce((t,n)=>t+n.qty*(r.find(t=>t.id===n.id)?.pricePence??0),0),u=(t,r,n)=>t.map(t=>r.find(r=>r.id===t.id)).filter(t=>!!t&&(t.allergens.some(t=>n.includes(t))||t.mayContain.some(t=>n.includes(t)))),f=(t,r)=>`${t.replace(/\/$/,'')}/customer-app/index.html?table=${r}`,p=t=>'table'===t.type&&'table-qr'===t.channel,b=t=>p(t)&&!!t.held&&!t.accepted&&'cancelled'!==t.status,m=t=>!b(t),y=t=>'cancelled'===t.status?t.cancelReason?`Cancelled: ${t.cancelReason}`:'Cancelled by the staff.':t.held&&!t.accepted?'Sent. Waiting for a member of staff to accept it.':'served'===t.status||'collected'===t.status||'closed'===t.status?'Served. Enjoy!':'ready'===t.status?'Ready: on its way to your table.':'Accepted: the kitchen has your order.',O=['Sold out','Wrong table','Sent twice','Kitchen closed','Guest asked to cancel'],h='Please pay at the bar or till. Paying by card from your phone is coming later.'},876,[]); +__d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.venueTextStyle=d,Object.defineProperty(_e,"Text",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"TextInput",{enumerable:!0,get:function(){return h}});var t=r(_d[0]),n=r(_d[1]),o=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(n){if('default'!==n){var o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,t})(r(_d[2])),f=e(r(_d[3])),u=e(r(_d[4])),l=e(r(_d[5])),c=r(_d[6]),s=r(_d[7]);function d(e){if(!t.IS_SOUTERS)return e;const n=l.default.flatten(e)||{};return{...n,...'number'==typeof n.fontSize?{fontSize:(0,c.soutersFont)(n.fontSize)}:{},...'number'==typeof n.lineHeight?{lineHeight:(0,c.soutersFont)(n.lineHeight)}:{},...'string'==typeof n.color?{color:(0,c.soutersInk)(n.color)}:{}}}const y=o.forwardRef(function({style:e,...t},n){return(0,s.jsx)(f.default,{...t,ref:n,style:d(e)})}),p=o.forwardRef(function({style:e,placeholderTextColor:t,...n},o){const f=d([{fontSize:14,color:'#F5F1E8'},e]),y=l.default.flatten(f)||{};return(0,s.jsx)(u.default,{...n,ref:o,placeholderTextColor:'string'==typeof t?(0,c.soutersInk)(t):'#B8B0A0',style:[f,{minHeight:Math.max(44,'number'==typeof y.minHeight?y.minHeight:44),minWidth:Math.max(44,'number'==typeof y.minWidth?y.minWidth:44)}]})}),S=o.forwardRef(function({style:e,...t},o){const u=l.default.flatten(e)||{};return(0,s.jsx)(f.default,{...t,ref:o,style:[u,{color:u.color===n.QUEUED_BRAND?.accent?n.QUEUED_BRAND.smallTextAccent:u.color}]})}),_=t.IS_QUEUED_VENUE?S:t.IS_SOUTERS?y:f.default,h=t.IS_SOUTERS?p:u.default},877,[5,1233,30,206,273,46,868,24]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.TableNumberWarning=function({plan:u}){const c=(0,n.numberClashes)(u.tables),o=[...new Set([...c.acrossAreas,...u.tables.filter(n=>c.sameArea.has(n.name)).map(n.tableNumber)])];return o.length?(0,l.jsxs)(t.T,{testID:"duplicate-table-numbers",size:16,colour:s.colours.goldLight,children:["Duplicate table numbers: ",o.join(', '),". Kept unchanged. Ask a manager to check the areas before assigning."]}):null},r(d[0]);var n=r(d[1]),s=r(d[2]),t=r(d[3]),l=r(d[4])},914,[30,945,821,813,24]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingTableButton=function({rid:e,booking:l,readOnly:y,turnBase:B=90,testID:f}){const[h,j]=(0,t.useState)(!1),k=(0,s.tableButtonLabel)(l.table),x=f??`table-btn-${l.id}`;if(y)return(0,c.jsx)(n.default,{testID:x,accessible:!0,accessibilityLabel:(0,s.tableButtonA11y)(l.table,!0),style:{minHeight:44,justifyContent:'center'},children:(0,c.jsx)(b.T,{size:16,weight:"semibold",colour:o.colours.goldLight,children:k})});return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(b.Button,{kind:"secondary",label:k,testID:x,accessibilityLabel:(0,s.tableButtonA11y)(l.table),onPress:()=>j(!0),style:{minHeight:44}}),h?(0,c.jsx)(u.TablePicker,{rid:e,booking:l,name:l.walkIn?'Walk-in':(l.name??'').replace(' (example)',''),turnBase:B,onClose:()=>j(!1)}):null]})};var e,t=r(d[0]),l=r(d[1]),n=(e=l)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),u=r(d[4]),b=r(d[5]),c=r(d[6])},915,[30,127,1297,821,930,813,24]); +__d(function(g,_r,i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingEditButton=function({rid:e,booking:a,who:l,role:s,inStaffApp:o,shiftManager:n,big:d,testID:h}){const[u,b]=(0,t.useState)(!1);return a.walkIn||!(0,c.canEditBooking)({variant:r.APP_VARIANT,inStaffApp:o,role:s,shiftManager:n})?null:(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(p.Button,{kind:"secondary",small:!d,label:"Edit booking",testID:h??`edit-booking-${a.id}`,accessibilityLabel:`Edit booking, ${a.name}, ${a.time}`,onPress:()=>b(!0),style:{minHeight:d?64:44}}),u?(0,x.jsx)(j,{rid:e,id:a.id,who:l,onClose:()=>b(!1)}):null]})},_e.EditBookingPicker=function({rid:e,today:a,who:l,onClose:o,hidePrivate:n}){const[d,r]=(0,t.useState)(null),c=(0,s.useBookings)(e).filter(e=>!e.walkIn&&e.date>=a&&!['cancelled','noshow','finished'].includes(e.status)).sort((e,t)=>e.date.localeCompare(t.date)||e.time.localeCompare(t.time)).slice(0,60);return d?(0,x.jsx)(j,{rid:e,id:d,who:l,hidePrivate:n,onClose:o}):(0,x.jsxs)(p.Sheet,{visible:!0,onClose:o,title:"Edit booking \xb7 pick a booking",maxWidth:640,testID:"edit-booking-picker",children:[(0,x.jsx)(p.T,{size:16,colour:u.colours.text,children:"Tip: tap the booking you want to change."}),c.length?c.map(e=>(0,x.jsx)(p.Button,{kind:"secondary",testID:`edit-pick-${e.id}`,label:`${e.date===a?'Today':e.date} ${e.time} \xb7 ${e.name} \xb7 ${e.partySize} ${1===e.partySize?'cover':'covers'}`,sub:e.notes?`Notes: ${e.notes}`:void 0,accessibilityLabel:`Edit booking, ${e.name}, ${e.date===a?'today':e.date}, ${e.time}, ${e.partySize} covers`,onPress:()=>r(e.id),style:{minHeight:56,alignItems:'flex-start'}},e.id)):(0,x.jsx)(p.Muted,{children:"No bookings to edit from today on."}),(0,x.jsx)(p.Button,{kind:"ghost",label:"Close",onPress:o,style:{minHeight:44}})]})},_e.EditBookingSheet=j;var e,t=_r(_d[0]),a=_r(_d[1]),l=(e=a)&&e.__esModule?e:{default:e},s=_r(_d[2]),o=_r(_d[3]),n=_r(_d[4]),d=_r(_d[5]),r=_r(_d[6]),c=_r(_d[7]),h=_r(_d[8]),u=_r(_d[9]),b=_r(_d[10]),m=_r(_d[11]),p=_r(_d[12]),x=_r(_d[13]);const y=/^([01]\d|2[0-3]):[0-5]\d$/,k=e=>{const t=e.trim().replace('.',':').match(/^(\d{1,2}):?(\d{2})$/);return t?`${t[1].padStart(2,'0')}:${t[2]}`:e.trim()};function j({rid:e,id:a,who:j,onClose:f,hidePrivate:v='display'===r.APP_VARIANT}){const T=(0,s.useBookings)(e),I=T.find(e=>e.id===a),C=(0,d.useRestaurant)(e),D=(0,o.usePlan)(e),P=(0,n.useBlocks)(e=>e.blocks),[$,w]=(0,t.useState)(I?(0,c.draftOf)(I):null),[B,S]=(0,t.useState)(null),[E,A]=(0,t.useState)(null);if(!I||!$||!C)return null;const z=e=>{S(null),A(null),w({...$,...e})},L=k($.time),_=y.test(L),F=(0,h.tableOptions)(D,T.filter(e=>e.date===$.date),$.table),N=(0,c.changedFields)(I,{...$,time:L}),W=C.settings.turnMins??90,R=async()=>{const t=(0,c.editPatch)(I,{...$,time:L},{by:j||'Team member',app:r.APP_VARIANT});if(Object.keys(t).length&&await s.repo.bookings.update(I.id,t),'seated'===I.status&&'table'in t&&t.table!==I.table){const a=e=>e?e.split('+').map(e=>e.trim()).filter(Boolean):[],l=a(I.table),s=a(t.table),n=o.useFloor.getState(),d=l.map(t=>n.live[e]?.[t]?.stage).find(Boolean)??'seated';l.filter(e=>!s.includes(e)).forEach(t=>n.setLive(e,t,{stage:void 0,dirty:!0})),s.forEach(t=>n.setLive(e,t,{stage:d,dirty:!1}))}A(`Saved. Changed: ${(0,c.editedWords)(N)}.`),S(null),f()};return(0,x.jsxs)(p.Sheet,{visible:!0,onClose:f,title:`Edit booking \xb7 ${I.name} \xb7 ${I.ref}`,maxWidth:760,testID:"edit-booking-sheet",children:[(0,x.jsx)(m.DepositChip,{b:I,money:!0,big:!0,testID:"edit-deposit"}),(0,c.isWixBooking)(I)?(0,x.jsx)(l.default,{testID:"edit-wix-note",accessible:!0,accessibilityLabel:c.WIX_EDIT_NOTE,style:{padding:12,borderRadius:12,borderWidth:1,borderColor:u.colours.gold},children:(0,x.jsx)(p.T,{size:16,colour:u.colours.goldLight,children:c.WIX_EDIT_NOTE})}):null,(0,x.jsx)(p.T,{size:16,colour:u.colours.text,children:"Tip: change what you need, then press Save changes."}),(0,x.jsx)(b.BookingDatePicker,{r:C,today:new Date,value:$.date,onChange:e=>z({date:e})}),(0,x.jsx)(p.Field,{label:"Time (24-hour, for example 19:30)",value:$.time,onChangeText:e=>z({time:e}),testID:"edit-time"}),_?null:(0,x.jsx)(p.T,{size:15,colour:u.colours.amber,children:"Write the time like 19:30."}),(0,x.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(p.T,{size:18,children:"Covers"}),(0,x.jsx)(p.Stepper,{value:$.partySize,onChange:e=>z({partySize:e}),min:1,max:60,label:"covers",testID:"edit-covers"})]}),(0,x.jsx)(p.Field,{label:"Name",value:$.name,onChangeText:e=>z({name:e}),testID:"edit-name"}),v?(0,x.jsx)(p.Muted,{children:"Phone and email can be changed in the Managers app; the Display never shows them."}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(p.Field,{label:"Phone",value:$.phone,onChangeText:e=>z({phone:e}),keyboardType:"phone-pad",testID:"edit-phone"}),(0,x.jsx)(p.Field,{label:"Email",value:$.email,onChangeText:e=>z({email:e}),keyboardType:"email-address",autoCapitalize:"none",testID:"edit-email"})]}),(0,x.jsx)(p.Field,{label:"Notes",value:$.notes,onChangeText:e=>z({notes:e}),placeholder:c.NOTES_PLACEHOLDER,multiline:!0,numberOfLines:3,testID:"edit-notes"}),I.allergies.length||I.allergyNote?(0,x.jsx)(p.Muted,{children:"Allergies are kept separately and are not changed here."}):null,(0,x.jsx)(p.T,{size:18,weight:"semibold",children:(0,h.tableButtonLabel)($.table)}),(0,x.jsxs)(p.Row,{gap:8,wrap:!0,children:[(0,x.jsx)(p.Button,{kind:$.table?'secondary':'primary',label:"No table",accessibilityLabel:"No table"+($.table?'':', chosen'),onPress:()=>z({table:''}),style:{minHeight:44,minWidth:96},testID:"edit-table-none"}),F.map(e=>(0,x.jsx)(p.Button,{kind:e===$.table?'primary':'secondary',label:(0,h.tableButtonLabel)(e),accessibilityLabel:`Table ${(0,h.tableButtonLabel)(e)}${e===$.table?', chosen':''}`,onPress:()=>z({table:e}),style:{minHeight:44,minWidth:64},testID:`edit-table-${e}`},e))]}),B?(0,x.jsxs)(l.default,{testID:"edit-warn",style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:u.colours.amber,backgroundColor:u.colours.amberBg},children:[B.map(e=>(0,x.jsx)(p.T,{size:16,colour:"#FFE2A8",children:e},e)),(0,x.jsx)(p.T,{size:16,colour:"#FFE2A8",children:"You can still save."})]}):null,E?(0,x.jsx)(p.T,{size:16,colour:u.colours.goldLight,children:E}):null,(0,x.jsxs)(p.Row,{gap:8,wrap:!0,children:[(0,x.jsx)(p.Button,{label:B?'Save anyway':'Save changes',testID:"edit-save",disabled:!_||$.name.trim().length<1||!N.length,onPress:()=>{const t=_?(0,n.blockAt)(P,e,$.date,L):void 0,a=(0,c.editWarnings)(I,{...$,time:L},T,t,W);!a.length||B?R():S(a)},style:{minHeight:56,flex:1}}),(0,x.jsx)(p.Button,{kind:"ghost",label:"Cancel",onPress:f,style:{minHeight:56}})]})]})}},916,[30,127,819,825,824,1022,806,812,1297,821,1298,951,813,24]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useScreensaverAsleep",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"useDisplayToolsH",{enumerable:!0,get:function(){return s}});var t=r(d[0]);const n=(0,t.create)(t=>({asleep:!1,set:n=>t({asleep:n})})),s=(0,t.create)(()=>({h:65}))},917,[952]); +__d(function(g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useSoldOut",{enumerable:!0,get:function(){return f}}),_e.setSoldOutBy=m,_e.setSoldOut=function(e,t,n){if(!s.useStore.getState().menu.find(t=>t.id===e))return;n&&m(n);s.useStore.getState().updateMenuItem(e,{soldOut:t})},_e.soldOutNow=function(e,t=c()){return(0,o.activeSoldOut)(f.getState().entries,e,t)},_e.linkSoldOut=O,_e.useSoldOutLink=function(e,t,n=!0){const r=_r(d[9]);r.useEffect(()=>{n&&O({adopt:e})},[e,n]),r.useEffect(()=>{n&&m(t)},[t,n])};var e,t=_r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},r=_r(d[1]),a=_r(d[2]),o=_r(d[3]),i=_r(d[4]),s=_r(d[5]),u=_r(d[6]),l=_r(d[7]);const c=()=>{try{return(0,s.nowFrom)(s.useStore.getState().clock)}catch{return new Date}},f=(0,r.create)()((0,a.persist)((e,t)=>({entries:[],adopted:{},mark:(t,n,r,a)=>{const u=c(),l=s.useStore.getState().restaurants.find(e=>e.id===t),f=(0,o.soldOutSettingsOf)(l?.settings?.soldOut),S=l?(0,i.hoursFor)(l,u)?.close??null:null,m=(0,o.clearAfterFor)(u,f,S),p={rid:t,itemId:n,name:r.slice(0,120),on:!0,at:u.toISOString(),by:a.slice(0,80),clearAfter:m?.toISOString(),auto:!1,kept:!1};e(e=>({entries:[...e.entries.filter(e=>!(e.rid===t&&e.itemId===n)),p]}))},back:(n,r,a)=>{const o=t().entries.find(e=>e.rid===n&&e.itemId===r);o&&o.on&&e(e=>({entries:e.entries.map(e=>e===o?{...e,on:!1,at:c().toISOString(),by:a.slice(0,80),clearAfter:void 0,kept:!!e.auto}:e)}))},expire:(n,r)=>{const a=(0,o.expiredSoldOut)(t().entries,n,r);if(!a.length)return 0;const i=new Set(a.map(e=>e.itemId));return e(e=>({entries:e.entries.map(e=>e.rid===n&&i.has(e.itemId)?{...e,on:!1,by:'Cleared automatically',clearAfter:void 0}:e)})),a.length}}),{name:'covercharge-soldout-v1',version:1,storage:(0,a.createJSONStorage)(()=>n.default),partialize:e=>({entries:e.entries.slice(-500),adopted:e.adopted})}));let S='Staff';function m(e){e&&(S=e.replace(' (example)',''))}let p=null;function O(e){if(p)return p;let t=!1;const n=(e=s.useStore.getState().menu)=>new Map(e.map(e=>[e.id,e.soldOut]));let r=n();if(e.adopt){const e={...f.getState().adopted},t=[];for(const t of s.useStore.getState().menu)e[t.restaurantId];for(const t of s.useStore.getState().menu)e[t.restaurantId]=!0;f.setState(n=>({entries:[...n.entries,...t],adopted:e}))}const a=()=>{const e=c(),a=f.getState().entries,o=s.useStore.getState().menu,i=new Map;for(const t of a){const n=t.on&&(!t.clearAfter||new Date(t.clearAfter).getTime()>e.getTime());i.set(`${t.rid}|${t.itemId}`,n)}const u=o.filter(e=>i.has(`${e.restaurantId}|${e.id}`)&&i.get(`${e.restaurantId}|${e.id}`)!==e.soldOut);if(u.length){t=!0;try{const e=new Map(u.map(e=>[e.id,i.get(`${e.restaurantId}|${e.id}`)]));s.useStore.setState(t=>({menu:t.menu.map(t=>e.has(t.id)?{...t,soldOut:e.get(t.id)}:t)}))}finally{t=!1,r=n()}}},o=s.useStore.subscribe((e,a)=>{if(e.menu===a.menu)return;const o=n(e.menu);if(!t)for(const t of e.menu){const e=r.get(t.id);void 0!==e&&e!==t.soldOut&&(t.soldOut?f.getState().mark(t.restaurantId,t.id,t.name,S):f.getState().back(t.restaurantId,t.id,S))}r=o}),i=f.subscribe((e,t)=>{e.entries!==t.entries&&a()}),u=()=>{const e=c(),t=new Set(f.getState().entries.filter(e=>e.on).map(e=>e.rid));for(const n of t)f.getState().expire(n,e)};u(),a();const l=setInterval(u,3e4);let m=null;if(e.adopt)try{m=_r(d[8],"./autoSoldOutStore").startAutoSoldOut()}catch{m=null}return p=()=>{o(),i(),clearInterval(l),m&&m(),p=null},p}u.PITCH&&'undefined'!=typeof globalThis&&(globalThis.__pitchLive=e=>(0,l.setLiveData)(!!e),globalThis.__pitchSoldOut=e=>{const t=s.useStore.getState(),n=t.restaurants[0]?.id;if(!n)return;const r=t.menu.filter(e=>e.restaurantId===n&&!e.hidden),a=['Sticky toffee pudding','Cullen skink','Fish supper','Steak pie','Haggis bon bons','Cranachan','Lemon tart','Mussels','Scampi','Venison burger','Chips (large)','Oysters','Lobster thermidor','Crab claws','Tablet ice cream','Beef shin','Smoked salmon','Cheeseboard','Halibut','Clootie dumpling'],o=(new Date).toISOString(),i=Array.from({length:e},(e,t)=>r[t]?{id:r[t].id,name:r[t].name}:{id:`pitch-so-${t}`,name:a[t%a.length]});f.setState(e=>({entries:[...e.entries.filter(e=>e.rid!==n||!i.some(t=>t.id===e.itemId)).map(e=>e.rid===n?{...e,on:!1}:e),...i.map(e=>({rid:n,itemId:e.id,name:e.name,on:!0,at:o,by:'Chef'}))]}))})},918,[1116,952,1117,944,815,872,2,1119,942,30]); +__d(function(g,r,i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"dismissNotice",{enumerable:!0,get:function(){return u.dismissNotice}}),Object.defineProperty(_e,"notify",{enumerable:!0,get:function(){return u.notify}}),Object.defineProperty(_e,"useSliders",{enumerable:!0,get:function(){return u.useSliders}}),Object.defineProperty(_e,"SLIDER",{enumerable:!0,get:function(){return y}}),_e.SliderButton=w,_e.SliderCard=S,_e.SliderHost=function(){x();const e=(0,u.useSliders)(e=>e.queue),n=e[0],o=(0,t.useRef)(null);if((0,t.useEffect)(()=>{if(f)return window.ccSlider=e=>(0,u.notify)(e),()=>{delete window.ccSlider}},[]),(0,t.useEffect)(()=>{if(o.current&&clearTimeout(o.current),!n)return;const e=void 0!==n.timeoutMs?n.timeoutMs:n.actions?.length||n.content?null:6e3;return e&&(o.current=setTimeout(()=>u.useSliders.getState().dismiss(n.id),e)),()=>{o.current&&clearTimeout(o.current)}},[n?.id,n?.timeoutMs]),!n)return null;const s=f?'fixed':'absolute';return(0,b.jsxs)(b.Fragment,{children:[n.modal?(0,b.jsx)(l.default,{...h('dim'),style:{position:s,left:0,right:0,top:0,bottom:0,zIndex:2147482990,backgroundColor:'rgba(0,0,0,0.72)'}}):null,(0,b.jsx)(l.default,{testID:"cc-slider-host",pointerEvents:"box-none",style:{position:s,left:12,right:12,bottom:12,zIndex:2147483e3,alignItems:'center',...f?{bottom:'calc(12px + env(safe-area-inset-bottom))'}:{}},children:(0,b.jsx)(S,{n:n,waiting:e.length-1,onClose:()=>u.useSliders.getState().dismiss(n.id)},n.id+':'+(n.seq??0))})]})};var t=r(d[0]);r(d[1]);var n=e(r(d[2])),o=e(r(d[3])),l=e(r(d[4])),s=e(r(d[5])),c=r(d[6]),a=r(d[7]),u=r(d[8]),b=r(d[9]);const f='undefined'!=typeof document,p="\n[data-ccsl=\"in\"]{animation:ccsl-in .45s cubic-bezier(.2,1,.3,1) both}\n@keyframes ccsl-in{from{opacity:0;transform:translate3d(0,110%,0)}to{opacity:1;transform:none}}\n[data-ccsl=\"urgent\"]{animation:ccsl-in .45s cubic-bezier(.2,1,.3,1) both,ccsl-red 1.6s ease-in-out .45s infinite}\n@keyframes ccsl-red{0%,100%{box-shadow:0 10px 30px rgba(0,0,0,.6),0 0 0 1px rgba(255,107,94,.55)}50%{box-shadow:0 10px 40px rgba(0,0,0,.6),0 0 0 2px #FF6B5E,0 0 34px rgba(255,107,94,.45)}}\n[data-ccsl=\"dim\"]{animation:ccsl-dim .3s ease both}\n@keyframes ccsl-dim{from{opacity:0}to{opacity:1}}\n@media (prefers-reduced-motion: reduce){[data-ccsl]{animation:none !important}}\n",h=e=>f?{dataSet:{ccsl:e}}:{};function x(){(0,t.useEffect)(()=>{if(!f||document.getElementById('cc-slider-css'))return;const e=document.createElement('style');e.id='cc-slider-css',e.textContent=p,document.head.appendChild(e)},[])}const y={bg:'#17140F',border:'rgba(207,164,95,.55)',text:'#F5F1E8',quiet:'#A89A80',gold:c.colours.gold,ink:'#17130D'},j=(e="normal")=>'urgent'===e?c.colours.red:'warn'===e?c.colours.amber:c.colours.gold,k=(e="normal")=>'urgent'===e?'rgba(255,107,94,.75)':'warn'===e?'rgba(255,181,71,.65)':y.border;function w({a:e,onDone:t,big:o}){const l=e.kind??'primary';return(0,b.jsx)(n.default,{testID:e.testID,accessibilityRole:"button",accessibilityLabel:e.label,onPress:()=>{try{e.onPress?.()}finally{e.keepOpen||t()}},style:({pressed:e})=>({minHeight:o?56:44,minWidth:44,paddingHorizontal:'ghost'===l?10:o?24:18,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:'primary'===l?y.gold:'transparent',borderWidth:'danger'===l?1:0,borderColor:c.colours.red,opacity:e?.8:1}),children:(0,b.jsx)(a.T,{size:o?18:'ghost'===l?14:15,weight:'primary'===l?'bold':'medium',colour:'primary'===l?y.ink:'danger'===l?c.colours.red:y.quiet,children:e.label})})}function S({n:e,onClose:t,waiting:n=0,maxWidth:c=520}){x();const u=e.tone??'normal',p=j(u),S=e.content,C=!!e.big,{height:I}=(0,s.default)(),D=e.actions??[];return(0,b.jsxs)(l.default,{testID:e.testID??'cc-slider',accessibilityRole:"summary",accessibilityLabel:`${e.kicker?e.kicker+': ':''}${e.title}`,...h('urgent'===u?'urgent':'in'),style:{width:'100%',maxWidth:C?Math.max(c,900):c,alignSelf:'center',borderRadius:14,backgroundColor:y.bg,borderWidth:1,borderColor:k(u),overflow:'hidden',...f?{boxShadow:'0 10px 30px rgba(0,0,0,.6)'}:{elevation:12}},children:['normal'!==u?(0,b.jsx)(l.default,{style:{position:'absolute',left:0,top:0,bottom:0,width:5,backgroundColor:p}}):null,(0,b.jsxs)(o.default,{style:{maxHeight:Math.max(220,I-40)},contentContainerStyle:{paddingVertical:C?18:12,paddingLeft:'normal'!==u?C?24:18:C?20:14,paddingRight:C?20:14,gap:C?10:6},children:[(0,b.jsxs)(l.default,{style:{flexDirection:'row',alignItems:'center',gap:12},children:[e.icon?(0,b.jsx)(a.T,{size:C?34:22,children:e.icon}):null,(0,b.jsxs)(l.default,{style:{flex:1,gap:2},children:[e.kicker?(0,b.jsx)(a.T,{size:C?15:11,weight:"bold",colour:p,style:{letterSpacing:1.4},children:e.kicker}):null,(0,b.jsx)(a.T,{size:C?24:15,weight:"medium",colour:y.text,children:e.title}),e.body?(0,b.jsx)(a.T,{size:C?18:13,colour:y.quiet,children:e.body}):null]}),D.length||S?null:(0,b.jsx)(w,{a:{label:'OK',kind:'ghost',testID:'cc-slider-ok'},onDone:t,big:C})]}),S?(0,b.jsx)(S,{close:t}):null,D.length?(0,b.jsx)(l.default,{style:{flexDirection:'row',flexWrap:'wrap',alignItems:'center',gap:8,justifyContent:'flex-end'},children:D.map(e=>(0,b.jsx)(w,{a:e,onDone:t,big:C},e.label))}):null,n>0?(0,b.jsxs)(a.T,{size:C?14:11,colour:y.quiet,children:[n," more waiting"]}):null]})]})}},919,[30,122,263,151,127,287,821,813,947,24]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AppBadge=function({label:o}){return(0,c.jsx)(t.default,{testID:"app-badge",accessibilityLabel:`${o} app`,style:{borderWidth:1,borderColor:s.colours.gold,borderRadius:6,paddingHorizontal:6,paddingVertical:1,backgroundColor:(0,e.soutersSurface)('#1c1a16')},children:(0,c.jsx)(u.T,{size:10,weight:"bold",colour:s.colours.gold,children:o})})};var e=r(d[0]);r(d[1]);var o,l=r(d[2]),t=(o=l)&&o.__esModule?o:{default:o},s=r(d[3]),u=r(d[4]),c=r(d[5])},920,[868,30,127,821,813,24]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.CoversToday=function({rid:e,onPress:v,big:$,sound:p,testID:x="covers-today",day:C,compact:j=!1}){const w=(0,c.useBookings)(e),k=(0,c.useNow)(3e4),T=(0,h.venueYmd)(k),D=C&&C!==T?C:T,I=D!==T,L=I?(0,y.dayCovers)(w,D,T):(0,u.coversToday)(w,T),_=(0,y.dayWord)(D,T),M=/^(Today|Yesterday|Tomorrow)$/.test(_),R=`COVERS ${_.toUpperCase()}`,S=I?`${M?`${_}\u2019s`:_} bookings \u203a`:'Today\u2019s bookings \u203a',O=I?`${M?`${_}, `:''}${(0,y.dayLong)(D)}`:'today',P=(0,o.useLiveState)();if('ready'!==P)return(0,f.jsx)(o.LiveWait,{state:P,title:"Covers today",testID:`${x}-wait`});const W=$?64:44,z=L.total?Math.min(1,L.done/L.total):0,B=(e,o,t,c)=>(0,f.jsxs)(s.default,{style:{flex:1,alignItems:'center',gap:6,minWidth:0},children:[(0,f.jsx)(l.SplitFlap,{value:o,height:W,colour:t,testID:`covers-${c}`,sound:p}),(0,f.jsx)(n.T,{size:$||j?14:12,weight:"semibold",colour:b.colours.muted,numberOfLines:j?void 0:1,center:j,style:{letterSpacing:.4},children:e})]});return(0,f.jsxs)(t.default,{testID:x,accessibilityRole:"button",disabled:!v,onPress:v,accessibilityLabel:`Covers ${O}: ${L.done} done, ${L.toCome} ${D({backgroundColor:e?b.colours.tilePressed:b.colours.surface,borderRadius:16,borderWidth:1,borderColor:b.colours.hairline,padding:16,gap:12}),children:[(0,f.jsxs)(s.default,{style:{flexDirection:j?'column':'row',justifyContent:'space-between',alignItems:'center',gap:j?6:void 0},children:[(0,f.jsx)(n.T,{center:j,size:j?16:12,weight:"semibold",colour:b.colours.goldMuted,style:{letterSpacing:1.6},children:R}),v?(0,f.jsx)(n.T,{center:j,size:j?14:12,colour:b.colours.muted,children:S}):null]}),(0,f.jsxs)(s.default,{style:{flexDirection:'row',gap:8},children:[B('Done',L.done,b.colours.text,'done'),B(De.set),d=a??t,[n,u]=j[e];return(0,r.useEffect)(()=>{if('display'!==e||!a)return;const t=setTimeout(()=>o(e,null),12e4);return()=>clearTimeout(t)},[e,a,o]),(0,D.jsxs)(l.default,{testID:"day-bar",style:{gap:8},children:[(0,D.jsx)(s.DaySwitch,{day:d,today:t,onDay:t=>o(e,t),back:-n,ahead:u,idPrefix:"day"}),a?(0,D.jsx)(c.Button,{testID:"day-today",kind:"secondary",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>o(e,null),style:{minHeight:48}}):null]})},_e.DayView=function({rid:e,day:s,today:r,app:d}){const n=(0,u.useRestaurant)(e),x=(0,u.useBookings)(e),j=(0,u.useEvents)(e),_=(0,p.parseYmd)(s),B=se.date===s),O=(0,f.regularEventsOf)(n).filter(e=>(0,f.occursOn)(e,s)),T=x.filter(e=>e.date===s).sort((e,t)=>e.time.localeCompare(t.time)).filter(y.ACTIVE),E='display'===d;return(0,D.jsxs)(l.default,{testID:"day-view",style:{gap:12},children:[(0,D.jsxs)(c.Card,{children:[(0,D.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,D.jsxs)(c.T,{weight:"semibold",colour:b.colours.gold,children:[(0,p.niceDate)(_),$?` \xb7 ${$.name} hours`:'']}),(0,D.jsx)(c.Badge,{kind:"gold",label:B?'LOOKING BACK':'LOOKING AHEAD'})]}),(0,D.jsxs)(c.T,{size:E?18:15,children:[C?`Kitchen ${k(C[0])}\u2013${k(C[1])}`:'Kitchen closed',C&&v&&'kitchen closes'!==v.reason?` \xb7 last food orders ${k(v.time)} (${v.reason})`:'']}),O.map(e=>(0,D.jsxs)(c.T,{size:14,colour:b.colours.goldLight,children:["\u266a ",e.name,e.time?` from ${k(e.time)}`:'',e.busier?' \xb7 expect busier':'']},e.id)),w.map(e=>(0,D.jsxs)(c.T,{size:14,colour:b.colours.goldLight,children:["\u2605 ",(0,y.holidayName)(e.title)]},e.id)),(0,D.jsx)(c.Muted,{children:"Read-only. Nothing here changes today\u2019s service."})]}),(0,D.jsx)(a.CoversToday,{rid:e,day:s}),(0,D.jsx)(m.PlattersBooked,{rid:e,date:s,label:B?'Platters that day':'Platters booked'}),T.length?T.map(s=>(0,D.jsxs)(l.default,{style:{gap:6,padding:14,borderRadius:16,borderWidth:1,borderColor:b.colours.hairline,backgroundColor:b.colours.surface},children:[(0,D.jsxs)(c.T,{weight:"semibold",children:[s.time," \xb7 ",s.walkIn?`Walk-in ${s.ref}`:s.name," \xb7 ",s.partySize," covers",s.table?` \xb7 ${(0,t.tableNumbers)(s.table)}`:'']}),(0,D.jsx)(o.DepositChip,{b:s,money:!0,testID:`day-deposit-${s.id}`}),(0,D.jsx)(m.BookingNeeds,{b:s}),'display'!==d&&!B&&['confirmed','pending'].includes(s.status)?(0,D.jsx)(l.default,{style:{flexDirection:'row'},children:(0,D.jsx)(A.WhatsAppGuest,{b:s,rid:e,kind:"auto"})}):null]},s.id)):(0,D.jsx)(c.Muted,{children:B?'No bookings that day.':'No bookings yet for this day.'})]})};var e,t=_r(_d[0]),s=_r(_d[1]),a=_r(_d[2]),o=_r(_d[3]),r=_r(_d[4]),d=_r(_d[5]),l=(e=d)&&e.__esModule?e:{default:e},n=_r(_d[6]),c=_r(_d[7]),u=_r(_d[8]),y=_r(_d[9]),h=_r(_d[10]),f=_r(_d[11]),p=_r(_d[12]),b=_r(_d[13]),m=_r(_d[14]),A=_r(_d[15]),D=_r(_d[16]);const x=(0,n.create)(e=>({day:{},set:(t,s)=>e(e=>({day:{...e.day,[t]:s??void 0}}))})),j={owner:[-s.DAY_BACK,s.DAY_AHEAD],chef:[-s.DAY_BACK,s.DAY_AHEAD],display:[-s.DAY_BACK,s.DAY_AHEAD],staff:[-s.DAY_BACK,s.DAY_AHEAD]},k=e=>{const[t,s]=e.split(':').map(Number);return`${t%12||12}${s?`:${String(s).padStart(2,'0')}`:''}${t<12?'am':'pm'}`};function _(e,t){const s=x(t=>t.day[e]);return s&&s!==t?s:null}},922,[808,936,921,951,30,127,952,813,819,828,815,809,818,821,950,1020,24]); +__d(function(_g,r,_i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"setDisplaySilent",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"soundAllowed",{enumerable:!0,get:function(){return u}}),e.chime=function(t="bright"){if(!u())return void l('__ccChimesBlocked');try{const n=o();if(!n)return;('bright'===t?[880,1318.5]:[659.3]).forEach((o,c)=>{const i=n.currentTime+.16*c,u=n.createOscillator(),l=n.createGain();u.type='sine',u.frequency.value=o,l.gain.setValueAtTime(1e-4,i),l.gain.exponentialRampToValueAtTime('bright'===t?.12:.07,i+.02),l.gain.exponentialRampToValueAtTime(1e-4,i+.9),u.connect(l).connect(n.destination),u.start(i),u.stop(i+.95)}),l('__ccChimes')}catch{}},Object.defineProperty(e,"LOW_CHIME_MIN",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"LOW_CHIME_MAX",{enumerable:!0,get:function(){return d}}),e.lowChime=function(t=0){if(!u())return void l('__ccChimesBlocked');const n=s+.095*Math.max(0,Math.min(1,t));'undefined'!=typeof window&&(window.__ccLowChimeLevels=[...window.__ccLowChimeLevels??[],Math.round(1e3*n)/1e3].slice(-40));try{const t=o();if(!t)return;[220,164.8].forEach((o,c)=>{const i=t.currentTime+.42*c,u=t.createOscillator(),l=t.createGain(),s=t.createBiquadFilter?.();u.type='triangle',u.frequency.value=o,l.gain.setValueAtTime(1e-4,i),l.gain.exponentialRampToValueAtTime(n,i+.12),l.gain.exponentialRampToValueAtTime(1e-4,i+1.6),s?(s.type='lowpass',s.frequency.value=900,u.connect(s).connect(l).connect(t.destination)):u.connect(l).connect(t.destination),u.start(i),u.stop(i+1.7)}),l('__ccLowChimes')}catch{}},Object.defineProperty(e,"flapSoundOn",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"setFlapSound",{enumerable:!0,get:function(){return w}}),e.flapClick=function(){if('display'!==t.APP_VARIANT&&!c)return;if(!p())return;try{const t=o();if(!t)return;const n=t.currentTime,c=Math.floor(.03*t.sampleRate),i=t.createBuffer(1,c,t.sampleRate),u=i.getChannelData(0);for(let t=0;t{if('undefined'==typeof window)return null;const t=window.AudioContext||window.webkitAudioContext;return t?(n||(n=new t),'suspended'===n.state&&n.resume?.().catch?.(()=>{}),n):null};if('undefined'!=typeof window){const t=()=>{try{o()}catch{}window.removeEventListener('pointerdown',t)};window.addEventListener('pointerdown',t)}let c=!1;const i=t=>{c=t},u=()=>'display'!==t.APP_VARIANT&&!c,l=t=>{'undefined'!=typeof window&&(window[t]=(window[t]??0)+1)};const s=.015,d=.11;const f='cc-flap-sound',p=()=>{try{return'undefined'!=typeof localStorage&&'1'===localStorage.getItem(f)}catch{return!1}},w=t=>{try{localStorage.setItem(f,t?'1':'0')}catch{}}},923,[122,806]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.SeatAllergenReminder=function({rid:c}){const u=(0,n.useRef)(new Set);return(0,n.useEffect)(()=>s.useStore.subscribe((n,s)=>{if(n.bookings===s.bookings)return;const h=new Map(s.bookings.map(t=>[t.id,t.status]));for(const s of n.bookings){if(s.restaurantId!==c||'seated'!==s.status||!(0,l.hasAllergens)(s)||u.current.has(s.id))continue;const n=h.get(s.id);n&&'seated'!==n&&(u.current.add(s.id),(0,o.notify)({id:`seat-allergen:${s.id}`,tone:'urgent',testID:'seat-allergen-reminder',icon:'\u26a0\ufe0f',kicker:'RE-CONFIRM ALLERGENS AT THE TABLE',title:`${s.name} \xb7 ${s.partySize} covers${s.table?` \xb7 ${(0,t.tableNumbers)(s.table)}`:''}`,body:`${(0,l.allergenText)(s)}. Before taking the order, check the allergens with the guests again and tell the kitchen about any change.`,actions:[{label:'Done, re-confirmed with the guests',testID:'seat-allergen-ok'}]}))}}),[c]),null},e.useKitchenTodoChime=function(t,u,h){const f=(0,s.useStore)(n=>n.bookings.filter(n=>n.restaurantId===t&&n.date>=u&&!n.walkIn&&((0,l.needsAllergenSeen)(n)||(0,l.needsHoldOk)(n))).map(t=>t.id).sort().join(',')),k=f?f.split(',').length:0,b=(0,n.useRef)(null);return(0,n.useEffect)(()=>{const t=s.useStore.getState().bookings.filter(t=>f.split(',').includes(t.id)),n=b.current;if(b.current=t.map(t=>t.id),null===n)return;const k=t.filter(t=>!n.includes(t.id));if(k.length){(0,c.soundAllowed)()&&(0,c.chime)('bright');for(const t of k){const n=(0,l.needsAllergenSeen)(t);(0,o.notify)({id:`kitchen-todo:${t.id}`,tone:n?'urgent':'warn',testID:'kitchen-todo-notice',icon:n?'\u26a0\ufe0f':'\ud83c\udf7d\ufe0f',kicker:n?'ALLERGENS TO SIGN OFF':'PLATTER TO SIGN OFF',title:`${t.name} \xb7 ${t.partySize} covers \xb7 ${t.date===u?'today':t.date} ${t.time}`,body:n?`${(0,l.allergenText)(t)}. Tap Allergens seen on the booking once the kitchen has read it.`:'A platter is booked. Tap Platter OK on the booking once the kitchen can do it.',actions:[...h?[{label:'Open bookings',onPress:h}]:[],{label:'Later',kind:'ghost'}]})}}},[f]),k};var t=r(d[0]),n=r(d[1]),o=r(d[2]),s=r(d[3]),l=r(d[4]),c=r(d[5])},924,[808,30,947,819,828,923]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useVoiceSlot",{enumerable:!0,get:function(){return w}}),_e.voiceAppFor=S,_e.useVoiceTarget=p,_e.VoiceSlot=function({size:e=56}){const t=p(),u=(0,n.useRef)(null),c=(0,n.useRef)(y++).current,{width:l,height:f}=(0,o.default)(),S=()=>u.current?.measureInWindow((e,t,n)=>{n&&w.setState({rect:{x:e,y:t,size:n},owner:c})});return(0,n.useEffect)(()=>{const e=setTimeout(S,50);return()=>clearTimeout(e)},[l,f,t?.on]),(0,n.useEffect)(()=>()=>{w.getState().owner===c&&w.setState({rect:null,owner:0})},[]),(0,n.useEffect)(()=>{t?.on||w.getState().owner!==c||w.setState({rect:null,owner:0})},[t?.on]),t?.on?(0,h.jsx)(s.default,{ref:u,testID:"voice-slot",onLayout:S,style:{width:e,height:e,flexShrink:0}}):null};var t=r(d[0]),n=r(d[1]),o=e(r(d[2])),s=e(r(d[3])),u=r(d[4]),c=r(d[5]),l=r(d[6]),f=r(d[7]),h=r(d[8]);const w=(0,u.create)(()=>({rect:null,owner:0}));function S(e){return'customer'===c.APP_VARIANT||/^\/(customer|table|demo)/.test(e)?null:e.startsWith('/owner')||e.startsWith('/admin')?'owner':e.startsWith('/team')?'staff':e.startsWith('/kitchen')?'chef':e.startsWith('/display')?'display':null}function p(){const e=(0,t.usePathname)()||'/',n=(0,l.useCtx)(6e4),o=(0,f.useVoiceSettings)(e=>e.enabled),s=S(e);if(!s)return null;const u='owner'===s?'owner'===n.role?'owner':'manager'===n.role?'manager':'staff':s;return{app:s,role:u,actions:'staff'===u?'staff':s,on:(0,f.voiceOn)(o,n.rid,u)}}let y=1},925,[804,30,287,127,952,806,927,1099,24]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"TABLES",{enumerable:!0,get:function(){return P}}),_e.useTableNames=O,_e.resetTableLive=z,_e.seatBookingNow=async function(e,t){await h.repo.bookings.setStatus(t.id,'seated'),z(e,t.table)},_e.finishBookingNow=async function(e,t){await h.repo.bookings.setStatus(t.id,'finished'),(0,w.tablesOf)(t.table).forEach(t=>w.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!0}))},_e.useTableUse=B,Object.defineProperty(_e,"walkInLabel",{enumerable:!0,get:function(){return M}}),_e.TablePicker=N,_e.WalkInSheet=F,_e.AssignTableSheet=A,_e.undoNotice=L,_e.NewBookingSheet=W,_e.useFrontDoor=function(e,t){const[s,o]=(0,a.useState)(!1),[l,i]=(0,a.useState)(!1),[r,d]=(0,a.useState)(null);return{openWalkIn:()=>o({}),openWalkInAt:e=>o({table:e}),openBooking:()=>i(!0),assignTable:e=>d({b:e}),combineTables:e=>d({b:e,combine:!0}),elements:(0,I.jsxs)(I.Fragment,{children:[s?(0,I.jsx)(F,{wide:t,initialTable:s.table,onClose:()=>o(!1),onSeated:L}):null,l?(0,I.jsx)(W,{wide:t,date:e,onClose:()=>i(!1),onSaved:e=>(0,n.notify)({id:`booked:${Date.now()}`,testID:'booking-saved-toast',timeoutMs:5e3,icon:'\u2713',title:`Booked: ${e.name} \xb7 ${(0,y.niceDate)((0,y.parseYmd)(e.date))} at ${e.time}`})}):null,r?(0,I.jsx)(A,{booking:r.b,combine:r.combine,onClose:()=>d(null)}):null]})}};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),n=_r(_d[4]),a=_r(_d[5]),i=e(a),r=_r(_d[6]),d=e(_r(_d[7])),u=e(_r(_d[8])),c=_r(_d[9]),b=_r(_d[10]),h=_r(_d[11]),p=_r(_d[12]),f=_r(_d[13]),y=_r(_d[14]),x=_r(_d[15]),k=_r(_d[16]),j=_r(_d[17]),w=_r(_d[18]),T=_r(_d[19]),S=_r(_d[20]),C=_r(_d[21]),v=_r(_d[22]),D=_r(_d[23]),$=_r(_d[24]),I=_r(_d[25]);const P=Array.from({length:12},(e,t)=>String(t+1));function O(e){const t=(0,w.usePlan)(e);return t.areas.flatMap(e=>t.tables.filter(t=>t.areaId===e.id).map(e=>e.name))}function z(e,t){(0,w.tablesOf)(t).forEach(t=>w.useFloor.getState().setLive(e,t,{stage:'seated',dirty:!1}))}function B(e,t){const s=(0,h.useBookings)(e),o=(0,h.useOrders)(e),l=O(e),n=(0,w.useFloor)(t=>t.live[e])??{},a=(0,w.usePlan)(e),i=(0,T.useBlocks)(e=>e.blocks),r=(0,y.ymd)(t),d=(0,T.closedAreasAt)(i,e,r,(0,y.hm)(t)),u={};for(const e of l)u[e]=n[e]?.blocked||d.has(`tbl:${e}`)?{busy:!0,label:'Blocked'}:d.has(a.tables.find(t=>t.name===e)?.areaId??'')?{busy:!0,label:'Closed'}:n[e]?.dirty?{busy:!0,label:'Needs clearing'}:{busy:!1,label:'Free'};for(const e of s)if(e.date===r&&e.table)for(const s of(0,w.tablesOf)(e.table))if(u[s])if('seated'===e.status)u[s]={busy:!0,label:`${e.walkIn?'Walk-in':`${e.name.slice(0,1)}.`} \xb7 ${e.partySize}`};else if('confirmed'===e.status&&!u[s].busy){const o=(0,y.minsBetween)(t,new Date(`${e.date}T${e.time}:00`));o>=-15&&o<=90&&(u[s]={...u[s],soon:`Booked ${e.time}`})}for(const e of o)'table'===e.type&&e.tableNo&&u[e.tableNo]&&!['closed','cancelled','collected'].includes(e.status)&&!u[e.tableNo].busy&&(u[e.tableNo]={busy:!0,label:'Open order'});return u}const M=e=>e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;function N({use:e,value:t,onPick:o,big:l,best:n,dense:i,bestSet:r,picked:c}){const b=Object.keys(e),[h,p]=(0,a.useState)(0),f=i?6:8,y=i?64:l?92:76,k=h?Math.max(3,Math.floor((h+f)/(y+f))):0,T=k?Math.floor((h-f*(k-1))/k):y,S=new Set(r??[]),C=n?(0,w.tablesOf)(n)[0]:null;return(0,I.jsx)(u.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:f},testID:"table-picker",onLayout:e=>p(Math.floor(e.nativeEvent.layout.width)),children:b.map(l=>{const n=e[l],a=t===l||!!c?.includes(l),r=S.has(l),b=C===l&&!a,h=n.busy?['Blocked','Needs clearing','Closed'].includes(n.label)?n.label:'In use':n.soon??'Free';return(0,I.jsxs)(d.default,{accessibilityRole:"button",testID:`pick-table-${l}`,accessibilityLabel:`Table ${(0,s.tableNumbers)(l)}${c?a?', picked':', not picked':''}, ${n.busy?`in use (${n.label})`:n.soon?`free, ${n.soon}`:'free'}${r?', best table':''}${b?', suggested for this party':''}`,accessibilityState:{selected:a,disabled:'Closed'===n.label},disabled:'Closed'===n.label,onPress:()=>o(l),style:{width:T,minHeight:i?58:64,borderRadius:12,borderWidth:a||b?2.5:1.5,paddingVertical:i?3:6,paddingHorizontal:4,alignItems:'center',justifyContent:'center',gap:2,borderColor:a||b?x.colours.gold:n.busy?x.colours.red:x.colours.ok,backgroundColor:a?x.colours.goldTint:n.busy?x.colours.redBg:x.colours.surface2,opacity:'Closed'!==n.label||a?1:.55},children:[(0,I.jsxs)(u.default,{style:{flexDirection:'row',alignItems:'center',gap:4},children:[(0,I.jsx)(j.T,{weight:"bold",size:22,colour:a?x.colours.goldLight:x.colours.text,children:(0,s.tableNumbers)(l)}),r?(0,I.jsx)(u.default,{testID:"best-table",style:{backgroundColor:x.colours.gold,borderRadius:5,paddingHorizontal:4,paddingVertical:1},children:(0,I.jsx)(j.T,{size:11,weight:"bold",colour:x.colours.onGold,children:"BEST"})}):null]}),(0,I.jsx)(j.T,{size:i?13:14,colour:n.busy?'#FFD9D4':n.soon?'#FFE2A8':'#E2C489',center:!0,numberOfLines:1,children:h})]},l)})})}const R=[1,2,3,4,5,6,7,8];function F({onClose:e,onSeated:o,wide:l,initialTable:n}){const{rid:p,r:k,now:S}=(0,b.useCtx)(15e3),C=B(p,S),[v,D]=(0,a.useState)(2),[$,P]=(0,a.useState)(!1),[O,M]=(0,a.useState)(n??null),F=(0,w.usePlan)(p),A=(0,h.useBookings)(p),L=(0,T.useBlocks)(e=>e.blocks),W=(0,T.closedAreasAt)(L,p,(0,y.ymd)(S),(0,y.hm)(S)),E=i.default.useMemo(()=>{const e=Object.fromEntries(Object.entries(C).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,f.suggestTable)(F,A.filter(e=>e.date===(0,y.ymd)(S)),e,v,S,(0,f.turnFor)(v,k.settings.turnMins),90,void 0,{closed:W})?.table??null},[F,A,C,v,W.size,S.getTime()]);(0,a.useEffect)(()=>{O&&(0,w.tablesOf)(O).some(e=>'Closed'===C[e]?.label)&&M(null)},[O,W.size]);const[H,_]=(0,a.useState)(!1),[U,q]=(0,a.useState)(''),V=(e,t=String(e),s=()=>{P(!1),D(e)})=>{const o='9+'===t?$:!$&&v===e;return(0,I.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:'9+'===t?'Party of 9 or more':`Party of ${e}`,accessibilityState:{selected:o},onPress:s,style:{width:l?58:60,height:l?58:56,borderRadius:14,borderWidth:2,borderColor:x.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:o?x.colours.gold:'transparent'},children:(0,I.jsx)(j.T,{weight:"bold",size:22,colour:o?x.colours.onGold:x.colours.gold,children:t})},t)},G=(0,I.jsxs)(j.Row,{gap:12,style:{justifyContent:'center'},children:[(0,I.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:"One fewer",onPress:()=>D(e=>Math.max(9,e-1)),style:{width:56,height:56,borderRadius:28,borderWidth:2,borderColor:x.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,I.jsx)(j.T,{size:26,colour:x.colours.gold,children:"\u2212"})}),(0,I.jsx)(j.T,{weight:"bold",size:26,children:v}),(0,I.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:"One more",onPress:()=>D(e=>Math.min(40,e+1)),style:{width:56,height:56,borderRadius:28,borderWidth:2,borderColor:x.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,I.jsx)(j.T,{size:26,colour:x.colours.gold,children:"+"})})]}),K=(0,I.jsxs)(u.default,{style:{gap:8,width:l?256:void 0},children:[(0,I.jsx)(j.T,{weight:"semibold",children:"How many people?"}),(0,I.jsxs)(u.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"walkin-party",children:[R.map(e=>V(e)),V(9,'9+',()=>{P(!0),D(e=>e>=9?e:9)})]}),$?G:null]}),[Q,Y]=(0,a.useState)(!1),J=async(t=O)=>{if(!Q){Y(!0);try{const s=await h.repo.bookings.seatWalkIn(p,v,t??void 0,U);z(p,t??void 0),o(s),e()}finally{Y(!1)}}},X=(0,I.jsxs)(u.default,{style:{gap:8,flex:l?1:void 0,minWidth:0},children:[(0,I.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,I.jsxs)(j.T,{weight:"semibold",children:["Table ",(0,I.jsx)(j.T,{colour:x.colours.muted,size:14,children:"(optional)"})]}),O?(0,I.jsx)(j.Button,{small:!0,kind:"ghost",label:"Clear table",onPress:()=>M(null)}):null]}),(0,I.jsx)(N,{use:C,value:O,onPick:e=>{C[e]&&!C[e].busy?J(e):M(O===e?null:e)},big:l,dense:l,best:E,bestSet:(0,r.bestTables)(F)}),(0,I.jsxs)(j.Muted,{children:["Tap a free table to seat them there",E&&!O?` (suggested for ${v}: ${(0,s.tableNumbers)(E)})`:'',", or Seat for no table yet. BEST marks the venue\u2019s best tables."]})]});return(0,I.jsxs)(j.Sheet,{visible:!0,onClose:e,title:`Walk-in \xb7 ${(0,y.hm)(S)}`,maxWidth:l?1100:void 0,testID:"walkin-sheet",children:[(0,I.jsx)(j.Button,{label:`Seat walk-in \xb7 ${v} ${1===v?'person':'people'}${O?` \xb7 ${(0,s.tableNumbers)(O)}`:''}`,disabled:Q,onPress:()=>{J()},testID:"seat-walkin",style:{minHeight:52}}),l?(0,I.jsxs)(j.Row,{gap:16,style:{alignItems:'flex-start'},children:[K,X]}):(0,I.jsxs)(I.Fragment,{children:[K,X]}),(0,I.jsxs)(j.Row,{gap:10,wrap:!0,style:{alignItems:'center'},children:[H?(0,I.jsx)(t.TextInput,{accessibilityLabel:"Walk-in note",placeholder:"Note (optional), e.g. high chair",placeholderTextColor:"#7D776C",value:U,onChangeText:q,style:[j.styles.input,{flex:1,minWidth:220}],autoFocus:!0}):(0,I.jsx)(j.Button,{small:!0,kind:"ghost",label:"Add a note (optional)",onPress:()=>_(!0)}),(0,I.jsx)(u.default,{style:{flex:1,minWidth:220},children:(0,I.jsxs)(j.Muted,{children:["No name needed. Counts in today's covers.",'staff'!==c.APP_VARIANT?' Using website bookings too? Mark the table there as well.':'']})})]})]})}function A({booking:e,onClose:t,combine:o}){const{rid:l,r:n,now:d}=(0,b.useCtx)(15e3),c=B(l,d),p=(0,w.usePlan)(l),k=(0,h.useBookings)(l),T=(0,w.tablesOf)(e.table),S=i.default.useMemo(()=>Object.fromEntries(Object.entries(c).map(([e,t])=>[e,T.includes(e)?{busy:!1,label:'This party',soon:'This party'}:t])),[c,e.table]),C=i.default.useMemo(()=>{const t=Object.fromEntries(Object.entries(S).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,f.suggestTable)(p,k.filter(e=>e.date===(0,y.ymd)(d)),t,e.partySize,d,(0,f.turnFor)(e.partySize,n.settings.turnMins),90,e.id)?.table??null},[p,k,S,e.partySize,d.getTime()]),[v,D]=(0,a.useState)(!!o||T.length>1),[$,P]=(0,a.useState)(T),O=e=>p.tables.find(t=>t.name===e)?.maxSeats??0,R=$.reduce((e,t)=>e+O(t),0),F=$.length>0&&R{const o=(0,w.joinTables)(s);await h.repo.bookings.assignTable(e.id,o);T.filter(e=>!s.includes(e)).forEach(t=>w.useFloor.getState().setLive(l,t,{stage:void 0,dirty:'seated'===e.status})),'seated'===e.status&&z(l,o),t()},L=v?(0,I.jsxs)(u.default,{style:{gap:8},testID:"assign-table-tip",children:[(0,I.jsx)(u.default,{accessibilityLiveRegion:"polite",children:(0,I.jsx)(j.T,{size:17,weight:"semibold",colour:x.colours.text,children:$.length?`${(0,w.tablesLabel)((0,w.joinTables)($))} \xb7 ${R} seats for ${e.partySize} covers`:'No tables picked yet'})}),F?(0,I.jsx)(u.default,{testID:"combine-short",children:(0,I.jsxs)(j.T,{size:15,weight:"semibold",colour:"#FFD9D4",children:["Not enough seats yet: ",e.partySize-R," more needed. Add another table."]})}):null,(0,I.jsx)(j.T,{size:15,colour:x.colours.text,children:"Tap each table to add or remove it, then tap Done. All of them show as taken until the party has finished."}),(0,I.jsxs)(j.Row,{gap:8,wrap:!0,children:[(0,I.jsx)(j.Button,{label:"Done",testID:"combine-done",disabled:!$.length,accessibilityLabel:$.length?`Done, save ${(0,w.tablesLabel)((0,w.joinTables)($))}`:'Done',onPress:()=>A($)}),(0,I.jsx)(j.Button,{kind:"ghost",label:"Cancel",onPress:t})]})]}):(0,I.jsx)(u.default,{style:{gap:8},testID:"assign-table-tip",children:(0,I.jsx)(j.T,{size:15,colour:x.colours.text,children:"Red tables are in use right now; you can still pick one (e.g. joining a table). BEST marks the venue\u2019s best tables. Big party? Tap Combine tables."})});return(0,I.jsxs)(j.Sheet,{visible:!0,onClose:t,title:`${v?'Combine tables':'Assign table'} \xb7 ${M(e)}`,testID:"assign-table-sheet",footer:L,children:[C&&!v?(0,I.jsx)(u.default,{testID:"assign-suggested",children:(0,I.jsxs)(j.T,{size:16,weight:"semibold",colour:x.colours.goldLight,children:["Suggested for ",e.partySize,": ",(0,s.tableNumbers)(C)]})}):null,v?null:(0,I.jsx)(j.Button,{kind:"secondary",label:"Combine tables",testID:"combine-start",accessibilityLabel:"Combine tables: pick several tables for this party",onPress:()=>D(!0)}),(0,I.jsx)(N,{use:S,best:v?null:C,bestSet:(0,r.bestTables)(p),picked:v?$:void 0,onPick:v?e=>P(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]):async e=>{await A([e])}})]})}function L(e){(0,n.notify)({id:`walkin:${e.id}`,testID:'walkin-toast',timeoutMs:6e3,title:`${M(e)} seated \xb7 ${e.table?`${(0,s.tableNumbers)(e.table)}`:'table to assign'} (${e.ref})`,actions:[{label:'Undo',testID:'undo-walkin',onPress:()=>h.repo.bookings.undoWalkIn(e.id)},{label:'OK',kind:'ghost'}]})}function W({date:e,onClose:t,wide:n,onSaved:i}){const{rid:r,r:d,now:c,role:P,meId:O}=(0,b.useCtx)(6e4),z=(0,y.ymd)(c),[B,M]=(0,a.useState)(ee.blocks),[F,A]=(0,a.useState)(!1),[L,W]=(0,a.useState)(''),[E,H]=(0,a.useState)(2),[_,U]=(0,a.useState)(null),[q,V]=(0,a.useState)(''),[G,K]=(0,a.useState)(''),[Q,Y]=(0,a.useState)(''),[J,X]=(0,a.useState)('phone'),[Z,ee]=(0,a.useState)((0,C.emptyNeeds)()),te=(0,C.needsMissing)(Z),[se,oe]=(0,a.useState)(null),le=(0,w.usePlan)(r),ne=(0,$.dogSetUp)(le),ae=!0===Z.dog&&ne,ie=Z.dog?Z.dogs:0,re=(0,y.parseYmd)(B),de=(0,f.turnFor)(E,d.settings.turnMins),ue=N.filter(e=>e.date===B),ce=e=>(0,f.freeTablesAt)(le,ue,E,new Date(`${B}${(0,s.tableNumbers)(e)}:00`),de,d.settings.turnMins,{dog:!0,closed:(0,T.closedAreasAt)(R,r,B,e)}),be=ae&&_?ce(_):[];(0,a.useEffect)(()=>{oe(null)},[ae,_,E]);const he=(0,p.bookingSlots)(d,re,e=>N.filter(t=>t.date===B&&t.time===e&&'cancelled'!==t.status&&!t.walkIn).reduce((e,t)=>e+t.partySize,0),E,B===(0,y.ymd)(c)?c:(0,y.addMins)(re,0)),ge=(0,k.ukPhone)(G),pe=_?(0,T.blockAt)(R,r,B,_):void 0,me='staff'!==P,fe=!!_&&!(0,C.dogTimeOk)(d,N,B,_,ie),ye=!te.length&&L.trim().length>=2&&!!_&&ge.ok&&(0,k.emailOk)(Q)&&(!pe||me&&F)&&(!ae||be.length>0)&&!fe,xe=Z.wheelchair>0||Z.stepFree;return(0,I.jsxs)(j.Sheet,{visible:!0,onClose:t,title:`New booking \xb7 ${(0,y.niceDate)(re)}`,maxWidth:n?760:void 0,testID:"booking-sheet",children:[(0,I.jsx)(C.FirstQuestions,{rid:r,value:Z,onChange:ee,party:E,audience:"staff"}),Z.dog&&!ne?(0,I.jsx)(j.T,{size:13,colour:x.colours.amber,children:"Dog-friendly tables aren\u2019t marked yet. Managers \u203a Booking options \u203a Tables. Booking is allowed; check where the dog can sit."}):null,(0,I.jsx)(S.BookingDatePicker,{r:d,today:c,value:B,onChange:e=>{e!==B&&(M(e),U(null),A(!1))}}),(0,I.jsxs)(j.Row,{gap:6,children:[(0,I.jsx)(j.Chip,{label:"Phone",selected:'phone'===J,onPress:()=>X('phone')}),(0,I.jsx)(j.Chip,{label:"In person",selected:'in-person'===J,onPress:()=>X('in-person')})]}),(0,I.jsx)(j.Field,{label:"Name",value:L,onChangeText:W,placeholder:"e.g. Reid",testID:"nb-name"}),(0,I.jsx)(j.Field,{label:"Mobile or phone number (needed)",value:G,onChangeText:K,keyboardType:"phone-pad",placeholder:"e.g. 07700 900123",testID:"nb-phone"}),!ge.ok&&G?(0,I.jsx)(j.T,{size:13,colour:x.colours.amber,children:ge.error}):null,(0,I.jsx)(j.Field,{label:"Email (optional)",value:Q,onChangeText:Y,keyboardType:"email-address",autoCapitalize:"none",placeholder:"For an email confirmation too",testID:"nb-email"}),(0,k.emailOk)(Q)?null:(0,I.jsx)(j.T,{size:13,colour:x.colours.amber,children:"That email doesn\u2019t look quite right."}),(0,I.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,I.jsx)(j.T,{children:"Covers"}),(0,I.jsx)(j.Stepper,{value:E,onChange:H,min:1,max:20,label:"covers"})]}),(0,I.jsx)(j.Row,{wrap:!0,gap:6,children:he.map(e=>{const t=ae&&e.available&&!ce(e.time).length||!(0,C.dogTimeOk)(d,N,B,e.time,ie);return(0,I.jsx)(j.Chip,{label:e.time,sub:(0,T.blockAt)(R,r,B,e.time)?'Paused':t?'Dogs full':e.drinksOnly?'Drinks only':`${e.left} left`,disabled:!e.available||t,selected:_===e.time,onPress:()=>{U(e.time),A(!1)}},e.time)})}),ae&&_?(0,I.jsxs)(u.default,{style:{gap:6},testID:"nb-dog-tables",children:[(0,I.jsxs)(j.T,{size:14,weight:"semibold",children:["Dog-friendly table ",(0,I.jsxs)(j.T,{size:13,colour:x.colours.muted,children:["(",le.areas.filter(e=>e.dogs).map(e=>e.name).join(' or '),")"]})]}),be.length?(0,I.jsx)(j.Row,{wrap:!0,gap:6,children:be.slice(0,10).map((e,t)=>(0,I.jsx)(j.Chip,{label:`${(0,s.tableNumbers)(e.table)}`,sub:`${e.area} \xb7 ${e.seats}${0===t?' \xb7 best':''}${xe&&(0,$.accessibleSetUp)(le)&&!(0,$.isAccessible)(le,e.table)?' \xb7 not step-free':''}`,selected:(se??be[0].table)===e.table,onPress:()=>oe(e.table)},e.table))}):(0,I.jsxs)(j.T,{size:14,colour:x.colours.amber,children:["No dog-friendly table free for ",E," at ",_,". Try another time."]})]}):null,pe?(0,I.jsxs)(u.default,{testID:"nb-block-warning",style:{borderWidth:1.5,borderColor:x.colours.amber,backgroundColor:x.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[(0,I.jsxs)(j.T,{weight:"semibold",colour:x.colours.amber,children:["Bookings are paused ",pe.from,"\u2013",pe.to,pe.reason?` (${pe.reason})`:'']}),me?(0,I.jsx)(j.Chip,{label:F?'Manager override on':'Override and book anyway',selected:F,onPress:()=>A(e=>!e)}):(0,I.jsx)(j.Muted,{children:"Ask a manager to override, or pick another time."})]}):null,he.length?null:(0,I.jsx)(u.default,{testID:"nb-closed",children:(0,I.jsxs)(j.T,{size:14,weight:"semibold",colour:x.colours.amber,children:["Closed on ",(0,y.niceDate)(re)," (per the venue\u2019s opening hours). Pick another date."]})}),(0,I.jsx)(C.MoreQuestions,{rid:r,r:d,value:Z,onChange:ee,party:E,date:B,time:_,today:(0,y.ymd)(c),bookings:N,audience:"staff",showTables:!1!==d.settings.tableRequests}),xe&&!(0,$.accessibleSetUp)(le)?(0,I.jsx)(j.T,{size:13,colour:x.colours.amber,children:"Step-free tables aren\u2019t marked yet (Managers \u203a Booking options \u203a Tables). Check the table works for a wheelchair."}):null,(0,I.jsx)(j.Field,{label:"Notes (optional)",value:q,onChangeText:V,placeholder:v.NOTES_PLACEHOLDER,multiline:!0,numberOfLines:3,testID:"nb-notes"}),(0,l.depositDue)((0,l.depositOf)(d.settings),E)?(0,I.jsxs)(j.Muted,{children:["Deposit due: ",(0,o.gbp)((0,l.depositDue)((0,l.depositOf)(d.settings),E))," (",(0,o.gbp)((0,l.depositOf)(d.settings).perPersonPence)," per person for ",(0,l.depositOf)(d.settings).fromParty,"+). Deposits are paid through website bookings or to you, never in CoverCharge: tick Deposit paid on the booking once the guest has paid."]}):null,(0,I.jsxs)(j.Muted,{children:["The guest gets a confirmation text",Q.trim()?' and email':''," automatically (preview mode: shown in the Outbox, not sent)."]}),fe?(0,I.jsxs)(j.T,{size:14,colour:x.colours.amber,children:["We already have the most dogs we can look after at ",_,". Try another time: dogs are very welcome then."]}):null,(0,I.jsx)(j.Button,{label:te.length?te[0]:'Save booking',testID:"nb-save",disabled:!ye,onPress:()=>{if(B<(0,y.ymd)(c))return;const e=(0,C.needsPatch)(Z),s=Z.tableReq.find(e=>!ae||be.some(t=>t.table===e));h.repo.bookings.create({restaurantId:r,customerId:null,name:L.trim(),partySize:E,date:B,time:_,notes:q.trim(),security:(0,l.depositDue)((0,l.depositOf)(d.settings),E)?'deposit':'none',depositPaid:0,...(0,l.depositDue)((0,l.depositOf)(d.settings),E)?{depositDue:(0,l.depositDue)((0,l.depositOf)(d.settings),E),depositPolicy:(0,l.depositWords)((0,l.depositOf)(d.settings),E,d.name).join(' '),depositRefundable:(0,l.depositOf)(d.settings).refundable,depositCutoffHours:(0,l.depositOf)(d.settings).cutoffHours}:{},phone:ge.pretty,email:Q.trim()||void 0,source:J,...e,...he.find(e=>e.time===_)?.drinksOnly?{drinksOnly:!0}:{},allergies:e.allergies??[],...ae?{table:se??s??be[0]?.table}:{}}).then(e=>(0,D.postNewBookingToKitchen)(e,O)).catch(()=>{}),i?.({date:B,time:_,name:L.trim()}),t()}})]})}},926,[877,808,816,13,919,30,945,263,127,806,927,819,817,826,818,821,823,813,825,824,1298,827,812,950,828,24]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"fmtH",{enumerable:!0,get:function(){return d.fmtH}}),Object.defineProperty(_e,"fmtHDay",{enumerable:!0,get:function(){return d.fmtHDay}}),Object.defineProperty(_e,"clampRole",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"StaffAppCtx",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"useInStaffApp",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"ShiftMgrScope",{enumerable:!0,get:function(){return y}}),_e.useShiftManager=D,_e.useSignedIn=b,_e.useCtx=function(e=1e4){const o=(0,t.useContext)(p),u=(0,r.useOwner)(e=>e.site),i=(0,r.useOwner)(e=>e.previewRole),f=(0,r.useOwner)(e=>e.staffAs),d=b(),m=o||'staff'===s.APP_VARIANT,w=(0,t.useContext)(y),h=D(),O=m?w&&h?'manager':'staff':d?l(i,d.role):i,S=(0,r.useOwner)(e=>e.staff),M=(0,n.useRestaurant)(u),A=(0,n.useNow)(e),I=d?d.id:m&&f?f:c[O],P=S.find(e=>e.id===I)?.name??'Team member';return{rid:u,r:M,now:A,role:O,me:P,meId:I,today:(0,a.venueYmd)(A),signedIn:!!d}},Object.defineProperty(_e,"weekday",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"DAY3",{enumerable:!0,get:function(){return O}}),_e.ensureAttendance=function(t,n){if(e.LIVE_VENUE_BUILD||(0,o.isLive)())return;const s=r.useOwner.getState(),u=[],i=s.staff.find(e=>e.active&&'manager'===e.role)??s.staff.find(e=>e.active&&'owner'===e.role),f=new Date(n);f.setDate(n.getDate()-h(n));const d=(0,a.ymd)(f),c=(0,a.ymd)(new Date(f.getFullYear(),f.getMonth(),f.getDate()+6)),m=(e,t,n)=>{const r=new Date(e);return r.setHours(0,0,0,0),r.setMinutes(Math.round(60*t)+n),r.toISOString()};for(let e=42;e>=1;e--){const t=new Date(n);t.setDate(t.getDate()-e);const r=(0,a.ymd)(t);if(s.attendance.some(e=>e.date===r))continue;const o=s.shifts.filter(e=>e.date===r&&!1!==e.published);(o.length?o:s.shifts.filter(e=>e.day===h(t)&&e.date>=d&&e.date<=c&&!1!==e.published)).forEach((n,a)=>{const s=e=>Math.round((7*r.charCodeAt(9)+13*a+e)%17-5),o=n.end-n.start,f=o>8?30:o>6?20:0,d=e>2&&i?{signOff:{by:i.name,byId:i.id,at:m(t,34,a)}}:{};u.push({id:`at-${r}-${n.staffId}`,staffId:n.staffId,date:r,in:m(t,n.start,s(1)),out:m(t,n.end,s(2)),inSite:!0,outSite:!0,breakMins:f,...d})})}u.length&&r.useOwner.setState({attendance:[...r.useOwner.getState().attendance,...u]})},_e.paidMins=function(e,t){if(!e.in)return{worked:0,brk:0,paid:0};const n=Math.max(0,Math.round(((e.out?new Date(e.out):t).getTime()-new Date(e.in).getTime())/6e4)),r=e.breakMins??0;return{worked:n,brk:r,paid:Math.max(0,n-r)}},Object.defineProperty(_e,"hmDur",{enumerable:!0,get:function(){return S}}),_e.payRange=function(e,t,n){const r=new Date(n);if(r.setHours(0,0,0,0),'monthly'===e){const e=new Date(r.getFullYear(),r.getMonth()+t,1),n=new Date(e.getFullYear(),e.getMonth()+1,0);return{s:e,e:n,key:`m-${(0,a.ymd)(e)}`}}const s='weekly'===e?7:14,o=new Date(r);o.setDate(r.getDate()-h(r));let u=new Date(o);if('fortnightly'===e){const e=new Date(2026,0,5);(Math.round((o.getTime()-e.getTime())/6048e5)%2+2)%2==1&&u.setDate(u.getDate()-7)}u.setDate(u.getDate()+t*s);const i=new Date(u);return i.setDate(u.getDate()+s-1),{s:u,e:i,key:`${e[0]}-${(0,a.ymd)(u)}`}},_e.useHourly=function(){const e=b(),t=(0,r.useOwner)(e=>e.hourly);return e?t:M};var e=_r(_d[0]),t=_r(_d[1]),n=_r(_d[2]),r=_r(_d[3]),a=_r(_d[4]),s=_r(_d[5]),o=_r(_d[6]),u=_r(_d[7]),i=_r(_d[8]),f=_r(_d[9]),d=_r(_d[10]);const c={owner:f.ROSTER.find(e=>'owner'===e.role)?.id??'',manager:f.ROSTER.find(e=>'manager'===e.role)?.id??'',staff:f.ROSTER.find(e=>'staff'===e.app)?.id??''},m={staff:0,manager:1,owner:2},l=(e,t)=>m[e]>m[t]?t:e,p=(0,t.createContext)(!1),w=()=>(0,t.useContext)(p),y=(0,t.createContext)(!1);function D(){const e=(0,t.useContext)(p)||'staff'===s.APP_VARIANT,n=b(),r=(0,o.useSync)(e=>!!e.venueId&&'staff'===e.kind),a=(0,o.useSync)(e=>e.perms);return(0,u.shiftManagerOn)({inStaffApp:e,managerAccess:n?.managerAccess,role:n?.role,app:(0,i.rosterPerson)(n?.id)?.app,live:r,perms:a})}function b(){const e=(0,i.useSession)(e=>e.meId),t=(0,r.useOwner)(e=>e.staff);return e?t.find(t=>t.id===e&&t.active):void 0}const h=e=>(e.getDay()+6)%7,O=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'];const S=e=>`${Math.floor(e/60)}h ${String(e%60).padStart(2,'0')}m`;const M={}},927,[833,30,819,856,818,806,820,1032,859,14,1031]); +__d(function(_g,_r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"snap",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"fitLabel",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"BIG_LABEL_MIN",{enumerable:!0,get:function(){return y}}),_e.areaBounds=w,_e.minReadableScale=function(e,t){return Math.max(0,...e.tables.filter(e=>e.areaId===t).map(e=>{const t='round'===e.shape?.85:1,o=(7.4399999999999995*Math.max(1,(0,c.tableNumber)(e).length)+6)/(e.w*t),n=22/Math.min(e.w,e.h);return Math.max(o,n)}))},_e.seatSpots=M,_e.FixtureShape=j,_e.FloorCanvas=function(e){const[v,k]=(0,n.useState)({w:0,h:0}),C=e.plan.tables.filter(t=>t.areaId===e.areaId),I=e.crop&&C.length?w(e.plan,e.areaId):{x:0,y:0,w:s.PLAN_W,h:s.PLAN_H},z={x:I.x,y:I.y,r:I.x+I.w,b:I.y+I.h},R=v.w?'width'===e.fit?Math.min(v.w/s.PLAN_W,e.maxH?e.maxH/s.PLAN_H:9):Math.min(v.w/I.w,v.h/I.h):0,S=e.fill&&'contain'===e.fit&&R>0&&v.h>0,$=S?(v.w/R-I.w)/2:0,A=S?(v.h/R-I.h)/2:0,T={x:z.x-$,y:z.y-A,r:z.r+$,b:z.b+A},L=T.r-T.x,E=T.b-T.y,[N,F]=(0,n.useState)(null),_=(0,n.useRef)(null),B=t=>e.plan.sections.find(e=>e.id===t.sectionId),P=t=>e.plan.joins.find(e=>e.tables.includes(t.name)),D=r.default.useMemo(()=>(0,c.numberClashes)(e.plan.tables).sameArea,[e.plan.tables]),O=(t,o)=>({onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>!0,onResponderTerminationRequest:()=>!1,onResponderGrant:e=>{_.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY,id:t.id,kind:o}},onResponderMove:n=>{const r=_.current;if(!r)return;const i=n.nativeEvent.pageX-r.x,s=n.nativeEvent.pageY-r.y;Math.abs(i)+Math.abs(s)<6&&!N||('live'!==e.mode||e.onDrop&&e.view&&['seated','mains','dessert','bill'].includes(e.view[t.name]?.status)&&e.view[t.name]?.booking)&&F({id:t.id,dx:i,dy:s,kind:o})},onResponderRelease:n=>{const r=_.current;_.current=null;const i=n.nativeEvent.pageX-(r?.x??0),a=n.nativeEvent.pageY-(r?.y??0);if(F(null),Math.abs(i)+Math.abs(a)<6||!R)return void('move'===o&&e.onTap?.(t));const l=i/R,u=a/R;if('edit'===e.mode&&'move'===o)e.onMove?.(t,p(g(t.x+l,e.snapOn),0,s.PLAN_W-t.w),p(g(t.y+u,e.snapOn),0,s.PLAN_H-t.h));else if('edit'===e.mode&&'resize'===o)e.onResize?.(t,p(g(t.w+l,e.snapOn),50,400),p(g(t.h+u,e.snapOn),50,300));else if('live'===e.mode&&e.onDrop){const o=t.x+t.w/2+l,n=t.y+t.h/2+u,r=C.find(e=>e.id!==t.id&&o>=e.x-10&&o<=e.x+e.w+10&&n>=e.y-10&&n<=e.y+e.h+10);r&&e.onDrop(t,r)}}}),W=e=>e*R,H='width'===e.fit?s.PLAN_H*R||200:void 0;return(0,b.jsx)(i.default,{testID:"floor-canvas",onLayout:e=>k({w:e.nativeEvent.layout.width,h:e.nativeEvent.layout.height}),style:[{width:'100%',borderRadius:16,overflow:'hidden'},'contain'===e.fit?{flex:1}:{height:H}],children:R?(0,b.jsx)(i.default,{style:{width:W(L),height:W(E),alignSelf:'center',backgroundColor:(0,t.soutersSurface)('#0F0E0C'),borderRadius:16,borderWidth:1,borderColor:l.colours.border,overflow:'hidden'},children:(0,b.jsxs)(i.default,{style:{position:'absolute',left:-W(T.x),top:-W(T.y),width:W(s.PLAN_W),height:W(s.PLAN_H)},children:['edit'===e.mode?Array.from({length:s.PLAN_W/(2*s.GRID)},(e,o)=>(0,b.jsx)(i.default,{style:{position:'absolute',left:W(o*s.GRID*2),top:0,bottom:0,width:1,backgroundColor:(0,t.soutersSurface)('#1E1B16')}},`v${o}`)):null,'edit'===e.mode?Array.from({length:s.PLAN_H/(2*s.GRID)},(e,o)=>(0,b.jsx)(i.default,{style:{position:'absolute',top:W(o*s.GRID*2),left:0,right:0,height:1,backgroundColor:(0,t.soutersSurface)('#1E1B16')}},`h${o}`)):null,(e.plan.fixtures??[]).filter(t=>t.areaId===e.areaId).map(t=>(0,b.jsx)(j,{f:t,S:W,live:'live'===e.mode},t.id)),e.plan.joins.map(e=>{const t=C.filter(t=>e.tables.includes(t.name));if(t.length<2)return null;const[o,n]=t,r=o.x+o.w/2,s=o.y+o.h/2,a=n.x+n.w/2,l=n.y+n.h/2,u=Math.hypot(a-r,l-s),h=Math.atan2(l-s,a-r);return(0,b.jsx)(i.default,{testID:`join-${e.tables.join('+')}`,style:{position:'absolute',left:W((r+a)/2-u/2),top:W((s+l)/2)-3,width:W(u),height:6,borderRadius:3,backgroundColor:'rgba(207,164,95,0.55)',transform:[{rotate:`${h}rad`}]}},e.id)}),C.map(n=>{const g=e.view?.[n.name],p=g?a.STATUS[g.status]:a.STATUS.free,v=N?.id===n.id,w=v&&'resize'===N.kind?Math.max(50,n.w+N.dx/R):n.w,j=v&&'resize'===N.kind?Math.max(50,n.h+N.dy/R):n.h,k=v&&'move'===N.kind?n.x+N.dx/R:n.x,C=v&&'move'===N.kind?n.y+N.dy/R:n.y,I=e.selected===n.id||e.highlight?.includes(n.name),z=B(n),S='edit'===e.mode?'#2A2419':p.colour,$='edit'===e.mode?l.colours.text:p.fg,A='round'===n.shape?W(Math.min(w,j))/2:W(10),T='live'===e.mode?(0,c.liveTableLabel)(n,D):(0,s.tableLabel)(n),L=W(Math.min(w,j))<64,E=f(e.big?Math.max(13,Math.min(34,W(Math.min(w,j))/3)):Math.max(11,Math.min(22,W(Math.min(w,j))/4)),T,W(w)*('round'===n.shape?.85:1),e.big?y:9),F=Math.max(e.big?11:12,Math.round(.62*E)),_=(W(j)-6-1.4*E)/(1.4*F),H=_>=2&&W(w)>=5*F?2:_>=1?1:0,G=g?g.booking&&void 0!==g.seatedMins?g.booking.time:g.next?.time:void 0,X='edit'===e.mode?`${(0,o.tableNumbers)(T)}, ${(0,s.shapeLabel)(n.shape).toLowerCase()}, ${n.minSeats}\u2013${n.maxSeats} seats${n.online?', bookable online':''}`:`${(0,o.tableNumbers)(T)}, ${p.label}${void 0!==g?.seatedMins?`, seated ${g.seatedMins} min`:''}${g?.covers?`, ${g.covers} covers`:''}${void 0!==g?.nextIn&&'seated'!==g.status?`, next booking ${g.next?.time}`:''}${g?.dayBookings?.length?`, booked: ${g.dayBookings.map(e=>`${e.time}, ${e.partySize} Covers`).join('; ')}`:''}${g?.group?`, combined with ${g.group.filter(e=>e!==n.name).map(e=>`table ${e}`).join(', ')}`:''}`,Y=void 0!==g?.seatedMins&&g.booking?Math.min(1.2,g.seatedMins/(g.booking.durationMins??(0,a.turnFor)(g.booking.partySize,e.turnBase))):null;return(0,b.jsxs)(r.default.Fragment,{children:[M({...n,w:w,h:j}).map((t,o)=>(0,b.jsx)(i.default,{pointerEvents:"none",style:[{position:'absolute',left:W(k+t.x)-Math.max(4,W(8)),top:W(C+t.y)-Math.max(4,W(8)),width:Math.max(8,W(16)),height:Math.max(8,W(16)),borderRadius:99,backgroundColor:'edit'===e.mode?'#5A4C33':'rgba(255,255,255,0.16)',borderWidth:1,borderColor:'edit'===e.mode?l.colours.gold:'rgba(255,255,255,0.25)'},x()]},o)),'live'===e.mode&&(W(w)<44||W(j)<44)?(0,b.jsx)(i.default,{accessible:!1,importantForAccessibility:"no-hide-descendants",'aria-hidden':!0,...O(n,'move'),style:{position:'absolute',left:W(k+w/2)-Math.max(44,W(w))/2,top:W(C+j/2)-Math.max(44,W(j))/2,width:Math.max(44,W(w)),height:Math.max(44,W(j)),zIndex:2}}):null,(0,b.jsxs)(i.default,{testID:`table-${n.name}`,accessibilityRole:"button",accessibilityLabel:X,onAccessibilityTap:()=>e.onTap?.(n),onKeyDown:t=>{'Enter'!==t?.key&&' '!==t?.key||e.onTap?.(n)},tabIndex:0,...O(n,'move'),style:[{position:'absolute',left:W(k),top:W(C),width:W(w),height:W(j),borderRadius:A,backgroundColor:S,alignItems:'center',justifyContent:'center',padding:2,borderWidth:I?3:e.sectionColours&&z?2.5:1.5,borderColor:I?'#FFFFFF':e.sectionColours&&z?(0,l.brandColour)(z.colour):'edit'===e.mode?l.colours.gold:'rgba(0,0,0,0.35)',transform:[{scale:v?1.06:1}],zIndex:v?50:3,opacity:v&&'live'===e.mode?.85:1,shadowColor:'#000',shadowOpacity:v?.6:.3,shadowRadius:v?14:6,cursor:'edit'===e.mode?'grab':'pointer',touchAction:'none'},v?null:x()],children:[(0,b.jsxs)(i.default,{style:{alignItems:'center'},pointerEvents:"none",children:[(0,b.jsx)(u.T,{weight:"bold",size:E,colour:$,center:!0,numberOfLines:1,children:T}),'live'===e.mode&&'blocked'===g?.status?(0,b.jsx)(u.T,{size:Math.max(10,Math.round(.5*E)),weight:"semibold",colour:$,center:!0,numberOfLines:1,children:"Blocked"}):null,e.big&&'live'===e.mode&&g&&1===H?g.covers||G?(0,b.jsx)(u.T,{size:F,weight:"bold",colour:$,center:!0,numberOfLines:1,children:'free'===g.status||'soon'===g.status?G?`${g.dayBookings?'Booked':'Next'} ${G}`:'':[g.covers?`${g.covers}`:'',G??''].filter(Boolean).join(' \xb7 ')}):null:e.big&&'live'===e.mode&&g&&2===H?(0,b.jsxs)(b.Fragment,{children:[g.covers?(0,b.jsxs)(u.T,{size:F,weight:"semibold",colour:$,center:!0,children:[g.covers," cover",1===g.covers?'':'s']}):'free'!==g.status||L?null:(0,b.jsxs)(u.T,{size:F,colour:$,center:!0,children:[n.minSeats,"\u2013",n.maxSeats]}),G?(0,b.jsx)(u.T,{size:F,weight:"bold",colour:$,center:!0,children:'free'===g.status||'soon'===g.status?`${g.dayBookings?'Booked':'Next'} ${G}`:G}):'dirty'===g.status?(0,b.jsx)(u.T,{size:F,colour:$,center:!0,children:"Clear"}):null]}):e.big&&'live'===e.mode?null:'edit'===e.mode?L?null:(0,b.jsxs)(u.T,{size:11,colour:l.colours.muted,center:!0,children:[n.minSeats,"\u2013",n.maxSeats,n.online?' \xb7 online':'']}):g?(0,b.jsxs)(b.Fragment,{children:['free'!==g.status||L?null:(0,b.jsxs)(u.T,{size:11,colour:$,center:!0,children:[n.minSeats,"\u2013",n.maxSeats," seats"]}),void 0!==g.seatedMins?(0,b.jsxs)(u.T,{size:12,weight:"semibold",colour:$,center:!0,children:[g.seatedMins,"m \xb7 ",g.covers,"\ud83d\udc65"]}):g.orderOnly?(0,b.jsx)(u.T,{size:11,colour:$,center:!0,children:"Open order"}):null,'soon'===g.status&&g.next?(0,b.jsxs)(u.T,{size:11,weight:"semibold",colour:$,center:!0,children:[g.next.time," \xb7 ",void 0===g.nextIn?`${g.next.partySize} Covers`:g.nextIn<=0?'due':`${g.nextIn}m`]}):null,'dirty'!==g.status||L?null:(0,b.jsx)(u.T,{size:11,colour:$,center:!0,children:"Clear"}),!L||g.allergy||g.vip?(0,b.jsxs)(u.T,{size:11,colour:$,center:!0,children:[g.allergy?'\u26a0':'',g.vip?'VIP'===g.vip?'\u2605':'\u2665':'',g.occasion?a.OCCASION_ICON[g.occasion]:'',g.note?'\u270e':'']}):null]}):null]}),null,'live'===e.mode&&g&&!L&&(g.booking??g.next)&&(0,h.needsIcons)(g.booking??g.next).replace('\u26a0\ufe0f','').trim()?(0,b.jsx)(i.default,{pointerEvents:"none",testID:`needs-${n.name}`,style:{position:'absolute',bottom:e.big?-Math.max(9,.55*F):2,right:e.big?-6:4,backgroundColor:(0,t.soutersSurface)('rgba(11,11,11,0.85)'),borderRadius:8,paddingHorizontal:4,borderWidth:1,borderColor:'rgba(255,255,255,0.15)'},children:(0,b.jsx)(u.T,{size:e.big?Math.max(11,.75*F):10,children:(0,h.needsIcons)(g.booking??g.next).replace('\u26a0\ufe0f','').trim()})}):null,z&&'live'===e.mode&&e.sectionColours&&!L&&!e.big?(0,b.jsx)(i.default,{pointerEvents:"none",style:{position:'absolute',top:3,right:6,backgroundColor:(0,l.brandColour)(z.colour),borderRadius:6,paddingHorizontal:3},children:(0,b.jsx)(u.T,{size:9,weight:"bold",colour:"#0B0B0B",children:z.server})}):null,null===Y||L?null:(0,b.jsx)(i.default,{pointerEvents:"none",style:{position:'absolute',left:'15%',right:'15%',bottom:5,height:4,borderRadius:2,backgroundColor:'rgba(0,0,0,0.25)'},children:(0,b.jsx)(i.default,{style:{width:`${Math.min(100,100*Y)}%`,height:4,borderRadius:2,backgroundColor:Y>=1?'#B3261E':'rgba(0,0,0,0.6)'}})}),'live'===e.mode&&g?.group?(0,b.jsx)(i.default,{pointerEvents:"none",testID:`group-${n.name}`,style:{position:'absolute',top:e.big?-Math.max(10,.6*F):2,right:e.big?-6:3,backgroundColor:(0,t.soutersSurface)('#0B0B0B'),borderRadius:8,paddingHorizontal:5,borderWidth:1.5,borderColor:l.colours.gold},children:(0,b.jsxs)(u.T,{size:e.big?Math.max(12,.8*F):10,weight:"bold",colour:l.colours.goldLight,children:["\u26d3 ",(U=g.group,(0,s.tablesLabel)(U.join('+')).replace(/^Tables? /,'').replace(/ \+ /g,'+'))]})}):null,P(n)&&'edit'===e.mode?(0,b.jsx)(i.default,{pointerEvents:"none",style:{position:'absolute',bottom:2,left:4},children:(0,b.jsx)(u.T,{size:10,colour:l.colours.gold,children:"\u26d3"})}):null]}),'edit'===e.mode&&e.selected===n.id?(0,b.jsx)(i.default,{testID:"resize-handle",accessibilityLabel:"Resize table",...O(n,'resize'),style:{position:'absolute',left:W(k+w)-14,top:W(C+j)-14,width:28,height:28,borderRadius:14,backgroundColor:l.colours.gold,borderWidth:2,borderColor:'#fff',zIndex:60,cursor:'nwse-resize',touchAction:'none'}}):null]},n.id);var U}),0===C.length?(0,b.jsx)(i.default,{style:{position:'absolute',left:0,right:0,top:'45%'},children:(0,b.jsxs)(u.T,{center:!0,colour:l.colours.muted,children:["No tables in this area yet",'edit'===e.mode?' \u2014 add some in Tables':'',"."]})}):null]})}):null})};var t=_r(d[0]),o=_r(d[1]),n=_r(d[2]),r=e(n);_r(d[3]);var i=e(_r(d[4])),s=_r(d[5]),a=_r(d[6]),l=_r(d[7]),u=_r(d[8]),h=_r(d[9]),c=_r(d[10]),b=_r(d[11]);const x=(e=250)=>({transitionProperty:'background-color, border-color, transform, left, top, width, height',transitionDuration:`${e}ms`}),g=(e,t=!0)=>t?Math.round(e/s.GRID)*s.GRID:Math.round(e),p=(e,t,o)=>Math.max(t,Math.min(o,e)),f=(e,t,o,n=9)=>Math.max(n,Math.min(e,(o-6)/(.62*Math.max(1,t.length)))),y=12,v=46;function w(e,t){const o=e.tables.filter(e=>e.areaId===t);if(!o.length)return{x:0,y:0,w:s.PLAN_W,h:s.PLAN_H};const n=Math.max(0,Math.min(...o.map(e=>e.x))-v),r=Math.max(0,Math.min(...o.map(e=>e.y))-v);return{x:n,y:r,w:Math.min(s.PLAN_W,Math.max(...o.map(e=>e.x+e.w))+v)-n,h:Math.min(s.PLAN_H,Math.max(...o.map(e=>e.y+e.h))+v)-r}}function M(e){const t=Math.max(1,e.maxSeats),o=[];if('round'===e.shape){const n=e.w/2+9.6,r=e.h/2+9.6;for(let i=0;ie.w,r=Math.ceil(t/2),i=t-r;if(n){for(let t=0;te.w,a=n?{borderColor:'#FFFFFF',borderWidth:2}:null;return'bar'===e.kind?(0,b.jsx)(i.default,{pointerEvents:"none",style:[r,{backgroundColor:o?'#2A2216':'#3A2E1C',borderRadius:8,borderWidth:1.5,borderColor:o?'#5A4A30':l.colours.gold},a],children:(0,b.jsx)(u.T,{size:Math.max(9,Math.min(14,t(e.h)/2.4)),weight:"semibold",colour:l.colours.goldLight,children:"BAR"})}):'wall'===e.kind?(0,b.jsx)(i.default,{pointerEvents:"none",style:[r,{backgroundColor:o?'#3A3631':'#5C574F',borderRadius:2},a]}):'window'===e.kind?(0,b.jsx)(i.default,{pointerEvents:"none",style:[r,{backgroundColor:'rgba(226,196,137,0.16)',borderColor:'rgba(226,196,137,0.6)',borderWidth:1,borderRadius:2},a],children:!o&&t(s?e.h:e.w)>60?(0,b.jsx)(u.T,{size:9,colour:"#BFDDFF",style:s?{transform:[{rotate:'90deg'}]}:void 0,children:"WINDOW"}):null}):(0,b.jsx)(i.default,{pointerEvents:"none",style:[r,{borderColor:o?'#7A6440':l.colours.gold,borderWidth:1.5,borderStyle:'dashed',borderRadius:3,backgroundColor:'rgba(207,164,95,0.08)'},a],children:t(s?e.h:e.w)>40?(0,b.jsx)(u.T,{size:9,colour:l.colours.goldLight,style:s?{transform:[{rotate:'90deg'}]}:void 0,children:"DOOR"}):null})}},928,[868,808,30,122,127,825,826,821,813,950,945,24]); +__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"areaMarks",{enumerable:!0,get:function(){return u}}),_e.AreaTabs=function({plan:o,area:e,onPick:n,counts:a,closed:b}){return(0,c.jsx)(t.Row,{wrap:!0,gap:6,style:{alignItems:'center'},children:o.areas.map(o=>{const f=o.id===e,h=b?.has(o.id);return(0,c.jsx)(l.default,{testID:`area-${o.id}`,accessibilityRole:"tab",accessibilityLabel:`Area ${o.name}${o.dogs?', dogs allowed':''}${o.outdoor?', outdoor':''}${h?', closed for weather':''}`,accessibilityState:{selected:f},onPress:()=>n(o.id),style:{minHeight:48,paddingHorizontal:16,borderRadius:24,borderWidth:1.5,borderColor:f?s.colours.gold:h?s.colours.blue:s.colours.border,backgroundColor:f?s.colours.gold:s.colours.surface,justifyContent:'center'},children:(0,c.jsxs)(t.T,{weight:"semibold",size:15,colour:f?s.colours.onGold:s.colours.text,children:[o.name,u(o),h?(0,c.jsx)(t.T,{size:12,colour:f?s.colours.onGold:s.colours.blue,children:" closed"}):null,a?.[o.id]?(0,c.jsxs)(t.T,{size:12,colour:f?s.colours.onGold:s.colours.muted,children:[" ",a[o.id]]}):null]})},o.id)})})},r(d[0]);var o,e=r(d[1]),l=(o=e)&&o.__esModule?o:{default:o},s=r(d[2]),t=r(d[3]),c=r(d[4]);const u=o=>`${o.dogs?' \ud83d\udc3e':''}${o.outdoor?' \ud83c\udf26':''}`},929,[30,263,821,813,24]); +__d(function(_g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.saveBookingTables=j,_e.TablePicker=function({rid:e,booking:u,name:p,turnBase:f=90,onClose:v,onSaved:w,onPickOnPlan:T}){const $=(0,b.usePlan)(e),C=(0,c.useBookings)(e),[L,P]=(0,s.useState)(()=>(0,b.tablesOf)((0,h.tableKey)((0,b.tablesOf)(u.table)))),S=(0,s.useMemo)(()=>(0,h.pickGroups)($),[$]),W=C.filter(e=>e.date===u.date),z=(0,h.seatsOf)($,L),O=(0,h.seatLine)(z.total,u.partySize),D=(0,h.pickClashes)(u,L,W,f),I=e=>(0,h.pickClashes)(u,[e],W,f)[0]?.with,B=(0,h.tableKey)(L)!==(0,h.tableKey)((0,b.tablesOf)(u.table)),_=e=>P(l=>(0,h.toggleTable)(l,e)),M=async l=>{await j(e,u,l),w?.((0,h.savedWords)(p,u.partySize,l,(0,h.seatsOf)($,l).total)),v()},R=(0,k.jsxs)(n.default,{style:{gap:8},children:[(0,k.jsxs)(n.default,{testID:"table-pick-total",accessible:!0,accessibilityLabel:`${(0,h.tablesWords)(L)} picked. ${O.text}.`,children:[(0,k.jsx)(y.T,{size:18,weight:"semibold",colour:g.colours.goldLight,children:(0,h.tablesWords)(L)}),(0,k.jsx)(y.T,{size:17,colour:g.colours.text,children:O.text})]}),D.length?(0,k.jsx)(n.default,{testID:"table-pick-clash",accessible:!0,accessibilityLabel:`Warning. ${(0,h.clashWords)(D)} You can still save.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:g.colours.gold},children:(0,k.jsxs)(y.T,{size:16,weight:"semibold",colour:g.colours.goldLight,children:[(0,h.clashWords)(D)," You can still save."]})}):null,(0,k.jsxs)(y.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(y.Button,{testID:"table-pick-save",label:D.length?'Save anyway':'Save tables',disabled:!B||!L.length,accessibilityLabel:`${D.length?'Save anyway, ':'Save, '}${(0,h.tablesWords)(L)} for ${p}. ${O.text}.${D.length?` ${(0,h.clashWords)(D)}`:''}`,onPress:()=>M(L),style:[x,{flexGrow:1}]}),(0,b.tablesOf)(u.table).length?(0,k.jsx)(y.Button,{testID:"table-pick-clear",kind:"secondary",label:"Clear table",accessibilityLabel:`Clear table, take ${(0,h.tablesWords)((0,b.tablesOf)(u.table)).toLowerCase()} off ${p}`,onPress:()=>M([]),style:x}):null,(0,k.jsx)(y.Button,{testID:"table-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",onPress:v,style:x})]})]});return(0,k.jsxs)(y.Sheet,{visible:!0,onClose:v,title:`Tables \xb7 ${u.time} ${p} \xb7 ${u.partySize} Covers`,maxWidth:760,testID:"table-picker",footer:R,children:[(0,k.jsx)(l.TableNumberWarning,{plan:$}),(0,k.jsx)(y.T,{size:16,colour:g.colours.text,children:"Tap one table, or several to join them. Tap again to take one off."}),T?(0,k.jsx)(y.Button,{kind:"secondary",testID:"table-pick-on-plan",label:"Pick on the table plan",accessibilityLabel:`Pick on the table plan instead, for ${p}`,onPress:()=>T(L),style:x}):null,S.map(e=>(0,k.jsxs)(n.default,{style:{gap:6},accessibilityLabel:e.area,children:[(0,k.jsx)(y.T,{size:15,weight:"semibold",colour:g.colours.gold,children:e.area}),(0,k.jsx)(y.Row,{gap:8,wrap:!0,children:e.tables.map(e=>{const l=L.includes(e.name),s=I(e.name);return(0,k.jsxs)(o.default,{testID:`table-pick-${e.name}`,accessibilityRole:"checkbox",accessibilityState:{checked:l},'aria-checked':l,accessibilityLabel:(0,h.pickA11y)(e.name,e.seats,l,s),onPress:()=>_(e.name),style:({pressed:e})=>({minWidth:92,minHeight:64,paddingHorizontal:10,paddingVertical:6,borderRadius:12,alignItems:'center',justifyContent:'center',borderWidth:l?2:1,borderColor:l?g.colours.gold:s?g.colours.goldMuted:g.colours.hairline,borderStyle:s&&!l?'dashed':'solid',backgroundColor:l?g.colours.gold:e?g.colours.tilePressed:g.colours.tile}),children:[(0,k.jsx)(y.T,{size:18,weight:"semibold",colour:l?g.colours.onGold:g.colours.text,children:(0,t.tableNumbers)(e.name)}),(0,k.jsxs)(y.T,{size:14,colour:l?g.colours.onGold:g.colours.muted,children:[e.seats," seats",s?' \xb7 booked':'']})]},e.name)})})]},e.area)),S.length?null:(0,k.jsx)(y.Muted,{children:"No tables on the plan yet. Add them in Setup \u203a Table plan."})]})};var l=r(d[0]),t=r(d[1]),s=r(d[2]),o=e(r(d[3])),n=e(r(d[4])),c=r(d[5]),b=r(d[6]),u=r(d[7]),h=r(d[8]),g=r(d[9]),p=r(d[10]),y=r(d[11]),f=r(d[12]),k=r(d[13]);const x={minHeight:56};async function j(e,l,t){const s=(0,h.tableKey)(t),o=(0,b.tablesOf)(l.table);await c.repo.bookings.update(l.id,(0,u.tablePatch)(s||null)),'seated'===l.status&&l.date===(0,p.venueYmd)(new Date)&&(o.filter(e=>!(0,b.tablesOf)(s).includes(e)).forEach(l=>b.useFloor.getState().setLive(e,l,{stage:void 0,dirty:!0})),s&&(0,f.resetTableLive)(e,s))}},930,[914,808,30,263,127,819,825,1297,931,821,818,813,926,24]); +__d(function(_g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"byNum",{enumerable:!0,get:function(){return s}}),e.tableKey=o,e.toggleTable=function(t,n){return t.includes(n)?t.filter(t=>t!==n):a(o([...t,n]))},e.seatsOf=function(t,n){const a={};for(const s of n)a[s]=t.tables.find(t=>t.name===s)?.maxSeats??0;return{per:a,total:Object.values(a).reduce((t,n)=>t+n,0)}},e.seatLine=function(t,n){const a=Math.max(0,n-t);return{text:`${t} ${1===t?'seat':'seats'} for ${l(n)}${a?`: ${a} short`:''}`,short:a,fits:0===a&&t>0}},e.pickClashes=function(t,l,u,c=90){if(!l.length)return[];const f={...t,table:o(l)},b=[];for(const s of u)if(s.id!==t.id&&s.date===t.date&&!['cancelled','noshow','finished'].includes(s.status)&&(0,n.startOf)(f)<(0,n.endOf)(s,c)&&(0,n.startOf)(s)<(0,n.endOf)(f,c))for(const t of a(s.table))l.includes(t)&&b.push({table:t,with:s});return b.sort((t,n)=>s(t.table,n.table))},e.clashWords=function(n){return n.map(n=>`${(0,t.tableNumbers)(n.table)} has ${n.with.walkIn?'a walk-in':(n.with.name||'a booking').replace(' (example)','')} at ${n.with.time}`).join('. ')+(n.length?'.':'')},e.tablesWords=u,e.pickA11y=function(n,a,s,l){return`Table ${(0,t.tableNumbers)(n)}, ${a} ${1===a?'seat':'seats'}${s?', selected':''}${l?`, has ${l.walkIn?'a walk-in':l.name} at ${l.time}`:''}`},e.pickGroups=function(t){return t.areas.map(n=>({area:n.name,tables:t.tables.filter(t=>t.areaId===n.id).map(t=>({name:t.name,seats:t.maxSeats})).sort((t,n)=>s(t.name,n.name))})).filter(t=>t.tables.length)},e.savedWords=function(t,n,a,s){return a.length?`${t}, ${l(n)}: ${u(a)} (${s} seats).`:`${t}: table taken off.`},e.tableActions=function(t,n){const s=a(t.table);if(['cancelled','noshow'].includes(t.status))return[];const o=[s.length?{id:'assign',label:'Change table',a11y:`Change table for ${n}, ${l(t.partySize)}, now ${u(s).toLowerCase()}. You can pick several tables to join.`}:{id:'assign',label:'Assign table',a11y:`Assign table for ${n}, ${l(t.partySize)}. You can pick several tables to join.`}];s.length&&o.push({id:'clear',label:'Clear table',a11y:`Clear table for ${n}, take ${u(s).toLowerCase()} off this booking`});return o},e.dragTables=function(t,n,s){if(!s||'__none'===s||s===n)return null;const l=a(t);if(l.includes(s))return null;return o('__none'!==n&&l.includes(n)?l.map(t=>t===n?s:t):[s])};var t=r(d[0]),n=r(d[1]);const a=t=>t?t.split('+').map(t=>t.trim()).filter(Boolean):[],s=(t,n)=>t.localeCompare(n,'en-GB',{numeric:!0}),l=t=>`${t} ${1===t?'person':'people'}`;function o(t){return[...new Set(t.map(t=>String(t).trim()).filter(Boolean))].sort(s).join('+')}function u(n){const s=a(o(n));return s.length?(0,t.tableListNumbers)(s):'No table'}},931,[808,826]); +__d(function(g,r,i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ds",{enumerable:!0,get:function(){return h}}),_e.useCss=function(){(0,n.useEffect)(()=>{if(!x||document.getElementById('cc-alert-css'))return;const e=document.createElement('style');e.id='cc-alert-css',e.textContent=k,document.head.appendChild(e)},[])},_e.KindIcon=function({kind:e,size:t=22,colour:n}){const a={stroke:n??m.KIND_META[e].colour,strokeWidth:2,fill:'none',strokeLinecap:'round',strokeLinejoin:'round'};return(0,b.jsxs)(l.default,{width:t,height:t,viewBox:"0 0 24 24",children:['booking'===e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...a}),(0,b.jsx)(o.Path,{d:"M3 10h18M8 3v4M16 3v4M9 15l2 2 4-4",...a})]}):null,'pending'===e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Circle,{cx:"12",cy:"13",r:"8",...a}),(0,b.jsx)(o.Path,{d:"M12 9v4l2.5 2M9 2h6",...a})]}):null,'takeaway'===e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Path,{d:"M5 8h14l-1.2 12H6.2z",...a}),(0,b.jsx)(o.Path,{d:"M9 8V6a3 3 0 0 1 6 0v2",...a})]}):null,'email'===e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Rect,{x:"3",y:"5",width:"18",height:"14",rx:"2",...a}),(0,b.jsx)(o.Path,{d:"M3 7l9 6 9-6",...a})]}):null,'test'===e?(0,b.jsx)(o.Path,{d:"M12 2l2.4 6.6L21 9l-5.2 4.3L17.5 20 12 16.3 6.5 20l1.7-6.7L3 9l6.6-.4z",...a}):null]})},_e.SoundToggle=function({big:e}){const t=(0,m.useAlerts)(e=>e.prefs.muted);return(0,b.jsx)(a.default,{accessibilityRole:"switch",accessibilityState:{checked:!t},accessibilityLabel:t?'Alert sound off, tap to turn on':'Alert sound on, tap to mute',onPress:()=>m.useAlerts.getState().setPrefs({muted:!t}),style:{alignSelf:'flex-end',paddingHorizontal:12,paddingVertical:e?8:5,borderRadius:999,backgroundColor:'rgba(0,0,0,0.75)',borderWidth:1,borderColor:d.colours.border},children:(0,b.jsx)(u.T,{size:e?15:12,colour:t?d.colours.muted:d.colours.gold,children:t?'Sound off':'Sound on'})})},_e.AlertHost=function({variant:e,rid:t,me:a,onOpen:s,skipTakeaway:o}){const l=(0,m.useAlerts)(e=>e.live).filter(n=>!(n.rid!==t||'chef'===e&&'takeaway'!==n.kind||o&&'takeaway'===n.kind&&!n.test)),c=e=>'booking'===e.kind||'pending'===e.kind,d=l.filter(c),u=l.filter(e=>!c(e));A('managers'===e);const x=u.map(e=>e.id+':'+e.at).join('|'),h=(0,n.useRef)({me:a,onOpen:s});return h.current={me:a,onOpen:s},(0,n.useEffect)(()=>{const t=new Set(u.map(e=>`alert:${e.id}`));f.useSliders.getState().dismissWhere(e=>e.id.startsWith('alert:')&&!t.has(e.id)&&!e.id.startsWith('alert-keep:'));for(const t of u){const n=m.KIND_META[t.kind],a='display'===e;(0,f.notify)({id:`alert:${t.id}`,tone:T(t),big:a,testID:'alert-slider',kicker:`${n.kicker}${t.test?' \xb7 TEST':''}${t.nag?` \xb7 REMINDER ${t.nag}`:''} \xb7 ${y(t.at)}`,title:t.name,timeoutMs:S(t,e),content:({close:n})=>(0,b.jsx)(I,{a:t,variant:e,big:a,me:h.current.me,onOpen:h.current.onOpen,close:n}),onClose:()=>m.useAlerts.getState().dismiss(t.id)})}},[x,e]),(0,n.useEffect)(()=>()=>f.useSliders.getState().dismissWhere(e=>e.id.startsWith('alert:')),[]),(0,b.jsx)(p.BookingBanners,{alerts:d,big:'display'===e,managers:'managers'===e,me:a,onOpen:s,onClose:e=>m.useAlerts.getState().dismiss(e.id)})};var t=r(_d[0]),n=r(_d[1]);r(_d[2]);var a=e(r(_d[3])),s=e(r(_d[4])),o=r(_d[5]),l=e(o),c=r(_d[6]),d=r(_d[7]),u=r(_d[8]),p=r(_d[9]),f=r(_d[10]),m=r(_d[11]),b=r(_d[12]);const x='undefined'!=typeof document,h=e=>({dataSet:{ccal:e}}),k="\n[data-ccal=\"drop\"]{animation:ccal-drop .62s cubic-bezier(.16,1.1,.3,1) both}\n@keyframes ccal-drop{0%{opacity:0;transform:translate3d(0,-70px,0) scale(.94)}60%{opacity:1}100%{opacity:1;transform:none}}\n[data-ccal=\"big\"]{animation:ccal-big .8s cubic-bezier(.16,1.05,.3,1) both}\n@keyframes ccal-big{0%{opacity:0;transform:translate3d(0,-120px,0) scale(.86)}100%{opacity:1;transform:none}}\n[data-ccal=\"fade\"]{animation:ccal-fade .5s ease both}\n@keyframes ccal-fade{from{opacity:0}to{opacity:1}}\n[data-ccal=\"glow-gold\"]{animation:ccal-glow-gold 2.4s ease-in-out infinite}\n[data-ccal=\"glow-amber\"]{animation:ccal-glow-amber 1.6s ease-in-out infinite}\n[data-ccal=\"glow-ok\"]{animation:ccal-glow-ok 2.4s ease-in-out infinite}\n[data-ccal=\"glow-blue\"]{animation:ccal-glow-blue 2.4s ease-in-out infinite}\n@keyframes ccal-glow-gold{0%,100%{box-shadow:0 0 0 1.5px rgba(207,164,95,.9),0 10px 40px rgba(207,164,95,.28)}50%{box-shadow:0 0 0 1.5px #CFA45F,0 10px 70px rgba(207,164,95,.6)}}\n@keyframes ccal-glow-amber{0%,100%{box-shadow:0 0 0 1.5px rgba(255,181,71,.9),0 10px 40px rgba(255,181,71,.25)}50%{box-shadow:0 0 0 1.5px #FFB547,0 10px 70px rgba(255,181,71,.6)}}\n@keyframes ccal-glow-ok{0%,100%{box-shadow:0 0 0 1.5px rgba(207,164,95,.9),0 10px 40px rgba(207,164,95,.22)}50%{box-shadow:0 0 0 1.5px #CFA45F,0 10px 70px rgba(207,164,95,.5)}}\n@keyframes ccal-glow-blue{0%,100%{box-shadow:0 0 0 1.5px rgba(226,196,137,.9),0 10px 40px rgba(226,196,137,.22)}50%{box-shadow:0 0 0 1.5px #E2C489,0 10px 70px rgba(226,196,137,.5)}}\n[data-ccal=\"stars\"]{position:absolute;top:0;left:0;right:0;bottom:0;pointer-events:none;background-image:radial-gradient(1.2px 1.2px at 23px 41px,#fff,transparent),radial-gradient(1px 1px at 97px 13px,#fff9,transparent),radial-gradient(1.4px 1.4px at 151px 120px,#f5e6c8,transparent),radial-gradient(1px 1px at 61px 163px,#fffa,transparent),radial-gradient(1.6px 1.6px at 183px 77px,#CFA45F,transparent);background-size:211px 199px;opacity:.55;animation:ccal-drift 50s linear infinite}\n@keyframes ccal-drift{to{background-position:-211px 199px}}\n[data-ccal=\"space\"]{background:radial-gradient(ellipse at 50% 120%,#2a1f0c 0%,#0a0805 40%,#000 72%)}\n[data-ccal=\"sheen\"]{position:absolute;top:0;bottom:0;width:35%;left:-50%;pointer-events:none;background:linear-gradient(100deg,transparent,rgba(255,255,255,.09),transparent);animation:ccal-sheen 3.6s ease-in-out .5s infinite}\n@keyframes ccal-sheen{0%{left:-50%}40%,100%{left:130%}}\n[data-ccal=\"dot\"]{animation:ccal-dot 1s ease-in-out infinite alternate}\n@keyframes ccal-dot{from{opacity:.25}to{opacity:1}}\n[data-ccal=\"bar\"]{animation-name:ccal-bar;animation-timing-function:linear;animation-fill-mode:both}\n@keyframes ccal-bar{from{transform:scaleX(1)}to{transform:scaleX(0)}}\n[data-ccal=\"ring\"]{animation:ccal-ring 1.4s ease-out infinite}\n@keyframes ccal-ring{0%{transform:scale(1);opacity:.7}100%{transform:scale(1.9);opacity:0}}\n[data-ccal=\"phase-gold\"]{animation:ccal-phase 1.8s ease-in-out infinite}\n@keyframes ccal-phase{0%,100%{background-color:rgba(40,28,6,.92)}50%{background-color:rgba(255,181,71,.55)}}\n[data-ccal=\"flash-red\"]{animation:ccal-red 1s steps(2,jump-none) infinite}\n@keyframes ccal-red{0%{background-color:#5A0E08}100%{background-color:#D9302A}}\n[data-ccal=\"pulse-btn\"]{animation:ccal-pulse 1.2s ease-in-out infinite}\n@keyframes ccal-pulse{0%,100%{transform:scale(1)}50%{transform:scale(1.04)}}\n@media (prefers-reduced-motion: reduce){[data-ccal]{animation:none !important;transition:none !important}}\n";const y=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`};function w({label:e,value:t,big:n}){return(0,b.jsxs)(s.default,{style:{minWidth:n?130:66,flexGrow:1,paddingVertical:n?10:6,paddingHorizontal:n?14:10,borderRadius:10,backgroundColor:'rgba(255,255,255,0.04)',borderWidth:1,borderColor:'rgba(207,164,95,0.22)'},children:[(0,b.jsx)(u.T,{size:n?13:10,weight:"semibold",colour:f.SLIDER.quiet,style:{letterSpacing:1.4},children:e}),(0,b.jsx)(u.T,{size:n?28:16,weight:"bold",numberOfLines:1,children:t})]})}function j({label:e,onPress:t,kind:n="primary",testID:a,big:s}){return(0,b.jsx)(f.SliderButton,{a:{label:e,kind:n,testID:a,onPress:t,keepOpen:!0},onDone:()=>{},big:s})}const S=(e,t)=>'display'===t?12e3:'chef'===t?15e3:'pending'===e.kind||'takeaway'===e.kind?null:1e4,T=e=>e.allergy?'urgent':'pending'===e.kind?'warn':'normal';function I({a:e,variant:a,big:o,me:l,onOpen:p,close:m}){const[x,h]=(0,n.useState)(!1),[k,y]=(0,n.useState)(null),S=e=>{y(e),setTimeout(m,1800)},T='managers'===a,I=l??'Manager',A='takeaway'===e.kind?[['ORDER',e.orderNo??''],['ITEMS',String(e.items??'')],['TOTAL',e.total??''],['COLLECT',e.collect??'']]:'email'===e.kind?[]:[['TIME',e.when??''],['COVERS',String(e.covers??'')],...e.table?[['TABLE',(0,t.tableNumbers)(e.table)]]:[],['SOURCE',e.source??'']];return(0,b.jsxs)(s.default,{testID:`alert-${e.kind}`,style:{gap:o?12:8},children:['email'===e.kind?(0,b.jsx)(u.T,{size:o?22:14,numberOfLines:2,children:e.subject}):null,A.length?(0,b.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:o?10:6},children:A.map(([e,t])=>(0,b.jsx)(w,{label:e,value:t,big:o},e))}):null,e.allergy?(0,b.jsxs)(s.default,{testID:"alert-allergy",style:{flexDirection:'row',gap:10,alignItems:'center',borderLeftWidth:4,borderColor:d.colours.red,backgroundColor:'rgba(255,107,94,0.10)',borderRadius:8,padding:o?12:8},children:[(0,b.jsx)(u.T,{size:o?16:11,weight:"bold",colour:d.colours.red,style:{letterSpacing:1.6},children:"ALLERGY"}),(0,b.jsxs)(s.default,{style:{flex:1},children:[(0,b.jsx)(u.T,{size:o?22:14,weight:"semibold",colour:"#FFE1DC",children:e.allergy}),e.allergyStep?(0,b.jsx)(u.T,{size:o?15:11,colour:"#FFC4BB",children:e.allergyStep}):null]})]}):null,'pending'===e.kind&&'managers'!==a?(0,b.jsx)(u.T,{size:o?18:13,colour:d.colours.amber,children:"Waiting for a manager to confirm it in the Managers app."}):null,'email'===e.kind&&e.test?(0,b.jsx)(u.T,{size:12,colour:f.SLIDER.quiet,children:"Test only. No venue email is connected yet."}):null,k?(0,b.jsx)(u.T,{size:14,weight:"semibold",colour:d.colours.goldLight,children:k}):null,(0,b.jsxs)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'flex-end',alignItems:'center'},children:[T&&!k?'pending'===e.kind?x?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(u.T,{size:14,colour:"#FFE1DC",style:{flexBasis:'100%'},children:["Decline this booking? We\u2019ll let ",e.name," know by text",e.test?' (test: nothing happens)':' (preview mode)',"."]}),(0,b.jsx)(j,{kind:"danger",label:"Yes, decline it",testID:"alert-decline-yes",onPress:()=>{e.refId&&!e.test&&c.repo.bookings.decide(e.refId,'declined',I),S('Declined. The guest\u2019s message is in the Outbox.')}}),(0,b.jsx)(j,{kind:"ghost",label:"Keep it",onPress:()=>h(!1)})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(j,{label:"Confirm",testID:"alert-confirm",onPress:()=>{e.refId&&!e.test&&c.repo.bookings.decide(e.refId,'confirmed',I),S(e.test?'Test alert: nothing to confirm.':'Confirmed. Their confirmation is ready in the Outbox.')}}),(0,b.jsx)(j,{kind:"danger",label:"Decline",testID:"alert-decline",onPress:()=>h(!0)})]}):'takeaway'===e.kind?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(j,{label:"Accept",testID:"alert-accept",onPress:async()=>{const t=!(e.refId&&!e.test)||await c.repo.orders.accept(e.refId,I);S(t?'Accepted.':'Accepted. The allergy sign-off is still needed before cooking.')}}),[15,20,30].map(t=>(0,b.jsx)(j,{kind:"ghost",label:`Ready in ${t}`,onPress:async()=>{const n=!(e.refId&&!e.test)||await c.repo.orders.accept(e.refId,I,t);S(`Accepted, ready in ${t} minutes.${n?'':' Allergy sign-off still needed.'}`)}},t))]}):'booking'===e.kind&&p?(0,b.jsx)(j,{kind:"ghost",label:"View bookings",onPress:()=>{m(),p(e)}}):null:null,k?null:(0,b.jsx)(j,{kind:"ghost",label:!T||'pending'!==e.kind&&'takeaway'!==e.kind?'Close':'Later',testID:"alert-close",onPress:m})]})]})}function A(e){const t=(0,m.useAlerts)(e=>e.askedSystem);(0,n.useEffect)(()=>{if(!e||t||'default'!==(0,m.systemSupport)())return;const n=setTimeout(()=>(0,f.notify)({id:'notify-prompt',testID:'notify-prompt',icon:'\ud83d\udd14',title:'Get booking alerts on this device?',body:'We\u2019ll let you know about new bookings, requests to confirm and takeaway orders, even when the app is in the background. You can change this any time in More, Alerts and sounds.',actions:[{label:'Turn on alerts',testID:'notify-allow',onPress:()=>{(0,m.requestSystemPermission)().then(()=>m.useAlerts.getState().setAsked())}},{label:'Not now',kind:'ghost',onPress:()=>m.useAlerts.getState().setAsked()}]}),2500);return()=>clearTimeout(n)},[e,t])}},932,[808,30,122,263,127,948,819,821,813,1346,919,934,24]); +__d(function(g,r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"unconfirmedTakeaways",{enumerable:!0,get:function(){return x}}),_e.useBuildingChime=function(e,s=4e3,i=6e4){const o=(0,a.useAlerts)(e=>e.prefs.muted);(0,t.useEffect)(()=>{if(!e||o)return;const t=Date.now(),l=()=>(0,c.lowChime)(Math.min(1,(Date.now()-t)/i));l();const n=setInterval(l,s);return()=>clearInterval(n)},[e,o,s,i])},_e.TakeawayFacts=b,_e.TakeawayTakeover=function({rid:e,me:i}){const o=(0,l.useOrders)(e),n=x(o),a=n[0],c=s.default.useRef(i);return c.current=i,(0,t.useEffect)(()=>{a?(0,f.notify)({id:'takeaway-takeover',tone:a.allergies.length?'urgent':'warn',modal:!0,big:!0,testID:'takeaway-takeover',icon:'\ud83e\udd61',kicker:'NEW TAKEAWAY ORDER',title:`Order ${a.ref}: read it, then tap Confirm`,body:"This stays on screen until someone confirms."+(n.length>1?` ${n.length-1} more waiting.`:''),timeoutMs:null,content:()=>(0,j.jsx)(y,{rid:e,id:a.id,me:c.current})}):(0,f.dismissNotice)('takeaway-takeover')},[a?.id,n.length,e]),(0,t.useEffect)(()=>()=>(0,f.dismissNotice)('takeaway-takeover'),[]),null};var t=r(d[0]),s=e(t),i=e(r(d[1])),o=e(r(d[2])),l=r(d[3]),n=r(d[4]),a=r(d[5]),c=r(d[6]),u=r(d[7]),h=r(d[8]),f=r(d[9]),j=r(d[10]);const w=e=>e?new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}):'As soon as possible',x=e=>e.filter(e=>'takeaway'===e.type&&'new'===e.status&&!e.accepted).sort((e,t)=>e.createdAt.localeCompare(t.createdAt));function b({o:e,big:t,personal:s=!0}){const o=t?1:.8;return(0,j.jsxs)(i.default,{style:{gap:10},children:[(0,j.jsxs)(i.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:18},children:[(0,j.jsxs)(i.default,{children:[(0,j.jsx)(h.T,{size:13*o+2,colour:u.colours.muted,children:"Collection"}),(0,j.jsx)(h.T,{size:34*o,weight:"bold",colour:u.colours.goldLight,children:w(e.slotTime)})]}),s?(0,j.jsxs)(i.default,{children:[(0,j.jsx)(h.T,{size:13*o+2,colour:u.colours.muted,children:"Customer"}),(0,j.jsx)(h.T,{size:26*o,weight:"semibold",children:e.customerName})]}):null,s?(0,j.jsxs)(i.default,{children:[(0,j.jsx)(h.T,{size:13*o+2,colour:u.colours.muted,children:"Phone"}),(0,j.jsx)(h.T,{size:26*o,weight:"semibold",children:e.phone??'Not given'})]}):null,(0,j.jsxs)(i.default,{children:[(0,j.jsx)(h.T,{size:13*o+2,colour:u.colours.muted,children:"Order"}),(0,j.jsx)(h.T,{size:26*o,weight:"semibold",children:e.ref})]})]}),e.allergies.length?(0,j.jsxs)(i.default,{testID:"takeover-allergy",style:{backgroundColor:'#7A140D',borderRadius:12,padding:12,borderWidth:2,borderColor:'#FFB3AB'},children:[(0,j.jsxs)(h.T,{size:22*o,weight:"bold",colour:"#FFFFFF",children:["\u26a0 ALLERGY: ",e.allergies.map(e=>`${(0,n.allergenLabel)(e.allergen)} (${(0,n.severityLabel)(e.severity)})`).join(', ')]}),e.lines.filter(e=>e.overridden).map((e,t)=>(0,j.jsxs)(h.T,{size:16*o,weight:"semibold",colour:"#FFE3DF",children:["Customer overrode a warning: ",e.name," contains ",e.contains.map(n.allergenLabel).join(', ')]},t))]}):(0,j.jsx)(h.T,{size:16*o,colour:u.colours.ok,children:"No allergies declared"}),(0,j.jsx)(i.default,{style:{gap:4},children:e.lines.map((e,t)=>(0,j.jsxs)(h.T,{size:22*o,weight:"semibold",children:[e.qty," \xd7 ",e.name,e.choices.length?` (${e.choices.join(', ')})`:'',e.notes?` \xb7 \u201c${e.notes}\u201d`:'']},t))})]})}function y({rid:e,id:t,me:s}){const n=(0,l.useOrders)(e).find(e=>e.id===t),{width:a}=(0,o.default)();return n?(0,j.jsxs)(i.default,{style:{gap:12},children:[(0,j.jsx)(b,{o:n,big:a>=700}),(0,j.jsx)(h.Button,{label:`Confirm order ${n.ref}`,testID:"takeover-confirm",onPress:()=>{l.repo.orders.accept(n.id,s)},style:{minHeight:72,borderRadius:14}})]}):null}},933,[30,127,287,819,814,934,923,821,813,919,24]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"chime",{enumerable:!0,get:function(){return l.chime}}),e.sendTestAlert=function(t,a){const o={rid:t,at:Date.now(),test:!0},c='pending'===a?{...o,id:`test-pending:${Date.now()}`,kind:'pending',name:'Test guest',when:'Today 19:30',covers:10,source:'Online'}:'takeaway'===a?{...o,id:`test-takeaway:${Date.now()}`,kind:'takeaway',name:'Test guest',orderNo:'T-TEST',items:3,total:'\xa324.50',collect:'18:45',source:'Online',allergy:'Milk (allergy)',allergyStep:'Test only: no sign-off needed'}:'email'===a?{...o,id:`test-email:${Date.now()}`,kind:'email',name:'CoverCharge test',subject:'This is a test alert. No real email was received.'}:{...o,id:`test-booking:${Date.now()}`,kind:'test'===a?'test':'booking',name:'Test guest',when:'Today 19:30',covers:4,table:'7',source:'Phone',allergy:'Peanuts (allergy)',allergyStep:'Test only: no sign-off needed'};n.useAlerts.getState().raise(c)};var t=r(d[0]);Object.keys(t).forEach(function(n){'default'===n||Object.prototype.hasOwnProperty.call(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[n]}})});var n=r(d[1]);Object.keys(n).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})});var a=r(d[2]);Object.keys(a).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return a[t]}})});var o=r(d[3]);Object.keys(o).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return o[t]}})});var c=r(d[4]);Object.keys(c).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return c[t]}})});var l=r(d[5]),s=r(d[6]);Object.keys(s).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return s[t]}})})},934,[1347,1348,1350,1349,1351,923,1352]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BlockList=p,_e.BlockBookingsSheet=B,_e.BlocksBanner=function({rid:e,now:o,big:s,by:l="staff"}){const t=(0,i.useBlocks)(e=>e.blocks),r=(0,i.useBlocks)(e=>e.remove),a=(0,i.activeBlock)(t,e,(0,c.ymd)(o),(0,c.hm)(o));return a?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(M,{rid:e,now:o,big:s}),(0,f.jsxs)(n.default,{testID:"blocks-banner",accessibilityRole:"summary",style:{flexDirection:'row',alignItems:'center',gap:10,backgroundColor:u.colours.amberBg,borderColor:u.colours.amber,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[(0,f.jsx)(b.T,{size:s?20:16,children:"\u23f8"}),(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",colour:u.colours.amber,style:{flex:1},children:(0,i.pausedLine)(a)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Undo",testID:"blocks-undo",onPress:()=>{r(a.id,l),(0,m.pushBlocksToWix)(e,[a.id],'remove')}})]})]}):(0,f.jsx)(M,{rid:e,now:o,big:s})},_e.BlockBookingsButton=function({rid:e,r:o,now:a,by:d,wide:m,big:x,quiet:j,tile:k,display:p}){const[y,w]=(0,s.useState)(!1),C=(0,i.useBlocks)(e=>e.blocks),v=(0,i.currentBlocks)(C,e,(0,c.ymd)(a),(0,c.hm)(a)).length;return k?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(l.ActionTile,{testID:"block-bookings",icon:"pause",label:"Block bookings",sub:v?`${v} block${1===v?'':'s'} on now`:'Pause online times',count:v||void 0,onPress:()=>w(!0),accessibilityLabel:"Block bookings"}),y?(0,f.jsx)(B,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>w(!1)}):null]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(r.default,{testID:"block-bookings",accessibilityRole:"button",accessibilityLabel:"Block bookings",onPress:()=>w(!0),style:({pressed:e})=>j?{...t.look.quiet(e),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:u.colours.gold,borderRadius:16,paddingVertical:x?14:10,paddingHorizontal:18,backgroundColor:e?u.colours.goldTint:'transparent'},children:[j?null:(0,f.jsx)(b.T,{size:x?22:17,colour:u.colours.gold,children:"\u23f8"}),(0,f.jsx)(b.T,{size:j?15:x?22:17,weight:"semibold",colour:j?u.colours.goldLight:u.colours.gold,children:"Block bookings"}),v?(0,f.jsx)(n.default,{style:{backgroundColor:u.colours.amber,borderRadius:10,minWidth:22,paddingHorizontal:6},children:(0,f.jsx)(b.T,{size:13,weight:"bold",colour:u.colours.onGold,center:!0,children:v})}):null]}),y?p?(0,f.jsx)(h.DisplayBlocksMenu,{rid:e,r:o,now:a,by:d,onClose:()=>w(!1)}):(0,f.jsx)(B,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>w(!1)}):null]})},_e.closeOutdoor=C,_e.useOutdoor=v,_e.CloseGardenButton=function({rid:e,r:o,now:s,by:n,big:a,quiet:d,short:c,tile:h}){const m=v(e,s);if(!m.outdoor.length)return null;const x=m.allClosed;return h?(0,f.jsx)(l.ActionTile,{testID:x?'reopen-garden':'close-garden',icon:x?'sun':'rain',tone:x?'blue':'gold',label:x?'Reopen garden':'Close garden',sub:x?'Closed for weather':'For weather',accessibilityLabel:x?'Reopen garden':'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):C(e,o,s,n,m.outdoor.filter(e=>!m.closed.has(e.id)))}):(0,f.jsxs)(r.default,{testID:x?'reopen-garden':'close-garden',accessibilityRole:"button",accessibilityLabel:x?'Reopen garden':'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):C(e,o,s,n,m.outdoor.filter(e=>!m.closed.has(e.id))),style:({pressed:e})=>d?{...t.look.quiet(e,x?'blue':'gold'),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:x?u.colours.blue:u.colours.gold,borderRadius:16,paddingVertical:a?14:10,paddingHorizontal:16,minHeight:48,backgroundColor:e?u.colours.goldTint:x?u.colours.blueBg:'transparent'},children:[d?null:(0,f.jsx)(b.T,{size:a?22:17,children:x?'\u2600\ufe0f':'\ud83c\udf27'}),(0,f.jsx)(b.T,{size:d?15:a?20:16,weight:"semibold",colour:x?u.colours.blue:d?u.colours.goldLight:u.colours.gold,children:x?'Reopen garden':c?'Close garden':'Close garden for weather'})]})},_e.GardenBanner=M;var o=_r(_d[0]),s=_r(_d[1]),l=_r(_d[2]),t=_r(_d[3]),r=e(_r(_d[4])),n=e(_r(_d[5])),i=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),b=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),f=_r(_d[14]);const x=e=>(0,c.fromMins)(15*Math.floor((60*e.getHours()+e.getMinutes())/15)),j=(e,o)=>e.date===o?'Today':(0,c.niceDate)((0,c.parseYmd)(e.date));function k({title:e,sub:o,onPress:s,testID:l,disabled:t}){return(0,f.jsxs)(r.default,{testID:l,accessibilityRole:"button",accessibilityLabel:e,disabled:t,onPress:s,style:({pressed:e})=>({borderWidth:1.5,borderColor:u.colours.gold,borderRadius:16,padding:16,backgroundColor:e?u.colours.goldTint:u.colours.surface2,opacity:t?.4:1}),children:[(0,f.jsx)(b.T,{size:20,weight:"semibold",colour:u.colours.gold,children:e}),o?(0,f.jsx)(b.Muted,{children:o}):null]})}function p({rid:e,now:l,by:t="staff"}){const r=(0,i.useBlocks)(e=>e.blocks),a=(0,i.useBlocks)(e=>e.remove),[d,h]=(0,s.useState)(null),x=(0,c.ymd)(l),k=(0,i.currentBlocks)(r,e,x,(0,c.hm)(l));return k.length?(0,f.jsxs)(n.default,{style:{gap:8},testID:"block-list",children:[k.map(e=>{const s=e.date===x&&(0,c.toMins)(e.from)<=(0,c.toMins)((0,c.hm)(l));return(0,f.jsxs)(b.Row,{style:{justifyContent:'space-between',borderWidth:1,borderColor:s?u.colours.amber:u.colours.border,borderRadius:12,padding:10},children:[(0,f.jsxs)(n.default,{style:{flex:1},children:[(0,f.jsxs)(b.T,{weight:"semibold",children:[e.areaId?`${e.areaName??'Area'} closed \xb7 `:'',e.tables?.length?`${e.tables.map(o.tableNumbers).join(', ')} \xb7 `:'',j(e,x)," \xb7 ",e.from,"\u2013",e.to,s?' \xb7 now':'']}),(0,f.jsxs)(b.Muted,{children:[e.reason??'No reason given'," \xb7 by ",e.by,e.areaId?' \xb7 the rest of the venue stays open':'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Remove",testID:`block-remove-${e.id}`,onPress:()=>h(e)})]},e.id)}),d?(0,f.jsxs)(b.Sheet,{visible:!0,onClose:()=>h(null),title:"Remove this block?",testID:"block-remove-confirm",children:[(0,f.jsx)(b.T,{children:`${j(d,x)}, ${d.from}\u2013${d.to}. Bookings open again for that time.`}),(0,f.jsx)(b.Button,{testID:"block-remove-yes",label:"Remove block",onPress:()=>{a(d.id,t),(0,m.pushBlocksToWix)(e,[d.id],'remove'),h(null)}}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Keep it",onPress:()=>h(null)})]}):null]}):(0,f.jsx)(b.Muted,{children:"No bookings paused. Online and staff bookings are open as normal."})}function y({value:e,onChange:o}){return(0,f.jsxs)(n.default,{style:{gap:6},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Reason (optional)"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:i.BLOCK_REASONS.map(s=>(0,f.jsx)(b.Chip,{label:s,selected:e===s,onPress:()=>o(e===s?void 0:s)},s))})]})}function w({label:e,value:o,onChange:s,min:l,max:t}){return(0,f.jsxs)(b.Row,{gap:8,children:[(0,f.jsx)(b.T,{style:{width:52},children:e}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"\u221230",accessibilityLabel:`${e} 30 minutes earlier`,onPress:()=>s(Math.max(l,o-30))}),(0,f.jsx)(b.T,{size:22,weight:"semibold",colour:u.colours.gold,style:{minWidth:70,textAlign:'center'},children:(0,c.fromMins)(o)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"+30",accessibilityLabel:`${e} 30 minutes later`,onPress:()=>s(Math.min(t,o+30))})]})}function B({rid:e,r:o,now:l,by:t,onClose:r,wide:a}){const u=(0,i.useBlocks)(e=>e.add),[h,m]=(0,s.useState)('menu'),[j,B]=(0,s.useState)(),C=(0,c.ymd)(l),v=(0,d.hoursFor)(o,l),M=v?(0,c.hm)(v.close):null,P=x(l),T=!!v&&(0,c.toMins)(P)<(0,c.toMins)(M),I=(0,c.fromMins)((0,c.toMins)(P)+60),R=(0,s.useMemo)(()=>{const e=[];for(let s=1;s<=28;s++){const t=new Date(l);t.setHours(12,0,0,0),t.setDate(t.getDate()+s),(0,d.hoursFor)(o,t)&&e.push(t)}return e},[C,o.id]),[$,z]=(0,s.useState)(R[0]?(0,c.ymd)(R[0]):C),S=(0,d.hoursFor)(o,(0,c.parseYmd)($)),L=S?(0,c.toMins)((0,c.hm)(S.open)):720,F=S?(0,c.toMins)((0,c.hm)(S.close)):1260,[W,A]=(0,s.useState)(null),N=W??{from:L,to:F},H=(o,s,l)=>{u({rid:e,date:o,from:s,to:l,reason:j,by:t}),r()};return(0,f.jsx)(b.Sheet,{visible:!0,onClose:r,title:"Block bookings",maxWidth:a?720:void 0,testID:"block-sheet",children:'menu'===h?(0,f.jsxs)(n.default,{style:{gap:10},children:[(0,f.jsx)(b.Muted,{children:"Pause new bookings for a while. The customer app stops offering those times, and staff get a warning."}),(0,f.jsx)(k,{testID:"block-today",title:"Today",sub:T?`Now until close (${M}) or for 1 hour`:'Closed for the rest of today',disabled:!T,onPress:()=>m('today')}),(0,f.jsx)(k,{testID:"block-future",title:"Future dates",sub:"Pick a date and a time window",onPress:()=>m('future')}),(0,f.jsx)(D,{rid:e,r:o,now:l,by:t,onDone:r}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Active and upcoming"}),(0,f.jsx)(p,{rid:e,now:l})]}):'today'===h?(0,f.jsxs)(n.default,{style:{gap:10},children:[(0,f.jsx)(y,{value:j,onChange:B}),(0,f.jsx)(k,{testID:"block-until-close",title:"From now until close",sub:`${P} to ${M} (kitchen close, from opening hours)`,onPress:()=>H(C,P,M)}),(0,f.jsx)(k,{testID:"block-one-hour",title:"From now for 1 hour",sub:`${P} to ${I}`,onPress:()=>H(C,P,I)}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]}):(0,f.jsxs)(n.default,{style:{gap:10},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Date"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:R.map(e=>(0,f.jsx)(b.Chip,{label:(0,c.niceDate)(e),selected:$===(0,c.ymd)(e),onPress:()=>{z((0,c.ymd)(e)),A(null)}},(0,c.ymd)(e)))}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Time window"}),(0,f.jsxs)(b.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(b.Chip,{label:"All day",selected:N.from===L&&N.to===F,onPress:()=>A({from:L,to:F})}),L<1020?(0,f.jsx)(b.Chip,{label:`Lunch ${(0,c.fromMins)(L)}\u201317:00`,selected:N.from===L&&1020===N.to,onPress:()=>A({from:L,to:Math.min(1020,F)})}):null,F>1020?(0,f.jsx)(b.Chip,{label:`Evening 17:00\u2013${(0,c.fromMins)(F)}`,selected:1020===N.from&&N.to===F,onPress:()=>A({from:Math.max(1020,L),to:F})}):null]}),(0,f.jsx)(w,{label:"From",value:N.from,min:L,max:N.to-30,onChange:e=>A({...N,from:e})}),(0,f.jsx)(w,{label:"To",value:N.to,min:N.from+30,max:F,onChange:e=>A({...N,to:e})}),(0,f.jsx)(y,{value:j,onChange:B}),(0,f.jsx)(b.Button,{testID:"block-save-future",label:`Block ${(0,c.niceDate)((0,c.parseYmd)($))} ${(0,c.fromMins)(N.from)}\u2013${(0,c.fromMins)(N.to)}`,disabled:!R.length,onPress:()=>H($,(0,c.fromMins)(N.from),(0,c.fromMins)(N.to))}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]})})}function C(e,o,s,l,t){const r=(0,d.hoursFor)(o,s),n=x(s),a=r?(0,c.hm)(r.close):null,u=a&&(0,c.toMins)(a)>(0,c.toMins)(n)?a:'23:59';return t.map(o=>i.useBlocks.getState().add({rid:e,date:(0,c.ymd)(s),from:n,to:u,reason:'Weather',by:l,areaId:o.id,areaName:o.name}))}function v(e,o){const s=(0,a.usePlan)(e),l=(0,i.useBlocks)(e=>e.blocks),t=s.areas.filter(e=>e.outdoor),r=(0,i.closedAreasAt)(l,e,(0,c.ymd)(o),(0,c.hm)(o)),n=l.filter(s=>s.rid===e&&s.areaId&&s.date===(0,c.ymd)(o)&&(0,c.toMins)((0,c.hm)(o))>=(0,c.toMins)(s.from)&&(0,c.toMins)((0,c.hm)(o))<(0,c.toMins)(s.to));return{plan:s,outdoor:t,closed:r,active:n,allClosed:t.length>0&&t.every(e=>r.has(e.id))}}function D({rid:e,r:o,now:s,by:l,onDone:t}){const r=v(e,s);return!r.outdoor.length||r.allClosed?null:(0,f.jsx)(k,{testID:"block-garden",title:"Close garden for weather",sub:`${r.outdoor.map(e=>e.name).join(', ')} only \xb7 the rest of the venue stays bookable`,onPress:()=>{C(e,o,s,l,r.outdoor.filter(e=>!r.closed.has(e.id))),t()}})}function M({rid:e,now:o,big:s}){const l=v(e,o);if(!l.active.length)return null;const t=[...new Set(l.active.map(e=>e.areaName??'Garden'))].join(', '),r=l.active.map(e=>e.to).sort().slice(-1)[0],a=l.plan.areas.filter(e=>e.dogs&&!l.closed.has(e.id)).map(e=>e.name);return(0,f.jsxs)(n.default,{testID:"garden-banner",accessibilityRole:"summary",style:{flexDirection:'row',alignItems:'center',gap:10,backgroundColor:u.colours.blueBg,borderColor:u.colours.blue,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[(0,f.jsx)(b.T,{size:s?20:16,children:"\ud83c\udf27"}),(0,f.jsxs)(n.default,{style:{flex:1},children:[(0,f.jsxs)(b.T,{size:s?20:16,weight:"semibold",colour:u.colours.blue,children:[t," closed for weather until ",r]}),(0,f.jsxs)(b.T,{size:13,colour:"#E2C489",children:["No bookings or walk-ins are offered there.",a.length?` Dogs can still sit in the ${a.join(' or ')}.`:'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Reopen",testID:"garden-reopen",onPress:()=>l.active.forEach(e=>i.useBlocks.getState().remove(e.id))})]})}},935,[808,30,1339,937,263,127,824,825,815,818,821,813,1024,1393,24]); +__d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DAY_BACK",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"DAY_AHEAD",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"DAY_IDLE_MS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"dayOffset",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"shiftDay",{enumerable:!0,get:function(){return h}}),_e.dayWord=p,Object.defineProperty(_e,"dayLong",{enumerable:!0,get:function(){return x}}),_e.bookingsForDay=D,_e.dayCovers=function(e,t,o){if(t>=o)return(0,s.coversToday)(e,t);const n=D(e,t,o),d=(c=n.filter(e=>(0,s.coverDone)(e)||'seated'===(0,s.shownStatus)(e)),c.reduce((e,t)=>e+t.partySize,0)),l=(0,s.coversToday)(e,t).total;var c;return{done:d,toCome:Math.max(0,l-d),total:l}},_e.DaySwitch=function({day:e,today:s,onDay:b,back:D=u,ahead:j=y,idPrefix:$="display-day",stacked:P=!1}){const T=f(e,s),v=t=>{const o=h(e,t);b(o===s?null:o)},w=h(e,-1),C=h(e,1),Y=0!==T,I=(e,o,s,d,u)=>(0,c.jsx)(t.default,{testID:u,accessibilityRole:"button",accessibilityLabel:o,accessibilityState:{disabled:d},disabled:d,onPress:s,style:({pressed:e})=>({minHeight:44,minWidth:P?0:92,flex:P?1:void 0,paddingHorizontal:P?6:12,borderRadius:12,alignItems:'center',justifyContent:'center',borderWidth:1,borderColor:l.colours.hairline,opacity:d?.35:1,backgroundColor:e?l.colours.tilePressed:'rgba(255,255,255,0.03)'}),children:(0,c.jsx)(n.T,{center:P,size:P?16:14,weight:"semibold",colour:l.colours.goldLight,numberOfLines:P?void 0:1,children:e})}),L=p(e,s);return P?(0,c.jsxs)(o.default,{testID:`${$}-switch`,style:{gap:10,padding:12,borderRadius:14,borderWidth:1,borderColor:Y?l.colours.gold:l.colours.hairline,backgroundColor:Y?l.colours.goldTint:l.colours.surface},children:[(0,c.jsxs)(o.default,{testID:`${$}-label`,accessible:!0,accessibilityRole:"header",accessibilityLabel:`Showing ${L}, ${x(e)}`,style:{gap:2,alignItems:'center'},children:[(0,c.jsx)(n.T,{center:!0,size:20,weight:"semibold",colour:l.colours.goldLight,children:L}),(0,c.jsx)(n.T,{center:!0,size:16,children:x(e)})]}),(0,c.jsxs)(o.default,{style:{flexDirection:'row',gap:8,justifyContent:'center'},children:[I('\u2039 Previous',`Previous day, ${x(w)}`,()=>v(-1),T<=-D,`${$}-prev`),I('Today','Back to today',()=>b(null),!1,'back-to-today'),I('Next \u203a',`Next day, ${x(C)}`,()=>v(1),T>=j,`${$}-next`)]})]}):(0,c.jsxs)(o.default,{testID:`${$}-switch`,style:{flexDirection:'row',alignItems:'center',gap:8},children:[I('\u2039 Previous',`Previous day, ${x(w)}`,()=>v(-1),T<=-D,`${$}-prev`),(0,c.jsxs)(t.default,{testID:`${$}-label`,accessibilityRole:Y?'button':'text',disabled:!Y,onPress:()=>b(null),accessibilityLabel:Y?`Showing ${L===(0,d.niceDate)((0,d.parseYmd)(e))?'':`${L}, `}${x(e)}. Back to today`:`Showing today, ${x(e)}`,style:({pressed:e})=>({flex:1,minWidth:0,minHeight:44,borderRadius:12,alignItems:'center',justifyContent:'center',paddingHorizontal:6,borderWidth:Y?1:0,borderColor:l.colours.gold,backgroundColor:e?l.colours.tilePressed:Y?l.colours.goldTint:'transparent'}),children:[(0,c.jsx)(n.T,{size:15,weight:"semibold",colour:Y?l.colours.gold:l.colours.text,numberOfLines:1,children:Y&&L!==(0,d.niceDate)((0,d.parseYmd)(e))?`${L} \xb7 ${(0,d.niceDate)((0,d.parseYmd)(e))}`:L}),Y?(0,c.jsx)(n.T,{size:11,colour:l.colours.muted,numberOfLines:1,children:"Tap for today"}):null]}),I('Next \u203a',`Next day, ${x(C)}`,()=>v(1),T>=j,`${$}-next`)]})},r(_d[0]);var t=e(r(_d[1])),o=e(r(_d[2])),n=r(_d[3]),s=r(_d[4]),d=r(_d[5]),l=r(_d[6]),c=r(_d[7]);const u=365,y=365,b=12e4,f=(e,t)=>Math.round(((0,d.parseYmd)(e).getTime()-(0,d.parseYmd)(t).getTime())/864e5),h=(e,t)=>(0,d.ymd)((0,d.addMins)((0,d.parseYmd)(e),1440*t+120));function p(e,t){const o=f(e,t);return 0===o?'Today':-1===o?'Yesterday':1===o?'Tomorrow':(0,d.niceDate)((0,d.parseYmd)(e))}const x=e=>(0,d.parseYmd)(e).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'});function D(e,t,o){return e.filter(e=>e.date===t&&(0,s.ACTIVE)(e))}},936,[30,263,127,813,828,818,821,24]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"look",{enumerable:!0,get:function(){return D}});var E=r(d[0]),I=r(d[1]),S=r(d[2]),o=r(d[3]);r(d[4]);var _=r(d[5]);const b=E=>E,D={panel:{backgroundColor:E.IS_QUEUED_VENUE?I.QUEUED_BRAND.ink:E.IS_ABBOTSFORD?'#2A2F34':E.IS_KIRKTON?'#141414':E.IS_GREENSIDE?'#222222':E.IS_WILDINGS?'#30343B':(0,o.soutersSurface)('#121110'),borderRadius:_.radii.xl,borderWidth:1,borderColor:'rgba(255,255,255,0.07)',boxShadow:'0 1px 0 rgba(255,255,255,0.04) inset, 0 12px 28px rgba(0,0,0,0.45)'},quiet:(o,b="gold")=>({minHeight:_.control.tall,borderRadius:_.radii.button,borderWidth:1,borderColor:E.IS_QUEUED_VENUE?I.QUEUED_BRAND.smallTextAccent:E.IS_ABBOTSFORD?'rgba(229,208,141,0.65)':E.IS_KIRKTON?'rgba(180,108,84,0.55)':E.IS_GREENSIDE?S.GREENSIDE_DISPLAY.quietBorder:E.IS_WILDINGS?'rgba(255,227,165,0.55)':E.IS_KIRKMICHAEL?'rgba(184,119,84,0.55)':E.IS_ISOLATED_VENUE?'rgba(164,98,46,0.55)':'blue'===b?'rgba(226,196,137,0.55)':'rgba(207,164,95,0.38)',backgroundColor:E.IS_ISOLATED_VENUE?o?E.IS_ABBOTSFORD?'rgba(184,147,98,0.16)':E.IS_KIRKTON?'rgba(180,108,84,0.16)':E.IS_GREENSIDE?S.GREENSIDE_DISPLAY.quietPressed:E.IS_WILDINGS?'rgba(255,227,165,0.16)':E.IS_KIRKMICHAEL?'rgba(184,119,84,0.16)':'rgba(164,98,46,0.16)':'rgba(255,255,255,0.035)':o?'rgba(207,164,95,0.16)':'blue'===b?'rgba(226,196,137,0.10)':'rgba(255,255,255,0.035)',paddingHorizontal:14,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,boxShadow:'0 1px 0 rgba(255,255,255,0.05) inset',transition:'background-color 120ms ease'}),primary:o=>E.IS_ISOLATED_VENUE?{backgroundColor:E.IS_QUEUED_VENUE?I.QUEUED_BRAND.accent:E.IS_ABBOTSFORD?'#B89362':E.IS_KIRKTON?'#B46C54':E.IS_GREENSIDE?o?S.GREENSIDE_DISPLAY.primaryPressed:S.GREENSIDE_PALETTE.gold:E.IS_WILDINGS?o?'#E6CC94':'#FFE3A5':E.IS_KIRKMICHAEL?o?'#A66949':'#B87754':o?'#8C5226':'#A4622E',borderWidth:1,borderColor:E.IS_QUEUED_VENUE?I.QUEUED_BRAND.smallTextAccent:E.IS_ABBOTSFORD?'#E5D08D':E.IS_KIRKTON?'#D6A28E':E.IS_GREENSIDE?S.GREENSIDE_PALETTE.goldLight:E.IS_WILDINGS?'#FFF0CF':E.IS_KIRKMICHAEL?'#C2937A':'#C18F67',backgroundImage:'none',boxShadow:'0 4px 12px rgba(0,0,0,0.35)'}:{backgroundColor:o?'#B8904F':'#CFA45F',borderWidth:1,borderColor:'rgba(255,226,170,0.55)',backgroundImage:o?'linear-gradient(180deg, #BE9552 0%, #A88143 100%)':'linear-gradient(180deg, #E0BA77 0%, #C69A55 100%)',boxShadow:o?'0 2px 8px rgba(0,0,0,0.4)':'0 1px 0 rgba(255,255,255,0.28) inset, 0 10px 24px rgba(207,164,95,0.22), 0 4px 10px rgba(0,0,0,0.45)',transition:'box-shadow 120ms ease'},onPrimary:E.IS_QUEUED_VENUE?I.QUEUED_BRAND.onAccent:E.IS_ABBOTSFORD||E.IS_KIRKTON?'#0B0B0B':E.IS_GREENSIDE?'#1A1A1A':E.IS_WILDINGS?'#272A2F':E.IS_KIRKMICHAEL?'#0B0B0B':E.IS_ISOLATED_VENUE?'#FFFFFF':'#17130D',web:b}},937,[5,1233,1204,868,122,1236]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useReservedToday=k,_e.ShellfishTile=function({rid:e,by:t,app:l,big:c,onOrder:h,style:b}){const y=(0,d.useShellfish)(e,t,l),p=k(e),[w,C]=(0,s.useState)(!1),S=x(e,y.items.find(e=>e.supplierId)?.supplierId),L=(0,o.useLiveState)();if('ready'!==L)return(0,f.jsx)(o.LiveWait,{state:L,title:"Lobsters & crabs",testID:"shellfish-wait"});if(!y.items.length)return null;const $=y.items.filter(e=>y.isLow(e.key)),T=y.items.length<=3?y.items.map(e=>e.plural.toUpperCase()).join(' & '):'LIVE STOCK';return(0,f.jsxs)(r.default,{testID:"shellfish-tile",style:[{borderRadius:16,borderWidth:1.5,borderColor:$.length?u.colours.amber:u.colours.border,backgroundColor:u.colours.surface,padding:c?10:12,gap:6},b],children:[(0,f.jsxs)(i.default,{accessibilityRole:"button",accessibilityLabel:`${y.items.map(t=>`${t.plural} ${(0,a.fmtStockCount)(e,t,y.counts[t.key]??0)}`).join(', ')}. Tap to update`,onPress:()=>C(!0),style:{gap:4,flex:c?1:void 0},children:[(0,f.jsxs)(n.Row,{wrap:!0,gap:6,style:{justifyContent:'space-between'},children:[(0,f.jsxs)(n.T,{size:12,weight:"semibold",colour:u.colours.gold,children:["LIVE \xb7 ",T]}),(0,f.jsx)(n.T,{size:12,colour:u.colours.muted,children:"Tap to update \u203a"})]}),(0,f.jsx)(n.Row,{gap:c?14:18,style:{flex:c?1:void 0,alignItems:'center'},children:y.items.map(t=>{const s=y.counts[t.key]??0,o=y.isLow(t.key);return(0,f.jsxs)(r.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,a.speakStockCount)(e,t,s)}`,style:{flex:1,alignItems:'center'},children:[(0,f.jsx)(n.T,{size:c?42:34,weight:"bold",colour:s<=0?u.colours.red:o?u.colours.amber:u.colours.text,style:{lineHeight:c?50:42},children:(0,a.fmtStockCount)(e,t,s)}),(0,f.jsxs)(n.T,{size:13,colour:o?u.colours.amber:u.colours.muted,children:[t.icon," ",t.plural,s<=0?' \xb7 out':o?' \xb7 low':'']}),p[t.key]?(0,f.jsxs)(n.T,{size:12,weight:"semibold",colour:u.colours.goldLight,children:["Reserved: ",(0,a.fmtStockCount)(e,t,p[t.key])," \xb7 free ",(0,a.fmtStockCount)(e,t,Math.max(0,s-p[t.key]))]}):null]},t.key)})})]}),!c&&$.length?(0,f.jsxs)(r.default,{testID:"shellfish-low",style:{backgroundColor:u.colours.amberBg,borderRadius:10,padding:8,gap:6},children:[(0,f.jsxs)(n.T,{size:13,weight:"semibold",colour:"#FFE2A8",children:["Low stock: ",$.map(t=>`${(0,a.fmtStockCount)(e,t,y.counts[t.key]??0)} ${t.plural.toLowerCase()} (warns at ${(0,a.fmtStockCount)(e,t,t.lowAt)})`).join(', ')]}),h?(0,f.jsx)(n.Button,{small:!0,label:S?`Order from ${S} \u203a`:'Order sheets \u203a',testID:"shellfish-order",onPress:h}):null]}):null,c||$.length||!h?null:(0,f.jsx)(i.default,{accessibilityRole:"button",onPress:h,style:{minHeight:44,justifyContent:'center'},children:(0,f.jsx)(n.T,{size:13,colour:u.colours.gold,children:S?`${S} order sheet \u203a`:'Order sheets \u203a'})}),w?(0,f.jsx)(j,{rid:e,by:t,app:l,onClose:()=>C(!1),onOrder:h?()=>{C(!1),h()}:void 0}):null]})},_e.ShellfishStrip=function({rid:e,by:t,app:o,height:c=76}){const h=(0,d.useShellfish)(e,t,o),b=k(e),[y,p]=(0,s.useState)(!1);if(!h.items.length)return null;const x=c>=80,w=Math.max(28,Math.min(52,Math.round(.6*c))),C=Math.max(22,Math.min(34,Math.round(.42*c)));return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(i.default,{testID:"shellfish-tile",accessibilityRole:"button",accessibilityLabel:`${h.items.map(t=>`${t.plural} ${(0,a.fmtStockCount)(e,t,h.counts[t.key]??0)}`).join(', ')}. Tap to update`,onPress:()=>p(!0),style:({pressed:e})=>({flexDirection:'row',alignItems:'stretch',height:c,backgroundColor:e?'#181612':'#100F0D',borderBottomWidth:1,borderBottomColor:'rgba(207,164,95,0.12)',borderTopWidth:1,borderTopColor:'rgba(255,255,255,0.04)',...l.look.web({backgroundImage:'linear-gradient(180deg, rgba(207,164,95,0.07) 0%, rgba(207,164,95,0.015) 100%)',cursor:'pointer'})}),children:h.items.map((t,s)=>{const o=h.counts[t.key]??0,i=b[t.key]??0,d=Math.max(0,o-i),y=d<=0,p=y||h.isLow(t.key);return(0,f.jsxs)(r.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,a.speakStockCount)(e,t,d)}`,style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:x?16:12,borderLeftWidth:s?1:0,borderLeftColor:'rgba(207,164,95,0.16)',backgroundColor:p?'rgba(255,107,94,0.07)':'transparent',...l.look.web(p?{backgroundImage:'linear-gradient(180deg, rgba(255,107,94,0.11) 0%, rgba(255,107,94,0.035) 100%)'}:{})},children:[(0,f.jsx)(n.T,{size:C,children:t.icon}),(0,f.jsx)(n.T,{size:w,weight:"bold",colour:p?'#FF8E82':u.colours.text,style:{lineHeight:Math.round(1.15*w),letterSpacing:-.5,minWidth:Math.round(.85*w),textAlign:'center'},children:(0,a.fmtStockCount)(e,t,d)}),(0,f.jsxs)(r.default,{style:{gap:0},children:[(0,f.jsx)(n.T,{size:x?15:13,weight:"semibold",colour:p?'#FFB3AA':u.colours.goldLight,style:{letterSpacing:2},children:t.plural.toUpperCase()}),p&&c>=60?(0,f.jsx)(n.T,{size:11,weight:"semibold",colour:"#FF8E82",style:{letterSpacing:1.5},children:y?'NONE LEFT':`LOW \xb7 WARNS AT ${(0,a.fmtStockCount)(e,t,t.lowAt)}`}):null,(0,f.jsxs)(n.T,{size:x?14:12,weight:"semibold",colour:i?u.colours.goldLight:'#857D6E',style:{letterSpacing:.5},children:["Reserved: ",(0,a.fmtStockCount)(e,t,i)]})]})]},t.key)})}),y?(0,f.jsx)(j,{rid:e,by:t,app:o,onClose:()=>p(!1)}):null]})},_e.ShellfishPanel=j,_e.ShellfishChip=function({rid:e,by:t,app:o,size:c="m"}){const h=(0,d.useShellfish)(e,t,o),b=k(e),[y,p]=(0,s.useState)(!1);if(!h.items.length)return null;const x='s'===c?17:20;return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(i.default,{testID:"shellfish-tile",accessibilityRole:"button",accessibilityLabel:`${h.items.map(t=>`${t.plural} ${(0,a.fmtStockCount)(e,t,Math.max(0,(h.counts[t.key]??0)-(b[t.key]??0)))} available`).join(', ')}. Tap to update`,onPress:()=>p(!0),style:({pressed:e})=>({flexDirection:'row',alignItems:'center',minHeight:44,borderRadius:14,borderWidth:1,borderColor:'rgba(207,164,95,0.30)',overflow:'hidden',backgroundColor:e?'#1C1913':'rgba(207,164,95,0.06)',...l.look.web({cursor:'pointer'})}),children:h.items.map((t,s)=>{const o=h.counts[t.key]??0,l=b[t.key]??0,i=Math.max(0,o-l),d=i<=0,c=d||h.isLow(t.key);return(0,f.jsxs)(r.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,a.speakStockCount)(e,t,i)}`,style:{flexDirection:'row',alignItems:'center',gap:6,paddingHorizontal:9,paddingVertical:3,borderLeftWidth:s?1:0,borderLeftColor:'rgba(207,164,95,0.18)',backgroundColor:c?'rgba(255,107,94,0.10)':'transparent'},children:[(0,f.jsx)(n.T,{size:x-2,children:t.icon}),(0,f.jsx)(n.T,{size:x,weight:"bold",colour:d?u.colours.red:c?u.colours.amber:u.colours.text,style:{lineHeight:x+4},children:(0,a.fmtStockCount)(e,t,i)}),l||d||c?(0,f.jsx)(n.T,{size:10,weight:"semibold",colour:d||c?'#FFB3AA':u.colours.goldLight,children:d?'none left':l?`${(0,a.fmtStockCount)(e,t,l)} res`:'low'}):null]},t.key)})}),y?(0,f.jsx)(j,{rid:e,by:t,app:o,onClose:()=>p(!1)}):null]})};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),i=e(_r(_d[4])),r=e(_r(_d[5])),n=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),y=_r(_d[13]),f=_r(_d[14]);const p=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'});function k(e){const t=(0,h.useBookings)(e),s=(0,h.useRestaurant)(e),o=(0,y.ymd)((0,h.useNow)(6e4));return(0,b.reservedOn)(t,o,(0,b.reservablesOf)(s))}function x(e,t){const s=(0,c.useSheets)(e);return t?s.find(e=>e.id===t)?.name:void 0}function j({rid:e,by:o,app:l,onClose:i,onOrder:c}){const h=(0,d.useShellfish)(e,o,l),[b,y]=(0,s.useState)({}),[k,j]=(0,s.useState)(null),w=x(e,h.items.find(e=>e.supplierId)?.supplierId),C=(s,o)=>{const l=h.itemOf(s);l&&y(i=>({...i,[s]:(0,t.fishInStone)(e,l)?(0,t.stepQuantity)(e,l,i[s]||0,o):Math.max(0,Math.min(99,(i[s]||0)+o))}))},S=(e,t=!1)=>{const s=h.itemOf(e);h.sell(e,t)&&j(('kg'===s?.unit?`Half a stone ${s.name.toLowerCase()}`:t?`Half ${s?.name.toLowerCase()}`:`1 ${s?.name.toLowerCase()}`)+" sold.")},L=Object.values(b).reduce((e,t)=>e+t,0);return(0,f.jsxs)(n.Sheet,{visible:!0,onClose:i,title:h.items.map(e=>e.plural).join(' & ')||'Tracked stock',maxWidth:620,testID:"shellfish-panel",children:[(0,f.jsx)(n.Row,{gap:10,wrap:!0,style:{alignItems:'stretch'},children:h.items.map(s=>{const o=h.counts[s.key]??0;return(0,f.jsxs)(r.default,{style:{flex:1,minWidth:160,gap:8,padding:10,borderRadius:14,borderWidth:1,borderColor:h.isLow(s.key)?u.colours.amber:u.colours.border,backgroundColor:u.colours.surface2},children:[(0,f.jsxs)(n.T,{center:!0,size:13,colour:u.colours.muted,children:[s.icon," ",s.plural]}),(0,f.jsx)(n.T,{center:!0,size:48,weight:"bold",colour:h.isLow(s.key)?u.colours.amber:u.colours.text,style:{lineHeight:56},children:(0,a.fmtStockCount)(e,s,o)}),(0,f.jsx)(n.Button,{label:(0,t.fishInStone)(e,s)?`Sold half a stone ${s.name.toLowerCase()}`:`Sold 1 ${s.name.toLowerCase()} \u22121`,testID:`sell-${s.key}`,disabled:o<((0,t.fishInStone)(e,s)?t.HALF_STONE_KG:1),onPress:()=>S(s.key),style:{minHeight:56}}),'half'===s.unit?(0,f.jsx)(n.Button,{kind:"secondary",label:"Sold a half \u2212\xbd",testID:`sell-${s.key}-half`,disabled:o<.5,onPress:()=>S(s.key,!0),style:{minHeight:52}}):(0,f.jsx)(r.default,{style:{minHeight:52}})]},s.key)})}),(0,f.jsx)(n.Button,{kind:"ghost",label:h.undoable?`\u21b6 Undo: ${(0,a.describe)(h.undoable,h.itemOf(h.undoable.kind))}`:'\u21b6 Nothing to undo',testID:"shellfish-undo",disabled:!h.undoable,onPress:()=>{const e=h.undoable;h.undoLast(),e&&j(`Undone: ${(0,a.describe)(e,h.itemOf(e.kind))}.`)}}),k?(0,f.jsx)(n.Banner,{kind:"success",title:k}):null,(0,f.jsxs)(r.default,{testID:"delivery-in",style:{gap:8,padding:10,borderRadius:14,borderWidth:1,borderColor:u.colours.gold,backgroundColor:u.colours.goldTint},children:[(0,f.jsx)(n.T,{weight:"semibold",colour:u.colours.goldLight,children:"Delivery in"}),h.items.map(s=>(0,f.jsxs)(n.Row,{gap:10,children:[(0,f.jsxs)(n.T,{style:{flex:1},children:[s.icon," ",s.plural]}),(0,f.jsx)(n.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:`${(0,t.fishInStone)(e,s)?'Half a stone less':'Fewer'} ${s.plural.toLowerCase()} in`,onPress:()=>C(s.key,-1),style:{minWidth:48,minHeight:48}}),(0,f.jsx)(n.T,{size:24,weight:"bold",style:{minWidth:76,textAlign:'center'},children:(0,a.fmtStockCount)(e,s,b[s.key]||0)}),(0,f.jsx)(n.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:`${(0,t.fishInStone)(e,s)?'Half a stone more':'More'} ${s.plural.toLowerCase()} in`,testID:`in-plus-${s.key}`,onPress:()=>C(s.key,1),style:{minWidth:48,minHeight:48}}),(0,t.fishInStone)(e,s)?null:(0,f.jsx)(n.Button,{small:!0,kind:"ghost",label:"Add five",onPress:()=>C(s.key,5)})]},s.key)),(0,f.jsx)(n.Button,{kind:"success",label:L?`Add to stock: ${h.items.filter(e=>b[e.key]).map(t=>`${(0,a.fmtStockCount)(e,t,b[t.key])} ${(1===b[t.key]?t.name:t.plural).toLowerCase()}`).join(' and ')}`:'Add to stock',testID:"delivery-add",disabled:!L,onPress:()=>{h.items.forEach(e=>h.deliver(e.key,b[e.key]??0)),j('Delivery added to the count.'),y({})},style:{minHeight:54}})]}),c?(0,f.jsx)(n.Button,{kind:"secondary",label:w?`${w} order sheet \u203a`:'Order sheets \u203a',onPress:c}):null,(0,f.jsxs)(r.default,{style:{gap:2},children:[(0,f.jsx)(n.T,{size:12,weight:"semibold",colour:u.colours.gold,children:"RECENT"}),h.events.slice(0,6).map(e=>(0,f.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(n.T,{size:13,style:{flex:1},children:(0,a.describe)(e,h.itemOf(e.kind))}),(0,f.jsxs)(n.Muted,{children:[p(e.at)," \xb7 ",e.by.replace(' (example)','')]})]},e.id))]}),(0,f.jsx)(n.Row,{wrap:!0,gap:6,children:h.synced?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(n.Badge,{kind:"ok",label:"Shared live"}),(0,f.jsx)(n.Muted,{children:"Every paired device sees the same count."})]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(n.Badge,{kind:"neutral",label:"Saved on this device"}),(0,f.jsx)(n.Muted,{children:"Not connected to the shared venue yet."})]})})]})}},938,[1026,30,1232,937,263,127,813,1029,1027,1028,821,819,828,818,24]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AllergyChain=j,_e.BookingAllergyChain=function({b:l,me:s,readOnly:k}){const p=(0,i.useOrders)(l.restaurantId),A=(0,n.useStore)(e=>e.ackBookingAllergy);if(!l.allergies.length)return null;const S=p.find(e=>e.allergies.length&&!['cancelled','closed'].includes(e.status)&&(e.bookingId===l.id||!e.bookingId&&(0,c.linkedBooking)(e,[l])?.id===l.id));if(S)return(0,h.jsx)(j,{o:S,me:s,readOnly:k,compact:!0});const w={booked:l.allergyAck,ordered:void 0,kitchen:void 0,pass:void 0,table:void 0};return(0,h.jsxs)(t.default,{testID:`allergy-chain-${l.ref}`,style:{gap:6,padding:8,borderRadius:10,borderWidth:1,borderColor:l.allergyAck?u.colours.border:u.colours.red,backgroundColor:(0,e.soutersSurface)('#140f0e')},children:[(0,h.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsxs)(o.T,{size:13,weight:"semibold",colour:"#FFD9D4",children:["Allergen sign-off \xb7 ",l.ref]}),(0,h.jsx)(o.Badge,{kind:l.allergyAck?'amber':'red',label:(l.allergyAck?1:0)+" of 5"})]}),(0,h.jsx)(y,{chain:w,next:l.allergyAck?null:'booked',testID:`allergy-steps-${l.ref}`}),l.allergyAck?(0,h.jsxs)(o.Row,{gap:6,children:[(0,h.jsx)(f.StaffAvatar,{name:l.allergyAck.by,size:20,ring:!1}),(0,h.jsxs)(o.Muted,{style:{flex:1},children:["1. Booked: ",x(l.allergyAck.by)," at ",b(l.allergyAck.at),". Steps 2 to 5 are signed on the table's order."]})]}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(o.T,{size:13,children:"Next: 1. Booked. Allergy recorded (who took it)."}),k?null:(0,h.jsxs)(o.Row,{wrap:!0,gap:8,children:[(0,h.jsx)(o.Button,{small:!0,kind:"danger",label:"Sign off",testID:`sign-off-${l.ref}`,accessibilityLabel:`Sign off Booked on ${l.ref}`,disabled:!s.trim(),onPress:()=>A(l.id,s)}),(0,h.jsxs)(o.Muted,{children:["as ",x(s)]})]})]})]})};var e=r(d[0]);r(d[1]);var l,s=r(d[2]),t=(l=s)&&l.__esModule?l:{default:l},o=r(d[3]),i=r(d[4]),n=r(d[5]),c=r(d[6]),u=r(d[7]),f=r(d[8]),h=r(d[9]);const b=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}),x=e=>e.replace(' (example)','');function y({chain:e,next:l,testID:s}){return(0,h.jsx)(t.default,{testID:s,accessibilityLabel:`Allergen sign-off ${c.CHAIN_STEPS.filter(l=>e[l.id]).length} of 5`,style:{flexDirection:'row',alignItems:'flex-start'},children:c.CHAIN_STEPS.map((s,i)=>{const n=!!e[s.id],c=l===s.id,f=n?u.colours.ok:c?u.colours.gold:u.colours.border;return(0,h.jsxs)(t.default,{style:{flex:1,alignItems:'center'},children:[(0,h.jsxs)(t.default,{style:{flexDirection:'row',alignItems:'center',width:'100%'},children:[(0,h.jsx)(t.default,{style:{flex:1,height:2,backgroundColor:i?n||c?f:u.colours.border:'transparent'}}),(0,h.jsx)(t.default,{style:{width:26,height:26,borderRadius:13,borderWidth:2,borderColor:f,backgroundColor:n?u.colours.ok:'transparent',alignItems:'center',justifyContent:'center'},children:(0,h.jsx)(o.T,{size:12,weight:"bold",colour:n?'#0B0B0B':c?u.colours.gold:u.colours.muted,children:n?'\u2713':String(s.n)})}),(0,h.jsx)(t.default,{style:{flex:1,height:2,backgroundColor:i<4?n?u.colours.ok:u.colours.border:'transparent'}})]}),(0,h.jsx)(o.T,{size:11,weight:c?'semibold':'regular',colour:n?u.colours.text:c?u.colours.gold:u.colours.muted,center:!0,children:s.label}),e[s.id]?(0,h.jsxs)(o.T,{size:10,colour:u.colours.muted,center:!0,numberOfLines:2,children:[x(e[s.id].by).split(' ')[0]," ",b(e[s.id].at)]}):null]},s.id)})})}function j({o:l,me:s,readOnly:j,compact:k}){const p=(0,i.useBookings)(l.restaurantId),A=(0,n.useStore)(e=>e.signAllergyStep);if(!l.allergies.length)return null;const S=(0,c.linkedBooking)(l,p),w=(0,c.orderChain)(l,S),I=(0,c.nextStep)(l,S),C=c.CHAIN_STEPS.filter(e=>w[e.id]).length,B=I?(0,c.stepInfo)(I):null,D='table'===I&&!['ready','served','collected'].includes(l.status);return(0,h.jsxs)(t.default,{testID:`allergy-chain-${l.ref}`,style:{gap:6,padding:8,borderRadius:10,borderWidth:1,borderColor:I?u.colours.red:u.colours.ok,backgroundColor:(0,e.soutersSurface)('#140f0e')},children:[(0,h.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsxs)(o.T,{size:13,weight:"semibold",colour:I?'#FFD9D4':'#E2C489',children:["Allergen sign-off \xb7 ",l.ref]}),(0,h.jsx)(o.Badge,{kind:I?'red':'ok',label:I?`${C} of 5`:'Complete'})]}),(0,h.jsx)(y,{chain:w,next:I,testID:`allergy-steps-${l.ref}`}),k?null:c.CHAIN_STEPS.filter(e=>w[e.id]).map(e=>(0,h.jsxs)(o.Row,{gap:6,children:[(0,h.jsx)(f.StaffAvatar,{name:w[e.id].by,size:20,ring:!1}),(0,h.jsxs)(o.Muted,{style:{flex:1},children:[e.n,". ",e.label,": ",x(w[e.id].by)," at ",b(w[e.id].at)]})]},e.id)),B?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(o.T,{size:13,children:["Next: ",B.n,". ",B.label,". ",B.what,"."]}),j?null:(0,h.jsxs)(o.Row,{wrap:!0,gap:8,children:[(0,h.jsx)(o.Button,{small:!0,kind:"danger",label:"Sign off",testID:`sign-off-${l.ref}`,accessibilityLabel:`Sign off ${B.label} on ${l.ref}`,disabled:!s.trim()||D,onPress:()=>A(l.id,I,s)}),(0,h.jsxs)(o.Muted,{children:["as ",x(s)]})]}),D?(0,h.jsx)(o.Muted,{children:"Signed off at the pass. The table step is signed when the dish is served."}):(0,h.jsx)(o.Muted,{children:"The ticket can't move on until this step is signed off."})]}):(0,h.jsx)(o.Muted,{children:"All five steps signed off. The full chain is in the allergen audit log."})]})}},939,[868,30,127,813,1022,872,940,821,953,24]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CHAIN_STEPS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"stepInfo",{enumerable:!0,get:function(){return t}}),e.linkedBooking=l,e.orderChain=o,e.nextStep=s,Object.defineProperty(e,"doneCount",{enumerable:!0,get:function(){return c}}),e.canSign=function(n,t,l){return s(n,l)===t},e.statusBlock=function(n,l,s){if(!n.allergies.length||'cancelled'===l)return null;const c=o(n,s),u=n=>c[n]?null:`${t(n).n}. ${t(n).label} needs signing off first`;return'acknowledged'===l||'preparing'===l||'ready'===l?u('booked')??u('ordered')??u('kitchen'):'served'===l?u('booked')??u('ordered')??u('kitchen')??u('pass'):'collected'===l||'closed'===l?u('booked')??u('ordered')??u('kitchen')??u('pass')??u('table'):null},e.chainNeedsAction=function(n,t){const o=s(n,l(n,t));return!(!o||'table'===o&&!['ready','served'].includes(n.status))},e.bookingNeedsAction=function(n,t){return n.allergies.length>0&&!n.allergyAck&&!t.some(t=>t.allergies.length&&l(t,[n])?.id===n.id)};const n=[{id:'booked',n:1,label:'Booked',what:'Allergy recorded (who took it)'},{id:'ordered',n:2,label:'Ordered',what:'Server confirms with the guest'},{id:'kitchen',n:3,label:'Kitchen',what:'Chef signs off before cooking'},{id:'pass',n:4,label:'Pass',what:'Checked before it leaves the pass'},{id:'table',n:5,label:'Table',what:'Server signs off when served'}],t=t=>n.find(n=>n.id===t);function l(n,t){return n.bookingId?t.find(t=>t.id===n.bookingId):'table'===n.type&&n.tableNo?t.find(t=>t.restaurantId===n.restaurantId&&'seated'===t.status&&!!t.table&&t.table.split('+').includes(String(n.tableNo))):void 0}function o(n,t){return{booked:n.allergyChain?.booked??(t?.allergies.length?t.allergyAck:void 0),ordered:n.allergyChain?.ordered,kitchen:n.allergyAck,pass:n.allergyChain?.pass,table:n.handoverCheck}}function s(t,l){if(!t.allergies.length)return null;const s=o(t,l);return n.find(n=>!s[n.id])?.id??null}const c=(t,l)=>{const s=o(t,l);return n.filter(n=>s[n.id]).length}},940,[]); +__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.queuedSessions=o,e.queuedRequestSlots=u,e.queuedRequestError=function(t,o,s,a=new Date){if(o.name.trim().length<2||o.name.trim().length>100||!/^[0-9 +()\-]{7,30}$/.test(o.phone)||!/^[0-9]{7,15}$/.test(o.phone.replace(/\D/g,''))||o.email.length>254||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(o.email))return'Enter your name, phone number and email.';if(o.notes.length>2e3)return'Keep notes under 2000 characters.';const c=(0,n.localDate)(a),d=(0,n.localDate)(new Date(+a+63072e6));if(!o.date||o.dated||!u(t,o.date,s).includes(o.time||''))return'Choose a future date and a time within confirmed kitchen service hours.';const l=new Intl.DateTimeFormat('en-GB',{timeZone:'Europe/London',hour:'2-digit',minute:'2-digit',hour12:!1}).format(a);return o.date===c&&(o.time||'')<=l?'Choose a future time.':!Number.isInteger(o.covers)||o.covers<1||o.covers>200?'Enter 1 to 200 Covers.':''};var t=r(_d[0]),n=r(_d[1]);function o(n){const o=t.queuedVenues[n];return o?.kitchenSessionsByDay??o?.hours.sessionsByDay??void 0}const s=t=>60*+t.slice(0,2)+ +t.slice(3);function u(n,u,a){if(!/^\d{4}-\d{2}-\d{2}$/.test(u))return[];const c=new Date(u+'T12:00:00Z');if(!Number.isFinite(+c)||c.toISOString().slice(0,10)!==u)return[];const d=(a??o(n))?.[c.getUTCDay()];if(!Array.isArray(d))return[];const l=[],f=t.queuedVenues[n]?.booking.lastSittingMinutesBeforeClose??0;for(const t of d){if(!Array.isArray(t)||2!==t.length||!t.every(t=>'string'==typeof t&&/^([01]\d|2[0-3]):[0-5]\d$/.test(t)))continue;const n=s(t[0]),o=s(t[1]);if(!(n>=o))for(let t=n;te.id===t)?.uses??[],r=O(e),i=c.useStore.getState().menu.find(e=>e.id===t)?.name??'';return(0,u.dishReason)(i,(0,u.shortOf)(s,r),r,b(e))},_e.runAutoSoldOut=y,_e.startAutoSoldOut=function(){if(w)return w;let e=null;const t=()=>{e||(e=setTimeout(()=>{e=null,y()},400))},n=[d.useShellStore.subscribe((e,n)=>{e.events===n.events&&e.server===n.server&&e.items===n.items||t()}),h.subscribe(t),S.useCardStore.subscribe((e,n)=>{e.cards!==n.cards&&t()}),c.useStore.subscribe((e,n)=>{e.menu===n.menu&&e.restaurants===n.restaurants||t()}),f.useSoldOut.subscribe((e,n)=>{e.entries!==n.entries&&t()})],s=setInterval(t,6e4);return t(),w=()=>{n.forEach(e=>e()),clearInterval(s),e&&clearTimeout(e),w=null},w},_e.useAutoSoldOutView=function(e){const t=(0,c.useStore)(e=>e.menu),n=h(e=>e.links),s=(0,S.useCardStore)(e=>e.cards),r=(0,d.useShellStore)(t=>t.items[e]);(0,d.useShellStore)(e=>e.events),(0,d.useShellStore)(t=>t.server[e]);const i=(r??[]).filter(e=>e.active).map(e=>({key:e.key,name:e.name,plural:e.plural,unit:e.unit,active:e.active})),o=p(e,t,n,s,i),l=O(e);return{dishes:o,counts:l,items:i,reason:e=>{const t=o.find(t=>t.id===e);return t?(0,u.dishReason)(t.name,(0,u.shortOf)(t.uses,l),l,i):''},links:n}};var e,t=_r(_d[0]),n=(e=t)&&e.__esModule?e:{default:e},s=_r(_d[1]),r=_r(_d[2]),u=_r(_d[3]),i=_r(_d[4]),o=_r(_d[5]),l=_r(_d[6]),c=_r(_d[7]),d=_r(_d[8]),S=_r(_d[9]),f=_r(_d[10]);const m=()=>{try{return(0,c.nowFrom)(c.useStore.getState().clock)}catch{return new Date}},h=(0,s.create)()((0,r.persist)(e=>({links:[],setLink:(t,n,s,r)=>e(e=>{const u=e.links.filter(e=>!(e.rid===t&&e.itemId===n));return{links:[...u,{rid:t,itemId:n,uses:s?s.filter(e=>e.qty>0).slice(0,10):[],at:m().toISOString(),by:r.slice(0,80),...s?{}:{auto:!0}}]}})}),{name:'covercharge-soldout-links-v1',version:1,storage:(0,r.createJSONStorage)(()=>n.default)})),k=e=>!!e&&!0===e.auto,v={soldOutRead:new Set,linksRead:new Set};function b(e){return(d.useShellStore.getState().items[e]??[]).filter(e=>e.active).map(e=>({key:e.key,name:e.name,plural:e.plural,unit:e.unit,active:e.active}))}function p(e,t=c.useStore.getState().menu,n=h.getState().links,s=S.useCardStore.getState().cards,r=b(e)){const i=[];for(const o of t){if(o.restaurantId!==e||o.hidden)continue;const t=s.find(t=>t.restaurantId===e&&t.menuItemId===o.id),l=n.find(t=>t.rid===e&&t.itemId===o.id),c=(0,u.inferUses)(o,t,r),d=k(l)?c:(0,u.usesFor)(o,l,t,r);i.push({id:o.id,name:o.name,uses:d.uses,source:d.source,guess:c.uses})}return i}function O(e){return(0,d.venueCounts)(d.useShellStore.getState(),e)}function I(e){const t={};for(const n of d.useShellStore.getState().events)n.rid===e&&(!t[n.kind]||n.at>t[n.kind])&&(t[n.kind]=n.at);return t}function y(e=m()){const t=c.useStore.getState();let n=0;for(const s of t.restaurants){const t=s.id;if((0,o.liveData)()&&(!d.useShellStore.getState().server[t]||!v.soldOutRead.has(t)||!v.linksRead.has(t)))continue;const r=(0,i.soldOutSettingsOf)(s.settings?.soldOut).auto,l=p(t),c=(0,u.planAuto)({rid:t,enabled:r,dishes:l,counts:O(t),entries:f.useSoldOut.getState().entries,lastChange:I(t),now:e});if(!c.mark.length&&!c.clear.length)continue;const S=e.toISOString();f.useSoldOut.setState(e=>{const n=new Set(c.clear),s=new Map(c.mark.map(e=>[e.itemId,e.name])),r=e.entries.filter(e=>!(e.rid===t&&s.has(e.itemId))).map(e=>e.rid===t&&n.has(e.itemId)?{...e,on:!1,at:S,by:'Count back up',kept:!1,clearAfter:void 0}:e);return{entries:[...r,...c.mark.map(e=>({rid:t,itemId:e.itemId,name:e.name.slice(0,120),on:!0,at:S,by:'Live count',auto:!0,kept:!1}))]}}),n+=c.mark.length+c.clear.length}return n}let w=null;l.PITCH&&'undefined'!=typeof globalThis&&(globalThis.__pitchCounts=e=>{const t=c.useStore.getState().restaurants[0]?.id;if(!t)return;const n=O(t),s=m().toISOString(),r=Object.entries(e).filter(([e,t])=>(n[e]??0)!==t).map(([e,r],u)=>({id:`pitch-count-${Date.now()}-${u}`,rid:t,kind:e,delta:r-(n[e]??0),reason:'count',by:'Chef',app:'chef',at:s}));return r.length&&d.useShellStore.setState(e=>({events:[...e.events,...r]})),y()})},942,[1116,952,1117,943,944,1119,2,872,1027,1094,918]); +__d(function(_g,r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.parseQty=i,_e.inferUses=u,_e.usesFor=function(e,t,n,o){const s=new Set(o.filter(e=>!1!==e.active).map(e=>e.key));return t?{uses:t.uses.filter(e=>s.has(e.key)&&e.qty>0),source:t.uses.length?'link':'none'}:u(e,n,o)},_e.shortOf=c,_e.shortReason=f,_e.dishReason=function(e,t,n,o){if(!t.length)return'';const i=e.replace(/\([^)]*\)/g,'').trim(),a=e=>{const t=o.find(t=>t.key===e);return!!t&&new RegExp(`\\b(${s(t)})$`,'i').test(i)},l=t.filter(e=>!a(e.key));return l.length?f(l,n,o):t.some(e=>(n[e.key]??0)>0)?'not enough left':'none left'},Object.defineProperty(_e,"withReason",{enumerable:!0,get:function(){return h}}),_e.usesText=function(e,t){return e.length?e.map(e=>{const n=t.find(t=>t.key===e.key),o=(n?.name??e.key).toLowerCase(),s=(n?.plural??`${o}s`).toLowerCase();return`${.5===e.qty?'\xbd':Number.isInteger(e.qty)?String(e.qty):`${Math.floor(e.qty)}\xbd`} ${e.qty>1?s:o}`}).join(', '):'Not linked to the counts'},_e.planAuto=function(e){const{rid:t,enabled:n,dishes:o,counts:s,entries:i,lastChange:a,now:l}=e,u={mark:[],clear:[]},f=new Map(i.filter(e=>e.rid===t).map(e=>[e.itemId,e])),h=l.getTime(),m=e=>e.on&&(!e.clearAfter||new Date(e.clearAfter).getTime()>h),d=new Set;for(const e of o){d.add(e.id);const t=f.get(e.id),o=n?c(e.uses,s):[];if(o.length){if(t&&m(t))continue;if(t&&t.kept){const e=o.map(e=>a[e.key]??'').sort().pop()??'';if(!e||e<=t.at)continue}u.mark.push({itemId:e.id,name:e.name})}else t&&t.auto&&m(t)&&u.clear.push(e.id)}for(const e of f.values())e.auto&&m(e)&&!d.has(e.itemId)&&u.clear.push(e.itemId);return u};const e='meat|bisque|stock|cakes?|claws?|sauce|butter|oil|paste|salad|mayo|mayonnaise|thermidor|tails?|bon|croquettes?|p\xe2t\xe9|pate|rolls?|soup|linguine|ravioli',t=/^(g|kg|gram|grams|ml|l|litre|litres|oz|lb|lbs|cl)$/i,n={a:1,an:1,one:1,two:2,three:3,four:4,five:5,six:6,half:.5,'\xbd':.5},o=e=>e.replace(/[.*+?^${}()|[\]\\]/g,'\\$&'),s=e=>{const t=new Set([e.name,e.plural].map(e=>e.trim().toLowerCase()).filter(Boolean));for(const e of[...t])e.endsWith('s')?t.add(e.slice(0,-1)):t.add(e+'s');return[...t].sort((e,t)=>t.length-e.length).map(o).join('|')};function i(e){const t=(e||'').trim().toLowerCase();if(!t)return 1;if(/^\xbd$|^half\b/.test(t))return.5;const o=t.match(/^(\d+(?:\.\d+)?)\s*(\xbd)?/);if(o)return Number(o[1])+(o[2]?.5:0);const s=t.split(/\s+/)[0];return n[s]??1}const a=(e,t)=>'half'===e.unit?Math.max(.5,Math.round(2*t)/2):Math.max(1,Math.round(t)),l=e=>(e.optionGroups??[]).some(e=>e.choices.some(e=>/\bhalf\b/i.test(e.label)));function u(n,o,u){const c=u.filter(e=>!1!==e.active&&'kg'!==e.unit),f=(e,t)=>({source:e,uses:t.map(t=>{const o=c.find(e=>e.key===t.key),s='half'===o.unit&&l(n)&&'description'!==e?.5:t.qty;return{key:t.key,qty:a(o,s)}})});if(o){const e=[];for(const n of c){const a=new RegExp(`\\b(${s(n)})\\b`,'i'),l=o.ingredients.find(e=>a.test(e.name)&&!t.test((e.unit||'').trim())&&!/\b(meat|stock|bisque|oil|butter|paste)\b/i.test(e.name));l&&e.push({key:n.key,qty:i(`${l.qty} ${l.unit}`)})}if(e.length)return f('card',e)}const h=n.description??'';{const t=[];for(const n of c){const o=new RegExp(`\\b(half an?|a|an|one|two|three|four|five|six|\\d+(?:\\.\\d+)?|\xbd)\\s+(?:(?:whole|fresh|live|dressed|local)\\s+)?(?:[A-Za-z'\u2019-]+\\s+){0,2}?(${s(n)})\\b(?!\\s+(?:${e}))`,'i'),a=h.match(o);a&&t.push({key:n.key,qty:i(a[1])})}if(t.length)return f('description',t)}{const e=n.name.replace(/\([^)]*\)/g,'').trim(),t=[];for(const n of c)new RegExp(`\\b(${s(n)})$`,'i').test(e)&&t.push({key:n.key,qty:1});if(t.length)return f('name',t)}return{uses:[],source:'none'}}function c(e,t){return e.filter(e=>(t[e.key]??0)(n.find(t=>t.key===e)?.name??e).toLowerCase(),s=e.filter(e=>(t[e.key]??0)<=0).map(e=>o(e.key)),i=e.filter(e=>(t[e.key]??0)>0).map(e=>o(e.key)),a=e=>e.length<=2?e.join(' or '):`${e.slice(0,-1).join(', ')} or ${e[e.length-1]}`;return[s.length?`no ${a(s)}`:'',i.length?`not enough ${a(i)}`:''].filter(Boolean).join(', ')}const h=(e,t)=>t?`${e.replace(/\s*\([^)]*\)\s*$/,'').trim()||e} (${t})`:e},943,[]); +__d(function(g,r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEFAULT_SOLD_OUT",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"SOLD_OUT_CLEAR_LABEL",{enumerable:!0,get:function(){return t}}),_e.soldOutSettingsOf=function(t){const n='morning'===t?.clear||'manual'===t?.clear||'close'===t?.clear?t.clear:e.clear,o=/^([01]\d|2[0-3]):[0-5]\d$/.test(t?.morningAt??'')?t.morningAt:e.morningAt;return{clear:n,morningAt:o,auto:!1!==t?.auto}},_e.clearAfterFor=function(e,t,o){if('manual'===t.clear)return;const c=(()=>{const o=n(e,t.morningAt);return ee.getTime()?o:c},_e.activeSoldOut=function(e,t,n){const o=n.getTime();return e.filter(e=>e.rid===t&&e.on&&(!e.clearAfter||new Date(e.clearAfter).getTime()>o)).sort((e,t)=>t.at.localeCompare(e.at)||e.name.localeCompare(t.name))},_e.expiredSoldOut=function(e,t,n){const o=n.getTime();return e.filter(e=>e.rid===t&&e.on&&!!e.clearAfter&&new Date(e.clearAfter).getTime()<=o)},_e.stripText=o,_e.stripNeedsTicker=function(e,t,n){return o(e).length*n*.56>Math.max(0,t-150)},_e.soldOutCount=function(e){return 1===e?'1 dish sold out':`${e} dishes sold out`};const e={clear:'close',morningAt:'05:00',auto:!0},t={close:'When the kitchen closes',morning:'Next morning',manual:'Only when someone taps Back on'};const n=(e,t,n=0)=>{const[o,c]=t.split(':').map(Number);return new Date(e.getFullYear(),e.getMonth(),e.getDate()+n,o,c,0,0)};function o(e){return e.join(' \xb7 ')}},944,[]); +__d(function(_g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"SHAPES",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"shapeLabel",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"tableLabel",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"tableNumber",{enumerable:!0,get:function(){return u}}),_e.numberClashes=function(e){const t=new Map;for(const n of e){const e=u(n);t.set(e,[...t.get(e)??[],{name:n.name,areaId:n.areaId}])}const n=new Set,r=[];for(const[e,a]of t){if(a.length<2)continue;const t=new Map;a.forEach(e=>t.set(e.areaId,[...t.get(e.areaId)??[],e.name]));for(const e of t.values())e.length>1&&e.forEach(e=>n.add(e));t.size>1&&r.push(e)}return{sameArea:n,acrossAreas:r}},Object.defineProperty(_e,"liveTableLabel",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"FIXTURES",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"PLAN_W",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"PLAN_H",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"GRID",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"snap",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"clamp",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"fid",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"slug",{enumerable:!0,get:function(){return w}}),_e.sizeFor=y,Object.defineProperty(_e,"minFor",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"numOf",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"byNumber",{enumerable:!0,get:function(){return P}}),_e.newTable=j,_e.autoArrange=M,_e.placeNew=S,_e.rotate90=function(e){const t=e.x+e.w/2,n=e.y+e.h/2;return{...e,w:e.h,h:e.w,x:h(f(t-e.h/2),0,c-e.h),y:h(f(n-e.w/2),0,b-e.w)}},_e.normalisePlan=function(e){return{...e,fixtures:e.fixtures??[],tables:e.tables.map(e=>{const t=e.shape;let n='booth'===t||'rect'===t?'rect':'round'===t?'round':'square',{w:r,h:a}=e;if('square'===n||'round'===n){const e=Math.max(r,a);r=e,a=e}if(90===e.rot||270===e.rot){const e=r;r=a,a=e}return'rect'===n&&r===a&&(n='square'),{...e,shape:n,w:r,h:a,rot:0}})}},Object.defineProperty(_e,"SECTION_COLOURS",{enumerable:!0,get:function(){return I}}),_e.buildPlan=k,_e.anchoragePlan=$,_e.starterPlan=function(){return k({areas:[{name:'Main room',tables:[[1,2],[2,4],[3,6],[4,4],[5,2],[6,6]],fixtures:[A(450,600)]}]},['SV'])},Object.defineProperty(_e,"TEMPLATES",{enumerable:!0,get:function(){return v}}),_e.parseTableList=function(e){const t=[],n=[];let r;for(const a of e.split(/\r?\n/)){const e=a.trim();if(!e)continue;if(!/\d/.test(e)){r=e.replace(/[:\-\u2013]+$/,'').trim()||r;continue}const o=e.match(/^(?:table|tbl|tab|t)?\s*(?:no\.?|number|#)?\s*([a-z]?\d+[a-z]?)\b[^\d]*?(\d+)/i);if(!o){n.push(e);continue}const s=parseInt(o[2],10);!s||s>30?n.push(e):t.push({area:r,name:o[1].toUpperCase(),seats:s})}return{items:t,skipped:n}},Object.defineProperty(_e,"planCounts",{enumerable:!0,get:function(){return C}}),Object.defineProperty(_e,"tableDogOk",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e,"dogTables",{enumerable:!0,get:function(){return L}}),Object.defineProperty(_e,"areaOfTable",{enumerable:!0,get:function(){return q}}),_e.bestTables=E,Object.defineProperty(_e,"isBestTable",{enumerable:!0,get:function(){return _}}),_e.withSeedBest=function(e,t){if('anchorage'!==e||!t?.areas?.some(e=>void 0===e.best))return t;const n=$();return{...t,areas:t.areas.map(e=>{if(void 0!==e.best)return e;const r=n.areas.find(t=>t.id===e.id||t.name===e.name),a=(r?.best??[]).filter(n=>t.tables.some(t=>t.name===n&&t.areaId===e.id));return a.length?{...e,best:a}:e})}};var e,t=_r(d[0]),n=_r(d[1]),r=(e=n)&&e.__esModule?e:{default:e};const a=[{id:'square',label:'Square'},{id:'rect',label:'Rectangle'},{id:'round',label:'Round'}],o=e=>'rect'===e?'Rectangle':'round'===e?'Round':'Square',s=e=>/\d/.test(e.name)?(0,t.plainTableNumber)(e.name):(0,t.plainTableNumber)(e.label?.trim()||e.name),u=s;const l=(e,t)=>u(e),i=[{id:'bar',label:'Bar',w:300,h:50},{id:'wall',label:'Wall',w:250,h:25},{id:'door',label:'Door',w:100,h:25},{id:'window',label:'Window',w:200,h:25}],c=1e3,b=625,m=25,f=e=>Math.round(e/m)*m,h=(e,t,n)=>Math.max(t,Math.min(n,e));let p=0;const g=e=>`${e}-${Date.now().toString(36)}${(p++).toString(36)}`,w=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,'-').replace(/^-|-$/g,'')||'area';function y(e){return e<=2?{shape:'square',w:75,h:75}:e<=4?{shape:'square',w:100,h:100}:e<=6?{shape:'rect',w:150,h:100}:e<=8?{shape:'rect',w:200,h:100}:e<=10?{shape:'rect',w:250,h:100}:{shape:'rect',w:300,h:100}}const x=e=>e<=2?1:Math.max(2,Math.ceil(e/2)),O=e=>{const t=e.match(/\d+/);return t?parseInt(t[0],10):9999},P=(e,t)=>O(e.name)-O(t.name)||e.name.localeCompare(t.name);function j(e,t,n,r){const a=y(n);return{id:`t-${e}-${g('x').slice(2)}`,name:e,areaId:t,shape:a.shape,minSeats:x(n),maxSeats:n,x:0,y:0,w:a.w,h:a.h,rot:0,online:!0,sectionId:r}}function M(e,t=125,n=75){const r=[...e].sort(P);if(!r.length)return r;let a=75;const o=e=>{const t=[];let n=[],a=0;for(const o of r){const r=(n.length?e:0)+o.w;n.length&&a+r>850&&(t.push(n),n=[],a=0),n.push(o),a+=(n.length>1?e:0)+o.w}return n.length&&t.push(n),t};let s=o(a);const u=(e,t)=>e.reduce((e,t)=>e+Math.max(...t.map(e=>e.h)),0)+t*(e.length-1);for(;u(s,a)>b-t-n&&a>25;)a-=25,s=o(a);const l=u(s,a),i=b-t-n,p=s.length>1?Math.min(150,a+Math.max(0,Math.floor((i-l)/(s.length-1)/m)*m)):0,g=s.reduce((e,t)=>e+Math.max(...t.map(e=>e.h)),0)+p*(s.length-1);let w=f(t+Math.max(0,(i-g)/2));const y=[];for(const e of s){const t=Math.max(...e.map(e=>e.h)),n=e.reduce((e,t)=>e+t.w,0)+a*(e.length-1);let r=f((c-n)/2);for(const n of e)y.push({...n,x:h(r,0,c-n.w),y:h(f(w+(t-n.h)/2),0,b-n.h),rot:0}),r+=n.w+a;w+=t+p}return y}function S(e,t,n=[]){const r=[...e,...n].map(e=>({x:e.x,y:e.y,w:e.w,h:e.h})),a=[];for(const e of t){let t=null;for(let n=50;n<=b-e.h-25&&!t;n+=m)for(let a=50;a<=c-e.w-25&&!t;a+=m){const o=50;r.some(t=>at.x&&nt.y)||(t={x:a,y:n})}const n=t??{x:50,y:50},o={...e,x:n.x,y:n.y};r.push({x:o.x,y:o.y,w:o.w,h:o.h}),a.push(o)}return a}const I=['#CFA45F','#E2C489','#A88B5A','#8C6A3A','#FFB547','#D9B98A'];function k(e,t=[]){const n=[],r=[],a=[],o=[];e.areas.forEach((e,s)=>{const u=w(e.name),l=e.best?e.best.map(String).filter(t=>e.tables.some(([e])=>String(e)===t)):void 0;n.push({id:u,name:e.name,dogs:!!e.dogs,outdoor:!!e.outdoor,...e.label?{label:e.label}:{},...e.colour?{colour:e.colour}:{},...l?{best:l}:{}});const i=`s-${u}`;o.push({id:i,name:e.name,colour:e.colour??I[s%I.length],server:t[s]??''});const m=(e.fixtures??[]).map((e,t)=>({...e,id:`fx-${u}-${t}`,areaId:u}));a.push(...m);const f=m.some(e=>e.y<100&&('bar'===e.kind||e.w>=300))?150:100,p=e.tables.map(([e,t])=>({...j(String(e),u,t,i),id:`t-${e}`})),g=e.layout??{},y=p.filter(e=>g[e.name]).map(e=>{const t=g[e.name],n=t.shape??(t.w===t.h?'square':'rect'),r=h(Math.round(t.w),50,c),a=h(Math.round('rect'===n?t.h:t.w),50,b);return{...e,shape:n,w:r,h:a,x:h(Math.round(t.x),0,c-r),y:h(Math.round(t.y),0,b-a),...t.label?{label:t.label}:{}}}),x=p.filter(e=>!g[e.name]);y.length?r.push(...y,...S(y,x,m)):r.push(...M(p,f,75))});const s=new Set(r.map(e=>e.name)),u=(e.joins??[]).filter(e=>e.every(e=>s.has(e))).map(e=>({id:`j-${e.join('-')}`,tables:e}));return{areas:n,tables:r,joins:u,sections:o,fixtures:a}}const T=(e,t,n=0,r=25)=>({kind:'window',x:e,y:n,w:t,h:r}),A=(e,t,n=100,r=25)=>({kind:'door',x:e,y:t,w:n,h:r});function $(){const e=r.default;return k({areas:e.areas.map(e=>({name:e.name,dogs:!!e.dogFriendly,outdoor:!(!e.outdoor&&!e.weatherDependent),label:e.label,colour:e.colour,tables:e.tables.map(([e,t])=>[e,t]),layout:e.layout,fixtures:[],best:e.best?.map(String)})),joins:e.joins??[]},e.areas.map(e=>e.server??''))}const v=[{id:'anchorage',name:'The Anchorage',sub:'4 areas \xb7 29 tables \xb7 119 seats',make:$},{id:'cafe',name:'Small caf\xe9',sub:'1 room \xb7 8 tables \xb7 dogs welcome',make:()=>k({areas:[{name:'Caf\xe9',dogs:!0,tables:[[1,2],[2,2],[3,4],[4,4],[5,2],[6,4],[7,2],[8,6]],fixtures:[{kind:'bar',x:300,y:25,w:400,h:50},A(450,600)]}]})},{id:'pub',name:'Pub with garden',sub:'Bar, lounge and beer garden',make:()=>k({areas:[{name:'Bar',dogs:!0,tables:[[1,2],[2,4],[3,4],[4,2],[5,4],[6,6]],fixtures:[{kind:'bar',x:250,y:25,w:500,h:75}]},{name:'Lounge',tables:[[7,4],[8,4],[9,2],[10,6],[11,4],[12,2],[13,4],[14,8]],fixtures:[T(150,700)]},{name:'Beer garden',dogs:!0,outdoor:!0,tables:[[20,6],[21,6],[22,4],[23,4],[24,6],[25,6]]}]})},{id:'restaurant',name:'Restaurant and terrace',sub:'Dining room with an outdoor terrace',make:()=>k({areas:[{name:'Dining room',tables:[[1,2],[2,2],[3,4],[4,4],[5,4],[6,6],[7,2],[8,2],[9,4],[10,4],[11,6],[12,8]],fixtures:[T(100,800),A(450,600)]},{name:'Terrace',outdoor:!0,tables:[[20,2],[21,4],[22,4],[23,2]]}]})},{id:'blank',name:'Blank',sub:'One empty room to start from',make:()=>k({areas:[{name:'Main room',tables:[]}]})}];const C=(e,t)=>{const n=t?e.tables.filter(e=>e.areaId===t):e.tables;return{tables:n.length,seats:n.reduce((e,t)=>e+t.maxSeats,0)}},B=(e,t)=>void 0!==t.dogOk?t.dogOk:!!e.areas.find(e=>e.id===t.areaId)?.dogs,L=e=>new Set(e.tables.filter(t=>B(e,t)).map(e=>e.name)),q=(e,t)=>e.areas.find(n=>n.id===e.tables.find(e=>e.name===t)?.areaId);function E(e,t){return e.areas.filter(e=>!t||e.id===t).flatMap(t=>(t.best??[]).filter(n=>e.tables.some(e=>e.name===n&&e.areaId===t.id)))}const _=(e,t)=>E(e).includes(t)},945,[808,17]); +__d(function(g,r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DEFAULT_WAKE_PIN",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"DEFAULT_WAKE_SALT",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"hashWakePin",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"DEFAULT_WAKE",{enumerable:!0,get:function(){return o}}),e.newSalt=u,e.wakePinProblem=function(n){return/^\d{6,8}$/.test(n)?/^(\d)\1+$/.test(n)||'0123456789012'.includes(n)||'9876543210987'.includes(n)?'Pick a PIN that is harder to guess (not all the same digit or a run like 123456).':n===t?'Pick a new PIN, not the starting one.':null:'The wake PIN must be 6 to 8 digits.'},e.makeWakePin=function(n,t=u()){return{pinHash:a(n,t),pinSalt:t,pinLen:n.length,pinDefault:!1}},Object.defineProperty(e,"wakePinMatches",{enumerable:!0,get:function(){return l}}),e.fromOldPin=function(n){const i='string'==typeof n&&/^\d{4,8}$/.test(n)?n:t;if(i===t)return{...o};const l=u();return{pinHash:a(i,l),pinSalt:l,pinLen:i.length,pinDefault:!1}};var n=r(d[0]);const t='2580',i='cc-wake-default',a=(t,i)=>(0,n.sha256HexSync)(`cc-wake:${i}:${t}`),o={pinHash:a(t,i),pinSalt:i,pinLen:4,pinDefault:!0};function u(){const n=globalThis.crypto,t=new Uint8Array(12);if(n?.getRandomValues)n.getRandomValues(t);else for(let n=0;nn.toString(16).padStart(2,'0')).join('')}const l=(n,t)=>a(t,n.pinSalt)===n.pinHash},946,[1153]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useSliders",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"notify",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"dismissNotice",{enumerable:!0,get:function(){return c}});var t=r(d[0]);let u=0;const s=t=>'urgent'===t.tone?0:'warn'===t.tone?1:2,n=(0,t.create)()((t,n)=>({queue:[],push:n=>t(t=>{const o=t.queue.find(t=>t.id===n.id),c=o?t.queue.map(t=>t.id===n.id?{...n,seq:o.seq}:t):[...t.queue,{...n,seq:++u}];return{queue:(f=c,[...f].sort((t,u)=>s(t)-s(u)||(t.seq??0)-(u.seq??0))).slice(0,40)};var f}),dismiss:u=>{const s=n().queue.find(t=>t.id===u);if(s){t(t=>({queue:t.queue.filter(t=>t.id!==u)}));try{s.onClose?.()}catch{}}},dismissWhere:t=>{for(const u of n().queue.filter(t))n().dismiss(u.id)}})),o=t=>n.getState().push(t),c=t=>n.getState().dismiss(t)},947,[952]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return n.default}});var e=r(d[0]);Object.keys(e).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(_e,t)||Object.defineProperty(_e,t,{enumerable:!0,get:function(){return e[t]}})});var t,n=(t=e)&&t.__esModule?t:{default:t}},948,[1311]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"canCancelWalkIn",{enumerable:!0,get:function(){return w}}),_e.cancelWalkInWords=y,_e.cancelWalkInNow=$,_e.CancelWalkInButton=function({rid:e,b:l,onDone:t,small:s}){const[c,o]=(0,n.useState)(!1);return w(l)?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(u.Button,{kind:"secondary",small:s,label:"Cancel walk-in",testID:`cancel-walkin-${l.id}`,accessibilityLabel:`Cancel walk-in ${l.ref}, ${l.partySize} Covers`,onPress:()=>o(!0),style:s?{minHeight:44}:k}),c?(0,f.jsx)(h,{rid:e,b:l,onClose:()=>o(!1),onDone:t}):null]}):null},_e.CancelWalkInConfirm=h;var e,n=r(d[0]),l=r(d[1]),t=(e=l)&&e.__esModule?e:{default:e},s=r(d[2]),c=r(d[3]),o=r(d[4]),b=r(d[5]),u=r(d[6]),f=r(d[7]);const k={minHeight:56},w=e=>!!e.walkIn&&('seated'===e.status||'confirmed'===e.status);function y(e){const n=(0,c.tablesOf)(e.table),l=(0,o.tablesWords)(n);return`Cancel walk-in ${e.ref}, ${e.partySize} Covers${n.length?` at ${l}`:''}, arrived ${e.time}? It comes off the Covers${n.length?` and ${l} ${n.length>1?'go':'goes'} back to Free`:''}.`}async function $(e,n){await s.repo.bookings.setStatus(n.id,'cancelled'),(0,c.tablesOf)(n.table).forEach(n=>c.useFloor.getState().setLive(e,n,{stage:void 0,dirty:!1}))}function h({rid:e,b:n,onClose:l,onDone:s}){const w=y(n);return(0,f.jsxs)(u.Sheet,{visible:!0,onClose:l,title:"Cancel walk-in?",maxWidth:560,testID:"cancel-walkin-confirm",children:[(0,f.jsx)(t.default,{accessible:!0,accessibilityLabel:w,children:(0,f.jsx)(u.T,{size:18,colour:b.colours.text,children:w})}),(0,f.jsxs)(u.Row,{gap:8,wrap:!0,children:[(0,f.jsx)(u.Button,{label:"Yes, cancel walk-in",testID:"cancel-walkin-yes",accessibilityLabel:`Yes, cancel walk-in ${n.ref}`,style:[k,{flexGrow:1}],onPress:async()=>{await $(e,n),l(),s?.(`Walk-in ${n.ref} cancelled.${(0,c.tablesOf)(n.table).length?` ${(0,o.tablesWords)((0,c.tablesOf)(n.table))} free.`:''}`)}}),(0,f.jsx)(u.Button,{kind:"secondary",label:"Keep walk-in",testID:"cancel-walkin-no",accessibilityLabel:`Keep walk-in ${n.ref}`,onPress:l,style:k})]})]})}},949,[30,127,819,825,931,821,813,24]); +__d(function(g,_r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AllergenBar=p,_e.NeedsPills=k,_e.BookingNeeds=x,Object.defineProperty(_e,"needsIcons",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"confirmHolds",{enumerable:!0,get:function(){return S}}),_e.serveHolds=y,_e.postNewBookingToKitchen=function(e,t){if(!t||'system'===t)return;const s=o.useStore.getState().restaurants.find(t=>t.id===e.restaurantId),l=[],r=`${e.name}, ${(0,c.niceDate)((0,c.parseYmd)(e.date)).slice(0,3)} ${e.time}${e.table?`, table ${e.table}`:''}`;if((e.holds??[]).filter(e=>e.qty>0).length){const t=I(e.restaurantId);l.push(`${(0,u.holdsText)(e,(0,u.reservablesOf)(s),t)} reserved: ${r}. Tap Platter OK in the Head Chef app.`)}(0,u.hasAllergens)(e)&&l.push(`\u26a0\ufe0f Allergens: ${(0,u.allergenText)(e)} \u2014 ${r}. Please sign \u2018Allergens seen\u2019.`);if(!l.length)return;a.useOwner.getState().chatSend({ch:'kitchen',from:t,text:l.join('\n'),at:(new Date).toISOString()})},_e.useKitchenTodo=D,_e.KitchenSignoffs=function({rid:t,today:s,by:a,app:f,canConfirm:p=!0,showAll:k}){const j=D(t,s),I=(0,o.useBookings)(t),T=(0,o.useRestaurant)(t),O=(0,n.useStockItems)(t),$=(0,u.reservablesOf)(T),A=I.filter(e=>e.date===s&&!['cancelled','noshow'].includes(e.status)&&(e.holds??[]).some(e=>e.qty>0)),v=k?[...j,...A.filter(e=>!j.includes(e))]:j;return v.length?(0,b.jsxs)(l.default,{testID:"kitchen-signoffs",style:{gap:10,padding:16,borderRadius:16,borderWidth:1.5,borderColor:j.length?h.colours.amber:h.colours.hairline,backgroundColor:h.colours.surface},children:[(0,b.jsx)(r.T,{size:12,weight:"semibold",colour:j.length?h.colours.amber:h.colours.goldMuted,style:{letterSpacing:1.6},children:j.length?`KITCHEN SIGN-OFF NEEDED (${j.length})`:'RESERVED TODAY'}),v.map(t=>(0,b.jsxs)(l.default,{style:{gap:6,paddingTop:8,borderTopWidth:1,borderColor:h.colours.hairline},testID:`signoff-${t.ref}`,children:[(0,b.jsxs)(r.T,{weight:"semibold",children:[t.name," \xb7 ",t.partySize," covers \xb7 ",t.date===s?'Today':(0,c.niceDate)((0,c.parseYmd)(t.date))," ",t.time,t.table?` \xb7 ${(0,e.tableNumbers)(t.table)}`:'']}),(0,b.jsx)(x,{b:t}),p?(0,b.jsxs)(r.Row,{wrap:!0,gap:8,children:[(0,u.needsAllergenSeen)(t)?(0,b.jsx)(r.Button,{small:!0,kind:"danger",label:"Allergens seen",testID:`allergens-seen-${t.ref}`,onPress:()=>o.useStore.getState().ackBookingAllergy(t.id,a)}):null,(0,u.needsHoldOk)(t)?(0,b.jsx)(r.Button,{small:!0,kind:"success",label:/platter/i.test((0,u.holdsText)(t,$,O))?'Platter OK':'Reservation OK',testID:`platter-ok-${t.ref}`,onPress:()=>S(t.id,a)}):null,t.date===s&&t.holdOk&&(t.holds??[]).some(e=>!e.served)&&['seated','confirmed'].includes(t.status)?(0,b.jsx)(r.Button,{small:!0,kind:"secondary",label:"Served",testID:`served-${t.ref}`,onPress:()=>y(t,a,f)}):null]}):(0,b.jsx)(r.Muted,{children:"The kitchen signs these off."})]},t.id))]}):null},_e.PlattersBooked=function({rid:e,date:t,label:s}){const a=(0,o.useBookings)(e),c=(0,o.useRestaurant)(e),f=(0,n.useStockItems)(e),p=(0,u.heldSummary)(a,t,(0,u.reservablesOf)(c)),k=Object.entries(p.stock).filter(([,e])=>e>0).map(([e,t])=>`${t} ${(f.find(t=>t.key===e)?.name??e).toLowerCase()}`);return p.platters||k.length?(0,b.jsx)(l.default,{testID:"platters-booked",children:(0,b.jsxs)(r.T,{weight:"semibold",colour:h.colours.goldLight,children:[s??'Platters booked',": ",p.platters,k.length?` (${k.join(', ')})`:'']})}):null};var e=_r(d[0]);_r(d[1]);var t,s=_r(d[2]),l=(t=s)&&t.__esModule?t:{default:t},r=_r(d[3]),o=_r(d[4]),n=_r(d[5]),a=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),b=_r(d[10]);const f=({label:e,bg:t,fg:s,border:o,testID:n})=>(0,b.jsx)(l.default,{testID:n,style:{backgroundColor:t,borderColor:o,borderWidth:1,borderRadius:999,paddingHorizontal:9,paddingVertical:2},children:(0,b.jsx)(r.T,{size:13,weight:"semibold",colour:s,children:e})});function p({b:e,big:t}){return(0,u.hasAllergens)(e)?(0,b.jsxs)(l.default,{testID:`allergen-bar-${e.ref}`,style:{backgroundColor:h.colours.redSolid,borderRadius:10,paddingHorizontal:10,paddingVertical:t?8:5,gap:2},children:[(0,b.jsxs)(r.T,{size:t?16:13,weight:"bold",colour:"#FFFFFF",children:["\u26a0\ufe0f ALLERGENS: ",(0,u.allergenText)(e)]}),e.allergyAck?(0,b.jsxs)(r.T,{size:12,colour:"#FFE3DF",children:["Seen by kitchen: ",e.allergyAck.by]}):(0,b.jsx)(r.T,{size:12,colour:"#FFE3DF",children:"Kitchen hasn\u2019t signed \u2018Allergens seen\u2019 yet"})]}):null}function k({b:t,r:s}){const l=(0,n.useStockItems)(t.restaurantId),o=(0,u.reservablesOf)(s),a=(t.holds??[]).some(e=>e.qty>0),c=[];return t.drinksOnly&&c.push((0,b.jsx)(f,{testID:"pill-drinks",label:"\ud83c\udf77 Drinks only (after last food orders)",bg:h.colours.surface2,fg:h.colours.goldLight,border:h.colours.accentBorder},"x")),(0,u.hasAccess)(t)&&c.push((0,b.jsx)(f,{testID:"pill-access",label:`\u267f ${(0,u.accessText)(t)}`,bg:h.colours.blueBg,fg:"#E2C489",border:h.colours.blue},"a")),(0,u.dogCount)(t)&&c.push((0,b.jsx)(f,{testID:"pill-dog",label:"\ud83d\udc15 "+((0,u.dogCount)(t)>1?`${(0,u.dogCount)(t)} dogs`:'Dog'),bg:h.colours.surface2,fg:h.colours.text,border:h.colours.hairline},"d")),(0,u.dietText)(t)&&c.push((0,b.jsx)(f,{testID:"pill-veg",label:`\u24cb ${(0,u.dietText)(t)}`,bg:"#2A2216",fg:"#E2C489",border:"#CFA45F"},"v")),a&&c.push(t.holdOk?(0,b.jsx)(f,{testID:"pill-platter",label:`\u2713 ${(0,u.holdsText)(t,o,l)} \xb7 confirmed`,bg:h.colours.okBg,fg:"#E2C489",border:h.colours.ok},"h"):(0,b.jsx)(f,{testID:"pill-platter",label:`\ud83e\udd9e ${(0,u.holdsText)(t,o,l)} \xb7 awaiting kitchen`,bg:h.colours.amberBg,fg:"#FFE2A8",border:h.colours.amber},"h")),t.tableReq?.length&&c.push((0,b.jsx)(f,{testID:"pill-request",label:`Requested: ${t.tableReq.map(t=>`${(0,e.tableNumbers)(t)}`).join(' or ')}`,bg:h.colours.goldTint,fg:h.colours.goldLight,border:h.colours.accentBorder},"t")),c.length?(0,b.jsx)(r.Row,{wrap:!0,gap:6,children:c}):null}function x({b:e,big:t}){const s=(0,o.useRestaurant)(e.restaurantId);return(0,b.jsxs)(l.default,{style:{gap:6},children:[(0,b.jsx)(p,{b:e,big:t}),(0,b.jsx)(k,{b:e,r:s})]})}const j=e=>[(0,u.hasAllergens)(e)?'\u26a0\ufe0f':'',(0,u.hasAccess)(e)?'\u267f':'',(0,u.dogCount)(e)?'\ud83d\udc15':'',(0,u.dietText)(e)?'\u24cb':'',(e.holds??[]).some(e=>e.qty>0)?e.holdOk?'\ud83e\udd9e\u2713':'\ud83e\udd9e':''].filter(Boolean).join(' '),S=(e,t)=>o.useStore.getState().updateBooking(e,{holdOk:{by:t,at:(new Date).toISOString()}});function y(e,t,s){const l=o.useStore.getState().restaurants.find(t=>t.id===e.restaurantId),r=(0,u.stockNeed)(e,(0,u.reservablesOf)(l));for(const[l,o]of Object.entries(r))o>0&&n.shellfish.append({rid:e.restaurantId,kind:l,delta:-o,reason:'sold',by:t,app:s});const a=(new Date).toISOString();o.useStore.getState().updateBooking(e.id,{holds:(e.holds??[]).map(e=>e.served?e:{...e,served:{by:t,at:a}})})}const I=e=>n.useShellStore.getState().items[e]??[];function D(e,t){return(0,o.useBookings)(e).filter(e=>e.date>=t&&!e.walkIn&&((0,u.needsAllergenSeen)(e)||(0,u.needsHoldOk)(e))).sort((e,t)=>(e.date+e.time).localeCompare(t.date+t.time))}},950,[808,30,127,813,819,1027,856,828,818,821,24]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.DepositChip=function({b:e,money:o,big:n,testID:b}){const f=(0,s.depositView)(e,o);if(!f)return null;const h={gold:[t.colours.goldTint,t.colours.goldLight,t.colours.gold],amber:[t.colours.amberBg,'#FFE2A8',t.colours.amber],red:[t.colours.redBg,'#FFD9D4',t.colours.red],neutral:[t.colours.surface2,t.colours.muted,t.colours.border]}[f.kind];return(0,u.jsxs)(l.default,{accessible:!0,accessibilityRole:"text",accessibilityLabel:f.a11y,testID:b??'deposit-chip',style:{alignSelf:'flex-start',maxWidth:'100%'},children:[(0,u.jsx)(l.default,{style:{backgroundColor:h[0],borderColor:h[2],borderWidth:n?2:1,borderRadius:8,paddingHorizontal:n?12:8,paddingVertical:n?6:3},children:(0,u.jsx)(c.T,{size:16,weight:"semibold",colour:h[1],children:f.label})}),f.note?(0,u.jsx)(c.Muted,{size:12,children:f.note}):null]})},r(d[0]);var e,o=r(d[1]),l=(e=o)&&e.__esModule?e:{default:e},s=r(d[2]),t=r(d[3]),c=r(d[4]),u=r(d[5])},951,[30,127,13,821,813,24]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0});var t=r(d[0]);Object.keys(t).forEach(function(n){'default'===n||Object.prototype.hasOwnProperty.call(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[n]}})});var n=r(d[1]);Object.keys(n).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})})},952,[1126,1127]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";function i(i){return i&&i.__esModule?i:{default:i}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEFAULT_AVATARS",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"AVATAR_BGS",{enumerable:!0,get:function(){return F}}),Object.defineProperty(_e,"AVATAR_RINGS",{enumerable:!0,get:function(){return u}}),_e.specFor=E,_e.AvatarArt=$,_e.useStaffMember=v,_e.StaffAvatar=function({id:i,name:t,size:s=34,ring:c=!0}){const f=v(i,t),y=f?.id??i,F=(0,n.useAvatars)(i=>y?i.photos[y]:void 0),u=(0,o.useSetup)(i=>y?i.looks[y]:void 0),j=`${(f?.name??t??'Team member').replace(' (example)','')}'s avatar`;return(0,h.jsx)(r.default,{testID:y?`avatar-${y}`:'avatar',accessibilityLabel:j,accessibilityRole:"image",style:{width:s,height:s,borderRadius:s/2,overflow:'hidden',borderWidth:c?Math.max(1,s/22):0,borderColor:x.colours.gold,backgroundColor:(0,l.soutersSurface)('#111')},children:F?(0,h.jsx)(e.default,{source:{uri:F.dataUrl},style:{width:'100%',height:'100%'},accessibilityIgnoresInvertColors:!0}):(0,h.jsx)($,{spec:null!=u?E(`${y}#look${u}`):E(y,f?.name??t),size:s-(c?2*Math.max(1,s/22):0)})})};var l=_r(d[0]);_r(d[1]);var e=i(_r(d[2])),r=i(_r(d[3])),t=_r(d[4]),s=i(t),c=_r(d[5]),n=_r(d[6]),o=_r(d[7]),x=_r(d[8]),f=_r(d[9]),h=_r(d[10]);const y=Object.fromEntries(f.ROSTER.map(i=>[i.id,i.avatar])),F=['#2A2520','#B89A72','#D9A441','#4A3F35','#3A3029','#8A6A3B'],u=['#E9B949','#CFA45F'],j=F,C=['#F1C7A5','#E8B48F','#C68B5E','#8D5B3E','#F4D2B8','#A86B45'],p=['#2B1B12','#7A4E2A','#151515','#C2462E','#D9B26A'],A=['quiff','flip','crop','beehive','bob','curls'],b=i=>{let l=7;for(const e of i)l=31*l+e.charCodeAt(0)>>>0;return l};function E(i,l){if(i&&y[i])return y[i];const e=b(i||l||'crew');return{bg:j[e%6],ring:u[e%2],skin:C[(e>>3)%6],hair:p[(e>>6)%5],hairStyle:A[(e>>9)%6],suit:'#F2EAD8',antenna:['ball','star','none'][(e>>12)%3]}}const k=(i,l,e)=>`M${i} ${l-e} Q${i+.18*e} ${l-.18*e} ${i+e} ${l} Q${i+.18*e} ${l+.18*e} ${i} ${l+e} Q${i-.18*e} ${l+.18*e} ${i-e} ${l} Q${i-.18*e} ${l-.18*e} ${i} ${l-e}Z`;function $({spec:i,size:l=40}){const e=i,r='#1B1B1B',c='flip'===e.hairStyle?(0,h.jsx)(t.Path,{d:"M29 50 C26 30 40 22 50 22 C60 22 74 30 71 50 C75 56 79 60 76 65 C72 60 69 58 66 57 L34 57 C31 58 28 60 24 65 C21 60 25 56 29 50Z",fill:e.hair}):'bob'===e.hairStyle?(0,h.jsx)(t.Path,{d:"M30 58 C27 32 40 24 50 24 C60 24 73 32 70 58 L66 60 L34 60Z",fill:e.hair}):'beehive'===e.hairStyle?(0,h.jsxs)(t.G,{children:[(0,h.jsx)(t.Ellipse,{cx:50,cy:25,rx:15,ry:14,fill:e.hair}),(0,h.jsx)(t.Path,{d:"M31 54 C28 34 40 27 50 27 C60 27 72 34 69 54 Z",fill:e.hair})]}):'curls'===e.hairStyle?(0,h.jsx)(t.G,{children:[[34,34],[40,27],[50,24],[60,27],[66,34],[69,43],[31,43]].map(([i,l],r)=>(0,h.jsx)(t.Circle,{cx:i,cy:l,r:7,fill:e.hair},r))}):null,n='quiff'===e.hairStyle?(0,h.jsxs)(t.G,{children:[(0,h.jsx)(t.Path,{d:"M32 42 C31 27 43 23 51 25 C61 22 70 30 68 42 C63 35 57 33 50 34 C43 34 37 37 32 42Z",fill:e.hair}),(0,h.jsx)(t.Path,{d:"M46 26 C51 14 66 14 66 23 C61 20 54 21 50 28Z",fill:e.hair})]}):'crop'===e.hairStyle?(0,h.jsx)(t.Path,{d:"M32 42 C31 28 42 25 50 25 C58 25 69 28 68 42 C64 36 58 33 50 33 C42 33 36 36 32 42Z",fill:e.hair}):'curls'===e.hairStyle?null:(0,h.jsx)(t.Path,{d:"M32 43 C33 30 42 27 50 27 C58 27 67 30 68 43 C61 38 57 33 51 33 C47 37 39 41 32 43Z",fill:e.hair});return(0,h.jsxs)(s.default,{width:l,height:l,viewBox:"0 0 100 100",children:[(0,h.jsx)(t.Circle,{cx:50,cy:50,r:50,fill:e.bg}),(0,h.jsx)(t.Ellipse,{cx:50,cy:50,rx:46,ry:13,fill:"none",stroke:"#FFF4E0",strokeOpacity:.28,strokeWidth:1.6,transform:"rotate(-28 50 50)"}),(0,h.jsx)(t.Path,{d:k(16,24,6),fill:"#FFF4E0",fillOpacity:.85}),(0,h.jsx)(t.Path,{d:k(84,34,4),fill:"#FFF4E0",fillOpacity:.7}),(0,h.jsx)(t.Circle,{cx:80,cy:16,r:1.6,fill:"#FFF4E0",fillOpacity:.8}),(0,h.jsx)(t.Circle,{cx:22,cy:70,r:1.3,fill:"#FFF4E0",fillOpacity:.6}),(0,h.jsx)(t.Path,{d:"M12 100 C14 82 31 74 50 74 C69 74 86 82 88 100 Z",fill:e.suit}),(0,h.jsx)(t.Path,{d:"M36 100 L40 84 L50 90 L60 84 L64 100Z",fill:e.ring,fillOpacity:.35}),(0,h.jsx)(t.Rect,{x:44,y:60,width:12,height:12,fill:e.skin}),c,(0,h.jsx)(t.Ellipse,{cx:50,cy:46,rx:17,ry:18.5,fill:e.skin}),n,e.specs?(0,h.jsxs)(t.G,{stroke:r,strokeWidth:1.6,fill:"#FFFFFF",fillOpacity:.25,children:[(0,h.jsx)(t.Rect,{x:37,y:42,width:11,height:8,rx:4}),(0,h.jsx)(t.Rect,{x:52,y:42,width:11,height:8,rx:4}),(0,h.jsx)(t.Line,{x1:48,y1:45,x2:52,y2:45})]}):null,(0,h.jsx)(t.Ellipse,{cx:42.5,cy:46.5,rx:2.1,ry:2.7,fill:r}),(0,h.jsx)(t.Ellipse,{cx:57.5,cy:46.5,rx:2.1,ry:2.7,fill:r}),(0,h.jsx)(t.Circle,{cx:43.3,cy:45.5,r:.8,fill:"#FFFFFF"}),(0,h.jsx)(t.Circle,{cx:58.3,cy:45.5,r:.8,fill:"#FFFFFF"}),(0,h.jsx)(t.Circle,{cx:38,cy:53,r:3,fill:"#F08A7E",fillOpacity:.55}),(0,h.jsx)(t.Circle,{cx:62,cy:53,r:3,fill:"#F08A7E",fillOpacity:.55}),(0,h.jsx)(t.Path,{d:"M44.5 55 Q50 60 55.5 55",stroke:r,strokeWidth:1.8,fill:"none",strokeLinecap:"round"}),(0,h.jsx)(t.Ellipse,{cx:50,cy:74,rx:21,ry:5.5,fill:e.ring}),(0,h.jsx)(t.Ellipse,{cx:50,cy:73,rx:16,ry:3,fill:"#000000",fillOpacity:.18}),(0,h.jsx)(t.Circle,{cx:50,cy:88,r:4,fill:e.ring}),(0,h.jsx)(t.Circle,{cx:50,cy:88,r:1.6,fill:e.bg}),(0,h.jsx)(t.Circle,{cx:50,cy:45,r:29,fill:"#FFF4E0",fillOpacity:.1,stroke:"#FFF4E0",strokeOpacity:.85,strokeWidth:2}),(0,h.jsx)(t.Path,{d:"M29 36 A23 23 0 0 1 41 22",stroke:"#FFFFFF",strokeOpacity:.85,strokeWidth:3.2,fill:"none",strokeLinecap:"round"}),(0,h.jsx)(t.Circle,{cx:28.5,cy:42,r:1.5,fill:"#FFFFFF",fillOpacity:.85}),'none'!==e.antenna?(0,h.jsx)(t.Line,{x1:50,y1:16,x2:50,y2:8,stroke:e.ring,strokeWidth:2}):null,'ball'===e.antenna?(0,h.jsx)(t.Circle,{cx:50,cy:6.5,r:3.3,fill:e.ring}):'star'===e.antenna?(0,h.jsx)(t.Path,{d:k(50,6.5,4.5),fill:e.ring}):null]})}const O=i=>(i??'').replace(' (example)','').trim().toLowerCase();function v(i,l){const e=(0,c.useOwner)(i=>i.staff);return i?e.find(l=>l.id===i):l?e.find(i=>O(i.name)===O(l)):void 0}},953,[868,30,196,127,948,856,1201,1202,821,14,24]); +__d(function(g,_r,i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"MIN_RADIUS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"MAX_RADIUS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"ACCURACY_CAP",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"DEFAULT_BREAK_OPTIONS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"DEFAULT_CLOCK_AREA",{enumerable:!0,get:function(){return r}}),e.distanceM=s,Object.defineProperty(e,"validLat",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"validLng",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"areaSet",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"clampRadius",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"accuracyAllowance",{enumerable:!0,get:function(){return p}}),e.isInside=h,e.cleanArea=function(t){const n=(t.breakOptions??a).map(t=>Math.round(Number(t))).filter(t=>Number.isFinite(t)&&t>0&&t<=180);return{...r,...t,lat:c(t.lat)?t.lat:null,lng:l(t.lng)?t.lng:null,radius:f(t.radius??r.radius),on:!1!==t.on,offRotaPrompt:!1!==t.offRotaPrompt,breakOptions:[...new Set(n)].sort((t,n)=>t-n).slice(0,12),offRotaTitle:(t.offRotaTitle??'').trim().slice(0,80)||r.offRotaTitle,offRotaBody:(t.offRotaBody??'').trim().slice(0,160)||r.offRotaBody}},Object.defineProperty(e,"ACTION_WORD",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"DENIED_TEXT",{enumerable:!0,get:function(){return m}}),e.gate=function(t,n,o,a,r="browser"){if(!t.on||!d(t)){const r={action:n,at:a,inside:null,unchecked:!0};return'object'==typeof o&&Object.assign(r,{lat:y(o.lat),lng:y(o.lng),acc:Math.round(o.acc)}),{allowed:!0,geo:r,warn:t.on?'The clock-in area isn\u2019t set yet, so location isn\u2019t checked.':void 0}}if('object'!=typeof o){const t='app-phone-off'===r?m['app-phone-off']:'denied'===o?m[r]:'timeout'===o?'Your phone couldn\u2019t find your location in time. Step outside or near a window and try again.':'unsupported'===o?'This phone or browser can\u2019t share its location. Ask a manager to record it for you.':'Your phone couldn\u2019t find your location. Check Location is on, then try again.';return{allowed:!1,message:`You need to be at the venue to ${b[n]}. ${t}`,geo:{action:n,at:a,inside:!1}}}const u=h(t,o),s={action:n,at:a,lat:y(o.lat),lng:y(o.lng),acc:Math.round(o.acc),dist:u.dist,inside:u.inside};if(u.inside)return{allowed:!0,geo:s};const c=u.dist>=1e3?`${(u.dist/1e3).toFixed(1)} km`:`${u.dist} m`;return{allowed:!1,geo:s,message:`You need to be at the venue to ${b[n]}. You look to be about ${c} away (allowed ${u.limit} m). If you\u2019re at the venue, try again in a moment or ask a manager to record it for you.`}},e.overrideGeo=function(t,n,o,a){const r=a.trim();return r.length<3?null:{action:t,at:n,inside:null,override:{by:o.name,byId:o.id,reason:r.slice(0,200)}}},e.offRotaDue=function(t){return!(!(t.area.offRotaPrompt&&d(t.area)&&t.inside)||t.clockedIn||t.dismissedToday)&&!t.shifts.some(n=>t.nowHours>=n.start-1&&t.nowHours<(n.end<=n.start?n.end+24:n.end))},Object.defineProperty(e,"breakLabel",{enumerable:!0,get:function(){return O}});const t=50,n=2e3,o=50,a=[5,10,15,20,30,45,60],r={lat:null,lng:null,radius:100,on:!0,breakOptions:[...a],offRotaPrompt:!0,offRotaTitle:'Do you want to sign in?',offRotaBody:'Should you be on the rota?'},u=t=>t*Math.PI/180;function s(t,n){const o=u(n.lat-t.lat),a=u(n.lng-t.lng),r=Math.sin(o/2)**2+Math.cos(u(t.lat))*Math.cos(u(n.lat))*Math.sin(a/2)**2;return 12742017.6*Math.asin(Math.min(1,Math.sqrt(r)))}const c=t=>'number'==typeof t&&Number.isFinite(t)&&t>=-90&&t<=90,l=t=>'number'==typeof t&&Number.isFinite(t)&&t>=-180&&t<=180,d=t=>c(t.lat)&&l(t.lng),f=o=>Number.isFinite(o)?Math.min(n,Math.max(t,Math.round(o))):r.radius,p=t=>Number.isFinite(t)&&t>0?Math.min(t,o):0;function h(t,n){const o=s({lat:t.lat,lng:t.lng},n),a=f(t.radius)+p(n.acc);return{inside:o<=a,dist:Math.round(o),limit:Math.round(a)}}const b={in:'clock in',out:'clock out',break_start:'start a break',break_end:'end your break'},m={browser:'Location is turned off for this browser. Turn it on in your phone\u2019s settings (Location \u203a allow for this browser), then try again.',iphone:'Location is turned off for this app. On your iPhone open Settings \u203a Privacy & Security \u203a Location Services \u203a Safari Websites and choose While Using the App, then try again.',app:'Location is turned off for this app. Tap Open app settings, then Permissions \u203a Location \u203a Allow only while using the app. Then come back and try again.','app-old':'This version of the app can\u2019t use location. Tap Update the app at the bottom of the screen, then tap Allow when your phone asks.','app-phone-off':'Location is switched off on your phone. Tap Open location settings, turn on Use location, then come back and try again.'};const y=t=>Math.round(1e6*t)/1e6;const O=t=>60===t?'1 hour':t%60==0?t/60+" hours":t>60?`${Math.floor(t/60)} h ${t%60} min`:`${t} min`},954,[]); +__d(function(g,_r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"pinProblem",{enumerable:!0,get:function(){return r.pinProblem}}),Object.defineProperty(_e,"ERROR_TEXT",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"errorText",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"useDisplayTiles",{enumerable:!0,get:function(){return u}}),_e.refreshTiles=async function(){const e=await l('display_staff_list',{});Array.isArray(e)&&u.setState({tiles:e,at:Date.now()});const t=await l('display_pin_lengths',{});t&&'object'==typeof t&&!('ok'in t)&&u.setState({lens:t})},_e.refreshManagers=async function(){const e=await l('display_managers',{});Array.isArray(e)&&u.setState({managers:e})},Object.defineProperty(_e,"displayClock",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"displayChangePin",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"displayAddTemp",{enumerable:!0,get:function(){return y}}),_e.setStaffPin=async function(e,n,a=4){const o=_();if(!o)return{ok:!1,error:'Sign in to the venue to set PINs (they are kept on the server only).'};const s=(0,r.pinProblem)(n,a);if(s)return{ok:!1,error:s};try{const{error:r}=await(0,t.getSupabase)().rpc('set_staff_pin',{p_venue:o,p_staff_ref:e,p_pin:n});return r?{ok:!1,error:r.message.replace(/^.*?:\s*(?=The PIN|Pick a PIN)/,'')}:{ok:!0}}catch{return{ok:!1,error:'No connection. Try again in a moment.'}}},_e.addTempStaff=async function(e){const n=_();if(!n)return{ok:!1,error:'Sign in to the venue to add temp staff (the code is made and kept on the server).'};try{const{data:r,error:a}=await(0,t.getSupabase)().rpc('add_temp_staff',{p_venue:n,p_name:e.name,p_dept:e.dept??null,p_rate:e.rate??null,p_until:e.until||null});return a?{ok:!1,error:a.message}:{ok:!0,...r}}catch{return{ok:!1,error:'No connection. Try again in a moment.'}}},Object.defineProperty(_e,"usePinStatus",{enumerable:!0,get:function(){return k}}),_e.refreshPinStatus=async function(){const e=_();if(!e)return;try{const{data:n}=await(0,t.getSupabase)().rpc('staff_pin_status',{p_venue:e});Array.isArray(n)&&k.setState(Object.fromEntries(n.map(e=>[e.staff_ref,{hasPin:e.has_pin,locked:e.locked}])),!0)}catch{}},_e.localTiles=function(e,t){return e.filter(e=>e.active&&e.displayClock&&!(e.temp&&e.tempUntil&&e.tempUntil({ref:e.id,name:e.name,nickname:e.nickname,dept:e.dept,temp:!!e.temp})).sort((e,t)=>Number(!!e.temp)-Number(!!t.temp)||e.name.localeCompare(t.name))},Object.defineProperty(_e,"displayBlockChange",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"displayBlockEdit",{enumerable:!0,get:function(){return h}});var e=_r(d[0]),t=_r(d[1]),n=_r(d[2]),r=_r(d[3]),a=_r(d[4]),o=_r(d[5]);const s={wrong:'That PIN is not right. Try again.',locked:'Too many wrong tries. Locked for 15 minutes, or ask a manager to reset your PIN.',nopin:'No PIN set yet. Ask a manager to set one in Staff & roles.',notallowed:'This person can\u2019t clock in at the Display. A manager can turn it on in Staff & roles.',already:'Already clocked in.',notin:'Not clocked in yet.',onbreak:'Already on a break.',notmanager:'Only an owner or manager can add temp staff.',format:'The new PIN must be 4 to 8 digits (6 or more for managers and owners).',weak:'Pick a PIN that is harder to guess (not all the same digit or a run like 1234).',devicelocked:'Too many wrong PINs on this Display. Wait 15 minutes, then try again.',unpaired:'Pair this Display first (Settings \u203a Devices on the Managers app), then try again.',offline:'No connection. Try again in a moment.'},c=(e,t)=>'format'===e&&t?.min?`The new PIN must be ${t.min} to 8 digits.`:s[e??'']??(e||'Something went wrong. Try again.'),p=()=>'device'===n.useSync.getState().kind&&!!n.useSync.getState().venueId;async function l(e,n){if(a.PITCH)return(0,o.pitchClock)(e,n);if(!p())return{ok:!1,error:'unpaired'};try{const{data:r,error:a}=await(0,t.getSupabase)().rpc(e,n);return a?{ok:!1,error:/paired Display/.test(a.message)?'unpaired':a.message}:r}catch{return{ok:!1,error:'offline'}}}const u=(0,e.create)(()=>({tiles:null,managers:[],lens:{}}));const f=(e,t,n,r={})=>l('display_clock',{p_staff_ref:e,p_pin:t,p_action:n,p_break_mins:r.breakMins??null,p_off_rota:!!r.offRota}),m=(e,t,n)=>l('display_change_pin',{p_staff_ref:e,p_old:t,p_new:n}),y=(e,t,n)=>l('display_add_temp',{p_manager_ref:e,p_manager_pin:t,p_name:n.name,p_dept:n.dept??null,p_rate:n.rate??null,p_until:n.until||null}),_=()=>'staff'===n.useSync.getState().kind?n.useSync.getState().venueId:void 0;const k=(0,e.create)(()=>({}));const b=(e,t,n,r,a)=>l('display_block_change',{p_manager_ref:e,p_manager_pin:t,p_block_id:n,p_action:r,p_doc:a}),h=(e,t,n,r)=>l('display_block_edit',{p_block_id:e,p_action:t,p_doc:n,p_by:r})},955,[952,863,820,1394,2,1395]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"notifSeedId",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"headChefId",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"gmId",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"seedsFor",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"useNotifs",{enumerable:!0,get:function(){return v}});var e,t=r(d[0]),i=(e=t)&&e.__esModule?e:{default:e},s=r(d[1]),n=r(d[2]),o=r(d[3]),u=r(d[4]),p=r(d[5]),f=r(d[6]),c=r(d[7]);const l=(e,t)=>(0,o.uuidFrom)(`sched-notif:${t}:${e}`),S=()=>p.ROSTER.find(e=>'Head Chef'===e.level)?.id??p.ROSTER.find(e=>'chef'===e.app)?.id??'',b=()=>p.ROSTER.find(e=>'Manager'===e.level)?.id??'',h=e=>'anchorage'===e?(0,u.anchorageSeeds)(t=>l(e,t),S(),b()):[],O=()=>(new Date).toISOString(),v=(0,s.create)()((0,n.persist)((e,t)=>({items:[],snooze:{},ensure:i=>{const s=t().items,n=s.map(e=>(0,c.fixSupplierNames)(e.title)!==e.title||(0,c.fixSupplierNames)(e.message)!==e.message?{...e,title:(0,c.fixSupplierNames)(e.title),message:(0,c.fixSupplierNames)(e.message),updatedAt:O()}:e);n.some((e,t)=>e!==s[t])&&e({items:n});const o=new Set(t().items.map(e=>e.id)),u=h(i).filter(e=>!o.has(e.id)).map(e=>({...e,rid:i}));u.length&&e(e=>({items:[...e.items,...u]}))},add:(t,i)=>{const s=(0,f.uuid)();return e(e=>({items:[...e.items,{...i,id:s,rid:t,updatedAt:O()}]})),s},update:(t,i)=>e(e=>({items:e.items.map(e=>e.id===t?{...e,...i,updatedAt:O()}:e)})),remove:t=>e(e=>({items:e.items.flatMap(e=>e.id!==t?[e]:e.seed?[{...e,removed:!0,paused:!0,updatedAt:O()}]:[])})),resetSeeds:t=>{const i=new Map(h(t).map(e=>[e.id,e]));e(e=>{const s=e.items.map(e=>i.has(e.id)?{...i.get(e.id),rid:t,updatedAt:O()}:e),n=new Set(s.map(e=>e.id));return{items:[...s,...[...i.values()].filter(e=>!n.has(e.id)).map(e=>({...e,rid:t,updatedAt:O()}))]}})},setSnooze:(t,i)=>e(e=>({snooze:Object.fromEntries([...Object.entries(e.snooze).filter(([,e])=>e>Date.now()-864e5),[t,i]])}))}),{name:'covercharge-sched-notifs-v1',version:1,storage:(0,n.createJSONStorage)(()=>i.default)}))},956,[1116,952,1117,1104,958,14,1034,1205]); +__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"chairsId",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"rulesId",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"useReminders",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"rulesOf",{enumerable:!0,get:function(){return A}});var e,r=_r(d[0]),t=(e=r)&&e.__esModule?e:{default:e},n=_r(d[1]),s=_r(d[2]),u=_r(d[3]),o=_r(d[4]),l=_r(d[5]);const c=e=>(0,u.uuidFrom)(`reminder:chairs:${e}`),p=e=>(0,u.uuidFrom)(`break-rules:${e}`),f=()=>(new Date).toISOString(),b=(0,n.create)()((0,s.persist)((e,r)=>({reminders:[],rules:{},done:[],snooze:{},ensure:t=>{const n=r(),s={};n.reminders.some(e=>e.id===c(t))||(s.reminders=[...n.reminders,{...(0,o.defaultChairs)(c(t)),rid:t}]),n.rules[t]||(s.rules={...n.rules,[t]:{...o.DEFAULT_BREAK_RULES,id:p(t)}}),Object.keys(s).length&&e(s)},add:(r,t)=>{const n=(0,l.uuid)();return e(e=>({reminders:[...e.reminders,{...t,id:n,rid:r,updatedAt:f()}]})),n},update:(r,t)=>e(e=>({reminders:e.reminders.map(e=>e.id===r?{...e,...t,updatedAt:f()}:e)})),remove:r=>e(e=>({reminders:e.reminders.flatMap(e=>e.id!==r?[e]:e.builtIn?[{...e,removed:!0,paused:!0,updatedAt:f()}]:[])})),resetReminder:r=>e(e=>({reminders:e.reminders.map(e=>e.id===r&&'chairs'===e.builtIn?{...(0,o.defaultChairs)(r),rid:e.rid,updatedAt:f()}:e)})),setRules:(r,t)=>e(e=>({rules:{...e.rules,[r]:{...(0,o.clampRules)({...e.rules[r]??o.DEFAULT_BREAK_RULES,...t}),id:p(r),updatedAt:f()}}})),resetRules:r=>e(e=>({rules:{...e.rules,[r]:{...o.DEFAULT_BREAK_RULES,id:p(r),updatedAt:f()}}})),markDone:r=>e(e=>({done:[{...r,id:(0,l.uuid)(),at:r.at??f()},...e.done].slice(0,400)})),setSnooze:(r,t)=>e(e=>({snooze:Object.fromEntries([...Object.entries(e.snooze).filter(([,e])=>e>Date.now()-864e5),[r,t]])}))}),{name:'covercharge-reminders-v1',version:1,storage:(0,s.createJSONStorage)(()=>t.default)})),A=e=>(0,o.clampRules)(b.getState().rules[e]??o.DEFAULT_BREAK_RULES)},957,[1116,952,1117,1104,1108,1034]); +__d(function(_g,_r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SHIFT_FILTER_LABEL",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"NOTIF_DAY_NAMES",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"NOTIF_GROUP_LABEL",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"IN_APP_WINDOW_MINS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"PUSH_WINDOW_MINS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"KITCHEN_OPEN_DAYS",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"TITLE_MAX",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"MESSAGE_MAX",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"validHm",{enumerable:!0,get:function(){return u}}),e.ukNow=p,Object.defineProperty(e,"timeOn",{enumerable:!0,get:function(){return m}}),e.notifDue=function(t,n,r=s){const o=p(n),d=m(t,o.dow);if(t.paused||t.removed||!u(d)||!t.days.includes(o.dow))return{due:!1,forDate:o.ymd,at:d};const f=l(d);return{due:o.mins>=f&&o.minst.days.includes(n));if(!r.length)return'No days ticked';const s=new Map;for(const n of r){const r=m(t,n);s.set(r,[...s.get(r)??[],n])}const o=t=>7===t.length?'Every day':t.map(t=>n[t]).join(', ');return[...s.entries()].map(([t,n])=>`${o(n)} at ${t}`).join('; ')+' (UK time)'},e.validateNotif=function(t){if(!t.title.trim())return'Give it a name.';if(t.title.length>f)return`Keep the name under ${f} letters.`;if(!t.message.trim())return'Type the message people will see.';if(t.message.length>c)return`Keep the message under ${c} letters.`;if(!u(t.time))return'Type the time as HH:MM, e.g. 21:00.';for(const n of Object.values(t.dayTimes??{}))if(!u(n))return'Type each day\u2019s time as HH:MM.';return t.days.length?t.recipients.staff.length||t.recipients.groups.length||(t.recipients.onShiftIn??[]).length?t.sendBy.inApp||t.sendBy.push?null:'Choose how to send it.':'Tick at least one person or group.':'Tick at least one day.'},e.anchorageSeeds=function(t,n,r){const s={staff:[n,r].filter(Boolean),groups:[]},o={inApp:!0,push:!0};return[{id:t('mills-milk'),seed:'mills-milk',title:'Mills milk order',message:'Make sure an order before 9:30',days:[...d],time:'21:00',dayTimes:{5:'20:55',0:'20:55'},recipients:s,sendBy:o},{id:t('peronis'),seed:'peronis',title:"Pieroni's order",message:"order Pieroni's by phone",days:[...d],time:'21:05',recipients:s,sendBy:o},{id:t('veg-second'),seed:'veg-second',title:'Veg order',message:'Order veg on the app before 11 PM',days:[...d],time:'21:15',recipients:s,sendBy:o},{id:t('reeds'),seed:'reeds',title:'Reeds order',message:'Order reeds',days:[3,4],time:'21:25',recipients:s,sendBy:o},{id:t('spezbona'),seed:'spezbona',title:'Spes Bona order',message:'Do we need anything from Spes Bona for this week? Message Anna if we do for Friday delivery.',days:[3],time:'15:00',recipients:s,sendBy:o},{id:t('olsens'),seed:'olsens',title:"Olsen's order",message:"Place Olsen's order before 3:30 PM. By phone.",days:[2],time:'13:00',recipients:{staff:[r],groups:[]},sendBy:o},{id:t('allsons-list'),seed:'allsons-list',title:'Alsons drinks list',message:'Add anything extra to the Alsons drinks list.',days:[0],time:'20:00',recipients:{staff:['st-finn'],groups:[]},sendBy:o,open:{page:'orderlists',list:'allsons'}},{id:t('tea-towels'),seed:'tea-towels',title:'Tea towels',message:'Put a load of tea towels on to wash.',days:[...d],time:'15:00',recipients:{staff:[],groups:[],onShiftIn:['kp'],fallback:{staff:[],groups:['head_chef']}},sendBy:o},{id:t('rota-upload'),seed:'rota-upload',title:'Rota upload',message:"Make sure you have uploaded next week's rota.",days:[0],time:'20:50',recipients:s,sendBy:o}]};const t={kitchen:'On shift: Kitchen',foh:'On shift: Front of house',bar:'On shift: Bar',kp:'On shift: KPs',chefs:'On shift: Chefs'},n=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],r={on_shift:'Everyone on shift',everyone:'Everyone',managers:'Owners and managers',head_chef:'Head Chef',kitchen:'Kitchen team',foh:'Front of house'},s=120,o=15,d=[3,4,5,6,0],f=60,c=160,u=t=>/^([01]\d|2[0-3]):[0-5]\d$/.test(t),l=t=>60*Number(t.slice(0,2))+Number(t.slice(3,5));function p(t){const r='number'==typeof t?new Date(t):t,s={};for(const t of new Intl.DateTimeFormat('en-GB',{timeZone:'Europe/London',weekday:'short',year:'numeric',month:'2-digit',day:'2-digit',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}).formatToParts(r))s[t.type]=t.value;return{dow:n.indexOf(String(s.weekday).slice(0,3)),mins:60*Number(s.hour)+Number(s.minute),ymd:`${s.year}-${s.month}-${s.day}`}}const m=(t,n)=>{const r=t.dayTimes?.[String(n)];return r&&u(r)?r:t.time};const h=t=>t.open?`./?open=${t.open.page}${t.open.list?`&list=${encodeURIComponent(t.open.list)}`:''}`:'./',y=(t,n)=>`${t.id}:${n}`,g=t=>(t??'').toLowerCase(),b=t=>t.level?['owner','manager'].includes(g(t.level)):['owner','manager'].includes(g(t.role)),O=t=>'head_chef'===g(t.role)||'head chef'===g(t.level)||'chef'===g(t.app)||/head chef/.test(g(t.job)),P=t=>'kitchen'===g(t.department)||/chef|kitchen|kp|porter/.test(g(t.job))||O(t),k=t=>/\bkp\b|kitchen porter/.test(g(t.job));function j(t,n){const r=g(n.department);return'kitchen'===t?P(n):'kp'===t?k(n):'chefs'===t?O(n)||/chef|commis/.test(g(n.job)):'bar'===t?'bar'===r||/\bbar/.test(g(n.job)):'front of house'===r||!r&&!P(n)&&!b(n)}function _(t,n,r=[]){const s=v(t.recipients,n,r),o=t.recipients.fallback;return s.length||!o?s:v({staff:o.staff,groups:o.groups},n,r)}const w=(t,n,r=[])=>!!t.recipients.fallback&&!v(t.recipients,n,r).length;function v(t,n,r){const s=t,o=n.filter(t=>!1!==t.active),d=new Set;for(const t of s.staff)o.some(n=>n.id===t)&&d.add(t);for(const t of s.groups)for(const n of o)('everyone'===t||'on_shift'===t&&r.includes(n.id)||'managers'===t&&b(n)||'head_chef'===t&&O(n)||'kitchen'===t&&P(n)||'foh'===t&&!P(n)&&!b(n))&&d.add(n.id);for(const t of s.onShiftIn??[])for(const n of o)r.includes(n.id)&&j(t,n)&&d.add(n.id);return[...d].sort()}const M=t=>({id:t.external_ref,role:t.roles?.key??void 0,job:t.job_title??'',department:t.department??'',active:!1!==t.active}),T=(t,n,r,s=[])=>_(t,r,s).includes(n)},958,[]); +__d(function(g,_r,i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.shiftNow=l,e.useShiftReminders=function({rid:c,staffId:k,name:h,kitchen:b,onStartBreak:S}){const D=(0,t.useRef)(S);D.current=S;const I=(0,t.useRef)(h);I.current=h;const v=(0,s.useReminders)(t=>`${t.reminders.length}:${t.done.length}:${JSON.stringify(t.rules[c]??{})}:${t.reminders.map(t=>t.updatedAt??'').join()}`),w=(0,r.useOwner)(t=>`${t.attendance.length}:${t.shifts.length}`);(0,t.useEffect)(()=>{s.useReminders.getState().ensure(c);const t=()=>{const t=u(),{att:h,shift:S,on:v}=l(k,t),w=s.useReminders.getState();if(!v||!k)return w.reminders.forEach(t=>(0,a.dismissNotice)(`rem:${t.id}`)),void(0,a.dismissNotice)('break-reminder');const R=(0,s.rulesOf)(c),$=h?.in?new Date(h.in).getTime():void 0,p=!!h?.breaks?.length,y=`break:${h?.id??S?.id??''}`,M=(0,o.breakDue)({now:t,clockIn:$,shiftStart:S?m(S.date,S.start):void 0,shiftEnd:S?m(S.date,S.end):void 0,rotaBreak:void 0!==S?.breakAt?m(S.date,S.breakAt):void 0,hadBreak:p,rules:R},w.snooze[y]??0);if(M){const r=$??(S?m(S.date,S.start):t);(0,a.notify)({id:'break-reminder',tone:3===M.stage?'warn':'normal',icon:'\ud83e\uded6',kicker:'BREAK REMINDER',testID:'break-reminder',timeoutMs:null,title:M.label,body:`${$?'Clocked in':'Shift started'} at ${f(r)}. ${3===M.stage?'':'Over 6 hours needs a 20-minute break.'}`.trim(),actions:[{label:'Start break',testID:'break-reminder-start',onPress:()=>{if(!h)return D.current?.(),void(0,a.notify)({id:'break-clock-first',title:'Clock in first, then tap Start break.',body:'Your break is started from the clock screen.',timeoutMs:6e3});const t=new Date(u()).toISOString();(0,n.clockAction)('break_start',{rid:c,staffId:k,date:t.slice(0,10),at:t}).then(t=>{t.ok||(0,a.notify)({id:'break-blocked',tone:'warn',title:'Break not started',body:t.message,timeoutMs:1e4}),D.current?.()})}},{label:'Later',kind:'ghost',testID:'break-reminder-later',onPress:()=>s.useReminders.getState().setSnooze(y,u()+6e4*R.snoozeMins)}]})}else(0,a.dismissNotice)('break-reminder');const N=r.useOwner.getState().staff.find(t=>t.id===k),O=b??(0,d.inKitchen)(N);for(const n of w.reminders){if(n.rid!==c)continue;const r=`rem:${n.id}`;if(n.removed||!(0,o.audienceMatch)(n.audience,O)){(0,a.dismissNotice)(r);continue}const{due:d,forDate:f}=(0,o.reminderDue)(n,t),m=w.done.find(t=>t.reminderId===n.id&&t.forDate===f),l=`rem:${n.id}:${f}`;!d||m||(w.snooze[l]??0)>t?(0,a.dismissNotice)(r):(0,a.notify)({id:r,icon:'\ud83e\ude91',kicker:'REMINDER',title:n.text,testID:'venue-reminder',timeoutMs:null,body:`For everyone on shift${'all'===n.audience?'':'kitchen'===n.audience?' in the kitchen':' front of house'}. Tap Done once it\u2019s done.`,actions:[{label:'Done',testID:'venue-reminder-done',onPress:()=>s.useReminders.getState().markDone({rid:c,reminderId:n.id,forDate:f,at:new Date(u()).toISOString(),staffRef:k,staffName:I.current.replace(' (example)','')})},{label:'Later',kind:'ghost',onPress:()=>s.useReminders.getState().setSnooze(l,u()+6e4*R.snoozeMins)}]})}};t();const h=setInterval(t,2e4);return()=>clearInterval(h)},[c,k,v,w,b])};var t=_r(_d[0]),n=_r(_d[1]),r=_r(_d[2]),s=_r(_d[3]),o=_r(_d[4]),a=_r(_d[5]),d=_r(_d[6]),c=_r(_d[7]);const u=()=>{try{return(0,c.nowFrom)(c.useStore.getState().clock).getTime()}catch{return Date.now()}},f=t=>new Date(t).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}),m=(t,n)=>{const[r,s,o]=t.split('-').map(Number);return new Date(r,s-1,o,Math.floor(n),Math.round(n%1*60)).getTime()};function l(t,n){const s=r.useOwner.getState(),a=(0,r.openShiftOf)(s.attendance,t,new Date(n)),d=(0,o.ukClock)(n).ymd,c=s.shifts.find(r=>r.staffId===t&&r.date===d&&!1!==r.published&&m(r.date,r.start)<=n&&nn.staffId===t&&n.date===d&&!1!==n.published):void 0),u=!a&&!!c&&s.attendance.some(n=>n.staffId===t&&n.date===d&&!!n.out&&new Date(n.out).getTime()>=m(c.date,c.start));return{att:a,shift:c,on:!!a||!!c&&!u}}},959,[30,1103,856,957,1108,947,1118,872]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"START_PAIR",{enumerable:!0,get:function(){return t}});const t=(()=>{try{if('undefined'==typeof window||!window.location)return null;const t=new URL(window.location.href),n=new URLSearchParams(t.hash.replace(/^#/,'')),c=t.searchParams.get('pair')||n.get('pair');if(!c)return null;t.searchParams.delete('pair'),n.delete('pair');const o=n.toString();return window.history.replaceState(null,'',t.pathname+(t.search?t.search:'')+(o?`#${o}`:'')),c}catch{return null}})()},960,[]); +__d(function(_g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PUB_LOCATIONS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"privateClockVenue",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"pubLocation",{enumerable:!0,get:function(){return s}}),e.venueClockArea=function(a,o={}){if((0,t.isQueuedVenue)(a)&&!t.queuedVenues[a].clockArea.on)return(0,n.cleanArea)({...o,on:!0===o.on&&'number'==typeof o.lat&&'number'==typeof o.lng,offRotaPrompt:!1});const l=s(a);if(!l)return(0,n.cleanArea)(o);const c=(0,n.cleanArea)({lat:l.lat,lng:l.lng,radius:150,...o});return{...c,lat:c.lat??l.lat,lng:c.lng??l.lng,on:!0,offRotaPrompt:!1}},e.venueClockGeo=l,e.privateAttendance=function(n,a){if(!o(n)&&!(0,t.isQueuedVenue)(n))return a;const s={...a};for(const t of['lat','lng','latitude','longitude','coords','position','location','acc','dist','accuracy','distance','outSite'])delete s[t];a.geo&&(s.geo=a.geo.map(t=>l(n,t)).filter(t=>!!t));return s};var t=r(d[0]),n=r(d[1]);const a={"3idiots":{name:"3 Idiots",address:"10 George Street, Ayr, KA8 0BL",lat:55.4650286,lng:-4.6283062,source:"Verified exact-address venue pack"},cecchinis:{name:"Cecchinis",address:"72 Fort Street, Wellington Square, Ayr, South Ayrshire KA7 1EH",lat:55.461505,lng:-4.6345736,source:"Verified exact-address venue pack"},williewastles:{name:"Willie Wastle's",address:"16-18 New Bridge Street, Ayr, South Ayrshire, KA7 1JX",lat:55.4646261,lng:-4.6323929,source:"Verified exact-address venue pack"},smokinggoat:{name:"Smoking Goat",address:"2A Academy Street, Ayr KA7 1HS",lat:55.464226,lng:-4.6326035,source:"Verified exact-address venue pack"},drunkencoo:{name:"The Drunken Coo",address:"22 Beresford Terrace, Ayr KA7 2EG",lat:55.4570308,lng:-4.6294663,source:"Verified exact-address venue pack"},abbotsford:{name:'The Abbotsford Hotel',address:'14 Corsehill Road, Ayr KA7 2ST',lat:55.4488797,lng:-4.6314856,source:'Official FSA1696388, exact address match verified6 Nov2026'},kirkton:{name:'The Kirkton Inn',address:'1-3 Main Street, Dalrymple, East Ayrshire KA6 6DF',lat:55.3971215,lng:-4.5920177,source:'Public FSA establishment1955433 verified6 November2026'},greenside:{name:'The Greenside Restaurant',address:'5 Greenside, Maybole, South Ayrshire KA19 7DG',lat:55.3542369,lng:-4.6851418,source:'Official Find us Google Maps link, place point, verified 6 November 2026'},kirkmichael:{name:'The Kirkmichael Arms',address:'3-5 Straiton Road, Kirkmichael, South Ayrshire KA19 7PH',lat:55.3458202,lng:-4.6180793,source:'venue-profile.json geo, matched to the venue address'},souters:{name:"Souter\u2019s Inn",address:'47 Main Road, Kirkoswald, South Ayrshire KA19 8HY',lat:55.3297218,lng:-4.7772979,source:'Food Standards Agency establishment 1863840, address matched'}},o=t=>Object.prototype.hasOwnProperty.call(a,t),s=t=>o(t)?a[t]:void 0;function l(n,a){return o(n)||(0,t.isQueuedVenue)(n)?'in'===a.action?{action:'in',at:a.at,inside:a.inside,...a.override?{override:{by:a.override.by,byId:a.override.byId,reason:a.override.reason}}:{}}:void 0:a}},989,[6,954]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.WhoBar=function(){const e=(0,n.useSignedIn)();if(!e)return null;const l=`Signed in as ${e.name.replace(' (example)','')}${e.level?` \xb7 ${e.level}`:''}`;return(0,o.jsx)(s.default,{testID:"who-bar",accessible:!0,accessibilityLabel:l,style:{paddingVertical:4},children:(0,o.jsx)(c.T,{size:18,weight:"semibold",colour:t.colours.gold,children:l})})},r(d[0]);var e,l=r(d[1]),s=(e=l)&&e.__esModule?e:{default:e},n=r(d[2]),t=r(d[3]),c=r(d[4]),o=r(d[5])},990,[30,127,927,821,813,24]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"currentScrollY",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"screenGeneration",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"restoreScroll",{enumerable:!0,get:function(){return o}}),_e.useScrollMemory=function(u){const c=(0,e.useRef)(0),o=(0,e.useRef)(0),l=(0,e.useRef)(0),s=(0,e.useRef)(0),f=(0,e.useRef)(0),v=(0,e.useRef)(null),y=(0,e.useRef)([]),h=()=>{y.current.forEach(clearTimeout),y.current=[]},b=()=>{const e=v.current;null!=e&&(u.current?.scrollTo({y:e,animated:!1}),f.current-s.current>=e-2&&(c.current=e,o.current=e,v.current=null,h()))},p=(0,e.useCallback)(e=>{if(h(),v.current=Math.max(0,e),e<=0)return v.current=null,u.current?.scrollTo({y:0,animated:!1}),c.current=0,void(o.current=0);for(const e of[0,30,80,160,320,600,1e3,1600,2500])y.current.push(setTimeout(b,e));y.current.push(setTimeout(()=>{v.current=null},2600))},[]);t={y:()=>o.current,restore:p};const R=(0,e.useCallback)(()=>{n++;return o.current},[]);return{props:{scrollEventThrottle:32,onScroll:e=>{const t=e.nativeEvent.contentOffset.y;c.current=t,s.current=e.nativeEvent.layoutMeasurement.height,f.current=e.nativeEvent.contentSize.height,Date.now()-l.current>250&&null==v.current&&(o.current=t)},onScrollBeginDrag:()=>{v.current=null,h()},onContentSizeChange:(e,t)=>{f.current=t,l.current=Date.now(),b()},onLayout:e=>{s.current=e.nativeEvent.layout.height}},restore:p,leave:R}};var e=r(d[0]);let t=null,n=0;const u=()=>t?t.y():0,c=()=>n,o=e=>t?.restore(e)},991,[30]); +__d(function(_g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useBackLayers",{enumerable:!0,get:function(){return y}}),_e.runBackLayer=function(){const e=y.getState().layers,t=e[e.length-1];return!!t&&(t.fn(),!0)},_e.useBackLayer=function(t,n,s=!0){const o=(0,e.useRef)(n);o.current=n,(0,e.useEffect)(()=>{if(!t)return;const e=++w,n=(0,l.currentScrollY)(),c=(0,l.screenGeneration)();return y.setState(t=>({layers:[...t.layers,{id:e,fn:()=>o.current(),own:s}]})),()=>{y.setState(t=>({layers:t.layers.filter(t=>t.id!==e)})),(0,l.screenGeneration)()===c&&(0,l.restoreScroll)(n)}},[t,s])},Object.defineProperty(_e,"useInnerBackShown",{enumerable:!0,get:function(){return h}}),_e.BackButton=function({onPress:e,testID:t="screen-back",label:n="Back"}){return(0,f.jsx)(s.default,{testID:t,accessibilityRole:"button",accessibilityLabel:n,onPress:e,hitSlop:8,style:({pressed:e})=>({minHeight:48,minWidth:96,justifyContent:'center',paddingRight:12,opacity:e?.6:1,alignSelf:'flex-start'}),children:(0,f.jsxs)(u.T,{size:18,weight:"semibold",colour:c.colours.gold,children:["\u2039 ",n]})})},_e.useWebBack=function(t){const n=(0,e.useRef)(t);n.current=t,(0,e.useEffect)(()=>{if('undefined'==typeof window||!window.history?.pushState)return;const e=()=>{try{window.history.pushState({...window.history.state??{},ccBack:Date.now()},'',window.location.href)}catch{}};e();const t=t=>{n.current()&&(t.stopImmediatePropagation?.(),e())};return window.addEventListener('popstate',t,!0),()=>window.removeEventListener('popstate',t,!0)},[])};var e=r(d[0]);r(d[1]);var t,n=r(d[2]),s=(t=n)&&t.__esModule?t:{default:t},o=r(d[3]),c=r(d[4]),u=r(d[5]),l=r(d[6]),f=r(d[7]);const y=(0,o.create)(()=>({layers:[]}));let w=0;const h=()=>y(e=>e.layers.some(e=>e.own))},992,[30,122,263,952,821,813,991,24]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.SoldOutList=function({rid:e,by:n,canMark:a=!0}){const f=(0,r.useSoldOut)(e=>e.entries),b=(0,i.useStore)(e=>e.clock),j=(0,i.useStore)(e=>e.menu),w=(0,i.useStore)(t=>t.restaurants.find(t=>t.id===e)),[S,I]=(0,s.useState)(''),$=(0,h.nowFrom)(b),C=(0,d.activeSoldOut)(f,e,$),D=new Set(C.map(e=>e.itemId)),M=(0,d.soldOutSettingsOf)(w?.settings?.soldOut),T=(0,u.useAutoSoldOutView)(e),L=f.filter(t=>t.rid===e&&!t.on&&t.kept&&T.reason(t.itemId)),v=(0,s.useMemo)(()=>j.filter(t=>t.restaurantId===e&&!t.hidden&&!D.has(t.id)&&(!S.trim()||t.name.toLowerCase().includes(S.trim().toLowerCase()))).sort((e,t)=>e.name.localeCompare(t.name)),[j,e,S,C.length]),B=(t,s)=>{const o=f.some(s=>s.rid===e&&s.itemId===t&&s.auto&&T.reason(t));j.some(e=>e.id===t)?(0,r.setSoldOut)(t,!1,n):r.useSoldOut.getState().back(e,t,n),x(`Back on: ${s}${o?' (kept on until the count changes)':''}`)};return(0,y.jsxs)(o.default,{testID:"soldout-list",style:{gap:10},children:[(0,y.jsx)(l.Muted,{children:"A reminder for staff. Dishes you mark sold out show on the Display and in the Sold out list in every staff app, within seconds. It doesn't change your till."}),(0,y.jsxs)(l.Card,{children:[(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'center'},wrap:!0,children:[(0,y.jsx)(l.T,{weight:"semibold",size:17,children:"Sold out now"}),(0,y.jsx)(l.T,{size:13,colour:C.length?m.colours.amber:m.colours.muted,children:C.length?(0,d.soldOutCount)(C.length):'Nothing sold out'})]}),C.length?C.map(e=>(0,y.jsxs)(o.default,{testID:`soldout-row-${e.itemId}`,style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'space-between',alignItems:'center',paddingVertical:6,borderTopWidth:1,borderTopColor:m.colours.border},children:[(0,y.jsxs)(o.default,{style:{flexShrink:1,flexGrow:1,flexBasis:160,gap:2},children:[(0,y.jsx)(l.T,{weight:"semibold",children:(0,c.withReason)(e.name,T.reason(e.itemId))}),(0,y.jsxs)(l.Muted,{children:["Since ",k(e.at),e.auto?' \xb7 Auto, from the counts \xb7 clears when the count is back up':`${e.by?` \xb7 ${e.by}`:''}${e.clearAfter?` \xb7 clears at ${k(e.clearAfter)}`:''}`]})]}),a?(0,y.jsx)(l.Button,{small:!0,kind:"secondary",label:"Back on",testID:`soldout-back-${e.itemId}`,accessibilityLabel:`Back on: ${e.name}`,onPress:()=>B(e.itemId,e.name)}):null]},e.itemId)):(0,y.jsx)(l.Muted,{children:"When a dish runs out, mark it here so everyone knows."}),L.length?(0,y.jsx)(o.default,{testID:"soldout-kept",children:(0,y.jsxs)(l.Muted,{children:["Kept on by hand while the count is short: ",L.map(e=>e.name).join(', '),". They stay on until the count changes."]})}):null,(0,y.jsxs)(l.Muted,{children:["Clears by itself: ",d.SOLD_OUT_CLEAR_LABEL[M.clear].toLowerCase(),". ",M.auto?'Dishes marked from the counts clear when the count is back up. ':'',"Managers can change this in Settings \u203a Advanced."]})]}),T.items.length?(0,y.jsx)(p,{rid:e,by:n,canEdit:a,auto:M.auto,view:T}):null,a?(0,y.jsxs)(l.Card,{children:[(0,y.jsx)(l.T,{weight:"semibold",size:17,children:"Mark a dish sold out"}),(0,y.jsx)(t.TextInput,{testID:"soldout-search",value:S,onChangeText:I,placeholder:"Find a dish",placeholderTextColor:m.colours.muted,accessibilityLabel:"Find a dish",style:{minHeight:46,borderRadius:12,borderWidth:1,borderColor:m.colours.accentBorder,backgroundColor:m.colours.surface2,color:m.colours.text,paddingHorizontal:12,fontSize:16}}),v.slice(0,60).map(e=>(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingVertical:4},wrap:!0,children:[(0,y.jsxs)(o.default,{style:{flexShrink:1,flexGrow:1,flexBasis:160},children:[(0,y.jsx)(l.T,{children:e.name}),(0,y.jsx)(l.Muted,{children:e.section})]}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"Mark sold out",testID:`soldout-mark-${e.id}`,accessibilityLabel:`Mark sold out: ${e.name}`,onPress:()=>{return t=e.id,s=e.name,(0,r.setSoldOut)(t,!0,n),void x(`Sold out: ${s}`);var t,s}})]},e.id)),v.length?null:(0,y.jsx)(l.Muted,{children:S?'No dish matches that.':'Every dish is marked sold out.'})]}):null]})};var e,t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),o=(e=n)&&e.__esModule?e:{default:e},l=_r(_d[3]),i=_r(_d[4]),r=_r(_d[5]),a=_r(_d[6]),d=_r(_d[7]),u=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),m=_r(_d[11]),y=_r(_d[12]);const k=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`},x=e=>{const t=new Date(globalThis.__ccNow??Date.now()).toISOString();for(const s of['kitchen','foh'])a.useOwner.getState().sys(s,e,t)};const f={link:'set by staff',card:'from its recipe card',description:'from its description',name:'from its name',none:''},b=e=>.5===e?'\xbd':Number.isInteger(e)?String(e):`${Math.floor(e)}\xbd`;function p({rid:e,by:t,canEdit:n,auto:i,view:r}){const[a,d]=(0,s.useState)(!1),[h,k]=(0,s.useState)(null),[x,p]=(0,s.useState)([]),j=r.dishes.filter(t=>t.uses.length||'none'===t.source&&r.links.some(s=>s.rid===e&&s.itemId===t.id&&!s.auto)),w=(a?r.dishes:j).slice().sort((e,t)=>e.name.localeCompare(t.name)),S=r.items.map(e=>`${e.name.toLowerCase()} ${b(r.counts[e.key]??0)}`).join(', '),I=(e,t,s)=>p(n=>n.map(n=>n.key===e?{...n,qty:Math.max(0,Math.min(20,n.qty+s*('half'===t.unit?.5:1)))}:n)),$=(s,n)=>{u.useSoldOutLinks.getState().setLink(e,s,n,t),k(null)};return(0,y.jsx)(o.default,{testID:"soldout-links",children:(0,y.jsxs)(l.Card,{children:[(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'center'},wrap:!0,children:[(0,y.jsx)(l.T,{weight:"semibold",size:17,children:"Dishes linked to the counts"}),(0,y.jsx)(o.default,{testID:"soldout-links-counts",children:(0,y.jsxs)(l.T,{size:13,colour:m.colours.muted,children:["Counts now: ",S]})})]}),(0,y.jsx)(l.Muted,{children:i?'When a count runs out, or drops below what a dish needs, the dish is marked sold out by itself, and put back on when the count is back up. Dishes you mark by hand are left alone.':'Marking dishes from the counts is off for this venue (Settings \u203a Advanced \u203a Sold out reminders).'}),w.map(e=>(0,y.jsxs)(o.default,{testID:`soldout-link-${e.id}`,style:{paddingVertical:6,borderTopWidth:1,borderTopColor:m.colours.border,gap:6},children:[(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'center'},wrap:!0,children:[(0,y.jsxs)(o.default,{style:{flexShrink:1,flexGrow:1,flexBasis:160},children:[(0,y.jsx)(l.T,{weight:"semibold",children:e.name}),(0,y.jsxs)(l.Muted,{children:[e.uses.length?`Uses ${(0,c.usesText)(e.uses,r.items)}`:'Not linked to the counts',f[e.source]?` \xb7 ${f[e.source]}`:'']})]}),n&&h!==e.id?(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"Change",testID:`soldout-link-edit-${e.id}`,accessibilityLabel:`Change what ${e.name} uses`,onPress:()=>{return t=e.id,s=e.uses,k(t),void p(r.items.map(e=>({key:e.key,qty:s.find(t=>t.key===e.key)?.qty??0})));var t,s}}):null]}),h===e.id?(0,y.jsxs)(o.default,{style:{gap:6},children:[r.items.map(t=>{const s=x.find(e=>e.key===t.key)?.qty??0;return(0,y.jsxs)(l.Row,{style:{alignItems:'center',gap:8},children:[(0,y.jsx)(l.T,{style:{flexGrow:1},children:t.name}),(0,y.jsx)(l.Button,{small:!0,kind:"secondary",label:"\u2013",testID:`soldout-link-${e.id}-${t.key}-minus`,accessibilityLabel:`Fewer ${t.plural.toLowerCase()}`,onPress:()=>I(t.key,t,-1)}),(0,y.jsx)(o.default,{testID:`soldout-link-${e.id}-${t.key}-qty`,style:{minWidth:28},children:(0,y.jsx)(l.T,{weight:"semibold",style:{textAlign:'center'},children:b(s)})}),(0,y.jsx)(l.Button,{small:!0,kind:"secondary",label:"+",testID:`soldout-link-${e.id}-${t.key}-plus`,accessibilityLabel:`More ${t.plural.toLowerCase()}`,onPress:()=>I(t.key,t,1)})]},t.key)}),(0,y.jsxs)(l.Muted,{children:["Per portion. ",x.some(e=>e.qty>0)?`Uses ${(0,c.usesText)(x.filter(e=>e.qty>0),r.items)}.`:'Not linked: never marked from the counts.']}),(0,y.jsxs)(l.Row,{style:{gap:8},wrap:!0,children:[(0,y.jsx)(l.Button,{small:!0,label:"Save",testID:`soldout-link-save-${e.id}`,onPress:()=>$(e.id,x.filter(e=>e.qty>0))}),(0,y.jsx)(l.Button,{small:!0,kind:"secondary",label:"Back to automatic",testID:`soldout-link-reset-${e.id}`,accessibilityLabel:`Back to automatic: ${e.guess.length?(0,c.usesText)(e.guess,r.items):'not linked'}`,onPress:()=>$(e.id,null)}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>k(null)})]}),(0,y.jsxs)(l.Muted,{children:["Automatic: ",e.guess.length?(0,c.usesText)(e.guess,r.items):'not linked'," (from the recipe card, description or name)."]})]}):null]},e.id)),w.length?null:(0,y.jsx)(l.Muted,{children:"No dish is linked yet."}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:a?'Show linked dishes only':'Link another dish',testID:"soldout-links-all",onPress:()=>d(!a)})]})})}},993,[877,30,127,813,819,918,856,944,942,943,872,821,24]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"APP_VERSION",{enumerable:!0,get:function(){return t}});const t='v0.3.12.77'},994,[]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useTasksProgress=function(e,s){const t=(0,d.useDailyTasks)(t=>t.people[(0,d.personKey)(e,s)]?.tasks)??[],i=(0,d.useDailyTasks)(e=>e.ticks),{ymd:l,dow:o}=b();return(0,r.progress)(t,i,s,l,o)},_e.DailyTasksEditor=T,_e.MyTasksToday=function({rid:e,staffId:s,name:t,onShift:c}){const u=(0,d.useDailyTasks)(t=>t.people[(0,d.personKey)(e,s)]?.tasks)??[],h=(0,d.useDailyTasks)(e=>e.ticks),{ymd:y,dow:k}=b(),p=(0,r.tasksFor)(u,k);if(!s||!p.length)return null;const T=(0,r.progress)(u,h,s,y,k);return(0,x.jsx)(l.default,{testID:"my-tasks-today",children:(0,x.jsxs)(o.Card,{children:[(0,x.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(o.T,{weight:"semibold",colour:n.colours.gold,children:"My tasks today"}),(0,x.jsx)(o.Badge,{kind:T.done===T.total?'gold':'neutral',label:`${T.done} of ${T.total}`})]}),c?null:(0,x.jsx)(o.Muted,{size:12,children:"You\u2019re not on shift right now. You can still tick these when you are."}),p.map(r=>{const u=h.find(t=>t.id===(0,d.tickId)(e,s,r.id,y));return(0,x.jsxs)(i.default,{testID:`my-task-${r.id}`,accessibilityRole:"checkbox",accessibilityState:{checked:!!u},disabled:!c,onPress:()=>d.useDailyTasks.getState().toggleTick(e,s,r.id,y,{id:s,name:t.replace(' (example)','')}),style:{flexDirection:'row',alignItems:'center',gap:10,paddingVertical:8,opacity:c?1:.6},children:[(0,x.jsx)(l.default,{style:{width:24,height:24,borderRadius:6,borderWidth:1.5,borderColor:n.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:u?'#2a2414':'transparent'},children:u?(0,x.jsx)(o.T,{colour:n.colours.gold,children:"\u2713"}):null}),(0,x.jsxs)(l.default,{style:{flex:1},children:[(0,x.jsx)(o.T,{style:{textDecorationLine:u?'line-through':'none'},children:r.text}),u?(0,x.jsxs)(o.Muted,{size:12,children:["Done at ",f(u.at)]}):null]})]},r.id)}),(0,x.jsx)(o.Muted,{size:12,children:"Tip: tick each one as you finish it. Your manager sees how you\u2019re getting on. They start fresh every day."})]})})},_e.TaskLibrarySettings=function({rid:e}){(0,t.useEffect)(()=>{d.useDailyTasks.getState().ensure(e)},[e]);const i=(0,d.useDailyTasks)(s=>s.library[e]?.items)??[],[c,u]=(0,t.useState)(''),[y,p]=(0,t.useState)({}),f=d.useDailyTasks.getState(),b=s=>f.setLibrary(e,s);return(0,x.jsxs)(l.default,{style:{gap:8},testID:"task-library",children:[(0,x.jsx)(o.Muted,{size:13,children:"Tip: these are quick picks when you add someone\u2019s daily tasks (Staff & roles \u203a a person \u203a Daily tasks). You can always type a new one there too."}),i.map((e,t)=>(0,x.jsxs)(o.Row,{gap:6,style:{opacity:e.archived?.5:1},children:[(0,x.jsx)(s.TextInput,{accessibilityLabel:`Rename ${e.text}`,value:y[e.id]??e.text,onChangeText:s=>p(t=>({...t,[e.id]:s})),onBlur:()=>{const s=(0,r.cleanTaskText)(y[e.id]??'');s&&s!==e.text&&b(i.map(t=>t.id===e.id?{...t,text:s}:t))},style:{...k,flex:1,minWidth:0}}),(0,x.jsx)(o.Button,{small:!0,kind:"ghost",label:"\u2191",disabled:0===t,onPress:()=>b((0,r.move)(i,t,-1))}),(0,x.jsx)(o.Button,{small:!0,kind:"ghost",label:"\u2193",disabled:t===i.length-1,onPress:()=>b((0,r.move)(i,t,1))}),(0,x.jsx)(o.Button,{small:!0,kind:"ghost",label:e.archived?'Bring back':'Archive',onPress:()=>b(i.map(s=>s.id===e.id?{...s,archived:!s.archived}:s))})]},e.id)),(0,x.jsxs)(o.Row,{gap:6,children:[(0,x.jsx)(s.TextInput,{accessibilityLabel:"New library task",testID:"task-lib-new",value:c,onChangeText:u,placeholder:"e.g. Check the beer garden",placeholderTextColor:n.colours.muted,style:{...k,flex:1}}),(0,x.jsx)(o.Button,{small:!0,label:"Add",disabled:!(0,r.cleanTaskText)(c),onPress:()=>{b([...i,{id:(0,h.uuid)(),text:(0,r.cleanTaskText)(c)}]),u('')}})]})]})},_e.KitchenTeamTasks=function({rid:e,actor:s}){const t=(0,y.useOwner)(e=>e.staff).filter(e=>e.active&&s&&(0,r.canEditTasks)(s,e));return(0,x.jsxs)(l.default,{style:{gap:10},testID:"kitchen-team-tasks",children:[(0,x.jsx)(o.Muted,{size:13,children:"Tip: set the daily tasks for your kitchen team here. They see them as \u2018My tasks today\u2019 when they\u2019re on shift and tick them off. Your own list and front of house lists are set by a manager."}),s?null:(0,x.jsx)(o.Muted,{children:"Sign in to change your team\u2019s tasks."}),s&&!t.length?(0,x.jsx)(o.Muted,{children:"No kitchen staff found. A manager can set each person\u2019s department in Staff & roles."}):null,t.map(t=>(0,x.jsxs)(o.Card,{children:[(0,x.jsx)(o.T,{weight:"semibold",children:(0,y.staffLabel)(t).replace(' (example)','')}),(0,x.jsxs)(o.Muted,{size:12,children:[t.job,t.dept?` \xb7 ${t.dept}`:'']}),(0,x.jsx)(T,{rid:e,person:t,actor:s})]},t.id))]})};var s=_r(_d[0]),t=_r(_d[1]),i=e(_r(_d[2])),l=e(_r(_d[3])),o=_r(_d[4]),n=_r(_d[5]),d=_r(_d[6]),r=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),y=_r(_d[11]),x=_r(_d[12]);const k={minHeight:42,borderRadius:10,borderWidth:1,borderColor:n.colours.hairline,backgroundColor:n.colours.surface2,color:n.colours.text,paddingHorizontal:10,fontSize:15},p=[1,2,3,4,5,6,0],f=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}),b=(e=Date.now())=>{const s=(0,c.ukClock)(e);return{ymd:s.ymd,dow:new Date(`${s.ymd}T12:00:00Z`).getUTCDay()}};function T({rid:e,person:c,actor:h}){(0,t.useEffect)(()=>{d.useDailyTasks.getState().ensure(e)},[e]);const y=(0,d.useDailyTasks)(s=>s.people[(0,d.personKey)(e,c.id)]?.tasks)??[],T=((0,d.useDailyTasks)(s=>s.library[e]?.items)??[]).filter(e=>!e.archived),j=(0,d.useDailyTasks)(e=>e.ticks),[w,D]=(0,t.useState)(!1),[v,S]=(0,t.useState)(''),[C,$]=(0,t.useState)(null),I=d.useDailyTasks.getState(),M=(0,r.canEditTasks)(h,c),{ymd:P,dow:R}=b(),L=(0,r.progress)(y,j,c.id,P,R),B=s=>I.setTasks(e,c.id,s),z=e=>{const s=y;B(y.filter(s=>s.id!==e.id)),(0,u.notify)({id:`task-undo-${e.id}`,title:`Removed \u201c${e.text}\u201d`,timeoutMs:8e3,actions:[{label:'Undo',testID:'task-undo',onPress:()=>B(s)}]})};return(0,x.jsxs)(l.default,{testID:`tasks-${c.id}`,style:{gap:6},children:[(0,x.jsx)(i.default,{accessibilityRole:"button",testID:`tasks-open-${c.id}`,onPress:()=>D(!w),children:(0,x.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsxs)(o.T,{weight:"semibold",colour:n.colours.gold,children:["Daily tasks ",w?'\u25b4':'\u25be']}),(0,x.jsx)(o.Muted,{size:12,children:y.length?`${L.done} of ${L.total} done today`:'None yet'})]})}),w?(0,x.jsxs)(l.default,{style:{gap:6},children:[y.map((s,t)=>{const i=j.find(t=>t.id===(0,d.tickId)(e,c.id,s.id,P));return(0,x.jsxs)(l.default,{testID:`task-row-${t}`,style:{borderTopWidth:1,borderColor:n.colours.hairline,paddingTop:6,gap:4},children:[(0,x.jsxs)(o.Row,{gap:6,children:[(0,x.jsxs)(o.T,{style:{flex:1},colour:i?n.colours.gold:n.colours.text,children:[i?'\u2713 ':'',s.text]}),M?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(o.Button,{small:!0,kind:"ghost",label:"\u2191",accessibilityLabel:`Move ${s.text} up`,disabled:0===t,onPress:()=>B((0,r.move)(y,t,-1))}),(0,x.jsx)(o.Button,{small:!0,kind:"ghost",label:"\u2193",accessibilityLabel:`Move ${s.text} down`,disabled:t===y.length-1,onPress:()=>B((0,r.move)(y,t,1))}),(0,x.jsx)(o.Button,{small:!0,kind:"ghost",label:"Days",onPress:()=>$(C===s.id?null:s.id)}),(0,x.jsx)(o.Button,{small:!0,kind:"ghost",testID:`task-remove-${t}`,label:"\u2715",accessibilityLabel:`Remove ${s.text}`,onPress:()=>z(s)})]}):null]}),(0,x.jsxs)(o.Muted,{size:12,children:[s.days?.length?s.days.map(e=>r.TASK_DAY_NAMES[e]).join(', '):'Every day',i?` \xb7 ticked by ${i.byName.split(' ')[0]} at ${f(i.at)}`:'']}),C===s.id?(0,x.jsx)(o.Row,{wrap:!0,gap:4,children:p.map(e=>{const t=!!s.days?.includes(e);return(0,x.jsx)(o.Chip,{label:r.TASK_DAY_NAMES[e],selected:t,onPress:()=>B(y.map(i=>i.id===s.id?{...i,days:t?(i.days??[]).filter(s=>s!==e):[...i.days??[],e].sort()}:i))},e)})}):null]},s.id)}),M?(0,x.jsxs)(l.default,{style:{gap:6},children:[(0,x.jsx)(o.Row,{wrap:!0,gap:4,children:T.filter(e=>!y.some(s=>s.text.toLowerCase()===e.text.toLowerCase())).slice(0,12).map(s=>(0,x.jsx)(o.Chip,{testID:"task-lib-chip",label:`${s.text}`,onPress:()=>I.addTask(e,c.id,s.text,s.id)},s.id))}),(0,x.jsxs)(o.Row,{gap:6,children:[(0,x.jsx)(s.TextInput,{accessibilityLabel:"New task",testID:`task-new-${c.id}`,value:v,onChangeText:S,placeholder:"Type a task, e.g. Restock the bar fridges",placeholderTextColor:n.colours.muted,style:{...k,flex:1},onSubmitEditing:()=>{(0,r.cleanTaskText)(v)&&(I.addTask(e,c.id,v),S(''))}}),(0,x.jsx)(o.Button,{small:!0,testID:`task-add-${c.id}`,label:"Add",disabled:!(0,r.cleanTaskText)(v),onPress:()=>{I.addTask(e,c.id,v),S('')}})]})]}):(0,x.jsx)(o.Muted,{size:12,children:'staff'===h?.role?'You can\u2019t change this list.':''})]}):null]})}},995,[877,30,263,127,813,821,1106,1107,1108,947,1034,856,24]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.readBack=S,_e.ReviewSheet=I,_e.Bars=P,_e.CashCharts=M,_e.CashUpScreen=function({rid:e,today:t,canEdit:s,who:l,chartsOnly:n}){const r=(0,p.useCashSettings)(e),h=(0,p.useCashUp)(e=>e.cashUps).filter(t=>t.rid===e).sort((e,t)=>t.date.localeCompare(e.date)),m=(0,p.useCashUp)(e=>e.sales).filter(t=>t.rid===e).sort((e,t)=>t.weekStart.localeCompare(e.weekStart)),[f,x]=(0,a.useState)(null),[D,P]=(0,a.useState)(null),$=(0,w.useLockedFor)(e),[B,R]=(0,a.useState)(!1),[L,A]=(0,a.useState)(null),z=async(e,s,a,o)=>{const l=a??('cashup'===e?t:(0,y.weekStartOf)((0,y.addDaysYmd)(t,-7)));if($(e,l))return void P((0,w.lockedMessage)(e,l));const n=s?await(0,k.pickPhotos)({source:s}):[];if(s&&!n.length)return void P('No photo taken. Try again, choose one from the gallery, or type the figures by hand.');const i='cashup'===e?r.cashFields:r.salesFields;let d,u={vals:{},reader:null,note:'Type the figures from the sheet.',categories:[]};n.length&&(R(!0),P('Reading the photo\u2026'),d=await Promise.all(n.map((t,s)=>(0,k.uploadPhoto)(e,l,t,s))),u=await(0,j.readSheet)(e,d.filter(e=>!!e),i),R(!1),P(null));const c=o&&'cashup'===e?h.find(e=>e.date===l)?.vals:void 0;x({kind:e,key:l,photos:n,vals:c?{...u.vals,...c}:u.vals,categories:u.categories??[],unread:(0,y.missing)(i,u.vals),note:u.note,reader:o?'edit':u.reader,uploaded:d,only:o})},E=[0,1,2].map(e=>({label:0===e?'Today':1===e?'Yesterday':v((0,y.addDaysYmd)(t,-e)),value:(0,y.addDaysYmd)(t,-e)})),N=[0,1,2].map(e=>{const s=(0,y.weekStartOf)((0,y.addDaysYmd)(t,-7*e));return{label:0===e?'This week':1===e?'Last week':`w/c ${v(s)}`,value:s}});return(0,C.jsxs)(d.default,{testID:"cashup-screen",style:{gap:12},children:[(0,C.jsx)(u.Muted,{children:"Tip: at the end of the night, tap Take a picture of the taking sheet: the figures are filled in from the photo for you to check beside it, then Confirm. Bigger venues can Upload a spreadsheet (CSV or Excel) for one night or several. Gross takings feed Spend per head. Head Chefs can see the graphs."}),D?(0,C.jsx)(u.Banner,{kind:"info",children:D}):null,(0,C.jsx)(U,{rid:e,today:t,manage:s,who:l}),s&&!n?(0,C.jsxs)(u.Card,{highlight:c.colours.gold,children:[(0,C.jsx)(u.T,{weight:"semibold",children:"End of night cash up"}),(0,C.jsx)(i.default,{testID:"upload-cashup",accessibilityRole:"button",accessibilityLabel:"Take a picture of the taking sheet. Opens the camera; the figures are filled in for you to check.",disabled:B,onPress:()=>{z('cashup','camera')},style:({pressed:e})=>({minHeight:64,borderRadius:16,backgroundColor:e?c.colours.goldLight:c.colours.gold,alignItems:'center',justifyContent:'center',paddingHorizontal:18,opacity:B?.5:1}),children:(0,C.jsx)(u.T,{size:20,weight:"semibold",colour:c.colours.onGold,children:B?'Reading the photo\u2026':'Take a picture of the taking sheet'})}),(0,C.jsxs)(u.Row,{wrap:!0,gap:8,children:[(0,C.jsx)(u.Button,{testID:"cashup-gallery",kind:"secondary",label:"Choose from gallery",accessibilityLabel:"Choose a photo of the cash up from the gallery",onPress:()=>{z('cashup','gallery')}}),(0,C.jsx)(u.Button,{testID:"cashup-by-hand",kind:"secondary",label:"Type it in",onPress:()=>{z('cashup',null)}}),(0,C.jsx)(u.Button,{testID:"cashup-sheet",kind:"secondary",label:"Upload a spreadsheet",accessibilityLabel:"Upload a spreadsheet of takings, CSV or Excel, for one night or several",onPress:async()=>{const e=await(0,b.pickSpreadsheet)();e&&('error'in e?P(e.error):A(e))}}),(0,C.jsx)(u.Button,{testID:"cashup-takings",kind:"secondary",label:"Enter takings",accessibilityLabel:"Enter tonight's takings: gross, and food and drink if you have them",onPress:()=>{z('cashup',null,t,y.TAKINGS_KEYS)}})]}),(0,C.jsx)(u.T,{weight:"semibold",style:{marginTop:8},children:"Weekly sales report"}),(0,C.jsxs)(u.Row,{wrap:!0,gap:8,children:[(0,C.jsx)(u.Button,{testID:"upload-sales",label:"Upload weekly sales report",onPress:()=>{z('sales','camera')}}),(0,C.jsx)(u.Button,{testID:"sales-gallery",kind:"secondary",label:"Choose from gallery",onPress:()=>{z('sales','gallery')}}),(0,C.jsx)(u.Button,{testID:"sales-by-hand",kind:"secondary",label:"Type it in",onPress:()=>{z('sales',null)}})]}),(0,C.jsx)(u.Muted,{children:"Several pages? Pick them all at once. Fields can be changed in Settings \u203a Advanced \u203a Cash up."})]}):null,(0,C.jsx)(M,{rid:e,today:t}),(0,C.jsxs)(u.Card,{children:[(0,C.jsx)(u.T,{weight:"semibold",children:"Recent cash ups"}),h.length?h.slice(0,10).map(e=>(0,C.jsxs)(d.default,{testID:`cashup-row-${e.date}`,style:{paddingVertical:6,borderTopWidth:1,borderTopColor:'rgba(255,255,255,0.06)',gap:2},children:[(0,C.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsx)(u.T,{weight:"semibold",children:v(e.date)}),(0,C.jsx)(u.T,{colour:c.colours.goldLight,children:T((0,y.takings)(e.vals))})]}),(0,C.jsx)(u.Muted,{children:r.cashFields.filter(e=>'text'!==e.kind&&'card'!==e.key&&'cash'!==e.key).map(t=>`${t.label} ${(0,y.isBlank)(e.vals[t.key])?'\u2014':'money'===t.kind?T(e.vals[t.key]):e.vals[t.key]}`).join(' \xb7 ')}),(0,C.jsxs)(u.Muted,{children:["Confirmed by ",e.confirmedBy??'\u2014',e.photos.length?` \xb7 ${e.photos.length} photo${e.photos.length>1?'s':''}`:'']}),s&&!$('cashup',e.date)?(0,C.jsxs)(u.Row,{gap:6,children:[(0,C.jsx)(u.Button,{small:!0,kind:"ghost",label:"Edit",onPress:()=>x({kind:'cashup',key:e.date,photos:e.photos,vals:e.vals,categories:[],unread:[],note:'',reader:'edit'})}),(0,C.jsx)(u.Button,{small:!0,kind:"ghost",testID:`takings-edit-${e.date}`,label:null==(0,y.grossOf)(e.vals)?'Add takings':'Edit takings',onPress:()=>x({kind:'cashup',key:e.date,photos:[],vals:e.vals,categories:[],unread:[],note:'',reader:'edit',only:y.TAKINGS_KEYS})})]}):null,s?(0,C.jsx)(w.CashLockControls,{kind:"cashup",item:e,label:v(e.date)}):null]},e.id)):(0,C.jsx)(u.Muted,{children:"None yet."})]}),(0,C.jsxs)(u.Card,{children:[(0,C.jsx)(u.T,{weight:"semibold",children:"Weekly sales reports"}),m.length?m.slice(0,8).map(e=>(0,C.jsxs)(d.default,{style:{paddingVertical:6,borderTopWidth:1,borderTopColor:'rgba(255,255,255,0.06)'},children:[(0,C.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsxs)(u.T,{weight:"semibold",children:["w/c ",v(e.weekStart)]}),(0,C.jsx)(u.T,{colour:c.colours.goldLight,children:T('number'==typeof e.vals.net?e.vals.net:null)})]}),(0,C.jsx)(u.Muted,{children:r.salesFields.filter(e=>'net'!==e.key).map(t=>`${t.label} ${(0,y.isBlank)(e.vals[t.key])?'\u2014':'money'===t.kind?T(e.vals[t.key]):e.vals[t.key]}`).join(' \xb7 ')}),s?(0,C.jsx)(w.CashLockControls,{kind:"sales",item:e,label:`w/c ${v(e.weekStart)}`}):null]},e.id)):(0,C.jsx)(u.Muted,{children:"None yet."})]}),L?(0,C.jsx)(b.SpreadsheetImport,{rid:e,file:L,who:l,locked:e=>$('cashup',e),onClose:()=>A(null),onSaved:e=>{P(e),A(null)}}):null,f?(0,C.jsx)(I,{draft:f,fields:'cashup'===f.kind?r.cashFields:r.salesFields,onClose:()=>x(null),onConfirm:async(t,s)=>{if(!f)return;if($(f.kind,f.key))return P((0,w.lockedMessage)(f.kind,f.key)),void x(null);const a=f.uploaded&&f.uploaded.length===f.photos.length?f.uploaded:await Promise.all(f.photos.map((e,t)=>(0,k.uploadPhoto)(f.kind,f.key,e,t))),n=f.photos.map((e,t)=>a[t]??e),r=(new Date).toISOString();if('cashup'===f.kind){const s=h.find(e=>e.date===f.key),a=f.only&&s?{...s.vals,...t}:t;p.useCashUp.getState().saveCashUp({rid:e,date:f.key,vals:a,photos:f.only&&s?s.photos:n,confirmedBy:l.name,confirmedAt:r,readBy:f.reader});const i=(0,y.combinedTips)(a),d=S(a);P(`Cash up for ${v(f.key)} saved${d?`: ${d}`:''}${null==i||f.only?'':`. Today\u2019s tips (${T(i)}) are now showing in the staff apps`}.`);try{o.default.announceForAccessibility?.(`Saved. ${d}`)}catch{}}else p.useCashUp.getState().saveSales({rid:e,weekStart:f.key,vals:t,categories:s,photos:n,confirmedBy:l.name,confirmedAt:r,readBy:f.reader}),P(`Weekly sales for the week of ${v(f.key)} saved.`);a.some(e=>null==e)&&f.photos.length&&P(e=>`${e??''} The photo is kept on this device only (not signed in or offline).`),x(null)},keyLabel:'cashup'===f.kind?'Day':'Week starting',keyChoices:'cashup'===f.kind?E:N,onKey:e=>x({...f,key:e})},`${f.kind}-${f.photos.length}`):null]})},_e.TodaysTipsCard=function({rid:e,today:t,big:s}){const a=(0,p.useTipsShow)(e),o=(0,p.useCashUp)(e=>e.tips).filter(s=>s.rid===e&&(s.date===t||s.date===(0,y.addDaysYmd)(t,-1))).sort((e,t)=>t.date.localeCompare(e.date))[0],l=R(o?.total??0);return a.showToday&&o?(0,C.jsx)(u.Card,{highlight:c.colours.gold,children:(0,C.jsxs)(d.default,{testID:"todays-tips",style:{flexDirection:'row',alignItems:'center',gap:14},children:[(0,C.jsx)($,{n:Math.ceil(o.total/25)}),(0,C.jsxs)(d.default,{style:{flex:1,gap:2},children:[(0,C.jsx)(u.T,{size:12,weight:"semibold",colour:c.colours.gold,style:{letterSpacing:1.5},children:o.date===t?'TODAY\u2019S TIPS':'LAST NIGHT\u2019S TIPS'}),(0,C.jsx)(u.T,{size:s?40:32,weight:"bold",colour:c.colours.goldLight,children:T(l)}),(0,C.jsxs)(u.Muted,{children:["Cash + card tips for the whole team \xb7 ",v(o.date),". Thank you, everyone."]})]})]})}):null},_e.TipsPotCard=U,_e.useTipsPosted=function(e,t,s=!0){const o=(0,p.useCashUp)(e=>e.tips),l=(0,p.useTipsShow)(e);(0,a.useEffect)(()=>{if(!s||!l.showToday)return;const a=o.filter(s=>s.rid===e&&s.date>=(0,y.addDaysYmd)(t,-1)&&s.date<=t).sort((e,t)=>t.date.localeCompare(e.date))[0];if(!a)return;const n=`${e}:${a.date}`;p.useCashUp.getState().seen[n]!==a.total&&(p.useCashUp.getState().markSeen(n,a.total),(0,x.notify)({id:`tips-${n}`,icon:'\ud83e\ude99',kicker:'TIPS',title:`${a.date===t?'Today\u2019s':'Last night\u2019s'} tips: ${T(a.total)}`,body:'Cash + card tips for the whole team. Added to the Tips pot. Thank you, everyone.',testID:'tips-notice',timeoutMs:12e3,actions:[{label:'Nice',testID:'tips-notice-ok',onPress:()=>{}}]}))},[e,t,o,l.showToday,s])},_e.CashUpSettings=function({rid:e}){const t=(0,p.useCashSettings)(e),a=(t,s)=>p.useCashUp.getState().setFields(e,t,s),o=(e,o)=>(0,C.jsxs)(d.default,{style:{gap:6},children:[(0,C.jsx)(u.T,{weight:"semibold",children:o}),t[e].map((o,l)=>(0,C.jsxs)(u.Row,{gap:6,children:[(0,C.jsx)(s.TextInput,{testID:`cf-${e}-${o.key}`,value:o.label,onChangeText:s=>a(e,t[e].map((e,t)=>t===l?{...e,label:s.slice(0,40)}:e)),style:{flex:1,minHeight:38,borderRadius:8,borderWidth:1,borderColor:'rgba(255,255,255,0.15)',color:c.colours.text,paddingHorizontal:8}}),(0,C.jsx)(u.Muted,{children:'money'===o.kind?'\xa3':'number'===o.kind?'#':'text'}),o.fixed?(0,C.jsx)(u.Muted,{children:"needed"}):(0,C.jsx)(u.Button,{small:!0,kind:"ghost",label:"\u2715",accessibilityLabel:`Remove ${o.label}`,onPress:()=>a(e,t[e].filter((e,t)=>t!==l))})]},o.key)),(0,C.jsxs)(u.Row,{gap:6,children:[(0,C.jsx)(u.Button,{small:!0,kind:"secondary",label:"Money figure",onPress:()=>a(e,[...t[e],{key:`f${Date.now().toString(36)}`,label:'New figure',kind:'money'}])}),(0,C.jsx)(u.Button,{small:!0,kind:"secondary",label:"Number",onPress:()=>a(e,[...t[e],{key:`n${Date.now().toString(36)}`,label:'New number',kind:'number'}])})]})]});return(0,C.jsxs)(d.default,{testID:"cashup-settings",style:{gap:12},children:[(0,C.jsx)(u.Muted,{children:"Tip: match these to the boxes on your paper cash up sheet and till printout. Cash tips total and Card tips total are needed for Today\u2019s tips and the Tips pot."}),o('cashFields','Cash up sheet'),o('salesFields','Weekly sales report')]})},_e.TipsSettings=function({rid:e}){const t=(0,p.useTipsShow)(e);return(0,C.jsxs)(d.default,{testID:"tips-settings",style:{gap:8},children:[(0,C.jsx)(u.Muted,{children:"Staff only ever see the team total: never anyone\u2019s share or pay. The Display never shows tips or money."}),(0,C.jsx)(u.Toggle,{testID:"tips-show-today",label:"Show Today\u2019s tips in the staff apps",value:t.showToday,onChange:t=>p.useCashUp.getState().setShow(e,{showToday:t})}),(0,C.jsx)(u.Toggle,{testID:"tips-show-pot",label:"Show the Tips pot in the staff apps",value:t.showPot,onChange:t=>p.useCashUp.getState().setShow(e,{showPot:t})})]})};var t=_r(_d[0]),s=_r(_d[1]),a=_r(_d[2]),o=e(_r(_d[3])),l=e(_r(_d[4])),n=e(_r(_d[5])),r=e(_r(_d[6])),i=e(_r(_d[7])),d=e(_r(_d[8])),h=e(_r(_d[9])),u=_r(_d[10]),c=_r(_d[11]),p=_r(_d[12]),y=_r(_d[13]),m=_r(_d[14]),f=_r(_d[15]),x=_r(_d[16]),k=_r(_d[17]),j=_r(_d[18]),b=_r(_d[19]),w=_r(_d[20]),C=_r(_d[21]);const T=e=>null==e?'\u2014':`\xa3${e.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`,v=e=>new Date(`${e}T12:00:00Z`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'UTC'});function S(e){const t=t=>'number'==typeof e[t]?e[t]:null,s=(0,y.combinedTips)(e);return[['Gross',t('gross')],['card',t('card')],['cash',t('cash')],['tips',s],['food',t('food')],['drink',t('drink')]].filter(([,e])=>null!=e).map(([e,t])=>`${e} ${T(t)}`).join(', ')}function D({p:e,h:s}){const[o,l]=(0,a.useState)(e.startsWith('data:')?e:null);return(0,a.useEffect)(()=>{o||(0,k.photoUrl)(e).then(l)},[e]),o?(0,C.jsx)(r.default,{source:{uri:o},style:{width:'100%',height:s,borderRadius:10,backgroundColor:(0,t.soutersSurface)('#111')},resizeMode:"contain"}):(0,C.jsx)(d.default,{style:{height:s,borderRadius:10,backgroundColor:(0,t.soutersSurface)('#1B1A18'),alignItems:'center',justifyContent:'center'},children:(0,C.jsx)(u.Muted,{children:"Photo"})})}function I({draft:e,fields:t,onClose:o,onConfirm:l,keyLabel:n,onKey:r,keyChoices:i}){const{width:p,height:m}=(0,h.default)(),f=p>=820;e.only&&(t=t.filter(t=>e.only.includes(t.key)));const[x,k]=(0,a.useState)(()=>Object.fromEntries(t.map(t=>[t.key,(0,y.isBlank)(e.vals[t.key])?'':String(e.vals[t.key])]))),[j,b]=(0,a.useState)(()=>e.categories.map(e=>({name:e.name,amount:String(e.amount)}))),[w,T]=(0,a.useState)(!1),v=Object.fromEntries(t.map(e=>[e.key,'text'===e.kind?x[e.key]?.trim()||null:(0,y.parseAmount)(x[e.key]??'',e.kind)])),S=t.filter(e=>'text'!==e.kind&&(x[e.key]??'').trim()&&null==v[e.key]).map(e=>e.key),I=(0,y.missing)(t,v),P=j.map(e=>({name:e.name.trim(),amount:(0,y.parseAmount)(e.amount)})).filter(e=>e.name),M=P.some(e=>null==e.amount),$=e=>({minHeight:42,borderRadius:10,borderWidth:e?2:1,borderColor:e?c.colours.amber:'rgba(255,255,255,0.15)',backgroundColor:e?'rgba(232,168,56,0.08)':'#141312',color:c.colours.text,paddingHorizontal:10,fontSize:17}),B=(0,C.jsx)(d.default,{testID:"review-photos",style:{gap:8,flex:f?1:void 0},children:e.photos.length?e.photos.map((t,s)=>(0,C.jsx)(D,{p:t,h:f?Math.max(300,.62*m/Math.min(2,e.photos.length)):260},s)):(0,C.jsx)(u.Muted,{children:"No photo: typed by hand."})}),R=(0,C.jsxs)(d.default,{testID:"review-fields",style:{gap:8,flex:f?1:void 0},children:[(0,C.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,C.jsx)(u.Muted,{children:n}),i.map(t=>(0,C.jsx)(u.Chip,{label:t.label,selected:e.key===t.value,onPress:()=>r(t.value)},t.value))]}),t.map(e=>{const t='text'!==e.kind&&!(x[e.key]??'').trim()||S.includes(e.key);return(0,C.jsxs)(d.default,{style:{gap:3},children:[(0,C.jsxs)(u.Row,{gap:6,children:[(0,C.jsx)(u.T,{weight:"semibold",size:14,children:e.label}),t&&'text'!==e.kind?(0,C.jsx)(u.Badge,{kind:"amber",label:S.includes(e.key)?'Check this':'Not read: type it'}):null]}),(0,C.jsx)(s.TextInput,{testID:`review-${e.key}`,value:x[e.key]??'',onChangeText:t=>k(s=>({...s,[e.key]:t})),keyboardType:'text'===e.kind?'default':'decimal-pad',placeholder:'money'===e.kind?'\xa3':'number'===e.kind?'Number':'Optional',placeholderTextColor:"#777",style:$(t)})]},e.key)}),'sales'===e.kind?(0,C.jsxs)(d.default,{testID:"review-categories",style:{gap:6},children:[(0,C.jsx)(u.T,{weight:"semibold",size:14,children:"Sales by category (if the printout has them)"}),j.map((e,t)=>(0,C.jsxs)(u.Row,{gap:6,children:[(0,C.jsx)(s.TextInput,{value:e.name,onChangeText:e=>b(s=>s.map((s,a)=>a===t?{...s,name:e}:s)),placeholder:"e.g. Food",placeholderTextColor:"#777",style:[$(!1),{flex:2}]}),(0,C.jsx)(s.TextInput,{value:e.amount,onChangeText:e=>b(s=>s.map((s,a)=>a===t?{...s,amount:e}:s)),placeholder:"\xa3",placeholderTextColor:"#777",keyboardType:"decimal-pad",style:[$(!e.amount.trim()||null==(0,y.parseAmount)(e.amount)),{flex:1}]}),(0,C.jsx)(u.Button,{small:!0,kind:"ghost",label:"\u2715",accessibilityLabel:"Remove category",onPress:()=>b(e=>e.filter((e,s)=>s!==t))})]},t)),(0,C.jsx)(u.Button,{small:!0,kind:"secondary",testID:"review-add-cat",label:"Add a category",onPress:()=>b(e=>[...e,{name:'',amount:''}])})]}):null]});return(0,C.jsxs)(u.Sheet,{visible:!0,onClose:o,title:'cashup'===e.kind?'Check the cash up':'Check the weekly sales',maxWidth:1100,testID:"review-sheet",children:[(0,C.jsx)(u.Muted,{children:"Tip: check each figure against the photo. Nothing is saved until you tap Confirm. Amber boxes weren\u2019t read: type them, or leave them blank if the sheet doesn\u2019t have them."}),'edit'===e.reader||e.only?null:e.reader?(0,C.jsx)(u.Banner,{kind:"info",title:"Read from the photo",children:e.note}):e.photos.length?(0,C.jsx)(u.Banner,{kind:"info",title:"Type it from the photo",children:e.note}):null,f?(0,C.jsxs)(d.default,{style:{flexDirection:'row',gap:14},children:[B,R]}):(0,C.jsxs)(C.Fragment,{children:[B,R]}),I.length?(0,C.jsxs)(u.Muted,{children:[I.length," figure",1===I.length?'':'s'," still blank. Blank means \u201cnot on the sheet\u201d, never zero."]}):null,(0,C.jsxs)(u.Row,{gap:8,children:[(0,C.jsx)(u.Button,{testID:"review-confirm",label:w?'Saving\u2026':'Confirm and save',disabled:w||!!S.length||M||!t.some(e=>'text'!==e.kind&&null!=v[e.key]),onPress:async()=>{T(!0),await l(v,P.map(e=>({name:e.name,amount:e.amount}))),T(!1)}}),(0,C.jsx)(u.Button,{kind:"secondary",label:"Cancel",onPress:o})]})]})}function P({data:e,height:t=140,testID:s,fmt:a=T}){const o=Math.max(1,...e.map(e=>e.value??0));return(0,C.jsxs)(d.default,{testID:s,style:{gap:4},children:[(0,C.jsx)(d.default,{style:{flexDirection:'row',alignItems:'flex-end',gap:4,height:t},children:e.map((e,s)=>(0,C.jsxs)(d.default,{style:{flex:1,alignItems:'center',justifyContent:'flex-end',height:t},children:[null!=e.value?(0,C.jsx)(u.T,{size:9,colour:c.colours.muted,children:a(e.value).replace('.00','')}):null,(0,C.jsx)(d.default,{style:{width:'80%',height:null==e.value?2:Math.max(3,e.value/o*(t-16)),borderRadius:4,backgroundColor:null==e.value?'#333':e.hi?c.colours.goldLight:c.colours.gold,opacity:null==e.value?.6:1}})]},s))}),(0,C.jsx)(d.default,{style:{flexDirection:'row',gap:4},children:e.map((e,t)=>(0,C.jsx)(u.T,{size:9,colour:c.colours.muted,style:{flex:1,textAlign:'center'},children:e.label},t))})]})}function M({rid:e,today:s}){const a=(0,p.useCashUp)(e=>e.cashUps).filter(t=>t.rid===e),o=(0,p.useCashUp)(e=>e.sales).filter(t=>t.rid===e),l=(0,y.dailySeries)(a,s,14),n=(0,y.dailySeries)(a,s,14,y.combinedTips),r=(0,y.weekStartOf)(s),i=Array.from({length:8},(e,t)=>(0,y.addDaysYmd)(r,7*(t-7))).map(e=>{const t=o.find(t=>t.weekStart===e&&t.confirmedAt),s=t?.vals.net;return{label:v(e).split(' ').slice(1).join(' '),value:'number'==typeof s?s:null,hi:e===r}}),h=[...o].filter(e=>e.confirmedAt).sort((e,t)=>t.weekStart.localeCompare(e.weekStart))[0],m=h?(0,y.weekCompare)(o,h.weekStart):null,f=h?.categories??[],x=Math.max(1,...f.map(e=>e.amount)),k=h?(0,y.weekCompare)(o,h.weekStart,'covers'):null;return(0,C.jsxs)(d.default,{testID:"cash-charts",style:{gap:12},children:[(0,C.jsxs)(u.Card,{children:[(0,C.jsx)(u.T,{weight:"semibold",children:"Takings, last 14 days"}),(0,C.jsx)(u.Muted,{children:"Card + cash from confirmed cash ups. A grey line means no cash up that day."}),(0,C.jsx)(P,{testID:"chart-daily",data:l.map(e=>({label:v(e.date).split(' ')[1],value:e.value,hi:e.date===s}))})]}),(0,C.jsxs)(u.Card,{children:[(0,C.jsx)(u.T,{weight:"semibold",children:"Tips, last 14 days"}),(0,C.jsx)(u.Muted,{children:"Cash + card tips, team total."}),(0,C.jsx)(P,{testID:"chart-tips",height:100,data:n.map(e=>({label:v(e.date).split(' ')[1],value:e.value,hi:e.date===s}))})]}),(0,C.jsxs)(u.Card,{children:[(0,C.jsx)(u.T,{weight:"semibold",children:"Weekly net sales"}),m&&null!=m.now?(0,C.jsx)(d.default,{testID:"week-compare",children:(0,C.jsxs)(u.T,{size:15,children:["Week of ",v(h.weekStart),": ",T(m.now),null!=m.prev?` \xb7 week before ${T(m.prev)}`:'',null!=m.change?` \xb7 ${m.change>=0?'\u25b2':'\u25bc'} ${Math.abs(m.change)}%`:'']})}):(0,C.jsx)(u.Muted,{children:"No weekly sales report yet."}),k&&null!=k.now?(0,C.jsxs)(u.Muted,{children:["Covers ",k.now,null!=k.prev?` (week before ${k.prev})`:'']}):null,(0,C.jsx)(P,{testID:"chart-weekly",data:i})]}),f.length?(0,C.jsxs)(u.Card,{children:[(0,C.jsxs)(u.T,{weight:"semibold",children:["By category, week of ",v(h.weekStart)]}),(0,C.jsx)(d.default,{testID:"chart-categories",style:{gap:6},children:f.map(e=>(0,C.jsxs)(d.default,{style:{gap:2},children:[(0,C.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsx)(u.T,{size:14,children:e.name}),(0,C.jsx)(u.T,{size:14,colour:c.colours.goldLight,children:T(e.amount)})]}),(0,C.jsx)(d.default,{style:{height:10,borderRadius:5,backgroundColor:(0,t.soutersSurface)('#2A2826')},children:(0,C.jsx)(d.default,{style:{width:e.amount/x*100+"%",height:10,borderRadius:5,backgroundColor:c.colours.gold}})})]},e.name))})]}):null]})}function $({n:e,testID:t}){const s=Math.max(1,Math.min(14,e));return(0,C.jsx)(d.default,{testID:t,style:{width:64,height:114,justifyContent:'flex-end'},children:Array.from({length:s}).map((e,t)=>(0,C.jsx)(B,{delay:50*t},t))})}function B({delay:e}){const t=(0,a.useRef)(new l.default.Value(1)).current;return(0,a.useEffect)(()=>{l.default.timing(t,{toValue:0,duration:420,delay:e,easing:n.default.out(n.default.back(1.6)),useNativeDriver:!1}).start()},[]),(0,C.jsx)(l.default.View,{style:{height:7,transform:[{translateY:t.interpolate({inputRange:[0,1],outputRange:[0,-120]})}],opacity:t.interpolate({inputRange:[0,1],outputRange:[1,0]})},children:(0,C.jsx)(d.default,{style:{width:60,height:12,borderRadius:30,backgroundColor:c.colours.gold,borderWidth:1,borderColor:c.colours.goldLight}})})}function R(e){const[t,s]=(0,a.useState)(e),o=(0,a.useRef)(e);return(0,a.useEffect)(()=>{const t=o.current,a=e;if(t===a)return;const l=Date.now(),n=setInterval(()=>{const e=Math.min(1,(Date.now()-l)/1200);s(Math.round(100*(t+(a-t)*(1-Math.pow(1-e,3))))/100),e>=1&&(clearInterval(n),o.current=a)},40);return()=>clearInterval(n)},[e]),t}function U({rid:e,today:t,manage:s,who:o,big:l}){const n=(0,p.useTipsShow)(e),r=(0,p.useCashUp)(e=>e.tips).filter(t=>t.rid===e),i=(0,p.useCashUp)(e=>e.pot).filter(t=>t.rid===e),h=(0,f.useVenuePay)(e).pay,x=(0,m.tipsPeriod)(h,t),k=(0,a.useMemo)(()=>(0,y.tipsPot)(r,i,x.start,t),[r,i,x.start,t]),j=R(k.total),[b,w]=(0,a.useState)(null);return n.showPot||s?(0,C.jsxs)(u.Card,{highlight:c.colours.gold,children:[(0,C.jsxs)(d.default,{testID:"tips-pot",style:{flexDirection:'row',alignItems:'center',gap:14},children:[(0,C.jsx)($,{n:Math.ceil(k.total/100),testID:"tips-pot-coins"},k.total),(0,C.jsxs)(d.default,{style:{flex:1,gap:2},children:[(0,C.jsx)(u.T,{size:12,weight:"semibold",colour:c.colours.gold,style:{letterSpacing:1.5},children:"TIPS POT"}),(0,C.jsx)(u.T,{size:l?40:32,weight:"bold",colour:c.colours.goldLight,children:T(j)}),(0,C.jsxs)(u.Muted,{children:["Tips held for the team since ",v(k.from),x.payday?` \xb7 next tip payday ${v(x.payday)}`:'',". Confirmed cash ups only.",n.showPot?'':' (Hidden from staff.)']})]})]}),s?(0,C.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,C.jsx)(u.Button,{small:!0,kind:"secondary",testID:"pot-payout",label:"Mark payout done",onPress:()=>w('payout')}),(0,C.jsx)(u.Button,{small:!0,kind:"ghost",testID:"pot-correct",label:"Correct an entry",onPress:()=>w('correct')}),(0,C.jsx)(u.Button,{small:!0,kind:"ghost",testID:"pot-history",label:"Past pots",onPress:()=>w('history')})]}):null,'payout'===b?(0,C.jsxs)(u.Sheet,{visible:!0,onClose:()=>w(null),title:"Mark payout done",maxWidth:520,testID:"pot-payout-sheet",children:[(0,C.jsxs)(u.T,{children:["Pay out ",T(k.total)," (tips from ",v(k.from)," to ",v(t),")?"]}),(0,C.jsx)(u.Muted,{children:"The pot goes back to \xa30.00 for the next period. This is logged and kept in Past pots. No money is moved by the app."}),(0,C.jsx)(u.Button,{testID:"pot-payout-confirm",label:"Yes, payout done",onPress:()=>{p.useCashUp.getState().addPotEvent({rid:e,kind:'payout',throughDate:t,amount:k.total,by:o?.name??'Manager'}),w(null)}})]}):null,'correct'===b?(0,C.jsx)(L,{rid:e,today:t,who:o,onClose:()=>w(null)}):null,'history'===b?(0,C.jsxs)(u.Sheet,{visible:!0,onClose:()=>w(null),title:"Past pots and corrections",maxWidth:560,testID:"pot-history-sheet",children:[k.history.length||i.some(e=>'correction'===e.kind)?null:(0,C.jsx)(u.Muted,{children:"No payouts or corrections yet."}),i.slice().sort((e,t)=>t.at.localeCompare(e.at)).map(e=>(0,C.jsxs)(d.default,{style:{paddingVertical:4},children:[(0,C.jsx)(u.T,{weight:"semibold",children:'payout'===e.kind?`Paid out ${T(e.amount)}`:`Correction ${e.amount>=0?'+':'\u2212'}${T(Math.abs(e.amount))} for ${v(e.forDate)}`}),(0,C.jsxs)(u.Muted,{children:['payout'===e.kind?`Tips to ${v(e.throughDate)}`:`\u201c${e.reason}\u201d`," \xb7 ",e.by," \xb7 ",new Date(e.at).toLocaleString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})]})]},e.id))]}):null]}):null}function L({rid:e,today:o,who:l,onClose:n}){const[r,i]=(0,a.useState)(o),[d,h]=(0,a.useState)(''),[m,f]=(0,a.useState)(''),x=(0,y.parseAmount)(d),k={minHeight:42,borderRadius:10,borderWidth:1,borderColor:'rgba(255,255,255,0.15)',backgroundColor:(0,t.soutersSurface)('#141312'),color:c.colours.text,paddingHorizontal:10,fontSize:16};return(0,C.jsxs)(u.Sheet,{visible:!0,onClose:n,title:"Correct an entry",maxWidth:520,testID:"pot-correct-sheet",children:[(0,C.jsx)(u.Muted,{children:"Tip: add or take off an amount for a day (use a minus for less, e.g. -5). Every correction is logged with your name and the reason."}),(0,C.jsx)(u.Row,{wrap:!0,gap:6,children:[0,1,2,3].map(e=>{const t=(0,y.addDaysYmd)(o,-e);return(0,C.jsx)(u.Chip,{label:0===e?'Today':v(t),selected:r===t,onPress:()=>i(t)},t)})}),(0,C.jsx)(s.TextInput,{testID:"pot-correct-amount",value:d,onChangeText:h,placeholder:"\xa3 e.g. -5.00",placeholderTextColor:"#777",keyboardType:"numbers-and-punctuation",style:k}),(0,C.jsx)(s.TextInput,{testID:"pot-correct-reason",value:m,onChangeText:f,placeholder:"Reason (required)",placeholderTextColor:"#777",maxLength:200,style:k}),(0,C.jsx)(u.Button,{testID:"pot-correct-save",label:"Save correction",disabled:null==x||0===x||!m.trim(),onPress:()=>{p.useCashUp.getState().addPotEvent({rid:e,kind:'correction',forDate:r,amount:x,reason:m.trim(),by:l?.name??'Manager'}),n()}})]})}},996,[868,877,30,118,120,224,196,263,127,287,813,821,1093,1109,1110,1111,947,1281,1285,1286,1289,24]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useCashAccess",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"hasCashUpAccess",{enumerable:!0,get:function(){return n}});const t=(0,r(d[0]).create)(()=>({byRef:{},mine:null,loaded:!1})),n=()=>!0===t.getState().mine},997,[952]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"fmtDate",{enumerable:!0,get:function(){return m}}),_e.SignOffLine=b,_e.CardView=w,_e.CardEditor=I,_e.RecipeCards=function({rid:e,actor:n,mode:d}){const f=(0,o.useRecipeCards)(e),[j,b]=(0,t.useState)(''),[C,k]=(0,t.useState)([]),[D,v]=(0,t.useState)('free-from'),[T,S]=(0,t.useState)('all'),[B,$]=(0,t.useState)(null),[P,R]=(0,t.useState)(null),L='edit'===d&&(0,h.canEditCards)(n.role),A=L?f:f.filter(e=>!!e.signOff),M=(0,t.useMemo)(()=>{const e='all'===T?A:A.filter(e=>(0,h.cardState)(e)===T);return(0,h.filterCards)(e,j,C,D).slice().sort((e,s)=>e.section.localeCompare(s.section)||e.dish.localeCompare(s.dish))},[A,j,C,D,T]),E=f.filter(e=>!e.signOff).length,N=B?f.find(e=>e.id===B):void 0,O=P&&'new'!==P?f.find(e=>e.id===P)??null:null,H=e=>k(s=>s.includes(e)?s.filter(s=>s!==e):[...s,e]);return(0,p.jsxs)(l.default,{testID:"recipe-cards",style:{gap:12},children:['read'===d?(0,p.jsx)(a.Banner,{kind:"info",title:"Read-only",children:"Signed-off recipe cards only. The head chef keeps these up to date."}):(0,p.jsx)(a.Muted,{children:(0,h.canSignOffCards)(n.role)?'You can add, edit and sign off cards. A card only goes live once you sign it off; any edit sets it back to Awaiting sign-off.':'You can add and edit cards. The head chef signs them off before they go live; any edit sets a card back to Awaiting sign-off.'}),f.some(e=>'example'===e.origin)?(0,p.jsx)(a.Banner,{kind:"example",title:"Example data",children:"Cards marked \u201cExample data\u201d are made-up examples to show how recipe cards work. Replace them with your own dishes."}):null,L?(0,p.jsx)(a.Button,{testID:"new-card",label:"New recipe card",onPress:()=>R('new')}):null,(0,p.jsx)(s.TextInput,{testID:"card-search",accessibilityLabel:"Search recipe cards",value:j,onChangeText:b,placeholder:"Search dishes or ingredients",placeholderTextColor:"#7D776C",style:a.styles.input}),(0,p.jsxs)(a.Row,{gap:6,wrap:!0,children:[(0,p.jsx)(a.T,{size:r.font.small,colour:r.colours.muted,children:"Allergens:"}),(0,p.jsx)(a.Chip,{label:"Free from",selected:'free-from'===D,onPress:()=>v('free-from')}),(0,p.jsx)(a.Chip,{label:"Contains",selected:'contains'===D,onPress:()=>v('contains')}),C.length?(0,p.jsx)(a.Chip,{label:"Clear",onPress:()=>k([])}):null]}),(0,p.jsx)(a.Row,{gap:6,wrap:!0,children:c.ALLERGENS.map(e=>(0,p.jsx)(i.default,{testID:`filter-${e.id}`,accessibilityRole:"button",accessibilityState:{selected:C.includes(e.id)},onPress:()=>H(e.id),style:{paddingVertical:5,paddingHorizontal:10,minHeight:44,minWidth:44,justifyContent:'center',borderRadius:14,borderWidth:1,borderColor:C.includes(e.id)?r.colours.gold:r.colours.border,backgroundColor:C.includes(e.id)?r.colours.gold:'transparent'},children:(0,p.jsx)(a.T,{size:13,colour:C.includes(e.id)?r.colours.onGold:r.colours.text,children:e.short})},e.id))}),L?(0,p.jsxs)(a.Row,{gap:6,wrap:!0,children:[(0,p.jsx)(a.Chip,{label:`All (${f.length})`,selected:'all'===T,onPress:()=>S('all')}),(0,p.jsx)(a.Chip,{label:`Awaiting sign-off (${E})`,selected:'awaiting'===T,onPress:()=>S('awaiting')}),(0,p.jsx)(a.Chip,{label:`Signed off (${f.length-E})`,selected:'signed-off'===T,onPress:()=>S('signed-off')})]}):null,(0,p.jsx)(l.default,{testID:"card-count",children:(0,p.jsxs)(a.Muted,{children:[M.length," ",1===M.length?'card':'cards',C.length?` ${'free-from'===D?'free from':'containing'} ${C.map(c.allergenLabel).join('free-from'===D?' and ':' or ')}`:'']})}),M.map(e=>(0,p.jsx)(i.default,{testID:`card-${e.menuItemId}`,accessibilityRole:"button",accessibilityLabel:`${e.dish}, ${e.signOff?'signed off':'awaiting sign-off'}`,onPress:()=>$(e.id),children:(0,p.jsx)(a.Card,{highlight:!e.signOff&&L?r.colours.amber:void 0,children:(0,p.jsxs)(a.Row,{gap:12,style:{alignItems:'flex-start'},children:[(0,p.jsx)(l.default,{style:{width:84},children:(0,p.jsx)(y,{card:e,height:64})}),(0,p.jsxs)(l.default,{style:{flex:1,gap:4},children:[(0,p.jsx)(a.T,{weight:"semibold",children:e.dish}),(0,p.jsxs)(a.Muted,{children:[e.section," \xb7 ",x(e.price),'example'===e.origin?` \xb7 ${u.EXAMPLE_TAG}`:'']}),(0,p.jsxs)(a.Row,{gap:4,wrap:!0,children:[e.signOff?(0,p.jsx)(a.Badge,{label:`\u2713 ${m(e.signOff.at)}`,kind:"ok"}):(0,p.jsx)(a.Badge,{label:h.STATE_LABEL.awaiting,kind:"amber"}),c.ALLERGENS.filter(s=>e.allergens[s.id]).map(s=>(0,p.jsx)(a.Badge,{label:'may'===e.allergens[s.id]?`${s.short}?`:s.short,kind:'may'===e.allergens[s.id]?'amber':'red'},s.id))]})]})]})})},e.id)),M.length?null:(0,p.jsx)(a.Muted,{children:"No cards match."}),(0,p.jsx)(a.Sheet,{visible:!!N&&!P,onClose:()=>$(null),title:N?.dish??'',maxWidth:640,testID:"card-sheet",children:N?(0,p.jsx)(w,{card:N,actor:'read'===d?{...n,role:'staff'}:n,onEdit:L?()=>R(N.id):void 0}):null}),(0,p.jsx)(a.Sheet,{visible:!!P,onClose:()=>R(null),title:'new'===P?'New recipe card':`Edit: ${O?.dish??''}`,maxWidth:680,testID:"editor-sheet",children:P?(0,p.jsx)(I,{rid:e,card:O,actor:n,onDone:e=>{R(null),$(e)}},P):null})]})};var s=_r(_d[0]),t=_r(_d[1]),n=e(_r(_d[2])),i=e(_r(_d[3])),l=e(_r(_d[4])),r=_r(_d[5]),a=_r(_d[6]),o=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),u=_r(_d[11]),f=_r(_d[12]),p=_r(_d[13]);const m=e=>{const s=new Date(e.length<=10?`${e}T12:00:00`:e);return isNaN(+s)?e:s.toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric'})},x=e=>null==e?'Price on the board':`\xa3${(e/100).toFixed(2)}`,j={example:u.EXAMPLE_TAG,imported:'Imported from the menu',new:null};function b({card:e,testID:s}){return e.signOff?(0,p.jsxs)(l.default,{testID:s,style:{gap:2},children:[(0,p.jsx)(a.Badge,{label:`\u2713 ${h.STATE_LABEL['signed-off']}`,kind:"ok"}),(0,p.jsxs)(a.T,{size:r.font.small,colour:r.colours.ok,children:["Signed off by ",e.signOff.by," on ",m(e.signOff.at)]})]}):(0,p.jsxs)(l.default,{testID:s,style:{gap:2},children:[(0,p.jsx)(a.Badge,{label:h.STATE_LABEL.awaiting,kind:"amber"}),(0,p.jsx)(a.T,{size:r.font.small,colour:r.colours.amber,children:e.wasLive?'Edited since the last sign-off. The dish shows "awaiting allergen sign-off" to guests and cannot be ordered until the head chef signs it off.':'New dish: it stays off the menu until the head chef signs it off.'})]})}function y({card:e,height:s=180,pending:t}){const i=t?{uri:t}:e.photo?(0,d.recipeCards)().photoSource(e.photo):null;return i?(0,p.jsx)(n.default,{testID:"card-photo",accessibilityLabel:`Plating photo: ${e.dish}`,source:i,style:{width:'100%',height:s,borderRadius:12,backgroundColor:r.colours.surface2},resizeMode:"cover"}):(0,p.jsx)(l.default,{style:{height:s,borderRadius:12,backgroundColor:r.colours.surface2,alignItems:'center',justifyContent:'center',borderWidth:1,borderColor:r.colours.border},children:(0,p.jsx)(a.Muted,{children:"No plating photo yet"})})}function C({map:e}){const s=c.ALLERGENS.filter(s=>e[s.id]).map(e=>e.id);return s.length?(0,p.jsx)(a.Row,{wrap:!0,gap:6,children:s.map(s=>(0,p.jsx)(a.Badge,{label:'may'===e[s]?`May contain ${(0,c.allergenLabel)(s).toLowerCase()}`:(0,c.allergenLabel)(s),kind:'may'===e[s]?'amber':'red'},s))}):(0,p.jsx)(a.Muted,{children:"None of the UK 14 allergens."})}function w({card:e,actor:s,onEdit:n}){const[i,o]=(0,t.useState)(null),c=(0,h.signOffBlock)(e),u=j[e.origin];return(0,p.jsxs)(l.default,{testID:"card-view",style:{gap:12},children:[(0,p.jsx)(y,{card:e,height:200}),(0,p.jsxs)(a.Row,{wrap:!0,gap:6,children:[u?(0,p.jsx)(a.Badge,{label:u,kind:'example'===e.origin?'blue':'neutral'}):null,(0,p.jsx)(a.Badge,{label:e.section,kind:"gold"}),(0,p.jsx)(a.Badge,{label:x(e.price)})]}),(0,p.jsx)(b,{card:e,testID:"card-status"}),(0,p.jsx)(a.Divider,{}),(0,p.jsx)(a.H2,{children:"Allergens"}),(0,p.jsx)(l.default,{testID:"card-allergens",children:(0,p.jsx)(C,{map:e.allergens})}),e.allergenNotes?(0,p.jsx)(a.Muted,{children:e.allergenNotes}):null,e.allergensConfirmed?(0,p.jsxs)(a.Muted,{children:["Allergen list confirmed by ",e.allergensConfirmed.by," on ",m(e.allergensConfirmed.at),"."]}):null,(0,p.jsx)(a.Divider,{}),(0,p.jsx)(a.H2,{children:"Ingredients"}),e.ingredients.length?e.ingredients.map(e=>(0,p.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(a.T,{style:{flex:1},children:e.name}),(0,p.jsx)(a.T,{colour:r.colours.goldLight,children:[e.qty,e.unit].filter(Boolean).join(' ')})]},e.id)):(0,p.jsx)(a.Muted,{children:"No ingredients on this card yet."}),(0,p.jsx)(a.Divider,{}),(0,p.jsx)(a.H2,{children:"Method"}),e.steps.length?e.steps.map((e,s)=>(0,p.jsxs)(a.Row,{gap:10,style:{alignItems:'flex-start'},children:[(0,p.jsx)(l.default,{style:{width:26,height:26,borderRadius:13,backgroundColor:r.colours.goldTint,alignItems:'center',justifyContent:'center'},children:(0,p.jsx)(a.T,{size:r.font.small,colour:r.colours.gold,children:s+1})}),(0,p.jsx)(a.T,{style:{flex:1},children:e})]},s)):(0,p.jsxs)(a.Muted,{children:["No method yet.",(0,h.canEditCards)(s.role)?' Tap Edit to add the steps.':'']}),(0,p.jsxs)(a.Muted,{children:["Version ",e.version," \xb7 last changed ",m(e.updatedAt)," by ",e.updatedBy]}),(0,h.canEditCards)(s.role)&&n?(0,p.jsx)(a.Button,{testID:"edit-card",kind:"secondary",label:"Edit card",onPress:n}):null,(0,h.canSignOffCards)(s.role)&&!e.signOff?(0,p.jsxs)(l.default,{style:{gap:6},children:[c?(0,p.jsx)(a.Banner,{kind:"warn",title:"Not ready to sign off",children:c}):null,(0,p.jsx)(a.Button,{testID:"sign-off",kind:"success",label:`Sign off as ${s.name}`,disabled:!!c,onPress:async()=>{try{await(0,d.recipeCards)().signOff(e.id,s),o(null)}catch(e){o(e?.message??'Could not sign off.')}}})]}):null,!(0,h.canEditCards)(s.role)||(0,h.canSignOffCards)(s.role)||e.signOff?null:(0,p.jsx)(a.Banner,{kind:"info",title:"Head chef sign-off",children:"Only the head chef can sign off a recipe card, in the Head Chef app."}),i?(0,p.jsx)(a.Banner,{kind:"danger",children:i}):null]})}const k=()=>`i-${Math.random().toString(36).slice(2,9)}`,D=(e,s)=>e?{id:e.id,dish:e.dish,section:e.section,price:null==e.price?'':(e.price/100).toFixed(2),description:'',ingredients:e.ingredients.map(e=>({...e})),steps:[...e.steps],allergens:{...e.allergens},dismissed:[...e.dismissed],allergenNotes:e.allergenNotes??'',photo:e.photo,pending:null,confirm:!!e.allergensConfirmed}:{id:(0,h.uuid)(),dish:'',section:s,price:'',description:'',ingredients:[{id:k(),name:'',qty:'',unit:''}],steps:[''],allergens:{},dismissed:[],allergenNotes:'',pending:null,confirm:!1},v=e=>{const s=e.replace(/[\xa3\s]/g,'');if(!s)return null;const t=Number(s);return isFinite(t)&&t>=0?Math.round(100*t):'bad'};function I({rid:e,card:n,actor:u,onDone:m}){const x=(0,o.useRestaurant)(e),j=x?.sections??['Mains'],[b,C]=(0,t.useState)(()=>D(n,j[0]??'Mains')),[w,I]=(0,t.useState)(null),[T,S]=(0,t.useState)(null),[B,$]=(0,t.useState)(!1),P=e=>C(s=>({...s,...e})),R=b.ingredients.filter(e=>e.name.trim()),L={ingredients:R,allergens:b.allergens,dismissed:b.dismissed},A=(0,h.suggestAllergens)(R),M=(0,h.unresolved)(L),E=e=>{const s=b.allergens[e],t={...b.allergens};s?'contains'===s?t[e]='may':delete t[e]:t[e]='contains',P({allergens:t,dismissed:b.dismissed.filter(s=>s!==e),confirm:!1})},N=e=>{const s={...b.allergens};delete s[e],P({allergens:s,dismissed:[...new Set([...b.dismissed,e])],confirm:!1})},O=(e,s)=>P({ingredients:b.ingredients.map((t,n)=>n===e?{...t,...s}:t),confirm:!1}),H=(e,s)=>P({steps:b.steps.map((t,n)=>n===e?s:t)}),F=(e,s)=>{const t=[...b.steps],n=e+s;n<0||n>=t.length||([t[e],t[n]]=[t[n],t[e]],P({steps:t}))},_=async e=>{S(null);try{const s=await(0,f.capturePlatingPhoto)(e);s&&(P({pending:s}),S(`Compressed on this device: ${s.width}\xd7${s.height}, ${(0,f.kb)(s.bytes)}${s.originalBytes?` (was ${(0,f.kb)(s.originalBytes)})`:''}.`))}catch(e){S(e?.message??'Could not read that photo.')}},[z,W]=(0,t.useState)(!1),G=n??{id:b.id,dish:b.dish,photo:b.photo};return(0,p.jsxs)(l.default,{testID:"card-editor",style:{gap:12},children:[n?.signOff?(0,p.jsx)(a.Banner,{kind:"warn",title:"Saving a change resets the sign-off",children:"This card is signed off. Any change you save sets it back to \"Awaiting sign-off\" until the head chef signs it off again."}):null,(0,p.jsx)(a.Field,{testID:"dish-name",label:"Dish name",value:b.dish,onChangeText:e=>P({dish:e}),placeholder:"e.g. Cullen skink"}),n?null:(0,p.jsx)(a.Field,{testID:"dish-description",label:"Menu description (optional)",value:b.description,onChangeText:e=>P({description:e}),placeholder:"What guests read on the menu"}),(0,p.jsx)(a.T,{size:r.font.small,weight:"medium",colour:r.colours.muted,children:"Menu section"}),(0,p.jsx)(a.Row,{wrap:!0,gap:6,children:j.map(e=>(0,p.jsx)(a.Chip,{label:e,selected:b.section===e,onPress:()=>P({section:e})},e))}),(0,p.jsx)(a.Field,{testID:"dish-price",label:"Price (\xa3)",value:b.price,onChangeText:e=>P({price:e}),placeholder:"Blank = price on the board",keyboardType:"decimal-pad"}),(0,p.jsx)(a.Divider,{}),(0,p.jsx)(a.H2,{children:"Plating photo"}),(0,p.jsx)(y,{card:G,pending:b.pending?.dataUrl??null,height:170}),(0,p.jsxs)(a.Row,{gap:8,wrap:!0,children:[(0,p.jsx)(a.Button,{testID:"photo-camera",small:!0,kind:"secondary",label:b.pending||b.photo?'Retake photo':'Take photo',onPress:()=>_('camera')}),(0,p.jsx)(a.Button,{testID:"photo-library",small:!0,kind:"secondary",label:b.pending||b.photo?'Replace photo':'Choose photo',onPress:()=>_('library')}),b.pending||b.photo?(0,p.jsx)(a.Button,{testID:"photo-remove",small:!0,kind:"ghost",label:"Remove photo",onPress:()=>P({pending:null,photo:void 0})}):null]}),T?(0,p.jsx)(l.default,{testID:"photo-info",children:(0,p.jsx)(a.Muted,{children:T})}):(0,p.jsx)(a.Muted,{children:'shared'===(0,d.recipeCards)().mode?'Photos are shrunk on this device, then shared with the team. Staff and guests only see the photo once the card is signed off.':'Photos are shrunk on this device before they are saved.'}),(0,p.jsx)(a.Divider,{}),(0,p.jsx)(a.H2,{children:"Ingredients"}),(0,p.jsx)(a.Muted,{children:"Quantity, unit and ingredient. We suggest allergens from the ingredient names."}),b.ingredients.map((e,t)=>{const n=e.name.trim()?(0,h.suggestAllergens)([e]):[];return(0,p.jsxs)(l.default,{style:{gap:4},children:[(0,p.jsxs)(a.Row,{gap:6,children:[(0,p.jsx)(s.TextInput,{testID:`ing-qty-${t}`,accessibilityLabel:`Quantity ${t+1}`,value:e.qty,onChangeText:e=>O(t,{qty:e}),placeholder:"Qty",placeholderTextColor:"#7D776C",style:[a.styles.input,{width:64}]}),(0,p.jsx)(s.TextInput,{testID:`ing-unit-${t}`,accessibilityLabel:`Unit ${t+1}`,value:e.unit,onChangeText:e=>O(t,{unit:e}),placeholder:"g / ml / each",placeholderTextColor:"#7D776C",style:[a.styles.input,{width:92}]}),(0,p.jsx)(s.TextInput,{testID:`ing-name-${t}`,accessibilityLabel:`Ingredient ${t+1}`,value:e.name,onChangeText:e=>O(t,{name:e}),placeholder:"Ingredient",placeholderTextColor:"#7D776C",style:[a.styles.input,{flex:1}]}),(0,p.jsx)(i.default,{accessibilityLabel:`Remove ingredient ${t+1}`,onPress:()=>P({ingredients:b.ingredients.filter((e,s)=>s!==t)}),hitSlop:8,children:(0,p.jsx)(a.T,{colour:r.colours.muted,children:"\u2715"})})]}),n.length?(0,p.jsxs)(a.Muted,{children:["Suggests: ",n.map(c.allergenLabel).join(', ')]}):null]},e.id)}),(0,p.jsx)(a.Button,{testID:"ing-add",small:!0,kind:"ghost",label:"Add ingredient",onPress:()=>P({ingredients:[...b.ingredients,{id:k(),name:'',qty:'',unit:''}]})}),(0,p.jsx)(a.Divider,{}),(0,p.jsx)(a.H2,{children:"Method"}),b.steps.map((e,t)=>(0,p.jsxs)(a.Row,{gap:6,style:{alignItems:'flex-start'},children:[(0,p.jsx)(a.T,{colour:r.colours.gold,style:{width:20,paddingTop:10},children:t+1}),(0,p.jsx)(s.TextInput,{testID:`step-${t}`,accessibilityLabel:`Step ${t+1}`,value:e,onChangeText:e=>H(t,e),multiline:!0,placeholder:"Describe this step",placeholderTextColor:"#7D776C",style:[a.styles.input,{flex:1,minHeight:56,textAlignVertical:'top'}]}),(0,p.jsxs)(l.default,{style:{gap:4},children:[(0,p.jsx)(i.default,{accessibilityLabel:`Move step ${t+1} up`,onPress:()=>F(t,-1),hitSlop:6,children:(0,p.jsx)(a.T,{colour:r.colours.muted,children:"\u25b2"})}),(0,p.jsx)(i.default,{accessibilityLabel:`Move step ${t+1} down`,onPress:()=>F(t,1),hitSlop:6,children:(0,p.jsx)(a.T,{colour:r.colours.muted,children:"\u25bc"})}),(0,p.jsx)(i.default,{accessibilityLabel:`Remove step ${t+1}`,onPress:()=>P({steps:b.steps.filter((e,s)=>s!==t)}),hitSlop:6,children:(0,p.jsx)(a.T,{colour:r.colours.muted,children:"\u2715"})})]})]},t)),(0,p.jsx)(a.Button,{testID:"step-add",small:!0,kind:"ghost",label:"Add step",onPress:()=>P({steps:[...b.steps,'']})}),(0,p.jsx)(a.Divider,{}),(0,p.jsx)(a.H2,{children:"Allergens (UK 14)"}),(0,p.jsx)(a.Muted,{children:"Tap to cycle: contains \u2192 may contain \u2192 none. Suggested allergens are marked \u201c?\u201d until you add or rule them out."}),M.length?(0,p.jsxs)(l.default,{testID:"allergen-suggestions",style:{gap:6},children:[(0,p.jsx)(a.Banner,{kind:"warn",title:`Check ${M.length} suggested allergen${1===M.length?'':'s'}`,children:M.map(e=>`${(0,c.allergenLabel)(e)} (from ${(0,h.suggestedBy)(R,e).join(', ')})`).join('; ')}),M.map(e=>(0,p.jsxs)(a.Row,{gap:6,wrap:!0,children:[(0,p.jsx)(a.T,{style:{flex:1},children:(0,c.allergenLabel)(e)}),(0,p.jsx)(a.Button,{testID:`suggest-add-${e}`,small:!0,label:"Contains",onPress:()=>P({allergens:{...b.allergens,[e]:'contains'},confirm:!1})}),(0,p.jsx)(a.Button,{testID:`suggest-may-${e}`,small:!0,kind:"secondary",label:"May contain",onPress:()=>P({allergens:{...b.allergens,[e]:'may'},confirm:!1})}),(0,p.jsx)(a.Button,{testID:`suggest-dismiss-${e}`,small:!0,kind:"ghost",label:"Not in this dish",onPress:()=>N(e)})]},e)),(0,p.jsx)(a.Button,{testID:"apply-suggestions",small:!0,kind:"secondary",label:"Add all suggestions as \u2018contains\u2019",onPress:()=>{const e={...b.allergens};M.forEach(s=>{e[s]='contains'}),P({allergens:e,confirm:!1})}})]}):null,(0,p.jsx)(a.Row,{wrap:!0,gap:6,children:c.ALLERGENS.map(e=>{const s=b.allergens[e.id],t=A.includes(e.id)&&!s&&!b.dismissed.includes(e.id),n='contains'===s?r.colours.redBg:'may'===s?r.colours.amberBg:r.colours.surface2,l='contains'===s?r.colours.red:'may'===s?r.colours.amber:t?r.colours.gold:r.colours.border;return(0,p.jsx)(i.default,{testID:`allergen-${e.id}`,accessibilityRole:"button",accessibilityLabel:`${e.short}: ${'contains'===s?'contains':'may'===s?'may contain':'not marked'}`,onPress:()=>E(e.id),style:{paddingVertical:6,paddingHorizontal:10,borderRadius:16,borderWidth:t?2:1,borderStyle:t?'dashed':'solid',borderColor:l,backgroundColor:n},children:(0,p.jsxs)(a.T,{size:r.font.small,colour:'contains'===s?'#FFD9D4':'may'===s?'#FFE2A8':r.colours.text,children:[e.short,'may'===s?' (may)':'',t?' ?':'']})},e.id)})}),b.dismissed.length?(0,p.jsxs)(a.Muted,{children:["Ruled out: ",b.dismissed.map(c.allergenLabel).join(', ')]}):null,(0,p.jsx)(a.Field,{testID:"allergen-notes",label:"Allergen notes (optional)",value:b.allergenNotes,onChangeText:e=>P({allergenNotes:e}),placeholder:"e.g. Cooked in the shared fryer"}),(0,p.jsxs)(i.default,{testID:"confirm-allergens",accessibilityRole:"checkbox",accessibilityState:{checked:b.confirm,disabled:M.length>0},disabled:M.length>0,onPress:()=>P({confirm:!b.confirm}),style:{flexDirection:'row',gap:10,alignItems:'center',padding:10,borderRadius:10,borderWidth:1,borderColor:b.confirm?r.colours.ok:r.colours.border,opacity:M.length?.5:1},children:[(0,p.jsx)(l.default,{style:{width:22,height:22,borderRadius:4,borderWidth:2,borderColor:b.confirm?r.colours.ok:r.colours.muted,alignItems:'center',justifyContent:'center',backgroundColor:b.confirm?r.colours.okBg:'transparent'},children:b.confirm?(0,p.jsx)(a.T,{colour:r.colours.ok,children:"\u2713"}):null}),(0,p.jsx)(a.T,{style:{flex:1},children:M.length?'Check the suggested allergens above first':`I have checked the allergen list against the ingredients (${u.name})`})]}),w?(0,p.jsx)(a.Banner,{kind:"danger",children:w}):null,(0,p.jsx)(a.Button,{testID:"card-save",label:z?'Saving\u2026':n?'Save changes':'Save card',disabled:z,onPress:async()=>{I(null);const s=v(b.price);if(!b.dish.trim())return I('Give the dish a name.');if('bad'===s)return I('Price should be in pounds, e.g. 14.50 (or leave it blank for "price on the board").');const t=(0,d.recipeCards)();W(!0);try{let i=b.photo;b.pending&&(i=await t.savePhoto(e,b.id,b.pending));const l=b.steps.map(e=>e.trim()).filter(Boolean),r={dish:b.dish.trim(),section:b.section,price:s,ingredients:R.map(e=>({...e,name:e.name.trim(),qty:e.qty.trim(),unit:e.unit.trim()})),steps:l,allergens:b.allergens,dismissed:b.dismissed,allergenNotes:b.allergenNotes.trim()||void 0,photo:i};if(n)await t.update(n.id,{...r,confirmAllergens:b.confirm},u),m(n.id);else{const s=await t.create(e,{...r,id:b.id,description:b.description.trim()||void 0},u);b.confirm&&await t.update(s.id,{confirmAllergens:!0},u),m(s.id)}}catch(e){I(e?.message??'Could not save the card.')}finally{W(!1)}}}),(0,p.jsx)(a.Muted,{children:(0,h.canSignOffCards)(u.role)?'After saving, sign the card off so it goes live.':'After saving, the head chef signs it off in the Head Chef app before it goes live.'}),n?B?(0,p.jsxs)(a.Row,{gap:8,children:[(0,p.jsx)(a.Button,{testID:"card-delete-yes",small:!0,kind:"danger",label:"Yes, remove this dish",onPress:async()=>{if(n)try{await(0,d.recipeCards)().remove(n.id,u),m(null)}catch(e){I(e?.message??'Could not remove the card.')}}}),(0,p.jsx)(a.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>$(!1)})]}):(0,p.jsx)(a.Button,{testID:"card-delete",small:!0,kind:"ghost",label:"Remove card and dish from the menu",onPress:()=>$(!0)}):null]})}},998,[877,30,196,263,127,821,813,819,831,814,1104,1142,1294,24]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useHrSettings",{enumerable:!0,get:function(){return f}}),_e.MoraleScale=b,_e.StaffingSlider=j,_e.ShiftCheckout=function({rid:e,shiftKey:o,day:a,meId:d,onClose:y}){const w=f(e),S=w.wording,k=(0,i.useOwner)(e=>e.staff),C=(0,i.useOwner)(e=>e.attendance),[v,T]=(0,s.useState)(null),[R,M]=(0,s.useState)(null),[I,D]=(0,s.useState)(''),[H,L]=(0,s.useState)('up'),[z,P]=(0,s.useState)(null),[W,A]=(0,s.useState)(''),[q,B]=(0,s.useState)(null),[N,E]=(0,s.useState)(!1),$=(0,s.useMemo)(()=>{const e=new Set(C.filter(e=>e.date===a&&e.staffId!==d).map(e=>e.staffId)),t=k.filter(e=>e.active&&e.id!==d&&!e.temp);return[...t.filter(t=>e.has(t.id)),...t.filter(t=>!e.has(t.id))].slice(0,14)},[k,C,a,d]),O=()=>{u.useHr.getState().skip(e,o),y()};return(0,c.jsx)(n.Sheet,{visible:!0,onClose:O,title:"How was today?",testID:"hr-checkout",children:N?(0,c.jsxs)(l.default,{testID:"hr-checkout-thanks",style:{gap:6,paddingVertical:10},children:[(0,c.jsx)(n.T,{size:18,weight:"semibold",colour:r.colours.goldLight,center:!0,children:"Thanks. Sent anonymously."}),(0,c.jsx)(n.Muted,{center:!0,children:"Have a good evening."})]}):(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(n.Muted,{size:13,children:S.intro}),(0,c.jsxs)(l.default,{style:{gap:8},children:[(0,c.jsx)(n.T,{weight:"semibold",children:S.morale}),(0,c.jsx)(b,{value:v,onChange:T,w:S})]}),(0,c.jsxs)(l.default,{style:{gap:8},children:[(0,c.jsx)(n.T,{weight:"semibold",children:S.staffing}),(0,c.jsx)(j,{value:R,onChange:M,w:S})]}),w.askQuestion||w.askShout?(0,c.jsxs)(n.Row,{wrap:!0,gap:6,children:[w.askQuestion?(0,c.jsx)(n.Chip,{testID:"hr-more-question",label:"\uff0b Ask the team a question",selected:'q'===q,onPress:()=>B('q'===q?null:'q')}):null,w.askShout?(0,c.jsx)(n.Chip,{testID:"hr-more-shout",label:"\uff0b Shout out a teammate",selected:'shout'===q,onPress:()=>B('shout'===q?null:'shout')}):null]}):null,'q'===q&&w.askQuestion?(0,c.jsxs)(l.default,{style:{gap:6},children:[(0,c.jsxs)(n.Muted,{size:13,children:[S.question," Optional."]}),(0,c.jsx)(t.TextInput,{testID:"hr-question",accessibilityLabel:"Your question",value:I,onChangeText:D,maxLength:280,multiline:!0,placeholder:"e.g. Could we start staff meals earlier?",placeholderTextColor:r.colours.muted,style:[x,{minHeight:64}]}),(0,c.jsxs)(n.Row,{wrap:!0,gap:6,children:[(0,c.jsx)(n.Chip,{label:"Vote up",selected:'up'===H,onPress:()=>L('up')}),(0,c.jsx)(n.Chip,{label:"Yes / No",selected:'yesno'===H,onPress:()=>L('yesno')})]})]}):null,'shout'===q&&w.askShout?(0,c.jsxs)(l.default,{style:{gap:6},children:[(0,c.jsxs)(n.Muted,{size:13,children:[S.shout," Optional. Your name isn\u2019t shown."]}),(0,c.jsx)(n.Row,{wrap:!0,gap:6,children:$.map(e=>(0,c.jsx)(n.Chip,{testID:`hr-shout-${e.id}`,label:p(e.nickname||e.name).split(' ')[0],selected:z===p(e.nickname||e.name).split(' ')[0],onPress:()=>{const t=p(e.nickname||e.name).split(' ')[0];P(z===t?null:t)}},e.id))}),z?(0,c.jsx)(t.TextInput,{testID:"hr-shout-note",accessibilityLabel:"What for (optional)",value:W,onChangeText:A,maxLength:140,placeholder:"What for? (optional)",placeholderTextColor:r.colours.muted,style:x}):null]}):null,(0,c.jsxs)(n.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(n.Button,{testID:"hr-checkout-send",label:"Send anonymously",disabled:null==v&&null==R,onPress:()=>{u.useHr.getState().submit({rid:e,shiftKey:o,day:a,morale:v??3,staffing:R,question:w.askQuestion&&I.trim()?I:void 0,kind:H,shoutTo:w.askShout&&z?z:void 0,shoutBody:W||void 0}),E(!0),setTimeout(y,2400)},style:{flexGrow:1}}),(0,c.jsx)(n.Button,{testID:"hr-checkout-skip",kind:"ghost",label:"Skip",onPress:O})]}),(0,c.jsxs)(n.Muted,{size:12,children:["No name, no staff number and no clock time is saved with these answers. Managers only see a day once ",h.MIN_ANSWERS," or more people have answered."]})]})})},_e.QuestionBoard=function({rid:e,today:i,manager:a,by:d}){const p=f(e);(0,s.useEffect)(()=>{u.useHr.getState().ensure(e,i),u.hrRemote.live&&u.hrRemote.refresh&&u.hrRemote.refresh()},[e,i]);const y=(0,u.useHr)(e=>e.questions),b=(0,u.useHr)(e=>e.voted),j=(0,u.useHr)(e=>e.log),[S,k]=(0,s.useState)(''),[C,v]=(0,s.useState)('up'),[T,R]=(0,s.useState)(null),[M,I]=(0,s.useState)(null),[D,H]=(0,s.useState)(''),[L,z]=(0,s.useState)(null),[P,W]=(0,s.useState)(''),[A,q]=(0,s.useState)(!1),[B,N]=(0,s.useState)(null);(0,s.useEffect)(()=>{a&&A&&u.hrRemote.live&&u.hrRemote.log&&u.hrRemote.log(e).then(e=>N(e))},[a,A,e,j.length]);const E=(0,h.boardOrder)(y.filter(t=>t.venue===e),a),$=(B??j.filter(t=>t.venue===e)).slice(0,30);if(!p.board)return(0,c.jsx)(n.Card,{children:(0,c.jsxs)(n.Muted,{children:["The question board is switched off for this venue.",a?' Turn it on in Settings \u203a Advanced \u203a Shift check-out & question board.':'']})});return(0,c.jsxs)(l.default,{style:{gap:10},testID:"hr-board",children:[(0,c.jsx)(n.Muted,{children:"Ask anything about work. No names are shown or saved, not even to managers. Vote on what matters to you."}),(0,c.jsxs)(n.Card,{children:[(0,c.jsx)(n.T,{weight:"semibold",children:"Post a question"}),(0,c.jsx)(t.TextInput,{testID:"hr-board-input",accessibilityLabel:"Your question",value:S,onChangeText:e=>{k(e),R(null)},maxLength:280,multiline:!0,placeholder:"e.g. Can the rota go up by Thursday?",placeholderTextColor:r.colours.muted,style:[x,{minHeight:64}]}),(0,c.jsxs)(n.Row,{wrap:!0,gap:6,style:{justifyContent:'space-between'},children:[(0,c.jsxs)(n.Row,{wrap:!0,gap:6,children:[(0,c.jsx)(n.Chip,{label:"Vote up",selected:'up'===C,onPress:()=>v('up')}),(0,c.jsx)(n.Chip,{label:"Yes / No",selected:'yesno'===C,onPress:()=>v('yesno')})]}),(0,c.jsx)(n.Button,{small:!0,testID:"hr-board-post",label:"Post anonymously",disabled:!(0,h.cleanQuestion)(S),onPress:()=>{u.useHr.getState().post(e,S,C,i)?(k(''),R('Posted anonymously.')):R('Write a few more words first.')}})]}),T?(0,c.jsx)(n.Muted,{size:13,children:T}):null]}),E.length?E.map(e=>(0,c.jsx)(w,{q:e,mine:b[e.id],manager:a,onHide:()=>{I(e),H('')},onReply:()=>{z(e),W(e.reply??'')},by:d},e.id)):(0,c.jsx)(n.Muted,{center:!0,children:"No questions yet. Be the first."}),a?(0,c.jsxs)(n.Card,{children:[(0,c.jsx)(o.default,{testID:"hr-log-toggle",accessibilityRole:"button",onPress:()=>q(!A),children:(0,c.jsxs)(n.Row,{style:{justifyContent:'space-between',minHeight:44},children:[(0,c.jsx)(n.T,{weight:"semibold",style:{flex:1},children:"Moderation log"}),(0,c.jsx)(n.T,{colour:r.colours.gold,children:A?'Hide':'Show'})]})}),(0,c.jsx)(n.Muted,{size:13,children:"Every hide, unhide and reply is logged with who did it and when. Questions never show who asked."}),A?$.length?$.map(e=>(0,c.jsxs)(l.default,{testID:"hr-log-row",style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:6},children:[(0,c.jsxs)(n.T,{size:14,children:['hide'===e.action?'Hidden':'unhide'===e.action?'Shown again':'Replied'," by ",e.by]}),(0,c.jsxs)(n.Muted,{size:12,children:[new Date(e.at).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'}),e.reason?` \xb7 ${e.reason}`:'']})]},e.id)):(0,c.jsx)(n.Muted,{children:"Nothing logged yet."}):null]}):null,(0,c.jsxs)(n.Sheet,{visible:!!M,onClose:()=>I(null),title:"Hide this question?",testID:"hr-hide-sheet",children:[(0,c.jsx)(n.Muted,{children:"It disappears for staff straight away. You can show it again later. This is logged with your name."}),(0,c.jsx)(t.TextInput,{testID:"hr-hide-reason",accessibilityLabel:"Reason",value:D,onChangeText:H,maxLength:140,placeholder:"Reason, e.g. rude or names someone",placeholderTextColor:r.colours.muted,style:x}),(0,c.jsxs)(n.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(n.Button,{testID:"hr-hide-confirm",kind:"danger",label:"Hide",disabled:D.trim().length<3,onPress:()=>{M&&u.useHr.getState().moderate(M.id,'hide',D,d),I(null)}}),(0,c.jsx)(n.Button,{kind:"ghost",label:"Cancel",onPress:()=>I(null)})]})]}),(0,c.jsxs)(n.Sheet,{visible:!!L,onClose:()=>z(null),title:"Reply to the team",testID:"hr-reply-sheet",children:[L?(0,c.jsxs)(n.Muted,{children:["\u201c",L.body,"\u201d"]}):null,(0,c.jsx)(t.TextInput,{testID:"hr-reply-input",accessibilityLabel:"Your reply",value:P,onChangeText:W,maxLength:600,multiline:!0,placeholder:"Your reply, shown under the question",placeholderTextColor:r.colours.muted,style:[x,{minHeight:80}]}),(0,c.jsx)(n.Muted,{size:12,children:"Shown as \u201cReply from the managers\u201d. Your name is kept in the moderation log only."}),(0,c.jsxs)(n.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(n.Button,{testID:"hr-reply-save",label:"Post reply",disabled:!P.trim(),onPress:()=>{L&&u.useHr.getState().reply(L.id,P,d),z(null)}}),(0,c.jsx)(n.Button,{kind:"ghost",label:"Cancel",onPress:()=>z(null)})]})]})]})},_e.coversByDay=k,_e.exampleCovers=C,_e.MoraleTrend=function({rid:e,today:t}){const o=f(e).wording;(0,s.useEffect)(()=>{u.useHr.getState().ensure(e,t)},[e,t]);const[i,a]=(0,s.useState)(14),p=(0,u.useHr)(e=>e.checkins),x=(0,u.useHr)(e=>e.shouts),b=(0,d.useBookings)(e),j=(0,s.useMemo)(()=>k(b),[b]),w=e=>j[e]??(z?C(e):void 0),v=S(t,-i),[T,R]=(0,s.useState)(null),[M,I]=(0,s.useState)(null);(0,s.useEffect)(()=>{let s=!0;return u.hrRemote.live&&u.hrRemote.trend&&u.hrRemote.trend(e,v,t).then(e=>{s&&R(e)}),u.hrRemote.live&&u.hrRemote.shouts&&u.hrRemote.shouts(e,S(t,-30)).then(e=>{s&&I(e)}),()=>{s=!1}},[e,v,t]);const D=(0,s.useMemo)(()=>(0,h.dayResults)(p.filter(s=>s.venue===e&&s.day>=v&&s.day<=t)),[p,e,v,t]),H=u.hrRemote.live,L=H?T??[]:D.shown,z=!H&&p.some(t=>t.venue===e&&t.example),P=(H?M??[]:x.filter(t=>t.venue===e)).slice().sort((e,t)=>t.day.localeCompare(e.day)).slice(0,8),W=L.length?Math.round(L.reduce((e,t)=>e+t.morale,0)/L.length*10)/10:null,A=Array.from({length:i},(e,s)=>S(t,1-i+s)),q=new Map(L.map(e=>[e.day,e]));return(0,c.jsxs)(l.default,{style:{gap:10},testID:"hr-trend",children:[(0,c.jsxs)(n.Muted,{children:["From the anonymous check-out when people clock out. A day only shows once ",h.MIN_ANSWERS," or more people have answered."]}),z?(0,c.jsx)(n.Banner,{kind:"example",title:"Example answers",children:"These are made-up answers so you can see how it looks. Real answers replace them once your team is signed in."}):null,(0,c.jsx)(n.Row,{wrap:!0,gap:6,children:[14,28,56].map(e=>(0,c.jsx)(n.Chip,{label:14===e?'2 weeks':28===e?'4 weeks':'8 weeks',selected:i===e,onPress:()=>a(e)},e))}),(0,c.jsxs)(n.Card,{children:[(0,c.jsxs)(n.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,c.jsx)(n.T,{weight:"semibold",style:{flexShrink:1},children:"Team morale"}),null!=W?(0,c.jsx)(n.Badge,{kind:"gold",label:`AVERAGE ${W} \xb7 ${(0,h.moraleWord)(Math.round(W),o).toUpperCase()}`}):null]}),(0,c.jsx)(l.default,{testID:"hr-trend-chart",accessibilityLabel:`Morale over the last ${i} days`,style:{height:110,flexDirection:'row',alignItems:'flex-end',gap:i>30?1:3,borderBottomWidth:1,borderColor:r.colours.border},children:A.map(e=>{const t=q.get(e);return(0,c.jsx)(l.default,{style:{flex:1,minWidth:0,height:'100%',justifyContent:'flex-end',alignItems:'center'},children:t?(0,c.jsx)(l.default,{style:{width:'100%',maxWidth:22,height:t.morale/5*100+"%",borderTopLeftRadius:4,borderTopRightRadius:4,backgroundColor:t.morale<2.5?r.colours.amber:r.colours.gold}}):(0,c.jsx)(l.default,{style:{width:4,height:4,borderRadius:2,backgroundColor:r.colours.border,marginBottom:2}})},e)})}),(0,c.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(n.Muted,{size:12,children:y(A[0])}),(0,c.jsx)(n.Muted,{size:12,children:y(A[A.length-1])})]}),(0,c.jsxs)(n.Muted,{size:12,children:["Bar height: average morale (1 low to 5 high). Amber: below 2.5. A dot: fewer than ",h.MIN_ANSWERS," answers or none."]})]}),(0,c.jsxs)(n.Card,{children:[(0,c.jsx)(n.T,{weight:"semibold",children:"Staffing vs covers, night by night"}),L.length?L.slice().reverse().map(e=>(0,c.jsxs)(l.default,{testID:"hr-trend-row",style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:8,gap:4},children:[(0,c.jsxs)(n.Row,{style:{justifyContent:'space-between'},gap:6,wrap:!0,children:[(0,c.jsx)(n.T,{weight:"semibold",style:{flexShrink:1},children:y(e.day)}),(0,c.jsx)(n.T,{size:14,colour:r.colours.goldLight,style:{flexShrink:1},children:null!=w(e.day)?`${w(e.day)} covers`:'No bookings'})]}),(0,c.jsxs)(n.Row,{gap:8,style:{alignItems:'center'},children:[(0,c.jsxs)(l.default,{style:{flex:1,minWidth:60,height:6,borderRadius:3,backgroundColor:r.colours.border},children:[null!=e.staffing?(0,c.jsx)(l.default,{style:{position:'absolute',left:`${e.staffing}%`,marginLeft:-6,top:-3,width:12,height:12,borderRadius:6,backgroundColor:r.colours.gold}}):null,(0,c.jsx)(l.default,{style:{position:'absolute',left:'50%',marginLeft:-1,top:-4,width:2,height:14,backgroundColor:r.colours.goldMuted}})]}),(0,c.jsx)(n.T,{size:13,style:{flexShrink:1,maxWidth:'55%'},children:null!=e.staffing?(0,h.staffingWord)(e.staffing,o):'\u2014'})]}),(0,c.jsxs)(n.Muted,{size:12,children:["Morale ",e.morale," \xb7 ",e.answers," answers \xb7 ",e.short," said short, ",e.perfect," perfect, ",e.over," over"]})]},e.day)):(0,c.jsxs)(n.Muted,{children:["No days with ",h.MIN_ANSWERS," or more answers yet."]}),!H&&D.held?(0,c.jsxs)(n.Muted,{size:12,children:[D.held," day",1===D.held?'':'s'," held back (fewer than ",h.MIN_ANSWERS," answers)."]}):null,(0,c.jsx)(n.Muted,{size:12,children:"Covers come from that day\u2019s bookings (cancelled and no-shows left out)."})]}),(0,c.jsxs)(n.Card,{children:[(0,c.jsx)(n.T,{weight:"semibold",children:"Shout-outs"}),P.length?P.map(e=>(0,c.jsxs)(l.default,{testID:"hr-shout-row",style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:6},children:[(0,c.jsxs)(n.T,{size:14,children:[(0,c.jsx)(n.T,{size:14,weight:"semibold",colour:r.colours.goldLight,children:e.to}),e.body?`: ${e.body}`:'']}),(0,c.jsxs)(n.Muted,{size:12,children:[y(e.day)," \xb7 from a teammate"]})]},e.id)):(0,c.jsx)(n.Muted,{children:"No shout-outs yet."})]})]})},_e.HrSettingsCard=function({rid:e}){const o=(0,a.useStore)(t=>t.restaurants.find(t=>t.id===e)?.settings?.hr),i=(0,h.hrSettingsOf)(o),d=t=>a.useStore.getState().updateSettings(e,{hr:{...i,...t}}),[u,f]=(0,s.useState)({});return(0,c.jsxs)(l.default,{style:{gap:8},testID:"hr-settings",children:[(0,c.jsx)(n.Toggle,{testID:"hr-set-on",label:"Ask a quick check-out when people clock out",value:i.on,onChange:e=>d({on:e})}),(0,c.jsx)(n.Toggle,{label:"Let them post a question for the board",value:i.askQuestion,onChange:e=>d({askQuestion:e})}),(0,c.jsx)(n.Toggle,{label:"Let them shout out a teammate",value:i.askShout,onChange:e=>d({askShout:e})}),(0,c.jsx)(n.Toggle,{testID:"hr-set-board",label:"Question board in the Staff, Head Chef and Managers apps",value:i.board,onChange:e=>d({board:e})}),(0,c.jsx)(n.Muted,{size:13,children:"Tip: it only shows after Clock out, never at clock in, and anyone can tap Skip. It\u2019s a card in the app, not a phone notification."}),(0,c.jsxs)(n.Muted,{size:13,children:["Tip: answers are anonymous. No name or staff number is saved, and a day\u2019s results only show once ",h.MIN_ANSWERS," people have answered."]}),(0,c.jsx)(n.T,{weight:"semibold",style:{marginTop:4},children:"Wording"}),v.map(({k:e,label:s})=>(0,c.jsxs)(l.default,{style:{gap:4},children:[(0,c.jsx)(n.Muted,{size:13,children:s}),(0,c.jsx)(t.TextInput,{testID:`hr-word-${e}`,accessibilityLabel:s,value:u[e]??i.wording[e],onChangeText:t=>f({...u,[e]:t}),onBlur:()=>{null!=u[e]&&(d({wording:{...i.wording,[e]:u[e].trim()||h.DEFAULT_HR.wording[e]}}),f(t=>{const s={...t};return delete s[e],s}))},maxLength:'intro'===e||'staffing'===e||'question'===e?160:60,multiline:'intro'===e||'staffing'===e||'question'===e,placeholderTextColor:r.colours.muted,style:[x,'intro'===e||'staffing'===e||'question'===e?{minHeight:92,textAlignVertical:'top'}:null]})]},e)),(0,c.jsx)(n.Muted,{size:13,children:"Tip: keep it short and plain. Leave a box empty to go back to the standard words."})]})};var t=_r(_d[0]),s=_r(_d[1]),o=e(_r(_d[2])),l=e(_r(_d[3])),n=_r(_d[4]),r=_r(_d[5]),i=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),c=_r(_d[11]);const f=e=>(0,h.hrSettingsOf)((0,a.useStore)(t=>t.restaurants.find(t=>t.id===e)?.settings?.hr)),p=e=>e.replace(' (example)','').trim(),x={minHeight:46,borderRadius:12,borderWidth:1,borderColor:r.colours.accentBorder,backgroundColor:r.colours.surface2,color:r.colours.text,paddingHorizontal:12,paddingVertical:10,fontSize:16},y=e=>new Date(`${e}T12:00:00`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'});function b({value:e,onChange:t,w:s}){return(0,c.jsxs)(l.default,{style:{gap:6},testID:"hr-morale",children:[(0,c.jsx)(n.Row,{gap:6,style:{justifyContent:'space-between'},children:h.MORALE_STEPS.map(l=>{const i=e===l;return(0,c.jsx)(o.default,{testID:`hr-morale-${l}`,accessibilityRole:"button",accessibilityState:{selected:i},accessibilityLabel:`Morale ${l} of 5: ${(0,h.moraleWord)(l,s)}`,onPress:()=>t(l),hitSlop:4,style:{flex:1,minWidth:0,minHeight:48,borderRadius:12,borderWidth:1,borderColor:i?r.colours.gold:r.colours.border,backgroundColor:i?r.colours.goldTint:r.colours.surface2,alignItems:'center',justifyContent:'center'},children:(0,c.jsx)(n.T,{size:18,weight:"bold",colour:i?r.colours.goldLight:r.colours.text,children:l})},l)})}),(0,c.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(n.Muted,{size:13,style:{flexShrink:1},children:s.moraleLow}),e?(0,c.jsx)(n.T,{size:13,weight:"semibold",colour:r.colours.goldLight,style:{flexShrink:1,textAlign:'center'},children:(0,h.moraleWord)(e,s)}):null,(0,c.jsx)(n.Muted,{size:13,style:{flexShrink:1,textAlign:'right'},children:s.moraleHigh})]})]})}function j({value:e,onChange:t,w:i}){const a=(0,s.useRef)(null),d=(0,s.useRef)(0),u=(0,s.useRef)(1),f=()=>{a.current?.measureInWindow?.((e,t,s)=>{d.current=e,u.current=Math.max(1,s)})},p=e=>t((0,h.snapStaffing)((e-d.current)/u.current*100)),x=e??50,y=null!=e;return(0,c.jsxs)(l.default,{style:{gap:6},children:[(0,c.jsx)(l.default,{testID:"hr-staffing",accessible:!0,accessibilityRole:"adjustable",accessibilityLabel:`Staffing: ${y?(0,h.staffingWord)(x,i):'not answered'}`,accessibilityActions:[{name:'increment'},{name:'decrement'}],onAccessibilityAction:e=>{const s=h.STAFF_STOPS.indexOf((0,h.snapStaffing)(x)),o='increment'===e.nativeEvent.actionName?Math.min(8,s+1):Math.max(0,s-1);t(h.STAFF_STOPS[o])},onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>!0,onResponderGrant:e=>{f(),p(e.nativeEvent.pageX)},onResponderMove:e=>p(e.nativeEvent.pageX),style:{height:48,justifyContent:'center',paddingHorizontal:15},children:(0,c.jsxs)(l.default,{ref:a,onLayout:f,style:{height:48,justifyContent:'center'},children:[(0,c.jsx)(l.default,{style:{height:6,borderRadius:3,backgroundColor:r.colours.border}}),(0,c.jsx)(l.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:0,bottom:0,flexDirection:'row',justifyContent:'space-between',alignItems:'center'},children:h.STAFF_STOPS.map(e=>(0,c.jsx)(l.default,{style:{width:e%50==0?4:2,height:e%50==0?18:10,borderRadius:2,backgroundColor:e%50==0?r.colours.goldMuted:r.colours.muted}},e))}),(0,c.jsx)(l.default,{pointerEvents:"none",style:{position:'absolute',left:`${x}%`,top:10,marginLeft:-14,width:28,height:28,borderRadius:14,borderWidth:2,borderColor:y?r.colours.gold:r.colours.muted,backgroundColor:y?r.colours.gold:r.colours.surface}})]})}),(0,c.jsx)(n.Row,{style:{justifyContent:'space-between',gap:8},children:[[0,i.staffLow],[50,i.staffMid],[100,i.staffHigh]].map(([e,s],l)=>(0,c.jsx)(o.default,{testID:`hr-staffing-${e}`,accessibilityRole:"button",accessibilityLabel:s,onPress:()=>t(e),hitSlop:6,style:{flexShrink:1,flexGrow:0,minWidth:0},children:(0,c.jsx)(n.T,{size:13,colour:y&&(0,h.snapStaffing)(x)===e?r.colours.goldLight:r.colours.muted,weight:y&&(0,h.snapStaffing)(x)===e?'semibold':'regular',style:{textAlign:0===l?'left':1===l?'center':'right'},children:s})},e))}),y&&(0,h.snapStaffing)(x)%50!=0?(0,c.jsx)(n.T,{size:13,colour:r.colours.goldLight,center:!0,children:(0,h.staffingWord)(x,i)}):null]})}function w({q:e,mine:t,manager:s,onHide:o,onReply:i,by:a}){const d=e.yes+e.no,h=d?Math.round(e.yes/d*100):0;return(0,c.jsx)(n.Card,{style:e.hidden?{opacity:.75}:void 0,children:(0,c.jsxs)(l.default,{testID:"hr-question-card",style:{gap:8},children:[(0,c.jsxs)(n.Row,{gap:8,style:{alignItems:'flex-start'},children:[(0,c.jsx)(n.T,{style:{flex:1,minWidth:0},children:e.body}),e.hidden?(0,c.jsx)(n.Badge,{kind:"amber",label:"HIDDEN"}):null]}),(0,c.jsxs)(n.Muted,{size:12,children:["Asked ",y(e.postedOn)," \xb7 anonymous"]}),'up'===e.kind?(0,c.jsx)(n.Row,{gap:8,wrap:!0,children:(0,c.jsx)(n.Button,{small:!0,testID:"hr-vote-up",kind:t?'success':'secondary',label:t?`\u25b2 Voted \xb7 ${e.up}`:`\u25b2 Vote up \xb7 ${e.up}`,disabled:!!t||e.hidden,onPress:()=>u.useHr.getState().vote(e.id,1)})}):(0,c.jsxs)(l.default,{style:{gap:6},children:[(0,c.jsxs)(n.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(n.Button,{small:!0,testID:"hr-vote-yes",kind:1===t?'success':'secondary',label:`Yes \xb7 ${e.yes}`,disabled:!!t||e.hidden,onPress:()=>u.useHr.getState().vote(e.id,1)}),(0,c.jsx)(n.Button,{small:!0,testID:"hr-vote-no",kind:-1===t?'success':'secondary',label:`No \xb7 ${e.no}`,disabled:!!t||e.hidden,onPress:()=>u.useHr.getState().vote(e.id,-1)})]}),d?(0,c.jsx)(l.default,{style:{height:6,borderRadius:3,backgroundColor:r.colours.border,overflow:'hidden'},children:(0,c.jsx)(l.default,{style:{width:`${h}%`,height:6,backgroundColor:r.colours.gold}})}):null,d?(0,c.jsxs)(n.Muted,{size:12,children:[h,"% yes from ",d," vote",1===d?'':'s']}):null]}),t?(0,c.jsx)(n.Muted,{size:12,children:"You\u2019ve voted. Votes are anonymous."}):null,e.reply?(0,c.jsxs)(l.default,{style:{borderLeftWidth:3,borderColor:r.colours.gold,paddingLeft:10,gap:2},children:[(0,c.jsx)(n.T,{size:13,weight:"semibold",colour:r.colours.goldLight,children:"Reply from the managers"}),(0,c.jsx)(n.T,{size:14,children:e.reply})]}):null,s?(0,c.jsxs)(n.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(n.Button,{small:!0,kind:"ghost",testID:"hr-reply",label:e.reply?'Edit reply':'Reply',onPress:i}),e.hidden?(0,c.jsx)(n.Button,{small:!0,kind:"ghost",testID:"hr-unhide",label:"Show again",onPress:()=>u.useHr.getState().moderate(e.id,'unhide','',a)}):(0,c.jsx)(n.Button,{small:!0,kind:"ghost",testID:"hr-hide",label:"Hide",onPress:o})]}):null]})})}const S=(e,t)=>{const s=new Date(`${e}T12:00:00Z`);return s.setUTCDate(s.getUTCDate()+t),s.toISOString().slice(0,10)};function k(e){const t={};for(const s of e)'cancelled'!==s.status&&'noshow'!==s.status&&(t[s.date]=(t[s.date]??0)+(s.partySize||0));return t}function C(e){let t=0;for(const s of e)t=(31*t+s.charCodeAt(0))%997;return 40+t%90}const v=[{k:'intro',label:'Opening line'},{k:'morale',label:'Morale question'},{k:'moraleLow',label:'Morale: low end'},{k:'moraleHigh',label:'Morale: high end'},{k:'staffing',label:'Staffing question'},{k:'staffLow',label:'Staffing: left'},{k:'staffMid',label:'Staffing: middle'},{k:'staffHigh',label:'Staffing: right'},{k:'question',label:'Question prompt'},{k:'shout',label:'Shout-out prompt'}]},999,[877,30,263,127,813,821,856,872,1022,1151,1152,24]); +__d(function(g,r,_i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ChatAsCtx",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"CHANNELS",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"dmId",{enumerable:!0,get:function(){return p.dmId}}),Object.defineProperty(_e,"inChannel",{enumerable:!0,get:function(){return p.inChannel}}),_e.autoPost=function(e,t){const n=new Date(globalThis.__ccNow??Date.now()).toISOString();(Array.isArray(e)?e:[e]).forEach(e=>u.useOwner.getState().sys(e,t,n))},_e.ensureChat=O,_e.useChatUnread=R,_e.Chat=function({go:e}){return(0,y.jsx)(M,{children:(0,y.jsx)(z,{go:e})})};var t=r(d[0]),n=r(d[1]),s=r(d[2]),a=r(d[3]),o=r(d[4]),i=r(d[5]),l=e(r(d[6])),c=e(r(d[7])),h=r(d[8]),u=r(d[9]),m=r(d[10]),f=r(d[11]),x=r(d[12]),b=r(d[13]),p=r(d[14]),j=r(d[15]),y=r(d[16]);const w=(0,o.createContext)(null);function C(e){const t=(0,x.useCtx)(e),n=(0,o.useContext)(w);return n?{...t,meId:n.meId,role:n.role}:t}const v=[{id:'all',name:'Team',icon:'\ud83d\udce2'},{id:'kitchen',name:'Kitchen',icon:'\ud83c\udf73',pinned:!0},{id:'foh',name:'Front of house',icon:'\ud83c\udf7d\ufe0f'},{id:'managers',name:'Managers',icon:'\ud83d\udd11'}],S=[],k=e=>(e??'').replace(' (example)','');function O(e){if(s.LIVE_VENUE_BUILD)return;if(a.IS_WILDINGS)return;const t=u.useOwner.getState();if(t.chat.some(e=>'m-seed-all'===e.id&&/this phone only/.test(e.text??''))&&u.useOwner.getState().chatPatch('m-seed-all',{text:'Welcome to the team chat on CoverCharge.'}),t.chat.length)return;const n=(t,n,s,a={})=>{return{id:`m-seed-${t}`,ch:t,from:'system',text:s,at:(o=n,new Date(e.getTime()-6e4*o).toISOString()),reactions:{},seenBy:[],...a};var o};u.useOwner.setState({chat:[n('all',5,'Welcome to the team chat on CoverCharge.',{pinned:!0}),n('kitchen',4,'Kitchen channel: Head Chef, kitchen team and managers.'),n('foh',3,'Front of house channel: front of house, bar and managers.'),n('managers',2,'Managers channel: owners, managers and the supervisor only.')]})}function R(){const{meId:e}=C(3e4),{role:t}=C(3e4),n=(0,u.useOwner)(e=>e.chat),s=(0,u.useOwner)(e=>e.staff),a=(0,u.useOwner)(t=>t.chatMuted[e]??S),i=(0,o.useMemo)(()=>T(s,e,t),[s,e,t]);return(0,o.useMemo)(()=>{const t={};return n.forEach(n=>{n.removed||n.from===e||n.seenBy.includes(e)||!(0,p.inChannel)(n.ch,i)||(t[n.ch]=(t[n.ch]??0)+1)}),{by:t,total:Object.entries(t).filter(([e])=>!a.includes(e)).reduce((e,[,t])=>e+t,0)}},[n,e,a,i])}function T(e,t,n){const s=e.find(e=>e.id===t);return s||!t?s:{id:t,name:'You',role:n,job:'',active:!0,level:'owner'===n?'Owner':'manager'===n?'Manager':'Staff',dept:''}}class M extends o.Component{state={err:null};static getDerivedStateFromError(e){return{err:String(e?.message??e)}}componentDidUpdate(e){e.resetKey!==this.props.resetKey&&this.state.err&&this.setState({err:null})}render(){return this.state.err?(0,y.jsxs)(c.default,{style:{gap:10},testID:"chat-error",children:[(0,y.jsx)(h.Banner,{kind:"warn",title:"Chat couldn\u2019t open",children:"Something went wrong showing this chat. Your messages are still saved on this phone. Go back and try again; if it keeps happening, close and reopen the app."}),(0,y.jsx)(h.Button,{kind:"secondary",label:"Back to chats",onPress:()=>{this.setState({err:null}),this.props.onBack?.()}})]}):this.props.children}}const I={owner:f.colours.gold,manager:f.colours.blue,staff:'#7a6f5c'};function P({s:e,size:n=34}){return e?(0,y.jsx)(b.StaffAvatar,{id:e.id,size:n}):(0,y.jsx)(c.default,{style:{width:n,height:n,borderRadius:n/2,backgroundColor:(0,t.soutersSurface)('#333'),alignItems:'center',justifyContent:'center'},children:(0,y.jsx)(h.T,{size:.38*n,weight:"bold",colour:"#111",children:"CC"})})}const B=[{caption:'Specials board',tone:'#4A3A22'},{caption:'Plating: Cullen skink',tone:'#3E2A2A'},{caption:'Delivery arrived',tone:'#40362A'},{caption:'Spillage by the bar',tone:'#2E2E40'}],D=['\ud83d\udc4d','\u2764\ufe0f','\ud83d\ude04','\ud83d\udc4f','\ud83d\udd25'];function E({ch:e,go:s,back:a}){const{now:b,meId:w,role:S,today:O}=C(1e4),R=(0,u.useOwner)(e=>e.staff),T=(0,u.useOwner)(e=>e.chat),M=(0,u.useOwner)(e=>e.shifts),E=T.filter(t=>t.ch===e).sort((e,t)=>e.at.localeCompare(t.at)),[z,A]=(R.find(e=>e.id===w),(0,o.useState)('')),[L,$]=(0,o.useState)(null),[N,_]=(0,o.useState)(!1),[W,H]=(0,o.useState)(!1),K=e.startsWith('dm:')?e.split(':').slice(1).length:R.filter(t=>t.active&&(0,p.inChannel)(e,t)).length;(0,o.useEffect)(()=>{u.useOwner.getState().chatSeen(e,w)},[e,w,E.length]);const U=t=>u.useOwner.getState().chatSend({ch:e,from:w,at:b.toISOString(),...t});(0,i.useBackLayer)(!0,a);const Y=E.filter(e=>e.pinned&&!e.removed),V=e.startsWith('dm:')?k(R.find(t=>t.id===e.split(':').slice(1).find(e=>e!==w))?.name):v.find(t=>t.id===e)?.name,F=(0,j.useChatSync)(e=>e.synced),q=M.filter(e=>e.staffId===w&&e.published&&e.date>=O).sort((e,t)=>e.date.localeCompare(t.date)).slice(0,10);return(0,y.jsxs)(c.default,{style:{gap:8},children:[(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(i.BackButton,{onPress:a,testID:"chat-thread-back"}),(0,y.jsxs)(c.default,{style:{flex:1,alignItems:'flex-end'},children:[(0,y.jsx)(h.T,{weight:"semibold",size:18,children:V}),(0,y.jsxs)(h.Muted,{children:[K," members"]})]})]}),Y.map(e=>(0,y.jsxs)(h.Card,{highlight:f.colours.gold,children:[(0,y.jsxs)(h.T,{size:12,colour:f.colours.gold,children:["\ud83d\udccc ",'system'===e.from?'Pinned note':`Pinned by ${k(R.find(t=>t.id===e.from)?.name)}`]}),(0,y.jsx)(h.T,{size:14,children:e.text})]},e.id)),E.map((n,a)=>{const o=R.find(e=>e.id===n.from),i=n.from===w,x=n.seenBy.filter(e=>e!==n.from).length,b=0===a||n.at.slice(0,10)!==E[a-1].at.slice(0,10);return'system'===n.from?(0,y.jsxs)(c.default,{style:{alignItems:'center',gap:2},children:[b?(0,y.jsx)(h.Muted,{children:(0,m.niceDate)(new Date(n.at))}):null,(0,y.jsx)(c.default,{style:{backgroundColor:(0,t.soutersSurface)('#1c1a14'),borderRadius:10,paddingHorizontal:10,paddingVertical:5,borderWidth:1,borderColor:f.colours.border},children:(0,y.jsxs)(h.T,{size:13,colour:/Allergy|86|Sold out/.test(n.text??'')?f.colours.amber:f.colours.muted,children:["CoverCharge \xb7 ",n.text," \xb7 ",(0,m.hm)(new Date(n.at))]})})]},n.id):(0,y.jsxs)(c.default,{style:{gap:2},children:[b?(0,y.jsx)(h.Muted,{center:!0,children:(0,m.niceDate)(new Date(n.at))}):null,(0,y.jsxs)(h.Row,{style:{alignItems:'flex-start',flexDirection:i?'row-reverse':'row'},children:[(0,y.jsx)(P,{s:o}),(0,y.jsxs)(l.default,{accessibilityRole:"button",accessibilityLabel:`Message from ${o?.name}`,onPress:()=>$(L===n.id?null:n.id),style:{maxWidth:'78%',backgroundColor:i?'#3a2f12':f.colours.surface,borderRadius:14,padding:9,borderWidth:1,borderColor:n.pinned?f.colours.gold:f.colours.border,gap:3},children:[(0,y.jsxs)(h.Row,{gap:6,children:[(0,y.jsx)(h.T,{size:12,weight:"semibold",colour:o?I[o.role]:f.colours.muted,children:k(o?.name)}),(0,y.jsxs)(h.T,{size:11,colour:f.colours.muted,children:[o?u.ROLE_LABEL[o.role]:''," \xb7 ",(0,m.hm)(new Date(n.at))]})]}),n.removed?(0,y.jsx)(h.T,{size:14,colour:f.colours.muted,children:"Message removed by the owner"}):(0,y.jsxs)(y.Fragment,{children:[n.photo?(0,y.jsx)(c.default,{style:{width:200,height:120,borderRadius:10,backgroundColor:n.photo.tone,justifyContent:'flex-end',padding:6},children:(0,y.jsxs)(h.T,{size:12,children:[n.photo.caption," (example image)"]})}):null,n.text?(0,y.jsx)(h.T,{size:15,children:n.text}):null,'cover'===n.action?(0,y.jsx)(h.Button,{small:!0,kind:"secondary",label:"Open cover requests on the rota",onPress:()=>s('more','rota')}):null]}),Object.entries(n.reactions).filter(([,e])=>e.length).length?(0,y.jsx)(h.Row,{wrap:!0,gap:4,children:Object.entries(n.reactions).filter(([,e])=>e.length).map(([e,t])=>(0,y.jsx)(c.default,{style:{borderRadius:10,paddingHorizontal:6,backgroundColor:t.includes(w)?'#4a3c16':'#222'},children:(0,y.jsxs)(h.T,{size:12,children:[e," ",t.length]})},e))}):null,i?(0,y.jsx)(h.T,{size:11,colour:f.colours.muted,children:x?`Seen by ${x}`:'Sent'}):null]})]}),L!==n.id||n.removed?null:(0,y.jsxs)(h.Row,{wrap:!0,gap:6,style:{justifyContent:i?'flex-end':'flex-start',paddingLeft:i?0:40},children:[D.map(e=>(0,y.jsx)(l.default,{accessibilityLabel:`React ${e}`,onPress:()=>{u.useOwner.getState().chatReact(n.id,e,w),$(null)},style:{padding:4},children:(0,y.jsx)(h.T,{size:20,children:e})},e)),'staff'===S||e.startsWith('dm:')?null:(0,y.jsx)(h.Button,{small:!0,kind:"ghost",label:n.pinned?'Unpin':'Pin',onPress:()=>{u.useOwner.getState().chatPatch(n.id,{pinned:!n.pinned}),$(null)}}),'owner'!==S||i?null:(0,y.jsx)(h.Button,{small:!0,kind:"danger",label:"Remove",onPress:()=>{u.useOwner.getState().chatPatch(n.id,{removed:!0,pinned:!1}),$(null)}})]})]},n.id)}),(0,y.jsxs)(h.Row,{gap:6,children:[(0,y.jsx)(l.default,{accessibilityRole:"button",accessibilityLabel:"Send a photo",onPress:()=>_(!0),style:{padding:8},children:(0,y.jsx)(h.T,{size:20,children:"\ud83c\udf9e\ufe0f"})}),(0,y.jsx)(n.TextInput,{accessibilityLabel:"Message",placeholder:`Message ${V}`,placeholderTextColor:"#7D776C",value:z,onChangeText:A,style:[h.styles.input,{flex:1}]}),(0,y.jsx)(h.Button,{small:!0,label:"Send",disabled:!z.trim(),onPress:()=>{U({text:z.trim()}),A('')}})]}),(0,y.jsx)(h.Row,{wrap:!0,gap:6,children:(0,y.jsx)(h.Button,{small:!0,kind:"secondary",label:"Ask for shift cover",onPress:()=>H(!0)})}),F?null:(0,y.jsx)(h.Muted,{center:!0,children:"Not shared yet: this message stays on this phone only. Nobody else will see it."}),(0,y.jsx)(h.Sheet,{visible:N,onClose:()=>_(!1),title:"Send a photo",children:(0,y.jsx)(h.Row,{wrap:!0,gap:8,children:B.map(e=>(0,y.jsx)(l.default,{accessibilityRole:"button",accessibilityLabel:e.caption,onPress:()=>{U({photo:e}),_(!1)},style:{width:'47%',height:100,borderRadius:10,backgroundColor:e.tone,justifyContent:'flex-end',padding:6},children:(0,y.jsx)(h.T,{size:12,children:e.caption})},e.caption))})}),(0,y.jsxs)(h.Sheet,{visible:W,onClose:()=>H(!1),title:"Ask for shift cover",children:[q.length?null:(0,y.jsx)(h.Muted,{children:"You have no shifts on the rota this week."}),q.map(e=>(0,y.jsx)(h.Button,{kind:"secondary",label:`${x.DAY3[e.day]} ${Number(e.date.slice(8))} ${(0,x.fmtH)(e.start)}\u2013${(0,x.fmtH)(e.end)}`,onPress:()=>{const t=`${x.DAY3[e.day]} ${Number(e.date.slice(8))} ${(0,x.fmtH)(e.start)}\u2013${(0,x.fmtH)(e.end)}`;u.useOwner.getState().addSwap({shiftId:e.id,fromId:w,kind:'cover',note:`Cover asked in chat for ${t}`}),U({text:`Can anyone cover my ${t} shift? I\u2019ve added a cover request on the rota.`,action:'cover'}),H(!1)}},e.id)),(0,y.jsx)(h.Muted,{children:"Creates a cover request in Rota \u203a Swaps & leave for a manager to approve."})]})]})}function z({go:e}){const{now:n,meId:s,role:a}=C(3e4),i=(0,u.useOwner)(e=>e.staff),x=(0,u.useOwner)(e=>e.chat),b=(0,u.useOwner)(e=>e.chatMuted[s]??S),{by:w}=R(),I=(0,j.useChatSync)(e=>e.synced),B=(0,j.useChatSync)(e=>e.error),D=(0,p.useKitchenExtra)(e=>e.extra),[z,A]=(0,o.useState)(null),[L,$]=(0,o.useState)(!1),[N,_]=(0,o.useState)(!1);(0,o.useEffect)(()=>{O(n)},[]),(0,o.useEffect)(()=>{A(null)},[s]);const W=T(i,s,a);if(z)return(0,y.jsx)(M,{resetKey:z,onBack:()=>A(null),children:(0,y.jsx)(E,{ch:z,go:e,back:()=>A(null)})});const H=e=>x.filter(t=>t.ch===e).sort((e,t)=>t.at.localeCompare(e.at))[0],K=i.filter(e=>e.active&&e.id!==s).map(e=>{const t=(0,p.dmId)(s,e.id);return{x:e,id:t,u:w[t]??0,l:H(t)?.at??''}}).sort((e,t)=>t.u-e.u||t.l.localeCompare(e.l)||k(e.x.name).localeCompare(k(t.x.name))),U='owner'===a||'manager'===a,Y=({id:e,name:n,icon:s,avatar:a})=>{const o=H(e),u=w[e]??0,x=b.includes(e);return(0,y.jsx)(l.default,{accessibilityRole:"button",accessibilityLabel:`Open ${n}`,onPress:()=>A(e),style:{padding:12,borderTopWidth:1,borderColor:f.colours.border},children:(0,y.jsxs)(h.Row,{children:[a?(0,y.jsx)(P,{s:a}):(0,y.jsx)(c.default,{style:{width:34,height:34,borderRadius:17,backgroundColor:(0,t.soutersSurface)('#222'),alignItems:'center',justifyContent:'center'},children:(0,y.jsx)(h.T,{size:16,children:s})}),(0,y.jsxs)(c.default,{style:{flex:1},children:[(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsxs)(h.T,{weight:u?'bold':'medium',children:[n,x?' \ud83d\udd15':'']}),o?(0,y.jsx)(h.Muted,{children:(0,m.hm)(new Date(o.at))}):null]}),(0,y.jsx)(h.Muted,{numberOfLines:1,children:o?o.removed?'Message removed':`${'system'===o.from?'CoverCharge':k(i.find(e=>e.id===o.from)?.name)}: ${o.text??'Photo'}`:'No messages yet'})]}),u?(0,y.jsx)(c.default,{style:{backgroundColor:x?'#555':f.colours.red,borderRadius:10,minWidth:20,height:20,alignItems:'center',justifyContent:'center',paddingHorizontal:5},children:(0,y.jsx)(h.T,{size:11,weight:"bold",children:u})}):null]})})};return(0,y.jsxs)(c.default,{style:{gap:10},children:[I?(0,y.jsx)(c.default,{testID:"chat-synced",children:(0,y.jsx)(h.Muted,{children:"\u2713 Shared with the team: messages reach everyone in the chat on their own phone."})}):(0,y.jsx)(h.Banner,{kind:"warn",title:"On this device only for now",children:"You\u2019re not connected with your personal link (or chat sharing isn\u2019t switched on yet), so anything you send stays on this device and nobody else will see it. Open your personal invite link to share chat with the team. Use your usual group chat for anything urgent."}),I&&B?(0,y.jsx)(c.default,{testID:"chat-sync-error",children:(0,y.jsx)(h.Banner,{kind:"warn",title:"Can\u2019t reach the server right now",children:"Showing the messages on this phone. New messages will be sent and others\u2019 messages will appear when the connection is back; it retries automatically."})}):null,(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsxs)(h.Muted,{children:["Signed in as ",k(W?.name)," (",'Head Chef'===W?.level?'Head Chef':u.ROLE_LABEL[a],")"]}),(0,y.jsx)(h.Button,{small:!0,kind:"ghost",label:"Chat settings",onPress:()=>_(!0)})]}),(0,y.jsxs)(c.default,{style:{borderRadius:14,borderWidth:1,borderColor:f.colours.border,backgroundColor:f.colours.surface,overflow:'hidden'},children:[(0,y.jsx)(h.T,{size:12,weight:"semibold",colour:f.colours.gold,style:{padding:10},children:"TEAM CHATS"}),v.filter(e=>'all'===e.id||(0,p.inChannel)(e.id,W)).map(e=>(0,y.jsx)(Y,{id:e.id,name:e.pinned?`${e.name} \ud83d\udccc`:e.name,icon:e.icon},e.id))]}),(0,y.jsxs)(c.default,{style:{borderRadius:14,borderWidth:1,borderColor:f.colours.border,backgroundColor:f.colours.surface,overflow:'hidden'},children:[(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between',padding:10},children:[(0,y.jsx)(h.T,{size:12,weight:"semibold",colour:f.colours.gold,children:"PRIVATE MESSAGES"}),(0,y.jsx)(h.Button,{small:!0,kind:"success",label:"New message",testID:"chat-new-pm",onPress:()=>$(!0)})]}),K.map(e=>(0,y.jsx)(Y,{id:e.id,name:k(e.x.name),avatar:e.x},e.id)),K.length?null:(0,y.jsx)(h.Muted,{style:{padding:10},children:"Nobody else on the team yet."})]}),(0,y.jsx)(h.Muted,{children:"Private messages can only be read by the two people in them; owners and managers can\u2019t read other people\u2019s private messages. The Kitchen chat is for owners, managers, head chefs and kitchen staff, and can\u2019t be left."}),(0,y.jsx)(h.Sheet,{visible:L,onClose:()=>$(!1),title:"New private message",children:i.filter(e=>e.active&&e.id!==s).map(e=>(0,y.jsx)(l.default,{accessibilityRole:"button",accessibilityLabel:`Message ${e.name}`,onPress:()=>{$(!1),A((0,p.dmId)(s,e.id))},style:{paddingVertical:8},children:(0,y.jsxs)(h.Row,{children:[(0,y.jsx)(P,{s:e}),(0,y.jsxs)(c.default,{children:[(0,y.jsx)(h.T,{children:k(e.name)}),(0,y.jsxs)(h.Muted,{children:[u.ROLE_LABEL[e.role]," \xb7 ",e.job]})]})]})},e.id))}),(0,y.jsxs)(h.Sheet,{visible:N,onClose:()=>_(!1),title:"Chat settings",children:[(0,y.jsx)(h.Banner,{kind:"info",title:"Privacy",children:"Chat is for work. Managers and the owner see messages in the channels they belong to and the owner can remove messages in group chats. Private messages can only be read by the two people in them: the server enforces this, so nobody else (not even the owner) can read them. Don\u2019t share customer card or health details beyond what\u2019s needed for service."}),(0,y.jsx)(h.T,{weight:"semibold",children:"Mute channels"}),v.filter(e=>(0,p.inChannel)(e.id,W)).map(e=>(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsxs)(h.T,{children:[e.icon," ",e.name]}),(0,y.jsx)(h.Toggle,{label:`Mute ${e.name}`,value:b.includes(e.id),onChange:()=>u.useOwner.getState().chatMute(s,e.id)})]},e.id)),(0,y.jsx)(h.Muted,{children:"Muted channels don\u2019t count towards the tab badge. The Kitchen chat can be muted but not left."}),U?(0,y.jsxs)(c.default,{style:{gap:6},testID:"kitchen-members",children:[(0,y.jsx)(h.T,{weight:"semibold",children:"Kitchen chat members"}),(0,y.jsxs)(h.Muted,{children:["Automatic: owners, managers, head chefs and kitchen staff (chefs, kitchen porters). Change who else is in it here",I?'':'; saved on this device for now',"."]}),i.filter(e=>e.active).map(e=>{const t=D[e.id]??(0,p.kitchenByRule)(e);return(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsxs)(h.T,{children:[k(e.name),null!=D[e.id]?' (changed)':'']}),(0,y.jsx)(h.Toggle,{label:`Kitchen chat: ${k(e.name)}`,value:t,onChange:t=>p.useKitchenExtra.getState().set(e.id,t===(0,p.kitchenByRule)(e)?null:t)})]},e.id)})]}):null]})]})}},1000,[868,877,833,5,30,992,263,127,813,856,818,821,927,953,1118,1209,24]); +__d(function(g,r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SNOOZE_MINS",{enumerable:!0,get:function(){return S}}),e.useScheduledNotices=function({rid:d,staffId:S,name:h,onOpen:w}){const D=(0,t.useRef)(h);D.current=h;const I=(0,t.useRef)(w);I.current=w,(0,t.useEffect)(()=>{if('undefined'==typeof window||!window.location?.search)return;const t=new URLSearchParams(window.location.search);'orderlists'===t.get('open')&&(o.useListOpen.getState().request(t.get('list')??void 0),setTimeout(()=>I.current?.('orderlists'),0))},[]);const N=(0,s.useNotifs)(t=>t.items.map(t=>`${t.id}:${t.updatedAt??''}`).join()),v=(0,c.useReminders)(t=>t.done.length);(0,t.useEffect)(()=>{s.useNotifs.getState().ensure(d);const t=()=>{const t=p(),h=s.useNotifs.getState(),w=n.useOwner.getState().staff.map(t=>({id:t.id,role:t.role,level:t.level,job:t.job,department:t.dept,active:t.active})),N=w.filter(s=>!1!==s.active&&(0,l.shiftNow)(s.id,t).on).map(t=>t.id);for(const n of h.items){if(n.rid!==d)continue;const l=`sched:${n.id}`;if(!S||n.removed||n.paused||!n.sendBy.inApp||!(0,u.isRecipient)(n,S,w,N)){(0,f.dismissNotice)(l);continue}const{due:v,forDate:O}=(0,u.notifDue)(n,t),b=c.useReminders.getState().done.find(t=>t.reminderId===n.id&&t.forDate===O),R=`sched:${n.id}:${O}`;!v||b||(h.snooze[R]??0)>t?(0,f.dismissNotice)(l):(0,f.notify)({id:l,icon:'\ud83d\udd14',kicker:'NOTICE',title:n.title,body:n.message,testID:'sched-notice',timeoutMs:null,actions:[{label:'Done',testID:'sched-notice-done',onPress:()=>c.useReminders.getState().markDone({rid:d,reminderId:n.id,forDate:O,at:new Date(p()).toISOString(),staffRef:S,staffName:D.current.replace(' (example)','')})},...'orderlists'===n.open?.page&&I.current?[{label:'Open list',testID:'sched-notice-open',onPress:()=>{o.useListOpen.getState().request(n.open?.list),I.current?.('orderlists')}}]:[],{label:'Later',kind:'ghost',testID:'sched-notice-later',onPress:()=>s.useNotifs.getState().setSnooze(R,p()+9e5)}]})}};t();const h=setInterval(t,2e4);return()=>clearInterval(h)},[d,S,N,v])};var t=r(_d[0]),s=r(_d[1]),n=r(_d[2]),o=r(_d[3]),c=r(_d[4]),d=r(_d[5]),u=r(_d[6]),f=r(_d[7]),l=r(_d[8]);const p=()=>{try{return(0,d.nowFrom)(d.useStore.getState().clock).getTime()}catch{return Date.now()}},S=15},1001,[30,956,856,1005,957,872,958,947,959]); +__d(function(g,_r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useOffRotaPrompt=function({rid:r,staffId:k}){const w=(0,o.useRef)(!1),h=(0,n.useClockArea)(o=>{const n=o.areas[r];return!(0,t.privateClockVenue)(r)&&!!n&&!1!==n.offRotaPrompt&&null!=n.lat});(0,o.useEffect)(()=>{if(!h||!k)return;const t=async()=>{if(w.current||'undefined'!=typeof document&&'hidden'===document.visibilityState)return;const t=(0,n.areaOf)(r);if(!(0,a.areaSet)(t)||!t.offRotaPrompt)return;const o=l(),y=(0,f.ukClock)(o).ymd,h=`${y}:${k}`,b=s.useOwner.getState();if(n.useClockArea.getState().visiting[h]||(0,s.openShiftOf)(b.attendance,k,new Date(o)))return void(0,d.dismissNotice)('off-rota');if(!await(0,c.locationAllowed)())return;w.current=!0;const v=await(0,c.getFix)();if(w.current=!1,'object'!=typeof v)return;const S=new Date(o),I=b.shifts.filter(t=>t.staffId===k&&t.date===y&&!1!==t.published);(0,a.offRotaDue)({area:t,inside:(0,a.isInside)(t,v).inside,clockedIn:!1,shifts:I,nowHours:S.getHours()+S.getMinutes()/60,dismissedToday:!1})?(0,d.notify)({id:'off-rota',icon:'\ud83d\udccd',kicker:'AT THE VENUE',title:t.offRotaTitle,body:t.offRotaBody,testID:'off-rota',timeoutMs:null,actions:[{label:'Yes, clock me in',testID:'off-rota-yes',onPress:()=>{(0,u.clockAction)('in',{rid:r,staffId:k,date:y,at:new Date(l()).toISOString(),offRota:!0}).then(t=>{(0,d.notify)(t.ok?{id:'off-rota-done',title:'Clocked in',body:'Your manager will see you weren\u2019t on the rota today.',timeoutMs:6e3}:{id:'off-rota-done',tone:'warn',title:'Not clocked in',body:t.message,timeoutMs:9e3})})}},{label:'No, just visiting',kind:'ghost',testID:'off-rota-no',onPress:()=>n.useClockArea.getState().setVisiting(h)}]}):(0,d.dismissNotice)('off-rota')};t();const o=setInterval(()=>{t()},y),b=()=>{'visible'===document.visibilityState&&t()};return'undefined'!=typeof document&&document.addEventListener('visibilitychange',b),()=>{clearInterval(o),'undefined'!=typeof document&&document.removeEventListener('visibilitychange',b)}},[r,k,h])},e.useOffRotaAlerts=function({enabled:t}){const n=(0,o.useRef)(new Set),r=(0,s.useOwner)(t=>t.attendance);(0,o.useEffect)(()=>{if(!t)return;const o=(0,f.ukClock)(l()).ymd;for(const t of r){if(!t.offRota||t.date!==o||n.current.has(t.id))continue;n.current.add(t.id);const r=s.useOwner.getState().staff.find(o=>o.id===t.staffId)?.name??'Someone',a=t.in?new Date(t.in).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}):'';(0,d.notify)({id:`off-rota-mgr:${t.id}`,icon:'\ud83d\udccd',kicker:'NOT ON THE ROTA',title:`${r} clocked in at ${a}`,body:'They weren\u2019t on today\u2019s rota. Check Hours if that\u2019s not right.',timeoutMs:null,actions:[{label:'OK',testID:'off-rota-mgr-ok',onPress:()=>{}}]})}},[r,t])};var t=_r(_d[0]),o=_r(_d[1]),n=_r(_d[2]),s=_r(_d[3]),r=_r(_d[4]),a=_r(_d[5]),f=_r(_d[6]),c=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]);const l=()=>{try{return(0,r.nowFrom)(r.useStore.getState().clock).getTime()}catch{return Date.now()}},y=24e4},1002,[989,30,1207,856,872,954,1108,1274,947,1103]); +__d(function(g,r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ListBadge=C,_e.OrderListsScreen=function({rid:e,who:t,editor:s,today:i}){(0,o.useEffect)(()=>{x.useOrderLists.getState().ensure(e)},[e]);const d=(0,x.useOrderLists)(e=>e.lists).filter(t=>t.rid===e&&!t.archived),n=(0,x.useOrderLists)(e=>e.items);(0,x.useOrderLists)(t=>t.settings[e]);const l=(0,x.orderSettingsOf)(e).allowStaff,h=(0,x.useListOpen)(e=>e.seed),[y,j]=(0,o.useState)(null);(0,o.useEffect)(()=>{if(!h)return;const e=d.find(e=>e.seed===h);e&&(j(e.id),x.useListOpen.getState().request(void 0))},[h,d.length]);const f=s||l;if(!s&&!l)return(0,w.jsxs)(c.Card,{children:[(0,w.jsx)(c.T,{children:"Order lists are for managers and the Head Chef here."}),(0,w.jsx)(c.Muted,{children:"Ask a manager to switch on \u201cLet all staff add items\u201d."})]});const b=d.find(e=>e.id===y);if(b)return(0,w.jsx)($,{rid:e,list:b,editor:s,canAdd:f,who:t,today:i,onBack:()=>j(null)});const I=(0,x.orderSettingsOf)(e).defaultTripDay;return(0,w.jsxs)(u.default,{style:{gap:10},testID:"order-lists",children:[(0,w.jsxs)(c.Muted,{size:13,children:["Tip: add what\u2019s running low as you notice it. ",s?'On the day, tick what you got, then Finish order.':'A manager or the Head Chef places the order.']}),d.map(t=>{const s=(0,p.liveItems)(n.filter(t=>t.rid===e),t.id).filter(e=>'open'===e.status).length;return(0,w.jsx)(c.Card,{onPress:()=>j(t.id),children:(0,w.jsx)(u.default,{testID:`order-list-card-${t.seed??t.id}`,children:(0,w.jsxs)(c.Row,{gap:10,children:[(0,w.jsx)(C,{list:t}),(0,w.jsxs)(u.default,{style:{flex:1},children:[(0,w.jsx)(c.T,{weight:"semibold",children:t.name}),(0,w.jsx)(c.Muted,{size:12,children:(0,p.tripText)(t,i,I)})]}),(0,w.jsx)(c.Badge,{kind:s?'gold':'neutral',label:`${s} to get`})]})})},t.id)}),d.length?null:(0,w.jsx)(c.Muted,{children:"No order lists yet. Add one in Settings \u203a Advanced \u203a Order lists."})]})};var t=r(_d[0]),s=r(_d[1]),i=r(_d[2]),o=r(_d[3]),d=e(r(_d[4])),n=e(r(_d[5]));r(_d[6]);var l=e(r(_d[7])),u=e(r(_d[8])),c=r(_d[9]),h=r(_d[10]),x=r(_d[11]),p=r(_d[12]),y=r(_d[13]),j=r(_d[14]),f=r(_d[15]),b=r(_d[16]),w=r(_d[17]);const I={minHeight:44,borderRadius:10,borderWidth:1,borderColor:h.colours.hairline,backgroundColor:h.colours.surface2,color:h.colours.text,paddingHorizontal:10,fontSize:15},L=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'}):'',v=e=>e.replace(' (example)','').split(' ')[0];function C({list:e,size:s=40}){const i=(0,f.useLogoCache)(t=>t.byList[e.id]),[n,l]=(0,o.useState)(null);(0,o.useEffect)(()=>{let t=!0;return!i&&e.logo&&(0,b.orderLogoUrl)(e.logo).then(e=>{t&&l(e)}),()=>{t=!1}},[e.logo,i]);const x=i??n;return x?(0,w.jsx)(d.default,{testID:`list-logo-${e.seed??e.id}`,source:{uri:x},accessibilityLabel:`${e.name} logo`,style:{width:s,height:s,borderRadius:s/2,borderWidth:1,borderColor:h.colours.gold}}):(0,w.jsx)(u.default,{testID:`list-initials-${e.seed??e.id}`,accessibilityLabel:`${e.name}`,style:{width:s,height:s,borderRadius:s/2,backgroundColor:(0,t.soutersSurface)('#1c1a16'),borderWidth:1,borderColor:h.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,w.jsx)(c.T,{size:.38*s,weight:"bold",colour:h.colours.gold,children:(0,p.initials)(e.name)})})}function D({phone:e}){const t=(0,p.telHref)(e);if(!e||!t)return null;return'undefined'!=typeof navigator&&/Android|iPhone|iPad|iPod/i.test(navigator.userAgent)?(0,w.jsx)(l.default,{testID:"list-phone",accessibilityRole:"link",onPress:()=>{n.default.openURL(t)},children:(0,w.jsxs)(c.T,{colour:h.colours.gold,children:["\ud83d\udcde Call ",e]})}):(0,w.jsxs)(c.Row,{gap:8,children:[(0,w.jsx)(u.default,{testID:"list-phone",children:(0,w.jsxs)(c.T,{children:["\ud83d\udcde ",e]})}),(0,w.jsx)(c.Button,{small:!0,kind:"ghost",testID:"list-phone-copy",label:"Copy",onPress:()=>{navigator.clipboard?.writeText(e).then(()=>(0,y.notify)({id:'copied',title:'Number copied',timeoutMs:3e3}))}})]})}function T({list:e}){const t=x.useOrderLists.getState(),s=(0,f.useLogoCache)(t=>!!t.byList[e.id])||!!e.logo,i=async s=>{try{const i=await(0,j.capturePlatingPhoto)(s);if(!i)return;const o=await(0,f.squareLogo)(i.dataUrl,256);f.useLogoCache.getState().put(e.id,o);const d=await(0,b.uploadOrderLogo)(e.id,o);if(d.ok){const s=e.logo;t.updateList(e.id,{logo:d.path}),s&&(0,b.removeOrderLogo)(s)}else'offline'!==d.message&&(0,y.notify)({id:'logo',tone:'warn',title:'Logo saved on this device only',body:d.message,timeoutMs:7e3})}catch(e){(0,y.notify)({id:'logo',tone:'warn',title:'Couldn\u2019t use that picture',body:String(e.message),timeoutMs:7e3})}};return(0,w.jsxs)(c.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(c.Button,{small:!0,kind:"secondary",testID:"logo-camera",label:s?'Replace: take photo':'Logo: take photo',onPress:()=>{i('camera')}}),(0,w.jsx)(c.Button,{small:!0,kind:"secondary",testID:"logo-library",label:s?'Replace: choose':'Logo: choose image',onPress:()=>{i('library')}}),s?(0,w.jsx)(c.Button,{small:!0,kind:"ghost",testID:"logo-remove",label:"Remove logo",onPress:()=>{f.useLogoCache.getState().drop(e.id),e.logo&&(0,b.removeOrderLogo)(e.logo),t.updateList(e.id,{logo:void 0})}}):null]})}function S({rid:e,list:t,who:i}){const[d,n]=(0,o.useState)(''),[l,y]=(0,o.useState)('1'),[j,f]=(0,o.useState)(''),[b,L]=(0,o.useState)(''),[C,D]=(0,o.useState)(null),T=x.useOrderLists.getState(),S=Number(l.replace(',','.')),B=d.trim().length>0&&(0,p.validQty)(S),$=()=>{n(''),y('1'),L(''),D(null)};return(0,w.jsxs)(u.default,{testID:"order-add",style:{gap:6},children:[(0,w.jsxs)(c.Row,{gap:6,children:[(0,w.jsx)(s.TextInput,{accessibilityLabel:"Item",testID:"order-add-name",value:d,onChangeText:n,placeholder:"Item, e.g. Tennent\u2019s",placeholderTextColor:h.colours.muted,style:{...I,flex:1}}),(0,w.jsx)(s.TextInput,{accessibilityLabel:"Quantity",testID:"order-add-qty",value:l,onChangeText:y,keyboardType:"decimal-pad",style:{...I,width:64,borderColor:(0,p.validQty)(S)?h.colours.hairline:h.colours.red}})]}),(0,w.jsx)(c.Row,{wrap:!0,gap:4,children:p.UNITS.map(e=>(0,w.jsx)(c.Chip,{label:e||'no unit',selected:j===e,onPress:()=>f(e)},e||'none'))}),(0,w.jsxs)(c.Row,{gap:6,children:[(0,w.jsx)(s.TextInput,{accessibilityLabel:"Note",testID:"order-add-note",value:b,onChangeText:L,placeholder:"Note (optional)",placeholderTextColor:h.colours.muted,style:{...I,flex:1}}),(0,w.jsx)(c.Button,{testID:"order-add-save",label:"Add",disabled:!B,onPress:()=>{const s=(0,p.findDuplicate)(T.items.filter(t=>t.rid===e),t.id,d,j);s?D(s):(T.addItem(e,{listId:t.id,name:d.trim(),qty:S,unit:j,note:b.trim()||void 0,addedBy:i.id,addedByName:i.name}),$())}})]}),(0,w.jsxs)(c.Sheet,{visible:!!C,onClose:()=>D(null),title:"Already on the list",testID:"order-dup",children:[(0,w.jsx)(c.T,{children:C?`${C.name}: ${(0,p.qtyText)(C)} (added by ${v(C.addedByName)})`:''}),(0,w.jsxs)(c.Row,{gap:8,children:[(0,w.jsx)(c.Button,{testID:"order-dup-bump",label:`Add ${l} more`,onPress:()=>{C&&T.bump(C.id,S,i),$()}}),(0,w.jsx)(c.Button,{kind:"ghost",label:"Add as separate item",onPress:()=>{T.addItem(e,{listId:t.id,name:d.trim(),qty:S,unit:j,note:b.trim()||void 0,addedBy:i.id,addedByName:i.name}),$()}})]})]})]})}function B({item:e,editor:t,who:s}){const i=x.useOrderLists.getState(),o='got'===e.status?h.colours.gold:'missing'===e.status?h.colours.amber:h.colours.text;return(0,w.jsxs)(u.default,{testID:`order-item-${e.id}`,style:{borderTopWidth:1,borderColor:h.colours.hairline,paddingVertical:8,gap:4},children:[(0,w.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(c.T,{weight:"semibold",colour:o,style:{flex:1,textDecorationLine:'got'===e.status?'line-through':'none'},children:e.name}),(0,w.jsx)(c.T,{weight:"semibold",children:(0,p.qtyText)(e)})]}),e.note?(0,w.jsxs)(c.Muted,{size:12,children:["Note: ",e.note]}):null,(0,w.jsxs)(c.Muted,{size:12,children:["Added by ",v(e.addedByName)," \xb7 ",L(e.addedAt),e.bumps?.length?` \xb7 +${e.bumps.map(e=>`${e.qty} ${v(e.name)}`).join(', ')}`:'',e.carried?' \xb7 carried over':'']}),'open'!==e.status?(0,w.jsxs)(c.Muted,{size:12,children:['got'===e.status?'Got / ordered':'Missing / not in stock'," \xb7 ",e.statusBy," ",L(e.statusAt)]}):null,t?(0,w.jsxs)(c.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(c.Chip,{testID:`order-got-${e.id}`,label:"\u2713 Got / ordered",selected:'got'===e.status,onPress:()=>i.setStatus(e.id,'got'===e.status?'open':'got',s)}),(0,w.jsx)(c.Chip,{testID:`order-missing-${e.id}`,label:"Missing / not in stock",selected:'missing'===e.status,onPress:()=>i.setStatus(e.id,'missing'===e.status?'open':'missing',s)}),(0,w.jsx)(c.Chip,{testID:`order-remove-${e.id}`,label:"Remove",onPress:()=>{i.removeItem(e.id),(0,y.notify)({id:`undo-${e.id}`,title:`Removed ${e.name}`,timeoutMs:8e3,actions:[{label:'Undo',testID:'order-undo',onPress:()=>i.undoRemove(e.id)}]})}})]}):null]})}function $({rid:e,list:t,editor:d,canAdd:n,who:l,today:j,onBack:f}){(0,i.useBackLayer)(!0,f);const b=(0,x.useOrderLists)(e=>e.items),$=(0,x.useOrderLists)(e=>e.history).filter(e=>e.listId===t.id),P=(0,p.liveItems)(b.filter(t=>t.rid===e),t.id),[k,R]=(0,o.useState)(!1),[O,M]=(0,o.useState)(!1),[A,z]=(0,o.useState)(t.phone??''),N=x.useOrderLists.getState(),q=P.filter(e=>'got'!==e.status).length,H=(0,x.orderSettingsOf)(e).defaultTripDay;return(0,w.jsxs)(u.default,{style:{gap:10},testID:`order-list-${t.seed??t.id}`,children:[(0,w.jsx)(i.BackButton,{onPress:f,testID:"order-list-back"}),(0,w.jsxs)(c.Card,{children:[(0,w.jsxs)(c.Row,{gap:10,children:[(0,w.jsx)(C,{list:t,size:48}),(0,w.jsxs)(u.default,{style:{flex:1},children:[(0,w.jsx)(c.T,{size:18,weight:"semibold",children:t.name}),(0,w.jsx)(c.Muted,{size:12,children:(0,p.tripText)(t,j,H)})]})]}),(0,w.jsx)(D,{phone:t.phone}),'trip'===t.kind&&d?(0,w.jsxs)(u.default,{style:{gap:4},children:[(0,w.jsx)(c.Muted,{size:12,children:"Trip day for this trip"}),(0,w.jsx)(c.Row,{wrap:!0,gap:4,children:[1,2,3,4,5,6,0].map(e=>(0,w.jsx)(c.Chip,{testID:`trip-day-${e}`,label:p.DAY_FULL[e].slice(0,3),selected:(t.tripDay??H)===e,onPress:()=>N.updateList(t.id,{tripDay:e})},e))})]}):null,d?(0,w.jsxs)(u.default,{style:{gap:6},children:[(0,w.jsx)(c.Row,{gap:6,children:(0,w.jsx)(s.TextInput,{accessibilityLabel:"Phone number",testID:"list-phone-edit",value:A,onChangeText:z,onBlur:()=>N.updateList(t.id,{phone:A.trim()||void 0}),placeholder:"Phone (optional)",placeholderTextColor:h.colours.muted,style:{...I,flex:1}})}),(0,w.jsx)(T,{list:t})]}):null]}),n?(0,w.jsxs)(c.Card,{children:[(0,w.jsx)(c.T,{weight:"semibold",children:"Add to this list"}),(0,w.jsx)(S,{rid:e,list:t,who:l})]}):null,(0,w.jsxs)(c.Card,{children:[(0,w.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(c.T,{weight:"semibold",children:"On the list"}),(0,w.jsx)(c.Badge,{kind:"neutral",label:`${P.length}`})]}),P.length?P.map(e=>(0,w.jsx)(B,{item:e,editor:d,who:l},e.id)):(0,w.jsx)(c.Muted,{children:"Nothing on this list yet."}),d&&P.length?(0,w.jsx)(c.Button,{testID:"order-finish",label:"Finish order",onPress:()=>R(!0)}):null]}),(0,w.jsx)(c.Button,{small:!0,kind:"ghost",testID:"order-history",label:O?'Hide history \u25b4':`History (${$.length}) \u25be`,onPress:()=>M(!O)}),O?$.map(e=>(0,w.jsxs)(c.Card,{children:[(0,w.jsxs)(c.T,{weight:"semibold",children:[L(e.finishedAt)," \xb7 ",v(e.finishedByName)]}),(0,w.jsx)(c.Muted,{size:12,children:e.items.map(e=>`${e.name} ${(0,p.qtyText)(e)}${'missing'===e.status?' (missing)':'open'===e.status?' (not got)':''}`).join(' \xb7 ')}),e.carried?(0,w.jsxs)(c.Muted,{size:12,children:[e.carried," carried over"]}):null]},e.id)):null,(0,w.jsxs)(c.Sheet,{visible:k,onClose:()=>R(!1),title:"Finish this order?",testID:"order-finish-sheet",children:[(0,w.jsxs)(c.T,{children:[P.length-q," got or ordered",q?`, ${q} not got (missing or still open)`:'',"."]}),(0,w.jsx)(c.Muted,{children:"It goes into History with today\u2019s date and your name."}),q?(0,w.jsxs)(c.T,{weight:"semibold",children:["Carry over the ",q," not got to the next order?"]}):null,(0,w.jsxs)(c.Row,{wrap:!0,gap:8,children:[q?(0,w.jsx)(c.Button,{testID:"order-finish-carry",label:"Finish and carry over",onPress:()=>{N.finish(e,t.id,!0,l),R(!1),(0,y.notify)({id:'order-done',title:`${t.name}: order finished`,body:`${q} carried over`,timeoutMs:6e3})}}):null,(0,w.jsx)(c.Button,{testID:"order-finish-clear",kind:q?'secondary':'primary',label:q?'Finish, don\u2019t carry over':'Finish order',onPress:()=>{N.finish(e,t.id,!1,l),R(!1),(0,y.notify)({id:'order-done',title:`${t.name}: order finished`,timeoutMs:6e3})}}),(0,w.jsx)(c.Button,{kind:"ghost",label:"Cancel",onPress:()=>R(!1)})]})]})]})}},1003,[868,877,992,30,196,239,122,263,127,813,821,1005,1206,947,1294,1295,820,24]); +__d(function(_g,_r,i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.NotificationsSettings=function({rid:e}){(0,n.useEffect)(()=>{c.useNotifs.getState().ensure(e),(0,j.readPushLive)()},[e]);const t=(0,c.useNotifs)(e=>e.items).filter(t=>t.rid===e&&!t.removed),s=(0,h.useOwner)(e=>e.staff),o=(0,j.usePushLive)(),[l,p]=(0,n.useState)(null),[f,g]=(0,n.useState)(null),[x,b]=(0,n.useState)(!1),y=c.useNotifs.getState(),T=s.map(e=>({id:e.id,role:e.role,level:e.level,job:e.job,department:e.dept,active:e.active})),v=e=>{const t=(0,u.resolveRecipients)(e,T,[]),n=[...e.recipients.groups.map(e=>u.NOTIF_GROUP_LABEL[e]),...(e.recipients.onShiftIn??[]).map(e=>u.SHIFT_FILTER_LABEL[e])];e.recipients.fallback&&n.push(`else ${[...e.recipients.fallback.groups.map(e=>u.NOTIF_GROUP_LABEL[e]),...e.recipients.fallback.staff.map(e=>I(s.find(t=>t.id===e)?.name??e))].join(', ')}`);const o=e.recipients.staff.map(e=>I(s.find(t=>t.id===e)?.name??e));return[...n,...o].join(', ')+(t.length||(e.recipients.onShiftIn??[]).length?'':' (nobody yet)')};return(0,k.jsxs)(a.default,{style:{gap:10},testID:"notif-settings",children:[(0,k.jsx)(r.Muted,{size:13,children:"Tip: these remind people at a set time, e.g. the Mills milk order. They show in the app as a gold slider with Done and Later. Done is logged with the name and time. Times are UK time."}),(0,k.jsxs)(a.default,{testID:"push-live-status",style:{borderWidth:1,borderColor:d.colours.accentBorder,borderRadius:10,padding:8,gap:4},children:[(0,k.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(r.T,{weight:"semibold",children:"Send to phones"}),(0,k.jsx)(r.Badge,{kind:o.live?'gold':'neutral',label:o.live?'ON':'OFF'})]}),(0,k.jsx)(r.Muted,{size:12,children:o.live?'Phone notifications go to people who turned them on.':'Off: nothing goes to anyone\u2019s phone yet. In-app reminders still work.'}),(0,k.jsx)(r.Button,{small:!0,kind:"secondary",testID:"push-live-toggle",label:o.live?'Switch phone notifications off':'Switch phone notifications on\u2026',onPress:()=>b(!0)})]}),(0,k.jsx)(R,{}),t.map(e=>l===e.id?(0,k.jsx)(D,{init:e,onCancel:()=>p(null),onSave:t=>{y.update(e.id,t),p(null)}},e.id):(0,k.jsxs)(a.default,{testID:`notif-${e.seed??e.id}`,style:{borderWidth:1,borderColor:d.colours.hairline,borderRadius:12,padding:10,gap:4,opacity:e.paused?.6:1},children:[(0,k.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(r.T,{weight:"semibold",style:{flex:1},children:e.title}),e.paused?(0,k.jsx)(r.Badge,{kind:"neutral",label:"Off"}):null]}),(0,k.jsx)(r.Muted,{size:13,children:e.message}),(0,k.jsxs)(r.Muted,{size:12,children:[(0,u.scheduleText)(e)," \xb7 ",v(e)," \xb7 ",[e.sendBy.inApp?'In app':'',e.sendBy.push?'Phone':''].filter(Boolean).join(' + ')]}),(0,k.jsxs)(r.Row,{gap:6,children:[(0,k.jsx)(r.Button,{small:!0,kind:"secondary",testID:`notif-edit-${e.seed??e.id}`,label:"Edit",onPress:()=>p(e.id)}),(0,k.jsx)(r.Button,{small:!0,kind:"ghost",label:e.paused?'Switch on':'Switch off',onPress:()=>y.update(e.id,{paused:!e.paused})}),(0,k.jsx)(r.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>g(e)})]})]},e.id)),'new'===l?(0,k.jsx)(D,{init:C,onCancel:()=>p(null),onSave:t=>{y.add(e,t),p(null)}}):(0,k.jsx)(r.Button,{small:!0,testID:"notif-add",label:"Add a notification",onPress:()=>p('new')}),(0,k.jsxs)(r.Sheet,{visible:!!f,onClose:()=>g(null),title:"Remove this notification?",children:[(0,k.jsx)(r.T,{children:f?.title}),(0,k.jsx)(r.Muted,{children:"Nobody gets it after this. Reset to default restores the configured rules."}),(0,k.jsxs)(r.Row,{gap:8,children:[(0,k.jsx)(r.Button,{label:"Remove",onPress:()=>{f&&y.remove(f.id),g(null)}}),(0,k.jsx)(r.Button,{kind:"ghost",label:"Cancel",onPress:()=>g(null)})]})]}),(0,k.jsxs)(r.Sheet,{visible:x,onClose:()=>b(!1),title:o.live?'Switch phone notifications off?':'Switch phone notifications on?',testID:"push-live-confirm",children:[(0,k.jsx)(r.T,{children:o.live?'Nothing more goes to phones. In-app reminders keep working.':'From the next scheduled time, everyone ticked on a notification with \u201cPhone notification\u201d gets it on any phone where they turned phone notifications on.'}),(0,k.jsxs)(r.Row,{gap:8,children:[(0,k.jsx)(r.Button,{testID:"push-live-yes",label:o.live?'Switch off':'Yes, switch on',onPress:()=>{(0,j.setPushLive)(!o.live).then(e=>(0,w.notify)({id:'push-live',tone:e.ok?'normal':'warn',title:e.ok?o.live?'Phone notifications are off':'Phone notifications are on':'Not changed',body:e.message??'',timeoutMs:7e3})),b(!1)}}),(0,k.jsx)(r.Button,{kind:"ghost",label:"Cancel",onPress:()=>b(!1)})]})]})]})},_e.PushButton=R,_e.OrderListsSettings=function({rid:e}){(0,n.useEffect)(()=>{p.useOrderLists.getState().ensure(e)},[e]);const s=(0,p.useOrderLists)(e=>e.lists).filter(t=>t.rid===e),o=(0,p.orderSettingsOf)(e);(0,p.useOrderLists)(t=>t.settings[e]);const l=p.useOrderLists.getState(),[c,u]=(0,n.useState)(''),[h,g]=(0,n.useState)({});return(0,k.jsxs)(a.default,{style:{gap:10},testID:"order-list-settings",children:[(0,k.jsx)(r.Muted,{size:13,children:"Tip: running lists (like Alsons drinks) collect items until you order; trip lists (like Cash and carry) are for one shopping day. Logos and phone numbers are set on each list."}),(0,k.jsx)(r.Toggle,{testID:"order-allow-staff",label:"Let all staff add items",value:o.allowStaff,onChange:t=>l.setSettings(e,{allowStaff:t})}),(0,k.jsx)(r.Muted,{size:12,children:"Staff can add items and see the lists. Only managers and the Head Chef tick, remove or finish an order."}),(0,k.jsx)(r.T,{weight:"semibold",children:"Default trip day"}),(0,k.jsx)(r.Row,{wrap:!0,gap:6,children:v.map(t=>(0,k.jsx)(r.Chip,{label:f.DAY_FULL[t].slice(0,3),selected:o.defaultTripDay===t,onPress:()=>l.setSettings(e,{defaultTripDay:t})},t))}),s.map(e=>(0,k.jsxs)(a.default,{testID:`order-list-row-${e.seed??e.id}`,style:{borderWidth:1,borderColor:d.colours.hairline,borderRadius:10,padding:8,gap:6,opacity:e.archived?.55:1},children:[(0,k.jsxs)(r.Row,{gap:6,children:[(0,k.jsx)(t.TextInput,{accessibilityLabel:`Rename ${e.name}`,value:h[e.id]??e.name,onChangeText:t=>g(s=>({...s,[e.id]:t})),onBlur:()=>{const t=(h[e.id]??'').trim();t&&t!==e.name&&l.updateList(e.id,{name:t})},style:{...T,flex:1,minWidth:0}}),(0,k.jsx)(r.Badge,{kind:"neutral",label:'trip'===e.kind?'Trip':'Running'})]}),'trip'===e.kind?(0,k.jsx)(r.Row,{wrap:!0,gap:6,children:v.map(t=>(0,k.jsx)(r.Chip,{label:f.DAY_FULL[t].slice(0,3),selected:(e.tripDay??o.defaultTripDay)===t,onPress:()=>l.updateList(e.id,{tripDay:t})},t))}):null,(0,k.jsx)(r.Row,{gap:6,children:(0,k.jsx)(r.Button,{small:!0,kind:"ghost",label:e.archived?'Bring back':'Archive',onPress:()=>l.updateList(e.id,{archived:!e.archived})})})]},e.id)),(0,k.jsxs)(r.Row,{gap:6,wrap:!0,children:[(0,k.jsx)(t.TextInput,{accessibilityLabel:"New list name",testID:"order-new-name",value:c,onChangeText:u,placeholder:"e.g. Butcher",placeholderTextColor:d.colours.muted,style:{...T,flexGrow:1,flexBasis:160,minWidth:0}}),(0,k.jsx)(r.Button,{small:!0,label:"Add running",disabled:c.trim().length<2,onPress:()=>{l.addList(e,{name:c.trim(),kind:'running'}),u('')}}),(0,k.jsx)(r.Button,{small:!0,kind:"secondary",label:"Add trip",disabled:c.trim().length<2,onPress:()=>{l.addList(e,{name:c.trim(),kind:'trip',tripDay:o.defaultTripDay}),u('')}})]})]})},Object.defineProperty(_e,"resetOrderLists",{enumerable:!0,get:function(){return B}}),_e.ClockAreaSettings=function({rid:e,me:c}){(0,g.useClockArea)(t=>t.areas[e]);const u=(0,g.areaOf)(e);const h=g.useClockArea.getState(),p=(0,s.privateClockVenue)(e),[f,j]=(0,n.useState)(null==u.lat?'':String(u.lat)),[y,w]=(0,n.useState)(null==u.lng?'':String(u.lng)),[v,S]=(0,n.useState)(!1),[I,C]=(0,n.useState)(''),[L,D]=(0,n.useState)(u.breakOptions.join(', ')),R=(t,s)=>{const n=Number(t),o=Number(s);t.trim()||s.trim()?Number.isFinite(n)&&Number.isFinite(o)&&Math.abs(n)<=90&&Math.abs(o)<=180&&h.set(e,{lat:n,lng:o},c):h.set(e,{lat:null,lng:null},c)},B=async()=>{if(p)return;S(!0),C('');const t=await(0,b.getFix)();if(S(!1),'object'!=typeof t)return void C('denied'===t?'Location is blocked for this app. Allow it in your browser or phone settings.':'Couldn\u2019t get your location. Try again outside or near a window.');const s=t.lat.toFixed(6),n=t.lng.toFixed(6);j(s),w(n),h.set(e,{lat:Number(s),lng:Number(n)},c),C(`Centre set to where you are (accurate to about ${Math.round(t.acc)} m).`)},P=(0,x.areaSet)(u);return(0,k.jsxs)(a.default,{style:{gap:10},testID:"clock-area-settings",children:[(0,k.jsx)(r.Muted,{size:13,children:p?'The address-matched pub centre is configured below. Only clock-in checks location; only pass/fail is saved. No background, clock-out or break checks. Change the radius or centre here; use a manager override for a refused check.':'Tip: stand in the middle of the venue and tap \u201cUse my current location\u201d. Clocking in, out and breaks then only work within the distance below. Rota and pay screens are never blocked.'}),P?null:(0,k.jsx)(r.Banner,{kind:"warn",title:"Clock-in area not set yet",children:"Until you set the centre, staff can clock in from anywhere."}),p?(0,k.jsx)(r.Muted,{children:"Clock-in at the pub is required. A manager can record an exception with a reason."}):(0,k.jsx)(r.Toggle,{testID:"clock-area-on",label:"Check people are at the venue",value:u.on,onChange:t=>h.set(e,{on:t},c)}),p?null:(0,k.jsx)(r.Button,{testID:"clock-area-here",label:v?'Finding you\u2026':'\ud83d\udccd Use my current location',disabled:v,onPress:()=>{B()}}),I?(0,k.jsx)(r.Muted,{size:13,children:I}):null,(0,k.jsxs)(r.Row,{wrap:!0,gap:8,children:[(0,k.jsxs)(a.default,{style:{gap:2},children:[(0,k.jsx)(r.Muted,{size:12,children:"Latitude"}),(0,k.jsx)(t.TextInput,{accessibilityLabel:"Latitude",testID:"clock-area-lat",value:f,onChangeText:j,onBlur:()=>R(f,y),placeholder:"55.40\u2026",placeholderTextColor:d.colours.muted,style:{...T,width:130}})]}),(0,k.jsxs)(a.default,{style:{gap:2},children:[(0,k.jsx)(r.Muted,{size:12,children:"Longitude"}),(0,k.jsx)(t.TextInput,{accessibilityLabel:"Longitude",testID:"clock-area-lng",value:y,onChangeText:w,onBlur:()=>R(f,y),placeholder:"-4.75\u2026",placeholderTextColor:d.colours.muted,style:{...T,width:130}})]})]}),P?(0,k.jsx)(l.default,{accessibilityRole:"link",testID:"clock-area-map",onPress:()=>{o.default.openURL(`https://www.openstreetmap.org/?mlat=${u.lat}&mlon=${u.lng}#map=18/${u.lat}/${u.lng}`)},children:(0,k.jsx)(r.T,{size:13,colour:d.colours.gold,children:"See the pin on a map \u203a"})}):null,(0,k.jsx)(r.T,{weight:"semibold",children:"How far from the centre"}),(0,k.jsxs)(r.Row,{gap:8,children:[(0,k.jsx)(r.Button,{small:!0,kind:"secondary",label:"\u2212",onPress:()=>h.set(e,{radius:(0,x.clampRadius)(u.radius-10)},c)}),(0,k.jsxs)(r.T,{weight:"semibold",style:{minWidth:70,textAlign:'center'},children:[u.radius," m"]}),(0,k.jsx)(r.Button,{small:!0,kind:"secondary",label:"+",onPress:()=>h.set(e,{radius:(0,x.clampRadius)(u.radius+10)},c)})]}),(0,k.jsxs)(r.Muted,{size:12,children:["At least ",x.MIN_RADIUS," m. Phones aren\u2019t exact, so up to 50 m of the phone\u2019s own accuracy is added on top."]}),(0,k.jsx)(r.T,{weight:"semibold",children:"Forgotten break: lengths to offer at clock-out"}),(0,k.jsx)(t.TextInput,{accessibilityLabel:"Break lengths in minutes",testID:"clock-break-options",value:L,onChangeText:D,onBlur:()=>{const t=L.split(/[ ,]+/).map(Number).filter(e=>Number.isFinite(e)&&e>0&&e<=180);t.length&&h.set(e,{breakOptions:[...new Set(t)].sort((e,t)=>e-t)},c),D((0,g.areaOf)(e).breakOptions.join(', '))},style:T}),(0,k.jsxs)(r.Muted,{size:12,children:["Minutes, e.g. 5, 10, 15, 20, 30, 45, 60. Shows as ",u.breakOptions.map(x.breakLabel).join(', ')," and \u201cNo break\u201d."]}),p?(0,k.jsx)(r.Muted,{children:"No automatic arrival checks: staff location is used only at clock-in."}):(0,k.jsxs)(k.Fragment,{children:[" ",(0,k.jsx)(r.T,{weight:"semibold",children:"Not on the rota"}),(0,k.jsx)(r.Toggle,{testID:"clock-offrota-on",label:"Ask people at the venue who aren\u2019t on the rota if they want to clock in",value:u.offRotaPrompt,onChange:t=>h.set(e,{offRotaPrompt:t},c)}),(0,k.jsx)(t.TextInput,{accessibilityLabel:"Off-rota question",testID:"clock-offrota-title",value:u.offRotaTitle,onChangeText:t=>h.set(e,{offRotaTitle:t||x.DEFAULT_CLOCK_AREA.offRotaTitle},c),style:T}),(0,k.jsx)(t.TextInput,{accessibilityLabel:"Off-rota second line",testID:"clock-offrota-body",value:u.offRotaBody,onChangeText:t=>h.set(e,{offRotaBody:t||x.DEFAULT_CLOCK_AREA.offRotaBody},c),style:T}),(0,k.jsx)(r.Muted,{size:12,children:"This only checks while the app is open (web apps can\u2019t watch location in the background; that would need a native app)."})]})]})},Object.defineProperty(_e,"resetClockArea",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"COOKSAFE_URL",{enumerable:!0,get:function(){return O}}),_e.FoodSafetyCard=function({children:e}){return(0,k.jsx)(r.Card,{children:(0,k.jsxs)(a.default,{testID:"food-safety",style:{gap:6},children:[(0,k.jsx)(r.T,{size:17,weight:"semibold",children:"Food safety"}),(0,k.jsxs)(r.T,{children:["Based on ",(0,k.jsx)(r.T,{weight:"bold",colour:d.colours.gold,children:"CookSafe"})," (Food Standards Scotland)"]}),(0,k.jsx)(r.Muted,{size:12,children:"CoverCharge is not endorsed by Food Standards Scotland."}),(0,k.jsx)(l.default,{accessibilityRole:"link",testID:"cooksafe-link",onPress:()=>{o.default.openURL(O)},children:(0,k.jsx)(r.T,{size:14,colour:d.colours.gold,children:"Open the CookSafe guidance \u203a"})}),(0,k.jsx)(r.Muted,{size:13,children:"Full logs coming in the next update."}),e]})})};var t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),o=e(_r(_d[3])),l=e(_r(_d[4])),a=e(_r(_d[5])),r=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),f=_r(_d[12]),g=_r(_d[13]),x=_r(_d[14]),b=_r(_d[15]),j=_r(_d[16]),y=_r(_d[17]),w=_r(_d[18]),k=_r(_d[19]);const T={minHeight:44,borderRadius:10,borderWidth:1,borderColor:d.colours.hairline,backgroundColor:d.colours.surface2,color:d.colours.text,paddingHorizontal:10,fontSize:15},v=[1,2,3,4,5,6,0],S=['on_shift','everyone','managers','head_chef','kitchen','foh'],I=e=>e.replace(' (example)',''),C={title:'',message:'',days:[3,4,5,6,0],time:'21:00',recipients:{staff:[],groups:[]},sendBy:{inApp:!0,push:!1}};function L({value:e,onChange:t}){const s=(0,h.useOwner)(e=>e.staff).filter(e=>e.active);return(0,k.jsxs)(a.default,{style:{gap:6},testID:"notif-recipients",children:[(0,k.jsx)(r.T,{weight:"semibold",children:"Who gets it"}),(0,k.jsx)(r.Muted,{size:12,children:"Tick people, or pick a group (groups follow the team as it changes)."}),(0,k.jsx)(r.Row,{wrap:!0,gap:6,children:S.map(s=>(0,k.jsx)(r.Chip,{testID:`notif-group-${s}`,label:u.NOTIF_GROUP_LABEL[s],selected:e.groups.includes(s),onPress:()=>t({...e,groups:e.groups.includes(s)?e.groups.filter(e=>e!==s):[...e.groups,s]})},s))}),(0,k.jsx)(r.Muted,{size:12,children:"Only people on shift when it goes, in:"}),(0,k.jsx)(r.Row,{wrap:!0,gap:6,children:Object.keys(u.SHIFT_FILTER_LABEL).map(s=>{const n=(e.onShiftIn??[]).includes(s);return(0,k.jsx)(r.Chip,{testID:`notif-onshift-${s}`,label:u.SHIFT_FILTER_LABEL[s],selected:n,onPress:()=>t({...e,onShiftIn:n?(e.onShiftIn??[]).filter(e=>e!==s):[...e.onShiftIn??[],s]})},s)})}),(0,k.jsx)(a.default,{style:{gap:2},children:s.map(s=>{const n=e.staff.includes(s.id);return(0,k.jsxs)(l.default,{testID:`notif-tick-${s.id}`,accessibilityRole:"checkbox",accessibilityState:{checked:n},onPress:()=>t({...e,staff:n?e.staff.filter(e=>e!==s.id):[...e.staff,s.id]}),style:{flexDirection:'row',alignItems:'center',gap:10,paddingVertical:6},children:[(0,k.jsx)(a.default,{style:{width:22,height:22,borderRadius:5,borderWidth:1.5,borderColor:d.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:n?'#2a2414':'transparent'},children:n?(0,k.jsx)(r.T,{size:14,colour:d.colours.gold,children:"\u2713"}):null}),(0,k.jsx)(r.T,{style:{flex:1},children:(0,h.staffLabel)({name:I(s.name),nickname:s.nickname})}),(0,k.jsx)(r.Muted,{size:12,children:'Head Chef'===s.level?'Head Chef':s.job})]},s.id)})}),(0,k.jsx)(r.Muted,{size:12,children:"If nobody above matches when it goes, send it to:"}),(0,k.jsxs)(r.Row,{wrap:!0,gap:6,children:[S.filter(e=>'on_shift'!==e).map(s=>{const n=e.fallback??{staff:[],groups:[]},o=n.groups.includes(s);return(0,k.jsx)(r.Chip,{testID:`notif-fallback-${s}`,label:u.NOTIF_GROUP_LABEL[s],selected:o,onPress:()=>{const l=o?n.groups.filter(e=>e!==s):[...n.groups,s];t({...e,fallback:l.length||n.staff.length?{...n,groups:l}:void 0})}},s)}),s.map(s=>{const n=e.fallback??{staff:[],groups:[]},o=n.staff.includes(s.id);return(0,k.jsx)(r.Chip,{testID:`notif-fallback-${s.id}`,label:I(s.name),selected:o,onPress:()=>{const l=o?n.staff.filter(e=>e!==s.id):[...n.staff,s.id];t({...e,fallback:l.length||n.groups.length?{...n,staff:l}:void 0})}},s.id)})]})]})}function D({init:e,onSave:s,onCancel:o}){const[l,c]=(0,n.useState)(e),[h,p]=(0,n.useState)(!!e.dayTimes&&Object.keys(e.dayTimes).length>0),f=(0,u.validateNotif)(l),g=e=>c(t=>({...t,...e}));return(0,k.jsxs)(a.default,{testID:"notif-editor",style:{gap:8,borderWidth:1,borderColor:d.colours.accentBorder,borderRadius:12,padding:10},children:[(0,k.jsx)(r.T,{weight:"semibold",children:"Title"}),(0,k.jsx)(t.TextInput,{accessibilityLabel:"Notification title",testID:"notif-title",value:l.title,onChangeText:e=>g({title:e}),maxLength:60,style:T}),(0,k.jsx)(r.T,{weight:"semibold",children:"Message"}),(0,k.jsx)(t.TextInput,{accessibilityLabel:"Notification message",testID:"notif-message",value:l.message,onChangeText:e=>g({message:e}),maxLength:160,style:T}),(0,k.jsx)(r.T,{weight:"semibold",children:"Days"}),(0,k.jsx)(r.Row,{wrap:!0,gap:6,children:v.map(e=>(0,k.jsx)(r.Chip,{testID:`notif-day-${e}`,label:u.NOTIF_DAY_NAMES[e],selected:l.days.includes(e),onPress:()=>g({days:l.days.includes(e)?l.days.filter(t=>t!==e):[...l.days,e]})},e))}),(0,k.jsxs)(r.Row,{gap:8,children:[(0,k.jsx)(r.T,{weight:"semibold",children:"Time (UK)"}),(0,k.jsx)(t.TextInput,{accessibilityLabel:"Time",testID:"notif-time",value:l.time,onChangeText:e=>g({time:e}),placeholder:"21:00",style:{...T,width:90,borderColor:(0,u.validHm)(l.time)?d.colours.hairline:d.colours.red}})]}),(0,k.jsx)(r.Toggle,{label:"A different time on some days",value:h,onChange:e=>{p(e),e||g({dayTimes:void 0})}}),h?(0,k.jsx)(r.Row,{wrap:!0,gap:8,children:v.filter(e=>l.days.includes(e)).map(e=>(0,k.jsxs)(r.Row,{gap:4,children:[(0,k.jsx)(r.T,{size:13,children:u.NOTIF_DAY_NAMES[e]}),(0,k.jsx)(t.TextInput,{accessibilityLabel:`${u.NOTIF_DAY_NAMES[e]} time`,testID:`notif-daytime-${e}`,value:l.dayTimes?.[String(e)]??'',placeholder:l.time,onChangeText:t=>{const s={...l.dayTimes??{}};t.trim()?s[String(e)]=t.trim():delete s[String(e)],g({dayTimes:s})},style:{...T,width:74}})]},e))}):null,(0,k.jsx)(L,{value:l.recipients,onChange:e=>g({recipients:e})}),(0,k.jsx)(r.T,{weight:"semibold",children:"Send by"}),(0,k.jsx)(r.Toggle,{testID:"notif-inapp",label:"In the app (gold slider, Done / Later)",value:l.sendBy.inApp,onChange:e=>g({sendBy:{...l.sendBy,inApp:e}})}),(0,k.jsx)(r.Toggle,{testID:"notif-push",label:"Phone notification (when phones are switched on)",value:l.sendBy.push,onChange:e=>g({sendBy:{...l.sendBy,push:e}})}),f?(0,k.jsx)(r.Muted,{size:13,children:f}):null,(0,k.jsxs)(r.Row,{gap:8,style:{justifyContent:'flex-end'},children:[(0,k.jsx)(r.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:o}),(0,k.jsx)(r.Button,{small:!0,testID:"notif-save",label:"Save",disabled:!!f,onPress:()=>s({...l,title:l.title.trim(),message:l.message.trim(),days:[...l.days].sort()})})]})]})}function R(){const[e,t]=(0,n.useState)(null),[s,o]=(0,n.useState)('');return(0,n.useEffect)(()=>{(0,y.pushState)().then(t)},[]),e&&'unsupported'!==e?(0,k.jsxs)(a.default,{testID:"push-button",style:{gap:4},children:[(0,k.jsx)(r.Button,{small:!0,kind:'on'===e?'ghost':'secondary',testID:"push-turn-on",label:'on'===e?'Phone notifications are on for this phone \xb7 Turn off':'\ud83d\udd14 Turn on phone notifications',onPress:()=>{('on'===e?(0,y.turnOffPush)():(0,y.turnOnPush)()).then(e=>{o(e.message),(0,y.pushState)().then(t)})}}),(0,k.jsx)(r.Muted,{size:12,children:s||('ios-home-screen'===e?'iPhone: add this app to your Home Screen first (iOS 16.4 or later).':'For this phone only. Each person turns it on on their own phone.')})]}):null}const B=e=>p.useOrderLists.getState().resetSettings(e);const P=(e,t)=>g.useClockArea.getState().reset(e,t),O='https://www.foodstandards.gov.scot/publications-and-research/publications/cooksafe-manual'},1004,[877,989,30,239,263,127,813,821,956,958,856,1005,1206,1207,954,1274,820,1097,947,24]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"orderListSeedId",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"orderListSettingsId",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"orderListSeeds",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"useOrderLists",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"orderSettingsOf",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"useListOpen",{enumerable:!0,get:function(){return y}});var e,t=r(d[0]),s=(e=t)&&e.__esModule?e:{default:e},i=r(d[1]),n=r(d[2]),u=r(d[3]),o=r(d[4]),p=r(d[5]),l=r(d[6]);const c=(e,t)=>(0,u.uuidFrom)(`order-list:${t}:${e}`),S=e=>(0,u.uuidFrom)(`order-list-settings:${e}`),f=e=>'anchorage'===e?[{id:c(e,'allsons'),seed:'allsons',name:'Alsons (drinks)',kind:'running'},{id:c(e,'cash-carry'),seed:'cash-carry',name:'Cash and carry',kind:'trip',tripDay:5}]:[],A=()=>(new Date).toISOString(),O=(0,i.create)()((0,n.persist)((e,t)=>({lists:[],items:[],history:[],settings:{},ensure:s=>{const i=t(),n=new Set(i.lists.map(e=>e.id)),u=f(s).filter(e=>!n.has(e.id)).map(e=>({...e,rid:s})),p={},c=i.lists.map(e=>(0,l.fixSupplierNames)(e.name)!==e.name?{...e,name:(0,l.fixSupplierNames)(e.name),updatedAt:A()}:e);c.some((e,t)=>e!==i.lists[t])&&(p.lists=c),u.length&&(p.lists=[...p.lists??i.lists,...u]),i.settings[s]||(p.settings={...i.settings,[s]:{...o.DEFAULT_ORDER_LIST_SETTINGS,id:S(s)}}),Object.keys(p).length&&e(p)},addList:(t,s)=>{const i=(0,p.uuid)();return e(e=>({lists:[...e.lists,{...s,id:i,rid:t,updatedAt:A()}]})),i},updateList:(t,s)=>e(e=>({lists:e.lists.map(e=>e.id===t?{...e,...s,updatedAt:A()}:e)})),addItem:(t,s)=>{const i=(0,p.uuid)(),n=s.addedAt??A();return e(e=>({items:[...e.items,{...s,id:i,rid:t,status:'open',addedAt:n,updatedAt:n}]})),i},bump:(t,s,i)=>e(e=>({items:e.items.map(e=>e.id===t?{...(0,o.bumpQty)(e,s,i.id,i.name,A()),rid:e.rid}:e)})),updateItem:(t,s)=>e(e=>({items:e.items.map(e=>e.id===t?{...e,...s,updatedAt:A()}:e)})),setStatus:(t,s,i)=>e(e=>({items:e.items.map(e=>e.id===t?{...e,status:s,statusBy:'open'===s?void 0:i.name,statusAt:'open'===s?void 0:A(),updatedAt:A()}:e)})),removeItem:t=>e(e=>({items:e.items.map(e=>e.id===t?{...e,removed:!0,updatedAt:A()}:e)})),undoRemove:t=>e(e=>({items:e.items.map(e=>e.id===t?{...e,removed:!1,updatedAt:A()}:e)})),finish:(s,i,n,u)=>{const l=t().lists.find(e=>e.id===i);if(!l)return null;const c=A(),{round:S,drop:f,carriedOver:O}=(0,o.finishOrder)(l,t().items,n,u,c,p.uuid),_=new Set(f),y=new Map(O.map(e=>[e.id,e])),T={...S,rid:s};return e(e=>({items:e.items.filter(e=>!_.has(e.id)).map(e=>y.has(e.id)?{...y.get(e.id),rid:e.rid}:e),history:[T,...e.history].slice(0,300),lists:e.lists.map(e=>e.id===i?{...e,nextTrip:void 0,updatedAt:c}:e)})),T},setSettings:(t,s)=>e(e=>({settings:{...e.settings,[t]:{...o.DEFAULT_ORDER_LIST_SETTINGS,...e.settings[t],...s,id:S(t),updatedAt:A()}}})),resetSettings:t=>e(e=>({settings:{...e.settings,[t]:{...o.DEFAULT_ORDER_LIST_SETTINGS,id:S(t),updatedAt:A()}}}))}),{name:'covercharge-order-lists-v1',version:1,storage:(0,n.createJSONStorage)(()=>s.default)})),_=e=>({...o.DEFAULT_ORDER_LIST_SETTINGS,...O.getState().settings[e]}),y=(0,i.create)()(e=>({request:t=>e({seed:t})}))},1005,[1116,952,1117,1104,1206,1034,1205]); +__d(function(g,_r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"APP_USED_TEXT",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"APP_NOT_SET_UP_TEXT",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"allowedHere",{enumerable:!0,get:function(){return C}}),Object.defineProperty(_e,"movedMessage",{enumerable:!0,get:function(){return N}}),_e.personFromStaff=E,_e.signInWithText=z,_e.SignInWithLink=M,_e.useSignedOutGate=function(){const e=(0,m.useSession)(e=>e.meId);return _.includes(b.APP_VARIANT)&&!A.PITCH&&!e},_e.InviteGate=function(){const[e,R]=(0,f.useState)(m.useSession.persist.hasHydrated()),[E,z]=(0,f.useState)(m.START_INVITE?'checking':'done'),[V,F]=(0,f.useState)(null),[W,D]=(0,f.useState)(0),[K,U]=(0,f.useState)(!1),[G,Y]=(0,f.useState)(null),B=(0,m.useSession)(e=>e.meId),$=(0,m.useSession)(e=>!B||!!e.welcomed[B]);if((0,f.useEffect)(()=>{const e=m.useSession.persist.onFinishHydration(()=>R(!0));return m.useSession.persist.hasHydrated()&&R(!0),e},[]),(0,f.useEffect)(()=>{if(!e||!_.includes(b.APP_VARIANT))return;let n,t=!0;return(async()=>{const e=m.useSession.getState().meId;if(m.START_INVITE&&!(e&&await(0,I.signedInHereAs)(e)&&await(0,I.rememberedInviteHere)(m.START_INVITE))){const e=await H(m.START_INVITE,e=>{t&&F(e)});if(!t)return;if('refused'===e.kind)return F(e.message),void z('done');if('offline'===e.kind)return U(!0),void(n=setTimeout(()=>{t&&D(e=>e+1)},1e4));if(U(!1),'bad'===e.kind)return void z('bad')}const s=O(m.useSession.getState().meId),o=s&&!1!==P.useOwner.getState().staff.find(e=>e.id===s.id)?.active;if(s&&!o)m.useSession.getState().signOut();else if(s&&!C(s)&&!m.START_INVITE&&await(0,I.signedInHereAs)(s.id)){if(await(0,I.forgetSignInHere)(),!t)return;m.useSession.getState().signOut(),Y(N(s.app))}else if(s&&!C(s)){const e=(0,m.appUrl)(s.app,m.START_INVITE);if(e)return void window.location.replace(e)}z('done')})(),()=>{t=!1,n&&clearTimeout(n)}},[e,W]),!_.includes(b.APP_VARIANT))return null;if(n.IS_QUEUED_VENUE&&!B)return(0,x.jsx)(h.default,{style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(t.QueuedVenueWelcome,{app:m.APP_NAME[b.APP_VARIANT]??'Team',message:V?'This link cannot be used here. Ask your authorised manager.':K?'Waiting for a connection.':void 0})});if(n.IS_GREENSIDE&&!B)return(0,x.jsx)(h.default,{style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(s.GreensideStaffHome,{app:m.APP_NAME[b.APP_VARIANT]??'Team',message:V?`This link can\u2019t be used here. ${V}`:K?'Waiting for a connection.':e&&'checking'!==E?'bad'===E?'This link is not recognised. Ask the authorised manager for access after setup.':void 0:'Opening your Greenside app\u2026'})});if(n.IS_ABBOTSFORD&&!B)return(0,x.jsx)(h.default,{style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(l.AbbotsfordStaffHome,{app:m.APP_NAME[b.APP_VARIANT]??'Team',message:V?'This link cannot be used here. Ask your authorised manager.':K?'Waiting for a connection.':void 0})});if(n.IS_KIRKTON&&!B)return(0,x.jsx)(h.default,{style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(u.KirktonStaffHome,{app:m.APP_NAME[b.APP_VARIANT]??'Team',message:V?`This link can\u2019t be used here. ${V}`:K?'Waiting for a connection.':e&&'checking'!==E?'bad'===E?'This link is not recognised. Ask the authorised manager for access after setup.':void 0:'Opening your Kirkton app\u2026'})});if(n.IS_WILDINGS&&!B)return(0,x.jsx)(h.default,{style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(o.WildingsStaffHome,{app:m.APP_NAME[b.APP_VARIANT]??'Team',message:V?`This link can\u2019t be used here. ${V}`:K?'Waiting for a connection. Your personal app signs you in automatically when it returns.':e&&'checking'!==E?'bad'===E?'This link is not recognised. Open the complete private link your manager gave you.':void 0:'Opening your personal Wildings app\u2026'})});if(n.IS_KIRKMICHAEL&&!B)return(0,x.jsx)(h.default,{style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(r.KirkmichaelStaffHome,{app:m.APP_NAME[b.APP_VARIANT]??'Team',message:V?`This link can\u2019t be used here. ${V}`:K?'Waiting for a connection. Your personal app signs you in automatically when it returns.':e&&'checking'!==E?'bad'===E?'This link is not recognised. Open the complete private link your manager gave you.':void 0:'Opening your personal Kirkmichael app\u2026'})});if(n.IS_SOUTERS&&!B)return(0,x.jsx)(h.default,{style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(c.SoutersStaffHome,{app:m.APP_NAME[b.APP_VARIANT]??'Team'})});if(K)return w('Waiting for a connection. Your app will sign you in automatically.','invite-waiting');if(!e||'checking'===E)return(0,x.jsx)(h.default,{style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}]});if((0,S.inPhoneApp)()&&!B&&!A.PITCH)return V&&/already been used/i.test(V)?w(j,'invite-app-used'):V?w(V,'invite-app-refused'):w(v,'invite-app-notsetup');if('bad'===E)return(0,x.jsxs)(h.default,{testID:"invite-bad",style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,x.jsx)(T.T,{size:22,weight:"bold",center:!0,children:"This link isn\u2019t recognised"}),(0,x.jsx)(T.Muted,{center:!0,children:"Part of the link may be missing. Go back to the message from your manager and tap the whole link, rather than copying part of it. If it still doesn't work, ask your manager for your personal CoverCharge link."}),(0,x.jsx)(T.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>z('done')}),(0,x.jsx)(T.Muted,{center:!0,children:"Offline, CoverCharge uses made-up data, and nothing you do there is shared with the team."})]});if(V&&!B)return(0,x.jsxs)(h.default,{testID:"invite-refused",style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,x.jsx)(T.T,{size:22,weight:"bold",center:!0,children:"This link can\u2019t be used here"}),(0,x.jsx)(T.Muted,{center:!0,children:V}),(0,x.jsx)(T.Muted,{center:!0,children:"Each personal link works on one phone only and lasts 30 days before first use, so nobody else can sign in as you."}),(0,x.jsx)(T.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>F(null)})]});if(G&&!B)return(0,x.jsxs)(h.default,{testID:"invite-moved",style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,x.jsx)(T.T,{size:22,weight:"bold",center:!0,children:"This app is signed out"}),(0,x.jsx)(T.Muted,{center:!0,children:G}),(0,x.jsx)(M,{})]});if(!B&&!A.PITCH)return(0,x.jsxs)(h.default,{testID:"invite-signin",style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,x.jsx)(T.T,{size:22,weight:"bold",center:!0,children:V?'This link can\u2019t be used here':'Sign in to CoverCharge'}),V?(0,x.jsx)(T.Muted,{center:!0,children:V}):null,(0,x.jsx)(T.Muted,{center:!0,children:"Open the personal link your manager sent you on this phone. Each link signs in one person on one phone and lasts 30 days before first use. If it has already been used on another phone or browser, ask your manager for a new one."}),(0,x.jsx)(M,{})]});const L=(0,m.rosterPerson)(B);return L&&!$&&C(L)?(0,x.jsx)(y.LaunchWelcome,{p:L,onDone:()=>m.useSession.getState().markWelcomed(L.id)}):null};var n=_r(d[0]),t=_r(d[1]),s=_r(d[2]),o=_r(d[3]),r=_r(d[4]),l=_r(d[5]),u=_r(d[6]),c=_r(d[7]),f=_r(d[8]);_r(d[9]);var p=e(_r(d[10])),h=e(_r(d[11])),b=_r(d[12]),m=_r(d[13]),k=_r(d[14]),y=_r(d[15]),T=_r(d[16]),I=_r(d[17]),A=_r(d[18]),S=_r(d[19]),P=_r(d[20]),x=_r(d[21]);const j='This app copy has already been set up on another phone. Ask your manager for a new link.',v='This app copy isn\u2019t set up for anyone yet. Ask your manager for your link, and download the app from it.',w=(e,n)=>(0,x.jsx)(h.default,{testID:n,style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:(0,x.jsx)(T.T,{size:22,weight:"bold",center:!0,children:e})}),_=['owner','staff','chef'],C=e=>'staff'===b.APP_VARIANT||e.app===b.APP_VARIANT,N=e=>`You now use ${m.APP_NAME[e]??'another CoverCharge app'}. This app is signed out on this phone. Open the new personal link your manager sent you.`;function R(e){m.useSession.getState().signIn(e.id);const n=P.useOwner.getState();P.useOwner.setState({staffAs:e.id,previewRole:'staff'===e.role?n.previewRole:e.role})}function E(e){const n='owner'===e.role?'Owner':'manager'===e.role?'Manager':'Head Chef'===e.level?'Head Chef':'Staff';return{id:e.id,name:e.name,level:n,role:e.role,job:e.job,nickname:e.nickname,dept:e.dept??'',app:'staff'===e.role?'Head Chef'===n?'chef':'staff':'owner',tokenHash:'',hourlyPence:null,salaried:!!e.salaried,noTax:!!e.noTax,avatar:void 0}}const O=e=>{const n=(0,m.rosterPerson)(e);if(n)return n;const t=e?P.useOwner.getState().staff.find(n=>n.id===e):void 0;return t?E(t):void 0};async function H(e,n){const t=await(0,m.personForInvite)(e);if(t)return R(t),C(t)?((0,I.claimInvite)(e).then(e=>{if('refused'===e.status&&m.useSession.getState().meId===t.id&&(m.useSession.getState().signOut(),n(e.message)),'ok'===e.status&&e.id.staffRef&&e.id.staffRef!==m.useSession.getState().meId){const n=O(e.id.staffRef);n&&R(n)}}),{kind:'ok',p:t}):{kind:'ok',p:t};const s=await(0,I.claimInvite)(e);if('refused'===s.status)return{kind:'refused',message:s.message};if('offline'===s.status)return{kind:'offline'};if('ok'!==s.status||!s.id.staffRef)return{kind:'bad'};const o=O(s.id.staffRef)??E({id:s.id.staffRef,name:s.id.displayName||s.id.staffRef,role:'owner'===s.id.role?'owner':'manager'===s.id.role?'manager':'staff',level:'head_chef'===s.id.role?'Head Chef':void 0,job:'',active:!0});return R(o),{kind:'ok',p:o}}async function z(e,n=()=>{}){const t=(0,m.inviteFromText)(e);if(!t)return'bad';const s=await H(t,n);if('refused'===s.kind)return{refused:s.message};if('bad'===s.kind||'offline'===s.kind)return'bad';const o=s.p;if(!C(o)){const e=(0,m.appUrl)(o.app,t);if(e)return window.location.replace(e),'moved'}return'ok'}function M(){const[e,n]=(0,f.useState)(''),[t,s]=(0,f.useState)('');return(0,x.jsxs)(h.default,{style:{gap:6},children:[(0,x.jsx)(T.Field,{label:"Your personal link (paste it here)",value:e,onChangeText:n,placeholder:"Your complete Android or iPhone link",autoCapitalize:"none",autoCorrect:!1}),(0,x.jsx)(T.Button,{label:"Sign in",disabled:!e.trim(),onPress:async()=>{const t=await z(e,s);s('bad'===t?'That link was not recognised. Check you copied all of it, or ask your manager for a new one.':'object'==typeof t?t.refused:''),'ok'===t&&n('')}}),t?(0,x.jsx)(T.T,{size:13,colour:k.colours.red,children:t}):null]})}},1006,[5,1396,1397,1398,1399,1400,1401,854,30,122,46,127,806,859,821,1402,813,820,2,1290,856,24]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Icon=function({name:l,size:x=22,colour:t}){const n={stroke:t,strokeWidth:2,fill:'none',strokeLinecap:'round',strokeLinejoin:'round'};return(0,e.jsxs)(h.default,{width:x,height:x,viewBox:"0 0 24 24",children:['home'===l?(0,e.jsx)(s.Path,{d:"M3 11l9-7 9 7v9a1 1 0 0 1-1 1h-5v-6H9v6H4a1 1 0 0 1-1-1z",...n}):null,'orders'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"5",y:"3",width:"14",height:"18",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M9 8h6M9 12h6M9 16h4",...n})]}):null,'bookings'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4",...n})]}):null,'forecast'===l?(0,e.jsx)(s.Path,{d:"M4 20V10M10 20V4M16 20v-7M22 20H2",...n}):null,'more'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"5",cy:"12",r:"1.6",fill:t}),(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"1.6",fill:t}),(0,e.jsx)(s.Circle,{cx:"19",cy:"12",r:"1.6",fill:t})]}):null,'search'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"11",r:"7",...n}),(0,e.jsx)(s.Path,{d:"M20 20l-4-4",...n})]}):null,'bell'===l?(0,e.jsx)(s.Path,{d:"M6 16V11a6 6 0 0 1 12 0v5l2 2H4zM10 20a2 2 0 0 0 4 0",...n}):null,'chat'===l?(0,e.jsx)(s.Path,{d:"M4 5h16v11H9l-5 4z",...n}):null,'clock'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M12 7v5l3 2",...n})]}):null,'user'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"8",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M4 21a8 8 0 0 1 16 0",...n})]}):null,'walkin'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"13",cy:"4.5",r:"1.8",...n}),(0,e.jsx)(s.Path,{d:"M10 21l2-6 3 3v3M9 12l2-4 4 1 2 3M11 8l-1 5",...n})]}):null,'calendarPlus'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4M12 13v5M9.5 15.5h5",...n})]}):null,'pause'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M10 9v6M14 9v6",...n})]}):null,'rain'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M7 15a4 4 0 0 1-.6-7.95A5.5 5.5 0 0 1 17 7.5a3.75 3.75 0 0 1 .5 7.5z",...n}),(0,e.jsx)(s.Path,{d:"M9 18l-1 2.5M13 18l-1 2.5M17 18l-1 2.5",...n})]}):null,'sun'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M12 2v2M12 20v2M2 12h2M20 12h2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4",...n})]}):null,'payroll'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"4",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M7 9h6M7 13h4M15 12.5a2 2 0 1 0 0 .01M7 17h10",...n})]}):null,'tips'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M14.5 9a2.5 2.5 0 0 0-5 0c0 2.5 0 4-1.5 6h7M9 12.5h4",...n})]}):null,'sparkle'===l?(0,e.jsx)(s.Path,{d:"M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8zM19 16l.7 1.8 1.8.7-1.8.7L19 21l-.7-1.8-1.8-.7 1.8-.7z",...n}):null,'platter'===l?(0,e.jsx)(e.Fragment,{children:(0,e.jsx)(s.Path,{d:"M3 15h18M5 15a7 7 0 0 1 14 0M12 6v2M2 18h20",...n})}):null,'check'===l?(0,e.jsx)(s.Path,{d:"M5 12.5l4.5 4.5L19 7.5",...n}):null,'alert'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M12 3l9.5 17h-19z",...n}),(0,e.jsx)(s.Path,{d:"M12 10v4M12 17.2v.1",...n})]}):null,'access'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"4.5",r:"1.8",...n}),(0,e.jsx)(s.Path,{d:"M11 7.5v6h5l2.5 5M11 10h5M8 11.5a5.5 5.5 0 1 0 7.5 6.5",...n})]}):null,'dog'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 10l1-5 3 3h4l3-3 1 5v4a5 5 0 0 1-5 5h-2a5 5 0 0 1-5-5z",...n}),(0,e.jsx)(s.Path,{d:"M10 13v.1M14 13v.1M11 16h2",...n})]}):null,'leaf'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 19c0-8 5-14 15-14 0 10-6 15-14 15",...n}),(0,e.jsx)(s.Path,{d:"M5 19l8-8",...n})]}):null,'table'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"4",y:"8",width:"16",height:"8",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M8 16v4M16 16v4M8 4v4M16 4v4",...n})]}):null,'bag'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 8h14l-1 12H6z",...n}),(0,e.jsx)(s.Path,{d:"M9 10V7a3 3 0 0 1 6 0v3",...n})]}):null,'phone'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"7",y:"2.5",width:"10",height:"19",rx:"2.5",...n}),(0,e.jsx)(s.Path,{d:"M11 18.5h2",...n})]}):null,'swap'===l?(0,e.jsx)(s.Path,{d:"M7 4L3 8l4 4M3 8h14M17 20l4-4-4-4M21 16H7",...n}):null,'box'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M3.5 8L12 4l8.5 4v8L12 20l-8.5-4z",...n}),(0,e.jsx)(s.Path,{d:"M3.5 8L12 12l8.5-4M12 12v8",...n})]}):null,'star'===l?(0,e.jsx)(s.Path,{d:"M12 3.5l2.6 5.4 5.9.8-4.3 4.1 1 5.8L12 16.8l-5.2 2.8 1-5.8L3.5 9.7l5.9-.8z",...n}):null,'userPlus'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"10",cy:"8",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M3 21a7 7 0 0 1 14 0M19 8v6M16 11h6",...n})]}):null,'gift'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3.5",y:"8.5",width:"17",height:"4",rx:"1",...n}),(0,e.jsx)(s.Path,{d:"M5 12.5V20h14v-7.5M12 8.5V20M12 8.5C10 8.5 7.5 7.8 7.5 5.8S10.5 4 12 8.5c1.5-4.5 4.5-4.7 4.5-2.7S14 8.5 12 8.5z",...n})]}):null,'tag'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M3.5 12.5V4h8.5l8.5 8.5-8.5 8.5z",...n}),(0,e.jsx)(s.Circle,{cx:"8",cy:"8.5",r:"1.4",...n})]}):null,'hanger'===l?(0,e.jsx)(s.Path,{d:"M12 7.5a2 2 0 1 1 2-2M12 7.5v2L3 16.5h18L12 9.5",...n}):null]})},r(d[0]);var l,s=r(d[1]),h=(l=s)&&l.__esModule?l:{default:l},e=r(d[2])},1007,[30,948,24]); +__d(function(g,_r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.usePay=j,_e.periodPay=T,_e.MyHoursPay=C,_e.Payroll=function(){const{role:e}=(0,y.useCtx)(6e4),r='owner'===e,c=!!(0,y.useSignedIn)(),p=c&&('owner'===e||'manager'===e),j=(0,a.useOwner)(e=>e.staff),k=(0,i.useMemo)(()=>j.filter(e=>e.active),[j]),D=(0,y.useHourly)(),R=(0,a.useOwner)(e=>e.attendance),z=(0,a.useOwner)(e=>e.troncHistory),{now:M,rid:N}=(0,y.useCtx)(6e4),v=(0,b.useVenuePay)(N).pay,[B,O]=(0,i.useState)(-1),[L,$]=(0,i.useState)(null),[S,H]=(0,i.useState)(''),[I,W]=(0,i.useState)(null),E=(0,i.useMemo)(()=>k.map(e=>({...T(e.id,B,M,R,D[e.id]??0,v,z),person:e})),[k,B,R,D,v,z]),_=E.reduce((e,s)=>({paid:e.paid+s.paid,gross:e.gross+s.gross,tips:e.tips+s.tips,total:e.total+s.total}),{paid:0,gross:0,tips:0,total:0}),V=E[0]?.label??'',F=k.find(e=>e.id===L),G=Math.round(100*Number(S));return(0,f.jsxs)(n.default,{style:{gap:10},children:[(0,f.jsx)(l.Muted,{children:"Periods follow your venue's pay dates (Settings \u203a Pay & tips). For hours to copy into a spreadsheet, use Payroll hours."}),(0,f.jsxs)(l.Muted,{children:["Pay period (venue setting",r?'':', owner only',"). Used for staff pay, the tip splitter and payroll."]}),(0,f.jsx)(P,{label:V,offset:B,setOffset:O,badge:0===B?'Current period':void 0}),(0,f.jsx)(t.WideTable,{children:(0,f.jsxs)(n.default,{children:[(0,f.jsx)(t.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:h.colours.border,paddingBottom:4},children:['Staff','Rate/h','Paid hrs','Gross','Tips','Total'].map((e,s)=>(0,f.jsx)(l.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{width:[120,96,64,72,64,76][s]},children:e},e))}),E.map(e=>(0,f.jsxs)(t.TRow,{heads:['Staff','Rate/h','Paid hrs','Gross','Tips','Total'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,f.jsxs)(o.default,{accessibilityRole:"button",accessibilityLabel:`Pay for ${e.person.name}`,onPress:()=>W(e.person.id),style:{width:120,minHeight:44,justifyContent:'center'},children:[(0,f.jsx)(l.T,{size:13,colour:h.colours.gold,numberOfLines:1,children:x(e.person.name)}),c&&e.person.noTax?(0,f.jsx)(l.T,{size:10,colour:h.colours.amber,children:"No tax deducted"}):null]}),(0,f.jsx)(o.default,{accessibilityRole:"button",accessibilityLabel:`Edit rate for ${e.person.name}`,disabled:!p,onPress:()=>{$(e.person.id),H(null==D[e.person.id]?'':(D[e.person.id]/100).toFixed(2))},style:{width:96,minHeight:44,justifyContent:'center'},children:(0,f.jsxs)(l.T,{size:13,colour:null==D[e.person.id]?h.colours.muted:'owner'!==e.person.role&&D[e.person.id]$(null),title:`Hourly rate: ${x(F?.name)}`,children:[(0,f.jsx)(l.Muted,{children:F?`${F.level??a.ROLE_LABEL[F.role]} \xb7 ${F.job}${F.noTax?' \xb7 No tax deducted':''} \xb7 now: ${(0,a.wageLabel)(F,D[F.id],u.gbp)}`:''}),(0,f.jsx)(s.TextInput,{accessibilityLabel:"Hourly rate \xa3",keyboardType:"decimal-pad",value:S,onChangeText:H,style:l.styles.input}),Number.isFinite(G)&&G>0&&G{a.useOwner.getState().setRate(L,G),$(null)}}),L&&null!=D[L]?(0,f.jsx)(l.Button,{kind:"secondary",label:"Clear (Not set)",onPress:()=>{a.useOwner.getState().clearRate(L),$(null)}}):null]}),(0,f.jsx)(l.Sheet,{visible:!!I,onClose:()=>W(null),title:`What ${x(k.find(e=>e.id===I)?.name)} sees`,children:I?(0,f.jsx)(C,{staffId:I}):null})]})};var s=_r(d[0]),t=_r(d[1]),i=_r(d[2]),o=e(_r(d[3])),n=e(_r(d[4])),r=e(_r(d[5])),l=_r(d[6]),a=_r(d[7]),u=_r(d[8]),c=_r(d[9]),h=_r(d[10]),p=_r(d[11]),y=_r(d[12]),b=_r(d[13]),f=_r(d[14]);const x=e=>(e??'').replace(' (example)',''),w='Before tax and deductions, estimate';function j(e,s){const{now:t,rid:o}=(0,y.useCtx)(6e4),n=(0,a.useOwner)(e=>e.attendance),r=(0,y.useHourly)()[e]??0,l=(0,b.useVenuePay)(o).pay,u=(0,a.useOwner)(e=>e.troncHistory);return(0,i.useMemo)(()=>T(e,s,t,n,r,l,u),[e,s,n,r,l,u,Math.floor(t.getTime()/6e4)])}function T(e,s,t,i,o,n,r){const{s:l,e:u,key:h}=(0,b.venueRange)(n,'wage',s,t),p=(0,c.ymd)(l),f=(0,c.ymd)(u),x=i.filter(s=>s.staffId===e&&s.date>=p&&s.date<=f&&s.in).sort((e,s)=>e.date.localeCompare(s.date)).map(e=>{const s=(0,y.paidMins)(e,t);return{a:e,...s,gross:Math.round(s.paid/60*o),open:!e.out,confirmed:(0,a.isConfirmed)(e)}}),w=x.filter(e=>e.confirmed),j=w.reduce((e,s)=>e+s.paid,0),T=w.reduce((e,s)=>e+s.gross,0),P=x.filter(e=>!e.open&&!e.confirmed).reduce((e,s)=>e+s.paid,0),C=r.filter(e=>e.end>=p&&e.end<=f).map(s=>({label:s.label,amount:s.rows.find(s=>s.staffId===e)?.amount??0})).filter(e=>e.amount>0),k=C.reduce((e,s)=>e+s.amount,0);return{s:l,e:u,key:h,label:`${(0,c.niceDate)(l)} \u2013 ${(0,c.niceDate)(u)} ${u.getFullYear()}`,shifts:x,paid:j,pending:P,gross:T,tips:k,tipItems:C,total:T+k,rate:o}}function P({label:e,offset:s,setOffset:t,badge:i}){return(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",disabled:s<=-12,onPress:()=>t(s-1)}),(0,f.jsxs)(n.default,{style:{alignItems:'center',flex:1},children:[(0,f.jsx)(l.T,{weight:"semibold",children:e}),i?(0,f.jsx)(l.Badge,{kind:0===s?'amber':'neutral',label:i}):null]}),(0,f.jsx)(l.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:s>=0,onPress:()=>t(s+1)})]})}function C({staffId:e}){const{meId:s,now:C,rid:k}=(0,y.useCtx)(6e4),D=e??s,R=(0,b.useVenuePay)(k).pay,z=(0,a.useOwner)(e=>e.staff).find(e=>e.id===D),M=(0,a.useOwner)(e=>e.attendance),N=(0,a.useOwner)(e=>e.troncHistory),v=(0,y.useHourly)(),B=v[D]??0,O=null!=v[D],[L,$]=(0,i.useState)(0),S=j(D,L),H=(0,r.default)().width<520,I=(0,i.useMemo)(()=>[-1,-2,-3,-4,-5,-6].map(e=>({o:e,...T(D,e,C,M,B,R,N)})),[D,M,B,R,N]);return(0,f.jsxs)(n.default,{style:{gap:10},children:[(0,f.jsx)(l.Banner,{kind:"info",title:w,children:"Gross pay from your clocked hours at your hourly rate, plus tips shared to you. Tax, National Insurance and pension come off in payroll."}),(0,f.jsxs)(l.Muted,{children:[x(z?.name)," \xb7 ",z?.job," \xb7 ",O?`${(0,u.gbp)(B)}/hour`:'Hourly rate not set yet'," \xb7 Paid on the ",R.wagePayDay,[1,21,31].includes(R.wagePayDay)?'st':[2,22].includes(R.wagePayDay)?'nd':[3,23].includes(R.wagePayDay)?'rd':'th',", cut-off the ",R.wageCutoffDay,[1,21].includes(R.wageCutoffDay)?'st':[2,22].includes(R.wageCutoffDay)?'nd':[3,23].includes(R.wageCutoffDay)?'rd':'th',e?'':' (set by your manager)']}),(0,f.jsx)(P,{label:S.label,offset:L,setOffset:$,badge:0===L?'Current period':void 0}),(0,f.jsxs)(l.Card,{children:[(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{children:"Confirmed paid hours"}),(0,f.jsx)(l.T,{weight:"semibold",children:(0,y.hmDur)(S.paid)})]}),S.pending?(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{colour:h.colours.amber,children:"Pending sign-off"}),(0,f.jsx)(l.T,{colour:h.colours.amber,children:(0,y.hmDur)(S.pending)})]}):null,(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{children:"Gross pay from hours"}),(0,f.jsx)(l.T,{weight:"semibold",children:(0,u.gbp)(S.gross)})]}),(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{children:"Tips allocated"}),(0,f.jsx)(l.T,{weight:"semibold",children:(0,u.gbp)(S.tips)})]}),S.tipItems.map(e=>(0,f.jsxs)(l.Muted,{children:[" Tips for ",e.label,": ",(0,u.gbp)(e.amount)]},e.label)),(0,f.jsx)(n.default,{style:{height:1,backgroundColor:h.colours.border}}),(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{weight:"bold",children:"Total gross"}),(0,f.jsx)(l.T,{size:20,weight:"bold",colour:h.colours.gold,children:(0,u.gbp)(S.total)})]}),(0,f.jsxs)(l.Muted,{children:[w,". Tips are shown separately and only once a tip period is approved."]})]}),(0,f.jsx)(p.SectionHead,{title:"Shifts",sub:"Paid hours = clock out \u2212 clock in \u2212 break"}),H?(0,f.jsxs)(n.default,{testID:"pay-shifts-list",children:[S.shifts.map(e=>(0,f.jsxs)(n.default,{style:{paddingVertical:8,borderBottomWidth:1,borderColor:'#222',gap:2},children:[(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{size:14,weight:"semibold",children:(0,c.niceDate)(new Date(e.a.date+'T12:00:00'))}),(0,f.jsx)(l.T,{size:14,weight:"semibold",colour:e.open||e.confirmed?void 0:h.colours.amber,children:e.open?'On now':e.confirmed?(0,u.gbp)(e.gross):'Pending'})]}),(0,f.jsxs)(l.Muted,{children:[(0,c.hm)(new Date(e.a.in)),"\u2013",e.a.out?(0,c.hm)(new Date(e.a.out)):'now',e.open?'':` \xb7 ${e.brk}m break \xb7 ${(0,y.hmDur)(e.paid)} paid`]})]},e.a.id)),S.shifts.length?null:(0,f.jsx)(l.Muted,{style:{paddingVertical:8},children:"No clocked shifts in this period."}),S.shifts.length?(0,f.jsxs)(l.Muted,{children:["At ",(0,u.gbp)(S.rate),"/hour."]}):null]}):(0,f.jsx)(t.WideTable,{children:(0,f.jsxs)(n.default,{children:[(0,f.jsx)(t.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:h.colours.border,paddingBottom:4},children:['Date','In','Out','Break','Paid','Rate','Gross'].map((e,s)=>(0,f.jsx)(l.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{width:[86,50,50,50,62,56,64][s]},children:e},e))}),S.shifts.map(e=>(0,f.jsxs)(t.TRow,{heads:['Date','In','Out','Break','Paid','Rate','Gross'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,f.jsx)(l.T,{size:13,style:{width:86},children:(0,c.niceDate)(new Date(e.a.date+'T12:00:00'))}),(0,f.jsx)(l.T,{size:13,style:{width:50},children:(0,c.hm)(new Date(e.a.in))}),(0,f.jsx)(l.T,{size:13,style:{width:50},children:e.a.out?(0,c.hm)(new Date(e.a.out)):'on now'}),(0,f.jsx)(l.T,{size:13,style:{width:50},children:e.open?'\u2013':`${e.brk}m`}),(0,f.jsx)(l.T,{size:13,style:{width:62},children:e.open?'\u2013':(0,y.hmDur)(e.paid)}),(0,f.jsx)(l.T,{size:13,style:{width:56},children:(0,u.gbp)(S.rate)}),(0,f.jsx)(l.T,{size:13,weight:"semibold",style:{width:64},colour:e.open||e.confirmed?void 0:h.colours.amber,children:e.open?'\u2013':e.confirmed?(0,u.gbp)(e.gross):'Pending'})]},e.a.id)),S.shifts.length?null:(0,f.jsx)(l.Muted,{style:{paddingVertical:8},children:"No clocked shifts in this period."})]})}),S.shifts.some(e=>e.open)?(0,f.jsx)(l.Muted,{children:"The shift you\u2019re on now is added once you clock out."}):null,S.pending?(0,f.jsx)(l.Muted,{children:"Hours marked Pending count once a manager signs them off."}):null,(0,f.jsx)(p.SectionHead,{title:"History"}),I.map(e=>(0,f.jsx)(o.default,{accessibilityRole:"button",accessibilityLabel:`Pay period ${e.label}`,onPress:()=>$(e.o),children:(0,f.jsxs)(l.Card,{children:[(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{weight:"semibold",children:e.label}),(0,f.jsx)(l.T,{weight:"bold",children:(0,u.gbp)(e.total)})]}),(0,f.jsxs)(l.Muted,{children:[(0,y.hmDur)(e.paid)," paid \xb7 ",(0,u.gbp)(e.gross)," from hours",e.tips?` + ${(0,u.gbp)(e.tips)} tips`:''," \xb7 ",w.toLowerCase()]})]})},e.o))]})}},1008,[877,1338,30,263,127,287,813,856,816,818,821,1019,927,1111,24]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"payFor",{enumerable:!0,get:function(){return b.payFor}}),Object.defineProperty(_e,"useVenuePay",{enumerable:!0,get:function(){return b.useVenuePay}}),_e.PayTipsSettings=function({go:e}){const{rid:s,today:t}=(0,x.useCtx)(6e4),{pay:n,source:r}=(0,b.useVenuePay)(s),[l,c]=(0,o.useState)(n),[p,y]=(0,o.useState)((0,u.ukDate)(n.tipsAnchorPayday)),[C,S]=(0,o.useState)(null),D=(0,u.parseUk)(p),M=(0,u.cleanPay)({...l,tipsAnchorPayday:D??l.tipsAnchorPayday}),B=JSON.stringify(M)!==JSON.stringify(n)||'settings'!==r,R=(0,u.nextToPay)(M,'tips',t).period,z=(0,u.nextToPay)(M,'wage',t).period,v=(0,u.tipsPeriod)(M,R.start,1),$=(0,u.wagePeriod)(M,z.start,1),O=e=>{c({...l,...e}),S(null)};return(0,j.jsxs)(d.default,{style:{gap:12},testID:"pay-settings",children:['none'===r?(0,j.jsx)(i.Banner,{kind:"warn",title:"Pay dates not set up yet",children:"Set your tips and wage dates here. Until then the app uses calendar months and weekly tips."}):null,'questionnaire'===r?(0,j.jsx)(i.Banner,{kind:"info",title:"From your sign-up answers",children:"These dates came from your questionnaire. Check them and tap Save to make them your venue's pay dates."}):null,(0,j.jsx)(f.SectionHead,{title:"Tips (tronc)",sub:"How often tips are paid out, and which days each payout covers."}),(0,j.jsxs)(i.Card,{children:[(0,j.jsx)(i.T,{weight:"semibold",children:"How often"}),(0,j.jsx)(i.Row,{wrap:!0,gap:6,children:['weekly','fortnightly','monthly'].map(e=>(0,j.jsx)(i.Chip,{label:w[e],selected:l.tipsFrequency===e,onPress:()=>O({tipsFrequency:e})},e))}),(0,j.jsx)(i.Field,{label:"A tips payday (DD/MM/YYYY). Every other one is worked out from it",value:p,onChangeText:e=>{y(e),S(null)},placeholder:"02/11/2026",keyboardType:"numbers-and-punctuation"}),D?(0,j.jsxs)(i.Muted,{children:[(0,u.dayMonth)(D)," ",D.slice(0,4)]}):(0,j.jsx)(i.T,{size:13,colour:h.colours.red,children:"Enter a date like 02/11/2026"}),(0,j.jsx)(i.T,{weight:"semibold",children:"Each tips period ends"}),(0,j.jsxs)(i.Row,{children:[(0,j.jsx)(i.Stepper,{label:"days before payday",value:l.tipsEndsDaysBefore,min:0,max:13,onChange:e=>O({tipsEndsDaysBefore:e})}),(0,j.jsx)(i.Muted,{style:{flex:1},children:0===l.tipsEndsDaysBefore?'on payday':1===l.tipsEndsDaysBefore?'day before payday (a Monday payday covers up to the Sunday)':'days before payday'})]})]}),(0,j.jsx)(f.SectionHead,{title:"Wages",sub:"Monthly pay: the cut-off starts each pay period."}),(0,j.jsxs)(i.Card,{children:[(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(i.T,{weight:"semibold",style:{flex:1},children:"Pay day of the month"}),(0,j.jsx)(i.Stepper,{label:"pay day",value:l.wagePayDay,min:1,max:31,onChange:e=>O({wagePayDay:e})})]}),(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(i.T,{weight:"semibold",style:{flex:1},children:"Cut-off (first day of each period)"}),(0,j.jsx)(i.Stepper,{label:"cut-off day",value:l.wageCutoffDay,min:1,max:28,onChange:e=>O({wageCutoffDay:e})})]}),(0,j.jsxs)(i.Muted,{children:["Period runs the ",P(l.wageCutoffDay)," to the ",P(1===l.wageCutoffDay?31:l.wageCutoffDay-1),1===l.wageCutoffDay?' (end of the month)':' of the next month',". A pay day past the month end uses the last day."]}),(0,j.jsx)(i.T,{weight:"semibold",children:"A pay day on a weekend"}),(0,j.jsx)(i.Row,{wrap:!0,gap:6,children:['none','before','after'].map(e=>(0,j.jsx)(i.Chip,{label:T[e],selected:(l.weekendRule??'none')===e,onPress:()=>O({weekendRule:e})},e))})]}),(0,j.jsx)(f.SectionHead,{title:"Preview"}),(0,j.jsxs)(i.Card,{highlight:h.colours.gold,children:[(0,j.jsx)(k,{label:"Next tips payday",day:R.payday,period:R}),(0,j.jsx)(k,{label:"Then",day:v.payday,period:v}),(0,j.jsx)(d.default,{style:{height:1,backgroundColor:h.colours.border}}),(0,j.jsx)(k,{label:"Next payday",day:z.payday,period:z}),(0,j.jsx)(k,{label:"Then",day:$.payday,period:$})]}),(0,j.jsx)(i.Button,{kind:"success",label:'settings'===r?'Save pay dates':'Save as our pay dates',disabled:!D||!B,testID:"save-pay",onPress:()=>{a.useStore.getState().updateSettings(s,{pay:M}),S('Saved. Everyone in the venue sees these dates.')}}),C?(0,j.jsx)(i.Banner,{kind:"success",title:C}):null,(0,j.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Payroll hours",onPress:()=>e('more','hours')}),(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Tips day",onPress:()=>e('more','tipsday')})]})]})},_e.hoursIn=S,Object.defineProperty(_e,"toTsv",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"toCsv",{enumerable:!0,get:function(){return $}}),_e.summaryTable=O,_e.detailTable=H,_e.copyText=I,_e.periodOptions=W,_e.PayrollHours=function({go:e}){const{rid:s,today:n,now:a,r:y}=(0,x.useCtx)(6e4),{pay:f,source:w}=(0,b.useVenuePay)(s),T=(0,l.useOwner)(e=>e.staff),P=(0,l.useOwner)(e=>e.attendance),k=(0,x.useHourly)(),C=(0,o.useMemo)(()=>W(f,n),[f,n]),[B,R]=(0,o.useState)('wage'),[z,F]=(0,o.useState)(null),[V,A]=(0,o.useState)(!1),[E,Y]=(0,o.useState)({}),[G,U]=(0,o.useState)(null),_='custom'===B&&z?z:(C.find(e=>e.id===B)??C[0]).period,q=(0,o.useMemo)(()=>S(_,T,P,a,k),[_.key,T,P,k,Math.floor(a.getTime()/6e4)]),J=q.some(e=>null!=e.rate),K='tips'===_.kind,Q=q.reduce((e,s)=>({c:e.c+s.confirmed,p:e.p+s.pending,s:e.s+s.shifts,g:e.g+(s.gross??0)}),{c:0,p:0,s:0,g:0}),X=q.filter(e=>e.pending>0).length,Z=`${y.name}: hours ${(0,u.rangeText)(_.start,_.end)}`,ee=`hours-${_.start}-to-${_.end}`,se=e=>{U(e),setTimeout(()=>U(null),6e3)};return(0,j.jsxs)(d.default,{style:{gap:10},testID:"payroll-hours",children:['none'===w?(0,j.jsxs)(i.Banner,{kind:"warn",title:"Pay dates not set up",children:[(0,j.jsx)(i.Muted,{children:"Using calendar months for now."}),(0,j.jsx)(i.Button,{small:!0,kind:"ghost",label:"Set your pay dates \u203a",onPress:()=>e('more','paysettings')})]}):null,(0,j.jsxs)(i.Row,{wrap:!0,gap:6,children:[C.map(e=>(0,j.jsx)(i.Chip,{label:e.label,sub:e.sub,selected:B===e.id,onPress:()=>{R(e.id),A(!1)}},e.id)),(0,j.jsx)(i.Chip,{label:"Custom dates",sub:z&&'custom'===B?(0,u.rangeText)(z.start,z.end):'Pick any range',selected:'custom'===B,onPress:()=>A(!V)})]}),V?(0,j.jsx)(N,{onSet:e=>{F(e),R('custom'),A(!1)}}):null,(0,j.jsx)(i.Card,{highlight:h.colours.gold,children:(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,j.jsxs)(d.default,{style:{flexShrink:1,minWidth:0},children:[(0,j.jsxs)(i.T,{weight:"bold",size:18,children:[(0,u.rangeText)(_.start,_.end)," ",_.end.slice(0,4)]}),(0,j.jsxs)(i.Muted,{children:[(0,u.ukDate)(_.start)," to ",(0,u.ukDate)(_.end),_.payday?` \xb7 ${_.payday>=n?'pays':'paid'} ${(0,u.dayMonth)(_.payday)}`:'',K?' \xb7 tips period':'wage'===_.kind?' \xb7 wage period':'']})]}),(0,j.jsxs)(d.default,{style:{alignItems:'flex-end'},children:[(0,j.jsxs)(i.T,{size:22,weight:"bold",colour:h.colours.gold,children:[(0,u.decH)(Q.c)," h"]}),(0,j.jsxs)(i.Muted,{children:["confirmed (",(0,u.hMm)(Q.c),")"]})]})]})}),X?(0,j.jsx)(r.default,{accessibilityRole:"button",accessibilityLabel:"Sign off pending hours",onPress:()=>e('more','signoff'),testID:"pending-banner",children:(0,j.jsxs)(d.default,{style:{backgroundColor:h.colours.amberBg,borderRadius:12,padding:12,borderLeftWidth:6,borderLeftColor:h.colours.amber,gap:4},children:[(0,j.jsxs)(i.T,{weight:"bold",colour:h.colours.amber,children:["\u26a0 ",(0,u.decH)(Q.p)," h still waiting for sign-off (",X," ",1===X?'person':'people',")"]}),(0,j.jsx)(i.T,{size:14,children:"Pending hours are not in the totals or the exports' confirmed columns. Sign them off first so everyone is paid in full."}),(0,j.jsx)(i.T,{weight:"semibold",colour:h.colours.gold,children:"Sign off hours \u203a"})]})}):(0,j.jsx)(i.Banner,{kind:"success",title:"All hours in this period are signed off"}),(0,j.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(i.Button,{small:!0,kind:"success",label:"Copy for spreadsheet",testID:"copy-tsv",onPress:async()=>{const e=await I(v(O(q,_,J,K)));se(e?`Copied ${q.length} rows. Paste into the first cell of your spreadsheet.`:'Copy is not available here. Use Download CSV.')}}),(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Download CSV",onPress:()=>{(0,p.downloadText)(`${ee}.csv`,$(O(q,_,J,K))),se('CSV downloaded (summary).')}}),(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Download CSV (daily detail)",onPress:()=>{(0,p.downloadText)(`${ee}-daily.csv`,$(H(q))),se('CSV downloaded (one line per shift).')}}),(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Print / PDF",onPress:()=>{const e=O(q,_,J,K);(0,p.printTable)(Z,`${(0,u.ukDate)(_.start)} to ${(0,u.ukDate)(_.end)} \xb7 confirmed hours only in the totals \xb7 printed ${(0,u.ukDate)(n)}`,e[0],e.slice(1))}})]}),G?(0,j.jsx)(i.Banner,{kind:"success",title:G}):null,(0,j.jsx)(t.WideTable,{children:(0,j.jsxs)(d.default,{testID:"hours-table",children:[(0,j.jsx)(t.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:h.colours.border,paddingBottom:4},children:['Name','Shifts','Confirmed','Pending',K?'Tips h':'h:mm',J?'Rate':'',J?'Gross':''].map((e,s)=>(0,j.jsx)(i.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{width:L[s]},children:e},s))}),q.map(e=>{const s=!!E[e.person.id];return(0,j.jsxs)(d.default,{style:{borderBottomWidth:1,borderColor:'#222'},children:[(0,j.jsx)(r.default,{accessibilityRole:"button",accessibilityLabel:`${M(e.person)} daily hours`,onPress:()=>Y({...E,[e.person.id]:!s}),style:{paddingVertical:7},children:(0,j.jsxs)(t.TRow,{heads:['Name','Shifts','Confirmed','Pending',K?'Tips h':'h:mm',J?'Rate':'',J?'Gross':''],children:[(0,j.jsxs)(d.default,{style:{width:L[0]},children:[(0,j.jsxs)(i.T,{size:14,weight:"semibold",numberOfLines:1,children:[s?'\u25be':'\u25b8'," ",M(e.person)]}),(0,j.jsx)(i.Muted,{numberOfLines:1,children:D(e.person)})]}),(0,j.jsx)(i.T,{size:14,style:{width:L[1]},children:e.shifts}),(0,j.jsx)(i.T,{size:14,weight:"semibold",style:{width:L[2]},children:(0,u.decH)(e.confirmed)}),(0,j.jsx)(i.T,{size:14,weight:e.pending?'bold':'regular',colour:e.pending?h.colours.amber:h.colours.muted,style:{width:L[3]},children:e.pending?`\u26a0 ${(0,u.decH)(e.pending)}`:'0.00'}),(0,j.jsx)(i.T,{size:14,style:{width:L[4]},children:K?(0,u.decH)(e.confirmed):(0,u.hMm)(e.confirmed)}),(0,j.jsx)(i.T,{size:14,colour:h.colours.muted,style:{width:L[5]},children:J?null!=e.rate?(0,c.gbp)(e.rate):'\u2013':''}),(0,j.jsx)(i.T,{size:14,weight:"semibold",style:{width:L[6]},children:J?null!=e.gross?(0,c.gbp)(e.gross):'\u2013':''})]})}),s?(0,j.jsxs)(d.default,{style:{backgroundColor:h.colours.surface2,borderRadius:8,padding:8,marginBottom:8,gap:2},testID:`daily-${e.person.id}`,children:[(0,j.jsx)(t.TRow,{head:!0,children:['Date','In','Out','Break','Paid','Status'].map((e,s)=>(0,j.jsx)(i.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{width:[96,52,52,52,56,90][s]},children:e},e))}),e.days.map(e=>(0,j.jsxs)(t.TRow,{heads:['Date','In','Out','Break','Paid','Status'],children:[(0,j.jsx)(i.T,{size:13,style:{width:96},children:(0,u.dayMonth)(e.date)}),(0,j.jsx)(i.T,{size:13,style:{width:52},children:e.inT}),(0,j.jsx)(i.T,{size:13,style:{width:52},children:e.outT||'\u2013'}),(0,j.jsx)(i.T,{size:13,style:{width:52},children:'On now'===e.status?'\u2013':`${e.brk}m`}),(0,j.jsx)(i.T,{size:13,style:{width:56},children:'On now'===e.status?'\u2013':(0,u.hMm)(e.paid)}),(0,j.jsx)(i.T,{size:13,weight:"semibold",style:{width:90},colour:'Confirmed'===e.status?h.colours.ok:'Pending'===e.status?h.colours.amber:h.colours.blue,children:e.status})]},e.a.id)),e.days.length?null:(0,j.jsx)(i.Muted,{children:"No clocked shifts in this period."})]}):null]},e.person.id)}),(0,j.jsxs)(t.TRow,{heads:['','Shifts','Confirmed','Pending',K?'Tips h':'h:mm','',J?'Gross':''],style:{paddingVertical:8,borderTopWidth:2,borderColor:h.colours.gold},children:[(0,j.jsxs)(i.T,{size:14,weight:"bold",style:{width:L[0]},children:["Total (",q.length,")"]}),(0,j.jsx)(i.T,{size:14,weight:"bold",style:{width:L[1]},children:Q.s}),(0,j.jsx)(i.T,{size:14,weight:"bold",colour:h.colours.gold,style:{width:L[2]},children:(0,u.decH)(Q.c)}),(0,j.jsx)(i.T,{size:14,weight:"bold",colour:Q.p?h.colours.amber:h.colours.muted,style:{width:L[3]},children:(0,u.decH)(Q.p)}),(0,j.jsx)(i.T,{size:14,weight:"bold",style:{width:L[4]},children:K?(0,u.decH)(Q.c):(0,u.hMm)(Q.c)}),(0,j.jsx)(i.T,{size:14,style:{width:L[5]},children:" "}),(0,j.jsx)(i.T,{size:14,weight:"bold",style:{width:L[6]},children:J?(0,c.gbp)(Q.g):''})]})]})}),(0,j.jsxs)(i.Muted,{children:["Tap a name for each day. Hours are decimal (37.50 = 37 hours 30 minutes); h:mm is also in the export. Paid hours = clock out \u2212 clock in \u2212 break. ",J?'Gross is before tax, from confirmed hours only.':'Rates and gross show once you sign in with your personal link.']}),K?(0,j.jsx)(i.Button,{kind:"success",label:"Tips day: split tips for this period \u203a",onPress:()=>e('more','tipsday')}):null]})},_e.TipsDay=function({go:e}){const{rid:n,today:a,now:f}=(0,x.useCtx)(6e4),{pay:w,source:T}=(0,b.useVenuePay)(n),P=(0,l.useOwner)(e=>e.staff),k=(0,l.useOwner)(e=>e.attendance),C=(0,l.useOwner)(e=>e.tronc),R=(0,u.nextToPay)(w,'tips',a),[z,O]=(0,o.useState)(0),H=(0,u.tipsPeriod)(w,R.period.start,z),[W,N]=(0,o.useState)(''),[L,F]=(0,o.useState)({}),[V,A]=(0,o.useState)(null),E=(0,o.useMemo)(()=>S(H,P,k,f,{}),[H.key,P,k]),Y=e=>'owner'===e.role&&!C.includeOwner||'manager'===e.role&&!C.includeManagers,G=e=>L[e.id]??Y(e),U=E.filter(e=>e.confirmed>0||e.pending>0),_=Math.round(100*Number(W.replace(/[\xa3,\s]/g,''))),q=Number.isFinite(_)&&_>0&&_<=1e8&&/^\s*\xa3?\s*[\d,]+(\.\d{0,2})?\s*$/.test(W),J=U.filter(e=>!G(e.person)&&e.confirmed>0),{amounts:K}=(0,y.allocate)(q?_:0,J.map(e=>e.confirmed)),Q={};J.forEach((e,s)=>{Q[e.person.id]=K[s]});const X=J.reduce((e,s)=>e+s.confirmed,0),Z=Object.values(Q).reduce((e,s)=>e+s,0),ee=U.filter(e=>e.pending>0&&!G(e.person)),se=ee.reduce((e,s)=>e+s.pending,0),te=()=>[['Name','Role','Period start','Period end','Payday','Confirmed hours','Confirmed h:mm','Share %','Tips \xa3'],...U.map(e=>{const s=!G(e.person)&&e.confirmed>0;return[M(e.person),D(e.person),(0,u.ukDate)(H.start),(0,u.ukDate)(H.end),H.payday?(0,u.ukDate)(H.payday):'',(0,u.decH)(e.confirmed),(0,u.hMm)(e.confirmed),s&&X?(e.confirmed/X*100).toFixed(2):'0.00',s?B(Q[e.person.id]??0):G(e.person)?'excluded':'0.00']}),['TOTAL','',(0,u.ukDate)(H.start),(0,u.ukDate)(H.end),H.payday?(0,u.ukDate)(H.payday):'',(0,u.decH)(X),(0,u.hMm)(X),X?'100.00':'0.00',B(Z)]],oe=e=>{A(e),setTimeout(()=>A(null),6e3)};return(0,j.jsxs)(d.default,{style:{gap:10},testID:"tips-day",children:[(0,j.jsx)(i.Banner,{kind:"info",title:"Saving payouts and notifying staff are coming next",children:"For now this works out the split and exports it. Nothing is saved to the team, sent or paid."}),'none'===T?(0,j.jsxs)(i.Banner,{kind:"warn",title:"Tips dates not set up",children:[(0,j.jsx)(i.Muted,{children:"Using weekly tips for now."}),(0,j.jsx)(i.Button,{small:!0,kind:"ghost",label:"Set your pay dates \u203a",onPress:()=>e('more','paysettings')})]}):null,(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(i.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",disabled:z<=-6,onPress:()=>O(z-1)}),(0,j.jsxs)(d.default,{style:{alignItems:'center',flex:1},children:[(0,j.jsx)(i.T,{weight:"bold",size:18,children:(0,u.rangeText)(H.start,H.end)}),(0,j.jsxs)(i.Muted,{children:[(0,u.ukDate)(H.start)," to ",(0,u.ukDate)(H.end)," \xb7 ",H.payday>=a?'paid':'was paid'," ",(0,u.dayMonth)(H.payday)]}),0===z?(0,j.jsx)(i.Badge,{kind:"gold",label:"Paid next"}):null]}),(0,j.jsx)(i.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:z>=1,onPress:()=>O(z+1)})]}),(0,j.jsxs)(i.Card,{highlight:h.colours.gold,children:[(0,j.jsx)(i.T,{weight:"semibold",children:"Total tips to share"}),(0,j.jsxs)(i.Row,{style:{alignItems:'center'},children:[(0,j.jsx)(i.T,{size:28,weight:"bold",colour:h.colours.gold,children:"\xa3"}),(0,j.jsx)(s.TextInput,{testID:"tips-total",accessibilityLabel:"Total tips in pounds",value:W,onChangeText:N,placeholder:"0.00",placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",style:[i.styles.input,{flex:1,fontSize:26,fontWeight:'700'}]})]}),W&&!q?(0,j.jsx)(i.T,{size:13,colour:h.colours.red,children:"Enter an amount like 1250.00"}):(0,j.jsx)(i.Muted,{children:"Shared by confirmed hours: share = total \xd7 (their hours \xf7 everyone's hours). Rounded to the penny; leftover pennies go to the largest shares so it adds up exactly."})]}),ee.length?(0,j.jsx)(r.default,{accessibilityRole:"button",onPress:()=>e('more','signoff'),testID:"tips-pending",children:(0,j.jsxs)(d.default,{style:{backgroundColor:h.colours.redBg,borderRadius:12,padding:12,borderLeftWidth:6,borderLeftColor:h.colours.red,gap:4},children:[(0,j.jsxs)(i.T,{weight:"bold",colour:h.colours.red,children:["\u26a0 Don't pay out yet: ",(0,u.decH)(se)," h not signed off"]}),(0,j.jsxs)(i.T,{size:14,children:[ee.map(e=>`${M(e.person)} (${(0,u.decH)(e.pending)} h)`).join(', '),". Pending hours are left out of the split, so these people would get less than they should."]}),(0,j.jsx)(i.T,{weight:"semibold",colour:h.colours.gold,children:"Sign off hours \u203a"})]})}):U.length?(0,j.jsx)(i.Banner,{kind:"success",title:"All hours in this fortnight are signed off"}):null,(0,j.jsx)(t.WideTable,{children:(0,j.jsxs)(d.default,{testID:"tips-table",children:[(0,j.jsx)(t.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:h.colours.border,paddingBottom:4},children:['Include','Name','Confirmed','Share','Tips'].map((e,s)=>(0,j.jsx)(i.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{width:[64,150,80,64,84][s]},children:e},e))}),U.map(e=>{const s=G(e.person),o=Q[e.person.id]??0;return(0,j.jsxs)(t.TRow,{heads:['Include','Name','Confirmed','Share','Tips'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222',opacity:s?.5:1},children:[(0,j.jsx)(r.default,{accessibilityRole:"checkbox",accessibilityState:{checked:!s},accessibilityLabel:`Include ${M(e.person)}`,onPress:()=>F({...L,[e.person.id]:!s}),style:{width:64,minHeight:44,justifyContent:'center'},children:(0,j.jsx)(d.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:s?h.colours.muted:h.colours.ok,backgroundColor:s?'transparent':h.colours.okBg,alignItems:'center',justifyContent:'center'},children:(0,j.jsx)(i.T,{size:14,colour:h.colours.ok,children:s?'':'\u2713'})})}),(0,j.jsxs)(d.default,{style:{width:150},children:[(0,j.jsx)(i.T,{size:14,weight:"semibold",numberOfLines:1,children:M(e.person)}),(0,j.jsxs)(i.Muted,{numberOfLines:1,children:[s?'Excluded':D(e.person),e.pending?` \xb7 \u26a0 ${(0,u.decH)(e.pending)} h pending`:'']})]}),(0,j.jsxs)(i.T,{size:14,style:{width:80},children:[(0,u.decH)(e.confirmed)," h"]}),(0,j.jsx)(i.T,{size:14,colour:h.colours.muted,style:{width:64},children:!s&&X?`${(e.confirmed/X*100).toFixed(1)}%`:'\u2013'}),(0,j.jsx)(i.T,{size:15,weight:"bold",colour:s?h.colours.muted:h.colours.gold,style:{width:84},children:s?'\u2013':(0,c.gbp)(o)})]},e.person.id)}),(0,j.jsxs)(t.TRow,{heads:['','','Confirmed','Share','Tips'],style:{paddingVertical:8,borderTopWidth:2,borderColor:h.colours.gold},children:[(0,j.jsx)(i.T,{size:14,style:{width:64},children:" "}),(0,j.jsxs)(i.T,{size:14,weight:"bold",style:{width:150},children:["Total (",J.length," people)"]}),(0,j.jsxs)(i.T,{size:14,weight:"bold",style:{width:80},children:[(0,u.decH)(X)," h"]}),(0,j.jsx)(i.T,{size:14,style:{width:64},children:X?'100%':'\u2013'}),(0,j.jsx)(i.T,{size:15,weight:"bold",colour:q&&Z===_?h.colours.ok:h.colours.text,style:{width:84},children:(0,c.gbp)(Z)})]})]})}),U.length?null:(0,j.jsx)(i.Muted,{children:"No clocked hours in this fortnight yet."}),q&&X?(0,j.jsxs)(i.Muted,{children:["Check: ",J.length," shares add up to ",(0,c.gbp)(Z)," of ",(0,c.gbp)(_)," ",Z===_?'\u2713':'',". \xa3",(_/100/(X/60)).toFixed(4)," per confirmed hour."]}):null,(0,j.jsxs)(i.Muted,{children:["Owner ",C.includeOwner?'included':'left out'," and managers ",C.includeManagers?'included':'left out'," by default (your tipping policy in Tips (tronc)). Tick or untick anyone for this split."]}),(0,j.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(i.Button,{small:!0,kind:"success",label:"Copy for spreadsheet",testID:"tips-copy",disabled:!q,onPress:async()=>{const e=await I(v(te()));oe(e?'Copied. Paste into the first cell of your spreadsheet.':'Copy is not available here. Use Download CSV.')}}),(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Download CSV",disabled:!q,onPress:()=>{(0,p.downloadText)(`tips-${H.start}-to-${H.end}.csv`,$(te())),oe('CSV downloaded.')}}),(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Print / PDF",disabled:!q,onPress:()=>{const e=te();(0,p.printTable)(`Tips ${(0,u.rangeText)(H.start,H.end)} (paid ${(0,u.dayMonth)(H.payday)})`,`Total ${(0,c.gbp)(_)} shared by confirmed hours${ee.length?` \xb7 WARNING ${(0,u.decH)(se)} h not signed off`:''}`,e[0],e.slice(1))}})]}),V?(0,j.jsx)(i.Banner,{kind:"success",title:V}):null]})},_e.PaydaysCard=function({go:e}){const{rid:s,today:t}=(0,x.useCtx)(6e4),{pay:o,source:r}=(0,b.useVenuePay)(s),a=(0,u.nextToPay)(o,'tips',t).period,l=(0,u.nextToPay)(o,'wage',t).period;return(0,j.jsxs)(d.default,{testID:"paydays-card",style:{backgroundColor:h.colours.surface,borderRadius:16,borderWidth:1,borderColor:h.colours.hairline,padding:16,gap:8},children:[(0,j.jsx)(n.CardHeading,{right:'none'===r?(0,j.jsx)(i.Badge,{kind:"amber",label:"Not set up"}):null,children:"Paydays"}),(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,j.jsxs)(i.T,{children:["Next tips payday: ",(0,j.jsx)(i.T,{weight:"semibold",colour:h.colours.goldLight,children:a.payday===t?'today':(0,u.dayMonth)(a.payday)})]}),(0,j.jsx)(i.Muted,{children:(0,u.rangeText)(a.start,a.end)})]}),(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,j.jsxs)(i.T,{children:["Next payday: ",(0,j.jsx)(i.T,{weight:"semibold",colour:h.colours.goldLight,children:l.payday===t?'today':(0,u.dayMonth)(l.payday)})]}),(0,j.jsxs)(i.Muted,{children:["period ",(0,u.rangeText)(l.start,l.end)]})]}),(0,j.jsxs)(n.ActionGrid,{testID:"paydays-actions",children:[(0,j.jsx)(n.ActionTile,{primary:!0,icon:"payroll",label:"Payroll hours",sub:"Copy or export",onPress:()=>e('more','hours'),testID:"paydays-hours"}),(0,j.jsx)(n.ActionTile,{icon:"tips",label:"Tips day",sub:"Share out tips",onPress:()=>e('more','tipsday'),testID:"paydays-tips"})]}),'settings'!==r?(0,j.jsx)(i.Button,{small:!0,kind:"ghost",label:"Pay & tips settings",onPress:()=>e('more','paysettings'),style:{alignSelf:'flex-start'}}):null]})},_e.MyPeriods=function({staffId:e}){const{rid:s,today:t,now:o,meId:n}=(0,x.useCtx)(6e4),r=e??n,{pay:a}=(0,b.useVenuePay)(s),c=(0,l.useOwner)(e=>e.attendance),p=(0,l.useOwner)(e=>e.staff.find(e=>e.id===r)),y=(0,u.wagePeriod)(a,t,0),f=(0,u.tipsPeriod)(a,t,0),w=e=>p?S(e,[p],c,o,{})[0]??null:null,T=(e,s,o)=>(0,j.jsxs)(d.default,{style:{flexGrow:1,flexBasis:160,backgroundColor:h.colours.surface,borderRadius:14,borderWidth:1,borderColor:h.colours.border,padding:12,gap:2},children:[(0,j.jsx)(i.T,{size:13,weight:"semibold",colour:h.colours.gold,children:e.toUpperCase()}),(0,j.jsxs)(i.Muted,{children:[(0,u.rangeText)(s.start,s.end)," \xb7 ",s.payday>=t?'paid':'was paid'," ",(0,u.dayMonth)(s.payday)]}),(0,j.jsxs)(i.T,{size:24,weight:"bold",children:[(0,u.decH)(o?.confirmed??0)," h"]}),(0,j.jsxs)(i.Muted,{children:["confirmed (",(0,u.hMm)(o?.confirmed??0),") \xb7 ",o?.shifts??0," shifts"]}),o?.pending?(0,j.jsxs)(i.T,{size:13,colour:h.colours.amber,children:["+ ",(0,u.decH)(o.pending)," h waiting for sign-off"]}):null]},e);return(0,j.jsx)(i.Row,{wrap:!0,gap:8,style:{alignItems:'stretch'},children:[T('This pay period',y,w(y)),T('This tips fortnight',f,w(f))]})};var s=_r(_d[0]),t=_r(_d[1]),o=_r(_d[2]),n=_r(_d[3]);_r(_d[4]);var r=e(_r(_d[5])),d=e(_r(_d[6])),i=_r(_d[7]),a=_r(_d[8]),l=_r(_d[9]),c=_r(_d[10]),u=_r(_d[11]),h=_r(_d[12]),p=_r(_d[13]),y=_r(_d[14]),f=_r(_d[15]),x=_r(_d[16]),b=_r(_d[17]),j=_r(_d[18]);const w={weekly:'Weekly',fortnightly:'Fortnightly',monthly:'Monthly'},T={none:'Keep the date',before:'Friday before',after:'Monday after'};const P=e=>`${e}${e%10==1&&11!==e?'st':e%10==2&&12!==e?'nd':e%10==3&&13!==e?'rd':'th'}`;function k({label:e,day:s,period:t}){return(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,j.jsxs)(i.T,{children:[e,": ",(0,j.jsx)(i.T,{weight:"bold",colour:h.colours.gold,children:(0,u.dayMonth)(s)})]}),(0,j.jsx)(i.Muted,{children:(0,u.rangeText)(t.start,t.end)})]})}const C=e=>{if(!e)return'';const s=new Date(e);return`${String(s.getHours()).padStart(2,'0')}:${String(s.getMinutes()).padStart(2,'0')}`};function S(e,s,t,o,n){const r=t.filter(s=>s.in&&s.date>=e.start&&s.date<=e.end);return s.map(e=>{const s=r.filter(s=>s.staffId===e.id).sort((e,s)=>e.date.localeCompare(s.date)||(e.in??'').localeCompare(s.in??'')).map(e=>{const s=(0,x.paidMins)(e,o),t=(0,l.attStatus)(e);return{a:e,date:e.date,inT:C(e.in),outT:C(e.out),brk:s.brk,paid:s.paid,status:'open'===t?'On now':'awaiting'===t?'Pending':'Confirmed'}}),t=e=>s.filter(s=>s.status===e).reduce((e,s)=>e+s.paid,0),d=t('Confirmed'),i=n[e.id];return{person:e,confirmed:d,pending:t('Pending'),open:t('On now'),shifts:s.filter(e=>'On now'!==e.status).length,days:s,rate:i,gross:null!=i?Math.round(d/60*i):void 0}}).filter(e=>e.days.length>0||e.person.active&&'owner'!==e.person.role)}const D=e=>`${l.ROLE_LABEL[e.role]}${e.job?` \xb7 ${e.job}`:''}`,M=e=>e.name.replace(' (example)',''),B=e=>null==e?'':(e/100).toFixed(2),R=e=>e.replace(/[\t\r\n]+/g,' '),z=e=>/[",\n]/.test(e)?`"${e.replace(/"/g,'""')}"`:e,v=e=>e.map(e=>e.map(R).join('\t')).join('\n'),$=e=>e.map(e=>e.map(z).join(',')).join('\r\n');function O(e,s,t,o){const n=['Name','Role','Period start','Period end','Confirmed hours','Confirmed h:mm','Pending hours','Pending h:mm','Shifts',...o?['Tips hours']:[],...t?['Rate \xa3/h','Gross \xa3']:[]],r=e.map(e=>[M(e.person),D(e.person),(0,u.ukDate)(s.start),(0,u.ukDate)(s.end),(0,u.decH)(e.confirmed),(0,u.hMm)(e.confirmed),(0,u.decH)(e.pending),(0,u.hMm)(e.pending),String(e.shifts),...o?[(0,u.decH)(e.confirmed)]:[],...t?[B(e.rate),B(e.gross)]:[]]),d=e.reduce((e,s)=>({c:e.c+s.confirmed,p:e.p+s.pending,s:e.s+s.shifts,g:e.g+(s.gross??0)}),{c:0,p:0,s:0,g:0});return[n,...r,['TOTAL','',(0,u.ukDate)(s.start),(0,u.ukDate)(s.end),(0,u.decH)(d.c),(0,u.hMm)(d.c),(0,u.decH)(d.p),(0,u.hMm)(d.p),String(d.s),...o?[(0,u.decH)(d.c)]:[],...t?['',B(d.g)]:[]]]}function H(e){return[['Name','Role','Date','In','Out','Break mins','Paid hours','Paid h:mm','Status'],...e.flatMap(e=>e.days.map(s=>[M(e.person),D(e.person),(0,u.ukDate)(s.date),s.inT,s.outT,'On now'===s.status?'':String(s.brk),'On now'===s.status?'':(0,u.decH)(s.paid),'On now'===s.status?'':(0,u.hMm)(s.paid),s.status]))]}async function I(e){if('undefined'==typeof document)return!1;try{if(navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}try{const s=document.createElement('textarea');s.value=e,s.style.position='fixed',s.style.opacity='0',document.body.appendChild(s),s.select();const t=document.execCommand('copy');return s.remove(),t}catch{return!1}}function W(e,s){const t=(0,u.nextToPay)(e,'wage',s),o=(0,u.nextToPay)(e,'tips',s),n=(0,u.wagePeriod)(e,t.period.start,-1),r=(0,u.tipsPeriod)(e,o.period.start,-1),d=e=>e.payday>=s?e.payday===s?'Pays today':`Pays ${(0,u.dayMonth)(e.payday)}`:`Paid ${(0,u.dayMonth)(e.payday)}`;return[{id:'wage',label:`Wages ${(0,u.rangeText)(t.period.start,t.period.end)}`,sub:d(t.period),period:t.period},{id:'wagePrev',label:`Wages ${(0,u.rangeText)(n.start,n.end)}`,sub:d(n),period:n},{id:'tips',label:`Tips ${(0,u.rangeText)(o.period.start,o.period.end)}`,sub:d(o.period),period:o.period},{id:'tipsPrev',label:`Tips ${(0,u.rangeText)(r.start,r.end)}`,sub:d(r),period:r}]}function N({onSet:e}){const[s,t]=(0,o.useState)(''),[n,r]=(0,o.useState)(''),a=(0,u.parseUk)(s),l=(0,u.parseUk)(n),c=!!a&&!!l&&l>=a&&(0,u.plusDays)(a,92)>=l;return(0,j.jsxs)(i.Row,{wrap:!0,gap:6,style:{alignItems:'flex-end'},children:[(0,j.jsx)(d.default,{style:{flexBasis:130,flexGrow:1},children:(0,j.jsx)(i.Field,{label:"From (DD/MM/YYYY)",value:s,onChangeText:t,placeholder:"23/10/2026"})}),(0,j.jsx)(d.default,{style:{flexBasis:130,flexGrow:1},children:(0,j.jsx)(i.Field,{label:"To (DD/MM/YYYY)",value:n,onChangeText:r,placeholder:"22/11/2026"})}),(0,j.jsx)(i.Button,{small:!0,kind:"success",label:"Show",disabled:!c,onPress:()=>c&&e((0,u.customPeriod)(a,l))}),s&&n&&!c?(0,j.jsx)(i.T,{size:13,colour:h.colours.red,children:"Use two dates, the second on or after the first, up to 3 months apart."}):null]})}const L=[150,54,62,62,48,62,70]},1009,[877,1338,30,1339,122,263,127,813,872,856,816,1110,821,1340,1011,1019,927,1111,24]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useWeekSales=F,_e.Rota=function(){const{now:e,role:t,meId:n}=(0,C.useCtx)(6e4),o=(0,f.useOwner)(e=>e.staff).filter(e=>e.active),i=(0,f.useOwner)(e=>e.shifts),h=(0,C.useHourly)(),m=(0,f.useOwner)(e=>e.availability),p=(0,f.useOwner)(e=>e.leave),x=(0,f.useOwner)(e=>e.swaps),[I,v]=(0,l.useState)(0),[D,T]=(0,l.useState)(null),[$,M]=(0,l.useState)(null),[R,P]=(0,l.useState)('week'),[z,H]=(0,l.useState)(''),[W,E]=(0,l.useState)(''),[_,q]=(0,l.useState)(''),K='staff'!==t,U=(0,b.addMins)(L(e),7*I*1440);U.setHours(0,0,0,0);const V=F(U),G=V.sales,X='none'===V.mode,J=Array.from({length:7},(e,t)=>{const s=new Date(U);return s.setDate(U.getDate()+t),(0,b.ymd)(s)}),Q=(0,f.visibleShifts)(i,K).filter(e=>e.date>=J[0]&&e.date<=J[6]),Z=(()=>{const e=new Date(U);return e.setDate(e.getDate()-7),(0,b.ymd)(e)})(),ee=Q.filter(e=>!e.published||e.changed).length,te=i.filter(e=>e.date>=Z&&e.datep.some(s=>s.staffId===e&&'approved'===s.status&&s.from<=t&&t<=s.to),ne=J.map(e=>Q.filter(t=>t.date===e).reduce((e,t)=>{return e+(A(s=t)-Y(A(s)))*(h[s.staffId]??0);var s},0)),ae=ne.reduce((e,t)=>e+t,0),oe=G.reduce((e,t)=>e+t,0),ie=(e,t)=>t?Math.round(e/t*100):0,le=K?o:o.filter(e=>e.id===n),re=(0,a.useNarrow)(),de=Math.max(0,J.indexOf((0,b.ymd)(e))),[ce,ue]=(0,l.useState)(null),he=ce??de,fe=(e,t)=>!re||t===he,me=re?150:74;return(0,B.jsxs)(c.default,{style:{gap:10},children:[(0,B.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,B.jsx)(u.Chip,{label:"Week",selected:'week'===R,onPress:()=>P('week')}),(0,B.jsx)(u.Chip,{label:`Swaps & leave (${x.filter(e=>'open'===e.status).length+p.filter(e=>'pending'===e.status).length})`,selected:'requests'===R,onPress:()=>P('requests')}),(0,B.jsx)(u.Chip,{label:"Availability",selected:'availability'===R,onPress:()=>P('availability')})]}),'week'===R?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsx)(u.Button,{small:!0,kind:"ghost",label:"\u2039 Prev",accessibilityLabel:"Previous week",onPress:()=>{v(I-1),T(null)}}),(0,B.jsxs)(c.default,{style:{alignItems:'center',flex:1},children:[(0,B.jsxs)(u.T,{weight:"semibold",children:["Week of ",(0,b.niceDate)(U)]}),(0,B.jsxs)(u.Muted,{children:[0===I?'This week':1===I?'Next week':-1===I?'Last week':I>0?`In ${I} weeks`:-I+" weeks ago",K?' \xb7 tap a cell to add or edit':' \xb7 your shifts']})]}),(0,B.jsx)(u.Button,{small:!0,kind:"ghost",label:"Next \u203a",accessibilityLabel:"Next week",onPress:()=>{v(I+1),T(null)}})]}),K?(0,B.jsxs)(u.Row,{wrap:!0,gap:8,style:{alignItems:'center'},children:[(0,B.jsx)(u.Button,{small:!0,kind:"secondary",label:"Copy last week"+(te?` (${te})`:''),disabled:!te,testID:"rota-copy",onPress:()=>{const e=f.useOwner.getState().copyWeek(Z,J[0]);T(e?`Copied ${e} ${1===e?'shift':'shifts'} from last week as drafts. Check them, then publish.`:'Nothing to copy: those days are already filled.')}}),(0,B.jsx)(u.Button,{small:!0,kind:"success",label:ee?`Publish ${ee} ${1===ee?'change':'changes'}`:'Week published',disabled:!ee,testID:"rota-publish",onPress:()=>{const e=f.useOwner.getState().publishWeek(J[0]);T(`Published ${e} ${1===e?'shift':'shifts'}. Staff see them in their app.`)}}),ee?(0,B.jsx)(u.Badge,{kind:"amber",label:`${ee} unpublished`}):Q.length?(0,B.jsx)(u.Badge,{kind:"ok",label:"Visible to staff"}):null]}):null,D?(0,B.jsx)(u.Banner,{kind:"success",title:D}):null,re?(0,B.jsx)(u.Row,{wrap:!0,gap:6,children:C.DAY3.map((e,t)=>(0,B.jsx)(u.Chip,{label:`${e} ${(0,b.parseYmd)(J[t]).getDate()}`,selected:t===he,onPress:()=>ue(t)},e))}):null,(0,B.jsx)(d.default,{horizontal:!re,showsHorizontalScrollIndicator:!0,children:(0,B.jsxs)(c.default,{style:{gap:4},children:[(0,B.jsxs)(u.Row,{gap:4,children:[(0,B.jsx)(c.default,{style:{width:126}}),C.DAY3.map((t,s)=>(0,B.jsx)(c.default,{style:{width:me,alignItems:'center'},children:(0,B.jsxs)(u.T,{size:12,weight:"semibold",colour:J[s]===(0,b.ymd)(e)?w.colours.gold:w.colours.text,children:[t," ",(0,b.parseYmd)(J[s]).getDate()]})},t)).filter(fe)]}),le.map(e=>(0,B.jsxs)(u.Row,{gap:4,children:[(0,B.jsxs)(u.Row,{gap:6,style:{width:126},children:[(0,B.jsx)(S.StaffAvatar,{id:e.id,size:26}),(0,B.jsxs)(c.default,{style:{flex:1},children:[(0,B.jsx)(u.T,{size:12,numberOfLines:1,children:e.name.replace(' (example)','')}),(0,B.jsx)(u.Muted,{numberOfLines:1,children:e.job})]})]}),C.DAY3.map((t,s)=>{const n=(0,f.shiftOf)(Q,e.id,J[s]),a=(m[e.id]??[]).includes(s),o=se(e.id,J[s]);return(0,B.jsxs)(r.default,{accessibilityRole:"button",accessibilityLabel:`${e.name} ${C.DAY3[s]} ${n?`${(0,C.fmtH)(n.start)} to ${(0,C.fmtH)(n.end)}`:'no shift'}`,disabled:!K,onPress:()=>M({staffId:e.id,date:J[s],shift:n}),style:{width:me,height:48,borderRadius:10,borderWidth:1,borderStyle:n&&!n.published?'dashed':'solid',borderColor:n?n.published?w.colours.gold:w.colours.amber:w.colours.border,backgroundColor:n?n.published?'#2b2414':'#241f14':o?'#1d2a3a':a?'#2a1d1d':'transparent',alignItems:'center',justifyContent:'center'},children:[n?(0,B.jsxs)(u.T,{size:11,weight:"semibold",children:[(0,C.fmtH)(n.start),"\u2013",(0,C.fmtH)(n.end)]}):(0,B.jsx)(u.T,{size:11,colour:w.colours.muted,children:o?'Leave':a?'Unavail.':K?'Add':'\u2013'}),n&&(a||o)?(0,B.jsx)(u.T,{size:9,colour:w.colours.red,children:o?'on leave!':'unavailable'}):n&&K&&(!n.published||n.changed)?(0,B.jsx)(u.T,{size:9,colour:w.colours.amber,children:n.published?'changed':'draft'}):null]},s)}).filter(fe)]},e.id)),K?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(u.Row,{gap:4,children:[(0,B.jsx)(c.default,{style:{width:96},children:(0,B.jsx)(u.Muted,{children:"Labour"})}),ne.map((e,t)=>(0,B.jsx)(c.default,{style:{width:me,alignItems:'center'},children:(0,B.jsx)(u.T,{size:11,children:(0,j.gbp)(e).replace('.00','')})},t)).filter(fe)]}),X?null:(0,B.jsxs)(u.Row,{gap:4,children:[(0,B.jsx)(c.default,{style:{width:96},children:(0,B.jsx)(u.Muted,{children:'example'===V.mode?'Fcst sales (ex.)':'Fcst sales'})}),G.map((e,t)=>(0,B.jsx)(c.default,{style:{width:me,alignItems:'center'},children:(0,B.jsx)(u.T,{size:11,colour:w.colours.muted,children:e?`\xa3${Math.round(e/100)}`:'shut'})},t)).filter(fe)]}),X?null:(0,B.jsxs)(u.Row,{gap:4,children:[(0,B.jsx)(c.default,{style:{width:96},children:(0,B.jsx)(u.Muted,{children:"Labour %"})}),ne.map((e,t)=>{const s=ie(e,G[t]);return(0,B.jsx)(c.default,{style:{width:me,alignItems:'center'},children:(0,B.jsx)(u.T,{size:11,weight:"semibold",colour:G[t]?s>32?w.colours.red:s>26?w.colours.amber:w.colours.ok:w.colours.muted,children:G[t]?`${s}%`:'\u2013'})},t)}).filter(fe)]})]}):null]})}),K&&X?(0,B.jsx)(u.Card,{children:(0,B.jsxs)(c.default,{testID:"labour-no-forecast",style:{gap:6},children:[(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsx)(u.T,{weight:"semibold",children:"Labour this week"}),(0,B.jsx)(c.default,{testID:"labour-week-cost",children:(0,B.jsx)(u.T,{weight:"semibold",children:(0,j.gbp)(ae)})})]}),(0,B.jsxs)(u.Muted,{children:[(0,j.gbp)(ae)," labour from the rota (paid hours \xd7 hourly rates, owner salaries excluded)."]}),(0,B.jsx)(u.T,{weight:"semibold",colour:w.colours.gold,children:"Not enough history yet for labour vs sales"}),(0,B.jsx)(u.Muted,{children:`Forecasts start once CoverCharge has ${1===V.weeks?'1 week':`${V.weeks} weeks`} of your bookings and cash-ups. Until then no sales forecast or labour % is shown.`}),V.booked?(0,B.jsx)(c.default,{testID:"labour-booked",children:(0,B.jsxs)(u.T,{children:["Booked so far: ",V.booked," covers this week"]})}):null]})}):null,K&&!X?(0,B.jsxs)(u.Card,{children:[(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsx)(u.T,{weight:"semibold",children:"Labour vs forecast sales"}),(0,B.jsxs)(u.Row,{gap:6,children:['example'===V.mode?(0,B.jsx)(O.ExampleBadge,{}):null,(0,B.jsx)(u.Badge,{kind:ie(ae,oe)>30?'red':'ok',label:`${ie(ae,oe)}% this week`})]})]}),(0,B.jsxs)(u.Muted,{children:[(0,j.gbp)(ae)," labour (paid hours \xd7 hourly rates, owner salaries excluded) vs about ",(0,j.gbp)(oe)," forecast sales. Target 25\u201330%. ",'example'===V.mode?'Example figures: forecast sales use an example spend per cover.':'Forecast sales are your average takings for each weekday from your cash-ups.']}),(()=>{const e=ie(ne[5],G[5]);return e&&e<24?(0,B.jsxs)(u.T,{size:14,colour:w.colours.gold,children:["Tip: Saturday is forecast busy and labour is only ",e,"%. Consider an extra server 18:00\u201321:00."]}):null})()]}):null,K?(0,B.jsx)(u.Muted,{center:!0,children:"New and copied shifts are drafts (dashed) until you publish. Publishing only makes shifts visible in the Staff app and on the Display. Nothing is sent by text or email."}):null]}):null,'requests'===R?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(k.SectionHead,{title:"Shift swaps & cover"}),x.filter(e=>K||e.fromId===n||e.toId===n).map(e=>{const t=i.find(t=>t.id===e.shiftId),s=o.find(t=>t.id===e.fromId),n=o.find(t=>t.id===e.toId);return(0,B.jsxs)(u.Card,{children:[(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsxs)(u.T,{weight:"semibold",style:{flex:1},children:['swap'===e.kind?'Swap':'Cover needed',": ",s?.name]}),(0,B.jsx)(u.Badge,{kind:'open'===e.status?'amber':'approved'===e.status?'ok':'neutral',label:e.status})]}),(0,B.jsxs)(u.Muted,{children:[t?`${C.DAY3[t.day]} ${(0,C.fmtH)(t.start)}\u2013${(0,C.fmtH)(t.end)}`:'Shift',n?` \u2192 ${n.name}`:''," \xb7 ",e.note]}),'open'===e.status&&K?(0,B.jsxs)(u.Row,{gap:6,children:['cover'!==e.kind||e.toId?null:o.filter(t=>t.id!==e.fromId&&'owner'!==t.role).map(t=>(0,B.jsx)(u.Chip,{label:`Give to ${t.name.split(' ')[0]}`,onPress:()=>{f.useOwner.setState(s=>({swaps:s.swaps.map(s=>s.id===e.id?{...s,toId:t.id}:s)}))}},t.id)),(0,B.jsx)(u.Button,{small:!0,label:"Approve",disabled:!e.toId,onPress:()=>{f.useOwner.getState().setSwap(e.id,'approved');const s=e=>(o.find(t=>t.id===e)?.name??'').replace(' (example)','');(0,y.autoPost)('all','swap'===e.kind?`Shift swap: ${s(e.fromId)} \u2194 ${s(e.toId)} approved`:`Cover approved: ${s(e.toId)} covers ${s(e.fromId)}${t?` (${C.DAY3[t.day]} ${(0,C.fmtH)(t.start)}\u2013${(0,C.fmtH)(t.end)})`:''}`)}}),(0,B.jsx)(u.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>f.useOwner.getState().setSwap(e.id,'declined')})]}):null]},e.id)}),K?null:(0,B.jsxs)(u.Card,{children:[(0,B.jsx)(u.T,{weight:"semibold",children:"Ask for a swap or cover"}),(0,B.jsx)(u.Muted,{children:"Your shifts this week. Your manager approves every swap."}),Q.filter(e=>e.staffId===n).sort((e,t)=>e.date.localeCompare(t.date)).map(e=>{const t=x.some(t=>t.shiftId===e.id&&'open'===t.status);return(0,B.jsxs)(c.default,{style:{gap:4,paddingVertical:4},children:[(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsxs)(u.T,{size:14,weight:"medium",children:[C.DAY3[e.day]," ",(0,C.fmtH)(e.start),"\u2013",(0,C.fmtH)(e.end)]}),t?(0,B.jsx)(u.Badge,{kind:"amber",label:"Request open"}):null]}),t?null:(0,B.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,B.jsx)(u.Chip,{label:"Ask for cover",onPress:()=>{f.useOwner.getState().addSwap({shiftId:e.id,fromId:n,kind:'cover',note:'Can anyone cover?'}),(0,y.autoPost)('all',`Cover needed: ${C.DAY3[e.day]} ${(0,C.fmtH)(e.start)}\u2013${(0,C.fmtH)(e.end)} (${(o.find(e=>e.id===n)?.name??'').replace(' (example)','')})`)}}),o.filter(e=>e.id!==n&&'staff'===e.role).map(t=>(0,B.jsx)(u.Chip,{label:`Swap with ${t.name.replace(' (example)','')}`,onPress:()=>f.useOwner.getState().addSwap({shiftId:e.id,fromId:n,toId:t.id,kind:'swap',note:'Agreed between us'})},t.id))]})]},e.id)}),Q.some(e=>e.staffId===n)?null:(0,B.jsx)(u.Muted,{children:"No shifts on the rota this week."})]}),(0,B.jsx)(k.SectionHead,{title:"Holiday & leave"}),p.filter(e=>K||e.staffId===n).map(e=>(0,B.jsxs)(u.Card,{children:[(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsx)(u.T,{weight:"semibold",children:o.find(t=>t.id===e.staffId)?.name}),(0,B.jsx)(u.Badge,{kind:'pending'===e.status?'amber':'approved'===e.status?'ok':'red',label:e.status})]}),(0,B.jsxs)(u.Muted,{children:[(0,b.niceDate)((0,b.parseYmd)(e.from))," \u2013 ",(0,b.niceDate)((0,b.parseYmd)(e.to))," \xb7 ",e.reason]}),'pending'===e.status&&K?(0,B.jsxs)(u.Row,{gap:6,children:[(0,B.jsx)(u.Button,{small:!0,label:"Approve",onPress:()=>f.useOwner.getState().setLeave(e.id,'approved')}),(0,B.jsx)(u.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>f.useOwner.getState().setLeave(e.id,'declined')})]}):null]},e.id)),(0,B.jsxs)(u.Card,{children:[(0,B.jsxs)(u.T,{weight:"semibold",children:["Request leave",K?' (as yourself)':'']}),(0,B.jsxs)(u.Row,{gap:6,children:[(0,B.jsx)(s.TextInput,{accessibilityLabel:"From date",placeholder:"From YYYY-MM-DD",placeholderTextColor:"#7D776C",value:z,onChangeText:H,style:[u.styles.input,{flex:1}]}),(0,B.jsx)(s.TextInput,{accessibilityLabel:"To date",placeholder:"To YYYY-MM-DD",placeholderTextColor:"#7D776C",value:W,onChangeText:E,style:[u.styles.input,{flex:1}]})]}),(0,B.jsx)(u.Field,{label:"Reason",value:_,onChangeText:q}),(0,B.jsx)(u.Button,{small:!0,label:"Send request",disabled:!/^\d{4}-\d{2}-\d{2}$/.test(z)||!/^\d{4}-\d{2}-\d{2}$/.test(W)||W{f.useOwner.getState().addLeave({staffId:n,from:z,to:W,reason:_.trim()||'Holiday'}),H(''),E(''),q('')}})]})]}):null,'availability'===R?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(u.Muted,{children:["Days each person can\u2019t work. ",K?'Tap to toggle.':'Tap to set your own.'," The rota flags clashes."]}),le.filter(e=>'owner'!==e.role||!K).map(e=>(0,B.jsxs)(u.Card,{children:[(0,B.jsxs)(u.Row,{gap:8,children:[(0,B.jsx)(S.StaffAvatar,{id:e.id,size:30}),(0,B.jsx)(u.T,{weight:"semibold",children:e.name})]}),(0,B.jsx)(u.Row,{wrap:!0,gap:4,children:C.DAY3.map((t,s)=>{const n=(m[e.id]??[]).includes(s);return(0,B.jsx)(u.Chip,{label:`${t} ${n?'\u2715':'\u2713'}`,selected:!n,onPress:()=>f.useOwner.getState().toggleAvail(e.id,s)},t)})})]},e.id))]}):null,$?(0,B.jsx)(N,{init:$,onClose:()=>M(null)}):null]})},_e.ClockInOut=function(){const{now:e,today:t,role:s,meId:a,me:d,r:h,rid:m}=(0,C.useCtx)(5e3),x=((0,I.useClockArea)(e=>e.areas[m]),(0,I.areaOf)(m));const j=(0,v.privateClockVenue)(m),[k,y]=(0,l.useState)(!1),O=(0,f.useOwner)(e=>e.consent[a]),R=(0,f.useOwner)(e=>e.attendance),P=(0,f.useOwner)(e=>e.shifts),[z,H]=(0,l.useState)(!1),[A,Y]=(0,l.useState)(null),[L,F]=(0,l.useState)(null),[N,_]=(0,l.useState)(void 0),[q,K]=(0,l.useState)(null),[U,V]=(0,l.useState)(!1),[G,X]=(0,l.useState)(null),J=R.filter(t=>t.staffId===a&&t.in&&!t.out&&e.getTime()-new Date(t.in).getTime()<72e6).sort((e,t)=>t.in.localeCompare(e.in))[0],Q=J&&(0,f.isOnBreak)(J)?J.breaks[J.breaks.length-1]:void 0,Z=(0,f.visibleShifts)(P,'staff'!==s).find(e=>e.staffId===a&&e.date===t),ee='staff'!==s,te=J?(0,C.paidMins)({in:J.in},e).worked:0,se=x.on&&(0,D.areaSet)(x),ne=J?.geo?.[J.geo.length-1],ae=async(s,n={})=>{Y(s),F(null),_(void 0);const l=await(0,T.clockAction)(s,{rid:m,staffId:a,date:t,at:new Date(e.getTime()).toISOString(),...n});return Y(null),l.ok?('out'===s&&l.att&&(K(l.att),(0,i.hrSettingsOf)(h.settings?.hr).on&&!o.useHr.getState().hasAnswered(m,l.att.id)&&X(l.att)),'in'===s&&K(null),!0):(F(l.message),_(l.fix),(0,$.notify)({id:'clock-blocked',tone:'warn',icon:'\ud83d\udccd',kicker:'CLOCK',title:l.message.split('. ')[0]+'.',body:l.message.split('. ').slice(1).join('. '),timeoutMs:9e3,testID:'clock-blocked'}),!1)};return O?(0,B.jsxs)(c.default,{style:{gap:10},children:[(0,B.jsxs)(u.Card,{highlight:w.colours.gold,children:[(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsxs)(u.Row,{gap:10,style:{flex:1},children:[(0,B.jsx)(S.StaffAvatar,{id:a,size:48}),(0,B.jsx)(u.T,{weight:"semibold",style:{flex:1},children:d})]}),(0,B.jsx)(u.Badge,{kind:J?'ok':'neutral',label:J?`On shift since ${(0,b.hm)(new Date(J.in))}`:'Not clocked in'})]}),(0,B.jsx)(u.Muted,{children:Z?`Today's shift: ${(0,C.fmtH)(Z.start)}\u2013${(0,C.fmtH)(Z.end)}`:'No shift on the rota today'}),(0,B.jsx)(c.default,{testID:"clock-area-line",children:(0,B.jsx)(u.T,{size:14,colour:w.colours.muted,children:se?j?`Location is checked only when you choose Clock in, at ${h.name}. Only pass or fail is saved.`:`\ud83d\udccd Your location is checked when you tap a button. You need to be at ${h.name}.`:x.on?'\ud83d\udccd The clock-in area isn\u2019t set yet, so location isn\u2019t checked.':'\ud83d\udccd Location checks are switched off for this venue.'})}),ne&&!0===ne.inside&&null!=ne.dist?(0,B.jsxs)(u.Muted,{children:["Last check: at the venue (about ",ne.dist," m from the centre)."]}):null,J?(0,B.jsx)(u.T,{size:30,weight:"bold",center:!0,children:(0,C.hmDur)(te)}):null,J&&Q?(0,B.jsx)(c.default,{testID:"on-break",children:(0,B.jsxs)(u.T,{size:15,weight:"semibold",colour:w.colours.gold,center:!0,children:["On a break since ",(0,b.hm)(new Date(Q.start))," \xb7 ",(0,f.loggedBreakMins)(J,e)," min so far"]})}):null,J?(0,B.jsxs)(B.Fragment,{children:[Q?(0,B.jsx)(u.Button,{testID:"break-end",kind:"success",label:'break_end'===A?'Checking your location\u2026':'End break',disabled:!!A,onPress:()=>{ae('break_end')}}):(0,B.jsx)(u.Button,{testID:"break-start",kind:"secondary",label:'break_start'===A?'Checking your location\u2026':'Start break',disabled:!!A,onPress:()=>{ae('break_start')}}),(0,B.jsx)(u.Button,{testID:"clock-out",kind:"danger",label:'out'===A?'Checking your location\u2026':'Clock out',disabled:!!A,onPress:()=>{J.breaks?.length?ae('out'):(F(null),H(!0))}})]}):(0,B.jsx)(u.Button,{testID:"clock-in",kind:"success",label:'in'===A?'Checking your location\u2026':'Clock in',disabled:!!A,onPress:()=>{j?y(!0):ae('in')}}),J?.breaks?.length?(0,B.jsxs)(u.Muted,{center:!0,children:["Breaks today: ",J.breaks.map(e=>`${(0,b.hm)(new Date(e.start))}\u2013${e.end?(0,b.hm)(new Date(e.end)):'now'}`).join(', ')," (",(0,f.loggedBreakMins)(J,e)," min)"]}):null,L?(0,B.jsx)(c.default,{testID:"clock-message",children:(0,B.jsx)(u.Banner,{kind:"warn",title:"Not recorded",children:L})}):null,L&&'settings'===N?(0,B.jsx)(u.Button,{testID:"clock-open-settings",label:"Open app settings",accessibilityLabel:"Open app settings, to allow location",onPress:M.openAppSettings}):null,L&&'location'===N?(0,B.jsx)(u.Button,{testID:"clock-open-location",label:"Open location settings",accessibilityLabel:"Open location settings, to turn on location",onPress:M.openLocationSettings}):null,L&&'update'===N?(0,B.jsx)(u.Button,{testID:"clock-check-update",label:"Look for the app update",accessibilityLabel:"Look for the app update",onPress:M.checkAppUpdate}):null]}),ee&&!(0,D.areaSet)(x)?(0,B.jsx)(c.default,{testID:"clock-area-warning",children:(0,B.jsx)(u.Banner,{kind:"warn",title:"Set the clock-in area",children:"Location isn\u2019t checked until a manager sets the venue\u2019s centre. Stand at the venue and go to Settings \u203a Advanced \u203a Clock-in area \u203a Use my current location."})}):null,(0,B.jsx)(r.default,{testID:"forgot-link",accessibilityRole:"button",onPress:()=>V(!0),style:{alignSelf:'center',padding:6},children:(0,B.jsx)(u.T,{size:14,colour:w.colours.gold,children:"Forgot to clock in or out?"})}),U?(0,B.jsx)(E,{onClose:()=>V(!1)}):null,(0,B.jsx)(p.BreakRoomCard,{staffId:a,name:d,now:e}),q?(()=>{const t=(0,C.paidMins)(q,e);return(0,B.jsxs)(u.Card,{highlight:w.colours.gold,children:[(0,B.jsxs)(u.T,{weight:"semibold",colour:w.colours.gold,children:["Clocked out at ",(0,b.hm)(new Date(q.out))]}),(0,B.jsxs)(u.T,{size:18,weight:"bold",children:["Clocked ",(0,C.hmDur)(t.worked),", break ",t.brk,"m, paid ",(0,C.hmDur)(t.paid)]}),(0,B.jsxs)(u.Muted,{children:["In ",(0,b.hm)(new Date(q.in))," \xb7 out ",(0,b.hm)(new Date(q.out))," \xb7 paid hours = (out \u2212 in) \u2212 break",q.breakAddedAtClockOut?' \xb7 break added at clock-out':'']}),t.worked>360&&0===t.brk?(0,B.jsx)(u.Banner,{kind:"info",title:"A note on breaks",children:"UK workers are generally entitled to a 20-minute rest break when working more than 6 hours. Your clock-out is saved; have a word with your manager if you didn\u2019t get one."}):null]})})():null,(0,B.jsx)(u.Sheet,{visible:k,onClose:()=>y(!1),title:"Why we ask for location",testID:"clock-location-reason",children:(0,B.jsxs)(c.default,{style:{gap:12},children:[(0,B.jsxs)(u.T,{children:["We check once that you are at ",h.name,", within about ",x.radius," m, when you clock in. Only pass or fail is saved, not your position. We never track you in the background."]}),(0,B.jsx)(u.T,{children:"If you refuse or are too far away, no clock-in is made. A manager can override it with a recorded reason."}),(0,B.jsx)(u.Button,{testID:"clock-location-continue",label:"Check my location and clock in",accessibilityLabel:"Check my location once and clock in at the pub",onPress:()=>{y(!1),ae('in')}}),(0,B.jsx)(u.Button,{testID:"clock-location-cancel",kind:"secondary",label:"Not now",onPress:()=>y(!1)})]})}),ee?(0,B.jsx)(W,{rid:m,today:t,now:e}):null,G?(0,B.jsx)(n.ShiftCheckout,{rid:m,shiftKey:G.id,day:G.date,meId:a,onClose:()=>X(null)}):null,(0,B.jsx)(u.Sheet,{visible:z,onClose:()=>H(!1),title:"Did you take a break? If so, how long?",children:(0,B.jsxs)(c.default,{testID:"forgot-break-prompt",style:{gap:10},children:[(0,B.jsx)(u.Muted,{children:"No break was recorded on this shift. Pick how long it was, or No break. Your manager can change it later in Hours."}),(0,B.jsx)(u.Row,{wrap:!0,gap:6,children:x.breakOptions.map(e=>(0,B.jsx)(u.Chip,{testID:`forgot-break-${e}`,label:(0,D.breakLabel)(e),disabled:e>=te,onPress:()=>{H(!1),ae('out',{addedBreak:e})}},e))}),(0,B.jsx)(u.Button,{testID:"forgot-break-none",kind:"secondary",label:"No break",onPress:()=>{H(!1),ae('out',{breakMins:0})}}),te>360?(0,B.jsx)(u.Muted,{children:"UK workers are generally entitled to a 20-minute rest break when working more than 6 hours."}):null,(0,B.jsx)(u.Muted,{children:j?'Clock-out and breaks do not use your location.':'Tip: your location is checked when you clock out, like clocking in.'})]})})]}):(0,B.jsx)(c.default,{style:{gap:10},children:(0,B.jsxs)(u.Card,{highlight:w.colours.gold,children:[(0,B.jsx)(u.T,{weight:"semibold",colour:w.colours.gold,children:"Before you clock in: location & your privacy"}),j?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(u.T,{size:14,children:["When you choose Clock in, we ask once for your phone\u2019s location to check you are at ",h.name,", within about ",x.radius," m."]}),(0,B.jsx)(u.T,{size:14,children:"Only pass or fail is kept with your clock-in time. Your map position, accuracy and distance are not saved. No location trails, background checks, clock-out checks or break checks."})]}):(0,B.jsxs)(B.Fragment,{children:[" ",(0,B.jsxs)(u.T,{size:14,children:["CoverCharge checks your phone\u2019s location ",(0,B.jsx)(u.T,{size:14,weight:"bold",children:"only at the moment you tap Clock in, Clock out, Start break or End break"}),", to confirm you are at ",h.name," (within about ",x.radius," m)."]}),(0,B.jsx)(u.T,{size:14,children:"\u2022 Your location is never tracked continuously or in the background."}),(0,B.jsx)(u.T,{size:14,children:"\u2022 With each clock record we keep that one reading (map position and how accurate the phone said it was), whether it was inside the area, and the time."}),(0,B.jsx)(u.T,{size:14,children:"\u2022 If the app is open while you\u2019re at the venue and you\u2019re not on the rota, it may ask whether you want to clock in (only if you have already allowed location)."})]}),(0,B.jsx)(u.T,{size:14,children:"\u2022 Your employer uses this for timesheets and pay (UK GDPR lawful basis: contract / legitimate interests)."}),(0,B.jsx)(u.T,{size:14,children:"\u2022 If your phone can\u2019t share its location, a manager can record it for you instead. You can see your own records anytime."}),(0,B.jsx)(u.T,{size:14,children:"\u2022 Records are kept for payroll (6 years, HMRC) and then deleted."}),(0,B.jsx)(u.Button,{label:"I understand \u2014 continue",onPress:()=>f.useOwner.getState().giveConsent(a,e.toISOString())})]})})},_e.Timesheets=function(){const{now:e,today:t,role:s,meId:n}=(0,C.useCtx)(3e4);return s!=='staff'?(0,B.jsx)(q,{now:e,today:t,meId:n}):(0,B.jsx)(_,{})};var t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),a=_r(_d[3]),o=_r(_d[4]),i=_r(_d[5]),l=_r(_d[6]),r=e(_r(_d[7])),d=e(_r(_d[8])),c=e(_r(_d[9])),u=_r(_d[10]),h=_r(_d[11]),f=_r(_d[12]),m=_r(_d[13]),p=_r(_d[14]),x=_r(_d[15]),j=_r(_d[16]),b=_r(_d[17]),w=_r(_d[18]),k=_r(_d[19]),y=_r(_d[20]),C=_r(_d[21]),S=_r(_d[22]),I=_r(_d[23]),v=_r(_d[24]),D=_r(_d[25]),T=_r(_d[26]),$=_r(_d[27]),M=_r(_d[28]),O=_r(_d[29]),R=_r(_d[30]),P=_r(_d[31]),B=_r(_d[32]);const z=2650,H=1900,A=e=>e.end-e.start,Y=e=>e>8?.5:e>6?.3333333333333333:0,L=e=>{const t=new Date(e);return t.setHours(0,0,0,0),t.setDate(t.getDate()-(0,C.weekday)(e)),t};function F(e){const{rid:t,r:s,now:n}=(0,C.useCtx)(6e4),a=(0,h.useBookings)(t),o=(0,h.useOrders)(t),i=(0,h.useEvents)(t),r=(0,O.useRealHistory)(t,n);return(0,l.useMemo)(()=>{const t=Array.from({length:7},(t,s)=>{const n=(0,b.addMins)(e,1440*s);return n.setHours(11,0,0,0),n}),n=a.filter(e=>!e.walkIn&&'confirmed'===e.status&&t.some(t=>(0,b.ymd)(t)===e.date)).reduce((e,t)=>e+t.partySize,0),l=(0,R.clampWeeks)(s.settings.forecastMinWeeks);return r?r.salesEnough?{mode:'real',weeks:l,booked:n,sales:t.map(e=>s.kitchenHours[e.getDay()]?r.takingsByDay[e.getDay()]??0:0)}:{mode:'none',weeks:l,booked:n,sales:t.map(()=>0)}:{mode:'example',weeks:l,booked:n,sales:t.map(e=>{const t=(0,x.forecastToday)(s,a,o,i,e);return t.open?t.restOfDay.covers*z+t.restOfDay.takeaway*H:0})}},[s,a,o,i,r,(0,b.ymd)(e)])}function N({init:e,onClose:t}){const s=(0,f.useOwner)(e=>e.staff),[n,a]=(0,l.useState)(e.shift?.start??12),[o,i]=(0,l.useState)(e.shift?.end??20),[r,d]=(0,l.useState)(e.shift?.breakAt),h=void 0===r||r>n&&rt.id===e.staffId);return(0,B.jsxs)(u.Sheet,{visible:!0,onClose:t,title:(0,P.shiftTitle)(m?.name??'',e.date),testID:"shift-sheet",children:[(0,B.jsx)(u.Row,{wrap:!0,gap:6,children:[['Lunch',11,16],['Dinner',16.5,22.5],['Double',11,21],['Close',17,23.5],['Late close',18,25]].map(([e,t,s])=>(0,B.jsx)(u.Chip,{label:`${e} ${(0,C.fmtH)(t)}\u2013${(0,C.fmtH)(s)}`,selected:n===t&&o===s,onPress:()=>{a(t),i(s)}},e))}),(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsx)(u.T,{children:"Start"}),(0,B.jsx)(u.Stepper,{testID:"shift-start",value:n,step:.5,min:P.SHIFT_MIN_START,max:o-1,onChange:a,format:C.fmtH,label:"Start time"})]}),(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,B.jsx)(u.T,{children:"End"}),(0,B.jsxs)(c.default,{style:{alignItems:'flex-end'},children:[(0,B.jsx)(u.Stepper,{testID:"shift-end",value:o,step:.5,min:n+1,max:P.SHIFT_MAX_END,onChange:i,format:C.fmtH,label:"End time"}),o>=24?(0,B.jsx)(u.Muted,{children:"next day"}):null]})]}),(0,B.jsxs)(u.Muted,{children:[(o-n).toFixed(1),"h scheduled",Y(o-n)?`, ${Math.round(60*Y(o-n))}m planned break`:'']}),(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,B.jsx)(u.T,{children:void 0===r?'Break: not set':'Break at'}),void 0===r?(0,B.jsx)(u.Chip,{label:"Set a break time",onPress:()=>d(Math.min(o-.5,Math.max(n+.5,Math.round(4*(n+Math.min(4,(o-n)/2)))/4)))}):(0,B.jsxs)(u.Row,{gap:6,children:[(0,B.jsx)(u.Stepper,{testID:"shift-break",value:r,step:.25,min:n+.25,max:o-.25,onChange:d,format:C.fmtH,label:"Break time"}),(0,B.jsx)(u.Chip,{label:"No set time",onPress:()=>d(void 0)})]})]}),(0,B.jsx)(u.Muted,{children:"Tip: with a break time, the person on this shift gets a break reminder at that time. Without one, they get it 4 hours after clocking in (change this in Settings, Advanced, Reminders)."}),(0,B.jsx)(u.Button,{label:e.shift?'Save shift':'Add shift',onPress:()=>{const s=f.useOwner.getState();e.shift?s.setShifts(s.shifts.map(t=>t.id===e.shift.id?{...t,start:n,end:o,breakAt:h?r:void 0,changed:!!t.published||t.changed}:t)):s.addShift({staffId:e.staffId,date:e.date,start:n,end:o,...void 0!==r&&h?{breakAt:r}:{}}),t()}}),(0,B.jsx)(u.Muted,{children:e.shift?.published?'Published: the change shows in the Staff app straight away and is marked as changed until you publish the week again.':'Draft: staff see it once you publish the week.'}),e.shift?(0,B.jsx)(u.Button,{kind:"danger",label:"Remove shift",onPress:()=>{f.useOwner.getState().removeShift(e.shift.id),t()}}):null]})}function W({rid:e,today:t,now:s}){const n=(0,f.useOwner)(e=>e.staff).filter(e=>e.active),a=(0,f.useOwner)(e=>e.attendance),o=(0,C.useSignedIn)(),{me:i,meId:r}=(0,C.useCtx)(3e4),[d,c]=(0,l.useState)(null),[h,m]=(0,l.useState)(''),[p,x]=(0,l.useState)(null),j=d?a.filter(e=>e.staffId===d&&e.in&&!e.out&&s.getTime()-new Date(e.in).getTime()<72e6)[0]:void 0,b=!!j&&(0,f.isOnBreak)(j),k=s=>{if(!d)return;const a=(0,T.managerClockAction)(s,{rid:e,staffId:d,date:t,at:(new Date).toISOString()},{id:o?.id??r,name:o?.name??i},h);if(!a.ok)return void x(a.message);const l=n.find(e=>e.id===d)?.name??'them';(0,$.notify)({id:'mgr-clock',title:`Recorded for ${l}`,body:`Reason kept with the record: ${h.trim()}`,timeoutMs:6e3}),m(''),x(null)};return(0,B.jsxs)(u.Card,{children:[(0,B.jsx)(u.T,{weight:"semibold",children:"Record it for someone"}),(0,B.jsx)(u.Muted,{children:"If someone\u2019s phone can\u2019t share its location, you can clock them in or out, or start or end their break. No location check; your reason is kept with the record."}),(0,B.jsx)(u.Row,{wrap:!0,gap:6,children:n.map(e=>(0,B.jsx)(u.Chip,{label:e.name,selected:d===e.id,onPress:()=>c(e.id)},e.id))}),d?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(u.Field,{label:"Reason (kept with the record)",value:h,onChangeText:m,placeholder:"e.g. Phone out of battery"}),(0,B.jsx)(u.Row,{wrap:!0,gap:6,children:j?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(u.Button,{kind:"secondary",label:b?'End their break':'Start their break',onPress:()=>k(b?'break_end':'break_start')}),(0,B.jsx)(u.Button,{kind:"secondary",label:"Clock them out",onPress:()=>k('out')})]}):(0,B.jsx)(u.Button,{testID:"mgr-clock-in",kind:"secondary",label:"Clock them in",onPress:()=>k('in')})}),p?(0,B.jsx)(u.T,{size:13,colour:w.colours.red,children:p}):null]}):null]})}function E({onClose:e}){const{now:t,today:s,meId:n}=(0,C.useCtx)(3e4),a=(0,f.useOwner)(e=>e.attendance),o=(0,f.useOwner)(e=>e.shifts),i=Array.from({length:7},(e,t)=>(0,b.ymd)((0,b.addMins)((0,b.parseYmd)(s),1440*-t))),[r,d]=(0,l.useState)(s),c=a.filter(e=>e.staffId===n&&e.date===r&&e.in).sort((e,t)=>t.in.localeCompare(e.in))[0],h=(0,f.visibleShifts)(o,!1).find(e=>e.staffId===n&&e.date===r),[p,x]=(0,l.useState)(c&&!c.out?'out':'in'),[j,k]=(0,l.useState)(h?Math.round(60*h.start):720),[y,S]=(0,l.useState)(h?Math.round(60*h.end):1200),[I,v]=(0,l.useState)(''),[D,T]=(0,l.useState)(!1),$=e=>`${String(Math.floor(e%1440/60)).padStart(2,'0')}:${String(e%60).padStart(2,'0')}`,M='out'!==p,O='in'!==p,R=M&&O&&y<=j,P=(e,t)=>(0,B.jsx)(u.Row,{gap:4,children:[-15,-5,5,15].map(s=>(0,B.jsx)(u.Button,{small:!0,kind:"ghost",label:s>0?`+${s}`:`${s}`,onPress:()=>e(Math.max(0,Math.min(2160,t+s)))},s))});return D?(0,B.jsxs)(u.Sheet,{visible:!0,onClose:e,title:"Request sent",children:[(0,B.jsx)(u.Banner,{kind:"success",title:"Sent to your manager",children:"They\u2019ll see it on the sign-off screen and fix the time. You\u2019ll see the change on your timesheet. Nothing is sent by text or email."}),(0,B.jsx)(u.Button,{label:"Done",onPress:e})]}):(0,B.jsxs)(u.Sheet,{visible:!0,onClose:e,title:"I forgot to clock in or out",testID:"request-sheet",children:[(0,B.jsx)(u.Muted,{children:"Pick the day and suggest the right time. Your manager checks it before it counts."}),(0,B.jsx)(u.Row,{wrap:!0,gap:6,children:i.map(e=>(0,B.jsx)(u.Chip,{label:e===s?'Today':(0,b.niceDate)((0,b.parseYmd)(e)).slice(0,10),selected:r===e,onPress:()=>d(e)},e))}),(0,B.jsxs)(u.Muted,{children:[h?`Your rota that day: ${(0,C.fmtH)(h.start)}\u2013${(0,C.fmtH)(h.end)}`:'Not on the rota that day',c?` \xb7 clocked ${(0,b.hm)(new Date(c.in))}\u2013${c.out?(0,b.hm)(new Date(c.out)):'no clock-out'}`:' \xb7 no clock record']}),(0,B.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,B.jsx)(u.Chip,{label:"Forgot to clock in",selected:'in'===p,onPress:()=>x('in')}),(0,B.jsx)(u.Chip,{label:"Forgot to clock out",selected:'out'===p,onPress:()=>x('out')}),(0,B.jsx)(u.Chip,{label:"Forgot both",selected:'both'===p,onPress:()=>x('both')})]}),M?(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsxs)(u.T,{size:18,weight:"bold",children:["In ",$(j)]}),P(k,j)]}):null,O?(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsxs)(u.T,{size:18,weight:"bold",children:["Out ",$(y),y>=1440?' (next day)':'']}),P(S,y)]}):null,R?(0,B.jsx)(u.T,{size:13,colour:w.colours.red,children:"Clock-out must be after clock-in."}):null,(0,B.jsx)(u.Field,{label:"Note for your manager (optional)",value:I,onChangeText:v,placeholder:"e.g. phone died",maxLength:200}),(0,B.jsx)(u.Button,{testID:"request-send",kind:"success",label:"Send to my manager",disabled:R,onPress:()=>{f.useOwner.getState().addTimeRequest({staffId:n,date:r,attendanceId:c?.id,kind:p,suggestedIn:M?(0,m.isoAt)(r,j):void 0,suggestedOut:O?(0,m.isoAt)(r,y):void 0,note:I.trim(),at:t.toISOString()}),T(!0)}})]})}function _(){const{now:e,today:t,meId:s}=(0,C.useCtx)(3e4),n=(0,f.useOwner)(e=>e.attendance),a=(0,f.useOwner)(e=>e.shifts),o=(0,f.useOwner)(e=>e.timeRequests),[i,r]=(0,l.useState)(!1),[d,h]=(0,l.useState)(null),p=(0,b.ymd)(L(e)),x=n.filter(e=>e.staffId===s&&e.in&&e.date>=(0,b.ymd)((0,b.addMins)((0,b.parseYmd)(t),-38880))).sort((e,t)=>t.date.localeCompare(e.date)||t.in.localeCompare(e.in)),j=x.filter(e=>e.date>=p),y=j.filter(f.isConfirmed).reduce((t,s)=>t+(0,C.paidMins)(s,e).paid,0),S=j.filter(e=>!(0,f.isConfirmed)(e)).reduce((t,s)=>t+(0,C.paidMins)(s,e).paid,0),I=o.filter(e=>e.staffId===s).sort((e,t)=>t.at.localeCompare(e.at)).slice(0,6);return(0,B.jsxs)(c.default,{style:{gap:10},testID:"my-timesheet",children:[(0,B.jsxs)(u.Card,{children:[(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between',alignItems:'flex-end'},children:[(0,B.jsxs)(c.default,{children:[(0,B.jsx)(u.T,{size:12,colour:w.colours.muted,children:"CONFIRMED THIS WEEK"}),(0,B.jsx)(u.T,{size:28,weight:"bold",colour:w.colours.ok,children:(0,C.hmDur)(y)})]}),(0,B.jsxs)(c.default,{style:{alignItems:'flex-end'},children:[(0,B.jsx)(u.T,{size:12,colour:w.colours.muted,children:"PENDING SIGN-OFF"}),(0,B.jsx)(u.T,{size:18,weight:"semibold",colour:S?w.colours.amber:w.colours.muted,children:(0,C.hmDur)(S)})]})]}),(0,B.jsx)(u.Muted,{children:"Your manager signs off your hours. Only confirmed hours count for pay. You can\u2019t change your own times; ask for a correction instead."})]}),(0,B.jsx)(u.Button,{testID:"forgot-clock",kind:"secondary",label:"I forgot to clock in or out",onPress:()=>r(!0)}),I.length?(0,B.jsx)(k.SectionHead,{title:"My correction requests"}):null,I.map(e=>(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between',paddingVertical:4},children:[(0,B.jsxs)(c.default,{style:{flex:1},children:[(0,B.jsxs)(u.T,{size:14,children:[(0,b.niceDate)((0,b.parseYmd)(e.date))," \xb7 ",'in'===e.kind?'Forgot to clock in':'out'===e.kind?'Forgot to clock out':'Forgot both']}),(0,B.jsxs)(u.Muted,{children:[e.suggestedIn?`in ${(0,b.hm)(new Date(e.suggestedIn))} `:'',e.suggestedOut?`out ${(0,b.hm)(new Date(e.suggestedOut))}`:'',e.resolvedBy?` \xb7 ${'applied'===e.status?'applied':'declined'} by ${e.resolvedBy.replace(' (example)','')}`:'']})]}),(0,B.jsx)(u.Badge,{kind:'open'===e.status?'blue':'applied'===e.status?'ok':'neutral',label:'open'===e.status?'Waiting':'applied'===e.status?'Applied':'Declined'})]},e.id)),(0,B.jsx)(k.SectionHead,{title:"My shifts",sub:"Last 4 weeks"}),x.map(t=>{const s=(0,f.shiftOf)((0,f.visibleShifts)(a,!1),t.staffId,t.date),n=(0,C.paidMins)(t,e),o=t.audit?.filter(e=>'confirmed'!==e.action).slice(-1)[0];return(0,B.jsxs)(u.Card,{onPress:()=>h(d===t.id?null:t.id),children:[(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsxs)(c.default,{style:{flex:1},children:[(0,B.jsx)(u.T,{weight:"semibold",children:(0,b.niceDate)((0,b.parseYmd)(t.date))}),(0,B.jsxs)(u.Muted,{children:[(0,b.hm)(new Date(t.in)),"\u2013",t.out?(0,b.hm)(new Date(t.out)):'on now',t.out?` \xb7 ${n.brk}m break \xb7 ${(0,C.hmDur)(n.paid)} paid`:'',s?` \xb7 rota ${(0,C.fmtH)(s.start)}\u2013${(0,C.fmtH)(s.end)}`:'']})]}),(0,B.jsx)(u.Badge,{kind:(0,m.statusKind)(t),label:'awaiting'===(0,f.attStatus)(t)?t.adjusted?'Adjusted \xb7 pending':'Pending':(0,m.statusLabel)(t)})]}),o?(0,B.jsxs)(u.T,{size:13,colour:w.colours.gold,children:["Adjusted by ",o.by.replace(' (example)',''),o.reason?`: ${o.reason}`:'']}):null,t.signOff?(0,B.jsxs)(u.Muted,{children:["Confirmed by ",t.signOff.by.replace(' (example)','')]}):null,d===t.id?(0,B.jsx)(m.AuditTrail,{a:t}):null]},t.id)}),x.length?null:(0,B.jsx)(u.Muted,{children:"No clocked shifts yet."}),i?(0,B.jsx)(E,{onClose:()=>r(!1)}):null]})}function q({now:e,today:s}){const n=(0,f.useOwner)(e=>e.staff),o=(0,f.useOwner)(e=>e.shifts),i=(0,C.useHourly)(),d=(0,f.useOwner)(e=>e.attendance),h=(0,f.useOwner)(e=>e.timeRequests),p=(0,f.useOwner)(e=>e.attLog),[x,y]=(0,l.useState)(s),[I,v]=(0,l.useState)(null),[D,T]=(0,l.useState)(!1),$=!!(0,C.useSignedIn)(),M=Array.from({length:7},(e,t)=>(0,b.ymd)((0,b.addMins)((0,b.parseYmd)(s),1440*-t))),O=d.filter(e=>e.date===x&&e.in),R=o.filter(e=>e.date===x&&!1!==e.published).filter(e=>!O.some(t=>t.staffId===e.staffId)),P=d.filter(e=>M.includes(e.date)&&e.out),z=P.filter(f.isConfirmed),H=z.reduce((t,s)=>t+(0,C.paidMins)(s,e).paid,0),A=P.filter(e=>!(0,f.isConfirmed)(e)).reduce((t,s)=>t+(0,C.paidMins)(s,e).paid,0),Y=z.reduce((t,s)=>t+(0,C.paidMins)(s,e).paid/60*(i[s.staffId]??0),0),L=['Staff,Date,Rostered,In,Out,Break (min),Paid hours,Rate,Pay,Status,Confirmed by,Tax note'].concat(z.sort((e,t)=>e.date.localeCompare(t.date)).map(t=>{const s=n.find(e=>e.id===t.staffId),a=(0,f.shiftOf)(o,t.staffId,t.date),l=(0,C.paidMins)(t,e),r=i[t.staffId]??0;return`${s?.name},${t.date},${a?`${(0,C.fmtH)(a.start)}-${(0,C.fmtH)(a.end)}`:'-'},${(0,b.hm)(new Date(t.in))},${(0,b.hm)(new Date(t.out))},${l.brk},${(l.paid/60).toFixed(2)},${(r/100).toFixed(2)},${(l.paid/60*r/100).toFixed(2)},${t.adjusted?'Confirmed (adjusted)':'Confirmed'},${t.signOff?.by??''},${s?.salaried?'Owner, no hourly wage':null==i[t.staffId]?'Rate not set':s?.noTax&&$?'No tax deducted':''}`}));return(0,B.jsxs)(c.default,{style:{gap:10},children:[(0,B.jsx)(u.Row,{wrap:!0,gap:6,children:M.map(e=>(0,B.jsx)(u.Chip,{label:e===s?'Today':(0,b.niceDate)((0,b.parseYmd)(e)).slice(0,6),selected:x===e,onPress:()=>y(e)},e))}),(0,B.jsxs)(u.Card,{children:[(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsx)(u.T,{weight:"semibold",children:"Last 7 days"}),(0,B.jsx)(u.Badge,{kind:"ok",label:`${(0,C.hmDur)(H)} confirmed`})]}),A?(0,B.jsxs)(u.T,{size:13,colour:w.colours.amber,children:[(0,C.hmDur)(A)," pending sign-off (not counted yet)"]}):null,(0,B.jsxs)(u.Muted,{children:["Labour cost ",(0,j.gbp)(Math.round(Y))," from confirmed hours (paid hours \xd7 hourly rates; owner salaries excluded). Sign off in Team \u203a Sign off hours."]})]}),(0,B.jsx)(a.WideTable,{children:(0,B.jsxs)(c.default,{style:{gap:2},children:[(0,B.jsx)(a.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:w.colours.border,paddingBottom:4},children:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''].map((e,t)=>(0,B.jsx)(u.T,{size:12,weight:"semibold",colour:w.colours.gold,style:{width:[110,86,52,52,52,74,120,140,50][t]},children:e},e+t))}),O.map(t=>{const i=n.find(e=>e.id===t.staffId),l=(0,f.shiftOf)(o,t.staffId,x),d=(0,C.paidMins)(t,e),c=(0,m.flagsFor)(t,l,e,s,h).map(e=>e.label);return(0,B.jsxs)(a.TRow,{heads:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,B.jsxs)(u.Row,{gap:4,style:{width:110},children:[(0,B.jsx)(S.StaffAvatar,{id:t.staffId,size:20,ring:!1}),(0,B.jsx)(u.T,{size:12,style:{flex:1},numberOfLines:1,children:i?.name.replace(' (example)','')})]}),(0,B.jsx)(u.T,{size:12,style:{width:86},colour:w.colours.muted,children:l?`${(0,C.fmtH)(l.start)}\u2013${(0,C.fmtH)(l.end)}`:'\u2013'}),(0,B.jsx)(u.T,{size:12,style:{width:52},children:(0,b.hm)(new Date(t.in))}),(0,B.jsx)(u.T,{size:12,style:{width:52},children:t.out?(0,b.hm)(new Date(t.out)):'on'}),(0,B.jsx)(u.T,{size:12,style:{width:52},children:t.out?`${d.brk}m`:'\u2013'}),(0,B.jsx)(u.T,{size:12,weight:"semibold",style:{width:74},children:t.out?(0,C.hmDur)(d.paid):`${(0,C.hmDur)(d.worked)}\u2026`}),(0,B.jsx)(u.T,{size:11,style:{width:120},colour:'confirmed'===(0,f.attStatus)(t)?w.colours.ok:'open'===(0,f.attStatus)(t)?w.colours.blue:w.colours.amber,children:(0,m.statusLabel)(t)}),(0,B.jsx)(u.T,{size:11,style:{width:140},colour:c.length?w.colours.amber:w.colours.ok,children:c.join(', ')||'OK'}),(0,B.jsx)(r.default,{accessibilityRole:"button",accessibilityLabel:`Edit ${i?.name}`,onPress:()=>v(t),style:{width:50,minHeight:44,justifyContent:'center'},children:(0,B.jsx)(u.T,{size:12,colour:w.colours.gold,children:"Edit"})})]},t.id)}),R.map(t=>(0,B.jsxs)(a.TRow,{heads:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''],style:{paddingVertical:6},children:[(0,B.jsx)(u.T,{size:12,style:{width:110},children:n.find(e=>e.id===t.staffId)?.name.replace(' (example)','')}),(0,B.jsxs)(u.T,{size:12,style:{width:86},colour:w.colours.muted,children:[(0,C.fmtH)(t.start),"\u2013",(0,C.fmtH)(t.end)]}),(0,B.jsx)(u.T,{size:12,colour:x===s&&60*t.start>60*e.getHours()+e.getMinutes()?w.colours.muted:w.colours.red,children:x===s&&60*t.start>60*e.getHours()+e.getMinutes()?'Not started yet':'No clock-in'})]},t.id))]})}),O.length||R.length?null:(0,B.jsx)(u.Muted,{children:"No shifts or clock records for this day."}),(0,B.jsx)(u.Muted,{children:"Paid hours = (clock-out \u2212 clock-in) \u2212 break. Only confirmed hours count for pay, tips and the export."}),(0,B.jsx)(u.Button,{kind:"secondary",label:"Payroll export (CSV preview)",onPress:()=>T(!0)}),(0,B.jsx)(k.SectionHead,{title:"Audit log",sub:"Every manual change and sign-off"}),p.length?p.slice(0,12).map(e=>(0,B.jsxs)(u.Muted,{children:[(0,b.niceDate)(new Date(e.at))," ",(0,b.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,B.jsx)(u.Muted,{children:"No manual changes yet."}),I?(0,B.jsx)(m.OverrideSheet,{a:I,staffId:I.staffId,date:I.date,onClose:()=>v(null)}):null,(0,B.jsxs)(u.Sheet,{visible:D,onClose:()=>T(!1),title:"Payroll export",children:[(0,B.jsxs)(u.Banner,{kind:"demo",title:"Preview: nothing is sent",children:["Confirmed hours only. ",A?`${(0,C.hmDur)(A)} still pending sign-off is left out.`:'']}),(0,B.jsxs)(c.default,{style:{backgroundColor:(0,t.soutersSurface)('#111'),borderRadius:8,padding:8},children:[L.slice(0,14).map((e,t)=>(0,B.jsx)(u.T,{size:10,colour:t?w.colours.text:w.colours.gold,children:e},t)),L.length>14?(0,B.jsxs)(u.Muted,{children:["\u2026 ",L.length-14," more rows"]}):null]}),(0,B.jsxs)(u.Muted,{children:[L.length-1," confirmed rows \xb7 paid hours (after breaks)."]})]})]})}},1010,[868,877,999,1338,1151,1152,30,263,151,127,813,819,856,1342,1030,870,816,818,821,1019,1000,927,953,1207,989,954,1103,947,1290,1305,1303,1031,24]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"category",{enumerable:!0,get:function(){return C}}),_e.allocate=S,_e.Tips=function({go:e}={}){const{rid:w,now:M,today:v,role:$,meId:P,me:B}=(0,x.useCtx)(6e4),I=(0,a.useOwner)(e=>e.staff),R=(0,a.useOwner)(e=>e.attendance),A=(0,a.useOwner)(e=>e.shifts),F=(0,a.useOwner)(e=>e.tronc),D=(0,a.useOwner)(e=>e.troncCash),E=(0,a.useOwner)(e=>e.troncHistory),z=(0,a.useOwner)(e=>e.troncLog),L=(0,d.useOrders)(w),q=(0,f.useVenuePay)(w).pay,[V,N]=(0,n.useState)(-1),[H,_]=(0,n.useState)(''),[Y,K]=(0,n.useState)(!1),[W,U]=(0,n.useState)(!1),[G,Q]=(0,n.useState)(F.text),[J,X]=(0,n.useState)(null),Z='staff'!==$,ee='owner'===$,{s:te,e:se,key:oe}=(0,f.venueRange)(q,'tips',V,M),ne=`${(0,u.niceDate)(te)} \u2013 ${(0,u.niceDate)(se)} ${se.getFullYear()}`,ie=E.find(e=>e.key===oe),re=e=>a.useOwner.getState().setOwner({tronc:{...F,...e}}),le=(0,j.useSync)(e=>!!e.venueId&&'guest'!==e.kind),de=Math.round((se.getTime()-te.getTime())/864e5)+1,ae=(0,n.useMemo)(()=>{let e=L.filter(e=>e.createdAt.slice(0,10)>=(0,u.ymd)(te)&&e.createdAt.slice(0,10)<=(0,u.ymd)(se)).reduce((e,t)=>e+(t.tip??0),0);if(!o.LIVE_VENUE_BUILD&&!le)for(let t=0;tM)break;const o=(0,x.weekday)(s);0!==o&&1!==o&&(e+=Math.round(6e3+9e3*(0,y.hash)((0,u.ymd)(s)+'tip')))}return e},[oe,L.length,le]),ce=D[oe]??0,ue=ie?ie.pot:ae+ce,he=(0,n.useMemo)(()=>{const e={};for(let t=0;tv)break;const o=(0,u.ymd)(s);I.forEach(t=>{const s=R.filter(e=>e.staffId===t.id&&e.date===o&&e.out),n=s.filter(a.isConfirmed).reduce((e,t)=>e+(0,x.paidMins)(t,M).paid,0),i=s.filter(e=>!(0,a.isConfirmed)(e)).reduce((e,t)=>e+(0,x.paidMins)(t,M).paid,0);(n||i)&&(e[t.id]={paid:(e[t.id]?.paid??0)+n,est:(e[t.id]?.est??!1)||i>0})})}return e},[oe,R.length,A.length,I.length]),pe=I.filter(e=>e.active&&('staff'===e.role||'manager'===e.role&&F.includeManagers||'owner'===e.role&&F.includeOwner)),me=(0,n.useMemo)(()=>{if(ie)return ie.rows;const e=pe.map(e=>{const t=(he[e.id]?.paid??0)/60,s=F.points[C(e)]??1;return'hours'===F.method?t:'points'===F.method?t*s:'equal'===F.method?t>0?1:0:F.custom[e.id]??0}),{amounts:t}=S(ue,e),s=e.reduce((e,t)=>e+t,0);return pe.map((o,n)=>({staffId:o.id,hours:(he[o.id]?.paid??0)/60,points:F.points[C(o)]??1,pct:s?e[n]/s*100:0,amount:t[n]}))},[ie,pe.map(e=>e.id).join(),he,F,ue]),ge=me.reduce((e,t)=>e+t.amount,0),xe=ie?0:(()=>{const e=me.map(e=>e.pct);return S(ue,e).remainder})(),fe=Object.entries(F.custom).filter(([e])=>pe.some(t=>t.id===e)).reduce((e,[,t])=>e+t,0),ye='custom'===F.method&&Math.abs(fe-100)>.01,je=new Date(se.getFullYear(),se.getMonth()+2,0),we=[...E].sort((e,t)=>t.end.localeCompare(e.end))[0],be=0!==E.length&&(0,u.parseYmd)(we.end)<(0,u.addMins)(M,-89280),Te=['Staff,Category,Paid hours,Points,Share %,Amount \xa3'].concat(me.map(e=>{const t=I.find(t=>t.id===e.staffId);return`${k(t.name)},${C(t)},${e.hours.toFixed(2)},${e.points},${e.pct.toFixed(2)},${(e.amount/100).toFixed(2)}`}),[`TOTAL,,,,100.00,${(ge/100).toFixed(2)}`]);return Z?(0,b.jsxs)(r.default,{style:{gap:10},children:[(0,b.jsxs)(l.Card,{highlight:h.colours.gold,children:[(0,b.jsx)(l.T,{weight:"semibold",children:"Quick split: Tips day"}),(0,b.jsx)(l.Muted,{children:"Enter the total and it's shared by confirmed hours for the fortnight, to the penny. Tips periods follow your pay dates (Settings \u203a Pay & tips)."}),(0,b.jsxs)(l.Row,{wrap:!0,gap:6,children:[(0,b.jsx)(l.Button,{small:!0,kind:"success",label:"Open Tips day",onPress:()=>e?.('more','tipsday')}),(0,b.jsx)(l.Button,{small:!0,kind:"ghost",label:"Pay & tips settings",onPress:()=>e?.('more','paysettings')})]})]}),(0,b.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(l.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",onPress:()=>N(V-1)}),(0,b.jsxs)(r.default,{style:{alignItems:'center',flex:1},children:[(0,b.jsx)(l.T,{weight:"semibold",children:ne}),ie?(0,b.jsx)(l.Badge,{kind:"ok",label:`Approved & locked ${ie.lockedAt}`}):V>=0?(0,b.jsx)(l.Badge,{kind:"amber",label:"Period in progress"}):(0,b.jsx)(l.Badge,{kind:"neutral",label:"Not yet approved"})]}),(0,b.jsx)(l.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:V>=0,onPress:()=>N(V+1)})]}),(0,b.jsxs)(l.Card,{children:[(0,b.jsx)(l.T,{weight:"semibold",children:"Tip pot"}),(0,b.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(l.T,{children:"Card tips on orders"}),(0,b.jsx)(l.T,{children:(0,c.gbp)(ie?ie.card:ae)})]}),(0,b.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(l.T,{children:"Cash tips"}),(0,b.jsx)(l.T,{children:(0,c.gbp)(ie?ie.cash:ce)})]}),ie?null:(0,b.jsxs)(l.Row,{gap:6,children:[(0,b.jsx)(s.TextInput,{accessibilityLabel:"Cash tips \xa3",placeholder:"Cash tips \xa3",placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",value:H,onChangeText:_,style:[l.styles.input,{flex:1}]}),(0,b.jsx)(l.Button,{small:!0,kind:"secondary",label:"Set cash",disabled:!(Number(H)>=0)||''===H.trim(),onPress:()=>{a.useOwner.getState().setOwner({troncCash:{...D,[oe]:Math.round(100*Number(H))}}),_('')}})]}),(0,b.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(l.T,{weight:"bold",children:"Total pot"}),(0,b.jsx)(l.T,{size:20,weight:"bold",colour:h.colours.gold,children:(0,c.gbp)(ue)})]}),(0,b.jsx)(l.Muted,{children:le?'Card tips are the tips taken on orders in CoverCharge. Add cash tips above.':'Card tips are the tips on orders saved on this device (not connected to your venue yet).'})]}),ie?(0,b.jsxs)(l.Muted,{children:["Locked with method: ",T[ie.method],"."]}):(0,b.jsxs)(l.Card,{children:[(0,b.jsx)(l.T,{weight:"semibold",children:"Split method (venue policy)"}),(0,b.jsx)(l.Row,{wrap:!0,gap:6,children:Object.keys(T).map(e=>(0,b.jsx)(l.Chip,{label:T[e],selected:F.method===e,onPress:()=>ee&&re({method:e})},e))}),ee?null:(0,b.jsx)(l.Muted,{children:"Only the owner can change the policy."}),'points'===F.method?Object.entries(F.points).map(([e,t])=>(0,b.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(l.T,{children:e}),(0,b.jsx)(l.Row,{gap:6,children:(0,b.jsx)(l.Stepper,{value:t,step:.1,min:0,max:2,onChange:t=>ee&&re({points:{...F.points,[e]:Math.round(10*t)/10}}),format:e=>e.toFixed(1),label:`${e} points`})})]},e)):null,'custom'===F.method?(0,b.jsxs)(b.Fragment,{children:[pe.map(e=>(0,b.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(l.T,{style:{flex:1},children:k(e.name)}),(0,b.jsx)(s.TextInput,{accessibilityLabel:`${e.name} percent`,keyboardType:"decimal-pad",defaultValue:String(F.custom[e.id]??''),placeholder:"%",placeholderTextColor:"#7D776C",onEndEditing:t=>re({custom:{...F.custom,[e.id]:Number(t.nativeEvent.text)||0}}),onBlur:t=>{const s=Number(t?.target?.value??t?.nativeEvent?.text);Number.isFinite(s)&&re({custom:{...a.useOwner.getState().tronc.custom,[e.id]:s}})},style:[l.styles.input,{width:80,paddingVertical:4}]})]},e.id)),(0,b.jsxs)(l.T,{size:13,colour:ye?h.colours.red:h.colours.ok,children:["Total ",fe.toFixed(1),"%",ye?' (must be 100%)':' \u2713']})]}):null,(0,b.jsx)(l.Toggle,{label:"Include managers",value:F.includeManagers,onChange:e=>ee&&re({includeManagers:e})}),(0,b.jsx)(l.Toggle,{label:"Include owner",value:F.includeOwner,onChange:e=>ee&&re({includeOwner:e})}),F.includeOwner?(0,b.jsx)(l.Banner,{kind:"warn",title:"Owner included",children:"Employers must not keep tips. An owner may only share in tips for qualifying work they personally do; check the statutory Code of Practice before including yourself."}):null]}),(0,b.jsx)(i.default,{horizontal:!0,children:(0,b.jsxs)(r.default,{children:[(0,b.jsx)(l.Row,{gap:0,style:{borderBottomWidth:1,borderColor:h.colours.border,paddingBottom:4},children:['Staff','Paid hrs','Points','Share','Amount'].map((e,t)=>(0,b.jsx)(l.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{width:[130,70,54,64,80][t]},children:e},e))}),me.map(e=>{const t=I.find(t=>t.id===e.staffId);return(0,b.jsxs)(l.Row,{gap:0,style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,b.jsxs)(l.T,{size:13,style:{width:130},numberOfLines:1,children:[k(t?.name),he[e.staffId]?.est&&!ie?'*':'']}),(0,b.jsx)(l.T,{size:13,style:{width:70},children:e.hours.toFixed(2)}),(0,b.jsx)(l.T,{size:13,style:{width:54},children:'points'===F.method||'points'===ie?.method?e.points.toFixed(1):'\u2013'}),(0,b.jsxs)(l.T,{size:13,style:{width:64},children:[e.pct.toFixed(1),"%"]}),(0,b.jsx)(l.T,{size:13,weight:"semibold",style:{width:80},children:(0,c.gbp)(e.amount)})]},e.staffId)}),(0,b.jsxs)(l.Row,{gap:0,style:{paddingVertical:6},children:[(0,b.jsx)(l.T,{size:13,weight:"bold",style:{width:318},children:"Total"}),(0,b.jsx)(l.T,{size:13,weight:"bold",colour:ge===ue?h.colours.ok:h.colours.red,style:{width:80},children:(0,c.gbp)(ge)})]})]})}),(0,b.jsxs)(l.Muted,{children:[ge===ue?`\u2713 Total equals the pot (${(0,c.gbp)(ue)}).`:'\u2717 Total does not equal the pot.',xe?` Rounding: ${xe}p left after rounding down went to the largest fractions, 1p each.`:''," * has hours still awaiting sign-off, which don\u2019t count until a manager confirms them. Paid hours already exclude breaks."]}),ie?null:(0,b.jsx)(l.Button,{label:"Approve & lock period",disabled:!ee||V>=0||ye||ge!==ue||ue<=0,onPress:()=>{const e=`${(0,u.niceDate)(M)} ${M.toTimeString().slice(0,5)}`,t={id:`tp-${oe}`,key:oe,label:ne,end:(0,u.ymd)(se),pot:ue,card:ae,cash:ce,method:F.method,rows:me,lockedAt:e,by:B};a.useOwner.getState().setOwner({troncHistory:[t,...E],troncLog:[{id:`tl-${Date.now()}`,at:M.toISOString(),text:`${B} approved & locked tips for ${ne}: ${(0,c.gbp)(ue)} split ${T[F.method].toLowerCase()} between ${me.filter(e=>e.amount>0).length} staff`},...z]})}}),!ie&&V>=0?(0,b.jsx)(l.Muted,{center:!0,children:"The current period can be approved once it has ended."}):null,ee||ie?null:(0,b.jsx)(l.Muted,{center:!0,children:"Only the owner can approve tips."}),(0,b.jsxs)(l.Row,{wrap:!0,gap:6,children:[(0,b.jsx)(l.Button,{small:!0,kind:"secondary",label:"Export CSV / PDF summary",onPress:()=>K(!0)}),ie?(0,b.jsx)(l.Button,{small:!0,kind:"secondary",label:ie.shared?'Shared \u2713':'Share with staff (chat)',disabled:!!ie.shared,onPress:()=>{(0,p.autoPost)('all',`Tips for ${ne} approved: ${(0,c.gbp)(ie.pot)} shared between ${ie.rows.filter(e=>e.amount>0).length} staff. See your own share in Team \u203a Tips.`),a.useOwner.getState().setOwner({troncHistory:E.map(e=>e.id===ie.id?{...e,shared:(0,u.niceDate)(M)}:e)}),X('Posted to All staff chat. Demo, nothing is sent.')}}):null]}),J?(0,b.jsx)(l.Banner,{kind:"demo",title:J}):null,(0,b.jsx)(m.SectionHead,{title:"Compliance checklist",sub:"Employment (Allocation of Tips) Act 2023, in force since 1 Oct 2024. Summary only, not legal advice."}),(0,b.jsxs)(l.Card,{children:[[[!0,'100% of qualifying tips passed to workers, no deductions',`Pot ${(0,c.gbp)(ue)} = allocated ${(0,c.gbp)(ge)}`],[F.text.trim().length>40,'Written tipping policy, available to staff','Stored in the app (template below)'],[!be,'Tips allocated by the end of the following month',`This period: by ${(0,u.niceDate)(je)} ${je.getFullYear()}`],[!0,'Tip records kept for 3 years',`${E.length} approved period(s) in the history`],[!0,'Staff can request their tip records',`${z.filter(e=>/requested/.test(e.text)).length} request(s) logged`]].map(([e,t,s])=>(0,b.jsxs)(l.Row,{style:{alignItems:'flex-start'},children:[(0,b.jsx)(l.T,{colour:e?h.colours.ok:h.colours.red,children:e?'\u2713':'\u2717'}),(0,b.jsxs)(r.default,{style:{flex:1},children:[(0,b.jsx)(l.T,{size:14,children:t}),(0,b.jsx)(l.Muted,{children:s})]})]},String(t))),(0,b.jsx)(l.Button,{small:!0,kind:"ghost",label:"View / edit tipping policy",onPress:()=>{Q(F.text),U(!0)}})]}),(0,b.jsx)(m.SectionHead,{title:"Tip history & audit log"}),E.map(e=>(0,b.jsxs)(l.Card,{children:[(0,b.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(l.T,{weight:"semibold",children:e.label}),(0,b.jsx)(l.T,{weight:"bold",children:(0,c.gbp)(e.pot)})]}),(0,b.jsxs)(l.Muted,{children:[T[e.method]," \xb7 ",e.rows.filter(e=>e.amount>0).length," staff \xb7 locked ",e.lockedAt," by ",e.by,e.shared?` \xb7 shared ${e.shared}`:'']})]},e.id)),z.map(e=>(0,b.jsxs)(l.Muted,{children:[(0,u.niceDate)(new Date(e.at))," \xb7 ",e.text]},e.id)),E.length||z.length?null:(0,b.jsx)(l.Muted,{children:"No approved periods yet."}),(0,b.jsxs)(l.Sheet,{visible:Y,onClose:()=>K(!1),title:"Tips summary export",children:[(0,b.jsx)(l.Banner,{kind:"demo",title:"Payroll export: not set up yet",children:"Nothing is sent. This will download a CSV or PDF payslip summary for payroll."}),(0,b.jsx)(r.default,{style:{backgroundColor:(0,t.soutersSurface)('#111'),borderRadius:8,padding:8},children:Te.map((e,t)=>(0,b.jsx)(l.T,{size:11,colour:t?h.colours.text:h.colours.gold,children:e},t))}),(0,b.jsxs)(l.Muted,{children:[ne," \xb7 ",T[ie?.method??F.method]]})]}),(0,b.jsxs)(l.Sheet,{visible:W,onClose:()=>U(!1),title:"Tipping policy",children:[(0,b.jsx)(s.TextInput,{accessibilityLabel:"Tipping policy",multiline:!0,editable:ee,value:G,onChangeText:Q,style:[l.styles.input,{minHeight:220,textAlignVertical:'top'}]}),ee?(0,b.jsx)(l.Button,{label:"Save policy",onPress:()=>{re({text:G}),U(!1)}}):null,(0,b.jsx)(l.Muted,{children:"Template only. Adapt it to your business."})]})]}):(0,b.jsx)(O,{})},_e.MyTips=O;var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),n=_r(_d[3]),i=e(_r(_d[4])),r=e(_r(_d[5])),l=_r(_d[6]),d=_r(_d[7]),a=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),p=_r(_d[12]),m=_r(_d[13]),x=_r(_d[14]),f=_r(_d[15]),y=_r(_d[16]),j=_r(_d[17]),w=_r(_d[18]),b=_r(_d[19]);const T={hours:'By paid hours',points:'Hours \xd7 role points',equal:'Equal share',custom:'Custom %'},C=e=>'staff'!==e.role?'Manager':/porter|KP/i.test(e.job)?'KP':/kitchen|chef/i.test(e.job)?'Kitchen':/bar/i.test(e.job)?'Bar':'FOH',k=e=>(e??'').replace(' (example)','');function S(e,t){const s=t.reduce((e,t)=>e+t,0);if(!s||e<=0)return{amounts:t.map(()=>0),remainder:0};const o=t.map(t=>e*t/s),n=o.map(Math.floor);let i=e-n.reduce((e,t)=>e+t,0);const r=i;return o.map((e,t)=>({i:t,f:e-Math.floor(e)})).sort((e,t)=>t.f-e.f).forEach(({i:e})=>{i>0&&(n[e]+=1,i-=1)}),{amounts:n,remainder:r}}function O({staffId:e}={}){const t=(0,x.useCtx)(6e4),{now:s,me:o}=t,i=e??t.meId,d=(0,a.useOwner)(e=>e.tronc),u=(0,a.useOwner)(e=>e.troncHistory),p=(0,a.useOwner)(e=>e.troncLog),[m,f]=(0,n.useState)(!1),[y,j]=(0,n.useState)(null),C=u.flatMap(e=>e.rows.filter(e=>e.staffId===i).map(t=>({h:e,r:t})));return(0,b.jsxs)(r.default,{style:{gap:10},children:[(0,b.jsx)(w.TipGoalCard,{staffId:i}),(0,b.jsxs)(l.Card,{children:[(0,b.jsx)(l.T,{weight:"semibold",children:"My tips"}),(0,b.jsx)(l.Muted,{children:"Only your own tip history is shown. 100% of tips go to staff; nothing is deducted."})]}),C.map(({h:e,r:t})=>(0,b.jsxs)(l.Card,{children:[(0,b.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(l.T,{weight:"semibold",children:e.label}),(0,b.jsx)(l.T,{weight:"bold",colour:h.colours.gold,children:(0,c.gbp)(t.amount)})]}),(0,b.jsxs)(l.Muted,{children:[(0,x.hmDur)(Math.round(60*t.hours))," paid \xb7 ",t.pct.toFixed(1),"% share \xb7 ",T[e.method]," \xb7 approved ",e.lockedAt]})]},e.id)),C.length?null:(0,b.jsx)(l.Muted,{children:"No approved tip periods yet. (Preview: approve a period in the Owner view first.)"}),(0,b.jsx)(l.Button,{kind:"secondary",label:"Request my tip records",onPress:()=>{a.useOwner.getState().setOwner({troncLog:[{id:`tl-${Date.now()}`,at:s.toISOString(),text:`${o} requested their tip records`},...p]}),j('Request logged for your manager (demo, nothing is sent).')}}),y?(0,b.jsx)(l.Banner,{kind:"success",title:y}):null,(0,b.jsx)(l.Button,{kind:"ghost",label:"Read the tipping policy",onPress:()=>f(!0)}),(0,b.jsx)(l.Sheet,{visible:m,onClose:()=>f(!1),title:"Tipping policy",children:(0,b.jsx)(l.T,{size:14,children:d.text})})]})}},1011,[868,877,833,30,151,127,813,819,856,816,818,821,1000,1019,927,1111,1301,820,1341,24]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.AccidentBook=function(n){return null}},1012,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.MissedBanner=function(n){return null},e.HaccpLog=function(n){return null}},1013,[]); +__d(function(_g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.styliseOnDevice=p,_e.pickPhoto=b,_e.AvatarMaker=function({meId:e,me:h}){const u=(0,n.useAvatars)(t=>t.photos[e]),[g,f]=(0,t.useState)(null),[v,y]=(0,t.useState)(null),[x,j]=(0,t.useState)(!1),[w,I]=(0,t.useState)(!1),[k,P]=(0,t.useState)('');(0,t.useEffect)(()=>()=>{g&&URL.revokeObjectURL(g)},[g]);const M='undefined'!=typeof document,R=async e=>{P('');const t=await b(e);if(t){I(!0),j(!1);try{const e=await p(t);g&&URL.revokeObjectURL(g),f(URL.createObjectURL(t)),y(e)}catch{P("That photo couldn't be opened. Try a different one (JPEG or PNG).")}finally{I(!1)}}},S=()=>{g&&URL.revokeObjectURL(g),f(null),y(null),j(!1)},B=h.replace(' (example)','');return(0,c.jsxs)(o.default,{style:{gap:12},testID:"avatar-maker",children:[(0,c.jsxs)(d.Box,{children:[(0,c.jsxs)(s.Row,{gap:14,children:[(0,c.jsx)(l.StaffAvatar,{id:e,size:88}),(0,c.jsxs)(o.default,{style:{flex:1,gap:4},children:[(0,c.jsx)(s.T,{weight:"semibold",size:17,children:B}),(0,c.jsxs)(s.Muted,{children:[u?`Your avatar from a photo (made ${new Date(u.at).toLocaleDateString('en-GB')}).`:'Your default space-age avatar.'," It shows on rotas, chat, clock-in and sign-offs."]})]})]}),u?(0,c.jsx)(s.Button,{small:!0,kind:"secondary",label:"Back to my default avatar",testID:"avatar-own-reset",onPress:()=>{n.useAvatars.getState().reset(e,{id:e,role:'staff',name:B}),P('Back to your default avatar.')}}):null]}),(0,c.jsxs)(d.Box,{testID:"avatar-create",children:[(0,c.jsx)(s.T,{weight:"semibold",size:17,children:"Create my avatar from a photo"}),(0,c.jsx)(s.Muted,{children:"Upload a photo or take a selfie. Your phone turns it into a retro space-age avatar. The photo never leaves this device and isn't saved: only the finished avatar is kept."}),M?v?(0,c.jsxs)(o.default,{style:{gap:10},testID:"avatar-preview",children:[(0,c.jsxs)(s.Row,{gap:12,style:{justifyContent:'center'},children:[(0,c.jsxs)(o.default,{style:{alignItems:'center',gap:4},children:[g?(0,c.jsx)(a.default,{source:{uri:g},style:{width:96,height:96,borderRadius:12},accessibilityLabel:"Your photo"}):null,(0,c.jsx)(s.Muted,{children:"Your photo"})]}),(0,c.jsx)(s.T,{size:22,colour:i.colours.gold,children:"\u2192"}),(0,c.jsxs)(o.default,{style:{alignItems:'center',gap:4},children:[(0,c.jsx)(a.default,{source:{uri:v},style:{width:120,height:120,borderRadius:60,borderWidth:3,borderColor:i.colours.gold},accessibilityLabel:"Your new avatar preview",testID:"avatar-result"}),(0,c.jsx)(s.Muted,{children:"Your avatar"})]})]}),(0,c.jsxs)(r.default,{accessibilityRole:"checkbox",accessibilityState:{checked:x},accessibilityLabel:"I agree to use this avatar",testID:"avatar-consent",onPress:()=>j(!x),style:{flexDirection:'row',gap:10,alignItems:'flex-start',padding:10,borderRadius:12,borderWidth:1,borderColor:x?i.colours.gold:i.colours.border},children:[(0,c.jsx)(o.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:i.colours.gold,backgroundColor:x?i.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:x?(0,c.jsx)(s.T,{size:15,weight:"bold",colour:"#111",children:"\u2713"}):null}),(0,c.jsx)(s.T,{size:14,style:{flex:1},children:"I\u2019m happy for this avatar, made from my photo, to be shown to my team in CoverCharge. Only the finished avatar is shared; my photo isn\u2019t uploaded or kept, and a manager can reset my avatar."})]}),(0,c.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,c.jsx)(s.Button,{label:"Use as my avatar",testID:"avatar-save",disabled:!x,onPress:()=>{const t=n.useAvatars.getState().setOwn(e,e,v,B);P(t?'Saved: this is your avatar now.':"Couldn't save the avatar."),t&&S()}}),(0,c.jsx)(s.Button,{kind:"secondary",label:"Try another photo",onPress:S})]})]}):(0,c.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,c.jsx)(s.Button,{label:w?'Making your avatar\u2026':'Upload a photo',testID:"avatar-upload",disabled:w,onPress:()=>R(!1)}),(0,c.jsx)(s.Button,{kind:"secondary",label:"Take a selfie",testID:"avatar-selfie",disabled:w,onPress:()=>R(!0)})]}):(0,c.jsx)(s.Muted,{children:"Available in the web app."}),k?(0,c.jsx)(o.default,{testID:"avatar-msg",children:(0,c.jsx)(s.T,{size:14,colour:i.colours.ok,children:k})}):null,(0,c.jsx)(s.Banner,{kind:"info",title:"Coming soon: AI avatars",children:"A future version will use AI to draw you as a full cartoon in the same style. For now it's a simple filter that runs on your phone."})]})]})};var t=_r(_d[0]),a=e(_r(_d[1]));_r(_d[2]);var r=e(_r(_d[3])),o=e(_r(_d[4])),s=_r(_d[5]),l=_r(_d[6]),n=_r(_d[7]),i=_r(_d[8]),d=_r(_d[9]),c=_r(_d[10]);const h=['#1B1B1B','#4A3F35','#B89A72','#E9B949','#FFF4E0'].map(e=>[1,3,5].map(t=>parseInt(e.slice(t,t+2),16))),u=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5];function g(e){return new Promise((t,a)=>{const r=URL.createObjectURL(e),o=new window.Image;o.onload=()=>t({img:o,url:r}),o.onerror=()=>{URL.revokeObjectURL(r),a(new Error('bad image'))},o.src=r})}function f(e,t,a,r){e.beginPath(),e.moveTo(t,a-r),e.quadraticCurveTo(t+.18*r,a-.18*r,t+r,a),e.quadraticCurveTo(t+.18*r,a+.18*r,t,a+r),e.quadraticCurveTo(t-.18*r,a+.18*r,t-r,a),e.quadraticCurveTo(t-.18*r,a-.18*r,t,a-r),e.fill()}async function p(e){const{img:t,url:a}=await g(e);try{const e=112,a=256,r=document.createElement('canvas');r.width=e,r.height=e;const o=r.getContext('2d'),s=Math.min(t.width,t.height);o.drawImage(t,(t.width-s)/2,Math.max(0,(t.height-s)/2-.04*s),s,s,0,0,e,e);const l=o.getImageData(0,0,e,e),n=l.data,i=[];for(let e=0;ee-t),c=d[Math.floor(.04*d.length)],g=d[Math.floor(.96*d.length)]||255;for(let t=0;t{const a=document.createElement('input');a.type='file',a.accept='image/*',e&&a.setAttribute('capture','user'),a.onchange=()=>t(a.files?.[0]??null),a.click()})}},1014,[30,196,122,263,127,813,953,1201,821,1340,24]); +__d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEFAULT_LOYALTY",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"consentText",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"prettyCardNo",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"cleanCode",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"cardQr",{enumerable:!0,get:function(){return s}}),_e.readCardQr=function(e){const r=/^covercharge:card:[^:]+:([A-Za-z0-9-]{8,9})$/.exec(e.trim());return r?n(r[1]):null},Object.defineProperty(_e,"codeQr",{enumerable:!0,get:function(){return o}}),_e.checkSettings=function(e){return!Number.isInteger(e.stampsNeeded)||e.stampsNeeded<2||e.stampsNeeded>30?'Stamps needed must be between 2 and 30.':e.reward.trim()?e.reward.length>80?'Keep the reward under 80 letters.':e.gapMinutes<0||e.gapMinutes>1440?'Time between stamps must be 0 to 24 hours.':e.maxPerDay<1||e.maxPerDay>10?'Stamps a day must be 1 to 10.':!Number.isInteger(e.stampExpiryDays)||e.stampExpiryDays<0||e.stampExpiryDays>1095?'Stamps last 0 (never run out) to 1095 days.':!Number.isInteger(e.rewardExpiryDays)||e.rewardExpiryDays<0||e.rewardExpiryDays>1095?'Rewards last 0 (never run out) to 1095 days.':!e.referralOn||e.referralGiver.trim()&&e.referralFriend.trim()?e.referralMonthlyCap<0||e.referralMonthlyCap>50?'Friend rewards a month must be 0 to 50.':null:'Say what both people get before you switch Bring a friend on.':'Say what the reward is, for example Free dessert.'},_e.checkOffer=function(e){if(!e.title.trim())return'Give the offer a title.';if(e.title.length>80)return'Keep the title under 80 letters.';if(e.details.length>500)return'Keep the details under 500 letters.';const r=/^\d{4}-\d{2}-\d{2}$/;return e.startsOn&&!r.test(e.startsOn)?'Start date should look like 2026-11-30.':e.endsOn&&!r.test(e.endsOn)?'End date should look like 2026-11-30.':e.startsOn&&e.endsOn&&e.endsOn`I agree to ${e} keeping my name and the phone or email I give, only to run my stamp card and offers here. I can leave at any time and my details are removed.`,t=e=>e&&8===e.length?`${e.slice(0,4)}-${e.slice(4)}`:e,n=e=>e.toUpperCase().replace(/[^A-Z0-9]/g,''),s=(e,r)=>`covercharge:card:${e}:${r}`;const o=(e,r,t)=>`${e.replace(/\/$/,'')}/customer/${r}/loyalty?code=${t}`;const l=(e,r)=>e.isOn&&(!e.startsOn||e.startsOn<=r)&&(!e.endsOn||e.endsOn>=r),p=r=>r?{saved:!!r.updated_by,cardOn:!!r.card_on,stampsNeeded:r.stamps_needed??8,reward:r.reward??'',stampExpiryDays:r.stamp_expiry_days??0,rewardExpiryDays:r.reward_expiry_days??0,gapMinutes:r.gap_minutes??60,maxPerDay:r.max_per_day??1,referralOn:!!r.referral_on,referralGiver:r.referral_giver??'',referralFriend:r.referral_friend??'',referralMonthlyCap:r.referral_monthly_cap??5}:{...e},u=e=>({card_on:e.cardOn,stamps_needed:e.stampsNeeded,reward:e.reward.trim(),stamp_expiry_days:e.stampExpiryDays,reward_expiry_days:e.rewardExpiryDays,gap_minutes:e.gapMinutes,max_per_day:e.maxPerDay,referral_on:e.referralOn,referral_giver:e.referralGiver.trim(),referral_friend:e.referralFriend.trim(),referral_monthly_cap:e.referralMonthlyCap}),y=e=>({id:String(e.id),title:e.title??'',details:e.details??'',startsOn:e.starts_on??null,endsOn:e.ends_on??null,isOn:!1!==e.is_on})},1015,[]); +__d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SHOP_DEFAULT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"PAY_PLACEHOLDER",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"STATUS_WORDS",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"cleanGiftCode",{enumerable:!0,get:function(){return o}}),e.prettyGiftCode=function(t){const n=o(t);return 16===n.length?n.match(/.{4}/g).join('-'):n},e.poundsToPence=i,e.redeemKey=function(t=Math.random){const n='abcdefghijkmnpqrstuvwxyz23456789';let r='r-';for(let o=0;o<20;o++)r+=n[Math.floor(32*t())%32];return r},Object.defineProperty(e,"expiryWords",{enumerable:!0,get:function(){return c}}),e.amountsFromText=function(t){const n=t.split(/[,\s]+/).filter(Boolean).map(i);return!n.length||n.length>6||n.some(t=>null===t||t<100)?null:[...new Set(n)].sort((t,n)=>t-n)},e.basketTotal=function(t,n){return t.reduce((t,r)=>t+(n.find(t=>t.id===r.id)?.pricePence??0)*r.qty,0)},Object.defineProperty(e,"settingsFromRow",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"settingsToRow",{enumerable:!0,get:function(){return a}});const t={giftsOn:!1,shopOn:!1,expiryMonths:24,amounts:[2500,5e3,1e4],minPence:500,maxPence:25e3,terms:''},n='Gift cards are sold through your website. You can also pay at the bar or till.',r={'waiting-payment':'Waiting for payment at the till',active:'Ready to use',used:'Used up',expired:'Expired',void:'Cancelled',paid:'Paid',ready:'Ready to collect',collected:'Collected',cancelled:'Cancelled'},o=t=>(t??'').toUpperCase().replace(/[^A-Z0-9]/g,'');function i(t){const n=(t??'').trim().replace(/^\xa3/,'');return/^\d{1,4}(\.\d{1,2})?$/.test(n)?Math.round(100*Number(n)):null}const c=t=>t%12==0?`${t/12} year${12===t?'':'s'}`:`${t} months`;const s=n=>n?{giftsOn:!!n.gifts_on,shopOn:!!n.shop_on,expiryMonths:n.expiry_months??24,amounts:n.amounts??t.amounts,minPence:n.min_pence??500,maxPence:n.max_pence??25e3,terms:n.terms??''}:{...t},a=t=>({gifts_on:t.giftsOn,shop_on:t.shopOn,expiry_months:t.expiryMonths,amounts:t.amounts,min_pence:t.minPence,max_pence:t.maxPence,terms:t.terms})},1016,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"shopPublic",{enumerable:!0,get:function(){return p}}),e.myShop=async function(t){return await(0,n.guestSession)()?(0,n.rpc)('guest_my_shop',{p_slug:t}):{cards:[],orders:[]}},e.buyGift=async function(t,o){if(!await(0,n.guestSession)())throw new Error('No connection. Try again when you are back online.');return(0,n.rpc)('guest_gift_buy',{p_slug:t,p_amount:o.amount,p_recipient:o.recipient,p_from:o.from,p_message:o.message})},e.shopOrder=async function(t,o,c){if(!await(0,n.guestSession)())throw new Error('No connection. Try again when you are back online.');return(0,n.rpc)('guest_shop_order',{p_slug:t,p_lines:o,p_name:c})},Object.defineProperty(e,"giftCheck",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"giftRedeem",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"giftActivate",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"giftIssue",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"giftHonourWix",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"giftVoid",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"giftSummary",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"shopStatus",{enumerable:!0,get:function(){return v}}),e.waitingCards=async function(){const{data:t,error:n}=await c().from('gift_cards').select('id,last4,ref,initial_pence,balance_pence,status,source,recipient_name,issued_at,expires_at').eq('venue_id',s()).order('issued_at',{ascending:!1}).limit(60);if(n)throw n;return t??[]},e.shopOrders=async function(){const{data:t,error:n}=await c().from('shop_orders').select('*').eq('venue_id',s()).order('created_at',{ascending:!1}).limit(60);if(n)throw n;return t??[]},e.readShopSettings=async function(){const{data:t,error:n}=await c().from('shop_settings').select('*').eq('venue_id',s()).maybeSingle();if(n)throw n;return(0,o.settingsFromRow)(t)},e.saveShopSettings=async function(t){const{error:n}=await c().from('shop_settings').upsert({venue_id:s(),...(0,o.settingsToRow)(t),updated_by:u(),updated_at:(new Date).toISOString()},{onConflict:'venue_id'});if(n)throw n},e.readProducts=async function(){const{data:t,error:n}=await c().from('shop_products').select('*').eq('venue_id',s()).order('sort').order('name');if(n)throw n;return t??[]},e.saveProduct=async function(t){const n={venue_id:s(),name:t.name.trim(),details:t.details.trim(),price_pence:t.pricePence,stock:t.stock,is_live:t.live,updated_by:u(),updated_at:(new Date).toISOString()},{error:o}=t.id?await c().from('shop_products').update(n).eq('id',t.id):await c().from('shop_products').insert(n);if(o)throw o},Object.defineProperty(e,"payPublic",{enumerable:!0,get:function(){return S}}),e.payStart=async function(t,o,s){if(!await(0,n.guestSession)())throw new Error('No connection. Try again when you are back online.');const u='undefined'!=typeof window?window.location.href.split('?')[0]:'',{data:p,error:_}=await c().functions.invoke('pay-checkout',{body:{slug:t,kind:o,target:s,successUrl:u,cancelUrl:u}});if(_||!p?.url)throw new Error(p?.error??'Card payment isn\u2019t available yet. Pay at the bar or till.');if(!/^https:\/\/checkout\.stripe\.com\//.test(p.url))throw new Error('Card payment isn\u2019t available yet. Pay at the bar or till.');return p},Object.defineProperty(e,"payStatus",{enumerable:!0,get:function(){return P}}),e.readPaySettings=async function(){const{data:t,error:n}=await c().from('payment_settings').select('*').eq('venue_id',s()).maybeSingle();if(n)throw n;return{provider:t?.provider??'none',cardOn:!!t?.card_on,account:t?.stripe_account_id??''}},Object.defineProperty(e,"savePaySettings",{enumerable:!0,get:function(){return O}}),e.recentPayments=async function(){const{data:t,error:n}=await c().from('payments').select('id,kind,amount_pence,status,provider,created_at,paid_at').eq('venue_id',s()).order('created_at',{ascending:!1}).limit(20);if(n)throw n;return t??[]};var t=r(d[0]),n=r(d[1]),o=r(d[2]);const c=()=>(0,t.getSupabase)(),s=()=>{const t=n.useSync.getState().venueId;if(!t)throw new Error('Not connected to the venue yet.');return t},u=()=>(n.useSync.getState().staffRef??'').slice(0,80)||null,p=t=>(0,n.rpc)('shop_public',{p_slug:t});const _=t=>(0,n.rpc)('staff_gift_check',{p_venue:s(),p_code:t}),f=(t,o,c,u)=>(0,n.rpc)('staff_gift_redeem',{p_venue:s(),p_code:t,p_amount:o,p_key:c,p_by:u}),y=(t,o)=>(0,n.rpc)('staff_gift_activate',{p_card:t,p_by:o}),l=(t,o,c)=>(0,n.rpc)('staff_gift_issue',{p_venue:s(),p_amount:t,p_recipient:o,p_by:c}),b=(t,o,c)=>(0,n.rpc)('staff_gift_honour_wix',{p_venue:s(),p_code:t,p_balance:o,p_by:c}),w=(t,o,c)=>(0,n.rpc)('staff_gift_void',{p_card:t,p_reason:o,p_by:c}),h=()=>(0,n.rpc)('staff_gift_summary',{p_venue:s()}),v=(t,o,c,s)=>(0,n.rpc)('staff_shop_status',{p_order:t,p_status:o,p_reason:c,p_by:s});const S=async t=>{try{return await(0,n.rpc)('pay_public',{p_slug:t})}catch{return{provider:'none',cardOn:!1,testMode:!0}}};const P=t=>(0,n.rpc)('guest_pay_status',{p_payment:t});const O=t=>(0,n.rpc)('staff_payment_settings_save',{p_venue:s(),p_provider:t.provider,p_card_on:t.cardOn,p_account:t.account,p_by:u()})},1017,[863,820,1016]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.refreshCashAccess=r,e.setStaffCashUp=async function(c,o){const f=s.useSync.getState().venueId;if(!f)return{ok:!1,error:'Not connected. Try again when the app is online.'};const u=(0,t.getSupabase)();try{const{data:t}=await u.from('staff').select('id').eq('venue_id',f).eq('external_ref',c).maybeSingle();if(!t?.id)return{ok:!1,error:'This person isn\u2019t on the shared team list yet.'};const{error:s}=await u.rpc('set_staff_cash_up',{p_staff:t.id,p_on:o});return s?{ok:!1,error:/owner or manager/i.test(s.message)?'Only an owner or manager can change this.':'Could not save. Try again.'}:(n.useCashAccess.setState(t=>({byRef:{...t.byRef,[c]:o}})),r(),{ok:!0})}catch{return{ok:!1,error:'Could not save. Try again when the app is online.'}}};var t=_r(d[0]),s=_r(d[1]),n=_r(d[2]);async function r(){const r=s.useSync.getState().venueId;if(!r||'staff'!==s.useSync.getState().kind)return;const c=(0,t.getSupabase)();try{const[{data:t},{data:s}]=await Promise.all([c.rpc('my_cash_up_access',{p_venue:r}),c.from('staff').select('external_ref, can_cash_up').eq('venue_id',r)]),o={};if(Array.isArray(s))for(const t of s)t.external_ref&&(o[t.external_ref]=!!t.can_cash_up);n.useCashAccess.setState({mine:'boolean'==typeof t?t:n.useCashAccess.getState().mine,byRef:Array.isArray(s)?o:n.useCashAccess.getState().byRef,loaded:!0})}catch{}}},1018,[863,820,997]); +__d(function(g,_r,i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"RID",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"statusKind",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"statusLabel",{enumerable:!0,get:function(){return d}}),_e.nextStatus=function(e){return'new'===e.status||'acknowledged'===e.status?{to:'preparing',label:'Start preparing'}:'preparing'===e.status?{to:'ready',label:'takeaway'===e.type?'Mark ready (notify customer)':'Mark ready'}:'ready'===e.status?'takeaway'===e.type?{to:'collected',label:'Collected'}:{to:'served',label:'Served'}:null},Object.defineProperty(_e,"LIVE",{enumerable:!0,get:function(){return a}}),_e.busyLevel=b,_e.restOfDayLevel=function(e,r){const t=e.hours.filter(r=>!e.nextHour||r.hour>=e.nextHour.hour).reduce((e,r)=>!e||r.covers>e.covers?r:e,void 0);return{level:b(t?.covers??0,r.settings.capacityPerHour),peak:t}},_e.Tile=function({label:e,value:n,sub:c,onPress:u,accent:d,children:a}){const b=(0,s.jsxs)(t.default,{style:{flexGrow:1,flexBasis:150,backgroundColor:o.colours.surface,borderRadius:14,padding:12,borderWidth:1,borderColor:d??o.colours.border,gap:2},children:[(0,s.jsx)(l.T,{size:13,weight:"medium",colour:o.colours.muted,children:e}),(0,s.jsx)(l.T,{size:24,weight:"bold",colour:d??o.colours.text,children:n}),c?(0,s.jsx)(l.T,{size:13,colour:o.colours.muted,children:c}):null,a]});return u?(0,s.jsx)(r.default,{accessibilityRole:"button",accessibilityLabel:e,onPress:u,style:{flexGrow:1,flexBasis:150},children:b}):b},_e.SectionHead=function({title:e,right:r,sub:n}){return(0,s.jsxs)(t.default,{style:{gap:2,marginTop:6},children:[(0,s.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,s.jsx)(l.T,{weight:"semibold",size:o.font.large,colour:o.colours.gold,children:e}),r]}),n?(0,s.jsx)(l.Muted,{children:n}):null]})},_e.AlertBox=function({colour:e,title:r,children:n}){return(0,s.jsxs)(t.default,{style:{backgroundColor:o.colours.surface2,borderRadius:12,padding:10,borderLeftWidth:6,borderLeftColor:e,gap:6},children:[(0,s.jsx)(l.T,{weight:"bold",colour:e,children:r}),n]})},_e.Bars=function({data:e,max:r,highlight:n,height:c=110}){return(0,s.jsx)(l.Row,{gap:4,style:{alignItems:'flex-end'},children:e.map(e=>{const u=e.key===n,d=e.a+(e.b??0);return(0,s.jsxs)(t.default,{style:{alignItems:'center',flex:1,minWidth:26},children:[(0,s.jsx)(l.T,{size:11,colour:u?o.colours.gold:o.colours.muted,children:e.note??String(d)}),(0,s.jsxs)(t.default,{style:{height:c,width:'70%',justifyContent:'flex-end',borderBottomWidth:1,borderColor:o.colours.border},children:[e.b?(0,s.jsx)(t.default,{style:{height:Math.max(0,e.b/r*c),backgroundColor:u?o.colours.goldLight:'#6B5A3A'}}):null,(0,s.jsx)(t.default,{style:{height:Math.max(d?2:0,e.a/r*c),backgroundColor:u?o.colours.gold:'#9C7C45'}})]}),(0,s.jsx)(l.T,{size:11,colour:u?o.colours.gold:o.colours.muted,children:e.label})]},e.key)})})},Object.defineProperty(_e,"DemoTag",{enumerable:!0,get:function(){return f}}),_r(_d[0]);var r=e(_r(_d[1])),t=e(_r(_d[2])),l=_r(_d[3]),o=_r(_d[4]),n=_r(_d[5]),s=_r(_d[6]);const c=n.VENUE_RID,u=e=>'new'===e?'red':'ready'===e?'ok':'preparing'===e||'acknowledged'===e?'amber':'served'===e||'collected'===e?'blue':'neutral',d=e=>({new:'New',acknowledged:'Accepted',preparing:'Preparing',ready:'Ready',collected:'Collected',served:'Served',closed:'Closed',cancelled:'Cancelled'}[e.status]);const a=e=>!['collected','served','closed','cancelled'].includes(e.status);function b(e,r){const t=r?e/r:0;return t<.35?{label:'Quiet',colour:o.colours.ok,pct:t}:t<.6?{label:'Steady',colour:o.colours.blue,pct:t}:t<.85?{label:'Busy',colour:o.colours.amber,pct:t}:{label:'Very busy',colour:o.colours.red,pct:t}}const f=({label:e="DEMO"})=>(0,s.jsx)(l.Badge,{kind:"amber",label:e})},1019,[30,263,127,813,821,5,24]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.WhatsAppGuest=function({b:p,rid:o,kind:u="change"}){const c=(0,n.useRestaurant)(o);if(!c?.settings?.whatsapp||!(0,s.waNumber)(c.settings.whatsapp)||p.walkIn||!(0,s.waNumber)(p.phone))return null;const l=c.location?.split(',')[1]?.trim(),f=(0,s.staffWhatsAppTexts)({name:p.name,ref:p.ref,date:p.date,time:p.time,partySize:p.partySize},c.name,l&&!/fictional/i.test(l)?l:void 0),h='auto'===u?['confirmed','pending'].includes(p.status)?'confirm':'change':u,b=(0,s.waMeLink)(p.phone,'confirm'===h?f.confirm:f.change);return b?(0,r.jsx)(t.Button,{small:!0,kind:"secondary",label:"\ud83d\udcac WhatsApp guest",testID:`wa-guest-${p.ref}`,accessibilityLabel:`WhatsApp ${p.name}`,onPress:()=>{(0,s.openWhatsApp)(b)}}):null},_r(d[0]);var t=_r(d[1]),n=_r(d[2]),s=_r(d[3]),r=_r(d[4])},1020,[30,813,819,822,24]); +__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.requestChallenge=async function(t,s){const{data:u,error:o}=await n().rpc('venue_request_challenge',{p_slug:(0,e.queuedDatabaseSlug)(t),p_kind:s});if(o)throw o;return u},_e.sendVenueRequest=async function(t,s,u,o,c,l){const{data:_,error:p}=await n().rpc('submit_venue_request',{p_slug:(0,e.queuedDatabaseSlug)(t),p_kind:s,p_payload:u,p_challenge:o,p_answer:c,p_website:l});if(p)throw p;return _},_e.listVenueRequests=async function(e,t){const{data:s,error:u}=await n().from('venue_booking_requests').select('*').eq('venue_id',e).eq('kind',t).order('status',{ascending:!1}).order('created_at',{ascending:!1}).limit(100);if(u)throw u;return s||[]},_e.decideVenueRequest=async function(e,t){const{data:s,error:u}=await n().rpc('decide_venue_request',{p_id:e,p_decision:t});if(u)throw u;return s},Object.defineProperty(_e,"requestMessage",{enumerable:!0,get:function(){return s}});var e=r(d[0]),t=r(d[1]);const n=()=>(0,t.getSupabase)();const s=e=>{const t=String(e?.message||'');return/^(Requests are not enabled|Too many|Please complete|Enter your|Choose |This request|Only this venue)/.test(t)?t:'Unable to send or load requests. Check your connection and try again, or call the hotel.'}},1021,[6,863]); +__d(function(_g,_r,i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useStore",{enumerable:!0,get:function(){return n.useStore}}),_e.useNow=function(e=1e4){const r=(0,n.useStore)(e=>e.clock),[,u]=(0,t.useState)(0);return(0,t.useEffect)(()=>{const t=setInterval(()=>u(e=>e+1),e);return()=>clearInterval(t)},[e]),(0,n.nowFrom)(r)},Object.defineProperty(_e,"useRestaurant",{enumerable:!0,get:function(){return a}}),_e.useRecipeCards=c,_e.useAllMenu=f,_e.useMenu=function(e){const r=f(e);return(0,t.useMemo)(()=>r.filter(e=>!e.hidden),[r])},Object.defineProperty(_e,"useCustomer",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"useBasket",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"useOrders",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"useOrderAtTable",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"useOrder",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"useBookings",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"useWaitlist",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"useEvents",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"useStampCard",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"useGiftCards",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"useRatings",{enumerable:!0,get:function(){return M}}),Object.defineProperty(_e,"useAudit",{enumerable:!0,get:function(){return v}});var e=_r(_d[0]),t=_r(_d[1]),r=_r(_d[2]),n=_r(_d[3]),u=_r(_d[4]),s=_r(_d[5]),o=_r(_d[6]);_r(_d[7]);const a=e=>(0,n.useStore)(t=>t.restaurants.find(t=>t.id===e)),l=e=>(0,o.recipeCards)().subscribe(e),d=[];function c(e){return(0,t.useSyncExternalStore)(l,()=>e?(0,o.recipeCards)().list(e):d,()=>e?(0,o.recipeCards)().list(e):d)}function f(e){const u=(0,n.useStore)((0,r.useShallow)(t=>t.menu.filter(t=>t.restaurantId===e))),o=c(e);return(0,t.useMemo)(()=>(0,s.resolveMenu)(u),[u,o])}const b=()=>(0,n.useStore)(e=>e.customer),S=()=>(0,n.useStore)(e=>e.basket),g=(e,t)=>'table'!==t.type||(0,u.orderAtTableOn)(e.restaurants.find(e=>e.id===t.restaurantId)),m=e=>(0,n.useStore)((0,r.useShallow)(t=>t.orders.filter(r=>(!e||r.restaurantId===e)&&g(t,r)))),p=e=>(0,n.useStore)(t=>(0,u.orderAtTableOn)(t.restaurants.find(t=>t.id===e))),O=e=>(0,n.useStore)(t=>t.orders.find(t=>t.id===e)),y=e=>(0,n.useStore)((0,r.useShallow)(t=>e?t.bookings.filter(t=>t.restaurantId===e):t.bookings)),w=e=>(0,n.useStore)((0,r.useShallow)(t=>t.waitlist.filter(t=>t.restaurantId===e))),I=[],j=u=>{const s=(0,n.useStore)((0,r.useShallow)(e=>e.events.filter(e=>null===e.restaurantId||e.restaurantId===u))),o=(0,n.useStore)(e=>e.restaurants.find(e=>e.id===u)),a=o?(0,e.regularEventsOf)(o):I,l=(new Date).toISOString().slice(0,7);return(0,t.useMemo)(()=>{if(!u||!a.length)return s;const t=new Date,r=new Date(t.getFullYear(),t.getMonth()-2,1),n=new Date(t.getFullYear()+1,t.getMonth()+1,0),o=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`;return[...s,...(0,e.expandEvents)(u,a,o(r),o(n))]},[s,a,u,l])},P=e=>(0,n.useStore)(t=>t.stampCards.find(r=>r.restaurantId===e&&r.customerId===t.customer.id)),h=e=>(0,n.useStore)((0,r.useShallow)(t=>t.giftCards.filter(r=>(!e||r.restaurantId===e)&&r.ownerId===t.customer.id))),M=e=>(0,n.useStore)((0,r.useShallow)(t=>t.ratings.filter(t=>t.restaurantId===e))),v=e=>(0,n.useStore)((0,r.useShallow)(t=>t.audit.filter(t=>t.restaurantId===e)))},1022,[809,30,873,872,1240,1114,831,1094]); +__d(function(g,r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"METHOD_LABEL",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"DAY3",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"DAYS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"wd",{enumerable:!0,get:function(){return i}}),e.dayRange=function(t){const n=[...new Set(t)].sort((t,n)=>t-n);if(!n.length)return'';if(7===n.length)return'every day';return n.every((t,o)=>o===0||t===n[o-1]+1)&&n.length>=3?`${o[n[0]]} to ${o[n[n.length-1]]}`:n.map(t=>o[t]).join(', ')},e.nextDelivery=a,Object.defineProperty(e,"niceDay",{enumerable:!0,get:function(){return d}}),e.remindersFor=function(t,n,o={}){const d=i(n);return t.filter(t=>t.orderDays.includes(d)).flatMap(t=>{if(o[t.id]&&new Date(o[t.id]).toDateString()===n.toDateString())return[];let d=!1;if(/^\d\d:\d\d$/.test(t.cutoff)){const[o,s]=t.cutoff.split(':').map(Number),i=new Date(n);i.setHours(o,s,0,0),d=n>i}const l=a(t,n),c=t.reminder||`Order ${t.name} today${l?` for ${s[i(l)]}`:''}`;return[{supplierId:t.id,name:t.name,text:`${c}${t.cutoff?d?` (cut-off ${t.cutoff} passed)`:` by ${t.cutoff}`:''}`,tone:d?'red':'amber',cutoffPassed:d}]})},e.orderLines=function(n,o,s,i=""){const a=n.items.filter(t=>(o[t.id]??0)>0).map(n=>`${(0,t.fishInStone)(i,n)?(0,t.fishQtyText)(i,n,o[n.id]):`${l(o[n.id])} ${n.unit}`} ${n.name}`.replace(/\s+/g,' ').trim());return s.split('\n').map(t=>t.trim()).filter(Boolean).forEach(t=>a.push(t)),a},e.orderMessage=function(t,n,o,s,i,l){const c=a(t,l);return[`Hi ${t.contact||t.name.split(' (')[0]}, order from ${n}${o?`, ${o}`:''}${c?` for ${d(c)}`:''}:`,...s.map(t=>`- ${t}`),'',`Thanks, ${i}`].join('\n')},e.intlDigits=c,Object.defineProperty(e,"smsLink",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"waLink",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"telLink",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"sid",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"ANCHORAGE_SHEETS",{enumerable:!0,get:function(){return k}});var t=r(_d[0]);const n={online:'Online',phone:'Phone',text:'Text message',whatsapp:'WhatsApp',tbc:'To be decided'},o=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],s=['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'],i=t=>(t.getDay()+6)%7;function a(t,n){const o=null!=t.deliversOn?[t.deliversOn]:t.deliveryDays;if(!o.length)return null;for(let t=1;t<=7;t++){const s=new Date(n);if(s.setDate(s.getDate()+t),o.includes(i(s)))return s}return null}const d=t=>t.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'});const l=t=>Number.isInteger(t)?String(t):t.toFixed(1).replace(/\.0$/,'');function c(t){const n=t.replace(/[^\d+]/g,'').replace(/^\+/,'');return n.startsWith('00')?n.slice(2):n.startsWith('0')?`44${n.slice(1)}`:n}const u=(t,n)=>`sms:${t.replace(/[^\d+]/g,'')}?&body=${encodeURIComponent(n)}`,m=(t,n)=>`https://wa.me/${c(t)}?text=${encodeURIComponent(n)}`,f=t=>`tel:${t.replace(/[^\d+]/g,'')}`;let p=0;const h=(t="os")=>`${t}-${Date.now().toString(36)}${(p++).toString(36)}`,y=(t,n,o)=>({id:t,name:n,unit:o}),b=t=>({number:'',url:'',deliveryDays:[],orderDays:[],cutoff:'',frequency:'',reminder:'',priceCapPerKg:0,seller:'',items:[],notes:'',...t}),k=[b({id:'os-reids',name:'Reids',goods:'Dry goods and frozen',method:'online',urlLabel:'Open Coldweb',deliveryDays:[0,1,2,3,4],frequency:'Order on Coldweb',items:[y('rd-chips','Frozen chips','boxes'),y('rd-oil','Fryer oil','tubs'),y('rd-flour','Flour','bags'),y('rd-rice','Rice','bags'),y('rd-peas','Frozen peas','bags')],notes:'Order on their Coldweb ordering site. Add the Coldweb link in Managers \u203a Settings \u203a Supplier order sheets, or here.'}),b({id:'os-veg',name:'Veg',goods:'Fruit and veg (supplier to be added)',method:'tbc',placeholder:!0,frequency:'To be added by Gordon',notes:'Placeholder: Gordon will add the veg supplier, how to order and delivery days.'}),b({id:'os-peroni',name:'J. Pieroni & Sons',goods:'Seafood (fish merchant, Ayr)',method:'phone',url:'https://pieronis.com',urlLabel:'Open pieronis.com',deliveryDays:[0,1,2,3,4,5],frequency:'Phone order',items:[y('pa-haddock','Haddock fillets','kg'),y('pa-mussels','Mussels','kg'),y('pa-scallops','Scallops','kg'),y('pa-salmon','Salmon','kg')],notes:'Phone order. Press Call, then read the order from the screen.'}),b({id:'os-spesbona',name:'Spes Bona',goods:'Langoustines and smoked haddock',method:'text',orderDays:[2],deliversOn:4,deliveryDays:[4],frequency:'Text on Wednesday for Friday',reminder:'Text Spes Bona today for Friday\u2019s langoustines and smoked haddock',items:[y('sb-langs','Langoustines','kg'),y('sb-smoked','Smoked haddock','kg')]}),b({id:'os-tarelgin',name:'Tarelgin',goods:'Butcher',method:'text',frequency:'Text order',items:[y('tg-steak','Ribeye steaks',''),y('tg-mince','Steak mince','kg'),y('tg-chicken','Chicken breasts',''),y('tg-sausage','Sausages','kg')]}),b({id:'os-mills',name:'Mills',goods:'Milk',method:'whatsapp',frequency:'WhatsApp message',items:[y('ml-milk','Milk','litres'),y('ml-cream','Double cream','litres'),y('ml-butter','Butter','kg')]}),b({id:'os-kittyfisher',name:'Kittyfisher boat (Big Sean)',goods:'Lobsters and crabs',method:'text',contact:'Sean',frequency:'Whenever stock is low',shellfish:!0,items:[y('kf-lobster','Lobsters',''),y('kf-crab','Crabs','')],notes:'Text Big Sean whenever the lobster or crab count runs low.'}),b({id:'os-lionsmane',name:'Lion\u2019s mane mushroom',goods:'Lion\u2019s mane mushrooms',method:'online',urlLabel:'Open seller',frequency:'Weekly or fortnightly',priceCapPerKg:2500,seller:'Cheapest UK seller (to be chosen)',items:[y('lm-kg','Lion\u2019s mane mushroom','kg')],notes:'Order online from the cheapest UK seller under the price cap. Check the price per kg before you buy.'})]},1023,[1026]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BigText=D,_e.TimeGrid=v,_e.ScopePicker=I,_e.BlockNowSheet=B,_e.DatePicker=C,_e.AddBlockSheet=P,_e.FutureBlocksList=R,_e.BlocksScreen=L,_e.DisplayBlocksScreen=W,_e.DisplayBlocksMenu=function({rid:e,r:t,now:o,by:l,onClose:n}){const[a,i]=(0,s.useState)('menu');return'now'===a?(0,y.jsx)(B,{rid:e,r:t,now:o,by:l,wide:!0,onClose:n}):'future'===a?(0,y.jsx)(P,{rid:e,r:t,now:o,by:l,wide:!0,onClose:n}):'list'===a?(0,y.jsx)(W,{rid:e,r:t,now:o,by:l,onBack:n}):(0,y.jsxs)(m.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:560,testID:"display-blocks-menu",children:[(0,y.jsx)(D,{wide:!0,testID:"dbm-now",label:"Block now",sub:"Pause bookings today",onPress:()=>i('now')}),(0,y.jsx)(D,{wide:!0,testID:"dbm-future",label:"Block future",sub:"A future date, time or tables",onPress:()=>i('future')}),(0,y.jsx)(D,{wide:!0,testID:"dbm-list",label:"All blocked times",sub:"See, change or remove a block",onPress:()=>i('list')}),(0,y.jsx)(m.Muted,{children:"Tip: anyone on the Display can add, change or remove a block. Removing asks you to confirm, and every change is logged."})]})};var t=_r(_d[0]),s=_r(_d[1]),o=e(_r(_d[2])),l=e(_r(_d[3])),n=e(_r(_d[4])),a=e(_r(_d[5])),i=e(_r(_d[6])),d=_r(_d[7]),r=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),g=_r(_d[13]),m=_r(_d[14]),x=_r(_d[15]),p=_r(_d[16]),f=_r(_d[17]),y=_r(_d[18]);const k=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],w=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],j=e=>{try{o.default.announceForAccessibility?.(e)}catch{}};function D({label:e,sub:t,onPress:s,selected:o,disabled:l,testID:a,a11y:i,wide:d}){return(0,y.jsxs)(n.default,{testID:a,accessibilityRole:"button",accessibilityLabel:i??(t?`${e}, ${t}`:e),accessibilityState:{selected:!!o,disabled:!!l},disabled:l,onPress:s,style:({pressed:e})=>({minHeight:52,minWidth:d?void 0:84,flexGrow:d?1:0,paddingHorizontal:14,paddingVertical:8,borderRadius:14,borderWidth:1.5,borderColor:o?b.colours.gold:b.colours.border,backgroundColor:o?b.colours.gold:e?b.colours.goldTint:b.colours.surface2,opacity:l?.35:1,justifyContent:'center'}),children:[(0,y.jsx)(m.T,{size:18,weight:"semibold",colour:o?b.colours.onGold:b.colours.goldLight,center:!0,children:e}),t?(0,y.jsx)(m.T,{size:13,colour:o?b.colours.onGold:b.colours.muted,center:!0,children:t}):null]})}function v({from:e,to:t,min:o,max:l,onChange:n,testID:a="time-grid"}){const[d,r]=(0,s.useState)(e?'to':'from'),c=(0,u.quarterTimes)(o,l),g=t=>{if('from'===d||!e||(0,h.toMins)(t)<=(0,h.toMins)(e))return n(t,void 0),r('to'),void j(`From ${(0,u.rangeText)(t,t).split('\u2013')[0]}. Now pick the end time.`);n(e,t),r('from'),j(`Block ${(0,u.rangeText)(e,t)}`)};return c.length?(0,y.jsxs)(i.default,{testID:a,style:{gap:6},children:[(0,y.jsxs)(m.T,{size:15,weight:"semibold",colour:b.colours.gold,children:['from'!==d&&e?'Now tap the end time':'Tap the start time',e?` \xb7 ${(0,u.rangeText)(e,t??e)}`:'']}),(0,y.jsx)(i.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:6},children:c.map(s=>{const o=!!e&&!!t&&(0,h.toMins)(s)>=(0,h.toMins)(e)&&(0,h.toMins)(s)<=(0,h.toMins)(t);return(0,y.jsx)(D,{testID:`${a}-${s.replace(':','')}`,label:(0,u.rangeText)(s,s).split('\u2013')[0],a11y:`${'from'===d?'From':'To'} ${(0,u.rangeText)(s,s).split('\u2013')[0]}`,selected:s===e||s===t||o,onPress:()=>g(s)},s)})})]}):(0,y.jsx)(m.Muted,{children:"No times left today."})}function I({rid:e,value:o,onChange:l}){const n=(0,c.usePlan)(e),[a,d]=(0,s.useState)(!!o.tables?.length);return(0,y.jsxs)(i.default,{style:{gap:6},testID:"block-scope",children:[(0,y.jsx)(m.T,{size:15,weight:"semibold",children:"Where (optional)"}),(0,y.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,y.jsx)(m.Chip,{testID:"scope-all",label:"All areas",selected:!o.areaId&&!o.tables?.length&&!a,onPress:()=>{d(!1),l({})}}),n.areas.map(e=>(0,y.jsx)(m.Chip,{testID:`scope-area-${e.id}`,label:e.name,selected:o.areaId===e.id,onPress:()=>{d(!1),l({areaId:e.id,areaName:e.name})}},e.id)),(0,y.jsx)(m.Chip,{testID:"scope-tables",label:"Some tables",selected:a,onPress:()=>{d(!0),l({tables:o.tables??[]})}})]}),a?(0,y.jsx)(m.Row,{wrap:!0,gap:6,children:n.tables.map(e=>{const s=!!o.tables?.includes(e.name);return(0,y.jsx)(m.Chip,{testID:`scope-table-${e.name}`,label:(0,t.tableNumbers)(e.name),selected:s,onPress:()=>l({tables:s?(o.tables??[]).filter(t=>t!==e.name):[...o.tables??[],e.name]})},e.id)})}):null]})}function T({value:e,note:t,onChange:s,onNote:o}){return(0,y.jsxs)(i.default,{style:{gap:6},children:[(0,y.jsx)(m.T,{size:15,weight:"semibold",children:"Reason (optional)"}),(0,y.jsx)(m.Row,{wrap:!0,gap:6,children:r.BLOCK_REASONS.map(t=>(0,y.jsx)(m.Chip,{label:t,selected:e===t,onPress:()=>s(e===t?void 0:t)},t))}),(0,y.jsx)(m.Field,{label:"Note (optional)",value:t,onChangeText:e=>o(e.slice(0,120)),placeholder:"e.g. Christening party",testID:"block-note"})]})}function S({line:e,clashes:t,testID:o="block-confirm"}){return(0,s.useEffect)(()=>{j(`${e}. ${t?`${t} booking${1===t?' is':'s are'} already in this time and will be kept.`:''}`)},[e,t]),(0,y.jsxs)(i.default,{testID:o,accessibilityLiveRegion:"polite",style:{borderWidth:1.5,borderColor:b.colours.gold,borderRadius:14,padding:12,gap:6,backgroundColor:b.colours.goldTint},children:[(0,y.jsx)(m.T,{size:19,weight:"semibold",colour:b.colours.gold,children:e}),t?(0,y.jsx)(m.T,{size:15,colour:b.colours.amber,testID:"block-clash-warning",children:`${t} booking${1===t?' is':'s are'} already in this time. ${1===t?'It is':'They are'} kept: call the guest${1===t?'':'s'} if needed.`}):(0,y.jsx)(m.Muted,{children:"No bookings in this time yet."})]})}const $=e=>(0,u.roundUpQuarter)(60*e.getHours()+e.getMinutes())-(e.getMinutes()%15==0?0:15);function B({rid:e,r:t,now:o,by:l,onClose:n,wide:a}){const g=(0,h.ymd)(o),p=(0,c.useDisplaySettings)(e),f=(0,u.openWindow)(t,g),k=(0,u.servicesOn)(t,g,p.serviceWindows),w=Math.max(f?.from??0,$(o)),B=(0,d.useBookings)(e),C=(0,c.usePlan)(e),[P,M]=(0,s.useState)({}),[R,L]=(0,s.useState)(!1),[W,z]=(0,s.useState)({}),[N,E]=(0,s.useState)(),[A,F]=(0,s.useState)(''),[O,_]=(0,s.useState)('pick'),[G,Y]=(0,s.useState)(''),q=!!f&&we&&e.to>w?{from:(0,h.fromMins)(Math.max(e.from,w)),to:(0,h.fromMins)(e.to)}:null,U=H(k.lunch),K=H(k.dinner),Q=q?[{id:'rest',label:'Rest of today',w:{from:(0,h.fromMins)(w),to:(0,h.fromMins)(f.to)}},{id:'hour',label:'Next hour',w:{from:(0,h.fromMins)(w),to:(0,h.fromMins)(Math.min(f.to,w+60))}},{id:'lunch',label:'Lunch',w:U},{id:'dinner',label:'Dinner',w:K}]:[],V=!!P.from&&!!P.to&&(0,h.toMins)(P.to)>(0,h.toMins)(P.from)&&!(W.tables&&!W.tables.length),J=V?(0,u.confirmLine)({dates:[g],from:P.from,to:P.to,today:g,...W}):'',X=V?(0,u.bookingsInWindow)(B,[g],P.from,P.to,W,e=>C.tables.find(t=>t.name===e)?.areaId).length:0;return(0,y.jsx)(m.Sheet,{visible:!0,onClose:n,title:"Block now",maxWidth:a?760:void 0,testID:"block-now-sheet",children:'done'===O?(0,y.jsxs)(i.default,{style:{gap:10},accessibilityLiveRegion:"polite",children:[(0,y.jsx)(m.T,{size:19,weight:"semibold",colour:b.colours.gold,testID:"block-now-done",children:G}),(0,y.jsx)(m.Muted,{children:"The customer app stops offering these times. Staff see the block on the plan and the timeline."}),(0,y.jsx)(m.Button,{label:"Done",onPress:n,testID:"block-now-close"})]}):'confirm'===O?(0,y.jsxs)(i.default,{style:{gap:10},children:[(0,y.jsx)(S,{line:J,clashes:X}),(0,y.jsx)(m.Button,{testID:"block-now-save",label:"Save block",onPress:()=>{const t=r.useBlocks.getState().add({rid:e,date:g,from:P.from,to:P.to,reason:N,note:A.trim()||void 0,by:l,...W});(0,x.pushBlocksToWix)(e,[t.id],'add'),Y(`Saved. ${J.replace(/^Block/,'Blocked')}.`),j(`Saved. ${J}`),_('done')}}),(0,y.jsx)(m.Button,{kind:"ghost",label:"Change",onPress:()=>_('pick')})]}):(0,y.jsxs)(i.default,{style:{gap:12},children:[(0,y.jsx)(m.Muted,{children:"Tip: pick a time, then check the one-line summary before you save. Bookings already made are kept."}),q?(0,y.jsxs)(i.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"block-now-quick",children:[Q.map(e=>(0,y.jsx)(D,{wide:!0,testID:`block-now-${e.id}`,label:e.label,sub:e.w?(0,u.rangeText)(e.w.from,e.w.to):'Not today',disabled:!e.w,selected:!R&&P.label===e.id,onPress:()=>{L(!1),M({...e.w,label:e.id})}},e.id)),(0,y.jsx)(D,{wide:!0,testID:"block-now-custom",label:"From\u2013To",sub:"Pick the times",selected:R,onPress:()=>{L(!0),M({})}})]}):(0,y.jsx)(m.T,{colour:b.colours.amber,children:"Closed for the rest of today. Use Add a block for another day."}),q&&R?(0,y.jsx)(v,{min:w,max:f.to,from:P.from,to:P.to,onChange:(e,t)=>M({from:e,to:t}),testID:"block-now-grid"}):null,q?(0,y.jsx)(I,{rid:e,value:W,onChange:z}):null,q?(0,y.jsx)(T,{value:N,note:A,onChange:E,onNote:F}):null,V?(0,y.jsx)(m.T,{size:16,weight:"semibold",colour:b.colours.goldLight,testID:"block-now-line",children:J}):null,(0,y.jsx)(m.Button,{testID:"block-now-next",label:"Check and save",disabled:!V,onPress:()=>_('confirm')})]})})}function C({value:e,end:t,range:o,min:l,onPick:a,testID:d="block-cal"}){const[r,c]=(0,s.useState)(()=>(e??l).slice(0,7)),g=(0,h.parseYmd)(`${r}-01`),x=(g.getDay()+6)%7,p=[...Array(x).fill(null)];for(let e=new Date(g);e.getMonth()===g.getMonth();e.setDate(e.getDate()+1))p.push((0,h.ymd)(e));const f=e=>{const t=(0,h.parseYmd)(`${r}-01`);t.setMonth(t.getMonth()+e),c((0,h.ymd)(t).slice(0,7))},k=s=>{if(!o||!e||t||sf(-1)}),(0,y.jsx)(m.T,{size:18,weight:"semibold",colour:b.colours.gold,accessibilityRole:"header",children:(0,u.monthLabel)(`${r}-01`)}),(0,y.jsx)(m.Button,{small:!0,kind:"secondary",label:"Later \u203a",accessibilityLabel:"Next month",onPress:()=>f(1)})]}),(0,y.jsx)(i.default,{style:{flexDirection:'row'},children:['Mon','Tue','Wed','Thu','Fri','Sat','Sun'].map(e=>(0,y.jsx)(m.T,{size:13,colour:b.colours.muted,center:!0,style:{flex:1},children:e},e))}),(0,y.jsx)(i.default,{style:{flexDirection:'row',flexWrap:'wrap'},children:p.map((s,o)=>{if(!s)return(0,y.jsx)(i.default,{style:{width:"14.285714285714286%",height:48}},`e${o}`);const a=se&&sk(s),style:{height:46,borderRadius:10,alignItems:'center',justifyContent:'center',backgroundColor:r?b.colours.gold:b.colours.surface2,borderWidth:1,borderColor:r?b.colours.gold:b.colours.border,opacity:a?.3:1},children:(0,y.jsx)(m.T,{size:17,weight:"semibold",colour:r?b.colours.onGold:b.colours.text,children:String((0,h.parseYmd)(s).getDate())})})},s)})})]})}function P({rid:e,r:t,now:o,by:l,onClose:n,wide:a,edit:g,onEdit:p}){const f=(0,h.ymd)(o),$=(0,d.useBookings)(e),B=(0,c.usePlan)(e),[P,M]=(0,s.useState)(g?.date),[R,L]=(0,s.useState)(),[W,z]=(0,s.useState)(!1),[N,E]=(0,s.useState)(g?!!g.wholeDay:null),[A,F]=(0,s.useState)(g&&!g.wholeDay?g.from:void 0),[O,_]=(0,s.useState)(g&&!g.wholeDay?g.to:void 0),[G,Y]=(0,s.useState)(g?{areaId:g.areaId,areaName:g.areaName,tables:g.tables}:{}),[q,H]=(0,s.useState)(g?.reason),[U,K]=(0,s.useState)(g?.note??''),[Q,V]=(0,s.useState)('none'),[J,X]=(0,s.useState)([]),[Z,ee]=(0,s.useState)(),[te,se]=(0,s.useState)(!1),[oe,le]=(0,s.useState)('pick'),[ne,ae]=(0,s.useState)(''),ie=P?(0,u.openWindow)(t,P):null,de=ie?.from??540,re=ie?.to??1380,ce=P?(0,h.parseYmd)(P).getDay():0,ue='weekly'===Q?{kind:'weekly',days:J.length?J:[ce]}:'last'===Q?{kind:'last',weekday:ce}:{kind:'none'},he=P?g?[P]:(0,u.blockDates)(P,W?R:void 0,ue,Z):[],be=N?'00:00':A,ge=N?'23:59':O,me=!!P&&he.length>0&&null!=N&&!!be&&!!ge&&(0,h.toMins)(ge)>(0,h.toMins)(be)&&('none'===Q||!!Z)&&!(G.tables&&!G.tables.length),xe=(0,u.repeatText)(ue,Z),pe=me?(0,u.confirmLine)({dates:he,from:be,to:ge,wholeDay:!!N,today:f,repeat:xe,...G}):'',fe=me?(0,u.bookingsInWindow)($,he,be,ge,G,e=>B.tables.find(t=>t.name===e)?.areaId).filter(e=>e.id!==g?.id).length:0;return(0,y.jsx)(m.Sheet,{visible:!0,onClose:n,title:g?'Edit block':'Add a block',maxWidth:a?760:void 0,testID:"add-block-sheet",children:'done'===oe?(0,y.jsxs)(i.default,{style:{gap:10},accessibilityLiveRegion:"polite",children:[(0,y.jsx)(m.T,{size:19,weight:"semibold",colour:b.colours.gold,testID:"add-block-done",children:ne}),(0,y.jsx)(m.Muted,{children:"It shows in Future blocks. The customer app won't offer these times."}),(0,y.jsx)(m.Button,{label:"Done",onPress:n,testID:"add-block-close"})]}):'confirm'===oe?(0,y.jsxs)(i.default,{style:{gap:10},children:[(0,y.jsx)(S,{line:pe,clashes:fe,testID:"add-block-confirm"}),(0,y.jsx)(m.Button,{testID:"add-block-save",label:g?'Save changes':'Save block',onPress:()=>{const t={from:be,to:ge,wholeDay:!!N||void 0,reason:q,note:U.trim()||void 0,areaId:G.areaId,areaName:G.areaName,tables:G.tables?.length?G.tables:void 0};if(g)return p?.({...t,date:P}),ae(`Saved. ${pe.replace(/^Block/,'Blocked')}.`),void le('done');const s=he.length>1?`s-${Date.now().toString(36)}`:void 0,o=r.useBlocks.getState().addMany(he.map(o=>({rid:e,date:o,by:l,...t,seriesId:s,repeatText:xe??(he.length>1?`${(0,u.longDate)(he[0])} to ${(0,u.longDate)(he[he.length-1])}`:void 0),until:'none'!==Q?Z:void 0})));(0,x.pushBlocksToWix)(e,o.map(e=>e.id),'add'),ae(`Saved. ${pe.replace(/^Block/,'Blocked')}.`),j(`Saved. ${pe}`),le('done')}}),(0,y.jsx)(m.Button,{kind:"ghost",label:"Change",onPress:()=>le('pick')})]}):(0,y.jsxs)(i.default,{style:{gap:12},children:[(0,y.jsx)(m.Muted,{children:"Tip: tap a date (or a first and last date for a range), choose Whole day or the times, then check the summary."}),g?null:(0,y.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,y.jsx)(m.Chip,{testID:"add-single",label:"One date",selected:!W,onPress:()=>{z(!1),L(void 0)}}),(0,y.jsx)(m.Chip,{testID:"add-range",label:"A range of dates",selected:W,onPress:()=>{z(!0),V('none')}})]}),(0,y.jsx)(C,{value:P,end:R,range:W&&!g,min:f,onPick:(e,t)=>{M(e),L(t)}}),P?(0,y.jsx)(m.T,{size:16,weight:"semibold",colour:b.colours.goldLight,testID:"add-dates",children:W&&R?`${(0,u.longDate)(P)} to ${(0,u.longDate)(R)}`:(0,u.longDate)(P)}):null,P?(0,y.jsxs)(i.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,y.jsx)(D,{wide:!0,testID:"add-whole-day",label:"Whole day",selected:!0===N,onPress:()=>E(!0)}),(0,y.jsx)(D,{wide:!0,testID:"add-times",label:"From\u2013To",sub:ie?`Open ${(0,u.rangeText)((0,h.fromMins)(ie.from),(0,h.fromMins)(ie.to))}`:'Closed that day',selected:!1===N,onPress:()=>E(!1)})]}):null,P&&!1===N?(0,y.jsx)(v,{min:de,max:re,from:A,to:O,onChange:(e,t)=>{F(e),_(t)},testID:"add-grid"}):null,P?(0,y.jsx)(I,{rid:e,value:G,onChange:Y}):null,P?(0,y.jsx)(T,{value:q,note:U,onChange:H,onNote:K}):null,!P||g||W?null:(0,y.jsxs)(i.default,{style:{gap:6},testID:"add-repeat",children:[(0,y.jsx)(m.T,{size:15,weight:"semibold",children:"Repeat (optional)"}),(0,y.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,y.jsx)(m.Chip,{testID:"repeat-none",label:"Does not repeat",selected:'none'===Q,onPress:()=>V('none')}),(0,y.jsx)(m.Chip,{testID:"repeat-weekly",label:"Every week",selected:'weekly'===Q,onPress:()=>{V('weekly'),J.length||X([ce])}}),(0,y.jsx)(m.Chip,{testID:"repeat-last",label:`Last ${k[ce]} of the month`,selected:'last'===Q,onPress:()=>V('last')})]}),'weekly'===Q?(0,y.jsx)(m.Row,{wrap:!0,gap:6,children:w.map((e,t)=>(0,y.jsx)(m.Chip,{testID:`repeat-day-${t}`,label:e,selected:J.includes(t),onPress:()=>X(J.includes(t)?J.filter(e=>e!==t):[...J,t])},e))}):null,'none'!==Q?(0,y.jsxs)(i.default,{style:{gap:6},children:[(0,y.jsx)(m.T,{size:15,weight:"semibold",children:"Until (needed)"}),(0,y.jsxs)(m.Row,{wrap:!0,gap:6,children:[[1,3,6,12].map(e=>{const t=(0,h.parseYmd)(P);t.setMonth(t.getMonth()+e);const s=(0,h.ymd)(t);return(0,y.jsx)(m.Chip,{testID:`until-${e}`,label:12===e?'1 year':`${e} month${e>1?'s':''}`,selected:Z===s,onPress:()=>{ee(s),se(!1)}},e)}),(0,y.jsx)(m.Chip,{testID:"until-pick",label:"Pick a date",selected:te,onPress:()=>se(!0)})]}),te?(0,y.jsx)(C,{value:Z,min:(0,u.addDays)(P,1),onPick:e=>ee(e),testID:"until-cal"}):null,Z?(0,y.jsx)(m.Muted,{children:`${xe} \xb7 ${he.length} date${1===he.length?'':'s'}`}):null]}):null]}),me?(0,y.jsx)(m.T,{size:16,weight:"semibold",colour:b.colours.goldLight,testID:"add-line",children:pe}):null,(0,y.jsx)(m.Button,{testID:"add-block-next",label:"Check and save",disabled:!me,onPress:()=>le('confirm')})]})})}function M({b:e,onEdit:t,onRemove:s}){const o=(0,u.whatText)(e);return(0,y.jsxs)(i.default,{testID:`fb-${e.id}`,style:{borderWidth:1,borderColor:b.colours.border,borderRadius:12,padding:12,gap:4,backgroundColor:b.colours.surface2},accessible:!1,children:[(0,y.jsxs)(m.T,{size:17,weight:"semibold",colour:b.colours.goldLight,children:[(0,u.longDate)(e.date)," \xb7 ",(0,u.rangeText)(e.from,e.to,e.wholeDay)]}),(0,y.jsxs)(m.T,{children:[o,e.reason?` \xb7 ${e.reason}`:'',e.note?` \xb7 ${e.note}`:'']}),e.repeatText?(0,y.jsx)(m.Muted,{children:e.repeatText}):null,(0,y.jsxs)(m.Muted,{size:13,children:["Added by ",e.by||'staff',e.editedBy?` \xb7 changed by ${e.editedBy}`:'']}),(0,y.jsxs)(m.Row,{gap:8,children:[(0,y.jsx)(m.Button,{small:!0,kind:"secondary",label:"Edit",accessibilityLabel:`Edit the block on ${(0,u.longDate)(e.date)}`,testID:`fb-edit-${e.id}`,onPress:t}),(0,y.jsx)(m.Button,{small:!0,kind:"ghost",label:"Remove",accessibilityLabel:`Remove the block on ${(0,u.longDate)(e.date)}`,testID:`fb-remove-${e.id}`,onPress:s})]})]})}function R({rid:e,r:t,now:o,by:l,display:n,wide:a}){const d=(0,r.useBlocks)(e=>e.blocks),c=(0,h.ymd)(o),g=(0,u.groupByMonth)(d,e,c,(0,h.hm)(o)),k=(0,s.useMemo)(()=>(0,u.ruleRows)(t,c),[t.id,c]),[w,D]=(0,s.useState)(null),[v,I]=(0,s.useState)(null),[T,S]=(0,s.useState)(''),$=e=>e.seriesId?d.filter(t=>t.seriesId===e.seriesId&&t.date>=c):[e],B=t=>{const s=t.length>1?`${t.length} blocks removed`:`Block on ${(0,u.longDate)(t[0].date)} removed`;if(!n)return t.forEach(e=>r.useBlocks.getState().remove(e.id,l)),(0,x.pushBlocksToWix)(e,t.map(e=>e.id),'remove'),S(`${s}. Bookings are open again for that time.`),j(s),void I(null);(async()=>{for(const e of t){if(!((0,f.isLive)()?await(0,p.displayBlockEdit)(e.id,'remove',{},l):{ok:!0}).ok)return void S('Could not remove it. Try again.');(0,f.isLive)()||r.useBlocks.getState().remove(e.id,l)}(0,x.pushBlocksToWix)(e,t.map(e=>e.id),'remove'),S(`${s}. Bookings are open again for that time.`),j(s),I(null)})()},C=(t,s)=>{if(!n)return r.useBlocks.getState().update(t.id,s,l),void(0,x.pushBlocksToWix)(e,[t.id],'edit');(async()=>{((0,f.isLive)()?await(0,p.displayBlockEdit)(t.id,'edit',s,l):{ok:!0}).ok?((0,f.isLive)()||r.useBlocks.getState().update(t.id,s,l),(0,x.pushBlocksToWix)(e,[t.id],'edit'),S(`Block on ${(0,u.longDate)(s.date??t.date)} changed.`)):S('Could not change it. Try again.')})()},R=[...new Set([...g.map(e=>e.month),...k.map(e=>(0,u.monthLabel)(e.date))])].sort((e,t)=>Date.parse(`1 ${e}`)-Date.parse(`1 ${t}`));return(0,y.jsxs)(i.default,{style:{gap:12},testID:"future-blocks",children:[T?(0,y.jsx)(i.default,{accessibilityLiveRegion:"polite",children:(0,y.jsx)(m.T,{colour:b.colours.goldLight,testID:"fb-msg",children:T})}):null,g.length?null:(0,y.jsx)(m.Muted,{testID:"fb-empty",children:"No blocks coming up. Online and staff bookings are open as normal."}),R.map(e=>{const t=g.find(t=>t.month===e)?.items??[],s=k.filter(t=>(0,u.monthLabel)(t.date)===e);return(0,y.jsxs)(i.default,{style:{gap:8},children:[(0,y.jsx)(m.T,{size:18,weight:"semibold",colour:b.colours.gold,accessibilityRole:"header",children:e}),t.map(e=>(0,y.jsx)(M,{b:e,onEdit:()=>D(e),onRemove:()=>I(e)},e.id)),s.map(e=>(0,y.jsxs)(i.default,{testID:`fb-rule-${e.date}`,style:{borderWidth:1,borderStyle:'dashed',borderColor:b.colours.border,borderRadius:12,padding:10,gap:2},children:[(0,y.jsxs)(m.T,{weight:"semibold",children:[(0,u.longDate)(e.date)," \xb7 ",e.name]}),(0,y.jsxs)(m.Muted,{children:[e.text," \xb7 regular rule, set in Settings \u203a Advanced \u203a Regular events"]})]},`${e.name}-${e.date}`))]},e)}),w?(0,y.jsx)(P,{rid:e,r:t,now:o,by:l,wide:a,edit:w,onClose:()=>D(null),onEdit:e=>C(w,e)}):null,v?(0,y.jsxs)(m.Sheet,{visible:!0,onClose:()=>I(null),title:"Remove this block?",testID:"fb-remove-confirm",children:[(0,y.jsx)(m.T,{size:17,children:`${(0,u.longDate)(v.date)}, ${(0,u.rangeText)(v.from,v.to,v.wholeDay)}, ${(0,u.whatText)(v).toLowerCase()}.`}),(0,y.jsx)(m.Muted,{children:"Bookings open again for that time. The removal is kept in the log."}),(0,y.jsx)(m.Button,{testID:"fb-remove-one",label:$(v).length>1?'Remove this date only':'Remove block',onPress:()=>B([v])}),$(v).length>1?(0,y.jsx)(m.Button,{testID:"fb-remove-series",kind:"secondary",label:`Remove all ${$(v).length} in this series`,onPress:()=>B($(v))}):null,(0,y.jsx)(m.Button,{kind:"ghost",label:"Keep it",onPress:()=>I(null)})]}):null]})}function L({rid:e,r:t,now:o,by:l,display:n,wide:a}){const[d,r]=(0,s.useState)(null);return(0,y.jsxs)(i.default,{style:{gap:12},testID:"blocks-screen",children:[(0,y.jsx)(m.Muted,{children:"Tip: Block now pauses new bookings today. Add a block closes a future date, a time, an area or some tables, once or every week. Existing bookings are always kept."}),(0,y.jsxs)(i.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,y.jsx)(D,{wide:!0,testID:"blocks-now",label:"Block now",sub:"Today",onPress:()=>r('now')}),(0,y.jsx)(D,{wide:!0,testID:"blocks-add",label:"Add a block",sub:"Future dates",onPress:()=>r('add')})]}),(0,y.jsx)(m.T,{size:20,weight:"semibold",children:"Future blocks"}),(0,y.jsx)(R,{rid:e,r:t,now:o,by:l,display:n,wide:a}),'now'===d?(0,y.jsx)(B,{rid:e,r:t,now:o,by:l,wide:a,onClose:()=>r(null)}):null,'add'===d?(0,y.jsx)(P,{rid:e,r:t,now:o,by:l,wide:a,onClose:()=>r(null)}):null]})}function W({rid:e,r:t,now:s,by:o,onBack:n}){return(0,g.useBackLayer)(!0,n),(0,y.jsx)(l.default,{visible:!0,animationType:"fade",onRequestClose:n,children:(0,y.jsxs)(i.default,{style:{flex:1,backgroundColor:b.colours.bg,padding:16},testID:"display-blocks-screen",children:[(0,y.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(g.BackButton,{onPress:n,testID:"display-blocks-back"}),(0,y.jsx)(m.T,{size:22,weight:"semibold",colour:b.colours.gold,children:"Block bookings"}),(0,y.jsx)(i.default,{style:{width:96}})]}),(0,y.jsx)(a.default,{contentContainerStyle:{paddingBottom:40,maxWidth:900,width:'100%',alignSelf:'center'},children:(0,y.jsx)(L,{rid:e,r:t,now:s,by:o,display:!0,wide:!0})})]})})}},1024,[808,30,118,256,263,151,127,819,824,825,1392,818,821,992,813,1393,955,820,24]); +__d(function(g,_r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ANCHORAGE_ID",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"isAnchorage",{enumerable:!0,get:function(){return n}}),e.isBarFridge=r,Object.defineProperty(e,"chefCanSee",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"demoActor",{enumerable:!0,get:function(){return s}}),e.hasRealSignature=c,e.isDemoCard=function(t){return!c(t)&&(['example','sample','demo'].includes(t.origin||'')||s(t.updatedBy))},Object.defineProperty(e,"isSeedChefChat",{enumerable:!0,get:function(){return u}});const t='6349aa07-3fec-46e9-8c69-7b1b08494793',n=n=>'anchorage'===n||n===t;function r(t){if('string'==typeof t)return/\bbar[\s_-]*(?:fridge|refrigerat)|\b(?:fridge|refrigerator)[\s_-]*(?:in[\s_-]*the[\s_-]*)?bar\b|^cp-bar$/i.test(t);if(!t||'object'!=typeof t)return!1;const n=t;return!!r(['name','label','kind','unit','location','storage','storageLocation'].map(t=>n[t]).filter(t=>'string'==typeof t).join(' '))||['id','key','pointId','name','label','unit','location','storage','storageLocation','aliases'].some(t=>Array.isArray(n[t])?n[t].some(r):'string'==typeof n[t]&&r(n[t]))}const o=(t,o)=>!n(t)||!r(o),s=t=>'string'==typeof t&&/(?:\b(?:example|sample|demo)\b)/i.test(t);function c(t){return[t.signOff?.by,t.allergensConfirmed?.by].some(t=>!!t&&!s(t))}const f={'m-seed-all':'Welcome to the team chat on CoverCharge.','m-seed-kitchen':'Kitchen channel: Head Chef, kitchen team and managers.','m-seed-foh':'Front of house channel: front of house, bar and managers.','m-seed-managers':'Managers channel: owners, managers and the supervisor only.'},u=t=>'system'===t.from&&(!!f[t.id]&&f[t.id]===t.text||'m-seed-all'===t.id&&/this phone only/.test(t.text||''))},1025,[]); +__d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"KG_PER_STONE",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"HALF_STONE_KG",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"isFishName",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"fishInStone",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"halfStone",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"toStone",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"fromStone",{enumerable:!0,get:function(){return c}}),e.stoneText=b,e.stoneSpeech=h,Object.defineProperty(e,"fishQtyText",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"fishQtySpeech",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"quantityStep",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"stepQuantity",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"inputQuantity",{enumerable:!0,get:function(){return P}}),Object.defineProperty(e,"quantityUnit",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"displayedCost",{enumerable:!0,get:function(){return k}}),e.parseStoneAmount=function(t){if('number'==typeof t)return Number.isFinite(t)?t:void 0;const n=t.toLowerCase().trim();if(/\b(?:kg|kilos?|kilograms?|grams?)\b/.test(n))return;const i=n.match(/(?:^|\s)(\d+(?:[.,]\d+)?)(\xbd)?(?:\s*(?:stone|st)\b|$)/);if(i)return Number(i[1].replace(',','.'))+(i[2]?.5:0);const o=n.match(/\b(zero|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve|thirteen|fourteen|fifteen|sixteen|seventeen|eighteen|nineteen|twenty)(?: and a half)?(?: stone| st|$)/);return o?l.indexOf(o[1])+(/and a half/.test(o[0])?.5:0):/(?:^|\s)(?:\xbd|(?:a )?half(?: a)?)(?: stone| st|$)/.test(n)?.5:void 0};var t=r(d[0]);const n=6.35029318,i=3.17514659,o=(t="")=>!/\b(?:vegan|vegetarian|banana|blossom|mushroom|sauce|stock|oil)\b|\(vg\)/i.test(t)&&/\b(?:fish|haddock|salmon|cod|hake|halibut|plaice|sole|turbot|trout|mackerel|monkfish|seabass|sea bass|seabream|sea bream|tuna|pollock|coley|whiting|sardines?|anchov(?:y|ies)|herring)\b/i.test(t),u=(n,i)=>(0,t.isAnchorage)(n)&&/^(kg|kilos?|kilograms?|st|stone)$/i.test(i.unit||'')&&o(i.name),s=t=>Math.round(2*(t+Number.EPSILON))/2,f=(t,i="kg")=>/^(st|stone)$/i.test(i)?t:t/n,c=(t,i="kg")=>/^(st|stone)$/i.test(i)?t:t*n;function b(t){const n=s(Math.abs(t)),i=Math.floor(n);return`${t<0&&n?'\u2212':''}${n%1?`${i||''}\xbd`:i} stone`}const l=['zero','one','two','three','four','five','six','seven','eight','nine','ten','eleven','twelve','thirteen','fourteen','fifteen','sixteen','seventeen','eighteen','nineteen','twenty'];function h(t){const n=s(Math.abs(t)),i=Math.floor(n);return`${t<0&&n?'minus ':''}${n%1?i?`${l[i]||i} and a half`:'half a':l[i]||i} stone`}const y=(t,n,i)=>u(t,n)?b(f(i,n.unit)):`${i} ${n.unit||''}`.trim(),p=(t,n,i)=>u(t,n)?h(f(i,n.unit)):y(t,n,i),O=(t,n)=>u(t,n)?c(.5,n.unit):'kg'===n.unit?.5:1,v=(t,n,i,o)=>u(t,n)?c(Math.max(0,s(f(i,n.unit))+.5*o),n.unit):Math.max(0,i+o*O(t,n)),P=(t,n,i)=>u(t,n)?c(s(i),n.unit):i,j=(t,n)=>u(t,n)?'stone':n.unit||'',k=(t,n,i)=>u(t,n)?i*c(1,n.unit):i},1026,[1025]); +__d(function(g,r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useShellStore",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"localShellfish",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"shellfish",{enumerable:!0,get:function(){return E}}),Object.defineProperty(_e,"useStockItems",{enumerable:!0,get:function(){return I}}),_e.venueCounts=w,_e.useShellfish=function(e,t,s){const a=I(e).filter(t=>'chef'!==s||(0,n.chefCanSee)(e,t)),o=_(t=>!!t.server[e]),d=_((0,l.useShallow)(t=>t.events.filter(s=>s.rid===e&&(!t.server[e]||k(s))))),u=_((0,l.useShallow)(t=>w(t,e))),c=(0,f.lastUndoable)(d),v=e=>a.find(t=>t.key===e);return{items:a,events:d,counts:u,undoable:c,synced:o,itemOf:v,isLow:e=>(0,f.isLowItem)(v(e),u[e]??0),sell:(n,a=!1)=>{const o=v(n),d=o&&(0,i.fishInStone)(e,o)?i.HALF_STONE_KG:a?.5:1;return!((u[n]??0){i>0&&E.append({rid:e,kind:n,delta:i,reason:'delivery',by:t,app:s})},recount:(n,i)=>{const a=i-(u[n]??0);a&&E.append({rid:e,kind:n,delta:a,reason:'count',by:t,app:s})},undoLast:()=>{c&&E.append({rid:e,kind:c.kind,delta:-c.delta,reason:'undo',by:t,app:s,undoes:c.id})}}};var e,t=r(_d[0]),s=r(_d[1]),n=r(_d[2]),i=r(_d[3]),a=r(_d[4]),o=r(_d[5]),d=(e=o)&&e.__esModule?e:{default:e};r(_d[6]);var u=r(_d[7]),c=r(_d[8]),l=r(_d[9]),f=r(_d[10]),v=r(_d[11]),p=r(_d[12]);const S=()=>{try{return(0,p.nowFrom)(p.useStore.getState().clock)}catch{return new Date}},h='covercharge-shellfish-v1',y='anchorage',_=(0,u.create)()((0,c.persist)(e=>({events:[],items:a.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD?{}:{[y]:f.ANCHORAGE_STOCK.map(e=>({...e}))},server:{},saveItem:(t,s)=>e(e=>{const n=e.items[t]??[];return{items:{...e.items,[t]:n.some(e=>e.key===s.key)?n.map(e=>e.key===s.key?s:e):[...n,s]}}}),removeItem:(t,s)=>e(e=>({items:{...e.items,[t]:(e.items[t]??[]).filter(e=>e.key!==s)}}))}),{name:h,storage:(0,c.createJSONStorage)(()=>d.default),version:4,partialize:e=>({events:e.events,items:e.items,server:e.server}),migrate:async e=>{t.LIVE_VENUE_BUILD&&e&&await(0,s.archiveChefCache)('tracked-stock',e);const n=e??{};return{events:(i=n.events,(i??[]).filter(e=>!e.id.startsWith('sf-seed-'))),items:n.items??(a.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD?{}:{[y]:f.ANCHORAGE_STOCK.map(e=>({...e}))}),server:n.server??{}};var i}})),b={list:e=>_.getState().events.filter(t=>t.rid===e),append:e=>{const t={...e,id:(0,v.uuid)(),at:e.at??S().toISOString()};return _.setState(e=>({events:[t,...e.events].slice(0,500)})),t},subscribe:e=>_.subscribe(e)},E=b;'undefined'!=typeof window&&window.addEventListener('storage',e=>{e.key===h&&_.persist.rehydrate()});const O=[],I=(e,t=!1)=>{const s=_(t=>t.items[e])??O;return t?s:s.filter(e=>e.active).sort((e,t)=>e.sort-t.sort)},k=e=>!e.id.startsWith('sf-');function w(e,t){const s=e.items[t]??[],n=e.server[t],i=e.events.filter(e=>e.rid===t);if(!n)return(0,f.countsOf)(i,s);const a=new Set(n.seen),o=new Date(Date.now()-2592e5).toISOString();return(0,f.countsOf)(i.filter(e=>k(e)&&!a.has(e.id)&&e.at>=o),s,n.counts)}},1027,[833,1132,1025,1026,5,1116,122,952,1117,873,1029,1034,872]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useOrderSheets",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"useSheets",{enumerable:!0,get:function(){return f}});var e,s=r(d[0]),t=r(d[1]),h=r(d[2]),n=r(d[3]),o=(e=n)&&e.__esModule?e:{default:e},c=r(d[4]),i=r(d[5]),u=r(d[6]);const p=()=>h.IS_ISOLATED_VENUE||s.LIVE_VENUE_BUILD?{}:{anchorage:u.ANCHORAGE_SHEETS.filter(e=>!e.placeholder).map(e=>({...e,items:e.items.map(e=>({...e}))}))},l=(0,c.create)()((0,i.persist)(e=>({sheets:p(),opened:{},upsert:(s,t)=>e(e=>{const h=e.sheets[s]??[];return{sheets:{...e.sheets,[s]:h.some(e=>e.id===t.id)?h.map(e=>e.id===t.id?t:e):[...h,t]}}}),patch:(s,t,h)=>e(e=>({sheets:{...e.sheets,[s]:(e.sheets[s]??[]).map(e=>e.id===t?{...e,...h}:e)}})),remove:(s,t)=>e(e=>({sheets:{...e.sheets,[s]:(e.sheets[s]??[]).filter(e=>e.id!==t)}})),markOpened:(s,t)=>e(e=>({opened:{...e.opened,[s]:t}})),reset:s=>e(e=>({sheets:{...e.sheets,[s]:'anchorage'===s&&p().anchorage||[]}}))}),{name:'covercharge-ordersheets-v1',storage:(0,i.createJSONStorage)(()=>o.default),version:3,migrate:async e=>{const h=e;return s.LIVE_VENUE_BUILD?(await(0,t.archiveChefCache)('order-sheets',h),{...h,sheets:{...h.sheets,anchorage:(h.sheets.anchorage||[]).filter(e=>!('os-veg'===e.id&&e.placeholder))}}):h}})),_=[],f=e=>l(s=>s.sheets[e])??_},1028,[833,1132,5,1116,952,1117,1023]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ANCHORAGE_STOCK",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"stockKey",{enumerable:!0,get:function(){return n}}),_e.countsOf=function(e,t=[],n={}){const s={...n};for(const e of t)s[e.key]=s[e.key]??0;for(const t of e)s[t.kind]=(s[t.kind]??0)+t.delta;const i=new Map(t.map(e=>[e.key,e]));return Object.fromEntries(Object.entries(s).map(([e,t])=>[e,o(i.get(e),t)]))},_e.lastUndoable=function(e){const t=new Set(e.filter(e=>e.undoes).map(e=>e.undoes));return e.find(e=>'undo'!==e.reason&&'count'!==e.reason&&!t.has(e.id))},Object.defineProperty(_e,"fmtCount",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"fmtStockCount",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"speakStockCount",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"isLowItem",{enumerable:!0,get:function(){return c}}),_e.describe=function(e,t){const n=(t?.name??e.kind).toLowerCase(),o=(t?.plural??`${e.kind}s`).toLowerCase(),u=t?i(e.rid,t,Math.abs(e.delta)):s(Math.abs(e.delta));return'delivery'===e.reason?`Delivery in: +${u} ${1===Math.abs(e.delta)?n:o}`:'sold-half'===e.reason?`Sold: half ${n}`:'sold'===e.reason?`Sold: ${u} ${1===Math.abs(e.delta)?n:o}`:'undo'===e.reason?`Undo (${e.delta>0?'+':'\u2212'}${u} ${n})`:`Count: ${u} ${o}`};var e=r(d[0]);const t=[{key:'lobster',name:'Lobster',plural:'Lobsters',unit:'half',lowAt:4,supplierId:'os-kittyfisher',icon:'\ud83e\udd9e',sort:1,active:!0},{key:'crab',name:'Crab',plural:'Crabs',unit:'whole',lowAt:4,supplierId:'os-kittyfisher',icon:'\ud83e\udd80',sort:2,active:!0}],n=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,'-').replace(/^-|-$/g,'').slice(0,40)||'item',o=(e,t)=>Math.max(0,'kg'===e?.unit?t:'half'===e?.unit?Math.round(2*t)/2:Math.round(t));const s=e=>{const t=Math.floor(e);return e-t>=.5?t?`${t}\xbd`:'\xbd':String(t)},i=(t,n,o)=>'kg'===n.unit?(0,e.fishQtyText)(t,n,o):s(o),u=(t,n,o)=>'kg'===n.unit?(0,e.fishQtySpeech)(t,n,o):s(o),c=(e,t)=>t<=(e?.lowAt??4)},1029,[1026]); +__d(function(g,_r,i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.gamesOn=function(){const e=m.useStore.getState().restaurants.find(e=>e.id===p.VENUE_RID);return!1!==e?.settings?.games},_e.usePlayable=v,Object.defineProperty(_e,"LENNY_GAME_URL",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"validGameUrl",{enumerable:!0,get:function(){return I}}),_e.gameBase=function(){const e=m.useStore.getState().restaurants.find(e=>e.id===p.VENUE_RID);return I(e?.settings?.gameUrl)??j},_e.BreakRoomCard=function({staffId:e,name:t,now:s}){const n=(0,m.useStore)(e=>!1!==e.restaurants.find(e=>e.id===p.VENUE_RID)?.settings?.games),[o,l]=(0,r.useState)(!1),c=v(e,s);return n?(0,k.jsxs)(u.Card,{children:[(0,k.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(u.T,{weight:"semibold",children:"\ud83e\uded6 Break room"}),(0,k.jsx)(u.T,{size:13,colour:c?w.colours.ok:w.colours.muted,children:c?'Open':'Opens on your break'})]}),(0,k.jsx)(u.Muted,{children:"Lenny\u2019s Kitchen Chaos, with the team as characters and a shared leaderboard. Playable on a break or when you\u2019re not clocked in."}),(0,k.jsx)(u.Button,{testID:"break-room-open",kind:"secondary",label:"Open the Break room",onPress:()=>l(!0)}),o?(0,k.jsx)(R,{staffId:e,name:t,playable:c,onClose:()=>l(!1)}):null]}):null},Object.defineProperty(_e,"displayName",{enumerable:!0,get:function(){return S}}),_e.BreakRoom=R;var t=_r(_d[0]),r=_r(_d[1]),s=e(r),n=e(_r(_d[2]));_r(_d[3]);var o=e(_r(_d[4])),l=e(_r(_d[5])),c=_r(_d[6]),u=_r(_d[7]),d=_r(_d[8]),f=_r(_d[9]),y=_r(_d[10]),m=_r(_d[11]),p=_r(_d[12]),h=_r(_d[13]),b=_r(_d[14]),w=_r(_d[15]),k=_r(_d[16]);function v(e,t){const r=(0,f.useOwner)(e=>e.attendance);if(!e)return!0;const s=(0,f.openShiftOf)(r,e,t);return!s||(0,f.isOnBreak)(s)}const j='https://lennys-kitchen-chaos-13e285.deed.page/',I=e=>{try{const t=new URL(String(e??'').trim());return'https:'!==t.protocol||t.username||t.password?null:t.toString()}catch{return null}};function x(e){if('undefined'==typeof window)return null;const t=new URL(e);for(const e of['demo','unlock','name','staffId'])t.searchParams.delete(e);return t.searchParams.set('host','covercharge'),t.searchParams.set('hostOrigin',window.location.origin),{src:t.toString(),origin:t.origin}}const S=e=>String(e??'').replace(/\s*\(.*\)$/,'').replace(/\s+/g,' ').trim().slice(0,24).trim();function R({staffId:e,name:v,playable:R,onClose:E}){const C=(0,f.useOwner)(e=>e.staff),T=(0,d.useAvatars)(e=>e.photos),M=(0,y.useSetup)(e=>e.looks),P=(0,r.useRef)(null),[O,L]=(0,r.useState)({}),[U,N]=(0,r.useState)(!1),[_,B]=(0,r.useState)(null),D=(0,m.useStore)(e=>I(e.restaurants.find(e=>e.id===p.VENUE_RID)?.settings?.gameUrl)??j),$=(0,r.useMemo)(()=>x(D),[D]),q=$?.origin??'',A=(0,b.useSync)(e=>'staff'===e.kind?e.staffRef??null:null),z=!(!A||!e||A===e),G=z?null:A??e??null,V=S(v),[H,W]=(0,r.useState)(''),[F,K]=(0,r.useState)(null),Y=(0,r.useRef)(null),J=(0,r.useRef)(0),Q=(0,r.useRef)(null),X=(0,r.useRef)(R);X.current=R;const Z=(0,r.useMemo)(()=>C.filter(e=>e.active&&!e.name.includes('(example)')),[C]);(0,r.useEffect)(()=>{const e=setTimeout(()=>{const e={};for(const t of Z){const r=document.getElementById(`cc-av-${t.id}`)?.querySelector('svg');r&&(e[t.id]=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(r.outerHTML.includes('xmlns')?r.outerHTML:r.outerHTML.replace('clearTimeout(e)},[Z,M]);const ee=(0,r.useMemo)(()=>Z.map(e=>{const t=T[e.id]?.dataUrl??O[e.id],r={id:e.id,name:S(e.name),role:e.job||e.level||e.role};return t&&(r.avatarUrl=t),r}),[Z,T,O]),te=(0,r.useCallback)(e=>{try{q&&P.current?.contentWindow?.postMessage(e,q)}catch{}},[q]);return(0,r.useEffect)(()=>{const e=async e=>{if(!q||e.origin!==q||e.source!==P.current?.contentWindow)return;const t=e.data;if('string'!=typeof t?.type||!t.type.startsWith('lenny:'))return;if('lenny:ready'===t.type)return B('string'==typeof t.version?String(t.version).slice(0,12):null),void N(!0);const r=String(t.levelId??'').slice(0,40);if('lenny:scores:list'===t.type&&te({type:'lenny:scores:result',reqId:t.reqId,result:await(0,h.listScores)(r,Math.min(50,Number(t.limit)||10))}),'lenny:scores:submit'===t.type){const e=t.entry??{};if(!G||'string'==typeof e.staffId&&e.staffId!==G)return void te({type:'lenny:scores:result',reqId:t.reqId,result:{rank:null,entries:await(0,h.listScores)(r,10),id:null}});const s='string'==typeof e.characterId?e.characterId.slice(0,80):void 0;te({type:'lenny:scores:result',reqId:t.reqId,result:await(0,h.submitScore)(r,{score:Number(e.score)||0,stars:Number(e.stars)||0,badges:Array.isArray(e.badges)?e.badges.map(String).slice(0,30):[],stats:'object'==typeof e.stats&&e.stats?e.stats:{},characterId:s,character:'string'==typeof e.character?e.character.slice(0,60):void 0,staffId:G,name:V})})}'lenny:roundAbandoned'===t.type&&W('The last round was stopped because the player changed. No score was saved.'),'lenny:roundStart'===t.type&&W(''),'lenny:progress'===t.type&&G&&t.staffId===G&&(0,h.saveProgress)(G,t.progress),'lenny:gameComplete'===t.type&&G&&t.staffId===G&&W(!0===t.firstTime?'Game complete! Character select is now unlocked.':'Game complete again. Nice work!')};return window.addEventListener('message',e),()=>window.removeEventListener('message',e)},[te,G,V,q]),(0,r.useEffect)(()=>{N(!1),Y.current=null,Q.current=null},[$?.src]),(0,r.useEffect)(()=>{if(!U)return;const e=e=>{Q.current!==e&&(Q.current=e,te({type:'lenny:setPlayable',playable:e}))},t=z?null:`${G??''}|${V}`;if(t&&Y.current===t)return void e(R);const r=++J.current;Y.current=null,Q.current&&e(!1),t&&(0,h.loadProgress)(G).catch(()=>null).then(s=>{r===J.current&&(te({type:'lenny:setPlayer',name:V,staffId:G,...s?{progress:s}:{}}),Y.current=t,e(X.current))})},[U,z,G,V,R,te]),(0,r.useEffect)(()=>{U&&te({type:'lenny:setRoster',staff:ee})},[U,ee,te]),(0,r.useEffect)(()=>{U&&null!==F&&te({type:'lenny:setMuted',muted:F})},[U,F,te]),(0,k.jsx)(n.default,{visible:!0,animationType:"slide",onRequestClose:E,children:(0,k.jsxs)(l.default,{testID:"break-room",style:{flex:1,backgroundColor:(0,t.soutersSurface)('#000')},children:[(0,k.jsxs)(u.Row,{style:{justifyContent:'space-between',padding:10,backgroundColor:w.colours.bg},children:[(0,k.jsx)(u.T,{weight:"semibold",children:"\ud83e\uded6 Break room"}),(0,k.jsx)(l.default,{testID:R&&!z?'break-playable':'break-locked',accessibilityLabel:_?`Game version ${_}`:void 0,children:(0,k.jsx)(u.T,{size:13,colour:R?w.colours.ok:w.colours.gold,children:z?'Switching player\u2026':R?'On your break: enjoy!':'Back to work! Start a break to play.'})}),(0,k.jsxs)(u.Row,{gap:4,children:[(0,k.jsx)(o.default,{testID:"break-room-mute",accessibilityRole:"button",accessibilityLabel:F?'Turn sound and voice on':'Mute sound and voice',onPress:()=>K(!F),style:{padding:6},children:(0,k.jsx)(u.T,{weight:"semibold",colour:w.colours.gold,children:F?'Sound on':'Mute'})}),(0,k.jsx)(o.default,{testID:"break-room-close",accessibilityRole:"button",onPress:E,style:{padding:6},children:(0,k.jsx)(u.T,{weight:"semibold",colour:w.colours.gold,children:"Close"})})]})]}),H?(0,k.jsx)(l.default,{testID:"break-notice",style:{paddingHorizontal:10,paddingVertical:6,backgroundColor:w.colours.surface},children:(0,k.jsx)(u.T,{size:13,colour:w.colours.muted,children:H})}):null,$?s.default.createElement('iframe',{ref:P,src:$.src,key:$.src,title:'Lenny\u2019s Kitchen Chaos','data-testid':'break-game',allow:'autoplay; fullscreen',style:{flex:1,width:'100%',height:'100%',border:0,background:'#000'}}):(0,k.jsx)(l.default,{style:{flex:1,alignItems:'center',justifyContent:'center'},children:(0,k.jsx)(u.Muted,{children:"The Break room opens in the web app."})}),(0,k.jsx)(l.default,{style:{position:'absolute',left:-9999,top:0,width:64,height:64,opacity:0},pointerEvents:"none",children:Z.map(e=>(0,k.jsx)(l.default,{nativeID:`cc-av-${e.id}`,children:(0,k.jsx)(c.AvatarArt,{spec:null!=M[e.id]?(0,c.specFor)(`${e.id}#look${M[e.id]}`):(0,c.specFor)(e.id,e.name),size:96})},e.id))})]})})}},1030,[868,30,256,122,263,127,953,813,1201,856,1202,872,5,1334,820,821,24]); +__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"fmtH",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"fmtHDay",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"SHIFT_MIN_START",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"SHIFT_MAX_END",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"shiftTitle",{enumerable:!0,get:function(){return f}});var t=r(d[0]);const n=t=>{const n=(Math.round(60*t)%1440+1440)%1440;return`${String(Math.floor(n/60)).padStart(2,'0')}:${String(n%60).padStart(2,'0')}`},u=t=>`${n(t)}${t>=24?' (next day)':''}`,o=7,c=28,f=(n,u)=>`${n.replace(' (example)','')} \xb7 ${(0,t.niceDate)((0,t.parseYmd)(u))}`},1031,[818]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SHIFT_MANAGER_PERMS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"SHIFT_MANAGER_FEATURES",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"SHIFT_MANAGER_EXCLUDED",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"SHIFT_MANAGER_EXCLUDED_WORDS",{enumerable:!0,get:function(){return o}}),e.shiftManagerOn=function(n){return!(!n.inStaffApp||!n.managerAccess||'owner'===n.role)&&(n.live?n.perms.includes('shift.manager'):'staff'===n.app)},e.swapTargets=function(n,t){return n.filter(n=>n.active&&n.id!==t&&'owner'!==n.role)};const n=['bookings.manage','floor.manage','stock.manage','attendance.view','rota.swap','shift.manager'],t=['New, edit and cancel bookings; walk-ins; seat, move and finish tables; deposit status','Tables to clear','Block bookings and close the garden','Allergy checks','Sold out (86) and tracked stock','Who\u2019s clocked in','Approve shift swaps and cover'],s=['wages.view','wages.manage','orders.manage','staff.manage','roles.manage','venue.settings','devices.manage','rota.manage','suppliers.manage','suppliers.order','recipes.edit','recipes.signoff','outbox.view'],o='takings, wages, tips and payouts, HR, billing, venue settings and owner access'},1032,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"isLiveVenue",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"useLiveVenue",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"NOT_SET_UP",{enumerable:!0,get:function(){return f}});var t=r(d[0]),n=r(d[1]);const u=n=>!(t.PITCH||'live'!==n.mode&&'offline'!==n.mode||!n.venueId),o=()=>u(n.useSync.getState()),c=()=>(0,n.useSync)(t=>u(t)),f='Not set up yet'},1033,[2,820]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"uuid",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"isUuid",{enumerable:!0,get:function(){return t}});const x=()=>globalThis.crypto&&'randomUUID'in globalThis.crypto?globalThis.crypto.randomUUID():'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g,x=>{const t=16*Math.random()|0;return('x'===x?t:3&t|8).toString(16)}),t=x=>'string'==typeof x&&/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(x)},1034,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.getCameraPermissionsAsync=l,_e.getMediaLibraryPermissionsAsync=y,_e.requestCameraPermissionsAsync=f,_e.requestMediaLibraryPermissionsAsync=b,Object.defineProperty(_e,"useMediaLibraryPermissions",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"useCameraPermissions",{enumerable:!0,get:function(){return w}}),_e.getPendingResultAsync=async function(){if(s.default.getPendingResultAsync)return s.default.getPendingResultAsync();return null},_e.launchCameraAsync=async function(e={}){if(!s.default.launchCameraAsync)throw new n.UnavailabilityError('ImagePicker','launchCameraAsync');const t=(0,o.mapDeprecatedOptions)(e);return await s.default.launchCameraAsync(c(t))},_e.launchImageLibraryAsync=async function(e={}){const t=(0,o.mapDeprecatedOptions)(e);if(!s.default.launchImageLibraryAsync)throw new n.UnavailabilityError('ImagePicker','launchImageLibraryAsync');t?.allowsEditing&&t.allowsMultipleSelection&&console.warn("[expo-image-picker] `allowsEditing` is not supported when `allowsMultipleSelection` is enabled and will be ignored.Disable either 'allowsEditing' or 'allowsMultipleSelection' in 'launchImageLibraryAsync' to fix this warning.");return await s.default.launchImageLibraryAsync(t)},Object.defineProperty(_e,"PermissionStatus",{enumerable:!0,get:function(){return n.PermissionStatus}});var e,n=r(d[0]),t=r(d[1]),s=(e=t)&&e.__esModule?e:{default:e},o=r(d[2]),u=r(d[3]);function c(e){const{aspect:t,quality:s,videoMaxDuration:o}=e;if(null!=t){const[e,s]=t;if(e<=0||s<=0)throw new n.CodedError('ERR_INVALID_ARGUMENT',`Invalid aspect ratio values ${e}:${s}. Provide positive numbers.`)}if(s&&(s<0||s>1))throw new n.CodedError('ERR_INVALID_ARGUMENT',`Invalid 'quality' value ${s}. Provide a value between 0 and 1.`);if(o&&o<0)throw new n.CodedError('ERR_INVALID_ARGUMENT',`Invalid 'videoMaxDuration' value ${o}. Provide a non-negative number.`);return e}async function l(){return s.default.getCameraPermissionsAsync()}async function y(e=!1){return s.default.getMediaLibraryPermissionsAsync(e)}async function f(){return s.default.requestCameraPermissionsAsync()}async function b(e=!1){return(0,s.default.requestMediaLibraryPermissionsAsync)(e)}Object.keys(u).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return u[e]}})});const P=(0,n.createPermissionHook)({getMethod:e=>y(e?.writeOnly),requestMethod:e=>b(e?.writeOnly)}),w=(0,n.createPermissionHook)({getMethod:l,requestMethod:f})},1035,[570,1282,1284,1283]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"hashOf",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"MASS_REMOVE",{enumerable:!0,get:function(){return c}}),_e.quietly=async function(e){l++;try{await e()}finally{l--;for(const e of u)e.resnapshot()}},Object.defineProperty(_e,"isQuiet",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"EntityBridge",{enumerable:!0,get:function(){return f}}),_e.venueChannel=function(e,t,n,s){let o=i().channel(`cc-live:${e}:${Math.random().toString(36).slice(2,8)}`);for(const{table:s,venueColumn:i}of t)o=o.on('postgres_changes',{event:'*',schema:'public',table:s,filter:`${i??'venue_id'}=eq.${e}`},e=>{n(s,'DELETE'===e.eventType?'delete':'upsert','DELETE'===e.eventType?e.old:e.new)});return o.subscribe(e=>s(e)),o},Object.defineProperty(_e,"onConnectivity",{enumerable:!0,get:function(){return t.onConnectivity}});var e=r(d[0]),t=r(d[1]),n=r(d[2]),s=r(d[3]);const i=()=>(0,e.getSupabase)(),o=e=>{if(null===e||'object'!=typeof e)return JSON.stringify(e)??'null';if(Array.isArray(e))return`[${e.map(o).join(',')}]`;const t=e;return`{${Object.keys(t).filter(e=>void 0!==t[e]).sort().map(e=>`${JSON.stringify(e)}:${o(t[e])}`).join(',')}}`},h=e=>{const t=o(e);let n=2166136261;for(let e=0;e>>0;return`${n.toString(36)}.${t.length}`},c=5;let l=0;const u=new Set;const p=()=>l>0;class f{known={};last=new Map;reconciled=!1;applying=!1;massOk=!1;unsub=null;constructor(e,t,n={}){this.spec=e,this.venueId=t,this.ev=n,this.kvKey=`known:${t}:${e.name}`}async start(){this.known=await n.kv.get(this.kvKey,{}),this.snapshotLocal(),u.add(this),this.unsub=this.spec.subscribe(()=>{l>0?this.snapshotLocal():!this.applying&&this.reconciled&&this.pushLocalChanges()})}stop(){this.unsub?.(),this.unsub=null,u.delete(this)}resnapshot(){this.snapshotLocal()}allowMassRemoveOnce(){this.massOk=!0}snapshotLocal(){this.last=new Map(this.spec.list().map(e=>[this.spec.key(e),h(e)]))}saveKnown(){n.kv.set(this.kvKey,this.known)}pending(e){return s.mutationQueue.hasPending(this.spec.table,this.venueId,e)}async read(){let e=i().from(this.spec.table).select('*').eq(this.spec.venueColumn??'venue_id',this.venueId);this.spec.filter&&(e=this.spec.filter(e));const{data:t,error:n}=await e.limit(2e3);if(n)throw n;const s=t??[];this.merge(s,!this.reconciled),this.reconciled=!0,this.spec.afterRead?.(s)}merge(e,t){const n=this.spec,s=new Map(n.list().map(e=>[n.key(e),e])),i=new Set,o=[],l=[],u=[],p=[];for(const t of e){const e=n.rowKey(t),c=n.fromRow(t);if(!c)continue;i.add(e),p.push(c);const l=h(c),f=s.get(e);if(!this.pending(e)){if(f){const t=h(f);if(t===l){this.known[e]=l;continue}if(this.known[e]&&t!==this.known[e]&&n.writable()&&n.syncable(f)){u.push(f);continue}}o.push(c),this.known[e]=l}}for(const[e,t]of s)i.has(e)||this.pending(e)||!n.syncable(t)||n.inWindow&&!n.inWindow(t)||(this.known[e]?l.push(e):n.writable()&&!n.supersededBy?.(t,p)&&u.push(t));const f=this.massOk;if(this.massOk=!1,l.length>c&&!f)this.ev.onSuspect?.(n.name,`read would remove ${l.length} of ${s.size}`),l.length=0,u.length=0;else for(const e of l)delete this.known[e];this.applyRemote(o,l);for(const e of u)this.write(e);this.saveKnown()}applyRemote(e,t){if(e.length||t.length){this.applying=!0;try{this.spec.apply(e,t)}finally{this.applying=!1}this.snapshotLocal(),this.ev.onActivity?.()}}remote(e,t){if(!this.reconciled)return;const n=this.spec,s=n.rowKey(t);if(this.pending(s))return;if('delete'===e){if(!this.last.has(s))return;return delete this.known[s],this.applyRemote([],[s]),this.saveKnown(),void n.onRemote?.(t,e)}const i=n.fromRow(t);if(!i)return;const o=h(i);this.known[s]=o,this.saveKnown(),this.last.get(s)!==o&&this.applyRemote([i],[]),n.onRemote?.(t,e)}pushLocalChanges(){const e=this.spec,t=new Map(e.list().map(t=>[e.key(t),t]));for(const[n,s]of t){const t=h(s);this.last.get(n)!==t&&(this.last.set(n,t),e.syncable(s)&&e.writable()&&this.known[n]!==t&&this.write(s))}const n=[...this.last.keys()].filter(e=>!t.has(e));for(const e of n)this.last.delete(e);const i=e.writable()&&!1!==e.deletes&&'insert'!==e.mode&&'update'!==e.mode?n.filter(e=>this.known[e]):[];if(e.protect&&i.length>c)return this.ev.onSuspect?.(e.name,`${i.length} items vanished at once; not deleted`),void this.saveKnown();for(const t of i)delete this.known[t],s.mutationQueue.enqueue({table:e.table,venueId:this.venueId,kind:'delete',rowKey:t,match:{...this.deleteMatch(t),venue_id:this.venueId}});this.saveKnown()}deleteMatch(e){return this.spec.matchKey?this.spec.matchKey(e):{id:e}}write(e){const t=this.spec,n=t.key(e);let i;try{i=t.toRow(e,this.venueId)}catch(e){return void this.ev.onError?.(t.name,String(e?.message??e))}if(this.known[n]=h(e),'update'===t.mode){const e=t.venueColumn??'venue_id';s.mutationQueue.enqueue({table:t.table,venueId:this.venueId,kind:'update',rowKey:n,values:i,match:{...t.matchKey?t.matchKey(n):{},[e]:this.venueId}})}else s.mutationQueue.enqueue({table:t.table,venueId:this.venueId,kind:'insert'===t.mode?'insert':'upsert',rowKey:n,values:i,conflictKey:t.conflict??'id'});this.ev.onActivity?.()}}},1092,[863,1197,1196,1095]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"cashUpId",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"salesId",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"cashSettingsId",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"defaultCashSettings",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"useCashUp",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"useCashSettings",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"useTipsShow",{enumerable:!0,get:function(){return y}});var t=e(_r(d[0])),s=e(_r(d[1])),r=_r(d[2]),n=_r(d[3]),o=_r(d[4]),u=_r(d[5]),l=_r(d[6]);const c=(e,t)=>(0,o.uuidFrom)(`cashup:${e}:${t}`),p=(e,t)=>(0,o.uuidFrom)(`sales:${e}:${t}`),h=e=>(0,o.uuidFrom)(`cashup-settings:${e}`),f=e=>({id:h(e),cashFields:u.DEFAULT_CASHUP_FIELDS.map(e=>({...e})),salesFields:u.DEFAULT_SALES_FIELDS.map(e=>({...e}))}),S=e=>{const t='number'==typeof e.vals.cashTips?e.vals.cashTips:null,s='number'==typeof e.vals.cardTips?e.vals.cardTips:null;return!e.confirmedAt||null==t&&null==s?null:{rid:e.rid,date:e.date,total:Math.round(100*((t??0)+(s??0)))/100,postedAt:e.confirmedAt,postedBy:e.confirmedBy}},b=(0,r.create)()((0,n.persist)((e,t)=>({cashUps:[],sales:[],tips:[],pot:[],settings:{},show:{},seen:{},saveCashUp:t=>{const s={...t,id:c(t.rid,t.date)},r=S(s);return e(e=>({cashUps:[s,...e.cashUps.filter(e=>e.id!==s.id)],tips:r?[r,...e.tips.filter(e=>!(e.rid===r.rid&&e.date===r.date))]:e.tips})),s},saveSales:t=>{const s={...t,id:p(t.rid,t.weekStart)};return e(e=>({sales:[s,...e.sales.filter(e=>e.id!==s.id)]})),s},setFields:(t,s,r)=>e(e=>({settings:{...e.settings,[t]:{...e.settings[t]??f(t),[s]:r,updatedAt:(new Date).toISOString()}}})),resetFields:t=>e(e=>({settings:{...e.settings,[t]:{...f(t),updatedAt:(new Date).toISOString()}}})),setShow:(t,s)=>e(e=>({show:{...e.show,[t]:{...e.show[t]??{showToday:!0,showPot:!0},...s}}})),addPotEvent:t=>e(e=>({pot:[{...t,id:(0,l.uuid)(),at:(new Date).toISOString()},...e.pot]})),markSeen:(t,s)=>e(e=>({seen:{...e.seen,[t]:s}}))}),{name:'covercharge-cashup-v1',storage:(0,n.createJSONStorage)(()=>s.default),partialize:e=>({...e,cashUps:e.cashUps.map(e=>({...e,photos:e.photos.filter(e=>!e.startsWith('data:'))})),sales:e.sales.map(e=>({...e,photos:e.photos.filter(e=>!e.startsWith('data:'))}))})})),w=e=>{const s=b(t=>t.settings[e])??f(e);return t.default.useMemo(()=>({...s,cashFields:(0,u.withTakingsFields)(s.cashFields)}),[s])},y=e=>b(t=>t.show[e])??{showToday:!0,showPot:!0}},1093,[30,1116,952,1117,1104,1109,1034]); +__d(function(g,_r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useCardStore",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"photoStorageFull",{enumerable:!0,get:function(){return E}}),_e.setStoragePhotoResolver=function(e){j=e},_e.cachePhotoAs=function(e,t){if(C.getState().photos[e]===t)return;C.setState(r=>({photos:{...r.photos,[e]:t}}))},Object.defineProperty(_e,"readLocalPhoto",{enumerable:!0,get:function(){return M}}),Object.defineProperty(_e,"localRecipeCards",{enumerable:!0,get:function(){return $}}),_e.ensureCards=F;var e,t=_r(d[0]),r=_r(d[1]),n=_r(d[2]),s=_r(d[3]),o=_r(d[4]),a=_r(d[5]),c=(e=a)&&e.__esModule?e:{default:e};_r(d[6]);var u=_r(d[7]),l=_r(d[8]),f=_r(d[9]),m=_r(d[10]),h=_r(d[11]),p=_r(d[12]),S=_r(d[13]);const I='covercharge-recipecards-v1',y='covercharge-recipephotos-v1',O=()=>{try{return(0,S.nowFrom)(S.useStore.getState().clock)}catch{return new Date}},b=(0,u.create)()((0,l.persist)(()=>({cards:[],removed:[],log:[]}),{name:I,storage:(0,l.createJSONStorage)(()=>c.default),version:3,migrate:async e=>{const n=e;return t.LIVE_VENUE_BUILD?(await(0,r.archiveChefCache)('recipe-cards',n),{...n,cards:n.cards.filter(e=>!(0,s.isDemoCard)(e)),log:n.log.filter(e=>!(0,s.demoActor)(e.by))}):n}}));let w=!1;const v={getItem:e=>c.default.getItem(e),setItem:async(e,t)=>{try{await c.default.setItem(e,t),w=!1}catch{w=!0}},removeItem:e=>c.default.removeItem(e)},E=()=>w,C=(0,u.create)()((0,l.persist)(()=>({photos:{}}),{name:y,storage:(0,l.createJSONStorage)(()=>v),version:1})),_={lobster:_r(d[14]),skink:_r(d[15]),fishsupper:_r(d[16]),moules:_r(d[17]),stp:_r(d[18])};let A=0;const L=(e,t,r)=>{const n={id:`cl-${Date.now().toString(36)}${(A++).toString(36)}`,cardId:e.id,rid:e.restaurantId,at:O().toISOString(),by:t,text:r};b.setState(e=>({log:[n,...e.log].slice(0,300)}));try{S.useStore.getState().addAudit(e.restaurantId,'menu',`Recipe card: ${e.dish}: ${r} (${t})`)}catch{}},P=e=>b.setState(t=>({cards:t.cards.some(t=>t.id===e.id)?t.cards.map(t=>t.id===e.id?e:t):[...t.cards,e]}));let B=null,D=null;function U(){const e=b.getState().cards,r=t.LIVE_VENUE_BUILD?e.filter(e=>!(0,s.isDemoCard)(e)).map(e=>({...e,signOff:(0,s.demoActor)(e.signOff?.by)?null:e.signOff,allergensConfirmed:(0,s.demoActor)(e.allergensConfirmed?.by)?void 0:e.allergensConfirmed})):e;if(!D||B!==e){B=e;const t=new Map,n=new Map;for(const e of r)t.set(e.restaurantId,[...t.get(e.restaurantId)??[],e]),n.set(e.menuItemId,e);D={cards:r,byRid:t,byItem:n}}return D}const N=[];function V(e){if(!(0,f.canEditCards)(e.role))throw new Error('Only the head chef and managers can edit recipe cards.')}let j=null;const M=e=>C.getState().photos[e],$={mode:'local',list:e=>U().byRid.get(e)??N,get:e=>U().cards.find(t=>t.id===e),byMenuItem:e=>U().byItem.get(e),subscribe:e=>{const t=b.subscribe(e),r=C.subscribe(e);return()=>{t(),r()}},async create(e,t,r){V(r);const n=O().toISOString();k=!0;let s=t.menuItemId;try{s||(s=S.useStore.getState().addMenuItem({restaurantId:e,section:t.section,name:t.dish,description:t.description??'',price:t.price,dietary:[],allergens:t.allergens??{},prepMins:12,soldOut:!1,signOff:null}));const o={id:t.id??(0,f.uuid)(),restaurantId:e,menuItemId:s,dish:t.dish,section:t.section,price:t.price,photo:t.photo,ingredients:t.ingredients??[],steps:t.steps??[],allergens:t.allergens??{},dismissed:t.dismissed??[],allergenNotes:t.allergenNotes,signOff:null,wasLive:!1,origin:'new',version:1,createdAt:n,updatedAt:n,updatedBy:r.name};return b.setState(e=>({cards:[...e.cards.filter(e=>e.menuItemId!==o.menuItemId),o]})),L(o,r.name,'card created, awaiting sign-off'),o}finally{k=!1}},async update(e,t,r){V(r);const n=$.get(e);if(!n)throw new Error('Card not found');const s=(0,f.editCard)(n,t,r.name,O().toISOString());return s.changed&&(P(s.card),L(s.card,r.name,s.resetSignOff?'edited, sign-off reset to Awaiting sign-off':t.confirmAllergens&&1===Object.keys(t).length?'allergens confirmed':'edited')),s.card},async signOff(e,t){if(!(0,f.canSignOffCards)(t.role))throw new Error('Only the head chef can sign off a recipe card.');const r=$.get(e);if(!r)throw new Error('Card not found');const n=(0,f.signOffBlock)(r);if(n)throw new Error(n);const s=(0,f.signOffCard)(r,t.name,O().toISOString());return P(s),L(s,t.name,'signed off'),s},async remove(e,t){V(t);const r=$.get(e);r&&(b.setState(t=>({cards:t.cards.filter(t=>t.id!==e),removed:[...t.removed,r.menuItemId]})),S.useStore.setState(e=>({menu:e.menu.map(e=>e.id===r.menuItemId?{...e,hidden:!0}:e)})),L(r,t.name,'card removed (dish hidden from the menu)'))},async savePhoto(e,t,r){const n=`local:${t}:${Date.now().toString(36)}`;return C.setState(e=>({photos:{...Object.fromEntries(Object.entries(e.photos).filter(([e])=>!e.startsWith(`local:${t}:`))),[n]:r.dataUrl}})),n},photoSource(e){if(!e)return null;if(e.startsWith('asset:'))return _[e.slice(6)]??null;if(e.startsWith('local:')){const t=C.getState().photos[e];return t?{uri:t}:null}if(/^(https?:|data:)/.test(e))return{uri:e};const t=C.getState().photos[e];if(t)return{uri:t};const r=j?.(e);return r?{uri:r}:null}};let k=!1,R=!1;function F(){if(k)return;const e=S.useStore.getState().menu,{cards:r,removed:a}=b.getState(),c=new Set(r.map(e=>e.menuItemId)),u=e.filter(e=>!c.has(e.id)&&!a.includes(e.id));if(!u.length)return;const l=O().toISOString(),f=o.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD||!(0,n.examplesAllowed)()?[]:(0,p.exampleCards)(u),m=new Set(f.map(e=>e.menuItemId)),h=[...f,...u.filter(e=>!m.has(e.id)).map(e=>(0,p.importedCard)(t.LIVE_VENUE_BUILD&&(0,s.demoActor)(e.signOff?.by)?{...e,signOff:null}:e,l))];b.setState(e=>({cards:[...e.cards,...h]}))}(0,h.setMenuCardBridge)({cardFor:e=>U().byItem.get(e),menuItemAdded:e=>{if(k||!R)return;const t=O().toISOString(),r={...(0,p.importedCard)(e,t),id:(0,f.uuid)(),signOff:null,allergensConfirmed:void 0,wasLive:!1,origin:'new',updatedBy:'Added to the menu'};P(r),L(r,r.updatedBy,'card created from the menu, awaiting sign-off')},menuEdited:(e,t,r,n)=>{const s=U().byItem.get(e);if(!s)return;let o=(0,f.editCard)(s,t,r,O().toISOString()).card;n&&o.signOff&&(o={...o,signOff:null,version:o.version+1,updatedAt:O().toISOString(),updatedBy:r}),o!==s&&(P(o),L(o,r,s.signOff&&!o.signOff?'edited from the menu, sign-off reset':'edited from the menu'))},signOff:(e,t)=>{const r=U().byItem.get(e);r&&$.signOff(r.id,{name:t,role:'head-chef'}).catch(()=>{})}}),(0,m.setRecipeCardRepository)($);const x=e=>new Promise(t=>{e.hasHydrated()?t():e.onFinishHydration(()=>t())});Promise.all([x(S.useStore.persist),x(b.persist)]).then(()=>{R=!0,F(),S.useStore.subscribe((e,t)=>{e.menu!==t.menu&&F()})}),'undefined'!=typeof window&&window.addEventListener('storage',e=>{e.key===(0,o.venueKey)(I)&&b.persist.rehydrate(),e.key===(0,o.venueKey)(y)&&C.persist.rehydrate()})},1094,[833,1132,1119,1025,5,1116,122,952,1117,1104,831,1114,1142,872,1143,1144,1145,1146,1147]); +__d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"MutationQueue",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"mutationQueue",{enumerable:!0,get:function(){return l}});var t=_r(d[0]),e=_r(d[1]),s=_r(d[2]);const r='queue:v1',n='queue:failed:v1',h=t=>`${t.table}|${t.venueId}|${t.rowKey}`;class o{items=[];failedItems=[];loaded=null;flushing=null;exec=null;listeners=new Set;onFailure=new Set;onSaved=new Set;retryTimer=null;waitTimer=null;backoffMs=2e3;now=()=>Date.now();constructor(){(0,t.onConnectivity)(t=>{t&&this.flush()})}setExecutor(t){this.exec=t}load(){return this.loaded||(this.loaded=(async()=>{const t=await e.kv.get(r,[]);this.items=[...t.map(t=>({...t,nextAt:void 0})),...this.items],this.failedItems=await e.kv.get(n,[]),this.emit()})()),this.loaded}get pending(){return this.items}get waiting(){return this.items.filter(t=>t.attempts>0)}get failed(){return this.failedItems}hasPending(t,e,s){return this.items.some(r=>r.table===t&&r.venueId===e&&r.rowKey===s)}async enqueue(t){await this.load();const s={...t,id:(0,e.uuid)(),createdAt:(new Date).toISOString(),attempts:0};return this.items.push(s),await this.persist(),this.flush(),s}nextReady(){const t=new Set,e=this.now();for(const s of this.items){const r=h(s);if(!t.has(r)){if(!(s.nextAt&&s.nextAt>e))return s;t.add(r)}}}remove(t){this.items=this.items.filter(e=>e!==t)}flush(){return this.flushing||(this.flushing=(async()=>{for(await this.load();this.exec;){const e=this.nextReady();if(!e)break;if(!(0,t.isOnline)()){this.scheduleRetry();break}try{const t=await this.exec(e);this.remove(e),this.backoffMs=2e3,'conflict'===t?this.fail(e,'conflict','Row changed on the server (version conflict) or is not visible to you'):this.onSaved.forEach(t=>t(e))}catch(r){e.attempts+=1,e.lastError=String(r?.message??r);const n=r??{};e.lastErr={code:n.code?String(n.code):void 0,status:Number(n.status)||void 0,message:e.lastError.slice(0,300)};const h=(0,s.classifyWriteError)(r);if('network'===h){e.attempts-=1,(0,t.setOnline)(!1),this.scheduleRetry(),await this.persist();break}'retry'===h?e.nextAt=this.now()+(0,s.retryDelayMs)(e.attempts):(this.remove(e),this.fail(e,'rejected',e.lastError))}await this.persist()}this.flushing=null,this.scheduleWaiting()})()),this.flushing}retryNow(){for(const t of this.items)t.nextAt=void 0;return this.flush()}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}onFailed(t){return this.onFailure.add(t),()=>{this.onFailure.delete(t)}}onDone(t){return this.onSaved.add(t),()=>{this.onSaved.delete(t)}}async clearFailed(){this.failedItems=[],await e.kv.set(n,[]),this.emit()}fail(t,s,r){const h={...t,lastError:r,failedAt:(new Date).toISOString(),reason:s};this.failedItems=[h,...this.failedItems].slice(0,100),e.kv.set(n,this.failedItems),this.onFailure.forEach(t=>t(h))}scheduleWaiting(){this.waitTimer&&(clearTimeout(this.waitTimer),this.waitTimer=null);const t=this.items.map(t=>t.nextAt??0).filter(t=>t>0);if(!t.length)return;const e=Math.max(500,Math.min(...t)-this.now());this.waitTimer=setTimeout(()=>{this.waitTimer=null,this.flush()},e)}scheduleRetry(){if(this.retryTimer)return;const e=this.backoffMs;this.backoffMs=Math.min(2*this.backoffMs,6e4),this.retryTimer=setTimeout(()=>{this.retryTimer=null,(0,t.setOnline)(!0),this.flush()},e)}async persist(){await e.kv.set(r,this.items),this.emit()}emit(){this.listeners.forEach(t=>t())}}const l=new o},1095,[1197,1196,1200]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SUPABASE_URL",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"SUPABASE_ANON_KEY",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"isSupabaseConfigured",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"REALTIME_TABLES",{enumerable:!0,get:function(){return s}});var t=r(d[0]);const n="https://rowdoidkftriylijobuy.supabase.co",o="sb_publishable_rPm723MQz6FwmFVHy6e1SA_ko-_-6GR",u=()=>!t.PITCH&&n.startsWith('https://')&&o.length>20,s=['bookings','walk_ins','blocks','table_plans','takeaway_orders','stock_counts']},1096,[2]); +__d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.pushState=f,e.turnOnPush=async function(){const u=await f();if('ios-home-screen'===u)return{ok:!1,message:'On iPhone, add this app to your Home Screen first (Share \u203a Add to Home Screen, iOS 16.4 or later), then open it from there.'};if('unsupported'===u)return{ok:!1,message:'This browser can\u2019t get phone notifications. Try Chrome on Android, or the app from your iPhone Home Screen.'};if('blocked'===u)return{ok:!1,message:'Notifications are blocked for this app. Allow them in your phone\u2019s settings, then try again.'};const c=i.useSync.getState();if('staff'!==c.kind||!c.venueId||!c.staffRef)return{ok:!1,message:'Sign in from your personal link first.'};if('granted'!==await Notification.requestPermission())return{ok:!1,message:'You didn\u2019t allow notifications, so nothing changed.'};const p=await navigator.serviceWorker.ready,h=(await p.pushManager.getSubscription()??await p.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:s(n.VAPID_PUBLIC_KEY)})).toJSON();if(!h.endpoint||!h.keys?.p256dh||!h.keys?.auth)return{ok:!1,message:'Your browser didn\u2019t give a usable subscription. Try again.'};const l=(0,t.getSupabase)(),{error:y}=await l.from('push_subscriptions').upsert({venue_id:c.venueId,staff_ref:c.staffRef,app:o.APP_VARIANT,endpoint:h.endpoint,p256dh:h.keys.p256dh,auth:h.keys.auth,user_agent:navigator.userAgent.slice(0,200)},{onConflict:'user_id,endpoint'});return y?{ok:!1,message:`Couldn\u2019t save this phone: ${y.message}`}:{ok:!0,message:'Phone notifications are on for this device.'}},e.turnOffPush=async function(){const n=await(navigator.serviceWorker?.getRegistration()),i=await(n?.pushManager.getSubscription());if(!i)return{ok:!0,message:'Phone notifications are off for this device.'};const o=i.endpoint;await i.unsubscribe();try{const n=(0,t.getSupabase)();await n.from('push_subscriptions').delete().eq('endpoint',o)}catch{}return{ok:!0,message:'Phone notifications are off for this device.'}};var n=r(d[0]),t=r(d[1]),i=r(d[2]),o=r(d[3]);const s=n=>{const t=atob(n.replace(/-/g,'+').replace(/_/g,'/')+'='.repeat((4-n.length%4)%4)),i=new Uint8Array(t.length);for(let n=0;n'undefined'!=typeof navigator&&/iPhone|iPad|iPod/.test(navigator.userAgent),c=()=>'undefined'!=typeof window&&(window.matchMedia?.('(display-mode: standalone)').matches||!0===navigator.standalone);async function f(){if('undefined'==typeof window||!('serviceWorker'in navigator))return'unsupported';if(!('PushManager'in window)||'undefined'==typeof Notification)return u()&&!c()?'ios-home-screen':'unsupported';if('denied'===Notification.permission)return'blocked';const n=await navigator.serviceWorker.getRegistration();return await(n?.pushManager.getSubscription())?'on':'off'}},1097,[1275,863,820,806]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SOON_TEXT",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"setVenueWords",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"getVenueWords",{enumerable:!0,get:function(){return u}}),e.askServer=async function(o,c,u,p){try{const l=(0,t.getSupabase)().functions.invoke(n,{body:{app:o,text:c,tools:u,...p?{receipt:p,spoken:!0,vocab:s}:{}}}),y=new Promise(t=>setTimeout(()=>t({data:null,error:new Error('timeout')}),1e4)),{data:f,error:b}=await Promise.race([l,y]);return b||!f||!0!==f.ready||f.busy?{kind:'soon'}:f.call?.name?{kind:'call',name:String(f.call.name),args:f.call.args??{}}:'string'==typeof f.text&&f.text.trim()?{kind:'text',text:f.text.trim()}:{kind:'soon'}}catch{return{kind:'soon'}}},e.transcribe=async function(n,o,c=8e3){try{const u=/mp4|m4a|aac/.test(o.type)?'m4a':/ogg/.test(o.type)?'ogg':/wav/.test(o.type)?'wav':'webm',l=new FormData;l.append('app',n),s.length&&l.append('keyterms',JSON.stringify(s)),l.append('file',o,`speech.${u}`);const y=(0,t.getSupabase)().functions.invoke(p,{body:l}),f=new Promise(t=>setTimeout(()=>t({data:null,error:new Error('timeout')}),c)),{data:b,error:k}=await Promise.race([y,f]);return k?{ok:!1,reason:'timeout'===String(k?.message)?'timeout':'offline'}:!0===b?.ok?{ok:!0,text:String(b.text??''),receipt:'string'==typeof b.receipt?b.receipt:void 0}:{ok:!1,reason:String(b?.reason??'busy'),text:'string'==typeof b?.text?b.text:void 0}}catch{return{ok:!1,reason:'offline'}}};var t=r(d[0]);const n='voice-assistant',o='Voice assistant is switching on soon. Until then I can do the everyday things, for example';let s=[];const c=t=>{s=t.slice(0,100)},u=()=>s;const p='voice-transcribe'},1098,[863]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"VOICE_ROLES",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"VOICE_ROLE_LABEL",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"useVoiceSettings",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"voiceOn",{enumerable:!0,get:function(){return f}}),_e.micExplainedFor=function(e){try{if('1'===b()?.getItem(s(e)))return!0}catch{}return u.getState().micExplained},_e.setMicExplainedFor=function(e){try{b()?.setItem(s(e),'1')}catch{}u.getState().setMicExplained(!0)};var e,n=r(d[0]),t=(e=n)&&e.__esModule?e:{default:e},c=r(d[1]),l=r(d[2]);const o=['owner','manager','staff','chef','display'],p={owner:'Owner (Managers app)',manager:'Managers (Managers app)',staff:'Staff app (full voice assistant, no money or HR)',chef:'Head Chef app',display:'Main Display'},u=(0,c.create)()((0,l.persist)(e=>({enabled:{},micExplained:!1,setEnabled:(n,t,c)=>e(e=>({enabled:{...e.enabled,[n]:{...e.enabled[n]??{},[t]:c}}})),setMicExplained:n=>e({micExplained:n})}),{name:'covercharge-voice-v1',version:4,storage:(0,l.createJSONStorage)(()=>t.default),migrate:(e,n)=>({enabled:n<2?{}:e?.enabled??{},micExplained:!!e?.micExplained}),merge:(e,n)=>({...n,enabled:e?.enabled??n.enabled,micExplained:e?.micExplained??n.micExplained}),partialize:e=>({enabled:e.enabled,micExplained:e.micExplained})})),f=(e,n,t)=>!1!==e[n]?.[t],s=e=>`cc-voice-mic-explained-${e}`,b=()=>{try{return'undefined'!=typeof window?window.localStorage:void 0}catch{return}}},1099,[1116,952,1117]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"desktopStt",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"desktopSttState",{enumerable:!0,get:function(){return u}}),_e.warmDesktopStt=function(){o()&&l()},Object.defineProperty(_e,"cleanHeard",{enumerable:!0,get:function(){return d}}),Object.defineProperty(_e,"tabletWithoutMic",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"canRecord",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"canListen",{enumerable:!0,get:function(){return w}}),_e.micPermission=b,Object.defineProperty(_e,"RATE",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"PRE_ROLL_MS",{enumerable:!0,get:function(){return M}}),Object.defineProperty(_e,"HANG_MS",{enumerable:!0,get:function(){return A}}),_e.releaseMic=O,Object.defineProperty(_e,"echoWanted",{enumerable:!0,get:function(){return R}}),Object.defineProperty(_e,"micConstraints",{enumerable:!0,get:function(){return j}}),_e.warmMic=async function(){try{if(o()||!y())return;if(!S&&'granted'!==await b())return;if(await D(),C){C.armedUntil=Date.now()+1500;try{C.ctx.resume?.()}catch{}}x()}catch{}},_e.disarmMic=function(){C&&!C.rec&&(C.armedUntil=0,C.ring=[],C.ringLen=0)},_e.askMic=async function(){try{return await D(),x(),!0}catch{return!1}},_e.wavOf=L,Object.defineProperty(_e,"MAX_CLIP_MS",{enumerable:!0,get:function(){return _}}),_e.listen=B,Object.defineProperty(_e,"CloudRecognition",{enumerable:!0,get:function(){return I}}),Object.defineProperty(_e,"speechRecognizer",{enumerable:!0,get:function(){return N}}),_e.levelMeter=async function(e){const t=n()?.navigator?.mediaDevices,r=n()?.AudioContext||n()?.webkitAudioContext;if(!t?.getUserMedia||!r)return()=>{};let o,i,a=0,c=!1;try{if(o=await t.getUserMedia({audio:!0}),c)return o.getTracks().forEach(e=>e.stop()),()=>{};i=new r;const s=i.createMediaStreamSource(o),u=i.createAnalyser();u.fftSize=512,s.connect(u);const l=new Uint8Array(u.fftSize),d=()=>{u.getByteTimeDomainData(l);let t=0;for(let e=0;e{}}return()=>{c=!0;try{n().cancelAnimationFrame(a)}catch{}try{o?.getTracks().forEach(e=>e.stop())}catch{}try{i?.close()}catch{}}},_e.yesNo=function(e){const t=e.toLowerCase().trim().replace(/[.!,]/g,'');return/^(yes|yeah|yep|yup|aye|confirm|confirmed|do it|go ahead|correct|that's right|ok|okay|yes please)\b/.test(t)?'yes':/^(no|nope|cancel|stop|don't|do not|wrong|never mind)\b/.test(t)?'no':null},Object.defineProperty(_e,"buzz",{enumerable:!0,get:function(){return W}});var e=_r(_d[0]),t=_r(_d[1]);const n=()=>'undefined'==typeof window?void 0:window,r=()=>n()?.ccDesktop,o=()=>!!r()?.stt&&!!r()?.sttWorker;let i=null,a=0;const c=new Map;let s='cold';const u=()=>s;function l(){if(i)return i;const e=n()?.Worker,t=r()?.sttWorker;return e&&t?(i=new e(t,{type:'module'}),s='loading',i.onmessage=e=>{const t=e.data??{};if(t.ready)return void(s='ready');t.failed&&(s='failed');const n=c.get(t.id);n&&(c.delete(t.id),n(t))},i.onerror=()=>{s='failed',c.forEach(e=>e({error:'stt-failed'})),c.clear()},i.postMessage({warm:!0}),i):null}const d=e=>e.replace(/\[[^\]]*\]|\([^)]*\)/g,' ').replace(/\s+/g,' ').trim();function f(e,t){let o,i,s,u,f=!1,p=!1;const y=[];let w=16e3;const b=()=>{try{s?.disconnect(),u?.disconnect()}catch{}try{o?.getTracks().forEach(e=>e.stop())}catch{}try{i?.close()}catch{}if(p)return;const n=y.reduce((e,t)=>e+t.length,0);if(n<.35*w)return void t('');const r=new Float32Array(n);let f=0;for(const e of y)r.set(e,f),f+=e.length;const b=16e3===w?r:h(r,w,16e3),v=l();if(!v)return void t('','stt-failed');e('Turning speech into text on this Mac\u2026');const M=++a;c.set(M,e=>t(d(e.text??''),e.error)),v.postMessage({id:M,audio:b},[b.buffer])};return(async()=>{try{if(r()?.askMic){if(!await r().askMic())return void t('','not-allowed')}if(o=await n().navigator.mediaDevices.getUserMedia({audio:{channelCount:1,echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0}}),f)return void b();const e=n().AudioContext||n().webkitAudioContext;try{i=new e({sampleRate:16e3})}catch{i=new e}w=i.sampleRate,u=i.createMediaStreamSource(o),s=i.createScriptProcessor(4096,1,1),s.onaudioprocess=e=>{f||y.push(new Float32Array(e.inputBuffer.getChannelData(0)))},u.connect(s),s.connect(i.destination),l()}catch(e){t('','NotAllowedError'===e?.name?'not-allowed':'audio-capture')}})(),{stop:()=>{f||(f=!0,b())},abort:()=>{p=!0,f=!0,b()}}}function h(e,t,n){const r=Math.round(e.length*n/t),o=new Float32Array(r),i=t/n;for(let t=0;t{const e=String(n()?.navigator?.userAgent??'');return/CoverChargeTablet\//.test(e)&&!/CoverChargeTablet\/[\d.]+ mic/.test(e)},y=()=>!p()&&!(!n()?.MediaRecorder||!n()?.navigator?.mediaDevices?.getUserMedia),w=()=>o()||y();async function b(){try{const e=n()?.navigator?.permissions?.query;if(!e)return'unknown';const t=await Promise.race([n().navigator.permissions.query({name:'microphone'}),new Promise(e=>setTimeout(()=>e(null),1500))]);return'granted'===t?.state||'denied'===t?.state||'prompt'===t?.state?t.state:'unknown'}catch{return'unknown'}}const v=16e3,M=500,A=450;let P,S=null,T=!1,k=!1,C=null;function U(){const e=C;if(C=null,e){try{e.node.disconnect(),e.src.disconnect()}catch{}try{e.ctx.close()}catch{}e.ring=[],e.rec=null}}function O(){clearTimeout(P),U();try{S?.getTracks().forEach(e=>e.stop())}catch{}S=null}const x=()=>{clearTimeout(P),P=setTimeout(O,/iPhone|iPad|iPod|Macintosh/.test(String(n()?.navigator?.userAgent??''))&&!r()?.mac?6e5:6e4)},R=()=>!1,j=(e=R())=>({audio:{channelCount:{ideal:1},sampleRate:{ideal:v},sampleSize:{ideal:16},echoCancellation:e,noiseSuppression:!0,autoGainControl:!0}});async function D(){clearTimeout(P);const e=R();if(S&&T===e&&S.getAudioTracks().some(e=>'live'===e.readyState))return S;if(S&&O(),S=await n().navigator.mediaDevices.getUserMedia(j(e)),T=e,!k){k=!0;try{n().document.addEventListener('visibilitychange',()=>{'hidden'===n().document.visibilityState&&O()})}catch{}}return E(S),S}function E(e){U();try{const t=n().AudioContext||n().webkitAudioContext;if(!t)return;let r;try{r=new t({sampleRate:v})}catch{r=new t}const o=r.createMediaStreamSource(e),i=r.createScriptProcessor(2048,1,1),a={ctx:r,node:i,src:o,rate:r.sampleRate,ring:[],ringLen:0,rec:null,frames:0,armedUntil:0,level:()=>{}},c=Math.round(.5*a.rate);i.onaudioprocess=e=>{const t=new Float32Array(e.inputBuffer.getChannelData(0));if(a.frames+=t.length,a.rec&&a.rec.push(t),!a.rec&&Date.now()>a.armedUntil)return a.ring=[],void(a.ringLen=0);for(a.ring.push(t),a.ringLen+=t.length;a.ring.length>1&&a.ringLen-a.ring[0].length>=c;)a.ringLen-=a.ring[0].length,a.ring.shift();let n=0;for(let e=0;ee+t.length,0),r=new Float32Array(n);let o=0;for(const t of e)r.set(t,o),o+=t.length;const i=t===v?r:h(r,t,v),a=new ArrayBuffer(44+2*i.length),c=new DataView(a),s=(e,t)=>{for(let n=0;n{clearTimeout(c),clearTimeout(s),S&&(S.rec=null,S.level=()=>{}),x()},k=(e,t,n)=>{h||f||(h=!0,o(e,t,n))};let U=!1;const O=async()=>{if(U)return;U=!0;const n=b,o=S?S.frames-P:0;if(T(),f)return;const i=Date.now()-y,a=!!n&&n.length>0&&o/M*1e3>.6*i?L(n,M):new Blob(w,{type:(p?.mimeType||w[0]?.type||'audio/webm').split(';')[0]});if(i<350||a.size<500)return void k('');r('Turning speech into text\u2026');const c=await(0,e.transcribe)(t,a);c.ok?k(c.text.trim(),void 0,{receipt:c.receipt}):k('',c.reason,{message:c.text})};(async()=>{try{const e=await D();if(d)return T(),void k('');if(S=C,S){try{S.ctx.resume?.()}catch{}b=[...S.ring],M=S.rate,P=S.frames-S.ringLen,S.rec=b,S.level=e=>{i?.(e),a&&!d&&(e>.12?(u=!0,l=0):u&&e<.05&&(l=l||Date.now(),Date.now()-l>1500&&j()))}}const t=F();p=new(n().MediaRecorder)(e,t?{mimeType:t,audioBitsPerSecond:48e3}:void 0),p.ondataavailable=e=>{e.data?.size&&w.push(e.data)},p.onstop=()=>{O()},p.onerror=()=>{b?.length?O():(T(),k('','audio-capture'))},p.start(),y=Date.now(),c=setTimeout(()=>{r('That\u2019s the 30-second limit. Sending now\u2026'),R()},_)}catch(e){T(),k('','NotAllowedError'===e?.name||'SecurityError'===e?.name?'not-allowed':'audio-capture')}})();const R=()=>{try{p&&'inactive'!==p.state?p.stop():O()}catch{O()}},j=()=>{d||(d=!0,p&&(s=setTimeout(R,a?0:A)))};return{stop:j,abort:()=>{f=!0,d=!0,clearTimeout(s);try{p&&'inactive'!==p.state&&p.stop()}catch{}T()}}}function B(e,t,n="owner",r,i=!1){return o()?f(e,t):y()?z(n,e,t,r,i):null}class I{lang='en-GB';interimResults=!1;continuous=!1;maxAlternatives=1;onresult=null;onerror=null;onend=null;l=null;start(){const e='customer'===t.APP_VARIANT?'owner':t.APP_VARIANT;if(this.l=B(()=>{},(e,t)=>{if(this.l=null,t)this.onerror?.({error:t});else if(e){const t=Object.assign([{transcript:e,confidence:1}],{isFinal:!0});this.onresult?.({resultIndex:0,results:[t]})}this.onend?.()},e,void 0,!0),!this.l)throw new Error('not-supported')}stop(){this.l?.stop()}abort(){const e=this.l;this.l=null,e?.abort(),e&&this.onend?.()}}const N=()=>w()?I:null;const W=(e=30)=>{try{n()?.navigator?.vibrate?.(e)}catch{}}},1100,[1098,806]); +__d(function(g,r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"HISTORY_LABEL",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"HISTORY_NOTE",{enumerable:!0,get:function(){return t}}),e.validPastDate=n,e.exactHistoryDate=function(o,t){if(1!==(o.match(/\b(?:\d{4}-\d{2}-\d{2}|\d{1,2}\/\d{1,2}\/\d{4}|\d{1,2}(?:st|nd|rd|th)?\s+[a-z]+\s+\d{4})\b/gi)??[]).length)return;const d=o.match(/\b(\d{4}-\d{2}-\d{2})\b/);let s=d?.[1];if(!s){const t=o.match(/\b(\d{1,2})\/(\d{1,2})\/(\d{4})\b/);t&&(s=`${t[3]}-${t[2].padStart(2,'0')}-${t[1].padStart(2,'0')}`)}if(!s){const t=o.toLowerCase().match(/\b(\d{1,2})(?:st|nd|rd|th)?\s+(january|february|march|april|may|june|july|august|september|october|november|december|jan|feb|mar|apr|jun|jul|aug|sep|sept|oct|nov|dec)\s+(\d{4})\b/),n=['jan','feb','mar','apr','may','jun','jul','aug','sep','oct','nov','dec'];t&&(s=`${t[3]}-${String(n.indexOf(t[2].slice(0,3))+1).padStart(2,'0')}-${t[1].padStart(2,'0')}`)}return s&&n(s,t)?s:void 0},Object.defineProperty(e,"historyDateLabel",{enumerable:!0,get:function(){return d}}),e.bookingDayText=function(o){const n=`Booked covers on ${d(o.date)}: ${null===o.booked_covers?'not recorded':o.booked_covers}.`,s=o.bookings.map(o=>`${o.time??'Time not recorded'}: party size ${null===o.covers?'not recorded':`${o.covers} Covers`}; ${o.table?`table ${o.table}`:'table not recorded'}; ${o.status??'status not recorded'}${o.counted?'':', excluded from Booked covers'}.`);return[n,...s,o.historical_records?"Includes previous booking system history (incomplete).":'',t,o.bookings.length?'':'No booking records found; incomplete history does not prove there were no bookings.',o.missing_covers?`${o.missing_covers} booking records have no party size; left blank.`:''].filter(Boolean).join(' ')};const o='Includes previous booking system history (incomplete)',t='Recovered booking records, not confirmed attendance. Cancelled bookings are shown but excluded from Booked covers.';function n(o,t){if(!/^\d{4}-\d{2}-\d{2}$/.test(o))return!1;const n=new Date(o+'T12:00:00Z');return!Number.isNaN(n.getTime())&&n.toISOString().slice(0,10)===o&&onew Date(o+'T12:00:00Z').toLocaleDateString('en-GB',{day:'numeric',month:'long',year:'numeric',timeZone:'Europe/London'})},1101,[]); +__d(function(_g,_r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.clockAction=async function(n,u){if((0,t.privateClockVenue)(u.rid)&&'in'!==n)return c(n,u,{action:n,at:u.at,inside:null,unchecked:!0});const f=(0,a.areaOf)(u.rid),k=f.on&&null!=f.lat&&null!=f.lng,l=k?await(u.fixFn??r.getFix)():'unavailable';if((0,t.privateClockVenue)(u.rid)&&'object'==typeof l&&(!Number.isFinite(l.acc)||l.acc>150))return{ok:!1,message:'Your phone\u2019s location is not accurate enough to confirm you are at the pub. Enable precise location, step near a window and try again, or ask a manager to record your clock-in with a reason.'};const g=k&&'object'!=typeof l?(0,s.locWhere)():'browser',p=(0,o.gate)(f,n,k?l:'unavailable',u.at,g);if(!p.allowed){const a='object'==typeof l?void 0:'app'===g&&'denied'===l?'settings':'app-phone-off'===g?'location':'app-old'===g&&'denied'===l?'update':void 0;return'update'===a&&(0,s.checkAppUpdate)(),{ok:!1,message:(p.message??'You need to be at the venue.')+((0,t.privateClockVenue)(u.rid)?' Ask a manager to record your clock-in with a reason using Record it for someone.':''),fix:a}}const w=c(n,u,p.geo);return w.ok&&p.warn?{...w,warn:p.warn}:w},e.managerClockAction=function(t,a,r,s){const u=(0,o.overrideGeo)(t,a.at,r,s);if(!u)return{ok:!1,message:'Type a short reason (at least 3 letters).'};const f=n.useOwner.getState().staff.find(t=>t.id===a.staffId)?.name??'staff',k=c(t,a,u,{adjusted:{by:r.name,at:a.at,reason:u.override.reason}});if(k.ok){const o={in:'clocked in',out:'clocked out',break_start:'started a break for',break_end:'ended a break for'}[t],s=`${r.name} ${o} ${f} (manager, no location check): ${u.override.reason}`;n.useOwner.setState(t=>({attLog:[{id:`al-${Date.now().toString(36)}`,at:a.at,text:s},...t.attLog]}))}return k};var t=_r(d[0]),a=_r(d[1]),n=_r(d[2]),o=_r(d[3]),r=_r(d[4]),s=_r(d[5]);function c(a,o,r,s={}){const c=(0,t.venueClockGeo)(o.rid,r),u=c?!1!==c.inside:void 0,f=n.useOwner.getState(),k=(0,n.openShiftOf)(f.attendance,o.staffId,o.at);if('in'===a){if(k)return{ok:!1,message:'You\u2019re already clocked in.'};f.clock(o.staffId,o.date,'in',o.at,u);const t=(0,n.openShiftOf)(n.useOwner.getState().attendance,o.staffId,o.at);return t&&n.useOwner.getState().patchAttendance(t.id,{...o.offRota?{offRota:!0}:{},...s},c),{ok:!0,att:t&&n.useOwner.getState().attendance.find(a=>a.id===t.id)}}if(!k)return{ok:!1,message:'You\u2019re not clocked in.'};if('out'===a){let t=o.breakMins;if(o.addedBreak&&o.addedBreak>0&&!k.breaks?.length){const a=new Date(o.at).getTime(),r=new Date(Math.max(new Date(k.in).getTime(),a-6e4*o.addedBreak)).toISOString();n.useOwner.getState().patchAttendance(k.id,{breaks:[{start:r,end:o.at}],breakAddedAtClockOut:o.addedBreak}),t=Math.round((a-new Date(r).getTime())/6e4)}return n.useOwner.getState().clock(o.staffId,o.date,'out',o.at,u,t),n.useOwner.getState().patchAttendance(k.id,s,c),{ok:!0,att:n.useOwner.getState().attendance.find(t=>t.id===k.id)}}return n.useOwner.getState().breakToggle(o.staffId,'break_start'===a?'start':'end',o.at)?(n.useOwner.getState().patchAttendance(k.id,s,c),{ok:!0,att:n.useOwner.getState().attendance.find(t=>t.id===k.id)}):{ok:!1,message:'break_start'===a?'You\u2019re already on a break.':'You\u2019re not on a break.'}}},1103,[989,1207,856,954,1274,1290]); +__d(function(_g,_r,_i,_a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"canEditCards",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"canSignOffCards",{enumerable:!0,get:function(){return i}}),e.suggestForIngredient=a,e.suggestAllergens=o,Object.defineProperty(e,"suggestedBy",{enumerable:!0,get:function(){return l}}),e.unresolved=c,e.applySuggestions=function(n){const t={...n.allergens};for(const i of c(n))t[i]='contains';return t},Object.defineProperty(e,"cardState",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"STATE_LABEL",{enumerable:!0,get:function(){return f}}),e.signOffBlock=function(n){if(!n.dish.trim())return'Give the dish a name first.';const t=c(n);return t.length?`Check the suggested allergens first: ${t.map(g).join(', ')}.`:n.allergensConfirmed?null:'Confirm the allergen list first.'},Object.defineProperty(e,"allergenList",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"CONTENT_FIELDS",{enumerable:!0,get:function(){return p}}),e.editCard=function(n,t,i,r){const{confirmAllergens:s,...a}=t,l=Object.keys(a).filter(t=>!h(a[t],n[t]));let u={...n};for(const n of l)u[n]=a[n];const f=l.some(n=>'allergens'===n||'dismissed'===n||'ingredients'===n);f&&!h(o(u.ingredients),o(n.ingredients))&&(u.allergensConfirmed=void 0);f&&(l.includes('allergens')||l.includes('dismissed'))&&(u.allergensConfirmed=void 0);let g=!1;!s||u.allergensConfirmed||c(u).length||(u.allergensConfirmed={by:i,at:r},g=!0);const m=l.length>0||g,p=l.length>0&&!!n.signOff;if(!m)return{card:n,changed:!1,resetSignOff:!1};l.length&&(u={...u,signOff:null,version:n.version+1});return{card:{...u,updatedAt:r,updatedBy:i},changed:m,resetSignOff:p}},e.signOffCard=function(n,t,i){return{...n,signOff:{by:t,at:i},wasLive:!0,updatedAt:i,updatedBy:t}},e.overlayItem=function(n,t){return t?{...n,name:t.dish,section:t.section,price:t.price,allergens:t.allergens,allergenNotes:t.allergenNotes,signOff:t.signOff?{by:t.signOff.by,at:t.signOff.at.slice(0,10)}:null,hidden:n.hidden||!t.signOff&&!t.wasLive,recipeCardId:t.id}:n},e.dishesFor=function(n,t){const i=n.filter(n=>!n.hidden),r=i.filter(n=>t.some(t=>'contains'===n.allergens[t])),s=i.filter(n=>!r.includes(n)&&t.some(t=>'may'===n.allergens[t])),a=i.filter(n=>!r.includes(n)&&!s.includes(n));return{contains:r,may:s,free:a}},e.filterCards=function(n,t,i,r="free-from"){const s=t.toLowerCase().split(/\s+/).filter(Boolean);return n.filter(n=>{const t=[n.dish,n.section,...n.ingredients.map(n=>n.name)].join(' ').toLowerCase();return!!s.every(n=>t.includes(n))&&(!i.length||('free-from'===r?i.every(t=>!n.allergens[t]):i.some(t=>!!n.allergens[t])))})},e.uuid=function(){const n=globalThis.crypto;if(n?.randomUUID)return n.randomUUID();const t=Array.from({length:16},()=>Math.floor(256*Math.random()));t[6]=15&t[6]|64,t[8]=63&t[8]|128;const i=t.map(n=>n.toString(16).padStart(2,'0')).join('');return`${i.slice(0,8)}-${i.slice(8,12)}-${i.slice(12,16)}-${i.slice(16,20)}-${i.slice(20)}`},e.uuidFrom=function(n){let t='';for(let i=0;i<4;i++){let r=2166136261^2654435761*i;for(let t=0;t>>0;t+=r.toString(16).padStart(8,'0')}const i=t.slice(0,12)+'4'+t.slice(13,16)+(3&parseInt(t[16],16)|8).toString(16)+t.slice(17,32);return`${i.slice(0,8)}-${i.slice(8,12)}-${i.slice(12,16)}-${i.slice(16,20)}-${i.slice(20,32)}`},Object.defineProperty(e,"RECIPE_CARD_EXTRA_COLUMNS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"STEP_SEP",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"photoPath",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"RECIPE_PHOTO_BUCKET",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"RECIPE_CARD_TABLE",{enumerable:!0,get:function(){return v}}),e.cardToRow=function(n,t){return{row:{id:n.id,venue_id:t,dish:n.dish,ingredients:n.ingredients.map(({name:n,qty:t,unit:i,allergens:r})=>({name:n,qty:t,unit:i,...r?.length?{allergens:r}:{}})),method:n.steps.join(y),allergens:m(n.allergens,'contains'),may_contain:m(n.allergens,'may'),photo_url:!n.photo||n.photo.startsWith('local:')||n.photo.startsWith('asset:')?null:n.photo,signed_off_by:n.signOff?.by??null,signed_off_at:n.signOff?.at??null,updated_at:n.updatedAt},extra:{menu_item_id:n.menuItemId,section:n.section,price_pence:n.price,dismissed:n.dismissed,allergen_notes:n.allergenNotes??null,allergens_confirmed_by:n.allergensConfirmed?.by??null,allergens_confirmed_at:n.allergensConfirmed?.at??null,was_live:n.wasLive,origin:n.origin,version:n.version,updated_by:n.updatedBy}}},e.rowToCard=function(n,t,i={}){const r={};n.may_contain.forEach(n=>{r[n]='may'}),n.allergens.forEach(n=>{r[n]='contains'});const s=n.updated_at??(new Date).toISOString();return{id:n.id,restaurantId:t,menuItemId:i.menu_item_id??n.id,dish:n.dish,section:i.section??'Mains',price:i.price_pence??null,photo:n.photo_url??void 0,ingredients:n.ingredients.map((t,i)=>({id:`${n.id}-i${i}`,...t})),steps:n.method?n.method.split(y).filter(n=>n.trim()):[],allergens:r,dismissed:i.dismissed??[],allergenNotes:i.allergen_notes??void 0,allergensConfirmed:i.allergens_confirmed_by?{by:i.allergens_confirmed_by,at:i.allergens_confirmed_at}:void 0,signOff:n.signed_off_by&&n.signed_off_at?{by:n.signed_off_by,at:n.signed_off_at}:null,wasLive:i.was_live??!!n.signed_off_by,origin:i.origin??'new',version:i.version??1,createdAt:s,updatedAt:s,updatedBy:i.updated_by??''}};var n=_r(d[0]);const t=n=>'head-chef'===n||'manager'===n||'owner'===n,i=n=>'head-chef'===n,r=[[/\b(flour(?!y)|wheat|bread|crumb|panko|pastry|brioche|buns?\b|crouton|crostini|batter|beer|ale\b|lager|stout|barley|malt|rye|spelt|oat|couscous|semolina|pasta|penne|macaroni|spaghetti|noodle|biscuit|sponge|crumble|roux|tempura|digestive|self.raising)/i,['gluten']],[/\b(prawn|langoustine|lobster|crab|shrimp|crayfish|scampi|shellfish)/i,['crustaceans']],[/\b(mussel|scallop|clam|cockle|squid|calamari|octopus|whelk|winkle|oyster(?! mushroom)|oyster sauce)/i,['molluscs']],[/\b(egg|mayonnaise|mayo|aioli|tartare|hollandaise|meringue|custard|brioche|bearnaise)/i,['eggs']],[/\b(fish(?!er)|haddock|cod|salmon|hake|anchov|tuna|mackerel|trout|sea bass|monkfish|pollock|halibut|kipper|worcester|fish sauce|caesar)/i,['fish']],[/\b(peanut|groundnut|satay)/i,['peanuts']],[/\b(almond|hazelnut|walnut|cashew|pecan|pistachio|macadamia|brazil nut|praline|frangipane|marzipan|pesto)/i,['treenuts']],[/\b(soy|soya|tofu|edamame|miso|tamari|tempeh)/i,['soya']],[/\b(milk|butter(?!nut)|cream|cheese|cheddar|parmesan|mozzarella|brie|yoghurt|yogurt|cr[e\xe8]me|ghee|ice cream|custard|butterscotch|toffee|fudge|buttermilk|mascarpone|ricotta|whey)/i,['milk']],[/\b(celery|celeriac|stock cube|beef stock|chicken stock|veg(etable)? stock)/i,['celery']],[/\b(mustard|dijon|vinaigrette|piccalilli)/i,['mustard']],[/\b(sesame|tahini|hummus|houmous)/i,['sesame']],[/\b(wine|vinegar|dried apricot|dried fruit|sulphite|sulfite|prosecco|cider|port\b|sherry|dates?\b|raisin|sultana)/i,['sulphites']],[/\blupin/i,['lupin']]],s=[[/gluten.free|\bgf\b/i,'gluten'],[/dairy.free|vegan (butter|cheese|cream)|oat milk|plant.based/i,'milk'],[/egg.free|vegan mayo/i,'eggs']];function a(t){const i=new Set(t.allergens??[]);for(const[n,s]of r)n.test(t.name)&&s.forEach(n=>i.add(n));for(const[n,r]of s)n.test(t.name)&&!(t.allergens??[]).includes(r)&&i.delete(r);return n.ALLERGENS.map(n=>n.id).filter(n=>i.has(n))}function o(t){const i=new Set(t.flatMap(a));return n.ALLERGENS.map(n=>n.id).filter(n=>i.has(n))}const l=(n,t)=>n.filter(n=>a(n).includes(t)).map(n=>n.name);function c(n){return o(n.ingredients).filter(t=>!n.allergens[t]&&!n.dismissed.includes(t))}const u=n=>n.signOff?'signed-off':'awaiting',f={'signed-off':'Signed off',awaiting:'Awaiting sign-off'};const g=t=>n.ALLERGENS.find(n=>n.id===t)?.short??t,m=(t,i)=>n.ALLERGENS.filter(n=>i?t[n.id]===i:!!t[n.id]).map(n=>n.id),p=['dish','section','price','photo','ingredients','steps','allergens','dismissed','allergenNotes'],h=(n,t)=>JSON.stringify(n??null)===JSON.stringify(t??null);const b={menu_item_id:'text',section:'text',price_pence:'integer null',dismissed:'text[]',allergen_notes:'text',allergens_confirmed_by:'text',allergens_confirmed_at:'timestamptz',was_live:'boolean',origin:'text',version:'integer',updated_by:'text'},y='\n',_=(n,t)=>`${n}/${t.id}-v${t.version}.jpg`,O='recipe-photos',v='recipe_cards'},1104,[814]); +__d(function(g,r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ACCIDENT_CATEGORIES",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"RIDDOR_CATEGORIES",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"sid",{enumerable:!0,get:function(){return u}}),_e.isSeedAccident=w,Object.defineProperty(_e,"useSafety",{enumerable:!0,get:function(){return b}});var e,t=r(_d[0]),n=r(_d[1]),a=r(_d[2]),s=r(_d[3]),o=(e=s)&&e.__esModule?e:{default:e},d=r(_d[4]),c=r(_d[5]),l=r(_d[6]);const p=['Near miss','Slip, trip or fall','Cut','Burn or scald','Manual handling','Struck by an object','Allergic reaction','Fall from height','Fracture or dislocation','Taken to hospital','Lost consciousness','Off work more than 7 days','Other'],f=['Fall from height','Fracture or dislocation','Taken to hospital','Lost consciousness','Off work more than 7 days'];let y=0;const u=e=>`${e}-${Date.now().toString(36)}${(y++).toString(36)}`,h=(e,t,n)=>({id:e,when:t,location:'',person:'',personType:'Staff',category:'Near miss',what:'',injury:'None',firstAid:'None needed',witnesses:'',reportedBy:'',reportedById:'',app:'staff',createdAt:`${t}:00`,...n});function S(){const e=new Date,t=(t,n)=>{const a=new Date(e);return a.setDate(a.getDate()-t),`${a.toISOString().slice(0,10)}T${n}`};return[h('acc-ex1',t(3,'19:40'),{location:'Kitchen pass',person:'Server (example)',category:'Near miss',what:'Example: water on the floor by the pass after the glass washer leaked. Nobody slipped.',firstAid:'None needed',witnesses:'Bar (example)',reportedBy:'Server (example)',reportedById:'st-4',app:'staff'}),h('acc-ex2',t(6,'12:15'),{location:'Kitchen: fryer section',person:'Head Chef (example)',category:'Burn or scald',what:'Example: splash of hot oil on the back of the hand while changing the basket.',injury:'Small burn, back of left hand',firstAid:'Cooled under running water for 20 minutes, sterile dressing',witnesses:'None',reportedBy:'Head Chef (example)',reportedById:'st-3',app:'chef'})]}function w(e){const t=({when:e,createdAt:t,...n})=>JSON.stringify(n);return S().some(n=>n.id===e.id&&t(n)===t(e))}const b=(0,d.create)()((0,c.persist)(e=>({points:l.DEFAULT_POINTS,entries:[],accidents:a.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD?[]:S(),probes:[],diary:[],daySigns:[],weekly:[],addNote:t=>e(e=>({diary:[{...t,id:u('dn')},...e.diary??[]]})),signDay:t=>e(e=>({daySigns:[...(e.daySigns??[]).filter(e=>e.date!==t.date),t]})),signWeek:t=>e(e=>({weekly:[{...t,id:u('wk')},...(e.weekly??[]).filter(e=>e.week!==t.week)]})),addProbe:t=>e(e=>({probes:[...e.probes??[],{...t,id:u('pr'),status:'not-connected'}]})),removeProbe:t=>e(e=>({probes:(e.probes??[]).filter(e=>e.id!==t)})),addEntries:t=>e(e=>({entries:[...t.map(e=>({...e,id:u('hc')})),...e.entries]})),setPoint:(t,n)=>e(e=>({points:e.points.map(e=>e.id===t?{...e,...n}:e)})),addPoint:t=>e(e=>({points:[...e.points,{...t,id:u('cp')}]})),resetPoints:()=>e({points:l.DEFAULT_POINTS}),addAccident:t=>e(e=>({accidents:[{...t,id:u('acc'),createdAt:(new Date).toISOString()},...e.accidents]})),setRiddorNote:(t,n)=>e(e=>({accidents:e.accidents.map(e=>e.id===t?{...e,riddorNote:n}:e)}))}),{name:'covercharge-safety-v1',storage:(0,c.createJSONStorage)(()=>o.default),version:4,migrate:async(e,a)=>{if(t.LIVE_VENUE_BUILD&&e&&await(0,n.archiveChefCache)('safety',e),e&&a<2){const t=new Set((e.points??[]).map(e=>e.id));e.points=[...e.points??[],...l.DEFAULT_POINTS.filter(e=>!t.has(e.id))],e.diary=e.diary??[],e.daySigns=e.daySigns??[],e.weekly=e.weekly??[]}return t.LIVE_VENUE_BUILD&&e&&(e.accidents=(e.accidents||[]).filter(e=>!w(e))),e}}))},1105,[833,1132,5,1116,952,1117,1113]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"libraryRowId",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"personRowId",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"tickId",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"personKey",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"useDailyTasks",{enumerable:!0,get:function(){return L}}),Object.defineProperty(_e,"tasksOf",{enumerable:!0,get:function(){return O}});var e,t=r(d[0]),i=(e=t)&&e.__esModule?e:{default:e},s=r(d[1]),n=r(d[2]),o=r(d[3]),u=r(d[4]),c=r(d[5]);const l=e=>(0,o.uuidFrom)(`daily-task-library:${e}`),y=(e,t)=>(0,o.uuidFrom)(`daily-tasks:${e}:${t}`),b=(e,t,i,s)=>(0,o.uuidFrom)(`daily-task-tick:${e}:${(0,u.tickKey)(t,i,s)}`),f=()=>(new Date).toISOString(),k=(e,t)=>`${e}|${t}`,p=e=>u.DEFAULT_LIBRARY.map((t,i)=>({id:(0,o.uuidFrom)(`daily-task-lib:${e}:${i}`),text:t})),L=(0,s.create)()((0,n.persist)((e,t)=>({library:{},people:{},ticks:[],ensure:i=>{t().library[i]||e(e=>({library:{...e.library,[i]:{items:p(i)}}}))},setLibrary:(t,i)=>e(e=>({library:{...e.library,[t]:{items:i,updatedAt:f()}}})),addLibrary:(e,i)=>{const s=(0,u.cleanTaskText)(i);if(!s)return;const n=t().library[e]?.items??p(e);n.some(e=>e.text.toLowerCase()===s.toLowerCase()&&!e.archived)||t().setLibrary(e,[...n,{id:(0,c.uuid)(),text:s}])},setTasks:(t,i,s)=>e(e=>({people:{...e.people,[k(t,i)]:{tasks:s,updatedAt:f()}}})),addTask:(e,i,s,n)=>{const o=(0,u.cleanTaskText)(s);if(!o)return;const l=t().people[k(e,i)]?.tasks??[];l.some(e=>e.text.toLowerCase()===o.toLowerCase())||t().setTasks(e,i,[...l,{id:(0,c.uuid)(),text:o,...n?{libraryId:n}:{}}])},toggleTick:(t,i,s,n,o)=>e(e=>{const u=b(t,i,s,n);if(e.ticks.some(e=>e.id===u))return{ticks:e.ticks.filter(e=>e.id!==u)};const c=new Date(Date.now()-12096e5).toISOString().slice(0,10);return{ticks:[...e.ticks.filter(e=>e.forDate>=c),{id:u,rid:t,staffRef:i,taskId:s,forDate:n,byRef:o.id,byName:o.name,at:f()}]}}),resetLibrary:e=>t().setLibrary(e,p(e))}),{name:'covercharge-daily-tasks-v1',version:1,storage:(0,n.createJSONStorage)(()=>i.default)})),O=(e,t)=>L.getState().people[k(e,t)]?.tasks??[]},1106,[1116,952,1117,1104,1107,1034]); +__d(function(g,r,_i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TASK_MAX",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"cleanTaskText",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"appliesOn",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"tasksFor",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"tickKey",{enumerable:!0,get:function(){return u}}),e.progress=function(t,n,o,u,c){const s=i(t,c),f=new Set(n.filter(t=>t.staffRef===o&&t.forDate===u).map(t=>t.taskId));return{done:s.filter(t=>f.has(t.id)).length,total:s.length}},e.move=function(t,n,o){const i=n+o;if(n<0||i<0||n>=t.length||i>=t.length)return t;const u=[...t];return[u[n],u[i]]=[u[i],u[n]],u},Object.defineProperty(e,"hasTask",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"DEFAULT_LIBRARY",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"TASK_DAY_NAMES",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"isHeadChefP",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"isKitchenP",{enumerable:!0,get:function(){return d}}),e.canEditTasks=function(t,n){return!!t&&('owner'===t.role||'manager'===t.role||!!l(t)&&(t.id!==n.id&&'staff'===n.role&&!l(n)&&d(n)))};const t=80,n=n=>n.replace(/\s+/g,' ').trim().slice(0,t),o=(t,n)=>!t.days||0===t.days.length||t.days.includes(n),i=(t,n)=>t.filter(t=>o(t,n)),u=(t,n,o)=>`${t}|${n}|${o}`;const c=(t,o)=>t.some(t=>t.text.toLowerCase()===n(o).toLowerCase()),s=['Restock the bar fridges','Wipe down the menus','Check the toilets','Set the tables','Polish glasses','Empty the bins','Clean the coffee machine','Take out the recycling'],f=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],l=t=>'staff'===t.role&&('Head Chef'===t.level||/^head chef/i.test(t.job??'')),d=t=>'kitchen'===(t.dept??'').trim().toLowerCase()},1107,[]); +__d(function(g,_r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"LEGAL_LIMIT_MINS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"DEFAULT_BREAK_RULES",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"REMINDER_WINDOW_MINS",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"CHAIRS_TEXT",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"defaultChairs",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"DAY_NAMES",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"AUDIENCE_LABEL",{enumerable:!0,get:function(){return u}}),e.clampRules=s,Object.defineProperty(e,"validTime",{enumerable:!0,get:function(){return c}}),e.ukClock=d,e.reminderDue=function(t,n){const o=d(n);if(t.paused||!c(t.time)||!t.days.includes(o.dow))return{due:!1,forDate:o.ymd};const i=l(t.time);return{due:o.mins>=i&&o.mins=t.shiftEnd))return null;const r=m(t).filter(n=>n.at<=t.now),o=r.length?r[r.length-1]:null;if(!o)return null;if(t.nowr?o:null}return o};const t=360,n={on:!0,afterMins:240,repeatMins:30,snoozeMins:15},r=180,o='Time to put the chairs up on the tables',i=t=>({id:t,text:o,days:[5,0],time:'21:00',audience:'all',builtIn:'chairs'}),a=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],u={all:'Everyone on shift',foh:'Front of house',kitchen:'Kitchen'};function s(r){const o=(t,n,r,o)=>{const i=Math.round(Number(t));return Number.isFinite(i)?Math.min(o,Math.max(r,i)):n};return{on:!1!==r.on,afterMins:o(r.afterMins,n.afterMins,30,t),repeatMins:o(r.repeatMins,n.repeatMins,5,120),snoozeMins:o(r.snoozeMins,n.snoozeMins,5,60)}}const c=t=>/^([01]\d|2[0-3]):[0-5]\d$/.test(t);function d(t){const n='number'==typeof t?new Date(t):t,r=Object.fromEntries(new Intl.DateTimeFormat('en-GB',{timeZone:'Europe/London',weekday:'short',year:'numeric',month:'2-digit',day:'2-digit',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}).formatToParts(n).map(t=>[t.type,t.value]));return{dow:a.indexOf(String(r.weekday).slice(0,3)),mins:60*Number(r.hour)+Number(r.minute),ymd:`${r.year}-${r.month}-${r.day}`}}const l=t=>60*Number(t.slice(0,2))+Number(t.slice(3,5));const f=(t,n)=>'all'===t||('kitchen'===t?n:!n);function m(t){const n=s(t.rules),r=t.clockIn??t.shiftStart;if(!n.on||void 0===r||t.hadBreak)return[];const o=r+216e5,i=Math.min(void 0!==t.rotaBreak&&t.rotaBreak>r?t.rotaBreak:r+6e4*n.afterMins,o),a=[{stage:1,at:i,label:void 0!==t.rotaBreak&&t.rotaBreak>r&&t.rotaBreak<=o?'Your break on the rota is now.':'Time for your break.'}],u=i+6e4*n.repeatMins;return a.push({stage:2,at:u,label:'Reminder: you haven\u2019t had your break yet.'}),o>u&&a.push({stage:3,at:o,label:'You\u2019ve worked 6 hours without a break. You need a 20-minute break (UK law).'}),a}},1108,[]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"TAKINGS_FIELDS",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"NO_SERVICE_SPLIT",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"TAKINGS_KEYS",{enumerable:!0,get:function(){return t}}),_e.withTakingsFields=function(t){t=t.filter(e=>!n.includes(e.key));const r=new Set(t.map(e=>e.key)),o=e.filter(e=>!r.has(e.key)).map(e=>({...e}));if(!o.length)return t;const l=t.findIndex(e=>'cash'===e.key),i=l<0?t.length:l+1;return[...t.slice(0,i),...o,...t.slice(i)]},Object.defineProperty(_e,"grossOf",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"DEFAULT_CASHUP_FIELDS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"DEFAULT_SALES_FIELDS",{enumerable:!0,get:function(){return l}}),_e.parseAmount=function(e,n="money"){const t=e.replace(/[\xa3,\s]/g,'');return t?'number'===n?/^\d{1,6}$/.test(t)?Number(t):null:/^-?\d{1,7}(\.\d{1,2})?$/.test(t)?Math.round(100*Number(t))/100:null:null},Object.defineProperty(_e,"isBlank",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"ymdUTC",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"addDaysYmd",{enumerable:!0,get:function(){return u}}),_e.weekStartOf=function(e){const n=(s(e).getUTCDay()+6)%7;return u(e,-n)},_e.combinedTips=function(e){const n='number'==typeof e.cashTips?e.cashTips:null,t='number'==typeof e.cardTips?e.cardTips:null;return null==n&&null==t?null:Math.round(100*((n??0)+(t??0)))/100},Object.defineProperty(_e,"takings",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"missing",{enumerable:!0,get:function(){return d}}),_e.dailySeries=function(e,n,t,r=c){const o=new Map(e.filter(e=>e.confirmedAt).map(e=>[e.date,e]));return Array.from({length:t},(e,l)=>{const i=u(n,l-t+1),a=o.get(i);return{date:i,value:a?r(a.vals):null}})},_e.weekCompare=function(e,n,t="net"){const r=n=>{const r=e.find(e=>e.weekStart===n&&e.confirmedAt),o=r?.vals[t];return'number'==typeof o?o:null},o=r(n),l=r(u(n,-7)),i=null!=o&&null!=l&&0!==l?Math.round((o-l)/l*1e3)/10:null;return{now:o,prev:l,change:i}},_e.tipsPot=function(e,n,t,r){const o=n.filter(e=>'payout'===e.kind&&e.throughDate).sort((e,n)=>e.at.localeCompare(n.at)),l=o[o.length-1],i=l?u(l.throughDate,1):t,a=e.filter(e=>e.date>=i&&e.date<=r).sort((e,n)=>e.date.localeCompare(n.date)),s=n.filter(e=>'correction'===e.kind&&e.forDate&&e.forDate>=i&&e.forDate<=r&&(!l||e.at>l.at)),c=Math.round(100*(a.reduce((e,n)=>e+n.total,0)+s.reduce((e,n)=>e+n.amount,0)))/100;return{from:i,total:Math.max(0,c),days:a,corrections:s,lastPayout:l??null,history:o.slice().reverse()}},_e.cashLocked=function(e,n=Date.now()){return!(!e.onServer||!e.confirmedAt)&&!(e.unlockedUntil&&Date.parse(e.unlockedUntil)>n)},_e.changedFields=function(e,n){const t=e??{},r=n??{},o=[],l=t.vals??{},i=r.vals??{};for(const e of new Set([...Object.keys(l),...Object.keys(i)]))JSON.stringify(l[e])!==JSON.stringify(i[e])&&o.push(e);JSON.stringify(t.categories??null)!==JSON.stringify(r.categories??null)&&(t.categories||r.categories)&&o.push('categories');JSON.stringify(t.photos??[])!==JSON.stringify(r.photos??[])&&e&&n&&o.push('photos');return o};const e=[{key:'gross',label:'Gross takings',kind:'money',fixed:!0,optional:!0},{key:'food',label:'Food takings (optional)',kind:'money',fixed:!0,optional:!0},{key:'drink',label:'Drink takings (optional)',kind:'money',fixed:!0,optional:!0}],n=['lunchGross','dinnerGross'],t=e.map(e=>e.key);const r=e=>'number'==typeof e.gross?e.gross:null,o=[{key:'card',label:'Card takings',kind:'money'},{key:'cash',label:'Cash takings',kind:'money'},...e,{key:'float',label:'Float (tills)',kind:'money'},{key:'cashTips',label:'Cash tips total',kind:'money',fixed:!0},{key:'cardTips',label:'Card tips total',kind:'money',fixed:!0},{key:'overUnder',label:'Over / under (discrepancy)',kind:'money'},{key:'notes',label:'Notes',kind:'text'}],l=[{key:'gross',label:'Gross sales',kind:'money'},{key:'net',label:'Net sales',kind:'money',fixed:!0},{key:'vat',label:'VAT',kind:'money'},{key:'covers',label:'Covers',kind:'number'},{key:'discounts',label:'Discounts',kind:'money'},{key:'refunds',label:'Refunds',kind:'money'}];const i=e=>null==e||''===e,a=e=>e.toISOString().slice(0,10),s=e=>new Date(`${e}T12:00:00Z`),u=(e,n)=>{const t=s(e);return t.setUTCDate(t.getUTCDate()+n),a(t)};const c=e=>{const n='number'==typeof e.card?e.card:null,t='number'==typeof e.cash?e.cash:null;return null==n&&null==t?null:(n??0)+(t??0)},d=(e,n)=>e.filter(e=>'text'!==e.kind&&!e.optional&&i(n[e.key])).map(e=>e.key)},1109,[]); +__d(function(g,r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"FALLBACK_PAY",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"ymdOf",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"dateOf",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"plusDays",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"daysBetween",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"isValidYmd",{enumerable:!0,get:function(){return y}}),_e.cleanPay=function(t){const n={...e,...t??{}};return{tipsFrequency:['weekly','fortnightly','monthly'].includes(n.tipsFrequency)?n.tipsFrequency:'fortnightly',tipsAnchorPayday:y(String(n.tipsAnchorPayday))?n.tipsAnchorPayday:e.tipsAnchorPayday,tipsEndsDaysBefore:Math.max(0,Math.min(13,Math.round(Number(n.tipsEndsDaysBefore)||0))),wagePayDay:Math.max(1,Math.min(31,Math.round(Number(n.wagePayDay)||28))),wageCutoffDay:Math.max(1,Math.min(28,Math.round(Number(n.wageCutoffDay)||1))),weekendRule:'before'===n.weekendRule||'after'===n.weekendRule?n.weekendRule:'none'}},_e.adjustWeekend=s,_e.wagePeriod=f,_e.tipsPeriod=m,_e.nextToPay=function(e,t,n){for(let a=-2;a<=2;a++){const u='wage'===t?f(e,n,a):m(e,n,a);if((u.payday??u.end)>=n)return{period:u,offset:a}}return{period:'wage'===t?f(e,n,0):m(e,n,0),offset:0}},_e.customPeriod=function(e,t){return{kind:'custom',start:e,end:t,key:`c-${e}-${t}`}},Object.defineProperty(_e,"ukDate",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"dayMonth",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"dm",{enumerable:!0,get:function(){return M}}),Object.defineProperty(_e,"rangeText",{enumerable:!0,get:function(){return $}}),_e.parseUk=function(e){const n=e.trim();if(y(n))return n;const a=/^(\d{1,2})[/.-](\d{1,2})[/.-](\d{2}|\d{4})$/.exec(n);if(!a)return null;const u=`${2===a[3].length?2e3+Number(a[3]):Number(a[3])}-${t(Number(a[2]))}-${t(Number(a[1]))}`;return y(u)?u:null},Object.defineProperty(_e,"decH",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"hMm",{enumerable:!0,get:function(){return F}});const e={tipsFrequency:'weekly',tipsAnchorPayday:'2026-01-05',tipsEndsDaysBefore:1,wagePayDay:31,wageCutoffDay:1,weekendRule:'none'},t=e=>String(e).padStart(2,'0'),n=e=>`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}`,a=e=>{const[t,n,a]=e.split('-').map(Number);return new Date(t,n-1,a,12)},u=(e,t)=>{const u=a(e);return u.setDate(u.getDate()+t),n(u)},o=(e,t)=>Math.round((a(t).getTime()-a(e).getTime())/864e5),i=(e,t)=>new Date(e,t+1,0).getDate(),c=(e,t,a)=>{const u=new Date(e,t,1,12),o=u.getFullYear(),c=u.getMonth();return n(new Date(o,c,Math.min(a,i(o,c)),12))},y=e=>/^\d{4}-\d{2}-\d{2}$/.test(e)&&n(a(e))===e;function s(e,t="none"){if('none'===t)return e;const n=a(e).getDay();return 6===n?u(e,'before'===t?-1:2):0===n?u(e,'before'===t?-2:1):e}function d(e,t,n){const o=c(t,n,e.wageCutoffDay),i=u(c(t,n+1,e.wageCutoffDay),-1),y=a(i);let d=c(y.getFullYear(),y.getMonth(),e.wagePayDay);return dn.end))break;a++}}return a}function m(e,t,n=0){return p(e,h(e,t)+n)}const b=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],D=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],w=e=>{const[t,n,a]=e.split('-');return`${a}/${n}/${t}`},P=e=>{const t=a(e);return`${b[t.getDay()]} ${t.getDate()} ${D[t.getMonth()]}`},M=e=>{const t=a(e);return`${t.getDate()} ${D[t.getMonth()]}`},$=(e,t,n=" to ")=>e.slice(0,4)===t.slice(0,4)?`${M(e)}${n}${M(t)}`:`${M(e)} ${e.slice(0,4)}${n}${M(t)} ${t.slice(0,4)}`;const k=e=>(Math.round(e/60*100)/100).toFixed(2),F=e=>`${Math.floor(e/60)}:${t(Math.round(e)%60)}`},1110,[]); +__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.payFor=u,_e.useVenuePay=function(s){const r=(0,n.useRestaurant)(s),o=(0,t.useOnboard)(e=>e.answers);return(0,e.useMemo)(()=>u(s,r?.settings.pay,o),[s,r?.settings.pay,o])},_e.venueRange=function(e,n,t,s){const u='wage'===n?(0,r.wagePeriod)(e,(0,r.ymdOf)(s),t):(0,r.tipsPeriod)(e,(0,r.ymdOf)(s),t),o=(0,r.dateOf)(u.start);o.setHours(0,0,0,0);const y=(0,r.dateOf)(u.end);return y.setHours(0,0,0,0),{s:o,e:y,key:u.key,payday:u.payday}};var e=_r(d[0]),n=_r(d[1]),t=_r(d[2]),s=_r(d[3]),r=_r(d[4]);function u(e,n,t){if(n)return{pay:(0,r.cleanPay)(n),source:'settings'};const u=t[e]?.pay??s.SEEDED_ANSWERS[e]?.pay;return u?{pay:(0,r.cleanPay)(u),source:'questionnaire'}:{pay:r.FALLBACK_PAY,source:'none'}}},1111,[30,1022,1112,1276,1110]); +__d(function(_g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useOnboard",{enumerable:!0,get:function(){return l}});var e,s=r(_d[0]),t=(e=s)&&e.__esModule?e:{default:e},p=r(_d[1]),u=r(_d[2]);const n=()=>{const e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`},l=(0,p.create)()((0,u.persist)(e=>({setup:{},answers:{},goals:{},replay:null,markStep:(s,t,p)=>e(e=>({setup:{...e.setup,[s]:{...e.setup[s]??{steps:{}},steps:{...e.setup[s]?.steps??{},[t]:p}}}})),welcome:s=>e(e=>({setup:{...e.setup,[s]:{...e.setup[s]??{steps:{}},welcomed:n()}}})),finish:s=>e(e=>({replay:null,setup:{...e.setup,[s]:{...e.setup[s]??{steps:{}},welcomed:e.setup[s]?.welcomed??n(),finished:n()}}})),restart:s=>e(e=>({setup:{...e.setup,[s]:{steps:{}}}})),setReplay:s=>e({replay:s}),saveAnswers:(s,t)=>e(e=>({answers:{...e.answers,[s]:t}})),setGoal:(s,t)=>e(e=>{const p={...e.goals};return t?p[s]=t:delete p[s],{goals:p}})}),{name:'covercharge-onboard-v1',version:1,storage:(0,u.createJSONStorage)(()=>t.default),partialize:e=>({setup:e.setup,answers:e.answers,goals:e.goals})}))},1112,[1116,952,1117]); +__d(function(g,_r,i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"KIND_LABEL",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"TEMP_KINDS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"isTempKind",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"SECTIONS",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"SECTION_LABEL",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"sectionOf",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"initialsOf",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"DEFAULT_POINTS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"limitText",{enumerable:!0,get:function(){return d}}),_e.inRange=u,_e.spokenNumber=p,_e.parseQuick=function(e,n){return e.split(/[,;\n]+|\s+and\s+|\.\s+/i).map(e=>e.trim()).filter(Boolean).map(e=>{const r=e.toLowerCase().replace(/[\u2010\u2013]/g,'-').replace(/-(?!\d)/g,' '),o=` ${r.replace(/[^a-z0-9.\- ]/g,' ').replace(/\s+/g,' ')} `;let a,l=0;for(const e of n)for(const n of[e.name.toLowerCase(),...e.aliases]){const t=n.replace(/-/g,' ').replace(/[^a-z0-9 ]/g,' ').replace(/\s+/g,' ').trim();t&&o.includes(` ${t} `)&&t.length>l&&(a=e,l=t.length)}const s=p(r);return a?t(a.kind)?null==s?{text:e,point:a,value:null,problem:'No temperature heard \u2014 type it in.'}:{text:e,point:a,value:s}:{text:e,point:a,value:null}:{text:e,value:s,problem:'Not sure which check this is \u2014 pick it below or type it.'}})},_e.missedChecks=function(e,n,t){const r=new Date(t);r.setHours(0,0,0,0);const o=60*t.getHours()+t.getMinutes(),a=[];for(const l of e){const e=l.due.filter(e=>f(e)<=o);if(!e.length)continue;const s=e[e.length-1],c=r.getTime()+6e4*f(e[0])-108e5,d=n.filter(e=>e.pointId===l.id&&new Date(e.at).getTime()>=c&&new Date(e.at).getTime()<=t.getTime()),u=e.length;d.lengthe.map(y).join(',')).join('\r\n')+'\r\n'},Object.defineProperty(_e,"SLOTS",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"SLOT_LABEL",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"SLOT_HINT",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"slotOf",{enumerable:!0,get:function(){return C}}),_e.todayTasks=function(e,n,t){const r=new Date(t);r.setHours(0,0,0,0);const o=60*t.getHours()+t.getMinutes(),a=[];for(const l of e){const e=[...l.due].sort();if(!e.length)continue;const s=r.getTime()+6e4*f(e[0])-108e5,c=n.filter(e=>e.pointId===l.id&&new Date(e.at).getTime()>=s&&new Date(e.at).getTime()<=t.getTime()).reverse().sort((e,n)=>e.at.localeCompare(n.at));e.forEach((e,n)=>{const t=c[n],r=f(e),s=t?'done':o>=r?'overdue':o>=r-60?'due':'upcoming';a.push({key:`${l.id}@${e}`,point:l,due:e,slot:C(e),status:s,entry:t})})}return a.sort((e,n)=>e.due.localeCompare(n.due)||e.point.name.localeCompare(n.point.name))},_e.unitStatus=function(e,n,t){const r=n.filter(n=>n.pointId===e.id&&null!=n.value).reverse().sort((e,n)=>e.at.localeCompare(n.at)),o=r[r.length-1];if(!o)return{rag:'none',history:r,why:'No readings yet'};const a=o.value;if(!u(e,a))return{rag:'red',latest:o,history:r,why:'Out of range'};const l=new Date(t);if(l.setHours(0,0,0,0),new Date(o.at).getTime()e.max-1||null!=e.min&&an.includes(e),r=['cross','cleaning','chilling','cooking','management'],o={cross:'Cross-contamination',cleaning:'Cleaning',chilling:'Chilling',cooking:'Cooking',management:'Management'},a={fridge:'chilling',freezer:'chilling',cool:'chilling',delivery:'chilling',cook:'cooking',hothold:'cooking',cleaning:'cleaning',allergen:'cross',check:'management'},l=e=>e.section??a[e.kind],s=e=>e.replace(' (example)','').split(/\s+/).filter(Boolean).map(e=>e[0]).join('').slice(0,3).toUpperCase(),c=[{id:'cp-walkin',name:'Walk-in fridge',kind:'fridge',max:5,due:['09:00','16:00'],aliases:['walk in fridge','walkin fridge','walk in','walk-in','walkin','cold room']},{id:'cp-prep',name:'Prep fridge',kind:'fridge',max:5,due:['09:00','16:00'],aliases:['prep fridge','prep']},{id:'cp-bar',name:'Bar fridge',kind:'fridge',max:5,due:['16:00'],aliases:['bar fridge','bar']},{id:'cp-freezer',name:'Freezer',kind:'freezer',max:-18,due:['09:00','16:00'],aliases:['freezer','chest freezer']},{id:'cp-cook',name:'Cooking: core temperature',kind:'cook',min:75,due:[],aliases:['core','cook','cooking','probe']},{id:'cp-cool',name:'Cooling: within 90 minutes',kind:'cool',max:8,due:[],aliases:['cooling','cool']},{id:'cp-hothold',name:'Hot hold: bain-marie',kind:'hothold',min:63,due:['18:00'],aliases:['hot hold','bain marie','bain-marie','hothold']},{id:'cp-del-chill',name:'Delivery: chilled',kind:'delivery',max:8,due:[],aliases:['chilled delivery','delivery chilled','delivery']},{id:'cp-del-frozen',name:'Delivery: frozen',kind:'delivery',max:-15,due:[],aliases:['frozen delivery','delivery frozen']},{id:'cp-clean',name:'Close-down clean signed off',kind:'cleaning',due:['23:00'],aliases:['cleaning','clean down','close down']},{id:'cp-allergen',name:'Allergen matrix checked against today\u2019s specials',kind:'allergen',due:['11:00'],aliases:['allergen','allergens']},{id:'cp-open-equip',name:'Fridges, freezers and other equipment working',kind:'check',section:'management',due:['09:00'],aliases:['equipment']},{id:'cp-open-staff',name:'Staff fit for work, in clean work clothes',kind:'check',section:'management',due:['09:00'],aliases:['staff fit']},{id:'cp-open-surfaces',name:'Prep areas, surfaces and utensils clean and disinfected',kind:'cleaning',due:['09:00'],aliases:['surfaces','prep areas']},{id:'cp-open-pests',name:'No signs of pests',kind:'check',section:'cleaning',due:['09:00'],aliases:['pests','pest']},{id:'cp-open-hands',name:'Hand-wash basins: hot water, soap and paper towels',kind:'check',section:'cross',due:['09:00'],aliases:['hand wash','handwash','soap']},{id:'cp-open-probe',name:'Probe thermometer working, probe wipes available',kind:'check',section:'management',due:['09:00'],aliases:['probe wipes','thermometer']},{id:'cp-mid-boards',name:'Raw and ready-to-eat kept apart; colour-coded boards in use',kind:'check',section:'cross',due:['12:00'],aliases:['boards','raw and ready to eat']},{id:'cp-close-stored',name:'Food covered, labelled, dated and put away',kind:'check',section:'chilling',due:['22:00'],aliases:['labelled','covered']},{id:'cp-close-useby',name:'Food past its use-by date thrown away',kind:'check',section:'chilling',due:['22:00'],aliases:['use by','use-by']},{id:'cp-close-waste',name:'Waste removed and bins relined',kind:'check',section:'cleaning',due:['22:00'],aliases:['waste','bins']}],d=e=>null!=e.min&&null!=e.max?`${e.min}\xb0C to ${e.max}\xb0C`:null!=e.max?`${e.max}\xb0C or colder`:null!=e.min?`${e.min}\xb0C or hotter`:'Done / not done';function u(e,n){return(null==e.min||n>=e.min)&&(null==e.max||n<=e.max)}const m={zero:0,nought:0,one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12,thirteen:13,fourteen:14,fifteen:15,sixteen:16,seventeen:17,eighteen:18,nineteen:19,twenty:20,thirty:30,forty:40,fifty:50,sixty:60,seventy:70,eighty:80,ninety:90};function p(e){const n=e.toLowerCase().replace(/\u2212/g,'-').replace(/degrees?|\xb0c?|celsius|centigrade/g,' '),t=/\b(minus|negative)\b/.test(n),r=n.match(/-?\d+(?:[.,]\d+)?/);if(r){const e=Number(r[0].replace(',','.'));return t&&e>0?-e:e}const o=n.split(/[^a-z]+/).filter(Boolean);let a=null,l=null,s=!1;for(const e of o)if('point'!==e){if(e in m){if(s){l=m[e];break}a=(a??0)+m[e]}}else s=!0;if(null==a)return null;const c=null!=l?Number(`${a}.${l}`):a;return t?-c:c}const f=e=>{const[n,t]=e.split(':').map(Number);return 60*n+t};const h=e=>null!=e.value?`${e.value}\xb0C`:e.done?'Done':'Not done',y=e=>{const n=null==e?'':String(e);return/[",\n]/.test(n)?`"${n.replace(/"/g,'""')}"`:n},k=['Date','Time','Check','Type','Reading','Safe limit','Result','Corrective action','Note','Recorded by','Entry'];function b(n,t){return n.map(n=>{const r=new Date(n.at),o=t.find(e=>e.id===n.pointId);return[r.toLocaleDateString('en-GB'),r.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}),n.name,e[n.kind],h(n),o?d(o):'',n.ok?'OK':'OUT OF RANGE',n.corrective??'',n.note??'',n.by,'probe'===n.source?'Wireless probe':'voice'===n.source?'Voice (confirmed)':'Typed']})}const w=['opening','midday','closing'],v={opening:'Opening',midday:'Midday',closing:'Closing'},O={opening:'until 11:00',midday:'11:00 to 16:00',closing:'from 16:00'},C=e=>{const n=f(e);return n<660?'opening':n<960?'midday':'closing'};const T=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`,x=['Opening and closing checks were done every day (or the reason is in the diary)','Every out-of-range reading has a corrective action','Probe thermometers checked (iced water / boiling water) this week','Allergen information is up to date for menu and special changes','Cleaning schedule followed; no signs of pests','Staff trained on any changed safe methods']},1113,[]); +__d(function(g,r,_i,_a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"setMenuCardBridge",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"menuCardBridge",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"resolveItem",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"resolveMenu",{enumerable:!0,get:function(){return m}}),e.sortMenu=c;var t=r(d[0]);let n=null;const o=t=>{n=t},u=()=>n,i=o=>(0,t.overlayItem)(o,n?.cardFor(o.id)),m=t=>c(t.map(i));function c(t){return t.some(t=>'number'==typeof t.sort)?t.map((t,n)=>({m:t,i:n,k:'number'==typeof t.sort?t.sort:10*n})).sort((t,n)=>t.k-n.k||t.i-n.i).map(t=>t.m):t}},1114,[1104]); +__d(function(_g,_r,i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.nextTablesFree=function(t,r,o,l,u=[]){const m=`${l.getFullYear()}-${String(l.getMonth()+1).padStart(2,'0')}-${String(l.getDate()).padStart(2,'0')}`,f=(0,a.lastFoodOn)(t,m),d=f?new Date(`${m}T${f.time}:00`):null,b=t=>o.filter(a=>a.date===m&&'confirmed'===a.status&&(a.table??'').split('+').map(t=>t.trim()).includes(t)).map(t=>new Date(`${t.date}T${t.time}:00`)).filter(t=>t>=s(l,-20)).sort((t,a)=>t.getTime()-a.getTime())[0],c=[],g=[];for(const o of Object.values(r)){const r=o.table.name,m=b(r);if('free'===o.status){(!m||m>s(l,60))&&c.push(r);continue}if(!n.includes(o.status)||!o.booking)continue;const f=o.booking,h=f.seatedAt?new Date(f.seatedAt):new Date(`${f.date}T${f.time}:00`),$=(0,a.dwellFor)(t,f.partySize,u);let w=s(h,$.mins),T='maybe',p=`seated ${Math.max(0,Math.round((l.getTime()-h.getTime())/6e4))} min, usual ${$.mins} min`;'bill'===o.status?(w=s(l,10),T='likely',p='bill requested'):'dessert'===o.status?(w=new Date(Math.min(w.getTime(),s(l,25).getTime())),T='likely',p='on dessert'):'mains'===o.status&&(w=new Date(Math.min(Math.max(w.getTime(),s(l,35).getTime()),s(l,60).getTime())),p='mains out'),w=d?{drinksOnly:!0}:{}})}g.sort((t,a)=>t.at.getTime()-a.at.getTime());const h=Object.values(r).filter(t=>'blocked'!==t.status).length,$=h>0&&c.length<=Math.max(1,Math.round(.1*h));return{full:$,freeNow:c,list:g,waitFor:t=>g.find(a=>a.seats>=t)??null}},Object.defineProperty(e,"hhmm",{enumerable:!0,get:function(){return r}}),e.nextFreeSentence=function(a,n){if(a.freeNow.length&&!a.full)return`There are ${a.freeNow.length} tables free now: ${a.freeNow.slice(0,4).map(t=>`table ${t}`).join(', ')}.`;const s=a.list[0];if(!s)return a.freeNow.length?`${(0,t.tableNumbers)(a.freeNow[0])} is free now.`:'No table is due to free up before the bookings that follow; check the bookings list.';const o=Math.max(5,Math.round((s.at.getTime()-n.getTime())/6e4)),l=a.waitFor(2),u=a.waitFor(4);return`Next table free about ${r(s.at)} (table ${s.table}, ${s.seats} seats), ${s.confidence}, in about ${o} minutes.${l?` A table for 2: about ${r(l.at)}.`:''}${u?` A table for 4: about ${r(u.at)}.`:''}${s.drinksOnly?' That\u2019s after last food orders, so drinks only.':''}`};var t=_r(_d[0]),a=_r(_d[1]);const n=['seated','mains','dessert','bill'],s=(t,a)=>new Date(t.getTime()+6e4*a);const r=t=>`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`},1115,[808,809]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return f}});var e,t=r(d[0]),u=(e=t)&&e.__esModule?e:{default:e},n=r(d[1]),f={getItem:e=>u.default.getItem((0,n.venueKey)(e)),setItem:(e,t)=>u.default.setItem((0,n.venueKey)(e),t),removeItem:e=>u.default.removeItem((0,n.venueKey)(e))}},1116,[1120,5]); +__d(function(g,_r,i,_a3,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"combine",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"createJSONStorage",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"devtools",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"persist",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"redux",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"subscribeWithSelector",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"unstable_ssrSafe",{enumerable:!0,get:function(){return S}});const e=(e,t)=>(n,r,o)=>(o.dispatch=t=>(n(n=>e(n,t),!1,t),t),o.dispatchFromDevtools=!0,{dispatch:(...e)=>o.dispatch(...e),...t}),t=e=>!!e.dispatchFromDevtools&&"function"==typeof e.dispatch,n=new Map,r=e=>{const t=n.get(e);return t?Object.fromEntries(Object.entries(t.stores).map(([e,t])=>[e,t.getState()])):{}},o=(e,t,r)=>{if(void 0===e)return{type:"untracked",connection:t.connect(r)};const o=n.get(r.name);if(o)return{type:"tracked",store:e,...o};const s={connection:t.connect(r),stores:{}};return n.set(r.name,s),{type:"tracked",store:e,...s}},s=(e,t,r)=>{if(void 0===t)return;const o=n.get(e);(null==o?void 0:o.stores[t])===r&&(delete o.stores[t],0===Object.keys(o.stores).length&&n.delete(e))},a=/^at (?:new |async )?(.+?) \(/,l=/^([^@]+)@/;function c(e){var t,n,r;if(!e)return;const o=e.split("\n"),s=o.findIndex(e=>e.includes("api.setState"));if(s<0)return;const c=(null==(t=o[s+1])?void 0:t.trim())||"";return(null==(n=a.exec(c))?void 0:n[1])||(null==(r=l.exec(c))?void 0:r[1])}const u=(e,a={})=>(l,u,p)=>{const{enabled:f,anonymousActionType:y,store:h,...b}=a;let S;try{S=(null!=f?f:"production"!==(globalThis.__ExpoImportMetaRegistry.env?globalThis.__ExpoImportMetaRegistry.env.MODE:void 0))&&window.__REDUX_DEVTOOLS_EXTENSION__}catch(e){}if(!S)return e(l,u,p);const{connection:O,..._}=o(h,S,b);let w,E=!0;p.setState=(e,t,n)=>{const o=l(e,t);if(!E)return o;const s=void 0===n?{type:y||c((new Error).stack)||"anonymous"}:"string"==typeof n?{type:n}:n;return void 0===h?(null==O||O.send(s,u()),o):(null==O||O.send({...s,type:`${h}/${s.type}`},{...r(b.name),[h]:p.getState()}),o)},p.devtools={cleanup:()=>{null==w||w(),w=void 0,s(b.name,h,p),void 0!==h&&n.has(b.name)||!O||"function"!=typeof O.unsubscribe||O.unsubscribe()}};const I=(...e)=>{const t=E;E=!1,l(...e),E=t},j=e(p.setState,u,p);if("untracked"===_.type?null==O||O.init(j):(_.stores[_.store]=p,null==O||O.init(Object.fromEntries(Object.entries(_.stores).map(([e,t])=>[e,e===_.store?j:t.getState()])))),t(p)){let e=!1;const t=p.dispatch;p.dispatch=(...n)=>{"production"===(globalThis.__ExpoImportMetaRegistry.env?globalThis.__ExpoImportMetaRegistry.env.MODE:void 0)||"__setState"!==n[0].type||e||(console.warn('[zustand devtools middleware] "__setState" action type is reserved to set state from the devtools. Avoid using it.'),e=!0),t(...n)}}return w=O.subscribe(e=>{var n;const o="object"==typeof b.serialize?b.serialize.reviver:void 0;switch(e.type){case"ACTION":return"string"!=typeof e.payload?void console.error("[zustand devtools middleware] Unsupported action format"):v(e.payload,o,e=>{if("__setState"===e.type){if(void 0===h)return void I(e.state);1!==Object.keys(e.state).length&&console.error("\n [zustand devtools middleware] Unsupported __setState action format.\n When using 'store' option in devtools(), the 'state' should have only one key, which is a value of 'store' that was passed in devtools(),\n and value of this only key should be a state object. Example: { \"type\": \"__setState\", \"state\": { \"abc123Store\": { \"foo\": \"bar\" } } }\n ");const t=e.state[h];if(null==t)return;return void(JSON.stringify(p.getState())!==JSON.stringify(t)&&I(t))}t(p)&&p.dispatch(e)});case"DISPATCH":switch(e.payload.type){case"RESET":return I(j),void 0===h?null==O?void 0:O.init(p.getState()):null==O?void 0:O.init(r(b.name));case"COMMIT":return void 0===h?void(null==O||O.init(p.getState())):null==O?void 0:O.init(r(b.name));case"ROLLBACK":return v(e.state,o,e=>{if(void 0===h)return I(e),void(null==O||O.init(p.getState()));I(e[h]),null==O||O.init(r(b.name))});case"JUMP_TO_STATE":case"JUMP_TO_ACTION":return v(e.state,o,e=>{void 0!==h?JSON.stringify(p.getState())!==JSON.stringify(e[h])&&I(e[h]):I(e)});case"IMPORT_STATE":{const{nextLiftedState:t}=e.payload,r=null==(n=t.computedStates.slice(-1)[0])?void 0:n.state;if(!r)return;return I(void 0===h?r:r[h]),void(null==O||O.send(null,t))}case"PAUSE_RECORDING":return E=!E}return}}),j},v=(e,t,n)=>{let r;try{r=JSON.parse(e,t)}catch(e){console.error("[zustand devtools middleware] Could not parse the received json",e)}void 0!==r&&n(r)},p=e=>(t,n,r)=>{const o=r.subscribe;r.subscribe=(e,t,n)=>{let s=e;if(t){const o=(null==n?void 0:n.equalityFn)||Object.is;let a=e(r.getState());s=n=>{const r=e(n);if(!o(a,r)){const e=a;t(a=r,e)}},(null==n?void 0:n.fireImmediately)&&t(a,a)}return o(s)};return e(t,n,r)};function f(e,t){return(...n)=>Object.assign({},e,t(...n))}function y(e,t){let n;try{n=e()}catch(e){return}return{getItem:e=>{var r;const o=e=>null===e?null:JSON.parse(e,null==t?void 0:t.reviver),s=null!=(r=n.getItem(e))?r:null;return s instanceof Promise?s.then(o):o(s)},setItem:(e,r)=>n.setItem(e,JSON.stringify(r,null==t?void 0:t.replacer)),removeItem:e=>n.removeItem(e)}}const h=e=>t=>{try{const n=e(t);return n instanceof Promise?n:{then:e=>h(e)(n),catch(e){return this}}}catch(e){return{then(e){return this},catch:t=>h(t)(e)}}},b=(e,t)=>(n,r,o)=>{let s={storage:y(()=>window.localStorage),partialize:e=>e,version:0,merge:(e,t)=>({...t,...e}),...t},a=!1,l=0;const c=new Set,u=new Set;let v=s.storage;if(!v)return e((...e)=>{console.warn(`[zustand persist middleware] Unable to update item '${s.name}', the given storage is currently unavailable.`),n(...e)},r,o);const p=()=>{const e=s.partialize({...r()});return v.setItem(s.name,{state:e,version:s.version})},f=o.setState;o.setState=(...e)=>(f(...e),p());const b=e((...e)=>(n(...e),p()),r,o);let S;o.getInitialState=()=>b;const O=()=>{var e,t;if(!v)return;const o=++l;a=!1,c.forEach(e=>{var t;return e(null!=(t=r())?t:b)});const f=(null==(t=s.onRehydrateStorage)?void 0:t.call(s,null!=(e=r())?e:b))||void 0;return h(v.getItem.bind(v))(s.name).then(e=>{if(e){if("number"!=typeof e.version||e.version===s.version)return[!1,e.state];if(s.migrate){const t=s.migrate(e.state,e.version);return t instanceof Promise?t.then(e=>[!0,e]):[!0,t]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}return[!1,void 0]}).then(e=>{var t;if(o!==l)return;const[a,c]=e;return S=s.merge(c,null!=(t=r())?t:b),n(S,!0),a?p():void 0}).then(()=>{o===l&&(null==f||f(r(),void 0),S=r(),a=!0,u.forEach(e=>e(S)))}).catch(e=>{o===l&&(null==f||f(void 0,e))})};return o.persist={setOptions:e=>{s={...s,...e},e.storage&&(v=e.storage)},clearStorage:()=>{++l,null==v||v.removeItem(s.name)},getOptions:()=>s,rehydrate:()=>O(),hasHydrated:()=>a,onHydrate:e=>(c.add(e),()=>{c.delete(e)}),onFinishHydration:e=>(u.add(e),()=>{u.delete(e)})},s.skipHydration||O(),S||b};function S(e,t="undefined"==typeof window){return(n,r,o)=>{if(!t)return e(n,r,o);const s=()=>{throw new Error("Cannot set state of Zustand store in SSR")};return o.setState=s,e(s,r,o)}}},1117,[]); +__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useKitchenExtra",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"isManagerish",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"isHeadChef",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"isKitchenStaff",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"kitchenByRule",{enumerable:!0,get:function(){return l}}),_e.inKitchen=b,_e.inChannel=function(e,t){return!!t&&(e.startsWith('dm:')?e.split(':').slice(1).includes(t.id):'all'===e||('kitchen'===e?b(t):'managers'===e?o(t):'foh'===e&&(o(t)||/front|bar|server|waiting/i.test(t.job))))},Object.defineProperty(_e,"dmId",{enumerable:!0,get:function(){return h}});var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},c=r(d[1]),a=r(d[2]);const u=(0,c.create)()((0,a.persist)(e=>({extra:{},set:(t,n)=>e(e=>{const c={...e.extra};return null==n?delete c[t]:c[t]=n,{extra:c}})}),{name:'covercharge-kitchen-chat-v1',version:1,storage:(0,a.createJSONStorage)(()=>n.default)})),o=e=>!!e&&'staff'!==e.role,s=e=>!!e&&/head chef/i.test((e.level??'')+' '+e.job),f=e=>!!e&&(/^kitchen$/i.test(e.dept??'')||/chef|kitchen|\bkp\b|porter/i.test(e.job)),l=e=>!!e&&(o(e)||s(e)||f(e));function b(e){if(!e||!e.active)return!1;return u.getState().extra[e.id]??l(e)}const h=(e,t)=>`dm:${[e,t].sort().join(':')}`},1118,[1116,952,1117]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.setLiveData=c,e.requireRealData=function(){t=!0,c(!0)},Object.defineProperty(e,"liveData",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"examplesAllowed",{enumerable:!0,get:function(){return l}}),e.onDataModeChange=function(n){return s.add(n),()=>{s.delete(n)}},Object.defineProperty(e,"EXAMPLE_LABEL",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"notEnoughTip",{enumerable:!0,get:function(){return b}});const n=['anchorage','souters','kirkmichael','wildings','kirkton','abbotsford','greenside',"3idiots","cecchinis","mrbasrais","yasmins","williewastles","rupeeroom","smokinggoat","pizzaioli","drunkencoo"].includes("wildings");let t=n,o=n;const s=new Set;function c(n){o!==(n=t||n)&&(o=n,s.forEach(n=>n()))}const u=()=>o,l=()=>!o;const f='Example figures',b=n=>`Forecasts start once CoverCharge has ${1===n?'1 week':`${n} weeks`} of your bookings and cash-ups.`},1119,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useAsyncStorage",{enumerable:!0,get:function(){return n.useAsyncStorage}}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return o}});var e,t=r(d[0]),u=(e=t)&&e.__esModule?e:{default:e},n=r(d[1]),o=u.default},1120,[1121,1125]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return i}});var e,t=r(d[0]);const o=((e=t)&&e.__esModule?e:{default:e}).default.bind({concatArrays:!0,ignoreUndefined:!0});function n(e,t){const n=window.localStorage.getItem(e);if(n){const l=JSON.parse(n),c=JSON.parse(t),s=JSON.stringify(o(l,c));window.localStorage.setItem(e,s)}else window.localStorage.setItem(e,t)}function l(e,t){return new Promise((o,n)=>{try{const n=e();t?.(null,n),o(n)}catch(e){t?.(e),n(e)}})}function c(e,t,o){return Promise.all(e).then(e=>{const n=o?.(e)??null;return t?.(null,n),Promise.resolve(n)},e=>(t?.(e),Promise.reject(e)))}const s={getItem:(e,t)=>l(()=>window.localStorage.getItem(e),t),setItem:(e,t,o)=>l(()=>window.localStorage.setItem(e,t),o),removeItem:(e,t)=>l(()=>window.localStorage.removeItem(e),t),mergeItem:(e,t,o)=>l(()=>n(e,t),o),clear:e=>l(()=>window.localStorage.clear(),e),getAllKeys:e=>l(()=>{const e=window.localStorage.length,t=[];for(let o=0;o{},multiGet:(e,t)=>c(e.map(e=>s.getItem(e)),t,t=>t.map((t,o)=>[e[o],t])),multiSet:(e,t)=>c(e.map(e=>s.setItem(e[0],e[1])),t),multiRemove:(e,t)=>c(e.map(e=>s.removeItem(e)),t),multiMerge:(e,t)=>c(e.map(e=>s.mergeItem(e[0],e[1])),t)};var i=s},1121,[1122]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u}});var e,t=r(d[0]),u=((e=t)&&e.__esModule?e:{default:e}).default},1122,[1123]); +__d(function(g,r,i,a,m,e,d){'use strict';const t=r(d[0]),{hasOwnProperty:n}=Object.prototype,{propertyIsEnumerable:o}=Object,c=(t,n,o)=>Object.defineProperty(t,n,{value:o,writable:!0,enumerable:!0,configurable:!0}),s=this,f={concatArrays:!1,ignoreUndefined:!1},l=t=>{const c=[];for(const o in t)n.call(t,o)&&c.push(o);if(Object.getOwnPropertySymbols){const n=Object.getOwnPropertySymbols(t);for(const s of n)o.call(t,s)&&c.push(s)}return c};function u(n){return Array.isArray(n)?y(n):t(n)?p(n):n}function y(t){const n=t.slice(0,0);return l(t).forEach(o=>{c(n,o,u(t[o]))}),n}function p(t){const n=null===Object.getPrototypeOf(t)?Object.create(null):{};return l(t).forEach(o=>{c(n,o,u(t[o]))}),n}const b=(t,n,o,s)=>(o.forEach(o=>{void 0===n[o]&&s.ignoreUndefined||(o in t&&t[o]!==Object.getPrototypeOf(t)?c(t,o,h(t[o],n[o],s)):c(t,o,u(n[o])))}),t),O=(t,o,s)=>{let f=t.slice(0,0),y=0;return[t,o].forEach(o=>{const p=[];for(let s=0;s!p.includes(t)),s)}),f};function h(n,o,c){return c.concatArrays&&Array.isArray(n)&&Array.isArray(o)?O(n,o,c):t(o)&&t(n)?b(n,o,l(o),c):u(o)}m.exports=function(...n){const o=h(u(f),this!==s&&this||{},f);let c={_:{}};for(const s of n)if(void 0!==s){if(!t(s))throw new TypeError('`'+s+'` is not an Option Object');c=h(c,{_:s},o)}return c._}},1123,[1124]); +__d(function(g,r,i,a,m,e,d){'use strict';m.exports=t=>{if('[object Object]'!==Object.prototype.toString.call(t))return!1;const o=Object.getPrototypeOf(t);return null===o||o===Object.prototype}},1124,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.useAsyncStorage=function(e){return{getItem:(...t)=>u.default.getItem(e,...t),setItem:(...t)=>u.default.setItem(e,...t),mergeItem:(...t)=>u.default.mergeItem(e,...t),removeItem:(...t)=>u.default.removeItem(e,...t)}};var e,t=r(d[0]),u=(e=t)&&e.__esModule?e:{default:e}},1125,[1121]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"createStore",{enumerable:!0,get:function(){return n}});const t=t=>{let n;const c=new Set,o=(t,o)=>{const s="function"==typeof t?t(n):t;if(!Object.is(s,n)){const t=n;n=(null!=o?o:"object"!=typeof s||null===s)?s:Object.assign({},n,s),c.forEach(c=>c(n,t))}},s=()=>n,u={setState:o,getState:s,getInitialState:()=>l,subscribe:t=>(c.add(t),()=>c.delete(t))},l=n=t(o,s,u);return u},n=n=>n?t(n):t},1126,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"create",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"useStore",{enumerable:!0,get:function(){return o}});var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},u=r(d[1]);const c=e=>e;function o(e,t=c){const u=n.default.useSyncExternalStore(e.subscribe,n.default.useCallback(()=>t(e.getState()),[e,t]),()=>t(e.getInitialState()));return n.default.useDebugValue(u),u}const s=e=>{const t=(0,u.createStore)(e),n=e=>o(t,e);return Object.assign(n,t),n},l=e=>e?s(e):s},1127,[30,1126]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"WILDINGS_LOCATION",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"WILDINGS_ADDRESS",{enumerable:!0,get:function(){return t}}),e.withWildingsAddress=function(r){return'wildings'===r.id?{...r,location:n,address:t}:r},e.withWildingsQuestionnaireAddress=function(n,r){return'wildings'===n&&r?{...r,venue:{...r.venue,address:t}}:r};const n='Maidens, KA26 9NR',t='Maidens Road, Maidens, KA26 9NR'},1128,[]); +__d(function(g,r,_i,_a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.sampleFingerprint=i,e.stripOwnerLiveSamples=function(n){const a={};for(const[s,o]of Object.entries(t.OWNER_SAMPLE_HASHES)){const t=n[s]||[];a[s]=t.filter(t=>!o.includes(i(t)))}a.chat=(n.chat||[]).filter(t=>!(0,s.isSeedChefChat)(t));const o=(n.changeRequests||[]).length-a.changeRequests.length;o&&(a.changesUsed=Math.max(0,(n.changesUsed||0)-o));return a},e.stripCoreLiveSamples=function(a){const c={...(0,n.stripCoreChefSamples)(a)};c.giftCards=(a.giftCards||[]).filter(s=>!t.CORE_SAMPLE_HASHES.giftCards.includes(i(s))),c.stampCards=(a.stampCards||[]).filter(s=>!t.CORE_SAMPLE_HASHES.stampCards.includes(i(s))),c.ratings=(a.ratings||[]).filter(t=>!(/^rt-[123]$/.test(t.id)&&(0,s.demoActor)(t.customerName))),i(a.customer)===t.LEGACY_CUSTOMER_HASH&&(c.customer={...a.customer,id:'',name:'',email:'',phone:'',allergies:[],allergyConsent:!1,referralCode:'',marketingOptIn:{}});return c.restaurants=(a.restaurants||[]).filter(t=>!('saltmarsh'===t.id&&['The Venue','Saltmarsh Bistro'].includes(t.name))),c.menu=(c.menu||a.menu||[]).filter(t=>'saltmarsh'!==t.restaurantId).map(t=>t.signOff?t:o(t)),c};var t=r(d[0]),s=r(d[1]),n=r(d[2]);const a=t=>Array.isArray(t)?t.map(a):t&&'object'==typeof t?Object.fromEntries(Object.entries(t).filter(([,t])=>void 0!==t&&'function'!=typeof t).sort(([t],[s])=>ts?1:0).map(([t,s])=>[t,a(s)])):t;function i(t){const s=JSON.stringify(a(t))??"null";let n=2166136261;for(let t=0;t>>0).toString(16)}const o=t=>Array.isArray(t)?t.map(o):t&&'object'==typeof t?Object.fromEntries(Object.entries(t).map(([t,s])=>[t,'allergenNotes'===t&&'string'==typeof s&&/\(example\)/i.test(s)?'':o(s)])):t},1129,[1130,1025,1131]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"OWNER_SAMPLE_HASHES",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"CORE_SAMPLE_HASHES",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"LEGACY_CUSTOMER_HASH",{enumerable:!0,get:function(){return b}});const c={referrals:["43f09bc0","c438fbad","96bf8c62","3399d421"],coats:["f51097ad","2f7efa3a"],merch:["ef6e14e","dbbc0999","dc233c1d"],merchOrders:["13b15512","bc27f242"],offers:["ad0fcde0","59e6c0cf"],photos:["53a60fd9","ab778a74","95de43cd"],changeRequests:["81c5be12","6819542c"],lost:["5bbf0d77","7d3aa9ed","850c049e"],campaigns:["9cdf8346","82150e7"],suppliers:["41df06e7","466e32ac","fa3d8eea","dfafa674","1e26fbd0","c195b120","5fc49e74","6aa8b0af","602fc2e4"],supplierOrders:["22636226","464d6a6a"]},f={giftCards:["b1bba36d","f029bc0e"],stampCards:["e7bedf6f","a3c8404d"]},b="4b1e9971"},1130,[]); +__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.stripCoreChefSamples=function(n){return{bookings:(n.bookings||[]).filter(n=>!((0,e.isAnchorage)(n.restaurantId)&&t[n.id]===n.name)),orders:(n.orders||[]).filter(t=>!((0,e.isAnchorage)(t.restaurantId)&&('ord-seed-1'===t.id&&'R. Gilmour'===t.customerName||'ord-seed-2'===t.id&&'Table 3 guest'===t.customerName))),waitlist:(n.waitlist||[]).filter(t=>!((0,e.isAnchorage)(t.restaurantId)&&('wl-1'===t.id&&'Paterson'===t.name||'wl-2'===t.id&&'Duncan'===t.name))),menu:(n.menu||[]).map(t=>(0,e.isAnchorage)(t.restaurantId)&&(0,e.demoActor)(t.signOff?.by)?{...t,signOff:null}:t),events:(n.events||[]).filter(e=>!(e.example&&('anchorage'===e.restaurantId||null===e.restaurantId))),audit:(n.audit||[]).filter(e=>!('anchorage'===e.restaurantId&&/Example sign-off \(demo\)/i.test(e.text)))}};var e=r(d[0]);const t={'bk-101':'Campbell','bk-102':'Fraser','bk-103':'McLeod','bk-104':'Kerr','bk-105':'Wallace','bk-106':'Boyd','bk-107':'Hamilton','bk-108':'Stewart','bk-109':'Murray'}},1131,[1025]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.archiveChefCache=async function(e,t){const n=JSON.stringify(t);let o=2166136261;for(let e=0;e>>0).toString(16)}`;const c=await i.default.getItem(s);if(c){if(JSON.stringify(JSON.parse(c).rows)===n)return;s+=`:${Date.now()}`}await i.default.setItem(s,JSON.stringify({at:(new Date).toISOString(),store:e,rows:t}))};var e,t=r(d[0]),i=(e=t)&&e.__esModule?e:{default:e}},1132,[1116]); +__d(function(g,_r,_i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEMO_CUSTOMER_ID",{enumerable:!0,get:function(){return c}}),_e.defaultSimStart=function(e=new Date){const t=new Date(e),r=(5-t.getDay()+7)%7;return t.setDate(t.getDate()+r),t.setHours(17,30,0,0),t},_e.buildSeed=function(d){if(r.LIVE_VENUE_BUILD&&!t.IS_ISOLATED_VENUE){const e=u(d);return{...e,restaurants:e.restaurants.filter(e=>'anchorage'===e.id),menu:o.anchorageMenu.map(e=>({...e,signOff:null})),bookings:[],waitlist:[],orders:[],stampCards:[],giftCards:[],events:e.events.filter(e=>!e.example),ratings:[],walkIns:{},counters:{order:0,table:0,booking:0},customer:{...e.customer,id:'',referralCode:'',name:'',email:'',phone:'',allergies:[],allergyConsent:!1,marketingOptIn:{}}}}return t.IS_ISOLATED_VENUE?{restaurants:[t.IS_QUEUED_VENUE?(0,e.queuedRestaurant)(t.VENUE_RID):t.IS_ABBOTSFORD?n.ABBOTSFORD_RESTAURANT:t.IS_KIRKTON?n.KIRKTON_RESTAURANT:t.IS_GREENSIDE?n.GREENSIDE_RESTAURANT:t.IS_WILDINGS?n.WILDINGS_RESTAURANT:t.IS_KIRKMICHAEL?n.KIRKMICHAEL_RESTAURANT:s.SOUTERS_RESTAURANT],menu:t.IS_SOUTERS?i.SOUTERS_MENU:[],customer:{id:'',name:'',email:'',phone:'',allergies:[],allergyConsent:!1,referralCode:'',marketingOptIn:{}},bookings:[],waitlist:[],orders:[],stampCards:[],giftCards:[],events:[],ratings:[],audit:[],alertAcks:{},walkIns:{},basket:{restaurantId:null,mode:'takeaway',lines:[]},counters:{order:0,table:0,booking:0}}:u(d)};var e=_r(_d[0]),t=_r(_d[1]),r=_r(_d[2]),n=_r(_d[3]),s=_r(_d[4]),i=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),l=_r(_d[8]);const c='cust-demo';function u(e){const t=(0,l.ymd)(e),r=e=>e.toISOString(),s=n.restaurants.map(e=>'anchorage'===e.id?{...e,sections:o.ANCHORAGE_SECTIONS}:e),i={id:c,name:'Alex Morgan',email:'alex.demo@example.com',phone:'07700 900123',allergies:[{allergen:'crustaceans',severity:'anaphylaxis'},{allergen:'mustard',severity:'allergy'}],allergyConsent:!0,referralCode:'ALEX-7K2Q',marketingOptIn:{anchorage:!0}},u=(n,s,i,o,d={})=>({id:n,ref:`BK-${n.slice(-3).toUpperCase()}`,restaurantId:'anchorage',customerId:null,name:s,partySize:i,date:t,time:o,allergies:[],notes:'',status:'confirmed',security:i>=6?'deposit':'none',depositPaid:0,...i>=6?{depositDue:1e3*i}:{},createdAt:r((0,l.addMins)(e,-4320)),...d}),m=[u('bk-101','Campbell',2,'17:00',{table:'12',status:'seated',seatedAt:r((0,l.addMins)(e,-28)),tags:['Regular']}),u('bk-102','Fraser',4,'17:30',{table:'10',tags:['VIP']}),u('bk-103','McLeod',2,'18:00',{table:'11',allergies:[{allergen:'gluten',severity:'coeliac'}],notes:'Anniversary',occasion:'anniversary'}),u('bk-104','Kerr',6,'18:00',{table:'18'}),u('bk-105','Wallace',3,'18:30',{table:'13'}),u('bk-106','Boyd',8,'19:00',{table:'1+2',dog:!0,allergies:[{allergen:'peanuts',severity:'anaphylaxis'}],notes:'Birthday \u2014 bringing a dog',occasion:'birthday'}),u('bk-107','Hamilton',2,'19:00',{table:'5'}),u('bk-108','Stewart',4,'19:30',{table:'19',tags:['Regular']}),u('bk-109','Murray',2,'20:00',{table:'16'})],p=[{id:'wl-1',restaurantId:'anchorage',number:1,name:'Paterson',partySize:2,joinedAt:r((0,l.addMins)(e,-12)),status:'waiting'},{id:'wl-2',restaurantId:'anchorage',number:2,name:'Duncan',partySize:4,joinedAt:r((0,l.addMins)(e,-4)),status:'waiting'}],h=(0,l.atTime)(e,'17:45'),I=[{id:'ord-seed-1',ref:'T-1041',restaurantId:'anchorage',customerId:'cust-other',customerName:'R. Gilmour',type:'takeaway',slotTime:r(h),lines:[{itemId:'a-fishsupper',name:'Fish Supper',qty:2,unitPrice:1800,choices:['Beer-battered'],notes:'',contains:[],may:[],overridden:!1,prepMins:12},{itemId:'a-chips',name:'Triple-Cooked Chips (V)',qty:1,unitPrice:450,choices:[],notes:'Extra salt',contains:[],may:[],overridden:!1,prepMins:6}],subtotal:4050,tip:0,giftCardApplied:0,total:4050,paid:4050,status:'acknowledged',createdAt:r((0,l.addMins)(e,-50)),allergies:[],readiness:{}},{id:'ord-seed-2',ref:'Q-2017',restaurantId:'anchorage',customerId:'cust-other2',customerName:'Table 3 guest',type:'table',tableNo:'3',lines:[{itemId:'a-moules',name:'Moules Marini\xe8re',qty:1,unitPrice:2200,choices:['Main 500g with triple-cooked chips (\xa322.00)'],notes:'',contains:[],may:[],overridden:!1,prepMins:10},{itemId:'a-claymore',name:'The Claymore Burger',qty:1,unitPrice:1800,choices:[],notes:'No gherkins',contains:[],may:[],overridden:!1,prepMins:14}],subtotal:4e3,tip:0,giftCardApplied:0,total:4e3,paid:0,status:'preparing',createdAt:r((0,l.addMins)(e,-18)),allergies:[],readiness:{}}],y=[{restaurantId:'anchorage',customerId:c,stamps:5,rewardsAvailable:0,history:[{at:'2026-08-15',source:'Dine-in (staff scan)'},{at:'2026-08-29',source:'Takeaway'},{at:'2026-09-12',source:'Table QR bill'},{at:'2026-10-02',source:'Takeaway'},{at:'2026-10-16',source:'Referral \u2014 friend\u2019s first visit'}]},{restaurantId:'saltmarsh',customerId:c,stamps:2,rewardsAvailable:0,history:[{at:'2026-09-01',source:'Dine-in'},{at:'2026-10-01',source:'Dine-in'}]}],b=[{id:'gc-1',code:'ANC-G7QX-4M2P-9TRE',restaurantId:'anchorage',initial:5e3,balance:2500,ownerId:c,recipientName:'Alex',message:'Happy birthday! (example)',createdAt:'2026-09-20'},{id:'gc-2',code:'WEB-OLD-10-EXAMPLE',restaurantId:'anchorage',initial:1e3,balance:1e3,ownerId:'legacy',recipientName:'Legacy website bookings voucher (example)',message:'',createdAt:'2026-06-01',legacy:!0}],k=[...d.SCOTTISH_BANK_HOLIDAYS.map((e,t)=>({id:`bh-${t}`,restaurantId:null,date:e.date,title:e.title+(e.notes&&!/substitute/i.test(e.notes)?` (${e.notes.toLowerCase()})`:''),kind:'bank-holiday',description:'Scottish bank holiday',example:!1,source:d.BANK_HOLIDAY_SOURCE})),{id:'ev-halloween',restaurantId:'anchorage',date:(0,l.ymd)(new Date(e.getFullYear(),9,31)),title:'Halloween weekend (example)',kind:'event',description:'Example event \u2014 busy weekend flag for the forecast.',example:!0},{id:'ev-xmas-party',restaurantId:'anchorage',date:'2026-12-04',title:'Christmas party nights begin (example)',kind:'event',description:'Example: festive set menu, deposit required for parties of 8+.',example:!0},{id:'ev-hogmanay',restaurantId:null,date:'2026-12-31',title:'Hogmanay',kind:'occasion',description:'Key dining date.',example:!1},{id:'ev-burns',restaurantId:'anchorage',date:'2027-01-25',title:'Burns Night Supper (example)',kind:'event',description:'EXAMPLE event: haggis, neeps & tatties, address to the haggis, set menu \xa348pp. Booking opens via the app.',example:!0},{id:'ev-valentines',restaurantId:null,date:'2027-02-14',title:"Valentine's Day",kind:'occasion',description:'Key dining date.',example:!1},{id:'ev-mothering',restaurantId:null,date:'2027-03-07',title:'Mothering Sunday (UK)',kind:'occasion',description:'Key dining date.',example:!1},{id:'ev-live',restaurantId:'anchorage',date:'2026-11-14',title:'Live acoustic music (example)',kind:'event',description:'EXAMPLE: local folk duo from 7pm.',example:!0},{id:'ev-school-xmas',restaurantId:null,date:'2026-12-23',title:'South Ayrshire schools close for Christmas',kind:'school-holiday',description:'23 Dec 2026 \u2013 4 Jan 2027',example:!1},{id:'ev-salt-quiz',restaurantId:'saltmarsh',date:'2026-11-05',title:'Quiz night (fictional)',kind:'event',description:'Fictional demo restaurant event.',example:!0}];return{restaurants:s,menu:[...o.anchorageMenu,...n.demoMenus],customer:i,bookings:m,waitlist:p,orders:I,stampCards:y,giftCards:b,events:k,ratings:[{id:'rt-1',restaurantId:'anchorage',customerId:'cust-x1',customerName:'Fiona (example)',stars:5,comment:'Best fish supper on the coast, and the staff were brilliant with my son\u2019s nut allergy.',createdAt:r((0,l.addMins)(e,-1560)),context:'Takeaway T-1032'},{id:'rt-2',restaurantId:'anchorage',customerId:'cust-x2',customerName:'Iain (example)',stars:4,comment:'Lovely langoustines. Bit of a wait for a table at 7.',createdAt:r((0,l.addMins)(e,-3e3)),context:'Dine-in, Table 6'},{id:'rt-3',restaurantId:'anchorage',customerId:'cust-x3',customerName:'Morag (example)',stars:2,comment:'Chips were cold by the time we collected.',createdAt:r((0,l.addMins)(e,-4320)),context:'Takeaway T-1019'}],audit:[],alertAcks:{},walkIns:{anchorage:6},basket:{restaurantId:null,mode:'takeaway',lines:[]},counters:{order:1042,table:2018,booking:110}}}},1133,[6,5,833,3,1134,1135,1136,1137,818]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SOUTERS_RESTAURANT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"SOUTERS_BOOKING_URL",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"SOUTERS_CONTACTS",{enumerable:!0,get:function(){return n}});const t={id:'souters',name:"Souter's Inn",tagline:'Culinary excellence meets country hospitality in Kirkoswald',location:'Kirkoswald, South Ayrshire',address:'47 Main Road, Kirkoswald, South Ayrshire KA19 8HY',phone:'01655 760653',website:'https://www.soutersinn.com/',fictional:!1,kitchenHours:{0:['09:00','21:00'],1:['09:00','21:00'],2:['09:00','21:00'],3:['09:00','21:00'],4:['09:00','21:00'],5:['09:00','21:00'],6:['09:00','21:00']},hoursNote:'Public hours: daily from 9am; food listed to 9pm. Closing time (9pm or 10pm) to confirm with the venue. Breakfast until 11.45am; main food from noon.',sections:[],settings:{slotMinutes:15,slotCap:3,bufferMins:5,leadMins:20,takeawayPaused:!0,bookingCoversPerSlot:16,stampTarget:8,stampReward:'',stampMinSpend:1e3,capacityPerHour:0,walkInShare:.35,turnMins:75,orderAtTable:!1,showTakeaway:!1,tableRequests:!0,shortName:"Souter's",deposit:{on:!1,perPersonPence:null,fromParty:null,refundable:null,cutoffHours:null,needsConfirmation:!0,wixLinksOn:!1,policy:'Table deposit policy not set. Ticketed event deposits are separate and are not a table policy.'}}},o='',n={email:'souters@southernayr.com',phone:'01655 760653'}},1134,[]); +__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SOUTERS_MENU",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"SOUTERS_MENU_COUNT",{enumerable:!0,get:function(){return t}});const s=[{id:"su-breakfast-full-breakfast",section:"Breakfast",name:"Full Breakfast",description:"Ayrshire Bacon, Link Sausage, Black Pudding, Potato Scone, Beans, Tomato, Mushrooms & Two Eggs (Poached, Scrambled or Fried) with White or Wholemeal Toast",price:1195,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-eggs-benedict",section:"Breakfast",name:"Eggs Benedict",description:"Two Poached Eggs along with Ayrshire Bacon served on Toasted Muffin topped with Hollandaise Sauce",price:1050,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-french-toast",section:"Breakfast",name:"French Toast",description:"Two Slices of Bloomer Eggy Bread with Ayrshire Bacon and a side of Maple Syrup",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-light-breakfast",section:"Breakfast",name:"Light Breakfast",description:"Ayrshire Bacon, Link Sausage, Beans, Tomato and Two Eggs served Poached, Scrambled or Fried with White or Wholemeal Toast",price:950,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-eggs-royale",section:"Breakfast",name:"Eggs Royale",description:"Two Poached Eggs with Flaked Smoked Salmon served on Toasted Muffin topped with Hollandaise Sauce",price:1150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-fried-scottish-pancakes",section:"Breakfast",name:"Fried Scottish Pancakes",description:"Scottish Pancakes with Ayrshire Bacon and a side of Maple Syrup",price:950,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-add-banana-to-fried-scottish-pancakes",section:"Breakfast add-ons",name:"Add Banana (to Fried Scottish Pancakes)",description:"",price:150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-add-two-eggs-poached-fried-or-scrambled-",section:"Breakfast add-ons",name:"Add Two Eggs \u2013 Poached, Fried or Scrambled (to Fried Scottish Pancakes)",description:"",price:200,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-vegetarian-breakfast",section:"Breakfast",name:"Vegetarian Breakfast",description:"Potato Scone, Tomato, Mushrooms, Beans and Two Eggs served Poached, Scrambled or Fried with White or Wholemeal Toast",price:925,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-smashed-avocado-benedict",section:"Breakfast",name:"Smashed Avocado Benedict",description:"Smashed Avocado Guacamole, 2 Poached Eggs served on Toasted Muffin topped with Hollandaise Sauce",price:1095,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-granola-bowl",section:"Breakfast",name:"Granola Bowl",description:"Almond and Raisin Granola topped with Berries, Natural Yoghurt and Honey",price:895,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-breakfast-burrito",section:"Breakfast",name:"Breakfast Burrito",description:"Crispy Bacon, Two Fried Eggs, Jalape\xf1o Salsa, Guacamole, Cheddar Cheese, Salad & Sour Cream",price:1150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-pancake-stack",section:"Breakfast",name:"Pancake Stack",description:"American style pancakes with Biscoff, Nutella, Chocolate Sauce & Fresh Strawberries",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-breakfast-roll",section:"Breakfast",name:"Breakfast Roll",description:"with a choice of Ayrshire Bacon, Pork Link Sausage, Potato Scone or Egg; 2 Items \xa34.75 | 3 Items \xa35.50",price:425,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-kids-breakfast",section:"Junior / Kids",name:"Kids Breakfast",description:"Pork Link Sausage, Beans, Potato Scone, served with a Slice of Toast",price:495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-kids-pancakes",section:"Junior / Kids",name:"Kids Pancakes",description:"American Style Pancakes served with Syrup, Nutella or Butter & Jam",price:495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-add-banana-or-strawberries-to-kids-panca",section:"Junior / Kids add-ons",name:"Add Banana or Strawberries (to Kids Pancakes)",description:"",price:150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-black-pudding-add-on",section:"Add-ons",name:"Black Pudding (add-on)",description:"",price:150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-beans-add-on",section:"Add-ons",name:"Beans (add-on)",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-smashed-avocado-add-on",section:"Add-ons",name:"Smashed Avocado (add-on)",description:"",price:200,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-pork-link-sausage-add-on",section:"Add-ons",name:"Pork Link Sausage (add-on)",description:"",price:150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-mushrooms-add-on",section:"Add-ons",name:"Mushrooms (add-on)",description:"",price:150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-tomato-add-on",section:"Add-ons",name:"Tomato (add-on)",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-ayrshire-bacon-2-add-on",section:"Add-ons",name:"Ayrshire Bacon (2) (add-on)",description:"",price:150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-haggis-add-on",section:"Add-ons",name:"Haggis (add-on)",description:"",price:150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-egg-add-on",section:"Add-ons",name:"Egg (add-on)",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-potato-scone-add-on",section:"Add-ons",name:"Potato Scone (add-on)",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-bucket-of-chips",section:"Add-ons",name:"Bucket of Chips",description:"",price:425,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-toasted-white-or-wholemeal-bread",section:"Add-ons",name:"Toasted White or Wholemeal Bread",description:"served with Butter and Preserve",price:450,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-white-coffee",section:"Coffee",name:"White Coffee",description:"",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-latte",section:"Coffee",name:"Latte",description:"",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-espresso",section:"Coffee",name:"Espresso",description:"",price:325,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-cappuccino",section:"Coffee",name:"Cappuccino",description:"",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-americano",section:"Coffee",name:"Americano",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-double-espresso",section:"Coffee",name:"Double Espresso",description:"",price:395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-macchiato",section:"Coffee",name:"Macchiato",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-flavour-shot-add-on",section:"Coffee add-ons",name:"Flavour Shot (add-on)",description:"",price:75,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-extra-shot-of-coffee-add-on",section:"Coffee add-ons",name:"Extra Shot of Coffee (add-on)",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-breakfast-tea",section:"Tea",name:"Breakfast Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-camomile-tea",section:"Tea",name:"Camomile Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-earl-grey-tea",section:"Tea",name:"Earl Grey Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-green-tea",section:"Tea",name:"Green Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-peppermint-tea",section:"Tea",name:"Peppermint Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-red-berry-tea",section:"Tea",name:"Red Berry Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-lemon-ginger-tea",section:"Tea",name:"Lemon & Ginger Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-hot-chocolate",section:"Hot chocolate",name:"Hot Chocolate",description:"",price:425,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-luxury-hot-chocolate",section:"Hot chocolate",name:"Luxury Hot Chocolate",description:"with Cream & Marshmallows",price:475,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-freshly-baked-basket-of-bread-with-butte",section:"Starters / bread",name:"Freshly Baked Basket Of Bread With Butter",description:"",price:450,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-add-olive-oil-balsamic-vinegar",section:"Starters / bread",name:"Add Olive Oil & Balsamic Vinegar",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-soup-of-the-day",section:"Starters",name:"Soup of The Day",description:"served with Crusty Bread & Butter",price:650,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-a-la-carte-salad-of-poached-pear-blue-cheese",section:"Starters",name:"Salad Of Poached Pear & Blue Cheese",description:"with Candied Walnuts & French Vinaigrette",price:850,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-fresh-water-prawns",section:"Starters",name:"Fresh Water Prawns",description:"coated in Spicy Bang Bang Sauce, topped with Chopped Chilli, Peanuts & Coriander",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-sliced-melon-fresh-fruits",section:"Starters",name:"Sliced Melon & Fresh Fruits",description:"with Coulis & Raspberry Sorbet",price:850,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-chicken-liver-p-t",section:"Starters",name:"Chicken Liver P\xe2t\xe9",description:"with Oatcakes, Plum & Apple Chutney",price:850,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-crispy-salt-pepper-calamari",section:"Starters",name:"Crispy Salt & Pepper Calamari",description:"served with Garlic Mayo & Oriental Dressing",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-steamed-mussels",section:"Starters",name:"Steamed Mussels",description:"with White Wine, Garlic, Shallots & Cream, served with Garlic Bread",price:1150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-creamy-baked-garlic-mushrooms",section:"Starters",name:"Creamy Baked Garlic Mushrooms",description:"with a Cheddar Cheese Gratin",price:895,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-boiled-egg-crispy-bacon-caesar-salad",section:"Starters",name:"Boiled Egg & Crispy Bacon Caesar Salad",description:"with Parmesan & Croutons",price:850,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-grilled-honey-glazed-goat-s-cheese-salad",section:"Starters",name:"Grilled Honey Glazed Goat\u2019s Cheese Salad",description:"with Roquito Peppers & Chilli Jam",price:850,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-sticky-bbq-ribs-in-a-korean-gochujang-sa",section:"Starters",name:"Sticky BBQ Ribs in a Korean Gochujang Sauce",description:"with Onions, Peppers & Sesame Seeds",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-cioppino-fish-soup",section:"Starters",name:"Cioppino Fish Soup",description:"fired up with Fresh Chillies & Smoked Paprika, topped with Croutons & Parmesan",price:1095,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-8oz-fillet-steak",section:"From the grill",name:"8oz Fillet Steak",description:"All served with Tomatoes, Portobello Mushrooms, Onion Rings & your choice of Chips, Boiled or Mashed Potatoes. Includes choice of Peppercorn, Mustard or Red Wine Jus",price:3695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-10oz-sirloin-steak",section:"From the grill",name:"10oz Sirloin Steak",description:"All served with Tomatoes, Portobello Mushrooms, Onion Rings & your choice of Chips, Boiled or Mashed Potatoes. Includes choice of Peppercorn, Mustard or Red Wine Jus",price:3395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-rosemary-garlic-lamb-chops",section:"From the grill",name:"Rosemary & Garlic Lamb Chops",description:"All served with Tomatoes, Portobello Mushrooms, Onion Rings & your choice of Chips, Boiled or Mashed Potatoes. Includes choice of Peppercorn, Mustard or Red Wine Jus",price:2750,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-top-with-breaded-haggis-grill",section:"From the grill add-ons",name:"Top with Breaded Haggis (grill)",description:"",price:250,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-top-with-6-garlic-buttered-prawns-grill",section:"From the grill add-ons",name:"Top with 6 Garlic Buttered Prawns (grill)",description:"",price:750,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-steamed-fillet-of-salmon-with-cheese-gla",section:"Main courses",name:"Steamed Fillet of Salmon with Cheese Glaze",description:"served with Buttered Greens & Creamed Potatoes",price:2150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-breaded-haddock-chips",section:"Main courses",name:"Breaded Haddock & Chips",description:"with Homemade Tartare Sauce & Side Salad",price:1850,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-fish-of-the-day",section:"Main courses",name:"Fish of the Day",description:"Check Chef\u2019s Daily Specials",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,priceNote:"Ask staff",special:!0},{id:"su-a-la-carte-locally-caught-haggis-with-neeps-tatties",section:"Main courses",name:"Locally Caught Haggis with Neeps & Tatties",description:"served with Whisky Peppercorn Sauce & Greentails",price:1795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-breast-of-cajun-spiced-chicken",section:"Main courses",name:"Breast Of Cajun Spiced Chicken",description:"with Capsicums, Rice Pilaf & a Curried Coconut & Mango Chutney Sauce",price:1850,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-chicken-schnitzel",section:"Main courses",name:"Chicken Schnitzel",description:"Pan-Fried in Breadcrumbs, served with Crispy Bacon, Grilled Pineapple & Chips",price:1895,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-beef-steak-butcher-s-sausage-pie",section:"Main courses",name:"Beef Steak & Butcher\u2019s Sausage Pie",description:"with Creamed Potatoes & Buttered Carrots",price:1895,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-madras-spiced-lamb-curry",section:"Main courses",name:"Madras Spiced Lamb Curry",description:"with Chillies, Pineapple & Coriander, served with Aromatic Rice, Spiced Onions & a Poppadom",price:1895,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-pan-fried-lambs-liver",section:"Main courses",name:"Pan-Fried Lambs Liver",description:"with Saut\xe9ed Onions, Smoked Bacon, Grilled Tomato, Creamed Potatoes & Red Wine Gravy",price:1750,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-8oz-cheeseburger",section:"Main courses",name:"8oz Cheeseburger",description:"with Bacon, Peppered Mayo, Pickles & Tomato, served with Coleslaw & Chips",price:1795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-add-haggis-to-cheeseburger",section:"Main courses add-ons",name:"Add Haggis (to Cheeseburger)",description:"",price:250,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-panko-breaded-chicken-burger",section:"Main courses",name:"Panko Breaded Chicken Burger",description:"in a Toasted Brioche Bun, with Curried Slaw, Katsu Sauce & Chips",price:1795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-macaroni-cheese",section:"Main courses",name:"Macaroni Cheese",description:"with Leeks, English Mustard & Matured Cheddar, served with Garlic Bread",price:1795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-add-bacon-to-macaroni-cheese",section:"Main courses add-ons",name:"Add Bacon (to Macaroni Cheese)",description:"",price:150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-penne-pasta-arrabbiata",section:"Main courses",name:"Penne Pasta Arrabbiata",description:"with Peppers, Vine Tomatoes, Chilli & Basil, served with Garlic Bread",price:1795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-melon-prawn-salad",section:"Salads",name:"Melon & Prawn Salad",description:"with Marie Rose Cocktail Dressing; served with a choice of Chips or Boiled Potatoes",price:1795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-ploughman-s-salad",section:"Salads",name:"Ploughman\u2019s Salad",description:"Souter\u2019s Sausage Roll, Matured Cheddar, Pickle, Gammon, Boiled Egg & Crusty Bread; served with a choice of Chips or Boiled Potatoes",price:1695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-cajun-spiced-fillet-of-salmon",section:"Salads",name:"Cajun Spiced Fillet Of Salmon",description:"with Curried Coleslaw, Cashew Nuts & a Chilli, Ginger & Citrus Dressing; served with a choice of Chips or Boiled Potatoes",price:1850,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-garlic-chicken-caesar-salad",section:"Salads",name:"Garlic Chicken Caesar Salad",description:"with Croutons, Parmesan, Baby Gem Lettuce, Boiled Egg & Caesar Dressing; served with a choice of Chips or Boiled Potatoes",price:1795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-prawn-smoked-salmon-sandwich",section:"Sandwiches",name:"Prawn & Smoked Salmon Sandwich",description:"with Rocket & Marie Rose Sauce; served on White or Malted Bread with Kettle Chips, Coleslaw & Side Salad. Available 12 Noon\u20135pm",price:1195,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-tuna-mayonnaise-sandwich",section:"Sandwiches",name:"Tuna Mayonnaise Sandwich",description:"with Red Onion, Cucumber & Gem Lettuce; served on White or Malted Bread with Kettle Chips, Coleslaw & Side Salad. Available 12 Noon\u20135pm",price:1050,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-spicy-bang-bang-chicken-sandwich",section:"Sandwiches",name:"Spicy Bang Bang Chicken Sandwich",description:"with Sriracha Mayonnaise, Peppers & Coriander; served on White or Malted Bread with Kettle Chips, Coleslaw & Side Salad. Available 12 Noon\u20135pm",price:1195,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-basil-pesto-chicken-sandwich",section:"Sandwiches",name:"Basil Pesto Chicken Sandwich",description:"with Tomatoes, Red Onion & Mayonnaise; served on White or Malted Bread with Kettle Chips, Coleslaw & Side Salad. Available 12 Noon\u20135pm",price:1095,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-smoked-ham-matured-cheddar-cheese-sandwi",section:"Sandwiches",name:"Smoked Ham & Matured Cheddar Cheese Sandwich",description:"with Mustard Mayonnaise; served on White or Malted Bread with Kettle Chips, Coleslaw & Side Salad. Available 12 Noon\u20135pm",price:1095,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-egg-mayonnaise-sandwich",section:"Sandwiches",name:"Egg Mayonnaise Sandwich",description:"with Spring Onion & Chives; served on White or Malted Bread with Kettle Chips, Coleslaw & Side Salad. Available 12 Noon\u20135pm",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-add-a-cup-of-soup-with-any-sandwich",section:"Sandwiches add-ons",name:"Add a Cup of Soup (with any Sandwich)",description:"",price:395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-chips",section:"Sides",name:"Chips",description:"",price:425,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-cajun-chips",section:"Sides",name:"Cajun Chips",description:"",price:495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-creamed-potatoes",section:"Sides",name:"Creamed Potatoes",description:"",price:450,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-onion-rings",section:"Sides",name:"Onion Rings",description:"",price:495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-mac-cheese-side",section:"Sides",name:"Mac & Cheese (side)",description:"",price:595,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-seasonal-mixed-vegetables",section:"Sides",name:"Seasonal Mixed Vegetables",description:"",price:450,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-souter-s-coleslaw",section:"Sides",name:"Souter\u2019s Coleslaw",description:"",price:395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-curried-coleslaw",section:"Sides",name:"Curried Coleslaw",description:"",price:395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-souter-s-side-salad",section:"Sides",name:"Souter\u2019s Side Salad",description:"",price:425,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-garlic-bread",section:"Sides",name:"Garlic Bread",description:"",price:395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-garlic-bread-with-cheese",section:"Sides",name:"Garlic Bread with Cheese",description:"",price:450,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-fresh-fruit-salad-sorbet",section:"Starters",name:"Fresh Fruit Salad & Sorbet",description:"",price:300,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-soup-of-the-day",section:"Starters",name:"Soup of the Day",description:"",price:300,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-kids-garlic-bread-with-or-without-cheese",section:"Starters",name:"Garlic Bread (with or without Cheese)",description:"",price:300,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-macaroni-cheese",section:"Main courses",name:"Macaroni Cheese",description:"All main dishes served with carrots, peas and a choice of chips or mash",price:695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-breaded-goujons-of-chicken",section:"Main courses",name:"Breaded Goujons of Chicken",description:"All main dishes served with carrots, peas and a choice of chips or mash",price:695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-mini-breaded-fish",section:"Main courses",name:"Mini Breaded Fish",description:"All main dishes served with carrots, peas and a choice of chips or mash",price:695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-roast-chicken-salad",section:"Main courses",name:"Roast Chicken Salad",description:"All main dishes served with carrots, peas and a choice of chips or mash",price:695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-grilled-sausages-or-chicken-with-gravy",section:"Main courses",name:"Grilled Sausages or Chicken with Gravy",description:"All main dishes served with carrots, peas and a choice of chips or mash",price:695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-sticky-toffee-pudding",section:"Sweet treats",name:"Sticky Toffee Pudding",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-cone-from-the-counter",section:"Sweet treats",name:"Cone from the Counter",description:"",price:185,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-kids-ice-cream-sundae",section:"Sweet treats",name:"Kids Ice Cream Sundae",description:"Two scoops, Sprinkles, Flakes, along with a choice of Sauce \u2013 Chocolate / Strawberry",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-kids-juice-apple-orange-pineapple",section:"Drinks",name:"Juice \u2013 Apple / Orange / Pineapple",description:"",price:185,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-simply-fruit-shoot-orange-blackcurrant",section:"Drinks",name:"Simply Fruit Shoot \u2013 Orange / Blackcurrant",description:"",price:200,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-diluting-juice-orange-blackcurrant",section:"Drinks",name:"Diluting Juice \u2013 Orange / Blackcurrant",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-milk",section:"Drinks",name:"Milk",description:"",price:175,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-coke-diet-coke-lemonade",section:"Drinks",name:"Coke / Diet Coke / Lemonade",description:"",price:200,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-kids-milk-shake-chocolate-strawberry",section:"Drinks",name:"Kids Milk Shake \u2013 Chocolate / Strawberry",description:"",price:250,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-souter-s-sticky-toffee-pudding",section:"Dessert",name:"Souter\u2019s Sticky Toffee Pudding",description:"with Butterscotch Sauce & Vanilla Ice Cream",price:795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-cherry-almond-tart",section:"Dessert",name:"Cherry & Almond Tart",description:"with Cr\xe8me Anglaise & Wild Cherry Ripple Ice Cream",price:795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-individual-banoffee-pie",section:"Dessert",name:"Individual Banoffee Pie",description:"topped with Chocolate Shavings, served with Salted Caramel Sauce & Banana Ice Cream",price:795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-souter-s-cheesecake-of-the-day",section:"Dessert",name:"Souter\u2019s Cheesecake of the Day",description:"Please ask your Server for Today\u2019s Choice",price:795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-desserts-warm-chocolate-fudge-cake",section:"Dessert",name:"Warm Chocolate Fudge Cake",description:"with Fresh Berries & Honeycomb Ice Cream",price:795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-lemon-meringue-pie",section:"Dessert",name:"Lemon Meringue Pie",description:"with Raspberries & Raspberry Ripple Ice Cream",price:795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-fresh-fruit-salad",section:"Dessert",name:"Fresh Fruit Salad",description:"with Citrus Syrup served with Pouring Cream, Ice Cream or Sorbet",price:700,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-cheeseboard",section:"Dessert",name:"Cheeseboard",description:"A Selection of British & Continental Cheeses with Grapes, Fruit Chutney & Biscuits",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-affogato",section:"Dessert",name:"Affogato",description:"Vanilla Ice Cream with a Shot of Espresso",price:650,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-ice-cream-one-scoop",section:"Ice cream",name:"Ice Cream \u2013 One Scoop",description:"Please ask your Server for Today\u2019s Flavours",price:395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-desserts-ice-cream-two-scoops",section:"Ice cream",name:"Ice Cream \u2013 Two Scoops",description:"Please ask your Server for Today\u2019s Flavours",price:495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-desserts-ice-cream-three-scoops",section:"Ice cream",name:"Ice Cream \u2013 Three Scoops",description:"Please ask your Server for Today\u2019s Flavours",price:595,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-desserts-strawberry-snowball-delight",section:"Sundaes",name:"Strawberry Snowball Delight",description:"Vanilla & Strawberry Ice cream, Crushed Meringue, Fresh Strawberries, Strawberry Sauce, topped with a Snowball & a Wafer",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-biscoff-sundae",section:"Sundaes",name:"Biscoff Sundae",description:"Biscoff & Toffee Fudge Ice Cream, Whipped Cream, Crushed Lotus Biscoff Biscuits, Biscoff Topping Sauce & a Wafer",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-kinder-bueno-sundae",section:"Sundaes",name:"Kinder Bueno Sundae",description:"Kinder Bueno & Chocolate Ice Cream, Whipped Cream, Kinder Bueno Pieces, Chocolate Sauce & a Wafer",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-white-coffee",section:"Coffee",name:"White Coffee",description:"",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-latte",section:"Coffee",name:"Latte",description:"",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-cappuccino",section:"Coffee",name:"Cappuccino",description:"",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-macchiato",section:"Coffee",name:"Macchiato",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-americano",section:"Coffee",name:"Americano",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-espresso",section:"Coffee",name:"Espresso",description:"",price:325,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-double-espresso",section:"Coffee",name:"Double Espresso",description:"",price:395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-flavour-shot-add-on",section:"Coffee add-ons",name:"Flavour Shot (add-on)",description:"",price:75,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-extra-shot-of-coffee-add-on",section:"Coffee add-ons",name:"Extra Shot of Coffee (add-on)",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-breakfast-tea",section:"Tea",name:"Breakfast Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-camomile-tea",section:"Tea",name:"Camomile Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-earl-grey-tea",section:"Tea",name:"Earl Grey Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-green-tea",section:"Tea",name:"Green Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-peppermint-tea",section:"Tea",name:"Peppermint Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-red-berry-tea",section:"Tea",name:"Red Berry Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-lemon-ginger-tea",section:"Tea",name:"Lemon & Ginger Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-hot-chocolate",section:"Hot chocolate",name:"Hot Chocolate",description:"",price:425,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-luxury-hot-chocolate",section:"Hot chocolate",name:"Luxury Hot Chocolate",description:"with Cream & Marshmallows",price:475,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-chilled-melon-seasonal-fruits",section:"Starters",name:"Chilled Melon & Seasonal Fruits",description:"with Fruit Coulis & Sorbet",price:850,dietary:["V","VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-creamy-garlic-mushrooms",section:"Starters",name:"Creamy Garlic Mushrooms",description:"with Cheddar Cheese & Crusty Bread",price:895,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-mediterranean-tomato-chunky-vegetable-so",section:"Starters",name:"Mediterranean Tomato & Chunky Vegetable Soup",description:"with Crusty Bread",price:650,dietary:["V","VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-honey-glazed-goats-cheese",section:"Starters",name:"Honey Glazed Goats Cheese",description:"with Tomato & Rocket Salad, Basil Pesto & Balsamic Dressing",price:850,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-freshly-baked-basket-of-bread",section:"Starters",name:"Freshly Baked Basket of Bread",description:"with Butter",price:450,dietary:["V","VG"],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-vegetarian-vegan-add-olive-oil-balsamic",section:"Starters",name:"Add Olive Oil & Balsamic",description:"",price:100,dietary:["V","VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-boiled-egg-caesar-salad",section:"Starters",name:"Boiled Egg Caesar Salad",description:"with Croutons, Garlic Dressing & Vegetarian Cheese Shavings",price:795,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-salad-of-poached-pear-candied-walnuts",section:"Starters",name:"Salad of Poached Pear & Candied Walnuts",description:"with French Vinaigrette",price:795,dietary:["V","VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-stuffed-peppers",section:"Main courses",name:"Stuffed Peppers",description:"with Braised Rice, Tomatoes, Basil & Brie, served with a Side Salad & a Bucket of Chips; without Brie is vegan",price:1795,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-vegetable-cashew-nut-stir-fry",section:"Main courses",name:"Vegetable & Cashew Nut Stir Fry",description:"with Hoisin, Ginger & Garlic, served with Aromatic Rice",price:1795,dietary:["V","VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-macaroni-cheese",section:"Main courses",name:"Macaroni Cheese",description:"with Coleman\u2019s Mustard, Leeks & Matured Cheddar, served with Garlic Bread",price:1795,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-pasta-arrabbiata",section:"Main courses",name:"Pasta Arrabbiata",description:"with Peppers, Tomatoes, Chilli & Basil, served with Garlic Bread",price:1795,dietary:["V","VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-creamy-coconut-vegetable-curry",section:"Main courses",name:"Creamy Coconut Vegetable Curry",description:"with Almonds, Cashew Nuts & Coriander, served with Rice, Spiced Onions & a Poppadom",price:1795,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-katsu-vegetable-curry",section:"Main courses",name:"Katsu Vegetable Curry",description:"with Almonds, Cashew Nuts & Coriander, served with Rice, Spiced Onions & a Poppadom",price:1795,dietary:["VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-fresh-fruit-salad",section:"Desserts",name:"Fresh Fruit Salad",description:"with Sorbet",price:700,dietary:["V","VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-sticky-toffee-pudding",section:"Desserts",name:"Sticky Toffee Pudding",description:"with Hot Caramel Sauce & Vanilla Ice Cream",price:795,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-cherry-almond-tart",section:"Desserts",name:"Cherry & Almond Tart",description:"with Wild Cherry Ripple Ice Cream",price:795,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-trillionaire-tart",section:"Desserts",name:"Trillionaire Tart",description:"with Chocolate Pastry, Caramel Toffee & Chocolate Style Ganache, served with Vegan Vanilla Ice Cream",price:795,dietary:["VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-individual-banoffee-pie",section:"Desserts",name:"Individual Banoffee Pie",description:"topped with Chocolate Shavings, served with Salted Caramel Sauce & Banana Ice Cream",price:795,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-warm-chocolate-fudge-cake",section:"Desserts",name:"Warm Chocolate Fudge Cake",description:"with Fresh Berries & Honeycomb Ice Cream",price:795,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-cheeseboard",section:"Desserts",name:"Cheeseboard",description:"served with Oatcakes & Seasonal Chutney",price:995,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-affogato",section:"Desserts",name:"Affogato",description:"1 Scoop of Plain Ice Cream with a shot of Espresso Coffee",price:650,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-floured-bap-with-ayrshire-bacon",section:"Morning (9am\u201312pm)",name:"Floured Bap with Ayrshire Bacon",description:"Available 9am\u201312pm",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-floured-bap-with-pork-link-sausage",section:"Morning (9am\u201312pm)",name:"Floured Bap with Pork Link Sausage",description:"Available 9am\u201312pm",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-floured-bap-with-poached-scrambled-fried",section:"Morning (9am\u201312pm)",name:"Floured Bap with Poached / Scrambled / Fried Egg",description:"Available 9am\u201312pm",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-extra-item-on-floured-bap",section:"Morning (9am\u201312pm)",name:"Extra Item (on Floured Bap)",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-traybakes",section:"Sweet treats",name:"Traybakes",description:"",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-takeaway-freshly-baked-cakes",section:"Sweet treats",name:"Freshly Baked Cakes",description:"",price:450,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-freshly-baked-plain-fruit-scone",section:"Sweet treats",name:"Freshly Baked Plain / Fruit Scone",description:"",price:175,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-soup-of-the-day",section:"Hot food (12pm\u20139pm)",name:"Soup of the Day",description:"with Crusty Bread; available 12pm\u20139pm",price:450,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-takeaway-breaded-haddock-chips",section:"Hot food (12pm\u20139pm)",name:"Breaded Haddock & Chips",description:"with Tartare Sauce",price:1375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-steak-sausage-pie",section:"Hot food (12pm\u20139pm)",name:"Steak & Sausage Pie",description:"with Chips & Gravy",price:1375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-macaroni-cheese",section:"Hot food (12pm\u20139pm)",name:"Macaroni Cheese",description:"with Leeks, Mustard & Matured Cheddar, served with Chips",price:1375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-8oz-burger",section:"Hot food (12pm\u20139pm)",name:"8oz Burger",description:"with Bacon & Cheese, served with Chips",price:1375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-breaded-katsu-chicken-burger",section:"Hot food (12pm\u20139pm)",name:"Breaded Katsu Chicken Burger",description:"with Curried Slaw, served with Chips",price:1375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-cajun-chicken",section:"Hot food (12pm\u20139pm)",name:"Cajun Chicken",description:"with Rice & Coconut Curry Sauce",price:1375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-breaded-goat-s-cheese",section:"Hot food (12pm\u20139pm)",name:"Breaded Goat\u2019s Cheese",description:"with Tomato Salad, Pesto & Chutney, served with Chips",price:1375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-basil-pesto-chicken-sandwich",section:"Sandwiches (12pm\u20135pm)",name:"Basil Pesto Chicken Sandwich",description:"with Tomatoes, Red Onion & Mayonnaise; sandwiches 12pm\u20135pm",price:695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-spicy-bang-bang-chicken-sandwich",section:"Sandwiches (12pm\u20135pm)",name:"Spicy Bang Bang Chicken Sandwich",description:"with Sriracha Mayonnaise, Peppers & Coriander; sandwiches 12pm\u20135pm",price:695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-smoked-ham-matured-cheddar-cheese-sandwi",section:"Sandwiches (12pm\u20135pm)",name:"Smoked Ham & Matured Cheddar Cheese Sandwich",description:"with Mustard Mayonnaise; sandwiches 12pm\u20135pm",price:695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-tuna-mayonnaise-sandwich",section:"Sandwiches (12pm\u20135pm)",name:"Tuna Mayonnaise Sandwich",description:"with Red Onion, Cucumber & Gem Lettuce; sandwiches 12pm\u20135pm",price:595,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-egg-mayonnaise-sandwich",section:"Sandwiches (12pm\u20135pm)",name:"Egg Mayonnaise Sandwich",description:"with Spring Onion & Chives; sandwiches 12pm\u20135pm",price:595,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-pork-fillet-escalopes",section:"Choose your cut",name:"Pork Fillet Escalopes",description:"All served with Grilled Tomato, Portobello Mushroom & your choice of side & sauce",price:2e3,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-8oz-scotch-beef-fillet",section:"Choose your cut",name:"8oz Scotch Beef Fillet",description:"All served with Grilled Tomato, Portobello Mushroom & your choice of side & sauce",price:3e3,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-8oz-scotch-sirloin",section:"Choose your cut",name:"8oz Scotch Sirloin",description:"All served with Grilled Tomato, Portobello Mushroom & your choice of side & sauce",price:2500,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-10oz-scotch-ribeye",section:"Choose your cut",name:"10oz Scotch Ribeye",description:"All served with Grilled Tomato, Portobello Mushroom & your choice of side & sauce",price:3e3,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-scotch-lamb-chops",section:"Choose your cut",name:"Scotch Lamb Chops",description:"All served with Grilled Tomato, Portobello Mushroom & your choice of side & sauce",price:2500,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-600gm-scotch-t-bone-steak",section:"Choose your cut",name:"600gm Scotch T-Bone Steak",description:"All served with Grilled Tomato, Portobello Mushroom & your choice of side & sauce",price:4500,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-souter-s-mixed-grill",section:"Choose your cut",name:"Souter\u2019s Mixed Grill",description:"4oz Sirloin / Chicken Breast / Lamb Chop / Pork Escalope; served with Grilled Tomato, Portobello Mushroom & your choice of side & sauce",price:3500,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-chunky-chips-included-side-choice",section:"Side (included)",name:"Chunky Chips (included side choice)",description:"Included side choice with cut",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-baby-boiled-potatoes-included-side-choic",section:"Side (included)",name:"Baby Boiled Potatoes (included side choice)",description:"Included side choice with cut",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-mashed-potato-included-side-choice",section:"Side (included)",name:"Mashed Potato (included side choice)",description:"Included side choice with cut",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-red-wine-jus-included-sauce-choice",section:"Sauce (included)",name:"Red Wine Jus (included sauce choice)",description:"Included sauce choice with cut",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-peppercorn-included-sauce-choice",section:"Sauce (included)",name:"Peppercorn (included sauce choice)",description:"Included sauce choice with cut",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-mustard-included-sauce-choice",section:"Sauce (included)",name:"Mustard (included sauce choice)",description:"Included sauce choice with cut",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-onion-rings",section:"Upgrade extras",name:"Onion Rings",description:"",price:495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-garden-salad",section:"Upgrade extras",name:"Garden Salad",description:"",price:425,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-mixed-vegetables",section:"Upgrade extras",name:"Mixed Vegetables",description:"",price:450,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-haggis-cake",section:"Upgrade extras",name:"Haggis Cake",description:"",price:200,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-mac-cheese",section:"Upgrade extras",name:"Mac & Cheese",description:"",price:525,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-garlic-prawns",section:"Upgrade extras",name:"Garlic Prawns",description:"",price:750,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-souter-s-coleslaw",section:"Upgrade extras",name:"Souter\u2019s Coleslaw",description:"",price:395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0}].map(s=>({...s,restaurantId:"souters",soldOut:!1,signOff:null})),t=215},1135,[]); +__d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ANCHORAGE_SECTIONS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"anchorageMenu",{enumerable:!0,get:function(){return o}});const i=i=>({id:i,name:'Served with',required:!0,multi:!1,choices:[{id:`${i}-custard`,label:'Custard',priceDelta:0,allergens:{}},{id:`${i}-icecream`,label:'Ice cream',priceDelta:0,allergens:{}},{id:`${i}-cream`,label:'Cream',priceDelta:0,allergens:{}},{id:`${i}-vegan`,label:'Vegan ice cream (ask server)',priceDelta:0,allergens:{}}]}),s=(i,s,n)=>({id:i,name:'Portion',required:!0,multi:!1,choices:[{id:`${i}-starter`,label:'Starter',priceDelta:0},{id:`${i}-main`,label:n,priceDelta:s}]}),n=[{id:'a-soup',section:'Starters',name:"Chef's Soup of the Day",description:'A heartwarming bowl of seasonal homemade soup, served with warm crusty bread and butter.',price:600,dietary:[],allergens:{},allergenNotes:'Recipe changes daily \u2014 check the day\u2019s soup.',prepMins:0},{id:'a-skink',section:'Starters',name:'Cullen Skink',description:'Traditional creamy soup made with locally smoked haddock, potatoes and leeks, served with warm crusty bread and butter.',price:900,dietary:[],allergens:{},prepMins:0},{id:'a-salmon',section:'Starters',name:'Scottish Smoked Salmon Roulade',description:'Delicate Scottish smoked salmon rolled with herb-infused cream cheese, served with garlic & herb crostini and dressed salad.',price:900,dietary:[],allergens:{},prepMins:0},{id:'a-haggis',section:'Starters',name:'Haggis Bon Bons',description:'Crisp golden panko-fried haggis balls, finished with a velvety Scotch whisky sauce and caramelised apple gel.',price:800,dietary:[],allergens:{},allergenNotes:'',prepMins:0},{id:'a-crabcakes',section:'Starters',name:'Spiced Crab Cakes',description:'Golden crab cakes, delicately seasoned with herbs and spices, served with crisp seasonal salad and house-made Marie Rose sauce.',price:900,dietary:[],allergens:{},allergenNotes:'',prepMins:0},{id:'a-tempura',section:'Starters',name:'Deluxe Mixed Tempura',description:"King prawns, chicken and lion's mane mushrooms in a light, crispy tempura batter, served with a dressed seasonal salad and house dipping sauce.",price:1e3,dietary:[],allergens:{},allergenNotes:'',prepMins:0,optionGroups:[s('tempura',900,'Main with triple-cooked chips (\xa319.00)')]},{id:'a-kingoyster',section:'Starters',name:"Pan-Seared King Oyster Mushroom 'Scallops' (VG)",description:"King oyster mushroom 'scallops' prepared with the chef's special recipe of the day. Ask your server or see our specials board for today's garnish and accompaniments.",price:1e3,dietary:['VG'],allergens:{},allergenNotes:'Garnish changes daily \u2014 sign-off needed for each version.',prepMins:0,special:!0,unsigned:!0,optionGroups:[s('kingoyster',800,'Main (\xa318.00)')]},{id:'a-fishsupper',section:'Mains',name:'Fish Supper',description:'Locally landed haddock, available beer-battered or breaded, served with buttered peas, triple-cooked chips and homemade tartare sauce.',price:1800,dietary:['GF option'],allergens:{},allergenNotes:'',prepMins:0,optionGroups:[{id:'fs-coat',name:'Coating',required:!0,multi:!1,choices:[{id:'fs-batter',label:'Beer-battered',priceDelta:0},{id:'fs-bread',label:'Breaded',priceDelta:0}]}]},{id:'a-lionsmane',section:'Mains',name:"Southern Fried Lion's Mane Burger (VG)",description:"Crispy southern fried lion's mane mushroom, layered with vegan cheese and garlic aioli, served with triple-cooked chips and golden onion rings.",price:1800,dietary:['VG'],allergens:{},prepMins:0},{id:'a-pie',section:'Mains',name:'Steak & Ale Pie',description:'Slow-braised beef in a rich ale jus beneath golden all-butter puff pastry, served with buttered seasonal vegetables.',price:1800,dietary:[],allergens:{},prepMins:0,optionGroups:[{id:'pie-side',name:'Served with',required:!0,multi:!1,choices:[{id:'chips',label:'Triple-cooked chips',priceDelta:0},{id:'creamed',label:'Creamed potatoes',priceDelta:0,allergens:{}}]}]},{id:'a-bananablossom',section:'Mains',name:"Beer-Battered Banana Blossom 'Fish' Goujons (VG)",description:'Crisp beer-battered banana blossom goujons, dusted with locally foraged truffle seaweed seasoning, served with triple-cooked chips, garden peas and vegan tartare sauce.',price:1700,dietary:['VG'],allergens:{},allergenNotes:'',prepMins:0},{id:'a-chicken',section:'Mains',name:'Roasted Breast of Chicken',description:'Golden pan-roasted chicken breast, served with creamed potatoes, buttered seasonal primaryBtns, and a fragrant lemon & thyme bouillon.',price:1900,dietary:[],allergens:{},prepMins:0},{id:'a-maccheese',section:'Mains',name:'Macaroni Cheese (V)',description:'Rich mature Cheddar macaroni finished with a golden cheese glaze, served with two slices of garlic bread.',price:1700,dietary:['V'],allergens:{},prepMins:0},{id:'a-penne',section:'Mains',name:'Cajun Chicken & Chorizo Penne Pasta',description:'Tender Cajun-spiced chicken strips, mixed peppers, red onion and smoky chorizo, tossed in a bold, creamy Cajun sauce, served with two slices of garlic bread.',price:1700,dietary:[],allergens:{},prepMins:0},{id:'a-caesar',section:'Mains',name:'Chicken Caesar Salad',description:'Tender pan-roasted chicken breast served on a bed of baby gem lettuce with golden garlic croutons, Parmesan and a classic Caesar dressing.',price:1800,dietary:[],allergens:{},allergenNotes:'',prepMins:0,optionGroups:[{id:'caesar-add',name:'Optional extras',required:!1,multi:!0,choices:[{id:'caesar-bacon',label:'Add smoked Ayrshire bacon',priceDelta:150}]}]},{id:'a-moules',section:'Mains',name:'Moules Marini\xe8re',description:'Fresh Scottish mussels, steamed to perfection in a rich, creamy white wine and garlic sauce.',price:1200,dietary:[],allergens:{},prepMins:0,optionGroups:[s('moules',1e3,'Main 500g with triple-cooked chips (\xa322.00)')]},{id:'a-fillet',section:'From the Grill',name:'8oz Fillet Steak',description:'Prime 8oz fillet steak served with truffled woodland mushrooms, seasonal primaryBtns, golden onion rings and triple-cooked chips.',price:3800,dietary:[],allergens:{},prepMins:0,optionGroups:[{id:'steak-sauce',name:'Sauce',required:!1,multi:!1,choices:[{id:'sauce-pepper',label:'Peppercorn sauce',priceDelta:0,allergens:{}},{id:'sauce-garlic',label:'Garlic butter',priceDelta:0,allergens:{}}]},{id:'steak-surf',name:'Surf & turf add-on',required:!1,multi:!1,choices:[{id:'surf-prawns',label:'Garlic prawns',priceDelta:800,allergens:{}},{id:'surf-scallops',label:'Scottish West Coast scallops',priceDelta:1e3,allergens:{}}]}]},{id:'a-claymore',section:'From the Grill',name:'The Claymore Burger',description:'One juicy 6oz homemade Scottish beef burger in a brioche bun with baby gem lettuce, tomato and gherkins, topped with cheese, smoked Ayrshire bacon and onion rings. Served with triple-cooked chips.',price:1800,dietary:[],allergens:{},prepMins:0,optionGroups:[{id:'claymore-add',name:'Optional extras',required:!1,multi:!0,choices:[{id:'claymore-haggis',label:'Add haggis and whisky sauce',priceDelta:150,allergens:{}}]}]},{id:'a-langoustines',section:"Captain's Table",name:'Whole Scottish Grilled Langoustines',description:'Locally caught whole Scottish langoustines grilled in garlic butter, served with a vibrant side salad and burnt lemon.',price:1700,dietary:[],allergens:{},prepMins:0,optionGroups:[s('lang',1200,'Main 500g with triple-cooked chips (\xa329.00)')]},{id:'a-scallops',section:"Captain's Table",name:'Pan-Seared West Coast Scallops',description:"Scottish West Coast scallops prepared to the chef's recipe of the day. Starter and main portions \u2014 see price on Specials Board.",price:null,priceNote:'See specials board',dietary:[],allergens:{},prepMins:0,special:!0,unsigned:!0},{id:'a-lobster',section:"Captain's Table",name:'Grilled Dunure Lobster',description:'Fresh Dunure lobster, caught locally by "Kitty Fisher", finished in rich garlic butter and served with a vibrant side salad, triple-cooked chips and burnt lemon. When available.',price:3500,dietary:[],allergens:{},prepMins:0,optionGroups:[{id:'lobster-size',name:'Size',required:!0,multi:!1,choices:[{id:'lob-half',label:'Half',priceDelta:0},{id:'lob-whole',label:'Whole (\xa365.00)',priceDelta:3e3}]}]},{id:'a-crab',section:"Captain's Table",name:'Grilled Dunure Crab',description:'Freshly landed Dunure brown crab, caught locally by "Kitty Fisher", finished in rich garlic butter and served with a vibrant side salad, triple-cooked chips and burnt lemon. When available.',price:4e3,dietary:[],allergens:{},prepMins:0},{id:'a-smorgasbord',section:'Platters',name:'Seafood Smorgasbord (serves one)',description:"250g langoustines, 3 pan-seared West Coast scallops, 250g fresh mussels, 6 garlic prawns and a roll of Scottish smoked salmon, with dressed side salad and warm crusty bread.",price:5e3,dietary:[],allergens:{},prepMins:0},{id:'a-deluxe',section:'Platters',name:'Deluxe Seafood Platter (serves two)',description:'One whole Dunure lobster, one whole Dunure crab, 500g whole langoustines, 500g moules marini\xe8re, pan-seared scallops, Scottish smoked salmon and 6 garlic prawns, with two portions of chips, side salad and warm crusty bread.',price:16500,dietary:[],allergens:{},prepMins:0},{id:'a-onionrings',section:'Sides',name:'House Beer-Battered Onion Rings (V)',description:'Crisp house beer-battered onion rings, served golden and crunchy.',price:450,dietary:['V'],allergens:{},allergenNotes:'',prepMins:0},{id:'a-garlicbread',section:'Sides',name:'Garlic Bread (V)',description:'Warm toasted garlic bread, finished with garlic & parsley butter.',price:450,dietary:['V'],allergens:{},prepMins:0,optionGroups:[{id:'gb-add',name:'Optional extras',required:!1,multi:!0,choices:[{id:'gb-cheese',label:'Add cheese',priceDelta:100}]}]},{id:'a-chips',section:'Sides',name:'Triple-Cooked Chips (V)',description:'Golden triple-cooked chips, lightly tossed in Maldon sea salt.',price:450,dietary:['V'],allergens:{},allergenNotes:'',prepMins:0,optionGroups:[{id:'chips-add',name:'Optional extras',required:!1,multi:!0,choices:[{id:'chips-cajun',label:'Add Cajun seasoning',priceDelta:0,allergens:{}}]}]},{id:'a-truffle',section:'Sides',name:'Parmesan & Truffle Fries (V)',description:'Crispy fries topped with finely grated parmesan and tossed in a winter truffle infused oil.',price:500,dietary:['V'],allergens:{},allergenNotes:'',prepMins:0},{id:'a-salad',section:'Sides',name:'Side Salad (VG)',description:'Seasonal mixed leaves with cucumber, red onion and mixed peppers, finished with a light vinaigrette.',price:450,dietary:['VG'],allergens:{},prepMins:0},{id:'a-brulee',section:'Desserts',name:"Chef's Cr\xe8me Br\xfbl\xe9e of the Day (V)",description:"Smooth Madagascan custard with a delicately caramelised sugar crust. Ask your server or see our specials board for today's flavour.",price:800,dietary:['V'],allergens:{},prepMins:0},{id:'a-crumble',section:'Desserts',name:'Seasonal Fruit Crumble (V)',description:'Slow-cooked seasonal fruit topped with a golden buttery crumble.',price:800,dietary:['V'],allergens:{},prepMins:0,optionGroups:[i('crumble')]},{id:'a-stp',section:'Desserts',name:'Sticky Toffee Pudding (V)',description:'A rich, homemade steamed date pudding, drenched in our signature homemade butterscotch sauce.',price:800,dietary:['V'],allergens:{},prepMins:0,optionGroups:[i('stp')]},{id:'a-cheesecake',section:'Desserts',name:'Cheesecake of the Day (V)',description:'A smooth, creamy cheesecake on a buttery biscuit base. Gluten-free and vegan options available.',price:800,dietary:['V'],allergens:{},prepMins:0,optionGroups:[i('cheesecake')]},{id:'a-affogato',section:'Desserts',name:'Affogato (V)',description:'Two scoops of creamy vanilla ice cream with a freshly brewed shot of Italian espresso poured over. Vegan options available.',price:800,dietary:['V'],allergens:{},prepMins:0},{id:'a-mini',section:'Mini Anchors (under 12s)',name:'Mini Anchors meal',description:'Under 12s only. Served with peas or beans. Includes a diluting juice drink & 2 scoops of ice cream. GF options available.',price:900,dietary:['GF option'],allergens:{},prepMins:0,optionGroups:[{id:'mini-main',name:'Choose a meal',required:!0,multi:!1,choices:[{id:'mini-burger',label:'Cheeseburger & chips',priceDelta:0,allergens:{}},{id:'mini-fish',label:'Fish goujons & chips',priceDelta:0,allergens:{}},{id:'mini-mac',label:"Mac 'n' cheese & chips (V)",priceDelta:0,allergens:{}},{id:'mini-chicken',label:'Chicken goujons & chips',priceDelta:0,allergens:{}}]},{id:'mini-veg',name:'With',required:!0,multi:!1,choices:[{id:'mini-peas',label:'Peas',priceDelta:0},{id:'mini-beans',label:'Beans',priceDelta:0}]}]}],t=['Starters','Mains','From the Grill',"Captain's Table",'Platters','Sides','Desserts','Mini Anchors (under 12s)'],o=n.map(({unsigned:i,soldOut:s,...n})=>({...n,allergens:{},allergenNotes:'',prepMins:0,optionGroups:n.optionGroups?.map(i=>({...i,choices:i.choices.map(i=>({...i,allergens:{}}))})),restaurantId:"anchorage",soldOut:!!s,signOff:null}))},1136,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SCOTTISH_BANK_HOLIDAYS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"BANK_HOLIDAY_SOURCE",{enumerable:!0,get:function(){return n}});const t=[{date:"2026-11-30",title:"St Andrew\u2019s Day",notes:""},{date:"2026-12-25",title:"Christmas Day",notes:""},{date:"2026-12-28",title:"Boxing Day",notes:"Substitute day"},{date:"2027-01-01",title:"New Year\u2019s Day",notes:""},{date:"2027-01-04",title:"2nd January",notes:"Substitute day"},{date:"2027-03-26",title:"Good Friday",notes:""},{date:"2027-05-03",title:"Early May bank holiday",notes:""},{date:"2027-05-31",title:"Spring bank holiday",notes:""},{date:"2027-08-02",title:"Summer bank holiday",notes:""},{date:"2027-11-30",title:"St Andrew\u2019s Day",notes:""},{date:"2027-12-27",title:"Christmas Day",notes:"Substitute day"},{date:"2027-12-28",title:"Boxing Day",notes:"Substitute day"},{date:"2028-01-03",title:"New Year\u2019s Day",notes:"Substitute day"},{date:"2028-01-04",title:"2nd January",notes:"Substitute day"},{date:"2028-04-14",title:"Good Friday",notes:""},{date:"2028-05-01",title:"Early May bank holiday",notes:""},{date:"2028-05-29",title:"Spring bank holiday",notes:""},{date:"2028-08-07",title:"Summer bank holiday",notes:""},{date:"2028-11-30",title:"St Andrew\u2019s Day",notes:""},{date:"2028-12-25",title:"Christmas Day",notes:""},{date:"2028-12-26",title:"Boxing Day",notes:""}],n='gov.uk/bank-holidays.json (Scotland)'},1137,[]); +__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"MESSAGING_CONFIG",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"previewProvider",{enumerable:!0,get:function(){return t}}),_e.relayProvider=n,Object.defineProperty(_e,"isLive",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"activeProvider",{enumerable:!0,get:function(){return s}});const e={mode:'preview',endpoint:'',smsService:'Twilio',emailService:'Postmark',smsSenderId:'ANCHORAGE',fromEmail:'bookings@your-venue.co.uk'},t={id:'preview',label:'Preview mode (nothing is sent)',live:!1,deliver:async()=>({ok:!0})};function n(e){return{id:'relay',label:'Your messaging server',live:!0,deliver:async t=>{try{const n=await fetch(e,{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({channel:t.channel,to:t.to,subject:t.subject,body:t.body,html:t.html,ref:t.ref,kind:t.kind,restaurantId:t.restaurantId})});if(!n.ok)return{ok:!1,error:`Server said ${n.status}`};return{ok:!0,providerId:(await n.json().catch(()=>({}))).id}}catch(e){return{ok:!1,error:e?.message??'Network error'}}}}}const o=()=>'live'===e.mode&&!!e.endpoint,s=()=>o()?n(e.endpoint):t},1138,[]); +__d(function(g,_r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TEMPLATE_LABEL",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"DEFAULT_TEMPLATES",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"PLACEHOLDERS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"teamName",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"longDate",{enumerable:!0,get:function(){return u}}),e.bookingVars=function(n,r){const o=n.allergies.map(n=>`${(0,t.allergenLabel)(n.allergen).toLowerCase()}`).join(', '),a=n.allergies.map(n=>`${(0,t.allergenLabel)(n.allergen)} (${(0,t.severityLabel)(n.severity).toLowerCase()})`).join(', '),i=`${n.partySize} ${1===n.partySize?'person':'people'}`,s={...c(r),first:l(n.name),name:n.name.trim(),date:u(n.date),time:n.time,covers:i,ref:n.ref};return{sms:{...s,allergy:n.allergies.length?` We\u2019ve noted the allergy (${o}) and the team will check it with you when you arrive.`:'',note:'',details:''},email:{...s,allergy:n.allergies.length?`Thank you for telling us about: ${a}. Our team will go through this with you when you arrive, and every dish for your table is checked at each step, from the kitchen to your table.`:'',note:n.notes.trim()?`Your note to us: "${n.notes.trim()}". We\u2019ll make sure the team sees it.`:'',details:[`Date: ${u(n.date)}`,`Time: ${n.time}`,`Table for: ${i}`,`Reference: ${n.ref}`].join('\n')}}},e.orderVars=function(r,o){const a=r.lines.reduce((t,n)=>t+n.qty,0),i=r.readyBy??r.slotTime,s=i?`at ${m(i)}`:'time to be confirmed',d=r.allergies.map(n=>(0,t.allergenLabel)(n.allergen).toLowerCase()).join(', '),u=r.allergies.map(n=>`${(0,t.allergenLabel)(n.allergen)} (${(0,t.severityLabel)(n.severity).toLowerCase()})`).join(', '),y={...c(o),first:l(r.customerName),name:r.customerName,ref:r.ref,items:`${a} ${1===a?'item':'items'}`,total:(0,n.gbp)(r.total),collect:s,date:'',time:i?m(i):'',covers:''};return{sms:{...y,allergy:r.allergies.length?` We\u2019ve noted your allergy (${d}); the kitchen checks every item.`:'',itemList:'',details:'',note:''},email:{...y,allergy:r.allergies.length?`You told us about: ${u}. The kitchen signs off every item against it before your order leaves the pass.`:'',itemList:r.lines.map(t=>`${t.qty} \xd7 ${t.name}${t.choices.length?` (${t.choices.join(', ')})`:''}`).join('\n'),details:[`Order: ${r.ref}`,`Collection: ${i?m(i):'time to be confirmed'}`,`Items: ${a}`,`Total: ${(0,n.gbp)(r.total)}`].join('\n'),note:''}}},e.fill=y,Object.defineProperty(e,"fillEmailText",{enumerable:!0,get:function(){return h}}),e.emailHtml=function(t,n){const r=n.accent??'#B8893E',o=t.split(/\n{2,}/).map(t=>{const n=t.split('\n');return n.length>1&&n.every(t=>/^[^:]{2,22}:\s.+/.test(t))?`${n.map(t=>{const n=t.indexOf(':');return``}).join('')}
${p(t.slice(0,n))}${p(t.slice(n+1).trim())}
`:n.length>1&&n.every(t=>/^\d+ \xd7/.test(t))?`
    ${n.map(t=>`
  • ${p(t)}
  • `).join('')}
`:`

${n.map(p).join('
')}

`}).join('');return`${p(n.preheader??'')}
${p(n.venue.toUpperCase())}
${o}
You\u2019re getting this because you made a booking or order with ${p(n.venue)}. It\u2019s about your booking only, not marketing.
`},e.smsParts=function(t){const n=b(t),r=!f.test(n),o=n.length,a=r?o<=70?1:Math.ceil(o/67):o<=160?1:Math.ceil(o/153);return{chars:o,parts:a,unicode:r}},Object.defineProperty(e,"toGsm",{enumerable:!0,get:function(){return b}});var t=_r(_d[0]),n=_r(_d[1]);const r={booking:{title:'Booking confirmed',when:'Every booking: online, phone or in person (and when you confirm a request)'},request:{title:'Booking request received',when:'Online bookings that need you to confirm them first'},declined:{title:'Booking request declined',when:'When you decline a booking request'},order:{title:'Takeaway order confirmed',when:'Every takeaway order from the app (and phone orders with a number)'}},o={booking:{sms:'Hi {first}, you\u2019re booked in at {venue}: {date} at {time}, {covers}. Ref {ref}.{allergy} Need to change or cancel? Just call {venuePhone}. See you soon, {team}',subject:'You\u2019re booked in at {venue}: {date} at {time}',body:'Hi {first},\n\nThank you for booking with us. We\u2019re really looking forward to welcoming you.\n\n{details}\n\n{allergy}\n\n{note}\n\nIf your plans change, just give us a ring on {venuePhone} and we\u2019ll happily move or cancel it for you. Please quote {ref}.\n\nYou\u2019ll find us at {address}.\n\nWarm wishes,\n{team}'},request:{sms:'Hi {first}, thanks for your booking request at {venue} for {date} at {time}, {covers}. We\u2019ll text you shortly to confirm. Ref {ref}. Questions? Call {venuePhone}. {team}',subject:'We\u2019ve got your booking request for {date}',body:'Hi {first},\n\nThank you for your booking request. A member of the team will look at it and confirm with you very shortly.\n\n{details}\n\n{allergy}\n\n{note}\n\nIf you have any questions in the meantime, call us on {venuePhone} and quote {ref}.\n\nWarm wishes,\n{team}'},declined:{sms:'Hi {first}, we\u2019re so sorry, we can\u2019t fit {covers} in on {date} at {time}. Please call {venuePhone} and we\u2019ll do our best to find another time. {team}',subject:'About your booking request for {date}',body:'Hi {first},\n\nThank you for asking to book with us. We\u2019re really sorry, but we can\u2019t fit your party in on {date} at {time}.\n\nWe\u2019d love to find another time that works. Give us a ring on {venuePhone} and we\u2019ll do our best.\n\nWith apologies and warm wishes,\n{team}'},order:{sms:'Hi {first}, thanks for your order {ref} from {venue}: {items}, {total}. Collection {collect}.{allergy} Questions? Call {venuePhone}. {team}',subject:'Your {venue} order {ref}',body:'Hi {first},\n\nThank you for your order. The kitchen has it and we\u2019ll have it ready for you.\n\n{details}\n\n{itemList}\n\n{allergy}\n\nAny questions, or need to change something? Call us on {venuePhone} and quote {ref}.\n\nYou\u2019ll find us at {address}.\n\nEnjoy!\n{team}'}},a=[{key:'first',what:'Guest\u2019s first name'},{key:'name',what:'Name on the booking'},{key:'venue',what:'Venue name'},{key:'date',what:'Day and date'},{key:'time',what:'Time'},{key:'covers',what:'e.g. 4 people'},{key:'ref',what:'Reference'},{key:'venuePhone',what:'Venue phone'},{key:'address',what:'Venue address'},{key:'team',what:'e.g. The Anchorage team'},{key:'allergy',what:'Allergy reassurance (only if one was noted)'},{key:'note',what:'Their note (email only)'},{key:'details',what:'Details box (email only)'},{key:'items',what:'Orders: e.g. 3 items'},{key:'total',what:'Orders: total'},{key:'collect',what:'Orders: collection time'},{key:'itemList',what:'Orders: list of items (email)'}],i=t=>/^the\s/i.test(t.trim())?`${t.trim()} team`:`The ${t.trim()} team`,l=t=>t.trim().replace(/^(mr|mrs|ms|miss|dr)\.?\s+/i,'').split(/\s+/)[0]||'there',s=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],d=['January','February','March','April','May','June','July','August','September','October','November','December'],u=t=>{const[n,r,o]=t.split('-').map(Number),a=new Date(n,r-1,o,12);return`${s[a.getDay()]} ${o} ${d[r-1]}`},m=t=>{const n=new Date(t);return`${String(n.getHours()).padStart(2,'0')}:${String(n.getMinutes()).padStart(2,'0')}`};function c(t){return{venue:t.name,venuePhone:t.phone||'the restaurant',address:t.address||t.location,team:i(t.name)}}function y(t,n){return t.replace(/\{(\w+)\}/g,(t,r)=>r in n?n[r]:t).replace(/[ \t]{2,}/g,' ').replace(/ +([.,])/g,'$1').trim()}const h=(t,n)=>y(t,n).split(/\n{2,}/).map(t=>t.trim()).filter(Boolean).join('\n\n'),p=t=>t.replace(/&/g,'&').replace(//g,'>').replace(/"/g,'"');const f=/^[A-Za-z0-9 \r\n@\xa3$\xa5\xe8\xe9\xf9\xec\xf2\xc7\xd8\xf8\xc5\xe5\u0394_\u03a6\u0393\u039b\u03a9\u03a0\u03a8\u03a3\u0398\u039e\xc6\xe6\xdf\xc9!"#\xa4%&'()*+,\-./:;<=>?\xa1\xc4\xd6\xd1\xdc\xa7\xbf\xe4\xf6\xf1\xfc\xe0^{}\\[~\]|\u20ac]*$/;const b=t=>t.replace(/[\u2018\u2019]/g,"'").replace(/[\u201c\u201d]/g,'"').replace(/[\u2013\u2014]/g,'-').replace(/\u2026/g,'...').replace(/\xd7/g,'x')},1139,[814,816]); +__d(function(g,r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.ukPhone=function(t){const s=(t??'').trim();if(!s)return{ok:!1,error:'A phone number is needed so we can send the confirmation.'};let l=s.replace(/[\s\-().]/g,'');l.startsWith('+44')?l='0'+l.slice(3):l.startsWith('0044')?l='0'+l.slice(4):/^44\d{10}$/.test(l)&&(l='0'+l.slice(2));l.startsWith('0(0)')&&(l=l.replace('0(0)','0'));l.startsWith('00')&&(l=l.slice(1));if(!/^0\d+$/.test(l))return{ok:!1,error:'Please use numbers only, for example 07700 900123.'};const n=/^07\d{9}$/.test(l),o=/^0[1238]\d{8,9}$/.test(l);if(!n&&!o)return{ok:!1,error:'That doesn\u2019t look like a UK mobile or landline. For example 07700 900123 or 01292 502826.'};const c=n?`${l.slice(0,5)} ${l.slice(5)}`:/^02/.test(l)?`${l.slice(0,3)} ${l.slice(3,7)} ${l.slice(7)}`:/^0(3|8)/.test(l)?`${l.slice(0,4)} ${l.slice(4,7)} ${l.slice(7)}`:`${l.slice(0,5)} ${l.slice(5)}`;return{ok:!0,e164:'+44'+l.slice(1),pretty:c,kind:n?'mobile':'landline'}},e.emailOk=function(t){const s=(t??'').trim();return!s||/^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/.test(s)}},1140,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"shallow",{enumerable:!0,get:function(){return c}});const t=t=>Symbol.iterator in t,n=t=>"entries"in t,o=(t,n)=>{const o=t instanceof Map?t:new Map(t.entries()),s=n instanceof Map?n:new Map(n.entries());if(o.size!==s.size)return!1;for(const[t,n]of o)if(!s.has(t)||!Object.is(n,s.get(t)))return!1;return!0},s=(t,n)=>{const o=t[Symbol.iterator](),s=n[Symbol.iterator]();let c=o.next(),u=s.next();for(;!c.done&&!u.done;){if(!Object.is(c.value,u.value))return!1;c=o.next(),u=s.next()}return!!c.done&&!!u.done};function c(c,u){return!!Object.is(c,u)||"object"==typeof c&&null!==c&&"object"==typeof u&&null!==u&&(Object.getPrototypeOf(c)===Object.getPrototypeOf(u)&&(t(c)&&t(u)?n(c)&&n(u)?o(c,u):s(c,u):o({entries:()=>Object.entries(c)},{entries:()=>Object.entries(u)})))}},1141,[]); +__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"EXAMPLE_TAG",{enumerable:!0,get:function(){return t}}),_e.exampleCards=function(t){return l.flatMap(l=>{const h=t.find(e=>e.id===l.menuItemId);if(!h)return[];return[{id:(0,e.uuidFrom)(`card:${h.restaurantId}:${h.id}`),restaurantId:h.restaurantId,menuItemId:h.id,dish:h.name,section:h.section,price:h.price,photo:l.photo,ingredients:o(l.menuItemId,l.ings),steps:l.steps,allergens:l.allergens,dismissed:l.dismissed??[],allergenNotes:l.notes,allergensConfirmed:{by:s.by,at:s.at},signOff:l.awaiting?null:s,wasLive:!0,origin:'example',version:l.awaiting?2:1,createdAt:n,updatedAt:l.awaiting?'2026-10-28T15:20:00.000Z':n,updatedBy:l.awaiting?'Example edit (demo)':s.by}]})},_e.importedCard=function(t,s){return{id:(0,e.uuidFrom)(`card:${t.restaurantId}:${t.id}`),restaurantId:t.restaurantId,menuItemId:t.id,dish:t.name,section:t.section,price:t.price,ingredients:[],steps:[],allergens:{...t.allergens},dismissed:[],allergenNotes:t.allergenNotes,allergensConfirmed:t.signOff?{by:t.signOff.by,at:t.signOff.at}:void 0,signOff:t.signOff?{by:t.signOff.by,at:t.signOff.at}:null,wasLive:!t.hidden||!!t.signOff,origin:'imported',version:1,createdAt:s,updatedAt:s,updatedBy:'Imported from the menu'}};var e=r(d[0]);const t='Example data',s={by:'Example sign-off (demo)',at:'2026-10-26T10:00:00.000Z'},n='2026-10-26T09:00:00.000Z',o=(e,t)=>t.map(([t,s,n],o)=>({id:`${e}-i${o}`,qty:t,unit:s,name:n})),l=[{menuItemId:'a-lobster',photo:'asset:lobster',ings:[['1','whole','Live Dunure lobster (c. 600 g, Kitty Fisher)'],['60','g','Garlic butter'],['\xbd','','Lemon, charred'],['60','g','Mixed leaves, cucumber and red onion'],['15','ml','House vinaigrette (Dijon mustard)'],['200','g','Triple-cooked chips']],steps:['Chill the lobster for 20 minutes, then dispatch humanely and split lengthways. Remove the stomach sac and the intestinal tract.','Crack the claws. Season the flesh and spoon over half the garlic butter.','Grill flesh side up for 6\u20138 minutes until just opaque; baste with the rest of the butter.','Char the lemon on the grill. Dress the salad at the pass.','Plate on the long board: lobster, claws alongside, salad, chips in the cone, lemon and a pot of the pan butter.'],allergens:{crustaceans:'contains',milk:'contains',mustard:'contains',gluten:'may',fish:'may'},notes:'Chips are cooked in a shared fryer (gluten, fish, crustaceans may be present).'},{menuItemId:'a-skink',photo:'asset:skink',ings:[['120','g','Smoked haddock, undyed'],['200','ml','Whole milk'],['20','g','Butter'],['60','g','Leek, sliced'],['40','g','Onion, diced'],['120','g','Floury potato, diced'],['1','tbsp','Parsley, chopped'],['1','slice','Crusty bread'],['10','g','Butter (portion)']],steps:['Poach the haddock in the milk for 5 minutes. Lift out, flake and keep the milk.','Sweat the leek and onion in the butter until soft, with no colour.','Add the potato and the poaching milk; simmer for 15 minutes until the potato breaks down.','Crush a third of the potato for body, return the haddock and season with pepper.','Serve in the warm bowl, parsley on top, bread and butter on the side.'],allergens:{fish:'contains',milk:'contains',gluten:'contains'}},{menuItemId:'a-fishsupper',photo:'asset:fishsupper',ings:[['200','g','Haddock fillet, locally landed'],['80','g','Self-raising flour'],['100','ml','Beer (lager)'],['250','g','Triple-cooked chips'],['80','g','Garden peas'],['10','g','Butter'],['40','g','Tartare sauce (mayonnaise, capers, gherkins)'],['\xbc','','Lemon']],steps:['Whisk the flour and cold beer to a thick batter; rest for 10 minutes.','Dust the haddock in flour, dip in the batter and lower into the fryer at 180 \xb0C for 5\u20136 minutes.','Fry the chips at 190 \xb0C until golden.','Warm the peas with the butter.','Plate the fish on the chips, peas in the ramekin, tartare and lemon on the side.'],allergens:{fish:'contains',gluten:'contains',eggs:'contains',milk:'contains',mustard:'may',crustaceans:'may',sulphites:'may'},notes:'Shared fryer. Tartare is made with mayonnaise (egg, may contain mustard). The beer in the batter may contain sulphites.'},{menuItemId:'a-moules',photo:'asset:moules',ings:[['500','g','Scottish rope mussels, cleaned'],['30','g','Butter'],['1','','Shallot, finely diced'],['2','cloves','Garlic, sliced'],['100','ml','Dry white wine'],['60','ml','Double cream'],['1','tbsp','Parsley, chopped'],['2','slices','Crusty bread']],steps:['Check every mussel: discard any that are cracked or stay open when tapped.','Sweat the shallot and garlic in the butter for 2 minutes.','Add the mussels and wine, cover and steam on a high heat for 3\u20134 minutes until they open.','Discard any that stay shut. Stir in the cream and parsley.','Serve in the deep bowl with the bread and an empty-shell bowl.'],allergens:{molluscs:'contains',milk:'contains',sulphites:'contains',gluten:'contains'}},{menuItemId:'a-stp',photo:'asset:stp',awaiting:!0,ings:[['30','g','Medjool dates, chopped'],['40','ml','Boiling water'],['25','g','Butter'],['30','g','Dark muscovado sugar'],['1','','Egg (\xbd per portion)'],['35','g','Self-raising flour'],['60','ml','Butterscotch sauce (butter, cream, brown sugar)']],steps:['Soak the dates in the boiling water for 10 minutes, then blitz.','Cream the butter and sugar, beat in the egg, fold in the flour and the dates.','Steam in buttered moulds for 35 minutes.','Warm the butterscotch sauce.','Turn out, pour over the sauce and serve with the guest\u2019s choice of custard, ice cream or cream.'],allergens:{gluten:'contains',milk:'contains',eggs:'contains',sulphites:'may'},notes:'Dried dates may contain sulphites. Accompaniments are chosen at order (see the dish options).'}]},1142,[1104]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/display-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg",width:800,height:600,toString(){return this.uri}}},1143,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/display-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg",width:800,height:600,toString(){return this.uri}}},1144,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/display-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg",width:800,height:600,toString(){return this.uri}}},1145,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/display-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg",width:800,height:600,toString(){return this.uri}}},1146,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/display-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg",width:800,height:600,toString(){return this.uri}}},1147,[]); +__d(function(g,r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"gid",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"SEED_CALC_INGREDIENTS",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"SEED_CALC_DISHES",{enumerable:!0,get:function(){return I}}),_e.stripGpSamples=y,Object.defineProperty(_e,"useGpCalc",{enumerable:!0,get:function(){return v}}),_e.useGpCalcView=function(){const e=v();return(0,t.useMemo)(()=>i.LIVE_VENUE_BUILD?{...e,...y(e)}:e,[e])};var e,i=r(_d[0]),t=r(_d[1]),s=r(_d[2]),a=r(_d[3]),n=r(_d[4]),c=(e=n)&&e.__esModule?e:{default:e},d=r(_d[5]),o=r(_d[6]),p=r(_d[7]);let l=0;const f=e=>`${e}-${Date.now().toString(36)}${(l++).toString(36)}`,h=(e,i,t,s,a,n=0,c=[])=>({id:e,name:i,packSize:t,packUnit:s,packPrice:a,wastePct:n,allergens:c}),u=e=>new Date(Date.now()-864e5*e).toISOString(),k={'gi-haddock':[8100,8700,8500],'gi-chicken':[4500,4600,4750],'gi-steak':[6200,5900,6e3],'gi-potato':[1450,1500,1600],'gi-oil':[3400,3300,3200]},S=[h('gi-haddock','Haddock fillet',5,'kg',8500,5,['fish']),h('gi-potato','Potatoes (chipping)',25,'kg',1600,20),h('gi-batter','Batter mix',3.5,'kg',770,0,['gluten']),h('gi-oil','Rapeseed oil',20,'L',3200),h('gi-peas','Garden peas (frozen)',2.5,'kg',450),h('gi-lemon','Lemons',80,'each',1600),h('gi-mayo','Mayonnaise',5,'L',1250,0,['eggs','mustard']),h('gi-capers','Capers',1,'kg',900,0,['sulphites']),h('gi-gherkin','Gherkins',2,'kg',700,0,['sulphites']),h('gi-steak','Braising steak',5,'kg',6e3,10),h('gi-pastry','Puff pastry',5,'kg',2250,0,['gluten','milk']),h('gi-onion','Onions',10,'kg',1e3,10),h('gi-stock','Beef stock',1,'L',350,0,['celery']),h('gi-chicken','Chicken breast',5,'kg',4750),h('gi-leaves','Cos lettuce',12,'each',960,15),h('gi-parmesan','Parmesan',1,'kg',1800,0,['milk']),h('gi-bread','Sourdough loaf',1,'each',300,0,['gluten']),h('gi-anchovy','Anchovies',.5,'kg',900,0,['fish']),h('gi-sponge','Date sponge (tray of 12)',1,'each',600,0,['gluten','eggs','milk']),h('gi-toffee','Toffee sauce',2,'L',1100,0,['milk']),h('gi-icecream','Vanilla ice cream',4,'L',1800,0,['milk','eggs'])].map(e=>({...e,prices:(k[e.id]??[e.packPrice]).map((e,i,t)=>({p:e,at:u(7*(t.length-i))}))})),P=(e,i,t,s,a,n,c,d="")=>({id:e,name:i,category:t,lines:s.map(([e,i,t])=>({ingId:e,qty:i,unit:t})),portions:a,target:70,menuPrice:n,status:c,description:d,allergens:[]}),I=[P('gd-chips','Chips (portion)','Sides',[['gi-potato',300,'g'],['gi-oil',50,'ml']],1,450,'ready','Hand-cut, twice-cooked chips.'),P('gd-tartare','Tartare sauce (batch of 20)','Sauces & extras',[['gi-mayo',1,'L'],['gi-capers',100,'g'],['gi-gherkin',150,'g'],['gi-lemon',2,'each']],20,void 0,'draft'),P('gd-fish','Fish & chips (example)','Mains',[['gi-haddock',220,'g'],['gi-batter',60,'g'],['dish:gd-chips',1,'each'],['gi-peas',80,'g'],['dish:gd-tartare',1,'each'],['gi-lemon',1,'each']],1,1695,'ready','Beer-battered haddock, chips, peas and tartare sauce.'),P('gd-pie','Steak pie (example)','Mains',[['gi-steak',2,'kg'],['gi-pastry',800,'g'],['gi-onion',500,'g'],['gi-stock',1,'L']],10,1595,'draft','Slow-braised steak under a puff pastry lid. Batch of 10.'),P('gd-caesar','Chicken Caesar (example)','Starters',[['gi-chicken',160,'g'],['gi-leaves',.5,'each'],['gi-parmesan',15,'g'],['gi-bread',.1,'each'],['gi-anchovy',8,'g']],1,1150,'draft'),P('gd-stp','Sticky toffee pudding (example)','Desserts',[['gi-sponge',.083,'each'],['gi-toffee',60,'ml'],['gi-icecream',70,'ml']],1,695,'ready','Warm date sponge, toffee sauce, vanilla ice cream.')];function y(e){const i=e=>I.some(i=>i.id===e.id&&JSON.stringify(i)===JSON.stringify(e))||/\(example\)/i.test(e.name),t=new Set(e.dishes.filter(e=>!i(e)).map(e=>e.id));let s=!0;for(;s;){s=!1;for(const i of e.dishes.filter(e=>t.has(e.id)))for(const e of i.lines)e.ingId.startsWith('dish:')&&!t.has(e.ingId.slice(5))&&(t.add(e.ingId.slice(5)),s=!0)}const a=e.dishes.filter(e=>t.has(e.id)),n=new Set(a.flatMap(e=>e.lines.map(e=>e.ingId))),c=e=>{const i=S.find(i=>i.id===e.id);if(!i)return!1;const t=({prices:e,...i})=>JSON.stringify(i);return t(i)===t(e)&&(!e.prices?.length||JSON.stringify(e.prices.map(e=>e.p))===JSON.stringify(i.prices?.map(e=>e.p)))};return{dishes:a,ingredients:e.ingredients.filter(e=>n.has(e.id)||!c(e))}}const v=(0,d.create)()((0,o.persist)((e,t)=>({ingredients:a.IS_ISOLATED_VENUE||i.LIVE_VENUE_BUILD?[]:S,dishes:a.IS_ISOLATED_VENUE||i.LIVE_VENUE_BUILD?[]:I,settings:{vatPct:20,pricePoints:!0,defaultTarget:70,multipleBasis:'inc',priceBasis:'latest',avgOf:5},alerts:[],saveIngredient:i=>{const s=t(),a=s.ingredients.find(e=>e.id===i.id),n=s.ingredients.map(e=>e.id===i.id?i:e);let c=s.alerts;if(a&&(a.packPrice!==i.packPrice||a.packSize!==i.packSize||a.wastePct!==i.wastePct)){const e=s.settings.vatPct,t=s.dishes.filter(e=>e.menuPrice).map(i=>{const t=(0,p.gpOf)((0,p.portionCost)(i,s.ingredients,s.dishes),i.menuPrice,e).gpPct,a=(0,p.gpOf)((0,p.portionCost)(i,n,s.dishes),i.menuPrice,e).gpPct;return{id:i.id,name:i.name,before:t,after:a,belowTarget:ae.aftere.packPrice/e.packSize/(1-(e.wastePct||0)/100),o=(d(i)-d(a))/d(a)*100;t.length&&(c=[{id:f('ma'),at:(new Date).toISOString(),ingredient:i.name,change:`${o>=0?'+':''}${o.toFixed(0)}%`,dishes:t},...c].slice(0,20))}e({ingredients:n,alerts:c})},addPricePaid:(e,i,s)=>{const a=t(),n=a.ingredients.find(i=>i.id===e);if(!(n&&i>0))return;const c=[...n.prices?.length?n.prices:[{p:n.packPrice,at:''}],{p:Math.round(i),at:s??(new Date).toISOString()}].slice(-20),d={...n,prices:c};t().saveIngredient({...d,packPrice:(0,p.costingPrice)(d,a.settings.priceBasis,a.settings.avgOf??5)})},addIngredient:i=>{const t=f('gi');return e(e=>({ingredients:[...e.ingredients,{...i,id:t}]})),t},saveDish:i=>e(e=>({dishes:e.dishes.some(e=>e.id===i.id)?e.dishes.map(e=>e.id===i.id?{...i,updatedAt:(new Date).toISOString()}:e):[{...i,updatedAt:(new Date).toISOString()},...e.dishes]})),removeDish:i=>e(e=>({dishes:e.dishes.filter(e=>e.id!==i)})),setSettings:i=>{const s={...t().settings,...i};if(e({settings:s}),void 0!==i.priceBasis||void 0!==i.avgOf)for(const e of t().ingredients){const i=(0,p.costingPrice)(e,s.priceBasis,s.avgOf??5);i!==e.packPrice&&t().saveIngredient({...e,packPrice:i})}},dismissAlert:i=>e(e=>({alerts:e.alerts.filter(e=>e.id!==i)}))}),{name:'covercharge-gpcalc-v1',storage:(0,o.createJSONStorage)(()=>c.default),version:4,migrate:async(e,t)=>(i.LIVE_VENUE_BUILD&&e&&(await(0,s.archiveChefCache)('gpcalc',e),e={...e,...y({...e,dishes:e.dishes||[],ingredients:e.ingredients||[]})}),t<2&&e&&(e.ingredients=(e.ingredients??[]).map(e=>e.prices?.length?e:{...e,prices:[{p:e.packPrice,at:(new Date).toISOString()}]}),e.settings={priceBasis:'latest',avgOf:5,...e.settings??{}}),e)}))},1148,[833,30,1132,5,1116,952,1117,1149]); +__d(function(g,r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DISH_CATEGORIES",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"pricesOf",{enumerable:!0,get:function(){return n}}),e.priceStats=i,Object.defineProperty(e,"costingPrice",{enumerable:!0,get:function(){return c}}),e.avgMenuPrice=function(t,n,i){const c=t.filter(t=>t.category===n&&t.menuPrice&&t.id!==i).map(t=>t.menuPrice);return c.length?{avg:Math.round(c.reduce((t,n)=>t+n,0)/c.length),count:c.length}:null},Object.defineProperty(e,"unitsFor",{enumerable:!0,get:function(){return a}}),e.lineCost=s,Object.defineProperty(e,"portionCost",{enumerable:!0,get:function(){return u}}),e.suggestAllergens=function t(n,i,c=[],o=0){const a=new Set;for(const s of n.lines)if(s.ingId.startsWith('dish:')){const n=c.find(t=>t.id===s.ingId.slice(5));n&&o<4&&((n.allergens??[]).forEach(t=>a.add(t)),t(n,i,c,o+1).forEach(t=>a.add(t)))}else i.find(t=>t.id===s.ingId)?.allergens?.forEach(t=>a.add(t));return[...a]},Object.defineProperty(e,"exVat",{enumerable:!0,get:function(){return d}}),e.gpOf=function(t,n,i){const c=d(n,i);return{ex:c,gpPct:c>0?(c-t)/c*100:0,cashGp:c-t,foodCostPct:c>0?t/c*100:0}},e.toPricePoint=f,e.suggestPrice=function(t,n,i,c){const o=Math.min(95,Math.max(0,n)),a=t/(1-o/100)*(1+i/100);return c?f(Math.ceil(a)):Math.ceil(a)},Object.defineProperty(e,"toneFor",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"money",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"pct",{enumerable:!0,get:function(){return p}}),e.multipleOf=function(t,n,i,c="inc"){return t<=0?0:('inc'===c?n:d(n,i))/t},Object.defineProperty(e,"fmtX",{enumerable:!0,get:function(){return h}}),e.suggestForMultiple=function(t,n,i,c,o){const a=t*Math.max(0,n)*('ex'===c?1+i/100:1);return o?f(Math.ceil(a)):Math.ceil(a)};const t=['Starters','Mains','From the Grill','Sides','Desserts','Specials','Kids','Sauces & extras'],n=t=>t.prices?.length?t.prices:[{p:t.packPrice,at:''}];function i(t,i=5){const c=n(t),o=c.slice(-Math.max(1,i)),a=Math.round(o.reduce((t,n)=>t+n.p,0)/o.length);return{latest:c[c.length-1].p,avg:a,count:o.length,min:Math.min(...o.map(t=>t.p)),max:Math.max(...o.map(t=>t.p))}}const c=(t,n="latest",c=5)=>'average'===n?i(t,c).avg:i(t,c).latest;const o={kg:{dim:'mass',f:1e3},g:{dim:'mass',f:1},L:{dim:'vol',f:1e3},ml:{dim:'vol',f:1},each:{dim:'each',f:1}},a=t=>'mass'===o[t].dim?['g','kg']:'vol'===o[t].dim?['ml','L']:['each'];function s(t,n,i=[],c=0){if(t.ingId.startsWith('dish:')){const o=i.find(n=>n.id===t.ingId.slice(5));return o&&c<4?u(o,n,i,c+1)*t.qty:0}const a=n.find(n=>n.id===t.ingId);if(!a||!a.packSize)return 0;const s=o[a.packUnit],d=o[t.unit];if(!d||s.dim!==d.dim)return 0;const f=a.packPrice/(a.packSize*s.f),l=Math.min(95,Math.max(0,t.wastePct??a.wastePct??0));return t.qty*d.f*f/(1-l/100)}const u=(t,n,i=[],c=0)=>t.lines.reduce((t,o)=>t+s(o,n,i,c),0)/Math.max(1,t.portions||1);const d=(t,n)=>t/(1+n/100);function f(t){const n=Math.floor(t/100),i=t-100*n;return i<=50?100*n+50:i<=95?100*n+95:100*(n+1)+50}const l=(t,n)=>t>=n-.05?'ok':t>=n-5?'amber':'red',m=t=>`\xa3${(Math.round(t)/100).toFixed(2)}`,p=t=>`${t.toFixed(1)}%`;const h=t=>`${t.toFixed(1)}x`},1149,[]); +__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.inviteFromLocation=function(n,t){const o=new URLSearchParams(n).get('invite');if(o)return o;const s=(t||'').match(/[#&]invite=([A-Za-z0-9_-]{10,})/);return s?s[1]:null},e.addressWithoutInvite=function(n){try{const t=new URL(n);t.searchParams.delete('invite');const o=t.hash.replace(/^#/,'').split('&').filter(n=>n&&!n.startsWith('invite=')).join('&');return t.hash=o?`#${o}`:'',t.toString()}catch{return n}},e.inviteRefusal=function(n){return/already been used/i.test(n)?'This link has already been used on another device. Ask your manager for a new one.':/expired/i.test(n)?'This link has expired. Ask your manager for a new one.':/replaced|switched off|not valid|invalid|unknown invite/i.test(n)?'This link has been replaced or switched off. Ask your manager for a new one.':/personal app link is incomplete/i.test(n)?'Open the complete personal iPhone link your manager sent.':/no longer active/i.test(n)?'This person is no longer on the team. Ask your manager if this is wrong.':null},Object.defineProperty(e,"WIPE_PREFIXES",{enumerable:!0,get:function(){return n}}),e.keysToWipe=function(t){return t.filter(t=>n.some(n=>t.startsWith(n)))};const n=['covercharge-','cc-sync:','cc-','sb-']},1150,[]); +__d(function(g,r,_i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"hrRemote",{enumerable:!0,get:function(){return y}}),_e.exampleHr=f,_e.stripHrSamples=m,Object.defineProperty(_e,"useHr",{enumerable:!0,get:function(){return q}});var e,t=r(_d[0]),s=r(_d[1]),n=r(_d[2]),o=r(_d[3]),i=r(_d[4]),u=(e=i)&&e.__esModule?e:{default:e},d=r(_d[5]),l=r(_d[6]),c=r(_d[7]),h=r(_d[8]);const y={live:!1,checkout:null,post:null,vote:null,moderate:null,reply:null,trend:null,shouts:null,log:null,refresh:null},v=(e,t,s)=>(0,c.oneWayToken)(e,`shift:${t}:${s}`),p=(e,t)=>{const s=new Date(`${e}T12:00:00Z`);return s.setUTCDate(s.getUTCDate()+t),s.toISOString().slice(0,10)};function f(e,t){const s=[];for(let n=14;n>=1;n--){const o=p(t,-n),i=4===n?2:4+7*n%4;for(let t=0;t!((0,s.isAnchorage)(e.venue)&&e.example)),questions:e.questions.filter(e=>!((0,s.isAnchorage)(e.venue)&&/^hrq-ex-[123]$/.test(e.id))),shouts:e.shouts.filter(e=>!((0,s.isAnchorage)(e.venue)&&/^hrs-ex-[123]$/.test(e.id)))}}const q=(0,d.create)()((0,l.persist)((e,t)=>({secret:(0,c.newSecret)(),answered:[],voted:{},checkins:[],questions:[],shouts:[],log:[],seeded:{},ensure:(s,i)=>{if(n.LIVE_VENUE_BUILD||o.IS_ISOLATED_VENUE||['souters','kirkmichael','wildings'].includes(s)||t().seeded[s]||y.live)return;const u=f(s,i);e(e=>({seeded:{...e.seeded,[s]:!0},checkins:[...e.checkins,...u.checkins],questions:[...e.questions,...u.questions],shouts:[...e.shouts,...u.shouts]}))},hasAnswered:(e,s)=>t().answered.includes(v(t().secret,e,s)),submit:s=>{const n=t(),o=v(n.secret,s.rid,s.shiftKey);if(n.answered.includes(o))return'already';const i=(0,c.checkInPayload)({venue:s.rid,day:s.day,token:o,morale:s.morale,staffing:s.staffing}),u=s.question?(0,c.cleanQuestion)(s.question):null,d=s.shoutTo?.trim().slice(0,80)||void 0,l=s.shoutBody?.trim().slice(0,280)||void 0;return e({answered:[...n.answered,o].slice(-300)}),y.live&&y.checkout?(y.checkout({rid:s.rid,shiftKey:'',day:i.day,morale:i.morale,staffing:i.staffing,question:u??void 0,kind:s.kind??'up',shoutTo:d,shoutBody:l,token:o}),'queued'):(e(e=>({checkins:[...e.checkins,{venue:i.venue,day:i.day,morale:i.morale,staffing:i.staffing}],questions:u?[...e.questions,{id:(0,h.uuid)(),venue:s.rid,body:u,kind:s.kind??'up',up:0,yes:0,no:0,hidden:!1,postedOn:s.day}]:e.questions,shouts:d?[...e.shouts,{id:(0,h.uuid)(),venue:s.rid,day:s.day,to:d,body:l}]:e.shouts})),'ok')},skip:(s,n)=>{const o=t(),i=v(o.secret,s,n);o.answered.includes(i)||e({answered:[...o.answered,i].slice(-300)})},post:(t,s,n,o)=>{const i=(0,c.cleanQuestion)(s);if(!i)return null;const u=(0,h.uuid)();return e(e=>({questions:[...e.questions,{id:u,venue:t,body:i,kind:n,up:0,yes:0,no:0,hidden:!1,postedOn:o}]})),y.live&&y.post&&y.post(t,u,i,n),u},vote:(s,n)=>{const o=t();if(o.voted[s])return!1;const i=o.questions.find(e=>e.id===s);if(!i||i.hidden)return!1;const u='up'===i.kind?1:n;return e({voted:{...o.voted,[s]:u},questions:o.questions.map(e=>e.id===s?(0,c.applyVote)(e,u):e)}),y.live&&y.vote&&y.vote(s,(0,c.oneWayToken)(o.secret,`vote:${s}`),u),!0},moderate:(s,n,o,i)=>{const u=t().questions.find(e=>e.id===s);u&&(e(e=>({questions:e.questions.map(e=>e.id===s?{...e,hidden:'hide'===n}:e),log:[{id:(0,h.uuid)(),venue:u.venue,questionId:s,action:n,reason:o.trim()||void 0,by:i,at:(new Date).toISOString()},...e.log].slice(0,500)})),y.live&&y.moderate&&y.moderate(s,n,o.trim()))},reply:(s,n,o)=>{const i=n.trim().slice(0,600),u=t().questions.find(e=>e.id===s);if(!u)return;const d=(new Date).toISOString();e(e=>({questions:e.questions.map(e=>e.id===s?{...e,reply:i||void 0,replyAt:i?d:void 0}:e),log:[{id:(0,h.uuid)(),venue:u.venue,questionId:s,action:'reply',by:o,at:d},...e.log].slice(0,500)})),y.live&&y.reply&&y.reply(s,i)},setRemoteBoard:(t,s)=>e(e=>({questions:[...e.questions.filter(e=>e.venue!==t),...s]})),upsertRemote:t=>e(e=>({questions:e.questions.some(e=>e.id===t.id)?e.questions.map(e=>e.id===t.id?t:e):[...e.questions,t]}))}),{name:'covercharge-hr-v1',version:3,storage:(0,l.createJSONStorage)(()=>u.default),migrate:async e=>n.LIVE_VENUE_BUILD&&e?(await(0,t.archiveChefCache)('hr',e),{...e,...m(e)}):e}))},1151,[1132,1025,833,5,1116,952,1117,1152,1034]); +__d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"MIN_ANSWERS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"DEFAULT_WORDING",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"DEFAULT_HR",{enumerable:!0,get:function(){return r}}),e.hrSettingsOf=function(t){const n=t??{},r=n.wording??{},s=Object.fromEntries(Object.entries(o).map(([t,n])=>[t,a(r[t],'intro'===t||'staffing'===t||'question'===t?160:60,n)]));return{on:!1!==n.on,askQuestion:!1!==n.askQuestion,askShout:!1!==n.askShout,board:!1!==n.board,wording:s}},Object.defineProperty(e,"MORALE_STEPS",{enumerable:!0,get:function(){return s}}),e.moraleWord=function(t,n=o){return t<=1?n.moraleLow:t>=5?n.moraleHigh:2===t?'Fairly low':3===t?'OK':'Good'},Object.defineProperty(e,"STAFF_STOPS",{enumerable:!0,get:function(){return u}}),e.snapStaffing=i,e.staffingWord=function(t,n=o){const r=i(t);return r<=12?n.staffLow:r<45?"A bit short":r<=55?n.staffMid:r<88?"A bit over":n.staffHigh},e.oneWayToken=function(n,o){return(0,t.sha256HexSync)(`cc-hr:${n}:${o}`).slice(0,40)},e.newSecret=function(){let t='';const n=globalThis.crypto;if(n?.getRandomValues){return n.getRandomValues(new Uint8Array(24)).forEach(n=>{t+=n.toString(16).padStart(2,'0')}),t}for(let n=0;n<48;n++)t+=Math.floor(16*Math.random()).toString(16);return t},e.checkInPayload=function(t){const n=Math.max(1,Math.min(5,Math.round(t.morale)));return{venue:t.venue,day:t.day,token:t.token,morale:n,staffing:null==t.staffing?null:i(t.staffing)}},e.dayResults=function(t,o=n){const r=new Map;for(const n of t){const t=r.get(n.day)??[];t.push(n),r.set(n.day,t)}const a=[];let s=0;for(const[t,n]of[...r.entries()].sort(([t],[n])=>t.localeCompare(n))){if(n.lengtht.staffing).filter(t=>null!=t);a.push({day:t,answers:n.length,morale:Math.round(n.reduce((t,n)=>t+n.morale,0)/n.length*10)/10,staffing:r.length?Math.round(r.reduce((t,n)=>t+n,0)/r.length):null,short:r.filter(t=>t<45).length,perfect:r.filter(t=>t>=45&&t<=55).length,over:r.filter(t=>t>55).length})}return{shown:a,held:s}},Object.defineProperty(e,"QUESTION_MAX",{enumerable:!0,get:function(){return f}}),e.cleanQuestion=function(t){const n=t.replace(/\s+/g,' ').trim().slice(0,f);return n.length>=3?n:null},e.boardOrder=function(t,n){const o=t=>'up'===t.kind?t.up:t.yes+t.no;return t.filter(t=>n||!t.hidden).sort((t,n)=>Number(t.hidden)-Number(n.hidden)||o(n)-o(t)||n.postedOn.localeCompare(t.postedOn)||t.id.localeCompare(n.id))},e.applyVote=function(t,n){return'up'===t.kind?{...t,up:t.up+1}:1===n?{...t,yes:t.yes+1}:{...t,no:t.no+1}};var t=_r(d[0]);const n=3,o={intro:'Before you go: 3 quick taps, about 15 seconds. Your name is never saved with your answers.',morale:'How was team morale today?',moraleLow:'Low',moraleHigh:'High',staffing:'Was there enough staff on today for the number of customers?',staffLow:'Not enough',staffMid:'Perfect',staffHigh:'Overstaffed',question:'Got a question you\u2019d like to post anonymously for the team to vote on?',shout:'Shout out a teammate?'},r={on:!0,askQuestion:!0,askShout:!0,board:!0,wording:o},a=(t,n,o)=>('string'==typeof t?t.trim().slice(0,n):'')||o;const s=[1,2,3,4,5];const u=[0,12.5,25,37.5,50,62.5,75,87.5,100].map(t=>Math.round(t));function i(t){const n=Math.max(0,Math.min(100,Number.isFinite(t)?t:50));return u.reduce((t,o)=>Math.abs(o-n)>>0;o.push(c>>>24&255,c>>>16&255,c>>>8&255,255&c,h>>>24&255,h>>>16&255,h>>>8&255,255&h);const l=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),u=new Uint32Array(64),f=(t,n)=>t>>>n|t<<32-n;for(let n=0;n>>3,e=f(u[t-2],17)^f(u[t-2],19)^u[t-2]>>>10;u[t]=u[t-16]+n+u[t-7]+e>>>0}let e=l[0],s=l[1],c=l[2],h=l[3],a=l[4],i=l[5],p=l[6],d=l[7];for(let n=0;n<64;n++){const o=d+(f(a,6)^f(a,11)^f(a,25))+(a&i^~a&p)+t[n]+u[n]>>>0,l=(f(e,2)^f(e,13)^f(e,22))+(e&s^e&c^s&c)>>>0;d=p,p=i,i=a,a=h+o>>>0,h=c,c=s,s=e,e=o+l>>>0}l[0]=l[0]+e>>>0,l[1]=l[1]+s>>>0,l[2]=l[2]+c>>>0,l[3]=l[3]+h>>>0,l[4]=l[4]+a>>>0,l[5]=l[5]+i>>>0,l[6]=l[6]+p>>>0,l[7]=l[7]+d>>>0}return Array.from(l).map(t=>t.toString(16).padStart(8,'0')).join('')};const t=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function n(t){const n=[];for(let e=0;e=55296&&o<=56319&&e+1=56320&&n<=57343&&(o=65536+(o-55296<<10)+(n-56320),e++)}o<128?n.push(o):o<2048?n.push(192|o>>6,128|63&o):o<65536?n.push(224|o>>12,128|o>>6&63,128|63&o):n.push(240|o>>18,128|o>>12&63,128|o>>6&63,128|63&o)}return n}},1153,[]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"FunctionRegion",{enumerable:!0,get:function(){return e.FunctionRegion}}),Object.defineProperty(_e,"FunctionsError",{enumerable:!0,get:function(){return e.FunctionsError}}),Object.defineProperty(_e,"FunctionsFetchError",{enumerable:!0,get:function(){return e.FunctionsFetchError}}),Object.defineProperty(_e,"FunctionsHttpError",{enumerable:!0,get:function(){return e.FunctionsHttpError}}),Object.defineProperty(_e,"FunctionsRelayError",{enumerable:!0,get:function(){return e.FunctionsRelayError}}),Object.defineProperty(_e,"PostgrestError",{enumerable:!0,get:function(){return t.PostgrestError}}),Object.defineProperty(_e,"StorageApiError",{enumerable:!0,get:function(){return r.StorageApiError}}),Object.defineProperty(_e,"SupabaseClient",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"createClient",{enumerable:!0,get:function(){return N}});var e=_r(d[0]),t=_r(d[1]),n=_r(d[2]);Object.keys(n).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return n[e]}})});var r=_r(d[3]),s=_r(d[4]);Object.keys(s).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return s[e]}})});let o,i="";var c;if("undefined"!=typeof Deno)i="deno",o=null===(c=Deno.version)||void 0===c?void 0:c.deno;else if("undefined"!=typeof document)i="web";else if("undefined"!=typeof navigator&&"ReactNative"===navigator.product)i="react-native";else{var u;i="node",o="undefined"!=typeof process?null===(u=process.version)||void 0===u?void 0:u.replace(/^v/,""):void 0}const l=[`runtime=${i}`];o&&l.push(`runtime-version=${o}`);const h={headers:{"X-Client-Info":`supabase-js/2.109.0; ${l.join("; ")}`}},f={schema:"public"},p={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},b={},v={enabled:!1,respectSamplingDecision:!0};let y=null;function w(){return e=this,t=void 0,r=function*(){try{const e=yield(null===y&&(y=import("@opentelemetry/api").catch(()=>null)),y);if(!e||!e.propagation||!e.context)return null;const t={};e.propagation.inject(e.context.active(),t);const n=t.traceparent;return n?{traceparent:n,tracestate:t.tracestate,baggage:t.baggage}:null}catch(e){return null}},new((n=void 0)||(n=Promise))(function(s,o){function i(e){try{u(r.next(e))}catch(e){o(e)}}function c(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(i,c)}u((r=r.apply(e,t||[])).next())});var e,t,n,r}function k(e){if(!e||"string"!=typeof e)return null;const t=e.split("-");if(4!==t.length)return null;const[n,r,s,o]=t;if(2!==n.length||32!==r.length||16!==s.length||2!==o.length)return null;const i=/^[0-9a-f]+$/i;return i.test(n)&&i.test(r)&&i.test(s)&&i.test(o)?"00000000000000000000000000000000"===r||"0000000000000000"===s?null:{version:n,traceId:r,parentId:s,traceFlags:o,isSampled:!(1&~parseInt(o,16))}:null}function O(e,t){if(!e||!t||0===t.length)return!1;let n;if(e instanceof URL)n=e;else try{n=new URL(e)}catch(e){return!1}for(const e of t)try{if("string"==typeof e){if(T(n.hostname,e))return!0}else if(e instanceof RegExp){if(e.test(n.hostname))return!0}else if("function"==typeof e&&e(n))return!0}catch(e){continue}return!1}function T(e,t){if(t===e)return!0;if(t.startsWith("*.")){const n=t.slice(2);if(e.endsWith(n)&&(e===n||e.endsWith("."+n)))return!0}return!1}function P(e){const t=[];try{const n=new URL(e);t.push(n.hostname)}catch(e){}return t.push("*.supabase.co","*.supabase.in"),t.push("localhost","127.0.0.1","[::1]"),t}function S(e){return(S="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function j(e,t){if("object"!=S(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=S(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function E(e){var t=j(e,"string");return"symbol"==S(t)?t:t+""}function U(e,t,n){return(t=E(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function A(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function R(e){for(var t=1;te?(...t)=>e(...t):(...e)=>fetch(...e),F=(e,t,n,r,s)=>{const o=C(r),i=Headers,c=!0===(null==s?void 0:s.enabled),u=!1!==(null==s?void 0:s.respectSamplingDecision),l=c?P(t):null;return async(t,r)=>{var s;const c=null!==(s=await n())&&void 0!==s?s:e;let h=new i(null==r?void 0:r.headers);if(h.has("apikey")||h.set("apikey",e),h.has("Authorization")||h.set("Authorization",`Bearer ${c}`),l){const e=await _(t,l,u);e&&(e.traceparent&&!h.has("traceparent")&&h.set("traceparent",e.traceparent),e.tracestate&&!h.has("tracestate")&&h.set("tracestate",e.tracestate),e.baggage&&!h.has("baggage")&&h.set("baggage",e.baggage))}return o(t,R(R({},r),{},{headers:h}))}};async function _(e,t,n){if(!O("string"==typeof e||e instanceof URL?e:e.url,t))return null;const r=await w();if(!r||!r.traceparent)return null;if(n){const e=k(r.traceparent);if(e&&!e.isSampled)return null}return r}function L(e){return"boolean"==typeof e?{enabled:e}:e}function I(e,t){var n,r,s,o,i,c;const{db:u,auth:l,realtime:h,global:f}=e,{db:p,auth:b,realtime:v,global:y}=t,w=L(e.tracePropagation),k=L(t.tracePropagation),O={db:R(R({},p),u),auth:R(R({},b),l),realtime:R(R({},v),h),storage:{},global:R(R(R({},y),f),{},{headers:R(R({},null!==(n=null==y?void 0:y.headers)&&void 0!==n?n:{}),null!==(r=null==f?void 0:f.headers)&&void 0!==r?r:{})}),tracePropagation:{enabled:null!==(s=null!==(o=null==w?void 0:w.enabled)&&void 0!==o?o:null==k?void 0:k.enabled)&&void 0!==s&&s,respectSamplingDecision:null===(i=null!==(c=null==w?void 0:w.respectSamplingDecision)&&void 0!==c?c:null==k?void 0:k.respectSamplingDecision)||void 0===i||i},accessToken:async()=>""};return e.accessToken?O.accessToken=e.accessToken:delete O.accessToken,O}function D(e){const t=null==e?void 0:e.trim();if(!t)throw new Error("supabaseUrl is required.");if(!t.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL((n=t).endsWith("/")?n:n+"/")}catch(e){throw Error("Invalid supabaseUrl: Provided URL is malformed.")}var n}var K=class extends s.AuthClient{constructor(e){super(e)}},x=class{constructor(e,n,s){var o,i;this.supabaseUrl=e,this.supabaseKey=n;const c=D(e);if(!n)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",c),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",c),this.storageUrl=new URL("storage/v1",c),this.functionsUrl=new URL("functions/v1",c);const u=`sb-${c.hostname.split(".")[0]}-auth-token`,l=I(null!=s?s:{},{db:f,realtime:b,auth:R(R({},p),{},{storageKey:u}),global:h,tracePropagation:v});var y;(this.settings=l,this.storageKey=null!==(o=l.auth.storageKey)&&void 0!==o?o:"",this.headers=null!==(i=l.global.headers)&&void 0!==i?i:{},l.accessToken)?(this.accessToken=l.accessToken,this.auth=new Proxy({},{get:(e,t)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(t)} is not possible`)}})):this.auth=this._initSupabaseAuthClient(null!==(y=l.auth)&&void 0!==y?y:{},this.headers,l.global.fetch);this.fetch=F(n,e,this._getAccessToken.bind(this),l.global.fetch,l.tracePropagation),this.realtime=this._initRealtimeClient(R({headers:this.headers,accessToken:this._getAccessToken.bind(this),fetch:this.fetch},l.realtime)),this.accessToken&&Promise.resolve(this.accessToken()).then(e=>this.realtime.setAuth(e)).catch(e=>console.warn("Failed to set initial Realtime auth token:",e)),this.rest=new t.PostgrestClient(new URL("rest/v1",c).href,{headers:this.headers,schema:l.db.schema,fetch:this.fetch,timeout:l.db.timeout,urlLengthLimit:l.db.urlLengthLimit}),this.storage=new r.StorageClient(this.storageUrl.href,this.headers,this.fetch,null==s?void 0:s.storage),l.accessToken||this._listenForAuthEvents()}get functions(){return new e.FunctionsClient(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e,t={},n={head:!1,get:!1,count:void 0}){return this.rest.rpc(e,t,n)}channel(e,t={config:{}}){return this.realtime.channel(e,t)}getChannels(){return this.realtime.getChannels()}removeChannel(e){return this.realtime.removeChannel(e)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var e,t,n=this;if(n.accessToken)return await n.accessToken();const{data:r}=await n.auth.getSession();return null!==(e=null===(t=r.session)||void 0===t?void 0:t.access_token)&&void 0!==e?e:n.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:t,detectSessionInUrl:n,storage:r,userStorage:s,storageKey:o,flowType:i,lock:c,debug:u,throwOnError:l,experimental:h,lockAcquireTimeout:f,skipAutoInitialize:p},b,v){const y={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new K({url:this.authUrl.href,headers:R(R({},y),b),storageKey:o,autoRefreshToken:e,persistSession:t,detectSessionInUrl:n,storage:r,userStorage:s,flowType:i,lock:c,debug:u,throwOnError:l,experimental:h,fetch:v,lockAcquireTimeout:f,skipAutoInitialize:p,hasCustomAuthorizationHeader:Object.keys(this.headers).some(e=>"authorization"===e.toLowerCase())})}_initRealtimeClient(e){return new n.RealtimeClient(this.realtimeUrl.href,R(R({},e),{},{params:R(R({},{apikey:this.supabaseKey}),null==e?void 0:e.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((e,t)=>{this._handleTokenChanged(e,"CLIENT",null==t?void 0:t.access_token)})}_handleTokenChanged(e,t,n){"TOKEN_REFRESHED"!==e&&"SIGNED_IN"!==e||this.changedAccessToken===n?"SIGNED_OUT"===e&&(this.realtime.setAuth(),"STORAGE"==t&&this.auth.signOut(),this.changedAccessToken=void 0):(this.changedAccessToken=n,this.realtime.setAuth(n))}};const N=(e,t,n)=>new x(e,t,n);(function(){if("undefined"!=typeof window)return!1;const e=globalThis.process;if(!e)return!1;const t=e.version;if(null==t)return!1;const n=t.match(/^v(\d+)\./);return!!n&&parseInt(n[1],10)<=18})()&&console.warn("\u26a0\ufe0f Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217")},1154,[1155,1160,1161,1176,1178]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"FunctionsClient",{enumerable:!0,get:function(){return n.FunctionsClient}}),Object.defineProperty(e,"FunctionsError",{enumerable:!0,get:function(){return t.FunctionsError}}),Object.defineProperty(e,"FunctionsFetchError",{enumerable:!0,get:function(){return t.FunctionsFetchError}}),Object.defineProperty(e,"FunctionsHttpError",{enumerable:!0,get:function(){return t.FunctionsHttpError}}),Object.defineProperty(e,"FunctionsRelayError",{enumerable:!0,get:function(){return t.FunctionsRelayError}}),Object.defineProperty(e,"FunctionRegion",{enumerable:!0,get:function(){return t.FunctionRegion}});var n=r(d[0]),t=r(d[1])},1155,[1156,1159]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"FunctionsClient",{enumerable:!0,get:function(){return s}});var t=r(d[0]),n=r(d[1]),o=r(d[2]);class s{constructor(t,{headers:s={},customFetch:c,region:l=o.FunctionRegion.Any}={}){this.url=t,this.headers=s,this.region=l,this.fetch=(0,n.resolveFetch)(c)}setAuth(t){this.headers.Authorization=`Bearer ${t}`}invoke(n){return(0,t.__awaiter)(this,arguments,void 0,function*(t,n={}){var s;let c,l;try{const{headers:u,method:f,body:h,signal:p,timeout:y}=n;let b={},{region:F}=n;F||(F=this.region);const v=new URL(`${this.url}/${t}`);let w;F&&'any'!==F&&(b['x-region']=F,v.searchParams.set('forceFunctionRegion',F));const j=!!u&&Object.keys(u).some(t=>'content-type'===t.toLowerCase());h&&!j?'undefined'!=typeof Blob&&h instanceof Blob||h instanceof ArrayBuffer?(b['Content-Type']='application/octet-stream',w=h):'string'==typeof h?(b['Content-Type']='text/plain',w=h):'undefined'!=typeof FormData&&h instanceof FormData?w=h:(b['Content-Type']='application/json',w=JSON.stringify(h)):w=!h||'string'==typeof h||'undefined'!=typeof Blob&&h instanceof Blob||h instanceof ArrayBuffer||'undefined'!=typeof FormData&&h instanceof FormData?h:JSON.stringify(h);let O=p;y&&(l=new AbortController,c=setTimeout(()=>l.abort(),y),p?(O=l.signal,p.addEventListener('abort',()=>l.abort())):O=l.signal);const x=yield this.fetch(v.toString(),{method:f||'POST',headers:Object.assign(Object.assign(Object.assign({},b),this.headers),u),body:w,signal:O}).catch(t=>{throw new o.FunctionsFetchError(t)}),B=x.headers.get('x-relay-error');if(B&&'true'===B)throw new o.FunctionsRelayError(x);if(!x.ok)throw new o.FunctionsHttpError(x);let C,T=(null!==(s=x.headers.get('Content-Type'))&&void 0!==s?s:'text/plain').split(';')[0].trim();return C='application/json'===T?yield x.json():'application/octet-stream'===T||'application/pdf'===T?yield x.blob():'text/event-stream'===T?x:'multipart/form-data'===T?yield x.formData():yield x.text(),{data:C,error:null,response:x}}catch(t){return{data:null,error:t,response:t instanceof o.FunctionsHttpError||t instanceof o.FunctionsRelayError?t.context:void 0}}finally{c&&clearTimeout(c)}})}}},1156,[1157,1158,1159]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return G}}),_e.__extends=t,Object.defineProperty(_e,"__assign",{enumerable:!0,get:function(){return r}}),_e.__rest=n,_e.__decorate=o,_e.__param=a,_e.__esDecorate=i,_e.__runInitializers=c,_e.__propKey=u,_e.__setFunctionName=s,_e.__metadata=f,_e.__awaiter=l,_e.__generator=p,Object.defineProperty(_e,"__createBinding",{enumerable:!0,get:function(){return y}}),_e.__exportStar=_,_e.__values=d,_e.__read=h,_e.__spread=b,_e.__spreadArrays=v,_e.__spreadArray=w,_e.__await=m,_e.__asyncGenerator=g,_e.__asyncDelegator=O,_e.__asyncValues=j,_e.__makeTemplateObject=P,_e.__importStar=x,_e.__importDefault=T,_e.__classPrivateFieldGet=I,_e.__classPrivateFieldSet=D,_e.__classPrivateFieldIn=R,_e.__addDisposableResource=k,_e.__disposeResources=F,_e.__rewriteRelativeImportExtension=C;var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};function t(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}var r=function(){return r=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=0;c--)(o=e[c])&&(i=(a<3?o(i):a>3?o(t,r,i):o(t,r))||i);return a>3&&i&&Object.defineProperty(t,r,i),i}function a(e,t){return function(r,n){t(r,n,e)}}function i(e,t,r,n,o,a){function i(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var c,u=n.kind,s="getter"===u?"get":"setter"===u?"set":"value",f=!t&&e?n.static?e:e.prototype:null,l=t||(f?Object.getOwnPropertyDescriptor(f,n.name):{}),p=!1,y=r.length-1;y>=0;y--){var _={};for(var d in n)_[d]="access"===d?{}:n[d];for(var d in n.access)_.access[d]=n.access[d];_.addInitializer=function(e){if(p)throw new TypeError("Cannot add initializers after decoration has completed");a.push(i(e||null))};var h=(0,r[y])("accessor"===u?{get:l.get,set:l.set}:l[s],_);if("accessor"===u){if(void 0===h)continue;if(null===h||"object"!=typeof h)throw new TypeError("Object expected");(c=i(h.get))&&(l.get=c),(c=i(h.set))&&(l.set=c),(c=i(h.init))&&o.unshift(c)}else(c=i(h))&&("field"===u?o.unshift(c):l[s]=c)}f&&Object.defineProperty(f,n.name,l),p=!0}function c(e,t,r){for(var n=arguments.length>2,o=0;o0&&o[o.length-1])||6!==c[0]&&2!==c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function h(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,a=r.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)i.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(o)throw o.error}}return i}function b(){for(var e=[],t=0;t1||c(e,t)})},t&&(n[e]=t(n[e])))}function c(e,t){try{(r=o[e](t)).value instanceof m?Promise.resolve(r.value.v).then(u,s):f(a[0][2],r)}catch(e){f(a[0][3],e)}var r}function u(e){c("next",e)}function s(e){c("throw",e)}function f(e,t){e(t),a.shift(),a.length&&c(a[0][0],a[0][1])}}function O(e){var t,r;return t={},n("next"),n("throw",function(e){throw e}),n("return"),t[Symbol.iterator]=function(){return this},t;function n(n,o){t[n]=e[n]?function(t){return(r=!r)?{value:m(e[n](t)),done:!1}:o?o(t):t}:o}}function j(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=d(e),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise(function(n,a){o(n,a,(t=e[r](t)).done,t.value)})}}function o(e,t,r,n){Promise.resolve(n).then(function(t){e({value:t,done:r})},t)}}function P(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var S=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t},E=function(e){return E=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t},E(e)};function x(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r=E(e),n=0;nt?(...n)=>t(...n):(...t)=>fetch(...t)},1158,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"FunctionsError",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"FunctionsFetchError",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"FunctionsRelayError",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"FunctionsHttpError",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"FunctionRegion",{enumerable:!0,get:function(){return u}});class t extends Error{constructor(t,n="FunctionsError",s){super(t),this.name=n,this.context=s}toJSON(){return{name:this.name,message:this.message,context:this.context}}}class n extends t{constructor(t){super('Failed to send a request to the Edge Function','FunctionsFetchError',t)}}class s extends t{constructor(t){super('Relay Error invoking the Edge Function','FunctionsRelayError',t)}}class o extends t{constructor(t){super('Edge Function returned a non-2xx status code','FunctionsHttpError',t)}}var u;!(function(t){t.Any="any",t.ApNortheast1="ap-northeast-1",t.ApNortheast2="ap-northeast-2",t.ApSouth1="ap-south-1",t.ApSoutheast1="ap-southeast-1",t.ApSoutheast2="ap-southeast-2",t.CaCentral1="ca-central-1",t.EuCentral1="eu-central-1",t.EuWest1="eu-west-1",t.EuWest2="eu-west-2",t.EuWest3="eu-west-3",t.SaEast1="sa-east-1",t.UsEast1="us-east-1",t.UsWest1="us-west-1",t.UsWest2="us-west-2"})(u||(u={}))},1159,[]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"PostgrestBuilder",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"PostgrestClient",{enumerable:!0,get:function(){return $}}),Object.defineProperty(_e,"PostgrestError",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"PostgrestFilterBuilder",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"PostgrestQueryBuilder",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"PostgrestTransformBuilder",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return w}});const e=e=>Math.min(1e3*2**e,3e4),t=[520,503],r=["GET","HEAD","OPTIONS"];var s=class extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.code=e.code}toJSON(){return{name:this.name,message:this.message,details:this.details,hint:this.hint,code:this.code}}};function n(e,t){return new Promise(r=>{if(null==t?void 0:t.aborted)return void r();const s=setTimeout(()=>{null==t||t.removeEventListener("abort",n),r()},e);function n(){clearTimeout(s),r()}null==t||t.addEventListener("abort",n)})}function i(e,s,n,i){return!(!i||n>=3)&&(!!r.includes(e)&&!!t.includes(s))}var l=class{constructor(e){var t,r,s,n,i;this.shouldThrowOnError=!1,this.retryEnabled=!0,this.method=e.method,this.url=e.url,this.headers=new Headers(e.headers),this.schema=e.schema,this.body=e.body,this.shouldThrowOnError=null!==(t=e.shouldThrowOnError)&&void 0!==t&&t,this.signal=e.signal,this.isMaybeSingle=null!==(r=e.isMaybeSingle)&&void 0!==r&&r,this.shouldStripNulls=null!==(s=e.shouldStripNulls)&&void 0!==s&&s,this.urlLengthLimit=null!==(n=e.urlLengthLimit)&&void 0!==n?n:8e3,this.retryEnabled=null===(i=e.retry)||void 0===i||i,e.fetch?this.fetch=e.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}stripNulls(){if("text/csv"===this.headers.get("Accept"))throw new Error("stripNulls() cannot be used with csv()");return this.shouldStripNulls=!0,this}setHeader(e,t){return this.headers=new Headers(this.headers),this.headers.set(e,t),this}retry(e){return this.retryEnabled=e,this}then(t,s){var l=this;if(void 0===this.schema||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),"GET"!==this.method&&"HEAD"!==this.method&&this.headers.set("Content-Type","application/json"),this.shouldStripNulls){const e=this.headers.get("Accept");"application/vnd.pgrst.object+json"===e?this.headers.set("Accept","application/vnd.pgrst.object+json;nulls=stripped"):e&&"application/json"!==e||this.headers.set("Accept","application/vnd.pgrst.array+json;nulls=stripped")}const o=this.fetch;let h=(async()=>{let t=0;for(;;){const u={};let c;l.headers.forEach((e,t)=>{u[t]=e}),t>0&&(u["X-Retry-Count"]=String(t));try{c=await o(l.url.toString(),{method:l.method,headers:u,body:JSON.stringify(l.body,(e,t)=>"bigint"==typeof t?t.toString():t),signal:l.signal})}catch(s){if("AbortError"===(null==s?void 0:s.name)||"ABORT_ERR"===(null==s?void 0:s.code))throw s;if(!r.includes(l.method))throw s;if(l.retryEnabled&&t<3){const r=e(t);t++,await n(r,l.signal);continue}throw s}if(i(l.method,c.status,t,l.retryEnabled)){var s,h;const r=null!==(s=null===(h=c.headers)||void 0===h?void 0:h.get("Retry-After"))&&void 0!==s?s:null,i=null!==r?1e3*Math.max(0,parseInt(r,10)||0):e(t);await c.text(),t++,await n(i,l.signal);continue}return await l.processResponse(c)}})();return this.shouldThrowOnError||(h=h.catch(e=>{var t;let r="",s="",n="";const i=null==e?void 0:e.cause;if(i){var l,o,h,u;const t=null!==(l=null==i?void 0:i.message)&&void 0!==l?l:"",s=null!==(o=null==i?void 0:i.code)&&void 0!==o?o:"";r=`${null!==(h=null==e?void 0:e.name)&&void 0!==h?h:"FetchError"}: ${null==e?void 0:e.message}`,r+=`\n\nCaused by: ${null!==(u=null==i?void 0:i.name)&&void 0!==u?u:"Error"}: ${t}`,s&&(r+=` (${s})`),(null==i?void 0:i.stack)&&(r+=`\n${i.stack}`)}else{var c;r=null!==(c=null==e?void 0:e.stack)&&void 0!==c?c:""}const p=this.url.toString().length;return"AbortError"===(null==e?void 0:e.name)||"ABORT_ERR"===(null==e?void 0:e.code)?(n="",s="Request was aborted (timeout or manual cancellation)",p>this.urlLengthLimit&&(s+=`. Note: Your request URL is ${p} characters, which may exceed server limits. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [many IDs])), consider using an RPC function to pass values server-side.`)):"HeadersOverflowError"!==(null==i?void 0:i.name)&&"UND_ERR_HEADERS_OVERFLOW"!==(null==i?void 0:i.code)||(n="",s="HTTP headers exceeded server limits (typically 16KB)",p>this.urlLengthLimit&&(s+=`. Your request URL is ${p} characters. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [200+ IDs])), consider using an RPC function instead.`)),{success:!1,error:{message:`${null!==(t=null==e?void 0:e.name)&&void 0!==t?t:"FetchError"}: ${null==e?void 0:e.message}`,details:r,hint:s,code:n},data:null,count:null,status:0,statusText:""}})),h.then(t,s)}async processResponse(e){var t=this;let r=null,n=null,i=null,l=e.status,o=e.statusText;if(e.ok){var h,u;if("HEAD"!==t.method){var c;const i=await e.text();if(""===i);else if("text/csv"===t.headers.get("Accept"))n=i;else if(t.headers.get("Accept")&&(null===(c=t.headers.get("Accept"))||void 0===c?void 0:c.includes("application/vnd.pgrst.plan+text")))n=i;else try{n=JSON.parse(i)}catch(e){if(r={message:i},n=null,t.shouldThrowOnError)throw new s({message:i,details:"",hint:"",code:""})}}const p=null===(h=t.headers.get("Prefer"))||void 0===h?void 0:h.match(/count=(exact|planned|estimated)/),f=null===(u=e.headers.get("content-range"))||void 0===u?void 0:u.split("/");p&&f&&f.length>1&&(i=parseInt(f[1])),t.isMaybeSingle&&Array.isArray(n)&&(n.length>1?(r={code:"PGRST116",details:`Results contain ${n.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},n=null,i=null,l=406,o="Not Acceptable"):n=1===n.length?n[0]:null)}else{const i=await e.text();try{r=JSON.parse(i),Array.isArray(r)&&404===e.status&&(n=[],r=null,l=200,o="OK")}catch(t){404===e.status&&""===i?(l=204,o="No Content"):r={message:i}}if(r&&t.shouldThrowOnError)throw new s(r)}return{success:null===r,error:r,data:n,count:i,status:l,statusText:o}}returns(){return this}overrideTypes(){return this}},o=class extends l{throwOnError(){return super.throwOnError()}select(e){let t=!1;const r=(null!=e?e:"*").split("").map(e=>/\s/.test(e)&&!t?"":("\""===e&&(t=!t),e)).join("");return this.url.searchParams.set("select",r),this.headers.append("Prefer","return=representation"),this}order(e,{ascending:t=!0,nullsFirst:r,foreignTable:s,referencedTable:n=s}={}){const i=n?`${n}.order`:"order",l=this.url.searchParams.get(i);return this.url.searchParams.set(i,`${l?`${l},`:""}${e}.${t?"asc":"desc"}${void 0===r?"":r?".nullsfirst":".nullslast"}`),this}limit(e,{foreignTable:t,referencedTable:r=t}={}){const s=void 0===r?"limit":`${r}.limit`;return this.url.searchParams.set(s,`${e}`),this}range(e,t,{foreignTable:r,referencedTable:s=r}={}){const n=void 0===s?"offset":`${s}.offset`,i=void 0===s?"limit":`${s}.limit`;return this.url.searchParams.set(n,`${e}`),this.url.searchParams.set(i,""+(t-e+1)),this}abortSignal(e){return this.signal=e,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:e=!1,verbose:t=!1,settings:r=!1,buffers:s=!1,wal:n=!1,format:i="text"}={}){var l;const o=[e?"analyze":null,t?"verbose":null,r?"settings":null,s?"buffers":null,n?"wal":null].filter(Boolean).join("|"),h=null!==(l=this.headers.get("Accept"))&&void 0!==l?l:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${i}; for="${h}"; options=${o};`),this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(e){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${e}`),this}};const h=new RegExp("[,()]");var u=class extends o{throwOnError(){return super.throwOnError()}eq(e,t){return this.url.searchParams.append(e,`eq.${t}`),this}neq(e,t){return this.url.searchParams.append(e,`neq.${t}`),this}gt(e,t){return this.url.searchParams.append(e,`gt.${t}`),this}gte(e,t){return this.url.searchParams.append(e,`gte.${t}`),this}lt(e,t){return this.url.searchParams.append(e,`lt.${t}`),this}lte(e,t){return this.url.searchParams.append(e,`lte.${t}`),this}like(e,t){return this.url.searchParams.append(e,`like.${t}`),this}likeAllOf(e,t){return this.url.searchParams.append(e,`like(all).{${t.join(",")}}`),this}likeAnyOf(e,t){return this.url.searchParams.append(e,`like(any).{${t.join(",")}}`),this}ilike(e,t){return this.url.searchParams.append(e,`ilike.${t}`),this}ilikeAllOf(e,t){return this.url.searchParams.append(e,`ilike(all).{${t.join(",")}}`),this}ilikeAnyOf(e,t){return this.url.searchParams.append(e,`ilike(any).{${t.join(",")}}`),this}regexMatch(e,t){return this.url.searchParams.append(e,`match.${t}`),this}regexIMatch(e,t){return this.url.searchParams.append(e,`imatch.${t}`),this}is(e,t){return this.url.searchParams.append(e,`is.${t}`),this}isDistinct(e,t){return this.url.searchParams.append(e,`isdistinct.${t}`),this}in(e,t){const r=Array.from(new Set(t)).map(e=>"string"==typeof e&&h.test(e)?`"${e}"`:`${e}`).join(",");return this.url.searchParams.append(e,`in.(${r})`),this}notIn(e,t){const r=Array.from(new Set(t)).map(e=>"string"==typeof e&&h.test(e)?`"${e}"`:`${e}`).join(",");return this.url.searchParams.append(e,`not.in.(${r})`),this}contains(e,t){return"string"==typeof t?this.url.searchParams.append(e,`cs.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cs.{${t.join(",")}}`):this.url.searchParams.append(e,`cs.${JSON.stringify(t)}`),this}containedBy(e,t){return"string"==typeof t?this.url.searchParams.append(e,`cd.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cd.{${t.join(",")}}`):this.url.searchParams.append(e,`cd.${JSON.stringify(t)}`),this}rangeGt(e,t){return this.url.searchParams.append(e,`sr.${t}`),this}rangeGte(e,t){return this.url.searchParams.append(e,`nxl.${t}`),this}rangeLt(e,t){return this.url.searchParams.append(e,`sl.${t}`),this}rangeLte(e,t){return this.url.searchParams.append(e,`nxr.${t}`),this}rangeAdjacent(e,t){return this.url.searchParams.append(e,`adj.${t}`),this}overlaps(e,t){return"string"==typeof t?this.url.searchParams.append(e,`ov.${t}`):this.url.searchParams.append(e,`ov.{${t.join(",")}}`),this}textSearch(e,t,{config:r,type:s}={}){let n="";"plain"===s?n="pl":"phrase"===s?n="ph":"websearch"===s&&(n="w");const i=void 0===r?"":`(${r})`;return this.url.searchParams.append(e,`${n}fts${i}.${t}`),this}match(e){return Object.entries(e).filter(([e,t])=>void 0!==t).forEach(([e,t])=>{this.url.searchParams.append(e,`eq.${t}`)}),this}not(e,t,r){return this.url.searchParams.append(e,`not.${t}.${r}`),this}or(e,{foreignTable:t,referencedTable:r=t}={}){const s=r?`${r}.or`:"or";return this.url.searchParams.append(s,`(${e})`),this}filter(e,t,r){return this.url.searchParams.append(e,`${t}.${r}`),this}},c=class{constructor(e,{headers:t={},schema:r,fetch:s,urlLengthLimit:n=8e3,retry:i}){this.url=e,this.headers=new Headers(t),this.schema=r,this.fetch=s,this.urlLengthLimit=n,this.retry=i}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(e,t){const{head:r=!1,count:s}=null!=t?t:{},n=r?"HEAD":"GET";let i=!1;const l=(null!=e?e:"*").split("").map(e=>/\s/.test(e)&&!i?"":("\""===e&&(i=!i),e)).join(""),{url:o,headers:h}=this.cloneRequestState();return o.searchParams.set("select",l),s&&h.append("Prefer",`count=${s}`),new u({method:n,url:o,headers:h,schema:this.schema,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}insert(e,{count:t,defaultToNull:r=!0}={}){var s;const{url:n,headers:i}=this.cloneRequestState();if(t&&i.append("Prefer",`count=${t}`),r||i.append("Prefer","missing=default"),Array.isArray(e)){const t=e.reduce((e,t)=>e.concat(Object.keys(t)),[]);if(t.length>0){const e=[...new Set(t)].map(e=>`"${e}"`);n.searchParams.set("columns",e.join(","))}}return new u({method:"POST",url:n,headers:i,schema:this.schema,body:e,fetch:null!==(s=this.fetch)&&void 0!==s?s:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}upsert(e,{onConflict:t,ignoreDuplicates:r=!1,count:s,defaultToNull:n=!0}={}){var i;const{url:l,headers:o}=this.cloneRequestState();if(o.append("Prefer",`resolution=${r?"ignore":"merge"}-duplicates`),void 0!==t&&l.searchParams.set("on_conflict",t),s&&o.append("Prefer",`count=${s}`),n||o.append("Prefer","missing=default"),Array.isArray(e)){const t=e.reduce((e,t)=>e.concat(Object.keys(t)),[]);if(t.length>0){const e=[...new Set(t)].map(e=>`"${e}"`);l.searchParams.set("columns",e.join(","))}}return new u({method:"POST",url:l,headers:o,schema:this.schema,body:e,fetch:null!==(i=this.fetch)&&void 0!==i?i:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}update(e,{count:t}={}){var r;const{url:s,headers:n}=this.cloneRequestState();return t&&n.append("Prefer",`count=${t}`),new u({method:"PATCH",url:s,headers:n,schema:this.schema,body:e,fetch:null!==(r=this.fetch)&&void 0!==r?r:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}delete({count:e}={}){var t;const{url:r,headers:s}=this.cloneRequestState();return e&&s.append("Prefer",`count=${e}`),new u({method:"DELETE",url:r,headers:s,schema:this.schema,fetch:null!==(t=this.fetch)&&void 0!==t?t:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};function p(e){return(p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function f(e,t){if("object"!=p(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var s=r.call(e,t||"default");if("object"!=p(s))return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function y(e){var t=f(e,"string");return"symbol"==p(t)?t:t+""}function v(e,t,r){return(t=y(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function b(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,s)}return r}function P(e){for(var t=1;t0?(e,t)=>{const r=new AbortController,s=setTimeout(()=>r.abort(),n),i=null==t?void 0:t.signal;if(i){if(i.aborted)return clearTimeout(s),o(e,t);const n=()=>{clearTimeout(s),r.abort()};return i.addEventListener("abort",n,{once:!0}),o(e,P(P({},t),{},{signal:r.signal})).finally(()=>{clearTimeout(s),i.removeEventListener("abort",n)})}return o(e,P(P({},t),{},{signal:r.signal})).finally(()=>clearTimeout(s))}:o,this.retry=l}from(e){if(!e||"string"!=typeof e||""===e.trim())throw new Error("Invalid relation name: relation must be a non-empty string.");return new c(new URL(`${this.url}/${e}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}schema(t){return new e(this.url,{headers:this.headers,schema:t,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}rpc(e,t={},{head:r=!1,get:s=!1,count:n}={}){var i;let l;const o=new URL(`${this.url}/rpc/${e}`);let h;const c=e=>null!==e&&"object"==typeof e&&(!Array.isArray(e)||e.some(c)),p=r&&Object.values(t).some(c);p?(l="POST",h=t):r||s?(l=r?"HEAD":"GET",Object.entries(t).filter(([e,t])=>void 0!==t).map(([e,t])=>[e,Array.isArray(t)?`{${t.join(",")}}`:`${t}`]).forEach(([e,t])=>{o.searchParams.append(e,t)})):(l="POST",h=t);const f=new Headers(this.headers);return p?f.set("Prefer",n?`count=${n},return=minimal`:"return=minimal"):n&&f.set("Prefer",`count=${n}`),new u({method:l,url:o,headers:f,schema:this.schemaName,body:h,fetch:null!==(i=this.fetch)&&void 0!==i?i:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}},w={PostgrestClient:$,PostgrestQueryBuilder:c,PostgrestFilterBuilder:u,PostgrestTransformBuilder:o,PostgrestBuilder:l,PostgrestError:s}},1160,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"RealtimePresence",{enumerable:!0,get:function(){return o.default}}),Object.defineProperty(_e,"RealtimeChannel",{enumerable:!0,get:function(){return E.default}}),Object.defineProperty(_e,"RealtimeClient",{enumerable:!0,get:function(){return t.default}}),Object.defineProperty(_e,"RealtimePostgresFilterBuilder",{enumerable:!0,get:function(){return n.RealtimePostgresFilterBuilder}}),Object.defineProperty(_e,"postgresChangesFilter",{enumerable:!0,get:function(){return n.postgresChangesFilter}}),Object.defineProperty(_e,"REALTIME_LISTEN_TYPES",{enumerable:!0,get:function(){return n.REALTIME_LISTEN_TYPES}}),Object.defineProperty(_e,"REALTIME_POSTGRES_CHANGES_LISTEN_EVENT",{enumerable:!0,get:function(){return n.REALTIME_POSTGRES_CHANGES_LISTEN_EVENT}}),Object.defineProperty(_e,"REALTIME_PRESENCE_LISTEN_EVENTS",{enumerable:!0,get:function(){return u.REALTIME_PRESENCE_LISTEN_EVENTS}}),Object.defineProperty(_e,"REALTIME_SUBSCRIBE_STATES",{enumerable:!0,get:function(){return n.REALTIME_SUBSCRIBE_STATES}}),Object.defineProperty(_e,"REALTIME_CHANNEL_STATES",{enumerable:!0,get:function(){return n.REALTIME_CHANNEL_STATES}}),Object.defineProperty(_e,"WebSocketFactory",{enumerable:!0,get:function(){return l.default}});var t=e(r(d[0])),n=r(d[1]),E=e(n),u=r(d[2]),o=e(u),l=e(r(d[3]))},1161,[1162,1168,1169,1163]); +__d(function(g,r,i,a,m,_e2,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"default",{enumerable:!0,get:function(){return f}});var t=e(r(d[0])),n=r(d[1]),s=e(r(d[2])),o=r(d[3]),c=e(r(d[4])),l=e(r(d[5]));const h=25e3,u=[1e3,2e3,5e3,1e4];function k(){const e=new Map;return{get length(){return e.size},clear(){e.clear()},getItem:t=>e.has(t)?e.get(t):null,key(t){var n;return null!==(n=Array.from(e.keys())[t])&&void 0!==n?n:null},removeItem(t){e.delete(t)},setItem(t,n){e.set(t,String(n))}}}function p(){try{if('undefined'!=typeof globalThis&&globalThis.sessionStorage)return globalThis.sessionStorage}catch(e){}return k()}class f{get endPoint(){return this.socketAdapter.endPoint}get timeout(){return this.socketAdapter.timeout}get transport(){return this.socketAdapter.transport}get heartbeatCallback(){return this.socketAdapter.heartbeatCallback}get heartbeatIntervalMs(){return this.socketAdapter.heartbeatIntervalMs}get heartbeatTimer(){return this.worker?this._workerHeartbeatTimer:this.socketAdapter.heartbeatTimer}get pendingHeartbeatRef(){return this.worker?this._pendingWorkerHeartbeatRef:this.socketAdapter.pendingHeartbeatRef}get reconnectTimer(){return this.socketAdapter.reconnectTimer}get vsn(){return this.socketAdapter.vsn}get encode(){return this.socketAdapter.encode}get decode(){return this.socketAdapter.decode}get reconnectAfterMs(){return this.socketAdapter.reconnectAfterMs}get sendBuffer(){return this.socketAdapter.sendBuffer}get stateChangeCallbacks(){return this.socketAdapter.stateChangeCallbacks}constructor(e,t){var n;if(this.channels=new Array,this.accessTokenValue=null,this.accessToken=null,this.apiKey=null,this.httpEndpoint='',this.headers={},this.params={},this.ref=0,this.serializer=new s.default,this._manuallySetToken=!1,this._authPromise=null,this._workerHeartbeatTimer=void 0,this._pendingWorkerHeartbeatRef=null,this._pendingDisconnectTimer=null,this._disconnectOnEmptyChannelsAfterMs=0,this._resolveFetch=e=>e?(...t)=>e(...t):(...e)=>fetch(...e),!(null===(n=null==t?void 0:t.params)||void 0===n?void 0:n.apikey))throw new Error('API key is required to connect to Realtime');this.apiKey=t.params.apikey;const c=this._initializeOptions(t);this.socketAdapter=new l.default(e,c),this.httpEndpoint=(0,o.httpEndpointURL)(e),this.fetch=this._resolveFetch(null==t?void 0:t.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.isConnected())){this.accessToken&&!this._authPromise&&this._setAuthSafely('connect'),this._setupConnectionHandlers();try{this.socketAdapter.connect()}catch(e){const t=e.message;if(t.includes('Node.js'))throw new Error(`${t}\n\nTo use Realtime in Node.js, you need to provide a WebSocket implementation:\n\nOption 1: Use Node.js 22+ which has native WebSocket support\nOption 2: Install and provide the "ws" package:\n\n npm install ws\n\n import ws from "ws"\n const client = new RealtimeClient(url, {\n ...options,\n transport: ws\n })`);throw new Error(`WebSocket not available: ${t}`)}this._handleNodeJsRaceCondition()}}endpointURL(){return this.socketAdapter.endPointURL()}async disconnect(e,t){return this._cancelPendingDisconnect(),this.isDisconnecting()?'ok':await this.socketAdapter.disconnect(()=>{clearInterval(this._workerHeartbeatTimer),this._terminateWorker()},e,t)}getChannels(){return this.channels}async removeChannel(e){const t=await e.unsubscribe();return'ok'===t&&e.teardown(),t}async removeAllChannels(){const e=this.channels.map(async e=>{const t=await e.unsubscribe();return e.teardown(),t}),t=await Promise.all(e);return await this.disconnect(),t}log(e,t,n){this.socketAdapter.log(e,t,n)}connectionState(){return this.socketAdapter.connectionState()||n.CONNECTION_STATE.closed}isConnected(){return this.socketAdapter.isConnected()}isConnecting(){return this.socketAdapter.isConnecting()}isDisconnecting(){return this.socketAdapter.isDisconnecting()}channel(e,t={config:{}}){const n=`realtime:${e}`,s=this.getChannels().find(e=>e.topic===n);if(s)return s;{const n=new c.default(`realtime:${e}`,t,this);return this._cancelPendingDisconnect(),this.channels.push(n),n}}push(e){this.socketAdapter.push(e)}async setAuth(e=null){this._authPromise=this._performAuth(e);try{await this._authPromise}finally{this._authPromise=null}}_isManualToken(){return this._manuallySetToken}async sendHeartbeat(){this.socketAdapter.sendHeartbeat()}onHeartbeat(e){this.socketAdapter.heartbeatCallback=this._wrapHeartbeatCallback(e)}_makeRef(){return this.socketAdapter.makeRef()}_remove(e){this.channels=this.channels.filter(t=>t.topic!==e.topic),0===this.channels.length&&(this.log('transport','no channels remaining, scheduling disconnect'),this._schedulePendingDisconnect())}_schedulePendingDisconnect(){if(this._cancelPendingDisconnect(),0===this._disconnectOnEmptyChannelsAfterMs)return this.log('transport','disconnecting immediately - no channels'),void this.disconnect();this._pendingDisconnectTimer=setTimeout(()=>{this._pendingDisconnectTimer=null,0===this.channels.length&&(this.log('transport','deferred disconnect fired - no channels, disconnecting'),this.disconnect())},this._disconnectOnEmptyChannelsAfterMs),this.log('transport',`deferred disconnect scheduled in ${this._disconnectOnEmptyChannelsAfterMs}ms`)}_cancelPendingDisconnect(){null!==this._pendingDisconnectTimer&&(this.log('transport','pending disconnect cancelled - channel activity detected'),clearTimeout(this._pendingDisconnectTimer),this._pendingDisconnectTimer=null)}async _performAuth(e=null){let t,s=!1;if(e)t=e,s=!0;else if(this.accessToken)try{t=await this.accessToken()}catch(e){this.log('error','Error fetching access token from callback',e),t=this.accessTokenValue}else t=this.accessTokenValue;s?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=t&&(this.accessTokenValue=t,this.channels.forEach(e=>{const s={access_token:t,version:n.DEFAULT_VERSION};t&&e.updateJoinPayload(s),e.joinedOnce&&e.channelAdapter.isJoined()&&e.channelAdapter.push(n.CHANNEL_EVENTS.access_token,{access_token:t})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(e="general"){this._isManualToken()||this.setAuth().catch(t=>{this.log('error',`Error setting auth in ${e}`,t)})}_setupConnectionHandlers(){this.socketAdapter.onOpen(()=>{(this._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).catch(e=>{this.log('error','error waiting for auth on connect',e)}),this.worker&&!this.workerRef&&this._startWorkerHeartbeat()}),this.socketAdapter.onClose(()=>{this.worker&&this.workerRef&&this._terminateWorker()}),this.socketAdapter.onMessage(e=>{e.ref&&e.ref===this._pendingWorkerHeartbeatRef&&(this._pendingWorkerHeartbeatRef=null)})}_handleNodeJsRaceCondition(){this.socketAdapter.isConnected()&&this.socketAdapter.getSocket().onConnOpen()}_wrapHeartbeatCallback(e){return(t,n)=>{'sent'==t&&this._setAuthSafely(),e&&e(t,n)}}_startWorkerHeartbeat(){this.workerUrl?this.log('worker',`starting worker for from ${this.workerUrl}`):this.log('worker',"starting default worker");const e=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(e),this.workerRef.onerror=e=>{this.log('worker','worker error',e.message),this._terminateWorker(),this.disconnect()},this.workerRef.onmessage=e=>{'keepAlive'===e.data.event&&this.sendHeartbeat()},this.workerRef.postMessage({event:'start',interval:this.heartbeatIntervalMs})}_terminateWorker(){this.workerRef&&(this.log('worker','terminating worker'),this.workerRef.terminate(),this.workerRef=void 0)}_workerObjectUrl(e){let t;if(e)t=e;else{const e=new Blob(["\n addEventListener(\"message\", (e) => {\n if (e.data.event === \"start\") {\n setInterval(() => postMessage({ event: \"keepAlive\" }), e.data.interval);\n }\n });"],{type:'application/javascript'});t=URL.createObjectURL(e)}return t}_initializeOptions(e){var s,o,c,l,k,f,_,v,w,b,A,T;this.worker=null!==(s=null==e?void 0:e.worker)&&void 0!==s&&s,this.accessToken=null!==(o=null==e?void 0:e.accessToken)&&void 0!==o?o:null;const y={};let C,R;y.timeout=null!==(c=null==e?void 0:e.timeout)&&void 0!==c?c:n.DEFAULT_TIMEOUT,y.heartbeatIntervalMs=null!==(l=null==e?void 0:e.heartbeatIntervalMs)&&void 0!==l?l:h,this._disconnectOnEmptyChannelsAfterMs=null!==(k=null==e?void 0:e.disconnectOnEmptyChannelsAfterMs)&&void 0!==k?k:2*(null!==(f=null==e?void 0:e.heartbeatIntervalMs)&&void 0!==f?f:h),y.transport=null!==(_=null==e?void 0:e.transport)&&void 0!==_?_:t.default.getWebSocketConstructor(),y.params=null==e?void 0:e.params,y.logger=null==e?void 0:e.logger,y.heartbeatCallback=this._wrapHeartbeatCallback(null==e?void 0:e.heartbeatCallback),y.sessionStorage=null!==(v=null==e?void 0:e.sessionStorage)&&void 0!==v?v:p(),y.reconnectAfterMs=null!==(w=null==e?void 0:e.reconnectAfterMs)&&void 0!==w?w:e=>u[e-1]||1e4;const E=null!==(b=null==e?void 0:e.vsn)&&void 0!==b?b:n.DEFAULT_VSN;switch(E){case n.VSN_1_0_0:C=(e,t)=>t(JSON.stringify(e)),R=(e,t)=>t(JSON.parse(e));break;case n.VSN_2_0_0:C=this.serializer.encode.bind(this.serializer),R=this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${y.vsn}`)}if(y.vsn=E,y.encode=null!==(A=null==e?void 0:e.encode)&&void 0!==A?A:C,y.decode=null!==(T=null==e?void 0:e.decode)&&void 0!==T?T:R,y.beforeReconnect=this._reconnectAuth.bind(this),((null==e?void 0:e.logLevel)||(null==e?void 0:e.log_level))&&(this.logLevel=e.logLevel||e.log_level,y.params=Object.assign(Object.assign({},y.params),{log_level:this.logLevel})),this.worker){if('undefined'!=typeof window&&!window.Worker)throw new Error('Web Worker is not supported');this.workerUrl=null==e?void 0:e.workerUrl,y.autoSendHeartbeat=!this.worker}return y}async _reconnectAuth(){await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()}}},1162,[1163,1164,1166,1167,1168,1175]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"WebSocketFactory",{enumerable:!0,get:function(){return t}});class t{constructor(){}static detectEnvironment(){var t;if('undefined'!=typeof WebSocket)return{type:'native',wsConstructor:WebSocket};const o=globalThis;if('undefined'!=typeof globalThis&&void 0!==o.WebSocket)return{type:'native',wsConstructor:o.WebSocket};const n=void 0!==g?g:void 0;if(n&&void 0!==n.WebSocket)return{type:'native',wsConstructor:n.WebSocket};if('undefined'!=typeof globalThis&&void 0!==o.WebSocketPair&&void 0===globalThis.WebSocket)return{type:'cloudflare',error:'Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.',workaround:'Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime.'};if('undefined'!=typeof globalThis&&o.EdgeRuntime||'undefined'!=typeof navigator&&(null===(t=navigator.userAgent)||void 0===t?void 0:t.includes('Vercel-Edge')))return{type:'unsupported',error:'Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.',workaround:'Use serverless functions or a different deployment target for WebSocket functionality.'};const s=globalThis.process;if(s){const t=s.versions;if(t&&t.node){const o=t.node,n=parseInt(o.replace(/^v/,'').split('.')[0]);return n>=22?void 0!==globalThis.WebSocket?{type:'native',wsConstructor:globalThis.WebSocket}:{type:'unsupported',error:`Node.js ${n} detected but native WebSocket not found.`,workaround:'Provide a WebSocket implementation via the transport option.'}:{type:'unsupported',error:`Node.js ${n} detected without native WebSocket support.`,workaround:"For Node.js < 22, install \"ws\" package and provide it via the transport option:\nimport ws from \"ws\"\nnew RealtimeClient(url, { transport: ws })"}}}return{type:'unsupported',error:'Unknown JavaScript runtime without WebSocket support.',workaround:"Ensure you're running in a supported environment (browser, Node.js, Deno) or provide a custom WebSocket implementation."}}static getWebSocketConstructor(){const t=this.detectEnvironment();if(t.wsConstructor)return t.wsConstructor;let o=t.error||'WebSocket not supported in this environment.';throw t.workaround&&(o+=`\n\nSuggested solution: ${t.workaround}`),new Error(o)}static isWebSocketSupported(){try{const t=this.detectEnvironment();return'native'===t.type||'ws'===t.type}catch(t){return!1}}}var o=t},1163,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DEFAULT_VERSION",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"VSN_1_0_0",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"VSN_2_0_0",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"DEFAULT_VSN",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"VERSION",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"DEFAULT_TIMEOUT",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"WS_CLOSE_NORMAL",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"MAX_PUSH_BUFFER_SIZE",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"SOCKET_STATES",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"CHANNEL_STATES",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"CHANNEL_EVENTS",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"TRANSPORTS",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"CONNECTION_STATE",{enumerable:!0,get:function(){return E}});var n=r(d[0]);const t=`realtime-js/${n.version}`,o='1.0.0',c='2.0.0',u=c,l=n.version,b=1e4,_=1e3,f=100,p={connecting:0,open:1,closing:2,closed:3},s={closed:'closed',errored:'errored',joined:'joined',joining:'joining',leaving:'leaving'},O={close:'phx_close',error:'phx_error',join:'phx_join',reply:'phx_reply',leave:'phx_leave',access_token:'access_token'},j={websocket:'websocket'},E={connecting:'connecting',open:'open',closing:'closing',closed:'closed'}},1164,[1165]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"version",{enumerable:!0,get:function(){return t}});const t='2.109.0'},1165,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}});class t{constructor(t){this.HEADER_LENGTH=1,this.USER_BROADCAST_PUSH_META_LENGTH=6,this.KINDS={userBroadcastPush:3,userBroadcast:4},this.BINARY_ENCODING=0,this.JSON_ENCODING=1,this.BROADCAST_EVENT='broadcast',this.allowedMetadataKeys=[],this.allowedMetadataKeys=null!=t?t:[]}encode(t,n){if(t.event===this.BROADCAST_EVENT&&!(t.payload instanceof ArrayBuffer)&&'string'==typeof t.payload.event)return n(this._binaryEncodeUserBroadcastPush(t));let s=[t.join_ref,t.ref,t.topic,t.event,t.payload];return n(JSON.stringify(s))}_binaryEncodeUserBroadcastPush(t){var n;return this._isArrayBuffer(null===(n=t.payload)||void 0===n?void 0:n.payload)?this._encodeBinaryUserBroadcastPush(t):this._encodeJsonUserBroadcastPush(t)}_encodeBinaryUserBroadcastPush(t){var n,s;const o=null!==(s=null===(n=t.payload)||void 0===n?void 0:n.payload)&&void 0!==s?s:new ArrayBuffer(0);return this._encodeUserBroadcastPush(t,this.BINARY_ENCODING,o)}_encodeJsonUserBroadcastPush(t){var n,s;const o=null!==(s=null===(n=t.payload)||void 0===n?void 0:n.payload)&&void 0!==s?s:{},c=(new TextEncoder).encode(JSON.stringify(o)).buffer;return this._encodeUserBroadcastPush(t,this.JSON_ENCODING,c)}_encodeUserBroadcastPush(t,n,s){var o,c;const l=t.topic,h=null!==(o=t.ref)&&void 0!==o?o:'',u=null!==(c=t.join_ref)&&void 0!==c?c:'',f=t.payload.event,y=this.allowedMetadataKeys?this._pick(t.payload,this.allowedMetadataKeys):{},_=0===Object.keys(y).length?'':JSON.stringify(y);if(u.length>255)throw new Error(`joinRef length ${u.length} exceeds maximum of 255`);if(h.length>255)throw new Error(`ref length ${h.length} exceeds maximum of 255`);if(l.length>255)throw new Error(`topic length ${l.length} exceeds maximum of 255`);if(f.length>255)throw new Error(`userEvent length ${f.length} exceeds maximum of 255`);if(_.length>255)throw new Error(`metadata length ${_.length} exceeds maximum of 255`);const A=this.USER_BROADCAST_PUSH_META_LENGTH+u.length+h.length+l.length+f.length+_.length,E=new ArrayBuffer(this.HEADER_LENGTH+A);let U=new DataView(E),B=0;U.setUint8(B++,this.KINDS.userBroadcastPush),U.setUint8(B++,u.length),U.setUint8(B++,h.length),U.setUint8(B++,l.length),U.setUint8(B++,f.length),U.setUint8(B++,_.length),U.setUint8(B++,n),Array.from(u,t=>U.setUint8(B++,t.charCodeAt(0))),Array.from(h,t=>U.setUint8(B++,t.charCodeAt(0))),Array.from(l,t=>U.setUint8(B++,t.charCodeAt(0))),Array.from(f,t=>U.setUint8(B++,t.charCodeAt(0))),Array.from(_,t=>U.setUint8(B++,t.charCodeAt(0)));var N=new Uint8Array(E.byteLength+s.byteLength);return N.set(new Uint8Array(E),0),N.set(new Uint8Array(s),E.byteLength),N.buffer}decode(t,n){if(this._isArrayBuffer(t)){return n(this._binaryDecode(t))}if('string'==typeof t){const s=JSON.parse(t),[o,c,l,h,u]=s;return n({join_ref:o,ref:c,topic:l,event:h,payload:u})}return n({})}_binaryDecode(t){const n=new DataView(t),s=n.getUint8(0),o=new TextDecoder;if(s===this.KINDS.userBroadcast)return this._decodeUserBroadcast(t,n,o)}_decodeUserBroadcast(t,n,s){const o=n.getUint8(1),c=n.getUint8(2),l=n.getUint8(3),h=n.getUint8(4);let u=this.HEADER_LENGTH+4;const f=s.decode(t.slice(u,u+o));u+=o;const y=s.decode(t.slice(u,u+c));u+=c;const _=s.decode(t.slice(u,u+l));u+=l;const A=t.slice(u,t.byteLength),E=h===this.JSON_ENCODING?JSON.parse(s.decode(A)):A,U={type:this.BROADCAST_EVENT,event:y,payload:E};return l>0&&(U.meta=JSON.parse(_)),{join_ref:null,ref:null,topic:f,event:this.BROADCAST_EVENT,payload:U}}_isArrayBuffer(t){var n;return t instanceof ArrayBuffer||'ArrayBuffer'===(null===(n=null==t?void 0:t.constructor)||void 0===n?void 0:n.name)}_pick(t,n){return t&&'object'==typeof t?Object.fromEntries(Object.entries(t).filter(([t])=>n.includes(t))):{}}}},1166,[]); +__d(function(g,r,i,a,m,e,d){"use strict";var t;Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PostgresTypes",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"convertChangeData",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"convertColumn",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"convertCell",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"toBoolean",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"toNumber",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"toJson",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"toArray",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"toTimestampString",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"httpEndpointURL",{enumerable:!0,get:function(){return y}}),(function(t){t.abstime="abstime",t.bool="bool",t.date="date",t.daterange="daterange",t.float4="float4",t.float8="float8",t.int2="int2",t.int4="int4",t.int4range="int4range",t.int8="int8",t.int8range="int8range",t.json="json",t.jsonb="jsonb",t.money="money",t.numeric="numeric",t.oid="oid",t.reltime="reltime",t.text="text",t.time="time",t.timestamp="timestamp",t.timestamptz="timestamptz",t.timetz="timetz",t.tsrange="tsrange",t.tstzrange="tstzrange"})(t||(t={}));const n=(t,n,o={})=>{var s;const u=null!==(s=o.skipTypes)&&void 0!==s?s:[];return n?Object.keys(n).reduce((o,s)=>(o[s]=c(s,t,n,u),o),{}):{}},c=(t,n,c,u)=>{const p=n.find(n=>n.name===t),l=null==p?void 0:p.type,f=c[t];return l&&!u.includes(l)?o(l,f):s(f)},o=(n,c)=>{if('_'===n.charAt(0)){const t=n.slice(1,n.length);return f(c,t)}switch(n){case t.bool:return u(c);case t.float4:case t.float8:case t.int2:case t.int4:case t.int8:case t.numeric:case t.oid:return p(c);case t.json:case t.jsonb:return l(c);case t.timestamp:return b(c);case t.abstime:case t.date:case t.daterange:case t.int4range:case t.int8range:case t.money:case t.reltime:case t.text:case t.time:case t.timestamptz:case t.timetz:case t.tsrange:case t.tstzrange:default:return s(c)}},s=t=>t,u=t=>{switch(t){case't':return!0;case'f':return!1;default:return t}},p=t=>{if('string'==typeof t){const n=parseFloat(t);if(!Number.isNaN(n))return n}return t},l=t=>{if('string'==typeof t)try{return JSON.parse(t)}catch(n){return t}return t},f=(t,n)=>{if('string'!=typeof t)return t;const c=t.length-1,s=t[c];if('{'===t[0]&&'}'===s){let s;const u=t.slice(1,c);try{s=JSON.parse('['+u+']')}catch(t){s=u?u.split(','):[]}return s.map(t=>o(n,t))}return t},b=t=>'string'==typeof t?t.replace(' ','T'):t,y=t=>{const n=new URL(t);return n.protocol=n.protocol.replace(/^ws/i,'http'),n.pathname=n.pathname.replace(/\/+$/,'').replace(/\/socket\/websocket$/i,'').replace(/\/socket$/i,'').replace(/\/websocket$/i,''),''===n.pathname||'/'===n.pathname?n.pathname='/api/broadcast':n.pathname=n.pathname+'/api/broadcast',n.href}},1167,[]); +__d(function(g,_r,_i,a,m,_e2,_d2){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"RealtimePostgresFilterBuilder",{enumerable:!0,get:function(){return d.RealtimePostgresFilterBuilder}}),Object.defineProperty(_e2,"postgresChangesFilter",{enumerable:!0,get:function(){return d.postgresChangesFilter}}),Object.defineProperty(_e2,"default",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e2,"REALTIME_POSTGRES_CHANGES_LISTEN_EVENT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e2,"REALTIME_LISTEN_TYPES",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e2,"REALTIME_SUBSCRIBE_STATES",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e2,"REALTIME_CHANNEL_STATES",{enumerable:!0,get:function(){return h}});var t,n,i,s=_r(_d2[0]),r=e(_r(_d2[1])),o=_r(_d2[2]),c=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(n){if('default'!==n){var i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,t})(o),l=_r(_d2[3]),u=e(_r(_d2[4])),d=_r(_d2[5]);!(function(e){e.ALL="*",e.INSERT="INSERT",e.UPDATE="UPDATE",e.DELETE="DELETE"})(t||(t={})),(function(e){e.BROADCAST="broadcast",e.PRESENCE="presence",e.POSTGRES_CHANGES="postgres_changes",e.SYSTEM="system"})(n||(n={})),(function(e){e.SUBSCRIBED="SUBSCRIBED",e.TIMED_OUT="TIMED_OUT",e.CLOSED="CLOSED",e.CHANNEL_ERROR="CHANNEL_ERROR"})(i||(i={}));const h=s.CHANNEL_STATES;class p{get state(){return this.channelAdapter.state}set state(e){this.channelAdapter.state=e}get joinedOnce(){return this.channelAdapter.joinedOnce}get timeout(){return this.socket.timeout}get joinPush(){return this.channelAdapter.joinPush}get rejoinTimer(){return this.channelAdapter.rejoinTimer}constructor(e,t={config:{}},n){var i,s;if(this.topic=e,this.params=t,this.socket=n,this.bindings={},this.subTopic=e.replace(/^realtime:/i,''),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:'',enabled:!1},private:!1},t.config),this.channelAdapter=new u.default(this.socket.socketAdapter,e,this.params),this.presence=new r.default(this),this._onClose(()=>{this.socket._remove(this)}),this._updateFilterTransform(),this.broadcastEndpointURL=(0,o.httpEndpointURL)(this.socket.socketAdapter.endPointURL()),this.private=this.params.config.private||!1,!this.private&&(null===(s=null===(i=this.params.config)||void 0===i?void 0:i.broadcast)||void 0===s?void 0:s.replay))throw new Error(`tried to use replay on public channel '${this.topic}'. It must be a private channel.`)}subscribe(e,t=this.timeout){var r,o,c;if(this.socket.isConnected()||this.socket.connect(),this.channelAdapter.isClosed()){const{config:{broadcast:u,presence:d,private:h}}=this.params,p=null!==(o=null===(r=this.bindings.postgres_changes)||void 0===r?void 0:r.map(e=>e.filter))&&void 0!==o?o:[],E=!!this.bindings[n.PRESENCE]&&this.bindings[n.PRESENCE].length>0||!0===(null===(c=this.params.config.presence)||void 0===c?void 0:c.enabled),b={},f={broadcast:u,presence:Object.assign(Object.assign({},d),{enabled:E}),postgres_changes:p,private:h};this.socket.accessTokenValue&&(b.access_token=this.socket.accessTokenValue),this._onError(t=>{null==e||e(i.CHANNEL_ERROR,(0,l.normalizeChannelError)(t))}),this._onClose(()=>null==e?void 0:e(i.CLOSED)),this.updateJoinPayload(Object.assign({config:f},b)),this._updateFilterMessage(),this.channelAdapter.subscribe(t).receive('ok',async({postgres_changes:t})=>{this.socket._isManualToken()||this.socket.setAuth(),void 0!==t?this._updatePostgresBindings(t,e):null==e||e(i.SUBSCRIBED)}).receive('error',t=>{this.state=s.CHANNEL_STATES.errored;const n=Object.values(t).join(', ')||'error';null==e||e(i.CHANNEL_ERROR,new Error(n,{cause:t}))}).receive('timeout',()=>{null==e||e(i.TIMED_OUT)})}return this}_updatePostgresBindings(e,t){var n;const r=this.bindings.postgres_changes,o=null!==(n=null==r?void 0:r.length)&&void 0!==n?n:0,c=[];for(let n=0;n{var i,s,r;const o=this.channelAdapter.push(e.type,e,t.timeout||this.timeout);'broadcast'!==e.type||(null===(r=null===(s=null===(i=this.params)||void 0===i?void 0:i.config)||void 0===s?void 0:s.broadcast)||void 0===r?void 0:r.ack)||n('ok'),o.receive('ok',()=>n('ok')),o.receive('error',()=>n('error')),o.receive('timeout',()=>n('timed out'))});{console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated in the future. Please use httpSend() explicitly for REST delivery.");const{event:s,payload:r}=e,o={apikey:this.socket.apiKey?this.socket.apiKey:'','Content-Type':'application/json'};this.socket.accessTokenValue&&(o.Authorization=`Bearer ${this.socket.accessTokenValue}`);const c={method:'POST',headers:o,body:JSON.stringify({messages:[{topic:this.subTopic,event:s,payload:r,private:this.private}]})};try{const e=await this._fetchWithTimeout(this.broadcastEndpointURL,c,null!==(n=t.timeout)&&void 0!==n?n:this.timeout);return await(null===(i=e.body)||void 0===i?void 0:i.cancel()),e.ok?'ok':'error'}catch(e){return e instanceof Error&&'AbortError'===e.name?'timed out':'error'}}}updateJoinPayload(e){this.channelAdapter.updateJoinPayload(e)}async unsubscribe(e=this.timeout){return new Promise(t=>{this.channelAdapter.unsubscribe(e).receive('ok',()=>t('ok')).receive('timeout',()=>t('timed out')).receive('error',()=>t('error'))})}teardown(){this.channelAdapter.teardown()}async _fetchWithTimeout(e,t,n){const i=new AbortController,s=setTimeout(()=>i.abort(),n),r=await this.socket.fetch(e,Object.assign(Object.assign({},t),{signal:i.signal}));return clearTimeout(s),r}_on(e,t,n){const i=e.toLocaleLowerCase(),s=null==t?void 0:t.filter;(s instanceof d.RealtimePostgresFilterBuilder||'object'==typeof s&&null!==s&&'function'==typeof s.build)&&(t=Object.assign(Object.assign({},t),{filter:s.build()}));const r={type:i,filter:t,callback:n,ref:this.channelAdapter.on(e,n)};return this.bindings[i]?this.bindings[i].push(r):this.bindings[i]=[r],this._updateFilterMessage(),this}_onClose(e){this.channelAdapter.onClose(e)}_onError(e){this.channelAdapter.onError(e)}_updateFilterMessage(){this.channelAdapter.updateFilterBindings((e,t,n)=>{var i,s,r,o,c,l,u;const d=e.event.toLocaleLowerCase();if(this._notThisChannelEvent(d,n))return!1;const h=null===(i=this.bindings[d])||void 0===i?void 0:i.find(t=>t.ref===e.ref);if(!h)return!0;if(['broadcast','presence','postgres_changes'].includes(d)){if('id'in h){const e=h.id,n=null===(s=h.filter)||void 0===s?void 0:s.event;return e&&(null===(r=t.ids)||void 0===r?void 0:r.includes(e))&&('*'===n||(null==n?void 0:n.toLocaleLowerCase())===(null===(o=t.data)||void 0===o?void 0:o.type.toLocaleLowerCase()))}{const e=null===(l=null===(c=null==h?void 0:h.filter)||void 0===c?void 0:c.event)||void 0===l?void 0:l.toLocaleLowerCase();return'*'===e||e===(null===(u=null==t?void 0:t.event)||void 0===u?void 0:u.toLocaleLowerCase())}}return h.type.toLocaleLowerCase()===d})}_notThisChannelEvent(e,t){const{close:n,error:i,leave:r,join:o}=s.CHANNEL_EVENTS;return t&&[n,i,r,o].includes(e)&&t!==this.joinPush.ref}_updateFilterTransform(){this.channelAdapter.updatePayloadTransform((e,t,n)=>{if('object'==typeof t&&'ids'in t){const e=t.data,{schema:n,table:i,commit_timestamp:s,type:r,errors:o}=e,c={schema:n,table:i,commit_timestamp:s,eventType:r,new:{},old:{},errors:o};return Object.assign(Object.assign({},c),this._getPayloadRecords(e))}return t})}copyBindings(e){if(this.joinedOnce)throw new Error('cannot copy bindings into joined channel');for(const t in e.bindings)for(const n of e.bindings[t])this._on(n.type,n.filter,n.callback)}static isFilterValueEqual(e,t){return(null!=e?e:void 0)===(null!=t?t:void 0)}_getPayloadRecords(e){const t={new:{},old:{}};return'INSERT'!==e.type&&'UPDATE'!==e.type||(t.new=c.convertChangeData(e.columns,e.record)),'UPDATE'!==e.type&&'DELETE'!==e.type||(t.old=c.convertChangeData(e.columns,e.old_record)),t}}},1168,[1164,1169,1167,1172,1173,1174]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"REALTIME_PRESENCE_LISTEN_EVENTS",{enumerable:!0,get:function(){return t}});var e,t,n=r(d[0]),c=(e=n)&&e.__esModule?e:{default:e};!(function(e){e.SYNC="sync",e.JOIN="join",e.LEAVE="leave"})(t||(t={}));class u{get state(){return this.presenceAdapter.state}constructor(e,t){this.channel=e,this.presenceAdapter=new c.default(this.channel.channelAdapter,t)}}},1169,[1170]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}});var n=r(d[0]);class t{constructor(s,c){const u=o(c);this.presence=new n.Presence(s.getChannel(),u),this.presence.onJoin((n,c,o)=>{const u=t.onJoinPayload(n,c,o);s.getChannel().trigger('presence',u)}),this.presence.onLeave((n,c,o)=>{const u=t.onLeavePayload(n,c,o);s.getChannel().trigger('presence',u)}),this.presence.onSync(()=>{s.getChannel().trigger('presence',{event:'sync'})})}get state(){return t.transformState(this.presence.state)}static transformState(n){return n=c(n),Object.getOwnPropertyNames(n).reduce((t,c)=>{const o=n[c];return t[c]=s(o),t},{})}static onJoinPayload(n,t,c){return{event:'join',key:n,currentPresences:u(t),newPresences:s(c)}}static onLeavePayload(n,t,c){return{event:'leave',key:n,currentPresences:u(t),leftPresences:s(c)}}}function s(n){return n.metas.map(n=>(n.presence_ref=n.phx_ref,delete n.phx_ref,delete n.phx_ref_prev,n))}function c(n){return JSON.parse(JSON.stringify(n))}function o(n){return(null==n?void 0:n.events)&&{events:n.events}}function u(n){return(null==n?void 0:n.metas)?s(n):[]}},1170,[1171]); +__d(function(g,r,_i,a,_m,_e2,d){"use strict";Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"Channel",{enumerable:!0,get:function(){return A}}),Object.defineProperty(_e2,"LongPoll",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e2,"Presence",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e2,"Push",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e2,"Serializer",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e2,"Socket",{enumerable:!0,get:function(){return $}}),Object.defineProperty(_e2,"Timer",{enumerable:!0,get:function(){return w}});var e=e=>{if("function"==typeof e)return e;return function(){return e}},t="undefined"!=typeof self?self:null,s="undefined"!=typeof window?window:null,i=t||s||globalThis,n=0,o=1,h=2,c=3,l="closed",u="errored",f="joined",p="joining",m="leaving",b="phx_close",k="phx_error",T="phx_join",y="phx_reply",C="phx_leave",v="longpoll",R="websocket",j=4,E="base64url.bearer.phx.",S=class{constructor(e,t,s,i){this.channel=e,this.event=t,this.payload=s||function(){return{}},this.receivedResp=null,this.timeout=i,this.timeoutTimer=null,this.recHooks=[],this.sent=!1,this.ref=void 0}resend(e){this.timeout=e,this.reset(),this.send()}send(){this.hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload(),ref:this.ref,join_ref:this.channel.joinRef()}))}receive(e,t){return this.hasReceived(e)&&t(this.receivedResp.response),this.recHooks.push({status:e,callback:t}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}destroy(){this.cancelRefEvent(),this.cancelTimeout()}matchReceive({status:e,response:t,_ref:s}){this.recHooks.filter(t=>t.status===e).forEach(e=>e.callback(t))}cancelRefEvent(){this.refEvent&&this.channel.off(this.refEvent)}cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null}startTimeout(){this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,e=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=e,this.matchReceive(e)}),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}trigger(e,t){this.channel.trigger(this.refEvent,{status:e,response:t})}},w=class{constructor(e,t){this.callback=e,this.timerCalc=t,this.timer=void 0,this.tries=0}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}},A=class{constructor(t,s,i){this.state=l,this.topic=t,this.params=e(s||{}),this.socket=i,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new S(this,T,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new w(()=>{this.socket.isConnected()&&this.rejoin()},this.socket.rejoinAfterMs),this.stateChangeRefs.push(this.socket.onError(()=>this.rejoinTimer.reset())),this.stateChangeRefs.push(this.socket.onOpen(()=>{this.rejoinTimer.reset(),this.isErrored()&&this.rejoin()})),this.joinPush.receive("ok",()=>{this.state=f,this.rejoinTimer.reset(),this.pushBuffer.forEach(e=>e.send()),this.pushBuffer=[]}),this.joinPush.receive("error",e=>{this.state=u,this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,e),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.onClose(()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log("channel",`close ${this.topic}`),this.state=l,this.socket.remove(this)}),this.onError(e=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,e),this.isJoining()&&this.joinPush.reset(),this.state=u,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.joinPush.receive("timeout",()=>{this.socket.hasLogger()&&this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),new S(this,C,e({}),this.timeout).send(),this.state=u,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(y,(e,t)=>{this.trigger(this.replyEventName(t),e)})}join(e=this.timeout){if(this.joinedOnce)throw new Error("tried to join multiple times. 'join' can only be called a single time per channel instance");return this.timeout=e,this.joinedOnce=!0,this.rejoin(),this.joinPush}teardown(){this.pushBuffer.forEach(e=>e.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=l,this.bindings=[]}onClose(e){this.on(b,e)}onError(e){return this.on(k,t=>e(t))}on(e,t){let s=this.bindingRef++;return this.bindings.push({event:e,ref:s,callback:t}),s}off(e,t){this.bindings=this.bindings.filter(s=>!(s.event===e&&(void 0===t||t===s.ref)))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(e,t,s=this.timeout){if(t=t||{},!this.joinedOnce)throw new Error(`tried to push '${e}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let i=new S(this,e,function(){return t},s);return this.canPush()?i.send():(i.startTimeout(),this.pushBuffer.push(i)),i}leave(t=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=m;let s=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(b,"leave")},i=new S(this,C,e({}),t);return i.receive("ok",()=>s()).receive("timeout",()=>s()),i.send(),this.canPush()||i.trigger("ok",{}),i}onMessage(e,t,s){return t}filterBindings(e,t,s){return!0}isMember(e,t,s,i){return this.topic===e&&(!i||i===this.joinRef()||(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:e,event:t,payload:s,joinRef:i}),!1))}joinRef(){return this.joinPush.ref}rejoin(e=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=p,this.joinPush.resend(e))}trigger(e,t,s,i){let n=this.onMessage(e,t,s,i);if(t&&!n)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let o=this.bindings.filter(i=>i.event===e&&this.filterBindings(i,t,s));for(let e=0;eu.abort(),o);l.signal=u.signal}return i.fetch(t,l).then(e=>e.text()).then(e=>this.parseJSON(e)).then(e=>c&&c(e)).catch(e=>{"AbortError"===e.name&&h?h():c&&c(null)}),u}static xdomainRequest(e,t,s,i,n,o,h){return e.timeout=n,e.open(t,s),e.onload=()=>{let t=this.parseJSON(e.responseText);h&&h(t)},o&&(e.ontimeout=o),e.onprogress=()=>{},e.send(i),e}static xhrRequest(e,t,s,i,n,o,h,c){e.open(t,s,!0),e.timeout=o;for(let[t,s]of Object.entries(i))e.setRequestHeader(t,s);return e.onerror=()=>c&&c(null),e.onreadystatechange=()=>{if(e.readyState===j&&c){let t=this.parseJSON(e.responseText);c(t)}},h&&(e.ontimeout=h),e.send(n),e}static parseJSON(e){if(!e||""===e)return null;try{return JSON.parse(e)}catch{return console&&console.log("failed to parse JSON response",e),null}}static serialize(e,t){let s=[];for(var i in e){if(!Object.prototype.hasOwnProperty.call(e,i))continue;let n=t?`${t}[${i}]`:i,o=e[i];"object"==typeof o?s.push(this.serialize(o,n)):s.push(encodeURIComponent(n)+"="+encodeURIComponent(o))}return s.join("&")}static appendParams(e,t){if(0===Object.keys(t).length)return e;let s=e.match(/\?/)?"&":"?";return`${e}${s}${this.serialize(t)}`}},L=e=>{let t="",s=new Uint8Array(e),i=s.byteLength;for(let e=0;ethis.poll(),0)}normalizeEndpoint(e){return e.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+R),"$1/"+v)}endpointURL(){return H.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(e,t,s){this.close(e,t,s),this.readyState=n}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===o||this.readyState===n}poll(){const e={Accept:"application/json"};this.authToken&&(e["X-Phoenix-AuthToken"]=this.authToken),this.ajax("GET",e,null,()=>this.ontimeout(),e=>{if(e){var{status:t,token:s,messages:i}=e;if(410===t&&null!==this.token)return this.onerror(410),void this.closeAndRetry(3410,"session_gone",!1);this.token=s}else t=0;switch(t){case 200:i.forEach(e=>{setTimeout(()=>this.onmessage({data:e}),0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=o,this.onopen({}),this.poll();break;case 403:this.onerror(403),this.close(1008,"forbidden",!1);break;case 0:case 500:this.onerror(500),this.closeAndRetry(1011,"internal server error",500);break;default:throw new Error(`unhandled poll status ${t}`)}})}send(e){"string"!=typeof e&&(e=L(e)),this.currentBatch?this.currentBatch.push(e):this.awaitingBatchAck?this.batchBuffer.push(e):(this.currentBatch=[e],this.currentBatchTimer=setTimeout(()=>{this.batchSend(this.currentBatch),this.currentBatch=null},0))}batchSend(e){this.awaitingBatchAck=!0,this.ajax("POST",{"Content-Type":"application/x-ndjson"},e.join("\n"),()=>this.onerror("timeout"),e=>{this.awaitingBatchAck=!1,e&&200===e.status?this.batchBuffer.length>0&&(this.batchSend(this.batchBuffer),this.batchBuffer=[]):(this.onerror(e&&e.status),this.closeAndRetry(1011,"internal server error",!1))})}close(e,t,s){for(let e of this.reqs)e.abort();this.readyState=c;let i=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:e,reason:t,wasClean:s});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,"undefined"!=typeof CloseEvent?this.onclose(new CloseEvent("close",i)):this.onclose(i)}ajax(e,t,s,i,n){let o;o=H.request(e,this.endpointURL(),t,s,this.timeout,()=>{this.reqs.delete(o),i()},e=>{this.reqs.delete(o),this.isActive()&&n(e)}),this.reqs.add(o)}},B=class e{constructor(t,s={}){let i=s.events||{state:"presence_state",diff:"presence_diff"};this.state={},this.pendingDiffs=[],this.channel=t,this.joinRef=null,this.caller={onJoin:function(){},onLeave:function(){},onSync:function(){}},this.channel.on(i.state,t=>{let{onJoin:s,onLeave:i,onSync:n}=this.caller;this.joinRef=this.channel.joinRef(),this.state=e.syncState(this.state,t,s,i),this.pendingDiffs.forEach(t=>{this.state=e.syncDiff(this.state,t,s,i)}),this.pendingDiffs=[],n()}),this.channel.on(i.diff,t=>{let{onJoin:s,onLeave:i,onSync:n}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(t):(this.state=e.syncDiff(this.state,t,s,i),n())})}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}list(t){return e.list(this.state,t)}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel.joinRef()}static syncState(e,t,s,i){let n=this.clone(e),o={},h={};return this.map(n,(e,s)=>{t[e]||(h[e]=s)}),this.map(t,(e,t)=>{let s=n[e];if(s){let i=t.metas.map(e=>e.phx_ref),n=s.metas.map(e=>e.phx_ref),c=t.metas.filter(e=>n.indexOf(e.phx_ref)<0),l=s.metas.filter(e=>i.indexOf(e.phx_ref)<0);c.length>0&&(o[e]=t,o[e].metas=c),l.length>0&&(h[e]=this.clone(s),h[e].metas=l)}else o[e]=t}),this.syncDiff(n,{joins:o,leaves:h},s,i)}static syncDiff(e,t,s,i){let{joins:n,leaves:o}=this.clone(t);return s||(s=function(){}),i||(i=function(){}),this.map(n,(t,i)=>{let n=e[t];if(e[t]=this.clone(i),n){let s=e[t].metas.map(e=>e.phx_ref),i=n.metas.filter(e=>s.indexOf(e.phx_ref)<0);e[t].metas.unshift(...i)}s(t,n,i)}),this.map(o,(t,s)=>{let n=e[t];if(!n)return;let o=s.metas.map(e=>e.phx_ref);n.metas=n.metas.filter(e=>o.indexOf(e.phx_ref)<0),i(t,n,s),0===n.metas.length&&delete e[t]}),e}static list(e,t){return t||(t=function(e,t){return t}),this.map(e,(e,s)=>t(e,s))}static map(e,t){return Object.getOwnPropertyNames(e).map(s=>t(s,e[s]))}static clone(e){return JSON.parse(JSON.stringify(e))}},O={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(e,t){if(e.payload.constructor===ArrayBuffer)return t(this.binaryEncode(e));{let s=[e.join_ref,e.ref,e.topic,e.event,e.payload];return t(JSON.stringify(s))}},decode(e,t){if(e.constructor===ArrayBuffer)return t(this.binaryDecode(e));{let[s,i,n,o,h]=JSON.parse(e);return t({join_ref:s,ref:i,topic:n,event:o,payload:h})}},binaryEncode(e){let{join_ref:t,ref:s,event:i,topic:n,payload:o}=e,h=this.META_LENGTH+t.length+s.length+n.length+i.length,c=new ArrayBuffer(this.HEADER_LENGTH+h),l=new DataView(c),u=0;l.setUint8(u++,this.KINDS.push),l.setUint8(u++,t.length),l.setUint8(u++,s.length),l.setUint8(u++,n.length),l.setUint8(u++,i.length),Array.from(t,e=>l.setUint8(u++,e.charCodeAt(0))),Array.from(s,e=>l.setUint8(u++,e.charCodeAt(0))),Array.from(n,e=>l.setUint8(u++,e.charCodeAt(0))),Array.from(i,e=>l.setUint8(u++,e.charCodeAt(0)));var f=new Uint8Array(c.byteLength+o.byteLength);return f.set(new Uint8Array(c),0),f.set(new Uint8Array(o),c.byteLength),f.buffer},binaryDecode(e){let t=new DataView(e),s=t.getUint8(0),i=new TextDecoder;switch(s){case this.KINDS.push:return this.decodePush(e,t,i);case this.KINDS.reply:return this.decodeReply(e,t,i);case this.KINDS.broadcast:return this.decodeBroadcast(e,t,i)}},decodePush(e,t,s){let i=t.getUint8(1),n=t.getUint8(2),o=t.getUint8(3),h=this.HEADER_LENGTH+this.META_LENGTH-1,c=s.decode(e.slice(h,h+i));h+=i;let l=s.decode(e.slice(h,h+n));h+=n;let u=s.decode(e.slice(h,h+o));return h+=o,{join_ref:c,ref:null,topic:l,event:u,payload:e.slice(h,e.byteLength)}},decodeReply(e,t,s){let i=t.getUint8(1),n=t.getUint8(2),o=t.getUint8(3),h=t.getUint8(4),c=this.HEADER_LENGTH+this.META_LENGTH,l=s.decode(e.slice(c,c+i));c+=i;let u=s.decode(e.slice(c,c+n));c+=n;let f=s.decode(e.slice(c,c+o));c+=o;let p=s.decode(e.slice(c,c+h));c+=h;let m=e.slice(c,e.byteLength);return{join_ref:l,ref:u,topic:f,event:y,payload:{status:p,response:m}}},decodeBroadcast(e,t,s){let i=t.getUint8(1),n=t.getUint8(2),o=this.HEADER_LENGTH+2,h=s.decode(e.slice(o,o+i));o+=i;let c=s.decode(e.slice(o,o+n));return o+=n,{join_ref:null,ref:null,topic:h,event:c,payload:e.slice(o,e.byteLength)}}},$=class{constructor(t,n={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=n.timeout||1e4,this.transport=n.transport||i.WebSocket||P,this.conn=void 0,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=n.longPollFallbackMs,this.fallbackTimer=null;let o=null;try{o=i&&i.sessionStorage}catch{}this.sessionStore=n.sessionStorage||o,this.establishedConnections=0,this.defaultEncoder=O.encode.bind(O),this.defaultDecoder=O.decode.bind(O),this.closeWasClean=!0,this.disconnecting=!1,this.binaryType=n.binaryType||"arraybuffer",this.connectClock=1,this.pageHidden=!1,this.encode=void 0,this.decode=void 0,this.transport!==P?(this.encode=n.encode||this.defaultEncoder,this.decode=n.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let h=null;s&&s.addEventListener&&(s.addEventListener("pagehide",e=>{this.conn&&(this.disconnect(),h=this.connectClock)}),s.addEventListener("pageshow",e=>{h===this.connectClock&&(h=null,this.connect())}),s.addEventListener("visibilitychange",()=>{"hidden"===document.visibilityState?this.pageHidden=!0:(this.pageHidden=!1,this.isConnected()||this.closeWasClean||this.teardown(()=>this.connect()))})),this.heartbeatIntervalMs=n.heartbeatIntervalMs||3e4,this.autoSendHeartbeat=n.autoSendHeartbeat??!0,this.heartbeatCallback=n.heartbeatCallback??(()=>{}),this.rejoinAfterMs=e=>n.rejoinAfterMs?n.rejoinAfterMs(e):[1e3,2e3,5e3][e-1]||1e4,this.reconnectAfterMs=e=>n.reconnectAfterMs?n.reconnectAfterMs(e):[10,50,100,150,200,250,500,1e3,2e3][e-1]||5e3,this.logger=n.logger||null,!this.logger&&n.debug&&(this.logger=(e,t,s)=>{console.log(`${e}: ${t}`,s)}),this.longpollerTimeout=n.longpollerTimeout||2e4,this.params=e(n.params||{}),this.endPoint=`${t}/${R}`,this.vsn=n.vsn||"2.0.0",this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.heartbeatSentAt=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new w(()=>{if(this.pageHidden)return this.log("Not reconnecting as page is hidden!"),void this.teardown();this.teardown(async()=>{n.beforeReconnect&&await n.beforeReconnect(),this.connect()})},this.reconnectAfterMs),this.authToken=n.authToken}getLongPollTransport(){return P}replaceTransport(e){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.conn&&(this.conn.close(),this.conn=null),this.transport=e}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let e=H.appendParams(H.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return"/"!==e.charAt(0)?e:"/"===e.charAt(1)?`${this.protocol()}:${e}`:`${this.protocol()}://${location.host}${e}`}disconnect(e,t,s){this.connectClock++,this.disconnecting=!0,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(()=>{this.disconnecting=!1,e&&e()},t,s)}connect(t){t&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=e(t)),this.conn&&!this.disconnecting||(this.longPollFallbackMs&&this.transport!==P?this.connectWithFallback(P,this.longPollFallbackMs):this.transportConnect())}log(e,t,s){this.logger&&this.logger(e,t,s)}hasLogger(){return null!==this.logger}onOpen(e){let t=this.makeRef();return this.stateChangeCallbacks.open.push([t,e]),t}onClose(e){let t=this.makeRef();return this.stateChangeCallbacks.close.push([t,e]),t}onError(e){let t=this.makeRef();return this.stateChangeCallbacks.error.push([t,e]),t}onMessage(e){let t=this.makeRef();return this.stateChangeCallbacks.message.push([t,e]),t}onHeartbeat(e){this.heartbeatCallback=e}ping(e){if(!this.isConnected())return!1;let t=this.makeRef(),s=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:t});let i=this.onMessage(n=>{n.ref===t&&(this.off([i]),e(Date.now()-s))});return!0}transportName(e){return e===P?"LongPoll":e.name}transportConnect(){let e;this.connectClock++,this.closeWasClean=!1,this.authToken&&(e=["phoenix",`${E}${btoa(this.authToken).replace(/=/g,"")}`]),this.conn=new this.transport(this.endPointURL(),e),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=()=>this.onConnOpen(),this.conn.onerror=e=>this.onConnError(e),this.conn.onmessage=e=>this.onConnMessage(e),this.conn.onclose=e=>this.onConnClose(e)}getSession(e){return this.sessionStore&&this.sessionStore.getItem(e)}storeSession(e,t){this.sessionStore&&this.sessionStore.setItem(e,t)}connectWithFallback(e,t=2500){clearTimeout(this.fallbackTimer);let s,i=!1,n=!0,o=this.transportName(e),h=t=>{this.log("transport",`falling back to ${o}...`,t),this.off([void 0,s]),n=!1,this.replaceTransport(e),this.transportConnect()};if(this.getSession(`phx:fallback:${o}`))return h("memorized");this.fallbackTimer=setTimeout(h,t),s=this.onError(e=>{this.log("transport","error",e),n&&!i&&(clearTimeout(this.fallbackTimer),h(e))}),this.fallbackRef&&this.off([this.fallbackRef]),this.fallbackRef=this.onOpen(()=>{if(i=!0,!n){let t=this.transportName(e);return this.primaryPassedHealthCheck||this.storeSession(`phx:fallback:${t}`,"true"),this.log("transport",`established ${t} fallback`)}clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(h,t),this.ping(e=>{this.log("transport","connected to primary after",e),this.primaryPassedHealthCheck=!0,clearTimeout(this.fallbackTimer)})}),this.transportConnect()}clearHeartbeats(){clearTimeout(this.heartbeatTimer),clearTimeout(this.heartbeatTimeoutTimer)}onConnOpen(){this.hasLogger()&&this.log("transport",`connected to ${this.endPointURL()}`),this.closeWasClean=!1,this.disconnecting=!1,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.autoSendHeartbeat&&this.resetHeartbeat(),this.triggerStateCallbacks("open")}heartbeatTimeout(){if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.hasLogger()&&this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(e){this.log("error","error in heartbeat callback",e)}this.triggerChanError(new Error("heartbeat timeout")),this.closeWasClean=!1,this.teardown(()=>this.reconnectTimer.scheduleTimeout(),1e3,"heartbeat timeout")}}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}teardown(e,t,s){if(!this.conn)return e&&e();const i=this.conn;this.waitForBufferDone(i,()=>{t?i.close(t,s||""):i.close(),this.waitForSocketClosed(i,()=>{this.conn===i&&(this.conn.onopen=function(){},this.conn.onerror=function(){},this.conn.onmessage=function(){},this.conn.onclose=function(){},this.conn=null),e&&e()})})}waitForBufferDone(e,t,s=1){5!==s&&e.bufferedAmount?setTimeout(()=>{this.waitForBufferDone(e,t,s+1)},150*s):t()}waitForSocketClosed(e,t,s=1){5!==s&&e.readyState!==c?setTimeout(()=>{this.waitForSocketClosed(e,t,s+1)},150*s):t()}onConnClose(e){this.conn&&(this.conn.onclose=()=>{}),this.hasLogger()&&this.log("transport","close",e),this.triggerChanError(e),this.clearHeartbeats(),this.closeWasClean||this.reconnectTimer.scheduleTimeout(),this.triggerStateCallbacks("close",e)}onConnError(e){this.hasLogger()&&this.log("transport","error",e);let t=this.transport,s=this.establishedConnections;this.triggerStateCallbacks("error",e,t,s),(t===this.transport||s>0)&&this.triggerChanError(e)}triggerChanError(e){this.channels.forEach(t=>{t.isErrored()||t.isLeaving()||t.isClosed()||t.trigger(k,e)})}connectionState(){switch(this.conn&&this.conn.readyState){case n:return"connecting";case o:return"open";case h:return"closing";default:return"closed"}}isConnected(){return"open"===this.connectionState()}remove(e){this.off(e.stateChangeRefs),this.channels=this.channels.filter(t=>t!==e)}off(e){for(let t in this.stateChangeCallbacks)this.stateChangeCallbacks[t]=this.stateChangeCallbacks[t].filter(([t])=>-1===e.indexOf(t))}channel(e,t={}){let s=new A(e,t,this);return this.channels.push(s),s}push(e){if(this.hasLogger()){let{topic:t,event:s,payload:i,ref:n,join_ref:o}=e;this.log("push",`${t} ${s} (${o}, ${n})`,i)}this.isConnected()?this.encode(e,e=>this.conn.send(e)):this.sendBuffer.push(()=>this.encode(e,e=>this.conn.send(e)))}makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}sendHeartbeat(){if(this.isConnected())if(this.pendingHeartbeatRef)this.heartbeatTimeout();else{this.pendingHeartbeatRef=this.makeRef(),this.heartbeatSentAt=Date.now(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(e){this.log("error","error in heartbeat callback",e)}this.heartbeatTimeoutTimer=setTimeout(()=>this.heartbeatTimeout(),this.heartbeatIntervalMs)}else try{this.heartbeatCallback("disconnected")}catch(e){this.log("error","error in heartbeat callback",e)}}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}onConnMessage(e){this.decode(e.data,e=>{let{topic:t,event:s,payload:i,ref:n,join_ref:o}=e;if(n&&n===this.pendingHeartbeatRef){const e=this.heartbeatSentAt?Date.now()-this.heartbeatSentAt:void 0;this.clearHeartbeats();try{this.heartbeatCallback("ok"===i.status?"ok":"error",e)}catch(e){this.log("error","error in heartbeat callback",e)}this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.autoSendHeartbeat&&(this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}this.hasLogger()&&this.log("receive",`${i.status||""} ${t} ${s} ${n&&"("+n+")"||""}`.trim(),i);for(let e=0;e{try{i(...t)}catch(t){this.log("error",`error in ${e} callback`,t)}})}catch(t){this.log("error",`error triggering ${e} callbacks`,t)}}leaveOpenTopic(e){let t=this.channels.find(t=>t.topic===e&&(t.isJoined()||t.isJoining()));t&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${e}"`),t.leave())}}},1171,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.normalizeChannelError=function(n){if(n instanceof Error)return n;if('string'==typeof n)return new Error(n);if(n&&'object'==typeof n){const o=n;if('number'==typeof o.code){const t='string'==typeof o.reason&&o.reason?` (${o.reason})`:'';return new Error(`socket closed: ${o.code}${t}`,{cause:n})}return new Error('channel error: transport failure',{cause:n})}return new Error('channel error: connection lost')}},1172,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}});var n=r(d[0]);class t{constructor(n,t,s){const h=(o=s,{config:Object.assign({broadcast:{ack:!1,self:!1},presence:{key:'',enabled:!1},private:!1},o.config)});var o;this.channel=n.getSocket().channel(t,h),this.socket=n}get state(){return this.channel.state}set state(n){this.channel.state=n}get joinedOnce(){return this.channel.joinedOnce}get joinPush(){return this.channel.joinPush}get rejoinTimer(){return this.channel.rejoinTimer}on(n,t){return this.channel.on(n,t)}off(n,t){this.channel.off(n,t)}subscribe(n){return this.channel.join(n)}unsubscribe(n){return this.channel.leave(n)}teardown(){this.channel.teardown()}onClose(n){this.channel.onClose(n)}onError(n){return this.channel.onError(n)}push(t,s,h){let o;try{o=this.channel.push(t,s,h)}catch(n){throw new Error(`tried to push '${t}' to '${this.channel.topic}' before joining. Use channel.subscribe() before pushing events`)}if(this.channel.pushBuffer.length>n.MAX_PUSH_BUFFER_SIZE){const n=this.channel.pushBuffer.shift();n.cancelTimeout(),this.socket.log('channel',`discarded push due to buffer overflow: ${n.event}`,n.payload())}return o}updateJoinPayload(n){const t=this.channel.joinPush.payload();this.channel.joinPush.payload=()=>Object.assign(Object.assign({},t),n)}canPush(){return this.socket.isConnected()&&this.state===n.CHANNEL_STATES.joined}isJoined(){return this.state===n.CHANNEL_STATES.joined}isJoining(){return this.state===n.CHANNEL_STATES.joining}isClosed(){return this.state===n.CHANNEL_STATES.closed}isLeaving(){return this.state===n.CHANNEL_STATES.leaving}updateFilterBindings(n){this.channel.filterBindings=n}updatePayloadTransform(n){this.channel.onMessage=n}getChannel(){return this.channel}}},1173,[1164]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"RealtimePostgresFilterBuilder",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"postgresChangesFilter",{enumerable:!0,get:function(){return c}});const t=/[,()"\\]/,n=n=>t.test(n)||n!==n.trim(),s=t=>`"${t.replace(/\\/g,'\\\\').replace(/"/g,'\\"')}"`,u=t=>{const u=null===t?'null':String(t);return n(u)?s(u):u},l=t=>null===t?'null':String(t),h=(t,n)=>{if('in'===t){const t=Array.isArray(n)?n:[n];if(0===t.length)throw new Error('Realtime `in` filter requires at least one value.');return`in.(${Array.from(new Set(t)).map(t=>u(t)).join(',')})`}return'is'===t?`is.${l(n)}`:`${t}.${u(n)}`};class o{constructor(){this.filters=[]}add(t,n,s,u=!1){const l=u?'not.':'';return this.filters.push(`${t}=${l}${h(n,s)}`),this}eq(t,n){return this.add(t,'eq',n)}neq(t,n){return this.add(t,'neq',n)}gt(t,n){return this.add(t,'gt',n)}gte(t,n){return this.add(t,'gte',n)}lt(t,n){return this.add(t,'lt',n)}lte(t,n){return this.add(t,'lte',n)}in(t,n){return this.add(t,'in',n)}like(t,n){return this.add(t,'like',n)}ilike(t,n){return this.add(t,'ilike',n)}match(t,n){return this.add(t,'match',n)}imatch(t,n){return this.add(t,'imatch',n)}is(t,n){return this.add(t,'is',n)}isDistinct(t,n){return this.add(t,'isdistinct',n)}not(t,n,s){return this.add(t,n,s,!0)}build(){return this.filters.join(',')}toString(){return this.build()}}const c=()=>new o},1174,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return s}});var t=r(d[0]),n=r(d[1]);class s{constructor(n,s){this.socket=new t.Socket(n,s)}get timeout(){return this.socket.timeout}get endPoint(){return this.socket.endPoint}get transport(){return this.socket.transport}get heartbeatIntervalMs(){return this.socket.heartbeatIntervalMs}get heartbeatCallback(){return this.socket.heartbeatCallback}set heartbeatCallback(t){this.socket.heartbeatCallback=t}get heartbeatTimer(){return this.socket.heartbeatTimer}get pendingHeartbeatRef(){return this.socket.pendingHeartbeatRef}get reconnectTimer(){return this.socket.reconnectTimer}get vsn(){return this.socket.vsn}get encode(){return this.socket.encode}get decode(){return this.socket.decode}get reconnectAfterMs(){return this.socket.reconnectAfterMs}get sendBuffer(){return this.socket.sendBuffer}get stateChangeCallbacks(){return this.socket.stateChangeCallbacks}connect(){this.socket.connect()}disconnect(t,n,s,o=1e4){return new Promise(c=>{setTimeout(()=>c('timeout'),o),this.socket.disconnect(()=>{t(),c('ok')},n,s)})}push(t){this.socket.push(t)}log(t,n,s){this.socket.log(t,n,s)}makeRef(){return this.socket.makeRef()}onOpen(t){this.socket.onOpen(t)}onClose(t){this.socket.onClose(t)}onError(t){this.socket.onError(t)}onMessage(t){this.socket.onMessage(t)}isConnected(){return this.socket.isConnected()}isConnecting(){return this.socket.connectionState()==n.CONNECTION_STATE.connecting}isDisconnecting(){return this.socket.connectionState()==n.CONNECTION_STATE.closing}connectionState(){return this.socket.connectionState()}endPointURL(){return this.socket.endPointURL()}sendHeartbeat(){this.socket.sendHeartbeat()}getSocket(){return this.socket}}},1175,[1171,1164]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"StorageAnalyticsClient",{enumerable:!0,get:function(){return H}}),Object.defineProperty(_e,"StorageApiError",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"StorageClient",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(_e,"StorageError",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"StorageUnknownError",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"StorageVectorsApiError",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"StorageVectorsClient",{enumerable:!0,get:function(){return X}}),Object.defineProperty(_e,"StorageVectorsError",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"StorageVectorsErrorCode",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"StorageVectorsUnknownError",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"VectorBucketApi",{enumerable:!0,get:function(){return W}}),Object.defineProperty(_e,"VectorBucketScope",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(_e,"VectorDataApi",{enumerable:!0,get:function(){return G}}),Object.defineProperty(_e,"VectorIndexApi",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(_e,"VectorIndexScope",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(_e,"isStorageError",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"isStorageVectorsError",{enumerable:!0,get:function(){return f}});var e=_r(d[0]);function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(e,r){if("object"!=t(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,r||"default");if("object"!=t(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}function n(e){var n=r(e,"string");return"symbol"==t(n)?n:n+""}function o(e,t,r){return(t=n(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function c(e){for(var t=1;t{if("object"!=typeof e||null===e)return!1;const t=Object.getPrototypeOf(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},k=e=>{if(Array.isArray(e))return e.map(e=>k(e));if("function"==typeof e||e!==Object(e))return e;const t={};return Object.entries(e).forEach(([e,r])=>{const n=e.replace(/([-_][a-z])/gi,e=>e.toUpperCase().replace(/[-_]/g,""));t[n]=k(r)}),t},x=e=>!(!e||"string"!=typeof e)&&(!(0===e.length||e.length>100)&&(e.trim()===e&&(!e.includes("/")&&!e.includes("\\")&&/^[\w!.\*'() &$@=;:+,?-]+$/.test(e)))),$=e=>{if("object"==typeof e&&null!==e){const t=e;if("string"==typeof t.msg)return t.msg;if("string"==typeof t.message)return t.message;if("string"==typeof t.error_description)return t.error_description;if("string"==typeof t.error)return t.error;if("object"==typeof t.error&&null!==t.error){const e=t.error;if("string"==typeof e.message)return e.message}}return JSON.stringify(e)},j=async(e,t,r,n)=>{if(null!==e&&"object"==typeof e&&"json"in e&&"function"==typeof e.json){const r=e;let o=parseInt(String(r.status),10);Number.isFinite(o)||(o=500),r.json().then(e=>{const r=(null==e?void 0:e.statusCode)||(null==e?void 0:e.code)||o+"";t(new l($(e),o,r,n))}).catch(()=>{const e=o+"";t(new l(r.statusText||`HTTP ${o} error`,o,e,n))})}else t(new h($(e),e,n))},B=(e,t,r,n)=>{const o={method:e,headers:(null==t?void 0:t.headers)||{}};if("GET"===e||"HEAD"===e||!n)return c(c({},o),r);if(S(n)){var s;const e=(null==t?void 0:t.headers)||{};let r;for(const[t,n]of Object.entries(e))"content-type"===t.toLowerCase()&&(r=n);o.headers=w(e,"Content-Type",null!==(s=r)&&void 0!==s?s:"application/json"),o.body=JSON.stringify(n)}else o.body=n;return(null==t?void 0:t.duplex)&&(o.duplex=t.duplex),c(c({},o),r)};async function P(e,t,r,n,o,s,c){return new Promise((i,u)=>{e(r,B(t,n,o,s)).then(e=>{if(!e.ok)throw e;if(null==n?void 0:n.noResolveJson)return e;if("vectors"===c){const t=e.headers.get("content-type");if("0"===e.headers.get("content-length")||204===e.status)return{};if(!t||!t.includes("application/json"))return{}}return e.json()}).then(e=>i(e)).catch(e=>j(e,u,0,c))})}function N(e="storage"){return{get:async(t,r,n,o)=>P(t,"GET",r,n,o,void 0,e),post:async(t,r,n,o,s)=>P(t,"POST",r,o,s,n,e),put:async(t,r,n,o,s)=>P(t,"PUT",r,o,s,n,e),head:async(t,r,n,o)=>P(t,"HEAD",r,c(c({},n),{},{noResolveJson:!0}),o,void 0,e),remove:async(t,r,n,o,s)=>P(t,"DELETE",r,o,s,n,e)}}const E=N("storage"),{get:C,post:V,put:I,head:T,remove:U}=E,_=N("vectors");var F=class{constructor(e,t={},r,n="storage"){var o;this.shouldThrowOnError=!1,this.url=e,this.headers=O(t),this.fetch=(o=r)?(...e)=>o(...e):(...e)=>fetch(...e),this.namespace=n}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,t){return this.headers=w(this.headers,e,t),this}async handleOperation(e){try{return{data:await e(),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(u(e))return{data:null,error:e};throw e}}};let R;R=Symbol.toStringTag;var L=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[R]="StreamDownloadBuilder",this.promise=null}then(e,t){return this.getPromise().then(e,t)}catch(e){return this.getPromise().catch(e)}finally(e){return this.getPromise().finally(e)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){try{return{data:(await this.downloadFn()).body,error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(u(e))return{data:null,error:e};throw e}}};let D;D=Symbol.toStringTag;var A=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[D]="BlobDownloadBuilder",this.promise=null}asStream(){return new L(this.downloadFn,this.shouldThrowOnError)}then(e,t){return this.getPromise().then(e,t)}catch(e){return this.getPromise().catch(e)}finally(e){return this.getPromise().finally(e)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){try{return{data:await(await this.downloadFn()).blob(),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(u(e))return{data:null,error:e};throw e}}};const M={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},z={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var J=class extends F{constructor(e,t={},r,n){super(e,t,n,"storage"),this.bucketId=r}async uploadOrUpdate(e,t,r,n){var o=this;return o.handleOperation(async()=>{let s;const i=c(c({},z),n);let u=c(c({},o.headers),"POST"===e&&{"x-upsert":String(i.upsert)});const l=i.metadata;if("undefined"!=typeof Blob&&r instanceof Blob?(s=new FormData,s.append("cacheControl",i.cacheControl),l&&s.append("metadata",o.encodeMetadata(l)),s.append("",r)):"undefined"!=typeof FormData&&r instanceof FormData?(s=r,s.has("cacheControl")||s.append("cacheControl",i.cacheControl),l&&!s.has("metadata")&&s.append("metadata",o.encodeMetadata(l))):(s=r,u["cache-control"]=`max-age=${i.cacheControl}`,u["content-type"]=i.contentType,l&&(u["x-metadata"]=o.toBase64(o.encodeMetadata(l))),("undefined"!=typeof ReadableStream&&s instanceof ReadableStream||s&&"object"==typeof s&&"pipe"in s&&"function"==typeof s.pipe)&&!i.duplex&&(i.duplex="half")),null==n?void 0:n.headers)for(const[e,t]of Object.entries(n.headers))u=w(u,e,t);const h=o._removeEmptyFolders(t),p=o._getFinalPath(h),f=await("PUT"==e?I:V)(o.fetch,`${o.url}/object/${p}`,s,c({headers:u},(null==i?void 0:i.duplex)?{duplex:i.duplex}:{}));return{path:h,id:f.Id,fullPath:f.Key}})}async upload(e,t,r){return this.uploadOrUpdate("POST",e,t,r)}async uploadToSignedUrl(e,t,r,n){var o=this;const s=o._removeEmptyFolders(e),i=o._getFinalPath(s),u=new URL(o.url+`/object/upload/sign/${i}`);return u.searchParams.set("token",t),o.handleOperation(async()=>{let e;const t=c(c({},z),n);let i=c(c({},o.headers),{"x-upsert":String(t.upsert)});const l=t.metadata;if("undefined"!=typeof Blob&&r instanceof Blob?(e=new FormData,e.append("cacheControl",t.cacheControl),l&&e.append("metadata",o.encodeMetadata(l)),e.append("",r)):"undefined"!=typeof FormData&&r instanceof FormData?(e=r,e.has("cacheControl")||e.append("cacheControl",t.cacheControl),l&&!e.has("metadata")&&e.append("metadata",o.encodeMetadata(l))):(e=r,i["cache-control"]=`max-age=${t.cacheControl}`,i["content-type"]=t.contentType,l&&(i["x-metadata"]=o.toBase64(o.encodeMetadata(l))),("undefined"!=typeof ReadableStream&&e instanceof ReadableStream||e&&"object"==typeof e&&"pipe"in e&&"function"==typeof e.pipe)&&!t.duplex&&(t.duplex="half")),null==n?void 0:n.headers)for(const[e,t]of Object.entries(n.headers))i=w(i,e,t);return{path:s,fullPath:(await I(o.fetch,u.toString(),e,c({headers:i},(null==t?void 0:t.duplex)?{duplex:t.duplex}:{}))).Key}})}async createSignedUploadUrl(e,t){var r=this;return r.handleOperation(async()=>{let n=r._getFinalPath(e);const o=c({},r.headers);(null==t?void 0:t.upsert)&&(o["x-upsert"]="true");const s=await V(r.fetch,`${r.url}/object/upload/sign/${n}`,{},{headers:o}),u=new URL(r.url+s.url),l=u.searchParams.get("token");if(!l)throw new i("No token returned by API");return{signedUrl:u.toString(),path:e,token:l}})}async update(e,t,r){return this.uploadOrUpdate("PUT",e,t,r)}async move(e,t,r){var n=this;return n.handleOperation(async()=>await V(n.fetch,`${n.url}/object/move`,{bucketId:n.bucketId,sourceKey:e,destinationKey:t,destinationBucket:null==r?void 0:r.destinationBucket},{headers:n.headers}))}async copy(e,t,r){var n=this;return n.handleOperation(async()=>({path:(await V(n.fetch,`${n.url}/object/copy`,{bucketId:n.bucketId,sourceKey:e,destinationKey:t,destinationBucket:null==r?void 0:r.destinationBucket},{headers:n.headers})).Key}))}async createSignedUrl(e,t,r){var n=this;return n.handleOperation(async()=>{let o=n._getFinalPath(e);const s="object"==typeof(null==r?void 0:r.transform)&&null!==r.transform&&Object.keys(r.transform).length>0;let i=await V(n.fetch,`${n.url}/object/sign/${o}`,c({expiresIn:t},s?{transform:r.transform}:{}),{headers:n.headers});const u=new URLSearchParams;(null==r?void 0:r.download)&&u.set("download",!0===r.download?"":r.download),null!=(null==r?void 0:r.cacheNonce)&&u.set("cacheNonce",String(r.cacheNonce));const l=u.toString();return{signedUrl:encodeURI(`${n.url}${i.signedURL}${l?`&${l}`:""}`)}})}async createSignedUrls(e,t,r){var n=this;return n.handleOperation(async()=>{const o=await V(n.fetch,`${n.url}/object/sign/${n.bucketId}`,{expiresIn:t,paths:e},{headers:n.headers}),s=new URLSearchParams;(null==r?void 0:r.download)&&s.set("download",!0===r.download?"":r.download),null!=(null==r?void 0:r.cacheNonce)&&s.set("cacheNonce",String(r.cacheNonce));const i=s.toString();return o.map(e=>c(c({},e),{},{signedUrl:e.signedURL?encodeURI(`${n.url}${e.signedURL}${i?`&${i}`:""}`):null}))})}download(e,t,r){const n="object"==typeof(null==t?void 0:t.transform)&&null!==t.transform&&Object.keys(t.transform).length>0?"render/image/authenticated":"object",o=new URLSearchParams;(null==t?void 0:t.transform)&&this.applyTransformOptsToQuery(o,t.transform),null!=(null==t?void 0:t.cacheNonce)&&o.set("cacheNonce",String(t.cacheNonce));const s=o.toString(),c=this._getFinalPath(e);return new A(()=>C(this.fetch,`${this.url}/${n}/${c}${s?`?${s}`:""}`,{headers:this.headers,noResolveJson:!0},r),this.shouldThrowOnError)}async info(e){var t=this;const r=t._getFinalPath(e);return t.handleOperation(async()=>k(await C(t.fetch,`${t.url}/object/info/${r}`,{headers:t.headers})))}async exists(e){var t=this;const r=t._getFinalPath(e);try{return await T(t.fetch,`${t.url}/object/${r}`,{headers:t.headers}),{data:!0,error:null}}catch(e){if(t.shouldThrowOnError)throw e;if(u(e)){var n;const t=e instanceof l?e.status:e instanceof h?null===(n=e.originalError)||void 0===n?void 0:n.status:void 0;if(void 0!==t&&[400,404].includes(t))return{data:!1,error:e}}throw e}}getPublicUrl(e,t){const r=this._getFinalPath(e),n=new URLSearchParams;(null==t?void 0:t.download)&&n.set("download",!0===t.download?"":t.download),(null==t?void 0:t.transform)&&this.applyTransformOptsToQuery(n,t.transform),null!=(null==t?void 0:t.cacheNonce)&&n.set("cacheNonce",String(t.cacheNonce));const o=n.toString(),s="object"==typeof(null==t?void 0:t.transform)&&null!==t.transform&&Object.keys(t.transform).length>0?"render/image":"object";return{data:{publicUrl:encodeURI(`${this.url}/${s}/public/${r}`)+(o?`?${o}`:"")}}}async remove(e){var t=this;return t.handleOperation(async()=>await U(t.fetch,`${t.url}/object/${t.bucketId}`,{prefixes:e},{headers:t.headers}))}async purgeCache(e,t,r){var n=this;return n.handleOperation(async()=>{const o=n._getFinalPath(e),s=new URLSearchParams;(null==t?void 0:t.transformations)&&s.set("transformations","true");const c=s.toString();return await U(n.fetch,`${n.url}/cdn/${o}${c?`?${c}`:""}`,{},{headers:n.headers},r)})}async list(e,t,r){var n=this;return n.handleOperation(async()=>{const o=(null==t?void 0:t.sortBy)?c(c({},M.sortBy),t.sortBy):M.sortBy,s=c(c(c({},M),t),{},{sortBy:o,prefix:e||""});return await V(n.fetch,`${n.url}/object/list/${n.bucketId}`,s,{headers:n.headers},r)})}async listV2(e,t){var r=this;return r.handleOperation(async()=>{const n=c({},e);return await V(r.fetch,`${r.url}/object/list-v2/${r.bucketId}`,n,{headers:r.headers},t)})}encodeMetadata(e){return JSON.stringify(e)}toBase64(e){return"undefined"!=typeof Buffer?Buffer.from(e).toString("base64"):btoa(e)}_getFinalPath(e){return`${this.bucketId}/${e.replace(/^\/+/,"")}`}_removeEmptyFolders(e){return e.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}applyTransformOptsToQuery(e,t){return t.width&&e.set("width",t.width.toString()),t.height&&e.set("height",t.height.toString()),t.resize&&e.set("resize",t.resize),t.format&&e.set("format",t.format),t.quality&&e.set("quality",t.quality.toString()),e}};const K={"X-Client-Info":"storage-js/2.109.0"};var q=class extends F{constructor(e,t={},r,n){const o=new URL(e);(null==n?void 0:n.useNewHostname)&&/supabase\.(co|in|red)$/.test(o.hostname)&&!o.hostname.includes("storage.supabase.")&&(o.hostname=o.hostname.replace("supabase.","storage.supabase."));super(o.href.replace(/\/$/,""),c(c({},K),t),r,"storage")}async listBuckets(e){var t=this;return t.handleOperation(async()=>{const r=t.listBucketOptionsToQueryString(e);return await C(t.fetch,`${t.url}/bucket${r}`,{headers:t.headers})})}async getBucket(e){var t=this;return t.handleOperation(async()=>await C(t.fetch,`${t.url}/bucket/${e}`,{headers:t.headers}))}async createBucket(e,t={public:!1}){var r=this;return r.handleOperation(async()=>await V(r.fetch,`${r.url}/bucket`,{id:e,name:e,type:t.type,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:r.headers}))}async updateBucket(e,t){var r=this;return r.handleOperation(async()=>await I(r.fetch,`${r.url}/bucket/${e}`,{id:e,name:e,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:r.headers}))}async emptyBucket(e){var t=this;return t.handleOperation(async()=>await V(t.fetch,`${t.url}/bucket/${e}/empty`,{},{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await U(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}))}async purgeBucketCache(e,t,r){var n=this;return n.handleOperation(async()=>{const o=new URLSearchParams;(null==t?void 0:t.transformations)&&o.set("transformations","true");const s=o.toString();return await U(n.fetch,`${n.url}/cdn/${e}${s?`?${s}`:""}`,{},{headers:n.headers},r)})}listBucketOptionsToQueryString(e){const t={};return e&&("limit"in e&&(t.limit=String(e.limit)),"offset"in e&&(t.offset=String(e.offset)),e.search&&(t.search=e.search),e.sortColumn&&(t.sortColumn=e.sortColumn),e.sortOrder&&(t.sortOrder=e.sortOrder)),Object.keys(t).length>0?"?"+new URLSearchParams(t).toString():""}},H=class extends F{constructor(e,t={},r){super(e.replace(/\/$/,""),c(c({},K),t),r,"storage")}async createBucket(e){var t=this;return t.handleOperation(async()=>await V(t.fetch,`${t.url}/bucket`,{name:e},{headers:t.headers}))}async listBuckets(e){var t=this;return t.handleOperation(async()=>{const r=new URLSearchParams;void 0!==(null==e?void 0:e.limit)&&r.set("limit",e.limit.toString()),void 0!==(null==e?void 0:e.offset)&&r.set("offset",e.offset.toString()),(null==e?void 0:e.sortColumn)&&r.set("sortColumn",e.sortColumn),(null==e?void 0:e.sortOrder)&&r.set("sortOrder",e.sortOrder),(null==e?void 0:e.search)&&r.set("search",e.search);const n=r.toString(),o=n?`${t.url}/bucket?${n}`:`${t.url}/bucket`;return await C(t.fetch,o,{headers:t.headers})})}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await U(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}))}from(t){var r=this;if(!x(t))throw new i("Invalid bucket name: File, folder, and bucket names must follow AWS object key naming guidelines and should avoid the use of any other characters.");const n=new e.IcebergRestCatalog({baseUrl:this.url,catalogName:t,auth:{type:"custom",getHeaders:async()=>r.headers},fetch:this.fetch}),o=this.shouldThrowOnError;return new Proxy(n,{get(e,t){const r=e[t];return"function"!=typeof r?r:async(...t)=>{try{return{data:await r.apply(e,t),error:null}}catch(e){if(o)throw e;return{data:null,error:e}}}}})}},Q=class extends F{constructor(e,t={},r){super(e.replace(/\/$/,""),c(c({},K),{},{"Content-Type":"application/json"},t),r,"vectors")}async createIndex(e){var t=this;return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/CreateIndex`,e,{headers:t.headers})||{})}async getIndex(e,t){var r=this;return r.handleOperation(async()=>await _.post(r.fetch,`${r.url}/GetIndex`,{vectorBucketName:e,indexName:t},{headers:r.headers}))}async listIndexes(e){var t=this;return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/ListIndexes`,e,{headers:t.headers}))}async deleteIndex(e,t){var r=this;return r.handleOperation(async()=>await _.post(r.fetch,`${r.url}/DeleteIndex`,{vectorBucketName:e,indexName:t},{headers:r.headers})||{})}},G=class extends F{constructor(e,t={},r){super(e.replace(/\/$/,""),c(c({},K),{},{"Content-Type":"application/json"},t),r,"vectors")}async putVectors(e){var t=this;if(e.vectors.length<1||e.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/PutVectors`,e,{headers:t.headers})||{})}async getVectors(e){var t=this;return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/GetVectors`,e,{headers:t.headers}))}async listVectors(e){var t=this;if(void 0!==e.segmentCount){if(e.segmentCount<1||e.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(void 0!==e.segmentIndex&&(e.segmentIndex<0||e.segmentIndex>=e.segmentCount))throw new Error("segmentIndex must be between 0 and "+(e.segmentCount-1))}return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/ListVectors`,e,{headers:t.headers}))}async queryVectors(e){var t=this;return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/QueryVectors`,e,{headers:t.headers}))}async deleteVectors(e){var t=this;if(e.keys.length<1||e.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/DeleteVectors`,e,{headers:t.headers})||{})}},W=class extends F{constructor(e,t={},r){super(e.replace(/\/$/,""),c(c({},K),{},{"Content-Type":"application/json"},t),r,"vectors")}async createBucket(e){var t=this;return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}async getBucket(e){var t=this;return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/GetVectorBucket`,{vectorBucketName:e},{headers:t.headers}))}async listBuckets(e={}){var t=this;return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/ListVectorBuckets`,e,{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}},X=class extends W{constructor(e,t={}){super(e,t.headers||{},t.fetch)}from(e){return new Y(this.url,this.headers,e,this.fetch)}async createBucket(e){return(()=>super.createBucket)().call(this,e)}async getBucket(e){return(()=>super.getBucket)().call(this,e)}async listBuckets(e={}){return(()=>super.listBuckets)().call(this,e)}async deleteBucket(e){return(()=>super.deleteBucket)().call(this,e)}},Y=class extends Q{constructor(e,t,r,n){super(e,t,n),this.vectorBucketName=r}async createIndex(e){return(()=>super.createIndex)().call(this,c(c({},e),{},{vectorBucketName:this.vectorBucketName}))}async listIndexes(e={}){return(()=>super.listIndexes)().call(this,c(c({},e),{},{vectorBucketName:this.vectorBucketName}))}async getIndex(e){return(()=>super.getIndex)().call(this,this.vectorBucketName,e)}async deleteIndex(e){return(()=>super.deleteIndex)().call(this,this.vectorBucketName,e)}index(e){return new Z(this.url,this.headers,this.vectorBucketName,e,this.fetch)}},Z=class extends G{constructor(e,t,r,n,o){super(e,t,o),this.vectorBucketName=r,this.indexName=n}async putVectors(e){var t=this;return(()=>super.putVectors)().call(t,c(c({},e),{},{vectorBucketName:t.vectorBucketName,indexName:t.indexName}))}async getVectors(e){var t=this;return(()=>super.getVectors)().call(t,c(c({},e),{},{vectorBucketName:t.vectorBucketName,indexName:t.indexName}))}async listVectors(e={}){var t=this;return(()=>super.listVectors)().call(t,c(c({},e),{},{vectorBucketName:t.vectorBucketName,indexName:t.indexName}))}async queryVectors(e){var t=this;return(()=>super.queryVectors)().call(t,c(c({},e),{},{vectorBucketName:t.vectorBucketName,indexName:t.indexName}))}async deleteVectors(e){var t=this;return(()=>super.deleteVectors)().call(t,c(c({},e),{},{vectorBucketName:t.vectorBucketName,indexName:t.indexName}))}},ee=class extends q{constructor(e,t={},r,n){super(e,t,r,n)}from(e){return new J(this.url,this.headers,e,this.fetch)}get vectors(){return new X(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new H(this.url+"/iceberg",this.headers,this.fetch)}}},1176,[1177]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IcebergError",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"IcebergRestCatalog",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"getCurrentSchema",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"isDecimalType",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"isFixedType",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"parseDecimalType",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"parseFixedType",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"typesEqual",{enumerable:!0,get:function(){return x}});var t=class extends Error{constructor(t,a){super(t),this.name="IcebergError",this.status=a.status,this.icebergType=a.icebergType,this.icebergCode=a.icebergCode,this.details=a.details,this.isCommitStateUnknown="CommitStateUnknownException"===a.icebergType||[500,502,504].includes(a.status)&&!0===a.icebergType?.includes("CommitState")}isNotFound(){return 404===this.status}isConflict(){return 409===this.status}isAuthenticationTimeout(){return 419===this.status}};function a(t,a,s){const n=new URL(a,t);if(s)for(const[t,a]of Object.entries(s))void 0!==a&&n.searchParams.set(t,a);return n.toString()}async function s(t){return t&&"none"!==t.type?"bearer"===t.type?{Authorization:`Bearer ${t.token}`}:"header"===t.type?{[t.name]:t.value}:"custom"===t.type?await t.getHeaders():{}:{}}function n(n){const c=n.fetchImpl??globalThis.fetch;return{async request({method:o,path:p,query:u,body:l,headers:h}){const b=a(n.baseUrl,p,u),f=await s(n.auth),y=await c(b,{method:o,headers:{...l?{"Content-Type":"application/json"}:{},...f,...h},body:l?JSON.stringify(l):void 0}),T=await y.text(),w=(y.headers.get("content-type")||"").includes("application/json"),x=w&&T?JSON.parse(T):T;if(!y.ok){const a=w?x:void 0,s=a?.error;throw new t(s?.message??`Request failed with status ${y.status}`,{status:y.status,icebergType:s?.type,icebergCode:s?.code,details:a})}return{status:y.status,headers:y.headers,data:x}}}}function c(t){return t.join("\x1f")}var o=class{constructor(t,a=""){this.client=t,this.prefix=a}async listNamespaces(t){const a=t?{parent:c(t.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:a})).data.namespaces.map(t=>({namespace:t}))}async createNamespace(t,a){const s={namespace:t.namespace,properties:a?.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:s})).data}async dropNamespace(t){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${c(t.namespace)}`})}async loadNamespaceMetadata(t){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${c(t.namespace)}`})).data.properties}}async namespaceExists(a){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${c(a.namespace)}`}),!0}catch(a){if(a instanceof t&&404===a.status)return!1;throw a}}async createNamespaceIfNotExists(a,s){try{return await this.createNamespace(a,s)}catch(a){if(a instanceof t&&409===a.status)return;throw a}}};function p(t){return t.join("\x1f")}var u=class{constructor(t,a="",s){this.client=t,this.prefix=a,this.accessDelegation=s}async listTables(t){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${p(t.namespace)}/tables`})).data.identifiers}async createTable(t,a){const s={};this.accessDelegation&&(s["X-Iceberg-Access-Delegation"]=this.accessDelegation);return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${p(t.namespace)}/tables`,body:a,headers:s})).data.metadata}async updateTable(t,a){const s=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${p(t.namespace)}/tables/${t.name}`,body:a});return{"metadata-location":s.data["metadata-location"],metadata:s.data.metadata}}async dropTable(t,a){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${p(t.namespace)}/tables/${t.name}`,query:{purgeRequested:String(a?.purge??!1)}})}async loadTable(t){const a={};this.accessDelegation&&(a["X-Iceberg-Access-Delegation"]=this.accessDelegation);return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${p(t.namespace)}/tables/${t.name}`,headers:a})).data.metadata}async tableExists(a){const s={};this.accessDelegation&&(s["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${p(a.namespace)}/tables/${a.name}`,headers:s}),!0}catch(a){if(a instanceof t&&404===a.status)return!1;throw a}}async createTableIfNotExists(a,s){try{return await this.createTable(a,s)}catch(n){if(n instanceof t&&409===n.status)return await this.loadTable({namespace:a.namespace,name:s.name});throw n}}},l=class{constructor(t){let a="v1";t.catalogName&&(a+=`/${t.catalogName}`);const s=t.baseUrl.endsWith("/")?t.baseUrl:`${t.baseUrl}/`;this.client=n({baseUrl:s,auth:t.auth,fetchImpl:t.fetch}),this.accessDelegation=t.accessDelegation?.join(","),this.namespaceOps=new o(this.client,a),this.tableOps=new u(this.client,a,this.accessDelegation)}async listNamespaces(t){return this.namespaceOps.listNamespaces(t)}async createNamespace(t,a){return this.namespaceOps.createNamespace(t,a)}async dropNamespace(t){await this.namespaceOps.dropNamespace(t)}async loadNamespaceMetadata(t){return this.namespaceOps.loadNamespaceMetadata(t)}async listTables(t){return this.tableOps.listTables(t)}async createTable(t,a){return this.tableOps.createTable(t,a)}async updateTable(t,a){return this.tableOps.updateTable(t,a)}async dropTable(t,a){await this.tableOps.dropTable(t,a)}async loadTable(t){return this.tableOps.loadTable(t)}async namespaceExists(t){return this.namespaceOps.namespaceExists(t)}async tableExists(t){return this.tableOps.tableExists(t)}async createNamespaceIfNotExists(t,a){return this.namespaceOps.createNamespaceIfNotExists(t,a)}async createTableIfNotExists(t,a){return this.tableOps.createTableIfNotExists(t,a)}},h=/^decimal\s*\(\s*(\d+)\s*,\s*(\d+)\s*\)$/,b=/^fixed\s*\[\s*(\d+)\s*\]$/;function f(t){const a=t.match(h);return a?{precision:parseInt(a[1],10),scale:parseInt(a[2],10)}:null}function y(t){const a=t.match(b);return a?{length:parseInt(a[1],10)}:null}function T(t){return h.test(t)}function w(t){return b.test(t)}function x(t,a){const s=f(t),n=f(a);if(s&&n)return s.precision===n.precision&&s.scale===n.scale;const c=y(t),o=y(a);return c&&o?c.length===o.length:t===a}function O(t){return t.schemas.find(a=>a["schema-id"]===t["current-schema-id"])}},1177,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"navigatorLock",{enumerable:!0,get:function(){return l.navigatorLock}}),Object.defineProperty(_e,"NavigatorLockAcquireTimeoutError",{enumerable:!0,get:function(){return l.NavigatorLockAcquireTimeoutError}}),Object.defineProperty(_e,"lockInternals",{enumerable:!0,get:function(){return l.internals}}),Object.defineProperty(_e,"processLock",{enumerable:!0,get:function(){return l.processLock}}),Object.defineProperty(_e,"GoTrueAdminApi",{enumerable:!0,get:function(){return t.default}}),Object.defineProperty(_e,"GoTrueClient",{enumerable:!0,get:function(){return n.default}}),Object.defineProperty(_e,"AuthAdminApi",{enumerable:!0,get:function(){return o.default}}),Object.defineProperty(_e,"AuthClient",{enumerable:!0,get:function(){return u.default}});var t=e(r(d[0])),n=e(r(d[1])),o=e(r(d[2])),u=e(r(d[3])),c=r(d[4]);Object.keys(c).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return c[e]}})});var f=r(d[5]);Object.keys(f).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return f[e]}})});var l=r(d[6])},1178,[1179,1187,1194,1195,1186,1184,1189]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return u}});var t=r(d[0]),s=r(d[1]),n=r(d[2]),o=r(d[3]),h=r(d[4]);class u{constructor({url:t="",headers:s={},fetch:o,experimental:h}){this.url=t,this.headers=s,this.fetch=(0,n.resolveFetch)(o),this.experimental=null!=h?h:{},this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)},this.oauth={listClients:this._listOAuthClients.bind(this),createClient:this._createOAuthClient.bind(this),getClient:this._getOAuthClient.bind(this),updateClient:this._updateOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)},this.customProviders={listProviders:this._listCustomProviders.bind(this),createProvider:this._createCustomProvider.bind(this),getProvider:this._getCustomProvider.bind(this),updateProvider:this._updateCustomProvider.bind(this),deleteProvider:this._deleteCustomProvider.bind(this)},this.passkey={listPasskeys:this._adminListPasskeys.bind(this),deletePasskey:this._adminDeletePasskey.bind(this)}}async signOut(t,n=o.SIGN_OUT_SCOPES[0]){if(o.SIGN_OUT_SCOPES.indexOf(n)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${o.SIGN_OUT_SCOPES.join(', ')}`);try{return await(0,s._request)(this.fetch,'POST',`${this.url}/logout?scope=${n}`,{headers:this.headers,jwt:t,noResolveJson:!0}),{data:null,error:null}}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async inviteUserByEmail(t,n={}){try{return await(0,s._request)(this.fetch,'POST',`${this.url}/invite`,{body:{email:t,data:n.data},headers:this.headers,redirectTo:n.redirectTo,xform:s._userResponse})}catch(t){if((0,h.isAuthError)(t))return{data:{user:null},error:t};throw t}}async generateLink(n){try{const{options:o}=n,h=(0,t.__rest)(n,["options"]),u=Object.assign(Object.assign({},h),o);return'newEmail'in h&&(u.new_email=null==h?void 0:h.newEmail,delete u.newEmail),await(0,s._request)(this.fetch,'POST',`${this.url}/admin/generate_link`,{body:u,headers:this.headers,xform:s._generateLinkResponse,redirectTo:null==o?void 0:o.redirectTo})}catch(t){if((0,h.isAuthError)(t))return{data:{properties:null,user:null},error:t};throw t}}async createUser(t){try{return await(0,s._request)(this.fetch,'POST',`${this.url}/admin/users`,{body:t,headers:this.headers,xform:s._userResponse})}catch(t){if((0,h.isAuthError)(t))return{data:{user:null},error:t};throw t}}async listUsers(t){var n,o,u,l,c,f,_;try{const h={nextPage:null,lastPage:0,total:0},y=await(0,s._request)(this.fetch,'GET',`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:null!==(o=null===(n=null==t?void 0:t.page)||void 0===n?void 0:n.toString())&&void 0!==o?o:'',per_page:null!==(l=null===(u=null==t?void 0:t.perPage)||void 0===u?void 0:u.toString())&&void 0!==l?l:''},xform:s._noResolveJsonResponse});if(y.error)throw y.error;const v=await y.json(),p=null!==(c=y.headers.get('x-total-count'))&&void 0!==c?c:0,E=null!==(_=null===(f=y.headers.get('link'))||void 0===f?void 0:f.split(','))&&void 0!==_?_:[];return E.length>0&&(E.forEach(t=>{const s=parseInt(t.split(';')[0].split('=')[1].substring(0,1)),n=JSON.parse(t.split(';')[1].split('=')[1]);h[`${n}Page`]=s}),h.total=parseInt(p)),{data:Object.assign(Object.assign({},v),h),error:null}}catch(t){if((0,h.isAuthError)(t))return{data:{users:[]},error:t};throw t}}async getUserById(t){(0,n.validateUUID)(t);try{return await(0,s._request)(this.fetch,'GET',`${this.url}/admin/users/${t}`,{headers:this.headers,xform:s._userResponse})}catch(t){if((0,h.isAuthError)(t))return{data:{user:null},error:t};throw t}}async updateUserById(t,o){(0,n.validateUUID)(t);try{return await(0,s._request)(this.fetch,'PUT',`${this.url}/admin/users/${t}`,{body:o,headers:this.headers,xform:s._userResponse})}catch(t){if((0,h.isAuthError)(t))return{data:{user:null},error:t};throw t}}async deleteUser(t,o=!1){(0,n.validateUUID)(t);try{return await(0,s._request)(this.fetch,'DELETE',`${this.url}/admin/users/${t}`,{headers:this.headers,body:{should_soft_delete:o},xform:s._userResponse})}catch(t){if((0,h.isAuthError)(t))return{data:{user:null},error:t};throw t}}async _listFactors(t){(0,n.validateUUID)(t.userId);try{const{data:n,error:o}=await(0,s._request)(this.fetch,'GET',`${this.url}/admin/users/${t.userId}/factors`,{headers:this.headers,xform:t=>({data:{factors:t},error:null})});return{data:n,error:o}}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _deleteFactor(t){(0,n.validateUUID)(t.userId),(0,n.validateUUID)(t.id);try{return{data:await(0,s._request)(this.fetch,'DELETE',`${this.url}/admin/users/${t.userId}/factors/${t.id}`,{headers:this.headers}),error:null}}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _listOAuthClients(t){var n,o,u,l,c,f,_;try{const h={nextPage:null,lastPage:0,total:0},y=await(0,s._request)(this.fetch,'GET',`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:null!==(o=null===(n=null==t?void 0:t.page)||void 0===n?void 0:n.toString())&&void 0!==o?o:'',per_page:null!==(l=null===(u=null==t?void 0:t.perPage)||void 0===u?void 0:u.toString())&&void 0!==l?l:''},xform:s._noResolveJsonResponse});if(y.error)throw y.error;const v=await y.json(),p=null!==(c=y.headers.get('x-total-count'))&&void 0!==c?c:0,E=null!==(_=null===(f=y.headers.get('link'))||void 0===f?void 0:f.split(','))&&void 0!==_?_:[];return E.length>0&&(E.forEach(t=>{const s=parseInt(t.split(';')[0].split('=')[1].substring(0,1)),n=JSON.parse(t.split(';')[1].split('=')[1]);h[`${n}Page`]=s}),h.total=parseInt(p)),{data:Object.assign(Object.assign({},v),h),error:null}}catch(t){if((0,h.isAuthError)(t))return{data:{clients:[]},error:t};throw t}}async _createOAuthClient(t){try{return await(0,s._request)(this.fetch,'POST',`${this.url}/admin/oauth/clients`,{body:t,headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _getOAuthClient(t){try{return await(0,s._request)(this.fetch,'GET',`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _updateOAuthClient(t,n){try{return await(0,s._request)(this.fetch,'PUT',`${this.url}/admin/oauth/clients/${t}`,{body:n,headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _deleteOAuthClient(t){try{return await(0,s._request)(this.fetch,'DELETE',`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _regenerateOAuthClientSecret(t){try{return await(0,s._request)(this.fetch,'POST',`${this.url}/admin/oauth/clients/${t}/regenerate_secret`,{headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _listCustomProviders(t){try{const n={};return(null==t?void 0:t.type)&&(n.type=t.type),await(0,s._request)(this.fetch,'GET',`${this.url}/admin/custom-providers`,{headers:this.headers,query:n,xform:t=>{var s;return{data:{providers:null!==(s=null==t?void 0:t.providers)&&void 0!==s?s:[]},error:null}}})}catch(t){if((0,h.isAuthError)(t))return{data:{providers:[]},error:t};throw t}}async _createCustomProvider(t){try{return await(0,s._request)(this.fetch,'POST',`${this.url}/admin/custom-providers`,{body:t,headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _getCustomProvider(t){try{return await(0,s._request)(this.fetch,'GET',`${this.url}/admin/custom-providers/${t}`,{headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _updateCustomProvider(t,n){try{return await(0,s._request)(this.fetch,'PUT',`${this.url}/admin/custom-providers/${t}`,{body:n,headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _deleteCustomProvider(t){try{return await(0,s._request)(this.fetch,'DELETE',`${this.url}/admin/custom-providers/${t}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _adminListPasskeys(t){(0,n.assertPasskeyExperimentalEnabled)(this.experimental),(0,n.validateUUID)(t.userId);try{return await(0,s._request)(this.fetch,'GET',`${this.url}/admin/users/${t.userId}/passkeys`,{headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _adminDeletePasskey(t){(0,n.assertPasskeyExperimentalEnabled)(this.experimental),(0,n.validateUUID)(t.userId),(0,n.validateUUID)(t.passkeyId);try{return await(0,s._request)(this.fetch,'DELETE',`${this.url}/admin/users/${t.userId}/passkeys/${t.passkeyId}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}}},1179,[1157,1180,1183,1186,1184]); +__d(function(g,r,_i,_a2,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.handleError=i,_e._request=async function(e,o,t,n){var a;const i=Object.assign({},null==n?void 0:n.headers);i[s.API_VERSION_HEADER_NAME]||(i[s.API_VERSION_HEADER_NAME]=s.API_VERSIONS['2024-01-01'].name);(null==n?void 0:n.jwt)&&(i.Authorization=`Bearer ${n.jwt}`);const u=null!==(a=null==n?void 0:n.query)&&void 0!==a?a:{};(null==n?void 0:n.redirectTo)&&(u.redirect_to=n.redirectTo);const l=Object.keys(u).length?'?'+new URLSearchParams(u).toString():'',_=await c(e,o,t+l,{headers:i,noResolveJson:null==n?void 0:n.noResolveJson},{},null==n?void 0:n.body);return(null==n?void 0:n.xform)?null==n?void 0:n.xform(_):{data:Object.assign({},_),error:null}},_e._sessionResponse=l,_e._sessionResponsePassword=function(e){const s=l(e);!s.error&&e.weak_password&&'object'==typeof e.weak_password&&Array.isArray(e.weak_password.reasons)&&e.weak_password.reasons.length&&e.weak_password.message&&'string'==typeof e.weak_password.message&&e.weak_password.reasons.reduce((e,s)=>e&&'string'==typeof s,!0)&&(s.data.weak_password=e.weak_password);return s},_e._userResponse=function(e){var s;return{data:{user:null!==(s=e.user)&&void 0!==s?s:e},error:null}},_e._ssoResponse=function(e){return{data:e,error:null}},_e._generateLinkResponse=function(s){const{action_link:o,email_otp:t,hashed_token:n,redirect_to:a,verification_type:i}=s,u=(0,e.__rest)(s,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),c={action_link:o,email_otp:t,hashed_token:n,redirect_to:a,verification_type:i},l=Object.assign({},u);return{data:{properties:c,user:l},error:null}},_e._noResolveJsonResponse=function(e){return e};var e=r(d[0]),s=r(d[1]),o=r(d[2]),t=r(d[3]);const n=e=>{if('object'==typeof e&&null!==e){const s=e;if('string'==typeof s.msg)return s.msg;if('string'==typeof s.message)return s.message;if('string'==typeof s.error_description)return s.error_description;if('string'==typeof s.error)return s.error}return JSON.stringify(e)},a=[500,501,502,503,504,520,521,522,523,524,525,526,527,528,529,530];async function i(e){var i;if(!(0,o.looksLikeFetchResponse)(e))throw new t.AuthRetryableFetchError(n(e),0);if(a.includes(e.status))throw new t.AuthRetryableFetchError(n(e),e.status);let u,c;try{u=await e.json()}catch(e){throw new t.AuthUnknownError(n(e),e)}const l=(0,o.parseResponseAPIVersion)(e);if(l&&l.getTime()>=s.API_VERSIONS['2024-01-01'].timestamp&&'object'==typeof u&&u&&'string'==typeof u.code?c=u.code:'object'==typeof u&&u&&'string'==typeof u.error_code&&(c=u.error_code),c){if('weak_password'===c)throw new t.AuthWeakPasswordError(n(u),e.status,(null===(i=u.weak_password)||void 0===i?void 0:i.reasons)||[]);if('session_not_found'===c)throw new t.AuthSessionMissingError}else if('object'==typeof u&&u&&'object'==typeof u.weak_password&&u.weak_password&&Array.isArray(u.weak_password.reasons)&&u.weak_password.reasons.length&&u.weak_password.reasons.reduce((e,s)=>e&&'string'==typeof s,!0))throw new t.AuthWeakPasswordError(n(u),e.status,u.weak_password.reasons);throw new t.AuthApiError(n(u),e.status||500,c)}const u=(e,s,o,t)=>{const n={method:e,headers:(null==s?void 0:s.headers)||{}};return'GET'===e?n:(n.headers=Object.assign({'Content-Type':'application/json;charset=UTF-8'},null==s?void 0:s.headers),n.body=JSON.stringify(t),Object.assign(Object.assign({},n),o))};async function c(e,s,o,a,c,l){const _=u(s,a,c,l);let p;try{p=await e(o,Object.assign({},_))}catch(e){throw console.error(e),new t.AuthRetryableFetchError(n(e),0)}if(p.ok||await i(p),null==a?void 0:a.noResolveJson)return p;try{return await p.json()}catch(e){await i(e)}}function l(e){var s;let t=null;_(e)&&(t=Object.assign({},e),e.expires_at||(t.expires_at=(0,o.expiresAt)(e.expires_in)));return{data:{session:t,user:null!==(s=e.user)&&void 0!==s?s:'string'==typeof(null==e?void 0:e.id)?e:null},error:null}}function _(e){return!!e.access_token&&!!e.refresh_token&&!!e.expires_in}},1180,[1157,1181,1183,1184]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"AUTO_REFRESH_TICK_DURATION_MS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"AUTO_REFRESH_TICK_THRESHOLD",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"EXPIRY_MARGIN_MS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"REFRESH_FAILURE_COOLDOWN_MS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"GOTRUE_URL",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"STORAGE_KEY",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"AUDIENCE",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"DEFAULT_HEADERS",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"NETWORK_FAILURE",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"API_VERSION_HEADER_NAME",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"API_VERSIONS",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"BASE64URL_REGEX",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"JWKS_TTL",{enumerable:!0,get:function(){return A}});var t=r(d[0]);const n=3e4,u=3,o=9e4,c=6e4,E='http://localhost:9999',_='supabase.auth.token',b='',f={'X-Client-Info':`gotrue-js/${t.version}`},R={MAX_RETRIES:10,RETRY_INTERVAL:2},O='X-Supabase-Api-Version',p={'2024-01-01':{timestamp:Date.parse('2024-01-01T00:00:00.0Z'),name:'2024-01-01'}},l=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,A=6e5},1181,[1182]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"version",{enumerable:!0,get:function(){return t}});const t='2.109.0'},1182,[]); +__d(function(g,r,_i,a,m,_e2,d){"use strict";Object.defineProperty(_e2,'__esModule',{value:!0}),_e2.expiresAt=function(e){return Math.round(Date.now()/1e3)+e},_e2.generateCallbackId=function(){return Symbol('auth-callback')},Object.defineProperty(_e2,"isBrowser",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e2,"supportsLocalStorage",{enumerable:!0,get:function(){return i}}),_e2.parseParametersFromURL=function(e){const t={},n=new URL(e);if(n.hash&&'#'===n.hash[0])try{new URLSearchParams(n.hash.substring(1)).forEach((e,n)=>{t[n]=e})}catch(e){}return n.searchParams.forEach((e,n)=>{t[n]=e}),t},Object.defineProperty(_e2,"resolveFetch",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e2,"looksLikeFetchResponse",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e2,"setItemAsync",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e2,"getItemAsync",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e2,"removeItemAsync",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e2,"Deferred",{enumerable:!0,get:function(){return p}}),_e2.decodeJWT=function(o){const s=o.split('.');if(3!==s.length)throw new t.AuthInvalidJwtError('Invalid JWT structure');for(let n=0;n{setTimeout(()=>t(null),e)})},_e2.retryable=function(e,t){return new Promise((n,o)=>{(async()=>{for(let s=0;s<1/0;s++)try{const o=await e(s);if(!t(s,null,o))return void n(o)}catch(e){if(!t(s,e))return void o(e)}})()})},_e2.generatePKCEVerifier=b,_e2.generatePKCEChallenge=S,_e2.getCodeChallengeAndMethod=async function(e,t,n=!1){const o=b();let s=o;n&&(s+='/recovery');await l(e,`${t}-code-verifier`,s);const i=await S(o);return[i,o===i?'plain':'s256']},_e2.parseResponseAPIVersion=function(t){const n=t.headers.get(e.API_VERSION_HEADER_NAME);if(!n)return null;if(!n.match(P))return null;try{return new Date(`${n}T00:00:00.0Z`)}catch(e){return null}},_e2.validateExp=function(e){if(!e)throw new Error('Missing exp claim');const t=Math.floor(Date.now()/1e3);if(e<=t)throw new Error('JWT has expired')},_e2.getAlgorithm=function(e){switch(e){case'RS256':return{name:'RSASSA-PKCS1-v1_5',hash:{name:'SHA-256'}};case'ES256':return{name:'ECDSA',namedCurve:'P-256',hash:{name:'SHA-256'}};default:throw new Error('Invalid alg claim')}},_e2.validateUUID=function(e){if(!A.test(e))throw new Error('@supabase/auth-js: Expected parameter to be UUID but is not')},_e2.assertPasskeyExperimentalEnabled=function(e){if(!e.passkey)throw new Error('@supabase/auth-js: the passkey API is experimental and disabled by default. Enable it by passing `auth: { experimental: { passkey: true } }` to createClient (or to the GoTrueClient constructor).')},_e2.userNotAvailableProxy=function(){return new Proxy({},{get:(e,t)=>{if('__isUserNotAvailableProxy'===t)return!0;if('symbol'==typeof t){const e=t.toString();if('Symbol(Symbol.toPrimitive)'===e||'Symbol(Symbol.toStringTag)'===e||'Symbol(util.inspect.custom)'===e)return}throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${t}" property of the session object is not supported. Please use getUser() instead.`)},set:(e,t)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${t}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(e,t)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${t}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})},_e2.insecureUserWarningProxy=function(e,t){return new Proxy(e,{get:(e,n,o)=>{if('__isInsecureUserWarningProxy'===n)return!0;if('symbol'==typeof n){const t=n.toString();if('Symbol(Symbol.toPrimitive)'===t||'Symbol(Symbol.toStringTag)'===t||'Symbol(util.inspect.custom)'===t||'Symbol(nodejs.util.inspect.custom)'===t)return Reflect.get(e,n,o)}return t.value||'string'!=typeof n||(console.warn('Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server.'),t.value=!0),Reflect.get(e,n,o)}})},_e2.deepClone=function(e){return JSON.parse(JSON.stringify(e))};var e=r(d[0]),t=r(d[1]),n=r(d[2]);const o=()=>'undefined'!=typeof window&&'undefined'!=typeof document,s={tested:!1,writable:!1},i=()=>{if(!o())return!1;try{if('object'!=typeof globalThis.localStorage)return!1}catch(e){return!1}if(s.tested)return s.writable;const e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),s.tested=!0,s.writable=!0}catch(e){s.tested=!0,s.writable=!1}return s.writable};const u=e=>e?(...t)=>e(...t):(...e)=>fetch(...e),c=e=>'object'==typeof e&&null!==e&&'status'in e&&'ok'in e&&'json'in e&&'function'==typeof e.json,l=async(e,t,n)=>{await e.setItem(t,JSON.stringify(n))},f=async(e,t)=>{const n=await e.getItem(t);if(!n)return null;try{return JSON.parse(n)}catch(e){return null}},h=async(e,t)=>{await e.removeItem(t)};class p{constructor(){this.promise=new p.promiseConstructor((e,t)=>{this.resolve=e,this.reject=t})}}function y(e){return('0'+e.toString(16)).substr(-2)}function b(){const e=new Uint32Array(56);if('undefined'==typeof crypto){const e='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~',t=e.length;let n='';for(let o=0;o<56;o++)n+=e.charAt(Math.floor(Math.random()*t));return n}return crypto.getRandomValues(e),Array.from(e,y).join('')}async function w(e){const t=(new TextEncoder).encode(e),n=await crypto.subtle.digest('SHA-256',t),o=new Uint8Array(n);return Array.from(o).map(e=>String.fromCharCode(e)).join('')}async function S(e){if(!('undefined'!=typeof crypto&&void 0!==crypto.subtle&&'undefined'!=typeof TextEncoder))return console.warn('WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256.'),e;const t=await w(e);return btoa(t).replace(/\+/g,'-').replace(/\//g,'_').replace(/=+$/,'')}p.promiseConstructor=Promise;const P=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;const A=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/},1183,[1181,1184,1185]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"AuthError",{enumerable:!0,get:function(){return t}}),e.isAuthError=s,Object.defineProperty(e,"AuthApiError",{enumerable:!0,get:function(){return n}}),e.isAuthApiError=function(t){return s(t)&&'AuthApiError'===t.name},Object.defineProperty(e,"AuthUnknownError",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"CustomAuthError",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"AuthSessionMissingError",{enumerable:!0,get:function(){return c}}),e.isAuthSessionMissingError=function(t){return s(t)&&'AuthSessionMissingError'===t.name},Object.defineProperty(e,"AuthInvalidTokenResponseError",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"AuthInvalidCredentialsError",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"AuthImplicitGrantRedirectError",{enumerable:!0,get:function(){return f}}),e.isAuthImplicitGrantRedirectError=function(t){return s(t)&&'AuthImplicitGrantRedirectError'===t.name},Object.defineProperty(e,"AuthPKCEGrantCodeExchangeError",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"AuthPKCECodeVerifierMissingError",{enumerable:!0,get:function(){return A}}),e.isAuthPKCECodeVerifierMissingError=function(t){return s(t)&&'AuthPKCECodeVerifierMissingError'===t.name},Object.defineProperty(e,"AuthRetryableFetchError",{enumerable:!0,get:function(){return p}}),e.isAuthRetryableFetchError=function(t){return s(t)&&'AuthRetryableFetchError'===t.name},Object.defineProperty(e,"AuthRefreshDiscardedError",{enumerable:!0,get:function(){return b}}),e.isAuthRefreshDiscardedError=function(t){return s(t)&&'AuthRefreshDiscardedError'===t.name},Object.defineProperty(e,"AuthWeakPasswordError",{enumerable:!0,get:function(){return O}}),e.isAuthWeakPasswordError=function(t){return s(t)&&'AuthWeakPasswordError'===t.name},Object.defineProperty(e,"AuthInvalidJwtError",{enumerable:!0,get:function(){return P}});class t extends Error{constructor(t,s,n){super(t),this.__isAuthError=!0,this.name='AuthError',this.status=s,this.code=n}toJSON(){return{name:this.name,message:this.message,status:this.status,code:this.code}}}function s(t){return'object'==typeof t&&null!==t&&'__isAuthError'in t}class n extends t{constructor(t,s,n){super(t,s,n),this.name='AuthApiError',this.status=s,this.code=n}}class o extends t{constructor(t,s){super(t),this.name='AuthUnknownError',this.originalError=s}}class u extends t{constructor(t,s,n,o){super(t,n,o),this.name=s,this.status=n}}class c extends u{constructor(){super('Auth session missing!','AuthSessionMissingError',400,void 0)}}class h extends u{constructor(){super('Auth session or user missing','AuthInvalidTokenResponseError',500,void 0)}}class l extends u{constructor(t){super(t,'AuthInvalidCredentialsError',400,void 0)}}class f extends u{constructor(t,s=null){super(t,'AuthImplicitGrantRedirectError',500,void 0),this.details=null,this.details=s}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}class E extends u{constructor(t,s=null){super(t,'AuthPKCEGrantCodeExchangeError',500,void 0),this.details=null,this.details=s}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}class A extends u{constructor(){super("PKCE code verifier not found in storage. This can happen if the auth flow was initiated in a different browser or device, or if the storage was cleared. For SSR frameworks (Next.js, SvelteKit, etc.), use @supabase/ssr on both the server and client to store the code verifier in cookies.",'AuthPKCECodeVerifierMissingError',400,'pkce_code_verifier_not_found')}}class p extends u{constructor(t,s){super(t,'AuthRetryableFetchError',s,void 0)}}class b extends u{constructor(t="Refresh result discarded: session state changed mid-flight (e.g., concurrent signOut)"){super(t,'AuthRefreshDiscardedError',409,void 0)}}class O extends u{constructor(t,s,n){super(t,'AuthWeakPasswordError',s,'weak_password'),this.reasons=n}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{reasons:this.reasons})}}class P extends u{constructor(t){super(t,'AuthInvalidJwtError',400,'invalid_jwt')}}},1184,[]); +__d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.byteToBase64URL=o,e.byteFromBase64URL=i,e.stringToBase64URL=function(t){const u=[],n=t=>{u.push(t)},i={queue:0,queuedBits:0};return f(t,t=>{o(t,i,n)}),o(null,i,n),u.join('')},e.stringFromBase64URL=function(t){const u=[],n=t=>{u.push(String.fromCodePoint(t))},o={utf8seq:0,codepoint:0},s={queue:0,queuedBits:0},f=t=>{c(t,o,n)};for(let u=0;u{u.push(t)};for(let u=0;uu.push(t)),new Uint8Array(u)},e.bytesToBase64URL=function(t){const u=[],n={queue:0,queuedBits:0},i=t=>{u.push(t)};return t.forEach(t=>o(t,n,i)),o(null,n,i),u.join('')};const t='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_'.split(''),u=' \t\n\r='.split(''),n=(()=>{const n=new Array(128);for(let t=0;t=6;){const u=n.queue>>n.queuedBits-6&63;o(t[u]),n.queuedBits-=6}else if(n.queuedBits>0)for(n.queue=n.queue<<6-n.queuedBits,n.queuedBits=6;n.queuedBits>=6;){const u=n.queue>>n.queuedBits-6&63;o(t[u]),n.queuedBits-=6}}function i(t,u,o){const i=n[t];if(!(i>-1)){if(-2===i)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(t)}"`)}for(u.queue=u.queue<<6|i,u.queuedBits+=6;u.queuedBits>=8;)o(u.queue>>u.queuedBits-8&255),u.queuedBits-=8}function s(t,u){if(!(t<=127)){if(t<=2047)return u(192|t>>6),void u(128|63&t);if(t<=65535)return u(224|t>>12),u(128|t>>6&63),void u(128|63&t);if(t<=1114111)return u(240|t>>18),u(128|t>>12&63),u(128|t>>6&63),void u(128|63&t);throw new Error(`Unrecognized Unicode codepoint: ${t.toString(16)}`)}u(t)}function f(t,u){for(let n=0;n55295&&o<=56319){const u=1024*(o-55296)&65535;o=65536+(t.charCodeAt(n+1)-56320&65535|u),n+=1}s(o,u)}}function c(t,u,n){if(0===u.utf8seq){if(t<=127)return void n(t);for(let n=1;n<6;n+=1)if(!(t>>7-n&1)){u.utf8seq=n;break}if(2===u.utf8seq)u.codepoint=31&t;else if(3===u.utf8seq)u.codepoint=15&t;else{if(4!==u.utf8seq)throw new Error('Invalid UTF-8 sequence');u.codepoint=7&t}u.utf8seq-=1}else if(u.utf8seq>0){if(t<=127)throw new Error('Invalid UTF-8 sequence');u.codepoint=u.codepoint<<6|63&t,u.utf8seq-=1,0===u.utf8seq&&n(u.codepoint)}}},1185,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SIGN_OUT_SCOPES",{enumerable:!0,get:function(){return t}});const t=['global','local','others']},1186,[]); +__d(function(e,t,s,r,i,n,a){"use strict";Object.defineProperty(n,'__esModule',{value:!0}),Object.defineProperty(n,"default",{enumerable:!0,get:function(){return A}});var o,l=t(a[0]),u=(o=l)&&o.__esModule?o:{default:o},h=t(a[1]),c=t(a[2]),d=t(a[3]),_=t(a[4]),g=t(a[5]),w=t(a[6]),y=t(a[7]),f=t(a[8]),p=t(a[9]),v=t(a[10]),b=t(a[11]);(0,y.polyfillGlobalThis)();const k={url:h.GOTRUE_URL,storageKey:h.STORAGE_KEY,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:h.DEFAULT_HEADERS,flowType:'implicit',debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:5e3,skipAutoInitialize:!1,experimental:{}},m={};class R{get jwks(){var e,t;return null!==(t=null===(e=m[this.storageKey])||void 0===e?void 0:e.jwks)&&void 0!==t?t:{keys:[]}}set jwks(e){m[this.storageKey]=Object.assign(Object.assign({},m[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,t;return null!==(t=null===(e=m[this.storageKey])||void 0===e?void 0:e.cachedAt)&&void 0!==t?t:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){m[this.storageKey]=Object.assign(Object.assign({},m[this.storageKey]),{cachedAt:e})}constructor(e){var t,s,r;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.autoRefreshTickTimeout=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.lastRefreshFailure=null,this._sessionRemovalEpoch=0,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lock=null,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log;const i=Object.assign(Object.assign({},k),e);if(this.storageKey=i.storageKey,this.instanceID=null!==(t=R.nextInstanceID[this.storageKey])&&void 0!==t?t:0,R.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!i.debug,'function'==typeof i.debug&&(this.logger=i.debug),this.instanceID>0&&(0,_.isBrowser)()){const e=`${this._logPrefix()} Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.`;console.warn(e),this.logDebugMessages&&console.trace(e)}if(this.persistSession=i.persistSession,this.autoRefreshToken=i.autoRefreshToken,this.experimental=null!==(s=i.experimental)&&void 0!==s?s:{},this.admin=new u.default({url:i.url,headers:i.headers,fetch:i.fetch,experimental:this.experimental}),this.url=i.url,this.headers=i.headers,this.fetch=(0,_.resolveFetch)(i.fetch),this.detectSessionInUrl=i.detectSessionInUrl,this.flowType=i.flowType,this.hasCustomAuthorizationHeader=i.hasCustomAuthorizationHeader,this.throwOnError=i.throwOnError,this.lockAcquireTimeout=i.lockAcquireTimeout,null!=i.lock&&(this.lock=i.lock),this.jwks||(this.jwks={keys:[]},this.jwks_cached_at=Number.MIN_SAFE_INTEGER),this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this),webauthn:new b.WebAuthnApi(this)},this.oauth={getAuthorizationDetails:this._getAuthorizationDetails.bind(this),approveAuthorization:this._approveAuthorization.bind(this),denyAuthorization:this._denyAuthorization.bind(this),listGrants:this._listOAuthGrants.bind(this),revokeGrant:this._revokeOAuthGrant.bind(this)},this.passkey={startRegistration:this._startPasskeyRegistration.bind(this),verifyRegistration:this._verifyPasskeyRegistration.bind(this),startAuthentication:this._startPasskeyAuthentication.bind(this),verifyAuthentication:this._verifyPasskeyAuthentication.bind(this),list:this._listPasskeys.bind(this),update:this._updatePasskey.bind(this),delete:this._deletePasskey.bind(this)},this.persistSession?(i.storage?this.storage=i.storage:(0,_.supportsLocalStorage)()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=(0,g.memoryLocalStorageAdapter)(this.memoryStorage)),i.userStorage&&(this.userStorage=i.userStorage)):(this.memoryStorage={},this.storage=(0,g.memoryLocalStorageAdapter)(this.memoryStorage)),(0,_.isBrowser)()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(e){console.error('Failed to create a new BroadcastChannel, multi-tab state changes will not be available',e)}null===(r=this.broadcastChannel)||void 0===r||r.addEventListener('message',async e=>{this._debug('received broadcast notification from other tab or client',e),'TOKEN_REFRESHED'!==e.data.event&&'SIGNED_IN'!==e.data.event||(this.lastRefreshFailure=null);try{await this._notifyAllSubscribers(e.data.event,e.data.session,!1)}catch(e){this._debug('#broadcastChannel','error',e)}})}i.skipAutoInitialize||this.initialize().catch(e=>{this._debug('#initialize()','error',e)})}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(e){if(this.throwOnError&&e&&e.error)throw e.error;return e}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${f.version}) ${(new Date).toISOString()}`}_debug(...e){return this.logDebugMessages&&this.logger(this._logPrefix(),...e),this}async initialize(){return this.initializePromise||(this.initializePromise=(async()=>null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._initialize()):await this._initialize())()),await this.initializePromise}async _initialize(){var e;try{let t={},s='none';if((0,_.isBrowser)()&&(t=(0,_.parseParametersFromURL)(window.location.href),this._isImplicitGrantCallback(t)?s='implicit':await this._isPKCECallback(t)&&(s='pkce')),(0,_.isBrowser)()&&this.detectSessionInUrl&&'none'!==s){const{data:r,error:i}=await this._getSessionFromURL(t,s);if(i){if(this._debug('#_initialize()','error detecting session from URL',i),(0,c.isAuthImplicitGrantRedirectError)(i)){const t=null===(e=i.details)||void 0===e?void 0:e.code;if('identity_already_exists'===t||'identity_not_found'===t||'single_identity_not_deletable'===t)return{error:i}}return{error:i}}const{session:n,redirectType:a}=r;return this._debug('#_initialize()','detected session in URL',n,'redirect type',a),await this._saveSession(n),setTimeout(async()=>{'recovery'===a?await this._notifyAllSubscribers('PASSWORD_RECOVERY',n):await this._notifyAllSubscribers('SIGNED_IN',n)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(e){return(0,c.isAuthError)(e)?this._returnResult({error:e}):this._returnResult({error:new c.AuthUnknownError('Unexpected error during initialization',e)})}finally{await this._handleVisibilityChange(),this._debug('#_initialize()','end')}}async signInAnonymously(e){var t,s,r;try{const i=await(0,d._request)(this.fetch,'POST',`${this.url}/signup`,{headers:this.headers,body:{data:null!==(s=null===(t=null==e?void 0:e.options)||void 0===t?void 0:t.data)&&void 0!==s?s:{},gotrue_meta_security:{captcha_token:null===(r=null==e?void 0:e.options)||void 0===r?void 0:r.captchaToken}},xform:d._sessionResponse}),{data:n,error:a}=i;if(a||!n)return this._returnResult({data:{user:null,session:null},error:a});const o=n.session,l=n.user;return n.session&&(await this._saveSession(n.session),await this._notifyAllSubscribers('SIGNED_IN',o)),this._returnResult({data:{user:l,session:o},error:null})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signUp(e){var t,s,r;try{let i;if('email'in e){const{email:s,password:r,options:n}=e;let a=null,o=null;'pkce'===this.flowType&&([a,o]=await(0,_.getCodeChallengeAndMethod)(this.storage,this.storageKey)),i=await(0,d._request)(this.fetch,'POST',`${this.url}/signup`,{headers:this.headers,redirectTo:null==n?void 0:n.emailRedirectTo,body:{email:s,password:r,data:null!==(t=null==n?void 0:n.data)&&void 0!==t?t:{},gotrue_meta_security:{captcha_token:null==n?void 0:n.captchaToken},code_challenge:a,code_challenge_method:o},xform:d._sessionResponse})}else{if(!('phone'in e))throw new c.AuthInvalidCredentialsError('You must provide either an email or phone number and a password');{const{phone:t,password:n,options:a}=e;i=await(0,d._request)(this.fetch,'POST',`${this.url}/signup`,{headers:this.headers,body:{phone:t,password:n,data:null!==(s=null==a?void 0:a.data)&&void 0!==s?s:{},channel:null!==(r=null==a?void 0:a.channel)&&void 0!==r?r:'sms',gotrue_meta_security:{captcha_token:null==a?void 0:a.captchaToken}},xform:d._sessionResponse})}}const{data:n,error:a}=i;if(a||!n)return await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:a});const o=n.session,l=n.user;return n.session&&(await this._saveSession(n.session),await this._notifyAllSubscribers('SIGNED_IN',o)),this._returnResult({data:{user:l,session:o},error:null})}catch(e){if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),(0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signInWithPassword(e){try{let t;if('email'in e){const{email:s,password:r,options:i}=e;t=await(0,d._request)(this.fetch,'POST',`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:s,password:r,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken}},xform:d._sessionResponsePassword})}else{if(!('phone'in e))throw new c.AuthInvalidCredentialsError('You must provide either an email or phone number and a password');{const{phone:s,password:r,options:i}=e;t=await(0,d._request)(this.fetch,'POST',`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:s,password:r,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken}},xform:d._sessionResponsePassword})}}const{data:s,error:r}=t;if(r)return this._returnResult({data:{user:null,session:null},error:r});if(!s||!s.session||!s.user){const e=new c.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null},error:e})}return s.session&&(await this._saveSession(s.session),await this._notifyAllSubscribers('SIGNED_IN',s.session)),this._returnResult({data:Object.assign({user:s.user,session:s.session},s.weak_password?{weakPassword:s.weak_password}:null),error:r})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signInWithOAuth(e){var t,s,r,i;return await this._handleProviderSignIn(e.provider,{redirectTo:null===(t=e.options)||void 0===t?void 0:t.redirectTo,scopes:null===(s=e.options)||void 0===s?void 0:s.scopes,queryParams:null===(r=e.options)||void 0===r?void 0:r.queryParams,skipBrowserRedirect:null===(i=e.options)||void 0===i?void 0:i.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,null!=this.lock?this._acquireLock(this.lockAcquireTimeout,async()=>this._exchangeCodeForSession(e)):this._exchangeCodeForSession(e)}async signInWithWeb3(e){const{chain:t}=e;switch(t){case'ethereum':return await this.signInWithEthereum(e);case'solana':return await this.signInWithSolana(e);default:throw new Error(`@supabase/auth-js: Unsupported chain "${t}"`)}}async signInWithEthereum(e){var t,s,r,i,n,a,o,l,u,h,g;let w,y;if('message'in e)w=e.message,y=e.signature;else{const{chain:h,wallet:c,statement:d,options:g}=e;let f;if((0,_.isBrowser)())if('object'==typeof c)f=c;else{const e=window;if(!('ethereum'in e)||'object'!=typeof e.ethereum||!('request'in e.ethereum)||'function'!=typeof e.ethereum.request)throw new Error("@supabase/auth-js: No compatible Ethereum wallet interface on the window object (window.ethereum) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'ethereum', wallet: resolvedUserWallet }) instead.");f=e.ethereum}else{if('object'!=typeof c||!(null==g?void 0:g.url))throw new Error('@supabase/auth-js: Both wallet and url must be specified in non-browser environments.');f=c}const p=new URL(null!==(t=null==g?void 0:g.url)&&void 0!==t?t:window.location.href),b=await f.request({method:'eth_requestAccounts'}).then(e=>e).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!b||0===b.length)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const k=(0,v.getAddress)(b[0]);let m=null===(s=null==g?void 0:g.signInWithEthereum)||void 0===s?void 0:s.chainId;if(!m){const e=await f.request({method:'eth_chainId'});m=(0,v.fromHex)(e)}const R={domain:p.host,address:k,statement:d,uri:p.href,version:'1',chainId:m,nonce:null===(r=null==g?void 0:g.signInWithEthereum)||void 0===r?void 0:r.nonce,issuedAt:null!==(n=null===(i=null==g?void 0:g.signInWithEthereum)||void 0===i?void 0:i.issuedAt)&&void 0!==n?n:new Date,expirationTime:null===(a=null==g?void 0:g.signInWithEthereum)||void 0===a?void 0:a.expirationTime,notBefore:null===(o=null==g?void 0:g.signInWithEthereum)||void 0===o?void 0:o.notBefore,requestId:null===(l=null==g?void 0:g.signInWithEthereum)||void 0===l?void 0:l.requestId,resources:null===(u=null==g?void 0:g.signInWithEthereum)||void 0===u?void 0:u.resources};w=(0,v.createSiweMessage)(R),y=await f.request({method:'personal_sign',params:[(0,v.toHex)(w),k]})}try{const{data:t,error:s}=await(0,d._request)(this.fetch,'POST',`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:'ethereum',message:w,signature:y},(null===(h=e.options)||void 0===h?void 0:h.captchaToken)?{gotrue_meta_security:{captcha_token:null===(g=e.options)||void 0===g?void 0:g.captchaToken}}:null),xform:d._sessionResponse});if(s)throw s;if(!t||!t.session||!t.user){const e=new c.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null},error:e})}return t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers('SIGNED_IN',t.session)),this._returnResult({data:Object.assign({},t),error:s})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signInWithSolana(e){var t,s,r,i,n,a,o,l,u,h,g,w;let y,f;if('message'in e)y=e.message,f=e.signature;else{const{chain:c,wallet:d,statement:g,options:w}=e;let p;if((0,_.isBrowser)())if('object'==typeof d)p=d;else{const e=window;if(!('solana'in e)||'object'!=typeof e.solana||!('signIn'in e.solana&&'function'==typeof e.solana.signIn||'signMessage'in e.solana&&'function'==typeof e.solana.signMessage))throw new Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.");p=e.solana}else{if('object'!=typeof d||!(null==w?void 0:w.url))throw new Error('@supabase/auth-js: Both wallet and url must be specified in non-browser environments.');p=d}const v=new URL(null!==(t=null==w?void 0:w.url)&&void 0!==t?t:window.location.href);if('signIn'in p&&p.signIn){const e=await p.signIn(Object.assign(Object.assign(Object.assign({issuedAt:(new Date).toISOString()},null==w?void 0:w.signInWithSolana),{version:'1',domain:v.host,uri:v.href}),g?{statement:g}:null));let t;if(Array.isArray(e)&&e[0]&&'object'==typeof e[0])t=e[0];else{if(!(e&&'object'==typeof e&&'signedMessage'in e&&'signature'in e))throw new Error('@supabase/auth-js: Wallet method signIn() returned unrecognized value');t=e}if(!('signedMessage'in t&&'signature'in t&&('string'==typeof t.signedMessage||t.signedMessage instanceof Uint8Array)&&t.signature instanceof Uint8Array))throw new Error('@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields');y='string'==typeof t.signedMessage?t.signedMessage:(new TextDecoder).decode(t.signedMessage),f=t.signature}else{if(!('signMessage'in p&&'function'==typeof p.signMessage&&'publicKey'in p&&'object'==typeof p&&p.publicKey&&'toBase58'in p.publicKey&&'function'==typeof p.publicKey.toBase58))throw new Error('@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API');y=[`${v.host} wants you to sign in with your Solana account:`,p.publicKey.toBase58(),...g?['',g,'']:[''],'Version: 1',`URI: ${v.href}`,`Issued At: ${null!==(r=null===(s=null==w?void 0:w.signInWithSolana)||void 0===s?void 0:s.issuedAt)&&void 0!==r?r:(new Date).toISOString()}`,...(null===(i=null==w?void 0:w.signInWithSolana)||void 0===i?void 0:i.notBefore)?[`Not Before: ${w.signInWithSolana.notBefore}`]:[],...(null===(n=null==w?void 0:w.signInWithSolana)||void 0===n?void 0:n.expirationTime)?[`Expiration Time: ${w.signInWithSolana.expirationTime}`]:[],...(null===(a=null==w?void 0:w.signInWithSolana)||void 0===a?void 0:a.chainId)?[`Chain ID: ${w.signInWithSolana.chainId}`]:[],...(null===(o=null==w?void 0:w.signInWithSolana)||void 0===o?void 0:o.nonce)?[`Nonce: ${w.signInWithSolana.nonce}`]:[],...(null===(l=null==w?void 0:w.signInWithSolana)||void 0===l?void 0:l.requestId)?[`Request ID: ${w.signInWithSolana.requestId}`]:[],...(null===(h=null===(u=null==w?void 0:w.signInWithSolana)||void 0===u?void 0:u.resources)||void 0===h?void 0:h.length)?['Resources',...w.signInWithSolana.resources.map(e=>`- ${e}`)]:[]].join('\n');const e=await p.signMessage((new TextEncoder).encode(y),'utf8');if(!(e&&e instanceof Uint8Array))throw new Error('@supabase/auth-js: Wallet signMessage() API returned an recognized value');f=e}}try{const{data:t,error:s}=await(0,d._request)(this.fetch,'POST',`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:'solana',message:y,signature:(0,p.bytesToBase64URL)(f)},(null===(g=e.options)||void 0===g?void 0:g.captchaToken)?{gotrue_meta_security:{captcha_token:null===(w=e.options)||void 0===w?void 0:w.captchaToken}}:null),xform:d._sessionResponse});if(s)throw s;if(!t||!t.session||!t.user){const e=new c.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null},error:e})}return t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers('SIGNED_IN',t.session)),this._returnResult({data:Object.assign({},t),error:s})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async _exchangeCodeForSession(e){const t=await(0,_.getItemAsync)(this.storage,`${this.storageKey}-code-verifier`),[s,r]=(null!=t?t:'').split('/');try{if(!s&&'pkce'===this.flowType)throw new c.AuthPKCECodeVerifierMissingError;const{data:t,error:i}=await(0,d._request)(this.fetch,'POST',`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:s},xform:d._sessionResponse});if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),i)throw i;if(!t||!t.session||!t.user){const e=new c.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null,redirectType:null},error:e})}return t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers('recovery'===r?'PASSWORD_RECOVERY':'SIGNED_IN',t.session)),this._returnResult({data:Object.assign(Object.assign({},t),{redirectType:null!=r?r:null}),error:i})}catch(e){if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),(0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null,redirectType:null},error:e});throw e}}async signInWithIdToken(e){try{const{options:t,provider:s,token:r,access_token:i,nonce:n}=e,a=await(0,d._request)(this.fetch,'POST',`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:s,id_token:r,access_token:i,nonce:n,gotrue_meta_security:{captcha_token:null==t?void 0:t.captchaToken}},xform:d._sessionResponse}),{data:o,error:l}=a;if(l)return this._returnResult({data:{user:null,session:null},error:l});if(!o||!o.session||!o.user){const e=new c.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null},error:e})}return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers('SIGNED_IN',o.session)),this._returnResult({data:o,error:l})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signInWithOtp(e){var t,s,r,i,n;try{if('email'in e){const{email:r,options:i}=e;let n=null,a=null;'pkce'===this.flowType&&([n,a]=await(0,_.getCodeChallengeAndMethod)(this.storage,this.storageKey));const{error:o}=await(0,d._request)(this.fetch,'POST',`${this.url}/otp`,{headers:this.headers,body:{email:r,data:null!==(t=null==i?void 0:i.data)&&void 0!==t?t:{},create_user:null===(s=null==i?void 0:i.shouldCreateUser)||void 0===s||s,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken},code_challenge:n,code_challenge_method:a},redirectTo:null==i?void 0:i.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:o})}if('phone'in e){const{phone:t,options:s}=e,{data:a,error:o}=await(0,d._request)(this.fetch,'POST',`${this.url}/otp`,{headers:this.headers,body:{phone:t,data:null!==(r=null==s?void 0:s.data)&&void 0!==r?r:{},create_user:null===(i=null==s?void 0:s.shouldCreateUser)||void 0===i||i,gotrue_meta_security:{captcha_token:null==s?void 0:s.captchaToken},channel:null!==(n=null==s?void 0:s.channel)&&void 0!==n?n:'sms'}});return this._returnResult({data:{user:null,session:null,messageId:null==a?void 0:a.message_id},error:o})}throw new c.AuthInvalidCredentialsError('You must provide either an email or phone number.')}catch(e){if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),(0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async verifyOtp(e){var t,s;try{let r,i;'options'in e&&(r=null===(t=e.options)||void 0===t?void 0:t.redirectTo,i=null===(s=e.options)||void 0===s?void 0:s.captchaToken);const{data:n,error:a}=await(0,d._request)(this.fetch,'POST',`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:i}}),redirectTo:r,xform:d._sessionResponse});if(a)throw a;if(!n){throw new Error('An error occurred on token verification.')}const o=n.session,l=n.user;return(null==o?void 0:o.access_token)&&(await this._saveSession(o),await this._notifyAllSubscribers('recovery'==e.type?'PASSWORD_RECOVERY':'SIGNED_IN',o)),this._returnResult({data:{user:l,session:o},error:null})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signInWithSSO(e){var t,s,r,i,n;try{let a=null,o=null;'pkce'===this.flowType&&([a,o]=await(0,_.getCodeChallengeAndMethod)(this.storage,this.storageKey));const l=await(0,d._request)(this.fetch,'POST',`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},'providerId'in e?{provider_id:e.providerId}:null),'domain'in e?{domain:e.domain}:null),{redirect_to:null!==(s=null===(t=e.options)||void 0===t?void 0:t.redirectTo)&&void 0!==s?s:void 0}),(null===(r=null==e?void 0:e.options)||void 0===r?void 0:r.captchaToken)?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:a,code_challenge_method:o}),headers:this.headers,xform:d._ssoResponse});return(null===(i=l.data)||void 0===i?void 0:i.url)&&(0,_.isBrowser)()&&!(null===(n=e.options)||void 0===n?void 0:n.skipBrowserRedirect)&&window.location.assign(l.data.url),this._returnResult(l)}catch(e){if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),(0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async reauthenticate(){return await this.initializePromise,null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._reauthenticate()):await this._reauthenticate()}async _reauthenticate(){try{return await this._useSession(async e=>{const{data:{session:t},error:s}=e;if(s)throw s;if(!t)throw new c.AuthSessionMissingError;const{error:r}=await(0,d._request)(this.fetch,'GET',`${this.url}/reauthenticate`,{headers:this.headers,jwt:t.access_token});return this._returnResult({data:{user:null,session:null},error:r})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async resend(e){try{const t=`${this.url}/resend`;if('email'in e){const{email:s,type:r,options:i}=e;let n=null,a=null;'pkce'===this.flowType&&([n,a]=await(0,_.getCodeChallengeAndMethod)(this.storage,this.storageKey));const{error:o}=await(0,d._request)(this.fetch,'POST',t,{headers:this.headers,body:{email:s,type:r,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken},code_challenge:n,code_challenge_method:a},redirectTo:null==i?void 0:i.emailRedirectTo});return o&&await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:o})}if('phone'in e){const{phone:s,type:r,options:i}=e,{data:n,error:a}=await(0,d._request)(this.fetch,'POST',t,{headers:this.headers,body:{phone:s,type:r,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:null==n?void 0:n.message_id},error:a})}throw new c.AuthInvalidCredentialsError('You must provide either an email or phone number and a type')}catch(e){if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),(0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async getSession(){return await this.initializePromise,null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>this._useSession(async e=>e)):await this._useSession(async e=>e)}async _acquireLock(e,t){this._debug('#_acquireLock','begin',e);try{if(this.lockAcquired){const e=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),s=(async()=>(await e,await t()))();return this.pendingInLock.push((async()=>{try{await s}catch(e){}})()),s}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug('#_acquireLock','lock acquired for storage key',this.storageKey);try{this.lockAcquired=!0;const e=t();for(this.pendingInLock.push((async()=>{try{await e}catch(e){}})()),await e;this.pendingInLock.length;){const e=[...this.pendingInLock];await Promise.all(e),this.pendingInLock.splice(0,e.length)}return await e}finally{this._debug('#_acquireLock','lock released for storage key',this.storageKey),this.lockAcquired=!1}})}finally{this._debug('#_acquireLock','end')}}async _useSession(e){this._debug('#_useSession','begin');try{const t=await this.__loadSession();return await e(t)}finally{this._debug('#_useSession','end')}}async __loadSession(){this._debug('#__loadSession()','begin'),null==this.lock||this.lockAcquired||this._debug('#__loadSession()','used outside of an acquired lock!',(new Error).stack);try{let e=null;const t=await(0,_.getItemAsync)(this.storage,this.storageKey);if(this._debug('#getSession()','session from storage',t),null!==t&&(this._isValidSession(t)?e=t:(this._debug('#getSession()','session from storage is not valid'),await this._removeSession())),!e)return{data:{session:null},error:null};const s=!!e.expires_at&&1e3*e.expires_at-Date.now()Date.now())){const t=await(0,_.getItemAsync)(this.storage,this.storageKey);if(t&&t.refresh_token===e.refresh_token)return this._returnResult({data:{session:e},error:null})}return this._returnResult({data:{session:null},error:i})}return this._returnResult({data:{session:r},error:null})}finally{this._debug('#__loadSession()','end')}}async getUser(e){if(e)return await this._getUser(e);let t;return await this.initializePromise,t=null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser()):await this._getUser(),t.data.user&&(this.suppressGetSessionWarning=!0),t}async _getUser(e){try{return e?await(0,d._request)(this.fetch,'GET',`${this.url}/user`,{headers:this.headers,jwt:e,xform:d._userResponse}):await this._useSession(async e=>{var t,s,r;const{data:i,error:n}=e;if(n)throw n;return(null===(t=i.session)||void 0===t?void 0:t.access_token)||this.hasCustomAuthorizationHeader?await(0,d._request)(this.fetch,'GET',`${this.url}/user`,{headers:this.headers,jwt:null!==(r=null===(s=i.session)||void 0===s?void 0:s.access_token)&&void 0!==r?r:void 0,xform:d._userResponse}):{data:{user:null},error:new c.AuthSessionMissingError}})}catch(e){if((0,c.isAuthError)(e))return(0,c.isAuthSessionMissingError)(e)&&(await this._removeSession(),await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:e});throw e}}async updateUser(e,t={}){return await this.initializePromise,null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(e,t)):await this._updateUser(e,t)}async _updateUser(e,t={}){try{return await this._useSession(async s=>{const{data:r,error:i}=s;if(i)throw i;if(!r.session)throw new c.AuthSessionMissingError;const n=r.session;let a=null,o=null;'pkce'===this.flowType&&null!=e.email&&([a,o]=await(0,_.getCodeChallengeAndMethod)(this.storage,this.storageKey));const{data:l,error:u}=await(0,d._request)(this.fetch,'PUT',`${this.url}/user`,{headers:this.headers,redirectTo:null==t?void 0:t.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:a,code_challenge_method:o}),jwt:n.access_token,xform:d._userResponse});if(u)throw u;return n.user=l.user,await this._saveSession(n),await this._notifyAllSubscribers('USER_UPDATED',n),this._returnResult({data:{user:n.user},error:null})})}catch(e){if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),(0,c.isAuthError)(e))return this._returnResult({data:{user:null},error:e});throw e}}async setSession(e){return await this.initializePromise,null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._setSession(e)):await this._setSession(e)}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new c.AuthSessionMissingError;const t=Date.now()/1e3;let s=t,r=!0,i=null;const{payload:n}=(0,_.decodeJWT)(e.access_token);if(n.exp&&(s=n.exp,r=s<=t),r){const{data:t,error:s}=await this._callRefreshToken(e.refresh_token);if(s)return this._returnResult({data:{user:null,session:null},error:s});if(!t)return{data:{user:null,session:null},error:null};i=t}else{const{data:r,error:n}=await this._getUser(e.access_token);if(n)return this._returnResult({data:{user:null,session:null},error:n});i={access_token:e.access_token,refresh_token:e.refresh_token,user:r.user,token_type:'bearer',expires_in:s-t,expires_at:s},await this._saveSession(i),await this._notifyAllSubscribers('SIGNED_IN',i)}return this._returnResult({data:{user:i.user,session:i},error:null})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{session:null,user:null},error:e});throw e}}async refreshSession(e){return await this.initializePromise,null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._refreshSession(e)):await this._refreshSession(e)}async _refreshSession(e){try{return await this._useSession(async t=>{var s;if(!e){const{data:r,error:i}=t;if(i)throw i;e=null!==(s=r.session)&&void 0!==s?s:void 0}if(!(null==e?void 0:e.refresh_token))throw new c.AuthSessionMissingError;const{data:r,error:i}=await this._callRefreshToken(e.refresh_token);return i?this._returnResult({data:{user:null,session:null},error:i}):r?this._returnResult({data:{user:r.user,session:r},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async _getSessionFromURL(e,t){var s;try{if(!(0,_.isBrowser)())throw new c.AuthImplicitGrantRedirectError('No browser detected.');if(e.error||e.error_description||e.error_code)throw new c.AuthImplicitGrantRedirectError(e.error_description||'Error in URL with unspecified error_description',{error:e.error||'unspecified_error',code:e.error_code||'unspecified_code'});switch(t){case'implicit':if('pkce'===this.flowType)throw new c.AuthPKCEGrantCodeExchangeError('Not a valid PKCE flow url.');break;case'pkce':if('implicit'===this.flowType)throw new c.AuthImplicitGrantRedirectError('Not a valid implicit grant flow url.')}if('pkce'===t){if(this._debug('#_initialize()','begin','is PKCE flow',!0),!e.code)throw new c.AuthPKCEGrantCodeExchangeError('No code detected.');const{data:t,error:r}=await this._exchangeCodeForSession(e.code);if(r)throw r;const i=new URL(window.location.href);return i.searchParams.delete('code'),window.history.replaceState(window.history.state,'',i.toString()),{data:{session:t.session,redirectType:null!==(s=t.redirectType)&&void 0!==s?s:null},error:null}}const{provider_token:r,provider_refresh_token:i,access_token:n,refresh_token:a,expires_in:o,expires_at:l,token_type:u}=e;if(!(n&&o&&a&&u))throw new c.AuthImplicitGrantRedirectError('No session defined in URL');const d=Math.round(Date.now()/1e3),g=parseInt(o);let w=d+g;l&&(w=parseInt(l));const y=w-d;1e3*y<=h.AUTO_REFRESH_TICK_DURATION_MS&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${y}s, should have been closer to ${g}s`);const f=w-g;d-f>=120?console.warn('@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale',f,w,d):d-f<0&&console.warn('@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew',f,w,d);const{data:p,error:v}=await this._getUser(n);if(v)throw v;const b={provider_token:r,provider_refresh_token:i,access_token:n,expires_in:g,expires_at:w,refresh_token:a,token_type:u,user:p.user};return window.location.hash='',this._debug('#_getSessionFromURL()','clearing window.location.hash'),this._returnResult({data:{session:b,redirectType:e.type},error:null})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{session:null,redirectType:null},error:e});throw e}}_isImplicitGrantCallback(e){return'function'==typeof this.detectSessionInUrl?this.detectSessionInUrl(new URL(window.location.href),e):Boolean(e.access_token||e.error||e.error_description||e.error_code)}async _isPKCECallback(e){const t=await(0,_.getItemAsync)(this.storage,`${this.storageKey}-code-verifier`);return!(!e.code||!t)}async signOut(e={scope:'global'}){return await this.initializePromise,null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(e)):await this._signOut(e)}async _signOut({scope:e}={scope:'global'}){return await this._useSession(async t=>{var s;const{data:r,error:i}=t;if(i&&!(0,c.isAuthSessionMissingError)(i))return this._returnResult({error:i});const n=null===(s=r.session)||void 0===s?void 0:s.access_token;if(n){const{error:t}=await this.admin.signOut(n,e);if(t&&(!(0,c.isAuthApiError)(t)||404!==t.status&&401!==t.status&&403!==t.status)&&!(0,c.isAuthSessionMissingError)(t))return this._returnResult({error:t})}return'others'!==e&&(await this._removeSession(),await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(e){const t=(0,_.generateCallbackId)(),s={id:t,callback:e,unsubscribe:()=>{this._debug('#unsubscribe()','state change callback with id removed',t),this.stateChangeEmitters.delete(t)}};return this._debug('#onAuthStateChange()','registered callback with id',t),this.stateChangeEmitters.set(t,s),(async()=>{await this.initializePromise,null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(t)}):await this._emitInitialSession(t)})(),{data:{subscription:s}}}async _emitInitialSession(e){return await this._useSession(async t=>{var s,r;try{const{data:{session:r},error:i}=t;if(i)throw i;await(null===(s=this.stateChangeEmitters.get(e))||void 0===s?void 0:s.callback('INITIAL_SESSION',r)),this._debug('INITIAL_SESSION','callback id',e,'session',r)}catch(t){await(null===(r=this.stateChangeEmitters.get(e))||void 0===r?void 0:r.callback('INITIAL_SESSION',null)),this._debug('INITIAL_SESSION','callback id',e,'error',t),(0,c.isAuthSessionMissingError)(t)?console.warn(t):console.error(t)}})}async resetPasswordForEmail(e,t={}){let s=null,r=null;'pkce'===this.flowType&&([s,r]=await(0,_.getCodeChallengeAndMethod)(this.storage,this.storageKey,!0));try{return await(0,d._request)(this.fetch,'POST',`${this.url}/recover`,{body:{email:e,code_challenge:s,code_challenge_method:r,gotrue_meta_security:{captcha_token:t.captchaToken}},headers:this.headers,redirectTo:t.redirectTo})}catch(e){if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),(0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async getUserIdentities(){var e;try{const{data:t,error:s}=await this.getUser();if(s)throw s;return this._returnResult({data:{identities:null!==(e=t.user.identities)&&void 0!==e?e:[]},error:null})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async linkIdentity(e){return'token'in e?this.linkIdentityIdToken(e):this.linkIdentityOAuth(e)}async linkIdentityOAuth(e){var t;try{const{data:s,error:r}=await this._useSession(async t=>{var s,r,i,n,a;const{data:o,error:l}=t;if(l)throw l;const u=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:null===(s=e.options)||void 0===s?void 0:s.redirectTo,scopes:null===(r=e.options)||void 0===r?void 0:r.scopes,queryParams:null===(i=e.options)||void 0===i?void 0:i.queryParams,skipBrowserRedirect:!0});return await(0,d._request)(this.fetch,'GET',u,{headers:this.headers,jwt:null!==(a=null===(n=o.session)||void 0===n?void 0:n.access_token)&&void 0!==a?a:void 0})});if(r)throw r;return(0,_.isBrowser)()&&!(null===(t=e.options)||void 0===t?void 0:t.skipBrowserRedirect)&&window.location.assign(null==s?void 0:s.url),this._returnResult({data:{provider:e.provider,url:null==s?void 0:s.url},error:null})}catch(t){if((0,c.isAuthError)(t))return this._returnResult({data:{provider:e.provider,url:null},error:t});throw t}}async linkIdentityIdToken(e){return await this._useSession(async t=>{var s;try{const{error:r,data:{session:i}}=t;if(r)throw r;const{options:n,provider:a,token:o,access_token:l,nonce:u}=e,h=await(0,d._request)(this.fetch,'POST',`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:null!==(s=null==i?void 0:i.access_token)&&void 0!==s?s:void 0,body:{provider:a,id_token:o,access_token:l,nonce:u,link_identity:!0,gotrue_meta_security:{captcha_token:null==n?void 0:n.captchaToken}},xform:d._sessionResponse}),{data:_,error:g}=h;return g?this._returnResult({data:{user:null,session:null},error:g}):_&&_.session&&_.user?(_.session&&(await this._saveSession(_.session),await this._notifyAllSubscribers('USER_UPDATED',_.session)),this._returnResult({data:_,error:g})):this._returnResult({data:{user:null,session:null},error:new c.AuthInvalidTokenResponseError})}catch(e){if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),(0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}})}async unlinkIdentity(e){try{return await this._useSession(async t=>{var s,r;const{data:i,error:n}=t;if(n)throw n;return await(0,d._request)(this.fetch,'DELETE',`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:null!==(r=null===(s=i.session)||void 0===s?void 0:s.access_token)&&void 0!==r?r:void 0})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _refreshAccessToken(e){const t="#_refreshAccessToken()";this._debug(t,'begin');try{const s=Date.now();return await(0,_.retryable)(async s=>(s>0&&await(0,_.sleep)(200*Math.pow(2,s-1)),this._debug(t,'refreshing attempt',s),await(0,d._request)(this.fetch,'POST',`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:d._sessionResponse})),(e,t)=>{const r=200*Math.pow(2,e);return t&&(0,c.isAuthRetryableFetchError)(t)&&Date.now()+r-sDate.now())?this._debug(r,'proactive refresh failed, access token still valid \u2014 preserving session'):await this._removeSession()}return this.lastRefreshFailure={refreshToken:e,result:s,expiresAt:Date.now()+h.REFRESH_FAILURE_COOLDOWN_MS},null===(t=this.refreshingDeferred)||void 0===t||t.resolve(s),s}throw null===(s=this.refreshingDeferred)||void 0===s||s.reject(i),i}finally{this.refreshingDeferred=null,this._debug(r,'end')}}async _notifyAllSubscribers(e,t,s=!0){const r=`#_notifyAllSubscribers(${e})`;this._debug(r,'begin',t,`broadcast = ${s}`);try{this.broadcastChannel&&s&&this.broadcastChannel.postMessage({event:e,session:t});const r=[],i=Array.from(this.stateChangeEmitters.values()).map(async s=>{try{await s.callback(e,t)}catch(e){r.push(e)}});if(await Promise.all(i),r.length>0){for(let e=0;ethis._autoRefreshTokenTick(),h.AUTO_REFRESH_TICK_DURATION_MS);this.autoRefreshTicker=e,e&&'object'==typeof e&&'function'==typeof e.unref?e.unref():'undefined'!=typeof Deno&&'function'==typeof Deno.unrefTimer&&Deno.unrefTimer(e);const t=setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0);this.autoRefreshTickTimeout=t,t&&'object'==typeof t&&'function'==typeof t.unref?t.unref():'undefined'!=typeof Deno&&'function'==typeof Deno.unrefTimer&&Deno.unrefTimer(t)}async _stopAutoRefresh(){this._debug('#_stopAutoRefresh()');const e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e);const t=this.autoRefreshTickTimeout;this.autoRefreshTickTimeout=null,t&&clearTimeout(t)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async dispose(){var e;this._removeVisibilityChangedCallback(),await this._stopAutoRefresh(),null===(e=this.broadcastChannel)||void 0===e||e.close(),this.broadcastChannel=null,this.stateChangeEmitters.clear()}async _autoRefreshTokenTick(){if(this._debug('#_autoRefreshTokenTick()','begin'),null==this.lock)if(null===this.refreshingDeferred)try{const e=Date.now();try{await this._useSession(async t=>{const{data:{session:s}}=t;if(!s||!s.refresh_token||!s.expires_at)return void this._debug('#_autoRefreshTokenTick()','no session');const r=Math.floor((1e3*s.expires_at-e)/h.AUTO_REFRESH_TICK_DURATION_MS);this._debug('#_autoRefreshTokenTick()',`access token expires in ${r} ticks, a tick lasts ${h.AUTO_REFRESH_TICK_DURATION_MS}ms, refresh threshold is ${h.AUTO_REFRESH_TICK_THRESHOLD} ticks`),r<=h.AUTO_REFRESH_TICK_THRESHOLD&&await this._callRefreshToken(s.refresh_token)})}catch(e){console.error('Auto refresh tick failed with error. This is likely a transient error.',e)}}finally{this._debug('#_autoRefreshTokenTick()','end')}else this._debug('#_autoRefreshTokenTick()','refresh already in flight, skipping');else try{await this._acquireLock(0,async()=>{try{const e=Date.now();try{return await this._useSession(async t=>{const{data:{session:s}}=t;if(!s||!s.refresh_token||!s.expires_at)return void this._debug('#_autoRefreshTokenTick()','no session');const r=Math.floor((1e3*s.expires_at-e)/h.AUTO_REFRESH_TICK_DURATION_MS);this._debug('#_autoRefreshTokenTick()',`access token expires in ${r} ticks, a tick lasts ${h.AUTO_REFRESH_TICK_DURATION_MS}ms, refresh threshold is ${h.AUTO_REFRESH_TICK_THRESHOLD} ticks`),r<=h.AUTO_REFRESH_TICK_THRESHOLD&&await this._callRefreshToken(s.refresh_token)})}catch(e){console.error('Auto refresh tick failed with error. This is likely a transient error.',e)}}finally{this._debug('#_autoRefreshTokenTick()','end')}})}catch(e){if(!(e instanceof w.LockAcquireTimeoutError))throw e;this._debug('auto refresh token tick lock not available')}}async _handleVisibilityChange(){if(this._debug('#_handleVisibilityChange()'),!(0,_.isBrowser)()||!(null===window||void 0===window?void 0:window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>{try{await this._onVisibilityChanged(!1)}catch(e){this._debug('#visibilityChangedCallback','error',e)}},null===window||void 0===window||window.addEventListener('visibilitychange',this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error('_handleVisibilityChange',e)}}async _onVisibilityChanged(e){const t=`#_onVisibilityChanged(${e})`;if(this._debug(t,'visibilityState',document.visibilityState),'visible'===document.visibilityState){if(this.autoRefreshToken&&this._startAutoRefresh(),!e)if(await this.initializePromise,null!=this.lock)await this._acquireLock(this.lockAcquireTimeout,async()=>{'visible'===document.visibilityState?await this._recoverAndRefresh():this._debug(t,'acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting')});else{if('visible'!==document.visibilityState)return void this._debug(t,'visibilityState is no longer visible, skipping recovery');await this._recoverAndRefresh()}}else'hidden'===document.visibilityState&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(e,t,s){const r=[`provider=${encodeURIComponent(t)}`];if((null==s?void 0:s.redirectTo)&&r.push(`redirect_to=${encodeURIComponent(s.redirectTo)}`),(null==s?void 0:s.scopes)&&r.push(`scopes=${encodeURIComponent(s.scopes)}`),'pkce'===this.flowType){const[e,t]=await(0,_.getCodeChallengeAndMethod)(this.storage,this.storageKey),s=new URLSearchParams({code_challenge:`${encodeURIComponent(e)}`,code_challenge_method:`${encodeURIComponent(t)}`});r.push(s.toString())}if(null==s?void 0:s.queryParams){const e=new URLSearchParams(s.queryParams);r.push(e.toString())}return(null==s?void 0:s.skipBrowserRedirect)&&r.push(`skip_http_redirect=${s.skipBrowserRedirect}`),`${e}?${r.join('&')}`}async _unenroll(e){try{return await this._useSession(async t=>{var s;const{data:r,error:i}=t;return i?this._returnResult({data:null,error:i}):await(0,d._request)(this.fetch,'DELETE',`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:null===(s=null==r?void 0:r.session)||void 0===s?void 0:s.access_token})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _enroll(e){try{return await this._useSession(async t=>{var s,r;const{data:i,error:n}=t;if(n)return this._returnResult({data:null,error:n});const a=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},'phone'===e.factorType?{phone:e.phone}:'totp'===e.factorType?{issuer:e.issuer}:{}),{data:o,error:l}=await(0,d._request)(this.fetch,'POST',`${this.url}/factors`,{body:a,headers:this.headers,jwt:null===(s=null==i?void 0:i.session)||void 0===s?void 0:s.access_token});return l?this._returnResult({data:null,error:l}):('totp'===e.factorType&&'totp'===o.type&&(null===(r=null==o?void 0:o.totp)||void 0===r?void 0:r.qr_code)&&(o.totp.qr_code=`data:image/svg+xml;utf-8,${o.totp.qr_code}`),this._returnResult({data:o,error:null}))})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _verify(e){const t=async()=>{try{return await this._useSession(async t=>{var s;const{data:r,error:i}=t;if(i)return this._returnResult({data:null,error:i});const n=Object.assign({challenge_id:e.challengeId},'webauthn'in e?{webauthn:Object.assign(Object.assign({},e.webauthn),{credential_response:'create'===e.webauthn.type?(0,b.serializeCredentialCreationResponse)(e.webauthn.credential_response):(0,b.serializeCredentialRequestResponse)(e.webauthn.credential_response)})}:{code:e.code}),{data:a,error:o}=await(0,d._request)(this.fetch,'POST',`${this.url}/factors/${e.factorId}/verify`,{body:n,headers:this.headers,jwt:null===(s=null==r?void 0:r.session)||void 0===s?void 0:s.access_token});return o?this._returnResult({data:null,error:o}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+a.expires_in},a)),await this._notifyAllSubscribers('MFA_CHALLENGE_VERIFIED',a),this._returnResult({data:a,error:o}))})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}};return null!=this.lock?this._acquireLock(this.lockAcquireTimeout,t):t()}async _challenge(e){const t=async()=>{try{return await this._useSession(async t=>{var s;const{data:r,error:i}=t;if(i)return this._returnResult({data:null,error:i});const n=await(0,d._request)(this.fetch,'POST',`${this.url}/factors/${e.factorId}/challenge`,{body:e,headers:this.headers,jwt:null===(s=null==r?void 0:r.session)||void 0===s?void 0:s.access_token});if(n.error)return n;const{data:a}=n;if('webauthn'!==a.type)return{data:a,error:null};switch(a.webauthn.type){case'create':return{data:Object.assign(Object.assign({},a),{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_options:Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:(0,b.deserializeCredentialCreationOptions)(a.webauthn.credential_options.publicKey)})})}),error:null};case'request':return{data:Object.assign(Object.assign({},a),{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_options:Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:(0,b.deserializeCredentialRequestOptions)(a.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}};return null!=this.lock?this._acquireLock(this.lockAcquireTimeout,t):t()}async _challengeAndVerify(e){const{data:t,error:s}=await this._challenge({factorId:e.factorId});return s?this._returnResult({data:null,error:s}):await this._verify({factorId:e.factorId,challengeId:t.id,code:e.code})}async _listFactors(){var e;const{data:{user:t},error:s}=await this.getUser();if(s)return{data:null,error:s};const r={all:[],phone:[],totp:[],webauthn:[]};for(const s of null!==(e=null==t?void 0:t.factors)&&void 0!==e?e:[])r.all.push(s),'verified'===s.status&&r[s.factor_type].push(s);return{data:r,error:null}}async _getAuthenticatorAssuranceLevel(e){var t,s,r,i;if(e)try{const{payload:r}=(0,_.decodeJWT)(e);let i=null;r.aal&&(i=r.aal);let n=i;const{data:{user:a},error:o}=await this.getUser(e);if(o)return this._returnResult({data:null,error:o});(null!==(s=null===(t=null==a?void 0:a.factors)||void 0===t?void 0:t.filter(e=>'verified'===e.status))&&void 0!==s?s:[]).length>0&&(n='aal2');return{data:{currentLevel:i,nextLevel:n,currentAuthenticationMethods:r.amr||[]},error:null}}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}const{data:{session:n},error:a}=await this.getSession();if(a)return this._returnResult({data:null,error:a});if(!n)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:o}=(0,_.decodeJWT)(n.access_token);let l=null;o.aal&&(l=o.aal);let u=l;(null!==(i=null===(r=n.user.factors)||void 0===r?void 0:r.filter(e=>'verified'===e.status))&&void 0!==i?i:[]).length>0&&(u='aal2');return{data:{currentLevel:l,nextLevel:u,currentAuthenticationMethods:o.amr||[]},error:null}}async _getAuthorizationDetails(e){try{return await this._useSession(async t=>{const{data:{session:s},error:r}=t;return r?this._returnResult({data:null,error:r}):s?await(0,d._request)(this.fetch,'GET',`${this.url}/oauth/authorizations/${e}`,{headers:this.headers,jwt:s.access_token,xform:e=>({data:e,error:null})}):this._returnResult({data:null,error:new c.AuthSessionMissingError})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _approveAuthorization(e,t){try{return await this._useSession(async s=>{const{data:{session:r},error:i}=s;if(i)return this._returnResult({data:null,error:i});if(!r)return this._returnResult({data:null,error:new c.AuthSessionMissingError});const n=await(0,d._request)(this.fetch,'POST',`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:r.access_token,body:{action:'approve'},xform:e=>({data:e,error:null})});return n.data&&n.data.redirect_url&&(0,_.isBrowser)()&&!(null==t?void 0:t.skipBrowserRedirect)&&window.location.assign(n.data.redirect_url),n})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _denyAuthorization(e,t){try{return await this._useSession(async s=>{const{data:{session:r},error:i}=s;if(i)return this._returnResult({data:null,error:i});if(!r)return this._returnResult({data:null,error:new c.AuthSessionMissingError});const n=await(0,d._request)(this.fetch,'POST',`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:r.access_token,body:{action:'deny'},xform:e=>({data:e,error:null})});return n.data&&n.data.redirect_url&&(0,_.isBrowser)()&&!(null==t?void 0:t.skipBrowserRedirect)&&window.location.assign(n.data.redirect_url),n})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _listOAuthGrants(){try{return await this._useSession(async e=>{const{data:{session:t},error:s}=e;return s?this._returnResult({data:null,error:s}):t?await(0,d._request)(this.fetch,'GET',`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:t.access_token,xform:e=>({data:e,error:null})}):this._returnResult({data:null,error:new c.AuthSessionMissingError})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _revokeOAuthGrant(e){try{return await this._useSession(async t=>{const{data:{session:s},error:r}=t;return r?this._returnResult({data:null,error:r}):s?(await(0,d._request)(this.fetch,'DELETE',`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:s.access_token,query:{client_id:e.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new c.AuthSessionMissingError})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async fetchJwk(e,t={keys:[]}){let s=t.keys.find(t=>t.kid===e);if(s)return s;const r=Date.now();if(s=this.jwks.keys.find(t=>t.kid===e),s&&this.jwks_cached_at+h.JWKS_TTL>r)return s;const{data:i,error:n}=await(0,d._request)(this.fetch,'GET',`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(n)throw n;return i.keys&&0!==i.keys.length?(this.jwks=i,this.jwks_cached_at=r,s=i.keys.find(t=>t.kid===e),s||null):null}async getClaims(e,t={}){try{let s=e;if(!s){const{data:e,error:t}=await this.getSession();if(t||!e.session)return this._returnResult({data:null,error:t});s=e.session.access_token}const{header:r,payload:i,signature:n,raw:{header:a,payload:o}}=(0,_.decodeJWT)(s);if(!(null==t?void 0:t.allowExpired))try{(0,_.validateExp)(i.exp)}catch(e){throw new c.AuthInvalidJwtError(e instanceof Error?e.message:'JWT validation failed')}const l=r.alg&&!r.alg.startsWith('HS')&&r.kid&&'crypto'in globalThis&&'subtle'in globalThis.crypto?await this.fetchJwk(r.kid,(null==t?void 0:t.keys)?{keys:t.keys}:null==t?void 0:t.jwks):null;if(!l){const{error:e}=await this.getUser(s);if(e)throw e;return{data:{claims:i,header:r,signature:n},error:null}}const u=(0,_.getAlgorithm)(r.alg),h=await crypto.subtle.importKey('jwk',l,u,!0,['verify']);if(!await crypto.subtle.verify(u,h,n,(0,p.stringToUint8Array)(`${a}.${o}`)))throw new c.AuthInvalidJwtError('Invalid JWT signature');return{data:{claims:i,header:r,signature:n},error:null}}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async signInWithPasskey(e){var t,s,r;(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{if(!(0,b.browserSupportsWebAuthn)())return this._returnResult({data:null,error:new c.AuthUnknownError('Browser does not support WebAuthn',null)});const{data:i,error:n}=await this._startPasskeyAuthentication({options:{captchaToken:null===(t=null==e?void 0:e.options)||void 0===t?void 0:t.captchaToken}});if(n||!i)return this._returnResult({data:null,error:n});const a=(0,b.deserializeCredentialRequestOptions)(i.options),o=null!==(r=null===(s=null==e?void 0:e.options)||void 0===s?void 0:s.signal)&&void 0!==r?r:b.webAuthnAbortService.createNewAbortSignal(),{data:l,error:u}=await(0,b.getCredential)({publicKey:a,signal:o});if(u||!l)return this._returnResult({data:null,error:null!=u?u:new c.AuthUnknownError('WebAuthn ceremony failed',null)});const h=(0,b.serializeCredentialRequestResponse)(l);return this._verifyPasskeyAuthentication({challengeId:i.challenge_id,credential:h})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async registerPasskey(e){var t,s;(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{if(!(0,b.browserSupportsWebAuthn)())return this._returnResult({data:null,error:new c.AuthUnknownError('Browser does not support WebAuthn',null)});const{data:r,error:i}=await this._startPasskeyRegistration();if(i||!r)return this._returnResult({data:null,error:i});const n=(0,b.deserializeCredentialCreationOptions)(r.options),a=null!==(s=null===(t=null==e?void 0:e.options)||void 0===t?void 0:t.signal)&&void 0!==s?s:b.webAuthnAbortService.createNewAbortSignal(),{data:o,error:l}=await(0,b.createCredential)({publicKey:n,signal:a});if(l||!o)return this._returnResult({data:null,error:null!=l?l:new c.AuthUnknownError('WebAuthn ceremony failed',null)});const u=(0,b.serializeCredentialCreationResponse)(o);return this._verifyPasskeyRegistration({challengeId:r.challenge_id,credential:u})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _startPasskeyRegistration(){(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{return await this._useSession(async e=>{const{data:{session:t},error:s}=e;if(s)return this._returnResult({data:null,error:s});if(!t)return this._returnResult({data:null,error:new c.AuthSessionMissingError});const{data:r,error:i}=await(0,d._request)(this.fetch,'POST',`${this.url}/passkeys/registration/options`,{headers:this.headers,jwt:t.access_token,body:{}});return i?this._returnResult({data:null,error:i}):this._returnResult({data:r,error:null})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _verifyPasskeyRegistration(e){(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{return await this._useSession(async t=>{const{data:{session:s},error:r}=t;if(r)return this._returnResult({data:null,error:r});if(!s)return this._returnResult({data:null,error:new c.AuthSessionMissingError});const{data:i,error:n}=await(0,d._request)(this.fetch,'POST',`${this.url}/passkeys/registration/verify`,{headers:this.headers,jwt:s.access_token,body:{challenge_id:e.challengeId,credential:e.credential}});return n?this._returnResult({data:null,error:n}):this._returnResult({data:i,error:null})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _startPasskeyAuthentication(e){var t;(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{const{data:s,error:r}=await(0,d._request)(this.fetch,'POST',`${this.url}/passkeys/authentication/options`,{headers:this.headers,body:{gotrue_meta_security:{captcha_token:null===(t=null==e?void 0:e.options)||void 0===t?void 0:t.captchaToken}}});return r?this._returnResult({data:null,error:r}):this._returnResult({data:s,error:null})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _verifyPasskeyAuthentication(e){(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{const{data:t,error:s}=await(0,d._request)(this.fetch,'POST',`${this.url}/passkeys/authentication/verify`,{headers:this.headers,body:{challenge_id:e.challengeId,credential:e.credential},xform:d._sessionResponse});return s?this._returnResult({data:null,error:s}):(t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers('SIGNED_IN',t.session)),this._returnResult({data:t,error:null}))}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _listPasskeys(){(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{return await this._useSession(async e=>{const{data:{session:t},error:s}=e;if(s)return this._returnResult({data:null,error:s});if(!t)return this._returnResult({data:null,error:new c.AuthSessionMissingError});const{data:r,error:i}=await(0,d._request)(this.fetch,'GET',`${this.url}/passkeys`,{headers:this.headers,jwt:t.access_token,xform:e=>({data:e,error:null})});return i?this._returnResult({data:null,error:i}):this._returnResult({data:r,error:null})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _updatePasskey(e){(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{return await this._useSession(async t=>{const{data:{session:s},error:r}=t;if(r)return this._returnResult({data:null,error:r});if(!s)return this._returnResult({data:null,error:new c.AuthSessionMissingError});const{data:i,error:n}=await(0,d._request)(this.fetch,'PATCH',`${this.url}/passkeys/${e.passkeyId}`,{headers:this.headers,jwt:s.access_token,body:{friendly_name:e.friendlyName}});return n?this._returnResult({data:null,error:n}):this._returnResult({data:i,error:null})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _deletePasskey(e){(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{return await this._useSession(async t=>{const{data:{session:s},error:r}=t;if(r)return this._returnResult({data:null,error:r});if(!s)return this._returnResult({data:null,error:new c.AuthSessionMissingError});const{error:i}=await(0,d._request)(this.fetch,'DELETE',`${this.url}/passkeys/${e.passkeyId}`,{headers:this.headers,jwt:s.access_token,noResolveJson:!0});return i?this._returnResult({data:null,error:i}):this._returnResult({data:null,error:null})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}}R.nextInstanceID={};var A=R},1187,[1179,1181,1184,1180,1183,1188,1189,1190,1182,1185,1191,1192]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.memoryLocalStorageAdapter=function(t={}){return{getItem:o=>t[o]||null,setItem:(o,n)=>{t[o]=n},removeItem:o=>{delete t[o]}}}},1188,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"internals",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"LockAcquireTimeoutError",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"NavigatorLockAcquireTimeoutError",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"ProcessLockAcquireTimeoutError",{enumerable:!0,get:function(){return s}}),_e.navigatorLock=async function(e,t,s){o.debug&&console.log('@supabase/gotrue-js: navigatorLock: acquire lock',e,t);const c=new globalThis.AbortController;let l;t>0&&(l=setTimeout(()=>{c.abort(),o.debug&&console.log('@supabase/gotrue-js: navigatorLock acquire timed out',e)},t));await Promise.resolve();try{return await globalThis.navigator.locks.request(e,0===t?{mode:'exclusive',ifAvailable:!0}:{mode:'exclusive',signal:c.signal},async c=>{if(!c){if(0===t)throw o.debug&&console.log('@supabase/gotrue-js: navigatorLock: not immediately available',e),new n(`Acquiring an exclusive Navigator LockManager lock "${e}" immediately failed`);if(o.debug)try{const e=await globalThis.navigator.locks.query();console.log('@supabase/gotrue-js: Navigator LockManager state',JSON.stringify(e,null,' '))}catch(e){console.warn('@supabase/gotrue-js: Error when querying Navigator LockManager state',e)}return console.warn('@supabase/gotrue-js: Navigator LockManager returned a null lock when using #request without ifAvailable set to true, it appears this browser is not following the LockManager spec https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request'),clearTimeout(l),await s()}clearTimeout(l),o.debug&&console.log('@supabase/gotrue-js: navigatorLock: acquired',e,c.name);try{return await s()}finally{o.debug&&console.log('@supabase/gotrue-js: navigatorLock: released',e,c.name)}})}catch(u){if(t>0&&clearTimeout(l),null!==u&&'object'==typeof u&&'name'in u&&'AbortError'===u.name&&t>0){if(c.signal.aborted)return o.debug&&console.log('@supabase/gotrue-js: navigatorLock: acquire timeout, recovering by stealing lock',e),console.warn(`@supabase/gotrue-js: Lock "${e}" was not released within ${t}ms. This may indicate an orphaned lock from a component unmount (e.g., React Strict Mode). Forcefully acquiring the lock to recover.`),await Promise.resolve().then(()=>globalThis.navigator.locks.request(e,{mode:'exclusive',steal:!0},async t=>{if(!t)return console.warn('@supabase/gotrue-js: Navigator LockManager returned null lock even with steal: true'),await s();o.debug&&console.log('@supabase/gotrue-js: navigatorLock: recovered (stolen)',e,t.name);try{return await s()}finally{o.debug&&console.log('@supabase/gotrue-js: navigatorLock: released (stolen)',e,t.name)}}));throw o.debug&&console.log('@supabase/gotrue-js: navigatorLock: lock was stolen by another request',e),new n(`Lock "${e}" was released because another request stole it`)}throw u}},_e.processLock=async function(e,o,n){var l;const u=null!==(l=c[e])&&void 0!==l?l:Promise.resolve(),b=(async()=>{try{return await u,null}catch(e){return null}})(),k=(async()=>{let c=null;try{const t=o>=0?new Promise((t,n)=>{c=setTimeout(()=>{console.warn(`@supabase/gotrue-js: Lock "${e}" acquisition timed out after ${o}ms. This may be caused by another operation holding the lock. Consider increasing lockAcquireTimeout or checking for stuck operations.`),n(new s(`Acquiring process lock with name "${e}" timed out`))},o)}):null;await Promise.race([b,t].filter(e=>e)),null!==c&&clearTimeout(c)}catch(e){if(null!==c&&clearTimeout(c),e instanceof t)throw e}return await n()})();return c[e]=(async()=>{try{return await k}catch(e){if(e instanceof t){try{await u}catch(e){}return null}throw e}})(),await k};var e=r(d[0]);const o={debug:!!(globalThis&&(0,e.supportsLocalStorage)()&&globalThis.localStorage&&'true'===globalThis.localStorage.getItem('supabase.gotrue-js.locks.debug'))};class t extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class n extends t{}class s extends t{}const c={}},1189,[1183]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.polyfillGlobalThis=function(){if('object'==typeof globalThis)return;try{Object.defineProperty(Object.prototype,'__magic__',{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch(e){'undefined'!=typeof self&&(self.globalThis=self)}}},1190,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(t){if(!/^0x[a-fA-F0-9]{40}$/.test(t))throw new Error(`@supabase/auth-js: Address "${t}" is invalid.`);return t.toLowerCase()}Object.defineProperty(e,'__esModule',{value:!0}),e.getAddress=t,e.fromHex=function(t){return parseInt(t,16)},e.toHex=function(t){const n=(new TextEncoder).encode(t);return'0x'+Array.from(n,t=>t.toString(16).padStart(2,'0')).join('')},e.createSiweMessage=function(n){var s;const{chainId:o,domain:u,expirationTime:c,issuedAt:l=new Date,nonce:f,notBefore:I,requestId:v,resources:h,scheme:$,uri:w,version:E}=n;if(!Number.isInteger(o))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${o}`);if(!u)throw new Error("@supabase/auth-js: Invalid SIWE message field \"domain\". Domain must be provided.");if(f&&f.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${f}`);if(!w)throw new Error("@supabase/auth-js: Invalid SIWE message field \"uri\". URI must be provided.");if('1'!==E)throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${E}`);if(null===(s=n.statement)||void 0===s?void 0:s.includes('\n'))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${n.statement}`);const S=t(n.address),b=$?`${$}://${u}`:u,p=n.statement?`${n.statement}\n`:'',j=`${b} wants you to sign in with your Ethereum account:\n${S}\n\n${p}`;let x=`URI: ${w}\nVersion: ${E}\nChain ID: ${o}${f?`\nNonce: ${f}`:''}\nIssued At: ${l.toISOString()}`;c&&(x+=`\nExpiration Time: ${c.toISOString()}`);I&&(x+=`\nNot Before: ${I.toISOString()}`);v&&(x+=`\nRequest ID: ${v}`);if(h){let t='\nResources:';for(const n of h){if(!n||'string'!=typeof n)throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${n}`);t+=`\n- ${n}`}x+=t}return`${j}\n${x}`}},1191,[]); +__d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"WebAuthnError",{enumerable:!0,get:function(){return l.WebAuthnError}}),Object.defineProperty(e,"isWebAuthnError",{enumerable:!0,get:function(){return l.isWebAuthnError}}),Object.defineProperty(e,"identifyRegistrationError",{enumerable:!0,get:function(){return l.identifyRegistrationError}}),Object.defineProperty(e,"identifyAuthenticationError",{enumerable:!0,get:function(){return l.identifyAuthenticationError}}),Object.defineProperty(e,"WebAuthnAbortService",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"webAuthnAbortService",{enumerable:!0,get:function(){return u}}),e.deserializeCredentialCreationOptions=function(i){if(!i)throw new Error('Credential creation options are required');if('undefined'!=typeof PublicKeyCredential&&'parseCreationOptionsFromJSON'in PublicKeyCredential&&'function'==typeof PublicKeyCredential.parseCreationOptionsFromJSON)return PublicKeyCredential.parseCreationOptionsFromJSON(i);const{challenge:o,user:l,excludeCredentials:s}=i,u=(0,t.__rest)(i,["challenge","user","excludeCredentials"]),c=(0,n.base64UrlToUint8Array)(o).buffer,f=Object.assign(Object.assign({},l),{id:(0,n.base64UrlToUint8Array)(l.id).buffer}),h=Object.assign(Object.assign({},u),{challenge:c,user:f});if(s&&s.length>0){h.excludeCredentials=new Array(s.length);for(let t=0;t0){c.allowCredentials=new Array(l.length);for(let t=0;tnull!==t&&'object'==typeof t&&!Array.isArray(t),i=t=>t instanceof ArrayBuffer||ArrayBuffer.isView(t),o={};for(const l of t)if(l)for(const t in l){const s=l[t];if(void 0!==s)if(Array.isArray(s))o[t]=s;else if(i(s))o[t]=s;else if(n(s)){const i=o[t];n(i)?o[t]=p(i,s):o[t]=p(s)}else o[t]=s}return o}function w(t,n){return p(b,t,n||{})}function A(t,n){return p(y,t,n||{})}class O{constructor(t){this.client=t,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(t){return this.client.mfa.enroll(Object.assign(Object.assign({},t),{factorType:'webauthn'}))}async _challenge({factorId:t,webauthn:n,friendlyName:o,signal:l},s){var c;try{const{data:i,error:b}=await this.client.mfa.challenge({factorId:t,webauthn:n});if(!i)return{data:null,error:b};const y=null!=l?l:u.createNewAbortSignal();if('create'===i.webauthn.type){const{user:t}=i.webauthn.credential_options.publicKey;if(!t.name){const n=o;if(n)t.name=`${t.id}:${n}`;else{const n=(await this.client.getUser()).data.user,i=(null===(c=null==n?void 0:n.user_metadata)||void 0===c?void 0:c.name)||(null==n?void 0:n.email)||(null==n?void 0:n.id)||'User';t.name=`${t.id}:${i}`}}t.displayName||(t.displayName=t.name)}switch(i.webauthn.type){case'create':{const n=w(i.webauthn.credential_options.publicKey,null==s?void 0:s.create),{data:o,error:l}=await f({publicKey:n,signal:y});return o?{data:{factorId:t,challengeId:i.id,webauthn:{type:i.webauthn.type,credential_response:o}},error:null}:{data:null,error:l}}case'request':{const n=A(i.webauthn.credential_options.publicKey,null==s?void 0:s.request),{data:o,error:l}=await h(Object.assign(Object.assign({},i.webauthn.credential_options),{publicKey:n,signal:y}));return o?{data:{factorId:t,challengeId:i.id,webauthn:{type:i.webauthn.type,credential_response:o}},error:null}:{data:null,error:l}}}}catch(t){return(0,i.isAuthError)(t)?{data:null,error:t}:{data:null,error:new i.AuthUnknownError('Unexpected error in challenge',t)}}}async _verify({challengeId:t,factorId:n,webauthn:i}){return this.client.mfa.verify({factorId:n,challengeId:t,webauthn:i})}async _authenticate({factorId:t,webauthn:{rpId:n=('undefined'!=typeof window?window.location.hostname:void 0),rpOrigins:o=('undefined'!=typeof window?[window.location.origin]:void 0),signal:l}={}},s){if(!n)return{data:null,error:new i.AuthError('rpId is required for WebAuthn authentication')};try{if(!c())return{data:null,error:new i.AuthUnknownError('Browser does not support WebAuthn',null)};const{data:u,error:f}=await this.challenge({factorId:t,webauthn:{rpId:n,rpOrigins:o},signal:l},{request:s});if(!u)return{data:null,error:f};const{webauthn:h}=u;return this._verify({factorId:t,challengeId:u.challengeId,webauthn:{type:h.type,rpId:n,rpOrigins:o,credential_response:h.credential_response}})}catch(t){return(0,i.isAuthError)(t)?{data:null,error:t}:{data:null,error:new i.AuthUnknownError('Unexpected error in authenticate',t)}}}async _register({friendlyName:t,webauthn:{rpId:n=('undefined'!=typeof window?window.location.hostname:void 0),rpOrigins:o=('undefined'!=typeof window?[window.location.origin]:void 0),signal:l}={}},s){if(!n)return{data:null,error:new i.AuthError('rpId is required for WebAuthn registration')};try{if(!c())return{data:null,error:new i.AuthUnknownError('Browser does not support WebAuthn',null)};const{data:u,error:f}=await this._enroll({friendlyName:t});if(!u)return await this.client.mfa.listFactors().then(n=>{var i;return null===(i=n.data)||void 0===i?void 0:i.all.find(n=>'webauthn'===n.factor_type&&n.friendly_name===t&&'unverified'!==n.status)}).then(t=>t?this.client.mfa.unenroll({factorId:null==t?void 0:t.id}):void 0),{data:null,error:f};const{data:h,error:b}=await this._challenge({factorId:u.id,friendlyName:u.friendly_name,webauthn:{rpId:n,rpOrigins:o},signal:l},{create:s});return h?this._verify({factorId:u.id,challengeId:h.challengeId,webauthn:{rpId:n,rpOrigins:o,type:h.webauthn.type,credential_response:h.webauthn.credential_response}}):{data:null,error:b}}catch(t){return(0,i.isAuthError)(t)?{data:null,error:t}:{data:null,error:new i.AuthUnknownError('Unexpected error in register',t)}}}}},1192,[1157,1185,1184,1183,1193]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"WebAuthnError",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"WebAuthnUnknownError",{enumerable:!0,get:function(){return t}}),e.isWebAuthnError=function(n){return'object'==typeof n&&null!==n&&'__isWebAuthnError'in n},e.identifyRegistrationError=function({error:t,options:s}){var u,c,R;const{publicKey:E}=s;if(!E)throw Error('options was missing required publicKey property');if('AbortError'===t.name){if(s.signal instanceof AbortSignal)return new o({message:'Registration ceremony was sent an abort signal',code:'ERROR_CEREMONY_ABORTED',cause:t})}else if('ConstraintError'===t.name){if(!0===(null===(u=E.authenticatorSelection)||void 0===u?void 0:u.requireResidentKey))return new o({message:'Discoverable credentials were required but no available authenticator supported it',code:'ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT',cause:t});if('conditional'===s.mediation&&'required'===(null===(c=E.authenticatorSelection)||void 0===c?void 0:c.userVerification))return new o({message:'User verification was required during automatic registration but it could not be performed',code:'ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE',cause:t});if('required'===(null===(R=E.authenticatorSelection)||void 0===R?void 0:R.userVerification))return new o({message:'User verification was required but no available authenticator supported it',code:'ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT',cause:t})}else{if('InvalidStateError'===t.name)return new o({message:'The authenticator was previously registered',code:'ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED',cause:t});if('NotAllowedError'===t.name)return new o({message:t.message,code:'ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY',cause:t});if('NotSupportedError'===t.name){return 0===E.pubKeyCredParams.filter(n=>'public-key'===n.type).length?new o({message:'No entry in pubKeyCredParams was of type "public-key"',code:'ERROR_MALFORMED_PUBKEYCREDPARAMS',cause:t}):new o({message:'No available authenticator supported any of the specified pubKeyCredParams algorithms',code:'ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG',cause:t})}if('SecurityError'===t.name){const s=window.location.hostname;if(!(0,n.isValidDomain)(s))return new o({message:`${window.location.hostname} is an invalid domain`,code:'ERROR_INVALID_DOMAIN',cause:t});if(E.rp.id!==s)return new o({message:`The RP ID "${E.rp.id}" is invalid for this domain`,code:'ERROR_INVALID_RP_ID',cause:t})}else if('TypeError'===t.name){if(E.user.id.byteLength<1||E.user.id.byteLength>64)return new o({message:'User ID was not between 1 and 64 characters',code:'ERROR_INVALID_USER_ID_LENGTH',cause:t})}else if('UnknownError'===t.name)return new o({message:'The authenticator was unable to process the specified options, or could not create a new credential',code:'ERROR_AUTHENTICATOR_GENERAL_ERROR',cause:t})}return new o({message:'a Non-Webauthn related error has occurred',code:'ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY',cause:t})},e.identifyAuthenticationError=function({error:t,options:s}){const{publicKey:u}=s;if(!u)throw Error('options was missing required publicKey property');if('AbortError'===t.name){if(s.signal instanceof AbortSignal)return new o({message:'Authentication ceremony was sent an abort signal',code:'ERROR_CEREMONY_ABORTED',cause:t})}else{if('NotAllowedError'===t.name)return new o({message:t.message,code:'ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY',cause:t});if('SecurityError'===t.name){const s=window.location.hostname;if(!(0,n.isValidDomain)(s))return new o({message:`${window.location.hostname} is an invalid domain`,code:'ERROR_INVALID_DOMAIN',cause:t});if(u.rpId!==s)return new o({message:`The RP ID "${u.rpId}" is invalid for this domain`,code:'ERROR_INVALID_RP_ID',cause:t})}else if('UnknownError'===t.name)return new o({message:'The authenticator was unable to process the specified options, or could not create a new assertion signature',code:'ERROR_AUTHENTICATOR_GENERAL_ERROR',cause:t})}return new o({message:'a Non-Webauthn related error has occurred',code:'ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY',cause:t})};var n=r(d[0]);class o extends Error{constructor({message:n,code:o,cause:t,name:s}){var u;super(n,{cause:t}),this.__isWebAuthnError=!0,this.name=null!==(u=null!=s?s:t instanceof Error?t.name:void 0)&&void 0!==u?u:'Unknown Error',this.code=o}toJSON(){return{name:this.name,message:this.message,code:this.code}}}class t extends o{constructor(n,o){super({code:'ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY',cause:o,message:n}),this.name='WebAuthnUnknownError',this.originalError=o}}},1193,[1192]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u}});var e,t=r(d[0]);var u=((e=t)&&e.__esModule?e:{default:e}).default},1194,[1179]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u}});var e,t=r(d[0]);var u=((e=t)&&e.__esModule?e:{default:e}).default},1195,[1187]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.setSyncNamespace=function(e){s=t.IS_ISOLATED_VENUE?`cc-sync:${t.VENUE_RID}:${e}:`:`cc-sync:${e}:`},Object.defineProperty(_e,"syncNamespace",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"kv",{enumerable:!0,get:function(){return i}}),_e.uuid=function(){const e=globalThis.crypto;if(e?.randomUUID)return e.randomUUID();const t=new Uint8Array(16);if(e?.getRandomValues)e.getRandomValues(t);else for(let e=0;e<16;e++)t[e]=Math.floor(256*Math.random());t[6]=15&t[6]|64,t[8]=63&t[8]|128;const n=Array.from(t,e=>e.toString(16).padStart(2,'0')).join('');return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20)}`};var e,t=r(d[0]),n=r(d[1]),c=(e=n)&&e.__esModule?e:{default:e};let s=t.IS_ISOLATED_VENUE?`cc-sync:${t.VENUE_RID}:`:'cc-sync:';const o=()=>s,i={async get(e,t){try{const n=await c.default.getItem(s+e);return null==n?t:JSON.parse(n)}catch{return t}},async set(e,t){try{await c.default.setItem(s+e,JSON.stringify(t))}catch{}},async remove(e){try{await c.default.removeItem(s+e)}catch{}}}},1196,[5,1116]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"isOnline",{enumerable:!0,get:function(){return t}}),_e.setOnline=o,_e.onConnectivity=function(e){return n.add(e),()=>{n.delete(e)}},_e.isNetworkError=function(e){if(!e)return!1;const n=String(e.message??e).toLowerCase();return 0===e.status||/network|fetch failed|failed to fetch|timeout|timed out|offline|econn|enotfound|socket/.test(n)};let e=!0;const n=new Set,t=()=>e;function o(t){t!==e&&(e=t,n.forEach(n=>n(e)))}const s=globalThis.window;s?.addEventListener&&('boolean'==typeof s.navigator?.onLine&&(e=s.navigator.onLine),s.addEventListener('online',()=>o(!0)),s.addEventListener('offline',()=>o(!1)))},1197,[]); +__d(function(g,_r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TableRepository",{enumerable:!0,get:function(){return u}}),e.executeMutation=async function(t){const s=(t,s)=>{throw Object.assign(t,{status:s})};if('rpc'===t.kind){const{error:n,status:r}=await o().rpc(t.fn,t.values??{});return n&&s(n,r),'ok'}const n=o().from(t.table);if('upsert'===t.kind||'insert'===t.kind){const{error:r,status:o}=await n.upsert(t.values??{},{onConflict:t.conflictKey??'id',ignoreDuplicates:'insert'===t.kind});return r&&s(r,o),'ok'}let r='update'===t.kind?n.update(t.values??{}):n.delete();for(const[s,n]of Object.entries(t.match??{}))r=r.eq(s,n);const{data:u,error:c,status:h}=await r.select();c&&s(c,h);return'update'!==t.kind||u&&0!==u.length?'ok':'conflict'};var t=_r(d[0]),s=_r(d[1]),n=_r(d[2]),r=_r(d[3]);const o=()=>(0,s.getSupabase)();class u{constructor(t,s={}){this.table=t,this.opts=s,this.keyOf=s.keyOf??(t=>String(t.id)),this.keyColumns=s.keyColumns??['id'],this.venueCol=s.venueColumn??'venue_id'}rows(s){return t.cache.rows(this.table,s)}get(s,n){return t.cache.get(this.table,s,n)}subscribe(s,n){return t.cache.subscribe(this.table,s,n)}hydrate(s){return t.cache.hydrate(this.table,s)}async refresh(s,n={}){let u=o().from(this.table).select('*').eq(this.venueCol,s);this.opts.orderBy&&(u=u.order(this.opts.orderBy.column,{ascending:this.opts.orderBy.ascending??!0})),n.filter&&(u=n.filter(u));const{data:c,error:h}=await u.limit(this.opts.limit??1e3);if(h)throw h;const l=c??[];return t.cache.replace(this.table,s,l.map(t=>[this.keyOf(t),t]),t=>r.mutationQueue.hasPending(this.table,s,t)),l}async create(s,o){const u={...1===this.keyColumns.length&&'id'===this.keyColumns[0]?{id:(0,n.uuid)()}:{},...o,[this.venueCol]:s},c=this.keyOf(u);return t.cache.put(this.table,s,c,u),await r.mutationQueue.enqueue({table:this.table,venueId:s,kind:'insert'===this.opts.writeMode?'insert':'upsert',rowKey:c,values:u,conflictKey:this.opts.conflictKey??'id'}),u}async update(s,n,o,u={}){const c=t.cache.get(this.table,s,n),h={...this.matchFor(n,c),...u,[this.venueCol]:s};t.cache.patch(this.table,s,n,{...o,updated_at:(new Date).toISOString()}),await r.mutationQueue.enqueue({table:this.table,venueId:s,kind:'update',rowKey:n,values:o,match:h})}async remove(s,n){const o=t.cache.get(this.table,s,n),u={...this.matchFor(n,o),[this.venueCol]:s};t.cache.remove(this.table,s,n),await r.mutationQueue.enqueue({table:this.table,venueId:s,kind:'delete',rowKey:n,match:u})}matchFor(t,s){if(1===this.keyColumns.length&&'id'===this.keyColumns[0])return{id:t};const n={};for(const t of this.keyColumns)n[t]=s?.[t];return n}}},1198,[1199,863,1196,1095]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"cache",{enumerable:!0,get:function(){return w}});var t=r(d[0]);const n=new Map,s=new Map,c=new Map,o=new Map,u=new Set,l=(t,n)=>`cache:${t}:${n}`;function f(t){let s=n.get(t);return s||(s=new Map,n.set(t,s)),s}function p(n){s.delete(n),c.get(n)?.forEach(t=>t());const u=o.get(n);u&&clearTimeout(u),o.set(n,setTimeout(()=>{o.delete(n),t.kv.set(n,Array.from(f(n).entries()))},250))}const w={async hydrate(n,s){const c=l(n,s);if(u.has(c))return;u.add(c);const o=await t.kv.get(c,[]),w=f(c);let h=0;for(const[t,n]of o)w.has(t)||(w.set(t,n),h++);h&&p(c)},rows(t,n){const c=l(t,n);let o=s.get(c);return o||(o=Array.from(f(c).values()),s.set(c,o)),o},get:(t,n,s)=>f(l(t,n)).get(s),put(t,n,s,c){f(l(t,n)).set(s,c),p(l(t,n))},patch(t,n,s,c){const o=f(l(t,n)),u=o.get(s);u&&(o.set(s,{...u,...c}),p(l(t,n)))},remove(t,n,s){f(l(t,n)).delete(s)&&p(l(t,n))},replace(t,s,c,o=()=>!1){const u=l(t,s),w=f(u),h=new Map(c);w.forEach((t,n)=>{o(n)&&h.set(n,t)}),n.set(u,h),p(u)},subscribe(t,n,s){const o=l(t,n);let u=c.get(o);return u||(u=new Set,c.set(o,u)),u.add(s),()=>{u?.delete(s)}},async clearVenue(o,f){for(const p of f){const f=l(p,o);n.delete(f),s.delete(f),u.delete(f),await t.kv.remove(f),c.get(f)?.forEach(t=>t())}}}},1199,[1196]); +__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.classifyWriteError=function(o){if((0,e.isNetworkError)(o))return'network';const{code:n,status:c,msg:l}=t(o);return s(o)?'refused':/^(08|53|57|58)/.test(n)||['40001','40P01','55P03','23505','23503'].includes(n)||/^PGRST30[0-3]$/.test(n)||/jwt|token.*expired/i.test(l)||401===c||408===c||425===c||429===c||c>=500?'retry':409!==c||n?'refused':'retry'},Object.defineProperty(_e,"retryDelayMs",{enumerable:!0,get:function(){return o}}),_e.describeWrite=function(e){const t='rpc'===e.kind?(e.fn??'change').replace(/_/g,' '):n[e.table]??e.table.replace(/_/g,' ').replace(/s$/,''),s=e.values??{},o=s.guest_name??s.name??s.display_name??s.title??s.reason,c='string'==typeof o&&o.trim()?` for ${o.trim().slice(0,60)}`:'';return'delete'===e.kind?`deleting a ${t}${c}`:`the ${t}${c}`},_e.plainReason=function(e,o){const{code:n,status:c,msg:l}=t(e);if('refused'===o)return s(e)?'more than 20 deletes in 10 minutes from one sign-in are stopped to keep your data safe':'42501'===n||403===c||/row-level security|permission/i.test(l)?'your sign-in isn\u2019t allowed to change this':'conflict'===n?'it was changed or removed on another device first':/^(22|23)/.test(n)?'the shared system says some of the details aren\u2019t valid':'P0001'===n&&l?l.slice(0,140):l?`the shared system said: ${l.slice(0,120)}`:'the shared system refused it';return'23505'===n?'the shared system already has another copy of it':'23503'===n?'a related change has to save first':/^PGRST30/.test(n)||401===c||/jwt/i.test(l)?'your sign-in is being refreshed':'the shared system is busy'};var e=r(d[0]);const t=e=>{const t=e&&'object'==typeof e?e:{};return{msg:String(t.message??e??''),code:String(t.code??''),status:Number(t.status??0)||0,hint:String(t.hint??'')}},s=e=>{const s=t(e);return/delete guard/i.test(s.hint)||/too many .* deleted in 10 minutes/i.test(s.msg)};const o=e=>Math.min(5e3*Math.pow(3,Math.max(0,e-1)),3e5),n={bookings:'booking',walk_ins:'walk-in',blocks:'blocked time',sold_out_items:'sold-out mark',sold_out_links:'dish stock link',staff:'staff details',rota_shifts:'rota shift',stock_items:'stock item',stock_events:'stock count',stock_counts:'stock count',chat_messages:'chat message',recipe_cards:'recipe card',order_lists:'order list',order_list_items:'order list item',daily_task_ticks:'task tick',daily_tasks:'daily task',attendance:'clock in or out',cash_ups:'cash-up',table_plans:'table plan',guest_profiles:'guest profile',floor_live:'table status',venues:'venue settings',time_requests:'time-off request',scheduled_notifications:'reminder',suppliers:'supplier',supplier_orders:'supplier order',takeaway_orders:'takeaway order'}},1200,[1197]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useAvatars",{enumerable:!0,get:function(){return l}});var t,e=r(d[0]),o=(t=e)&&t.__esModule?t:{default:t},s=r(d[1]),n=r(d[2]);const l=(0,s.create)()((0,n.persist)((t,e)=>({photos:{},log:[],setOwn:(e,o,s,n)=>{if(!e||e!==o||!s.startsWith('data:image/'))return!1;const l=(new Date).toISOString();return t(t=>({photos:{...t.photos,[o]:{dataUrl:s,at:l}},log:[{id:`av-${Date.now().toString(36)}`,staffId:o,what:'made',by:n,at:l},...t.log].slice(0,100)})),!0},reset:(o,s)=>{if(s.id!==o&&'staff'===s.role)return!1;if(!e().photos[o])return!1;const n={...e().photos};return delete n[o],t(t=>({photos:n,log:[{id:`av-${Date.now().toString(36)}`,staffId:o,what:'reset',by:s.name,at:(new Date).toISOString()},...t.log].slice(0,100)})),!0}}),{name:'covercharge-avatars-v1',storage:(0,n.createJSONStorage)(()=>o.default),version:1}))},1201,[1116,952,1117]); +__d(function(_g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"SETUP_STEPS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"ACCESS_LEVELS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"ACCESS_ROLE",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"ACCESS_APP",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"accessOf",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"PERMS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"DEFAULT_PERMS",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"DEFAULT_GRADES",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"useSetup",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"useSiteSetup",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"setupProgress",{enumerable:!0,get:function(){return w}});var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},i=r(d[1]),s=r(d[2]);const o=[{id:'venue',title:'Venue details & logo',sub:'Name, address, phone, your logo and order at table'},{id:'hours',title:'Opening hours',sub:'When the kitchen is open each day'},{id:'plan',title:'Areas & table plan',sub:'Your areas, tables and seats'},{id:'paygrades',title:'Pay grades',sub:'Named hourly rates for your team'},{id:'staff',title:'Add staff',sub:'Name, role, access, pay and avatar'},{id:'permissions',title:'Permissions',sub:'What each access level can do'},{id:'email',title:'Link email',sub:'Your work email address'},{id:'website',title:'Link website',sub:'Your website and booking link'},{id:'invites',title:'Staff invite links',sub:'Personal links for each person'}],l=['Owner','Manager','Supervisor','Head Chef','Staff'],u={Owner:'owner',Manager:'manager',Supervisor:'manager','Head Chef':'staff',Staff:'staff'},c={Owner:'Managers',Manager:'Managers',Supervisor:'Managers','Head Chef':'Head Chef',Staff:'Staff'},f=(e,t)=>l.includes(e??'')?e:'owner'===t?'Owner':'manager'===t?'Manager':'Staff',b=[{id:'bookings',label:'Take and change bookings'},{id:'walkins',label:'Seat walk-ins'},{id:'block',label:'Block bookings and close the garden'},{id:'tableplan',label:'Edit the table plan'},{id:'kitchen',label:'Kitchen tickets and allergy ticks'},{id:'menu',label:'Edit the menu and allergens'},{id:'rota',label:'Make the rota'},{id:'timesheets',label:'Approve timesheets'},{id:'pay',label:'See pay and wages'},{id:'takings',label:'See takings and reports'},{id:'staff',label:'Add staff and change access'},{id:'settings',label:'Change venue settings'},{id:'billing',label:'Plan and billing'}],p=e=>Object.fromEntries(b.map(t=>[t.id,e])),g=e=>({...p(!1),...Object.fromEntries(e.map(e=>[e,!0]))}),h={Owner:p(!0),Manager:{...p(!0),staff:!1,billing:!1},Supervisor:g(['bookings','walkins','block','tableplan','kitchen','rota']),'Head Chef':g(['kitchen','menu','rota']),Staff:g(['bookings','walkins'])},S=[{id:'pg-foh',name:'Front of house',pence:1271},{id:'pg-bar',name:'Bar team',pence:1271},{id:'pg-kp',name:'Kitchen porter',pence:1271},{id:'pg-cdp',name:'Chef de partie',pence:1450},{id:'pg-sup',name:'Supervisor',pence:1400}],k=()=>({done:{},grades:S.map(e=>({...e})),staffGrade:{},perms:JSON.parse(JSON.stringify(h)),email:'',website:'',bookingUrl:'',invites:{}}),O=(0,i.create)()((0,s.persist)((e,t)=>({sites:{},looks:{},patch:(t,n)=>e(e=>({sites:{...e.sites,[t]:{...e.sites[t]??k(),...n}}})),markDone:(e,n,i=!0)=>{const s={...(t().sites[e]??k()).done};i?s[n]=(new Date).toISOString():delete s[n],t().patch(e,{done:s})},setPerm:(e,n,i,s)=>{const o=t().sites[e]??k();'Owner'!==n&&t().patch(e,{perms:{...o.perms,[n]:{...o.perms[n],[i]:s}}})},resetPerms:e=>t().patch(e,{perms:JSON.parse(JSON.stringify(h))}),setLook:(t,n)=>e(e=>{const i={...e.looks};return null==n?delete i[t]:i[t]=n,{looks:i}})}),{name:'covercharge-setup-v1',storage:(0,s.createJSONStorage)(()=>n.default),version:1})),P=e=>O(t=>t.sites[e])??y,y=k(),w=e=>{const t=o.filter(t=>e.done[t.id]).length;return{done:t,total:o.length,pct:t/o.length}}},1202,[1116,952,1117]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"SEED_INGREDIENTS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"SEED_RECIPES",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"WASTE_REASONS",{enumerable:!0,get:function(){return f}}),_e.stripKitchenExamples=S,Object.defineProperty(_e,"useKitchen",{enumerable:!0,get:function(){return w}});var e,t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),n=_r(_d[3]),r=_r(_d[4]),o=_r(_d[5]),d=(e=o)&&e.__esModule?e:{default:e},c=_r(_d[6]),l=_r(_d[7]);const p=(e,t,s,i,n,r,o,d=[],c)=>({id:e,name:t,unit:s,cost:i,supplierId:n,par:r,onHand:o,allergens:d,prevCost:c}),u=[p('haddock','Haddock fillet','kg',1848,'sup-1',14,9.5,['fish'],1650),p('smk-haddock','Smoked haddock','kg',1500,'sup-1',4,3.2,['fish']),p('smk-salmon','Smoked salmon','kg',2800,'sup-1',3,1.1,['fish']),p('crab','White and brown crab meat','kg',3800,'sup-1',3,2.4,['crustaceans']),p('mussels','Rope mussels','kg',450,'sup-1',12,0,['molluscs']),p('langoustine','Langoustines','kg',2600,'sup-1',6,4.5,['crustaceans']),p('lobster','Lobster (whole)','each',1800,'sup-1',6,4,['crustaceans']),p('prawns','Prawns (cooked, peeled)','kg',1400,'sup-1',3,2.6,['crustaceans']),p('beef-fillet','Beef fillet','kg',4800,'sup-2',4,2.9),p('steak','Braising steak','kg',1200,'sup-2',8,6.2),p('patty','Burger patty 6 oz','each',160,'sup-2',40,18),p('chicken','Chicken breast','kg',950,'sup-2',10,7.5),p('chorizo','Chorizo','kg',1400,'sup-2',2,1.6,['sulphites']),p('haggis','Haggis','kg',900,'sup-2',4,3.5,['gluten','celery']),p('potatoes','Potatoes (chipping)','kg',90,'sup-3',75,40),p('onions','Onions','kg',110,'sup-3',15,11),p('leaves','Salad leaves','kg',700,'sup-3',3,.8),p('lemons','Lemons','each',25,'sup-3',60,44),p('milk','Whole milk','L',110,'sup-4',20,14,['milk']),p('cream','Double cream','L',380,'sup-4',12,9,['milk']),p('butter','Butter','kg',850,'sup-4',6,4.5,['milk']),p('cheddar','Mature cheddar','kg',900,'sup-4',5,3.8,['milk']),p('parmesan','Parmesan','kg',1800,'sup-4',2,1.4,['milk']),p('eggs','Free-range eggs','each',28,'sup-4',120,90,['eggs']),p('ice-cream','Vanilla ice cream','L',450,'sup-4',10,7,['milk','eggs']),p('flour','Plain flour','kg',90,'sup-5',16,12,['gluten']),p('batter','Beer batter mix','kg',220,'sup-5',12,3.5,['gluten']),p('pastry','Puff pastry','kg',450,'sup-5',6,4.2,['gluten','milk']),p('macaroni','Macaroni','kg',180,'sup-5',6,5,['gluten']),p('penne','Penne','kg',180,'sup-5',6,4.5,['gluten']),p('buns','Brioche buns','each',45,'sup-5',40,30,['gluten','eggs','milk','sesame']),p('baguette','Garlic baguette','each',90,'sup-5',24,16,['gluten','milk']),p('oil','Rapeseed oil (fryer)','L',200,'sup-5',60,32),p('sponge','Sticky toffee sponge (portion)','each',95,'sup-5',30,22,['gluten','eggs','milk']),p('truffle-oil','Truffle oil','L',3e3,'sup-5',1,.6)],k=(e,t,s)=>({dishId:e,yield:t,lines:s.map(([e,t])=>({ing:e,qty:t}))}),h=[k('a-fishsupper','1 portion (220 g fillet)',[['haddock',.22],['batter',.06],['potatoes',.35],['oil',.05],['lemons',1]]),k('a-skink','1 bowl',[['smk-haddock',.08],['potatoes',.1],['milk',.15],['cream',.05],['onions',.03],['butter',.01]]),k('a-salmon','1 plate',[['smk-salmon',.07],['cream',.03],['leaves',.02],['lemons',1]]),k('a-haggis','1 plate',[['haggis',.1],['flour',.02],['eggs',1],['oil',.03]]),k('a-crabcakes','2 cakes',[['crab',.08],['potatoes',.06],['flour',.02],['eggs',1],['leaves',.02]]),k('a-tempura','1 plate',[['haddock',.07],['prawns',.05],['onions',.05],['batter',.06],['oil',.04],['lemons',1]]),k('a-mini','Kids fish & chips + ice cream',[['haddock',.1],['potatoes',.2],['batter',.03],['oil',.03],['ice-cream',.05]]),k('a-pie','1 pie',[['steak',.22],['pastry',.08],['onions',.05],['potatoes',.3],['oil',.03]]),k('a-chicken','1 plate',[['chicken',.22],['potatoes',.25],['cream',.05],['butter',.02]]),k('a-maccheese','1 bowl',[['macaroni',.12],['cheddar',.08],['milk',.2],['butter',.02],['flour',.015]]),k('a-penne','1 bowl',[['penne',.12],['chicken',.15],['chorizo',.04],['cream',.08],['parmesan',.01]]),k('a-caesar','1 plate',[['chicken',.16],['leaves',.08],['parmesan',.015],['eggs',1],['baguette',.25]]),k('a-moules','1 pot',[['mussels',.5],['cream',.08],['onions',.03],['baguette',.5]]),k('a-fillet','8 oz steak',[['beef-fillet',.227],['potatoes',.35],['onions',.05],['oil',.05],['butter',.02]]),k('a-claymore','1 burger',[['patty',1],['buns',1],['cheddar',.03],['potatoes',.3],['onions',.06],['batter',.03],['oil',.05]]),k('a-langoustines','1 plate',[['langoustine',.35],['butter',.03],['baguette',.5],['leaves',.03],['lemons',1]]),k('a-lobster','1 lobster',[['lobster',1],['butter',.04],['potatoes',.3],['oil',.04],['leaves',.03],['lemons',1]]),k('a-smorgasbord','Serves one',[['langoustine',.3],['mussels',.3],['crab',.08],['prawns',.1],['smk-salmon',.06],['leaves',.05],['lemons',2]]),k('a-deluxe','Serves two',[['lobster',1],['langoustine',.5],['crab',.15],['mussels',.5],['prawns',.15],['smk-salmon',.1],['leaves',.1],['lemons',3],['baguette',1]]),k('a-chips','1 side',[['potatoes',.35],['oil',.05]]),k('a-onionrings','1 side',[['onions',.15],['batter',.06],['oil',.04]]),k('a-garlicbread','1 side',[['baguette',.5],['butter',.02]]),k('a-truffle','1 side',[['potatoes',.35],['oil',.05],['parmesan',.015],['truffle-oil',.005]]),k('a-salad','1 side',[['leaves',.06],['lemons',.5]]),k('a-stp','1 portion',[['sponge',1],['cream',.05],['butter',.02],['ice-cream',.08]])],f=['Out of date','Spoiled','Over-production','Dropped / burnt','Returned by customer','Prep trim'],b=(e,t=10)=>{const s=new Date;return s.setDate(s.getDate()-e),s.setHours(t,0,0,0),s.toISOString()},y=e=>`${e}-${Math.random().toString(36).slice(2,8)}`;function v(){return{ingredients:u.map(e=>({...e})),recipes:h,targetGp:70,deliveries:[{id:'dl-today-fish',supplierId:'sup-1',due:'today',status:'expected',lines:[{ing:'haddock',ordered:10,received:8,price:1848},{ing:'mussels',ordered:12,received:12,price:450},{ing:'langoustine',ordered:3,received:3,price:2750},{ing:'smk-salmon',ordered:2,received:2,price:2800}]},{id:'dl-today-veg',supplierId:'sup-3',due:'today',status:'expected',lines:[{ing:'potatoes',ordered:50,received:50,price:90},{ing:'leaves',ordered:3,received:2,price:700},{ing:'lemons',ordered:30,received:30,price:25}]}],stockTakes:[{id:'stk-1',at:b(7,22),by:'Head Chef (example)',lines:[{ing:'haddock',expected:6,counted:5.4,cost:1650},{ing:'potatoes',expected:30,counted:28,cost:90},{ing:'cream',expected:8,counted:8,cost:380},{ing:'beef-fillet',expected:3.2,counted:3,cost:4800}]}],waste:[{id:'w1',at:b(1,21),by:'Head Chef (example)',item:'Haddock fillet',ing:'haddock',qty:.6,unit:'kg',reason:'Over-production',cost:1109},{id:'w2',at:b(2,15),by:'Head Chef (example)',item:'Salad leaves',ing:'leaves',qty:.5,unit:'kg',reason:'Spoiled',cost:350},{id:'w3',at:b(3,20),by:'Head Chef (example)',item:'Fish supper',qty:1,unit:'portion',reason:'Dropped / burnt',cost:517},{id:'w4',at:b(4,11),by:'Head Chef (example)',item:'Double cream',ing:'cream',qty:1,unit:'L',reason:'Out of date',cost:380},{id:'w5',at:b(5,22),by:'Head Chef (example)',item:'Chips',ing:'potatoes',qty:3,unit:'kg',reason:'Over-production',cost:270}],orders:[{id:'po-1',supplierId:'sup-1',at:b(1,13),by:'Head Chef (example)',status:'placed (by phone)',lines:[{ing:'haddock',qty:10,cost:1848},{ing:'mussels',qty:12,cost:450},{ing:'langoustine',qty:3,cost:2600},{ing:'smk-salmon',qty:2,cost:2800}],total:30520},{id:'po-2',supplierId:'sup-3',at:b(1,18),by:'Head Chef (example)',status:'placed (on website)',lines:[{ing:'potatoes',qty:50,cost:90},{ing:'leaves',qty:3,cost:700},{ing:'lemons',qty:30,cost:25}],total:7350}],prepTicks:{},temps:[{id:'t1',at:b(0,9),by:'Head Chef (example)',kind:'fridge',unit:'Walk-in fridge',temp:3},{id:'t2',at:b(0,9),by:'Head Chef (example)',kind:'freezer',unit:'Chest freezer',temp:-20}]}}function S(e){const t=v(),s=(e,t)=>t.some(t=>JSON.stringify(t)===JSON.stringify(e)),i=e.recipes.filter(e=>!s(e,t.recipes)),r=e.deliveries.filter(e=>!t.deliveries.some(t=>t.id===e.id&&t.supplierId===e.supplierId&&t.due===e.due&&'expected'===e.status&&!e.checkedBy&&!e.note&&JSON.stringify(t.lines)===JSON.stringify(e.lines))),o=e.stockTakes.filter(e=>!(0,n.demoActor)(e.by)),d=e.waste.filter(e=>!(0,n.demoActor)(e.by)),c=e.orders.filter(e=>!(0,n.demoActor)(e.by)),l=e.temps.filter(e=>!(0,n.demoActor)(e.by)),p=new Set([...i,...r,...o,...c].flatMap(e=>e.lines.map(e=>e.ing)));return d.forEach(e=>{e.ing&&p.add(e.ing)}),{ingredients:e.ingredients.filter(e=>p.has(e.id)||!s(e,t.ingredients)),recipes:i,deliveries:r,stockTakes:o,waste:d,orders:c,temps:l}}const w=(0,c.create)()((0,l.persist)(e=>({...r.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD?{targetGp:70,ingredients:[],recipes:[],deliveries:[],stockTakes:[],waste:[],orders:[],prepTicks:{},temps:[]}:v(),setTarget:t=>e({targetGp:Math.max(40,Math.min(90,Math.round(t)))}),setIngredient:(t,s)=>e(e=>({ingredients:e.ingredients.map(e=>e.id===t?{...e,...s}:e)})),setRecipeQty:(t,s,i)=>e(e=>({recipes:e.recipes.map(e=>e.dishId!==t?e:{...e,lines:i>0?e.lines.some(e=>e.ing===s)?e.lines.map(e=>e.ing===s?{...e,qty:i}:e):[...e.lines,{ing:s,qty:i}]:e.lines.filter(e=>e.ing!==s)})})),acceptDelivery:(t,i,n,o)=>e(e=>({deliveries:e.deliveries.map(e=>e.id===t?{...e,lines:i,status:'accepted',checkedBy:n,at:(new Date).toISOString(),note:o}:e),ingredients:e.ingredients.map(e=>{const t=i.find(t=>t.ing===e.id);return t?{...e,onHand:(0,s.fishInStone)(r.VENUE_RID,e)?e.onHand+t.received:Math.round(100*(e.onHand+t.received))/100,...t.price!==e.cost?{prevCost:e.cost,cost:t.price}:{}}:e})})),saveStockTake:(t,s)=>e(e=>({stockTakes:[{id:y('stk'),at:(new Date).toISOString(),by:s,lines:Object.entries(t).map(([t,s])=>{const i=e.ingredients.find(e=>e.id===t);return{ing:t,expected:i.onHand,counted:s,cost:i.cost}})},...e.stockTakes],ingredients:e.ingredients.map(e=>e.id in t?{...e,onHand:t[e.id]}:e)})),addWaste:t=>e(e=>({waste:[{...t,id:y('w'),at:(new Date).toISOString()},...e.waste],ingredients:t.ing?e.ingredients.map(e=>e.id===t.ing?{...e,onHand:Math.max(0,(0,s.fishInStone)(r.VENUE_RID,e)?e.onHand-t.qty:Math.round(100*(e.onHand-t.qty))/100)}:e):e.ingredients})),addOrder:t=>{const s=y('po');return e(e=>({orders:[{...t,id:s,at:(new Date).toISOString()},...e.orders]})),s},setOrderStatus:(t,s)=>e(e=>({orders:e.orders.map(e=>e.id===t?{...e,status:s}:e)})),tickPrep:(t,s)=>e(e=>{const i={...e.prepTicks};return s?i[t]={by:s,at:(new Date).toISOString()}:delete i[t],{prepTicks:i}}),addTemp:t=>e(e=>({temps:[{...t,id:y('t'),at:(new Date).toISOString()},...e.temps]})),reset:()=>e(r.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD?{targetGp:70,ingredients:[],recipes:[],deliveries:[],stockTakes:[],waste:[],orders:[],prepTicks:{},temps:[]}:v())}),{name:'covercharge-kitchen-v1',version:3,storage:(0,l.createJSONStorage)(()=>d.default),migrate:async e=>{const s=e;return t.LIVE_VENUE_BUILD?(await(0,i.archiveChefCache)('kitchen',s),{...s,...S(s)}):s}}))},1203,[833,1026,1132,1025,5,1116,952,1117]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"GREENSIDE_PALETTE",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"GREENSIDE_DISPLAY",{enumerable:!0,get:function(){return o}});const t={bg:'#1A1A1A',surface:'#222222',surface2:'#292929',border:'#62675E',gold:'#7DB754',goldLight:'#AED28E',goldTint:'#25321E',goldMuted:'#A1C783',tile:'#222222',tilePressed:'#2D3428',accentBg:'rgba(125,183,84,0.13)',accentBorder:'rgba(125,183,84,0.55)',onGold:'#1A1A1A',ok:'#AED28E',okBg:'#25321E',blue:'#AED28E',blueBg:'#25321E'},o={quietBorder:'rgba(125,183,84,0.55)',quietPressed:'rgba(125,183,84,0.16)',primaryPressed:'#6D9F49'}},1204,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.fixSupplierNames=function(n){return n?s.reduce((s,[n,b])=>s.replace(n,b),n):n};const s=[[/\bAl{2}sons?'?s?\b|\bAlson's\b/g,'Alsons'],[/\bSpe[zs] ?[Bb]ona\b|\bSpezbona\b/g,'Spes Bona']]},1205,[]); +__d(function(g,r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DEFAULT_ORDER_LIST_SETTINGS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"UNITS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"DAY_FULL",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"normName",{enumerable:!0,get:function(){return a}}),e.findDuplicate=function(t,n,i,s){return t.find(t=>t.listId===n&&!t.removed&&'open'===t.status&&a(t.name)===a(i)&&u(t.unit)===u(s))},e.bumpQty=function(t,n,i,a,u){return{...t,qty:Math.round(100*(t.qty+n))/100,bumps:[...t.bumps??[],{by:i,name:a,qty:n,at:u}],updatedAt:u}},Object.defineProperty(e,"qtyText",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"validQty",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"liveItems",{enumerable:!0,get:function(){return d}}),e.finishOrder=function(t,n,i,a,u,s){const o=d(n,t.id),l=o.filter(t=>'got'!==t.status),c={id:s(),listId:t.id,listName:t.name,finishedAt:u,finishedBy:a.id,finishedByName:a.name,items:o.map(t=>({name:t.name,qty:t.qty,unit:t.unit,note:t.note,status:t.status,addedByName:t.addedByName})),carried:i?l.length:0},p=i?l.map(t=>({...t,status:'open',carried:'missing'===t.status?'missing':'not-got',statusBy:void 0,statusAt:void 0,updatedAt:u})):[],m=new Set(p.map(t=>t.id));return{round:c,drop:o.filter(t=>!m.has(t.id)).map(t=>t.id),carriedOver:p}},e.nextTripDate=p,e.tripText=function(t,n,a){const u=p(t,n,a);if(!u)return'Running list';const[,s,o]=u.split('-').map(Number);return"Next trip "+(u===n?'today':u===l(n,1)?'tomorrow':`${i[c(u)]} ${o} ${['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'][s-1]}`)},e.initials=function(t){const n=t.replace(/\(.*?\)/g,' ').split(/[^A-Za-z0-9]+/).filter(t=>t&&!['and','the','of','&'].includes(t.toLowerCase()));return n.length?(1===n.length?n[0].slice(0,2):n[0][0]+n[1][0]).toUpperCase():'?'},e.telHref=function(t){if(!t)return null;const n=t.trim().replace(/[^\d+]/g,'').replace(/(?!^)\+/g,'');return n.replace(/\D/g,'').length>=6?`tel:${n}`:null};const t={allowStaff:!0,defaultTripDay:5},n=['','cases','bottles','kegs','boxes','bags','packs','kg','litres','each'],i=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],a=t=>t.trim().toLowerCase().replace(/[\u2019']/g,"'").replace(/\s+/g,' ').replace(/s$/,''),u=t=>t.trim().toLowerCase().replace(/s$/,'');const s=t=>`${Number.isInteger(t.qty)?t.qty:t.qty.toFixed(2).replace(/0$/,'')}${t.unit?` ${t.unit}`:''}`,o=t=>Number.isFinite(t)&&t>0&&t<=9999,d=(t,n)=>t.filter(t=>t.listId===n&&!t.removed).sort((t,n)=>('open'===t.status?0:1)-('open'===n.status?0:1)||t.addedAt.localeCompare(n.addedAt));const l=(t,n)=>{const[i,a,u]=t.split('-').map(Number);return new Date(Date.UTC(i,a-1,u+n)).toISOString().slice(0,10)},c=t=>{const[n,i,a]=t.split('-').map(Number);return new Date(Date.UTC(n,i-1,a)).getUTCDay()};function p(n,i,a=t.defaultTripDay){if('trip'!==n.kind)return null;if(n.nextTrip&&n.nextTrip>=i)return n.nextTrip;const u=n.tripDay??a;return l(i,(u-c(i)+7)%7)}},1206,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useClockArea",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"areaOf",{enumerable:!0,get:function(){return _}});var e,t=r(d[0]),n=r(d[1]),s=r(d[2]),u=(e=s)&&e.__esModule?e:{default:e},c=r(d[3]),l=r(d[4]),E=r(d[5]);const o=(0,c.create)()((0,l.persist)(e=>({areas:(0,n.privateClockVenue)(t.VENUE_RID)?{[t.VENUE_RID]:(0,n.venueClockArea)(t.VENUE_RID)}:{},visiting:{},set:(s,u,c)=>e(e=>t.IS_ISOLATED_VENUE&&s!==t.VENUE_RID?e:{areas:{...e.areas,[s]:{...(0,n.venueClockArea)(s,{...e.areas[s]??{},...u}),updatedAt:(new Date).toISOString(),updatedBy:c}}}),reset:(s,u)=>e(e=>t.IS_ISOLATED_VENUE&&s!==t.VENUE_RID?e:{areas:{...e.areas,[s]:{...(0,n.venueClockArea)(s,{lat:e.areas[s]?.lat??null,lng:e.areas[s]?.lng??null}),updatedAt:(new Date).toISOString(),updatedBy:u}}}),setVisiting:t=>e(e=>({visiting:Object.fromEntries([...Object.entries(e.visiting).slice(-60),[t,!0]])}))}),{name:'covercharge-clock-area-v1',version:1,storage:(0,l.createJSONStorage)(()=>u.default)})),_=e=>t.IS_ISOLATED_VENUE&&e!==t.VENUE_RID?(0,E.cleanArea)(E.DEFAULT_CLOCK_AREA):(0,n.venueClockArea)(e,o.getState().areas[e]??{})},1207,[5,989,1116,952,1117,954]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.inviteStatus=function(){return{'st-tracy':{state:'used',usedAt:s(3e3),devices:2},'st-gordon':{state:'used',usedAt:s(2940),devices:2},'st-bisto':{state:'used',usedAt:s(1800),devices:1},'st-agate':{state:'used',usedAt:s(1680),devices:1},'st-lenny':{state:'used',usedAt:s(1560),devices:1},'st-finn':{state:'unused',expiresAt:a(52),devices:0},'st-eilidh':{state:'used',usedAt:s(1200),devices:1},'st-emily':{state:'expired',devices:0},'st-lillie':{state:'used',usedAt:s(480),devices:1},'st-jack':{state:'unused',expiresAt:a(70),devices:0}}},e.reissueInvite=async function(t){const s='st-bisto'===t?'chef':['st-tracy','st-gordon','st-agate'].includes(t)?'owner':'staff';return{ok:!0,token:'DEMO-link-not-real-0000',expiresAt:a(72),app:s}},e.unlockCashUp=async function(s,a,n){const c=new Date(Date.now()+18e5).toISOString();'cashup'===s?t.useCashUp.setState(t=>({cashUps:t.cashUps.map(t=>t.id===a?{...t,unlockedUntil:c}:t)})):t.useCashUp.setState(t=>({sales:t.sales.map(t=>t.id===a?{...t,unlockedUntil:c}:t)}));return{ok:!0,until:c}},e.cashAudit=async function(t){return[{at:s(780),action:'unlocked',by:'Morgan',tbl:'cash_ups',reason:'Card total keyed as 1,284 not 1,248',changed:[]},{at:s(768),action:'changed',by:'Alex',tbl:'cash_ups',changed:['card']},{at:s(840),action:'created',by:'Alex',tbl:'cash_ups',changed:[]}]},e.pitchRpc=function(t,s){switch(t){case'list_displays':return n;case'create_display_code':case'new_code_for_display':return[{code:'DEMO7K2QX',expires_at:a(24*Number(s.p_hours?Number(s.p_hours)/24:7))}];default:return[]}};var t=r(d[0]);const s=t=>new Date(Date.now()-6e4*t).toISOString(),a=t=>new Date(Date.now()+36e5*t).toISOString();const n=[{id:'pd-1',label:'Front desk tablet',can_write:!0,created_at:s(17280),last_seen_at:s(2),revoked_at:null,sessions:1,open_codes:0},{id:'pd-2',label:'Kitchen pass tablet',can_write:!1,created_at:s(12960),last_seen_at:s(5),revoked_at:null,sessions:1,open_codes:0}]},1208,[1093]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useChatSync",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"chatSynced",{enumerable:!0,get:function(){return n}});const t=(0,r(d[0]).create)(()=>({synced:!1,checked:!1})),n=()=>t.getState().synced},1209,[952]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1210,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var u in n)Object.defineProperty(t,u,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,u).get})})(e,{get Badge(){return x.Badge},get DarkTheme(){return y.DarkTheme},get DefaultTheme(){return _.DefaultTheme},get ErrorBoundary(){return v.ErrorBoundary},get ExperimentalStack(){return U.ExperimentalStack},get ExpoRoot(){return c.ExpoRoot},get Icon(){return x.Icon},get IsWithinNativeNavigator(){return B.IsWithinNativeNavigator},get Label(){return x.Label},get LocaleProvider(){return I.LocaleProvider},get NativeStackView(){return E.NativeStackView},get NavigationAwareActivity(){return R.NavigationAwareActivity},get Navigator(){return t.Navigator},get RouterActionHandling(){return C.RouterActionHandling},get Sitemap(){return b.Sitemap},get Slot(){return t.Slot},get SplashScreen(){return S},get StackRouter(){return C.StackRouter},get SuspenseFallback(){return f.SuspenseFallback},get TabRouter(){return C.TabRouter},get Tabs(){return M.Tabs},get ThemeProvider(){return T.ThemeProvider},get Unmatched(){return l.Unmatched},get VectorIcon(){return x.VectorIcon},get attachRouteState(){return C.attachRouteState},get createBaseStackProps(){return j.createBaseStackProps},get createBaseTabProps(){return D.createBaseTabProps},get createNativeStackProps(){return W.createNativeStackProps},get createStandardRouterNavigator(){return B.createStandardRouterNavigator},get enableLegacyHeaderAppearance(){return F.enableLegacyHeaderAppearance},get extendRouter(){return C.extendRouter},get extendRouterActions(){return C.extendRouterActions},get integrateWithRouter(){return B.integrateWithRouter},get isActionHandled(){return C.isActionHandled},get router(){return u.router},get unstable_PerformanceObserver(){return G.unstable_PerformanceObserver},get unstable_createStandardRouterNavigator(){return B.unstable_createStandardRouterNavigator},get unstable_enablePerformanceIntegration(){return G.unstable_enablePerformanceIntegration},get unstable_integrateWithRouter(){return B.unstable_integrateWithRouter},get unstable_performance(){return G.unstable_performance},get unstable_useIsNavigating(){return o.useIsNavigating},get unstable_useReconcileTabHistory(){return H.useReconcileTabHistory},get useCanGoBack(){return n.useCanGoBack},get useCurrentRouteInfo(){return n.useCurrentRouteInfo},get useFocusEffect(){return h.useFocusEffect},get useGlobalSearchParams(){return n.useGlobalSearchParams},get useIsFocused(){return N.useIsFocused},get useLoaderData(){return n.useLoaderData},get useLocalSearchParams(){return n.useLocalSearchParams},get useNavigation(){return P.useNavigation},get useNavigationContainerRef(){return n.useNavigationContainerRef},get usePathname(){return n.usePathname},get usePreventRemove(){return L.usePreventRemove},get useRootNavigation(){return n.useRootNavigation},get useRootNavigationState(){return n.useRootNavigationState},get useRoute(){return A.useRoute},get useRoutePath(){return O.useRoutePath},get useRouter(){return n.useRouter},get useScrollToTop(){return w.useScrollToTop},get useSegments(){return n.useSegments},get useSitemap(){return p.useSitemap},get useTheme(){return k.useTheme},get useUnstableGlobalHref(){return n.useUnstableGlobalHref},get withLayoutContext(){return s.withLayoutContext}});const t=r(d[0]),n=r(d[1]),u=r(d[2]),o=r(d[3]),s=r(d[4]),c=r(d[5]),l=r(d[6]),b=r(d[7]),p=r(d[8]),v=r(d[9]),f=r(d[10]),R=r(d[11]),S=q(r(d[12])),P=r(d[13]),h=r(d[14]),N=r(d[15]),y=r(d[16]),_=r(d[17]),T=r(d[18]),k=r(d[19]),I=r(d[20]),O=r(d[21]),w=r(d[22]),A=r(d[23]),L=r(d[24]),x=r(d[25]),B=r(d[26]),H=r(d[27]),j=r(d[28]),D=r(d[29]),W=r(d[30]),C=r(d[31]),E=r(d[32]),F=r(d[33]),G=r(d[34]),M=r(d[35]),U=r(d[36]);function V(t){if("function"!=typeof WeakMap)return null;var n=new WeakMap,u=new WeakMap;return(V=function(t){return t?u:n})(t)}function q(t,n){if(!n&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var u=V(n);if(u&&u.has(t))return u.get(t);var o={__proto__:null},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var c in t)if("default"!==c&&Object.prototype.hasOwnProperty.call(t,c)){var l=s?Object.getOwnPropertyDescriptor(t,c):null;l&&(l.get||l.set)?Object.defineProperty(o,c,l):o[c]=t[c]}return o.default=t,u&&u.set(t,o),o}},1211,[694,419,512,1212,712,32,766,757,760,1213,664,662,667,533,537,542,481,483,447,448,1214,488,489,478,476,524,711,657,725,1215,724,358,703,708,378,1216,1219]); +__d(function(g,r,i,a,m,e,d){"use strict";function n(){const t=r(d[0]);return n=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"useIsNavigating",{enumerable:!0,get:function(){return u}});const t=r(d[1]);function u(){return(0,n().use)(t.NavigationPendingContext)}},1212,[30,375]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const o=r(d[0]);return t=function(){return o},o}function o(){const t=r(d[1]);return o=function(){return t},t}function n(){const t=r(d[2]);return n=function(){return t},t}function l(){const t=r(d[3]);return l=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"ErrorBoundary",{enumerable:!0,get:function(){return f}});r(d[4]);const s=r(d[5]),c=r(d[6]),u=r(d[7]);function h({error:o}){return(0,t().jsxs)(n().View,{style:{marginBottom:12,gap:4,flexWrap:'wrap'},children:[(0,t().jsx)(n().Text,{role:"heading","aria-level":1,style:y.title,children:"Something went wrong"}),(0,t().jsxs)(n().Text,{testID:"router_error_message",role:"heading","aria-level":2,style:y.errorMessage,children:["Error: ",o.message]})]})}function f({error:f,retry:x}){const w=(0,o().use)(s.BottomTabBarHeightContext)?n().View:l().SafeAreaView,S=f instanceof c.ReactServerError;return(0,t().jsx)(n().View,{style:y.container,children:(0,t().jsxs)(w,{style:{flex:1,gap:8,maxWidth:720,marginHorizontal:'auto'},children:[S?(0,t().jsx)(b,{error:f}):(0,t().jsx)(h,{error:f}),(0,t().jsx)(n().View,{style:{flex:1}}),!1,(0,t().jsx)(u.Pressable,{testID:"router_error_retry",onPress:x,children:({hovered:o,pressed:l})=>(0,t().jsx)(n().View,{style:[y.buttonInner,(o||l)&&{backgroundColor:'white'}],children:(0,t().jsx)(n().Text,{style:[y.buttonText,{color:o||l?'black':'white'}],children:"Retry"})})})]})})}const x={404:'NOT_FOUND',500:'INTERNAL_SERVER_ERROR',503:'SERVICE_UNAVAILABLE',504:'GATEWAY_TIMEOUT'};function b({error:o}){let l=String(o.statusCode);l+=': '+(x[o.statusCode]??'Server Error');const s=o.headers.get('cf-ray'),c=o.headers.get('Date');return(0,t().jsxs)(n().View,{style:{padding:12,gap:8},children:[(0,t().jsx)(n().Text,{selectable:!0,allowFontScaling:!0,style:{fontSize:n().Platform.select({web:24,default:16}),fontWeight:'bold',marginBottom:4,color:'white'},children:l}),(0,t().jsx)(n().ScrollView,{style:{borderColor:'rgba(255,255,255,0.5)',borderTopWidth:n().StyleSheet.hairlineWidth,borderBottomWidth:n().StyleSheet.hairlineWidth,maxHeight:150},contentContainerStyle:{paddingVertical:4},children:(0,t().jsx)(n().Text,{testID:"router_error_message",selectable:!0,allowFontScaling:!0,style:{color:'white'},children:o.message})}),(0,t().jsx)(w,{title:"Code",right:o.statusCode}),s&&(0,t().jsx)(w,{title:"ID",right:s}),c&&(0,t().jsx)(w,{title:"Date",right:c}),o.url&&(0,t().jsx)(n().Text,{selectable:!0,allowFontScaling:!0,style:{fontSize:14,opacity:.5,color:'white'},children:o.url})]})}function w({title:o,right:l}){const s={fontSize:16,color:'white'};return(0,t().jsxs)(n().View,{style:{flexDirection:'row',justifyContent:'space-between'},children:[(0,t().jsx)(n().Text,{selectable:!0,allowFontScaling:!0,style:s,children:o}),l&&(0,t().jsx)(n().Text,{selectable:!0,allowFontScaling:!0,style:[s,y.code],children:l})]})}const y=n().StyleSheet.create({container:{flex:1,backgroundColor:'black',padding:24,alignItems:'stretch',justifyContent:'center'},title:{color:'white',fontSize:n().Platform.select({web:32,default:24}),fontWeight:'bold'},buttonText:{fontSize:18,fontWeight:'bold',color:'black',...n().Platform.select({web:{transitionDuration:'100ms'}})},buttonInner:{...n().Platform.select({web:{transitionDuration:'100ms'}}),paddingVertical:12,paddingHorizontal:24,borderColor:'white',borderWidth:2,marginLeft:8,justifyContent:'center',alignItems:'center'},code:{fontFamily:n().Platform.select({default:'Courier',ios:'Courier New',android:'monospace'}),fontWeight:'500'},errorMessage:{color:'white',fontSize:16},subtitle:{color:'white',fontSize:14,marginBottom:12},link:{color:'rgba(255,255,255,0.4)',textDecorationStyle:'solid',textDecorationLine:'underline',fontSize:14,textAlign:'center'}})},1213,[24,30,33,289,508,545,666,759]); +__d(function(g,r,i,a,m,e,d){"use strict";function n(){const t=r(d[0]);return n=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"LocaleProvider",{enumerable:!0,get:function(){return o}});const t=r(d[1]);function o({direction:o,children:c}){return(0,n().jsx)(t.LocaleDirContext.Provider,{value:o,children:c})}},1214,[24,429]); +__d(function(g,r,i,a,m,e,d){"use strict";function t({dispatch:t,isPreloaded:o,isRemovalPrevented:n,state:s}){return{isPreloaded:o,isRemovalPrevented:n,routeNames:s.routeNames,preload:o=>t({type:'PRELOAD',payload:{name:o}})}}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"createBaseTabProps",{enumerable:!0,get:function(){return t}})},1215,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),(function(t,o){for(var n in o)Object.defineProperty(t,n,{enumerable:!0,get:Object.getOwnPropertyDescriptor(o,n).get})})(e,{get BottomTabBar(){return n.BottomTabBar},get BottomTabBarHeightCallbackContext(){return n.BottomTabBarHeightCallbackContext},get BottomTabBarHeightContext(){return n.BottomTabBarHeightContext},get BottomTabView(){return n.BottomTabView},get SceneStyleInterpolators(){return u},get Tabs(){return n.default},get TransitionPresets(){return c},get TransitionSpecs(){return f},get createJSTabsProps(){return n.createJSTabsProps},get createStandardBottomTabNavigator(){return n.createStandardBottomTabNavigator},get default(){return s},get useBottomTabBarHeight(){return n.useBottomTabBarHeight}});const t=r(d[0]),o=r(d[1]),n=b(r(d[2])),u=b(r(d[3])),c=b(r(d[4])),f=b(r(d[5]));function l(t){if("function"!=typeof WeakMap)return null;var o=new WeakMap,n=new WeakMap;return(l=function(t){return t?n:o})(t)}function b(t,o){if(!o&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var n=l(o);if(n&&n.has(t))return n.get(t);var u={__proto__:null},c=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var f in t)if("default"!==f&&Object.prototype.hasOwnProperty.call(t,f)){var b=c?Object.getOwnPropertyDescriptor(t,f):null;b&&(b.get||b.set)?Object.defineProperty(u,f,b):u[f]=t[f]}return u.default=t,n&&n.set(t,u),u}n.default.Screen=o.Screen,n.default.Protected=t.Protected;const s=n.default},1216,[718,719,1217,546,547,548]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}function n(){const t=r(d[1]);return n=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get createJSTabsProps(){return h},get default(){return y}});const o=r(d[2]),s=r(d[3]),c=r(d[4]),u=r(d[5]),p=r(d[6]),f=r(d[7]);var l,b;function h(t){const{dispatch:n,state:o}=t;return{...(0,f.createBaseTabProps)(t),popNestedStackToTop:t=>{const s=o.routes.find(n=>n.key===t)?.state;s?.key&&n({...c.StackActions.popToTop(),target:s.key})}}}l=r(d[8]),b=e,Object.keys(l).forEach(function(t){"default"===t||Object.prototype.hasOwnProperty.call(b,t)||Object.defineProperty(b,t,{enumerable:!0,get:function(){return l[t]}})});const y=(0,u.integrateWithRouter)(s.createStandardBottomTabNavigator,c.TabRouter,{activityDefaultThreshold:1,processDescriptors:p.appendMissingPlaceholderTabDescriptors,processState:p.appendMissingPlaceholderTabRoutes,createProps:h,processScreens:s=>s.map(s=>{if('function'!=typeof s.options&&void 0!==s.options?.href){const{href:c,...u}=s.options;if(u.tabBarButton)throw new Error('Cannot use `href` and `tabBarButton` together.');return null===c?{...s,options:{...u,hidden:!0}}:{...s,options:{...u,tabBarButton:s=>{const u='web'===n().Platform.OS?s.children:(0,t().jsx)(n().Pressable,{children:s.children});return(0,t().jsx)(o.Link,{...s,style:[{display:'flex'},s.style],href:c,asChild:'web'!==n().Platform.OS,children:u})}}}}return s})})},1217,[24,33,508,652,427,711,1218,1215,545]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(t,n,o){const s=n.routeNames.filter(t=>!n.routes.some(n=>n.name===t));if(0===s.length)return t;const u=s.reduce((t,n)=>(t[n]=o({key:void 0,name:n}),t),{});return{...t,...u}}function n(t,n){if(!t.routeNames.some(n=>!t.routes.some(t=>t.name===n)))return t;const s=t.routes[t.index]?.key,u=t.routeNames.map(s=>{const u=t.routes.find(t=>t.name===s);return u||o(s,n)}),c=Math.max(0,u.findIndex(t=>t.key===s));return{...t,index:c,routes:u}}function o(t,n){const o=n[t];if(!o)throw new Error(`Could not find a descriptor for route "${t}". This is most likely a bug in expo-router. Please report it at https://github.com/expo/expo/issues.`);return{...o.route,key:t,name:t}}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get appendMissingPlaceholderTabDescriptors(){return t},get appendMissingPlaceholderTabRoutes(){return n}})},1218,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var u in n)Object.defineProperty(t,u,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,u).get})})(e,{get ExperimentalStack(){return c},get default(){return o}});const n=u(r(d[1]));function u(t){return t&&t.__esModule?t:{default:t}}const c=Object.assign(u=>(0,t().jsx)(n.default,{...u}),{Screen:n.default.Screen,Protected:n.default.Protected}),o=c},1219,[24,1220]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),(function(t,u){for(var n in u)Object.defineProperty(t,n,{enumerable:!0,get:Object.getOwnPropertyDescriptor(u,n).get})})(e,{get Stack(){return t.default},get default(){return l}});const t=c(r(d[0])),u=r(d[1]),n=r(d[2]);function c(t){return t&&t.__esModule?t:{default:t}}t.default.Screen=u.StackScreen,t.default.Header=u.StackHeader,t.default.Title=u.StackTitle,t.default.Toolbar=n.StackToolbar;const l=t.default},1220,[695,728,733]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t.default}});const t=o((n=r(d[0]),u=e,Object.keys(n).forEach(function(t){"default"===t||Object.prototype.hasOwnProperty.call(u,t)||Object.defineProperty(u,t,{enumerable:!0,get:function(){return n[t]}})}),n));var n,u;function o(t){return t&&t.__esModule?t:{default:t}}},1221,[1220]); +__d(function(g,r,i,a,m,e,d){"use strict";var t,n;Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get useIsPreview(){return s.useIsPreview},get usePreventZoomTransitionDismissal(){return o.usePreventZoomTransitionDismissal}}),t=r(d[0]),n=e,Object.keys(t).forEach(function(o){"default"===o||Object.prototype.hasOwnProperty.call(n,o)||Object.defineProperty(n,o,{enumerable:!0,get:function(){return t[o]}})});const o=r(d[1]),s=r(d[2])},1222,[508,1223,421]); +__d(function(g,r,i,a,m,e,d){"use strict";function n(n){}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"usePreventZoomTransitionDismissal",{enumerable:!0,get:function(){return n}})},1223,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"Color",{enumerable:!0,get:function(){return y}});r(d[0]);function t(t,n){return Object.keys(t).forEach(function(u){"default"===u||Object.prototype.hasOwnProperty.call(n,u)||Object.defineProperty(n,u,{enumerable:!0,get:function(){return t[u]}})}),t}t(r(d[1]),e),t(r(d[2]),e),t(r(d[3]),e),t(r(d[4]),e),t(r(d[5]),e);const n=new Proxy({},{get:(t,n)=>null}),u=new Proxy({},{get:(t,n)=>null}),o=new Proxy({},{get:(t,n)=>null}),l=new Proxy({},{get:(t,n)=>null}),c=new Proxy({get attr(){return u},get material(){return o},get dynamic(){return l}},{get:(t,n)=>n in t?t[n]:null}),y={get ios(){return n},get android(){return c}}},1224,[1225,1226,1227,1228,1229,1230]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(t){return null}function n(t){return null}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get Material3Color(){return n},get Material3DynamicColor(){return t}})},1225,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1226,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1227,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1228,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1229,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1230,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"LIVE_HEAD_CHEF",{enumerable:!0,get:function(){return o}});var t=r(d[0]),n=r(d[1]),c=r(d[2]),_=r(d[3]);const o='chef'===t.APP_VARIANT&&(0,c.isAnchorage)(_.VENUE_RID)&&!n.PITCH},1231,[806,2,1025,5]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.useLiveState=function(){const e=(0,s.useSync)(e=>e.mode),n=(0,s.useSync)(e=>e.venueId),o=(0,s.useSync)(e=>e.lastSyncAt);return l.PITCH||n&&o?'ready':'signin'===e||'local'===e||'off'===e||'unpaired'===e?'nolink':'offline'===e?'offline':'connecting'},_e.LiveWait=function({state:n,title:o,testID:s}){const l='nolink'===n&&'display'===e.APP_VARIANT?h:p[n];return(0,f.jsxs)(t.default,{testID:s,accessible:!0,accessibilityLabel:`${o}: ${l}`,style:{borderRadius:16,borderWidth:1,borderColor:c.colours.border,backgroundColor:c.colours.surface,padding:14,gap:4},children:[(0,f.jsx)(u.T,{size:12,weight:"semibold",colour:c.colours.goldMuted,children:o.toUpperCase()}),(0,f.jsx)(u.T,{size:18,weight:"semibold",children:l})]})};var e=r(d[0]);r(d[1]);var n,o=r(d[2]),t=(n=o)&&n.__esModule?n:{default:n},s=r(d[3]),l=r(d[4]),c=r(d[5]),u=r(d[6]),f=r(d[7]);const p={connecting:'Connecting\u2026',offline:'No connection. The live numbers show again when this phone is back online.',nolink:'Not connected to the venue. Open your personal link from your manager on this phone to see live numbers.'},h="This Display isn't paired yet. Tap Not paired to pair it."},1232,[806,30,127,820,2,821,813,24]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"QUEUED_BRAND",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"QUEUED_PALETTE",{enumerable:!0,get:function(){return l}});var t=r(d[0]),n=r(d[1]);const c=n.queuedVenues[t.VENUE_RID]?.branding,l={bg:c?.ink,surface:'#222222',surface2:'#292929',border:'#686868',gold:c?.accent,goldLight:c?.smallTextAccent,goldMuted:c?.smallTextAccent,onGold:c?.onAccent,goldTint:'#292929',tile:'#222222',tilePressed:'#292929',ok:c?.smallTextAccent,okBg:'#292929',blue:c?.smallTextAccent,blueBg:'#292929'}},1233,[5,6]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ABBOTSFORD_BRAND_ACCENT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"ABBOTSFORD_PALETTE",{enumerable:!0,get:function(){return n}});const t='#B89362',n={bg:'#32373C',surface:'#2A2F34',surface2:'#252A2F',tile:'#2A2F34',tilePressed:'#3D4349',border:'#777C81',gold:'#E5D08D',goldLight:'#F0DEA4',goldTint:'#3C372B',goldMuted:'#E5D08D',accentBg:'rgba(184,147,98,0.13)',accentBorder:'rgba(229,208,141,0.65)',onGold:'#0B0B0B',text:'#F8F4EA',muted:'#D7D1C7',ok:'#E5D08D',okBg:'#3C372B',blue:'#E5D08D',blueBg:'#3C372B'}},1234,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"KIRKTON_PALETTE",{enumerable:!0,get:function(){return t}});const t={bg:'#0B0B0B',surface:'#111111',surface2:'#141414',border:'#65554F',gold:'#B46C54',goldLight:'#D4A18E',goldTint:'#241A16',goldMuted:'#C99A86',tile:'#111111',tilePressed:'#141414',accentBg:'rgba(180,108,84,0.13)',accentBorder:'rgba(180,108,84,0.55)',onGold:'#0B0B0B',ok:'#D4A18E',okBg:'#241A16',blue:'#D4A18E',blueBg:'#241A16'}},1235,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"space",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"type",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"LINE",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"LINE_TIGHT",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"MIN_LINE",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"lineFor",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"radii",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"control",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"caps",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"layout",{enumerable:!0,get:function(){return y}});const t={xxs:2,xs:4,s:8,m:12,l:16,xl:24,xxl:32},n={micro:11,caption:12,small:14,body:16,large:18,title:22,hero:30,display:40},u=1.4,o=1.25,c=1.2,l=(t,n=u)=>Math.ceil(t*Math.max(n,c)),b={xs:4,s:8,m:12,button:14,l:16,xl:20,pill:999},f={min:48,tall:52,hero:56},p={letterSpacing:1.6},y={contentMax:640,headerSide:96}},1236,[]); +__d(function(_g,_r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.normaliseHex=n,e.hexToRgb=r,e.rgbToHex=o,e.hsvToRgb=s,Object.defineProperty(e,"hsvToHex",{enumerable:!0,get:function(){return a}}),e.hexToHsv=function(t){const{r:n,g:o,b:s}=r(t),a=n/255,c=o/255,u=s/255,i=Math.max(a,c,u),h=Math.min(a,c,u),l=i-h;let p=0;l&&(p=i===a?(c-u)/l%6:i===c?(u-a)/l+2:(a-c)/l+4);return{h:(60*p+360)%360,s:i?l/i:0,v:i}},e.luminance=c,e.contrast=u,e.shade=i,e.checkAccent=function(t,r,o,s){const a=n(t)??'#CFA45F',c=u(a,o),h=u(a,s),l=c>=h?o:s,p=[];Math.max(c,h)<4.5?p.push('Button text may be hard to read on this colour. We picked the clearer text colour for you, but a lighter or darker shade will read better.'):l===s&&p.push('This is a dark colour, so buttons use light text.');let b=a,d=0;for(;u(b,r)<4.5&&d<20;)b=i(a,.05*(d+1)),d++;b!==a&&p.push('This colour is hard to read on the dark background, so header text uses a lighter shade of it.');return{onAccent:l,accentText:b,tips:p}},e.pushRecent=function(t,r,o=8){const s=n(r);return s?[s,...(t??[]).filter(t=>t!==s)].slice(0,o):t??[]};const t=(t,n=0,r=1)=>Math.min(r,Math.max(n,t));function n(t){const n=t.trim().replace(/^#/,'');return/^[0-9a-fA-F]{3}$/.test(n)?'#'+n.split('').map(t=>t+t).join('').toUpperCase():/^[0-9a-fA-F]{6}$/.test(n)?'#'+n.toUpperCase():null}function r(t){const r=(n(t)??'#000000').slice(1);return{r:parseInt(r.slice(0,2),16),g:parseInt(r.slice(2,4),16),b:parseInt(r.slice(4,6),16)}}function o({r:n,g:r,b:o}){return'#'+[n,r,o].map(n=>Math.round(t(n,0,255)).toString(16).padStart(2,'0')).join('').toUpperCase()}function s({h:t,s:n,v:r}){const o=(t%360+360)%360/60,s=r*n,a=s*(1-Math.abs(o%2-1)),c=r-s,[u,i,h]=o<1?[s,a,0]:o<2?[a,s,0]:o<3?[0,s,a]:o<4?[0,a,s]:o<5?[a,0,s]:[s,0,a];return{r:255*(u+c),g:255*(i+c),b:255*(h+c)}}const a=t=>o(s(t));function c(t){const n=t=>{const n=t/255;return n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4)},{r:o,g:s,b:a}=r(t);return.2126*n(o)+.7152*n(s)+.0722*n(a)}function u(t,n){const r=c(t),o=c(n);return(Math.max(r,o)+.05)/(Math.min(r,o)+.05)}function i(t,n){const{r:s,g:a,b:c}=r(t),u=n>0?255:0,i=Math.abs(n);return o({r:s+(u-s)*i,g:a+(u-a)*i,b:c+(u-c)*i})}},1237,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.webLine=function(e,t){const u=n.default.flatten(e)||{},f='number'==typeof u.fontSize?u.fontSize:t,l='number'==typeof u.lineHeight?u.lineHeight:(0,o.lineFor)(f);return{lineHeight:String(Math.max(l/f,o.MIN_LINE))}},r(d[0]);var e,t=r(d[1]),n=(e=t)&&e.__esModule?e:{default:e},o=r(d[2])},1238,[122,46,1236]); +__d(function(g,_r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"localRepositories",{enumerable:!0,get:function(){return s}});var e=_r(d[0]);const a=()=>e.useStore.getState(),t=e=>Promise.resolve(e),s={customers:{update:async e=>a().updateCustomer(e),setAllergy:async(e,t)=>a().setAllergy(e,t)},menu:{updateItem:async(e,t)=>a().updateMenuItem(e,t),setSignOff:async(e,t)=>a().setSignOff(e,t)},orders:{placeFromBasket:e=>t(a().placeOrder(e)),accept:async(e,t,s)=>a().acceptOrder(e,t,s),setStatus:async(e,t,s)=>a().setOrderStatus(e,t,s),acknowledgeAllergy:async(e,t)=>a().ackOrderAllergy(e,t),acknowledgeReadiness:async(e,t,s)=>a().ackReadiness(e,t,s),recordHandoverCheck:async(e,t)=>a().handoverCheck(e,t),signAllergyStep:async(e,t,s)=>a().signAllergyStep(e,t,s),customerSignal:async(e,t)=>a().customerSignal(e,t),setSplit:async(e,t,s)=>a().setSplit(e,t,s),payTable:async(e,t)=>a().payTable(e,t)},bookings:{create:e=>t(a().createBooking(e)),setStatus:async(e,t)=>a().setBookingStatus(e,t),decide:async(e,t,s)=>a().decideBooking(e,t,s),acknowledgeAllergy:async(e,t)=>a().ackBookingAllergy(e,t),seatWalkIn:(e,s,n,c)=>t(a().seatWalkIn(e,s,n,c)),assignTable:async(e,t)=>a().setBookingTable(e,t),undoWalkIn:async e=>a().undoWalkIn(e),update:async(e,t)=>a().updateBooking(e,t)},waitlist:{join:(e,s,n,c)=>t(a().joinWaitlist(e,s,n,c)),setStatus:async(e,t)=>a().setWaitlistStatus(e,t),addWalkIn:async(e,t)=>a().addWalkIn(e,t)},loyalty:{addStamp:async(e,t,s)=>a().addStamp(e,t,s),redeemReward:async(e,t)=>a().redeemReward(e,t)},giftCards:{purchase:(e,s,n,c)=>t(a().buyGiftCard(e,s,n,c))},calendar:{addEvent:async e=>a().addEvent(e)},feedback:{add:async e=>a().addRating(e)},restaurants:{updateSettings:async(e,t)=>a().updateSettings(e,t)},alerts:{acknowledge:async(e,t)=>a().ackAlert(e,t)}}},1239,[872]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"orderAtTableOn",{enumerable:!0,get:function(){return t}});const t=t=>!!t&&(t.settings.orderAtTable??!0)},1240,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/display-app/assets/assets/brand/3idiots.df4a76d2130f0e5b0042f06a8c88693a.png",width:1024,height:1024,toString(){return this.uri}}},1241,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/display-app/assets/assets/brand/cecchinis.ebf752fef363247848ae7c0d91938765.png",width:1024,height:1024,toString(){return this.uri}}},1242,[]); +__d(function(s,i,t,r,a,c,d){"use strict";a.exports={uri:"/wildings/display-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png",width:1024,height:1024,toString(){return this.uri}}},1243,[]); +__d(function(s,i,t,n,r,a,e){"use strict";r.exports={uri:"/wildings/display-app/assets/assets/brand/yasmins.8482602e9f0a965655924835625cb02b.png",width:1024,height:1024,toString(){return this.uri}}},1244,[]); +__d(function(s,i,t,a,e,r,n){"use strict";e.exports={uri:"/wildings/display-app/assets/assets/brand/williewastles.055a77893ced99bf3a6c5402ba5baac6.png",width:1024,height:1024,toString(){return this.uri}}},1245,[]); +__d(function(e,s,t,i,r,d,n){"use strict";r.exports={uri:"/wildings/display-app/assets/assets/brand/rupeeroom.689e6fb536dc0845eeb174a1ec7bd346.png",width:1024,height:1024,toString(){return this.uri}}},1246,[]); +__d(function(s,t,i,a,d,n,r){"use strict";d.exports={uri:"/wildings/display-app/assets/assets/brand/smokinggoat.20a3a1970596ab43c5d6468d4ed549a7.png",width:1024,height:1024,toString(){return this.uri}}},1247,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/display-app/assets/assets/brand/pizzaioli.db8c000b62ee407121aa8b90ce45e170.png",width:1024,height:1024,toString(){return this.uri}}},1248,[]); +__d(function(s,t,i,e,n,r,a){"use strict";n.exports={uri:"/wildings/display-app/assets/assets/brand/drunkencoo.f6d92af3b14e4205a3deaf4434754c51.png",width:1024,height:1024,toString(){return this.uri}}},1249,[]); +__d(function(s,t,i,a,r,d,e){"use strict";r.exports={uri:"/wildings/display-app/assets/assets/brand/abbotsford.b26602bba5ce4969733c5422a45ad053.png",width:1024,height:1024,toString(){return this.uri}}},1250,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/display-app/assets/assets/brand/kirkton.bcf8d846df4861474d224a7a77f498fb.png",width:1024,height:1024,toString(){return this.uri}}},1251,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/display-app/assets/assets/brand/greenside.9d1556db97dcb903a3c57e2063ee2255.png",width:1024,height:1024,toString(){return this.uri}}},1252,[]); +__d(function(i,s,t,d,n,r,a){"use strict";n.exports={uri:"/wildings/display-app/assets/assets/brand/wildings.076f4fcd06d19a0af0205c410f461b14.png",width:1024,height:1024,toString(){return this.uri}}},1253,[]); +__d(function(i,s,t,e,r,a,d){"use strict";r.exports={uri:"/wildings/display-app/assets/assets/brand/kirkmichael.63b13cde7fd82eb622622b39ac80c394.png",width:1024,height:1024,toString(){return this.uri}}},1254,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/display-app/assets/assets/brand/souters.f4c58d9349b6e1700fe5abcc9e9b665c.png",width:1024,height:1024,toString(){return this.uri}}},1255,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/display-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png",width:512,height:512,toString(){return this.uri}}},1256,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/display-app/assets/assets/brand/saltmarsh.85a6a65732635e5148478d743d9ca884.png",width:512,height:512,toString(){return this.uri}}},1257,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/display-app/assets/assets/brand/brae.8de9e89ac30966c6669de990370d8e40.png",width:512,height:512,toString(){return this.uri}}},1258,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/display-app/assets/assets/brand/3idiots-hero.e5dfd53739f05086b1956e72d585a66a.png",width:1024,height:1024,toString(){return this.uri}}},1259,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/display-app/assets/assets/brand/cecchinis-hero.f77780fcc94fd668cf35d66d6dc52d81.png",width:1024,height:1024,toString(){return this.uri}}},1260,[]); +__d(function(s,i,t,r,a,e,d){"use strict";a.exports={uri:"/wildings/display-app/assets/assets/brand/mrbasrais-hero.4ce74641cfcf52d099157c84005b9d2a.png",width:1024,height:1024,toString(){return this.uri}}},1261,[]); +__d(function(s,i,t,e,a,r,n){"use strict";a.exports={uri:"/wildings/display-app/assets/assets/brand/yasmins-hero.a5aef62e37dfcecbe0afc056186f4ad9.png",width:1024,height:1024,toString(){return this.uri}}},1262,[]); +__d(function(s,i,t,e,r,a,d){"use strict";r.exports={uri:"/wildings/display-app/assets/assets/brand/williewastles-hero.b9d53d27b66f903b5618a7177b2ffad4.png",width:1024,height:1024,toString(){return this.uri}}},1263,[]); +__d(function(a,s,t,i,r,e,d){"use strict";r.exports={uri:"/wildings/display-app/assets/assets/brand/rupeeroom-hero.969fa372add526aaacf3a6c009b8ac92.png",width:1024,height:1024,toString(){return this.uri}}},1264,[]); +__d(function(s,t,i,e,d,r,n){"use strict";d.exports={uri:"/wildings/display-app/assets/assets/brand/smokinggoat-hero.0588f17ef0eed7f757f22916cd4d37db.png",width:1600,height:900,toString(){return this.uri}}},1265,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/display-app/assets/assets/brand/pizzaioli-hero.1896657c08264cefb49b401891d5448d.png",width:1024,height:1024,toString(){return this.uri}}},1266,[]); +__d(function(s,t,i,r,e,n,a){"use strict";e.exports={uri:"/wildings/display-app/assets/assets/brand/drunkencoo-hero.65c21c4da9e466cf4bffc969639a1427.png",width:1600,height:900,toString(){return this.uri}}},1267,[]); +__d(function(s,t,e,i,r,a,d){"use strict";r.exports={uri:"/wildings/display-app/assets/assets/brand/abbotsford-hero.78fcb8ee06ee22c4ca659c9254db7512.png",width:1024,height:1024,toString(){return this.uri}}},1268,[]); +__d(function(t,i,s,r,n,d,e){"use strict";n.exports={uri:"/wildings/display-app/assets/assets/brand/kirkton-hero.9d0837b292c2f4f30f4521d806bb28c3.png",width:1024,height:1024,toString(){return this.uri}}},1269,[]); +__d(function(s,i,t,e,r,a,c){"use strict";r.exports={uri:"/wildings/display-app/assets/assets/brand/greenside-hero.1caec5a6cb939434cccb5f3a613b50f8.png",width:1024,height:1024,toString(){return this.uri}}},1270,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/display-app/assets/assets/brand/wildings-hero-logo-text.4661e4b935726f2511f9c17a1567c89a.png",width:1024,height:1024,toString(){return this.uri}}},1271,[]); +__d(function(i,s,t,e,r,a,d){"use strict";r.exports={uri:"/wildings/display-app/assets/assets/brand/kirkmichael-hero.63b13cde7fd82eb622622b39ac80c394.png",width:1024,height:1024,toString(){return this.uri}}},1272,[]); +__d(function(s,t,i,r,e,n,a){"use strict";e.exports={uri:"/wildings/display-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png",width:1024,height:1024,toString(){return this.uri}}},1273,[]); +__d(function(_g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.getFix=function(e=1e4){const t='undefined'!=typeof navigator?navigator.geolocation:void 0;return t?new Promise(o=>{let n=!1;const c=e=>{n||(n=!0,o(e))},u=setTimeout(()=>c('timeout'),e+1500);try{t.getCurrentPosition(e=>{clearTimeout(u),c({lat:e.coords.latitude,lng:e.coords.longitude,acc:e.coords.accuracy??999})},e=>{clearTimeout(u),c(1===e.code?'denied':3===e.code?'timeout':'unavailable')},{enableHighAccuracy:!0,timeout:e,maximumAge:0})}catch{clearTimeout(u),c('unsupported')}}):Promise.resolve('unsupported')},_e.locationAllowed=async function(){try{const e=await(navigator.permissions?.query({name:'geolocation'}));return'granted'===e?.state}catch{return!1}}},1274,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"VAPID_PUBLIC_KEY",{enumerable:!0,get:function(){return t}});const t='BC3MoXpycbFY4Nf3czfBMaiD0iaMd1ugc70iUWZUiaScERZibFBsI9cmPAiNrlPN0b2_wJR-wgutj4eC8suarQ0'},1275,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"SEEDED_ANSWERS",{enumerable:!0,get:function(){return f}});var n=r(d[0]),t=e(r(d[1])),l=e(r(d[2])),o=e(r(d[3])),s=e(r(d[4])),u=e(r(d[5])),p=e(r(d[6])),h=r(d[7]),c=r(d[8]);const f={...Object.fromEntries(Object.entries(n.queuedVenues).map(([e,n])=>[e,(0,h.cleanQuestionnaire)(n.questionnaire,e)??{}])),greenside:(0,h.cleanQuestionnaire)(t.default,'greenside')??{},abbotsford:(0,h.cleanQuestionnaire)(l.default,'abbotsford')??{},kirkton:(0,h.cleanQuestionnaire)(o.default,'kirkton')??{},wildings:(0,h.cleanQuestionnaire)(s.default,'wildings')??{},kirkmichael:(0,h.cleanQuestionnaire)(u.default,'kirkmichael')??{},souters:(0,h.cleanQuestionnaire)(p.default,'souters')??{},anchorage:{source:'from-config',submittedAt:'2026-10-01',onboardedAt:'2026-10-01',pay:c.ANCHORAGE_PAY},saltmarsh:{source:'signup-form',submittedAt:'2026-10-27',venue:{name:'The Venue',tagline:'Seasonal small plates by the harbour (fictional)',address:'4 Quay Street, Port Ailsa (fictional)',phone:'01632 960 418',email:'hello@thevenue.example',website:'thevenue.example'},tables:{template:'bistro',tables:14,covers:48,areas:['Inside','Terrace']},team:[{name:'Morven Reid (example)',role:'owner',job:'Owner',email:'morven@thevenue.example'},{name:'Callum Shaw (example)',role:'manager',job:'General manager',email:'callum@thevenue.example'},{name:'Isla Grant (example)',role:'staff',job:'Head chef'},{name:'Ruaridh Bell (example)',role:'staff',job:'Waiter',phone:'07700 900 311'},{name:'Ellie Muir (example)',role:'staff',job:'Waiter'}],suppliers:[{name:'Ailsa Fish Co (example)',category:'Fish',phone:'01632 960 101'},{name:'Hillside Dairy (example)',category:'Dairy',email:'orders@hillside.example'}],pay:{tipsFrequency:'fortnightly',tipsAnchorPayday:'2026-11-06',tipsEndsDaysBefore:5,wagePayDay:28,wageCutoffDay:20,weekendRule:'before'},accounts:[{provider:'gmail',handle:'hello@thevenue.example'},{provider:'wix',handle:'thevenue.example'},{provider:'instagram',handle:'@thevenue.demo'},{provider:'facebook',handle:'The Venue'},{provider:'google-business',handle:'The Venue'},{provider:'sumup',handle:'The Venue'},{provider:'xero',handle:'The Venue Ltd'}],features:{bookings:!0,takeaway:!0,orderAtTable:!0,tips:!0,rota:!0,games:!1,specials:!0},notes:'Fictional example answers for the demo venue.'}}},1276,[6,1277,1278,1279,867,866,1280,865,3]); +__d(function(e,a,n,s,o,r,t){o.exports={version:1,venueId:"greenside",source:"from-config",submittedAt:"2026-11-06",venue:{name:"The Greenside Restaurant",tagline:"Restaurant \u2022 Wood Fired Pizza \u2022 Maybole",address:"5 Greenside, Maybole, South Ayrshire KA19 7DG",phone:"01655 889685",email:"info@thegreensiderestaurant.co.uk",website:"https://thegreensiderestaurant.co.uk/",hasLogo:!0,emailNeedsConfirmation:!0},hours:{days:{0:["10:00","00:00"],1:null,2:null,3:["10:00","23:00"],4:["10:00","23:00"],5:["10:00","00:00"],6:["10:00","00:00"]},note:"Closed Monday and Tuesday. Venue Wednesday and Thursday 10:00\u201323:00, Friday to Sunday 10:00\u201300:00. Kitchen Wednesday, Thursday and Sunday 10:00\u201320:00; Friday and Saturday 10:00\u201321:00. Cash only."},tables:{template:"restaurant",tables:null,covers:null,areas:["Restaurant","Beer garden"],needsConfirmation:!0,note:"Historical figure about 50 covers inside and about 48 in seasonal beer garden (former GM LinkedIn). Names, tables and covers need Gordon's confirmation. Bar and restaurant only \u2014 no accommodation."},team:[],suppliers:[],accounts:[],features:{bookings:!0,takeaway:!1,orderAtTable:!1,tips:!0,rota:!0,games:!0,specials:!0},notes:"Separate greenside tenant. No staff, invites or table plan yet. Cash only; no card payments or deposits. CoverCharge manager-confirmed table requests only, with Call01655 889685 as backup. Menu, allergens, public email, pay settings and deposit policy need confirmation. No external booking or ordering links."}},1277,[]); +__d(function(e,o,a,t,r,n,s){r.exports={version:1,venueId:"abbotsford",source:"from-config",submittedAt:"2026-11-06",venue:{name:"The Abbotsford Hotel",tagline:"Get Hungry. Get Curious.",address:"14 Corsehill Road, Ayr KA7 2ST",phone:"01292 261506",email:"info@abbotsfordhotel.co.uk",website:"https://www.abbotsfordhotel.co.uk/",hasLogo:!0},hours:{days:{0:["10:00","20:30"],1:["10:00","20:30"],2:["10:00","20:30"],3:["10:00","20:30"],4:["10:00","20:30"],5:["10:00","20:30"],6:["10:00","20:30"]},note:"Daily 10:00\u201320:30 \u2014 to confirm with the hotel. Copper Bar hours to confirm."},tables:{template:"restaurant",tables:null,covers:null,areas:[],needsConfirmation:!0,note:"Rowan seats up to 120 (published). Restaurant and bar covers/tables unknown."},team:[],suppliers:[],accounts:[{provider:"facebook",handle:"TheAbbotsfordHotel"},{provider:"instagram",handle:"@abbotsfordhotelayr"},{provider:"tiktok",handle:"@the.abbotsford.hotel.ayr"}],features:{bookings:!0,takeaway:!1,orderAtTable:!1,tips:!0,rota:!0,games:!0,specials:!0},notes:"Separate abbotsford tenant. Epicurious restaurant and The Copper Bar. CoverCharge dining and room requests require manager confirmation. No external booking links, no room inventory module or external booking integrations. Zero staff/invites/sample data. Deposit, manager, team, table plan/covers, Copper Bar hours, dog policy and allergens to confirm."}},1278,[]); +__d(function(e,n,t,a,o,r,i){o.exports={version:1,venueId:"kirkton",source:"from-config",submittedAt:"2026-11-06",venue:{name:"The Kirkton Inn",tagline:"Bar and restaurant in Dalrymple, Ayrshire \u2014 Burns country hospitality",address:"1-3 Main Street, Dalrymple, East Ayrshire KA6 6DF",phone:"",email:"",website:"",hasLogo:!0},hours:{days:{0:null,1:null,2:null,3:null,4:null,5:null,6:null},note:"Current opening and kitchen hours to confirm. No service times set."},tables:{template:"restaurant",tables:null,covers:null,areas:[],needsConfirmation:!0,note:"Table plan and capacity to confirm."},team:[],suppliers:[],accounts:[],features:{bookings:!0,takeaway:!1,orderAtTable:!1,tips:!0,rota:!0,games:!0,specials:!0},notes:"Separate kirkton tenant. No staff or personal links. Room inventory and current letting to confirm; room functionality deferred. No external booking integrations. Phone, public email, website, current hours, capacity, table plan, takeaway, pay and deposit policy to confirm. Archived 2019 menus are provisional and not saleable stock."}},1279,[]); +__d(function(e,o,r,s,a,t,n){a.exports={version:1,venueId:"souters",source:"from-config",submittedAt:"2026-11-05",onboardedAt:"2026-11-05",venue:{name:"Souter's Inn",tagline:"Culinary excellence meets country hospitality in Kirkoswald",address:"47 Main Road, Kirkoswald, South Ayrshire KA19 8HY",phone:"01655 760653",email:"souters@southernayr.com",website:"https://www.soutersinn.com/",hasLogo:!0},hours:{days:{0:["09:00","21:00"],1:["09:00","21:00"],2:["09:00","21:00"],3:["09:00","21:00"],4:["09:00","21:00"],5:["09:00","21:00"],6:["09:00","21:00"]},note:"Open daily 9am\u20139pm. Breakfast 9\u201311.45am; main food service from noon. Confirm last orders with the venue."},tables:{template:"restaurant",tables:0,covers:130,areas:[]},team:[],suppliers:[{name:"Pollok Williamson Butchers",category:"Meat",phone:"",email:""}],accounts:[{provider:"instagram",handle:"@soutersinn"},{provider:"facebook",handle:"Souter's Inn"},{provider:"gmail",handle:"souters@southernayr.com"},{provider:"tripadvisor",handle:"Souter's Inn Kirkoswald"},{provider:"google-business",handle:"Souter's Inn"}],features:{bookings:!0,takeaway:!0,orderAtTable:!1,tips:!0,rota:!0,games:!0,specials:!0},notes:"Part of Southern Ayr Limited (Brian Daly). Sister venues: Abbotsford Hotel, The Brig, Bridges Bar, Wellingtons. Bookings: guests request a table in CoverCharge. Deposit default suggested \xa310pp from party of 6 \u2014 confirm with venue (published \xa310pp for some events). Regional Scottish Thistle Award Best Eating Experience 2026. Brand accent from official logo SVG fill #A4622E. Real table plan, manager contact, team, priced menu and deposit confirmation still required; no tables or staff seeded."}},1280,[]); +__d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.pickPhotos=function(t={}){const a=t.source??'camera';return'undefined'==typeof document?n(a):new Promise(t=>{const n=document.createElement('input');n.type='file',n.accept='image/*',n.multiple=!0,'camera'===a&&n.setAttribute('capture','environment'),n.setAttribute('data-testid','camera'===a?'photo-input':'gallery-input'),n.style.display='none',n.onchange=async()=>{const a=Array.from(n.files??[]).slice(0,8),o=[];for(const t of a)try{o.push(await r(t))}catch{}n.remove(),t(o)},document.body.appendChild(n),n.click()})},e.shrink=r,e.uploadPhoto=async function(n,r,o,c){const i=a.useSync.getState();if('staff'!==i.kind||!i.venueId)return null;try{const a=await(await fetch(o)).blob(),s=`${i.venueId}/${n}/${r}-${Date.now()}-${c}.jpg`,{error:u}=await(0,t.getSupabase)().storage.from('cashup-photos').upload(s,a,{contentType:'image/jpeg',upsert:!1});return u?null:s}catch{return null}},e.photoUrl=async function(a){if(a.startsWith('data:'))return a;try{const{data:n}=await(0,t.getSupabase)().storage.from('cashup-photos').createSignedUrl(a,600);return n?.signedUrl??null}catch{return null}},_r(d[0]);var t=_r(d[1]),a=_r(d[2]);async function n(t){try{const a=_r(d[3],"expo-image-picker"),n={mediaTypes:['images'],quality:.7,base64:!0,allowsMultipleSelection:'gallery'===t,selectionLimit:8};if('camera'===t){if(!(await a.requestCameraPermissionsAsync()).granted)return[]}const r='camera'===t?await a.launchCameraAsync(n):await a.launchImageLibraryAsync(n);return r.canceled?[]:r.assets.filter(t=>t.base64).map(t=>`data:image/jpeg;base64,${t.base64}`)}catch{return[]}}function r(t,a=1600){return new Promise((n,r)=>{const o=URL.createObjectURL(t),c=new Image;c.onload=()=>{const t=Math.min(1,a/Math.max(c.width,c.height)),r=document.createElement('canvas');r.width=Math.round(c.width*t),r.height=Math.round(c.height*t),r.getContext('2d').drawImage(c,0,0,r.width,r.height),URL.revokeObjectURL(o),n(r.toDataURL('image/jpeg',.78))},c.onerror=()=>{URL.revokeObjectURL(o),r(new Error('not an image'))},c.src=o})}},1281,[122,863,820,1035]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return c}});var t=r(d[0]),n=r(d[1]),s=r(d[2]);const o={images:'image/*',videos:'video/mp4,video/quicktime,video/x-m4v,video/*',livePhotos:''};var c={launchImageLibraryAsync:async({mediaTypes:t=['images'],allowsMultipleSelection:n=!1,base64:s=!1})=>'undefined'==typeof window||'undefined'==typeof document?{canceled:!0,assets:null}:await u({mediaTypes:t,allowsMultipleSelection:n,base64:s}),launchCameraAsync:async({mediaTypes:t=['images'],allowsMultipleSelection:n=!1,base64:s=!1,cameraType:o})=>'undefined'==typeof window||'undefined'==typeof document?{canceled:!0,assets:null}:await u({mediaTypes:t,allowsMultipleSelection:n,capture:o??!0,base64:s}),getCameraPermissionsAsync:async()=>l(),requestCameraPermissionsAsync:async()=>l(),getMediaLibraryPermissionsAsync:async t=>l(),requestMediaLibraryPermissionsAsync:async t=>l()};function l(){return{status:t.PermissionStatus.GRANTED,expires:'never',granted:!0,canAskAgain:!0}}function u({mediaTypes:t,capture:o=!1,allowsMultipleSelection:c=!1,base64:l}){const u=w((0,s.parseMediaTypes)(t)),p=document.createElement('input');if(p.style.display='none',p.setAttribute('type','file'),p.setAttribute('accept',u),p.setAttribute('id',String(Math.random())),p.setAttribute('data-testid','file-input'),c&&p.setAttribute('multiple','multiple'),o)switch(o){case!0:p.setAttribute('capture','camera');break;case n.CameraType.front:p.setAttribute('capture','user');break;case n.CameraType.back:p.setAttribute('capture','environment')}return document.body.appendChild(p),new Promise(t=>{p.addEventListener('change',async()=>{if(p.files?.length){const n=c?p.files:[p.files[0]];try{const s=await Promise.all(Array.from(n).filter(t=>null!=t).map(t=>f(t,{base64:l})));t({canceled:!1,assets:s})}catch(n){t(Promise.reject(n))}}else t({canceled:!0,assets:null});document.body.removeChild(p)}),p.addEventListener('cancel',()=>{p.dispatchEvent(new Event('change'))});const n=new MouseEvent('click');p.dispatchEvent(n)})}async function p(t){return new Promise(n=>{const s=new Image;s.onload=()=>{n({width:s.naturalWidth??s.width,height:s.naturalHeight??s.height})},s.onerror=()=>n({width:0,height:0}),s.src=t})}async function y(t){return new Promise(n=>{const s=document.createElement('video');s.preload='metadata',s.onloadedmetadata=()=>{n({width:s.videoWidth,height:s.videoHeight,duration:s.duration})},s.onerror=()=>n({width:0,height:0,duration:0}),s.src=t})}async function h(t){return new Promise((n,s)=>{const o=new FileReader;o.onerror=()=>{s(new Error('Failed to read the selected media because the operation failed.'))},o.onload=t=>{const o=t.target?.result;'string'==typeof o?n(o.split(',')?.[1]??''):s(new Error('Failed to read file as base64'))},o.readAsDataURL(t)})}async function f(t,n){const s=t.type,o=URL.createObjectURL(t);let c,l;if(s.startsWith('image/'))c=await p(o);else{if(!s.startsWith('video/'))throw new Error(`Unsupported file type: ${s}. Only images and videos are supported.`);c=await y(o)}return n.base64&&(l=await h(t)),{uri:o,width:c.width,height:c.height,type:s.startsWith('image/')?'image':'video',mimeType:s,fileName:t.name,fileSize:t.size,file:t,...void 0!==c.duration&&{duration:c.duration},...l&&{base64:l}}}function w(t){const n=t.filter(t=>'livePhotos'!==t);if(0===n.length)return'image/*';let s='';for(const t of n)s.includes(o[t])||(s=s.concat(',',o[t]));return s}},1282,[570,1283,1284]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"MediaTypeOptions",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"VideoExportPreset",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"UIImagePickerControllerQualityType",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"UIImagePickerPresentationStyle",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"UIImagePickerPreferredAssetRepresentationMode",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"CameraType",{enumerable:!0,get:function(){return l}});let t=(function(t){return t.All="All",t.Videos="Videos",t.Images="Images",t})({}),n=(function(t){return t[t.Passthrough=0]="Passthrough",t[t.LowQuality=1]="LowQuality",t[t.MediumQuality=2]="MediumQuality",t[t.HighestQuality=3]="HighestQuality",t[t.H264_640x480=4]="H264_640x480",t[t.H264_960x540=5]="H264_960x540",t[t.H264_1280x720=6]="H264_1280x720",t[t.H264_1920x1080=7]="H264_1920x1080",t[t.H264_3840x2160=8]="H264_3840x2160",t[t.HEVC_1920x1080=9]="HEVC_1920x1080",t[t.HEVC_3840x2160=10]="HEVC_3840x2160",t})({}),u=(function(t){return t[t.High=0]="High",t[t.Medium=1]="Medium",t[t.Low=2]="Low",t[t.VGA640x480=3]="VGA640x480",t[t.IFrame1280x720=4]="IFrame1280x720",t[t.IFrame960x540=5]="IFrame960x540",t})({}),o=(function(t){return t.FULL_SCREEN="fullScreen",t.PAGE_SHEET="pageSheet",t.FORM_SHEET="formSheet",t.CURRENT_CONTEXT="currentContext",t.OVER_FULL_SCREEN="overFullScreen",t.OVER_CURRENT_CONTEXT="overCurrentContext",t.POPOVER="popover",t.AUTOMATIC="automatic",t})({}),c=(function(t){return t.Automatic="automatic",t.Compatible="compatible",t.Current="current",t})({}),l=(function(t){return t.back="back",t.front="front",t})({})},1283,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.parseMediaTypes=p,e.mapDeprecatedOptions=function(s){if(!s.mediaTypes)return s;return{...s,mediaTypes:p(s.mediaTypes??[])}};var s=r(d[0]);function p(p){const n={Images:['images'],Videos:['videos'],All:['images','videos']};return p===s.MediaTypeOptions.Images||p===s.MediaTypeOptions.Videos||p===s.MediaTypeOptions.All?(console.warn('[expo-image-picker] `ImagePicker.MediaTypeOptions` have been deprecated. Use `ImagePicker.MediaType` or an array of `ImagePicker.MediaType` instead.'),n[p]):'string'==typeof p?[p]:p}},1284,[1283]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.readSheet=async function(l,u,c){const f=u.filter(t=>!t.startsWith('data:'));try{const u=n.useSync.getState();if('staff'!==u.kind||!u.venueId||!f.length)return{vals:o(c),reader:null,note:s};const{data:h,error:y}=await(0,t.getSupabase)().functions.invoke('cashup-read',{body:{kind:l,venueId:u.venueId,paths:f,fields:c.filter(t=>'text'!==t.kind).map(t=>({key:t.key,label:t.label,kind:t.kind}))}});if(y||!h||'object'!=typeof h||!h.vals)return{vals:o(c),reader:null,note:s};const p=o(c);for(const t of c){const n=h.vals[t.key];'number'==typeof n&&Number.isFinite(n)&&(p[t.key]=Math.round(100*n)/100)}const v=Object.values(p).filter(t=>null!=t).length;return v?{vals:p,categories:Array.isArray(h.categories)?h.categories:[],reader:String(h.reader??'photo reader'),note:`${v} figure${1===v?'':'s'} read from the photo. Check each one against the photo before you confirm.`}:{vals:p,reader:null,note:'The photo couldn\u2019t be read clearly, so type the figures from it.'}}catch{return{vals:o(c),reader:null,note:s}}};var t=r(d[0]),n=r(d[1]);const o=t=>Object.fromEntries(t.map(t=>[t.key,null])),s='Automatic reading isn\u2019t switched on yet, so type the figures from the photo. Nothing is filled in for you.'},1285,[863,820]); +__d(function(g,_r,_i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.pickSpreadsheet=function(){return'undefined'==typeof document?Promise.resolve({error:'Upload a spreadsheet from the Managers app in a web browser.'}):new Promise(e=>{const s=document.createElement('input');s.type='file',s.accept='.csv,.xlsx,text/csv,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',s.setAttribute('data-testid','sheet-input'),s.style.display='none',s.onchange=async()=>{const t=s.files?.[0];if(s.remove(),!t)return e(null);if(t.size>5242880)return e({error:'That file is over 5 MB. Export just the takings columns and try again.'});try{const s=/\.xlsx$/i.test(t.name)?await(0,c.readXlsx)(await t.arrayBuffer()):(0,r.parseCsv)(await t.text());e(s.length?{name:t.name,rows:s}:{error:'The file looks empty.'})}catch(s){e({error:s instanceof Error?s.message:'The file couldn\u2019t be read. Try saving it as CSV.'})}},document.body.appendChild(s),s.click()})},_e.SpreadsheetImport=function({rid:e,file:t,who:c,onClose:v,onSaved:w,locked:x}){const[y,$]=(0,s.useState)(!0),b=y?t.rows[0]:t.rows[0].map((e,s)=>`Column ${s+1}`),[j,k]=(0,s.useState)(()=>(0,r.guessMapping)(t.rows[0])),[C,T]=(0,s.useState)(!1),[D,S]=(0,s.useState)('map'),B=(0,n.useCashUp)(e=>e.cashUps),I=(0,s.useMemo)(()=>new Set(B.filter(s=>s.rid===e&&s.confirmedAt&&null!=(0,i.grossOf)(s.vals)).map(e=>e.date)),[B,e]),M=(0,s.useMemo)(()=>(0,r.buildPreview)(t.rows,j,y,I),[t.rows,j,y,I]),P=M.filter(e=>e.ok&&!(e.date&&x(e.date))),R=P.filter(e=>'saved'!==e.dup||C),z=P.filter(e=>'saved'===e.dup).length,L=M.filter(e=>!e.ok).length,U=M.filter(e=>e.ok&&e.date&&x(e.date)).length,E=null!=j.date&&null!=j.gross;return(0,u.jsxs)(l.Sheet,{visible:!0,onClose:v,title:"Upload a spreadsheet",maxWidth:1e3,testID:"sheet-import",children:[(0,u.jsx)(l.Muted,{children:`${t.name} \xb7 ${t.rows.length-(y?1:0)} row${t.rows.length-(y?1:0)==1?'':'s'}`}),'map'===D?(0,u.jsxs)(o.default,{style:{gap:10},testID:"sheet-map",children:[(0,u.jsx)(l.T,{size:17,weight:"semibold",children:"1. Which column is which?"}),(0,u.jsx)(l.Muted,{children:"Tip: Date and Gross takings are needed. Food, drink, card and cash are optional. Leave a column as \u201cNot in the file\u201d if you don\u2019t have it."}),(0,u.jsx)(l.Toggle,{testID:"sheet-header",label:"The first row is headings",value:y,onChange:$}),r.COLS.map(e=>(0,u.jsxs)(o.default,{style:{gap:4},testID:`sheet-col-${e.key}`,children:[(0,u.jsxs)(l.Row,{gap:6,children:[(0,u.jsx)(l.T,{weight:"semibold",children:e.label}),e.required?(0,u.jsx)(l.Badge,{kind:"gold",label:"NEEDED"}):(0,u.jsx)(l.Muted,{children:"optional"})]}),(0,u.jsxs)(l.Row,{wrap:!0,gap:6,children:[e.required?null:(0,u.jsx)(l.Chip,{label:"Not in the file",selected:null==j[e.key],onPress:()=>k({...j,[e.key]:void 0})}),b.map((s,o)=>(0,u.jsx)(l.Chip,{testID:`sheet-col-${e.key}-${o}`,label:s||`Column ${o+1}`,sub:y?void 0:t.rows[0][o],selected:j[e.key]===o,onPress:()=>{const s={...j};Object.keys(s).forEach(e=>{s[e]===o&&delete s[e]}),s[e.key]=o,k(s)}},o))]})]},e.key)),(0,u.jsx)(l.Button,{testID:"sheet-to-preview",label:"Preview",disabled:!E,onPress:()=>{S('preview'),f(`${M.filter(e=>e.ok).length} rows ready, ${L} with problems.`)}})]}):null,'preview'===D?(0,u.jsxs)(o.default,{style:{gap:10},testID:"sheet-preview",children:[(0,u.jsx)(l.T,{size:17,weight:"semibold",children:"2. Check the preview"}),(0,u.jsx)(o.default,{accessibilityLiveRegion:"polite",children:(0,u.jsx)(l.T,{testID:"sheet-summary",children:`${P.length} night${1===P.length?'':'s'} ready${L?` \xb7 ${L} row${1===L?'':'s'} with a problem (not saved)`:''}${U?` \xb7 ${U} signed off and locked (not changed)`:''}`})}),z?(0,u.jsx)(l.Banner,{kind:"warn",title:`${z} date${1===z?' already has':'s already have'} takings in CoverCharge`,children:(0,u.jsxs)(o.default,{style:{gap:6},children:[(0,u.jsx)(l.Toggle,{testID:"sheet-replace",label:"Replace those nights\u2019 takings with the spreadsheet",value:C,onChange:T}),(0,u.jsx)(l.Muted,{children:C?'Those nights will be replaced (the change is logged).':'Those nights are skipped; their saved takings are kept.'})]})}):null,M.slice(0,62).map(e=>{const s=e.ok&&'saved'===e.dup&&!C,t=e.ok&&!!e.date&&x(e.date),n=e.ok?t?'Locked: not changed':s?'Already saved: skipped':'saved'===e.dup?'Replaces saved takings':'Ready':e.errors.join('; ');return(0,u.jsxs)(o.default,{testID:`sheet-row-${e.line}`,accessible:!0,accessibilityLabel:`Row ${e.line}: ${e.date?m(e.date):'no date'}, gross ${p(e.vals.gross)}. ${n}`,style:{paddingVertical:8,gap:2,borderBottomWidth:1,borderBottomColor:h.colours.hairline,opacity:!e.ok||s||t?.75:1},children:[(0,u.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(l.T,{size:15,weight:"semibold",children:`Row ${e.line} \xb7 ${e.date?m(e.date):'no date'}`}),(0,u.jsx)(l.T,{size:15,weight:"semibold",colour:h.colours.goldLight,children:p(e.vals.gross)})]}),(()=>{const s=['food','drink','card','cash'].filter(s=>null!=j[s]&&null!=e.vals[s]).map(s=>`${s[0].toUpperCase()}${s.slice(1)} ${p(e.vals[s])}`);return s.length?(0,u.jsx)(l.T,{size:13,colour:h.colours.text,children:s.join(' \xb7 ')}):null})(),(0,u.jsx)(l.T,{size:13,colour:e.ok?h.colours.muted:h.colours.amber,children:n})]},e.line)}),M.length>62?(0,u.jsx)(l.Muted,{children:`\u2026and ${M.length-62} more rows.`}):null,(0,u.jsxs)(o.default,{style:{gap:8},children:[(0,u.jsx)(l.Button,{testID:"sheet-to-confirm",label:`Next: save ${R.length} night${1===R.length?'':'s'}`,disabled:!R.length,onPress:()=>S('confirm')}),(0,u.jsx)(l.Button,{kind:"secondary",label:"Change columns",onPress:()=>S('map')})]})]}):null,'confirm'===D?(0,u.jsxs)(o.default,{style:{gap:10},testID:"sheet-confirm",children:[(0,u.jsx)(l.T,{size:17,weight:"semibold",children:"3. Confirm"}),(0,u.jsxs)(o.default,{style:{borderWidth:1.5,borderColor:h.colours.gold,borderRadius:14,padding:12,gap:4,backgroundColor:h.colours.goldTint},accessibilityLiveRegion:"polite",children:[(0,u.jsx)(l.T,{size:18,weight:"semibold",colour:h.colours.gold,children:`Save takings for ${R.length} night${1===R.length?'':'s'}`}),(0,u.jsx)(l.T,{children:R.length?`${m(R.map(e=>e.date).sort()[0])} to ${m(R.map(e=>e.date).sort().slice(-1)[0])} \xb7 gross ${p(Math.round(100*R.reduce((e,s)=>e+(s.vals.gross??0),0))/100)} in total`:''}),(0,u.jsx)(l.Muted,{children:`Saved as confirmed by ${c.name}. Each night is logged. ${C&&z?`${z} saved night${1===z?' is':'s are'} replaced.`:z?`${z} already-saved night${1===z?' is':'s are'} skipped.`:''}`})]}),(0,u.jsx)(l.Button,{testID:"sheet-save",label:"Confirm and save",onPress:()=>{const s=(new Date).toISOString(),o=n.useCashUp.getState();for(const l of R){const n=o.cashUps.find(s=>s.rid===e&&s.date===l.date);o.saveCashUp({rid:e,date:l.date,vals:{...n?.vals??{},...(0,r.rowVals)(l)},photos:n?.photos??[],confirmedBy:c.name,confirmedAt:s,readBy:`spreadsheet: ${t.name}`.slice(0,80)})}const l=R.length,i=`Takings saved for ${l} night${1===l?'':'s'} from ${t.name}.`;f(i),w(i)}}),(0,u.jsx)(l.Button,{kind:"secondary",label:"Back to the preview",onPress:()=>S('preview')})]}):null]})};var s=_r(d[0]),t=e(_r(d[1]));_r(d[2]);var o=e(_r(d[3])),l=_r(d[4]),n=_r(d[5]),i=_r(d[6]),r=_r(d[7]),h=_r(d[8]),c=_r(d[9]),u=_r(d[10]);const p=e=>null==e?'\u2014':`\xa3${e.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`,m=e=>new Date(`${e}T12:00:00Z`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',year:'numeric',timeZone:'UTC'}),f=e=>{try{t.default.announceForAccessibility?.(e)}catch{}}},1286,[30,118,122,127,813,1093,1109,1287,821,1288,24]); +__d(function(g,_r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"COLS",{enumerable:!0,get:function(){return n}}),e.parseCsv=function(t){const n=t.replace(/^\uFEFF/,''),r=n.split(/\r?\n/,1)[0]??'',s=t=>r.split(t).length-1,a=[',',';','\t'].sort((t,n)=>s(n)-s(t))[0],o=[];let l=[],d='',i=!1;for(let t=0;tt.some(t=>''!==t.trim())).map(t=>t.map(t=>t.trim()))},e.guessMapping=function(t){const n={},s=new Set;for(const a of['date','food','drink','card','cash','gross']){const o=t.findIndex((t,n)=>!s.has(n)&&r[a].test(t)&&!('gross'===a&&/tips?/i.test(t))&&!('cash'===a&&/tips?|float/i.test(t)));o>=0&&(n[a]=o,s.add(o))}return n},e.parseDateCell=l,e.buildPreview=function(r,s,a,o){const d=a?r.slice(1):r,i=new Map,u=d.map((r,o)=>{const d=[],i=t=>null==s[t]?'':(r[s[t]]??'').trim(),u=null==s.date?null:l(i('date'));u||d.push(i('date')?`Date \u201c${i('date')}\u201d not understood`:'No date');const c={};for(const r of n){if('date'===r.key||null==s[r.key])continue;const n=i(r.key);if(!n){c[r.key]=null,r.required&&d.push(`No ${r.label.toLowerCase()}`);continue}const a=(0,t.parseAmount)(n.replace(/^\((.*)\)$/,'-$1'));null==a&&d.push(`${r.label} \u201c${n}\u201d not a \xa3 amount`),c[r.key]=a}return null==s.gross&&d.push('No gross column'),{line:o+(a?2:1),date:u,vals:c,errors:d,dup:null,ok:!1}});for(const t of u)t.date&&i.set(t.date,(i.get(t.date)??0)+1);for(const t of u)t.date&&(i.get(t.date)??0)>1?(t.dup='file',t.errors.push('This date is in the file more than once')):t.date&&o.has(t.date)&&(t.dup='saved'),t.ok=!t.errors.length;return u},e.rowVals=function(t){const n={};for(const r of['gross','food','drink','card','cash'])r in t.vals&&(n[r]=t.vals[r]??null);return n};var t=_r(_d[0]);const n=[{key:'date',label:'Date',required:!0},{key:'gross',label:'Gross takings',required:!0},{key:'food',label:'Food'},{key:'drink',label:'Drink'},{key:'card',label:'Card'},{key:'cash',label:'Cash'}];const r={date:/^(date|day|night|trading ?date|business ?date)\b/i,gross:/(gross|total ?takings|takings|total ?sales|sales ?total|turnover|^total$)/i,food:/\bfood\b|kitchen/i,drink:/\bdrinks?\b|\bbar\b|bev(erage)?s?|wet/i,card:/\bcard\b|pdq|debit|credit/i,cash:/\bcash\b/i};const s=['jan','feb','mar','apr','may','jun','jul','aug','sep','oct','nov','dec'],a=t=>String(t).padStart(2,'0'),o=(t,n,r)=>{const s=new Date(Date.UTC(t,n-1,r));return s.getUTCFullYear()===t&&s.getUTCMonth()===n-1&&s.getUTCDate()===r?`${t}-${a(n)}-${a(r)}`:null};function l(t){const n=t.trim();let r;if(r=n.match(/^(\d{4})-(\d{1,2})-(\d{1,2})(?:[ T].*)?$/))return o(+r[1],+r[2],+r[3]);if(r=n.match(/^(\d{1,2})[/.-](\d{1,2})[/.-](\d{2}|\d{4})(?: .*)?$/))return o(2===r[3].length?+r[3]+2e3:+r[3],+r[2],+r[1]);if(r=n.match(/^(?:[a-z]+,? )?(\d{1,2})(?:st|nd|rd|th)? ([a-z]{3})[a-z]*,? (\d{4})$/i)){const t=s.indexOf(r[2].toLowerCase());return t<0?null:o(+r[3],t+1,+r[1])}if(/^\d{5}(\.\d+)?$/.test(n)){const t=Math.floor(+n);if(t<36526||t>73050)return null;const r=new Date(Date.UTC(1899,11,30)+864e5*t);return o(r.getUTCFullYear(),r.getUTCMonth()+1,r.getUTCDate())}return null}},1287,[1109]); +__d(function(g,_r,_i,a,_m,e,_d){"use strict";async function t(t){const r=globalThis.DecompressionStream;if(!r)throw new Error('This browser can\u2019t open .xlsx files. Save the sheet as CSV and upload that.');const n=new Blob([t]).stream().pipeThrough(new r('deflate-raw'));return new Uint8Array(await new Response(n).arrayBuffer())}async function r(r,n){const s=new Uint8Array(r),o=new DataView(r),i={};let c=-1;for(let t=s.length-22;t>=Math.max(0,s.length-66e3);t--)if(101010256===o.getUint32(t,!0)){c=t;break}if(c<0)throw new Error('This isn\u2019t a readable .xlsx file.');const l=o.getUint16(c+10,!0);let h=o.getUint32(c+16,!0);const f=new TextDecoder;for(let r=0;r'xl/sharedStrings.xml'===t||/^xl\/worksheets\/sheet\d+\.xml$/.test(t)),i=Object.keys(o).filter(t=>t.startsWith('xl/worksheets/')).sort()[0];if(!i)throw new Error('No worksheet found in this file.');const c=[...(o['xl/sharedStrings.xml']??'').matchAll(/([\s\S]*?)<\/si>/g)].map(t=>n([...t[1].matchAll(/]*>([\s\S]*?)<\/t>/g)].map(t=>t[1]).join(''))),l=[];for(const t of o[i].matchAll(/]*>([\s\S]*?)<\/row>/g)){const r=[];for(const o of t[1].matchAll(/]*?)(?:\/>|>([\s\S]*?)<\/c>)/g)){const t=o[1],i=o[2]??'',l=t.match(/r="([A-Z]+\d+)"/)?.[1],h=t.match(/t="(\w+)"/)?.[1],f=i.match(/([\s\S]*?)<\/v>/)?.[1],w=i.match(/]*>([\s\S]*?)<\/t>/)?.[1],m='s'===h?c[Number(f)]??'':n('inlineStr'===h?w??'':f??'');r[l?s(l):r.length]=m}l.push(Array.from(r,t=>(t??'').trim()))}return l.filter(t=>t.some(t=>''!==t))};const n=t=>t.replace(/</g,'<').replace(/>/g,'>').replace(/"/g,'"').replace(/'/g,"'").replace(/&#(\d+);/g,(t,r)=>String.fromCharCode(+r)).replace(/&/g,'&'),s=t=>{const r=t.replace(/\d+/g,'');let n=0;for(const t of r)n=26*n+(t.charCodeAt(0)-64);return n-1}},1288,[]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.useLockedFor=function(e){const n=(0,c.useCashUp)(e=>e.cashUps),s=(0,c.useCashUp)(e=>e.sales);return(0,o.useCallback)((o,l)=>{const i='cashup'===o?n.find(n=>n.rid===e&&n.date===l):s.find(n=>n.rid===e&&n.weekStart===l);return!!i&&(0,h.cashLocked)(t.PITCH&&i.confirmedAt?{...i,onServer:!0}:i)},[n,s,e])},Object.defineProperty(_e,"lockedMessage",{enumerable:!0,get:function(){return y}}),_e.auditLine=j,_e.CashLockControls=function({kind:e,item:s,label:c}){const y=(0,k.useSync)(e=>'staff'===e.kind&&!!e.venueId)||t.PITCH,b=(0,k.useSync)(e=>e.perms.includes('*')||e.perms.includes('roles.manage')),x=(0,u.useOwner)(e=>e.previewRole),C=b||t.PITCH&&'owner'===x,[$,w]=(0,o.useState)(!1),[I,S]=(0,o.useState)(''),[P,L]=(0,o.useState)(!1),[T,U]=(0,o.useState)(null);if(!y||!(s.onServer||t.PITCH&&s.confirmedAt))return null;const v=(0,h.cashLocked)(t.PITCH?{...s,onServer:!0}:s),H=async()=>{L(!0);const n=await(0,k.unlockCashUp)(e,s.id,I.trim());L(!1),n.ok?(w(!1),S(''),(0,f.notify)({id:'cash-unlock',icon:'\ud83d\udd11',title:`${c} unlocked for 30 minutes`,body:'Correct it now. It locks again by itself, and the change is logged with your name.',timeoutMs:8e3})):(0,f.notify)({id:'cash-unlock',tone:'warn',title:'Not unlocked',body:n.message,timeoutMs:8e3})};return(0,p.jsxs)(l.default,{testID:`cash-lock-${s.id}`,style:{gap:4},children:[(0,p.jsxs)(i.Row,{gap:6,wrap:!0,children:[v?(0,p.jsx)(i.Badge,{kind:"gold",label:"Signed off"}):(0,p.jsx)(i.Badge,{kind:"neutral",label:`Unlocked until ${new Date(s.unlockedUntil??'').toLocaleTimeString('en-GB',{timeZone:'Europe/London',hour:'2-digit',minute:'2-digit'})}`}),v&&C&&!$?(0,p.jsx)(i.Button,{small:!0,kind:"ghost",testID:`cash-unlock-${s.id}`,label:"Unlock to correct",onPress:()=>w(!0)}):null,(0,p.jsx)(i.Button,{small:!0,kind:"ghost",testID:`cash-history-${s.id}`,label:T?'Hide history \u25b4':'History \u25be',onPress:()=>{T?U(null):(0,k.readCashAudit)(s.id).then(U)}})]}),v&&!C?(0,p.jsx)(i.Muted,{size:12,children:"Only an owner can unlock it to make a correction."}):null,$?(0,p.jsxs)(l.default,{style:{gap:4},children:[(0,p.jsx)(n.TextInput,{testID:`cash-unlock-reason-${s.id}`,value:I,onChangeText:S,placeholder:"Why does it need changing?",placeholderTextColor:r.colours.muted,maxLength:200,style:{minHeight:36,borderRadius:8,borderWidth:1,borderColor:r.colours.hairline,color:r.colours.text,paddingHorizontal:8}}),(0,p.jsxs)(i.Row,{gap:6,children:[(0,p.jsx)(i.Button,{small:!0,testID:`cash-unlock-yes-${s.id}`,label:P?'Unlocking\u2026':'Unlock for 30 minutes',disabled:P||I.trim().length<3,onPress:()=>{H()}}),(0,p.jsx)(i.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>{w(!1),S('')}})]})]}):null,T?T.length?T.map((e,n)=>(0,p.jsx)(i.Muted,{size:12,children:j(e)},n)):(0,p.jsx)(i.Muted,{size:12,children:"No history yet."}):null]})};var e,n=_r(d[0]),t=_r(d[1]),o=_r(d[2]),s=_r(d[3]),l=(e=s)&&e.__esModule?e:{default:e},i=_r(d[4]),r=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]),k=_r(d[9]),f=_r(d[10]),p=_r(d[11]);const y=(e,n)=>`The ${'cashup'===e?'cash up':'weekly sales report'} for ${n} is signed off and locked. An owner can tap \u201cUnlock to correct\u201d on it.`,b={created:'signed off',changed:'changed',unlocked:'unlocked',deleted:'removed'},x=e=>new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'});function j(e){const n=e.changed.length&&'changed'===e.action?` (${e.changed.slice(0,6).join(', ')}${e.changed.length>6?'\u2026':''})`:'';return`${x(e.at)} \xb7 ${e.by} ${b[e.action]??e.action}${n}${e.reason?`: \u201c${e.reason}\u201d`:''}`}},1289,[877,2,30,127,813,821,1093,856,1109,820,947,24]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"inPhoneApp",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"canOpenAppSettings",{enumerable:!0,get:function(){return c}}),e.openAppSettings=function(){try{t()?.openSettings?.()}catch{}},e.openLocationSettings=function(){try{t()?.openLocationSettings?.()}catch{}},e.appLocationPermission=function(){try{return t()?.locationPermission?.()??null}catch{return null}},e.phoneLocationOn=p,e.checkAppUpdate=function(){try{t()?.checkUpdate?.()}catch{}},e.locWhere=function(){if(!o()){const t=String(n()?.navigator?.userAgent??'');return/iPhone|iPad|iPod/.test(t)||/Macintosh/.test(t)&&(n()?.navigator?.maxTouchPoints??0)>1?'iphone':'browser'}return c()?p()?'app':'app-phone-off':'app-old'};const n=()=>'undefined'!=typeof window?window:void 0,t=()=>{const t=n()?.CoverChargeNative;return t&&'object'==typeof t?t:null},o=()=>/CoverChargePhone\//.test(String(n()?.navigator?.userAgent??'')),c=()=>'function'==typeof t()?.openSettings;function p(){try{const n=t()?.locationOn?.();return!1!==n}catch{return!0}}},1290,[]); +__d(function(g,r,_i,a,m,_e,d){"use strict";function t(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.SplitFlap=function({value:t,height:e=52,colour:o="#F5F1E8",min:i=2,sound:n,testID:u}){const s=String(Math.max(0,Math.round(t))).padStart(i,' '),h=Math.round(.68*e);return(0,c.jsx)(l.default,{testID:u,accessible:!0,accessibilityLabel:String(Math.max(0,Math.round(t))),style:{flexDirection:'row',gap:3},children:s.split('').map((t,i)=>(0,c.jsx)(x,{ch:' '===t?'':t,h:e,colour:o,size:h,sound:n&&i===s.length-1},s.length-i))})};var e=r(d[0]),o=t(r(d[1])),i=t(r(d[2])),n=t(r(d[3])),l=t(r(d[4])),u=r(d[5]),s=r(d[6]),c=r(d[7]);let h=!1;o.default.isReduceMotionEnabled?.().then(t=>{h=!!t}).catch(()=>{}),o.default.addEventListener?.('reduceMotionChanged',t=>{h=!!t});const f='#1B1A1D',p='#201F22';function b({ch:t,h:e,w:o,colour:n,part:u,size:h}){return(0,c.jsx)(l.default,{style:{height:e/2,width:o,overflow:'hidden',backgroundColor:'top'===u?p:f,borderTopLeftRadius:'top'===u?8:0,borderTopRightRadius:'top'===u?8:0,borderBottomLeftRadius:'bottom'===u?8:0,borderBottomRightRadius:'bottom'===u?8:0},children:(0,c.jsx)(i.default.Text,{allowFontScaling:!1,style:{position:'absolute',left:0,right:0,top:'top'===u?0:-e/2,height:e,lineHeight:e,textAlign:'center',fontSize:h,fontFamily:s.fonts.bold,color:n,includeFontPadding:!1},children:t})})}function x({ch:t,h:o,colour:s,size:f,sound:p}){const x=Math.round(.7*o),[j,v]=(0,e.useState)(t),[w,R]=(0,e.useState)(t),y=(0,e.useRef)(new i.default.Value(0)).current,M=(0,e.useRef)(new i.default.Value(1)).current,V=(0,e.useRef)(!0);(0,e.useEffect)(()=>{if(V.current)return V.current=!1,v(t),void R(t);if(t!==j){if(h)return R(t),void v(t);R(j),v(t),y.setValue(0),M.setValue(1),p&&(0,u.flapClick)(),i.default.sequence([i.default.timing(y,{toValue:1,duration:210,easing:n.default.in(n.default.quad),useNativeDriver:!0}),i.default.timing(M,{toValue:0,duration:210,easing:n.default.out(n.default.quad),useNativeDriver:!0})]).start(()=>R(t))}},[t]);const z=o/4,F=y.interpolate({inputRange:[0,1],outputRange:['0deg','-90deg']}),S=M.interpolate({inputRange:[0,1],outputRange:['0deg','90deg']}),D=w!==j;return(0,c.jsxs)(l.default,{style:{width:x,height:o},children:[(0,c.jsx)(b,{ch:j,h:o,w:x,colour:s,part:"top",size:f}),(0,c.jsx)(b,{ch:D?w:j,h:o,w:x,colour:s,part:"bottom",size:f}),D?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(i.default.View,{style:{position:'absolute',top:0,left:0,transform:[{perspective:400},{translateY:z},{rotateX:F},{translateY:-z}],backfaceVisibility:'hidden'},children:(0,c.jsx)(b,{ch:w,h:o,w:x,colour:s,part:"top",size:f})}),(0,c.jsx)(i.default.View,{style:{position:'absolute',top:o/2,left:0,transform:[{perspective:400},{translateY:-z},{rotateX:S},{translateY:z}],backfaceVisibility:'hidden'},children:(0,c.jsx)(b,{ch:j,h:o,w:x,colour:s,part:"bottom",size:f})})]}):null,(0,c.jsx)(l.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:o/2-.5,height:1,backgroundColor:'rgba(0,0,0,0.75)'}})]})}},1291,[30,118,120,224,127,923,821,24]); +__d(function(g,_r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.LastFoodBanner=function({rid:e,now:o,big:c}){const f=(0,l.useRestaurant)(e),h=u(o),$=(0,l.useEvents)(e).filter(e=>e.date===h&&'regular'===e.source),b=f?(0,s.lastFoodOn)(f,h):null;if(!b)return null;const T=new Date(`${h}T${b.time}:00`),p=Math.round((T.getTime()-o.getTime())/6e4),_=$[0],j=_?`${_.title}${_.time?` from ${(0,s.fmt12)(_.time)}`:''}`:'';if(p>90&&!_)return null;if(p<-60)return null;const w=p>=0&&p<=15,x=p<0,D=w?n.colours.redBg:x?n.colours.surface2:n.colours.goldTint,F=w?n.colours.red:x?n.colours.hairline:n.colours.accentBorder,M=w?'#FFD9D4':x?n.colours.muted:n.colours.goldLight,y=c?1.3:1,B=x?`Kitchen closed for food \xb7 last orders were ${(0,s.fmt12)(b.time)}`:w?`Last food orders in ${Math.max(0,p)} min (${(0,s.fmt12)(b.time)})`:`Last food orders ${(0,s.fmt12)(b.time)}`;return(0,d.jsxs)(t.default,{testID:w?'last-food-warning':'last-food-banner',accessibilityRole:"text",style:{borderRadius:14,borderWidth:w?2:1,borderColor:F,backgroundColor:D,paddingVertical:10*y,paddingHorizontal:14,gap:2},children:[(0,d.jsxs)(r.T,{size:17*y,weight:"bold",colour:M,children:[w?'\u23f0 ':'\ud83c\udf7d ',B]}),j||'kitchen closes'!==b.reason?(0,d.jsx)(r.T,{size:13*y,colour:n.colours.muted,children:[j?`Tonight: ${j}`:'','kitchen closes'!==b.reason&&b.reason!==_?.title?`Early last orders (${b.reason})`:''].filter(Boolean).join(' \xb7 ')}):null]})},_r(_d[0]);var e,o=_r(_d[1]),t=(e=o)&&e.__esModule?e:{default:e},r=_r(_d[2]),l=_r(_d[3]),s=_r(_d[4]),n=_r(_d[5]),d=_r(_d[6]);const u=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`},1292,[30,127,813,819,809,821,24]); +__d(function(_g,_r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.useNextFree=j,_e.NextTableFreeCard=function({rid:e,now:s,big:r,always:d}){const u=(0,n.useRestaurant)(e),c=j(e,s);if(!u||!c||!(0,h.nextTableOn)(u))return null;if(!c.full&&!d)return null;const T=c.list.slice(0,3),w=c.waitFor(2),p=c.waitFor(4),y=(0,h.lastFoodOn)(u,x(s)),M=r?1.25:1,F=(e,r)=>(0,g.jsxs)(l.default,{style:{flex:1,borderRadius:12,borderWidth:1,borderColor:f.colours.hairline,backgroundColor:f.colours.tile,padding:10},testID:`wait-for-${e}`,children:[(0,g.jsxs)(o.Muted,{children:["Wait for ",e]}),(0,g.jsx)(o.T,{size:20*M,weight:"bold",colour:f.colours.goldLight,children:r?`About ${Math.max(5,Math.round((r.at.getTime()-s.getTime())/6e4))} min`:'\u2014'}),(0,g.jsx)(o.Muted,{children:r?`${(0,t.tableNumbers)(r.table)} \xb7 ${r.confidence}`:'nothing due yet'})]});return(0,g.jsxs)(l.default,{testID:"next-table-free",accessibilityRole:"summary",style:{borderRadius:16,borderWidth:1,borderColor:f.colours.accentBorder,backgroundColor:f.colours.surface,padding:14,gap:8},children:[(0,g.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,g.jsx)(o.T,{size:12,weight:"semibold",colour:f.colours.goldMuted,style:{letterSpacing:1.4},children:c.full?'FULL \xb7 NEXT TABLE FREE':'NEXT TABLE FREE'}),(0,g.jsx)(o.Badge,{kind:"amber",label:"ESTIMATE"})]}),T.length?(0,g.jsxs)(o.T,{size:22*M,weight:"bold",children:["About ",(0,b.hhmm)(T[0].at)," ",(0,g.jsxs)(o.T,{size:16*M,colour:f.colours.muted,children:["(",(0,t.tableNumbers)(T[0].table),", ",T[0].seats," seats \xb7 ",T[0].confidence,")"]})]}):(0,g.jsx)(o.T,{size:18*M,weight:"semibold",children:c.freeNow.length?`Free now: ${c.freeNow.map(e=>`${(0,t.tableNumbers)(e)}`).join(', ')}`:'No table due to free up before its next booking'}),T.slice(1).map(e=>(0,g.jsxs)(o.Muted,{children:["Then about ",(0,b.hhmm)(e.at)," \xb7 ",(0,t.tableNumbers)(e.table)," (",e.seats," seats) \xb7 ",e.confidence," \xb7 ",e.why]},e.table)),T[0]?(0,g.jsxs)(o.Muted,{children:[(0,t.tableNumbers)(T[0].table),": ",T[0].why,"."]}):null,(0,g.jsxs)(o.Row,{gap:8,children:[F(2,w),F(4,p)]}),T.some(e=>e.drinksOnly)&&y?(0,g.jsxs)(o.T,{size:13,colour:f.colours.amber,children:["After last food orders (",(0,h.fmt12)(y.time),") a table is for drinks only."]}):null,(0,g.jsx)(o.Muted,{children:"Tap Bill requested or Table finished on the plan and this updates straight away."})]})};var e,t=_r(_d[0]),s=_r(_d[1]),r=_r(_d[2]),l=(e=r)&&e.__esModule?e:{default:e},o=_r(_d[3]),n=_r(_d[4]),d=_r(_d[5]),u=_r(_d[6]),c=_r(_d[7]),b=_r(_d[8]),h=_r(_d[9]),f=_r(_d[10]),g=_r(_d[11]);const x=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`,T=e=>(0,b.hhmm)(e);function j(e,t){const r=(0,n.useRestaurant)(e),l=(0,u.usePlan)(e),o=(0,n.useBookings)(e),h=(0,n.useOrders)(e),f=(0,u.useFloor)(t=>t.live[e]),g=(0,d.useBlocks)(e=>e.blocks),j=t.getTime()/6e4|0;return(0,s.useMemo)(()=>{if(!r)return null;const s=x(t),n=(0,d.closedAreasAt)(g,e,s,T(t)),u=(0,c.floorView)(l,o,h,f??{},t,r.settings.turnMins,n);return(0,b.nextTablesFree)(r,u,o.filter(e=>e.date===s),t,o)},[r,l,o,h,f,g,j])}},1293,[808,30,127,813,819,824,825,826,1115,809,821,24]); +__d(function(_g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"MAX",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"TARGET",{enumerable:!0,get:function(){return t}}),_e.compressOnWeb=r,_e.capturePlatingPhoto=async function(e){{const n=await(t='camera'===e,new Promise(e=>{const n=document.createElement('input');n.type='file',n.accept='image/*',t&&n.setAttribute('capture','environment'),n.style.display='none',n.setAttribute('data-testid',t?'photo-input-camera':'photo-input-library'),n.onchange=()=>{const t=n.files?.[0]??null;n.remove(),e(t)},n.oncancel=()=>{n.remove(),e(null)},document.body.appendChild(n),n.click()}));if(!n)return null;return{...await r(n),originalBytes:n.size}}var t},Object.defineProperty(_e,"kb",{enumerable:!0,get:function(){return a}});!(function(e){if(e&&e.__esModule)return e;var t={};e&&Object.keys(e).forEach(function(n){if('default'!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e})(_r(_d[0]));_r(_d[1]);const e=1024,t=225280,n=e=>Math.round(3*(e.length-e.indexOf(',')-1)/4);async function r(r,a=e,o=t){const i='string'==typeof r?r:URL.createObjectURL(r);try{const e=await new Promise((e,t)=>{const n=new window.Image;n.onload=()=>e(n),n.onerror=()=>t(new Error('That file is not a photo we can read.')),n.src=i}),t=Math.min(1,a/Math.max(e.naturalWidth,e.naturalHeight)),r=Math.max(1,Math.round(e.naturalWidth*t)),c=Math.max(1,Math.round(e.naturalHeight*t)),u=document.createElement('canvas');u.width=r,u.height=c;const l=u.getContext('2d');l.fillStyle='#ffffff',l.fillRect(0,0,r,c),l.drawImage(e,0,0,r,c);let f=.8,s=u.toDataURL('image/jpeg',f);for(;n(s)>o&&f>.4;)f-=.1,s=u.toDataURL('image/jpeg',f);return{dataUrl:s,width:r,height:c,bytes:n(s)}}finally{'string'!=typeof r&&URL.revokeObjectURL(i)}}const a=e=>`${Math.max(1,Math.round(e/1024))} KB`},1294,[1035,122]); +__d(function(_g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useLogoCache",{enumerable:!0,get:function(){return s}}),_e.squareLogo=async function(e,t=256){const n=await new Promise((t,n)=>{const o=new window.Image;o.onload=()=>t(o),o.onerror=()=>n(new Error('That file is not a picture we can read.')),o.src=e}),o=Math.min(n.naturalWidth,n.naturalHeight),i=(n.naturalWidth-o)/2,s=(n.naturalHeight-o)/2,c=document.createElement('canvas');c.width=t,c.height=t;const u=c.getContext('2d');return u.fillStyle='#ffffff',u.fillRect(0,0,t,t),u.drawImage(n,i,s,o,o,0,0,t,t),c.toDataURL('image/jpeg',.85)};var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},o=r(d[1]),i=r(d[2]);const s=(0,o.create)()((0,i.persist)(e=>({byList:{},put:(t,n)=>e(e=>({byList:{...e.byList,[t]:n}})),drop:t=>e(e=>{const n={...e.byList};return delete n[t],{byList:n}})}),{name:'covercharge-order-logos-v1',storage:(0,i.createJSONStorage)(()=>n.default)}))},1295,[1116,952,1117]); +__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TodaysBookings=function({rid:o,today:s,by:p,app:x}){const v=(0,l.useBookings)(o).filter(e=>e.date===s&&(0,u.ACTIVE)(e)).sort((e,t)=>e.time.localeCompare(t.time)),B=v.reduce((e,t)=>e+(t.diet?.vegan??0),0),C=v.reduce((e,t)=>e+(t.diet?.vegetarian??0),0);return(0,y.jsxs)(n.default,{style:{gap:12},testID:"todays-bookings",children:[(0,y.jsx)(j.CoversToday,{rid:o}),(0,y.jsx)(h.PlattersBooked,{rid:o,date:s,label:"Platters booked today"}),B||C?(0,y.jsxs)(a.T,{colour:c.colours.ok,children:["\u24cb ",B?`${B} vegan`:'',B&&C?' \xb7 ':'',C?`${C} vegetarian`:''," today"]}):null,(0,y.jsx)(h.KitchenSignoffs,{rid:o,today:s,by:p,app:x,showAll:!0}),v.length?v.map(s=>(0,y.jsxs)(n.default,{style:{gap:6,padding:14,borderRadius:16,borderWidth:1,borderColor:c.colours.hairline,backgroundColor:c.colours.surface},children:[(0,y.jsxs)(a.T,{weight:"semibold",children:[s.time," \xb7 ",s.walkIn?`Walk-in ${s.ref}`:s.name," \xb7 ",s.partySize," covers",s.table?` \xb7 ${(0,e.tableNumbers)(s.table)}`:'']}),(0,y.jsx)(t.DepositChip,{b:s,money:!0,testID:`kitchen-deposit-${s.id}`}),(0,y.jsx)(b.BookingTableButton,{rid:o,booking:s,readOnly:'chef'===x}),'chef'!==x&&s.walkIn?(0,y.jsx)(k.CancelWalkInButton,{rid:o,b:s,small:!0}):null,s.notes?(0,y.jsxs)(a.T,{size:16,testID:`kitchen-notes-${s.id}`,children:["Notes: ",s.notes]}):null,(0,y.jsx)(f.BookingEditButton,{rid:o,booking:s,who:p,inStaffApp:'staff'===x}),(0,y.jsx)(h.BookingNeeds,{b:s}),'seated'===(0,u.shownStatus)(s)?(0,y.jsx)(a.Muted,{children:"Seated"}):'finished'===s.status?(0,y.jsx)(a.Muted,{children:"Finished"}):null]},s.id)):(0,y.jsx)(a.Muted,{children:"No bookings today yet."})]})};var e=r(d[0]),t=r(d[1]);r(d[2]);var o,s=r(d[3]),n=(o=s)&&o.__esModule?o:{default:o},a=r(d[4]),l=r(d[5]),u=r(d[6]),c=r(d[7]),h=r(d[8]),b=r(d[9]),k=r(d[10]),f=r(d[11]),j=r(d[12]),y=r(d[13])},1296,[808,951,30,127,813,819,828,821,950,915,949,916,921,24]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"tableButtonLabel",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"tableButtonA11y",{enumerable:!0,get:function(){return s}}),e.tableOptions=function(t,n,o){const s=t.tables.map(t=>t.name).sort(l),c=new Set;return(t.joins??[]).forEach(t=>{t.tables.length>1&&c.add(t.tables.slice().sort(l).join('+'))}),[...n.map(t=>t.table),o].forEach(t=>{const n=a(t);n.length>1&&c.add(n.slice().sort(l).join('+'))}),[...s,...[...c].sort(l)]},e.tableOverlaps=function(t,l,o,s=90){const c=a(l);if(!c.length)return[];const b={...t,table:l};return o.filter(l=>l.id!==t.id&&l.date===t.date&&!['cancelled','noshow','finished'].includes(l.status)&&a(l.table).some(t=>c.includes(t))&&(0,n.startOf)(b)<(0,n.endOf)(l,s)&&(0,n.startOf)(l)<(0,n.endOf)(b,s))},Object.defineProperty(e,"tablePatch",{enumerable:!0,get:function(){return c}});var t=r(d[0]),n=r(d[1]);const a=t=>t?t.split('+').map(t=>t.trim()).filter(Boolean):[],l=(t,n)=>t.localeCompare(n,'en-GB',{numeric:!0}),o=n=>(0,t.tableNumbers)(n)||'No table',s=(n,a)=>`${(0,t.tableNumbersA11y)(n)}${a?'':', change table'}`;const c=t=>({table:t||void 0,tableSetHere:!0})},1297,[808,826]); +__d(function(g,_r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.nextDays=c,Object.defineProperty(_e,"openOn",{enumerable:!0,get:function(){return u}}),_e.BookingDatePicker=function({r:e,today:l,value:b,onChange:m}){const[f,x]=(0,t.useState)(!1),p=(0,r.ymd)(l),j=c(l,9),D=(e,t)=>0===t?'Today':1===t?'Tomorrow':`${(0,r.dayShort)(e)} ${e.getDate()}`,w=j.some(e=>(0,r.ymd)(e)===b),C=(0,r.parseYmd)(b),[P,T]=(0,t.useState)(()=>({y:C.getFullYear(),m:C.getMonth()})),v=(new Date(P.y,P.m,1,12).getDay()+6)%7,M=new Date(P.y,P.m+1,0).getDate(),R=[...Array.from({length:v},()=>null),...Array.from({length:M},(e,t)=>new Date(P.y,P.m,t+1,12))];for(;R.length%7;)R.push(null);const k=12*(P.y-l.getFullYear())+P.m-l.getMonth(),F=e=>T(({y:t,m:o})=>{const s=new Date(t,o+e,1);return{y:s.getFullYear(),m:s.getMonth()}});return(0,i.jsxs)(s.default,{testID:"nb-date",style:{gap:6},children:[(0,i.jsxs)(d.Row,{wrap:!0,gap:6,children:[j.map((t,o)=>(0,i.jsx)(d.Chip,{label:D(t,o),sub:u(e,t)?void 0:'Closed',selected:b===(0,r.ymd)(t),onPress:()=>{m((0,r.ymd)(t)),x(!1)}},(0,r.ymd)(t))),w?null:(0,i.jsx)(d.Chip,{label:(0,r.niceDate)(C),sub:u(e,C)?void 0:'Closed',selected:!0,onPress:()=>x(!0)}),(0,i.jsx)(d.Chip,{label:f?'Close calendar':'\ud83d\udcc5 Pick date',selected:f,onPress:()=>{f||T({y:C.getFullYear(),m:C.getMonth()}),x(!f)}})]}),f?(0,i.jsxs)(s.default,{testID:"nb-calendar",style:{borderWidth:1,borderColor:n.colours.border,borderRadius:14,padding:10,gap:6,backgroundColor:n.colours.surface2,maxWidth:420},children:[(0,i.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,i.jsx)(o.default,{accessibilityRole:"button",accessibilityLabel:"Previous month",disabled:k<=0,onPress:()=>F(-1),style:{padding:8,opacity:k<=0?.3:1},children:(0,i.jsx)(d.T,{size:20,colour:n.colours.gold,children:"\u2039"})}),(0,i.jsxs)(d.T,{weight:"semibold",children:[(0,r.monthLong)(P.m)," ",P.y]}),(0,i.jsx)(o.default,{accessibilityRole:"button",accessibilityLabel:"Next month",disabled:k>=h,onPress:()=>F(1),style:{padding:8,opacity:k>=h?.3:1},children:(0,i.jsx)(d.T,{size:20,colour:n.colours.gold,children:"\u203a"})})]}),(0,i.jsx)(s.default,{style:{flexDirection:'row'},children:y.map(e=>(0,i.jsx)(d.T,{size:12,colour:n.colours.muted,center:!0,style:{flex:1},children:e},e))}),Array.from({length:R.length/7},(t,l)=>(0,i.jsx)(s.default,{style:{flexDirection:'row',gap:4},children:R.slice(7*l,7*l+7).map((t,l)=>{if(!t)return(0,i.jsx)(s.default,{style:{flex:1,height:40}},l);const c=(0,r.ymd)(t),y=c{m(c),x(!1)},style:{flex:1,height:40,borderRadius:10,alignItems:'center',justifyContent:'center',borderWidth:c===p?1.5:0,borderColor:n.colours.gold,backgroundColor:h?n.colours.gold:'transparent',opacity:y?.3:1},children:(0,i.jsx)(d.T,{size:15,weight:h?'bold':'regular',colour:h?n.colours.onGold:f?n.colours.muted:n.colours.text,style:f&&!y?{textDecorationLine:'line-through'}:void 0,children:t.getDate()})},l)})},l)),(0,i.jsx)(d.Muted,{children:"Past dates can\u2019t be booked. Crossed-out days: closed (per the venue\u2019s hours)."})]}):null]})};var t=_r(_d[0]),o=e(_r(_d[1])),s=e(_r(_d[2])),l=_r(_d[3]),r=_r(_d[4]),n=_r(_d[5]),d=_r(_d[6]),i=_r(_d[7]);function c(e,t){const o=new Date(e);return o.setHours(12,0,0,0),Array.from({length:t},(e,t)=>{const s=new Date(o);return s.setDate(o.getDate()+t),s})}const u=(e,t)=>!!(0,l.hoursFor)(e,t),y=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],h=12},1298,[30,263,127,815,818,821,813,24]); +__d(function(g,r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.MenuAllergyCheck=function({rid:e,allergens:j,audience:m="guest"}){const b=(0,t.useMenu)(e),[x,y]=(0,s.useState)(!1);if(!j.length)return null;const{contains:p,may:M,free:k}=(0,c.dishesFor)(b,j),w=k.filter(e=>!e.signOff),S=k.filter(e=>e.signOff),_=j.map(o.allergenLabel).join(', '),C=e=>e.map(e=>e.name).join(', ')||'none';return(0,f.jsxs)(l.default,{testID:"menu-allergy-check",style:{gap:6,borderWidth:1,borderColor:p.length?h.colours.red:h.colours.border,borderRadius:12,padding:10,backgroundColor:h.colours.surface2},children:[(0,f.jsxs)(u.T,{weight:"semibold",children:["Allergy check against the menu (",_,")"]}),(0,f.jsxs)(u.T,{size:14,colour:h.colours.red,children:["Contains: ",p.length," dish",1===p.length?'':'es']}),(0,f.jsxs)(u.T,{size:14,colour:h.colours.amber,children:["May contain: ",M.length]}),(0,f.jsxs)(u.T,{size:14,colour:h.colours.ok,children:["Free from ",1===j.length?'it':'them'," (signed off): ",S.length]}),w.length?(0,f.jsxs)(u.Muted,{children:[w.length," more awaiting the head chef's sign-off, so not shown as safe."]}):null,(0,f.jsx)(n.default,{testID:"menu-allergy-details",accessibilityRole:"button",onPress:()=>y(!x),hitSlop:6,children:(0,f.jsx)(u.T,{size:14,colour:h.colours.gold,children:x?'Hide dishes':'Show dishes'})}),x?(0,f.jsxs)(l.default,{style:{gap:4},children:[(0,f.jsxs)(u.Muted,{children:["Contains: ",C(p)]}),(0,f.jsxs)(u.Muted,{children:["May contain: ",C(M)]}),(0,f.jsxs)(u.Muted,{children:["Free from: ",C(S)]})]}):null,(0,f.jsx)(u.Muted,{children:'guest'===m?'From the kitchen\u2019s signed-off recipe cards. Specials on the board are checked by staff on the day.':'From the signed-off recipe cards. Specials on the board have their own allergens. Still check with the guest and the kitchen.'})]})};var s=r(d[0]),n=e(r(d[1])),l=e(r(d[2])),t=r(d[3]),o=r(d[4]),c=r(d[5]),h=r(d[6]),u=r(d[7]),f=r(d[8])},1299,[30,263,127,819,814,1104,821,813,24]); +__d(function(g,_r,_i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"VAT",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"exVat",{enumerable:!0,get:function(){return n}}),e.dishCost=i,Object.defineProperty(e,"gpPct",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"priceForTarget",{enumerable:!0,get:function(){return c}}),e.costings=function(r,c,s,u){const d=(0,t.dishStats)(r);return c.map(t=>{const c=r.find(r=>r.id===t.dishId);if(!c||null==c.price)return null;const p=i(t,s),l=n(c.price),f=o(p,c.price),b=d.find(t=>t.item.id===c.id)?.sold??0;return{item:c,recipe:t,cost:p,priceInc:c.price,priceEx:l,gp:f,cashGp:l-p,below:ft.prevCost&&t.prevCost!==t.cost).map(s=>{const u=(s.cost-(s.prevCost??s.cost))/(s.prevCost??1)*100,d=r.filter(t=>t.lines.some(t=>t.ing===s.id)).map(r=>{const u=t.find(t=>t.id===r.dishId);if(!u||null==u.price)return null;const d=o(i(r,n,{ing:s.id,cost:s.prevCost}),u.price),p=o(i(r,n),u.price);return{item:u,before:d,after:p,dropped:d>=c&&pt.dropped),below:d.filter(t=>t.below)}})},e.weekGp=function(t,r,n){const i=t.reduce((t,r)=>t+r.priceEx*r.soldWeek,0),o=t.reduce((t,r)=>t+r.cost*r.soldWeek,0),c=o+r+Math.max(0,n);return{sales:i,theoCost:o,actualCost:c,theo:i?(i-o)/i*100:0,actual:i?(i-c)/i*100:0}},Object.defineProperty(e,"fmtQty",{enumerable:!0,get:function(){return s}});var t=_r(_d[0]);const r=.2,n=t=>Math.round(t/1.2);function i(t,r,n){return Math.round(t.lines.reduce((t,i)=>{const o=r.find(t=>t.id===i.ing);return t+(n&&n.ing===i.ing?n.cost:o?.cost??0)*i.qty},0))}const o=(t,r)=>{const i=n(r);return i>0?(i-t)/i*100:0},c=(t,r)=>50*Math.ceil(t/(1-r/100)*1.2/50);const s=(t,r)=>`${Number.isInteger(t)?t:t.toFixed(t<1?3:2).replace(/0+$/,'').replace(/\.$/,'')} ${'each'===r?'':r}`.trim()},1300,[1301]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"hash",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"CHANNELS",{enumerable:!0,get:function(){return n}}),_e.revenueHistory=function(e,n,r=28){const s=[];if(!(0,o.examplesAllowed)())return s;for(let o=r;o>=1;o--){const r=(0,t.addMins)(n,1440*-o),i=!!e.kitchenHours[r.getDay()],d=[1.05,0,0,.6,.7,1,1.2][r.getDay()]*('anchorage'===e.id?1:.6),l=o=>.85+.3*a((0,t.ymd)(r)+o+e.id),u=i?Math.round(24e4*d*l('d')):0,c=i?Math.round(95e3*d*l('t')):0,p=i?Math.round(52e3*d*l('q')):0;s.push({date:r,label:(0,t.niceDate)(r).slice(0,6),byChannel:{'Dine-in':u,Takeaway:c,'Table QR':p},total:u+c+p,covers:i?Math.round(150*d*l('c')):0})}return s},_e.dishStats=function(e){return(0,o.examplesAllowed)()?e.filter(e=>null!=e.price).map(e=>{const t=Math.round(20+260*a(e.id+'s')),o=.24+.22*a(e.id+'c'),n=e.price??0,r=Math.round(n*(1-o));return{item:e,sold:t,revenue:t*n,costPct:o,margin:r,gp:r*t}}):[]},_e.quadrant=function(e,t,o,a){return e>=o?t>=a?'Star':'Plough horse':t>=a?'Puzzle':'Dog'},Object.defineProperty(_e,"QUADRANT_TIP",{enumerable:!0,get:function(){return r}}),_e.crmCustomers=function(){return(0,o.examplesAllowed)()?s.map((e,t)=>{const o=a(e+t);return{id:0===t?'cust-demo':`cr-${t}`,name:`${e} ${i[t]}${0===t?'':' (example)'}`,phone:`07700 900${String(100+7*t).slice(-3)}`,visits:1+Math.round(18*o),lastVisit:`${1+Math.round(27*o)} days ago`,spend:Math.round(3e3+6e4*o),allergies:0===t?['Crustaceans (anaphylaxis)','Mustard']:o>.8?['Gluten (coeliac)']:o<.1?['Peanuts']:[],stamps:0===t?5:Math.round(7*o),optIn:o>.25,channel:n[Math.floor(3*o)%3],birthday:o>.6?`${1+Math.round(27*o)} Nov`:void 0}}):[]},Object.defineProperty(_e,"STOCK",{enumerable:!0,get:function(){return d}}),Object.defineProperty(_e,"stockList",{enumerable:!0,get:function(){return l}}),_e.insights=function(a,n,r,s,i,l,c){const p=[];if(!(0,o.examplesAllowed)())return u(a,n,r,s,i,l,c);const h=new Date(l);h.setDate(h.getDate()+((6-h.getDay()+7)%7||7)),h.setHours(0,0,0,0);const b=(0,e.forecastToday)(a,n,r,s,h),m=Math.round(b.restOfDay.covers/Math.max(1,b.multiplier)),y=Math.max(35,Math.round(100*(b.multiplier-1))+35);p.push({id:'sat',icon:'\ud83d\udcc8',tone:'gold',title:`${(0,t.niceDate)(h)} forecast +${y}%: add 1 server 6\u20139pm`,body:`Example: about ${Math.round(m*(1+y/100))} covers expected vs about ${m} on a usual Saturday (bookings pace + Halloween weekend flag).`,action:{label:'Open rota',tab:'more',sub:'rota'}});const f=(0,e.forecastToday)(a,n,r,s,l),v=d[0],w=Math.ceil((f.restOfDay.covers+2*f.restOfDay.takeaway)*v.perCover);p.push({id:'haddock',icon:'\ud83d\udc1f',tone:'red',title:`Haddock low: ${v.onHand} portions left`,body:`Tonight\u2019s forecast needs about ${w}. Call the supplier before 18:00 or mark the fish supper sold out at ${v.onHand} sold.`,action:{label:'Prep list',tab:'more',sub:'prep'}});const k=s.find(e=>/Burns/.test(e.title));if(k){const e=Math.max(1,Math.round((new Date(k.date).getTime()-l.getTime())/6048e5));p.push({id:'burns',icon:'\ud83e\udd43',tone:'blue',title:`Burns Night in ${e} weeks: open bookings?`,body:'Last year\u2019s equivalent nights sold out about 3 weeks ahead (example). Publish the set menu and push to opted-in regulars.',action:{label:'Plan campaign',tab:'more',sub:'marketing'}})}const M=n.filter(e=>e.date===(0,t.venueYmd)(l)&&'noshow'===e.status).length;p.push({id:'noshow',icon:'\ud83e\ude91',tone:'amber',title:M?`${M} no-show today: deposits for 6+?`:'Deposits for bigger tables (example)',body:'Deposits are set per venue in Settings \u203a Advanced \u203a Deposits. Consider them on Fri/Sat after 19:00.',action:{label:'Bookings',tab:'bookings'}});const C=i.filter(e=>e.stars<=2).length;C&&p.push({id:'reviews',icon:'\ud83d\udcac',tone:'red',title:`${C} low rating this week: cold chips at collection`,body:'Readiness alerts now time bagging 5 min before pickup. Reply to say thanks and invite them back.',action:{label:'Reviews',tab:'more',sub:'reviews'}});return p.push({id:'commission',icon:'\ud83d\udcb7',tone:'ok',title:'You kept about \xa31,240 in commission this month',body:'Example: \xa34,140 of direct takeaway orders that would have cost about 30% on delivery apps.',action:{label:'Analytics',tab:'more',sub:'analytics'}}),p.push({id:'covers',icon:'\ud83c\udf7d\ufe0f',tone:'gold',title:`${c} covers so far today`,body:'Lobster special is the top add-on tonight. Suggest it with the scallops (example).'}),p};var e=_r(_d[0]),t=_r(_d[1]),o=_r(_d[2]);const a=e=>{let t=2166136261;for(let o=0;o>>0)/4294967295},n=['Dine-in','Takeaway','Table QR'];const r={Star:'Keep: high margin and popular. Feature it.','Plough horse':'Popular, low margin: nudge the price or trim the cost.',Puzzle:'High margin, few sales: promote it or rename it.',Dog:'Low margin, few sales: consider removing it.'},s=['Alex','Fiona','Iain','Morag','Callum','Eilidh','Ross','Kirsty','Euan','Shona','Hamish','Isla','Craig','Ailsa','Neil','Catriona'],i=['Morgan','Campbell','Fraser','McLeod','Kerr','Wallace','Boyd','Hamilton','Stewart','Murray','Paterson','Duncan','Gilmour','Reid','Ross','Grant'];const d=[{cat:'Fish & seafood',id:'haddock',name:'Haddock fillets',unit:'portions',onHand:8,perCover:.22,par:40},{cat:'Fruit & veg',id:'chips',name:'Chipping potatoes',unit:'kg',onHand:25,perCover:.18,par:40},{cat:'Fish & seafood',id:'langoustine',name:'Langoustines',unit:'kg',onHand:4,perCover:.03,par:6},{cat:'Fish & seafood',id:'mussels',name:'Mussels',unit:'kg',onHand:10,perCover:.05,par:12},{cat:'Fish & seafood',id:'scallops',name:'Scallops',unit:'portions',onHand:14,perCover:.06,par:20},{cat:'Meat',id:'beef',name:'Burger patties',unit:'each',onHand:30,perCover:.1,par:40},{cat:'Fruit & veg',id:'peas',name:'Garden peas',unit:'kg',onHand:6,perCover:.04,par:8},{cat:'Dairy',id:'tartare',name:'House tartare sauce',unit:'tubs',onHand:5,perCover:.05,par:10}],l=()=>(0,o.examplesAllowed)()?d:[];function u(o,a,n,r,s,i,d){const l=[],u=(0,e.forecastToday)(o,a,n,r,i);u.enough||l.push({id:'history',icon:'\ud83d\udcc5',tone:'gold',title:'Not enough history yet',body:u.suggestions[0]?.replace(/^Not enough history yet\. /,'')??'',action:{label:'Settings \u203a Advanced',tab:'more',sub:'advanced'}});const c=(0,t.ymd)(i),p=a.filter(e=>e.date===c&&'noshow'===e.status).length;p&&l.push({id:'noshow',icon:'\ud83e\ude91',tone:'amber',title:`${p} no-show${1===p?'':'s'} today`,body:'Think about a deposit for larger parties (Settings \u203a Advanced \u203a Deposits).',action:{label:'Bookings',tab:'bookings'}});const h=s.filter(e=>e.stars<=2).length;h&&l.push({id:'reviews',icon:'\ud83d\udcac',tone:'red',title:`${h} low rating${1===h?'':'s'} to read`,body:'Read what they said, reply to say thanks and invite them back.',action:{label:'Reviews',tab:'more',sub:'reviews'}});const b=r.filter(e=>e.date>=c).sort((e,t)=>e.date.localeCompare(t.date))[0];return b&&l.push({id:'event',icon:'\ud83d\udcc5',tone:'blue',title:`Coming up: ${b.title}`,body:`${(0,t.niceDate)(new Date(b.date+'T12:00:00'))}. Check your rota and think about a promo.`,action:{label:'Forecast',tab:'forecast'}}),l.push({id:'covers',icon:'\ud83c\udf7d\ufe0f',tone:'gold',title:`${d} covers so far today`,body:'Seated bookings and walk-ins recorded in CoverCharge today.'}),l}},1301,[870,818,1119]); +__d(function(g,r,i,a,m,e,_d){"use strict";function t(t,n){const o={};for(let c=0;c<7;c++){o[c]={};const u=n[c]??0;for(const[n,s]of Object.entries(t))o[c][Number(n)]=Math.round(s*u)}return o}Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"EXAMPLE_HISTORY",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"EXAMPLE_ACCURACY",{enumerable:!0,get:function(){return f}});const n={12:18,13:26,14:16,15:9,16:10,17:22,18:36,19:38,20:20},o={12:2,13:2,14:1,15:1,16:2,17:4,18:6,19:5,20:2},c={0:1.05,1:0,2:0,3:.6,4:.7,5:1,6:1.15},u={0:.6,1:.5,2:.5,3:.6,4:.7,5:.9,6:1},s={anchorage:{covers:t(n,c),takeaway:t(o,c)},default:{covers:t(n,u),takeaway:t(o,u)}},f='Example: last 4 weeks within \xb118% of actual covers'},1302,[]); +__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DEFAULT_MIN_WEEKS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"clampWeeks",{enumerable:!0,get:function(){return o}}),e.buildHistory=function(o,a,c,u,d,f=n){const l=(0,t.ymd)(d),y=(0,t.ymd)(new Date(d.getTime()-48384e5)),h=t=>t>=y&&tt.rid===o&&h(t.date));for(const t of k)D.add(t.date);const T=[...D].sort(),w=T.length?s(T[0],l):0,j=w>=7*f&&T.length>=2*f,O=t=>{const n={},o={};for(const t of T){const n=new Date(t+'T12:00:00').getDay();o[n]=(o[n]??0)+1}for(const[o,s]of Object.entries(t)){const t=new Date(o+'T12:00:00').getDay();n[t]??={};for(const[o,a]of Object.entries(s))n[t][Number(o)]=(n[t][Number(o)]??0)+a}for(const t of Object.keys(n))for(const s of Object.keys(n[+t]))n[+t][+s]=n[+t][+s]/(o[+t]||1);return n},M=Array.from({length:7},()=>[]);for(const t of k)'number'==typeof t.takings&&t.takings>0&&M[new Date(t.date+'T12:00:00').getDay()].push(Math.round(100*t.takings));const N=M.map(t=>t.length?Math.round(t.reduce((t,n)=>t+n,0)/t.length):null),_=k.filter(t=>'number'==typeof t.takings&&t.takings>0),E=(_.length?s(_.map(t=>t.date).sort()[0],l):0)>=7*f&&_.length>=2*f;return{covers:O(b),takeaway:O(p),days:T.length,spanDays:w,enough:j,minWeeks:f,takingsByDay:N,cashUps:_.length,salesEnough:E}};var t=r(_d[0]);const n=2,o=t=>{const o=Math.round(Number(t));return Number.isFinite(o)&&o>=1&&o<=8?o:n},s=(t,n)=>Math.round((new Date(n+'T12:00:00').getTime()-new Date(t+'T12:00:00').getTime())/864e5)},1303,[818]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"CHEF_ID",{enumerable:!0,get:function(){return x}}),_e.useChef=C,Object.defineProperty(_e,"isLow",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"stockValue",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"within7",{enumerable:!0,get:function(){return v}}),_e.useWeek=function(){const{k:e,c:r,now:t}=C(6e4),o=e.waste.filter(e=>v(e.at,t)).reduce((e,r)=>e+r.cost,0),n=e.stockTakes[0],s=n?n.lines.reduce((e,r)=>e+(r.expected-r.counted)*r.cost,0):0;return{...(0,b.weekGp)(r,o,s),wasteWeek:o,variance:Math.round(s)}},_e.useForecast=function(){const{r:e,rid:r,now:t}=C(6e4),o=(0,i.useBookings)(r),n=(0,i.useOrders)(r),s=(0,i.useEvents)(r),d=(0,u.useRealHistory)(r,t),c=(0,l.forecastToday)(e,o,n,s,t,d??void 0),f=c.hours.reduce((e,r)=>e+r.covers,0),b=c.hours.reduce((e,r)=>e+r.booked,0),p=c.hours.reduce((e,r)=>e+r.historicalCovers,0),y=c.enough&&p?Math.round((f-p)/p*100):0,w=['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'][(0,h.weekday)(t)],x=c.enough?`${w} ${y>=0?'+':''}${y}%${c.example?' (example figures)':''}`:'Not enough history yet';return{f:c,covers:f,booked:b,typical:p,pct:y,day:w,label:x,enough:c.enough,example:c.example}},_e.Tile=function({label:e,value:r,sub:t,tone:o,onPress:s,testID:i}){const d='red'===o?f.colours.red:'amber'===o?f.colours.amber:'ok'===o?f.colours.ok:f.colours.text;return(0,w.jsxs)(n.default,{testID:i,accessibilityRole:s?'button':void 0,accessibilityLabel:`${e}: ${r}`,onPress:s,style:({pressed:e})=>({flexGrow:1,flexBasis:150,minWidth:140,padding:12,borderRadius:14,borderWidth:1,borderColor:'red'===o?f.colours.red:f.colours.border,backgroundColor:e?'#1d1a14':f.colours.surface,gap:2}),children:[(0,w.jsx)(c.Muted,{children:e}),(0,w.jsx)(c.T,{size:22,weight:"bold",colour:d,children:r}),t?(0,w.jsx)(c.T,{size:12,colour:f.colours.muted,children:t}):null]})},_e.Seg=function({value:e,options:r,onChange:t}){return(0,w.jsx)(c.Row,{wrap:!0,gap:6,children:r.map(r=>(0,w.jsx)(n.default,{accessibilityRole:"tab",accessibilityState:{selected:e===r.id},accessibilityLabel:r.label,onPress:()=>t(r.id),style:{paddingHorizontal:12,paddingVertical:7,minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center',borderRadius:999,borderWidth:1,borderColor:e===r.id?f.colours.gold:f.colours.border,backgroundColor:e===r.id?f.colours.goldTint:'transparent'},children:(0,w.jsx)(c.T,{size:13,weight:e===r.id?'semibold':'regular',colour:e===r.id?f.colours.goldLight:f.colours.text,children:r.label})},r.id))})},_e.Bar=function({pct:e,colour:r=f.colours.gold}){return(0,w.jsx)(s.default,{style:{height:6,borderRadius:3,backgroundColor:f.colours.surface2,overflow:'hidden'},children:(0,w.jsx)(s.default,{style:{width:`${Math.max(0,Math.min(100,e))}%`,height:6,backgroundColor:r}})})},Object.defineProperty(_e,"pct1",{enumerable:!0,get:function(){return S}});var r=_r(_d[0]),t=e(_r(_d[1])),o=_r(_d[2]),n=e(_r(_d[3])),s=e(_r(_d[4])),i=_r(_d[5]),d=_r(_d[6]),u=_r(_d[7]),l=_r(_d[8]),c=_r(_d[9]),f=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),p=_r(_d[13]),y=_r(_d[14]),w=_r(_d[15]);const x=y.ROSTER.find(e=>'chef'===e.app)?.id??'';function C(e=3e4){const n=(0,d.useOwner)(e=>e.site),s=(0,i.useRestaurant)(n),u=(0,d.useOwner)(e=>e.staff),l=u.find(e=>e.id===x)?.name??'Head Chef',c=(0,i.useNow)(e),f=(0,i.useAllMenu)(n),h=(0,p.useKitchen)(),y=t.default.useMemo(()=>{const e=r.LIVE_HEAD_CHEF?{...h,...(0,p.stripKitchenExamples)(h)}:h,t=e.ingredients.filter(e=>(0,o.chefCanSee)(n,e)),s=new Set(e.ingredients.filter(e=>!(0,o.chefCanSee)(n,e)).map(e=>e.id));return{...e,ingredients:t,temps:e.temps.filter(e=>(0,o.chefCanSee)(n,e)),waste:e.waste.filter(e=>(0,o.chefCanSee)(n,e)&&!s.has(e.ing||'')),deliveries:e.deliveries.filter(e=>(0,o.chefCanSee)(n,e)).map(e=>({...e,lines:e.lines.filter(e=>!s.has(e.ing))})),orders:e.orders.filter(e=>(0,o.chefCanSee)(n,e)).map(e=>({...e,lines:e.lines.filter(e=>!s.has(e.ing))}))}},[h,n]),w=(0,b.costings)(f,y.recipes,y.ingredients,y.targetGp);return{rid:n,r:s,me:l,now:c,menu:f,k:y,c:w}}const k=(e,r)=>e>0&&e<.5*r,j=e=>Math.round(e.reduce((e,r)=>e+r.onHand*r.cost,0)),v=(e,r)=>r.getTime()-new Date(e).getTime()<6048e5;const S=e=>`${e.toFixed(1)}%`},1304,[1231,30,1025,263,127,819,856,1305,870,813,821,927,1300,1203,14,24]); +__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.useRealHistory=function(e,t){const o=(0,l.useExamples)(),n=(0,r.useBookings)(e),c=(0,r.useOrders)(e),f=(0,u.useCashUp)(e=>e.cashUps),y=(0,k.clampWeeks)((0,h.useStore)(s=>s.restaurants.find(s=>s.id===e)?.settings.forecastMinWeeks)),b=t.toDateString();return(0,s.useMemo)(()=>o?null:(0,k.buildHistory)(e,n,c,f.map(e=>({rid:e.rid,date:e.date,takings:(0,p.takings)(e.vals)})),t,y),[o,e,n,c,f,y,b])},Object.defineProperty(_e,"ExampleBadge",{enumerable:!0,get:function(){return b}}),_e.NotEnoughHistory=function({weeks:e,booked:s,what:t="Forecasts",testID:r="not-enough-history"}){return(0,y.jsx)(n.Card,{children:(0,y.jsxs)(o.default,{testID:r,style:{gap:6},children:[(0,y.jsx)(n.T,{weight:"semibold",colour:f.colours.gold,children:"Not enough history yet"}),(0,y.jsx)(n.Muted,{children:'Forecasts'===t?(0,c.notEnoughTip)(e):`${t} start once CoverCharge has ${1===e?'1 week':`${e} weeks`} of your bookings and cash-ups.`}),s?(0,y.jsx)(o.default,{testID:`${r}-booked`,children:(0,y.jsxs)(n.T,{children:["Booked so far: ",s," covers"]})}):null,(0,y.jsx)(n.Muted,{children:"Tip: upload or add your bookings and do the cash up each night. Managers can change how much history is needed in Settings \u203a Advanced."})]})})};var e,s=_r(d[0]),t=_r(d[1]),o=(e=t)&&e.__esModule?e:{default:e},n=_r(d[2]),r=_r(d[3]),u=_r(d[4]),c=_r(d[5]),l=_r(d[6]),h=_r(d[7]),p=_r(d[8]),k=_r(d[9]),f=_r(d[10]),y=_r(d[11]);const b=()=>(0,y.jsx)(n.Badge,{kind:"amber",label:c.EXAMPLE_LABEL.toUpperCase()})},1305,[30,127,813,819,1093,1119,1306,872,1109,1303,821,24]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useExamples",{enumerable:!0,get:function(){return l}});var t=r(d[0]),n=r(d[1]);const l=()=>(0,t.useSyncExternalStore)(n.onDataModeChange,n.examplesAllowed,n.examplesAllowed)},1306,[30,1119]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GpScreen=function({initial:e="dishes"}){const[t,l]=(0,s.useState)(e),{k:o}=(0,c.useChef)(),d=(0,a.useKitchen)(e=>e.setTarget);return(0,h.jsxs)(i.default,{style:{gap:12},children:[(0,h.jsx)(n.Card,{children:(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsxs)(i.default,{style:{flex:1},children:[(0,h.jsx)(n.T,{weight:"semibold",children:"Target GP"}),(0,h.jsx)(n.Muted,{children:"Dishes under target are flagged red."})]}),(0,h.jsx)(n.Button,{small:!0,kind:"secondary",label:"\u2212",accessibilityLabel:"Lower target",onPress:()=>d(o.targetGp-1)}),(0,h.jsxs)(n.T,{size:22,weight:"bold",colour:r.colours.gold,children:[o.targetGp,"%"]}),(0,h.jsx)(n.Button,{small:!0,kind:"secondary",label:"+",accessibilityLabel:"Raise target",onPress:()=>d(o.targetGp+1)})]})}),(0,h.jsx)(c.Seg,{value:t,onChange:l,options:[{id:'dishes',label:'Recipe cards & GP'},{id:'changes',label:'Price changes'},{id:'week',label:'Theoretical vs actual'},{id:'engineering',label:'Menu engineering'}]}),'dishes'===t?(0,h.jsx)(u,{}):'changes'===t?(0,h.jsx)(j,{}):'week'===t?(0,h.jsx)(b,{}):(0,h.jsx)(w,{})]})};var s=_r(_d[0]),t=e(_r(_d[1])),i=e(_r(_d[2])),n=_r(_d[3]),l=_r(_d[4]),r=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),a=_r(_d[9]),h=_r(_d[10]);function u(){const{c:e,k:t}=(0,c.useChef)(),[l,r]=(0,s.useState)(null),o=e.filter(e=>e.below),d=[...e].sort((e,s)=>e.gp-s.gp),a=e.find(e=>e.item.id===l);return e.length?(0,h.jsxs)(i.default,{style:{gap:10},children:[(0,h.jsx)(n.Muted,{children:"Menu prices include VAT (20%). GP is worked out on the price ex VAT: (price ex VAT \u2212 dish cost) \xf7 price ex VAT. VAT figures are for information only."}),o.length?(0,h.jsxs)(n.Banner,{kind:"danger",title:`${o.length} of ${e.length} dishes below ${t.targetGp}%`,children:[o.slice(0,6).map(e=>e.item.name).join(', '),o.length>6?'\u2026':'']}):(0,h.jsx)(n.Banner,{kind:"success",title:"All costed dishes on target"}),d.map(e=>(0,h.jsx)(p,{d:e,onPress:()=>r(e.item.id)},e.item.id)),(0,h.jsx)(n.Sheet,{visible:!!a,onClose:()=>r(null),title:a?.item.name??'',children:a?(0,h.jsx)(x,{d:a}):null})]}):(0,h.jsx)(n.Muted,{children:"No costed dishes yet. Add your real recipes and ingredient costs to see GP."})}function p({d:e,onPress:s}){return(0,h.jsxs)(t.default,{accessibilityRole:"button",accessibilityLabel:`${e.item.name}, GP ${e.gp.toFixed(1)} percent`,onPress:s,style:({pressed:s})=>({padding:12,borderRadius:12,borderWidth:1,borderColor:e.below?r.colours.red:r.colours.border,backgroundColor:s?'#1d1a14':e.below?r.colours.redBg:r.colours.surface,gap:2}),children:[(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{weight:"medium",style:{flex:1},children:e.item.name}),(0,h.jsx)(n.T,{weight:"bold",colour:e.below?r.colours.red:r.colours.ok,children:(0,c.pct1)(e.gp)})]}),(0,h.jsxs)(n.Muted,{children:["Cost ",(0,l.gbp)(e.cost)," \xb7 ",(0,l.gbp)(e.priceInc)," inc VAT (",(0,l.gbp)(e.priceEx)," ex) \xb7 cash GP ",(0,l.gbp)(e.cashGp)]}),e.below?(0,h.jsxs)(n.T,{size:12,colour:r.colours.red,children:["Below ",e.target,"%: price for target ",(0,l.gbp)((0,d.priceForTarget)(e.cost,e.target))," inc VAT"]}):null]})}function x({d:e}){const s=(0,a.useKitchen)(),t=s.recipes.find(s=>s.dishId===e.item.id);return(0,h.jsxs)(i.default,{style:{gap:8},children:[(0,h.jsxs)(n.Muted,{children:["Recipe card \xb7 ",t.yield]}),t.lines.map(t=>{const r=s.ingredients.find(e=>e.id===t.ing);if(!r)return null;const o='each'===r.unit?1:'kg'===r.unit&&t.qty<.1?.005:.01;return(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsxs)(i.default,{style:{flex:1},children:[(0,h.jsx)(n.T,{size:14,children:r.name}),(0,h.jsxs)(n.Muted,{children:[(0,l.gbp)(r.cost)," per ",r.unit]})]}),(0,h.jsx)(n.Button,{small:!0,kind:"ghost",label:"\u2212",accessibilityLabel:`Less ${r.name}`,onPress:()=>s.setRecipeQty(e.item.id,t.ing,Math.max(0,Math.round(1e3*(t.qty-o))/1e3))}),(0,h.jsx)(n.T,{size:13,style:{width:64,textAlign:'center'},children:(0,d.fmtQty)(t.qty,r.unit)}),(0,h.jsx)(n.Button,{small:!0,kind:"ghost",label:"+",accessibilityLabel:`More ${r.name}`,onPress:()=>s.setRecipeQty(e.item.id,t.ing,Math.round(1e3*(t.qty+o))/1e3)}),(0,h.jsx)(n.T,{size:13,style:{width:60,textAlign:'right'},children:(0,l.gbp)(Math.round(r.cost*t.qty))})]},t.ing)}),(0,h.jsxs)(i.default,{style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:8,gap:4},children:[(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{children:"Dish cost"}),(0,h.jsx)(n.T,{weight:"semibold",children:(0,l.gbp)(e.cost)})]}),(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{children:"Selling price inc VAT"}),(0,h.jsx)(n.T,{children:(0,l.gbp)(e.priceInc)})]}),(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.Muted,{children:"VAT (20%, for info)"}),(0,h.jsx)(n.Muted,{children:(0,l.gbp)(e.priceInc-e.priceEx)})]}),(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{children:"Price ex VAT"}),(0,h.jsx)(n.T,{children:(0,l.gbp)(e.priceEx)})]}),(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{children:"Cash GP"}),(0,h.jsx)(n.T,{weight:"semibold",children:(0,l.gbp)(e.cashGp)})]}),(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{children:"GP %"}),(0,h.jsx)(n.T,{weight:"bold",colour:e.below?r.colours.red:r.colours.ok,children:(0,c.pct1)(e.gp)})]}),(0,h.jsxs)(n.Banner,{kind:e.below?'warn':'info',title:`Price that hits ${e.target}%: ${(0,l.gbp)((0,d.priceForTarget)(e.cost,e.target))} inc VAT`,children:["Or bring the dish cost down to ",(0,l.gbp)(Math.floor(e.priceEx*(1-e.target/100))),". Prices are changed in CoverCharge for Managers (Menu & allergens)."]})]})]})}function j(){const{menu:e,k:s}=(0,c.useChef)(),t=(0,d.priceImpacts)(e,s.recipes,s.ingredients,s.targetGp);return t.length?(0,h.jsx)(i.default,{style:{gap:10},children:t.map(e=>(0,h.jsxs)(n.Card,{highlight:e.dropped.length?r.colours.red:void 0,children:[(0,h.jsxs)(n.T,{weight:"semibold",children:[e.ing.name," ",e.pct>0?'+':'',e.pct.toFixed(0),"%: ",e.dropped.length," dish",1===e.dropped.length?'':'es'," drop below target"]}),(0,h.jsxs)(n.Muted,{children:[(0,l.gbp)(e.ing.prevCost??0)," \u2192 ",(0,l.gbp)(e.ing.cost)," per ",e.ing.unit]}),e.dishes.map(e=>(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{size:14,style:{flex:1},children:e.item.name}),(0,h.jsxs)(n.T,{size:13,colour:r.colours.muted,children:[(0,c.pct1)(e.before)," \u2192 "]}),(0,h.jsx)(n.T,{size:13,weight:"semibold",colour:e.below?r.colours.red:r.colours.ok,children:(0,c.pct1)(e.after)}),e.dropped?(0,h.jsx)(n.Badge,{kind:"red",label:"NOW BELOW"}):null]},e.item.id))]},e.ing.id))}):(0,h.jsx)(n.Muted,{children:"No ingredient price changes since the last deliveries."})}function b(){const{k:e}=(0,c.useChef)(),s=(0,c.useWeek)();return s.sales?(0,h.jsxs)(i.default,{style:{gap:10},children:[(0,h.jsxs)(n.Row,{wrap:!0,gap:10,children:[(0,h.jsx)(c.Tile,{label:"Theoretical GP (recipes \xd7 sales)",value:(0,c.pct1)(s.theo),tone:s.theoe.soldWeek>0),t=s.reduce((e,s)=>e+s.soldWeek,0)/Math.max(1,s.length),r=s.reduce((e,s)=>e+s.cashGp,0)/Math.max(1,s.length),d={Star:[],'Plough horse':[],Puzzle:[],Dog:[]};return s.forEach(e=>d[(0,o.quadrant)(e.soldWeek,e.cashGp,t,r)].push(e)),(0,h.jsxs)(i.default,{style:{gap:10},children:[s.length?(0,h.jsx)(n.Muted,{children:"Popularity (sold per week) against cash GP per dish, using the live menu from CoverCharge for Managers. Example sales figures."}):(0,h.jsx)(n.Muted,{children:"Needs dish sales figures, which CoverCharge doesn't have on a real venue yet (no till link). Nothing is guessed."}),Object.keys(d).map(e=>(0,h.jsxs)(n.Card,{children:[(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{weight:"semibold",children:'Star'===e?'\u2b50 Stars':'Plough horse'===e?'\ud83d\udc0e Plough horses':'Puzzle'===e?'\u2754 Puzzles':'\ud83d\udc15 Dogs'}),(0,h.jsx)(n.Badge,{kind:"gold",label:`${d[e].length}`})]}),(0,h.jsx)(n.Muted,{children:o.QUADRANT_TIP[e]}),d[e].map(e=>(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{size:14,style:{flex:1},children:e.item.name}),(0,h.jsxs)(n.Muted,{children:[e.soldWeek,"/wk \xb7 ",(0,l.gbp)(e.cashGp)," \xb7 ",(0,c.pct1)(e.gp)]})]},e.item.id))]},e))]})}},1307,[30,263,127,813,816,821,1301,1300,1304,1203,24]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.PrepScreen=function(){const{k:e,menu:t,me:s,now:i}=(0,M.useChef)(),{covers:n,label:r,typical:l,enough:a,booked:o,f:c}=(0,M.useForecast)(),f=(0,w.ymd)(i),m=(0,T.dishStats)(t).filter(t=>e.recipes.some(e=>e.dishId===t.item.id)&&!['Sides','Desserts'].includes(t.item.section)),p=m.reduce((e,t)=>e+t.sold,0)||1,x=m.map(e=>({id:e.item.id,name:e.item.name,qty:Math.ceil(.85*n*(e.sold/p)*1.1)})).filter(e=>e.qty>0).sort((e,t)=>t.qty-e.qty),y={};x.forEach(t=>e.recipes.find(e=>e.dishId===t.id)?.lines.forEach(e=>{y[e.ing]=(y[e.ing]??0)+e.qty*t.qty}));const b=[{id:'haddock',text:`Portion ${x.filter(e=>['a-fishsupper','a-mini','a-tempura'].includes(e.id)).reduce((e,t)=>e+t.qty,0)} haddock portions (fish supper, tempura, Mini Anchors)`},{id:'chips',text:`Peel, cut and blanch ${(0,v.fmtQty)(Math.ceil(2*(y.potatoes??0))/2,'kg')} chipping potatoes`},{id:'batter',text:`Make up ${(0,v.fmtQty)(Math.ceil(10*(y.batter??0))/10+.5,'kg')} beer batter`},{id:'leaves',text:`Wash and spin ${(0,v.fmtQty)(Math.ceil(10*(y.leaves??0))/10,'kg')} salad leaves`},{id:'mussels',text:`Clean and debeard ${(0,v.fmtQty)(Math.ceil(2*(y.mussels??0))/2,'kg')} mussels (discard any open that don't close)`},{id:'sauce',text:'Garlic butter, tartare and Marie Rose: check, make and date-label'}],j=(0,B.useKitchen)(e=>e.tickPrep),C=[...b.map(e=>({key:`${f}:task:${e.id}`,text:e.text})),...x.map(e=>({key:`${f}:dish:${e.id}`,text:`${e.qty} \xd7 ${e.name}`}))],S=C.filter(t=>e.prepTicks[t.key]).length;return e.recipes.length&&e.ingredients.length?(0,D.jsxs)(h.default,{style:{gap:10},children:[a?null:(0,D.jsx)(u.Banner,{kind:"info",title:`Booked so far: ${o} covers`,children:`Not enough history yet. Forecasts start once CoverCharge has ${c.minWeeks} weeks of your bookings and cash-ups. Prep from what is booked and your own judgement.`}),a?(0,D.jsxs)(u.Banner,{kind:"info",title:`${r}: ${n} covers forecast`,children:["A typical ",r.split(' ')[0]," is about ",l," covers. Portions below are scaled from the forecast, bookings and the usual dish mix, plus 10% cover."]}):null,(0,D.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,D.jsx)(u.T,{weight:"semibold",children:"Prep list for today"}),(0,D.jsx)(u.Badge,{kind:S===C.length?'ok':'gold',label:`${S}/${C.length} done`})]}),C.map((t,i)=>{const n=e.prepTicks[t.key];return(0,D.jsxs)(d.default,{accessibilityRole:"checkbox",accessibilityState:{checked:!!n},accessibilityLabel:t.text,onPress:()=>j(t.key,n?null:s),style:{flexDirection:'row',gap:10,alignItems:'center',padding:10,borderRadius:10,borderWidth:1,borderColor:n?k.colours.ok:k.colours.border,backgroundColor:k.colours.surface,marginTop:i===b.length?8:0},children:[(0,D.jsx)(u.T,{size:18,colour:n?k.colours.ok:k.colours.muted,children:n?'\u2611':'\u2610'}),(0,D.jsxs)(h.default,{style:{flex:1},children:[(0,D.jsx)(u.T,{size:14,style:n?{textDecorationLine:'line-through',color:k.colours.muted}:void 0,children:t.text}),n?(0,D.jsxs)(u.Muted,{children:[n.by," \xb7 ",new Date(n.at).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})]}):null]})]},t.key)})]}):(0,D.jsx)(u.Muted,{children:"No prep list yet. Add your real recipe costs and ingredients to build it."})},_e.WasteScreen=function(){const{k:e,me:n,now:r,rid:l}=(0,M.useChef)(),a=(0,M.useWeek)(),d=(0,B.useKitchen)(e=>e.addWaste),[f,m]=(0,o.useState)(e.ingredients[0]?.id),[p,x]=(0,o.useState)(''),[y,j]=(0,o.useState)('Over-production'),w=e.ingredients.find(e=>e.id===f),C=Number(p.replace(',','.'))||0,S=C>=0&&(!w||!(0,s.fishInStone)(l,w)||Number.isInteger(2*C)),T=w&&S?(0,s.inputQuantity)(l,w,C):0,v=e.waste.filter(e=>(0,M.within7)(e.at,r));return w?(0,D.jsxs)(h.default,{style:{gap:10},children:[(0,D.jsxs)(u.Row,{wrap:!0,gap:10,children:[(0,D.jsx)(M.Tile,{label:"Waste this week",value:(0,b.gbp)(a.wasteWeek),sub:`${v.length} entries`,tone:a.sales&&a.wasteWeek/a.sales>.02?'amber':'ok'}),(0,D.jsx)(M.Tile,{label:"Waste as % of food sales",value:a.sales?(0,M.pct1)(a.wasteWeek/a.sales*100):'\u2014',sub:a.sales?'Food sales ex VAT, this week':'Needs dish sales (no till link yet)'})]}),(0,D.jsxs)(u.Card,{children:[(0,D.jsx)(u.T,{weight:"semibold",children:"Log waste"}),(0,D.jsx)(c.default,{horizontal:!0,showsHorizontalScrollIndicator:!1,children:(0,D.jsx)(u.Row,{gap:6,children:e.ingredients.map(e=>(0,D.jsx)(u.Chip,{label:e.name,selected:e.id===f,onPress:()=>m(e.id)},e.id))})}),(0,D.jsxs)(u.Row,{gap:8,children:[(0,D.jsx)(t.TextInput,{accessibilityLabel:`Waste quantity in ${(0,s.quantityUnit)(l,w)}`,accessibilityValue:{text:(0,i.ingredientSpeech)(l,w,T)},keyboardType:"decimal-pad",value:p,onChangeText:x,placeholder:`qty (${(0,s.quantityUnit)(l,w)})`,placeholderTextColor:k.colours.muted,style:{flex:1,minHeight:44,borderWidth:1,borderColor:k.colours.border,borderRadius:8,padding:8,color:k.colours.text}}),(0,D.jsx)(u.T,{children:(0,s.quantityUnit)(l,w)}),(0,D.jsx)(u.T,{weight:"semibold",colour:k.colours.gold,children:(0,b.gbp)(Math.round(T*w.cost))})]}),(0,s.fishInStone)(l,w)?(0,D.jsxs)(u.Row,{children:[(0,D.jsx)(u.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:`Waste half a stone less ${w.name}`,onPress:()=>x(String(Math.max(0,(0,s.halfStone)(C)-.5)))}),(0,D.jsx)(u.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:`Waste half a stone more ${w.name}`,onPress:()=>x(String((0,s.halfStone)(C)+.5))}),(0,D.jsx)(u.Muted,{children:"Half-stone amounts"})]}):null,(0,D.jsx)(u.Row,{wrap:!0,gap:6,children:B.WASTE_REASONS.map(e=>(0,D.jsx)(u.Chip,{label:e,selected:e===y,onPress:()=>j(e)},e))}),(0,D.jsx)(u.Button,{label:"Add to waste log",disabled:T<=0,onPress:()=>{d({by:n,item:w.name,ing:w.id,qty:T,unit:w.unit,reason:y,cost:Math.round(T*w.cost)}),x('')}}),(0,D.jsx)(u.Muted,{children:"Logged waste also comes off stock."})]}),e.waste.slice(0,20).map(e=>(0,D.jsxs)(u.Row,{style:{justifyContent:'space-between',paddingVertical:2},children:[(0,D.jsxs)(h.default,{style:{flex:1},children:[(0,D.jsxs)(u.T,{size:14,children:[e.item," \xb7 ",(0,i.ingredientQty)(l,{name:e.item,unit:e.unit},e.qty)]}),(0,D.jsxs)(u.Muted,{children:[e.reason," \xb7 ",new Date(e.at).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'})," \xb7 ",e.by]})]}),(0,D.jsx)(u.T,{size:14,children:(0,b.gbp)(e.cost)})]},e.id))]}):(0,D.jsx)(u.Muted,{children:"No stock items yet. Add your real ingredients before logging waste."})},_e.AllergenScreen=function({openCards:e}={}){const{k:t,me:s,rid:i}=(0,M.useChef)(),n=(0,f.useRecipeCards)(i),r=(0,x.auditView)('chef',(0,f.useAudit)(i)).filter(e=>/allergen|recipe card|sign/i.test(e.text)).slice(0,12),l=n.slice().sort((e,t)=>e.section.localeCompare(t.section)||e.dish.localeCompare(t.dish)).map(e=>{const s=t.recipes.find(t=>t.dishId===e.menuItemId),i=new Set(s?s.lines.flatMap(e=>t.ingredients.find(t=>t.id===e.ing)?.allergens??[]):[]),n=[...i].filter(t=>!e.allergens[t]);return{card:e,fromCosting:i,missing:n}}),a={name:s,role:'head-chef'};return(0,D.jsxs)(h.default,{style:{gap:10},testID:"allergen-matrix",children:[(0,D.jsx)(u.Muted,{children:"The 14 allergens from each recipe card (C contains, m may contain). These are what guests see on the menu, takeaway and the booking allergy check. A red cell means the costing recipe uses an ingredient with that allergen but the card doesn't list it."}),e?(0,D.jsx)(u.Button,{testID:"open-recipe-cards",small:!0,kind:"secondary",label:"Open recipe cards \u203a",onPress:e}):null,(0,D.jsx)(c.default,{horizontal:!0,children:(0,D.jsxs)(h.default,{children:[(0,D.jsxs)(u.Row,{gap:0,children:[(0,D.jsx)(h.default,{style:{width:150},children:(0,D.jsx)(u.Muted,{children:"Dish"})}),y.ALLERGENS.map(e=>(0,D.jsx)(h.default,{style:{width:34,alignItems:'center'},children:(0,D.jsx)(u.T,{size:10,colour:k.colours.muted,children:e.short})},e.id))]}),l.map(({card:e,fromCosting:t})=>(0,D.jsxs)(u.Row,{gap:0,style:{borderTopWidth:1,borderColor:k.colours.border,paddingVertical:4},children:[(0,D.jsx)(h.default,{style:{width:150},children:(0,D.jsx)(u.T,{size:12,numberOfLines:2,children:e.dish})}),y.ALLERGENS.map(s=>{const i=e.allergens[s.id],n=t.has(s.id)&&!i;return(0,D.jsx)(h.default,{accessibilityLabel:`${e.dish} ${s.label}: ${'contains'===i?'contains':'may'===i?'may contain':n?'in the costing recipe, not on the card':'no'}`,style:{width:34,height:24,alignItems:'center',justifyContent:'center',backgroundColor:n?k.colours.redBg:'transparent'},children:(0,D.jsx)(u.T,{size:11,weight:'contains'===i?'bold':'regular',colour:n?k.colours.red:'contains'===i?k.colours.gold:i?k.colours.muted:'#444',children:'contains'===i?'C':'may'===i?'m':n?'!':'\xb7'})},s.id)})]},e.id))]})}),(0,D.jsx)(u.Muted,{children:"C card says contains \xb7 m may contain \xb7 ! in the costing recipe but not on the card"}),l.filter(e=>e.missing.length||!e.card.signOff).map(({card:t,missing:s})=>(0,D.jsxs)(u.Card,{highlight:s.length?k.colours.red:k.colours.amber,children:[(0,D.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,D.jsx)(u.T,{weight:"semibold",style:{flex:1},children:t.dish}),t.signOff?(0,D.jsx)(u.Badge,{kind:"ok",label:"Signed off"}):(0,D.jsx)(u.Badge,{kind:"amber",label:"Awaiting sign-off"})]}),s.length?(0,D.jsxs)(u.T,{size:13,colour:k.colours.red,children:["Costing recipe has ",s.map(e=>y.ALLERGENS.find(t=>t.id===e)?.short).join(', '),", not on the card"]}):null,(0,D.jsxs)(u.Row,{wrap:!0,gap:8,children:[s.length?(0,D.jsx)(u.Button,{small:!0,label:"Add to the card",onPress:()=>{const e={...t.allergens};s.forEach(t=>{e[t]='contains'}),(0,m.recipeCards)().update(t.id,{allergens:e},a).catch(()=>{})}}):null,e?(0,D.jsx)(u.Button,{small:!0,kind:"secondary",label:"Check and sign off on the card",onPress:e}):null]})]},t.id)),(0,D.jsxs)(u.Card,{children:[(0,D.jsx)(u.T,{weight:"semibold",children:"Audit log"}),r.length?r.map(e=>(0,D.jsxs)(u.Muted,{children:[new Date(e.at).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})," \xb7 ",e.text]},e.id)):(0,D.jsx)(u.Muted,{children:"No allergen changes yet."})]})]})},_e.ComplianceScreen=function(){const{k:e,me:s,now:i,rid:r}=(0,M.useChef)(),l=(0,w.ymd)(i),a=(0,B.useKitchen)(e=>e.addTemp),c=(0,p.useOwner)(e=>e.checks),{tick:f,untick:m}=p.useOwner.getState(),[x,y]=(0,o.useState)('fridge'),b=A.find(e=>e.id===x),j={...b,units:b.units.filter(e=>(0,n.chefCanSee)(r,e))},[C,S]=(0,o.useState)(j.units[0]),[T,v]=(0,o.useState)(''),R=Number(T.replace(',','.')),$=T.trim()&&!Number.isNaN(R)?j.ok(R):null,I=e.temps.filter(e=>e.at.slice(0,10)===l),L=(e,t,i)=>{const n=c[e];return(0,D.jsxs)(d.default,{accessibilityRole:"checkbox",accessibilityState:{checked:!!n},accessibilityLabel:t,onPress:()=>n?m(e):f(e,s,(new Date).toISOString()),style:{flexDirection:'row',gap:10,alignItems:'center',paddingVertical:6},children:[(0,D.jsx)(u.T,{size:18,colour:n?k.colours.ok:k.colours.muted,children:n?'\u2611':'\u2610'}),(0,D.jsxs)(h.default,{style:{flex:1},children:[(0,D.jsx)(u.T,{size:14,children:t}),(0,D.jsx)(u.Muted,{children:n?`${n.by} \xb7 ${new Date(n.at).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})}`:i??''})]})]},e)};return(0,D.jsxs)(h.default,{style:{gap:10},children:[(0,D.jsxs)(u.Card,{children:[(0,D.jsx)(u.T,{weight:"semibold",children:"Record a temperature"}),(0,D.jsx)(u.Row,{wrap:!0,gap:6,children:A.map(e=>(0,D.jsx)(u.Chip,{label:e.label,selected:e.id===x,onPress:()=>{y(e.id),S(e.units.filter(e=>(0,n.chefCanSee)(r,e))[0])}},e.id))}),(0,D.jsx)(u.Row,{wrap:!0,gap:6,children:j.units.map(e=>(0,D.jsx)(u.Chip,{label:e,selected:e===C,onPress:()=>S(e)},e))}),(0,D.jsx)(u.Muted,{children:j.rule}),(0,D.jsxs)(u.Row,{gap:8,children:[(0,D.jsx)(t.TextInput,{accessibilityLabel:"Temperature in degrees C",keyboardType:"numbers-and-punctuation",value:T,onChangeText:v,placeholder:"\xb0C",placeholderTextColor:k.colours.muted,style:{width:90,borderWidth:1,borderColor:k.colours.border,borderRadius:8,padding:8,color:k.colours.text}}),null===$?null:(0,D.jsx)(u.Badge,{kind:!0===$?'ok':'warn'===$?'amber':'red',label:!0===$?'OK':'warn'===$?'CHECK':'OUT OF RANGE'}),(0,D.jsx)(u.Button,{small:!0,label:"Save",disabled:null===$,onPress:()=>{a({by:s,kind:x,unit:C,temp:R,note:!0===$?void 0:'Action needed'}),v('')}})]}),!1===$?(0,D.jsx)(u.Banner,{kind:"danger",title:"Out of range",children:"Record what you did (e.g. moved food, called the engineer, cooked longer) and re-check."}):null]}),(0,D.jsxs)(u.Card,{children:[(0,D.jsxs)(u.T,{weight:"semibold",children:["Today's readings (",I.length,")"]}),I.length?I.map(e=>{const t=A.find(t=>t.id===e.kind)?.ok(e.temp);return(0,D.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,D.jsx)(u.T,{size:14,style:{flex:1},children:e.unit}),(0,D.jsx)(u.Muted,{children:new Date(e.at).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})}),(0,D.jsxs)(u.T,{size:14,weight:"semibold",colour:!0===t?k.colours.ok:'warn'===t?k.colours.amber:k.colours.red,children:[e.temp,"\xb0C"]})]},e.id)}):(0,D.jsx)(u.Muted,{children:"None yet today."})]}),(0,D.jsxs)(u.Card,{children:[(0,D.jsx)(u.T,{weight:"semibold",children:"Opening and closing checks"}),(0,D.jsx)(u.Muted,{children:"Day-to-day checks in the style of a CookSafe diary. Your own CookSafe manual is the record that counts."}),P.map(e=>L(`${l}:kc-${e.id}`,e.text))]}),(0,D.jsxs)(u.Card,{children:[(0,D.jsx)(u.T,{weight:"semibold",children:"Cleaning schedule"}),N.map(e=>L('Daily'===e.freq?`${l}:kcl-${e.id}`:`wk${Math.floor(i.getTime()/6048e5)}:kcl-${e.id}`,e.text,e.freq))]})]})},_e.TeamScreen=function(){const{rid:e,r:t,me:s,now:i,menu:n}=(0,M.useChef)(15e3),[r,a]=(0,o.useState)('live'),d=(0,S.useSignedIn)(),c=(0,o.useMemo)(()=>({meId:d?.id??M.CHEF_ID,role:'staff'}),[d?.id]);return(0,D.jsx)(C.ChatAsCtx.Provider,{value:c,children:(0,D.jsxs)(h.default,{style:{gap:10},children:[(0,D.jsx)(q,{sub:r,setSub:a}),'live'===r?(0,D.jsx)(E,{}):'soldout'===r?(0,D.jsx)(l.SoldOutList,{rid:e,by:s}):'team'===r?(0,D.jsx)(G,{}):(0,D.jsx)(W,{}),void 0,void 0,void 0,void 0,void 0]})})};var t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),n=_r(_d[3]),r=_r(_d[4]),l=_r(_d[5]),a=_r(_d[6]),o=_r(_d[7]),d=e(_r(_d[8])),c=e(_r(_d[9])),h=e(_r(_d[10])),u=_r(_d[11]),f=_r(_d[12]),m=_r(_d[13]),p=_r(_d[14]),x=_r(_d[15]),y=_r(_d[16]),b=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),k=_r(_d[20]),C=_r(_d[21]),S=_r(_d[22]),T=_r(_d[23]),v=_r(_d[24]),R=_r(_d[25]),$=_r(_d[26]),M=_r(_d[27]),B=_r(_d[28]),I=_r(_d[29]),L=_r(_d[30]),O=_r(_d[31]),z=_r(_d[32]),D=_r(_d[33]);const A=[{id:'fridge',label:'Fridge',units:['Walk-in fridge','Prep fridge','Bar fridge'],rule:'Target 5\xb0C or below (8\xb0C maximum)',ok:e=>e<=5||e<=8&&'warn'},{id:'freezer',label:'Freezer',units:['Chest freezer','Upright freezer'],rule:'Target \u221218\xb0C or below',ok:e=>e<=-18||e<=-15&&'warn'},{id:'cook',label:'Cooking (core)',units:['Fish','Chicken','Pie','Burger'],rule:'Core 75\xb0C or above',ok:e=>e>=75},{id:'reheat',label:'Reheating',units:['Soup','Skink','Sauce'],rule:'Core 82\xb0C or above (Scotland)',ok:e=>e>=82},{id:'hot hold',label:'Hot holding',units:['Bain-marie','Soup kettle'],rule:'63\xb0C or above',ok:e=>e>=63},{id:'cool',label:'Cooling',units:['Stock','Rice','Braise'],rule:'Below 8\xb0C, cooled as quickly as possible (aim for 90 minutes)',ok:e=>e<8||'warn'}],N=[{id:'surfaces',text:'Work surfaces and boards cleaned and sanitised',freq:'Daily'},{id:'fryers',text:'Fryers filtered, oil checked',freq:'Daily'},{id:'floors',text:'Floors and drains',freq:'Daily'},{id:'handwash',text:'Wash-hand basins stocked (soap, towels)',freq:'Daily'},{id:'fridges',text:'Fridges emptied and cleaned',freq:'Weekly'},{id:'extract',text:'Extraction canopy filters',freq:'Weekly'}],P=[{id:'open-temps',text:'Opening: fridge and freezer temperatures recorded',when:'Opening'},{id:'open-fit',text:'Opening: staff fit for work (no sickness or diarrhoea in 48 hours)',when:'Opening'},{id:'open-probe',text:'Opening: probe thermometer checked and wiped',when:'Opening'},{id:'close-label',text:'Closing: food covered, labelled and dated',when:'Closing'},{id:'close-dates',text:'Closing: anything past its use-by removed',when:'Closing'},{id:'close-clean',text:'Closing: cleaning schedule done',when:'Closing'}];function q({sub:e,setSub:t}){const{total:s}=(0,C.useChatUnread)();return(0,D.jsx)(M.Seg,{value:e,onChange:t,options:[{id:'live',label:'Live tickets'},{id:'soldout',label:'Sold out'},{id:'team',label:"Who's on & rota"},{id:'chat',label:s?`Chat (${s})`:'Chat'}]})}function W(){return(0,D.jsx)(C.Chat,{go:()=>{}})}function E(){const{rid:e,r:t,me:s,now:i}=(0,M.useChef)(15e3),n=(0,f.useStore)(e=>e.bookings),l=(0,f.useOrders)(e),o=l.filter(e=>(0,a.waitingForStaff)(e)).length,d=l.filter(a.kitchenCanSee).filter(e=>['new','acknowledged','preparing'].includes(e.status)||'ready'===e.status&&'pass'===(0,$.nextStep)(e,(0,$.linkedBooking)(e,n))),c=(e,t)=>!!(0,$.statusBlock)(e,t,(0,$.linkedBooking)(e,n)),m=(0,x.ticketView)('chef',d),p=(0,f.useStore)(e=>e.setOrderStatus),b=(0,f.useStore)(e=>e.ackReadiness),w=d.flatMap(e=>(0,j.readinessFor)(e,t,i)).filter(e=>'due'===e.state||'overdue'===e.state);return(0,D.jsxs)(h.default,{style:{gap:8},children:[w.length?(0,D.jsx)(u.Banner,{kind:"warn",title:`${w.length} readiness alert${w.length>1?'s':''}`,children:w.map(e=>e.detail).join(' \xb7 ')}):(0,D.jsx)(u.Muted,{children:"No readiness alerts right now."}),o?(0,D.jsxs)(u.Muted,{children:[o," table order",o>1?'s':''," waiting for front of house to accept (the first order from a new phone). It shows here once accepted."]}):null,m.length?m.map(e=>(0,D.jsxs)(u.Card,{highlight:e.allergies.length&&(0,$.nextStep)(e,(0,$.linkedBooking)(e,n))&&'ready'!==e.status?k.colours.red:void 0,children:[(0,D.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,D.jsxs)(u.T,{weight:"semibold",children:['table'===e.type?`${(0,r.tableNumbers)(e.tableNo)}`:`Takeaway ${e.slotTime?new Date(e.slotTime).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}):''}`," \xb7 ",e.ref]}),(0,D.jsx)(u.Badge,{kind:'new'===e.status?'amber':'gold',label:e.status.toUpperCase()})]}),e.lines.map((e,t)=>(0,D.jsxs)(u.T,{size:14,children:[e.qty," \xd7 ",e.name]},t)),e.allergies.length?(0,D.jsxs)(u.T,{size:13,colour:k.colours.red,children:["\u26a0 Allergy: ",e.allergies.map(e=>`${y.ALLERGENS.find(t=>t.id===e.allergen)?.label} (${e.severity})`).join(', ')]}):null,'takeaway'===e.type&&e.accepted?(0,D.jsxs)(u.T,{size:13,colour:k.colours.ok,children:["\u2713 Confirmed by ",e.accepted.by,Object.keys(e.allergyTicks??{}).length?` \xb7 kitchen checked: ${Object.keys(e.allergyTicks).map(e=>y.ALLERGENS.find(t=>t.id===e)?.label??e).join(', ')}`:'']}):null,e.allergies.length?(0,D.jsx)(R.AllergyChain,{o:e,me:s}):null,(0,D.jsxs)(u.Row,{wrap:!0,gap:8,children:['preparing'!==e.status&&'ready'!==e.status?(0,D.jsx)(u.Button,{small:!0,label:"Start",testID:`start-${e.ref}`,disabled:c(e,'preparing'),onPress:()=>{p(e.id,'preparing',s),'takeaway'===e.type&&b(e.id,'cook',s)}}):null,'ready'!==e.status?(0,D.jsx)(u.Button,{small:!0,kind:"success",label:"Ready",testID:`ready-${e.ref}`,disabled:c(e,'ready'),onPress:()=>p(e.id,'ready',s)}):null]})]},e.id)):(0,D.jsx)(u.Muted,{children:"No live tickets. New orders from the customer app and the Staff app show here."})]})}const F=(e,t)=>{const[s,i,n]=e.split('-').map(Number);return(0,w.ymd)(new Date(s,i-1,n+t))};function G(){const{now:e,today:t}={...(0,M.useChef)(6e4),today:(0,w.ymd)(new Date)},{staff:s,shifts:i}=(0,x.rotaView)('chef',(0,p.useOwner)(e=>e.staff),(0,p.useOwner)(e=>e.shifts)),n=(0,p.useOwner)(e=>e.attendance).filter(e=>e.date===t&&e.in&&!e.out),r=(0,S.weekday)(e),l=s.filter(e=>/kitchen|chef|kp/i.test(e.job+e.name)),a=(0,O.useSession)(e=>e.meId),o=(0,z.useSync)(e=>e.staffRef),d=a??o??M.CHEF_ID,c=(0,p.useOwner)(e=>e.staff.find(e=>e.id===d)?.name??'Chef').replace(/\s*\(.*\)$/,'');return(0,D.jsxs)(h.default,{style:{gap:10},children:[(0,D.jsx)(L.BreakRoomCard,{staffId:d,name:c,now:e}),(0,D.jsxs)(u.Card,{children:[(0,D.jsx)(u.T,{weight:"semibold",children:"On now"}),n.length?n.map(e=>(0,D.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,D.jsxs)(u.Row,{gap:8,style:{flex:1},children:[(0,D.jsx)(I.StaffAvatar,{id:e.staffId,size:28}),(0,D.jsx)(u.T,{size:14,children:s.find(t=>t.id===e.staffId)?.name??e.staffId})]}),(0,D.jsxs)(u.Muted,{children:["since ",new Date(e.in).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})]})]},e.id)):(0,D.jsx)(u.Muted,{children:"Nobody clocked in yet."})]}),(0,D.jsxs)(u.Card,{children:[(0,D.jsxs)(u.T,{weight:"semibold",children:["Today on the rota (",S.DAY3[r],")"]}),i.filter(e=>e.date===t).map(e=>(0,D.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,D.jsxs)(u.Row,{gap:8,style:{flex:1},children:[(0,D.jsx)(I.StaffAvatar,{id:e.staffId,size:28}),(0,D.jsx)(u.T,{size:14,children:s.find(t=>t.id===e.staffId)?.name})]}),(0,D.jsxs)(u.Muted,{children:[(0,S.fmtH)(e.start),"\u2013",(0,S.fmtH)(e.end)]})]},e.id))]}),(0,D.jsxs)(u.Card,{children:[(0,D.jsx)(u.T,{weight:"semibold",children:"Kitchen rota this week"}),l.map(e=>(0,D.jsxs)(h.default,{style:{gap:4},children:[(0,D.jsx)(u.T,{size:14,children:e.name}),(0,D.jsx)(u.Row,{wrap:!0,gap:4,children:S.DAY3.map((s,n)=>{const l=i.find(s=>s.staffId===e.id&&s.date===F(t,n-r));return(0,D.jsxs)(h.default,{style:{width:44,padding:4,borderRadius:6,backgroundColor:l?k.colours.goldTint:k.colours.surface2,alignItems:'center'},children:[(0,D.jsx)(u.T,{size:10,colour:k.colours.muted,children:s}),(0,D.jsx)(u.T,{size:10,children:l?`${(0,S.fmtH)(l.start).slice(0,2)}\u2013${(0,S.fmtH)(l.end).slice(0,2)}`:'off'})]},s)})})]},e.id)),(0,D.jsx)(u.Muted,{children:"Rota changes, swaps and leave are made in CoverCharge for Managers. This view shows shifts only."})]})]})}},1308,[877,1026,1309,1025,808,993,876,30,263,151,127,813,819,831,856,807,814,816,1310,818,821,1000,927,1301,1300,939,940,1304,1203,953,1030,859,820,24]); +__d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ingredientQty",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"ingredientSpeech",{enumerable:!0,get:function(){return f}});var t=r(d[0]),n=r(d[1]);const i=(i,f,u)=>(0,n.fishInStone)(i,f)?(0,n.fishQtyText)(i,f,u):(0,t.fmtQty)(u,f.unit||''),f=(t,f,u)=>(0,n.fishInStone)(t,f)?(0,n.fishQtySpeech)(t,f,u):i(t,f,u)},1309,[1300,1026]); +__d(function(g,_r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.readinessFor=function(a,d,r){if('takeaway'!==a.type||!a.slotTime)return[];if(['collected','cancelled','closed'].includes(a.status))return[];const s=new Date(a.slotTime),n=d.settings.bufferMins,o=a.lines.map(a=>({name:a.name,qty:a.qty,at:(0,t.addMins)(s,-(a.prepMins+n))})),u=o.reduce((t,a)=>a.at{if(a)return'done';const d=r.getTime()-t.getTime();return d<0?'upcoming':d>3e5?'overdue':'due'},y=['ready','collected'].includes(a.status);return[{id:`${a.id}:cook`,orderId:a.id,stage:'cook',due:u,state:l(u,!!a.readiness.cook||y),detail:o.sort((t,a)=>t.at.getTime()-a.at.getTime()).map(t=>{return`${t.qty}\xd7 ${t.name} at ${a=t.at,`${String(a.getHours()).padStart(2,'0')}:${String(a.getMinutes()).padStart(2,'0')}`}`;var a}).join(' \xb7 ')},{id:`${a.id}:bag`,orderId:a.id,stage:'bag',due:c,state:l(c,!!a.readiness.bag||y),detail:'Bag, add sauces/drinks, check against ticket and allergy flags'},{id:`${a.id}:ready`,orderId:a.id,stage:'ready',due:s,state:l(s,y),detail:'Mark ready \u2014 sends the customer a "your order is ready" notification'}]};var t=_r(_d[0])},1310,[818]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"inlineStyles",{enumerable:!0,get:function(){return n.inlineStyles}}),Object.defineProperty(_e,"loadLocalRawResource",{enumerable:!0,get:function(){return n.loadLocalRawResource}}),Object.defineProperty(_e,"LocalSvg",{enumerable:!0,get:function(){return n.LocalSvg}}),Object.defineProperty(_e,"SvgCss",{enumerable:!0,get:function(){return n.SvgCss}}),Object.defineProperty(_e,"SvgCssUri",{enumerable:!0,get:function(){return n.SvgCssUri}}),Object.defineProperty(_e,"SvgWithCss",{enumerable:!0,get:function(){return n.SvgWithCss}}),Object.defineProperty(_e,"SvgWithCssUri",{enumerable:!0,get:function(){return n.SvgWithCssUri}}),Object.defineProperty(_e,"WithLocalSvg",{enumerable:!0,get:function(){return n.WithLocalSvg}}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return f.default}}),Object.defineProperty(_e,"camelCase",{enumerable:!0,get:function(){return e.camelCase}}),Object.defineProperty(_e,"fetchText",{enumerable:!0,get:function(){return t.fetchText}}),Object.defineProperty(_e,"parse",{enumerable:!0,get:function(){return e.parse}}),Object.defineProperty(_e,"SvgAst",{enumerable:!0,get:function(){return e.SvgAst}}),Object.defineProperty(_e,"SvgFromUri",{enumerable:!0,get:function(){return e.SvgFromUri}}),Object.defineProperty(_e,"SvgFromXml",{enumerable:!0,get:function(){return e.SvgFromXml}}),Object.defineProperty(_e,"SvgUri",{enumerable:!0,get:function(){return e.SvgUri}}),Object.defineProperty(_e,"SvgXml",{enumerable:!0,get:function(){return e.SvgXml}});var e=r(d[0]),t=r(d[1]),n=r(d[2]),u=r(d[3]);Object.keys(u).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return u[e]}})});var o=r(d[4]);Object.keys(o).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return o[e]}})});var c,f=(c=o)&&c.__esModule?c:{default:c}},1311,[1312,1313,1332,1333,1315]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.SvgAst=c,_e.SvgXml=l,_e.SvgUri=function(r){const{onError:o=i,uri:s,onLoad:c,fallback:u}=r,[f,p]=(0,t.useState)(null),[d,h]=(0,t.useState)(!1);if((0,t.useEffect)(()=>{s?(0,n.fetchText)(s).then(t=>{p(t),d&&h(!1),c?.()}).catch(t=>{o(t),h(!0)}):p(null)},[o,s,c]),d)return u??null;return e.createElement(l,{xml:f,override:r,fallback:u})},Object.defineProperty(_e,"SvgFromXml",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"SvgFromUri",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"camelCase",{enumerable:!0,get:function(){return d}}),_e.getStyle=h,_e.astToReact=x,_e.parse=j,Object.defineProperty(_e,"tags",{enumerable:!0,get:function(){return r.tags}});var t=_r(_d[0]),e=(function(t){if(t&&t.__esModule)return t;var e={};return t&&Object.keys(t).forEach(function(n){if('default'!==n){var r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:function(){return t[n]}})}}),e.default=t,e})(t),n=_r(_d[1]),r=_r(_d[2]);function o(){return o=Object.assign?Object.assign.bind():function(t){for(var e=1;enull!==o?j(o):null,[o]);return e.createElement(c,{ast:r,override:s||n})}catch(t){return r(t),l??null}}class u extends t.Component{state={ast:null};componentDidMount(){this.parse(this.props.xml)}componentDidUpdate(t){const{xml:e}=this.props;e!==t.xml&&this.parse(e)}parse(t){const{onError:e=i}=this.props;try{this.setState({ast:t?j(t):null})}catch(t){const n=t;e({...n,message:`[RNSVG] Couldn't parse SVG, reason: ${n.message}`})}}render(){const{props:t,state:{ast:n}}=this;return e.createElement(c,{ast:n,override:t.override||t})}}class f extends t.Component{state={xml:null};componentDidMount(){this.fetch(this.props.uri)}componentDidUpdate(t){const{uri:e}=this.props;e!==t.uri&&this.fetch(e)}async fetch(t){try{this.setState({xml:t?await(0,n.fetchText)(t):null})}catch(t){console.error(t)}}render(){const{props:t,state:{xml:n}}=this;return e.createElement(u,{xml:n,override:t,onError:t.onError})}}const p=(t,e)=>e.toUpperCase(),d=t=>t.replace(/[:-]([a-z])/g,p);function h(t){const e={},n=t.split(';').filter(t=>t.trim()),{length:r}=n;for(let t=0;tb(' ',t.length);function v(t,e){const n=t.split('\n'),r=n.length;let o=e,s=0;for(;s=t))break;o-=t}const c=t.slice(0,e).replace(/^\t+/,y),i=/(^|\n).*$/.exec(c),l=i&&i[0]||'',u=t.slice(e),f=/.*(\n|$)/.exec(u);return{line:s,column:o,snippet:`${l}${f&&f[0]}\n${b(' ',l.length)}^`}}const E=/[a-zA-Z0-9:_-]/,O=/
Wildings Hotel & Restaurant
- + diff --git a/wildings/display-app/index.html b/wildings/display-app/index.html index c40e7ff71d82213bf454c05f0837112bdfb219dc..a5d1138e147018b3c4eef2a9223d1cd956538039 100644 --- a/wildings/display-app/index.html +++ b/wildings/display-app/index.html @@ -35,6 +35,6 @@
Wildings Hotel & Restaurant
- + diff --git a/wildings/display-app/sw.js b/wildings/display-app/sw.js index 2fd5ddc3a88528cccdaba7dc35b083a6e073fd66..5eb2da299878b16b595994973e37bc8dba0f40a7 100644 --- a/wildings/display-app/sw.js +++ b/wildings/display-app/sw.js @@ -1,4 +1,4 @@ -const V="cc-wildings-display-914407295d50",B="/wildings/display-app/",P=["/wildings/display-app/apple-touch-icon.png", "/wildings/display-app/favicon.ico", "/wildings/display-app/icon-192.png", "/wildings/display-app/icon-512.png", "/wildings/display-app/brand-logo.png", "/wildings/display-app/index.html", "/wildings/display-app/display.html", "/wildings/display-app/manifest.webmanifest", "/wildings/display-app/brand-hero.png", "/wildings/display-app/_expo/static/js/web/basket-23b053a78600f85843ac913693772ec7.js", "/wildings/display-app/_expo/static/js/web/[section]-7680005b9f9a2edf6bc1f22af6918f1c.js", "/wildings/display-app/_expo/static/js/web/index-a696887a353f7d51648c1e753887f562.js", "/wildings/display-app/_expo/static/js/web/index-374f32ca8b3acd4c473cb67f0be4a5c1.js", "/wildings/display-app/_expo/static/js/web/index-973ada74f56035815426979f31f74d4e.js", "/wildings/display-app/_expo/static/js/web/profile-1c74baad53640e29d41fc5c9e961f3e3.js", "/wildings/display-app/_expo/static/js/web/lost-0a5d5326efc5a5dcb2110fd615779f07.js", "/wildings/display-app/_expo/static/js/web/index-08029b0479f99a2d4c6b46f63ebe2bc0.js", "/wildings/display-app/_expo/static/js/web/loyalty-bdba91e76a1977daa5ad4379cc66a275.js", "/wildings/display-app/_expo/static/js/web/whatson-9d1e33597e23613f788dd1a65097d805.js", "/wildings/display-app/_expo/static/js/web/index-6c5ae0996d456c20f8ac83537e2f0afe.js", "/wildings/display-app/_expo/static/js/web/index-aa80a45d20901c92ac80bce3e7f15e09.js", "/wildings/display-app/_expo/static/js/web/feedback-d9f2534b23e5222df62036cf5c589115.js", "/wildings/display-app/_expo/static/js/web/demo-83f3a2ec0a7b15fde8c581deca3aacba.js", "/wildings/display-app/_expo/static/js/web/index-1184747fb013391b5c68f2bc5f74404d.js", "/wildings/display-app/_expo/static/js/web/book-e85de1237680ea1ed22194e431f4aae4.js", "/wildings/display-app/_expo/static/js/web/index-db8aa0906eb1b544ee9a2364139b06f3.js", "/wildings/display-app/_expo/static/js/web/[did]-227a2f79a620251d29d8f8e716ee8bdb.js", "/wildings/display-app/_expo/static/js/web/__expo-metro-runtime-8c088df87a31e4e6accd81c554ec290d.js", "/wildings/display-app/_expo/static/js/web/gift-816d52e2568f34226fab48f95bd8cd2d.js", "/wildings/display-app/_expo/static/js/web/historicalBookingApi-8df5bad0df5a656a389cbe2d72a17686.js", "/wildings/display-app/_expo/static/js/web/index-c2e5595ff2606c756fa90389e35ce544.js", "/wildings/display-app/_expo/static/js/web/index-6ff9008e6ddc971ef1cd72c414e77874.js", "/wildings/display-app/_expo/static/js/web/refer-378e1e06d7d4e4950a522cf456508788.js", "/wildings/display-app/_expo/static/js/web/[n]-3078b1d37581aff4da1ffebe18afde8a.js", "/wildings/display-app/_expo/static/js/web/offers-3a70cae9a304021a06d107a723b85340.js", "/wildings/display-app/_expo/static/js/web/[oid]-79da5afa34641052ac0acd9d446a2fdc.js", "/wildings/display-app/_expo/static/js/web/_layout-a7e2fde9337e1675c2295553798da1c2.js", "/wildings/display-app/_expo/static/js/web/__common-b386eb4cec314f0966c0d86451531607.js", "/wildings/display-app/_expo/static/js/web/merch-0c059175e625a9d65fea1c24c9fd49cb.js", "/wildings/display-app/_expo/static/js/web/waitlist-ad8a10a700c4b24b6910dd9ba40f2c28.js", "/wildings/display-app/_expo/static/js/web/[token]-71d704981c137007abc843f2f7737ebd.js", "/wildings/display-app/_expo/static/js/web/+not-found-a9acde932f0ed95cf1e7409e88874f97.js", "/wildings/display-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/wildings/display-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/wildings/display-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/wildings/display-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/wildings/display-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/wildings/display-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/wildings/display-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/wildings/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/wildings/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/wildings/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/wildings/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/wildings/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/wildings/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/wildings/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/wildings/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/wildings/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/wildings/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/wildings/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/wildings/display-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/wildings/display-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/wildings/display-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/wildings/display-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/wildings/display-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/wildings/display-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/wildings/display-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/wildings/display-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/wildings/display-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/wildings/display-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/wildings/display-app/assets/assets/brand/wildings.076f4fcd06d19a0af0205c410f461b14.png", "/wildings/display-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/wildings/display-app/assets/assets/brand/kirkmichael.63b13cde7fd82eb622622b39ac80c394.png", "/wildings/display-app/assets/assets/brand/brae.8de9e89ac30966c6669de990370d8e40.png", "/wildings/display-app/assets/assets/brand/kirkmichael-hero.63b13cde7fd82eb622622b39ac80c394.png", "/wildings/display-app/assets/assets/brand/greenside.9d1556db97dcb903a3c57e2063ee2255.png", "/wildings/display-app/assets/assets/brand/abbotsford-hero.78fcb8ee06ee22c4ca659c9254db7512.png", "/wildings/display-app/assets/assets/brand/kirkton.bcf8d846df4861474d224a7a77f498fb.png", "/wildings/display-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/wildings/display-app/assets/assets/brand/wildings-hero-logo-text.4661e4b935726f2511f9c17a1567c89a.png", "/wildings/display-app/assets/assets/brand/kirkton-hero.9d0837b292c2f4f30f4521d806bb28c3.png", "/wildings/display-app/assets/assets/brand/saltmarsh.85a6a65732635e5148478d743d9ca884.png", "/wildings/display-app/assets/assets/brand/souters.f4c58d9349b6e1700fe5abcc9e9b665c.png", "/wildings/display-app/assets/assets/brand/greenside-hero.1caec5a6cb939434cccb5f3a613b50f8.png", "/wildings/display-app/assets/assets/brand/abbotsford.b26602bba5ce4969733c5422a45ad053.png"]; +const V="cc-wildings-display-d38632db285d",B="/wildings/display-app/",P=["/wildings/display-app/apple-touch-icon.png", "/wildings/display-app/favicon.ico", "/wildings/display-app/icon-192.png", "/wildings/display-app/icon-512.png", "/wildings/display-app/brand-logo.png", "/wildings/display-app/index.html", "/wildings/display-app/display.html", "/wildings/display-app/manifest.webmanifest", "/wildings/display-app/brand-hero.png", "/wildings/display-app/_expo/static/js/web/feedback-3a26c70c9f758c4e362493c3b124ff43.js", "/wildings/display-app/_expo/static/js/web/[n]-ced785c534ba69ad6c9c35369d7ecc36.js", "/wildings/display-app/_expo/static/js/web/index-f9b07e7c25cec3623c10876ff1e01e58.js", "/wildings/display-app/_expo/static/js/web/[section]-93e8e4ffe952e5b3c505e21ca771e570.js", "/wildings/display-app/_expo/static/js/web/index-a39af53b0c36f30a0cc27647d3da5a52.js", "/wildings/display-app/_expo/static/js/web/loyalty-679d7aa42c3cddfce82c3e1207d2d4cf.js", "/wildings/display-app/_expo/static/js/web/[oid]-7fa4f78cb447d1c659e81fff8893269f.js", "/wildings/display-app/_expo/static/js/web/index-5c634de6ad187be6c30eaf496c8cd727.js", "/wildings/display-app/_expo/static/js/web/refer-01535dadf727412eb1a34a61dcc6d53d.js", "/wildings/display-app/_expo/static/js/web/index-94d82b4679566277ef6fffceb8c359a6.js", "/wildings/display-app/_expo/static/js/web/index-a87fa345a0c01a0150c6e7893fe81768.js", "/wildings/display-app/_expo/static/js/web/__common-d94e71b33d3093ccc2225eba91947508.js", "/wildings/display-app/_expo/static/js/web/[did]-2a2aaaa129307f15140971a22b834cd3.js", "/wildings/display-app/_expo/static/js/web/demo-6323990816bb686dcab3b33d7e6ec148.js", "/wildings/display-app/_expo/static/js/web/historicalBookingApi-2cd603463f8e0769db6a7ead5b608069.js", "/wildings/display-app/_expo/static/js/web/book-b68aff7cd8daa9b5d327ece648db8831.js", "/wildings/display-app/_expo/static/js/web/profile-b82887516ccba728915e95d502c0081a.js", "/wildings/display-app/_expo/static/js/web/offers-eba5409c285b6031064e79e9f1ea19e0.js", "/wildings/display-app/_expo/static/js/web/index-1ca3ee630447c7d027b33568fe68d67d.js", "/wildings/display-app/_expo/static/js/web/merch-63634eac687774d71f27698748247bd2.js", "/wildings/display-app/_expo/static/js/web/__expo-metro-runtime-8c088df87a31e4e6accd81c554ec290d.js", "/wildings/display-app/_expo/static/js/web/[token]-6c815095a584dc0399e5918b52874b98.js", "/wildings/display-app/_expo/static/js/web/gift-eb5daa22c1465e33034a87271e1b8b3b.js", "/wildings/display-app/_expo/static/js/web/basket-b17831f04afc73d6dfc4107f720f1f19.js", "/wildings/display-app/_expo/static/js/web/index-3c5f820b3b21978c61372b3163c55b0a.js", "/wildings/display-app/_expo/static/js/web/+not-found-585f3164ae74e5ff35af71a4ba7360a3.js", "/wildings/display-app/_expo/static/js/web/lost-817d2886f8973bfa630e2a69674dc584.js", "/wildings/display-app/_expo/static/js/web/index-837efe1be9c39737e9750ae18a91c7cb.js", "/wildings/display-app/_expo/static/js/web/whatson-0608a899f634d91b081b758137ce1d33.js", "/wildings/display-app/_expo/static/js/web/waitlist-119a5ba8531abfe81734f2106aefa476.js", "/wildings/display-app/_expo/static/js/web/_layout-fbf6c194d5e488417e3024d18b097c2f.js", "/wildings/display-app/_expo/static/js/web/index-08f47ce9345574523241cee01d2a7020.js", "/wildings/display-app/_expo/static/js/web/index-3b9f18cdf88a9245c096d383ff4ec0ad.js", "/wildings/display-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/wildings/display-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/wildings/display-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/wildings/display-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/wildings/display-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/wildings/display-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/wildings/display-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/wildings/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/wildings/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/wildings/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/wildings/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/wildings/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/wildings/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/wildings/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/wildings/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/wildings/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/wildings/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/wildings/display-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/wildings/display-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/wildings/display-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/wildings/display-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/wildings/display-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/wildings/display-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/wildings/display-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/wildings/display-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/wildings/display-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/wildings/display-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/wildings/display-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/wildings/display-app/assets/assets/brand/wildings.076f4fcd06d19a0af0205c410f461b14.png", "/wildings/display-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/wildings/display-app/assets/assets/brand/3idiots-hero.e5dfd53739f05086b1956e72d585a66a.png", "/wildings/display-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png", "/wildings/display-app/assets/assets/brand/cecchinis.ebf752fef363247848ae7c0d91938765.png", "/wildings/display-app/assets/assets/brand/kirkmichael.63b13cde7fd82eb622622b39ac80c394.png", "/wildings/display-app/assets/assets/brand/3idiots.df4a76d2130f0e5b0042f06a8c88693a.png", "/wildings/display-app/assets/assets/brand/brae.8de9e89ac30966c6669de990370d8e40.png", "/wildings/display-app/assets/assets/brand/rupeeroom-hero.969fa372add526aaacf3a6c009b8ac92.png", "/wildings/display-app/assets/assets/brand/kirkmichael-hero.63b13cde7fd82eb622622b39ac80c394.png", "/wildings/display-app/assets/assets/brand/williewastles.055a77893ced99bf3a6c5402ba5baac6.png", "/wildings/display-app/assets/assets/brand/drunkencoo-hero.65c21c4da9e466cf4bffc969639a1427.png", "/wildings/display-app/assets/assets/brand/pizzaioli-hero.1896657c08264cefb49b401891d5448d.png", "/wildings/display-app/assets/assets/brand/drunkencoo.f6d92af3b14e4205a3deaf4434754c51.png", "/wildings/display-app/assets/assets/brand/smokinggoat.20a3a1970596ab43c5d6468d4ed549a7.png", "/wildings/display-app/assets/assets/brand/greenside.9d1556db97dcb903a3c57e2063ee2255.png", "/wildings/display-app/assets/assets/brand/abbotsford-hero.78fcb8ee06ee22c4ca659c9254db7512.png", "/wildings/display-app/assets/assets/brand/rupeeroom.689e6fb536dc0845eeb174a1ec7bd346.png", "/wildings/display-app/assets/assets/brand/kirkton.bcf8d846df4861474d224a7a77f498fb.png", "/wildings/display-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/wildings/display-app/assets/assets/brand/williewastles-hero.b9d53d27b66f903b5618a7177b2ffad4.png", "/wildings/display-app/assets/assets/brand/pizzaioli.db8c000b62ee407121aa8b90ce45e170.png", "/wildings/display-app/assets/assets/brand/yasmins-hero.a5aef62e37dfcecbe0afc056186f4ad9.png", "/wildings/display-app/assets/assets/brand/wildings-hero-logo-text.4661e4b935726f2511f9c17a1567c89a.png", "/wildings/display-app/assets/assets/brand/yasmins.8482602e9f0a965655924835625cb02b.png", "/wildings/display-app/assets/assets/brand/kirkton-hero.9d0837b292c2f4f30f4521d806bb28c3.png", "/wildings/display-app/assets/assets/brand/saltmarsh.85a6a65732635e5148478d743d9ca884.png", "/wildings/display-app/assets/assets/brand/souters.f4c58d9349b6e1700fe5abcc9e9b665c.png", "/wildings/display-app/assets/assets/brand/greenside-hero.1caec5a6cb939434cccb5f3a613b50f8.png", "/wildings/display-app/assets/assets/brand/abbotsford.b26602bba5ce4969733c5422a45ad053.png", "/wildings/display-app/assets/assets/brand/smokinggoat-hero.0588f17ef0eed7f757f22916cd4d37db.png", "/wildings/display-app/assets/assets/brand/cecchinis-hero.f77780fcc94fd668cf35d66d6dc52d81.png", "/wildings/display-app/assets/assets/brand/mrbasrais-hero.4ce74641cfcf52d099157c84005b9d2a.png"]; self.addEventListener('install',e=>e.waitUntil(caches.open(V).then(c=>Promise.all(P.map(u=>fetch(u).then(r=>r.blob().then(b=>c.put(u,new Response(b,{status:200,headers:{'Content-Type':r.headers.get('Content-Type')||b.type}}))))))).then(()=>self.skipWaiting()))); self.addEventListener('activate',e=>e.waitUntil(caches.keys().then(ks=>Promise.all(ks.filter(k=>k.startsWith('cc-wildings-display-')&&k!==V).map(k=>caches.delete(k)))).then(()=>self.clients.claim()))); self.addEventListener('fetch',e=>{const u=new URL(e.request.url);if(e.request.method!=='GET'||u.origin!==location.origin||!u.pathname.startsWith(B))return;if(e.request.mode==='navigate'){e.respondWith(fetch(e.request).then(r=>r.ok?r:caches.match(B+'index.html')).catch(()=>caches.match(B+'index.html')));return;}e.respondWith(caches.match(e.request,{ignoreSearch:true}).then(r=>r||fetch(e.request)));}); \ No newline at end of file diff --git a/wildings/get/chef.html b/wildings/get/chef.html index 17efeb26c27a4b90175fba752e84bcce828139f1..76fec06a16afd855670c4584f5153eb88a5ddbca 100644 --- a/wildings/get/chef.html +++ b/wildings/get/chef.html @@ -1 +1 @@ -Wildings Hotel & Restaurant · Head ChefWildings Hotel & Restaurant

Maidens, KA26 9NR

Head Chef

Open in Safari or Chrome. Use the browser menu to add to your Home Screen.

Open Head Chef

Use your private personal link to sign in automatically. No personal link is included here.

v0.3.12.76 \ No newline at end of file +Wildings Hotel & Restaurant · Head ChefWildings Hotel & Restaurant

Maidens, KA26 9NR

Head Chef

Open in Safari or Chrome. Use the browser menu to add to your Home Screen.

Open Head Chef

Use your private personal link to sign in automatically. No personal link is included here.

v0.3.12.77 \ No newline at end of file diff --git a/wildings/get/customer.html b/wildings/get/customer.html index 099a6299c5d580f2f67687fba99cfd708796c5d5..1468813e1e0b5d06409f5c901cc52d76d6c9dcc3 100644 --- a/wildings/get/customer.html +++ b/wildings/get/customer.html @@ -1 +1 @@ -Wildings Hotel & Restaurant · CustomerWildings Hotel & Restaurant

Maidens, KA26 9NR

Customer

Open in Safari or Chrome. Use the browser menu to add to your Home Screen.

Open Customer

No personal link or pairing code is included.

v0.3.12.76 \ No newline at end of file +Wildings Hotel & Restaurant · CustomerWildings Hotel & Restaurant

Maidens, KA26 9NR

Customer

Open in Safari or Chrome. Use the browser menu to add to your Home Screen.

Open Customer

No personal link or pairing code is included.

v0.3.12.77 \ No newline at end of file diff --git a/wildings/get/display.html b/wildings/get/display.html index f3b0b13a23c71754bf2c09e709dc82b32e34ecf7..e11981db283905fc2ac1cbf19c11ccefd9c062ab 100644 --- a/wildings/get/display.html +++ b/wildings/get/display.html @@ -1 +1 @@ -Wildings Hotel & Restaurant · DisplayWildings Hotel & Restaurant

Maidens, KA26 9NR

Display

Open in Safari or Chrome. Use the browser menu to add to your Home Screen.

Open Display

No personal link or pairing code is included.

v0.3.12.76 \ No newline at end of file +Wildings Hotel & Restaurant · DisplayWildings Hotel & Restaurant

Maidens, KA26 9NR

Display

Open in Safari or Chrome. Use the browser menu to add to your Home Screen.

Open Display

No personal link or pairing code is included.

v0.3.12.77 \ No newline at end of file diff --git a/wildings/get/managers.html b/wildings/get/managers.html index e34a484bb9b13062052186ab619d27bd92b4e32c..4ee071c702314e7ca40e6c387b5551baab769c17 100644 --- a/wildings/get/managers.html +++ b/wildings/get/managers.html @@ -1 +1 @@ -Wildings Hotel & Restaurant · ManagersWildings Hotel & Restaurant

Maidens, KA26 9NR

Managers

Open in Safari or Chrome. Use the browser menu to add to your Home Screen.

Open Managers

Use your private personal link to sign in automatically. No personal link is included here.

v0.3.12.76 \ No newline at end of file +Wildings Hotel & Restaurant · ManagersWildings Hotel & Restaurant

Maidens, KA26 9NR

Managers

Open in Safari or Chrome. Use the browser menu to add to your Home Screen.

Open Managers

Use your private personal link to sign in automatically. No personal link is included here.

v0.3.12.77 \ No newline at end of file diff --git a/wildings/get/staff.html b/wildings/get/staff.html index 4c9bfe6aae88c8890bea07fd508b355b8fcb03ed..ab9bc92599796815b8c60ea5568e2c1fa7d0cb19 100644 --- a/wildings/get/staff.html +++ b/wildings/get/staff.html @@ -1 +1 @@ -Wildings Hotel & Restaurant · StaffWildings Hotel & Restaurant

Maidens, KA26 9NR

Staff

Open in Safari or Chrome. Use the browser menu to add to your Home Screen.

Open Staff

Use your private personal link to sign in automatically. No personal link is included here.

v0.3.12.76 \ No newline at end of file +Wildings Hotel & Restaurant · StaffWildings Hotel & Restaurant

Maidens, KA26 9NR

Staff

Open in Safari or Chrome. Use the browser menu to add to your Home Screen.

Open Staff

Use your private personal link to sign in automatically. No personal link is included here.

v0.3.12.77 \ No newline at end of file diff --git a/wildings/index.html b/wildings/index.html index f65ea5e556b170e49270ead320fb6aa5134e8a6b..c1d5d97e08c4af199b1fa8a0a6488d78e87607ee 100644 --- a/wildings/index.html +++ b/wildings/index.html @@ -1 +1 @@ -Wildings Hotel & Restaurant · CoverChargeWildings Hotel & Restaurant

Maidens, KA26 9NR

CoverCharge apps

Venue apps

Managers

Staff

Head Chef

Display

Customer

v0.3.12.76 \ No newline at end of file +Wildings Hotel & Restaurant · CoverChargeWildings Hotel & Restaurant

Maidens, KA26 9NR

CoverCharge apps

Venue apps

Managers

Staff

Head Chef

Display

Customer

v0.3.12.77 \ No newline at end of file diff --git a/wildings/owner-app/_expo/static/js/web/+not-found-585f3164ae74e5ff35af71a4ba7360a3.js b/wildings/owner-app/_expo/static/js/web/+not-found-585f3164ae74e5ff35af71a4ba7360a3.js new file mode 100644 index 0000000000000000000000000000000000000000..cf2e6d94e8ca98606e0f8533c347ea51139bfdb7 --- /dev/null +++ b/wildings/owner-app/_expo/static/js/web/+not-found-585f3164ae74e5ff35af71a4ba7360a3.js @@ -0,0 +1 @@ +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return c}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]);function c(){return(0,u.jsx)(t.Redirect,{href:n.ENTRY[n.APP_VARIANT]})}},801,[804,30,806,24]); \ No newline at end of file diff --git a/wildings/owner-app/_expo/static/js/web/[did]-2a2aaaa129307f15140971a22b834cd3.js b/wildings/owner-app/_expo/static/js/web/[did]-2a2aaaa129307f15140971a22b834cd3.js new file mode 100644 index 0000000000000000000000000000000000000000..1f0ffb8d5093d5a183dc2a9c0fb7062951faa5c1 --- /dev/null +++ b/wildings/owner-app/_expo/static/js/web/[did]-2a2aaaa129307f15140971a22b834cd3.js @@ -0,0 +1 @@ +__d(function(_g,_r,i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return f}});var t=_r(_d[0]),n=_r(_d[1]),l=e(_r(_d[2])),s=e(_r(_d[3])),r=_r(_d[4]),a=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),g=_r(_d[11]),p=_r(_d[12]);function f(){const{rid:e,did:f}=(0,t.useLocalSearchParams)(),b=(0,u.useRestaurant)(e),j=(0,u.useMenu)(e).find(e=>e.id===f),x=(0,u.useCustomer)(),m=(0,u.useRecipeCards)(e).find(e=>e.id===j?.recipeCardId),y=m?.signOff&&m.photo?(0,h.recipeCards)().photoSource(m.photo):null,k=(0,u.useStore)(e=>e.addLine),[v,w]=(0,n.useState)(()=>(j?.optionGroups??[]).filter(e=>e.required).map(e=>e.choices[0].id)),[S,C]=(0,n.useState)(1),[B,$]=(0,n.useState)(''),[I,P]=(0,n.useState)(!1),[L,T]=(0,n.useState)(!1),[D,O]=(0,n.useState)(!1),[A,M]=(0,n.useState)(!1),R=(0,n.useMemo)(()=>j?(0,d.effectiveAllergens)(j,v):{},[j,v]);if(!b||!j)return(0,p.jsx)(o.Screen,{title:"Not found",children:(0,p.jsx)(o.T,{children:"Dish not found."})});const q=(0,d.conflictsFor)(R,x.allergies),_=(j.price??0)+(j.optionGroups??[]).flatMap(e=>e.choices).filter(e=>v.includes(e.id)).reduce((e,t)=>e+t.priceDelta,0),N=j.soldOut||!j.signOff||null===j.price,G=(e,t)=>{const n=j.optionGroups.find(t=>t.id===e);w(e=>{const l=n.choices.map(e=>e.id);return n.multi?e.includes(t)?e.filter(e=>e!==t):[...e,t]:e.includes(t)&&!n.required?e.filter(e=>e!==t):[...e.filter(e=>!l.includes(e)),t]})},z=e=>{u.useStore.getState().basket.restaurantId!==b.id&&u.useStore.getState().startBasket(b.id,'takeaway'),k({itemId:j.id,qty:S,choiceIds:v,notes:B,override:e?{allergens:q.contains,at:(new Date).toISOString()}:void 0}),P(!1),M(!0)};return(0,p.jsxs)(o.Screen,{title:j.name,subtitle:b.name,right:(0,p.jsx)(a.BasketButton,{}),children:[y?(0,p.jsx)(l.default,{testID:"dish-photo",source:y,accessibilityLabel:`${j.name}${'example'===m?.origin?' (example photo)':''}`,style:{width:'100%',height:200,borderRadius:12},resizeMode:"cover"}):null,(0,p.jsxs)(o.Row,{wrap:!0,gap:6,children:[(0,p.jsx)(o.T,{weight:"bold",size:20,colour:g.colours.gold,children:null===j.price?j.priceNote:(0,c.gbp)(_)}),j.dietary.map(e=>(0,p.jsx)(o.Badge,{kind:"ok",label:e},e))]}),(0,p.jsx)(o.T,{children:j.description}),q.contains.length?(0,p.jsx)(o.Banner,{kind:"danger",title:`Blocked: contains ${q.contains.map(d.allergenLabel).join(', ')}`,children:`You\u2019ve told us: ${x.allergies.filter(e=>q.contains.includes(e.allergen)).map(e=>`${(0,d.allergenLabel)(e.allergen)} \u2014 ${(0,d.severityLabel)(e.severity)}`).join('; ')}. This dish can\u2019t be added unless you deliberately override (for example, ordering for someone else).`}):null,q.may.length?(0,p.jsx)(o.Banner,{kind:"warn",title:`Warning: may contain ${q.may.map(d.allergenLabel).join(', ')}`,children:"Cross-contact is possible (e.g. shared fryer). Please speak to staff before ordering."}):null,(j.optionGroups??[]).map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsxs)(o.T,{weight:"semibold",children:[e.name,e.required?' (required)':' (optional)']}),(0,p.jsx)(o.Row,{wrap:!0,gap:6,children:e.choices.map(t=>(0,p.jsx)(o.Chip,{label:t.label,sub:t.priceDelta?`+${(0,c.gbp)(t.priceDelta)}`:void 0,selected:v.includes(t.id),onPress:()=>G(e.id,t.id)},t.id))})]},e.id)),(0,p.jsx)(o.Card,{children:(0,p.jsx)(r.AllergenPanel,{item:j,map:R,declared:x.allergies})}),b.fictional?null:(0,p.jsx)(o.ExampleAllergenNotice,{}),(0,p.jsx)(o.Field,{label:"Notes for the kitchen (optional)",placeholder:"e.g. no gherkins",value:B,onChangeText:$}),(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Quantity"}),(0,p.jsx)(o.Stepper,{value:S,onChange:C,label:"quantity"})]}),A?(0,p.jsx)(o.Banner,{kind:"success",title:"Added to basket",children:q.contains.length?'Allergy override recorded \u2014 the kitchen will see a large allergy alert.':'Carry on browsing or go to your basket.'}):null,N?(0,p.jsx)(o.Banner,{kind:"warn",children:j.soldOut?'Sold out today.':j.signOff?'Price on the specials board \u2014 ask staff.':'Not available to order online until the head chef signs off its allergens.'}):q.contains.length?(0,p.jsxs)(s.default,{style:{gap:8},children:[(0,p.jsx)(o.Button,{kind:"secondary",label:"Choose something else",onPress:()=>t.router.back()}),(0,p.jsx)(o.Button,{kind:"danger",label:"Override and add anyway\u2026",onPress:()=>{T(!1),O(!1),P(!0)},testID:"override-open"})]}):(0,p.jsxs)(o.Row,{gap:8,children:[(0,p.jsx)(o.Button,{style:{flex:1},label:`Add ${S} to basket \xb7 ${(0,c.gbp)(_*S)}`,onPress:()=>z(!1),testID:"add-to-basket"}),A?(0,p.jsx)(o.Button,{kind:"secondary",label:"Basket",onPress:()=>t.router.push('/customer/basket')}):null]}),(0,p.jsxs)(o.Sheet,{visible:I,onClose:()=>P(!1),title:"Allergy override",children:[(0,p.jsx)(o.Banner,{kind:"danger",title:`${j.name} contains ${q.contains.map(d.allergenLabel).join(', ')}`,children:`Your profile says: ${x.allergies.filter(e=>q.contains.includes(e.allergen)).map(e=>`${(0,d.allergenLabel)(e.allergen)} \u2014 ${(0,d.severityLabel)(e.severity)}`).join('; ')}.`}),(0,p.jsx)(o.Toggle,{label:"I understand this dish contains an allergen I have declared",value:L,onChange:T}),(0,p.jsx)(o.Toggle,{label:"It is for someone without this allergy, or I have spoken to staff",value:D,onChange:O}),(0,p.jsx)(o.Muted,{children:"The override is logged and shown to the kitchen as an allergy alert that must be acknowledged."}),(0,p.jsx)(o.Button,{kind:"danger",disabled:!L||!D,label:"Confirm override and add",onPress:()=>z(!0),testID:"override-confirm"})]})]})}},778,[804,30,196,127,829,830,813,814,816,819,831,821,24]); \ No newline at end of file diff --git a/wildings/owner-app/_expo/static/js/web/[n]-ced785c534ba69ad6c9c35369d7ecc36.js b/wildings/owner-app/_expo/static/js/web/[n]-ced785c534ba69ad6c9c35369d7ecc36.js new file mode 100644 index 0000000000000000000000000000000000000000..c1ced89e3ab9de89839af726f375c95f9fe94a33 --- /dev/null +++ b/wildings/owner-app/_expo/static/js/web/[n]-ced785c534ba69ad6c9c35369d7ecc36.js @@ -0,0 +1 @@ +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return f}});var t=_r(d[0]),r=_r(d[1]),n=_r(d[2]),o=_r(d[3]),u=_r(d[4]),c=_r(d[5]),s=_r(d[6]),l=_r(d[7]);function f(){const{n:f,r:b}=(0,r.useLocalSearchParams)(),E=(0,u.useStore)(t=>t.startBasket),[_,h]=(0,n.useState)(!1),S=b??c.VENUE_RID,j=(0,u.useOrderAtTable)(S),I=(0,s.guestServer)();return(0,n.useEffect)(()=>{t.LIVE_VENUE_BUILD||I||(j&&E(S,'table',String(f)),h(!0))},[S,f,j,I]),t.LIVE_VENUE_BUILD||I?(0,l.jsx)(o.Screen,{title:"Order at the table",children:(0,l.jsx)(o.Banner,{kind:"demo",title:"Scan the code on your table",children:"To order from your table, scan the QR code printed on it. Or order at the bar."})}):_?(0,l.jsx)(r.Redirect,{href:`/customer/${S}`}):null}},794,[833,804,30,813,819,5,836,24]); \ No newline at end of file diff --git a/wildings/owner-app/_expo/static/js/web/[oid]-7fa4f78cb447d1c659e81fff8893269f.js b/wildings/owner-app/_expo/static/js/web/[oid]-7fa4f78cb447d1c659e81fff8893269f.js new file mode 100644 index 0000000000000000000000000000000000000000..f0fcaabb7a82273cae61ec240fcab227e980b17e --- /dev/null +++ b/wildings/owner-app/_expo/static/js/web/[oid]-7fa4f78cb447d1c659e81fff8893269f.js @@ -0,0 +1 @@ +__d(function(g,_r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return f}});var e,t=_r(d[0]),s=_r(d[1]),l=_r(d[2]),r=_r(d[3]),n=(e=r)&&e.__esModule?e:{default:e},o=_r(d[4]),i=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]),p=_r(d[9]),b=_r(d[10]),y=_r(d[11]),j=_r(d[12]);const x=[['new','Placed'],['acknowledged','Accepted'],['preparing','Cooking'],['ready','Ready to collect'],['collected','Collected']],w=[['new','Sent'],['acknowledged','Accepted'],['preparing','Cooking'],['served','Food out'],['closed','Paid']];function f(){const{oid:e}=(0,s.useLocalSearchParams)(),r=(0,b.useOrder)(e),f=(0,b.useRestaurant)(r?.restaurantId),[C,S]=(0,l.useState)(0),[k,T]=(0,l.useState)(''),[v,P]=(0,l.useState)(!1),[M,$]=(0,l.useState)(!1),[R,A]=(0,l.useState)(1),[I,N]=(0,l.useState)(0),[O,B]=(0,l.useState)(r?.split?.ways??1);if(!r||!f)return(0,j.jsx)(c.Screen,{title:"Order",children:(0,j.jsx)(c.T,{children:"Order not found."})});const H='takeaway'===r.type?x:w,_=Math.max(0,H.findIndex(([e])=>e===r.status)),D=Math.round(r.subtotal*I/100),F='table'===r.type?r.subtotal+(r.split?r.tip:D):r.total,q=F-r.paid,L=r.split?.ways??O,W=r.split?.paidShares??0,Y=Math.ceil(F/L),E='collected'===r.status||'closed'===r.status;return(0,j.jsxs)(c.Screen,{title:`Order ${r.ref}`,subtitle:`${f.name} \xb7 ${'table'===r.type?`${(0,t.tableNumbers)(r.tableNo)}`:`Collection at ${r.slotTime?(0,p.hm)(new Date(r.slotTime)):'\u2014'}`}`,children:['takeaway'===r.type?(0,j.jsx)(c.Banner,{kind:"success",title:'ready'===r.status?'Your order is ready!':'Order placed',children:'ready'===r.status?'Head to the bar and give your order number. Staff will check allergies with you at handover.':`Show order number ${r.ref} at the bar when you arrive.`}):null,(0,j.jsxs)(c.Card,{children:[(0,j.jsx)(c.H2,{children:"Status"}),H.map(([e,t],s)=>(0,j.jsxs)(c.Row,{gap:10,children:[(0,j.jsx)(n.default,{style:{width:22,height:22,borderRadius:11,backgroundColor:s<=_?y.colours.gold:y.colours.surface2,borderWidth:1,borderColor:y.colours.gold}}),(0,j.jsx)(c.T,{weight:s===_?'semibold':'regular',colour:s<=_?y.colours.text:y.colours.muted,children:t})]},e)),r.allergyAck?(0,j.jsxs)(c.Muted,{children:["Kitchen signed off your allergies (",r.allergyAck.by,", ",(0,p.hm)(new Date(r.allergyAck.at)),")"]}):r.allergies.length?(0,j.jsx)(c.Muted,{children:"Waiting for the kitchen to sign off your allergies\u2026"}):null,'takeaway'!==r.type||E?null:(0,j.jsxs)(c.Row,{gap:8,children:[(0,j.jsx)(c.Button,{small:!0,kind:'on-my-way'===r.customerSignal?'primary':'secondary',label:"On my way",onPress:()=>b.repo.orders.customerSignal(r.id,'on-my-way')}),(0,j.jsx)(c.Button,{small:!0,kind:'here'===r.customerSignal?'primary':'secondary',label:"I\u2019m here",onPress:()=>b.repo.orders.customerSignal(r.id,'here')})]})]}),(0,j.jsxs)(c.Card,{children:[(0,j.jsx)(c.H2,{children:"Items"}),r.lines.map((e,t)=>(0,j.jsxs)(n.default,{children:[(0,j.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(c.T,{style:{flex:1},children:[e.qty,"\xd7 ",e.name]}),(0,j.jsx)(c.T,{children:(0,h.gbp)(e.unitPrice*e.qty)})]}),e.choices.length?(0,j.jsx)(c.Muted,{children:e.choices.join(' \xb7 ')}):null,e.overridden?(0,j.jsx)(c.Badge,{kind:"red",label:`Allergy override: ${e.contains.map(u.allergenLabel).join(', ')}`}):null]},t)),(0,j.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(c.Muted,{children:"Subtotal"}),(0,j.jsx)(c.T,{children:(0,h.gbp)(r.subtotal)})]}),r.giftCardApplied?(0,j.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(c.Muted,{children:"Of which gift card"}),(0,j.jsxs)(c.T,{colour:y.colours.ok,children:["\u2212",(0,h.gbp)(r.giftCardApplied)]})]}):null,r.tip?(0,j.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(c.Muted,{children:"Tip"}),(0,j.jsx)(c.T,{children:(0,h.gbp)(r.tip)})]}):null,(0,j.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(c.T,{weight:"semibold",children:"Paid (test, no real money)"}),(0,j.jsx)(c.T,{weight:"semibold",colour:y.colours.gold,children:(0,h.gbp)(r.paid)})]})]}),'table'===r.type&&'closed'!==r.status&&'cancelled'!==r.status?(0,j.jsxs)(c.Card,{highlight:y.colours.gold,children:[(0,j.jsxs)(c.H2,{children:["Your bill \u2014 ",(0,t.tableNumbers)(r.tableNo)]}),r.split?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(c.T,{children:["Total ",(0,h.gbp)(F)," \xb7 split ",L," way",L>1?'s':''," \xb7 ",(0,h.gbp)(Y)," each"]}),(0,j.jsxs)(c.T,{children:["Shares paid: ",W," of ",L," \xb7 remaining ",(0,h.gbp)(q)]}),L>1?(0,j.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(c.T,{children:"Shares to pay now"}),(0,j.jsx)(c.Stepper,{value:R,onChange:A,min:1,max:L-W,label:"shares"})]}):null,(0,j.jsx)(c.Button,{label:`Pay ${L>1?`${R} share${R>1?'s':''}`:'bill'} \xb7 ${(0,h.gbp)(Math.min(q,Y*R))}`,onPress:()=>$(!0),testID:"pay-bill"})]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(c.T,{weight:"semibold",children:"Add a tip?"}),(0,j.jsx)(c.Row,{wrap:!0,children:[0,10,12.5,15].map(e=>(0,j.jsx)(c.Chip,{label:e?`${e}%`:'No tip',selected:I===e,onPress:()=>N(e)},e))}),(0,j.jsx)(c.Muted,{children:"Tips go to staff under the restaurant\u2019s tipping policy (Employment (Allocation of Tips) Act 2023)."}),(0,j.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(c.T,{weight:"semibold",children:"Split evenly between"}),(0,j.jsx)(c.Stepper,{value:O,onChange:B,min:1,max:8,label:"people"})]}),(0,j.jsxs)(c.T,{children:["Total ",(0,h.gbp)(r.subtotal+D),O>1?` \xb7 ${(0,h.gbp)(Math.ceil((r.subtotal+D)/O))} each`:'']}),(0,j.jsx)(c.Button,{label:"Get the bill",onPress:()=>b.repo.orders.setSplit(r.id,O,D),testID:"get-bill"})]})]}):null,!E||r.rated||v?null:(0,j.jsxs)(c.Card,{highlight:y.colours.gold,children:[(0,j.jsx)(c.H2,{children:"How was everything?"}),(0,j.jsxs)(c.Muted,{children:["One tap \u2014 this goes privately to ",f.name," only, never published."]}),(0,j.jsx)(i.Stars,{value:C,onChange:S}),C?(0,j.jsx)(c.Field,{label:"Anything to add? (optional)",value:k,onChangeText:T}):null,(0,j.jsx)(c.Button,{label:"Send feedback",disabled:!C,onPress:()=>{b.repo.feedback.add({restaurantId:f.id,orderId:r.id,customerId:r.customerId,customerName:r.customerName,stars:C,comment:k,context:'table'===r.type?`${(0,t.tableNumbers)(r.tableNo)}`:`Takeaway ${r.ref}`}),P(!0)},testID:"send-rating"})]}),v||r.rated?(0,j.jsx)(c.Banner,{kind:"success",children:"Thanks \u2014 your feedback went privately to the restaurant."}):null,E?(0,j.jsx)(c.Button,{kind:"secondary",label:"View stamp card",onPress:()=>s.router.push(`/customer/${f.id}/loyalty`)}):null,(0,j.jsx)(o.MockPay,{visible:M,onClose:()=>$(!1),amount:Math.min(q,Y*R),restaurantId:f.id,title:`Pay \u2014 ${(0,t.tableNumbers)(r.tableNo)}`,onPaid:e=>{b.repo.orders.payTable(r.id,{shares:R,giftCardCode:e.giftCardCode}),$(!1),A(1)}})]})}},791,[808,804,30,127,834,832,813,814,816,818,819,821,24]); \ No newline at end of file diff --git a/wildings/owner-app/_expo/static/js/web/[section]-93e8e4ffe952e5b3c505e21ca771e570.js b/wildings/owner-app/_expo/static/js/web/[section]-93e8e4ffe952e5b3c505e21ca771e570.js new file mode 100644 index 0000000000000000000000000000000000000000..11f3bab84de38d8d8874b5ec2723dd3ea24b04a1 --- /dev/null +++ b/wildings/owner-app/_expo/static/js/web/[section]-93e8e4ffe952e5b3c505e21ca771e570.js @@ -0,0 +1 @@ +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return s}});var t=r(d[0]);r(d[1]);var n=r(d[2]),c=r(d[3]),o=r(d[4]),f=r(d[5]);function s(){const{section:s}=(0,t.useLocalSearchParams)();return(0,c.canShow)('chef')?s&&(0,o.chefSectionAllowed)(String(s))?(0,f.jsx)(n.ChefApp,{section:String(s)},String(s)):(0,f.jsx)(t.Redirect,{href:"/kitchen"}):(0,f.jsx)(t.Redirect,{href:c.ENTRY[c.APP_VARIANT]})}},775,[804,30,805,806,807,24]); \ No newline at end of file diff --git a/wildings/owner-app/_expo/static/js/web/[token]-3c722cbf6e54dbbeb30a3a3ee3ece670.js b/wildings/owner-app/_expo/static/js/web/[token]-3c722cbf6e54dbbeb30a3a3ee3ece670.js new file mode 100644 index 0000000000000000000000000000000000000000..859900de2cb16ddb4f7ce2dd500f6b9a2504326c --- /dev/null +++ b/wildings/owner-app/_expo/static/js/web/[token]-3c722cbf6e54dbbeb30a3a3ee3ece670.js @@ -0,0 +1,2 @@ +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return u}});var t=r(d[0]);r(d[1]);var n=r(d[2]),o=r(d[3]),c=r(d[4]),s=r(d[5]),l=r(d[6]);function u(){const{token:u}=(0,t.useLocalSearchParams)(),h=(0,c.cleanToken)(u);return h?(0,s.guestServer)()?(0,l.jsx)(o.TableOrderLive,{token:h}):(0,l.jsx)(n.Screen,{title:"Order at the table",children:(0,l.jsx)(n.Banner,{kind:"demo",title:"Not connected",children:"This preview isn't connected to a venue, so table orders can't be sent from here."})}):(0,l.jsx)(n.Screen,{title:"Order at the table",children:(0,l.jsx)(n.Banner,{kind:"warn",title:"This code isn't working",children:"Please scan the QR code on your table again, or ask a member of staff."})})}},795,[804,30,813,872,873,836,24]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TableOrderLive=function({token:e}){const[s,b]=(0,n.useState)(null),[m,f]=(0,n.useState)(null),[j,y]=(0,n.useState)([]),[k,w]=(0,n.useState)(null),T=(0,h.useCustomer)(),[C,S]=(0,n.useState)(()=>(T?.allergies??[]).map(e=>e.allergen)),[v,P]=(0,n.useState)(''),[O,N]=(0,n.useState)(''),[B,I]=(0,n.useState)(!1),[L,M]=(0,n.useState)(null),[R,$]=(0,n.useState)([]),A=(0,n.useCallback)(async()=>{try{b(await(0,c.tablePublic)(e)),f(null)}catch(e){f(e?.message??'Could not load the menu.')}},[e]),D=(0,n.useCallback)(async()=>{try{$(await(0,c.myTableOrders)(e))}catch{}},[e]);(0,n.useEffect)(()=>{A(),D();const e=setInterval(()=>{D(),A()},8e3);return()=>clearInterval(e)},[A,D]);const _=s?.menu??[];(0,n.useEffect)(()=>{y(e=>e.filter(e=>_.some(t=>t.id===e.id&&!t.soldOut)))},[s]);const q=(0,n.useMemo)(()=>{const e=new Map;for(const t of _)e.set(t.section,[...e.get(t.section)??[],t]);return[...e.entries()]},[s]),Y=(0,d.cartTotal)(j,_),W='yes'===k?C.map(e=>({allergen:e,severity:T?.allergies?.find(t=>t.allergen===e)?.severity??'allergy'})):[],E=(0,d.allergyClashes)(j,_,W.map(e=>e.allergen)),z=e=>j.find(t=>t.id===e)?.qty??0,G=(e,t)=>y(l=>t<=0?l.filter(t=>t.id!==e):l.some(t=>t.id===e)?l.map(l=>l.id===e?{...l,qty:t}:l):[...l,{id:e,qty:t,note:''}]),H=(e,t)=>y(l=>l.map(l=>l.id===e?{...l,note:t}:l)),V=async()=>{I(!0),M(null);try{const t=await(0,c.sendTableOrder)(e,j,{note:O,name:v,allergies:W});y([]),N(''),M({kind:'success',text:t.held?`Order ${t.ref} sent. A member of staff will check it, then it goes to the kitchen.`:`Order ${t.ref} sent to the kitchen.`}),D()}catch(e){M({kind:'warn',text:e?.message??'The order was not sent. Please try again or ask a member of staff.'}),A()}finally{I(!1)}};if(m)return(0,x.jsxs)(r.Screen,{title:"Order at the table",children:[(0,x.jsx)(r.Banner,{kind:"warn",title:"Couldn't open the menu",children:m}),(0,x.jsx)(r.Button,{label:"Try again",onPress:()=>{A()}})]});if(!s)return(0,x.jsx)(r.Screen,{title:"Order at the table",children:(0,x.jsx)(r.Muted,{children:"Opening the menu\u2026"})});if(!s.ok)return(0,x.jsx)(r.Screen,{title:"Order at the table",children:(0,x.jsx)(r.Banner,{kind:"warn",title:"This code isn't working",children:s.reason??'Please ask a member of staff.'})});const F=s.open&&j.length>0&&null!==k&&('none'===k||C.length>0)&&!B;return(0,x.jsxs)(r.Screen,{title:`${(0,l.tableNumbers)(s.table)}`,subtitle:s.venueName,footer:s.open?(0,x.jsx)(r.Button,{label:B?'Sending\u2026':j.length?`Send order to the kitchen (${(0,o.gbp)(Y)})`:'Add a dish to order',disabled:!F,onPress:()=>{V()},testID:"send-table-order-live"}):void 0,children:[(0,x.jsxs)(r.Muted,{children:["Tip: add dishes, answer the allergy question, then send. Staff bring it to ",(0,l.tableNumbers)(s.table),". ",d.PAY_WORDS]}),s.tip?(0,x.jsx)(r.Banner,{kind:"demo",children:s.tip}):null,s.open?null:(0,x.jsx)(r.Banner,{kind:"warn",title:"Not taking table orders right now",children:s.reason}),s.open&&s.staffAccept&&!R.some(e=>e.accepted)?(0,x.jsx)(r.Muted,{children:"The first order from your phone is checked by a member of staff before it goes to the kitchen."}):null,L?(0,x.jsx)(r.Banner,{kind:L.kind,children:L.text}):null,R.length?(0,x.jsx)(a.default,{testID:"my-table-orders",children:(0,x.jsxs)(r.Card,{children:[(0,x.jsx)(r.T,{weight:"semibold",children:"Your orders at this table"}),R.map(e=>(0,x.jsxs)(a.default,{style:{gap:2,paddingVertical:4},children:[(0,x.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(r.T,{children:e.ref}),(0,x.jsx)(r.T,{size:13,colour:'cancelled'===e.status?u.colours.amber:u.colours.gold,children:(0,d.guestStatusWords)(e)})]}),(0,x.jsxs)(r.Muted,{children:[e.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')," \xb7 ",(0,o.gbp)(e.totalPence)," to pay at the bar or till"]})]},e.id))]})}):null,s.open?q.map(([e,t])=>(0,x.jsxs)(a.default,{style:{gap:8},children:[(0,x.jsx)(r.H2,{children:e}),t.map(e=>(0,x.jsxs)(r.Card,{children:[(0,x.jsxs)(r.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,x.jsxs)(a.default,{style:{flex:1,gap:2},children:[(0,x.jsx)(r.T,{weight:"semibold",children:e.name}),e.description?(0,x.jsx)(r.Muted,{children:e.description}):null,(0,x.jsxs)(r.T,{size:13,colour:u.colours.muted,children:[e.allergens.length?`Contains: ${e.allergens.map(i.allergenLabel).join(', ')}`:'No allergens listed: ask staff if unsure',e.mayContain.length?` \xb7 May contain: ${e.mayContain.map(i.allergenLabel).join(', ')}`:'']})]}),(0,x.jsx)(r.T,{weight:"semibold",colour:u.colours.gold,children:(0,o.gbp)(e.pricePence)})]}),e.soldOut?(0,x.jsx)(r.Badge,{kind:"amber",label:"Sold out today"}):z(e.id)?(0,x.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(r.Stepper,{value:z(e.id),min:0,max:20,onChange:t=>G(e.id,t),label:e.name}),(0,x.jsx)(r.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>G(e.id,0)})]}):(0,x.jsx)(r.Button,{small:!0,kind:"secondary",label:"Add",accessibilityLabel:`Add ${e.name}`,onPress:()=>G(e.id,1)})]},e.id))]},e)):null,s.open&&!_.length?(0,x.jsx)(r.Banner,{kind:"demo",title:"No dishes to order yet",children:"The venue hasn't put any priced dishes on the table menu yet. Please order at the bar."}):null,s.open&&j.length?(0,x.jsx)(a.default,{testID:"table-cart",children:(0,x.jsxs)(r.Card,{children:[(0,x.jsx)(r.T,{weight:"semibold",children:"Your order"}),j.map(e=>{const l=_.find(t=>t.id===e.id);return(0,x.jsxs)(a.default,{style:{gap:4},children:[(0,x.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsxs)(r.T,{children:[e.qty,"\xd7 ",l?.name]}),(0,x.jsx)(r.T,{children:(0,o.gbp)(e.qty*(l?.pricePence??0))})]}),(0,x.jsx)(t.TextInput,{style:p,value:e.note,onChangeText:t=>H(e.id,t),placeholder:"Note for the kitchen (optional), e.g. no onions",placeholderTextColor:u.colours.muted,maxLength:140,accessibilityLabel:`Note for ${l?.name}`,testID:`table-note-${e.id}`})]},e.id)}),(0,x.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(r.T,{weight:"semibold",children:"Total"}),(0,x.jsx)(r.T,{weight:"semibold",children:(0,o.gbp)(Y)})]})]})}):null,s.open?(0,x.jsx)(a.default,{testID:"table-allergy",children:(0,x.jsxs)(r.Card,{children:[(0,x.jsx)(r.T,{weight:"semibold",children:"Does anyone at the table have a food allergy?"}),(0,x.jsx)(r.Muted,{children:"We ask everyone, so the kitchen can keep you safe."}),(0,x.jsxs)(r.Row,{gap:8,children:[(0,x.jsx)(r.Chip,{label:"No allergies",selected:'none'===k,onPress:()=>w('none')}),(0,x.jsx)(r.Chip,{label:"Yes, allergies",selected:'yes'===k,onPress:()=>w('yes')})]}),'yes'===k?(0,x.jsx)(r.Row,{wrap:!0,gap:6,children:i.ALLERGENS.map(e=>(0,x.jsx)(r.Chip,{label:e.short,selected:C.includes(e.id),onPress:()=>S(t=>t.includes(e.id)?t.filter(t=>t!==e.id):[...t,e.id])},e.id))}):null,E.length?(0,x.jsxs)(r.Banner,{kind:"warn",title:"Check with staff",children:[E.map(e=>e.name).join(', ')," ",E.length>1?'contain':'contains'," or may contain an allergy you picked. The kitchen will see your allergies on the ticket."]}):null]})}):null,s.open?(0,x.jsxs)(r.Card,{children:[(0,x.jsx)(r.T,{weight:"semibold",children:"Anything else?"}),(0,x.jsx)(t.TextInput,{style:p,value:v,onChangeText:P,placeholder:"Your first name (optional)",placeholderTextColor:u.colours.muted,maxLength:40,accessibilityLabel:"Your first name (optional)"}),(0,x.jsx)(t.TextInput,{style:p,value:O,onChangeText:N,placeholder:"Note for the staff (optional)",placeholderTextColor:u.colours.muted,maxLength:300,accessibilityLabel:"Note for the staff (optional)"})]}):null,(0,x.jsx)(a.default,{testID:"pay-placeholder",children:(0,x.jsxs)(r.Card,{children:[(0,x.jsx)(r.T,{weight:"semibold",children:"Paying"}),(0,x.jsx)(r.T,{children:d.PAY_WORDS}),(0,x.jsx)(r.Muted,{children:"No card details are asked for or kept in this app."})]})})]})};var e,t=_r(_d[0]),l=_r(_d[1]),n=_r(_d[2]),s=_r(_d[3]),a=(e=s)&&e.__esModule?e:{default:e},r=_r(_d[4]),i=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),x=_r(_d[11]);const p={borderWidth:1,borderColor:u.colours.border,borderRadius:10,padding:10,color:u.colours.text,backgroundColor:u.colours.surface2}},872,[874,808,30,127,813,814,816,873,875,819,821,24]); \ No newline at end of file diff --git a/wildings/owner-app/_expo/static/js/web/__common-e34bda0c77453cf83fbff6f618cb9cc0.js b/wildings/owner-app/_expo/static/js/web/__common-e34bda0c77453cf83fbff6f618cb9cc0.js new file mode 100644 index 0000000000000000000000000000000000000000..4845b9dd3ab1c362428e4ce1053f0297c9ca0003 --- /dev/null +++ b/wildings/owner-app/_expo/static/js/web/__common-e34bda0c77453cf83fbff6f618cb9cc0.js @@ -0,0 +1,547 @@ +__d(function(g,r,i,a,m,e,d){"use strict";function t(t,n){return Object.keys(t).forEach(function(c){"default"===c||Object.prototype.hasOwnProperty.call(n,c)||Object.defineProperty(n,c,{enumerable:!0,get:function(){return t[c]}})}),t}Object.defineProperty(e,"__esModule",{value:!0}),r(d[0]),t(r(d[1]),e),t(r(d[2]),e),t(r(d[3]),e),t(r(d[4]),e)},804,[1224,1225,1235,1236,1238]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ChefApp=function({section:e}={}){const{r:s,rid:t,me:i,now:$}=(0,G.useChef)(3e4),_=(0,W.useSignedIn)(),K=_?.id??G.CHEF_ID;(0,o.useSoldOutLink)(!0,(_?.name??i).replace(' (example)',''));const V=e?me[e]:void 0,[ue,je]=(0,P.useState)(V?.tab??'home'),[we,Ce]=(0,P.useState)(V?.k??null),[Te,ve]=(0,P.useState)(V?.stock??'levels'),[Se,Pe]=(0,P.useState)(void 0),[Ie,Re]=(0,P.useState)(V?.gp??'dishes'),Be=(0,P.useRef)(null),He=(0,f.ymd)($),Ae=(0,f.ymd)(new Date($.getTime()+864e5));(0,u.useTipsPosted)(t,He);const Oe=(0,Q.useTravelDay)('chef',He),De='home'===ue&&!Oe;(0,v.useKitchenTodoChime)(t,He,()=>Fe('kitchen','bookings')),(0,de.useAlertWatcher)(t,{kinds:['takeaway']}),(0,P.useEffect)(()=>{(0,W.ensureAttendance)((new Date).toISOString().slice(0,10),$)},[]);const Le=(0,P.useRef)({t:'home',k:null});Le.current={t:ue,k:we};const Ee=(0,P.useRef)([]),$e=(0,n.useScrollMemory)(Be),Fe=(0,P.useCallback)((e,s=null)=>{const t=Le.current;t.t===e&&t.k===s||(Ee.current=[...Ee.current,{...t,y:$e.leave()}].slice(-30),$e.restore(0)),je(e),Ce(s)},[]),We=(0,P.useCallback)(()=>{if((0,l.runBackLayer)())return!0;const e=Le.current;let s=Ee.current.pop();for(;s&&s.t===e.t&&s.k===e.k;)s=Ee.current.pop();if(!s&&'home'===e.t&&!e.k)return!1;const t=s??{t:'home',k:null};return $e.leave(),je(t.t),Ce(t.k),$e.restore(t.y??0),!0},[]);(0,l.useWebBack)(We);const Ge=(0,l.useInnerBackShown)();(0,P.useEffect)(()=>{d.PITCH&&(globalThis.__pitchGo=(e,s=null,t)=>{'stock'===e&&t&&ve(t),'gp'===e&&t&&Re(t),Fe(e,s)})},[Fe]),(0,p.useShiftReminders)({rid:t,staffId:K,name:i,kitchen:!0}),(0,C.useScheduledNotices)({rid:t,staffId:_?.id??'',name:i,onOpen:()=>Fe('kitchen','orderlists')}),(0,T.useOffRotaPrompt)({rid:t,staffId:_?.id??''}),(0,P.useEffect)(()=>{const e=I.default.addEventListener('hardwareBackPress',We);return()=>e.remove()},[We]);const Me=we?ye.find(e=>e.id===we):null,Ne=(0,H.default)().width<430,ze=Me?Me.title:{home:'Today in the kitchen',stock:'Stock',gp:'GP & costing',creator:ie.CREATOR_TITLE,orders:'Ordering',kitchen:'Kitchen'}[ue];return(0,be.jsxs)(O.SafeAreaView,{style:{flex:1,backgroundColor:F.colours.bg},edges:['top','bottom'],children:[(0,be.jsxs)(A.default,{style:{paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:F.colours.border,gap:6},children:[(0,be.jsx)(A.default,{style:{alignItems:'center'},children:(0,be.jsx)(A.default,{testID:"header-me",accessibilityLabel:`Signed in as ${i.replace(' (example)','')}, Head Chef`,style:{borderWidth:1,borderColor:F.colours.gold,borderRadius:16,paddingHorizontal:10,paddingVertical:4,maxWidth:'86%'},children:(0,be.jsxs)(E.Row,{gap:6,children:[(0,be.jsx)(se.StaffAvatar,{id:G.CHEF_ID,size:24,ring:!1}),(0,be.jsxs)(E.T,{size:13,weight:"semibold",colour:F.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[i.replace(' (example)','')," \xb7 Head Chef"]})]})})}),(0,be.jsxs)(E.Row,{gap:10,children:[(0,be.jsx)(D.RestaurantLogo,{rid:t,size:Ne?36:44}),(0,be.jsxs)(A.default,{style:{flex:1,minWidth:0},children:[(0,be.jsxs)(E.Row,{gap:6,children:[(0,be.jsx)(E.T,{weight:"semibold",size:Ne?15:17,numberOfLines:1,style:{flexShrink:1},children:s.name}),(0,be.jsx)(w.AppBadge,{label:"CHEF"})]}),(0,be.jsx)(E.T,{size:12,colour:F.colours.muted,numberOfLines:1,children:"Head Chef app"}),(0,be.jsx)(D.PoweredBy,{})]}),(0,be.jsx)(R.default,{accessibilityRole:"button",accessibilityLabel:"Open CoverCharge for Staff",onPress:()=>{const e=(0,te.appUrl)('staff');e&&window.location.assign(e)},style:{borderWidth:1,borderColor:F.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:3,minHeight:44,justifyContent:'center'},children:(0,be.jsx)(E.T,{size:13,colour:F.colours.gold,children:"Staff app \u203a"})}),(0,be.jsx)(L.VoiceSlot,{})]})]}),(0,be.jsxs)(B.default,{ref:Be,...$e.props,contentContainerStyle:{padding:14,paddingBottom:60,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:[(0,be.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:['home'===ue&&!we||Ge?null:(0,be.jsx)(l.BackButton,{onPress:We}),(0,be.jsx)(E.T,{size:22,weight:"bold",style:{flex:1,textAlign:'home'===ue&&!we||Ge?'left':'right'},children:ze})]}),'home'===ue?(0,be.jsx)(Q.DayBar,{app:"chef",today:He}):null,'home'===ue&&Oe?(0,be.jsx)(Q.DayView,{rid:t,day:Oe,today:He,app:"chef"}):null,'home'===ue?(0,be.jsx)(ee.WhoBar,{}):null,De&&_?(0,be.jsx)(h.MyTasksToday,{rid:t,staffId:_.id,name:_.name,onShift:(0,p.shiftNow)(_.id,$.getTime()).on}):null,De?(0,be.jsx)(u.TodaysTipsCard,{rid:t,today:He}):null,De?(0,be.jsx)(u.TipsPotCard,{rid:t,today:He}):null,De?(0,be.jsx)(b.CoversToday,{rid:t,onPress:()=>Fe('kitchen','bookings')}):null,De?(0,be.jsx)(k.LastFoodBanner,{rid:t,now:$}):null,De?(0,be.jsx)(y.NextTableFreeCard,{rid:t,now:$}):null,De?(0,be.jsx)(x.KitchenSignoffs,{rid:t,today:He,by:i,app:"chef"}):null,De?(0,be.jsxs)(A.default,{style:{gap:4},children:[(0,be.jsx)(x.PlattersBooked,{rid:t,date:He,label:"Platters booked today"}),(0,be.jsx)(x.PlattersBooked,{rid:t,date:Ae,label:"Platters booked tomorrow"})]}):null,De?(0,be.jsx)(pe.ChefAssistantButton,{}):null,De?(0,be.jsx)(xe,{go:(e,s)=>{'stock'===e&&s&&ve(s),'gp'===e&&s&&Re(s),'orders'===e&&Pe(s),Fe(e,'kitchen'===e?s??null:null)}}):null,'stock'===ue?(0,be.jsx)(U.StockScreen,{initial:Te},Te):null,'gp'===ue?(0,be.jsx)(M.GpScreen,{initial:Ie},Ie):null,'creator'===ue?(0,be.jsx)(ie.DishCreator,{rid:t,canPublish:!1}):null,'orders'===ue?(0,be.jsx)(z.OrdersScreen,{focus:Se},Se??'all'):null,'kitchen'!==ue||Me?null:(0,be.jsxs)(A.default,{style:{gap:10},children:[(0,be.jsx)(A.default,{style:{borderRadius:14,borderWidth:1,borderColor:F.colours.border,backgroundColor:F.colours.surface,overflow:'hidden'},children:ye.map((e,s)=>(0,be.jsx)(R.default,{accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>Fe(ue,e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:F.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,be.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,be.jsxs)(A.default,{style:{flex:1},children:[(0,be.jsx)(E.T,{weight:"medium",children:e.title}),(0,be.jsx)(E.Muted,{children:e.sub})]}),(0,be.jsx)(E.T,{colour:F.colours.muted,children:"\u203a"})]})},e.id))}),(0,be.jsx)(E.Muted,{children:"Head Chef sees kitchen, stock, food costs and GP. Payroll, wages and the restaurant's billing stay in CoverCharge for Managers."}),(0,be.jsxs)(E.Muted,{center:!0,children:["Head Chef app \xb7 ",r.APP_VERSION," \xb7 ",'live'===ge.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),'myshift'===we&&K?(0,be.jsxs)(A.default,{style:{gap:10},testID:"chef-myshift",children:[(0,be.jsx)(X.ClockInOut,{}),(0,be.jsx)(Z.MyUpcomingShifts,{staffId:K})]}):null,'mypay'===we?(0,be.jsxs)(A.default,{style:{gap:10},testID:"chef-mypay",children:[(0,be.jsx)(Y.MyPeriods,{staffId:K}),(0,be.jsx)(q.MyHoursPay,{staffId:K}),(0,be.jsx)(J.MyTips,{staffId:K}),(0,be.jsxs)(E.Card,{children:[(0,be.jsx)(E.T,{weight:"semibold",children:"Phone notifications"}),(0,be.jsx)(E.Muted,{children:"Get reminders like \u201cMills milk order\u201d on this phone, even with the app closed (once your manager switches phone notifications on). iPhone: add the app to your Home Screen first (iOS 16.4 or later)."}),(0,be.jsx)(c.PushButton,{})]})]}):null,'bookings'===we?(0,be.jsx)(S.TodaysBookings,{rid:t,today:He,by:i,app:"chef"}):null,'specials'===we?(0,be.jsx)(le.SpecialsEditor,{rid:t,me:i,app:"chef",now:$}):null,'prep'===we?(0,be.jsx)(N.PrepScreen,{}):null,'live'===we?(0,be.jsx)(N.TeamScreen,{}):null,'waste'===we?(0,be.jsx)(N.WasteScreen,{}):null,'recipes'===we?(0,be.jsx)(ce.RecipeCards,{rid:t,actor:{name:i,role:'head-chef'},mode:"edit"}):null,'allergens'===we?(0,be.jsx)(N.AllergenScreen,{openCards:()=>Fe('kitchen','recipes')}):null,'compliance'===we?(0,be.jsx)(N.ComplianceScreen,{}):null,'takings'===we?(0,be.jsx)(u.CashUpScreen,{rid:t,today:He,canEdit:!1,chartsOnly:!0,who:{id:K,name:i.replace(' (example)','')}}):null,'board'===we?(0,be.jsx)(he.QuestionBoard,{rid:t,today:He,manager:!1,by:""}):null,'teamtasks'===we?(0,be.jsx)(h.KitchenTeamTasks,{rid:t,actor:_}):null,'orderlists'===we?(0,be.jsx)(j.OrderListsScreen,{rid:t,today:He,editor:!0,who:{id:K,name:i.replace(' (example)','')}}):null,'foodsafety'===we?(0,be.jsx)(c.FoodSafetyCard,{children:(0,be.jsx)(R.default,{accessibilityRole:"button",onPress:()=>Fe('kitchen','haccp'),children:(0,be.jsx)(E.T,{colour:F.colours.gold,children:"Today\u2019s temperature log \u203a"})})}):null,'haccp'===we?(0,be.jsx)(ne.HaccpLog,{mode:"chef",me:i,meId:G.CHEF_ID,now:$}):null,'accidents'===we?(0,be.jsx)(oe.AccidentBook,{app:"chef",me:i,meId:G.CHEF_ID,now:$,seeAll:!1}):null]}),(0,be.jsx)(A.default,{accessibilityRole:"tablist",style:{flexDirection:'row',borderTopWidth:1,borderColor:F.colours.border,backgroundColor:F.colours.surface},children:ke.map(e=>{const s=ue===e.id;return(0,be.jsxs)(R.default,{accessibilityRole:"tab",accessibilityState:{selected:s},accessibilityLabel:e.label,onPress:()=>Fe(e.id),style:{flex:1,alignItems:'center',paddingVertical:8,paddingHorizontal:2,minHeight:52,gap:2},children:[(0,be.jsx)(fe.Icon,{name:e.icon,colour:s?F.colours.gold:F.colours.muted}),(0,be.jsx)(E.T,{size:e.label.length>10?10:11,weight:s?'semibold':'regular',colour:s?F.colours.gold:F.colours.muted,center:!0,children:e.label})]},e.id)})}),(0,be.jsx)(pe.ChefAssistantSheet,{go:(e,s)=>{'orders'===e?(Pe(s),Fe('orders')):'gp'===e?Fe('gp'):Fe('kitchen',e)}}),(0,be.jsx)(re.AlertHost,{variant:"chef",rid:t,skipTakeaway:!0}),(0,be.jsx)(ae.KitchenFlash,{rid:t,me:i})]})};var s=_r(_d[0]),t=_r(_d[1]),o=_r(_d[2]),i=_r(_d[3]),n=_r(_d[4]),l=_r(_d[5]),r=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]),f=_r(_d[12]),b=_r(_d[13]),k=_r(_d[14]),y=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),w=_r(_d[18]),C=_r(_d[19]),T=_r(_d[20]),v=_r(_d[21]),S=_r(_d[22]),P=_r(_d[23]),I=e(_r(_d[24]));_r(_d[25]);var R=e(_r(_d[26])),B=e(_r(_d[27])),H=e(_r(_d[28])),A=e(_r(_d[29])),O=_r(_d[30]),D=_r(_d[31]),L=_r(_d[32]),E=_r(_d[33]),$=_r(_d[34]),F=_r(_d[35]),W=_r(_d[36]),_=_r(_d[37]),G=_r(_d[38]),M=_r(_d[39]),N=_r(_d[40]),z=_r(_d[41]),K=_r(_d[42]),V=_r(_d[43]),U=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),Y=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),se=_r(_d[52]),te=_r(_d[53]),oe=_r(_d[54]),ie=_r(_d[55]),ne=_r(_d[56]),le=_r(_d[57]),re=_r(_d[58]),ae=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),he=_r(_d[62]),ue=_r(_d[63]),pe=_r(_d[64]),ge=_r(_d[65]),fe=_r(_d[66]),be=_r(_d[67]);s.LIVE_HEAD_CHEF&&(0,t.requireRealData)();const ke=[{id:'home',label:'Home',icon:'home'},{id:'stock',label:'Stock',icon:'box'},{id:'gp',label:'GP',icon:'forecast'},{id:'creator',label:ie.CREATOR_TITLE,icon:'sparkle'},{id:'orders',label:'Orders',icon:'orders'},{id:'kitchen',label:'Kitchen',icon:'platter'}],ye=[{id:'myshift',title:'My shifts & clock in',sub:'Clock in and out (checks you are at the venue), breaks, and your shifts on the rota'},{id:'mypay',title:'My pay & tips',sub:'Your hours, tips share, tip goal, paydays and payslip info. Only you see this'},{id:'takings',title:'Takings & tips graphs',sub:'Daily cash ups, weekly sales, this week vs last, categories and the Tips pot (view only)'},{id:'bookings',title:'Today\u2019s bookings',sub:'Covers, allergens to sign off, platters and other reservations, dogs, access and vegan/vegetarian'},{id:'recipes',title:'Recipe cards',sub:'Plating photo, ingredients, method, allergens, section and price; you sign each card off before it goes live'},{id:'specials',title:'Specials board',sub:'Photo of the chalkboard or typed specials with allergens; shown in the customer app'},{id:'board',title:'Question board',sub:'Ask the team anything anonymously, and vote'},{id:'teamtasks',title:'Kitchen team tasks',sub:'Daily tasks for your chefs, commis and KPs'},{id:'orderlists',title:'Order lists',sub:'Alsons drinks, Cash and carry: add items, tick on the day, finish and carry over'},{id:'foodsafety',title:'Food safety (CookSafe)',sub:'Based on CookSafe (Food Standards Scotland). Full logs coming in the next update'},{id:'haccp',title:'Food safety log (HACCP)',sub:'Temperatures, cleaning and allergen checks; voice entry; limits; EHO export'},{id:'accidents',title:'Accident book',sub:'Accidents and near misses; you see your own entries'},{id:'prep',title:'Prep list',sub:'From the forecast and bookings, tick off as you go'},{id:'live',title:'Live tickets, sold out, team & chat',sub:'Orders, readiness alerts, sold out, who\u2019s on, rota, team chat and private messages'},{id:'waste',title:'Waste log',sub:'Item, quantity, reason and cost; weekly total and % of sales'},{id:'allergens',title:'Allergens',sub:'14-allergen matrix from the recipe cards, costing cross-check and audit log'},{id:'compliance',title:'Kitchen compliance',sub:'Fridge, freezer, cooking and cooling temps; cleaning; daily checks'}],me={stock:{tab:'stock',stock:'levels'},'stock-take':{tab:'stock',stock:'take'},deliveries:{tab:'stock',stock:'deliveries'},gp:{tab:'gp',gp:'dishes'},'price-changes':{tab:'gp',gp:'changes'},'gp-week':{tab:'gp',gp:'week'},'menu-engineering':{tab:'gp',gp:'engineering'},orders:{tab:'orders'},prep:{tab:'kitchen',k:'prep'},live:{tab:'kitchen',k:'live'},waste:{tab:'kitchen',k:'waste'},recipes:{tab:'kitchen',k:'recipes'},'recipe-cards':{tab:'kitchen',k:'recipes'},allergens:{tab:'kitchen',k:'allergens'},compliance:{tab:'kitchen',k:'compliance'},haccp:{tab:'kitchen',k:'haccp'},specials:{tab:'kitchen',k:'specials'},accidents:{tab:'kitchen',k:'accidents'},'new-dish':{tab:'creator'}};function xe({go:e}){const{k:s,c:t,menu:o,now:n,rid:l,me:r}=(0,G.useChef)(3e4),d=(0,K.useSheetReminders)(),c=(0,G.useWeek)(),{covers:h,label:u,enough:p,booked:f}=(0,G.useForecast)(),b=(0,z.useSuggestions)(),k=s.ingredients.filter(e=>e.onHand<=0||(0,G.isLow)(e.onHand,e.par)),y=b.filter(e=>e.ordersToday&&!e.placedToday),x=(0,_.priceImpacts)(o,s.recipes,s.ingredients,s.targetGp).filter(e=>e.dropped.length),j=s.deliveries.filter(e=>'expected'===e.status),w=!s.recipes.length||!s.ingredients.length,C=w?[]:t.filter(e=>e.below),T=(0,i.useLiveState)(),v=(0,ue.useRecipeCards)(l).filter(e=>!e.signOff);return(0,be.jsxs)(A.default,{style:{gap:12},testID:"chef-dashboard",children:[(0,be.jsx)(ne.MissedBanner,{mode:"chef",now:n,onPress:()=>e('kitchen','haccp')}),d.map(s=>(0,be.jsx)(R.default,{accessibilityRole:"button",onPress:()=>e('orders',s.supplierId),children:(0,be.jsxs)(E.Banner,{kind:'red'===s.tone?'danger':'warn',title:`\u23f0 ${s.text}`,children:["Tap to open the ",s.name," order sheet. Nothing is sent until you press Send."]})},s.supplierId)),v.length?(0,be.jsx)(R.default,{testID:"cards-awaiting",accessibilityRole:"button",onPress:()=>e('kitchen','recipes'),children:(0,be.jsxs)(E.Banner,{kind:"warn",title:`${v.length} recipe card${1===v.length?'':'s'} awaiting your sign-off`,children:[v.slice(0,4).map(e=>e.dish).join(', '),". Guests see \"awaiting allergen sign-off\" and cannot order these until you sign them off."]})}):null,(0,be.jsx)(V.ShellfishTile,{rid:l,by:r,app:"chef",onOrder:()=>e('orders','os-kittyfisher')}),(0,be.jsxs)(E.Row,{wrap:!0,gap:10,children:[w?(0,be.jsx)(G.Tile,{testID:"tile-gp",label:"GP this week vs target",value:"Nothing yet",sub:"Add ingredients and recipe costs to see GP",onPress:()=>e('gp','week')}):(0,be.jsx)(G.Tile,{testID:"tile-gp",label:"GP this week vs target",value:(0,G.pct1)(c.theo),sub:`Target ${s.targetGp}% \xb7 actual ${(0,G.pct1)(c.actual)}`,tone:c.theoe('gp','week')}),(0,be.jsx)(G.Tile,{testID:"tile-stock",label:"Stock value",value:s.ingredients.length?(0,$.gbp)((0,G.stockValue)(s.ingredients)):'Nothing yet',sub:s.ingredients.length?'At cost':'No stock counted yet',onPress:()=>e('stock','levels')}),(0,be.jsx)(G.Tile,{label:"Items low or out",value:s.ingredients.length?`${k.length}`:'Nothing yet',sub:s.ingredients.length?k.slice(0,3).map(e=>e.name).join(', '):'No stock counted yet',tone:k.some(e=>e.onHand<=0)?'red':k.length?'amber':'ok',onPress:()=>e('stock','levels')}),(0,be.jsx)(G.Tile,{label:"Waste this week",value:s.waste.length?(0,$.gbp)(c.wasteWeek):'Nothing yet',sub:c.sales?`${(0,G.pct1)(c.wasteWeek/c.sales*100)} of food sales`:'',onPress:()=>e('kitchen','waste')}),p?(0,be.jsx)(G.Tile,{label:"Covers forecast today",value:`${h}`,sub:u,onPress:()=>e('kitchen','prep')}):(0,be.jsx)(G.Tile,{label:"Booked so far today",value:'ready'===T?`${f}`:'connecting'===T?'Connecting\u2026':'Not connected',sub:"Not enough history for a forecast yet",onPress:()=>e('kitchen','prep')}),(0,be.jsx)(G.Tile,{label:"Orders due today",value:`${y.length}`,sub:y.map(e=>`${e.s.name} by ${e.s.cutoff}`).join(' \xb7 ')||'None',tone:y.some(e=>e.cutPassed)?'red':y.length?'amber':'ok',onPress:()=>e('orders')})]}),x.map(e=>(0,be.jsxs)(E.Banner,{kind:"danger",title:`${e.ing.name} ${e.pct>0?'+':''}${e.pct.toFixed(0)}%: ${e.dropped.length} dish${1===e.dropped.length?'':'es'} drop below target`,children:[e.dropped.map(e=>e.item.name).join(', '),". Open GP \u203a Price changes."]},e.ing.id)),j.length?(0,be.jsx)(R.default,{accessibilityRole:"button",onPress:()=>e('stock','deliveries'),children:(0,be.jsx)(E.Banner,{kind:"info",title:`${j.length} deliver${1===j.length?'y':'ies'} to check in today`,children:"Count in against the order, flag shorts and price changes."})}):null,C.length?(0,be.jsx)(R.default,{accessibilityRole:"button",onPress:()=>e('gp','dishes'),children:(0,be.jsxs)(E.Banner,{kind:"warn",title:`${C.length} dishes below ${s.targetGp}% GP`,children:[C.slice(0,4).map(e=>e.item.name).join(', '),C.length>4?'\u2026':'']})}):null,(0,be.jsx)(E.Row,{wrap:!0,gap:8,children:[['Recipe cards','recipes'],['Food safety log','haccp'],['Specials board','specials'],[ie.CREATOR_TITLE,'creator'],['Prep list','prep'],['Live tickets & sold out','live'],['Allergens','allergens'],['Accident book','accidents']].map(([s,t])=>(0,be.jsx)(R.default,{accessibilityRole:"button",accessibilityLabel:s,onPress:()=>'creator'===t?e('creator'):e('kitchen',t),style:{flexGrow:1,flexBasis:140,padding:12,borderRadius:12,borderWidth:1.5,borderColor:F.colours.gold,backgroundColor:F.colours.surface},children:(0,be.jsxs)(E.T,{weight:"semibold",children:[s," \u203a"]})},t))}),(0,be.jsx)(E.Badge,{kind:"neutral",label:"Nothing is ordered or sent from here"})]})}},805,[1245,1053,946,1246,945,947,1011,2,996,948,949,950,818,971,973,974,976,1034,970,967,968,951,1309,30,233,122,263,151,287,127,289,860,962,813,816,821,954,1320,1321,1322,1323,1350,1351,1352,1354,1032,972,988,1031,1030,969,944,955,858,1054,1055,1056,1057,963,1371,965,1048,992,819,1373,820,959,24]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"APP_VARIANT",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"ENTRY",{enumerable:!0,get:function(){return s}}),_e.isAllowedPath=function(e,n=c){return!(t.IS_ISOLATED_VENUE&&/^\/(customer|table)(\/|$)/.test(e)&&![`/customer/${t.VENUE_RID}`,`/customer/${t.VENUE_RID}/`].includes(e))&&('/'===e||''===e||f[n].test(e))},_e.canShow=function(e,t=c){return t===e||'owner'===t&&'customer'===e};var e,t=r(d[0]),n=r(d[1]),o=(e=n)&&e.__esModule?e:{default:e};const u=o.default.expoConfig?.extra?.appVariant??void 0??'owner',c=['owner','staff','customer','display','chef'].includes(u)?u:'owner',s={owner:'/owner',staff:'/team',customer:`/customer/${t.VENUE_RID}`,display:'/display',chef:'/kitchen'},f={owner:/^\/(owner|customer|table)(\/|$)/,customer:/^\/(customer|table)(\/|$)/,staff:/^\/team(\/|$)/,display:/^\/display(\/|$)/,chef:/^\/kitchen(\/|$)/}},806,[5,408]); +__d(function(g,r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"PERMISSIONS",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"can",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"CHEF_SECTIONS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"chefSectionAllowed",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"rotaView",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"chatView",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"ticketView",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"supplierView",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"auditView",{enumerable:!0,get:function(){return p}});const e={owner:'all',manager:'all',staff:new Set(['rota-shifts','tickets','eighty-six','allergens']),chef:new Set(['stock','costing','gp','waste','dish-sales','prep','ordering','allergens','compliance','rota-shifts','kitchen-chat','tickets','eighty-six','specials'])},t=(t,n)=>{const a=e[t];return'all'===a||a.has(n)},n={stock:'stock','stock-take':'stock',deliveries:'stock',gp:'gp','price-changes':'gp','gp-week':'gp','menu-engineering':'dish-sales',orders:'ordering',prep:'prep',live:'tickets',waste:'waste',allergens:'allergens',compliance:'compliance',haccp:'compliance',accidents:'compliance','new-dish':'gp',specials:'specials',recipes:'allergens','recipe-cards':'allergens'},a=e=>e in n&&t('chef',n[e]),s=(e,n,a)=>t(e,'staff-personal')?{staff:n,shifts:a}:{staff:n.filter(e=>e.active).map(e=>({id:e.id,name:e.name,...e.nickname?{nickname:e.nickname}:{},job:e.job})),shifts:a.filter(e=>e.published).map(({id:e,staffId:t,date:n,day:a,start:s,end:c,published:l})=>({id:e,staffId:t,date:n,day:a,start:s,end:c,published:l}))},c=(e,t)=>'chef'===e?t.filter(e=>'kitchen'===e.ch&&!e.removed):t,l=(e,n)=>t(e,'customer-personal')?n:n.map(({id:e,ref:t,type:n,tableNo:a,slotTime:s,lines:c,status:l,allergies:o,allergyAck:p,handoverCheck:f,allergyChain:u,bookingId:m,readiness:h,createdAt:b,restaurantId:k,notes:y,accepted:w,allergyTicks:j})=>({id:e,ref:t,type:n,tableNo:a,slotTime:s,lines:c,status:l,allergies:o,allergyAck:p,handoverCheck:f,allergyChain:u,bookingId:m,readiness:h,createdAt:b,restaurantId:k,notes:y,accepted:w,allergyTicks:j})),o=(e,n)=>t(e,'supplier-email')?n:n.map(e=>({...e,email:''})),p=(e,n)=>t(e,'audit-all')?n:n.filter(e=>'menu'===e.kind&&/allergen|sign-off|recipe card/i.test(e.text))},807,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(t){const n=String(t??'').trim(),l=n.match(/\d+/g);return 1===l?.length?l[0].replace(/^0+(?=\d)/,''):n}Object.defineProperty(e,'__esModule',{value:!0}),e.plainTableNumber=t,Object.defineProperty(e,"tableNumbers",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"tableListNumbers",{enumerable:!0,get:function(){return l}}),e.tableNumbersA11y=function(t){const l=n(t).split('+').filter(Boolean);return l.length?`${1===l.length?'Table':'Tables'} ${l.join(', ')}`:'No table'};const n=n=>String(n??'').split('+').map(t).filter(Boolean).join('+'),l=(t,l=" + ")=>t.map(n).filter(Boolean).join(l)},808,[]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEFAULT_DWELL",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"dwellBands",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"bandLabel",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"fmtMins",{enumerable:!0,get:function(){return o}}),_e.dwellFor=function(e,t,r=[]){const o=n(e),i=Math.max(0,o.findIndex(e=>t<=e.upTo)),s=o[i]??o[o.length-1];if(!1===e?.settings.dwellLearn)return{mins:s.mins,learned:!1,samples:0};const a=0===i?1:o[i-1].upTo+1,u=r.filter(e=>'finished'===e.status&&e.seatedAt&&e.finishedAt&&e.partySize>=a&&e.partySize<=s.upTo).map(e=>(new Date(e.finishedAt).getTime()-new Date(e.seatedAt).getTime())/6e4).filter(e=>e>=20&&e<=360).sort((e,t)=>e-t);if(u.length<8)return{mins:s.mins,learned:!1,samples:u.length};const l=u[Math.floor(u.length/2)];return{mins:5*Math.round((s.mins+l)/2/5),learned:!0,samples:u.length}},Object.defineProperty(_e,"DAYS",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"ruleText",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"ANCHORAGE_EVENTS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"regularEventsOf",{enumerable:!0,get:function(){return l}}),_e.occursOn=m,_e.nextOccurrence=function(e,t){const n=f(t);for(let t=0;t<400;t++){const r=c(new Date(n.getFullYear(),n.getMonth(),n.getDate()+t));if(m(e,r))return r}return null},_e.expandEvents=function(e,t,n,r){const o=[];if(!t.some(e=>e.active))return o;const i=f(n),s=f(r);for(let n=i;n<=s;n=new Date(n.getFullYear(),n.getMonth(),n.getDate()+1)){const r=c(n);for(const n of t)m(n,r)&&o.push({id:`${n.id}:${r}`,restaurantId:e,date:r,title:n.name,kind:'event',example:!1,source:'regular',description:[n.time?`from ${n.time}`:'',n.lastFood?`last food orders ${n.lastFood}`:'',n.notes??''].filter(Boolean).join(' \xb7 '),busier:n.busier,lastFood:n.lastFood,time:n.time})}return o},_e.lastFoodOn=function(t,n){if(!t)return null;const r=f(n).getDay(),o=t.settings.lastFoodByDay?.[r],s=(0,e.kitchenHoursOn)(t,f(n));let a=s?{time:s[1],reason:'kitchen closes'}:null;o&&(!a||oe?.settings.dwellBands?.length?e.settings.dwellBands:t,r=(e,t)=>{const n=0===t?1:e[t-1].upTo+1,r=e[t].upTo;return r>=9999?`${n} or more covers`:n===r?`${n} cover${1===n?'':'s'}`:`${n}\u2013${r} covers`},o=e=>e%60==0?`${e/60} hour${60===e?'':'s'}`:e>60?`${Math.floor(e/60)} h ${e%60} min`:`${e} min`;const i=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],s=['','first','second','third','fourth'],a=e=>'last'===e.kind?`Last ${i[e.weekday]} of every month`:'nth'===e.kind?`${s[e.n][0].toUpperCase()}${s[e.n].slice(1)} ${i[e.weekday]} of every month`:'weekly'===e.kind?`Every ${i[e.weekday]}`:`One-off: ${e.date}`,u=[{id:'ev-music-night',name:'Open Mic Night',rule:{kind:'last',weekday:0},time:'20:00',notes:'Live music from 8pm.',busier:!0,lastFood:'19:00',active:!0}],l=e=>e?.settings.regularEvents??('anchorage'===e?.id?u:[]),d=e=>String(e).padStart(2,'0'),c=e=>`${e.getFullYear()}-${d(e.getMonth()+1)}-${d(e.getDate())}`,f=e=>new Date(Number(e.slice(0,4)),Number(e.slice(5,7))-1,Number(e.slice(8,10)));function m(e,t){if(!e.active)return!1;const n=e.rule;if('once'===n.kind)return n.date===t;const r=f(t);return r.getDay()===n.weekday&&('weekly'===n.kind||('nth'===n.kind?Math.ceil(r.getDate()/7)===n.n:new Date(r.getFullYear(),r.getMonth(),r.getDate()+7).getMonth()!==r.getMonth()))}const b=e=>e?.settings.afterLastFood??'drinks',p=e=>{const[t,n]=e.split(':').map(Number);return`${t%12||12}${n?`:${d(n)}`:''}${t<12?'am':'pm'}`},y=e=>e?.settings.showTakeaway??'anchorage'!==e?.id,h=e=>!1!==e?.settings.coversCounter,O=e=>!1!==e?.settings.nextTableFree,$=e=>!1!==e?.settings.dogQuestion,w=e=>!1!==e?.settings.dietQuestion,F=e=>!1!==e?.settings.accessQuestion,k=(e,t)=>e?.settings.holidayFullNames?t:t.replace(/\s*\(substitute day\)/gi,'').trim()},809,[815]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Honeypot=function({value:t,onChange:n}){return(0,l.jsx)(o.default,{"aria-hidden":!0,pointerEvents:"none",style:{position:'absolute',left:-1e4,top:0,width:1,height:1,overflow:'hidden',opacity:0},children:(0,l.jsx)(e.TextInput,{testID:"hp-field",accessibilityLabel:"Leave this empty",value:t,onChangeText:n,tabIndex:-1,autoComplete:'off',name:'cc_extra_info','aria-hidden':!0})})};var e=r(d[0]);r(d[1]),r(d[2]);var t,n=r(d[3]),o=(t=n)&&t.__esModule?t:{default:t},l=r(d[4])},810,[874,30,122,127,24]); +__d(function(_g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.startForm=function(t=Date.now()){return{openedAt:t,hp:''}},e.guardFor=function(t,n=Date.now()){return{hp:t.hp,formMs:Math.max(0,Math.round(n-t.openedAt))}},e.rememberGuard=function(n,o){t.set(n,o)},e.takeGuard=function(n){const o=t.get(n);return o?(t.delete(n),o):{}};const t=new Map},811,[]); +__d(function(g,r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"NOTES_PLACEHOLDER",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"WIX_EDIT_NOTE",{enumerable:!0,get:function(){return o}}),e.canEditBooking=function(t){return'customer'!==t.variant&&('staff'===t.variant||t.inStaffApp?!!t.shiftManager:'display'===t.variant||'chef'===t.variant||'staff'!==t.role)},Object.defineProperty(e,"isWixBooking",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"EDIT_FIELDS",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"FIELD_WORDS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"draftOf",{enumerable:!0,get:function(){return c}}),e.changedFields=f,e.editPatch=function(t,n,o,s=(new Date).toISOString()){const d=f(t,n);if(!d.length)return{};const l={};for(const t of d){const o=u(t,n[t]);l[t]='partySize'===t?Math.max(1,Math.min(200,o)):'phone'===t||'email'===t||'table'===t?o||void 0:o}d.includes('table')&&(l.tableSetHere=!0);const c=t;return l.locallyEdited=!0,l.editedFields=[...new Set([...c.editedFields??[],...d])],l.editLog=[...c.editLog??[],{at:s,by:o.by.slice(0,80),app:o.app,fields:d}].slice(-50),l},e.editWarnings=function(n,o,s,d,l=90){const c=[],u={...n,date:o.date,time:o.time,partySize:o.partySize};if(o.table){const n=(0,t.tableOverlaps)(u,o.table,s.filter(t=>t.date===o.date),l);n.length&&c.push(`The table already has a booking at about the same time: ${n.map(t=>`${t.time} ${t.walkIn?'walk-in':t.name}`).join(', ')}.`)}d&&c.push(`Bookings are paused ${d.from} to ${d.to}${d.reason?` (${d.reason})`:''}.`);return c},Object.defineProperty(e,"editedWords",{enumerable:!0,get:function(){return b}});var t=r(_d[0]);const n='For example: birthday, high chair, dog, window seat',o='This booking came from the website. Changes here are not sent to website bookings yet.';const s=t=>{const n=t;return'Wix'===n.importedFrom||!!n.wix||(t.tags??[]).includes('Wix')},d=['date','time','partySize','name','phone','email','notes','table'],l={date:'date',time:'time',partySize:'covers',name:'name',phone:'phone',email:'email',notes:'notes',table:'table'},c=t=>({date:t.date,time:t.time,partySize:t.partySize,name:t.name,phone:t.phone??'',email:t.email??'',notes:t.notes??'',table:t.table??''}),u=(t,n)=>'partySize'===t?Number(n):String(n??'').trim();function f(t,n){const o=c(t);return d.filter(t=>u(t,o[t])!==u(t,n[t]))}const b=t=>t.map(t=>l[t]).join(', ')},812,[1312]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"webLine",{enumerable:!0,get:function(){return j.webLine}}),_e.T=I,Object.defineProperty(_e,"H1",{enumerable:!0,get:function(){return R}}),Object.defineProperty(_e,"H2",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"Muted",{enumerable:!0,get:function(){return W}}),_e.BrandBar=D,_e.Screen=function({children:e,title:t,subtitle:o,back:l=!0,right:n,maxWidth:s=640,footer:u,scroll:b=!0}){const f=(0,w.jsx)(h.default,{style:{width:'100%',maxWidth:s,alignSelf:'center',padding:16,gap:12,alignItems:'stretch'},children:e});return(0,w.jsxs)(y.SafeAreaView,{style:{flex:1,backgroundColor:p.colours.bg},edges:['top','left','right'],children:[(0,w.jsx)(h.default,{style:{width:'100%',maxWidth:s,alignSelf:'center'},children:(0,w.jsx)(D,{title:t,subtitle:o,back:l,right:n})}),b?(0,w.jsx)(c.default,{contentContainerStyle:{paddingBottom:40},children:f}):(0,w.jsx)(h.default,{style:{flex:1},children:f}),u?(0,w.jsx)(h.default,{style:H.footer,children:(0,w.jsx)(h.default,{style:{width:'100%',maxWidth:s,alignSelf:'center'},children:u})}):null]})},_e.Button=function({label:e,sub:t,onPress:o,kind:l="primary",disabled:n,small:c,style:u,accessibilityLabel:b,testID:h}){const f={primary:p.colours.gold,secondary:p.colours.tile,danger:p.colours.redSolid,ghost:'transparent',success:p.colours.accentBg}[l],y={primary:p.colours.onGold,secondary:p.colours.text,danger:'#FFFFFF',ghost:p.colours.gold,success:p.colours.goldLight}[l],j={primary:'transparent',secondary:p.colours.hairline,danger:'transparent',ghost:'transparent',success:p.colours.accentBorder}[l];return(0,w.jsxs)(s.default,{testID:h,accessibilityRole:"button",accessibilityLabel:b??e,accessibilityState:{disabled:!!n},disabled:n,onPress:o,style:({pressed:e})=>[H.btn,{backgroundColor:e&&'secondary'===l?p.colours.tilePressed:f,borderColor:j,opacity:n?.4:e?.85:1},c&&{paddingVertical:8,paddingHorizontal:14,minHeight:x.control.min,minWidth:44},u],children:[(0,w.jsx)(I,{weight:"semibold",size:c?p.font.small:p.font.body,colour:y,center:!0,children:e}),t?(0,w.jsx)(I,{size:c?p.font.small-2:p.font.small,colour:y,center:!0,testID:h?`${h}-sub`:void 0,children:t}):null]})},_e.Card=function({children:e,style:t,onPress:o,highlight:l}){const n=l===p.colours.gold||l===p.colours.accentBorder,c=(0,w.jsx)(h.default,{style:[H.card,{alignItems:'center'},l?{borderColor:n?p.colours.accentBorder:l,borderWidth:n?1:2}:null,t],children:e});return o?(0,w.jsx)(s.default,{accessibilityRole:"button",onPress:o,style:({pressed:e})=>({opacity:e?.85:1}),children:c}):c},_e.Badge=function({label:e,kind:t="neutral"}){const o={neutral:[p.colours.surface2,p.colours.muted,p.colours.border],gold:[p.colours.goldTint,p.colours.goldLight,p.colours.gold],red:[p.colours.redBg,'#FFD9D4',p.colours.red],amber:[p.colours.amberBg,'#FFE2A8',p.colours.amber],ok:[p.colours.okBg,p.colours.goldLight,p.colours.ok],blue:[p.colours.blueBg,p.colours.goldLight,p.colours.blue]}[t];return(0,w.jsx)(h.default,{style:[H.badge,{backgroundColor:o[0],borderColor:o[2],maxWidth:'100%'}],children:(0,w.jsx)(I,{size:13,weight:"medium",colour:o[1],style:{flexShrink:1},children:e})})},_e.Banner=F,Object.defineProperty(_e,"ExampleAllergenNotice",{enumerable:!0,get:function(){return z}}),Object.defineProperty(_e,"DemoPaymentNotice",{enumerable:!0,get:function(){return P}}),_e.Row=L,Object.defineProperty(_e,"Divider",{enumerable:!0,get:function(){return v}}),_e.Field=function({label:e,...o}){return(0,w.jsxs)(h.default,{style:{gap:4,alignSelf:'stretch',width:'100%'},children:[(0,w.jsx)(I,{size:p.font.small,weight:"medium",colour:p.colours.muted,center:!0,children:e}),(0,w.jsx)(t.TextInput,{accessibilityLabel:e,placeholderTextColor:"#7D776C",...o,style:[H.input,o.multiline&&{minHeight:70,textAlignVertical:'top'},o.style]})]})},_e.Chip=function({label:e,selected:t,onPress:o,disabled:l,sub:n,testID:c}){return(0,w.jsxs)(s.default,{testID:c,accessibilityRole:"button",accessibilityState:{selected:!!t,disabled:!!l},accessibilityLabel:`${e}${n?`, ${n}`:''}${t?', selected':''}`,'aria-pressed':!!t,disabled:l,onPress:o,style:[H.chip,t&&{backgroundColor:p.colours.gold,borderColor:p.colours.gold},l&&{opacity:.35}],children:[(0,w.jsx)(I,{size:p.font.small,weight:"medium",colour:t?p.colours.onGold:p.colours.text,center:!0,children:e}),n?(0,w.jsx)(I,{size:12,colour:t?p.colours.onGold:p.colours.muted,center:!0,children:n}):null]})},_e.Toggle=function({value:e,onChange:t,label:o,testID:l,disabled:n,a11y:s}){return(0,w.jsxs)(L,{style:{justifyContent:'space-between',flexShrink:1,minWidth:0},children:[(0,w.jsx)(I,{style:{flex:1,flexShrink:1},children:o}),(0,w.jsx)(b.default,{testID:l,disabled:n,accessibilityLabel:s??o,value:e,onValueChange:t,trackColor:{true:p.colours.gold,false:'#444'},thumbColor:e?'#FFF6E0':'#BBB',activeThumbColor:'#FFF6E0',activeTrackColor:p.colours.gold})]})},_e.Stepper=function({value:e,onChange:t,min:o=1,max:l=20,label:n,step:c=1,format:u,testID:b}){const f=u?u(e):String(e),y=e=>Math.round(e/c)*c;return(0,w.jsxs)(L,{gap:10,children:[(0,w.jsx)(s.default,{testID:b?`${b}-down`:void 0,accessibilityRole:"button",accessibilityLabel:`Decrease ${n??''}`,disabled:e<=o,onPress:()=>t(Math.max(o,y(e-c))),style:[H.stepBtn,e<=o?{opacity:.4}:null],children:(0,w.jsx)(I,{size:20,colour:p.colours.gold,children:"\u2212"})}),(0,w.jsx)(h.default,{testID:b?`${b}-value`:void 0,accessibilityLabel:n?`${n}: ${f}`:f,children:(0,w.jsx)(I,{weight:"semibold",size:p.font.large,style:{minWidth:u?64:28,textAlign:'center'},children:f})}),(0,w.jsx)(s.default,{testID:b?`${b}-up`:void 0,accessibilityRole:"button",accessibilityLabel:`Increase ${n??''}`,disabled:e>=l,onPress:()=>t(Math.min(l,y(e+c))),style:[H.stepBtn,e>=l?{opacity:.4}:null],children:(0,w.jsx)(I,{size:20,colour:p.colours.gold,children:"+"})})]})},_e.Sheet=function({visible:e,onClose:t,title:o,children:u,maxWidth:b,testID:x,footer:j}){const{height:C}=(0,f.default)(),k=l.default.useContext(y.SafeAreaInsetsContext)??{top:0,bottom:0,left:0,right:0},B=Math.max(320,C-k.top-k.bottom-24);return(0,w.jsx)(n.default,{visible:e,transparent:!0,animationType:"fade",onRequestClose:t,children:(0,w.jsx)(h.default,{style:[H.overlay,{padding:12,paddingTop:12+k.top,paddingBottom:12+k.bottom}],children:(0,w.jsxs)(h.default,{style:[H.sheet,{maxHeight:B},b?{maxWidth:b}:null],testID:x,children:[(0,w.jsxs)(L,{style:{justifyContent:'space-between',marginBottom:8,gap:8},children:[(0,w.jsx)(T,{style:{flex:1},children:o}),(0,w.jsx)(s.default,{accessibilityRole:"button",accessibilityLabel:"Close",onPress:t,hitSlop:8,testID:"sheet-close",style:{minWidth:48,minHeight:48,width:S?72:48,alignItems:'center',justifyContent:'center',marginRight:-8,marginTop:-6},children:(0,w.jsx)(I,{size:S?18:24,colour:p.colours.text,children:S?'Close':'\u2715'})})]}),(0,w.jsx)(c.default,{style:{flexShrink:1},contentContainerStyle:{gap:12,paddingTop:2,paddingBottom:4},children:u}),j?(0,w.jsx)(h.default,{style:{borderTopWidth:1,borderTopColor:p.colours.border,paddingTop:10,marginTop:8},testID:x?`${x}-footer`:void 0,children:j}):null]})})})},_e.SectionTitle=function({children:e}){return(0,w.jsx)(I,{weight:"semibold",size:12,colour:p.colours.goldMuted,center:!0,style:{textTransform:'uppercase',letterSpacing:1.6,marginTop:8},children:e})},Object.defineProperty(_e,"styles",{enumerable:!0,get:function(){return H}});var t=r(d[0]),o=r(d[1]),l=e(r(d[2])),n=e(r(d[3])),s=e(r(d[4])),c=e(r(d[5])),u=e(r(d[6])),b=e(r(d[7])),h=e(r(d[8])),f=e(r(d[9])),y=r(d[10]),p=r(d[11]),x=r(d[12]),j=r(d[13]),C=r(d[14]),k=r(d[15]),B=r(d[16]),w=r(d[17]);const S=['kirkton','abbotsford'].includes(C.VENUE_RID);function I({children:e,style:o,size:l=p.font.body,weight:n="regular",colour:s=p.colours.text,numberOfLines:c,center:u,testID:b,accessibilityRole:h}){return(0,w.jsx)(t.Text,{testID:b,accessibilityRole:h,numberOfLines:c,style:[{fontFamily:p.fonts[n],fontSize:l,color:s,lineHeight:(0,x.lineFor)(l)},u&&{textAlign:'center'},o,(0,j.webLine)(o,l)],children:e})}const R=e=>(0,w.jsx)(I,{size:p.font.title,weight:"semibold",center:!0,...e}),T=e=>(0,w.jsx)(I,{size:p.font.large,weight:"semibold",center:!0,...e}),W=e=>(0,w.jsx)(I,{colour:p.colours.muted,size:p.font.small,...e});function D({title:e,back:t=!0,right:l,subtitle:n}){return(0,w.jsxs)(h.default,{style:H.brandBar,children:[(0,w.jsxs)(h.default,{style:H.row,children:[(0,w.jsx)(h.default,{style:H.brandSide,children:t?(0,w.jsx)(s.default,{accessibilityRole:"button",accessibilityLabel:"Back",onPress:()=>o.router.canGoBack()?o.router.back():o.router.replace(k.ENTRY[k.APP_VARIANT]),style:H.backBtn,hitSlop:10,children:(0,w.jsx)(I,{size:18,weight:"semibold",colour:p.colours.gold,children:"\u2039 Back"})}):null}),(0,w.jsx)(s.default,{onPress:()=>o.router.push(k.ENTRY[k.APP_VARIANT]),accessibilityLabel:"Home",style:H.brandCenter,children:(0,w.jsx)(B.RestaurantBrand,{size:B.HEADER_LOGO})}),(0,w.jsx)(h.default,{style:[H.brandSide,{alignItems:'flex-end'}],children:l?(0,w.jsx)(h.default,{style:{flexShrink:0},children:l}):null})]}),e?(0,w.jsx)(R,{style:{marginTop:10,alignSelf:'stretch'},children:e}):null,n?(0,w.jsx)(W,{center:!0,style:{alignSelf:'stretch'},children:n}):null]})}function F({kind:e="info",title:t,children:o}){const n={info:[p.colours.surface,p.colours.gold,p.colours.text],warn:[p.colours.amberBg,p.colours.amber,'#FFE2A8'],danger:[p.colours.redBg,p.colours.red,'#FFE3DF'],success:[p.colours.okBg,p.colours.ok,p.colours.goldLight],example:[p.colours.amberBg,p.colours.amber,'#FFE2A8'],demo:[p.colours.goldTint,p.colours.gold,p.colours.goldLight]}[e];return(0,w.jsxs)(h.default,{accessibilityRole:"summary",style:[H.banner,{backgroundColor:n[0],borderLeftColor:n[1]}],children:[t?(0,w.jsx)(I,{weight:"semibold",colour:n[2],center:!0,children:t}):null,l.default.Children.toArray(o).every(e=>'string'==typeof e||'number'==typeof e)?(0,w.jsx)(I,{size:p.font.small,colour:n[2],center:!0,children:o}):o]})}const z=()=>(0,w.jsx)(F,{kind:"example",title:"Allergens awaiting kitchen verification",children:"This allergen information has not been verified by the kitchen. Head chef sign-off is required. Always speak to staff about allergies."}),P=()=>(0,w.jsx)(F,{kind:"demo",title:"Card payments: not set up yet",children:"No card is charged and no payment provider is contacted."});function L({children:e,style:t,gap:o=8,wrap:l}){return(0,w.jsx)(h.default,{style:[H.row,{gap:o},l&&{flexWrap:'wrap',justifyContent:'center'},t],children:e})}const v=()=>(0,w.jsx)(h.default,{style:{height:1,backgroundColor:p.colours.border,marginVertical:4}});const H=u.default.create({row:{flexDirection:'row',alignItems:'center'},brandBar:{paddingHorizontal:16,paddingTop:8,paddingBottom:8,borderBottomWidth:1,borderBottomColor:p.colours.border},brandSide:{width:96,minHeight:48,justifyContent:'center'},brandCenter:{flex:1,alignItems:'center',justifyContent:'center',minHeight:48},backBtn:{paddingRight:12,minHeight:48,minWidth:88,justifyContent:'center'},btn:{borderRadius:x.radii.button,paddingVertical:12,paddingHorizontal:18,borderWidth:1,alignItems:'center',justifyContent:'center',minHeight:x.control.min,alignSelf:'stretch'},card:{backgroundColor:p.colours.surface,borderRadius:p.radius.l,padding:16,borderWidth:1,borderColor:p.colours.hairline,gap:8},badge:{borderRadius:999,paddingHorizontal:9,paddingVertical:2,borderWidth:1,alignSelf:'flex-start'},banner:{borderRadius:p.radius.m,padding:12,borderLeftWidth:5,gap:2},input:{minWidth:0,backgroundColor:p.colours.surface2,borderColor:p.colours.border,borderWidth:1,borderRadius:p.radius.m,paddingHorizontal:12,paddingVertical:10,color:p.colours.text,fontSize:p.font.body,fontFamily:p.fonts.regular},chip:{borderWidth:1,borderColor:p.colours.border,borderRadius:p.radius.m,paddingHorizontal:12,paddingVertical:8,backgroundColor:p.colours.surface2,minWidth:64,minHeight:44,justifyContent:'center'},stepBtn:{width:44,height:44,borderRadius:22,borderWidth:1.5,borderColor:p.colours.gold,alignItems:'center',justifyContent:'center'},overlay:{flex:1,backgroundColor:'rgba(0,0,0,0.7)',justifyContent:'center',alignItems:'center',padding:16},sheet:{backgroundColor:p.colours.surface,borderRadius:x.radii.xl,padding:18,width:'100%',maxWidth:520,maxHeight:'90%',borderWidth:1,borderColor:p.colours.gold},footer:{borderTopWidth:1,borderTopColor:p.colours.border,backgroundColor:p.colours.surface,padding:12}})},813,[874,804,30,256,263,151,46,271,127,287,289,821,1250,1251,5,806,860,24]); +__d(function(_g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ALLERGENS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"allergenLabel",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"SEVERITIES",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"severityLabel",{enumerable:!0,get:function(){return s}}),e.effectiveAllergens=function(l,n=[]){const t={...l.allergens};for(const s of l.optionGroups??[])for(const l of s.choices)if(n.includes(l.id)&&l.allergens)for(const[n,s]of Object.entries(l.allergens))'contains'!==t[n]&&(t[n]=s);return t},e.conflictsFor=function(l,n){const t=[],s=[];for(const a of n)'contains'===l[a.allergen]?t.push(a.allergen):'may'===l[a.allergen]&&s.push(a.allergen);return{contains:t,may:s}},Object.defineProperty(e,"hasConflict",{enumerable:!0,get:function(){return a}});const l=[{id:'gluten',label:'Cereals containing gluten',short:'Gluten'},{id:'crustaceans',label:'Crustaceans',short:'Crustaceans'},{id:'molluscs',label:'Molluscs',short:'Molluscs'},{id:'eggs',label:'Eggs',short:'Eggs'},{id:'fish',label:'Fish',short:'Fish'},{id:'peanuts',label:'Peanuts',short:'Peanuts'},{id:'treenuts',label:'Tree nuts',short:'Tree nuts'},{id:'soya',label:'Soya',short:'Soya'},{id:'milk',label:'Milk',short:'Milk'},{id:'celery',label:'Celery',short:'Celery'},{id:'mustard',label:'Mustard',short:'Mustard'},{id:'sesame',label:'Sesame',short:'Sesame'},{id:'sulphites',label:'Sulphur dioxide / sulphites',short:'Sulphites'},{id:'lupin',label:'Lupin',short:'Lupin'}],n=n=>l.find(l=>l.id===n)?.short??n,t=[{id:'intolerance',label:'Intolerance'},{id:'allergy',label:'Allergy'},{id:'coeliac',label:'Coeliac disease'},{id:'anaphylaxis',label:'Severe \u2014 anaphylaxis risk'}],s=l=>t.find(n=>n.id===l)?.label??l;const a=l=>l.contains.length>0||l.may.length>0},814,[]); +__d(function(g,_r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ANCHORAGE_SEASONS",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"hourSetsOf",{enumerable:!0,get:function(){return n}}),e.seasonOn=s,e.kitchenHoursOn=l,e.hoursFor=function(r,n){const u=l(r,n);return u?{open:(0,t.atTime)(n,u[0]),close:(0,t.atTime)(n,u[1])}:null};var t=_r(_d[0]);const r=[{id:'winter',name:'Winter',hours:{0:['12:30','19:00'],1:null,2:null,3:['12:00','19:00'],4:['12:00','19:00'],5:['12:00','20:00'],6:['12:00','20:00']}},{id:'summer',name:'Summer',hours:null}],n=t=>t.settings.hourSets??('anchorage'===t.id?r:[]),u=t=>`${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`,o=t=>`${t.getFullYear()}-${u(t)}`;function s(t,r){const o=n(t).filter(t=>t.hours);if(!o.length)return null;const s=o.filter(t=>t.start).sort((t,r)=>t.start.localeCompare(r.start));if(s.length<2)return s[0]??o[0];const l=u(r);return[...s].reverse().find(t=>t.start<=l)??s[s.length-1]}function l(t,r){const n=(t.settings.hourOverrides??[]).find(t=>t.date===o(r));if(n)return n.hours;const u=s(t,r);return u?.hours?u.hours[r.getDay()]??null:t.kitchenHours[r.getDay()]??null}},815,[818]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"gbp",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"pounds",{enumerable:!0,get:function(){return n}});const t=t=>`\xa3${(t/100).toFixed(2)}`,n=t=>Math.round(100*t)},816,[]); +__d(function(g,_r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.takeawaySlots=function(s,o,r){const l=(0,t.hoursFor)(s,r);if(!l)return[];const d=s.settings.slotMinutes,u=(0,n.addMins)(r,s.settings.leadMins),c=[];for(let t=new Date(l.open);t<=l.close;t=(0,n.addMins)(t,d)){if(tn.restaurantId===s.id&&'takeaway'===n.type&&'cancelled'!==n.status&&n.slotTime&&new Date(n.slotTime).getTime()===t.getTime()).length;c.push({time:new Date(t),label:(0,n.hm)(t),taken:r,cap:s.settings.slotCap,full:r>=s.settings.slotCap})}return c},e.bookingSlots=function(r,l,d,u,c){const f=(0,t.hoursFor)(r,l);if(!f)return[];const p=[],M=(0,n.addMins)(f.close,-60),h=(0,s.lastFoodOn)(r,o(l)),k=h?(0,n.addMins)((0,n.atTime)(l,h.time),-60):M,S='drinks'===(0,s.afterLastFood)(r);for(let t=new Date(f.open);t<=M;t=(0,n.addMins)(t,30)){const s=(0,n.hm)(t),o=t>k;if(o&&!S)continue;const l=r.settings.bookingCoversPerSlot-d(s),f=t.getTime()=u,...o?{drinksOnly:!0}:{}})}return p};var t=_r(_d[0]),n=_r(_d[1]),s=_r(_d[2]);const o=t=>`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`},817,[815,818,809]); +__d(function(g,r,i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"pad",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"ymd",{enumerable:!0,get:function(){return n}}),e.venueYmd=function(t,u="Europe/London"){try{const n=new Intl.DateTimeFormat('en-CA',{timeZone:u,year:'numeric',month:'2-digit',day:'2-digit'}).format(t);if(/^\d{4}-\d{2}-\d{2}$/.test(n))return n}catch{}return n(t)},Object.defineProperty(e,"hm",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"parseYmd",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"toMins",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"fromMins",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"atTime",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"addMins",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"dayShort",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"dayLong",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"monthLong",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"niceDate",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"niceDateYear",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"minsBetween",{enumerable:!0,get:function(){return P}});const t=t=>String(t).padStart(2,'0'),n=n=>`${n.getFullYear()}-${t(n.getMonth()+1)}-${t(n.getDate())}`;const u=n=>`${t(n.getHours())}:${t(n.getMinutes())}`,a=t=>{const[n,u,a]=t.split('-').map(Number);return new Date(n,u-1,a)},o=t=>{const[n,u]=t.split(':').map(Number);return 60*n+u},c=n=>`${t(Math.floor(n/60))}:${t(n%60)}`,d=(t,n)=>{const u=new Date(t);return u.setHours(0,0,0,0),u.setMinutes(o(n)),u},m=(t,n)=>new Date(t.getTime()+6e4*n),b=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],y=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],f=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],l=['January','February','March','April','May','June','July','August','September','October','November','December'],p=t=>b[t.getDay()],s=t=>y[t.getDay()],O=t=>l[t],M=t=>`${b[t.getDay()]} ${t.getDate()} ${f[t.getMonth()]}`,j=t=>`${M(t)} ${t.getFullYear()}`,P=(t,n)=>Math.round((n.getTime()-t.getTime())/6e4)},818,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"repo",{enumerable:!0,get:function(){return o}});var t=r(d[0]),n=r(d[1]);Object.keys(n).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})});const o=t.localRepositories},819,[1252,1019]); +__d(function(_g,_r2,_i2,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"inviteRefusal",{enumerable:!0,get:function(){return p.inviteRefusal}}),Object.defineProperty(_e,"keysToWipe",{enumerable:!0,get:function(){return p.keysToWipe}}),Object.defineProperty(_e,"changedFields",{enumerable:!0,get:function(){return m.changedFields}}),Object.defineProperty(_e,"useSync",{enumerable:!0,get:function(){return re}}),Object.defineProperty(_e,"can",{enumerable:!0,get:function(){return de}}),Object.defineProperty(_e,"isLive",{enumerable:!0,get:function(){return ue}}),_e.setTempManagerAccess=async function(e,t,a){const s=re.getState().venueId;if(!s||'staff'!==re.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{error:i}=await ne().rpc('set_staff_manager_access',{p_venue:s,p_staff_ref:e,p_on:t,p_reason:a.trim()||null});return i?{ok:!1,message:/owner/i.test(i.message)?'Only an owner can change this.':'Could not save. Try again.'}:(P.useOwner.setState(a=>({staff:a.staff.map(a=>a.id===e?{...a,...t?{role:'manager',managerAccess:!0}:{role:'staff',managerAccess:void 0}}:a)})),{ok:!0})}catch{return{ok:!1,message:'Could not save. Try again when the app is online.'}}},_e.setTempOwnerAccess=async function(e,t,a){const s=re.getState().venueId;if(!s||'staff'!==re.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{error:i}=await ne().rpc('set_staff_owner_access',{p_venue:s,p_staff_ref:e,p_on:t,p_reason:a.trim()||null});if(i)return{ok:!1,message:/owner/i.test(i.message)?'Only an owner can change this.':'Could not save. Try again.'};const n=e=>'Manager'===e.level||'Supervisor'===e.level?'manager':'staff';return P.useOwner.setState(a=>({staff:a.staff.map(a=>a.id===e?{...a,...t?{role:'owner',ownerAccess:!0}:{role:a.managerAccess?'manager':n(a),ownerAccess:void 0}}:a)})),{ok:!0}}catch{return{ok:!1,message:'Could not save. Try again when the app is online.'}}},_e.setManagerAccess=async function(e,t){const a=re.getState().venueId;if(!a||'staff'!==re.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:s,error:i}=await ne().rpc('set_manager_access',{p_venue:a,p_staff_ref:e,p_on:t});if(i)return{ok:!1,message:i.message.replace(/^.*?:\s*/,'')||'Not allowed'};const n=String(s??'');return P.useOwner.setState(t=>({staff:t.staff.map(t=>t.id===e?{...t,...Ge(n)}:t)})),{ok:!0,role:n}}catch(e){return{ok:!1,message:String(e?.message??e)}}},_e.unlockCashUp=async function(e,t,a){if(H.PITCH)return Q.unlockCashUp(e,t,a);const s=re.getState().venueId;if(!s||'staff'!==re.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:i,error:n}=await ne().rpc('unlock_cash_up',{p_venue:s,p_kind:e,p_id:t,p_reason:a});if(n)return{ok:!1,message:n.message};const r=String(i);return'cashup'===e?B.useCashUp.setState(e=>({cashUps:e.cashUps.map(e=>e.id===t?{...e,unlockedUntil:r}:e)})):B.useCashUp.setState(e=>({sales:e.sales.map(e=>e.id===t?{...e,unlockedUntil:r}:e)})),{ok:!0,until:r}}catch(e){return{ok:!1,message:String(e?.message??e)}}},_e.readCashAudit=async function(e){if(H.PITCH)return Q.cashAudit(e);const t=re.getState().venueId;if(!t)return[];let a=ne().from('cash_up_audit').select('at, action, changed_by_name, tbl, for_date, reason, old_row, new_row').eq('venue_id',t).order('at',{ascending:!1}).limit(50);e&&(a=a.eq('row_id',e));const{data:s,error:i}=await a;return i||!Array.isArray(s)?[]:s.map(e=>({at:String(e.at),action:String(e.action),by:String(e.changed_by_name??'\u2014'),tbl:String(e.tbl),forDate:e.for_date??void 0,reason:e.reason??void 0,changed:(0,m.changedFields)(e.old_row,e.new_row)}))},_e.setPushLive=async function(e){const t=re.getState().venueId;if(!t)return{ok:!1,message:'Connect to the venue first.'};const{data:a,error:s}=await ne().rpc('set_push_live',{p_venue:t,p_on:e});return s?{ok:!1,message:s.message}:(qt.setState({live:!!a,known:!0}),{ok:!0})},_e.readPushLive=Kt,_e.readAccessLog=async function(){const e=re.getState().venueId;if(!e)return[];try{const{data:t}=await ne().from('staff_access_log').select('*').eq('venue_id',e).order('changed_at',{ascending:!1}).limit(30);return t??[]}catch{return[]}},Object.defineProperty(_e,"ORDER_LOGO_BUCKET",{enumerable:!0,get:function(){return xt}}),_e.uploadOrderLogo=async function(e,t){const a=re.getState().venueId;if(!a||'staff'!==re.getState().kind)return{ok:!1,message:'offline'};try{const s=await(await fetch(t)).blob(),i=`${a}/${e}-${Date.now()}.jpg`,{error:n}=await ne().storage.from(xt).upload(i,s,{upsert:!0,contentType:'image/jpeg'});return n?{ok:!1,message:n.message}:{ok:!0,path:i}}catch(e){return{ok:!1,message:String(e?.message??e)}}},_e.orderLogoUrl=async function(e){const t=Lt.get(e);if(t&&t.until>Date.now())return t.url;try{const{data:t}=await ne().storage.from(xt).createSignedUrl(e,3600);if(t?.signedUrl)return Lt.set(e,{url:t.signedUrl,until:Date.now()+3e6}),t.signedUrl}catch{}return null},_e.removeOrderLogo=async function(e){try{await ne().storage.from(xt).remove([e])}catch{}},Object.defineProperty(_e,"usePushLive",{enumerable:!0,get:function(){return qt}}),_e.claimInvite=Zt,_e.signedInHereAs=async function(e){fe();const t=await k.kv.get(Ht,null);return!!t&&'staff'===t.kind&&t.staffRef===e},_e.rememberedInviteHere=async function(e){return fe(),await k.kv.get(Gt,null)===e},_e.kirkmichaelStaffAppUrl=async function(){const t=re.getState();if(!e.IS_KIRKMICHAEL||'staff'!==t.kind||t.venueId!==e.VENUE_UUID||t.staffRef!==g.useSession.getState().meId)return null;fe();const a=await k.kv.get(Gt,null);return a?(0,g.appUrl)('staff',a):null},_e.wildingsStaffAppUrl=async function(){const t=re.getState();if(!e.IS_WILDINGS||'staff'!==t.kind||t.venueId!==e.VENUE_UUID||t.staffRef!==g.useSession.getState().meId)return null;fe();const a=await k.kv.get(Gt,null);return a?(0,g.appUrl)('staff',a):null},_e.forgetSignInHere=async function(){fe(),await k.kv.remove(Ht),await k.kv.remove(Gt),oe({mode:'signin',perms:[]});try{await ta()}catch{}},_e.approveShiftSwap=async function(e,t,a){const s=re.getState().venueId;if(H.PITCH||!s||'staff'!==re.getState().kind)return{ok:!0};if(!(0,$.isUuid)(e))return{ok:!1,message:'This shift isn\u2019t on the shared rota yet.'};try{return await Yt('approve_shift_swap',{p_venue:s,p_shift:e,p_to_ref:t,p_kind:a}),{ok:!0}}catch(e){return{ok:!1,message:String(e?.message??e).replace(/^.*?:\s*/,'')||'Not allowed'}}},_e.claimInviteForSync=async function(e){const t=await Zt(e);return'ok'===t.status?t.id:null},_e.reissueInvite=async function(e){if(H.PITCH)return Q.reissueInvite(e);const t=re.getState().venueId;if(!t||'staff'!==re.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:a,error:s}=await ne().rpc('reissue_invite',{p_venue:t,p_staff_ref:e});if(s)return{ok:!1,message:s.message.replace(/^.*?:\s*/,'')||'Not allowed'};const i=a,n=String(i.app??'staff');return{ok:!0,token:String(i.token),expiresAt:String(i.expiresAt),app:'owner'===n||'chef'===n?n:'staff'}}catch(e){return{ok:!1,message:String(e?.message??e)}}},_e.ensureStaffAppLinks=async function(e){const t=re.getState().venueId;if(!t||'staff'!==re.getState().kind)throw new Error('Connect to the venue first.');return Yt('ensure_staff_app_links',{p_venue:t,p_staff_ref:e})},_e.staffAppLinkHistory=async function(e){return Yt('staff_app_link_history',{p_venue:re.getState().venueId,p_staff_ref:e})},_e.revokeStaffAppLink=async function(e){await Yt('revoke_staff_app_link',{p_venue:re.getState().venueId,p_link_id:e})},_e.readInviteStatus=async function(){if(H.PITCH)return Q.inviteStatus();const e=re.getState().venueId;if(!e)return{};const{data:t,error:a}=await ne().rpc('invite_status',{p_venue:e});if(a||!Array.isArray(t))return{};const s={};for(const e of t)s[String(e.staff_ref)]={state:e.state,expiresAt:e.expires_at??void 0,usedAt:e.used_at??void 0,devices:Number(e.devices??0)};return s},_e.pairWithCode=async function(t){if(!(0,v.isSupabaseConfigured)())return{ok:!1,error:'This build has no shared backend.'};try{await zt();const{data:a,error:s}=await ne().rpc(e.IS_QUEUED_VENUE?'claim_'+e.VENUE_RID+'_pairing_code':e.IS_GREENSIDE?'claim_greenside_pairing_code':e.IS_ABBOTSFORD?'claim_abbotsford_pairing_code':e.IS_KIRKTON?'claim_kirkton_pairing_code':e.IS_WILDINGS?'claim_wildings_pairing_code':e.IS_KIRKMICHAEL?'claim_kirkmichael_pairing_code':e.IS_ISOLATED_VENUE?'claim_souters_pairing_code':'claim_pairing_code',{p_code:t});if(s)throw s;const i=a?.[0];if(!i)return{ok:!1,error:'That code was not accepted. It may have expired. Ask a manager for a new one.'};const n={kind:'device',venueId:i.venue_id,venueSlug:i.venue_slug,venueName:i.venue_name,canWrite:i.can_write,label:i.label};return await k.kv.set(Vt,n),aa(),{ok:!0,venueName:i.venue_name}}catch(e){const t=String(e?.message??e);return/fetch|network/i.test(t)?{ok:!1,error:'No connection. Check the tablet\u2019s Wi-Fi and try again.'}:/rate|too many/i.test(t)?{ok:!1,error:'Too many tries from this network. Wait a little and try again.'}:{ok:!1,error:/valid|switched off/i.test(t)?t:`Couldn\u2019t pair: ${t}`}}},_e.unpairDisplay=async function(){await k.kv.remove(Vt),await ta();try{await ne().auth.signOut()}catch{}oe({mode:'unpaired',venueId:void 0,venueName:void 0,perms:[]})},_e.disconnectStaff=async function(){await k.kv.remove(Ht),await k.kv.remove(Gt),await ta();try{await ne().auth.signOut()}catch{}oe({mode:'signin',venueId:void 0,venueName:void 0,perms:[],kind:void 0,role:void 0,staffRef:void 0,message:'Disconnected. Open your personal invite link to connect again.'})},_e.wipeThisDevice=async function(t={}){try{await ta()}catch{}try{(0,v.isSupabaseConfigured)()&&await ne().auth.signOut({scope:'local'})}catch{}let a=0;try{const e='undefined'!=typeof navigator?navigator:null,t=await(e?.serviceWorker?.getRegistration?.()),a=await(t?.pushManager?.getSubscription?.());a&&await a.unsubscribe()}catch{}for(const t of['undefined'!=typeof localStorage?localStorage:null,'undefined'!=typeof sessionStorage?sessionStorage:null])if(t)try{const s=[];for(let e=0;et.startsWith(`cc-venue:${e.VENUE_RID}:`)):(0,p.keysToWipe)(s).filter(e=>!e.startsWith('cc-venue:')))t.removeItem(i),a++}catch{}try{const t='undefined'!=typeof caches?caches:null;if(t)for(const a of await t.keys())!e.IS_ISOLATED_VENUE&&/data|api|photo/i.test(a)&&await t.delete(a)}catch{}oe({mode:'signin',venueId:void 0,venueName:void 0,perms:[],kind:void 0,role:void 0,staffRef:void 0,message:'This device has been wiped.'}),!1!==t.reload&&'undefined'!=typeof window&&window.location&&window.location.replace(window.location.pathname);return a},_e.guestSession=Xt,Object.defineProperty(_e,"rpc",{enumerable:!0,get:function(){return Yt}}),_e.startAppSync=async function(t=e.VENUE_RID){if(e.IS_ISOLATED_VENUE&&t!==e.VENUE_RID)return;if(ge)return;ge=!0,sa=t,'customer'===le&&'live'!==U.useStore.getState().clock.mode&&U.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}});if(fe(),'customer'!==le){const e=e=>new Promise(t=>{try{if(!e?.persist||e.persist.hasHydrated())return t();const a=e.persist.onFinishHydration(()=>{a?.(),t()});setTimeout(t,3e3)}catch{t()}}),a='chef'===le&&(0,d.isAnchorage)(t)?[U.useStore,P.useOwner,L.useKitchen,q.useSafety,N.useCardStore,r.useGpCalc,M.useOrderSheets,o.useSpecials,_.useHr]:[U.useStore,P.useOwner,L.useKitchen];if(await Promise.all(a.map(e)),'chef'===le&&(0,d.isAnchorage)(t)&&a.some(e=>!e.persist.hasHydrated()))return void oe({mode:'offline',message:'Saved kitchen data could not be backed up. Nothing was cleared. Free some device storage, then reopen.',lastError:'Legacy kitchen archive not ready'});try{await wa(t)}catch{if(s.LIVE_VENUE_BUILD&&(0,s.isLiveVenue)(t))return void oe({mode:'offline',message:'Device backup failed. Nothing was cleared. Free some storage, then reopen.',lastError:'Legacy kitchen archive failed'})}'live'!==U.useStore.getState().clock.mode&&U.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}})}if(!(0,v.isSupabaseConfigured)())return void oe({mode:'off'});R.mutationQueue.subscribe(()=>{const e=R.mutationQueue.waiting,t=e[0];oe({pending:R.mutationQueue.pending.length,failed:R.mutationQueue.failed.length,waiting:e.length,waitingWhat:t?`${(0,O.describeWrite)(t)}: ${(0,O.plainReason)({...t.lastErr},'retry')}`:void 0})}),R.mutationQueue.onFailed(e=>oe({lastError:`${e.table}: ${e.lastError??'rejected'}`,failed:R.mutationQueue.failed.length,refused:{what:(0,O.describeWrite)(e),why:'conflict'===e.reason?(0,O.plainReason)({code:'conflict'},'refused'):(0,O.plainReason)({...e.lastErr,message:e.lastErr?.message??e.lastError},'refused'),at:e.failedAt}})),me.push((0,b.onConnectivity)(e=>oe({mode:e?re.getState().venueId?'live':re.getState().mode:re.getState().venueId?'offline':re.getState().mode}))),await ia()},Object.defineProperty(_e,"syncInternals",{enumerable:!0,get:function(){return fa}}),_e.goLive=ma,Object.defineProperty(_e,"usePublicDayStore",{enumerable:!0,get:function(){return Ca}}),_e.publicDay=function(e,a){const s=`${e}|${a}`,i=Ea.get(s);if('customer'!==le||!(0,v.isSupabaseConfigured)())return null;(!i||Date.now()-i.at>6e4)&&(i?i.at=Date.now():Ea.set(s,{at:Date.now(),v:{bookings:[],blocks:[]}}),Yt('public_day',{p_venue_slug:(0,t.queuedDatabaseSlug)(e),p_date:a}).then(t=>{const i=[],n=[];(t??[]).forEach((t,s)=>{'booking'===t.kind?i.push({id:`pub-${a}-${s}`,ref:'',restaurantId:e,customerId:null,name:'',date:a,time:ye(t.booking_time),partySize:Number(t.covers)||0,table:(t.table_ids??[]).join('+')||void 0,durationMins:t.duration_mins??void 0,status:'confirmed',allergies:[],createdAt:''}):n.push({id:`pubblk-${a}-${s}`,rid:e,date:a,from:ye(t.from_time),to:ye(t.to_time),areaId:t.area_id??void 0,tables:Array.isArray(t.table_ids)&&t.table_ids.length?t.table_ids.map(String):void 0,by:'',createdAt:''})}),Ea.set(s,{at:Date.now(),v:{bookings:i,blocks:n},ok:!0}),Ca.setState(e=>({n:e.n+1}))}).catch(()=>{const e=Ea.get(s);e&&!e.ok&&Ea.delete(s)}));const n=Ea.get(s);return n?.ok?n.v:null};var e=_r2(_d[0]),t=_r2(_d[1]),a=_r2(_d[2]),s=_r2(_d[3]),i=_r2(_d[4]),n=_r2(_d[5]),r=_r2(_d[6]),o=_r2(_d[7]),d=_r2(_d[8]),u=_r2(_d[9]),l=_r2(_d[10]),c=_r2(_d[11]),f=_r2(_d[12]),p=_r2(_d[13]),m=_r2(_d[14]),g=_r2(_d[15]),_=_r2(_d[16]),S=_r2(_d[17]),h=_r2(_d[18]),y=_r2(_d[19]),w=_r2(_d[20]),v=_r2(_d[21]),b=_r2(_d[22]),k=_r2(_d[23]),I=_r2(_d[24]),O=_r2(_d[25]),R=_r2(_d[26]),A=_r2(_d[27]),U=_r2(_d[28]),D=_r2(_d[29]),E=_r2(_d[30]),C=_r2(_d[31]),T=_r2(_d[32]),N=_r2(_d[33]),M=_r2(_d[34]),K=_r2(_d[35]),x=_r2(_d[36]),L=_r2(_d[37]),q=_r2(_d[38]),P=_r2(_d[39]),$=_r2(_d[40]),j=_r2(_d[41]),B=_r2(_d[42]),F=_r2(_d[43]),W=_r2(_d[44]),V=_r2(_d[45]),H=_r2(_d[46]),G=_r2(_d[47]),Q=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(a){if('default'!==a){var s=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(t,a,s.get?s:{enumerable:!0,get:function(){return e[a]}})}}),t.default=e,t})(G),J=_r2(_d[48]),z=_r2(_d[49]),Z=_r2(_d[50]),X=_r2(_d[51]),Y=_r2(_d[52]),ee=_r2(_d[53]),te=_r2(_d[54]),ae=_r2(_d[55]),se=_r2(_d[56]),ie=_r2(_d[57]);const ne=()=>(0,w.getSupabase)();R.mutationQueue.setExecutor(I.executeMutation);const re=(0,y.create)(()=>({mode:'off',perms:[],pending:0,failed:0})),oe=e=>re.setState(e),de=e=>{const t=re.getState().perms;return t.includes('*')||t.includes(e)},ue=()=>{const e=re.getState().mode;return'live'===e||'offline'===e||'connecting'===e};re.subscribe(()=>(0,ae.setLiveData)(ue()));let le=D.APP_VARIANT,ce=!1;const fe=()=>{ce||((0,k.setSyncNamespace)(le),ce=!0)};let pe=[],me=[],ge=!1;const Se=()=>(new Date).toISOString().slice(0,10),he=e=>new Date(Date.now()-864e5*e).toISOString().slice(0,10),ye=e=>e?e.slice(0,5):'',we=e=>Array.isArray(e)?e.filter(e=>e&&'object'==typeof e&&'string'==typeof e.allergen&&['gluten','crustaceans','molluscs','eggs','fish','peanuts','treenuts','soya','milk','celery','mustard','sesame','sulphites','lupin'].includes(e.allergen)&&(!e.severity||['intolerance','allergy','coeliac','anaphylaxis'].includes(e.severity))):[],ve=e=>JSON.parse(JSON.stringify(e));function be(e,t){const a=he(120);return{name:t?'walk_ins':'bookings',table:t?'walk_ins':'bookings',list:()=>U.useStore.getState().bookings.filter(a=>a.restaurantId===e&&!!a.walkIn===t),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id),writable:()=>'guest'!==re.getState().kind,filter:e=>e.gte(t?'walk_date':'booking_date',a),inWindow:e=>e.date>=a,toRow:(e,a)=>{const s=ve(e);return t?{id:e.id,venue_id:a,walk_date:e.date,arrived_at:e.seatedAt??e.createdAt,covers:Math.max(1,Math.min(200,e.partySize)),table_ids:e.table?e.table.split('+').map(e=>e.trim()).filter(Boolean):[],dog:!!e.dog,allergies:we(e.allergies),note:e.notes??'',status:'finished'===e.status?'left':'cancelled'===e.status||'noshow'===e.status?'undone':'seated',created_at:e.createdAt,doc:s}:{id:e.id,venue_id:a,ref:e.ref,customer_id:(0,$.isUuid)(e.customerId)?e.customerId:null,guest_name:e.name||'Guest',phone:e.phone??null,email:e.email??null,booking_date:e.date,booking_time:e.time,duration_mins:e.durationMins&&e.durationMins>=15&&e.durationMins<=720?e.durationMins:null,covers:Math.max(1,Math.min(200,e.partySize)),table_ids:e.table?e.table.split('+').map(e=>e.trim()).filter(Boolean):[],dog:!!e.dog,allergies:we(e.allergies),allergy_ack_by:e.allergyAck?.by??null,allergy_ack_at:e.allergyAck?.at??null,notes:e.notes??'',tags:e.tags??[],occasion:e.occasion??null,status:e.status,source:e.source??'in-person',security:e.security??'none',deposit_paid:e.depositPaid??0,seated_at:e.seatedAt??null,finished_at:e.finishedAt??null,created_at:e.createdAt,doc:s}},fromRow:a=>{if(!a.doc||'object'!=typeof a.doc)return null;const s={...a.doc,id:String(a.id),restaurantId:e};return!t&&a.status&&'declined'!==a.status&&(s.status=a.status),t&&(s.walkIn=!0),'saved-card'===s.security&&(s.security='none'),s},apply:(e,t)=>U.useStore.setState(a=>{const s=new Set(t),i=new Map(e.map(e=>[e.id,e])),n=a.bookings.filter(e=>!s.has(e.id)).map(e=>i.get(e.id)??e),r=new Set(n.map(e=>e.id));return{bookings:[...n,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>U.useStore.subscribe((t,a)=>{t.bookings!==a.bookings&&e()}),protect:!0}}function ke(e){const t=new Date(Date.now()-18144e5).toISOString();return{name:'orders',table:'takeaway_orders',list:()=>U.useStore.getState().orders.filter(t=>t.restaurantId===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id),writable:()=>'guest'!==re.getState().kind,filter:e=>e.gte('created_at',t),inWindow:e=>e.createdAt>=t,toRow:(e,t)=>({id:e.id,venue_id:t,ref:e.ref,customer_id:(0,$.isUuid)(e.customerId)?e.customerId:null,customer_name:e.customerName||'Guest',phone:e.phone??null,email:e.email??null,items:ve(e.lines??[]),allergies:we(e.allergies),notes:e.notes??null,slot_time:e.slotTime??null,ready_by:e.readyBy??null,subtotal:Math.round(e.subtotal??0),tip:Math.round(e.tip??0),total:Math.round(e.total??0),paid:Math.round(e.paid??0),status:e.status,channel:e.channel??null,confirmed_by:e.accepted?e.accepted.by:null,confirmed_at:e.accepted?e.accepted.at:null,created_at:e.createdAt,allergy_chain:ve(e.allergyChain??{}),readiness:ve(e.readiness??{}),allergy_ticks:ve(e.allergyTicks??{}),handover_check:e.handoverCheck?ve(e.handoverCheck):null,accepted:e.accepted?ve(e.accepted):null,doc:ve(e)}),fromRow:t=>t.doc&&'object'==typeof t.doc?{...t.doc,id:String(t.id),restaurantId:e,status:t.status??t.doc.status}:null,apply:(e,t)=>U.useStore.setState(a=>{const s=new Set(t),i=new Map(e.map(e=>[e.id,e])),n=a.orders.filter(e=>!s.has(e.id)).map(e=>i.get(e.id)??e),r=new Set(n.map(e=>e.id));return{orders:[...e.filter(e=>!r.has(e.id)),...n]}}),subscribe:e=>U.useStore.subscribe((t,a)=>{t.orders!==a.orders&&e()})}}function Ie(e){const t=he(60);return{protect:!0,name:'blocks',table:'blocks',list:()=>[...E.useBlocks.getState().blocks,...E.useBlocks.getState().removed].filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id)&&e.to>e.from,writable:()=>'guest'!==re.getState().kind,filter:e=>e.gte('block_date',t),inWindow:e=>e.date>=t,toRow:(e,t)=>({id:e.id,venue_id:t,block_date:e.date,from_time:e.from,to_time:e.to,reason:e.reason??null,note:e.note??null,area_id:e.areaId??null,area_name:e.areaName??null,created_by:e.by,created_at:e.createdAt,doc:ve(e)}),fromRow:t=>t.doc?{...t.doc,id:String(t.id),rid:e}:{id:String(t.id),rid:e,date:t.block_date,from:ye(t.from_time),to:ye(t.to_time),reason:t.reason??void 0,note:t.note??void 0,by:t.created_by??'',createdAt:t.created_at,areaId:t.area_id??void 0,areaName:t.area_name??void 0},apply:(e,t)=>E.useBlocks.setState(a=>{const s=new Set(t),i=new Map(e.map(e=>[e.id,e])),n=[...a.blocks,...a.removed].filter(e=>!s.has(e.id)).map(e=>i.get(e.id)??e),r=new Set(n.map(e=>e.id)),o=[...n,...e.filter(e=>!r.has(e.id))];return{blocks:o.filter(e=>!e.removedAt),removed:o.filter(e=>!!e.removedAt)}}),subscribe:e=>E.useBlocks.subscribe((t,a)=>{t.blocks===a.blocks&&t.removed===a.removed||e()})}}let Oe=null;function Re(e){const t=e=>ve({areas:e.areas??[],tables:e.tables??[],joins:e.joins??[],sections:e.sections??[],fixtures:e.fixtures??[]});return{name:'table_plan',table:'table_plans',list:()=>[t(C.useFloor.getState().plans[e]??(0,C.planOf)(e))],key:()=>'plan',rowKey:()=>'plan',syncable:()=>!0,writable:()=>de('floor.manage'),filter:e=>e.eq('is_active',!0),deletes:!1,toRow:(e,a)=>({id:Oe??(0,se.uuidFrom)(`plan:${a}`),venue_id:a,name:'Main',is_active:!0,...t(e),updated_by:re.getState().staffRef??le}),fromRow:e=>(Oe=String(e.id),t({areas:e.areas,tables:e.tables,joins:e.joins,sections:e.sections,fixtures:e.fixtures})),apply:t=>{const a=t[0]?(0,ie.withSeedBest)(e,t[0]):void 0;a&&C.useFloor.setState(t=>({plans:{...t.plans,[e]:a}}))},subscribe:e=>C.useFloor.subscribe((t,a)=>{t.plans!==a.plans&&e()})}}function Ae(e){return{protect:!0,name:'stock_items',table:'stock_items',conflict:'venue_id,key',list:()=>T.useShellStore.getState().items[e]??[],key:e=>e.key,rowKey:e=>String(e.key),syncable:()=>!0,writable:()=>de('stock.manage'),matchKey:e=>({key:e}),toRow:(e,t)=>({venue_id:t,key:e.key,name:e.name,plural:e.plural,unit:e.unit,low_at:e.lowAt,supplier_id:e.supplierId?(0,$.isUuid)(e.supplierId)?e.supplierId:(0,se.uuidFrom)(`sup:${t}:${e.supplierId}`):null,icon:e.icon,sort:e.sort,active:e.active}),fromRow:e=>{return{key:e.key,name:e.name,plural:e.plural,unit:e.unit,lowAt:Number(e.low_at),icon:e.icon??'\u2022',sort:e.sort??0,active:!1!==e.active,...e.supplier_id?{supplierId:(t=String(e.supplier_id),Le.get(t)??t)}:{}};var t},apply:(t,a)=>T.useShellStore.setState(s=>{const i=new Set(a),n=new Map(t.map(e=>[e.key,e])),r=(s.items[e]??[]).filter(e=>!i.has(e.key)).map(e=>n.get(e.key)??e),o=new Set(r.map(e=>e.key));return{items:{...s.items,[e]:[...r,...t.filter(e=>!o.has(e.key))]}}}),subscribe:e=>T.useShellStore.subscribe((t,a)=>{t.items!==a.items&&e()})}}const Ue=new Set;function De(e){const t=new Date(Date.now()-2592e5).toISOString();return{name:'stock_events',table:'stock_events',mode:'insert',list:()=>T.useShellStore.getState().events.filter(t=>t.rid===e&&(0,$.isUuid)(t.id)),key:e=>e.id,rowKey:e=>String(e.id),syncable:t=>(0,$.isUuid)(t.id)&&!!(T.useShellStore.getState().items[e]??[]).find(e=>e.key===t.kind),writable:()=>'guest'!==re.getState().kind&&('device'!==re.getState().kind||de('device.write')),filter:e=>e.gte('at',t).order('at',{ascending:!1}),inWindow:e=>e.at>=t,toRow:(e,t)=>({id:e.id,venue_id:t,item:e.kind,delta:e.delta,reason:e.reason,undoes:e.undoes&&(0,$.isUuid)(e.undoes)?e.undoes:null,by_name:e.by||'Team',app:e.app,at:e.at}),fromRow:t=>(Ue.add(String(t.id)),{id:String(t.id),rid:e,kind:t.item,delta:Number(t.delta),reason:t.reason,by:t.by_name??'',app:t.app??'',at:new Date(t.at).toISOString(),...t.undoes?{undoes:String(t.undoes)}:{}}),apply:(e,t)=>T.useShellStore.setState(a=>{const s=new Set(t),i=new Map(e.map(e=>[e.id,e])),n=a.events.filter(e=>!s.has(e.id)).map(e=>i.get(e.id)??e),r=new Set(n.map(e=>e.id));return{events:[...e.filter(e=>!r.has(e.id)),...n].sort((e,t)=>t.at.localeCompare(e.at)).slice(0,500)}}),subscribe:e=>T.useShellStore.subscribe((t,a)=>{t.events!==a.events&&e()})}}function Ee(e){let t={};return{name:'stock_counts',table:'stock_counts',list:()=>Object.entries(T.useShellStore.getState().server[e]?.counts??{}).map(([e,t])=>({item:e,quantity:t})),key:e=>e.item,rowKey:e=>String(e.item),syncable:()=>!1,writable:()=>!1,toRow:()=>({}),fromRow:e=>({item:String(e.item),quantity:Number(e.quantity)}),apply:(a,s)=>{t={...T.useShellStore.getState().server[e]?.counts??{}};for(const e of s)delete t[e];for(const e of a)t[e.item]=e.quantity;T.useShellStore.setState(a=>({server:{...a.server,[e]:{counts:t,seen:[...Ue]}}}))},afterRead:()=>{T.useShellStore.getState().server[e]||T.useShellStore.setState(t=>({server:{...t.server,[e]:{counts:{},seen:[...Ue]}}}))},subscribe:()=>()=>{}}}const Ce=new Set;function Te(e){return{name:'recipe_cards',table:'recipe_cards',list:()=>{const t=U.useStore.getState().menu;return N.useCardStore.getState().cards.filter(t=>t.restaurantId===e).map(e=>({card:e,item:t.find(t=>t.id===e.menuItemId)}))},key:e=>e.card.id,rowKey:e=>String(e.id),syncable:t=>(0,$.isUuid)(t.card.id)&&!((0,d.isAnchorage)(e)&&(0,d.isDemoCard)(t.card)),writable:()=>de('recipes.edit'),toRow:(t,a)=>{let s=t.card;(0,d.isAnchorage)(e)&&(s={...s,signOff:(0,d.demoActor)(s.signOff?.by)?null:s.signOff,allergensConfirmed:(0,d.demoActor)(s.allergensConfirmed?.by)?void 0:s.allergensConfirmed});const i=t.item&&(0,d.isAnchorage)(e)&&(0,d.demoActor)(t.item.signOff?.by)?{...t.item,signOff:null}:t.item;if(s.photo?.startsWith('local:')){const e=(0,se.photoPath)(a,s),t=Ne(s.photo);t&&((0,N.cachePhotoAs)(e,t),Me(e,t)),s={...s,photo:e}}const{row:n,extra:r}=(0,se.cardToRow)(s,a);return{...n,...r,doc:ve({card:s,item:i})}},fromRow:t=>{const a=t.doc;if(!a?.card)return null;const s=t.signed_off_by&&t.signed_off_at?{by:t.signed_off_by,at:new Date(t.signed_off_at).toISOString()}:null;return{card:{...a.card,id:String(t.id),restaurantId:e,signOff:s&&a.card.signOff?a.card.signOff:s,...t.photo_url?{photo:t.photo_url}:{}},item:a.item?{...a.item,restaurantId:e,signOff:(0,d.isAnchorage)(e)&&(0,d.demoActor)(a.item.signOff?.by)?null:a.item.signOff}:void 0}},supersededBy:(e,t)=>t.some(t=>t.card.menuItemId===e.card.menuItemId&&t.card.id!==e.card.id),apply:(e,t)=>{if(!de('recipes.edit')&&t.length){const e=new Set(t);N.useCardStore.setState(t=>({cards:t.cards.map(t=>e.has(t.id)&&t.signOff?{...t,signOff:null}:t)})),t=[]}const a=new Set(t);N.useCardStore.setState(t=>{const s=new Map(e.map(e=>[e.card.id,e.card])),i=new Set(e.map(e=>e.card.menuItemId)),n=t.cards.filter(e=>a.has(e.id)).map(e=>e.menuItemId),r=t.cards.filter(e=>!a.has(e.id)&&(s.has(e.id)||!i.has(e.menuItemId))).map(e=>s.get(e.id)??e),o=new Set(r.map(e=>e.id));return n.length&&U.useStore.setState(e=>({menu:e.menu.map(e=>n.includes(e.id)?{...e,hidden:!0}:e)})),{cards:[...r,...e.filter(e=>!o.has(e.card.id)).map(e=>e.card)],removed:[...t.removed,...n]}});const s=e.map(e=>e.item).filter(Boolean);s.length&&U.useStore.setState(e=>{const t=new Map(s.map(e=>[e.id,e])),a=e.menu.map(e=>t.get(e.id)??e),i=new Set(a.map(e=>e.id));return{menu:[...a,...s.filter(e=>!i.has(e.id))]}})},subscribe:e=>{const t=N.useCardStore.subscribe((t,a)=>{t.cards!==a.cards&&e()}),a=U.useStore.subscribe((t,a)=>{t.menu!==a.menu&&e()});return()=>{t(),a()}}}}const Ne=e=>(0,N.readLocalPhoto)(e);async function Me(e,t){if(!Ce.has(e)){Ce.add(e);try{const a=await(await fetch(t)).blob(),{error:s}=await ne().storage.from(se.RECIPE_PHOTO_BUCKET).upload(e,a,{upsert:!0,contentType:a.type||'image/jpeg'});if(s)throw s}catch(t){Ce.delete(e),oe({lastError:`Photo upload: ${String(t?.message??t)}`})}}}const Ke=new Map,xe=(0,y.create)(()=>({n:0}));(0,N.setStoragePhotoResolver)(e=>{const t=Ke.get(e);return t&&Date.now()-t.at<3e6?t.url:(0,v.isSupabaseConfigured)()&&'off'!==re.getState().mode?(t||(Ke.set(e,{url:'',at:Date.now()}),ne().storage.from(se.RECIPE_PHOTO_BUCKET).createSignedUrl(e,3600).then(({data:t})=>{t?.signedUrl&&(Ke.set(e,{url:t.signedUrl,at:Date.now()}),xe.setState(e=>({n:e.n+1})),N.useCardStore.setState(e=>({cards:[...e.cards]})))}).catch(()=>{})),t?.url||null):null});const Le=new Map;const qe=(e,t)=>{const a=(0,$.isUuid)(t)?t:(0,se.uuidFrom)(`sup:${e}:${t}`);return Le.set(a,t),a};function Pe(e){return{name:'order_sheets',table:'suppliers',list:()=>M.useOrderSheets.getState().sheets[e]??[],key:e=>e.id,rowKey:e=>String(e.doc?.localId??e.id),syncable:t=>!((0,d.isAnchorage)(e)&&'os-veg'===t.id&&t.placeholder),writable:()=>de('suppliers.manage'),toRow:(e,t)=>({id:qe(t,e.id),venue_id:t,name:e.name||'Supplier',category:e.goods||null,contact:e.contact??null,phones:e.number?[e.number]:[],website:e.url||null,cutoff:e.cutoff||null,order_days:e.orderDays,delivery_days:e.deliveryDays,notes:e.notes||null,doc:{kind:'sheet',localId:e.id,sheet:ve(e)}}),fromRow:e=>'sheet'!==e.doc?.kind?null:(Le.set(String(e.id),String(e.doc.localId)),e.doc.sheet),apply:(t,a)=>M.useOrderSheets.setState(s=>{const i=new Set(a),n=new Map(t.map(e=>[e.id,e])),r=(s.sheets[e]??[]).filter(e=>!i.has(e.id)).map(e=>n.get(e.id)??e),o=new Set(r.map(e=>e.id));return{sheets:{...s.sheets,[e]:[...r,...t.filter(e=>!o.has(e.id))]}}}),subscribe:e=>M.useOrderSheets.subscribe((t,a)=>{t.sheets!==a.sheets&&e()}),matchKey:e=>({id:(0,$.isUuid)(e)?e:(0,se.uuidFrom)(`sup:${re.getState().venueId}:${e}`)})}}let $e=!1,je=!1;const Be=new Map,Fe=new Map,We=new Map,Ve=new Map,He=e=>'owner'===e.role?'owner':'manager'===e.role?'Supervisor'===e.level?'supervisor':'manager':'Head Chef'===e.level?'head_chef':'staff',Ge=e=>'owner'===e?{role:'owner',level:'Owner'}:'manager'===e?{role:'manager',level:'Manager'}:'supervisor'===e?{role:'manager',level:'Supervisor'}:'head_chef'===e?{role:'staff',level:'Head Chef'}:{role:'staff',level:'Staff'},Qe=(e,t)=>t&&'owner'!==e.role&&'manager'!==e.role?{role:'manager',level:e.level,managerAccess:!0}:{...e,managerAccess:void 0},Je=e=>ve({id:e.id,name:e.name,role:e.role,job:e.job,active:e.active,level:e.level??Ge(He(e)).level,dept:e.dept??'',nickname:e.nickname,displayClock:e.displayClock,temp:e.temp,tempUntil:e.tempUntil,managerAccess:e.managerAccess||void 0,ownerAccess:e.ownerAccess||void 0,...e.temp&&e.tempUntil&&e.tempUntil(new Date).toLocaleDateString('en-CA',{timeZone:'Europe/London'});const Ze=(e=new Date)=>{const t=new Date(e);return t.setDate(t.getDate()-(t.getDay()+6)%7),t.toISOString().slice(0,10)},Xe=e=>{const t=Math.round(60*e)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`};function Ye(){return{name:'rota',table:'rota_shifts',list:()=>P.useOwner.getState().shifts,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id)&&Be.has(e.staffId),writable:()=>de('rota.manage'),toRow:(e,t)=>({id:e.id,venue_id:t,staff_id:Be.get(e.staffId),staff_ref:e.staffId,shift_date:e.date??(()=>{const t=new Date(Ze());return t.setDate(t.getDate()+(e.day??0)),t.toISOString().slice(0,10)})(),start_time:Xe(e.start),end_time:Xe(e.end),published:!!e.published,doc:ve(e)}),fromRow:e=>{if(!e.doc)return null;const t=e.doc,a=t.date??String(e.shift_date).slice(0,10),[s,i,n]=a.split('-').map(Number);return{...t,id:String(e.id),date:a,day:(new Date(s,i-1,n).getDay()+6)%7,published:!!e.published}},apply:(e,t)=>P.useOwner.setState(a=>{const s=new Set(t),i=new Map(e.map(e=>[e.id,e])),n=a.shifts.filter(e=>!s.has(e.id)).map(e=>i.get(e.id)??e),r=new Set(n.map(e=>e.id));return{shifts:[...n,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>P.useOwner.subscribe((t,a)=>{t.shifts!==a.shifts&&e()})}}function et(){const t=he(62),a=e=>de('rota.manage')||e.staffId===re.getState().staffRef;return{name:'attendance',table:'attendance',list:()=>P.useOwner.getState().attendance,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id)&&a(e),writable:()=>'staff'===re.getState().kind,filter:e=>e.gte('work_date',t),inWindow:e=>e.date>=t,toRow:(t,a)=>({id:t.id,venue_id:a,staff_id:Be.get(t.staffId)??null,staff_ref:t.staffId,work_date:t.date,clock_in:t.in??null,clock_out:t.out??null,breaks:ve(t.breaks??[]),break_mins:t.breakMins??0,doc:ve((0,u.privateAttendance)(e.VENUE_RID,t))}),fromRow:t=>{if(!t.doc)return null;const a=(0,u.privateAttendance)(e.VENUE_RID,{...t.doc,id:String(t.id)});return'confirmed'===t.status?a.signOff={by:String(t.confirmed_by_name??a.signOff?.by??'Manager'),byId:a.signOff?.byId??'',at:t.confirmed_at?new Date(t.confirmed_at).toISOString():a.signOff?.at??''}:delete a.signOff,a},apply:(e,t)=>P.useOwner.setState(a=>{const s=new Set(t),i=new Map(e.map(e=>[e.id,e])),n=a.attendance.filter(e=>!s.has(e.id)).map(e=>i.get(e.id)??e),r=new Set(n.map(e=>e.id));return{attendance:[...n,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>P.useOwner.subscribe((t,a)=>{t.attendance!==a.attendance&&e()})}}function tt(){const e=he(62);return{name:'time_requests',table:'time_requests',mode:'insert',deletes:!1,list:()=>P.useOwner.getState().timeRequests,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id)&&e.staffId===re.getState().staffRef&&'open'===e.status,writable:()=>'staff'===re.getState().kind,filter:t=>t.gte('work_date',e),inWindow:t=>t.date>=e,toRow:(e,t)=>({id:e.id,venue_id:t,staff_id:Be.get(e.staffId)??null,staff_ref:e.staffId,work_date:e.date,attendance_id:e.attendanceId&&(0,$.isUuid)(e.attendanceId)?e.attendanceId:null,kind:e.kind,suggested_in:e.suggestedIn??null,suggested_out:e.suggestedOut??null,note:(e.note??'').slice(0,300)||null,status:'open',doc:ve({...e,status:'open'})}),fromRow:e=>{const t=e.doc??{};return{...t,id:String(e.id),staffId:String(e.staff_ref),date:String(e.work_date).slice(0,10),attendanceId:e.attendance_id?String(e.attendance_id):t.attendanceId,kind:e.kind,suggestedIn:e.suggested_in?new Date(e.suggested_in).toISOString():void 0,suggestedOut:e.suggested_out?new Date(e.suggested_out).toISOString():void 0,note:e.note??'',at:t.at??new Date(e.created_at).toISOString(),status:e.status,resolvedBy:e.resolved_by_name??void 0,resolvedAt:e.resolved_at?new Date(e.resolved_at).toISOString():void 0}},apply:(e,t)=>P.useOwner.setState(a=>{const s=new Set(t),i=new Map(e.map(e=>[e.id,e])),n=a.timeRequests.filter(e=>!s.has(e.id)).map(e=>i.get(e.id)??e),r=new Set(n.map(e=>e.id));return{timeRequests:[...e.filter(e=>!r.has(e.id)),...n]}}),subscribe:e=>P.useOwner.subscribe((t,a)=>{t.timeRequests!==a.timeRequests&&e()})}}function at(t){P.timesheetRemote.send=(a,s)=>{if(!de('rota.manage')||!(0,$.isUuid)(s.id))return!1;if('time_request_resolve'===a){const e=s;return R.mutationQueue.enqueue({table:'time_requests',venueId:t,kind:'rpc',fn:a,rowKey:e.id,values:{p_id:e.id,p_status:e.status,p_doc:ve(e)}}),!0}const i=s;if('attendance_confirm'===a)return R.mutationQueue.enqueue({table:'attendance',venueId:t,kind:'rpc',fn:a,rowKey:i.id,values:{p_id:i.id,p_doc:ve((0,u.privateAttendance)(e.VENUE_RID,i))}}),!0;if(!i.in)return!1;const n=i.adjusted?.reason??'';return R.mutationQueue.enqueue({table:'attendance',venueId:t,kind:'rpc',fn:'attendance_override',rowKey:i.id,values:{p_id:i.id,p_venue:t,p_staff_ref:i.staffId,p_work_date:i.date,p_clock_in:i.in,p_clock_out:i.out??null,p_break_mins:i.breakMins??0,p_breaks:ve(i.breaks??[]),p_reason:n,p_doc:ve((0,u.privateAttendance)(e.VENUE_RID,i))}}),!0},me.push(()=>{P.timesheetRemote.send=null})}function st(e){return{name:'outbox',table:'outbox',mode:'insert',list:()=>U.useStore.getState().outbox.filter(t=>t.restaurantId===e),key:e=>e.id,rowKey:e=>String(e.local_id??e.id),syncable:()=>!0,writable:()=>'staff'===re.getState().kind,filter:e=>e.gte('created_at',new Date(Date.now()-2592e6).toISOString()),inWindow:()=>!1,toRow:(e,t)=>{return{id:(a=e.id,(0,$.isUuid)(a)?a:(0,se.uuidFrom)(`outbox:${a}`)),local_id:e.id,venue_id:t,channel:e.channel,kind:e.kind,to_address:e.to||'',to_name:e.toName||null,subject:e.subject??null,body:e.body,html:e.html??null,ref_type:e.refType,ref_id:(0,$.isUuid)(e.refId)?e.refId:null,ref:e.ref,status:e.status,provider:e.provider,error:e.error??null,created_at:e.at,doc:ve(e)};var a},fromRow:t=>t.doc?{...t.doc,restaurantId:e}:null,apply:e=>U.useStore.setState(t=>{const a=new Set(t.outbox.map(e=>e.id));return{outbox:[...e.filter(e=>!a.has(e.id)),...t.outbox].sort((e,t)=>t.at.localeCompare(e.at)).slice(0,300)}}),subscribe:e=>U.useStore.subscribe((t,a)=>{t.outbox!==a.outbox&&e()})}}const it=e=>U.useStore.getState().events.filter(t=>t.restaurantId===e&&!t.example);function nt(e,t){if(!Array.isArray(t))return;const a=t.filter(e=>e&&'string'==typeof e.id&&'string'==typeof e.date&&'string'==typeof e.title).map(t=>({...t,restaurantId:e,example:!1}));U.useStore.setState(t=>({events:[...t.events.filter(t=>!(t.restaurantId===e&&!t.example)),...a]}))}function rt(e){return{name:'venue',table:'venues',venueColumn:'id',mode:'update',list:()=>{const t=U.useStore.getState(),a=t.restaurants.find(t=>t.id===e);return[ve({restaurant:a,msgTemplates:t.msgTemplates[e]??{},display:C.useFloor.getState().settings[e]??{},games:!1!==a?.settings?.games,events:it(e)})]},key:()=>'venue',rowKey:()=>'venue',syncable:()=>!0,writable:()=>de('venue.settings'),matchKey:()=>({}),toRow:e=>({name:e.restaurant?.name,settings:{...dt??{},whatsapp:e.restaurant?.settings?.whatsapp||null,app:{...dt?.app??{},restaurant:e.restaurant,events:e.events??[]},ops:{...dt?.ops??{},msgTemplates:e.msgTemplates,display:e.display}},feature_flags:{...ot??{},games:e.games,takeaway:!e.restaurant?.settings?.takeawayPaused}}),fromRow:t=>{ot=t.feature_flags??{},dt=t.settings??{};const a=t.settings?.app?.restaurant;if(!a)return null;const s='string'==typeof t.settings?.whatsapp?t.settings.whatsapp:void 0;return s&&!a.settings?.whatsapp&&(a.settings={...a.settings,whatsapp:s}),ve({restaurant:{...a,id:e},msgTemplates:t.settings?.ops?.msgTemplates??{},display:t.settings?.ops?.display??{},games:!1!==t.feature_flags?.games,...Array.isArray(t.settings?.app?.events)?{events:t.settings.app.events}:{}})},apply:t=>{const s=t[0];s&&(U.useStore.setState(t=>({restaurants:t.restaurants.map(t=>t.id===e&&s.restaurant?(0,a.withWildingsAddress)({...s.restaurant,id:e,settings:{...s.restaurant.settings,games:s.games}}):t),msgTemplates:{...t.msgTemplates,[e]:s.msgTemplates??{}}})),s.display&&Object.keys(s.display).length&&C.useFloor.setState(t=>({settings:{...t.settings,[e]:s.display}})),s.events&&nt(e,s.events))},subscribe:e=>{const t=U.useStore.subscribe((t,a)=>{t.restaurants===a.restaurants&&t.msgTemplates===a.msgTemplates&&t.events===a.events||e()}),a=C.useFloor.subscribe((t,a)=>{t.settings!==a.settings&&e()});return()=>{t(),a()}}}}let ot=null,dt=null;const ut=()=>new Date(Date.now()-2592e6).toISOString(),lt=e=>{if(!e.startsWith('dm:'))return['all','kitchen','foh','managers'].includes(e)?e:null;const t=e.split(':').slice(1).map(e=>Be.get(e));return 2===t.length&&t[0]&&t[1]?`dm:${[t[0],t[1]].sort().join(':')}`:null},ct=e=>{if(!e.startsWith('dm:'))return e;const t=e.split(':').slice(1).map(e=>Fe.get(e));return 2===t.length&&t[0]&&t[1]?(0,X.dmId)(t[0],t[1]):null},ft=()=>re.getState().perms.includes('*');function pt(){const e=()=>re.getState().staffRef;return{name:'chat',table:'chat_messages',deletes:!1,list:()=>P.useOwner.getState().chat.filter(e=>(0,$.isUuid)(e.id)).map(e=>ve({id:e.id,ch:e.ch,from:e.from,text:e.text,photo:e.photo,at:e.at,removed:!!e.removed})),key:e=>e.id,rowKey:e=>String(e.id),syncable:t=>!!lt(t.ch)&&(t.from===e()||ft()&&!t.ch.startsWith('dm:')&&t.removed),writable:()=>'staff'===re.getState().kind,filter:e=>e.gte('created_at',ut()).order('created_at',{ascending:!1}),inWindow:e=>e.at>=ut(),toRow:(e,t)=>{const a=lt(e.ch);if(!a)throw new Error('chat: unknown person');const s='system'===e.from?null:Be.get(e.from)??null;return{id:e.id,venue_id:t,channel:a,from_staff:s,body:e.text??null,photo:e.photo??null,removed:e.removed,created_at:e.at}},fromRow:e=>{const t=ct(String(e.channel));if(!t)return null;const a=e.from_staff?Fe.get(String(e.from_staff)):'system';return a?ve({id:String(e.id),ch:t,from:a,text:e.body??void 0,photo:e.photo??void 0,at:new Date(e.created_at).toISOString(),removed:!!e.removed}):null},apply:(t,a)=>P.useOwner.setState(s=>{const i=new Set(a),n=new Map(t.map(e=>[e.id,e])),r=e(),o=s.chat.filter(e=>!i.has(e.id)).map(e=>n.has(e.id)?{...e,...n.get(e.id)}:e),d=new Set(o.map(e=>e.id)),u=t.filter(e=>!d.has(e.id)).map(e=>({...e,reactions:{},seenBy:e.from===r?[e.from]:[]}));return{chat:u.length?[...o,...u].sort((e,t)=>e.at.localeCompare(t.at)):o}}),subscribe:e=>P.useOwner.subscribe((t,a)=>{t.chat!==a.chat&&e()}),onRemote:(t,a)=>{if('upsert'!==a||t.removed)return;const s=t.from_staff?Fe.get(String(t.from_staff)):'system',i=ct(String(t.channel)),n=e();if(!i||!n||s===n||Date.now()-new Date(t.created_at).getTime()>12e4)return;const r=P.useOwner.getState();if((r.chatMuted[n]??[]).includes(i))return;if(!(0,X.inChannel)(i,r.staff.find(e=>e.id===n)))return;if((0,Y.soundAllowed)())try{(0,Y.chime)('soft')}catch{}const o=r.staff.find(e=>e.id===s)?.name?.replace(' (example)','')??'The team',d=i.startsWith('dm:')?'sent you a message':`in ${'all'===i?'Everyone':'foh'===i?'Front of house':'kitchen'===i?'Kitchen':'managers'===i?'Managers':i}`,u=String(t.body??t.text??'').slice(0,120);(0,c.notify)({id:`chat:${t.id}`,icon:'\ud83d\udcac',kicker:'NEW MESSAGE',title:`${o} ${d}`,body:u||void 0,timeoutMs:7e3,testID:'chat-notice'})}}}function mt(e){return{name:'reminders',table:'venue_reminders',list:()=>{const t=S.useReminders.getState(),a=t.reminders.filter(t=>t.rid===e&&(0,$.isUuid)(t.id)).map(e=>{const{rid:t,...a}=e;return{id:e.id,kind:'reminder',doc:ve(a)}}),s=t.rules[e];return s?[...a,{id:s.id,kind:'break_rules',doc:ve(s)}]:a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id),writable:()=>de('venue.settings'),toRow:(e,t)=>({id:e.id,venue_id:t,kind:e.kind,doc:e.doc,updated_at:(new Date).toISOString()}),fromRow:e=>({id:String(e.id),kind:'break_rules'===e.kind?'break_rules':'reminder',doc:e.doc??{}}),apply:(t,a)=>S.useReminders.setState(s=>{const i=new Set(a),n={...s.rules},r=t.filter(e=>'break_rules'===e.kind);for(const t of r)n[e]={...(0,h.clampRules)(t.doc),id:t.id,updatedAt:t.doc.updatedAt};n[e]&&i.has(n[e].id)&&delete n[e];const o=new Map(t.filter(e=>'reminder'===e.kind).map(t=>[t.id,{...t.doc,id:t.id,rid:e}])),d=s.reminders.filter(e=>!i.has(e.id)).map(e=>o.get(e.id)??e),u=new Set(d.map(e=>e.id));return{rules:n,reminders:[...d,...[...o.values()].filter(e=>!u.has(e.id))]}}),subscribe:e=>S.useReminders.subscribe((t,a)=>{t.reminders===a.reminders&&t.rules===a.rules||e()})}}function gt(e){const t=he(14);return{name:'reminder_done',table:'reminder_done',mode:'insert',deletes:!1,list:()=>S.useReminders.getState().done.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id)&&(0,$.isUuid)(e.reminderId)&&e.staffRef===re.getState().staffRef,writable:()=>'staff'===re.getState().kind,filter:e=>e.gte('for_date',t).order('done_at',{ascending:!1}),inWindow:e=>e.forDate>=t,toRow:(e,t)=>({id:e.id,venue_id:t,reminder_id:e.reminderId,for_date:e.forDate,staff_ref:e.staffRef,staff_name:e.staffName.slice(0,80),done_at:e.at}),fromRow:t=>({id:String(t.id),rid:e,reminderId:String(t.reminder_id),forDate:String(t.for_date).slice(0,10),staffRef:t.staff_ref??'',staffName:t.staff_name??'Team',at:new Date(t.done_at).toISOString()}),apply:(e,t)=>S.useReminders.setState(a=>{const s=new Set(t),i=new Map(e.map(e=>[e.id,e])),n=a.done.filter(e=>!s.has(e.id)).map(e=>i.get(e.id)??e),r=new Set(n.map(e=>e.id));return{done:[...e.filter(e=>!r.has(e.id)),...n].sort((e,t)=>t.at.localeCompare(e.at)).slice(0,400)}}),subscribe:e=>S.useReminders.subscribe((t,a)=>{t.done!==a.done&&e()})}}function _t(e,t,a,s=()=>!0){const i=new Set(a),n=new Map(t.map(e=>[e.id,e])),r=e.filter(e=>!s(e)||!i.has(e.id)).map(e=>s(e)&&n.has(e.id)?n.get(e.id):e),o=new Set(r.map(e=>e.id));return[...r,...t.filter(e=>!o.has(e.id))]}const St=e=>null==e||''===e?null:Number(e),ht=e=>e.filter(e=>!e.startsWith('data:'));function yt(e){return{name:'cash_ups',table:'cash_ups',list:()=>B.useCashUp.getState().cashUps.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id)&&!!e.confirmedAt,writable:()=>de('wages.manage')||(0,l.hasCashUpAccess)(),deletes:!1,filter:e=>e.gte('for_date',he(400)),toRow:(e,t)=>({id:e.id,venue_id:t,for_date:e.date,vals:ve(e.vals),cash_tips:'number'==typeof e.vals.cashTips?e.vals.cashTips:null,card_tips:'number'==typeof e.vals.cardTips?e.vals.cardTips:null,photos:ht(e.photos),read_by:e.readBy??null,confirmed_by:e.confirmedBy??null,confirmed_at:e.confirmedAt??null,updated_at:(new Date).toISOString()}),fromRow:t=>({id:String(t.id),rid:e,date:String(t.for_date),vals:t.vals??{},photos:t.photos??[],readBy:t.read_by??null,confirmedBy:t.confirmed_by??void 0,confirmedAt:t.confirmed_at??void 0,onServer:!0,unlockedUntil:t.unlocked_until??void 0,unlockedBy:t.unlocked_by??void 0}),apply:(t,a)=>B.useCashUp.setState(s=>({cashUps:_t(s.cashUps,t.map(e=>{const t=s.cashUps.find(t=>t.id===e.id);return t&&!e.photos.length?{...e,photos:t.photos}:e}),a,t=>t.rid===e)})),subscribe:e=>B.useCashUp.subscribe((t,a)=>{t.cashUps!==a.cashUps&&e()})}}function wt(e){return{name:'sales_reports',table:'sales_reports',list:()=>B.useCashUp.getState().sales.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id)&&!!e.confirmedAt,writable:()=>de('wages.manage')||(0,l.hasCashUpAccess)(),deletes:!1,toRow:(e,t)=>({id:e.id,venue_id:t,week_start:e.weekStart,vals:ve(e.vals),categories:e.categories,photos:ht(e.photos),read_by:e.readBy??null,confirmed_by:e.confirmedBy??null,confirmed_at:e.confirmedAt??null,updated_at:(new Date).toISOString()}),fromRow:t=>({id:String(t.id),rid:e,weekStart:String(t.week_start),vals:t.vals??{},categories:t.categories??[],photos:t.photos??[],readBy:t.read_by??null,confirmedBy:t.confirmed_by??void 0,confirmedAt:t.confirmed_at??void 0,onServer:!0,unlockedUntil:t.unlocked_until??void 0,unlockedBy:t.unlocked_by??void 0}),apply:(t,a)=>B.useCashUp.setState(s=>({sales:_t(s.sales,t.map(e=>{const t=s.sales.find(t=>t.id===e.id);return t&&!e.photos.length?{...e,photos:t.photos}:e}),a,t=>t.rid===e)})),subscribe:e=>B.useCashUp.subscribe((t,a)=>{t.sales!==a.sales&&e()})}}function vt(e){return{name:'cashup_settings',table:'cashup_settings',conflict:'venue_id',list:()=>{const t=B.useCashUp.getState().settings[e];return t?[t]:[]},key:e=>e.id,rowKey:()=>(0,B.cashSettingsId)(e),syncable:e=>!!e.updatedAt,writable:()=>de('wages.manage'),deletes:!1,toRow:(e,t)=>({venue_id:t,doc:ve({cashFields:e.cashFields,salesFields:e.salesFields}),updated_at:(new Date).toISOString()}),fromRow:t=>({...t.doc,id:(0,B.cashSettingsId)(e),updatedAt:t.updated_at??void 0}),apply:t=>B.useCashUp.setState(a=>t[0]?{settings:{...a.settings,[e]:t[0]}}:a),subscribe:e=>B.useCashUp.subscribe((t,a)=>{t.settings!==a.settings&&e()})}}function bt(e){return{name:'day_tips',table:'day_tips',list:()=>B.useCashUp.getState().tips.filter(t=>t.rid===e).map(e=>({...e,id:e.date})),key:e=>e.id,rowKey:e=>String(e.for_date),syncable:()=>!1,writable:()=>!1,deletes:!1,filter:e=>e.gte('for_date',he(120)),toRow:()=>({}),fromRow:t=>({id:String(t.for_date),rid:e,date:String(t.for_date),total:Number(t.total),postedAt:String(t.posted_at),postedBy:t.posted_by??void 0}),apply:t=>B.useCashUp.setState(a=>{const s=new Map(t.map(e=>[e.date,e])),i=a.tips.filter(t=>!(t.rid===e&&s.has(t.date)));return{tips:[...t.map(({id:e,...t})=>t),...i]}}),subscribe:e=>B.useCashUp.subscribe((t,a)=>{t.tips!==a.tips&&e()})}}function kt(e){return{name:'tips_pot_events',table:'tips_pot_events',mode:'insert',deletes:!1,list:()=>B.useCashUp.getState().pot.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id),writable:()=>de('wages.manage'),toRow:(e,t)=>({id:e.id,venue_id:t,kind:e.kind,for_date:e.forDate??null,through_date:e.throughDate??null,amount:e.amount,reason:e.reason??null,by_name:e.by,at:e.at}),fromRow:t=>({id:String(t.id),rid:e,kind:'payout'===t.kind?'payout':'correction',forDate:t.for_date??void 0,throughDate:t.through_date??void 0,amount:St(t.amount)??0,reason:t.reason??void 0,by:String(t.by_name),at:String(t.at)}),apply:(t,a)=>B.useCashUp.setState(s=>({pot:_t(s.pot,t,a,t=>t.rid===e)})),subscribe:e=>B.useCashUp.subscribe((t,a)=>{t.pot!==a.pot&&e()})}}function It(e){return{name:'tips_settings',table:'tips_settings',conflict:'venue_id',deletes:!1,list:()=>{const t=B.useCashUp.getState().show[e];return t?[{id:'show',...t}]:[]},key:e=>e.id,rowKey:()=>'show',syncable:()=>!0,writable:()=>de('wages.manage'),toRow:(e,t)=>({venue_id:t,show_today:e.showToday,show_pot:e.showPot,updated_at:(new Date).toISOString()}),fromRow:e=>({id:'show',showToday:!1!==e.show_today,showPot:!1!==e.show_pot}),apply:t=>B.useCashUp.setState(a=>t[0]?{show:{...a.show,[e]:{showToday:t[0].showToday,showPot:t[0].showPot}}}:a),subscribe:e=>B.useCashUp.subscribe((t,a)=>{t.show!==a.show&&e()})}}function Ot(e){return{name:'scheduled_notifications',table:'scheduled_notifications',list:()=>j.useNotifs.getState().items.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id),writable:()=>de('venue.settings'),deletes:!1,toRow:(e,t)=>{const{rid:a,...s}=e;return{id:e.id,venue_id:t,doc:ve(s),updated_at:(new Date).toISOString()}},fromRow:t=>({...t.doc,id:String(t.id),rid:e}),apply:(t,a)=>j.useNotifs.setState(s=>({items:_t(s.items,t,a,t=>t.rid===e)})),subscribe:e=>j.useNotifs.subscribe((t,a)=>{t.items!==a.items&&e()})}}function Rt(e){return{name:'order_lists',table:'order_lists',list:()=>{const t=F.useOrderLists.getState(),a=t.lists.filter(t=>t.rid===e&&(0,$.isUuid)(t.id)).map(e=>{const{rid:t,...a}=e;return{id:e.id,kind:'list',doc:ve(a)}}),s=t.settings[e];return s?[...a,{id:s.id,kind:'settings',doc:ve(s)}]:a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id),writable:()=>de('venue.settings')||de('suppliers.order'),deletes:!1,toRow:(e,t)=>({id:e.id,venue_id:t,kind:e.kind,doc:e.doc,updated_at:(new Date).toISOString()}),fromRow:e=>({id:String(e.id),kind:'settings'===e.kind?'settings':'list',doc:e.doc??{}}),apply:(t,a)=>F.useOrderLists.setState(s=>{const i={...s.settings};for(const a of t.filter(e=>'settings'===e.kind))i[e]={...W.DEFAULT_ORDER_LIST_SETTINGS,...a.doc,id:a.id};const n=t.filter(e=>'list'===e.kind).map(t=>({...t.doc,id:t.id,rid:e}));return{settings:i,lists:_t(s.lists,n,a,t=>t.rid===e)}}),subscribe:e=>F.useOrderLists.subscribe((t,a)=>{t.lists===a.lists&&t.settings===a.settings||e()})}}function At(e){const t=()=>de('venue.settings')||de('suppliers.order');return{name:'order_list_items',table:'order_list_items',list:()=>F.useOrderLists.getState().items.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:a=>(0,$.isUuid)(a.id)&&(0,$.isUuid)(a.listId)&&(t()||'open'===a.status&&(0,F.orderSettingsOf)(e).allowStaff),writable:()=>'staff'===re.getState().kind,deletes:!0,toRow:(e,a)=>{const{rid:s,...i}=e;return{id:e.id,venue_id:a,list_id:e.listId,status:e.status,added_by_ref:(t()?e.addedBy:re.getState().staffRef)||null,doc:ve(i),updated_at:(new Date).toISOString()}},fromRow:t=>({...t.doc,id:String(t.id),listId:String(t.list_id),status:t.status??'open',rid:e}),apply:(t,a)=>F.useOrderLists.setState(s=>({items:_t(s.items,t,a,t=>t.rid===e)})),subscribe:e=>F.useOrderLists.subscribe((t,a)=>{t.items!==a.items&&e()})}}function Ut(e){const t=he(400);return{name:'order_list_history',table:'order_list_history',mode:'insert',deletes:!1,list:()=>F.useOrderLists.getState().history.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id),writable:()=>de('venue.settings')||de('suppliers.order'),filter:e=>e.gte('finished_at',t).order('finished_at',{ascending:!1}).limit(300),toRow:(e,t)=>{const{rid:a,...s}=e;return{id:e.id,venue_id:t,list_id:e.listId,finished_at:e.finishedAt,finished_by:e.finishedByName.slice(0,80),doc:ve(s)}},fromRow:t=>({...t.doc,id:String(t.id),rid:e}),apply:(t,a)=>F.useOrderLists.setState(s=>({history:_t(s.history,t,a,t=>t.rid===e).sort((e,t)=>t.finishedAt.localeCompare(e.finishedAt)).slice(0,300)})),subscribe:e=>F.useOrderLists.subscribe((t,a)=>{t.history!==a.history&&e()})}}function Dt(e){return{name:'venue_clock_area',table:'venue_clock_area',conflict:'venue_id',deletes:!1,list:()=>{const t=V.useClockArea.getState().areas[e];return t&&t.updatedAt?[{id:'area',doc:ve(t)}]:[]},key:()=>'area',rowKey:()=>'area',syncable:()=>!0,matchKey:()=>({}),writable:()=>de('venue.settings'),toRow:(e,t)=>({venue_id:t,doc:e.doc,updated_at:(new Date).toISOString()}),fromRow:e=>({id:'area',doc:e.doc??{}}),apply:t=>{const a=t[0];a&&V.useClockArea.setState(t=>({areas:{...t.areas,[e]:{...(0,u.venueClockArea)(e,a.doc),updatedAt:a.doc.updatedAt,updatedBy:a.doc.updatedBy}}}))},subscribe:e=>V.useClockArea.subscribe((t,a)=>{t.areas!==a.areas&&e()})}}function Et(e){return{name:'daily_tasks',table:'daily_tasks',deletes:!1,list:()=>{const t=J.useDailyTasks.getState(),a=[],s=t.library[e];s?.updatedAt&&a.push({id:(0,J.libraryRowId)(e),kind:'library',doc:ve({items:s.items,updatedAt:s.updatedAt})});for(const[s,i]of Object.entries(t.people)){const[t,n]=s.split('|');t===e&&i.updatedAt&&a.push({id:(0,J.personRowId)(e,n),kind:'person',staffRef:n,doc:ve({tasks:i.tasks,updatedAt:i.updatedAt})})}return a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>{const t=P.useOwner.getState().staff.find(e=>e.id===re.getState().staffRef);if(!t)return!1;if('staff'!==t.role)return!0;if('person'!==e.kind)return!1;const a=P.useOwner.getState().staff.find(t=>t.id===e.staffRef);return!!a&&(0,z.canEditTasks)(t,a)},writable:()=>'staff'===re.getState().kind,toRow:(e,t)=>({id:e.id,venue_id:t,kind:e.kind,staff_ref:e.staffRef??null,doc:e.doc,updated_at:(new Date).toISOString()}),fromRow:e=>({id:String(e.id),kind:'library'===e.kind?'library':'person',staffRef:e.staff_ref??void 0,doc:e.doc??{}}),apply:t=>J.useDailyTasks.setState(a=>{const s={...a.library},i={...a.people};for(const a of t)'library'===a.kind?s[e]={items:a.doc.items??[],updatedAt:a.doc.updatedAt}:a.staffRef&&(i[(0,J.personKey)(e,a.staffRef)]={tasks:a.doc.tasks??[],updatedAt:a.doc.updatedAt});return{library:s,people:i}}),subscribe:e=>J.useDailyTasks.subscribe((t,a)=>{t.library===a.library&&t.people===a.people||e()})}}function Ct(e){const t=he(7);return{name:'daily_task_ticks',table:'daily_task_ticks',list:()=>J.useDailyTasks.getState().ticks.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>{const t=re.getState();return e.byRef===t.staffRef||de('staff.manage')},writable:()=>'staff'===re.getState().kind,filter:e=>e.gte('for_date',t),inWindow:e=>e.forDate>=t,toRow:(e,t)=>({id:e.id,venue_id:t,staff_ref:e.staffRef,task_id:e.taskId,for_date:e.forDate,ticked_by_ref:e.byRef,ticked_by_name:e.byName.slice(0,80),ticked_at:e.at}),fromRow:t=>({id:String(t.id),rid:e,staffRef:String(t.staff_ref),taskId:String(t.task_id),forDate:String(t.for_date).slice(0,10),byRef:String(t.ticked_by_ref??''),byName:String(t.ticked_by_name??''),at:String(t.ticked_at)}),apply:(t,a)=>J.useDailyTasks.setState(s=>({ticks:_t(s.ticks,t,a,t=>t.rid===e)})),subscribe:e=>J.useDailyTasks.subscribe((t,a)=>{t.ticks!==a.ticks&&e()})}}function Tt(e,t=!1){const a=he(14);return{name:'sold_out_items',table:'sold_out_items',conflict:'venue_id,item_id',list:()=>ee.useSoldOut.getState().entries.filter(t=>t.rid===e),key:e=>e.itemId,rowKey:e=>String(e.item_id),syncable:()=>!0,deletes:!1,writable:()=>'staff'===re.getState().kind,filter:e=>e.gte('marked_at',a),inWindow:e=>e.at.slice(0,10)>=a,toRow:(e,a)=>({id:(0,se.uuidFrom)(`soldout:${a}:${e.itemId}`),venue_id:a,item_id:e.itemId.slice(0,80),name:e.name.slice(0,120),is_on:e.on,marked_at:e.at,by_name:(e.by||'Staff').slice(0,80),clear_after:e.clearAfter??null,...t?{auto:!!e.auto,kept:!!e.kept}:{}}),fromRow:a=>({rid:e,itemId:String(a.item_id),name:String(a.name??''),on:!0===a.is_on,at:String(a.marked_at),by:String(a.by_name??''),clearAfter:a.clear_after?String(a.clear_after):void 0,...t?{auto:!0===a.auto,kept:!0===a.kept}:{}}),apply:(t,a)=>ee.useSoldOut.setState(s=>{const i=new Set(a);return{entries:[...s.entries.filter(a=>!(a.rid===e&&(i.has(a.itemId)||t.some(e=>{return s=a,(t=e).rid===s.rid&&t.itemId===s.itemId;var t,s})))),...t]}}),subscribe:e=>ee.useSoldOut.subscribe((t,a)=>{t.entries!==a.entries&&e()}),afterRead:()=>{te.autoSync.soldOutRead.add(e)}}}function Nt(e){return{name:'sold_out_links',table:'sold_out_links',conflict:'venue_id,item_id',list:()=>te.useSoldOutLinks.getState().links.filter(t=>t.rid===e),key:e=>e.itemId,rowKey:e=>String(e.item_id),syncable:()=>!0,deletes:!1,writable:()=>'staff'===re.getState().kind,toRow:(e,t)=>({id:(0,se.uuidFrom)(`soldoutlink:${t}:${e.itemId}`),venue_id:t,item_id:e.itemId.slice(0,80),uses:e.uses.slice(0,10).map(e=>({key:String(e.key).slice(0,40),qty:Math.max(0,Math.min(99,Number(e.qty)||0))})),auto:!!e.auto,updated_at:e.at,updated_by:(e.by||'Staff').slice(0,80)}),fromRow:t=>({rid:e,itemId:String(t.item_id),uses:(Array.isArray(t.uses)?t.uses:[]).map(e=>({key:String(e.key??''),qty:Number(e.qty)||0})).filter(e=>e.key&&e.qty>0),at:String(t.updated_at??''),by:String(t.updated_by??''),...!0===t.auto?{auto:!0}:{}}),apply:(t,a)=>te.useSoldOutLinks.setState(s=>{const i=new Set(a);return{links:[...s.links.filter(a=>!(a.rid===e&&(i.has(a.itemId)||t.some(e=>e.itemId===a.itemId)))),...t]}}),subscribe:e=>te.useSoldOutLinks.subscribe((t,a)=>{t.links!==a.links&&e()}),afterRead:()=>{te.autoSync.linksRead.add(e)}}}async function Mt(e,t="*"){const a='*'===t?`table:${e}`:`table:${e}.${t}`;try{const s=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:i}=await Promise.race([ne().from(e).select(t,{head:!0,count:'exact'}).limit(1),s]);return i?!!/fetch|network|Failed/i.test(i.message)&&k.kv.get(a,!1):(k.kv.set(a,!0),!0)}catch{return k.kv.get(a,!1)}}async function Kt(){const e=re.getState().venueId;if(e)try{const{data:t}=await ne().from('push_settings').select('push_live').eq('venue_id',e).maybeSingle();qt.setState({live:!!t?.push_live,known:!0})}catch{}}const xt='order-list-logos';const Lt=new Map;const qt=(0,y.create)(()=>({live:!1,known:!1}));async function Pt(){try{const e=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:t}=await Promise.race([ne().from('venue_reminders').select('id').limit(1),e]);return t?!!/fetch|network|Failed/i.test(t.message)&&k.kv.get('reminders:ok',!1):(k.kv.set('reminders:ok',!0),!0)}catch{return k.kv.get('reminders:ok',!1)}}async function $t(){try{const e=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:t}=await Promise.race([ne().from('chat_messages').select('id').limit(1),e]);return t?!!/fetch|network|Failed/i.test(t.message)&&k.kv.get('chat:ok',!1):(k.kv.set('chat:ok',!0),!0)}catch{return k.kv.get('chat:ok',!1)}}const jt=(e,t)=>ve({id:String(e.id),venue:t,body:String(e.body??''),kind:'yesno'===e.kind?'yesno':'up',up:Number(e.up_count??0),yes:Number(e.yes_count??0),no:Number(e.no_count??0),hidden:!!e.hidden,reply:e.reply??void 0,replyAt:e.reply_at??void 0,postedOn:String(e.posted_on??'').slice(0,10)}),Bt='id,body,kind,up_count,yes_count,no_count,hidden,reply,reply_at,posted_on';function Ft(e){return{name:'hr_questions',table:'hr_questions',deletes:!1,list:()=>_.useHr.getState().questions.filter(t=>t.venue===e&&(0,$.isUuid)(t.id)),key:e=>e.id,rowKey:e=>String(e.id),syncable:()=>!1,writable:()=>!1,toRow:e=>({id:e.id}),fromRow:t=>jt(t,e),filter:e=>e.gte('posted_on',new Date(Date.now()-10368e6).toISOString().slice(0,10)),apply:(e,t)=>{const a=new Set(t);_.useHr.setState(t=>{const s=new Map(e.map(e=>[e.id,e])),i=t.questions.filter(e=>!a.has(e.id)).map(e=>s.get(e.id)??e),n=new Set(i.map(e=>e.id));return{questions:[...i,...e.filter(e=>!n.has(e.id))]}})},subscribe:e=>_.useHr.subscribe((t,a)=>{t.questions!==a.questions&&e()})}}function Wt(e,t){const a=(t,a,s)=>{R.mutationQueue.enqueue({table:'hr_questions',venueId:e,kind:'rpc',fn:t,rowKey:a,values:s})};Object.assign(_.hrRemote,{live:!0,checkout:t=>a('hr_checkout',t.token,{p_venue:e,p_day:t.day,p_token:t.token,p_morale:t.morale,p_staffing:t.staffing,p_question:t.question??null,p_kind:t.kind??'up',p_shout_to:t.shoutTo??null,p_shout_body:t.shoutBody??null}),post:(t,s,i,n)=>a('hr_post_question',s,{p_venue:e,p_id:s,p_body:i,p_kind:n}),vote:(e,t,s)=>a('hr_vote',e,{p_question:e,p_token:t,p_vote:s}),moderate:(e,t,s)=>a('hr_moderate',e,{p_question:e,p_action:t,p_reason:s}),reply:(e,t)=>a('hr_reply',e,{p_question:e,p_reply:t}),trend:async(t,a,s)=>{try{const{data:t,error:i}=await ne().rpc('hr_trend',{p_venue:e,p_from:a,p_to:s});return i?null:(t??[]).map(e=>({day:String(e.day).slice(0,10),answers:Number(e.answers),morale:Number(e.morale),staffing:null==e.staffing?null:Number(e.staffing),short:Number(e.short),perfect:Number(e.perfect),over:Number(e.over)}))}catch{return null}},shouts:async(a,s)=>{try{const{data:a,error:i}=await ne().from('hr_shoutouts').select('id,day,to_name,body').eq('venue_id',e).gte('day',s).order('day',{ascending:!1}).limit(20);return i?null:(a??[]).map(e=>({id:String(e.id),venue:t,day:String(e.day).slice(0,10),to:String(e.to_name),body:e.body??void 0}))}catch{return null}},log:async()=>{try{const{data:a,error:s}=await ne().from('hr_mod_log').select('id,question_id,action,reason,by_name,at').eq('venue_id',e).order('at',{ascending:!1}).limit(30);return s?null:(a??[]).map(e=>({id:String(e.id),venue:t,questionId:String(e.question_id??''),action:e.action,reason:e.reason??void 0,by:String(e.by_name??'A manager'),at:String(e.at)}))}catch{return null}},refresh:async()=>{try{const{data:a,error:s}=await ne().from('hr_questions').select(Bt).eq('venue_id',e).order('posted_on',{ascending:!1}).limit(200);s||_.useHr.getState().setRemoteBoard(t,(a??[]).map(e=>jt(e,t)))}catch{}}}),me.push(()=>{Object.assign(_.hrRemote,{live:!1,checkout:null,post:null,vote:null,moderate:null,reply:null,trend:null,shouts:null,log:null,refresh:null})})}const Vt='pair:v1',Ht='staff:v1',Gt='staff:rejoin:v1';async function Qt(){if('display'===le||'customer'===le||H.PITCH)return'none';const t=await k.kv.get(Gt,null);if(!t)return'none';try{await zt();const{data:a,error:s}=await ne().rpc(e.IS_QUEUED_VENUE?'claim_'+e.VENUE_RID+'_invite':e.IS_GREENSIDE?'claim_greenside_invite':e.IS_ABBOTSFORD?'claim_abbotsford_invite':e.IS_KIRKTON?'claim_kirkton_invite':e.IS_WILDINGS?'claim_wildings_invite':e.IS_KIRKMICHAEL?'claim_kirkmichael_invite':e.IS_ISOLATED_VENUE?'claim_souters_invite':'claim_invite',{p_token:t,p_app:le,p_device:(0,g.deviceId)()});if(s)return(0,p.inviteRefusal)(s.message)?(await k.kv.remove(Gt),await k.kv.remove(Ht),'refused'):'offline';const i=a?.[0];return i?(await k.kv.set(Ht,{kind:'staff',venueId:i.venue_id,venueSlug:i.venue_slug,venueName:i.venue_name,staffRef:i.external_ref,staffUuid:i.staff_id,role:i.role_key,displayName:i.display_name}),'ok'):(await k.kv.remove(Gt),'refused')}catch{return'offline'}}const Jt=e=>/jwt|refresh|token|401|not authenticated|invalid claim|session/i.test(String(e?.message??e))&&!/fetch|network/i.test(String(e?.message??e));async function zt(){fe();const{data:e}=await ne().auth.getSession();if(!e.session)for(let e=0;;e++){const{error:t}=await ne().auth.signInAnonymously();if(!t)return;const a=429===t.status||/rate|too many/i.test(t.message);if(!a||e>=2){if(a)throw new Error('Too many people are connecting from this network right now. Wait a few minutes, or switch to mobile data, and open the link again.');throw t}oe({message:'Lots of people are connecting at once. Trying again in a moment\u2026'}),await new Promise(t=>setTimeout(t,0===e?15e3:45e3))}}async function Zt(t){if(H.PITCH)return{status:'refused',message:'This link has been replaced or switched off. Ask your manager for a new one.'};if(!(0,v.isSupabaseConfigured)())return{status:'off'};try{await zt();const{data:a,error:s}=await ne().rpc(e.IS_QUEUED_VENUE?'claim_'+e.VENUE_RID+'_invite':e.IS_GREENSIDE?'claim_greenside_invite':e.IS_ABBOTSFORD?'claim_abbotsford_invite':e.IS_KIRKTON?'claim_kirkton_invite':e.IS_WILDINGS?'claim_wildings_invite':e.IS_KIRKMICHAEL?'claim_kirkmichael_invite':e.IS_ISOLATED_VENUE?'claim_souters_invite':'claim_invite',{p_token:t,p_app:le,p_device:(0,g.deviceId)()});if(s){const t=(0,p.inviteRefusal)(s.message);if(t){try{localStorage.removeItem((0,e.venueKey)(`cc-pending-invite:${le}`))}catch{}return{status:'refused',message:t}}throw s}const i=a?.[0];if(!i)return{status:'refused',message:'This link has been replaced or switched off. Ask your manager for a new one.'};const n={kind:'staff',venueId:i.venue_id,venueSlug:i.venue_slug,venueName:i.venue_name,staffRef:i.external_ref,staffUuid:i.staff_id,role:i.role_key,displayName:i.display_name};return await k.kv.set(Ht,n),await k.kv.set(Gt,t),ge&&aa(),{status:'ok',id:n}}catch(e){const t=String(e?.message??e);return oe({lastError:`Sign-in: ${t}`}),{status:'offline',message:t}}}async function Xt(){if(!(0,v.isSupabaseConfigured)())return!1;try{return await zt(),!0}catch{return!1}}const Yt=async(e,t={})=>{if(H.PITCH)return(0,G.pitchRpc)(e,t);const{data:a,error:s}=await ne().rpc(e,t);if(s)throw s;return a};let ea=null;async function ta(){for(const e of me)try{e()}catch{}me=[],pe.forEach(e=>e.stop()),pe=[],ea&&(clearInterval(ea),ea=null)}async function aa(){await ta(),await ia()}let sa=e.VENUE_RID;async function ia(){try{const e='undefined'!=typeof navigator?navigator.storage:null;e?.persist&&e.persist()}catch{}try{const e='undefined'!=typeof window?window.CoverChargeNative:null;e&&'function'==typeof e.checkUpdate&&/CoverChargePhone\//.test(navigator.userAgent)&&e.checkUpdate()}catch{}const t=sa;try{if(oe({mode:'connecting'}),await R.mutationQueue.load(),'customer'===le)return void await da(t);const a=await k.kv.get(Vt,null);let s=await k.kv.get(Ht,null);if(e.IS_ISOLATED_VENUE&&(a&&!(0,e.venueIdentityAllowed)(a.venueId,a.venueSlug)||s&&!(0,e.venueIdentityAllowed)(s.venueId,s.venueSlug)))return void oe({mode:'display'===le?'unpaired':'signin',perms:[],message:'This sign-in belongs to a different venue.'});let{data:i}=await ne().auth.getSession();if('display'!==le&&s&&!i.session){const e=await Qt();if('offline'===e)return oe({venueId:s.venueId,venueSlug:s.venueSlug,venueName:s.venueName,kind:s.kind,role:s.role,staffRef:s.staffRef,staffUuid:s.staffUuid,mode:'offline'}),void setTimeout(()=>{sa===t&&aa()},6e4);'refused'===e&&s.staffRef&&g.useSession.getState().meId===s.staffRef&&g.useSession.getState().signOut(),s=await k.kv.get(Ht,null),({data:i}=await ne().auth.getSession())}const n='display'===le?a:s;if(!i.session||!n)return void oe({mode:'display'===le?'unpaired':'signin',perms:[]});let r=[];try{const e=(await Yt('whoami')??[]).filter(e=>e.venue_id===n.venueId);if(!e.length)return'display'===le?await k.kv.remove(Vt):(await k.kv.remove(Ht),await k.kv.remove(Gt)),'staff'===n.kind&&n.staffRef&&g.useSession.getState().meId===n.staffRef&&g.useSession.getState().signOut(),void oe({mode:'display'===le?'unpaired':'signin',perms:[],message:'display'===le?'This display was unpaired by a manager.':'Open your invite link again to connect.'});r=[...new Set(e.flatMap(e=>e.permissions??[]))],'device'===n.kind&&n.canWrite&&r.push('device.write')}catch(e){if(!(0,b.isOnline)()||/fetch|network/i.test(String(e?.message)))oe({mode:'offline'});else if(Jt(e)&&'display'!==le){const{error:e}=await ne().auth.refreshSession();e&&'ok'===await Qt()&&setTimeout(()=>{sa===t&&aa()},500)}r=re.getState().perms}oe({venueId:n.venueId,venueSlug:n.venueSlug,venueName:n.venueName,kind:n.kind,role:n.role,staffRef:n.staffRef,staffUuid:n.staffUuid,perms:r}),'staff'===n.kind&&n.staffRef&&g.useSession.getState().meId!==n.staffRef&&(g.useSession.getState().signIn(n.staffRef),P.useOwner.setState({staffAs:n.staffRef})),await ra(n.venueId,t,n.kind)}catch(e){oe({mode:'local',lastError:String(e?.message??e)})}}const na=new Set(['venues','staff','bookings','walk_ins','blocks','table_plans','takeaway_orders','stock_items','stock_events','stock_counts','recipe_cards','suppliers','supplier_orders','rota_shifts','attendance','time_requests','game_scores','floor_live','chat_messages','venue_reminders','reminder_done']);async function ra(t,a,s){if(!(0,e.venueIdentityAllowed)(t,a))throw new Error('Different venue: sync refused.');await ma(a),me.push(Da(t));try{const{data:e}=await ne().from('roles').select('id,key').eq('venue_id',t);for(const t of e??[])We.set(t.key,t.id),Ve.set(t.id,t.key)}catch{}const i=[rt(a),{protect:!0,name:'staff',table:'staff',conflict:'venue_id,external_ref',list:()=>P.useOwner.getState().staff.map(Je),key:e=>e.id,rowKey:e=>String(e.external_ref??e.id),syncable:e=>!e.name.includes('(example)'),writable:()=>de('staff.manage'),deletes:!1,toRow:(e,t)=>({venue_id:t,external_ref:e.id,display_name:e.name,...$e?{nickname:e.nickname?.trim()||null}:{},job_title:e.job||null,department:e.dept||null,active:e.active,...je?{display_clock:!!e.displayClock,temp:!!e.temp,temp_until:e.tempUntil||null}:{},...e.managerAccess||e.ownerAccess||!We.get(He(e))?{}:{role_id:We.get(He(e))}}),fromRow:e=>e.external_ref?(Be.set(String(e.external_ref),String(e.id)),Fe.set(String(e.id),String(e.external_ref)),Oa.set(String(e.external_ref),e.avatar_path??null),ve({id:String(e.external_ref),name:e.display_name,...$e&&'nickname'in e?{nickname:e.nickname??void 0}:{},job:e.job_title??'',active:!1!==e.active,dept:e.department??'',...je&&'display_clock'in e?{displayClock:!!e.display_clock,temp:!!e.temp||void 0,tempUntil:e.temp_until??void 0}:{},...Qe(Ge(Ve.get(String(e.role_id))),!0===e.manager_access),...!0===e.owner_access&&'owner'!==Ge(Ve.get(String(e.role_id))).role?{role:'owner',ownerAccess:!0}:{}})):null,apply:e=>P.useOwner.setState(t=>{const a=new Map(e.map(e=>[e.id,e])),s=t.staff.map(e=>a.has(e.id)?{...e,...a.get(e.id)}:e),i=new Set(s.map(e=>e.id));return{staff:[...s,...e.filter(e=>!i.has(e.id)).map(e=>({...e}))]}}),subscribe:e=>P.useOwner.subscribe((t,a)=>{t.staff!==a.staff&&e()}),afterRead:()=>{Ua()},onRemote:()=>{Ua()}},{name:'pay',table:'staff_private',conflict:'staff_id',list:()=>{const e=P.useOwner.getState(),t=x.useSetup.getState().sites[sa]?.staffGrade??{};return e.staff.filter(e=>Be.has(e.id)).map(a=>ve({id:a.id,hourly:e.hourly[a.id]??null,salaried:!!a.salaried,noTax:!!a.noTax,grade:t[a.id]||void 0}))},key:e=>e.id,rowKey:e=>Fe.get(String(e.staff_id))??String(e.staff_id),syncable:e=>Be.has(e.id),writable:()=>de('wages.manage'),deletes:!1,toRow:(e,t)=>({staff_id:Be.get(e.id),venue_id:t,hourly_rate:null==e.hourly?null:e.hourly/100,salaried:e.salaried,no_tax:e.noTax,pay_grade:e.grade??null}),fromRow:e=>{const t=Fe.get(String(e.staff_id));return t?ve({id:t,hourly:null==e.hourly_rate?null:Math.round(100*Number(e.hourly_rate)),salaried:!!e.salaried,noTax:!!e.no_tax,grade:e.pay_grade||void 0}):null},apply:e=>P.useOwner.setState(t=>{const a={...t.hourly},s=new Map(e.map(e=>[e.id,e]));for(const t of e)null==t.hourly?delete a[t.id]:a[t.id]=t.hourly;if(e.length){const t=x.useSetup.getState().sites[sa],a={...t?.staffGrade??{}};let s=!1;for(const t of e)(a[t.id]||void 0)!==t.grade&&(s=!0,t.grade?a[t.id]=t.grade:delete a[t.id]);s&&x.useSetup.getState().patch(sa,{staffGrade:a})}return{hourly:a,staff:t.staff.map(e=>s.has(e.id)?{...e,salaried:s.get(e.id).salaried,noTax:s.get(e.id).noTax}:e)}}),subscribe:e=>{const t=P.useOwner.subscribe((t,a)=>{t.hourly===a.hourly&&t.staff===a.staff||e()}),a=x.useSetup.subscribe((t,a)=>{t.sites[sa]?.staffGrade!==a.sites[sa]?.staffGrade&&e()});return()=>{t(),a()}}},be(a,!1),be(a,!0),Ie(a),Re(a),ke(a),Ae(a),De(a),Ee(a),Pe(a),{name:'supplier_directory',table:'suppliers',list:()=>P.useOwner.getState().suppliers,key:e=>e.id,rowKey:e=>String(e.doc?.localId??e.id),syncable:e=>(0,$.isUuid)(e.id),writable:()=>de('suppliers.manage'),toRow:(e,t)=>({id:e.id,venue_id:t,name:e.name||'Supplier',category:e.category,contact:e.contact||null,phones:e.phones.filter(Boolean),email:e.email||null,website:e.website||null,account_ref:e.account||null,cutoff:e.cutoff||null,order_days:e.orderDays,delivery_days:e.deliveryDays,doc:{kind:'directory',localId:e.id,supplier:ve(e)}}),fromRow:e=>'directory'===e.doc?.kind?e.doc.supplier:null,apply:(e,t)=>P.useOwner.setState(a=>{const s=new Set(t),i=new Map(e.map(e=>[e.id,e])),n=a.suppliers.filter(e=>!s.has(e.id)).map(e=>i.get(e.id)??e),r=new Set(n.map(e=>e.id));return{suppliers:[...n,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>P.useOwner.subscribe((t,a)=>{t.suppliers!==a.suppliers&&e()})},{name:'supplier_orders',table:'supplier_orders',list:()=>P.useOwner.getState().supplierOrders,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id)&&(0,$.isUuid)(e.supplierId),writable:()=>de('suppliers.order')||de('suppliers.manage'),toRow:(e,t)=>({id:e.id,venue_id:t,supplier_id:e.supplierId,order_date:e.date||Se(),items:[{text:e.items}],amount:Math.round(e.amount||0),status:'sent',by_name:e.by,doc:ve(e)}),fromRow:e=>e.doc?{...e.doc,id:String(e.id)}:null,apply:(e,t)=>P.useOwner.setState(a=>{const s=new Set(t),i=new Map(e.map(e=>[e.id,e])),n=a.supplierOrders.filter(e=>!s.has(e.id)).map(e=>i.get(e.id)??e),r=new Set(n.map(e=>e.id));return{supplierOrders:[...e.filter(e=>!r.has(e.id)),...n]}}),subscribe:e=>P.useOwner.subscribe((t,a)=>{t.supplierOrders!==a.supplierOrders&&e()})},Te(a),ba(a)];de('wages.view')&&i.push(ka(a)),'staff'===s&&(i.push(Ye(),et(),tt(),st(a)),at(t));const n='staff'===s&&await $t();if(Z.useChatSync.setState({synced:n,checked:!0}),me.push(()=>Z.useChatSync.setState({synced:!1})),n&&i.push(pt(),{name:'chat_extra',table:'chat_channel_extra',conflict:'venue_id,channel,staff_id',list:()=>Object.entries(X.useKitchenExtra.getState().extra).map(([e,t])=>({id:e,include:t})),key:e=>e.id,rowKey:e=>Fe.get(String(e.staff_id))??String(e.staff_id),syncable:e=>Be.has(e.id),writable:()=>de('staff.manage'),filter:e=>e.eq('channel','kitchen'),matchKey:e=>({channel:'kitchen',staff_id:Be.get(e)??e}),toRow:(e,t)=>({venue_id:t,channel:'kitchen',staff_id:Be.get(e.id),include:e.include}),fromRow:e=>{const t=Fe.get(String(e.staff_id));return t?{id:t,include:!!e.include}:null},apply:(e,t)=>X.useKitchenExtra.setState(a=>{const s={...a.extra};return t.forEach(e=>{delete s[e]}),e.forEach(e=>{s[e.id]=e.include}),{extra:s}}),subscribe:e=>X.useKitchenExtra.subscribe((t,a)=>{t.extra!==a.extra&&e()})}),'staff'===s&&await Mt('hr_questions')&&(i.push(Ft(a)),na.add('hr_questions'),Wt(t,a)),'guest'!==s&&await Mt('sold_out_items')?(i.push(Tt(a,await Mt('sold_out_items','auto'))),na.add('sold_out_items')):te.autoSync.soldOutRead.add(a),'guest'!==s&&await Mt('sold_out_links')?(i.push(Nt(a)),na.add('sold_out_links')):te.autoSync.linksRead.add(a),S.useReminders.getState().ensure(a),'guest'!==s&&await Pt()&&(i.push(mt(a)),'staff'===s&&i.push(gt(a))),j.useNotifs.getState().ensure(a),F.useOrderLists.getState().ensure(a),'staff'===s){$e=await Mt('staff','nickname'),je=await Mt('staff','display_clock');const[e,t,s,n]=await Promise.all([Mt('scheduled_notifications'),Mt('order_lists'),Mt('venue_clock_area'),Mt('daily_tasks')]);J.useDailyTasks.getState().ensure(a),n&&(i.push(Et(a),Ct(a)),na.add('daily_tasks'),na.add('daily_task_ticks')),e&&(i.push(Ot(a)),Kt()),t&&i.push(Rt(a),At(a),Ut(a)),s&&i.push(Dt(a));for(const[a,i]of[[e,'scheduled_notifications'],[t,'order_lists'],[t,'order_list_items'],[t,'order_list_history'],[s,'venue_clock_area']])a&&na.add(i)}if('guest'!==s&&await Mt('day_tips')){i.push(bt(a));for(const e of['day_tips','tips_pot_events','tips_settings'])na.add(e);await Mt('tips_pot_events')&&i.push(kt(a),It(a)),'staff'===s&&(i.push(yt(a),wt(a),vt(a)),na.add('cash_ups'),na.add('sales_reports'),_r2(_d[59])(_d[58],_d.paths).then(e=>e.refreshCashAccess()))}'device'===s&&(i.push(Ye(),et()),await Mt('scheduled_notifications')&&i.push(Ot(a)));let r=!1;const o={onActivity:()=>oe({lastSyncAt:(new Date).toISOString()}),onError:(e,t)=>oe({lastError:`${e}: ${t}`}),onSuspect:(e,s)=>{oe({lastError:`${e}: held back, ${s}`}),r||(r=!0,(async()=>{try{if(!(await Yt('whoami')??[]).some(e=>e.venue_id===t))return void(sa===a&&aa());for(const a of pe){if(a.spec.name!==e)continue;const{count:s,error:i}=await ne().from(a.spec.table).select('*',{count:'exact',head:!0}).eq(a.spec.venueColumn??'venue_id',t);!i&&(s??0)>0&&a.allowMassRemoveOnce()}}catch{}finally{r=!1}})())}};pe=i.map(e=>new A.EntityBridge(e,t,o)),await Promise.all(pe.map(e=>e.start()));const d=async()=>{if('staff'===s&&(0,b.isOnline)())try{const e=await Yt('whoami');if(!e?.some(e=>e.venue_id===t))return void(sa===a&&aa())}catch(e){if(Jt(e)){const e=await Qt();return void('ok'!==e&&'refused'!==e||sa===a&&aa())}}let e=0;for(const[t,a]of pe.entries()){const s='chat'===i[t]?.name;try{await a.read(),e++,s&&Z.useChatSync.getState().error&&Z.useChatSync.setState({error:void 0})}catch(e){const t=String(e?.message??e);if((s||/fetch|network|Failed/i.test(t))&&Z.useChatSync.setState({error:t||'unknown error'}),/fetch|network|Failed/i.test(t))break}}if(e?(oe({mode:(0,b.isOnline)()?'live':'offline',lastSyncAt:(new Date).toISOString()}),R.mutationQueue.flush()):oe({mode:'offline'}),!de('wages.view')){const e=re.getState().staffRef;P.useOwner.setState(t=>({hourly:e&&null!=t.hourly[e]?{[e]:t.hourly[e]}:{}}))}};await d();const u=new Map;for(const e of pe)u.set(e.spec.table,[...u.get(e.spec.table)??[],e]);const l=[...u.keys()].filter(e=>na.has(e)).map(e=>({table:e,venueColumn:u.get(e)[0].spec.venueColumn}));let c=!1;const f=(0,A.venueChannel)(t,l,(e,t,a)=>{for(const s of u.get(e)??[])s.remote(t,a);oe({lastSyncAt:(new Date).toISOString()})},e=>{oe({realtime:e}),'SUBSCRIBED'===e?(c&&d(),c=!1):'CHANNEL_ERROR'!==e&&'TIMED_OUT'!==e&&'CLOSED'!==e||(c=!0)});me.push(()=>{ne().removeChannel(f)}),ea=setInterval(()=>{d()},6e4),me.push((0,b.onConnectivity)(e=>{e&&d()}))}'undefined'!=typeof window&&(window.__ccSync=()=>({...re.getState(),queue:R.mutationQueue.pending.map(e=>e.table),failedTables:R.mutationQueue.failed.map(e=>`${e.table}: ${e.lastError??''}`.slice(0,200))}));const oa='guest:sent:v1';async function da(s){oe({kind:'guest',venueSlug:s,perms:[]});try{const i=(await Yt('public_venue',{p_venue_slug:(0,t.queuedDatabaseSlug)(s)}))?.[0];if(i&&(!e.IS_ISOLATED_VENUE||i.id===e.VENUE_UUID)){oe({venueId:i.id,venueName:i.name}),await ma(s);const e=i.app?.restaurant;e&&U.useStore.setState(t=>({restaurants:t.restaurants.map(t=>t.id===s?(0,a.withWildingsAddress)({...e,id:s}):t)})),nt(s,i.app?.events)}await ua(s),oe({mode:'live',lastSyncAt:(new Date).toISOString()})}catch{oe({mode:(0,b.isOnline)()?'local':'offline'})}const i=setInterval(()=>{ua(s).catch(()=>{})},6e4);me.push(()=>clearInterval(i)),e.IS_ISOLATED_VENUE||await la(s)}async function ua(e){const a=await Yt('public_menu',{p_venue_slug:(0,t.queuedDatabaseSlug)(e)})??[];if(a.length){const t=new Map(a.map(e=>[String(e.menu_item_id??e.doc?.item?.id??''),e]));N.useCardStore.setState(a=>({cards:a.cards.map(a=>{if(a.restaurantId!==e)return a;const s=t.get(a.menuItemId);if(!s)return a.signOff?{...a,signOff:null}:a;const i=s.updated_at?new Date(s.updated_at).toISOString():a.updatedAt;return{...a,photo:s.photo_url||void 0,signOff:a.signOff??{by:'Head chef',at:i}}})}))}const s=a.map(e=>e.doc?.item).filter(e=>!!e&&!!e.id).map(t=>({...t,restaurantId:e}));s.length&&U.useStore.setState(e=>{const t=new Map(s.map(e=>[e.id,e])),a=e.menu.map(e=>t.get(e.id)??e),i=new Set(a.map(e=>e.id));return{menu:[...a,...s.filter(e=>!i.has(e.id))]}})}async function la(e){let a=await k.kv.get(oa,{}),s=!1;const i=new Date(Date.now()-1728e5).toISOString(),n=async()=>{if(!s){s=!0;try{const s=U.useStore.getState(),n=s.bookings.filter(t=>t.restaurantId===e&&(0,$.isUuid)(t.id)&&!t.walkIn&&!a[t.id]&&t.createdAt>=i),r=s.orders.filter(t=>t.restaurantId===e&&(0,$.isUuid)(t.id)&&!a[t.id]&&t.createdAt>=i&&'table'!==t.type);if(n.length||r.length){if(!await Xt())return;for(const s of n)try{const i=(await Yt('guest_create_booking',{p_venue_slug:(0,t.queuedDatabaseSlug)(e),p_booking:{...ve(s),...(0,f.takeGuard)(s.id),allergies:we(s.allergies)}}))?.[0];a={...a,[s.id]:'booking'};const n={};i?.status&&i.status!==s.status&&(n.status=i.status),'string'==typeof i?.ref&&i.ref&&i.ref!==s.ref&&(n.ref=i.ref),Object.keys(n).length&&U.useStore.setState(e=>({bookings:e.bookings.map(e=>e.id===s.id?{...e,...n}:e)}))}catch(e){/fetch|network/i.test(String(e?.message))||(a={...a,[s.id]:'failed'},oe({lastError:`Booking: ${e?.message}`}))}for(const s of r)try{await Yt('guest_create_takeaway',{p_venue_slug:(0,t.queuedDatabaseSlug)(e),p_order:{...ve(s),...(0,f.takeGuard)(s.id),allergies:we(s.allergies)}}),a={...a,[s.id]:'order'}}catch(e){/fetch|network/i.test(String(e?.message))||(a={...a,[s.id]:'failed'},oe({lastError:`Order: ${e?.message}`}))}await k.kv.set(oa,a)}for(const e of s.bookings)if('booking'===a[e.id]&&'cancelled'===e.status)try{await Yt('guest_cancel_booking',{p_id:e.id}),a={...a,[e.id]:'cancelled'},await k.kv.set(oa,a)}catch{}if(Object.values(a).some(e=>'booking'===e||'order'===e)){const e=await Yt('guest_my_items')??[],t=new Map(e.map(e=>[String(e.id),e]));U.useStore.setState(e=>({bookings:e.bookings.map(e=>{const a=t.get(e.id);return a&&a.status&&a.status!==e.status&&'declined'!==a.status?{...e,status:a.status}:'declined'===a?.status&&'cancelled'!==e.status?{...e,status:'cancelled'}:e}),orders:e.orders.map(e=>{const a=t.get(e.id);if(!a)return e;const s=a.doc??{},i={...e,status:a.status??e.status,readyBy:s.readyBy??e.readyBy,accepted:s.accepted??e.accepted};return ca(i)===ca(e)?e:i})})),oe({mode:'live',lastSyncAt:(new Date).toISOString()})}}catch{oe({mode:(0,b.isOnline)()?re.getState().mode:'offline'})}finally{s=!1}}};me.push(U.useStore.subscribe((e,t)=>{e.bookings===t.bookings&&e.orders===t.orders||setTimeout(()=>{n()},200)})),ea=setInterval(()=>{n()},15e3),n()}const ca=e=>JSON.stringify([e.status,e.readyBy,e.accepted]),fa={bridges:()=>pe,restart:aa},pa='golive:v1:';async function ma(e){'live'!==U.useStore.getState().clock.mode&&U.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}}),s.LIVE_VENUE_BUILD&&(0,s.isLiveVenue)(e)?await wa(e):(await k.kv.get(pa+e,!1)||await wa(e),await k.kv.get(ha+e,!1)||(ya(e),await k.kv.set(ha+e,!0)),await k.kv.get(ga+e,!1)||(Sa(),await k.kv.set(ga+e,!0)))}const ga='golive:v3:';function Sa(){const e=e=>JSON.stringify(e).includes('(example)');try{L.useKitchen.setState(t=>({waste:t.waste.filter(t=>!e(t)),stockTakes:t.stockTakes.filter(t=>!e(t)),deliveries:t.deliveries.filter(e=>'dl-today-fish'!==e.id&&'dl-today-veg'!==e.id)}))}catch{}}const ha='golive:v2:';function ya(e){const t=e=>JSON.stringify(e).includes('(example)');U.useStore.setState(t=>({customer:{...t.customer,name:'',email:'',phone:'',allergies:[],allergyConsent:!1,marketingOptIn:{}},stampCards:t.stampCards.filter(t=>t.restaurantId!==e),giftCards:t.giftCards.filter(t=>t.restaurantId!==e),ratings:t.ratings.filter(t=>t.restaurantId!==e),events:t.events.filter(t=>!(t.example&&(t.restaurantId===e||null===t.restaurantId)))})),P.useOwner.setState(e=>({referrals:[],coats:[],merchOrders:[],lost:[],customerTags:{},offers:e.offers.filter(e=>!t(e)),changeRequests:e.changeRequests.filter(e=>!t(e)),campaigns:e.campaigns.filter(e=>!t(e)),supplierOrders:e.supplierOrders.filter(e=>!t(e)),chat:e.chat.filter(e=>e.id.startsWith('m-seed-')).map((e,t)=>({...e,at:new Date(Date.now()-6e4*(5-t)).toISOString()}))}))}async function wa(e){if(s.LIVE_VENUE_BUILD&&(0,s.isLiveVenue)(e)){const t=(0,i.stripCoreLiveSamples)(U.useStore.getState()),a=(0,L.stripKitchenExamples)(L.useKitchen.getState()),o=P.useOwner.getState(),u=(0,i.stripOwnerLiveSamples)(o),l={accidents:q.useSafety.getState().accidents.filter(e=>!(0,q.isSeedAccident)(e))},c=(e,t)=>Object.keys(t).some(a=>JSON.stringify(e[a])!==JSON.stringify(t[a]));c(U.useStore.getState(),t)&&(await(0,n.archiveChefCache)('core',U.useStore.getState()),U.useStore.setState(t)),c(L.useKitchen.getState(),a)&&(await(0,n.archiveChefCache)('kitchen',L.useKitchen.getState()),L.useKitchen.setState(a)),c(o,u)&&(await(0,n.archiveChefCache)('owner',o),P.useOwner.setState(u)),c(q.useSafety.getState(),l)&&(await(0,n.archiveChefCache)('safety',q.useSafety.getState()),q.useSafety.setState(l));const f=(0,_.stripHrSamples)(_.useHr.getState());c(_.useHr.getState(),f)&&(await(0,n.archiveChefCache)('hr',_.useHr.getState()),_.useHr.setState(f));const p=(0,r.stripGpSamples)(r.useGpCalc.getState());c(r.useGpCalc.getState(),p)&&(await(0,n.archiveChefCache)('gp',r.useGpCalc.getState()),r.useGpCalc.setState(p));const m=M.useOrderSheets.getState(),g={sheets:{...m.sheets,anchorage:(m.sheets.anchorage||[]).filter(e=>!('os-veg'===e.id&&e.placeholder))}};c(m,g)&&(await(0,n.archiveChefCache)('order-sheets',m),M.useOrderSheets.setState(g));const S=N.useCardStore.getState(),h={cards:S.cards.filter(e=>!(0,s.isLiveVenue)(e.restaurantId)||!(0,d.isDemoCard)(e)),log:S.log.filter(e=>!(0,d.demoActor)(e.by))};return c(S,h)&&(await(0,n.archiveChefCache)('recipe-cards',S),N.useCardStore.setState(h)),void await k.kv.set(pa+e,!0)}const t=t=>t.restaurantId===e&&!(0,$.isUuid)(t.id);U.useStore.setState(a=>({bookings:a.bookings.filter(e=>!t(e)),orders:a.orders.filter(e=>!t(e)),waitlist:a.waitlist.filter(t=>t.restaurantId!==e),walkIns:Object.fromEntries(Object.entries(a.walkIns).filter(([t])=>!t.includes(e)))})),E.useBlocks.setState(t=>({blocks:t.blocks.filter(t=>t.rid!==e||(0,$.isUuid)(t.id))})),C.useFloor.setState(t=>({live:{...t.live,[e]:{}}})),P.useOwner.setState(e=>({shifts:e.shifts.filter(e=>(0,$.isUuid)(e.id)),attendance:e.attendance.filter(e=>(0,$.isUuid)(e.id)),timeRequests:e.timeRequests.filter(e=>(0,$.isUuid)(e.id)),leave:[],swaps:[]}));try{L.useKitchen.setState(e=>(0,L.stripKitchenExamples)(e))}catch{}P.useOwner.setState(e=>({suppliers:e.suppliers.filter(e=>(0,$.isUuid)(e.id)),supplierOrders:e.supplierOrders.filter(e=>(0,$.isUuid)(e.id)&&(0,$.isUuid)(e.supplierId))}));try{q.useSafety.setState(e=>({accidents:e.accidents.filter(e=>{return!String(e.id).startsWith('acc-ex')&&(t=e,!JSON.stringify(t).includes('(example)'));var t})}))}catch{}await k.kv.set(pa+e,!0)}const va=(e,t)=>ve({name:e,stage:t.stage||void 0,dirty:t.dirty||void 0,blocked:t.blocked||void 0,note:t.note||void 0});function ba(e){return{name:'floor_live',table:'floor_live',conflict:'venue_id,table_name',list:()=>Object.entries(C.useFloor.getState().live[e]??{}).map(([e,t])=>va(e,t)),key:e=>e.name,rowKey:e=>String(e.table_name),syncable:e=>e.name.length>0&&e.name.length<=20,writable:()=>'staff'===re.getState().kind||de('device.write'),deletes:!1,matchKey:e=>({table_name:e}),toRow:(e,t)=>({venue_id:t,table_name:e.name,stage:e.stage??null,dirty:!!e.dirty,blocked:!!e.blocked,note:e.note?e.note.slice(0,200):null,updated_by:re.getState().staffRef??le}),fromRow:e=>va(String(e.table_name),{stage:e.stage??void 0,dirty:!!e.dirty,blocked:!!e.blocked,note:e.note??void 0}),apply:(t,a)=>C.useFloor.setState(s=>{const i={...s.live[e]??{}};for(const e of t){const{name:t,...a}=e;i[t]=a}for(const e of a)delete i[e];return{live:{...s.live,[e]:i}}}),subscribe:e=>C.useFloor.subscribe((t,a)=>{t.live!==a.live&&e()})}}function ka(e){return{name:'pay_grades',table:'pay_grades',conflict:'venue_id,grade_id',list:()=>(x.useSetup.getState().sites[e]?.grades??x.DEFAULT_GRADES).map((e,t)=>({id:e.id,name:e.name,pence:e.pence,sort:t})),key:e=>e.id,rowKey:e=>String(e.grade_id),syncable:e=>!!e.id&&!!e.name,writable:()=>de('wages.manage'),matchKey:e=>({grade_id:e}),toRow:(e,t)=>({venue_id:t,grade_id:e.id,name:e.name.slice(0,60),pence:Math.max(0,Math.min(1e5,Math.round(e.pence))),sort:e.sort}),fromRow:e=>({id:String(e.grade_id),name:String(e.name),pence:Number(e.pence),sort:Number(e.sort??0)}),apply:(t,a)=>{if(!t.length&&!a.length)return;const s=x.useSetup.getState().sites[e]?.grades??[],i=new Map(s.map((e,t)=>[e.id,{...e,sort:t}]));for(const e of t)i.set(e.id,e);for(const e of a)i.delete(e);const n=[...i.values()].sort((e,t)=>e.sort-t.sort).map(e=>({id:e.id,name:e.name,pence:e.pence}));x.useSetup.getState().patch(e,{grades:n})},subscribe:t=>x.useSetup.subscribe((a,s)=>{a.sites[e]?.grades!==s.sites[e]?.grades&&t()})}}const Ia='staff-avatars',Oa=new Map;let Ra=!1;const Aa=e=>new Promise((t,a)=>{const s=new FileReader;s.onload=()=>t(String(s.result)),s.onerror=a,s.readAsDataURL(e)});async function Ua(){if(!Ra){Ra=!0;try{for(const[e,t]of Oa){const a=K.useAvatars.getState().photos[e];if(!t){a?.path&&K.useAvatars.setState(t=>{const a={...t.photos};return delete a[e],{photos:a}});continue}if(a?.path===t)continue;if(a&&!a.path&&e===re.getState().staffRef)continue;const{data:s,error:i}=await ne().storage.from(Ia).download(t);if(i||!s)continue;const n=await Aa(s);n.startsWith('data:image/')&&K.useAvatars.setState(a=>({photos:{...a.photos,[e]:{dataUrl:n,at:(new Date).toISOString(),path:t}}}))}}catch{}finally{Ra=!1}}}function Da(e){const t=async()=>{const t=re.getState().staffRef,a=t?Be.get(t)??re.getState().staffUuid:void 0;if(!t||!a||'staff'!==re.getState().kind)return;const s=K.useAvatars.getState().photos[t];try{const i=Oa.get(t),n=t=>{t&&t.startsWith(`${e}/${a}-`)&&ne().storage.from(Ia).remove([t]).catch(()=>{})};if(!s)return void(i&&(await Yt('set_staff_avatar',{p_staff_ref:t,p_path:null}),Oa.set(t,null),n(i)));if(s.path)return;const r=await(await fetch(s.dataUrl)).blob();if(r.size>512e3)return void oe({lastError:'Avatar: picture too large to share'});const o='image/jpeg'===r.type?'jpg':'image/webp'===r.type?'webp':'png',d=`${e}/${a}-${Date.now().toString(36)}.${o}`,{error:u}=await ne().storage.from(Ia).upload(d,r,{upsert:!1,contentType:r.type||'image/png'});if(u)throw u;await Yt('set_staff_avatar',{p_staff_ref:t,p_path:d}),Oa.set(t,d),i!==d&&n(i),K.useAvatars.setState(e=>e.photos[t]?.dataUrl===s.dataUrl?{photos:{...e.photos,[t]:{...s,path:d}}}:e)}catch(e){oe({lastError:`Avatar: ${String(e?.message??e)}`})}},a={photos:K.useAvatars.getState().photos},s=K.useAvatars.subscribe(e=>{const s=a.photos;if(a.photos=e.photos,t(),de('staff.manage'))for(const t of Object.keys(s))if(!e.photos[t]&&s[t]?.path&&t!==re.getState().staffRef){const e=s[t].path;Oa.set(t,null),Yt('set_staff_avatar',{p_staff_ref:t,p_path:null}).then(()=>ne().storage.from(Ia).remove([e])).catch(()=>{})}});return t(),s}const Ea=new Map,Ca=(0,y.create)(()=>({n:0}))},820,{"0":5,"1":6,"2":1018,"3":833,"4":1134,"5":1137,"6":1158,"7":856,"8":1125,"9":1074,"10":1075,"11":1041,"12":811,"13":1161,"14":984,"15":858,"16":1162,"17":994,"18":995,"19":1008,"20":862,"21":1121,"22":1208,"23":1207,"24":1209,"25":1211,"26":1120,"27":1117,"28":870,"29":806,"30":824,"31":825,"32":1148,"33":1119,"34":1059,"35":1040,"36":1007,"37":1212,"38":1213,"39":854,"40":1147,"41":997,"42":983,"43":1076,"44":1218,"45":1219,"46":2,"47":1220,"48":993,"49":1221,"50":1222,"51":1223,"52":1012,"53":946,"54":1069,"55":1053,"56":1143,"57":1022,"58":1374,"59":28,"paths":{}}); +__d(function(_g,_r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"colours",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"fonts",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"font",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"radius",{enumerable:!0,get:function(){return A}}),e.brandColour=function(I,S=n.gold){const r=/^#([0-9a-f]{6})$/i.exec(I??'');if(!r)return S;const _=parseInt(r[1],16),t=(_>>16)/255,E=(_>>8&255)/255,o=(255&_)/255,F=Math.max(t,E,o),A=Math.min(t,E,o),l=F-A;if(l<.12)return I;const D=F===t?((E-o)/l+6)%6*60:F===E?60*((o-t)/l+2):60*((t-E)/l+4);return D>65&&D<320?S:I};var I=_r(_d[0]),S=_r(_d[1]),r=_r(_d[2]),_=_r(_d[3]),t=_r(_d[4]),E=_r(_d[5]);const n={bg:I.IS_SOUTERS?'#56152A':I.IS_WILDINGS?'#272A2F':'#0B0B0B',surface:I.IS_SOUTERS?'#43122F':I.IS_WILDINGS?'#30343B':'#141414',surface2:I.IS_SOUTERS?'#43122F':I.IS_WILDINGS?'#363A42':'#1D1C1A',border:I.IS_SOUTERS?'#87435B':I.IS_WILDINGS?'#50545C':'#34302A',gold:I.IS_WILDINGS?'#FFE3A5':I.IS_KIRKMICHAEL?'#B87754':I.IS_SOUTERS?'#A4622E':'#CFA45F',goldLight:I.IS_WILDINGS?'#FFF0CF':I.IS_KIRKMICHAEL?'#D8AF95':I.IS_SOUTERS?'#D9AD8A':'#E2C489',goldTint:I.IS_WILDINGS?'#39352C':I.IS_KIRKMICHAEL?'#2C211B':I.IS_SOUTERS?'#43122F':'#2A2216',goldMuted:I.IS_WILDINGS?'#DDC694':I.IS_KIRKMICHAEL?'#C2937A':I.IS_SOUTERS?'#C18F67':'#BFA06C',hairline:'rgba(255,255,255,0.09)',tile:I.IS_SOUTERS?'#43122F':I.IS_WILDINGS?'#30343B':'#18171A',tilePressed:I.IS_SOUTERS?'#64223B':I.IS_WILDINGS?'#393D45':'#211F1C',accentBg:I.IS_WILDINGS?'rgba(255,227,165,0.13)':I.IS_KIRKMICHAEL?'rgba(184,119,84,0.13)':I.IS_SOUTERS?'rgba(164,98,46,0.13)':'rgba(207,164,95,0.13)',accentBorder:I.IS_WILDINGS?'rgba(255,227,165,0.38)':I.IS_KIRKMICHAEL?'rgba(184,119,84,0.38)':I.IS_SOUTERS?'rgba(164,98,46,0.38)':'rgba(207,164,95,0.38)',text:'#F5F1E8',muted:'#B8B0A0',onGold:I.IS_WILDINGS?'#272A2F':I.IS_KIRKMICHAEL?'#0B0B0B':I.IS_SOUTERS?'#FFFFFF':'#0B0B0B',red:'#FF6B5E',redBg:'#4A1310',redSolid:'#C62F22',amber:'#FFB547',amberBg:'#3F2C05',ok:I.IS_WILDINGS?'#FFF0CF':I.IS_KIRKMICHAEL?'#D8AF95':I.IS_SOUTERS?'#D9AD8A':'#E2C489',okBg:I.IS_WILDINGS?'#39352C':I.IS_KIRKMICHAEL?'#2C211B':I.IS_SOUTERS?'#43122F':'#2A2216',blue:I.IS_WILDINGS?'#FFF0CF':I.IS_KIRKMICHAEL?'#D8AF95':I.IS_SOUTERS?'#D9AD8A':'#E2C489',blueBg:I.IS_SOUTERS?'#43122F':I.IS_WILDINGS?'#39352C':'#1E1A12',...I.IS_GREENSIDE?r.GREENSIDE_PALETTE:{},...I.IS_QUEUED_VENUE?S.QUEUED_PALETTE:{},...I.IS_KIRKTON?t.KIRKTON_PALETTE:{},...I.IS_ABBOTSFORD?_.ABBOTSFORD_PALETTE:{}},o={regular:'Poppins_400Regular',medium:'Poppins_500Medium',semibold:'Poppins_600SemiBold',bold:'Poppins_700Bold'},F={small:E.type.small,body:E.type.body,large:E.type.large,title:E.type.title,hero:E.type.hero},A={s:E.radii.s,m:E.radii.m,l:E.radii.l}},821,[5,1247,1215,1248,1249,1250]); +__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.waNumber=o,_e.waMeLink=function(e,t){const n=o(e);return n?t?`https://wa.me/${n}?text=${encodeURIComponent(t)}`:`https://wa.me/${n}`:null},Object.defineProperty(_e,"guestWhatsAppText",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"staffWhatsAppTexts",{enumerable:!0,get:function(){return p}}),_e.openWhatsApp=async function(e){try{return await n.default.openURL(e),!0}catch{return!1}};var e,t=r(_d[0]),n=(e=t)&&e.__esModule?e:{default:e};function o(e,t="44"){if(!e)return null;let n=String(e).trim().replace(/[\s().\-]/g,'');return n.startsWith('+')?n=n.slice(1):n.startsWith('00')?n=n.slice(2):n.startsWith('0')&&(n=t+n.slice(1)),n=n.replace(/^440/,'44'),/^[1-9][0-9]{6,14}$/.test(n)?n:null}const s=e=>{const[t,n,o]=e.split('-').map(Number);return new Date(t,n-1,o).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',year:'numeric'})},u=e=>{const[t,n,o]=e.split('-').map(Number);return new Date(t,n-1,o).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'})},c=e=>e.slice(0,5),l=e=>e.replace(' (example)','').trim().split(/\s+/)[0]||'there',m=(e,t)=>`Hi ${t}, it's ${e.name.trim()} about my booking${e.ref?` ${e.ref}`:''}: ${s(e.date)} at ${c(e.time)}, table for ${e.partySize}. `,p=(e,t,n)=>({confirm:`Hi ${l(e.name)}, it's ${t}${n?` in ${n}`:''}. Just confirming your table for ${e.partySize} on ${u(e.date)} at ${c(e.time)}${e.ref?` (ref ${e.ref})`:''}. Any questions, just reply here.`,change:`Hi ${l(e.name)}, it's ${t} about your booking on ${u(e.date)} at ${c(e.time)}. `})},822,[239]); +__d(function(g,_r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.templatesFor=function(t){const n={...r.DEFAULT_TEMPLATES};for(const o of Object.keys(r.DEFAULT_TEMPLATES))n[o]={...r.DEFAULT_TEMPLATES[o],...t?.[o]??{}};return n},e.composeBooking=function(t,n,o,c,u){if(n.walkIn)return[];return s(t,'booking-confirmation'===t?'booking':'booking-request'===t?'request':'declined',(0,r.bookingVars)(n,o),{phone:n.phone,email:n.email,name:n.name},{refType:'booking',refId:n.id,ref:n.ref},o,c,u)},e.composeOrder=function(t,n,o,c){return'takeaway'!==t.type?[]:s('order-confirmation','order',(0,r.orderVars)(t,n),{phone:t.phone,email:t.email,name:t.customerName},{refType:'order',refId:t.id,ref:t.ref},n,o,c)},e.deliverQueued=async function(r,n){if(!(0,t.isLive)())return;const o=(0,t.activeProvider)();for(const t of r){const r=await o.deliver(t);n(t.id,r.ok?{status:'sent'}:{status:'failed',error:r.error})}},e.statusLabel=function(t){const r='sms'===t.channel?'Text':'Email';return'preview'===t.status?`${r}: Ready (preview mode)`:'queued'===t.status?`${r}: Sending\u2026`:'sent'===t.status?`${r} sent`:`${r}: Not sent (failed)`},Object.defineProperty(e,"PREVIEW_BANNER",{enumerable:!0,get:function(){return c}});var t=_r(d[0]);Object.keys(t).forEach(function(r){'default'===r||Object.prototype.hasOwnProperty.call(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[r]}})});var r=_r(d[1]);Object.keys(r).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return r[t]}})});var n=_r(d[2]);Object.keys(n).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})});const o=()=>`msg-${Math.random().toString(36).slice(2,8)}${Date.now().toString(36).slice(-4)}`;function s(s,c,u,l,f,m,p,b){const y=[],v=(0,t.isLive)()?'queued':'preview',h=(0,t.activeProvider)().id,k=(0,n.ukPhone)(l.phone);if(k.ok&&y.push({id:o(),restaurantId:m.id,at:b,channel:'sms',kind:s,to:k.pretty,toName:l.name,body:(0,r.toGsm)((0,r.fill)(p[c].sms,u.sms)),...f,status:v,provider:h}),l.email?.trim()){const t=(0,r.fillEmailText)(p[c].body,u.email),n=(0,r.fill)(p[c].subject,u.email);y.push({id:o(),restaurantId:m.id,at:b,channel:'email',kind:s,to:l.email.trim(),toName:l.name,subject:n,body:t,html:(0,r.emailHtml)(t,{venue:m.name,preheader:n}),...f,status:v,provider:h})}return y}const c='Preview mode, not sent yet. Connect a text and email service to go live.'},823,[1144,1145,1146]); +__d(function(g,r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"BLOCK_REASONS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"useBlocks",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"venueWide",{enumerable:!0,get:function(){return f}}),_e.blockedTablesAt=m,Object.defineProperty(_e,"blocksOn",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"areaBlocksOn",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"tableKey",{enumerable:!0,get:function(){return p}}),_e.closedAreasAt=function(e,t,o,n){const s=(0,l.toMins)(n),a=v(e,t,o).filter(e=>s>=(0,l.toMins)(e.from)&&s<(0,l.toMins)(e.to)).map(e=>e.areaId);return new Set([...a,...[...m(e,t,o,n)].map(p)])},_e.blockAt=M,_e.currentBlocks=function(e,t,o,n){return e.filter(e=>e.rid===t&&!e.removedAt&&(e.date>o||e.date===o&&(0,l.toMins)(e.to)>(0,l.toMins)(n))).sort((e,t)=>e.date===t.date?(0,l.toMins)(e.from)-(0,l.toMins)(t.from):e.date({blocks:[],removed:[],add:t=>{const o={...t,id:(0,s.uuid)(),createdAt:(new Date).toISOString(),source:'covercharge'};return e(e=>({blocks:[...e.blocks,o]})),o},addMany:t=>{const o=(new Date).toISOString(),n=t.map(e=>({...e,id:(0,s.uuid)(),createdAt:o,source:'covercharge'}));return e(e=>({blocks:[...e.blocks,...n]})),n},update:(t,o,n)=>e(e=>({blocks:e.blocks.map(e=>e.id===t?{...e,...o,id:t,editedAt:(new Date).toISOString(),editedBy:n}:e)})),remove:(t,o)=>e(e=>{const n=e.blocks.find(e=>e.id===t);return n?{blocks:e.blocks.filter(e=>e.id!==t),removed:[...e.removed,{...n,removedAt:(new Date).toISOString(),removedBy:o??n.by}]}:e}),put:t=>e(e=>{const o=e.blocks.filter(e=>e.id!==t.id),n=e.removed.filter(e=>e.id!==t.id);return t.removedAt?{blocks:o,removed:[...n,t]}:{blocks:[...o,t],removed:n}})}),{name:'covercharge-blocks-v1',storage:(0,c.createJSONStorage)(()=>n.default),version:2,migrate:e=>{const t=e??{};return{blocks:t.blocks??[],removed:t.removed??[]}}})),f=e=>!e.areaId&&!e.tables?.length;function m(e,t,o,n){const s=(0,l.toMins)(n);return new Set(e.filter(e=>e.rid===t&&e.date===o&&!e.removedAt&&e.tables?.length&&s>=(0,l.toMins)(e.from)&&s<(0,l.toMins)(e.to)).flatMap(e=>e.tables))}const k=(e,t,o)=>e.filter(e=>e.rid===t&&e.date===o&&!e.removedAt&&f(e)).sort((e,t)=>(0,l.toMins)(e.from)-(0,l.toMins)(t.from)),v=(e,t,o)=>e.filter(e=>e.rid===t&&e.date===o&&!e.removedAt&&!!e.areaId).sort((e,t)=>(0,l.toMins)(e.from)-(0,l.toMins)(t.from)),p=e=>`tbl:${e}`;function M(e,t,o,n){const s=(0,l.toMins)(n);return k(e,t,o).find(e=>s>=(0,l.toMins)(e.from)&&s<(0,l.toMins)(e.to))}const O=(e,t,o,n)=>M(e,t,o,n),y=e=>e.tables?.length?`${e.tables.map(t.tableNumbers).join(', ')} blocked until ${e.to}${e.reason?` \xb7 ${e.reason}`:''}`:e.areaId?`${e.areaName??'Area'} closed until ${e.to}${e.reason?` \xb7 ${e.reason}`:''}`:`Bookings paused until ${e.to}${e.reason?` \xb7 ${e.reason}`:''}`,A=(e,t)=>{const o=b(e=>e.blocks);return k(o,e,t)}},824,[808,1024,1147,1008,1025,818]); +__d(function(g,r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEFAULT_SETTINGS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"seedPlan",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"useFloor",{enumerable:!0,get:function(){return p}}),_e.hashOldPins=f,Object.defineProperty(_e,"usePlan",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"useDisplaySettings",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"planOf",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"tablesOf",{enumerable:!0,get:function(){return j}}),_e.tablesLabel=function(e){const n=j((0,t.tableNumbers)(e));if(!n.length)return'';if(1===n.length)return n[0];const a=n.map(e=>/^\d+$/.test(e)?Number(e):NaN),s=a.every(e=>!Number.isNaN(e))?[...n].sort((e,n)=>Number(e)-Number(n)):n;return a.every(e=>!Number.isNaN(e))&&s.length>=3&&s.every((e,n)=>0===n||Number(e)===Number(s[n-1])+1)?`${s[0]}\u2013${s[s.length-1]}`:s.join(' + ')},Object.defineProperty(_e,"joinTables",{enumerable:!0,get:function(){return v}});var e,n=r(d[0]),t=r(d[1]),a=r(d[2]),s=(e=a)&&e.__esModule?e:{default:e},i=r(d[3]),l=r(d[4]),o=r(d[5]),c=r(d[6]);Object.keys(c).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return c[e]}})});const u={privacy:!0,idleMins:2,pinOn:!1,...i.DEFAULT_WAKE,tonightCards:!0},b=e=>'souters'===e||n.IS_ISOLATED_VENUE&&'souters'===n.VENUE_RID?{areas:[{id:'su-restaurant',name:'Restaurant'},{id:'su-bar',name:'Bar'},{id:'su-mezzanine',name:'Mezzanine / private dining'},{id:'su-garden',name:'Beer garden',outdoor:!0},{id:'su-icecream',name:'Ice cream & cake corner'}],tables:[],joins:[],sections:[],fixtures:[]}:'kirkmichael'===e||n.IS_ISOLATED_VENUE&&'kirkmichael'===n.VENUE_RID?{areas:[{id:'km-restaurant',name:'Restaurant'},{id:'km-bar',name:'Bar'},{id:'km-private',name:'Private dining',label:'The Room (about 18 covers) \u2014 table plan to confirm'}],tables:[],joins:[],sections:[],fixtures:[]}:['wildings','greenside'].includes(e)||n.IS_ISOLATED_VENUE?{areas:[],tables:[],joins:[],sections:[],fixtures:[]}:'anchorage'===e?(0,c.anchoragePlan)():(0,c.starterPlan)(),p=(0,l.create)()((0,o.persist)((e,t)=>{const a=e=>t().plans[e]??b(e);return{plans:n.IS_ISOLATED_VENUE?{[n.VENUE_RID]:b(n.VENUE_RID)}:{anchorage:(0,c.anchoragePlan)()},live:{},settings:{},smsLog:[],setPlan:(n,t)=>e(e=>({plans:{...e.plans,[n]:t}})),updateTable:(n,t,s)=>{const i=a(n);e(e=>({plans:{...e.plans,[n]:{...i,tables:i.tables.map(e=>e.id===t?{...e,...s}:e)}}}))},addTable:(n,t)=>{const s=a(n);e(e=>({plans:{...e.plans,[n]:{...s,tables:[...s.tables,t]}}}))},removeTable:(n,t)=>{const s=a(n),i=s.tables.find(e=>e.id===t);e(e=>({plans:{...e.plans,[n]:{...s,tables:s.tables.filter(e=>e.id!==t),joins:s.joins.filter(e=>!i||!e.tables.includes(i.name))}}}))},setLive:(n,t,a)=>e(e=>({live:{...e.live,[n]:{...e.live[n]??{},[t]:{...e.live[n]?.[t]??{},...a}}}})),setSettings:(n,t)=>e(e=>({settings:{...e.settings,[n]:{...u,...e.settings[n]??{},...t}}})),logSms:(n,t,a)=>e(e=>{return{smsLog:[{id:(s='sms',`${s}-${Date.now().toString(36)}${Math.random().toString(36).slice(2,6)}`),rid:n,at:t,text:a},...e.smsLog].slice(0,50)};var s}),resetPlan:n=>e(e=>({plans:{...e.plans,[n]:b(n)}}))}},{name:'covercharge-floor-v1',version:6,storage:(0,o.createJSONStorage)(()=>s.default),migrate:(e,n)=>{const t=e??{};let a=t;if(n<2){const e={};for(const[n,a]of Object.entries(t.plans??{}))e[n]='anchorage'===n?(0,c.anchoragePlan)():(0,c.normalisePlan)(a);e.anchorage=(0,c.anchoragePlan)(),a={...t,plans:e,live:{}}}else if(n<3)a={...t,plans:{...t.plans??{},anchorage:(0,c.anchoragePlan)()}};else if(n<4){const e=t.plans?.anchorage;e&&(a={...t,plans:{...t.plans,anchorage:{...e,joins:(e.joins??[]).filter(e=>!(2===e.tables.length&&e.tables.includes('1')&&e.tables.includes('2')))}}})}return n<5&&(a={...a,settings:f(a.settings)}),n<6&&a.plans?.anchorage&&(a={...a,plans:{...a.plans,anchorage:(0,c.withSeedBest)('anchorage',a.plans.anchorage)}}),a}}));function f(e){const n={};for(const[t,a]of Object.entries(e??{})){const{pin:e,...s}=a??{};n[t]={...u,...s,...'pinHash'in s?{}:(0,i.fromOldPin)(e)}}return n}const h=e=>p(n=>n.plans[e])??E(e),N={};function E(e){return N[e]??=b(e)}const O=e=>{const n=p(n=>n.settings[e]);return n?{...u,...n}:u},P=e=>p.getState().plans[e]??E(e),j=e=>e?e.split('+').map(e=>e.trim()).filter(Boolean):[];const v=e=>[...new Set(e)].sort((e,n)=>/^\d+$/.test(e)&&/^\d+$/.test(n)?Number(e)-Number(n):e.localeCompare(n)).join('+')},825,[5,808,1024,1016,1008,1025,1022]); +__d(function(_g,r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"STATUS",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"STAGE_LABEL",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"STAGES",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"turnFor",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"startOf",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"durOf",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"endOf",{enumerable:!0,get:function(){return f}}),e.clashes=function(a,s=90){const n=new Set,l=a.filter(t=>g(t)&&t.table);for(let a=0;a(0,t.tablesOf)(d.table).includes(a))&&(u(o)t.date===n&&!['cancelled','noshow'].includes(t.status)).sort((t,a)=>t.time.localeCompare(a.time));for(const s of a.tables){const a=i.filter(a=>(0,t.tablesOf)(a.table).includes(s.name)),n=a[0],o=(0,t.tablesOf)(n?.table);l[s.name]={table:s,status:n?'soon':'free',next:n,covers:n?.partySize??0,dayBookings:a.length?a:void 0,group:o.length>1?o:void 0,allergy:!(!n?.allergies?.length&&!n?.allergyNote),vip:n?.tags?.find(t=>'VIP'===t)??n?.tags?.find(t=>'Regular'===t),occasion:n?.occasion??h(n?.notes)}}return l},e.floorView=function(a,n,l,i,o,d=90,c){const b={},g=n.filter(t=>t.date===O(o));for(const n of a.tables){const a=i[n.name]??{},y=g.filter(a=>(0,t.tablesOf)(a.table).includes(n.name)),O=y.find(t=>'seated'===(0,s.shownStatus)(t)),v=y.filter(t=>'confirmed'===t.status).sort((t,a)=>t.time.localeCompare(a.time)).find(t=>S(o,t)>=-20),T=v?Math.round(S(o,v)):void 0,w=O?void 0:p(y,o,d),F=l.find(t=>'table'===t.type&&t.tableNo===n.name&&!['closed','cancelled','collected'].includes(t.status));let j='free';a.blocked?j='blocked':O?j=a.stage??'seated':!c?.has(n.areaId)&&!c?.has(`tbl:${n.name}`)||F?a.dirty?j='dirty':F?j=a.stage??'seated':v&&void 0!==T&&T<=45&&(j='soon'):j='blocked';const A=O,P=A?.tags?.find(t=>'VIP'===t)??A?.tags?.find(t=>'Regular'===t)??(A?void 0:v?.tags?.[0]);b[n.name]={table:n,status:j,booking:A,next:v,due:w,nextIn:T,covers:A?.partySize??0,group:(()=>{const a=(0,t.tablesOf)((A??('soon'===j?v:void 0))?.table);return a.length>1?a:void 0})(),orderOnly:!A&&!!F,note:a.note,seatedMins:A?Math.max(0,Math.round((o.getTime()-u(A).getTime())/6e4)):void 0,freeAt:A?f(A,d):void 0,allergy:!!(A?.allergies?.length||A?.allergyNote||!A&&(v?.allergies?.length||v?.allergyNote)||F?.allergies?.length),vip:P,occasion:A?.occasion??(A?void 0:v?.occasion??h(v?.notes))??h(A?.notes)}}return b},e.dueOnTable=p,Object.defineProperty(e,"OCCASION_ICON",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"tableAllowed",{enumerable:!0,get:function(){return v}}),e.suggestTable=function(s,n,l,i,o,d,c=90,b,p){const h=[...s.tables.map(t=>({name:t.name,seats:t.maxSeats,min:t.minSeats,parts:[t.name]})),...s.joins.map(t=>{const a=s.tables.filter(a=>t.tables.includes(a.name));return{name:t.tables.join('+'),seats:a.reduce((t,a)=>t+a.maxSeats,0),min:a.reduce((t,a)=>t+a.minSeats,0),parts:t.tables}})].filter(t=>t.parts.every(t=>v(s,t,p))),y=o.getTime()+6e4*d,S=new Set((0,a.bestTables)(s));let O=null;for(const a of h){if(a.seats['blocked'].includes(l[t]?.status)))continue;const s=!!l&&a.parts.some(t=>['seated','mains','dessert','bill','dirty'].includes(l[t]?.status)),d=n.filter(s=>s.id!==b&&g(s)&&(0,t.tablesOf)(s.table).some(t=>a.parts.includes(t))&&u(s).getTime()o.getTime()).length,p=1===a.parts.length&&S.has(a.parts[0])?12:0,h=(s?1e3:0)+100*d+10*(a.seats-i)+(i({name:t.name,seats:t.maxSeats,parts:[t.name]})),...s.joins.map(t=>({name:t.tables.join('+'),seats:s.tables.filter(a=>t.tables.includes(a.name)).reduce((t,a)=>t+a.maxSeats,0),parts:t.tables}))].filter(t=>t.seats>=l&&t.parts.every(t=>v(s,t,c))).filter(a=>!n.some(s=>s.id!==b&&g(s)&&(0,t.tablesOf)(s.table).some(t=>a.parts.includes(t))&&u(s).getTime()i.getTime())),y=new Set((0,a.bestTables)(s)),S=t=>1===t.parts.length&&y.has(t.parts[0])?0:1;return h.sort((t,a)=>t.seats-a.seats||t.parts.length-a.parts.length||S(t)-S(a)).map(t=>({table:t.name,seats:t.seats,area:s.areas.find(a=>a.id===s.tables.find(a=>a.name===t.parts[0])?.areaId)?.name??''}))};var t=r(_d[0]),a=r(_d[1]),s=r(_d[2]);const n={colour:'#3A2F1E',fg:'#F1DDB0'},l={colour:'#CFA45F',fg:'#0B0B0B'},i={free:{label:'Free',...n},soon:{label:'Free',...n},seated:{label:'Seated',...l},mains:{label:'Seated',...l},dessert:{label:'Seated',...l},bill:{label:'Seated',...l},dirty:{label:'Needs clearing',colour:'#6E6555',fg:'#FFFFFF'},blocked:{label:'Blocked',...n}},o={seated:'Seated',mains:'Mains',dessert:'Dessert',bill:'Bill requested'},d=['seated','mains','dessert','bill'],c=(t,a=90)=>Math.min(a+60,a+15*Math.max(0,Math.ceil((t-2)/2))),u=t=>'seated'===(0,s.shownStatus)(t)&&t.seatedAt?new Date(t.seatedAt):new Date(`${t.date}T${t.time}:00`),b=(t,a=90)=>t.durationMins??c(t.partySize,a),f=(t,a=90)=>new Date(u(t).getTime()+6e4*b(t,a)),g=t=>!['cancelled','noshow','finished'].includes(t.status);function p(t,a,s=90){return t.filter(t=>'confirmed'===t.status&&S(a,t)<=45&&-S(a,t)t.time.localeCompare(a.time))[0]}const h=t=>t?/birthday/i.test(t)?'birthday':/anniversary/i.test(t)?'anniversary':void 0:void 0,y={birthday:'\ud83c\udf82',anniversary:'\ud83d\udc9d',celebration:'\ud83e\udd42'},S=(t,a)=>(new Date(`${a.date}T${a.time}:00`).getTime()-t.getTime())/6e4,O=t=>`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`,v=(t,a,s)=>{const n=t.tables.find(t=>t.name===a);if(!n)return!1;const l=t.areas.find(t=>t.id===n.areaId);return!(s?.dog&&!(void 0!==n.dogOk?n.dogOk:l?.dogs))&&(!s?.closed?.has(n.areaId)&&!s?.closed?.has(`tbl:${n.name}`))}},826,[825,1022,828]); +__d(function(g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"emptyNeeds",{enumerable:!0,get:function(){return w}}),_e.needsMissing=function(e,l=[]){const s=[];null===e.allergy?s.push('Answer the allergy question first'):'yes'!==e.allergy||e.allergens.length||l.length||e.allergyNote.trim()||s.push('Pick the allergens or describe them');null===e.dog&&s.push('Say whether a dog is coming');return s},_e.needsPatch=function(e,l=[]){const s='yes'===e.allergy?e.allergens.filter(e=>!l.some(l=>l.allergen===e)).map(l=>({allergen:l,severity:e.severity})):[],t=Object.entries(e.holds).filter(([,e])=>e>0).map(([e,l])=>({kind:e.startsWith('item:')?'item':'stock',id:e.slice(5),qty:l})),a=e.dog?Math.max(1,e.dogs):0,n={...e.wheelchair?{wheelchair:e.wheelchair}:{},...e.stepFree?{stepFree:!0}:{},...e.toilet?{toilet:!0}:{},...e.assistDog?{assistDog:!0}:{},...e.accessNote.trim()?{note:e.accessNote.trim()}:{}},r={...e.vegan?{vegan:e.vegan}:{},...e.vegetarian?{vegetarian:e.vegetarian}:{}};return{allergies:[...l,...s],allergyNone:'none'===e.allergy&&!l.length||void 0,allergyPeople:'yes'===e.allergy?e.allergyPeople:void 0,allergyNote:'yes'===e.allergy&&e.allergyNote.trim()?e.allergyNote.trim():void 0,dog:a>0,dogs:a||void 0,access:Object.keys(n).length?n:void 0,diet:Object.keys(r).length?r:void 0,holds:t.length?t:void 0,tableReq:e.tableReq.length?e.tableReq:void 0}},_e.FirstQuestions=function({rid:e,value:l,onChange:a,party:r,audience:i,profile:o=[]}){const p=e=>a({...l,...e}),b=(0,y.usePlan)(e),[x,j]=(0,t.useState)(!1),k=(0,s.dogQuestionOn)((0,u.useRestaurant)(e));(0,t.useEffect)(()=>{k||null!==l.dog||a({...l,dog:!1})},[k,l.dog]);const w=x?m.ALLERGENS:m.ALLERGENS.filter(e=>['gluten','milk','peanuts','treenuts','crustaceans','molluscs','fish','eggs','sesame'].includes(e.id)||l.allergens.includes(e.id)),M=[...o.map(e=>e.allergen),...l.allergens],q=(0,f.dogSetUp)(b);return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)(R,{tone:"red",testID:"q-allergens",children:[(0,v.jsx)(C,{sub:'guest'===i?'We ask everyone first, so the kitchen can keep you safe.':'Ask every guest first. It goes to the kitchen in red.',children:"\u26a0\ufe0f Does anyone in the party have a food allergy?"}),o.length?(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:o.map(e=>(0,v.jsx)(h.Badge,{kind:"red",label:`${m.ALLERGENS.find(l=>l.id===e.allergen)?.short} (from your profile)`},e.allergen))}):null,(0,v.jsxs)(h.Row,{gap:8,children:[(0,v.jsx)(n.default,{style:{flex:1},children:(0,v.jsx)(h.Chip,{label:"No allergies",selected:'none'===l.allergy,onPress:()=>p({allergy:'none',allergens:[]})})}),(0,v.jsx)(n.default,{style:{flex:1},children:(0,v.jsx)(h.Chip,{label:"Yes, allergies",selected:'yes'===l.allergy,onPress:()=>p({allergy:'yes'})})})]}),'none'===l.allergy&&o.length?(0,v.jsx)(h.Muted,{children:"Your profile allergies above are still shared with the kitchen."}):null,'yes'===l.allergy?(0,v.jsxs)(n.default,{style:{gap:10},testID:"allergen-picker",children:[(0,v.jsx)(h.T,{size:14,weight:"semibold",children:"Which allergens? (the 14 UK allergens)"}),(0,v.jsxs)(h.Row,{wrap:!0,gap:6,children:[w.map(e=>(0,v.jsx)(h.Chip,{label:e.short,selected:l.allergens.includes(e.id)||o.some(l=>l.allergen===e.id),disabled:o.some(l=>l.allergen===e.id),onPress:()=>p({allergens:l.allergens.includes(e.id)?l.allergens.filter(l=>l!==e.id):[...l.allergens,e.id]})},e.id)),x?null:(0,v.jsx)(h.Chip,{label:"All 14\u2026",onPress:()=>j(!0)})]}),(0,v.jsx)(h.T,{size:14,weight:"semibold",children:"How serious?"}),(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:m.SEVERITIES.map(e=>(0,v.jsx)(h.Chip,{label:e.label,selected:l.severity===e.id,onPress:()=>p({severity:e.id})},e.id))}),(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.T,{size:14,children:"How many people with allergies?"}),(0,v.jsx)(h.Stepper,{value:Math.min(l.allergyPeople,r),onChange:e=>p({allergyPeople:e}),min:1,max:Math.max(1,r),label:"people with allergies"})]}),(0,v.jsx)(h.Field,{label:"Anything else the kitchen should know? (optional)",value:l.allergyNote,onChangeText:e=>p({allergyNote:e}),placeholder:"e.g. traces of sesame, one child with coeliac disease",testID:"allergy-note"}),M.length?(0,v.jsx)(c.MenuAllergyCheck,{rid:e,allergens:M,audience:i}):null]}):null]}),k?(0,v.jsxs)(R,{tone:"gold",testID:"q-dogs",children:[(0,v.jsx)(C,{sub:q?'Well-behaved dogs are welcome at our dog-friendly tables.':'staff'===i?'Dog-friendly tables aren\u2019t marked yet (Managers \u203a Booking options), so any table is offered for now.':void 0,children:"\ud83d\udc15 Are you bringing a dog?"}),(0,v.jsxs)(h.Row,{gap:8,children:[(0,v.jsx)(n.default,{style:{flex:1},children:(0,v.jsx)(h.Chip,{label:"No",selected:!1===l.dog,onPress:()=>p({dog:!1})})}),(0,v.jsx)(n.default,{style:{flex:1},children:(0,v.jsx)(h.Chip,{label:"Yes",selected:!0===l.dog,onPress:()=>p({dog:!0,dogs:Math.max(1,l.dogs)})})})]}),l.dog?(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.T,{size:14,children:"How many dogs?"}),(0,v.jsx)(h.Stepper,{value:l.dogs,onChange:e=>p({dogs:e}),min:1,max:4,label:"dogs"})]}):null]}):null]})},_e.useReserveAvailability=M,_e.MoreQuestions=function({rid:e,r:l,value:a,onChange:r,party:i,date:o,time:c,today:p,bookings:m,audience:b,showTables:x}){const j=e=>r({...a,...e}),w=l.settings,S=(0,u.useMenu)(e),P=(0,t.useMemo)(()=>S.filter(e=>/\((V|VG|Ve)\)|vegan|vegetarian/i.test(`${e.name} ${e.tags?.join(' ')??''}`)).slice(0,4),[S.length]),N=M(e,l,o,p,m,b),T=e=>a.holds[e]??0,$=(0,f.stockNeed)({holds:Object.entries(a.holds).map(([e,l])=>({kind:e.startsWith('item:')?'item':'stock',id:e.slice(5),qty:l}))},N.items),D=(e,l)=>Math.min(10,...e.map(e=>{const s=($[e.key]??0)-T(l)*e.qty;return Math.floor(((N.free[e.key]??0)-s)/e.qty)})),A=(e,l,s,t)=>{const r=T(e),i=t<=0&&0===r;return(0,v.jsxs)(n.default,{style:{flexDirection:'row',alignItems:'center',gap:10,opacity:i?.55:1},testID:`reserve-${e.replace(':','-')}`,children:[(0,v.jsxs)(n.default,{style:{flex:1,minWidth:0},children:[(0,v.jsx)(h.T,{weight:"semibold",children:l}),(0,v.jsx)(h.Muted,{children:i?'Unavailable \u2014 none left for this day':s})]}),i?(0,v.jsx)(h.Badge,{kind:"neutral",label:"Unavailable"}):(0,v.jsx)(h.Stepper,{value:r,onChange:l=>j({holds:{...a.holds,[e]:Math.max(0,Math.min(l,Math.max(r,t)))}}),min:0,max:Math.max(r,Math.min(10,t)),label:l})]},e)},I=N.items.length>0||!1!==w.reserveStock&&N.stock.length>0,O=(0,y.usePlan)(e);return(0,v.jsxs)(v.Fragment,{children:[(0,s.accessQuestionOn)(l)?(0,v.jsxs)(R,{tone:"plain",testID:"q-access",children:[(0,v.jsx)(C,{sub:"Optional. Tell us and we\u2019ll have the right table ready.",children:"\u267f Access needs"}),(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.T,{size:14,children:"Wheelchair users"}),(0,v.jsx)(h.Stepper,{value:a.wheelchair,onChange:e=>j({wheelchair:e}),min:0,max:Math.max(1,i),label:"wheelchair users"})]}),(0,v.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,v.jsx)(h.Chip,{label:"Step-free access",selected:a.stepFree,onPress:()=>j({stepFree:!a.stepFree})}),(0,v.jsx)(h.Chip,{label:"Accessible toilet",selected:a.toilet,onPress:()=>j({toilet:!a.toilet})}),(0,v.jsx)(h.Chip,{label:"Assistance dog",selected:a.assistDog,onPress:()=>j({assistDog:!a.assistDog})})]}),(0,v.jsx)(h.Field,{label:"Anything else? (optional)",value:a.accessNote,onChangeText:e=>j({accessNote:e}),placeholder:"e.g. needs a chair with arms"}),w.accessStatement?.trim()?(0,v.jsx)(h.Muted,{children:w.accessStatement.trim()}):null]}):null,(0,s.dietQuestionOn)(l)?(0,v.jsxs)(R,{tone:"plain",testID:"q-veg",children:[(0,v.jsx)(C,{sub:"We\u2019d love to look after you. Optional.",children:"\u24cb Any vegans or vegetarians?"}),(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.T,{size:14,children:"Vegan"}),(0,v.jsx)(h.Stepper,{value:a.vegan,onChange:e=>j({vegan:e}),min:0,max:Math.max(1,i),label:"vegans"})]}),(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.T,{size:14,children:"Vegetarian"}),(0,v.jsx)(h.Stepper,{value:a.vegetarian,onChange:e=>j({vegetarian:e}),min:0,max:Math.max(1,i),label:"vegetarians"})]}),!1!==w.vegTeaser&&P.length&&(a.vegan||a.vegetarian)?(0,v.jsxs)(h.Muted,{children:["On the menu: ",P.map(e=>e.name).join(' \xb7 ')]}):null]}):null,I?(0,v.jsxs)(R,{tone:"gold",testID:"q-reserve",children:[(0,v.jsx)(C,{sub:N.known?'Held for you from today\u2019s count.':o>p||'guest'===b?'Held for you; the kitchen confirms and orders in.':void 0,children:"\ud83e\udd9e Reserve with your table"}),N.items.map(e=>A(`item:${e.id}`,`${e.name}${k(e.price)}`,e.description||e.uses.map(e=>`${e.qty} ${N.stock.find(l=>l.key===e.key)?.name.toLowerCase()??e.key}`).join(' + '),D(e.uses,`item:${e.id}`))),!1!==w.reserveStock?N.stock.map(e=>A(`stock:${e.key}`,`Reserve ${e.name.toLowerCase()}`,N.known?`${N.free[e.key]} available today`:'Held for the kitchen to order',D([{key:e.key,qty:1}],`stock:${e.key}`))):null,'staff'===b&&N.known?(0,v.jsxs)(h.Muted,{children:["Today: ",N.stock.map(e=>`${N.free[e.key]} ${e.plural.toLowerCase()} free (${N.reserved[e.key]??0} reserved)`).join(' \xb7 ')]}):null]}):null,x&&!1!==w.tableRequests&&O.tables.length?(0,v.jsx)(q,{rid:e,value:a,onChange:r,party:i,hide:w.tableRequestHide??[]}):null]})},_e.dogTimeOk=function(e,l,s,t,a){if(!a)return!0;const n=e.settings.maxDogsPerSlot;return!n||(0,f.dogsAt)(l,s,t)+a<=n},Object.defineProperty(_e,"accessibleSetUp",{enumerable:!0,get:function(){return f.accessibleSetUp}});var e,l=_r(d[0]),s=_r(d[1]),t=_r(d[2]),a=_r(d[3]),n=(e=a)&&e.__esModule?e:{default:e},r=_r(d[4]),i=_r(d[5]),o=_r(d[6]),c=_r(d[7]),h=_r(d[8]),u=_r(d[9]),y=_r(d[10]),p=_r(d[11]),m=_r(d[12]),b=_r(d[13]),x=_r(d[14]),f=_r(d[15]),j=_r(d[16]),v=_r(d[17]);const k=e=>'display'===x.APP_VARIANT?'':` \xb7 ${(0,b.gbp)(e)}`,w=()=>({allergy:null,allergens:[],severity:'allergy',allergyPeople:1,allergyNote:'',dog:null,dogs:1,wheelchair:0,stepFree:!1,toilet:!1,assistDog:!1,accessNote:'',vegan:0,vegetarian:0,holds:{},tableReq:[]});const R=({children:e,tone:l,testID:s})=>(0,v.jsx)(n.default,{testID:s,style:{gap:10,padding:16,borderRadius:16,borderWidth:'plain'===l?1:1.5,borderColor:'red'===l?j.colours.red:'gold'===l?j.colours.accentBorder:j.colours.hairline,backgroundColor:'red'===l?'#1E1110':j.colours.surface},children:e}),C=({children:e,sub:l})=>(0,v.jsxs)(n.default,{style:{gap:2},children:[(0,v.jsx)(h.T,{weight:"semibold",size:17,children:e}),l?(0,v.jsx)(h.Muted,{children:l}):null]});function M(e,l,s,t,a,n,i){const o=(0,f.reservablesOf)(l),c=(0,p.useStockItems)(e),h=(0,p.useShellStore)((0,r.useShallow)(l=>(0,p.venueCounts)(l,e))),u=(0,p.useShellStore)(l=>!!l.server[e]),y=(0,f.reservedOn)(a,s,o,i),m=s===t&&('staff'===n||u),b={};for(const e of c)b[e.key]=m?Math.max(0,Math.floor((h[e.key]??0)-(y[e.key]??0))):1/0;return{items:o,stock:c,free:b,reserved:y,known:m}}function q({rid:e,value:s,onChange:a,party:r,hide:c}){const u=(0,y.usePlan)(e),p=u.areas.filter(e=>u.tables.some(l=>l.areaId===e.id&&!c.includes(l.name))),[m,b]=(0,t.useState)(p[0]?.id??''),x=s.dog?s.dogs:0,k=e=>c.includes(e)?'Not bookable':(0,f.tableBlockReason)(u,e,r,x,s.wheelchair>0||s.stepFree),w=Object.fromEntries(u.tables.map(e=>[e.name,{table:e,status:k(e.name)?'blocked':'free',covers:0,allergy:!1}])),M=e=>{if(k(e))return;const l=s.tableReq.includes(e)?s.tableReq.filter(l=>l!==e):[...s.tableReq,e].slice(-2);a({...s,tableReq:l})},q=u.tables.filter(e=>e.areaId===m&&!c.includes(e.name));return(0,v.jsxs)(R,{tone:"plain",testID:"q-table",children:[(0,v.jsx)(C,{sub:"Table requests aren\u2019t guaranteed, but we\u2019ll do our best.",children:"\ud83e\ude91 Request a table (optional)"}),p.length>1?(0,v.jsx)(i.AreaTabs,{plan:u,area:m,onPick:b}):null,(0,v.jsx)(n.default,{style:{borderRadius:12,overflow:'hidden',borderWidth:1,borderColor:j.colours.hairline},children:(0,v.jsx)(o.FloorCanvas,{plan:u,areaId:m,mode:"live",view:w,privacy:!0,fit:"contain",crop:!0,maxH:260,highlight:s.tableReq,onTap:e=>M(e.name)})}),(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:q.map(e=>{const t=k(e.name),a=s.tableReq.indexOf(e.name);return(0,v.jsx)(h.Chip,{label:`${(0,l.tableNumbers)(e.name)}`,sub:t||(0===a?'1st choice':1===a?'2nd choice':`${e.maxSeats} seats`),selected:a>=0,disabled:!!t,onPress:()=>M(e.name)},e.name)})}),s.tableReq.length?(0,v.jsxs)(h.T,{size:14,colour:j.colours.goldLight,children:["Requested: ",s.tableReq.map((e,s)=>`${(0,l.tableNumbers)(e)}${s?' (2nd choice)':''}`).join(', ')]}):(0,v.jsx)(h.Muted,{children:"Tap a table; tap another for a second choice."})]})}},827,[808,809,30,127,871,1013,1014,1317,813,819,825,1148,814,816,806,828,821,24]); +__d(function(g,_r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ACTIVE",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"ANCHORAGE_RESERVABLES",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"reservablesOf",{enumerable:!0,get:function(){return i}}),e.stockNeed=s,e.reservedOn=a,e.usedOn=function(t,r,n){const o={};for(const i of t)if(i.date===r)for(const t of i.holds??[])if(t.served)for(const[r,a]of Object.entries(s({...i,holds:[{...t,served:void 0}]},n)))o[r]=(o[r]??0)+a;return o},e.heldSummary=function(t,r,o){const i={},s={};for(const o of t)if(o.date===r&&n(o))for(const t of o.holds??[])t.served||('item'===t.kind?i[t.id]=(i[t.id]??0)+t.qty:s[t.id]=(s[t.id]??0)+t.qty);return{platters:Object.values(i).reduce((t,r)=>t+r,0),byItem:i,single:s,stock:a(t,r,o)}},e.holdsText=function(t,r,n){return(t.holds??[]).filter(t=>t.qty>0).map(t=>`${'item'===t.kind?c(r.find(r=>r.id===t.id)?.name??'Reserved item'):n.find(r=>r.key===t.id)?.name??t.id} x${t.qty}${t.served?' (served)':''}`).join(', ')},Object.defineProperty(e,"shortItem",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"needsAllergenSeen",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"needsHoldOk",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"hasAllergens",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"allergenText",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"dogCount",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"hasAccess",{enumerable:!0,get:function(){return y}}),e.accessText=function(t){const r=t.access;return r?[r.wheelchair?`${r.wheelchair} wheelchair user${1===r.wheelchair?'':'s'}`:'',r.stepFree?'step-free access':'',r.toilet?'accessible toilet':'',r.assistDog?'assistance dog':'',r.note?.trim()??''].filter(Boolean).join(', '):''},Object.defineProperty(e,"dietText",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"accessibleSetUp",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"dogSetUp",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"isAccessible",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"isDogOk",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"dogsAt",{enumerable:!0,get:function(){return P}}),e.tableBlockReason=function(t,n,o,i,s){const a=t.tables.find(t=>t.name===n);return a?a.maxSeats0&&O(t)&&!(0,r.tableDogOk)(t,a)?'No dogs here':s&&h(t)&&!a.accessible?'Not step-free':'':'Not available'},Object.defineProperty(e,"holidayName",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"coverDone",{enumerable:!0,get:function(){return A}}),e.shownStatus=S,e.coversToday=function(t,r){const o=t.filter(t=>t.date===r&&n(t)),i=o.filter(A),s=o.filter(t=>!A(t)&&['confirmed','pending','seated'].includes(S(t))),a=t=>t.reduce((t,r)=>t+r.partySize,0);return{done:a(i),toCome:a(s),total:a(i)+a(s)}};var t=_r(_d[0]),r=_r(_d[1]);const n=t=>!['cancelled','noshow'].includes(t.status),o=[{id:'seafood-platter-2',name:'Seafood Platter for 2',price:16e3,description:'Whole crab and lobster with all the trimmings, for two to share.',uses:[{key:'crab',qty:1},{key:'lobster',qty:1}],active:!0}],i=t=>(t?.settings.reservables??('anchorage'===t?.id?o:[])).filter(t=>t.active);function s(t,r,n=!1){const o={};for(const i of t.holds??[])if(!i.served||n)if('stock'===i.kind)o[i.id]=(o[i.id]??0)+i.qty;else for(const t of r.find(t=>t.id===i.id)?.uses??[])o[t.key]=(o[t.key]??0)+t.qty*i.qty;return o}function a(t,r,o,i){const a={};for(const c of t)if(c.date===r&&n(c)&&'finished'!==c.status&&c.id!==i)for(const[t,r]of Object.entries(s(c,o)))a[t]=(a[t]??0)+r;return a}const c=t=>/platter/i.test(t)?'Platter':t.replace(/ for \d+$/i,''),l=t=>n(t)&&(t.allergies.length>0||!!t.allergyNote?.trim())&&!t.allergyAck,d=t=>n(t)&&(t.holds??[]).some(t=>t.qty>0&&!t.served)&&!t.holdOk,f=t=>t.allergies.length>0||!!t.allergyNote?.trim(),u=r=>[r.allergies.map(r=>(0,t.allergenLabel)(r.allergen)).join(', '),r.allergyNote?.trim()].filter(Boolean).join(' \xb7 ')+(r.allergyPeople?` (${r.allergyPeople} ${1===r.allergyPeople?'person':'people'})`:''),b=t=>t.dogs??(t.dog?1:0),y=t=>!(!t.access||!(t.access.wheelchair||t.access.stepFree||t.access.toilet||t.access.assistDog||t.access.note?.trim()));const p=t=>[t.diet?.vegan?`${t.diet.vegan} vegan`:'',t.diet?.vegetarian?`${t.diet.vegetarian} vegetarian`:''].filter(Boolean).join(', '),h=t=>t.tables.some(t=>t.accessible),O=t=>t.tables.some(t=>void 0!==t.dogOk)||t.areas.some(t=>t.dogs),v=(t,r)=>r.split('+').every(r=>!!t.tables.find(t=>t.name===r.trim())?.accessible),j=(t,n)=>n.split('+').every(n=>{const o=t.tables.find(t=>t.name===n.trim());return!!o&&(0,r.tableDogOk)(t,o)}),P=(t,r,o,i)=>t.filter(t=>t.id!==i&&t.date===r&&t.time===o&&n(t)).reduce((t,r)=>t+b(r),0);const k=t=>t.replace(/\s*\(substitute day\)/gi,'').trim(),A=t=>'finished'===t.status;function S(t){if('seated'===t.status&&t.seatedAt){const r=new Date(t.seatedAt);if((isNaN(r.getTime())?t.date:r.toLocaleDateString('en-CA',{timeZone:'Europe/London'})){const l=n[e.id],c=u.find(l=>l.allergen===e.id),f='contains'===l?t.colours.redBg:'may'===l?t.colours.amberBg:t.colours.surface2,h='contains'===l?'#FFD9D4':'may'===l?'#FFE2A8':t.colours.muted;return(0,d.jsxs)(s.default,{style:{width:'48%',flexGrow:1,backgroundColor:f,borderRadius:8,padding:8,borderWidth:c?2:1,borderColor:c?t.colours.red:t.colours.border},children:[(0,d.jsx)(o.T,{size:14,weight:"medium",colour:l?h:t.colours.text,children:e.label}),(0,d.jsxs)(o.T,{size:13,colour:h,children:['contains'===l?'Contains':'may'===l?'May contain':'Not listed',c?` \xb7 YOUR ALLERGY (${(0,a.severityLabel)(c.severity)})`:'']})]},e.id)})}),e.allergenNotes?(0,d.jsxs)(o.Muted,{children:["Notes: ",e.allergenNotes]}):null,(0,d.jsx)(s.default,{testID:"allergen-signoff",children:(0,d.jsx)(o.Muted,{children:e.signOff?`From the dish's recipe card. Signed off by ${e.signOff.by} on ${c(e.signOff.at)}.`:"Awaiting the head chef's allergen sign-off: not available to order online."})}),(0,d.jsx)(o.Muted,{children:"Always tell staff about allergies when you order or arrive."})]})},_e.AllergenChips=function({map:e,declared:l}){const n=Object.entries(e);return n.length?(0,d.jsx)(o.Row,{wrap:!0,gap:5,children:n.sort((e,l)=>e[1]===l[1]?0:'contains'===e[1]?-1:1).map(([e,n])=>{const s=l.some(l=>l.allergen===e);return(0,d.jsx)(o.Badge,{label:`${s?'\u26a0 ':''}${(0,a.allergenLabel)(e)}${'may'===n?' (may)':''}`,kind:s?'contains'===n?'red':'amber':'neutral'},e)})}):(0,d.jsx)(o.Muted,{children:"No listed allergens"})},r(_d[0]);var e,l=r(_d[1]),n=r(_d[2]),s=(e=n)&&e.__esModule?e:{default:e},a=r(_d[3]),t=r(_d[4]),o=r(_d[5]),d=r(_d[6]);const c=e=>{const l=new Date(`${e.slice(0,10)}T12:00:00`);return isNaN(+l)?e:l.toLocaleDateString('en-GB',{day:'numeric',month:'long',year:'numeric'})}},829,[30,943,127,814,821,813,24]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BasketButton=function(){const s=(0,l.useBasket)().lines.reduce((e,s)=>e+s.qty,0);return s?(0,c.jsx)(o.default,{accessibilityRole:"button",accessibilityLabel:`Basket, ${s} items`,onPress:()=>e.router.push('/customer/basket'),style:{backgroundColor:u.colours.gold,borderRadius:999,paddingHorizontal:12,paddingVertical:6},children:(0,c.jsxs)(n.T,{weight:"semibold",colour:u.colours.onGold,size:14,children:["Basket \xb7 ",s]})}):null};var e=r(d[0]);r(d[1]);var s,t=r(d[2]),o=(s=t)&&s.__esModule?s:{default:s},l=r(d[3]),u=r(d[4]),n=r(d[5]),c=r(d[6])},830,[804,30,263,819,821,813,24]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.setRecipeCardRepository=function(n){t=n,r.forEach(t=>t())},e.recipeCards=function(){if(!t)throw new Error('Recipe card repository not set up');return t},Object.defineProperty(e,"hasRecipeCards",{enumerable:!0,get:function(){return n}}),e.onRepositorySwap=function(t){return r.add(t),()=>{r.delete(t)}};let t=null;const r=new Set;const n=()=>!!t},831,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Stars=function({value:e,onChange:s,size:n=36}){return(0,c.jsx)(t.Row,{gap:6,children:[1,2,3,4,5].map(u=>(0,c.jsx)(l.default,{disabled:!s,accessibilityRole:"button",accessibilityLabel:`${u} star${u>1?'s':''}`,onPress:()=>s?.(u),hitSlop:4,children:(0,c.jsx)(t.T,{size:n,colour:u<=e?o.colours.gold:'#555',children:"\u2605"})},u))})},r(d[0]);var e,s=r(d[1]),l=(e=s)&&e.__esModule?e:{default:e},o=r(d[2]),t=r(d[3]),c=r(d[4])},832,[30,263,821,813,24]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"LIVE_VENUE_SLUGS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"LIVE_VENUE_BUILD",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"isLiveVenue",{enumerable:!0,get:function(){return n}});var c=r(d[0]);const b=['anchorage','souters','kirkmichael','wildings','kirkton','abbotsford','greenside',"3idiots","cecchinis","mrbasrais","yasmins","williewastles","rupeeroom","smokinggoat","pizzaioli","drunkencoo"],f=b.includes(c.VENUE_RID),n=c=>b.includes(c)||['6349aa07-3fec-46e9-8c69-7b1b08494793','41ce63ca-ae46-432d-a5ba-25e1b801e64d','43c8da91-b8b8-4ce9-9ab7-f00c84c5f4f6','47f86b36-4c99-466a-be9c-30eb3d79f1e1','e0afad1d-cbc1-414a-add6-92e47d302139','24624ea5-d1e3-4182-b0d1-73402b8a1532','1bc2a056-2ef6-4585-abfd-b7d21c84f215',"59766322-119e-4036-a18a-f6909f60a8d2","596c6f7e-9797-4e16-84fe-db4a99fa1bdc","5d500571-e205-4ead-bb58-60e986b6f40e","f43f20ad-55d0-4008-88c8-7738dc1698df","6abc2793-93ab-4e23-a705-b4011a5cc011","78bff97d-5f07-440a-bb99-f6a6118da7a3","cd985ff5-2443-458d-ac8b-342d553628cf","35f870fc-772c-4aad-bb9e-09a9a16bc925","f500ef12-b405-438b-9671-e54289bec5dd"].includes(c)},833,[5]); +__d(function(_g,r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.MockPay=function({visible:e,onClose:j,amount:p,restaurantId:b,allowGiftCard:x=!0,onPaid:f,title:g="Pay"}){const y=(0,o.useGiftCards)(b).filter(e=>e.balance>0),[m,w]=(0,s.useState)(),[P,C]=(0,s.useState)('Test card \u2022\u2022\u2022\u2022 4242'),[T,M]=(0,s.useState)(!1),_=y.find(e=>e.code===m),v=_?Math.min(_.balance,p):0,R=p-v;return(0,h.jsxs)(u.Sheet,{visible:e,onClose:j,title:g,children:[(0,h.jsx)(u.DemoPaymentNotice,{}),x&&y.length>0?(0,h.jsxs)(l.default,{style:{gap:6},children:[(0,h.jsx)(u.T,{weight:"semibold",children:"Use a gift card"}),(0,h.jsxs)(u.Row,{wrap:!0,children:[(0,h.jsx)(u.Chip,{label:"None",selected:!m,onPress:()=>w(void 0)}),y.map(e=>(0,h.jsx)(u.Chip,{label:`${e.code.slice(0,8)}\u2026`,sub:`${(0,n.gbp)(e.balance)} left`,selected:m===e.code,onPress:()=>w(e.code)},e.id))]})]}):null,(0,h.jsx)(u.T,{weight:"semibold",children:"Payment method"}),(0,h.jsx)(u.Row,{wrap:!0,children:['Test card \u2022\u2022\u2022\u2022 4242','Apple Pay (test)','Google Pay (test)'].map(e=>(0,h.jsx)(u.Chip,{label:e,selected:P===e,onPress:()=>C(e)},e))}),(0,h.jsxs)(l.default,{style:{gap:2},children:[(0,h.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(u.Muted,{children:"Amount"}),(0,h.jsx)(u.T,{children:(0,n.gbp)(p)})]}),v?(0,h.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(u.Muted,{children:"Gift card"}),(0,h.jsxs)(u.T,{colour:c.colours.ok,children:["\u2212",(0,n.gbp)(v)]})]}):null,(0,h.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(u.T,{weight:"semibold",children:"To pay now"}),(0,h.jsx)(u.T,{weight:"bold",size:20,colour:c.colours.gold,children:(0,n.gbp)(R)})]})]}),T?(0,h.jsx)(t.default,{color:c.colours.gold}):(0,h.jsx)(u.Button,{label:`Pay ${(0,n.gbp)(R)} \u2014 demo`,onPress:()=>{M(!0),setTimeout(()=>{M(!1),f({giftCardCode:m,giftApplied:v,method:P})},700)},testID:"mock-pay-confirm"})]})};var s=r(d[0]),t=e(r(d[1])),l=e(r(d[2])),o=r(d[3]),n=r(d[4]),c=r(d[5]),u=r(d[6]),h=r(d[7])},834,[30,246,127,819,816,821,813,24]); +__d(function(_g,_r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.GiftLive=function({slug:e,venue:n}){const{info:x,mine:b,err:S,load:w,pay:k}=j(e),[T,P]=(0,t.useState)(null),[D,C]=(0,t.useState)(''),[O,$]=(0,t.useState)(''),[v,B]=(0,t.useState)(''),[I,M]=(0,t.useState)(''),[E,L]=(0,t.useState)(!1),[R,A]=(0,t.useState)(''),[_,H]=(0,t.useState)(null),F=f(e);if(!x)return(0,h.jsx)(a.Screen,{title:"Gift cards",subtitle:n,children:S?(0,h.jsx)(a.Banner,{kind:"warn",title:S}):(0,h.jsx)(a.Muted,{children:"Loading\u2026"})});const N=D?(0,o.poundsToPence)(D)??0:T??x.amounts[1]??x.amounts[0]??0;return(0,h.jsxs)(a.Screen,{title:"Gift cards",subtitle:`${n}: used only at ${n}`,children:[_?(0,h.jsx)(s.default,{testID:"gift-made",children:(0,h.jsx)(a.Card,{highlight:u.colours.gold,children:(0,h.jsxs)(s.default,{style:{gap:6},children:[(0,h.jsx)(a.H2,{children:"Your gift card code"}),(0,h.jsx)(a.T,{size:26,weight:"bold",colour:u.colours.gold,center:!0,children:_.code}),(0,h.jsxs)(a.Muted,{center:!0,children:["Shown once and kept on this phone. Write it down or take a screenshot to give it to ",O||'them',"."]}),(0,h.jsxs)(a.Banner,{kind:"warn",title:`Pay ${(0,l.gbp)(_.pence)} at the bar or till`,children:["Show reference ",_.ref,". The card works once staff mark it paid.",k.cardOn?'':' Card payment in the app is coming soon.']}),(0,h.jsx)(m,{slug:e,kind:"gift",id:_.id,pay:k})]})})}):null,(0,h.jsx)(g,{onDone:w}),(0,h.jsx)(s.default,{testID:"gift-mine",children:(0,h.jsx)(a.Card,{children:(0,h.jsxs)(s.default,{style:{gap:6},children:[(0,h.jsx)(a.H2,{children:"Your gift cards"}),b.cards.length?b.cards.map(t=>(0,h.jsxs)(s.default,{style:{gap:2},children:[(0,h.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(a.T,{style:{flex:1},children:F[t.id]??`\u2022\u2022\u2022\u2022 ${t.last4}`}),(0,h.jsxs)(a.T,{weight:"semibold",colour:u.colours.gold,children:[(0,l.gbp)(t.balancePence)," of ",(0,l.gbp)(t.initialPence)]})]}),(0,h.jsxs)(a.Muted,{size:12,children:[o.STATUS_WORDS[t.status]??t.status,t.expiresAt?` \xb7 use by ${p(t.expiresAt)}`:'','waiting-payment'===t.status?` \xb7 reference ${t.ref}`:'']}),'waiting-payment'===t.status&&_?.id!==t.id?(0,h.jsx)(m,{slug:e,kind:"gift",id:t.id,pay:k}):null]},t.id)):(0,h.jsx)(a.Muted,{children:"None yet."})]})})}),x.giftsOn?(0,h.jsx)(s.default,{testID:"gift-buy",children:(0,h.jsx)(a.Card,{children:(0,h.jsxs)(s.default,{style:{gap:8},children:[(0,h.jsx)(a.H2,{children:"Buy a gift card"}),(0,h.jsx)(a.Row,{wrap:!0,children:x.amounts.map(e=>(0,h.jsx)(a.Chip,{label:(0,l.gbp)(e),selected:!D&&N===e,onPress:()=>{C(''),P(e)}},e))}),(0,h.jsx)(a.Field,{label:`Or another amount (\xa3${x.minPence/100} to \xa3${x.maxPence/100})`,keyboardType:"decimal-pad",value:D,onChangeText:C,placeholder:"e.g. 40",testID:"gift-custom"}),(0,h.jsx)(a.Field,{label:"Who it\u2019s for",value:O,onChangeText:$,testID:"gift-recipient"}),(0,h.jsx)(a.Field,{label:"From",value:v,onChangeText:B}),(0,h.jsx)(a.Field,{label:"Message",value:I,onChangeText:M,multiline:!0,placeholder:"Happy birthday!"}),(0,h.jsxs)(a.Muted,{size:12,children:["Use within ",(0,o.expiryWords)(x.expiryMonths)," of paying. Part-use leaves a balance.",x.terms?` ${x.terms}`:'']}),(0,h.jsx)(s.default,{testID:"gift-pay-placeholder",children:(0,h.jsx)(a.Banner,{kind:"demo",title:"Payment",children:o.PAY_PLACEHOLDER})}),R?(0,h.jsx)(a.Banner,{kind:"warn",title:R}):null,(0,h.jsx)(a.Button,{label:E?'Saving\u2026':`Get a ${(0,l.gbp)(N)} gift card, pay at the till`,testID:"gift-buy-btn",disabled:E||Nx.maxPence,onPress:async()=>{L(!0),A('');try{const t=await(0,c.buyGift)(e,{amount:N,recipient:O,from:v,message:I});t.code&&y(e,t.id,t.code),H({id:t.id,code:t.code??'',ref:t.ref,pence:t.initialPence}),w()}catch(e){A((0,r.plainError)(e))}finally{L(!1)}}})]})})}):(0,h.jsx)(a.Banner,{kind:"demo",title:`${n} isn\u2019t selling gift cards in the app yet`,children:"Ask at the bar."})]})},_e.ShopLive=function({slug:e,venue:n,guestName:p}){const{info:x,mine:f,err:y,load:b,pay:S}=j(e),[w,k]=(0,t.useState)({}),[T,P]=(0,t.useState)(p),[D,C]=(0,t.useState)(!1),[O,$]=(0,t.useState)(''),[v,B]=(0,t.useState)(null);if(!x)return(0,h.jsx)(a.Screen,{title:"Shop",subtitle:n,children:y?(0,h.jsx)(a.Banner,{kind:"warn",title:y}):(0,h.jsx)(a.Muted,{children:"Loading\u2026"})});const I=Object.entries(w).filter(([,e])=>e>0).map(([e,t])=>({id:e,qty:t})),M=(0,o.basketTotal)(I,x.products);return(0,h.jsxs)(a.Screen,{title:"Shop",subtitle:`${n}: collect at the venue`,children:[v?(0,h.jsxs)(s.default,{testID:"shop-done",children:[(0,h.jsxs)(a.Banner,{kind:"warn",title:`Order ${v.ref}: pay ${(0,l.gbp)(v.total)} at the bar or till`,children:["Staff will have it ready to collect once it\u2019s paid.",S.cardOn?'':' Card payment in the app is coming soon.']}),(0,h.jsx)(m,{slug:e,kind:"shop",id:v.id,pay:S})]}):null,(0,h.jsx)(g,{onDone:b}),x.shopOn?(0,h.jsxs)(h.Fragment,{children:[x.products.length?x.products.map(e=>(0,h.jsx)(s.default,{testID:`shop-item-${e.id}`,children:(0,h.jsx)(a.Card,{children:(0,h.jsxs)(s.default,{style:{gap:4},children:[(0,h.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(a.T,{weight:"semibold",style:{flex:1},children:e.name}),(0,h.jsx)(a.T,{colour:u.colours.gold,children:(0,l.gbp)(e.pricePence)})]}),e.details?(0,h.jsx)(a.Muted,{children:e.details}):null,e.soldOut?(0,h.jsx)(a.Badge,{kind:"amber",label:"Sold out"}):(0,h.jsxs)(a.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,h.jsx)(a.Muted,{children:"How many"}),(0,h.jsx)(a.Stepper,{value:w[e.id]??0,min:0,max:20,label:`${e.name} quantity`,onChange:t=>k({...w,[e.id]:t})})]})]})})},e.id)):(0,h.jsx)(a.Muted,{children:"Nothing in the shop yet."}),I.length?(0,h.jsx)(s.default,{testID:"shop-basket",children:(0,h.jsx)(a.Card,{children:(0,h.jsxs)(s.default,{style:{gap:6},children:[(0,h.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(a.T,{weight:"semibold",children:"Total"}),(0,h.jsx)(a.T,{weight:"semibold",colour:u.colours.gold,children:(0,l.gbp)(M)})]}),(0,h.jsx)(a.Field,{label:"Name for collection",value:T,onChangeText:P,testID:"shop-name"}),(0,h.jsx)(a.Banner,{kind:"demo",title:"Payment",children:o.PAY_PLACEHOLDER}),O?(0,h.jsx)(a.Banner,{kind:"warn",title:O}):null,(0,h.jsx)(a.Button,{label:D?'Sending\u2026':'Order, pay at the till',testID:"shop-order-btn",disabled:D||!T.trim(),onPress:async()=>{C(!0),$('');try{const t=await(0,c.shopOrder)(e,I,T);B({id:t.id,ref:t.ref,total:t.totalPence}),k({}),b()}catch(e){$((0,r.plainError)(e))}finally{C(!1)}}})]})})}):null]}):(0,h.jsx)(a.Banner,{kind:"demo",title:`${n}\u2019s shop isn\u2019t open in the app yet`,children:"Ask at the bar."}),f.orders.length?(0,h.jsx)(s.default,{testID:"shop-mine",children:(0,h.jsx)(a.Card,{children:(0,h.jsxs)(s.default,{style:{gap:4},children:[(0,h.jsx)(a.H2,{children:"Your shop orders"}),f.orders.map(e=>(0,h.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsxs)(a.T,{style:{flex:1},children:[e.ref," \xb7 ",e.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')]}),(0,h.jsx)(a.Muted,{children:o.STATUS_WORDS[e.status]??e.status})]},e.ref))]})})}):null]})};var e,t=_r(d[0]),n=_r(d[1]),s=(e=n)&&e.__esModule?e:{default:e},a=_r(d[2]),l=_r(d[3]),r=_r(d[4]),o=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]);const p=e=>{if(!e)return'';try{return new Date(e).toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric',timeZone:'Europe/London'})}catch{return e.slice(0,10)}},x=e=>`cc-gift-codes:${e}:v1`;function f(e){try{return JSON.parse(globalThis.localStorage?.getItem(x(e))||'{}')}catch{return{}}}function y(e,t,n){try{const s=f(e);s[t]=n,globalThis.localStorage?.setItem(x(e),JSON.stringify(s))}catch{}}function j(e){const[n,s]=(0,t.useState)(null),[a,l]=(0,t.useState)({cards:[],orders:[]}),[o,u]=(0,t.useState)(''),[h,p]=(0,t.useState)({provider:'none',cardOn:!1,testMode:!0}),x=(0,t.useCallback)(()=>{u(''),(0,c.shopPublic)(e).then(s).catch(e=>u((0,r.plainError)(e))),(0,c.myShop)(e).then(l).catch(()=>{}),(0,c.payPublic)(e).then(p)},[e]);return(0,t.useEffect)(()=>{x()},[x]),{info:n,mine:a,err:o,load:x,pay:h}}function g({onDone:e}){const[n,l]=(0,t.useState)('');return(0,t.useEffect)(()=>{const t='undefined'!=typeof window?new URLSearchParams(window.location.search).get('paid'):null;if(!t||!/^[0-9a-f-]{36}$/.test(t))return;let n=0;const s=()=>(0,c.payStatus)(t).then(t=>{l(t.status),'paid'===t.status?e():n++<10&&setTimeout(s,2e3)}).catch(()=>{});s()},[e]),n?(0,h.jsx)(s.default,{testID:"pay-back",children:(0,h.jsx)(a.Banner,{kind:'paid'===n?'success':'warn',title:'paid'===n?'Paid by card (TEST MODE: no real money)':'expired'===n?'The card payment timed out. Pay at the bar or till.':'Checking the card payment\u2026'})}):null}function m({slug:e,kind:n,id:l,pay:o}){const[u,p]=(0,t.useState)(!1),[x,f]=(0,t.useState)('');return o.cardOn?(0,h.jsxs)(s.default,{testID:`pay-card-${n}`,style:{gap:4},children:[(0,h.jsx)(a.Button,{label:u?'Opening card payment\u2026':'Pay by card (TEST MODE)',kind:"secondary",disabled:u,onPress:async()=>{p(!0),f('');try{const t=await(0,c.payStart)(e,n,l);window.location.assign(t.url)}catch(e){f((0,r.plainError)(e))}finally{p(!1)}}}),(0,h.jsx)(a.Muted,{size:12,children:"Test mode: use a Stripe test card. No real money is taken."}),x?(0,h.jsx)(a.Banner,{kind:"warn",title:x}):null]}):null}},835,[30,127,813,816,1003,1375,1376,821,24]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"guestServer",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"staffServer",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"useGuestLoyalty",{enumerable:!0,get:function(){return _}}),e.refreshGuest=async function(t){if(!c())return;_.setState(n=>({loading:{...n.loading,[t]:!0}}));try{const n=await(0,o.rpc)('loyalty_public',{p_venue_slug:t});if(_.setState(r=>({info:{...r.info,[t]:n}})),await(0,o.guestSession)()){const n=await(0,o.rpc)('loyalty_my_card',{p_venue_slug:t});_.setState(r=>({card:{...r.card,[t]:n??null}}))}}finally{_.setState(n=>({loading:{...n.loading,[t]:!1}}))}},e.guestJoin=async function(t,n){if(!await(0,o.guestSession)())throw new Error('No connection. Try again when you are back online.');const r=await(0,o.rpc)('loyalty_guest_join',{p_venue_slug:t,p_name:n.name.trim(),p_phone:n.phone.trim()||null,p_email:n.email.trim()||null,p_consent:n.consent,p_consent_text:n.consentText,p_referral:n.referral?(0,l.cleanCode)(n.referral):null});return p(t,r),r},e.guestClaim=async function(t,n){if(!await(0,o.guestSession)())return{ok:!1,error:'No connection. Try again when you are back online.'};const r=await(0,o.rpc)('loyalty_guest_claim',{p_venue_slug:t,p_code:(0,l.cleanCode)(n)});return r?.error?{ok:!1,error:String(r.error)}:(p(t,r),{ok:!0,card:r,linked:!!r.linked})},e.guestLinkCode=async function(t){return(0,o.rpc)('loyalty_guest_link_code',{p_venue_slug:t})},e.guestLeave=async function(t){await(0,o.rpc)('loyalty_guest_leave',{p_venue_slug:t}),p(t,null)},Object.defineProperty(e,"staffFind",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"staffCard",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"staffStamp",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"staffRedeem",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"staffJoin",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"staffCode",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"staffRemove",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"loyaltySummary",{enumerable:!0,get:function(){return P}}),e.readSettings=async function(){const{data:t,error:n}=await u().from('loyalty_settings').select('*').eq('venue_id',y()).maybeSingle();if(n)throw n;return(0,l.settingsFromRow)(t)},e.saveSettings=async function(t){const{error:n}=await u().from('loyalty_settings').upsert({venue_id:y(),...(0,l.settingsToRow)(t),updated_by:(o.useSync.getState().staffRef??'').slice(0,80)||'manager',updated_at:(new Date).toISOString()},{onConflict:'venue_id'});if(n)throw n},e.readOffers=k,e.saveOffer=C,e.watchLoyalty=function(t){if(!f())return()=>{};const n=y();let r=u().channel(`cc-loyalty:${n}:${Math.random().toString(36).slice(2,8)}`);for(const o of['loyalty_settings','loyalty_offers','loyalty_guests','loyalty_stamps','loyalty_rewards','loyalty_referrals'])r=r.on('postgres_changes',{event:'*',schema:'public',table:o,filter:`venue_id=eq.${n}`},()=>t());return r.subscribe(),()=>{try{u().removeChannel(r)}catch{}}},e.migrateLocalOnce=async function(t,n,r){if(!f())return 0;const o=`loyalty:migrated:${y()}`;if(await n(o))return 0;let s=0;if(!(await k()).length)for(const n of t.offers.filter(t=>'offer'===t.kind&&!JSON.stringify(t).includes('(example)')))await C({title:n.title.slice(0,80),details:(n.body??'').slice(0,500),startsOn:null,endsOn:n.until??null,isOn:!!n.live}),s++;return await r(o),s};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]),o=_r(d[3]),s=_r(d[4]),l=_r(d[5]);const u=()=>(0,n.getSupabase)(),c=()=>(0,r.isSupabaseConfigured)()&&!s.PITCH,f=()=>c()&&'staff'===o.useSync.getState().kind&&!!o.useSync.getState().venueId,y=()=>{const t=o.useSync.getState().venueId;if(!t)throw new Error('Not connected to the venue yet.');return t},_=(0,t.create)(()=>({info:{},card:{},loading:{}}));const p=(t,n)=>_.setState(r=>({card:{...r.card,[t]:n}}));const b=t=>(0,o.rpc)('loyalty_staff_find',{p_venue:y(),p_q:t}),w=t=>(0,o.rpc)('loyalty_staff_card',{p_guest:t}),v=t=>(0,o.rpc)('loyalty_staff_stamp',{p_guest:t}),S=t=>(0,o.rpc)('loyalty_staff_redeem',{p_reward:t}),O=t=>(0,o.rpc)('loyalty_staff_join',{p_venue:y(),p_name:t.name.trim(),p_phone:t.phone.trim()||null,p_email:t.email.trim()||null,p_consent:t.consent,p_consent_text:t.consentText}),h=(t,n)=>(0,o.rpc)('loyalty_staff_code',{p_venue:y(),p_kind:t,p_guest:n??null}),j=t=>(0,o.rpc)('loyalty_staff_remove',{p_guest:t}),P=()=>(0,o.rpc)('loyalty_summary',{p_venue:y()});async function k(){const{data:t,error:n}=await u().from('loyalty_offers').select('*').eq('venue_id',y()).order('created_at');if(n)throw n;return(t??[]).map(l.offerFromRow)}async function C(t){const n={venue_id:y(),title:t.title.trim(),details:t.details.trim(),starts_on:t.startsOn||null,ends_on:t.endsOn||null,is_on:t.isOn,updated_at:(new Date).toISOString()},{error:r}=t.id?await u().from('loyalty_offers').update(n).eq('id',t.id):await u().from('loyalty_offers').insert(n);if(r)throw r}},836,[1008,862,1121,820,2,1003]); +__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.SoutersCustomerHome=function(){const[e,n]=(0,t.useState)(!1),[p,m]=(0,t.useState)(!1),[b,y]=(0,t.useState)('All'),S=(0,h.useMenu)('souters'),M=(0,t.useMemo)(()=>['All',...Array.from(new Set(S.map(e=>e.section)))],[S]),k=S.filter(e=>'All'===b||e.section===b);if(e)return(0,j.jsx)(u.Screen,{title:"Souter's Inn",back:!1,children:(0,j.jsx)(c.VenueRequestForm,{rid:"souters",kind:"table",onClose:()=>n(!1)})});if(p)return(0,j.jsxs)(u.Screen,{title:"Menu",subtitle:"Souter's Inn",back:!1,children:[(0,j.jsx)(u.Button,{kind:"ghost",label:"\u2039 Back",onPress:()=>m(!1)}),(0,j.jsxs)(u.Muted,{children:[x.SOUTERS_MENU_COUNT," dishes. Please speak to staff about allergens \u2014 nothing is signed off for ordering yet."]}),(0,j.jsx)(u.Row,{wrap:!0,gap:6,children:M.slice(0,12).map(e=>(0,j.jsx)(u.Chip,{label:e,selected:b===e,onPress:()=>y(e)},e))}),k.map(e=>(0,j.jsx)(o.default,{testID:`souters-dish-${e.id}`,children:(0,j.jsxs)(u.Card,{children:[(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,j.jsx)(u.T,{weight:"semibold",style:{flex:1},children:e.name}),(0,j.jsx)(u.T,{children:null==e.price?e.priceNote||'Ask staff':(0,f.gbp)(e.price)})]}),e.description?(0,j.jsx)(u.Muted,{children:e.description}):null,(0,j.jsx)(u.Muted,{children:"Awaiting allergen sign-off \xb7 not orderable yet"})]})},e.id))]});return(0,j.jsxs)(u.Screen,{title:"Souter's Inn",subtitle:"Kirkoswald \xb7 Southern Ayr",children:[(0,j.jsx)(l.RestaurantHero,{rid:"souters",size:160}),(0,j.jsx)(s.FindPub,{rid:"souters"}),(0,j.jsx)(u.Card,{children:(0,j.jsxs)(o.default,{testID:"souters-book-table",style:{gap:8},children:[(0,j.jsx)(u.T,{weight:"bold",children:"Book a table"}),(0,j.jsx)(u.Muted,{children:"Send a request to the venue. No deposit and no payment here \u2014 staff will confirm."}),(0,j.jsx)(u.Button,{label:"Book a table",onPress:()=>n(!0)})]})}),(0,j.jsx)(u.Card,{children:(0,j.jsxs)(o.default,{testID:"souters-menu-card",style:{gap:8},children:[(0,j.jsx)(u.T,{weight:"bold",children:"Menu"}),(0,j.jsxs)(u.Muted,{children:[x.SOUTERS_MENU_COUNT," dishes from the venue menus. Allergen information is not signed off yet \u2014 please speak to staff about allergens. Ordering stays off until the Head Chef signs each dish off."]}),(0,j.jsx)(u.Button,{kind:"secondary",label:"Browse the menu",onPress:()=>m(!0)})]})}),(0,j.jsx)(u.Muted,{children:"Table deposits are not set. Closing time (9pm or 10pm) to confirm. No payment is taken here."})]})},_e.SoutersStaffHome=function({app:e}){return(0,j.jsxs)(o.default,{testID:"souters-setup-home",style:{flex:1,padding:24,justifyContent:'center',gap:16,maxWidth:680,width:'100%',alignSelf:'center'},children:[(0,j.jsx)(l.RestaurantHero,{rid:"souters",size:180}),(0,j.jsx)(u.T,{size:24,weight:"bold",center:!0,children:e}),(0,j.jsxs)(u.Card,{children:[(0,j.jsx)(u.T,{weight:"bold",children:"Ready for venue setup"}),(0,j.jsx)(u.Muted,{children:"Contact: souters@southernayr.com \xb7 01655 760653. No named manager or staff list yet \u2014 no personal links have been created."})]}),(0,j.jsx)(u.Muted,{center:!0,children:"Areas are set (Restaurant, Bar, Mezzanine, Beer garden, Ice cream & cake corner). Table plan to confirm \u2014 no sample tables. Menu seeded without allergen sign-off."}),(0,j.jsx)(u.Muted,{center:!0,children:"Guests request a table in the Customer app. Proposed closing time to confirm."})]})};var e,s=r(d[0]),t=r(d[1]),n=r(d[2]),o=(e=n)&&e.__esModule?e:{default:e},l=r(d[3]),u=r(d[4]),c=r(d[5]),h=r(d[6]),f=r(d[7]),x=r(d[8]),j=r(d[9])},852,[861,30,127,860,813,863,819,816,1139,24]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"LAUNCHER_LINE",{enumerable:!0,get:function(){return u}}),_e.LauncherLine=function(){return(0,c.jsx)(l.default,{style:{borderTopWidth:1,borderColor:n.colours.border,paddingTop:10,marginTop:4},children:(0,c.jsx)(s.Muted,{center:!0,children:u})})},_e.HubTile=function({icon:e,label:u,sub:h,onPress:p,badge:f}){return(0,c.jsxs)(o.default,{accessibilityRole:"button",accessibilityLabel:u,onPress:p,style:({pressed:e})=>({flexBasis:'30%',flexGrow:1,maxWidth:'31.5%',minWidth:96,backgroundColor:e?'#1d1a14':n.colours.surface,borderRadius:14,borderWidth:1,borderColor:n.colours.border,padding:10,gap:2,alignItems:'center'}),children:[b.includes(e)?(0,c.jsx)(t.Icon,{name:e,size:24,colour:n.colours.gold}):(0,c.jsx)(s.T,{size:22,children:e}),(0,c.jsx)(s.T,{size:13,weight:"semibold",center:!0,children:u}),h?(0,c.jsx)(s.T,{size:11,colour:n.colours.muted,center:!0,children:h}):null,f?(0,c.jsx)(l.default,{style:{position:'absolute',top:6,right:6,backgroundColor:n.colours.gold,borderRadius:8,paddingHorizontal:5},children:(0,c.jsx)(s.T,{size:10,weight:"bold",colour:n.colours.onGold,children:f})}):null]})},r(d[0]);var o=e(r(d[1])),l=e(r(d[2])),s=r(d[3]),n=r(d[4]),t=r(d[5]),c=r(d[6]);const u='Card payments: not set up yet';const b=['bag','phone','box','calendarPlus','clock','star','userPlus','gift','alert','tag','sparkle','chat','hanger']},853,[30,263,127,813,821,959,24]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"attStatus",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"isConfirmed",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"timesheetRemote",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"weekdayOf",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"addDays",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"mondayOfDate",{enumerable:!0,get:function(){return I}}),Object.defineProperty(_e,"shiftsOn",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"shiftOf",{enumerable:!0,get:function(){return E}}),Object.defineProperty(_e,"visibleShifts",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"SUPPLIER_CATS",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"NLW_PENCE",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"MAX_CUSTOM_LINKS",{enumerable:!0,get:function(){return R}}),Object.defineProperty(_e,"WIX_IDS",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"isWixLink",{enumerable:!0,get:function(){return L}}),Object.defineProperty(_e,"DEFAULT_QUICK_LINKS",{enumerable:!0,get:function(){return T}}),_e.openShiftOf=$,_e.loggedBreakMins=D,Object.defineProperty(_e,"isOnBreak",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"DISPLAY_CLOCK_DEFAULT",{enumerable:!0,get:function(){return N}}),Object.defineProperty(_e,"useOwner",{enumerable:!0,get:function(){return V}}),Object.defineProperty(_e,"wageLabel",{enumerable:!0,get:function(){return q}}),Object.defineProperty(_e,"ROLE_LABEL",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"CAN",{enumerable:!0,get:function(){return K}}),_e.staffLabel=function(e){const t=e.nickname?.trim(),n=e.name.replace(/\s*\(([^)]*)\)\s*$/,(e,n)=>t&&n.trim().toLowerCase()===t.toLowerCase()?'':e);return t?`${n} (${t})`:n},Object.defineProperty(_e,"staffCalls",{enumerable:!0,get:function(){return W}}),Object.defineProperty(_e,"staffCalled",{enumerable:!0,get:function(){return F}}),Object.defineProperty(_e,"staffMatches",{enumerable:!0,get:function(){return G}});var e,t=_r(_d[0]),n=_r(_d[1]),a=_r(_d[2]),i=_r(_d[3]),s=_r(_d[4]),r=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),c=(e=d)&&e.__esModule?e:{default:e},u=_r(_d[8]),f=_r(_d[9]),l=_r(_d[10]),p=_r(_d[11]);const m=e=>e.out?e.signOff?'confirmed':'awaiting':'open',g=e=>!!e.out&&!!e.signOff,h={send:null},b=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`,k=e=>{const[t,n,a]=e.split('-').map(Number);return(new Date(t,n-1,a).getDay()+6)%7},y=(e,t)=>{const[n,a,i]=e.split('-').map(Number);return b(new Date(n,a-1,i+t))},I=e=>y(e,-k(e)),w=(e,t)=>e.filter(e=>e.date===t),E=(e,t,n)=>e.find(e=>e.staffId===t&&e.date===n),S=(e,t)=>t?e:e.filter(e=>e.published),O=['Fish & seafood','Meat','Fruit & veg','Dairy','Dry goods','Drinks/brewery','Cleaning','Packaging','Equipment/maintenance'],v=1271,R=6,_=['ql-wix-view','ql-wix-edit'],L=e=>_.includes(e.id)||'Website bookings'===e.group,T=[{id:'ql-gmail',label:'Work email (Gmail)',url:'',icon:'\u2709\ufe0f',kind:'gmail',staff:!1,builtIn:!0},{id:'ql-wix-view',label:'View site',url:'https://www.anchoragedunure.com',icon:'\ud83c\udf10',kind:'link',group:'Website bookings',staff:!1,builtIn:!0},{id:'ql-wix-edit',label:'Edit site',url:'https://manage.wix.com',icon:'\ud83d\udd8a\ufe0f',kind:'link',group:'Website bookings',staff:!1,builtIn:!0}];function $(e,t,n){const a=new Date(n).getTime();return e.filter(e=>e.staffId===t&&e.in&&!e.out&&a-new Date(e.in).getTime()<72e6).sort((e,t)=>t.in.localeCompare(e.in))[0]}function D(e,t=new Date){const n=new Date(t).getTime();return Math.round((e.breaks??[]).reduce((e,t)=>e+Math.max(0,(t.end?new Date(t.end).getTime():n)-new Date(t.start).getTime()),0)/6e4)}const P=e=>!!e?.breaks?.some(e=>!e.end),A=e=>`${e}-${Math.random().toString(36).slice(2,8)}`,M=['#2A3B4C','#4A3A22','#40362A','#3E2A2A','#2E2E40'];function j(){return l.ROSTER.map(e=>({id:e.id,name:e.name,...e.nickname?{nickname:e.nickname}:{},role:e.role,job:e.job,active:!0,level:e.level,dept:e.dept,salaried:e.salaried,noTax:e.noTax,...N.includes(e.id)?{displayClock:!0}:{}}))}const N=['st-jack'];function C(){return Object.fromEntries(l.ROSTER.filter(e=>null!=e.hourlyPence).map(e=>[e.id,e.hourlyPence]))}const U=()=>{const e={tronc:{method:'hours',points:{FOH:1,Bar:1,Kitchen:.8,KP:.6,Manager:1},includeManagers:!0,includeOwner:!1,custom:{},text:'The Anchorage tipping policy (template)\n\n1. 100% of tips paid by card and cash tips put in the tip jar go to staff. Nothing is deducted.\n2. Tips are pooled and shared by paid hours worked in each pay period (breaks excluded).\n3. The owner does not take a share. Managers share only for hours worked on the floor or in the kitchen.\n4. Tips are paid with wages, no later than the end of the month after the tip was paid.\n5. Tip records are kept for 3 years. Ask a manager for your records at any time.'},troncCash:{},troncHistory:[],troncLog:[],chat:[],chatMuted:{},referral:{giverReward:'Free dessert',friendReward:'\xa35 off first order',active:!0},referrals:[],reminders:{h24:!0,h2:!0,confirmText:!0},coats:[],merch:[],merchOrders:[],marketingDraft:void 0,socialAccounts:{facebook:!0,instagram:!0,tiktok:!0,youtube:!0},socialPosts:[],socialDraft:void 0,quickLinks:T.map(e=>({...e})),workEmail:'',staff:j(),rosterVersion:l.ROSTER_VERSION,previewRole:'owner',staffAs:l.ROSTER.find(e=>'staff'===e.app)?.id??l.ROSTER[0]?.id??'',offers:[],photos:[],changeRequests:[],changesUsed:2,site:t.VENUE_RID,branding:{},checks:{},lost:[],lostReports:[],campaigns:[],shifts:[],rotaPublished:void 0,leave:[],swaps:[],availability:{},attendance:[],attLog:[],timeRequests:[],geofence:{lat:55.4047,lng:-4.7606,radius:100},simLocation:'venue',consent:{},hourly:C(),payPeriod:'weekly',suppliers:[],supplierOrders:[],staffCanViewSuppliers:!1,readNotes:{},customerTags:{'cust-demo':['Allergy','Regular'],'cr-2':['VIP'],'cr-5':['Takeaway']}};if(s.LIVE_VENUE_BUILD&&!t.IS_ISOLATED_VENUE)return{...e,changesUsed:0,customerTags:{},socialAccounts:{facebook:!1,instagram:!1,tiktok:!1,youtube:!1},referral:{...e.referral,active:!1}};if(!t.IS_ISOLATED_VENUE)return e;for(const t of Object.keys(e))Array.isArray(e[t])&&(e[t]=[]);return{...e,site:t.VENUE_RID,staffAs:'',hourly:{},customerTags:{},geofence:{lat:0,lng:0,radius:100},tronc:{...e.tronc,text:t.IS_QUEUED_VENUE?n.queuedVenues[t.VENUE_RID].name+' tipping policy \u2014 to confirm.':t.IS_ABBOTSFORD?'The Abbotsford Hotel tipping policy \u2014 awaiting venue confirmation.':t.IS_KIRKTON?'The Kirkton Inn tipping policy \u2014 awaiting venue confirmation.':t.IS_GREENSIDE?'The Greenside Restaurant tipping policy \u2014 awaiting venue confirmation.':t.IS_WILDINGS?'Wildings Hotel & Restaurant tipping policy \u2014 awaiting venue confirmation.':t.IS_KIRKMICHAEL?"The Kirkmichael Arms tipping policy \u2014 awaiting venue confirmation.":"Souter's Inn tipping policy \u2014 awaiting venue confirmation."},changesUsed:0,socialAccounts:{facebook:!1,instagram:!1,tiktok:!1,youtube:!1},referral:{...e.referral,active:!1},quickLinks:t.IS_QUEUED_VENUE||t.IS_ABBOTSFORD||t.IS_KIRKTON?[]:t.IS_GREENSIDE?[{id:'greenside-phone',label:'Call 01655 889685',url:'tel:01655889685',icon:'',kind:'link',group:'Bookings',staff:!0,builtIn:!0}]:t.IS_WILDINGS?[{id:'wildings-phone',label:'Call to book',url:'tel:01655331401',icon:'\ud83c\udf10',kind:'link',group:'Bookings',staff:!0,builtIn:!0},{id:'wildings-email',label:'Email to book',url:'mailto:bookings@wildingsrestaurant-hotel.co.uk',icon:'\ud83c\udf10',kind:'link',group:'Bookings',staff:!0,builtIn:!0}]:t.IS_KIRKMICHAEL?[{id:'kirkmichael-site',label:'Venue website',url:'https://www.kirkmichaelarms.co.uk/',icon:'\ud83c\udf10',kind:'link',group:'Website',staff:!0,builtIn:!0}]:[{id:'souters-book',label:'Guest table requests',url:'https://covercharge-apps.static.hf.space/souters/customer-app/',icon:'\ud83c\udf10',kind:'link',group:'Bookings',staff:!0,builtIn:!0}],branding:{[t.VENUE_RID]:{accent:t.IS_QUEUED_VENUE?n.queuedVenues[t.VENUE_RID].branding.accent:t.IS_ABBOTSFORD?'#B89362':t.IS_KIRKTON?'#B46C54':t.IS_GREENSIDE?a.GREENSIDE_PALETTE.gold:t.IS_WILDINGS?'#FFE3A5':t.IS_KIRKMICHAEL?'#B87754':'#A4622E'}}}},V=(0,u.create)()((0,f.persist)((e,n)=>({...U(),setPreviewRole:t=>e({previewRole:t}),addStaff:(t,n,a)=>e(e=>({staff:[...e.staff,{id:A('st'),name:t,role:n,job:a,active:!0,level:x[n]}]})),saveSupplier:t=>e(e=>({suppliers:e.suppliers.some(e=>e.id===t.id)?e.suppliers.map(e=>e.id===t.id?t:e):[...e.suppliers,t]})),setRate:(t,n)=>e(e=>({hourly:{...e.hourly,[t]:Math.max(0,Math.round(n))}})),clearRate:t=>e(e=>{const n={...e.hourly};return delete n[t],{hourly:n}}),updateStaff:(t,n)=>e(e=>({staff:e.staff.map(e=>e.id===t?{...e,...n}:e)})),addOffer:t=>e(e=>({offers:[{...t,id:A('of')},...e.offers]})),updateOffer:(t,n)=>e(e=>({offers:e.offers.map(e=>e.id===t?{...e,...n}:e)})),addPhoto:t=>e(e=>({photos:[...e.photos,{id:A('ph'),caption:t,tone:M[e.photos.length%M.length]}]})),removePhoto:t=>e(e=>({photos:e.photos.filter(e=>e.id!==t)})),requestChange:(t,n)=>e(e=>e.changesUsed>=5?e:{changesUsed:e.changesUsed+1,changeRequests:[{id:A('cr'),text:t,at:n,status:'requested'},...e.changeRequests]}),setSite:n=>e({site:t.IS_ISOLATED_VENUE?t.VENUE_RID:n}),setBranding:(t,n)=>e(e=>{const a={...e.branding};return n?a[t]={...a[t],...n}:delete a[t],{branding:a}}),setOwner:t=>e(t),addSocialPost:t=>e(e=>({socialPosts:[{...t,id:A('sp')},...e.socialPosts]})),setSocialPost:(t,n)=>e(e=>({socialPosts:e.socialPosts.map(e=>e.id===t?{...e,...n}:e)})),chatSend:t=>e(e=>({chat:[...e.chat,{...t,id:(0,p.uuid)(),reactions:{},seenBy:t.seenBy??('system'===t.from?[]:[t.from])}]})),chatReact:(t,n,a)=>e(e=>({chat:e.chat.map(e=>{if(e.id!==t)return e;const i=e.reactions[n]??[];return{...e,reactions:{...e.reactions,[n]:i.includes(a)?i.filter(e=>e!==a):[...i,a]}}})})),chatSeen:(t,n)=>e(e=>e.chat.some(e=>e.ch===t&&!e.seenBy.includes(n))?{chat:e.chat.map(e=>e.ch!==t||e.seenBy.includes(n)?e:{...e,seenBy:[...e.seenBy,n]})}:e),chatPatch:(t,n)=>e(e=>({chat:e.chat.map(e=>e.id===t?{...e,...n}:e)})),chatMute:(t,n)=>e(e=>{const a=e.chatMuted[t]??[];return{chatMuted:{...e.chatMuted,[t]:a.includes(n)?a.filter(e=>e!==n):[...a,n]}}}),sys:(t,n,a)=>e(e=>({chat:[...e.chat,{id:A('m'),ch:t,from:'system',text:n,at:a,reactions:{},seenBy:[]}]})),tick:(t,n,a,i)=>e(e=>({checks:{...e.checks,[t]:{by:n,at:a,value:i}}})),untick:t=>e(e=>{const n={...e.checks};return delete n[t],{checks:n}}),addLost:t=>e(e=>({lost:[{...t,id:A('lp'),status:'held'},...e.lost]})),setLost:(t,n)=>e(e=>({lost:e.lost.map(e=>e.id===t?{...e,...n}:e)})),addCampaign:t=>e(e=>({campaigns:[{...t,id:A('cp')},...e.campaigns]})),setCampaign:(t,n)=>e(e=>({campaigns:e.campaigns.map(e=>e.id===t?{...e,...n}:e)})),setShifts:t=>e({shifts:t.map(e=>e.date?{...e,day:k(e.date)}:e)}),addShift:t=>e(e=>({shifts:[...e.shifts,{...t,day:k(t.date),published:!1,id:(0,p.uuid)()}]})),copyWeek:(t,a)=>{const i=n(),s=new Set(i.staff.filter(e=>e.active).map(e=>e.id)),r=[];for(let e=0;e<7;e++){const n=y(t,e),o=y(a,e);i.shifts.filter(e=>e.date===n&&s.has(e.staffId)&&!i.shifts.some(t=>t.staffId===e.staffId&&t.date===o)&&!r.some(t=>t.staffId===e.staffId&&t.date===o)).forEach(e=>r.push({id:(0,p.uuid)(),staffId:e.staffId,date:o,day:k(o),start:e.start,end:e.end,note:e.note,published:!1}))}return r.length&&e({shifts:[...i.shifts,...r]}),r.length},publishWeek:t=>{const n=y(t,6);let a=0;return e(e=>({shifts:e.shifts.map(e=>e.daten||e.published&&!e.changed?e:(a++,{...e,published:!0,changed:!1})),rotaPublished:(new Date).toISOString()})),a},removeShift:t=>e(e=>({shifts:e.shifts.filter(e=>e.id!==t)})),markRead:t=>e(e=>({readNotes:{...e.readNotes,...Object.fromEntries(t.map(e=>[e,!0]))}})),toggleTag:(t,n)=>e(e=>{const a=e.customerTags[t]??[];return{customerTags:{...e.customerTags,[t]:a.includes(n)?a.filter(e=>e!==n):[...a,n]}}}),publishRota:t=>e({rotaPublished:t}),addLeave:t=>e(e=>({leave:[{...t,id:A('lv'),status:'pending'},...e.leave]})),setLeave:(t,n)=>e(e=>({leave:e.leave.map(e=>e.id===t?{...e,status:n}:e)})),addSwap:t=>e(e=>({swaps:[{...t,id:A('sw'),status:'open'},...e.swaps]})),setSwap:(t,n)=>e(e=>{const a=e.swaps.find(e=>e.id===t);return{shifts:'approved'===n&&a?.toId?e.shifts.map(e=>e.id===a.shiftId?{...e,staffId:a.toId}:e):e.shifts,swaps:e.swaps.map(e=>e.id===t?{...e,status:n}:e)}}),toggleAvail:(t,n)=>e(e=>{const a=e.availability[t]??[];return{availability:{...e.availability,[t]:a.includes(n)?a.filter(e=>e!==n):[...a,n]}}}),clock:(t,n,a,i,s,r)=>e(e=>{const o=e.attendance.filter(e=>e.staffId===t&&e.in&&!e.out&&new Date(i).getTime()-new Date(e.in).getTime()<72e6).sort((e,t)=>t.in.localeCompare(e.in))[0];if('in'===a)return o?e:{attendance:[...e.attendance,{id:(0,p.uuid)(),staffId:t,date:n,in:i,inSite:s}]};const d=e=>e?.map(e=>e.end?e:{...e,end:i});return o?{attendance:e.attendance.map(e=>e.id===o.id?{...e,out:i,outSite:s,breakMins:r??D({...e,breaks:d(e.breaks)}),breaks:d(e.breaks)}:e)}:e}),adjustClock:(t,n,a,i,s,r)=>e(e=>{const o=e.attendance.find(e=>e.id===t),d=e.staff.find(e=>e.id===o?.staffId),c=o?.[n]?new Date(o[n]).toTimeString().slice(0,5):'none';return{attendance:e.attendance.map(e=>e.id===t?{...e,[n]:a,adjusted:{by:i,at:r,reason:s}}:e),attLog:[{id:A('al'),at:r,text:`${i} changed ${d?.name??'staff'} clock-${n} from ${c} to ${new Date(a).toTimeString().slice(0,5)}: ${s}`},...e.attLog]}}),patchAttendance:(t,n,a)=>e(e=>({attendance:e.attendance.map(e=>e.id===t?{...e,...n,geo:a?[...e.geo??[],a].slice(-20):e.geo}:e)})),breakToggle:(t,a,i)=>{const s=n(),r=$(s.attendance,t,i);if(!r)return!1;const o=r.breaks??[],d=o.some(e=>!e.end);if('start'===a?d:!d)return!1;const c='start'===a?[...o,{start:i}]:o.map(e=>e.end?e:{...e,end:i});return e({attendance:s.attendance.map(e=>e.id===r.id?{...e,breaks:c,breakMins:D({breaks:c})}:e)}),!0},adjustBreak:(t,n,a,i,s)=>e(e=>{const r=e.attendance.find(e=>e.id===t),o=e.staff.find(e=>e.id===r?.staffId);return{attendance:e.attendance.map(e=>e.id===t?{...e,breakMins:n,adjusted:{by:a,at:s,reason:i}}:e),attLog:[{id:A('al'),at:s,text:`${a} changed ${o?.name??'staff'} break from ${r?.breakMins??0}m to ${n}m: ${i}`},...e.attLog]}}),overrideEntry:t=>{const a=n(),i=t.id?a.attendance.find(e=>e.id===t.id):void 0,s=t.reason.trim();if(s.length<3)return null;if(t.out&&t.out<=t.in)return null;const r=e=>e?new Date(e).toTimeString().slice(0,5):'none',o=(e,n,a)=>({at:t.now,by:t.by,byId:t.byId,action:e,from:n,to:a,reason:s}),d=a.staff.find(e=>e.id===t.staffId)?.name??'staff';let c;const u=[];if(i){const e=[...i.audit??[]];if(i.signOff&&(e.push(o('reopened','Confirmed','Awaiting sign-off')),u.push(`${t.by} reopened ${d}'s confirmed ${i.date} entry`)),i.in!==t.in&&(e.push(o('clock_in',r(i.in),r(t.in))),u.push(`${t.by} changed ${d} clock-in from ${r(i.in)} to ${r(t.in)}: ${s}`)),(i.out??'')!==(t.out??'')&&(e.push(o('clock_out',r(i.out),r(t.out))),u.push(`${t.by} changed ${d} clock-out from ${r(i.out)} to ${r(t.out)}: ${s}`)),(i.breakMins??0)!==t.breakMins&&(e.push(o('break',`${i.breakMins??0}m`,`${t.breakMins}m`)),u.push(`${t.by} changed ${d} break from ${i.breakMins??0}m to ${t.breakMins}m: ${s}`)),e.length===(i.audit??[]).length)return i;const n=t.out?i.breaks?.map(e=>e.end?e:{...e,end:t.out}):i.breaks;c={...i,in:t.in,out:t.out,breakMins:t.breakMins,breaks:n,signOff:void 0,adjusted:{by:t.by,at:t.now,reason:s},audit:e}}else c={id:t.id??(0,p.uuid)(),staffId:t.staffId,date:t.date,in:t.in,out:t.out,breakMins:t.breakMins,added:!0,adjusted:{by:t.by,at:t.now,reason:s},audit:[o('added',void 0,`${r(t.in)}\u2013${t.out?r(t.out):'open'}, break ${t.breakMins}m`)]},u.push(`${t.by} added ${d}'s ${t.date} entry ${r(t.in)}\u2013${t.out?r(t.out):'open'} (break ${t.breakMins}m): ${s}`);return t.request&&(c={...c,audit:[...c.audit??[],o('request_applied')]}),h.send?.('attendance_override',c,{reason:s}),e(e=>({attendance:i?e.attendance.map(e=>e.id===i.id?c:e):[...e.attendance,c],attLog:[...u.reverse().map(e=>({id:A('al'),at:t.now,text:e})),...e.attLog]})),c},confirmEntries:(t,a,i,s)=>{const r=n(),o=new Set(t),d=[],c=r.attendance.map(e=>{if(!o.has(e.id)||!e.out||e.signOff)return e;const t={...e,signOff:{by:a,byId:i,at:s},audit:[...e.audit??[],{at:s,by:a,byId:i,action:'confirmed',from:'Awaiting sign-off',to:'Confirmed'}]};return d.push(t),t});return d.length?(d.forEach(e=>h.send?.('attendance_confirm',e)),e({attendance:c,attLog:[{id:A('al'),at:s,text:`${a} confirmed ${d.length} ${1===d.length?'entry':'entries'} (${[...new Set(d.map(e=>e.date))].join(', ')})`},...r.attLog]}),d.length):0},addTimeRequest:t=>e(e=>({timeRequests:[{...t,id:(0,p.uuid)(),status:'open'},...e.timeRequests]})),resolveTimeRequest:(t,a,i,s)=>{const r=n().timeRequests.find(e=>e.id===t);if(!r||'open'!==r.status)return;const o={...r,status:a,resolvedBy:i,resolvedAt:s};h.send?.('time_request_resolve',o),e(e=>({timeRequests:e.timeRequests.map(e=>e.id===t?o:e)}))},setGeofence:t=>e(e=>({geofence:{...e.geofence,...t}})),setSimLocation:t=>e({simLocation:t}),giveConsent:(t,n)=>e(e=>({consent:{...e.consent,[t]:n}})),resetOwner:()=>e(U()),syncRoster:()=>e(e=>{if(t.IS_ISOLATED_VENUE||e.rosterVersion===l.ROSTER_VERSION)return e;const n=new Map(e.staff.map(e=>[e.id,e]));return{staff:[...j().map(e=>({...e,active:n.get(e.id)?.active??!0})),...e.staff.filter(e=>!l.ROSTER.some(t=>t.id===e.id)&&!B.includes(e.id))],hourly:{...e.hourly,...C()},rosterVersion:l.ROSTER_VERSION}})}),{name:'covercharge-owner-v1',version:6,storage:(0,f.createJSONStorage)(()=>c.default),migrate:async(e,t)=>{if(s.LIVE_VENUE_BUILD&&e)return await(0,o.archiveChefCache)('owner',e),{...e,...(0,i.stripOwnerLiveSamples)(e)};if(e&&t<2&&Array.isArray(e.quickLinks)&&(e.quickLinks=e.quickLinks.map(e=>_.includes(e.id)||'Website bookings'===e.group?{...e,staff:!1}:e)),e&&t<3){const t=U();Object.assign(e,{staff:t.staff,hourly:t.hourly,shifts:t.shifts,leave:t.leave,swaps:t.swaps,availability:t.availability,attendance:[],attLog:[],consent:{},chat:[],chatMuted:{},troncHistory:[],staffAs:t.staffAs,previewRole:'owner',rosterVersion:l.ROSTER_VERSION,rotaPublished:void 0})}if(e&&t<4){const t=I(b(new Date));e.shifts=(e.shifts??[]).map(e=>e.date?e:{...e,date:y(t,e.day??0),published:!0}),e.timeRequests=e.timeRequests??[]}return s.LIVE_VENUE_BUILD&&e&&(Object.assign(e,(0,i.stripOwnerLiveSamples)(e)),e.chat=(e.chat||[]).filter(e=>!(0,r.isSeedChefChat)(e)),e.suppliers=(e.suppliers||[]).filter(e=>!/^sup-[1-9]$/.test(e.id)||!/^(Example|Sample)\b/.test(e.name)),e.supplierOrders=(e.supplierOrders||[]).filter(e=>!/\(example\)/i.test(e.by||''))),e}})),q=(e,t,n)=>e?.salaried&&null==t?'Owner, no hourly wage':null==t?'Not set':`${n(t)}/h`,B=['st-2','st-3','st-4','st-5'],x={owner:'Owner',manager:'Manager',staff:'Staff'},K={forecasts:e=>'staff'!==e,manage:e=>'staff'!==e,staffAdmin:e=>'owner'===e,billing:e=>'owner'===e,takings:e=>'staff'!==e,publishSocial:e=>'staff'!==e};const W=e=>[e.name.replace(/\s*\([^)]*\)\s*$/,'').replace(' (example)',''),e.nickname??''].map(e=>e.trim().toLowerCase()).filter(Boolean).flatMap(e=>[e,e.split(' ')[0]]).filter((e,t,n)=>n.indexOf(e)===t),F=(e,t)=>{const n=t.trim().toLowerCase();if(!n)return!1;const a=W(e);return a.includes(n)||a.includes(n.split(' ')[0])},G=(e,t)=>{const n=t.trim().toLowerCase();return!n||[e.name,e.nickname,e.job,e.dept].some(e=>(e??'').toLowerCase().includes(n))}},854,[5,6,1215,1134,833,1125,1137,1024,1008,1025,14,1147]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"photoSource",{enumerable:!0,get:function(){return C}}),_e.BoardPhoto=T,_e.PhotoZoom=M,_e.SpecialRow=P,_e.SpecialsTab=function({rid:e,declared:t,now:l}){const o=(0,f.useSpecials)(t=>t.current[e]??null),[n,c]=(0,s.useState)(null);if(!o)return(0,w.jsx)(p.Card,{children:(0,w.jsxs)(u.default,{testID:"specials-empty",style:{alignItems:'center',gap:6,paddingVertical:18},children:[(0,w.jsx)(p.T,{size:34,children:"\ud83e\uddd1\u200d\ud83c\udf73"}),(0,w.jsx)(p.T,{weight:"semibold",size:18,center:!0,children:"Today\u2019s specials are on their way"}),(0,w.jsx)(p.Muted,{center:!0,children:"The kitchen posts the specials board here as soon as it\u2019s written up. Check back soon, or ask a member of staff."})]})});const h=o.allergenCheck;return(0,w.jsxs)(u.default,{style:{gap:10},testID:"specials-tab",children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(u.default,{testID:"specials-updated",style:{flex:1},children:(0,w.jsx)(p.T,{weight:"semibold",colour:b.colours.goldLight,children:(0,y.freshness)(o,l)})}),(0,y.isToday)(o.postedAt,l)?(0,w.jsx)(p.Badge,{kind:"ok",label:"Today"}):(0,w.jsx)(p.Badge,{kind:"amber",label:"Not updated today"})]}),(0,y.isToday)(o.postedAt,l)?null:(0,w.jsx)(p.Muted,{children:"These are the most recent specials posted. Today\u2019s may differ, so please ask."}),o.photo?(0,w.jsxs)(u.default,{style:{gap:4},children:[(0,w.jsx)(T,{photo:o.photo,testID:"specials-photo",onPress:()=>c(o.photo)}),(0,w.jsx)(p.Muted,{center:!0,children:"Tap the photo to zoom"})]}):null,o.items.map(e=>(0,w.jsx)(P,{it:e,declared:t,signedBy:h?.by},e.id)),h?(0,w.jsxs)(p.Muted,{children:["Allergens for the typed specials were checked by ",h.by.replace(' (example)','')," at ",(0,j.hm)(new Date(h.at)),"."]}):null,o.photo&&!o.items.length?(0,w.jsx)(p.Muted,{children:"For allergens in these specials, please ask a member of staff before you order."}):null,(0,w.jsx)(p.Muted,{children:"Specials are served in the restaurant while they last. Ask your server to order one."}),(0,w.jsx)(M,{photo:n,onClose:()=>c(null)})]})};var t=r(d[0]),s=r(d[1]),l=e(r(d[2])),o=e(r(d[3])),n=e(r(d[4])),c=e(r(d[5])),u=e(r(d[6])),h=r(d[7]),p=r(d[8]),f=r(d[9]),x=r(d[10]),y=r(d[11]),j=r(d[12]),b=r(d[13]),w=r(d[14]);const k=r(d[15]),C=e=>e===y.SAMPLE_PHOTO?k:{uri:e};function T({photo:e,width:o,onPress:c,testID:h,label:p="Photo of the specials board"}){const[f,x]=(0,s.useState)(.75);(0,s.useEffect)(()=>{e!==y.SAMPLE_PHOTO?l.default.getSize(e,(e,t)=>e&&t&&x(e/t),()=>{}):x(.75)},[e]);const j=(0,w.jsx)(l.default,{source:C(e),resizeMode:"contain",accessibilityLabel:p,style:{width:o??'100%',aspectRatio:f,borderRadius:12,backgroundColor:(0,t.soutersSurface)('#1b1f1d')}});return c?(0,w.jsx)(n.default,{testID:h,accessibilityRole:"button",accessibilityLabel:`${p}. Tap to zoom`,onPress:c,children:j}):(0,w.jsx)(u.default,{testID:h,children:j})}function M({photo:e,onClose:l}){const[h,f]=(0,s.useState)(!1);return(0,s.useEffect)(()=>f(!1),[e]),(0,w.jsx)(o.default,{visible:!!e,transparent:!0,animationType:"fade",onRequestClose:l,children:(0,w.jsxs)(u.default,{testID:"specials-zoom",style:{flex:1,backgroundColor:(0,t.soutersSurface)('rgba(5,5,5,0.97)')},children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between',padding:12},children:[(0,w.jsx)(p.Button,{small:!0,kind:"secondary",label:h?'Zoom out':'Zoom in',onPress:()=>f(!h)}),(0,w.jsx)(p.Button,{small:!0,label:"Close",accessibilityLabel:"Close photo",onPress:l})]}),(0,w.jsx)(c.default,{horizontal:h,contentContainerStyle:{padding:12,alignItems:'center',justifyContent:'center',flexGrow:1},children:(0,w.jsx)(c.default,{contentContainerStyle:{alignItems:'center'},children:e?(0,w.jsx)(n.default,{onPress:()=>f(!h),accessibilityLabel:h?'Zoom out':'Zoom in',children:(0,w.jsx)(T,{photo:e,width:h?820:360})}):null})})]})})}function P({it:e,declared:t,signedBy:s}){const l=(0,x.conflictsFor)(e.allergens,t);return(0,w.jsx)(p.Card,{highlight:l.contains.length?b.colours.red:l.may.length?b.colours.amber:void 0,children:(0,w.jsxs)(u.default,{testID:"special-item",style:{gap:6},children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,w.jsx)(p.T,{weight:"semibold",style:{flex:1,paddingRight:8},children:e.name}),(0,w.jsx)(p.T,{weight:"semibold",colour:b.colours.gold,children:(0,y.priceText)(e.price)})]}),e.description?(0,w.jsx)(p.Muted,{children:e.description}):null,l.contains.length?(0,w.jsx)(p.Badge,{kind:"red",label:"\u26a0 Contains your allergen"}):l.may.length?(0,w.jsx)(p.Badge,{kind:"amber",label:"\u26a0 May contain your allergen"}):null,e.noAllergens&&!Object.keys(e.allergens).length?(0,w.jsx)(p.Muted,{children:"None of the 14 allergens listed"}):(0,w.jsx)(h.AllergenChips,{map:e.allergens,declared:t}),s?(0,w.jsxs)(p.Muted,{children:["Allergens checked by ",s.replace(' (example)','')]}):null]})})}},855,[878,30,196,256,263,151,127,829,813,856,814,857,818,821,24,1363]); +__d(function(g,r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useSpecials",{enumerable:!0,get:function(){return _}});var e,t=r(_d[0]),s=r(_d[1]),i=r(_d[2]),n=r(_d[3]),o=r(_d[4]),c=(e=o)&&e.__esModule?e:{default:e},l=r(_d[5]),d=r(_d[6]),h=r(_d[7]),u=r(_d[8]),y=r(_d[9]);const p=()=>{try{return(0,u.nowFrom)(u.useStore.getState().clock)}catch{return new Date}};let S=0;const f=()=>`sb-${Date.now().toString(36)}${(S++).toString(36)}`,b=(e,t)=>u.useStore.setState(s=>({audit:[{id:`au-${f()}`,restaurantId:e,at:p().toISOString(),kind:'allergy',text:t},...s.audit].slice(0,300)})),_=(0,l.create)()((0,d.persist)((e,t)=>({...n.IS_ISOLATED_VENUE||s.LIVE_VENUE_BUILD?{current:{},history:[]}:(0,h.seedSpecials)(p()),post:(t,s,i,n)=>{e(e=>(0,h.postBoard)(e,t,s,i,n,p(),f())),s.items.length&&b(t,`Specials board: allergens for ${s.items.length} typed special${1===s.items.length?'':'s'} checked and signed off by ${i}`)},clear:(t,s)=>{e(e=>(0,h.clearBoard)(e,t)),b(t,`Specials board cleared by ${s}`)},reuse:(s,i,n,o)=>{const c=t().history.find(e=>e.id===i);e(e=>(0,h.reuseBoard)(e,s,i,n,o,p(),f())),c?.items.length&&b(s,`Specials board re-used: ${c.items.length} typed special${1===c.items.length?'':'s'}, allergens as previously checked, signed off by ${n}`)},remove:t=>e(e=>(0,h.deleteFromHistory)(e,t))}),{name:'covercharge-specials-v1',storage:(0,d.createJSONStorage)(()=>c.default),version:1,partialize:e=>({current:e.current,history:e.history})})),E=async()=>{if(!(0,y.liveData)())return;const e=_.getState(),n=e=>String(e.id).startsWith('sb-seed')&&(!s.LIVE_VENUE_BUILD||(0,t.demoActor)(e.postedBy)&&(!e.allergenCheck||(0,t.demoActor)(e.allergenCheck.by))&&(!e.photo||e.photo===h.SAMPLE_PHOTO)&&e.items.every(e=>/\(sample\)/i.test(e.name))),o=Object.fromEntries(Object.entries(e.current).filter(([,e])=>!(e&&n(e)))),c=e.history.filter(e=>!n(e));Object.keys(o).length===Object.keys(e.current).length&&c.length===e.history.length||(s.LIVE_VENUE_BUILD&&await(0,i.archiveChefCache)('specials',{current:e.current,history:e.history}),_.setState({current:o,history:c}))};(0,y.onDataModeChange)(E);try{_.persist?.onFinishHydration?.(E)}catch{}E()},856,[1125,833,1137,5,1024,1008,1025,857,870,1053]); +__d(function(g,r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SAMPLE_PHOTO",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"HISTORY_MAX",{enumerable:!0,get:function(){return n}}),e.parsePrice=function(t){const n=t.trim().replace(/^\xa3\s*/,'');return n?/^\d{1,3}(\.\d{1,2})?$/.test(n)?Math.round(100*parseFloat(n)):NaN:null},Object.defineProperty(e,"priceText",{enumerable:!0,get:function(){return s}}),e.itemProblems=a,e.draftProblems=i,e.cycleAllergen=function(t,n){const s={...t};s[n]?'contains'===s[n]?s[n]='may':delete s[n]:s[n]='contains';return s},e.postBoard=function(t,n,s,a,l,c,d){const u=i(s);if(u.length)throw new Error(u[0]);const p={id:d,restaurantId:n,photo:s.photo,app:l,postedBy:a,postedAt:c.toISOString(),items:s.items.map(t=>({...t,name:t.name.trim(),description:t.description.trim()})),allergenCheck:s.items.length?{by:a,at:c.toISOString()}:null};return{current:{...t.current,[n]:p},history:o(t.history,t.current[n],n)}},e.clearBoard=function(t,n){return{current:{...t.current,[n]:null},history:o(t.history,t.current[n],n)}},e.reuseBoard=function(t,n,s,a,i,l,c){const d=t.history.find(t=>t.id===s&&t.restaurantId===n);if(!d)return t;const u={...d,id:c,app:i,postedBy:a,postedAt:l.toISOString(),reusedFrom:d.id,allergenCheck:d.items.length?{by:a,at:l.toISOString()}:null},p={...t,history:t.history.filter(t=>t.id!==s)};return{current:{...t.current,[n]:u},history:o(p.history,t.current[n],n)}},e.deleteFromHistory=function(t,n){return{...t,history:t.history.filter(t=>t.id!==n)}},Object.defineProperty(e,"historyFor",{enumerable:!0,get:function(){return l}}),e.whenText=h,Object.defineProperty(e,"isToday",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"freshness",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"lastUpdated",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"boardSummary",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"SAMPLE_ITEMS",{enumerable:!0,get:function(){return k}}),e.seedSpecials=function(n){const s=60*n.getHours()+n.getMinutes()>=702?S(n,0,11,42):new Date(n.getTime()-6e5),a=S(n,1,11,20),i=S(n,3,12,5);return{current:{anchorage:{id:'sb-seed-today',restaurantId:'anchorage',photo:null,items:k,postedAt:s.toISOString(),postedBy:'Head Chef (example)',app:'chef',allergenCheck:{by:'Head Chef (example)',at:s.toISOString()}}},history:[{id:'sb-seed-yday',restaurantId:'anchorage',photo:null,postedAt:a.toISOString(),postedBy:'Duty Manager (example)',app:'managers',allergenCheck:{by:'Duty Manager (example)',at:a.toISOString()},items:[{id:'sp-y1',name:'Pan-fried sea bass, samphire, brown shrimp butter (sample)',description:'Sample dish.',price:2100,allergens:{fish:'contains',crustaceans:'contains',milk:'contains'}},{id:'sp-y2',name:'Smoked haddock fishcake, poached egg (sample)',description:'Sample dish: with wholegrain mustard sauce.',price:1250,allergens:{fish:'contains',eggs:'contains',gluten:'contains',milk:'contains',mustard:'contains'}},{id:'sp-y3',name:'Lemon posset, shortbread (sample)',description:'Sample pudding.',price:750,allergens:{milk:'contains',gluten:'contains'}}]},{id:'sb-seed-photo',restaurantId:'anchorage',photo:t,items:[],postedAt:i.toISOString(),postedBy:'Head Chef (example)',app:'chef',allergenCheck:null}]}};const t='sample:chalkboard',n=8;const s=t=>null===t?'Ask your server':`\xa3${(t/100).toFixed(2)}`;function a(t){const n=[];t.name.trim().length<3&&n.push('Add a dish name'),null!==t.price&&(!Number.isFinite(t.price)||t.price<=0||t.price>5e4)&&n.push('Check the price');const s=Object.keys(t.allergens).length;return s||t.noAllergens||n.push('Choose its allergens, or tick \u201cNone of the 14\u201d'),s&&t.noAllergens&&n.push('Allergens chosen and \u201cNone of the 14\u201d both ticked'),n}function i(t){const n=[];return t.photo||t.items.length||n.push('Add a photo of the board or type at least one special'),t.items.forEach((t,s)=>a(t).forEach(t=>n.push(`Special ${s+1}: ${t}`))),t.items.length&&!t.allergensChecked&&n.push('Confirm you have checked the allergens'),n}const o=(t,s,a)=>{if(!s)return t;return[...[s,...t.filter(t=>t.restaurantId===a&&t.id!==s.id)].slice(0,n),...t.filter(t=>t.restaurantId!==a)]};const l=(t,n)=>t.history.filter(t=>t.restaurantId===n),c=t=>String(t).padStart(2,'0'),d=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],u=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],p=(t,n)=>t.getFullYear()===n.getFullYear()&&t.getMonth()===n.getMonth()&&t.getDate()===n.getDate();function h(t,n){const s=new Date(t),a=`${c(s.getHours())}:${c(s.getMinutes())}`;if(p(s,n))return`today at ${a}`;const i=new Date(n);return i.setDate(i.getDate()-1),p(s,i)?`yesterday at ${a}`:`${d[s.getDay()]} ${s.getDate()} ${u[s.getMonth()]} at ${a}`}const m=(t,n)=>p(new Date(t),n),y=(t,n)=>`Updated ${h(t.postedAt,n)}`,f=(t,n)=>`Last updated ${h(t.postedAt,n)} by ${t.postedBy}`,b=t=>[t.photo?'Photo':'',t.items.length?`${t.items.length} typed special${1===t.items.length?'':'s'}`:''].filter(Boolean).join(' + '),S=(t,n,s,a)=>{const i=new Date(t);return i.setDate(i.getDate()-n),i.setHours(s,a,0,0),i},k=[{id:'sp-hake',name:'Grilled hake, crushed new potatoes, salsa verde (sample)',description:'Sample dish: day-boat hake, lemon and caper salsa verde.',price:1950,allergens:{fish:'contains',mustard:'contains',sulphites:'may'}},{id:'sp-scallops',name:'Half-shell scallops, garlic and herb butter (sample)',description:'Sample dish: three scallops grilled in the shell, crusty bread.',price:1400,allergens:{molluscs:'contains',milk:'contains',gluten:'contains'}},{id:'sp-crab',name:'Crab and chilli linguine (sample)',description:'Sample dish: brown and white crab meat, chilli, parsley, lemon.',price:1850,allergens:{crustaceans:'contains',gluten:'contains',eggs:'contains',molluscs:'may'}},{id:'sp-mussels',name:'Mussels in cider and leek cream (sample)',description:'Sample dish: rope-grown mussels, dry cider, leeks, cream. Main with chips.',price:1300,allergens:{molluscs:'contains',milk:'contains',sulphites:'contains',celery:'may'}}]},857,[]); +__d(function(g,r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"addressWithoutInvite",{enumerable:!0,get:function(){return u.addressWithoutInvite}}),Object.defineProperty(_e,"inviteFromLocation",{enumerable:!0,get:function(){return u.inviteFromLocation}}),Object.defineProperty(_e,"useSession",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"rosterPerson",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"APP_NAME",{enumerable:!0,get:function(){return w}}),_e.sha256Hex=h,_e.inviteFromText=function(e){const t=e.trim(),n=t.match(/[?&#](?:invite|i)=([A-Za-z0-9_-]{10,})/);return n?n[1]:/^[A-Za-z0-9_-]{10,}$/.test(t)?t:null},_e.personForInvite=async function(e){if(a.IS_ISOLATED_VENUE)return;const t=await h(e);return t?l.ROSTER.find(e=>e.tokenHash===t):void 0},Object.defineProperty(_e,"DEVICE_KEY",{enumerable:!0,get:function(){return m}}),_e.deviceId=function(){try{if('undefined'==typeof localStorage)return null;let e=localStorage.getItem(m);if(!e||!/^[A-Za-z0-9_-]{16,64}$/.test(e)){const t=new Uint8Array(18);if(globalThis.crypto?.getRandomValues?.(t),!t.some(e=>e))for(let e=0;ee.toString(16).padStart(2,'0')).join(''),localStorage.setItem(m,e)}return e}catch{return null}},Object.defineProperty(_e,"START_INVITE",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"START_GO",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"START_LOYALTY_CODE",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"START_TABLE_TOKEN",{enumerable:!0,get:function(){return v}}),_e.appUrl=function(e,t){if('undefined'==typeof window||!window.location)return null;const{origin:n,pathname:o}=window.location,i=o.match(/^(.*?\/)(owner|staff|chef|display|customer)-app(\/|$)/),a=i?i[1]:'/';return`${n}${a}${e}-app/index.html${t?`#invite=${encodeURIComponent(t)}`:''}`},_e.levelJob=function(e,t){const n=(e??'').trim(),o=(t??'').trim();return n?!o||o.toLowerCase().startsWith(n.toLowerCase())?o||n:`${n} \xb7 ${o}`:o};var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},o=r(d[1]),i=r(d[2]),a=r(d[3]),c=r(d[4]),l=r(d[5]),u=r(d[6]);const s=(0,o.create)()((0,i.persist)(e=>({meId:null,welcomed:{},signIn:t=>e({meId:t,signedInAt:(new Date).toISOString()}),signOut:()=>e({meId:null,signedInAt:void 0}),markWelcomed:t=>e(e=>({welcomed:{...e.welcomed,[t]:(new Date).toISOString()}}))}),{name:'covercharge-session-v1',storage:(0,i.createJSONStorage)(()=>n.default),version:1})),f=e=>!a.IS_ISOLATED_VENUE&&e?l.ROSTER.find(t=>t.id===e):void 0,w={owner:'CoverCharge for Managers',staff:'CoverCharge for Staff',chef:'CoverCharge for Head Chef'};async function h(e){const t=globalThis.crypto?.subtle;if(!t)return null;const n=await t.digest('SHA-256',(new TextEncoder).encode(e));return Array.from(new Uint8Array(n)).map(e=>e.toString(16).padStart(2,'0')).join('')}const m=(0,a.venueKey)('covercharge-device-id');const p=(()=>{try{if('undefined'==typeof window||!window.location)return null;const e=(0,a.venueKey)(`cc-pending-invite:${c.APP_VARIANT}`);let t=(0,u.inviteFromLocation)(window.location.search,window.location.hash);try{t?localStorage.setItem(e,t):t=localStorage.getItem(e)}catch{}if(t&&!/^[A-Za-z0-9_-]{10,64}$/.test(t)&&(t=null),t&&window.history?.replaceState){const e=()=>{try{/[?&#]invite=/.test(window.location.href)&&window.history.replaceState(window.history.state,'',(0,u.addressWithoutInvite)(window.location.href))}catch{}};e();try{const e=window.history;for(const t of['pushState','replaceState']){const n=e[t].bind(e);e[t]=(e,t,o)=>n(e,t,null==o?o:/[?&#]invite=/.test(String(o))?(0,u.addressWithoutInvite)(new URL(String(o),window.location.href).toString()):o)}}catch{}for(const t of[300,1e3,2500,5e3,1e4,2e4])setTimeout(e,t)}return t}catch{return null}})(),y=(()=>{try{return'undefined'!=typeof window&&window.location?new URLSearchParams(window.location.search).get('go'):null}catch{return null}})(),S=(()=>{try{const e='undefined'!=typeof window&&window.location?new URLSearchParams(window.location.search).get('loyalty'):null;return e&&/^[A-Za-z0-9-]{4,12}$/.test(e)?e.toUpperCase():null}catch{return null}})(),v=(()=>{try{const e='undefined'!=typeof window&&window.location?new URLSearchParams(window.location.search).get('table'):null;return e&&/^[A-Za-z2-9]{16}$/.test(e)?e.toUpperCase():null}catch{return null}})()},858,[1024,1008,1025,5,806,14,1161]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.LoyaltyLive=function({slug:e,venue:r}){const{info:t,card:l,loading:i,err:u,load:y}=p(e),[S,v]=(0,n.useState)('');return t?t.cardOn||l?(0,f.jsxs)(o.Screen,{title:"Stamp card",subtitle:`${r}. This card is just for ${r}.`,children:[S?(0,f.jsx)(o.Banner,{kind:"success",title:S}):null,t.cardOn?null:(0,f.jsxs)(o.Banner,{kind:"info",children:[r," has paused the stamp card. Your stamps and rewards are kept."]}),l?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(o.H2,{children:[l.stamps," of ",l.needed," stamps"]}),(0,f.jsxs)(o.T,{colour:h.colours.gold,weight:"semibold",children:["Reward: ",l.reward]})]}),(0,f.jsx)(w,{n:l.stamps,of:l.needed}),(0,f.jsxs)(o.Muted,{children:["Staff add a stamp when you visit. ",t.stampExpiryDays?`Stamps last ${t.stampExpiryDays} days.`:'']})]}),l.rewards.length?(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsx)(o.H2,{children:"Ready to use"}),l.rewards.map(e=>(0,f.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(o.T,{weight:"semibold",style:{flex:1},children:e.title}),(0,f.jsx)(o.Muted,{children:e.expiresAt?`Use by ${x(e.expiresAt)}`:''})]},e.id)),(0,f.jsx)(o.Muted,{children:"Show this screen or your card to staff when you'd like to use a reward. Staff mark it used; each one works once."})]}):null,(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Your card"}),(0,f.jsx)(o.Muted,{children:"Staff scan this, or look you up by name, to add a stamp."}),(0,f.jsx)(s.QR,{value:(0,c.cardQr)(e,l.cardNo),size:170}),(0,f.jsx)(o.T,{center:!0,weight:"semibold",children:l.name}),(0,f.jsx)(o.T,{center:!0,size:20,weight:"bold",colour:h.colours.gold,children:(0,c.prettyCardNo)(l.cardNo)})]}),(0,f.jsx)(b,{slug:e,joined:!0,onDone:v}),t.referralOn?(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Bring a friend"}),(0,f.jsx)(o.T,{children:"Your code"}),(0,f.jsx)(o.T,{size:28,weight:"bold",colour:h.colours.gold,center:!0,children:l.referralCode}),(0,f.jsxs)(o.Muted,{children:["Your friend types it when they join. After their first stamp you get: ",t.referralGiver,". They get: ",t.referralFriend,"."]}),(0,f.jsxs)(o.Muted,{children:["Waiting: ",l.referrals.waiting," \xb7 Rewarded: ",l.referrals.rewarded]})]}):null,(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"History"}),l.history.length?l.history.map((e,n)=>(0,f.jsxs)(o.Muted,{children:[x(e.at)," ",j(e.at)," \xb7 ",e.what]},n)):(0,f.jsx)(o.Muted,{children:"No stamps yet."})]}),(0,f.jsx)(C,{slug:e}),(0,f.jsx)(k,{slug:e})]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsxs)(o.H2,{children:[t.needed," stamps = ",t.reward]}),(0,f.jsx)(w,{n:0,of:t.needed})]}),(0,f.jsx)(T,{slug:e,venue:r,referralOn:t.referralOn,onJoined:e=>v(e.note?`You're in. ${e.note}`:"You're in. Show your card to staff on your next visit.")}),(0,f.jsx)(b,{slug:e,joined:!1,onDone:v})]}),(0,f.jsxs)(o.Muted,{children:["Tip: your card is saved by ",r,", not on this phone, so you won't lose it. Rewards are kept on food, not drinks."]})]}):(0,f.jsxs)(o.Screen,{title:"Stamp card",subtitle:r,children:[(0,f.jsx)(o.Banner,{kind:"info",title:`${r} hasn't started a stamp card yet`,children:"When they do, you can join here."}),(0,f.jsxs)(o.Muted,{children:["Tip: offers from ",r," are under Offers on the home screen."]})]}):(0,f.jsxs)(o.Screen,{title:"Stamp card",subtitle:r,children:[u?(0,f.jsx)(o.Banner,{kind:"warn",title:"Couldn't load the stamp card",children:u}):(0,f.jsx)(o.Muted,{children:i?'Loading your card\u2026':'Loading\u2026'}),u?(0,f.jsx)(o.Button,{kind:"secondary",label:"Try again",onPress:y}):null,(0,f.jsxs)(o.Muted,{children:["Tip: your card is saved by ",r,", so it's the same on any phone once you sign in with a code."]})]})},_e.OffersLive=function({slug:e,venue:n}){const{info:r,err:t,load:s}=p(e);return(0,f.jsxs)(o.Screen,{title:"Offers",subtitle:n,children:[!r&&t?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(o.Banner,{kind:"warn",title:"Couldn't load offers",children:t}),(0,f.jsx)(o.Button,{kind:"secondary",label:"Try again",onPress:s})]}):null,r?r.offers.length?r.offers.map(e=>(0,f.jsxs)(o.Card,{children:[(0,f.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(o.T,{weight:"semibold",style:{flex:1},children:e.title}),(0,f.jsx)(o.Badge,{kind:"gold",label:"Offer"})]}),e.details?(0,f.jsx)(o.Muted,{children:e.details}):null,e.endsOn?(0,f.jsxs)(o.Muted,{children:["Until ",x(e.endsOn+'T12:00:00Z')]}):null]},e.id)):(0,f.jsxs)(o.Muted,{children:["No offers from ",n," right now."]}):t?null:(0,f.jsx)(o.Muted,{children:"Loading\u2026"}),(0,f.jsxs)(o.Muted,{children:["Tip: offers are set by ",n," and shown here only. Nothing is sent to your phone. Drinks promotions follow Scottish licensing rules."]})]})},_e.ReferLive=function({slug:e,venue:n}){const{info:r,card:t}=p(e);return(0,f.jsxs)(o.Screen,{title:"Bring a friend",subtitle:n,children:[r?r.referralOn?(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsxs)(o.H2,{children:["You get: ",r.referralGiver]}),(0,f.jsxs)(o.T,{children:["Your friend gets: ",r.referralFriend]}),(0,f.jsx)(o.Muted,{children:"Your friend joins the stamp card with your code. You both get your reward after their first stamp."}),t?(0,f.jsx)(o.T,{size:30,weight:"bold",colour:h.colours.gold,center:!0,children:t.referralCode}):(0,f.jsx)(o.Banner,{kind:"info",children:"Join the stamp card first to get your code."}),t?(0,f.jsxs)(o.Muted,{children:["Waiting: ",t.referrals.waiting," \xb7 Rewarded: ",t.referrals.rewarded]}):null]}):(0,f.jsxs)(o.Banner,{kind:"info",children:[n," isn't running Bring a friend right now."]}):(0,f.jsx)(o.Muted,{children:"Loading\u2026"}),(0,f.jsxs)(o.Muted,{children:["Tip: tell your friend the code yourself. One reward per friend; it doesn't work on your own card, and ",n," may cap it each month."]})]})},_e.useLiveTile=function(e){const r=(0,u.useGuestLoyalty)(n=>n.info[e]),t=(0,u.useGuestLoyalty)(n=>n.card[e]);return(0,n.useEffect)(()=>{(0,u.refreshGuest)(e).catch(()=>{})},[e]),{stamps:r?t?`${t.stamps} of ${t.needed}`:r.cardOn?'Join':void 0:void 0,offers:r?.offers.length}};var n=_r(d[0]),r=e(n),t=e(_r(d[1])),s=_r(d[2]),o=_r(d[3]),l=_r(d[4]),i=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]),f=_r(d[9]);const x=e=>{try{return new Date(e).toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric',timeZone:'Europe/London'})}catch{return e.slice(0,10)}},j=e=>{try{return new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return''}};let y=!1;function p(e){const t=(0,u.useGuestLoyalty)(n=>n.info[e]),s=(0,u.useGuestLoyalty)(n=>n.card[e]),o=(0,u.useGuestLoyalty)(n=>!!n.loading[e]),[l,i]=(0,n.useState)(''),h=r.default.useCallback(()=>{i(''),(0,u.refreshGuest)(e).catch(e=>i((0,c.plainError)(e)))},[e]);return(0,n.useEffect)(()=>{h();const e=setInterval(h,3e4);return()=>clearInterval(e)},[h]),{info:t,card:s,loading:o,err:l,load:h}}function w({n:e,of:n}){return(0,f.jsx)(t.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:10,justifyContent:'center',paddingVertical:8},children:Array.from({length:n}).map((n,r)=>(0,f.jsx)(t.default,{accessibilityLabel:r!y&&i.START_LOYALTY_CODE?(y=!0,i.START_LOYALTY_CODE):''),[h,x]=(0,n.useState)(!1),[j,p]=(0,n.useState)('');return(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:r?'Got a code from staff?':'Already have a card?'}),(0,f.jsx)(o.Muted,{children:r?'Staff can give you a one-time code for a stamp. Type it here.':'Ask staff for a sign-in code, or make one on your other phone (Stamp card \u203a Use on another phone). Type it here to open your card.'}),(0,f.jsx)(o.Field,{label:"Code",value:s,onChangeText:e=>l(e.toUpperCase()),autoCapitalize:"characters",maxLength:9,placeholder:"e.g. 7KQ2MX",testID:"loyalty-code"}),j?(0,f.jsx)(o.Banner,{kind:"warn",children:j}):null,(0,f.jsx)(o.Button,{label:h?'Checking\u2026':'Use code',disabled:h||s.replace(/[^A-Za-z0-9]/g,'').length<6,onPress:async()=>{x(!0),p('');try{const n=await(0,u.guestClaim)(e,s);n.ok?(l(''),t(n.linked?'This phone now shows your card.':n.card.newReward?`Stamp added. You've earned: ${n.card.rewards[n.card.rewards.length-1]?.title??'a reward'}!`:'Stamp added.')):p(n.error)}catch(e){p((0,c.plainError)(e))}finally{x(!1)}},testID:"loyalty-use-code"})]})}function T({slug:e,venue:r,referralOn:t,onJoined:s}){const i=(0,l.useCustomer)(),[x,j]=(0,n.useState)(i.name??''),[y,p]=(0,n.useState)(i.phone??''),[w,b]=(0,n.useState)(i.email??''),[T,C]=(0,n.useState)(''),[k,S]=(0,n.useState)(!1),[v,L]=(0,n.useState)(!1),[M,B]=(0,n.useState)('');return(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsx)(o.H2,{children:"Join the stamp card"}),(0,f.jsx)(o.Muted,{children:"Only your name is needed. A phone number or email helps staff find your card if you lose this phone. Nothing is sent to you."}),(0,f.jsx)(o.Field,{label:"Your name",value:x,onChangeText:j,maxLength:60,testID:"loyalty-name"}),(0,f.jsx)(o.Field,{label:"Phone (optional)",value:y,onChangeText:p,keyboardType:"phone-pad",maxLength:20}),(0,f.jsx)(o.Field,{label:"Email (optional)",value:w,onChangeText:b,keyboardType:"email-address",autoCapitalize:"none",maxLength:120}),t?(0,f.jsx)(o.Field,{label:"Friend's code (optional)",value:T,onChangeText:e=>C(e.toUpperCase()),autoCapitalize:"characters",maxLength:8}):null,(0,f.jsx)(o.Toggle,{label:(0,c.consentText)(r),value:k,onChange:S,testID:"loyalty-consent"}),M?(0,f.jsx)(o.Banner,{kind:"warn",children:M}):null,(0,f.jsx)(o.Button,{label:v?'Joining\u2026':'Join',disabled:v||!k||!x.trim(),onPress:async()=>{L(!0),B('');try{s(await(0,u.guestJoin)(e,{name:x,phone:y,email:w,consent:k,consentText:(0,c.consentText)(r),referral:T}))}catch(e){B((0,c.plainError)(e))}finally{L(!1)}},testID:"loyalty-join"})]})}function C({slug:e}){const[r,t]=(0,n.useState)(null),[s,l]=(0,n.useState)('');return(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Use on another phone"}),(0,f.jsxs)(o.Muted,{children:["Make a code here, then on the other phone open ","the stamp card"," and type it under \"Already have a card?\". The code works once, for 15 minutes."]}),r?(0,f.jsx)(o.T,{size:30,weight:"bold",colour:h.colours.gold,center:!0,children:r.code}):null,r?(0,f.jsxs)(o.Muted,{center:!0,children:["Works until ",j(r.expiresAt)]}):null,s?(0,f.jsx)(o.Banner,{kind:"warn",children:s}):null,(0,f.jsx)(o.Button,{kind:"secondary",label:r?'Make a new code':'Make a code',onPress:()=>{l(''),(0,u.guestLinkCode)(e).then(t).catch(e=>l((0,c.plainError)(e)))}})]})}function k({slug:e}){const[r,t]=(0,n.useState)(!1),[s,l]=(0,n.useState)('');return(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Leave the stamp card"}),(0,f.jsx)(o.Muted,{children:"Your name, phone and email are removed and your stamps and rewards go. This can't be undone."}),s?(0,f.jsx)(o.Banner,{kind:"warn",children:s}):null,r?(0,f.jsxs)(o.Row,{gap:8,children:[(0,f.jsx)(o.Button,{kind:"danger",label:"Yes, remove me",onPress:()=>(0,u.guestLeave)(e).catch(e=>l((0,c.plainError)(e)))}),(0,f.jsx)(o.Button,{kind:"ghost",label:"Keep my card",onPress:()=>t(!1)})]}):(0,f.jsx)(o.Button,{kind:"ghost",label:"Leave the stamp card",onPress:()=>t(!0)})]})}},859,[30,127,867,813,819,858,1003,836,821,24]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"BUILTIN_LOGOS",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"HERO_LOGOS",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"HEADER_LOGO",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"ACCENTS",{enumerable:!0,get:function(){return z}}),_e.useBrandRid=k,_e.useBrand=L,_e.PoweredBy=O,_e.RestaurantLogo=S,_e.RestaurantHero=function({rid:e,size:o=200,showPlace:r=!0}){const c=L(e),u='wildings'===c.rid||'greenside'===c.rid||'kirkton'===c.rid||'abbotsford'===c.rid||(0,t.isQueuedVenue)(c.rid),b='yasmins'===c.rid?c.logo:u?w[c.rid]:c.custom?c.logo:w[c.rid]??c.logo;return(0,j.jsxs)(l.default,{testID:"restaurant-hero",style:{alignItems:'center',gap:6},children:[b?(0,j.jsx)(s.default,{source:b,accessibilityLabel:`${c.name} logo`,style:{width:o,height:o,borderRadius:!u&&c.custom?o/2:0},resizeMode:"contain"}):(0,j.jsx)(S,{rid:c.rid,size:o}),u?null:(0,j.jsx)(n.Text,{testID:"restaurant-hero-name",style:[{fontFamily:f.fonts.semibold,fontSize:26,lineHeight:34,color:f.colours.text,textAlign:'center'},(0,h.webLine)({lineHeight:34},26)],children:c.name}),r&&c.place?(0,j.jsx)(n.Text,{style:[{fontFamily:f.fonts.regular,fontSize:14,lineHeight:20,color:c.accentText,textAlign:'center'},(0,h.webLine)({lineHeight:20},14)],children:c.place}):null]})},_e.RestaurantBrand=function({rid:e,sub:t,size:o=T,nameSuffix:r}){const s=L(e);return(0,j.jsxs)(l.default,{style:{gap:2,flexShrink:1},children:[(0,j.jsx)(O,{}),(0,j.jsxs)(l.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,j.jsx)(S,{rid:s.rid,size:o}),(0,j.jsxs)(l.default,{style:{flexShrink:1},children:[(0,j.jsxs)(n.Text,{numberOfLines:1,style:[{fontFamily:f.fonts.semibold,fontSize:17,lineHeight:22,color:f.colours.text},(0,h.webLine)({lineHeight:22},17)],children:[s.name,r??'']}),t?(0,j.jsx)(n.Text,{numberOfLines:1,style:[{fontFamily:f.fonts.regular,fontSize:12,lineHeight:16,color:s.accentText},(0,h.webLine)({lineHeight:16},12)],children:t}):null]})]})]})};var t=_r(d[0]),n=_r(d[1]),o=_r(d[2]),r=e(_r(d[3])),s=e(_r(d[4])),l=e(_r(d[5])),c=_r(d[6]),u=_r(d[7]),f=_r(d[8]),h=_r(d[9]),b=_r(d[10]),x=_r(d[11]),y=_r(d[12]),j=_r(d[13]);const p={"3idiots":_r(d[14]),cecchinis:_r(d[15]),mrbasrais:_r(d[16]),yasmins:_r(d[17]),williewastles:_r(d[18]),rupeeroom:_r(d[19]),smokinggoat:_r(d[20]),pizzaioli:_r(d[21]),drunkencoo:_r(d[22]),abbotsford:_r(d[23]),kirkton:_r(d[24]),greenside:_r(d[25]),wildings:_r(d[26]),kirkmichael:_r(d[27]),souters:_r(d[28]),anchorage:_r(d[29]),saltmarsh:_r(d[30]),brae:_r(d[31])},w={"3idiots":_r(d[32]),cecchinis:_r(d[33]),mrbasrais:_r(d[34]),yasmins:_r(d[35]),williewastles:_r(d[36]),rupeeroom:_r(d[37]),smokinggoat:_r(d[38]),pizzaioli:_r(d[39]),drunkencoo:_r(d[40]),abbotsford:_r(d[41]),kirkton:_r(d[42]),greenside:_r(d[43]),wildings:_r(d[44]),kirkmichael:_r(d[45]),souters:_r(d[28]),anchorage:_r(d[46])};x.PITCH&&(delete p.anchorage,delete w.anchorage);const T=48,z=['#CFA45F','#D4AF61','#C9A24A','#E2C489','#F2EDE4','#A88B5A','#B08D57','#D9774B'];function k(e){const t=(0,o.useGlobalSearchParams)(),n=(0,u.useOwner)(e=>e.site),r='string'==typeof t.rid?t.rid:void 0;return b.IS_ISOLATED_VENUE?b.VENUE_RID:e??r??n??b.VENUE_RID}function L(e){const t=k(e),n=(0,c.useStore)(e=>e.restaurants.find(e=>e.id===t)),o=(0,u.useOwner)(e=>e.branding[t]),s=o?.logoUri?{uri:o.logoUri}:p[t],l=o?.accent??f.colours.gold,h=r.default.useMemo(()=>(0,y.checkAccent)(l,f.colours.bg,f.colours.onGold,f.colours.text),[l]);return{rid:t,name:n?.name??'Restaurant',place:n?.location??'',logo:s,accent:l,accentText:h.accentText,onAccent:h.onAccent,custom:!!o?.logoUri}}function O({size:e=10}){return(0,j.jsxs)(n.Text,{accessibilityLabel:"powered by CoverCharge",style:[{fontFamily:f.fonts.regular,fontSize:e,lineHeight:Math.round(1.35*e),color:f.colours.muted},(0,h.webLine)({lineHeight:Math.round(1.35*e)},e)],children:["powered by ",(0,j.jsx)(n.Text,{style:{fontFamily:f.fonts.semibold,color:f.colours.text},children:"Cover"}),(0,j.jsx)(n.Text,{style:{fontFamily:f.fonts.semibold,color:f.colours.gold},children:"Charge"})]})}function S({rid:e,size:t=T}){const o=L(e);if(o.logo)return(0,j.jsx)(s.default,{source:o.logo,accessibilityLabel:`${o.name} logo`,style:{width:t,height:t,borderRadius:o.custom?t/2:0},resizeMode:"contain"});const r=o.name.replace(/^The /,'').split(/\s+/).map(e=>e[0]).join('').slice(0,2).toUpperCase();return(0,j.jsx)(l.default,{accessibilityLabel:`${o.name} logo`,style:{width:t,height:t,borderRadius:t/2,borderWidth:2,borderColor:o.accentText,alignItems:'center',justifyContent:'center'},children:(0,j.jsx)(n.Text,{style:{fontFamily:f.fonts.bold,color:o.accentText,fontSize:.36*t},children:r})})}},860,[6,874,804,30,196,127,819,854,821,1251,5,2,1047,24,1253,1254,1255,1256,1257,1258,1259,1260,1261,1262,1263,1264,1265,1266,1267,1268,1269,1270,1271,1272,1273,1274,1275,1276,1277,1278,1279,1280,1281,1282,1283,1284,1285]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.FindPub=function({rid:e}){const p=(0,l.pubLocation)(e),[b,y]=(0,n.useState)(!1),[f,x]=(0,n.useState)(!1),[j,w]=(0,n.useState)(null),[I,v]=(0,n.useState)(null);if(!p)return null;const D=async()=>{y(!1),x(!0),v(null);const e=await(0,u.getFix)();x(!1),'object'==typeof e?(w(Math.round((0,c.distanceM)(p,e))),v(null)):(w(null),v('Your location was not shared. You can still use the address and open directions.'))};return(0,h.jsx)(o.Card,{children:(0,h.jsxs)(t.default,{testID:"find-pub",style:{gap:10},children:[(0,h.jsx)(o.T,{accessibilityRole:"header",weight:"bold",children:"Find us"}),(0,h.jsx)(o.T,{children:p.address}),(0,h.jsx)(o.Muted,{children:"See your approximate distance, or open directions. Location is optional and is never saved."}),(0,h.jsx)(o.Button,{testID:"find-pub-distance",label:f?'Finding your distance\u2026':'Find us \u2014 show my distance',accessibilityLabel:`Find ${p.name}, show my distance using my location once`,disabled:f,onPress:()=>y(!0)}),(0,h.jsxs)(t.default,{accessibilityLiveRegion:"polite",testID:"find-pub-result",children:[null!=j?(0,h.jsxs)(o.T,{children:["About ",j<1e3?`${j} m`:`${(j/1e3).toFixed(1)} km`," away, in a straight line."]}):null,I?(0,h.jsx)(o.T,{children:I}):null]}),(0,h.jsx)(o.Button,{testID:"find-pub-directions",kind:"secondary",label:"Open directions in Maps",accessibilityLabel:`Open directions to ${p.name}, ${p.address}, without sharing my location with CoverCharge`,onPress:()=>{s.default.openURL(`https://www.google.com/maps/dir/?api=1&destination=${encodeURIComponent(p.address)}`)}}),(0,h.jsx)(o.Sheet,{visible:b,onClose:()=>y(!1),title:"Use your location for distance?",testID:"find-pub-reason",children:(0,h.jsxs)(t.default,{style:{gap:12},children:[(0,h.jsxs)(o.T,{children:["We use your phone\u2019s location once to estimate how far you are from ",p.name,". Your position stays on this screen only: it is not stored or sent to the pub."]}),(0,h.jsx)(o.T,{children:"You can refuse location and still see the address and use directions."}),(0,h.jsx)(o.Button,{testID:"find-pub-allow",label:"Use my location once",onPress:()=>{D()}}),(0,h.jsx)(o.Button,{testID:"find-pub-cancel",kind:"secondary",label:"Not now \u2014 keep the address",onPress:()=>y(!1)})]})})]})})};var n=r(d[0]),s=e(r(d[1])),t=e(r(d[2])),o=r(d[3]),l=r(d[4]),c=r(d[5]),u=r(d[6]),h=r(d[7])},861,[30,239,127,813,1074,1160,1286,24]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.getSupabase=function(){if(_)return _;if(!(0,u.isSupabaseConfigured)())throw new Error('Supabase is not configured: set EXPO_PUBLIC_SUPABASE_URL and EXPO_PUBLIC_SUPABASE_ANON_KEY in .env.local');return _=(0,s.createClient)(u.SUPABASE_URL,u.SUPABASE_ANON_KEY,{auth:{storage:n.default,persistSession:!0,autoRefreshToken:!0,detectSessionInUrl:!1,storageKey:`${(0,o.syncNamespace)()}auth`},realtime:{params:{eventsPerSecond:10}}}),_},_e.setSupabaseClient=function(e){_=e};var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},s=r(d[1]),u=r(d[2]),o=r(d[3]);let _=null},862,[1024,1165,1121,1207]); +__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.VenueRequestForm=function({rid:e,kind:l,hotel:c,allDayHours:j,sessionHours:q,onClose:T}){const[D,f]=(0,o.useState)({name:'',phone:'',email:'',notes:'',date:(0,p.localDate)(),service:(0,t.isQueuedVenue)(e)||'greenside'===e?void 0:'Lunch',time:j||'greenside'===e?'10:00':'12:00',covers:2,checkIn:(0,p.localDate)(),checkOut:'',roomType:c?.roomTypes[0]?.id,guests:2,addDinner:!1}),v=e=>f(t=>({...t,...e})),[C,I]=(0,o.useState)(''),[S,w]=(0,o.useState)(''),[B,P]=(0,o.useState)(null),[R,Y]=(0,o.useState)(''),[M,N]=(0,o.useState)(!1),[$,V]=(0,o.useState)(!1),z=(0,o.useRef)(!1);(0,o.useEffect)(()=>{let s=!0;return(0,b.requestChallenge)(e,l).then(e=>{s&&P(e)}).catch(n=>{s&&Y((0,t.isQueuedVenue)(e)||['greenside','kirkton'].includes(e)?(0,b.requestMessage)(n).replace(/the hotel/g,'the restaurant'):(0,b.requestMessage)(n))}),()=>{s=!1}},[e,l]);const L=async()=>{if(z.current)return;const o=(0,t.isQueuedVenue)(e)?(0,s.queuedRequestError)(e,D,q):j&&'table'===l?(0,r.allDayRequestError)(D,j):(0,n.errorForVenue)(e,l,D,c);if(o)Y(o);else if(B&&C.trim()){z.current=!0,V(!0),Y('');try{await(0,b.sendVenueRequest)(e,l,D,B.id,C,S),N(!0)}catch(s){Y((0,t.isQueuedVenue)(e)||['greenside','kirkton'].includes(e)?(0,b.requestMessage)(s).replace(/the hotel/g,'the restaurant'):(0,b.requestMessage)(s))}finally{z.current=!1,V(!1)}}else Y('Complete the security check.')},F={minHeight:48,fontSize:18,color:y.colours.text};return(0,x.jsxs)(u.default,{testID:`venue-${l}-form`,style:{gap:16,alignItems:'stretch'},children:[(0,x.jsx)(h.H2,{children:'table'===l?'Book a table':'Book a room'}),(0,x.jsx)(h.T,{size:18,center:!0,children:'greenside'===e?'No payment is taken for this request. Deposit terms to confirm. This is a request, not an instant confirmation.':'No deposit. No payment. This is a request, not an instant confirmation.'}),M?(0,x.jsx)(h.Banner,{kind:"info",title:'greenside'===e?'Request sent. A Greenside manager must confirm your table.':c?.enabled?'Request sent. The hotel will contact you to confirm.':'Request sent. The venue will contact you to confirm.',children:"Nothing has been charged. No email or text is sent by this app."}):(0,x.jsxs)(x.Fragment,{children:['table'===l?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(k,{label:"Date (YYYY-MM-DD)",testID:"request-date",value:D.date,onChangeText:e=>v({date:e}),placeholder:"2026-11-20",style:F}),(0,t.isQueuedVenue)(e)||'greenside'===e||j?null:(0,x.jsx)(h.Row,{wrap:!0,children:['Lunch','Dinner'].map(e=>(0,x.jsx)(h.Button,{testID:`request-service-${e.toLowerCase()}`,label:e+(D.service===e?' \xb7 selected':''),kind:D.service===e?'primary':'secondary',onPress:()=>v({service:e,time:'Lunch'===e?'12:00':'18:00'}),style:{alignSelf:'auto'}},e))}),(0,x.jsx)(h.T,{size:18,weight:"semibold",center:!0,children:"Time within kitchen hours"}),(0,x.jsx)(h.Row,{wrap:!0,children:((0,t.isQueuedVenue)(e)?(0,s.queuedRequestSlots)(e,D.date||'',q):j?(0,r.allDaySlots)(D.date||'',j):(0,n.slotsForVenue)(e,D.date||'',D.service||'Lunch')).map(e=>(0,x.jsx)(h.Button,{testID:`request-time-${e.replace(':','')}`,label:e+(D.time===e?' \xb7 selected':''),kind:D.time===e?'primary':'secondary',onPress:()=>v({time:e}),style:{alignSelf:'auto'}},e))}),(0,x.jsx)(k,{label:"Covers",testID:"request-covers",keyboardType:"number-pad",value:String(D.covers??''),onChangeText:e=>v({covers:Number(e)}),style:F})]}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(h.T,{size:18,center:!0,children:[null==c?.bedrooms?'':`${c.bedrooms} bedrooms. `,c?.priceNote,"."]}),(0,x.jsx)(k,{label:"Check-in date (YYYY-MM-DD)",testID:"request-check-in",value:D.checkIn,onChangeText:e=>v({checkIn:e}),style:F}),(0,x.jsx)(k,{label:"Check-out date (YYYY-MM-DD)",testID:"request-check-out",value:D.checkOut,onChangeText:e=>v({checkOut:e}),style:F}),(0,x.jsx)(h.T,{size:18,weight:"semibold",center:!0,children:"Room type"}),c?.roomTypes.map(e=>(0,x.jsx)(h.Button,{testID:`request-room-${e.id}`,label:`${e.name} \xb7 ${null==e.pricePence?'Price to confirm with the hotel':`${e.from?'from ':''}\xa3${e.pricePence/100}`} \xb7 ${c.breakfast}${D.roomType===e.id?' \xb7 selected':''}`,kind:D.roomType===e.id?'primary':'secondary',onPress:()=>v({roomType:e.id})},e.id)),(0,x.jsx)(k,{label:"Guests",testID:"request-guests",keyboardType:"number-pad",value:String(D.guests??''),onChangeText:e=>v({guests:Number(e)}),style:F}),(0,x.jsx)(h.Button,{testID:"request-add-dinner",label:"Add dinner \xb7 "+(D.addDinner?'Yes':'No'),kind:D.addDinner?'primary':'secondary',onPress:()=>v({addDinner:!D.addDinner})}),(0,x.jsx)(h.T,{size:18,center:!0,children:"The hotel will arrange dinner details with you."})]}),(0,x.jsx)(k,{label:"Name",testID:"request-name",autoComplete:"name",value:D.name,onChangeText:e=>v({name:e}),style:F}),(0,x.jsx)(k,{label:"Phone",testID:"request-phone",keyboardType:"phone-pad",autoComplete:"tel",value:D.phone,onChangeText:e=>v({phone:e}),style:F}),(0,x.jsx)(k,{label:"Email",testID:"request-email",keyboardType:"email-address",autoCapitalize:"none",autoComplete:"email",value:D.email,onChangeText:e=>v({email:e}),style:F}),(0,x.jsx)(k,{label:'table'===l?'Notes (allergies, occasion)':'Notes',testID:"request-notes",multiline:!0,maxLength:2e3,value:D.notes,onChangeText:e=>v({notes:e}),style:F}),(0,x.jsx)(u.default,{style:{display:'none'},accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",children:(0,x.jsx)(k,{label:"Leave this empty",value:S,onChangeText:w})}),B?(0,x.jsx)(k,{label:`Security check: ${B.question} = ?`,testID:"request-answer",keyboardType:"number-pad",value:C,onChangeText:I,style:F}):(0,x.jsx)(h.T,{size:18,center:!0,children:"Preparing security check\u2026"}),R?(0,x.jsx)(h.Banner,{kind:"warn",title:"Please check your request",children:R}):null,(0,x.jsx)(h.Button,{testID:"request-submit",label:$?'Sending request\u2026':'Send request',disabled:$||!B,onPress:()=>{L()}})]}),(0,x.jsx)(h.Button,{kind:"secondary",label:M?'greenside'===e?'Back to the restaurant':c?.enabled?'Back to the hotel':'Back to Customer home':'Back to Customer home',onPress:T})]})};var e,t=_r(d[0]),s=_r(d[1]),n=_r(d[2]),r=_r(d[3]),o=_r(d[4]),l=_r(d[5]),u=(e=l)&&e.__esModule?e:{default:e},c=_r(d[6]),h=_r(d[7]),y=_r(d[8]),p=_r(d[9]),b=_r(d[10]),x=_r(d[11]);function k({label:e,...t}){return(0,x.jsxs)(u.default,{style:{gap:6,alignSelf:'stretch',width:'100%'},children:[(0,x.jsx)(h.T,{size:18,weight:"semibold",center:!0,children:e}),(0,x.jsx)(c.TextInput,{accessibilityLabel:e,placeholderTextColor:y.colours.muted,...t,style:[{minHeight:48,fontSize:18,color:y.colours.text,backgroundColor:y.colours.surface2,borderWidth:1,borderColor:y.colours.border,borderRadius:12,padding:12},t.multiline?{minHeight:96,textAlignVertical:'top'}:null,t.style]})]})}},863,[6,1410,1411,1412,30,127,874,813,821,11,1413,24]); +__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"STEP_IDS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"STEP_TITLE",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"TEMPLATE_LABEL",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"DAY_NAMES",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"WEEK_ORDER",{enumerable:!0,get:function(){return u}}),e.cleanQuestionnaire=function(t,s){if(!t||'object'!=typeof t)return null;const o=t,n=o.venue??{},u=l(n.name,80);if(!u)return null;const b={};for(let a=0;a<7;a++){const t=o.hours?.days?.[a],s=Array.isArray(t)?p(t[0]):null,n=Array.isArray(t)?p(t[1]):null;b[a]=s&&n?[s,n]:null}const y=['cafe','bistro','restaurant','custom'].includes(o.tables?.template)?o.tables.template:'custom',f=(a,t)=>'number'==typeof a&&a>=0&&a<=t?Math.round(a):void 0,h=o.features??{};return{version:1,venueId:l(s??o.venueId,60)||'venue',source:'signup-form'===o.source||'from-config'===o.source?o.source:'imported',submittedAt:l(o.submittedAt,10),onboardedAt:l(o.onboardedAt,10),venue:{name:u,tagline:l(n.tagline,120),address:l(n.address,200),phone:l(n.phone,30),email:l(n.email,120),website:l(n.website,120),hasLogo:!!n.hasLogo},hours:{days:b,note:l(o.hours?.note,300)},tables:{template:y,tables:f(o.tables?.tables,300),covers:f(o.tables?.covers,2e3),areas:Array.isArray(o.tables?.areas)?o.tables.areas.map(a=>l(a,40)).filter(Boolean).slice(0,12):void 0},team:Array.isArray(o.team)?o.team.map(a=>({name:l(a?.name,60)??'',role:d.includes(a?.role)?a.role:'staff',job:l(a?.job,60),email:l(a?.email,120),phone:l(a?.phone,30)})).filter(a=>a.name).slice(0,200):[],suppliers:Array.isArray(o.suppliers)?o.suppliers.map(a=>({name:l(a?.name,80)??'',category:l(a?.category,40),phone:l(a?.phone,30),email:l(a?.email,120)})).filter(a=>a.name).slice(0,100):[],pay:o.pay&&'object'==typeof o.pay?(0,a.cleanPay)(o.pay):void 0,accounts:Array.isArray(o.accounts)?o.accounts.map(a=>({provider:l(a?.provider,40)??'',handle:l(a?.handle,120)})).filter(a=>/^[a-z0-9-]+$/.test(a.provider)).slice(0,40):void 0,features:{bookings:c(h.bookings,!0),takeaway:c(h.takeaway,!0),orderAtTable:c(h.orderAtTable,!1),tips:c(h.tips,!0),rota:c(h.rota,!0),games:c(h.games,!0),specials:c(h.specials,!0)},notes:l(o.notes,1e3)}},e.questionnaireFromFacts=function(a,t){const s=a.tables??0,o=0===s?'custom':s<=9?'cafe':s<=16?'bistro':'restaurant';return{version:1,venueId:a.id,source:'from-config',venue:{name:a.name,tagline:a.tagline,address:a.address,phone:a.phone,website:a.website,hasLogo:a.hasLogo},hours:{days:{...a.hours},note:a.hoursNote},tables:{template:a.tables?'custom':o,tables:a.tables,covers:a.covers,areas:a.areas},team:a.team,suppliers:a.suppliers,pay:a.pay,features:{bookings:!0,takeaway:!1!==a.takeaway,orderAtTable:!!a.orderAtTable,tips:!0,rota:!0,games:!1!==a.games,specials:!0},...t}},e.mergeQuestionnaire=function(a,t){if(!t)return a;const s={},o=Object.values(t.hours?.days??{}).some(Boolean);for(let n=0;n<7;n++)s[n]=o?t.hours.days[n]??null:a.hours.days[n]??null;return{...a,...t,venue:{...a.venue,...Object.fromEntries(Object.entries(t.venue).filter(([,a])=>void 0!==a&&''!==a))},hours:{days:s,note:t.hours?.note??a.hours.note},tables:{...a.tables,...Object.fromEntries(Object.entries(t.tables).filter(([,a])=>void 0!==a))},team:t.team.length?t.team:a.team,suppliers:t.suppliers.length?t.suppliers:a.suppliers,pay:t.pay??a.pay,accounts:t.accounts?.length?t.accounts:a.accounts,features:{...a.features,...t.features}}},e.hoursLines=function(a){return u.map(t=>({day:n[t],text:a[t]?`${a[t][0]} to ${a[t][1]}`:'Closed'}))},Object.defineProperty(e,"EXAMPLE_QUESTIONNAIRE",{enumerable:!0,get:function(){return b}});var a=r(_d[0]);const t=['venue','hours','tables','team','suppliers','accounts','pay','features'],s={venue:'Your venue',hours:'Opening hours',tables:'Table plan',team:'Your team',suppliers:'Suppliers',accounts:'Connected accounts',pay:'Pay & tips',features:'Features'},o={cafe:'Small caf\xe9 (about 8 tables)',bistro:'Bistro (about 14 tables)',restaurant:'Restaurant (about 24 tables, 2 areas)',custom:'My own layout'},n=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],u=[1,2,3,4,5,6,0],l=(a,t=200)=>'string'==typeof a?a.trim().slice(0,t):void 0,c=(a,t)=>'boolean'==typeof a?a:t,p=a=>'string'==typeof a&&/^([01]\d|2[0-3]):[0-5]\d$/.test(a)?a:null,d=['owner','manager','staff'];const b={version:1,venueId:'example',source:'signup-form',submittedAt:'2026-10-20',venue:{name:'Example Harbour Caf\xe9',tagline:'Coffee, cakes and crab rolls',address:'1 Example Quay, Exampletown',phone:'01632 960000',email:'hello@example.com',website:'example.com',hasLogo:!1},hours:{days:{0:['10:00','16:00'],1:null,2:['09:00','16:00'],3:['09:00','16:00'],4:['09:00','16:00'],5:['09:00','20:00'],6:['09:00','20:00']},note:'Shorter hours in winter'},tables:{template:'cafe',tables:8,covers:30,areas:['Inside','Terrace']},team:[{name:'Alex Example',role:'owner'},{name:'Sam Example',role:'manager',job:'Front of house manager'},{name:'Jo Example',role:'staff',job:'Barista'}],suppliers:[{name:'Example Dairy',category:'Dairy'},{name:'Example Fish Co',category:'Fish & seafood'}],pay:{tipsFrequency:'fortnightly',tipsAnchorPayday:'2026-11-02',tipsEndsDaysBefore:1,wagePayDay:28,wageCutoffDay:23,weekendRule:'none'},features:{bookings:!0,takeaway:!0,orderAtTable:!1,tips:!0,rota:!0,games:!0,specials:!0}}},864,[1023]); +__d(function(e,a,i,n,r,o,s){r.exports={version:1,venueId:"kirkmichael",source:"from-config",submittedAt:"2026-11-05",onboardedAt:"2026-11-05",venue:{name:"The Kirkmichael Arms",tagline:"Michelin-listed restaurant and bar in Kirkmichael, Ayrshire",address:"3-5 Straiton Road, Kirkmichael, South Ayrshire KA19 7PH",phone:"01655 750 200",email:"enquiries@thekirkmichaelarms.co.uk",website:"https://www.kirkmichaelarms.co.uk/",hasLogo:!0},hours:{days:{0:["13:00","22:30"],1:null,2:null,3:null,4:["13:00","22:30"],5:["13:00","22:30"],6:["13:00","22:30"]},note:"Thu\u2013Sun from 1pm; schema close 22:30. Michelin lists Sunday from 12:30 \u2014 confirm. Closed Mon\u2013Wed."},tables:{template:"restaurant",tables:null,covers:56,areas:["Restaurant","Bar","Private dining (The Room)"],needsConfirmation:!0,note:"56 covers from historical sale listing; private dining about 18. Table count unknown \u2014 ask Gordon/Justin."},team:[{name:"Justin Galea",role:"owner",job:"Chef & Owner",email:"enquiries@thekirkmichaelarms.co.uk",phone:"01655 750 200"}],suppliers:[],accounts:[{provider:"instagram",handle:"@kirkmichaelarms_unfiltered"},{provider:"facebook",handle:"kirkmichaelarms"},{provider:"gmail",handle:"enquiries@thekirkmichaelarms.co.uk"},{provider:"tripadvisor",handle:"The Kirkmichael Arms"},{provider:"google-business",handle:"The Kirkmichael Arms"}],pay:{tipsFrequency:"fortnightly",tipsAnchorPayday:"2026-11-07",tipsEndsDaysBefore:1,wagePayDay:28,wageCutoffDay:23,weekendRule:"none"},features:{bookings:!0,takeaway:!1,orderAtTable:!1,tips:!0,rota:!0,games:!0,specials:!0},notes:"Seed as venue_id kirkmichael (separate tenant). Chef-owner Justin Galea. Brand accent #B87754 (whisky amber); lion emblem + wordmark in branding/. Deposit amount unknown \u2014 leave off until Gordon confirms. Bookings currently via own site /booking (own website booking page noted in research only). Menu from live Sample menus 2026-11-05; specials board changes often. Never blend with other venues' data."}},865,[]); +__d(function(e,n,a,o,s,t,i){s.exports={version:1,venueId:"wildings",source:"from-config",submittedAt:"2026-11-05",venue:{name:"Wildings Hotel & Restaurant",tagline:"Coastal cuisine with character",address:"Maidens Road, Maidens, KA26 9NR",phone:"01655 331 401",email:"bookings@wildingsrestaurant-hotel.co.uk",website:"https://www.wildingshotel.com/",hasLogo:!0},hours:{days:{0:["12:00","21:00"],1:["12:00","21:00"],2:["12:00","21:00"],3:["12:00","21:00"],4:["12:00","21:00"],5:["12:00","21:00"],6:["12:00","21:00"]},note:"Lunch Mon\u2013Sat 12:00\u201314:00, Sun 12:00\u201314:30; dinner daily 18:00\u201321:00 (closed 14:00\u201318:00). Bar hours not published. Sunday lunch end time to confirm."},tables:{template:"restaurant",tables:null,covers:null,areas:["Dining room 1","Dining room 2"],needsConfirmation:!0,note:"Two dining rooms per website; names, tables and covers unknown."},team:[],suppliers:[],accounts:[{provider:"facebook",handle:"profile.php?id=100057663900963"},{provider:"instagram",handle:"@wildingsmaidens"}],pay:{tipsFrequency:"fortnightly",tipsAnchorPayday:"2026-11-07",tipsEndsDaysBefore:1,wagePayDay:28,wageCutoffDay:23,weekendRule:"none"},features:{bookings:!0,takeaway:!1,orderAtTable:!1,tips:!0,rota:!0,games:!0,specials:!0},notes:"Separate tenant, venue id wildings. Accent #FFE3A5 (logo star gold) on ink #272A2F. No demo/local roster. Authorised real team is loaded from this venue\u2019s server; remaining staff list and personal manager contacts are to confirm. Deposit off until confirmed. Bookings are by phone/email today; site is Duda, so no Wix sync. Pay settings are app defaults, to confirm. Never blend with other venues' data.",onboardedAt:"2026-11-05"}},866,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.QR=function({value:e,size:t=180}){return(0,n.jsx)(o.default,{style:{padding:12,backgroundColor:'#FFFFFF',borderRadius:12,alignSelf:'center',borderWidth:3,borderColor:u.colours.gold},children:(0,n.jsx)(l.default,{value:e,size:t,color:"#0B0B0B",backgroundColor:"#FFFFFF"})})},r(d[0]);var o=e(r(d[1])),l=e(r(d[2])),u=r(d[3]),n=r(d[4])},867,[30,127,1377,821,24]); +__d(function(g,_r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.forecastToday=function(i,u,l,h,f,y){const v=(0,s.examplesAllowed)(),k=(0,a.clampWeeks)(i.settings.forecastMinWeeks),M=v?null:y??(0,a.buildHistory)(i.id,u,l,[],f,k),w=v||!!M?.enough,b=(0,o.hoursFor)(i,f),H=[],O=(0,r.ymd)(f);let S=1;for(const e of h.filter(e=>e.date===O&&(null===e.restaurantId||e.restaurantId===i.id)))H.push(e.title.replace(/\s*\(substitute day\)/gi,'')),!1!==e.busier&&(S*='bank-holiday'===e.kind?1.25:'event'===e.kind?1.15:1.1);if(!b)return{open:!1,hours:[],restOfDay:{covers:0,low:0,high:0,takeaway:0,booked:0},flags:H,suggestions:['Kitchen closed today (per listed hours).'],multiplier:S,example:v,enough:w,minWeeks:k};const I=v?t.EXAMPLE_HISTORY[i.id]??t.EXAMPLE_HISTORY.default:w&&M?M:{covers:{},takeaway:{}},x=f.getDay(),E=c(i,f),C=(0,e.lastFoodOn)(i,O);let N=b.close.getMinutes()>0?b.close.getHours():b.close.getHours()-1;if(C){const[e,t]=C.time.split(':').map(Number);N=Math.min(N,t>0?e:e-1),'kitchen closes'!==C.reason&&H.push(`Last food orders ${C.time} (${C.reason})`)}const $=u.filter(e=>e.restaurantId===i.id&&e.date===O&&['confirmed','seated','finished'].includes(e.status)),_=$.filter(e=>!e.walkIn&&'finished'!==e.status).map(e=>Number(e.time.slice(0,2))),P=Math.min(E[0],b.open.getHours(),..._),T=Math.max(E[1],N,..._),A=[];for(let e=P;e<=T;e++){const t=e>=b.open.getHours()&&e<=N,o=I.covers[x]?.[e]??0,s=I.takeaway[x]?.[e]??0,a=$.filter(t=>!t.walkIn&&'finished'!==t.status&&Number(t.time.slice(0,2))===e).reduce((e,t)=>e+t.partySize,0),n=$.filter(t=>t.walkIn&&['seated','finished'].includes(t.status)&&Number(t.time.slice(0,2))===e).reduce((e,t)=>e+t.partySize,0),u=t?Math.round(o*i.settings.walkInShare*S):0,c=w&&t?Math.max(0,Math.round(o*S*(1-i.settings.walkInShare))-a):0,h=Math.max(n,u)+c,f=a+h,p=l.filter(t=>t.restaurantId===i.id&&'takeaway'===t.type&&'cancelled'!==t.status&&t.slotTime&&new Date(t.slotTime).getHours()===e&&(0,r.ymd)(new Date(t.slotTime))===O).length,y=t?Math.max(p,Math.round(s*S)):p;A.push({hour:e,booked:a,walkIns:h,covers:f,coversLow:w?Math.round(.8*f):f,coversHigh:w?Math.round(1.2*f):f,takeawayPlaced:p,takeaway:y,historicalCovers:o})}const L=p(i,x);if(w&&L){const e=L-A.reduce((e,t)=>e+t.covers,0),t=A.filter(e=>e.hour>=b.open.getHours()&&e.hour<=N);if(e>0&&t.length){const o=t.map(e=>e.historicalCovers),r=n(e,o.reduce((e,t)=>e+t,0)>0?o:t.map(()=>1));t.forEach((e,t)=>{const o=r[t];o&&(e.floorAdded=o,e.walkIns+=o,e.covers+=o,e.coversHigh=Math.max(e.coversHigh,Math.round(1.2*e.covers)))})}const o=A.reduce((e,t)=>e+t.coversLow,0);if(oMath.max(1,e.covers)));t.forEach((t,o)=>{t.coversLow=Math.min(t.covers,t.coversLow+e[o])})}}const R=f.getHours()+(f.getMinutes()>=30?1:0),D=A.filter(e=>e.hour>=R),j=D[0],W=e=>D.reduce((t,o)=>t+e(o),0),F={covers:W(e=>e.covers),low:W(e=>e.coversLow),high:W(e=>e.coversHigh),takeaway:W(e=>e.takeaway),booked:W(e=>e.booked)},G=[],z=i.settings.capacityPerHour,B=D.reduce((e,t)=>!e||t.covers>e.covers?t:e,void 0);B&&B.covers>=.85*z&&G.push(`Dining room near capacity around ${String(B.hour).padStart(2,'0')}:00 (about ${B.covers} of ${z} covers) \u2014 consider pausing or capping takeaway slots then.`);const V=D.find(e=>e.historicalCovers>0&&e.covers>1.1*e.historicalCovers);V&&G.push(`Busier than a usual ${['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'][x]} from ${String(V.hour).padStart(2,'0')}:00 \u2014 consider one more on the floor.`);F.takeaway>=10&&G.push(`About ${F.takeaway} takeaway orders expected \u2014 prep extra haddock and chips.`);w||G.unshift(`Not enough history yet. ${(0,s.notEnoughTip)(k)}`);G.length||G.push('Looks like a normal service \u2014 no action suggested.');return{open:!0,nextHour:j,hours:A,restOfDay:F,flags:H,suggestions:G,multiplier:S,example:v,enough:w,minWeeks:k,minCovers:L??void 0}},_e.spread=n,Object.defineProperty(_e,"ANCHORAGE_FORECAST_HOURS",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"forecastHoursOf",{enumerable:!0,get:function(){return u}}),_e.forecastWindow=c,Object.defineProperty(_e,"ANCHORAGE_MIN_COVERS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"MIN_COVERS_NOTE",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"minCoversOf",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"minCoversOn",{enumerable:!0,get:function(){return p}}),_e.coversRange=function(e,t,o=!0){const r=Math.min(e,t),s=Math.max(e,t),a=r===s?String(r):`${r} to ${s}`;return o?`${a} ${1===s?'cover':'covers'}`:a};var e=_r(d[0]),t=_r(d[1]),o=_r(d[2]),r=_r(d[3]),s=_r(d[4]),a=_r(d[5]);function n(e,t){const o=t.reduce((e,t)=>e+t,0)||1,r=t.map(t=>e*t/o),s=r.map(Math.floor);let a=e-s.reduce((e,t)=>e+t,0);return r.map((e,t)=>[e-Math.floor(e),t]).sort((e,t)=>t[0]-e[0]).forEach(([,e])=>{a>0&&(s[e]++,a--)}),s}const i={0:['12:00','22:00'],1:null,2:null,3:['12:00','22:00'],4:['12:00','22:00'],5:['12:00','22:00'],6:['12:00','22:00']},u=e=>e.settings.forecastHours??('anchorage'===e.id?i:{});function c(e,t){const r=(0,o.hoursFor)(e,t),s=r.close.getMinutes()>0?r.close.getHours():r.close.getHours()-1,a=u(e)[t.getDay()];if(!a)return[r.open.getHours(),s];const[n]=a[0].split(':').map(Number),[i,c]=a[1].split(':').map(Number);return[Math.min(n,r.open.getHours()),Math.max(c>0?i:i-1,s)]}const l={0:50,6:50},h='Gordon, 4 Nov 2026',f=e=>e.settings.minCoversByDay??('anchorage'===e.id?l:{}),p=(e,t)=>{const o=f(e)[t];return o&&o>0?Math.round(o):null}},868,[809,1026,815,818,1053,998]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.estimateWait=function(t,n,u){const o=Math.max(6,Math.round(n/6*u));return t*o}},869,[]); +__d(function(_g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"uuid",{enumerable:!0,get:function(){return y.uuid}}),_e.nowFrom=S,_e.linesFromBasket=w,Object.defineProperty(_e,"useStore",{enumerable:!0,get:function(){return C}}),Object.defineProperty(_e,"DEMO_CUSTOMER_ID",{enumerable:!0,get:function(){return u.DEMO_CUSTOMER_ID}});var e,t=_r(d[0]),a=_r(d[1]),r=_r(d[2]),n=_r(d[3]),s=_r(d[4]),i=_r(d[5]),o=(e=i)&&e.__esModule?e:{default:e},l=_r(d[6]),c=_r(d[7]),u=_r(d[8]),g=_r(d[9]),m=_r(d[10]),p=_r(d[11]),b=_r(d[12]),f=_r(d[13]),k=_r(d[14]),y=_r(d[15]);const $=(e,t,a)=>e.reduce((e,a)=>a.startsWith(t)?Math.max(e,Number(a.slice(t.length))||0):e,a)+1,I=e=>`${e}-${Math.random().toString(36).slice(2,8)}${Date.now().toString(36).slice(-3)}`;function S(e){return'live'===e.mode?new Date:new Date(e.simStartMs+(Date.now()-e.anchorRealMs))}function h(){const e=(0,u.defaultSimStart)();return{clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()},...(0,u.buildSeed)(e),outbox:[],msgTemplates:{}}}function w(e,t,a){return e.lines.flatMap(e=>{const r=t.find(t=>t.id===e.itemId);if(!r)return[];const n=(0,b.resolveItem)(r),s=(n.optionGroups??[]).flatMap(t=>t.choices.filter(t=>e.choiceIds.includes(t.id))),i=(n.price??0)+s.reduce((e,t)=>e+t.priceDelta,0),o=(0,p.conflictsFor)((0,p.effectiveAllergens)(n,e.choiceIds),a);return[{itemId:n.id,name:n.name,qty:e.qty,unitPrice:i,choices:s.map(e=>e.label),notes:e.notes,contains:o.contains,may:o.may,overridden:!!e.override&&o.contains.every(t=>e.override.allergens.includes(t)),prepMins:n.prepMins}]})}const O=e=>{const t='ABCDEFGHJKLMNPQRSTUVWXYZ23456789',a=()=>Array.from({length:4},()=>t[Math.floor(32*Math.random())]).join('');return`${e}-${a()}-${a()}-${a()}`},C=(0,l.create)()((0,c.persist)((e,t)=>{const a=()=>S(t().clock),r=(t,r,n)=>e(e=>({audit:[{id:I('au'),restaurantId:t,at:a().toISOString(),kind:r,text:n},...e.audit].slice(0,300)})),n=(a,n,s)=>{if(!a||s<=0)return 0;const i=t().giftCards.find(e=>e.code===a&&e.restaurantId===n);if(!i||i.balance<=0)return 0;const o=Math.min(i.balance,s);return e(e=>({giftCards:e.giftCards.map(e=>e.id===i.id?{...e,balance:e.balance-o}:e)})),r(n,'giftcard',`Gift card ${a.slice(0,8)}\u2026 redeemed \xa3${(o/100).toFixed(2)} (balance \xa3${((i.balance-o)/100).toFixed(2)})`),o},s=e=>{const a=t().restaurants.find(t=>t.id===e.restaurantId);a&&e.customerId===t().customer.id&&e.subtotal>=a.settings.stampMinSpend&&t().addStamp(e.restaurantId,e.customerId,'takeaway'===e.type?'Takeaway (auto on collection)':'Table QR bill (auto on payment)')},i=e=>(0,f.templatesFor)(t().msgTemplates[e]),o=a=>{a.length&&(e(e=>({outbox:[...a,...e.outbox].slice(0,300)})),(0,f.deliverQueued)(a.filter(e=>'queued'===e.status),(e,a)=>t().updateOutbox(e,a)))},l=(e,r)=>{const n=t().restaurants.find(e=>e.id===r.restaurantId);n&&o((0,f.composeBooking)(e,r,n,i(n.id),a().toISOString()))},c=e=>{const r=t().restaurants.find(t=>t.id===e.restaurantId);r&&o((0,f.composeOrder)(e,r,i(r.id),a().toISOString()))};return{...h(),resetDemo:()=>e(h()),setClockMode:()=>e({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}}),skipMinutes:()=>{},updateCustomer:t=>e(e=>({customer:{...e.customer,...t}})),setAllergy:(t,a)=>e(e=>{const r=e.customer.allergies.filter(e=>e.allergen!==t);return{customer:{...e.customer,allergies:a?[...r,{allergen:t,severity:a}]:r}}}),startBasket:(t,a,r)=>e(e=>{const n=e.basket.restaurantId===t&&e.basket.mode===a&&e.basket.tableNo===r;return{basket:{restaurantId:t,mode:a,tableNo:r,lines:n?e.basket.lines:[]}}}),addLine:t=>e(e=>({basket:{...e.basket,lines:[...e.basket.lines,{...t,key:I('ln')}]}})),setLineQty:(t,a)=>e(e=>({basket:{...e.basket,lines:a<=0?e.basket.lines.filter(e=>e.key!==t):e.basket.lines.map(e=>e.key===t?{...e,qty:a}:e)}})),overrideLine:(t,r)=>e(e=>({basket:{...e.basket,lines:e.basket.lines.map(e=>e.key===t?{...e,override:{allergens:r,at:a().toISOString()}}:e)}})),clearBasket:()=>e(e=>({basket:{...e.basket,lines:[]}})),placeOrder:({slotTime:s,tip:i,giftCardCode:o,notes:l,paidNow:u,phone:g,email:m})=>{const p=t(),b=p.basket,f=b.restaurantId,k=w(b,p.menu,p.customer.allergies),I=k.reduce((e,t)=>e+t.unitPrice*t.qty,0),S='table'===b.mode,h=$(p.orders.filter(e=>e.restaurantId===f).map(e=>e.ref),S?'Q-':'T-',S?p.counters.table:p.counters.order),O=u?n(o,f,I+i):0,C=I+i,v={id:(0,y.uuid)(),ref:`${S?'Q':'T'}-${h}`,restaurantId:f,customerId:p.customer.id,customerName:p.customer.name,type:b.mode,tableNo:b.tableNo,slotTime:s,lines:k,subtotal:I,tip:i,giftCardApplied:O,giftCardCode:O?o:void 0,total:C,paid:u?C:0,status:'new',createdAt:a().toISOString(),allergies:p.customer.allergies,readiness:{},notes:l,channel:'app',...'takeaway'===b.mode?{phone:g??p.customer.phone,email:m??p.customer.email}:{}};e(e=>({orders:[v,...e.orders],basket:{...e.basket,lines:[]},counters:S?{...e.counters,table:h}:{...e.counters,order:h}}));const A=k.filter(e=>e.overridden);return r(f,'order',`Order ${v.ref} placed (${S?`Table ${b.tableNo}`:'takeaway'})${A.length?` \u2014 ALLERGY OVERRIDE on ${A.map(e=>e.name).join(', ')}`:''}`),v.allergies.length&&r(f,'allergy',`Allergies declared and confirmed by customer on ${v.ref}: ${v.allergies.map(e=>`${e.allergen} (${e.severity})`).join(', ')}`),c(v),v},setOrderStatus:(a,n,i)=>{const o=t().orders.find(e=>e.id===a);o&&((0,k.statusBlock)(o,n,(0,k.linkedBooking)(o,t().bookings))||(e(e=>({orders:e.orders.map(e=>e.id===a?{...e,status:n}:e)})),r(o.restaurantId,'order',`${o.ref} \u2192 ${n}${i?` by ${i}`:''}`),'collected'===n&&'takeaway'===o.type&&s(o)))},ackOrderAllergy:(n,s)=>{const i=t().orders.find(e=>e.id===n);if(!i||!(0,k.canSign)(i,'kitchen',(0,k.linkedBooking)(i,t().bookings)))return;const o={by:s,at:a().toISOString()};e(e=>({orders:e.orders.map(e=>e.id===n?{...e,allergyAck:o,status:'new'===e.status?'acknowledged':e.status}:e)})),r(i.restaurantId,'allergy',`Allergen sign-off 3/5 Kitchen on ${i.ref}: ${s} (chef signed off before cooking)`)},tickOrderAllergy:(n,s,i,o=!0)=>{const l=t().orders.find(e=>e.id===n);if(!l)return;const c={...l.allergyTicks??{}};o?c[s]={by:i,at:a().toISOString()}:delete c[s],e(e=>({orders:e.orders.map(e=>e.id===n?{...e,allergyTicks:c}:e)})),r(l.restaurantId,'allergy',`${l.ref}: kitchen ${o?'confirmed':'unticked'} ${s} (${i})`)},ackReadiness:(n,s,i)=>{const o=t().orders.find(e=>e.id===n);o&&('cook'===s&&(0,k.statusBlock)(o,'preparing',(0,k.linkedBooking)(o,t().bookings))||(e(e=>({orders:e.orders.map(e=>e.id===n?{...e,readiness:{...e.readiness,[s]:{by:i,at:a().toISOString()}},status:'cook'===s&&['new','acknowledged'].includes(e.status)?'preparing':e.status}:e)})),r(o.restaurantId,'order',`${o.ref}: ${'cook'===s?'started cooking':'bagged'} (${i})`)))},handoverCheck:(n,s)=>{const i=t().orders.find(e=>e.id===n);i&&(0,k.canSign)(i,'table',(0,k.linkedBooking)(i,t().bookings))&&(e(e=>({orders:e.orders.map(e=>e.id===n?{...e,handoverCheck:{by:s,at:a().toISOString()}}:e)})),r(i.restaurantId,'allergy',`Allergen sign-off 5/5 Table on ${i.ref}: ${s} (served and checked with the guest; chain complete)`))},signAllergyStep:(n,s,i)=>{const o=t().orders.find(e=>e.id===n);if(!o||!i.trim())return!1;const l=(0,k.linkedBooking)(o,t().bookings);if(!(0,k.canSign)(o,s,l))return!1;if('kitchen'===s)return t().ackOrderAllergy(n,i),!0;if('table'===s)return t().handoverCheck(n,i),!0;const c={by:i,at:a().toISOString()};'booked'===s&&l&&l.allergies.length&&!l.allergyAck?e(e=>({bookings:e.bookings.map(e=>e.id===l.id?{...e,allergyAck:c}:e)})):e(e=>({orders:e.orders.map(e=>e.id===n?{...e,allergyChain:{...e.allergyChain,[s]:c}}:e)}));const u=(0,k.stepInfo)(s);return r(o.restaurantId,'allergy',`Allergen sign-off ${u.n}/5 ${u.label} on ${o.ref}: ${i} (${u.what.toLowerCase()})`),!0},customerSignal:(t,a)=>e(e=>({orders:e.orders.map(e=>e.id===t?{...e,customerSignal:a}:e)})),setSplit:(t,a,r)=>e(e=>({orders:e.orders.map(e=>e.id===t?{...e,tip:r,total:e.subtotal+r,split:{ways:a,paidShares:e.split?.paidShares??0}}:e)})),payTable:(a,{shares:i,giftCardCode:o})=>{const l=t().orders.find(e=>e.id===a);if(!l)return;const c=l.split?.ways??1,u=Math.ceil(l.total/c),g=Math.min(c,(l.split?.paidShares??0)+i),m=g>=c,p=m?l.total-l.paid:Math.min(l.total-l.paid,u*i),b=n(o,l.restaurantId,p),f={...l,giftCardApplied:l.giftCardApplied+b,giftCardCode:b?o:l.giftCardCode,paid:l.paid+p,split:{ways:c,paidShares:g},status:m?'closed':l.status};e(e=>({orders:e.orders.map(e=>e.id===a?f:e)})),r(l.restaurantId,'order',`${l.ref} (Table ${l.tableNo}) ${m?'bill paid in full':`share ${g}/${c} paid`} (paid at the till)`),m&&s(f)},createBooking:n=>{const s=$(t().bookings.filter(e=>e.restaurantId===n.restaurantId).map(e=>e.ref),'BK-',t().counters.booking),i=t().restaurants.find(e=>e.id===n.restaurantId)?.settings,o='online'===n.source&&!!i&&(n.partySize>(i.autoAcceptUpTo??7)||!!i.reviewRequests&&!!n.notes.trim()),c={...n,id:(0,y.uuid)(),ref:`BK-${s}`,status:o?'pending':'confirmed',createdAt:a().toISOString()};return e(e=>({bookings:[...e.bookings,c],counters:{...e.counters,booking:s}})),r(c.restaurantId,'booking',`Booking ${o?'request ':''}${c.ref}: ${c.name}, ${c.partySize} on ${c.date} ${c.time}${c.source?` (${c.source})`:''}${c.allergies.length?' \u2014 allergies declared':''}`),l(o?'booking-request':'booking-confirmation',c),c},decideBooking:(n,s,i)=>{const o=t().bookings.find(e=>e.id===n);if(!o||'pending'!==o.status)return;const c={by:i,at:a().toISOString(),outcome:s},u='confirmed'===s?'confirmed':'cancelled';e(e=>({bookings:e.bookings.map(e=>e.id===n?{...e,status:u,decided:c}:e)})),r(o.restaurantId,'booking',`Booking request ${o.ref} (${o.name}, ${o.partySize}) ${s} by ${i}`),l('confirmed'===s?'booking-confirmation':'booking-declined',{...o,status:u})},addOutbox:t=>e(e=>({outbox:[...t,...e.outbox].slice(0,300)})),updateOutbox:(t,a)=>e(e=>({outbox:e.outbox.map(e=>e.id===t?{...e,...a}:e)})),clearOutbox:t=>e(e=>({outbox:e.outbox.filter(e=>e.restaurantId!==t)})),setTemplate:(t,a,r)=>e(e=>{const n={...e.msgTemplates[t]??{}};return null===r?delete n[a]:n[a]={...n[a]??{},...r},{msgTemplates:{...e.msgTemplates,[t]:n}}}),acceptOrder:(n,s,i)=>{const o=t().orders.find(e=>e.id===n);if(!o)return!1;const l='new'===o.status&&!!(0,k.statusBlock)(o,'acknowledged',(0,k.linkedBooking)(o,t().bookings)),c=a(),u=i?new Date(c.getTime()+6e4*i).toISOString():o.readyBy;return e(e=>({orders:e.orders.map(e=>e.id===n?{...e,status:'new'!==e.status||l?e.status:'acknowledged',accepted:e.accepted??{by:s,at:c.toISOString()},readyBy:u}:e)})),r(o.restaurantId,'order',`${o.ref} accepted by ${s}${i?`, ready by ${String(new Date(u).getHours()).padStart(2,'0')}:${String(new Date(u).getMinutes()).padStart(2,'0')}`:''}`),!l},setBookingStatus:(n,s)=>{const i=t().bookings.find(e=>e.id===n),o=a().toISOString();e(e=>({bookings:e.bookings.map(e=>e.id===n?{...e,status:s,...'seated'===s?{seatedAt:o}:'finished'===s?{finishedAt:o}:{}}:e)})),i&&r(i.restaurantId,'booking',`${i.ref} ${i.name} \u2192 ${s}`)},seatWalkIn:(n,s,i,o)=>{const l=a(),c=`${l.getFullYear()}-${String(l.getMonth()+1).padStart(2,'0')}-${String(l.getDate()).padStart(2,'0')}`,u=`${String(l.getHours()).padStart(2,'0')}:${String(l.getMinutes()).padStart(2,'0')}`,g=t().bookings.filter(e=>e.restaurantId===n&&e.walkIn&&e.date===c).reduce((e,t)=>Math.max(e,Number(t.ref.slice(2))||0),0)+1,m={id:(0,y.uuid)(),ref:`W-${g}`,restaurantId:n,customerId:null,name:'Walk-in',partySize:s,date:c,time:u,table:i||void 0,allergies:[],notes:(o??'').trim(),status:'seated',security:'none',depositPaid:0,createdAt:l.toISOString(),seatedAt:l.toISOString(),walkIn:!0,source:'walk-in'};return e(e=>({bookings:[...e.bookings,m]})),r(n,'walkin',`Walk-in ${m.ref} seated: ${s} cover(s)${i?`, Table ${i}`:', table to assign'}`),m},setBookingTable:(a,n)=>{const s=t().bookings.find(e=>e.id===a);e(e=>({bookings:e.bookings.map(e=>e.id===a?{...e,table:n}:e)})),s&&r(s.restaurantId,'booking',`${s.ref} ${s.name} \u2192 ${n?n.includes('+')?`Tables ${n.split('+').join(' + ')}`:`Table ${n}`:'no table'}`)},updateBooking:(a,n)=>{const s=t().bookings.find(e=>e.id===a);e(e=>({bookings:e.bookings.map(e=>e.id===a?{...e,...n}:e)})),s&&r(s.restaurantId,'booking',`${s.ref} ${s.walkIn?'Walk-in':s.name} moved/updated${n.table?` \u2192 Table ${n.table}`:''}${n.time?` at ${n.time}`:''}${n.durationMins?` for ${n.durationMins} min`:''}`)},undoWalkIn:a=>{const n=t().bookings.find(e=>e.id===a);n&&n.walkIn&&(e(e=>({bookings:e.bookings.filter(e=>e.id!==a)})),r(n.restaurantId,'walkin',`Walk-in ${n.ref} undone`))},ackBookingAllergy:(n,s)=>{const i=t().bookings.find(e=>e.id===n);i&&!i.allergyAck&&(e(e=>({bookings:e.bookings.map(e=>e.id===n?{...e,allergyAck:{by:s,at:a().toISOString()}}:e)})),r(i.restaurantId,'allergy',`Allergen sign-off 1/5 Booked on ${i.ref} (${i.name}): ${s} (allergy recorded)`))},joinWaitlist:(n,s,i,o)=>{const l=t().waitlist.filter(e=>e.restaurantId===n).reduce((e,t)=>Math.max(e,t.number),0)+1,c={id:I('wl'),restaurantId:n,number:l,name:s,partySize:i,joinedAt:a().toISOString(),status:'waiting',customerId:o};return e(e=>({waitlist:[...e.waitlist,c]})),r(n,'waitlist',`${s} (${i}) joined the waitlist as #${l}`),c},setWaitlistStatus:(a,n)=>{const s=t().waitlist.find(e=>e.id===a);e(e=>({waitlist:e.waitlist.map(e=>e.id===a?{...e,status:n}:e)})),s&&(r(s.restaurantId,'waitlist',`Waitlist #${s.number} ${s.name} \u2192 ${n}`),'seated'===n&&t().addWalkIn(s.restaurantId,s.partySize))},addWalkIn:(t,a)=>{e(e=>({walkIns:{...e.walkIns,[t]:(e.walkIns[t]??0)+a}})),r(t,'walkin',`Walk-in seated: ${a} cover(s)`)},addStamp:(n,s,i)=>{const o=t().restaurants.find(e=>e.id===n);o&&(e(e=>{const t=e.stampCards.find(e=>e.restaurantId===n&&e.customerId===s),r=t??{restaurantId:n,customerId:s,stamps:0,rewardsAvailable:0,history:[]};let l=r.stamps+1,c=r.rewardsAvailable;l>=o.settings.stampTarget&&(l=0,c+=1);const u={...r,stamps:l,rewardsAvailable:c,history:[{at:a().toISOString(),source:i},...r.history]};return{stampCards:t?e.stampCards.map(e=>e===t?u:e):[...e.stampCards,u]}}),r(n,'stamp',`Stamp added (${i})`))},redeemReward:(t,a)=>{e(e=>({stampCards:e.stampCards.map(e=>e.restaurantId===t&&e.customerId===a&&e.rewardsAvailable>0?{...e,rewardsAvailable:e.rewardsAvailable-1}:e)})),r(t,'stamp','Loyalty reward redeemed')},buyGiftCard:(n,s,i,o)=>{const l=n.slice(0,3).toUpperCase(),c={id:I('gc'),code:O(l),restaurantId:n,initial:s,balance:s,ownerId:t().customer.id,recipientName:i,message:o,createdAt:a().toISOString()};return e(e=>({giftCards:[c,...e.giftCards]})),r(n,'giftcard',`Gift card sold \xa3${(s/100).toFixed(2)} (demo payment)`),c},redeemGiftCard:(a,n,s)=>{const i=t().giftCards.find(e=>e.code.toUpperCase()===a.trim().toUpperCase());return!(!i||n<=0||n>i.balance)&&(e(e=>({giftCards:e.giftCards.map(e=>e.id===i.id?{...e,balance:e.balance-n}:e)})),r(i.restaurantId,'giftcard',`Gift card ${i.code} redeemed \xa3${(n/100).toFixed(2)} by ${s}`),!0)},honourLegacyCard:(t,n,s,i)=>{const o={id:I('gc'),code:n.trim().toUpperCase(),restaurantId:t,initial:s,balance:s,ownerId:'legacy',recipientName:'Legacy website bookings gift card',message:`Honoured by ${i}`,createdAt:a().toISOString().slice(0,10),legacy:!0};return e(e=>({giftCards:[o,...e.giftCards]})),r(t,'giftcard',`Legacy website bookings gift card ${o.code} honoured (\xa3${(s/100).toFixed(2)}) by ${i}`),o},addEvent:t=>e(e=>({events:[...e.events,{...t,id:I('ev')}]})),addRating:t=>{e(e=>({ratings:[{...t,id:I('rt'),createdAt:a().toISOString()},...e.ratings],orders:t.orderId?e.orders.map(e=>e.id===t.orderId?{...e,rated:!0}:e):e.orders})),r(t.restaurantId,'rating',`Private rating ${t.stars}/5 from ${t.customerName}`)},updateMenuItem:(a,n)=>{const{name:s,section:i,price:o,allergens:l,allergenNotes:c,...u}=n,g={};void 0!==s&&(g.dish=s),void 0!==i&&(g.section=i),'price'in n&&(g.price=o??null),void 0!==l&&(g.allergens=l),'allergenNotes'in n&&(g.allergenNotes=c);const m='optionGroups'in n,p=(0,b.menuCardBridge)();p&&(Object.keys(g).length||m)&&p.menuEdited(a,g,'CoverCharge for Managers',m);const f=p?u:n;Object.keys(f).length&&e(e=>({menu:e.menu.map(e=>e.id===a?{...e,...f}:e)}));const k=t().menu.find(e=>e.id===a);k&&Object.keys(f).length&&r(k.restaurantId,'menu',`Menu: ${(0,b.resolveItem)(k).name} updated`)},setSignOff:(t,r)=>{const n=(0,b.menuCardBridge)();n?r?n.signOff(t,r):n.menuEdited(t,{},'CoverCharge for Managers',!0):e(e=>({menu:e.menu.map(e=>e.id===t?{...e,signOff:r?{by:r,at:a().toISOString().slice(0,10)}:null}:e)}))},addAudit:(e,t,a)=>r(e,t,a),updateSettings:(t,a)=>{e(e=>({restaurants:e.restaurants.map(e=>e.id===t?{...e,settings:{...e.settings,...a}}:e)})),'takeawayPaused'in a&&r(t,'order',"Takeaway slots "+(a.takeawayPaused?'PAUSED':'resumed'))},addMenuItem:t=>{const a=I('m');return e(e=>({menu:[...e.menu,{...t,id:a}]})),(0,b.menuCardBridge)()?.menuItemAdded({...t,id:a}),r(t.restaurantId,'menu',`Menu: ${t.name} added (recipe card awaiting head chef sign-off)`),a},updateRestaurant:(t,a)=>{e(e=>({restaurants:e.restaurants.map(e=>e.id===t?{...e,...a}:e)})),r(t,'menu',`Restaurant info updated (${Object.keys(a).join(', ')})`)},placeManualOrder:({restaurantId:n,type:s,channel:i,customerName:o,phone:l,email:u,tableNo:g,slotTime:m,lines:f,allergies:k,notes:I,by:S})=>{const h=t(),w=f.flatMap(({itemId:e,qty:t})=>{const a=h.menu.find(t=>t.id===e);if(!a||t<=0)return[];const r=(0,b.resolveItem)(a),n=(0,p.conflictsFor)((0,p.effectiveAllergens)(r),k);return[{itemId:e,name:r.name,qty:t,unitPrice:r.price??0,choices:[],notes:'',contains:n.contains,may:n.may,overridden:!1,prepMins:r.prepMins}]}),O=w.reduce((e,t)=>e+t.unitPrice*t.qty,0),C='table'===s,v=$(h.orders.filter(e=>e.restaurantId===n).map(e=>e.ref),C?'Q-':'T-',C?h.counters.table:h.counters.order),A={id:(0,y.uuid)(),ref:`${C?'Q':'T'}-${v}`,restaurantId:n,customerId:`manual-${i}`,customerName:o||(C?`Table ${g}`:'Walk-in'),type:s,tableNo:g,slotTime:m,lines:w,subtotal:O,tip:0,giftCardApplied:0,total:O,paid:0,status:'new',createdAt:a().toISOString(),allergies:k,readiness:{},notes:I,channel:i,...l?{phone:l}:{},...u?{email:u}:{},...k.length?{allergyChain:{booked:{by:S,at:a().toISOString()}}}:{}};return e(e=>({orders:[A,...e.orders],counters:C?{...e.counters,table:v}:{...e.counters,order:v}})),r(n,'order',`Order ${A.ref} taken by ${S} (${'phone'===i?'phone':'walk-in'===i?'walk-in takeaway':`Table ${g}`})`),k.length&&r(n,'allergy',`Allergen sign-off 1/5 Booked on ${A.ref}: ${S} recorded ${k.map(e=>`${e.allergen} (${e.severity})`).join(', ')}`),(l||u)&&c(A),A},ackAlert:(t,r)=>e(e=>({alertAcks:{...e.alertAcks,[t]:{by:r,at:a().toISOString()}}}))}},{name:'covercharge-demo-v1',version:9,migrate:async(e,t)=>{if(!e)return e;if(n.LIVE_VENUE_BUILD)return await(0,s.archiveChefCache)('core',e),Object.assign(e,(0,r.stripCoreLiveSamples)(e)),e.clock={mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()},e;if(e.clock={mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()},t<6){try{e.restaurants=(e.restaurants??[]).map(e=>'saltmarsh'===e?.id?{...e,name:'The Venue'}:e)}catch{}try{e.restaurants=(e.restaurants??[]).map(e=>'anchorage'===e?.id&&JSON.stringify(e.kitchenHours)===JSON.stringify(g.ANCHORAGE_KITCHEN_OLD)?{...e,kitchenHours:g.ANCHORAGE_KITCHEN,hoursNote:'Kitchen (food) hours from Gordon, 30 Oct 2026: closed Mon\u2013Tue. The closing time is last food orders. Bar hours not set.'}:e)}catch{}}if(t<5)try{e.events=(e.events??[]).map(e=>'string'==typeof e?.title&&/\(substitute day\)/i.test(e.title)?{...e,title:e.title.replace(/\s*\(substitute day\)/gi,'').trim()}:e)}catch{}if(t<4)try{e.restaurants=(e.restaurants??[]).map(e=>'anchorage'===e.id&&e.settings&&!e.settings.pay?{...e,settings:{...e.settings,pay:g.ANCHORAGE_PAY}}:e)}catch{}if(t<3)try{e.restaurants=(e.restaurants??[]).map(e=>'anchorage'===e.id?{...e,settings:{...e.settings,orderAtTable:!1}}:e),e.orders=(e.orders??[]).filter(e=>'ord-seed-3'!==e.id&&'Q-2018'!==e.ref),e.audit=(e.audit??[]).filter(e=>!String(e.text??'').includes('Q-2018'))}catch{}if(t>=2)return e;try{const t=(0,u.buildSeed)((0,u.defaultSimStart)()),a=new Map(t.bookings.map(e=>[e.id,e])),r=new Set((0,m.anchoragePlan)().tables.map(e=>e.name)),n=e=>!e||e.split('+').every(e=>r.has(e));e.bookings=(e.bookings??[]).map(e=>{const t=a.get(e.id);return t?{...e,table:t.table,dog:t.dog,notes:t.notes}:'anchorage'!==e.restaurantId||n(e.table)?e:{...e,table:void 0}})}catch{}return e},merge:(e,r)=>{const n={...r,...e};return a.IS_WILDINGS&&(n.restaurants=n.restaurants.map(t.withWildingsAddress)),n},storage:(0,c.createJSONStorage)(()=>o.default)}))},870,[1018,5,1134,833,1137,1024,1008,1025,1045,3,1022,814,1142,823,987,1147]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useShallow",{enumerable:!0,get:function(){return o}});var e,t=r(d[0]),u=(e=t)&&e.__esModule?e:{default:e},n=r(d[1]);function o(e){const t=u.default.useRef(void 0);return u=>{const o=e(u);return(0,n.shallow)(t.current,o)?t.current:t.current=o}}},871,[30,1150]); +__d(function(g,_r,i,_a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TABLE_ORDER_DEFAULT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"cleanToken",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"isTableNo",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"fromRow",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"toRow",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"hm",{enumerable:!0,get:function(){return s}}),e.openAt=function(t,r){const n=a(r),o=t.openFrom?a(t.openFrom):null,l=t.lastOrders?a(t.lastOrders):null;return null!==o&&null!==l?o<=l?n>=o&&n=o||n=o:null===l||n{const r=(t??'').trim().toUpperCase();return/^[A-Z2-9]{16}$/.test(r)?r:null},n=t=>/^[0-9]{1,4}$/.test(t),o=r=>r?{on:!!r.is_on,tables:Array.isArray(r.tables)?r.tables.map(String):null,staffAccept:!1!==r.staff_accept,openFrom:r.open_from?String(r.open_from).slice(0,5):null,lastOrders:r.last_orders?String(r.last_orders).slice(0,5):null,guestTip:r.guest_tip??''}:{...t},l=t=>({is_on:t.on,tables:t.tables&&t.tables.length?t.tables.filter(n):null,staff_accept:t.staffAccept,open_from:t.openFrom,last_orders:t.lastOrders,guest_tip:t.guestTip.slice(0,300)}),a=t=>{const[r,n]=t.split(':').map(Number);return 60*r+n},s=t=>`${String(Math.floor(t/60)%24).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`;const c=(t,r)=>t.reduce((t,n)=>t+n.qty*(r.find(t=>t.id===n.id)?.pricePence??0),0),u=(t,r,n)=>t.map(t=>r.find(r=>r.id===t.id)).filter(t=>!!t&&(t.allergens.some(t=>n.includes(t))||t.mayContain.some(t=>n.includes(t)))),f=(t,r)=>`${t.replace(/\/$/,'')}/customer-app/index.html?table=${r}`,p=t=>'table'===t.type&&'table-qr'===t.channel,b=t=>p(t)&&!!t.held&&!t.accepted&&'cancelled'!==t.status,m=t=>!b(t),y=t=>'cancelled'===t.status?t.cancelReason?`Cancelled: ${t.cancelReason}`:'Cancelled by the staff.':t.held&&!t.accepted?'Sent. Waiting for a member of staff to accept it.':'served'===t.status||'collected'===t.status||'closed'===t.status?'Served. Enjoy!':'ready'===t.status?'Ready: on its way to your table.':'Accepted: the kitchen has your order.',O=['Sold out','Wrong table','Sent twice','Kitchen closed','Guest asked to cancel'],h='Please pay at the bar or till. Paying by card from your phone is coming later.'},873,[]); +__d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.venueTextStyle=d,Object.defineProperty(_e,"Text",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"TextInput",{enumerable:!0,get:function(){return h}});var t=r(_d[0]),n=r(_d[1]),o=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(n){if('default'!==n){var o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,t})(r(_d[2])),f=e(r(_d[3])),u=e(r(_d[4])),l=e(r(_d[5])),c=r(_d[6]),s=r(_d[7]);function d(e){if(!t.IS_SOUTERS)return e;const n=l.default.flatten(e)||{};return{...n,...'number'==typeof n.fontSize?{fontSize:(0,c.soutersFont)(n.fontSize)}:{},...'number'==typeof n.lineHeight?{lineHeight:(0,c.soutersFont)(n.lineHeight)}:{},...'string'==typeof n.color?{color:(0,c.soutersInk)(n.color)}:{}}}const y=o.forwardRef(function({style:e,...t},n){return(0,s.jsx)(f.default,{...t,ref:n,style:d(e)})}),p=o.forwardRef(function({style:e,placeholderTextColor:t,...n},o){const f=d([{fontSize:14,color:'#F5F1E8'},e]),y=l.default.flatten(f)||{};return(0,s.jsx)(u.default,{...n,ref:o,placeholderTextColor:'string'==typeof t?(0,c.soutersInk)(t):'#B8B0A0',style:[f,{minHeight:Math.max(44,'number'==typeof y.minHeight?y.minHeight:44),minWidth:Math.max(44,'number'==typeof y.minWidth?y.minWidth:44)}]})}),S=o.forwardRef(function({style:e,...t},o){const u=l.default.flatten(e)||{};return(0,s.jsx)(f.default,{...t,ref:o,style:[u,{color:u.color===n.QUEUED_BRAND?.accent?n.QUEUED_BRAND.smallTextAccent:u.color}]})}),_=t.IS_QUEUED_VENUE?S:t.IS_SOUTERS?y:f.default,h=t.IS_SOUTERS?p:u.default},874,[5,1247,30,206,273,46,878,24]); +__d(function(g,_r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"tablePublic",{enumerable:!0,get:function(){return s}}),e.sendTableOrder=async function(t,r,a){if(!await(0,n.guestSession)())throw new Error('No connection. Try again when you are back online.');return(0,n.rpc)('guest_table_order',{p_token:t,p_lines:r.map(t=>({id:t.id,qty:t.qty,note:t.note.trim().slice(0,140)})),p_note:a.note.trim().slice(0,300)||null,p_allergies:a.allergies.map(t=>({allergen:t.allergen,severity:t.severity})),p_name:a.name.trim().slice(0,40)||null})},e.myTableOrders=async function(t){return await(0,n.guestSession)()?await(0,n.rpc)('guest_table_my_orders',{p_token:t})??[]:[]},e.loadTableSettings=async function(){const{data:t,error:n}=await a().from('table_order_settings').select('*').eq('venue_id',o()).maybeSingle();if(n)throw n;return(0,r.fromRow)(t)},e.saveTableSettings=async function(t,n){const{error:s}=await a().from('table_order_settings').upsert({venue_id:o(),...(0,r.toRow)(t),updated_at:(new Date).toISOString(),updated_by:n.slice(0,80)});if(s)throw s},e.listTableCodes=async function(){const{data:t,error:n}=await a().from('table_qr_codes').select('table_no, token, created_at').eq('venue_id',o()).eq('is_on',!0);if(n)throw n;return(t??[]).map(t=>({table:String(t.table_no),token:String(t.token),createdAt:String(t.created_at)})).sort((t,n)=>Number(t.table)-Number(n.table))},Object.defineProperty(e,"makeTableCodes",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"renewTableCode",{enumerable:!0,get:function(){return c}}),e.watchTableSettings=function(t){const r=n.useSync.getState().venueId;if(!r)return()=>{};const o=a().channel(`tos-${r}-${Math.random().toString(36).slice(2,8)}`).on('postgres_changes',{event:'*',schema:'public',table:'table_order_settings',filter:`venue_id=eq.${r}`},()=>t()).subscribe();return()=>{a().removeChannel(o)}};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]);const a=()=>(0,t.getSupabase)(),o=()=>{const t=n.useSync.getState().venueId;if(!t)throw new Error('Not connected to the venue yet.');return t},s=t=>(0,n.rpc)('table_public',{p_token:t});const l=t=>(0,n.rpc)('table_qr_make',{p_venue:o(),p_tables:t}),c=t=>(0,n.rpc)('table_qr_renew',{p_venue:o(),p_table:t})},875,[862,820,873]); +__d(function(_g,_r,_i,_a,m,_e2,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"EDIT_IDLE_MS",{enumerable:!0,get:function(){return ke}}),_e2.DisplayBoard=function({embedded:e=!1}={}){const{width:d,height:R}=(0,M.default)(),me=d<700,xe=d>=R,ve=!me&&xe&&d>=600,Be=ve,Me=Math.round(Math.min(520,Math.max(240,.3*d))),ze=w.default.useRef(null),Le=w.default.useRef(0),[Pe,Re]=(0,j.useState)({w:0,h:0}),We=(0,A.useOwner)(e=>e.site),He=(0,H.useRestaurant)(We);(0,re.useAlertWatcher)(We,{enabled:!e}),(0,p.useSoldOutLink)(!1,void 0,!e);const Oe=(0,H.useOrders)(We),Ae=(0,H.useBookings)(We),Ee=(0,H.useEvents)(We),Ne=(0,H.useStore)(e=>e.skipMinutes),_e=(0,H.useStore)(e=>e.clock.mode),Fe=(0,H.useNow)(5e3),Ve=(0,A.useOwner)(e=>e.staff),Ge=(0,A.useOwner)(e=>e.attendance),Ue=(0,A.useOwner)(e=>e.shifts);w.default.useEffect(()=>{(0,N.ensureAttendance)((0,W.ymd)(Fe),Fe)},[(0,W.ymd)(Fe)]);const qe=Ge.filter(e=>e.in&&!e.out&&Fe.getTime()-new Date(e.in).getTime()<72e6&&Fe.getTime()>=new Date(e.in).getTime()),Ke=De(Ve.find(e=>e.id===qe[0]?.staffId)?.name)||'Duty Manager',Ye=(0,W.ymd)(Fe),Qe=(0,D.useTravelDay)('display',Ye),Je=(0,E.useFrontDoor)(Ye,xe),Xe=(0,_.useDisplaySettings)(We),Ze=Xe.privacy,et=(0,_.usePlan)(We),tt=(0,_.useFloor)(e=>e.live[We]),st=(0,de.useBlocks)(e=>e.blocks),[lt,ot]=(0,j.useState)('plan'),[it,at]=(0,j.useState)('all'),[nt,rt]=(0,j.useState)(null),[dt,ct]=(0,j.useState)(null),[ut,ht]=(0,j.useState)(null),[gt,bt]=(0,j.useState)(!1),[yt,pt]=(0,j.useState)(!1),[mt,xt]=(0,j.useState)(null),[ft,jt]=(0,j.useState)(!1),[wt,kt]=(0,j.useState)(!1),[Dt,It]=(0,j.useState)(null),[vt,St]=(0,j.useState)(null),[Tt,Ct]=(0,j.useState)(null),$t=w.default.useRef(0),Bt=e=>{$t.current=Date.now(),Ct(e)};w.default.useEffect(()=>{if(!Tt)return;const e=setInterval(()=>{Date.now()-$t.current>=he.DAY_IDLE_MS&&Ct(null)},5e3);return()=>clearInterval(e)},[Tt]);const Mt=(0,H.useWaitlist)(We),zt=(0,H.useStore)(e=>e.walkIns[We]??0),[Lt,Pt]=(0,j.useState)(!1),[Rt,Wt]=(0,j.useState)(null);w.default.useEffect(()=>{Rt&&((0,x.notify)({id:`floor-note:${Date.now()}`,title:Rt,timeoutMs:4500,big:!0,testID:'floor-toast'}),Wt(null))},[Rt]),w.default.useEffect(()=>{if(!e)return(0,I.setDisplaySilent)(!0),()=>(0,I.setDisplaySilent)(!1)},[e]);const[Ht,Ot]=(0,j.useState)(null),At=w.default.useRef(0),[Et,Nt]=(0,j.useState)(null);w.default.useEffect(()=>{if(!Ht)return;At.current=Date.now();const e=setInterval(()=>{const e=Date.now()-At.current;if(e>=ke)return Ot(null),void Wt('Table plan locked again after 2 minutes with no touches. Unsaved changes were not kept.');Nt(e>=105e3?Math.ceil((ke-e)/1e3):null)},1e3);return()=>clearInterval(e)},[Ht]);const _t=e=>e.date!==Ye?ht({title:`Guest details \xb7 ${(0,he.dayWord)(e.date,Ye)} ${e.time}`,body:(0,we.jsx)(we.Fragment,{children:(0,oe.bookingDetails)(e)})}):ht({title:`Guest details \xb7 ${e.time}`,body:(0,we.jsxs)(we.Fragment,{children:[(0,we.jsx)($e,{rid:We,id:e.id,turnBase:He.settings.turnMins}),e.walkIn?null:(0,we.jsx)(L.Button,{kind:"secondary",label:"Edit booking",testID:"details-edit-booking",accessibilityLabel:`Edit booking, ${e.name}, ${e.time}`,onPress:()=>{ht(null),xt(e.id)},style:{minHeight:56}}),(0,oe.bookingDetails)(e)]})}),Ft=Ae.filter(e=>e.date===Ye).sort((e,t)=>e.time.localeCompare(t.time)),Vt=Ft.filter(e=>!['cancelled','noshow'].includes(e.status)),Gt=Vt.reduce((e,t)=>e+t.partySize,0),Ut=Oe.filter(Ie).sort((e,t)=>Number('new'===t.status)-Number('new'===e.status)||(e.slotTime??e.createdAt).localeCompare(t.slotTime??t.createdAt)),qt=(0,j.useMemo)(()=>(0,n.forecastToday)(He,Ae,Oe,Ee,Fe),[He,Ae,Oe,Ee,Fe.getTime()/6e4|0]),Kt=(0,de.closedAreasAt)(st,We,Ye,(0,W.hm)(Fe)),Yt=[...Kt].join(','),Qt=(0,j.useMemo)(()=>(0,F.floorView)(et,Ae,Oe,tt??{},Fe,He.settings.turnMins,Kt),[et,Ae,Oe,tt,Fe.getTime(),Yt]),Jt=(0,le.hoursFor)(He,Fe),Xt=Jt?.open??new Date(`${Ye}T12:00:00`),Zt=Jt?.close??new Date(`${Ye}T21:00:00`),es=(0,W.addMins)(Xt,-Xt.getMinutes()),ts=(0,W.addMins)(Zt,90),ss=e=>new Date(`${Ye}T${e}:00`),ls=(0,de.blocksOn)(st,We,Ye).map(e=>({from:ss(e.from),to:ss(e.to),label:e.reason??'Paused'})).concat((0,l.queuedServicePauses)(He,Fe,Ye)),os=Object.keys(Qt).filter(e=>'blocked'===Qt[e]?.status),is=Tt&&Tt!==Ye?Tt:Ye,as=is!==Ye,ns=(0,he.dayWord)(is,Ye),rs=/^(Today|Yesterday|Tomorrow)$/.test(ns),ds=as?(0,he.bookingsForDay)(Ae,is,Ye).sort((e,t)=>e.time.localeCompare(t.time)):Ft,cs=(0,W.parseYmd)(is);cs.setHours(12);const us=as?(0,le.hoursFor)(He,cs):Jt,hs=us?.open??new Date(`${is}T12:00:00`),gs=us?.close??new Date(`${is}T21:00:00`),bs=e=>new Date(`${is}T${e}:00`),ys=[...as?(0,de.blocksOn)(st,We,is).map(e=>({from:bs(e.from),to:bs(e.to),label:e.reason??'Paused'})):ls,...as?(0,l.queuedServicePauses)(He,cs,is):[]],ps=(0,l.queuedServiceSessions)(He,cs),ms=t.IS_QUEUED_VENUE&&(void 0===ps||!ps.length),xs=(0,we.jsxs)(B.default,{testID:"queued-hours-gate",style:[be.look.panel,{padding:14,gap:8}],children:[(0,we.jsx)(L.T,{weight:"semibold",children:void 0===ps?'Opening and kitchen hours: to confirm':'Kitchen closed this day'}),(0,we.jsx)(L.Muted,{children:s.queuedVenues[We]?.hours.note})]}),fs=as?us||ds.length?isas?(0,F.dayFloorView)(et,ds,is):Qt,[as,et,ds,is,Qt]),[ws,ks]=(0,j.useState)(null),Ds=as?ds.filter(e=>!['cancelled','noshow'].includes(e.status)):Vt,Is=Ds.reduce((e,t)=>e+t.partySize,0),vs=!qt.example&&qt.open&&qt.enough&&qt.restOfDay.high>0?`Usual for a ${Fe.toLocaleDateString('en-GB',{weekday:'long'})}: about ${(0,n.coversRange)(Math.round((qt.restOfDay.low+qt.restOfDay.high)/2),Math.round((qt.restOfDay.low+qt.restOfDay.high)/2))} more`:void 0,Ss=async(e,t)=>{const s=Qt[e]?.booking;if(!s||e===t)return;const l=Qt[t]?.status;if(l&&!['free','soon'].includes(l))return void Wt('dirty'===l?`${(0,a.tableNumbers)(t)} needs clearing first.`:`${(0,a.tableNumbers)(t)} is ${F.STATUS[l].label.toLowerCase()}. Pick a free table.`);await H.repo.bookings.update(s.id,{table:t});const o=tt?.[e]?.stage;_.useFloor.getState().setLive(We,t,{stage:o??'seated',dirty:!1}),_.useFloor.getState().setLive(We,e,{stage:void 0,dirty:!0}),Wt(`${(0,J.privName)(s,Ze)} moved ${(0,a.tableNumbers)(e)} \u2192 ${t}. ${(0,a.tableNumbers)(e)} needs clearing.`)},Ts=vt?Ae.find(e=>e.id===vt.id):void 0,Cs=vt&&Ts?(()=>{const e=Ts.walkIn?(0,J.privName)(Ts,Ze):De(Ts.name),t=(0,se.seatsOf)(et,vt.tables).total,s=(0,se.seatLine)(t,Ts.partySize),l=(0,se.pickClashes)(Ts,vt.tables,Ae.filter(e=>e.date===Ts.date),He.settings.turnMins),o=(0,se.tableKey)(vt.tables)!==(0,se.tableKey)((0,_.tablesOf)(Ts.table));return(0,we.jsxs)(B.default,{testID:"plan-pick-bar",style:{gap:6,backgroundColor:O.colours.goldTint,borderRadius:12,borderWidth:1,borderColor:O.colours.gold,padding:10},children:[(0,we.jsxs)(B.default,{accessible:!0,accessibilityLabel:`Picking tables for ${e}, ${(0,he.dayWord)(Ts.date,Ye)} ${Ts.time}. Tap tables on the plan to add or take them off. ${(0,se.tablesWords)(vt.tables)}. ${s.text}.${l.length?` ${l.length} clash${1===l.length?'':'es'} with other bookings.`:''}`,children:[(0,we.jsxs)(L.T,{size:17,weight:"semibold",colour:O.colours.goldLight,children:["Tap tables for ",e," \xb7 ",(0,he.dayWord)(Ts.date,Ye)," ",Ts.time]}),(0,we.jsxs)(L.T,{size:16,colour:O.colours.text,children:[(0,se.tablesWords)(vt.tables)," \xb7 ",s.text,l.length?` \xb7 ${[...new Set(l.map(e=>(0,a.tableNumbers)(e.table)))].join(', ')} booked then`:'']})]}),(0,we.jsxs)(L.Row,{gap:8,wrap:!0,children:[(0,we.jsx)(L.Button,{testID:"plan-pick-save",label:l.length?'Save anyway':'Save tables',disabled:!o,style:{minHeight:56},accessibilityLabel:`${l.length?'Save anyway':'Save'}, ${(0,se.tablesWords)(vt.tables)} for ${e}. ${s.text}.`,onPress:async()=>{await(0,te.saveBookingTables)(We,Ts,vt.tables),Wt((0,se.savedWords)(e,Ts.partySize,vt.tables,t)),St(null)}}),(0,we.jsx)(L.Button,{testID:"plan-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",style:{minHeight:56},onPress:()=>St(null)})]})]})})():null,$s=et.areas.filter(e=>et.tables.some(t=>t.areaId===e.id)),Bs=e=>{const t=et.tables.filter(t=>t.areaId===e);return as?`${t.filter(e=>!js[e.name]?.dayBookings).length}/${t.length} unbooked`:`${t.filter(e=>['free','soon'].includes(Qt[e.name]?.status??'free')).length}/${t.length} free`},Ms='all'===it||$s.some(e=>e.id===it)?it:'all',zs=e=>(0,we.jsx)(V.FloorCanvas,{plan:et,areaId:e,mode:"live",fit:"contain",crop:!0,fill:ve,big:!0,view:js,privacy:Ze,turnBase:He.settings.turnMins,highlight:vt?vt.tables:dt?[dt]:void 0,onTap:e=>{return t=e.name,void(vt?St(e=>e?{...e,tables:(0,se.toggleTable)(e.tables,t)}:e):as?ks(t):dt?(t!==dt&&Ss(dt,t),ct(null)):rt(t));var t},onDrop:(e,t)=>vt||as?void 0:Ss(e.name,t.name)}),Ls=me?1:xe||$s.length>2?2:1,Ps=e=>{const t=et.tables.filter(t=>t.areaId===e);if(!t.length)return.5;const s=Math.max(...t.map(e=>e.x+e.w))-Math.min(...t.map(e=>e.x))+92;return(Math.max(...t.map(e=>e.y+e.h))-Math.min(...t.map(e=>e.y))+92)/s},Rs=[];for(let e=0;e<$s.length;e+=Ls)Rs.push($s.slice(e,e+Ls));const Ws=ve?(0,G.venueGrid)($s.map(e=>{const t=(0,V.areaBounds)(et,e.id);return{id:e.id,w:t.w,h:t.h,minScale:(0,V.minReadableScale)(et,e.id)}}),Pe.w,Pe.h):null,Hs=e=>(0,we.jsxs)(L.Row,{style:{justifyContent:'space-between',height:G.AREA_LABEL_H-2,paddingHorizontal:4},children:[(0,we.jsxs)(L.T,{size:14,weight:"semibold",colour:(0,O.brandColour)(e.colour),numberOfLines:1,style:{flexShrink:1},children:[e.name,(0,U.areaMarks)(e)]}),Kt.has(e.id)?(0,we.jsx)(L.T,{size:13,weight:"semibold",colour:O.colours.blue,children:"Closed for weather"}):(0,we.jsx)(L.T,{size:13,colour:O.colours.muted,children:Bs(e.id)})]}),Os=(0,we.jsx)(B.default,{testID:"venue-grid",style:{flex:1,minHeight:0},onLayout:e=>{const{width:t,height:s}=e.nativeEvent.layout;(Math.abs(t-Pe.w)>1||Math.abs(s-Pe.h)>1)&&Re({w:t,h:s})},children:Ws?(0,we.jsx)($.default,{style:{flex:1},scrollEnabled:Ws.scroll,showsVerticalScrollIndicator:Ws.scroll,contentContainerStyle:{gap:G.GRID_GAP},children:Ws.rows.map((e,t)=>(0,we.jsx)(B.default,{style:{height:Ws.rowHeights[t],flexDirection:'row',gap:G.GRID_GAP},children:e.map(e=>{const t=$s.find(t=>t.id===e);return(0,we.jsxs)(B.default,{testID:`area-cell-${e}`,style:{width:Ws.cellW,gap:2},children:[Hs(t),(0,we.jsx)(B.default,{style:{flex:1},children:zs(e)})]},e)})},t))}):null}),As=(0,we.jsxs)(B.default,{testID:"venue-plan",style:{flex:me?void 0:1,gap:10,minWidth:0},children:[(0,we.jsx)(i.TableNumberWarning,{plan:et}),et.tables.length?null:(0,we.jsxs)(B.default,{testID:"venue-plan-pending",style:{flex:1,justifyContent:'center',alignItems:'center',gap:8,padding:24},children:[(0,we.jsx)(L.T,{size:24,weight:"semibold",children:"No table plan yet"}),(0,we.jsx)(L.Muted,{center:!0,children:"Waiting for the venue\u2019s real table plan. No sample tables have been added."})]}),(()=>{const e=[(0,we.jsx)(Te,{label:"Whole venue",selected:'all'===Ms,onPress:()=>at('all')},"__all"),...$s.map(e=>(0,we.jsx)(Te,{label:`${e.name}${(0,U.areaMarks)(e)}`,colour:(0,O.brandColour)(e.colour),sub:Kt.has(e.id)?'closed':Ms===e.id?Bs(e.id):void 0,selected:Ms===e.id,onPress:()=>at(e.id)},e.id))];return me?(0,we.jsx)(B.default,{style:{flexDirection:'row',flexWrap:'wrap',justifyContent:'center',gap:8},children:e}):ve&&R<500||!ve&&d<900?(0,we.jsx)($.default,{horizontal:!0,showsHorizontalScrollIndicator:!1,style:{flexGrow:0},contentContainerStyle:{gap:6},children:e}):(0,we.jsx)(L.Row,{wrap:!0,gap:8,children:e})})(),(0,we.jsx)(r.FloorLegend,{}),Cs,dt?(0,we.jsxs)(L.Row,{gap:8,style:{backgroundColor:O.colours.goldTint,borderRadius:10,padding:8},children:[(0,we.jsxs)(L.T,{weight:"semibold",colour:O.colours.goldLight,style:{flex:1},children:["Moving the party from ",(0,a.tableNumbers)(dt),": tap the new table."]}),(0,we.jsx)(L.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>ct(null)})]}):null,'all'===Ms&&ve?Os:'all'===Ms?(0,we.jsx)(B.default,{style:{flex:me?void 0:1,gap:12,minHeight:Be?void 0:360},children:Rs.map((e,t)=>(0,we.jsxs)(B.default,{style:{flex:me?void 0:Math.max(.3,...e.map(e=>Ps(e.id))),flexDirection:'row',gap:8},children:[e.map(e=>(0,we.jsxs)(B.default,{style:{flex:1,gap:2},children:[me?(0,we.jsxs)(B.default,{style:{alignItems:'center',gap:4},children:[(0,we.jsxs)(L.T,{center:!0,size:18,weight:"semibold",colour:(0,O.brandColour)(e.colour),children:[e.name,(0,U.areaMarks)(e)]}),Kt.has(e.id)?(0,we.jsx)(L.T,{center:!0,size:14,weight:"semibold",colour:O.colours.blue,children:"Closed for weather"}):(0,we.jsx)(L.Muted,{center:!0,children:Bs(e.id)})]}):(0,we.jsxs)(L.Row,{style:{justifyContent:'space-between'},children:[(0,we.jsxs)(L.T,{size:14,weight:"semibold",colour:(0,O.brandColour)(e.colour),children:[e.name,(0,U.areaMarks)(e)]}),Kt.has(e.id)?(0,we.jsx)(L.T,{size:13,weight:"semibold",colour:O.colours.blue,children:"Closed for weather"}):(0,we.jsx)(L.Muted,{children:Bs(e.id)})]}),(0,we.jsx)(B.default,{style:me?{height:Math.max(280,Math.round((d-40)*Ps(e.id)))}:{flex:1},children:zs(e.id)})]},e.id)),e.length{if(as)return void It(e.id);const t=(0,_.tablesOf)(e.table)[0];t&&Qt[t]?rt(t):_t(e)}},is)}),Ns='timeline'===lt,_s=as?(0,we.jsxs)(B.default,{testID:"display-day-bar",style:{flexDirection:'row',alignItems:'center',gap:10,marginBottom:8,padding:8,paddingLeft:12,borderRadius:12,borderWidth:1,borderColor:O.colours.gold,backgroundColor:O.colours.goldTint},children:[(0,we.jsxs)(B.default,{style:{flex:1,minWidth:0},accessible:!0,accessibilityRole:"header",accessibilityLabel:`Showing ${rs?`${ns}, `:''}${(0,he.dayLong)(is)}. Guests, table plan, Timeline and Covers are for that day.`,children:[(0,we.jsxs)(L.T,{size:18,weight:"semibold",colour:O.colours.goldLight,children:["Showing ",rs?`${ns} \xb7 `:'',(0,he.dayLong)(is)]}),(0,we.jsx)(L.T,{size:14,colour:O.colours.text,children:"Guests, table plan, Timeline and Covers are for this day."})]}),(0,we.jsx)(L.Button,{testID:"back-to-today",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>{St(null),Bt(null)},style:{minHeight:56}})]}):null,Fs=(0,we.jsx)(B.default,{accessibilityRole:"tablist",style:{flexDirection:'row',borderRadius:15,padding:4,gap:4,borderWidth:1,borderColor:'rgba(255,255,255,0.08)',backgroundColor:'rgba(255,255,255,0.035)',alignSelf:me?'stretch':'flex-start'},children:[['plan','Table plan','view-floor'],['timeline','Timeline','view-timeline']].map(([e,s,l])=>{const o='timeline'===e===Ns;return(0,we.jsx)(C.default,{testID:l,accessibilityRole:"tab",accessibilityLabel:s,accessibilityState:{selected:o},onPress:()=>ot(e),style:{flex:me?1:void 0,minHeight:me?48:44,minWidth:88,paddingHorizontal:12,borderRadius:11,alignItems:'center',justifyContent:'center',backgroundColor:o?O.colours.gold:'transparent',...be.look.web(o?{backgroundImage:t.IS_ISOLATED_VENUE?'none':'linear-gradient(180deg, #DDB671 0%, #C29550 100%)',boxShadow:t.IS_ISOLATED_VENUE?'0 4px 12px rgba(0,0,0,0.3)':'0 1px 0 rgba(255,255,255,0.3) inset, 0 4px 12px rgba(207,164,95,0.22)'}:{})},children:(0,we.jsx)(L.T,{size:me?16:13,weight:"semibold",colour:o?'#16120B':'#BDB5A6',children:s})},e)})}),Vs=e=>(0,we.jsxs)(we.Fragment,{children:[(0,we.jsx)(ye.BigAction,{premium:!0,label:"Walk-in",onPress:Je.openWalkIn,testID:"add-walkin",block:e,size:"s"}),(0,we.jsx)(ye.BigAction,{premium:!0,label:"New booking",onPress:Je.openBooking,testID:"add-booking",block:e,size:"s"}),(0,we.jsx)(ye.BigAction,{premium:!0,label:"Edit booking",onPress:()=>pt(!0),testID:"display-edit-booking",block:e,size:"s"})]});(0,je.useDisplayNotices)(We,!e);const Gs=(0,we.jsxs)(B.default,{testID:"display-tools",accessibilityLabel:"Display tools",onLayout:t=>{e||g.useDisplayToolsH.setState({h:Math.round(t.nativeEvent.layout.height)})},style:{flexDirection:'row',flexWrap:d>=900?'nowrap':'wrap',gap:8,paddingHorizontal:14,paddingVertical:me?12:6,justifyContent:me?'center':void 0,borderTopWidth:1,borderTopColor:O.colours.hairline,backgroundColor:(0,o.soutersSurface)('#0D0D0C')},children:[e?null:(0,we.jsx)(fe.DisplayClockButton,{}),et.areas.some(e=>e.outdoor)?(0,we.jsx)(ce.CloseGardenButton,{rid:We,r:He,now:Fe,by:Ke,quiet:!0,short:!0}):null,(0,we.jsx)(ce.BlockBookingsButton,{rid:We,r:He,now:Fe,by:Ke,quiet:!0,display:!0}),(0,we.jsx)(K.HoldToEdit,{quiet:!0,onUnlock:()=>{Nt(null),Ot({at:Date.now()})},onHint:()=>Wt('Plan locked. Press and hold Edit plan for 2 seconds to unlock it.')}),(0,we.jsx)(h.GiftQrButton,{rid:We,venue:He.name}),e?null:(0,we.jsx)(b.ExitButton,{})]}),Us=Ut.length?(0,we.jsxs)(B.default,{testID:"takeaway-panel",style:[be.look.panel,{overflow:'hidden'}],children:[(0,we.jsxs)(L.Row,{style:{justifyContent:'space-between',paddingHorizontal:14,paddingTop:12},children:[(0,we.jsx)(L.T,{size:15,weight:"semibold",children:"Takeaway"}),(0,we.jsxs)(L.T,{size:12,colour:O.colours.muted,children:[Ut.length," live"]})]}),(0,we.jsx)(B.default,{style:{padding:10},children:(0,we.jsx)(Ce,{list:Ut,me:Ke,compact:!0,bookings:Ae})})]}):null,qs=(ge.DueToday,as?ds:Ft.filter(e=>'confirmed'===e.status||'seated'===e.status).sort((e,t)=>e.time.localeCompare(t.time))),Ks=as?rs?`${ns}\u2019s guests`:`Guests ${ns}`:'Today\u2019s guests',Ys=(0,we.jsxs)(we.Fragment,{children:[0===qs.length?(0,we.jsx)(L.Muted,{children:as?is{const t=(0,X.guestRowText)(e,{name:e.walkIn?(0,J.privName)(e,Ze):(e.name??'').replace(' (example)',''),seated:'seated'===e.status&&!as});return(0,we.jsxs)(C.default,{testID:`display-guest-row-${e.id}`,accessibilityRole:"button",accessibilityLabel:t.a11y,accessibilityHint:as?'Opens assign table':'Opens seat, finished, no-show and assign table',onPress:()=>{kt(!1),It(e.id)},style:({pressed:e})=>({minHeight:64,paddingVertical:8,paddingHorizontal:8,borderRadius:8,borderBottomWidth:1,borderColor:O.colours.hairline,backgroundColor:e?O.colours.tilePressed:'transparent'}),children:[(0,we.jsxs)(B.default,{style:{flexDirection:'row',alignItems:'flex-start',gap:10},children:[(0,we.jsx)(L.T,{size:18,weight:"semibold",colour:O.colours.gold,style:{width:58},children:t.time}),(0,we.jsx)(L.T,{size:18,weight:"semibold",testID:"guest-row-name",style:{flex:1,minWidth:0,flexWrap:'wrap'},children:t.name})]}),(0,we.jsxs)(L.T,{size:16,testID:"guest-row-detail",style:{marginLeft:68,marginTop:2,flexWrap:'wrap'},children:[(0,we.jsx)(L.T,{size:16,colour:O.colours.text,children:t.people}),t.deposit?(0,we.jsx)(L.T,{size:16,colour:O.colours.muted,children:" \xb7 "}):null,t.deposit?(0,we.jsx)(L.T,{size:16,weight:"semibold",colour:t.depositWarn?O.colours.amber:O.colours.goldLight,testID:`display-deposit-${e.id}`,children:t.deposit}):null,(0,we.jsx)(L.T,{size:16,colour:O.colours.muted,children:" \xb7 "}),(0,we.jsx)(L.T,{size:16,colour:'No table yet'===t.table?O.colours.muted:O.colours.text,children:t.table}),t.dog?(0,we.jsx)(L.T,{size:16,children:" "}):null,t.dog?(0,we.jsx)(B.default,{style:{width:18,height:18,transform:[{translateY:3}]},children:(0,we.jsx)(Z.DogIcon,{size:18,testID:`display-dog-${e.id}`})}):null]})]},e.id)})]}),Qs=(0,we.jsx)($.default,{testID:"display-guest-list",accessibilityLabel:Ks,style:{flex:1},contentContainerStyle:{padding:12,gap:4},children:Ys}),Js=T.default.create({onMoveShouldSetPanResponder:(e,t)=>Math.abs(t.dx)>12&&Math.abs(t.dx)>Math.abs(t.dy),onPanResponderRelease:(e,t)=>{t.dx<-40&&kt(!1)}}),Xs=(0,we.jsxs)(C.default,{testID:"guests-handle",accessibilityRole:"button",accessibilityLabel:`${Ks}, ${qs.length}`,accessibilityState:{expanded:wt},'aria-expanded':wt,onPress:()=>kt(e=>!e),style:({pressed:e})=>({width:44,alignSelf:'stretch',borderRadius:12,borderWidth:1,borderColor:wt?O.colours.gold:O.colours.hairline,alignItems:'center',justifyContent:'center',gap:8,backgroundColor:e?O.colours.tilePressed:wt?O.colours.goldTint:'rgba(255,255,255,0.03)'}),children:[(0,we.jsx)(L.T,{size:16,weight:"bold",colour:O.colours.gold,children:qs.length}),(0,we.jsx)(B.default,{style:{width:44,height:150,alignItems:'center',justifyContent:'center'},children:(0,we.jsx)(B.default,{style:{position:'absolute',width:150,height:44,left:-53,top:53,alignItems:'center',justifyContent:'center',transform:[{rotate:'-90deg'}]},children:(0,we.jsxs)(L.T,{size:13,weight:"semibold",colour:O.colours.goldLight,numberOfLines:1,children:[Ks," ",wt?'\u2039':'\u203a']})})})]}),Zs=wt?(0,we.jsxs)(B.default,{style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:40,flexDirection:'row'},children:[(0,we.jsxs)(B.default,{testID:"guests-drawer",...Js.panHandlers,accessibilityViewIsModal:!0,style:{width:Math.min(560,Math.max(320,.44*d)),backgroundColor:O.colours.surface,borderRightWidth:1,borderColor:O.colours.gold,borderRadius:14,...be.look.web({boxShadow:'6px 0 24px rgba(0,0,0,0.5)'})},children:[(0,we.jsxs)(L.Row,{style:{justifyContent:'space-between',paddingHorizontal:12,paddingTop:10},children:[(0,we.jsxs)(L.T,{size:17,weight:"semibold",colour:O.colours.gold,style:{flex:1,flexWrap:'wrap'},children:[Ks.toUpperCase()," (",qs.length,")"]}),(0,we.jsx)(C.default,{accessibilityRole:"button",accessibilityLabel:`Close ${Ks}`,onPress:()=>kt(!1),style:{minWidth:44,minHeight:44,alignItems:'center',justifyContent:'center'},children:(0,we.jsx)(L.T,{size:18,colour:O.colours.muted,children:"\u2715"})})]}),Qs]}),(0,we.jsx)(C.default,{testID:"guests-backdrop",accessibilityLabel:`Close ${Ks}`,accessibilityRole:"button",onPress:()=>kt(!1),style:{flex:1}})]}):null,el=ms?xs:t.IS_KIRKTON&&!Object.values(He.kitchenHours??{}).some(Boolean)?(0,we.jsxs)(B.default,{testID:"kirkton-hours-to-confirm",style:[be.look.panel,{padding:14,gap:8}],children:[(0,we.jsx)(L.T,{weight:"semibold",children:"Opening and kitchen hours: to confirm"}),(0,we.jsx)(L.Muted,{children:"No service hours have been set for this venue."})]}):(0,we.jsx)(ue.DayGraph,{todays:ds,open:hs,close:gs,now:Fe,turnBase:He.settings.turnMins,pauses:ys,compact:me,height:me?180:Math.round(Math.min(130,Math.max(90,.13*R))),forecastNote:as?void 0:vs,emptyText:fs,past:is{as?kt(!0):ot('timeline')},ol=(0,we.jsxs)(B.default,{style:{flex:1,flexDirection:'row',padding:12,paddingTop:10,gap:12,minHeight:0},children:[Qe?null:Xs,(0,we.jsxs)(B.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[Qe?null:_s,Qe?(0,we.jsx)($.default,{contentContainerStyle:{gap:10,paddingBottom:14},children:(0,we.jsx)(D.DayView,{rid:We,day:Qe,today:Ye,app:"display"})}):Ns?Es:As,Zs]}),(0,we.jsxs)(B.default,{testID:"display-side",style:{width:Me,gap:10,minHeight:0},children:[(0,we.jsx)(B.default,{testID:"primary-actions",style:{flexDirection:'row',gap:8},children:Vs(!1)}),Fs,(0,we.jsxs)($.default,{testID:"display-side-scroll",style:{flex:1},contentContainerStyle:{gap:10,paddingBottom:6},children:[Us,(0,we.jsx)(ce.BlocksBanner,{rid:We,now:Fe,big:!0,by:Ke})]}),Qe?null:sl,Qe?null:tl,Qe?null:(0,we.jsx)(B.default,{testID:"covers-dock",children:(0,we.jsx)(k.CoversToday,{rid:We,day:is,sound:(0,I.flapSoundOn)(),onPress:ll})})]})]}),il=(xe&&Math.round(Math.min(160,Math.max(105,.16*R))),d<1180),al=xe&&d>=900;return(0,we.jsxs)(z.SafeAreaView,{style:{flex:1,backgroundColor:O.colours.bg},onTouchStart:()=>{$t.current=Date.now()},onMouseDown:()=>{$t.current=Date.now()},children:[me?(0,we.jsxs)(B.default,{style:{flex:1},children:[(0,we.jsxs)($.default,{ref:ze,testID:"phone-dashboard-scroll",style:{flex:1},contentContainerStyle:{padding:12,gap:16,paddingBottom:24,width:'100%',maxWidth:700,alignSelf:'center'},children:[(0,we.jsxs)(B.default,{testID:"display-header",style:{alignItems:'center',gap:8,paddingVertical:12},children:[(0,we.jsx)(P.RestaurantLogo,{rid:We,size:64}),(0,we.jsx)(L.T,{center:!0,size:24,weight:"semibold",accessibilityRole:"header",children:He.name}),(0,we.jsx)(P.PoweredBy,{}),(0,we.jsx)(f.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),(0,we.jsx)(B.default,{accessible:!0,accessibilityLabel:`Current time ${(0,W.hm)(Fe)}`,children:(0,we.jsx)(L.T,{center:!0,size:30,weight:"semibold",colour:O.colours.goldLight,children:(0,W.hm)(Fe)})}),(0,we.jsx)(pe.ShellfishChip,{rid:We,by:Ke,app:"display",size:"m"})]}),(0,we.jsx)(B.default,{testID:"phone-glance",style:{width:'100%'},children:(0,we.jsx)(Se,{phone:!0,items:[{label:'Tables',value:Ds.length,testID:'badge-tables'},{label:'Covers',value:Is,testID:'badge-covers'},{label:'Takeaway',value:Ut.length,alert:Ut.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>bt(!0)}]})}),(0,we.jsx)(B.default,{testID:"primary-actions",style:{gap:8},children:Vs(!0)}),(0,we.jsx)(ce.BlocksBanner,{rid:We,now:Fe,big:!0,by:Ke}),sl,Fs,(0,we.jsx)(B.default,{testID:"display-main",style:{width:'100%',minWidth:0},children:Ns?Es:As}),(0,we.jsxs)(B.default,{onLayout:e=>{Le.current=e.nativeEvent.layout.y},testID:"phone-guests-section",style:[be.look.panel,{width:'100%',padding:12,gap:8}],children:[(0,we.jsxs)(L.T,{center:!0,size:20,weight:"semibold",colour:O.colours.goldLight,accessibilityRole:"header",children:[Ks," (",qs.length,")"]}),(0,we.jsx)(B.default,{testID:"display-guest-list",accessibilityLabel:Ks,style:{gap:4},children:Ys})]}),Us,tl,(0,we.jsx)(B.default,{testID:"covers-dock",children:(0,we.jsx)(k.CoversToday,{rid:We,day:is,compact:!0,sound:(0,I.flapSoundOn)(),onPress:()=>ze.current?.scrollTo({y:Le.current,animated:!0})})}),(0,we.jsxs)(B.default,{testID:"phone-display-settings",style:{gap:8,alignItems:'center'},children:[(0,we.jsx)(L.T,{center:!0,size:14,colour:Ze?O.colours.muted:O.colours.amber,children:Ze?'Privacy: names shown as initials on tables':'Privacy off: names shown on tables'}),(0,we.jsx)(L.Button,{testID:"colour-key-help",kind:"secondary",label:"Table colours & symbols",accessibilityLabel:"Help: table colours and symbols",onPress:()=>Pt(!0),style:{minHeight:48,alignSelf:'stretch'}})]}),Gs]}),e?null:(0,we.jsx)(B.default,{testID:"phone-voice-footer",style:{alignItems:'center',paddingVertical:6,borderTopWidth:1,borderColor:O.colours.hairline},children:(0,we.jsx)(S.VoiceSlot,{size:56})})]}):(0,we.jsxs)(we.Fragment,{children:[(0,we.jsxs)(B.default,{testID:"display-header",style:{flexDirection:'row',flexWrap:al?'nowrap':'wrap',alignItems:'center',paddingHorizontal:d>=1e3?18:14,paddingVertical:R<500?3:8,gap:il?10:14,minHeight:R<500?46:60,backgroundColor:(0,o.soutersSurface)('#0D0D0C'),...be.look.web({backgroundImage:t.IS_SOUTERS?'none':'linear-gradient(180deg, #121110 0%, #0B0B0B 100%)'})},children:[(0,we.jsx)(B.default,{style:{flexShrink:1,minWidth:0},children:(0,we.jsx)(P.RestaurantBrand,{rid:He.id,size:30})}),(0,we.jsx)(f.AppBadge,{label:e?'RESTAURANT DASHBOARD':'DISPLAY'}),d>=1e3?(0,we.jsx)(B.default,{style:{width:1,height:26,backgroundColor:'rgba(255,255,255,0.08)'}}):null,(0,we.jsxs)(B.default,{style:{flexDirection:'row',alignItems:'baseline',gap:10},children:[(0,we.jsx)(L.T,{size:26,weight:"semibold",colour:O.colours.goldLight,style:{letterSpacing:.5,lineHeight:32},children:(0,W.hm)(Fe)}),R>=500&&!il?(0,we.jsx)(L.T,{size:14,colour:O.colours.muted,children:(0,W.niceDate)(Fe)}):null]}),(0,we.jsx)(B.default,{style:{flex:1}}),(0,we.jsx)(pe.ShellfishChip,{rid:We,by:Ke,app:"display",size:d<1e3||R<500?'s':'m'}),(0,we.jsx)(Se,{tight:d<1e3,items:[{label:as?`tables ${rs?ns.toLowerCase():ns}`:'tables',value:Ds.length,testID:'badge-tables'},{label:as?`Covers ${rs?ns.toLowerCase():ns}`:'covers',value:as?Is:Gt,testID:'badge-covers'},{label:'takeaway',value:Ut.length,alert:Ut.some(e=>'new'===e.status),testID:'badge-takeaway',onPress:()=>bt(!0)}]}),R>=500||!Ze?(0,we.jsx)(L.T,{size:12,colour:Ze?'#A89A80':O.colours.amber,children:Ze?'Privacy':'Privacy off'}):null,(0,we.jsx)(C.default,{testID:"colour-key-help",accessibilityRole:"button",accessibilityLabel:"Help: table colours and symbols",onPress:()=>Pt(!0),style:({pressed:e})=>({width:44,height:44,borderRadius:22,borderWidth:1,borderColor:'rgba(255,255,255,0.10)',backgroundColor:e?'rgba(255,255,255,0.08)':'rgba(255,255,255,0.03)',alignItems:'center',justifyContent:'center'}),children:(0,we.jsx)(L.T,{size:15,weight:"semibold",colour:O.colours.muted,children:"?"})}),'simulated'===_e?(0,we.jsx)(C.default,{accessibilityRole:"button",accessibilityLabel:"Skip 15 minutes",onPress:()=>Ne(15),style:{minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center'},children:(0,we.jsx)(L.T,{size:11,colour:O.colours.muted,children:il?'+15':'Skip 15 min'})}):null,(0,we.jsx)(S.VoiceSlot,{size:R<500?52:il?56:72})]}),ve?ol:(nl=(0,we.jsxs)(we.Fragment,{children:[(0,we.jsxs)(B.default,{testID:"front-door-bar",style:{gap:10},children:[(0,we.jsx)(B.default,{testID:"primary-actions",style:{flexDirection:'row',gap:12},children:Vs(!1)}),Fs]}),(0,we.jsx)(ce.BlocksBanner,{rid:We,now:Fe,big:!0,by:Ke}),Qe?(0,we.jsx)(D.DayView,{rid:We,day:Qe,today:Ye,app:"display"}):(0,we.jsx)(we.Fragment,{children:(0,we.jsxs)(B.default,{style:{flex:1,minHeight:0,flexDirection:'row',gap:10},children:[Xs,(0,we.jsxs)(B.default,{testID:"display-main",style:{flex:1,minWidth:0},children:[_s,Ns?Es:As,Zs]})]})}),Us,Qe?null:sl,Qe?null:(0,we.jsxs)(B.default,{style:{flexDirection:'row',gap:12,alignItems:'stretch'},children:[(0,we.jsx)(B.default,{style:{flex:1.4},children:tl}),(0,we.jsx)(B.default,{testID:"covers-dock",style:{flex:1},children:(0,we.jsx)(k.CoversToday,{rid:We,day:is,sound:(0,I.flapSoundOn)(),onPress:ll})})]})]}),(0,we.jsx)(B.default,{style:{flex:1,padding:12,paddingTop:10,gap:10,minHeight:0},children:nl})),Gs]}),(0,we.jsx)(y.SoldOutStrip,{rid:We}),(0,we.jsx)(u.TableOrderCue,{rid:We}),Je.elements,yt?(0,we.jsx)(c.EditBookingPicker,{rid:We,today:Ye,who:Ke,hidePrivate:!0,onClose:()=>pt(!1)}):null,mt?(0,we.jsx)(c.EditBookingSheet,{rid:We,id:mt,who:Ke,hidePrivate:!0,onClose:()=>xt(null)}):null,nt?(0,we.jsx)(oe.TableSheet,{rid:We,name:nt,view:Qt,plan:et,todays:Ft,now:Fe,privacy:Ze,turnBase:He.settings.turnMins,onClose:()=>rt(null),onWalkIn:e=>Je.openWalkInAt(e),onMove:e=>ct(e),onDetails:_t}):null,ws?(()=>{const e=js[ws],t=e?.dayBookings??[];return(0,we.jsxs)(L.Sheet,{visible:!0,onClose:()=>ks(null),title:`${(0,a.tableNumbers)(ws)} \xb7 ${rs?ns:(0,he.dayLong)(is)}`,maxWidth:560,testID:"day-table-sheet",children:[(0,we.jsxs)(L.T,{size:16,colour:O.colours.text,children:[e?`${e.table.maxSeats} seats. `:'',t.length?`${t.length} ${1===t.length?'booking':'bookings'} on this table ${rs?ns.toLowerCase():'that day'}. Tap one to change its tables.`:`No bookings on this table ${rs?ns.toLowerCase():'that day'}.`]}),t.map(e=>{const t=e.walkIn?(0,J.privName)(e,Ze):De(e.name);return(0,we.jsx)(L.Button,{kind:"secondary",label:`${e.time} \xb7 ${t} \xb7 ${e.partySize} Covers`,testID:`day-table-booking-${e.id}`,accessibilityLabel:`${e.time}, ${t}, ${e.partySize} Covers, ${(0,se.tablesWords)((0,_.tablesOf)(e.table))}. Opens assign table.`,onPress:()=>{ks(null),It(e.id)},style:{minHeight:56}},e.id)}),(0,we.jsx)(L.Button,{kind:"ghost",label:"Close",accessibilityLabel:"Close",onPress:()=>ks(null),style:{minHeight:56}})]})})():null,Dt?(()=>{const e=Ae.find(e=>e.id===Dt);return e?(0,we.jsx)(ee.GuestActionsSheet,{rid:We,b:e,name:e.walkIn?(0,J.privName)(e,Ze):De(e.name),view:Qt,now:Fe,otherDay:e.date!==Ye,turnBase:He.settings.turnMins,onClose:()=>It(null),onDetails:_t,onDone:Wt,onPickOnPlan:(e,t)=>{kt(!1),ot('plan'),at('all'),St({id:e.id,tables:t})}}):null})():null,ut?(0,we.jsx)(oe.DetailsPanel,{title:ut.title,onClose:()=>ht(null),children:ut.body}):null,ft?(0,we.jsx)(oe.ServiceSummary,{r:He,todays:Ft,orders:Oe,waitlistAll:Mt,walkInCount:zt,onClose:()=>jt(!1)}):null,Lt?(0,we.jsxs)(L.Sheet,{visible:!0,onClose:()=>Pt(!1),title:"Table colours and symbols",maxWidth:560,testID:"colour-key",children:[(0,we.jsx)(oe.Legend,{}),(0,we.jsx)(L.Button,{kind:"secondary",label:"Close",onPress:()=>Pt(!1)})]}):null,gt?(0,we.jsxs)(oe.DetailsPanel,{title:"Takeaway",onClose:()=>bt(!1),children:[(0,we.jsx)(L.Muted,{children:"In-house orders go through your till (EPOS). Only takeaway orders show here."}),(0,we.jsx)(Ce,{list:Ut,me:Ke,bookings:Ae})]}):null,Ht?(0,we.jsx)(B.default,{testID:"display-editor",style:{position:'absolute',left:0,right:0,top:0,bottom:0,zIndex:1e3,backgroundColor:O.colours.bg},children:(0,we.jsx)(q.PlanDesigner,{initial:et,venue:He.name,mode:"display",startStep:"arrange",onActivity:()=>{At.current=Date.now(),null!==Et&&Nt(null)},notice:null!==Et?`Locking again in ${Et} s \xb7 touch to keep editing`:null,onSave:e=>{_.useFloor.getState().setPlan(We,e),Ot(null),Wt('Table plan saved. Editing is locked again.')},onCancel:()=>{Ot(null),Wt('No changes kept. Editing is locked again.')}},Ht.at)}):null,e?null:(0,we.jsx)(Q.Screensaver,{rid:We,idleMins:Xe.idleMins,pinOn:Xe.pinOn,wake:Xe,tonightCards:Xe.tonightCards}),e?null:(0,we.jsx)(ae.PrintHost,{rid:We}),e?null:(0,we.jsx)(ie.AlertHost,{variant:"display",rid:We,skipTakeaway:!0}),e?null:(0,we.jsx)(v.SeatAllergenReminder,{rid:We}),e?null:(0,we.jsx)(ne.TakeawayTakeover,{rid:We,me:Ke})]});var nl};var t=_r(_d[0]),s=_r(_d[1]),l=_r(_d[2]),o=_r(_d[3]),i=_r(_d[4]),a=_r(_d[5]),n=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),g=_r(_d[12]),b=_r(_d[13]),y=_r(_d[14]),p=_r(_d[15]),x=_r(_d[16]),f=_r(_d[17]),j=_r(_d[18]),w=e(j),k=_r(_d[19]),D=_r(_d[20]),I=_r(_d[21]),v=_r(_d[22]),S=_r(_d[23]),T=e(_r(_d[24])),C=e(_r(_d[25])),$=e(_r(_d[26])),B=e(_r(_d[27])),M=e(_r(_d[28])),z=_r(_d[29]),L=_r(_d[30]),P=_r(_d[31]),R=_r(_d[32]),W=_r(_d[33]),H=_r(_d[34]),O=_r(_d[35]),A=_r(_d[36]),E=_r(_d[37]),N=_r(_d[38]),_=_r(_d[39]),F=_r(_d[40]),V=_r(_d[41]),G=_r(_d[42]),U=_r(_d[43]),q=_r(_d[44]),K=_r(_d[45]),Y=_r(_d[46]),Q=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),te=_r(_d[52]),se=_r(_d[53]),le=_r(_d[54]),oe=_r(_d[55]),ie=_r(_d[56]),ae=_r(_d[57]),ne=_r(_d[58]),re=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),ue=_r(_d[62]),he=_r(_d[63]),ge=_r(_d[64]),be=_r(_d[65]),ye=_r(_d[66]),pe=_r(_d[67]),me=_r(_d[68]),xe=_r(_d[69]),fe=_r(_d[70]),je=_r(_d[71]),we=_r(_d[72]);const ke=12e4,De=e=>(e??'').replace(' (example)',''),Ie=e=>'takeaway'===e.type&&!['collected','closed','cancelled'].includes(e.status),ve=e=>e.slotTime?(0,W.hm)(new Date(e.slotTime)):'ASAP';function Se({items:e,tight:t,phone:s}){return(0,we.jsx)(B.default,{style:{flexDirection:'row',alignItems:'center',borderRadius:14,borderWidth:1,borderColor:'rgba(255,255,255,0.07)',backgroundColor:'rgba(255,255,255,0.025)',overflow:'hidden'},children:e.map((e,l)=>{const o=(0,we.jsxs)(B.default,{testID:e.testID,style:{flex:s?1:void 0,flexDirection:s?'column':'row',alignItems:s?'center':'baseline',justifyContent:s?'center':void 0,gap:6,minHeight:44,paddingHorizontal:t?10:14,paddingVertical:6,borderLeftWidth:l?1:0,borderLeftColor:'rgba(255,255,255,0.07)',backgroundColor:e.alert?'rgba(232,168,56,0.14)':'transparent',...s?{minHeight:76}:{}},children:[(0,we.jsx)(L.T,{size:s?24:19,weight:"semibold",colour:e.alert?O.colours.amber:O.colours.text,children:e.value}),(0,we.jsx)(L.T,{size:s?14:12,colour:O.colours.muted,style:{letterSpacing:.3},children:e.label})]});return e.onPress?(0,we.jsx)(C.default,{accessibilityRole:"button",accessibilityLabel:`${e.label} ${e.value}`,onPress:e.onPress,style:s?{flex:1,minWidth:0}:void 0,children:o},e.testID):(0,we.jsx)(w.default.Fragment,{children:o},e.testID)})})}function Te({label:e,sub:t,selected:s,onPress:l,colour:o}){return(0,we.jsxs)(C.default,{accessibilityRole:"button",accessibilityState:{selected:s},accessibilityLabel:`${e}${t?`, ${t}`:''}${s?', selected':''}`,'aria-pressed':s,onPress:l,style:({pressed:e})=>({flexDirection:'row',alignItems:'center',gap:7,minHeight:44,paddingHorizontal:14,borderRadius:999,borderWidth:1,borderColor:s?'rgba(207,164,95,0.75)':'rgba(255,255,255,0.08)',backgroundColor:s?'rgba(207,164,95,0.16)':e?'rgba(255,255,255,0.06)':'rgba(255,255,255,0.03)'}),children:[o?(0,we.jsx)(B.default,{style:{width:7,height:7,borderRadius:4,backgroundColor:o}}):null,(0,we.jsx)(L.T,{size:14,weight:s?'semibold':'medium',colour:s?O.colours.goldLight:'#CFC8BA',children:e}),t?(0,we.jsx)(L.T,{size:12,colour:O.colours.muted,children:t}):null]})}function Ce({list:e,me:t,compact:s,bookings:l}){const o=(e,t)=>(0,xe.statusBlock)(e,t,(0,xe.linkedBooking)(e,l));return e.length?(0,we.jsx)(B.default,{style:{gap:8},children:e.map(e=>(0,we.jsxs)(B.default,{testID:`takeaway-${e.ref}`,style:{backgroundColor:O.colours.surface2,borderRadius:12,padding:10,gap:4,borderLeftWidth:5,borderLeftColor:'ready'===e.status?O.colours.ok:e.allergies.length?O.colours.red:O.colours.gold},children:[(0,we.jsxs)(L.Row,{style:{justifyContent:'space-between'},children:[(0,we.jsxs)(L.T,{size:s?16:18,weight:"bold",children:[ve(e)," \xb7 ",De(e.customerName)]}),(0,we.jsx)(L.Badge,{kind:'ready'===e.status?'ok':'new'===e.status?'amber':'gold',label:'new'===e.status?'NEW':'ready'===e.status?'READY':'preparing'===e.status?'COOKING':'CONFIRMED'})]}),(0,we.jsxs)(L.Muted,{children:[e.ref," \xb7 ",e.lines.reduce((e,t)=>e+t.qty,0)," items",'here'===e.customerSignal?' \xb7 CUSTOMER IS HERE':e.customerSignal?' \xb7 on the way':'']}),e.allergies.length?(0,we.jsxs)(L.T,{size:14,weight:"semibold",colour:O.colours.red,children:["\u26a0 ",e.allergies.map(e=>(0,R.allergenLabel)(e.allergen)).join(', ')]}):null,e.allergies.length?(0,we.jsx)(me.AllergyChain,{o:e,me:t,compact:!0}):null,(0,we.jsxs)(L.Row,{wrap:!0,gap:6,children:['new'!==e.status||e.accepted?null:(0,we.jsx)(L.Button,{small:!0,label:"Confirm",testID:`confirm-${e.ref}`,onPress:()=>H.repo.orders.accept(e.id,t)}),e.accepted&&['new','acknowledged','preparing'].includes(e.status)?(0,we.jsx)(L.Button,{small:!0,kind:"success",label:o(e,'ready')?'Kitchen sign-off first':'Ready',disabled:!!o(e,'ready'),testID:`ready-${e.ref}`,onPress:()=>H.repo.orders.setStatus(e.id,'ready',t)}):null,'ready'===e.status?(0,we.jsx)(L.Button,{small:!0,label:o(e,'collected')?'Sign-offs needed':'Collected',disabled:!!o(e,'collected'),testID:`collected-${e.ref}`,onPress:()=>H.repo.orders.setStatus(e.id,'collected',t)}):null,(0,we.jsx)(ae.ReprintButton,{rid:e.restaurantId,o:e})]})]},e.id))}):(0,we.jsx)(L.Muted,{children:"No takeaway orders right now."})}function $e({rid:e,id:t,turnBase:s}){const l=(0,H.useBookings)(e).find(e=>e.id===t);return l?(0,we.jsx)(d.BookingTableButton,{rid:e,booking:l,turnBase:s}):null}},877,[5,6,1414,878,1314,808,868,1415,1311,1319,1416,1417,879,1418,1419,946,1118,970,30,971,972,1012,951,962,241,263,151,127,287,289,813,860,814,818,819,821,854,989,954,825,826,1014,1420,1013,1015,1422,1424,1427,1426,1429,1430,1431,1313,1315,815,1433,963,964,1372,965,824,990,1442,1305,1444,1353,1445,1352,986,987,1044,1446,24]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SOUTERS_BG",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"SOUTERS_SURFACE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"SOUTERS_TYPE_SCALE",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"soutersFont",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"soutersSurface",{enumerable:!0,get:function(){return f}}),e.soutersInk=function(o){if(!t.IS_SOUTERS)return o;const c=(0,n.normaliseHex)(o);return c?'#A4622E'===c?'#D9AD8A':(0,n.contrast)(c,u)<4.5?'#FFFFFF':o:o};var t=r(d[0]),n=r(d[1]);const u='#56152A',o='#43122F',c=.88,S=n=>t.IS_SOUTERS?Math.round(n*c*100)/100:n,f=n=>t.IS_SOUTERS?o:n},878,[5,1047]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useScreensaverAsleep",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"useDisplayToolsH",{enumerable:!0,get:function(){return s}});var t=r(d[0]);const n=(0,t.create)(t=>({asleep:!1,set:n=>t({asleep:n})})),s=(0,t.create)(()=>({h:65}))},879,[1008]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"START_PAIR",{enumerable:!0,get:function(){return t}});const t=(()=>{try{if('undefined'==typeof window||!window.location)return null;const t=new URL(window.location.href),n=new URLSearchParams(t.hash.replace(/^#/,'')),c=t.searchParams.get('pair')||n.get('pair');if(!c)return null;t.searchParams.delete('pair'),n.delete('pair');const o=n.toString();return window.history.replaceState(null,'',t.pathname+(t.search?t.search:'')+(o?`#${o}`:'')),c}catch{return null}})()},880,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"isLiveVenue",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"useLiveVenue",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"NOT_SET_UP",{enumerable:!0,get:function(){return f}});var t=r(d[0]),n=r(d[1]);const u=n=>!(t.PITCH||'live'!==n.mode&&'offline'!==n.mode||!n.venueId),o=()=>u(n.useSync.getState()),c=()=>(0,n.useSync)(t=>u(t)),f='Not set up yet'},943,[2,820]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.WhoBar=function(){const e=(0,n.useSignedIn)();if(!e)return null;const l=`Signed in as ${e.name.replace(' (example)','')}${e.level?` \xb7 ${e.level}`:''}`;return(0,o.jsx)(s.default,{testID:"who-bar",accessible:!0,accessibilityLabel:l,style:{paddingVertical:4},children:(0,o.jsx)(c.T,{size:18,weight:"semibold",colour:t.colours.gold,children:l})})},r(d[0]);var e,l=r(d[1]),s=(e=l)&&e.__esModule?e:{default:e},n=r(d[2]),t=r(d[3]),c=r(d[4]),o=r(d[5])},944,[30,127,954,821,813,24]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"currentScrollY",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"screenGeneration",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"restoreScroll",{enumerable:!0,get:function(){return o}}),_e.useScrollMemory=function(u){const c=(0,e.useRef)(0),o=(0,e.useRef)(0),l=(0,e.useRef)(0),s=(0,e.useRef)(0),f=(0,e.useRef)(0),v=(0,e.useRef)(null),y=(0,e.useRef)([]),h=()=>{y.current.forEach(clearTimeout),y.current=[]},b=()=>{const e=v.current;null!=e&&(u.current?.scrollTo({y:e,animated:!1}),f.current-s.current>=e-2&&(c.current=e,o.current=e,v.current=null,h()))},p=(0,e.useCallback)(e=>{if(h(),v.current=Math.max(0,e),e<=0)return v.current=null,u.current?.scrollTo({y:0,animated:!1}),c.current=0,void(o.current=0);for(const e of[0,30,80,160,320,600,1e3,1600,2500])y.current.push(setTimeout(b,e));y.current.push(setTimeout(()=>{v.current=null},2600))},[]);t={y:()=>o.current,restore:p};const R=(0,e.useCallback)(()=>{n++;return o.current},[]);return{props:{scrollEventThrottle:32,onScroll:e=>{const t=e.nativeEvent.contentOffset.y;c.current=t,s.current=e.nativeEvent.layoutMeasurement.height,f.current=e.nativeEvent.contentSize.height,Date.now()-l.current>250&&null==v.current&&(o.current=t)},onScrollBeginDrag:()=>{v.current=null,h()},onContentSizeChange:(e,t)=>{f.current=t,l.current=Date.now(),b()},onLayout:e=>{s.current=e.nativeEvent.layout.height}},restore:p,leave:R}};var e=r(d[0]);let t=null,n=0;const u=()=>t?t.y():0,c=()=>n,o=e=>t?.restore(e)},945,[30]); +__d(function(g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useSoldOut",{enumerable:!0,get:function(){return f}}),_e.setSoldOutBy=m,_e.setSoldOut=function(e,t,n){if(!s.useStore.getState().menu.find(t=>t.id===e))return;n&&m(n);s.useStore.getState().updateMenuItem(e,{soldOut:t})},_e.soldOutNow=function(e,t=c()){return(0,o.activeSoldOut)(f.getState().entries,e,t)},_e.linkSoldOut=O,_e.useSoldOutLink=function(e,t,n=!0){const r=_r(d[9]);r.useEffect(()=>{n&&O({adopt:e})},[e,n]),r.useEffect(()=>{n&&m(t)},[t,n])};var e,t=_r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},r=_r(d[1]),a=_r(d[2]),o=_r(d[3]),i=_r(d[4]),s=_r(d[5]),u=_r(d[6]),l=_r(d[7]);const c=()=>{try{return(0,s.nowFrom)(s.useStore.getState().clock)}catch{return new Date}},f=(0,r.create)()((0,a.persist)((e,t)=>({entries:[],adopted:{},mark:(t,n,r,a)=>{const u=c(),l=s.useStore.getState().restaurants.find(e=>e.id===t),f=(0,o.soldOutSettingsOf)(l?.settings?.soldOut),S=l?(0,i.hoursFor)(l,u)?.close??null:null,m=(0,o.clearAfterFor)(u,f,S),p={rid:t,itemId:n,name:r.slice(0,120),on:!0,at:u.toISOString(),by:a.slice(0,80),clearAfter:m?.toISOString(),auto:!1,kept:!1};e(e=>({entries:[...e.entries.filter(e=>!(e.rid===t&&e.itemId===n)),p]}))},back:(n,r,a)=>{const o=t().entries.find(e=>e.rid===n&&e.itemId===r);o&&o.on&&e(e=>({entries:e.entries.map(e=>e===o?{...e,on:!1,at:c().toISOString(),by:a.slice(0,80),clearAfter:void 0,kept:!!e.auto}:e)}))},expire:(n,r)=>{const a=(0,o.expiredSoldOut)(t().entries,n,r);if(!a.length)return 0;const i=new Set(a.map(e=>e.itemId));return e(e=>({entries:e.entries.map(e=>e.rid===n&&i.has(e.itemId)?{...e,on:!1,by:'Cleared automatically',clearAfter:void 0}:e)})),a.length}}),{name:'covercharge-soldout-v1',version:1,storage:(0,a.createJSONStorage)(()=>n.default),partialize:e=>({entries:e.entries.slice(-500),adopted:e.adopted})}));let S='Staff';function m(e){e&&(S=e.replace(' (example)',''))}let p=null;function O(e){if(p)return p;let t=!1;const n=(e=s.useStore.getState().menu)=>new Map(e.map(e=>[e.id,e.soldOut]));let r=n();if(e.adopt){const e={...f.getState().adopted},t=[];for(const t of s.useStore.getState().menu)e[t.restaurantId];for(const t of s.useStore.getState().menu)e[t.restaurantId]=!0;f.setState(n=>({entries:[...n.entries,...t],adopted:e}))}const a=()=>{const e=c(),a=f.getState().entries,o=s.useStore.getState().menu,i=new Map;for(const t of a){const n=t.on&&(!t.clearAfter||new Date(t.clearAfter).getTime()>e.getTime());i.set(`${t.rid}|${t.itemId}`,n)}const u=o.filter(e=>i.has(`${e.restaurantId}|${e.id}`)&&i.get(`${e.restaurantId}|${e.id}`)!==e.soldOut);if(u.length){t=!0;try{const e=new Map(u.map(e=>[e.id,i.get(`${e.restaurantId}|${e.id}`)]));s.useStore.setState(t=>({menu:t.menu.map(t=>e.has(t.id)?{...t,soldOut:e.get(t.id)}:t)}))}finally{t=!1,r=n()}}},o=s.useStore.subscribe((e,a)=>{if(e.menu===a.menu)return;const o=n(e.menu);if(!t)for(const t of e.menu){const e=r.get(t.id);void 0!==e&&e!==t.soldOut&&(t.soldOut?f.getState().mark(t.restaurantId,t.id,t.name,S):f.getState().back(t.restaurantId,t.id,S))}r=o}),i=f.subscribe((e,t)=>{e.entries!==t.entries&&a()}),u=()=>{const e=c(),t=new Set(f.getState().entries.filter(e=>e.on).map(e=>e.rid));for(const n of t)f.getState().expire(n,e)};u(),a();const l=setInterval(u,3e4);let m=null;if(e.adopt)try{m=_r(d[8],"./autoSoldOutStore").startAutoSoldOut()}catch{m=null}return p=()=>{o(),i(),clearInterval(l),m&&m(),p=null},p}u.PITCH&&'undefined'!=typeof globalThis&&(globalThis.__pitchLive=e=>(0,l.setLiveData)(!!e),globalThis.__pitchSoldOut=e=>{const t=s.useStore.getState(),n=t.restaurants[0]?.id;if(!n)return;const r=t.menu.filter(e=>e.restaurantId===n&&!e.hidden),a=['Sticky toffee pudding','Cullen skink','Fish supper','Steak pie','Haggis bon bons','Cranachan','Lemon tart','Mussels','Scampi','Venison burger','Chips (large)','Oysters','Lobster thermidor','Crab claws','Tablet ice cream','Beef shin','Smoked salmon','Cheeseboard','Halibut','Clootie dumpling'],o=(new Date).toISOString(),i=Array.from({length:e},(e,t)=>r[t]?{id:r[t].id,name:r[t].name}:{id:`pitch-so-${t}`,name:a[t%a.length]});f.setState(e=>({entries:[...e.entries.filter(e=>e.rid!==n||!i.some(t=>t.id===e.itemId)).map(e=>e.rid===n?{...e,on:!1}:e),...i.map(e=>({rid:n,itemId:e.id,name:e.name,on:!0,at:o,by:'Chef'}))]}))})},946,[1024,1008,1025,999,815,870,2,1053,1069,30]); +__d(function(_g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useBackLayers",{enumerable:!0,get:function(){return y}}),_e.runBackLayer=function(){const e=y.getState().layers,t=e[e.length-1];return!!t&&(t.fn(),!0)},_e.useBackLayer=function(t,n,s=!0){const o=(0,e.useRef)(n);o.current=n,(0,e.useEffect)(()=>{if(!t)return;const e=++w,n=(0,l.currentScrollY)(),c=(0,l.screenGeneration)();return y.setState(t=>({layers:[...t.layers,{id:e,fn:()=>o.current(),own:s}]})),()=>{y.setState(t=>({layers:t.layers.filter(t=>t.id!==e)})),(0,l.screenGeneration)()===c&&(0,l.restoreScroll)(n)}},[t,s])},Object.defineProperty(_e,"useInnerBackShown",{enumerable:!0,get:function(){return h}}),_e.BackButton=function({onPress:e,testID:t="screen-back",label:n="Back"}){return(0,f.jsx)(s.default,{testID:t,accessibilityRole:"button",accessibilityLabel:n,onPress:e,hitSlop:8,style:({pressed:e})=>({minHeight:48,minWidth:96,justifyContent:'center',paddingRight:12,opacity:e?.6:1,alignSelf:'flex-start'}),children:(0,f.jsxs)(u.T,{size:18,weight:"semibold",colour:c.colours.gold,children:["\u2039 ",n]})})},_e.useWebBack=function(t){const n=(0,e.useRef)(t);n.current=t,(0,e.useEffect)(()=>{if('undefined'==typeof window||!window.history?.pushState)return;const e=()=>{try{window.history.pushState({...window.history.state??{},ccBack:Date.now()},'',window.location.href)}catch{}};e();const t=t=>{n.current()&&(t.stopImmediatePropagation?.(),e())};return window.addEventListener('popstate',t,!0),()=>window.removeEventListener('popstate',t,!0)},[])};var e=r(d[0]);r(d[1]);var t,n=r(d[2]),s=(t=n)&&t.__esModule?t:{default:t},o=r(d[3]),c=r(d[4]),u=r(d[5]),l=r(d[6]),f=r(d[7]);const y=(0,o.create)(()=>({layers:[]}));let w=0;const h=()=>y(e=>e.layers.some(e=>e.own))},947,[30,122,263,1008,821,813,945,24]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useTasksProgress=function(e,s){const t=(0,d.useDailyTasks)(t=>t.people[(0,d.personKey)(e,s)]?.tasks)??[],i=(0,d.useDailyTasks)(e=>e.ticks),{ymd:l,dow:o}=b();return(0,r.progress)(t,i,s,l,o)},_e.DailyTasksEditor=T,_e.MyTasksToday=function({rid:e,staffId:s,name:t,onShift:c}){const u=(0,d.useDailyTasks)(t=>t.people[(0,d.personKey)(e,s)]?.tasks)??[],h=(0,d.useDailyTasks)(e=>e.ticks),{ymd:y,dow:k}=b(),p=(0,r.tasksFor)(u,k);if(!s||!p.length)return null;const T=(0,r.progress)(u,h,s,y,k);return(0,x.jsx)(l.default,{testID:"my-tasks-today",children:(0,x.jsxs)(o.Card,{children:[(0,x.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(o.T,{weight:"semibold",colour:n.colours.gold,children:"My tasks today"}),(0,x.jsx)(o.Badge,{kind:T.done===T.total?'gold':'neutral',label:`${T.done} of ${T.total}`})]}),c?null:(0,x.jsx)(o.Muted,{size:12,children:"You\u2019re not on shift right now. You can still tick these when you are."}),p.map(r=>{const u=h.find(t=>t.id===(0,d.tickId)(e,s,r.id,y));return(0,x.jsxs)(i.default,{testID:`my-task-${r.id}`,accessibilityRole:"checkbox",accessibilityState:{checked:!!u},disabled:!c,onPress:()=>d.useDailyTasks.getState().toggleTick(e,s,r.id,y,{id:s,name:t.replace(' (example)','')}),style:{flexDirection:'row',alignItems:'center',gap:10,paddingVertical:8,opacity:c?1:.6},children:[(0,x.jsx)(l.default,{style:{width:24,height:24,borderRadius:6,borderWidth:1.5,borderColor:n.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:u?'#2a2414':'transparent'},children:u?(0,x.jsx)(o.T,{colour:n.colours.gold,children:"\u2713"}):null}),(0,x.jsxs)(l.default,{style:{flex:1},children:[(0,x.jsx)(o.T,{style:{textDecorationLine:u?'line-through':'none'},children:r.text}),u?(0,x.jsxs)(o.Muted,{size:12,children:["Done at ",f(u.at)]}):null]})]},r.id)}),(0,x.jsx)(o.Muted,{size:12,children:"Tip: tick each one as you finish it. Your manager sees how you\u2019re getting on. They start fresh every day."})]})})},_e.TaskLibrarySettings=function({rid:e}){(0,t.useEffect)(()=>{d.useDailyTasks.getState().ensure(e)},[e]);const i=(0,d.useDailyTasks)(s=>s.library[e]?.items)??[],[c,u]=(0,t.useState)(''),[y,p]=(0,t.useState)({}),f=d.useDailyTasks.getState(),b=s=>f.setLibrary(e,s);return(0,x.jsxs)(l.default,{style:{gap:8},testID:"task-library",children:[(0,x.jsx)(o.Muted,{size:13,children:"Tip: these are quick picks when you add someone\u2019s daily tasks (Staff & roles \u203a a person \u203a Daily tasks). You can always type a new one there too."}),i.map((e,t)=>(0,x.jsxs)(o.Row,{gap:6,style:{opacity:e.archived?.5:1},children:[(0,x.jsx)(s.TextInput,{accessibilityLabel:`Rename ${e.text}`,value:y[e.id]??e.text,onChangeText:s=>p(t=>({...t,[e.id]:s})),onBlur:()=>{const s=(0,r.cleanTaskText)(y[e.id]??'');s&&s!==e.text&&b(i.map(t=>t.id===e.id?{...t,text:s}:t))},style:{...k,flex:1,minWidth:0}}),(0,x.jsx)(o.Button,{small:!0,kind:"ghost",label:"\u2191",disabled:0===t,onPress:()=>b((0,r.move)(i,t,-1))}),(0,x.jsx)(o.Button,{small:!0,kind:"ghost",label:"\u2193",disabled:t===i.length-1,onPress:()=>b((0,r.move)(i,t,1))}),(0,x.jsx)(o.Button,{small:!0,kind:"ghost",label:e.archived?'Bring back':'Archive',onPress:()=>b(i.map(s=>s.id===e.id?{...s,archived:!s.archived}:s))})]},e.id)),(0,x.jsxs)(o.Row,{gap:6,children:[(0,x.jsx)(s.TextInput,{accessibilityLabel:"New library task",testID:"task-lib-new",value:c,onChangeText:u,placeholder:"e.g. Check the beer garden",placeholderTextColor:n.colours.muted,style:{...k,flex:1}}),(0,x.jsx)(o.Button,{small:!0,label:"Add",disabled:!(0,r.cleanTaskText)(c),onPress:()=>{b([...i,{id:(0,h.uuid)(),text:(0,r.cleanTaskText)(c)}]),u('')}})]})]})},_e.KitchenTeamTasks=function({rid:e,actor:s}){const t=(0,y.useOwner)(e=>e.staff).filter(e=>e.active&&s&&(0,r.canEditTasks)(s,e));return(0,x.jsxs)(l.default,{style:{gap:10},testID:"kitchen-team-tasks",children:[(0,x.jsx)(o.Muted,{size:13,children:"Tip: set the daily tasks for your kitchen team here. They see them as \u2018My tasks today\u2019 when they\u2019re on shift and tick them off. Your own list and front of house lists are set by a manager."}),s?null:(0,x.jsx)(o.Muted,{children:"Sign in to change your team\u2019s tasks."}),s&&!t.length?(0,x.jsx)(o.Muted,{children:"No kitchen staff found. A manager can set each person\u2019s department in Staff & roles."}):null,t.map(t=>(0,x.jsxs)(o.Card,{children:[(0,x.jsx)(o.T,{weight:"semibold",children:(0,y.staffLabel)(t).replace(' (example)','')}),(0,x.jsxs)(o.Muted,{size:12,children:[t.job,t.dept?` \xb7 ${t.dept}`:'']}),(0,x.jsx)(T,{rid:e,person:t,actor:s})]},t.id))]})};var s=_r(_d[0]),t=_r(_d[1]),i=e(_r(_d[2])),l=e(_r(_d[3])),o=_r(_d[4]),n=_r(_d[5]),d=_r(_d[6]),r=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),y=_r(_d[11]),x=_r(_d[12]);const k={minHeight:42,borderRadius:10,borderWidth:1,borderColor:n.colours.hairline,backgroundColor:n.colours.surface2,color:n.colours.text,paddingHorizontal:10,fontSize:15},p=[1,2,3,4,5,6,0],f=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}),b=(e=Date.now())=>{const s=(0,c.ukClock)(e);return{ymd:s.ymd,dow:new Date(`${s.ymd}T12:00:00Z`).getUTCDay()}};function T({rid:e,person:c,actor:h}){(0,t.useEffect)(()=>{d.useDailyTasks.getState().ensure(e)},[e]);const y=(0,d.useDailyTasks)(s=>s.people[(0,d.personKey)(e,c.id)]?.tasks)??[],T=((0,d.useDailyTasks)(s=>s.library[e]?.items)??[]).filter(e=>!e.archived),j=(0,d.useDailyTasks)(e=>e.ticks),[w,D]=(0,t.useState)(!1),[v,S]=(0,t.useState)(''),[C,$]=(0,t.useState)(null),I=d.useDailyTasks.getState(),M=(0,r.canEditTasks)(h,c),{ymd:P,dow:R}=b(),L=(0,r.progress)(y,j,c.id,P,R),B=s=>I.setTasks(e,c.id,s),z=e=>{const s=y;B(y.filter(s=>s.id!==e.id)),(0,u.notify)({id:`task-undo-${e.id}`,title:`Removed \u201c${e.text}\u201d`,timeoutMs:8e3,actions:[{label:'Undo',testID:'task-undo',onPress:()=>B(s)}]})};return(0,x.jsxs)(l.default,{testID:`tasks-${c.id}`,style:{gap:6},children:[(0,x.jsx)(i.default,{accessibilityRole:"button",testID:`tasks-open-${c.id}`,onPress:()=>D(!w),children:(0,x.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsxs)(o.T,{weight:"semibold",colour:n.colours.gold,children:["Daily tasks ",w?'\u25b4':'\u25be']}),(0,x.jsx)(o.Muted,{size:12,children:y.length?`${L.done} of ${L.total} done today`:'None yet'})]})}),w?(0,x.jsxs)(l.default,{style:{gap:6},children:[y.map((s,t)=>{const i=j.find(t=>t.id===(0,d.tickId)(e,c.id,s.id,P));return(0,x.jsxs)(l.default,{testID:`task-row-${t}`,style:{borderTopWidth:1,borderColor:n.colours.hairline,paddingTop:6,gap:4},children:[(0,x.jsxs)(o.Row,{gap:6,children:[(0,x.jsxs)(o.T,{style:{flex:1},colour:i?n.colours.gold:n.colours.text,children:[i?'\u2713 ':'',s.text]}),M?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(o.Button,{small:!0,kind:"ghost",label:"\u2191",accessibilityLabel:`Move ${s.text} up`,disabled:0===t,onPress:()=>B((0,r.move)(y,t,-1))}),(0,x.jsx)(o.Button,{small:!0,kind:"ghost",label:"\u2193",accessibilityLabel:`Move ${s.text} down`,disabled:t===y.length-1,onPress:()=>B((0,r.move)(y,t,1))}),(0,x.jsx)(o.Button,{small:!0,kind:"ghost",label:"Days",onPress:()=>$(C===s.id?null:s.id)}),(0,x.jsx)(o.Button,{small:!0,kind:"ghost",testID:`task-remove-${t}`,label:"\u2715",accessibilityLabel:`Remove ${s.text}`,onPress:()=>z(s)})]}):null]}),(0,x.jsxs)(o.Muted,{size:12,children:[s.days?.length?s.days.map(e=>r.TASK_DAY_NAMES[e]).join(', '):'Every day',i?` \xb7 ticked by ${i.byName.split(' ')[0]} at ${f(i.at)}`:'']}),C===s.id?(0,x.jsx)(o.Row,{wrap:!0,gap:4,children:p.map(e=>{const t=!!s.days?.includes(e);return(0,x.jsx)(o.Chip,{label:r.TASK_DAY_NAMES[e],selected:t,onPress:()=>B(y.map(i=>i.id===s.id?{...i,days:t?(i.days??[]).filter(s=>s!==e):[...i.days??[],e].sort()}:i))},e)})}):null]},s.id)}),M?(0,x.jsxs)(l.default,{style:{gap:6},children:[(0,x.jsx)(o.Row,{wrap:!0,gap:4,children:T.filter(e=>!y.some(s=>s.text.toLowerCase()===e.text.toLowerCase())).slice(0,12).map(s=>(0,x.jsx)(o.Chip,{testID:"task-lib-chip",label:`${s.text}`,onPress:()=>I.addTask(e,c.id,s.text,s.id)},s.id))}),(0,x.jsxs)(o.Row,{gap:6,children:[(0,x.jsx)(s.TextInput,{accessibilityLabel:"New task",testID:`task-new-${c.id}`,value:v,onChangeText:S,placeholder:"Type a task, e.g. Restock the bar fridges",placeholderTextColor:n.colours.muted,style:{...k,flex:1},onSubmitEditing:()=>{(0,r.cleanTaskText)(v)&&(I.addTask(e,c.id,v),S(''))}}),(0,x.jsx)(o.Button,{small:!0,testID:`task-add-${c.id}`,label:"Add",disabled:!(0,r.cleanTaskText)(v),onPress:()=>{I.addTask(e,c.id,v),S('')}})]})]}):(0,x.jsx)(o.Muted,{size:12,children:'staff'===h?.role?'You can\u2019t change this list.':''})]}):null]})}},948,[874,30,263,127,813,821,993,1221,995,1041,1147,854,24]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.readBack=S,_e.ReviewSheet=I,_e.Bars=P,_e.CashCharts=M,_e.CashUpScreen=function({rid:e,today:t,canEdit:s,who:l,chartsOnly:n}){const r=(0,p.useCashSettings)(e),h=(0,p.useCashUp)(e=>e.cashUps).filter(t=>t.rid===e).sort((e,t)=>t.date.localeCompare(e.date)),m=(0,p.useCashUp)(e=>e.sales).filter(t=>t.rid===e).sort((e,t)=>t.weekStart.localeCompare(e.weekStart)),[f,x]=(0,a.useState)(null),[D,P]=(0,a.useState)(null),$=(0,w.useLockedFor)(e),[B,R]=(0,a.useState)(!1),[L,A]=(0,a.useState)(null),z=async(e,s,a,o)=>{const l=a??('cashup'===e?t:(0,y.weekStartOf)((0,y.addDaysYmd)(t,-7)));if($(e,l))return void P((0,w.lockedMessage)(e,l));const n=s?await(0,k.pickPhotos)({source:s}):[];if(s&&!n.length)return void P('No photo taken. Try again, choose one from the gallery, or type the figures by hand.');const i='cashup'===e?r.cashFields:r.salesFields;let d,u={vals:{},reader:null,note:'Type the figures from the sheet.',categories:[]};n.length&&(R(!0),P('Reading the photo\u2026'),d=await Promise.all(n.map((t,s)=>(0,k.uploadPhoto)(e,l,t,s))),u=await(0,j.readSheet)(e,d.filter(e=>!!e),i),R(!1),P(null));const c=o&&'cashup'===e?h.find(e=>e.date===l)?.vals:void 0;x({kind:e,key:l,photos:n,vals:c?{...u.vals,...c}:u.vals,categories:u.categories??[],unread:(0,y.missing)(i,u.vals),note:u.note,reader:o?'edit':u.reader,uploaded:d,only:o})},E=[0,1,2].map(e=>({label:0===e?'Today':1===e?'Yesterday':v((0,y.addDaysYmd)(t,-e)),value:(0,y.addDaysYmd)(t,-e)})),N=[0,1,2].map(e=>{const s=(0,y.weekStartOf)((0,y.addDaysYmd)(t,-7*e));return{label:0===e?'This week':1===e?'Last week':`w/c ${v(s)}`,value:s}});return(0,C.jsxs)(d.default,{testID:"cashup-screen",style:{gap:12},children:[(0,C.jsx)(u.Muted,{children:"Tip: at the end of the night, tap Take a picture of the taking sheet: the figures are filled in from the photo for you to check beside it, then Confirm. Bigger venues can Upload a spreadsheet (CSV or Excel) for one night or several. Gross takings feed Spend per head. Head Chefs can see the graphs."}),D?(0,C.jsx)(u.Banner,{kind:"info",children:D}):null,(0,C.jsx)(U,{rid:e,today:t,manage:s,who:l}),s&&!n?(0,C.jsxs)(u.Card,{highlight:c.colours.gold,children:[(0,C.jsx)(u.T,{weight:"semibold",children:"End of night cash up"}),(0,C.jsx)(i.default,{testID:"upload-cashup",accessibilityRole:"button",accessibilityLabel:"Take a picture of the taking sheet. Opens the camera; the figures are filled in for you to check.",disabled:B,onPress:()=>{z('cashup','camera')},style:({pressed:e})=>({minHeight:64,borderRadius:16,backgroundColor:e?c.colours.goldLight:c.colours.gold,alignItems:'center',justifyContent:'center',paddingHorizontal:18,opacity:B?.5:1}),children:(0,C.jsx)(u.T,{size:20,weight:"semibold",colour:c.colours.onGold,children:B?'Reading the photo\u2026':'Take a picture of the taking sheet'})}),(0,C.jsxs)(u.Row,{wrap:!0,gap:8,children:[(0,C.jsx)(u.Button,{testID:"cashup-gallery",kind:"secondary",label:"Choose from gallery",accessibilityLabel:"Choose a photo of the cash up from the gallery",onPress:()=>{z('cashup','gallery')}}),(0,C.jsx)(u.Button,{testID:"cashup-by-hand",kind:"secondary",label:"Type it in",onPress:()=>{z('cashup',null)}}),(0,C.jsx)(u.Button,{testID:"cashup-sheet",kind:"secondary",label:"Upload a spreadsheet",accessibilityLabel:"Upload a spreadsheet of takings, CSV or Excel, for one night or several",onPress:async()=>{const e=await(0,b.pickSpreadsheet)();e&&('error'in e?P(e.error):A(e))}}),(0,C.jsx)(u.Button,{testID:"cashup-takings",kind:"secondary",label:"Enter takings",accessibilityLabel:"Enter tonight's takings: gross, and food and drink if you have them",onPress:()=>{z('cashup',null,t,y.TAKINGS_KEYS)}})]}),(0,C.jsx)(u.T,{weight:"semibold",style:{marginTop:8},children:"Weekly sales report"}),(0,C.jsxs)(u.Row,{wrap:!0,gap:8,children:[(0,C.jsx)(u.Button,{testID:"upload-sales",label:"Upload weekly sales report",onPress:()=>{z('sales','camera')}}),(0,C.jsx)(u.Button,{testID:"sales-gallery",kind:"secondary",label:"Choose from gallery",onPress:()=>{z('sales','gallery')}}),(0,C.jsx)(u.Button,{testID:"sales-by-hand",kind:"secondary",label:"Type it in",onPress:()=>{z('sales',null)}})]}),(0,C.jsx)(u.Muted,{children:"Several pages? Pick them all at once. Fields can be changed in Settings \u203a Advanced \u203a Cash up."})]}):null,(0,C.jsx)(M,{rid:e,today:t}),(0,C.jsxs)(u.Card,{children:[(0,C.jsx)(u.T,{weight:"semibold",children:"Recent cash ups"}),h.length?h.slice(0,10).map(e=>(0,C.jsxs)(d.default,{testID:`cashup-row-${e.date}`,style:{paddingVertical:6,borderTopWidth:1,borderTopColor:'rgba(255,255,255,0.06)',gap:2},children:[(0,C.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsx)(u.T,{weight:"semibold",children:v(e.date)}),(0,C.jsx)(u.T,{colour:c.colours.goldLight,children:T((0,y.takings)(e.vals))})]}),(0,C.jsx)(u.Muted,{children:r.cashFields.filter(e=>'text'!==e.kind&&'card'!==e.key&&'cash'!==e.key).map(t=>`${t.label} ${(0,y.isBlank)(e.vals[t.key])?'\u2014':'money'===t.kind?T(e.vals[t.key]):e.vals[t.key]}`).join(' \xb7 ')}),(0,C.jsxs)(u.Muted,{children:["Confirmed by ",e.confirmedBy??'\u2014',e.photos.length?` \xb7 ${e.photos.length} photo${e.photos.length>1?'s':''}`:'']}),s&&!$('cashup',e.date)?(0,C.jsxs)(u.Row,{gap:6,children:[(0,C.jsx)(u.Button,{small:!0,kind:"ghost",label:"Edit",onPress:()=>x({kind:'cashup',key:e.date,photos:e.photos,vals:e.vals,categories:[],unread:[],note:'',reader:'edit'})}),(0,C.jsx)(u.Button,{small:!0,kind:"ghost",testID:`takings-edit-${e.date}`,label:null==(0,y.grossOf)(e.vals)?'Add takings':'Edit takings',onPress:()=>x({kind:'cashup',key:e.date,photos:[],vals:e.vals,categories:[],unread:[],note:'',reader:'edit',only:y.TAKINGS_KEYS})})]}):null,s?(0,C.jsx)(w.CashLockControls,{kind:"cashup",item:e,label:v(e.date)}):null]},e.id)):(0,C.jsx)(u.Muted,{children:"None yet."})]}),(0,C.jsxs)(u.Card,{children:[(0,C.jsx)(u.T,{weight:"semibold",children:"Weekly sales reports"}),m.length?m.slice(0,8).map(e=>(0,C.jsxs)(d.default,{style:{paddingVertical:6,borderTopWidth:1,borderTopColor:'rgba(255,255,255,0.06)'},children:[(0,C.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsxs)(u.T,{weight:"semibold",children:["w/c ",v(e.weekStart)]}),(0,C.jsx)(u.T,{colour:c.colours.goldLight,children:T('number'==typeof e.vals.net?e.vals.net:null)})]}),(0,C.jsx)(u.Muted,{children:r.salesFields.filter(e=>'net'!==e.key).map(t=>`${t.label} ${(0,y.isBlank)(e.vals[t.key])?'\u2014':'money'===t.kind?T(e.vals[t.key]):e.vals[t.key]}`).join(' \xb7 ')}),s?(0,C.jsx)(w.CashLockControls,{kind:"sales",item:e,label:`w/c ${v(e.weekStart)}`}):null]},e.id)):(0,C.jsx)(u.Muted,{children:"None yet."})]}),L?(0,C.jsx)(b.SpreadsheetImport,{rid:e,file:L,who:l,locked:e=>$('cashup',e),onClose:()=>A(null),onSaved:e=>{P(e),A(null)}}):null,f?(0,C.jsx)(I,{draft:f,fields:'cashup'===f.kind?r.cashFields:r.salesFields,onClose:()=>x(null),onConfirm:async(t,s)=>{if(!f)return;if($(f.kind,f.key))return P((0,w.lockedMessage)(f.kind,f.key)),void x(null);const a=f.uploaded&&f.uploaded.length===f.photos.length?f.uploaded:await Promise.all(f.photos.map((e,t)=>(0,k.uploadPhoto)(f.kind,f.key,e,t))),n=f.photos.map((e,t)=>a[t]??e),r=(new Date).toISOString();if('cashup'===f.kind){const s=h.find(e=>e.date===f.key),a=f.only&&s?{...s.vals,...t}:t;p.useCashUp.getState().saveCashUp({rid:e,date:f.key,vals:a,photos:f.only&&s?s.photos:n,confirmedBy:l.name,confirmedAt:r,readBy:f.reader});const i=(0,y.combinedTips)(a),d=S(a);P(`Cash up for ${v(f.key)} saved${d?`: ${d}`:''}${null==i||f.only?'':`. Today\u2019s tips (${T(i)}) are now showing in the staff apps`}.`);try{o.default.announceForAccessibility?.(`Saved. ${d}`)}catch{}}else p.useCashUp.getState().saveSales({rid:e,weekStart:f.key,vals:t,categories:s,photos:n,confirmedBy:l.name,confirmedAt:r,readBy:f.reader}),P(`Weekly sales for the week of ${v(f.key)} saved.`);a.some(e=>null==e)&&f.photos.length&&P(e=>`${e??''} The photo is kept on this device only (not signed in or offline).`),x(null)},keyLabel:'cashup'===f.kind?'Day':'Week starting',keyChoices:'cashup'===f.kind?E:N,onKey:e=>x({...f,key:e})},`${f.kind}-${f.photos.length}`):null]})},_e.TodaysTipsCard=function({rid:e,today:t,big:s}){const a=(0,p.useTipsShow)(e),o=(0,p.useCashUp)(e=>e.tips).filter(s=>s.rid===e&&(s.date===t||s.date===(0,y.addDaysYmd)(t,-1))).sort((e,t)=>t.date.localeCompare(e.date))[0],l=R(o?.total??0);return a.showToday&&o?(0,C.jsx)(u.Card,{highlight:c.colours.gold,children:(0,C.jsxs)(d.default,{testID:"todays-tips",style:{flexDirection:'row',alignItems:'center',gap:14},children:[(0,C.jsx)($,{n:Math.ceil(o.total/25)}),(0,C.jsxs)(d.default,{style:{flex:1,gap:2},children:[(0,C.jsx)(u.T,{size:12,weight:"semibold",colour:c.colours.gold,style:{letterSpacing:1.5},children:o.date===t?'TODAY\u2019S TIPS':'LAST NIGHT\u2019S TIPS'}),(0,C.jsx)(u.T,{size:s?40:32,weight:"bold",colour:c.colours.goldLight,children:T(l)}),(0,C.jsxs)(u.Muted,{children:["Cash + card tips for the whole team \xb7 ",v(o.date),". Thank you, everyone."]})]})]})}):null},_e.TipsPotCard=U,_e.useTipsPosted=function(e,t,s=!0){const o=(0,p.useCashUp)(e=>e.tips),l=(0,p.useTipsShow)(e);(0,a.useEffect)(()=>{if(!s||!l.showToday)return;const a=o.filter(s=>s.rid===e&&s.date>=(0,y.addDaysYmd)(t,-1)&&s.date<=t).sort((e,t)=>t.date.localeCompare(e.date))[0];if(!a)return;const n=`${e}:${a.date}`;p.useCashUp.getState().seen[n]!==a.total&&(p.useCashUp.getState().markSeen(n,a.total),(0,x.notify)({id:`tips-${n}`,icon:'\ud83e\ude99',kicker:'TIPS',title:`${a.date===t?'Today\u2019s':'Last night\u2019s'} tips: ${T(a.total)}`,body:'Cash + card tips for the whole team. Added to the Tips pot. Thank you, everyone.',testID:'tips-notice',timeoutMs:12e3,actions:[{label:'Nice',testID:'tips-notice-ok',onPress:()=>{}}]}))},[e,t,o,l.showToday,s])},_e.CashUpSettings=function({rid:e}){const t=(0,p.useCashSettings)(e),a=(t,s)=>p.useCashUp.getState().setFields(e,t,s),o=(e,o)=>(0,C.jsxs)(d.default,{style:{gap:6},children:[(0,C.jsx)(u.T,{weight:"semibold",children:o}),t[e].map((o,l)=>(0,C.jsxs)(u.Row,{gap:6,children:[(0,C.jsx)(s.TextInput,{testID:`cf-${e}-${o.key}`,value:o.label,onChangeText:s=>a(e,t[e].map((e,t)=>t===l?{...e,label:s.slice(0,40)}:e)),style:{flex:1,minHeight:38,borderRadius:8,borderWidth:1,borderColor:'rgba(255,255,255,0.15)',color:c.colours.text,paddingHorizontal:8}}),(0,C.jsx)(u.Muted,{children:'money'===o.kind?'\xa3':'number'===o.kind?'#':'text'}),o.fixed?(0,C.jsx)(u.Muted,{children:"needed"}):(0,C.jsx)(u.Button,{small:!0,kind:"ghost",label:"\u2715",accessibilityLabel:`Remove ${o.label}`,onPress:()=>a(e,t[e].filter((e,t)=>t!==l))})]},o.key)),(0,C.jsxs)(u.Row,{gap:6,children:[(0,C.jsx)(u.Button,{small:!0,kind:"secondary",label:"Money figure",onPress:()=>a(e,[...t[e],{key:`f${Date.now().toString(36)}`,label:'New figure',kind:'money'}])}),(0,C.jsx)(u.Button,{small:!0,kind:"secondary",label:"Number",onPress:()=>a(e,[...t[e],{key:`n${Date.now().toString(36)}`,label:'New number',kind:'number'}])})]})]});return(0,C.jsxs)(d.default,{testID:"cashup-settings",style:{gap:12},children:[(0,C.jsx)(u.Muted,{children:"Tip: match these to the boxes on your paper cash up sheet and till printout. Cash tips total and Card tips total are needed for Today\u2019s tips and the Tips pot."}),o('cashFields','Cash up sheet'),o('salesFields','Weekly sales report')]})},_e.TipsSettings=function({rid:e}){const t=(0,p.useTipsShow)(e);return(0,C.jsxs)(d.default,{testID:"tips-settings",style:{gap:8},children:[(0,C.jsx)(u.Muted,{children:"Staff only ever see the team total: never anyone\u2019s share or pay. The Display never shows tips or money."}),(0,C.jsx)(u.Toggle,{testID:"tips-show-today",label:"Show Today\u2019s tips in the staff apps",value:t.showToday,onChange:t=>p.useCashUp.getState().setShow(e,{showToday:t})}),(0,C.jsx)(u.Toggle,{testID:"tips-show-pot",label:"Show the Tips pot in the staff apps",value:t.showPot,onChange:t=>p.useCashUp.getState().setShow(e,{showPot:t})})]})};var t=_r(_d[0]),s=_r(_d[1]),a=_r(_d[2]),o=e(_r(_d[3])),l=e(_r(_d[4])),n=e(_r(_d[5])),r=e(_r(_d[6])),i=e(_r(_d[7])),d=e(_r(_d[8])),h=e(_r(_d[9])),u=_r(_d[10]),c=_r(_d[11]),p=_r(_d[12]),y=_r(_d[13]),m=_r(_d[14]),f=_r(_d[15]),x=_r(_d[16]),k=_r(_d[17]),j=_r(_d[18]),b=_r(_d[19]),w=_r(_d[20]),C=_r(_d[21]);const T=e=>null==e?'\u2014':`\xa3${e.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`,v=e=>new Date(`${e}T12:00:00Z`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'UTC'});function S(e){const t=t=>'number'==typeof e[t]?e[t]:null,s=(0,y.combinedTips)(e);return[['Gross',t('gross')],['card',t('card')],['cash',t('cash')],['tips',s],['food',t('food')],['drink',t('drink')]].filter(([,e])=>null!=e).map(([e,t])=>`${e} ${T(t)}`).join(', ')}function D({p:e,h:s}){const[o,l]=(0,a.useState)(e.startsWith('data:')?e:null);return(0,a.useEffect)(()=>{o||(0,k.photoUrl)(e).then(l)},[e]),o?(0,C.jsx)(r.default,{source:{uri:o},style:{width:'100%',height:s,borderRadius:10,backgroundColor:(0,t.soutersSurface)('#111')},resizeMode:"contain"}):(0,C.jsx)(d.default,{style:{height:s,borderRadius:10,backgroundColor:(0,t.soutersSurface)('#1B1A18'),alignItems:'center',justifyContent:'center'},children:(0,C.jsx)(u.Muted,{children:"Photo"})})}function I({draft:e,fields:t,onClose:o,onConfirm:l,keyLabel:n,onKey:r,keyChoices:i}){const{width:p,height:m}=(0,h.default)(),f=p>=820;e.only&&(t=t.filter(t=>e.only.includes(t.key)));const[x,k]=(0,a.useState)(()=>Object.fromEntries(t.map(t=>[t.key,(0,y.isBlank)(e.vals[t.key])?'':String(e.vals[t.key])]))),[j,b]=(0,a.useState)(()=>e.categories.map(e=>({name:e.name,amount:String(e.amount)}))),[w,T]=(0,a.useState)(!1),v=Object.fromEntries(t.map(e=>[e.key,'text'===e.kind?x[e.key]?.trim()||null:(0,y.parseAmount)(x[e.key]??'',e.kind)])),S=t.filter(e=>'text'!==e.kind&&(x[e.key]??'').trim()&&null==v[e.key]).map(e=>e.key),I=(0,y.missing)(t,v),P=j.map(e=>({name:e.name.trim(),amount:(0,y.parseAmount)(e.amount)})).filter(e=>e.name),M=P.some(e=>null==e.amount),$=e=>({minHeight:42,borderRadius:10,borderWidth:e?2:1,borderColor:e?c.colours.amber:'rgba(255,255,255,0.15)',backgroundColor:e?'rgba(232,168,56,0.08)':'#141312',color:c.colours.text,paddingHorizontal:10,fontSize:17}),B=(0,C.jsx)(d.default,{testID:"review-photos",style:{gap:8,flex:f?1:void 0},children:e.photos.length?e.photos.map((t,s)=>(0,C.jsx)(D,{p:t,h:f?Math.max(300,.62*m/Math.min(2,e.photos.length)):260},s)):(0,C.jsx)(u.Muted,{children:"No photo: typed by hand."})}),R=(0,C.jsxs)(d.default,{testID:"review-fields",style:{gap:8,flex:f?1:void 0},children:[(0,C.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,C.jsx)(u.Muted,{children:n}),i.map(t=>(0,C.jsx)(u.Chip,{label:t.label,selected:e.key===t.value,onPress:()=>r(t.value)},t.value))]}),t.map(e=>{const t='text'!==e.kind&&!(x[e.key]??'').trim()||S.includes(e.key);return(0,C.jsxs)(d.default,{style:{gap:3},children:[(0,C.jsxs)(u.Row,{gap:6,children:[(0,C.jsx)(u.T,{weight:"semibold",size:14,children:e.label}),t&&'text'!==e.kind?(0,C.jsx)(u.Badge,{kind:"amber",label:S.includes(e.key)?'Check this':'Not read: type it'}):null]}),(0,C.jsx)(s.TextInput,{testID:`review-${e.key}`,value:x[e.key]??'',onChangeText:t=>k(s=>({...s,[e.key]:t})),keyboardType:'text'===e.kind?'default':'decimal-pad',placeholder:'money'===e.kind?'\xa3':'number'===e.kind?'Number':'Optional',placeholderTextColor:"#777",style:$(t)})]},e.key)}),'sales'===e.kind?(0,C.jsxs)(d.default,{testID:"review-categories",style:{gap:6},children:[(0,C.jsx)(u.T,{weight:"semibold",size:14,children:"Sales by category (if the printout has them)"}),j.map((e,t)=>(0,C.jsxs)(u.Row,{gap:6,children:[(0,C.jsx)(s.TextInput,{value:e.name,onChangeText:e=>b(s=>s.map((s,a)=>a===t?{...s,name:e}:s)),placeholder:"e.g. Food",placeholderTextColor:"#777",style:[$(!1),{flex:2}]}),(0,C.jsx)(s.TextInput,{value:e.amount,onChangeText:e=>b(s=>s.map((s,a)=>a===t?{...s,amount:e}:s)),placeholder:"\xa3",placeholderTextColor:"#777",keyboardType:"decimal-pad",style:[$(!e.amount.trim()||null==(0,y.parseAmount)(e.amount)),{flex:1}]}),(0,C.jsx)(u.Button,{small:!0,kind:"ghost",label:"\u2715",accessibilityLabel:"Remove category",onPress:()=>b(e=>e.filter((e,s)=>s!==t))})]},t)),(0,C.jsx)(u.Button,{small:!0,kind:"secondary",testID:"review-add-cat",label:"Add a category",onPress:()=>b(e=>[...e,{name:'',amount:''}])})]}):null]});return(0,C.jsxs)(u.Sheet,{visible:!0,onClose:o,title:'cashup'===e.kind?'Check the cash up':'Check the weekly sales',maxWidth:1100,testID:"review-sheet",children:[(0,C.jsx)(u.Muted,{children:"Tip: check each figure against the photo. Nothing is saved until you tap Confirm. Amber boxes weren\u2019t read: type them, or leave them blank if the sheet doesn\u2019t have them."}),'edit'===e.reader||e.only?null:e.reader?(0,C.jsx)(u.Banner,{kind:"info",title:"Read from the photo",children:e.note}):e.photos.length?(0,C.jsx)(u.Banner,{kind:"info",title:"Type it from the photo",children:e.note}):null,f?(0,C.jsxs)(d.default,{style:{flexDirection:'row',gap:14},children:[B,R]}):(0,C.jsxs)(C.Fragment,{children:[B,R]}),I.length?(0,C.jsxs)(u.Muted,{children:[I.length," figure",1===I.length?'':'s'," still blank. Blank means \u201cnot on the sheet\u201d, never zero."]}):null,(0,C.jsxs)(u.Row,{gap:8,children:[(0,C.jsx)(u.Button,{testID:"review-confirm",label:w?'Saving\u2026':'Confirm and save',disabled:w||!!S.length||M||!t.some(e=>'text'!==e.kind&&null!=v[e.key]),onPress:async()=>{T(!0),await l(v,P.map(e=>({name:e.name,amount:e.amount}))),T(!1)}}),(0,C.jsx)(u.Button,{kind:"secondary",label:"Cancel",onPress:o})]})]})}function P({data:e,height:t=140,testID:s,fmt:a=T}){const o=Math.max(1,...e.map(e=>e.value??0));return(0,C.jsxs)(d.default,{testID:s,style:{gap:4},children:[(0,C.jsx)(d.default,{style:{flexDirection:'row',alignItems:'flex-end',gap:4,height:t},children:e.map((e,s)=>(0,C.jsxs)(d.default,{style:{flex:1,alignItems:'center',justifyContent:'flex-end',height:t},children:[null!=e.value?(0,C.jsx)(u.T,{size:9,colour:c.colours.muted,children:a(e.value).replace('.00','')}):null,(0,C.jsx)(d.default,{style:{width:'80%',height:null==e.value?2:Math.max(3,e.value/o*(t-16)),borderRadius:4,backgroundColor:null==e.value?'#333':e.hi?c.colours.goldLight:c.colours.gold,opacity:null==e.value?.6:1}})]},s))}),(0,C.jsx)(d.default,{style:{flexDirection:'row',gap:4},children:e.map((e,t)=>(0,C.jsx)(u.T,{size:9,colour:c.colours.muted,style:{flex:1,textAlign:'center'},children:e.label},t))})]})}function M({rid:e,today:s}){const a=(0,p.useCashUp)(e=>e.cashUps).filter(t=>t.rid===e),o=(0,p.useCashUp)(e=>e.sales).filter(t=>t.rid===e),l=(0,y.dailySeries)(a,s,14),n=(0,y.dailySeries)(a,s,14,y.combinedTips),r=(0,y.weekStartOf)(s),i=Array.from({length:8},(e,t)=>(0,y.addDaysYmd)(r,7*(t-7))).map(e=>{const t=o.find(t=>t.weekStart===e&&t.confirmedAt),s=t?.vals.net;return{label:v(e).split(' ').slice(1).join(' '),value:'number'==typeof s?s:null,hi:e===r}}),h=[...o].filter(e=>e.confirmedAt).sort((e,t)=>t.weekStart.localeCompare(e.weekStart))[0],m=h?(0,y.weekCompare)(o,h.weekStart):null,f=h?.categories??[],x=Math.max(1,...f.map(e=>e.amount)),k=h?(0,y.weekCompare)(o,h.weekStart,'covers'):null;return(0,C.jsxs)(d.default,{testID:"cash-charts",style:{gap:12},children:[(0,C.jsxs)(u.Card,{children:[(0,C.jsx)(u.T,{weight:"semibold",children:"Takings, last 14 days"}),(0,C.jsx)(u.Muted,{children:"Card + cash from confirmed cash ups. A grey line means no cash up that day."}),(0,C.jsx)(P,{testID:"chart-daily",data:l.map(e=>({label:v(e.date).split(' ')[1],value:e.value,hi:e.date===s}))})]}),(0,C.jsxs)(u.Card,{children:[(0,C.jsx)(u.T,{weight:"semibold",children:"Tips, last 14 days"}),(0,C.jsx)(u.Muted,{children:"Cash + card tips, team total."}),(0,C.jsx)(P,{testID:"chart-tips",height:100,data:n.map(e=>({label:v(e.date).split(' ')[1],value:e.value,hi:e.date===s}))})]}),(0,C.jsxs)(u.Card,{children:[(0,C.jsx)(u.T,{weight:"semibold",children:"Weekly net sales"}),m&&null!=m.now?(0,C.jsx)(d.default,{testID:"week-compare",children:(0,C.jsxs)(u.T,{size:15,children:["Week of ",v(h.weekStart),": ",T(m.now),null!=m.prev?` \xb7 week before ${T(m.prev)}`:'',null!=m.change?` \xb7 ${m.change>=0?'\u25b2':'\u25bc'} ${Math.abs(m.change)}%`:'']})}):(0,C.jsx)(u.Muted,{children:"No weekly sales report yet."}),k&&null!=k.now?(0,C.jsxs)(u.Muted,{children:["Covers ",k.now,null!=k.prev?` (week before ${k.prev})`:'']}):null,(0,C.jsx)(P,{testID:"chart-weekly",data:i})]}),f.length?(0,C.jsxs)(u.Card,{children:[(0,C.jsxs)(u.T,{weight:"semibold",children:["By category, week of ",v(h.weekStart)]}),(0,C.jsx)(d.default,{testID:"chart-categories",style:{gap:6},children:f.map(e=>(0,C.jsxs)(d.default,{style:{gap:2},children:[(0,C.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsx)(u.T,{size:14,children:e.name}),(0,C.jsx)(u.T,{size:14,colour:c.colours.goldLight,children:T(e.amount)})]}),(0,C.jsx)(d.default,{style:{height:10,borderRadius:5,backgroundColor:(0,t.soutersSurface)('#2A2826')},children:(0,C.jsx)(d.default,{style:{width:e.amount/x*100+"%",height:10,borderRadius:5,backgroundColor:c.colours.gold}})})]},e.name))})]}):null]})}function $({n:e,testID:t}){const s=Math.max(1,Math.min(14,e));return(0,C.jsx)(d.default,{testID:t,style:{width:64,height:114,justifyContent:'flex-end'},children:Array.from({length:s}).map((e,t)=>(0,C.jsx)(B,{delay:50*t},t))})}function B({delay:e}){const t=(0,a.useRef)(new l.default.Value(1)).current;return(0,a.useEffect)(()=>{l.default.timing(t,{toValue:0,duration:420,delay:e,easing:n.default.out(n.default.back(1.6)),useNativeDriver:!1}).start()},[]),(0,C.jsx)(l.default.View,{style:{height:7,transform:[{translateY:t.interpolate({inputRange:[0,1],outputRange:[0,-120]})}],opacity:t.interpolate({inputRange:[0,1],outputRange:[1,0]})},children:(0,C.jsx)(d.default,{style:{width:60,height:12,borderRadius:30,backgroundColor:c.colours.gold,borderWidth:1,borderColor:c.colours.goldLight}})})}function R(e){const[t,s]=(0,a.useState)(e),o=(0,a.useRef)(e);return(0,a.useEffect)(()=>{const t=o.current,a=e;if(t===a)return;const l=Date.now(),n=setInterval(()=>{const e=Math.min(1,(Date.now()-l)/1200);s(Math.round(100*(t+(a-t)*(1-Math.pow(1-e,3))))/100),e>=1&&(clearInterval(n),o.current=a)},40);return()=>clearInterval(n)},[e]),t}function U({rid:e,today:t,manage:s,who:o,big:l}){const n=(0,p.useTipsShow)(e),r=(0,p.useCashUp)(e=>e.tips).filter(t=>t.rid===e),i=(0,p.useCashUp)(e=>e.pot).filter(t=>t.rid===e),h=(0,f.useVenuePay)(e).pay,x=(0,m.tipsPeriod)(h,t),k=(0,a.useMemo)(()=>(0,y.tipsPot)(r,i,x.start,t),[r,i,x.start,t]),j=R(k.total),[b,w]=(0,a.useState)(null);return n.showPot||s?(0,C.jsxs)(u.Card,{highlight:c.colours.gold,children:[(0,C.jsxs)(d.default,{testID:"tips-pot",style:{flexDirection:'row',alignItems:'center',gap:14},children:[(0,C.jsx)($,{n:Math.ceil(k.total/100),testID:"tips-pot-coins"},k.total),(0,C.jsxs)(d.default,{style:{flex:1,gap:2},children:[(0,C.jsx)(u.T,{size:12,weight:"semibold",colour:c.colours.gold,style:{letterSpacing:1.5},children:"TIPS POT"}),(0,C.jsx)(u.T,{size:l?40:32,weight:"bold",colour:c.colours.goldLight,children:T(j)}),(0,C.jsxs)(u.Muted,{children:["Tips held for the team since ",v(k.from),x.payday?` \xb7 next tip payday ${v(x.payday)}`:'',". Confirmed cash ups only.",n.showPot?'':' (Hidden from staff.)']})]})]}),s?(0,C.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,C.jsx)(u.Button,{small:!0,kind:"secondary",testID:"pot-payout",label:"Mark payout done",onPress:()=>w('payout')}),(0,C.jsx)(u.Button,{small:!0,kind:"ghost",testID:"pot-correct",label:"Correct an entry",onPress:()=>w('correct')}),(0,C.jsx)(u.Button,{small:!0,kind:"ghost",testID:"pot-history",label:"Past pots",onPress:()=>w('history')})]}):null,'payout'===b?(0,C.jsxs)(u.Sheet,{visible:!0,onClose:()=>w(null),title:"Mark payout done",maxWidth:520,testID:"pot-payout-sheet",children:[(0,C.jsxs)(u.T,{children:["Pay out ",T(k.total)," (tips from ",v(k.from)," to ",v(t),")?"]}),(0,C.jsx)(u.Muted,{children:"The pot goes back to \xa30.00 for the next period. This is logged and kept in Past pots. No money is moved by the app."}),(0,C.jsx)(u.Button,{testID:"pot-payout-confirm",label:"Yes, payout done",onPress:()=>{p.useCashUp.getState().addPotEvent({rid:e,kind:'payout',throughDate:t,amount:k.total,by:o?.name??'Manager'}),w(null)}})]}):null,'correct'===b?(0,C.jsx)(L,{rid:e,today:t,who:o,onClose:()=>w(null)}):null,'history'===b?(0,C.jsxs)(u.Sheet,{visible:!0,onClose:()=>w(null),title:"Past pots and corrections",maxWidth:560,testID:"pot-history-sheet",children:[k.history.length||i.some(e=>'correction'===e.kind)?null:(0,C.jsx)(u.Muted,{children:"No payouts or corrections yet."}),i.slice().sort((e,t)=>t.at.localeCompare(e.at)).map(e=>(0,C.jsxs)(d.default,{style:{paddingVertical:4},children:[(0,C.jsx)(u.T,{weight:"semibold",children:'payout'===e.kind?`Paid out ${T(e.amount)}`:`Correction ${e.amount>=0?'+':'\u2212'}${T(Math.abs(e.amount))} for ${v(e.forDate)}`}),(0,C.jsxs)(u.Muted,{children:['payout'===e.kind?`Tips to ${v(e.throughDate)}`:`\u201c${e.reason}\u201d`," \xb7 ",e.by," \xb7 ",new Date(e.at).toLocaleString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})]})]},e.id))]}):null]}):null}function L({rid:e,today:o,who:l,onClose:n}){const[r,i]=(0,a.useState)(o),[d,h]=(0,a.useState)(''),[m,f]=(0,a.useState)(''),x=(0,y.parseAmount)(d),k={minHeight:42,borderRadius:10,borderWidth:1,borderColor:'rgba(255,255,255,0.15)',backgroundColor:(0,t.soutersSurface)('#141312'),color:c.colours.text,paddingHorizontal:10,fontSize:16};return(0,C.jsxs)(u.Sheet,{visible:!0,onClose:n,title:"Correct an entry",maxWidth:520,testID:"pot-correct-sheet",children:[(0,C.jsx)(u.Muted,{children:"Tip: add or take off an amount for a day (use a minus for less, e.g. -5). Every correction is logged with your name and the reason."}),(0,C.jsx)(u.Row,{wrap:!0,gap:6,children:[0,1,2,3].map(e=>{const t=(0,y.addDaysYmd)(o,-e);return(0,C.jsx)(u.Chip,{label:0===e?'Today':v(t),selected:r===t,onPress:()=>i(t)},t)})}),(0,C.jsx)(s.TextInput,{testID:"pot-correct-amount",value:d,onChangeText:h,placeholder:"\xa3 e.g. -5.00",placeholderTextColor:"#777",keyboardType:"numbers-and-punctuation",style:k}),(0,C.jsx)(s.TextInput,{testID:"pot-correct-reason",value:m,onChangeText:f,placeholder:"Reason (required)",placeholderTextColor:"#777",maxLength:200,style:k}),(0,C.jsx)(u.Button,{testID:"pot-correct-save",label:"Save correction",disabled:null==x||0===x||!m.trim(),onPress:()=>{p.useCashUp.getState().addPotEvent({rid:e,kind:'correction',forDate:r,amount:x,reason:m.trim(),by:l?.name??'Manager'}),n()}})]})}},949,[878,874,30,118,120,224,196,263,127,287,813,821,983,984,1023,1288,1041,1293,1297,1298,1301,24]); +__d(function(g,_r,i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.shiftNow=l,e.useShiftReminders=function({rid:c,staffId:k,name:h,kitchen:b,onStartBreak:S}){const D=(0,t.useRef)(S);D.current=S;const I=(0,t.useRef)(h);I.current=h;const v=(0,s.useReminders)(t=>`${t.reminders.length}:${t.done.length}:${JSON.stringify(t.rules[c]??{})}:${t.reminders.map(t=>t.updatedAt??'').join()}`),w=(0,r.useOwner)(t=>`${t.attendance.length}:${t.shifts.length}`);(0,t.useEffect)(()=>{s.useReminders.getState().ensure(c);const t=()=>{const t=u(),{att:h,shift:S,on:v}=l(k,t),w=s.useReminders.getState();if(!v||!k)return w.reminders.forEach(t=>(0,a.dismissNotice)(`rem:${t.id}`)),void(0,a.dismissNotice)('break-reminder');const R=(0,s.rulesOf)(c),$=h?.in?new Date(h.in).getTime():void 0,p=!!h?.breaks?.length,y=`break:${h?.id??S?.id??''}`,M=(0,o.breakDue)({now:t,clockIn:$,shiftStart:S?m(S.date,S.start):void 0,shiftEnd:S?m(S.date,S.end):void 0,rotaBreak:void 0!==S?.breakAt?m(S.date,S.breakAt):void 0,hadBreak:p,rules:R},w.snooze[y]??0);if(M){const r=$??(S?m(S.date,S.start):t);(0,a.notify)({id:'break-reminder',tone:3===M.stage?'warn':'normal',icon:'\ud83e\uded6',kicker:'BREAK REMINDER',testID:'break-reminder',timeoutMs:null,title:M.label,body:`${$?'Clocked in':'Shift started'} at ${f(r)}. ${3===M.stage?'':'Over 6 hours needs a 20-minute break.'}`.trim(),actions:[{label:'Start break',testID:'break-reminder-start',onPress:()=>{if(!h)return D.current?.(),void(0,a.notify)({id:'break-clock-first',title:'Clock in first, then tap Start break.',body:'Your break is started from the clock screen.',timeoutMs:6e3});const t=new Date(u()).toISOString();(0,n.clockAction)('break_start',{rid:c,staffId:k,date:t.slice(0,10),at:t}).then(t=>{t.ok||(0,a.notify)({id:'break-blocked',tone:'warn',title:'Break not started',body:t.message,timeoutMs:1e4}),D.current?.()})}},{label:'Later',kind:'ghost',testID:'break-reminder-later',onPress:()=>s.useReminders.getState().setSnooze(y,u()+6e4*R.snoozeMins)}]})}else(0,a.dismissNotice)('break-reminder');const N=r.useOwner.getState().staff.find(t=>t.id===k),O=b??(0,d.inKitchen)(N);for(const n of w.reminders){if(n.rid!==c)continue;const r=`rem:${n.id}`;if(n.removed||!(0,o.audienceMatch)(n.audience,O)){(0,a.dismissNotice)(r);continue}const{due:d,forDate:f}=(0,o.reminderDue)(n,t),m=w.done.find(t=>t.reminderId===n.id&&t.forDate===f),l=`rem:${n.id}:${f}`;!d||m||(w.snooze[l]??0)>t?(0,a.dismissNotice)(r):(0,a.notify)({id:r,icon:'\ud83e\ude91',kicker:'REMINDER',title:n.text,testID:'venue-reminder',timeoutMs:null,body:`For everyone on shift${'all'===n.audience?'':'kitchen'===n.audience?' in the kitchen':' front of house'}. Tap Done once it\u2019s done.`,actions:[{label:'Done',testID:'venue-reminder-done',onPress:()=>s.useReminders.getState().markDone({rid:c,reminderId:n.id,forDate:f,at:new Date(u()).toISOString(),staffRef:k,staffName:I.current.replace(' (example)','')})},{label:'Later',kind:'ghost',onPress:()=>s.useReminders.getState().setSnooze(l,u()+6e4*R.snoozeMins)}]})}};t();const h=setInterval(t,2e4);return()=>clearInterval(h)},[c,k,v,w,b])};var t=_r(_d[0]),n=_r(_d[1]),r=_r(_d[2]),s=_r(_d[3]),o=_r(_d[4]),a=_r(_d[5]),d=_r(_d[6]),c=_r(_d[7]);const u=()=>{try{return(0,c.nowFrom)(c.useStore.getState().clock).getTime()}catch{return Date.now()}},f=t=>new Date(t).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}),m=(t,n)=>{const[r,s,o]=t.split('-').map(Number);return new Date(r,s-1,o,Math.floor(n),Math.round(n%1*60)).getTime()};function l(t,n){const s=r.useOwner.getState(),a=(0,r.openShiftOf)(s.attendance,t,new Date(n)),d=(0,o.ukClock)(n).ymd,c=s.shifts.find(r=>r.staffId===t&&r.date===d&&!1!==r.published&&m(r.date,r.start)<=n&&nn.staffId===t&&n.date===d&&!1!==n.published):void 0),u=!a&&!!c&&s.attendance.some(n=>n.staffId===t&&n.date===d&&!!n.out&&new Date(n.out).getTime()>=m(c.date,c.start));return{att:a,shift:c,on:!!a||!!c&&!u}}},950,[30,1302,854,994,995,1041,1223,870]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.SeatAllergenReminder=function({rid:c}){const u=(0,n.useRef)(new Set);return(0,n.useEffect)(()=>s.useStore.subscribe((n,s)=>{if(n.bookings===s.bookings)return;const h=new Map(s.bookings.map(t=>[t.id,t.status]));for(const s of n.bookings){if(s.restaurantId!==c||'seated'!==s.status||!(0,l.hasAllergens)(s)||u.current.has(s.id))continue;const n=h.get(s.id);n&&'seated'!==n&&(u.current.add(s.id),(0,o.notify)({id:`seat-allergen:${s.id}`,tone:'urgent',testID:'seat-allergen-reminder',icon:'\u26a0\ufe0f',kicker:'RE-CONFIRM ALLERGENS AT THE TABLE',title:`${s.name} \xb7 ${s.partySize} covers${s.table?` \xb7 ${(0,t.tableNumbers)(s.table)}`:''}`,body:`${(0,l.allergenText)(s)}. Before taking the order, check the allergens with the guests again and tell the kitchen about any change.`,actions:[{label:'Done, re-confirmed with the guests',testID:'seat-allergen-ok'}]}))}}),[c]),null},e.useKitchenTodoChime=function(t,u,h){const f=(0,s.useStore)(n=>n.bookings.filter(n=>n.restaurantId===t&&n.date>=u&&!n.walkIn&&((0,l.needsAllergenSeen)(n)||(0,l.needsHoldOk)(n))).map(t=>t.id).sort().join(',')),k=f?f.split(',').length:0,b=(0,n.useRef)(null);return(0,n.useEffect)(()=>{const t=s.useStore.getState().bookings.filter(t=>f.split(',').includes(t.id)),n=b.current;if(b.current=t.map(t=>t.id),null===n)return;const k=t.filter(t=>!n.includes(t.id));if(k.length){(0,c.soundAllowed)()&&(0,c.chime)('bright');for(const t of k){const n=(0,l.needsAllergenSeen)(t);(0,o.notify)({id:`kitchen-todo:${t.id}`,tone:n?'urgent':'warn',testID:'kitchen-todo-notice',icon:n?'\u26a0\ufe0f':'\ud83c\udf7d\ufe0f',kicker:n?'ALLERGENS TO SIGN OFF':'PLATTER TO SIGN OFF',title:`${t.name} \xb7 ${t.partySize} covers \xb7 ${t.date===u?'today':t.date} ${t.time}`,body:n?`${(0,l.allergenText)(t)}. Tap Allergens seen on the booking once the kitchen has read it.`:'A platter is booked. Tap Platter OK on the booking once the kitchen can do it.',actions:[...h?[{label:'Open bookings',onPress:h}]:[],{label:'Later',kind:'ghost'}]})}}},[f]),k};var t=r(d[0]),n=r(d[1]),o=r(d[2]),s=r(d[3]),l=r(d[4]),c=r(d[5])},951,[808,30,1041,819,828,1012]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Bookings=function(){const{rid:e,r:j,now:z,today:G,me:U,role:H}=(0,u.useCtx)(1e4),q=(0,B.useBookings)(e),F=(0,u.useInStaffApp)(),K=(0,u.useShiftManager)(),V=(0,B.useWaitlist)(e),[Q,Y]=((0,B.useStore)(e=>e.alertAcks),(0,f.useState)(G)),J=(0,L.useFrontDoor)(Q),[X,Z]=(0,f.useState)(''),[ee,se]=(0,f.useState)(2),te=Qe.date===Q).sort((e,s)=>e.time.localeCompare(s.time)),le=V.filter(e=>'waiting'===e.status||'notified'===e.status).sort((e,s)=>e.number-s.number),ie=ne.filter(e=>'noshow'===e.status),ae=(0,A.useSync)(e=>!!e.venueId&&'guest'!==e.kind),oe=ne.filter(e=>'cancelled'!==e.status).reduce((e,s)=>e+s.partySize,0),de=ne.filter(e=>!e.walkIn),re=ne.filter(e=>e.walkIn),ue=q.filter(e=>'pending'===e.status&&e.date>=G).sort((e,s)=>(e.date+e.time).localeCompare(s.date+s.time)),[ce,he]=(0,f.useState)(null);return(0,E.jsxs)(y.default,{style:{gap:12},children:[s.IS_WILDINGS||(s.IS_QUEUED_VENUE||s.IS_KIRKTON||s.IS_GREENSIDE||'abbotsford'===e)&&!F&&'staff'!==H?(0,E.jsx)(l.VenueRequestList,{rid:e,kind:"table"}):null,!s.IS_WILDINGS&&!j.settings.hotel?.enabled||F||'staff'===H?null:(0,E.jsx)(l.VenueRequestList,{rid:e,kind:"room",hotel:j.settings.hotel??n.WILDINGS_HOTEL}),(0,E.jsx)(M.BookingsDayNav,{today:G,date:Q,onDate:Y,count:e=>q.filter(s=>s.date===e&&'cancelled'!==s.status).length,sub:e=>{const s=q.filter(s=>s.date===e&&'cancelled'!==s.status&&!s.walkIn),t=s.reduce((e,s)=>e+s.partySize,0);return`${s.length} ${1===s.length?'table':'tables'} \xb7 ${t} ${1===t?'cover':'covers'}`}}),te?(0,E.jsxs)(y.default,{testID:"bookings-past-totals",style:[I.styles.card,{gap:4}],accessible:!0,accessibilityLabel:`${(0,M.longDay)(Q)}: ${de.length} tables, ${oe} covers, ${ne.filter(e=>'finished'===e.status).length} finished, ${ie.length} no-shows, ${ne.filter(e=>'cancelled'===e.status).length} cancelled`,children:[(0,E.jsxs)(I.T,{size:17,weight:"semibold",children:["That day: ",de.length," table",1===de.length?'':'s',re.length?` \xb7 ${re.length} walk-in${1===re.length?'':'s'}`:''," \xb7 ",oe," cover",1===oe?'':'s']}),(0,E.jsxs)(I.T,{size:16,colour:T.colours.text,children:[ne.filter(e=>'finished'===e.status).length," finished \xb7 ",ie.length," no-show",1===ie.length?'':'s'," \xb7 ",ne.filter(e=>'cancelled'===e.status).length," cancelled"]}),(0,E.jsx)(I.Muted,{children:"Looking back: read-only. Undo is still there for a mistake made today."})]}):null,(0,E.jsx)(y.default,{testID:"bookings-summary",children:(0,E.jsxs)(I.T,{weight:"semibold",children:[de.length," table",1===de.length?'':'s'," booked",re.length?` \xb7 ${re.length} walk-in${1===re.length?'':'s'}`:''," \xb7 ",oe," cover",1===oe?'':'s']})}),(0,E.jsxs)(y.default,{testID:"bookings-actions",style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[te?null:(0,E.jsx)(p.QuietButton,{label:"New booking",onPress:J.openBooking,testID:"add-booking"}),F&&K&&Q===G?(0,E.jsx)(p.QuietButton,{label:"Walk-in",onPress:J.openWalkIn,testID:"add-walkin"}):null,Q===G?(0,E.jsx)(k.CloseGardenButton,{quiet:!0,short:!0,rid:e,r:j,now:z,by:U}):null]}),ue.length?(0,E.jsxs)(y.default,{testID:"pending-requests",style:[I.styles.card,{borderColor:T.colours.amber,gap:8}],children:[(0,E.jsxs)(I.T,{weight:"semibold",colour:T.colours.amber,children:["Needs confirming (",ue.length,")"]}),(0,E.jsx)(I.Muted,{children:"Online requests outside your auto-accept rules. Confirming sends the guest their confirmation (preview mode)."}),ue.map(s=>(0,E.jsxs)(y.default,{style:{gap:6,paddingTop:6,borderTopWidth:1,borderColor:T.colours.border},children:[(0,E.jsxs)(I.T,{weight:"semibold",children:[s.name," \xb7 ",s.partySize," cover",1===s.partySize?'':'s']}),(0,E.jsxs)(I.Muted,{children:[(0,S.niceDate)((0,S.parseYmd)(s.date))," at ",s.time," \xb7 ",s.ref," \xb7 ",s.phone??'no phone']}),s.notes?(0,E.jsxs)(I.T,{size:16,children:["Notes: ",s.notes]}):null,s.allergies.length?(0,E.jsx)(I.Row,{wrap:!0,gap:4,children:s.allergies.map(e=>(0,E.jsx)(I.Badge,{kind:"red",label:`${(0,$.allergenLabel)(e.allergen)} \xb7 ${(0,$.severityLabel)(e.severity)}`},e.allergen))}):null,(0,E.jsx)(x.NeedsPills,{b:s,r:j}),'staff'!==H&&((0,w.needsHoldOk)(s)||s.date===G&&s.holdOk&&(s.holds??[]).some(e=>!e.served)&&'seated'===s.status)?(0,E.jsxs)(I.Row,{wrap:!0,gap:6,children:[(0,w.needsHoldOk)(s)?(0,E.jsx)(I.Button,{small:!0,kind:"success",label:"Platter OK",testID:`mgr-platter-ok-${s.ref}`,onPress:()=>(0,x.confirmHolds)(s.id,U)}):null,s.holdOk&&'seated'===s.status?(0,E.jsx)(I.Button,{small:!0,kind:"secondary",label:"Platter served",onPress:()=>(0,x.serveHolds)(s,U,'owner')}):null]}):null,ce===s.id?(0,E.jsxs)(y.default,{style:{gap:6},children:[(0,E.jsxs)(I.T,{size:14,children:["Are you sure? ",s.name.split(' ')[0]," will get a polite \u201csorry, we can\u2019t fit you in\u201d message."]}),(0,E.jsxs)(I.Row,{gap:6,children:[(0,E.jsx)(I.Button,{small:!0,kind:"danger",label:"Yes, decline",onPress:()=>{B.repo.bookings.decide(s.id,'declined',U),he(null)}}),(0,E.jsx)(I.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>he(null)})]})]}):(0,E.jsxs)(I.Row,{gap:6,children:[(0,E.jsx)(I.Button,{small:!0,label:"Confirm",testID:`confirm-${s.ref}`,onPress:()=>B.repo.bookings.decide(s.id,'confirmed',U)}),(0,E.jsx)(I.Button,{small:!0,kind:"secondary",label:"Decline",onPress:()=>he(s.id)}),(0,E.jsx)(_.WhatsAppGuest,{b:s,rid:e,kind:"change"})]}),(0,E.jsx)(R.ConfirmTimeline,{refId:s.id})]},s.id))]}):null,0===ne.length?(0,E.jsx)(I.Muted,{children:"No bookings for this day yet."}):null,ne.map(s=>{const t='confirmed'===s.status&&Q===G&&(0,S.minsBetween)(new Date(`${s.date}T${s.time}:00`),z)>15,n=(0,h.depositState)(s),l=(0,h.depositBadge)(s,D.gbp);return(0,E.jsxs)(y.default,{style:[I.styles.card,{borderColor:(0,w.hasAllergens)(s)?T.colours.red:t?T.colours.amber:T.colours.hairline,opacity:['finished','cancelled'].includes(s.status)?.55:1}],children:[(0,E.jsx)(x.AllergenBar,{b:s}),(0,E.jsxs)(I.Row,{style:{justifyContent:'space-between'},children:[(0,E.jsxs)(I.T,{weight:"semibold",children:[s.time," \xb7 ",(0,L.walkInLabel)(s)]}),(0,E.jsx)(I.Badge,{kind:'seated'===s.status?'ok':'noshow'===s.status?'red':'confirmed'===s.status?'gold':'pending'===s.status?'amber':'neutral',label:'noshow'===s.status?'No-show':'pending'===s.status?'Needs confirming':s.status[0].toUpperCase()+s.status.slice(1)})]}),l?(0,E.jsx)(c.DepositChip,{b:s,money:!0,big:!0,testID:`deposit-chip-${s.id}`}):null,(0,E.jsxs)(I.Muted,{children:[s.table?(0,v.tablesLabel)(s.table):s.walkIn?'Table to assign':'Table TBC'," \xb7 ",s.ref]}),s.notes?(0,E.jsxs)(I.T,{size:16,testID:`booking-notes-${s.id}`,children:["Notes: ",s.notes]}):null,l?(0,E.jsxs)(I.Row,{wrap:!0,gap:6,style:{alignItems:'center'},children:[te||!(0,h.canTickDeposit)(s)||['cancelled','finished'].includes(s.status)?null:(0,E.jsx)(I.Button,{small:!0,kind:"secondary",label:"Mark deposit paid",testID:`deposit-paid-${s.id}`,accessibilityLabel:`Mark deposit paid for ${(0,L.walkInLabel)(s)}`,onPress:()=>B.repo.bookings.update(s.id,{depositPaid:s.depositDue??0,depositPaidBy:U,depositPaidAt:(new Date).toISOString()})}),te?null:(0,E.jsx)(b.WixDepositLink,{b:s,rid:e}),'paid'===n&&s.depositPaidBy?(0,E.jsx)(I.Muted,{size:13,children:'Wix deposit link'===s.depositPaidBy?'Paid through a website bookings deposit link':`Ticked by ${s.depositPaidBy}`}):null]}):null,s.walkIn?null:(0,E.jsxs)(I.Muted,{children:[(0,O.bookingSource)(s),s.phone?` \xb7 ${s.phone}`:'',s.email?` \xb7 ${s.email}`:'']}),s.allergies.length?(0,E.jsx)(I.Row,{wrap:!0,gap:4,children:s.allergies.map(e=>(0,E.jsx)(I.Badge,{kind:"red",label:`${(0,$.allergenLabel)(e.allergen)} \xb7 ${(0,$.severityLabel)(e.severity)}`},e.allergen))}):null,(0,w.hasAllergens)(s)&&!['cancelled','noshow'].includes(s.status)?(0,E.jsx)(W.BookingAllergyChain,{b:s,me:U}):null,s.walkIn?null:(0,E.jsx)(R.ConfirmTimeline,{refId:s.id,noPhone:!!s.source&&!s.phone}),t?(0,E.jsxs)(I.T,{size:13,colour:T.colours.amber,children:["Running ",(0,S.minsBetween)(new Date(`${s.date}T${s.time}:00`),z)," min late. Call them, then mark no-show if needed."]}):null,(0,E.jsxs)(I.Row,{wrap:!0,gap:6,children:[(0,E.jsx)(d.BookingTableButton,{rid:e,booking:s,readOnly:te,turnBase:j.settings.turnMins}),(0,E.jsx)(r.BookingEditButton,{rid:e,booking:s,who:U,role:H,inStaffApp:F,shiftManager:K}),te||s.table||!['seated','confirmed'].includes(s.status)?null:(0,E.jsx)(I.Button,{small:!s.walkIn,kind:s.walkIn?'primary':'secondary',label:"Assign table",onPress:()=>J.assignTable(s)}),!te&&['seated','confirmed'].includes(s.status)?(0,E.jsx)(I.Button,{small:!0,kind:"secondary",label:(0,v.tablesOf)(s.table).length>1?'Change tables':'Combine tables',testID:`combine-${s.id}`,accessibilityLabel:`${(0,v.tablesOf)(s.table).length>1?'Change tables':'Combine tables'} for ${(0,L.walkInLabel)(s)}`,onPress:()=>J.combineTables(s)}):null,te||'confirmed'!==s.status?null:(0,E.jsxs)(E.Fragment,{children:[s.date===G?(0,E.jsx)(I.Button,{small:!0,label:"Seat",accessibilityLabel:`Seat ${(0,L.walkInLabel)(s)} now`,onPress:()=>(0,L.seatBookingNow)(e,s)}):null,(0,E.jsx)(I.Button,{small:!0,kind:"secondary",label:"No-show",onPress:()=>B.repo.bookings.setStatus(s.id,'noshow')}),(0,E.jsx)(I.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>B.repo.bookings.setStatus(s.id,'cancelled')})]}),te||'seated'!==s.status?null:(0,E.jsx)(I.Button,{small:!0,kind:"secondary",label:"Finished",accessibilityLabel:`Finished: ${(0,L.walkInLabel)(s)}, table needs clearing`,onPress:()=>(0,L.finishBookingNow)(e,s)}),['confirmed','pending'].includes(s.status)&&s.date>=G?(0,E.jsx)(_.WhatsAppGuest,{b:s,rid:e,kind:"auto"}):null,!te&&s.walkIn?(0,E.jsx)(o.CancelWalkInButton,{rid:e,b:s,small:!0}):null,(0,E.jsx)(N.BookingUndo,{b:s,rid:e,today:G,who:(0,L.walkInLabel)(s)})]}),'noshow'===s.status&&'paid'===n?(0,E.jsx)(I.Muted,{size:13,children:"A deposit was paid. Keep or refund it by your deposit terms (Settings \u203a Advanced \u203a Deposits). Deposits paid through website bookings are refunded in Website bookings \u203a Orders."}):null]},s.id)}),(0,E.jsxs)(I.Card,{children:[(0,E.jsxs)(I.Row,{style:{justifyContent:'space-between'},children:[(0,E.jsx)(I.T,{weight:"semibold",children:"No-shows"}),(0,E.jsx)(I.Badge,{kind:ie.length?'red':'ok',label:`${ie.length} ${Q===G?'today':(0,S.niceDate)((0,S.parseYmd)(Q)).slice(0,6)}${ae||a.LIVE_VENUE_BUILD?'':' \xb7 4.1% last 28 days (example)'}`})]}),(0,E.jsx)(I.Muted,{children:ie.length?`Marked no-show today: ${ie.slice(0,6).map(e=>`${e.time} ${(0,L.walkInLabel)(e)}`).join(', ')}${ie.length>6?` and ${ie.length-6} more`:''}. If they turn up, open the booking and tap Undo no-show.`:'No no-shows today. If a party doesn\u2019t arrive, call them first, then tap No-show on their booking.'})]}),s.IS_GREENSIDE?(0,E.jsx)(t.GreensideCashOnly,{}):(0,E.jsxs)(I.Card,{children:[(0,E.jsx)(I.T,{weight:"semibold",children:"Deposits"}),(0,E.jsx)(I.Muted,{testID:"deposits-card-text",children:(()=>{const e=(0,h.depositOf)(j.settings);return e.on&&e.perPersonPence>0?`Deposits: ${(0,D.gbp)(e.perPersonPence)} per person for parties of ${e.fromParty} or more. Deposits are paid through website bookings. Website bookings show Deposit paid on website bookings by themselves once the guest has paid. For phone and walk-in bookings, tick Deposit paid once the guest has paid you${e.wixLinksOn?', or press Send deposit link':''}.`:'Deposits are off. Turn them on in Settings \u203a Advanced \u203a Deposits.'})()}),(0,E.jsx)(I.Muted,{size:13,children:"Tip: refunds are done in Website bookings \u203a Orders. Booking deposit amounts are visible in Managers, Display and Staff."})]}),(0,E.jsx)(C.SectionHead,{title:`Waitlist (${le.length})`,sub:`New party waits about ${(0,P.estimateWait)(le.length+1,j.settings.turnMins,1)} min (estimate)`}),le.map((e,s)=>(0,E.jsxs)(y.default,{style:I.styles.card,children:[(0,E.jsxs)(I.Row,{style:{justifyContent:'space-between'},children:[(0,E.jsxs)(I.T,{weight:"semibold",children:["#",e.number," ",e.name," \xb7 ",e.partySize]}),(0,E.jsxs)(I.Muted,{children:[(0,S.minsBetween)(new Date(e.joinedAt),z)," min \xb7 est. ",(0,P.estimateWait)(s+1,j.settings.turnMins,1)," min"]})]}),'notified'===e.status?(0,E.jsx)(I.Badge,{kind:"ok",label:"Marked as told: table ready (no text is sent)"}):null,(0,E.jsxs)(I.Row,{gap:6,children:['waiting'===e.status?(0,E.jsx)(I.Button,{small:!0,kind:"secondary",label:"Notify",onPress:()=>B.repo.waitlist.setStatus(e.id,'notified')}):null,(0,E.jsx)(I.Button,{small:!0,label:"Seat",onPress:()=>B.repo.waitlist.setStatus(e.id,'seated')}),(0,E.jsx)(I.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>B.repo.waitlist.setStatus(e.id,'removed')})]})]},e.id)),(0,E.jsxs)(I.Row,{gap:6,children:[(0,E.jsx)(i.TextInput,{accessibilityLabel:"Waitlist name",placeholder:"Name for the waitlist",placeholderTextColor:"#7D776C",value:X,onChangeText:Z,style:[I.styles.input,{flex:1}]}),(0,E.jsx)(I.Stepper,{value:ee,onChange:se,min:1,max:12,label:"party"})]}),(0,E.jsx)(I.Button,{kind:"secondary",label:"Add to waitlist",disabled:X.trim().length<2,onPress:()=>{B.repo.waitlist.join(e,X.trim(),ee),Z('')}}),J.elements]})};var e,s=_r(_d[0]),t=_r(_d[1]),n=_r(_d[2]),l=_r(_d[3]),i=_r(_d[4]),a=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),r=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),p=_r(_d[13]),k=_r(_d[14]),x=_r(_d[15]),w=_r(_d[16]),f=_r(_d[17]),j=_r(_d[18]),y=(e=j)&&e.__esModule?e:{default:e},I=_r(_d[19]),B=_r(_d[20]),$=_r(_d[21]),D=_r(_d[22]),S=_r(_d[23]),P=_r(_d[24]),T=_r(_d[25]),C=_r(_d[26]),L=_r(_d[27]),v=_r(_d[28]),N=_r(_d[29]),M=_r(_d[30]),W=_r(_d[31]),R=_r(_d[32]),O=_r(_d[33]),A=_r(_d[34]),_=_r(_d[35]),E=_r(_d[36])},952,[5,991,11,1447,874,833,1318,1311,1319,954,1310,13,1448,975,990,976,828,30,127,813,819,814,816,818,869,821,953,989,825,1449,1037,986,1027,965,820,1356,24]); +__d(function(g,_r,i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"RID",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"statusKind",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"statusLabel",{enumerable:!0,get:function(){return d}}),_e.nextStatus=function(e){return'new'===e.status||'acknowledged'===e.status?{to:'preparing',label:'Start preparing'}:'preparing'===e.status?{to:'ready',label:'takeaway'===e.type?'Mark ready (notify customer)':'Mark ready'}:'ready'===e.status?'takeaway'===e.type?{to:'collected',label:'Collected'}:{to:'served',label:'Served'}:null},Object.defineProperty(_e,"LIVE",{enumerable:!0,get:function(){return a}}),_e.busyLevel=b,_e.restOfDayLevel=function(e,r){const t=e.hours.filter(r=>!e.nextHour||r.hour>=e.nextHour.hour).reduce((e,r)=>!e||r.covers>e.covers?r:e,void 0);return{level:b(t?.covers??0,r.settings.capacityPerHour),peak:t}},_e.Tile=function({label:e,value:n,sub:c,onPress:u,accent:d,children:a}){const b=(0,s.jsxs)(t.default,{style:{flexGrow:1,flexBasis:150,backgroundColor:o.colours.surface,borderRadius:14,padding:12,borderWidth:1,borderColor:d??o.colours.border,gap:2},children:[(0,s.jsx)(l.T,{size:13,weight:"medium",colour:o.colours.muted,children:e}),(0,s.jsx)(l.T,{size:24,weight:"bold",colour:d??o.colours.text,children:n}),c?(0,s.jsx)(l.T,{size:13,colour:o.colours.muted,children:c}):null,a]});return u?(0,s.jsx)(r.default,{accessibilityRole:"button",accessibilityLabel:e,onPress:u,style:{flexGrow:1,flexBasis:150},children:b}):b},_e.SectionHead=function({title:e,right:r,sub:n}){return(0,s.jsxs)(t.default,{style:{gap:2,marginTop:6},children:[(0,s.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,s.jsx)(l.T,{weight:"semibold",size:o.font.large,colour:o.colours.gold,children:e}),r]}),n?(0,s.jsx)(l.Muted,{children:n}):null]})},_e.AlertBox=function({colour:e,title:r,children:n}){return(0,s.jsxs)(t.default,{style:{backgroundColor:o.colours.surface2,borderRadius:12,padding:10,borderLeftWidth:6,borderLeftColor:e,gap:6},children:[(0,s.jsx)(l.T,{weight:"bold",colour:e,children:r}),n]})},_e.Bars=function({data:e,max:r,highlight:n,height:c=110}){return(0,s.jsx)(l.Row,{gap:4,style:{alignItems:'flex-end'},children:e.map(e=>{const u=e.key===n,d=e.a+(e.b??0);return(0,s.jsxs)(t.default,{style:{alignItems:'center',flex:1,minWidth:26},children:[(0,s.jsx)(l.T,{size:11,colour:u?o.colours.gold:o.colours.muted,children:e.note??String(d)}),(0,s.jsxs)(t.default,{style:{height:c,width:'70%',justifyContent:'flex-end',borderBottomWidth:1,borderColor:o.colours.border},children:[e.b?(0,s.jsx)(t.default,{style:{height:Math.max(0,e.b/r*c),backgroundColor:u?o.colours.goldLight:'#6B5A3A'}}):null,(0,s.jsx)(t.default,{style:{height:Math.max(d?2:0,e.a/r*c),backgroundColor:u?o.colours.gold:'#9C7C45'}})]}),(0,s.jsx)(l.T,{size:11,colour:u?o.colours.gold:o.colours.muted,children:e.label})]},e.key)})})},Object.defineProperty(_e,"DemoTag",{enumerable:!0,get:function(){return f}}),_r(_d[0]);var r=e(_r(_d[1])),t=e(_r(_d[2])),l=_r(_d[3]),o=_r(_d[4]),n=_r(_d[5]),s=_r(_d[6]);const c=n.VENUE_RID,u=e=>'new'===e?'red':'ready'===e?'ok':'preparing'===e||'acknowledged'===e?'amber':'served'===e||'collected'===e?'blue':'neutral',d=e=>({new:'New',acknowledged:'Accepted',preparing:'Preparing',ready:'Ready',collected:'Collected',served:'Served',closed:'Closed',cancelled:'Cancelled'}[e.status]);const a=e=>!['collected','served','closed','cancelled'].includes(e.status);function b(e,r){const t=r?e/r:0;return t<.35?{label:'Quiet',colour:o.colours.ok,pct:t}:t<.6?{label:'Steady',colour:o.colours.blue,pct:t}:t<.85?{label:'Busy',colour:o.colours.amber,pct:t}:{label:'Very busy',colour:o.colours.red,pct:t}}const f=({label:e="DEMO"})=>(0,s.jsx)(l.Badge,{kind:"amber",label:e})},953,[30,263,127,813,821,5,24]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"fmtH",{enumerable:!0,get:function(){return d.fmtH}}),Object.defineProperty(_e,"fmtHDay",{enumerable:!0,get:function(){return d.fmtHDay}}),Object.defineProperty(_e,"clampRole",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"StaffAppCtx",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"useInStaffApp",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"ShiftMgrScope",{enumerable:!0,get:function(){return y}}),_e.useShiftManager=D,_e.useSignedIn=b,_e.useCtx=function(e=1e4){const o=(0,t.useContext)(p),u=(0,r.useOwner)(e=>e.site),i=(0,r.useOwner)(e=>e.previewRole),f=(0,r.useOwner)(e=>e.staffAs),d=b(),m=o||'staff'===s.APP_VARIANT,w=(0,t.useContext)(y),h=D(),O=m?w&&h?'manager':'staff':d?l(i,d.role):i,S=(0,r.useOwner)(e=>e.staff),M=(0,n.useRestaurant)(u),A=(0,n.useNow)(e),I=d?d.id:m&&f?f:c[O],P=S.find(e=>e.id===I)?.name??'Team member';return{rid:u,r:M,now:A,role:O,me:P,meId:I,today:(0,a.venueYmd)(A),signedIn:!!d}},Object.defineProperty(_e,"weekday",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"DAY3",{enumerable:!0,get:function(){return O}}),_e.ensureAttendance=function(t,n){if(e.LIVE_VENUE_BUILD||(0,o.isLive)())return;const s=r.useOwner.getState(),u=[],i=s.staff.find(e=>e.active&&'manager'===e.role)??s.staff.find(e=>e.active&&'owner'===e.role),f=new Date(n);f.setDate(n.getDate()-h(n));const d=(0,a.ymd)(f),c=(0,a.ymd)(new Date(f.getFullYear(),f.getMonth(),f.getDate()+6)),m=(e,t,n)=>{const r=new Date(e);return r.setHours(0,0,0,0),r.setMinutes(Math.round(60*t)+n),r.toISOString()};for(let e=42;e>=1;e--){const t=new Date(n);t.setDate(t.getDate()-e);const r=(0,a.ymd)(t);if(s.attendance.some(e=>e.date===r))continue;const o=s.shifts.filter(e=>e.date===r&&!1!==e.published);(o.length?o:s.shifts.filter(e=>e.day===h(t)&&e.date>=d&&e.date<=c&&!1!==e.published)).forEach((n,a)=>{const s=e=>Math.round((7*r.charCodeAt(9)+13*a+e)%17-5),o=n.end-n.start,f=o>8?30:o>6?20:0,d=e>2&&i?{signOff:{by:i.name,byId:i.id,at:m(t,34,a)}}:{};u.push({id:`at-${r}-${n.staffId}`,staffId:n.staffId,date:r,in:m(t,n.start,s(1)),out:m(t,n.end,s(2)),inSite:!0,outSite:!0,breakMins:f,...d})})}u.length&&r.useOwner.setState({attendance:[...r.useOwner.getState().attendance,...u]})},_e.paidMins=function(e,t){if(!e.in)return{worked:0,brk:0,paid:0};const n=Math.max(0,Math.round(((e.out?new Date(e.out):t).getTime()-new Date(e.in).getTime())/6e4)),r=e.breakMins??0;return{worked:n,brk:r,paid:Math.max(0,n-r)}},Object.defineProperty(_e,"hmDur",{enumerable:!0,get:function(){return S}}),_e.payRange=function(e,t,n){const r=new Date(n);if(r.setHours(0,0,0,0),'monthly'===e){const e=new Date(r.getFullYear(),r.getMonth()+t,1),n=new Date(e.getFullYear(),e.getMonth()+1,0);return{s:e,e:n,key:`m-${(0,a.ymd)(e)}`}}const s='weekly'===e?7:14,o=new Date(r);o.setDate(r.getDate()-h(r));let u=new Date(o);if('fortnightly'===e){const e=new Date(2026,0,5);(Math.round((o.getTime()-e.getTime())/6048e5)%2+2)%2==1&&u.setDate(u.getDate()-7)}u.setDate(u.getDate()+t*s);const i=new Date(u);return i.setDate(u.getDate()+s-1),{s:u,e:i,key:`${e[0]}-${(0,a.ymd)(u)}`}},_e.useHourly=function(){const e=b(),t=(0,r.useOwner)(e=>e.hourly);return e?t:M};var e=_r(_d[0]),t=_r(_d[1]),n=_r(_d[2]),r=_r(_d[3]),a=_r(_d[4]),s=_r(_d[5]),o=_r(_d[6]),u=_r(_d[7]),i=_r(_d[8]),f=_r(_d[9]),d=_r(_d[10]);const c={owner:f.ROSTER.find(e=>'owner'===e.role)?.id??'',manager:f.ROSTER.find(e=>'manager'===e.role)?.id??'',staff:f.ROSTER.find(e=>'staff'===e.app)?.id??''},m={staff:0,manager:1,owner:2},l=(e,t)=>m[e]>m[t]?t:e,p=(0,t.createContext)(!1),w=()=>(0,t.useContext)(p),y=(0,t.createContext)(!1);function D(){const e=(0,t.useContext)(p)||'staff'===s.APP_VARIANT,n=b(),r=(0,o.useSync)(e=>!!e.venueId&&'staff'===e.kind),a=(0,o.useSync)(e=>e.perms);return(0,u.shiftManagerOn)({inStaffApp:e,managerAccess:n?.managerAccess,role:n?.role,app:(0,i.rosterPerson)(n?.id)?.app,live:r,perms:a})}function b(){const e=(0,i.useSession)(e=>e.meId),t=(0,r.useOwner)(e=>e.staff);return e?t.find(t=>t.id===e&&t.active):void 0}const h=e=>(e.getDay()+6)%7,O=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'];const S=e=>`${Math.floor(e/60)}h ${String(e%60).padStart(2,'0')}m`;const M={}},954,[833,30,819,854,818,806,820,1077,858,14,1071]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";function i(i){return i&&i.__esModule?i:{default:i}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEFAULT_AVATARS",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"AVATAR_BGS",{enumerable:!0,get:function(){return F}}),Object.defineProperty(_e,"AVATAR_RINGS",{enumerable:!0,get:function(){return u}}),_e.specFor=E,_e.AvatarArt=$,_e.useStaffMember=v,_e.StaffAvatar=function({id:i,name:t,size:s=34,ring:c=!0}){const f=v(i,t),y=f?.id??i,F=(0,n.useAvatars)(i=>y?i.photos[y]:void 0),u=(0,o.useSetup)(i=>y?i.looks[y]:void 0),j=`${(f?.name??t??'Team member').replace(' (example)','')}'s avatar`;return(0,h.jsx)(r.default,{testID:y?`avatar-${y}`:'avatar',accessibilityLabel:j,accessibilityRole:"image",style:{width:s,height:s,borderRadius:s/2,overflow:'hidden',borderWidth:c?Math.max(1,s/22):0,borderColor:x.colours.gold,backgroundColor:(0,l.soutersSurface)('#111')},children:F?(0,h.jsx)(e.default,{source:{uri:F.dataUrl},style:{width:'100%',height:'100%'},accessibilityIgnoresInvertColors:!0}):(0,h.jsx)($,{spec:null!=u?E(`${y}#look${u}`):E(y,f?.name??t),size:s-(c?2*Math.max(1,s/22):0)})})};var l=_r(d[0]);_r(d[1]);var e=i(_r(d[2])),r=i(_r(d[3])),t=_r(d[4]),s=i(t),c=_r(d[5]),n=_r(d[6]),o=_r(d[7]),x=_r(d[8]),f=_r(d[9]),h=_r(d[10]);const y=Object.fromEntries(f.ROSTER.map(i=>[i.id,i.avatar])),F=['#2A2520','#B89A72','#D9A441','#4A3F35','#3A3029','#8A6A3B'],u=['#E9B949','#CFA45F'],j=F,C=['#F1C7A5','#E8B48F','#C68B5E','#8D5B3E','#F4D2B8','#A86B45'],p=['#2B1B12','#7A4E2A','#151515','#C2462E','#D9B26A'],A=['quiff','flip','crop','beehive','bob','curls'],b=i=>{let l=7;for(const e of i)l=31*l+e.charCodeAt(0)>>>0;return l};function E(i,l){if(i&&y[i])return y[i];const e=b(i||l||'crew');return{bg:j[e%6],ring:u[e%2],skin:C[(e>>3)%6],hair:p[(e>>6)%5],hairStyle:A[(e>>9)%6],suit:'#F2EAD8',antenna:['ball','star','none'][(e>>12)%3]}}const k=(i,l,e)=>`M${i} ${l-e} Q${i+.18*e} ${l-.18*e} ${i+e} ${l} Q${i+.18*e} ${l+.18*e} ${i} ${l+e} Q${i-.18*e} ${l+.18*e} ${i-e} ${l} Q${i-.18*e} ${l-.18*e} ${i} ${l-e}Z`;function $({spec:i,size:l=40}){const e=i,r='#1B1B1B',c='flip'===e.hairStyle?(0,h.jsx)(t.Path,{d:"M29 50 C26 30 40 22 50 22 C60 22 74 30 71 50 C75 56 79 60 76 65 C72 60 69 58 66 57 L34 57 C31 58 28 60 24 65 C21 60 25 56 29 50Z",fill:e.hair}):'bob'===e.hairStyle?(0,h.jsx)(t.Path,{d:"M30 58 C27 32 40 24 50 24 C60 24 73 32 70 58 L66 60 L34 60Z",fill:e.hair}):'beehive'===e.hairStyle?(0,h.jsxs)(t.G,{children:[(0,h.jsx)(t.Ellipse,{cx:50,cy:25,rx:15,ry:14,fill:e.hair}),(0,h.jsx)(t.Path,{d:"M31 54 C28 34 40 27 50 27 C60 27 72 34 69 54 Z",fill:e.hair})]}):'curls'===e.hairStyle?(0,h.jsx)(t.G,{children:[[34,34],[40,27],[50,24],[60,27],[66,34],[69,43],[31,43]].map(([i,l],r)=>(0,h.jsx)(t.Circle,{cx:i,cy:l,r:7,fill:e.hair},r))}):null,n='quiff'===e.hairStyle?(0,h.jsxs)(t.G,{children:[(0,h.jsx)(t.Path,{d:"M32 42 C31 27 43 23 51 25 C61 22 70 30 68 42 C63 35 57 33 50 34 C43 34 37 37 32 42Z",fill:e.hair}),(0,h.jsx)(t.Path,{d:"M46 26 C51 14 66 14 66 23 C61 20 54 21 50 28Z",fill:e.hair})]}):'crop'===e.hairStyle?(0,h.jsx)(t.Path,{d:"M32 42 C31 28 42 25 50 25 C58 25 69 28 68 42 C64 36 58 33 50 33 C42 33 36 36 32 42Z",fill:e.hair}):'curls'===e.hairStyle?null:(0,h.jsx)(t.Path,{d:"M32 43 C33 30 42 27 50 27 C58 27 67 30 68 43 C61 38 57 33 51 33 C47 37 39 41 32 43Z",fill:e.hair});return(0,h.jsxs)(s.default,{width:l,height:l,viewBox:"0 0 100 100",children:[(0,h.jsx)(t.Circle,{cx:50,cy:50,r:50,fill:e.bg}),(0,h.jsx)(t.Ellipse,{cx:50,cy:50,rx:46,ry:13,fill:"none",stroke:"#FFF4E0",strokeOpacity:.28,strokeWidth:1.6,transform:"rotate(-28 50 50)"}),(0,h.jsx)(t.Path,{d:k(16,24,6),fill:"#FFF4E0",fillOpacity:.85}),(0,h.jsx)(t.Path,{d:k(84,34,4),fill:"#FFF4E0",fillOpacity:.7}),(0,h.jsx)(t.Circle,{cx:80,cy:16,r:1.6,fill:"#FFF4E0",fillOpacity:.8}),(0,h.jsx)(t.Circle,{cx:22,cy:70,r:1.3,fill:"#FFF4E0",fillOpacity:.6}),(0,h.jsx)(t.Path,{d:"M12 100 C14 82 31 74 50 74 C69 74 86 82 88 100 Z",fill:e.suit}),(0,h.jsx)(t.Path,{d:"M36 100 L40 84 L50 90 L60 84 L64 100Z",fill:e.ring,fillOpacity:.35}),(0,h.jsx)(t.Rect,{x:44,y:60,width:12,height:12,fill:e.skin}),c,(0,h.jsx)(t.Ellipse,{cx:50,cy:46,rx:17,ry:18.5,fill:e.skin}),n,e.specs?(0,h.jsxs)(t.G,{stroke:r,strokeWidth:1.6,fill:"#FFFFFF",fillOpacity:.25,children:[(0,h.jsx)(t.Rect,{x:37,y:42,width:11,height:8,rx:4}),(0,h.jsx)(t.Rect,{x:52,y:42,width:11,height:8,rx:4}),(0,h.jsx)(t.Line,{x1:48,y1:45,x2:52,y2:45})]}):null,(0,h.jsx)(t.Ellipse,{cx:42.5,cy:46.5,rx:2.1,ry:2.7,fill:r}),(0,h.jsx)(t.Ellipse,{cx:57.5,cy:46.5,rx:2.1,ry:2.7,fill:r}),(0,h.jsx)(t.Circle,{cx:43.3,cy:45.5,r:.8,fill:"#FFFFFF"}),(0,h.jsx)(t.Circle,{cx:58.3,cy:45.5,r:.8,fill:"#FFFFFF"}),(0,h.jsx)(t.Circle,{cx:38,cy:53,r:3,fill:"#F08A7E",fillOpacity:.55}),(0,h.jsx)(t.Circle,{cx:62,cy:53,r:3,fill:"#F08A7E",fillOpacity:.55}),(0,h.jsx)(t.Path,{d:"M44.5 55 Q50 60 55.5 55",stroke:r,strokeWidth:1.8,fill:"none",strokeLinecap:"round"}),(0,h.jsx)(t.Ellipse,{cx:50,cy:74,rx:21,ry:5.5,fill:e.ring}),(0,h.jsx)(t.Ellipse,{cx:50,cy:73,rx:16,ry:3,fill:"#000000",fillOpacity:.18}),(0,h.jsx)(t.Circle,{cx:50,cy:88,r:4,fill:e.ring}),(0,h.jsx)(t.Circle,{cx:50,cy:88,r:1.6,fill:e.bg}),(0,h.jsx)(t.Circle,{cx:50,cy:45,r:29,fill:"#FFF4E0",fillOpacity:.1,stroke:"#FFF4E0",strokeOpacity:.85,strokeWidth:2}),(0,h.jsx)(t.Path,{d:"M29 36 A23 23 0 0 1 41 22",stroke:"#FFFFFF",strokeOpacity:.85,strokeWidth:3.2,fill:"none",strokeLinecap:"round"}),(0,h.jsx)(t.Circle,{cx:28.5,cy:42,r:1.5,fill:"#FFFFFF",fillOpacity:.85}),'none'!==e.antenna?(0,h.jsx)(t.Line,{x1:50,y1:16,x2:50,y2:8,stroke:e.ring,strokeWidth:2}):null,'ball'===e.antenna?(0,h.jsx)(t.Circle,{cx:50,cy:6.5,r:3.3,fill:e.ring}):'star'===e.antenna?(0,h.jsx)(t.Path,{d:k(50,6.5,4.5),fill:e.ring}):null]})}const O=i=>(i??'').replace(' (example)','').trim().toLowerCase();function v(i,l){const e=(0,c.useOwner)(i=>i.staff);return i?e.find(l=>l.id===i):l?e.find(i=>O(i.name)===O(l)):void 0}},955,[878,30,196,127,1005,854,1040,1007,821,14,24]); +__d(function(g,_r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"APP_USED_TEXT",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"APP_NOT_SET_UP_TEXT",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"allowedHere",{enumerable:!0,get:function(){return C}}),Object.defineProperty(_e,"movedMessage",{enumerable:!0,get:function(){return N}}),_e.personFromStaff=E,_e.signInWithText=z,_e.SignInWithLink=M,_e.useSignedOutGate=function(){const e=(0,m.useSession)(e=>e.meId);return _.includes(b.APP_VARIANT)&&!A.PITCH&&!e},_e.InviteGate=function(){const[e,R]=(0,f.useState)(m.useSession.persist.hasHydrated()),[E,z]=(0,f.useState)(m.START_INVITE?'checking':'done'),[V,F]=(0,f.useState)(null),[W,D]=(0,f.useState)(0),[K,U]=(0,f.useState)(!1),[G,Y]=(0,f.useState)(null),B=(0,m.useSession)(e=>e.meId),$=(0,m.useSession)(e=>!B||!!e.welcomed[B]);if((0,f.useEffect)(()=>{const e=m.useSession.persist.onFinishHydration(()=>R(!0));return m.useSession.persist.hasHydrated()&&R(!0),e},[]),(0,f.useEffect)(()=>{if(!e||!_.includes(b.APP_VARIANT))return;let n,t=!0;return(async()=>{const e=m.useSession.getState().meId;if(m.START_INVITE&&!(e&&await(0,I.signedInHereAs)(e)&&await(0,I.rememberedInviteHere)(m.START_INVITE))){const e=await H(m.START_INVITE,e=>{t&&F(e)});if(!t)return;if('refused'===e.kind)return F(e.message),void z('done');if('offline'===e.kind)return U(!0),void(n=setTimeout(()=>{t&&D(e=>e+1)},1e4));if(U(!1),'bad'===e.kind)return void z('bad')}const s=O(m.useSession.getState().meId),o=s&&!1!==P.useOwner.getState().staff.find(e=>e.id===s.id)?.active;if(s&&!o)m.useSession.getState().signOut();else if(s&&!C(s)&&!m.START_INVITE&&await(0,I.signedInHereAs)(s.id)){if(await(0,I.forgetSignInHere)(),!t)return;m.useSession.getState().signOut(),Y(N(s.app))}else if(s&&!C(s)){const e=(0,m.appUrl)(s.app,m.START_INVITE);if(e)return void window.location.replace(e)}z('done')})(),()=>{t=!1,n&&clearTimeout(n)}},[e,W]),!_.includes(b.APP_VARIANT))return null;if(n.IS_QUEUED_VENUE&&!B)return(0,x.jsx)(h.default,{style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(t.QueuedVenueWelcome,{app:m.APP_NAME[b.APP_VARIANT]??'Team',message:V?'This link cannot be used here. Ask your authorised manager.':K?'Waiting for a connection.':void 0})});if(n.IS_GREENSIDE&&!B)return(0,x.jsx)(h.default,{style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(s.GreensideStaffHome,{app:m.APP_NAME[b.APP_VARIANT]??'Team',message:V?`This link can\u2019t be used here. ${V}`:K?'Waiting for a connection.':e&&'checking'!==E?'bad'===E?'This link is not recognised. Ask the authorised manager for access after setup.':void 0:'Opening your Greenside app\u2026'})});if(n.IS_ABBOTSFORD&&!B)return(0,x.jsx)(h.default,{style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(l.AbbotsfordStaffHome,{app:m.APP_NAME[b.APP_VARIANT]??'Team',message:V?'This link cannot be used here. Ask your authorised manager.':K?'Waiting for a connection.':void 0})});if(n.IS_KIRKTON&&!B)return(0,x.jsx)(h.default,{style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(u.KirktonStaffHome,{app:m.APP_NAME[b.APP_VARIANT]??'Team',message:V?`This link can\u2019t be used here. ${V}`:K?'Waiting for a connection.':e&&'checking'!==E?'bad'===E?'This link is not recognised. Ask the authorised manager for access after setup.':void 0:'Opening your Kirkton app\u2026'})});if(n.IS_WILDINGS&&!B)return(0,x.jsx)(h.default,{style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(o.WildingsStaffHome,{app:m.APP_NAME[b.APP_VARIANT]??'Team',message:V?`This link can\u2019t be used here. ${V}`:K?'Waiting for a connection. Your personal app signs you in automatically when it returns.':e&&'checking'!==E?'bad'===E?'This link is not recognised. Open the complete private link your manager gave you.':void 0:'Opening your personal Wildings app\u2026'})});if(n.IS_KIRKMICHAEL&&!B)return(0,x.jsx)(h.default,{style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(r.KirkmichaelStaffHome,{app:m.APP_NAME[b.APP_VARIANT]??'Team',message:V?`This link can\u2019t be used here. ${V}`:K?'Waiting for a connection. Your personal app signs you in automatically when it returns.':e&&'checking'!==E?'bad'===E?'This link is not recognised. Open the complete private link your manager gave you.':void 0:'Opening your personal Kirkmichael app\u2026'})});if(n.IS_SOUTERS&&!B)return(0,x.jsx)(h.default,{style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(c.SoutersStaffHome,{app:m.APP_NAME[b.APP_VARIANT]??'Team'})});if(K)return w('Waiting for a connection. Your app will sign you in automatically.','invite-waiting');if(!e||'checking'===E)return(0,x.jsx)(h.default,{style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}]});if((0,S.inPhoneApp)()&&!B&&!A.PITCH)return V&&/already been used/i.test(V)?w(j,'invite-app-used'):V?w(V,'invite-app-refused'):w(v,'invite-app-notsetup');if('bad'===E)return(0,x.jsxs)(h.default,{testID:"invite-bad",style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,x.jsx)(T.T,{size:22,weight:"bold",center:!0,children:"This link isn\u2019t recognised"}),(0,x.jsx)(T.Muted,{center:!0,children:"Part of the link may be missing. Go back to the message from your manager and tap the whole link, rather than copying part of it. If it still doesn't work, ask your manager for your personal CoverCharge link."}),(0,x.jsx)(T.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>z('done')}),(0,x.jsx)(T.Muted,{center:!0,children:"Offline, CoverCharge uses made-up data, and nothing you do there is shared with the team."})]});if(V&&!B)return(0,x.jsxs)(h.default,{testID:"invite-refused",style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,x.jsx)(T.T,{size:22,weight:"bold",center:!0,children:"This link can\u2019t be used here"}),(0,x.jsx)(T.Muted,{center:!0,children:V}),(0,x.jsx)(T.Muted,{center:!0,children:"Each personal link works on one phone only and lasts 30 days before first use, so nobody else can sign in as you."}),(0,x.jsx)(T.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>F(null)})]});if(G&&!B)return(0,x.jsxs)(h.default,{testID:"invite-moved",style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,x.jsx)(T.T,{size:22,weight:"bold",center:!0,children:"This app is signed out"}),(0,x.jsx)(T.Muted,{center:!0,children:G}),(0,x.jsx)(M,{})]});if(!B&&!A.PITCH)return(0,x.jsxs)(h.default,{testID:"invite-signin",style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,x.jsx)(T.T,{size:22,weight:"bold",center:!0,children:V?'This link can\u2019t be used here':'Sign in to CoverCharge'}),V?(0,x.jsx)(T.Muted,{center:!0,children:V}):null,(0,x.jsx)(T.Muted,{center:!0,children:"Open the personal link your manager sent you on this phone. Each link signs in one person on one phone and lasts 30 days before first use. If it has already been used on another phone or browser, ask your manager for a new one."}),(0,x.jsx)(M,{})]});const L=(0,m.rosterPerson)(B);return L&&!$&&C(L)?(0,x.jsx)(y.LaunchWelcome,{p:L,onDone:()=>m.useSession.getState().markWelcomed(L.id)}):null};var n=_r(d[0]),t=_r(d[1]),s=_r(d[2]),o=_r(d[3]),r=_r(d[4]),l=_r(d[5]),u=_r(d[6]),c=_r(d[7]),f=_r(d[8]);_r(d[9]);var p=e(_r(d[10])),h=e(_r(d[11])),b=_r(d[12]),m=_r(d[13]),k=_r(d[14]),y=_r(d[15]),T=_r(d[16]),I=_r(d[17]),A=_r(d[18]),S=_r(d[19]),P=_r(d[20]),x=_r(d[21]);const j='This app copy has already been set up on another phone. Ask your manager for a new link.',v='This app copy isn\u2019t set up for anyone yet. Ask your manager for your link, and download the app from it.',w=(e,n)=>(0,x.jsx)(h.default,{testID:n,style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:(0,x.jsx)(T.T,{size:22,weight:"bold",center:!0,children:e})}),_=['owner','staff','chef'],C=e=>'staff'===b.APP_VARIANT||e.app===b.APP_VARIANT,N=e=>`You now use ${m.APP_NAME[e]??'another CoverCharge app'}. This app is signed out on this phone. Open the new personal link your manager sent you.`;function R(e){m.useSession.getState().signIn(e.id);const n=P.useOwner.getState();P.useOwner.setState({staffAs:e.id,previewRole:'staff'===e.role?n.previewRole:e.role})}function E(e){const n='owner'===e.role?'Owner':'manager'===e.role?'Manager':'Head Chef'===e.level?'Head Chef':'Staff';return{id:e.id,name:e.name,level:n,role:e.role,job:e.job,nickname:e.nickname,dept:e.dept??'',app:'staff'===e.role?'Head Chef'===n?'chef':'staff':'owner',tokenHash:'',hourlyPence:null,salaried:!!e.salaried,noTax:!!e.noTax,avatar:void 0}}const O=e=>{const n=(0,m.rosterPerson)(e);if(n)return n;const t=e?P.useOwner.getState().staff.find(n=>n.id===e):void 0;return t?E(t):void 0};async function H(e,n){const t=await(0,m.personForInvite)(e);if(t)return R(t),C(t)?((0,I.claimInvite)(e).then(e=>{if('refused'===e.status&&m.useSession.getState().meId===t.id&&(m.useSession.getState().signOut(),n(e.message)),'ok'===e.status&&e.id.staffRef&&e.id.staffRef!==m.useSession.getState().meId){const n=O(e.id.staffRef);n&&R(n)}}),{kind:'ok',p:t}):{kind:'ok',p:t};const s=await(0,I.claimInvite)(e);if('refused'===s.status)return{kind:'refused',message:s.message};if('offline'===s.status)return{kind:'offline'};if('ok'!==s.status||!s.id.staffRef)return{kind:'bad'};const o=O(s.id.staffRef)??E({id:s.id.staffRef,name:s.id.displayName||s.id.staffRef,role:'owner'===s.id.role?'owner':'manager'===s.id.role?'manager':'staff',level:'head_chef'===s.id.role?'Head Chef':void 0,job:'',active:!0});return R(o),{kind:'ok',p:o}}async function z(e,n=()=>{}){const t=(0,m.inviteFromText)(e);if(!t)return'bad';const s=await H(t,n);if('refused'===s.kind)return{refused:s.message};if('bad'===s.kind||'offline'===s.kind)return'bad';const o=s.p;if(!C(o)){const e=(0,m.appUrl)(o.app,t);if(e)return window.location.replace(e),'moved'}return'ok'}function M(){const[e,n]=(0,f.useState)(''),[t,s]=(0,f.useState)('');return(0,x.jsxs)(h.default,{style:{gap:6},children:[(0,x.jsx)(T.Field,{label:"Your personal link (paste it here)",value:e,onChangeText:n,placeholder:"Your complete Android or iPhone link",autoCapitalize:"none",autoCorrect:!1}),(0,x.jsx)(T.Button,{label:"Sign in",disabled:!e.trim(),onPress:async()=>{const t=await z(e,s);s('bad'===t?'That link was not recognised. Check you copied all of it, or ask your manager for a new one.':'object'==typeof t?t.refused:''),'ok'===t&&n('')}}),t?(0,x.jsx)(T.T,{size:13,colour:k.colours.red,children:t}):null]})}},956,[5,1450,1451,1452,1453,1454,1455,852,30,122,46,127,806,858,821,1456,813,820,2,1303,854,24]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useCoach",{enumerable:!0,get:function(){return p}}),_e.findTarget=b,_e.CoachHost=function(){const{target:e,hint:s,nonce:x}=p(),[y,w]=(0,o.useState)(null),v=(0,o.useRef)(new n.default.Value(0)).current;if((0,o.useEffect)(()=>{n.default.loop(n.default.timing(v,{toValue:1,duration:1300,easing:l.default.out(l.default.quad),useNativeDriver:!1})).start()},[]),(0,o.useEffect)(()=>{if(w(null),!s||!e)return;let t=0,o=null,n=!1;const l=()=>{if(o=o&&o.isConnected?o:b(e),o){n||(o.scrollIntoView?.({block:'center',behavior:'smooth'}),n=!0);const e=o.getBoundingClientRect();w({x:e.left,y:e.top,w:e.width,h:e.height,vw:window.innerWidth,vh:window.innerHeight})}else++t>40&&w(null)},r=setInterval(l,150);l();const u=setTimeout(()=>p.getState().clear(),2e4);return()=>{clearInterval(r),clearTimeout(u)}},[x]),!s)return null;const C='fixed',R=!y||y.y+y.h+110p.getState().clear(),style:{alignSelf:'flex-end',backgroundColor:(0,t.soutersSurface)('#1A1408'),borderRadius:10,paddingHorizontal:14,paddingVertical:6},children:(0,h.jsx)(c.T,{colour:f.colours.gold,weight:"semibold",children:"Got it"})})]})})]})};var t=_r(d[0]),o=_r(d[1]),n=e(_r(d[2])),l=e(_r(d[3]));_r(d[4]);var r=e(_r(d[5])),u=e(_r(d[6])),s=_r(d[7]),c=_r(d[8]),f=_r(d[9]),h=_r(d[10]);const p=(0,s.create)(e=>({target:null,hint:null,nonce:0,show:(t,o)=>e(e=>({target:t??null,hint:o,nonce:e.nonce+1})),clear:()=>e({target:null,hint:null})}));function b(e){if('undefined'==typeof document)return null;const t=e=>e&&e.getClientRects().length?e:null;if(e.testID){const o=Array.from(document.querySelectorAll(`[data-testid="${e.testID}"]`)).map(t).find(Boolean);if(o)return o}if(e.label){const o=Array.from(document.querySelectorAll(`[aria-label="${e.label}"]`)).map(t).find(Boolean);if(o)return o}if(e.text){const o=e.text.toLowerCase(),n=Array.from(document.querySelectorAll('[role="button"], button, a')).filter(e=>(e.textContent??'').trim().toLowerCase().includes(o)).map(t).find(Boolean);if(n)return n}return null}},957,[878,30,120,224,122,263,127,1008,813,821,24]); +__d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffHome=function({go:e}){const I=(0,p.useInStaffApp)(),{now:M,meId:v,me:L,r:N,today:O}=(0,p.useCtx)(3e4),z=(0,s.useTravelDay)('staff',O),A=(0,c.useOwner)(e=>e.shifts),P=(0,c.useOwner)(e=>e.attendance),R=(0,c.useOwner)(e=>e.staffCanViewSuppliers),$=(0,c.useOwner)(e=>e.quickLinks),F=(0,c.useOwner)(e=>e.chat),H=(0,c.useOwner)(e=>e.swaps),_=(0,c.useOwner)(e=>e.leave),V=A.filter(e=>e.staffId===v&&e.published&&e.date>=O).sort((e,s)=>e.date.localeCompare(s.date)||e.start-s.start),W=V.find(e=>e.date===O),q=P.filter(e=>e.staffId===v&&e.in&&!e.out&&M.getTime()-new Date(e.in).getTime()<72e6).sort((e,s)=>s.in.localeCompare(e.in))[0],E=(0,m.usePay)(v,0),U=(0,y.useOrders)(N.id),Y=(0,y.useBookings)(N.id),G=U.filter(e=>(0,k.LIVE)(e)&&e.allergies.length&&(0,w.nextStep)(e,(0,w.linkedBooking)(e,Y))),Q=Y.filter(e=>e.date===O&&['confirmed','seated'].includes(e.status)&&(0,w.bookingNeedsAction)(e,U.filter(k.LIVE))),K=Y.filter(e=>(0,C.undoKind)(e,O)).sort((e,s)=>e.time.localeCompare(s.time)).slice(0,12),J=F.filter(e=>'all'===e.ch&&e.pinned&&!e.removed).slice(-1)[0],X=H.filter(e=>e.fromId===v&&'open'===e.status).length+_.filter(e=>e.staffId===v&&'pending'===e.status).length,Z=[['Clock in / out',()=>e('more','clock')],['My rota, swaps & leave',()=>e('more','rota')],['Staff chat',()=>e('chat')],['Recipe cards',()=>e('more','recipecards')],['My hours & pay',()=>e('more','mypay')],['My tips',()=>e('more','mytips')],['Post to social (draft)',()=>e('more','social')],...R?[['Suppliers',()=>e('more','suppliers')]]:[]];return!I&&z?(0,B.jsxs)(o.default,{style:{gap:10},children:[(0,B.jsx)(s.DayBar,{app:"staff",today:O}),(0,B.jsx)(s.DayView,{rid:N.id,day:z,today:O,app:"staff"})]}):(0,B.jsxs)(o.default,{style:{gap:10},children:[I?null:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(s.DayBar,{app:"staff",today:O}),(0,B.jsx)(t.CoversToday,{rid:N.id})]}),(0,B.jsxs)(r.Card,{highlight:u.colours.accentBorder,children:[(0,B.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsxs)(r.Row,{gap:10,style:{flex:1},children:[(0,B.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"My avatar",onPress:()=>e('more','avatar'),children:(0,B.jsx)(T.StaffAvatar,{id:v,size:52})}),(0,B.jsxs)(r.T,{size:18,weight:"bold",children:["Hi ",L.replace(' (example)','').split(' ')[0]]})]}),(0,B.jsx)(r.Badge,{kind:"gold",label:I?N.name:'Staff app preview'})]}),(0,B.jsx)(r.Muted,{children:I?`${M.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'})}`:'This is what staff will see in the separate Staff app.'})]}),(0,B.jsxs)(r.Card,{highlight:q?u.colours.ok:void 0,children:[(0,B.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsx)(r.T,{weight:"semibold",children:q?`On shift since ${(0,h.hm)(new Date(q.in))}`:'Not clocked in'}),q?(0,B.jsx)(r.Badge,{kind:"ok",label:(0,p.hmDur)(Math.max(0,Math.round((M.getTime()-new Date(q.in).getTime())/6e4)))}):null]}),W?(0,B.jsxs)(r.Muted,{children:["Today on the rota: ",(0,p.fmtH)(W.start),"\u2013",(0,p.fmtH)(W.end)]}):V[0]?(0,B.jsxs)(r.Muted,{children:["Next on the rota: ",p.DAY3[V[0].day]," ",Number(V[0].date.slice(8))," ",(0,p.fmtH)(V[0].start),"\u2013",(0,p.fmtH)(V[0].end)]}):(0,B.jsx)(r.Muted,{children:"No shifts on the rota this week."}),(0,B.jsx)(r.Button,{small:!0,kind:q?'secondary':'success',label:q?'Clock out':'Clock in',onPress:()=>e('more','clock')})]}),(0,B.jsx)(f.ShellfishTile,{rid:N.id,by:L.replace(' (example)',''),app:"staff"}),K.length?(0,B.jsx)(r.Card,{children:(0,B.jsxs)(o.default,{testID:"staff-seated-today",style:{gap:8},children:[(0,B.jsxs)(r.T,{weight:"semibold",children:["Seated and finished today (",K.length,")"]}),(0,B.jsx)(r.Muted,{children:"Seated someone by mistake? Tap Unseat: they go back to Booked and their tables are freed. Finished or No-show by mistake? Tap Undo."}),K.map(e=>{const s=e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;return(0,B.jsxs)(o.default,{style:{gap:6,borderTopWidth:1,borderTopColor:u.colours.hairline,paddingTop:8},children:[(0,B.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsxs)(r.T,{size:17,weight:"semibold",children:[e.time," \xb7 ",s]}),(0,B.jsx)(r.Badge,{kind:'noshow'===e.status?'red':'seated'===e.status?'ok':'neutral',label:'noshow'===e.status?'No-show':'seated'===e.status?'Seated':'Finished'})]}),(0,B.jsxs)(r.Muted,{children:[e.table?(0,D.tablesLabel)(e.table):'No table'," \xb7 ",e.ref]}),(0,B.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,B.jsxs)(r.Row,{wrap:!0,gap:6,children:['seated'===e.status?(0,B.jsx)(r.Button,{small:!0,kind:"secondary",label:"Finished",accessibilityLabel:`Finished: ${s}`,onPress:()=>(0,S.finishBookingNow)(N.id,e)}):null,e.walkIn?(0,B.jsx)(a.CancelWalkInButton,{rid:N.id,b:e,small:!0}):null,(0,B.jsx)(C.BookingUndo,{b:e,rid:N.id,today:O,who:s})]})]},e.id)})]})}):null,G.length+Q.length?(0,B.jsxs)(o.default,{testID:"staff-allergy-signoffs",style:{gap:8},children:[(0,B.jsxs)(r.T,{weight:"semibold",children:["Allergy sign-offs (",G.length+Q.length,")"]}),(0,B.jsx)(r.Muted,{children:"Tap Sign off for your step. Your name and the time are recorded."}),G.map(e=>(0,B.jsx)(j.AllergyChain,{o:e,me:L},e.id)),Q.map(e=>(0,B.jsxs)(o.default,{style:{gap:4},children:[(0,B.jsxs)(r.Muted,{children:["Booking ",e.time," \xb7 ",e.name," (",e.partySize,")",e.table?` \xb7 ${(0,D.tablesLabel)(e.table)}`:'']}),(0,B.jsx)(l.DepositChip,{b:e,money:!0,testID:`staff-deposit-${e.id}`}),(0,B.jsx)(j.BookingAllergyChain,{b:e,me:L}),(0,B.jsx)(o.default,{style:{flexDirection:'row'},children:(0,B.jsx)(b.WhatsAppGuest,{b:e,rid:N.id,kind:"auto"})})]},e.id))]}):null,J?(0,B.jsxs)(r.Card,{onPress:()=>e('chat'),children:[(0,B.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsx)(r.T,{size:12,weight:"semibold",colour:u.colours.gold,children:"\ud83d\udccc PINNED IN ALL STAFF"}),(0,B.jsx)(r.Muted,{children:"Open chat \u203a"})]}),(0,B.jsx)(r.T,{size:14,children:J.text})]}):null,(0,B.jsxs)(r.Card,{children:[(0,B.jsx)(r.T,{weight:"semibold",children:"Hours this pay period"}),(0,B.jsxs)(r.T,{size:18,weight:"semibold",colour:u.colours.goldLight,children:[(0,p.hmDur)(E.paid)," paid hours"]})]}),X?(0,B.jsx)(r.Card,{onPress:()=>e('more','rota'),children:(0,B.jsxs)(r.T,{size:14,children:["You have ",X," request",X>1?'s':''," waiting for a manager \u203a"]})}):null,(0,x.visibleLinks)($,'staff').length?(0,B.jsxs)(o.default,{testID:"quick-links",style:{gap:6},children:[(0,B.jsx)(r.T,{weight:"semibold",children:"Quick links"}),(0,B.jsx)(x.QuickLinksRow,{compact:!0})]}):null,I?null:(0,B.jsx)(o.default,{style:{gap:6},children:Z.map(([e,s])=>(0,B.jsx)(r.Button,{kind:"secondary",label:e,onPress:s},e))})]})};var s=_r(d[0]),t=_r(d[1]),a=_r(d[2]),l=_r(d[3]);_r(d[4]);var n=e(_r(d[5])),o=e(_r(d[6])),r=_r(d[7]),c=_r(d[8]),h=_r(d[9]),u=_r(d[10]),f=_r(d[11]),p=_r(d[12]),m=_r(d[13]),x=_r(d[14]),j=_r(d[15]),y=_r(d[16]),b=_r(d[17]),w=_r(d[18]),k=_r(d[19]),T=_r(d[20]),C=_r(d[21]),D=_r(d[22]),S=_r(d[23]),B=_r(d[24])},958,[972,971,1318,1310,30,263,127,813,854,818,821,1352,954,1032,985,986,1019,1356,987,953,955,1449,825,989,24]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Icon=function({name:l,size:x=22,colour:t}){const n={stroke:t,strokeWidth:2,fill:'none',strokeLinecap:'round',strokeLinejoin:'round'};return(0,e.jsxs)(h.default,{width:x,height:x,viewBox:"0 0 24 24",children:['home'===l?(0,e.jsx)(s.Path,{d:"M3 11l9-7 9 7v9a1 1 0 0 1-1 1h-5v-6H9v6H4a1 1 0 0 1-1-1z",...n}):null,'orders'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"5",y:"3",width:"14",height:"18",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M9 8h6M9 12h6M9 16h4",...n})]}):null,'bookings'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4",...n})]}):null,'forecast'===l?(0,e.jsx)(s.Path,{d:"M4 20V10M10 20V4M16 20v-7M22 20H2",...n}):null,'more'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"5",cy:"12",r:"1.6",fill:t}),(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"1.6",fill:t}),(0,e.jsx)(s.Circle,{cx:"19",cy:"12",r:"1.6",fill:t})]}):null,'search'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"11",r:"7",...n}),(0,e.jsx)(s.Path,{d:"M20 20l-4-4",...n})]}):null,'bell'===l?(0,e.jsx)(s.Path,{d:"M6 16V11a6 6 0 0 1 12 0v5l2 2H4zM10 20a2 2 0 0 0 4 0",...n}):null,'chat'===l?(0,e.jsx)(s.Path,{d:"M4 5h16v11H9l-5 4z",...n}):null,'clock'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M12 7v5l3 2",...n})]}):null,'user'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"8",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M4 21a8 8 0 0 1 16 0",...n})]}):null,'walkin'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"13",cy:"4.5",r:"1.8",...n}),(0,e.jsx)(s.Path,{d:"M10 21l2-6 3 3v3M9 12l2-4 4 1 2 3M11 8l-1 5",...n})]}):null,'calendarPlus'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4M12 13v5M9.5 15.5h5",...n})]}):null,'pause'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M10 9v6M14 9v6",...n})]}):null,'rain'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M7 15a4 4 0 0 1-.6-7.95A5.5 5.5 0 0 1 17 7.5a3.75 3.75 0 0 1 .5 7.5z",...n}),(0,e.jsx)(s.Path,{d:"M9 18l-1 2.5M13 18l-1 2.5M17 18l-1 2.5",...n})]}):null,'sun'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M12 2v2M12 20v2M2 12h2M20 12h2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4",...n})]}):null,'payroll'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"4",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M7 9h6M7 13h4M15 12.5a2 2 0 1 0 0 .01M7 17h10",...n})]}):null,'tips'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M14.5 9a2.5 2.5 0 0 0-5 0c0 2.5 0 4-1.5 6h7M9 12.5h4",...n})]}):null,'sparkle'===l?(0,e.jsx)(s.Path,{d:"M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8zM19 16l.7 1.8 1.8.7-1.8.7L19 21l-.7-1.8-1.8-.7 1.8-.7z",...n}):null,'platter'===l?(0,e.jsx)(e.Fragment,{children:(0,e.jsx)(s.Path,{d:"M3 15h18M5 15a7 7 0 0 1 14 0M12 6v2M2 18h20",...n})}):null,'check'===l?(0,e.jsx)(s.Path,{d:"M5 12.5l4.5 4.5L19 7.5",...n}):null,'alert'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M12 3l9.5 17h-19z",...n}),(0,e.jsx)(s.Path,{d:"M12 10v4M12 17.2v.1",...n})]}):null,'access'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"4.5",r:"1.8",...n}),(0,e.jsx)(s.Path,{d:"M11 7.5v6h5l2.5 5M11 10h5M8 11.5a5.5 5.5 0 1 0 7.5 6.5",...n})]}):null,'dog'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 10l1-5 3 3h4l3-3 1 5v4a5 5 0 0 1-5 5h-2a5 5 0 0 1-5-5z",...n}),(0,e.jsx)(s.Path,{d:"M10 13v.1M14 13v.1M11 16h2",...n})]}):null,'leaf'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 19c0-8 5-14 15-14 0 10-6 15-14 15",...n}),(0,e.jsx)(s.Path,{d:"M5 19l8-8",...n})]}):null,'table'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"4",y:"8",width:"16",height:"8",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M8 16v4M16 16v4M8 4v4M16 4v4",...n})]}):null,'bag'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 8h14l-1 12H6z",...n}),(0,e.jsx)(s.Path,{d:"M9 10V7a3 3 0 0 1 6 0v3",...n})]}):null,'phone'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"7",y:"2.5",width:"10",height:"19",rx:"2.5",...n}),(0,e.jsx)(s.Path,{d:"M11 18.5h2",...n})]}):null,'swap'===l?(0,e.jsx)(s.Path,{d:"M7 4L3 8l4 4M3 8h14M17 20l4-4-4-4M21 16H7",...n}):null,'box'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M3.5 8L12 4l8.5 4v8L12 20l-8.5-4z",...n}),(0,e.jsx)(s.Path,{d:"M3.5 8L12 12l8.5-4M12 12v8",...n})]}):null,'star'===l?(0,e.jsx)(s.Path,{d:"M12 3.5l2.6 5.4 5.9.8-4.3 4.1 1 5.8L12 16.8l-5.2 2.8 1-5.8L3.5 9.7l5.9-.8z",...n}):null,'userPlus'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"10",cy:"8",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M3 21a7 7 0 0 1 14 0M19 8v6M16 11h6",...n})]}):null,'gift'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3.5",y:"8.5",width:"17",height:"4",rx:"1",...n}),(0,e.jsx)(s.Path,{d:"M5 12.5V20h14v-7.5M12 8.5V20M12 8.5C10 8.5 7.5 7.8 7.5 5.8S10.5 4 12 8.5c1.5-4.5 4.5-4.7 4.5-2.7S14 8.5 12 8.5z",...n})]}):null,'tag'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M3.5 12.5V4h8.5l8.5 8.5-8.5 8.5z",...n}),(0,e.jsx)(s.Circle,{cx:"8",cy:"8.5",r:"1.4",...n})]}):null,'hanger'===l?(0,e.jsx)(s.Path,{d:"M12 7.5a2 2 0 1 1 2-2M12 7.5v2L3 16.5h18L12 9.5",...n}):null]})},r(d[0]);var l,s=r(d[1]),h=(l=s)&&l.__esModule?l:{default:l},e=r(d[2])},959,[30,1005,24]); +__d(function(g,r,_i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ChatAsCtx",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"CHANNELS",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"dmId",{enumerable:!0,get:function(){return p.dmId}}),Object.defineProperty(_e,"inChannel",{enumerable:!0,get:function(){return p.inChannel}}),_e.autoPost=function(e,t){const n=new Date(globalThis.__ccNow??Date.now()).toISOString();(Array.isArray(e)?e:[e]).forEach(e=>u.useOwner.getState().sys(e,t,n))},_e.ensureChat=O,_e.useChatUnread=R,_e.Chat=function({go:e}){return(0,y.jsx)(M,{children:(0,y.jsx)(z,{go:e})})};var t=r(d[0]),n=r(d[1]),s=r(d[2]),a=r(d[3]),o=r(d[4]),i=r(d[5]),l=e(r(d[6])),c=e(r(d[7])),h=r(d[8]),u=r(d[9]),m=r(d[10]),f=r(d[11]),x=r(d[12]),b=r(d[13]),p=r(d[14]),j=r(d[15]),y=r(d[16]);const w=(0,o.createContext)(null);function C(e){const t=(0,x.useCtx)(e),n=(0,o.useContext)(w);return n?{...t,meId:n.meId,role:n.role}:t}const v=[{id:'all',name:'Team',icon:'\ud83d\udce2'},{id:'kitchen',name:'Kitchen',icon:'\ud83c\udf73',pinned:!0},{id:'foh',name:'Front of house',icon:'\ud83c\udf7d\ufe0f'},{id:'managers',name:'Managers',icon:'\ud83d\udd11'}],S=[],k=e=>(e??'').replace(' (example)','');function O(e){if(s.LIVE_VENUE_BUILD)return;if(a.IS_WILDINGS)return;const t=u.useOwner.getState();if(t.chat.some(e=>'m-seed-all'===e.id&&/this phone only/.test(e.text??''))&&u.useOwner.getState().chatPatch('m-seed-all',{text:'Welcome to the team chat on CoverCharge.'}),t.chat.length)return;const n=(t,n,s,a={})=>{return{id:`m-seed-${t}`,ch:t,from:'system',text:s,at:(o=n,new Date(e.getTime()-6e4*o).toISOString()),reactions:{},seenBy:[],...a};var o};u.useOwner.setState({chat:[n('all',5,'Welcome to the team chat on CoverCharge.',{pinned:!0}),n('kitchen',4,'Kitchen channel: Head Chef, kitchen team and managers.'),n('foh',3,'Front of house channel: front of house, bar and managers.'),n('managers',2,'Managers channel: owners, managers and the supervisor only.')]})}function R(){const{meId:e}=C(3e4),{role:t}=C(3e4),n=(0,u.useOwner)(e=>e.chat),s=(0,u.useOwner)(e=>e.staff),a=(0,u.useOwner)(t=>t.chatMuted[e]??S),i=(0,o.useMemo)(()=>T(s,e,t),[s,e,t]);return(0,o.useMemo)(()=>{const t={};return n.forEach(n=>{n.removed||n.from===e||n.seenBy.includes(e)||!(0,p.inChannel)(n.ch,i)||(t[n.ch]=(t[n.ch]??0)+1)}),{by:t,total:Object.entries(t).filter(([e])=>!a.includes(e)).reduce((e,[,t])=>e+t,0)}},[n,e,a,i])}function T(e,t,n){const s=e.find(e=>e.id===t);return s||!t?s:{id:t,name:'You',role:n,job:'',active:!0,level:'owner'===n?'Owner':'manager'===n?'Manager':'Staff',dept:''}}class M extends o.Component{state={err:null};static getDerivedStateFromError(e){return{err:String(e?.message??e)}}componentDidUpdate(e){e.resetKey!==this.props.resetKey&&this.state.err&&this.setState({err:null})}render(){return this.state.err?(0,y.jsxs)(c.default,{style:{gap:10},testID:"chat-error",children:[(0,y.jsx)(h.Banner,{kind:"warn",title:"Chat couldn\u2019t open",children:"Something went wrong showing this chat. Your messages are still saved on this phone. Go back and try again; if it keeps happening, close and reopen the app."}),(0,y.jsx)(h.Button,{kind:"secondary",label:"Back to chats",onPress:()=>{this.setState({err:null}),this.props.onBack?.()}})]}):this.props.children}}const I={owner:f.colours.gold,manager:f.colours.blue,staff:'#7a6f5c'};function P({s:e,size:n=34}){return e?(0,y.jsx)(b.StaffAvatar,{id:e.id,size:n}):(0,y.jsx)(c.default,{style:{width:n,height:n,borderRadius:n/2,backgroundColor:(0,t.soutersSurface)('#333'),alignItems:'center',justifyContent:'center'},children:(0,y.jsx)(h.T,{size:.38*n,weight:"bold",colour:"#111",children:"CC"})})}const B=[{caption:'Specials board',tone:'#4A3A22'},{caption:'Plating: Cullen skink',tone:'#3E2A2A'},{caption:'Delivery arrived',tone:'#40362A'},{caption:'Spillage by the bar',tone:'#2E2E40'}],D=['\ud83d\udc4d','\u2764\ufe0f','\ud83d\ude04','\ud83d\udc4f','\ud83d\udd25'];function E({ch:e,go:s,back:a}){const{now:b,meId:w,role:S,today:O}=C(1e4),R=(0,u.useOwner)(e=>e.staff),T=(0,u.useOwner)(e=>e.chat),M=(0,u.useOwner)(e=>e.shifts),E=T.filter(t=>t.ch===e).sort((e,t)=>e.at.localeCompare(t.at)),[z,A]=(R.find(e=>e.id===w),(0,o.useState)('')),[L,$]=(0,o.useState)(null),[N,_]=(0,o.useState)(!1),[W,H]=(0,o.useState)(!1),K=e.startsWith('dm:')?e.split(':').slice(1).length:R.filter(t=>t.active&&(0,p.inChannel)(e,t)).length;(0,o.useEffect)(()=>{u.useOwner.getState().chatSeen(e,w)},[e,w,E.length]);const U=t=>u.useOwner.getState().chatSend({ch:e,from:w,at:b.toISOString(),...t});(0,i.useBackLayer)(!0,a);const Y=E.filter(e=>e.pinned&&!e.removed),V=e.startsWith('dm:')?k(R.find(t=>t.id===e.split(':').slice(1).find(e=>e!==w))?.name):v.find(t=>t.id===e)?.name,F=(0,j.useChatSync)(e=>e.synced),q=M.filter(e=>e.staffId===w&&e.published&&e.date>=O).sort((e,t)=>e.date.localeCompare(t.date)).slice(0,10);return(0,y.jsxs)(c.default,{style:{gap:8},children:[(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(i.BackButton,{onPress:a,testID:"chat-thread-back"}),(0,y.jsxs)(c.default,{style:{flex:1,alignItems:'flex-end'},children:[(0,y.jsx)(h.T,{weight:"semibold",size:18,children:V}),(0,y.jsxs)(h.Muted,{children:[K," members"]})]})]}),Y.map(e=>(0,y.jsxs)(h.Card,{highlight:f.colours.gold,children:[(0,y.jsxs)(h.T,{size:12,colour:f.colours.gold,children:["\ud83d\udccc ",'system'===e.from?'Pinned note':`Pinned by ${k(R.find(t=>t.id===e.from)?.name)}`]}),(0,y.jsx)(h.T,{size:14,children:e.text})]},e.id)),E.map((n,a)=>{const o=R.find(e=>e.id===n.from),i=n.from===w,x=n.seenBy.filter(e=>e!==n.from).length,b=0===a||n.at.slice(0,10)!==E[a-1].at.slice(0,10);return'system'===n.from?(0,y.jsxs)(c.default,{style:{alignItems:'center',gap:2},children:[b?(0,y.jsx)(h.Muted,{children:(0,m.niceDate)(new Date(n.at))}):null,(0,y.jsx)(c.default,{style:{backgroundColor:(0,t.soutersSurface)('#1c1a14'),borderRadius:10,paddingHorizontal:10,paddingVertical:5,borderWidth:1,borderColor:f.colours.border},children:(0,y.jsxs)(h.T,{size:13,colour:/Allergy|86|Sold out/.test(n.text??'')?f.colours.amber:f.colours.muted,children:["CoverCharge \xb7 ",n.text," \xb7 ",(0,m.hm)(new Date(n.at))]})})]},n.id):(0,y.jsxs)(c.default,{style:{gap:2},children:[b?(0,y.jsx)(h.Muted,{center:!0,children:(0,m.niceDate)(new Date(n.at))}):null,(0,y.jsxs)(h.Row,{style:{alignItems:'flex-start',flexDirection:i?'row-reverse':'row'},children:[(0,y.jsx)(P,{s:o}),(0,y.jsxs)(l.default,{accessibilityRole:"button",accessibilityLabel:`Message from ${o?.name}`,onPress:()=>$(L===n.id?null:n.id),style:{maxWidth:'78%',backgroundColor:i?'#3a2f12':f.colours.surface,borderRadius:14,padding:9,borderWidth:1,borderColor:n.pinned?f.colours.gold:f.colours.border,gap:3},children:[(0,y.jsxs)(h.Row,{gap:6,children:[(0,y.jsx)(h.T,{size:12,weight:"semibold",colour:o?I[o.role]:f.colours.muted,children:k(o?.name)}),(0,y.jsxs)(h.T,{size:11,colour:f.colours.muted,children:[o?u.ROLE_LABEL[o.role]:''," \xb7 ",(0,m.hm)(new Date(n.at))]})]}),n.removed?(0,y.jsx)(h.T,{size:14,colour:f.colours.muted,children:"Message removed by the owner"}):(0,y.jsxs)(y.Fragment,{children:[n.photo?(0,y.jsx)(c.default,{style:{width:200,height:120,borderRadius:10,backgroundColor:n.photo.tone,justifyContent:'flex-end',padding:6},children:(0,y.jsxs)(h.T,{size:12,children:[n.photo.caption," (example image)"]})}):null,n.text?(0,y.jsx)(h.T,{size:15,children:n.text}):null,'cover'===n.action?(0,y.jsx)(h.Button,{small:!0,kind:"secondary",label:"Open cover requests on the rota",onPress:()=>s('more','rota')}):null]}),Object.entries(n.reactions).filter(([,e])=>e.length).length?(0,y.jsx)(h.Row,{wrap:!0,gap:4,children:Object.entries(n.reactions).filter(([,e])=>e.length).map(([e,t])=>(0,y.jsx)(c.default,{style:{borderRadius:10,paddingHorizontal:6,backgroundColor:t.includes(w)?'#4a3c16':'#222'},children:(0,y.jsxs)(h.T,{size:12,children:[e," ",t.length]})},e))}):null,i?(0,y.jsx)(h.T,{size:11,colour:f.colours.muted,children:x?`Seen by ${x}`:'Sent'}):null]})]}),L!==n.id||n.removed?null:(0,y.jsxs)(h.Row,{wrap:!0,gap:6,style:{justifyContent:i?'flex-end':'flex-start',paddingLeft:i?0:40},children:[D.map(e=>(0,y.jsx)(l.default,{accessibilityLabel:`React ${e}`,onPress:()=>{u.useOwner.getState().chatReact(n.id,e,w),$(null)},style:{padding:4},children:(0,y.jsx)(h.T,{size:20,children:e})},e)),'staff'===S||e.startsWith('dm:')?null:(0,y.jsx)(h.Button,{small:!0,kind:"ghost",label:n.pinned?'Unpin':'Pin',onPress:()=>{u.useOwner.getState().chatPatch(n.id,{pinned:!n.pinned}),$(null)}}),'owner'!==S||i?null:(0,y.jsx)(h.Button,{small:!0,kind:"danger",label:"Remove",onPress:()=>{u.useOwner.getState().chatPatch(n.id,{removed:!0,pinned:!1}),$(null)}})]})]},n.id)}),(0,y.jsxs)(h.Row,{gap:6,children:[(0,y.jsx)(l.default,{accessibilityRole:"button",accessibilityLabel:"Send a photo",onPress:()=>_(!0),style:{padding:8},children:(0,y.jsx)(h.T,{size:20,children:"\ud83c\udf9e\ufe0f"})}),(0,y.jsx)(n.TextInput,{accessibilityLabel:"Message",placeholder:`Message ${V}`,placeholderTextColor:"#7D776C",value:z,onChangeText:A,style:[h.styles.input,{flex:1}]}),(0,y.jsx)(h.Button,{small:!0,label:"Send",disabled:!z.trim(),onPress:()=>{U({text:z.trim()}),A('')}})]}),(0,y.jsx)(h.Row,{wrap:!0,gap:6,children:(0,y.jsx)(h.Button,{small:!0,kind:"secondary",label:"Ask for shift cover",onPress:()=>H(!0)})}),F?null:(0,y.jsx)(h.Muted,{center:!0,children:"Not shared yet: this message stays on this phone only. Nobody else will see it."}),(0,y.jsx)(h.Sheet,{visible:N,onClose:()=>_(!1),title:"Send a photo",children:(0,y.jsx)(h.Row,{wrap:!0,gap:8,children:B.map(e=>(0,y.jsx)(l.default,{accessibilityRole:"button",accessibilityLabel:e.caption,onPress:()=>{U({photo:e}),_(!1)},style:{width:'47%',height:100,borderRadius:10,backgroundColor:e.tone,justifyContent:'flex-end',padding:6},children:(0,y.jsx)(h.T,{size:12,children:e.caption})},e.caption))})}),(0,y.jsxs)(h.Sheet,{visible:W,onClose:()=>H(!1),title:"Ask for shift cover",children:[q.length?null:(0,y.jsx)(h.Muted,{children:"You have no shifts on the rota this week."}),q.map(e=>(0,y.jsx)(h.Button,{kind:"secondary",label:`${x.DAY3[e.day]} ${Number(e.date.slice(8))} ${(0,x.fmtH)(e.start)}\u2013${(0,x.fmtH)(e.end)}`,onPress:()=>{const t=`${x.DAY3[e.day]} ${Number(e.date.slice(8))} ${(0,x.fmtH)(e.start)}\u2013${(0,x.fmtH)(e.end)}`;u.useOwner.getState().addSwap({shiftId:e.id,fromId:w,kind:'cover',note:`Cover asked in chat for ${t}`}),U({text:`Can anyone cover my ${t} shift? I\u2019ve added a cover request on the rota.`,action:'cover'}),H(!1)}},e.id)),(0,y.jsx)(h.Muted,{children:"Creates a cover request in Rota \u203a Swaps & leave for a manager to approve."})]})]})}function z({go:e}){const{now:n,meId:s,role:a}=C(3e4),i=(0,u.useOwner)(e=>e.staff),x=(0,u.useOwner)(e=>e.chat),b=(0,u.useOwner)(e=>e.chatMuted[s]??S),{by:w}=R(),I=(0,j.useChatSync)(e=>e.synced),B=(0,j.useChatSync)(e=>e.error),D=(0,p.useKitchenExtra)(e=>e.extra),[z,A]=(0,o.useState)(null),[L,$]=(0,o.useState)(!1),[N,_]=(0,o.useState)(!1);(0,o.useEffect)(()=>{O(n)},[]),(0,o.useEffect)(()=>{A(null)},[s]);const W=T(i,s,a);if(z)return(0,y.jsx)(M,{resetKey:z,onBack:()=>A(null),children:(0,y.jsx)(E,{ch:z,go:e,back:()=>A(null)})});const H=e=>x.filter(t=>t.ch===e).sort((e,t)=>t.at.localeCompare(e.at))[0],K=i.filter(e=>e.active&&e.id!==s).map(e=>{const t=(0,p.dmId)(s,e.id);return{x:e,id:t,u:w[t]??0,l:H(t)?.at??''}}).sort((e,t)=>t.u-e.u||t.l.localeCompare(e.l)||k(e.x.name).localeCompare(k(t.x.name))),U='owner'===a||'manager'===a,Y=({id:e,name:n,icon:s,avatar:a})=>{const o=H(e),u=w[e]??0,x=b.includes(e);return(0,y.jsx)(l.default,{accessibilityRole:"button",accessibilityLabel:`Open ${n}`,onPress:()=>A(e),style:{padding:12,borderTopWidth:1,borderColor:f.colours.border},children:(0,y.jsxs)(h.Row,{children:[a?(0,y.jsx)(P,{s:a}):(0,y.jsx)(c.default,{style:{width:34,height:34,borderRadius:17,backgroundColor:(0,t.soutersSurface)('#222'),alignItems:'center',justifyContent:'center'},children:(0,y.jsx)(h.T,{size:16,children:s})}),(0,y.jsxs)(c.default,{style:{flex:1},children:[(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsxs)(h.T,{weight:u?'bold':'medium',children:[n,x?' \ud83d\udd15':'']}),o?(0,y.jsx)(h.Muted,{children:(0,m.hm)(new Date(o.at))}):null]}),(0,y.jsx)(h.Muted,{numberOfLines:1,children:o?o.removed?'Message removed':`${'system'===o.from?'CoverCharge':k(i.find(e=>e.id===o.from)?.name)}: ${o.text??'Photo'}`:'No messages yet'})]}),u?(0,y.jsx)(c.default,{style:{backgroundColor:x?'#555':f.colours.red,borderRadius:10,minWidth:20,height:20,alignItems:'center',justifyContent:'center',paddingHorizontal:5},children:(0,y.jsx)(h.T,{size:11,weight:"bold",children:u})}):null]})})};return(0,y.jsxs)(c.default,{style:{gap:10},children:[I?(0,y.jsx)(c.default,{testID:"chat-synced",children:(0,y.jsx)(h.Muted,{children:"\u2713 Shared with the team: messages reach everyone in the chat on their own phone."})}):(0,y.jsx)(h.Banner,{kind:"warn",title:"On this device only for now",children:"You\u2019re not connected with your personal link (or chat sharing isn\u2019t switched on yet), so anything you send stays on this device and nobody else will see it. Open your personal invite link to share chat with the team. Use your usual group chat for anything urgent."}),I&&B?(0,y.jsx)(c.default,{testID:"chat-sync-error",children:(0,y.jsx)(h.Banner,{kind:"warn",title:"Can\u2019t reach the server right now",children:"Showing the messages on this phone. New messages will be sent and others\u2019 messages will appear when the connection is back; it retries automatically."})}):null,(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsxs)(h.Muted,{children:["Signed in as ",k(W?.name)," (",'Head Chef'===W?.level?'Head Chef':u.ROLE_LABEL[a],")"]}),(0,y.jsx)(h.Button,{small:!0,kind:"ghost",label:"Chat settings",onPress:()=>_(!0)})]}),(0,y.jsxs)(c.default,{style:{borderRadius:14,borderWidth:1,borderColor:f.colours.border,backgroundColor:f.colours.surface,overflow:'hidden'},children:[(0,y.jsx)(h.T,{size:12,weight:"semibold",colour:f.colours.gold,style:{padding:10},children:"TEAM CHATS"}),v.filter(e=>'all'===e.id||(0,p.inChannel)(e.id,W)).map(e=>(0,y.jsx)(Y,{id:e.id,name:e.pinned?`${e.name} \ud83d\udccc`:e.name,icon:e.icon},e.id))]}),(0,y.jsxs)(c.default,{style:{borderRadius:14,borderWidth:1,borderColor:f.colours.border,backgroundColor:f.colours.surface,overflow:'hidden'},children:[(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between',padding:10},children:[(0,y.jsx)(h.T,{size:12,weight:"semibold",colour:f.colours.gold,children:"PRIVATE MESSAGES"}),(0,y.jsx)(h.Button,{small:!0,kind:"success",label:"New message",testID:"chat-new-pm",onPress:()=>$(!0)})]}),K.map(e=>(0,y.jsx)(Y,{id:e.id,name:k(e.x.name),avatar:e.x},e.id)),K.length?null:(0,y.jsx)(h.Muted,{style:{padding:10},children:"Nobody else on the team yet."})]}),(0,y.jsx)(h.Muted,{children:"Private messages can only be read by the two people in them; owners and managers can\u2019t read other people\u2019s private messages. The Kitchen chat is for owners, managers, head chefs and kitchen staff, and can\u2019t be left."}),(0,y.jsx)(h.Sheet,{visible:L,onClose:()=>$(!1),title:"New private message",children:i.filter(e=>e.active&&e.id!==s).map(e=>(0,y.jsx)(l.default,{accessibilityRole:"button",accessibilityLabel:`Message ${e.name}`,onPress:()=>{$(!1),A((0,p.dmId)(s,e.id))},style:{paddingVertical:8},children:(0,y.jsxs)(h.Row,{children:[(0,y.jsx)(P,{s:e}),(0,y.jsxs)(c.default,{children:[(0,y.jsx)(h.T,{children:k(e.name)}),(0,y.jsxs)(h.Muted,{children:[u.ROLE_LABEL[e.role]," \xb7 ",e.job]})]})]})},e.id))}),(0,y.jsxs)(h.Sheet,{visible:N,onClose:()=>_(!1),title:"Chat settings",children:[(0,y.jsx)(h.Banner,{kind:"info",title:"Privacy",children:"Chat is for work. Managers and the owner see messages in the channels they belong to and the owner can remove messages in group chats. Private messages can only be read by the two people in them: the server enforces this, so nobody else (not even the owner) can read them. Don\u2019t share customer card or health details beyond what\u2019s needed for service."}),(0,y.jsx)(h.T,{weight:"semibold",children:"Mute channels"}),v.filter(e=>(0,p.inChannel)(e.id,W)).map(e=>(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsxs)(h.T,{children:[e.icon," ",e.name]}),(0,y.jsx)(h.Toggle,{label:`Mute ${e.name}`,value:b.includes(e.id),onChange:()=>u.useOwner.getState().chatMute(s,e.id)})]},e.id)),(0,y.jsx)(h.Muted,{children:"Muted channels don\u2019t count towards the tab badge. The Kitchen chat can be muted but not left."}),U?(0,y.jsxs)(c.default,{style:{gap:6},testID:"kitchen-members",children:[(0,y.jsx)(h.T,{weight:"semibold",children:"Kitchen chat members"}),(0,y.jsxs)(h.Muted,{children:["Automatic: owners, managers, head chefs and kitchen staff (chefs, kitchen porters). Change who else is in it here",I?'':'; saved on this device for now',"."]}),i.filter(e=>e.active).map(e=>{const t=D[e.id]??(0,p.kitchenByRule)(e);return(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsxs)(h.T,{children:[k(e.name),null!=D[e.id]?' (changed)':'']}),(0,y.jsx)(h.Toggle,{label:`Kitchen chat: ${k(e.name)}`,value:t,onChange:t=>p.useKitchenExtra.getState().set(e.id,t===(0,p.kitchenByRule)(e)?null:t)})]},e.id)})]}):null]})]})}},960,[878,874,833,5,30,947,263,127,813,854,818,821,954,955,1223,1222,24]); +__d(function(g,_r,i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ASSISTANT_AVAILABLE",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"useAssistantUi",{enumerable:!0,get:function(){return S}}),_e.AssistantFab=function(){const{role:e}=(0,j.useCtx)(6e4),t=(0,x.useAssistant)(e=>e.enabled);return T(e)&&t?(0,k.jsxs)(r.default,{testID:"assistant-fab",accessibilityRole:"button",accessibilityLabel:"Assistant",onPress:()=>S.getState().setOpen(!0),style:{position:'absolute',right:16,bottom:78,height:56,minWidth:56,paddingHorizontal:16,borderRadius:28,backgroundColor:y.colours.gold,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:6,zIndex:50,boxShadow:'0 4px 14px rgba(0,0,0,0.5)'},children:[(0,k.jsx)(I,{size:22}),(0,k.jsx)(h.T,{weight:"bold",colour:A,children:"Assistant"})]}):null},_e.AssistantSheet=function(){const e=S(e=>e.open),s=()=>S.getState().setOpen(!1),{rid:n,role:u,me:w}=(0,j.useCtx)(3e4),A=(0,x.useAssistant)(),B=R(),[P,O]=(0,o.useState)([]),[E,L]=(0,o.useState)(''),[z,W]=(0,o.useState)(!1),$=(0,o.useRef)(null),_=(0,o.useRef)(null);if((0,o.useEffect)(()=>{setTimeout(()=>$.current?.scrollToEnd?.({animated:!0}),50)},[P.length]),!e||!T(u))return null;const N=(e,t,s)=>x.useAssistant.getState().record({at:(new Date).toISOString(),by:w,role:u,asked:e,action:t,outcome:s}),H=(e,t="result")=>O(s=>[...s,{id:v(),from:'assistant',text:e,kind:t}]),F=async e=>{const t=e.trim();if(!t)return;let s;L(''),O(e=>[...e,{id:v(),from:'you',text:t}]);try{s=await(0,m.getProvider)('xai').interpret(t,B)}catch(e){s={kind:'unknown',message:String(e.message),suggestions:[]}}'unknown'===s.kind&&N(t,'\u2014','not understood'),O(e=>[...e,{id:v(),from:'assistant',proposal:s,state:'open',asked:t}])},U=(e,t)=>O(s=>s.map(s=>s.id===e?{...s,state:t}:s)),V=async(e,t,s)=>{if(U(e.id,'confirmed'),'external'===t.kind)return N(e.asked,`${t.title}: \u201c${(s??t.text).slice(0,120)}\u201d`,'demo (nothing sent)'),void H(C,'demo');if('inapp'!==t.kind)return;const o=t.params;switch(t.intent){case'walkin':{const s=String(o.table||'')||void 0;await b.repo.bookings.seatWalkIn(n,Number(o.party),s,'Added by Assistant'),s&&(0,p.resetTableLive)(n,s),H(`Done: Walk-in \xb7 ${o.party} seated${s?` at table ${s}`:' (table to assign)'}. It's in Bookings now.`),N(e.asked,t.title,'done');break}case'eightysix':await b.repo.menu.updateItem(String(o.itemId),{soldOut:Boolean(o.soldOut)}),H(o.soldOut?`Done: ${o.name} is marked sold out. Staff see it on the Display.`:`Done: ${o.name} is back on.`),N(e.asked,t.title,'done');break;case'price':await b.repo.menu.updateItem(String(o.itemId),{price:Number(o.pence)}),H(`Done: ${o.name} is now \xa3${(Number(o.pence)/100).toFixed(2)}.`),N(e.asked,t.title,'done');break;case'offer':f.useOwner.getState().addOffer({title:String(o.title),body:String(o.body),kind:'offer',live:!1}),H(`Done: draft offer \u201c${o.title}\u201d saved in Offers & specials (not live).`),N(e.asked,t.title,'done');break;case'rota':case'bookings':H(String(o.result)),N(e.asked,t.title,'looked up')}},G=e=>{U(e.id,'cancelled'),N(e.asked,e.proposal?.title??'\u2014','cancelled'),H('Cancelled. Nothing was changed.','note')},q='lite'===A.tier,Y=(0,x.tasksUsed)(A);return(0,k.jsx)(a.default,{visible:!0,transparent:!0,animationType:"fade",onRequestClose:s,children:(0,k.jsx)(c.default,{style:[h.styles.overlay,{justifyContent:'flex-end',padding:0}],children:(0,k.jsxs)(c.default,{testID:"assistant-sheet",style:{backgroundColor:y.colours.surface,borderTopLeftRadius:18,borderTopRightRadius:18,borderWidth:1,borderColor:y.colours.border,width:'100%',maxWidth:640,alignSelf:'center',maxHeight:'92%',minHeight:'70%',padding:14,gap:10},children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsxs)(h.Row,{gap:8,style:{flex:1},children:[(0,k.jsx)(c.default,{style:{width:34,height:34,borderRadius:17,backgroundColor:y.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,k.jsx)(I,{size:18})}),(0,k.jsx)(h.T,{size:20,weight:"semibold",children:"Assistant"})]}),(0,k.jsx)(r.default,{accessibilityLabel:"Close",onPress:s,hitSlop:10,children:(0,k.jsx)(h.T,{size:22,colour:y.colours.muted,children:"\u2715"})})]}),(0,k.jsx)(c.default,{testID:"assistant-demo-badge",children:(0,k.jsx)(h.Badge,{kind:"amber",label:"Demo mode \xb7 the secure AI server isn\u2019t connected yet"})}),q?(0,k.jsxs)(c.default,{testID:"assistant-upgrade",style:{gap:10},children:[(0,k.jsx)(h.Banner,{kind:"info",title:"The Assistant is switched off in this preview",children:"Ask for things in plain English \u2014 add a walk-in, mark a dish sold out, check the rota, draft posts and replies \u2014 and confirm each one before anything happens. To use it, turn off the preview switch in More \u203a Account \u203a Assistant settings."}),(0,k.jsx)(h.Button,{kind:"secondary",label:"Close",onPress:s})]}):(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(l.default,{ref:$,style:{flex:1},contentContainerStyle:{gap:10,paddingBottom:6},keyboardShouldPersistTaps:"handled",children:[0===P.length?(0,k.jsxs)(c.default,{style:{gap:8},testID:"suggested-prompts",children:[(0,k.jsxs)(h.T,{children:["Hi ",w.split(' ')[0]," \u2014 what can I do? I\u2019ll always show you what I\u2019m about to do and wait for you to confirm."]}),(0,k.jsx)(h.Muted,{children:"Try:"}),m.SUGGESTED_PROMPTS.map(e=>(0,k.jsx)(r.default,{accessibilityRole:"button",accessibilityLabel:`Suggestion: ${e}`,onPress:()=>F(e),style:{borderWidth:1,borderColor:y.colours.border,borderRadius:12,paddingVertical:9,paddingHorizontal:12,backgroundColor:y.colours.surface2},children:(0,k.jsx)(h.T,{size:14,children:e})},e))]}):null,P.map(e=>'you'===e.from?(0,k.jsx)(c.default,{style:{alignSelf:'flex-end',maxWidth:'85%',backgroundColor:'#3A2F12',borderRadius:14,padding:10},children:(0,k.jsx)(h.T,{children:e.text})},e.id):e.proposal?'inapp'===e.proposal.kind||'external'===e.proposal.kind?(0,k.jsx)(D,{m:e,onConfirm:(t,s)=>V(e,t,s),onCancel:()=>G(e)},e.id):'choose'===e.proposal.kind?(0,k.jsxs)(c.default,{style:{gap:6},children:[(0,k.jsx)(h.T,{children:e.proposal.message}),(0,k.jsx)(h.Row,{wrap:!0,gap:6,children:e.proposal.options.map(e=>(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:e.label,onPress:()=>F(e.prompt)},e.label))})]},e.id):(0,k.jsxs)(c.default,{testID:"assistant-unknown",style:{gap:6},children:[(0,k.jsx)(h.T,{children:e.proposal.message}),e.proposal.suggestions.map(e=>(0,k.jsx)(r.default,{accessibilityRole:"button",onPress:()=>F(e),style:{borderWidth:1,borderColor:y.colours.border,borderRadius:12,padding:8},children:(0,k.jsx)(h.T,{size:14,children:e})},e))]},e.id):(0,k.jsx)(c.default,{testID:'demo'===e.kind?'assistant-demo-note':'assistant-result',style:{alignSelf:'flex-start',maxWidth:'92%',backgroundColor:'demo'===e.kind?y.colours.amberBg:y.colours.surface2,borderRadius:14,padding:10,borderWidth:'demo'===e.kind?1:0,borderColor:y.colours.amber},children:(0,k.jsx)(h.T,{children:e.text})},e.id))]}),(0,k.jsxs)(h.Row,{gap:8,children:[(0,k.jsx)(t.TextInput,{accessibilityLabel:"Ask the Assistant",placeholder:"Ask in plain English\u2026",placeholderTextColor:"#7D776C",value:E,onChangeText:L,onSubmitEditing:()=>F(E),returnKeyType:"send",style:[h.styles.input,{flex:1,minWidth:0,width:40}]}),A.voice?(0,k.jsx)(r.default,{testID:"assistant-mic",accessibilityRole:"button",accessibilityLabel:z?'Stop listening':'Speak',onPress:()=>{const e=M();if(e)if(z)_.current?.stop?.();else try{const t=new e;_.current=t,t.lang='en-GB',t.interimResults=!1,t.maxAlternatives=1,t.onresult=e=>{const t=e.results?.[0]?.[0]?.transcript;t&&L(t)},t.onend=()=>W(!1),t.onerror=()=>{W(!1),H("Sorry, I didn't catch that. You can type instead.",'note')},W(!0),t.start()}catch{W(!1),H("Voice input isn't available here. Please type instead.",'note')}else H("Voice input isn't available in this browser (for example Huawei Browser). Please type your request instead.",'note')},style:{width:48,height:48,borderRadius:24,borderWidth:1.5,borderColor:y.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:z?y.colours.gold:'transparent'},children:(0,k.jsx)(h.T,{size:20,children:"\ud83c\udfa4"})}):null,(0,k.jsx)(h.Button,{label:"Send",accessibilityLabel:"Send",disabled:!E.trim(),onPress:()=>F(E)})]}),(0,k.jsxs)(h.Muted,{center:!0,children:["Demo on this device \xb7 ",Y," of ",x.FAIR_USE," tasks this month \xb7 nothing is sent automatically"]})]})]})})})},_e.AssistantPage=function({go:e}){const{role:t}=(0,j.useCtx)(6e4),s=(0,x.useAssistant)();return T(t)?(0,k.jsxs)(c.default,{style:{gap:12},children:[(0,k.jsxs)(h.Card,{children:[(0,k.jsxs)(h.Row,{gap:10,children:[(0,k.jsx)(c.default,{style:{width:44,height:44,borderRadius:22,backgroundColor:y.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,k.jsx)(I,{size:22})}),(0,k.jsxs)(c.default,{style:{flex:1},children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Ask for things in plain English"}),(0,k.jsx)(h.Muted,{children:"Add walk-ins, mark dishes sold out, change prices, check the rota or bookings, draft offers, posts and replies. You confirm every action."})]})]}),(0,k.jsx)(h.Button,{label:s.enabled?'Open Assistant':'Assistant is off',disabled:!s.enabled,testID:"open-assistant",onPress:()=>S.getState().setOpen(!0)}),(0,k.jsx)(h.Button,{small:!0,kind:"ghost",label:"Assistant settings \u203a",onPress:()=>e('more','assistantsettings')})]}),'owner'===t?(0,k.jsxs)(c.default,{testID:"assistant-log",style:{gap:6},children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Activity log"}),s.log.length?(0,k.jsx)(h.Button,{small:!0,kind:"ghost",label:"Clear",onPress:()=>x.useAssistant.getState().clearLog()}):null]}),(0,k.jsx)(h.Muted,{children:"What was asked and what was confirmed, on this device. Visible to the owner."}),0===s.log.length?(0,k.jsx)(h.Muted,{children:"Nothing yet."}):s.log.map(e=>(0,k.jsxs)(c.default,{style:{borderWidth:1,borderColor:y.colours.border,borderRadius:12,padding:10,gap:2},children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsxs)(h.T,{size:12,colour:y.colours.muted,children:[new Date(e.at).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})," \xb7 ",e.by," (",e.role,")"]}),(0,k.jsx)(h.Badge,{kind:'done'===e.outcome||'looked up'===e.outcome?'ok':'demo (nothing sent)'===e.outcome?'amber':'neutral',label:e.outcome})]}),(0,k.jsxs)(h.T,{size:14,children:["Asked: \u201c",e.asked,"\u201d"]}),(0,k.jsxs)(h.T,{size:13,colour:y.colours.muted,children:["Action: ",e.action]})]},e.id))]}):(0,k.jsx)(h.Muted,{children:"The activity log is visible to the owner."})]}):(0,k.jsx)(h.Banner,{kind:"info",title:"Owners and managers only",children:"The Assistant is for owners and managers."})},_e.AssistantSettings=function(){const{role:e}=(0,j.useCtx)(6e4),t=(0,x.useAssistant)();return T(e)?(0,k.jsxs)(c.default,{style:{gap:12},testID:"assistant-settings",children:[(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(h.Toggle,{label:"Assistant on",value:t.enabled,onChange:e=>t.set({enabled:e})}),(0,k.jsx)(h.Muted,{children:"Shows the gold Assistant button on every Managers screen."}),(0,k.jsx)(h.Toggle,{label:"Voice input (microphone)",value:t.voice,onChange:e=>t.set({voice:e})}),(0,k.jsx)(h.Muted,{children:"What you say is sent to Grok (xAI) to be turned into text. CoverCharge doesn\u2019t keep the audio. If this device can\u2019t record, just type."})]}),(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Connected services"}),B.map(e=>(0,k.jsxs)(c.default,{testID:`service-${e.id}`,style:{gap:2,borderTopWidth:1,borderColor:y.colours.border,paddingTop:8},children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(h.T,{children:e.name}),(0,k.jsx)(h.Badge,{kind:"neutral",label:"Not connected"})]}),(0,k.jsxs)(h.Muted,{children:["Needed for ",e.does,". Until it\u2019s connected, the Assistant only shows you a preview \u2014 nothing is sent or changed."]})]},e.id)),(0,k.jsx)(h.Muted,{children:"Connecting accounts isn\u2019t available yet."})]}),'owner'===e?(0,k.jsxs)(h.Card,{children:[(0,k.jsx)(h.Toggle,{label:"Preview the app with the Assistant switched off",value:'lite'===t.tier,onChange:e=>t.set({tier:e?'lite':'pro'})}),(0,k.jsx)(h.Muted,{children:"The Assistant is included for every venue. This switch only shows how the app looks with it switched off."})]}):null,(0,k.jsx)(h.Muted,{children:"Every action needs your confirmation; nothing is ever sent automatically. If the assistant here doesn\u2019t understand, your words go to the voice assistant to work out what you meant. Nothing changes until you tap Confirm."})]}):(0,k.jsx)(h.Banner,{kind:"info",title:"Owners and managers only",children:"The Assistant is for owners and managers."})},_e.AssistantPlanCard=function(){const e=(0,x.useAssistant)(),t=(0,x.tasksUsed)(e),s=Math.min(1,t/x.FAIR_USE);return(0,k.jsxs)(h.Card,{children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(h.T,{weight:"semibold",children:"Assistant: fair use 300 tasks/month"}),(0,k.jsx)(h.Badge,{kind:s>.9?'red':'gold',label:'lite'===e.tier?'Switched off':'Included'})]}),(0,k.jsx)(c.default,{testID:"assistant-usage",accessibilityLabel:`${t} of ${x.FAIR_USE} tasks used`,style:{height:8,backgroundColor:y.colours.border,borderRadius:4},children:(0,k.jsx)(c.default,{style:{height:8,width:`${Math.round(100*s)}%`,backgroundColor:y.colours.gold,borderRadius:4}})}),(0,k.jsxs)(h.Muted,{children:[t," of ",x.FAIR_USE," tasks used this month (mock). A task is one confirmed action or look-up."]})]})};var t=_r(d[0]),s=_r(d[1]),n=_r(d[2]),o=_r(d[3]),a=e(_r(d[4]));_r(d[5]);var r=e(_r(d[6])),l=e(_r(d[7])),c=e(_r(d[8])),u=_r(d[9]),h=_r(d[10]),p=_r(d[11]),b=_r(d[12]),f=_r(d[13]),m=_r(d[14]),x=_r(d[15]),y=_r(d[16]),j=_r(d[17]),k=_r(d[18]);const w=!0,C='Nothing was sent or changed: this connection is not set up yet.',A='#1A1408',S=(0,u.create)(e=>({open:!1,setOpen:t=>e({open:t})})),T=e=>'owner'===e||'manager'===e,v=()=>Math.random().toString(36).slice(2,9);function I({size:e=24,colour:t=A}){return(0,k.jsx)(h.T,{size:e,weight:"bold",colour:t,style:{lineHeight:1.1*e},children:"\u2726"})}function R(){const{rid:e,r:t,now:n,today:a}=(0,j.useCtx)(3e4),r=(0,b.useAllMenu)(e),l=(0,p.useTableNames)(e),c=(0,b.useBookings)(e),u=(0,f.useOwner)(e=>e.staff),h=(0,f.useOwner)(e=>e.shifts),m=(0,f.useOwner)(e=>e.offers),x=(0,f.useOwner)(e=>e.suppliers);return(0,o.useMemo)(()=>({venue:t.name,now:n.toISOString(),menu:r.map(e=>({id:e.id,name:e.name,price:e.price,soldOut:e.soldOut})),tables:l,staff:u.filter(e=>e.active).map(e=>({id:e.id,name:e.name,job:e.job})),shifts:h.filter(e=>e.published&&e.date>=(0,f.addDays)(a,-(0,f.weekdayOf)(a))&&e.date<=(0,f.addDays)(a,6-(0,f.weekdayOf)(a))),bookingsToday:c.filter(e=>e.date===a).sort((e,t)=>e.time.localeCompare(t.time)).map(e=>({name:e.walkIn?'Walk-in':e.name,party:e.partySize,time:e.time,table:e.table,status:e.status})),specials:m.filter(e=>'special'===e.kind&&e.live).map(e=>({title:e.title,body:e.body})),kitchenHours:t.kitchenHours,latestSupplierEmail:(0,s.examplesAllowed)()?{from:`${x[0]?.contact??'Alex Sample'}, ${x[0]?.name??'Example Fish Co.'}`,subject:'Price update for next week (example)',body:'Langoustine is up about 8% next week because of the weather. Haddock and hake unchanged. Same delivery days.'}:null}),[t,n.getMinutes(),r,l,c,u,h,m,x])}function D({m:e,onConfirm:s,onCancel:n}){const a=e.proposal,[r,l]=(0,o.useState)(!1),[u,p]=(0,o.useState)('external'===a.kind?a.text:''),b='open'===e.state;return'inapp'!==a.kind&&'external'!==a.kind?null:(0,k.jsxs)(c.default,{testID:"confirm-card",style:{borderWidth:1.5,borderColor:b?y.colours.gold:y.colours.border,borderRadius:14,padding:12,gap:8,backgroundColor:y.colours.surface2},children:[(0,k.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(h.T,{weight:"semibold",style:{flex:1},children:a.title}),'external'===a.kind?(0,k.jsx)(h.Badge,{kind:"amber",label:"Demo \xb7 not connected"}):(0,k.jsx)(h.Badge,{kind:"gold",label:"In CoverCharge"})]}),'external'===a.kind?(0,k.jsxs)(c.default,{style:{gap:6},children:[a.detail?(0,k.jsx)(h.Muted,{children:a.detail}):null,(0,k.jsx)(h.T,{size:14,colour:y.colours.muted,children:a.label}),r&&b?(0,k.jsx)(t.TextInput,{accessibilityLabel:"Edit text",multiline:!0,value:u,onChangeText:p,style:[h.styles.input,{minHeight:90,textAlignVertical:'top'}]}):(0,k.jsx)(c.default,{testID:"preview-text",style:{borderLeftWidth:3,borderColor:y.colours.gold,paddingLeft:10},children:(0,k.jsxs)(h.T,{children:["\u201c",u,"\u201d"]})}),(0,k.jsxs)(h.Muted,{children:["Sends to: ",a.service.map(e=>m.SERVICE_LABEL[e]).join(' & ')," \u2014 not connected, so nothing will be sent."]})]}):(0,k.jsxs)(c.default,{style:{gap:4},children:[(0,k.jsx)(h.Muted,{children:a.detail}),a.warning?(0,k.jsxs)(h.T,{size:13,colour:y.colours.amber,children:["\u26a0 ",a.warning]}):null]}),b?(0,k.jsxs)(h.Row,{wrap:!0,gap:8,children:[(0,k.jsx)(h.Button,{small:!0,label:'inapp'===a.kind?a.confirmLabel:'Confirm',testID:"confirm-action",onPress:()=>s(a,u)}),'external'===a.kind?(0,k.jsx)(h.Button,{small:!0,kind:"secondary",label:r?'Done editing':'Edit',testID:"edit-action",onPress:()=>l(!r)}):null,(0,k.jsx)(h.Button,{small:!0,kind:"ghost",label:"Cancel",testID:"cancel-action",onPress:n})]}):(0,k.jsx)(h.Badge,{kind:'confirmed'===e.state?'ok':'neutral',label:'confirmed'===e.state?'Confirmed':'Cancelled \u2014 nothing done'}),b?(0,k.jsxs)(h.Muted,{children:["Nothing happens until you tap ",'inapp'===a.kind?a.confirmLabel:'Confirm',"."]}):null]})}function M(){return'undefined'==typeof window?null:(0,n.speechRecognizer)()}const B=[{id:'facebook',name:'Facebook (Page & Messenger)',does:'posts and the Messenger auto-reply'},{id:'instagram',name:'Instagram',does:'posts'},{id:'gmail',name:'Gmail',does:'drafting and replying to email'},{id:'wix',name:'Website bookings',does:'website changes such as opening hours'}]},961,[874,1053,1067,30,256,122,263,151,127,1008,813,989,819,854,1462,1058,821,954,24]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useVoiceSlot",{enumerable:!0,get:function(){return w}}),_e.voiceAppFor=S,_e.useVoiceTarget=p,_e.VoiceSlot=function({size:e=56}){const t=p(),u=(0,n.useRef)(null),c=(0,n.useRef)(y++).current,{width:l,height:f}=(0,o.default)(),S=()=>u.current?.measureInWindow((e,t,n)=>{n&&w.setState({rect:{x:e,y:t,size:n},owner:c})});return(0,n.useEffect)(()=>{const e=setTimeout(S,50);return()=>clearTimeout(e)},[l,f,t?.on]),(0,n.useEffect)(()=>()=>{w.getState().owner===c&&w.setState({rect:null,owner:0})},[]),(0,n.useEffect)(()=>{t?.on||w.getState().owner!==c||w.setState({rect:null,owner:0})},[t?.on]),t?.on?(0,h.jsx)(s.default,{ref:u,testID:"voice-slot",onLayout:S,style:{width:e,height:e,flexShrink:0}}):null};var t=r(d[0]),n=r(d[1]),o=e(r(d[2])),s=e(r(d[3])),u=r(d[4]),c=r(d[5]),l=r(d[6]),f=r(d[7]),h=r(d[8]);const w=(0,u.create)(()=>({rect:null,owner:0}));function S(e){return'customer'===c.APP_VARIANT||/^\/(customer|table|demo)/.test(e)?null:e.startsWith('/owner')||e.startsWith('/admin')?'owner':e.startsWith('/team')?'staff':e.startsWith('/kitchen')?'chef':e.startsWith('/display')?'display':null}function p(){const e=(0,t.usePathname)()||'/',n=(0,l.useCtx)(6e4),o=(0,f.useVoiceSettings)(e=>e.enabled),s=S(e);if(!s)return null;const u='owner'===s?'owner'===n.role?'owner':'manager'===n.role?'manager':'staff':s;return{app:s,role:u,actions:'staff'===u?'staff':s,on:(0,f.voiceOn)(o,n.rid,u)}}let y=1},962,[804,30,287,127,1008,806,954,1066,24]); +__d(function(g,r,i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ds",{enumerable:!0,get:function(){return h}}),_e.useCss=function(){(0,n.useEffect)(()=>{if(!x||document.getElementById('cc-alert-css'))return;const e=document.createElement('style');e.id='cc-alert-css',e.textContent=k,document.head.appendChild(e)},[])},_e.KindIcon=function({kind:e,size:t=22,colour:n}){const a={stroke:n??m.KIND_META[e].colour,strokeWidth:2,fill:'none',strokeLinecap:'round',strokeLinejoin:'round'};return(0,b.jsxs)(l.default,{width:t,height:t,viewBox:"0 0 24 24",children:['booking'===e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...a}),(0,b.jsx)(o.Path,{d:"M3 10h18M8 3v4M16 3v4M9 15l2 2 4-4",...a})]}):null,'pending'===e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Circle,{cx:"12",cy:"13",r:"8",...a}),(0,b.jsx)(o.Path,{d:"M12 9v4l2.5 2M9 2h6",...a})]}):null,'takeaway'===e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Path,{d:"M5 8h14l-1.2 12H6.2z",...a}),(0,b.jsx)(o.Path,{d:"M9 8V6a3 3 0 0 1 6 0v2",...a})]}):null,'email'===e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Rect,{x:"3",y:"5",width:"18",height:"14",rx:"2",...a}),(0,b.jsx)(o.Path,{d:"M3 7l9 6 9-6",...a})]}):null,'test'===e?(0,b.jsx)(o.Path,{d:"M12 2l2.4 6.6L21 9l-5.2 4.3L17.5 20 12 16.3 6.5 20l1.7-6.7L3 9l6.6-.4z",...a}):null]})},_e.SoundToggle=function({big:e}){const t=(0,m.useAlerts)(e=>e.prefs.muted);return(0,b.jsx)(a.default,{accessibilityRole:"switch",accessibilityState:{checked:!t},accessibilityLabel:t?'Alert sound off, tap to turn on':'Alert sound on, tap to mute',onPress:()=>m.useAlerts.getState().setPrefs({muted:!t}),style:{alignSelf:'flex-end',paddingHorizontal:12,paddingVertical:e?8:5,borderRadius:999,backgroundColor:'rgba(0,0,0,0.75)',borderWidth:1,borderColor:d.colours.border},children:(0,b.jsx)(u.T,{size:e?15:12,colour:t?d.colours.muted:d.colours.gold,children:t?'Sound off':'Sound on'})})},_e.AlertHost=function({variant:e,rid:t,me:a,onOpen:s,skipTakeaway:o}){const l=(0,m.useAlerts)(e=>e.live).filter(n=>!(n.rid!==t||'chef'===e&&'takeaway'!==n.kind||o&&'takeaway'===n.kind&&!n.test)),c=e=>'booking'===e.kind||'pending'===e.kind,d=l.filter(c),u=l.filter(e=>!c(e));A('managers'===e);const x=u.map(e=>e.id+':'+e.at).join('|'),h=(0,n.useRef)({me:a,onOpen:s});return h.current={me:a,onOpen:s},(0,n.useEffect)(()=>{const t=new Set(u.map(e=>`alert:${e.id}`));f.useSliders.getState().dismissWhere(e=>e.id.startsWith('alert:')&&!t.has(e.id)&&!e.id.startsWith('alert-keep:'));for(const t of u){const n=m.KIND_META[t.kind],a='display'===e;(0,f.notify)({id:`alert:${t.id}`,tone:T(t),big:a,testID:'alert-slider',kicker:`${n.kicker}${t.test?' \xb7 TEST':''}${t.nag?` \xb7 REMINDER ${t.nag}`:''} \xb7 ${y(t.at)}`,title:t.name,timeoutMs:S(t,e),content:({close:n})=>(0,b.jsx)(I,{a:t,variant:e,big:a,me:h.current.me,onOpen:h.current.onOpen,close:n}),onClose:()=>m.useAlerts.getState().dismiss(t.id)})}},[x,e]),(0,n.useEffect)(()=>()=>f.useSliders.getState().dismissWhere(e=>e.id.startsWith('alert:')),[]),(0,b.jsx)(p.BookingBanners,{alerts:d,big:'display'===e,managers:'managers'===e,me:a,onOpen:s,onClose:e=>m.useAlerts.getState().dismiss(e.id)})};var t=r(_d[0]),n=r(_d[1]);r(_d[2]);var a=e(r(_d[3])),s=e(r(_d[4])),o=r(_d[5]),l=e(o),c=r(_d[6]),d=r(_d[7]),u=r(_d[8]),p=r(_d[9]),f=r(_d[10]),m=r(_d[11]),b=r(_d[12]);const x='undefined'!=typeof document,h=e=>({dataSet:{ccal:e}}),k="\n[data-ccal=\"drop\"]{animation:ccal-drop .62s cubic-bezier(.16,1.1,.3,1) both}\n@keyframes ccal-drop{0%{opacity:0;transform:translate3d(0,-70px,0) scale(.94)}60%{opacity:1}100%{opacity:1;transform:none}}\n[data-ccal=\"big\"]{animation:ccal-big .8s cubic-bezier(.16,1.05,.3,1) both}\n@keyframes ccal-big{0%{opacity:0;transform:translate3d(0,-120px,0) scale(.86)}100%{opacity:1;transform:none}}\n[data-ccal=\"fade\"]{animation:ccal-fade .5s ease both}\n@keyframes ccal-fade{from{opacity:0}to{opacity:1}}\n[data-ccal=\"glow-gold\"]{animation:ccal-glow-gold 2.4s ease-in-out infinite}\n[data-ccal=\"glow-amber\"]{animation:ccal-glow-amber 1.6s ease-in-out infinite}\n[data-ccal=\"glow-ok\"]{animation:ccal-glow-ok 2.4s ease-in-out infinite}\n[data-ccal=\"glow-blue\"]{animation:ccal-glow-blue 2.4s ease-in-out infinite}\n@keyframes ccal-glow-gold{0%,100%{box-shadow:0 0 0 1.5px rgba(207,164,95,.9),0 10px 40px rgba(207,164,95,.28)}50%{box-shadow:0 0 0 1.5px #CFA45F,0 10px 70px rgba(207,164,95,.6)}}\n@keyframes ccal-glow-amber{0%,100%{box-shadow:0 0 0 1.5px rgba(255,181,71,.9),0 10px 40px rgba(255,181,71,.25)}50%{box-shadow:0 0 0 1.5px #FFB547,0 10px 70px rgba(255,181,71,.6)}}\n@keyframes ccal-glow-ok{0%,100%{box-shadow:0 0 0 1.5px rgba(207,164,95,.9),0 10px 40px rgba(207,164,95,.22)}50%{box-shadow:0 0 0 1.5px #CFA45F,0 10px 70px rgba(207,164,95,.5)}}\n@keyframes ccal-glow-blue{0%,100%{box-shadow:0 0 0 1.5px rgba(226,196,137,.9),0 10px 40px rgba(226,196,137,.22)}50%{box-shadow:0 0 0 1.5px #E2C489,0 10px 70px rgba(226,196,137,.5)}}\n[data-ccal=\"stars\"]{position:absolute;top:0;left:0;right:0;bottom:0;pointer-events:none;background-image:radial-gradient(1.2px 1.2px at 23px 41px,#fff,transparent),radial-gradient(1px 1px at 97px 13px,#fff9,transparent),radial-gradient(1.4px 1.4px at 151px 120px,#f5e6c8,transparent),radial-gradient(1px 1px at 61px 163px,#fffa,transparent),radial-gradient(1.6px 1.6px at 183px 77px,#CFA45F,transparent);background-size:211px 199px;opacity:.55;animation:ccal-drift 50s linear infinite}\n@keyframes ccal-drift{to{background-position:-211px 199px}}\n[data-ccal=\"space\"]{background:radial-gradient(ellipse at 50% 120%,#2a1f0c 0%,#0a0805 40%,#000 72%)}\n[data-ccal=\"sheen\"]{position:absolute;top:0;bottom:0;width:35%;left:-50%;pointer-events:none;background:linear-gradient(100deg,transparent,rgba(255,255,255,.09),transparent);animation:ccal-sheen 3.6s ease-in-out .5s infinite}\n@keyframes ccal-sheen{0%{left:-50%}40%,100%{left:130%}}\n[data-ccal=\"dot\"]{animation:ccal-dot 1s ease-in-out infinite alternate}\n@keyframes ccal-dot{from{opacity:.25}to{opacity:1}}\n[data-ccal=\"bar\"]{animation-name:ccal-bar;animation-timing-function:linear;animation-fill-mode:both}\n@keyframes ccal-bar{from{transform:scaleX(1)}to{transform:scaleX(0)}}\n[data-ccal=\"ring\"]{animation:ccal-ring 1.4s ease-out infinite}\n@keyframes ccal-ring{0%{transform:scale(1);opacity:.7}100%{transform:scale(1.9);opacity:0}}\n[data-ccal=\"phase-gold\"]{animation:ccal-phase 1.8s ease-in-out infinite}\n@keyframes ccal-phase{0%,100%{background-color:rgba(40,28,6,.92)}50%{background-color:rgba(255,181,71,.55)}}\n[data-ccal=\"flash-red\"]{animation:ccal-red 1s steps(2,jump-none) infinite}\n@keyframes ccal-red{0%{background-color:#5A0E08}100%{background-color:#D9302A}}\n[data-ccal=\"pulse-btn\"]{animation:ccal-pulse 1.2s ease-in-out infinite}\n@keyframes ccal-pulse{0%,100%{transform:scale(1)}50%{transform:scale(1.04)}}\n@media (prefers-reduced-motion: reduce){[data-ccal]{animation:none !important;transition:none !important}}\n";const y=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`};function w({label:e,value:t,big:n}){return(0,b.jsxs)(s.default,{style:{minWidth:n?130:66,flexGrow:1,paddingVertical:n?10:6,paddingHorizontal:n?14:10,borderRadius:10,backgroundColor:'rgba(255,255,255,0.04)',borderWidth:1,borderColor:'rgba(207,164,95,0.22)'},children:[(0,b.jsx)(u.T,{size:n?13:10,weight:"semibold",colour:f.SLIDER.quiet,style:{letterSpacing:1.4},children:e}),(0,b.jsx)(u.T,{size:n?28:16,weight:"bold",numberOfLines:1,children:t})]})}function j({label:e,onPress:t,kind:n="primary",testID:a,big:s}){return(0,b.jsx)(f.SliderButton,{a:{label:e,kind:n,testID:a,onPress:t,keepOpen:!0},onDone:()=>{},big:s})}const S=(e,t)=>'display'===t?12e3:'chef'===t?15e3:'pending'===e.kind||'takeaway'===e.kind?null:1e4,T=e=>e.allergy?'urgent':'pending'===e.kind?'warn':'normal';function I({a:e,variant:a,big:o,me:l,onOpen:p,close:m}){const[x,h]=(0,n.useState)(!1),[k,y]=(0,n.useState)(null),S=e=>{y(e),setTimeout(m,1800)},T='managers'===a,I=l??'Manager',A='takeaway'===e.kind?[['ORDER',e.orderNo??''],['ITEMS',String(e.items??'')],['TOTAL',e.total??''],['COLLECT',e.collect??'']]:'email'===e.kind?[]:[['TIME',e.when??''],['COVERS',String(e.covers??'')],...e.table?[['TABLE',(0,t.tableNumbers)(e.table)]]:[],['SOURCE',e.source??'']];return(0,b.jsxs)(s.default,{testID:`alert-${e.kind}`,style:{gap:o?12:8},children:['email'===e.kind?(0,b.jsx)(u.T,{size:o?22:14,numberOfLines:2,children:e.subject}):null,A.length?(0,b.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:o?10:6},children:A.map(([e,t])=>(0,b.jsx)(w,{label:e,value:t,big:o},e))}):null,e.allergy?(0,b.jsxs)(s.default,{testID:"alert-allergy",style:{flexDirection:'row',gap:10,alignItems:'center',borderLeftWidth:4,borderColor:d.colours.red,backgroundColor:'rgba(255,107,94,0.10)',borderRadius:8,padding:o?12:8},children:[(0,b.jsx)(u.T,{size:o?16:11,weight:"bold",colour:d.colours.red,style:{letterSpacing:1.6},children:"ALLERGY"}),(0,b.jsxs)(s.default,{style:{flex:1},children:[(0,b.jsx)(u.T,{size:o?22:14,weight:"semibold",colour:"#FFE1DC",children:e.allergy}),e.allergyStep?(0,b.jsx)(u.T,{size:o?15:11,colour:"#FFC4BB",children:e.allergyStep}):null]})]}):null,'pending'===e.kind&&'managers'!==a?(0,b.jsx)(u.T,{size:o?18:13,colour:d.colours.amber,children:"Waiting for a manager to confirm it in the Managers app."}):null,'email'===e.kind&&e.test?(0,b.jsx)(u.T,{size:12,colour:f.SLIDER.quiet,children:"Test only. No venue email is connected yet."}):null,k?(0,b.jsx)(u.T,{size:14,weight:"semibold",colour:d.colours.goldLight,children:k}):null,(0,b.jsxs)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'flex-end',alignItems:'center'},children:[T&&!k?'pending'===e.kind?x?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(u.T,{size:14,colour:"#FFE1DC",style:{flexBasis:'100%'},children:["Decline this booking? We\u2019ll let ",e.name," know by text",e.test?' (test: nothing happens)':' (preview mode)',"."]}),(0,b.jsx)(j,{kind:"danger",label:"Yes, decline it",testID:"alert-decline-yes",onPress:()=>{e.refId&&!e.test&&c.repo.bookings.decide(e.refId,'declined',I),S('Declined. The guest\u2019s message is in the Outbox.')}}),(0,b.jsx)(j,{kind:"ghost",label:"Keep it",onPress:()=>h(!1)})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(j,{label:"Confirm",testID:"alert-confirm",onPress:()=>{e.refId&&!e.test&&c.repo.bookings.decide(e.refId,'confirmed',I),S(e.test?'Test alert: nothing to confirm.':'Confirmed. Their confirmation is ready in the Outbox.')}}),(0,b.jsx)(j,{kind:"danger",label:"Decline",testID:"alert-decline",onPress:()=>h(!0)})]}):'takeaway'===e.kind?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(j,{label:"Accept",testID:"alert-accept",onPress:async()=>{const t=!(e.refId&&!e.test)||await c.repo.orders.accept(e.refId,I);S(t?'Accepted.':'Accepted. The allergy sign-off is still needed before cooking.')}}),[15,20,30].map(t=>(0,b.jsx)(j,{kind:"ghost",label:`Ready in ${t}`,onPress:async()=>{const n=!(e.refId&&!e.test)||await c.repo.orders.accept(e.refId,I,t);S(`Accepted, ready in ${t} minutes.${n?'':' Allergy sign-off still needed.'}`)}},t))]}):'booking'===e.kind&&p?(0,b.jsx)(j,{kind:"ghost",label:"View bookings",onPress:()=>{m(),p(e)}}):null:null,k?null:(0,b.jsx)(j,{kind:"ghost",label:!T||'pending'!==e.kind&&'takeaway'!==e.kind?'Close':'Later',testID:"alert-close",onPress:m})]})]})}function A(e){const t=(0,m.useAlerts)(e=>e.askedSystem);(0,n.useEffect)(()=>{if(!e||t||'default'!==(0,m.systemSupport)())return;const n=setTimeout(()=>(0,f.notify)({id:'notify-prompt',testID:'notify-prompt',icon:'\ud83d\udd14',title:'Get booking alerts on this device?',body:'We\u2019ll let you know about new bookings, requests to confirm and takeaway orders, even when the app is in the background. You can change this any time in More, Alerts and sounds.',actions:[{label:'Turn on alerts',testID:'notify-allow',onPress:()=>{(0,m.requestSystemPermission)().then(()=>m.useAlerts.getState().setAsked())}},{label:'Not now',kind:'ghost',onPress:()=>m.useAlerts.getState().setAsked()}]}),2500);return()=>clearTimeout(n)},[e,t])}},963,[808,30,122,263,127,1005,819,821,813,1364,1118,965,24]); +__d(function(g,_r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.PrintHost=function({rid:e}){const t=(0,l.useFloor)(t=>t.settings[e]?.printing),i=(0,o.useStore)(b),d=(0,p.usePrintStatus)(m);(0,r.useEffect)(()=>{(0,p.checkDue)(e)},[e,t,i]),(0,r.useEffect)(()=>{const t=setInterval(()=>(0,p.checkDue)(e),2e4);return()=>clearInterval(t)},[e]);const c=Object.values(d);return c.length?(0,u.jsxs)(n.default,{testID:"print-fail",accessibilityRole:"summary",style:{position:'fixed',left:12,bottom:76,zIndex:9e3,maxWidth:520,gap:8},children:[c.slice(0,3).map(t=>(0,u.jsxs)(n.default,{style:{backgroundColor:h.colours.amberBg,borderColor:h.colours.amber,borderWidth:2,borderRadius:12,padding:12,gap:6},children:[(0,u.jsxs)(s.T,{weight:"semibold",colour:h.colours.amber,children:["\u26a0 Ticket didn\u2019t print: #",t.ref," \xb7 ",t.name]}),(0,u.jsxs)(s.T,{size:14,children:[t.printer,": ",t.reason,". The order is safe and still on screen",t.tries>1?` (tried ${t.tries} times)`:'',". Read it from the screen, or print it another way."]}),(0,u.jsxs)(s.Row,{wrap:!0,gap:6,children:[(0,u.jsx)(s.Button,{small:!0,label:"Try again",testID:`print-retry-${t.ref}`,onPress:()=>(0,p.retryFail)(e,t)}),(0,u.jsx)(s.Button,{small:!0,kind:"secondary",label:"Print on this screen",onPress:()=>(0,p.printHere)(e,t)}),(0,u.jsx)(s.Button,{small:!0,kind:"ghost",label:"Done, kitchen has it",onPress:()=>(0,p.dismissFail)(e,t)})]})]},`${t.orderId}:${t.printerId}`)),c.length>3?(0,u.jsxs)(s.T,{size:13,colour:h.colours.amber,children:["+ ",c.length-3," more tickets didn\u2019t print. Check the printer."]}):null]}):null},_e.ReprintButton=function({rid:e,o:t}){const[i,o]=(0,r.useState)('');return(0,u.jsxs)(n.default,{style:{gap:4},children:[(0,u.jsx)(s.Button,{small:!0,kind:"secondary",label:"Reprint ticket",testID:`reprint-${t.ref}`,onPress:()=>{o('Printing\u2026'),(0,p.reprint)(e,t).then(e=>o(e.ok?`Sent to ${e.where}.`:`Didn\u2019t print: ${e.error??'no answer'}.`))}}),i?(0,u.jsx)(s.Muted,{size:12,children:i}):null,t.printed?(0,u.jsxs)(s.Muted,{size:12,children:["Ticket printed ",new Date(t.printed.at).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})," on ",t.printed.printer]}):null]})},_e.PrintersSettings=function({rid:e,go:p}){const b=(0,l.useFloor)(t=>t.settings[e]?.printing),m=(0,d.normPrint)(b),k=t=>{const r=l.useFloor.getState().settings[e]??l.DEFAULT_SETTINGS;l.useFloor.getState().setSettings(e,{...r,printing:t})},y=(e,t)=>k({...m,printers:m.printers.map(r=>r.id===e?(0,d.normPrinter)({...r,...t}):r)}),P=(0,c.thisDevice)(),[j,T]=(0,r.useState)({}),[S,v]=(0,r.useState)({busy:!1,text:'',found:[]}),[I,C]=(0,r.useState)([]),D=e=>k({...m,printers:[...m.printers,(0,d.normPrinter)({id:f(),name:m.printers.length?`Printer ${m.printers.length+1}`:'Kitchen printer',from:'owner'===P||'display'===P?['tablet','mac',P]:[P,...['tablet','mac'].filter(e=>e!==P)],...e})]}),B=async t=>{T(e=>({...e,[t.id]:'Printing a test ticket\u2026'}));const r=await(0,c.sendTicket)(t,(0,c.testTicket)(o.useStore.getState().restaurants.find(t=>t.id===e)?.name??'',t));T(e=>({...e,[t.id]:r.ok?'Test ticket sent. Check the printer: the \xa3 sign and the allergy lines should be clear.':`Didn\u2019t print: ${r.error}.`}))};return(0,u.jsxs)(n.default,{style:{gap:10},testID:"adv-printers-body",children:[(0,u.jsx)(s.Toggle,{testID:"print-auto",label:"Print a kitchen ticket for every takeaway order",value:m.auto,onChange:e=>k({...m,auto:e,since:e?(new Date).toISOString():m.since}),a11y:"Print a kitchen ticket for every takeaway order"}),(0,u.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,u.jsx)(s.Chip,{testID:"print-when-arrival",label:"As soon as it comes in",selected:'arrival'===m.when,onPress:()=>k({...m,when:'arrival'})}),(0,u.jsx)(s.Chip,{testID:"print-when-accept",label:"When it\u2019s accepted",selected:'accept'===m.when,onPress:()=>k({...m,when:'accept'})})]}),(0,u.jsx)(s.Muted,{size:13,children:"The ticket shows the order number, collection time, name, every dish with its options and notes, allergies in white-on-black, and whether it\u2019s paid. If a printer doesn\u2019t answer, an amber warning shows on screen and the order stays there. Nothing is lost."}),(0,u.jsxs)(s.Muted,{size:13,children:["You\u2019re on: ",d.DEVICE_LABEL[P],"."]}),m.printers.map(e=>{const r=(0,d.canDrive)(P,e);return(0,u.jsxs)(n.default,{testID:`printer-${e.id}`,style:{borderWidth:1,borderColor:h.colours.hairline,borderRadius:12,padding:12,gap:8},children:[(0,u.jsxs)(s.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(t.TextInput,{accessibilityLabel:"Printer name",value:e.name,onChangeText:t=>y(e.id,{name:t}),style:[w,{flex:1}]}),(0,u.jsx)(s.Toggle,{label:"On",value:e.on,onChange:t=>y(e.id,{on:t}),a11y:`${e.name} on`})]}),(0,u.jsx)(s.T,{size:14,weight:"semibold",children:"Type"}),(0,u.jsx)(s.Row,{wrap:!0,gap:6,children:['epson','star','escpos','bluetooth','browser'].map(t=>(0,u.jsx)(s.Chip,{label:'epson'===t?'Epson':'star'===t?'Star':'escpos'===t?'Other (port 9100)':'bluetooth'===t?'Bluetooth':'Print dialog',selected:e.kind===t,onPress:()=>y(e.id,{kind:t})},t))}),(0,u.jsx)(s.Muted,{size:12,children:d.PRINTER_KIND_LABEL[e.kind]}),'epson'===e.kind||'star'===e.kind||'escpos'===e.kind?(0,u.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,u.jsx)(t.TextInput,{accessibilityLabel:"Printer IP address",testID:`printer-ip-${e.id}`,value:e.host??'',onChangeText:t=>y(e.id,{host:t.trim()}),placeholder:"IP address, e.g. 192.168.1.50",placeholderTextColor:h.colours.muted,style:[w,{minWidth:220,borderColor:e.host&&!(0,d.hostOk)(e.host)?h.colours.amber:h.colours.hairline}]}),'escpos'===e.kind?(0,u.jsx)(t.TextInput,{accessibilityLabel:"Port",value:String(e.port??9100),onChangeText:t=>y(e.id,{port:Number(t.replace(/\D/g,''))||9100}),style:[w,{width:90}]}):(0,u.jsx)(s.Toggle,{label:"HTTPS",value:!!e.https,onChange:t=>y(e.id,{https:t}),a11y:"Use HTTPS"})]}):null,'bluetooth'===e.kind?(0,u.jsxs)(n.default,{style:{gap:6},children:[(0,u.jsx)(s.Muted,{size:13,children:e.btAddress?`Printer: ${e.btName??e.btAddress}`:'Pair the printer in the tablet\u2019s Bluetooth settings first, then choose it here.'}),(0,u.jsx)(s.Button,{small:!0,kind:"secondary",label:"Choose a paired printer",onPress:()=>{(0,c.pairedBluetooth)().then(t=>{C(t.devices),T(r=>({...r,[e.id]:t.ok?t.devices.length?'Tap your printer below.':'No paired Bluetooth devices. Pair the printer in Android Settings \u203a Bluetooth first.':t.error??''}))})}}),(0,u.jsx)(s.Row,{wrap:!0,gap:6,children:I.map(t=>(0,u.jsx)(s.Chip,{label:t.name||t.address,selected:e.btAddress===t.address,onPress:()=>y(e.id,{btAddress:t.address,btName:t.name})},t.address))})]}):null,(0,u.jsx)(s.T,{size:14,weight:"semibold",children:"Prints"}),(0,u.jsxs)(s.Row,{wrap:!0,gap:6,children:[(0,u.jsx)(s.Chip,{label:"Kitchen ticket",selected:'kitchen'===e.role,onPress:()=>y(e.id,{role:'kitchen'})}),(0,u.jsx)(s.Chip,{label:"Front-of-house ticket (with prices)",selected:'foh'===e.role,onPress:()=>y(e.id,{role:'foh'})}),(0,u.jsx)(s.Chip,{label:"Both",selected:'both'===e.role,onPress:()=>y(e.id,{role:'both'})})]}),(0,u.jsxs)(s.Row,{wrap:!0,gap:6,children:[(0,u.jsx)(s.T,{size:14,children:"Kitchen copies"}),[1,2,3].map(t=>(0,u.jsx)(s.Chip,{label:String(t),selected:e.copies===t,onPress:()=>y(e.id,{copies:t})},t)),(0,u.jsx)(s.T,{size:14,children:" Paper"}),[48,42,32].map(t=>(0,u.jsx)(s.Chip,{label:32===t?'58 mm':42===t?'80 mm (42)':'80 mm',selected:e.cols===t,onPress:()=>y(e.id,{cols:t})},t))]}),(0,u.jsx)(s.T,{size:14,weight:"semibold",children:"Which devices print to it (first one first)"}),(0,u.jsx)(s.Row,{wrap:!0,gap:6,children:x.map(t=>{const r=e.from.indexOf(t);return(0,u.jsx)(s.Chip,{label:`${r>=0?`${r+1}. `:''}${'tablet'===t?'Tablet app':'mac'===t?'Mac app':'display'===t?'Display (browser)':'Managers (browser)'}`,selected:r>=0,onPress:()=>y(e.id,{from:r>=0?e.from.filter(e=>e!==t):[...e.from,t]})},t)})}),(0,u.jsx)(s.Muted,{size:12,children:"If the first device is off, the next one prints after a few seconds. A ticket is printed once, not by every device."}),r.ok?null:(0,u.jsx)(s.Banner,{kind:"warn",title:"This device can\u2019t reach this printer",children:r.why}),(0,u.jsxs)(s.Row,{wrap:!0,gap:6,children:[(0,u.jsx)(s.Button,{small:!0,label:"Test print",testID:`printer-test-${e.id}`,disabled:!r.ok,onPress:()=>{B(e)}}),(0,u.jsx)(s.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>k({...m,printers:m.printers.filter(t=>t.id!==e.id)})})]}),j[e.id]?(0,u.jsx)(s.T,{size:13,colour:/Didn/.test(j[e.id])?h.colours.amber:h.colours.goldLight,children:j[e.id]}):null]},e.id)}),(0,u.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,u.jsx)(s.Button,{testID:"printer-add",label:"Add a printer by IP address",onPress:()=>D({kind:'epson'})}),(0,u.jsx)(s.Button,{kind:"secondary",testID:"printer-scan",label:S.busy?'Looking\u2026':'Find printers on this Wi-Fi',disabled:S.busy,onPress:()=>{v({busy:!0,text:'Looking for printers on this Wi-Fi (up to 30 seconds)\u2026',found:[]}),(0,c.scanNetwork)().then(e=>v({busy:!1,text:e.ok?e.found.length?`Found ${e.found.length}. Tap one to add it.`:'No printers found. Check the printer is on and on the same Wi-Fi, or type its IP address.':e.error??'',found:e.found}))}}),(0,u.jsx)(s.Button,{kind:"secondary",label:"Use this device\u2019s Print dialog",onPress:()=>D({kind:'browser',name:'Print dialog',from:[P]})})]}),S.text?(0,u.jsx)(s.Muted,{size:13,children:S.text}):null,(0,u.jsx)(s.Row,{wrap:!0,gap:6,children:S.found.map(e=>(0,u.jsx)(s.Chip,{label:`${e.name??('epson'===e.kind?'Epson':'star'===e.kind?'Star':'Printer')} \xb7 ${e.host}`,onPress:()=>D({kind:'epson'===e.kind?'epson':'star'===e.kind?'star':'escpos',host:e.host,port:e.port,name:e.name??'Kitchen printer'})},`${e.host}:${e.port}`))}),p?(0,u.jsx)(i.default,{accessibilityRole:"link",onPress:()=>p('more','printerhelp'),children:(0,u.jsx)(s.T,{size:14,colour:h.colours.gold,children:"How to connect a Wi-Fi or Bluetooth printer \u203a"})}):null,(0,u.jsx)(s.Muted,{size:13,children:"Tip: print a test ticket after any change, and keep a spare roll by the printer."})]})},_e.PrinterHelpPage=function(){return(0,u.jsxs)(n.default,{style:{gap:12},testID:"printer-help",children:[(0,u.jsx)(s.Muted,{children:"Printing kitchen tickets for takeaway orders, in plain words."}),k.map(e=>(0,u.jsxs)(n.default,{style:{gap:6,borderWidth:1,borderColor:h.colours.hairline,borderRadius:12,padding:12},children:[(0,u.jsx)(s.T,{size:17,weight:"semibold",colour:h.colours.gold,children:e.h}),e.p.map(e=>(0,u.jsx)(s.T,{size:15,children:e},e))]},e.h)),(0,u.jsx)(s.Muted,{size:13,children:"Tip: put the printer where the kitchen sees it first, out of the way of steam and grease."})]})};var t=_r(_d[0]),r=_r(_d[1]);_r(_d[2]);var i=e(_r(_d[3])),n=e(_r(_d[4])),s=_r(_d[5]),o=_r(_d[6]),l=_r(_d[7]),d=_r(_d[8]),h=_r(_d[9]),p=_r(_d[10]),c=_r(_d[11]),u=_r(_d[12]);const b=e=>e.orders,m=e=>e.fails;const w={minHeight:44,borderRadius:10,borderWidth:1,borderColor:h.colours.hairline,backgroundColor:h.colours.surface2,color:h.colours.text,paddingHorizontal:10,fontSize:15},f=()=>`pr-${Date.now().toString(36)}${Math.random().toString(36).slice(2,5)}`,x=['tablet','mac','display','owner'];const k=[{h:'Which printers work',p:['Epson TM-m30, TM-T20 and TM-T88 with a network port or Wi-Fi (they understand Epson ePOS-Print).','Star printers with WebPRNT on the network, e.g. TSP143IV LAN or mC-Print3.','Most other receipt printers on the network that take ESC/POS on port 9100 (from the tablet app or the Mac app).','Bluetooth receipt printers that take ESC/POS, from the Display tablet app (Android) only.','Any printer your computer or tablet already prints to, using its own Print dialog (one tap per ticket).']},{h:'Wi-Fi or network printer',p:['1. Plug the printer into your router with a network cable, or join it to your Wi-Fi using the maker\u2019s app (Epson TM Utility or Star Quick Setup).','2. Find its IP address: switch the printer off, hold the Feed button and switch it on. It prints a page with the IP address (for example 192.168.1.50).','3. Ask whoever looks after your Wi-Fi to fix (reserve) that address for the printer, so it doesn\u2019t change.','4. In Settings \u203a Advanced \u203a Printers, tap Add a printer by IP address (or Find printers on this Wi-Fi in the tablet or Mac app), choose the type and type the address.','5. Tap Test print. You should see a ticket with \xa3 signs and white-on-black allergy lines.']},{h:'Bluetooth printer (tablet app)',p:['1. Switch the printer on. On the tablet open Settings \u203a Bluetooth and pair it (the PIN is often 0000 or 1234).','2. Open the CoverCharge Display app, go to Settings \u203a Advanced \u203a Printers and tap Add a printer, then choose Bluetooth.','3. Tap Choose a paired printer and pick it. Allow Nearby devices if the tablet asks.','4. Tap Test print. Keep the printer within a few metres of the tablet.']},{h:'If a ticket doesn\u2019t print',p:['An amber warning shows on screen with the order number. The order is never lost: it stays on the Display and in Orders.','Check the printer is on, has paper, the lid is shut, and it\u2019s on the same Wi-Fi. Then tap Try again.','Print on this screen opens the device\u2019s Print dialog. Done, kitchen has it clears the warning once someone has the order.','Reprint ticket on any order prints it again, marked REPRINT.']},{h:'Web browsers',p:['A web browser can\u2019t reach port 9100 printers or Bluetooth, and can only reach Epson or Star printers over HTTPS. That means switching on HTTPS on the printer and opening https:// once to accept its certificate. The Display tablet app and CoverCharge for Mac have none of these limits, so use one of them for automatic printing.']}]},964,[874,30,122,263,127,813,819,825,1434,821,1435,1437,24]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"chime",{enumerable:!0,get:function(){return l.chime}}),e.sendTestAlert=function(t,a){const o={rid:t,at:Date.now(),test:!0},c='pending'===a?{...o,id:`test-pending:${Date.now()}`,kind:'pending',name:'Test guest',when:'Today 19:30',covers:10,source:'Online'}:'takeaway'===a?{...o,id:`test-takeaway:${Date.now()}`,kind:'takeaway',name:'Test guest',orderNo:'T-TEST',items:3,total:'\xa324.50',collect:'18:45',source:'Online',allergy:'Milk (allergy)',allergyStep:'Test only: no sign-off needed'}:'email'===a?{...o,id:`test-email:${Date.now()}`,kind:'email',name:'CoverCharge test',subject:'This is a test alert. No real email was received.'}:{...o,id:`test-booking:${Date.now()}`,kind:'test'===a?'test':'booking',name:'Test guest',when:'Today 19:30',covers:4,table:'7',source:'Phone',allergy:'Peanuts (allergy)',allergyStep:'Test only: no sign-off needed'};n.useAlerts.getState().raise(c)};var t=r(d[0]);Object.keys(t).forEach(function(n){'default'===n||Object.prototype.hasOwnProperty.call(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[n]}})});var n=r(d[1]);Object.keys(n).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})});var a=r(d[2]);Object.keys(a).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return a[t]}})});var o=r(d[3]);Object.keys(o).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return o[t]}})});var c=r(d[4]);Object.keys(c).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return c[t]}})});var l=r(d[5]),s=r(d[6]);Object.keys(s).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return s[t]}})})},965,[1365,1366,1368,1367,1369,1012,1370]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useVoiceNav",{enumerable:!0,get:function(){return t}});const t=(0,r(d[0]).create)(()=>({go:null}))},966,[1008]); +__d(function(g,r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SNOOZE_MINS",{enumerable:!0,get:function(){return S}}),e.useScheduledNotices=function({rid:d,staffId:S,name:h,onOpen:w}){const D=(0,t.useRef)(h);D.current=h;const I=(0,t.useRef)(w);I.current=w,(0,t.useEffect)(()=>{if('undefined'==typeof window||!window.location?.search)return;const t=new URLSearchParams(window.location.search);'orderlists'===t.get('open')&&(o.useListOpen.getState().request(t.get('list')??void 0),setTimeout(()=>I.current?.('orderlists'),0))},[]);const N=(0,s.useNotifs)(t=>t.items.map(t=>`${t.id}:${t.updatedAt??''}`).join()),v=(0,c.useReminders)(t=>t.done.length);(0,t.useEffect)(()=>{s.useNotifs.getState().ensure(d);const t=()=>{const t=p(),h=s.useNotifs.getState(),w=n.useOwner.getState().staff.map(t=>({id:t.id,role:t.role,level:t.level,job:t.job,department:t.dept,active:t.active})),N=w.filter(s=>!1!==s.active&&(0,l.shiftNow)(s.id,t).on).map(t=>t.id);for(const n of h.items){if(n.rid!==d)continue;const l=`sched:${n.id}`;if(!S||n.removed||n.paused||!n.sendBy.inApp||!(0,u.isRecipient)(n,S,w,N)){(0,f.dismissNotice)(l);continue}const{due:v,forDate:O}=(0,u.notifDue)(n,t),b=c.useReminders.getState().done.find(t=>t.reminderId===n.id&&t.forDate===O),R=`sched:${n.id}:${O}`;!v||b||(h.snooze[R]??0)>t?(0,f.dismissNotice)(l):(0,f.notify)({id:l,icon:'\ud83d\udd14',kicker:'NOTICE',title:n.title,body:n.message,testID:'sched-notice',timeoutMs:null,actions:[{label:'Done',testID:'sched-notice-done',onPress:()=>c.useReminders.getState().markDone({rid:d,reminderId:n.id,forDate:O,at:new Date(p()).toISOString(),staffRef:S,staffName:D.current.replace(' (example)','')})},...'orderlists'===n.open?.page&&I.current?[{label:'Open list',testID:'sched-notice-open',onPress:()=>{o.useListOpen.getState().request(n.open?.list),I.current?.('orderlists')}}]:[],{label:'Later',kind:'ghost',testID:'sched-notice-later',onPress:()=>s.useNotifs.getState().setSnooze(R,p()+9e5)}]})}};t();const h=setInterval(t,2e4);return()=>clearInterval(h)},[d,S,N,v])};var t=r(_d[0]),s=r(_d[1]),n=r(_d[2]),o=r(_d[3]),c=r(_d[4]),d=r(_d[5]),u=r(_d[6]),f=r(_d[7]),l=r(_d[8]);const p=()=>{try{return(0,d.nowFrom)(d.useStore.getState().clock).getTime()}catch{return Date.now()}},S=15},967,[30,997,854,1076,994,870,1216,1041,950]); +__d(function(g,_r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useOffRotaPrompt=function({rid:r,staffId:k}){const w=(0,o.useRef)(!1),h=(0,n.useClockArea)(o=>{const n=o.areas[r];return!(0,t.privateClockVenue)(r)&&!!n&&!1!==n.offRotaPrompt&&null!=n.lat});(0,o.useEffect)(()=>{if(!h||!k)return;const t=async()=>{if(w.current||'undefined'!=typeof document&&'hidden'===document.visibilityState)return;const t=(0,n.areaOf)(r);if(!(0,a.areaSet)(t)||!t.offRotaPrompt)return;const o=l(),y=(0,f.ukClock)(o).ymd,h=`${y}:${k}`,b=s.useOwner.getState();if(n.useClockArea.getState().visiting[h]||(0,s.openShiftOf)(b.attendance,k,new Date(o)))return void(0,d.dismissNotice)('off-rota');if(!await(0,c.locationAllowed)())return;w.current=!0;const v=await(0,c.getFix)();if(w.current=!1,'object'!=typeof v)return;const S=new Date(o),I=b.shifts.filter(t=>t.staffId===k&&t.date===y&&!1!==t.published);(0,a.offRotaDue)({area:t,inside:(0,a.isInside)(t,v).inside,clockedIn:!1,shifts:I,nowHours:S.getHours()+S.getMinutes()/60,dismissedToday:!1})?(0,d.notify)({id:'off-rota',icon:'\ud83d\udccd',kicker:'AT THE VENUE',title:t.offRotaTitle,body:t.offRotaBody,testID:'off-rota',timeoutMs:null,actions:[{label:'Yes, clock me in',testID:'off-rota-yes',onPress:()=>{(0,u.clockAction)('in',{rid:r,staffId:k,date:y,at:new Date(l()).toISOString(),offRota:!0}).then(t=>{(0,d.notify)(t.ok?{id:'off-rota-done',title:'Clocked in',body:'Your manager will see you weren\u2019t on the rota today.',timeoutMs:6e3}:{id:'off-rota-done',tone:'warn',title:'Not clocked in',body:t.message,timeoutMs:9e3})})}},{label:'No, just visiting',kind:'ghost',testID:'off-rota-no',onPress:()=>n.useClockArea.getState().setVisiting(h)}]}):(0,d.dismissNotice)('off-rota')};t();const o=setInterval(()=>{t()},y),b=()=>{'visible'===document.visibilityState&&t()};return'undefined'!=typeof document&&document.addEventListener('visibilitychange',b),()=>{clearInterval(o),'undefined'!=typeof document&&document.removeEventListener('visibilitychange',b)}},[r,k,h])},e.useOffRotaAlerts=function({enabled:t}){const n=(0,o.useRef)(new Set),r=(0,s.useOwner)(t=>t.attendance);(0,o.useEffect)(()=>{if(!t)return;const o=(0,f.ukClock)(l()).ymd;for(const t of r){if(!t.offRota||t.date!==o||n.current.has(t.id))continue;n.current.add(t.id);const r=s.useOwner.getState().staff.find(o=>o.id===t.staffId)?.name??'Someone',a=t.in?new Date(t.in).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}):'';(0,d.notify)({id:`off-rota-mgr:${t.id}`,icon:'\ud83d\udccd',kicker:'NOT ON THE ROTA',title:`${r} clocked in at ${a}`,body:'They weren\u2019t on today\u2019s rota. Check Hours if that\u2019s not right.',timeoutMs:null,actions:[{label:'OK',testID:'off-rota-mgr-ok',onPress:()=>{}}]})}},[r,t])};var t=_r(_d[0]),o=_r(_d[1]),n=_r(_d[2]),s=_r(_d[3]),r=_r(_d[4]),a=_r(_d[5]),f=_r(_d[6]),c=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]);const l=()=>{try{return(0,r.nowFrom)(r.useStore.getState().clock).getTime()}catch{return Date.now()}},y=24e4},968,[1074,30,1219,854,870,1160,995,1286,1041,1302]); +__d(function(g,r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.MyShiftCard=function({go:e}){const{now:t,today:u}=(0,a.useCtx)(3e4),f=(0,a.useSignedIn)(),y=(0,o.useOwner)(e=>e.attendance),j=(0,o.useOwner)(e=>e.shifts);if(!f)return null;const x=(0,o.openShiftOf)(y,f.id,t),p=!!x?.breaks?.some(e=>!e.end),w=j.filter(e=>e.staffId===f.id&&e.date===u),k=w.length?w.map(e=>`${e.start}\u2013${e.end}`).join(', '):'Not on today\u2019s rota';return(0,l.jsx)(s.default,{testID:"my-shift-card",children:(0,l.jsxs)(n.Card,{children:[(0,l.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,l.jsx)(n.T,{weight:"semibold",colour:d.colours.gold,children:"My shift"}),(0,l.jsx)(n.Muted,{size:12,children:k})]}),(0,l.jsx)(h,{staffId:f.id}),(0,l.jsx)(n.T,{children:x?p?'On a break':`Clocked in since ${c(x.in)}`:'Not clocked in'}),(0,l.jsx)(n.Muted,{size:12,children:"Tip: clock in and out here, the same as in the Front of House app. It checks you\u2019re at the venue."}),(0,l.jsxs)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,l.jsx)(n.Button,{testID:"my-shift-clock",label:x?'Clock out / break':'Clock in',onPress:()=>e('more','clock')}),(0,l.jsx)(n.Button,{testID:"my-shift-rota",kind:"ghost",label:"My rota",onPress:()=>e('more','rota')}),(0,l.jsx)(n.Button,{testID:"my-shift-pay",kind:"ghost",label:"My pay & tips",onPress:()=>e('more','mypay')})]})]})})},_e.MyUpcomingShifts=h,r(_d[0]);var e,t=r(_d[1]),s=(e=t)&&e.__esModule?e:{default:e},n=r(_d[2]),o=r(_d[3]),d=r(_d[4]),a=r(_d[5]),l=r(_d[6]);const c=e=>e?new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}):'';function h({staffId:e}){const{today:t}=(0,a.useCtx)(6e4),c=(0,o.useOwner)(e=>e.shifts).filter(s=>s.staffId===e&&!1!==s.published&&s.date>=t).sort((e,t)=>(e.date+e.start).localeCompare(t.date+t.start)).slice(0,14);return(0,l.jsx)(s.default,{testID:"my-upcoming-shifts",children:(0,l.jsxs)(n.Card,{children:[(0,l.jsx)(n.T,{weight:"semibold",colour:d.colours.gold,children:"My shifts"}),c.length?c.map(e=>{return(0,l.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,l.jsx)(n.T,{children:(t=e.date,new Date(`${t}T12:00:00`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'}))}),(0,l.jsxs)(n.T,{children:[e.start,"\u2013",e.end]})]},e.id);var t}):(0,l.jsx)(n.Muted,{children:"No shifts on the rota yet."})]})})}},969,[30,127,813,854,821,954,24]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AppBadge=function({label:o}){return(0,c.jsx)(t.default,{testID:"app-badge",accessibilityLabel:`${o} app`,style:{borderWidth:1,borderColor:s.colours.gold,borderRadius:6,paddingHorizontal:6,paddingVertical:1,backgroundColor:(0,e.soutersSurface)('#1c1a16')},children:(0,c.jsx)(u.T,{size:10,weight:"bold",colour:s.colours.gold,children:o})})};var e=r(d[0]);r(d[1]);var o,l=r(d[2]),t=(o=l)&&o.__esModule?o:{default:o},s=r(d[3]),u=r(d[4]),c=r(d[5])},970,[878,30,127,821,813,24]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.CoversToday=function({rid:e,onPress:v,big:$,sound:p,testID:x="covers-today",day:C,compact:j=!1}){const w=(0,c.useBookings)(e),k=(0,c.useNow)(3e4),T=(0,h.venueYmd)(k),D=C&&C!==T?C:T,I=D!==T,L=I?(0,y.dayCovers)(w,D,T):(0,u.coversToday)(w,T),_=(0,y.dayWord)(D,T),M=/^(Today|Yesterday|Tomorrow)$/.test(_),R=`COVERS ${_.toUpperCase()}`,S=I?`${M?`${_}\u2019s`:_} bookings \u203a`:'Today\u2019s bookings \u203a',O=I?`${M?`${_}, `:''}${(0,y.dayLong)(D)}`:'today',P=(0,o.useLiveState)();if('ready'!==P)return(0,f.jsx)(o.LiveWait,{state:P,title:"Covers today",testID:`${x}-wait`});const W=$?64:44,z=L.total?Math.min(1,L.done/L.total):0,B=(e,o,t,c)=>(0,f.jsxs)(s.default,{style:{flex:1,alignItems:'center',gap:6,minWidth:0},children:[(0,f.jsx)(l.SplitFlap,{value:o,height:W,colour:t,testID:`covers-${c}`,sound:p}),(0,f.jsx)(n.T,{size:$||j?14:12,weight:"semibold",colour:b.colours.muted,numberOfLines:j?void 0:1,center:j,style:{letterSpacing:.4},children:e})]});return(0,f.jsxs)(t.default,{testID:x,accessibilityRole:"button",disabled:!v,onPress:v,accessibilityLabel:`Covers ${O}: ${L.done} done, ${L.toCome} ${D({backgroundColor:e?b.colours.tilePressed:b.colours.surface,borderRadius:16,borderWidth:1,borderColor:b.colours.hairline,padding:16,gap:12}),children:[(0,f.jsxs)(s.default,{style:{flexDirection:j?'column':'row',justifyContent:'space-between',alignItems:'center',gap:j?6:void 0},children:[(0,f.jsx)(n.T,{center:j,size:j?16:12,weight:"semibold",colour:b.colours.goldMuted,style:{letterSpacing:1.6},children:R}),v?(0,f.jsx)(n.T,{center:j,size:j?14:12,colour:b.colours.muted,children:S}):null]}),(0,f.jsxs)(s.default,{style:{flexDirection:'row',gap:8},children:[B('Done',L.done,b.colours.text,'done'),B(De.set),d=a??t,[n,u]=j[e];return(0,r.useEffect)(()=>{if('display'!==e||!a)return;const t=setTimeout(()=>o(e,null),12e4);return()=>clearTimeout(t)},[e,a,o]),(0,D.jsxs)(l.default,{testID:"day-bar",style:{gap:8},children:[(0,D.jsx)(s.DaySwitch,{day:d,today:t,onDay:t=>o(e,t),back:-n,ahead:u,idPrefix:"day"}),a?(0,D.jsx)(c.Button,{testID:"day-today",kind:"secondary",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>o(e,null),style:{minHeight:48}}):null]})},_e.DayView=function({rid:e,day:s,today:r,app:d}){const n=(0,u.useRestaurant)(e),x=(0,u.useBookings)(e),j=(0,u.useEvents)(e),_=(0,p.parseYmd)(s),B=se.date===s),O=(0,f.regularEventsOf)(n).filter(e=>(0,f.occursOn)(e,s)),T=x.filter(e=>e.date===s).sort((e,t)=>e.time.localeCompare(t.time)).filter(y.ACTIVE),E='display'===d;return(0,D.jsxs)(l.default,{testID:"day-view",style:{gap:12},children:[(0,D.jsxs)(c.Card,{children:[(0,D.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,D.jsxs)(c.T,{weight:"semibold",colour:b.colours.gold,children:[(0,p.niceDate)(_),$?` \xb7 ${$.name} hours`:'']}),(0,D.jsx)(c.Badge,{kind:"gold",label:B?'LOOKING BACK':'LOOKING AHEAD'})]}),(0,D.jsxs)(c.T,{size:E?18:15,children:[C?`Kitchen ${k(C[0])}\u2013${k(C[1])}`:'Kitchen closed',C&&v&&'kitchen closes'!==v.reason?` \xb7 last food orders ${k(v.time)} (${v.reason})`:'']}),O.map(e=>(0,D.jsxs)(c.T,{size:14,colour:b.colours.goldLight,children:["\u266a ",e.name,e.time?` from ${k(e.time)}`:'',e.busier?' \xb7 expect busier':'']},e.id)),w.map(e=>(0,D.jsxs)(c.T,{size:14,colour:b.colours.goldLight,children:["\u2605 ",(0,y.holidayName)(e.title)]},e.id)),(0,D.jsx)(c.Muted,{children:"Read-only. Nothing here changes today\u2019s service."})]}),(0,D.jsx)(a.CoversToday,{rid:e,day:s}),(0,D.jsx)(m.PlattersBooked,{rid:e,date:s,label:B?'Platters that day':'Platters booked'}),T.length?T.map(s=>(0,D.jsxs)(l.default,{style:{gap:6,padding:14,borderRadius:16,borderWidth:1,borderColor:b.colours.hairline,backgroundColor:b.colours.surface},children:[(0,D.jsxs)(c.T,{weight:"semibold",children:[s.time," \xb7 ",s.walkIn?`Walk-in ${s.ref}`:s.name," \xb7 ",s.partySize," covers",s.table?` \xb7 ${(0,t.tableNumbers)(s.table)}`:'']}),(0,D.jsx)(o.DepositChip,{b:s,money:!0,testID:`day-deposit-${s.id}`}),(0,D.jsx)(m.BookingNeeds,{b:s}),'display'!==d&&!B&&['confirmed','pending'].includes(s.status)?(0,D.jsx)(l.default,{style:{flexDirection:'row'},children:(0,D.jsx)(A.WhatsAppGuest,{b:s,rid:e,kind:"auto"})}):null]},s.id)):(0,D.jsx)(c.Muted,{children:B?'No bookings that day.':'No bookings yet for this day.'})]})};var e,t=_r(_d[0]),s=_r(_d[1]),a=_r(_d[2]),o=_r(_d[3]),r=_r(_d[4]),d=_r(_d[5]),l=(e=d)&&e.__esModule?e:{default:e},n=_r(_d[6]),c=_r(_d[7]),u=_r(_d[8]),y=_r(_d[9]),h=_r(_d[10]),f=_r(_d[11]),p=_r(_d[12]),b=_r(_d[13]),m=_r(_d[14]),A=_r(_d[15]),D=_r(_d[16]);const x=(0,n.create)(e=>({day:{},set:(t,s)=>e(e=>({day:{...e.day,[t]:s??void 0}}))})),j={owner:[-s.DAY_BACK,s.DAY_AHEAD],chef:[-s.DAY_BACK,s.DAY_AHEAD],display:[-s.DAY_BACK,s.DAY_AHEAD],staff:[-s.DAY_BACK,s.DAY_AHEAD]},k=e=>{const[t,s]=e.split(':').map(Number);return`${t%12||12}${s?`:${String(s).padStart(2,'0')}`:''}${t<12?'am':'pm'}`};function _(e,t){const s=x(t=>t.day[e]);return s&&s!==t?s:null}},972,[808,1305,971,1310,30,127,1008,813,819,828,815,809,818,821,976,1356,24]); +__d(function(g,_r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.LastFoodBanner=function({rid:e,now:o,big:c}){const f=(0,l.useRestaurant)(e),h=u(o),$=(0,l.useEvents)(e).filter(e=>e.date===h&&'regular'===e.source),b=f?(0,s.lastFoodOn)(f,h):null;if(!b)return null;const T=new Date(`${h}T${b.time}:00`),p=Math.round((T.getTime()-o.getTime())/6e4),_=$[0],j=_?`${_.title}${_.time?` from ${(0,s.fmt12)(_.time)}`:''}`:'';if(p>90&&!_)return null;if(p<-60)return null;const w=p>=0&&p<=15,x=p<0,D=w?n.colours.redBg:x?n.colours.surface2:n.colours.goldTint,F=w?n.colours.red:x?n.colours.hairline:n.colours.accentBorder,M=w?'#FFD9D4':x?n.colours.muted:n.colours.goldLight,y=c?1.3:1,B=x?`Kitchen closed for food \xb7 last orders were ${(0,s.fmt12)(b.time)}`:w?`Last food orders in ${Math.max(0,p)} min (${(0,s.fmt12)(b.time)})`:`Last food orders ${(0,s.fmt12)(b.time)}`;return(0,d.jsxs)(t.default,{testID:w?'last-food-warning':'last-food-banner',accessibilityRole:"text",style:{borderRadius:14,borderWidth:w?2:1,borderColor:F,backgroundColor:D,paddingVertical:10*y,paddingHorizontal:14,gap:2},children:[(0,d.jsxs)(r.T,{size:17*y,weight:"bold",colour:M,children:[w?'\u23f0 ':'\ud83c\udf7d ',B]}),j||'kitchen closes'!==b.reason?(0,d.jsx)(r.T,{size:13*y,colour:n.colours.muted,children:[j?`Tonight: ${j}`:'','kitchen closes'!==b.reason&&b.reason!==_?.title?`Early last orders (${b.reason})`:''].filter(Boolean).join(' \xb7 ')}):null]})},_r(_d[0]);var e,o=_r(_d[1]),t=(e=o)&&e.__esModule?e:{default:e},r=_r(_d[2]),l=_r(_d[3]),s=_r(_d[4]),n=_r(_d[5]),d=_r(_d[6]);const u=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`},973,[30,127,813,819,809,821,24]); +__d(function(_g,_r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.useNextFree=j,_e.NextTableFreeCard=function({rid:e,now:s,big:r,always:d}){const u=(0,n.useRestaurant)(e),c=j(e,s);if(!u||!c||!(0,h.nextTableOn)(u))return null;if(!c.full&&!d)return null;const T=c.list.slice(0,3),w=c.waitFor(2),p=c.waitFor(4),y=(0,h.lastFoodOn)(u,x(s)),M=r?1.25:1,F=(e,r)=>(0,g.jsxs)(l.default,{style:{flex:1,borderRadius:12,borderWidth:1,borderColor:f.colours.hairline,backgroundColor:f.colours.tile,padding:10},testID:`wait-for-${e}`,children:[(0,g.jsxs)(o.Muted,{children:["Wait for ",e]}),(0,g.jsx)(o.T,{size:20*M,weight:"bold",colour:f.colours.goldLight,children:r?`About ${Math.max(5,Math.round((r.at.getTime()-s.getTime())/6e4))} min`:'\u2014'}),(0,g.jsx)(o.Muted,{children:r?`${(0,t.tableNumbers)(r.table)} \xb7 ${r.confidence}`:'nothing due yet'})]});return(0,g.jsxs)(l.default,{testID:"next-table-free",accessibilityRole:"summary",style:{borderRadius:16,borderWidth:1,borderColor:f.colours.accentBorder,backgroundColor:f.colours.surface,padding:14,gap:8},children:[(0,g.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,g.jsx)(o.T,{size:12,weight:"semibold",colour:f.colours.goldMuted,style:{letterSpacing:1.4},children:c.full?'FULL \xb7 NEXT TABLE FREE':'NEXT TABLE FREE'}),(0,g.jsx)(o.Badge,{kind:"amber",label:"ESTIMATE"})]}),T.length?(0,g.jsxs)(o.T,{size:22*M,weight:"bold",children:["About ",(0,b.hhmm)(T[0].at)," ",(0,g.jsxs)(o.T,{size:16*M,colour:f.colours.muted,children:["(",(0,t.tableNumbers)(T[0].table),", ",T[0].seats," seats \xb7 ",T[0].confidence,")"]})]}):(0,g.jsx)(o.T,{size:18*M,weight:"semibold",children:c.freeNow.length?`Free now: ${c.freeNow.map(e=>`${(0,t.tableNumbers)(e)}`).join(', ')}`:'No table due to free up before its next booking'}),T.slice(1).map(e=>(0,g.jsxs)(o.Muted,{children:["Then about ",(0,b.hhmm)(e.at)," \xb7 ",(0,t.tableNumbers)(e.table)," (",e.seats," seats) \xb7 ",e.confidence," \xb7 ",e.why]},e.table)),T[0]?(0,g.jsxs)(o.Muted,{children:[(0,t.tableNumbers)(T[0].table),": ",T[0].why,"."]}):null,(0,g.jsxs)(o.Row,{gap:8,children:[F(2,w),F(4,p)]}),T.some(e=>e.drinksOnly)&&y?(0,g.jsxs)(o.T,{size:13,colour:f.colours.amber,children:["After last food orders (",(0,h.fmt12)(y.time),") a table is for drinks only."]}):null,(0,g.jsx)(o.Muted,{children:"Tap Bill requested or Table finished on the plan and this updates straight away."})]})};var e,t=_r(_d[0]),s=_r(_d[1]),r=_r(_d[2]),l=(e=r)&&e.__esModule?e:{default:e},o=_r(_d[3]),n=_r(_d[4]),d=_r(_d[5]),u=_r(_d[6]),c=_r(_d[7]),b=_r(_d[8]),h=_r(_d[9]),f=_r(_d[10]),g=_r(_d[11]);const x=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`,T=e=>(0,b.hhmm)(e);function j(e,t){const r=(0,n.useRestaurant)(e),l=(0,u.usePlan)(e),o=(0,n.useBookings)(e),h=(0,n.useOrders)(e),f=(0,u.useFloor)(t=>t.live[e]),g=(0,d.useBlocks)(e=>e.blocks),j=t.getTime()/6e4|0;return(0,s.useMemo)(()=>{if(!r)return null;const s=x(t),n=(0,d.closedAreasAt)(g,e,s,T(t)),u=(0,c.floorView)(l,o,h,f??{},t,r.settings.turnMins,n);return(0,b.nextTablesFree)(r,u,o.filter(e=>e.date===s),t,o)},[r,l,o,h,f,g,j])}},974,[808,30,127,813,819,824,825,826,1306,809,821,24]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.QuietButton=function({icon:e,label:l,onPress:n,testID:b,a11y:f}){return(0,c.jsxs)(s.default,{accessibilityRole:"button",accessibilityLabel:f??l,testID:b,onPress:n,style:({pressed:e})=>({...o.look.quiet(e),flexGrow:1}),children:[e?(0,c.jsx)(t.T,{size:15,colour:u.colours.goldLight,children:e}):null,(0,c.jsx)(t.T,{size:15,weight:"semibold",colour:u.colours.goldLight,children:l})]})},r(d[0]);var e,l=r(d[1]),s=(e=l)&&e.__esModule?e:{default:e},o=r(d[2]),t=r(d[3]),u=r(d[4]),c=r(d[5])},975,[30,263,1353,813,821,24]); +__d(function(g,_r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AllergenBar=p,_e.NeedsPills=k,_e.BookingNeeds=x,Object.defineProperty(_e,"needsIcons",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"confirmHolds",{enumerable:!0,get:function(){return S}}),_e.serveHolds=y,_e.postNewBookingToKitchen=function(e,t){if(!t||'system'===t)return;const s=o.useStore.getState().restaurants.find(t=>t.id===e.restaurantId),l=[],r=`${e.name}, ${(0,c.niceDate)((0,c.parseYmd)(e.date)).slice(0,3)} ${e.time}${e.table?`, table ${e.table}`:''}`;if((e.holds??[]).filter(e=>e.qty>0).length){const t=I(e.restaurantId);l.push(`${(0,u.holdsText)(e,(0,u.reservablesOf)(s),t)} reserved: ${r}. Tap Platter OK in the Head Chef app.`)}(0,u.hasAllergens)(e)&&l.push(`\u26a0\ufe0f Allergens: ${(0,u.allergenText)(e)} \u2014 ${r}. Please sign \u2018Allergens seen\u2019.`);if(!l.length)return;a.useOwner.getState().chatSend({ch:'kitchen',from:t,text:l.join('\n'),at:(new Date).toISOString()})},_e.useKitchenTodo=D,_e.KitchenSignoffs=function({rid:t,today:s,by:a,app:f,canConfirm:p=!0,showAll:k}){const j=D(t,s),I=(0,o.useBookings)(t),T=(0,o.useRestaurant)(t),O=(0,n.useStockItems)(t),$=(0,u.reservablesOf)(T),A=I.filter(e=>e.date===s&&!['cancelled','noshow'].includes(e.status)&&(e.holds??[]).some(e=>e.qty>0)),v=k?[...j,...A.filter(e=>!j.includes(e))]:j;return v.length?(0,b.jsxs)(l.default,{testID:"kitchen-signoffs",style:{gap:10,padding:16,borderRadius:16,borderWidth:1.5,borderColor:j.length?h.colours.amber:h.colours.hairline,backgroundColor:h.colours.surface},children:[(0,b.jsx)(r.T,{size:12,weight:"semibold",colour:j.length?h.colours.amber:h.colours.goldMuted,style:{letterSpacing:1.6},children:j.length?`KITCHEN SIGN-OFF NEEDED (${j.length})`:'RESERVED TODAY'}),v.map(t=>(0,b.jsxs)(l.default,{style:{gap:6,paddingTop:8,borderTopWidth:1,borderColor:h.colours.hairline},testID:`signoff-${t.ref}`,children:[(0,b.jsxs)(r.T,{weight:"semibold",children:[t.name," \xb7 ",t.partySize," covers \xb7 ",t.date===s?'Today':(0,c.niceDate)((0,c.parseYmd)(t.date))," ",t.time,t.table?` \xb7 ${(0,e.tableNumbers)(t.table)}`:'']}),(0,b.jsx)(x,{b:t}),p?(0,b.jsxs)(r.Row,{wrap:!0,gap:8,children:[(0,u.needsAllergenSeen)(t)?(0,b.jsx)(r.Button,{small:!0,kind:"danger",label:"Allergens seen",testID:`allergens-seen-${t.ref}`,onPress:()=>o.useStore.getState().ackBookingAllergy(t.id,a)}):null,(0,u.needsHoldOk)(t)?(0,b.jsx)(r.Button,{small:!0,kind:"success",label:/platter/i.test((0,u.holdsText)(t,$,O))?'Platter OK':'Reservation OK',testID:`platter-ok-${t.ref}`,onPress:()=>S(t.id,a)}):null,t.date===s&&t.holdOk&&(t.holds??[]).some(e=>!e.served)&&['seated','confirmed'].includes(t.status)?(0,b.jsx)(r.Button,{small:!0,kind:"secondary",label:"Served",testID:`served-${t.ref}`,onPress:()=>y(t,a,f)}):null]}):(0,b.jsx)(r.Muted,{children:"The kitchen signs these off."})]},t.id))]}):null},_e.PlattersBooked=function({rid:e,date:t,label:s}){const a=(0,o.useBookings)(e),c=(0,o.useRestaurant)(e),f=(0,n.useStockItems)(e),p=(0,u.heldSummary)(a,t,(0,u.reservablesOf)(c)),k=Object.entries(p.stock).filter(([,e])=>e>0).map(([e,t])=>`${t} ${(f.find(t=>t.key===e)?.name??e).toLowerCase()}`);return p.platters||k.length?(0,b.jsx)(l.default,{testID:"platters-booked",children:(0,b.jsxs)(r.T,{weight:"semibold",colour:h.colours.goldLight,children:[s??'Platters booked',": ",p.platters,k.length?` (${k.join(', ')})`:'']})}):null};var e=_r(d[0]);_r(d[1]);var t,s=_r(d[2]),l=(t=s)&&t.__esModule?t:{default:t},r=_r(d[3]),o=_r(d[4]),n=_r(d[5]),a=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),b=_r(d[10]);const f=({label:e,bg:t,fg:s,border:o,testID:n})=>(0,b.jsx)(l.default,{testID:n,style:{backgroundColor:t,borderColor:o,borderWidth:1,borderRadius:999,paddingHorizontal:9,paddingVertical:2},children:(0,b.jsx)(r.T,{size:13,weight:"semibold",colour:s,children:e})});function p({b:e,big:t}){return(0,u.hasAllergens)(e)?(0,b.jsxs)(l.default,{testID:`allergen-bar-${e.ref}`,style:{backgroundColor:h.colours.redSolid,borderRadius:10,paddingHorizontal:10,paddingVertical:t?8:5,gap:2},children:[(0,b.jsxs)(r.T,{size:t?16:13,weight:"bold",colour:"#FFFFFF",children:["\u26a0\ufe0f ALLERGENS: ",(0,u.allergenText)(e)]}),e.allergyAck?(0,b.jsxs)(r.T,{size:12,colour:"#FFE3DF",children:["Seen by kitchen: ",e.allergyAck.by]}):(0,b.jsx)(r.T,{size:12,colour:"#FFE3DF",children:"Kitchen hasn\u2019t signed \u2018Allergens seen\u2019 yet"})]}):null}function k({b:t,r:s}){const l=(0,n.useStockItems)(t.restaurantId),o=(0,u.reservablesOf)(s),a=(t.holds??[]).some(e=>e.qty>0),c=[];return t.drinksOnly&&c.push((0,b.jsx)(f,{testID:"pill-drinks",label:"\ud83c\udf77 Drinks only (after last food orders)",bg:h.colours.surface2,fg:h.colours.goldLight,border:h.colours.accentBorder},"x")),(0,u.hasAccess)(t)&&c.push((0,b.jsx)(f,{testID:"pill-access",label:`\u267f ${(0,u.accessText)(t)}`,bg:h.colours.blueBg,fg:"#E2C489",border:h.colours.blue},"a")),(0,u.dogCount)(t)&&c.push((0,b.jsx)(f,{testID:"pill-dog",label:"\ud83d\udc15 "+((0,u.dogCount)(t)>1?`${(0,u.dogCount)(t)} dogs`:'Dog'),bg:h.colours.surface2,fg:h.colours.text,border:h.colours.hairline},"d")),(0,u.dietText)(t)&&c.push((0,b.jsx)(f,{testID:"pill-veg",label:`\u24cb ${(0,u.dietText)(t)}`,bg:"#2A2216",fg:"#E2C489",border:"#CFA45F"},"v")),a&&c.push(t.holdOk?(0,b.jsx)(f,{testID:"pill-platter",label:`\u2713 ${(0,u.holdsText)(t,o,l)} \xb7 confirmed`,bg:h.colours.okBg,fg:"#E2C489",border:h.colours.ok},"h"):(0,b.jsx)(f,{testID:"pill-platter",label:`\ud83e\udd9e ${(0,u.holdsText)(t,o,l)} \xb7 awaiting kitchen`,bg:h.colours.amberBg,fg:"#FFE2A8",border:h.colours.amber},"h")),t.tableReq?.length&&c.push((0,b.jsx)(f,{testID:"pill-request",label:`Requested: ${t.tableReq.map(t=>`${(0,e.tableNumbers)(t)}`).join(' or ')}`,bg:h.colours.goldTint,fg:h.colours.goldLight,border:h.colours.accentBorder},"t")),c.length?(0,b.jsx)(r.Row,{wrap:!0,gap:6,children:c}):null}function x({b:e,big:t}){const s=(0,o.useRestaurant)(e.restaurantId);return(0,b.jsxs)(l.default,{style:{gap:6},children:[(0,b.jsx)(p,{b:e,big:t}),(0,b.jsx)(k,{b:e,r:s})]})}const j=e=>[(0,u.hasAllergens)(e)?'\u26a0\ufe0f':'',(0,u.hasAccess)(e)?'\u267f':'',(0,u.dogCount)(e)?'\ud83d\udc15':'',(0,u.dietText)(e)?'\u24cb':'',(e.holds??[]).some(e=>e.qty>0)?e.holdOk?'\ud83e\udd9e\u2713':'\ud83e\udd9e':''].filter(Boolean).join(' '),S=(e,t)=>o.useStore.getState().updateBooking(e,{holdOk:{by:t,at:(new Date).toISOString()}});function y(e,t,s){const l=o.useStore.getState().restaurants.find(t=>t.id===e.restaurantId),r=(0,u.stockNeed)(e,(0,u.reservablesOf)(l));for(const[l,o]of Object.entries(r))o>0&&n.shellfish.append({rid:e.restaurantId,kind:l,delta:-o,reason:'sold',by:t,app:s});const a=(new Date).toISOString();o.useStore.getState().updateBooking(e.id,{holds:(e.holds??[]).map(e=>e.served?e:{...e,served:{by:t,at:a}})})}const I=e=>n.useShellStore.getState().items[e]??[];function D(e,t){return(0,o.useBookings)(e).filter(e=>e.date>=t&&!e.walkIn&&((0,u.needsAllergenSeen)(e)||(0,u.needsHoldOk)(e))).sort((e,t)=>(e.date+e.time).localeCompare(t.date+t.time))}},976,[808,30,127,813,819,1148,854,828,818,821,24]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"REASONS",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"isoAt",{enumerable:!0,get:function(){return b}}),_e.flagsFor=w,_e.notesFor=S,Object.defineProperty(_e,"statusLabel",{enumerable:!0,get:function(){return I}}),Object.defineProperty(_e,"statusKind",{enumerable:!0,get:function(){return C}}),_e.AuditTrail=D,_e.OverrideSheet=O,_e.outstandingDays=T,_e.useOutstanding=function(){const e=(0,i.useOwner)(e=>e.attendance),t=(0,i.useOwner)(e=>e.timeRequests),s=(0,r.ymd)(new Date);return(0,n.useMemo)(()=>({days:T(e,s),requests:t.filter(e=>'open'===e.status).length}),[e,t,s])},_e.SignOff=function(){const{now:e,today:t,me:h,meId:m}=(0,c.useCtx)(3e4),x=(0,i.useOwner)(e=>e.staff),b=(0,i.useOwner)(e=>e.attendance),j=(0,i.useOwner)(e=>e.shifts),M=(0,i.useOwner)(e=>e.timeRequests),D=(0,n.useMemo)(()=>T(b,t),[b,t]),[$,v]=(0,n.useState)(t),[B,R]=(0,n.useState)(null),[A,P]=(0,n.useState)(null),q=(0,n.useMemo)(()=>{const n=b.filter(e=>e.date===$&&e.in),s=n.map(n=>{const s=(0,i.shiftOf)(j,n.staffId,$);return{key:n.id,staffId:n.staffId,a:n,sh:s,flags:w(n,s,e,t,M)}});j.filter(e=>e.date===$&&!1!==e.published&&!n.some(t=>t.staffId===e.staffId)).forEach(n=>{($60*n.start+15)&&s.push({key:`miss-${n.id}`,staffId:n.staffId,sh:n,flags:[{key:'noin',label:'No clock-in'}]})});const o=e=>e.a?'confirmed'===(0,i.attStatus)(e.a)?3:e.flags.length?0:2:1;return s.sort((e,t)=>o(e)-o(t)||(x.find(t=>t.id===e.staffId)?.name??'').localeCompare(x.find(e=>e.id===t.staffId)?.name??''))},[b,j,M,$,e.getMinutes(),x]),z=M.filter(e=>'open'===e.status&&e.date===$),F=M.filter(e=>'open'===e.status&&e.date!==$),H=q.filter(e=>e.a&&'awaiting'===(0,i.attStatus)(e.a)&&!e.flags.length),N=q.reduce((t,n)=>{if(!n.a)return t;const s=(0,c.paidMins)(n.a,e).paid;return'confirmed'===(0,i.attStatus)(n.a)?t.conf+=s:t.pend+=s,t},{conf:0,pend:0}),E={confirmed:q.filter(e=>e.a&&'confirmed'===(0,i.attStatus)(e.a)).length,awaiting:q.filter(e=>e.a&&'awaiting'===(0,i.attStatus)(e.a)).length,open:q.filter(e=>e.a&&'open'===(0,i.attStatus)(e.a)).length,flagged:q.filter(e=>e.flags.length&&!(e.a&&'confirmed'===(0,i.attStatus)(e.a))).length},_=[t,...D.map(e=>e.date).filter(e=>e!==t)];for(let e=1;_.length<8&&e<=7;e++){const n=k(t,-e);_.includes(n)||_.push(n)}const Y=t=>{const n=i.useOwner.getState().confirmEntries(t,h,m,e.toISOString());P(n?`${n} ${1===n?'entry':'entries'} confirmed`:null)};return(0,f.jsxs)(o.default,{style:{gap:10},testID:"signoff",children:[D.filter(e=>e.date!==$).length?(0,f.jsx)(s.default,{accessibilityRole:"button",onPress:()=>v(D.filter(e=>e.date!==$)[D.filter(e=>e.date!==$).length-1].date),children:(0,f.jsx)(a.Banner,{kind:"warn",title:`${D.filter(e=>e.date!==$).length} earlier ${1===D.filter(e=>e.date!==$).length?'day':'days'} still to sign off`,children:"Hours only count for pay once they\u2019re confirmed. Tap to open the oldest."})}):null,(0,f.jsx)(a.Row,{wrap:!0,gap:6,children:_.slice(0,10).sort((e,t)=>t.localeCompare(e)).map(e=>{const n=D.find(t=>t.date===e);return(0,f.jsx)(a.Chip,{label:y(e,t),sub:n?`${n.n} to sign off`:void 0,selected:$===e,onPress:()=>{v(e),P(null)}},e)})}),(0,f.jsx)(a.Card,{children:(0,f.jsxs)(a.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,f.jsxs)(o.default,{style:{flex:1},children:[(0,f.jsxs)(a.T,{size:18,weight:"bold",children:[y($,t),$===t||$===k(t,-1)?` \xb7 ${(0,r.niceDate)((0,r.parseYmd)($))}`:'']}),(0,f.jsxs)(a.Muted,{children:[E.confirmed," confirmed \xb7 ",E.awaiting," awaiting \xb7 ",E.open," still clocked in",E.flagged?` \xb7 ${E.flagged} flagged`:'']})]}),(0,f.jsxs)(o.default,{style:{alignItems:'flex-end'},children:[(0,f.jsx)(a.T,{size:18,weight:"bold",colour:d.colours.ok,children:(0,c.hmDur)(N.conf)}),(0,f.jsx)(a.Muted,{children:"confirmed"}),N.pend?(0,f.jsxs)(a.T,{size:13,colour:d.colours.amber,children:[(0,c.hmDur)(N.pend)," pending"]}):null]})]})}),A?(0,f.jsx)(a.Banner,{kind:"success",title:A}):null,z.length||F.length?(0,f.jsx)(u.SectionHead,{title:"Correction requests",sub:"From the Staff app. Apply opens the times to check; declining keeps the times as clocked."}):null,[...z,...F].map(t=>{const n=x.find(e=>e.id===t.staffId),s=t.attendanceId&&b.find(e=>e.id===t.attendanceId)||b.find(e=>e.staffId===t.staffId&&e.date===t.date&&e.in);return(0,f.jsxs)(a.Card,{highlight:d.colours.blue,children:[(0,f.jsxs)(a.Row,{gap:8,children:[(0,f.jsx)(l.StaffAvatar,{id:t.staffId,size:30}),(0,f.jsxs)(o.default,{style:{flex:1},children:[(0,f.jsxs)(a.T,{weight:"semibold",children:[p(n?.name)," \xb7 ",(0,r.niceDate)((0,r.parseYmd)(t.date))]}),(0,f.jsxs)(a.Muted,{children:['in'===t.kind?'Forgot to clock in':'out'===t.kind?'Forgot to clock out':'Forgot to clock in and out',t.suggestedIn?` \xb7 in ${(0,r.hm)(new Date(t.suggestedIn))}`:'',t.suggestedOut?` \xb7 out ${(0,r.hm)(new Date(t.suggestedOut))}`:'',t.note?` \xb7 \u201c${t.note}\u201d`:'']})]}),(0,f.jsx)(a.Badge,{kind:"blue",label:"Request"})]}),(0,f.jsxs)(a.Row,{gap:6,children:[(0,f.jsx)(a.Button,{small:!0,kind:"success",label:"Review & apply",onPress:()=>R({staffId:t.staffId,a:s,request:t})}),(0,f.jsx)(a.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>i.useOwner.getState().resolveTimeRequest(t.id,'declined',h,e.toISOString())})]})]},t.id)}),(0,f.jsx)(u.SectionHead,{title:"Hours",sub:"Rostered vs actual. Flagged rows need a look and are confirmed one by one."}),q.map(t=>{const n=x.find(e=>e.id===t.staffId),s=t.a,u=s?(0,c.paidMins)(s,e):null,h=s?(0,i.attStatus)(s):null,m=s?.audit?.filter(e=>'confirmed'!==e.action).slice(-1)[0];return(0,f.jsx)(a.Card,{highlight:'confirmed'===h?d.colours.ok:t.flags.length?d.colours.amber:void 0,children:(0,f.jsxs)(o.default,{testID:`so-row-${t.staffId}`,style:{gap:8},children:[(0,f.jsxs)(a.Row,{gap:10,children:[(0,f.jsx)(l.StaffAvatar,{id:t.staffId,size:36}),(0,f.jsxs)(o.default,{style:{flex:1},children:[(0,f.jsx)(a.T,{weight:"semibold",children:p(n?.name)}),(0,f.jsx)(a.Muted,{children:[n?.job,...S(s,n?.temp)].filter(Boolean).join(' \xb7 ')})]}),n?.temp||s?.temp?(0,f.jsx)(a.Badge,{kind:"gold",label:"Temp"}):null,s?(0,f.jsx)(a.Badge,{kind:C(s),label:I(s)}):(0,f.jsx)(a.Badge,{kind:"red",label:"Missing"})]}),(0,f.jsx)(a.Row,{gap:0,style:{flexWrap:'wrap',rowGap:6},children:[['Rota',t.sh?`${(0,c.fmtH)(t.sh.start)}\u2013${(0,c.fmtH)(t.sh.end)}`:'\u2014'],['Actual',s?.in?`${(0,r.hm)(new Date(s.in))}\u2013${s.out?(0,r.hm)(new Date(s.out)):'on'}`:'no clock-in'],['Break',s?.out?`${u.brk}m`:s?`${s.breakMins??0}m so far`:'\u2014'],['Paid',s?s.out?(0,c.hmDur)(u.paid):`${(0,c.hmDur)(u.worked)}\u2026`:'\u2014']].map(([e,t])=>(0,f.jsxs)(o.default,{style:{minWidth:92,flexGrow:1},children:[(0,f.jsx)(a.T,{size:11,colour:d.colours.muted,children:e.toUpperCase()}),(0,f.jsx)(a.T,{size:15,weight:"semibold",colour:'Paid'===e&&'confirmed'===h?d.colours.ok:d.colours.text,children:t})]},e))}),t.flags.length&&'confirmed'!==h?(0,f.jsx)(a.Row,{wrap:!0,gap:6,children:t.flags.map(e=>(0,f.jsx)(a.Badge,{kind:'noin'===e.key||'noout'===e.key?'red':'amber',label:e.label},e.key))}):null,m?(0,f.jsxs)(a.Muted,{children:["Adjusted by ",p(m.by),m.reason?`: ${m.reason}`:'']}):null,s?.signOff?(0,f.jsxs)(a.Muted,{children:["Confirmed by ",p(s.signOff.by)," \xb7 ",(0,r.niceDate)(new Date(s.signOff.at))," ",(0,r.hm)(new Date(s.signOff.at))]}):null,(0,f.jsxs)(a.Row,{gap:8,children:[(0,f.jsx)(a.Button,{small:!0,kind:"secondary",label:s?'Edit':'Add entry',accessibilityLabel:`${s?'Edit':'Add entry for'} ${p(n?.name)}`,onPress:()=>R({staffId:t.staffId,a:s})}),s&&'awaiting'===h?(0,f.jsx)(a.Button,{small:!0,kind:"success",label:"Confirm",accessibilityLabel:`Confirm ${p(n?.name)}`,onPress:()=>Y([s.id])}):null,s&&'open'===h?(0,f.jsx)(a.Muted,{style:{alignSelf:'center'},children:"Needs a clock-out before it can be confirmed"}):null]})]})},t.key)}),q.length?null:(0,f.jsx)(a.Card,{children:(0,f.jsx)(a.Muted,{children:"No clock records or rostered shifts for this day."})}),q.length?(0,f.jsx)(a.Button,{testID:"confirm-unflagged",kind:"success",label:H.length?`Confirm all unflagged (${H.length})`:'Nothing unflagged to confirm',disabled:!H.length,onPress:()=>Y(H.map(e=>e.a.id))}):null,(0,f.jsx)(a.Muted,{children:"Flags: no clock-out, 30 min or more off the rota, over 12 hours, no break on a shift over 6 hours, not on the rota, off-site, or a correction request. Editing a confirmed entry puts it back to Awaiting sign-off. Only confirmed hours count for pay, tips and exports."}),B?(0,f.jsx)(O,{a:B.a,staffId:B.staffId,date:B.request?.date??B.a?.date??$,request:B.request,onClose:()=>R(null)}):null]})};var t=_r(_d[0]),n=_r(_d[1]),s=e(_r(_d[2])),o=e(_r(_d[3])),a=_r(_d[4]),l=_r(_d[5]),i=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),c=_r(_d[10]),f=_r(_d[11]);const h=['Forgot to clock in','Forgot to clock out','Wrong time'],m=[0,15,20,30,45,60],p=e=>(e??'').replace(' (example)',''),x=e=>{const t=new Date(e);return 60*t.getHours()+t.getMinutes()},b=(e,t)=>{const n=(0,r.parseYmd)(e);return n.setMinutes(t),n.toISOString()},j=e=>{const t=(e%1440+1440)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`},k=(e,t)=>{const n=(0,r.parseYmd)(e);return n.setDate(n.getDate()+t),(0,r.ymd)(n)},y=(e,t)=>e===t?'Today':e===k(t,-1)?'Yesterday':(0,r.niceDate)((0,r.parseYmd)(e));function w(e,t,n,s,o=[]){const a=[],l=(0,c.paidMins)(e,n),i=60*n.getHours()+n.getMinutes();if(!e.out&&(e.date60*t.end+60||l.worked>840)&&a.push({key:'noout',label:'No clock-out'}),t&&e.in){const n=x(e.in)-Math.round(60*t.start),s=e.out?x(e.out)+(e.out.slice(0,10)!==e.in.slice(0,10)&&x(e.out)=30&&a.push({key:'diff',label:`${l>=60?(0,c.hmDur)(l):`${l}m`} off the rota`})}return t||a.push({key:'unrostered',label:'Not on the rota'}),l.worked>720&&a.push({key:'long',label:`Very long shift (${(0,c.hmDur)(l.worked)})`}),e.out&&l.worked>360&&0===l.brk&&a.push({key:'nobreak',label:'No break (over 6h)'}),!1!==e.inSite&&!1!==e.outSite||a.push({key:'offsite',label:'Clocked off-site'}),o.some(t=>'open'===t.status&&t.staffId===e.staffId&&t.date===e.date)&&a.push({key:'request',label:'Correction requested'}),e.breakAddedAtClockOut&&a.push({key:'breakadded',label:`Break added at clock-out (${e.breakAddedAtClockOut}m)`}),e.offRota&&t&&a.push({key:'offrota',label:'Signed in off rota'}),a}function S(e,t){const n=[];return(t||e?.temp)&&n.push('Temp'),'display'!==e?.via&&'display'!==e?.outVia||n.push('via Display'),n}const I=e=>{const t=(0,i.attStatus)(e);return'open'===t?'Open':'awaiting'===t?e.adjusted?'Adjusted \xb7 awaiting sign-off':'Awaiting sign-off':e.adjusted?'Confirmed \xb7 adjusted':'Confirmed'},C=e=>{const t=(0,i.attStatus)(e);return'confirmed'===t?'ok':'open'===t?'blue':'amber'},M={added:'Added entry',clock_in:'Clock-in',clock_out:'Clock-out',break:'Break',confirmed:'Confirmed',reopened:'Reopened',request_applied:'Correction request applied',request_declined:'Correction request declined'};function D({a:e,limit:t}){const n=[...e.audit??[]].reverse().slice(0,t??50);return n.length?(0,f.jsx)(o.default,{style:{gap:6},testID:"audit-trail",children:n.map((e,t)=>(0,f.jsxs)(o.default,{style:{flexDirection:'row',gap:8},children:[(0,f.jsx)(o.default,{style:{width:3,borderRadius:2,backgroundColor:'confirmed'===e.action?d.colours.ok:'reopened'===e.action?d.colours.amber:d.colours.gold}}),(0,f.jsxs)(o.default,{style:{flex:1},children:[(0,f.jsxs)(a.T,{size:13,weight:"semibold",children:[M[e.action],e.from||e.to?`: ${e.from??'\u2013'} \u2192 ${e.to??'\u2013'}`:'']}),(0,f.jsxs)(a.Muted,{children:[p(e.by)," \xb7 ",(0,r.niceDate)(new Date(e.at))," ",(0,r.hm)(new Date(e.at)),e.reason?` \xb7 \u201c${e.reason}\u201d`:'']})]})]},t))}):(0,f.jsx)(a.Muted,{children:"No changes yet. Times are as clocked."})}function $({label:e,mins:s,onChange:l,testID:i}){const[r,u]=(0,n.useState)(null),c=e=>{const t=/^(\d{1,2})[:.]?(\d{2})$/.exec(e.trim());t&&+t[1]<24&&+t[2]<60&&l(60*+t[1]+ +t[2]+(s>=1440&&60*+t[1]+ +t[2]<360?1440:0)),u(null)};return(0,f.jsxs)(o.default,{style:{gap:6},children:[(0,f.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(a.T,{size:13,colour:d.colours.muted,children:e}),s>=1440?(0,f.jsx)(a.Muted,{children:"next day"}):null]}),(0,f.jsxs)(a.Row,{gap:6,children:[(0,f.jsx)(a.Button,{small:!0,kind:"ghost",label:"\u221215",onPress:()=>l(s-15)}),(0,f.jsx)(a.Button,{small:!0,kind:"ghost",label:"\u22125",onPress:()=>l(s-5)}),(0,f.jsx)(t.TextInput,{testID:i,accessibilityLabel:e,value:r??j(s),onChangeText:u,onBlur:()=>null!=r&&c(r),onSubmitEditing:()=>null!=r&&c(r),style:[a.styles.input,{flex:1,textAlign:'center',fontSize:22,fontWeight:'700',paddingVertical:6,color:d.colours.text}]}),(0,f.jsx)(a.Button,{small:!0,kind:"ghost",label:"+5",onPress:()=>l(s+5)}),(0,f.jsx)(a.Button,{small:!0,kind:"ghost",label:"+15",onPress:()=>l(s+15)})]})]})}function O({a:e,staffId:t,date:s,request:o,onClose:l}){const{me:j,meId:k,now:y}=(0,c.useCtx)(3e4),w=(0,i.useOwner)(e=>e.staff.find(e=>e.id===t)?.name),S=(0,i.useOwner)(e=>e.shifts),M=(0,i.shiftOf)(S,t,s),O=o?.suggestedIn?x(o.suggestedIn):e?.in?Math.round((new Date(e.in).getTime()-(0,r.parseYmd)(s).getTime())/6e4):M?Math.round(60*M.start):720,T=o?.suggestedOut??e?.out,v=T?(B=T,Math.round((new Date(B).getTime()-(0,r.parseYmd)(s).getTime())/6e4)):e&&e.in&&!e.out?null:M?Math.round(60*M.end):O+480;var B;const[R,A]=(0,n.useState)(O),[P,q]=(0,n.useState)(v),[z,F]=(0,n.useState)(e?.breakMins??(M&&M.end-M.start>6?30:0)),[H,N]=(0,n.useState)(o?'out'===o.kind?h[1]:h[0]:e?e.in&&!e.out?h[1]:null:h[0]),[E,_]=(0,n.useState)(''),[Y,W]=(0,n.useState)(null),L=[H,E.trim()].filter(Boolean).join(': ')+(o&&o.note?` (request: ${o.note})`:''),V=null!=P?P-R:0,G=e?(0,c.paidMins)(e,y):null,K=null!=P?Math.max(0,V-z):null,U=e&&'confirmed'===(0,i.attStatus)(e),J=null!=P&&P<=R?'Clock-out must be after clock-in.':V>1200?'A shift can\u2019t be longer than 20 hours.':null!=P&&z>=V?'The break is longer than the shift.':null,Q=e?.in&&!o&&R===O?e.in:b(s,R),X=null==P?void 0:e?.out&&!o&&P===v?e.out:b(s,P),Z=!e||Q!==e.in||(X??'')!==(e.out??'')||(e.breakMins??0)!==z;return(0,f.jsxs)(a.Sheet,{visible:!0,onClose:l,title:`${e?'Edit hours':'Add missing entry'} \xb7 ${p(w)} \xb7 ${(0,r.niceDate)((0,r.parseYmd)(s))}`,testID:"override-sheet",children:[(0,f.jsxs)(a.Row,{gap:8,style:{flexWrap:'wrap'},children:[e?(0,f.jsx)(a.Badge,{kind:C(e),label:I(e)}):(0,f.jsx)(a.Badge,{kind:"red",label:"No clock record"}),M?(0,f.jsx)(a.Badge,{kind:"neutral",label:`Rota ${(0,c.fmtH)(M.start)}\u2013${(0,c.fmtH)(M.end)}`}):(0,f.jsx)(a.Badge,{kind:"neutral",label:"Not on the rota"}),e?.in?(0,f.jsx)(a.Badge,{kind:"neutral",label:`Clocked ${(0,r.hm)(new Date(e.in))}\u2013${e.out?(0,r.hm)(new Date(e.out)):'still on'}`}):null]}),o?(0,f.jsxs)(a.Banner,{kind:"info",title:`${p(w)} asked for a correction`,children:['in'===o.kind?'Forgot to clock in':'out'===o.kind?'Forgot to clock out':'Forgot to clock in and out',o.suggestedIn?` \xb7 in ${(0,r.hm)(new Date(o.suggestedIn))}`:'',o.suggestedOut?` \xb7 out ${(0,r.hm)(new Date(o.suggestedOut))}`:'',o.note?` \xb7 \u201c${o.note}\u201d`:'',". The suggested times are filled in below."]}):null,(0,f.jsx)($,{label:"Clock in",mins:R,onChange:A,testID:"ov-in"}),null!=P?(0,f.jsx)($,{label:"Clock out",mins:P,onChange:q,testID:"ov-out"}):(0,f.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(a.Muted,{children:"No clock-out yet."}),(0,f.jsx)(a.Button,{small:!0,kind:"secondary",label:"Add clock-out",onPress:()=>q(M?Math.round(60*M.end):Math.min(R+480,60*y.getHours()+y.getMinutes()>R?60*y.getHours()+y.getMinutes():R+480))})]}),(0,f.jsx)(a.T,{size:13,colour:d.colours.muted,children:"Break"}),(0,f.jsxs)(a.Row,{wrap:!0,gap:6,children:[m.map(e=>(0,f.jsx)(a.Chip,{label:0===e?'None':`${e} min`,selected:z===e,onPress:()=>F(e)},e)),(0,f.jsx)(a.Stepper,{value:z,min:0,max:240,onChange:F,label:"break minutes"})]}),(0,f.jsx)(a.T,{size:13,colour:d.colours.muted,children:"Reason (required, kept in the audit trail)"}),(0,f.jsx)(a.Row,{wrap:!0,gap:6,children:h.map(e=>(0,f.jsx)(a.Chip,{label:e,selected:H===e,onPress:()=>N(H===e?null:e)},e))}),(0,f.jsx)(a.Field,{label:H?'Add detail (optional)':'Or type a reason',value:E,onChangeText:_,placeholder:"e.g. stayed late for a function",maxLength:150}),(0,f.jsxs)(a.Card,{style:{backgroundColor:d.colours.surface2},children:[(0,f.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(a.T,{children:"Paid hours"}),(0,f.jsx)(a.T,{weight:"bold",colour:d.colours.gold,children:null!=K?(0,c.hmDur)(K):'still on shift'})]}),G&&e?.out?(0,f.jsxs)(a.Muted,{children:["Was ",(0,c.hmDur)(G.paid)," (",(0,r.hm)(new Date(e.in)),"\u2013",(0,r.hm)(new Date(e.out)),", ",G.brk,"m break)"]}):null,U?(0,f.jsx)(a.T,{size:13,colour:d.colours.amber,children:"This entry was confirmed. Saving puts it back to Awaiting sign-off (logged)."}):null]}),J?(0,f.jsx)(a.T,{size:13,colour:d.colours.red,children:J}):null,Y?(0,f.jsx)(a.T,{size:13,colour:d.colours.red,children:Y}):null,(0,f.jsx)(a.Button,{testID:"ov-save",kind:"success",label:e?'Save change':'Add entry',disabled:!!J||!Z||L.trim().length<3,onPress:()=>{i.useOwner.getState().overrideEntry({id:e?.id,staffId:t,date:s,in:Q,out:X,breakMins:z,reason:L.slice(0,200),by:j,byId:k,now:y.toISOString(),request:o?.id})?(o&&i.useOwner.getState().resolveTimeRequest(o.id,'applied',j,y.toISOString()),l()):W('Couldn\u2019t save: check the times and the reason.')}}),e?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(u.SectionHead,{title:"Audit trail",sub:"Every change: what, from, to, who, when and why"}),(0,f.jsx)(D,{a:e})]}):null]})}function T(e,t){const n=new Map;return e.forEach(e=>{e.date({date:e,n:t})).sort((e,t)=>t.date.localeCompare(e.date))}},977,[874,30,263,127,813,955,854,818,821,953,954,24]); +__d(function(g,_r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.readinessFor=function(a,d,r){if('takeaway'!==a.type||!a.slotTime)return[];if(['collected','cancelled','closed'].includes(a.status))return[];const s=new Date(a.slotTime),n=d.settings.bufferMins,o=a.lines.map(a=>({name:a.name,qty:a.qty,at:(0,t.addMins)(s,-(a.prepMins+n))})),u=o.reduce((t,a)=>a.at{if(a)return'done';const d=r.getTime()-t.getTime();return d<0?'upcoming':d>3e5?'overdue':'due'},y=['ready','collected'].includes(a.status);return[{id:`${a.id}:cook`,orderId:a.id,stage:'cook',due:u,state:l(u,!!a.readiness.cook||y),detail:o.sort((t,a)=>t.at.getTime()-a.at.getTime()).map(t=>{return`${t.qty}\xd7 ${t.name} at ${a=t.at,`${String(a.getHours()).padStart(2,'0')}:${String(a.getMinutes()).padStart(2,'0')}`}`;var a}).join(' \xb7 ')},{id:`${a.id}:bag`,orderId:a.id,stage:'bag',due:c,state:l(c,!!a.readiness.bag||y),detail:'Bag, add sauces/drinks, check against ticket and allergy flags'},{id:`${a.id}:ready`,orderId:a.id,stage:'ready',due:s,state:l(s,y),detail:'Mark ready \u2014 sends the customer a "your order is ready" notification'}]};var t=_r(_d[0])},978,[818]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"orderAtTableOn",{enumerable:!0,get:function(){return t}});const t=t=>!!t&&(t.settings.orderAtTable??!0)},979,[]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"hash",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"CHANNELS",{enumerable:!0,get:function(){return n}}),_e.revenueHistory=function(e,n,r=28){const s=[];if(!(0,o.examplesAllowed)())return s;for(let o=r;o>=1;o--){const r=(0,t.addMins)(n,1440*-o),i=!!e.kitchenHours[r.getDay()],d=[1.05,0,0,.6,.7,1,1.2][r.getDay()]*('anchorage'===e.id?1:.6),l=o=>.85+.3*a((0,t.ymd)(r)+o+e.id),u=i?Math.round(24e4*d*l('d')):0,c=i?Math.round(95e3*d*l('t')):0,p=i?Math.round(52e3*d*l('q')):0;s.push({date:r,label:(0,t.niceDate)(r).slice(0,6),byChannel:{'Dine-in':u,Takeaway:c,'Table QR':p},total:u+c+p,covers:i?Math.round(150*d*l('c')):0})}return s},_e.dishStats=function(e){return(0,o.examplesAllowed)()?e.filter(e=>null!=e.price).map(e=>{const t=Math.round(20+260*a(e.id+'s')),o=.24+.22*a(e.id+'c'),n=e.price??0,r=Math.round(n*(1-o));return{item:e,sold:t,revenue:t*n,costPct:o,margin:r,gp:r*t}}):[]},_e.quadrant=function(e,t,o,a){return e>=o?t>=a?'Star':'Plough horse':t>=a?'Puzzle':'Dog'},Object.defineProperty(_e,"QUADRANT_TIP",{enumerable:!0,get:function(){return r}}),_e.crmCustomers=function(){return(0,o.examplesAllowed)()?s.map((e,t)=>{const o=a(e+t);return{id:0===t?'cust-demo':`cr-${t}`,name:`${e} ${i[t]}${0===t?'':' (example)'}`,phone:`07700 900${String(100+7*t).slice(-3)}`,visits:1+Math.round(18*o),lastVisit:`${1+Math.round(27*o)} days ago`,spend:Math.round(3e3+6e4*o),allergies:0===t?['Crustaceans (anaphylaxis)','Mustard']:o>.8?['Gluten (coeliac)']:o<.1?['Peanuts']:[],stamps:0===t?5:Math.round(7*o),optIn:o>.25,channel:n[Math.floor(3*o)%3],birthday:o>.6?`${1+Math.round(27*o)} Nov`:void 0}}):[]},Object.defineProperty(_e,"STOCK",{enumerable:!0,get:function(){return d}}),Object.defineProperty(_e,"stockList",{enumerable:!0,get:function(){return l}}),_e.insights=function(a,n,r,s,i,l,c){const p=[];if(!(0,o.examplesAllowed)())return u(a,n,r,s,i,l,c);const h=new Date(l);h.setDate(h.getDate()+((6-h.getDay()+7)%7||7)),h.setHours(0,0,0,0);const b=(0,e.forecastToday)(a,n,r,s,h),m=Math.round(b.restOfDay.covers/Math.max(1,b.multiplier)),y=Math.max(35,Math.round(100*(b.multiplier-1))+35);p.push({id:'sat',icon:'\ud83d\udcc8',tone:'gold',title:`${(0,t.niceDate)(h)} forecast +${y}%: add 1 server 6\u20139pm`,body:`Example: about ${Math.round(m*(1+y/100))} covers expected vs about ${m} on a usual Saturday (bookings pace + Halloween weekend flag).`,action:{label:'Open rota',tab:'more',sub:'rota'}});const f=(0,e.forecastToday)(a,n,r,s,l),v=d[0],w=Math.ceil((f.restOfDay.covers+2*f.restOfDay.takeaway)*v.perCover);p.push({id:'haddock',icon:'\ud83d\udc1f',tone:'red',title:`Haddock low: ${v.onHand} portions left`,body:`Tonight\u2019s forecast needs about ${w}. Call the supplier before 18:00 or mark the fish supper sold out at ${v.onHand} sold.`,action:{label:'Prep list',tab:'more',sub:'prep'}});const k=s.find(e=>/Burns/.test(e.title));if(k){const e=Math.max(1,Math.round((new Date(k.date).getTime()-l.getTime())/6048e5));p.push({id:'burns',icon:'\ud83e\udd43',tone:'blue',title:`Burns Night in ${e} weeks: open bookings?`,body:'Last year\u2019s equivalent nights sold out about 3 weeks ahead (example). Publish the set menu and push to opted-in regulars.',action:{label:'Plan campaign',tab:'more',sub:'marketing'}})}const M=n.filter(e=>e.date===(0,t.venueYmd)(l)&&'noshow'===e.status).length;p.push({id:'noshow',icon:'\ud83e\ude91',tone:'amber',title:M?`${M} no-show today: deposits for 6+?`:'Deposits for bigger tables (example)',body:'Deposits are set per venue in Settings \u203a Advanced \u203a Deposits. Consider them on Fri/Sat after 19:00.',action:{label:'Bookings',tab:'bookings'}});const C=i.filter(e=>e.stars<=2).length;C&&p.push({id:'reviews',icon:'\ud83d\udcac',tone:'red',title:`${C} low rating this week: cold chips at collection`,body:'Readiness alerts now time bagging 5 min before pickup. Reply to say thanks and invite them back.',action:{label:'Reviews',tab:'more',sub:'reviews'}});return p.push({id:'commission',icon:'\ud83d\udcb7',tone:'ok',title:'You kept about \xa31,240 in commission this month',body:'Example: \xa34,140 of direct takeaway orders that would have cost about 30% on delivery apps.',action:{label:'Analytics',tab:'more',sub:'analytics'}}),p.push({id:'covers',icon:'\ud83c\udf7d\ufe0f',tone:'gold',title:`${c} covers so far today`,body:'Lobster special is the top add-on tonight. Suggest it with the scallops (example).'}),p};var e=_r(_d[0]),t=_r(_d[1]),o=_r(_d[2]);const a=e=>{let t=2166136261;for(let o=0;o>>0)/4294967295},n=['Dine-in','Takeaway','Table QR'];const r={Star:'Keep: high margin and popular. Feature it.','Plough horse':'Popular, low margin: nudge the price or trim the cost.',Puzzle:'High margin, few sales: promote it or rename it.',Dog:'Low margin, few sales: consider removing it.'},s=['Alex','Fiona','Iain','Morag','Callum','Eilidh','Ross','Kirsty','Euan','Shona','Hamish','Isla','Craig','Ailsa','Neil','Catriona'],i=['Morgan','Campbell','Fraser','McLeod','Kerr','Wallace','Boyd','Hamilton','Stewart','Murray','Paterson','Duncan','Gilmour','Reid','Ross','Grant'];const d=[{cat:'Fish & seafood',id:'haddock',name:'Haddock fillets',unit:'portions',onHand:8,perCover:.22,par:40},{cat:'Fruit & veg',id:'chips',name:'Chipping potatoes',unit:'kg',onHand:25,perCover:.18,par:40},{cat:'Fish & seafood',id:'langoustine',name:'Langoustines',unit:'kg',onHand:4,perCover:.03,par:6},{cat:'Fish & seafood',id:'mussels',name:'Mussels',unit:'kg',onHand:10,perCover:.05,par:12},{cat:'Fish & seafood',id:'scallops',name:'Scallops',unit:'portions',onHand:14,perCover:.06,par:20},{cat:'Meat',id:'beef',name:'Burger patties',unit:'each',onHand:30,perCover:.1,par:40},{cat:'Fruit & veg',id:'peas',name:'Garden peas',unit:'kg',onHand:6,perCover:.04,par:8},{cat:'Dairy',id:'tartare',name:'House tartare sauce',unit:'tubs',onHand:5,perCover:.05,par:10}],l=()=>(0,o.examplesAllowed)()?d:[];function u(o,a,n,r,s,i,d){const l=[],u=(0,e.forecastToday)(o,a,n,r,i);u.enough||l.push({id:'history',icon:'\ud83d\udcc5',tone:'gold',title:'Not enough history yet',body:u.suggestions[0]?.replace(/^Not enough history yet\. /,'')??'',action:{label:'Settings \u203a Advanced',tab:'more',sub:'advanced'}});const c=(0,t.ymd)(i),p=a.filter(e=>e.date===c&&'noshow'===e.status).length;p&&l.push({id:'noshow',icon:'\ud83e\ude91',tone:'amber',title:`${p} no-show${1===p?'':'s'} today`,body:'Think about a deposit for larger parties (Settings \u203a Advanced \u203a Deposits).',action:{label:'Bookings',tab:'bookings'}});const h=s.filter(e=>e.stars<=2).length;h&&l.push({id:'reviews',icon:'\ud83d\udcac',tone:'red',title:`${h} low rating${1===h?'':'s'} to read`,body:'Read what they said, reply to say thanks and invite them back.',action:{label:'Reviews',tab:'more',sub:'reviews'}});const b=r.filter(e=>e.date>=c).sort((e,t)=>e.date.localeCompare(t.date))[0];return b&&l.push({id:'event',icon:'\ud83d\udcc5',tone:'blue',title:`Coming up: ${b.title}`,body:`${(0,t.niceDate)(new Date(b.date+'T12:00:00'))}. Check your rota and think about a promo.`,action:{label:'Forecast',tab:'forecast'}}),l.push({id:'covers',icon:'\ud83c\udf7d\ufe0f',tone:'gold',title:`${d} covers so far today`,body:'Seated bookings and walk-ins recorded in CoverCharge today.'}),l}},980,[868,818,1053]); +__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.useRealHistory=function(e,t){const o=(0,l.useExamples)(),n=(0,r.useBookings)(e),c=(0,r.useOrders)(e),f=(0,u.useCashUp)(e=>e.cashUps),y=(0,k.clampWeeks)((0,h.useStore)(s=>s.restaurants.find(s=>s.id===e)?.settings.forecastMinWeeks)),b=t.toDateString();return(0,s.useMemo)(()=>o?null:(0,k.buildHistory)(e,n,c,f.map(e=>({rid:e.rid,date:e.date,takings:(0,p.takings)(e.vals)})),t,y),[o,e,n,c,f,y,b])},Object.defineProperty(_e,"ExampleBadge",{enumerable:!0,get:function(){return b}}),_e.NotEnoughHistory=function({weeks:e,booked:s,what:t="Forecasts",testID:r="not-enough-history"}){return(0,y.jsx)(n.Card,{children:(0,y.jsxs)(o.default,{testID:r,style:{gap:6},children:[(0,y.jsx)(n.T,{weight:"semibold",colour:f.colours.gold,children:"Not enough history yet"}),(0,y.jsx)(n.Muted,{children:'Forecasts'===t?(0,c.notEnoughTip)(e):`${t} start once CoverCharge has ${1===e?'1 week':`${e} weeks`} of your bookings and cash-ups.`}),s?(0,y.jsx)(o.default,{testID:`${r}-booked`,children:(0,y.jsxs)(n.T,{children:["Booked so far: ",s," covers"]})}):null,(0,y.jsx)(n.Muted,{children:"Tip: upload or add your bookings and do the cash up each night. Managers can change how much history is needed in Settings \u203a Advanced."})]})})};var e,s=_r(d[0]),t=_r(d[1]),o=(e=t)&&e.__esModule?e:{default:e},n=_r(d[2]),r=_r(d[3]),u=_r(d[4]),c=_r(d[5]),l=_r(d[6]),h=_r(d[7]),p=_r(d[8]),k=_r(d[9]),f=_r(d[10]),y=_r(d[11]);const b=()=>(0,y.jsx)(n.Badge,{kind:"amber",label:c.EXAMPLE_LABEL.toUpperCase()})},981,[30,127,813,819,983,1053,982,870,984,998,821,24]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useExamples",{enumerable:!0,get:function(){return l}});var t=r(d[0]),n=r(d[1]);const l=()=>(0,t.useSyncExternalStore)(n.onDataModeChange,n.examplesAllowed,n.examplesAllowed)},982,[30,1053]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"cashUpId",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"salesId",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"cashSettingsId",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"defaultCashSettings",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"useCashUp",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"useCashSettings",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"useTipsShow",{enumerable:!0,get:function(){return y}});var t=e(_r(d[0])),s=e(_r(d[1])),r=_r(d[2]),n=_r(d[3]),o=_r(d[4]),u=_r(d[5]),l=_r(d[6]);const c=(e,t)=>(0,o.uuidFrom)(`cashup:${e}:${t}`),p=(e,t)=>(0,o.uuidFrom)(`sales:${e}:${t}`),h=e=>(0,o.uuidFrom)(`cashup-settings:${e}`),f=e=>({id:h(e),cashFields:u.DEFAULT_CASHUP_FIELDS.map(e=>({...e})),salesFields:u.DEFAULT_SALES_FIELDS.map(e=>({...e}))}),S=e=>{const t='number'==typeof e.vals.cashTips?e.vals.cashTips:null,s='number'==typeof e.vals.cardTips?e.vals.cardTips:null;return!e.confirmedAt||null==t&&null==s?null:{rid:e.rid,date:e.date,total:Math.round(100*((t??0)+(s??0)))/100,postedAt:e.confirmedAt,postedBy:e.confirmedBy}},b=(0,r.create)()((0,n.persist)((e,t)=>({cashUps:[],sales:[],tips:[],pot:[],settings:{},show:{},seen:{},saveCashUp:t=>{const s={...t,id:c(t.rid,t.date)},r=S(s);return e(e=>({cashUps:[s,...e.cashUps.filter(e=>e.id!==s.id)],tips:r?[r,...e.tips.filter(e=>!(e.rid===r.rid&&e.date===r.date))]:e.tips})),s},saveSales:t=>{const s={...t,id:p(t.rid,t.weekStart)};return e(e=>({sales:[s,...e.sales.filter(e=>e.id!==s.id)]})),s},setFields:(t,s,r)=>e(e=>({settings:{...e.settings,[t]:{...e.settings[t]??f(t),[s]:r,updatedAt:(new Date).toISOString()}}})),resetFields:t=>e(e=>({settings:{...e.settings,[t]:{...f(t),updatedAt:(new Date).toISOString()}}})),setShow:(t,s)=>e(e=>({show:{...e.show,[t]:{...e.show[t]??{showToday:!0,showPot:!0},...s}}})),addPotEvent:t=>e(e=>({pot:[{...t,id:(0,l.uuid)(),at:(new Date).toISOString()},...e.pot]})),markSeen:(t,s)=>e(e=>({seen:{...e.seen,[t]:s}}))}),{name:'covercharge-cashup-v1',storage:(0,n.createJSONStorage)(()=>s.default),partialize:e=>({...e,cashUps:e.cashUps.map(e=>({...e,photos:e.photos.filter(e=>!e.startsWith('data:'))})),sales:e.sales.map(e=>({...e,photos:e.photos.filter(e=>!e.startsWith('data:'))}))})})),w=e=>{const s=b(t=>t.settings[e])??f(e);return t.default.useMemo(()=>({...s,cashFields:(0,u.withTakingsFields)(s.cashFields)}),[s])},y=e=>b(t=>t.show[e])??{showToday:!0,showPot:!0}},983,[30,1024,1008,1025,1143,984,1147]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"TAKINGS_FIELDS",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"NO_SERVICE_SPLIT",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"TAKINGS_KEYS",{enumerable:!0,get:function(){return t}}),_e.withTakingsFields=function(t){t=t.filter(e=>!n.includes(e.key));const r=new Set(t.map(e=>e.key)),o=e.filter(e=>!r.has(e.key)).map(e=>({...e}));if(!o.length)return t;const l=t.findIndex(e=>'cash'===e.key),i=l<0?t.length:l+1;return[...t.slice(0,i),...o,...t.slice(i)]},Object.defineProperty(_e,"grossOf",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"DEFAULT_CASHUP_FIELDS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"DEFAULT_SALES_FIELDS",{enumerable:!0,get:function(){return l}}),_e.parseAmount=function(e,n="money"){const t=e.replace(/[\xa3,\s]/g,'');return t?'number'===n?/^\d{1,6}$/.test(t)?Number(t):null:/^-?\d{1,7}(\.\d{1,2})?$/.test(t)?Math.round(100*Number(t))/100:null:null},Object.defineProperty(_e,"isBlank",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"ymdUTC",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"addDaysYmd",{enumerable:!0,get:function(){return u}}),_e.weekStartOf=function(e){const n=(s(e).getUTCDay()+6)%7;return u(e,-n)},_e.combinedTips=function(e){const n='number'==typeof e.cashTips?e.cashTips:null,t='number'==typeof e.cardTips?e.cardTips:null;return null==n&&null==t?null:Math.round(100*((n??0)+(t??0)))/100},Object.defineProperty(_e,"takings",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"missing",{enumerable:!0,get:function(){return d}}),_e.dailySeries=function(e,n,t,r=c){const o=new Map(e.filter(e=>e.confirmedAt).map(e=>[e.date,e]));return Array.from({length:t},(e,l)=>{const i=u(n,l-t+1),a=o.get(i);return{date:i,value:a?r(a.vals):null}})},_e.weekCompare=function(e,n,t="net"){const r=n=>{const r=e.find(e=>e.weekStart===n&&e.confirmedAt),o=r?.vals[t];return'number'==typeof o?o:null},o=r(n),l=r(u(n,-7)),i=null!=o&&null!=l&&0!==l?Math.round((o-l)/l*1e3)/10:null;return{now:o,prev:l,change:i}},_e.tipsPot=function(e,n,t,r){const o=n.filter(e=>'payout'===e.kind&&e.throughDate).sort((e,n)=>e.at.localeCompare(n.at)),l=o[o.length-1],i=l?u(l.throughDate,1):t,a=e.filter(e=>e.date>=i&&e.date<=r).sort((e,n)=>e.date.localeCompare(n.date)),s=n.filter(e=>'correction'===e.kind&&e.forDate&&e.forDate>=i&&e.forDate<=r&&(!l||e.at>l.at)),c=Math.round(100*(a.reduce((e,n)=>e+n.total,0)+s.reduce((e,n)=>e+n.amount,0)))/100;return{from:i,total:Math.max(0,c),days:a,corrections:s,lastPayout:l??null,history:o.slice().reverse()}},_e.cashLocked=function(e,n=Date.now()){return!(!e.onServer||!e.confirmedAt)&&!(e.unlockedUntil&&Date.parse(e.unlockedUntil)>n)},_e.changedFields=function(e,n){const t=e??{},r=n??{},o=[],l=t.vals??{},i=r.vals??{};for(const e of new Set([...Object.keys(l),...Object.keys(i)]))JSON.stringify(l[e])!==JSON.stringify(i[e])&&o.push(e);JSON.stringify(t.categories??null)!==JSON.stringify(r.categories??null)&&(t.categories||r.categories)&&o.push('categories');JSON.stringify(t.photos??[])!==JSON.stringify(r.photos??[])&&e&&n&&o.push('photos');return o};const e=[{key:'gross',label:'Gross takings',kind:'money',fixed:!0,optional:!0},{key:'food',label:'Food takings (optional)',kind:'money',fixed:!0,optional:!0},{key:'drink',label:'Drink takings (optional)',kind:'money',fixed:!0,optional:!0}],n=['lunchGross','dinnerGross'],t=e.map(e=>e.key);const r=e=>'number'==typeof e.gross?e.gross:null,o=[{key:'card',label:'Card takings',kind:'money'},{key:'cash',label:'Cash takings',kind:'money'},...e,{key:'float',label:'Float (tills)',kind:'money'},{key:'cashTips',label:'Cash tips total',kind:'money',fixed:!0},{key:'cardTips',label:'Card tips total',kind:'money',fixed:!0},{key:'overUnder',label:'Over / under (discrepancy)',kind:'money'},{key:'notes',label:'Notes',kind:'text'}],l=[{key:'gross',label:'Gross sales',kind:'money'},{key:'net',label:'Net sales',kind:'money',fixed:!0},{key:'vat',label:'VAT',kind:'money'},{key:'covers',label:'Covers',kind:'number'},{key:'discounts',label:'Discounts',kind:'money'},{key:'refunds',label:'Refunds',kind:'money'}];const i=e=>null==e||''===e,a=e=>e.toISOString().slice(0,10),s=e=>new Date(`${e}T12:00:00Z`),u=(e,n)=>{const t=s(e);return t.setUTCDate(t.getUTCDate()+n),a(t)};const c=e=>{const n='number'==typeof e.card?e.card:null,t='number'==typeof e.cash?e.cash:null;return null==n&&null==t?null:(n??0)+(t??0)},d=(e,n)=>e.filter(e=>'text'!==e.kind&&!e.optional&&i(n[e.key])).map(e=>e.key)},984,[]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"PLATFORM",{enumerable:!0,get:function(){return k}}),_e.Mark=S,_e.shareToSocial=function(e,t){m.useOwner.getState().setOwner({socialDraft:t}),e?.('more','social')},_e.PostToSocialButtons=P,_e.validate=B,Object.defineProperty(_e,"gmailWebUrl",{enumerable:!0,get:function(){return V}}),Object.defineProperty(_e,"linkUrl",{enumerable:!0,get:function(){return _}}),_e.openQuickLink=q,Object.defineProperty(_e,"visibleLinks",{enumerable:!0,get:function(){return G}}),_e.QuickLinksSection=function({go:e,heading:t}){const{role:l}=(0,x.useCtx)(6e4),i=(0,m.useOwner)(e=>e.quickLinks);return G(i,l).length?(0,j.jsxs)(u.default,{testID:"quick-links",style:{gap:6},children:[t('Quick links'),(0,j.jsx)(H,{go:e,compact:!0})]}):null},_e.QuickLinksRow=H,_e.QuickLinksSettings=function(){const e=(0,m.useOwner)(e=>e.quickLinks),t=(0,m.useOwner)(e=>e.workEmail),[l,i]=(0,s.useState)(()=>e.map(e=>({...e}))),[o,n]=(0,s.useState)(t),[a,r]=(0,s.useState)({label:'',url:'',icon:'\ud83c\udf10'}),[h,p]=(0,s.useState)(null),b=l.filter(e=>!e.builtIn).length,x=(e,t)=>{p(null),i(l=>l.map(l=>l.id===e?{...l,...t}:l))},f=(e,t)=>{const o=[...l],s=e+t;s<0||s>=o.length||([o[e],o[s]]=[o[s],o[e]],i(o),p(null))};return(0,j.jsxs)(u.default,{style:{gap:10},children:[(0,j.jsx)(c.Banner,{kind:"info",title:"Shortcuts only",children:"Quick links just open another app or website. CoverCharge never reads or sends your email and never signs in for you."}),(0,j.jsxs)(c.Card,{children:[(0,j.jsx)(c.T,{weight:"semibold",children:"Work email (Gmail)"}),(0,j.jsx)(c.Field,{label:"Work email address",value:o,onChangeText:e=>{n(e),p(null)},placeholder:"e.g. hello@yourrestaurant.co.uk",keyboardType:"email-address",autoCapitalize:"none",autoCorrect:!1}),(0,j.jsxs)(c.Muted,{children:["Opens the Gmail app if it\u2019s on this phone, otherwise Gmail on the web",o.trim()?` for ${o.trim()}`:'',"."]})]}),(0,j.jsx)(c.T,{weight:"semibold",colour:g.colours.gold,children:"Links (in tile order)"}),l.map((e,t)=>(0,j.jsxs)(c.Card,{children:[(0,j.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(c.T,{weight:"semibold",style:{flex:1},children:[e.icon," ",e.group?`${e.group}: `:'',e.label||'New link']}),(0,j.jsxs)(c.Row,{gap:10,children:[(0,j.jsx)(d.default,{accessibilityLabel:`Move ${e.label} up`,disabled:0===t,onPress:()=>f(t,-1),hitSlop:8,children:(0,j.jsx)(c.T,{colour:0===t?'#555':g.colours.gold,children:"\u25b2"})}),(0,j.jsx)(d.default,{accessibilityLabel:`Move ${e.label} down`,disabled:t===l.length-1,onPress:()=>f(t,1),hitSlop:8,children:(0,j.jsx)(c.T,{colour:t===l.length-1?'#555':g.colours.gold,children:"\u25bc"})})]})]}),(0,j.jsx)(c.Field,{label:"Label",value:e.label,onChangeText:t=>x(e.id,{label:t})}),'gmail'===e.kind?(0,j.jsxs)(c.Muted,{children:["Address: ",V(o)]}):(0,j.jsx)(c.Field,{label:"Web address",value:e.url,onChangeText:t=>x(e.id,{url:t}),autoCapitalize:"none",autoCorrect:!1,keyboardType:"url"}),e.builtIn?null:(0,j.jsx)(c.Row,{wrap:!0,gap:6,children:Q.map(t=>(0,j.jsx)(c.Chip,{label:t,selected:e.icon===t,onPress:()=>x(e.id,{icon:t})},t))}),(0,m.isWixLink)(e)||'gmail'===e.kind?(0,j.jsx)(c.Muted,{children:"Owners and managers only. Never shown in CoverCharge for Staff or Head Chef."}):(0,j.jsx)(c.Toggle,{label:"Staff can see this link",value:e.staff,onChange:t=>x(e.id,{staff:t})}),e.builtIn?null:(0,j.jsx)(c.Button,{small:!0,kind:"ghost",label:`Remove ${e.label||'link'}`,onPress:()=>{i(t=>t.filter(t=>t.id!==e.id)),p(null)}})]},e.id)),(0,j.jsxs)(c.Card,{children:[(0,j.jsxs)(c.T,{weight:"semibold",children:["Add your own link (",b," / ",m.MAX_CUSTOM_LINKS,")"]}),(0,j.jsx)(c.Row,{wrap:!0,gap:6,children:K.map(e=>(0,j.jsx)(c.Chip,{label:e.label,onPress:()=>r({label:e.label,url:e.url,icon:e.icon})},e.label))}),(0,j.jsx)(c.Field,{label:"New link label",value:a.label,onChangeText:e=>r({...a,label:e}),placeholder:"e.g. Google Business Profile"}),(0,j.jsx)(c.Field,{label:"New link web address",value:a.url,onChangeText:e=>r({...a,url:e}),placeholder:"https://",autoCapitalize:"none",autoCorrect:!1,keyboardType:"url"}),(0,j.jsx)(c.Row,{wrap:!0,gap:6,children:Q.map(e=>(0,j.jsx)(c.Chip,{label:e,selected:a.icon===e,onPress:()=>r({...a,icon:e})},e))}),(0,j.jsx)(c.Button,{kind:"secondary",label:"Add link",disabled:b>=m.MAX_CUSTOM_LINKS,onPress:()=>{const e=X(a.url);a.label.trim()&&Z(e)?(i(t=>[...t,{id:C('ql'),label:a.label.trim(),url:e,icon:a.icon,kind:'link',staff:!1}]),r({label:'',url:'',icon:'\ud83c\udf10'}),p({ok:!0,text:'Link added. Tap Save quick links to keep it.'})):p({ok:!1,text:'Give the new link a label and a full web address, e.g. https://example.co.uk'})}})]}),h?(0,j.jsx)(c.Banner,{kind:h.ok?'success':'danger',title:h.ok?'Done':'Check these',children:h.text}):null,(0,j.jsxs)(c.Row,{gap:8,children:[(0,j.jsx)(c.Button,{label:"Save quick links",onPress:()=>{const e=[];J(o)||e.push('The work email doesn\'t look like an email address.');const t=l.map(e=>({...e,label:e.label.trim(),url:'gmail'===e.kind?'':X(e.url)}));t.forEach(t=>{t.label||e.push('Every link needs a label.'),'gmail'===t.kind||Z(t.url)||e.push(`"${t.label||'Link'}" needs a full web address, e.g. https://example.co.uk`)}),e.length?p({ok:!1,text:[...new Set(e)].join('\n')}):(m.useOwner.getState().setOwner({quickLinks:t,workEmail:o.trim()}),i(t),p({ok:!0,text:'Quick links saved on this device.'}))},style:{flex:1}}),(0,j.jsx)(c.Button,{kind:"ghost",label:"Restore defaults",onPress:()=>{i(m.DEFAULT_QUICK_LINKS.map(e=>({...e}))),p({ok:!0,text:'Defaults restored. Tap Save quick links to keep them.'})}})]})]})},Object.defineProperty(_e,"eventDraft",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(_e,"specialDraft",{enumerable:!0,get:function(){return te}}),_e.SocialPage=function(e){return l.LIVE_VENUE_BUILD?(0,j.jsxs)(u.default,{style:{gap:12},children:[(0,j.jsx)(c.Banner,{kind:"info",title:"Social publishing is not connected",children:"Nothing is published from this app. Saved drafts are kept on this device."}),(0,j.jsx)(c.Muted,{children:"Open your social account directly to publish."})]}):(0,j.jsx)(N,{...e})},_e.SocialAccounts=function(){return l.LIVE_VENUE_BUILD?(0,j.jsx)(c.Banner,{kind:"info",title:"No social publishing connection",children:"No social accounts are connected through this app."}):(0,j.jsx)(W,{})};var t=_r(_d[0]),l=_r(_d[1]),i=_r(_d[2]),o=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(l){if('default'!==l){var i=Object.getOwnPropertyDescriptor(e,l);Object.defineProperty(t,l,i.get?i:{enumerable:!0,get:function(){return e[l]}})}}),t.default=e,t})(_r(_d[3]));_r(_d[4]);var s=_r(_d[5]),n=_r(_d[6]),a=e(_r(_d[7])),r=e(_r(_d[8]));_r(_d[9]);var d=e(_r(_d[10])),u=e(_r(_d[11])),c=_r(_d[12]),h=_r(_d[13]),m=_r(_d[14]),p=_r(_d[15]),g=_r(_d[16]),b=_r(_d[17]),x=_r(_d[18]),f=_r(_d[19]),j=_r(_d[20]);const k={facebook:{name:'Facebook',account:'Facebook Page',colour:'#2A2722',mark:'f',limit:63206,limitLabel:'63,206'},instagram:{name:'Instagram',account:'Instagram Business',colour:'#E1306C',mark:'\u25ce',limit:2200,limitLabel:'2,200'},tiktok:{name:'TikTok',account:'TikTok',colour:'#F5F1E8',mark:'\u266a',limit:2200,limitLabel:'2,200'},youtube:{name:'YouTube',account:'YouTube channel',colour:'#FF0000',mark:'\u25b6',limit:5e3,limitLabel:'5,000'}},y=()=>(0,f.venueInfo)().name,w=100,v=()=>{const e=(0,f.venueInfo)(),t=e.place.split(',').map(e=>e.trim()).filter(e=>e&&!/fictional/i.test(e)).slice(0,2).map(e=>'#'+e.replace(/[^A-Za-z0-9]/g,''));return[...new Set([e.tag,...t,'#FoodScotland','#EatLocal','#SupportLocal'])]},T=['#2A2722','#4A3A22','#40362A','#3E2A2A','#2A2722'],C=e=>`${e}-${Math.random().toString(36).slice(2,8)}`,$=e=>e.toLocaleString('en-GB');function S({p:e,size:t=22}){const l=k[e];return(0,j.jsx)(u.default,{accessibilityLabel:l.name,style:{width:t,height:t,borderRadius:'instagram'===e?.3*t:t/2,backgroundColor:'tiktok'===e?'#000':l.colour,borderWidth:'tiktok'===e?1.5:0,borderColor:'#FE2C55',alignItems:'center',justifyContent:'center'},children:(0,j.jsx)(c.T,{size:.55*t,weight:"bold",colour:'tiktok'===e?'#F5F1E8':'#fff',style:{lineHeight:.75*t},children:l.mark})})}function P({onPick:e}){const t=(0,m.useOwner)(e=>e.socialAccounts),l=({g:l,title:i,sub:o,marks:s})=>(0,j.jsxs)(d.default,{accessibilityRole:"button",accessibilityLabel:i,onPress:()=>e(l),style:({pressed:e})=>({flexGrow:1,flexBasis:240,minHeight:104,borderRadius:16,borderWidth:1.5,borderColor:g.colours.gold,backgroundColor:e?g.colours.goldTint:g.colours.surface,padding:14,gap:6}),children:[(0,j.jsxs)(c.Row,{gap:6,children:[s.map(e=>(0,j.jsx)(S,{p:e,size:26},e)),(0,j.jsx)(u.default,{style:{flex:1}}),(0,j.jsx)(c.T,{colour:g.colours.gold,size:20,children:"\u203a"})]}),(0,j.jsx)(c.T,{weight:"bold",size:18,children:i}),(0,j.jsx)(c.Muted,{children:o}),(0,j.jsx)(c.Row,{wrap:!0,gap:6,children:s.map(e=>(0,j.jsx)(c.Badge,{kind:t[e]?'ok':'neutral',label:`${k[e].name}: ${t[e]?'connected':'not connected'}`},e))})]});return(0,j.jsxs)(c.Row,{wrap:!0,gap:10,children:[(0,j.jsx)(l,{g:"meta",title:"Facebook + Instagram",sub:"Meta, linked accounts \xb7 photos, carousel, Reel or Story",marks:['facebook','instagram']}),(0,j.jsx)(l,{g:"video",title:"TikTok + YouTube",sub:"Video \xb7 TikTok and YouTube Shorts or a YouTube video",marks:['tiktok','youtube']})]})}const R=(e,t)=>({group:e,fb:t?.platforms?t.platforms.includes('facebook'):'meta'===e,ig:t?.platforms?t.platforms.includes('instagram'):'meta'===e,tt:t?.platforms?t.platforms.includes('tiktok'):'video'===e,yt:t?.platforms?t.platforms.includes('youtube'):'video'===e,igFormat:t?.igFormat??'feed',ytFormat:t?.ytFormat??'short',ytTitle:t?.ytTitle??'',ytVisibility:t?.ytVisibility??'public',text:t?.text??'',media:(t?.media??[]).map(e=>({...e,id:C('md')})),when:'now',day:0,time:'17:00',source:t?.source}),F=e=>('meta'===e.group?[e.fb&&'facebook',e.ig&&'instagram']:[e.tt&&'tiktok',e.yt&&'youtube']).filter(Boolean),O=(e,t)=>{const l=new Date(t);l.setDate(l.getDate()+e.day);const[i,o]=e.time.split(':').map(Number);return l.setHours(i,o,0,0),l},L={feed:'Feed',reel:'Reel',story:'Story'},M={short:'YouTube Shorts',video:'YouTube video'};function B(e,t,l){const i=[],o=F(e),s=e.media.filter(e=>'image'===e.kind).length,n=e.media.filter(e=>'video'===e.kind).length;return o.length||i.push('meta'===e.group?'Choose Facebook, Instagram or both.':'Choose TikTok, YouTube or both.'),'meta'===e.group?(e.ig&&!e.media.length&&i.push('Instagram needs at least one photo or video. Add one from your gallery.'),e.ig&&'reel'===e.igFormat&&!n&&i.push('An Instagram Reel needs a video.'),e.ig&&'reel'===e.igFormat&&e.media.length>1&&i.push('A Reel is one video. Remove the extra items or choose Feed for a carousel.'),e.ig&&'story'===e.igFormat&&e.media.length>1&&i.push('A Story posts one photo or video at a time. Keep one item.'),e.media.length>10&&i.push('A carousel takes up to 10 photos or videos.'),!e.fb||e.ig||e.text.trim()||e.media.length||i.push('Add some text or a photo for Facebook.')):(n||i.push('TikTok and YouTube need a video. Add one from your gallery.'),s&&i.push('TikTok and YouTube take a video only. Remove the photos.'),e.yt&&!e.ytTitle.trim()&&i.push('Add a YouTube title.'),e.yt&&e.ytTitle.length>w&&i.push(`The YouTube title is too long (${e.ytTitle.length} / ${w}).`),e.tt&&!e.text.trim()&&i.push('Add a caption for TikTok.')),o.forEach(t=>{e.text.length>k[t].limit&&i.push(`The text is too long for ${k[t].name} (${$(e.text.length)} / ${k[t].limitLabel}).`)}),o.forEach(e=>{t[e]||i.push(`${k[e].account} isn't connected. Connect it in Connected accounts, or untick it.`)}),'later'===e.when&&O(e,l).getTime()<=l.getTime()+3e5&&i.push('Pick a time at least 5 minutes from now.'),i}function I({m:e,size:t=84}){const[l,i]=(0,s.useState)(!1);return(0,j.jsxs)(u.default,{style:{width:t,height:t,borderRadius:10,overflow:'hidden',backgroundColor:e.tone??'#222',alignItems:'center',justifyContent:'center'},children:[e.uri&&'image'===e.kind&&!l?(0,j.jsx)(a.default,{source:{uri:e.uri},onError:()=>i(!0),style:{position:'absolute',width:t,height:t},resizeMode:"cover"}):null,'video'===e.kind?(0,j.jsx)(c.T,{size:.32*t,colour:"#fff",children:"\u25b6"}):!e.uri||l?(0,j.jsx)(c.T,{size:11,colour:"#fff",center:!0,numberOfLines:3,style:{padding:4},children:l?'Photo (preview unavailable)':e.name}):null,'video'===e.kind?(0,j.jsx)(c.T,{size:10,colour:"#fff",style:{position:'absolute',bottom:3,right:5},children:e.duration?`${Math.round(e.duration)}s`:'video'}):null]})}function A({p:e,n:t,title:l}){const i='yt-title'===e?w:k[e].limit,o=t>i,s=t>.9*i,n='yt-title'===e?'YouTube title':'youtube'===e?'YouTube description':k[e].name;return(0,j.jsx)(c.Badge,{kind:o?'red':s?'amber':'neutral',label:`${n} ${$(t)} / ${'yt-title'===e?w:k[e].limitLabel}`})}function D({p:e,d:l}){const i=l.media[0],o=l.text.trim()||'Your text appears here.',s=(0,j.jsxs)(c.Row,{gap:8,children:[(0,j.jsx)(S,{p:e,size:20}),(0,j.jsx)(c.T,{weight:"semibold",size:14,children:y()}),(0,j.jsx)(u.default,{style:{flex:1}}),(0,j.jsx)(c.Muted,{children:'instagram'===e?L[l.igFormat]:'youtube'===e?M[l.ytFormat]:k[e].name})]}),n=(e,t="100%")=>i?(0,j.jsxs)(u.default,{style:{width:t,aspectRatio:e,borderRadius:8,overflow:'hidden',backgroundColor:i.tone??'#222',alignItems:'center',justifyContent:'center'},children:[i.uri&&'image'===i.kind?(0,j.jsx)(a.default,{source:{uri:i.uri},style:{position:'absolute',width:'100%',height:'100%'},resizeMode:"cover"}):null,'video'===i.kind?(0,j.jsx)(c.T,{size:30,colour:"#fff",children:"\u25b6"}):i.uri?null:(0,j.jsx)(c.T,{size:12,colour:"#fff",children:i.name}),l.media.length>1?(0,j.jsx)(u.default,{style:{position:'absolute',top:6,right:6,backgroundColor:'#000a',borderRadius:10,paddingHorizontal:6},children:(0,j.jsxs)(c.T,{size:11,colour:"#fff",children:["1/",l.media.length]})}):null]}):(0,j.jsx)(u.default,{style:{width:t,aspectRatio:e,borderRadius:8,borderWidth:1,borderStyle:'dashed',borderColor:g.colours.border,alignItems:'center',justifyContent:'center'},children:(0,j.jsx)(c.Muted,{children:"No media yet"})});return(0,j.jsxs)(u.default,{accessibilityLabel:`${k[e].name} preview`,style:{flexGrow:1,flexBasis:230,maxWidth:360,backgroundColor:(0,t.soutersSurface)('#101010'),borderRadius:14,borderWidth:1,borderColor:g.colours.border,padding:10,gap:8},children:[s,'facebook'===e?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(c.T,{size:14,numberOfLines:5,children:o}),l.media.length?n(1.25):null,(0,j.jsx)(c.Muted,{children:"\ud83d\udc4d Like \xb7 \ud83d\udcac Comment \xb7 \u2197 Share"})]}):null,'instagram'===e?(0,j.jsxs)(j.Fragment,{children:[n('feed'===l.igFormat?1:.5625,'feed'===l.igFormat?'100%':'60%'),l.media.length>1&&'feed'===l.igFormat?(0,j.jsx)(c.Row,{gap:4,style:{justifyContent:'center'},children:l.media.slice(0,10).map((e,t)=>(0,j.jsx)(u.default,{style:{width:6,height:6,borderRadius:3,backgroundColor:t?'#555':'#3897F0'}},e.id))}):null,'story'!==l.igFormat?(0,j.jsxs)(c.T,{size:13,numberOfLines:3,children:[(0,j.jsx)(c.T,{size:13,weight:"semibold",children:"theanchoragedunure "}),o]}):(0,j.jsx)(c.Muted,{children:"Stories show the photo or video only."})]}):null,'tiktok'===e?(0,j.jsxs)(u.default,{style:{alignSelf:'center',width:'62%'},children:[n(.5625),(0,j.jsx)(c.T,{size:12,numberOfLines:3,style:{marginTop:4},children:o})]}):null,'youtube'===e?(0,j.jsxs)(j.Fragment,{children:['short'===l.ytFormat?(0,j.jsx)(u.default,{style:{alignSelf:'center',width:'62%'},children:n(.5625)}):n(1.7777777777777777),(0,j.jsx)(c.T,{weight:"semibold",size:14,numberOfLines:2,children:l.ytTitle.trim()||'Your YouTube title'}),(0,j.jsxs)(c.Muted,{children:[y()," \xb7 ",'public'===l.ytVisibility?'Public':'unlisted'===l.ytVisibility?'Unlisted':'Private']})]}):null]})}function E({onInsert:e,onClose:t}){const{rid:l,r:o,now:s}=(0,x.useCtx)(6e4),n=(0,m.useOwner)(e=>e.offers),a=(0,m.useOwner)(e=>e.quickLinks),r=(0,h.useEvents)(l).filter(e=>e.restaurantId===l&&e.date>=(0,p.ymd)(s)).sort((e,t)=>e.date.localeCompare(t.date)).slice(0,5),u=a.find(e=>'ql-wix-view'===e.id)?.url||(o.website?`https://${o.website}`:''),b=n.find(e=>'special'===e.kind&&e.live),k=(0,i.kitchenHoursOn)(o,s),y=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],w=[1,2,3,4,5,6,0].map(e=>{const t=(0,i.kitchenHoursOn)(o,new Date(s.getFullYear(),s.getMonth(),s.getDate()+(e-s.getDay()+7)%7));return t?`${y[e]} ${t[0]}\u2013${t[1]}`:null}).filter(Boolean).join(', '),v=[{label:'Book link',sub:u||'Set your website in Quick links',text:`Book a table: ${u}`,disabled:!u},{label:"Today's special",sub:b?b.title:'No live special',text:b?`Today's special: ${b.title}. ${b.body}`:'',disabled:!b},{label:'Opening hours',sub:k?`Kitchen today ${k[0]}\u2013${k[1]}`:'Kitchen closed today',text:`Kitchen hours: ${w}.`},...r.map(e=>({label:`What's on: ${e.title.replace(' (example)','')}`,sub:(0,p.niceDate)((0,p.parseYmd)(e.date)),text:`${e.title.replace(' (example)','')}, ${(0,p.niceDate)((0,p.parseYmd)(e.date))} at ${(0,f.venueInfo)().name}.${e.description?` ${e.description}`:''}`}))];return(0,j.jsx)(c.Sheet,{visible:!0,onClose:t,title:"Insert",children:v.map(l=>(0,j.jsxs)(d.default,{accessibilityRole:"button",accessibilityLabel:`Insert ${l.label}`,disabled:l.disabled,onPress:()=>{e(l.text),t()},style:({pressed:e})=>({padding:12,borderRadius:12,borderWidth:1,borderColor:g.colours.border,backgroundColor:e?g.colours.goldTint:g.colours.surface,opacity:l.disabled?.4:1}),children:[(0,j.jsx)(c.T,{weight:"medium",children:l.label}),(0,j.jsx)(c.Muted,{children:l.sub})]},l.label))})}function z({initial:e,onClose:t,onDone:l}){const{now:i,role:n,me:a}=(0,x.useCtx)(3e4),r=(0,m.useOwner)(e=>e.socialAccounts),[h,w]=(0,s.useState)(e),[P,R]=(0,s.useState)(!1),[z,Y]=(0,s.useState)(!1),[N,W]=(0,s.useState)(!1),[V,_]=(0,s.useState)(!1),[q,U]=(0,s.useState)(null),G=(0,s.useRef)(null);(0,s.useEffect)(()=>()=>{G.current&&clearInterval(G.current)},[]);const H=e=>w(t=>({...t,...e})),Q=F(h),K=B(h,r,i),X=m.CAN.publishSocial(n),Z='meta'===h.group,J=e=>{const t=h.media.length,l={id:C('md'),kind:e,name:'video'===e?'Example video':`Example photo ${t+1}`,tone:T[t%T.length],duration:'video'===e?24:void 0};H({media:Z?[...h.media,l].slice(0,10):[l]})},ee=(e,t)=>{const l=[...h.media],i=e+t;i<0||i>=l.length||([l[e],l[i]]=[l[i],l[e]],H({media:l}))},te=e=>H({text:h.text.includes(e)?h.text.replace(new RegExp(`\\s?${e}\\b`),''):`${h.text.trimEnd()}${h.text.trim()?' ':''}${e}`}),le=(e,t)=>{const l='later'===h.when;m.useOwner.getState().addSocialPost({group:h.group,platforms:Q,igFormat:h.igFormat,ytFormat:h.ytFormat,ytTitle:h.ytTitle.trim(),ytVisibility:h.ytVisibility,text:h.text.trim(),media:h.media,scheduleAt:l?O(h,i).toISOString():void 0,createdAt:i.toISOString(),by:a,byRole:n,status:t,results:e})};return(0,j.jsxs)(u.default,{style:{gap:10},children:[(0,j.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(c.Button,{small:!0,kind:"ghost",label:"\u2039 Post to social",onPress:t}),(0,j.jsx)(c.Row,{gap:6,children:(Z?['facebook','instagram']:['tiktok','youtube']).map(e=>(0,j.jsx)(S,{p:e},e))})]}),(0,j.jsx)(c.T,{weight:"bold",size:20,children:Z?'Facebook + Instagram':'TikTok + YouTube'}),(0,j.jsx)(c.Banner,{kind:"demo",title:"Demo, nothing is posted",children:"Publishing is simulated. Nothing goes to Facebook, Instagram, TikTok or YouTube, and no account is contacted."}),h.source?(0,j.jsx)(c.Banner,{kind:"info",title:"Prefilled",children:`From ${h.source}. Edit anything before publishing.`}):null,X?null:(0,j.jsx)(c.Banner,{kind:"info",title:"Staff draft",children:"You can prepare the post. A manager or the owner approves it before it goes out."}),(0,j.jsxs)(c.Card,{children:[(0,j.jsx)(c.T,{weight:"semibold",children:"Where to post"}),Z?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(c.Toggle,{label:"Facebook Page",value:h.fb,onChange:e=>H({fb:e})}),(0,j.jsx)(c.Toggle,{label:"Instagram",value:h.ig,onChange:e=>H({ig:e})}),(0,j.jsx)(c.Muted,{children:h.fb&&h.ig?'Both':h.fb?'Facebook only':h.ig?'Instagram only':'Nothing selected'}),h.ig?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(c.Muted,{children:"Instagram as"}),(0,j.jsx)(c.Row,{gap:6,children:['feed','reel','story'].map(e=>(0,j.jsx)(c.Chip,{label:L[e],selected:h.igFormat===e,onPress:()=>H({igFormat:e})},e))})]}):null]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(c.Toggle,{label:"TikTok",value:h.tt,onChange:e=>H({tt:e})}),(0,j.jsx)(c.Toggle,{label:"YouTube",value:h.yt,onChange:e=>H({yt:e})}),h.yt?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(c.Row,{gap:6,children:['short','video'].map(e=>(0,j.jsx)(c.Chip,{label:M[e],selected:h.ytFormat===e,onPress:()=>H({ytFormat:e})},e))}),(0,j.jsx)(c.Field,{label:"YouTube title",value:h.ytTitle,onChangeText:e=>H({ytTitle:e}),placeholder:`e.g. Fish supper night at ${(0,f.venueInfo)().name}`}),(0,j.jsx)(c.Row,{wrap:!0,gap:6,children:(0,j.jsx)(A,{p:"yt-title",n:h.ytTitle.length})}),(0,j.jsx)(c.Muted,{children:"Visibility"}),(0,j.jsx)(c.Row,{gap:6,children:['public','unlisted','private'].map(e=>(0,j.jsx)(c.Chip,{label:e[0].toUpperCase()+e.slice(1),selected:h.ytVisibility===e,onPress:()=>H({ytVisibility:e})},e))})]}):null]})]}),(0,j.jsxs)(c.Card,{children:[(0,j.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(c.T,{weight:"semibold",children:Z?'Photos and videos':'Video'}),(0,j.jsx)(c.Muted,{children:Z?`${h.media.length} / 10`:h.media.length?'1 video':'none'})]}),(0,j.jsx)(c.Button,{kind:"secondary",label:Z?'Choose from gallery':'Choose a video from gallery',onPress:async()=>{const e=await o.launchImageLibraryAsync({mediaTypes:Z?['images','videos']:['videos'],allowsMultipleSelection:Z,selectionLimit:Z?10:1,quality:.8});if(e.canceled)return;const t=e.assets.map((e,t)=>({id:C('md'),kind:'video'===e.type?'video':'image',uri:e.uri,name:e.fileName??`${'video'===e.type?'Video':'Photo'} ${h.media.length+t+1}`,duration:e.duration?e.duration/1e3:void 0}));H({media:Z?[...h.media,...t].slice(0,10):t.slice(0,1)})}}),(0,j.jsxs)(c.Row,{wrap:!0,gap:6,children:[Z?(0,j.jsx)(c.Chip,{label:"Example photo",onPress:()=>J('image')}):null,(0,j.jsx)(c.Chip,{label:"Example video",onPress:()=>J('video')})]}),h.media.length?(0,j.jsx)(c.Row,{wrap:!0,gap:8,children:h.media.map((e,t)=>(0,j.jsxs)(u.default,{accessibilityLabel:`Media ${t+1}`,style:{gap:4,alignItems:'center'},children:[(0,j.jsx)(I,{m:e}),(0,j.jsxs)(c.Row,{gap:4,children:[Z?(0,j.jsx)(d.default,{accessibilityLabel:`Move item ${t+1} left`,disabled:0===t,onPress:()=>ee(t,-1),hitSlop:6,children:(0,j.jsx)(c.T,{colour:0===t?'#555':g.colours.gold,children:"\u25c0"})}):null,(0,j.jsx)(d.default,{accessibilityLabel:`Remove item ${t+1}`,onPress:()=>H({media:h.media.filter(t=>t.id!==e.id)}),hitSlop:6,children:(0,j.jsx)(c.T,{colour:g.colours.red,children:"\u2715"})}),Z?(0,j.jsx)(d.default,{accessibilityLabel:`Move item ${t+1} right`,disabled:t===h.media.length-1,onPress:()=>ee(t,1),hitSlop:6,children:(0,j.jsx)(c.T,{colour:t===h.media.length-1?'#555':g.colours.gold,children:"\u25b6"})}):null]})]},e.id))}):(0,j.jsx)(c.Muted,{children:Z?'Add up to 10 photos or videos. Two or more make a carousel.':'Add one video (vertical works best for TikTok and Shorts).'})]}),(0,j.jsxs)(c.Card,{children:[(0,j.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(c.T,{weight:"semibold",children:Z?'Post text':'Caption / description'}),(0,j.jsx)(c.Button,{small:!0,kind:"ghost",label:"Insert \u25be",onPress:()=>Y(!0)})]}),(0,j.jsx)(c.Field,{label:"Text",value:h.text,onChangeText:e=>H({text:e}),multiline:!0,placeholder:`What\u2019s happening at ${(0,f.venueInfo)().name}?`,style:{minHeight:110}}),(0,j.jsx)(c.Row,{wrap:!0,gap:6,children:(Q.length?Q:Z?['facebook','instagram']:['tiktok','youtube']).map(e=>(0,j.jsx)(A,{p:e,n:h.text.length},e))}),(0,j.jsx)(c.Muted,{children:"Hashtags"}),(0,j.jsx)(c.Row,{wrap:!0,gap:6,children:v().map(e=>(0,j.jsx)(c.Chip,{label:e,selected:h.text.includes(e),onPress:()=>te(e)},e))})]}),(0,j.jsxs)(c.Card,{children:[(0,j.jsx)(c.T,{weight:"semibold",children:"When"}),(0,j.jsxs)(c.Row,{gap:6,children:[(0,j.jsx)(c.Chip,{label:"Post now",selected:'now'===h.when,onPress:()=>H({when:'now'})}),(0,j.jsx)(c.Chip,{label:"Schedule",selected:'later'===h.when,onPress:()=>H({when:'later',day:h.day||1})})]}),'later'===h.when?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(c.Row,{wrap:!0,gap:6,children:Array.from({length:7},(e,t)=>{const l=new Date(i);return l.setDate(l.getDate()+t),(0,j.jsx)(c.Chip,{label:0===t?'Today':1===t?'Tomorrow':(0,p.niceDate)(l),selected:h.day===t,onPress:()=>H({day:t})},t)})}),(0,j.jsx)(c.Row,{wrap:!0,gap:6,children:['09:00','11:00','12:00','15:00','17:00','19:00','21:00'].map(e=>(0,j.jsx)(c.Chip,{label:e,selected:h.time===e,onPress:()=>H({time:e})},e))}),(0,j.jsxs)(c.Muted,{children:["Goes out ",(0,p.niceDate)(O(h,i))," at ",h.time," (publishing is not set up yet, so nothing goes out)."]})]}):null]}),(0,j.jsx)(b.SectionHead,{title:"Live preview",sub:"Roughly how it will look on each platform"}),(0,j.jsxs)(c.Row,{wrap:!0,gap:10,children:[(Q.length?Q:[]).map(e=>(0,j.jsx)(D,{p:e,d:h},e)),Q.length?null:(0,j.jsx)(c.Muted,{children:"Choose at least one platform to see a preview."})]}),P&&K.length?(0,j.jsx)(c.Banner,{kind:"danger",title:"Before you publish",children:K.map(e=>`\u2022 ${e}`).join('\n')}):null,(0,j.jsx)(c.Button,{label:X?'later'===h.when?'Review & schedule':'Review & publish':'Review & send for approval',onPress:()=>{R(!0),K.length||W(!0)}}),z?(0,j.jsx)(E,{onClose:()=>Y(!1),onInsert:e=>H({text:`${h.text.trimEnd()}${h.text.trim()?'\n':''}${e}`})}):null,N?(0,j.jsxs)(c.Sheet,{visible:!0,onClose:()=>null==q?W(!1):null,title:X?'Ready to publish?':'Send for approval?',children:[(0,j.jsx)(c.Banner,{kind:"demo",title:"Demo, nothing is posted",children:"This is a simulation. No platform is contacted."}),(0,j.jsx)(c.T,{weight:"semibold",children:X?'This will go to:':'When approved, this will go to:'}),Q.map(e=>(0,j.jsxs)(c.Row,{gap:10,style:{alignItems:'flex-start'},children:[(0,j.jsx)(S,{p:e}),(0,j.jsxs)(u.default,{style:{flex:1},children:[(0,j.jsxs)(c.T,{weight:"medium",children:[k[e].account," \xb7 ",y()]}),(0,j.jsx)(c.Muted,{children:'instagram'===e?`${L[h.igFormat]}${'feed'===h.igFormat&&h.media.length>1?` (carousel of ${h.media.length})`:''}`:'youtube'===e?`${M[h.ytFormat]} \xb7 "${h.ytTitle.trim()}" \xb7 ${h.ytVisibility}`:'facebook'===e?"Page post"+(h.media.length?` with ${h.media.length} item${h.media.length>1?'s':''}`:''):'Video post'}),null!=q?(0,j.jsx)(u.default,{style:{height:6,borderRadius:3,backgroundColor:g.colours.border,marginTop:4},children:(0,j.jsx)(u.default,{style:{height:6,borderRadius:3,width:`${Math.min(100,q)}%`,backgroundColor:g.colours.gold}})}):null]})]},e)),(0,j.jsxs)(c.Muted,{children:['later'===h.when?`Scheduled for ${(0,p.niceDate)(O(h,i))} at ${h.time}.`:'Posts now.'," ",h.media.length," media item",1===h.media.length?'':'s'," \xb7 ",$(h.text.length)," characters."]}),X?(0,j.jsx)(c.Toggle,{label:"Simulate a failure on the last platform (demo)",value:V,onChange:_}):null,null!=q?(0,j.jsxs)(c.T,{colour:g.colours.gold,children:["Saving\u2026 ",Math.min(100,Math.round(q)),"%"]}):(0,j.jsxs)(c.Row,{gap:8,children:[(0,j.jsx)(c.Button,{kind:"ghost",label:"Back to edit",onPress:()=>W(!1),style:{flex:1}}),(0,j.jsx)(c.Button,{label:X?'later'===h.when?'Schedule':'Publish':'Send for approval',onPress:()=>{if(!X)return le({},'awaiting approval'),W(!1),void l('Sent for approval. A manager or the owner can approve it. Publishing: not set up yet.');U(0),G.current=setInterval(()=>U(e=>{const t=(e??0)+12.5;if(t>=100){G.current&&clearInterval(G.current);const e='later'===h.when,t=Object.fromEntries(Q.map((t,l)=>[t,V&&l===Q.length-1?'Failed (demo)':e?'Scheduled':'Posted']));return le(t,'done'),setTimeout(()=>{W(!1),U(null),l(e?`Saved for later (publishing is not set up yet, nothing goes out) for ${(0,p.niceDate)(O(h,i))} ${h.time}.`:V?'Posted (demo, nothing was actually published). One platform shows a demo failure.':'Posted (demo, nothing was actually published).')},250),100}return t}),150)},style:{flex:1}})]})]}):null]})}function Y({onDuplicate:e}){const{role:t,me:l,now:i}=(0,x.useCtx)(3e4),o=(0,m.useOwner)(e=>e.socialPosts),s=(0,m.useOwner)(e=>e.setSocialPost),n=m.CAN.publishSocial(t);return o.length?(0,j.jsx)(u.default,{style:{gap:8},children:o.map(t=>{const o=new Date(t.scheduleAt??t.createdAt);return(0,j.jsxs)(c.Card,{highlight:'awaiting approval'===t.status?g.colours.amber:void 0,children:[(0,j.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(c.Row,{gap:4,children:t.platforms.map(e=>(0,j.jsx)(S,{p:e,size:18},e))}),(0,j.jsxs)(c.Muted,{children:[t.scheduleAt?'For ':'',(0,p.niceDate)(o)," ",o.toTimeString().slice(0,5)," \xb7 by ",t.by]})]}),'video'===t.group&&t.ytTitle?(0,j.jsx)(c.T,{weight:"semibold",children:t.ytTitle}):null,(0,j.jsx)(c.T,{size:14,numberOfLines:3,children:t.text||'(no text)'}),(0,j.jsxs)(c.Muted,{children:[t.media.length," media item",1===t.media.length?'':'s',t.platforms.includes('instagram')?` \xb7 Instagram ${L[t.igFormat]}`:'',t.platforms.includes('youtube')?` \xb7 ${M[t.ytFormat]} (${t.ytVisibility})`:'']}),(0,j.jsx)(c.Row,{wrap:!0,gap:6,children:'awaiting approval'===t.status?(0,j.jsx)(c.Badge,{kind:"amber",label:"Awaiting approval"}):'declined'===t.status?(0,j.jsx)(c.Badge,{kind:"neutral",label:"Declined"}):t.platforms.map(e=>{const l=t.results[e];return(0,j.jsx)(c.Badge,{kind:'Posted'===l?'ok':'Scheduled'===l?'blue':'red',label:`${k[e].name}: ${l??'\u2014'}`},e)})}),'done'===t.status?(0,j.jsx)(c.Muted,{children:"Reach, likes and comments: not set up yet"}):null,(0,j.jsxs)(c.Row,{wrap:!0,gap:6,children:['awaiting approval'===t.status&&n?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(c.Button,{small:!0,label:"Approve & publish",onPress:()=>{const e=t.scheduleAt&&new Date(t.scheduleAt)>i;s(t.id,{status:'done',approvedBy:l,results:Object.fromEntries(t.platforms.map(t=>[t,e?'Scheduled':'Posted']))})}}),(0,j.jsx)(c.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>s(t.id,{status:'declined',approvedBy:l})})]}):null,'done'===t.status&&n&&Object.values(t.results).includes('Failed (demo)')?(0,j.jsx)(c.Button,{small:!0,kind:"secondary",label:"Retry failed (demo)",onPress:()=>s(t.id,{results:Object.fromEntries(Object.entries(t.results).map(([e,t])=>[e,'Failed (demo)'===t?'Posted':t]))})}):null,(0,j.jsx)(c.Button,{small:!0,kind:"ghost",label:"Duplicate as new",onPress:()=>e(t)})]}),t.approvedBy?(0,j.jsxs)(c.Muted,{children:['declined'===t.status?'Declined':'Approved'," by ",t.approvedBy]}):null]},t.id)})}):(0,j.jsx)(c.Muted,{children:"No posts yet. Your demo posts appear here with a status per platform."})}function N({go:e}){const{role:t}=(0,x.useCtx)(6e4),l=(0,m.useOwner)(e=>e.socialDraft),i=(0,m.useOwner)(e=>e.socialPosts),[o,n]=(0,s.useState)(null),[a,r]=(0,s.useState)(null),[d,h]=(0,s.useState)(0);(0,s.useEffect)(()=>{l&&(n(R(l.group,l)),r(null),m.useOwner.getState().setOwner({socialDraft:void 0}))},[l]);const p=i.filter(e=>'awaiting approval'===e.status).length,g=m.CAN.publishSocial(t);return o?(0,j.jsx)(z,{initial:o,onClose:()=>n(null),onDone:e=>{n(null),r(e)}},d):(0,j.jsxs)(u.default,{style:{gap:10},children:[(0,j.jsx)(c.Banner,{kind:"demo",title:"Demo, nothing is posted",children:"Compose and preview posts for Facebook, Instagram, TikTok and YouTube. Publishing is simulated on this device only."}),a?(0,j.jsx)(c.Banner,{kind:"success",title:a.split('.')[0],children:a.includes('.')&&a.slice(a.indexOf('.')+1).trim()||'Logged in Post history below.'}):null,p&&g?(0,j.jsx)(c.Banner,{kind:"warn",title:`${p} post${p>1?'s':''} awaiting approval`,children:"Drafted by staff. Approve or decline in Post history below."}):null,g?null:(0,j.jsx)(c.Muted,{children:"Staff can draft posts. A manager or the owner approves them before anything goes out."}),(0,j.jsx)(b.SectionHead,{title:"Post to social"}),(0,j.jsx)(P,{onPick:e=>{r(null),h(e=>e+1),n(R(e))}}),g?(0,j.jsx)(c.Button,{kind:"ghost",label:"Connected accounts \u203a",onPress:()=>e('more','socialaccounts')}):null,(0,j.jsx)(b.SectionHead,{title:"Post history",sub:"Status per platform. Duplicate a post to reuse it."}),(0,j.jsx)(Y,{onDuplicate:e=>{r(null),h(e=>e+1),n(R(e.group,{...e,source:'a previous post'}))}})]})}function W(){const e=(0,m.useOwner)(e=>e.socialAccounts),t=(e,t)=>m.useOwner.getState().setOwner({socialAccounts:{...m.useOwner.getState().socialAccounts,[e]:t}}),l=({p:l,via:i})=>(0,j.jsxs)(c.Row,{gap:10,children:[(0,j.jsx)(S,{p:l,size:30}),(0,j.jsxs)(u.default,{style:{flex:1},children:[(0,j.jsxs)(c.T,{weight:"semibold",children:[k[l].account,i?` (${i})`:'']}),(0,j.jsx)(c.Muted,{children:e[l]?`Connected as ${y()} (mock)`:'Not connected'})]}),(0,j.jsx)(c.Button,{small:!0,kind:e[l]?'ghost':'primary',label:e[l]?'Disconnect':'Connect',accessibilityLabel:`${e[l]?'Disconnect':'Connect'} ${k[l].name}`,onPress:()=>t(l,!e[l])})]});return(0,j.jsxs)(u.default,{style:{gap:10},children:[(0,j.jsx)(c.Banner,{kind:"demo",title:"Demo, nothing is connected",children:"These are mock connections. No login happens and no platform is contacted."}),(0,j.jsxs)(c.Card,{children:[(0,j.jsx)(c.T,{weight:"semibold",colour:g.colours.gold,children:"Meta"}),(0,j.jsx)(l,{p:"facebook",via:"via Meta"}),(0,j.jsx)(l,{p:"instagram",via:"via Meta"})]}),(0,j.jsxs)(c.Card,{children:[(0,j.jsx)(c.T,{weight:"semibold",colour:g.colours.gold,children:"Video"}),(0,j.jsx)(l,{p:"tiktok"}),(0,j.jsx)(l,{p:"youtube"})]}),(0,j.jsxs)(c.Card,{children:[(0,j.jsx)(c.T,{weight:"semibold",children:"For real posting"}),(0,j.jsx)(c.Muted,{children:"Each platform needs its business API approval before CoverCharge can publish for you: the Meta Graph API for Facebook Page and Instagram content publishing (Instagram Business or Creator account linked to the Page), the TikTok Content Posting API, and the YouTube Data API for uploads. Until then, this screen is a mock."})]})]})}const V=e=>e.trim()?`https://mail.google.com/mail/u/?authuser=${encodeURIComponent(e.trim())}`:'https://mail.google.com/mail/',_=(e,t)=>'gmail'===e.kind?V(t):e.url;async function q(e,t){return e.kind,await r.default.openURL(_(e,t)),'web'}const U=e=>{try{return new URL(e).host.replace(/^www\./,'')}catch{return e}},G=(e,t)=>'chef'!==t||(0,n.can)('chef','quick-links')?e.filter(e=>'staff'!==t||e.staff&&!(0,m.isWixLink)(e)&&'gmail'!==e.kind):[];function H({go:e,compact:t}){const{role:l}=(0,x.useCtx)(6e4),i=(0,m.useOwner)(e=>e.quickLinks),o=(0,m.useOwner)(e=>e.workEmail),[n,a]=(0,s.useState)(null),r=G(i,l),h=[];r.forEach(e=>{const t=e.group??e.id,l=h.find(e=>e.key===t);l?l.items.push(e):h.push({key:t,title:e.group??e.label,icon:e.icon,items:[e]})});const p=async e=>{const t=await q(e,o).catch(()=>null);a(t?`Opened ${'gmail'===e.kind&&'app'===t?'the Gmail app':U(_(e,o))}`:`Couldn't open ${e.label}`)};return h.length?(0,j.jsxs)(u.default,{style:{gap:6},children:[(0,j.jsx)(c.Row,{wrap:!0,gap:10,children:h.map(e=>{const l=1===e.items.length?e.items[0]:null,i='gmail'===l?.kind,s='Website bookings'===e.key?'\ud83c\udf10':e.icon,n=(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(c.Row,{gap:8,children:[(0,j.jsx)(c.T,{size:22,children:s}),(0,j.jsx)(c.T,{weight:"bold",size:16,style:{flex:1},children:e.title}),l?(0,j.jsx)(c.T,{colour:g.colours.gold,size:18,children:"\u2197"}):null]}),(0,j.jsx)(c.Muted,{numberOfLines:1,children:i?o||'Opens Gmail \xb7 set your work email in Quick links':U(l?l.url:e.items[0].url)}),l?null:(0,j.jsx)(c.Row,{gap:6,children:e.items.map(t=>(0,j.jsx)(c.Button,{small:!0,kind:t.label.startsWith('Edit')?'ghost':'secondary',label:t.label,accessibilityLabel:`${e.title}: ${t.label}`,onPress:()=>p(t),style:{flex:1}},t.id))})]}),a={flexGrow:1,flexBasis:t?150:200,minHeight:84,borderRadius:16,borderWidth:1.5,borderColor:g.colours.gold,backgroundColor:g.colours.surface,padding:12,gap:6};return l?(0,j.jsx)(d.default,{accessibilityRole:"link",accessibilityLabel:e.title,onPress:()=>p(l),style:({pressed:e})=>[a,e&&{backgroundColor:g.colours.goldTint}],children:n},e.key):(0,j.jsx)(u.default,{style:a,children:n},e.key)})}),n?(0,j.jsx)(c.Muted,{children:n}):null,e&&m.CAN.manage(l)?(0,j.jsx)(c.Button,{small:!0,kind:"ghost",label:"Edit quick links \u203a",onPress:()=>e('more','quicklinks'),style:{alignSelf:'flex-start'}}):null]}):null}const Q=['\u2709\ufe0f','\ud83c\udf10','\ud83d\udd8a\ufe0f','\ud83d\udcc5','\u2b50','\ud83d\udccd','\ud83d\udcc8','\ud83d\uded2','\ud83d\udcde','\ud83d\udd8b\ufe0f'],K=[{label:'Outlook',url:'https://outlook.office.com/mail/',icon:'\u2709\ufe0f'},{label:'Squarespace',url:'https://account.squarespace.com',icon:'\ud83d\udd8a\ufe0f'},{label:'Google Business Profile',url:'https://business.google.com',icon:'\ud83d\udccd'}],X=e=>{const t=e.trim();return t?/^(https?:|mailto:|tel:)/i.test(t)?t:`https://${t}`:t},Z=e=>/^(https?:\/\/[^\s/$.?#][^\s]*\.[^\s]+|mailto:[^\s@]+@[^\s@]+|tel:\+?[\d\s]{6,})$/i.test(e),J=e=>!e.trim()||/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e.trim());const ee=e=>{const t=e.title.replace(' (example)','');return{group:'meta',source:`What's on: ${t}`,text:`${t}, ${(0,p.niceDate)((0,p.parseYmd)(e.date))} at ${(0,f.venueInfo)().address}.${e.description?`\n${e.description}`:''}\nBook your table now. ${(0,f.venueInfo)().tag}`,ytTitle:`${t} at ${(0,f.venueInfo)().name}`.slice(0,w)}},te=e=>{const t=e.title.replace(' (example)','');return{group:'meta',source:`Specials: ${t}`,text:`${t}\n${e.body}\n${(0,f.venueInfo)().tag}`,ytTitle:t.slice(0,w)}}},985,[878,833,815,1006,1457,30,807,196,239,122,263,127,813,819,854,818,821,953,954,1010,24]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AllergyChain=j,_e.BookingAllergyChain=function({b:l,me:s,readOnly:k}){const p=(0,i.useOrders)(l.restaurantId),A=(0,n.useStore)(e=>e.ackBookingAllergy);if(!l.allergies.length)return null;const S=p.find(e=>e.allergies.length&&!['cancelled','closed'].includes(e.status)&&(e.bookingId===l.id||!e.bookingId&&(0,c.linkedBooking)(e,[l])?.id===l.id));if(S)return(0,h.jsx)(j,{o:S,me:s,readOnly:k,compact:!0});const w={booked:l.allergyAck,ordered:void 0,kitchen:void 0,pass:void 0,table:void 0};return(0,h.jsxs)(t.default,{testID:`allergy-chain-${l.ref}`,style:{gap:6,padding:8,borderRadius:10,borderWidth:1,borderColor:l.allergyAck?u.colours.border:u.colours.red,backgroundColor:(0,e.soutersSurface)('#140f0e')},children:[(0,h.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsxs)(o.T,{size:13,weight:"semibold",colour:"#FFD9D4",children:["Allergen sign-off \xb7 ",l.ref]}),(0,h.jsx)(o.Badge,{kind:l.allergyAck?'amber':'red',label:(l.allergyAck?1:0)+" of 5"})]}),(0,h.jsx)(y,{chain:w,next:l.allergyAck?null:'booked',testID:`allergy-steps-${l.ref}`}),l.allergyAck?(0,h.jsxs)(o.Row,{gap:6,children:[(0,h.jsx)(f.StaffAvatar,{name:l.allergyAck.by,size:20,ring:!1}),(0,h.jsxs)(o.Muted,{style:{flex:1},children:["1. Booked: ",x(l.allergyAck.by)," at ",b(l.allergyAck.at),". Steps 2 to 5 are signed on the table's order."]})]}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(o.T,{size:13,children:"Next: 1. Booked. Allergy recorded (who took it)."}),k?null:(0,h.jsxs)(o.Row,{wrap:!0,gap:8,children:[(0,h.jsx)(o.Button,{small:!0,kind:"danger",label:"Sign off",testID:`sign-off-${l.ref}`,accessibilityLabel:`Sign off Booked on ${l.ref}`,disabled:!s.trim(),onPress:()=>A(l.id,s)}),(0,h.jsxs)(o.Muted,{children:["as ",x(s)]})]})]})]})};var e=r(d[0]);r(d[1]);var l,s=r(d[2]),t=(l=s)&&l.__esModule?l:{default:l},o=r(d[3]),i=r(d[4]),n=r(d[5]),c=r(d[6]),u=r(d[7]),f=r(d[8]),h=r(d[9]);const b=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}),x=e=>e.replace(' (example)','');function y({chain:e,next:l,testID:s}){return(0,h.jsx)(t.default,{testID:s,accessibilityLabel:`Allergen sign-off ${c.CHAIN_STEPS.filter(l=>e[l.id]).length} of 5`,style:{flexDirection:'row',alignItems:'flex-start'},children:c.CHAIN_STEPS.map((s,i)=>{const n=!!e[s.id],c=l===s.id,f=n?u.colours.ok:c?u.colours.gold:u.colours.border;return(0,h.jsxs)(t.default,{style:{flex:1,alignItems:'center'},children:[(0,h.jsxs)(t.default,{style:{flexDirection:'row',alignItems:'center',width:'100%'},children:[(0,h.jsx)(t.default,{style:{flex:1,height:2,backgroundColor:i?n||c?f:u.colours.border:'transparent'}}),(0,h.jsx)(t.default,{style:{width:26,height:26,borderRadius:13,borderWidth:2,borderColor:f,backgroundColor:n?u.colours.ok:'transparent',alignItems:'center',justifyContent:'center'},children:(0,h.jsx)(o.T,{size:12,weight:"bold",colour:n?'#0B0B0B':c?u.colours.gold:u.colours.muted,children:n?'\u2713':String(s.n)})}),(0,h.jsx)(t.default,{style:{flex:1,height:2,backgroundColor:i<4?n?u.colours.ok:u.colours.border:'transparent'}})]}),(0,h.jsx)(o.T,{size:11,weight:c?'semibold':'regular',colour:n?u.colours.text:c?u.colours.gold:u.colours.muted,center:!0,children:s.label}),e[s.id]?(0,h.jsxs)(o.T,{size:10,colour:u.colours.muted,center:!0,numberOfLines:2,children:[x(e[s.id].by).split(' ')[0]," ",b(e[s.id].at)]}):null]},s.id)})})}function j({o:l,me:s,readOnly:j,compact:k}){const p=(0,i.useBookings)(l.restaurantId),A=(0,n.useStore)(e=>e.signAllergyStep);if(!l.allergies.length)return null;const S=(0,c.linkedBooking)(l,p),w=(0,c.orderChain)(l,S),I=(0,c.nextStep)(l,S),C=c.CHAIN_STEPS.filter(e=>w[e.id]).length,B=I?(0,c.stepInfo)(I):null,D='table'===I&&!['ready','served','collected'].includes(l.status);return(0,h.jsxs)(t.default,{testID:`allergy-chain-${l.ref}`,style:{gap:6,padding:8,borderRadius:10,borderWidth:1,borderColor:I?u.colours.red:u.colours.ok,backgroundColor:(0,e.soutersSurface)('#140f0e')},children:[(0,h.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsxs)(o.T,{size:13,weight:"semibold",colour:I?'#FFD9D4':'#E2C489',children:["Allergen sign-off \xb7 ",l.ref]}),(0,h.jsx)(o.Badge,{kind:I?'red':'ok',label:I?`${C} of 5`:'Complete'})]}),(0,h.jsx)(y,{chain:w,next:I,testID:`allergy-steps-${l.ref}`}),k?null:c.CHAIN_STEPS.filter(e=>w[e.id]).map(e=>(0,h.jsxs)(o.Row,{gap:6,children:[(0,h.jsx)(f.StaffAvatar,{name:w[e.id].by,size:20,ring:!1}),(0,h.jsxs)(o.Muted,{style:{flex:1},children:[e.n,". ",e.label,": ",x(w[e.id].by)," at ",b(w[e.id].at)]})]},e.id)),B?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(o.T,{size:13,children:["Next: ",B.n,". ",B.label,". ",B.what,"."]}),j?null:(0,h.jsxs)(o.Row,{wrap:!0,gap:8,children:[(0,h.jsx)(o.Button,{small:!0,kind:"danger",label:"Sign off",testID:`sign-off-${l.ref}`,accessibilityLabel:`Sign off ${B.label} on ${l.ref}`,disabled:!s.trim()||D,onPress:()=>A(l.id,I,s)}),(0,h.jsxs)(o.Muted,{children:["as ",x(s)]})]}),D?(0,h.jsx)(o.Muted,{children:"Signed off at the pass. The table step is signed when the dish is served."}):(0,h.jsx)(o.Muted,{children:"The ticket can't move on until this step is signed off."})]}):(0,h.jsx)(o.Muted,{children:"All five steps signed off. The full chain is in the allergen audit log."})]})}},986,[878,30,127,813,1019,870,987,821,955,24]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CHAIN_STEPS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"stepInfo",{enumerable:!0,get:function(){return t}}),e.linkedBooking=l,e.orderChain=o,e.nextStep=s,Object.defineProperty(e,"doneCount",{enumerable:!0,get:function(){return c}}),e.canSign=function(n,t,l){return s(n,l)===t},e.statusBlock=function(n,l,s){if(!n.allergies.length||'cancelled'===l)return null;const c=o(n,s),u=n=>c[n]?null:`${t(n).n}. ${t(n).label} needs signing off first`;return'acknowledged'===l||'preparing'===l||'ready'===l?u('booked')??u('ordered')??u('kitchen'):'served'===l?u('booked')??u('ordered')??u('kitchen')??u('pass'):'collected'===l||'closed'===l?u('booked')??u('ordered')??u('kitchen')??u('pass')??u('table'):null},e.chainNeedsAction=function(n,t){const o=s(n,l(n,t));return!(!o||'table'===o&&!['ready','served'].includes(n.status))},e.bookingNeedsAction=function(n,t){return n.allergies.length>0&&!n.allergyAck&&!t.some(t=>t.allergies.length&&l(t,[n])?.id===n.id)};const n=[{id:'booked',n:1,label:'Booked',what:'Allergy recorded (who took it)'},{id:'ordered',n:2,label:'Ordered',what:'Server confirms with the guest'},{id:'kitchen',n:3,label:'Kitchen',what:'Chef signs off before cooking'},{id:'pass',n:4,label:'Pass',what:'Checked before it leaves the pass'},{id:'table',n:5,label:'Table',what:'Server signs off when served'}],t=t=>n.find(n=>n.id===t);function l(n,t){return n.bookingId?t.find(t=>t.id===n.bookingId):'table'===n.type&&n.tableNo?t.find(t=>t.restaurantId===n.restaurantId&&'seated'===t.status&&!!t.table&&t.table.split('+').includes(String(n.tableNo))):void 0}function o(n,t){return{booked:n.allergyChain?.booked??(t?.allergies.length?t.allergyAck:void 0),ordered:n.allergyChain?.ordered,kitchen:n.allergyAck,pass:n.allergyChain?.pass,table:n.handoverCheck}}function s(t,l){if(!t.allergies.length)return null;const s=o(t,l);return n.find(n=>!s[n.id])?.id??null}const c=(t,l)=>{const s=o(t,l);return n.filter(n=>s[n.id]).length}},987,[]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"payFor",{enumerable:!0,get:function(){return b.payFor}}),Object.defineProperty(_e,"useVenuePay",{enumerable:!0,get:function(){return b.useVenuePay}}),_e.PayTipsSettings=function({go:e}){const{rid:s,today:t}=(0,x.useCtx)(6e4),{pay:n,source:r}=(0,b.useVenuePay)(s),[l,c]=(0,o.useState)(n),[p,y]=(0,o.useState)((0,u.ukDate)(n.tipsAnchorPayday)),[C,S]=(0,o.useState)(null),D=(0,u.parseUk)(p),M=(0,u.cleanPay)({...l,tipsAnchorPayday:D??l.tipsAnchorPayday}),B=JSON.stringify(M)!==JSON.stringify(n)||'settings'!==r,R=(0,u.nextToPay)(M,'tips',t).period,z=(0,u.nextToPay)(M,'wage',t).period,v=(0,u.tipsPeriod)(M,R.start,1),$=(0,u.wagePeriod)(M,z.start,1),O=e=>{c({...l,...e}),S(null)};return(0,j.jsxs)(d.default,{style:{gap:12},testID:"pay-settings",children:['none'===r?(0,j.jsx)(i.Banner,{kind:"warn",title:"Pay dates not set up yet",children:"Set your tips and wage dates here. Until then the app uses calendar months and weekly tips."}):null,'questionnaire'===r?(0,j.jsx)(i.Banner,{kind:"info",title:"From your sign-up answers",children:"These dates came from your questionnaire. Check them and tap Save to make them your venue's pay dates."}):null,(0,j.jsx)(f.SectionHead,{title:"Tips (tronc)",sub:"How often tips are paid out, and which days each payout covers."}),(0,j.jsxs)(i.Card,{children:[(0,j.jsx)(i.T,{weight:"semibold",children:"How often"}),(0,j.jsx)(i.Row,{wrap:!0,gap:6,children:['weekly','fortnightly','monthly'].map(e=>(0,j.jsx)(i.Chip,{label:w[e],selected:l.tipsFrequency===e,onPress:()=>O({tipsFrequency:e})},e))}),(0,j.jsx)(i.Field,{label:"A tips payday (DD/MM/YYYY). Every other one is worked out from it",value:p,onChangeText:e=>{y(e),S(null)},placeholder:"02/11/2026",keyboardType:"numbers-and-punctuation"}),D?(0,j.jsxs)(i.Muted,{children:[(0,u.dayMonth)(D)," ",D.slice(0,4)]}):(0,j.jsx)(i.T,{size:13,colour:h.colours.red,children:"Enter a date like 02/11/2026"}),(0,j.jsx)(i.T,{weight:"semibold",children:"Each tips period ends"}),(0,j.jsxs)(i.Row,{children:[(0,j.jsx)(i.Stepper,{label:"days before payday",value:l.tipsEndsDaysBefore,min:0,max:13,onChange:e=>O({tipsEndsDaysBefore:e})}),(0,j.jsx)(i.Muted,{style:{flex:1},children:0===l.tipsEndsDaysBefore?'on payday':1===l.tipsEndsDaysBefore?'day before payday (a Monday payday covers up to the Sunday)':'days before payday'})]})]}),(0,j.jsx)(f.SectionHead,{title:"Wages",sub:"Monthly pay: the cut-off starts each pay period."}),(0,j.jsxs)(i.Card,{children:[(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(i.T,{weight:"semibold",style:{flex:1},children:"Pay day of the month"}),(0,j.jsx)(i.Stepper,{label:"pay day",value:l.wagePayDay,min:1,max:31,onChange:e=>O({wagePayDay:e})})]}),(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(i.T,{weight:"semibold",style:{flex:1},children:"Cut-off (first day of each period)"}),(0,j.jsx)(i.Stepper,{label:"cut-off day",value:l.wageCutoffDay,min:1,max:28,onChange:e=>O({wageCutoffDay:e})})]}),(0,j.jsxs)(i.Muted,{children:["Period runs the ",P(l.wageCutoffDay)," to the ",P(1===l.wageCutoffDay?31:l.wageCutoffDay-1),1===l.wageCutoffDay?' (end of the month)':' of the next month',". A pay day past the month end uses the last day."]}),(0,j.jsx)(i.T,{weight:"semibold",children:"A pay day on a weekend"}),(0,j.jsx)(i.Row,{wrap:!0,gap:6,children:['none','before','after'].map(e=>(0,j.jsx)(i.Chip,{label:T[e],selected:(l.weekendRule??'none')===e,onPress:()=>O({weekendRule:e})},e))})]}),(0,j.jsx)(f.SectionHead,{title:"Preview"}),(0,j.jsxs)(i.Card,{highlight:h.colours.gold,children:[(0,j.jsx)(k,{label:"Next tips payday",day:R.payday,period:R}),(0,j.jsx)(k,{label:"Then",day:v.payday,period:v}),(0,j.jsx)(d.default,{style:{height:1,backgroundColor:h.colours.border}}),(0,j.jsx)(k,{label:"Next payday",day:z.payday,period:z}),(0,j.jsx)(k,{label:"Then",day:$.payday,period:$})]}),(0,j.jsx)(i.Button,{kind:"success",label:'settings'===r?'Save pay dates':'Save as our pay dates',disabled:!D||!B,testID:"save-pay",onPress:()=>{a.useStore.getState().updateSettings(s,{pay:M}),S('Saved. Everyone in the venue sees these dates.')}}),C?(0,j.jsx)(i.Banner,{kind:"success",title:C}):null,(0,j.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Payroll hours",onPress:()=>e('more','hours')}),(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Tips day",onPress:()=>e('more','tipsday')})]})]})},_e.hoursIn=S,Object.defineProperty(_e,"toTsv",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"toCsv",{enumerable:!0,get:function(){return $}}),_e.summaryTable=O,_e.detailTable=H,_e.copyText=I,_e.periodOptions=W,_e.PayrollHours=function({go:e}){const{rid:s,today:n,now:a,r:y}=(0,x.useCtx)(6e4),{pay:f,source:w}=(0,b.useVenuePay)(s),T=(0,l.useOwner)(e=>e.staff),P=(0,l.useOwner)(e=>e.attendance),k=(0,x.useHourly)(),C=(0,o.useMemo)(()=>W(f,n),[f,n]),[B,R]=(0,o.useState)('wage'),[z,F]=(0,o.useState)(null),[V,A]=(0,o.useState)(!1),[E,Y]=(0,o.useState)({}),[G,U]=(0,o.useState)(null),_='custom'===B&&z?z:(C.find(e=>e.id===B)??C[0]).period,q=(0,o.useMemo)(()=>S(_,T,P,a,k),[_.key,T,P,k,Math.floor(a.getTime()/6e4)]),J=q.some(e=>null!=e.rate),K='tips'===_.kind,Q=q.reduce((e,s)=>({c:e.c+s.confirmed,p:e.p+s.pending,s:e.s+s.shifts,g:e.g+(s.gross??0)}),{c:0,p:0,s:0,g:0}),X=q.filter(e=>e.pending>0).length,Z=`${y.name}: hours ${(0,u.rangeText)(_.start,_.end)}`,ee=`hours-${_.start}-to-${_.end}`,se=e=>{U(e),setTimeout(()=>U(null),6e3)};return(0,j.jsxs)(d.default,{style:{gap:10},testID:"payroll-hours",children:['none'===w?(0,j.jsxs)(i.Banner,{kind:"warn",title:"Pay dates not set up",children:[(0,j.jsx)(i.Muted,{children:"Using calendar months for now."}),(0,j.jsx)(i.Button,{small:!0,kind:"ghost",label:"Set your pay dates \u203a",onPress:()=>e('more','paysettings')})]}):null,(0,j.jsxs)(i.Row,{wrap:!0,gap:6,children:[C.map(e=>(0,j.jsx)(i.Chip,{label:e.label,sub:e.sub,selected:B===e.id,onPress:()=>{R(e.id),A(!1)}},e.id)),(0,j.jsx)(i.Chip,{label:"Custom dates",sub:z&&'custom'===B?(0,u.rangeText)(z.start,z.end):'Pick any range',selected:'custom'===B,onPress:()=>A(!V)})]}),V?(0,j.jsx)(N,{onSet:e=>{F(e),R('custom'),A(!1)}}):null,(0,j.jsx)(i.Card,{highlight:h.colours.gold,children:(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,j.jsxs)(d.default,{style:{flexShrink:1,minWidth:0},children:[(0,j.jsxs)(i.T,{weight:"bold",size:18,children:[(0,u.rangeText)(_.start,_.end)," ",_.end.slice(0,4)]}),(0,j.jsxs)(i.Muted,{children:[(0,u.ukDate)(_.start)," to ",(0,u.ukDate)(_.end),_.payday?` \xb7 ${_.payday>=n?'pays':'paid'} ${(0,u.dayMonth)(_.payday)}`:'',K?' \xb7 tips period':'wage'===_.kind?' \xb7 wage period':'']})]}),(0,j.jsxs)(d.default,{style:{alignItems:'flex-end'},children:[(0,j.jsxs)(i.T,{size:22,weight:"bold",colour:h.colours.gold,children:[(0,u.decH)(Q.c)," h"]}),(0,j.jsxs)(i.Muted,{children:["confirmed (",(0,u.hMm)(Q.c),")"]})]})]})}),X?(0,j.jsx)(r.default,{accessibilityRole:"button",accessibilityLabel:"Sign off pending hours",onPress:()=>e('more','signoff'),testID:"pending-banner",children:(0,j.jsxs)(d.default,{style:{backgroundColor:h.colours.amberBg,borderRadius:12,padding:12,borderLeftWidth:6,borderLeftColor:h.colours.amber,gap:4},children:[(0,j.jsxs)(i.T,{weight:"bold",colour:h.colours.amber,children:["\u26a0 ",(0,u.decH)(Q.p)," h still waiting for sign-off (",X," ",1===X?'person':'people',")"]}),(0,j.jsx)(i.T,{size:14,children:"Pending hours are not in the totals or the exports' confirmed columns. Sign them off first so everyone is paid in full."}),(0,j.jsx)(i.T,{weight:"semibold",colour:h.colours.gold,children:"Sign off hours \u203a"})]})}):(0,j.jsx)(i.Banner,{kind:"success",title:"All hours in this period are signed off"}),(0,j.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(i.Button,{small:!0,kind:"success",label:"Copy for spreadsheet",testID:"copy-tsv",onPress:async()=>{const e=await I(v(O(q,_,J,K)));se(e?`Copied ${q.length} rows. Paste into the first cell of your spreadsheet.`:'Copy is not available here. Use Download CSV.')}}),(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Download CSV",onPress:()=>{(0,p.downloadText)(`${ee}.csv`,$(O(q,_,J,K))),se('CSV downloaded (summary).')}}),(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Download CSV (daily detail)",onPress:()=>{(0,p.downloadText)(`${ee}-daily.csv`,$(H(q))),se('CSV downloaded (one line per shift).')}}),(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Print / PDF",onPress:()=>{const e=O(q,_,J,K);(0,p.printTable)(Z,`${(0,u.ukDate)(_.start)} to ${(0,u.ukDate)(_.end)} \xb7 confirmed hours only in the totals \xb7 printed ${(0,u.ukDate)(n)}`,e[0],e.slice(1))}})]}),G?(0,j.jsx)(i.Banner,{kind:"success",title:G}):null,(0,j.jsx)(t.WideTable,{children:(0,j.jsxs)(d.default,{testID:"hours-table",children:[(0,j.jsx)(t.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:h.colours.border,paddingBottom:4},children:['Name','Shifts','Confirmed','Pending',K?'Tips h':'h:mm',J?'Rate':'',J?'Gross':''].map((e,s)=>(0,j.jsx)(i.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{width:L[s]},children:e},s))}),q.map(e=>{const s=!!E[e.person.id];return(0,j.jsxs)(d.default,{style:{borderBottomWidth:1,borderColor:'#222'},children:[(0,j.jsx)(r.default,{accessibilityRole:"button",accessibilityLabel:`${M(e.person)} daily hours`,onPress:()=>Y({...E,[e.person.id]:!s}),style:{paddingVertical:7},children:(0,j.jsxs)(t.TRow,{heads:['Name','Shifts','Confirmed','Pending',K?'Tips h':'h:mm',J?'Rate':'',J?'Gross':''],children:[(0,j.jsxs)(d.default,{style:{width:L[0]},children:[(0,j.jsxs)(i.T,{size:14,weight:"semibold",numberOfLines:1,children:[s?'\u25be':'\u25b8'," ",M(e.person)]}),(0,j.jsx)(i.Muted,{numberOfLines:1,children:D(e.person)})]}),(0,j.jsx)(i.T,{size:14,style:{width:L[1]},children:e.shifts}),(0,j.jsx)(i.T,{size:14,weight:"semibold",style:{width:L[2]},children:(0,u.decH)(e.confirmed)}),(0,j.jsx)(i.T,{size:14,weight:e.pending?'bold':'regular',colour:e.pending?h.colours.amber:h.colours.muted,style:{width:L[3]},children:e.pending?`\u26a0 ${(0,u.decH)(e.pending)}`:'0.00'}),(0,j.jsx)(i.T,{size:14,style:{width:L[4]},children:K?(0,u.decH)(e.confirmed):(0,u.hMm)(e.confirmed)}),(0,j.jsx)(i.T,{size:14,colour:h.colours.muted,style:{width:L[5]},children:J?null!=e.rate?(0,c.gbp)(e.rate):'\u2013':''}),(0,j.jsx)(i.T,{size:14,weight:"semibold",style:{width:L[6]},children:J?null!=e.gross?(0,c.gbp)(e.gross):'\u2013':''})]})}),s?(0,j.jsxs)(d.default,{style:{backgroundColor:h.colours.surface2,borderRadius:8,padding:8,marginBottom:8,gap:2},testID:`daily-${e.person.id}`,children:[(0,j.jsx)(t.TRow,{head:!0,children:['Date','In','Out','Break','Paid','Status'].map((e,s)=>(0,j.jsx)(i.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{width:[96,52,52,52,56,90][s]},children:e},e))}),e.days.map(e=>(0,j.jsxs)(t.TRow,{heads:['Date','In','Out','Break','Paid','Status'],children:[(0,j.jsx)(i.T,{size:13,style:{width:96},children:(0,u.dayMonth)(e.date)}),(0,j.jsx)(i.T,{size:13,style:{width:52},children:e.inT}),(0,j.jsx)(i.T,{size:13,style:{width:52},children:e.outT||'\u2013'}),(0,j.jsx)(i.T,{size:13,style:{width:52},children:'On now'===e.status?'\u2013':`${e.brk}m`}),(0,j.jsx)(i.T,{size:13,style:{width:56},children:'On now'===e.status?'\u2013':(0,u.hMm)(e.paid)}),(0,j.jsx)(i.T,{size:13,weight:"semibold",style:{width:90},colour:'Confirmed'===e.status?h.colours.ok:'Pending'===e.status?h.colours.amber:h.colours.blue,children:e.status})]},e.a.id)),e.days.length?null:(0,j.jsx)(i.Muted,{children:"No clocked shifts in this period."})]}):null]},e.person.id)}),(0,j.jsxs)(t.TRow,{heads:['','Shifts','Confirmed','Pending',K?'Tips h':'h:mm','',J?'Gross':''],style:{paddingVertical:8,borderTopWidth:2,borderColor:h.colours.gold},children:[(0,j.jsxs)(i.T,{size:14,weight:"bold",style:{width:L[0]},children:["Total (",q.length,")"]}),(0,j.jsx)(i.T,{size:14,weight:"bold",style:{width:L[1]},children:Q.s}),(0,j.jsx)(i.T,{size:14,weight:"bold",colour:h.colours.gold,style:{width:L[2]},children:(0,u.decH)(Q.c)}),(0,j.jsx)(i.T,{size:14,weight:"bold",colour:Q.p?h.colours.amber:h.colours.muted,style:{width:L[3]},children:(0,u.decH)(Q.p)}),(0,j.jsx)(i.T,{size:14,weight:"bold",style:{width:L[4]},children:K?(0,u.decH)(Q.c):(0,u.hMm)(Q.c)}),(0,j.jsx)(i.T,{size:14,style:{width:L[5]},children:" "}),(0,j.jsx)(i.T,{size:14,weight:"bold",style:{width:L[6]},children:J?(0,c.gbp)(Q.g):''})]})]})}),(0,j.jsxs)(i.Muted,{children:["Tap a name for each day. Hours are decimal (37.50 = 37 hours 30 minutes); h:mm is also in the export. Paid hours = clock out \u2212 clock in \u2212 break. ",J?'Gross is before tax, from confirmed hours only.':'Rates and gross show once you sign in with your personal link.']}),K?(0,j.jsx)(i.Button,{kind:"success",label:"Tips day: split tips for this period \u203a",onPress:()=>e('more','tipsday')}):null]})},_e.TipsDay=function({go:e}){const{rid:n,today:a,now:f}=(0,x.useCtx)(6e4),{pay:w,source:T}=(0,b.useVenuePay)(n),P=(0,l.useOwner)(e=>e.staff),k=(0,l.useOwner)(e=>e.attendance),C=(0,l.useOwner)(e=>e.tronc),R=(0,u.nextToPay)(w,'tips',a),[z,O]=(0,o.useState)(0),H=(0,u.tipsPeriod)(w,R.period.start,z),[W,N]=(0,o.useState)(''),[L,F]=(0,o.useState)({}),[V,A]=(0,o.useState)(null),E=(0,o.useMemo)(()=>S(H,P,k,f,{}),[H.key,P,k]),Y=e=>'owner'===e.role&&!C.includeOwner||'manager'===e.role&&!C.includeManagers,G=e=>L[e.id]??Y(e),U=E.filter(e=>e.confirmed>0||e.pending>0),_=Math.round(100*Number(W.replace(/[\xa3,\s]/g,''))),q=Number.isFinite(_)&&_>0&&_<=1e8&&/^\s*\xa3?\s*[\d,]+(\.\d{0,2})?\s*$/.test(W),J=U.filter(e=>!G(e.person)&&e.confirmed>0),{amounts:K}=(0,y.allocate)(q?_:0,J.map(e=>e.confirmed)),Q={};J.forEach((e,s)=>{Q[e.person.id]=K[s]});const X=J.reduce((e,s)=>e+s.confirmed,0),Z=Object.values(Q).reduce((e,s)=>e+s,0),ee=U.filter(e=>e.pending>0&&!G(e.person)),se=ee.reduce((e,s)=>e+s.pending,0),te=()=>[['Name','Role','Period start','Period end','Payday','Confirmed hours','Confirmed h:mm','Share %','Tips \xa3'],...U.map(e=>{const s=!G(e.person)&&e.confirmed>0;return[M(e.person),D(e.person),(0,u.ukDate)(H.start),(0,u.ukDate)(H.end),H.payday?(0,u.ukDate)(H.payday):'',(0,u.decH)(e.confirmed),(0,u.hMm)(e.confirmed),s&&X?(e.confirmed/X*100).toFixed(2):'0.00',s?B(Q[e.person.id]??0):G(e.person)?'excluded':'0.00']}),['TOTAL','',(0,u.ukDate)(H.start),(0,u.ukDate)(H.end),H.payday?(0,u.ukDate)(H.payday):'',(0,u.decH)(X),(0,u.hMm)(X),X?'100.00':'0.00',B(Z)]],oe=e=>{A(e),setTimeout(()=>A(null),6e3)};return(0,j.jsxs)(d.default,{style:{gap:10},testID:"tips-day",children:[(0,j.jsx)(i.Banner,{kind:"info",title:"Saving payouts and notifying staff are coming next",children:"For now this works out the split and exports it. Nothing is saved to the team, sent or paid."}),'none'===T?(0,j.jsxs)(i.Banner,{kind:"warn",title:"Tips dates not set up",children:[(0,j.jsx)(i.Muted,{children:"Using weekly tips for now."}),(0,j.jsx)(i.Button,{small:!0,kind:"ghost",label:"Set your pay dates \u203a",onPress:()=>e('more','paysettings')})]}):null,(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(i.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",disabled:z<=-6,onPress:()=>O(z-1)}),(0,j.jsxs)(d.default,{style:{alignItems:'center',flex:1},children:[(0,j.jsx)(i.T,{weight:"bold",size:18,children:(0,u.rangeText)(H.start,H.end)}),(0,j.jsxs)(i.Muted,{children:[(0,u.ukDate)(H.start)," to ",(0,u.ukDate)(H.end)," \xb7 ",H.payday>=a?'paid':'was paid'," ",(0,u.dayMonth)(H.payday)]}),0===z?(0,j.jsx)(i.Badge,{kind:"gold",label:"Paid next"}):null]}),(0,j.jsx)(i.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:z>=1,onPress:()=>O(z+1)})]}),(0,j.jsxs)(i.Card,{highlight:h.colours.gold,children:[(0,j.jsx)(i.T,{weight:"semibold",children:"Total tips to share"}),(0,j.jsxs)(i.Row,{style:{alignItems:'center'},children:[(0,j.jsx)(i.T,{size:28,weight:"bold",colour:h.colours.gold,children:"\xa3"}),(0,j.jsx)(s.TextInput,{testID:"tips-total",accessibilityLabel:"Total tips in pounds",value:W,onChangeText:N,placeholder:"0.00",placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",style:[i.styles.input,{flex:1,fontSize:26,fontWeight:'700'}]})]}),W&&!q?(0,j.jsx)(i.T,{size:13,colour:h.colours.red,children:"Enter an amount like 1250.00"}):(0,j.jsx)(i.Muted,{children:"Shared by confirmed hours: share = total \xd7 (their hours \xf7 everyone's hours). Rounded to the penny; leftover pennies go to the largest shares so it adds up exactly."})]}),ee.length?(0,j.jsx)(r.default,{accessibilityRole:"button",onPress:()=>e('more','signoff'),testID:"tips-pending",children:(0,j.jsxs)(d.default,{style:{backgroundColor:h.colours.redBg,borderRadius:12,padding:12,borderLeftWidth:6,borderLeftColor:h.colours.red,gap:4},children:[(0,j.jsxs)(i.T,{weight:"bold",colour:h.colours.red,children:["\u26a0 Don't pay out yet: ",(0,u.decH)(se)," h not signed off"]}),(0,j.jsxs)(i.T,{size:14,children:[ee.map(e=>`${M(e.person)} (${(0,u.decH)(e.pending)} h)`).join(', '),". Pending hours are left out of the split, so these people would get less than they should."]}),(0,j.jsx)(i.T,{weight:"semibold",colour:h.colours.gold,children:"Sign off hours \u203a"})]})}):U.length?(0,j.jsx)(i.Banner,{kind:"success",title:"All hours in this fortnight are signed off"}):null,(0,j.jsx)(t.WideTable,{children:(0,j.jsxs)(d.default,{testID:"tips-table",children:[(0,j.jsx)(t.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:h.colours.border,paddingBottom:4},children:['Include','Name','Confirmed','Share','Tips'].map((e,s)=>(0,j.jsx)(i.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{width:[64,150,80,64,84][s]},children:e},e))}),U.map(e=>{const s=G(e.person),o=Q[e.person.id]??0;return(0,j.jsxs)(t.TRow,{heads:['Include','Name','Confirmed','Share','Tips'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222',opacity:s?.5:1},children:[(0,j.jsx)(r.default,{accessibilityRole:"checkbox",accessibilityState:{checked:!s},accessibilityLabel:`Include ${M(e.person)}`,onPress:()=>F({...L,[e.person.id]:!s}),style:{width:64,minHeight:44,justifyContent:'center'},children:(0,j.jsx)(d.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:s?h.colours.muted:h.colours.ok,backgroundColor:s?'transparent':h.colours.okBg,alignItems:'center',justifyContent:'center'},children:(0,j.jsx)(i.T,{size:14,colour:h.colours.ok,children:s?'':'\u2713'})})}),(0,j.jsxs)(d.default,{style:{width:150},children:[(0,j.jsx)(i.T,{size:14,weight:"semibold",numberOfLines:1,children:M(e.person)}),(0,j.jsxs)(i.Muted,{numberOfLines:1,children:[s?'Excluded':D(e.person),e.pending?` \xb7 \u26a0 ${(0,u.decH)(e.pending)} h pending`:'']})]}),(0,j.jsxs)(i.T,{size:14,style:{width:80},children:[(0,u.decH)(e.confirmed)," h"]}),(0,j.jsx)(i.T,{size:14,colour:h.colours.muted,style:{width:64},children:!s&&X?`${(e.confirmed/X*100).toFixed(1)}%`:'\u2013'}),(0,j.jsx)(i.T,{size:15,weight:"bold",colour:s?h.colours.muted:h.colours.gold,style:{width:84},children:s?'\u2013':(0,c.gbp)(o)})]},e.person.id)}),(0,j.jsxs)(t.TRow,{heads:['','','Confirmed','Share','Tips'],style:{paddingVertical:8,borderTopWidth:2,borderColor:h.colours.gold},children:[(0,j.jsx)(i.T,{size:14,style:{width:64},children:" "}),(0,j.jsxs)(i.T,{size:14,weight:"bold",style:{width:150},children:["Total (",J.length," people)"]}),(0,j.jsxs)(i.T,{size:14,weight:"bold",style:{width:80},children:[(0,u.decH)(X)," h"]}),(0,j.jsx)(i.T,{size:14,style:{width:64},children:X?'100%':'\u2013'}),(0,j.jsx)(i.T,{size:15,weight:"bold",colour:q&&Z===_?h.colours.ok:h.colours.text,style:{width:84},children:(0,c.gbp)(Z)})]})]})}),U.length?null:(0,j.jsx)(i.Muted,{children:"No clocked hours in this fortnight yet."}),q&&X?(0,j.jsxs)(i.Muted,{children:["Check: ",J.length," shares add up to ",(0,c.gbp)(Z)," of ",(0,c.gbp)(_)," ",Z===_?'\u2713':'',". \xa3",(_/100/(X/60)).toFixed(4)," per confirmed hour."]}):null,(0,j.jsxs)(i.Muted,{children:["Owner ",C.includeOwner?'included':'left out'," and managers ",C.includeManagers?'included':'left out'," by default (your tipping policy in Tips (tronc)). Tick or untick anyone for this split."]}),(0,j.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(i.Button,{small:!0,kind:"success",label:"Copy for spreadsheet",testID:"tips-copy",disabled:!q,onPress:async()=>{const e=await I(v(te()));oe(e?'Copied. Paste into the first cell of your spreadsheet.':'Copy is not available here. Use Download CSV.')}}),(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Download CSV",disabled:!q,onPress:()=>{(0,p.downloadText)(`tips-${H.start}-to-${H.end}.csv`,$(te())),oe('CSV downloaded.')}}),(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Print / PDF",disabled:!q,onPress:()=>{const e=te();(0,p.printTable)(`Tips ${(0,u.rangeText)(H.start,H.end)} (paid ${(0,u.dayMonth)(H.payday)})`,`Total ${(0,c.gbp)(_)} shared by confirmed hours${ee.length?` \xb7 WARNING ${(0,u.decH)(se)} h not signed off`:''}`,e[0],e.slice(1))}})]}),V?(0,j.jsx)(i.Banner,{kind:"success",title:V}):null]})},_e.PaydaysCard=function({go:e}){const{rid:s,today:t}=(0,x.useCtx)(6e4),{pay:o,source:r}=(0,b.useVenuePay)(s),a=(0,u.nextToPay)(o,'tips',t).period,l=(0,u.nextToPay)(o,'wage',t).period;return(0,j.jsxs)(d.default,{testID:"paydays-card",style:{backgroundColor:h.colours.surface,borderRadius:16,borderWidth:1,borderColor:h.colours.hairline,padding:16,gap:8},children:[(0,j.jsx)(n.CardHeading,{right:'none'===r?(0,j.jsx)(i.Badge,{kind:"amber",label:"Not set up"}):null,children:"Paydays"}),(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,j.jsxs)(i.T,{children:["Next tips payday: ",(0,j.jsx)(i.T,{weight:"semibold",colour:h.colours.goldLight,children:a.payday===t?'today':(0,u.dayMonth)(a.payday)})]}),(0,j.jsx)(i.Muted,{children:(0,u.rangeText)(a.start,a.end)})]}),(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,j.jsxs)(i.T,{children:["Next payday: ",(0,j.jsx)(i.T,{weight:"semibold",colour:h.colours.goldLight,children:l.payday===t?'today':(0,u.dayMonth)(l.payday)})]}),(0,j.jsxs)(i.Muted,{children:["period ",(0,u.rangeText)(l.start,l.end)]})]}),(0,j.jsxs)(n.ActionGrid,{testID:"paydays-actions",children:[(0,j.jsx)(n.ActionTile,{primary:!0,icon:"payroll",label:"Payroll hours",sub:"Copy or export",onPress:()=>e('more','hours'),testID:"paydays-hours"}),(0,j.jsx)(n.ActionTile,{icon:"tips",label:"Tips day",sub:"Share out tips",onPress:()=>e('more','tipsday'),testID:"paydays-tips"})]}),'settings'!==r?(0,j.jsx)(i.Button,{small:!0,kind:"ghost",label:"Pay & tips settings",onPress:()=>e('more','paysettings'),style:{alignSelf:'flex-start'}}):null]})},_e.MyPeriods=function({staffId:e}){const{rid:s,today:t,now:o,meId:n}=(0,x.useCtx)(6e4),r=e??n,{pay:a}=(0,b.useVenuePay)(s),c=(0,l.useOwner)(e=>e.attendance),p=(0,l.useOwner)(e=>e.staff.find(e=>e.id===r)),y=(0,u.wagePeriod)(a,t,0),f=(0,u.tipsPeriod)(a,t,0),w=e=>p?S(e,[p],c,o,{})[0]??null:null,T=(e,s,o)=>(0,j.jsxs)(d.default,{style:{flexGrow:1,flexBasis:160,backgroundColor:h.colours.surface,borderRadius:14,borderWidth:1,borderColor:h.colours.border,padding:12,gap:2},children:[(0,j.jsx)(i.T,{size:13,weight:"semibold",colour:h.colours.gold,children:e.toUpperCase()}),(0,j.jsxs)(i.Muted,{children:[(0,u.rangeText)(s.start,s.end)," \xb7 ",s.payday>=t?'paid':'was paid'," ",(0,u.dayMonth)(s.payday)]}),(0,j.jsxs)(i.T,{size:24,weight:"bold",children:[(0,u.decH)(o?.confirmed??0)," h"]}),(0,j.jsxs)(i.Muted,{children:["confirmed (",(0,u.hMm)(o?.confirmed??0),") \xb7 ",o?.shifts??0," shifts"]}),o?.pending?(0,j.jsxs)(i.T,{size:13,colour:h.colours.amber,children:["+ ",(0,u.decH)(o.pending)," h waiting for sign-off"]}):null]},e);return(0,j.jsx)(i.Row,{wrap:!0,gap:8,style:{alignItems:'stretch'},children:[T('This pay period',y,w(y)),T('This tips fortnight',f,w(f))]})};var s=_r(_d[0]),t=_r(_d[1]),o=_r(_d[2]),n=_r(_d[3]);_r(_d[4]);var r=e(_r(_d[5])),d=e(_r(_d[6])),i=_r(_d[7]),a=_r(_d[8]),l=_r(_d[9]),c=_r(_d[10]),u=_r(_d[11]),h=_r(_d[12]),p=_r(_d[13]),y=_r(_d[14]),f=_r(_d[15]),x=_r(_d[16]),b=_r(_d[17]),j=_r(_d[18]);const w={weekly:'Weekly',fortnightly:'Fortnightly',monthly:'Monthly'},T={none:'Keep the date',before:'Friday before',after:'Monday after'};const P=e=>`${e}${e%10==1&&11!==e?'st':e%10==2&&12!==e?'nd':e%10==3&&13!==e?'rd':'th'}`;function k({label:e,day:s,period:t}){return(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,j.jsxs)(i.T,{children:[e,": ",(0,j.jsx)(i.T,{weight:"bold",colour:h.colours.gold,children:(0,u.dayMonth)(s)})]}),(0,j.jsx)(i.Muted,{children:(0,u.rangeText)(t.start,t.end)})]})}const C=e=>{if(!e)return'';const s=new Date(e);return`${String(s.getHours()).padStart(2,'0')}:${String(s.getMinutes()).padStart(2,'0')}`};function S(e,s,t,o,n){const r=t.filter(s=>s.in&&s.date>=e.start&&s.date<=e.end);return s.map(e=>{const s=r.filter(s=>s.staffId===e.id).sort((e,s)=>e.date.localeCompare(s.date)||(e.in??'').localeCompare(s.in??'')).map(e=>{const s=(0,x.paidMins)(e,o),t=(0,l.attStatus)(e);return{a:e,date:e.date,inT:C(e.in),outT:C(e.out),brk:s.brk,paid:s.paid,status:'open'===t?'On now':'awaiting'===t?'Pending':'Confirmed'}}),t=e=>s.filter(s=>s.status===e).reduce((e,s)=>e+s.paid,0),d=t('Confirmed'),i=n[e.id];return{person:e,confirmed:d,pending:t('Pending'),open:t('On now'),shifts:s.filter(e=>'On now'!==e.status).length,days:s,rate:i,gross:null!=i?Math.round(d/60*i):void 0}}).filter(e=>e.days.length>0||e.person.active&&'owner'!==e.person.role)}const D=e=>`${l.ROLE_LABEL[e.role]}${e.job?` \xb7 ${e.job}`:''}`,M=e=>e.name.replace(' (example)',''),B=e=>null==e?'':(e/100).toFixed(2),R=e=>e.replace(/[\t\r\n]+/g,' '),z=e=>/[",\n]/.test(e)?`"${e.replace(/"/g,'""')}"`:e,v=e=>e.map(e=>e.map(R).join('\t')).join('\n'),$=e=>e.map(e=>e.map(z).join(',')).join('\r\n');function O(e,s,t,o){const n=['Name','Role','Period start','Period end','Confirmed hours','Confirmed h:mm','Pending hours','Pending h:mm','Shifts',...o?['Tips hours']:[],...t?['Rate \xa3/h','Gross \xa3']:[]],r=e.map(e=>[M(e.person),D(e.person),(0,u.ukDate)(s.start),(0,u.ukDate)(s.end),(0,u.decH)(e.confirmed),(0,u.hMm)(e.confirmed),(0,u.decH)(e.pending),(0,u.hMm)(e.pending),String(e.shifts),...o?[(0,u.decH)(e.confirmed)]:[],...t?[B(e.rate),B(e.gross)]:[]]),d=e.reduce((e,s)=>({c:e.c+s.confirmed,p:e.p+s.pending,s:e.s+s.shifts,g:e.g+(s.gross??0)}),{c:0,p:0,s:0,g:0});return[n,...r,['TOTAL','',(0,u.ukDate)(s.start),(0,u.ukDate)(s.end),(0,u.decH)(d.c),(0,u.hMm)(d.c),(0,u.decH)(d.p),(0,u.hMm)(d.p),String(d.s),...o?[(0,u.decH)(d.c)]:[],...t?['',B(d.g)]:[]]]}function H(e){return[['Name','Role','Date','In','Out','Break mins','Paid hours','Paid h:mm','Status'],...e.flatMap(e=>e.days.map(s=>[M(e.person),D(e.person),(0,u.ukDate)(s.date),s.inT,s.outT,'On now'===s.status?'':String(s.brk),'On now'===s.status?'':(0,u.decH)(s.paid),'On now'===s.status?'':(0,u.hMm)(s.paid),s.status]))]}async function I(e){if('undefined'==typeof document)return!1;try{if(navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}try{const s=document.createElement('textarea');s.value=e,s.style.position='fixed',s.style.opacity='0',document.body.appendChild(s),s.select();const t=document.execCommand('copy');return s.remove(),t}catch{return!1}}function W(e,s){const t=(0,u.nextToPay)(e,'wage',s),o=(0,u.nextToPay)(e,'tips',s),n=(0,u.wagePeriod)(e,t.period.start,-1),r=(0,u.tipsPeriod)(e,o.period.start,-1),d=e=>e.payday>=s?e.payday===s?'Pays today':`Pays ${(0,u.dayMonth)(e.payday)}`:`Paid ${(0,u.dayMonth)(e.payday)}`;return[{id:'wage',label:`Wages ${(0,u.rangeText)(t.period.start,t.period.end)}`,sub:d(t.period),period:t.period},{id:'wagePrev',label:`Wages ${(0,u.rangeText)(n.start,n.end)}`,sub:d(n),period:n},{id:'tips',label:`Tips ${(0,u.rangeText)(o.period.start,o.period.end)}`,sub:d(o.period),period:o.period},{id:'tipsPrev',label:`Tips ${(0,u.rangeText)(r.start,r.end)}`,sub:d(r),period:r}]}function N({onSet:e}){const[s,t]=(0,o.useState)(''),[n,r]=(0,o.useState)(''),a=(0,u.parseUk)(s),l=(0,u.parseUk)(n),c=!!a&&!!l&&l>=a&&(0,u.plusDays)(a,92)>=l;return(0,j.jsxs)(i.Row,{wrap:!0,gap:6,style:{alignItems:'flex-end'},children:[(0,j.jsx)(d.default,{style:{flexBasis:130,flexGrow:1},children:(0,j.jsx)(i.Field,{label:"From (DD/MM/YYYY)",value:s,onChangeText:t,placeholder:"23/10/2026"})}),(0,j.jsx)(d.default,{style:{flexBasis:130,flexGrow:1},children:(0,j.jsx)(i.Field,{label:"To (DD/MM/YYYY)",value:n,onChangeText:r,placeholder:"22/11/2026"})}),(0,j.jsx)(i.Button,{small:!0,kind:"success",label:"Show",disabled:!c,onPress:()=>c&&e((0,u.customPeriod)(a,l))}),s&&n&&!c?(0,j.jsx)(i.T,{size:13,colour:h.colours.red,children:"Use two dates, the second on or after the first, up to 3 months apart."}):null]})}const L=[150,54,62,62,48,62,70]},988,[874,1355,30,1357,122,263,127,813,870,854,816,1023,821,1358,1031,953,954,1288,24]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"TABLES",{enumerable:!0,get:function(){return P}}),_e.useTableNames=O,_e.resetTableLive=z,_e.seatBookingNow=async function(e,t){await h.repo.bookings.setStatus(t.id,'seated'),z(e,t.table)},_e.finishBookingNow=async function(e,t){await h.repo.bookings.setStatus(t.id,'finished'),(0,w.tablesOf)(t.table).forEach(t=>w.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!0}))},_e.useTableUse=B,Object.defineProperty(_e,"walkInLabel",{enumerable:!0,get:function(){return M}}),_e.TablePicker=N,_e.WalkInSheet=F,_e.AssignTableSheet=A,_e.undoNotice=L,_e.NewBookingSheet=W,_e.useFrontDoor=function(e,t){const[s,o]=(0,a.useState)(!1),[l,i]=(0,a.useState)(!1),[r,d]=(0,a.useState)(null);return{openWalkIn:()=>o({}),openWalkInAt:e=>o({table:e}),openBooking:()=>i(!0),assignTable:e=>d({b:e}),combineTables:e=>d({b:e,combine:!0}),elements:(0,I.jsxs)(I.Fragment,{children:[s?(0,I.jsx)(F,{wide:t,initialTable:s.table,onClose:()=>o(!1),onSeated:L}):null,l?(0,I.jsx)(W,{wide:t,date:e,onClose:()=>i(!1),onSaved:e=>(0,n.notify)({id:`booked:${Date.now()}`,testID:'booking-saved-toast',timeoutMs:5e3,icon:'\u2713',title:`Booked: ${e.name} \xb7 ${(0,y.niceDate)((0,y.parseYmd)(e.date))} at ${e.time}`})}):null,r?(0,I.jsx)(A,{booking:r.b,combine:r.combine,onClose:()=>d(null)}):null]})}};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),n=_r(_d[4]),a=_r(_d[5]),i=e(a),r=_r(_d[6]),d=e(_r(_d[7])),u=e(_r(_d[8])),c=_r(_d[9]),b=_r(_d[10]),h=_r(_d[11]),p=_r(_d[12]),f=_r(_d[13]),y=_r(_d[14]),x=_r(_d[15]),k=_r(_d[16]),j=_r(_d[17]),w=_r(_d[18]),T=_r(_d[19]),S=_r(_d[20]),C=_r(_d[21]),v=_r(_d[22]),D=_r(_d[23]),$=_r(_d[24]),I=_r(_d[25]);const P=Array.from({length:12},(e,t)=>String(t+1));function O(e){const t=(0,w.usePlan)(e);return t.areas.flatMap(e=>t.tables.filter(t=>t.areaId===e.id).map(e=>e.name))}function z(e,t){(0,w.tablesOf)(t).forEach(t=>w.useFloor.getState().setLive(e,t,{stage:'seated',dirty:!1}))}function B(e,t){const s=(0,h.useBookings)(e),o=(0,h.useOrders)(e),l=O(e),n=(0,w.useFloor)(t=>t.live[e])??{},a=(0,w.usePlan)(e),i=(0,T.useBlocks)(e=>e.blocks),r=(0,y.ymd)(t),d=(0,T.closedAreasAt)(i,e,r,(0,y.hm)(t)),u={};for(const e of l)u[e]=n[e]?.blocked||d.has(`tbl:${e}`)?{busy:!0,label:'Blocked'}:d.has(a.tables.find(t=>t.name===e)?.areaId??'')?{busy:!0,label:'Closed'}:n[e]?.dirty?{busy:!0,label:'Needs clearing'}:{busy:!1,label:'Free'};for(const e of s)if(e.date===r&&e.table)for(const s of(0,w.tablesOf)(e.table))if(u[s])if('seated'===e.status)u[s]={busy:!0,label:`${e.walkIn?'Walk-in':`${e.name.slice(0,1)}.`} \xb7 ${e.partySize}`};else if('confirmed'===e.status&&!u[s].busy){const o=(0,y.minsBetween)(t,new Date(`${e.date}T${e.time}:00`));o>=-15&&o<=90&&(u[s]={...u[s],soon:`Booked ${e.time}`})}for(const e of o)'table'===e.type&&e.tableNo&&u[e.tableNo]&&!['closed','cancelled','collected'].includes(e.status)&&!u[e.tableNo].busy&&(u[e.tableNo]={busy:!0,label:'Open order'});return u}const M=e=>e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;function N({use:e,value:t,onPick:o,big:l,best:n,dense:i,bestSet:r,picked:c}){const b=Object.keys(e),[h,p]=(0,a.useState)(0),f=i?6:8,y=i?64:l?92:76,k=h?Math.max(3,Math.floor((h+f)/(y+f))):0,T=k?Math.floor((h-f*(k-1))/k):y,S=new Set(r??[]),C=n?(0,w.tablesOf)(n)[0]:null;return(0,I.jsx)(u.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:f},testID:"table-picker",onLayout:e=>p(Math.floor(e.nativeEvent.layout.width)),children:b.map(l=>{const n=e[l],a=t===l||!!c?.includes(l),r=S.has(l),b=C===l&&!a,h=n.busy?['Blocked','Needs clearing','Closed'].includes(n.label)?n.label:'In use':n.soon??'Free';return(0,I.jsxs)(d.default,{accessibilityRole:"button",testID:`pick-table-${l}`,accessibilityLabel:`Table ${(0,s.tableNumbers)(l)}${c?a?', picked':', not picked':''}, ${n.busy?`in use (${n.label})`:n.soon?`free, ${n.soon}`:'free'}${r?', best table':''}${b?', suggested for this party':''}`,accessibilityState:{selected:a,disabled:'Closed'===n.label},disabled:'Closed'===n.label,onPress:()=>o(l),style:{width:T,minHeight:i?58:64,borderRadius:12,borderWidth:a||b?2.5:1.5,paddingVertical:i?3:6,paddingHorizontal:4,alignItems:'center',justifyContent:'center',gap:2,borderColor:a||b?x.colours.gold:n.busy?x.colours.red:x.colours.ok,backgroundColor:a?x.colours.goldTint:n.busy?x.colours.redBg:x.colours.surface2,opacity:'Closed'!==n.label||a?1:.55},children:[(0,I.jsxs)(u.default,{style:{flexDirection:'row',alignItems:'center',gap:4},children:[(0,I.jsx)(j.T,{weight:"bold",size:22,colour:a?x.colours.goldLight:x.colours.text,children:(0,s.tableNumbers)(l)}),r?(0,I.jsx)(u.default,{testID:"best-table",style:{backgroundColor:x.colours.gold,borderRadius:5,paddingHorizontal:4,paddingVertical:1},children:(0,I.jsx)(j.T,{size:11,weight:"bold",colour:x.colours.onGold,children:"BEST"})}):null]}),(0,I.jsx)(j.T,{size:i?13:14,colour:n.busy?'#FFD9D4':n.soon?'#FFE2A8':'#E2C489',center:!0,numberOfLines:1,children:h})]},l)})})}const R=[1,2,3,4,5,6,7,8];function F({onClose:e,onSeated:o,wide:l,initialTable:n}){const{rid:p,r:k,now:S}=(0,b.useCtx)(15e3),C=B(p,S),[v,D]=(0,a.useState)(2),[$,P]=(0,a.useState)(!1),[O,M]=(0,a.useState)(n??null),F=(0,w.usePlan)(p),A=(0,h.useBookings)(p),L=(0,T.useBlocks)(e=>e.blocks),W=(0,T.closedAreasAt)(L,p,(0,y.ymd)(S),(0,y.hm)(S)),E=i.default.useMemo(()=>{const e=Object.fromEntries(Object.entries(C).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,f.suggestTable)(F,A.filter(e=>e.date===(0,y.ymd)(S)),e,v,S,(0,f.turnFor)(v,k.settings.turnMins),90,void 0,{closed:W})?.table??null},[F,A,C,v,W.size,S.getTime()]);(0,a.useEffect)(()=>{O&&(0,w.tablesOf)(O).some(e=>'Closed'===C[e]?.label)&&M(null)},[O,W.size]);const[H,_]=(0,a.useState)(!1),[U,q]=(0,a.useState)(''),V=(e,t=String(e),s=()=>{P(!1),D(e)})=>{const o='9+'===t?$:!$&&v===e;return(0,I.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:'9+'===t?'Party of 9 or more':`Party of ${e}`,accessibilityState:{selected:o},onPress:s,style:{width:l?58:60,height:l?58:56,borderRadius:14,borderWidth:2,borderColor:x.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:o?x.colours.gold:'transparent'},children:(0,I.jsx)(j.T,{weight:"bold",size:22,colour:o?x.colours.onGold:x.colours.gold,children:t})},t)},G=(0,I.jsxs)(j.Row,{gap:12,style:{justifyContent:'center'},children:[(0,I.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:"One fewer",onPress:()=>D(e=>Math.max(9,e-1)),style:{width:56,height:56,borderRadius:28,borderWidth:2,borderColor:x.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,I.jsx)(j.T,{size:26,colour:x.colours.gold,children:"\u2212"})}),(0,I.jsx)(j.T,{weight:"bold",size:26,children:v}),(0,I.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:"One more",onPress:()=>D(e=>Math.min(40,e+1)),style:{width:56,height:56,borderRadius:28,borderWidth:2,borderColor:x.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,I.jsx)(j.T,{size:26,colour:x.colours.gold,children:"+"})})]}),K=(0,I.jsxs)(u.default,{style:{gap:8,width:l?256:void 0},children:[(0,I.jsx)(j.T,{weight:"semibold",children:"How many people?"}),(0,I.jsxs)(u.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"walkin-party",children:[R.map(e=>V(e)),V(9,'9+',()=>{P(!0),D(e=>e>=9?e:9)})]}),$?G:null]}),[Q,Y]=(0,a.useState)(!1),J=async(t=O)=>{if(!Q){Y(!0);try{const s=await h.repo.bookings.seatWalkIn(p,v,t??void 0,U);z(p,t??void 0),o(s),e()}finally{Y(!1)}}},X=(0,I.jsxs)(u.default,{style:{gap:8,flex:l?1:void 0,minWidth:0},children:[(0,I.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,I.jsxs)(j.T,{weight:"semibold",children:["Table ",(0,I.jsx)(j.T,{colour:x.colours.muted,size:14,children:"(optional)"})]}),O?(0,I.jsx)(j.Button,{small:!0,kind:"ghost",label:"Clear table",onPress:()=>M(null)}):null]}),(0,I.jsx)(N,{use:C,value:O,onPick:e=>{C[e]&&!C[e].busy?J(e):M(O===e?null:e)},big:l,dense:l,best:E,bestSet:(0,r.bestTables)(F)}),(0,I.jsxs)(j.Muted,{children:["Tap a free table to seat them there",E&&!O?` (suggested for ${v}: ${(0,s.tableNumbers)(E)})`:'',", or Seat for no table yet. BEST marks the venue\u2019s best tables."]})]});return(0,I.jsxs)(j.Sheet,{visible:!0,onClose:e,title:`Walk-in \xb7 ${(0,y.hm)(S)}`,maxWidth:l?1100:void 0,testID:"walkin-sheet",children:[(0,I.jsx)(j.Button,{label:`Seat walk-in \xb7 ${v} ${1===v?'person':'people'}${O?` \xb7 ${(0,s.tableNumbers)(O)}`:''}`,disabled:Q,onPress:()=>{J()},testID:"seat-walkin",style:{minHeight:52}}),l?(0,I.jsxs)(j.Row,{gap:16,style:{alignItems:'flex-start'},children:[K,X]}):(0,I.jsxs)(I.Fragment,{children:[K,X]}),(0,I.jsxs)(j.Row,{gap:10,wrap:!0,style:{alignItems:'center'},children:[H?(0,I.jsx)(t.TextInput,{accessibilityLabel:"Walk-in note",placeholder:"Note (optional), e.g. high chair",placeholderTextColor:"#7D776C",value:U,onChangeText:q,style:[j.styles.input,{flex:1,minWidth:220}],autoFocus:!0}):(0,I.jsx)(j.Button,{small:!0,kind:"ghost",label:"Add a note (optional)",onPress:()=>_(!0)}),(0,I.jsx)(u.default,{style:{flex:1,minWidth:220},children:(0,I.jsxs)(j.Muted,{children:["No name needed. Counts in today's covers.",'staff'!==c.APP_VARIANT?' Using website bookings too? Mark the table there as well.':'']})})]})]})}function A({booking:e,onClose:t,combine:o}){const{rid:l,r:n,now:d}=(0,b.useCtx)(15e3),c=B(l,d),p=(0,w.usePlan)(l),k=(0,h.useBookings)(l),T=(0,w.tablesOf)(e.table),S=i.default.useMemo(()=>Object.fromEntries(Object.entries(c).map(([e,t])=>[e,T.includes(e)?{busy:!1,label:'This party',soon:'This party'}:t])),[c,e.table]),C=i.default.useMemo(()=>{const t=Object.fromEntries(Object.entries(S).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,f.suggestTable)(p,k.filter(e=>e.date===(0,y.ymd)(d)),t,e.partySize,d,(0,f.turnFor)(e.partySize,n.settings.turnMins),90,e.id)?.table??null},[p,k,S,e.partySize,d.getTime()]),[v,D]=(0,a.useState)(!!o||T.length>1),[$,P]=(0,a.useState)(T),O=e=>p.tables.find(t=>t.name===e)?.maxSeats??0,R=$.reduce((e,t)=>e+O(t),0),F=$.length>0&&R{const o=(0,w.joinTables)(s);await h.repo.bookings.assignTable(e.id,o);T.filter(e=>!s.includes(e)).forEach(t=>w.useFloor.getState().setLive(l,t,{stage:void 0,dirty:'seated'===e.status})),'seated'===e.status&&z(l,o),t()},L=v?(0,I.jsxs)(u.default,{style:{gap:8},testID:"assign-table-tip",children:[(0,I.jsx)(u.default,{accessibilityLiveRegion:"polite",children:(0,I.jsx)(j.T,{size:17,weight:"semibold",colour:x.colours.text,children:$.length?`${(0,w.tablesLabel)((0,w.joinTables)($))} \xb7 ${R} seats for ${e.partySize} covers`:'No tables picked yet'})}),F?(0,I.jsx)(u.default,{testID:"combine-short",children:(0,I.jsxs)(j.T,{size:15,weight:"semibold",colour:"#FFD9D4",children:["Not enough seats yet: ",e.partySize-R," more needed. Add another table."]})}):null,(0,I.jsx)(j.T,{size:15,colour:x.colours.text,children:"Tap each table to add or remove it, then tap Done. All of them show as taken until the party has finished."}),(0,I.jsxs)(j.Row,{gap:8,wrap:!0,children:[(0,I.jsx)(j.Button,{label:"Done",testID:"combine-done",disabled:!$.length,accessibilityLabel:$.length?`Done, save ${(0,w.tablesLabel)((0,w.joinTables)($))}`:'Done',onPress:()=>A($)}),(0,I.jsx)(j.Button,{kind:"ghost",label:"Cancel",onPress:t})]})]}):(0,I.jsx)(u.default,{style:{gap:8},testID:"assign-table-tip",children:(0,I.jsx)(j.T,{size:15,colour:x.colours.text,children:"Red tables are in use right now; you can still pick one (e.g. joining a table). BEST marks the venue\u2019s best tables. Big party? Tap Combine tables."})});return(0,I.jsxs)(j.Sheet,{visible:!0,onClose:t,title:`${v?'Combine tables':'Assign table'} \xb7 ${M(e)}`,testID:"assign-table-sheet",footer:L,children:[C&&!v?(0,I.jsx)(u.default,{testID:"assign-suggested",children:(0,I.jsxs)(j.T,{size:16,weight:"semibold",colour:x.colours.goldLight,children:["Suggested for ",e.partySize,": ",(0,s.tableNumbers)(C)]})}):null,v?null:(0,I.jsx)(j.Button,{kind:"secondary",label:"Combine tables",testID:"combine-start",accessibilityLabel:"Combine tables: pick several tables for this party",onPress:()=>D(!0)}),(0,I.jsx)(N,{use:S,best:v?null:C,bestSet:(0,r.bestTables)(p),picked:v?$:void 0,onPick:v?e=>P(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]):async e=>{await A([e])}})]})}function L(e){(0,n.notify)({id:`walkin:${e.id}`,testID:'walkin-toast',timeoutMs:6e3,title:`${M(e)} seated \xb7 ${e.table?`${(0,s.tableNumbers)(e.table)}`:'table to assign'} (${e.ref})`,actions:[{label:'Undo',testID:'undo-walkin',onPress:()=>h.repo.bookings.undoWalkIn(e.id)},{label:'OK',kind:'ghost'}]})}function W({date:e,onClose:t,wide:n,onSaved:i}){const{rid:r,r:d,now:c,role:P,meId:O}=(0,b.useCtx)(6e4),z=(0,y.ymd)(c),[B,M]=(0,a.useState)(ee.blocks),[F,A]=(0,a.useState)(!1),[L,W]=(0,a.useState)(''),[E,H]=(0,a.useState)(2),[_,U]=(0,a.useState)(null),[q,V]=(0,a.useState)(''),[G,K]=(0,a.useState)(''),[Q,Y]=(0,a.useState)(''),[J,X]=(0,a.useState)('phone'),[Z,ee]=(0,a.useState)((0,C.emptyNeeds)()),te=(0,C.needsMissing)(Z),[se,oe]=(0,a.useState)(null),le=(0,w.usePlan)(r),ne=(0,$.dogSetUp)(le),ae=!0===Z.dog&&ne,ie=Z.dog?Z.dogs:0,re=(0,y.parseYmd)(B),de=(0,f.turnFor)(E,d.settings.turnMins),ue=N.filter(e=>e.date===B),ce=e=>(0,f.freeTablesAt)(le,ue,E,new Date(`${B}${(0,s.tableNumbers)(e)}:00`),de,d.settings.turnMins,{dog:!0,closed:(0,T.closedAreasAt)(R,r,B,e)}),be=ae&&_?ce(_):[];(0,a.useEffect)(()=>{oe(null)},[ae,_,E]);const he=(0,p.bookingSlots)(d,re,e=>N.filter(t=>t.date===B&&t.time===e&&'cancelled'!==t.status&&!t.walkIn).reduce((e,t)=>e+t.partySize,0),E,B===(0,y.ymd)(c)?c:(0,y.addMins)(re,0)),ge=(0,k.ukPhone)(G),pe=_?(0,T.blockAt)(R,r,B,_):void 0,me='staff'!==P,fe=!!_&&!(0,C.dogTimeOk)(d,N,B,_,ie),ye=!te.length&&L.trim().length>=2&&!!_&&ge.ok&&(0,k.emailOk)(Q)&&(!pe||me&&F)&&(!ae||be.length>0)&&!fe,xe=Z.wheelchair>0||Z.stepFree;return(0,I.jsxs)(j.Sheet,{visible:!0,onClose:t,title:`New booking \xb7 ${(0,y.niceDate)(re)}`,maxWidth:n?760:void 0,testID:"booking-sheet",children:[(0,I.jsx)(C.FirstQuestions,{rid:r,value:Z,onChange:ee,party:E,audience:"staff"}),Z.dog&&!ne?(0,I.jsx)(j.T,{size:13,colour:x.colours.amber,children:"Dog-friendly tables aren\u2019t marked yet. Managers \u203a Booking options \u203a Tables. Booking is allowed; check where the dog can sit."}):null,(0,I.jsx)(S.BookingDatePicker,{r:d,today:c,value:B,onChange:e=>{e!==B&&(M(e),U(null),A(!1))}}),(0,I.jsxs)(j.Row,{gap:6,children:[(0,I.jsx)(j.Chip,{label:"Phone",selected:'phone'===J,onPress:()=>X('phone')}),(0,I.jsx)(j.Chip,{label:"In person",selected:'in-person'===J,onPress:()=>X('in-person')})]}),(0,I.jsx)(j.Field,{label:"Name",value:L,onChangeText:W,placeholder:"e.g. Reid",testID:"nb-name"}),(0,I.jsx)(j.Field,{label:"Mobile or phone number (needed)",value:G,onChangeText:K,keyboardType:"phone-pad",placeholder:"e.g. 07700 900123",testID:"nb-phone"}),!ge.ok&&G?(0,I.jsx)(j.T,{size:13,colour:x.colours.amber,children:ge.error}):null,(0,I.jsx)(j.Field,{label:"Email (optional)",value:Q,onChangeText:Y,keyboardType:"email-address",autoCapitalize:"none",placeholder:"For an email confirmation too",testID:"nb-email"}),(0,k.emailOk)(Q)?null:(0,I.jsx)(j.T,{size:13,colour:x.colours.amber,children:"That email doesn\u2019t look quite right."}),(0,I.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,I.jsx)(j.T,{children:"Covers"}),(0,I.jsx)(j.Stepper,{value:E,onChange:H,min:1,max:20,label:"covers"})]}),(0,I.jsx)(j.Row,{wrap:!0,gap:6,children:he.map(e=>{const t=ae&&e.available&&!ce(e.time).length||!(0,C.dogTimeOk)(d,N,B,e.time,ie);return(0,I.jsx)(j.Chip,{label:e.time,sub:(0,T.blockAt)(R,r,B,e.time)?'Paused':t?'Dogs full':e.drinksOnly?'Drinks only':`${e.left} left`,disabled:!e.available||t,selected:_===e.time,onPress:()=>{U(e.time),A(!1)}},e.time)})}),ae&&_?(0,I.jsxs)(u.default,{style:{gap:6},testID:"nb-dog-tables",children:[(0,I.jsxs)(j.T,{size:14,weight:"semibold",children:["Dog-friendly table ",(0,I.jsxs)(j.T,{size:13,colour:x.colours.muted,children:["(",le.areas.filter(e=>e.dogs).map(e=>e.name).join(' or '),")"]})]}),be.length?(0,I.jsx)(j.Row,{wrap:!0,gap:6,children:be.slice(0,10).map((e,t)=>(0,I.jsx)(j.Chip,{label:`${(0,s.tableNumbers)(e.table)}`,sub:`${e.area} \xb7 ${e.seats}${0===t?' \xb7 best':''}${xe&&(0,$.accessibleSetUp)(le)&&!(0,$.isAccessible)(le,e.table)?' \xb7 not step-free':''}`,selected:(se??be[0].table)===e.table,onPress:()=>oe(e.table)},e.table))}):(0,I.jsxs)(j.T,{size:14,colour:x.colours.amber,children:["No dog-friendly table free for ",E," at ",_,". Try another time."]})]}):null,pe?(0,I.jsxs)(u.default,{testID:"nb-block-warning",style:{borderWidth:1.5,borderColor:x.colours.amber,backgroundColor:x.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[(0,I.jsxs)(j.T,{weight:"semibold",colour:x.colours.amber,children:["Bookings are paused ",pe.from,"\u2013",pe.to,pe.reason?` (${pe.reason})`:'']}),me?(0,I.jsx)(j.Chip,{label:F?'Manager override on':'Override and book anyway',selected:F,onPress:()=>A(e=>!e)}):(0,I.jsx)(j.Muted,{children:"Ask a manager to override, or pick another time."})]}):null,he.length?null:(0,I.jsx)(u.default,{testID:"nb-closed",children:(0,I.jsxs)(j.T,{size:14,weight:"semibold",colour:x.colours.amber,children:["Closed on ",(0,y.niceDate)(re)," (per the venue\u2019s opening hours). Pick another date."]})}),(0,I.jsx)(C.MoreQuestions,{rid:r,r:d,value:Z,onChange:ee,party:E,date:B,time:_,today:(0,y.ymd)(c),bookings:N,audience:"staff",showTables:!1!==d.settings.tableRequests}),xe&&!(0,$.accessibleSetUp)(le)?(0,I.jsx)(j.T,{size:13,colour:x.colours.amber,children:"Step-free tables aren\u2019t marked yet (Managers \u203a Booking options \u203a Tables). Check the table works for a wheelchair."}):null,(0,I.jsx)(j.Field,{label:"Notes (optional)",value:q,onChangeText:V,placeholder:v.NOTES_PLACEHOLDER,multiline:!0,numberOfLines:3,testID:"nb-notes"}),(0,l.depositDue)((0,l.depositOf)(d.settings),E)?(0,I.jsxs)(j.Muted,{children:["Deposit due: ",(0,o.gbp)((0,l.depositDue)((0,l.depositOf)(d.settings),E))," (",(0,o.gbp)((0,l.depositOf)(d.settings).perPersonPence)," per person for ",(0,l.depositOf)(d.settings).fromParty,"+). Deposits are paid through website bookings or to you, never in CoverCharge: tick Deposit paid on the booking once the guest has paid."]}):null,(0,I.jsxs)(j.Muted,{children:["The guest gets a confirmation text",Q.trim()?' and email':''," automatically (preview mode: shown in the Outbox, not sent)."]}),fe?(0,I.jsxs)(j.T,{size:14,colour:x.colours.amber,children:["We already have the most dogs we can look after at ",_,". Try another time: dogs are very welcome then."]}):null,(0,I.jsx)(j.Button,{label:te.length?te[0]:'Save booking',testID:"nb-save",disabled:!ye,onPress:()=>{if(B<(0,y.ymd)(c))return;const e=(0,C.needsPatch)(Z),s=Z.tableReq.find(e=>!ae||be.some(t=>t.table===e));h.repo.bookings.create({restaurantId:r,customerId:null,name:L.trim(),partySize:E,date:B,time:_,notes:q.trim(),security:(0,l.depositDue)((0,l.depositOf)(d.settings),E)?'deposit':'none',depositPaid:0,...(0,l.depositDue)((0,l.depositOf)(d.settings),E)?{depositDue:(0,l.depositDue)((0,l.depositOf)(d.settings),E),depositPolicy:(0,l.depositWords)((0,l.depositOf)(d.settings),E,d.name).join(' '),depositRefundable:(0,l.depositOf)(d.settings).refundable,depositCutoffHours:(0,l.depositOf)(d.settings).cutoffHours}:{},phone:ge.pretty,email:Q.trim()||void 0,source:J,...e,...he.find(e=>e.time===_)?.drinksOnly?{drinksOnly:!0}:{},allergies:e.allergies??[],...ae?{table:se??s??be[0]?.table}:{}}).then(e=>(0,D.postNewBookingToKitchen)(e,O)).catch(()=>{}),i?.({date:B,time:_,name:L.trim()}),t()}})]})}},989,[874,808,816,13,1118,30,1022,263,127,806,954,819,817,826,818,821,823,813,825,824,1316,827,812,976,828,24]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BlockList=p,_e.BlockBookingsSheet=B,_e.BlocksBanner=function({rid:e,now:o,big:s,by:l="staff"}){const t=(0,i.useBlocks)(e=>e.blocks),r=(0,i.useBlocks)(e=>e.remove),a=(0,i.activeBlock)(t,e,(0,c.ymd)(o),(0,c.hm)(o));return a?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(M,{rid:e,now:o,big:s}),(0,f.jsxs)(n.default,{testID:"blocks-banner",accessibilityRole:"summary",style:{flexDirection:'row',alignItems:'center',gap:10,backgroundColor:u.colours.amberBg,borderColor:u.colours.amber,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[(0,f.jsx)(b.T,{size:s?20:16,children:"\u23f8"}),(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",colour:u.colours.amber,style:{flex:1},children:(0,i.pausedLine)(a)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Undo",testID:"blocks-undo",onPress:()=>{r(a.id,l),(0,m.pushBlocksToWix)(e,[a.id],'remove')}})]})]}):(0,f.jsx)(M,{rid:e,now:o,big:s})},_e.BlockBookingsButton=function({rid:e,r:o,now:a,by:d,wide:m,big:x,quiet:j,tile:k,display:p}){const[y,w]=(0,s.useState)(!1),C=(0,i.useBlocks)(e=>e.blocks),v=(0,i.currentBlocks)(C,e,(0,c.ymd)(a),(0,c.hm)(a)).length;return k?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(l.ActionTile,{testID:"block-bookings",icon:"pause",label:"Block bookings",sub:v?`${v} block${1===v?'':'s'} on now`:'Pause online times',count:v||void 0,onPress:()=>w(!0),accessibilityLabel:"Block bookings"}),y?(0,f.jsx)(B,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>w(!1)}):null]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(r.default,{testID:"block-bookings",accessibilityRole:"button",accessibilityLabel:"Block bookings",onPress:()=>w(!0),style:({pressed:e})=>j?{...t.look.quiet(e),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:u.colours.gold,borderRadius:16,paddingVertical:x?14:10,paddingHorizontal:18,backgroundColor:e?u.colours.goldTint:'transparent'},children:[j?null:(0,f.jsx)(b.T,{size:x?22:17,colour:u.colours.gold,children:"\u23f8"}),(0,f.jsx)(b.T,{size:j?15:x?22:17,weight:"semibold",colour:j?u.colours.goldLight:u.colours.gold,children:"Block bookings"}),v?(0,f.jsx)(n.default,{style:{backgroundColor:u.colours.amber,borderRadius:10,minWidth:22,paddingHorizontal:6},children:(0,f.jsx)(b.T,{size:13,weight:"bold",colour:u.colours.onGold,center:!0,children:v})}):null]}),y?p?(0,f.jsx)(h.DisplayBlocksMenu,{rid:e,r:o,now:a,by:d,onClose:()=>w(!1)}):(0,f.jsx)(B,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>w(!1)}):null]})},_e.closeOutdoor=C,_e.useOutdoor=v,_e.CloseGardenButton=function({rid:e,r:o,now:s,by:n,big:a,quiet:d,short:c,tile:h}){const m=v(e,s);if(!m.outdoor.length)return null;const x=m.allClosed;return h?(0,f.jsx)(l.ActionTile,{testID:x?'reopen-garden':'close-garden',icon:x?'sun':'rain',tone:x?'blue':'gold',label:x?'Reopen garden':'Close garden',sub:x?'Closed for weather':'For weather',accessibilityLabel:x?'Reopen garden':'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):C(e,o,s,n,m.outdoor.filter(e=>!m.closed.has(e.id)))}):(0,f.jsxs)(r.default,{testID:x?'reopen-garden':'close-garden',accessibilityRole:"button",accessibilityLabel:x?'Reopen garden':'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):C(e,o,s,n,m.outdoor.filter(e=>!m.closed.has(e.id))),style:({pressed:e})=>d?{...t.look.quiet(e,x?'blue':'gold'),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:x?u.colours.blue:u.colours.gold,borderRadius:16,paddingVertical:a?14:10,paddingHorizontal:16,minHeight:48,backgroundColor:e?u.colours.goldTint:x?u.colours.blueBg:'transparent'},children:[d?null:(0,f.jsx)(b.T,{size:a?22:17,children:x?'\u2600\ufe0f':'\ud83c\udf27'}),(0,f.jsx)(b.T,{size:d?15:a?20:16,weight:"semibold",colour:x?u.colours.blue:d?u.colours.goldLight:u.colours.gold,children:x?'Reopen garden':c?'Close garden':'Close garden for weather'})]})},_e.GardenBanner=M;var o=_r(_d[0]),s=_r(_d[1]),l=_r(_d[2]),t=_r(_d[3]),r=e(_r(_d[4])),n=e(_r(_d[5])),i=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),b=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),f=_r(_d[14]);const x=e=>(0,c.fromMins)(15*Math.floor((60*e.getHours()+e.getMinutes())/15)),j=(e,o)=>e.date===o?'Today':(0,c.niceDate)((0,c.parseYmd)(e.date));function k({title:e,sub:o,onPress:s,testID:l,disabled:t}){return(0,f.jsxs)(r.default,{testID:l,accessibilityRole:"button",accessibilityLabel:e,disabled:t,onPress:s,style:({pressed:e})=>({borderWidth:1.5,borderColor:u.colours.gold,borderRadius:16,padding:16,backgroundColor:e?u.colours.goldTint:u.colours.surface2,opacity:t?.4:1}),children:[(0,f.jsx)(b.T,{size:20,weight:"semibold",colour:u.colours.gold,children:e}),o?(0,f.jsx)(b.Muted,{children:o}):null]})}function p({rid:e,now:l,by:t="staff"}){const r=(0,i.useBlocks)(e=>e.blocks),a=(0,i.useBlocks)(e=>e.remove),[d,h]=(0,s.useState)(null),x=(0,c.ymd)(l),k=(0,i.currentBlocks)(r,e,x,(0,c.hm)(l));return k.length?(0,f.jsxs)(n.default,{style:{gap:8},testID:"block-list",children:[k.map(e=>{const s=e.date===x&&(0,c.toMins)(e.from)<=(0,c.toMins)((0,c.hm)(l));return(0,f.jsxs)(b.Row,{style:{justifyContent:'space-between',borderWidth:1,borderColor:s?u.colours.amber:u.colours.border,borderRadius:12,padding:10},children:[(0,f.jsxs)(n.default,{style:{flex:1},children:[(0,f.jsxs)(b.T,{weight:"semibold",children:[e.areaId?`${e.areaName??'Area'} closed \xb7 `:'',e.tables?.length?`${e.tables.map(o.tableNumbers).join(', ')} \xb7 `:'',j(e,x)," \xb7 ",e.from,"\u2013",e.to,s?' \xb7 now':'']}),(0,f.jsxs)(b.Muted,{children:[e.reason??'No reason given'," \xb7 by ",e.by,e.areaId?' \xb7 the rest of the venue stays open':'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Remove",testID:`block-remove-${e.id}`,onPress:()=>h(e)})]},e.id)}),d?(0,f.jsxs)(b.Sheet,{visible:!0,onClose:()=>h(null),title:"Remove this block?",testID:"block-remove-confirm",children:[(0,f.jsx)(b.T,{children:`${j(d,x)}, ${d.from}\u2013${d.to}. Bookings open again for that time.`}),(0,f.jsx)(b.Button,{testID:"block-remove-yes",label:"Remove block",onPress:()=>{a(d.id,t),(0,m.pushBlocksToWix)(e,[d.id],'remove'),h(null)}}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Keep it",onPress:()=>h(null)})]}):null]}):(0,f.jsx)(b.Muted,{children:"No bookings paused. Online and staff bookings are open as normal."})}function y({value:e,onChange:o}){return(0,f.jsxs)(n.default,{style:{gap:6},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Reason (optional)"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:i.BLOCK_REASONS.map(s=>(0,f.jsx)(b.Chip,{label:s,selected:e===s,onPress:()=>o(e===s?void 0:s)},s))})]})}function w({label:e,value:o,onChange:s,min:l,max:t}){return(0,f.jsxs)(b.Row,{gap:8,children:[(0,f.jsx)(b.T,{style:{width:52},children:e}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"\u221230",accessibilityLabel:`${e} 30 minutes earlier`,onPress:()=>s(Math.max(l,o-30))}),(0,f.jsx)(b.T,{size:22,weight:"semibold",colour:u.colours.gold,style:{minWidth:70,textAlign:'center'},children:(0,c.fromMins)(o)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"+30",accessibilityLabel:`${e} 30 minutes later`,onPress:()=>s(Math.min(t,o+30))})]})}function B({rid:e,r:o,now:l,by:t,onClose:r,wide:a}){const u=(0,i.useBlocks)(e=>e.add),[h,m]=(0,s.useState)('menu'),[j,B]=(0,s.useState)(),C=(0,c.ymd)(l),v=(0,d.hoursFor)(o,l),M=v?(0,c.hm)(v.close):null,P=x(l),T=!!v&&(0,c.toMins)(P)<(0,c.toMins)(M),I=(0,c.fromMins)((0,c.toMins)(P)+60),R=(0,s.useMemo)(()=>{const e=[];for(let s=1;s<=28;s++){const t=new Date(l);t.setHours(12,0,0,0),t.setDate(t.getDate()+s),(0,d.hoursFor)(o,t)&&e.push(t)}return e},[C,o.id]),[$,z]=(0,s.useState)(R[0]?(0,c.ymd)(R[0]):C),S=(0,d.hoursFor)(o,(0,c.parseYmd)($)),L=S?(0,c.toMins)((0,c.hm)(S.open)):720,F=S?(0,c.toMins)((0,c.hm)(S.close)):1260,[W,A]=(0,s.useState)(null),N=W??{from:L,to:F},H=(o,s,l)=>{u({rid:e,date:o,from:s,to:l,reason:j,by:t}),r()};return(0,f.jsx)(b.Sheet,{visible:!0,onClose:r,title:"Block bookings",maxWidth:a?720:void 0,testID:"block-sheet",children:'menu'===h?(0,f.jsxs)(n.default,{style:{gap:10},children:[(0,f.jsx)(b.Muted,{children:"Pause new bookings for a while. The customer app stops offering those times, and staff get a warning."}),(0,f.jsx)(k,{testID:"block-today",title:"Today",sub:T?`Now until close (${M}) or for 1 hour`:'Closed for the rest of today',disabled:!T,onPress:()=>m('today')}),(0,f.jsx)(k,{testID:"block-future",title:"Future dates",sub:"Pick a date and a time window",onPress:()=>m('future')}),(0,f.jsx)(D,{rid:e,r:o,now:l,by:t,onDone:r}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Active and upcoming"}),(0,f.jsx)(p,{rid:e,now:l})]}):'today'===h?(0,f.jsxs)(n.default,{style:{gap:10},children:[(0,f.jsx)(y,{value:j,onChange:B}),(0,f.jsx)(k,{testID:"block-until-close",title:"From now until close",sub:`${P} to ${M} (kitchen close, from opening hours)`,onPress:()=>H(C,P,M)}),(0,f.jsx)(k,{testID:"block-one-hour",title:"From now for 1 hour",sub:`${P} to ${I}`,onPress:()=>H(C,P,I)}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]}):(0,f.jsxs)(n.default,{style:{gap:10},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Date"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:R.map(e=>(0,f.jsx)(b.Chip,{label:(0,c.niceDate)(e),selected:$===(0,c.ymd)(e),onPress:()=>{z((0,c.ymd)(e)),A(null)}},(0,c.ymd)(e)))}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Time window"}),(0,f.jsxs)(b.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(b.Chip,{label:"All day",selected:N.from===L&&N.to===F,onPress:()=>A({from:L,to:F})}),L<1020?(0,f.jsx)(b.Chip,{label:`Lunch ${(0,c.fromMins)(L)}\u201317:00`,selected:N.from===L&&1020===N.to,onPress:()=>A({from:L,to:Math.min(1020,F)})}):null,F>1020?(0,f.jsx)(b.Chip,{label:`Evening 17:00\u2013${(0,c.fromMins)(F)}`,selected:1020===N.from&&N.to===F,onPress:()=>A({from:Math.max(1020,L),to:F})}):null]}),(0,f.jsx)(w,{label:"From",value:N.from,min:L,max:N.to-30,onChange:e=>A({...N,from:e})}),(0,f.jsx)(w,{label:"To",value:N.to,min:N.from+30,max:F,onChange:e=>A({...N,to:e})}),(0,f.jsx)(y,{value:j,onChange:B}),(0,f.jsx)(b.Button,{testID:"block-save-future",label:`Block ${(0,c.niceDate)((0,c.parseYmd)($))} ${(0,c.fromMins)(N.from)}\u2013${(0,c.fromMins)(N.to)}`,disabled:!R.length,onPress:()=>H($,(0,c.fromMins)(N.from),(0,c.fromMins)(N.to))}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]})})}function C(e,o,s,l,t){const r=(0,d.hoursFor)(o,s),n=x(s),a=r?(0,c.hm)(r.close):null,u=a&&(0,c.toMins)(a)>(0,c.toMins)(n)?a:'23:59';return t.map(o=>i.useBlocks.getState().add({rid:e,date:(0,c.ymd)(s),from:n,to:u,reason:'Weather',by:l,areaId:o.id,areaName:o.name}))}function v(e,o){const s=(0,a.usePlan)(e),l=(0,i.useBlocks)(e=>e.blocks),t=s.areas.filter(e=>e.outdoor),r=(0,i.closedAreasAt)(l,e,(0,c.ymd)(o),(0,c.hm)(o)),n=l.filter(s=>s.rid===e&&s.areaId&&s.date===(0,c.ymd)(o)&&(0,c.toMins)((0,c.hm)(o))>=(0,c.toMins)(s.from)&&(0,c.toMins)((0,c.hm)(o))<(0,c.toMins)(s.to));return{plan:s,outdoor:t,closed:r,active:n,allClosed:t.length>0&&t.every(e=>r.has(e.id))}}function D({rid:e,r:o,now:s,by:l,onDone:t}){const r=v(e,s);return!r.outdoor.length||r.allClosed?null:(0,f.jsx)(k,{testID:"block-garden",title:"Close garden for weather",sub:`${r.outdoor.map(e=>e.name).join(', ')} only \xb7 the rest of the venue stays bookable`,onPress:()=>{C(e,o,s,l,r.outdoor.filter(e=>!r.closed.has(e.id))),t()}})}function M({rid:e,now:o,big:s}){const l=v(e,o);if(!l.active.length)return null;const t=[...new Set(l.active.map(e=>e.areaName??'Garden'))].join(', '),r=l.active.map(e=>e.to).sort().slice(-1)[0],a=l.plan.areas.filter(e=>e.dogs&&!l.closed.has(e.id)).map(e=>e.name);return(0,f.jsxs)(n.default,{testID:"garden-banner",accessibilityRole:"summary",style:{flexDirection:'row',alignItems:'center',gap:10,backgroundColor:u.colours.blueBg,borderColor:u.colours.blue,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[(0,f.jsx)(b.T,{size:s?20:16,children:"\ud83c\udf27"}),(0,f.jsxs)(n.default,{style:{flex:1},children:[(0,f.jsxs)(b.T,{size:s?20:16,weight:"semibold",colour:u.colours.blue,children:[t," closed for weather until ",r]}),(0,f.jsxs)(b.T,{size:13,colour:"#E2C489",children:["No bookings or walk-ins are offered there.",a.length?` Dogs can still sit in the ${a.join(' or ')}.`:'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Reopen",testID:"garden-reopen",onPress:()=>l.active.forEach(e=>i.useBlocks.getState().remove(e.id))})]})}},990,[808,30,1357,1353,263,127,824,825,815,818,821,813,1438,1439,24]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.GreensideCashOnly=function(){return(0,s.jsxs)(n.Card,{children:[(0,s.jsx)(n.T,{weight:"semibold",children:"Cash only"}),(0,s.jsx)(n.Muted,{children:"Card payments and online checkout are not enabled for The Greenside Restaurant. Deposits are off; the policy needs confirmation."})]})},r(d[0]);var n=r(d[1]),s=r(d[2])},991,[30,813,24]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useHrSettings",{enumerable:!0,get:function(){return f}}),_e.MoraleScale=b,_e.StaffingSlider=j,_e.ShiftCheckout=function({rid:e,shiftKey:o,day:a,meId:d,onClose:y}){const w=f(e),S=w.wording,k=(0,i.useOwner)(e=>e.staff),C=(0,i.useOwner)(e=>e.attendance),[v,T]=(0,s.useState)(null),[R,M]=(0,s.useState)(null),[I,D]=(0,s.useState)(''),[H,L]=(0,s.useState)('up'),[z,P]=(0,s.useState)(null),[W,A]=(0,s.useState)(''),[q,B]=(0,s.useState)(null),[N,E]=(0,s.useState)(!1),$=(0,s.useMemo)(()=>{const e=new Set(C.filter(e=>e.date===a&&e.staffId!==d).map(e=>e.staffId)),t=k.filter(e=>e.active&&e.id!==d&&!e.temp);return[...t.filter(t=>e.has(t.id)),...t.filter(t=>!e.has(t.id))].slice(0,14)},[k,C,a,d]),O=()=>{u.useHr.getState().skip(e,o),y()};return(0,c.jsx)(n.Sheet,{visible:!0,onClose:O,title:"How was today?",testID:"hr-checkout",children:N?(0,c.jsxs)(l.default,{testID:"hr-checkout-thanks",style:{gap:6,paddingVertical:10},children:[(0,c.jsx)(n.T,{size:18,weight:"semibold",colour:r.colours.goldLight,center:!0,children:"Thanks. Sent anonymously."}),(0,c.jsx)(n.Muted,{center:!0,children:"Have a good evening."})]}):(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(n.Muted,{size:13,children:S.intro}),(0,c.jsxs)(l.default,{style:{gap:8},children:[(0,c.jsx)(n.T,{weight:"semibold",children:S.morale}),(0,c.jsx)(b,{value:v,onChange:T,w:S})]}),(0,c.jsxs)(l.default,{style:{gap:8},children:[(0,c.jsx)(n.T,{weight:"semibold",children:S.staffing}),(0,c.jsx)(j,{value:R,onChange:M,w:S})]}),w.askQuestion||w.askShout?(0,c.jsxs)(n.Row,{wrap:!0,gap:6,children:[w.askQuestion?(0,c.jsx)(n.Chip,{testID:"hr-more-question",label:"\uff0b Ask the team a question",selected:'q'===q,onPress:()=>B('q'===q?null:'q')}):null,w.askShout?(0,c.jsx)(n.Chip,{testID:"hr-more-shout",label:"\uff0b Shout out a teammate",selected:'shout'===q,onPress:()=>B('shout'===q?null:'shout')}):null]}):null,'q'===q&&w.askQuestion?(0,c.jsxs)(l.default,{style:{gap:6},children:[(0,c.jsxs)(n.Muted,{size:13,children:[S.question," Optional."]}),(0,c.jsx)(t.TextInput,{testID:"hr-question",accessibilityLabel:"Your question",value:I,onChangeText:D,maxLength:280,multiline:!0,placeholder:"e.g. Could we start staff meals earlier?",placeholderTextColor:r.colours.muted,style:[x,{minHeight:64}]}),(0,c.jsxs)(n.Row,{wrap:!0,gap:6,children:[(0,c.jsx)(n.Chip,{label:"Vote up",selected:'up'===H,onPress:()=>L('up')}),(0,c.jsx)(n.Chip,{label:"Yes / No",selected:'yesno'===H,onPress:()=>L('yesno')})]})]}):null,'shout'===q&&w.askShout?(0,c.jsxs)(l.default,{style:{gap:6},children:[(0,c.jsxs)(n.Muted,{size:13,children:[S.shout," Optional. Your name isn\u2019t shown."]}),(0,c.jsx)(n.Row,{wrap:!0,gap:6,children:$.map(e=>(0,c.jsx)(n.Chip,{testID:`hr-shout-${e.id}`,label:p(e.nickname||e.name).split(' ')[0],selected:z===p(e.nickname||e.name).split(' ')[0],onPress:()=>{const t=p(e.nickname||e.name).split(' ')[0];P(z===t?null:t)}},e.id))}),z?(0,c.jsx)(t.TextInput,{testID:"hr-shout-note",accessibilityLabel:"What for (optional)",value:W,onChangeText:A,maxLength:140,placeholder:"What for? (optional)",placeholderTextColor:r.colours.muted,style:x}):null]}):null,(0,c.jsxs)(n.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(n.Button,{testID:"hr-checkout-send",label:"Send anonymously",disabled:null==v&&null==R,onPress:()=>{u.useHr.getState().submit({rid:e,shiftKey:o,day:a,morale:v??3,staffing:R,question:w.askQuestion&&I.trim()?I:void 0,kind:H,shoutTo:w.askShout&&z?z:void 0,shoutBody:W||void 0}),E(!0),setTimeout(y,2400)},style:{flexGrow:1}}),(0,c.jsx)(n.Button,{testID:"hr-checkout-skip",kind:"ghost",label:"Skip",onPress:O})]}),(0,c.jsxs)(n.Muted,{size:12,children:["No name, no staff number and no clock time is saved with these answers. Managers only see a day once ",h.MIN_ANSWERS," or more people have answered."]})]})})},_e.QuestionBoard=function({rid:e,today:i,manager:a,by:d}){const p=f(e);(0,s.useEffect)(()=>{u.useHr.getState().ensure(e,i),u.hrRemote.live&&u.hrRemote.refresh&&u.hrRemote.refresh()},[e,i]);const y=(0,u.useHr)(e=>e.questions),b=(0,u.useHr)(e=>e.voted),j=(0,u.useHr)(e=>e.log),[S,k]=(0,s.useState)(''),[C,v]=(0,s.useState)('up'),[T,R]=(0,s.useState)(null),[M,I]=(0,s.useState)(null),[D,H]=(0,s.useState)(''),[L,z]=(0,s.useState)(null),[P,W]=(0,s.useState)(''),[A,q]=(0,s.useState)(!1),[B,N]=(0,s.useState)(null);(0,s.useEffect)(()=>{a&&A&&u.hrRemote.live&&u.hrRemote.log&&u.hrRemote.log(e).then(e=>N(e))},[a,A,e,j.length]);const E=(0,h.boardOrder)(y.filter(t=>t.venue===e),a),$=(B??j.filter(t=>t.venue===e)).slice(0,30);if(!p.board)return(0,c.jsx)(n.Card,{children:(0,c.jsxs)(n.Muted,{children:["The question board is switched off for this venue.",a?' Turn it on in Settings \u203a Advanced \u203a Shift check-out & question board.':'']})});return(0,c.jsxs)(l.default,{style:{gap:10},testID:"hr-board",children:[(0,c.jsx)(n.Muted,{children:"Ask anything about work. No names are shown or saved, not even to managers. Vote on what matters to you."}),(0,c.jsxs)(n.Card,{children:[(0,c.jsx)(n.T,{weight:"semibold",children:"Post a question"}),(0,c.jsx)(t.TextInput,{testID:"hr-board-input",accessibilityLabel:"Your question",value:S,onChangeText:e=>{k(e),R(null)},maxLength:280,multiline:!0,placeholder:"e.g. Can the rota go up by Thursday?",placeholderTextColor:r.colours.muted,style:[x,{minHeight:64}]}),(0,c.jsxs)(n.Row,{wrap:!0,gap:6,style:{justifyContent:'space-between'},children:[(0,c.jsxs)(n.Row,{wrap:!0,gap:6,children:[(0,c.jsx)(n.Chip,{label:"Vote up",selected:'up'===C,onPress:()=>v('up')}),(0,c.jsx)(n.Chip,{label:"Yes / No",selected:'yesno'===C,onPress:()=>v('yesno')})]}),(0,c.jsx)(n.Button,{small:!0,testID:"hr-board-post",label:"Post anonymously",disabled:!(0,h.cleanQuestion)(S),onPress:()=>{u.useHr.getState().post(e,S,C,i)?(k(''),R('Posted anonymously.')):R('Write a few more words first.')}})]}),T?(0,c.jsx)(n.Muted,{size:13,children:T}):null]}),E.length?E.map(e=>(0,c.jsx)(w,{q:e,mine:b[e.id],manager:a,onHide:()=>{I(e),H('')},onReply:()=>{z(e),W(e.reply??'')},by:d},e.id)):(0,c.jsx)(n.Muted,{center:!0,children:"No questions yet. Be the first."}),a?(0,c.jsxs)(n.Card,{children:[(0,c.jsx)(o.default,{testID:"hr-log-toggle",accessibilityRole:"button",onPress:()=>q(!A),children:(0,c.jsxs)(n.Row,{style:{justifyContent:'space-between',minHeight:44},children:[(0,c.jsx)(n.T,{weight:"semibold",style:{flex:1},children:"Moderation log"}),(0,c.jsx)(n.T,{colour:r.colours.gold,children:A?'Hide':'Show'})]})}),(0,c.jsx)(n.Muted,{size:13,children:"Every hide, unhide and reply is logged with who did it and when. Questions never show who asked."}),A?$.length?$.map(e=>(0,c.jsxs)(l.default,{testID:"hr-log-row",style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:6},children:[(0,c.jsxs)(n.T,{size:14,children:['hide'===e.action?'Hidden':'unhide'===e.action?'Shown again':'Replied'," by ",e.by]}),(0,c.jsxs)(n.Muted,{size:12,children:[new Date(e.at).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'}),e.reason?` \xb7 ${e.reason}`:'']})]},e.id)):(0,c.jsx)(n.Muted,{children:"Nothing logged yet."}):null]}):null,(0,c.jsxs)(n.Sheet,{visible:!!M,onClose:()=>I(null),title:"Hide this question?",testID:"hr-hide-sheet",children:[(0,c.jsx)(n.Muted,{children:"It disappears for staff straight away. You can show it again later. This is logged with your name."}),(0,c.jsx)(t.TextInput,{testID:"hr-hide-reason",accessibilityLabel:"Reason",value:D,onChangeText:H,maxLength:140,placeholder:"Reason, e.g. rude or names someone",placeholderTextColor:r.colours.muted,style:x}),(0,c.jsxs)(n.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(n.Button,{testID:"hr-hide-confirm",kind:"danger",label:"Hide",disabled:D.trim().length<3,onPress:()=>{M&&u.useHr.getState().moderate(M.id,'hide',D,d),I(null)}}),(0,c.jsx)(n.Button,{kind:"ghost",label:"Cancel",onPress:()=>I(null)})]})]}),(0,c.jsxs)(n.Sheet,{visible:!!L,onClose:()=>z(null),title:"Reply to the team",testID:"hr-reply-sheet",children:[L?(0,c.jsxs)(n.Muted,{children:["\u201c",L.body,"\u201d"]}):null,(0,c.jsx)(t.TextInput,{testID:"hr-reply-input",accessibilityLabel:"Your reply",value:P,onChangeText:W,maxLength:600,multiline:!0,placeholder:"Your reply, shown under the question",placeholderTextColor:r.colours.muted,style:[x,{minHeight:80}]}),(0,c.jsx)(n.Muted,{size:12,children:"Shown as \u201cReply from the managers\u201d. Your name is kept in the moderation log only."}),(0,c.jsxs)(n.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(n.Button,{testID:"hr-reply-save",label:"Post reply",disabled:!P.trim(),onPress:()=>{L&&u.useHr.getState().reply(L.id,P,d),z(null)}}),(0,c.jsx)(n.Button,{kind:"ghost",label:"Cancel",onPress:()=>z(null)})]})]})]})},_e.coversByDay=k,_e.exampleCovers=C,_e.MoraleTrend=function({rid:e,today:t}){const o=f(e).wording;(0,s.useEffect)(()=>{u.useHr.getState().ensure(e,t)},[e,t]);const[i,a]=(0,s.useState)(14),p=(0,u.useHr)(e=>e.checkins),x=(0,u.useHr)(e=>e.shouts),b=(0,d.useBookings)(e),j=(0,s.useMemo)(()=>k(b),[b]),w=e=>j[e]??(z?C(e):void 0),v=S(t,-i),[T,R]=(0,s.useState)(null),[M,I]=(0,s.useState)(null);(0,s.useEffect)(()=>{let s=!0;return u.hrRemote.live&&u.hrRemote.trend&&u.hrRemote.trend(e,v,t).then(e=>{s&&R(e)}),u.hrRemote.live&&u.hrRemote.shouts&&u.hrRemote.shouts(e,S(t,-30)).then(e=>{s&&I(e)}),()=>{s=!1}},[e,v,t]);const D=(0,s.useMemo)(()=>(0,h.dayResults)(p.filter(s=>s.venue===e&&s.day>=v&&s.day<=t)),[p,e,v,t]),H=u.hrRemote.live,L=H?T??[]:D.shown,z=!H&&p.some(t=>t.venue===e&&t.example),P=(H?M??[]:x.filter(t=>t.venue===e)).slice().sort((e,t)=>t.day.localeCompare(e.day)).slice(0,8),W=L.length?Math.round(L.reduce((e,t)=>e+t.morale,0)/L.length*10)/10:null,A=Array.from({length:i},(e,s)=>S(t,1-i+s)),q=new Map(L.map(e=>[e.day,e]));return(0,c.jsxs)(l.default,{style:{gap:10},testID:"hr-trend",children:[(0,c.jsxs)(n.Muted,{children:["From the anonymous check-out when people clock out. A day only shows once ",h.MIN_ANSWERS," or more people have answered."]}),z?(0,c.jsx)(n.Banner,{kind:"example",title:"Example answers",children:"These are made-up answers so you can see how it looks. Real answers replace them once your team is signed in."}):null,(0,c.jsx)(n.Row,{wrap:!0,gap:6,children:[14,28,56].map(e=>(0,c.jsx)(n.Chip,{label:14===e?'2 weeks':28===e?'4 weeks':'8 weeks',selected:i===e,onPress:()=>a(e)},e))}),(0,c.jsxs)(n.Card,{children:[(0,c.jsxs)(n.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,c.jsx)(n.T,{weight:"semibold",style:{flexShrink:1},children:"Team morale"}),null!=W?(0,c.jsx)(n.Badge,{kind:"gold",label:`AVERAGE ${W} \xb7 ${(0,h.moraleWord)(Math.round(W),o).toUpperCase()}`}):null]}),(0,c.jsx)(l.default,{testID:"hr-trend-chart",accessibilityLabel:`Morale over the last ${i} days`,style:{height:110,flexDirection:'row',alignItems:'flex-end',gap:i>30?1:3,borderBottomWidth:1,borderColor:r.colours.border},children:A.map(e=>{const t=q.get(e);return(0,c.jsx)(l.default,{style:{flex:1,minWidth:0,height:'100%',justifyContent:'flex-end',alignItems:'center'},children:t?(0,c.jsx)(l.default,{style:{width:'100%',maxWidth:22,height:t.morale/5*100+"%",borderTopLeftRadius:4,borderTopRightRadius:4,backgroundColor:t.morale<2.5?r.colours.amber:r.colours.gold}}):(0,c.jsx)(l.default,{style:{width:4,height:4,borderRadius:2,backgroundColor:r.colours.border,marginBottom:2}})},e)})}),(0,c.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(n.Muted,{size:12,children:y(A[0])}),(0,c.jsx)(n.Muted,{size:12,children:y(A[A.length-1])})]}),(0,c.jsxs)(n.Muted,{size:12,children:["Bar height: average morale (1 low to 5 high). Amber: below 2.5. A dot: fewer than ",h.MIN_ANSWERS," answers or none."]})]}),(0,c.jsxs)(n.Card,{children:[(0,c.jsx)(n.T,{weight:"semibold",children:"Staffing vs covers, night by night"}),L.length?L.slice().reverse().map(e=>(0,c.jsxs)(l.default,{testID:"hr-trend-row",style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:8,gap:4},children:[(0,c.jsxs)(n.Row,{style:{justifyContent:'space-between'},gap:6,wrap:!0,children:[(0,c.jsx)(n.T,{weight:"semibold",style:{flexShrink:1},children:y(e.day)}),(0,c.jsx)(n.T,{size:14,colour:r.colours.goldLight,style:{flexShrink:1},children:null!=w(e.day)?`${w(e.day)} covers`:'No bookings'})]}),(0,c.jsxs)(n.Row,{gap:8,style:{alignItems:'center'},children:[(0,c.jsxs)(l.default,{style:{flex:1,minWidth:60,height:6,borderRadius:3,backgroundColor:r.colours.border},children:[null!=e.staffing?(0,c.jsx)(l.default,{style:{position:'absolute',left:`${e.staffing}%`,marginLeft:-6,top:-3,width:12,height:12,borderRadius:6,backgroundColor:r.colours.gold}}):null,(0,c.jsx)(l.default,{style:{position:'absolute',left:'50%',marginLeft:-1,top:-4,width:2,height:14,backgroundColor:r.colours.goldMuted}})]}),(0,c.jsx)(n.T,{size:13,style:{flexShrink:1,maxWidth:'55%'},children:null!=e.staffing?(0,h.staffingWord)(e.staffing,o):'\u2014'})]}),(0,c.jsxs)(n.Muted,{size:12,children:["Morale ",e.morale," \xb7 ",e.answers," answers \xb7 ",e.short," said short, ",e.perfect," perfect, ",e.over," over"]})]},e.day)):(0,c.jsxs)(n.Muted,{children:["No days with ",h.MIN_ANSWERS," or more answers yet."]}),!H&&D.held?(0,c.jsxs)(n.Muted,{size:12,children:[D.held," day",1===D.held?'':'s'," held back (fewer than ",h.MIN_ANSWERS," answers)."]}):null,(0,c.jsx)(n.Muted,{size:12,children:"Covers come from that day\u2019s bookings (cancelled and no-shows left out)."})]}),(0,c.jsxs)(n.Card,{children:[(0,c.jsx)(n.T,{weight:"semibold",children:"Shout-outs"}),P.length?P.map(e=>(0,c.jsxs)(l.default,{testID:"hr-shout-row",style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:6},children:[(0,c.jsxs)(n.T,{size:14,children:[(0,c.jsx)(n.T,{size:14,weight:"semibold",colour:r.colours.goldLight,children:e.to}),e.body?`: ${e.body}`:'']}),(0,c.jsxs)(n.Muted,{size:12,children:[y(e.day)," \xb7 from a teammate"]})]},e.id)):(0,c.jsx)(n.Muted,{children:"No shout-outs yet."})]})]})},_e.HrSettingsCard=function({rid:e}){const o=(0,a.useStore)(t=>t.restaurants.find(t=>t.id===e)?.settings?.hr),i=(0,h.hrSettingsOf)(o),d=t=>a.useStore.getState().updateSettings(e,{hr:{...i,...t}}),[u,f]=(0,s.useState)({});return(0,c.jsxs)(l.default,{style:{gap:8},testID:"hr-settings",children:[(0,c.jsx)(n.Toggle,{testID:"hr-set-on",label:"Ask a quick check-out when people clock out",value:i.on,onChange:e=>d({on:e})}),(0,c.jsx)(n.Toggle,{label:"Let them post a question for the board",value:i.askQuestion,onChange:e=>d({askQuestion:e})}),(0,c.jsx)(n.Toggle,{label:"Let them shout out a teammate",value:i.askShout,onChange:e=>d({askShout:e})}),(0,c.jsx)(n.Toggle,{testID:"hr-set-board",label:"Question board in the Staff, Head Chef and Managers apps",value:i.board,onChange:e=>d({board:e})}),(0,c.jsx)(n.Muted,{size:13,children:"Tip: it only shows after Clock out, never at clock in, and anyone can tap Skip. It\u2019s a card in the app, not a phone notification."}),(0,c.jsxs)(n.Muted,{size:13,children:["Tip: answers are anonymous. No name or staff number is saved, and a day\u2019s results only show once ",h.MIN_ANSWERS," people have answered."]}),(0,c.jsx)(n.T,{weight:"semibold",style:{marginTop:4},children:"Wording"}),v.map(({k:e,label:s})=>(0,c.jsxs)(l.default,{style:{gap:4},children:[(0,c.jsx)(n.Muted,{size:13,children:s}),(0,c.jsx)(t.TextInput,{testID:`hr-word-${e}`,accessibilityLabel:s,value:u[e]??i.wording[e],onChangeText:t=>f({...u,[e]:t}),onBlur:()=>{null!=u[e]&&(d({wording:{...i.wording,[e]:u[e].trim()||h.DEFAULT_HR.wording[e]}}),f(t=>{const s={...t};return delete s[e],s}))},maxLength:'intro'===e||'staffing'===e||'question'===e?160:60,multiline:'intro'===e||'staffing'===e||'question'===e,placeholderTextColor:r.colours.muted,style:[x,'intro'===e||'staffing'===e||'question'===e?{minHeight:92,textAlignVertical:'top'}:null]})]},e)),(0,c.jsx)(n.Muted,{size:13,children:"Tip: keep it short and plain. Leave a box empty to go back to the standard words."})]})};var t=_r(_d[0]),s=_r(_d[1]),o=e(_r(_d[2])),l=e(_r(_d[3])),n=_r(_d[4]),r=_r(_d[5]),i=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),c=_r(_d[11]);const f=e=>(0,h.hrSettingsOf)((0,a.useStore)(t=>t.restaurants.find(t=>t.id===e)?.settings?.hr)),p=e=>e.replace(' (example)','').trim(),x={minHeight:46,borderRadius:12,borderWidth:1,borderColor:r.colours.accentBorder,backgroundColor:r.colours.surface2,color:r.colours.text,paddingHorizontal:12,paddingVertical:10,fontSize:16},y=e=>new Date(`${e}T12:00:00`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'});function b({value:e,onChange:t,w:s}){return(0,c.jsxs)(l.default,{style:{gap:6},testID:"hr-morale",children:[(0,c.jsx)(n.Row,{gap:6,style:{justifyContent:'space-between'},children:h.MORALE_STEPS.map(l=>{const i=e===l;return(0,c.jsx)(o.default,{testID:`hr-morale-${l}`,accessibilityRole:"button",accessibilityState:{selected:i},accessibilityLabel:`Morale ${l} of 5: ${(0,h.moraleWord)(l,s)}`,onPress:()=>t(l),hitSlop:4,style:{flex:1,minWidth:0,minHeight:48,borderRadius:12,borderWidth:1,borderColor:i?r.colours.gold:r.colours.border,backgroundColor:i?r.colours.goldTint:r.colours.surface2,alignItems:'center',justifyContent:'center'},children:(0,c.jsx)(n.T,{size:18,weight:"bold",colour:i?r.colours.goldLight:r.colours.text,children:l})},l)})}),(0,c.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(n.Muted,{size:13,style:{flexShrink:1},children:s.moraleLow}),e?(0,c.jsx)(n.T,{size:13,weight:"semibold",colour:r.colours.goldLight,style:{flexShrink:1,textAlign:'center'},children:(0,h.moraleWord)(e,s)}):null,(0,c.jsx)(n.Muted,{size:13,style:{flexShrink:1,textAlign:'right'},children:s.moraleHigh})]})]})}function j({value:e,onChange:t,w:i}){const a=(0,s.useRef)(null),d=(0,s.useRef)(0),u=(0,s.useRef)(1),f=()=>{a.current?.measureInWindow?.((e,t,s)=>{d.current=e,u.current=Math.max(1,s)})},p=e=>t((0,h.snapStaffing)((e-d.current)/u.current*100)),x=e??50,y=null!=e;return(0,c.jsxs)(l.default,{style:{gap:6},children:[(0,c.jsx)(l.default,{testID:"hr-staffing",accessible:!0,accessibilityRole:"adjustable",accessibilityLabel:`Staffing: ${y?(0,h.staffingWord)(x,i):'not answered'}`,accessibilityActions:[{name:'increment'},{name:'decrement'}],onAccessibilityAction:e=>{const s=h.STAFF_STOPS.indexOf((0,h.snapStaffing)(x)),o='increment'===e.nativeEvent.actionName?Math.min(8,s+1):Math.max(0,s-1);t(h.STAFF_STOPS[o])},onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>!0,onResponderGrant:e=>{f(),p(e.nativeEvent.pageX)},onResponderMove:e=>p(e.nativeEvent.pageX),style:{height:48,justifyContent:'center',paddingHorizontal:15},children:(0,c.jsxs)(l.default,{ref:a,onLayout:f,style:{height:48,justifyContent:'center'},children:[(0,c.jsx)(l.default,{style:{height:6,borderRadius:3,backgroundColor:r.colours.border}}),(0,c.jsx)(l.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:0,bottom:0,flexDirection:'row',justifyContent:'space-between',alignItems:'center'},children:h.STAFF_STOPS.map(e=>(0,c.jsx)(l.default,{style:{width:e%50==0?4:2,height:e%50==0?18:10,borderRadius:2,backgroundColor:e%50==0?r.colours.goldMuted:r.colours.muted}},e))}),(0,c.jsx)(l.default,{pointerEvents:"none",style:{position:'absolute',left:`${x}%`,top:10,marginLeft:-14,width:28,height:28,borderRadius:14,borderWidth:2,borderColor:y?r.colours.gold:r.colours.muted,backgroundColor:y?r.colours.gold:r.colours.surface}})]})}),(0,c.jsx)(n.Row,{style:{justifyContent:'space-between',gap:8},children:[[0,i.staffLow],[50,i.staffMid],[100,i.staffHigh]].map(([e,s],l)=>(0,c.jsx)(o.default,{testID:`hr-staffing-${e}`,accessibilityRole:"button",accessibilityLabel:s,onPress:()=>t(e),hitSlop:6,style:{flexShrink:1,flexGrow:0,minWidth:0},children:(0,c.jsx)(n.T,{size:13,colour:y&&(0,h.snapStaffing)(x)===e?r.colours.goldLight:r.colours.muted,weight:y&&(0,h.snapStaffing)(x)===e?'semibold':'regular',style:{textAlign:0===l?'left':1===l?'center':'right'},children:s})},e))}),y&&(0,h.snapStaffing)(x)%50!=0?(0,c.jsx)(n.T,{size:13,colour:r.colours.goldLight,center:!0,children:(0,h.staffingWord)(x,i)}):null]})}function w({q:e,mine:t,manager:s,onHide:o,onReply:i,by:a}){const d=e.yes+e.no,h=d?Math.round(e.yes/d*100):0;return(0,c.jsx)(n.Card,{style:e.hidden?{opacity:.75}:void 0,children:(0,c.jsxs)(l.default,{testID:"hr-question-card",style:{gap:8},children:[(0,c.jsxs)(n.Row,{gap:8,style:{alignItems:'flex-start'},children:[(0,c.jsx)(n.T,{style:{flex:1,minWidth:0},children:e.body}),e.hidden?(0,c.jsx)(n.Badge,{kind:"amber",label:"HIDDEN"}):null]}),(0,c.jsxs)(n.Muted,{size:12,children:["Asked ",y(e.postedOn)," \xb7 anonymous"]}),'up'===e.kind?(0,c.jsx)(n.Row,{gap:8,wrap:!0,children:(0,c.jsx)(n.Button,{small:!0,testID:"hr-vote-up",kind:t?'success':'secondary',label:t?`\u25b2 Voted \xb7 ${e.up}`:`\u25b2 Vote up \xb7 ${e.up}`,disabled:!!t||e.hidden,onPress:()=>u.useHr.getState().vote(e.id,1)})}):(0,c.jsxs)(l.default,{style:{gap:6},children:[(0,c.jsxs)(n.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(n.Button,{small:!0,testID:"hr-vote-yes",kind:1===t?'success':'secondary',label:`Yes \xb7 ${e.yes}`,disabled:!!t||e.hidden,onPress:()=>u.useHr.getState().vote(e.id,1)}),(0,c.jsx)(n.Button,{small:!0,testID:"hr-vote-no",kind:-1===t?'success':'secondary',label:`No \xb7 ${e.no}`,disabled:!!t||e.hidden,onPress:()=>u.useHr.getState().vote(e.id,-1)})]}),d?(0,c.jsx)(l.default,{style:{height:6,borderRadius:3,backgroundColor:r.colours.border,overflow:'hidden'},children:(0,c.jsx)(l.default,{style:{width:`${h}%`,height:6,backgroundColor:r.colours.gold}})}):null,d?(0,c.jsxs)(n.Muted,{size:12,children:[h,"% yes from ",d," vote",1===d?'':'s']}):null]}),t?(0,c.jsx)(n.Muted,{size:12,children:"You\u2019ve voted. Votes are anonymous."}):null,e.reply?(0,c.jsxs)(l.default,{style:{borderLeftWidth:3,borderColor:r.colours.gold,paddingLeft:10,gap:2},children:[(0,c.jsx)(n.T,{size:13,weight:"semibold",colour:r.colours.goldLight,children:"Reply from the managers"}),(0,c.jsx)(n.T,{size:14,children:e.reply})]}):null,s?(0,c.jsxs)(n.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(n.Button,{small:!0,kind:"ghost",testID:"hr-reply",label:e.reply?'Edit reply':'Reply',onPress:i}),e.hidden?(0,c.jsx)(n.Button,{small:!0,kind:"ghost",testID:"hr-unhide",label:"Show again",onPress:()=>u.useHr.getState().moderate(e.id,'unhide','',a)}):(0,c.jsx)(n.Button,{small:!0,kind:"ghost",testID:"hr-hide",label:"Hide",onPress:o})]}):null]})})}const S=(e,t)=>{const s=new Date(`${e}T12:00:00Z`);return s.setUTCDate(s.getUTCDate()+t),s.toISOString().slice(0,10)};function k(e){const t={};for(const s of e)'cancelled'!==s.status&&'noshow'!==s.status&&(t[s.date]=(t[s.date]??0)+(s.partySize||0));return t}function C(e){let t=0;for(const s of e)t=(31*t+s.charCodeAt(0))%997;return 40+t%90}const v=[{k:'intro',label:'Opening line'},{k:'morale',label:'Morale question'},{k:'moraleLow',label:'Morale: low end'},{k:'moraleHigh',label:'Morale: high end'},{k:'staffing',label:'Staffing question'},{k:'staffLow',label:'Staffing: left'},{k:'staffMid',label:'Staffing: middle'},{k:'staffHigh',label:'Staffing: right'},{k:'question',label:'Question prompt'},{k:'shout',label:'Shout-out prompt'}]},992,[874,30,263,127,813,821,854,870,1019,1162,1163,24]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"libraryRowId",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"personRowId",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"tickId",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"personKey",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"useDailyTasks",{enumerable:!0,get:function(){return L}}),Object.defineProperty(_e,"tasksOf",{enumerable:!0,get:function(){return O}});var e,t=r(d[0]),i=(e=t)&&e.__esModule?e:{default:e},s=r(d[1]),n=r(d[2]),o=r(d[3]),u=r(d[4]),c=r(d[5]);const l=e=>(0,o.uuidFrom)(`daily-task-library:${e}`),y=(e,t)=>(0,o.uuidFrom)(`daily-tasks:${e}:${t}`),b=(e,t,i,s)=>(0,o.uuidFrom)(`daily-task-tick:${e}:${(0,u.tickKey)(t,i,s)}`),f=()=>(new Date).toISOString(),k=(e,t)=>`${e}|${t}`,p=e=>u.DEFAULT_LIBRARY.map((t,i)=>({id:(0,o.uuidFrom)(`daily-task-lib:${e}:${i}`),text:t})),L=(0,s.create)()((0,n.persist)((e,t)=>({library:{},people:{},ticks:[],ensure:i=>{t().library[i]||e(e=>({library:{...e.library,[i]:{items:p(i)}}}))},setLibrary:(t,i)=>e(e=>({library:{...e.library,[t]:{items:i,updatedAt:f()}}})),addLibrary:(e,i)=>{const s=(0,u.cleanTaskText)(i);if(!s)return;const n=t().library[e]?.items??p(e);n.some(e=>e.text.toLowerCase()===s.toLowerCase()&&!e.archived)||t().setLibrary(e,[...n,{id:(0,c.uuid)(),text:s}])},setTasks:(t,i,s)=>e(e=>({people:{...e.people,[k(t,i)]:{tasks:s,updatedAt:f()}}})),addTask:(e,i,s,n)=>{const o=(0,u.cleanTaskText)(s);if(!o)return;const l=t().people[k(e,i)]?.tasks??[];l.some(e=>e.text.toLowerCase()===o.toLowerCase())||t().setTasks(e,i,[...l,{id:(0,c.uuid)(),text:o,...n?{libraryId:n}:{}}])},toggleTick:(t,i,s,n,o)=>e(e=>{const u=b(t,i,s,n);if(e.ticks.some(e=>e.id===u))return{ticks:e.ticks.filter(e=>e.id!==u)};const c=new Date(Date.now()-12096e5).toISOString().slice(0,10);return{ticks:[...e.ticks.filter(e=>e.forDate>=c),{id:u,rid:t,staffRef:i,taskId:s,forDate:n,byRef:o.id,byName:o.name,at:f()}]}}),resetLibrary:e=>t().setLibrary(e,p(e))}),{name:'covercharge-daily-tasks-v1',version:1,storage:(0,n.createJSONStorage)(()=>i.default)})),O=(e,t)=>L.getState().people[k(e,t)]?.tasks??[]},993,[1024,1008,1025,1143,1221,1147]); +__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"chairsId",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"rulesId",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"useReminders",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"rulesOf",{enumerable:!0,get:function(){return A}});var e,r=_r(d[0]),t=(e=r)&&e.__esModule?e:{default:e},n=_r(d[1]),s=_r(d[2]),u=_r(d[3]),o=_r(d[4]),l=_r(d[5]);const c=e=>(0,u.uuidFrom)(`reminder:chairs:${e}`),p=e=>(0,u.uuidFrom)(`break-rules:${e}`),f=()=>(new Date).toISOString(),b=(0,n.create)()((0,s.persist)((e,r)=>({reminders:[],rules:{},done:[],snooze:{},ensure:t=>{const n=r(),s={};n.reminders.some(e=>e.id===c(t))||(s.reminders=[...n.reminders,{...(0,o.defaultChairs)(c(t)),rid:t}]),n.rules[t]||(s.rules={...n.rules,[t]:{...o.DEFAULT_BREAK_RULES,id:p(t)}}),Object.keys(s).length&&e(s)},add:(r,t)=>{const n=(0,l.uuid)();return e(e=>({reminders:[...e.reminders,{...t,id:n,rid:r,updatedAt:f()}]})),n},update:(r,t)=>e(e=>({reminders:e.reminders.map(e=>e.id===r?{...e,...t,updatedAt:f()}:e)})),remove:r=>e(e=>({reminders:e.reminders.flatMap(e=>e.id!==r?[e]:e.builtIn?[{...e,removed:!0,paused:!0,updatedAt:f()}]:[])})),resetReminder:r=>e(e=>({reminders:e.reminders.map(e=>e.id===r&&'chairs'===e.builtIn?{...(0,o.defaultChairs)(r),rid:e.rid,updatedAt:f()}:e)})),setRules:(r,t)=>e(e=>({rules:{...e.rules,[r]:{...(0,o.clampRules)({...e.rules[r]??o.DEFAULT_BREAK_RULES,...t}),id:p(r),updatedAt:f()}}})),resetRules:r=>e(e=>({rules:{...e.rules,[r]:{...o.DEFAULT_BREAK_RULES,id:p(r),updatedAt:f()}}})),markDone:r=>e(e=>({done:[{...r,id:(0,l.uuid)(),at:r.at??f()},...e.done].slice(0,400)})),setSnooze:(r,t)=>e(e=>({snooze:Object.fromEntries([...Object.entries(e.snooze).filter(([,e])=>e>Date.now()-864e5),[r,t]])}))}),{name:'covercharge-reminders-v1',version:1,storage:(0,s.createJSONStorage)(()=>t.default)})),A=e=>(0,o.clampRules)(b.getState().rules[e]??o.DEFAULT_BREAK_RULES)},994,[1024,1008,1025,1143,995,1147]); +__d(function(g,_r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"LEGAL_LIMIT_MINS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"DEFAULT_BREAK_RULES",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"REMINDER_WINDOW_MINS",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"CHAIRS_TEXT",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"defaultChairs",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"DAY_NAMES",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"AUDIENCE_LABEL",{enumerable:!0,get:function(){return u}}),e.clampRules=s,Object.defineProperty(e,"validTime",{enumerable:!0,get:function(){return c}}),e.ukClock=d,e.reminderDue=function(t,n){const o=d(n);if(t.paused||!c(t.time)||!t.days.includes(o.dow))return{due:!1,forDate:o.ymd};const i=l(t.time);return{due:o.mins>=i&&o.mins=t.shiftEnd))return null;const r=m(t).filter(n=>n.at<=t.now),o=r.length?r[r.length-1]:null;if(!o)return null;if(t.nowr?o:null}return o};const t=360,n={on:!0,afterMins:240,repeatMins:30,snoozeMins:15},r=180,o='Time to put the chairs up on the tables',i=t=>({id:t,text:o,days:[5,0],time:'21:00',audience:'all',builtIn:'chairs'}),a=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],u={all:'Everyone on shift',foh:'Front of house',kitchen:'Kitchen'};function s(r){const o=(t,n,r,o)=>{const i=Math.round(Number(t));return Number.isFinite(i)?Math.min(o,Math.max(r,i)):n};return{on:!1!==r.on,afterMins:o(r.afterMins,n.afterMins,30,t),repeatMins:o(r.repeatMins,n.repeatMins,5,120),snoozeMins:o(r.snoozeMins,n.snoozeMins,5,60)}}const c=t=>/^([01]\d|2[0-3]):[0-5]\d$/.test(t);function d(t){const n='number'==typeof t?new Date(t):t,r=Object.fromEntries(new Intl.DateTimeFormat('en-GB',{timeZone:'Europe/London',weekday:'short',year:'numeric',month:'2-digit',day:'2-digit',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}).formatToParts(n).map(t=>[t.type,t.value]));return{dow:a.indexOf(String(r.weekday).slice(0,3)),mins:60*Number(r.hour)+Number(r.minute),ymd:`${r.year}-${r.month}-${r.day}`}}const l=t=>60*Number(t.slice(0,2))+Number(t.slice(3,5));const f=(t,n)=>'all'===t||('kitchen'===t?n:!n);function m(t){const n=s(t.rules),r=t.clockIn??t.shiftStart;if(!n.on||void 0===r||t.hadBreak)return[];const o=r+216e5,i=Math.min(void 0!==t.rotaBreak&&t.rotaBreak>r?t.rotaBreak:r+6e4*n.afterMins,o),a=[{stage:1,at:i,label:void 0!==t.rotaBreak&&t.rotaBreak>r&&t.rotaBreak<=o?'Your break on the rota is now.':'Time for your break.'}],u=i+6e4*n.repeatMins;return a.push({stage:2,at:u,label:'Reminder: you haven\u2019t had your break yet.'}),o>u&&a.push({stage:3,at:o,label:'You\u2019ve worked 6 hours without a break. You need a 20-minute break (UK law).'}),a}},995,[]); +__d(function(_g,_r,i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.NotificationsSettings=function({rid:e}){(0,n.useEffect)(()=>{c.useNotifs.getState().ensure(e),(0,j.readPushLive)()},[e]);const t=(0,c.useNotifs)(e=>e.items).filter(t=>t.rid===e&&!t.removed),s=(0,h.useOwner)(e=>e.staff),o=(0,j.usePushLive)(),[l,p]=(0,n.useState)(null),[f,g]=(0,n.useState)(null),[x,b]=(0,n.useState)(!1),y=c.useNotifs.getState(),T=s.map(e=>({id:e.id,role:e.role,level:e.level,job:e.job,department:e.dept,active:e.active})),v=e=>{const t=(0,u.resolveRecipients)(e,T,[]),n=[...e.recipients.groups.map(e=>u.NOTIF_GROUP_LABEL[e]),...(e.recipients.onShiftIn??[]).map(e=>u.SHIFT_FILTER_LABEL[e])];e.recipients.fallback&&n.push(`else ${[...e.recipients.fallback.groups.map(e=>u.NOTIF_GROUP_LABEL[e]),...e.recipients.fallback.staff.map(e=>I(s.find(t=>t.id===e)?.name??e))].join(', ')}`);const o=e.recipients.staff.map(e=>I(s.find(t=>t.id===e)?.name??e));return[...n,...o].join(', ')+(t.length||(e.recipients.onShiftIn??[]).length?'':' (nobody yet)')};return(0,k.jsxs)(a.default,{style:{gap:10},testID:"notif-settings",children:[(0,k.jsx)(r.Muted,{size:13,children:"Tip: these remind people at a set time, e.g. the Mills milk order. They show in the app as a gold slider with Done and Later. Done is logged with the name and time. Times are UK time."}),(0,k.jsxs)(a.default,{testID:"push-live-status",style:{borderWidth:1,borderColor:d.colours.accentBorder,borderRadius:10,padding:8,gap:4},children:[(0,k.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(r.T,{weight:"semibold",children:"Send to phones"}),(0,k.jsx)(r.Badge,{kind:o.live?'gold':'neutral',label:o.live?'ON':'OFF'})]}),(0,k.jsx)(r.Muted,{size:12,children:o.live?'Phone notifications go to people who turned them on.':'Off: nothing goes to anyone\u2019s phone yet. In-app reminders still work.'}),(0,k.jsx)(r.Button,{small:!0,kind:"secondary",testID:"push-live-toggle",label:o.live?'Switch phone notifications off':'Switch phone notifications on\u2026',onPress:()=>b(!0)})]}),(0,k.jsx)(R,{}),t.map(e=>l===e.id?(0,k.jsx)(D,{init:e,onCancel:()=>p(null),onSave:t=>{y.update(e.id,t),p(null)}},e.id):(0,k.jsxs)(a.default,{testID:`notif-${e.seed??e.id}`,style:{borderWidth:1,borderColor:d.colours.hairline,borderRadius:12,padding:10,gap:4,opacity:e.paused?.6:1},children:[(0,k.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(r.T,{weight:"semibold",style:{flex:1},children:e.title}),e.paused?(0,k.jsx)(r.Badge,{kind:"neutral",label:"Off"}):null]}),(0,k.jsx)(r.Muted,{size:13,children:e.message}),(0,k.jsxs)(r.Muted,{size:12,children:[(0,u.scheduleText)(e)," \xb7 ",v(e)," \xb7 ",[e.sendBy.inApp?'In app':'',e.sendBy.push?'Phone':''].filter(Boolean).join(' + ')]}),(0,k.jsxs)(r.Row,{gap:6,children:[(0,k.jsx)(r.Button,{small:!0,kind:"secondary",testID:`notif-edit-${e.seed??e.id}`,label:"Edit",onPress:()=>p(e.id)}),(0,k.jsx)(r.Button,{small:!0,kind:"ghost",label:e.paused?'Switch on':'Switch off',onPress:()=>y.update(e.id,{paused:!e.paused})}),(0,k.jsx)(r.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>g(e)})]})]},e.id)),'new'===l?(0,k.jsx)(D,{init:C,onCancel:()=>p(null),onSave:t=>{y.add(e,t),p(null)}}):(0,k.jsx)(r.Button,{small:!0,testID:"notif-add",label:"Add a notification",onPress:()=>p('new')}),(0,k.jsxs)(r.Sheet,{visible:!!f,onClose:()=>g(null),title:"Remove this notification?",children:[(0,k.jsx)(r.T,{children:f?.title}),(0,k.jsx)(r.Muted,{children:"Nobody gets it after this. Reset to default restores the configured rules."}),(0,k.jsxs)(r.Row,{gap:8,children:[(0,k.jsx)(r.Button,{label:"Remove",onPress:()=>{f&&y.remove(f.id),g(null)}}),(0,k.jsx)(r.Button,{kind:"ghost",label:"Cancel",onPress:()=>g(null)})]})]}),(0,k.jsxs)(r.Sheet,{visible:x,onClose:()=>b(!1),title:o.live?'Switch phone notifications off?':'Switch phone notifications on?',testID:"push-live-confirm",children:[(0,k.jsx)(r.T,{children:o.live?'Nothing more goes to phones. In-app reminders keep working.':'From the next scheduled time, everyone ticked on a notification with \u201cPhone notification\u201d gets it on any phone where they turned phone notifications on.'}),(0,k.jsxs)(r.Row,{gap:8,children:[(0,k.jsx)(r.Button,{testID:"push-live-yes",label:o.live?'Switch off':'Yes, switch on',onPress:()=>{(0,j.setPushLive)(!o.live).then(e=>(0,w.notify)({id:'push-live',tone:e.ok?'normal':'warn',title:e.ok?o.live?'Phone notifications are off':'Phone notifications are on':'Not changed',body:e.message??'',timeoutMs:7e3})),b(!1)}}),(0,k.jsx)(r.Button,{kind:"ghost",label:"Cancel",onPress:()=>b(!1)})]})]})]})},_e.PushButton=R,_e.OrderListsSettings=function({rid:e}){(0,n.useEffect)(()=>{p.useOrderLists.getState().ensure(e)},[e]);const s=(0,p.useOrderLists)(e=>e.lists).filter(t=>t.rid===e),o=(0,p.orderSettingsOf)(e);(0,p.useOrderLists)(t=>t.settings[e]);const l=p.useOrderLists.getState(),[c,u]=(0,n.useState)(''),[h,g]=(0,n.useState)({});return(0,k.jsxs)(a.default,{style:{gap:10},testID:"order-list-settings",children:[(0,k.jsx)(r.Muted,{size:13,children:"Tip: running lists (like Alsons drinks) collect items until you order; trip lists (like Cash and carry) are for one shopping day. Logos and phone numbers are set on each list."}),(0,k.jsx)(r.Toggle,{testID:"order-allow-staff",label:"Let all staff add items",value:o.allowStaff,onChange:t=>l.setSettings(e,{allowStaff:t})}),(0,k.jsx)(r.Muted,{size:12,children:"Staff can add items and see the lists. Only managers and the Head Chef tick, remove or finish an order."}),(0,k.jsx)(r.T,{weight:"semibold",children:"Default trip day"}),(0,k.jsx)(r.Row,{wrap:!0,gap:6,children:v.map(t=>(0,k.jsx)(r.Chip,{label:f.DAY_FULL[t].slice(0,3),selected:o.defaultTripDay===t,onPress:()=>l.setSettings(e,{defaultTripDay:t})},t))}),s.map(e=>(0,k.jsxs)(a.default,{testID:`order-list-row-${e.seed??e.id}`,style:{borderWidth:1,borderColor:d.colours.hairline,borderRadius:10,padding:8,gap:6,opacity:e.archived?.55:1},children:[(0,k.jsxs)(r.Row,{gap:6,children:[(0,k.jsx)(t.TextInput,{accessibilityLabel:`Rename ${e.name}`,value:h[e.id]??e.name,onChangeText:t=>g(s=>({...s,[e.id]:t})),onBlur:()=>{const t=(h[e.id]??'').trim();t&&t!==e.name&&l.updateList(e.id,{name:t})},style:{...T,flex:1,minWidth:0}}),(0,k.jsx)(r.Badge,{kind:"neutral",label:'trip'===e.kind?'Trip':'Running'})]}),'trip'===e.kind?(0,k.jsx)(r.Row,{wrap:!0,gap:6,children:v.map(t=>(0,k.jsx)(r.Chip,{label:f.DAY_FULL[t].slice(0,3),selected:(e.tripDay??o.defaultTripDay)===t,onPress:()=>l.updateList(e.id,{tripDay:t})},t))}):null,(0,k.jsx)(r.Row,{gap:6,children:(0,k.jsx)(r.Button,{small:!0,kind:"ghost",label:e.archived?'Bring back':'Archive',onPress:()=>l.updateList(e.id,{archived:!e.archived})})})]},e.id)),(0,k.jsxs)(r.Row,{gap:6,wrap:!0,children:[(0,k.jsx)(t.TextInput,{accessibilityLabel:"New list name",testID:"order-new-name",value:c,onChangeText:u,placeholder:"e.g. Butcher",placeholderTextColor:d.colours.muted,style:{...T,flexGrow:1,flexBasis:160,minWidth:0}}),(0,k.jsx)(r.Button,{small:!0,label:"Add running",disabled:c.trim().length<2,onPress:()=>{l.addList(e,{name:c.trim(),kind:'running'}),u('')}}),(0,k.jsx)(r.Button,{small:!0,kind:"secondary",label:"Add trip",disabled:c.trim().length<2,onPress:()=>{l.addList(e,{name:c.trim(),kind:'trip',tripDay:o.defaultTripDay}),u('')}})]})]})},Object.defineProperty(_e,"resetOrderLists",{enumerable:!0,get:function(){return B}}),_e.ClockAreaSettings=function({rid:e,me:c}){(0,g.useClockArea)(t=>t.areas[e]);const u=(0,g.areaOf)(e);const h=g.useClockArea.getState(),p=(0,s.privateClockVenue)(e),[f,j]=(0,n.useState)(null==u.lat?'':String(u.lat)),[y,w]=(0,n.useState)(null==u.lng?'':String(u.lng)),[v,S]=(0,n.useState)(!1),[I,C]=(0,n.useState)(''),[L,D]=(0,n.useState)(u.breakOptions.join(', ')),R=(t,s)=>{const n=Number(t),o=Number(s);t.trim()||s.trim()?Number.isFinite(n)&&Number.isFinite(o)&&Math.abs(n)<=90&&Math.abs(o)<=180&&h.set(e,{lat:n,lng:o},c):h.set(e,{lat:null,lng:null},c)},B=async()=>{if(p)return;S(!0),C('');const t=await(0,b.getFix)();if(S(!1),'object'!=typeof t)return void C('denied'===t?'Location is blocked for this app. Allow it in your browser or phone settings.':'Couldn\u2019t get your location. Try again outside or near a window.');const s=t.lat.toFixed(6),n=t.lng.toFixed(6);j(s),w(n),h.set(e,{lat:Number(s),lng:Number(n)},c),C(`Centre set to where you are (accurate to about ${Math.round(t.acc)} m).`)},P=(0,x.areaSet)(u);return(0,k.jsxs)(a.default,{style:{gap:10},testID:"clock-area-settings",children:[(0,k.jsx)(r.Muted,{size:13,children:p?'The address-matched pub centre is configured below. Only clock-in checks location; only pass/fail is saved. No background, clock-out or break checks. Change the radius or centre here; use a manager override for a refused check.':'Tip: stand in the middle of the venue and tap \u201cUse my current location\u201d. Clocking in, out and breaks then only work within the distance below. Rota and pay screens are never blocked.'}),P?null:(0,k.jsx)(r.Banner,{kind:"warn",title:"Clock-in area not set yet",children:"Until you set the centre, staff can clock in from anywhere."}),p?(0,k.jsx)(r.Muted,{children:"Clock-in at the pub is required. A manager can record an exception with a reason."}):(0,k.jsx)(r.Toggle,{testID:"clock-area-on",label:"Check people are at the venue",value:u.on,onChange:t=>h.set(e,{on:t},c)}),p?null:(0,k.jsx)(r.Button,{testID:"clock-area-here",label:v?'Finding you\u2026':'\ud83d\udccd Use my current location',disabled:v,onPress:()=>{B()}}),I?(0,k.jsx)(r.Muted,{size:13,children:I}):null,(0,k.jsxs)(r.Row,{wrap:!0,gap:8,children:[(0,k.jsxs)(a.default,{style:{gap:2},children:[(0,k.jsx)(r.Muted,{size:12,children:"Latitude"}),(0,k.jsx)(t.TextInput,{accessibilityLabel:"Latitude",testID:"clock-area-lat",value:f,onChangeText:j,onBlur:()=>R(f,y),placeholder:"55.40\u2026",placeholderTextColor:d.colours.muted,style:{...T,width:130}})]}),(0,k.jsxs)(a.default,{style:{gap:2},children:[(0,k.jsx)(r.Muted,{size:12,children:"Longitude"}),(0,k.jsx)(t.TextInput,{accessibilityLabel:"Longitude",testID:"clock-area-lng",value:y,onChangeText:w,onBlur:()=>R(f,y),placeholder:"-4.75\u2026",placeholderTextColor:d.colours.muted,style:{...T,width:130}})]})]}),P?(0,k.jsx)(l.default,{accessibilityRole:"link",testID:"clock-area-map",onPress:()=>{o.default.openURL(`https://www.openstreetmap.org/?mlat=${u.lat}&mlon=${u.lng}#map=18/${u.lat}/${u.lng}`)},children:(0,k.jsx)(r.T,{size:13,colour:d.colours.gold,children:"See the pin on a map \u203a"})}):null,(0,k.jsx)(r.T,{weight:"semibold",children:"How far from the centre"}),(0,k.jsxs)(r.Row,{gap:8,children:[(0,k.jsx)(r.Button,{small:!0,kind:"secondary",label:"\u2212",onPress:()=>h.set(e,{radius:(0,x.clampRadius)(u.radius-10)},c)}),(0,k.jsxs)(r.T,{weight:"semibold",style:{minWidth:70,textAlign:'center'},children:[u.radius," m"]}),(0,k.jsx)(r.Button,{small:!0,kind:"secondary",label:"+",onPress:()=>h.set(e,{radius:(0,x.clampRadius)(u.radius+10)},c)})]}),(0,k.jsxs)(r.Muted,{size:12,children:["At least ",x.MIN_RADIUS," m. Phones aren\u2019t exact, so up to 50 m of the phone\u2019s own accuracy is added on top."]}),(0,k.jsx)(r.T,{weight:"semibold",children:"Forgotten break: lengths to offer at clock-out"}),(0,k.jsx)(t.TextInput,{accessibilityLabel:"Break lengths in minutes",testID:"clock-break-options",value:L,onChangeText:D,onBlur:()=>{const t=L.split(/[ ,]+/).map(Number).filter(e=>Number.isFinite(e)&&e>0&&e<=180);t.length&&h.set(e,{breakOptions:[...new Set(t)].sort((e,t)=>e-t)},c),D((0,g.areaOf)(e).breakOptions.join(', '))},style:T}),(0,k.jsxs)(r.Muted,{size:12,children:["Minutes, e.g. 5, 10, 15, 20, 30, 45, 60. Shows as ",u.breakOptions.map(x.breakLabel).join(', ')," and \u201cNo break\u201d."]}),p?(0,k.jsx)(r.Muted,{children:"No automatic arrival checks: staff location is used only at clock-in."}):(0,k.jsxs)(k.Fragment,{children:[" ",(0,k.jsx)(r.T,{weight:"semibold",children:"Not on the rota"}),(0,k.jsx)(r.Toggle,{testID:"clock-offrota-on",label:"Ask people at the venue who aren\u2019t on the rota if they want to clock in",value:u.offRotaPrompt,onChange:t=>h.set(e,{offRotaPrompt:t},c)}),(0,k.jsx)(t.TextInput,{accessibilityLabel:"Off-rota question",testID:"clock-offrota-title",value:u.offRotaTitle,onChangeText:t=>h.set(e,{offRotaTitle:t||x.DEFAULT_CLOCK_AREA.offRotaTitle},c),style:T}),(0,k.jsx)(t.TextInput,{accessibilityLabel:"Off-rota second line",testID:"clock-offrota-body",value:u.offRotaBody,onChangeText:t=>h.set(e,{offRotaBody:t||x.DEFAULT_CLOCK_AREA.offRotaBody},c),style:T}),(0,k.jsx)(r.Muted,{size:12,children:"This only checks while the app is open (web apps can\u2019t watch location in the background; that would need a native app)."})]})]})},Object.defineProperty(_e,"resetClockArea",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"COOKSAFE_URL",{enumerable:!0,get:function(){return O}}),_e.FoodSafetyCard=function({children:e}){return(0,k.jsx)(r.Card,{children:(0,k.jsxs)(a.default,{testID:"food-safety",style:{gap:6},children:[(0,k.jsx)(r.T,{size:17,weight:"semibold",children:"Food safety"}),(0,k.jsxs)(r.T,{children:["Based on ",(0,k.jsx)(r.T,{weight:"bold",colour:d.colours.gold,children:"CookSafe"})," (Food Standards Scotland)"]}),(0,k.jsx)(r.Muted,{size:12,children:"CoverCharge is not endorsed by Food Standards Scotland."}),(0,k.jsx)(l.default,{accessibilityRole:"link",testID:"cooksafe-link",onPress:()=>{o.default.openURL(O)},children:(0,k.jsx)(r.T,{size:14,colour:d.colours.gold,children:"Open the CookSafe guidance \u203a"})}),(0,k.jsx)(r.Muted,{size:13,children:"Full logs coming in the next update."}),e]})})};var t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),o=e(_r(_d[3])),l=e(_r(_d[4])),a=e(_r(_d[5])),r=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),f=_r(_d[12]),g=_r(_d[13]),x=_r(_d[14]),b=_r(_d[15]),j=_r(_d[16]),y=_r(_d[17]),w=_r(_d[18]),k=_r(_d[19]);const T={minHeight:44,borderRadius:10,borderWidth:1,borderColor:d.colours.hairline,backgroundColor:d.colours.surface2,color:d.colours.text,paddingHorizontal:10,fontSize:15},v=[1,2,3,4,5,6,0],S=['on_shift','everyone','managers','head_chef','kitchen','foh'],I=e=>e.replace(' (example)',''),C={title:'',message:'',days:[3,4,5,6,0],time:'21:00',recipients:{staff:[],groups:[]},sendBy:{inApp:!0,push:!1}};function L({value:e,onChange:t}){const s=(0,h.useOwner)(e=>e.staff).filter(e=>e.active);return(0,k.jsxs)(a.default,{style:{gap:6},testID:"notif-recipients",children:[(0,k.jsx)(r.T,{weight:"semibold",children:"Who gets it"}),(0,k.jsx)(r.Muted,{size:12,children:"Tick people, or pick a group (groups follow the team as it changes)."}),(0,k.jsx)(r.Row,{wrap:!0,gap:6,children:S.map(s=>(0,k.jsx)(r.Chip,{testID:`notif-group-${s}`,label:u.NOTIF_GROUP_LABEL[s],selected:e.groups.includes(s),onPress:()=>t({...e,groups:e.groups.includes(s)?e.groups.filter(e=>e!==s):[...e.groups,s]})},s))}),(0,k.jsx)(r.Muted,{size:12,children:"Only people on shift when it goes, in:"}),(0,k.jsx)(r.Row,{wrap:!0,gap:6,children:Object.keys(u.SHIFT_FILTER_LABEL).map(s=>{const n=(e.onShiftIn??[]).includes(s);return(0,k.jsx)(r.Chip,{testID:`notif-onshift-${s}`,label:u.SHIFT_FILTER_LABEL[s],selected:n,onPress:()=>t({...e,onShiftIn:n?(e.onShiftIn??[]).filter(e=>e!==s):[...e.onShiftIn??[],s]})},s)})}),(0,k.jsx)(a.default,{style:{gap:2},children:s.map(s=>{const n=e.staff.includes(s.id);return(0,k.jsxs)(l.default,{testID:`notif-tick-${s.id}`,accessibilityRole:"checkbox",accessibilityState:{checked:n},onPress:()=>t({...e,staff:n?e.staff.filter(e=>e!==s.id):[...e.staff,s.id]}),style:{flexDirection:'row',alignItems:'center',gap:10,paddingVertical:6},children:[(0,k.jsx)(a.default,{style:{width:22,height:22,borderRadius:5,borderWidth:1.5,borderColor:d.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:n?'#2a2414':'transparent'},children:n?(0,k.jsx)(r.T,{size:14,colour:d.colours.gold,children:"\u2713"}):null}),(0,k.jsx)(r.T,{style:{flex:1},children:(0,h.staffLabel)({name:I(s.name),nickname:s.nickname})}),(0,k.jsx)(r.Muted,{size:12,children:'Head Chef'===s.level?'Head Chef':s.job})]},s.id)})}),(0,k.jsx)(r.Muted,{size:12,children:"If nobody above matches when it goes, send it to:"}),(0,k.jsxs)(r.Row,{wrap:!0,gap:6,children:[S.filter(e=>'on_shift'!==e).map(s=>{const n=e.fallback??{staff:[],groups:[]},o=n.groups.includes(s);return(0,k.jsx)(r.Chip,{testID:`notif-fallback-${s}`,label:u.NOTIF_GROUP_LABEL[s],selected:o,onPress:()=>{const l=o?n.groups.filter(e=>e!==s):[...n.groups,s];t({...e,fallback:l.length||n.staff.length?{...n,groups:l}:void 0})}},s)}),s.map(s=>{const n=e.fallback??{staff:[],groups:[]},o=n.staff.includes(s.id);return(0,k.jsx)(r.Chip,{testID:`notif-fallback-${s.id}`,label:I(s.name),selected:o,onPress:()=>{const l=o?n.staff.filter(e=>e!==s.id):[...n.staff,s.id];t({...e,fallback:l.length||n.groups.length?{...n,staff:l}:void 0})}},s.id)})]})]})}function D({init:e,onSave:s,onCancel:o}){const[l,c]=(0,n.useState)(e),[h,p]=(0,n.useState)(!!e.dayTimes&&Object.keys(e.dayTimes).length>0),f=(0,u.validateNotif)(l),g=e=>c(t=>({...t,...e}));return(0,k.jsxs)(a.default,{testID:"notif-editor",style:{gap:8,borderWidth:1,borderColor:d.colours.accentBorder,borderRadius:12,padding:10},children:[(0,k.jsx)(r.T,{weight:"semibold",children:"Title"}),(0,k.jsx)(t.TextInput,{accessibilityLabel:"Notification title",testID:"notif-title",value:l.title,onChangeText:e=>g({title:e}),maxLength:60,style:T}),(0,k.jsx)(r.T,{weight:"semibold",children:"Message"}),(0,k.jsx)(t.TextInput,{accessibilityLabel:"Notification message",testID:"notif-message",value:l.message,onChangeText:e=>g({message:e}),maxLength:160,style:T}),(0,k.jsx)(r.T,{weight:"semibold",children:"Days"}),(0,k.jsx)(r.Row,{wrap:!0,gap:6,children:v.map(e=>(0,k.jsx)(r.Chip,{testID:`notif-day-${e}`,label:u.NOTIF_DAY_NAMES[e],selected:l.days.includes(e),onPress:()=>g({days:l.days.includes(e)?l.days.filter(t=>t!==e):[...l.days,e]})},e))}),(0,k.jsxs)(r.Row,{gap:8,children:[(0,k.jsx)(r.T,{weight:"semibold",children:"Time (UK)"}),(0,k.jsx)(t.TextInput,{accessibilityLabel:"Time",testID:"notif-time",value:l.time,onChangeText:e=>g({time:e}),placeholder:"21:00",style:{...T,width:90,borderColor:(0,u.validHm)(l.time)?d.colours.hairline:d.colours.red}})]}),(0,k.jsx)(r.Toggle,{label:"A different time on some days",value:h,onChange:e=>{p(e),e||g({dayTimes:void 0})}}),h?(0,k.jsx)(r.Row,{wrap:!0,gap:8,children:v.filter(e=>l.days.includes(e)).map(e=>(0,k.jsxs)(r.Row,{gap:4,children:[(0,k.jsx)(r.T,{size:13,children:u.NOTIF_DAY_NAMES[e]}),(0,k.jsx)(t.TextInput,{accessibilityLabel:`${u.NOTIF_DAY_NAMES[e]} time`,testID:`notif-daytime-${e}`,value:l.dayTimes?.[String(e)]??'',placeholder:l.time,onChangeText:t=>{const s={...l.dayTimes??{}};t.trim()?s[String(e)]=t.trim():delete s[String(e)],g({dayTimes:s})},style:{...T,width:74}})]},e))}):null,(0,k.jsx)(L,{value:l.recipients,onChange:e=>g({recipients:e})}),(0,k.jsx)(r.T,{weight:"semibold",children:"Send by"}),(0,k.jsx)(r.Toggle,{testID:"notif-inapp",label:"In the app (gold slider, Done / Later)",value:l.sendBy.inApp,onChange:e=>g({sendBy:{...l.sendBy,inApp:e}})}),(0,k.jsx)(r.Toggle,{testID:"notif-push",label:"Phone notification (when phones are switched on)",value:l.sendBy.push,onChange:e=>g({sendBy:{...l.sendBy,push:e}})}),f?(0,k.jsx)(r.Muted,{size:13,children:f}):null,(0,k.jsxs)(r.Row,{gap:8,style:{justifyContent:'flex-end'},children:[(0,k.jsx)(r.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:o}),(0,k.jsx)(r.Button,{small:!0,testID:"notif-save",label:"Save",disabled:!!f,onPress:()=>s({...l,title:l.title.trim(),message:l.message.trim(),days:[...l.days].sort()})})]})]})}function R(){const[e,t]=(0,n.useState)(null),[s,o]=(0,n.useState)('');return(0,n.useEffect)(()=>{(0,y.pushState)().then(t)},[]),e&&'unsupported'!==e?(0,k.jsxs)(a.default,{testID:"push-button",style:{gap:4},children:[(0,k.jsx)(r.Button,{small:!0,kind:'on'===e?'ghost':'secondary',testID:"push-turn-on",label:'on'===e?'Phone notifications are on for this phone \xb7 Turn off':'\ud83d\udd14 Turn on phone notifications',onPress:()=>{('on'===e?(0,y.turnOffPush)():(0,y.turnOnPush)()).then(e=>{o(e.message),(0,y.pushState)().then(t)})}}),(0,k.jsx)(r.Muted,{size:12,children:s||('ios-home-screen'===e?'iPhone: add this app to your Home Screen first (iOS 16.4 or later).':'For this phone only. Each person turns it on on their own phone.')})]}):null}const B=e=>p.useOrderLists.getState().resetSettings(e);const P=(e,t)=>g.useClockArea.getState().reset(e,t),O='https://www.foodstandards.gov.scot/publications-and-research/publications/cooksafe-manual'},996,[874,1074,30,239,263,127,813,821,997,1216,854,1076,1218,1219,1160,1286,820,1122,1041,24]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"notifSeedId",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"headChefId",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"gmId",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"seedsFor",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"useNotifs",{enumerable:!0,get:function(){return v}});var e,t=r(d[0]),i=(e=t)&&e.__esModule?e:{default:e},s=r(d[1]),n=r(d[2]),o=r(d[3]),u=r(d[4]),p=r(d[5]),f=r(d[6]),c=r(d[7]);const l=(e,t)=>(0,o.uuidFrom)(`sched-notif:${t}:${e}`),S=()=>p.ROSTER.find(e=>'Head Chef'===e.level)?.id??p.ROSTER.find(e=>'chef'===e.app)?.id??'',b=()=>p.ROSTER.find(e=>'Manager'===e.level)?.id??'',h=e=>'anchorage'===e?(0,u.anchorageSeeds)(t=>l(e,t),S(),b()):[],O=()=>(new Date).toISOString(),v=(0,s.create)()((0,n.persist)((e,t)=>({items:[],snooze:{},ensure:i=>{const s=t().items,n=s.map(e=>(0,c.fixSupplierNames)(e.title)!==e.title||(0,c.fixSupplierNames)(e.message)!==e.message?{...e,title:(0,c.fixSupplierNames)(e.title),message:(0,c.fixSupplierNames)(e.message),updatedAt:O()}:e);n.some((e,t)=>e!==s[t])&&e({items:n});const o=new Set(t().items.map(e=>e.id)),u=h(i).filter(e=>!o.has(e.id)).map(e=>({...e,rid:i}));u.length&&e(e=>({items:[...e.items,...u]}))},add:(t,i)=>{const s=(0,f.uuid)();return e(e=>({items:[...e.items,{...i,id:s,rid:t,updatedAt:O()}]})),s},update:(t,i)=>e(e=>({items:e.items.map(e=>e.id===t?{...e,...i,updatedAt:O()}:e)})),remove:t=>e(e=>({items:e.items.flatMap(e=>e.id!==t?[e]:e.seed?[{...e,removed:!0,paused:!0,updatedAt:O()}]:[])})),resetSeeds:t=>{const i=new Map(h(t).map(e=>[e.id,e]));e(e=>{const s=e.items.map(e=>i.has(e.id)?{...i.get(e.id),rid:t,updatedAt:O()}:e),n=new Set(s.map(e=>e.id));return{items:[...s,...[...i.values()].filter(e=>!n.has(e.id)).map(e=>({...e,rid:t,updatedAt:O()}))]}})},setSnooze:(t,i)=>e(e=>({snooze:Object.fromEntries([...Object.entries(e.snooze).filter(([,e])=>e>Date.now()-864e5),[t,i]])}))}),{name:'covercharge-sched-notifs-v1',version:1,storage:(0,n.createJSONStorage)(()=>i.default)}))},997,[1024,1008,1025,1143,1216,14,1147,1217]); +__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DEFAULT_MIN_WEEKS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"clampWeeks",{enumerable:!0,get:function(){return o}}),e.buildHistory=function(o,a,c,u,d,f=n){const l=(0,t.ymd)(d),y=(0,t.ymd)(new Date(d.getTime()-48384e5)),h=t=>t>=y&&tt.rid===o&&h(t.date));for(const t of k)D.add(t.date);const T=[...D].sort(),w=T.length?s(T[0],l):0,j=w>=7*f&&T.length>=2*f,O=t=>{const n={},o={};for(const t of T){const n=new Date(t+'T12:00:00').getDay();o[n]=(o[n]??0)+1}for(const[o,s]of Object.entries(t)){const t=new Date(o+'T12:00:00').getDay();n[t]??={};for(const[o,a]of Object.entries(s))n[t][Number(o)]=(n[t][Number(o)]??0)+a}for(const t of Object.keys(n))for(const s of Object.keys(n[+t]))n[+t][+s]=n[+t][+s]/(o[+t]||1);return n},M=Array.from({length:7},()=>[]);for(const t of k)'number'==typeof t.takings&&t.takings>0&&M[new Date(t.date+'T12:00:00').getDay()].push(Math.round(100*t.takings));const N=M.map(t=>t.length?Math.round(t.reduce((t,n)=>t+n,0)/t.length):null),_=k.filter(t=>'number'==typeof t.takings&&t.takings>0),E=(_.length?s(_.map(t=>t.date).sort()[0],l):0)>=7*f&&_.length>=2*f;return{covers:O(b),takeaway:O(p),days:T.length,spanDays:w,enough:j,minWeeks:f,takingsByDay:N,cashUps:_.length,salesEnough:E}};var t=r(_d[0]);const n=2,o=t=>{const o=Math.round(Number(t));return Number.isFinite(o)&&o>=1&&o<=8?o:n},s=(t,n)=>Math.round((new Date(n+'T12:00:00').getTime()-new Date(t+'T12:00:00').getTime())/864e5)},998,[818]); +__d(function(g,r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEFAULT_SOLD_OUT",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"SOLD_OUT_CLEAR_LABEL",{enumerable:!0,get:function(){return t}}),_e.soldOutSettingsOf=function(t){const n='morning'===t?.clear||'manual'===t?.clear||'close'===t?.clear?t.clear:e.clear,o=/^([01]\d|2[0-3]):[0-5]\d$/.test(t?.morningAt??'')?t.morningAt:e.morningAt;return{clear:n,morningAt:o,auto:!1!==t?.auto}},_e.clearAfterFor=function(e,t,o){if('manual'===t.clear)return;const c=(()=>{const o=n(e,t.morningAt);return ee.getTime()?o:c},_e.activeSoldOut=function(e,t,n){const o=n.getTime();return e.filter(e=>e.rid===t&&e.on&&(!e.clearAfter||new Date(e.clearAfter).getTime()>o)).sort((e,t)=>t.at.localeCompare(e.at)||e.name.localeCompare(t.name))},_e.expiredSoldOut=function(e,t,n){const o=n.getTime();return e.filter(e=>e.rid===t&&e.on&&!!e.clearAfter&&new Date(e.clearAfter).getTime()<=o)},_e.stripText=o,_e.stripNeedsTicker=function(e,t,n){return o(e).length*n*.56>Math.max(0,t-150)},_e.soldOutCount=function(e){return 1===e?'1 dish sold out':`${e} dishes sold out`};const e={clear:'close',morningAt:'05:00',auto:!0},t={close:'When the kitchen closes',morning:'Next morning',manual:'Only when someone taps Back on'};const n=(e,t,n=0)=>{const[o,c]=t.split(':').map(Number);return new Date(e.getFullYear(),e.getMonth(),e.getDate()+n,o,c,0,0)};function o(e){return e.join(' \xb7 ')}},999,[]); +__d(function(g,r,i,a,m,_e,d){const t=r(d[0]),n=r(d[1]),e=r(d[2]),o=r(d[3]);function c(e,o,c,l,u){const f=[].slice.call(arguments,1),s=f.length,v='function'==typeof f[s-1];if(!v&&!t())throw new Error('Callback required as last argument');if(!v){if(s<1)throw new Error('Too few arguments provided');return 1===s?(c=o,o=l=void 0):2!==s||o.getContext||(l=c,c=o,o=void 0),new Promise(function(t,u){try{const u=n.create(c,l);t(e(u,o,l))}catch(t){u(t)}})}if(s<2)throw new Error('Too few arguments provided');2===s?(u=c,c=o,o=l=void 0):3===s&&(o.getContext&&void 0===u?(u=l,l=void 0):(u=l,l=c,c=o,o=void 0));try{const t=n.create(c,l);u(null,e(t,o,l))}catch(t){u(t)}}_e.create=n.create,_e.toCanvas=c.bind(null,e.render),_e.toDataURL=c.bind(null,e.renderToDataURL),_e.toString=c.bind(null,function(t,n,e){return o.render(t,e)})},1000,[1380,1381,1404,1406]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"GIFT_QR_TEXT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"GIFT_QR_MAX",{enumerable:!0,get:function(){return n}}),e.giftQrUrlOk=o,Object.defineProperty(e,"giftQrShown",{enumerable:!0,get:function(){return u}});const t='Scan to buy a gift card on your phone',n=300;function o(t){const o=(t??'').trim();return!(!o||o.length>n||/\s/.test(o))&&/^https:\/\/[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)+(:\d+)?(\/[^\s]*)?$/i.test(o)}const u=t=>!!t?.giftQrOn&&o(t?.giftQrUrl)},1001,[]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"STEP",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"addDays",{enumerable:!0,get:function(){return u}}),_e.fmt12=i,_e.rangeText=c,_e.openWindow=function(r,o){const a=(0,e.kitchenHoursOn)(r,(0,t.parseYmd)(o));if(!a)return null;let s=(0,t.toMins)(a[1]);for(const e of(0,n.regularEventsOf)(r))(0,n.occursOn)(e,o)&&e.time&&(s=Math.max(s,Math.min(1425,(0,t.toMins)(e.time)+180)));return{from:(0,t.toMins)(a[0]),to:s}},_e.servicesOn=l,_e.serviceOf=function(e,n,r,o){const a=l(e,n,o),s=(0,t.toMins)(r);return a.lunch&&s>=a.lunch.from&&s=a.dinner.from&&s=a.dinner.to?'dinner':a.lunch&&s=e?n:e);if('none'===r.kind||!o||o=h)break}return s},_e.repeatText=function(e,t){if('none'===e.kind)return;const n=t?` until ${p(t)}`:'';return'weekly'===e.kind?`Every ${[...e.days].sort().map(e=>a[e]).join(', ')}${n}`:`Last ${o[e.weekday]} of the month${n}`},Object.defineProperty(_e,"longDate",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"monthLabel",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"scopeText",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"whatText",{enumerable:!0,get:function(){return M}}),_e.confirmLine=function(e){const t=e.dates.length?1===e.dates.length?e.dates[0]===e.today?'today':p(e.dates[0]):e.repeat?`on ${e.dates.length} dates (${e.repeat})`:`${p(e.dates[0])} to ${p(e.dates[e.dates.length-1])}`:'no dates';return`Block ${c(e.from,e.to,e.wholeDay)} ${t}, ${y(e)}`},_e.bookingsInWindow=function(e,n,r,o,a,s){const u=new Set(n),i=(0,t.toMins)(r),c=(0,t.toMins)(o);return e.filter(e=>{if(!u.has(e.date)||!['confirmed','pending','seated'].includes(e.status))return!1;const n=(0,t.toMins)(e.time);if(n=c)return!1;const r=(e.table??'').split(/[^A-Za-z0-9]+/).filter(Boolean);return a.tables?.length?r.some(e=>a.tables.includes(e)):!a.areaId||r.some(e=>s?.(e)===a.areaId)})},_e.groupByMonth=function(e,n,r,o){const a=e.filter(e=>e.rid===n&&!e.removedAt&&(e.date>r||e.date===r&&(0,t.toMins)(e.to)>(0,t.toMins)(o))).sort((e,n)=>e.date===n.date?(0,t.toMins)(e.from)-(0,t.toMins)(n.from):e.date{const r=(0,t.parseYmd)(e);return r.setDate(r.getDate()+n),(0,t.ymd)(r)};function i(e){const n=(0,t.toMins)(e),r=Math.floor(n/60)%24;return`${r%12==0?12:r%12}:${String(n%60).padStart(2,'0')}${r<12?'am':'pm'}`}function c(e,t,n){if(n)return'all day';const r=i(e),o=i(t);return r.slice(-2)===o.slice(-2)?`${r.slice(0,-2)}\u2013${o}`:`${r}\u2013${o}`}function l(n,r,o){const a=(0,e.kitchenHoursOn)(n,(0,t.parseYmd)(r));if(!a)return{lunch:null,dinner:null};const s=(0,t.toMins)(a[0]),u=(0,t.toMins)(a[1]),i=1020,c=(e,n)=>{if(!e)return n;const r=Math.max(s,(0,t.toMins)(e[0])),o=Math.min(u,(0,t.toMins)(e[1]));return o>r?{from:r,to:o}:null};return{lunch:c(o?.lunch,si?{from:Math.max(i,s),to:u}:null)}}const d=e=>Math.ceil(e/r)*r;function f(e,t){const n=[];let r=e;for(;r<=t&&n.length<366;)n.push(r),r=u(r,1);return n}const m=(e,n)=>{const r=(0,t.parseYmd)(e);if(r.getDay()!==n)return!1;const o=new Date(r);return o.setDate(r.getDate()+7),o.getMonth()!==r.getMonth()},h=104;const p=e=>{const n=(0,t.parseYmd)(e);return`${o[n.getDay()]} ${n.getDate()} ${s[n.getMonth()]}`},g=e=>{const n=(0,t.parseYmd)(e);return`${s[n.getMonth()]} ${n.getFullYear()}`},y=e=>e.tables?.length?`table${e.tables.length>1?'s':''} ${e.tables.join(', ')}`:e.areaId?e.areaName??'one area':'all areas',M=e=>{const t=y(e);return t.charAt(0).toUpperCase()+t.slice(1)}},1002,[815,818,809]); +__d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEFAULT_LOYALTY",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"consentText",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"prettyCardNo",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"cleanCode",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"cardQr",{enumerable:!0,get:function(){return s}}),_e.readCardQr=function(e){const r=/^covercharge:card:[^:]+:([A-Za-z0-9-]{8,9})$/.exec(e.trim());return r?n(r[1]):null},Object.defineProperty(_e,"codeQr",{enumerable:!0,get:function(){return o}}),_e.checkSettings=function(e){return!Number.isInteger(e.stampsNeeded)||e.stampsNeeded<2||e.stampsNeeded>30?'Stamps needed must be between 2 and 30.':e.reward.trim()?e.reward.length>80?'Keep the reward under 80 letters.':e.gapMinutes<0||e.gapMinutes>1440?'Time between stamps must be 0 to 24 hours.':e.maxPerDay<1||e.maxPerDay>10?'Stamps a day must be 1 to 10.':!Number.isInteger(e.stampExpiryDays)||e.stampExpiryDays<0||e.stampExpiryDays>1095?'Stamps last 0 (never run out) to 1095 days.':!Number.isInteger(e.rewardExpiryDays)||e.rewardExpiryDays<0||e.rewardExpiryDays>1095?'Rewards last 0 (never run out) to 1095 days.':!e.referralOn||e.referralGiver.trim()&&e.referralFriend.trim()?e.referralMonthlyCap<0||e.referralMonthlyCap>50?'Friend rewards a month must be 0 to 50.':null:'Say what both people get before you switch Bring a friend on.':'Say what the reward is, for example Free dessert.'},_e.checkOffer=function(e){if(!e.title.trim())return'Give the offer a title.';if(e.title.length>80)return'Keep the title under 80 letters.';if(e.details.length>500)return'Keep the details under 500 letters.';const r=/^\d{4}-\d{2}-\d{2}$/;return e.startsOn&&!r.test(e.startsOn)?'Start date should look like 2026-11-30.':e.endsOn&&!r.test(e.endsOn)?'End date should look like 2026-11-30.':e.startsOn&&e.endsOn&&e.endsOn`I agree to ${e} keeping my name and the phone or email I give, only to run my stamp card and offers here. I can leave at any time and my details are removed.`,t=e=>e&&8===e.length?`${e.slice(0,4)}-${e.slice(4)}`:e,n=e=>e.toUpperCase().replace(/[^A-Z0-9]/g,''),s=(e,r)=>`covercharge:card:${e}:${r}`;const o=(e,r,t)=>`${e.replace(/\/$/,'')}/customer/${r}/loyalty?code=${t}`;const l=(e,r)=>e.isOn&&(!e.startsOn||e.startsOn<=r)&&(!e.endsOn||e.endsOn>=r),p=r=>r?{saved:!!r.updated_by,cardOn:!!r.card_on,stampsNeeded:r.stamps_needed??8,reward:r.reward??'',stampExpiryDays:r.stamp_expiry_days??0,rewardExpiryDays:r.reward_expiry_days??0,gapMinutes:r.gap_minutes??60,maxPerDay:r.max_per_day??1,referralOn:!!r.referral_on,referralGiver:r.referral_giver??'',referralFriend:r.referral_friend??'',referralMonthlyCap:r.referral_monthly_cap??5}:{...e},u=e=>({card_on:e.cardOn,stamps_needed:e.stampsNeeded,reward:e.reward.trim(),stamp_expiry_days:e.stampExpiryDays,reward_expiry_days:e.rewardExpiryDays,gap_minutes:e.gapMinutes,max_per_day:e.maxPerDay,referral_on:e.referralOn,referral_giver:e.referralGiver.trim(),referral_friend:e.referralFriend.trim(),referral_monthly_cap:e.referralMonthlyCap}),y=e=>({id:String(e.id),title:e.title??'',details:e.details??'',startsOn:e.starts_on??null,endsOn:e.ends_on??null,isOn:!1!==e.is_on})},1003,[]); +__d(function(_g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"GRID_SIZES",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"DEFAULT_GRID",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"GUIDE_PULL",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"snapTo",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"gridOf",{enumerable:!0,get:function(){return o}}),_e.snapMove=function(e,n,o,x,y){const c=y.pull??r,f=(n,r)=>({x:(0,t.clamp)(Math.round(n),0,t.PLAN_W-e.w),y:(0,t.clamp)(Math.round(r),0,t.PLAN_H-e.h)});if(y.free){return{...f(n,o),guides:[],spacing:[]}}let h=y.snap?s(n,y.grid):n,u=y.snap?s(o,y.grid):o;const d=x.filter(t=>t.id!==e.id),l=t=>{const r='x'===t?n:o,s='x'===t?e.w:e.h;let a=null;for(const e of d){const n='x'===t?e.x:e.y,o='x'===t?e.w:e.h,i=[[n,'edge'],[n+o-s,'edge'],[n+o/2-s/2,'centre'],[n-s,'edge'],[n+o,'edge']];for(const[t,e]of i){const n=Math.abs(r-t);n<=c&&(!a||nt.areaId===r);if(!a.length)return e;const i=(e.fixtures??[]).filter(t=>t.areaId===r).map(t=>({id:t.id,x:t.x,y:t.y,w:t.w,h:t.h})),c=new Map,f=(e,n)=>(0,t.clamp)(n,0,t.PLAN_W-e.w),h=(e,n)=>(0,t.clamp)(n,0,t.PLAN_H-e.h);for(const t of y(a)){const e=t.reduce((t,e)=>t+e.y+e.h/2,0)/t.length,n=s(e,o),r=t.map(t=>t.h),a=t.map(t=>t.y).sort((t,e)=>t-e),i=s(a[Math.floor(a.length/2)],o),y=Math.max(...r)-Math.min(...r)<=2*o,u=t=>h(t,y?i:Math.round(n-t.h/2)),d=t.map(t=>({...t,x:f(t,s(t.x,o)),y:u(t)}));let l=d;if(t.length>=3){const e=d[0],n=d[d.length-1],r=d.reduce((t,e)=>t+e.w,0),a=(n.x+n.w-e.x-r)/(t.length-1);if(a>=0){let t=e.x;l=d.map(e=>{const n={...e,x:f(e,s(t,5))};return t+=e.w+a,n}),l.some((t,e)=>Math.abs(t.x-d[e].x)>2*o)&&(l=d)}}const g=t=>t.some((e,n)=>t.some((t,r)=>nc.set(t.id,{x:t.x,y:t.y}))}let u=a.map(t=>({...t,...c.get(t.id)??{}}));for(let t=0;t<5;t++){let t=!1;if(u=u.map((e,n)=>{const r=a[n];if(e.x===r.x&&e.y===r.y)return e;return u.some((t,s)=>s!==n&&x(e,t)&&!x(r,a[s]))||i.some(t=>x(e,t)&&!x(r,t))?(t=!0,r):e}),!t)break}const d=new Map(u.map(t=>[t.id,t]));return{...e,tables:e.tables.map(t=>{const e=d.get(t.id);return e?{...t,x:e.x,y:e.y}:t})}},Object.defineProperty(_e,"backupOf",{enumerable:!0,get:function(){return c}}),_e.restoreFrom=function(t,e){return{...t,tables:t.tables.map(t=>{const n=e.tables.find(e=>e.id===t.id)??e.tables.find(e=>e.name===t.name);return n?{...t,x:n.x,y:n.y}:t})}},Object.defineProperty(_e,"movedCount",{enumerable:!0,get:function(){return f}}),_e.onlyPositionsChanged=function(t,e){if(t.tables.length!==e.tables.length)return!1;const n=t=>JSON.stringify({...t,x:0,y:0});return t.tables.every((t,r)=>n(t)===n(e.tables[r]))&&JSON.stringify(t.areas)===JSON.stringify(e.areas)&&JSON.stringify(t.joins)===JSON.stringify(e.joins)&&JSON.stringify(t.sections)===JSON.stringify(e.sections)&&JSON.stringify(t.fixtures??[])===JSON.stringify(e.fixtures??[])};var t=_r(_d[0]);const e=[10,25,50],n=25,r=8,s=(t,e)=>Math.round(t/e)*e,o=t=>e.includes(t)?t:n;function a(t,e){const n=[],r=t=>{if(n.some(e=>e.axis===t.axis&&e.at===t.at)){const e=n.find(e=>e.axis===t.axis&&e.at===t.at);e.from=Math.min(e.from,t.from),e.to=Math.max(e.to,t.to)}else n.push(t)};for(const n of e){const e=[[t.x,n.x,'edge'],[t.x+t.w,n.x+n.w,'edge'],[t.x,n.x+n.w,'edge'],[t.x+t.w,n.x,'edge'],[t.x+t.w/2,n.x+n.w/2,'centre']];for(const[s,o,a]of e)Math.abs(s-o)<.5&&r({axis:'x',at:s,from:Math.min(t.y,n.y),to:Math.max(t.y+t.h,n.y+n.h),kind:a});const s=[[t.y,n.y,'edge'],[t.y+t.h,n.y+n.h,'edge'],[t.y,n.y+n.h,'edge'],[t.y+t.h,n.y,'edge'],[t.y+t.h/2,n.y+n.h/2,'centre']];for(const[e,o,a]of s)Math.abs(e-o)<.5&&r({axis:'y',at:e,from:Math.min(t.x,n.x),to:Math.max(t.x+t.w,n.x+n.w),kind:a})}return n}function i(t,e){const n=[],r=e=>e.yt.y,s=e=>e.xt.x,o=e.filter(e=>r(e)&&e.x+e.w<=t.x).sort((t,e)=>e.x+e.w-(t.x+t.w))[0],a=e.filter(e=>r(e)&&e.x>=t.x+t.w).sort((t,e)=>t.x-e.x)[0];if(o&&a){const e=t.x-(o.x+o.w),r=a.x-(t.x+t.w);e>0&&Math.abs(e-r)<=2&&n.push({axis:'x',gap:Math.round(e),spans:[[o.x+o.w,t.x],[t.x+t.w,a.x]],cross:t.y+t.h/2})}const i=e.filter(e=>s(e)&&e.y+e.h<=t.y).sort((t,e)=>e.y+e.h-(t.y+t.h))[0],x=e.filter(e=>s(e)&&e.y>=t.y+t.h).sort((t,e)=>t.y-e.y)[0];if(i&&x){const e=t.y-(i.y+i.h),r=x.y-(t.y+t.h);e>0&&Math.abs(e-r)<=2&&n.push({axis:'y',gap:Math.round(e),spans:[[i.y+i.h,t.y],[t.y+t.h,x.y]],cross:t.x+t.w/2})}return n}const x=(t,e)=>t.xe.x&&t.ye.y;function y(t){const e=[...t].sort((t,e)=>t.y+t.h/2-(e.y+e.h/2)),n=[];for(const t of e){const e=t.y+t.h/2,r=n[n.length-1];if(r){const n=r.reduce((t,e)=>t+e.y+e.h/2,0)/r.length,s=Math.max(12,Math.min(t.h,...r.map(t=>t.h))/2);if(Math.abs(e-n)<=s){r.push(t);continue}}n.push([t])}return n.map(t=>t.sort((t,e)=>t.x-e.x))}const c=(t,e,n,r)=>({at:e,by:n,note:r,tables:t.tables.map(t=>({id:t.id,name:t.name,x:t.x,y:t.y}))});const f=(t,e)=>t.tables.filter(t=>{const n=e.tables.find(e=>e.id===t.id);return n&&(n.x!==t.x||n.y!==t.y)}).length},1004,[1022]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return n.default}});var e=r(d[0]);Object.keys(e).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(_e,t)||Object.defineProperty(_e,t,{enumerable:!0,get:function(){return e[t]}})});var t,n=(t=e)&&t.__esModule?t:{default:t}},1005,[1325]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.getCameraPermissionsAsync=l,_e.getMediaLibraryPermissionsAsync=y,_e.requestCameraPermissionsAsync=f,_e.requestMediaLibraryPermissionsAsync=b,Object.defineProperty(_e,"useMediaLibraryPermissions",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"useCameraPermissions",{enumerable:!0,get:function(){return w}}),_e.getPendingResultAsync=async function(){if(s.default.getPendingResultAsync)return s.default.getPendingResultAsync();return null},_e.launchCameraAsync=async function(e={}){if(!s.default.launchCameraAsync)throw new n.UnavailabilityError('ImagePicker','launchCameraAsync');const t=(0,o.mapDeprecatedOptions)(e);return await s.default.launchCameraAsync(c(t))},_e.launchImageLibraryAsync=async function(e={}){const t=(0,o.mapDeprecatedOptions)(e);if(!s.default.launchImageLibraryAsync)throw new n.UnavailabilityError('ImagePicker','launchImageLibraryAsync');t?.allowsEditing&&t.allowsMultipleSelection&&console.warn("[expo-image-picker] `allowsEditing` is not supported when `allowsMultipleSelection` is enabled and will be ignored.Disable either 'allowsEditing' or 'allowsMultipleSelection' in 'launchImageLibraryAsync' to fix this warning.");return await s.default.launchImageLibraryAsync(t)},Object.defineProperty(_e,"PermissionStatus",{enumerable:!0,get:function(){return n.PermissionStatus}});var e,n=r(d[0]),t=r(d[1]),s=(e=t)&&e.__esModule?e:{default:e},o=r(d[2]),u=r(d[3]);function c(e){const{aspect:t,quality:s,videoMaxDuration:o}=e;if(null!=t){const[e,s]=t;if(e<=0||s<=0)throw new n.CodedError('ERR_INVALID_ARGUMENT',`Invalid aspect ratio values ${e}:${s}. Provide positive numbers.`)}if(s&&(s<0||s>1))throw new n.CodedError('ERR_INVALID_ARGUMENT',`Invalid 'quality' value ${s}. Provide a value between 0 and 1.`);if(o&&o<0)throw new n.CodedError('ERR_INVALID_ARGUMENT',`Invalid 'videoMaxDuration' value ${o}. Provide a non-negative number.`);return e}async function l(){return s.default.getCameraPermissionsAsync()}async function y(e=!1){return s.default.getMediaLibraryPermissionsAsync(e)}async function f(){return s.default.requestCameraPermissionsAsync()}async function b(e=!1){return(0,s.default.requestMediaLibraryPermissionsAsync)(e)}Object.keys(u).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return u[e]}})});const P=(0,n.createPermissionHook)({getMethod:e=>y(e?.writeOnly),requestMethod:e=>b(e?.writeOnly)}),w=(0,n.createPermissionHook)({getMethod:l,requestMethod:f})},1006,[570,1294,1296,1295]); +__d(function(_g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"SETUP_STEPS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"ACCESS_LEVELS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"ACCESS_ROLE",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"ACCESS_APP",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"accessOf",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"PERMS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"DEFAULT_PERMS",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"DEFAULT_GRADES",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"useSetup",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"useSiteSetup",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"setupProgress",{enumerable:!0,get:function(){return w}});var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},i=r(d[1]),s=r(d[2]);const o=[{id:'venue',title:'Venue details & logo',sub:'Name, address, phone, your logo and order at table'},{id:'hours',title:'Opening hours',sub:'When the kitchen is open each day'},{id:'plan',title:'Areas & table plan',sub:'Your areas, tables and seats'},{id:'paygrades',title:'Pay grades',sub:'Named hourly rates for your team'},{id:'staff',title:'Add staff',sub:'Name, role, access, pay and avatar'},{id:'permissions',title:'Permissions',sub:'What each access level can do'},{id:'email',title:'Link email',sub:'Your work email address'},{id:'website',title:'Link website',sub:'Your website and booking link'},{id:'invites',title:'Staff invite links',sub:'Personal links for each person'}],l=['Owner','Manager','Supervisor','Head Chef','Staff'],u={Owner:'owner',Manager:'manager',Supervisor:'manager','Head Chef':'staff',Staff:'staff'},c={Owner:'Managers',Manager:'Managers',Supervisor:'Managers','Head Chef':'Head Chef',Staff:'Staff'},f=(e,t)=>l.includes(e??'')?e:'owner'===t?'Owner':'manager'===t?'Manager':'Staff',b=[{id:'bookings',label:'Take and change bookings'},{id:'walkins',label:'Seat walk-ins'},{id:'block',label:'Block bookings and close the garden'},{id:'tableplan',label:'Edit the table plan'},{id:'kitchen',label:'Kitchen tickets and allergy ticks'},{id:'menu',label:'Edit the menu and allergens'},{id:'rota',label:'Make the rota'},{id:'timesheets',label:'Approve timesheets'},{id:'pay',label:'See pay and wages'},{id:'takings',label:'See takings and reports'},{id:'staff',label:'Add staff and change access'},{id:'settings',label:'Change venue settings'},{id:'billing',label:'Plan and billing'}],p=e=>Object.fromEntries(b.map(t=>[t.id,e])),g=e=>({...p(!1),...Object.fromEntries(e.map(e=>[e,!0]))}),h={Owner:p(!0),Manager:{...p(!0),staff:!1,billing:!1},Supervisor:g(['bookings','walkins','block','tableplan','kitchen','rota']),'Head Chef':g(['kitchen','menu','rota']),Staff:g(['bookings','walkins'])},S=[{id:'pg-foh',name:'Front of house',pence:1271},{id:'pg-bar',name:'Bar team',pence:1271},{id:'pg-kp',name:'Kitchen porter',pence:1271},{id:'pg-cdp',name:'Chef de partie',pence:1450},{id:'pg-sup',name:'Supervisor',pence:1400}],k=()=>({done:{},grades:S.map(e=>({...e})),staffGrade:{},perms:JSON.parse(JSON.stringify(h)),email:'',website:'',bookingUrl:'',invites:{}}),O=(0,i.create)()((0,s.persist)((e,t)=>({sites:{},looks:{},patch:(t,n)=>e(e=>({sites:{...e.sites,[t]:{...e.sites[t]??k(),...n}}})),markDone:(e,n,i=!0)=>{const s={...(t().sites[e]??k()).done};i?s[n]=(new Date).toISOString():delete s[n],t().patch(e,{done:s})},setPerm:(e,n,i,s)=>{const o=t().sites[e]??k();'Owner'!==n&&t().patch(e,{perms:{...o.perms,[n]:{...o.perms[n],[i]:s}}})},resetPerms:e=>t().patch(e,{perms:JSON.parse(JSON.stringify(h))}),setLook:(t,n)=>e(e=>{const i={...e.looks};return null==n?delete i[t]:i[t]=n,{looks:i}})}),{name:'covercharge-setup-v1',storage:(0,s.createJSONStorage)(()=>n.default),version:1})),P=e=>O(t=>t.sites[e])??y,y=k(),w=e=>{const t=o.filter(t=>e.done[t.id]).length;return{done:t,total:o.length,pct:t/o.length}}},1007,[1024,1008,1025]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0});var t=r(d[0]);Object.keys(t).forEach(function(n){'default'===n||Object.prototype.hasOwnProperty.call(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[n]}})});var n=r(d[1]);Object.keys(n).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})})},1008,[1132,1133]); +__d(function(g,r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useOrdersDue=C,Object.defineProperty(_e,"supplierForCat",{enumerable:!0,get:function(){return S}}),_e.Suppliers=function(){const{now:e,today:o,role:S,me:O}=(0,x.useCtx)(6e4),M='owner'===S,P='staff'!==S,$=(0,c.useOwner)(e=>e.suppliers),R=(0,c.useOwner)(e=>e.supplierOrders),k=(0,c.useOwner)(e=>e.staffCanViewSuppliers),[B,D]=(0,l.useState)(''),[F,L]=(0,l.useState)('all'),[A,N]=(0,l.useState)(!1),[I,_]=(0,l.useState)(null),[E,z]=(0,l.useState)(null);(0,n.useBackLayer)(!!I,()=>_(null));const[H,U]=(0,l.useState)(null),V=C();if('staff'===S&&!k)return(0,j.jsx)(u.Banner,{kind:"info",title:"Suppliers are hidden",children:"The owner hasn\u2019t turned on supplier access for staff."});const W=$.filter(e=>e.archived===A&&('all'===F||('fav'===F?e.fav:e.category===F))&&(!B.trim()||`${e.name} ${e.category} ${e.contact} ${e.notes}`.toLowerCase().includes(B.trim().toLowerCase()))).sort((e,s)=>Number(s.fav)-Number(e.fav)||e.name.localeCompare(s.name)),Y=$.find(e=>e.id===I),q=e=>c.useOwner.getState().saveSupplier(e),G=e=>e.length?e.map(e=>x.DAY3[e]).join(', '):'\u2013';if(Y){const s=R.filter(e=>e.supplierId===Y.id);return(0,j.jsxs)(d.default,{style:{gap:10},children:[(0,j.jsx)(n.BackButton,{onPress:()=>_(null),testID:"supplier-back"}),(0,j.jsxs)(u.Card,{children:[(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(u.T,{size:18,weight:"bold",style:{flex:1},children:Y.name}),(0,j.jsx)(i.default,{accessibilityRole:"button",accessibilityLabel:Y.fav?'Unfavourite':'Favourite',disabled:!P,onPress:()=>q({...Y,fav:!Y.fav}),children:(0,j.jsx)(u.T,{size:22,colour:m.colours.gold,children:Y.fav?'\u2605':'\u2606'})})]}),(0,j.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(u.Badge,{kind:"gold",label:Y.category}),Y.archived?(0,j.jsx)(u.Badge,{kind:"neutral",label:"Archived"}):null]}),(0,t.isLiveVenue)()?null:(0,j.jsx)(u.Muted,{children:"Saved on this device only (not connected to your venue)."}),[['Contact',Y.contact],['Account no.',Y.account],['Order cut-off',Y.cutoff?`${Y.cutoff} on ${G(Y.orderDays)}`:'Call when needed'],['Delivery days',G(Y.deliveryDays)],['Minimum order',Y.minOrder?(0,h.gbp)(Y.minOrder):'None'],['Payment terms',Y.terms||'\u2013']].map(([e,s])=>(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(u.Muted,{children:e}),(0,j.jsx)(u.T,{size:14,style:{flex:1,textAlign:'right'},children:s})]},e)),Y.notes?(0,j.jsxs)(u.T,{size:14,children:["\ud83d\udd8b\ufe0f ",Y.notes]}):null]}),(0,j.jsxs)(u.Row,{wrap:!0,gap:6,children:[Y.phones.filter(Boolean).map(e=>(0,j.jsx)(u.Button,{small:!0,label:`\ud83d\udcde Call ${e}`,onPress:()=>v(w(e))},e)),Y.email?(0,j.jsx)(u.Button,{small:!0,kind:"secondary",label:"\u2709\ufe0f Email",onPress:()=>v(`mailto:${Y.email}?subject=${encodeURIComponent(`Order from ${(0,b.venueInfo)().name} (acct ${Y.account})`)}`)}):null,Y.website?(0,j.jsx)(u.Button,{small:!0,kind:"secondary",label:"\ud83c\udf10 Ordering website",onPress:()=>v(Y.website)}):null]}),(0,j.jsx)(u.Muted,{children:"Call opens your phone\u2019s dialler and you place the call yourself. Email opens a draft in your mail app; the app sends nothing."}),P?(0,j.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(u.Button,{small:!0,kind:"secondary",label:"Log an order",onPress:()=>U({items:'',amount:''})}),M?(0,j.jsx)(u.Button,{small:!0,kind:"secondary",label:"Edit",onPress:()=>z({...Y,phones:[...Y.phones]})}):null,M?(0,j.jsx)(u.Button,{small:!0,kind:"ghost",label:Y.archived?'Restore':'Archive',onPress:()=>q({...Y,archived:!Y.archived,fav:!!Y.archived&&Y.fav})}):null]}):null,(0,j.jsx)(f.SectionHead,{title:"Order history",sub:"Manual log"}),s.map(e=>(0,j.jsxs)(u.Card,{children:[(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(u.T,{weight:"semibold",children:e.date?(0,p.niceDate)(new Date(e.date+'T12:00:00')):'Last week (example)'}),(0,j.jsx)(u.T,{children:(0,h.gbp)(e.amount)})]}),(0,j.jsxs)(u.Muted,{children:[e.items," \xb7 ",e.by,e.at?` at ${e.at}`:'']})]},e.id)),s.length?null:(0,j.jsx)(u.Muted,{children:"No orders logged yet."}),(0,j.jsxs)(u.Sheet,{visible:!!H,onClose:()=>U(null),title:`Log an order: ${Y.name}`,children:[(0,j.jsx)(u.Field,{label:"What was ordered",value:H?.items??'',onChangeText:e=>U({items:e,amount:H?.amount??''}),placeholder:"e.g. Haddock 40 portions"}),(0,j.jsx)(u.Field,{label:"Approx. value \xa3",value:H?.amount??'',onChangeText:e=>U({items:H?.items??'',amount:e}),keyboardType:"decimal-pad"}),H&&Y.minOrder&&100*Number(H.amount){c.useOwner.getState().setOwner({supplierOrders:[{id:(0,a.uuid)(),supplierId:Y.id,date:o,items:H.items.trim(),amount:Math.round(100*(Number(H.amount)||0)),by:O,at:(0,p.hm)(e)},...R]}),U(null)}}),(0,j.jsx)(u.Muted,{children:"Records an order you placed by phone, email or website. Nothing is sent."})]}),E?(0,j.jsx)(T,{sup:E,onClose:()=>z(null),onSave:e=>{q(e),z(null)}}):null]})}return(0,j.jsxs)(d.default,{style:{gap:10},children:[P&&V.length&&!A?(0,j.jsxs)(u.Card,{highlight:m.colours.amber,children:[(0,j.jsx)(u.T,{weight:"semibold",children:"Orders due today"}),V.map(({s:e,left:s})=>(0,j.jsx)(i.default,{accessibilityRole:"button",accessibilityLabel:`Order due ${e.name}`,onPress:()=>_(e.id),style:{minHeight:44,justifyContent:'center'},children:(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,j.jsx)(u.T,{size:14,children:e.name}),(0,j.jsx)(u.T,{size:13,colour:s<0?m.colours.red:s<120?m.colours.amber:m.colours.muted,children:s<0?`cut-off ${e.cutoff} passed`:`by ${e.cutoff} (${Math.floor(s/60)}h ${s%60}m left)`})]})},e.id)),(0,j.jsx)(u.Muted,{children:"Clears when you log an order for that supplier today."})]}):null,(0,j.jsx)(s.TextInput,{accessibilityLabel:"Search suppliers",placeholder:"Search suppliers",placeholderTextColor:"#7D776C",value:B,onChangeText:D,style:u.styles.input}),(0,j.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(u.Chip,{label:"All",selected:'all'===F,onPress:()=>L('all')}),(0,j.jsx)(u.Chip,{label:"\u2605 Favourites",selected:'fav'===F,onPress:()=>L('fav')}),c.SUPPLIER_CATS.map(e=>(0,j.jsx)(u.Chip,{label:e,selected:F===e,onPress:()=>L(e)},e))]}),W.map(e=>(0,j.jsx)(i.default,{accessibilityRole:"button",accessibilityLabel:`Supplier ${e.name}`,onPress:()=>_(e.id),children:(0,j.jsxs)(u.Card,{children:[(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(u.T,{weight:"semibold",style:{flex:1},children:[e.fav?'\u2605 ':'',e.name]}),(0,j.jsx)(u.Muted,{children:e.category})]}),(0,j.jsxs)(u.Muted,{children:[e.contact," \xb7 ",e.phones[0],e.cutoff?` \xb7 order by ${e.cutoff} ${G(e.orderDays)}`:'']})]})},e.id)),W.length?null:(0,j.jsx)(u.Muted,{children:"No suppliers match."}),(0,j.jsxs)(u.Row,{wrap:!0,gap:6,children:[M?(0,j.jsx)(u.Button,{small:!0,label:"Add supplier",onPress:()=>z(y())}):null,P?(0,j.jsx)(u.Button,{small:!0,kind:"ghost",label:A?'Show active':'Show archived',onPress:()=>N(!A)}):null]}),M?(0,j.jsx)(u.Card,{children:(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(d.default,{style:{flex:1},children:[(0,j.jsx)(u.T,{children:"Staff can view suppliers"}),(0,j.jsx)(u.Muted,{children:"Role permission. Staff get read-only access (call, email, website)."})]}),(0,j.jsx)(u.Toggle,{label:"Staff can view suppliers",value:k,onChange:e=>c.useOwner.getState().setOwner({staffCanViewSuppliers:e})})]})}):null,(0,t.isLiveVenue)()?null:(0,j.jsx)(u.Muted,{children:"These suppliers are saved on this device only (not connected to your venue)."}),E?(0,j.jsx)(T,{sup:E,onClose:()=>z(null),onSave:e=>{q(e),z(null),_(e.id)}}):null]})};var s=r(_d[0]),l=r(_d[1]),t=r(_d[2]),n=r(_d[3]),a=r(_d[4]),o=e(r(_d[5])),i=e(r(_d[6])),d=e(r(_d[7])),u=r(_d[8]),c=r(_d[9]),h=r(_d[10]),p=r(_d[11]),m=r(_d[12]),f=r(_d[13]),x=r(_d[14]),b=r(_d[15]),j=r(_d[16]);const y=()=>({id:(0,a.uuid)(),name:'',category:'Dry goods',contact:'',phones:[''],email:'',website:'',account:'',cutoff:'',orderDays:[],deliveryDays:[],minOrder:0,terms:'',notes:'',fav:!1,archived:!1}),w=e=>`tel:${e.replace(/[^\d+]/g,'')}`,v=e=>{o.default.openURL(e).catch(()=>{})};function C(){const{now:e,today:s}=(0,x.useCtx)(6e4),t=(0,c.useOwner)(e=>e.suppliers),n=(0,c.useOwner)(e=>e.supplierOrders);return(0,l.useMemo)(()=>{const l=(0,x.weekday)(e),a=60*e.getHours()+e.getMinutes();return t.filter(e=>!e.archived&&e.cutoff&&e.orderDays.includes(l)&&!n.some(l=>l.supplierId===e.id&&l.date===s)).map(e=>{const[s,l]=e.cutoff.split(':').map(Number);return{s:e,left:60*s+l-a}}).sort((e,s)=>e.left-s.left)},[t,n,s,Math.floor(e.getTime()/6e4)])}const S=(e,s)=>e.filter(e=>!e.archived&&e.category===s).sort((e,s)=>Number(s.fav)-Number(e.fav))[0];function T({sup:e,onClose:s,onSave:t}){const[n,a]=(0,l.useState)(e),[o,i]=(0,l.useState)(e.minOrder?(e.minOrder/100).toFixed(2):''),d=e=>s=>a({...n,[e]:s}),h=e=>(0,j.jsx)(u.Row,{wrap:!0,gap:4,children:x.DAY3.map((s,l)=>(0,j.jsx)(u.Chip,{label:s,selected:n[e].includes(l),onPress:()=>a({...n,[e]:n[e].includes(l)?n[e].filter(e=>e!==l):[...n[e],l].sort()})},s))}),p=!n.cutoff||/^([01]\d|2[0-3]):[0-5]\d$/.test(n.cutoff);return(0,j.jsxs)(u.Sheet,{visible:!0,onClose:s,title:e.name?`Edit ${e.name}`:'Add supplier',children:[(0,j.jsx)(u.Field,{label:"Name",value:n.name,onChangeText:d('name')}),(0,j.jsx)(u.Muted,{children:"Category"}),(0,j.jsx)(u.Row,{wrap:!0,gap:4,children:c.SUPPLIER_CATS.map(e=>(0,j.jsx)(u.Chip,{label:e,selected:n.category===e,onPress:()=>a({...n,category:e})},e))}),(0,j.jsx)(u.Field,{label:"Contact name",value:n.contact,onChangeText:d('contact')}),n.phones.map((e,s)=>(0,j.jsx)(u.Field,{label:`Phone ${s+1}`,value:e,keyboardType:"phone-pad",onChangeText:e=>a({...n,phones:n.phones.map((l,t)=>t===s?e:l)})},s)),(0,j.jsx)(u.Button,{small:!0,kind:"ghost",label:"Another phone number",onPress:()=>a({...n,phones:[...n.phones,'']})}),(0,j.jsx)(u.Field,{label:"Email",value:n.email,onChangeText:d('email'),keyboardType:"email-address"}),(0,j.jsx)(u.Field,{label:"Ordering website",value:n.website,onChangeText:d('website'),placeholder:"https://"}),(0,j.jsx)(u.Field,{label:"Account number",value:n.account,onChangeText:d('account')}),(0,j.jsx)(u.Field,{label:"Order cut-off (HH:MM)",value:n.cutoff,onChangeText:d('cutoff'),placeholder:"14:00"}),p?null:(0,j.jsx)(u.Muted,{children:"Use 24-hour time, e.g. 14:00."}),(0,j.jsx)(u.Muted,{children:"Order days (cut-off applies)"}),h('orderDays'),(0,j.jsx)(u.Muted,{children:"Delivery days"}),h('deliveryDays'),(0,j.jsx)(u.Field,{label:"Minimum order \xa3",value:o,onChangeText:i,keyboardType:"decimal-pad"}),(0,j.jsx)(u.Field,{label:"Payment terms",value:n.terms,onChangeText:d('terms'),placeholder:"e.g. 30 days"}),(0,j.jsx)(u.Field,{label:"Notes",value:n.notes,onChangeText:d('notes'),multiline:!0}),(0,j.jsx)(u.Button,{label:"Save supplier",disabled:n.name.trim().length<2||!p,onPress:()=>t({...n,name:n.name.trim(),phones:n.phones.map(e=>e.trim()).filter(Boolean),minOrder:Math.round(100*(Number(o)||0)),website:n.website&&!/^https?:\/\//.test(n.website)?`https://${n.website}`:n.website})})]})}},1009,[874,30,943,947,1147,239,263,127,813,854,816,818,821,953,954,1010,24]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"venueInfo",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"useVenueInfo",{enumerable:!0,get:function(){return o}});var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]);const u=(t,n)=>{const r=n?.name??'Your venue',u=n?.location??'';return{rid:t,name:r,place:u,address:n?.address??[r,u].filter(Boolean).join(', '),tag:'#'+r.replace(/[^A-Za-z0-9]/g,'')}},s=s=>{const o=r.IS_ISOLATED_VENUE?r.VENUE_RID:s??n.useOwner.getState().site??r.VENUE_RID;return u(o,t.useStore.getState().restaurants.find(t=>t.id===o))},o=s=>{const o=(0,n.useOwner)(t=>t.site),c=r.IS_ISOLATED_VENUE?r.VENUE_RID:s??o??r.VENUE_RID,E=(0,t.useStore)(t=>t.restaurants.find(t=>t.id===c));return u(c,E)}},1010,[870,854,5]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"APP_VERSION",{enumerable:!0,get:function(){return t}});const t='v0.3.12.77'},1011,[]); +__d(function(_g,r,_i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"setDisplaySilent",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"soundAllowed",{enumerable:!0,get:function(){return u}}),e.chime=function(t="bright"){if(!u())return void l('__ccChimesBlocked');try{const n=o();if(!n)return;('bright'===t?[880,1318.5]:[659.3]).forEach((o,c)=>{const i=n.currentTime+.16*c,u=n.createOscillator(),l=n.createGain();u.type='sine',u.frequency.value=o,l.gain.setValueAtTime(1e-4,i),l.gain.exponentialRampToValueAtTime('bright'===t?.12:.07,i+.02),l.gain.exponentialRampToValueAtTime(1e-4,i+.9),u.connect(l).connect(n.destination),u.start(i),u.stop(i+.95)}),l('__ccChimes')}catch{}},Object.defineProperty(e,"LOW_CHIME_MIN",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"LOW_CHIME_MAX",{enumerable:!0,get:function(){return d}}),e.lowChime=function(t=0){if(!u())return void l('__ccChimesBlocked');const n=s+.095*Math.max(0,Math.min(1,t));'undefined'!=typeof window&&(window.__ccLowChimeLevels=[...window.__ccLowChimeLevels??[],Math.round(1e3*n)/1e3].slice(-40));try{const t=o();if(!t)return;[220,164.8].forEach((o,c)=>{const i=t.currentTime+.42*c,u=t.createOscillator(),l=t.createGain(),s=t.createBiquadFilter?.();u.type='triangle',u.frequency.value=o,l.gain.setValueAtTime(1e-4,i),l.gain.exponentialRampToValueAtTime(n,i+.12),l.gain.exponentialRampToValueAtTime(1e-4,i+1.6),s?(s.type='lowpass',s.frequency.value=900,u.connect(s).connect(l).connect(t.destination)):u.connect(l).connect(t.destination),u.start(i),u.stop(i+1.7)}),l('__ccLowChimes')}catch{}},Object.defineProperty(e,"flapSoundOn",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"setFlapSound",{enumerable:!0,get:function(){return w}}),e.flapClick=function(){if('display'!==t.APP_VARIANT&&!c)return;if(!p())return;try{const t=o();if(!t)return;const n=t.currentTime,c=Math.floor(.03*t.sampleRate),i=t.createBuffer(1,c,t.sampleRate),u=i.getChannelData(0);for(let t=0;t{if('undefined'==typeof window)return null;const t=window.AudioContext||window.webkitAudioContext;return t?(n||(n=new t),'suspended'===n.state&&n.resume?.().catch?.(()=>{}),n):null};if('undefined'!=typeof window){const t=()=>{try{o()}catch{}window.removeEventListener('pointerdown',t)};window.addEventListener('pointerdown',t)}let c=!1;const i=t=>{c=t},u=()=>'display'!==t.APP_VARIANT&&!c,l=t=>{'undefined'!=typeof window&&(window[t]=(window[t]??0)+1)};const s=.015,d=.11;const f='cc-flap-sound',p=()=>{try{return'undefined'!=typeof localStorage&&'1'===localStorage.getItem(f)}catch{return!1}},w=t=>{try{localStorage.setItem(f,t?'1':'0')}catch{}}},1012,[122,806]); +__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"areaMarks",{enumerable:!0,get:function(){return u}}),_e.AreaTabs=function({plan:o,area:e,onPick:n,counts:a,closed:b}){return(0,c.jsx)(t.Row,{wrap:!0,gap:6,style:{alignItems:'center'},children:o.areas.map(o=>{const f=o.id===e,h=b?.has(o.id);return(0,c.jsx)(l.default,{testID:`area-${o.id}`,accessibilityRole:"tab",accessibilityLabel:`Area ${o.name}${o.dogs?', dogs allowed':''}${o.outdoor?', outdoor':''}${h?', closed for weather':''}`,accessibilityState:{selected:f},onPress:()=>n(o.id),style:{minHeight:48,paddingHorizontal:16,borderRadius:24,borderWidth:1.5,borderColor:f?s.colours.gold:h?s.colours.blue:s.colours.border,backgroundColor:f?s.colours.gold:s.colours.surface,justifyContent:'center'},children:(0,c.jsxs)(t.T,{weight:"semibold",size:15,colour:f?s.colours.onGold:s.colours.text,children:[o.name,u(o),h?(0,c.jsx)(t.T,{size:12,colour:f?s.colours.onGold:s.colours.blue,children:" closed"}):null,a?.[o.id]?(0,c.jsxs)(t.T,{size:12,colour:f?s.colours.onGold:s.colours.muted,children:[" ",a[o.id]]}):null]})},o.id)})})},r(d[0]);var o,e=r(d[1]),l=(o=e)&&o.__esModule?o:{default:o},s=r(d[2]),t=r(d[3]),c=r(d[4]);const u=o=>`${o.dogs?' \ud83d\udc3e':''}${o.outdoor?' \ud83c\udf26':''}`},1013,[30,263,821,813,24]); +__d(function(_g,_r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"snap",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"fitLabel",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"BIG_LABEL_MIN",{enumerable:!0,get:function(){return y}}),_e.areaBounds=w,_e.minReadableScale=function(e,t){return Math.max(0,...e.tables.filter(e=>e.areaId===t).map(e=>{const t='round'===e.shape?.85:1,o=(7.4399999999999995*Math.max(1,(0,c.tableNumber)(e).length)+6)/(e.w*t),n=22/Math.min(e.w,e.h);return Math.max(o,n)}))},_e.seatSpots=M,_e.FixtureShape=j,_e.FloorCanvas=function(e){const[v,k]=(0,n.useState)({w:0,h:0}),C=e.plan.tables.filter(t=>t.areaId===e.areaId),I=e.crop&&C.length?w(e.plan,e.areaId):{x:0,y:0,w:s.PLAN_W,h:s.PLAN_H},z={x:I.x,y:I.y,r:I.x+I.w,b:I.y+I.h},R=v.w?'width'===e.fit?Math.min(v.w/s.PLAN_W,e.maxH?e.maxH/s.PLAN_H:9):Math.min(v.w/I.w,v.h/I.h):0,S=e.fill&&'contain'===e.fit&&R>0&&v.h>0,$=S?(v.w/R-I.w)/2:0,A=S?(v.h/R-I.h)/2:0,T={x:z.x-$,y:z.y-A,r:z.r+$,b:z.b+A},L=T.r-T.x,E=T.b-T.y,[N,F]=(0,n.useState)(null),_=(0,n.useRef)(null),B=t=>e.plan.sections.find(e=>e.id===t.sectionId),P=t=>e.plan.joins.find(e=>e.tables.includes(t.name)),D=r.default.useMemo(()=>(0,c.numberClashes)(e.plan.tables).sameArea,[e.plan.tables]),O=(t,o)=>({onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>!0,onResponderTerminationRequest:()=>!1,onResponderGrant:e=>{_.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY,id:t.id,kind:o}},onResponderMove:n=>{const r=_.current;if(!r)return;const i=n.nativeEvent.pageX-r.x,s=n.nativeEvent.pageY-r.y;Math.abs(i)+Math.abs(s)<6&&!N||('live'!==e.mode||e.onDrop&&e.view&&['seated','mains','dessert','bill'].includes(e.view[t.name]?.status)&&e.view[t.name]?.booking)&&F({id:t.id,dx:i,dy:s,kind:o})},onResponderRelease:n=>{const r=_.current;_.current=null;const i=n.nativeEvent.pageX-(r?.x??0),a=n.nativeEvent.pageY-(r?.y??0);if(F(null),Math.abs(i)+Math.abs(a)<6||!R)return void('move'===o&&e.onTap?.(t));const l=i/R,u=a/R;if('edit'===e.mode&&'move'===o)e.onMove?.(t,p(g(t.x+l,e.snapOn),0,s.PLAN_W-t.w),p(g(t.y+u,e.snapOn),0,s.PLAN_H-t.h));else if('edit'===e.mode&&'resize'===o)e.onResize?.(t,p(g(t.w+l,e.snapOn),50,400),p(g(t.h+u,e.snapOn),50,300));else if('live'===e.mode&&e.onDrop){const o=t.x+t.w/2+l,n=t.y+t.h/2+u,r=C.find(e=>e.id!==t.id&&o>=e.x-10&&o<=e.x+e.w+10&&n>=e.y-10&&n<=e.y+e.h+10);r&&e.onDrop(t,r)}}}),W=e=>e*R,H='width'===e.fit?s.PLAN_H*R||200:void 0;return(0,b.jsx)(i.default,{testID:"floor-canvas",onLayout:e=>k({w:e.nativeEvent.layout.width,h:e.nativeEvent.layout.height}),style:[{width:'100%',borderRadius:16,overflow:'hidden'},'contain'===e.fit?{flex:1}:{height:H}],children:R?(0,b.jsx)(i.default,{style:{width:W(L),height:W(E),alignSelf:'center',backgroundColor:(0,t.soutersSurface)('#0F0E0C'),borderRadius:16,borderWidth:1,borderColor:l.colours.border,overflow:'hidden'},children:(0,b.jsxs)(i.default,{style:{position:'absolute',left:-W(T.x),top:-W(T.y),width:W(s.PLAN_W),height:W(s.PLAN_H)},children:['edit'===e.mode?Array.from({length:s.PLAN_W/(2*s.GRID)},(e,o)=>(0,b.jsx)(i.default,{style:{position:'absolute',left:W(o*s.GRID*2),top:0,bottom:0,width:1,backgroundColor:(0,t.soutersSurface)('#1E1B16')}},`v${o}`)):null,'edit'===e.mode?Array.from({length:s.PLAN_H/(2*s.GRID)},(e,o)=>(0,b.jsx)(i.default,{style:{position:'absolute',top:W(o*s.GRID*2),left:0,right:0,height:1,backgroundColor:(0,t.soutersSurface)('#1E1B16')}},`h${o}`)):null,(e.plan.fixtures??[]).filter(t=>t.areaId===e.areaId).map(t=>(0,b.jsx)(j,{f:t,S:W,live:'live'===e.mode},t.id)),e.plan.joins.map(e=>{const t=C.filter(t=>e.tables.includes(t.name));if(t.length<2)return null;const[o,n]=t,r=o.x+o.w/2,s=o.y+o.h/2,a=n.x+n.w/2,l=n.y+n.h/2,u=Math.hypot(a-r,l-s),h=Math.atan2(l-s,a-r);return(0,b.jsx)(i.default,{testID:`join-${e.tables.join('+')}`,style:{position:'absolute',left:W((r+a)/2-u/2),top:W((s+l)/2)-3,width:W(u),height:6,borderRadius:3,backgroundColor:'rgba(207,164,95,0.55)',transform:[{rotate:`${h}rad`}]}},e.id)}),C.map(n=>{const g=e.view?.[n.name],p=g?a.STATUS[g.status]:a.STATUS.free,v=N?.id===n.id,w=v&&'resize'===N.kind?Math.max(50,n.w+N.dx/R):n.w,j=v&&'resize'===N.kind?Math.max(50,n.h+N.dy/R):n.h,k=v&&'move'===N.kind?n.x+N.dx/R:n.x,C=v&&'move'===N.kind?n.y+N.dy/R:n.y,I=e.selected===n.id||e.highlight?.includes(n.name),z=B(n),S='edit'===e.mode?'#2A2419':p.colour,$='edit'===e.mode?l.colours.text:p.fg,A='round'===n.shape?W(Math.min(w,j))/2:W(10),T='live'===e.mode?(0,c.liveTableLabel)(n,D):(0,s.tableLabel)(n),L=W(Math.min(w,j))<64,E=f(e.big?Math.max(13,Math.min(34,W(Math.min(w,j))/3)):Math.max(11,Math.min(22,W(Math.min(w,j))/4)),T,W(w)*('round'===n.shape?.85:1),e.big?y:9),F=Math.max(e.big?11:12,Math.round(.62*E)),_=(W(j)-6-1.4*E)/(1.4*F),H=_>=2&&W(w)>=5*F?2:_>=1?1:0,G=g?g.booking&&void 0!==g.seatedMins?g.booking.time:g.next?.time:void 0,X='edit'===e.mode?`${(0,o.tableNumbers)(T)}, ${(0,s.shapeLabel)(n.shape).toLowerCase()}, ${n.minSeats}\u2013${n.maxSeats} seats${n.online?', bookable online':''}`:`${(0,o.tableNumbers)(T)}, ${p.label}${void 0!==g?.seatedMins?`, seated ${g.seatedMins} min`:''}${g?.covers?`, ${g.covers} covers`:''}${void 0!==g?.nextIn&&'seated'!==g.status?`, next booking ${g.next?.time}`:''}${g?.dayBookings?.length?`, booked: ${g.dayBookings.map(e=>`${e.time}, ${e.partySize} Covers`).join('; ')}`:''}${g?.group?`, combined with ${g.group.filter(e=>e!==n.name).map(e=>`table ${e}`).join(', ')}`:''}`,Y=void 0!==g?.seatedMins&&g.booking?Math.min(1.2,g.seatedMins/(g.booking.durationMins??(0,a.turnFor)(g.booking.partySize,e.turnBase))):null;return(0,b.jsxs)(r.default.Fragment,{children:[M({...n,w:w,h:j}).map((t,o)=>(0,b.jsx)(i.default,{pointerEvents:"none",style:[{position:'absolute',left:W(k+t.x)-Math.max(4,W(8)),top:W(C+t.y)-Math.max(4,W(8)),width:Math.max(8,W(16)),height:Math.max(8,W(16)),borderRadius:99,backgroundColor:'edit'===e.mode?'#5A4C33':'rgba(255,255,255,0.16)',borderWidth:1,borderColor:'edit'===e.mode?l.colours.gold:'rgba(255,255,255,0.25)'},x()]},o)),'live'===e.mode&&(W(w)<44||W(j)<44)?(0,b.jsx)(i.default,{accessible:!1,importantForAccessibility:"no-hide-descendants",'aria-hidden':!0,...O(n,'move'),style:{position:'absolute',left:W(k+w/2)-Math.max(44,W(w))/2,top:W(C+j/2)-Math.max(44,W(j))/2,width:Math.max(44,W(w)),height:Math.max(44,W(j)),zIndex:2}}):null,(0,b.jsxs)(i.default,{testID:`table-${n.name}`,accessibilityRole:"button",accessibilityLabel:X,onAccessibilityTap:()=>e.onTap?.(n),onKeyDown:t=>{'Enter'!==t?.key&&' '!==t?.key||e.onTap?.(n)},tabIndex:0,...O(n,'move'),style:[{position:'absolute',left:W(k),top:W(C),width:W(w),height:W(j),borderRadius:A,backgroundColor:S,alignItems:'center',justifyContent:'center',padding:2,borderWidth:I?3:e.sectionColours&&z?2.5:1.5,borderColor:I?'#FFFFFF':e.sectionColours&&z?(0,l.brandColour)(z.colour):'edit'===e.mode?l.colours.gold:'rgba(0,0,0,0.35)',transform:[{scale:v?1.06:1}],zIndex:v?50:3,opacity:v&&'live'===e.mode?.85:1,shadowColor:'#000',shadowOpacity:v?.6:.3,shadowRadius:v?14:6,cursor:'edit'===e.mode?'grab':'pointer',touchAction:'none'},v?null:x()],children:[(0,b.jsxs)(i.default,{style:{alignItems:'center'},pointerEvents:"none",children:[(0,b.jsx)(u.T,{weight:"bold",size:E,colour:$,center:!0,numberOfLines:1,children:T}),'live'===e.mode&&'blocked'===g?.status?(0,b.jsx)(u.T,{size:Math.max(10,Math.round(.5*E)),weight:"semibold",colour:$,center:!0,numberOfLines:1,children:"Blocked"}):null,e.big&&'live'===e.mode&&g&&1===H?g.covers||G?(0,b.jsx)(u.T,{size:F,weight:"bold",colour:$,center:!0,numberOfLines:1,children:'free'===g.status||'soon'===g.status?G?`${g.dayBookings?'Booked':'Next'} ${G}`:'':[g.covers?`${g.covers}`:'',G??''].filter(Boolean).join(' \xb7 ')}):null:e.big&&'live'===e.mode&&g&&2===H?(0,b.jsxs)(b.Fragment,{children:[g.covers?(0,b.jsxs)(u.T,{size:F,weight:"semibold",colour:$,center:!0,children:[g.covers," cover",1===g.covers?'':'s']}):'free'!==g.status||L?null:(0,b.jsxs)(u.T,{size:F,colour:$,center:!0,children:[n.minSeats,"\u2013",n.maxSeats]}),G?(0,b.jsx)(u.T,{size:F,weight:"bold",colour:$,center:!0,children:'free'===g.status||'soon'===g.status?`${g.dayBookings?'Booked':'Next'} ${G}`:G}):'dirty'===g.status?(0,b.jsx)(u.T,{size:F,colour:$,center:!0,children:"Clear"}):null]}):e.big&&'live'===e.mode?null:'edit'===e.mode?L?null:(0,b.jsxs)(u.T,{size:11,colour:l.colours.muted,center:!0,children:[n.minSeats,"\u2013",n.maxSeats,n.online?' \xb7 online':'']}):g?(0,b.jsxs)(b.Fragment,{children:['free'!==g.status||L?null:(0,b.jsxs)(u.T,{size:11,colour:$,center:!0,children:[n.minSeats,"\u2013",n.maxSeats," seats"]}),void 0!==g.seatedMins?(0,b.jsxs)(u.T,{size:12,weight:"semibold",colour:$,center:!0,children:[g.seatedMins,"m \xb7 ",g.covers,"\ud83d\udc65"]}):g.orderOnly?(0,b.jsx)(u.T,{size:11,colour:$,center:!0,children:"Open order"}):null,'soon'===g.status&&g.next?(0,b.jsxs)(u.T,{size:11,weight:"semibold",colour:$,center:!0,children:[g.next.time," \xb7 ",void 0===g.nextIn?`${g.next.partySize} Covers`:g.nextIn<=0?'due':`${g.nextIn}m`]}):null,'dirty'!==g.status||L?null:(0,b.jsx)(u.T,{size:11,colour:$,center:!0,children:"Clear"}),!L||g.allergy||g.vip?(0,b.jsxs)(u.T,{size:11,colour:$,center:!0,children:[g.allergy?'\u26a0':'',g.vip?'VIP'===g.vip?'\u2605':'\u2665':'',g.occasion?a.OCCASION_ICON[g.occasion]:'',g.note?'\u270e':'']}):null]}):null]}),null,'live'===e.mode&&g&&!L&&(g.booking??g.next)&&(0,h.needsIcons)(g.booking??g.next).replace('\u26a0\ufe0f','').trim()?(0,b.jsx)(i.default,{pointerEvents:"none",testID:`needs-${n.name}`,style:{position:'absolute',bottom:e.big?-Math.max(9,.55*F):2,right:e.big?-6:4,backgroundColor:(0,t.soutersSurface)('rgba(11,11,11,0.85)'),borderRadius:8,paddingHorizontal:4,borderWidth:1,borderColor:'rgba(255,255,255,0.15)'},children:(0,b.jsx)(u.T,{size:e.big?Math.max(11,.75*F):10,children:(0,h.needsIcons)(g.booking??g.next).replace('\u26a0\ufe0f','').trim()})}):null,z&&'live'===e.mode&&e.sectionColours&&!L&&!e.big?(0,b.jsx)(i.default,{pointerEvents:"none",style:{position:'absolute',top:3,right:6,backgroundColor:(0,l.brandColour)(z.colour),borderRadius:6,paddingHorizontal:3},children:(0,b.jsx)(u.T,{size:9,weight:"bold",colour:"#0B0B0B",children:z.server})}):null,null===Y||L?null:(0,b.jsx)(i.default,{pointerEvents:"none",style:{position:'absolute',left:'15%',right:'15%',bottom:5,height:4,borderRadius:2,backgroundColor:'rgba(0,0,0,0.25)'},children:(0,b.jsx)(i.default,{style:{width:`${Math.min(100,100*Y)}%`,height:4,borderRadius:2,backgroundColor:Y>=1?'#B3261E':'rgba(0,0,0,0.6)'}})}),'live'===e.mode&&g?.group?(0,b.jsx)(i.default,{pointerEvents:"none",testID:`group-${n.name}`,style:{position:'absolute',top:e.big?-Math.max(10,.6*F):2,right:e.big?-6:3,backgroundColor:(0,t.soutersSurface)('#0B0B0B'),borderRadius:8,paddingHorizontal:5,borderWidth:1.5,borderColor:l.colours.gold},children:(0,b.jsxs)(u.T,{size:e.big?Math.max(12,.8*F):10,weight:"bold",colour:l.colours.goldLight,children:["\u26d3 ",(U=g.group,(0,s.tablesLabel)(U.join('+')).replace(/^Tables? /,'').replace(/ \+ /g,'+'))]})}):null,P(n)&&'edit'===e.mode?(0,b.jsx)(i.default,{pointerEvents:"none",style:{position:'absolute',bottom:2,left:4},children:(0,b.jsx)(u.T,{size:10,colour:l.colours.gold,children:"\u26d3"})}):null]}),'edit'===e.mode&&e.selected===n.id?(0,b.jsx)(i.default,{testID:"resize-handle",accessibilityLabel:"Resize table",...O(n,'resize'),style:{position:'absolute',left:W(k+w)-14,top:W(C+j)-14,width:28,height:28,borderRadius:14,backgroundColor:l.colours.gold,borderWidth:2,borderColor:'#fff',zIndex:60,cursor:'nwse-resize',touchAction:'none'}}):null]},n.id);var U}),0===C.length?(0,b.jsx)(i.default,{style:{position:'absolute',left:0,right:0,top:'45%'},children:(0,b.jsxs)(u.T,{center:!0,colour:l.colours.muted,children:["No tables in this area yet",'edit'===e.mode?' \u2014 add some in Tables':'',"."]})}):null]})}):null})};var t=_r(d[0]),o=_r(d[1]),n=_r(d[2]),r=e(n);_r(d[3]);var i=e(_r(d[4])),s=_r(d[5]),a=_r(d[6]),l=_r(d[7]),u=_r(d[8]),h=_r(d[9]),c=_r(d[10]),b=_r(d[11]);const x=(e=250)=>({transitionProperty:'background-color, border-color, transform, left, top, width, height',transitionDuration:`${e}ms`}),g=(e,t=!0)=>t?Math.round(e/s.GRID)*s.GRID:Math.round(e),p=(e,t,o)=>Math.max(t,Math.min(o,e)),f=(e,t,o,n=9)=>Math.max(n,Math.min(e,(o-6)/(.62*Math.max(1,t.length)))),y=12,v=46;function w(e,t){const o=e.tables.filter(e=>e.areaId===t);if(!o.length)return{x:0,y:0,w:s.PLAN_W,h:s.PLAN_H};const n=Math.max(0,Math.min(...o.map(e=>e.x))-v),r=Math.max(0,Math.min(...o.map(e=>e.y))-v);return{x:n,y:r,w:Math.min(s.PLAN_W,Math.max(...o.map(e=>e.x+e.w))+v)-n,h:Math.min(s.PLAN_H,Math.max(...o.map(e=>e.y+e.h))+v)-r}}function M(e){const t=Math.max(1,e.maxSeats),o=[];if('round'===e.shape){const n=e.w/2+9.6,r=e.h/2+9.6;for(let i=0;ie.w,r=Math.ceil(t/2),i=t-r;if(n){for(let t=0;te.w,a=n?{borderColor:'#FFFFFF',borderWidth:2}:null;return'bar'===e.kind?(0,b.jsx)(i.default,{pointerEvents:"none",style:[r,{backgroundColor:o?'#2A2216':'#3A2E1C',borderRadius:8,borderWidth:1.5,borderColor:o?'#5A4A30':l.colours.gold},a],children:(0,b.jsx)(u.T,{size:Math.max(9,Math.min(14,t(e.h)/2.4)),weight:"semibold",colour:l.colours.goldLight,children:"BAR"})}):'wall'===e.kind?(0,b.jsx)(i.default,{pointerEvents:"none",style:[r,{backgroundColor:o?'#3A3631':'#5C574F',borderRadius:2},a]}):'window'===e.kind?(0,b.jsx)(i.default,{pointerEvents:"none",style:[r,{backgroundColor:'rgba(226,196,137,0.16)',borderColor:'rgba(226,196,137,0.6)',borderWidth:1,borderRadius:2},a],children:!o&&t(s?e.h:e.w)>60?(0,b.jsx)(u.T,{size:9,colour:"#BFDDFF",style:s?{transform:[{rotate:'90deg'}]}:void 0,children:"WINDOW"}):null}):(0,b.jsx)(i.default,{pointerEvents:"none",style:[r,{borderColor:o?'#7A6440':l.colours.gold,borderWidth:1.5,borderStyle:'dashed',borderRadius:3,backgroundColor:'rgba(207,164,95,0.08)'},a],children:t(s?e.h:e.w)>40?(0,b.jsx)(u.T,{size:9,colour:l.colours.goldLight,style:s?{transform:[{rotate:'90deg'}]}:void 0,children:"DOOR"}):null})}},1014,[878,808,30,122,127,825,826,821,813,976,1022,24]); +__d(function(g,r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.cleanPlan=v,_e.PlanDesigner=function(e){const[s,a]=(0,n.useReducer)(S,{past:[],now:e.initial,future:[]}),A=s.now,B=e=>a({t:'set',p:e}),[N,F]=(0,n.useState)(e.startStep??'areas'),[E,W]=(0,n.useState)(e.initial.areas[0]?.id??''),[H,O]=(0,n.useState)(null),U=(0,y.useOwner)(e=>e.site),_=(0,j.useFloor)(e=>e.settings[U]),G=!1!==_?.gridSnap,K=(0,f.gridOf)(_?.gridSize),[J,X]=(0,n.useState)(null),[Y,Z]=(0,n.useState)(null),[q,V]=(0,n.useState)(''),{width:Q,height:ee}=(0,u.default)(),te=Q>=900,se=s.past.length>0||JSON.stringify(A)!==JSON.stringify(e.initial),ae=(0,h.planCounts)(A);(0,n.useEffect)(()=>{A.areas.some(e=>e.id===E)||W(A.areas[0]?.id??'')},[A.areas,E]),(0,n.useEffect)(()=>{q&&((0,o.notify)({id:`plan-note:${Date.now()}`,title:q,timeoutMs:3500,testID:'plan-toast'}),V(''))},[q]);const le='table'===H?.kind?A.tables.find(e=>e.id===H.id):void 0,oe='fixture'===H?.kind?(A.fixtures??[]).find(e=>e.id===H.id):void 0,re=(e,t)=>{const s=A.tables.find(t=>t.id===e),a=s&&t.name&&t.name!==s.name?A.joins.map(e=>({...e,tables:e.tables.map(e=>e===s.name?t.name:e)})):A.joins,l=s&&t.name&&t.name!==s.name?A.areas.map(e=>e.best?.includes(s.name)?{...e,best:e.best.map(e=>e===s.name?t.name:e)}:e):A.areas;B({...A,areas:l,joins:a,tables:A.tables.map(s=>s.id===e?{...s,...t}:s)})},ne=e=>{const t=A.tables.find(t=>t.id===e);B({...A,tables:A.tables.filter(t=>t.id!==e),joins:A.joins.filter(e=>!t||!e.tables.includes(t.name))}),O(null)},ie=e=>{const t=h.FIXTURES.find(t=>t.id===e),s={id:(0,h.fid)('fx'),areaId:E,kind:e,x:25*Math.round((h.PLAN_W-t.w)/50),y:25,w:t.w,h:t.h};B({...A,fixtures:[...A.fixtures??[],s]}),O({kind:'fixture',id:s.id})},de=e=>{const t=(0,f.tidyArea)(A,e,K),s=(0,f.movedCount)(A,t);s?(B(t),V(`Tidied: ${s} table${1===s?'':'s'} lined up on the grid. Undo (\u2318Z / Ctrl+Z) if you preferred it before.`)):V('Already tidy: every table is on the grid and lined up.')},ue=e=>{const t=(0,h.autoArrange)(A.tables.filter(t=>t.areaId===e),R(A,e));B({...A,tables:[...A.tables.filter(t=>t.areaId!==e),...t]}),V('Layout tidied. Undo if you preferred it before.')};(0,n.useEffect)(()=>{if('undefined'==typeof document)return;const e=e=>{const t=e.target?.tagName;if('INPUT'===t||'TEXTAREA'===t)return;if((e.ctrlKey||e.metaKey)&&'z'===e.key.toLowerCase())return e.preventDefault(),void a({t:e.shiftKey?'redo':'undo'});if((e.ctrlKey||e.metaKey)&&'y'===e.key.toLowerCase())return e.preventDefault(),void a({t:'redo'});if('arrange'!==N||!H)return;const s=e.altKey?1:G?K:5,l={ArrowLeft:[-s,0],ArrowRight:[s,0],ArrowUp:[0,-s],ArrowDown:[0,s]}[e.key];l&&(e.preventDefault(),ce(H.kind,H.id,l[0],l[1],!0)),'Delete'!==e.key&&'Backspace'!==e.key||(e.preventDefault(),'table'===H.kind?ne(H.id):(B({...A,fixtures:(A.fixtures??[]).filter(e=>e.id!==H.id)}),O(null))),'r'===e.key.toLowerCase()&&he(H.kind,H.id)};return document.addEventListener('keydown',e),()=>document.removeEventListener('keydown',e)});const ce=(e,t,s,a,l=!1)=>{const o=e=>({x:Math.max(0,Math.min(h.PLAN_W-e.w,l?e.x+s:s)),y:Math.max(0,Math.min(h.PLAN_H-e.h,l?e.y+a:a))});B('table'===e?{...A,tables:A.tables.map(e=>e.id===t?{...e,...o(e)}:e)}:{...A,fixtures:(A.fixtures??[]).map(e=>e.id===t?{...e,...o(e)}:e)})},he=(e,t)=>{B('table'===e?{...A,tables:A.tables.map(e=>e.id===t?(0,h.rotate90)(e):e)}:{...A,fixtures:(A.fixtures??[]).map(e=>e.id===t?(0,h.rotate90)(e):e)})},be='display'===e.mode;return(0,T.jsxs)(c.default,{testID:"plan-designer",style:{flex:1,backgroundColor:b.colours.bg},onStartShouldSetResponderCapture:()=>(e.onActivity?.(),!1),onMoveShouldSetResponderCapture:()=>(e.onActivity?.(),!1),children:[be?(0,T.jsxs)(c.default,{testID:"editing-banner",accessibilityRole:"summary",style:{backgroundColor:b.colours.gold,paddingHorizontal:16,paddingVertical:8,flexDirection:'row',alignItems:'center',gap:10},children:[(0,T.jsx)(p.T,{size:18,weight:"bold",colour:b.colours.onGold,children:"\u270e EDITING THE TABLE PLAN"}),(0,T.jsx)(p.T,{size:14,weight:"medium",colour:b.colours.onGold,style:{flex:1},children:"The Display is unlocked. Nothing changes on the floor until you tap Save changes."}),e.notice?(0,T.jsx)(c.default,{style:{backgroundColor:(0,t.soutersSurface)('#0B0B0B'),borderRadius:8,paddingHorizontal:10,paddingVertical:4},children:(0,T.jsx)(p.T,{size:13,weight:"semibold",colour:b.colours.amber,children:e.notice})}):null]}):null,(0,T.jsxs)(c.default,{style:{flexDirection:'row',flexWrap:'wrap',alignItems:'center',gap:10,paddingHorizontal:14,paddingVertical:8,borderBottomWidth:1,borderColor:b.colours.border,backgroundColor:b.colours.surface},children:[(0,T.jsxs)(c.default,{style:{marginRight:6},children:[(0,T.jsx)(p.T,{weight:"bold",size:17,colour:b.colours.gold,children:"Table plan"}),(0,T.jsx)(p.Muted,{size:12,children:e.venue})]}),(0,T.jsx)(p.Row,{gap:6,children:C.map(e=>{const t=e.id===N;return(0,T.jsxs)(i.default,{testID:`step-${e.id}`,accessibilityRole:"tab",accessibilityState:{selected:t},accessibilityLabel:`Step ${e.n}: ${e.label}`,onPress:()=>{F(e.id),O(null),X(null)},style:{flexDirection:'row',alignItems:'center',gap:8,minHeight:44,paddingHorizontal:12,borderRadius:22,borderWidth:1.5,borderColor:t?b.colours.gold:b.colours.border,backgroundColor:t?b.colours.goldTint:'transparent'},children:[(0,T.jsx)(c.default,{style:{width:24,height:24,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:t?b.colours.gold:b.colours.surface2},children:(0,T.jsx)(p.T,{size:13,weight:"bold",colour:t?b.colours.onGold:b.colours.muted,children:e.n})}),(0,T.jsx)(p.T,{weight:"semibold",size:15,colour:t?b.colours.goldLight:b.colours.text,children:e.label})]},e.id)})}),(0,T.jsx)(c.default,{style:{flex:1}}),(0,T.jsxs)(c.default,{testID:"plan-counts",style:{alignItems:'flex-end',marginRight:4},children:[(0,T.jsxs)(p.T,{weight:"bold",size:16,children:[ae.tables," tables \xb7 ",ae.seats," seats"]}),(0,T.jsxs)(p.Muted,{size:12,children:[A.areas.length," area",1===A.areas.length?'':'s',se?' \xb7 unsaved changes':'']})]}),(0,T.jsx)(z,{label:"Undo",glyph:"\u21b6",disabled:!s.past.length,onPress:()=>a({t:'undo'})}),(0,T.jsx)(z,{label:"Redo",glyph:"\u21b7",disabled:!s.future.length,onPress:()=>a({t:'redo'})}),(0,T.jsx)(p.Button,{small:!0,kind:"secondary",label:"Cancel",testID:"designer-cancel",onPress:()=>se?Z({title:'Discard your changes?',body:'The table plan goes back to how it was before you started editing.',ok:'Discard changes',danger:!0,run:e.onCancel}):e.onCancel(),style:{minHeight:44}}),(0,T.jsx)(p.Button,{small:!0,label:"Save changes",testID:"designer-save",disabled:!se,onPress:()=>Z({title:'Save changes to the table plan?',body:`${ae.tables} tables \xb7 ${ae.seats} seats across ${A.areas.length} area${1===A.areas.length?'':'s'}. The live floor plan updates straight away on this device.`,ok:'Save changes',run:()=>e.onSave(v(A))}),style:{minHeight:44}})]}),(0,T.jsxs)(c.default,{style:{flex:1},children:['areas'===N?(0,T.jsx)($,{plan:A,set:B,confirm:Z,wide:te,next:()=>F('tables'),toast:V}):null,'tables'===N?(0,T.jsx)(M,{plan:A,set:B,area:E,setArea:W,addTables:(e,t)=>{let s={...A,areas:[...A.areas],tables:[...A.tables]};const a=new Set(s.tables.map(e=>e.name)),l=[];let o=0;const n=new Set;for(const t of e){if(a.has(t.name)){l.push(t.name);continue}let e=E;if(t.area){const a=s.areas.find(e=>e.name.toLowerCase()===t.area.toLowerCase());a?e=a.id:(e=D(s,t.area),s.areas.push({id:e,name:t.area,dogs:!1,outdoor:!1}))}const i=(0,h.newTable)(t.name,e,t.seats,I(s,e)),[d]=(0,h.placeNew)(s.tables.filter(t=>t.areaId===e),[i],(s.fixtures??[]).filter(t=>t.areaId===e));s.tables.push(d),a.add(t.name),n.add(e),o++}if(t)for(const e of n){const t=s.tables.filter(t=>t.areaId===e),a=(0,h.autoArrange)(t,R(s,e));s={...s,tables:[...s.tables.filter(t=>t.areaId!==e),...a]}}return o&&B(s),V(`${o} table${1===o?'':'s'} added${l.length?` \xb7 skipped ${l.join(', ')} (already on the plan)`:''}`),o},remove:ne,patch:re,wide:te,next:()=>F('arrange'),back:()=>F('areas')}):null,'arrange'===N?(0,T.jsxs)(c.default,{style:{flex:1,flexDirection:te?'row':'column'},children:[(0,T.jsxs)(c.default,{style:{flex:1,padding:10,gap:8,minHeight:te?void 0:Math.min(420,.5*ee)},children:[(0,T.jsx)(P,{plan:A,area:E,onPick:e=>{W(e),O(null),X(null)}}),J?(0,T.jsxs)(c.default,{style:{backgroundColor:b.colours.blueBg,borderRadius:10,padding:8,flexDirection:'row',alignItems:'center',gap:8},children:[(0,T.jsxs)(p.T,{colour:b.colours.blue,style:{flex:1},children:["Tap the table to join with ",(0,l.tableNumbers)(A.tables.find(e=>e.id===J)?.name),"."]}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Stop joining",onPress:()=>X(null)})]}):null,(0,T.jsx)(x.DesignerCanvas,{plan:A,areaId:E,sel:H,onSelect:e=>{if(J&&'table'===e?.kind&&e.id!==J){const t=A.tables.find(e=>e.id===J),s=A.tables.find(t=>t.id===e.id),a=A.joins.find(e=>e.tables.includes(t.name)),l=a?A.joins.map(e=>e===a?{...e,tables:[...new Set([...e.tables,s.name])].sort((e,t)=>(0,h.numOf)(e)-(0,h.numOf)(t))}:e).filter(e=>e===a||!e.tables.includes(s.name)):[...A.joins.filter(e=>!e.tables.includes(s.name)),{id:(0,h.fid)('j'),tables:[t.name,s.name].sort((e,t)=>(0,h.numOf)(e)-(0,h.numOf)(t))}];return B({...A,joins:l}),X(null),V(`Joined: book as ${l.find(e=>e.tables.includes(t.name)).tables.join('+')}`),void O(e)}X(null),O(e)},snapOn:G,grid:K,joinFrom:J,onMove:(e,t,s,a)=>ce(e,t,s,a),onResize:(e,t,s,a)=>{if('table'===e){const e=A.tables.find(e=>e.id===t);if('round'===e.shape){const l=Math.max(s,a);re(t,{w:l,h:l,x:e.x,y:e.y})}else re(t,{w:s,h:a,shape:s===a?'square':'rect',x:e.x,y:e.y})}else B({...A,fixtures:(A.fixtures??[]).map(e=>e.id===t?{...e,w:s,h:a}:e)})}}),(0,T.jsxs)(p.Muted,{size:12,children:["Drag to move \xb7 the gold dot resizes \xb7 ",G?`tables snap to a ${K} grid and line up with each other (gold guides)`:'snap to grid is off',' \xb7 hold Alt (Option on a Mac) to move freely \xb7 keys: arrows nudge, R rotates, Delete removes, Ctrl+Z / \u2318Z undoes']})]}),(0,T.jsx)(d.default,{style:{width:te?330:void 0,flexGrow:te?0:1,flexShrink:0,flexBasis:te?330:void 0,borderLeftWidth:te?1:0,borderTopWidth:te?0:1,borderColor:b.colours.border,backgroundColor:b.colours.surface},contentContainerStyle:{padding:14,gap:12},children:le?(0,T.jsx)(L,{t:le,plan:A,patch:e=>re(le.id,e),rotate:()=>he('table',le.id),remove:()=>ne(le.id),duplicate:()=>{const e=k(A),t={...le,id:`t-${e}-${(0,h.fid)('d')}`,name:e,label:void 0},[s]=(0,h.placeNew)(A.tables.filter(e=>e.areaId===le.areaId),[t],(A.fixtures??[]).filter(e=>e.areaId===le.areaId));B({...A,tables:[...A.tables,s]}),O({kind:'table',id:s.id}),V(`${(0,l.tableNumbers)(e)} added`)},join:()=>X(le.id),split:e=>B({...A,joins:A.joins.filter(t=>t.id!==e)}),moveArea:e=>{const[t]=(0,h.placeNew)(A.tables.filter(t=>t.areaId===e),[{...le,areaId:e,sectionId:I(A,e)}],(A.fixtures??[]).filter(t=>t.areaId===e));B({...A,tables:A.tables.map(e=>e.id===le.id?t:e)}),W(e)},onDone:()=>O(null),toast:V}):oe?(0,T.jsxs)(c.default,{style:{gap:10},children:[(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{weight:"bold",size:18,colour:b.colours.gold,children:h.FIXTURES.find(e=>e.id===oe.kind)?.label}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Done",onPress:()=>O(null)})]}),(0,T.jsx)(p.Muted,{children:"Drag it into place; the gold dot changes its length."}),(0,T.jsx)(p.Row,{gap:6,wrap:!0,children:h.FIXTURES.map(e=>(0,T.jsx)(p.Chip,{label:e.label,selected:oe.kind===e.id,onPress:()=>B({...A,fixtures:(A.fixtures??[]).map(t=>t.id===oe.id?{...t,kind:e.id}:t)})},e.id))}),(0,T.jsx)(p.Button,{kind:"secondary",label:"Rotate 90\xb0",onPress:()=>he('fixture',oe.id)}),(0,T.jsx)(p.Button,{kind:"danger",label:"Remove",onPress:()=>{B({...A,fixtures:(A.fixtures??[]).filter(e=>e.id!==oe.id)}),O(null)}})]}):(0,T.jsxs)(c.default,{style:{gap:12},children:[(0,T.jsxs)(p.T,{weight:"bold",size:18,colour:b.colours.gold,children:["Arrange ",A.areas.find(e=>e.id===E)?.name??'']}),(0,T.jsx)(p.Muted,{children:"Tap a table to change its seats, rotate it or join it to another. Drag anything to move it."}),(0,T.jsx)(p.Button,{label:"Add table",testID:"arrange-add-table",onPress:()=>{const e=k(A),t=(0,h.newTable)(e,E,4,I(A,E)),[s]=(0,h.placeNew)(A.tables.filter(e=>e.areaId===E),[t],(A.fixtures??[]).filter(e=>e.areaId===E));B({...A,tables:[...A.tables,s]}),O({kind:'table',id:s.id})}}),(0,T.jsx)(p.T,{weight:"semibold",size:14,colour:b.colours.muted,children:"FIXTURES"}),(0,T.jsx)(p.Row,{gap:6,wrap:!0,children:h.FIXTURES.map(e=>(0,T.jsx)(c.default,{testID:`add-fixture-${e.id}`,children:(0,T.jsx)(p.Chip,{label:e.label,onPress:()=>ie(e.id)})},e.id))}),(0,T.jsx)(p.Button,{label:"Tidy up",testID:"tidy-up",onPress:()=>de(E)}),(0,T.jsx)(p.Muted,{size:12,children:"Snaps every table in this area to the grid and evens out the rows. Table numbers, covers and sizes stay the same. You can undo."}),(0,T.jsx)(p.Button,{kind:"secondary",label:"Re-arrange from scratch",testID:"tidy-area",onPress:()=>ue(E)}),(0,T.jsx)(p.Toggle,{label:"Snap to grid",value:G,onChange:e=>j.useFloor.getState().setSettings(U,{...j.DEFAULT_SETTINGS,..._??{},gridSnap:e})}),(0,T.jsx)(c.default,{style:{borderTopWidth:1,borderColor:b.colours.border,paddingTop:10,gap:4},children:A.areas.map(e=>{const t=(0,h.planCounts)(A,e.id);return(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsxs)(p.T,{size:14,children:[e.name,(0,w.areaMarks)(e)]}),(0,T.jsxs)(p.T,{size:14,colour:b.colours.muted,children:[t.tables," tables \xb7 ",t.seats," seats"]})]},e.id)})})]})})]}):null]}),Y?(0,T.jsx)(c.default,{testID:"designer-confirm",style:{position:'absolute',left:0,right:0,top:0,bottom:0,backgroundColor:'rgba(0,0,0,0.72)',alignItems:'center',justifyContent:'center',padding:16},children:(0,T.jsxs)(c.default,{style:{width:'100%',maxWidth:460,backgroundColor:b.colours.surface,borderRadius:16,borderWidth:1,borderColor:b.colours.gold,padding:20,gap:12},children:[(0,T.jsx)(p.T,{weight:"bold",size:20,children:Y.title}),(0,T.jsx)(p.T,{colour:b.colours.muted,children:Y.body}),(0,T.jsxs)(p.Row,{gap:10,style:{justifyContent:'flex-end'},children:[(0,T.jsx)(p.Button,{kind:"secondary",label:"Keep editing",onPress:()=>Z(null)}),(0,T.jsx)(p.Button,{kind:Y.danger?'danger':'primary',label:Y.ok,testID:"confirm-ok",onPress:()=>{const e=Y;Z(null),e.run()}})]})]})}):null]})};var t=r(_d[0]),s=r(_d[1]),a=r(_d[2]),l=r(_d[3]),o=r(_d[4]),n=r(_d[5]);r(_d[6]);var i=e(r(_d[7])),d=e(r(_d[8])),u=e(r(_d[9])),c=e(r(_d[10])),h=r(_d[11]),b=r(_d[12]),p=r(_d[13]),x=r(_d[14]),f=r(_d[15]),j=r(_d[16]),y=r(_d[17]),w=r(_d[18]),T=r(_d[19]);const C=[{id:'areas',n:1,label:'Areas'},{id:'tables',n:2,label:'Tables'},{id:'arrange',n:3,label:'Arrange'}];function S(e,t){return'set'===t.t?{past:[...e.past,e.now].slice(-80),now:t.p,future:[]}:'undo'===t.t?e.past.length?{past:e.past.slice(0,-1),now:e.past[e.past.length-1],future:[e.now,...e.future]}:e:'redo'===t.t?e.future.length?{past:[...e.past,e.now],now:e.future[0],future:e.future.slice(1)}:e:{past:[],now:t.p,future:[]}}function v(e){const t=new Set(e.tables.map(e=>e.name)),s=[...e.sections];for(const t of e.areas)s.some(e=>e.id===`s-${t.id}`)||e.tables.some(e=>e.areaId===t.id&&e.sectionId)||s.push({id:`s-${t.id}`,name:t.name,colour:'#CFA45F',server:''});return{...e,sections:s,fixtures:(e.fixtures??[]).filter(t=>e.areas.some(e=>e.id===t.areaId)),joins:e.joins.filter(e=>e.tables.length>1&&e.tables.every(e=>t.has(e)))}}const k=e=>{let t=1;const s=new Set(e.tables.map(e=>e.name));for(;s.has(String(t));)t++;return String(t)},I=(e,t)=>e.tables.find(e=>e.areaId===t)?.sectionId??`s-${t}`,R=(e,t)=>(e.fixtures??[]).some(e=>e.areaId===t&&e.y<100&&('bar'===e.kind||e.w>=300))?150:100;const D=(e,t)=>{let s=(0,h.slug)(t),a=2;for(;e.areas.some(e=>e.id===s);)s=`${(0,h.slug)(t)}-${a++}`;return s};function z({label:e,glyph:t,onPress:s,disabled:a}){return(0,T.jsx)(i.default,{accessibilityRole:"button",accessibilityLabel:e,testID:`designer-${e.toLowerCase()}`,disabled:a,onPress:s,style:({pressed:e})=>({minWidth:48,height:44,borderRadius:10,borderWidth:1.5,borderColor:b.colours.border,alignItems:'center',justifyContent:'center',opacity:a?.35:e?.7:1,paddingHorizontal:8}),children:(0,T.jsxs)(p.T,{size:18,weight:"bold",colour:b.colours.gold,children:[t,(0,T.jsxs)(p.T,{size:12,colour:b.colours.muted,children:[" ",e]})]})})}function P({plan:e,area:t,onPick:s}){return(0,T.jsx)(d.default,{horizontal:!0,showsHorizontalScrollIndicator:!1,style:{flexGrow:0},contentContainerStyle:{gap:6},children:e.areas.map(a=>{const l=a.id===t,o=(0,h.planCounts)(e,a.id);return(0,T.jsx)(i.default,{testID:`darea-${a.id}`,accessibilityRole:"tab",accessibilityState:{selected:l},accessibilityLabel:`Area ${a.name}`,onPress:()=>s(a.id),style:{minHeight:44,paddingHorizontal:14,borderRadius:22,borderWidth:1.5,borderColor:l?b.colours.gold:b.colours.border,backgroundColor:l?b.colours.gold:b.colours.surface,justifyContent:'center'},children:(0,T.jsxs)(p.T,{weight:"semibold",size:14,colour:l?b.colours.onGold:b.colours.text,children:[a.name,(0,w.areaMarks)(a)," ",(0,T.jsxs)(p.T,{size:12,colour:l?b.colours.onGold:b.colours.muted,children:[o.tables," \xb7 ",o.seats]})]})},a.id)})})}function $({plan:e,set:t,confirm:a,wide:o,next:u,toast:x}){const[f,j]=(0,n.useState)(''),y=(s,a)=>t({...e,areas:e.areas.map(e=>e.id===s?{...e,...a}:e)}),w=(s,a)=>{const l=[...e.areas],o=s+a;o<0||o>=l.length||([l[s],l[o]]=[l[o],l[s]],t({...e,areas:l}))},C=()=>{const s=f.trim();if(!s)return;if(e.areas.some(e=>e.name.toLowerCase()===s.toLowerCase()))return void x(`There's already an area called ${s}`);const a=D(e,s);t({...e,areas:[...e.areas,{id:a,name:s,dogs:!1,outdoor:!1}],sections:[...e.sections,{id:`s-${a}`,name:s,colour:'#CFA45F',server:''}]}),j('')};return(0,T.jsxs)(d.default,{contentContainerStyle:{padding:16,gap:16,flexDirection:o?'row':'column',alignItems:'flex-start'},children:[(0,T.jsxs)(c.default,{style:{flex:o?3:void 0,alignSelf:'stretch',gap:10},children:[(0,T.jsx)(p.T,{weight:"bold",size:20,children:"1. Areas"}),(0,T.jsx)(p.Muted,{children:"The rooms and spaces guests can sit in. Tick where dogs are welcome and which areas are outdoors (so you can close them in bad weather)."}),e.areas.map((s,o)=>{const n=(0,h.planCounts)(e,s.id);return(0,T.jsxs)(c.default,{testID:`area-card-${s.id}`,style:{backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border,padding:12,gap:8},children:[(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(B,{value:s.name,onCommit:e=>e&&e!==s.name&&y(s.id,{name:e})}),(0,T.jsx)(p.Badge,{label:`${n.tables} tables \xb7 ${n.seats} seats`}),(0,T.jsx)(z,{label:"Up",glyph:"\u2191",disabled:0===o,onPress:()=>w(o,-1)}),(0,T.jsx)(z,{label:"Down",glyph:"\u2193",disabled:o===e.areas.length-1,onPress:()=>w(o,1)})]}),(0,T.jsx)(p.Row,{gap:8,children:(0,T.jsx)(B,{value:s.label??'',label:"Area description (optional)",placeholder:"Description, e.g. Covered conservatory, no pets",onCommit:e=>e!==(s.label??'')&&y(s.id,{label:e||void 0})})}),(0,T.jsxs)(p.Row,{gap:6,wrap:!0,style:{alignItems:'center'},children:[(0,T.jsx)(p.T,{size:13,colour:b.colours.muted,children:"Colour"}),A.map(a=>{const l=(s.colour??e.sections.find(e=>e.id===`s-${s.id}`)?.colour)===a;return(0,T.jsx)(i.default,{testID:`area-colour-${s.id}-${a.slice(1)}`,accessibilityRole:"radio",accessibilityState:{selected:l},accessibilityLabel:`Area colour ${a}`,onPress:()=>t({...e,areas:e.areas.map(e=>e.id===s.id?{...e,colour:a}:e),sections:e.sections.map(e=>e.id===`s-${s.id}`?{...e,colour:a}:e)}),style:{width:32,height:32,borderRadius:16,backgroundColor:a,borderWidth:l?3:1,borderColor:l?'#FFFFFF':b.colours.border}},a)})]}),(()=>{const t=e.tables.filter(e=>e.areaId===s.id).sort((e,t)=>e.name.localeCompare(t.name,void 0,{numeric:!0})),a=s.best??[];return t.length?(0,T.jsxs)(c.default,{style:{gap:6},testID:`area-best-${s.id}`,children:[(0,T.jsx)(p.T,{size:13,colour:b.colours.muted,children:"Best tables"}),(0,T.jsx)(p.Row,{gap:6,wrap:!0,children:t.map(e=>(0,T.jsx)(p.Chip,{testID:`area-best-${s.id}-${e.name}`,label:(0,l.tableNumbers)(e.name),selected:a.includes(e.name),onPress:()=>y(s.id,{best:a.includes(e.name)?a.filter(t=>t!==e.name):[...a,e.name]})},e.id))}),(0,T.jsx)(p.Muted,{size:12,children:"Tip: tap the tables you\u2019d seat first. They show as BEST for walk-ins and bookings when they suit the party size. None ticked: CoverCharge picks by size."})]}):null})(),(0,T.jsxs)(p.Row,{gap:16,wrap:!0,children:[(0,T.jsx)(c.default,{style:{minWidth:220,flex:1},children:(0,T.jsx)(p.Toggle,{label:"\ud83d\udc3e Dogs allowed",value:!!s.dogs,onChange:e=>y(s.id,{dogs:e})})}),(0,T.jsx)(c.default,{style:{minWidth:220,flex:1},children:(0,T.jsx)(p.Toggle,{label:"\ud83c\udf26 Outdoor (weather)",value:!!s.outdoor,onChange:e=>y(s.id,{outdoor:e})})}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Remove area",disabled:e.areas.length<2,onPress:()=>a({title:`Remove ${s.name}?`,body:n.tables?`Its ${n.tables} tables (${n.seats} seats) are removed too. You can undo this.`:'You can undo this.',ok:'Remove area',danger:!0,run:()=>t({...e,areas:e.areas.filter(e=>e.id!==s.id),tables:e.tables.filter(e=>e.areaId!==s.id),fixtures:(e.fixtures??[]).filter(e=>e.areaId!==s.id)})})})]})]},s.id)}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(s.TextInput,{accessibilityLabel:"New area name",placeholder:"New area, e.g. Snug",placeholderTextColor:"#7D776C",value:f,onChangeText:j,onSubmitEditing:C,style:[p.styles.input,{flex:1,minHeight:48}]}),(0,T.jsx)(p.Button,{label:"Add area",testID:"add-area",onPress:C,disabled:!f.trim()})]}),(0,T.jsx)(p.Button,{label:"Next: Tables",onPress:u,testID:"next-tables"})]}),(0,T.jsxs)(c.default,{style:{flex:o?2:void 0,alignSelf:'stretch',gap:10},testID:"templates",children:[(0,T.jsx)(p.T,{weight:"bold",size:18,colour:b.colours.gold,children:"Start from a template"}),(0,T.jsx)(p.Muted,{children:"Replaces the whole plan. You can undo, and nothing is saved until you tap Save changes."}),h.TEMPLATES.map(e=>(0,T.jsxs)(i.default,{testID:`template-${e.id}`,accessibilityRole:"button",accessibilityLabel:`Template: ${e.name}`,onPress:()=>a({title:`Start from ${e.name}?`,body:'This replaces the areas, tables and fixtures in the plan you are editing. You can undo it.',ok:'Use template',run:()=>{t(e.make()),x(`${e.name} template loaded`)}}),style:({pressed:e})=>({backgroundColor:e?b.colours.goldTint:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border,padding:12,minHeight:56}),children:[(0,T.jsx)(p.T,{weight:"semibold",children:e.name}),(0,T.jsx)(p.Muted,{children:e.sub})]},e.id))]})]})}const A=[...h.SECTION_COLOURS,'#E5736B','#F2F2F2'];function B({value:e,onCommit:t,label:a="Area name",placeholder:l}){const[o,i]=(0,n.useState)(e);return(0,n.useEffect)(()=>i(e),[e]),(0,T.jsx)(s.TextInput,{accessibilityLabel:a,placeholder:l,placeholderTextColor:"#7D776C",value:o,onChangeText:i,onBlur:()=>t(o.trim()),onSubmitEditing:()=>t(o.trim()),style:[p.styles.input,{flex:1,minHeight:48,fontSize:17}]})}function M({plan:e,set:t,area:a,setArea:o,addTables:i,remove:u,patch:x,wide:f,next:j,back:y}){const[w,C]=(0,n.useState)(''),[S,v]=(0,n.useState)(4),[I,R]=(0,n.useState)(''),[D,$]=(0,n.useState)(!0),A=(0,n.useMemo)(()=>(0,h.parseTableList)(I),[I]),B=e.tables.filter(e=>e.areaId===a).sort(h.byNumber),M=k(e),L=e.areas.find(e=>e.id===a),N=(e,t)=>{const s=(0,h.sizeFor)(t),a=(0,h.sizeFor)(e.maxSeats),l=e.w!==a.w||e.h!==a.h;x(e.id,{maxSeats:t,minSeats:Math.min(e.minSeats,t),...l?{}:'round'===e.shape?{w:s.h,h:s.h}:{w:s.w,h:s.h,shape:s.shape}})};return(0,T.jsxs)(d.default,{contentContainerStyle:{padding:16,gap:16,flexDirection:f?'row':'column',alignItems:'flex-start'},children:[(0,T.jsxs)(c.default,{style:{flex:f?3:void 0,alignSelf:'stretch',gap:10},children:[(0,T.jsx)(p.T,{weight:"bold",size:20,children:"2. Tables"}),(0,T.jsx)(P,{plan:e,area:a,onPick:o}),(0,T.jsxs)(p.Muted,{children:[L?`${L.name}${L.dogs?' \xb7 dogs allowed':''}${L.outdoor?' \xb7 outdoor':''}`:'',". Table numbers are what you use in website bookings and on the floor."]}),(0,T.jsx)(c.default,{style:{backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border},children:B.length?B.map((e,t)=>(0,T.jsxs)(p.Row,{gap:10,style:{padding:10,borderTopWidth:t?1:0,borderColor:b.colours.border},children:[(0,T.jsxs)(c.default,{style:{width:92},children:[(0,T.jsx)(p.T,{weight:"bold",size:17,colour:b.colours.goldLight,children:(0,h.tableLabel)(e)}),(0,T.jsxs)(p.Muted,{size:12,children:[(0,h.shapeLabel)(e.shape),(0,h.tableLabel)(e)!==e.name?` \xb7 no. ${e.name}`:'']})]}),(0,T.jsx)(c.default,{style:{flex:1},children:(0,T.jsx)(p.Stepper,{value:e.maxSeats,min:1,max:20,label:`seats at table ${e.name}`,onChange:t=>N(e,t)})}),(0,T.jsx)(p.Muted,{children:"seats"}),(0,T.jsx)(z,{label:"Remove",glyph:"\u2715",onPress:()=>u(e.id)})]},e.id)):(0,T.jsx)(c.default,{style:{padding:16},children:(0,T.jsx)(p.Muted,{children:"No tables in this area yet. Add one, or paste a list."})})}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.Button,{kind:"secondary",label:"Back: Areas",onPress:y,style:{flex:1}}),(0,T.jsx)(p.Button,{label:"Next: Arrange",onPress:j,testID:"next-arrange",style:{flex:1}})]})]}),(0,T.jsxs)(c.default,{style:{flex:f?2:void 0,alignSelf:'stretch',gap:12},children:[(0,T.jsxs)(c.default,{style:{backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.gold,padding:14,gap:10},children:[(0,T.jsxs)(p.T,{weight:"bold",size:17,colour:b.colours.gold,children:["Add a table to ",L?.name]}),(0,T.jsxs)(p.Row,{gap:10,children:[(0,T.jsxs)(c.default,{style:{width:120},children:[(0,T.jsx)(p.T,{size:13,colour:b.colours.muted,children:"Table number"}),(0,T.jsx)(s.TextInput,{testID:"add-number",accessibilityLabel:"Table number",value:w,placeholder:M,placeholderTextColor:"#7D776C",onChangeText:e=>C(e.replace(/[^0-9A-Za-z]/g,'').slice(0,4)),style:[p.styles.input,{minHeight:48,fontSize:18}]})]}),(0,T.jsxs)(c.default,{children:[(0,T.jsx)(p.T,{size:13,colour:b.colours.muted,children:"Seats"}),(0,T.jsx)(p.Stepper,{value:S,min:1,max:20,label:"seats",onChange:v})]})]}),(0,T.jsx)(p.Button,{label:`Add ${(0,l.tableNumbers)(w||M)}`,testID:"add-table",onPress:()=>{i([{name:(w||M).toUpperCase(),seats:S}],!1)&&C('')}})]}),(0,T.jsxs)(c.default,{style:{backgroundColor:b.colours.surface,borderRadius:14,borderWidth:1,borderColor:b.colours.border,padding:14,gap:10},children:[(0,T.jsx)(p.T,{weight:"bold",size:17,colour:b.colours.gold,children:"Or paste a list"}),(0,T.jsx)(p.Muted,{children:"One table per line, like \u201c7 - upto 5 people\u201d. A line with just a name (e.g. \u201cBeer Garden\u201d) puts the tables after it in that area."}),(0,T.jsx)(s.TextInput,{testID:"paste-list",accessibilityLabel:"Paste a list of tables",multiline:!0,value:I,onChangeText:R,placeholder:'7 - upto 5 people\n9 - upto 2 people',placeholderTextColor:"#7D776C",style:[p.styles.input,{minHeight:120,textAlignVertical:'top',fontSize:15}]}),I.trim()?(0,T.jsxs)(p.T,{size:14,colour:A.items.length?b.colours.ok:b.colours.amber,children:["Found ",A.items.length," table",1===A.items.length?'':'s'," \xb7 ",A.items.reduce((e,t)=>e+t.seats,0)," seats",A.skipped.length?` \xb7 couldn't read: ${A.skipped.slice(0,2).join('; ')}`:'']}):null,(0,T.jsx)(p.Toggle,{label:"Tidy the layout after adding",value:D,onChange:$}),(0,T.jsx)(p.Button,{label:A.items.length?`Add ${A.items.length} tables`:'Add tables',testID:"paste-add",disabled:!A.items.length,onPress:()=>{i(A.items,D)&&R('')}})]})]})]})}function L({t:e,plan:t,patch:o,rotate:i,remove:d,duplicate:u,join:x,split:f,moveArea:j,onDone:y,toast:w}){const[C,S]=(0,n.useState)(e.name);(0,n.useEffect)(()=>S(e.name),[e.id,e.name]);const v=t.joins.find(t=>t.tables.includes(e.name)),k=()=>{const s=C.trim().toUpperCase();if(s&&s!==e.name)return t.tables.some(e=>e.name===s)?(w(`${(0,l.tableNumbers)(s)} already exists`),void S(e.name)):void o({name:s})};return(0,T.jsxs)(c.default,{style:{gap:12},testID:"table-inspector",children:[(0,T.jsx)(a.TableNumberWarning,{plan:t}),(0,T.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,T.jsx)(p.T,{weight:"bold",size:20,colour:b.colours.gold,children:(0,h.tableLabel)(e)}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Done",onPress:y})]}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.T,{size:14,colour:b.colours.muted,style:{width:80},children:"Number"}),(0,T.jsx)(s.TextInput,{accessibilityLabel:"Table number",value:C,onChangeText:S,onBlur:k,onSubmitEditing:k,style:[p.styles.input,{flex:1,minHeight:44}]})]}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.T,{size:14,colour:b.colours.muted,style:{width:80},children:"Seats"}),(0,T.jsx)(p.Stepper,{value:e.maxSeats,min:1,max:20,label:"seats",onChange:t=>o({maxSeats:t,minSeats:Math.min(e.minSeats,t)})})]}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.T,{size:14,colour:b.colours.muted,style:{width:80},children:"Min covers"}),(0,T.jsx)(p.Stepper,{value:e.minSeats,min:1,max:e.maxSeats,label:"minimum covers",onChange:e=>o({minSeats:e})})]}),(0,T.jsxs)(p.Row,{gap:6,wrap:!0,children:[(0,T.jsx)(p.Chip,{label:"Square",selected:'square'===e.shape,onPress:()=>{const t=Math.max(e.w,e.h);o({shape:'square',w:t,h:t})}}),(0,T.jsx)(p.Chip,{label:"Round",selected:'round'===e.shape,onPress:()=>{const t=Math.max(e.w,e.h);o({shape:'round',w:t,h:t})}}),(0,T.jsx)(p.Chip,{label:"Rectangle",selected:'rect'===e.shape,onPress:()=>{if('rect'===e.shape)return;const t=(0,h.sizeFor)(Math.max(5,e.maxSeats));o({shape:'rect',w:e.h>e.w?e.w:t.w,h:e.h>e.w?t.w:t.h})}}),(0,T.jsx)(p.Chip,{label:"Fit to seats",onPress:()=>{const t=(0,h.sizeFor)(e.maxSeats);o({shape:t.shape,w:t.w,h:t.h,minSeats:Math.min(e.minSeats,e.maxSeats)||(0,h.minFor)(e.maxSeats)})}})]}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.Button,{kind:"secondary",label:"Rotate 90\xb0",testID:"rotate",onPress:i,style:{flex:1}}),(0,T.jsx)(p.Button,{kind:"secondary",label:"Duplicate",onPress:u,style:{flex:1}})]}),v?(0,T.jsxs)(c.default,{style:{gap:6},children:[(0,T.jsxs)(p.T,{size:14,children:["Joined with ",v.tables.filter(t=>t!==e.name).map(l.tableNumbers).join(', ')," \xb7 book as ",(0,T.jsx)(p.T,{weight:"bold",colour:b.colours.goldLight,children:(0,l.tableNumbers)(v.tables.join('+'))})]}),(0,T.jsxs)(p.Row,{gap:8,children:[(0,T.jsx)(p.Button,{small:!0,kind:"secondary",label:"Join another",onPress:x,style:{flex:1}}),(0,T.jsx)(p.Button,{small:!0,kind:"ghost",label:"Split",onPress:()=>f(v.id),style:{flex:1}})]})]}):(0,T.jsx)(p.Button,{kind:"secondary",label:"Join with another table",testID:"join",onPress:x}),(0,T.jsx)(p.Toggle,{label:"Bookable online",value:e.online,onChange:e=>o({online:e})}),t.areas.length>1?(0,T.jsxs)(c.default,{style:{gap:6},children:[(0,T.jsx)(p.T,{size:14,colour:b.colours.muted,children:"Move to area"}),(0,T.jsx)(p.Row,{gap:6,wrap:!0,children:t.areas.map(t=>(0,T.jsx)(p.Chip,{label:t.name,selected:t.id===e.areaId,onPress:()=>t.id!==e.areaId&&j(t.id)},t.id))})]}):null,(0,T.jsx)(p.Button,{kind:"danger",label:"Remove table",onPress:d})]})}},1015,[878,874,1314,808,1118,30,122,263,151,287,127,1022,821,813,1421,1004,825,854,1013,24]); +__d(function(g,r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DEFAULT_WAKE_PIN",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"DEFAULT_WAKE_SALT",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"hashWakePin",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"DEFAULT_WAKE",{enumerable:!0,get:function(){return o}}),e.newSalt=u,e.wakePinProblem=function(n){return/^\d{6,8}$/.test(n)?/^(\d)\1+$/.test(n)||'0123456789012'.includes(n)||'9876543210987'.includes(n)?'Pick a PIN that is harder to guess (not all the same digit or a run like 123456).':n===t?'Pick a new PIN, not the starting one.':null:'The wake PIN must be 6 to 8 digits.'},e.makeWakePin=function(n,t=u()){return{pinHash:a(n,t),pinSalt:t,pinLen:n.length,pinDefault:!1}},Object.defineProperty(e,"wakePinMatches",{enumerable:!0,get:function(){return l}}),e.fromOldPin=function(n){const i='string'==typeof n&&/^\d{4,8}$/.test(n)?n:t;if(i===t)return{...o};const l=u();return{pinHash:a(i,l),pinSalt:l,pinLen:i.length,pinDefault:!1}};var n=r(d[0]);const t='2580',i='cc-wake-default',a=(t,i)=>(0,n.sha256HexSync)(`cc-wake:${i}:${t}`),o={pinHash:a(t,i),pinSalt:i,pinLen:4,pinDefault:!0};function u(){const n=globalThis.crypto,t=new Uint8Array(12);if(n?.getRandomValues)n.getRandomValues(t);else for(let n=0;nn.toString(16).padStart(2,'0')).join('')}const l=(n,t)=>a(t,n.pinSalt)===n.pinHash},1016,[1164]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.WipeDevice=function({compact:e}){const f=(0,u.useDisplaySettings)(p.VENUE_RID),[v,T]=(0,s.useState)(!1),[w,j]=(0,s.useState)(''),[D,C]=(0,s.useState)(!1),I='display'===h.APP_VARIANT&&f.pinOn,P=!I||(0,b.wakePinMatches)(f,w);return v?(0,x.jsxs)(o.default,{testID:"wipe-confirm-box",style:{gap:6,marginTop:6},children:[(0,x.jsx)(l.T,{size:e?12:14,children:"Sign out and remove everything CoverCharge keeps on this device: sign-ins, pairing, saved screens and any changes not sent yet. The venue\u2019s shared data is not touched. To use it again, open a personal link or pair the Display again."}),I?(0,x.jsx)(t.TextInput,{testID:"wipe-pin",value:w,onChangeText:j,placeholder:"Display wake PIN",placeholderTextColor:c.colours.muted,secureTextEntry:!0,keyboardType:"number-pad",accessibilityLabel:"Display wake PIN",style:{borderWidth:1,borderColor:'rgba(255,255,255,0.2)',borderRadius:8,paddingHorizontal:10,paddingVertical:6,color:c.colours.text}}):null,(0,x.jsxs)(o.default,{style:{flexDirection:'row',gap:8},children:[(0,x.jsx)(n.default,{testID:"wipe-confirm",accessibilityRole:"button",accessibilityLabel:"Yes, wipe this device",disabled:!P||D,onPress:()=>{C(!0),(0,y.wipeThisDevice)()},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,backgroundColor:P?c.colours.red:'rgba(255,255,255,0.08)'},children:(0,x.jsx)(l.T,{size:12,weight:"semibold",children:D?'Wiping\u2026':'Yes, wipe this device'})}),(0,x.jsx)(n.default,{accessibilityRole:"button",accessibilityLabel:"Cancel",onPress:()=>{T(!1),j('')},style:{paddingHorizontal:12,paddingVertical:6,borderRadius:8,borderWidth:1,borderColor:'rgba(255,255,255,0.2)'},children:(0,x.jsx)(l.T,{size:12,children:"Cancel"})})]})]}):(0,x.jsx)(n.default,{testID:"wipe-device",accessibilityRole:"button",accessibilityLabel:"Sign out and wipe this device",onPress:()=>T(!0),style:{alignSelf:'flex-start',marginTop:e?4:0,minHeight:44,justifyContent:'center'},children:(0,x.jsx)(l.T,{size:e?12:14,colour:c.colours.gold,children:"Sign out and wipe this device\u2026"})})};var t=r(d[0]),s=r(d[1]),n=e(r(d[2])),o=e(r(d[3])),l=r(d[4]),c=r(d[5]),u=r(d[6]),p=r(d[7]),b=r(d[8]),h=r(d[9]),y=r(d[10]),x=r(d[11])},1017,[874,30,263,127,813,821,825,5,1016,806,820,24]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"WILDINGS_LOCATION",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"WILDINGS_ADDRESS",{enumerable:!0,get:function(){return t}}),e.withWildingsAddress=function(r){return'wildings'===r.id?{...r,location:n,address:t}:r},e.withWildingsQuestionnaireAddress=function(n,r){return'wildings'===n&&r?{...r,venue:{...r.venue,address:t}}:r};const n='Maidens, KA26 9NR',t='Maidens Road, Maidens, KA26 9NR'},1018,[]); +__d(function(_g,_r,i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useStore",{enumerable:!0,get:function(){return n.useStore}}),_e.useNow=function(e=1e4){const r=(0,n.useStore)(e=>e.clock),[,u]=(0,t.useState)(0);return(0,t.useEffect)(()=>{const t=setInterval(()=>u(e=>e+1),e);return()=>clearInterval(t)},[e]),(0,n.nowFrom)(r)},Object.defineProperty(_e,"useRestaurant",{enumerable:!0,get:function(){return a}}),_e.useRecipeCards=c,_e.useAllMenu=f,_e.useMenu=function(e){const r=f(e);return(0,t.useMemo)(()=>r.filter(e=>!e.hidden),[r])},Object.defineProperty(_e,"useCustomer",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"useBasket",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"useOrders",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"useOrderAtTable",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"useOrder",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"useBookings",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"useWaitlist",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"useEvents",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"useStampCard",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"useGiftCards",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"useRatings",{enumerable:!0,get:function(){return M}}),Object.defineProperty(_e,"useAudit",{enumerable:!0,get:function(){return v}});var e=_r(_d[0]),t=_r(_d[1]),r=_r(_d[2]),n=_r(_d[3]),u=_r(_d[4]),s=_r(_d[5]),o=_r(_d[6]);_r(_d[7]);const a=e=>(0,n.useStore)(t=>t.restaurants.find(t=>t.id===e)),l=e=>(0,o.recipeCards)().subscribe(e),d=[];function c(e){return(0,t.useSyncExternalStore)(l,()=>e?(0,o.recipeCards)().list(e):d,()=>e?(0,o.recipeCards)().list(e):d)}function f(e){const u=(0,n.useStore)((0,r.useShallow)(t=>t.menu.filter(t=>t.restaurantId===e))),o=c(e);return(0,t.useMemo)(()=>(0,s.resolveMenu)(u),[u,o])}const b=()=>(0,n.useStore)(e=>e.customer),S=()=>(0,n.useStore)(e=>e.basket),g=(e,t)=>'table'!==t.type||(0,u.orderAtTableOn)(e.restaurants.find(e=>e.id===t.restaurantId)),m=e=>(0,n.useStore)((0,r.useShallow)(t=>t.orders.filter(r=>(!e||r.restaurantId===e)&&g(t,r)))),p=e=>(0,n.useStore)(t=>(0,u.orderAtTableOn)(t.restaurants.find(t=>t.id===e))),O=e=>(0,n.useStore)(t=>t.orders.find(t=>t.id===e)),y=e=>(0,n.useStore)((0,r.useShallow)(t=>e?t.bookings.filter(t=>t.restaurantId===e):t.bookings)),w=e=>(0,n.useStore)((0,r.useShallow)(t=>t.waitlist.filter(t=>t.restaurantId===e))),I=[],j=u=>{const s=(0,n.useStore)((0,r.useShallow)(e=>e.events.filter(e=>null===e.restaurantId||e.restaurantId===u))),o=(0,n.useStore)(e=>e.restaurants.find(e=>e.id===u)),a=o?(0,e.regularEventsOf)(o):I,l=(new Date).toISOString().slice(0,7);return(0,t.useMemo)(()=>{if(!u||!a.length)return s;const t=new Date,r=new Date(t.getFullYear(),t.getMonth()-2,1),n=new Date(t.getFullYear()+1,t.getMonth()+1,0),o=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`;return[...s,...(0,e.expandEvents)(u,a,o(r),o(n))]},[s,a,u,l])},P=e=>(0,n.useStore)(t=>t.stampCards.find(r=>r.restaurantId===e&&r.customerId===t.customer.id)),h=e=>(0,n.useStore)((0,r.useShallow)(t=>t.giftCards.filter(r=>(!e||r.restaurantId===e)&&r.ownerId===t.customer.id))),M=e=>(0,n.useStore)((0,r.useShallow)(t=>t.ratings.filter(t=>t.restaurantId===e))),v=e=>(0,n.useStore)((0,r.useShallow)(t=>t.audit.filter(t=>t.restaurantId===e)))},1019,[809,30,871,870,979,1142,831,1119]); +__d(function(_g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useOnboard",{enumerable:!0,get:function(){return l}});var e,s=r(_d[0]),t=(e=s)&&e.__esModule?e:{default:e},p=r(_d[1]),u=r(_d[2]);const n=()=>{const e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`},l=(0,p.create)()((0,u.persist)(e=>({setup:{},answers:{},goals:{},replay:null,markStep:(s,t,p)=>e(e=>({setup:{...e.setup,[s]:{...e.setup[s]??{steps:{}},steps:{...e.setup[s]?.steps??{},[t]:p}}}})),welcome:s=>e(e=>({setup:{...e.setup,[s]:{...e.setup[s]??{steps:{}},welcomed:n()}}})),finish:s=>e(e=>({replay:null,setup:{...e.setup,[s]:{...e.setup[s]??{steps:{}},welcomed:e.setup[s]?.welcomed??n(),finished:n()}}})),restart:s=>e(e=>({setup:{...e.setup,[s]:{steps:{}}}})),setReplay:s=>e({replay:s}),saveAnswers:(s,t)=>e(e=>({answers:{...e.answers,[s]:t}})),setGoal:(s,t)=>e(e=>{const p={...e.goals};return t?p[s]=t:delete p[s],{goals:p}})}),{name:'covercharge-onboard-v1',version:1,storage:(0,u.createJSONStorage)(()=>t.default),partialize:e=>({setup:e.setup,answers:e.answers,goals:e.goals})}))},1020,[1024,1008,1025]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"SEEDED_ANSWERS",{enumerable:!0,get:function(){return f}});var n=r(d[0]),t=e(r(d[1])),l=e(r(d[2])),o=e(r(d[3])),s=e(r(d[4])),u=e(r(d[5])),p=e(r(d[6])),h=r(d[7]),c=r(d[8]);const f={...Object.fromEntries(Object.entries(n.queuedVenues).map(([e,n])=>[e,(0,h.cleanQuestionnaire)(n.questionnaire,e)??{}])),greenside:(0,h.cleanQuestionnaire)(t.default,'greenside')??{},abbotsford:(0,h.cleanQuestionnaire)(l.default,'abbotsford')??{},kirkton:(0,h.cleanQuestionnaire)(o.default,'kirkton')??{},wildings:(0,h.cleanQuestionnaire)(s.default,'wildings')??{},kirkmichael:(0,h.cleanQuestionnaire)(u.default,'kirkmichael')??{},souters:(0,h.cleanQuestionnaire)(p.default,'souters')??{},anchorage:{source:'from-config',submittedAt:'2026-10-01',onboardedAt:'2026-10-01',pay:c.ANCHORAGE_PAY},saltmarsh:{source:'signup-form',submittedAt:'2026-10-27',venue:{name:'The Venue',tagline:'Seasonal small plates by the harbour (fictional)',address:'4 Quay Street, Port Ailsa (fictional)',phone:'01632 960 418',email:'hello@thevenue.example',website:'thevenue.example'},tables:{template:'bistro',tables:14,covers:48,areas:['Inside','Terrace']},team:[{name:'Morven Reid (example)',role:'owner',job:'Owner',email:'morven@thevenue.example'},{name:'Callum Shaw (example)',role:'manager',job:'General manager',email:'callum@thevenue.example'},{name:'Isla Grant (example)',role:'staff',job:'Head chef'},{name:'Ruaridh Bell (example)',role:'staff',job:'Waiter',phone:'07700 900 311'},{name:'Ellie Muir (example)',role:'staff',job:'Waiter'}],suppliers:[{name:'Ailsa Fish Co (example)',category:'Fish',phone:'01632 960 101'},{name:'Hillside Dairy (example)',category:'Dairy',email:'orders@hillside.example'}],pay:{tipsFrequency:'fortnightly',tipsAnchorPayday:'2026-11-06',tipsEndsDaysBefore:5,wagePayDay:28,wageCutoffDay:20,weekendRule:'before'},accounts:[{provider:'gmail',handle:'hello@thevenue.example'},{provider:'wix',handle:'thevenue.example'},{provider:'instagram',handle:'@thevenue.demo'},{provider:'facebook',handle:'The Venue'},{provider:'google-business',handle:'The Venue'},{provider:'sumup',handle:'The Venue'},{provider:'xero',handle:'The Venue Ltd'}],features:{bookings:!0,takeaway:!0,orderAtTable:!0,tips:!0,rota:!0,games:!1,specials:!0},notes:'Fictional example answers for the demo venue.'}}},1021,[6,1289,1290,1291,866,865,1292,864,3]); +__d(function(_g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"SHAPES",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"shapeLabel",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"tableLabel",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"tableNumber",{enumerable:!0,get:function(){return u}}),_e.numberClashes=function(e){const t=new Map;for(const n of e){const e=u(n);t.set(e,[...t.get(e)??[],{name:n.name,areaId:n.areaId}])}const n=new Set,r=[];for(const[e,a]of t){if(a.length<2)continue;const t=new Map;a.forEach(e=>t.set(e.areaId,[...t.get(e.areaId)??[],e.name]));for(const e of t.values())e.length>1&&e.forEach(e=>n.add(e));t.size>1&&r.push(e)}return{sameArea:n,acrossAreas:r}},Object.defineProperty(_e,"liveTableLabel",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"FIXTURES",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"PLAN_W",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"PLAN_H",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"GRID",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"snap",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"clamp",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"fid",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"slug",{enumerable:!0,get:function(){return w}}),_e.sizeFor=y,Object.defineProperty(_e,"minFor",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"numOf",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"byNumber",{enumerable:!0,get:function(){return P}}),_e.newTable=j,_e.autoArrange=M,_e.placeNew=S,_e.rotate90=function(e){const t=e.x+e.w/2,n=e.y+e.h/2;return{...e,w:e.h,h:e.w,x:h(f(t-e.h/2),0,c-e.h),y:h(f(n-e.w/2),0,b-e.w)}},_e.normalisePlan=function(e){return{...e,fixtures:e.fixtures??[],tables:e.tables.map(e=>{const t=e.shape;let n='booth'===t||'rect'===t?'rect':'round'===t?'round':'square',{w:r,h:a}=e;if('square'===n||'round'===n){const e=Math.max(r,a);r=e,a=e}if(90===e.rot||270===e.rot){const e=r;r=a,a=e}return'rect'===n&&r===a&&(n='square'),{...e,shape:n,w:r,h:a,rot:0}})}},Object.defineProperty(_e,"SECTION_COLOURS",{enumerable:!0,get:function(){return I}}),_e.buildPlan=k,_e.anchoragePlan=$,_e.starterPlan=function(){return k({areas:[{name:'Main room',tables:[[1,2],[2,4],[3,6],[4,4],[5,2],[6,6]],fixtures:[A(450,600)]}]},['SV'])},Object.defineProperty(_e,"TEMPLATES",{enumerable:!0,get:function(){return v}}),_e.parseTableList=function(e){const t=[],n=[];let r;for(const a of e.split(/\r?\n/)){const e=a.trim();if(!e)continue;if(!/\d/.test(e)){r=e.replace(/[:\-\u2013]+$/,'').trim()||r;continue}const o=e.match(/^(?:table|tbl|tab|t)?\s*(?:no\.?|number|#)?\s*([a-z]?\d+[a-z]?)\b[^\d]*?(\d+)/i);if(!o){n.push(e);continue}const s=parseInt(o[2],10);!s||s>30?n.push(e):t.push({area:r,name:o[1].toUpperCase(),seats:s})}return{items:t,skipped:n}},Object.defineProperty(_e,"planCounts",{enumerable:!0,get:function(){return C}}),Object.defineProperty(_e,"tableDogOk",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e,"dogTables",{enumerable:!0,get:function(){return L}}),Object.defineProperty(_e,"areaOfTable",{enumerable:!0,get:function(){return q}}),_e.bestTables=E,Object.defineProperty(_e,"isBestTable",{enumerable:!0,get:function(){return _}}),_e.withSeedBest=function(e,t){if('anchorage'!==e||!t?.areas?.some(e=>void 0===e.best))return t;const n=$();return{...t,areas:t.areas.map(e=>{if(void 0!==e.best)return e;const r=n.areas.find(t=>t.id===e.id||t.name===e.name),a=(r?.best??[]).filter(n=>t.tables.some(t=>t.name===n&&t.areaId===e.id));return a.length?{...e,best:a}:e})}};var e,t=_r(d[0]),n=_r(d[1]),r=(e=n)&&e.__esModule?e:{default:e};const a=[{id:'square',label:'Square'},{id:'rect',label:'Rectangle'},{id:'round',label:'Round'}],o=e=>'rect'===e?'Rectangle':'round'===e?'Round':'Square',s=e=>/\d/.test(e.name)?(0,t.plainTableNumber)(e.name):(0,t.plainTableNumber)(e.label?.trim()||e.name),u=s;const l=(e,t)=>u(e),i=[{id:'bar',label:'Bar',w:300,h:50},{id:'wall',label:'Wall',w:250,h:25},{id:'door',label:'Door',w:100,h:25},{id:'window',label:'Window',w:200,h:25}],c=1e3,b=625,m=25,f=e=>Math.round(e/m)*m,h=(e,t,n)=>Math.max(t,Math.min(n,e));let p=0;const g=e=>`${e}-${Date.now().toString(36)}${(p++).toString(36)}`,w=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,'-').replace(/^-|-$/g,'')||'area';function y(e){return e<=2?{shape:'square',w:75,h:75}:e<=4?{shape:'square',w:100,h:100}:e<=6?{shape:'rect',w:150,h:100}:e<=8?{shape:'rect',w:200,h:100}:e<=10?{shape:'rect',w:250,h:100}:{shape:'rect',w:300,h:100}}const x=e=>e<=2?1:Math.max(2,Math.ceil(e/2)),O=e=>{const t=e.match(/\d+/);return t?parseInt(t[0],10):9999},P=(e,t)=>O(e.name)-O(t.name)||e.name.localeCompare(t.name);function j(e,t,n,r){const a=y(n);return{id:`t-${e}-${g('x').slice(2)}`,name:e,areaId:t,shape:a.shape,minSeats:x(n),maxSeats:n,x:0,y:0,w:a.w,h:a.h,rot:0,online:!0,sectionId:r}}function M(e,t=125,n=75){const r=[...e].sort(P);if(!r.length)return r;let a=75;const o=e=>{const t=[];let n=[],a=0;for(const o of r){const r=(n.length?e:0)+o.w;n.length&&a+r>850&&(t.push(n),n=[],a=0),n.push(o),a+=(n.length>1?e:0)+o.w}return n.length&&t.push(n),t};let s=o(a);const u=(e,t)=>e.reduce((e,t)=>e+Math.max(...t.map(e=>e.h)),0)+t*(e.length-1);for(;u(s,a)>b-t-n&&a>25;)a-=25,s=o(a);const l=u(s,a),i=b-t-n,p=s.length>1?Math.min(150,a+Math.max(0,Math.floor((i-l)/(s.length-1)/m)*m)):0,g=s.reduce((e,t)=>e+Math.max(...t.map(e=>e.h)),0)+p*(s.length-1);let w=f(t+Math.max(0,(i-g)/2));const y=[];for(const e of s){const t=Math.max(...e.map(e=>e.h)),n=e.reduce((e,t)=>e+t.w,0)+a*(e.length-1);let r=f((c-n)/2);for(const n of e)y.push({...n,x:h(r,0,c-n.w),y:h(f(w+(t-n.h)/2),0,b-n.h),rot:0}),r+=n.w+a;w+=t+p}return y}function S(e,t,n=[]){const r=[...e,...n].map(e=>({x:e.x,y:e.y,w:e.w,h:e.h})),a=[];for(const e of t){let t=null;for(let n=50;n<=b-e.h-25&&!t;n+=m)for(let a=50;a<=c-e.w-25&&!t;a+=m){const o=50;r.some(t=>at.x&&nt.y)||(t={x:a,y:n})}const n=t??{x:50,y:50},o={...e,x:n.x,y:n.y};r.push({x:o.x,y:o.y,w:o.w,h:o.h}),a.push(o)}return a}const I=['#CFA45F','#E2C489','#A88B5A','#8C6A3A','#FFB547','#D9B98A'];function k(e,t=[]){const n=[],r=[],a=[],o=[];e.areas.forEach((e,s)=>{const u=w(e.name),l=e.best?e.best.map(String).filter(t=>e.tables.some(([e])=>String(e)===t)):void 0;n.push({id:u,name:e.name,dogs:!!e.dogs,outdoor:!!e.outdoor,...e.label?{label:e.label}:{},...e.colour?{colour:e.colour}:{},...l?{best:l}:{}});const i=`s-${u}`;o.push({id:i,name:e.name,colour:e.colour??I[s%I.length],server:t[s]??''});const m=(e.fixtures??[]).map((e,t)=>({...e,id:`fx-${u}-${t}`,areaId:u}));a.push(...m);const f=m.some(e=>e.y<100&&('bar'===e.kind||e.w>=300))?150:100,p=e.tables.map(([e,t])=>({...j(String(e),u,t,i),id:`t-${e}`})),g=e.layout??{},y=p.filter(e=>g[e.name]).map(e=>{const t=g[e.name],n=t.shape??(t.w===t.h?'square':'rect'),r=h(Math.round(t.w),50,c),a=h(Math.round('rect'===n?t.h:t.w),50,b);return{...e,shape:n,w:r,h:a,x:h(Math.round(t.x),0,c-r),y:h(Math.round(t.y),0,b-a),...t.label?{label:t.label}:{}}}),x=p.filter(e=>!g[e.name]);y.length?r.push(...y,...S(y,x,m)):r.push(...M(p,f,75))});const s=new Set(r.map(e=>e.name)),u=(e.joins??[]).filter(e=>e.every(e=>s.has(e))).map(e=>({id:`j-${e.join('-')}`,tables:e}));return{areas:n,tables:r,joins:u,sections:o,fixtures:a}}const T=(e,t,n=0,r=25)=>({kind:'window',x:e,y:n,w:t,h:r}),A=(e,t,n=100,r=25)=>({kind:'door',x:e,y:t,w:n,h:r});function $(){const e=r.default;return k({areas:e.areas.map(e=>({name:e.name,dogs:!!e.dogFriendly,outdoor:!(!e.outdoor&&!e.weatherDependent),label:e.label,colour:e.colour,tables:e.tables.map(([e,t])=>[e,t]),layout:e.layout,fixtures:[],best:e.best?.map(String)})),joins:e.joins??[]},e.areas.map(e=>e.server??''))}const v=[{id:'anchorage',name:'The Anchorage',sub:'4 areas \xb7 29 tables \xb7 119 seats',make:$},{id:'cafe',name:'Small caf\xe9',sub:'1 room \xb7 8 tables \xb7 dogs welcome',make:()=>k({areas:[{name:'Caf\xe9',dogs:!0,tables:[[1,2],[2,2],[3,4],[4,4],[5,2],[6,4],[7,2],[8,6]],fixtures:[{kind:'bar',x:300,y:25,w:400,h:50},A(450,600)]}]})},{id:'pub',name:'Pub with garden',sub:'Bar, lounge and beer garden',make:()=>k({areas:[{name:'Bar',dogs:!0,tables:[[1,2],[2,4],[3,4],[4,2],[5,4],[6,6]],fixtures:[{kind:'bar',x:250,y:25,w:500,h:75}]},{name:'Lounge',tables:[[7,4],[8,4],[9,2],[10,6],[11,4],[12,2],[13,4],[14,8]],fixtures:[T(150,700)]},{name:'Beer garden',dogs:!0,outdoor:!0,tables:[[20,6],[21,6],[22,4],[23,4],[24,6],[25,6]]}]})},{id:'restaurant',name:'Restaurant and terrace',sub:'Dining room with an outdoor terrace',make:()=>k({areas:[{name:'Dining room',tables:[[1,2],[2,2],[3,4],[4,4],[5,4],[6,6],[7,2],[8,2],[9,4],[10,4],[11,6],[12,8]],fixtures:[T(100,800),A(450,600)]},{name:'Terrace',outdoor:!0,tables:[[20,2],[21,4],[22,4],[23,2]]}]})},{id:'blank',name:'Blank',sub:'One empty room to start from',make:()=>k({areas:[{name:'Main room',tables:[]}]})}];const C=(e,t)=>{const n=t?e.tables.filter(e=>e.areaId===t):e.tables;return{tables:n.length,seats:n.reduce((e,t)=>e+t.maxSeats,0)}},B=(e,t)=>void 0!==t.dogOk?t.dogOk:!!e.areas.find(e=>e.id===t.areaId)?.dogs,L=e=>new Set(e.tables.filter(t=>B(e,t)).map(e=>e.name)),q=(e,t)=>e.areas.find(n=>n.id===e.tables.find(e=>e.name===t)?.areaId);function E(e,t){return e.areas.filter(e=>!t||e.id===t).flatMap(t=>(t.best??[]).filter(n=>e.tables.some(e=>e.name===n&&e.areaId===t.id)))}const _=(e,t)=>E(e).includes(t)},1022,[808,17]); +__d(function(g,r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"FALLBACK_PAY",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"ymdOf",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"dateOf",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"plusDays",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"daysBetween",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"isValidYmd",{enumerable:!0,get:function(){return y}}),_e.cleanPay=function(t){const n={...e,...t??{}};return{tipsFrequency:['weekly','fortnightly','monthly'].includes(n.tipsFrequency)?n.tipsFrequency:'fortnightly',tipsAnchorPayday:y(String(n.tipsAnchorPayday))?n.tipsAnchorPayday:e.tipsAnchorPayday,tipsEndsDaysBefore:Math.max(0,Math.min(13,Math.round(Number(n.tipsEndsDaysBefore)||0))),wagePayDay:Math.max(1,Math.min(31,Math.round(Number(n.wagePayDay)||28))),wageCutoffDay:Math.max(1,Math.min(28,Math.round(Number(n.wageCutoffDay)||1))),weekendRule:'before'===n.weekendRule||'after'===n.weekendRule?n.weekendRule:'none'}},_e.adjustWeekend=s,_e.wagePeriod=f,_e.tipsPeriod=m,_e.nextToPay=function(e,t,n){for(let a=-2;a<=2;a++){const u='wage'===t?f(e,n,a):m(e,n,a);if((u.payday??u.end)>=n)return{period:u,offset:a}}return{period:'wage'===t?f(e,n,0):m(e,n,0),offset:0}},_e.customPeriod=function(e,t){return{kind:'custom',start:e,end:t,key:`c-${e}-${t}`}},Object.defineProperty(_e,"ukDate",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"dayMonth",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"dm",{enumerable:!0,get:function(){return M}}),Object.defineProperty(_e,"rangeText",{enumerable:!0,get:function(){return $}}),_e.parseUk=function(e){const n=e.trim();if(y(n))return n;const a=/^(\d{1,2})[/.-](\d{1,2})[/.-](\d{2}|\d{4})$/.exec(n);if(!a)return null;const u=`${2===a[3].length?2e3+Number(a[3]):Number(a[3])}-${t(Number(a[2]))}-${t(Number(a[1]))}`;return y(u)?u:null},Object.defineProperty(_e,"decH",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"hMm",{enumerable:!0,get:function(){return F}});const e={tipsFrequency:'weekly',tipsAnchorPayday:'2026-01-05',tipsEndsDaysBefore:1,wagePayDay:31,wageCutoffDay:1,weekendRule:'none'},t=e=>String(e).padStart(2,'0'),n=e=>`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}`,a=e=>{const[t,n,a]=e.split('-').map(Number);return new Date(t,n-1,a,12)},u=(e,t)=>{const u=a(e);return u.setDate(u.getDate()+t),n(u)},o=(e,t)=>Math.round((a(t).getTime()-a(e).getTime())/864e5),i=(e,t)=>new Date(e,t+1,0).getDate(),c=(e,t,a)=>{const u=new Date(e,t,1,12),o=u.getFullYear(),c=u.getMonth();return n(new Date(o,c,Math.min(a,i(o,c)),12))},y=e=>/^\d{4}-\d{2}-\d{2}$/.test(e)&&n(a(e))===e;function s(e,t="none"){if('none'===t)return e;const n=a(e).getDay();return 6===n?u(e,'before'===t?-1:2):0===n?u(e,'before'===t?-2:1):e}function d(e,t,n){const o=c(t,n,e.wageCutoffDay),i=u(c(t,n+1,e.wageCutoffDay),-1),y=a(i);let d=c(y.getFullYear(),y.getMonth(),e.wagePayDay);return dn.end))break;a++}}return a}function m(e,t,n=0){return p(e,h(e,t)+n)}const b=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],D=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],w=e=>{const[t,n,a]=e.split('-');return`${a}/${n}/${t}`},P=e=>{const t=a(e);return`${b[t.getDay()]} ${t.getDate()} ${D[t.getMonth()]}`},M=e=>{const t=a(e);return`${t.getDate()} ${D[t.getMonth()]}`},$=(e,t,n=" to ")=>e.slice(0,4)===t.slice(0,4)?`${M(e)}${n}${M(t)}`:`${M(e)} ${e.slice(0,4)}${n}${M(t)} ${t.slice(0,4)}`;const k=e=>(Math.round(e/60*100)/100).toFixed(2),F=e=>`${Math.floor(e/60)}:${t(Math.round(e)%60)}`},1023,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return f}});var e,t=r(d[0]),u=(e=t)&&e.__esModule?e:{default:e},n=r(d[1]),f={getItem:e=>u.default.getItem((0,n.venueKey)(e)),setItem:(e,t)=>u.default.setItem((0,n.venueKey)(e),t),removeItem:e=>u.default.removeItem((0,n.venueKey)(e))}},1024,[1126,5]); +__d(function(g,_r,i,_a3,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"combine",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"createJSONStorage",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"devtools",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"persist",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"redux",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"subscribeWithSelector",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"unstable_ssrSafe",{enumerable:!0,get:function(){return S}});const e=(e,t)=>(n,r,o)=>(o.dispatch=t=>(n(n=>e(n,t),!1,t),t),o.dispatchFromDevtools=!0,{dispatch:(...e)=>o.dispatch(...e),...t}),t=e=>!!e.dispatchFromDevtools&&"function"==typeof e.dispatch,n=new Map,r=e=>{const t=n.get(e);return t?Object.fromEntries(Object.entries(t.stores).map(([e,t])=>[e,t.getState()])):{}},o=(e,t,r)=>{if(void 0===e)return{type:"untracked",connection:t.connect(r)};const o=n.get(r.name);if(o)return{type:"tracked",store:e,...o};const s={connection:t.connect(r),stores:{}};return n.set(r.name,s),{type:"tracked",store:e,...s}},s=(e,t,r)=>{if(void 0===t)return;const o=n.get(e);(null==o?void 0:o.stores[t])===r&&(delete o.stores[t],0===Object.keys(o.stores).length&&n.delete(e))},a=/^at (?:new |async )?(.+?) \(/,l=/^([^@]+)@/;function c(e){var t,n,r;if(!e)return;const o=e.split("\n"),s=o.findIndex(e=>e.includes("api.setState"));if(s<0)return;const c=(null==(t=o[s+1])?void 0:t.trim())||"";return(null==(n=a.exec(c))?void 0:n[1])||(null==(r=l.exec(c))?void 0:r[1])}const u=(e,a={})=>(l,u,p)=>{const{enabled:f,anonymousActionType:y,store:h,...b}=a;let S;try{S=(null!=f?f:"production"!==(globalThis.__ExpoImportMetaRegistry.env?globalThis.__ExpoImportMetaRegistry.env.MODE:void 0))&&window.__REDUX_DEVTOOLS_EXTENSION__}catch(e){}if(!S)return e(l,u,p);const{connection:O,..._}=o(h,S,b);let w,E=!0;p.setState=(e,t,n)=>{const o=l(e,t);if(!E)return o;const s=void 0===n?{type:y||c((new Error).stack)||"anonymous"}:"string"==typeof n?{type:n}:n;return void 0===h?(null==O||O.send(s,u()),o):(null==O||O.send({...s,type:`${h}/${s.type}`},{...r(b.name),[h]:p.getState()}),o)},p.devtools={cleanup:()=>{null==w||w(),w=void 0,s(b.name,h,p),void 0!==h&&n.has(b.name)||!O||"function"!=typeof O.unsubscribe||O.unsubscribe()}};const I=(...e)=>{const t=E;E=!1,l(...e),E=t},j=e(p.setState,u,p);if("untracked"===_.type?null==O||O.init(j):(_.stores[_.store]=p,null==O||O.init(Object.fromEntries(Object.entries(_.stores).map(([e,t])=>[e,e===_.store?j:t.getState()])))),t(p)){let e=!1;const t=p.dispatch;p.dispatch=(...n)=>{"production"===(globalThis.__ExpoImportMetaRegistry.env?globalThis.__ExpoImportMetaRegistry.env.MODE:void 0)||"__setState"!==n[0].type||e||(console.warn('[zustand devtools middleware] "__setState" action type is reserved to set state from the devtools. Avoid using it.'),e=!0),t(...n)}}return w=O.subscribe(e=>{var n;const o="object"==typeof b.serialize?b.serialize.reviver:void 0;switch(e.type){case"ACTION":return"string"!=typeof e.payload?void console.error("[zustand devtools middleware] Unsupported action format"):v(e.payload,o,e=>{if("__setState"===e.type){if(void 0===h)return void I(e.state);1!==Object.keys(e.state).length&&console.error("\n [zustand devtools middleware] Unsupported __setState action format.\n When using 'store' option in devtools(), the 'state' should have only one key, which is a value of 'store' that was passed in devtools(),\n and value of this only key should be a state object. Example: { \"type\": \"__setState\", \"state\": { \"abc123Store\": { \"foo\": \"bar\" } } }\n ");const t=e.state[h];if(null==t)return;return void(JSON.stringify(p.getState())!==JSON.stringify(t)&&I(t))}t(p)&&p.dispatch(e)});case"DISPATCH":switch(e.payload.type){case"RESET":return I(j),void 0===h?null==O?void 0:O.init(p.getState()):null==O?void 0:O.init(r(b.name));case"COMMIT":return void 0===h?void(null==O||O.init(p.getState())):null==O?void 0:O.init(r(b.name));case"ROLLBACK":return v(e.state,o,e=>{if(void 0===h)return I(e),void(null==O||O.init(p.getState()));I(e[h]),null==O||O.init(r(b.name))});case"JUMP_TO_STATE":case"JUMP_TO_ACTION":return v(e.state,o,e=>{void 0!==h?JSON.stringify(p.getState())!==JSON.stringify(e[h])&&I(e[h]):I(e)});case"IMPORT_STATE":{const{nextLiftedState:t}=e.payload,r=null==(n=t.computedStates.slice(-1)[0])?void 0:n.state;if(!r)return;return I(void 0===h?r:r[h]),void(null==O||O.send(null,t))}case"PAUSE_RECORDING":return E=!E}return}}),j},v=(e,t,n)=>{let r;try{r=JSON.parse(e,t)}catch(e){console.error("[zustand devtools middleware] Could not parse the received json",e)}void 0!==r&&n(r)},p=e=>(t,n,r)=>{const o=r.subscribe;r.subscribe=(e,t,n)=>{let s=e;if(t){const o=(null==n?void 0:n.equalityFn)||Object.is;let a=e(r.getState());s=n=>{const r=e(n);if(!o(a,r)){const e=a;t(a=r,e)}},(null==n?void 0:n.fireImmediately)&&t(a,a)}return o(s)};return e(t,n,r)};function f(e,t){return(...n)=>Object.assign({},e,t(...n))}function y(e,t){let n;try{n=e()}catch(e){return}return{getItem:e=>{var r;const o=e=>null===e?null:JSON.parse(e,null==t?void 0:t.reviver),s=null!=(r=n.getItem(e))?r:null;return s instanceof Promise?s.then(o):o(s)},setItem:(e,r)=>n.setItem(e,JSON.stringify(r,null==t?void 0:t.replacer)),removeItem:e=>n.removeItem(e)}}const h=e=>t=>{try{const n=e(t);return n instanceof Promise?n:{then:e=>h(e)(n),catch(e){return this}}}catch(e){return{then(e){return this},catch:t=>h(t)(e)}}},b=(e,t)=>(n,r,o)=>{let s={storage:y(()=>window.localStorage),partialize:e=>e,version:0,merge:(e,t)=>({...t,...e}),...t},a=!1,l=0;const c=new Set,u=new Set;let v=s.storage;if(!v)return e((...e)=>{console.warn(`[zustand persist middleware] Unable to update item '${s.name}', the given storage is currently unavailable.`),n(...e)},r,o);const p=()=>{const e=s.partialize({...r()});return v.setItem(s.name,{state:e,version:s.version})},f=o.setState;o.setState=(...e)=>(f(...e),p());const b=e((...e)=>(n(...e),p()),r,o);let S;o.getInitialState=()=>b;const O=()=>{var e,t;if(!v)return;const o=++l;a=!1,c.forEach(e=>{var t;return e(null!=(t=r())?t:b)});const f=(null==(t=s.onRehydrateStorage)?void 0:t.call(s,null!=(e=r())?e:b))||void 0;return h(v.getItem.bind(v))(s.name).then(e=>{if(e){if("number"!=typeof e.version||e.version===s.version)return[!1,e.state];if(s.migrate){const t=s.migrate(e.state,e.version);return t instanceof Promise?t.then(e=>[!0,e]):[!0,t]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}return[!1,void 0]}).then(e=>{var t;if(o!==l)return;const[a,c]=e;return S=s.merge(c,null!=(t=r())?t:b),n(S,!0),a?p():void 0}).then(()=>{o===l&&(null==f||f(r(),void 0),S=r(),a=!0,u.forEach(e=>e(S)))}).catch(e=>{o===l&&(null==f||f(void 0,e))})};return o.persist={setOptions:e=>{s={...s,...e},e.storage&&(v=e.storage)},clearStorage:()=>{++l,null==v||v.removeItem(s.name)},getOptions:()=>s,rehydrate:()=>O(),hasHydrated:()=>a,onHydrate:e=>(c.add(e),()=>{c.delete(e)}),onFinishHydration:e=>(u.add(e),()=>{u.delete(e)})},s.skipHydration||O(),S||b};function S(e,t="undefined"==typeof window){return(n,r,o)=>{if(!t)return e(n,r,o);const s=()=>{throw new Error("Cannot set state of Zustand store in SSR")};return o.setState=s,e(s,r,o)}}},1025,[]); +__d(function(g,r,i,a,m,e,_d){"use strict";function t(t,n){const o={};for(let c=0;c<7;c++){o[c]={};const u=n[c]??0;for(const[n,s]of Object.entries(t))o[c][Number(n)]=Math.round(s*u)}return o}Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"EXAMPLE_HISTORY",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"EXAMPLE_ACCURACY",{enumerable:!0,get:function(){return f}});const n={12:18,13:26,14:16,15:9,16:10,17:22,18:36,19:38,20:20},o={12:2,13:2,14:1,15:1,16:2,17:4,18:6,19:5,20:2},c={0:1.05,1:0,2:0,3:.6,4:.7,5:1,6:1.15},u={0:.6,1:.5,2:.5,3:.6,4:.7,5:.9,6:1},s={anchorage:{covers:t(n,c),takeaway:t(o,c)},default:{covers:t(n,u),takeaway:t(o,u)}},f='Example: last 4 weeks within \xb118% of actual covers'},1026,[]); +__d(function(g,r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.ConfirmTimeline=function({refId:e,noPhone:o}){const m=(0,s.useStore)((0,n.useShallow)(o=>o.outbox.filter(o=>o.refId===e))).slice().sort((e,o)=>e.at.localeCompare(o.at));return m.length?(0,a.jsx)(t.default,{testID:"confirm-timeline",style:{borderLeftWidth:2,borderColor:u.colours.gold,paddingLeft:10,gap:3},children:m.map(e=>(0,a.jsxs)(t.default,{style:{flexDirection:'row',gap:6,alignItems:'center'},children:[(0,a.jsx)(t.default,{style:{width:7,height:7,borderRadius:4,marginLeft:-14.5,backgroundColor:'sent'===e.status?u.colours.ok:'failed'===e.status?u.colours.red:u.colours.amber}}),(0,a.jsx)(c.T,{size:12,colour:u.colours.muted,children:e.at.slice(11,16)}),(0,a.jsxs)(c.T,{size:12,children:[f[e.kind],": ",(0,l.statusLabel)(e)]})]},e.id))}):o?(0,a.jsx)(c.T,{size:12,colour:u.colours.muted,children:"Confirmation: no phone number, so no text"}):null},r(d[0]);var e,o=r(d[1]),t=(e=o)&&e.__esModule?e:{default:e},n=r(d[2]),s=r(d[3]),l=r(d[4]),u=r(d[5]),c=r(d[6]),a=r(d[7]);const f={'booking-request':'Request received','booking-confirmation':'Confirmation','booking-declined':'Declined','order-confirmation':'Order confirmation',test:'Test'}},1027,[30,127,871,819,823,821,813,24]); +__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AllergenSignOffLog=function(){const{rid:e,me:n}=(0,y.useCtx)(1e4),j=(0,c.useOrders)(e).filter(e=>e.allergies.length&&'cancelled'!==e.status),v=(0,c.useBookings)(e),k=(0,c.useAudit)(e).filter(e=>'allergy'===e.kind),[w,C]=(0,l.useState)('all'),A=j.map(e=>({o:e,bk:(0,u.linkedBooking)(e,v)})).map(e=>({...e,next:(0,u.nextStep)(e.o,e.bk)})).filter(e=>'all'===w||('open'===w?!!e.next:!e.next));return(0,b.jsxs)(s.default,{style:{gap:10},testID:"allergen-signoff-log",children:[(0,b.jsx)(o.Banner,{kind:"info",title:"Five sign-offs for every guest allergy",children:"1. Booked (allergy recorded) \xb7 2. Ordered (server confirms with the guest) \xb7 3. Kitchen (chef, before cooking) \xb7 4. Pass (before it leaves) \xb7 5. Table (when served). A ticket can\u2019t move on until the previous step is signed off."}),(0,b.jsx)(o.Row,{gap:6,children:['all','open','complete'].map(e=>(0,b.jsx)(o.Chip,{label:'all'===e?'All':'open'===e?'Waiting':'Complete',selected:w===e,onPress:()=>C(e)},e))}),A.length?A.map(({o:e,bk:l,next:s})=>{const c=(0,u.orderChain)(e,l);return(0,b.jsxs)(o.Card,{children:[(0,b.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsxs)(o.T,{weight:"semibold",children:[e.ref," \xb7 ",'table'===e.type?`${(0,t.tableNumbers)(e.tableNo)}`:'Takeaway',l?` \xb7 booking ${l.ref}`:'']}),(0,b.jsx)(o.Badge,{kind:s?'red':'ok',label:s?'Waiting':'Complete'})]}),(0,b.jsxs)(o.Muted,{children:[e.allergies.map(e=>`${(0,h.allergenLabel)(e.allergen)} (${(0,h.severityLabel)(e.severity)})`).join(', ')," \xb7 ",(0,p.niceDate)(new Date(e.createdAt))]}),(0,b.jsx)(a.AllergyChain,{o:e,me:n,readOnly:!0,compact:!0}),u.CHAIN_STEPS.map(e=>(0,b.jsxs)(o.Muted,{children:[e.n,". ",e.label,": ",c[e.id]?`${c[e.id].by.replace(' (example)','')} at ${(0,p.hm)(new Date(c[e.id].at))}`:'not signed yet']},e.id))]},e.id)}):(0,b.jsxs)(o.Muted,{children:["No allergy orders",'all'===w?'':' in this view',"."]}),(0,b.jsx)(x.SectionHead,{title:"Allergen audit log",sub:"Every sign-off with the person's name and the time"}),(0,b.jsx)(s.default,{testID:"allergen-audit-log",style:{gap:4},children:k.length?k.slice(0,40).map(e=>(0,b.jsxs)(o.Muted,{children:[(0,p.niceDate)(new Date(e.at))," ",(0,p.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,b.jsx)(o.Muted,{children:"No allergen events yet."})}),(0,b.jsx)(o.Muted,{children:"Prototype: stored on this device. In the live service the log is kept with your venue\u2019s records."}),void f.colours]})};var e,t=r(d[0]),l=r(d[1]),n=r(d[2]),s=(e=n)&&e.__esModule?e:{default:e},a=r(d[3]),o=r(d[4]),c=r(d[5]),h=r(d[6]),u=r(d[7]),p=r(d[8]),f=r(d[9]),x=r(d[10]),y=r(d[11]),b=r(d[12])},1028,[808,30,127,986,813,819,814,987,818,821,953,954,24]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.BlocksPage=function(){const{rid:o,r:t,now:s,me:u}=(0,n.useCtx)(3e4);return(0,c.jsx)(r.BlocksScreen,{rid:o,r:t,now:s,by:u.replace(' (example)','')})},_r(d[0]);var r=_r(d[1]),n=_r(d[2]),c=_r(d[3])},1029,[30,1438,954,24]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useWeekSales=F,_e.Rota=function(){const{now:e,role:t,meId:n}=(0,C.useCtx)(6e4),o=(0,f.useOwner)(e=>e.staff).filter(e=>e.active),i=(0,f.useOwner)(e=>e.shifts),h=(0,C.useHourly)(),m=(0,f.useOwner)(e=>e.availability),p=(0,f.useOwner)(e=>e.leave),x=(0,f.useOwner)(e=>e.swaps),[I,v]=(0,l.useState)(0),[D,T]=(0,l.useState)(null),[$,M]=(0,l.useState)(null),[R,P]=(0,l.useState)('week'),[z,H]=(0,l.useState)(''),[W,E]=(0,l.useState)(''),[_,q]=(0,l.useState)(''),K='staff'!==t,U=(0,b.addMins)(L(e),7*I*1440);U.setHours(0,0,0,0);const V=F(U),G=V.sales,X='none'===V.mode,J=Array.from({length:7},(e,t)=>{const s=new Date(U);return s.setDate(U.getDate()+t),(0,b.ymd)(s)}),Q=(0,f.visibleShifts)(i,K).filter(e=>e.date>=J[0]&&e.date<=J[6]),Z=(()=>{const e=new Date(U);return e.setDate(e.getDate()-7),(0,b.ymd)(e)})(),ee=Q.filter(e=>!e.published||e.changed).length,te=i.filter(e=>e.date>=Z&&e.datep.some(s=>s.staffId===e&&'approved'===s.status&&s.from<=t&&t<=s.to),ne=J.map(e=>Q.filter(t=>t.date===e).reduce((e,t)=>{return e+(A(s=t)-Y(A(s)))*(h[s.staffId]??0);var s},0)),ae=ne.reduce((e,t)=>e+t,0),oe=G.reduce((e,t)=>e+t,0),ie=(e,t)=>t?Math.round(e/t*100):0,le=K?o:o.filter(e=>e.id===n),re=(0,a.useNarrow)(),de=Math.max(0,J.indexOf((0,b.ymd)(e))),[ce,ue]=(0,l.useState)(null),he=ce??de,fe=(e,t)=>!re||t===he,me=re?150:74;return(0,B.jsxs)(c.default,{style:{gap:10},children:[(0,B.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,B.jsx)(u.Chip,{label:"Week",selected:'week'===R,onPress:()=>P('week')}),(0,B.jsx)(u.Chip,{label:`Swaps & leave (${x.filter(e=>'open'===e.status).length+p.filter(e=>'pending'===e.status).length})`,selected:'requests'===R,onPress:()=>P('requests')}),(0,B.jsx)(u.Chip,{label:"Availability",selected:'availability'===R,onPress:()=>P('availability')})]}),'week'===R?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsx)(u.Button,{small:!0,kind:"ghost",label:"\u2039 Prev",accessibilityLabel:"Previous week",onPress:()=>{v(I-1),T(null)}}),(0,B.jsxs)(c.default,{style:{alignItems:'center',flex:1},children:[(0,B.jsxs)(u.T,{weight:"semibold",children:["Week of ",(0,b.niceDate)(U)]}),(0,B.jsxs)(u.Muted,{children:[0===I?'This week':1===I?'Next week':-1===I?'Last week':I>0?`In ${I} weeks`:-I+" weeks ago",K?' \xb7 tap a cell to add or edit':' \xb7 your shifts']})]}),(0,B.jsx)(u.Button,{small:!0,kind:"ghost",label:"Next \u203a",accessibilityLabel:"Next week",onPress:()=>{v(I+1),T(null)}})]}),K?(0,B.jsxs)(u.Row,{wrap:!0,gap:8,style:{alignItems:'center'},children:[(0,B.jsx)(u.Button,{small:!0,kind:"secondary",label:"Copy last week"+(te?` (${te})`:''),disabled:!te,testID:"rota-copy",onPress:()=>{const e=f.useOwner.getState().copyWeek(Z,J[0]);T(e?`Copied ${e} ${1===e?'shift':'shifts'} from last week as drafts. Check them, then publish.`:'Nothing to copy: those days are already filled.')}}),(0,B.jsx)(u.Button,{small:!0,kind:"success",label:ee?`Publish ${ee} ${1===ee?'change':'changes'}`:'Week published',disabled:!ee,testID:"rota-publish",onPress:()=>{const e=f.useOwner.getState().publishWeek(J[0]);T(`Published ${e} ${1===e?'shift':'shifts'}. Staff see them in their app.`)}}),ee?(0,B.jsx)(u.Badge,{kind:"amber",label:`${ee} unpublished`}):Q.length?(0,B.jsx)(u.Badge,{kind:"ok",label:"Visible to staff"}):null]}):null,D?(0,B.jsx)(u.Banner,{kind:"success",title:D}):null,re?(0,B.jsx)(u.Row,{wrap:!0,gap:6,children:C.DAY3.map((e,t)=>(0,B.jsx)(u.Chip,{label:`${e} ${(0,b.parseYmd)(J[t]).getDate()}`,selected:t===he,onPress:()=>ue(t)},e))}):null,(0,B.jsx)(d.default,{horizontal:!re,showsHorizontalScrollIndicator:!0,children:(0,B.jsxs)(c.default,{style:{gap:4},children:[(0,B.jsxs)(u.Row,{gap:4,children:[(0,B.jsx)(c.default,{style:{width:126}}),C.DAY3.map((t,s)=>(0,B.jsx)(c.default,{style:{width:me,alignItems:'center'},children:(0,B.jsxs)(u.T,{size:12,weight:"semibold",colour:J[s]===(0,b.ymd)(e)?w.colours.gold:w.colours.text,children:[t," ",(0,b.parseYmd)(J[s]).getDate()]})},t)).filter(fe)]}),le.map(e=>(0,B.jsxs)(u.Row,{gap:4,children:[(0,B.jsxs)(u.Row,{gap:6,style:{width:126},children:[(0,B.jsx)(S.StaffAvatar,{id:e.id,size:26}),(0,B.jsxs)(c.default,{style:{flex:1},children:[(0,B.jsx)(u.T,{size:12,numberOfLines:1,children:e.name.replace(' (example)','')}),(0,B.jsx)(u.Muted,{numberOfLines:1,children:e.job})]})]}),C.DAY3.map((t,s)=>{const n=(0,f.shiftOf)(Q,e.id,J[s]),a=(m[e.id]??[]).includes(s),o=se(e.id,J[s]);return(0,B.jsxs)(r.default,{accessibilityRole:"button",accessibilityLabel:`${e.name} ${C.DAY3[s]} ${n?`${(0,C.fmtH)(n.start)} to ${(0,C.fmtH)(n.end)}`:'no shift'}`,disabled:!K,onPress:()=>M({staffId:e.id,date:J[s],shift:n}),style:{width:me,height:48,borderRadius:10,borderWidth:1,borderStyle:n&&!n.published?'dashed':'solid',borderColor:n?n.published?w.colours.gold:w.colours.amber:w.colours.border,backgroundColor:n?n.published?'#2b2414':'#241f14':o?'#1d2a3a':a?'#2a1d1d':'transparent',alignItems:'center',justifyContent:'center'},children:[n?(0,B.jsxs)(u.T,{size:11,weight:"semibold",children:[(0,C.fmtH)(n.start),"\u2013",(0,C.fmtH)(n.end)]}):(0,B.jsx)(u.T,{size:11,colour:w.colours.muted,children:o?'Leave':a?'Unavail.':K?'Add':'\u2013'}),n&&(a||o)?(0,B.jsx)(u.T,{size:9,colour:w.colours.red,children:o?'on leave!':'unavailable'}):n&&K&&(!n.published||n.changed)?(0,B.jsx)(u.T,{size:9,colour:w.colours.amber,children:n.published?'changed':'draft'}):null]},s)}).filter(fe)]},e.id)),K?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(u.Row,{gap:4,children:[(0,B.jsx)(c.default,{style:{width:96},children:(0,B.jsx)(u.Muted,{children:"Labour"})}),ne.map((e,t)=>(0,B.jsx)(c.default,{style:{width:me,alignItems:'center'},children:(0,B.jsx)(u.T,{size:11,children:(0,j.gbp)(e).replace('.00','')})},t)).filter(fe)]}),X?null:(0,B.jsxs)(u.Row,{gap:4,children:[(0,B.jsx)(c.default,{style:{width:96},children:(0,B.jsx)(u.Muted,{children:'example'===V.mode?'Fcst sales (ex.)':'Fcst sales'})}),G.map((e,t)=>(0,B.jsx)(c.default,{style:{width:me,alignItems:'center'},children:(0,B.jsx)(u.T,{size:11,colour:w.colours.muted,children:e?`\xa3${Math.round(e/100)}`:'shut'})},t)).filter(fe)]}),X?null:(0,B.jsxs)(u.Row,{gap:4,children:[(0,B.jsx)(c.default,{style:{width:96},children:(0,B.jsx)(u.Muted,{children:"Labour %"})}),ne.map((e,t)=>{const s=ie(e,G[t]);return(0,B.jsx)(c.default,{style:{width:me,alignItems:'center'},children:(0,B.jsx)(u.T,{size:11,weight:"semibold",colour:G[t]?s>32?w.colours.red:s>26?w.colours.amber:w.colours.ok:w.colours.muted,children:G[t]?`${s}%`:'\u2013'})},t)}).filter(fe)]})]}):null]})}),K&&X?(0,B.jsx)(u.Card,{children:(0,B.jsxs)(c.default,{testID:"labour-no-forecast",style:{gap:6},children:[(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsx)(u.T,{weight:"semibold",children:"Labour this week"}),(0,B.jsx)(c.default,{testID:"labour-week-cost",children:(0,B.jsx)(u.T,{weight:"semibold",children:(0,j.gbp)(ae)})})]}),(0,B.jsxs)(u.Muted,{children:[(0,j.gbp)(ae)," labour from the rota (paid hours \xd7 hourly rates, owner salaries excluded)."]}),(0,B.jsx)(u.T,{weight:"semibold",colour:w.colours.gold,children:"Not enough history yet for labour vs sales"}),(0,B.jsx)(u.Muted,{children:`Forecasts start once CoverCharge has ${1===V.weeks?'1 week':`${V.weeks} weeks`} of your bookings and cash-ups. Until then no sales forecast or labour % is shown.`}),V.booked?(0,B.jsx)(c.default,{testID:"labour-booked",children:(0,B.jsxs)(u.T,{children:["Booked so far: ",V.booked," covers this week"]})}):null]})}):null,K&&!X?(0,B.jsxs)(u.Card,{children:[(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsx)(u.T,{weight:"semibold",children:"Labour vs forecast sales"}),(0,B.jsxs)(u.Row,{gap:6,children:['example'===V.mode?(0,B.jsx)(O.ExampleBadge,{}):null,(0,B.jsx)(u.Badge,{kind:ie(ae,oe)>30?'red':'ok',label:`${ie(ae,oe)}% this week`})]})]}),(0,B.jsxs)(u.Muted,{children:[(0,j.gbp)(ae)," labour (paid hours \xd7 hourly rates, owner salaries excluded) vs about ",(0,j.gbp)(oe)," forecast sales. Target 25\u201330%. ",'example'===V.mode?'Example figures: forecast sales use an example spend per cover.':'Forecast sales are your average takings for each weekday from your cash-ups.']}),(()=>{const e=ie(ne[5],G[5]);return e&&e<24?(0,B.jsxs)(u.T,{size:14,colour:w.colours.gold,children:["Tip: Saturday is forecast busy and labour is only ",e,"%. Consider an extra server 18:00\u201321:00."]}):null})()]}):null,K?(0,B.jsx)(u.Muted,{center:!0,children:"New and copied shifts are drafts (dashed) until you publish. Publishing only makes shifts visible in the Staff app and on the Display. Nothing is sent by text or email."}):null]}):null,'requests'===R?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(k.SectionHead,{title:"Shift swaps & cover"}),x.filter(e=>K||e.fromId===n||e.toId===n).map(e=>{const t=i.find(t=>t.id===e.shiftId),s=o.find(t=>t.id===e.fromId),n=o.find(t=>t.id===e.toId);return(0,B.jsxs)(u.Card,{children:[(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsxs)(u.T,{weight:"semibold",style:{flex:1},children:['swap'===e.kind?'Swap':'Cover needed',": ",s?.name]}),(0,B.jsx)(u.Badge,{kind:'open'===e.status?'amber':'approved'===e.status?'ok':'neutral',label:e.status})]}),(0,B.jsxs)(u.Muted,{children:[t?`${C.DAY3[t.day]} ${(0,C.fmtH)(t.start)}\u2013${(0,C.fmtH)(t.end)}`:'Shift',n?` \u2192 ${n.name}`:''," \xb7 ",e.note]}),'open'===e.status&&K?(0,B.jsxs)(u.Row,{gap:6,children:['cover'!==e.kind||e.toId?null:o.filter(t=>t.id!==e.fromId&&'owner'!==t.role).map(t=>(0,B.jsx)(u.Chip,{label:`Give to ${t.name.split(' ')[0]}`,onPress:()=>{f.useOwner.setState(s=>({swaps:s.swaps.map(s=>s.id===e.id?{...s,toId:t.id}:s)}))}},t.id)),(0,B.jsx)(u.Button,{small:!0,label:"Approve",disabled:!e.toId,onPress:()=>{f.useOwner.getState().setSwap(e.id,'approved');const s=e=>(o.find(t=>t.id===e)?.name??'').replace(' (example)','');(0,y.autoPost)('all','swap'===e.kind?`Shift swap: ${s(e.fromId)} \u2194 ${s(e.toId)} approved`:`Cover approved: ${s(e.toId)} covers ${s(e.fromId)}${t?` (${C.DAY3[t.day]} ${(0,C.fmtH)(t.start)}\u2013${(0,C.fmtH)(t.end)})`:''}`)}}),(0,B.jsx)(u.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>f.useOwner.getState().setSwap(e.id,'declined')})]}):null]},e.id)}),K?null:(0,B.jsxs)(u.Card,{children:[(0,B.jsx)(u.T,{weight:"semibold",children:"Ask for a swap or cover"}),(0,B.jsx)(u.Muted,{children:"Your shifts this week. Your manager approves every swap."}),Q.filter(e=>e.staffId===n).sort((e,t)=>e.date.localeCompare(t.date)).map(e=>{const t=x.some(t=>t.shiftId===e.id&&'open'===t.status);return(0,B.jsxs)(c.default,{style:{gap:4,paddingVertical:4},children:[(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsxs)(u.T,{size:14,weight:"medium",children:[C.DAY3[e.day]," ",(0,C.fmtH)(e.start),"\u2013",(0,C.fmtH)(e.end)]}),t?(0,B.jsx)(u.Badge,{kind:"amber",label:"Request open"}):null]}),t?null:(0,B.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,B.jsx)(u.Chip,{label:"Ask for cover",onPress:()=>{f.useOwner.getState().addSwap({shiftId:e.id,fromId:n,kind:'cover',note:'Can anyone cover?'}),(0,y.autoPost)('all',`Cover needed: ${C.DAY3[e.day]} ${(0,C.fmtH)(e.start)}\u2013${(0,C.fmtH)(e.end)} (${(o.find(e=>e.id===n)?.name??'').replace(' (example)','')})`)}}),o.filter(e=>e.id!==n&&'staff'===e.role).map(t=>(0,B.jsx)(u.Chip,{label:`Swap with ${t.name.replace(' (example)','')}`,onPress:()=>f.useOwner.getState().addSwap({shiftId:e.id,fromId:n,toId:t.id,kind:'swap',note:'Agreed between us'})},t.id))]})]},e.id)}),Q.some(e=>e.staffId===n)?null:(0,B.jsx)(u.Muted,{children:"No shifts on the rota this week."})]}),(0,B.jsx)(k.SectionHead,{title:"Holiday & leave"}),p.filter(e=>K||e.staffId===n).map(e=>(0,B.jsxs)(u.Card,{children:[(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsx)(u.T,{weight:"semibold",children:o.find(t=>t.id===e.staffId)?.name}),(0,B.jsx)(u.Badge,{kind:'pending'===e.status?'amber':'approved'===e.status?'ok':'red',label:e.status})]}),(0,B.jsxs)(u.Muted,{children:[(0,b.niceDate)((0,b.parseYmd)(e.from))," \u2013 ",(0,b.niceDate)((0,b.parseYmd)(e.to))," \xb7 ",e.reason]}),'pending'===e.status&&K?(0,B.jsxs)(u.Row,{gap:6,children:[(0,B.jsx)(u.Button,{small:!0,label:"Approve",onPress:()=>f.useOwner.getState().setLeave(e.id,'approved')}),(0,B.jsx)(u.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>f.useOwner.getState().setLeave(e.id,'declined')})]}):null]},e.id)),(0,B.jsxs)(u.Card,{children:[(0,B.jsxs)(u.T,{weight:"semibold",children:["Request leave",K?' (as yourself)':'']}),(0,B.jsxs)(u.Row,{gap:6,children:[(0,B.jsx)(s.TextInput,{accessibilityLabel:"From date",placeholder:"From YYYY-MM-DD",placeholderTextColor:"#7D776C",value:z,onChangeText:H,style:[u.styles.input,{flex:1}]}),(0,B.jsx)(s.TextInput,{accessibilityLabel:"To date",placeholder:"To YYYY-MM-DD",placeholderTextColor:"#7D776C",value:W,onChangeText:E,style:[u.styles.input,{flex:1}]})]}),(0,B.jsx)(u.Field,{label:"Reason",value:_,onChangeText:q}),(0,B.jsx)(u.Button,{small:!0,label:"Send request",disabled:!/^\d{4}-\d{2}-\d{2}$/.test(z)||!/^\d{4}-\d{2}-\d{2}$/.test(W)||W{f.useOwner.getState().addLeave({staffId:n,from:z,to:W,reason:_.trim()||'Holiday'}),H(''),E(''),q('')}})]})]}):null,'availability'===R?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(u.Muted,{children:["Days each person can\u2019t work. ",K?'Tap to toggle.':'Tap to set your own.'," The rota flags clashes."]}),le.filter(e=>'owner'!==e.role||!K).map(e=>(0,B.jsxs)(u.Card,{children:[(0,B.jsxs)(u.Row,{gap:8,children:[(0,B.jsx)(S.StaffAvatar,{id:e.id,size:30}),(0,B.jsx)(u.T,{weight:"semibold",children:e.name})]}),(0,B.jsx)(u.Row,{wrap:!0,gap:4,children:C.DAY3.map((t,s)=>{const n=(m[e.id]??[]).includes(s);return(0,B.jsx)(u.Chip,{label:`${t} ${n?'\u2715':'\u2713'}`,selected:!n,onPress:()=>f.useOwner.getState().toggleAvail(e.id,s)},t)})})]},e.id))]}):null,$?(0,B.jsx)(N,{init:$,onClose:()=>M(null)}):null]})},_e.ClockInOut=function(){const{now:e,today:t,role:s,meId:a,me:d,r:h,rid:m}=(0,C.useCtx)(5e3),x=((0,I.useClockArea)(e=>e.areas[m]),(0,I.areaOf)(m));const j=(0,v.privateClockVenue)(m),[k,y]=(0,l.useState)(!1),O=(0,f.useOwner)(e=>e.consent[a]),R=(0,f.useOwner)(e=>e.attendance),P=(0,f.useOwner)(e=>e.shifts),[z,H]=(0,l.useState)(!1),[A,Y]=(0,l.useState)(null),[L,F]=(0,l.useState)(null),[N,_]=(0,l.useState)(void 0),[q,K]=(0,l.useState)(null),[U,V]=(0,l.useState)(!1),[G,X]=(0,l.useState)(null),J=R.filter(t=>t.staffId===a&&t.in&&!t.out&&e.getTime()-new Date(t.in).getTime()<72e6).sort((e,t)=>t.in.localeCompare(e.in))[0],Q=J&&(0,f.isOnBreak)(J)?J.breaks[J.breaks.length-1]:void 0,Z=(0,f.visibleShifts)(P,'staff'!==s).find(e=>e.staffId===a&&e.date===t),ee='staff'!==s,te=J?(0,C.paidMins)({in:J.in},e).worked:0,se=x.on&&(0,D.areaSet)(x),ne=J?.geo?.[J.geo.length-1],ae=async(s,n={})=>{Y(s),F(null),_(void 0);const l=await(0,T.clockAction)(s,{rid:m,staffId:a,date:t,at:new Date(e.getTime()).toISOString(),...n});return Y(null),l.ok?('out'===s&&l.att&&(K(l.att),(0,i.hrSettingsOf)(h.settings?.hr).on&&!o.useHr.getState().hasAnswered(m,l.att.id)&&X(l.att)),'in'===s&&K(null),!0):(F(l.message),_(l.fix),(0,$.notify)({id:'clock-blocked',tone:'warn',icon:'\ud83d\udccd',kicker:'CLOCK',title:l.message.split('. ')[0]+'.',body:l.message.split('. ').slice(1).join('. '),timeoutMs:9e3,testID:'clock-blocked'}),!1)};return O?(0,B.jsxs)(c.default,{style:{gap:10},children:[(0,B.jsxs)(u.Card,{highlight:w.colours.gold,children:[(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsxs)(u.Row,{gap:10,style:{flex:1},children:[(0,B.jsx)(S.StaffAvatar,{id:a,size:48}),(0,B.jsx)(u.T,{weight:"semibold",style:{flex:1},children:d})]}),(0,B.jsx)(u.Badge,{kind:J?'ok':'neutral',label:J?`On shift since ${(0,b.hm)(new Date(J.in))}`:'Not clocked in'})]}),(0,B.jsx)(u.Muted,{children:Z?`Today's shift: ${(0,C.fmtH)(Z.start)}\u2013${(0,C.fmtH)(Z.end)}`:'No shift on the rota today'}),(0,B.jsx)(c.default,{testID:"clock-area-line",children:(0,B.jsx)(u.T,{size:14,colour:w.colours.muted,children:se?j?`Location is checked only when you choose Clock in, at ${h.name}. Only pass or fail is saved.`:`\ud83d\udccd Your location is checked when you tap a button. You need to be at ${h.name}.`:x.on?'\ud83d\udccd The clock-in area isn\u2019t set yet, so location isn\u2019t checked.':'\ud83d\udccd Location checks are switched off for this venue.'})}),ne&&!0===ne.inside&&null!=ne.dist?(0,B.jsxs)(u.Muted,{children:["Last check: at the venue (about ",ne.dist," m from the centre)."]}):null,J?(0,B.jsx)(u.T,{size:30,weight:"bold",center:!0,children:(0,C.hmDur)(te)}):null,J&&Q?(0,B.jsx)(c.default,{testID:"on-break",children:(0,B.jsxs)(u.T,{size:15,weight:"semibold",colour:w.colours.gold,center:!0,children:["On a break since ",(0,b.hm)(new Date(Q.start))," \xb7 ",(0,f.loggedBreakMins)(J,e)," min so far"]})}):null,J?(0,B.jsxs)(B.Fragment,{children:[Q?(0,B.jsx)(u.Button,{testID:"break-end",kind:"success",label:'break_end'===A?'Checking your location\u2026':'End break',disabled:!!A,onPress:()=>{ae('break_end')}}):(0,B.jsx)(u.Button,{testID:"break-start",kind:"secondary",label:'break_start'===A?'Checking your location\u2026':'Start break',disabled:!!A,onPress:()=>{ae('break_start')}}),(0,B.jsx)(u.Button,{testID:"clock-out",kind:"danger",label:'out'===A?'Checking your location\u2026':'Clock out',disabled:!!A,onPress:()=>{J.breaks?.length?ae('out'):(F(null),H(!0))}})]}):(0,B.jsx)(u.Button,{testID:"clock-in",kind:"success",label:'in'===A?'Checking your location\u2026':'Clock in',disabled:!!A,onPress:()=>{j?y(!0):ae('in')}}),J?.breaks?.length?(0,B.jsxs)(u.Muted,{center:!0,children:["Breaks today: ",J.breaks.map(e=>`${(0,b.hm)(new Date(e.start))}\u2013${e.end?(0,b.hm)(new Date(e.end)):'now'}`).join(', ')," (",(0,f.loggedBreakMins)(J,e)," min)"]}):null,L?(0,B.jsx)(c.default,{testID:"clock-message",children:(0,B.jsx)(u.Banner,{kind:"warn",title:"Not recorded",children:L})}):null,L&&'settings'===N?(0,B.jsx)(u.Button,{testID:"clock-open-settings",label:"Open app settings",accessibilityLabel:"Open app settings, to allow location",onPress:M.openAppSettings}):null,L&&'location'===N?(0,B.jsx)(u.Button,{testID:"clock-open-location",label:"Open location settings",accessibilityLabel:"Open location settings, to turn on location",onPress:M.openLocationSettings}):null,L&&'update'===N?(0,B.jsx)(u.Button,{testID:"clock-check-update",label:"Look for the app update",accessibilityLabel:"Look for the app update",onPress:M.checkAppUpdate}):null]}),ee&&!(0,D.areaSet)(x)?(0,B.jsx)(c.default,{testID:"clock-area-warning",children:(0,B.jsx)(u.Banner,{kind:"warn",title:"Set the clock-in area",children:"Location isn\u2019t checked until a manager sets the venue\u2019s centre. Stand at the venue and go to Settings \u203a Advanced \u203a Clock-in area \u203a Use my current location."})}):null,(0,B.jsx)(r.default,{testID:"forgot-link",accessibilityRole:"button",onPress:()=>V(!0),style:{alignSelf:'center',padding:6},children:(0,B.jsx)(u.T,{size:14,colour:w.colours.gold,children:"Forgot to clock in or out?"})}),U?(0,B.jsx)(E,{onClose:()=>V(!1)}):null,(0,B.jsx)(p.BreakRoomCard,{staffId:a,name:d,now:e}),q?(()=>{const t=(0,C.paidMins)(q,e);return(0,B.jsxs)(u.Card,{highlight:w.colours.gold,children:[(0,B.jsxs)(u.T,{weight:"semibold",colour:w.colours.gold,children:["Clocked out at ",(0,b.hm)(new Date(q.out))]}),(0,B.jsxs)(u.T,{size:18,weight:"bold",children:["Clocked ",(0,C.hmDur)(t.worked),", break ",t.brk,"m, paid ",(0,C.hmDur)(t.paid)]}),(0,B.jsxs)(u.Muted,{children:["In ",(0,b.hm)(new Date(q.in))," \xb7 out ",(0,b.hm)(new Date(q.out))," \xb7 paid hours = (out \u2212 in) \u2212 break",q.breakAddedAtClockOut?' \xb7 break added at clock-out':'']}),t.worked>360&&0===t.brk?(0,B.jsx)(u.Banner,{kind:"info",title:"A note on breaks",children:"UK workers are generally entitled to a 20-minute rest break when working more than 6 hours. Your clock-out is saved; have a word with your manager if you didn\u2019t get one."}):null]})})():null,(0,B.jsx)(u.Sheet,{visible:k,onClose:()=>y(!1),title:"Why we ask for location",testID:"clock-location-reason",children:(0,B.jsxs)(c.default,{style:{gap:12},children:[(0,B.jsxs)(u.T,{children:["We check once that you are at ",h.name,", within about ",x.radius," m, when you clock in. Only pass or fail is saved, not your position. We never track you in the background."]}),(0,B.jsx)(u.T,{children:"If you refuse or are too far away, no clock-in is made. A manager can override it with a recorded reason."}),(0,B.jsx)(u.Button,{testID:"clock-location-continue",label:"Check my location and clock in",accessibilityLabel:"Check my location once and clock in at the pub",onPress:()=>{y(!1),ae('in')}}),(0,B.jsx)(u.Button,{testID:"clock-location-cancel",kind:"secondary",label:"Not now",onPress:()=>y(!1)})]})}),ee?(0,B.jsx)(W,{rid:m,today:t,now:e}):null,G?(0,B.jsx)(n.ShiftCheckout,{rid:m,shiftKey:G.id,day:G.date,meId:a,onClose:()=>X(null)}):null,(0,B.jsx)(u.Sheet,{visible:z,onClose:()=>H(!1),title:"Did you take a break? If so, how long?",children:(0,B.jsxs)(c.default,{testID:"forgot-break-prompt",style:{gap:10},children:[(0,B.jsx)(u.Muted,{children:"No break was recorded on this shift. Pick how long it was, or No break. Your manager can change it later in Hours."}),(0,B.jsx)(u.Row,{wrap:!0,gap:6,children:x.breakOptions.map(e=>(0,B.jsx)(u.Chip,{testID:`forgot-break-${e}`,label:(0,D.breakLabel)(e),disabled:e>=te,onPress:()=>{H(!1),ae('out',{addedBreak:e})}},e))}),(0,B.jsx)(u.Button,{testID:"forgot-break-none",kind:"secondary",label:"No break",onPress:()=>{H(!1),ae('out',{breakMins:0})}}),te>360?(0,B.jsx)(u.Muted,{children:"UK workers are generally entitled to a 20-minute rest break when working more than 6 hours."}):null,(0,B.jsx)(u.Muted,{children:j?'Clock-out and breaks do not use your location.':'Tip: your location is checked when you clock out, like clocking in.'})]})})]}):(0,B.jsx)(c.default,{style:{gap:10},children:(0,B.jsxs)(u.Card,{highlight:w.colours.gold,children:[(0,B.jsx)(u.T,{weight:"semibold",colour:w.colours.gold,children:"Before you clock in: location & your privacy"}),j?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(u.T,{size:14,children:["When you choose Clock in, we ask once for your phone\u2019s location to check you are at ",h.name,", within about ",x.radius," m."]}),(0,B.jsx)(u.T,{size:14,children:"Only pass or fail is kept with your clock-in time. Your map position, accuracy and distance are not saved. No location trails, background checks, clock-out checks or break checks."})]}):(0,B.jsxs)(B.Fragment,{children:[" ",(0,B.jsxs)(u.T,{size:14,children:["CoverCharge checks your phone\u2019s location ",(0,B.jsx)(u.T,{size:14,weight:"bold",children:"only at the moment you tap Clock in, Clock out, Start break or End break"}),", to confirm you are at ",h.name," (within about ",x.radius," m)."]}),(0,B.jsx)(u.T,{size:14,children:"\u2022 Your location is never tracked continuously or in the background."}),(0,B.jsx)(u.T,{size:14,children:"\u2022 With each clock record we keep that one reading (map position and how accurate the phone said it was), whether it was inside the area, and the time."}),(0,B.jsx)(u.T,{size:14,children:"\u2022 If the app is open while you\u2019re at the venue and you\u2019re not on the rota, it may ask whether you want to clock in (only if you have already allowed location)."})]}),(0,B.jsx)(u.T,{size:14,children:"\u2022 Your employer uses this for timesheets and pay (UK GDPR lawful basis: contract / legitimate interests)."}),(0,B.jsx)(u.T,{size:14,children:"\u2022 If your phone can\u2019t share its location, a manager can record it for you instead. You can see your own records anytime."}),(0,B.jsx)(u.T,{size:14,children:"\u2022 Records are kept for payroll (6 years, HMRC) and then deleted."}),(0,B.jsx)(u.Button,{label:"I understand \u2014 continue",onPress:()=>f.useOwner.getState().giveConsent(a,e.toISOString())})]})})},_e.Timesheets=function(){const{now:e,today:t,role:s,meId:n}=(0,C.useCtx)(3e4);return s!=='staff'?(0,B.jsx)(q,{now:e,today:t,meId:n}):(0,B.jsx)(_,{})};var t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),a=_r(_d[3]),o=_r(_d[4]),i=_r(_d[5]),l=_r(_d[6]),r=e(_r(_d[7])),d=e(_r(_d[8])),c=e(_r(_d[9])),u=_r(_d[10]),h=_r(_d[11]),f=_r(_d[12]),m=_r(_d[13]),p=_r(_d[14]),x=_r(_d[15]),j=_r(_d[16]),b=_r(_d[17]),w=_r(_d[18]),k=_r(_d[19]),y=_r(_d[20]),C=_r(_d[21]),S=_r(_d[22]),I=_r(_d[23]),v=_r(_d[24]),D=_r(_d[25]),T=_r(_d[26]),$=_r(_d[27]),M=_r(_d[28]),O=_r(_d[29]),R=_r(_d[30]),P=_r(_d[31]),B=_r(_d[32]);const z=2650,H=1900,A=e=>e.end-e.start,Y=e=>e>8?.5:e>6?.3333333333333333:0,L=e=>{const t=new Date(e);return t.setHours(0,0,0,0),t.setDate(t.getDate()-(0,C.weekday)(e)),t};function F(e){const{rid:t,r:s,now:n}=(0,C.useCtx)(6e4),a=(0,h.useBookings)(t),o=(0,h.useOrders)(t),i=(0,h.useEvents)(t),r=(0,O.useRealHistory)(t,n);return(0,l.useMemo)(()=>{const t=Array.from({length:7},(t,s)=>{const n=(0,b.addMins)(e,1440*s);return n.setHours(11,0,0,0),n}),n=a.filter(e=>!e.walkIn&&'confirmed'===e.status&&t.some(t=>(0,b.ymd)(t)===e.date)).reduce((e,t)=>e+t.partySize,0),l=(0,R.clampWeeks)(s.settings.forecastMinWeeks);return r?r.salesEnough?{mode:'real',weeks:l,booked:n,sales:t.map(e=>s.kitchenHours[e.getDay()]?r.takingsByDay[e.getDay()]??0:0)}:{mode:'none',weeks:l,booked:n,sales:t.map(()=>0)}:{mode:'example',weeks:l,booked:n,sales:t.map(e=>{const t=(0,x.forecastToday)(s,a,o,i,e);return t.open?t.restOfDay.covers*z+t.restOfDay.takeaway*H:0})}},[s,a,o,i,r,(0,b.ymd)(e)])}function N({init:e,onClose:t}){const s=(0,f.useOwner)(e=>e.staff),[n,a]=(0,l.useState)(e.shift?.start??12),[o,i]=(0,l.useState)(e.shift?.end??20),[r,d]=(0,l.useState)(e.shift?.breakAt),h=void 0===r||r>n&&rt.id===e.staffId);return(0,B.jsxs)(u.Sheet,{visible:!0,onClose:t,title:(0,P.shiftTitle)(m?.name??'',e.date),testID:"shift-sheet",children:[(0,B.jsx)(u.Row,{wrap:!0,gap:6,children:[['Lunch',11,16],['Dinner',16.5,22.5],['Double',11,21],['Close',17,23.5],['Late close',18,25]].map(([e,t,s])=>(0,B.jsx)(u.Chip,{label:`${e} ${(0,C.fmtH)(t)}\u2013${(0,C.fmtH)(s)}`,selected:n===t&&o===s,onPress:()=>{a(t),i(s)}},e))}),(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsx)(u.T,{children:"Start"}),(0,B.jsx)(u.Stepper,{testID:"shift-start",value:n,step:.5,min:P.SHIFT_MIN_START,max:o-1,onChange:a,format:C.fmtH,label:"Start time"})]}),(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,B.jsx)(u.T,{children:"End"}),(0,B.jsxs)(c.default,{style:{alignItems:'flex-end'},children:[(0,B.jsx)(u.Stepper,{testID:"shift-end",value:o,step:.5,min:n+1,max:P.SHIFT_MAX_END,onChange:i,format:C.fmtH,label:"End time"}),o>=24?(0,B.jsx)(u.Muted,{children:"next day"}):null]})]}),(0,B.jsxs)(u.Muted,{children:[(o-n).toFixed(1),"h scheduled",Y(o-n)?`, ${Math.round(60*Y(o-n))}m planned break`:'']}),(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,B.jsx)(u.T,{children:void 0===r?'Break: not set':'Break at'}),void 0===r?(0,B.jsx)(u.Chip,{label:"Set a break time",onPress:()=>d(Math.min(o-.5,Math.max(n+.5,Math.round(4*(n+Math.min(4,(o-n)/2)))/4)))}):(0,B.jsxs)(u.Row,{gap:6,children:[(0,B.jsx)(u.Stepper,{testID:"shift-break",value:r,step:.25,min:n+.25,max:o-.25,onChange:d,format:C.fmtH,label:"Break time"}),(0,B.jsx)(u.Chip,{label:"No set time",onPress:()=>d(void 0)})]})]}),(0,B.jsx)(u.Muted,{children:"Tip: with a break time, the person on this shift gets a break reminder at that time. Without one, they get it 4 hours after clocking in (change this in Settings, Advanced, Reminders)."}),(0,B.jsx)(u.Button,{label:e.shift?'Save shift':'Add shift',onPress:()=>{const s=f.useOwner.getState();e.shift?s.setShifts(s.shifts.map(t=>t.id===e.shift.id?{...t,start:n,end:o,breakAt:h?r:void 0,changed:!!t.published||t.changed}:t)):s.addShift({staffId:e.staffId,date:e.date,start:n,end:o,...void 0!==r&&h?{breakAt:r}:{}}),t()}}),(0,B.jsx)(u.Muted,{children:e.shift?.published?'Published: the change shows in the Staff app straight away and is marked as changed until you publish the week again.':'Draft: staff see it once you publish the week.'}),e.shift?(0,B.jsx)(u.Button,{kind:"danger",label:"Remove shift",onPress:()=>{f.useOwner.getState().removeShift(e.shift.id),t()}}):null]})}function W({rid:e,today:t,now:s}){const n=(0,f.useOwner)(e=>e.staff).filter(e=>e.active),a=(0,f.useOwner)(e=>e.attendance),o=(0,C.useSignedIn)(),{me:i,meId:r}=(0,C.useCtx)(3e4),[d,c]=(0,l.useState)(null),[h,m]=(0,l.useState)(''),[p,x]=(0,l.useState)(null),j=d?a.filter(e=>e.staffId===d&&e.in&&!e.out&&s.getTime()-new Date(e.in).getTime()<72e6)[0]:void 0,b=!!j&&(0,f.isOnBreak)(j),k=s=>{if(!d)return;const a=(0,T.managerClockAction)(s,{rid:e,staffId:d,date:t,at:(new Date).toISOString()},{id:o?.id??r,name:o?.name??i},h);if(!a.ok)return void x(a.message);const l=n.find(e=>e.id===d)?.name??'them';(0,$.notify)({id:'mgr-clock',title:`Recorded for ${l}`,body:`Reason kept with the record: ${h.trim()}`,timeoutMs:6e3}),m(''),x(null)};return(0,B.jsxs)(u.Card,{children:[(0,B.jsx)(u.T,{weight:"semibold",children:"Record it for someone"}),(0,B.jsx)(u.Muted,{children:"If someone\u2019s phone can\u2019t share its location, you can clock them in or out, or start or end their break. No location check; your reason is kept with the record."}),(0,B.jsx)(u.Row,{wrap:!0,gap:6,children:n.map(e=>(0,B.jsx)(u.Chip,{label:e.name,selected:d===e.id,onPress:()=>c(e.id)},e.id))}),d?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(u.Field,{label:"Reason (kept with the record)",value:h,onChangeText:m,placeholder:"e.g. Phone out of battery"}),(0,B.jsx)(u.Row,{wrap:!0,gap:6,children:j?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(u.Button,{kind:"secondary",label:b?'End their break':'Start their break',onPress:()=>k(b?'break_end':'break_start')}),(0,B.jsx)(u.Button,{kind:"secondary",label:"Clock them out",onPress:()=>k('out')})]}):(0,B.jsx)(u.Button,{testID:"mgr-clock-in",kind:"secondary",label:"Clock them in",onPress:()=>k('in')})}),p?(0,B.jsx)(u.T,{size:13,colour:w.colours.red,children:p}):null]}):null]})}function E({onClose:e}){const{now:t,today:s,meId:n}=(0,C.useCtx)(3e4),a=(0,f.useOwner)(e=>e.attendance),o=(0,f.useOwner)(e=>e.shifts),i=Array.from({length:7},(e,t)=>(0,b.ymd)((0,b.addMins)((0,b.parseYmd)(s),1440*-t))),[r,d]=(0,l.useState)(s),c=a.filter(e=>e.staffId===n&&e.date===r&&e.in).sort((e,t)=>t.in.localeCompare(e.in))[0],h=(0,f.visibleShifts)(o,!1).find(e=>e.staffId===n&&e.date===r),[p,x]=(0,l.useState)(c&&!c.out?'out':'in'),[j,k]=(0,l.useState)(h?Math.round(60*h.start):720),[y,S]=(0,l.useState)(h?Math.round(60*h.end):1200),[I,v]=(0,l.useState)(''),[D,T]=(0,l.useState)(!1),$=e=>`${String(Math.floor(e%1440/60)).padStart(2,'0')}:${String(e%60).padStart(2,'0')}`,M='out'!==p,O='in'!==p,R=M&&O&&y<=j,P=(e,t)=>(0,B.jsx)(u.Row,{gap:4,children:[-15,-5,5,15].map(s=>(0,B.jsx)(u.Button,{small:!0,kind:"ghost",label:s>0?`+${s}`:`${s}`,onPress:()=>e(Math.max(0,Math.min(2160,t+s)))},s))});return D?(0,B.jsxs)(u.Sheet,{visible:!0,onClose:e,title:"Request sent",children:[(0,B.jsx)(u.Banner,{kind:"success",title:"Sent to your manager",children:"They\u2019ll see it on the sign-off screen and fix the time. You\u2019ll see the change on your timesheet. Nothing is sent by text or email."}),(0,B.jsx)(u.Button,{label:"Done",onPress:e})]}):(0,B.jsxs)(u.Sheet,{visible:!0,onClose:e,title:"I forgot to clock in or out",testID:"request-sheet",children:[(0,B.jsx)(u.Muted,{children:"Pick the day and suggest the right time. Your manager checks it before it counts."}),(0,B.jsx)(u.Row,{wrap:!0,gap:6,children:i.map(e=>(0,B.jsx)(u.Chip,{label:e===s?'Today':(0,b.niceDate)((0,b.parseYmd)(e)).slice(0,10),selected:r===e,onPress:()=>d(e)},e))}),(0,B.jsxs)(u.Muted,{children:[h?`Your rota that day: ${(0,C.fmtH)(h.start)}\u2013${(0,C.fmtH)(h.end)}`:'Not on the rota that day',c?` \xb7 clocked ${(0,b.hm)(new Date(c.in))}\u2013${c.out?(0,b.hm)(new Date(c.out)):'no clock-out'}`:' \xb7 no clock record']}),(0,B.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,B.jsx)(u.Chip,{label:"Forgot to clock in",selected:'in'===p,onPress:()=>x('in')}),(0,B.jsx)(u.Chip,{label:"Forgot to clock out",selected:'out'===p,onPress:()=>x('out')}),(0,B.jsx)(u.Chip,{label:"Forgot both",selected:'both'===p,onPress:()=>x('both')})]}),M?(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsxs)(u.T,{size:18,weight:"bold",children:["In ",$(j)]}),P(k,j)]}):null,O?(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsxs)(u.T,{size:18,weight:"bold",children:["Out ",$(y),y>=1440?' (next day)':'']}),P(S,y)]}):null,R?(0,B.jsx)(u.T,{size:13,colour:w.colours.red,children:"Clock-out must be after clock-in."}):null,(0,B.jsx)(u.Field,{label:"Note for your manager (optional)",value:I,onChangeText:v,placeholder:"e.g. phone died",maxLength:200}),(0,B.jsx)(u.Button,{testID:"request-send",kind:"success",label:"Send to my manager",disabled:R,onPress:()=>{f.useOwner.getState().addTimeRequest({staffId:n,date:r,attendanceId:c?.id,kind:p,suggestedIn:M?(0,m.isoAt)(r,j):void 0,suggestedOut:O?(0,m.isoAt)(r,y):void 0,note:I.trim(),at:t.toISOString()}),T(!0)}})]})}function _(){const{now:e,today:t,meId:s}=(0,C.useCtx)(3e4),n=(0,f.useOwner)(e=>e.attendance),a=(0,f.useOwner)(e=>e.shifts),o=(0,f.useOwner)(e=>e.timeRequests),[i,r]=(0,l.useState)(!1),[d,h]=(0,l.useState)(null),p=(0,b.ymd)(L(e)),x=n.filter(e=>e.staffId===s&&e.in&&e.date>=(0,b.ymd)((0,b.addMins)((0,b.parseYmd)(t),-38880))).sort((e,t)=>t.date.localeCompare(e.date)||t.in.localeCompare(e.in)),j=x.filter(e=>e.date>=p),y=j.filter(f.isConfirmed).reduce((t,s)=>t+(0,C.paidMins)(s,e).paid,0),S=j.filter(e=>!(0,f.isConfirmed)(e)).reduce((t,s)=>t+(0,C.paidMins)(s,e).paid,0),I=o.filter(e=>e.staffId===s).sort((e,t)=>t.at.localeCompare(e.at)).slice(0,6);return(0,B.jsxs)(c.default,{style:{gap:10},testID:"my-timesheet",children:[(0,B.jsxs)(u.Card,{children:[(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between',alignItems:'flex-end'},children:[(0,B.jsxs)(c.default,{children:[(0,B.jsx)(u.T,{size:12,colour:w.colours.muted,children:"CONFIRMED THIS WEEK"}),(0,B.jsx)(u.T,{size:28,weight:"bold",colour:w.colours.ok,children:(0,C.hmDur)(y)})]}),(0,B.jsxs)(c.default,{style:{alignItems:'flex-end'},children:[(0,B.jsx)(u.T,{size:12,colour:w.colours.muted,children:"PENDING SIGN-OFF"}),(0,B.jsx)(u.T,{size:18,weight:"semibold",colour:S?w.colours.amber:w.colours.muted,children:(0,C.hmDur)(S)})]})]}),(0,B.jsx)(u.Muted,{children:"Your manager signs off your hours. Only confirmed hours count for pay. You can\u2019t change your own times; ask for a correction instead."})]}),(0,B.jsx)(u.Button,{testID:"forgot-clock",kind:"secondary",label:"I forgot to clock in or out",onPress:()=>r(!0)}),I.length?(0,B.jsx)(k.SectionHead,{title:"My correction requests"}):null,I.map(e=>(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between',paddingVertical:4},children:[(0,B.jsxs)(c.default,{style:{flex:1},children:[(0,B.jsxs)(u.T,{size:14,children:[(0,b.niceDate)((0,b.parseYmd)(e.date))," \xb7 ",'in'===e.kind?'Forgot to clock in':'out'===e.kind?'Forgot to clock out':'Forgot both']}),(0,B.jsxs)(u.Muted,{children:[e.suggestedIn?`in ${(0,b.hm)(new Date(e.suggestedIn))} `:'',e.suggestedOut?`out ${(0,b.hm)(new Date(e.suggestedOut))}`:'',e.resolvedBy?` \xb7 ${'applied'===e.status?'applied':'declined'} by ${e.resolvedBy.replace(' (example)','')}`:'']})]}),(0,B.jsx)(u.Badge,{kind:'open'===e.status?'blue':'applied'===e.status?'ok':'neutral',label:'open'===e.status?'Waiting':'applied'===e.status?'Applied':'Declined'})]},e.id)),(0,B.jsx)(k.SectionHead,{title:"My shifts",sub:"Last 4 weeks"}),x.map(t=>{const s=(0,f.shiftOf)((0,f.visibleShifts)(a,!1),t.staffId,t.date),n=(0,C.paidMins)(t,e),o=t.audit?.filter(e=>'confirmed'!==e.action).slice(-1)[0];return(0,B.jsxs)(u.Card,{onPress:()=>h(d===t.id?null:t.id),children:[(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsxs)(c.default,{style:{flex:1},children:[(0,B.jsx)(u.T,{weight:"semibold",children:(0,b.niceDate)((0,b.parseYmd)(t.date))}),(0,B.jsxs)(u.Muted,{children:[(0,b.hm)(new Date(t.in)),"\u2013",t.out?(0,b.hm)(new Date(t.out)):'on now',t.out?` \xb7 ${n.brk}m break \xb7 ${(0,C.hmDur)(n.paid)} paid`:'',s?` \xb7 rota ${(0,C.fmtH)(s.start)}\u2013${(0,C.fmtH)(s.end)}`:'']})]}),(0,B.jsx)(u.Badge,{kind:(0,m.statusKind)(t),label:'awaiting'===(0,f.attStatus)(t)?t.adjusted?'Adjusted \xb7 pending':'Pending':(0,m.statusLabel)(t)})]}),o?(0,B.jsxs)(u.T,{size:13,colour:w.colours.gold,children:["Adjusted by ",o.by.replace(' (example)',''),o.reason?`: ${o.reason}`:'']}):null,t.signOff?(0,B.jsxs)(u.Muted,{children:["Confirmed by ",t.signOff.by.replace(' (example)','')]}):null,d===t.id?(0,B.jsx)(m.AuditTrail,{a:t}):null]},t.id)}),x.length?null:(0,B.jsx)(u.Muted,{children:"No clocked shifts yet."}),i?(0,B.jsx)(E,{onClose:()=>r(!1)}):null]})}function q({now:e,today:s}){const n=(0,f.useOwner)(e=>e.staff),o=(0,f.useOwner)(e=>e.shifts),i=(0,C.useHourly)(),d=(0,f.useOwner)(e=>e.attendance),h=(0,f.useOwner)(e=>e.timeRequests),p=(0,f.useOwner)(e=>e.attLog),[x,y]=(0,l.useState)(s),[I,v]=(0,l.useState)(null),[D,T]=(0,l.useState)(!1),$=!!(0,C.useSignedIn)(),M=Array.from({length:7},(e,t)=>(0,b.ymd)((0,b.addMins)((0,b.parseYmd)(s),1440*-t))),O=d.filter(e=>e.date===x&&e.in),R=o.filter(e=>e.date===x&&!1!==e.published).filter(e=>!O.some(t=>t.staffId===e.staffId)),P=d.filter(e=>M.includes(e.date)&&e.out),z=P.filter(f.isConfirmed),H=z.reduce((t,s)=>t+(0,C.paidMins)(s,e).paid,0),A=P.filter(e=>!(0,f.isConfirmed)(e)).reduce((t,s)=>t+(0,C.paidMins)(s,e).paid,0),Y=z.reduce((t,s)=>t+(0,C.paidMins)(s,e).paid/60*(i[s.staffId]??0),0),L=['Staff,Date,Rostered,In,Out,Break (min),Paid hours,Rate,Pay,Status,Confirmed by,Tax note'].concat(z.sort((e,t)=>e.date.localeCompare(t.date)).map(t=>{const s=n.find(e=>e.id===t.staffId),a=(0,f.shiftOf)(o,t.staffId,t.date),l=(0,C.paidMins)(t,e),r=i[t.staffId]??0;return`${s?.name},${t.date},${a?`${(0,C.fmtH)(a.start)}-${(0,C.fmtH)(a.end)}`:'-'},${(0,b.hm)(new Date(t.in))},${(0,b.hm)(new Date(t.out))},${l.brk},${(l.paid/60).toFixed(2)},${(r/100).toFixed(2)},${(l.paid/60*r/100).toFixed(2)},${t.adjusted?'Confirmed (adjusted)':'Confirmed'},${t.signOff?.by??''},${s?.salaried?'Owner, no hourly wage':null==i[t.staffId]?'Rate not set':s?.noTax&&$?'No tax deducted':''}`}));return(0,B.jsxs)(c.default,{style:{gap:10},children:[(0,B.jsx)(u.Row,{wrap:!0,gap:6,children:M.map(e=>(0,B.jsx)(u.Chip,{label:e===s?'Today':(0,b.niceDate)((0,b.parseYmd)(e)).slice(0,6),selected:x===e,onPress:()=>y(e)},e))}),(0,B.jsxs)(u.Card,{children:[(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsx)(u.T,{weight:"semibold",children:"Last 7 days"}),(0,B.jsx)(u.Badge,{kind:"ok",label:`${(0,C.hmDur)(H)} confirmed`})]}),A?(0,B.jsxs)(u.T,{size:13,colour:w.colours.amber,children:[(0,C.hmDur)(A)," pending sign-off (not counted yet)"]}):null,(0,B.jsxs)(u.Muted,{children:["Labour cost ",(0,j.gbp)(Math.round(Y))," from confirmed hours (paid hours \xd7 hourly rates; owner salaries excluded). Sign off in Team \u203a Sign off hours."]})]}),(0,B.jsx)(a.WideTable,{children:(0,B.jsxs)(c.default,{style:{gap:2},children:[(0,B.jsx)(a.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:w.colours.border,paddingBottom:4},children:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''].map((e,t)=>(0,B.jsx)(u.T,{size:12,weight:"semibold",colour:w.colours.gold,style:{width:[110,86,52,52,52,74,120,140,50][t]},children:e},e+t))}),O.map(t=>{const i=n.find(e=>e.id===t.staffId),l=(0,f.shiftOf)(o,t.staffId,x),d=(0,C.paidMins)(t,e),c=(0,m.flagsFor)(t,l,e,s,h).map(e=>e.label);return(0,B.jsxs)(a.TRow,{heads:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,B.jsxs)(u.Row,{gap:4,style:{width:110},children:[(0,B.jsx)(S.StaffAvatar,{id:t.staffId,size:20,ring:!1}),(0,B.jsx)(u.T,{size:12,style:{flex:1},numberOfLines:1,children:i?.name.replace(' (example)','')})]}),(0,B.jsx)(u.T,{size:12,style:{width:86},colour:w.colours.muted,children:l?`${(0,C.fmtH)(l.start)}\u2013${(0,C.fmtH)(l.end)}`:'\u2013'}),(0,B.jsx)(u.T,{size:12,style:{width:52},children:(0,b.hm)(new Date(t.in))}),(0,B.jsx)(u.T,{size:12,style:{width:52},children:t.out?(0,b.hm)(new Date(t.out)):'on'}),(0,B.jsx)(u.T,{size:12,style:{width:52},children:t.out?`${d.brk}m`:'\u2013'}),(0,B.jsx)(u.T,{size:12,weight:"semibold",style:{width:74},children:t.out?(0,C.hmDur)(d.paid):`${(0,C.hmDur)(d.worked)}\u2026`}),(0,B.jsx)(u.T,{size:11,style:{width:120},colour:'confirmed'===(0,f.attStatus)(t)?w.colours.ok:'open'===(0,f.attStatus)(t)?w.colours.blue:w.colours.amber,children:(0,m.statusLabel)(t)}),(0,B.jsx)(u.T,{size:11,style:{width:140},colour:c.length?w.colours.amber:w.colours.ok,children:c.join(', ')||'OK'}),(0,B.jsx)(r.default,{accessibilityRole:"button",accessibilityLabel:`Edit ${i?.name}`,onPress:()=>v(t),style:{width:50,minHeight:44,justifyContent:'center'},children:(0,B.jsx)(u.T,{size:12,colour:w.colours.gold,children:"Edit"})})]},t.id)}),R.map(t=>(0,B.jsxs)(a.TRow,{heads:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''],style:{paddingVertical:6},children:[(0,B.jsx)(u.T,{size:12,style:{width:110},children:n.find(e=>e.id===t.staffId)?.name.replace(' (example)','')}),(0,B.jsxs)(u.T,{size:12,style:{width:86},colour:w.colours.muted,children:[(0,C.fmtH)(t.start),"\u2013",(0,C.fmtH)(t.end)]}),(0,B.jsx)(u.T,{size:12,colour:x===s&&60*t.start>60*e.getHours()+e.getMinutes()?w.colours.muted:w.colours.red,children:x===s&&60*t.start>60*e.getHours()+e.getMinutes()?'Not started yet':'No clock-in'})]},t.id))]})}),O.length||R.length?null:(0,B.jsx)(u.Muted,{children:"No shifts or clock records for this day."}),(0,B.jsx)(u.Muted,{children:"Paid hours = (clock-out \u2212 clock-in) \u2212 break. Only confirmed hours count for pay, tips and the export."}),(0,B.jsx)(u.Button,{kind:"secondary",label:"Payroll export (CSV preview)",onPress:()=>T(!0)}),(0,B.jsx)(k.SectionHead,{title:"Audit log",sub:"Every manual change and sign-off"}),p.length?p.slice(0,12).map(e=>(0,B.jsxs)(u.Muted,{children:[(0,b.niceDate)(new Date(e.at))," ",(0,b.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,B.jsx)(u.Muted,{children:"No manual changes yet."}),I?(0,B.jsx)(m.OverrideSheet,{a:I,staffId:I.staffId,date:I.date,onClose:()=>v(null)}):null,(0,B.jsxs)(u.Sheet,{visible:D,onClose:()=>T(!1),title:"Payroll export",children:[(0,B.jsxs)(u.Banner,{kind:"demo",title:"Preview: nothing is sent",children:["Confirmed hours only. ",A?`${(0,C.hmDur)(A)} still pending sign-off is left out.`:'']}),(0,B.jsxs)(c.default,{style:{backgroundColor:(0,t.soutersSurface)('#111'),borderRadius:8,padding:8},children:[L.slice(0,14).map((e,t)=>(0,B.jsx)(u.T,{size:10,colour:t?w.colours.text:w.colours.gold,children:e},t)),L.length>14?(0,B.jsxs)(u.Muted,{children:["\u2026 ",L.length-14," more rows"]}):null]}),(0,B.jsxs)(u.Muted,{children:[L.length-1," confirmed rows \xb7 paid hours (after breaks)."]})]})]})}},1030,[878,874,992,1355,1162,1163,30,263,151,127,813,819,854,977,1348,868,816,818,821,953,960,954,955,1219,1074,1160,1302,1041,1303,981,998,1071,24]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"category",{enumerable:!0,get:function(){return C}}),_e.allocate=S,_e.Tips=function({go:e}={}){const{rid:w,now:M,today:v,role:$,meId:P,me:B}=(0,x.useCtx)(6e4),I=(0,a.useOwner)(e=>e.staff),R=(0,a.useOwner)(e=>e.attendance),A=(0,a.useOwner)(e=>e.shifts),F=(0,a.useOwner)(e=>e.tronc),D=(0,a.useOwner)(e=>e.troncCash),E=(0,a.useOwner)(e=>e.troncHistory),z=(0,a.useOwner)(e=>e.troncLog),L=(0,d.useOrders)(w),q=(0,f.useVenuePay)(w).pay,[V,N]=(0,n.useState)(-1),[H,_]=(0,n.useState)(''),[Y,K]=(0,n.useState)(!1),[W,U]=(0,n.useState)(!1),[G,Q]=(0,n.useState)(F.text),[J,X]=(0,n.useState)(null),Z='staff'!==$,ee='owner'===$,{s:te,e:se,key:oe}=(0,f.venueRange)(q,'tips',V,M),ne=`${(0,u.niceDate)(te)} \u2013 ${(0,u.niceDate)(se)} ${se.getFullYear()}`,ie=E.find(e=>e.key===oe),re=e=>a.useOwner.getState().setOwner({tronc:{...F,...e}}),le=(0,j.useSync)(e=>!!e.venueId&&'guest'!==e.kind),de=Math.round((se.getTime()-te.getTime())/864e5)+1,ae=(0,n.useMemo)(()=>{let e=L.filter(e=>e.createdAt.slice(0,10)>=(0,u.ymd)(te)&&e.createdAt.slice(0,10)<=(0,u.ymd)(se)).reduce((e,t)=>e+(t.tip??0),0);if(!o.LIVE_VENUE_BUILD&&!le)for(let t=0;tM)break;const o=(0,x.weekday)(s);0!==o&&1!==o&&(e+=Math.round(6e3+9e3*(0,y.hash)((0,u.ymd)(s)+'tip')))}return e},[oe,L.length,le]),ce=D[oe]??0,ue=ie?ie.pot:ae+ce,he=(0,n.useMemo)(()=>{const e={};for(let t=0;tv)break;const o=(0,u.ymd)(s);I.forEach(t=>{const s=R.filter(e=>e.staffId===t.id&&e.date===o&&e.out),n=s.filter(a.isConfirmed).reduce((e,t)=>e+(0,x.paidMins)(t,M).paid,0),i=s.filter(e=>!(0,a.isConfirmed)(e)).reduce((e,t)=>e+(0,x.paidMins)(t,M).paid,0);(n||i)&&(e[t.id]={paid:(e[t.id]?.paid??0)+n,est:(e[t.id]?.est??!1)||i>0})})}return e},[oe,R.length,A.length,I.length]),pe=I.filter(e=>e.active&&('staff'===e.role||'manager'===e.role&&F.includeManagers||'owner'===e.role&&F.includeOwner)),me=(0,n.useMemo)(()=>{if(ie)return ie.rows;const e=pe.map(e=>{const t=(he[e.id]?.paid??0)/60,s=F.points[C(e)]??1;return'hours'===F.method?t:'points'===F.method?t*s:'equal'===F.method?t>0?1:0:F.custom[e.id]??0}),{amounts:t}=S(ue,e),s=e.reduce((e,t)=>e+t,0);return pe.map((o,n)=>({staffId:o.id,hours:(he[o.id]?.paid??0)/60,points:F.points[C(o)]??1,pct:s?e[n]/s*100:0,amount:t[n]}))},[ie,pe.map(e=>e.id).join(),he,F,ue]),ge=me.reduce((e,t)=>e+t.amount,0),xe=ie?0:(()=>{const e=me.map(e=>e.pct);return S(ue,e).remainder})(),fe=Object.entries(F.custom).filter(([e])=>pe.some(t=>t.id===e)).reduce((e,[,t])=>e+t,0),ye='custom'===F.method&&Math.abs(fe-100)>.01,je=new Date(se.getFullYear(),se.getMonth()+2,0),we=[...E].sort((e,t)=>t.end.localeCompare(e.end))[0],be=0!==E.length&&(0,u.parseYmd)(we.end)<(0,u.addMins)(M,-89280),Te=['Staff,Category,Paid hours,Points,Share %,Amount \xa3'].concat(me.map(e=>{const t=I.find(t=>t.id===e.staffId);return`${k(t.name)},${C(t)},${e.hours.toFixed(2)},${e.points},${e.pct.toFixed(2)},${(e.amount/100).toFixed(2)}`}),[`TOTAL,,,,100.00,${(ge/100).toFixed(2)}`]);return Z?(0,b.jsxs)(r.default,{style:{gap:10},children:[(0,b.jsxs)(l.Card,{highlight:h.colours.gold,children:[(0,b.jsx)(l.T,{weight:"semibold",children:"Quick split: Tips day"}),(0,b.jsx)(l.Muted,{children:"Enter the total and it's shared by confirmed hours for the fortnight, to the penny. Tips periods follow your pay dates (Settings \u203a Pay & tips)."}),(0,b.jsxs)(l.Row,{wrap:!0,gap:6,children:[(0,b.jsx)(l.Button,{small:!0,kind:"success",label:"Open Tips day",onPress:()=>e?.('more','tipsday')}),(0,b.jsx)(l.Button,{small:!0,kind:"ghost",label:"Pay & tips settings",onPress:()=>e?.('more','paysettings')})]})]}),(0,b.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(l.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",onPress:()=>N(V-1)}),(0,b.jsxs)(r.default,{style:{alignItems:'center',flex:1},children:[(0,b.jsx)(l.T,{weight:"semibold",children:ne}),ie?(0,b.jsx)(l.Badge,{kind:"ok",label:`Approved & locked ${ie.lockedAt}`}):V>=0?(0,b.jsx)(l.Badge,{kind:"amber",label:"Period in progress"}):(0,b.jsx)(l.Badge,{kind:"neutral",label:"Not yet approved"})]}),(0,b.jsx)(l.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:V>=0,onPress:()=>N(V+1)})]}),(0,b.jsxs)(l.Card,{children:[(0,b.jsx)(l.T,{weight:"semibold",children:"Tip pot"}),(0,b.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(l.T,{children:"Card tips on orders"}),(0,b.jsx)(l.T,{children:(0,c.gbp)(ie?ie.card:ae)})]}),(0,b.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(l.T,{children:"Cash tips"}),(0,b.jsx)(l.T,{children:(0,c.gbp)(ie?ie.cash:ce)})]}),ie?null:(0,b.jsxs)(l.Row,{gap:6,children:[(0,b.jsx)(s.TextInput,{accessibilityLabel:"Cash tips \xa3",placeholder:"Cash tips \xa3",placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",value:H,onChangeText:_,style:[l.styles.input,{flex:1}]}),(0,b.jsx)(l.Button,{small:!0,kind:"secondary",label:"Set cash",disabled:!(Number(H)>=0)||''===H.trim(),onPress:()=>{a.useOwner.getState().setOwner({troncCash:{...D,[oe]:Math.round(100*Number(H))}}),_('')}})]}),(0,b.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(l.T,{weight:"bold",children:"Total pot"}),(0,b.jsx)(l.T,{size:20,weight:"bold",colour:h.colours.gold,children:(0,c.gbp)(ue)})]}),(0,b.jsx)(l.Muted,{children:le?'Card tips are the tips taken on orders in CoverCharge. Add cash tips above.':'Card tips are the tips on orders saved on this device (not connected to your venue yet).'})]}),ie?(0,b.jsxs)(l.Muted,{children:["Locked with method: ",T[ie.method],"."]}):(0,b.jsxs)(l.Card,{children:[(0,b.jsx)(l.T,{weight:"semibold",children:"Split method (venue policy)"}),(0,b.jsx)(l.Row,{wrap:!0,gap:6,children:Object.keys(T).map(e=>(0,b.jsx)(l.Chip,{label:T[e],selected:F.method===e,onPress:()=>ee&&re({method:e})},e))}),ee?null:(0,b.jsx)(l.Muted,{children:"Only the owner can change the policy."}),'points'===F.method?Object.entries(F.points).map(([e,t])=>(0,b.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(l.T,{children:e}),(0,b.jsx)(l.Row,{gap:6,children:(0,b.jsx)(l.Stepper,{value:t,step:.1,min:0,max:2,onChange:t=>ee&&re({points:{...F.points,[e]:Math.round(10*t)/10}}),format:e=>e.toFixed(1),label:`${e} points`})})]},e)):null,'custom'===F.method?(0,b.jsxs)(b.Fragment,{children:[pe.map(e=>(0,b.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(l.T,{style:{flex:1},children:k(e.name)}),(0,b.jsx)(s.TextInput,{accessibilityLabel:`${e.name} percent`,keyboardType:"decimal-pad",defaultValue:String(F.custom[e.id]??''),placeholder:"%",placeholderTextColor:"#7D776C",onEndEditing:t=>re({custom:{...F.custom,[e.id]:Number(t.nativeEvent.text)||0}}),onBlur:t=>{const s=Number(t?.target?.value??t?.nativeEvent?.text);Number.isFinite(s)&&re({custom:{...a.useOwner.getState().tronc.custom,[e.id]:s}})},style:[l.styles.input,{width:80,paddingVertical:4}]})]},e.id)),(0,b.jsxs)(l.T,{size:13,colour:ye?h.colours.red:h.colours.ok,children:["Total ",fe.toFixed(1),"%",ye?' (must be 100%)':' \u2713']})]}):null,(0,b.jsx)(l.Toggle,{label:"Include managers",value:F.includeManagers,onChange:e=>ee&&re({includeManagers:e})}),(0,b.jsx)(l.Toggle,{label:"Include owner",value:F.includeOwner,onChange:e=>ee&&re({includeOwner:e})}),F.includeOwner?(0,b.jsx)(l.Banner,{kind:"warn",title:"Owner included",children:"Employers must not keep tips. An owner may only share in tips for qualifying work they personally do; check the statutory Code of Practice before including yourself."}):null]}),(0,b.jsx)(i.default,{horizontal:!0,children:(0,b.jsxs)(r.default,{children:[(0,b.jsx)(l.Row,{gap:0,style:{borderBottomWidth:1,borderColor:h.colours.border,paddingBottom:4},children:['Staff','Paid hrs','Points','Share','Amount'].map((e,t)=>(0,b.jsx)(l.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{width:[130,70,54,64,80][t]},children:e},e))}),me.map(e=>{const t=I.find(t=>t.id===e.staffId);return(0,b.jsxs)(l.Row,{gap:0,style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,b.jsxs)(l.T,{size:13,style:{width:130},numberOfLines:1,children:[k(t?.name),he[e.staffId]?.est&&!ie?'*':'']}),(0,b.jsx)(l.T,{size:13,style:{width:70},children:e.hours.toFixed(2)}),(0,b.jsx)(l.T,{size:13,style:{width:54},children:'points'===F.method||'points'===ie?.method?e.points.toFixed(1):'\u2013'}),(0,b.jsxs)(l.T,{size:13,style:{width:64},children:[e.pct.toFixed(1),"%"]}),(0,b.jsx)(l.T,{size:13,weight:"semibold",style:{width:80},children:(0,c.gbp)(e.amount)})]},e.staffId)}),(0,b.jsxs)(l.Row,{gap:0,style:{paddingVertical:6},children:[(0,b.jsx)(l.T,{size:13,weight:"bold",style:{width:318},children:"Total"}),(0,b.jsx)(l.T,{size:13,weight:"bold",colour:ge===ue?h.colours.ok:h.colours.red,style:{width:80},children:(0,c.gbp)(ge)})]})]})}),(0,b.jsxs)(l.Muted,{children:[ge===ue?`\u2713 Total equals the pot (${(0,c.gbp)(ue)}).`:'\u2717 Total does not equal the pot.',xe?` Rounding: ${xe}p left after rounding down went to the largest fractions, 1p each.`:''," * has hours still awaiting sign-off, which don\u2019t count until a manager confirms them. Paid hours already exclude breaks."]}),ie?null:(0,b.jsx)(l.Button,{label:"Approve & lock period",disabled:!ee||V>=0||ye||ge!==ue||ue<=0,onPress:()=>{const e=`${(0,u.niceDate)(M)} ${M.toTimeString().slice(0,5)}`,t={id:`tp-${oe}`,key:oe,label:ne,end:(0,u.ymd)(se),pot:ue,card:ae,cash:ce,method:F.method,rows:me,lockedAt:e,by:B};a.useOwner.getState().setOwner({troncHistory:[t,...E],troncLog:[{id:`tl-${Date.now()}`,at:M.toISOString(),text:`${B} approved & locked tips for ${ne}: ${(0,c.gbp)(ue)} split ${T[F.method].toLowerCase()} between ${me.filter(e=>e.amount>0).length} staff`},...z]})}}),!ie&&V>=0?(0,b.jsx)(l.Muted,{center:!0,children:"The current period can be approved once it has ended."}):null,ee||ie?null:(0,b.jsx)(l.Muted,{center:!0,children:"Only the owner can approve tips."}),(0,b.jsxs)(l.Row,{wrap:!0,gap:6,children:[(0,b.jsx)(l.Button,{small:!0,kind:"secondary",label:"Export CSV / PDF summary",onPress:()=>K(!0)}),ie?(0,b.jsx)(l.Button,{small:!0,kind:"secondary",label:ie.shared?'Shared \u2713':'Share with staff (chat)',disabled:!!ie.shared,onPress:()=>{(0,p.autoPost)('all',`Tips for ${ne} approved: ${(0,c.gbp)(ie.pot)} shared between ${ie.rows.filter(e=>e.amount>0).length} staff. See your own share in Team \u203a Tips.`),a.useOwner.getState().setOwner({troncHistory:E.map(e=>e.id===ie.id?{...e,shared:(0,u.niceDate)(M)}:e)}),X('Posted to All staff chat. Demo, nothing is sent.')}}):null]}),J?(0,b.jsx)(l.Banner,{kind:"demo",title:J}):null,(0,b.jsx)(m.SectionHead,{title:"Compliance checklist",sub:"Employment (Allocation of Tips) Act 2023, in force since 1 Oct 2024. Summary only, not legal advice."}),(0,b.jsxs)(l.Card,{children:[[[!0,'100% of qualifying tips passed to workers, no deductions',`Pot ${(0,c.gbp)(ue)} = allocated ${(0,c.gbp)(ge)}`],[F.text.trim().length>40,'Written tipping policy, available to staff','Stored in the app (template below)'],[!be,'Tips allocated by the end of the following month',`This period: by ${(0,u.niceDate)(je)} ${je.getFullYear()}`],[!0,'Tip records kept for 3 years',`${E.length} approved period(s) in the history`],[!0,'Staff can request their tip records',`${z.filter(e=>/requested/.test(e.text)).length} request(s) logged`]].map(([e,t,s])=>(0,b.jsxs)(l.Row,{style:{alignItems:'flex-start'},children:[(0,b.jsx)(l.T,{colour:e?h.colours.ok:h.colours.red,children:e?'\u2713':'\u2717'}),(0,b.jsxs)(r.default,{style:{flex:1},children:[(0,b.jsx)(l.T,{size:14,children:t}),(0,b.jsx)(l.Muted,{children:s})]})]},String(t))),(0,b.jsx)(l.Button,{small:!0,kind:"ghost",label:"View / edit tipping policy",onPress:()=>{Q(F.text),U(!0)}})]}),(0,b.jsx)(m.SectionHead,{title:"Tip history & audit log"}),E.map(e=>(0,b.jsxs)(l.Card,{children:[(0,b.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(l.T,{weight:"semibold",children:e.label}),(0,b.jsx)(l.T,{weight:"bold",children:(0,c.gbp)(e.pot)})]}),(0,b.jsxs)(l.Muted,{children:[T[e.method]," \xb7 ",e.rows.filter(e=>e.amount>0).length," staff \xb7 locked ",e.lockedAt," by ",e.by,e.shared?` \xb7 shared ${e.shared}`:'']})]},e.id)),z.map(e=>(0,b.jsxs)(l.Muted,{children:[(0,u.niceDate)(new Date(e.at))," \xb7 ",e.text]},e.id)),E.length||z.length?null:(0,b.jsx)(l.Muted,{children:"No approved periods yet."}),(0,b.jsxs)(l.Sheet,{visible:Y,onClose:()=>K(!1),title:"Tips summary export",children:[(0,b.jsx)(l.Banner,{kind:"demo",title:"Payroll export: not set up yet",children:"Nothing is sent. This will download a CSV or PDF payslip summary for payroll."}),(0,b.jsx)(r.default,{style:{backgroundColor:(0,t.soutersSurface)('#111'),borderRadius:8,padding:8},children:Te.map((e,t)=>(0,b.jsx)(l.T,{size:11,colour:t?h.colours.text:h.colours.gold,children:e},t))}),(0,b.jsxs)(l.Muted,{children:[ne," \xb7 ",T[ie?.method??F.method]]})]}),(0,b.jsxs)(l.Sheet,{visible:W,onClose:()=>U(!1),title:"Tipping policy",children:[(0,b.jsx)(s.TextInput,{accessibilityLabel:"Tipping policy",multiline:!0,editable:ee,value:G,onChangeText:Q,style:[l.styles.input,{minHeight:220,textAlignVertical:'top'}]}),ee?(0,b.jsx)(l.Button,{label:"Save policy",onPress:()=>{re({text:G}),U(!1)}}):null,(0,b.jsx)(l.Muted,{children:"Template only. Adapt it to your business."})]})]}):(0,b.jsx)(O,{})},_e.MyTips=O;var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),n=_r(_d[3]),i=e(_r(_d[4])),r=e(_r(_d[5])),l=_r(_d[6]),d=_r(_d[7]),a=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),p=_r(_d[12]),m=_r(_d[13]),x=_r(_d[14]),f=_r(_d[15]),y=_r(_d[16]),j=_r(_d[17]),w=_r(_d[18]),b=_r(_d[19]);const T={hours:'By paid hours',points:'Hours \xd7 role points',equal:'Equal share',custom:'Custom %'},C=e=>'staff'!==e.role?'Manager':/porter|KP/i.test(e.job)?'KP':/kitchen|chef/i.test(e.job)?'Kitchen':/bar/i.test(e.job)?'Bar':'FOH',k=e=>(e??'').replace(' (example)','');function S(e,t){const s=t.reduce((e,t)=>e+t,0);if(!s||e<=0)return{amounts:t.map(()=>0),remainder:0};const o=t.map(t=>e*t/s),n=o.map(Math.floor);let i=e-n.reduce((e,t)=>e+t,0);const r=i;return o.map((e,t)=>({i:t,f:e-Math.floor(e)})).sort((e,t)=>t.f-e.f).forEach(({i:e})=>{i>0&&(n[e]+=1,i-=1)}),{amounts:n,remainder:r}}function O({staffId:e}={}){const t=(0,x.useCtx)(6e4),{now:s,me:o}=t,i=e??t.meId,d=(0,a.useOwner)(e=>e.tronc),u=(0,a.useOwner)(e=>e.troncHistory),p=(0,a.useOwner)(e=>e.troncLog),[m,f]=(0,n.useState)(!1),[y,j]=(0,n.useState)(null),C=u.flatMap(e=>e.rows.filter(e=>e.staffId===i).map(t=>({h:e,r:t})));return(0,b.jsxs)(r.default,{style:{gap:10},children:[(0,b.jsx)(w.TipGoalCard,{staffId:i}),(0,b.jsxs)(l.Card,{children:[(0,b.jsx)(l.T,{weight:"semibold",children:"My tips"}),(0,b.jsx)(l.Muted,{children:"Only your own tip history is shown. 100% of tips go to staff; nothing is deducted."})]}),C.map(({h:e,r:t})=>(0,b.jsxs)(l.Card,{children:[(0,b.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(l.T,{weight:"semibold",children:e.label}),(0,b.jsx)(l.T,{weight:"bold",colour:h.colours.gold,children:(0,c.gbp)(t.amount)})]}),(0,b.jsxs)(l.Muted,{children:[(0,x.hmDur)(Math.round(60*t.hours))," paid \xb7 ",t.pct.toFixed(1),"% share \xb7 ",T[e.method]," \xb7 approved ",e.lockedAt]})]},e.id)),C.length?null:(0,b.jsx)(l.Muted,{children:"No approved tip periods yet. (Preview: approve a period in the Owner view first.)"}),(0,b.jsx)(l.Button,{kind:"secondary",label:"Request my tip records",onPress:()=>{a.useOwner.getState().setOwner({troncLog:[{id:`tl-${Date.now()}`,at:s.toISOString(),text:`${o} requested their tip records`},...p]}),j('Request logged for your manager (demo, nothing is sent).')}}),y?(0,b.jsx)(l.Banner,{kind:"success",title:y}):null,(0,b.jsx)(l.Button,{kind:"ghost",label:"Read the tipping policy",onPress:()=>f(!0)}),(0,b.jsx)(l.Sheet,{visible:m,onClose:()=>f(!1),title:"Tipping policy",children:(0,b.jsx)(l.T,{size:14,children:d.text})})]})}},1031,[878,874,833,30,151,127,813,819,854,816,818,821,960,953,954,1288,980,820,1359,24]); +__d(function(g,_r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.usePay=j,_e.periodPay=T,_e.MyHoursPay=C,_e.Payroll=function(){const{role:e}=(0,y.useCtx)(6e4),r='owner'===e,c=!!(0,y.useSignedIn)(),p=c&&('owner'===e||'manager'===e),j=(0,a.useOwner)(e=>e.staff),k=(0,i.useMemo)(()=>j.filter(e=>e.active),[j]),D=(0,y.useHourly)(),R=(0,a.useOwner)(e=>e.attendance),z=(0,a.useOwner)(e=>e.troncHistory),{now:M,rid:N}=(0,y.useCtx)(6e4),v=(0,b.useVenuePay)(N).pay,[B,O]=(0,i.useState)(-1),[L,$]=(0,i.useState)(null),[S,H]=(0,i.useState)(''),[I,W]=(0,i.useState)(null),E=(0,i.useMemo)(()=>k.map(e=>({...T(e.id,B,M,R,D[e.id]??0,v,z),person:e})),[k,B,R,D,v,z]),_=E.reduce((e,s)=>({paid:e.paid+s.paid,gross:e.gross+s.gross,tips:e.tips+s.tips,total:e.total+s.total}),{paid:0,gross:0,tips:0,total:0}),V=E[0]?.label??'',F=k.find(e=>e.id===L),G=Math.round(100*Number(S));return(0,f.jsxs)(n.default,{style:{gap:10},children:[(0,f.jsx)(l.Muted,{children:"Periods follow your venue's pay dates (Settings \u203a Pay & tips). For hours to copy into a spreadsheet, use Payroll hours."}),(0,f.jsxs)(l.Muted,{children:["Pay period (venue setting",r?'':', owner only',"). Used for staff pay, the tip splitter and payroll."]}),(0,f.jsx)(P,{label:V,offset:B,setOffset:O,badge:0===B?'Current period':void 0}),(0,f.jsx)(t.WideTable,{children:(0,f.jsxs)(n.default,{children:[(0,f.jsx)(t.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:h.colours.border,paddingBottom:4},children:['Staff','Rate/h','Paid hrs','Gross','Tips','Total'].map((e,s)=>(0,f.jsx)(l.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{width:[120,96,64,72,64,76][s]},children:e},e))}),E.map(e=>(0,f.jsxs)(t.TRow,{heads:['Staff','Rate/h','Paid hrs','Gross','Tips','Total'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,f.jsxs)(o.default,{accessibilityRole:"button",accessibilityLabel:`Pay for ${e.person.name}`,onPress:()=>W(e.person.id),style:{width:120,minHeight:44,justifyContent:'center'},children:[(0,f.jsx)(l.T,{size:13,colour:h.colours.gold,numberOfLines:1,children:x(e.person.name)}),c&&e.person.noTax?(0,f.jsx)(l.T,{size:10,colour:h.colours.amber,children:"No tax deducted"}):null]}),(0,f.jsx)(o.default,{accessibilityRole:"button",accessibilityLabel:`Edit rate for ${e.person.name}`,disabled:!p,onPress:()=>{$(e.person.id),H(null==D[e.person.id]?'':(D[e.person.id]/100).toFixed(2))},style:{width:96,minHeight:44,justifyContent:'center'},children:(0,f.jsxs)(l.T,{size:13,colour:null==D[e.person.id]?h.colours.muted:'owner'!==e.person.role&&D[e.person.id]$(null),title:`Hourly rate: ${x(F?.name)}`,children:[(0,f.jsx)(l.Muted,{children:F?`${F.level??a.ROLE_LABEL[F.role]} \xb7 ${F.job}${F.noTax?' \xb7 No tax deducted':''} \xb7 now: ${(0,a.wageLabel)(F,D[F.id],u.gbp)}`:''}),(0,f.jsx)(s.TextInput,{accessibilityLabel:"Hourly rate \xa3",keyboardType:"decimal-pad",value:S,onChangeText:H,style:l.styles.input}),Number.isFinite(G)&&G>0&&G{a.useOwner.getState().setRate(L,G),$(null)}}),L&&null!=D[L]?(0,f.jsx)(l.Button,{kind:"secondary",label:"Clear (Not set)",onPress:()=>{a.useOwner.getState().clearRate(L),$(null)}}):null]}),(0,f.jsx)(l.Sheet,{visible:!!I,onClose:()=>W(null),title:`What ${x(k.find(e=>e.id===I)?.name)} sees`,children:I?(0,f.jsx)(C,{staffId:I}):null})]})};var s=_r(d[0]),t=_r(d[1]),i=_r(d[2]),o=e(_r(d[3])),n=e(_r(d[4])),r=e(_r(d[5])),l=_r(d[6]),a=_r(d[7]),u=_r(d[8]),c=_r(d[9]),h=_r(d[10]),p=_r(d[11]),y=_r(d[12]),b=_r(d[13]),f=_r(d[14]);const x=e=>(e??'').replace(' (example)',''),w='Before tax and deductions, estimate';function j(e,s){const{now:t,rid:o}=(0,y.useCtx)(6e4),n=(0,a.useOwner)(e=>e.attendance),r=(0,y.useHourly)()[e]??0,l=(0,b.useVenuePay)(o).pay,u=(0,a.useOwner)(e=>e.troncHistory);return(0,i.useMemo)(()=>T(e,s,t,n,r,l,u),[e,s,n,r,l,u,Math.floor(t.getTime()/6e4)])}function T(e,s,t,i,o,n,r){const{s:l,e:u,key:h}=(0,b.venueRange)(n,'wage',s,t),p=(0,c.ymd)(l),f=(0,c.ymd)(u),x=i.filter(s=>s.staffId===e&&s.date>=p&&s.date<=f&&s.in).sort((e,s)=>e.date.localeCompare(s.date)).map(e=>{const s=(0,y.paidMins)(e,t);return{a:e,...s,gross:Math.round(s.paid/60*o),open:!e.out,confirmed:(0,a.isConfirmed)(e)}}),w=x.filter(e=>e.confirmed),j=w.reduce((e,s)=>e+s.paid,0),T=w.reduce((e,s)=>e+s.gross,0),P=x.filter(e=>!e.open&&!e.confirmed).reduce((e,s)=>e+s.paid,0),C=r.filter(e=>e.end>=p&&e.end<=f).map(s=>({label:s.label,amount:s.rows.find(s=>s.staffId===e)?.amount??0})).filter(e=>e.amount>0),k=C.reduce((e,s)=>e+s.amount,0);return{s:l,e:u,key:h,label:`${(0,c.niceDate)(l)} \u2013 ${(0,c.niceDate)(u)} ${u.getFullYear()}`,shifts:x,paid:j,pending:P,gross:T,tips:k,tipItems:C,total:T+k,rate:o}}function P({label:e,offset:s,setOffset:t,badge:i}){return(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",disabled:s<=-12,onPress:()=>t(s-1)}),(0,f.jsxs)(n.default,{style:{alignItems:'center',flex:1},children:[(0,f.jsx)(l.T,{weight:"semibold",children:e}),i?(0,f.jsx)(l.Badge,{kind:0===s?'amber':'neutral',label:i}):null]}),(0,f.jsx)(l.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:s>=0,onPress:()=>t(s+1)})]})}function C({staffId:e}){const{meId:s,now:C,rid:k}=(0,y.useCtx)(6e4),D=e??s,R=(0,b.useVenuePay)(k).pay,z=(0,a.useOwner)(e=>e.staff).find(e=>e.id===D),M=(0,a.useOwner)(e=>e.attendance),N=(0,a.useOwner)(e=>e.troncHistory),v=(0,y.useHourly)(),B=v[D]??0,O=null!=v[D],[L,$]=(0,i.useState)(0),S=j(D,L),H=(0,r.default)().width<520,I=(0,i.useMemo)(()=>[-1,-2,-3,-4,-5,-6].map(e=>({o:e,...T(D,e,C,M,B,R,N)})),[D,M,B,R,N]);return(0,f.jsxs)(n.default,{style:{gap:10},children:[(0,f.jsx)(l.Banner,{kind:"info",title:w,children:"Gross pay from your clocked hours at your hourly rate, plus tips shared to you. Tax, National Insurance and pension come off in payroll."}),(0,f.jsxs)(l.Muted,{children:[x(z?.name)," \xb7 ",z?.job," \xb7 ",O?`${(0,u.gbp)(B)}/hour`:'Hourly rate not set yet'," \xb7 Paid on the ",R.wagePayDay,[1,21,31].includes(R.wagePayDay)?'st':[2,22].includes(R.wagePayDay)?'nd':[3,23].includes(R.wagePayDay)?'rd':'th',", cut-off the ",R.wageCutoffDay,[1,21].includes(R.wageCutoffDay)?'st':[2,22].includes(R.wageCutoffDay)?'nd':[3,23].includes(R.wageCutoffDay)?'rd':'th',e?'':' (set by your manager)']}),(0,f.jsx)(P,{label:S.label,offset:L,setOffset:$,badge:0===L?'Current period':void 0}),(0,f.jsxs)(l.Card,{children:[(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{children:"Confirmed paid hours"}),(0,f.jsx)(l.T,{weight:"semibold",children:(0,y.hmDur)(S.paid)})]}),S.pending?(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{colour:h.colours.amber,children:"Pending sign-off"}),(0,f.jsx)(l.T,{colour:h.colours.amber,children:(0,y.hmDur)(S.pending)})]}):null,(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{children:"Gross pay from hours"}),(0,f.jsx)(l.T,{weight:"semibold",children:(0,u.gbp)(S.gross)})]}),(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{children:"Tips allocated"}),(0,f.jsx)(l.T,{weight:"semibold",children:(0,u.gbp)(S.tips)})]}),S.tipItems.map(e=>(0,f.jsxs)(l.Muted,{children:[" Tips for ",e.label,": ",(0,u.gbp)(e.amount)]},e.label)),(0,f.jsx)(n.default,{style:{height:1,backgroundColor:h.colours.border}}),(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{weight:"bold",children:"Total gross"}),(0,f.jsx)(l.T,{size:20,weight:"bold",colour:h.colours.gold,children:(0,u.gbp)(S.total)})]}),(0,f.jsxs)(l.Muted,{children:[w,". Tips are shown separately and only once a tip period is approved."]})]}),(0,f.jsx)(p.SectionHead,{title:"Shifts",sub:"Paid hours = clock out \u2212 clock in \u2212 break"}),H?(0,f.jsxs)(n.default,{testID:"pay-shifts-list",children:[S.shifts.map(e=>(0,f.jsxs)(n.default,{style:{paddingVertical:8,borderBottomWidth:1,borderColor:'#222',gap:2},children:[(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{size:14,weight:"semibold",children:(0,c.niceDate)(new Date(e.a.date+'T12:00:00'))}),(0,f.jsx)(l.T,{size:14,weight:"semibold",colour:e.open||e.confirmed?void 0:h.colours.amber,children:e.open?'On now':e.confirmed?(0,u.gbp)(e.gross):'Pending'})]}),(0,f.jsxs)(l.Muted,{children:[(0,c.hm)(new Date(e.a.in)),"\u2013",e.a.out?(0,c.hm)(new Date(e.a.out)):'now',e.open?'':` \xb7 ${e.brk}m break \xb7 ${(0,y.hmDur)(e.paid)} paid`]})]},e.a.id)),S.shifts.length?null:(0,f.jsx)(l.Muted,{style:{paddingVertical:8},children:"No clocked shifts in this period."}),S.shifts.length?(0,f.jsxs)(l.Muted,{children:["At ",(0,u.gbp)(S.rate),"/hour."]}):null]}):(0,f.jsx)(t.WideTable,{children:(0,f.jsxs)(n.default,{children:[(0,f.jsx)(t.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:h.colours.border,paddingBottom:4},children:['Date','In','Out','Break','Paid','Rate','Gross'].map((e,s)=>(0,f.jsx)(l.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{width:[86,50,50,50,62,56,64][s]},children:e},e))}),S.shifts.map(e=>(0,f.jsxs)(t.TRow,{heads:['Date','In','Out','Break','Paid','Rate','Gross'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,f.jsx)(l.T,{size:13,style:{width:86},children:(0,c.niceDate)(new Date(e.a.date+'T12:00:00'))}),(0,f.jsx)(l.T,{size:13,style:{width:50},children:(0,c.hm)(new Date(e.a.in))}),(0,f.jsx)(l.T,{size:13,style:{width:50},children:e.a.out?(0,c.hm)(new Date(e.a.out)):'on now'}),(0,f.jsx)(l.T,{size:13,style:{width:50},children:e.open?'\u2013':`${e.brk}m`}),(0,f.jsx)(l.T,{size:13,style:{width:62},children:e.open?'\u2013':(0,y.hmDur)(e.paid)}),(0,f.jsx)(l.T,{size:13,style:{width:56},children:(0,u.gbp)(S.rate)}),(0,f.jsx)(l.T,{size:13,weight:"semibold",style:{width:64},colour:e.open||e.confirmed?void 0:h.colours.amber,children:e.open?'\u2013':e.confirmed?(0,u.gbp)(e.gross):'Pending'})]},e.a.id)),S.shifts.length?null:(0,f.jsx)(l.Muted,{style:{paddingVertical:8},children:"No clocked shifts in this period."})]})}),S.shifts.some(e=>e.open)?(0,f.jsx)(l.Muted,{children:"The shift you\u2019re on now is added once you clock out."}):null,S.pending?(0,f.jsx)(l.Muted,{children:"Hours marked Pending count once a manager signs them off."}):null,(0,f.jsx)(p.SectionHead,{title:"History"}),I.map(e=>(0,f.jsx)(o.default,{accessibilityRole:"button",accessibilityLabel:`Pay period ${e.label}`,onPress:()=>$(e.o),children:(0,f.jsxs)(l.Card,{children:[(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{weight:"semibold",children:e.label}),(0,f.jsx)(l.T,{weight:"bold",children:(0,u.gbp)(e.total)})]}),(0,f.jsxs)(l.Muted,{children:[(0,y.hmDur)(e.paid)," paid \xb7 ",(0,u.gbp)(e.gross)," from hours",e.tips?` + ${(0,u.gbp)(e.tips)} tips`:''," \xb7 ",w.toLowerCase()]})]})},e.o))]})}},1032,[874,1355,30,263,127,287,813,854,816,818,821,953,954,1288,24]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.DisplaysPage=function(){const e=(0,h.useSync)(e=>e.venueId)??(x.PITCH?'pitch':void 0),s=(0,h.useSync)(e=>x.PITCH?'live':e.mode),a=(0,h.useSync)(e=>e.perms.includes('*')||e.perms.includes('devices.manage'))||x.PITCH,[l,o]=(0,t.useState)([]),[r,d]=(0,t.useState)('Kitchen tablet'),[c,u]=(0,t.useState)(7),[y,f]=(0,t.useState)(!0),[k,S]=(0,t.useState)(null),[v,_]=(0,t.useState)(''),C=(0,t.useCallback)(async()=>{if(e)try{o((await(0,h.rpc)('list_displays',{p_venue:e})??[]).sort((e,s)=>s.created_at.localeCompare(e.created_at))),_('')}catch(e){_(String(e?.message??e))}},[e]);if((0,t.useEffect)(()=>{C()},[C]),!e||'signin'===s||'local'===s)return(0,w.jsx)(i.Banner,{kind:"info",title:"Connect first",children:"Displays are paired through your venue\u2019s shared system. Open your personal invite link on this device once, then come back here."});if(!a)return(0,w.jsx)(i.Banner,{kind:"info",title:"Managers only",children:"Ask a manager to pair or switch off a display."});const T=async e=>{try{const s=(await(0,h.rpc)('new_code_for_display',{p_token_id:e.id,p_hours:24*c}))?.[0];s&&S({code:s.code,label:e.label,expires:s.expires_at}),C()}catch(e){_(String(e?.message??e))}},[P,I]=(0,t.useState)(null),B=async e=>{try{await(0,h.rpc)('revoke_display',{p_token_id:e.id}),C()}catch(e){_(String(e?.message??e))}};return(0,w.jsxs)(n.default,{style:{gap:10},testID:"displays-page",children:[(0,w.jsxs)(i.Card,{children:[(0,w.jsx)(i.T,{weight:"semibold",children:"Pair a display"}),(0,w.jsx)(i.Muted,{children:"Make a one-time code, then type it on the tablet (Display app \u2192 Pair this display) or open the pairing link on it. Each code works once."}),(0,w.jsx)(i.Field,{label:"Name",value:r,onChangeText:d,placeholder:"e.g. Kitchen tablet"}),(0,w.jsx)(i.T,{size:14,children:"Code lasts"}),(0,w.jsx)(i.Row,{wrap:!0,gap:6,children:[1,7,14].map(e=>(0,w.jsx)(i.Chip,{label:1===e?'1 day':`${e} days`,selected:c===e,onPress:()=>u(e)},e))}),(0,w.jsx)(i.Toggle,{label:"Can sell, count and seat (not just view)",value:y,onChange:f}),(0,w.jsx)(i.Button,{testID:"display-create",label:"Make a pairing code",onPress:async()=>{try{const s=(await(0,h.rpc)('create_display_code',{p_venue:e,p_label:r.trim()||'Display',p_hours:24*c,p_can_write:y}))?.[0];s&&S({code:s.code,label:r.trim()||'Display',expires:s.expires_at}),C()}catch(e){_(String(e?.message??e))}}}),k?(0,w.jsxs)(n.default,{testID:"display-code",style:{gap:4,padding:12,borderRadius:12,borderWidth:1,borderColor:p.colours.gold},children:[(0,w.jsxs)(i.T,{size:13,colour:p.colours.muted,children:[k.label," \xb7 until ",j(k.expires)]}),(0,w.jsx)(i.T,{size:28,weight:"bold",style:{letterSpacing:3},children:k.code.replace(/(.{5})/,'$1 ')}),(0,w.jsx)(i.T,{size:13,colour:p.colours.muted,children:b(k.code)}),(0,w.jsx)(i.Muted,{children:"Shown once. If it\u2019s lost, make a new code for this display below."})]}):null]}),v?(0,w.jsx)(i.Banner,{kind:"warn",title:"Couldn\u2019t update displays",children:v}):null,(0,w.jsxs)(i.Card,{children:[(0,w.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(i.T,{weight:"semibold",children:"Your displays"}),(0,w.jsx)(i.Button,{small:!0,kind:"secondary",label:"Refresh",onPress:C})]}),0===l.length?(0,w.jsx)(i.Muted,{children:"No displays yet."}):l.map(e=>(0,w.jsxs)(n.default,{testID:`display-${e.label}`,style:{paddingVertical:8,borderTopWidth:1,borderTopColor:p.colours.border,gap:4},children:[(0,w.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(i.T,{weight:"semibold",children:e.label}),(0,w.jsx)(i.T,{size:13,colour:e.revoked_at?p.colours.red:e.sessions?p.colours.ok:p.colours.muted,children:e.revoked_at?`Switched off ${j(e.revoked_at)}`:e.sessions?`Paired (${e.sessions})`:e.open_codes?'Waiting for pairing':'Not paired'})]}),(0,w.jsxs)(i.Muted,{children:[e.can_write?'Can sell, count and seat':'View only',e.last_seen_at?` \xb7 last seen ${j(e.last_seen_at)}`:'',e.open_codes?` \xb7 ${e.open_codes} unused code${1===e.open_codes?'':'s'}`:'']}),e.revoked_at?null:P===e.id?(0,w.jsxs)(n.default,{style:{gap:6},children:[(0,w.jsxs)(i.T,{size:13,children:["Switch off \u201c",e.label,"\u201d? It stops showing the venue\u2019s live data straight away and needs a new code to pair again."]}),(0,w.jsxs)(i.Row,{gap:6,children:[(0,w.jsx)(i.Button,{small:!0,kind:"danger",label:"Yes, switch off",testID:"display-off-yes",onPress:()=>{I(null),B(e)}}),(0,w.jsx)(i.Button,{small:!0,kind:"ghost",label:"Keep it on",onPress:()=>I(null)})]})]}):(0,w.jsxs)(i.Row,{gap:6,children:[(0,w.jsx)(i.Button,{small:!0,kind:"secondary",label:"New code",onPress:()=>T(e)}),(0,w.jsx)(i.Button,{small:!0,kind:"danger",label:"Switch off\u2026",onPress:()=>I(e.id)})]})]},e.id)),(0,w.jsx)(i.Muted,{children:"Switching a display off disconnects it straight away. It then shows its own data only, until it\u2019s paired again."})]})]})},_e.TrackedStockPage=function(){const a=(0,r.useOwner)(e=>e.site),l=(0,d.useShellStore)(e=>e.items[a])??[],o=(0,c.useOrderSheets)(e=>e.sheets[a])??[],[x,y]=(0,t.useState)(null),j=!(0,h.useSync)(e=>'live'===e.mode||'offline'===e.mode)||(0,h.can)('stock.manage');return(0,w.jsxs)(n.default,{style:{gap:10},testID:"tracked-stock",children:[(0,w.jsx)(i.Banner,{kind:"info",title:"Tracked stock",children:"Things you count live through service, like lobster and crab. Each item gets a counter in the Display, Staff and Head Chef apps, with sell, delivery, recount and undo, and a low-stock warning."}),l.map(e=>(0,w.jsxs)(i.Card,{children:[(0,w.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsxs)(i.T,{weight:"semibold",children:[e.icon," ",e.name,e.active?'':' (not tracked)']}),j?(0,w.jsx)(i.Button,{small:!0,kind:"secondary",label:"Edit",testID:`stock-edit-${e.key}`,onPress:()=>y({...e})}):null]}),(0,w.jsxs)(i.Muted,{children:['kg'===e.unit?'Fish weight in stone':'half'===e.unit?'Sold in halves':'Whole units'," \xb7 low at ",'kg'===e.unit?(0,s.fishQtyText)(a,e,e.lowAt):e.lowAt," \xb7 ",o.find(s=>s.id===e.supplierId)?.name??'no supplier set']})]},e.key)),j&&!x?(0,w.jsx)(i.Button,{testID:"stock-add",label:"Add an item to track",onPress:()=>y(f())}):null,x?(0,w.jsxs)(i.Card,{highlight:p.colours.gold,children:[(0,w.jsx)(i.T,{weight:"semibold",children:x.key?`Edit ${x.name}`:'New tracked item'}),(0,w.jsx)(i.Field,{label:"Name",value:x.name,onChangeText:e=>y({...x,name:e}),placeholder:"e.g. Oysters",testID:"stock-name"}),(0,w.jsx)(i.Field,{label:"Plural (optional)",value:x.plural,onChangeText:e=>y({...x,plural:e}),placeholder:"e.g. Oysters"}),(0,w.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(i.Chip,{label:"Whole units",selected:'whole'===x.unit,onPress:()=>y({...x,unit:'whole'})}),(0,w.jsx)(i.Chip,{label:"Halves too",selected:'half'===x.unit,onPress:()=>y({...x,unit:'half'})}),(0,e.isAnchorage)(a)&&(0,s.isFishName)(x.name)?(0,w.jsx)(i.Chip,{label:"Fish weight (stone)",selected:'kg'===x.unit,onPress:()=>y({...x,unit:'kg',lowAt:(0,s.fromStone)(.5)})}):null]}),(0,w.jsx)(i.Field,{label:'kg'===x.unit?"Warn at or below (stone)":"Warn when at or below",value:String('kg'===x.unit?(0,s.halfStone)((0,s.toStone)(x.lowAt)):x.lowAt),onChangeText:e=>{const t=Number(e.replace(/[^0-9.]/g,''))||0;y({...x,lowAt:'kg'===x.unit?(0,s.fromStone)((0,s.halfStone)(t)):t})},keyboardType:"decimal-pad"}),(0,w.jsx)(i.Field,{label:"Icon (an emoji)",value:x.icon,onChangeText:e=>y({...x,icon:e.slice(0,4)})}),(0,w.jsx)(i.T,{size:14,children:"Supplier"}),(0,w.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(i.Chip,{label:"None",selected:!x.supplierId,onPress:()=>y({...x,supplierId:void 0})}),o.map(e=>(0,w.jsx)(i.Chip,{label:e.name,selected:x.supplierId===e.id,onPress:()=>y({...x,supplierId:e.id})},e.id))]}),(0,w.jsx)(i.Toggle,{label:"Show the counter",value:x.active,onChange:e=>y({...x,active:e})}),(0,w.jsxs)(i.Row,{gap:6,children:[(0,w.jsx)(i.Button,{testID:"stock-save",label:"Save",disabled:!x.name.trim(),onPress:()=>{if(!x)return;const e=x.name.trim();if(!e)return;const s=x.key||(0,u.stockKey)(e);!x.key&&l.some(e=>e.key===s)||(d.useShellStore.getState().saveItem(a,{...x,key:s,name:e,plural:x.plural.trim()||`${e}s`,lowAt:Math.max(0,Number(x.lowAt)||0)}),y(null))}}),(0,w.jsx)(i.Button,{kind:"secondary",label:"Cancel",onPress:()=>y(null)})]}),(0,w.jsx)(i.Muted,{children:"To stop counting something, switch \u201cShow the counter\u201d off. Its history is kept."})]}):null]})},_e.BreakRoomSettings=function(){const e=(0,r.useOwner)(e=>e.site),s=(0,o.useStore)(s=>!1!==s.restaurants.find(s=>s.id===e)?.settings?.games),a=(0,o.useStore)(s=>s.restaurants.find(s=>s.id===e)?.settings?.gameUrl??''),[l,d]=(0,t.useState)(a),c=!l.trim()||!!(0,y.validGameUrl)(l);return(0,w.jsxs)(n.default,{style:{gap:10},children:[(0,w.jsx)(i.Card,{children:(0,w.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsxs)(n.default,{style:{flex:1},children:[(0,w.jsx)(i.T,{weight:"semibold",children:"Break room game"}),(0,w.jsx)(i.Muted,{children:"Lenny\u2019s Kitchen Chaos in the Staff app, with the team as characters and a shared leaderboard. Only playable on a break or when not clocked in."})]}),(0,w.jsx)(i.Toggle,{label:"Break room game",value:s,onChange:s=>o.useStore.getState().updateSettings(e,{games:s})})]})}),(0,w.jsxs)(i.Card,{children:[(0,w.jsx)(i.T,{weight:"semibold",children:"Game address (advanced)"}),(0,w.jsxs)(i.Muted,{children:["The game loads from its own web address, so new levels and fixes arrive without updating CoverCharge. Leave blank to use the standard one (",y.LENNY_GAME_URL,")."]}),(0,w.jsx)(i.Field,{testID:"game-url",label:"Game address",value:l,onChangeText:d,autoCapitalize:"none",autoCorrect:!1,placeholder:y.LENNY_GAME_URL}),c?null:(0,w.jsx)(i.T,{size:13,colour:p.colours.red,children:"Use a full https:// address."}),(0,w.jsxs)(i.Row,{gap:6,children:[(0,w.jsx)(i.Button,{small:!0,label:"Save address",disabled:!c||l.trim()===a,onPress:()=>o.useStore.getState().updateSettings(e,{gameUrl:l.trim()?(0,y.validGameUrl)(l):void 0})}),a?(0,w.jsx)(i.Button,{small:!0,kind:"secondary",label:"Use the standard address",onPress:()=>{d(''),o.useStore.getState().updateSettings(e,{gameUrl:void 0})}}):null]})]})]})};var e=_r(_d[0]),s=_r(_d[1]),t=_r(_d[2]);_r(_d[3]);var a,l=_r(_d[4]),n=(a=l)&&a.__esModule?a:{default:a},i=_r(_d[5]),o=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),p=_r(_d[12]),x=_r(_d[13]),y=_r(_d[14]),w=_r(_d[15]);const j=e=>e?new Date(e).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'}):'',b=e=>'undefined'!=typeof window?`${window.location.origin}/display-app/index.html?pair=${e}`:`display-app/index.html?pair=${e}`;const f=()=>({key:'',name:'',plural:'',unit:'whole',lowAt:4,icon:'\ud83d\udce6',sort:50,active:!0})},1033,[1125,1149,30,122,127,813,870,854,1148,1059,1151,820,821,2,1348,24]); +__d(function(g,r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ListBadge=C,_e.OrderListsScreen=function({rid:e,who:t,editor:s,today:i}){(0,o.useEffect)(()=>{x.useOrderLists.getState().ensure(e)},[e]);const d=(0,x.useOrderLists)(e=>e.lists).filter(t=>t.rid===e&&!t.archived),n=(0,x.useOrderLists)(e=>e.items);(0,x.useOrderLists)(t=>t.settings[e]);const l=(0,x.orderSettingsOf)(e).allowStaff,h=(0,x.useListOpen)(e=>e.seed),[y,j]=(0,o.useState)(null);(0,o.useEffect)(()=>{if(!h)return;const e=d.find(e=>e.seed===h);e&&(j(e.id),x.useListOpen.getState().request(void 0))},[h,d.length]);const f=s||l;if(!s&&!l)return(0,w.jsxs)(c.Card,{children:[(0,w.jsx)(c.T,{children:"Order lists are for managers and the Head Chef here."}),(0,w.jsx)(c.Muted,{children:"Ask a manager to switch on \u201cLet all staff add items\u201d."})]});const b=d.find(e=>e.id===y);if(b)return(0,w.jsx)($,{rid:e,list:b,editor:s,canAdd:f,who:t,today:i,onBack:()=>j(null)});const I=(0,x.orderSettingsOf)(e).defaultTripDay;return(0,w.jsxs)(u.default,{style:{gap:10},testID:"order-lists",children:[(0,w.jsxs)(c.Muted,{size:13,children:["Tip: add what\u2019s running low as you notice it. ",s?'On the day, tick what you got, then Finish order.':'A manager or the Head Chef places the order.']}),d.map(t=>{const s=(0,p.liveItems)(n.filter(t=>t.rid===e),t.id).filter(e=>'open'===e.status).length;return(0,w.jsx)(c.Card,{onPress:()=>j(t.id),children:(0,w.jsx)(u.default,{testID:`order-list-card-${t.seed??t.id}`,children:(0,w.jsxs)(c.Row,{gap:10,children:[(0,w.jsx)(C,{list:t}),(0,w.jsxs)(u.default,{style:{flex:1},children:[(0,w.jsx)(c.T,{weight:"semibold",children:t.name}),(0,w.jsx)(c.Muted,{size:12,children:(0,p.tripText)(t,i,I)})]}),(0,w.jsx)(c.Badge,{kind:s?'gold':'neutral',label:`${s} to get`})]})})},t.id)}),d.length?null:(0,w.jsx)(c.Muted,{children:"No order lists yet. Add one in Settings \u203a Advanced \u203a Order lists."})]})};var t=r(_d[0]),s=r(_d[1]),i=r(_d[2]),o=r(_d[3]),d=e(r(_d[4])),n=e(r(_d[5]));r(_d[6]);var l=e(r(_d[7])),u=e(r(_d[8])),c=r(_d[9]),h=r(_d[10]),x=r(_d[11]),p=r(_d[12]),y=r(_d[13]),j=r(_d[14]),f=r(_d[15]),b=r(_d[16]),w=r(_d[17]);const I={minHeight:44,borderRadius:10,borderWidth:1,borderColor:h.colours.hairline,backgroundColor:h.colours.surface2,color:h.colours.text,paddingHorizontal:10,fontSize:15},L=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'}):'',v=e=>e.replace(' (example)','').split(' ')[0];function C({list:e,size:s=40}){const i=(0,f.useLogoCache)(t=>t.byList[e.id]),[n,l]=(0,o.useState)(null);(0,o.useEffect)(()=>{let t=!0;return!i&&e.logo&&(0,b.orderLogoUrl)(e.logo).then(e=>{t&&l(e)}),()=>{t=!1}},[e.logo,i]);const x=i??n;return x?(0,w.jsx)(d.default,{testID:`list-logo-${e.seed??e.id}`,source:{uri:x},accessibilityLabel:`${e.name} logo`,style:{width:s,height:s,borderRadius:s/2,borderWidth:1,borderColor:h.colours.gold}}):(0,w.jsx)(u.default,{testID:`list-initials-${e.seed??e.id}`,accessibilityLabel:`${e.name}`,style:{width:s,height:s,borderRadius:s/2,backgroundColor:(0,t.soutersSurface)('#1c1a16'),borderWidth:1,borderColor:h.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,w.jsx)(c.T,{size:.38*s,weight:"bold",colour:h.colours.gold,children:(0,p.initials)(e.name)})})}function D({phone:e}){const t=(0,p.telHref)(e);if(!e||!t)return null;return'undefined'!=typeof navigator&&/Android|iPhone|iPad|iPod/i.test(navigator.userAgent)?(0,w.jsx)(l.default,{testID:"list-phone",accessibilityRole:"link",onPress:()=>{n.default.openURL(t)},children:(0,w.jsxs)(c.T,{colour:h.colours.gold,children:["\ud83d\udcde Call ",e]})}):(0,w.jsxs)(c.Row,{gap:8,children:[(0,w.jsx)(u.default,{testID:"list-phone",children:(0,w.jsxs)(c.T,{children:["\ud83d\udcde ",e]})}),(0,w.jsx)(c.Button,{small:!0,kind:"ghost",testID:"list-phone-copy",label:"Copy",onPress:()=>{navigator.clipboard?.writeText(e).then(()=>(0,y.notify)({id:'copied',title:'Number copied',timeoutMs:3e3}))}})]})}function T({list:e}){const t=x.useOrderLists.getState(),s=(0,f.useLogoCache)(t=>!!t.byList[e.id])||!!e.logo,i=async s=>{try{const i=await(0,j.capturePlatingPhoto)(s);if(!i)return;const o=await(0,f.squareLogo)(i.dataUrl,256);f.useLogoCache.getState().put(e.id,o);const d=await(0,b.uploadOrderLogo)(e.id,o);if(d.ok){const s=e.logo;t.updateList(e.id,{logo:d.path}),s&&(0,b.removeOrderLogo)(s)}else'offline'!==d.message&&(0,y.notify)({id:'logo',tone:'warn',title:'Logo saved on this device only',body:d.message,timeoutMs:7e3})}catch(e){(0,y.notify)({id:'logo',tone:'warn',title:'Couldn\u2019t use that picture',body:String(e.message),timeoutMs:7e3})}};return(0,w.jsxs)(c.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(c.Button,{small:!0,kind:"secondary",testID:"logo-camera",label:s?'Replace: take photo':'Logo: take photo',onPress:()=>{i('camera')}}),(0,w.jsx)(c.Button,{small:!0,kind:"secondary",testID:"logo-library",label:s?'Replace: choose':'Logo: choose image',onPress:()=>{i('library')}}),s?(0,w.jsx)(c.Button,{small:!0,kind:"ghost",testID:"logo-remove",label:"Remove logo",onPress:()=>{f.useLogoCache.getState().drop(e.id),e.logo&&(0,b.removeOrderLogo)(e.logo),t.updateList(e.id,{logo:void 0})}}):null]})}function S({rid:e,list:t,who:i}){const[d,n]=(0,o.useState)(''),[l,y]=(0,o.useState)('1'),[j,f]=(0,o.useState)(''),[b,L]=(0,o.useState)(''),[C,D]=(0,o.useState)(null),T=x.useOrderLists.getState(),S=Number(l.replace(',','.')),B=d.trim().length>0&&(0,p.validQty)(S),$=()=>{n(''),y('1'),L(''),D(null)};return(0,w.jsxs)(u.default,{testID:"order-add",style:{gap:6},children:[(0,w.jsxs)(c.Row,{gap:6,children:[(0,w.jsx)(s.TextInput,{accessibilityLabel:"Item",testID:"order-add-name",value:d,onChangeText:n,placeholder:"Item, e.g. Tennent\u2019s",placeholderTextColor:h.colours.muted,style:{...I,flex:1}}),(0,w.jsx)(s.TextInput,{accessibilityLabel:"Quantity",testID:"order-add-qty",value:l,onChangeText:y,keyboardType:"decimal-pad",style:{...I,width:64,borderColor:(0,p.validQty)(S)?h.colours.hairline:h.colours.red}})]}),(0,w.jsx)(c.Row,{wrap:!0,gap:4,children:p.UNITS.map(e=>(0,w.jsx)(c.Chip,{label:e||'no unit',selected:j===e,onPress:()=>f(e)},e||'none'))}),(0,w.jsxs)(c.Row,{gap:6,children:[(0,w.jsx)(s.TextInput,{accessibilityLabel:"Note",testID:"order-add-note",value:b,onChangeText:L,placeholder:"Note (optional)",placeholderTextColor:h.colours.muted,style:{...I,flex:1}}),(0,w.jsx)(c.Button,{testID:"order-add-save",label:"Add",disabled:!B,onPress:()=>{const s=(0,p.findDuplicate)(T.items.filter(t=>t.rid===e),t.id,d,j);s?D(s):(T.addItem(e,{listId:t.id,name:d.trim(),qty:S,unit:j,note:b.trim()||void 0,addedBy:i.id,addedByName:i.name}),$())}})]}),(0,w.jsxs)(c.Sheet,{visible:!!C,onClose:()=>D(null),title:"Already on the list",testID:"order-dup",children:[(0,w.jsx)(c.T,{children:C?`${C.name}: ${(0,p.qtyText)(C)} (added by ${v(C.addedByName)})`:''}),(0,w.jsxs)(c.Row,{gap:8,children:[(0,w.jsx)(c.Button,{testID:"order-dup-bump",label:`Add ${l} more`,onPress:()=>{C&&T.bump(C.id,S,i),$()}}),(0,w.jsx)(c.Button,{kind:"ghost",label:"Add as separate item",onPress:()=>{T.addItem(e,{listId:t.id,name:d.trim(),qty:S,unit:j,note:b.trim()||void 0,addedBy:i.id,addedByName:i.name}),$()}})]})]})]})}function B({item:e,editor:t,who:s}){const i=x.useOrderLists.getState(),o='got'===e.status?h.colours.gold:'missing'===e.status?h.colours.amber:h.colours.text;return(0,w.jsxs)(u.default,{testID:`order-item-${e.id}`,style:{borderTopWidth:1,borderColor:h.colours.hairline,paddingVertical:8,gap:4},children:[(0,w.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(c.T,{weight:"semibold",colour:o,style:{flex:1,textDecorationLine:'got'===e.status?'line-through':'none'},children:e.name}),(0,w.jsx)(c.T,{weight:"semibold",children:(0,p.qtyText)(e)})]}),e.note?(0,w.jsxs)(c.Muted,{size:12,children:["Note: ",e.note]}):null,(0,w.jsxs)(c.Muted,{size:12,children:["Added by ",v(e.addedByName)," \xb7 ",L(e.addedAt),e.bumps?.length?` \xb7 +${e.bumps.map(e=>`${e.qty} ${v(e.name)}`).join(', ')}`:'',e.carried?' \xb7 carried over':'']}),'open'!==e.status?(0,w.jsxs)(c.Muted,{size:12,children:['got'===e.status?'Got / ordered':'Missing / not in stock'," \xb7 ",e.statusBy," ",L(e.statusAt)]}):null,t?(0,w.jsxs)(c.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(c.Chip,{testID:`order-got-${e.id}`,label:"\u2713 Got / ordered",selected:'got'===e.status,onPress:()=>i.setStatus(e.id,'got'===e.status?'open':'got',s)}),(0,w.jsx)(c.Chip,{testID:`order-missing-${e.id}`,label:"Missing / not in stock",selected:'missing'===e.status,onPress:()=>i.setStatus(e.id,'missing'===e.status?'open':'missing',s)}),(0,w.jsx)(c.Chip,{testID:`order-remove-${e.id}`,label:"Remove",onPress:()=>{i.removeItem(e.id),(0,y.notify)({id:`undo-${e.id}`,title:`Removed ${e.name}`,timeoutMs:8e3,actions:[{label:'Undo',testID:'order-undo',onPress:()=>i.undoRemove(e.id)}]})}})]}):null]})}function $({rid:e,list:t,editor:d,canAdd:n,who:l,today:j,onBack:f}){(0,i.useBackLayer)(!0,f);const b=(0,x.useOrderLists)(e=>e.items),$=(0,x.useOrderLists)(e=>e.history).filter(e=>e.listId===t.id),P=(0,p.liveItems)(b.filter(t=>t.rid===e),t.id),[k,R]=(0,o.useState)(!1),[O,M]=(0,o.useState)(!1),[A,z]=(0,o.useState)(t.phone??''),N=x.useOrderLists.getState(),q=P.filter(e=>'got'!==e.status).length,H=(0,x.orderSettingsOf)(e).defaultTripDay;return(0,w.jsxs)(u.default,{style:{gap:10},testID:`order-list-${t.seed??t.id}`,children:[(0,w.jsx)(i.BackButton,{onPress:f,testID:"order-list-back"}),(0,w.jsxs)(c.Card,{children:[(0,w.jsxs)(c.Row,{gap:10,children:[(0,w.jsx)(C,{list:t,size:48}),(0,w.jsxs)(u.default,{style:{flex:1},children:[(0,w.jsx)(c.T,{size:18,weight:"semibold",children:t.name}),(0,w.jsx)(c.Muted,{size:12,children:(0,p.tripText)(t,j,H)})]})]}),(0,w.jsx)(D,{phone:t.phone}),'trip'===t.kind&&d?(0,w.jsxs)(u.default,{style:{gap:4},children:[(0,w.jsx)(c.Muted,{size:12,children:"Trip day for this trip"}),(0,w.jsx)(c.Row,{wrap:!0,gap:4,children:[1,2,3,4,5,6,0].map(e=>(0,w.jsx)(c.Chip,{testID:`trip-day-${e}`,label:p.DAY_FULL[e].slice(0,3),selected:(t.tripDay??H)===e,onPress:()=>N.updateList(t.id,{tripDay:e})},e))})]}):null,d?(0,w.jsxs)(u.default,{style:{gap:6},children:[(0,w.jsx)(c.Row,{gap:6,children:(0,w.jsx)(s.TextInput,{accessibilityLabel:"Phone number",testID:"list-phone-edit",value:A,onChangeText:z,onBlur:()=>N.updateList(t.id,{phone:A.trim()||void 0}),placeholder:"Phone (optional)",placeholderTextColor:h.colours.muted,style:{...I,flex:1}})}),(0,w.jsx)(T,{list:t})]}):null]}),n?(0,w.jsxs)(c.Card,{children:[(0,w.jsx)(c.T,{weight:"semibold",children:"Add to this list"}),(0,w.jsx)(S,{rid:e,list:t,who:l})]}):null,(0,w.jsxs)(c.Card,{children:[(0,w.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(c.T,{weight:"semibold",children:"On the list"}),(0,w.jsx)(c.Badge,{kind:"neutral",label:`${P.length}`})]}),P.length?P.map(e=>(0,w.jsx)(B,{item:e,editor:d,who:l},e.id)):(0,w.jsx)(c.Muted,{children:"Nothing on this list yet."}),d&&P.length?(0,w.jsx)(c.Button,{testID:"order-finish",label:"Finish order",onPress:()=>R(!0)}):null]}),(0,w.jsx)(c.Button,{small:!0,kind:"ghost",testID:"order-history",label:O?'Hide history \u25b4':`History (${$.length}) \u25be`,onPress:()=>M(!O)}),O?$.map(e=>(0,w.jsxs)(c.Card,{children:[(0,w.jsxs)(c.T,{weight:"semibold",children:[L(e.finishedAt)," \xb7 ",v(e.finishedByName)]}),(0,w.jsx)(c.Muted,{size:12,children:e.items.map(e=>`${e.name} ${(0,p.qtyText)(e)}${'missing'===e.status?' (missing)':'open'===e.status?' (not got)':''}`).join(' \xb7 ')}),e.carried?(0,w.jsxs)(c.Muted,{size:12,children:[e.carried," carried over"]}):null]},e.id)):null,(0,w.jsxs)(c.Sheet,{visible:k,onClose:()=>R(!1),title:"Finish this order?",testID:"order-finish-sheet",children:[(0,w.jsxs)(c.T,{children:[P.length-q," got or ordered",q?`, ${q} not got (missing or still open)`:'',"."]}),(0,w.jsx)(c.Muted,{children:"It goes into History with today\u2019s date and your name."}),q?(0,w.jsxs)(c.T,{weight:"semibold",children:["Carry over the ",q," not got to the next order?"]}):null,(0,w.jsxs)(c.Row,{wrap:!0,gap:8,children:[q?(0,w.jsx)(c.Button,{testID:"order-finish-carry",label:"Finish and carry over",onPress:()=>{N.finish(e,t.id,!0,l),R(!1),(0,y.notify)({id:'order-done',title:`${t.name}: order finished`,body:`${q} carried over`,timeoutMs:6e3})}}):null,(0,w.jsx)(c.Button,{testID:"order-finish-clear",kind:q?'secondary':'primary',label:q?'Finish, don\u2019t carry over':'Finish order',onPress:()=>{N.finish(e,t.id,!1,l),R(!1),(0,y.notify)({id:'order-done',title:`${t.name}: order finished`,timeoutMs:6e3})}}),(0,w.jsx)(c.Button,{kind:"ghost",label:"Cancel",onPress:()=>R(!1)})]})]})]})}},1034,[878,874,947,30,196,239,122,263,127,813,821,1076,1218,1041,1307,1308,820,24]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.SoldOutList=function({rid:e,by:n,canMark:a=!0}){const f=(0,r.useSoldOut)(e=>e.entries),b=(0,i.useStore)(e=>e.clock),j=(0,i.useStore)(e=>e.menu),w=(0,i.useStore)(t=>t.restaurants.find(t=>t.id===e)),[S,I]=(0,s.useState)(''),$=(0,h.nowFrom)(b),C=(0,d.activeSoldOut)(f,e,$),D=new Set(C.map(e=>e.itemId)),M=(0,d.soldOutSettingsOf)(w?.settings?.soldOut),T=(0,u.useAutoSoldOutView)(e),L=f.filter(t=>t.rid===e&&!t.on&&t.kept&&T.reason(t.itemId)),v=(0,s.useMemo)(()=>j.filter(t=>t.restaurantId===e&&!t.hidden&&!D.has(t.id)&&(!S.trim()||t.name.toLowerCase().includes(S.trim().toLowerCase()))).sort((e,t)=>e.name.localeCompare(t.name)),[j,e,S,C.length]),B=(t,s)=>{const o=f.some(s=>s.rid===e&&s.itemId===t&&s.auto&&T.reason(t));j.some(e=>e.id===t)?(0,r.setSoldOut)(t,!1,n):r.useSoldOut.getState().back(e,t,n),x(`Back on: ${s}${o?' (kept on until the count changes)':''}`)};return(0,y.jsxs)(o.default,{testID:"soldout-list",style:{gap:10},children:[(0,y.jsx)(l.Muted,{children:"A reminder for staff. Dishes you mark sold out show on the Display and in the Sold out list in every staff app, within seconds. It doesn't change your till."}),(0,y.jsxs)(l.Card,{children:[(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'center'},wrap:!0,children:[(0,y.jsx)(l.T,{weight:"semibold",size:17,children:"Sold out now"}),(0,y.jsx)(l.T,{size:13,colour:C.length?m.colours.amber:m.colours.muted,children:C.length?(0,d.soldOutCount)(C.length):'Nothing sold out'})]}),C.length?C.map(e=>(0,y.jsxs)(o.default,{testID:`soldout-row-${e.itemId}`,style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'space-between',alignItems:'center',paddingVertical:6,borderTopWidth:1,borderTopColor:m.colours.border},children:[(0,y.jsxs)(o.default,{style:{flexShrink:1,flexGrow:1,flexBasis:160,gap:2},children:[(0,y.jsx)(l.T,{weight:"semibold",children:(0,c.withReason)(e.name,T.reason(e.itemId))}),(0,y.jsxs)(l.Muted,{children:["Since ",k(e.at),e.auto?' \xb7 Auto, from the counts \xb7 clears when the count is back up':`${e.by?` \xb7 ${e.by}`:''}${e.clearAfter?` \xb7 clears at ${k(e.clearAfter)}`:''}`]})]}),a?(0,y.jsx)(l.Button,{small:!0,kind:"secondary",label:"Back on",testID:`soldout-back-${e.itemId}`,accessibilityLabel:`Back on: ${e.name}`,onPress:()=>B(e.itemId,e.name)}):null]},e.itemId)):(0,y.jsx)(l.Muted,{children:"When a dish runs out, mark it here so everyone knows."}),L.length?(0,y.jsx)(o.default,{testID:"soldout-kept",children:(0,y.jsxs)(l.Muted,{children:["Kept on by hand while the count is short: ",L.map(e=>e.name).join(', '),". They stay on until the count changes."]})}):null,(0,y.jsxs)(l.Muted,{children:["Clears by itself: ",d.SOLD_OUT_CLEAR_LABEL[M.clear].toLowerCase(),". ",M.auto?'Dishes marked from the counts clear when the count is back up. ':'',"Managers can change this in Settings \u203a Advanced."]})]}),T.items.length?(0,y.jsx)(p,{rid:e,by:n,canEdit:a,auto:M.auto,view:T}):null,a?(0,y.jsxs)(l.Card,{children:[(0,y.jsx)(l.T,{weight:"semibold",size:17,children:"Mark a dish sold out"}),(0,y.jsx)(t.TextInput,{testID:"soldout-search",value:S,onChangeText:I,placeholder:"Find a dish",placeholderTextColor:m.colours.muted,accessibilityLabel:"Find a dish",style:{minHeight:46,borderRadius:12,borderWidth:1,borderColor:m.colours.accentBorder,backgroundColor:m.colours.surface2,color:m.colours.text,paddingHorizontal:12,fontSize:16}}),v.slice(0,60).map(e=>(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingVertical:4},wrap:!0,children:[(0,y.jsxs)(o.default,{style:{flexShrink:1,flexGrow:1,flexBasis:160},children:[(0,y.jsx)(l.T,{children:e.name}),(0,y.jsx)(l.Muted,{children:e.section})]}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"Mark sold out",testID:`soldout-mark-${e.id}`,accessibilityLabel:`Mark sold out: ${e.name}`,onPress:()=>{return t=e.id,s=e.name,(0,r.setSoldOut)(t,!0,n),void x(`Sold out: ${s}`);var t,s}})]},e.id)),v.length?null:(0,y.jsx)(l.Muted,{children:S?'No dish matches that.':'Every dish is marked sold out.'})]}):null]})};var e,t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),o=(e=n)&&e.__esModule?e:{default:e},l=_r(_d[3]),i=_r(_d[4]),r=_r(_d[5]),a=_r(_d[6]),d=_r(_d[7]),u=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),m=_r(_d[11]),y=_r(_d[12]);const k=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`},x=e=>{const t=new Date(globalThis.__ccNow??Date.now()).toISOString();for(const s of['kitchen','foh'])a.useOwner.getState().sys(s,e,t)};const f={link:'set by staff',card:'from its recipe card',description:'from its description',name:'from its name',none:''},b=e=>.5===e?'\xbd':Number.isInteger(e)?String(e):`${Math.floor(e)}\xbd`;function p({rid:e,by:t,canEdit:n,auto:i,view:r}){const[a,d]=(0,s.useState)(!1),[h,k]=(0,s.useState)(null),[x,p]=(0,s.useState)([]),j=r.dishes.filter(t=>t.uses.length||'none'===t.source&&r.links.some(s=>s.rid===e&&s.itemId===t.id&&!s.auto)),w=(a?r.dishes:j).slice().sort((e,t)=>e.name.localeCompare(t.name)),S=r.items.map(e=>`${e.name.toLowerCase()} ${b(r.counts[e.key]??0)}`).join(', '),I=(e,t,s)=>p(n=>n.map(n=>n.key===e?{...n,qty:Math.max(0,Math.min(20,n.qty+s*('half'===t.unit?.5:1)))}:n)),$=(s,n)=>{u.useSoldOutLinks.getState().setLink(e,s,n,t),k(null)};return(0,y.jsx)(o.default,{testID:"soldout-links",children:(0,y.jsxs)(l.Card,{children:[(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'center'},wrap:!0,children:[(0,y.jsx)(l.T,{weight:"semibold",size:17,children:"Dishes linked to the counts"}),(0,y.jsx)(o.default,{testID:"soldout-links-counts",children:(0,y.jsxs)(l.T,{size:13,colour:m.colours.muted,children:["Counts now: ",S]})})]}),(0,y.jsx)(l.Muted,{children:i?'When a count runs out, or drops below what a dish needs, the dish is marked sold out by itself, and put back on when the count is back up. Dishes you mark by hand are left alone.':'Marking dishes from the counts is off for this venue (Settings \u203a Advanced \u203a Sold out reminders).'}),w.map(e=>(0,y.jsxs)(o.default,{testID:`soldout-link-${e.id}`,style:{paddingVertical:6,borderTopWidth:1,borderTopColor:m.colours.border,gap:6},children:[(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'center'},wrap:!0,children:[(0,y.jsxs)(o.default,{style:{flexShrink:1,flexGrow:1,flexBasis:160},children:[(0,y.jsx)(l.T,{weight:"semibold",children:e.name}),(0,y.jsxs)(l.Muted,{children:[e.uses.length?`Uses ${(0,c.usesText)(e.uses,r.items)}`:'Not linked to the counts',f[e.source]?` \xb7 ${f[e.source]}`:'']})]}),n&&h!==e.id?(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"Change",testID:`soldout-link-edit-${e.id}`,accessibilityLabel:`Change what ${e.name} uses`,onPress:()=>{return t=e.id,s=e.uses,k(t),void p(r.items.map(e=>({key:e.key,qty:s.find(t=>t.key===e.key)?.qty??0})));var t,s}}):null]}),h===e.id?(0,y.jsxs)(o.default,{style:{gap:6},children:[r.items.map(t=>{const s=x.find(e=>e.key===t.key)?.qty??0;return(0,y.jsxs)(l.Row,{style:{alignItems:'center',gap:8},children:[(0,y.jsx)(l.T,{style:{flexGrow:1},children:t.name}),(0,y.jsx)(l.Button,{small:!0,kind:"secondary",label:"\u2013",testID:`soldout-link-${e.id}-${t.key}-minus`,accessibilityLabel:`Fewer ${t.plural.toLowerCase()}`,onPress:()=>I(t.key,t,-1)}),(0,y.jsx)(o.default,{testID:`soldout-link-${e.id}-${t.key}-qty`,style:{minWidth:28},children:(0,y.jsx)(l.T,{weight:"semibold",style:{textAlign:'center'},children:b(s)})}),(0,y.jsx)(l.Button,{small:!0,kind:"secondary",label:"+",testID:`soldout-link-${e.id}-${t.key}-plus`,accessibilityLabel:`More ${t.plural.toLowerCase()}`,onPress:()=>I(t.key,t,1)})]},t.key)}),(0,y.jsxs)(l.Muted,{children:["Per portion. ",x.some(e=>e.qty>0)?`Uses ${(0,c.usesText)(x.filter(e=>e.qty>0),r.items)}.`:'Not linked: never marked from the counts.']}),(0,y.jsxs)(l.Row,{style:{gap:8},wrap:!0,children:[(0,y.jsx)(l.Button,{small:!0,label:"Save",testID:`soldout-link-save-${e.id}`,onPress:()=>$(e.id,x.filter(e=>e.qty>0))}),(0,y.jsx)(l.Button,{small:!0,kind:"secondary",label:"Back to automatic",testID:`soldout-link-reset-${e.id}`,accessibilityLabel:`Back to automatic: ${e.guess.length?(0,c.usesText)(e.guess,r.items):'not linked'}`,onPress:()=>$(e.id,null)}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>k(null)})]}),(0,y.jsxs)(l.Muted,{children:["Automatic: ",e.guess.length?(0,c.usesText)(e.guess,r.items):'not linked'," (from the recipe card, description or name)."]})]}):null]},e.id)),w.length?null:(0,y.jsx)(l.Muted,{children:"No dish is linked yet."}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:a?'Show linked dishes only':'Link another dish',testID:"soldout-links-all",onPress:()=>d(!a)})]})})}},1035,[874,30,127,813,819,946,854,999,1069,1070,870,821,24]); +__d(function(_g,r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.GuestProfiles=function({me:e,manager:t}){const[a,h]=(0,s.useState)(''),[x,p]=(0,s.useState)(null),[y,k]=(0,s.useState)(null),[b,v]=(0,s.useState)(null),[S,C]=(0,s.useState)(null);return(0,s.useEffect)(()=>{if(!(0,u.staffServer)()||a.trim().length<2)return void p(null);const e=setTimeout(()=>{(0,u.guestSearch)(a).then(p).catch(e=>k({kind:'warn',text:(0,i.plainError)(e)}))},300);return()=>clearTimeout(e)},[a]),(0,u.staffServer)()?b?(0,g.jsx)(f,{id:b,me:e,onClose:()=>v(null),onErased:()=>{v(null),h(''),k({kind:'success',text:'Erased. The audit trail keeps a record that it happened.'})}}):S?(0,g.jsx)(j,{seed:S,me:e,onCancel:()=>C(null),onMade:e=>{C(null),v(e.id)}}):(0,g.jsxs)(l.default,{style:{gap:10},testID:"guest-profiles",children:[t?(0,g.jsx)(w,{onOpen:v}):null,(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsx)(n.Field,{label:"Find a guest: name, phone or email",value:a,onChangeText:h,autoCapitalize:"none",testID:"guest-search"}),(0,g.jsx)(n.Muted,{size:12,children:"Visits and Covers come from real bookings. A profile is only kept with the guest\u2019s OK."})]})}),y?(0,g.jsx)(n.Banner,{kind:y.kind,title:y.text}):null,x?(0,g.jsxs)(l.default,{style:{gap:8},testID:"guest-results",children:[x.profiles.map(e=>(0,g.jsx)(n.Card,{children:(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,g.jsxs)(l.default,{style:{flex:1},children:[(0,g.jsx)(n.T,{weight:"medium",children:e.name}),(0,g.jsxs)(n.Muted,{size:12,children:[(0,o.visitWords)(e.visits,0).split(' \xb7 ')[0]," \xb7 ",e.allergies.length?`Allergies: ${(0,o.allergyLine)(e.allergies)}`:'No allergies recorded']})]}),(0,g.jsx)(n.Button,{label:"Open",small:!0,testID:`guest-open-${e.name.replace(/\W+/g,'-').toLowerCase()}`,onPress:()=>v(e.id)})]})},e.id)),x.fromBookings.length?(0,g.jsx)(n.Muted,{weight:"medium",children:"From bookings (no profile yet)"}):null,x.fromBookings.map((e,s)=>(0,g.jsx)(n.Card,{children:(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,g.jsxs)(l.default,{style:{flex:1},children:[(0,g.jsx)(n.T,{weight:"medium",children:e.name}),(0,g.jsxs)(n.Muted,{size:12,children:[(0,o.visitWords)(e.visits,e.covers),e.lastVisit?` \xb7 last ${c(e.lastVisit)}`:'']})]}),(0,g.jsx)(n.Button,{label:"Make profile",kind:"ghost",small:!0,testID:`guest-make-${s}`,onPress:()=>C({name:e.name,phone:e.phone??'',email:e.email??''})})]})},s)),x.profiles.length||x.fromBookings.length?null:(0,g.jsx)(n.Muted,{children:"No guest found."}),(0,g.jsx)(n.Button,{label:"New guest",kind:"ghost",small:!0,testID:"guest-new",onPress:()=>C({name:a.trim(),phone:'',email:''})})]}):null]}):(0,g.jsx)(n.Banner,{kind:"demo",title:"Guest profiles are saved on the server",children:"Sign this device in to your venue to look guests up. There are no example guests here."})};var e,s=r(d[0]),t=r(d[1]),l=(e=t)&&e.__esModule?e:{default:e},n=r(d[2]),a=r(d[3]),i=r(d[4]),o=r(d[5]),u=r(d[6]),h=r(d[7]),g=r(d[8]);const c=e=>{if(!e)return'\u2013';try{return new Date(10===e.length?e+'T12:00:00Z':e).toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric',timeZone:'Europe/London'})}catch{return e}},x=e=>{if(!e)return'\u2013';try{return new Date(e).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return e}};function p({label:e,value:s}){return(0,g.jsxs)(l.default,{style:{minWidth:70,gap:2},children:[(0,g.jsx)(n.T,{size:20,weight:"bold",colour:h.colours.gold,children:String(s)}),(0,g.jsx)(n.Muted,{size:12,children:e})]})}function j({seed:e,me:t,onMade:a,onCancel:o}){const[h,c]=(0,s.useState)(e),[x,p]=(0,s.useState)(!1),[j,y]=(0,s.useState)(null),[f,w]=(0,s.useState)(!1);return(0,g.jsx)(l.default,{testID:"guest-make",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:8},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Make a guest profile"}),(0,g.jsx)(n.Field,{label:"Name",value:h.name,onChangeText:e=>c({...h,name:e}),testID:"guest-make-name"}),(0,g.jsx)(n.Field,{label:"Phone",value:h.phone,onChangeText:e=>c({...h,phone:e}),keyboardType:"phone-pad",testID:"guest-make-phone"}),(0,g.jsx)(n.Field,{label:"Email",value:h.email,onChangeText:e=>c({...h,email:e}),keyboardType:"email-address",autoCapitalize:"none",testID:"guest-make-email"}),(0,g.jsx)(n.Toggle,{label:"The guest said yes to us keeping a profile (visits, preferences and allergies)",value:x,onChange:p,testID:"guest-make-consent"}),(0,g.jsx)(n.Muted,{size:12,children:"Ask first. They can ask to see it or have it erased at any time."}),j?(0,g.jsx)(n.Banner,{kind:j.kind,title:j.text}):null,(0,g.jsxs)(n.Row,{style:{gap:8},children:[(0,g.jsx)(n.Button,{label:f?'Saving\u2026':'Make profile',disabled:f||!x,testID:"guest-make-save",onPress:async()=>{w(!0),y(null);try{a(await(0,u.guestMake)({...h,consent:x},t))}catch(e){y({kind:'warn',text:(0,i.plainError)(e)})}finally{w(!1)}}}),(0,g.jsx)(n.Button,{label:"Cancel",kind:"ghost",onPress:o})]})]})})})}function y({g:e,me:t,onSaved:h}){const[c,x]=(0,s.useState)(e.allergies),[p,j]=(0,s.useState)(t),[y,f]=(0,s.useState)(null),[w,k]=(0,s.useState)(!1);return(0,g.jsxs)(l.default,{style:{gap:8},testID:"guest-allergy-editor",children:[(0,g.jsx)(n.Muted,{children:"Ask the guest and tick what they tell you. Saving puts your name and the time on it."}),(0,g.jsx)(n.Row,{style:{flexWrap:'wrap',gap:6},children:a.ALLERGENS.map(e=>(0,g.jsx)(n.Chip,{label:e.short,selected:c.some(s=>s.allergen===e.id),testID:`guest-allergen-${e.id}`,onPress:()=>x((0,o.toggleAllergy)(c,e.id))},e.id))}),c.map(e=>(0,g.jsxs)(n.Row,{style:{flexWrap:'wrap',gap:6,alignItems:'center'},children:[(0,g.jsx)(n.T,{weight:"medium",children:a.ALLERGENS.find(s=>s.id===e.allergen)?.short}),a.SEVERITIES.map(s=>(0,g.jsx)(n.Chip,{label:s.label,selected:e.severity===s.id,onPress:()=>x(c.map(t=>t.allergen===e.allergen?{...t,severity:s.id}:t))},s.id))]},e.allergen)),(0,g.jsx)(n.Field,{label:"Checked with the guest by",value:p,onChangeText:j,testID:"guest-allergy-by"}),y?(0,g.jsx)(n.Banner,{kind:y.kind,title:y.text}):null,(0,g.jsx)(n.Button,{label:w?'Saving\u2026':c.length?'Save allergies (checked with the guest)':'Save: no allergies (checked with the guest)',disabled:w,testID:"guest-allergy-save",onPress:async()=>{k(!0),f(null);try{h(await(0,u.guestSignAllergies)(e.id,c,p))}catch(e){f({kind:'warn',text:(0,i.plainError)(e)})}finally{k(!1)}}})]})}function f({id:e,me:t,onClose:a,onErased:j}){const[f,w]=(0,s.useState)(null),[k,b]=(0,s.useState)(null),[v,S]=(0,s.useState)(!1),[C,D]=(0,s.useState)(!1),[I,T]=(0,s.useState)([]),[B,E]=(0,s.useState)(''),[P,M]=(0,s.useState)(''),[A,R]=(0,s.useState)(''),[N,z]=(0,s.useState)(null),O=(0,s.useCallback)(async()=>{try{const s=await(0,u.guestGet)(e);w(s),T(s.preferences),E(s.notes)}catch(e){b({kind:'warn',text:(0,i.plainError)(e)})}},[e]);(0,s.useEffect)(()=>{O()},[O]);const F=async e=>{S(!0),b(null);try{await e()}catch(e){b({kind:'warn',text:(0,i.plainError)(e)})}finally{S(!1),z(null)}};if(!f)return(0,g.jsx)(n.Card,{children:(0,g.jsx)(n.Muted,{children:k?k.text:'Opening the profile\u2026'})});const G=f.history,W=f.eraseRequest,L=!!f.erasedAt,$=JSON.stringify((0,o.tidyPrefs)(I))!==JSON.stringify(f.preferences)||B!==f.notes;return(0,g.jsxs)(l.default,{style:{gap:10},testID:"guest-profile",children:[(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,g.jsxs)(l.default,{style:{flex:1},children:[(0,g.jsx)(n.T,{size:20,weight:"bold",children:f.name}),(0,g.jsx)(n.Muted,{children:[f.phone,f.email].filter(Boolean).join(' \xb7 ')||(L?'Personal details erased':'')})]}),(0,g.jsx)(n.Button,{label:"Back",kind:"ghost",small:!0,onPress:a})]}),L?(0,g.jsx)(n.Banner,{kind:"warn",title:`Erased ${x(f.erasedAt)}`,children:"The profile\u2019s personal details were blanked. Bookings and any website bookings copy keep their own details."}):null,f.consentWithdrawnAt?(0,g.jsx)(n.Banner,{kind:"warn",title:"The guest withdrew consent",children:"Ask a manager to request erasing this profile."}):null,(0,g.jsx)(l.default,{testID:"guest-stats",children:(0,g.jsxs)(n.Row,{style:{flexWrap:"wrap",gap:14},children:[(0,g.jsx)(p,{label:"Visits",value:G.visits}),(0,g.jsx)(p,{label:"Covers",value:G.covers}),(0,g.jsx)(p,{label:"No-shows",value:G.noShows}),(0,g.jsx)(p,{label:"Upcoming",value:G.upcoming})]})}),(0,g.jsxs)(n.Muted,{size:12,children:["From real bookings matched by phone or email. First visit ",c(G.firstVisit)," \xb7 last visit ",c(G.lastVisit),"."]})]})}),(0,g.jsx)(l.default,{testID:"guest-allergies",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Allergies"}),L?null:(0,g.jsx)(n.Button,{label:C?'Close':'Check with the guest',kind:"ghost",small:!0,testID:"guest-allergy-edit",onPress:()=>D(!C)})]}),f.allergiesSignedAt?(0,g.jsxs)(l.default,{style:{gap:2},children:[(0,g.jsx)(n.T,{weight:"medium",colour:f.allergies.length?h.colours.amber:h.colours.text,children:(0,o.allergyLine)(f.allergies)}),(0,g.jsxs)(n.Muted,{size:12,children:["Checked with the guest by ",f.allergiesSignedBy,", ",x(f.allergiesSignedAt),". Check again at every visit."]})]}):(0,g.jsx)(n.Muted,{children:"Not checked yet. Nothing is assumed: ask the guest."}),C?(0,g.jsx)(y,{g:f,me:t,onSaved:e=>{w(e),D(!1),b({kind:'success',text:'Allergies saved with your name'})}}):null]})})}),L?null:(0,g.jsx)(l.default,{testID:"guest-prefs",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Preferences and notes"}),(0,g.jsxs)(n.Row,{style:{flexWrap:'wrap',gap:6},children:[I.map(e=>(0,g.jsx)(n.Chip,{label:`${e} \xd7`,selected:!0,onPress:()=>T(I.filter(s=>s!==e))},e)),o.PREFERENCE_IDEAS.filter(e=>!I.includes(e)).slice(0,6).map(e=>(0,g.jsx)(n.Chip,{label:`${e}`,onPress:()=>T((0,o.tidyPrefs)([...I,e]))},e))]}),(0,g.jsxs)(n.Row,{style:{gap:6,alignItems:'flex-end'},children:[(0,g.jsx)(l.default,{style:{flex:1},children:(0,g.jsx)(n.Field,{label:"Add a preference",value:P,onChangeText:M,testID:"guest-pref-new"})}),(0,g.jsx)(n.Button,{label:"Add",kind:"ghost",small:!0,onPress:()=>{T((0,o.tidyPrefs)([...I,P])),M('')}})]}),(0,g.jsx)(n.Field,{label:"Notes (the guest can ask to see these)",value:B,onChangeText:E,multiline:!0,testID:"guest-notes"}),$?(0,g.jsx)(n.Button,{label:v?'Saving\u2026':'Save preferences and notes',disabled:v,testID:"guest-prefs-save",onPress:()=>F(async()=>{const e=await(0,u.guestUpdate)(f.id,(0,o.tidyPrefs)(I),B,t);w(e),T(e.preferences),E(e.notes),b({kind:'success',text:'Saved'})})}):null]})})}),(0,g.jsx)(l.default,{testID:"guest-history",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:4},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Recent bookings"}),G.bookings.length?G.bookings.map((e,s)=>(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,g.jsxs)(n.T,{children:[c(e.date)," ",e.time]}),(0,g.jsxs)(n.Muted,{children:[e.covers," Covers \xb7 ",o.STATUS_WORDS[e.status]??e.status]})]},s)):(0,g.jsx)(n.Muted,{children:"No bookings match yet."}),f.loyalty?(0,g.jsxs)(n.Muted,{size:12,children:["Stamp card ",f.loyalty.cardNo,", joined ",c(f.loyalty.joined),"."]}):(0,g.jsx)(n.Muted,{size:12,children:"No stamp card linked."})]})})}),(0,g.jsx)(l.default,{testID:"guest-consent",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Consent (GDPR)"}),(0,g.jsxs)(n.Muted,{size:12,children:["\u201c",f.consentText,"\u201d Taken by ",f.consentBy,", ",x(f.consentAt),"."]}),L||f.consentWithdrawnAt?null:(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(n.Toggle,{label:"Happy to hear about offers (we still send nothing: messages are off)",value:f.marketingOk,onChange:e=>F(async()=>w(await(0,u.guestConsent)(f.id,e,!1,t))),testID:"guest-marketing"}),'withdraw'===N?(0,g.jsxs)(n.Row,{style:{gap:8},children:[(0,g.jsx)(n.Button,{label:"Yes, the guest withdrew consent",kind:"danger",small:!0,onPress:()=>F(async()=>w(await(0,u.guestConsent)(f.id,!1,!0,t)))}),(0,g.jsx)(n.Button,{label:"Keep",kind:"ghost",small:!0,onPress:()=>z(null)})]}):(0,g.jsx)(n.Button,{label:"Guest withdrew consent",kind:"ghost",small:!0,onPress:()=>z('withdraw')})]})]})})}),f.canManage?(0,g.jsx)(l.default,{testID:"guest-manager",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:8},children:[(0,g.jsx)(n.T,{weight:"semibold",children:"Manager"}),(0,g.jsx)(n.Button,{label:"Export everything we hold (file on this device)",kind:"ghost",testID:"guest-export",disabled:v,onPress:()=>F(async()=>{const e=await(0,u.guestExport)(f.id,t),s=(0,o.exportFileName)(f.name,new Date);b({kind:'success',text:(0,u.saveJsonFile)(s,e)?`Saved ${s}. Nothing was sent: hand it to the guest yourself.`:'Export made. Open the Managers app in a browser to save the file.'}),w(await(0,u.guestGet)(f.id))})}),!W||'waiting'!==W.status&&'approved'!==W.status?L?null:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsx)(n.Field,{label:"Ask to erase: reason",value:A,onChangeText:R,placeholder:"e.g. Guest asked by phone",testID:"guest-erase-reason"}),(0,g.jsx)(n.Button,{label:"Ask the owner to erase this profile",kind:"ghost",small:!0,disabled:v||A.trim().length<3,testID:"guest-erase-ask",onPress:()=>F(async()=>{await(0,u.guestEraseAsk)(f.id,A,t),R(''),w(await(0,u.guestGet)(f.id)),b({kind:'success',text:'Asked. It waits for the owner; nothing is erased yet.'})})})]}):(0,g.jsxs)(l.default,{style:{gap:6},testID:"guest-erase-status",children:[(0,g.jsx)(n.Badge,{kind:"amber",label:'waiting'===W.status?'Erase request waiting for the owner':'Owner approved erasing'}),(0,g.jsxs)(n.Muted,{size:12,children:["Asked by ",W.askedBy,", ",x(W.askedAt),": \u201c",W.reason,"\u201d"]}),f.isOwner&&'waiting'===W.status?(0,g.jsxs)(n.Row,{style:{gap:8},children:[(0,g.jsx)(n.Button,{label:"Approve erasing",kind:"danger",small:!0,testID:"guest-erase-approve",onPress:()=>F(async()=>{await(0,u.guestEraseDecide)(W.id,!0,t),w(await(0,u.guestGet)(f.id))})}),(0,g.jsx)(n.Button,{label:"Decline",kind:"ghost",small:!0,onPress:()=>F(async()=>{await(0,u.guestEraseDecide)(W.id,!1,t),w(await(0,u.guestGet)(f.id))})})]}):null,f.isOwner&&'approved'===W.status?'erase'===N?(0,g.jsxs)(n.Row,{style:{gap:8},children:[(0,g.jsx)(n.Button,{label:"Yes, erase now",kind:"danger",small:!0,testID:"guest-erase-now-yes",onPress:()=>F(async()=>{await(0,u.guestEraseApply)(W.id,t),j()})}),(0,g.jsx)(n.Button,{label:"Not now",kind:"ghost",small:!0,onPress:()=>z(null)})]}):(0,g.jsx)(n.Button,{label:"Erase now",kind:"danger",small:!0,testID:"guest-erase-now",onPress:()=>z('erase')}):null,f.isOwner?null:(0,g.jsx)(n.Muted,{size:12,children:"Only the owner can approve and erase. Nothing happens until they do."})]}),f.audit?.length?(0,g.jsxs)(l.default,{style:{gap:2},testID:"guest-audit",children:[(0,g.jsx)(n.Muted,{weight:"medium",children:"Audit trail"}),f.audit.slice(0,8).map((e,s)=>(0,g.jsxs)(n.Muted,{size:12,children:[x(e.at)," \xb7 ",o.AUDIT_WORDS[e.action]??e.action,e.detail?`: ${e.detail}`:''," \xb7 ",e.by]},s))]}):null]})})}):null,k?(0,g.jsx)(n.Banner,{kind:k.kind,title:k.text}):null]})}function w({onOpen:e}){const[t,a]=(0,s.useState)(null);return(0,s.useEffect)(()=>{(0,u.guestEraseList)().then(a).catch(()=>a([]))},[]),t?.length?(0,g.jsx)(l.default,{testID:"guest-erase-queue",children:(0,g.jsx)(n.Card,{children:(0,g.jsxs)(l.default,{style:{gap:6},children:[(0,g.jsxs)(n.T,{weight:"semibold",children:["Erase requests waiting (",t.length,")"]}),t.map(s=>(0,g.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,g.jsxs)(l.default,{style:{flex:1},children:[(0,g.jsx)(n.T,{children:s.name}),(0,g.jsxs)(n.Muted,{size:12,children:['waiting'===s.status?'Waiting for the owner':'Approved, not erased yet'," \xb7 asked by ",s.askedBy]})]}),(0,g.jsx)(n.Button,{label:"Open",kind:"ghost",small:!0,onPress:()=>s.profileId&&e(s.profileId)})]},s.id))]})})}):null}},1036,[30,127,813,814,1003,1460,1461,821,24]); +__d(function(g,r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.addDays=b,Object.defineProperty(_e,"longDay",{enumerable:!0,get:function(){return h}}),_e.BookingsDayNav=function({today:e,date:p,onDate:j,sub:w,count:x}){const[f,D]=(0,t.useState)(pb(e,6)?p:e),[$,k]=(0,t.useState)(!1),[T,C]=(0,t.useState)(p.slice(0,7)),L=Array.from({length:7},(e,t)=>b(f,t)),I=e=>{j(e),L.includes(e)||D(e)},P=t=>t===e?'Today':t===b(e,1)?'Tomorrow':t===b(e,-1)?'Yesterday':m(t),[U,S]=T.split('-').map(Number),B=y(`${T}-01`),N=new Date(Date.UTC(U,S,0)).getUTCDate(),M=[...Array(B).fill(null),...Array.from({length:N},(e,t)=>`${T}-${u(t+1)}`)],R=e=>{const t=new Date(Date.UTC(U,S-1+e,1,12));C(`${t.getUTCFullYear()}-${u(t.getUTCMonth()+1)}`)};return(0,i.jsxs)(l.default,{style:{gap:8},testID:"bookings-day-nav",children:[(0,i.jsxs)(o.Row,{wrap:!0,gap:6,children:[(0,i.jsx)(o.Button,{small:!0,kind:"secondary",label:"Earlier week",testID:"week-earlier",accessibilityLabel:`Earlier week, from ${h(b(f,-7))}`,onPress:()=>{D(b(f,-7)),j(b(f,-7))}}),(0,i.jsx)(o.Button,{small:!0,kind:"secondary",label:"Later week",testID:"week-later",accessibilityLabel:`Later week, from ${h(b(f,7))}`,onPress:()=>{D(b(f,7)),j(b(f,7))}}),p!==e?(0,i.jsx)(o.Button,{small:!0,kind:"secondary",label:"Today",testID:"day-today",accessibilityLabel:`Back to today, ${h(e)}`,onPress:()=>{D(e),j(e),k(!1)}}):null,(0,i.jsx)(o.Button,{small:!0,kind:"ghost",label:$?'Close calendar':'Pick a date',testID:"day-pick",onPress:()=>{$||C(p.slice(0,7)),k(!$)}})]}),$?(0,i.jsxs)(l.default,{testID:"day-calendar",style:{gap:6,borderWidth:1.5,borderColor:n.colours.gold,borderRadius:12,padding:10},children:[(0,i.jsxs)(o.Row,{style:{justifyContent:'space-between',alignItems:'center'},gap:6,children:[(0,i.jsx)(o.Button,{small:!0,kind:"ghost",label:"Earlier month",accessibilityLabel:"Earlier month",onPress:()=>R(-1)}),(0,i.jsxs)(o.T,{size:18,weight:"bold",colour:n.colours.goldLight,children:[d[S-1]," ",U]}),(0,i.jsx)(o.Button,{small:!0,kind:"ghost",label:"Later month",accessibilityLabel:"Later month",onPress:()=>R(1)})]}),(0,i.jsx)(o.Row,{children:c.map(e=>(0,i.jsx)(l.default,{style:{width:"14.285714285714286%",alignItems:'center'},children:(0,i.jsx)(o.T,{size:13,colour:n.colours.muted,children:e.slice(0,3)})},e))}),(0,i.jsx)(l.default,{style:{flexDirection:'row',flexWrap:'wrap'},children:M.map((t,d)=>{if(!t)return(0,i.jsx)(l.default,{style:{width:"14.285714285714286%",height:48}},`e${d}`);const c=t===p,u=x(t);return(0,i.jsxs)(s.default,{accessibilityRole:"button",testID:`cal-${t}`,accessibilityState:{selected:c},accessibilityLabel:`${h(t)}${t===e?', today':''}, ${u} booking${1===u?'':'s'}`,onPress:()=>{I(t),D(t),k(!1)},style:{width:"14.285714285714286%",height:48,alignItems:'center',justifyContent:'center',borderRadius:10,borderWidth:t===e?1.5:0,borderColor:n.colours.gold,backgroundColor:c?n.colours.goldTint:'transparent'},children:[(0,i.jsx)(o.T,{size:17,weight:c||t===e?'bold':'regular',colour:c?n.colours.goldLight:n.colours.text,children:Number(t.slice(8))}),u?(0,i.jsx)(o.T,{size:11,colour:n.colours.goldLight,children:u}):null]},t)})})]}):null,(0,i.jsx)(o.Row,{wrap:!0,gap:6,children:L.map(e=>(0,i.jsx)(o.Chip,{label:P(e),sub:w(e),selected:p===e,onPress:()=>j(e)},e))}),(0,i.jsx)(l.default,{testID:"bookings-day-title",children:(0,i.jsxs)(o.T,{size:17,weight:"semibold",colour:n.colours.goldLight,children:[h(p),pString(e).padStart(2,'0');function b(e,t){const[s,l,o]=e.split('-').map(Number),n=new Date(Date.UTC(s,l-1,o+t,12));return`${n.getUTCFullYear()}-${u(n.getUTCMonth()+1)}-${u(n.getUTCDate())}`}const y=e=>{const[t,s,l]=e.split('-').map(Number);return(new Date(Date.UTC(t,s-1,l,12)).getUTCDay()+6)%7},h=e=>{const[t,s,l]=e.split('-').map(Number);return`${c[y(e)]} ${l} ${d[s-1]} ${t}`},m=e=>{const[,t,s]=e.split('-').map(Number);return`${c[y(e)].slice(0,3)} ${s} ${d[t-1].slice(0,3)}`}},1037,[30,263,127,813,821,24]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.historyAccess=c,_e.lookupBookingDay=l,_e.useHistoricalBookingDay=function(t,o,u,y=0){const k=(0,s.useSync)(e=>[e.kind,e.venueId,e.venueSlug,e.perms.join(',')].join(':')),f=c(t),h=f&&(0,n.validPastDate)(o,u)?`${k}:${o}:${y}`:'',[w,p]=(0,e.useState)({key:'',data:null,error:''});return(0,e.useEffect)(()=>{if(!h)return void p({key:'',data:null,error:''});let e=!0;return l(t,o).then(t=>{e&&p({key:h,data:t,error:''})}).catch(t=>{e&&p({key:h,data:null,error:t.message})}),()=>{e=!1}},[h,t,o]),{allowed:f,data:h&&w.key===h?w.data:null,error:h&&w.key===h?w.error:''}};var e=r(d[0]),t=r(d[1]),n=r(d[2]),o=r(d[3]),s=r(d[4]),u=r(d[5]);function c(e){const n=s.useSync.getState();return'owner'===t.APP_VARIANT&&'staff'===n.kind&&n.venueSlug===e&&!!n.venueId&&(n.perms.includes('*')||n.perms.includes('staff.manage'))}async function l(e,t){if(!c(e))throw new Error('Sign in to the Managers app with manager or owner access to Look back.');if(!(0,n.validPastDate)(t,(0,o.venueYmd)(new Date)))throw new Error('Choose an exact past date, with day, month and year.');const l=(0,u.getSupabase)(),{data:y,error:k}=await l.rpc('historical_booking_day',{p_venue:s.useSync.getState().venueId,p_date:t});if(k||!y||!Array.isArray(y.bookings))throw new Error('Booking history could not be loaded. Reconnect and try again.');return y}},1038,[30,806,1039,818,820,862]); +__d(function(g,r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"HISTORY_LABEL",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"HISTORY_NOTE",{enumerable:!0,get:function(){return t}}),e.validPastDate=n,e.exactHistoryDate=function(o,t){if(1!==(o.match(/\b(?:\d{4}-\d{2}-\d{2}|\d{1,2}\/\d{1,2}\/\d{4}|\d{1,2}(?:st|nd|rd|th)?\s+[a-z]+\s+\d{4})\b/gi)??[]).length)return;const d=o.match(/\b(\d{4}-\d{2}-\d{2})\b/);let s=d?.[1];if(!s){const t=o.match(/\b(\d{1,2})\/(\d{1,2})\/(\d{4})\b/);t&&(s=`${t[3]}-${t[2].padStart(2,'0')}-${t[1].padStart(2,'0')}`)}if(!s){const t=o.toLowerCase().match(/\b(\d{1,2})(?:st|nd|rd|th)?\s+(january|february|march|april|may|june|july|august|september|october|november|december|jan|feb|mar|apr|jun|jul|aug|sep|sept|oct|nov|dec)\s+(\d{4})\b/),n=['jan','feb','mar','apr','may','jun','jul','aug','sep','oct','nov','dec'];t&&(s=`${t[3]}-${String(n.indexOf(t[2].slice(0,3))+1).padStart(2,'0')}-${t[1].padStart(2,'0')}`)}return s&&n(s,t)?s:void 0},Object.defineProperty(e,"historyDateLabel",{enumerable:!0,get:function(){return d}}),e.bookingDayText=function(o){const n=`Booked covers on ${d(o.date)}: ${null===o.booked_covers?'not recorded':o.booked_covers}.`,s=o.bookings.map(o=>`${o.time??'Time not recorded'}: party size ${null===o.covers?'not recorded':`${o.covers} Covers`}; ${o.table?`table ${o.table}`:'table not recorded'}; ${o.status??'status not recorded'}${o.counted?'':', excluded from Booked covers'}.`);return[n,...s,o.historical_records?"Includes previous booking system history (incomplete).":'',t,o.bookings.length?'':'No booking records found; incomplete history does not prove there were no bookings.',o.missing_covers?`${o.missing_covers} booking records have no party size; left blank.`:''].filter(Boolean).join(' ')};const o='Includes previous booking system history (incomplete)',t='Recovered booking records, not confirmed attendance. Cancelled bookings are shown but excluded from Booked covers.';function n(o,t){if(!/^\d{4}-\d{2}-\d{2}$/.test(o))return!1;const n=new Date(o+'T12:00:00Z');return!Number.isNaN(n.getTime())&&n.toISOString().slice(0,10)===o&&onew Date(o+'T12:00:00Z').toLocaleDateString('en-GB',{day:'numeric',month:'long',year:'numeric',timeZone:'Europe/London'})},1039,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useAvatars",{enumerable:!0,get:function(){return l}});var t,e=r(d[0]),o=(t=e)&&t.__esModule?t:{default:t},s=r(d[1]),n=r(d[2]);const l=(0,s.create)()((0,n.persist)((t,e)=>({photos:{},log:[],setOwn:(e,o,s,n)=>{if(!e||e!==o||!s.startsWith('data:image/'))return!1;const l=(new Date).toISOString();return t(t=>({photos:{...t.photos,[o]:{dataUrl:s,at:l}},log:[{id:`av-${Date.now().toString(36)}`,staffId:o,what:'made',by:n,at:l},...t.log].slice(0,100)})),!0},reset:(o,s)=>{if(s.id!==o&&'staff'===s.role)return!1;if(!e().photos[o])return!1;const n={...e().photos};return delete n[o],t(t=>({photos:n,log:[{id:`av-${Date.now().toString(36)}`,staffId:o,what:'reset',by:s.name,at:(new Date).toISOString()},...t.log].slice(0,100)})),!0}}),{name:'covercharge-avatars-v1',storage:(0,n.createJSONStorage)(()=>o.default),version:1}))},1040,[1024,1008,1025]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useSliders",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"notify",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"dismissNotice",{enumerable:!0,get:function(){return c}});var t=r(d[0]);let u=0;const s=t=>'urgent'===t.tone?0:'warn'===t.tone?1:2,n=(0,t.create)()((t,n)=>({queue:[],push:n=>t(t=>{const o=t.queue.find(t=>t.id===n.id),c=o?t.queue.map(t=>t.id===n.id?{...n,seq:o.seq}:t):[...t.queue,{...n,seq:++u}];return{queue:(f=c,[...f].sort((t,u)=>s(t)-s(u)||(t.seq??0)-(u.seq??0))).slice(0,40)};var f}),dismiss:u=>{const s=n().queue.find(t=>t.id===u);if(s){t(t=>({queue:t.queue.filter(t=>t.id!==u)}));try{s.onClose?.()}catch{}}},dismissWhere:t=>{for(const u of n().queue.filter(t))n().dismiss(u.id)}})),o=t=>n.getState().push(t),c=t=>n.getState().dismiss(t)},1041,[1008]); +__d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.CashUpAccessToggle=function({m:e}){const c=(0,o.useCashAccess)(s=>!0===s.byRef[e.id]),l=(0,o.useCashAccess)(e=>e.loaded),b=(0,r.useSync)(e=>'staff'===e.kind&&!!e.venueId),[y,C]=(0,s.useState)(!1),[m,x]=(0,s.useState)(null);if((0,s.useEffect)(()=>{b&&!l&&(0,u.refreshCashAccess)()},[b,l]),p(e))return(0,h.jsxs)(t.default,{testID:`cashup-access-${e.id}`,style:{gap:2},accessible:!0,accessibilityLabel:`${f(e)} can use cash up: always, as ${'owner'===e.role?'an owner':'a manager'}`,children:[(0,h.jsx)(n.T,{size:14,children:"Can use cash up"}),(0,h.jsxs)(n.Muted,{size:12,children:["Always on for ",'owner'===e.role?'owners':'managers',"."]})]});const j=async s=>{C(!0),x(null);const c=await(0,u.setStaffCashUp)(e.id,s);C(!1),x(c.ok?s?`${f(e)} can now open the cash up. The change is in the cash-up log.`:`${f(e)} can no longer open the cash up. The change is in the cash-up log.`:c.error??'Could not save.')};return(0,h.jsxs)(t.default,{testID:`cashup-access-${e.id}`,style:{gap:2},children:[(0,h.jsx)(n.Toggle,{testID:`cashup-toggle-${e.id}`,label:"Can use cash up",value:c,disabled:y||!b,onChange:e=>{j(e)}}),(0,h.jsx)(n.Muted,{size:12,children:b?c?'Can open the cash up, take a picture of the taking sheet and upload a spreadsheet.':'Off: the cash up is hidden from them and the server refuses it.':'Connect to the shared team to change this.'}),m?(0,h.jsx)(t.default,{accessibilityLiveRegion:"polite",children:(0,h.jsx)(n.Muted,{size:12,testID:`cashup-msg-${e.id}`,children:m})}):null]})},_e.CashUpAccessBadge=function({m:e}){const s=(0,o.useCashAccess)(s=>!0===s.byRef[e.id]);return p(e)||s?(0,h.jsx)(t.default,{accessible:!0,accessibilityLabel:`${f(e)} can use cash up`,testID:`cashup-badge-${e.id}`,children:(0,h.jsx)(n.Badge,{kind:"gold",label:"Cash up"})}):null},_e.NoCashUpAccess=function(){return(0,h.jsxs)(t.default,{testID:"cashup-no-access",accessible:!0,accessibilityRole:"text",accessibilityLabel:"You can't use the cash up yet. A manager can switch it on for you in Staff and roles.",style:{borderWidth:1,borderColor:l.colours.border,borderRadius:14,padding:16,gap:6,backgroundColor:l.colours.surface},children:[(0,h.jsx)(n.T,{size:18,weight:"semibold",children:"You can\u2019t use the cash up yet"}),(0,h.jsx)(n.T,{children:"A manager can switch it on for you in Staff & roles (\u201cCan use cash up\u201d)."})]})};var e,s=_r(d[0]),c=_r(d[1]),t=(e=c)&&e.__esModule?e:{default:e},n=_r(d[2]),l=_r(d[3]),o=_r(d[4]),u=_r(d[5]),r=_r(d[6]),h=_r(d[7]);const p=e=>'owner'===e.role||'manager'===e.role&&!e.managerAccess,f=e=>e.name.replace(' (example)','').split(' ')[0]},1042,[30,127,813,821,1075,1374,820,24]); +__d(function(g,_r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"pinProblem",{enumerable:!0,get:function(){return r.pinProblem}}),Object.defineProperty(_e,"ERROR_TEXT",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"errorText",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"useDisplayTiles",{enumerable:!0,get:function(){return u}}),_e.refreshTiles=async function(){const e=await l('display_staff_list',{});Array.isArray(e)&&u.setState({tiles:e,at:Date.now()});const t=await l('display_pin_lengths',{});t&&'object'==typeof t&&!('ok'in t)&&u.setState({lens:t})},_e.refreshManagers=async function(){const e=await l('display_managers',{});Array.isArray(e)&&u.setState({managers:e})},Object.defineProperty(_e,"displayClock",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"displayChangePin",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"displayAddTemp",{enumerable:!0,get:function(){return y}}),_e.setStaffPin=async function(e,n,a=4){const o=_();if(!o)return{ok:!1,error:'Sign in to the venue to set PINs (they are kept on the server only).'};const s=(0,r.pinProblem)(n,a);if(s)return{ok:!1,error:s};try{const{error:r}=await(0,t.getSupabase)().rpc('set_staff_pin',{p_venue:o,p_staff_ref:e,p_pin:n});return r?{ok:!1,error:r.message.replace(/^.*?:\s*(?=The PIN|Pick a PIN)/,'')}:{ok:!0}}catch{return{ok:!1,error:'No connection. Try again in a moment.'}}},_e.addTempStaff=async function(e){const n=_();if(!n)return{ok:!1,error:'Sign in to the venue to add temp staff (the code is made and kept on the server).'};try{const{data:r,error:a}=await(0,t.getSupabase)().rpc('add_temp_staff',{p_venue:n,p_name:e.name,p_dept:e.dept??null,p_rate:e.rate??null,p_until:e.until||null});return a?{ok:!1,error:a.message}:{ok:!0,...r}}catch{return{ok:!1,error:'No connection. Try again in a moment.'}}},Object.defineProperty(_e,"usePinStatus",{enumerable:!0,get:function(){return k}}),_e.refreshPinStatus=async function(){const e=_();if(!e)return;try{const{data:n}=await(0,t.getSupabase)().rpc('staff_pin_status',{p_venue:e});Array.isArray(n)&&k.setState(Object.fromEntries(n.map(e=>[e.staff_ref,{hasPin:e.has_pin,locked:e.locked}])),!0)}catch{}},_e.localTiles=function(e,t){return e.filter(e=>e.active&&e.displayClock&&!(e.temp&&e.tempUntil&&e.tempUntil({ref:e.id,name:e.name,nickname:e.nickname,dept:e.dept,temp:!!e.temp})).sort((e,t)=>Number(!!e.temp)-Number(!!t.temp)||e.name.localeCompare(t.name))},Object.defineProperty(_e,"displayBlockChange",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"displayBlockEdit",{enumerable:!0,get:function(){return h}});var e=_r(d[0]),t=_r(d[1]),n=_r(d[2]),r=_r(d[3]),a=_r(d[4]),o=_r(d[5]);const s={wrong:'That PIN is not right. Try again.',locked:'Too many wrong tries. Locked for 15 minutes, or ask a manager to reset your PIN.',nopin:'No PIN set yet. Ask a manager to set one in Staff & roles.',notallowed:'This person can\u2019t clock in at the Display. A manager can turn it on in Staff & roles.',already:'Already clocked in.',notin:'Not clocked in yet.',onbreak:'Already on a break.',notmanager:'Only an owner or manager can add temp staff.',format:'The new PIN must be 4 to 8 digits (6 or more for managers and owners).',weak:'Pick a PIN that is harder to guess (not all the same digit or a run like 1234).',devicelocked:'Too many wrong PINs on this Display. Wait 15 minutes, then try again.',unpaired:'Pair this Display first (Settings \u203a Devices on the Managers app), then try again.',offline:'No connection. Try again in a moment.'},c=(e,t)=>'format'===e&&t?.min?`The new PIN must be ${t.min} to 8 digits.`:s[e??'']??(e||'Something went wrong. Try again.'),p=()=>'device'===n.useSync.getState().kind&&!!n.useSync.getState().venueId;async function l(e,n){if(a.PITCH)return(0,o.pitchClock)(e,n);if(!p())return{ok:!1,error:'unpaired'};try{const{data:r,error:a}=await(0,t.getSupabase)().rpc(e,n);return a?{ok:!1,error:/paired Display/.test(a.message)?'unpaired':a.message}:r}catch{return{ok:!1,error:'offline'}}}const u=(0,e.create)(()=>({tiles:null,managers:[],lens:{}}));const f=(e,t,n,r={})=>l('display_clock',{p_staff_ref:e,p_pin:t,p_action:n,p_break_mins:r.breakMins??null,p_off_rota:!!r.offRota}),m=(e,t,n)=>l('display_change_pin',{p_staff_ref:e,p_old:t,p_new:n}),y=(e,t,n)=>l('display_add_temp',{p_manager_ref:e,p_manager_pin:t,p_name:n.name,p_dept:n.dept??null,p_rate:n.rate??null,p_until:n.until||null}),_=()=>'staff'===n.useSync.getState().kind?n.useSync.getState().venueId:void 0;const k=(0,e.create)(()=>({}));const b=(e,t,n,r,a)=>l('display_block_change',{p_manager_ref:e,p_manager_pin:t,p_block_id:n,p_action:r,p_doc:a}),h=(e,t,n,r)=>l('display_block_edit',{p_block_id:e,p_action:t,p_doc:n,p_by:r})},1043,[1008,862,820,1440,2,1441]); +__d(function(g,_r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.DisplayClockButton=function(){const[e,t]=(0,r.useState)(!1);return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(l.default,{testID:"display-clock-btn",accessibilityRole:"button",accessibilityLabel:"Clock in or out",onPress:()=>t(!0),style:({pressed:e})=>({...s.look.quiet(e),flexGrow:1}),children:(0,y.jsx)(c.T,{size:15,weight:"semibold",colour:u.colours.goldLight,children:"Clock in / out"})}),e?(0,y.jsx)(w,{onClose:()=>t(!1)}):null]})},_e.PinPad=D,_e.DisplayClockSheet=w,_e.TempCode=I,_e.AddTempForm=P;var t=_r(_d[0]),n=_r(_d[1]),o=_r(_d[2]),s=_r(_d[3]),r=_r(_d[4]),l=e(_r(_d[5])),i=e(_r(_d[6])),d=e(_r(_d[7])),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),m=_r(_d[12]),f=_r(_d[13]),b=_r(_d[14]),k=_r(_d[15]),y=_r(_d[16]);const x=()=>(new Date).toLocaleDateString('en-CA',{timeZone:'Europe/London'}),j={in:'clocked in',break_start:'started a break',break_end:'ended the break',out:'clocked out'};function D({title:e,sub:t,onDone:n,error:o,busy:s,length:d=4,min:h}){const[p,m]=(0,r.useState)('');(0,r.useEffect)(()=>{o&&m('')},[o]);const f=null!=h,b=f?8:d,k=e=>{if(s)return;const t=(p+e).slice(0,b);m(t),f||t.length!==d||(n(t),setTimeout(()=>m(''),300))},x=f?Math.max(h??4,p.length):d,j=(e,t,n)=>(0,y.jsx)(l.default,{testID:n,accessibilityRole:"button",accessibilityLabel:'\u232b'===e?'Delete':'OK'===e?'Done':e,onPress:t,style:({pressed:e})=>({width:84,height:72,borderRadius:14,alignItems:'center',justifyContent:'center',borderWidth:1,borderColor:'rgba(255,255,255,0.10)',backgroundColor:e?'rgba(201,162,74,0.25)':'#1B1A18'}),children:(0,y.jsx)(c.T,{size:28,weight:"semibold",children:e})},n);return(0,y.jsxs)(i.default,{testID:"pin-pad",style:{alignItems:'center',gap:12},children:[(0,y.jsx)(c.T,{size:20,weight:"semibold",children:e}),t?(0,y.jsx)(c.Muted,{children:t}):null,(0,y.jsx)(i.default,{testID:"pin-dots",style:{flexDirection:'row',gap:14},children:Array.from({length:x},(e,t)=>t).map(e=>(0,y.jsx)(i.default,{style:{width:18,height:18,borderRadius:9,borderWidth:2,borderColor:u.colours.gold,backgroundColor:e(0,y.jsx)(c.Row,{gap:10,children:e.map(e=>j(e,()=>k(e),`pin-key-${e}`))},e.join())),(0,y.jsxs)(c.Row,{gap:10,children:[f?j('OK',()=>{if(s||!f||p.length<(h??4))return;n(p),setTimeout(()=>m(''),300)},'pin-ok'):(0,y.jsx)(i.default,{style:{width:84}}),j('0',()=>k('0'),'pin-key-0'),j('\u232b',()=>m(p.slice(0,-1)),'pin-back')]})]})]})}function w({onClose:e,initial:t}){const{width:n}=(0,d.default)(),s=(0,h.useOwner)(e=>e.staff),w=(0,b.useDisplayTiles)(e=>e.tiles),T=(0,b.useDisplayTiles)(e=>e.managers),C=(0,b.useDisplayTiles)(e=>e.lens),S=e=>C[e]?.len??4,v=(0,k.useSync)(e=>'device'===e.kind)||o.PITCH,[B,M]=(0,r.useState)(t??{s:'tiles'}),[$,N]=(0,r.useState)(null),[A,L]=(0,r.useState)(!1),R=(0,r.useRef)(Date.now());(0,r.useEffect)(()=>{(0,b.refreshTiles)(),(0,b.refreshManagers)()},[]),(0,r.useEffect)(()=>{R.current=Date.now();const t=setInterval(()=>{Date.now()-R.current>6e4&&e()},5e3);return()=>clearInterval(t)},[B,e]),(0,r.useEffect)(()=>{if('done'!==B.s)return;const t=setTimeout(e,5e3);return()=>clearTimeout(t)},[B,e]);const _=(0,r.useMemo)(()=>w??(0,b.localTiles)(s,x()),[w,s]),E=v?T:s.filter(e=>e.active&&('owner'===e.role||'manager'===e.role)&&!e.name.includes('(example)')).map(e=>({ref:e.id,name:e.name})),F=e=>{N(null),M(e)},Y=async(e,t,n,o={})=>{L(!0);const s=await(0,b.displayClock)(e.ref,t,n,o);if(L(!1),!s.ok)return void N((0,b.errorText)(s.error));const r=s.at?(0,m.hm)(new Date(s.at)):'';(0,f.notify)({id:`display-clock-${e.ref}`,icon:'\ud83d\udd52',kicker:'VIA DISPLAY',title:`${e.name} ${j[n]}${r?` at ${r}`:''}`,body:'',tone:'normal',timeoutMs:6e3}),(0,b.refreshTiles)(),F({s:'done',text:`${e.name} ${j[n]}${r?` at ${r}`:''}. Logged via Display.`})},z=async(e,t)=>{L(!0);const n=await(0,b.displayClock)(e.ref,t,'status');L(!1),n.ok?F({s:'actions',t:e,pin:t,st:n}):N((0,b.errorText)(n.error))};let O='Clock in / out',K=null;if('tiles'===B.s){const e=n>=1100?4:n>=760?3:2;K=(0,y.jsxs)(i.default,{testID:"clock-tiles",style:{gap:12},children:[(0,y.jsx)(c.Muted,{children:"Tap your name, then type your PIN. This tablet is at the venue, so no location check is needed."}),v?null:(0,y.jsx)(c.Banner,{kind:"info",title:"Pair this Display first",children:"The names show, but clocking in needs this Display paired to the venue (Managers app \u203a Settings \u203a Devices)."}),_.length?null:(0,y.jsx)(c.Muted,{children:"Nobody is set up to clock in here yet. A manager can turn on \u201cCan clock in at the Display\u201d for a person in Staff & roles."}),(0,y.jsx)(i.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:12},children:_.map(t=>(0,y.jsxs)(l.default,{testID:`clock-tile-${t.ref}`,accessibilityRole:"button",accessibilityLabel:`${t.name}${t.temp?', temp':''}`,onPress:()=>F({s:'pin',t:t}),style:({pressed:n})=>({width:100/e-2+"%",minHeight:110,borderRadius:16,padding:14,justifyContent:'center',gap:6,borderWidth:1,borderColor:t.clockedIn?u.colours.gold:'rgba(255,255,255,0.10)',backgroundColor:n?'rgba(201,162,74,0.20)':'#1B1A18'}),children:[(0,y.jsx)(c.T,{size:24,weight:"semibold",children:(0,h.staffLabel)({name:t.name,nickname:t.nickname??void 0})}),(0,y.jsxs)(c.Row,{gap:6,wrap:!0,children:[t.dept?(0,y.jsx)(c.Muted,{children:t.dept}):null,t.temp?(0,y.jsx)(c.Badge,{kind:"gold",label:"Temp"}):null,t.clockedIn?(0,y.jsx)(c.Badge,{kind:"neutral",label:"In"}):null]})]},t.ref))}),(0,y.jsx)(c.Button,{testID:"clock-add-temp",kind:"secondary",label:"Add temp staff (manager PIN)",onPress:()=>F({s:'mgr'})})]})}else if('pin'===B.s){const e=B.t;O=`Hello ${e.name}`,K=(0,y.jsx)(D,{length:S(e.ref),title:"Type your PIN",sub:e.temp?'Temp staff: use the 4-digit code your manager gave you.':'Forgotten it? A manager can reset it in Staff & roles.',error:$,busy:A,onDone:t=>{z(e,t)}})}else if('actions'===B.s){const{t:e,pin:t,st:n}=B;O=(0,h.staffLabel)({name:e.name,nickname:e.nickname??void 0});const o=n.since?Math.round((Date.now()-new Date(n.since).getTime())/6e4):0;K=(0,y.jsxs)(i.default,{testID:"clock-actions",style:{gap:12},children:[(0,y.jsxs)(c.Muted,{children:[n.clockedIn?`Clocked in since ${n.since?(0,m.hm)(new Date(n.since)):'\u2014'}${n.onBreak?' \xb7 on a break now':''}.`:'Not clocked in.'," Tip: this is logged as \u201cvia Display\u201d."]}),$?(0,y.jsx)(c.T,{colour:u.colours.amber,children:$}):null,n.clockedIn?null:(0,y.jsx)(c.Button,{testID:"clock-do-in",label:"Clock in",disabled:A,onPress:()=>n.onRota?void Y(e,t,'in'):F({s:'offrota',t:e,pin:t})}),n.clockedIn&&!n.onBreak?(0,y.jsx)(c.Button,{testID:"clock-do-break-start",kind:"secondary",label:"Start break",disabled:A,onPress:()=>{Y(e,t,'break_start')}}):null,n.clockedIn&&n.onBreak?(0,y.jsx)(c.Button,{testID:"clock-do-break-end",kind:"secondary",label:"End break",disabled:A,onPress:()=>{Y(e,t,'break_end')}}):null,n.clockedIn?(0,y.jsx)(c.Button,{testID:"clock-do-out",label:"Clock out",disabled:A,onPress:()=>n.hadBreak||n.onBreak?void Y(e,t,'out'):F({s:'break',t:e,pin:t,worked:o})}):null,(0,y.jsx)(c.Button,{testID:"clock-change-pin",kind:"ghost",label:e.temp?'Change my code':'Change my PIN',onPress:()=>F({s:'newpin',t:e,pin:t})})]})}else if('offrota'===B.s){const{t:t,pin:n}=B;O='Do you want to sign in?',K=(0,y.jsxs)(i.default,{testID:"clock-offrota",style:{gap:12},children:[(0,y.jsx)(c.T,{size:18,children:"Should you be on the rota?"}),(0,y.jsx)(c.Muted,{children:"You\u2019re not on today\u2019s published rota. If you\u2019re working, clock in and your manager gets a note."}),(0,y.jsx)(c.Button,{testID:"clock-offrota-yes",label:"Yes, clock me in",disabled:A,onPress:()=>{Y(t,n,'in',{offRota:!0})}}),(0,y.jsx)(c.Button,{testID:"clock-offrota-no",kind:"secondary",label:"No, just visiting",onPress:e})]})}else if('break'===B.s){const{t:e,pin:t,worked:n}=B;O='Did you take a break? If so, how long?',K=(0,y.jsxs)(i.default,{testID:"forgot-break-prompt",style:{gap:10},children:[(0,y.jsx)(c.Muted,{children:"No break was recorded on this shift. Pick how long it was, or No break. Your manager can change it later in Hours."}),(0,y.jsx)(c.Row,{wrap:!0,gap:6,children:p.DEFAULT_BREAK_OPTIONS.map(o=>(0,y.jsx)(c.Chip,{testID:`forgot-break-${o}`,label:(0,p.breakLabel)(o),disabled:o>=n&&n>0,onPress:()=>{Y(e,t,'out',{breakMins:o})}},o))}),(0,y.jsx)(c.Button,{testID:"forgot-break-none",kind:"secondary",label:"No break",onPress:()=>{Y(e,t,'out',{breakMins:0})}}),n>360?(0,y.jsx)(c.Muted,{children:"UK workers are generally entitled to a 20-minute rest break when working more than 6 hours."}):null]})}else if('newpin'===B.s){const{t:e,pin:t,first:n}=B;O=e.temp?'Change my code':'Change my PIN';const o=e.temp?4:(W=e.ref,C[W]?.min??4);K=(0,y.jsx)(D,{min:o,title:n?'Type it again, then OK':`Type a new PIN (${o} to 8 digits), then OK`,sub:"Pick something that isn\u2019t 1234 or your birthday.",error:$,busy:A,onDone:async s=>{if(!n){const n=(0,b.pinProblem)(s,o);return n?void N(n):void F({s:'newpin',t:e,pin:t,first:s})}if(s!==n)return N('They didn\u2019t match. Start again.'),void M({s:'newpin',t:e,pin:t});L(!0);const r=await(0,b.displayChangePin)(e.ref,t,s);L(!1),r.ok?F({s:'done',text:`${e.name}, your ${e.temp?'code':'PIN'} is changed.`}):N((0,b.errorText)(r.error,r))}})}else if('done'===B.s)O='Done',K=(0,y.jsxs)(i.default,{testID:"clock-done",style:{gap:12},children:[(0,y.jsx)(c.T,{size:20,weight:"semibold",colour:u.colours.goldLight,children:B.text}),(0,y.jsx)(c.Button,{label:"Close",onPress:e})]});else if('mgr'===B.s)O='Add temp staff',K=(0,y.jsxs)(i.default,{testID:"clock-mgr-tiles",style:{gap:12},children:[(0,y.jsx)(c.Muted,{children:"A manager or owner taps their name and types their own PIN to add a temp."}),(0,y.jsx)(i.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:10},children:E.map(e=>(0,y.jsx)(c.Chip,{testID:`clock-mgr-${e.ref}`,label:e.name,onPress:()=>F({s:'mgrpin',m:e})},e.ref))}),E.length?null:(0,y.jsx)(c.Muted,{children:"No manager has a PIN yet. Set one in Staff & roles first."}),(0,y.jsx)(c.Button,{kind:"secondary",label:"Back",onPress:()=>F({s:'tiles'})})]});else if('mgrpin'===B.s){const e=B.m;O='Manager PIN',K=(0,y.jsx)(D,{length:S(e.ref),title:`${e.name}: type your PIN`,error:$,busy:A,onDone:t=>F({s:'temp',m:e,pin:t})})}else if('temp'===B.s){const{m:e,pin:t}=B;O='Add temp staff',K=(0,y.jsx)(P,{noPay:!0,busy:A,error:$,onSubmit:async n=>{L(!0);const o=await(0,b.displayAddTemp)(e.ref,t,n);if(L(!1),!o.ok)return N((0,b.errorText)(o.error)),void('wrong'!==o.error&&'locked'!==o.error||M({s:'mgrpin',m:e}));(0,b.refreshTiles)(),F({s:'code',name:o.name??n.name,code:o.code??''})}})}else'code'===B.s&&(O='Temp added',K=(0,y.jsx)(I,{name:B.name,code:B.code,onClose:e}));var W;return(0,y.jsx)(c.Sheet,{visible:!0,onClose:e,title:O,maxWidth:'tiles'===B.s?1100:560,testID:"display-clock-sheet",children:(0,y.jsx)(i.default,{onTouchStart:()=>{R.current=Date.now()},children:K})})}function I({name:e,code:t,onClose:n}){return(0,y.jsxs)(i.default,{testID:"temp-code",style:{gap:12,alignItems:'center'},children:[(0,y.jsxs)(c.T,{children:["Tell ",e," this code now. It won\u2019t be shown again."]}),(0,y.jsx)(c.T,{size:48,weight:"bold",colour:u.colours.goldLight,style:{letterSpacing:12},children:t}),(0,y.jsx)(c.Muted,{children:"They tap their name on the Display and type it to clock in, start and end breaks and clock out. It doesn\u2019t work in any phone app. Change it any time on the Display, or reset it in Staff & roles."}),(0,y.jsx)(c.Button,{label:"Done",onPress:n})]})}const T=['Kitchen','Front of house','Bar'],C=e=>{const t=new Date;return t.setDate(t.getDate()+e),t.toLocaleDateString('en-CA',{timeZone:'Europe/London'})};function P({onSubmit:e,busy:o,error:s,noPay:l}){const[d,h]=(0,r.useState)(''),[p,m]=(0,r.useState)(null),[f,b]=(0,r.useState)(''),[k,x]=(0,r.useState)(''),j=f.trim()?Number(f.replace(/[\xa3,\s]/g,'')):null,D=null!=j&&(!Number.isFinite(j)||j<0||j>200),w=!!k&&(!/^\d{4}-\d{2}-\d{2}$/.test(k)||k(0,y.jsx)(c.Chip,{testID:`temp-dept-${e}`,label:e,selected:p===e,onPress:()=>m(p===e?null:e)},e))}),l?null:(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(c.T,{weight:"semibold",children:"Hourly rate (optional)"}),(0,y.jsx)(n.TextInput,{testID:"temp-rate",value:f,onChangeText:b,placeholder:"\xa3 per hour, e.g. 12.21",placeholderTextColor:"#777",keyboardType:"decimal-pad",style:I}),D?(0,y.jsx)(c.T,{colour:u.colours.amber,children:"Check the hourly rate."}):null]}),(0,y.jsx)(c.T,{weight:"semibold",children:"End date (optional)"}),(0,y.jsx)(c.Row,{wrap:!0,gap:6,children:[['No end date',''],['Today',C(0)],['In 1 week',C(7)],['In 2 weeks',C(14)]].map(([e,t])=>(0,y.jsx)(c.Chip,{testID:`temp-until-${e}`,label:e,selected:k===t,onPress:()=>x(t)},e))}),(0,y.jsx)(n.TextInput,{testID:"temp-until",value:k,onChangeText:x,placeholder:"YYYY-MM-DD",placeholderTextColor:"#777",style:I}),w?(0,y.jsxs)(c.T,{colour:u.colours.amber,children:["Use a date from today on, like ",C(7),"."]}):null,(0,y.jsx)(c.Muted,{children:"After the end date they are hidden from the Display and staff lists (kept, not deleted, so their hours stay)."}),s?(0,y.jsx)(i.default,{testID:"temp-error",children:(0,y.jsx)(c.T,{colour:u.colours.amber,children:s})}):null,(0,y.jsx)(c.Button,{testID:"temp-save",label:"Add and show the code",disabled:o||!d.trim()||D||w,onPress:()=>e({name:d.trim(),dept:p,rate:j,until:k||null})})]})}},1044,[878,874,2,1353,30,263,127,287,813,821,854,1160,818,1041,1043,820,24]); +__d(function(g,_r,_i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEMO_CUSTOMER_ID",{enumerable:!0,get:function(){return c}}),_e.defaultSimStart=function(e=new Date){const t=new Date(e),r=(5-t.getDay()+7)%7;return t.setDate(t.getDate()+r),t.setHours(17,30,0,0),t},_e.buildSeed=function(d){if(r.LIVE_VENUE_BUILD&&!t.IS_ISOLATED_VENUE){const e=u(d);return{...e,restaurants:e.restaurants.filter(e=>'anchorage'===e.id),menu:o.anchorageMenu.map(e=>({...e,signOff:null})),bookings:[],waitlist:[],orders:[],stampCards:[],giftCards:[],events:e.events.filter(e=>!e.example),ratings:[],walkIns:{},counters:{order:0,table:0,booking:0},customer:{...e.customer,id:'',referralCode:'',name:'',email:'',phone:'',allergies:[],allergyConsent:!1,marketingOptIn:{}}}}return t.IS_ISOLATED_VENUE?{restaurants:[t.IS_QUEUED_VENUE?(0,e.queuedRestaurant)(t.VENUE_RID):t.IS_ABBOTSFORD?n.ABBOTSFORD_RESTAURANT:t.IS_KIRKTON?n.KIRKTON_RESTAURANT:t.IS_GREENSIDE?n.GREENSIDE_RESTAURANT:t.IS_WILDINGS?n.WILDINGS_RESTAURANT:t.IS_KIRKMICHAEL?n.KIRKMICHAEL_RESTAURANT:s.SOUTERS_RESTAURANT],menu:t.IS_SOUTERS?i.SOUTERS_MENU:[],customer:{id:'',name:'',email:'',phone:'',allergies:[],allergyConsent:!1,referralCode:'',marketingOptIn:{}},bookings:[],waitlist:[],orders:[],stampCards:[],giftCards:[],events:[],ratings:[],audit:[],alertAcks:{},walkIns:{},basket:{restaurantId:null,mode:'takeaway',lines:[]},counters:{order:0,table:0,booking:0}}:u(d)};var e=_r(_d[0]),t=_r(_d[1]),r=_r(_d[2]),n=_r(_d[3]),s=_r(_d[4]),i=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),l=_r(_d[8]);const c='cust-demo';function u(e){const t=(0,l.ymd)(e),r=e=>e.toISOString(),s=n.restaurants.map(e=>'anchorage'===e.id?{...e,sections:o.ANCHORAGE_SECTIONS}:e),i={id:c,name:'Alex Morgan',email:'alex.demo@example.com',phone:'07700 900123',allergies:[{allergen:'crustaceans',severity:'anaphylaxis'},{allergen:'mustard',severity:'allergy'}],allergyConsent:!0,referralCode:'ALEX-7K2Q',marketingOptIn:{anchorage:!0}},u=(n,s,i,o,d={})=>({id:n,ref:`BK-${n.slice(-3).toUpperCase()}`,restaurantId:'anchorage',customerId:null,name:s,partySize:i,date:t,time:o,allergies:[],notes:'',status:'confirmed',security:i>=6?'deposit':'none',depositPaid:0,...i>=6?{depositDue:1e3*i}:{},createdAt:r((0,l.addMins)(e,-4320)),...d}),m=[u('bk-101','Campbell',2,'17:00',{table:'12',status:'seated',seatedAt:r((0,l.addMins)(e,-28)),tags:['Regular']}),u('bk-102','Fraser',4,'17:30',{table:'10',tags:['VIP']}),u('bk-103','McLeod',2,'18:00',{table:'11',allergies:[{allergen:'gluten',severity:'coeliac'}],notes:'Anniversary',occasion:'anniversary'}),u('bk-104','Kerr',6,'18:00',{table:'18'}),u('bk-105','Wallace',3,'18:30',{table:'13'}),u('bk-106','Boyd',8,'19:00',{table:'1+2',dog:!0,allergies:[{allergen:'peanuts',severity:'anaphylaxis'}],notes:'Birthday \u2014 bringing a dog',occasion:'birthday'}),u('bk-107','Hamilton',2,'19:00',{table:'5'}),u('bk-108','Stewart',4,'19:30',{table:'19',tags:['Regular']}),u('bk-109','Murray',2,'20:00',{table:'16'})],p=[{id:'wl-1',restaurantId:'anchorage',number:1,name:'Paterson',partySize:2,joinedAt:r((0,l.addMins)(e,-12)),status:'waiting'},{id:'wl-2',restaurantId:'anchorage',number:2,name:'Duncan',partySize:4,joinedAt:r((0,l.addMins)(e,-4)),status:'waiting'}],h=(0,l.atTime)(e,'17:45'),I=[{id:'ord-seed-1',ref:'T-1041',restaurantId:'anchorage',customerId:'cust-other',customerName:'R. Gilmour',type:'takeaway',slotTime:r(h),lines:[{itemId:'a-fishsupper',name:'Fish Supper',qty:2,unitPrice:1800,choices:['Beer-battered'],notes:'',contains:[],may:[],overridden:!1,prepMins:12},{itemId:'a-chips',name:'Triple-Cooked Chips (V)',qty:1,unitPrice:450,choices:[],notes:'Extra salt',contains:[],may:[],overridden:!1,prepMins:6}],subtotal:4050,tip:0,giftCardApplied:0,total:4050,paid:4050,status:'acknowledged',createdAt:r((0,l.addMins)(e,-50)),allergies:[],readiness:{}},{id:'ord-seed-2',ref:'Q-2017',restaurantId:'anchorage',customerId:'cust-other2',customerName:'Table 3 guest',type:'table',tableNo:'3',lines:[{itemId:'a-moules',name:'Moules Marini\xe8re',qty:1,unitPrice:2200,choices:['Main 500g with triple-cooked chips (\xa322.00)'],notes:'',contains:[],may:[],overridden:!1,prepMins:10},{itemId:'a-claymore',name:'The Claymore Burger',qty:1,unitPrice:1800,choices:[],notes:'No gherkins',contains:[],may:[],overridden:!1,prepMins:14}],subtotal:4e3,tip:0,giftCardApplied:0,total:4e3,paid:0,status:'preparing',createdAt:r((0,l.addMins)(e,-18)),allergies:[],readiness:{}}],y=[{restaurantId:'anchorage',customerId:c,stamps:5,rewardsAvailable:0,history:[{at:'2026-08-15',source:'Dine-in (staff scan)'},{at:'2026-08-29',source:'Takeaway'},{at:'2026-09-12',source:'Table QR bill'},{at:'2026-10-02',source:'Takeaway'},{at:'2026-10-16',source:'Referral \u2014 friend\u2019s first visit'}]},{restaurantId:'saltmarsh',customerId:c,stamps:2,rewardsAvailable:0,history:[{at:'2026-09-01',source:'Dine-in'},{at:'2026-10-01',source:'Dine-in'}]}],b=[{id:'gc-1',code:'ANC-G7QX-4M2P-9TRE',restaurantId:'anchorage',initial:5e3,balance:2500,ownerId:c,recipientName:'Alex',message:'Happy birthday! (example)',createdAt:'2026-09-20'},{id:'gc-2',code:'WEB-OLD-10-EXAMPLE',restaurantId:'anchorage',initial:1e3,balance:1e3,ownerId:'legacy',recipientName:'Legacy website bookings voucher (example)',message:'',createdAt:'2026-06-01',legacy:!0}],k=[...d.SCOTTISH_BANK_HOLIDAYS.map((e,t)=>({id:`bh-${t}`,restaurantId:null,date:e.date,title:e.title+(e.notes&&!/substitute/i.test(e.notes)?` (${e.notes.toLowerCase()})`:''),kind:'bank-holiday',description:'Scottish bank holiday',example:!1,source:d.BANK_HOLIDAY_SOURCE})),{id:'ev-halloween',restaurantId:'anchorage',date:(0,l.ymd)(new Date(e.getFullYear(),9,31)),title:'Halloween weekend (example)',kind:'event',description:'Example event \u2014 busy weekend flag for the forecast.',example:!0},{id:'ev-xmas-party',restaurantId:'anchorage',date:'2026-12-04',title:'Christmas party nights begin (example)',kind:'event',description:'Example: festive set menu, deposit required for parties of 8+.',example:!0},{id:'ev-hogmanay',restaurantId:null,date:'2026-12-31',title:'Hogmanay',kind:'occasion',description:'Key dining date.',example:!1},{id:'ev-burns',restaurantId:'anchorage',date:'2027-01-25',title:'Burns Night Supper (example)',kind:'event',description:'EXAMPLE event: haggis, neeps & tatties, address to the haggis, set menu \xa348pp. Booking opens via the app.',example:!0},{id:'ev-valentines',restaurantId:null,date:'2027-02-14',title:"Valentine's Day",kind:'occasion',description:'Key dining date.',example:!1},{id:'ev-mothering',restaurantId:null,date:'2027-03-07',title:'Mothering Sunday (UK)',kind:'occasion',description:'Key dining date.',example:!1},{id:'ev-live',restaurantId:'anchorage',date:'2026-11-14',title:'Live acoustic music (example)',kind:'event',description:'EXAMPLE: local folk duo from 7pm.',example:!0},{id:'ev-school-xmas',restaurantId:null,date:'2026-12-23',title:'South Ayrshire schools close for Christmas',kind:'school-holiday',description:'23 Dec 2026 \u2013 4 Jan 2027',example:!1},{id:'ev-salt-quiz',restaurantId:'saltmarsh',date:'2026-11-05',title:'Quiz night (fictional)',kind:'event',description:'Fictional demo restaurant event.',example:!0}];return{restaurants:s,menu:[...o.anchorageMenu,...n.demoMenus],customer:i,bookings:m,waitlist:p,orders:I,stampCards:y,giftCards:b,events:k,ratings:[{id:'rt-1',restaurantId:'anchorage',customerId:'cust-x1',customerName:'Fiona (example)',stars:5,comment:'Best fish supper on the coast, and the staff were brilliant with my son\u2019s nut allergy.',createdAt:r((0,l.addMins)(e,-1560)),context:'Takeaway T-1032'},{id:'rt-2',restaurantId:'anchorage',customerId:'cust-x2',customerName:'Iain (example)',stars:4,comment:'Lovely langoustines. Bit of a wait for a table at 7.',createdAt:r((0,l.addMins)(e,-3e3)),context:'Dine-in, Table 6'},{id:'rt-3',restaurantId:'anchorage',customerId:'cust-x3',customerName:'Morag (example)',stars:2,comment:'Chips were cold by the time we collected.',createdAt:r((0,l.addMins)(e,-4320)),context:'Takeaway T-1019'}],audit:[],alertAcks:{},walkIns:{anchorage:6},basket:{restaurantId:null,mode:'takeaway',lines:[]},counters:{order:1042,table:2018,booking:110}}}},1045,[6,5,833,3,1138,1139,1140,1141,818]); +__d(function(g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"VOICE_TASKS_PER_MONTH",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"VOICE_WARN_AT",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"VOICE_FAIR_USAGE",{enumerable:!0,get:function(){return d}}),Object.defineProperty(_e,"monthKey",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"voiceUsage",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"REACHED_TEXT",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"WARN_TEXT",{enumerable:!0,get:function(){return v}}),_e.useVoiceUsage=function(e,t=new Date){const n=h(n=>n.used[e]?.[f(t)]??0);return _(n)};var e,t=r(_d[0]),n=(e=t)&&e.__esModule?e:{default:e},o=r(_d[1]),s=r(_d[2]);const u=1e3,c=.8,d='Fair usage: 1,000 voice tasks a month per venue',l=new Set(['log_check']),f=(e=new Date)=>e.getFullYear()+'-'+String(e.getMonth()+1).padStart(2,'0'),h=(0,o.create)()((0,s.persist)(e=>({used:{},add:(t,n)=>e(e=>({used:{...e.used,[t]:{[n]:(e.used[t]?.[n]??0)+1}}}))}),{name:'covercharge-voice-usage-v1',version:1,storage:(0,s.createJSONStorage)(()=>n.default)})),_=e=>{const t=e/u;return{used:e,limit:u,pct:t,warn:t>=c,reached:e>=u,line:'Voice assistant: '+e.toLocaleString('en-GB')+' of 1,000 tasks used this month, resets on the 1st'}},b={get:(e,t=new Date)=>_(h.getState().used[e]?.[f(t)]??0),allowed:(e,t,n=new Date)=>null!=t&&l.has(t)||!b.get(e,n).reached,record:(e,t=new Date)=>h.getState().add(e,f(t))},p='This venue has used its fair-usage allowance of 1,000 voice tasks for this month. It starts again on the 1st. Food safety logging still works, and the owner can contact CoverCharge if you need more.',v=e=>e.line+'. That\u2019s '+Math.round(100*e.pct)+'% of this venue\u2019s fair-usage allowance.'},1046,[1024,1008,1025]); +__d(function(_g,_r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.normaliseHex=n,e.hexToRgb=r,e.rgbToHex=o,e.hsvToRgb=s,Object.defineProperty(e,"hsvToHex",{enumerable:!0,get:function(){return a}}),e.hexToHsv=function(t){const{r:n,g:o,b:s}=r(t),a=n/255,c=o/255,u=s/255,i=Math.max(a,c,u),h=Math.min(a,c,u),l=i-h;let p=0;l&&(p=i===a?(c-u)/l%6:i===c?(u-a)/l+2:(a-c)/l+4);return{h:(60*p+360)%360,s:i?l/i:0,v:i}},e.luminance=c,e.contrast=u,e.shade=i,e.checkAccent=function(t,r,o,s){const a=n(t)??'#CFA45F',c=u(a,o),h=u(a,s),l=c>=h?o:s,p=[];Math.max(c,h)<4.5?p.push('Button text may be hard to read on this colour. We picked the clearer text colour for you, but a lighter or darker shade will read better.'):l===s&&p.push('This is a dark colour, so buttons use light text.');let b=a,d=0;for(;u(b,r)<4.5&&d<20;)b=i(a,.05*(d+1)),d++;b!==a&&p.push('This colour is hard to read on the dark background, so header text uses a lighter shade of it.');return{onAccent:l,accentText:b,tips:p}},e.pushRecent=function(t,r,o=8){const s=n(r);return s?[s,...(t??[]).filter(t=>t!==s)].slice(0,o):t??[]};const t=(t,n=0,r=1)=>Math.min(r,Math.max(n,t));function n(t){const n=t.trim().replace(/^#/,'');return/^[0-9a-fA-F]{3}$/.test(n)?'#'+n.split('').map(t=>t+t).join('').toUpperCase():/^[0-9a-fA-F]{6}$/.test(n)?'#'+n.toUpperCase():null}function r(t){const r=(n(t)??'#000000').slice(1);return{r:parseInt(r.slice(0,2),16),g:parseInt(r.slice(2,4),16),b:parseInt(r.slice(4,6),16)}}function o({r:n,g:r,b:o}){return'#'+[n,r,o].map(n=>Math.round(t(n,0,255)).toString(16).padStart(2,'0')).join('').toUpperCase()}function s({h:t,s:n,v:r}){const o=(t%360+360)%360/60,s=r*n,a=s*(1-Math.abs(o%2-1)),c=r-s,[u,i,h]=o<1?[s,a,0]:o<2?[a,s,0]:o<3?[0,s,a]:o<4?[0,a,s]:o<5?[a,0,s]:[s,0,a];return{r:255*(u+c),g:255*(i+c),b:255*(h+c)}}const a=t=>o(s(t));function c(t){const n=t=>{const n=t/255;return n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4)},{r:o,g:s,b:a}=r(t);return.2126*n(o)+.7152*n(s)+.0722*n(a)}function u(t,n){const r=c(t),o=c(n);return(Math.max(r,o)+.05)/(Math.min(r,o)+.05)}function i(t,n){const{r:s,g:a,b:c}=r(t),u=n>0?255:0,i=Math.abs(n);return o({r:s+(u-s)*i,g:a+(u-a)*i,b:c+(u-c)*i})}},1047,[]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"fmtDate",{enumerable:!0,get:function(){return m}}),_e.SignOffLine=b,_e.CardView=w,_e.CardEditor=I,_e.RecipeCards=function({rid:e,actor:n,mode:d}){const f=(0,o.useRecipeCards)(e),[j,b]=(0,t.useState)(''),[C,k]=(0,t.useState)([]),[D,v]=(0,t.useState)('free-from'),[T,S]=(0,t.useState)('all'),[B,$]=(0,t.useState)(null),[P,R]=(0,t.useState)(null),L='edit'===d&&(0,h.canEditCards)(n.role),A=L?f:f.filter(e=>!!e.signOff),M=(0,t.useMemo)(()=>{const e='all'===T?A:A.filter(e=>(0,h.cardState)(e)===T);return(0,h.filterCards)(e,j,C,D).slice().sort((e,s)=>e.section.localeCompare(s.section)||e.dish.localeCompare(s.dish))},[A,j,C,D,T]),E=f.filter(e=>!e.signOff).length,N=B?f.find(e=>e.id===B):void 0,O=P&&'new'!==P?f.find(e=>e.id===P)??null:null,H=e=>k(s=>s.includes(e)?s.filter(s=>s!==e):[...s,e]);return(0,p.jsxs)(l.default,{testID:"recipe-cards",style:{gap:12},children:['read'===d?(0,p.jsx)(a.Banner,{kind:"info",title:"Read-only",children:"Signed-off recipe cards only. The head chef keeps these up to date."}):(0,p.jsx)(a.Muted,{children:(0,h.canSignOffCards)(n.role)?'You can add, edit and sign off cards. A card only goes live once you sign it off; any edit sets it back to Awaiting sign-off.':'You can add and edit cards. The head chef signs them off before they go live; any edit sets a card back to Awaiting sign-off.'}),f.some(e=>'example'===e.origin)?(0,p.jsx)(a.Banner,{kind:"example",title:"Example data",children:"Cards marked \u201cExample data\u201d are made-up examples to show how recipe cards work. Replace them with your own dishes."}):null,L?(0,p.jsx)(a.Button,{testID:"new-card",label:"New recipe card",onPress:()=>R('new')}):null,(0,p.jsx)(s.TextInput,{testID:"card-search",accessibilityLabel:"Search recipe cards",value:j,onChangeText:b,placeholder:"Search dishes or ingredients",placeholderTextColor:"#7D776C",style:a.styles.input}),(0,p.jsxs)(a.Row,{gap:6,wrap:!0,children:[(0,p.jsx)(a.T,{size:r.font.small,colour:r.colours.muted,children:"Allergens:"}),(0,p.jsx)(a.Chip,{label:"Free from",selected:'free-from'===D,onPress:()=>v('free-from')}),(0,p.jsx)(a.Chip,{label:"Contains",selected:'contains'===D,onPress:()=>v('contains')}),C.length?(0,p.jsx)(a.Chip,{label:"Clear",onPress:()=>k([])}):null]}),(0,p.jsx)(a.Row,{gap:6,wrap:!0,children:c.ALLERGENS.map(e=>(0,p.jsx)(i.default,{testID:`filter-${e.id}`,accessibilityRole:"button",accessibilityState:{selected:C.includes(e.id)},onPress:()=>H(e.id),style:{paddingVertical:5,paddingHorizontal:10,minHeight:44,minWidth:44,justifyContent:'center',borderRadius:14,borderWidth:1,borderColor:C.includes(e.id)?r.colours.gold:r.colours.border,backgroundColor:C.includes(e.id)?r.colours.gold:'transparent'},children:(0,p.jsx)(a.T,{size:13,colour:C.includes(e.id)?r.colours.onGold:r.colours.text,children:e.short})},e.id))}),L?(0,p.jsxs)(a.Row,{gap:6,wrap:!0,children:[(0,p.jsx)(a.Chip,{label:`All (${f.length})`,selected:'all'===T,onPress:()=>S('all')}),(0,p.jsx)(a.Chip,{label:`Awaiting sign-off (${E})`,selected:'awaiting'===T,onPress:()=>S('awaiting')}),(0,p.jsx)(a.Chip,{label:`Signed off (${f.length-E})`,selected:'signed-off'===T,onPress:()=>S('signed-off')})]}):null,(0,p.jsx)(l.default,{testID:"card-count",children:(0,p.jsxs)(a.Muted,{children:[M.length," ",1===M.length?'card':'cards',C.length?` ${'free-from'===D?'free from':'containing'} ${C.map(c.allergenLabel).join('free-from'===D?' and ':' or ')}`:'']})}),M.map(e=>(0,p.jsx)(i.default,{testID:`card-${e.menuItemId}`,accessibilityRole:"button",accessibilityLabel:`${e.dish}, ${e.signOff?'signed off':'awaiting sign-off'}`,onPress:()=>$(e.id),children:(0,p.jsx)(a.Card,{highlight:!e.signOff&&L?r.colours.amber:void 0,children:(0,p.jsxs)(a.Row,{gap:12,style:{alignItems:'flex-start'},children:[(0,p.jsx)(l.default,{style:{width:84},children:(0,p.jsx)(y,{card:e,height:64})}),(0,p.jsxs)(l.default,{style:{flex:1,gap:4},children:[(0,p.jsx)(a.T,{weight:"semibold",children:e.dish}),(0,p.jsxs)(a.Muted,{children:[e.section," \xb7 ",x(e.price),'example'===e.origin?` \xb7 ${u.EXAMPLE_TAG}`:'']}),(0,p.jsxs)(a.Row,{gap:4,wrap:!0,children:[e.signOff?(0,p.jsx)(a.Badge,{label:`\u2713 ${m(e.signOff.at)}`,kind:"ok"}):(0,p.jsx)(a.Badge,{label:h.STATE_LABEL.awaiting,kind:"amber"}),c.ALLERGENS.filter(s=>e.allergens[s.id]).map(s=>(0,p.jsx)(a.Badge,{label:'may'===e.allergens[s.id]?`${s.short}?`:s.short,kind:'may'===e.allergens[s.id]?'amber':'red'},s.id))]})]})]})})},e.id)),M.length?null:(0,p.jsx)(a.Muted,{children:"No cards match."}),(0,p.jsx)(a.Sheet,{visible:!!N&&!P,onClose:()=>$(null),title:N?.dish??'',maxWidth:640,testID:"card-sheet",children:N?(0,p.jsx)(w,{card:N,actor:'read'===d?{...n,role:'staff'}:n,onEdit:L?()=>R(N.id):void 0}):null}),(0,p.jsx)(a.Sheet,{visible:!!P,onClose:()=>R(null),title:'new'===P?'New recipe card':`Edit: ${O?.dish??''}`,maxWidth:680,testID:"editor-sheet",children:P?(0,p.jsx)(I,{rid:e,card:O,actor:n,onDone:e=>{R(null),$(e)}},P):null})]})};var s=_r(_d[0]),t=_r(_d[1]),n=e(_r(_d[2])),i=e(_r(_d[3])),l=e(_r(_d[4])),r=_r(_d[5]),a=_r(_d[6]),o=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),u=_r(_d[11]),f=_r(_d[12]),p=_r(_d[13]);const m=e=>{const s=new Date(e.length<=10?`${e}T12:00:00`:e);return isNaN(+s)?e:s.toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric'})},x=e=>null==e?'Price on the board':`\xa3${(e/100).toFixed(2)}`,j={example:u.EXAMPLE_TAG,imported:'Imported from the menu',new:null};function b({card:e,testID:s}){return e.signOff?(0,p.jsxs)(l.default,{testID:s,style:{gap:2},children:[(0,p.jsx)(a.Badge,{label:`\u2713 ${h.STATE_LABEL['signed-off']}`,kind:"ok"}),(0,p.jsxs)(a.T,{size:r.font.small,colour:r.colours.ok,children:["Signed off by ",e.signOff.by," on ",m(e.signOff.at)]})]}):(0,p.jsxs)(l.default,{testID:s,style:{gap:2},children:[(0,p.jsx)(a.Badge,{label:h.STATE_LABEL.awaiting,kind:"amber"}),(0,p.jsx)(a.T,{size:r.font.small,colour:r.colours.amber,children:e.wasLive?'Edited since the last sign-off. The dish shows "awaiting allergen sign-off" to guests and cannot be ordered until the head chef signs it off.':'New dish: it stays off the menu until the head chef signs it off.'})]})}function y({card:e,height:s=180,pending:t}){const i=t?{uri:t}:e.photo?(0,d.recipeCards)().photoSource(e.photo):null;return i?(0,p.jsx)(n.default,{testID:"card-photo",accessibilityLabel:`Plating photo: ${e.dish}`,source:i,style:{width:'100%',height:s,borderRadius:12,backgroundColor:r.colours.surface2},resizeMode:"cover"}):(0,p.jsx)(l.default,{style:{height:s,borderRadius:12,backgroundColor:r.colours.surface2,alignItems:'center',justifyContent:'center',borderWidth:1,borderColor:r.colours.border},children:(0,p.jsx)(a.Muted,{children:"No plating photo yet"})})}function C({map:e}){const s=c.ALLERGENS.filter(s=>e[s.id]).map(e=>e.id);return s.length?(0,p.jsx)(a.Row,{wrap:!0,gap:6,children:s.map(s=>(0,p.jsx)(a.Badge,{label:'may'===e[s]?`May contain ${(0,c.allergenLabel)(s).toLowerCase()}`:(0,c.allergenLabel)(s),kind:'may'===e[s]?'amber':'red'},s))}):(0,p.jsx)(a.Muted,{children:"None of the UK 14 allergens."})}function w({card:e,actor:s,onEdit:n}){const[i,o]=(0,t.useState)(null),c=(0,h.signOffBlock)(e),u=j[e.origin];return(0,p.jsxs)(l.default,{testID:"card-view",style:{gap:12},children:[(0,p.jsx)(y,{card:e,height:200}),(0,p.jsxs)(a.Row,{wrap:!0,gap:6,children:[u?(0,p.jsx)(a.Badge,{label:u,kind:'example'===e.origin?'blue':'neutral'}):null,(0,p.jsx)(a.Badge,{label:e.section,kind:"gold"}),(0,p.jsx)(a.Badge,{label:x(e.price)})]}),(0,p.jsx)(b,{card:e,testID:"card-status"}),(0,p.jsx)(a.Divider,{}),(0,p.jsx)(a.H2,{children:"Allergens"}),(0,p.jsx)(l.default,{testID:"card-allergens",children:(0,p.jsx)(C,{map:e.allergens})}),e.allergenNotes?(0,p.jsx)(a.Muted,{children:e.allergenNotes}):null,e.allergensConfirmed?(0,p.jsxs)(a.Muted,{children:["Allergen list confirmed by ",e.allergensConfirmed.by," on ",m(e.allergensConfirmed.at),"."]}):null,(0,p.jsx)(a.Divider,{}),(0,p.jsx)(a.H2,{children:"Ingredients"}),e.ingredients.length?e.ingredients.map(e=>(0,p.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(a.T,{style:{flex:1},children:e.name}),(0,p.jsx)(a.T,{colour:r.colours.goldLight,children:[e.qty,e.unit].filter(Boolean).join(' ')})]},e.id)):(0,p.jsx)(a.Muted,{children:"No ingredients on this card yet."}),(0,p.jsx)(a.Divider,{}),(0,p.jsx)(a.H2,{children:"Method"}),e.steps.length?e.steps.map((e,s)=>(0,p.jsxs)(a.Row,{gap:10,style:{alignItems:'flex-start'},children:[(0,p.jsx)(l.default,{style:{width:26,height:26,borderRadius:13,backgroundColor:r.colours.goldTint,alignItems:'center',justifyContent:'center'},children:(0,p.jsx)(a.T,{size:r.font.small,colour:r.colours.gold,children:s+1})}),(0,p.jsx)(a.T,{style:{flex:1},children:e})]},s)):(0,p.jsxs)(a.Muted,{children:["No method yet.",(0,h.canEditCards)(s.role)?' Tap Edit to add the steps.':'']}),(0,p.jsxs)(a.Muted,{children:["Version ",e.version," \xb7 last changed ",m(e.updatedAt)," by ",e.updatedBy]}),(0,h.canEditCards)(s.role)&&n?(0,p.jsx)(a.Button,{testID:"edit-card",kind:"secondary",label:"Edit card",onPress:n}):null,(0,h.canSignOffCards)(s.role)&&!e.signOff?(0,p.jsxs)(l.default,{style:{gap:6},children:[c?(0,p.jsx)(a.Banner,{kind:"warn",title:"Not ready to sign off",children:c}):null,(0,p.jsx)(a.Button,{testID:"sign-off",kind:"success",label:`Sign off as ${s.name}`,disabled:!!c,onPress:async()=>{try{await(0,d.recipeCards)().signOff(e.id,s),o(null)}catch(e){o(e?.message??'Could not sign off.')}}})]}):null,!(0,h.canEditCards)(s.role)||(0,h.canSignOffCards)(s.role)||e.signOff?null:(0,p.jsx)(a.Banner,{kind:"info",title:"Head chef sign-off",children:"Only the head chef can sign off a recipe card, in the Head Chef app."}),i?(0,p.jsx)(a.Banner,{kind:"danger",children:i}):null]})}const k=()=>`i-${Math.random().toString(36).slice(2,9)}`,D=(e,s)=>e?{id:e.id,dish:e.dish,section:e.section,price:null==e.price?'':(e.price/100).toFixed(2),description:'',ingredients:e.ingredients.map(e=>({...e})),steps:[...e.steps],allergens:{...e.allergens},dismissed:[...e.dismissed],allergenNotes:e.allergenNotes??'',photo:e.photo,pending:null,confirm:!!e.allergensConfirmed}:{id:(0,h.uuid)(),dish:'',section:s,price:'',description:'',ingredients:[{id:k(),name:'',qty:'',unit:''}],steps:[''],allergens:{},dismissed:[],allergenNotes:'',pending:null,confirm:!1},v=e=>{const s=e.replace(/[\xa3\s]/g,'');if(!s)return null;const t=Number(s);return isFinite(t)&&t>=0?Math.round(100*t):'bad'};function I({rid:e,card:n,actor:u,onDone:m}){const x=(0,o.useRestaurant)(e),j=x?.sections??['Mains'],[b,C]=(0,t.useState)(()=>D(n,j[0]??'Mains')),[w,I]=(0,t.useState)(null),[T,S]=(0,t.useState)(null),[B,$]=(0,t.useState)(!1),P=e=>C(s=>({...s,...e})),R=b.ingredients.filter(e=>e.name.trim()),L={ingredients:R,allergens:b.allergens,dismissed:b.dismissed},A=(0,h.suggestAllergens)(R),M=(0,h.unresolved)(L),E=e=>{const s=b.allergens[e],t={...b.allergens};s?'contains'===s?t[e]='may':delete t[e]:t[e]='contains',P({allergens:t,dismissed:b.dismissed.filter(s=>s!==e),confirm:!1})},N=e=>{const s={...b.allergens};delete s[e],P({allergens:s,dismissed:[...new Set([...b.dismissed,e])],confirm:!1})},O=(e,s)=>P({ingredients:b.ingredients.map((t,n)=>n===e?{...t,...s}:t),confirm:!1}),H=(e,s)=>P({steps:b.steps.map((t,n)=>n===e?s:t)}),F=(e,s)=>{const t=[...b.steps],n=e+s;n<0||n>=t.length||([t[e],t[n]]=[t[n],t[e]],P({steps:t}))},_=async e=>{S(null);try{const s=await(0,f.capturePlatingPhoto)(e);s&&(P({pending:s}),S(`Compressed on this device: ${s.width}\xd7${s.height}, ${(0,f.kb)(s.bytes)}${s.originalBytes?` (was ${(0,f.kb)(s.originalBytes)})`:''}.`))}catch(e){S(e?.message??'Could not read that photo.')}},[z,W]=(0,t.useState)(!1),G=n??{id:b.id,dish:b.dish,photo:b.photo};return(0,p.jsxs)(l.default,{testID:"card-editor",style:{gap:12},children:[n?.signOff?(0,p.jsx)(a.Banner,{kind:"warn",title:"Saving a change resets the sign-off",children:"This card is signed off. Any change you save sets it back to \"Awaiting sign-off\" until the head chef signs it off again."}):null,(0,p.jsx)(a.Field,{testID:"dish-name",label:"Dish name",value:b.dish,onChangeText:e=>P({dish:e}),placeholder:"e.g. Cullen skink"}),n?null:(0,p.jsx)(a.Field,{testID:"dish-description",label:"Menu description (optional)",value:b.description,onChangeText:e=>P({description:e}),placeholder:"What guests read on the menu"}),(0,p.jsx)(a.T,{size:r.font.small,weight:"medium",colour:r.colours.muted,children:"Menu section"}),(0,p.jsx)(a.Row,{wrap:!0,gap:6,children:j.map(e=>(0,p.jsx)(a.Chip,{label:e,selected:b.section===e,onPress:()=>P({section:e})},e))}),(0,p.jsx)(a.Field,{testID:"dish-price",label:"Price (\xa3)",value:b.price,onChangeText:e=>P({price:e}),placeholder:"Blank = price on the board",keyboardType:"decimal-pad"}),(0,p.jsx)(a.Divider,{}),(0,p.jsx)(a.H2,{children:"Plating photo"}),(0,p.jsx)(y,{card:G,pending:b.pending?.dataUrl??null,height:170}),(0,p.jsxs)(a.Row,{gap:8,wrap:!0,children:[(0,p.jsx)(a.Button,{testID:"photo-camera",small:!0,kind:"secondary",label:b.pending||b.photo?'Retake photo':'Take photo',onPress:()=>_('camera')}),(0,p.jsx)(a.Button,{testID:"photo-library",small:!0,kind:"secondary",label:b.pending||b.photo?'Replace photo':'Choose photo',onPress:()=>_('library')}),b.pending||b.photo?(0,p.jsx)(a.Button,{testID:"photo-remove",small:!0,kind:"ghost",label:"Remove photo",onPress:()=>P({pending:null,photo:void 0})}):null]}),T?(0,p.jsx)(l.default,{testID:"photo-info",children:(0,p.jsx)(a.Muted,{children:T})}):(0,p.jsx)(a.Muted,{children:'shared'===(0,d.recipeCards)().mode?'Photos are shrunk on this device, then shared with the team. Staff and guests only see the photo once the card is signed off.':'Photos are shrunk on this device before they are saved.'}),(0,p.jsx)(a.Divider,{}),(0,p.jsx)(a.H2,{children:"Ingredients"}),(0,p.jsx)(a.Muted,{children:"Quantity, unit and ingredient. We suggest allergens from the ingredient names."}),b.ingredients.map((e,t)=>{const n=e.name.trim()?(0,h.suggestAllergens)([e]):[];return(0,p.jsxs)(l.default,{style:{gap:4},children:[(0,p.jsxs)(a.Row,{gap:6,children:[(0,p.jsx)(s.TextInput,{testID:`ing-qty-${t}`,accessibilityLabel:`Quantity ${t+1}`,value:e.qty,onChangeText:e=>O(t,{qty:e}),placeholder:"Qty",placeholderTextColor:"#7D776C",style:[a.styles.input,{width:64}]}),(0,p.jsx)(s.TextInput,{testID:`ing-unit-${t}`,accessibilityLabel:`Unit ${t+1}`,value:e.unit,onChangeText:e=>O(t,{unit:e}),placeholder:"g / ml / each",placeholderTextColor:"#7D776C",style:[a.styles.input,{width:92}]}),(0,p.jsx)(s.TextInput,{testID:`ing-name-${t}`,accessibilityLabel:`Ingredient ${t+1}`,value:e.name,onChangeText:e=>O(t,{name:e}),placeholder:"Ingredient",placeholderTextColor:"#7D776C",style:[a.styles.input,{flex:1}]}),(0,p.jsx)(i.default,{accessibilityLabel:`Remove ingredient ${t+1}`,onPress:()=>P({ingredients:b.ingredients.filter((e,s)=>s!==t)}),hitSlop:8,children:(0,p.jsx)(a.T,{colour:r.colours.muted,children:"\u2715"})})]}),n.length?(0,p.jsxs)(a.Muted,{children:["Suggests: ",n.map(c.allergenLabel).join(', ')]}):null]},e.id)}),(0,p.jsx)(a.Button,{testID:"ing-add",small:!0,kind:"ghost",label:"Add ingredient",onPress:()=>P({ingredients:[...b.ingredients,{id:k(),name:'',qty:'',unit:''}]})}),(0,p.jsx)(a.Divider,{}),(0,p.jsx)(a.H2,{children:"Method"}),b.steps.map((e,t)=>(0,p.jsxs)(a.Row,{gap:6,style:{alignItems:'flex-start'},children:[(0,p.jsx)(a.T,{colour:r.colours.gold,style:{width:20,paddingTop:10},children:t+1}),(0,p.jsx)(s.TextInput,{testID:`step-${t}`,accessibilityLabel:`Step ${t+1}`,value:e,onChangeText:e=>H(t,e),multiline:!0,placeholder:"Describe this step",placeholderTextColor:"#7D776C",style:[a.styles.input,{flex:1,minHeight:56,textAlignVertical:'top'}]}),(0,p.jsxs)(l.default,{style:{gap:4},children:[(0,p.jsx)(i.default,{accessibilityLabel:`Move step ${t+1} up`,onPress:()=>F(t,-1),hitSlop:6,children:(0,p.jsx)(a.T,{colour:r.colours.muted,children:"\u25b2"})}),(0,p.jsx)(i.default,{accessibilityLabel:`Move step ${t+1} down`,onPress:()=>F(t,1),hitSlop:6,children:(0,p.jsx)(a.T,{colour:r.colours.muted,children:"\u25bc"})}),(0,p.jsx)(i.default,{accessibilityLabel:`Remove step ${t+1}`,onPress:()=>P({steps:b.steps.filter((e,s)=>s!==t)}),hitSlop:6,children:(0,p.jsx)(a.T,{colour:r.colours.muted,children:"\u2715"})})]})]},t)),(0,p.jsx)(a.Button,{testID:"step-add",small:!0,kind:"ghost",label:"Add step",onPress:()=>P({steps:[...b.steps,'']})}),(0,p.jsx)(a.Divider,{}),(0,p.jsx)(a.H2,{children:"Allergens (UK 14)"}),(0,p.jsx)(a.Muted,{children:"Tap to cycle: contains \u2192 may contain \u2192 none. Suggested allergens are marked \u201c?\u201d until you add or rule them out."}),M.length?(0,p.jsxs)(l.default,{testID:"allergen-suggestions",style:{gap:6},children:[(0,p.jsx)(a.Banner,{kind:"warn",title:`Check ${M.length} suggested allergen${1===M.length?'':'s'}`,children:M.map(e=>`${(0,c.allergenLabel)(e)} (from ${(0,h.suggestedBy)(R,e).join(', ')})`).join('; ')}),M.map(e=>(0,p.jsxs)(a.Row,{gap:6,wrap:!0,children:[(0,p.jsx)(a.T,{style:{flex:1},children:(0,c.allergenLabel)(e)}),(0,p.jsx)(a.Button,{testID:`suggest-add-${e}`,small:!0,label:"Contains",onPress:()=>P({allergens:{...b.allergens,[e]:'contains'},confirm:!1})}),(0,p.jsx)(a.Button,{testID:`suggest-may-${e}`,small:!0,kind:"secondary",label:"May contain",onPress:()=>P({allergens:{...b.allergens,[e]:'may'},confirm:!1})}),(0,p.jsx)(a.Button,{testID:`suggest-dismiss-${e}`,small:!0,kind:"ghost",label:"Not in this dish",onPress:()=>N(e)})]},e)),(0,p.jsx)(a.Button,{testID:"apply-suggestions",small:!0,kind:"secondary",label:"Add all suggestions as \u2018contains\u2019",onPress:()=>{const e={...b.allergens};M.forEach(s=>{e[s]='contains'}),P({allergens:e,confirm:!1})}})]}):null,(0,p.jsx)(a.Row,{wrap:!0,gap:6,children:c.ALLERGENS.map(e=>{const s=b.allergens[e.id],t=A.includes(e.id)&&!s&&!b.dismissed.includes(e.id),n='contains'===s?r.colours.redBg:'may'===s?r.colours.amberBg:r.colours.surface2,l='contains'===s?r.colours.red:'may'===s?r.colours.amber:t?r.colours.gold:r.colours.border;return(0,p.jsx)(i.default,{testID:`allergen-${e.id}`,accessibilityRole:"button",accessibilityLabel:`${e.short}: ${'contains'===s?'contains':'may'===s?'may contain':'not marked'}`,onPress:()=>E(e.id),style:{paddingVertical:6,paddingHorizontal:10,borderRadius:16,borderWidth:t?2:1,borderStyle:t?'dashed':'solid',borderColor:l,backgroundColor:n},children:(0,p.jsxs)(a.T,{size:r.font.small,colour:'contains'===s?'#FFD9D4':'may'===s?'#FFE2A8':r.colours.text,children:[e.short,'may'===s?' (may)':'',t?' ?':'']})},e.id)})}),b.dismissed.length?(0,p.jsxs)(a.Muted,{children:["Ruled out: ",b.dismissed.map(c.allergenLabel).join(', ')]}):null,(0,p.jsx)(a.Field,{testID:"allergen-notes",label:"Allergen notes (optional)",value:b.allergenNotes,onChangeText:e=>P({allergenNotes:e}),placeholder:"e.g. Cooked in the shared fryer"}),(0,p.jsxs)(i.default,{testID:"confirm-allergens",accessibilityRole:"checkbox",accessibilityState:{checked:b.confirm,disabled:M.length>0},disabled:M.length>0,onPress:()=>P({confirm:!b.confirm}),style:{flexDirection:'row',gap:10,alignItems:'center',padding:10,borderRadius:10,borderWidth:1,borderColor:b.confirm?r.colours.ok:r.colours.border,opacity:M.length?.5:1},children:[(0,p.jsx)(l.default,{style:{width:22,height:22,borderRadius:4,borderWidth:2,borderColor:b.confirm?r.colours.ok:r.colours.muted,alignItems:'center',justifyContent:'center',backgroundColor:b.confirm?r.colours.okBg:'transparent'},children:b.confirm?(0,p.jsx)(a.T,{colour:r.colours.ok,children:"\u2713"}):null}),(0,p.jsx)(a.T,{style:{flex:1},children:M.length?'Check the suggested allergens above first':`I have checked the allergen list against the ingredients (${u.name})`})]}),w?(0,p.jsx)(a.Banner,{kind:"danger",children:w}):null,(0,p.jsx)(a.Button,{testID:"card-save",label:z?'Saving\u2026':n?'Save changes':'Save card',disabled:z,onPress:async()=>{I(null);const s=v(b.price);if(!b.dish.trim())return I('Give the dish a name.');if('bad'===s)return I('Price should be in pounds, e.g. 14.50 (or leave it blank for "price on the board").');const t=(0,d.recipeCards)();W(!0);try{let i=b.photo;b.pending&&(i=await t.savePhoto(e,b.id,b.pending));const l=b.steps.map(e=>e.trim()).filter(Boolean),r={dish:b.dish.trim(),section:b.section,price:s,ingredients:R.map(e=>({...e,name:e.name.trim(),qty:e.qty.trim(),unit:e.unit.trim()})),steps:l,allergens:b.allergens,dismissed:b.dismissed,allergenNotes:b.allergenNotes.trim()||void 0,photo:i};if(n)await t.update(n.id,{...r,confirmAllergens:b.confirm},u),m(n.id);else{const s=await t.create(e,{...r,id:b.id,description:b.description.trim()||void 0},u);b.confirm&&await t.update(s.id,{confirmAllergens:!0},u),m(s.id)}}catch(e){I(e?.message??'Could not save the card.')}finally{W(!1)}}}),(0,p.jsx)(a.Muted,{children:(0,h.canSignOffCards)(u.role)?'After saving, sign the card off so it goes live.':'After saving, the head chef signs it off in the Head Chef app before it goes live.'}),n?B?(0,p.jsxs)(a.Row,{gap:8,children:[(0,p.jsx)(a.Button,{testID:"card-delete-yes",small:!0,kind:"danger",label:"Yes, remove this dish",onPress:async()=>{if(n)try{await(0,d.recipeCards)().remove(n.id,u),m(null)}catch(e){I(e?.message??'Could not remove the card.')}}}),(0,p.jsx)(a.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>$(!1)})]}):(0,p.jsx)(a.Button,{testID:"card-delete",small:!0,kind:"ghost",label:"Remove card and dish from the menu",onPress:()=>$(!0)}):null]})}},1048,[874,30,196,263,127,821,813,819,831,814,1143,1152,1307,24]); +__d(function(_g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.styliseOnDevice=p,_e.pickPhoto=b,_e.AvatarMaker=function({meId:e,me:h}){const u=(0,n.useAvatars)(t=>t.photos[e]),[g,f]=(0,t.useState)(null),[v,y]=(0,t.useState)(null),[x,j]=(0,t.useState)(!1),[w,I]=(0,t.useState)(!1),[k,P]=(0,t.useState)('');(0,t.useEffect)(()=>()=>{g&&URL.revokeObjectURL(g)},[g]);const M='undefined'!=typeof document,R=async e=>{P('');const t=await b(e);if(t){I(!0),j(!1);try{const e=await p(t);g&&URL.revokeObjectURL(g),f(URL.createObjectURL(t)),y(e)}catch{P("That photo couldn't be opened. Try a different one (JPEG or PNG).")}finally{I(!1)}}},S=()=>{g&&URL.revokeObjectURL(g),f(null),y(null),j(!1)},B=h.replace(' (example)','');return(0,c.jsxs)(o.default,{style:{gap:12},testID:"avatar-maker",children:[(0,c.jsxs)(d.Box,{children:[(0,c.jsxs)(s.Row,{gap:14,children:[(0,c.jsx)(l.StaffAvatar,{id:e,size:88}),(0,c.jsxs)(o.default,{style:{flex:1,gap:4},children:[(0,c.jsx)(s.T,{weight:"semibold",size:17,children:B}),(0,c.jsxs)(s.Muted,{children:[u?`Your avatar from a photo (made ${new Date(u.at).toLocaleDateString('en-GB')}).`:'Your default space-age avatar.'," It shows on rotas, chat, clock-in and sign-offs."]})]})]}),u?(0,c.jsx)(s.Button,{small:!0,kind:"secondary",label:"Back to my default avatar",testID:"avatar-own-reset",onPress:()=>{n.useAvatars.getState().reset(e,{id:e,role:'staff',name:B}),P('Back to your default avatar.')}}):null]}),(0,c.jsxs)(d.Box,{testID:"avatar-create",children:[(0,c.jsx)(s.T,{weight:"semibold",size:17,children:"Create my avatar from a photo"}),(0,c.jsx)(s.Muted,{children:"Upload a photo or take a selfie. Your phone turns it into a retro space-age avatar. The photo never leaves this device and isn't saved: only the finished avatar is kept."}),M?v?(0,c.jsxs)(o.default,{style:{gap:10},testID:"avatar-preview",children:[(0,c.jsxs)(s.Row,{gap:12,style:{justifyContent:'center'},children:[(0,c.jsxs)(o.default,{style:{alignItems:'center',gap:4},children:[g?(0,c.jsx)(a.default,{source:{uri:g},style:{width:96,height:96,borderRadius:12},accessibilityLabel:"Your photo"}):null,(0,c.jsx)(s.Muted,{children:"Your photo"})]}),(0,c.jsx)(s.T,{size:22,colour:i.colours.gold,children:"\u2192"}),(0,c.jsxs)(o.default,{style:{alignItems:'center',gap:4},children:[(0,c.jsx)(a.default,{source:{uri:v},style:{width:120,height:120,borderRadius:60,borderWidth:3,borderColor:i.colours.gold},accessibilityLabel:"Your new avatar preview",testID:"avatar-result"}),(0,c.jsx)(s.Muted,{children:"Your avatar"})]})]}),(0,c.jsxs)(r.default,{accessibilityRole:"checkbox",accessibilityState:{checked:x},accessibilityLabel:"I agree to use this avatar",testID:"avatar-consent",onPress:()=>j(!x),style:{flexDirection:'row',gap:10,alignItems:'flex-start',padding:10,borderRadius:12,borderWidth:1,borderColor:x?i.colours.gold:i.colours.border},children:[(0,c.jsx)(o.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:i.colours.gold,backgroundColor:x?i.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:x?(0,c.jsx)(s.T,{size:15,weight:"bold",colour:"#111",children:"\u2713"}):null}),(0,c.jsx)(s.T,{size:14,style:{flex:1},children:"I\u2019m happy for this avatar, made from my photo, to be shown to my team in CoverCharge. Only the finished avatar is shared; my photo isn\u2019t uploaded or kept, and a manager can reset my avatar."})]}),(0,c.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,c.jsx)(s.Button,{label:"Use as my avatar",testID:"avatar-save",disabled:!x,onPress:()=>{const t=n.useAvatars.getState().setOwn(e,e,v,B);P(t?'Saved: this is your avatar now.':"Couldn't save the avatar."),t&&S()}}),(0,c.jsx)(s.Button,{kind:"secondary",label:"Try another photo",onPress:S})]})]}):(0,c.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,c.jsx)(s.Button,{label:w?'Making your avatar\u2026':'Upload a photo',testID:"avatar-upload",disabled:w,onPress:()=>R(!1)}),(0,c.jsx)(s.Button,{kind:"secondary",label:"Take a selfie",testID:"avatar-selfie",disabled:w,onPress:()=>R(!0)})]}):(0,c.jsx)(s.Muted,{children:"Available in the web app."}),k?(0,c.jsx)(o.default,{testID:"avatar-msg",children:(0,c.jsx)(s.T,{size:14,colour:i.colours.ok,children:k})}):null,(0,c.jsx)(s.Banner,{kind:"info",title:"Coming soon: AI avatars",children:"A future version will use AI to draw you as a full cartoon in the same style. For now it's a simple filter that runs on your phone."})]})]})};var t=_r(_d[0]),a=e(_r(_d[1]));_r(_d[2]);var r=e(_r(_d[3])),o=e(_r(_d[4])),s=_r(_d[5]),l=_r(_d[6]),n=_r(_d[7]),i=_r(_d[8]),d=_r(_d[9]),c=_r(_d[10]);const h=['#1B1B1B','#4A3F35','#B89A72','#E9B949','#FFF4E0'].map(e=>[1,3,5].map(t=>parseInt(e.slice(t,t+2),16))),u=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5];function g(e){return new Promise((t,a)=>{const r=URL.createObjectURL(e),o=new window.Image;o.onload=()=>t({img:o,url:r}),o.onerror=()=>{URL.revokeObjectURL(r),a(new Error('bad image'))},o.src=r})}function f(e,t,a,r){e.beginPath(),e.moveTo(t,a-r),e.quadraticCurveTo(t+.18*r,a-.18*r,t+r,a),e.quadraticCurveTo(t+.18*r,a+.18*r,t,a+r),e.quadraticCurveTo(t-.18*r,a+.18*r,t-r,a),e.quadraticCurveTo(t-.18*r,a-.18*r,t,a-r),e.fill()}async function p(e){const{img:t,url:a}=await g(e);try{const e=112,a=256,r=document.createElement('canvas');r.width=e,r.height=e;const o=r.getContext('2d'),s=Math.min(t.width,t.height);o.drawImage(t,(t.width-s)/2,Math.max(0,(t.height-s)/2-.04*s),s,s,0,0,e,e);const l=o.getImageData(0,0,e,e),n=l.data,i=[];for(let e=0;ee-t),c=d[Math.floor(.04*d.length)],g=d[Math.floor(.96*d.length)]||255;for(let t=0;t{const a=document.createElement('input');a.type='file',a.accept='image/*',e&&a.setAttribute('capture','user'),a.onchange=()=>t(a.files?.[0]??null),a.click()})}},1049,[30,196,122,263,127,813,955,1040,821,1358,24]); +__d(function(g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.StaffTableOrders=function({rid:e,me:l}){const p=(0,c.useOrderAtTable)(e),x=(0,c.useNow)(15e3),f=(0,c.useStore)(e=>e.bookings),w=(0,c.useOrders)(e).filter(i.isTableQr).sort((e,t)=>t.createdAt.localeCompare(e.createdAt)),S=w.filter(i.waitingForStaff),y=w.filter(e=>m(e)&&!(0,i.waitingForStaff)(e)),k=w.filter(e=>!m(e)).slice(0,8),[v,T]=(0,s.useState)(null),[$,B]=(0,s.useState)(null),M=e=>{c.repo.orders.accept(e.id,l),B(`${e.ref} accepted for ${(0,t.tableNumbers)(e.tableNo)}: it's gone to the kitchen.`)},N=e=>{const t=(0,h.statusBlock)(e,'served',(0,h.linkedBooking)(e,f));if(t)return void B(`${e.ref}: ${t}`);const s=(new Date).toISOString();c.useStore.setState(t=>({orders:t.orders.map(t=>t.id===e.id?{...t,servedBy:{by:l,at:s}}:t)})),c.useStore.getState().setOrderStatus(e.id,'served',l),B(`${e.ref} marked served.`)},O=(e,t)=>{const s=(new Date).toISOString();c.useStore.setState(r=>({orders:r.orders.map(r=>r.id===e.id?{...r,cancelReason:t,cancelledBy:{by:l,at:s}}:r)})),c.useStore.getState().setOrderStatus(e.id,'cancelled',l),T(null),B(`${e.ref} cancelled (${t}). The guest's phone shows the reason.`)},A=({o:e,held:s})=>(0,b.jsxs)(n.Card,{highlight:s?u.colours.amber:e.allergies.length?u.colours.red:u.colours.gold,children:[(0,b.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsxs)(n.T,{weight:"semibold",children:[(0,t.tableNumbers)(e.tableNo)," \xb7 ",e.ref]}),(0,b.jsx)(n.Badge,{kind:s?'amber':'cancelled'===e.status?'neutral':'gold',label:s?'Waiting for you':'served'===e.status?'Served':'cancelled'===e.status?'Cancelled':'In the kitchen'})]}),(0,b.jsxs)(n.Muted,{children:[e.customerName," \xb7 ",j(e.createdAt,x),e.accepted?` \xb7 accepted by ${e.accepted.by}`:'']}),e.lines.map((e,t)=>(0,b.jsxs)(n.T,{children:[e.qty,"\xd7 ",e.name,e.notes?` (note: ${e.notes})`:'']},t)),e.allergies.length?(0,b.jsx)(n.Row,{wrap:!0,gap:6,children:e.allergies.map(e=>(0,b.jsx)(n.Badge,{kind:"red",label:`${(0,a.allergenLabel)(e.allergen)}: ${(0,a.severityLabel)(e.severity)}`},e.allergen))}):(0,b.jsx)(n.Muted,{children:"No allergies declared."}),e.notes?(0,b.jsxs)(n.T,{size:13,children:["Note: ",e.notes]}):null,(0,b.jsxs)(n.T,{size:13,colour:u.colours.muted,children:[(0,o.gbp)(e.total)," to pay at the bar or till"]}),'cancelled'===e.status&&e.cancelReason?(0,b.jsxs)(n.Muted,{children:["Reason: ",e.cancelReason]}):null,m(e)?v===e.id?(0,b.jsxs)(r.default,{style:{gap:6},children:[(0,b.jsx)(n.T,{size:13,children:"Why are you cancelling? The guest sees this."}),(0,b.jsx)(n.Row,{wrap:!0,gap:6,children:i.CANCEL_REASONS.map(t=>(0,b.jsx)(n.Chip,{label:t,onPress:()=>O(e,t)},t))}),(0,b.jsx)(n.Button,{small:!0,kind:"ghost",label:"Don't cancel",onPress:()=>T(null)})]}):(0,b.jsxs)(n.Row,{gap:8,wrap:!0,children:[s?(0,b.jsx)(n.Button,{small:!0,label:"Accept",testID:`accept-${e.ref}`,onPress:()=>M(e)}):(0,b.jsx)(n.Button,{small:!0,label:"Mark served",testID:`served-${e.ref}`,onPress:()=>N(e)}),(0,b.jsx)(n.Button,{small:!0,kind:"secondary",label:"Cancel with a reason",onPress:()=>T(e.id)})]}):null]});return(0,b.jsxs)(r.default,{style:{gap:10},children:[(0,b.jsx)(n.Muted,{children:"Tip: orders from guests' phones land here within seconds. Accept the first one from a new phone, check allergies, then mark it served. Guests pay at the bar or till."}),p?null:(0,b.jsx)(n.Banner,{kind:"demo",title:"Order at the table is off",children:"Managers can switch it on in Settings \u203a Advanced \u203a Order at the table."}),$?(0,b.jsx)(n.Banner,{kind:"success",children:$}):null,(0,b.jsxs)(n.T,{weight:"semibold",children:["Waiting for you to accept (",S.length,")"]}),S.length?S.map(e=>(0,b.jsx)(A,{o:e,held:!0},e.id)):(0,b.jsx)(n.Muted,{children:"Nothing waiting."}),(0,b.jsxs)(n.T,{weight:"semibold",children:["In the kitchen (",y.length,")"]}),y.length?y.map(e=>(0,b.jsx)(A,{o:e,held:!1},e.id)):(0,b.jsx)(n.Muted,{children:"No table orders being made."}),k.length?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(n.T,{weight:"semibold",children:"Served or cancelled"}),k.map(e=>(0,b.jsx)(A,{o:e,held:!1},e.id))]}):null]})};var e,t=_r(d[0]),s=_r(d[1]),l=_r(d[2]),r=(e=l)&&e.__esModule?e:{default:e},n=_r(d[3]),a=_r(d[4]),o=_r(d[5]),i=_r(d[6]),c=_r(d[7]),h=_r(d[8]),u=_r(d[9]),b=_r(d[10]);const j=(e,t)=>{const s=Math.max(0,Math.round((t.getTime()-new Date(e).getTime())/6e4));return s<1?'just now':`${s} min ago`},m=e=>!['served','collected','closed','cancelled'].includes(e.status)},1050,[808,30,127,813,814,816,873,819,987,821,24]); +__d(function(g,_r,_i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.customerCodeLink=y,_e.StaffLoyalty=function({venue:e,canRemove:r=!1,onOpenSettings:u}){const[p,x]=(0,t.useState)(null),[y,b]=(0,t.useState)(''),[S,k]=(0,t.useState)(null),[v,C]=(0,t.useState)(null),[M,T]=(0,t.useState)(!1),[B,R]=(0,t.useState)(''),[P,O]=(0,t.useState)(null),$=(0,c.staffServer)(),L=(0,n.can)('venue.settings'),[N,E]=(0,t.useState)(!1),[D,A]=(0,t.useState)(''),F=async e=>{if(p){E(!0),A('');try{await(0,c.saveSettings)({...p,cardOn:e}),x({...p,cardOn:e,saved:!0});const n=e?'Stamp card switched on':'Stamp card switched off';A(n),s.default.announceForAccessibility?.(n)}catch(e){R((0,o.plainError)(e))}E(!1)}},I=(0,t.useCallback)(()=>{$&&(0,c.readSettings)().then(x).catch(()=>{})},[$]);(0,t.useEffect)(()=>(I(),(0,c.watchLoyalty)(()=>{I(),C(e=>(e&&(0,c.staffCard)(e.id).then(C).catch(()=>{}),e))})),[I]);const _=async(e=y)=>{R('');try{const n=await(0,c.staffFind)(e);k(n),1===n.length&&C(n[0])}catch(e){R((0,o.plainError)(e))}},z=(0,t.useCallback)(e=>{T(!1),b((0,o.prettyCardNo)(e)),_(e)},[]);return $?(0,m.jsxs)(l.default,{style:{gap:10},children:[!p||p.cardOn||L?null:(0,m.jsx)(i.Banner,{kind:"info",title:"The stamp card is off",children:"Ask a manager to switch it on."}),p&&L?(0,m.jsx)(i.Card,{children:(0,m.jsxs)(l.default,{style:{gap:8},testID:"loy-quick",children:[p.cardOn?null:(0,m.jsx)(i.T,{weight:"semibold",children:"The stamp card is off"}),(0,m.jsx)(i.Toggle,{testID:"loy-quick-on",label:"Stamp card on",a11y:"Stamp card on. "+(p.cardOn?'On':'Off'),value:p.cardOn,disabled:N,onChange:e=>{F(e)}}),D?(0,m.jsx)(l.default,{accessibilityLiveRegion:"polite",children:(0,m.jsx)(i.Muted,{children:D})}):null,u?(0,m.jsx)(i.Button,{kind:"ghost",label:"Change the stamp card",testID:"loy-open-settings",onPress:u}):null]})}):null,p&&p.saved?(0,m.jsxs)(i.Muted,{children:[p.stampsNeeded," stamps = ",p.reward||'reward not set',". At most ",p.maxPerDay," a day",p.gapMinutes?`, ${p.gapMinutes} minutes apart`:'',"."]}):null,p&&!p.saved&&L?(0,m.jsxs)(i.Muted,{children:["Suggested settings, not saved yet: ",p.stampsNeeded," stamps = ",p.reward||'reward not set',". At most ",p.maxPerDay," a day",p.gapMinutes?`, ${p.gapMinutes} minutes apart`:'',"."]}):null,(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Find a guest"}),(0,m.jsx)(i.Field,{label:"Name, phone, email or card number",value:y,onChangeText:b,onSubmitEditing:()=>_(),autoCapitalize:"none",testID:"loyalty-search"}),(0,m.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,m.jsx)(i.Button,{small:!0,label:"Find",disabled:y.trim().length<2,onPress:()=>_(),testID:"loyalty-find"}),(0,h.canScan)()?(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:M?'Scanning\u2026':'Scan their card',onPress:()=>T(!0)}):null]}),M?(0,m.jsx)(h.CardScanner,{onCard:z,onClose:()=>T(!1)}):null,B?(0,m.jsx)(i.Banner,{kind:"warn",children:B}):null,S&&!S.length?(0,m.jsx)(i.Muted,{children:"No one found. Check the spelling, or sign them up below."}):null,S&&S.length>1?S.map(e=>(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.T,{children:e.name}),(0,m.jsxs)(i.Muted,{children:[(0,o.prettyCardNo)(e.cardNo)," \xb7 ",e.stamps," of ",e.needed,e.phone?` \xb7 ${e.phone}`:'']})]}),e.rewards.length?(0,m.jsx)(i.Badge,{kind:"gold",label:`${e.rewards.length} ready`}):null,(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Open",onPress:()=>C(e)})]},e.id)):null]}),v?(0,m.jsx)(f,{card:v,settings:p,canRemove:r,onChange:e=>{C(e),k(null)},onClose:()=>C(null)}):null,(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Stamp code"}),(0,m.jsx)(i.Muted,{children:"Busy? Make a one-time code and show it to the guest; they type it (or scan it) on their own phone for one stamp."}),P?(0,m.jsx)(j,{c:P,what:"One stamp."}):null,(0,m.jsx)(i.Button,{kind:"secondary",label:P?'Make another code':'Make a stamp code',disabled:!1===p?.cardOn,onPress:()=>{R(''),(0,c.staffCode)('stamp').then(O).catch(e=>R((0,o.plainError)(e)))}})]}),(0,m.jsx)(w,{venue:e,onJoined:e=>{C(e),k(null)}}),(0,m.jsx)(i.Muted,{children:"Tip: search by the last 4 digits of a phone number. Each reward can only be used once, and the card shows who used it and when."})]}):(0,m.jsxs)(l.default,{style:{gap:10},children:[(0,m.jsx)(i.Banner,{kind:"info",title:"Connect to your venue first",children:"The stamp card is saved on your venue's account. Open your invite link on this phone to connect, then you can find guests and add stamps here."}),(0,m.jsx)(i.Muted,{children:"Tip: stamps can only be added by staff of the venue, so a guest can't stamp their own card."})]})};var n=_r(d[0]),t=_r(d[1]),s=e(_r(d[2]));_r(d[3]);var l=e(_r(d[4])),r=_r(d[5]),i=_r(d[6]),o=_r(d[7]),c=_r(d[8]),u=_r(d[9]),h=_r(d[10]),m=_r(d[11]);const p=e=>{try{return new Date(e).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return e}},x=e=>{try{return new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return''}};function y(e){if('undefined'==typeof window||!window.location)return e;const n=window.location.pathname.match(/^(.*?)\/(owner|staff|customer|display|chef)-app(\/|$)/);return new URL(`${n?n[1]:''}/customer-app/index.html?loyalty=${e}`,window.location.origin).toString()}function j({c:e,what:n}){return(0,m.jsxs)(l.default,{style:{gap:4,alignItems:'center'},children:[(0,m.jsx)(i.T,{size:34,weight:"bold",colour:u.colours.gold,center:!0,children:e.code}),(0,m.jsx)(r.QR,{value:y(e.code),size:150}),(0,m.jsxs)(i.Muted,{center:!0,children:[n," Works once, until ",x(e.expiresAt),". The guest types it in Stamp card, or scans this with their phone camera."]})]})}function f({card:e,settings:n,canRemove:s,onChange:r,onClose:h}){const[x,y]=(0,t.useState)(null),[f,w]=(0,t.useState)(!1),[b,S]=(0,t.useState)(null),[k,v]=(0,t.useState)(null),C=async e=>{w(!0),y(null);try{await e()}catch(e){y({kind:'warn',text:(0,o.plainError)(e)})}finally{w(!1),S(null)}};return(0,m.jsxs)(i.Card,{highlight:u.colours.gold,children:[(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.H2,{children:e.name}),(0,m.jsxs)(i.Muted,{children:["Card ",(0,o.prettyCardNo)(e.cardNo),e.phone?` \xb7 ${e.phone}`:'',e.email?` \xb7 ${e.email}`:'']})]}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Close",onPress:h})]}),(0,m.jsxs)(i.T,{size:20,weight:"semibold",children:[e.stamps," of ",e.needed," stamps"]}),(0,m.jsxs)(i.Muted,{children:["Next reward: ",e.reward]}),x?(0,m.jsx)(i.Banner,{kind:x.kind,children:x.text}):null,(0,m.jsx)(i.Button,{label:f?'Saving\u2026':'Add a stamp',disabled:f||!1===n?.cardOn,testID:"loyalty-add-stamp",onPress:()=>C(async()=>{const n=await(0,c.staffStamp)(e.id);r(n),y({kind:'success',text:n.newReward?`Stamp added. ${e.name} has earned: ${n.rewards[n.rewards.length-1]?.title??'a reward'}.`:`Stamp added: ${n.stamps} of ${n.needed}.`})})}),!1===n?.cardOn?(0,m.jsx)(i.Muted,{children:"The stamp card is switched off in Settings \u203a Advanced \u203a Loyalty, so no stamps can be added."}):null,e.rewards.length?(0,m.jsx)(i.T,{weight:"semibold",children:"Rewards ready"}):(0,m.jsx)(i.Muted,{children:"No rewards ready yet."}),e.rewards.map(e=>(0,m.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,m.jsxs)(l.default,{style:{flex:1},children:[(0,m.jsx)(i.T,{children:e.title}),e.expiresAt?(0,m.jsxs)(i.Muted,{children:["Use by ",p(e.expiresAt)]}):null]}),b===e.id?(0,m.jsxs)(i.Row,{gap:6,children:[(0,m.jsx)(i.Button,{small:!0,label:"Yes, used now",disabled:f,onPress:()=>C(async()=>{const n=await(0,c.staffRedeem)(e.id);r(n),y({kind:'success',text:`${n.redeemed} marked used.`})})}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Not yet",onPress:()=>S(null)})]}):(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Use reward",onPress:()=>S(e.id)})]},e.id)),(0,m.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,m.jsx)(i.Button,{small:!0,kind:"secondary",label:"Sign-in code for their phone",onPress:()=>C(async()=>v(await(0,c.staffCode)('link',e.id)))}),s?'remove'===b?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(i.Button,{small:!0,kind:"danger",label:"Yes, remove their details",onPress:()=>C(async()=>{await(0,c.staffRemove)(e.id),r(null),h()})}),(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Keep",onPress:()=>S(null)})]}):(0,m.jsx)(i.Button,{small:!0,kind:"ghost",label:"Remove guest",onPress:()=>S('remove')}):null]}),k?(0,m.jsx)(j,{c:k,what:`Opens ${e.name}'s card on their phone.`}):null,'remove'===b?(0,m.jsx)(i.Muted,{children:"Removing wipes their name, phone and email and closes the card (for example if they ask you to delete their data). Counts in the summary stay."}):null,(0,m.jsx)(i.T,{weight:"semibold",children:"Recent"}),e.history.length?e.history.slice(0,8).map((e,n)=>(0,m.jsxs)(i.Muted,{children:[p(e.at)," \xb7 ",e.what]},n)):(0,m.jsx)(i.Muted,{children:"Nothing yet."})]})}function w({venue:e,onJoined:n}){const[s,l]=(0,t.useState)(''),[r,u]=(0,t.useState)(''),[h,p]=(0,t.useState)(''),[x,y]=(0,t.useState)(!1),[j,f]=(0,t.useState)(!1),[w,b]=(0,t.useState)('');return(0,m.jsxs)(i.Card,{children:[(0,m.jsx)(i.H2,{children:"Sign a guest up"}),(0,m.jsx)(i.Muted,{children:"Only a name is needed. Read the agreement to the guest and tick it only if they say yes."}),(0,m.jsx)(i.Field,{label:"Guest's name",value:s,onChangeText:l,maxLength:60}),(0,m.jsx)(i.Field,{label:"Phone (optional)",value:r,onChangeText:u,keyboardType:"phone-pad",maxLength:20}),(0,m.jsx)(i.Field,{label:"Email (optional)",value:h,onChangeText:p,keyboardType:"email-address",autoCapitalize:"none",maxLength:120}),(0,m.jsx)(i.Toggle,{label:`The guest agrees: \u201c${(0,o.consentText)(e)}\u201d`,value:x,onChange:y}),w?(0,m.jsx)(i.Banner,{kind:"warn",children:w}):null,(0,m.jsx)(i.Button,{label:j?'Saving\u2026':'Sign up',disabled:j||!x||!s.trim(),onPress:async()=>{f(!0),b('');try{n(await(0,c.staffJoin)({name:s,phone:r,email:h,consent:x,consentText:(0,o.consentText)(e)})),l(''),u(''),p(''),y(!1)}catch(e){b((0,o.plainError)(e))}finally{f(!1)}}})]})}},1051,[820,30,118,122,127,867,813,1003,836,821,1459,24]); +__d(function(_g,_r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.GiftTill=b,_e.GiftTillManager=y,_e.GiftShopManager=w,_e.PaymentsTestMode=S,_e.GiftCardsPage=function({me:e}){return(0,p.staffServer)()?(0,j.jsxs)(l.default,{style:{gap:10},children:[(0,j.jsx)(b,{me:e}),(0,x.can)('orders.manage')?(0,j.jsx)(y,{me:e}):null,(0,x.can)('venue.settings')?(0,j.jsx)(w,{me:e}):null,(0,x.can)('venue.settings')?(0,j.jsx)(S,{me:e}):null]}):(0,j.jsx)(r.Banner,{kind:"demo",title:"Gift cards are saved on the server",children:"Sign this device in to your venue to check and take gift cards. There are no example cards here."})};var e,t=_r(d[0]),s=_r(d[1]),n=_r(d[2]),a=_r(d[3]),l=(e=a)&&e.__esModule?e:{default:e},r=_r(d[4]),o=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]),x=_r(d[9]),p=_r(d[10]),g=_r(d[11]),j=_r(d[12]);const f=e=>{if(!e)return'';try{return new Date(e).toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric',timeZone:'Europe/London'})}catch{return e.slice(0,10)}},m=({m:e})=>e?(0,j.jsx)(r.Banner,{kind:e.kind,title:e.text}):null;function b({me:e}){const[t,s]=(0,n.useState)(''),[a,x]=(0,n.useState)(null),[p,b]=(0,n.useState)(''),[y,w]=(0,n.useState)((0,u.redeemKey)()),[k,S]=(0,n.useState)(null),[T,C]=(0,n.useState)(!1),v=(0,u.poundsToPence)(p);return(0,j.jsx)(l.default,{testID:"gift-till",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:8},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Check a gift card or take it off the bill"}),(0,j.jsx)(r.Field,{label:"Gift card code",value:t,autoCapitalize:"characters",onChangeText:e=>{s(e),x(null),w((0,u.redeemKey)())},placeholder:"XXXX-XXXX-XXXX-XXXX",testID:"gift-code"}),(0,j.jsx)(r.Button,{label:T?'Checking\u2026':'Check balance',kind:"ghost",small:!0,disabled:T||t.replace(/\W/g,'').length<6,testID:"gift-check",onPress:async()=>{C(!0),S(null);try{const e=await(0,h.giftCheck)(t);x(e),e.found||S({kind:'warn',text:'No gift card with that code here.'})}catch(e){S({kind:'warn',text:(0,c.plainError)(e)})}finally{C(!1)}}}),a?.found?(0,j.jsxs)(l.default,{style:{gap:4},testID:"gift-card-found",children:[(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(r.T,{weight:"medium",children:(0,u.prettyGiftCode)(t)}),(0,j.jsx)(r.T,{size:20,weight:"bold",colour:g.colours.gold,children:(0,o.gbp)(a.balancePence)})]}),(0,j.jsxs)(r.Muted,{size:12,children:[u.STATUS_WORDS[a.status]??a.status," \xb7 of ",(0,o.gbp)(a.initialPence),a.expiresAt?` \xb7 use by ${f(a.expiresAt)}`:'','wix'===a.source?' \xb7 old website bookings card':'']}),'active'===a.status?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(r.Field,{label:"Amount to take off \xa3",value:p,onChangeText:b,keyboardType:"decimal-pad",testID:"gift-amount"}),(0,j.jsx)(r.Button,{label:T?'Taking it off\u2026':v?`Take ${(0,o.gbp)(v)} off the card`:'Take it off the card',disabled:T||!v||v>a.balancePence,testID:"gift-redeem",onPress:async()=>{C(!0),S(null);try{const s=await(0,h.giftRedeem)(t,v,y,e);x({...a,...s,found:!0}),b(''),w((0,u.redeemKey)()),S({kind:'success',text:`${s.already?'Already taken: ':'Taken '}${(0,o.gbp)(s.redeemedPence)}. ${(0,o.gbp)(s.balancePence)} left on the card.`})}catch(e){S({kind:'warn',text:(0,c.plainError)(e)})}finally{C(!1)}}})]}):null]}):null,(0,j.jsx)(m,{m:k})]})})})}function y({me:e}){const[t,s]=(0,n.useState)([]),[a,x]=(0,n.useState)([]),[p,b]=(0,n.useState)(null),[y,w]=(0,n.useState)(''),[k,S]=(0,n.useState)(''),[T,C]=(0,n.useState)(null),[v,P]=(0,n.useState)(null),I=(0,n.useCallback)(()=>{(0,h.waitingCards)().then(s).catch(()=>{}),(0,h.shopOrders)().then(x).catch(()=>{})},[]);(0,n.useEffect)(()=>{I()},[I]);const D=async(e,t)=>{b(null);try{await e(),b({kind:'success',text:t}),I()}catch(e){b({kind:'warn',text:(0,c.plainError)(e)})}},M=t.filter(e=>'waiting-payment'===e.status),_=a.filter(e=>!['collected','cancelled'].includes(e.status)),B=(0,u.poundsToPence)(y);return(0,j.jsxs)(l.default,{style:{gap:10},children:[(0,j.jsx)(l.default,{testID:"gift-waiting",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:6},children:[(0,j.jsxs)(r.T,{weight:"semibold",children:["Waiting for payment at the till (",M.length+_.filter(e=>'waiting-payment'===e.status).length,")"]}),(0,j.jsx)(r.Muted,{size:12,children:"Card payment in the app isn\u2019t on yet. Take the money at the till, then mark it paid here."}),M.map(t=>(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(l.default,{style:{flex:1},children:[(0,j.jsxs)(r.T,{children:["Gift card ",t.ref," \xb7 ",(0,o.gbp)(t.initial_pence)]}),(0,j.jsxs)(r.Muted,{size:12,children:["for ",t.recipient_name||'no name'," \xb7 ends ",t.last4]})]}),(0,j.jsx)(r.Button,{label:"Paid at the till",small:!0,testID:`gift-paid-${t.ref}`,onPress:()=>D(()=>(0,h.giftActivate)(t.id,e),`${t.ref} is ready to use`)})]},t.id)),_.map(t=>(0,j.jsxs)(l.default,{style:{gap:4},children:[(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(l.default,{style:{flex:1},children:[(0,j.jsxs)(r.T,{children:["Shop ",t.ref," \xb7 ",t.guest_name," \xb7 ",(0,o.gbp)(t.total_pence)]}),(0,j.jsxs)(r.Muted,{size:12,children:[t.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')," \xb7 ",u.STATUS_WORDS[t.status]]})]}),'waiting-payment'===t.status?(0,j.jsx)(r.Button,{label:"Paid at the till",small:!0,onPress:()=>D(()=>(0,h.shopStatus)(t.id,'paid','',e),`${t.ref} paid`)}):'paid'===t.status?(0,j.jsx)(r.Button,{label:"Ready",small:!0,onPress:()=>D(()=>(0,h.shopStatus)(t.id,'ready','',e),`${t.ref} ready`)}):(0,j.jsx)(r.Button,{label:"Collected",small:!0,onPress:()=>D(()=>(0,h.shopStatus)(t.id,'collected','',e),`${t.ref} collected`)})]}),v&&v.id===t.id?(0,j.jsxs)(r.Row,{style:{gap:6,alignItems:'flex-end'},children:[(0,j.jsx)(l.default,{style:{flex:1},children:(0,j.jsx)(r.Field,{label:"Reason",value:v.reason,onChangeText:e=>P({id:t.id,reason:e})})}),(0,j.jsx)(r.Button,{label:"Cancel order",kind:"danger",small:!0,disabled:v.reason.trim().length<3,onPress:()=>D(()=>(0,h.shopStatus)(t.id,'cancelled',v.reason,e),`${t.ref} cancelled, stock put back`).then(()=>P(null))})]}):(0,j.jsx)(r.Button,{label:"Cancel with a reason",kind:"ghost",small:!0,onPress:()=>P({id:t.id,reason:''})})]},t.id)),M.length||_.length?null:(0,j.jsx)(r.Muted,{children:"Nothing waiting."})]})})}),(0,j.jsx)(l.default,{testID:"gift-sell",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:6},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Sell a gift card at the till"}),(0,j.jsx)(r.Field,{label:"Amount \xa3",value:y,onChangeText:w,keyboardType:"decimal-pad",testID:"gift-sell-amount"}),(0,j.jsx)(r.Field,{label:"Who it\u2019s for (optional)",value:k,onChangeText:S}),(0,j.jsx)(r.Button,{label:B?`Paid ${(0,o.gbp)(B)} at the till: make the card`:'Make the card',small:!0,disabled:!B,testID:"gift-sell-btn",onPress:()=>D(async()=>{const t=await(0,h.giftIssue)(B,k,e);C(t),w(''),S('')},'Card made')}),T?.code?(0,j.jsxs)(l.default,{style:{gap:2},children:[(0,j.jsx)(r.T,{size:22,weight:"bold",colour:g.colours.gold,center:!0,children:T.code}),(0,j.jsxs)(r.Muted,{center:!0,size:12,children:["Shown once: write it on the card or receipt now. ",(0,o.gbp)(T.initialPence),", use by ",f(T.expiresAt),"."]})]}):null]})})}),(0,j.jsx)(m,{m:p})]})}function w({me:e}){const[t,s]=(0,n.useState)(null),[a,x]=(0,n.useState)(''),[p,b]=(0,n.useState)(null),[y,w]=(0,n.useState)([]),[k,S]=(0,n.useState)({name:'',price:'',details:''}),[T,C]=(0,n.useState)(null),[v,P]=(0,n.useState)({code:'',bal:''}),[I,D]=(0,n.useState)([]),[M,_]=(0,n.useState)(null),B=(0,n.useCallback)(()=>{(0,h.readShopSettings)().then(e=>{s(e),x(e.amounts.map(e=>String(e/100)).join(', '))}).catch(e=>C({kind:'warn',text:(0,c.plainError)(e)})),(0,h.readProducts)().then(w).catch(()=>{}),(0,h.giftSummary)().then(b).catch(()=>{}),(0,h.waitingCards)().then(D).catch(()=>{})},[]);(0,n.useEffect)(()=>{B()},[B]);const R=async(e,t)=>{C(null);try{await e(),C({kind:'success',text:t}),B()}catch(e){C({kind:'warn',text:(0,c.plainError)(e)})}};if(!t)return(0,j.jsx)(r.Card,{children:(0,j.jsx)(r.Muted,{children:T?.text??'Loading\u2026'})});const z=(0,u.amountsFromText)(a);return(0,j.jsxs)(l.default,{style:{gap:10},children:[p?(0,j.jsx)(l.default,{testID:"gift-summary",children:(0,j.jsxs)(r.Row,{style:{gap:8},children:[(0,j.jsxs)(r.Card,{style:{flex:1},children:[(0,j.jsx)(r.Muted,{children:"Sold (paid)"}),(0,j.jsx)(r.T,{size:20,weight:"bold",children:(0,o.gbp)(p.soldPence)})]}),(0,j.jsxs)(r.Card,{style:{flex:1},children:[(0,j.jsx)(r.Muted,{children:"Still to spend"}),(0,j.jsx)(r.T,{size:20,weight:"bold",children:(0,o.gbp)(p.outstandingPence)})]}),(0,j.jsxs)(r.Card,{style:{flex:1},children:[(0,j.jsx)(r.Muted,{children:"Waiting"}),(0,j.jsx)(r.T,{size:20,weight:"bold",children:p.waiting})]})]})}):null,(0,j.jsx)(l.default,{testID:"gift-settings",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:8},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Gift cards and shop settings"}),(0,j.jsx)(r.Toggle,{label:"Sell gift cards in the customer app",value:t.giftsOn,onChange:e=>s({...t,giftsOn:e}),testID:"gift-on"}),(0,j.jsx)(r.Toggle,{label:"Open the shop in the customer app",value:t.shopOn,onChange:e=>s({...t,shopOn:e}),testID:"shop-on"}),(0,j.jsxs)(r.T,{children:["Cards last ",(0,u.expiryWords)(t.expiryMonths)," from when they\u2019re paid"]}),(0,j.jsx)(r.Stepper,{value:t.expiryMonths,min:1,max:60,label:"Gift card expiry in months",onChange:e=>s({...t,expiryMonths:e})}),(0,j.jsx)(r.Field,{label:"Amounts guests can pick (\xa3, comma between)",value:a,onChangeText:x,testID:"gift-amounts"}),(0,j.jsx)(r.Field,{label:"Terms shown to guests (optional)",value:t.terms,onChangeText:e=>s({...t,terms:e}),multiline:!0}),(0,j.jsx)(r.Muted,{size:12,children:"Gift cards are sold through your website. Guests can also pay at the bar or till."}),(0,j.jsx)(r.Button,{label:"Save",disabled:!z,testID:"gift-settings-save",onPress:()=>R(()=>(0,h.saveShopSettings)({...t,amounts:z}),'Saved. The customer app shows it next time it opens.')})]})})}),(0,j.jsx)(l.default,{testID:"shop-products",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:8},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Shop products"}),y.map(e=>(0,j.jsxs)(l.default,{style:{gap:4,borderTopWidth:1,borderColor:g.colours.border,paddingTop:6},children:[(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(r.T,{weight:"medium",style:{flex:1},children:e.name}),(0,j.jsx)(r.T,{children:(0,o.gbp)(e.price_pence)})]}),(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,j.jsx)(l.default,{style:{flex:1},children:(0,j.jsx)(r.Toggle,{label:e.is_live?'In the shop':'Hidden',a11y:`${e.name} in the shop`,value:e.is_live,onChange:t=>R(()=>(0,h.saveProduct)({id:e.id,name:e.name,details:e.details,pricePence:e.price_pence,stock:e.stock,live:t}),'Saved')})}),(0,j.jsxs)(l.default,{style:{alignItems:'flex-end'},children:[(0,j.jsx)(r.Muted,{size:12,children:"Stock"}),(0,j.jsx)(r.Stepper,{value:e.stock,min:0,max:500,label:`${e.name} stock`,onChange:t=>R(()=>(0,h.saveProduct)({id:e.id,name:e.name,details:e.details,pricePence:e.price_pence,stock:t,live:e.is_live}),'Stock saved')})]})]}),0===e.stock?(0,j.jsx)(r.Badge,{kind:"amber",label:"Sold out"}):null]},e.id)),y.length?null:(0,j.jsx)(r.Muted,{children:"No products yet."}),(0,j.jsx)(r.Field,{label:"New product name",value:k.name,onChangeText:e=>S({...k,name:e}),testID:"shop-new-name"}),(0,j.jsx)(r.Field,{label:"Price \xa3",value:k.price,onChangeText:e=>S({...k,price:e}),keyboardType:"decimal-pad",testID:"shop-new-price"}),(0,j.jsx)(r.Field,{label:"Details (optional)",value:k.details,onChangeText:e=>S({...k,details:e})}),(0,j.jsx)(r.Button,{label:"Add product (hidden until you switch it on)",kind:"ghost",small:!0,disabled:k.name.trim().length<2||!(0,u.poundsToPence)(k.price),onPress:()=>R(async()=>{await(0,h.saveProduct)({name:k.name,details:k.details,pricePence:(0,u.poundsToPence)(k.price),stock:0,live:!1}),S({name:'',price:'',details:''})},'Product added')})]})})}),(0,j.jsx)(l.default,{testID:"gift-wix",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:6},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Honour an old website bookings gift card"}),(0,j.jsx)(r.Muted,{size:12,children:"Check the balance in your website bookings dashboard first. Each website bookings code can be added once."}),(0,j.jsx)(r.Field,{label:"Website bookings code",value:v.code,autoCapitalize:"characters",onChangeText:e=>P({...v,code:e})}),(0,j.jsx)(r.Field,{label:"Balance you checked in website bookings \xa3",value:v.bal,keyboardType:"decimal-pad",onChangeText:e=>P({...v,bal:e})}),(0,j.jsx)(r.Button,{label:"Add to CoverCharge",kind:"ghost",small:!0,disabled:v.code.replace(/\W/g,'').length<6||!(0,u.poundsToPence)(v.bal),onPress:()=>R(async()=>{await(0,h.giftHonourWix)(v.code,(0,u.poundsToPence)(v.bal),e),P({code:'',bal:''})},'Website bookings card added')})]})})}),(0,j.jsx)(l.default,{testID:"gift-list",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:4},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Recent cards"}),I.map(t=>(0,j.jsxs)(l.default,{style:{gap:2},children:[(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(r.T,{style:{flex:1},children:[t.ref," \xb7 ends ",t.last4," \xb7 ",'wix'===t.source?'Website bookings':'till'===t.source?'Till':'App']}),(0,j.jsxs)(r.T,{children:[(0,o.gbp)(t.balance_pence)," / ",(0,o.gbp)(t.initial_pence)]})]}),(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(r.Muted,{size:12,children:[u.STATUS_WORDS[t.status]??t.status,t.expires_at?` \xb7 use by ${f(t.expires_at)}`:'']}),'void'!==t.status&&M?.id!==t.id?(0,j.jsx)(r.Button,{label:"Cancel card",kind:"ghost",small:!0,onPress:()=>_({id:t.id,reason:''})}):null]}),M&&M.id===t.id?(0,j.jsxs)(r.Row,{style:{gap:6,alignItems:'flex-end'},children:[(0,j.jsx)(l.default,{style:{flex:1},children:(0,j.jsx)(r.Field,{label:"Reason",value:M.reason,onChangeText:e=>_({id:t.id,reason:e})})}),(0,j.jsx)(r.Button,{label:"Cancel it",kind:"danger",small:!0,disabled:M.reason.trim().length<3,onPress:()=>R(()=>(0,h.giftVoid)(t.id,M.reason,e),'Card cancelled (kept on record)').then(()=>_(null))})]}):null]},t.id)),I.length?null:(0,j.jsx)(r.Muted,{children:"No cards yet."})]})})}),(0,j.jsx)(m,{m:T})]})}const k={none:'Pay at the till only',stripe:'Stripe (test mode)',wix:'Website bookings payments (coming)'};function S({me:e}){if(t.IS_GREENSIDE)return(0,j.jsx)(s.GreensideCashOnly,{});const[a,u]=(0,n.useState)(null),[x,p]=(0,n.useState)([]),[g,b]=(0,n.useState)(null),y=(0,n.useCallback)(()=>{(0,h.readPaySettings)().then(u).catch(e=>b({kind:'warn',text:(0,c.plainError)(e)})),(0,h.recentPayments)().then(p).catch(()=>{})},[]);return(0,n.useEffect)(()=>{y()},[y]),a?(0,j.jsx)(l.default,{testID:"pay-settings",children:(0,j.jsx)(r.Card,{children:(0,j.jsxs)(l.default,{style:{gap:8},children:[(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,j.jsx)(r.T,{weight:"semibold",children:"Card payments"}),(0,j.jsx)(r.Badge,{kind:"amber",label:"TEST MODE"})]}),(0,j.jsx)(r.Banner,{kind:"demo",title:"Test mode only: no real money",children:"This build can\u2019t take live payments. Guests pay at the bar or till unless you switch on Stripe test mode below."}),(0,j.jsx)(r.Row,{wrap:!0,children:['none','stripe','wix'].map(e=>(0,j.jsx)(r.Chip,{label:k[e],selected:a.provider===e,onPress:()=>u({...a,provider:e,cardOn:'stripe'===e&&a.cardOn})},e))}),'stripe'===a.provider?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(r.Field,{label:"Venue\u2019s Stripe account id (starts acct_)",value:a.account,autoCapitalize:"none",onChangeText:e=>u({...a,account:e.trim()}),placeholder:"acct_\u2026",testID:"pay-account"}),(0,j.jsx)(r.Muted,{size:12,children:"Money goes straight to the venue\u2019s own Stripe account. Never paste a key here."}),(0,j.jsx)(r.Toggle,{label:"Offer \u201cPay by card (test mode)\u201d in the customer app",value:a.cardOn,onChange:e=>u({...a,cardOn:e}),testID:"pay-card-on"}),(0,j.jsx)(r.Muted,{size:12,children:"Needs CoverCharge\u2019s Stripe sandbox to be set up first (Gordon\u2019s step). Until then guests see pay at the till."})]}):null,'wix'===a.provider?(0,j.jsx)(r.Banner,{kind:"demo",title:"Website bookings payments aren\u2019t linked yet",children:"Website bookings venues keep taking payments on their website. In the app, guests pay at the bar or till."}):null,(0,j.jsx)(r.Button,{label:"Save",testID:"pay-save",onPress:async()=>{b(null);try{await(0,h.savePaySettings)(a),b({kind:'success',text:'Saved'}),y()}catch(e){b({kind:'warn',text:(0,c.plainError)(e)})}}}),x.length?(0,j.jsxs)(l.default,{style:{gap:2},children:[(0,j.jsx)(r.T,{weight:"medium",children:"Recent test payments"}),x.map(e=>(0,j.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(r.Muted,{children:['gift'===e.kind?'Gift card':'Shop'," \xb7 ",f(e.created_at)]}),(0,j.jsxs)(r.T,{children:[(0,o.gbp)(e.amount_pence)," \xb7 ",e.status]})]},e.id))]}):null,(0,j.jsx)(m,{m:g})]})})}):(0,j.jsx)(r.Card,{children:(0,j.jsx)(r.Muted,{children:g?.text??'Loading\u2026'})})}},1052,[5,991,30,127,813,816,1003,1375,1376,820,836,821,24]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.setLiveData=c,e.requireRealData=function(){t=!0,c(!0)},Object.defineProperty(e,"liveData",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"examplesAllowed",{enumerable:!0,get:function(){return l}}),e.onDataModeChange=function(n){return s.add(n),()=>{s.delete(n)}},Object.defineProperty(e,"EXAMPLE_LABEL",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"notEnoughTip",{enumerable:!0,get:function(){return b}});const n=['anchorage','souters','kirkmichael','wildings','kirkton','abbotsford','greenside',"3idiots","cecchinis","mrbasrais","yasmins","williewastles","rupeeroom","smokinggoat","pizzaioli","drunkencoo"].includes("wildings");let t=n,o=n;const s=new Set;function c(n){o!==(n=t||n)&&(o=n,s.forEach(n=>n()))}const u=()=>o,l=()=>!o;const f='Example figures',b=n=>`Forecasts start once CoverCharge has ${1===n?'1 week':`${n} weeks`} of your bookings and cash-ups.`},1053,[]); +__d(function(g,r,i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.AccidentBook=function({me:e,meId:t,now:n,app:d,seeAll:h}){const p=(0,l.useSafety)(e=>e.accidents),[y,b]=(0,s.useState)(h?'list':'add'),w=p.filter(e=>e.reportedById===t),f=p.length-w.length;return(0,u.jsxs)(a.default,{style:{gap:12},testID:"accident-book",children:[(0,u.jsx)(c.Tabs,{value:y,onChange:b,options:[{id:'add',label:'Report an accident or near miss'},{id:'list',label:h?`All entries (${p.length})`:`My entries (${w.length})`}]}),'add'===y?(0,u.jsx)(x,{me:e,meId:t,now:n,app:d,onSaved:()=>b('list')}):null,'list'===y?(0,u.jsxs)(c.Box,{testID:"accident-list",children:[(h?p:w).length?(h?p:w).map(e=>(0,u.jsx)(j,{a:e,manager:h},e.id)):(0,u.jsx)(o.Muted,{children:"No entries yet."}),!h&&f>0?(0,u.jsx)(a.default,{testID:"accident-others",children:(0,u.jsxs)(o.Muted,{children:[f," other entr",1===f?'y is':'ies are'," in the book. Only managers can see other people\u2019s entries and personal details."]})}):null]}):null,(0,u.jsx)(o.Muted,{children:"In an emergency call 999 first. The accident book is kept on this device for now; nothing is sent or reported to anyone."})]})};var t=r(_d[0]),s=r(_d[1]),n=e(r(_d[2])),a=e(r(_d[3])),o=r(_d[4]),l=r(_d[5]),d=r(_d[6]),c=r(_d[7]),u=r(_d[8]);const h=e=>String(e).padStart(2,'0'),p=e=>`${e.getFullYear()}-${h(e.getMonth()+1)}-${h(e.getDate())}T${h(e.getHours())}:${h(e.getMinutes())}`,y=e=>{const t=new Date(e);return Number.isNaN(t.getTime())?e:`${t.toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',year:'numeric'})} ${h(t.getHours())}:${h(t.getMinutes())}`};function x({me:e,meId:n,now:h,app:y,onSaved:x}){const[j,b]=(0,s.useState)({date:p(h).slice(0,10),time:p(h).slice(11),location:'',person:'',personType:'Staff',category:'',what:'',injury:'',firstAid:'',witnesses:'',reportedBy:e.replace(' (example)','')}),[w,f]=(0,s.useState)(''),[T,D]=(0,s.useState)(''),I=e=>b({...j,...e}),S='Near miss'===j.category,C=(e,s,n,l=!1)=>(0,u.jsxs)(a.default,{style:{gap:4},children:[(0,u.jsx)(o.T,{size:14,weight:"medium",colour:d.colours.muted,children:e}),(0,u.jsx)(t.TextInput,{accessibilityLabel:e,value:String(j[s]),onChangeText:e=>I({[s]:e}),placeholder:n,placeholderTextColor:"#7D776C",multiline:l,style:[o.styles.input,l&&{minHeight:70,textAlignVertical:'top'}]})]});return(0,u.jsxs)(c.Box,{testID:"accident-form",children:[(0,u.jsx)(o.T,{size:18,weight:"semibold",children:"Report an accident or near miss"}),(0,u.jsxs)(o.Row,{gap:8,children:[(0,u.jsxs)(a.default,{style:{flex:1,gap:4},children:[(0,u.jsx)(o.T,{size:14,weight:"medium",colour:d.colours.muted,children:"Date"}),(0,u.jsx)(t.TextInput,{accessibilityLabel:"Date",value:j.date,onChangeText:e=>I({date:e}),placeholder:"YYYY-MM-DD",placeholderTextColor:"#7D776C",style:[o.styles.input,{minWidth:0,width:40}]})]}),(0,u.jsxs)(a.default,{style:{width:110,gap:4},children:[(0,u.jsx)(o.T,{size:14,weight:"medium",colour:d.colours.muted,children:"Time"}),(0,u.jsx)(t.TextInput,{accessibilityLabel:"Time",value:j.time,onChangeText:e=>I({time:e}),placeholder:"HH:MM",placeholderTextColor:"#7D776C",style:o.styles.input})]})]}),(0,u.jsx)(o.T,{size:14,weight:"medium",colour:d.colours.muted,children:"What kind?"}),(0,u.jsx)(o.Row,{wrap:!0,gap:6,children:l.ACCIDENT_CATEGORIES.map(e=>(0,u.jsx)(o.Chip,{label:e,selected:j.category===e,onPress:()=>I({category:e})},e))}),C('Where it happened','location','e.g. kitchen pass, cellar steps, terrace'),C('Person involved','person','Name'),(0,u.jsx)(o.Row,{wrap:!0,gap:6,children:['Staff','Customer','Contractor','Visitor'].map(e=>(0,u.jsx)(o.Chip,{label:e,selected:j.personType===e,onPress:()=>I({personType:e})},e))}),C('What happened','what','Describe what happened, in order',!0),C('Injury','injury',S?'None (near miss)':'e.g. small cut to left thumb'),C('First aid given','firstAid','e.g. cleaned and plaster applied by \u2026'),C('Witnesses','witnesses','Names, or none'),C('Reported by','reportedBy','Your name'),w?(0,u.jsx)(o.Banner,{kind:"warn",children:w}):null,(0,u.jsx)(o.Button,{label:"Save to the accident book",testID:"accident-save",onPress:()=>/^\d{4}-\d{2}-\d{2}$/.test(j.date)&&/^([01]\d|2[0-3]):[0-5]\d$/.test(j.time)?j.category?j.location.trim()&&j.person.trim()&&j.what.trim()?(l.useSafety.getState().addAccident({when:`${j.date}T${j.time}`,location:j.location.trim(),person:j.person.trim(),personType:j.personType,category:j.category,what:j.what.trim(),injury:j.injury.trim()||(S?'None (near miss)':'Not recorded'),firstAid:j.firstAid.trim()||'None recorded',witnesses:j.witnesses.trim()||'None',reportedBy:j.reportedBy.trim()||e,reportedById:n,app:y}),D(`Saved to the accident book: ${j.category}, ${j.location.trim()}.`),f(''),b({...j,location:'',person:'',category:'',what:'',injury:'',firstAid:'',witnesses:''}),void x()):f('Fill in where it happened, who was involved and what happened.'):f('Pick what kind of accident or near miss it was.'):f('Enter the date as YYYY-MM-DD and the time as HH:MM.')}),T?(0,u.jsx)(a.default,{testID:"accident-saved",children:(0,u.jsx)(o.T,{size:14,colour:d.colours.ok,children:T})}):null,(0,u.jsx)(o.Muted,{children:"Personal details are only visible to managers. You can see your own entries."})]})}function j({a:e,manager:c}){const h=l.RIDDOR_CATEGORIES.includes(e.category),[p,x]=(0,s.useState)(e.riddorNote??''),[j,b]=(0,s.useState)(!1);return(0,u.jsxs)(a.default,{testID:"accident-entry",style:{paddingVertical:10,borderTopWidth:1,borderColor:d.colours.border,gap:4},children:[(0,u.jsxs)(n.default,{accessibilityRole:"button",accessibilityLabel:`${e.category} at ${e.location}`,onPress:()=>b(!j),children:[(0,u.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsxs)(o.T,{weight:"semibold",style:{flex:1},children:[e.category," \xb7 ",e.location]}),(0,u.jsx)(o.Badge,{kind:'Near miss'===e.category?'blue':h?'red':'amber',label:'Near miss'===e.category?'Near miss':h?'Serious':'Accident'})]}),(0,u.jsxs)(o.Muted,{children:[y(e.when)," \xb7 ",e.person," (",e.personType,") \xb7 reported by ",e.reportedBy]})]}),j||c?(0,u.jsxs)(a.default,{style:{gap:2},children:[(0,u.jsxs)(o.T,{size:14,children:["What happened: ",e.what]}),(0,u.jsxs)(o.T,{size:14,children:["Injury: ",e.injury]}),(0,u.jsxs)(o.T,{size:14,children:["First aid: ",e.firstAid]}),(0,u.jsxs)(o.T,{size:14,children:["Witnesses: ",e.witnesses]})]}):null,c&&h?(0,u.jsxs)(a.default,{testID:"riddor-prompt",style:{gap:6},children:[(0,u.jsx)(o.Banner,{kind:"danger",title:"Consider RIDDOR",children:"This may need reporting to the HSE under RIDDOR (for example a specified injury, over-7-day incapacitation, or a member of the public taken to hospital). Check the HSE\u2019s RIDDOR guidance and decide. CoverCharge never reports anything for you."}),(0,u.jsx)(t.TextInput,{accessibilityLabel:"RIDDOR decision note",value:p,onChangeText:x,placeholder:"Your decision, e.g. reported on \u2026 ref \u2026, or not reportable because \u2026",placeholderTextColor:"#7D776C",style:o.styles.input}),(0,u.jsx)(o.Button,{small:!0,label:"Save note",disabled:p===(e.riddorNote??''),onPress:()=>l.useSafety.getState().setRiddorNote(e.id,p)}),e.riddorNote?(0,u.jsxs)(o.Muted,{children:["Saved note: ",e.riddorNote]}):null]}):null]})}},1054,[874,30,263,127,813,1213,821,1358,24]); +__d(function(_g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"CREATOR_TITLE",{enumerable:!0,get:function(){return g}}),_e.DishCreator=function({rid:e,canPublish:t}){const i=(0,d.useGpCalcView)(),[r,o]=(0,s.useState)('create'),[g,x]=(0,s.useState)(()=>y(i.settings.defaultTarget));return(0,h.jsxs)(a.default,{style:{gap:12},testID:"dish-creator",children:[i.alerts.map(e=>(0,h.jsx)(a.default,{testID:"margin-alert",children:(0,h.jsx)(n.Banner,{kind:"danger",title:`Margin dropped: ${e.ingredient} ${e.change}`,children:(0,h.jsxs)(a.default,{style:{gap:4},children:[e.dishes.map(e=>(0,h.jsxs)(n.T,{size:14,colour:"#FFE3DF",children:[e.name,": ",(0,c.pct)(e.before)," \u2192 ",(0,c.pct)(e.after),e.belowTarget?' \xb7 below target':'']},e.id)),(0,h.jsx)(l.default,{accessibilityRole:"button",accessibilityLabel:"Dismiss alert",onPress:()=>i.dismissAlert(e.id),children:(0,h.jsx)(n.T,{size:14,weight:"semibold",colour:u.colours.gold,children:"Dismiss"})})]})})},e.id)),(0,h.jsx)(p.Tabs,{value:r,onChange:o,options:[{id:'create',label:g.name&&i.dishes.some(e=>e.id===g.id)?'Edit dish':'Create'},{id:'saved',label:'Saved dishes & GP'},{id:'items',label:'Ingredients'},{id:'settings',label:'VAT & rounding'}]}),'create'===r?(0,h.jsx)(T,{draft:g,setDraft:x,onNew:()=>x(y(i.settings.defaultTarget)),onSaved:()=>o('saved')},g.id):null,'saved'===r?(0,h.jsx)(S,{rid:e,canPublish:t,onEdit:e=>{x({...e,allergens:[...e.allergens??[]]}),o('create')}}):null,'items'===r?(0,h.jsx)(k,{}):null,'settings'===r?(0,h.jsx)(R,{}):null,(0,h.jsx)(n.Muted,{children:"Costs are visible to Managers and the Head Chef only. Prices you enter, not supplier quotes."})]})};var t=_r(_d[0]),s=_r(_d[1]),i=e(_r(_d[2]));_r(_d[3]);var l=e(_r(_d[4])),a=e(_r(_d[5])),n=_r(_d[6]),r=_r(_d[7]),d=_r(_d[8]),o=_r(_d[9]),c=_r(_d[10]),u=_r(_d[11]),p=_r(_d[12]),h=_r(_d[13]);const g='New dish creator',x={ok:u.colours.ok,amber:u.colours.amber,red:u.colours.red},b=e=>{const t=e.replace(/[\xa3\s]/g,'').replace(',','.');return/^\d+(\.\d{1,2})?$/.test(t)?Math.round(100*Number(t)):null},j=e=>{const t=e.trim().replace(',','.');return/^\d*\.?\d+$/.test(t)?Number(t):null},y=e=>({id:(0,d.gid)('gd'),name:'',lines:[],portions:1,target:e,status:'draft',allergens:[],description:''});function f({n:e,title:t,children:s,testID:i}){return(0,h.jsxs)(p.Box,{testID:i,children:[(0,h.jsxs)(n.Row,{gap:10,children:[(0,h.jsx)(a.default,{style:{width:30,height:30,borderRadius:15,backgroundColor:u.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,h.jsx)(n.T,{weight:"bold",colour:u.colours.onGold,children:e})}),(0,h.jsx)(n.T,{size:18,weight:"semibold",style:{flex:1},children:t})]}),s]})}function w({label:e,value:t,colour:s=u.colours.text,testID:i,sub:l}){return(0,h.jsxs)(a.default,{testID:i,style:{flexGrow:1,flexBasis:140,padding:12,borderRadius:14,backgroundColor:u.colours.surface2,borderWidth:1,borderColor:u.colours.border,gap:2},children:[(0,h.jsx)(n.Muted,{children:e}),(0,h.jsx)(n.T,{size:30,weight:"bold",colour:s,children:t}),l?(0,h.jsx)(n.Muted,{children:l}):null]})}function T({draft:e,setDraft:i,onNew:r,onSaved:g}){const{ingredients:y,dishes:T,settings:P,saveDish:S}=(0,d.useGpCalcView)(),[I,k]=(0,s.useState)(''),[D,R]=(0,s.useState)(!1),[M,$]=(0,s.useState)(''),[A,L]=(0,s.useState)(e.menuPrice?'price':'gp'),[B,G]=(0,s.useState)(e.menuPrice?(e.menuPrice/100).toFixed(2):''),[V,z]=(0,s.useState)(String(e.target)),[E,W]=(0,s.useState)(String(e.targetX??4)),O=t=>i({...e,...t}),N=T.filter(t=>t.id!==e.id),F=(0,c.portionCost)(e,y,T),U=P.vatPct,_=j(V)??e.target,q=j(E)??4,H='price'===A?b(B):F>0?'gp'===A?(0,c.suggestPrice)(F,_,U,P.pricePoints):(0,c.suggestForMultiple)(F,q,U,P.multipleBasis,P.pricePoints):null,X=H?(0,c.gpOf)(F,H,U):null,K=H?(0,c.multipleOf)(F,H,U,P.multipleBasis):0,Q=X?(0,c.toneFor)(X.gpPct,_):'ok',Y=(0,c.suggestAllergens)(e,y,T),J=t=>{const s=y.find(e=>e.id===t),l=t.startsWith('dish:')?'each':(0,c.unitsFor)(s.packUnit)[0],a=[...e.lines,{ingId:t,qty:t.startsWith('dish:')?1:0,unit:l}],n={...e,lines:a},r=(0,c.suggestAllergens)(n,y,T);i({...n,allergens:Array.from(new Set([...e.allergens??[],...r]))})},Z=(t,s)=>O({lines:e.lines.map((e,i)=>i===t?{...e,...s}:e)}),ee=y.filter(e=>!I.trim()||e.name.toLowerCase().includes(I.trim().toLowerCase())),te=t=>{if(!e.name.trim())return $('Give the dish a name first.');if('ready'===t){if(!e.category)return $('Pick a category to make it menu-ready.');if(!e.lines.length||F<=0)return $('Add ingredients with quantities to make it menu-ready.');if(!H)return $('Set a price to make it menu-ready.')}const s='published'===e.status?'published':t;S({...e,name:e.name.trim(),target:_,targetX:q,menuPrice:H??void 0,status:s}),$('ready'===t?`Saved \u201c${e.name.trim()}\u201d as menu-ready. A manager can publish it to the menu.`:`Saved \u201c${e.name.trim()}\u201d as a draft.`)};return(0,h.jsxs)(a.default,{style:{gap:12},children:[(0,h.jsxs)(f,{n:1,title:"Name and category",testID:"step-name",children:[(0,h.jsx)(t.TextInput,{accessibilityLabel:"Dish name",value:e.name,onChangeText:e=>O({name:e.slice(0,60)}),placeholder:"e.g. Cullen skink",placeholderTextColor:"#7D776C",style:[n.styles.input,{fontSize:20}]}),(0,h.jsx)(n.Row,{wrap:!0,gap:6,children:c.DISH_CATEGORIES.map(t=>(0,h.jsx)(n.Chip,{label:t,selected:e.category===t,onPress:()=>O({category:t})},t))})]}),(0,h.jsxs)(f,{n:2,title:"Add saved items and ingredients",testID:"step-ingredients",children:[N.length?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(n.Muted,{children:"Saved items (tap to add a portion)"}),(0,h.jsx)(n.Row,{wrap:!0,gap:6,children:N.map(e=>(0,h.jsx)(n.Chip,{label:`${e.name}`,onPress:()=>J(`dish:${e.id}`)},e.id))})]}):null,(0,h.jsx)(n.Muted,{children:"Ingredients"}),(0,h.jsx)(t.TextInput,{accessibilityLabel:"Search ingredients",value:I,onChangeText:k,placeholder:"Search ingredients",placeholderTextColor:"#7D776C",style:n.styles.input}),(0,h.jsxs)(n.Row,{wrap:!0,gap:6,children:[ee.slice(0,24).map(e=>(0,h.jsx)(n.Chip,{label:`${e.name}`,onPress:()=>J(e.id)},e.id)),(0,h.jsx)(n.Chip,{label:"New ingredient",onPress:()=>R(!0)})]}),D?(0,h.jsx)(C,{initial:I,onDone:e=>{R(!1),k(''),e&&J(e)}}):null,e.lines.length?(0,h.jsx)(a.default,{style:{gap:8},testID:"dish-lines",children:e.lines.map((s,i)=>{const r=s.ingId.startsWith('dish:'),d=y.find(e=>e.id===s.ingId),o=(p=s.ingId).startsWith('dish:')?T.find(e=>e.id===p.slice(5))?.name??'Saved item':y.find(e=>e.id===p)?.name??'?';var p;return(0,h.jsxs)(a.default,{testID:"dish-line",style:{gap:6,padding:10,borderRadius:12,backgroundColor:u.colours.surface2,borderWidth:1,borderColor:u.colours.border},children:[(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsxs)(n.T,{weight:"medium",style:{flex:1},children:[o,r?' (saved item)':'']}),(0,h.jsx)(n.T,{weight:"semibold",children:(0,c.money)((0,c.lineCost)(s,y,T))}),(0,h.jsx)(l.default,{accessibilityRole:"button",accessibilityLabel:`Remove ${o}`,onPress:()=>O({lines:e.lines.filter((e,t)=>t!==i)}),hitSlop:8,children:(0,h.jsx)(n.T,{colour:u.colours.muted,children:" \u2715"})})]}),(0,h.jsxs)(n.Row,{wrap:!0,gap:6,children:[(0,h.jsx)(t.TextInput,{accessibilityLabel:`Quantity of ${o}`,value:s.qty?String(s.qty):'',onChangeText:e=>Z(i,{qty:j(e)??0}),placeholder:"qty",placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",style:[n.styles.input,{width:90}]}),r?(0,h.jsx)(n.Muted,{children:"portion(s)"}):(0,c.unitsFor)(d.packUnit).map(e=>(0,h.jsx)(n.Chip,{label:e,selected:s.unit===e,onPress:()=>Z(i,{unit:e})},e)),r?null:(0,h.jsx)(t.TextInput,{accessibilityLabel:`Waste % for ${o}`,value:null==s.wastePct?'':String(s.wastePct),onChangeText:e=>Z(i,{wastePct:''===e.trim()?void 0:j(e)??0}),placeholder:`waste ${d.wastePct}%`,placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",style:[n.styles.input,{width:110}]})]})]},i)})}):(0,h.jsx)(n.Muted,{children:"Nothing added yet. Tap a saved item or an ingredient above."}),(0,h.jsxs)(n.Row,{gap:10,children:[(0,h.jsx)(n.T,{style:{flex:1},children:"Portions this makes"}),(0,h.jsx)(t.TextInput,{accessibilityLabel:"Portions per batch",value:String(e.portions),onChangeText:e=>O({portions:Math.max(1,Math.round(j(e)??1))}),keyboardType:"number-pad",style:[n.styles.input,{width:80,textAlign:'center'}]})]}),(0,h.jsx)(w,{testID:"cost-per-plate",label:"Cost per plate",value:(0,c.money)(F),sub:e.portions>1?`Batch cost ${(0,c.money)(F*e.portions)} \xf7 ${e.portions}`:'Live: updates as you type'})]}),(0,h.jsxs)(f,{n:3,title:"Price it",testID:"step-price",children:[(0,h.jsx)(p.Tabs,{value:A,onChange:L,options:[{id:'gp',label:'Target GP %'},{id:'x',label:'Target multiple'},{id:'price',label:'Type a price'}]}),'gp'===A?(0,h.jsxs)(n.Row,{wrap:!0,gap:6,children:[[65,70,75].map(e=>(0,h.jsx)(n.Chip,{label:`${e}%`,selected:_===e,onPress:()=>z(String(e))},e)),(0,h.jsx)(t.TextInput,{accessibilityLabel:"Target GP %",value:V,onChangeText:z,keyboardType:"decimal-pad",style:[n.styles.input,{width:80}]})]}):null,'x'===A?(0,h.jsxs)(n.Row,{wrap:!0,gap:6,children:[[3,4,5].map(e=>(0,h.jsx)(n.Chip,{label:`${e}x`,selected:q===e,onPress:()=>W(String(e))},e)),(0,h.jsx)(t.TextInput,{accessibilityLabel:"Target multiple",value:E,onChangeText:W,keyboardType:"decimal-pad",style:[n.styles.input,{width:80}]})]}):null,'price'===A?(0,h.jsxs)(n.Row,{gap:8,children:[(0,h.jsx)(n.T,{size:24,children:"\xa3"}),(0,h.jsx)(t.TextInput,{accessibilityLabel:"Menu price (inc VAT)",value:B,onChangeText:G,placeholder:"0.00",placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",style:[n.styles.input,{width:140,fontSize:24}]}),(0,h.jsx)(n.Muted,{children:"inc VAT"})]}):null,'price'!==A?(0,h.jsxs)(n.Row,{wrap:!0,gap:8,children:[(0,h.jsx)(w,{testID:"suggested-price",label:`Suggested menu price (inc ${U}% VAT)`,value:H?(0,c.money)(H):'\u2014',colour:u.colours.gold,sub:H?`${(0,c.money)(H/(1+U/100))} ex VAT${P.pricePoints?' \xb7 rounded up to .50 / .95':''}`:'Add ingredients first'}),H?(0,h.jsx)(n.Button,{small:!0,kind:"secondary",label:"Type my own price",onPress:()=>{G((H/100).toFixed(2)),L('price')}}):null]}):null,(()=>{const t=(0,c.avgMenuPrice)(T,e.category,e.id);return e.category?(0,h.jsx)(a.default,{testID:"avg-menu-price",children:(0,h.jsx)(n.Muted,{children:t?`Average menu price for ${e.category}: ${(0,c.money)(t.avg)} (${t.count} dish${1===t.count?'':'es'})${H?` \xb7 this dish ${H>=t.avg?'+':'\u2212'}${(0,c.money)(Math.abs(H-t.avg))}`:''}`:`No other priced ${e.category.toLowerCase()} yet to compare with.`})}):null})(),(0,h.jsxs)(n.Row,{wrap:!0,gap:8,children:[(0,h.jsx)(w,{testID:"big-gp",label:`GP (target ${_}%)`,value:X?(0,c.pct)(X.gpPct):'\u2014',colour:X?x[Q]:u.colours.muted}),(0,h.jsx)(w,{testID:"big-x",label:`Multiple (${'inc'===P.multipleBasis?'inc VAT price':'ex VAT price'} \xf7 cost)`,value:X&&F>0?(0,c.fmtX)(K):'\u2014',colour:u.colours.gold}),(0,h.jsx)(w,{testID:"big-profit",label:"Profit per plate (cash GP)",value:X?(0,c.money)(X.cashGp):'\u2014',colour:X?x[Q]:u.colours.muted}),(0,h.jsx)(w,{testID:"big-foodcost",label:"Food cost",value:X?(0,c.pct)(X.foodCostPct):'\u2014'})]}),(0,h.jsxs)(n.Muted,{children:["GP is worked out on the price without VAT (",U,"% VAT). Gold: at or above target \xb7 amber: up to 5 points under \xb7 red: more than 5 under."]})]}),(0,h.jsxs)(f,{n:4,title:"Photo, allergens and description",testID:"step-details",children:[(0,h.jsx)(v,{value:e.photo,onChange:e=>O({photo:e})}),(0,h.jsx)(n.T,{weight:"medium",children:"Allergens (14 UK allergens)"}),Y.length?(0,h.jsx)(a.default,{testID:"allergen-suggest",children:(0,h.jsxs)(n.Muted,{children:["Suggested from the ingredients: ",Y.map(e=>o.ALLERGENS.find(t=>t.id===e).short).join(', '),". Check before it goes on the menu."]})}):(0,h.jsx)(n.Muted,{children:"No allergens known from these ingredients yet. Tick any that apply."}),(0,h.jsx)(n.Row,{wrap:!0,gap:6,children:o.ALLERGENS.map(t=>{const s=(e.allergens??[]).includes(t.id);return(0,h.jsx)(n.Chip,{label:`${s?'\u2713 ':''}${t.short}`,sub:Y.includes(t.id)?'suggested':void 0,selected:s,onPress:()=>O({allergens:s?e.allergens.filter(e=>e!==t.id):[...e.allergens??[],t.id]})},t.id)})}),(0,h.jsx)(t.TextInput,{accessibilityLabel:"Short description",value:e.description??'',onChangeText:e=>O({description:e.slice(0,160)}),multiline:!0,placeholder:"Short description for the menu (up to 160 characters)",placeholderTextColor:"#7D776C",style:[n.styles.input,{minHeight:70,textAlignVertical:'top'}]}),(0,h.jsxs)(n.Muted,{children:[(e.description??'').length,"/160"]})]}),(0,h.jsxs)(f,{n:5,title:"Save",testID:"step-save",children:[(0,h.jsxs)(n.Row,{wrap:!0,gap:8,children:[(0,h.jsx)(n.Button,{label:"Save as draft",kind:"secondary",testID:"save-draft",onPress:()=>te('draft'),style:{flexGrow:1}}),(0,h.jsx)(n.Button,{label:"Save as menu-ready dish",testID:"save-ready",onPress:()=>te('ready'),style:{flexGrow:1}})]}),M?(0,h.jsx)(a.default,{testID:"creator-msg",children:(0,h.jsx)(n.T,{size:15,colour:M.startsWith('Saved')?u.colours.ok:u.colours.amber,children:M})}):null,M.startsWith('Saved')?(0,h.jsxs)(n.Row,{gap:8,children:[(0,h.jsx)(n.Button,{small:!0,label:"See saved dishes",onPress:g}),(0,h.jsx)(n.Button,{small:!0,kind:"secondary",label:"Start a new dish",onPress:()=>{r(),$(''),G(''),L('gp')}})]}):null]})]})}function v({value:e,onChange:t}){return(0,h.jsxs)(n.Row,{gap:10,children:[e?(0,h.jsx)(i.default,{testID:"dish-photo",source:{uri:e},style:{width:96,height:72,borderRadius:10}}):(0,h.jsx)(a.default,{style:{width:96,height:72,borderRadius:10,borderWidth:1,borderStyle:'dashed',borderColor:u.colours.border,alignItems:'center',justifyContent:'center'},children:(0,h.jsx)(n.Muted,{children:"No photo"})}),(0,h.jsxs)(a.default,{style:{gap:6},children:[(0,h.jsx)(n.Button,{small:!0,kind:"secondary",label:e?'Change photo':'Add photo (optional)',onPress:()=>{if('undefined'==typeof document)return;const e=document.createElement('input');e.type='file',e.accept='image/*',e.onchange=()=>{const s=e.files?.[0];if(!s)return;const i=new FileReader;i.onload=()=>{const e=new window.Image;e.onload=()=>{const s=Math.min(1,480/Math.max(e.width,e.height)),i=document.createElement('canvas');i.width=Math.round(e.width*s),i.height=Math.round(e.height*s),i.getContext('2d').drawImage(e,0,0,i.width,i.height),t(i.toDataURL('image/jpeg',.8))},e.src=String(i.result)},i.readAsDataURL(s)},e.click()}}),e?(0,h.jsx)(n.Button,{small:!0,kind:"ghost",label:"Remove photo",onPress:()=>t(void 0)}):null]})]})}function C({initial:e,onDone:i}){const[l,r]=(0,s.useState)(e),[c,p]=(0,s.useState)(''),[g,x]=(0,s.useState)('kg'),[y,f]=(0,s.useState)(''),[w,T]=(0,s.useState)(''),[v,C]=(0,s.useState)([]),P=l.trim()&&j(c)&&null!=b(y);return(0,h.jsxs)(a.default,{testID:"new-ingredient",style:{gap:8,padding:10,borderRadius:12,borderWidth:1,borderColor:u.colours.gold},children:[(0,h.jsx)(n.T,{weight:"semibold",children:"New ingredient"}),(0,h.jsx)(t.TextInput,{accessibilityLabel:"Ingredient name",value:l,onChangeText:r,placeholder:"e.g. Smoked haddock",placeholderTextColor:"#7D776C",style:n.styles.input}),(0,h.jsxs)(n.Row,{wrap:!0,gap:6,children:[(0,h.jsx)(t.TextInput,{accessibilityLabel:"Pack size",value:c,onChangeText:p,placeholder:"pack size",placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",style:[n.styles.input,{width:100}]}),['kg','g','L','ml','each'].map(e=>(0,h.jsx)(n.Chip,{label:e,selected:g===e,onPress:()=>x(e)},e))]}),(0,h.jsxs)(n.Row,{wrap:!0,gap:6,children:[(0,h.jsx)(t.TextInput,{accessibilityLabel:"Pack price (\xa3)",value:y,onChangeText:f,placeholder:"pack price \xa3",placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",style:[n.styles.input,{width:130}]}),(0,h.jsx)(t.TextInput,{accessibilityLabel:"Yield loss / waste %",value:w,onChangeText:T,placeholder:"waste % (optional)",placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",style:[n.styles.input,{width:160}]})]}),(0,h.jsx)(n.Muted,{children:"Allergens in this ingredient (if known)"}),(0,h.jsx)(n.Row,{wrap:!0,gap:6,children:o.ALLERGENS.map(e=>(0,h.jsx)(n.Chip,{label:e.short,selected:v.includes(e.id),onPress:()=>C(v.includes(e.id)?v.filter(t=>t!==e.id):[...v,e.id])},e.id))}),(0,h.jsxs)(n.Row,{gap:8,children:[(0,h.jsx)(n.Button,{small:!0,label:"Add ingredient",disabled:!P,onPress:()=>i(d.useGpCalc.getState().addIngredient({name:l.trim(),packSize:j(c),packUnit:g,packPrice:b(y),wastePct:Math.min(90,j(w)??0),allergens:v}))}),(0,h.jsx)(n.Button,{small:!0,kind:"secondary",label:"Cancel",onPress:()=>i()})]})]})}const P={draft:{label:'Draft',kind:'neutral'},ready:{label:'Menu-ready',kind:'gold'},published:{label:'On the menu',kind:'ok'}};function S({rid:e,canPublish:t,onEdit:i}){const{dishes:l,ingredients:o,settings:g,saveDish:b}=(0,d.useGpCalcView)(),[j,y]=(0,s.useState)('low'),[f,w]=(0,s.useState)(''),T=(0,s.useMemo)(()=>l.map(e=>{const t=(0,c.portionCost)(e,o,l);return{d:e,cost:t,g:e.menuPrice?(0,c.gpOf)(t,e.menuPrice,g.vatPct):null,x:e.menuPrice?(0,c.multipleOf)(t,e.menuPrice,g.vatPct,g.multipleBasis):0}}).sort((e,t)=>(e.g?e.g.gpPct:999)-(t.g?t.g.gpPct:999)),[l,o,g]),v='low'===j?T:[...T].reverse(),C=T.filter(e=>e.g&&e.g.gpPct{const s={};(t.allergens??[]).forEach(e=>{s[e]='contains'});const i=r.useStore.getState().addMenuItem({restaurantId:e,section:t.category??'Specials',name:t.name,description:t.description??'',price:t.menuPrice??null,dietary:[],allergens:s,prepMins:12,soldOut:!1,signOff:null});b({...t,status:'published',menuItemId:i}),w(`Published \u201c${t.name}\u201d to the menu (${t.category??'Specials'}). It needs allergen sign-off in Menu & allergens.`)};return(0,h.jsxs)(p.Box,{testID:"menu-gp",children:[(0,h.jsx)(n.T,{size:18,weight:"semibold",children:"Saved dishes and items \xb7 Menu GP"}),(0,h.jsxs)(n.Muted,{children:[T.length," saved \xb7 ",C," below target \xb7 multiples on the ",'inc'===g.multipleBasis?'inc-VAT menu price':'ex-VAT price']}),(0,h.jsxs)(n.Row,{gap:6,children:[(0,h.jsx)(n.Chip,{label:"Lowest GP first",selected:'low'===j,onPress:()=>y('low')}),(0,h.jsx)(n.Chip,{label:"Highest GP first",selected:'high'===j,onPress:()=>y('high')})]}),v.map(({d:e,cost:s,g:l,x:r})=>{const d=l?(0,c.toneFor)(l.gpPct,e.target):null;return(0,h.jsxs)(a.default,{testID:"gp-row",style:{paddingVertical:10,borderTopWidth:1,borderColor:u.colours.border,gap:4},children:[(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,h.jsxs)(a.default,{style:{flex:1,gap:2},children:[(0,h.jsx)(n.T,{weight:"semibold",children:e.name}),(0,h.jsxs)(n.Row,{wrap:!0,gap:6,children:[(0,h.jsx)(n.Badge,{kind:P[e.status??'draft'].kind,label:P[e.status??'draft'].label}),e.category?(0,h.jsx)(n.Muted,{children:e.category}):null]}),(0,h.jsxs)(n.Muted,{children:["Cost ",(0,c.money)(s),e.menuPrice?` \xb7 price ${(0,c.money)(e.menuPrice)}`:' \xb7 no price yet']})]}),(0,h.jsxs)(a.default,{style:{alignItems:'flex-end'},children:[(0,h.jsx)(n.T,{size:22,weight:"bold",colour:d?x[d]:u.colours.muted,children:l?(0,c.pct)(l.gpPct):'\u2014'}),(0,h.jsx)(n.T,{size:16,weight:"semibold",colour:u.colours.gold,children:l&&s>0?(0,c.fmtX)(r):''})]})]}),l&&l.gpPcti(e)}),t&&'ready'===e.status?(0,h.jsx)(n.Button,{small:!0,label:"Publish to menu",accessibilityLabel:`Publish ${e.name} to menu`,onPress:()=>S(e)}):null,t||'ready'!==e.status?null:(0,h.jsx)(n.Muted,{children:"Waiting for a manager to publish"})]})]},e.id)}),f?(0,h.jsx)(a.default,{testID:"publish-msg",children:(0,h.jsx)(n.T,{size:14,colour:u.colours.ok,children:f})}):null]})}function I(){const{settings:e,setSettings:t}=(0,d.useGpCalcView)(),s=e.priceBasis??'latest',i=e.avgOf??5;return(0,h.jsxs)(a.default,{testID:"price-basis",style:{gap:6},children:[(0,h.jsx)(n.T,{weight:"medium",children:"Cost dishes using"}),(0,h.jsxs)(n.Row,{wrap:!0,gap:6,children:[(0,h.jsx)(n.Chip,{label:"Latest price paid",selected:'latest'===s,onPress:()=>t({priceBasis:'latest'})}),(0,h.jsx)(n.Chip,{label:`Average price (last ${i})`,selected:'average'===s,onPress:()=>t({priceBasis:'average'})})]}),'average'===s?(0,h.jsxs)(n.Row,{wrap:!0,gap:6,children:[(0,h.jsx)(n.Muted,{children:"Average of the last"}),[3,5,10].map(e=>(0,h.jsx)(n.Chip,{label:`${e} prices`,selected:i===e,onPress:()=>t({avgOf:e})},e))]}):null,(0,h.jsx)(n.Muted,{children:'average'===s?'Averages smooth out price swings, so GP doesn\u2019t jump every delivery.':'Uses the most recent price you paid.'})]})}function k(){const{ingredients:e,dishes:t,settings:i}=(0,d.useGpCalcView)(),[l,r]=(0,s.useState)('');return(0,h.jsxs)(p.Box,{testID:"calc-items",children:[(0,h.jsx)(n.T,{size:18,weight:"semibold",children:"Ingredients and average prices"}),(0,h.jsx)(n.Muted,{children:"Record each price you pay (from the delivery note or invoice). Every dish using it re-costs. If a margin drops you\u2019ll see an alert."}),(0,h.jsx)(I,{}),e.map(e=>(0,h.jsx)(D,{i:e,n:i.avgOf??5,basis:i.priceBasis??'latest',used:t.filter(t=>t.lines.some(t=>t.ingId===e.id)).length,onSaved:e=>r(e)},e.id)),l?(0,h.jsx)(a.default,{testID:"items-msg",children:(0,h.jsx)(n.T,{size:14,colour:u.colours.ok,children:l})}):null]})}function D({i:e,used:i,n:l,basis:r,onSaved:o}){const[p,g]=(0,s.useState)(String(e.packSize)),[x,y]=(0,s.useState)(String(e.wastePct)),[f,w]=(0,s.useState)(''),T=(0,c.priceStats)(e,l),v=p!==String(e.packSize)||x!==String(e.wastePct),C=j(p)&&null!=j(x),P=b(f);return(0,h.jsxs)(a.default,{testID:`item-${e.id}`,style:{paddingVertical:10,borderTopWidth:1,borderColor:u.colours.border,gap:6},children:[(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{weight:"medium",style:{flex:1},children:e.name}),(0,h.jsxs)(n.Muted,{children:["used in ",i]})]}),(0,h.jsxs)(n.Row,{wrap:!0,gap:6,children:[(0,h.jsxs)(a.default,{testID:`latest-${e.id}`,style:{paddingHorizontal:10,paddingVertical:6,borderRadius:10,backgroundColor:u.colours.surface2,borderWidth:1,borderColor:'latest'===r?u.colours.gold:u.colours.border},children:[(0,h.jsx)(n.Muted,{children:"Latest"}),(0,h.jsx)(n.T,{weight:"bold",children:(0,c.money)(T.latest)})]}),(0,h.jsxs)(a.default,{testID:`avg-${e.id}`,style:{paddingHorizontal:10,paddingVertical:6,borderRadius:10,backgroundColor:u.colours.surface2,borderWidth:1,borderColor:'average'===r?u.colours.gold:u.colours.border},children:[(0,h.jsxs)(n.Muted,{children:["Average (",T.count,")"]}),(0,h.jsx)(n.T,{weight:"bold",colour:u.colours.gold,children:(0,c.money)(T.avg)})]}),T.count>1?(0,h.jsxs)(a.default,{style:{paddingHorizontal:10,paddingVertical:6},children:[(0,h.jsx)(n.Muted,{children:"Range"}),(0,h.jsxs)(n.T,{size:14,children:[(0,c.money)(T.min),"\u2013",(0,c.money)(T.max)]})]}):null]}),(0,h.jsxs)(n.Muted,{children:["Costing at ",(0,c.money)(e.packPrice)," per ",e.packSize," ",e.packUnit," (",'average'===r?'average':'latest',")"]}),(0,h.jsxs)(n.Row,{wrap:!0,gap:6,children:[(0,h.jsx)(n.T,{children:"\xa3"}),(0,h.jsx)(t.TextInput,{accessibilityLabel:`Price paid for ${e.name}`,value:f,onChangeText:w,placeholder:"price paid",placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",style:[n.styles.input,{width:110}]}),(0,h.jsx)(n.Button,{small:!0,label:"Add price paid",testID:`add-price-${e.id}`,disabled:!P,onPress:()=>{d.useGpCalc.getState().addPricePaid(e.id,P),w(''),o(`Recorded ${(0,c.money)(P)} for ${e.name}. Dishes re-costed.`)}})]}),(0,h.jsxs)(n.Row,{wrap:!0,gap:6,children:[(0,h.jsx)(t.TextInput,{accessibilityLabel:`Pack size for ${e.name}`,value:p,onChangeText:g,keyboardType:"decimal-pad",style:[n.styles.input,{width:70}]}),(0,h.jsx)(n.T,{children:e.packUnit}),(0,h.jsx)(t.TextInput,{accessibilityLabel:`Waste % for ${e.name}`,value:x,onChangeText:y,keyboardType:"decimal-pad",style:[n.styles.input,{width:60}]}),(0,h.jsx)(n.T,{children:"% waste"}),v?(0,h.jsx)(n.Button,{small:!0,label:"Save",disabled:!C,onPress:()=>{d.useGpCalc.getState().saveIngredient({...e,packSize:j(p),wastePct:Math.min(90,j(x))}),o(`Saved ${e.name}. Dishes updated.`)}}):null]})]})}function R(){const{settings:e,setSettings:i}=(0,d.useGpCalcView)(),[l,a]=(0,s.useState)(String(e.vatPct)),[r,o]=(0,s.useState)(String(e.defaultTarget));return(0,h.jsxs)(p.Box,{testID:"calc-settings",children:[(0,h.jsx)(n.T,{size:18,weight:"semibold",children:"VAT and rounding"}),(0,h.jsxs)(n.Row,{gap:8,children:[(0,h.jsx)(n.T,{style:{flex:1},children:"VAT rate %"}),(0,h.jsx)(t.TextInput,{accessibilityLabel:"VAT rate %",value:l,onChangeText:e=>{a(e);const t=j(e);null!=t&&t<=50&&i({vatPct:t})},keyboardType:"decimal-pad",style:[n.styles.input,{width:80}]})]}),(0,h.jsx)(I,{}),(0,h.jsx)(n.Toggle,{label:"Round suggested prices up to .50 / .95",value:e.pricePoints,onChange:e=>i({pricePoints:e})}),(0,h.jsxs)(n.Row,{gap:8,children:[(0,h.jsx)(n.T,{style:{flex:1},children:"Default target GP %"}),(0,h.jsx)(t.TextInput,{accessibilityLabel:"Default target GP %",value:r,onChangeText:e=>{o(e);const t=j(e);null!=t&&t<95&&i({defaultTarget:t})},keyboardType:"decimal-pad",style:[n.styles.input,{width:80}]})]}),(0,h.jsx)(n.T,{weight:"medium",children:"Cost multiple (x) is based on"}),(0,h.jsxs)(n.Row,{gap:6,children:[(0,h.jsx)(n.Chip,{label:"Inc VAT (menu price)",selected:'inc'===e.multipleBasis,onPress:()=>i({multipleBasis:'inc'})}),(0,h.jsx)(n.Chip,{label:"Ex VAT",selected:'ex'===e.multipleBasis,onPress:()=>i({multipleBasis:'ex'})})]}),(0,h.jsx)(n.Muted,{children:"GP % uses the ex-VAT price. The price multiple is the menu price divided by ingredient cost."})]})}},1055,[874,30,196,122,263,127,813,870,1158,814,1159,821,1358,24]); +__d(function(g,_r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.MissedBanner=v,_e.HaccpLog=function({me:e,meId:t,now:n,mode:s}){const[o,l]=(0,i.useState)('today'),r=(e,t)=>({id:e,label:t}),u='chef'===s?[r('today','Today'),r('units','Fridges & units'),r('record','Quick entry'),r('diary','Diary'),r('weekly','Weekly sign-off'),r('report','EHO report'),r('history','History'),r('limits','Safe limits'),r('probes','Wireless probes')]:'managers'===s?[r('today','Today'),r('units','Fridges & units'),r('diary','Diary'),r('weekly','Weekly sign-off'),r('report','EHO report'),r('history','History'),r('limits','Safe limits'),r('probes','Wireless probes')]:[r('today','Today'),r('record','Quick entry'),r('diary','Diary'),r('history','My entries')],h={me:e,meId:t,now:n,mode:s};return(0,y.jsxs)(d.default,{style:{gap:12},testID:"haccp-log",children:['today'!==o?(0,y.jsx)(v,{mode:s,now:n,onPress:()=>l('today')}):null,(0,y.jsx)(x.Tabs,{value:o,onChange:l,options:u}),'today'===o?(0,y.jsx)(b.TodayView,{who:h}):null,'units'===o?(0,y.jsx)(b.UnitsView,{who:h}):null,'record'===o?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(C,{who:h}),(0,y.jsx)(T,{who:h})]}):null,'diary'===o?(0,y.jsx)(b.DiaryView,{who:h}):null,'weekly'===o?(0,y.jsx)(b.WeeklyView,{who:h}):null,'report'===o?(0,y.jsx)(b.ReportView,{who:h}):null,'history'===o?(0,y.jsx)(S,{who:h}):null,'limits'===o?(0,y.jsx)(I,{mode:s,editable:'chef'===s}):null,'probes'===o?(0,y.jsx)(B,{mode:s,me:e,now:n}):null,(0,y.jsx)(c.Muted,{children:"Every reading here was entered by a person; the app never fills in or estimates a value. Sections follow Safer Food, Better Business (cross-contamination, cleaning, chilling, cooking, management). Your own HACCP plan (e.g. CookSafe) sets the limits that count. Saved on this device."})]})};var t=_r(_d[0]),n=_r(_d[1]),s=_r(_d[2]),o=_r(_d[3]),i=_r(_d[4]),l=e(_r(_d[5])),r=e(_r(_d[6])),d=e(_r(_d[7])),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),m=_r(_d[12]),x=_r(_d[13]),b=_r(_d[14]),y=_r(_d[15]);const f=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}),j=e=>new Date(e).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'}),w=e=>{const t=e.trim().replace(',','.').replace(/^\u2212/,'-');return t&&/^-?\d+(\.\d+)?$/.test(t)?Number(t):null};function v({now:e,onPress:t,mode:s="managers"}){const o=(0,n.useSafetyView)(s).points,i=(0,n.useSafetyView)(s).entries,l=(0,h.missedChecks)(o,i,e);if(!l.length)return(0,y.jsx)(d.default,{testID:"haccp-uptodate",children:(0,y.jsx)(c.Banner,{kind:"success",title:"Food safety checks up to date",children:"No checks overdue right now."})});const u=(0,y.jsx)(d.default,{testID:"haccp-missed",children:(0,y.jsx)(c.Banner,{kind:"warn",title:`${l.length} food safety check${1===l.length?'':'s'} overdue`,children:l.map(e=>`${e.point.name} (due ${e.due})`).join(' \xb7 ')})});return t?(0,y.jsx)(r.default,{accessibilityRole:"button",accessibilityLabel:"Open the food safety log",onPress:t,children:u}):u}function k(e,t){u.useSafety.getState().addEntries(t.filter(t=>'chef'!==e.mode||(0,s.chefCanSee)(o.useOwner.getState().site,t.point)).map(t=>{const n=(0,h.isTempKind)(t.point.kind)?(0,h.inRange)(t.point,t.value):!!t.done;return{pointId:t.point.id,name:t.point.name,kind:t.point.kind,at:e.now.toISOString(),by:e.me.replace(' (example)',''),byId:e.meId,app:e.mode,value:t.value,done:t.done,ok:n,corrective:t.corrective?.trim()||void 0,note:t.note?.trim()||void 0,source:t.source,initials:(0,h.initialsOf)(e.me)}}))}function C({who:e}){const l=(0,n.useSafetyView)(e.mode).points,[u,m]=(0,i.useState)(''),[b,f]=(0,i.useState)(null),[j,v]=(0,i.useState)(''),[C,T]=(0,i.useState)(!1),[S,D]=(0,i.useState)(!1),I=(0,i.useRef)(null),P=(t,n)=>{if('chef'===e.mode&&!(0,s.chefCanSee)(o.useOwner.getState().site,t))return f(null),void v('That check is managed in the Managers app.');const i=(0,h.parseQuick)(t,l);D(n),v(''),f(i.map((e,t)=>({key:`${t}-${e.text}`,text:e.text,pointId:e.point?.id,value:null==e.value?'':String(e.value),done:!(!e.point||(0,h.isTempKind)(e.point.kind)||!/\b(done|yes|complete|completed|ok|signed)\b/i.test(e.text))||void 0,corrective:'',problem:e.problem})))},R=(e,t)=>f(n=>n&&n.map(n=>n.key===e?{...n,...t}:n)),B=(b??[]).map(e=>{const t=l.find(t=>t.id===e.pointId),n=w(e.value),s=!!t&&(0,h.isTempKind)(t.kind),o=!!t&&(s?null!=n:void 0!==e.done),i=t?s?null!=n?(0,h.inRange)(t,n):null:void 0===e.done?null:e.done:null;return{d:e,point:t,v:n,temp:s,ready:o,ok:i,needsAction:!1===i&&!e.corrective.trim()}}),L=B.length>0&&B.every(e=>e.ready&&!e.needsAction);return(0,y.jsxs)(x.Box,{testID:"haccp-quick",children:[(0,y.jsx)(c.T,{weight:"semibold",size:17,children:"Quick entry: say or type readings"}),(0,y.jsx)(c.Muted,{children:"For example \u201cwalk-in fridge 3, freezer minus 19\u201d. You check every value before anything is saved."}),(0,y.jsxs)(c.Row,{gap:8,children:[(0,y.jsx)(t.TextInput,{accessibilityLabel:"Readings",value:u,onChangeText:m,placeholder:"walk-in fridge 3, freezer minus 19",placeholderTextColor:"#7D776C",onSubmitEditing:()=>P(u,!1),style:[c.styles.input,{flex:1,minWidth:0,width:40}]}),(0,y.jsx)(r.default,{accessibilityRole:"button",accessibilityLabel:"Speak readings",testID:"haccp-mic",onPress:()=>{const e=(0,x.speechRecognition)();if(!e)return void v("Voice input isn't available in this browser (for example Huawei Browser). Please type the readings instead.");if(C)return void I.current?.stop();const t=new e;I.current=t,t.lang='en-GB',t.interimResults=!1,t.maxAlternatives=1,t.onresult=e=>{const t=e.results?.[0]?.[0]?.transcript??'';m(t),t&&P(t,!0)},t.onerror=()=>v("Didn't catch that. Try again or type the readings."),t.onend=()=>T(!1);try{t.start(),T(!0)}catch{v("Voice input couldn't start. Please type the readings.")}},style:{width:48,height:48,borderRadius:24,borderWidth:1.5,borderColor:p.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:C?p.colours.gold:'transparent'},children:(0,y.jsx)(c.T,{size:20,children:C?'\u25a0':'\ud83c\udfa4'})})]}),(0,y.jsx)(c.Button,{label:"Check readings",disabled:!u.trim(),onPress:()=>P(u,!1)}),j?(0,y.jsx)(d.default,{testID:"haccp-quick-msg",children:(0,y.jsx)(c.Banner,{kind:"info",children:j})}):null,b?(0,y.jsxs)(d.default,{style:{gap:10},testID:"haccp-confirm",children:[(0,y.jsxs)(c.T,{weight:"semibold",children:["Check these ",b.length," reading",1===b.length?'':'s']}),B.map(({d:e,point:n,temp:s,ok:o,needsAction:i})=>(0,y.jsxs)(d.default,{testID:"haccp-draft",style:{gap:6,padding:10,borderRadius:12,borderWidth:1,borderColor:!1===o?p.colours.red:p.colours.border,backgroundColor:p.colours.surface2},children:[(0,y.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsxs)(c.Muted,{style:{flex:1},children:["Heard: \u201c",e.text,"\u201d"]}),(0,y.jsx)(r.default,{accessibilityRole:"button",accessibilityLabel:`Remove ${n?.name??e.text}`,onPress:()=>f(t=>t.filter(t=>t.key!==e.key)),children:(0,y.jsx)(c.T,{colour:p.colours.muted,children:"\u2715"})})]}),n?(0,y.jsxs)(c.T,{weight:"semibold",children:[n.name," ",(0,y.jsxs)(c.Muted,{children:["\xb7 safe: ",(0,h.limitText)(n)]})]}):(0,y.jsxs)(d.default,{style:{gap:6},children:[(0,y.jsx)(c.T,{colour:p.colours.amber,children:e.problem}),(0,y.jsx)(c.Row,{wrap:!0,gap:6,children:l.map(t=>(0,y.jsx)(c.Chip,{label:t.name,onPress:()=>R(e.key,{pointId:t.id,problem:void 0})},t.id))})]}),n&&s?(0,y.jsxs)(c.Row,{gap:8,children:[(0,y.jsx)(t.TextInput,{accessibilityLabel:`Reading for ${n.name}`,value:e.value,onChangeText:t=>R(e.key,{value:t}),placeholder:"\xb0C",placeholderTextColor:"#7D776C",keyboardType:"numbers-and-punctuation",style:[c.styles.input,{width:96,fontSize:20}]}),(0,y.jsx)(c.T,{size:18,children:"\xb0C"}),null===o?(0,y.jsx)(c.Badge,{kind:"amber",label:"Type the reading"}):(0,y.jsx)(c.Badge,{kind:o?'ok':'red',label:o?'OK':'OUT OF RANGE'})]}):null,n&&!s?(0,y.jsxs)(c.Row,{gap:6,children:[(0,y.jsx)(c.Chip,{label:"Done",selected:!0===e.done,onPress:()=>R(e.key,{done:!0})}),(0,y.jsx)(c.Chip,{label:"Not done",selected:!1===e.done,onPress:()=>R(e.key,{done:!1})})]}):null,!1===o?(0,y.jsx)(t.TextInput,{accessibilityLabel:`Corrective action for ${n.name}`,value:e.corrective,onChangeText:t=>R(e.key,{corrective:t}),placeholder:"What did you do? e.g. moved stock, called engineer, re-checked",placeholderTextColor:"#7D776C",style:[c.styles.input,i&&{borderColor:p.colours.red}]}):null,i?(0,y.jsx)(c.T,{size:13,colour:p.colours.red,children:"A corrective action note is needed before saving."}):null]},e.key)),(0,y.jsxs)(c.Row,{gap:8,children:[(0,y.jsx)(c.Button,{label:`Save ${B.length} reading${1===B.length?'':'s'}`,testID:"haccp-save-quick",disabled:!L,onPress:()=>{k(e,B.map(e=>({point:e.point,value:e.temp?e.v:void 0,done:e.temp?void 0:e.d.done,corrective:e.d.corrective,source:S?'voice':'typed'}))),v(`Saved ${B.length} reading${1===B.length?'':'s'}.`),f(null),m('')},style:{flex:1}}),(0,y.jsx)(c.Button,{kind:"secondary",label:"Cancel",onPress:()=>{f(null),v('Nothing saved.')}})]}),(0,y.jsx)(c.Muted,{children:"Nothing is saved until you tap Save."})]}):null]})}function T({who:e}){const s=(0,n.useSafetyView)(e.mode).points,[o,l]=(0,i.useState)(s[0]?.id),[r,d]=(0,i.useState)(''),[u,m]=(0,i.useState)(),[b,f]=(0,i.useState)(''),[j,v]=(0,i.useState)(''),[C,T]=(0,i.useState)(''),S=s.find(e=>e.id===o),D=!!S&&(0,h.isTempKind)(S.kind),I=w(r),P=S?D?null==I?null:(0,h.inRange)(S,I):void 0===u?null:u:null,R=null!==P&&(P||b.trim());return(0,y.jsxs)(x.Box,{testID:"haccp-manual",children:[(0,y.jsx)(c.T,{weight:"semibold",size:17,children:"Record one check"}),(0,y.jsx)(c.Row,{wrap:!0,gap:6,children:s.map(e=>(0,y.jsx)(c.Chip,{label:e.name,selected:e.id===o,onPress:()=>{l(e.id),d(''),m(void 0),f(''),T('')}},e.id))}),S?(0,y.jsxs)(c.Muted,{children:[h.KIND_LABEL[S.kind]," \xb7 safe: ",(0,h.limitText)(S)]}):null,D?(0,y.jsxs)(c.Row,{gap:8,children:[(0,y.jsx)(t.TextInput,{accessibilityLabel:"Temperature reading",value:r,onChangeText:d,placeholder:"\xb0C",placeholderTextColor:"#7D776C",keyboardType:"numbers-and-punctuation",style:[c.styles.input,{width:110,fontSize:22}]}),(0,y.jsx)(c.T,{size:18,children:"\xb0C"}),null===P?null:(0,y.jsx)(c.Badge,{kind:P?'ok':'red',label:P?'OK':'OUT OF RANGE'})]}):(0,y.jsxs)(c.Row,{gap:6,children:[(0,y.jsx)(c.Chip,{label:"Done",selected:!0===u,onPress:()=>m(!0)}),(0,y.jsx)(c.Chip,{label:"Not done",selected:!1===u,onPress:()=>m(!1)})]}),!1===P?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(c.Banner,{kind:"danger",title:D?'Out of range':'Check not done',children:"Write what you did about it before saving (e.g. moved food, discarded, called the engineer, re-checked in 30 minutes)."}),(0,y.jsx)(t.TextInput,{accessibilityLabel:"Corrective action",value:b,onChangeText:f,placeholder:"Corrective action taken",placeholderTextColor:"#7D776C",style:c.styles.input})]}):null,(0,y.jsx)(t.TextInput,{accessibilityLabel:"Note (optional)",value:j,onChangeText:v,placeholder:"Note (optional), e.g. probe used, batch",placeholderTextColor:"#7D776C",style:c.styles.input}),(0,y.jsx)(c.Button,{label:"Save check",testID:"haccp-save-one",disabled:!R,onPress:()=>{k(e,[{point:S,value:D?I:void 0,done:D?void 0:u,corrective:b,note:j,source:'typed'}]),d(''),m(void 0),f(''),v(''),T(`Saved: ${S.name}.`)}}),C?(0,y.jsx)(c.T,{size:14,colour:p.colours.ok,children:C}):null]})}function S({who:e}){const t=(0,n.useSafetyView)(e.mode).entries,s=(0,n.useSafetyView)(e.mode).points,[o,l]=(0,i.useState)('7'),[r,u]=(0,i.useState)('all'),[m,b]=(0,i.useState)(!1),[f,j]=(0,i.useState)(''),w='staff'===e.mode,v=(0,i.useMemo)(()=>{const n=new Date(e.now);n.setHours(0,0,0,0);const s='today'===o?n.getTime():'all'===o?0:e.now.getTime()-864e5*Number(o);return t.filter(t=>!(w&&t.byId!==e.meId||!(new Date(t.at).getTime()>=s)||'all'!==r&&t.kind!==r||m&&t.ok))},[t,o,r,m,w,e.meId,e.now.getTime()]),k=Array.from(new Set(s.map(e=>e.kind))),C=e.now.toISOString().slice(0,10);return(0,y.jsxs)(x.Box,{testID:"haccp-history",children:[(0,y.jsx)(c.T,{weight:"semibold",size:17,children:w?'My entries':'Food safety log'}),(0,y.jsx)(c.Row,{wrap:!0,gap:6,children:[['today','Today'],['7','7 days'],['30','30 days'],['all','All']].map(([e,t])=>(0,y.jsx)(c.Chip,{label:t,selected:o===e,onPress:()=>l(e)},e))}),(0,y.jsxs)(c.Row,{wrap:!0,gap:6,children:[(0,y.jsx)(c.Chip,{label:"All checks",selected:'all'===r,onPress:()=>u('all')}),k.map(e=>(0,y.jsx)(c.Chip,{label:h.KIND_LABEL[e],selected:r===e,onPress:()=>u(e)},e))]}),(0,y.jsx)(c.Toggle,{label:"Out of range only",value:m,onChange:b}),(0,y.jsx)(d.default,{testID:"haccp-count",children:(0,y.jsxs)(c.Muted,{children:[v.length," entr",1===v.length?'y':'ies',v.filter(e=>!e.ok).length?` \xb7 ${v.filter(e=>!e.ok).length} out of range`:'']})}),v.length?v.slice(0,200).map(e=>(0,y.jsx)(D,{e:e},e.id)):(0,y.jsx)(c.Muted,{children:"No entries for these filters yet."}),w?null:(0,y.jsxs)(c.Row,{wrap:!0,gap:8,children:[(0,y.jsx)(c.Button,{small:!0,label:"Download CSV",testID:"haccp-csv",disabled:!v.length,onPress:()=>j((0,x.downloadText)(`food-safety-log-${C}.csv`,(0,h.toCsv)(v,s))?`CSV downloaded: ${v.length} entries.`:'Downloads work in the web app.')}),(0,y.jsx)(c.Button,{small:!0,kind:"secondary",label:"Print for EHO",testID:"haccp-print",disabled:!v.length,onPress:()=>j((0,x.printTable)('Food safety log (HACCP)',`${v.length} entries \xb7 printed ${e.now.toLocaleString('en-GB')} \xb7 all readings entered by staff`,h.LOG_HEAD,(0,h.logRows)(v,s))?'Print view opened in a new tab.':'Pop-ups are blocked: allow them to print.')})]}),f?(0,y.jsx)(c.T,{size:14,colour:p.colours.ok,children:f}):null]})}function D({e:e}){return(0,y.jsxs)(d.default,{testID:"haccp-row",style:{paddingVertical:8,borderTopWidth:1,borderColor:p.colours.border,gap:2},children:[(0,y.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(c.T,{size:15,weight:"medium",style:{flex:1},children:e.name}),(0,y.jsx)(c.T,{size:17,weight:"bold",colour:e.ok?p.colours.ok:p.colours.red,children:(0,h.fmtEntryValue)(e)})]}),(0,y.jsxs)(c.Row,{gap:6,children:[(0,y.jsx)(m.StaffAvatar,{id:e.byId,name:e.by,size:20,ring:!1}),(0,y.jsxs)(c.Muted,{style:{flex:1},children:[j(e.at)," ",f(e.at)," \xb7 ",e.initials??(0,h.initialsOf)(e.by)," ",e.by,'voice'===e.source?' \xb7 voice, confirmed':'probe'===e.source?' \xb7 probe':'',e.ok?'':' \xb7 OUT OF RANGE']})]}),e.corrective?(0,y.jsxs)(c.T,{size:13,colour:p.colours.amber,children:["Action: ",e.corrective]}):null,e.note?(0,y.jsxs)(c.Muted,{children:["Note: ",e.note]}):null,e.photo?(0,y.jsx)(l.default,{source:{uri:e.photo},style:{width:72,height:72,borderRadius:8},accessibilityLabel:"Corrective action photo"}):null]})}function I({editable:e,mode:t}){const s=(0,n.useSafetyView)(t).points,[o,l]=(0,i.useState)('');return(0,y.jsxs)(x.Box,{testID:"haccp-limits",children:[(0,y.jsx)(c.T,{weight:"semibold",size:17,children:"Check points and safe limits"}),(0,y.jsx)(c.Muted,{children:e?'Set the limits from your own HACCP plan. Leave min or max empty if it doesn\u2019t apply. Due times are daily reminders (24 h, comma separated).':'Set by the Head Chef in CoverCharge for Head Chef.'}),s.map(t=>(0,y.jsx)(P,{p:t,editable:e,onSaved:()=>l(`Saved limits for ${t.name}.`)},t.id)),e?(0,y.jsx)(R,{onAdded:e=>l(`Added ${e}.`)}):null,o?(0,y.jsx)(c.T,{size:14,colour:p.colours.ok,children:o}):null]})}function P({p:e,editable:n,onSaved:s}){const[o,l]=(0,i.useState)(null==e.min?'':String(e.min)),[r,m]=(0,i.useState)(null==e.max?'':String(e.max)),[x,b]=(0,i.useState)(e.due.join(', ')),f=(0,h.isTempKind)(e.kind),j=''===x.trim()||x.split(',').every(e=>/^\s*([01]\d|2[0-3]):[0-5]\d\s*$/.test(e)),v=o!==(null==e.min?'':String(e.min))||r!==(null==e.max?'':String(e.max))||x!==e.due.join(', '),k=j&&(''===o||null!=w(o))&&(''===r||null!=w(r));return n?(0,y.jsxs)(d.default,{style:{gap:6,paddingVertical:8,borderTopWidth:1,borderColor:p.colours.border},testID:`limit-${e.id}`,children:[(0,y.jsxs)(c.T,{weight:"medium",children:[e.name," ",(0,y.jsxs)(c.Muted,{children:["\xb7 ",h.KIND_LABEL[e.kind]]})]}),(0,y.jsxs)(c.Row,{wrap:!0,gap:8,children:[f?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(t.TextInput,{accessibilityLabel:`Minimum for ${e.name}`,value:o,onChangeText:l,placeholder:"min \xb0C",placeholderTextColor:"#7D776C",style:[c.styles.input,{width:90}]}),(0,y.jsx)(t.TextInput,{accessibilityLabel:`Maximum for ${e.name}`,value:r,onChangeText:m,placeholder:"max \xb0C",placeholderTextColor:"#7D776C",style:[c.styles.input,{width:90}]})]}):null,(0,y.jsx)(t.TextInput,{accessibilityLabel:`Due times for ${e.name}`,value:x,onChangeText:b,placeholder:"e.g. 09:00, 16:00",placeholderTextColor:"#7D776C",style:[c.styles.input,{flex:1,minWidth:140,width:40}]}),v?(0,y.jsx)(c.Button,{small:!0,label:"Save",disabled:!k,onPress:()=>{u.useSafety.getState().setPoint(e.id,{min:''===o?void 0:w(o),max:''===r?void 0:w(r),due:x.split(',').map(e=>e.trim()).filter(Boolean).sort()}),s()}}):null]}),j?null:(0,y.jsx)(c.T,{size:13,colour:p.colours.red,children:"Use 24-hour times like 09:00, 16:00."})]}):(0,y.jsxs)(c.Row,{style:{justifyContent:'space-between',paddingVertical:4},children:[(0,y.jsx)(c.T,{size:14,style:{flex:1},children:e.name}),(0,y.jsxs)(c.Muted,{children:[(0,h.limitText)(e),e.due.length?` \xb7 due ${e.due.join(', ')}`:'']})]})}function R({onAdded:e}){const[n,l]=(0,i.useState)(''),[r,m]=(0,i.useState)('fridge');return(0,y.jsxs)(d.default,{style:{gap:6,paddingTop:8,borderTopWidth:1,borderColor:p.colours.border},children:[(0,y.jsx)(c.T,{weight:"medium",children:"Add a check point"}),(0,y.jsx)(t.TextInput,{accessibilityLabel:"New check point name",value:n,onChangeText:l,placeholder:"e.g. Dessert fridge",placeholderTextColor:"#7D776C",style:c.styles.input}),(0,y.jsx)(c.Row,{wrap:!0,gap:6,children:Object.keys(h.KIND_LABEL).map(e=>(0,y.jsx)(c.Chip,{label:h.KIND_LABEL[e],selected:e===r,onPress:()=>m(e)},e))}),(0,y.jsx)(c.Button,{small:!0,label:"Add check point",disabled:!n.trim()||!(0,s.chefCanSee)(o.useOwner.getState().site,n),onPress:()=>{if(!(0,s.chefCanSee)(o.useOwner.getState().site,n))return;const t='fridge'===r?{max:5}:'freezer'===r?{max:-18}:'cook'===r?{min:75}:'hothold'===r?{min:63}:'cool'===r||'delivery'===r?{max:8}:{};u.useSafety.getState().addPoint({name:n.trim(),kind:r,due:[],aliases:[n.trim().toLowerCase()],...t}),e(n.trim()),l('')}})]})}function B({me:e,now:l,mode:r}){const h=(0,n.useSafetyView)(r).probes??[],m=(0,n.useSafetyView)(r).points.filter(e=>'fridge'===e.kind||'freezer'===e.kind),[b,f]=(0,i.useState)(!1),[j,w]=(0,i.useState)(''),[v,k]=(0,i.useState)(''),[C,T]=(0,i.useState)(null),[S,D]=(0,i.useState)(''),I=m.find(e=>e.id===v);return(0,y.jsxs)(x.Box,{testID:"haccp-probes",children:[(0,y.jsx)(c.T,{weight:"semibold",size:17,children:"Wireless probes"}),(0,y.jsx)(c.Muted,{children:"Wireless fridge and freezer probes. Once a probe is connected, its readings go into the food safety log tagged \u201cprobe\u201d with the time they were taken. Out-of-range probe readings still need a corrective action from a person."}),h.length?h.map(e=>(0,y.jsxs)(d.default,{testID:"probe-row",style:{gap:6,paddingVertical:10,borderTopWidth:1,borderColor:p.colours.border},children:[(0,y.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsxs)(d.default,{style:{flex:1,gap:2},children:[(0,y.jsx)(c.T,{weight:"semibold",children:e.name}),(0,y.jsx)(c.Muted,{children:e.location})]}),(0,y.jsx)(c.Badge,{kind:'connected'===e.status?'ok':'amber',label:'connected'===e.status?'Connected':'Not connected'})]}),(0,y.jsxs)(c.Row,{wrap:!0,gap:6,children:[(0,y.jsx)(c.Button,{small:!0,label:"Connect your probe",accessibilityLabel:`Connect your probe: ${e.name}`,onPress:()=>T(C===e.id?null:e.id)}),(0,y.jsx)(c.Button,{small:!0,kind:"ghost",label:"Remove",accessibilityLabel:`Remove probe ${e.name}`,onPress:()=>u.useSafety.getState().removeProbe(e.id)})]}),C===e.id?(0,y.jsxs)(d.default,{testID:"probe-connect",style:{gap:6,padding:10,borderRadius:12,borderWidth:1,borderColor:p.colours.gold},children:[(0,y.jsx)(c.T,{weight:"semibold",children:"Connect your probe"}),(0,y.jsxs)(c.T,{size:14,children:["1. Put the probe in ",e.location," and switch it on."]}),(0,y.jsx)(c.T,{size:14,children:"2. Keep this device near the probe."}),(0,y.jsx)(c.T,{size:14,children:"3. Tap Search for probe and pick it from the list."}),(0,y.jsx)(c.Button,{small:!0,kind:"secondary",label:"Search for probe",onPress:()=>D(`No probe found for ${e.name}. Probe hardware isn\u2019t set up yet, so it stays Not connected and nothing is added to the log.`)})]}):null]},e.id)):(0,y.jsx)(d.default,{testID:"probes-empty",children:(0,y.jsx)(c.Muted,{children:"No probes yet."})}),S?(0,y.jsx)(d.default,{testID:"probe-msg",children:(0,y.jsx)(c.Banner,{kind:"info",children:S})}):null,b?(0,y.jsxs)(d.default,{testID:"probe-add",style:{gap:8,padding:10,borderRadius:12,borderWidth:1,borderColor:p.colours.gold},children:[(0,y.jsx)(t.TextInput,{accessibilityLabel:"Probe name",value:j,onChangeText:w,placeholder:"e.g. Walk-in probe 1",placeholderTextColor:"#7D776C",style:[c.styles.input,{minWidth:0}]}),(0,y.jsx)(c.Muted,{children:"Where is it?"}),(0,y.jsx)(c.Row,{wrap:!0,gap:6,children:m.map(e=>(0,y.jsx)(c.Chip,{label:e.name,selected:v===e.id,onPress:()=>k(e.id)},e.id))}),(0,y.jsxs)(c.Row,{gap:8,children:[(0,y.jsx)(c.Button,{label:"Save probe",disabled:!j.trim()||!I,onPress:()=>{j.trim()&&I&&('chef'!==r||(0,s.chefCanSee)(o.useOwner.getState().site,I))&&(u.useSafety.getState().addProbe({name:j.trim(),pointId:I.id,location:I.name,addedBy:e.replace(' (example)',''),addedAt:l.toISOString()}),D(`Added \u201c${j.trim()}\u201d for ${I.name}. Next: connect your probe.`),w(''),k(''),f(!1))}}),(0,y.jsx)(c.Button,{kind:"ghost",label:"Cancel",onPress:()=>f(!1)})]})]}):(0,y.jsx)(c.Button,{kind:"secondary",label:"Add probe",onPress:()=>{f(!0),D('')}}),(0,y.jsx)(c.Muted,{children:"No probe hardware is connected, so no probe readings appear. The app never makes up a temperature."})]})}},1056,[874,1360,1125,854,30,196,263,127,813,1213,1214,821,955,1358,1361,24]); +__d(function(g,r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.SpecialsEditor=function({rid:e,me:l,app:n,now:p}){const j=(0,a.useSpecials)(s=>s.current[e]??null),y=(0,a.useSpecials)(e=>e.history).filter(s=>s.restaurantId===e),{post:f,clear:w,reuse:k,remove:T}=a.useSpecials.getState(),[C,S]=(0,s.useState)(!1),[P,v]=(0,s.useState)(null),[D,B]=(0,s.useState)([]),[I,R]=(0,s.useState)(!1),[M,$]=(0,s.useState)(''),[A,N]=(0,s.useState)(''),[L,U]=(0,s.useState)(''),[G,_]=(0,s.useState)({}),[z,W]=(0,s.useState)(!1),[E,O]=(0,s.useState)(null),[F,Y]=(0,s.useState)(null),[H,K]=(0,s.useState)(''),[V,Z]=(0,s.useState)(!1),q=async e=>{Z(!0);const s=await(0,c.pickImageDataUrl)(1100,e);Z(!1),s&&(v(s),K(''))},J=(0,i.parsePrice)(L),Q={name:M,price:J,allergens:G,noAllergens:z},X=(0,i.itemProblems)(Q),ee=''!==L.trim()&&(null===J||Number.isNaN(J)),se=(0,i.draftProblems)({photo:P,items:D,allergensChecked:I});return(0,u.jsxs)(t.default,{style:{gap:12},testID:"specials-editor",children:[(0,u.jsxs)(o.Card,{children:[(0,u.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(o.T,{weight:"semibold",children:"On the board now"}),j?(0,u.jsx)(o.Badge,{kind:"ok",label:"Live in customer app"}):(0,u.jsx)(o.Badge,{kind:"neutral",label:"Empty"})]}),(0,u.jsx)(t.default,{testID:"specials-last-updated",children:(0,u.jsx)(o.T,{colour:d.colours.goldLight,children:j?(0,i.lastUpdated)(j,p):'Nothing posted. Customers see \u201cToday\u2019s specials are on their way\u201d.'})}),j?(0,u.jsxs)(o.Muted,{children:[(0,i.boardSummary)(j),j.allergenCheck?` \xb7 allergens signed off by ${j.allergenCheck.by}`:'']}):null,(0,u.jsxs)(o.Row,{wrap:!0,gap:8,children:[(0,u.jsx)(o.Button,{testID:"specials-update",label:"Update today\u2019s specials",onPress:()=>{return v((e=!0)?j?.photo??null:null),B(e?j?.items.map(e=>({...e}))??[]:[]),R(!1),$(''),N(''),U(''),_({}),W(!1),S(!0),void K('');var e},style:{flexGrow:1}}),(0,u.jsx)(o.Button,{testID:"specials-clear",kind:"secondary",label:"Clear board",disabled:!j,onPress:()=>O({kind:'clear'}),style:{flexGrow:1}})]})]}),H?(0,u.jsx)(o.Banner,{kind:"success",children:H}):null,C?(0,u.jsxs)(o.Card,{children:[(0,u.jsx)(o.T,{weight:"semibold",size:17,children:"Update today\u2019s specials"}),(0,u.jsx)(o.Muted,{children:"Take a photo of the chalkboard, type the specials, or both. Typed specials show prices and allergens to customers."}),(0,u.jsx)(o.T,{weight:"semibold",colour:d.colours.gold,children:"1. Photo of the board"}),P?(0,u.jsxs)(t.default,{style:{gap:6},testID:"specials-photo-preview",children:[(0,u.jsx)(h.BoardPhoto,{photo:P,onPress:()=>Y(P),testID:"specials-editor-photo"}),(0,u.jsxs)(o.Row,{gap:8,children:[(0,u.jsx)(o.Button,{small:!0,kind:"secondary",label:"Retake or change photo",onPress:()=>q(!1)}),(0,u.jsx)(o.Button,{small:!0,kind:"ghost",label:"Remove photo",onPress:()=>v(null)})]})]}):(0,u.jsxs)(o.Row,{wrap:!0,gap:8,children:[(0,u.jsx)(o.Button,{testID:"specials-take-photo",kind:"secondary",label:"Take a photo",disabled:V,onPress:()=>q(!0),style:{flexGrow:1}}),(0,u.jsx)(o.Button,{testID:"specials-upload-photo",kind:"secondary",label:"Upload a photo",disabled:V,onPress:()=>q(!1),style:{flexGrow:1}})]}),(0,u.jsx)(o.Muted,{children:"The photo is shrunk and kept on this device for now. Nothing is uploaded."}),(0,u.jsxs)(o.T,{weight:"semibold",colour:d.colours.gold,children:["2. Typed specials (",D.length,")"]}),D.map(e=>(0,u.jsxs)(t.default,{style:{gap:4},children:[(0,u.jsx)(h.SpecialRow,{it:e,declared:[]}),(0,u.jsx)(o.Button,{small:!0,kind:"ghost",label:"Remove",accessibilityLabel:`Remove ${e.name}`,onPress:()=>O({kind:'remove-item',id:e.id,label:e.name}),style:{alignSelf:'flex-end'}})]},e.id)),(0,u.jsxs)(t.default,{style:{gap:8,borderWidth:1,borderColor:d.colours.border,borderRadius:12,padding:10},testID:"special-form",children:[(0,u.jsx)(o.Field,{label:"Dish name",value:M,onChangeText:$,placeholder:"e.g. Grilled hake, salsa verde"}),(0,u.jsx)(o.Field,{label:"Short description",value:A,onChangeText:N,placeholder:"One line for customers"}),(0,u.jsx)(o.Field,{label:"Price (\xa3)",value:L,onChangeText:U,placeholder:"e.g. 18.50 (blank: ask your server)",keyboardType:"decimal-pad"}),ee?(0,u.jsx)(o.T,{size:13,colour:d.colours.red,children:"Type the price like 18.50"}):null,(0,u.jsx)(x,{map:G,none:z,onChange:_,onNone:e=>{W(e),e&&_({})}}),M.trim()&&X.length?(0,u.jsx)(o.Muted,{children:X.join(' \xb7 ')}):null,(0,u.jsx)(o.Button,{testID:"special-add",kind:"secondary",label:"Add this special",disabled:!!X.length||ee,onPress:()=>{X.length||ee||(B([...D,{id:b(),name:M.trim(),description:A.trim(),price:J,allergens:G,noAllergens:z||void 0}]),$(''),N(''),U(''),_({}),W(!1),R(!1))}})]}),D.length?(0,u.jsxs)(t.default,{testID:"specials-allergen-check",style:{borderWidth:1,borderColor:I?d.colours.ok:d.colours.amber,borderRadius:12,padding:10,gap:4},children:[(0,u.jsx)(o.Toggle,{label:"I have checked the allergens for every typed special",value:I,onChange:R}),(0,u.jsxs)(o.Muted,{children:["Signed off as ",l," with the time. This joins the allergen log, alongside the sign-off chain for guest allergies."]})]}):null,se.length?(0,u.jsx)(t.default,{testID:"specials-problems",children:(0,u.jsx)(o.Muted,{children:se[0]})}):null,(0,u.jsxs)(o.Row,{gap:8,children:[(0,u.jsx)(o.Button,{kind:"ghost",label:"Cancel",onPress:()=>S(!1)}),(0,u.jsx)(o.Button,{testID:"specials-post",label:"Post to customer app",disabled:!!se.length,onPress:()=>{se.length||(f(e,{photo:P,items:D,allergensChecked:I},l,n),S(!1),K('Specials board updated. Customers see it now in the app\u2019s Specials tab.'))},style:{flex:1}})]})]}):j?(0,u.jsxs)(t.default,{style:{gap:8},testID:"specials-current",children:[j.photo?(0,u.jsx)(h.BoardPhoto,{photo:j.photo,onPress:()=>Y(j.photo)}):null,j.items.map(e=>(0,u.jsx)(h.SpecialRow,{it:e,declared:[]},e.id))]}):null,(0,u.jsxs)(o.Card,{children:[(0,u.jsx)(o.T,{weight:"semibold",children:"Past boards"}),(0,u.jsxs)(o.Muted,{children:["The last ",y.length||'few'," boards. Use one again with one tap; it is posted now, signed off as you."]}),y.length?y.map(s=>(0,u.jsxs)(t.default,{testID:"specials-history-row",style:{borderTopWidth:1,borderColor:d.colours.border,paddingTop:8,gap:6},children:[(0,u.jsx)(o.Row,{style:{justifyContent:'space-between'},children:(0,u.jsxs)(t.default,{style:{flex:1},children:[(0,u.jsx)(o.T,{weight:"medium",children:(0,i.whenText)(s.postedAt,p).replace(/^./,e=>e.toUpperCase())}),(0,u.jsxs)(o.Muted,{numberOfLines:2,children:[(0,i.boardSummary)(s)," \xb7 ",s.postedBy,s.items.length?` \xb7 ${s.items.map(e=>e.name.replace(' (sample)','')).slice(0,3).join(', ')}`:'']})]})}),(0,u.jsxs)(o.Row,{gap:8,children:[(0,u.jsx)(o.Button,{small:!0,label:"Use again",accessibilityLabel:`Use again: board from ${(0,i.whenText)(s.postedAt,p)}`,onPress:()=>{k(e,s.id,l,n),S(!1),K(`Board from ${(0,i.whenText)(s.postedAt,p)} is live again.`)}}),(0,u.jsx)(o.Button,{small:!0,kind:"ghost",label:"Delete",accessibilityLabel:`Delete board from ${(0,i.whenText)(s.postedAt,p)}`,onPress:()=>O({kind:'delete',id:s.id,label:(0,i.whenText)(s.postedAt,p)})})]})]},s.id)):(0,u.jsx)(o.Muted,{children:"No past boards yet."})]}),(0,u.jsxs)(o.Sheet,{visible:!!E,onClose:()=>O(null),title:'clear'===E?.kind?'Clear the specials board?':'delete'===E?.kind?'Delete this past board?':'Remove this special?',testID:"specials-confirm",children:[(0,u.jsx)(o.Muted,{children:'clear'===E?.kind?'Customers will see \u201cToday\u2019s specials are on their way\u201d until you post a new board. The current board is kept in Past boards.':'delete'===E?.kind?`The board from ${E.label} will be removed from Past boards. This can\u2019t be undone.`:E?`\u201c${E.label}\u201d will be taken off this draft.`:''}),(0,u.jsxs)(o.Row,{gap:8,children:[(0,u.jsx)(o.Button,{kind:"ghost",label:"Keep it",onPress:()=>O(null)}),(0,u.jsx)(o.Button,{testID:"specials-confirm-yes",kind:"danger",style:{flex:1},label:'clear'===E?.kind?'Yes, clear the board':'delete'===E?.kind?'Yes, delete it':'Yes, remove it',onPress:()=>{'clear'===E?.kind&&(w(e,l),S(!1),K('Board cleared. Customers see \u201cToday\u2019s specials are on their way\u201d.')),'delete'===E?.kind&&T(E.id),'remove-item'===E?.kind&&B(D.filter(e=>e.id!==E.id)),O(null)}})]})]}),(0,u.jsx)(h.PhotoZoom,{photo:F,onClose:()=>Y(null)})]})};var s=r(_d[0]),l=e(r(_d[1])),t=e(r(_d[2])),o=r(_d[3]),a=r(_d[4]),n=r(_d[5]),i=r(_d[6]),d=r(_d[7]),c=r(_d[8]),h=r(_d[9]),u=r(_d[10]);let p=0;const b=()=>`sp-${Date.now().toString(36)}${(p++).toString(36)}`;function x({map:e,none:s,onChange:a,onNone:c}){return(0,u.jsxs)(t.default,{style:{gap:6},testID:"special-allergens",children:[(0,u.jsx)(o.T,{size:13,weight:"medium",colour:d.colours.muted,children:"Allergens (tap: contains, tap again: may contain)"}),(0,u.jsx)(t.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:6},children:n.ALLERGENS.map(t=>{const n=e[t.id],c='contains'===n?d.colours.redBg:'may'===n?d.colours.amberBg:d.colours.surface2,h='contains'===n?d.colours.red:'may'===n?d.colours.amber:d.colours.border;return(0,u.jsx)(l.default,{accessibilityRole:"button",accessibilityLabel:`${t.short}: ${'contains'===n?'contains':'may'===n?'may contain':'not listed'}`,disabled:s,onPress:()=>a((0,i.cycleAllergen)(e,t.id)),style:{paddingHorizontal:10,paddingVertical:8,minHeight:40,justifyContent:'center',borderRadius:18,borderWidth:1,borderColor:h,backgroundColor:c,opacity:s?.35:1},children:(0,u.jsxs)(o.T,{size:13,weight:"medium",colour:n?d.colours.text:d.colours.muted,children:[t.short,'may'===n?' (may)':'']})},t.id)})}),(0,u.jsx)(o.Toggle,{label:"None of the 14 allergens",value:s,onChange:c})]})}},1057,[30,263,127,813,856,814,857,821,1358,855,24]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"FAIR_USE",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"useAssistant",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"tasksUsed",{enumerable:!0,get:function(){return b}});var e,t=r(d[0]),o=r(d[1]),n=(e=o)&&e.__esModule?e:{default:e},s=r(d[2]),l=r(d[3]);const c=300,u=(0,s.create)()((0,l.persist)(e=>({enabled:!0,voice:!0,tier:'pro',baseUsed:41,log:[],set:t=>e(t),record:t=>e(e=>({log:[{...t,id:`as-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,6)}`},...e.log].slice(0,200)})),clearLog:()=>e({log:[]})}),{name:'covercharge-assistant-v1',version:2,storage:(0,l.createJSONStorage)(()=>n.default),migrate:(e,t)=>t<2?{...e,enabled:!0,voice:!0}:e})),b=e=>((0,t.examplesAllowed)()?e.baseUsed:0)+e.log.filter(e=>['done','demo (nothing sent)','looked up'].includes(e.outcome)).length},1058,[1053,1024,1008,1025]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useOrderSheets",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"useSheets",{enumerable:!0,get:function(){return f}});var e,s=r(d[0]),t=r(d[1]),h=r(d[2]),n=r(d[3]),o=(e=n)&&e.__esModule?e:{default:e},c=r(d[4]),i=r(d[5]),u=r(d[6]);const p=()=>h.IS_ISOLATED_VENUE||s.LIVE_VENUE_BUILD?{}:{anchorage:u.ANCHORAGE_SHEETS.filter(e=>!e.placeholder).map(e=>({...e,items:e.items.map(e=>({...e}))}))},l=(0,c.create)()((0,i.persist)(e=>({sheets:p(),opened:{},upsert:(s,t)=>e(e=>{const h=e.sheets[s]??[];return{sheets:{...e.sheets,[s]:h.some(e=>e.id===t.id)?h.map(e=>e.id===t.id?t:e):[...h,t]}}}),patch:(s,t,h)=>e(e=>({sheets:{...e.sheets,[s]:(e.sheets[s]??[]).map(e=>e.id===t?{...e,...h}:e)}})),remove:(s,t)=>e(e=>({sheets:{...e.sheets,[s]:(e.sheets[s]??[]).filter(e=>e.id!==t)}})),markOpened:(s,t)=>e(e=>({opened:{...e.opened,[s]:t}})),reset:s=>e(e=>({sheets:{...e.sheets,[s]:'anchorage'===s&&p().anchorage||[]}}))}),{name:'covercharge-ordersheets-v1',storage:(0,i.createJSONStorage)(()=>o.default),version:3,migrate:async e=>{const h=e;return s.LIVE_VENUE_BUILD?(await(0,t.archiveChefCache)('order-sheets',h),{...h,sheets:{...h.sheets,anchorage:(h.sheets.anchorage||[]).filter(e=>!('os-veg'===e.id&&e.placeholder))}}):h}})),_=[],f=e=>l(s=>s.sheets[e])??_},1059,[833,1137,5,1024,1008,1025,1060]); +__d(function(g,r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"METHOD_LABEL",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"DAY3",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"DAYS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"wd",{enumerable:!0,get:function(){return i}}),e.dayRange=function(t){const n=[...new Set(t)].sort((t,n)=>t-n);if(!n.length)return'';if(7===n.length)return'every day';return n.every((t,o)=>o===0||t===n[o-1]+1)&&n.length>=3?`${o[n[0]]} to ${o[n[n.length-1]]}`:n.map(t=>o[t]).join(', ')},e.nextDelivery=a,Object.defineProperty(e,"niceDay",{enumerable:!0,get:function(){return d}}),e.remindersFor=function(t,n,o={}){const d=i(n);return t.filter(t=>t.orderDays.includes(d)).flatMap(t=>{if(o[t.id]&&new Date(o[t.id]).toDateString()===n.toDateString())return[];let d=!1;if(/^\d\d:\d\d$/.test(t.cutoff)){const[o,s]=t.cutoff.split(':').map(Number),i=new Date(n);i.setHours(o,s,0,0),d=n>i}const l=a(t,n),c=t.reminder||`Order ${t.name} today${l?` for ${s[i(l)]}`:''}`;return[{supplierId:t.id,name:t.name,text:`${c}${t.cutoff?d?` (cut-off ${t.cutoff} passed)`:` by ${t.cutoff}`:''}`,tone:d?'red':'amber',cutoffPassed:d}]})},e.orderLines=function(n,o,s,i=""){const a=n.items.filter(t=>(o[t.id]??0)>0).map(n=>`${(0,t.fishInStone)(i,n)?(0,t.fishQtyText)(i,n,o[n.id]):`${l(o[n.id])} ${n.unit}`} ${n.name}`.replace(/\s+/g,' ').trim());return s.split('\n').map(t=>t.trim()).filter(Boolean).forEach(t=>a.push(t)),a},e.orderMessage=function(t,n,o,s,i,l){const c=a(t,l);return[`Hi ${t.contact||t.name.split(' (')[0]}, order from ${n}${o?`, ${o}`:''}${c?` for ${d(c)}`:''}:`,...s.map(t=>`- ${t}`),'',`Thanks, ${i}`].join('\n')},e.intlDigits=c,Object.defineProperty(e,"smsLink",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"waLink",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"telLink",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"sid",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"ANCHORAGE_SHEETS",{enumerable:!0,get:function(){return k}});var t=r(_d[0]);const n={online:'Online',phone:'Phone',text:'Text message',whatsapp:'WhatsApp',tbc:'To be decided'},o=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],s=['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'],i=t=>(t.getDay()+6)%7;function a(t,n){const o=null!=t.deliversOn?[t.deliversOn]:t.deliveryDays;if(!o.length)return null;for(let t=1;t<=7;t++){const s=new Date(n);if(s.setDate(s.getDate()+t),o.includes(i(s)))return s}return null}const d=t=>t.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'});const l=t=>Number.isInteger(t)?String(t):t.toFixed(1).replace(/\.0$/,'');function c(t){const n=t.replace(/[^\d+]/g,'').replace(/^\+/,'');return n.startsWith('00')?n.slice(2):n.startsWith('0')?`44${n.slice(1)}`:n}const u=(t,n)=>`sms:${t.replace(/[^\d+]/g,'')}?&body=${encodeURIComponent(n)}`,m=(t,n)=>`https://wa.me/${c(t)}?text=${encodeURIComponent(n)}`,f=t=>`tel:${t.replace(/[^\d+]/g,'')}`;let p=0;const h=(t="os")=>`${t}-${Date.now().toString(36)}${(p++).toString(36)}`,y=(t,n,o)=>({id:t,name:n,unit:o}),b=t=>({number:'',url:'',deliveryDays:[],orderDays:[],cutoff:'',frequency:'',reminder:'',priceCapPerKg:0,seller:'',items:[],notes:'',...t}),k=[b({id:'os-reids',name:'Reids',goods:'Dry goods and frozen',method:'online',urlLabel:'Open Coldweb',deliveryDays:[0,1,2,3,4],frequency:'Order on Coldweb',items:[y('rd-chips','Frozen chips','boxes'),y('rd-oil','Fryer oil','tubs'),y('rd-flour','Flour','bags'),y('rd-rice','Rice','bags'),y('rd-peas','Frozen peas','bags')],notes:'Order on their Coldweb ordering site. Add the Coldweb link in Managers \u203a Settings \u203a Supplier order sheets, or here.'}),b({id:'os-veg',name:'Veg',goods:'Fruit and veg (supplier to be added)',method:'tbc',placeholder:!0,frequency:'To be added by Gordon',notes:'Placeholder: Gordon will add the veg supplier, how to order and delivery days.'}),b({id:'os-peroni',name:'J. Pieroni & Sons',goods:'Seafood (fish merchant, Ayr)',method:'phone',url:'https://pieronis.com',urlLabel:'Open pieronis.com',deliveryDays:[0,1,2,3,4,5],frequency:'Phone order',items:[y('pa-haddock','Haddock fillets','kg'),y('pa-mussels','Mussels','kg'),y('pa-scallops','Scallops','kg'),y('pa-salmon','Salmon','kg')],notes:'Phone order. Press Call, then read the order from the screen.'}),b({id:'os-spesbona',name:'Spes Bona',goods:'Langoustines and smoked haddock',method:'text',orderDays:[2],deliversOn:4,deliveryDays:[4],frequency:'Text on Wednesday for Friday',reminder:'Text Spes Bona today for Friday\u2019s langoustines and smoked haddock',items:[y('sb-langs','Langoustines','kg'),y('sb-smoked','Smoked haddock','kg')]}),b({id:'os-tarelgin',name:'Tarelgin',goods:'Butcher',method:'text',frequency:'Text order',items:[y('tg-steak','Ribeye steaks',''),y('tg-mince','Steak mince','kg'),y('tg-chicken','Chicken breasts',''),y('tg-sausage','Sausages','kg')]}),b({id:'os-mills',name:'Mills',goods:'Milk',method:'whatsapp',frequency:'WhatsApp message',items:[y('ml-milk','Milk','litres'),y('ml-cream','Double cream','litres'),y('ml-butter','Butter','kg')]}),b({id:'os-kittyfisher',name:'Kittyfisher boat (Big Sean)',goods:'Lobsters and crabs',method:'text',contact:'Sean',frequency:'Whenever stock is low',shellfish:!0,items:[y('kf-lobster','Lobsters',''),y('kf-crab','Crabs','')],notes:'Text Big Sean whenever the lobster or crab count runs low.'}),b({id:'os-lionsmane',name:'Lion\u2019s mane mushroom',goods:'Lion\u2019s mane mushrooms',method:'online',urlLabel:'Open seller',frequency:'Weekly or fortnightly',priceCapPerKg:2500,seller:'Cheapest UK seller (to be chosen)',items:[y('lm-kg','Lion\u2019s mane mushroom','kg')],notes:'Order online from the cheapest UK seller under the price cap. Check the price per kg before you buy.'})]},1060,[1149]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"HELP_TOPICS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"HELP",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"helpById",{enumerable:!0,get:function(){return a}});const t=['Bookings','Walk-ins','Table plan','Rota','Hours & pay','Tips','Team','Suppliers','Stock','Recipe cards','Displays','Settings','Accounts'],o=[{id:'new-booking',kind:'guide',topic:'Bookings',title:'Take a phone booking',keywords:['booking','reservation','book','table','phone','covers','reserve'],body:'Add a booking for a guest who calls or walks up to ask. The app only offers times that are really free.',steps:['Open Bookings (or tap New booking on Today).','Pick the date, time and number of covers.','Add the guest\u2019s name and phone, plus any allergies or notes.','Tap Save. The booking appears on the timeline and the floor plan.'],showMe:{tab:'bookings',target:{testID:'add-booking'},hint:'Tap New booking to start a booking.'}},{id:'move-booking',kind:'faq',topic:'Bookings',title:'How do I move a booking to another table or time?',keywords:['move','change','reschedule','table','booking','swap'],body:'Open the booking from Bookings or the timeline and tap Edit, or drag it to another table on the Display. Guests are not messaged unless you choose to.',showMe:{tab:'bookings',target:{testID:'add-booking'},hint:'Your bookings list is here. Tap a booking to change it.'}},{id:'walk-in',kind:'guide',topic:'Walk-ins',title:'Seat a walk-in',keywords:['walk-in','walkin','walk in','seat','no booking','covers','party'],body:'Record guests who arrive without a booking so the floor plan and covers stay right.',steps:['On the Display (the venue tablet), tap Walk-in. On a phone, say \u201cadd a walk-in for 2\u201d to the Assistant.','Choose the number of covers.','Pick a free table (the best fit is suggested).','Tap Seat. The table shows as seated.'],actions:['add_walkin']},{id:'table-plan',kind:'guide',topic:'Table plan',title:'Edit the table plan',keywords:['table plan','floor plan','layout','tables','move tables','designer','areas','seats'],body:'Drag tables into place, set seats, join tables and add areas such as Terrace or Garden.',steps:['Go to More \u203a Table plan.','Tap Open the designer.','Drag tables, or tap one to change its name and seats.','Tap Save. Displays and bookings use the new plan straight away.'],showMe:{tab:'more',page:'tableplan',target:{testID:'open-designer'},hint:'Open the designer to move tables.'}},{id:'rota',kind:'guide',topic:'Rota',title:'Build and publish the rota',keywords:['rota','shift','schedule','week','publish','staff hours','add shift'],body:'Plan the week, then publish it so staff see their shifts in the Staff app.',steps:['Go to More \u203a Rota.','Tap a person\u2019s day to add a shift (presets: lunch, dinner, double).','New shifts are drafts with a dashed amber border.','Tap Publish when the week is ready. Staff see only published shifts.'],showMe:{tab:'more',page:'rota',target:{testID:'rota-publish'},hint:'Tap a day to add a shift, then Publish here.'},actions:['add_rota_shift','publish_rota']},{id:'rota-copy',kind:'faq',topic:'Rota',title:'Can I copy last week\u2019s rota?',keywords:['copy','last week','repeat','rota','duplicate'],body:'Yes. On the Rota tap Copy last week. The shifts come over as drafts so you can tweak them before publishing.',showMe:{tab:'more',page:'rota',target:{testID:'rota-copy'},hint:'Copy last week\u2019s shifts as drafts.'}},{id:'sign-off',kind:'guide',topic:'Hours & pay',title:'Sign off hours',keywords:['sign off','signoff','confirm hours','approve','timesheet','clock','pending'],body:'Only confirmed hours count for pay and tips. Check clocked times against the rota and confirm them.',steps:['Go to More \u203a Sign off hours.','Flagged days (late, missing clock-out, long breaks) are at the top.','Tap a row to fix a time; give a short reason.','Tap Confirm all unflagged, then deal with the rest.'],showMe:{tab:'more',page:'signoff',target:{testID:'confirm-unflagged'},hint:'Confirm all the days that look right in one tap.'}},{id:'payroll-hours',kind:'guide',topic:'Hours & pay',title:'Export hours for payroll',keywords:['payroll','export','hours','spreadsheet','csv','excel','accountant','copy','print'],body:'Get each person\u2019s confirmed hours for a pay period into your spreadsheet or to your accountant.',steps:['Go to More \u203a Payroll hours.','Pick the pay period (or a tips fortnight, or a custom range).','Check the pending banner: sign those off first if you can.','Tap Copy for spreadsheet and paste into Excel or Google Sheets, or download a CSV, or print.'],showMe:{tab:'more',page:'hours',target:{testID:'copy-tsv'},hint:'Copy, then paste straight into your spreadsheet.'}},{id:'pay-dates',kind:'faq',topic:'Hours & pay',title:'How do I set our pay dates?',keywords:['pay day','payday','pay dates','cut-off','wages','monthly','fortnightly'],body:'Settings \u203a Pay & tips: set when tips are paid and how often, the wage pay day and the cut-off. Payroll hours and Tips day use these dates.',showMe:{tab:'more',page:'paysettings',target:{testID:'save-pay'},hint:'Change the dates above, then Save.'}},{id:'tips-day',kind:'guide',topic:'Tips',title:'Share out tips on tips day',keywords:['tips','tronc','gratuity','share','split','tips day','service charge'],body:'Enter the tips total and it\u2019s shared by confirmed hours for the fortnight, to the penny.',steps:['Go to More \u203a Tips day (the right fortnight is picked for you).','Type the total tips.','Check anyone with pending hours; sign them off first if you can.','Copy or download the split for payroll.'],showMe:{tab:'more',page:'tipsday',target:{testID:'tips-total'},hint:'Type the tips total here.'}},{id:'invites',kind:'guide',topic:'Team',title:'Invite staff to the app',keywords:['invite','link','staff app','new starter','sign in','add staff','team member'],body:'Each person gets their own sign-in link. You choose when and how to share it.',steps:['Go to Settings \u203a Invite links.','Tap Make invite link next to the person.','Share the link yourself (text or WhatsApp). The app never sends it for you.','They tap it once and the Staff app remembers them.'],showMe:{tab:'more',page:'setup-invites',target:{text:'Make invite link'},hint:'Make a personal link, then share it yourself.'}},{id:'suppliers',kind:'guide',topic:'Suppliers',title:'Suppliers and order sheets',keywords:['supplier','order','order sheet','delivery','cut-off','fish','veg','dairy'],body:'Keep supplier contacts, order days and cut-offs together, and log what you ordered.',steps:['Go to More \u203a Suppliers to add or edit a supplier.','Use Supplier order sheets for the items you usually order.','Tap Log an order after you place it by phone or email.'],showMe:{tab:'more',page:'ordersheets',target:{testID:'sheet-add'},hint:'Add an order sheet for a supplier.'}},{id:'display-glance',kind:'guide',topic:'Display',title:'Today at a glance (Display)',keywords:['glance','today','covers by hour','breaks','on now','next','cut-off','cutoff','order times','display bar'],body:'The bar under the Display header shows today in one line: covers by hour (booked in solid gold, the walk-in estimate dashed), quiet times for breaks, who is on now and next, today\u2019s supplier order cut-offs with a countdown (amber under 30 minutes) and one tip. Cut-offs come from Scheduled notifications.'},{id:'sold-out',kind:'guide',topic:'Menu',title:'Sold out dishes',keywords:['sold out','run out','ran out','none left','back on','86','eighty six','display strip'],body:'When a dish runs out, mark it sold out so every member of staff knows. It\u2019s a reminder for staff: CoverCharge doesn\u2019t link up to your till, so it doesn\u2019t change the till. Sold out dishes show in a slim strip along the bottom of the Display within seconds, and in the Sold out list in Front of House, Managers and Head Chef. They clear by themselves when the kitchen closes (or the next morning, or only when you tap Back on: Settings \u203a Advanced \u203a Sold out reminders).',steps:['Open the Sold out list (Managers: More \u203a Sold out; Front of House: Me \u203a Sold out; Head Chef: Kitchen \u203a Live tickets \u203a Sold out).','Tap Mark sold out next to the dish.','When it\u2019s back, tap Back on.'],showMe:{tab:'more',page:'soldout',target:{testID:'soldout-search'},hint:'Find the dish, then tap Mark sold out.'}},{id:'shellfish',kind:'guide',topic:'Stock',title:'Live shellfish (and other) counts',keywords:['shellfish','lobster','crab','oysters','count','stock','tracked','sold out','86'],body:'Counters for things you sell by the unit, like lobster or crab. They show on the Display and warn when low.',steps:['Go to Settings \u203a Tracked stock.','Tap Add an item to track; set the name, icon and low warning.','Staff update the count from the small lobster and crab chip at the top of the Display, or in the app.'],showMe:{tab:'more',page:'trackedstock',target:{text:'Add an item to track'},hint:'Add something to count, like lobster.'}},{id:'recipe-cards',kind:'guide',topic:'Recipe cards',title:'Recipe cards',keywords:['recipe','card','dish','ingredients','method','allergens','spec'],body:'Photo, ingredients, method and allergens for each dish; the head chef signs them off and staff can read them.',steps:['Go to More \u203a Recipe cards.','Search for a dish or add a new one.','Fill in ingredients (allergens are suggested) and the method.','Send for head chef sign-off.'],showMe:{tab:'more',page:'recipecards',target:{testID:'card-search'},hint:'Search your recipe cards here.'}},{id:'display-pair',kind:'guide',topic:'Displays',title:'Pair a display or tablet',keywords:['display','tablet','pair','screen','code','front of house','kitchen screen'],body:'Connect a tablet to your venue with a one-time code. You can switch any display off from here.',steps:['Open the Display app on the tablet.','In Managers go to Settings \u203a Displays and tap Make a pairing code.','Type the code on the tablet. It joins your venue straight away.'],showMe:{tab:'more',page:'displays',target:{text:'Make a pairing code'},hint:'Make a one-time code for the tablet.'}},{id:'settings-hours',kind:'faq',topic:'Settings',title:'How do I change our opening hours?',keywords:['opening hours','hours','closed','open','kitchen hours','times'],body:'Settings \u203a Opening hours. Guests see these on your booking and order pages; bookings outside them are turned away.',showMe:{tab:'more',page:'setup-hours',hint:'Set each day\u2019s opening and closing time here.'}},{id:'replay-setup',kind:'faq',topic:'Settings',title:'Can I see the welcome walkthrough again?',keywords:['welcome','setup','walkthrough','onboarding','checklist','questionnaire'],body:'Yes: Settings \u203a Setup checklist \u203a Replay welcome. Everything is pre-filled from your questionnaire.',showMe:{tab:'more',page:'setupchecklist',target:{testID:'replay-welcome'},hint:'Replay the welcome walkthrough.'}},{id:'connected-accounts',kind:'guide',topic:'Accounts',title:'Connect your email, website and socials',keywords:['connect','account','gmail','outlook','wix','facebook','instagram','square','xero','quickbooks','login'],body:'Settings \u203a Connected accounts: tap a logo, save the account to your list, and use Connect with\u2026 to sign in on that service\u2019s own page (rolling out service by service; it shows Coming soon until then). CoverCharge never sees your password that way, and you can remove an account any time.',steps:['Go to Settings \u203a Connected accounts.','Tap the service\u2019s logo.','Tap Connect with\u2026 and sign in on their page.','To stop, tap Remove.'],showMe:{tab:'more',page:'connections',target:{testID:'conn-tile-gmail'},hint:'Tap a logo to connect that account.'}},{id:'supplier-portals',kind:'guide',topic:'Suppliers',title:'Order from Bidfood or Booker',keywords:['bidfood','booker','wholesale','cash and carry','order online','supplier login','account number','customer number'],body:'Settings \u203a Connected accounts \u203a Suppliers. Add Bidfood or Booker for this venue, with your account number if you like. Open ordering and Log in open the supplier\u2019s own website, where you sign in; CoverCharge never keeps the password.',steps:['Go to Settings \u203a Connected accounts.','Scroll to Suppliers.','Tap Add Bidfood or Add Booker (account number optional).','Tap Open ordering or Log in whenever you need them.','To stop, tap Remove and confirm.'],showMe:{tab:'more',page:'connections',target:{testID:'portal-bidfood'},hint:'Your supplier ordering websites live here.'}},{id:'support',kind:'faq',topic:'Settings',title:'How do I get help from a person?',keywords:['support','help','contact','person','problem','broken','stuck'],body:'Support is free for life. Message the CoverCharge team from Settings \u203a Help, or email us, and we\u2019ll reply. We help by message and email.'},{id:'assistant-safe',kind:'faq',topic:'Settings',title:'Can the Assistant send or pay for things by itself?',keywords:['assistant','safe','confirm','send','pay','delete','ai'],body:'No. The Assistant and the voice helper show you exactly what they will do and wait for you to tap Confirm (or say yes). Anything that would send a message, order from a supplier or pay is only saved as a draft in Drafts for approval; nothing goes out by itself.'},{id:'restaurant-dashboard',kind:'guide',topic:'Bookings',title:'Restaurant dashboard',keywords:['restaurant dashboard','tables','timeline','guests','covers','joined tables'],body:'In Managers, tap Restaurant dashboard on Home, or More > Run the day > Restaurant dashboard. It is the same live table plan, Timeline, guest list, deposits, dogs, joined tables, Covers, covers-through-the-day chart and block bookings as the Display. Use the day arrows and Back to today. Assign or join tables on any day; seat, finish, no-show and cancel walk-in actions apply today. You can also say \u201copen Restaurant dashboard\u201d. The helper replies in text only.',showMe:{tab:'more',page:'serviceboard',target:{testID:'restaurant-dashboard-close'},hint:'Restaurant dashboard is open. Pick a day, or tap Back to Managers to close.'}},{id:'voice-helper',kind:'guide',topic:'Settings',title:'Use the hold-to-talk voice button',keywords:['voice','talk','speak','microphone','mic','hold','walkie','button','hands free','gloves'],body:'Hold the big gold button, say what you need, then let go. It logs fridge and freezer temperatures, answers allergen questions, marks dishes sold out, checks tables, adds to the waitlist, reads orders and covers, and drafts bookings, offers, events and Booker or Bidfood lists. The helper replies in text only, never aloud. Changes are shown in text first with Confirm and Cancel buttons: tap Confirm or say yes. Tap the button to type instead (in Managers this also opens the Assistant). It sits at the top right of the header in Managers, Head Chef, the Staff app (the full voice assistant, with no money, tips or HR) and on the Display (no money, tips or HR). Until the voice assistant\u2019s server is switched on, anything new says \u201cVoice assistant is switching on soon\u201d. Fair usage: 1,000 voice tasks a month per venue.',steps:['Hold the gold microphone button (the first time, allow the microphone).','Speak, for example \u201cwalk-in fridge 3 degrees\u201d.','Let go to send.','If it reads something back, tap Confirm or hold again and say \u201cyes\u201d.','The button stays at the top right so it never covers the screen.'],showMe:{tab:'more',page:'voice',hint:'Turn the voice button on or off for each role here.'}},{id:'voice-drafts',kind:'faq',topic:'Settings',title:'Where do voice bookings and shopping lists go?',keywords:['drafts','approve','approval','shopping list','booker list','bidfood list','draft booking','offer','event'],body:'To Settings \u203a Drafts for approval. Bookings, Booker and Bidfood shopping lists, offers, events and specials made by voice wait there for an owner or manager. Approving marks it approved and opens the right screen; you still place the order or confirm the booking yourself.',showMe:{tab:'more',page:'drafts',hint:'Drafts from the voice helper wait here.'}},{id:'voice-temps',kind:'guide',topic:'Settings',title:'Log fridge and freezer temperatures by voice',keywords:['temperature','fridge','freezer','haccp','food safety','eho','log temps','probe'],body:'Hold the voice button and say the unit and the number, for example \u201cwalk-in fridge 3, freezer minus 19\u201d. Fridges should be 5\xb0C or colder and freezers -18\xb0C or colder; anything outside is flagged. Everything is in the Food safety log with who and when, ready to export or print for the EHO.',showMe:{tab:'more',page:'haccp',hint:'Every voice reading appears in the food safety log.'}},{id:'voice-fair-usage',kind:'faq',topic:'Settings',title:'Is there a limit on voice tasks?',keywords:['voice','limit','allowance','fair usage','fair use','how many','tasks','month','plan'],body:'Fair usage: 1,000 voice tasks a month per venue. It is one allowance shared by all of the venue\u2019s apps and devices, and it resets on the 1st. Each request counts once, spoken or typed; saying \u201cyes\u201d to confirm does not count again. You will see a note at 80%. If the venue reaches 1,000, the voice helper pauses until the 1st, except food safety and temperature logging, which always works. The owner can contact CoverCharge if you need more. See the count in Plan & billing or Settings \u203a Voice helper.',showMe:{tab:'more',page:'voice',hint:'This month\u2019s voice task count is shown here.'}},{id:'adv-bookings',kind:'guide',topic:'Settings',title:'Booking questions: allergies, dogs, access, vegan',keywords:['advanced','allergen','dog','dogs','cap','wheelchair','access','vegan','vegetarian','table request','settings'],body:'Choose what guests are asked when they book. Allergies are always asked first, in red, and staff tick \u201cAllergens seen\u201d. The others can be switched off.',steps:['Open More \u203a Settings \u203a Advanced.','In Bookings, tick or untick each question.','Use the dog stepper to cap dogs per booking time (No limit = only the dog-friendly tables).','Mark dog-friendly and step-free tables on the Table plan.'],showMe:{tab:'more',page:'advanced',target:{testID:'adv-bookings'},hint:'Booking questions are here.'}},{id:'adv-table-times',kind:'guide',topic:'Settings',title:'How long tables stay (table times)',keywords:['advanced','dwell','table time','turn','how long','next table free','minutes'],body:'Usual table times by party size: 90 min for 1\u20132 covers, 105 for 3\u20135, 2 hours for 6\u201319 and 3 hours for 20 or more. The app fine-tunes them from how long your tables really stay, and uses them for \u201cNext table free\u201d.',steps:['Open More \u203a Settings \u203a Advanced \u203a Table times.','Tap \u2212 or + to change a band by 5 minutes.','Untick \u201cFine-tune\u201d to use your numbers exactly.','Reset to default puts the four bands back.'],showMe:{tab:'more',page:'advanced',target:{testID:'adv-times'},hint:'Table times are here.'}},{id:'adv-reservable',kind:'guide',topic:'Settings',title:'Seafood platter, crab and lobster reservations',keywords:['advanced','platter','seafood','crab','lobster','reserve','price'],body:'Guests can reserve the Seafood Platter (1 crab + 1 lobster, \xa3160) or a crab or lobster with their booking. Reserved ones come off the Display count with a \u201cReserved\u201d line, the kitchen is told, and the Head Chef taps OK.',steps:['Open More \u203a Settings \u203a Advanced \u203a Reservable items.','Tick what guests can reserve and set the price.'],showMe:{tab:'more',page:'advanced',target:{testID:'adv-reserve'},hint:'Reservable items are here.'}},{id:'adv-events',kind:'guide',topic:'Settings',title:'Regular events like Open Mic Night',keywords:['advanced','open mic night','music night','event','regular','monthly','promote','busier','last food'],body:'Add events that repeat, e.g. Open Mic Night on the last Sunday of every month from 8pm with last food orders at 7pm. They show in Forecast key dates with a Promote button and on Today, and \u201cExpect busier\u201d raises the forecast.',steps:['Open More \u203a Settings \u203a Advanced \u203a Regular events.','Tap Add a regular event (or Edit).','Pick how it repeats and the day, add a start time and last food orders if needed.','Tap Save event.'],showMe:{tab:'more',page:'advanced',target:{testID:'adv-events'},hint:'Regular events are here.'}},{id:'adv-hours',kind:'guide',topic:'Settings',title:'Kitchen hours, seasons and special days',keywords:['advanced','hours','kitchen','season','winter','summer','special day','closed','last food orders','cutoff'],body:'Kitchen (food) hours decide which booking times are offered; the closing time is last food orders. Keep Winter and Summer hours, each with the date it starts every year, and the app switches by itself. Add special days for one-off changes.',steps:['Open More \u203a Settings \u203a Advanced \u203a Kitchen hours.','Tap Set Summer hours, fill in each day and the start date (e.g. 04-01 for 1 April).','Set the Winter start date too.','Use Add a special day for closures or late nights.'],showMe:{tab:'more',page:'advanced',target:{testID:'adv-hours'},hint:'Kitchen hours and seasons are here.'}},{id:'adv-home',kind:'faq',topic:'Settings',title:'Covers counter, Next table free and takeaway on home screens',keywords:['advanced','covers counter','takeaway','next table free','home','display','flip'],body:'Turn the COVERS counter and the \u201cNext table free\u201d card on or off, and choose whether takeaway figures show on home screens (off at the Anchorage). Takeaway order alerts always work. The flap click sound is set on each Display.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-home'},hint:'Display and home options are here.'}},{id:'adv-holidays',kind:'faq',topic:'Settings',title:'Why don\u2019t bank holidays say \u201c(substitute day)\u201d?',keywords:['advanced','holiday','substitute','bank holiday'],body:'The date already shows when a holiday moves, so the extra words are hidden. Tick \u201cShow full gov.uk names\u201d in Settings \u203a Advanced \u203a Holiday names to bring them back.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-holidays'},hint:'Holiday names are here.'}},{id:'adv-blocks',kind:'guide',topic:'Settings',title:'Lunch and dinner times for Block now',keywords:['block','lunch','dinner','service','wix','advanced','pause'],body:'Settings \u203a Advanced \u203a Block bookings sets when Lunch and Dinner run, for the Block now buttons and Spend per head. Copying blocks to website bookings is built but stays off until a test block is approved, so the website can still take bookings in a blocked time.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-blocks'},hint:'Block bookings settings are here.'}},{id:'blocks-screen',kind:'guide',topic:'Bookings',title:'Block bookings: today, a future date, an area or some tables',keywords:['block','blocks','pause','close','closed','stop bookings','private','repeat','future'],body:'Tap Block bookings on the home screen. Block now pauses bookings today (Rest of today, Next hour, Lunch, Dinner, or a From\u2013To). Add a block closes a future date or range, the whole day or set times, the whole venue, one area or some tables, once or every week or on the last weekday of the month. Every future block is listed by month with Edit and Remove; removing asks first and is logged. Bookings already made are kept, and you are told how many.',showMe:{tab:'more',page:'blocks',target:{testID:'blocks-screen'},hint:'Block bookings is here.'}},{id:'spend-per-head',kind:'guide',topic:'Money',title:'Spend per head',keywords:['spend per head','sph','average spend','takings','covers','gross'],body:'Spend per head is Gross takings \xf7 Covers, by day, by week and for lunch and dinner. Enter the gross on the cash up (Take a picture of the taking sheet, Upload a spreadsheet, or Enter takings). Covers are seated and finished bookings and walk-ins; no-shows and cancellations are left out. A day with no takings shows \u201cNo takings entered\u201d, never \xa30.',showMe:{tab:'more',page:'spendhead',target:{testID:'sph-screen'},hint:'Spend per head is here.'}},{id:'cashup-photo',kind:'guide',topic:'Money',title:'Take a picture of the taking sheet, or upload a spreadsheet',keywords:['cash up','photo','spreadsheet','csv','excel','xlsx','camera','sheet','gross','card','cash','tips','takings'],body:'In Cash up & sales tap Take a picture of the taking sheet: the camera opens and the figures are filled in from the photo. Check every figure beside the photo (gross, card, cash, tips, food and drink), change anything that is wrong, then tap Confirm and save. Bigger venues can tap Upload a spreadsheet (CSV or Excel): match the columns, check the preview (dates already saved are flagged), then confirm. Nothing is saved before you confirm, and every save is logged. If the photo can\u2019t be read, type the figures in.',showMe:{tab:'more',page:'cashup',target:{testID:'upload-cashup'},hint:'The taking sheet buttons are here.'}},{id:'adv-giftqr',kind:'guide',topic:'Settings',title:'Buy a gift card on the Display',keywords:['gift','gift card','voucher','qr','display','wix','advanced'],body:'Switch on \u201cShow Buy a gift card on the Display\u201d in Settings \u203a Advanced \u203a Gift cards on the Display, and save your gift card page address. The Display then shows a Buy a gift card button with a large QR code. Guests buy on your website; the Display shows no prices or balances.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-giftqr'},hint:'Gift cards on the Display are here.'}},{id:'adv-whatsapp',kind:'guide',topic:'Settings',title:'WhatsApp buttons (tap to chat)',keywords:['whatsapp','wa.me','message','chat','guest','mobile','number','advanced'],body:'Put the venue\u2019s WhatsApp number in Settings \u203a Advanced \u203a WhatsApp, e.g. 01292 500123 or +44 7700 900123. Guests then see \u201cMessage us on WhatsApp\u201d on their booking confirmation, with their booking details typed in. Staff and managers see \u201cWhatsApp guest\u201d on bookings with a mobile number, with a confirmation typed in that you can change. Nothing is ever sent for you: WhatsApp opens and you tap Send yourself. Leave the number blank and every WhatsApp button stays hidden. Reset to default clears the number.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-whatsapp'},hint:'The WhatsApp number is here.'}},{id:'adv-reminders',kind:'guide',topic:'Settings',title:'Staff reminders: breaks and \u201cchairs up\u201d',keywords:['reminder','reminders','break','breaks','chairs','closing','6 hours','law','snooze','later','done','advanced'],body:'Reminders slide up for staff who are on shift right now (clocked in, or on the rota at that time) in the Staff and Head Chef apps, while the app is open. Break reminders: if the rota shift has a break time, the reminder comes at that time; if not, it comes 4 hours after they clock in (or after the shift starts). If they still haven\u2019t started a break it comes once more 30 minutes later, and again at 6 hours, because UK law says a shift over 6 hours needs a 20-minute break. \u201cStart break\u201d starts their break; \u201cLater\u201d hides it for 15 minutes. You can change these times. Venue reminders, such as \u201cTime to put the chairs up on the tables\u201d (Friday and Sunday, 21:00), have wording, days, a time (UK) and who sees them: everyone on shift, front of house or kitchen. Pause, edit or delete any of them, or add your own. Once anyone taps Done it goes for everyone that day, and the Reminders screen shows who did it. Reset to default brings back the standard break times and \u201cchairs up\u201d; your own reminders stay. Phones with the app closed don\u2019t get reminders yet.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-reminders'},hint:'Reminders are here.'}},{id:'adv-notifications',kind:'guide',topic:'Settings',title:'Scheduled notifications (e.g. the Mills milk order)',keywords:['notification','notifications','push','phone','milk','mills','pieroni','pieronis','veg','olsen','rota upload','scheduled','advanced'],body:'Settings \u203a Advanced \u203a Notifications lists reminders that go to named people at a set UK time, such as \u201cMills milk order\u201d for the Head Chef and Gordon. Each has a title, a message, the days, a time (you can set a different time on some days, e.g. 20:55 on Fridays), who gets it (tick people or pick a group like Everyone on shift) and how it is sent. In the app it is the gold slider with Done and Later; Done is logged with the name and time, and Later hides it for 15 minutes. Urgent notices (like the 6-hour break) always come first and only one shows at a time. Phone notifications: each person taps \u201cTurn on phone notifications\u201d on their own phone (iPhone: add the app to the Home Screen first, iOS 16.4 or later). Nothing goes to phones until an owner or manager switches \u201cSend to phones\u201d on. The Display never gets these. Reset to default restores the configured rules.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-notifications'},hint:'Notifications are here.'}},{id:'adv-order-lists',kind:'guide',topic:'Settings',title:'Order lists (Alsons, Cash and carry)',keywords:['order list','orders','alsons','drinks','cash and carry','trip','shopping','logo','carry over','advanced'],body:'Order lists collect what you need from a supplier. A running list (Alsons drinks) fills up until you order; a trip list (Cash and carry) is for a shopping day, Friday by default, which you can change for each trip. Add an item with a quantity and unit and an optional note; the app records who added it and when. Adding something already on the list offers to add to the quantity instead. On the day, tick Got or Ordered, or mark Missing / not in stock. Finish order saves it to History (date and who) and asks whether to carry over anything not got. Removing an item can be undone. Settings \u203a Advanced \u203a Order lists: add, rename or archive lists, the default trip day, and \u201cLet all staff add items\u201d (on: staff can add and see lists; only managers and the Head Chef tick, remove or finish). Each list can have a logo (take a photo or choose one) or shows its initials, and a phone number to tap to call (never called for you).',showMe:{tab:'more',page:'advanced',target:{testID:'adv-orderlists'},hint:'Order list settings are here.'}},{id:'adv-clock-area',kind:'guide',topic:'Settings',title:'Clock-in area, forgotten breaks and off-rota arrivals',keywords:['clock','clock in','geofence','location','area','radius','break','forgot','rota','visiting','override','advanced'],body:'Clock in, clock out, start break and end break only work at the venue once the centre is set. Stand in the middle of the venue and tap \u201cUse my current location\u201d, then choose how far (at least 50 m, 100 m to start). Phones are not exact, so up to 50 m of the phone\u2019s own accuracy is allowed on top. Each clock record keeps the reading, its accuracy and whether it was inside. If location is off or blocked, the app says how to allow it. Managers can record it for someone from Clock in / out \u203a Record it for someone, with a reason that is logged. Until the centre is set nobody is blocked and managers see a warning. Rota and pay screens are never blocked. Forgotten breaks: if no break was recorded, Clock out asks \u201cDid you take a break? If so, how long?\u201d; a length you pick is saved as a break marked \u201cadded at clock-out\u201d, which managers see and can edit in Hours. Not on the rota: if someone is at the venue, not clocked in and not on the rota, the Staff and Head Chef apps ask \u201cDo you want to sign in?\u201d. Yes clocks them in, marked off-rota, and managers get a notice; \u201cNo, just visiting\u201d stops asking for the day. This only checks while the app is open; web apps can\u2019t watch location in the background.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-clockarea'},hint:'Clock-in area settings are here.'}},{id:'adv-tablegrid',kind:'guide',topic:'Table plan',title:'Table plan grid and Tidy up (Advanced)',keywords:['grid','snap','line up','align','tidy','guides','spacing','restore','table plan','option','alt'],body:'Tables snap to the grid when you drag them, and gold guides show when an edge or centre lines up with another table. A small number shows when the gaps either side are even. Hold Alt (Option on a Mac) to move freely. Tidy up lines every table up on the grid and evens out the rows; only positions change. The old positions are kept, so one tap puts them back.',steps:['Go to Settings \u203a Advanced.','Find Table plan grid.','Turn snapping on or off, pick a grid size, or tap Tidy up the whole plan.','Changed your mind? Tap Put the tables back where they were.']},{id:'adv-printers',kind:'guide',topic:'Orders',title:'Kitchen ticket printers (Advanced)',keywords:['print','printer','printing','ticket','kitchen ticket','docket','receipt','epson','star','bluetooth','reprint','takeaway'],body:'Print a kitchen ticket by itself for every takeaway order, as soon as it comes in or when it is accepted. The ticket has the order number, collection time, name, every dish with its options and notes, allergies in white-on-black, and paid or not paid. Works with Epson (TM-m30, TM-T20, TM-T88), Star WebPRNT, most other network receipt printers (port 9100) and Bluetooth printers from the tablet app. If a ticket does not print, an amber warning shows and the order stays on screen.',steps:['Go to Settings \u203a Advanced.','Find Printers.','Tap Add a printer by IP address or Find printers on this Wi-Fi, choose the type and tap Test print.','Turn on Print a kitchen ticket for every takeaway order.']},{id:'adv-deposits',kind:'guide',topic:'Bookings',title:'Deposits (Advanced)',keywords:['deposit','deposits','per person','party size','refund','refundable','cut off','policy','paid','due'],body:'Ask bigger tables for a deposit: set the amount per person, the smallest party that pays one, whether it is refundable and up to how many hours before, and the words guests see. No card is saved in CoverCharge. Deposits are paid through website bookings: website bookings show Deposit paid on website bookings, Part paid on website bookings or Deposit not paid by themselves. For phone and walk-in bookings, staff tick Deposit paid once the guest has paid you, or (once switched on) press Send deposit link to send a website bookings pay link by text, WhatsApp or email. Refunds are done in Website bookings \u203a Orders. Deposit amounts are shown on bookings in Managers, Display and Staff. Other financial and HR information remains restricted.',steps:['Go to Settings \u203a Advanced.','Find Deposits.','Turn deposits on or off, and set the amount, party size, refund terms and the words guests see.','On a booking, tap Mark deposit paid once the guest has paid.']},{id:'adv-loyalty',kind:'guide',topic:'Guests',title:'Loyalty: stamp card, offers & bring a friend (Advanced)',keywords:['loyalty','stamp','stamps','card','reward','offer','offers','referral','friend','expiry'],body:'The stamp card, offers and bring-a-friend are saved on the server, so every phone and tablet shows the same card. Set how many stamps earn a reward, what the reward is, when stamps or rewards run out, and how often one guest can get a stamp. Stamps only come from staff, or from a code or QR staff make, and each reward can be used once. Guests join with their agreement recorded, and a manager can remove a guest and their details.',steps:['Go to Settings \u203a Advanced.','Find Loyalty.','Turn the stamp card on, write the reward and tap Save loyalty settings.','Add offers with their dates, and turn bring-a-friend on if you want it.']},{id:'adv-table-order',kind:'guide',topic:'Guests',title:'Order at the table (Advanced)',keywords:['order at table','qr','qr code','scan','table','phone','accept','last orders','print','pdf','pay at bar'],body:'Guests scan the QR code on their table, see your menu with allergens, and send an order. It lands in Front of House and on the kitchen screen within seconds. Prices, sold-out dishes and hours are checked on the server, so a phone can\u2019t change them. Staff accept the first order from each new phone (you can turn this off). Guests pay at the bar or till; paying by card from the phone is coming later.',steps:['Go to Settings \u203a Advanced.','Find Order at the table.','Turn it on, pick the areas or tables, set the hours and tap Save order at the table.','Tap Make codes, then Print QR sheet (PDF) and put each code on its table.']},{id:'adv-soldout',kind:'guide',topic:'Menu',title:'Sold out reminders (Advanced)',keywords:['sold out','86','clear','end of service','next morning','back on','advanced','display strip','automatic','counts','lobster','crab'],body:'Choose when sold out dishes go back on by themselves: when the kitchen closes (from your Kitchen hours), the next morning (pick the time), or only when someone taps Back on. \u201cMark dishes sold out from the counts\u201d (on unless you turn it off) marks every dish that uses a counted item, like lobster or crab, when the count runs out, and puts it back on when the count is back up. Sold out is a reminder for staff on the Display and in the staff apps; it doesn\u2019t change your till.',steps:['Go to Settings \u203a Advanced.','Find Sold out reminders.','Pick when they clear, and turn marking from the counts on or off.']},{id:'sold-out-auto',kind:'guide',topic:'Menu',title:'Sold out from the counts (lobster, crab\u2026)',keywords:['sold out','automatic','auto','counts','shellfish','lobster','crab','platter','link','uses','none left'],body:'When a counted item runs out, or drops below what a dish needs, every dish that uses it is marked sold out by itself, with the reason: \u201cDeluxe Seafood Platter (no lobster or crab)\u201d. When the count is back up (a delivery or a recount), those dishes go back on by themselves. Dishes marked by hand are left alone. CoverCharge works out what each dish uses from its recipe card, its description (\u201cone whole lobster\u201d) or its name; you can change it for any dish. If you tap Back on while the count is still short, the dish stays on until the count changes.',steps:['Open the Sold out list.','Under Dishes linked to the counts, tap Change next to a dish.','Set how many of each item one portion uses (0 = not linked), then tap Save. Back to automatic undoes it.'],showMe:{tab:'more',page:'soldout',target:{testID:'soldout-links'},hint:'Tap Change next to a dish to set what it uses.'}},{id:'adv-forecast',kind:'guide',topic:'Forecasts',title:'Forecast history and "Not enough history yet"',keywords:['forecast','not enough history','history','estimate','example figures','labour','sales','walk-ins','advanced'],body:'Forecasts are built only from your own bookings, seated walk-ins, takeaway orders and cash-ups. Until CoverCharge has enough of your history (2 weeks to start with; change it in Settings \u203a Advanced \u203a Forecast history) you see \u2018Not enough history yet\u2019, what is already booked and your real labour cost from the rota, with no sales forecast or labour %. No history is invented for a live venue.',steps:['Go to Settings \u203a Advanced.','Find Forecast history.','Pick how many weeks are needed.']},{id:'adv-checkout',kind:'guide',topic:'Team',title:'Shift check-out, question board and team morale',keywords:['check out','checkout','morale','mood','staffing','overstaffed','survey','anonymous','question board','vote','shout out','wellbeing','advanced'],body:'When someone clocks out, they get a quick card: team morale from Low to High, and whether there was enough staff for the customers. They can also post a question for the board or shout out a teammate, or tap Skip. Nothing shows at clock in. Answers are anonymous: no name or staff number is saved, and each phone can answer a shift once. Team morale (Managers app \u203a More \u203a Team morale) shows a day only once 3 or more people have answered, next to that day\u2019s covers. Change the wording or switch parts off here.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-checkout'},hint:'Check-out and board settings are here.'}},{id:'hr-board',kind:'guide',topic:'Team',title:'The anonymous question board',keywords:['question board','board','anonymous','vote','yes no','reply','hide','moderation','log'],body:'Anyone on the team can post a question and vote it up, or vote Yes or No. No names are shown or saved. Owners and managers can reply (shown as \u201cReply from the managers\u201d) and hide offensive posts with a reason. Every hide, unhide and reply is in the Moderation log.',showMe:{tab:'more',page:'board',hint:'The question board.'}},{id:'adv-tasks',kind:'guide',topic:'Team',title:'Daily tasks',keywords:['tasks','daily tasks','checklist','duties','jobs','to do','my tasks','library','head chef'],body:'Give each person a short list of daily tasks: open Staff & roles, tap Daily tasks on their card, then pick from the venue\u2019s task library or type a new one. Use the arrows to reorder, \u2715 to remove (with Undo) and Days to limit a task to certain days. They see \u201cMy tasks today\u201d on their home screen and tick each one off while on shift; each tick records who and when, and you see \u201c2 of 5 done today\u201d on their card. Lists start fresh every day. Owners and managers can change anyone\u2019s list, including the Head Chef\u2019s. The Head Chef can change the lists of kitchen staff (chefs, commis and KPs) from Kitchen \u203a Kitchen team tasks, but not their own and not front of house. The task library is in Settings \u203a Advanced \u203a Tasks.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-tasks'},hint:'The task library is here.'}},{id:'adv-cashup',kind:'guide',topic:'Money',title:'Cash up and weekly sales',keywords:['cash up','cashup','takings','float','till','sales report','weekly sales','pos','printout','photo','graphs','charts'],body:'At the end of the night open Cash up & sales and tap Upload cash up sheet. Your phone camera opens; take a photo of the paper sheet (you can add several). The review screen shows the photo beside the figures. Automatic reading isn\u2019t switched on yet, so type each figure from the photo; boxes left blank stay blank (never counted as zero) and are highlighted in amber. Nothing is saved until you tap Confirm and save. Do the same with the weekly sales report from the till (several pages is fine). The graphs show daily takings, tips, weekly net sales against the week before and sales by category. Owners and managers can enter and change cash ups; the Head Chef can see the graphs. Change the boxes to match your sheet in Settings \u203a Advanced \u203a Cash up; Cash tips total and Card tips total are always kept.',showMe:{tab:'more',page:'cashup',target:{testID:'upload-cashup'},hint:'Start the cash up here.'}},{id:'adv-tips',kind:'guide',topic:'Money',title:'Today\u2019s tips and the Tips pot',keywords:['tips','today tips','tips pot','pot','payout','tip pay','correction','coins'],body:'When a cash up with Cash tips total and Card tips total is confirmed, the team\u2019s combined tips for that day show as Today\u2019s tips in every staff app and on the Display, with a short notice. The Tips pot adds up confirmed daily tips since the last payout (fortnightly tip pay). After paying the tips, an owner or manager taps Mark payout done on the Tips pot card: the pot goes back to \xa30.00 and the old pot is kept in Past pots. Use Correct an entry to add or take off an amount for a day; a reason is required and every correction is logged with your name. Only the team total is ever shown, never anyone\u2019s share. Hide either card in Settings \u203a Advanced \u203a Tips.',showMe:{tab:'more',page:'advanced',target:{testID:'adv-tips'},hint:'Show or hide the tips cards here.'}},{id:'manager-access',kind:'guide',topic:'Team',title:'Manager access',keywords:['manager access','manager','access','role','promote','front of house','head chef','owner'],body:'In Staff & roles each person has a Manager access switch. On: they use the Manager app (rota, bookings, staff, hours, settings, plus their own clock in, rota and pay). Off: they use the Front of House app, or the Head Chef app for the Head Chef. Owners can switch anyone except owners; managers can switch anyone except themselves and owners. The last owner can never be removed. You confirm each change; it is logged with who and when (Access changes). Job titles are free text and don\u2019t change.',showMe:{tab:'more',page:'staff',target:{testID:'access-tip'},hint:'Manager access switches are on each person.'}},{id:'next-table-free',kind:'faq',topic:'Walk-ins',title:'When is the next table free?',keywords:['next table','free','wait','walk-in','quote','full'],body:'When you\u2019re full, Today and the Display show \u201cNext table free about 19:40 (T6, 4 seats)\u201d with \u201clikely\u201d or \u201cmaybe\u201d, and how long a walk-in for 2 or 4 would wait. Tap Bill requested or Table finished on the plan and it updates. You can also ask the Assistant \u201cwhen\u2019s the next table free?\u201d.'},{id:'time-travel',kind:'faq',topic:'Today',title:'Look at another day (time travel)',keywords:['yesterday','tomorrow','next week','past','future','day','time travel'],body:'On Today, tap \u2039 or \u203a beside the date to step a day back or forward. You\u2019ll see that day\u2019s kitchen hours, events, covers (booked, or how it went), platters and each booking\u2019s allergens and needs. It\u2019s read-only and nothing changes live service. Tap Today to come back. The Display goes back to today by itself after 2 minutes. Staff can look 7 days back and 14 days ahead.'},{id:'sign-in-links',kind:'guide',topic:'Team',title:'Personal sign-in links',keywords:['link','invite','sign in','new link','expired','already used','phone','login'],body:'Each personal link works on one phone only and lasts 72 hours, so nobody else can sign in as that person. The same phone can open it again, in any of the apps. If someone gets a new phone, or their link has expired, open Staff & roles, tap New sign-in link on their entry, then Copy link and send it to them yourself. The app never sends it. Owners can make links for anyone; managers for anyone except owners. Their old unused link stops working; phones already signed in stay signed in.',showMe:{tab:'more',page:'staff',target:{testID:'access-tip'},hint:'New sign-in link is on each person.'}},{id:'pins-security',kind:'faq',topic:'Team',title:'PINs for the Display',keywords:['pin','display pin','clock in','wake pin','2580','manager pin','locked'],body:'Staff PINs for clocking in at the Display are 4 to 8 digits. Managers and owners need 6 to 8 digits, because their PIN can add temp staff. Easy PINs such as 1111 or 1234 are refused. Five wrong tries locks that person for 15 minutes; 20 wrong tries on one Display stops it for 15 minutes. The Display wake PIN (Settings \u203a Display) is 6 to 8 digits and is kept only as a scrambled hash. If it still says 2580, change it.'},{id:'cash-up-lock',kind:'faq',topic:'Money',title:'Correcting a signed-off cash up',keywords:['cash up','locked','unlock','correct','mistake','history','audit','sales report'],body:'Once a cash up or weekly sales report is confirmed and saved, it is locked so the figures can\u2019t change quietly. An owner taps Unlock to correct on it, says why, and has 30 minutes to fix it. History on each one shows who signed it off, changed or unlocked it, and when.'},{id:'wipe-device',kind:'faq',topic:'Settings',title:'Sign out and wipe a shared tablet or phone',keywords:['wipe','sign out','shared','tablet','leaver','lost','reset device'],body:'Tap the sync badge (bottom left), or go to Settings \u203a Display, and choose Sign out and wipe this device. It signs out and removes everything CoverCharge keeps on that device: sign-ins, pairing, saved screens and changes not sent yet. The venue\u2019s shared data is not touched. On the Display you type the wake PIN first.'}],a=t=>o.find(o=>o.id===t)},1061,[]); +__d(function(g,r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"tokens",{enumerable:!0,get:function(){return o}}),e.lev=l,e.searchHelp=function(n,l,i=8){const h=o(l);if(!h.length)return[];const a=t(l);return n.map(n=>{const l=o(n.title),i=o(n.keywords.join(' ')),c=o(`${n.body} ${(n.steps??[]).join(' ')}`);let f=3*s(h,l)+2.5*s(h,i)+.8*s(h,c);return n.keywords.some(n=>a.includes(t(n))&&t(n).length>3)&&(f+=2),t(n.title).includes(a)&&a.length>3&&(f+=3),{a:n,score:f/Math.sqrt(h.length)}}).filter(t=>t.score>=1.2).sort((t,n)=>n.score-t.score).slice(0,i)};const t=t=>t.toLowerCase().replace(/[\u2019']/g,'').replace(/[^a-z0-9\xa3 ]+/g,' ').replace(/\s+/g,' ').trim(),n=new Set(['how','do','i','a','an','the','to','can','my','our','we','is','it','of','for','in','on','and','what','where','please','me','you','with']),o=o=>t(o).split(' ').filter(t=>t&&!n.has(t));function l(t,n,o=2){if(Math.abs(t.length-n.length)>o)return o+1;let l=Array.from({length:n.length+1},(t,n)=>n);for(let i=1;i<=t.length;i++){const s=[i];let h=i;for(let o=1;o<=n.length;o++)s[o]=Math.min(l[o]+1,s[o-1]+1,l[o-1]+(t[i-1]===n[o-1]?0:1)),h=Math.min(h,s[o]);if(h>o)return o+1;l=s}return l[n.length]}function i(t,n){if(t===n)return 1;if(t.length>=3&&n.startsWith(t))return.8;if(n.length>=4&&t.startsWith(n))return.7;if(t.length>=4){if(l(t,n,t.length>=7?2:1)<=(t.length>=7?2:1))return.6}return 0}function s(t,n){let o=0;for(const l of t){let t=0;for(const o of n)if(t=Math.max(t,i(l,o)),1===t)break;o+=t}return o}},1062,[]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"staffMay",{enumerable:!0,get:function(){return h}}),_e.noMoney=b,Object.defineProperty(_e,"hasMoney",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"moneySafe",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"RISK_LABEL",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"needsConfirm",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"demoOnly",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"PAGES",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"tableName",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"ACTIONS",{enumerable:!0,get:function(){return M}}),Object.defineProperty(_e,"actionById",{enumerable:!0,get:function(){return T}}),_e.toolSpecs=function(){const e=e=>({type:'integer'===e.type?'integer':'string',description:e.description,...e.enum?{enum:e.enum}:{}});return M.map(t=>({type:'function',function:{name:t.id,description:`${t.description} [${k[t.risk]}${v(t.risk)?'; the app asks the manager to confirm':''}]`,parameters:{type:'object',properties:Object.fromEntries(t.params.map(t=>[t.name,e(t)])),required:t.params.filter(e=>e.required).map(e=>e.name)}}}))},_e.runAction=async function(e,t,a,s=!1){const r=T(e);if(!r)return{status:'error',message:`Unknown action ${e}`};if(('staff'===a.app||'staff'===a.role)&&!h(r))return{status:'error',message:'That isn\u2019t available in the Staff app. Ask a manager.'};if(r.apps&&a.app&&!r.apps.includes(a.app))return{status:'error',message:'That isn\u2019t available in this app.'};const n=r.params.filter(e=>e.required&&(void 0===t[e.name]||''===t[e.name])).map(e=>e.name);if(n.length)return{status:'error',message:`Missing ${n.join(', ')}`};if(v(r.risk)&&!s)return{status:'needs_confirmation',preview:r.preview(t,a),risk:r.risk};if(S(r.risk)){const e=String(await r.run(t,a));return'send'===r.risk||'pay'===r.risk?(l.useDrafts.getState().add({rid:a.rid,kind:'pay'===r.risk?'payment':'message',title:r.title,lines:[r.preview(t,a)],by:a.who??'Assistant',app:a.app??'owner'}),{status:'demo_only',message:`${e} Saved as a draft for the owner to approve.`}):{status:'demo_only',message:e}}try{const e=String(await r.run(t,a));return{status:'done',message:y(a.app,a.role)?b(e):e}}catch(e){return{status:'error',message:e.message}}},_e.extract=x,_e.matchIntent=function(e,t,a={}){const s=` ${(e=(0,f.normaliseHeard)(e)).toLowerCase()} `,r=(0,p.tokens)(e),n=/\b(how|where|what|why|can i|help)\b/.test(s);let i=null;const o=a.app??'owner';for(const e of M){if('show_me'===e.id||'open_screen'===e.id)continue;if(e.apps&&!e.apps.includes(o))continue;if('staff'===o&&!h(e))continue;let t=0;if(e.match)t=e.match(s);else for(const a of e.keywords)s.includes(a)&&(t+=a.includes(' ')?2:1);'add_rota_shift'!==e.id||s.includes('shift')||s.includes('rota')||(t=0),'add_walkin'!==e.id||/walk|seat|arriv/.test(s)||(t=0),t>(i?.s??0)&&(i={a:e,s:t})}if(i&&i.s>=1&&(!n||'look'===i.a.risk||i.s>=3))return{kind:'action',action:i.a,params:i.a.parse?i.a.parse(e,{rid:a.rid??'',today:t,app:o,whoId:a.whoId}):x(e,t),score:i.s};if('owner'!==o){const t=(0,p.searchHelp)(d.HELP,e,3);return t.length?{kind:'help',ids:t.map(e=>e.a.id)}:{kind:'none'}}const l=s.match(/\b(?:open|show|go to|take me to)\s+(.+?)\s*$/);if(l){const e=_.find(e=>e.words.some(e=>l[1].includes(e)));if(e)return{kind:'action',action:T('open_screen'),params:{screen:e.title},score:2}}const c=(0,p.searchHelp)(d.HELP,e,3);return c.length?{kind:'help',ids:c.map(e=>e.a.id)}:(r.length,{kind:'none'})};var e=_r(_d[0]),t=_r(_d[1]),a=_r(_d[2]),s=_r(_d[3]),r=_r(_d[4]),n=_r(_d[5]),i=_r(_d[6]),o=_r(_d[7]),d=_r(_d[8]),p=_r(_d[9]),l=_r(_d[10]),c=_r(_d[11]),u=_r(_d[12]),f=_r(_d[13]);const h=e=>!e.apps||e.apps.includes('staff'),m=/\xa3|\btips?\b|\btronc\b|\btakings\b|\bwages?\b|\bsalar(y|ies)\b|\bpay(slip|roll)?\b|\bsales\b|\brevenue\b|\bdisciplinar|\bsick(ness)? (leave|pay)\b/i;function b(e){const t=e.split(/(?<=[.!?])\s+/).filter(e=>!m.test(e));return t.length?t.join(' '):'That isn\u2019t shown here. Ask a manager in the Managers app.'}const w=e=>m.test(e),y=(e,t)=>'display'===e||'staff'===e||'staff'===t,k={look:'Looks something up',navigate:'Opens a screen',change:'Changes something in the app',draft:'Saves a DRAFT for the owner to approve (nothing is sent or bought)',send:'SENDS to someone',pay:'PAYS money',delete:'DELETES something'},v=e=>'change'===e||'draft'===e||'send'===e||'pay'===e||'delete'===e,S=e=>'send'===e||'pay'===e||'delete'===e,$=e=>(r.useOwner.getState().staff.find(t=>t.id===e)?.name??'someone').replace(' (example)',''),O=e=>{const[t,a,s]=e.split('-').map(Number);return new Date(t,a-1,s).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'})},I=e=>{const t=(Math.round(60*e)%1440+1440)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`},_=[{page:'lookback',tab:'more',title:'Look back',words:['look back','booking history']},{page:'serviceboard',tab:'more',title:'Restaurant dashboard',words:['restaurant dashboard','dashboard']},{page:'',tab:'bookings',title:'Bookings',words:['bookings','reservations','diary']},{page:'',tab:'orders',title:'Orders',words:['orders','takeaway','tickets']},{page:'rota',tab:'more',title:'Rota',words:['rota','shifts','schedule']},{page:'signoff',tab:'more',title:'Sign off hours',words:['sign off','signoff','approve hours']},{page:'hours',tab:'more',title:'Payroll hours',words:['payroll hours','payroll','hours export']},{page:'tipsday',tab:'more',title:'Tips day',words:['tips day','tips','tronc']},{page:'tableplan',tab:'more',title:'Table plan',words:['table plan','floor plan','layout']},{page:'suppliers',tab:'more',title:'Suppliers',words:['suppliers','supplier']},{page:'recipecards',tab:'more',title:'Recipe cards',words:['recipe cards','recipes']},{page:'displays',tab:'more',title:'Displays',words:['displays','tablets','pairing']},{page:'paysettings',tab:'more',title:'Pay & tips settings',words:['pay settings','pay dates','payday']},{page:'connections',tab:'more',title:'Connected accounts',words:['connected accounts','connections','accounts']},{page:'help',tab:'more',title:'Help & tutorials',words:['help','tutorials']}],N=['owner'],C=['zero','one','two','three','four','five','six','seven','eight','nine','ten','eleven','twelve','thirteen','fourteen','fifteen','sixteen','seventeen','eighteen','nineteen','twenty'],P=e=>{const t=String(e??'').replace(/^table\s+/i,'').trim(),a=C.indexOf(t.toLowerCase());return a>0?String(a):t};function A(e,a){if(!e||null==a||''===a)return'';const s=P(a),r=i.useFloor.getState().live[e]??{},n=Object.keys(r).find(e=>e.toLowerCase()===s.toLowerCase()||e.toLowerCase()===`t${s}`.toLowerCase()),o=n?r[n]:void 0;return o?o.blocked?`. ${(0,t.tableNumbers)(s)} is marked blocked`:o.dirty?`. ${(0,t.tableNumbers)(s)} still needs clearing`:o.stage?`. ${(0,t.tableNumbers)(s)} already has people seated`:'':''}const M=[...e.HISTORY_VOICE_ACTIONS,{id:'open_screen',apps:N,title:'Open a screen',description:'Navigate to a screen of the Managers app.',risk:'navigate',params:[{name:'screen',type:'string',required:!0,description:'Screen to open',enum:_.map(e=>e.title)}],keywords:['open','go to','take me','show','where is'],preview:e=>`Open ${e.screen}`,run:(e,t)=>{const a=_.find(t=>t.title===e.screen);return a?(t.go(a.tab,a.page||null),`Opened ${a.title}.`):'I couldn\u2019t find that screen.'}},{id:'show_me',apps:N,title:'Show me how',description:'Open the screen for a help guide and highlight the control to tap.',risk:'navigate',params:[{name:'guide',type:'string',required:!0,description:'Help article id',enum:d.HELP.filter(e=>e.showMe).map(e=>e.id)}],keywords:['how do i','how to','show me','where do i','help'],preview:e=>`Show me: ${(0,d.helpById)(String(e.guide))?.title??''}`,run:(e,t)=>{const a=(0,d.helpById)(String(e.guide));return a?.showMe?(t.go(a.showMe.tab,a.showMe.page??null),setTimeout(()=>o.useCoach.getState().show(a.showMe.target,a.showMe.hint),250),`Here\u2019s where: ${a.showMe.hint}`):'No guide for that.'}},{id:'add_walkin',title:'Add a walk-in',description:'Seat a walk-in party now, optionally at a table.',risk:'change',form:!0,params:[{name:'covers',type:'integer',required:!0,description:'Number of covers (1\u201330)'},{name:'table',type:'string',description:'Table name, if known'}],keywords:['walk-in','walkin','walk in','seat','just arrived','no booking'],match:e=>/\bwalk-in\b/.test(e)&&!/\b(fridges?|freezers?|cold room|degrees|temps?|temperatures?|probe|minus|how long|wait|waiting|waitlist|how many|undo|remove|cancel)\b/.test(e)||/\b(seat|sit)\b/.test(e)&&/\b(just arrived|no booking)\b/.test(e)?9:/\b(just arrived|no booking)\b/.test(e)?3:/\b(seat|sit)\b/.test(e)?1:0,parse:e=>{const t={},a=(0,f.walkInCovers)(e);a&&(t.covers=a);const s=(0,f.tableSaid)(e);return s&&(t.table=s),t},preview:(e,t)=>`Seat a walk-in of ${e.covers} cover${1===Number(e.covers)?'':'s'}${e.table?` at table ${P(e.table)}`:' (table to assign)'}${A(t?.rid,e.table)}`,run:async(e,t)=>{const a=Number(e.covers);return a>=1&&a<=30?(await n.repo.bookings.seatWalkIn(t.rid,a,e.table?P(e.table):void 0,'Added by Assistant'),`Done: walk-in of ${a} seated${e.table?` at table ${P(e.table)}`:''}. It\u2019s in Bookings now.`):'Covers must be between 1 and 30. Say for example \u201cwalk-in of 2 at table 4\u201d.'}},{id:'add_rota_shift',apps:N,title:'Add a rota shift',description:'Add a DRAFT shift for one person (staff see it only after the week is published).',risk:'change',form:!0,params:[{name:'staffId',type:'string',required:!0,description:'Staff member id'},{name:'date',type:'date',required:!0,description:'YYYY-MM-DD'},{name:'start',type:'time',required:!0,description:'Start hour, e.g. 17 or 17.5'},{name:'end',type:'time',required:!0,description:'End hour, e.g. 23'}],keywords:['shift','rota','put','add','schedule','on'],preview:e=>`Add a draft shift: ${$(e.staffId)}, ${e.date?O(String(e.date)):'?'}, ${I(Number(e.start))}\u2013${I(Number(e.end))}`,run:e=>{const t=Number(e.start),a=Number(e.end);return e.staffId&&e.date&&a>t?(r.useOwner.getState().addShift({staffId:String(e.staffId),date:String(e.date),start:t,end:a}),`Done: draft shift for ${$(e.staffId)} on ${O(String(e.date))} (${(0,r.weekdayOf)(String(e.date))>=0?'publish the week when ready':''}).`):'That shift isn\u2019t complete.'}},{id:'publish_rota',apps:N,title:'Publish the rota',description:'Make the week\u2019s draft shifts visible to staff (they\u2019re told in the app).',risk:'send',params:[],keywords:['publish','send rota','release rota'],preview:()=>'Publish this week\u2019s rota so staff are notified in the Staff app',run:()=>'Nothing was published or sent. Open the Rota and tap Publish yourself when you\u2019re ready.'},{id:'message_staff',apps:N,title:'Message the team',description:'Post a message to staff chat.',risk:'send',params:[{name:'text',type:'string',required:!0,description:'Message'}],keywords:['message','tell the team','text staff','announce'],preview:e=>`Send to All staff: \u201c${e.text??''}\u201d`,run:()=>'Nothing was sent.'},{id:'pay_tips',apps:N,title:'Pay out tips',description:'Pay each person their tips share.',risk:'pay',params:[],keywords:['pay tips','pay out','transfer','pay staff'],preview:()=>'Pay out this fortnight\u2019s tips',run:()=>'CoverCharge never moves money. Use Tips day to work out the split, then pay through your payroll.'},{id:'remove_shift',apps:N,title:'Remove a shift',description:'Delete a rota shift.',risk:'delete',params:[{name:'staffId',type:'string',description:'Staff member id'},{name:'date',type:'date',description:'YYYY-MM-DD'}],keywords:['remove shift','delete shift','cancel shift','take off'],preview:e=>`Delete ${$(e.staffId)}\u2019s shift${e.date?` on ${O(String(e.date))}`:''}`,run:()=>'Nothing was deleted. Open the Rota and tap the shift to remove it yourself.'},...c.VOICE_ACTIONS,...u.STAFF_VOICE_ACTIONS,...a.OPS_VOICE_ACTIONS,...s.GAP_VOICE_ACTIONS],T=e=>M.find(t=>t.id===e);const j={one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12},D=['monday','tuesday','wednesday','thursday','friday','saturday','sunday'];function E(e){const t=e.match(/^(\d{1,2})(?::(\d{2}))?\s*(am|pm)?$/);if(!t)return null;let a=Number(t[1]);const s=Number(t[2]??0);return'pm'===t[3]&&a<12&&(a+=12),'am'===t[3]&&12===a&&(a=0),!t[3]&&a>=1&&a<=7&&(a+=12),a>24||s>59?null:a+s/60}function x(e,t){const a=` ${e.toLowerCase().replace(/\u2019/g,"'")} `,s={},n=a.match(/(?:for|of|party of|x)\s+(\d{1,2}|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)\b/)??a.match(/\b(\d{1,2})\s*(?:covers|people|guests|pax|persons)\b/);n&&(s.covers=j[n[1]]??Number(n[1]));const i=a.match(/\btable\s+([a-z]?\d{1,3}[a-z]?)\b/);i&&(s.table=i[1].toUpperCase()),/\btomorrow\b/.test(a)?s.date=(0,r.addDays)(t,1):/\btoday\b|\btonight\b/.test(a)&&(s.date=t);const o=a.match(/\b(\d{1,2})\/(\d{1,2})(?:\/(\d{2,4}))?\b/);if(o){const e=o[3]?2===o[3].length?2e3+Number(o[3]):Number(o[3]):Number(t.slice(0,4));s.date=`${e}-${o[2].padStart(2,'0')}-${o[1].padStart(2,'0')}`}const d=D.findIndex(e=>a.includes(` ${e}`)||a.includes(` ${e.slice(0,3)} `));if(!s.date&&d>=0){const e=(0,r.weekdayOf)(t);s.date=(0,r.addDays)(t,(d-e+7)%7||7)}const p=a.match(/(\d{1,2}(?::\d{2})?\s*(?:am|pm)?)\s*(?:-|\u2013|to|till|until)\s*(\d{1,2}(?::\d{2})?\s*(?:am|pm)?)/);if(p){const e=E(p[1].trim()),t=E(p[2].trim());null!==e&&null!==t&&(s.start=e,s.end=t<=e?t+12:t)}const l=r.useOwner.getState().staff.filter(e=>e.active).find(e=>(0,r.staffCalls)(e).some(e=>e.length>2&&/^[a-z' -]+$/.test(e)&&new RegExp(`\\b${e}\\b`).test(a)));return l&&(s.staffId=l.id),s}},1063,[1466,808,1467,1468,854,819,825,957,1061,1062,1064,1469,1470,1124]); +__d(function(g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DRAFT_LABEL",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"useDrafts",{enumerable:!0,get:function(){return f}});var e,t=r(_d[0]),s=(e=t)&&e.__esModule?e:{default:e},d=r(_d[1]),n=r(_d[2]);const o={booking:'Booking',shopping:'Shopping list',offer:'Offer',event:'Event',special:'Special',message:'Message',payment:'Payment',other:'Request'},f=(0,d.create)()((0,n.persist)((e,t)=>({drafts:[],add:t=>{const s={...t,id:`dr-${Date.now().toString(36)}${Math.random().toString(36).slice(2,6)}`,at:(new Date).toISOString(),status:'draft'};return e(e=>({drafts:[s,...e.drafts].slice(0,300)})),s},addToList:(s,d,n,o,f)=>{const p=t().drafts.find(e=>e.rid===s&&'shopping'===e.kind&&e.supplier===d&&'draft'===e.status);if(p){const t={...p,lines:[...p.lines,...n]};return e(e=>({drafts:e.drafts.map(e=>e.id===p.id?t:e)})),t}return t().add({rid:s,kind:'shopping',supplier:d,title:('bidfood'===d?'Bidfood':'Booker')+" shopping list",lines:n,by:o,app:f})},decide:(t,s,d)=>e(e=>({drafts:e.drafts.map(e=>e.id===t?{...e,status:s,decidedBy:d,decidedAt:(new Date).toISOString()}:e)}))}),{name:'covercharge-drafts-v1',version:1,storage:(0,n.createJSONStorage)(()=>s.default)}))},1064,[1024,1008,1025]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useShiftNotes",{enumerable:!0,get:function(){return c}});var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},s=r(d[1]),o=r(d[2]);const c=(0,s.create)()((0,o.persist)(e=>({notes:[],add:t=>e(e=>({notes:[Object.assign({},t,{id:'sn-'+Date.now().toString(36),at:(new Date).toISOString()}),...e.notes].slice(0,300)})),setDone:(t,n)=>e(e=>({notes:e.notes.map(e=>e.id===t?Object.assign({},e,{done:n}):e)}))}),{name:'covercharge-shiftnotes-v1',version:1,storage:(0,o.createJSONStorage)(()=>n.default)}))},1065,[1024,1008,1025]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"VOICE_ROLES",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"VOICE_ROLE_LABEL",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"useVoiceSettings",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"voiceOn",{enumerable:!0,get:function(){return f}}),_e.micExplainedFor=function(e){try{if('1'===b()?.getItem(s(e)))return!0}catch{}return u.getState().micExplained},_e.setMicExplainedFor=function(e){try{b()?.setItem(s(e),'1')}catch{}u.getState().setMicExplained(!0)};var e,n=r(d[0]),t=(e=n)&&e.__esModule?e:{default:e},c=r(d[1]),l=r(d[2]);const o=['owner','manager','staff','chef','display'],p={owner:'Owner (Managers app)',manager:'Managers (Managers app)',staff:'Staff app (full voice assistant, no money or HR)',chef:'Head Chef app',display:'Main Display'},u=(0,c.create)()((0,l.persist)(e=>({enabled:{},micExplained:!1,setEnabled:(n,t,c)=>e(e=>({enabled:{...e.enabled,[n]:{...e.enabled[n]??{},[t]:c}}})),setMicExplained:n=>e({micExplained:n})}),{name:'covercharge-voice-v1',version:4,storage:(0,l.createJSONStorage)(()=>t.default),migrate:(e,n)=>({enabled:n<2?{}:e?.enabled??{},micExplained:!!e?.micExplained}),merge:(e,n)=>({...n,enabled:e?.enabled??n.enabled,micExplained:e?.micExplained??n.micExplained}),partialize:e=>({enabled:e.enabled,micExplained:e.micExplained})})),f=(e,n,t)=>!1!==e[n]?.[t],s=e=>`cc-voice-mic-explained-${e}`,b=()=>{try{return'undefined'!=typeof window?window.localStorage:void 0}catch{return}}},1066,[1024,1008,1025]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"desktopStt",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"desktopSttState",{enumerable:!0,get:function(){return u}}),_e.warmDesktopStt=function(){o()&&l()},Object.defineProperty(_e,"cleanHeard",{enumerable:!0,get:function(){return d}}),Object.defineProperty(_e,"tabletWithoutMic",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"canRecord",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"canListen",{enumerable:!0,get:function(){return w}}),_e.micPermission=b,Object.defineProperty(_e,"RATE",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"PRE_ROLL_MS",{enumerable:!0,get:function(){return M}}),Object.defineProperty(_e,"HANG_MS",{enumerable:!0,get:function(){return A}}),_e.releaseMic=O,Object.defineProperty(_e,"echoWanted",{enumerable:!0,get:function(){return R}}),Object.defineProperty(_e,"micConstraints",{enumerable:!0,get:function(){return j}}),_e.warmMic=async function(){try{if(o()||!y())return;if(!S&&'granted'!==await b())return;if(await D(),C){C.armedUntil=Date.now()+1500;try{C.ctx.resume?.()}catch{}}x()}catch{}},_e.disarmMic=function(){C&&!C.rec&&(C.armedUntil=0,C.ring=[],C.ringLen=0)},_e.askMic=async function(){try{return await D(),x(),!0}catch{return!1}},_e.wavOf=L,Object.defineProperty(_e,"MAX_CLIP_MS",{enumerable:!0,get:function(){return _}}),_e.listen=B,Object.defineProperty(_e,"CloudRecognition",{enumerable:!0,get:function(){return I}}),Object.defineProperty(_e,"speechRecognizer",{enumerable:!0,get:function(){return N}}),_e.levelMeter=async function(e){const t=n()?.navigator?.mediaDevices,r=n()?.AudioContext||n()?.webkitAudioContext;if(!t?.getUserMedia||!r)return()=>{};let o,i,a=0,c=!1;try{if(o=await t.getUserMedia({audio:!0}),c)return o.getTracks().forEach(e=>e.stop()),()=>{};i=new r;const s=i.createMediaStreamSource(o),u=i.createAnalyser();u.fftSize=512,s.connect(u);const l=new Uint8Array(u.fftSize),d=()=>{u.getByteTimeDomainData(l);let t=0;for(let e=0;e{}}return()=>{c=!0;try{n().cancelAnimationFrame(a)}catch{}try{o?.getTracks().forEach(e=>e.stop())}catch{}try{i?.close()}catch{}}},_e.yesNo=function(e){const t=e.toLowerCase().trim().replace(/[.!,]/g,'');return/^(yes|yeah|yep|yup|aye|confirm|confirmed|do it|go ahead|correct|that's right|ok|okay|yes please)\b/.test(t)?'yes':/^(no|nope|cancel|stop|don't|do not|wrong|never mind)\b/.test(t)?'no':null},Object.defineProperty(_e,"buzz",{enumerable:!0,get:function(){return W}});var e=_r(_d[0]),t=_r(_d[1]);const n=()=>'undefined'==typeof window?void 0:window,r=()=>n()?.ccDesktop,o=()=>!!r()?.stt&&!!r()?.sttWorker;let i=null,a=0;const c=new Map;let s='cold';const u=()=>s;function l(){if(i)return i;const e=n()?.Worker,t=r()?.sttWorker;return e&&t?(i=new e(t,{type:'module'}),s='loading',i.onmessage=e=>{const t=e.data??{};if(t.ready)return void(s='ready');t.failed&&(s='failed');const n=c.get(t.id);n&&(c.delete(t.id),n(t))},i.onerror=()=>{s='failed',c.forEach(e=>e({error:'stt-failed'})),c.clear()},i.postMessage({warm:!0}),i):null}const d=e=>e.replace(/\[[^\]]*\]|\([^)]*\)/g,' ').replace(/\s+/g,' ').trim();function f(e,t){let o,i,s,u,f=!1,p=!1;const y=[];let w=16e3;const b=()=>{try{s?.disconnect(),u?.disconnect()}catch{}try{o?.getTracks().forEach(e=>e.stop())}catch{}try{i?.close()}catch{}if(p)return;const n=y.reduce((e,t)=>e+t.length,0);if(n<.35*w)return void t('');const r=new Float32Array(n);let f=0;for(const e of y)r.set(e,f),f+=e.length;const b=16e3===w?r:h(r,w,16e3),v=l();if(!v)return void t('','stt-failed');e('Turning speech into text on this Mac\u2026');const M=++a;c.set(M,e=>t(d(e.text??''),e.error)),v.postMessage({id:M,audio:b},[b.buffer])};return(async()=>{try{if(r()?.askMic){if(!await r().askMic())return void t('','not-allowed')}if(o=await n().navigator.mediaDevices.getUserMedia({audio:{channelCount:1,echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0}}),f)return void b();const e=n().AudioContext||n().webkitAudioContext;try{i=new e({sampleRate:16e3})}catch{i=new e}w=i.sampleRate,u=i.createMediaStreamSource(o),s=i.createScriptProcessor(4096,1,1),s.onaudioprocess=e=>{f||y.push(new Float32Array(e.inputBuffer.getChannelData(0)))},u.connect(s),s.connect(i.destination),l()}catch(e){t('','NotAllowedError'===e?.name?'not-allowed':'audio-capture')}})(),{stop:()=>{f||(f=!0,b())},abort:()=>{p=!0,f=!0,b()}}}function h(e,t,n){const r=Math.round(e.length*n/t),o=new Float32Array(r),i=t/n;for(let t=0;t{const e=String(n()?.navigator?.userAgent??'');return/CoverChargeTablet\//.test(e)&&!/CoverChargeTablet\/[\d.]+ mic/.test(e)},y=()=>!p()&&!(!n()?.MediaRecorder||!n()?.navigator?.mediaDevices?.getUserMedia),w=()=>o()||y();async function b(){try{const e=n()?.navigator?.permissions?.query;if(!e)return'unknown';const t=await Promise.race([n().navigator.permissions.query({name:'microphone'}),new Promise(e=>setTimeout(()=>e(null),1500))]);return'granted'===t?.state||'denied'===t?.state||'prompt'===t?.state?t.state:'unknown'}catch{return'unknown'}}const v=16e3,M=500,A=450;let P,S=null,T=!1,k=!1,C=null;function U(){const e=C;if(C=null,e){try{e.node.disconnect(),e.src.disconnect()}catch{}try{e.ctx.close()}catch{}e.ring=[],e.rec=null}}function O(){clearTimeout(P),U();try{S?.getTracks().forEach(e=>e.stop())}catch{}S=null}const x=()=>{clearTimeout(P),P=setTimeout(O,/iPhone|iPad|iPod|Macintosh/.test(String(n()?.navigator?.userAgent??''))&&!r()?.mac?6e5:6e4)},R=()=>!1,j=(e=R())=>({audio:{channelCount:{ideal:1},sampleRate:{ideal:v},sampleSize:{ideal:16},echoCancellation:e,noiseSuppression:!0,autoGainControl:!0}});async function D(){clearTimeout(P);const e=R();if(S&&T===e&&S.getAudioTracks().some(e=>'live'===e.readyState))return S;if(S&&O(),S=await n().navigator.mediaDevices.getUserMedia(j(e)),T=e,!k){k=!0;try{n().document.addEventListener('visibilitychange',()=>{'hidden'===n().document.visibilityState&&O()})}catch{}}return E(S),S}function E(e){U();try{const t=n().AudioContext||n().webkitAudioContext;if(!t)return;let r;try{r=new t({sampleRate:v})}catch{r=new t}const o=r.createMediaStreamSource(e),i=r.createScriptProcessor(2048,1,1),a={ctx:r,node:i,src:o,rate:r.sampleRate,ring:[],ringLen:0,rec:null,frames:0,armedUntil:0,level:()=>{}},c=Math.round(.5*a.rate);i.onaudioprocess=e=>{const t=new Float32Array(e.inputBuffer.getChannelData(0));if(a.frames+=t.length,a.rec&&a.rec.push(t),!a.rec&&Date.now()>a.armedUntil)return a.ring=[],void(a.ringLen=0);for(a.ring.push(t),a.ringLen+=t.length;a.ring.length>1&&a.ringLen-a.ring[0].length>=c;)a.ringLen-=a.ring[0].length,a.ring.shift();let n=0;for(let e=0;ee+t.length,0),r=new Float32Array(n);let o=0;for(const t of e)r.set(t,o),o+=t.length;const i=t===v?r:h(r,t,v),a=new ArrayBuffer(44+2*i.length),c=new DataView(a),s=(e,t)=>{for(let n=0;n{clearTimeout(c),clearTimeout(s),S&&(S.rec=null,S.level=()=>{}),x()},k=(e,t,n)=>{h||f||(h=!0,o(e,t,n))};let U=!1;const O=async()=>{if(U)return;U=!0;const n=b,o=S?S.frames-P:0;if(T(),f)return;const i=Date.now()-y,a=!!n&&n.length>0&&o/M*1e3>.6*i?L(n,M):new Blob(w,{type:(p?.mimeType||w[0]?.type||'audio/webm').split(';')[0]});if(i<350||a.size<500)return void k('');r('Turning speech into text\u2026');const c=await(0,e.transcribe)(t,a);c.ok?k(c.text.trim(),void 0,{receipt:c.receipt}):k('',c.reason,{message:c.text})};(async()=>{try{const e=await D();if(d)return T(),void k('');if(S=C,S){try{S.ctx.resume?.()}catch{}b=[...S.ring],M=S.rate,P=S.frames-S.ringLen,S.rec=b,S.level=e=>{i?.(e),a&&!d&&(e>.12?(u=!0,l=0):u&&e<.05&&(l=l||Date.now(),Date.now()-l>1500&&j()))}}const t=F();p=new(n().MediaRecorder)(e,t?{mimeType:t,audioBitsPerSecond:48e3}:void 0),p.ondataavailable=e=>{e.data?.size&&w.push(e.data)},p.onstop=()=>{O()},p.onerror=()=>{b?.length?O():(T(),k('','audio-capture'))},p.start(),y=Date.now(),c=setTimeout(()=>{r('That\u2019s the 30-second limit. Sending now\u2026'),R()},_)}catch(e){T(),k('','NotAllowedError'===e?.name||'SecurityError'===e?.name?'not-allowed':'audio-capture')}})();const R=()=>{try{p&&'inactive'!==p.state?p.stop():O()}catch{O()}},j=()=>{d||(d=!0,p&&(s=setTimeout(R,a?0:A)))};return{stop:j,abort:()=>{f=!0,d=!0,clearTimeout(s);try{p&&'inactive'!==p.state&&p.stop()}catch{}T()}}}function B(e,t,n="owner",r,i=!1){return o()?f(e,t):y()?z(n,e,t,r,i):null}class I{lang='en-GB';interimResults=!1;continuous=!1;maxAlternatives=1;onresult=null;onerror=null;onend=null;l=null;start(){const e='customer'===t.APP_VARIANT?'owner':t.APP_VARIANT;if(this.l=B(()=>{},(e,t)=>{if(this.l=null,t)this.onerror?.({error:t});else if(e){const t=Object.assign([{transcript:e,confidence:1}],{isFinal:!0});this.onresult?.({resultIndex:0,results:[t]})}this.onend?.()},e,void 0,!0),!this.l)throw new Error('not-supported')}stop(){this.l?.stop()}abort(){const e=this.l;this.l=null,e?.abort(),e&&this.onend?.()}}const N=()=>w()?I:null;const W=(e=30)=>{try{n()?.navigator?.vibrate?.(e)}catch{}}},1067,[1123,806]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useVoiceKeys",{enumerable:!0,get:function(){return e}}),_e.installVoiceKeys=function(){if('undefined'==typeof window||!window.addEventListener)return()=>{};let n=!1;const o=o=>(o.metaKey||o.ctrlKey)&&o.shiftKey&&'g'===o.key.toLowerCase()?(o.preventDefault(),void(o.repeat||e.getState().send('toggle'))):!o.metaKey&&!o.ctrlKey||o.shiftKey||'/'!==o.key?void('Space'!==o.code||o.metaKey||o.ctrlKey||o.altKey||t(o.target)||(o.preventDefault(),o.repeat||n||(n=!0,e.getState().send('start')))):(o.preventDefault(),void e.getState().send('type')),s=t=>{'Space'===t.code&&n&&(t.preventDefault(),n=!1,e.getState().send('stop'))},l=()=>{n&&(n=!1,e.getState().send('stop'))};return window.addEventListener('keydown',o,!0),window.addEventListener('keyup',s,!0),window.addEventListener('blur',l),()=>{window.removeEventListener('keydown',o,!0),window.removeEventListener('keyup',s,!0),window.removeEventListener('blur',l)}};const e=(0,r(d[0]).create)((e,t)=>({last:null,send:n=>e({last:{cmd:n,n:(t().last?.n??0)+1}})})),t=e=>{const t=e?.tagName;return'INPUT'===t||'TEXTAREA'===t||'SELECT'===t||!!e?.isContentEditable}},1068,[1008]); +__d(function(g,_r,_i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useSoldOutLinks",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"isAutoLink",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"autoSync",{enumerable:!0,get:function(){return v}}),_e.itemsFor=b,_e.dishUsesFor=p,_e.countsFor=O,_e.reasonFor=function(e,t,n){const s=n??p(e).find(e=>e.id===t)?.uses??[],r=O(e),i=c.useStore.getState().menu.find(e=>e.id===t)?.name??'';return(0,u.dishReason)(i,(0,u.shortOf)(s,r),r,b(e))},_e.runAutoSoldOut=y,_e.startAutoSoldOut=function(){if(w)return w;let e=null;const t=()=>{e||(e=setTimeout(()=>{e=null,y()},400))},n=[d.useShellStore.subscribe((e,n)=>{e.events===n.events&&e.server===n.server&&e.items===n.items||t()}),h.subscribe(t),S.useCardStore.subscribe((e,n)=>{e.cards!==n.cards&&t()}),c.useStore.subscribe((e,n)=>{e.menu===n.menu&&e.restaurants===n.restaurants||t()}),f.useSoldOut.subscribe((e,n)=>{e.entries!==n.entries&&t()})],s=setInterval(t,6e4);return t(),w=()=>{n.forEach(e=>e()),clearInterval(s),e&&clearTimeout(e),w=null},w},_e.useAutoSoldOutView=function(e){const t=(0,c.useStore)(e=>e.menu),n=h(e=>e.links),s=(0,S.useCardStore)(e=>e.cards),r=(0,d.useShellStore)(t=>t.items[e]);(0,d.useShellStore)(e=>e.events),(0,d.useShellStore)(t=>t.server[e]);const i=(r??[]).filter(e=>e.active).map(e=>({key:e.key,name:e.name,plural:e.plural,unit:e.unit,active:e.active})),o=p(e,t,n,s,i),l=O(e);return{dishes:o,counts:l,items:i,reason:e=>{const t=o.find(t=>t.id===e);return t?(0,u.dishReason)(t.name,(0,u.shortOf)(t.uses,l),l,i):''},links:n}};var e,t=_r(_d[0]),n=(e=t)&&e.__esModule?e:{default:e},s=_r(_d[1]),r=_r(_d[2]),u=_r(_d[3]),i=_r(_d[4]),o=_r(_d[5]),l=_r(_d[6]),c=_r(_d[7]),d=_r(_d[8]),S=_r(_d[9]),f=_r(_d[10]);const m=()=>{try{return(0,c.nowFrom)(c.useStore.getState().clock)}catch{return new Date}},h=(0,s.create)()((0,r.persist)(e=>({links:[],setLink:(t,n,s,r)=>e(e=>{const u=e.links.filter(e=>!(e.rid===t&&e.itemId===n));return{links:[...u,{rid:t,itemId:n,uses:s?s.filter(e=>e.qty>0).slice(0,10):[],at:m().toISOString(),by:r.slice(0,80),...s?{}:{auto:!0}}]}})}),{name:'covercharge-soldout-links-v1',version:1,storage:(0,r.createJSONStorage)(()=>n.default)})),k=e=>!!e&&!0===e.auto,v={soldOutRead:new Set,linksRead:new Set};function b(e){return(d.useShellStore.getState().items[e]??[]).filter(e=>e.active).map(e=>({key:e.key,name:e.name,plural:e.plural,unit:e.unit,active:e.active}))}function p(e,t=c.useStore.getState().menu,n=h.getState().links,s=S.useCardStore.getState().cards,r=b(e)){const i=[];for(const o of t){if(o.restaurantId!==e||o.hidden)continue;const t=s.find(t=>t.restaurantId===e&&t.menuItemId===o.id),l=n.find(t=>t.rid===e&&t.itemId===o.id),c=(0,u.inferUses)(o,t,r),d=k(l)?c:(0,u.usesFor)(o,l,t,r);i.push({id:o.id,name:o.name,uses:d.uses,source:d.source,guess:c.uses})}return i}function O(e){return(0,d.venueCounts)(d.useShellStore.getState(),e)}function I(e){const t={};for(const n of d.useShellStore.getState().events)n.rid===e&&(!t[n.kind]||n.at>t[n.kind])&&(t[n.kind]=n.at);return t}function y(e=m()){const t=c.useStore.getState();let n=0;for(const s of t.restaurants){const t=s.id;if((0,o.liveData)()&&(!d.useShellStore.getState().server[t]||!v.soldOutRead.has(t)||!v.linksRead.has(t)))continue;const r=(0,i.soldOutSettingsOf)(s.settings?.soldOut).auto,l=p(t),c=(0,u.planAuto)({rid:t,enabled:r,dishes:l,counts:O(t),entries:f.useSoldOut.getState().entries,lastChange:I(t),now:e});if(!c.mark.length&&!c.clear.length)continue;const S=e.toISOString();f.useSoldOut.setState(e=>{const n=new Set(c.clear),s=new Map(c.mark.map(e=>[e.itemId,e.name])),r=e.entries.filter(e=>!(e.rid===t&&s.has(e.itemId))).map(e=>e.rid===t&&n.has(e.itemId)?{...e,on:!1,at:S,by:'Count back up',kept:!1,clearAfter:void 0}:e);return{entries:[...r,...c.mark.map(e=>({rid:t,itemId:e.itemId,name:e.name.slice(0,120),on:!0,at:S,by:'Live count',auto:!0,kept:!1}))]}}),n+=c.mark.length+c.clear.length}return n}let w=null;l.PITCH&&'undefined'!=typeof globalThis&&(globalThis.__pitchCounts=e=>{const t=c.useStore.getState().restaurants[0]?.id;if(!t)return;const n=O(t),s=m().toISOString(),r=Object.entries(e).filter(([e,t])=>(n[e]??0)!==t).map(([e,r],u)=>({id:`pitch-count-${Date.now()}-${u}`,rid:t,kind:e,delta:r-(n[e]??0),reason:'count',by:'Chef',app:'chef',at:s}));return r.length&&d.useShellStore.setState(e=>({events:[...e.events,...r]})),y()})},1069,[1024,1008,1025,1070,999,1053,2,870,1148,1119,946]); +__d(function(_g,r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.parseQty=i,_e.inferUses=u,_e.usesFor=function(e,t,n,o){const s=new Set(o.filter(e=>!1!==e.active).map(e=>e.key));return t?{uses:t.uses.filter(e=>s.has(e.key)&&e.qty>0),source:t.uses.length?'link':'none'}:u(e,n,o)},_e.shortOf=c,_e.shortReason=f,_e.dishReason=function(e,t,n,o){if(!t.length)return'';const i=e.replace(/\([^)]*\)/g,'').trim(),a=e=>{const t=o.find(t=>t.key===e);return!!t&&new RegExp(`\\b(${s(t)})$`,'i').test(i)},l=t.filter(e=>!a(e.key));return l.length?f(l,n,o):t.some(e=>(n[e.key]??0)>0)?'not enough left':'none left'},Object.defineProperty(_e,"withReason",{enumerable:!0,get:function(){return h}}),_e.usesText=function(e,t){return e.length?e.map(e=>{const n=t.find(t=>t.key===e.key),o=(n?.name??e.key).toLowerCase(),s=(n?.plural??`${o}s`).toLowerCase();return`${.5===e.qty?'\xbd':Number.isInteger(e.qty)?String(e.qty):`${Math.floor(e.qty)}\xbd`} ${e.qty>1?s:o}`}).join(', '):'Not linked to the counts'},_e.planAuto=function(e){const{rid:t,enabled:n,dishes:o,counts:s,entries:i,lastChange:a,now:l}=e,u={mark:[],clear:[]},f=new Map(i.filter(e=>e.rid===t).map(e=>[e.itemId,e])),h=l.getTime(),m=e=>e.on&&(!e.clearAfter||new Date(e.clearAfter).getTime()>h),d=new Set;for(const e of o){d.add(e.id);const t=f.get(e.id),o=n?c(e.uses,s):[];if(o.length){if(t&&m(t))continue;if(t&&t.kept){const e=o.map(e=>a[e.key]??'').sort().pop()??'';if(!e||e<=t.at)continue}u.mark.push({itemId:e.id,name:e.name})}else t&&t.auto&&m(t)&&u.clear.push(e.id)}for(const e of f.values())e.auto&&m(e)&&!d.has(e.itemId)&&u.clear.push(e.itemId);return u};const e='meat|bisque|stock|cakes?|claws?|sauce|butter|oil|paste|salad|mayo|mayonnaise|thermidor|tails?|bon|croquettes?|p\xe2t\xe9|pate|rolls?|soup|linguine|ravioli',t=/^(g|kg|gram|grams|ml|l|litre|litres|oz|lb|lbs|cl)$/i,n={a:1,an:1,one:1,two:2,three:3,four:4,five:5,six:6,half:.5,'\xbd':.5},o=e=>e.replace(/[.*+?^${}()|[\]\\]/g,'\\$&'),s=e=>{const t=new Set([e.name,e.plural].map(e=>e.trim().toLowerCase()).filter(Boolean));for(const e of[...t])e.endsWith('s')?t.add(e.slice(0,-1)):t.add(e+'s');return[...t].sort((e,t)=>t.length-e.length).map(o).join('|')};function i(e){const t=(e||'').trim().toLowerCase();if(!t)return 1;if(/^\xbd$|^half\b/.test(t))return.5;const o=t.match(/^(\d+(?:\.\d+)?)\s*(\xbd)?/);if(o)return Number(o[1])+(o[2]?.5:0);const s=t.split(/\s+/)[0];return n[s]??1}const a=(e,t)=>'half'===e.unit?Math.max(.5,Math.round(2*t)/2):Math.max(1,Math.round(t)),l=e=>(e.optionGroups??[]).some(e=>e.choices.some(e=>/\bhalf\b/i.test(e.label)));function u(n,o,u){const c=u.filter(e=>!1!==e.active&&'kg'!==e.unit),f=(e,t)=>({source:e,uses:t.map(t=>{const o=c.find(e=>e.key===t.key),s='half'===o.unit&&l(n)&&'description'!==e?.5:t.qty;return{key:t.key,qty:a(o,s)}})});if(o){const e=[];for(const n of c){const a=new RegExp(`\\b(${s(n)})\\b`,'i'),l=o.ingredients.find(e=>a.test(e.name)&&!t.test((e.unit||'').trim())&&!/\b(meat|stock|bisque|oil|butter|paste)\b/i.test(e.name));l&&e.push({key:n.key,qty:i(`${l.qty} ${l.unit}`)})}if(e.length)return f('card',e)}const h=n.description??'';{const t=[];for(const n of c){const o=new RegExp(`\\b(half an?|a|an|one|two|three|four|five|six|\\d+(?:\\.\\d+)?|\xbd)\\s+(?:(?:whole|fresh|live|dressed|local)\\s+)?(?:[A-Za-z'\u2019-]+\\s+){0,2}?(${s(n)})\\b(?!\\s+(?:${e}))`,'i'),a=h.match(o);a&&t.push({key:n.key,qty:i(a[1])})}if(t.length)return f('description',t)}{const e=n.name.replace(/\([^)]*\)/g,'').trim(),t=[];for(const n of c)new RegExp(`\\b(${s(n)})$`,'i').test(e)&&t.push({key:n.key,qty:1});if(t.length)return f('name',t)}return{uses:[],source:'none'}}function c(e,t){return e.filter(e=>(t[e.key]??0)(n.find(t=>t.key===e)?.name??e).toLowerCase(),s=e.filter(e=>(t[e.key]??0)<=0).map(e=>o(e.key)),i=e.filter(e=>(t[e.key]??0)>0).map(e=>o(e.key)),a=e=>e.length<=2?e.join(' or '):`${e.slice(0,-1).join(', ')} or ${e[e.length-1]}`;return[s.length?`no ${a(s)}`:'',i.length?`not enough ${a(i)}`:''].filter(Boolean).join(', ')}const h=(e,t)=>t?`${e.replace(/\s*\([^)]*\)\s*$/,'').trim()||e} (${t})`:e},1070,[]); +__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"fmtH",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"fmtHDay",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"SHIFT_MIN_START",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"SHIFT_MAX_END",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"shiftTitle",{enumerable:!0,get:function(){return f}});var t=r(d[0]);const n=t=>{const n=(Math.round(60*t)%1440+1440)%1440;return`${String(Math.floor(n/60)).padStart(2,'0')}:${String(n%60).padStart(2,'0')}`},u=t=>`${n(t)}${t>=24?' (next day)':''}`,o=7,c=28,f=(n,u)=>`${n.replace(' (example)','')} \xb7 ${(0,t.niceDate)((0,t.parseYmd)(u))}`},1071,[818]); +__d(function(_g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PUB_LOCATIONS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"privateClockVenue",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"pubLocation",{enumerable:!0,get:function(){return s}}),e.venueClockArea=function(a,o={}){if((0,t.isQueuedVenue)(a)&&!t.queuedVenues[a].clockArea.on)return(0,n.cleanArea)({...o,on:!0===o.on&&'number'==typeof o.lat&&'number'==typeof o.lng,offRotaPrompt:!1});const l=s(a);if(!l)return(0,n.cleanArea)(o);const c=(0,n.cleanArea)({lat:l.lat,lng:l.lng,radius:150,...o});return{...c,lat:c.lat??l.lat,lng:c.lng??l.lng,on:!0,offRotaPrompt:!1}},e.venueClockGeo=l,e.privateAttendance=function(n,a){if(!o(n)&&!(0,t.isQueuedVenue)(n))return a;const s={...a};for(const t of['lat','lng','latitude','longitude','coords','position','location','acc','dist','accuracy','distance','outSite'])delete s[t];a.geo&&(s.geo=a.geo.map(t=>l(n,t)).filter(t=>!!t));return s};var t=r(d[0]),n=r(d[1]);const a={"3idiots":{name:"3 Idiots",address:"10 George Street, Ayr, KA8 0BL",lat:55.4650286,lng:-4.6283062,source:"Verified exact-address venue pack"},cecchinis:{name:"Cecchinis",address:"72 Fort Street, Wellington Square, Ayr, South Ayrshire KA7 1EH",lat:55.461505,lng:-4.6345736,source:"Verified exact-address venue pack"},williewastles:{name:"Willie Wastle's",address:"16-18 New Bridge Street, Ayr, South Ayrshire, KA7 1JX",lat:55.4646261,lng:-4.6323929,source:"Verified exact-address venue pack"},smokinggoat:{name:"Smoking Goat",address:"2A Academy Street, Ayr KA7 1HS",lat:55.464226,lng:-4.6326035,source:"Verified exact-address venue pack"},drunkencoo:{name:"The Drunken Coo",address:"22 Beresford Terrace, Ayr KA7 2EG",lat:55.4570308,lng:-4.6294663,source:"Verified exact-address venue pack"},abbotsford:{name:'The Abbotsford Hotel',address:'14 Corsehill Road, Ayr KA7 2ST',lat:55.4488797,lng:-4.6314856,source:'Official FSA1696388, exact address match verified6 Nov2026'},kirkton:{name:'The Kirkton Inn',address:'1-3 Main Street, Dalrymple, East Ayrshire KA6 6DF',lat:55.3971215,lng:-4.5920177,source:'Public FSA establishment1955433 verified6 November2026'},greenside:{name:'The Greenside Restaurant',address:'5 Greenside, Maybole, South Ayrshire KA19 7DG',lat:55.3542369,lng:-4.6851418,source:'Official Find us Google Maps link, place point, verified 6 November 2026'},kirkmichael:{name:'The Kirkmichael Arms',address:'3-5 Straiton Road, Kirkmichael, South Ayrshire KA19 7PH',lat:55.3458202,lng:-4.6180793,source:'venue-profile.json geo, matched to the venue address'},souters:{name:"Souter\u2019s Inn",address:'47 Main Road, Kirkoswald, South Ayrshire KA19 8HY',lat:55.3297218,lng:-4.7772979,source:'Food Standards Agency establishment 1863840, address matched'}},o=t=>Object.prototype.hasOwnProperty.call(a,t),s=t=>o(t)?a[t]:void 0;function l(n,a){return o(n)||(0,t.isQueuedVenue)(n)?'in'===a.action?{action:'in',at:a.at,inside:a.inside,...a.override?{override:{by:a.override.by,byId:a.override.byId,reason:a.override.reason}}:{}}:void 0:a}},1074,[6,1160]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useCashAccess",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"hasCashUpAccess",{enumerable:!0,get:function(){return n}});const t=(0,r(d[0]).create)(()=>({byRef:{},mine:null,loaded:!1})),n=()=>!0===t.getState().mine},1075,[1008]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"orderListSeedId",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"orderListSettingsId",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"orderListSeeds",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"useOrderLists",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"orderSettingsOf",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"useListOpen",{enumerable:!0,get:function(){return y}});var e,t=r(d[0]),s=(e=t)&&e.__esModule?e:{default:e},i=r(d[1]),n=r(d[2]),u=r(d[3]),o=r(d[4]),p=r(d[5]),l=r(d[6]);const c=(e,t)=>(0,u.uuidFrom)(`order-list:${t}:${e}`),S=e=>(0,u.uuidFrom)(`order-list-settings:${e}`),f=e=>'anchorage'===e?[{id:c(e,'allsons'),seed:'allsons',name:'Alsons (drinks)',kind:'running'},{id:c(e,'cash-carry'),seed:'cash-carry',name:'Cash and carry',kind:'trip',tripDay:5}]:[],A=()=>(new Date).toISOString(),O=(0,i.create)()((0,n.persist)((e,t)=>({lists:[],items:[],history:[],settings:{},ensure:s=>{const i=t(),n=new Set(i.lists.map(e=>e.id)),u=f(s).filter(e=>!n.has(e.id)).map(e=>({...e,rid:s})),p={},c=i.lists.map(e=>(0,l.fixSupplierNames)(e.name)!==e.name?{...e,name:(0,l.fixSupplierNames)(e.name),updatedAt:A()}:e);c.some((e,t)=>e!==i.lists[t])&&(p.lists=c),u.length&&(p.lists=[...p.lists??i.lists,...u]),i.settings[s]||(p.settings={...i.settings,[s]:{...o.DEFAULT_ORDER_LIST_SETTINGS,id:S(s)}}),Object.keys(p).length&&e(p)},addList:(t,s)=>{const i=(0,p.uuid)();return e(e=>({lists:[...e.lists,{...s,id:i,rid:t,updatedAt:A()}]})),i},updateList:(t,s)=>e(e=>({lists:e.lists.map(e=>e.id===t?{...e,...s,updatedAt:A()}:e)})),addItem:(t,s)=>{const i=(0,p.uuid)(),n=s.addedAt??A();return e(e=>({items:[...e.items,{...s,id:i,rid:t,status:'open',addedAt:n,updatedAt:n}]})),i},bump:(t,s,i)=>e(e=>({items:e.items.map(e=>e.id===t?{...(0,o.bumpQty)(e,s,i.id,i.name,A()),rid:e.rid}:e)})),updateItem:(t,s)=>e(e=>({items:e.items.map(e=>e.id===t?{...e,...s,updatedAt:A()}:e)})),setStatus:(t,s,i)=>e(e=>({items:e.items.map(e=>e.id===t?{...e,status:s,statusBy:'open'===s?void 0:i.name,statusAt:'open'===s?void 0:A(),updatedAt:A()}:e)})),removeItem:t=>e(e=>({items:e.items.map(e=>e.id===t?{...e,removed:!0,updatedAt:A()}:e)})),undoRemove:t=>e(e=>({items:e.items.map(e=>e.id===t?{...e,removed:!1,updatedAt:A()}:e)})),finish:(s,i,n,u)=>{const l=t().lists.find(e=>e.id===i);if(!l)return null;const c=A(),{round:S,drop:f,carriedOver:O}=(0,o.finishOrder)(l,t().items,n,u,c,p.uuid),_=new Set(f),y=new Map(O.map(e=>[e.id,e])),T={...S,rid:s};return e(e=>({items:e.items.filter(e=>!_.has(e.id)).map(e=>y.has(e.id)?{...y.get(e.id),rid:e.rid}:e),history:[T,...e.history].slice(0,300),lists:e.lists.map(e=>e.id===i?{...e,nextTrip:void 0,updatedAt:c}:e)})),T},setSettings:(t,s)=>e(e=>({settings:{...e.settings,[t]:{...o.DEFAULT_ORDER_LIST_SETTINGS,...e.settings[t],...s,id:S(t),updatedAt:A()}}})),resetSettings:t=>e(e=>({settings:{...e.settings,[t]:{...o.DEFAULT_ORDER_LIST_SETTINGS,id:S(t),updatedAt:A()}}}))}),{name:'covercharge-order-lists-v1',version:1,storage:(0,n.createJSONStorage)(()=>s.default)})),_=e=>({...o.DEFAULT_ORDER_LIST_SETTINGS,...O.getState().settings[e]}),y=(0,i.create)()(e=>({request:t=>e({seed:t})}))},1076,[1024,1008,1025,1143,1218,1147,1217]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SHIFT_MANAGER_PERMS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"SHIFT_MANAGER_FEATURES",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"SHIFT_MANAGER_EXCLUDED",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"SHIFT_MANAGER_EXCLUDED_WORDS",{enumerable:!0,get:function(){return o}}),e.shiftManagerOn=function(n){return!(!n.inStaffApp||!n.managerAccess||'owner'===n.role)&&(n.live?n.perms.includes('shift.manager'):'staff'===n.app)},e.swapTargets=function(n,t){return n.filter(n=>n.active&&n.id!==t&&'owner'!==n.role)};const n=['bookings.manage','floor.manage','stock.manage','attendance.view','rota.swap','shift.manager'],t=['New, edit and cancel bookings; walk-ins; seat, move and finish tables; deposit status','Tables to clear','Block bookings and close the garden','Allergy checks','Sold out (86) and tracked stock','Who\u2019s clocked in','Approve shift swaps and cover'],s=['wages.view','wages.manage','orders.manage','staff.manage','roles.manage','venue.settings','devices.manage','rota.manage','suppliers.manage','suppliers.order','recipes.edit','recipes.signoff','outbox.view'],o='takings, wages, tips and payouts, HR, billing, venue settings and owner access'},1077,[]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"hashOf",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"MASS_REMOVE",{enumerable:!0,get:function(){return c}}),_e.quietly=async function(e){l++;try{await e()}finally{l--;for(const e of u)e.resnapshot()}},Object.defineProperty(_e,"isQuiet",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"EntityBridge",{enumerable:!0,get:function(){return f}}),_e.venueChannel=function(e,t,n,s){let o=i().channel(`cc-live:${e}:${Math.random().toString(36).slice(2,8)}`);for(const{table:s,venueColumn:i}of t)o=o.on('postgres_changes',{event:'*',schema:'public',table:s,filter:`${i??'venue_id'}=eq.${e}`},e=>{n(s,'DELETE'===e.eventType?'delete':'upsert','DELETE'===e.eventType?e.old:e.new)});return o.subscribe(e=>s(e)),o},Object.defineProperty(_e,"onConnectivity",{enumerable:!0,get:function(){return t.onConnectivity}});var e=r(d[0]),t=r(d[1]),n=r(d[2]),s=r(d[3]);const i=()=>(0,e.getSupabase)(),o=e=>{if(null===e||'object'!=typeof e)return JSON.stringify(e)??'null';if(Array.isArray(e))return`[${e.map(o).join(',')}]`;const t=e;return`{${Object.keys(t).filter(e=>void 0!==t[e]).sort().map(e=>`${JSON.stringify(e)}:${o(t[e])}`).join(',')}}`},h=e=>{const t=o(e);let n=2166136261;for(let e=0;e>>0;return`${n.toString(36)}.${t.length}`},c=5;let l=0;const u=new Set;const p=()=>l>0;class f{known={};last=new Map;reconciled=!1;applying=!1;massOk=!1;unsub=null;constructor(e,t,n={}){this.spec=e,this.venueId=t,this.ev=n,this.kvKey=`known:${t}:${e.name}`}async start(){this.known=await n.kv.get(this.kvKey,{}),this.snapshotLocal(),u.add(this),this.unsub=this.spec.subscribe(()=>{l>0?this.snapshotLocal():!this.applying&&this.reconciled&&this.pushLocalChanges()})}stop(){this.unsub?.(),this.unsub=null,u.delete(this)}resnapshot(){this.snapshotLocal()}allowMassRemoveOnce(){this.massOk=!0}snapshotLocal(){this.last=new Map(this.spec.list().map(e=>[this.spec.key(e),h(e)]))}saveKnown(){n.kv.set(this.kvKey,this.known)}pending(e){return s.mutationQueue.hasPending(this.spec.table,this.venueId,e)}async read(){let e=i().from(this.spec.table).select('*').eq(this.spec.venueColumn??'venue_id',this.venueId);this.spec.filter&&(e=this.spec.filter(e));const{data:t,error:n}=await e.limit(2e3);if(n)throw n;const s=t??[];this.merge(s,!this.reconciled),this.reconciled=!0,this.spec.afterRead?.(s)}merge(e,t){const n=this.spec,s=new Map(n.list().map(e=>[n.key(e),e])),i=new Set,o=[],l=[],u=[],p=[];for(const t of e){const e=n.rowKey(t),c=n.fromRow(t);if(!c)continue;i.add(e),p.push(c);const l=h(c),f=s.get(e);if(!this.pending(e)){if(f){const t=h(f);if(t===l){this.known[e]=l;continue}if(this.known[e]&&t!==this.known[e]&&n.writable()&&n.syncable(f)){u.push(f);continue}}o.push(c),this.known[e]=l}}for(const[e,t]of s)i.has(e)||this.pending(e)||!n.syncable(t)||n.inWindow&&!n.inWindow(t)||(this.known[e]?l.push(e):n.writable()&&!n.supersededBy?.(t,p)&&u.push(t));const f=this.massOk;if(this.massOk=!1,l.length>c&&!f)this.ev.onSuspect?.(n.name,`read would remove ${l.length} of ${s.size}`),l.length=0,u.length=0;else for(const e of l)delete this.known[e];this.applyRemote(o,l);for(const e of u)this.write(e);this.saveKnown()}applyRemote(e,t){if(e.length||t.length){this.applying=!0;try{this.spec.apply(e,t)}finally{this.applying=!1}this.snapshotLocal(),this.ev.onActivity?.()}}remote(e,t){if(!this.reconciled)return;const n=this.spec,s=n.rowKey(t);if(this.pending(s))return;if('delete'===e){if(!this.last.has(s))return;return delete this.known[s],this.applyRemote([],[s]),this.saveKnown(),void n.onRemote?.(t,e)}const i=n.fromRow(t);if(!i)return;const o=h(i);this.known[s]=o,this.saveKnown(),this.last.get(s)!==o&&this.applyRemote([i],[]),n.onRemote?.(t,e)}pushLocalChanges(){const e=this.spec,t=new Map(e.list().map(t=>[e.key(t),t]));for(const[n,s]of t){const t=h(s);this.last.get(n)!==t&&(this.last.set(n,t),e.syncable(s)&&e.writable()&&this.known[n]!==t&&this.write(s))}const n=[...this.last.keys()].filter(e=>!t.has(e));for(const e of n)this.last.delete(e);const i=e.writable()&&!1!==e.deletes&&'insert'!==e.mode&&'update'!==e.mode?n.filter(e=>this.known[e]):[];if(e.protect&&i.length>c)return this.ev.onSuspect?.(e.name,`${i.length} items vanished at once; not deleted`),void this.saveKnown();for(const t of i)delete this.known[t],s.mutationQueue.enqueue({table:e.table,venueId:this.venueId,kind:'delete',rowKey:t,match:{...this.deleteMatch(t),venue_id:this.venueId}});this.saveKnown()}deleteMatch(e){return this.spec.matchKey?this.spec.matchKey(e):{id:e}}write(e){const t=this.spec,n=t.key(e);let i;try{i=t.toRow(e,this.venueId)}catch(e){return void this.ev.onError?.(t.name,String(e?.message??e))}if(this.known[n]=h(e),'update'===t.mode){const e=t.venueColumn??'venue_id';s.mutationQueue.enqueue({table:t.table,venueId:this.venueId,kind:'update',rowKey:n,values:i,match:{...t.matchKey?t.matchKey(n):{},[e]:this.venueId}})}else s.mutationQueue.enqueue({table:t.table,venueId:this.venueId,kind:'insert'===t.mode?'insert':'upsert',rowKey:n,values:i,conflictKey:t.conflict??'id'});this.ev.onActivity?.()}}},1117,[862,1208,1207,1120]); +__d(function(g,r,i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"dismissNotice",{enumerable:!0,get:function(){return u.dismissNotice}}),Object.defineProperty(_e,"notify",{enumerable:!0,get:function(){return u.notify}}),Object.defineProperty(_e,"useSliders",{enumerable:!0,get:function(){return u.useSliders}}),Object.defineProperty(_e,"SLIDER",{enumerable:!0,get:function(){return y}}),_e.SliderButton=w,_e.SliderCard=S,_e.SliderHost=function(){x();const e=(0,u.useSliders)(e=>e.queue),n=e[0],o=(0,t.useRef)(null);if((0,t.useEffect)(()=>{if(f)return window.ccSlider=e=>(0,u.notify)(e),()=>{delete window.ccSlider}},[]),(0,t.useEffect)(()=>{if(o.current&&clearTimeout(o.current),!n)return;const e=void 0!==n.timeoutMs?n.timeoutMs:n.actions?.length||n.content?null:6e3;return e&&(o.current=setTimeout(()=>u.useSliders.getState().dismiss(n.id),e)),()=>{o.current&&clearTimeout(o.current)}},[n?.id,n?.timeoutMs]),!n)return null;const s=f?'fixed':'absolute';return(0,b.jsxs)(b.Fragment,{children:[n.modal?(0,b.jsx)(l.default,{...h('dim'),style:{position:s,left:0,right:0,top:0,bottom:0,zIndex:2147482990,backgroundColor:'rgba(0,0,0,0.72)'}}):null,(0,b.jsx)(l.default,{testID:"cc-slider-host",pointerEvents:"box-none",style:{position:s,left:12,right:12,bottom:12,zIndex:2147483e3,alignItems:'center',...f?{bottom:'calc(12px + env(safe-area-inset-bottom))'}:{}},children:(0,b.jsx)(S,{n:n,waiting:e.length-1,onClose:()=>u.useSliders.getState().dismiss(n.id)},n.id+':'+(n.seq??0))})]})};var t=r(d[0]);r(d[1]);var n=e(r(d[2])),o=e(r(d[3])),l=e(r(d[4])),s=e(r(d[5])),c=r(d[6]),a=r(d[7]),u=r(d[8]),b=r(d[9]);const f='undefined'!=typeof document,p="\n[data-ccsl=\"in\"]{animation:ccsl-in .45s cubic-bezier(.2,1,.3,1) both}\n@keyframes ccsl-in{from{opacity:0;transform:translate3d(0,110%,0)}to{opacity:1;transform:none}}\n[data-ccsl=\"urgent\"]{animation:ccsl-in .45s cubic-bezier(.2,1,.3,1) both,ccsl-red 1.6s ease-in-out .45s infinite}\n@keyframes ccsl-red{0%,100%{box-shadow:0 10px 30px rgba(0,0,0,.6),0 0 0 1px rgba(255,107,94,.55)}50%{box-shadow:0 10px 40px rgba(0,0,0,.6),0 0 0 2px #FF6B5E,0 0 34px rgba(255,107,94,.45)}}\n[data-ccsl=\"dim\"]{animation:ccsl-dim .3s ease both}\n@keyframes ccsl-dim{from{opacity:0}to{opacity:1}}\n@media (prefers-reduced-motion: reduce){[data-ccsl]{animation:none !important}}\n",h=e=>f?{dataSet:{ccsl:e}}:{};function x(){(0,t.useEffect)(()=>{if(!f||document.getElementById('cc-slider-css'))return;const e=document.createElement('style');e.id='cc-slider-css',e.textContent=p,document.head.appendChild(e)},[])}const y={bg:'#17140F',border:'rgba(207,164,95,.55)',text:'#F5F1E8',quiet:'#A89A80',gold:c.colours.gold,ink:'#17130D'},j=(e="normal")=>'urgent'===e?c.colours.red:'warn'===e?c.colours.amber:c.colours.gold,k=(e="normal")=>'urgent'===e?'rgba(255,107,94,.75)':'warn'===e?'rgba(255,181,71,.65)':y.border;function w({a:e,onDone:t,big:o}){const l=e.kind??'primary';return(0,b.jsx)(n.default,{testID:e.testID,accessibilityRole:"button",accessibilityLabel:e.label,onPress:()=>{try{e.onPress?.()}finally{e.keepOpen||t()}},style:({pressed:e})=>({minHeight:o?56:44,minWidth:44,paddingHorizontal:'ghost'===l?10:o?24:18,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:'primary'===l?y.gold:'transparent',borderWidth:'danger'===l?1:0,borderColor:c.colours.red,opacity:e?.8:1}),children:(0,b.jsx)(a.T,{size:o?18:'ghost'===l?14:15,weight:'primary'===l?'bold':'medium',colour:'primary'===l?y.ink:'danger'===l?c.colours.red:y.quiet,children:e.label})})}function S({n:e,onClose:t,waiting:n=0,maxWidth:c=520}){x();const u=e.tone??'normal',p=j(u),S=e.content,C=!!e.big,{height:I}=(0,s.default)(),D=e.actions??[];return(0,b.jsxs)(l.default,{testID:e.testID??'cc-slider',accessibilityRole:"summary",accessibilityLabel:`${e.kicker?e.kicker+': ':''}${e.title}`,...h('urgent'===u?'urgent':'in'),style:{width:'100%',maxWidth:C?Math.max(c,900):c,alignSelf:'center',borderRadius:14,backgroundColor:y.bg,borderWidth:1,borderColor:k(u),overflow:'hidden',...f?{boxShadow:'0 10px 30px rgba(0,0,0,.6)'}:{elevation:12}},children:['normal'!==u?(0,b.jsx)(l.default,{style:{position:'absolute',left:0,top:0,bottom:0,width:5,backgroundColor:p}}):null,(0,b.jsxs)(o.default,{style:{maxHeight:Math.max(220,I-40)},contentContainerStyle:{paddingVertical:C?18:12,paddingLeft:'normal'!==u?C?24:18:C?20:14,paddingRight:C?20:14,gap:C?10:6},children:[(0,b.jsxs)(l.default,{style:{flexDirection:'row',alignItems:'center',gap:12},children:[e.icon?(0,b.jsx)(a.T,{size:C?34:22,children:e.icon}):null,(0,b.jsxs)(l.default,{style:{flex:1,gap:2},children:[e.kicker?(0,b.jsx)(a.T,{size:C?15:11,weight:"bold",colour:p,style:{letterSpacing:1.4},children:e.kicker}):null,(0,b.jsx)(a.T,{size:C?24:15,weight:"medium",colour:y.text,children:e.title}),e.body?(0,b.jsx)(a.T,{size:C?18:13,colour:y.quiet,children:e.body}):null]}),D.length||S?null:(0,b.jsx)(w,{a:{label:'OK',kind:'ghost',testID:'cc-slider-ok'},onDone:t,big:C})]}),S?(0,b.jsx)(S,{close:t}):null,D.length?(0,b.jsx)(l.default,{style:{flexDirection:'row',flexWrap:'wrap',alignItems:'center',gap:8,justifyContent:'flex-end'},children:D.map(e=>(0,b.jsx)(w,{a:e,onDone:t,big:C},e.label))}):null,n>0?(0,b.jsxs)(a.T,{size:C?14:11,colour:y.quiet,children:[n," more waiting"]}):null]})]})}},1118,[30,122,263,151,127,287,821,813,1041,24]); +__d(function(g,_r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useCardStore",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"photoStorageFull",{enumerable:!0,get:function(){return E}}),_e.setStoragePhotoResolver=function(e){j=e},_e.cachePhotoAs=function(e,t){if(C.getState().photos[e]===t)return;C.setState(r=>({photos:{...r.photos,[e]:t}}))},Object.defineProperty(_e,"readLocalPhoto",{enumerable:!0,get:function(){return M}}),Object.defineProperty(_e,"localRecipeCards",{enumerable:!0,get:function(){return $}}),_e.ensureCards=F;var e,t=_r(d[0]),r=_r(d[1]),n=_r(d[2]),s=_r(d[3]),o=_r(d[4]),a=_r(d[5]),c=(e=a)&&e.__esModule?e:{default:e};_r(d[6]);var u=_r(d[7]),l=_r(d[8]),f=_r(d[9]),m=_r(d[10]),h=_r(d[11]),p=_r(d[12]),S=_r(d[13]);const I='covercharge-recipecards-v1',y='covercharge-recipephotos-v1',O=()=>{try{return(0,S.nowFrom)(S.useStore.getState().clock)}catch{return new Date}},b=(0,u.create)()((0,l.persist)(()=>({cards:[],removed:[],log:[]}),{name:I,storage:(0,l.createJSONStorage)(()=>c.default),version:3,migrate:async e=>{const n=e;return t.LIVE_VENUE_BUILD?(await(0,r.archiveChefCache)('recipe-cards',n),{...n,cards:n.cards.filter(e=>!(0,s.isDemoCard)(e)),log:n.log.filter(e=>!(0,s.demoActor)(e.by))}):n}}));let w=!1;const v={getItem:e=>c.default.getItem(e),setItem:async(e,t)=>{try{await c.default.setItem(e,t),w=!1}catch{w=!0}},removeItem:e=>c.default.removeItem(e)},E=()=>w,C=(0,u.create)()((0,l.persist)(()=>({photos:{}}),{name:y,storage:(0,l.createJSONStorage)(()=>v),version:1})),_={lobster:_r(d[14]),skink:_r(d[15]),fishsupper:_r(d[16]),moules:_r(d[17]),stp:_r(d[18])};let A=0;const L=(e,t,r)=>{const n={id:`cl-${Date.now().toString(36)}${(A++).toString(36)}`,cardId:e.id,rid:e.restaurantId,at:O().toISOString(),by:t,text:r};b.setState(e=>({log:[n,...e.log].slice(0,300)}));try{S.useStore.getState().addAudit(e.restaurantId,'menu',`Recipe card: ${e.dish}: ${r} (${t})`)}catch{}},P=e=>b.setState(t=>({cards:t.cards.some(t=>t.id===e.id)?t.cards.map(t=>t.id===e.id?e:t):[...t.cards,e]}));let B=null,D=null;function U(){const e=b.getState().cards,r=t.LIVE_VENUE_BUILD?e.filter(e=>!(0,s.isDemoCard)(e)).map(e=>({...e,signOff:(0,s.demoActor)(e.signOff?.by)?null:e.signOff,allergensConfirmed:(0,s.demoActor)(e.allergensConfirmed?.by)?void 0:e.allergensConfirmed})):e;if(!D||B!==e){B=e;const t=new Map,n=new Map;for(const e of r)t.set(e.restaurantId,[...t.get(e.restaurantId)??[],e]),n.set(e.menuItemId,e);D={cards:r,byRid:t,byItem:n}}return D}const N=[];function V(e){if(!(0,f.canEditCards)(e.role))throw new Error('Only the head chef and managers can edit recipe cards.')}let j=null;const M=e=>C.getState().photos[e],$={mode:'local',list:e=>U().byRid.get(e)??N,get:e=>U().cards.find(t=>t.id===e),byMenuItem:e=>U().byItem.get(e),subscribe:e=>{const t=b.subscribe(e),r=C.subscribe(e);return()=>{t(),r()}},async create(e,t,r){V(r);const n=O().toISOString();k=!0;let s=t.menuItemId;try{s||(s=S.useStore.getState().addMenuItem({restaurantId:e,section:t.section,name:t.dish,description:t.description??'',price:t.price,dietary:[],allergens:t.allergens??{},prepMins:12,soldOut:!1,signOff:null}));const o={id:t.id??(0,f.uuid)(),restaurantId:e,menuItemId:s,dish:t.dish,section:t.section,price:t.price,photo:t.photo,ingredients:t.ingredients??[],steps:t.steps??[],allergens:t.allergens??{},dismissed:t.dismissed??[],allergenNotes:t.allergenNotes,signOff:null,wasLive:!1,origin:'new',version:1,createdAt:n,updatedAt:n,updatedBy:r.name};return b.setState(e=>({cards:[...e.cards.filter(e=>e.menuItemId!==o.menuItemId),o]})),L(o,r.name,'card created, awaiting sign-off'),o}finally{k=!1}},async update(e,t,r){V(r);const n=$.get(e);if(!n)throw new Error('Card not found');const s=(0,f.editCard)(n,t,r.name,O().toISOString());return s.changed&&(P(s.card),L(s.card,r.name,s.resetSignOff?'edited, sign-off reset to Awaiting sign-off':t.confirmAllergens&&1===Object.keys(t).length?'allergens confirmed':'edited')),s.card},async signOff(e,t){if(!(0,f.canSignOffCards)(t.role))throw new Error('Only the head chef can sign off a recipe card.');const r=$.get(e);if(!r)throw new Error('Card not found');const n=(0,f.signOffBlock)(r);if(n)throw new Error(n);const s=(0,f.signOffCard)(r,t.name,O().toISOString());return P(s),L(s,t.name,'signed off'),s},async remove(e,t){V(t);const r=$.get(e);r&&(b.setState(t=>({cards:t.cards.filter(t=>t.id!==e),removed:[...t.removed,r.menuItemId]})),S.useStore.setState(e=>({menu:e.menu.map(e=>e.id===r.menuItemId?{...e,hidden:!0}:e)})),L(r,t.name,'card removed (dish hidden from the menu)'))},async savePhoto(e,t,r){const n=`local:${t}:${Date.now().toString(36)}`;return C.setState(e=>({photos:{...Object.fromEntries(Object.entries(e.photos).filter(([e])=>!e.startsWith(`local:${t}:`))),[n]:r.dataUrl}})),n},photoSource(e){if(!e)return null;if(e.startsWith('asset:'))return _[e.slice(6)]??null;if(e.startsWith('local:')){const t=C.getState().photos[e];return t?{uri:t}:null}if(/^(https?:|data:)/.test(e))return{uri:e};const t=C.getState().photos[e];if(t)return{uri:t};const r=j?.(e);return r?{uri:r}:null}};let k=!1,R=!1;function F(){if(k)return;const e=S.useStore.getState().menu,{cards:r,removed:a}=b.getState(),c=new Set(r.map(e=>e.menuItemId)),u=e.filter(e=>!c.has(e.id)&&!a.includes(e.id));if(!u.length)return;const l=O().toISOString(),f=o.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD||!(0,n.examplesAllowed)()?[]:(0,p.exampleCards)(u),m=new Set(f.map(e=>e.menuItemId)),h=[...f,...u.filter(e=>!m.has(e.id)).map(e=>(0,p.importedCard)(t.LIVE_VENUE_BUILD&&(0,s.demoActor)(e.signOff?.by)?{...e,signOff:null}:e,l))];b.setState(e=>({cards:[...e.cards,...h]}))}(0,h.setMenuCardBridge)({cardFor:e=>U().byItem.get(e),menuItemAdded:e=>{if(k||!R)return;const t=O().toISOString(),r={...(0,p.importedCard)(e,t),id:(0,f.uuid)(),signOff:null,allergensConfirmed:void 0,wasLive:!1,origin:'new',updatedBy:'Added to the menu'};P(r),L(r,r.updatedBy,'card created from the menu, awaiting sign-off')},menuEdited:(e,t,r,n)=>{const s=U().byItem.get(e);if(!s)return;let o=(0,f.editCard)(s,t,r,O().toISOString()).card;n&&o.signOff&&(o={...o,signOff:null,version:o.version+1,updatedAt:O().toISOString(),updatedBy:r}),o!==s&&(P(o),L(o,r,s.signOff&&!o.signOff?'edited from the menu, sign-off reset':'edited from the menu'))},signOff:(e,t)=>{const r=U().byItem.get(e);r&&$.signOff(r.id,{name:t,role:'head-chef'}).catch(()=>{})}}),(0,m.setRecipeCardRepository)($);const x=e=>new Promise(t=>{e.hasHydrated()?t():e.onFinishHydration(()=>t())});Promise.all([x(S.useStore.persist),x(b.persist)]).then(()=>{R=!0,F(),S.useStore.subscribe((e,t)=>{e.menu!==t.menu&&F()})}),'undefined'!=typeof window&&window.addEventListener('storage',e=>{e.key===(0,o.venueKey)(I)&&b.persist.rehydrate(),e.key===(0,o.venueKey)(y)&&C.persist.rehydrate()})},1119,[833,1137,1053,1125,5,1024,122,1008,1025,1143,831,1142,1152,870,1153,1154,1155,1156,1157]); +__d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"MutationQueue",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"mutationQueue",{enumerable:!0,get:function(){return l}});var t=_r(d[0]),e=_r(d[1]),s=_r(d[2]);const r='queue:v1',n='queue:failed:v1',h=t=>`${t.table}|${t.venueId}|${t.rowKey}`;class o{items=[];failedItems=[];loaded=null;flushing=null;exec=null;listeners=new Set;onFailure=new Set;onSaved=new Set;retryTimer=null;waitTimer=null;backoffMs=2e3;now=()=>Date.now();constructor(){(0,t.onConnectivity)(t=>{t&&this.flush()})}setExecutor(t){this.exec=t}load(){return this.loaded||(this.loaded=(async()=>{const t=await e.kv.get(r,[]);this.items=[...t.map(t=>({...t,nextAt:void 0})),...this.items],this.failedItems=await e.kv.get(n,[]),this.emit()})()),this.loaded}get pending(){return this.items}get waiting(){return this.items.filter(t=>t.attempts>0)}get failed(){return this.failedItems}hasPending(t,e,s){return this.items.some(r=>r.table===t&&r.venueId===e&&r.rowKey===s)}async enqueue(t){await this.load();const s={...t,id:(0,e.uuid)(),createdAt:(new Date).toISOString(),attempts:0};return this.items.push(s),await this.persist(),this.flush(),s}nextReady(){const t=new Set,e=this.now();for(const s of this.items){const r=h(s);if(!t.has(r)){if(!(s.nextAt&&s.nextAt>e))return s;t.add(r)}}}remove(t){this.items=this.items.filter(e=>e!==t)}flush(){return this.flushing||(this.flushing=(async()=>{for(await this.load();this.exec;){const e=this.nextReady();if(!e)break;if(!(0,t.isOnline)()){this.scheduleRetry();break}try{const t=await this.exec(e);this.remove(e),this.backoffMs=2e3,'conflict'===t?this.fail(e,'conflict','Row changed on the server (version conflict) or is not visible to you'):this.onSaved.forEach(t=>t(e))}catch(r){e.attempts+=1,e.lastError=String(r?.message??r);const n=r??{};e.lastErr={code:n.code?String(n.code):void 0,status:Number(n.status)||void 0,message:e.lastError.slice(0,300)};const h=(0,s.classifyWriteError)(r);if('network'===h){e.attempts-=1,(0,t.setOnline)(!1),this.scheduleRetry(),await this.persist();break}'retry'===h?e.nextAt=this.now()+(0,s.retryDelayMs)(e.attempts):(this.remove(e),this.fail(e,'rejected',e.lastError))}await this.persist()}this.flushing=null,this.scheduleWaiting()})()),this.flushing}retryNow(){for(const t of this.items)t.nextAt=void 0;return this.flush()}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}onFailed(t){return this.onFailure.add(t),()=>{this.onFailure.delete(t)}}onDone(t){return this.onSaved.add(t),()=>{this.onSaved.delete(t)}}async clearFailed(){this.failedItems=[],await e.kv.set(n,[]),this.emit()}fail(t,s,r){const h={...t,lastError:r,failedAt:(new Date).toISOString(),reason:s};this.failedItems=[h,...this.failedItems].slice(0,100),e.kv.set(n,this.failedItems),this.onFailure.forEach(t=>t(h))}scheduleWaiting(){this.waitTimer&&(clearTimeout(this.waitTimer),this.waitTimer=null);const t=this.items.map(t=>t.nextAt??0).filter(t=>t>0);if(!t.length)return;const e=Math.max(500,Math.min(...t)-this.now());this.waitTimer=setTimeout(()=>{this.waitTimer=null,this.flush()},e)}scheduleRetry(){if(this.retryTimer)return;const e=this.backoffMs;this.backoffMs=Math.min(2*this.backoffMs,6e4),this.retryTimer=setTimeout(()=>{this.retryTimer=null,(0,t.setOnline)(!0),this.flush()},e)}async persist(){await e.kv.set(r,this.items),this.emit()}emit(){this.listeners.forEach(t=>t())}}const l=new o},1120,[1208,1207,1211]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SUPABASE_URL",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"SUPABASE_ANON_KEY",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"isSupabaseConfigured",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"REALTIME_TABLES",{enumerable:!0,get:function(){return s}});var t=r(d[0]);const n="https://rowdoidkftriylijobuy.supabase.co",o="sb_publishable_rPm723MQz6FwmFVHy6e1SA_ko-_-6GR",u=()=>!t.PITCH&&n.startsWith('https://')&&o.length>20,s=['bookings','walk_ins','blocks','table_plans','takeaway_orders','stock_counts']},1121,[2]); +__d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.pushState=f,e.turnOnPush=async function(){const u=await f();if('ios-home-screen'===u)return{ok:!1,message:'On iPhone, add this app to your Home Screen first (Share \u203a Add to Home Screen, iOS 16.4 or later), then open it from there.'};if('unsupported'===u)return{ok:!1,message:'This browser can\u2019t get phone notifications. Try Chrome on Android, or the app from your iPhone Home Screen.'};if('blocked'===u)return{ok:!1,message:'Notifications are blocked for this app. Allow them in your phone\u2019s settings, then try again.'};const c=i.useSync.getState();if('staff'!==c.kind||!c.venueId||!c.staffRef)return{ok:!1,message:'Sign in from your personal link first.'};if('granted'!==await Notification.requestPermission())return{ok:!1,message:'You didn\u2019t allow notifications, so nothing changed.'};const p=await navigator.serviceWorker.ready,h=(await p.pushManager.getSubscription()??await p.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:s(n.VAPID_PUBLIC_KEY)})).toJSON();if(!h.endpoint||!h.keys?.p256dh||!h.keys?.auth)return{ok:!1,message:'Your browser didn\u2019t give a usable subscription. Try again.'};const l=(0,t.getSupabase)(),{error:y}=await l.from('push_subscriptions').upsert({venue_id:c.venueId,staff_ref:c.staffRef,app:o.APP_VARIANT,endpoint:h.endpoint,p256dh:h.keys.p256dh,auth:h.keys.auth,user_agent:navigator.userAgent.slice(0,200)},{onConflict:'user_id,endpoint'});return y?{ok:!1,message:`Couldn\u2019t save this phone: ${y.message}`}:{ok:!0,message:'Phone notifications are on for this device.'}},e.turnOffPush=async function(){const n=await(navigator.serviceWorker?.getRegistration()),i=await(n?.pushManager.getSubscription());if(!i)return{ok:!0,message:'Phone notifications are off for this device.'};const o=i.endpoint;await i.unsubscribe();try{const n=(0,t.getSupabase)();await n.from('push_subscriptions').delete().eq('endpoint',o)}catch{}return{ok:!0,message:'Phone notifications are off for this device.'}};var n=r(d[0]),t=r(d[1]),i=r(d[2]),o=r(d[3]);const s=n=>{const t=atob(n.replace(/-/g,'+').replace(/_/g,'/')+'='.repeat((4-n.length%4)%4)),i=new Uint8Array(t.length);for(let n=0;n'undefined'!=typeof navigator&&/iPhone|iPad|iPod/.test(navigator.userAgent),c=()=>'undefined'!=typeof window&&(window.matchMedia?.('(display-mode: standalone)').matches||!0===navigator.standalone);async function f(){if('undefined'==typeof window||!('serviceWorker'in navigator))return'unsupported';if(!('PushManager'in window)||'undefined'==typeof Notification)return u()&&!c()?'ios-home-screen':'unsupported';if('denied'===Notification.permission)return'blocked';const n=await navigator.serviceWorker.getRegistration();return await(n?.pushManager.getSubscription())?'on':'off'}},1122,[1287,862,820,806]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SOON_TEXT",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"setVenueWords",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"getVenueWords",{enumerable:!0,get:function(){return u}}),e.askServer=async function(o,c,u,p){try{const l=(0,t.getSupabase)().functions.invoke(n,{body:{app:o,text:c,tools:u,...p?{receipt:p,spoken:!0,vocab:s}:{}}}),y=new Promise(t=>setTimeout(()=>t({data:null,error:new Error('timeout')}),1e4)),{data:f,error:b}=await Promise.race([l,y]);return b||!f||!0!==f.ready||f.busy?{kind:'soon'}:f.call?.name?{kind:'call',name:String(f.call.name),args:f.call.args??{}}:'string'==typeof f.text&&f.text.trim()?{kind:'text',text:f.text.trim()}:{kind:'soon'}}catch{return{kind:'soon'}}},e.transcribe=async function(n,o,c=8e3){try{const u=/mp4|m4a|aac/.test(o.type)?'m4a':/ogg/.test(o.type)?'ogg':/wav/.test(o.type)?'wav':'webm',l=new FormData;l.append('app',n),s.length&&l.append('keyterms',JSON.stringify(s)),l.append('file',o,`speech.${u}`);const y=(0,t.getSupabase)().functions.invoke(p,{body:l}),f=new Promise(t=>setTimeout(()=>t({data:null,error:new Error('timeout')}),c)),{data:b,error:k}=await Promise.race([y,f]);return k?{ok:!1,reason:'timeout'===String(k?.message)?'timeout':'offline'}:!0===b?.ok?{ok:!0,text:String(b.text??''),receipt:'string'==typeof b.receipt?b.receipt:void 0}:{ok:!1,reason:String(b?.reason??'busy'),text:'string'==typeof b?.text?b.text:void 0}}catch{return{ok:!1,reason:'offline'}}};var t=r(d[0]);const n='voice-assistant',o='Voice assistant is switching on soon. Until then I can do the everyday things, for example';let s=[];const c=t=>{s=t.slice(0,100)},u=()=>s;const p='voice-transcribe'},1123,[862]); +__d(function(g,r,i,_a,_m2,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"NUM_WORDS",{enumerable:!0,get:function(){return s}}),e.numberOf=l,e.normaliseHeard=function(t){let n=` ${t.replace(/[\u2019\u2018]/g,"'").replace(/\s+/g,' ').trim()} `;n=n.replace(/\bwalk[\s-]?ins?\b/gi,'walk-in').replace(/\bwalking\b(?=\s+(?:of|for|in|on|at|party|\d|one|two|three|four|five|six|seven|eight|nine|ten|to|too)\b)/gi,'walk-in').replace(/\bseat(?:er|ed|a)?\s+(?:a\s+|at\s+|the\s+)?walk-in\b/gi,'seat a walk-in').replace(/\bsit\s+(?:a\s+)?walk-in\b/gi,'seat a walk-in').replace(/\b(?:quitter|quieter|pew ta|puta|put the|push a)\s+walk-in\b/gi,'put a walk-in').replace(/^(\s*)(?:lock|clock)\s+table\b/i,'$1block table').replace(/^(\s*)(?:[Ss]id|[Ss]it|[Ss]eed|[Ss]ee)\s+(?=[A-Z][a-z]+\b.*\b(?:waitlist|wait list|waiting list)\b)/,'$1seat ').replace(/\b(table \S+ (?:needs|is needing|wants)) cleaning\b/gi,'$1 clearing').replace(/^(\s*)have many\b/i,'$1how many').replace(/^(\s*)(?:meet|need|reed|weed) the (orders|shift notes|messages|specials)\b/i,'$1read the $2'),n=n.replace(new RegExp(`\\btable(\\s+(?:number\\s+)?)(${a})\\b(?!\\s+(?:${b})\\b)`,'gi'),(t,n,s)=>`table${n}${p(s)}`).replace(new RegExp("\\btable(\\s+(?:number\\s+)?)(for|fore)\\b(?=\\s*(?:$|[.,!?]|\\b(?:please|now|is|has|needs|wants|on|at)\\b))",'gi'),(t,n,s)=>`table${n}${p(s)}`).replace(new RegExp(`\\btable(\\s+(?:number\\s+)?)((?:twenty|thirty)[ -](?:one|two|three|four|five|six|seven|eight|nine)|${s})\\b`,'gi'),(t,n,s)=>`table${n}${p(s)}`).replace(new RegExp(`\\b(walk-in(?:\\s+party)?\\s+(?:of|for)|party of|table for|of|for)\\s+(${o})\\b${w}`,'gi'),(t,n,s)=>`${n} ${p(s)}`).replace(new RegExp(`\\bwalk-in\\s+(${s}|\\d{1,2})\\b${w}`,'gi'),(t,n)=>`walk-in of ${p(n)}`).replace(new RegExp(`\\bwalk-in\\s+(${o})\\b(?=\\s*(?:$|[.,!?]|\\b(?:on|at|people|covers|guests|please|now)\\b))`,'gi'),(t,n)=>`walk-in of ${p(n)}`).replace(new RegExp(`\\b(${o})\\s+(covers|people|guests|adults)\\b`,'gi'),(t,n,s)=>`${p(n)} ${s}`);const c=n.match(new RegExp(`^\\s*(?:(?:put|seat|sit)\\s+)?(?:a\\s+)?(${b})\\s+(?:on|at|to|onto)\\s+table\\s+(\\w+)[.,!?]?(?:\\s+(?:please|now|thanks))?\\s*[.!?]?\\s*$`,'i'));c&&l(c[1])&&l(c[1])<=30&&(n=` seat a walk-in of ${p(c[1])} at table ${p(c[2])} `);return n.replace(/\s+/g,' ').trim()},e.walkInCovers=function(t){const n=` ${t.toLowerCase()} `,a=`(\\d{1,2}|${s})`,o=n.match(new RegExp(`\\bwalk-in(?:\\s+party)?\\s+(?:of|for)\\s+${a}\\b`))??n.match(new RegExp(`\\bwalk-in\\s+(?:at|a|of a|for a)\\s+${a}\\s+(?:at|on)\\s+table\\b`))??n.match(new RegExp(`\\b${a}\\s+walk-in`))??n.match(new RegExp(`\\b(?:party of|table for|for|of)\\s+${a}\\b(?!\\s*(?:am|pm|[:.]\\d|o.?clock))`))??n.match(new RegExp(`\\b${a}\\s*(?:covers|people|guests|adults|pax|persons|of us)\\b`)),b=l(o?.[1],!1);return b&&b>=1&&b<=30?b:void 0},e.tableSaid=function(t){const n=[...` ${t.toLowerCase()} `.matchAll(/\btable\s+(?:number\s+)?([a-z]?\d{1,3}[a-z]?)\b/g)];return n.length?n[n.length-1][1].toUpperCase():void 0},e.coversAnswer=function(t){const n=t.toLowerCase().replace(/[.,!?]/g,' '),a=n.match(new RegExp(`\\b(\\d{1,2}|${s})\\b`))??n.match(new RegExp(`^\\s*(?:just\\s+)?(${o})\\s*(?:people|of us|please)?\\s*$`)),b=l(a?.[1]);return b&&b>=1&&b<=30?b:void 0};const t={one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12,thirteen:13,fourteen:14,fifteen:15,sixteen:16,seventeen:17,eighteen:18,nineteen:19,twenty:20,thirty:30},n={to:2,too:2,tu:2,for:4,fore:4,ate:8,won:1,tree:3,free:3,sax:6,sex:6,fiver:5,nein:9,tin:10},s=Object.keys(t).join('|'),a='to|too|tu|ate|won|tree|free|sax|sex|fiver|nein|tin',o='to|too|tu|for|fore|ate|won',b=`\\d{1,2}|(?:twenty|thirty)[ -](?:one|two|three|four|five|six|seven|eight|nine)|${s}|${o}`;function l(s,a=!0){if(!s)return;const o=s.toLowerCase().trim().replace(/-/g,' ');if(/^\d+$/.test(o))return Number(o);const b=o.match(/^(twenty|thirty) (one|two|three|four|five|six|seven|eight|nine)$/);return b?t[b[1]]+t[b[2]]:t[o]??(a?n[o]:void 0)}const p=t=>String(l(t)??t),w='(?=\\s*(?:$|[.,!?]|\\bon\\b|\\bat\\b|\\bin\\b|\\bto\\b|\\btable\\b|\\bplease\\b|\\bnow\\b|\\bpeople\\b|\\bcovers?\\b|\\bguests?\\b))'},1124,[]); +__d(function(g,_r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ANCHORAGE_ID",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"isAnchorage",{enumerable:!0,get:function(){return n}}),e.isBarFridge=r,Object.defineProperty(e,"chefCanSee",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"demoActor",{enumerable:!0,get:function(){return s}}),e.hasRealSignature=c,e.isDemoCard=function(t){return!c(t)&&(['example','sample','demo'].includes(t.origin||'')||s(t.updatedBy))},Object.defineProperty(e,"isSeedChefChat",{enumerable:!0,get:function(){return u}});const t='6349aa07-3fec-46e9-8c69-7b1b08494793',n=n=>'anchorage'===n||n===t;function r(t){if('string'==typeof t)return/\bbar[\s_-]*(?:fridge|refrigerat)|\b(?:fridge|refrigerator)[\s_-]*(?:in[\s_-]*the[\s_-]*)?bar\b|^cp-bar$/i.test(t);if(!t||'object'!=typeof t)return!1;const n=t;return!!r(['name','label','kind','unit','location','storage','storageLocation'].map(t=>n[t]).filter(t=>'string'==typeof t).join(' '))||['id','key','pointId','name','label','unit','location','storage','storageLocation','aliases'].some(t=>Array.isArray(n[t])?n[t].some(r):'string'==typeof n[t]&&r(n[t]))}const o=(t,o)=>!n(t)||!r(o),s=t=>'string'==typeof t&&/(?:\b(?:example|sample|demo)\b)/i.test(t);function c(t){return[t.signOff?.by,t.allergensConfirmed?.by].some(t=>!!t&&!s(t))}const f={'m-seed-all':'Welcome to the team chat on CoverCharge.','m-seed-kitchen':'Kitchen channel: Head Chef, kitchen team and managers.','m-seed-foh':'Front of house channel: front of house, bar and managers.','m-seed-managers':'Managers channel: owners, managers and the supervisor only.'},u=t=>'system'===t.from&&(!!f[t.id]&&f[t.id]===t.text||'m-seed-all'===t.id&&/this phone only/.test(t.text||''))},1125,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useAsyncStorage",{enumerable:!0,get:function(){return n.useAsyncStorage}}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return o}});var e,t=r(d[0]),u=(e=t)&&e.__esModule?e:{default:e},n=r(d[1]),o=u.default},1126,[1127,1131]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return i}});var e,t=r(d[0]);const o=((e=t)&&e.__esModule?e:{default:e}).default.bind({concatArrays:!0,ignoreUndefined:!0});function n(e,t){const n=window.localStorage.getItem(e);if(n){const l=JSON.parse(n),c=JSON.parse(t),s=JSON.stringify(o(l,c));window.localStorage.setItem(e,s)}else window.localStorage.setItem(e,t)}function l(e,t){return new Promise((o,n)=>{try{const n=e();t?.(null,n),o(n)}catch(e){t?.(e),n(e)}})}function c(e,t,o){return Promise.all(e).then(e=>{const n=o?.(e)??null;return t?.(null,n),Promise.resolve(n)},e=>(t?.(e),Promise.reject(e)))}const s={getItem:(e,t)=>l(()=>window.localStorage.getItem(e),t),setItem:(e,t,o)=>l(()=>window.localStorage.setItem(e,t),o),removeItem:(e,t)=>l(()=>window.localStorage.removeItem(e),t),mergeItem:(e,t,o)=>l(()=>n(e,t),o),clear:e=>l(()=>window.localStorage.clear(),e),getAllKeys:e=>l(()=>{const e=window.localStorage.length,t=[];for(let o=0;o{},multiGet:(e,t)=>c(e.map(e=>s.getItem(e)),t,t=>t.map((t,o)=>[e[o],t])),multiSet:(e,t)=>c(e.map(e=>s.setItem(e[0],e[1])),t),multiRemove:(e,t)=>c(e.map(e=>s.removeItem(e)),t),multiMerge:(e,t)=>c(e.map(e=>s.mergeItem(e[0],e[1])),t)};var i=s},1127,[1128]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u}});var e,t=r(d[0]),u=((e=t)&&e.__esModule?e:{default:e}).default},1128,[1129]); +__d(function(g,r,i,a,m,e,d){'use strict';const t=r(d[0]),{hasOwnProperty:n}=Object.prototype,{propertyIsEnumerable:o}=Object,c=(t,n,o)=>Object.defineProperty(t,n,{value:o,writable:!0,enumerable:!0,configurable:!0}),s=this,f={concatArrays:!1,ignoreUndefined:!1},l=t=>{const c=[];for(const o in t)n.call(t,o)&&c.push(o);if(Object.getOwnPropertySymbols){const n=Object.getOwnPropertySymbols(t);for(const s of n)o.call(t,s)&&c.push(s)}return c};function u(n){return Array.isArray(n)?y(n):t(n)?p(n):n}function y(t){const n=t.slice(0,0);return l(t).forEach(o=>{c(n,o,u(t[o]))}),n}function p(t){const n=null===Object.getPrototypeOf(t)?Object.create(null):{};return l(t).forEach(o=>{c(n,o,u(t[o]))}),n}const b=(t,n,o,s)=>(o.forEach(o=>{void 0===n[o]&&s.ignoreUndefined||(o in t&&t[o]!==Object.getPrototypeOf(t)?c(t,o,h(t[o],n[o],s)):c(t,o,u(n[o])))}),t),O=(t,o,s)=>{let f=t.slice(0,0),y=0;return[t,o].forEach(o=>{const p=[];for(let s=0;s!p.includes(t)),s)}),f};function h(n,o,c){return c.concatArrays&&Array.isArray(n)&&Array.isArray(o)?O(n,o,c):t(o)&&t(n)?b(n,o,l(o),c):u(o)}m.exports=function(...n){const o=h(u(f),this!==s&&this||{},f);let c={_:{}};for(const s of n)if(void 0!==s){if(!t(s))throw new TypeError('`'+s+'` is not an Option Object');c=h(c,{_:s},o)}return c._}},1129,[1130]); +__d(function(g,r,i,a,m,e,d){'use strict';m.exports=t=>{if('[object Object]'!==Object.prototype.toString.call(t))return!1;const o=Object.getPrototypeOf(t);return null===o||o===Object.prototype}},1130,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.useAsyncStorage=function(e){return{getItem:(...t)=>u.default.getItem(e,...t),setItem:(...t)=>u.default.setItem(e,...t),mergeItem:(...t)=>u.default.mergeItem(e,...t),removeItem:(...t)=>u.default.removeItem(e,...t)}};var e,t=r(d[0]),u=(e=t)&&e.__esModule?e:{default:e}},1131,[1127]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"createStore",{enumerable:!0,get:function(){return n}});const t=t=>{let n;const c=new Set,o=(t,o)=>{const s="function"==typeof t?t(n):t;if(!Object.is(s,n)){const t=n;n=(null!=o?o:"object"!=typeof s||null===s)?s:Object.assign({},n,s),c.forEach(c=>c(n,t))}},s=()=>n,u={setState:o,getState:s,getInitialState:()=>l,subscribe:t=>(c.add(t),()=>c.delete(t))},l=n=t(o,s,u);return u},n=n=>n?t(n):t},1132,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"create",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"useStore",{enumerable:!0,get:function(){return o}});var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},u=r(d[1]);const c=e=>e;function o(e,t=c){const u=n.default.useSyncExternalStore(e.subscribe,n.default.useCallback(()=>t(e.getState()),[e,t]),()=>t(e.getInitialState()));return n.default.useDebugValue(u),u}const s=e=>{const t=(0,u.createStore)(e),n=e=>o(t,e);return Object.assign(n,t),n},l=e=>e?s(e):s},1133,[30,1132]); +__d(function(g,r,_i,_a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.sampleFingerprint=i,e.stripOwnerLiveSamples=function(n){const a={};for(const[s,o]of Object.entries(t.OWNER_SAMPLE_HASHES)){const t=n[s]||[];a[s]=t.filter(t=>!o.includes(i(t)))}a.chat=(n.chat||[]).filter(t=>!(0,s.isSeedChefChat)(t));const o=(n.changeRequests||[]).length-a.changeRequests.length;o&&(a.changesUsed=Math.max(0,(n.changesUsed||0)-o));return a},e.stripCoreLiveSamples=function(a){const c={...(0,n.stripCoreChefSamples)(a)};c.giftCards=(a.giftCards||[]).filter(s=>!t.CORE_SAMPLE_HASHES.giftCards.includes(i(s))),c.stampCards=(a.stampCards||[]).filter(s=>!t.CORE_SAMPLE_HASHES.stampCards.includes(i(s))),c.ratings=(a.ratings||[]).filter(t=>!(/^rt-[123]$/.test(t.id)&&(0,s.demoActor)(t.customerName))),i(a.customer)===t.LEGACY_CUSTOMER_HASH&&(c.customer={...a.customer,id:'',name:'',email:'',phone:'',allergies:[],allergyConsent:!1,referralCode:'',marketingOptIn:{}});return c.restaurants=(a.restaurants||[]).filter(t=>!('saltmarsh'===t.id&&['The Venue','Saltmarsh Bistro'].includes(t.name))),c.menu=(c.menu||a.menu||[]).filter(t=>'saltmarsh'!==t.restaurantId).map(t=>t.signOff?t:o(t)),c};var t=r(d[0]),s=r(d[1]),n=r(d[2]);const a=t=>Array.isArray(t)?t.map(a):t&&'object'==typeof t?Object.fromEntries(Object.entries(t).filter(([,t])=>void 0!==t&&'function'!=typeof t).sort(([t],[s])=>ts?1:0).map(([t,s])=>[t,a(s)])):t;function i(t){const s=JSON.stringify(a(t))??"null";let n=2166136261;for(let t=0;t>>0).toString(16)}const o=t=>Array.isArray(t)?t.map(o):t&&'object'==typeof t?Object.fromEntries(Object.entries(t).map(([t,s])=>[t,'allergenNotes'===t&&'string'==typeof s&&/\(example\)/i.test(s)?'':o(s)])):t},1134,[1135,1125,1136]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"OWNER_SAMPLE_HASHES",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"CORE_SAMPLE_HASHES",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"LEGACY_CUSTOMER_HASH",{enumerable:!0,get:function(){return b}});const c={referrals:["43f09bc0","c438fbad","96bf8c62","3399d421"],coats:["f51097ad","2f7efa3a"],merch:["ef6e14e","dbbc0999","dc233c1d"],merchOrders:["13b15512","bc27f242"],offers:["ad0fcde0","59e6c0cf"],photos:["53a60fd9","ab778a74","95de43cd"],changeRequests:["81c5be12","6819542c"],lost:["5bbf0d77","7d3aa9ed","850c049e"],campaigns:["9cdf8346","82150e7"],suppliers:["41df06e7","466e32ac","fa3d8eea","dfafa674","1e26fbd0","c195b120","5fc49e74","6aa8b0af","602fc2e4"],supplierOrders:["22636226","464d6a6a"]},f={giftCards:["b1bba36d","f029bc0e"],stampCards:["e7bedf6f","a3c8404d"]},b="4b1e9971"},1135,[]); +__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.stripCoreChefSamples=function(n){return{bookings:(n.bookings||[]).filter(n=>!((0,e.isAnchorage)(n.restaurantId)&&t[n.id]===n.name)),orders:(n.orders||[]).filter(t=>!((0,e.isAnchorage)(t.restaurantId)&&('ord-seed-1'===t.id&&'R. Gilmour'===t.customerName||'ord-seed-2'===t.id&&'Table 3 guest'===t.customerName))),waitlist:(n.waitlist||[]).filter(t=>!((0,e.isAnchorage)(t.restaurantId)&&('wl-1'===t.id&&'Paterson'===t.name||'wl-2'===t.id&&'Duncan'===t.name))),menu:(n.menu||[]).map(t=>(0,e.isAnchorage)(t.restaurantId)&&(0,e.demoActor)(t.signOff?.by)?{...t,signOff:null}:t),events:(n.events||[]).filter(e=>!(e.example&&('anchorage'===e.restaurantId||null===e.restaurantId))),audit:(n.audit||[]).filter(e=>!('anchorage'===e.restaurantId&&/Example sign-off \(demo\)/i.test(e.text)))}};var e=r(d[0]);const t={'bk-101':'Campbell','bk-102':'Fraser','bk-103':'McLeod','bk-104':'Kerr','bk-105':'Wallace','bk-106':'Boyd','bk-107':'Hamilton','bk-108':'Stewart','bk-109':'Murray'}},1136,[1125]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.archiveChefCache=async function(e,t){const n=JSON.stringify(t);let o=2166136261;for(let e=0;e>>0).toString(16)}`;const c=await i.default.getItem(s);if(c){if(JSON.stringify(JSON.parse(c).rows)===n)return;s+=`:${Date.now()}`}await i.default.setItem(s,JSON.stringify({at:(new Date).toISOString(),store:e,rows:t}))};var e,t=r(d[0]),i=(e=t)&&e.__esModule?e:{default:e}},1137,[1024]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SOUTERS_RESTAURANT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"SOUTERS_BOOKING_URL",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"SOUTERS_CONTACTS",{enumerable:!0,get:function(){return n}});const t={id:'souters',name:"Souter's Inn",tagline:'Culinary excellence meets country hospitality in Kirkoswald',location:'Kirkoswald, South Ayrshire',address:'47 Main Road, Kirkoswald, South Ayrshire KA19 8HY',phone:'01655 760653',website:'https://www.soutersinn.com/',fictional:!1,kitchenHours:{0:['09:00','21:00'],1:['09:00','21:00'],2:['09:00','21:00'],3:['09:00','21:00'],4:['09:00','21:00'],5:['09:00','21:00'],6:['09:00','21:00']},hoursNote:'Public hours: daily from 9am; food listed to 9pm. Closing time (9pm or 10pm) to confirm with the venue. Breakfast until 11.45am; main food from noon.',sections:[],settings:{slotMinutes:15,slotCap:3,bufferMins:5,leadMins:20,takeawayPaused:!0,bookingCoversPerSlot:16,stampTarget:8,stampReward:'',stampMinSpend:1e3,capacityPerHour:0,walkInShare:.35,turnMins:75,orderAtTable:!1,showTakeaway:!1,tableRequests:!0,shortName:"Souter's",deposit:{on:!1,perPersonPence:null,fromParty:null,refundable:null,cutoffHours:null,needsConfirmation:!0,wixLinksOn:!1,policy:'Table deposit policy not set. Ticketed event deposits are separate and are not a table policy.'}}},o='',n={email:'souters@southernayr.com',phone:'01655 760653'}},1138,[]); +__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SOUTERS_MENU",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"SOUTERS_MENU_COUNT",{enumerable:!0,get:function(){return t}});const s=[{id:"su-breakfast-full-breakfast",section:"Breakfast",name:"Full Breakfast",description:"Ayrshire Bacon, Link Sausage, Black Pudding, Potato Scone, Beans, Tomato, Mushrooms & Two Eggs (Poached, Scrambled or Fried) with White or Wholemeal Toast",price:1195,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-eggs-benedict",section:"Breakfast",name:"Eggs Benedict",description:"Two Poached Eggs along with Ayrshire Bacon served on Toasted Muffin topped with Hollandaise Sauce",price:1050,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-french-toast",section:"Breakfast",name:"French Toast",description:"Two Slices of Bloomer Eggy Bread with Ayrshire Bacon and a side of Maple Syrup",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-light-breakfast",section:"Breakfast",name:"Light Breakfast",description:"Ayrshire Bacon, Link Sausage, Beans, Tomato and Two Eggs served Poached, Scrambled or Fried with White or Wholemeal Toast",price:950,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-eggs-royale",section:"Breakfast",name:"Eggs Royale",description:"Two Poached Eggs with Flaked Smoked Salmon served on Toasted Muffin topped with Hollandaise Sauce",price:1150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-fried-scottish-pancakes",section:"Breakfast",name:"Fried Scottish Pancakes",description:"Scottish Pancakes with Ayrshire Bacon and a side of Maple Syrup",price:950,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-add-banana-to-fried-scottish-pancakes",section:"Breakfast add-ons",name:"Add Banana (to Fried Scottish Pancakes)",description:"",price:150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-add-two-eggs-poached-fried-or-scrambled-",section:"Breakfast add-ons",name:"Add Two Eggs \u2013 Poached, Fried or Scrambled (to Fried Scottish Pancakes)",description:"",price:200,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-vegetarian-breakfast",section:"Breakfast",name:"Vegetarian Breakfast",description:"Potato Scone, Tomato, Mushrooms, Beans and Two Eggs served Poached, Scrambled or Fried with White or Wholemeal Toast",price:925,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-smashed-avocado-benedict",section:"Breakfast",name:"Smashed Avocado Benedict",description:"Smashed Avocado Guacamole, 2 Poached Eggs served on Toasted Muffin topped with Hollandaise Sauce",price:1095,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-granola-bowl",section:"Breakfast",name:"Granola Bowl",description:"Almond and Raisin Granola topped with Berries, Natural Yoghurt and Honey",price:895,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-breakfast-burrito",section:"Breakfast",name:"Breakfast Burrito",description:"Crispy Bacon, Two Fried Eggs, Jalape\xf1o Salsa, Guacamole, Cheddar Cheese, Salad & Sour Cream",price:1150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-pancake-stack",section:"Breakfast",name:"Pancake Stack",description:"American style pancakes with Biscoff, Nutella, Chocolate Sauce & Fresh Strawberries",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-breakfast-roll",section:"Breakfast",name:"Breakfast Roll",description:"with a choice of Ayrshire Bacon, Pork Link Sausage, Potato Scone or Egg; 2 Items \xa34.75 | 3 Items \xa35.50",price:425,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-kids-breakfast",section:"Junior / Kids",name:"Kids Breakfast",description:"Pork Link Sausage, Beans, Potato Scone, served with a Slice of Toast",price:495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-kids-pancakes",section:"Junior / Kids",name:"Kids Pancakes",description:"American Style Pancakes served with Syrup, Nutella or Butter & Jam",price:495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-add-banana-or-strawberries-to-kids-panca",section:"Junior / Kids add-ons",name:"Add Banana or Strawberries (to Kids Pancakes)",description:"",price:150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-black-pudding-add-on",section:"Add-ons",name:"Black Pudding (add-on)",description:"",price:150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-beans-add-on",section:"Add-ons",name:"Beans (add-on)",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-smashed-avocado-add-on",section:"Add-ons",name:"Smashed Avocado (add-on)",description:"",price:200,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-pork-link-sausage-add-on",section:"Add-ons",name:"Pork Link Sausage (add-on)",description:"",price:150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-mushrooms-add-on",section:"Add-ons",name:"Mushrooms (add-on)",description:"",price:150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-tomato-add-on",section:"Add-ons",name:"Tomato (add-on)",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-ayrshire-bacon-2-add-on",section:"Add-ons",name:"Ayrshire Bacon (2) (add-on)",description:"",price:150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-haggis-add-on",section:"Add-ons",name:"Haggis (add-on)",description:"",price:150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-egg-add-on",section:"Add-ons",name:"Egg (add-on)",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-potato-scone-add-on",section:"Add-ons",name:"Potato Scone (add-on)",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-bucket-of-chips",section:"Add-ons",name:"Bucket of Chips",description:"",price:425,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-toasted-white-or-wholemeal-bread",section:"Add-ons",name:"Toasted White or Wholemeal Bread",description:"served with Butter and Preserve",price:450,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-white-coffee",section:"Coffee",name:"White Coffee",description:"",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-latte",section:"Coffee",name:"Latte",description:"",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-espresso",section:"Coffee",name:"Espresso",description:"",price:325,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-cappuccino",section:"Coffee",name:"Cappuccino",description:"",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-americano",section:"Coffee",name:"Americano",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-double-espresso",section:"Coffee",name:"Double Espresso",description:"",price:395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-macchiato",section:"Coffee",name:"Macchiato",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-flavour-shot-add-on",section:"Coffee add-ons",name:"Flavour Shot (add-on)",description:"",price:75,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-extra-shot-of-coffee-add-on",section:"Coffee add-ons",name:"Extra Shot of Coffee (add-on)",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-breakfast-tea",section:"Tea",name:"Breakfast Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-camomile-tea",section:"Tea",name:"Camomile Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-earl-grey-tea",section:"Tea",name:"Earl Grey Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-green-tea",section:"Tea",name:"Green Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-peppermint-tea",section:"Tea",name:"Peppermint Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-red-berry-tea",section:"Tea",name:"Red Berry Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-lemon-ginger-tea",section:"Tea",name:"Lemon & Ginger Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-hot-chocolate",section:"Hot chocolate",name:"Hot Chocolate",description:"",price:425,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-luxury-hot-chocolate",section:"Hot chocolate",name:"Luxury Hot Chocolate",description:"with Cream & Marshmallows",price:475,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-freshly-baked-basket-of-bread-with-butte",section:"Starters / bread",name:"Freshly Baked Basket Of Bread With Butter",description:"",price:450,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-add-olive-oil-balsamic-vinegar",section:"Starters / bread",name:"Add Olive Oil & Balsamic Vinegar",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-soup-of-the-day",section:"Starters",name:"Soup of The Day",description:"served with Crusty Bread & Butter",price:650,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-a-la-carte-salad-of-poached-pear-blue-cheese",section:"Starters",name:"Salad Of Poached Pear & Blue Cheese",description:"with Candied Walnuts & French Vinaigrette",price:850,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-fresh-water-prawns",section:"Starters",name:"Fresh Water Prawns",description:"coated in Spicy Bang Bang Sauce, topped with Chopped Chilli, Peanuts & Coriander",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-sliced-melon-fresh-fruits",section:"Starters",name:"Sliced Melon & Fresh Fruits",description:"with Coulis & Raspberry Sorbet",price:850,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-chicken-liver-p-t",section:"Starters",name:"Chicken Liver P\xe2t\xe9",description:"with Oatcakes, Plum & Apple Chutney",price:850,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-crispy-salt-pepper-calamari",section:"Starters",name:"Crispy Salt & Pepper Calamari",description:"served with Garlic Mayo & Oriental Dressing",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-steamed-mussels",section:"Starters",name:"Steamed Mussels",description:"with White Wine, Garlic, Shallots & Cream, served with Garlic Bread",price:1150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-creamy-baked-garlic-mushrooms",section:"Starters",name:"Creamy Baked Garlic Mushrooms",description:"with a Cheddar Cheese Gratin",price:895,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-boiled-egg-crispy-bacon-caesar-salad",section:"Starters",name:"Boiled Egg & Crispy Bacon Caesar Salad",description:"with Parmesan & Croutons",price:850,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-grilled-honey-glazed-goat-s-cheese-salad",section:"Starters",name:"Grilled Honey Glazed Goat\u2019s Cheese Salad",description:"with Roquito Peppers & Chilli Jam",price:850,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-sticky-bbq-ribs-in-a-korean-gochujang-sa",section:"Starters",name:"Sticky BBQ Ribs in a Korean Gochujang Sauce",description:"with Onions, Peppers & Sesame Seeds",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-cioppino-fish-soup",section:"Starters",name:"Cioppino Fish Soup",description:"fired up with Fresh Chillies & Smoked Paprika, topped with Croutons & Parmesan",price:1095,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-8oz-fillet-steak",section:"From the grill",name:"8oz Fillet Steak",description:"All served with Tomatoes, Portobello Mushrooms, Onion Rings & your choice of Chips, Boiled or Mashed Potatoes. Includes choice of Peppercorn, Mustard or Red Wine Jus",price:3695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-10oz-sirloin-steak",section:"From the grill",name:"10oz Sirloin Steak",description:"All served with Tomatoes, Portobello Mushrooms, Onion Rings & your choice of Chips, Boiled or Mashed Potatoes. Includes choice of Peppercorn, Mustard or Red Wine Jus",price:3395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-rosemary-garlic-lamb-chops",section:"From the grill",name:"Rosemary & Garlic Lamb Chops",description:"All served with Tomatoes, Portobello Mushrooms, Onion Rings & your choice of Chips, Boiled or Mashed Potatoes. Includes choice of Peppercorn, Mustard or Red Wine Jus",price:2750,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-top-with-breaded-haggis-grill",section:"From the grill add-ons",name:"Top with Breaded Haggis (grill)",description:"",price:250,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-top-with-6-garlic-buttered-prawns-grill",section:"From the grill add-ons",name:"Top with 6 Garlic Buttered Prawns (grill)",description:"",price:750,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-steamed-fillet-of-salmon-with-cheese-gla",section:"Main courses",name:"Steamed Fillet of Salmon with Cheese Glaze",description:"served with Buttered Greens & Creamed Potatoes",price:2150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-breaded-haddock-chips",section:"Main courses",name:"Breaded Haddock & Chips",description:"with Homemade Tartare Sauce & Side Salad",price:1850,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-fish-of-the-day",section:"Main courses",name:"Fish of the Day",description:"Check Chef\u2019s Daily Specials",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,priceNote:"Ask staff",special:!0},{id:"su-a-la-carte-locally-caught-haggis-with-neeps-tatties",section:"Main courses",name:"Locally Caught Haggis with Neeps & Tatties",description:"served with Whisky Peppercorn Sauce & Greentails",price:1795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-breast-of-cajun-spiced-chicken",section:"Main courses",name:"Breast Of Cajun Spiced Chicken",description:"with Capsicums, Rice Pilaf & a Curried Coconut & Mango Chutney Sauce",price:1850,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-chicken-schnitzel",section:"Main courses",name:"Chicken Schnitzel",description:"Pan-Fried in Breadcrumbs, served with Crispy Bacon, Grilled Pineapple & Chips",price:1895,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-beef-steak-butcher-s-sausage-pie",section:"Main courses",name:"Beef Steak & Butcher\u2019s Sausage Pie",description:"with Creamed Potatoes & Buttered Carrots",price:1895,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-madras-spiced-lamb-curry",section:"Main courses",name:"Madras Spiced Lamb Curry",description:"with Chillies, Pineapple & Coriander, served with Aromatic Rice, Spiced Onions & a Poppadom",price:1895,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-pan-fried-lambs-liver",section:"Main courses",name:"Pan-Fried Lambs Liver",description:"with Saut\xe9ed Onions, Smoked Bacon, Grilled Tomato, Creamed Potatoes & Red Wine Gravy",price:1750,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-8oz-cheeseburger",section:"Main courses",name:"8oz Cheeseburger",description:"with Bacon, Peppered Mayo, Pickles & Tomato, served with Coleslaw & Chips",price:1795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-add-haggis-to-cheeseburger",section:"Main courses add-ons",name:"Add Haggis (to Cheeseburger)",description:"",price:250,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-panko-breaded-chicken-burger",section:"Main courses",name:"Panko Breaded Chicken Burger",description:"in a Toasted Brioche Bun, with Curried Slaw, Katsu Sauce & Chips",price:1795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-macaroni-cheese",section:"Main courses",name:"Macaroni Cheese",description:"with Leeks, English Mustard & Matured Cheddar, served with Garlic Bread",price:1795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-add-bacon-to-macaroni-cheese",section:"Main courses add-ons",name:"Add Bacon (to Macaroni Cheese)",description:"",price:150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-penne-pasta-arrabbiata",section:"Main courses",name:"Penne Pasta Arrabbiata",description:"with Peppers, Vine Tomatoes, Chilli & Basil, served with Garlic Bread",price:1795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-melon-prawn-salad",section:"Salads",name:"Melon & Prawn Salad",description:"with Marie Rose Cocktail Dressing; served with a choice of Chips or Boiled Potatoes",price:1795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-ploughman-s-salad",section:"Salads",name:"Ploughman\u2019s Salad",description:"Souter\u2019s Sausage Roll, Matured Cheddar, Pickle, Gammon, Boiled Egg & Crusty Bread; served with a choice of Chips or Boiled Potatoes",price:1695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-cajun-spiced-fillet-of-salmon",section:"Salads",name:"Cajun Spiced Fillet Of Salmon",description:"with Curried Coleslaw, Cashew Nuts & a Chilli, Ginger & Citrus Dressing; served with a choice of Chips or Boiled Potatoes",price:1850,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-garlic-chicken-caesar-salad",section:"Salads",name:"Garlic Chicken Caesar Salad",description:"with Croutons, Parmesan, Baby Gem Lettuce, Boiled Egg & Caesar Dressing; served with a choice of Chips or Boiled Potatoes",price:1795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-prawn-smoked-salmon-sandwich",section:"Sandwiches",name:"Prawn & Smoked Salmon Sandwich",description:"with Rocket & Marie Rose Sauce; served on White or Malted Bread with Kettle Chips, Coleslaw & Side Salad. Available 12 Noon\u20135pm",price:1195,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-tuna-mayonnaise-sandwich",section:"Sandwiches",name:"Tuna Mayonnaise Sandwich",description:"with Red Onion, Cucumber & Gem Lettuce; served on White or Malted Bread with Kettle Chips, Coleslaw & Side Salad. Available 12 Noon\u20135pm",price:1050,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-spicy-bang-bang-chicken-sandwich",section:"Sandwiches",name:"Spicy Bang Bang Chicken Sandwich",description:"with Sriracha Mayonnaise, Peppers & Coriander; served on White or Malted Bread with Kettle Chips, Coleslaw & Side Salad. Available 12 Noon\u20135pm",price:1195,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-basil-pesto-chicken-sandwich",section:"Sandwiches",name:"Basil Pesto Chicken Sandwich",description:"with Tomatoes, Red Onion & Mayonnaise; served on White or Malted Bread with Kettle Chips, Coleslaw & Side Salad. Available 12 Noon\u20135pm",price:1095,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-smoked-ham-matured-cheddar-cheese-sandwi",section:"Sandwiches",name:"Smoked Ham & Matured Cheddar Cheese Sandwich",description:"with Mustard Mayonnaise; served on White or Malted Bread with Kettle Chips, Coleslaw & Side Salad. Available 12 Noon\u20135pm",price:1095,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-egg-mayonnaise-sandwich",section:"Sandwiches",name:"Egg Mayonnaise Sandwich",description:"with Spring Onion & Chives; served on White or Malted Bread with Kettle Chips, Coleslaw & Side Salad. Available 12 Noon\u20135pm",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-add-a-cup-of-soup-with-any-sandwich",section:"Sandwiches add-ons",name:"Add a Cup of Soup (with any Sandwich)",description:"",price:395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-chips",section:"Sides",name:"Chips",description:"",price:425,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-cajun-chips",section:"Sides",name:"Cajun Chips",description:"",price:495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-creamed-potatoes",section:"Sides",name:"Creamed Potatoes",description:"",price:450,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-onion-rings",section:"Sides",name:"Onion Rings",description:"",price:495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-mac-cheese-side",section:"Sides",name:"Mac & Cheese (side)",description:"",price:595,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-seasonal-mixed-vegetables",section:"Sides",name:"Seasonal Mixed Vegetables",description:"",price:450,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-souter-s-coleslaw",section:"Sides",name:"Souter\u2019s Coleslaw",description:"",price:395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-curried-coleslaw",section:"Sides",name:"Curried Coleslaw",description:"",price:395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-souter-s-side-salad",section:"Sides",name:"Souter\u2019s Side Salad",description:"",price:425,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-garlic-bread",section:"Sides",name:"Garlic Bread",description:"",price:395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-garlic-bread-with-cheese",section:"Sides",name:"Garlic Bread with Cheese",description:"",price:450,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-fresh-fruit-salad-sorbet",section:"Starters",name:"Fresh Fruit Salad & Sorbet",description:"",price:300,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-soup-of-the-day",section:"Starters",name:"Soup of the Day",description:"",price:300,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-kids-garlic-bread-with-or-without-cheese",section:"Starters",name:"Garlic Bread (with or without Cheese)",description:"",price:300,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-macaroni-cheese",section:"Main courses",name:"Macaroni Cheese",description:"All main dishes served with carrots, peas and a choice of chips or mash",price:695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-breaded-goujons-of-chicken",section:"Main courses",name:"Breaded Goujons of Chicken",description:"All main dishes served with carrots, peas and a choice of chips or mash",price:695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-mini-breaded-fish",section:"Main courses",name:"Mini Breaded Fish",description:"All main dishes served with carrots, peas and a choice of chips or mash",price:695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-roast-chicken-salad",section:"Main courses",name:"Roast Chicken Salad",description:"All main dishes served with carrots, peas and a choice of chips or mash",price:695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-grilled-sausages-or-chicken-with-gravy",section:"Main courses",name:"Grilled Sausages or Chicken with Gravy",description:"All main dishes served with carrots, peas and a choice of chips or mash",price:695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-sticky-toffee-pudding",section:"Sweet treats",name:"Sticky Toffee Pudding",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-cone-from-the-counter",section:"Sweet treats",name:"Cone from the Counter",description:"",price:185,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-kids-ice-cream-sundae",section:"Sweet treats",name:"Kids Ice Cream Sundae",description:"Two scoops, Sprinkles, Flakes, along with a choice of Sauce \u2013 Chocolate / Strawberry",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-kids-juice-apple-orange-pineapple",section:"Drinks",name:"Juice \u2013 Apple / Orange / Pineapple",description:"",price:185,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-simply-fruit-shoot-orange-blackcurrant",section:"Drinks",name:"Simply Fruit Shoot \u2013 Orange / Blackcurrant",description:"",price:200,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-diluting-juice-orange-blackcurrant",section:"Drinks",name:"Diluting Juice \u2013 Orange / Blackcurrant",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-milk",section:"Drinks",name:"Milk",description:"",price:175,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-coke-diet-coke-lemonade",section:"Drinks",name:"Coke / Diet Coke / Lemonade",description:"",price:200,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-kids-milk-shake-chocolate-strawberry",section:"Drinks",name:"Kids Milk Shake \u2013 Chocolate / Strawberry",description:"",price:250,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-souter-s-sticky-toffee-pudding",section:"Dessert",name:"Souter\u2019s Sticky Toffee Pudding",description:"with Butterscotch Sauce & Vanilla Ice Cream",price:795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-cherry-almond-tart",section:"Dessert",name:"Cherry & Almond Tart",description:"with Cr\xe8me Anglaise & Wild Cherry Ripple Ice Cream",price:795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-individual-banoffee-pie",section:"Dessert",name:"Individual Banoffee Pie",description:"topped with Chocolate Shavings, served with Salted Caramel Sauce & Banana Ice Cream",price:795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-souter-s-cheesecake-of-the-day",section:"Dessert",name:"Souter\u2019s Cheesecake of the Day",description:"Please ask your Server for Today\u2019s Choice",price:795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-desserts-warm-chocolate-fudge-cake",section:"Dessert",name:"Warm Chocolate Fudge Cake",description:"with Fresh Berries & Honeycomb Ice Cream",price:795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-lemon-meringue-pie",section:"Dessert",name:"Lemon Meringue Pie",description:"with Raspberries & Raspberry Ripple Ice Cream",price:795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-fresh-fruit-salad",section:"Dessert",name:"Fresh Fruit Salad",description:"with Citrus Syrup served with Pouring Cream, Ice Cream or Sorbet",price:700,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-cheeseboard",section:"Dessert",name:"Cheeseboard",description:"A Selection of British & Continental Cheeses with Grapes, Fruit Chutney & Biscuits",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-affogato",section:"Dessert",name:"Affogato",description:"Vanilla Ice Cream with a Shot of Espresso",price:650,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-ice-cream-one-scoop",section:"Ice cream",name:"Ice Cream \u2013 One Scoop",description:"Please ask your Server for Today\u2019s Flavours",price:395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-desserts-ice-cream-two-scoops",section:"Ice cream",name:"Ice Cream \u2013 Two Scoops",description:"Please ask your Server for Today\u2019s Flavours",price:495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-desserts-ice-cream-three-scoops",section:"Ice cream",name:"Ice Cream \u2013 Three Scoops",description:"Please ask your Server for Today\u2019s Flavours",price:595,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-desserts-strawberry-snowball-delight",section:"Sundaes",name:"Strawberry Snowball Delight",description:"Vanilla & Strawberry Ice cream, Crushed Meringue, Fresh Strawberries, Strawberry Sauce, topped with a Snowball & a Wafer",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-biscoff-sundae",section:"Sundaes",name:"Biscoff Sundae",description:"Biscoff & Toffee Fudge Ice Cream, Whipped Cream, Crushed Lotus Biscoff Biscuits, Biscoff Topping Sauce & a Wafer",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-kinder-bueno-sundae",section:"Sundaes",name:"Kinder Bueno Sundae",description:"Kinder Bueno & Chocolate Ice Cream, Whipped Cream, Kinder Bueno Pieces, Chocolate Sauce & a Wafer",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-white-coffee",section:"Coffee",name:"White Coffee",description:"",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-latte",section:"Coffee",name:"Latte",description:"",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-cappuccino",section:"Coffee",name:"Cappuccino",description:"",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-macchiato",section:"Coffee",name:"Macchiato",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-americano",section:"Coffee",name:"Americano",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-espresso",section:"Coffee",name:"Espresso",description:"",price:325,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-double-espresso",section:"Coffee",name:"Double Espresso",description:"",price:395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-flavour-shot-add-on",section:"Coffee add-ons",name:"Flavour Shot (add-on)",description:"",price:75,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-extra-shot-of-coffee-add-on",section:"Coffee add-ons",name:"Extra Shot of Coffee (add-on)",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-breakfast-tea",section:"Tea",name:"Breakfast Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-camomile-tea",section:"Tea",name:"Camomile Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-earl-grey-tea",section:"Tea",name:"Earl Grey Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-green-tea",section:"Tea",name:"Green Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-peppermint-tea",section:"Tea",name:"Peppermint Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-red-berry-tea",section:"Tea",name:"Red Berry Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-lemon-ginger-tea",section:"Tea",name:"Lemon & Ginger Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-hot-chocolate",section:"Hot chocolate",name:"Hot Chocolate",description:"",price:425,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-luxury-hot-chocolate",section:"Hot chocolate",name:"Luxury Hot Chocolate",description:"with Cream & Marshmallows",price:475,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-chilled-melon-seasonal-fruits",section:"Starters",name:"Chilled Melon & Seasonal Fruits",description:"with Fruit Coulis & Sorbet",price:850,dietary:["V","VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-creamy-garlic-mushrooms",section:"Starters",name:"Creamy Garlic Mushrooms",description:"with Cheddar Cheese & Crusty Bread",price:895,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-mediterranean-tomato-chunky-vegetable-so",section:"Starters",name:"Mediterranean Tomato & Chunky Vegetable Soup",description:"with Crusty Bread",price:650,dietary:["V","VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-honey-glazed-goats-cheese",section:"Starters",name:"Honey Glazed Goats Cheese",description:"with Tomato & Rocket Salad, Basil Pesto & Balsamic Dressing",price:850,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-freshly-baked-basket-of-bread",section:"Starters",name:"Freshly Baked Basket of Bread",description:"with Butter",price:450,dietary:["V","VG"],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-vegetarian-vegan-add-olive-oil-balsamic",section:"Starters",name:"Add Olive Oil & Balsamic",description:"",price:100,dietary:["V","VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-boiled-egg-caesar-salad",section:"Starters",name:"Boiled Egg Caesar Salad",description:"with Croutons, Garlic Dressing & Vegetarian Cheese Shavings",price:795,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-salad-of-poached-pear-candied-walnuts",section:"Starters",name:"Salad of Poached Pear & Candied Walnuts",description:"with French Vinaigrette",price:795,dietary:["V","VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-stuffed-peppers",section:"Main courses",name:"Stuffed Peppers",description:"with Braised Rice, Tomatoes, Basil & Brie, served with a Side Salad & a Bucket of Chips; without Brie is vegan",price:1795,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-vegetable-cashew-nut-stir-fry",section:"Main courses",name:"Vegetable & Cashew Nut Stir Fry",description:"with Hoisin, Ginger & Garlic, served with Aromatic Rice",price:1795,dietary:["V","VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-macaroni-cheese",section:"Main courses",name:"Macaroni Cheese",description:"with Coleman\u2019s Mustard, Leeks & Matured Cheddar, served with Garlic Bread",price:1795,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-pasta-arrabbiata",section:"Main courses",name:"Pasta Arrabbiata",description:"with Peppers, Tomatoes, Chilli & Basil, served with Garlic Bread",price:1795,dietary:["V","VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-creamy-coconut-vegetable-curry",section:"Main courses",name:"Creamy Coconut Vegetable Curry",description:"with Almonds, Cashew Nuts & Coriander, served with Rice, Spiced Onions & a Poppadom",price:1795,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-katsu-vegetable-curry",section:"Main courses",name:"Katsu Vegetable Curry",description:"with Almonds, Cashew Nuts & Coriander, served with Rice, Spiced Onions & a Poppadom",price:1795,dietary:["VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-fresh-fruit-salad",section:"Desserts",name:"Fresh Fruit Salad",description:"with Sorbet",price:700,dietary:["V","VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-sticky-toffee-pudding",section:"Desserts",name:"Sticky Toffee Pudding",description:"with Hot Caramel Sauce & Vanilla Ice Cream",price:795,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-cherry-almond-tart",section:"Desserts",name:"Cherry & Almond Tart",description:"with Wild Cherry Ripple Ice Cream",price:795,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-trillionaire-tart",section:"Desserts",name:"Trillionaire Tart",description:"with Chocolate Pastry, Caramel Toffee & Chocolate Style Ganache, served with Vegan Vanilla Ice Cream",price:795,dietary:["VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-individual-banoffee-pie",section:"Desserts",name:"Individual Banoffee Pie",description:"topped with Chocolate Shavings, served with Salted Caramel Sauce & Banana Ice Cream",price:795,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-warm-chocolate-fudge-cake",section:"Desserts",name:"Warm Chocolate Fudge Cake",description:"with Fresh Berries & Honeycomb Ice Cream",price:795,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-cheeseboard",section:"Desserts",name:"Cheeseboard",description:"served with Oatcakes & Seasonal Chutney",price:995,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-affogato",section:"Desserts",name:"Affogato",description:"1 Scoop of Plain Ice Cream with a shot of Espresso Coffee",price:650,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-floured-bap-with-ayrshire-bacon",section:"Morning (9am\u201312pm)",name:"Floured Bap with Ayrshire Bacon",description:"Available 9am\u201312pm",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-floured-bap-with-pork-link-sausage",section:"Morning (9am\u201312pm)",name:"Floured Bap with Pork Link Sausage",description:"Available 9am\u201312pm",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-floured-bap-with-poached-scrambled-fried",section:"Morning (9am\u201312pm)",name:"Floured Bap with Poached / Scrambled / Fried Egg",description:"Available 9am\u201312pm",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-extra-item-on-floured-bap",section:"Morning (9am\u201312pm)",name:"Extra Item (on Floured Bap)",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-traybakes",section:"Sweet treats",name:"Traybakes",description:"",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-takeaway-freshly-baked-cakes",section:"Sweet treats",name:"Freshly Baked Cakes",description:"",price:450,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-freshly-baked-plain-fruit-scone",section:"Sweet treats",name:"Freshly Baked Plain / Fruit Scone",description:"",price:175,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-soup-of-the-day",section:"Hot food (12pm\u20139pm)",name:"Soup of the Day",description:"with Crusty Bread; available 12pm\u20139pm",price:450,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-takeaway-breaded-haddock-chips",section:"Hot food (12pm\u20139pm)",name:"Breaded Haddock & Chips",description:"with Tartare Sauce",price:1375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-steak-sausage-pie",section:"Hot food (12pm\u20139pm)",name:"Steak & Sausage Pie",description:"with Chips & Gravy",price:1375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-macaroni-cheese",section:"Hot food (12pm\u20139pm)",name:"Macaroni Cheese",description:"with Leeks, Mustard & Matured Cheddar, served with Chips",price:1375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-8oz-burger",section:"Hot food (12pm\u20139pm)",name:"8oz Burger",description:"with Bacon & Cheese, served with Chips",price:1375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-breaded-katsu-chicken-burger",section:"Hot food (12pm\u20139pm)",name:"Breaded Katsu Chicken Burger",description:"with Curried Slaw, served with Chips",price:1375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-cajun-chicken",section:"Hot food (12pm\u20139pm)",name:"Cajun Chicken",description:"with Rice & Coconut Curry Sauce",price:1375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-breaded-goat-s-cheese",section:"Hot food (12pm\u20139pm)",name:"Breaded Goat\u2019s Cheese",description:"with Tomato Salad, Pesto & Chutney, served with Chips",price:1375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-basil-pesto-chicken-sandwich",section:"Sandwiches (12pm\u20135pm)",name:"Basil Pesto Chicken Sandwich",description:"with Tomatoes, Red Onion & Mayonnaise; sandwiches 12pm\u20135pm",price:695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-spicy-bang-bang-chicken-sandwich",section:"Sandwiches (12pm\u20135pm)",name:"Spicy Bang Bang Chicken Sandwich",description:"with Sriracha Mayonnaise, Peppers & Coriander; sandwiches 12pm\u20135pm",price:695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-smoked-ham-matured-cheddar-cheese-sandwi",section:"Sandwiches (12pm\u20135pm)",name:"Smoked Ham & Matured Cheddar Cheese Sandwich",description:"with Mustard Mayonnaise; sandwiches 12pm\u20135pm",price:695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-tuna-mayonnaise-sandwich",section:"Sandwiches (12pm\u20135pm)",name:"Tuna Mayonnaise Sandwich",description:"with Red Onion, Cucumber & Gem Lettuce; sandwiches 12pm\u20135pm",price:595,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-egg-mayonnaise-sandwich",section:"Sandwiches (12pm\u20135pm)",name:"Egg Mayonnaise Sandwich",description:"with Spring Onion & Chives; sandwiches 12pm\u20135pm",price:595,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-pork-fillet-escalopes",section:"Choose your cut",name:"Pork Fillet Escalopes",description:"All served with Grilled Tomato, Portobello Mushroom & your choice of side & sauce",price:2e3,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-8oz-scotch-beef-fillet",section:"Choose your cut",name:"8oz Scotch Beef Fillet",description:"All served with Grilled Tomato, Portobello Mushroom & your choice of side & sauce",price:3e3,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-8oz-scotch-sirloin",section:"Choose your cut",name:"8oz Scotch Sirloin",description:"All served with Grilled Tomato, Portobello Mushroom & your choice of side & sauce",price:2500,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-10oz-scotch-ribeye",section:"Choose your cut",name:"10oz Scotch Ribeye",description:"All served with Grilled Tomato, Portobello Mushroom & your choice of side & sauce",price:3e3,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-scotch-lamb-chops",section:"Choose your cut",name:"Scotch Lamb Chops",description:"All served with Grilled Tomato, Portobello Mushroom & your choice of side & sauce",price:2500,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-600gm-scotch-t-bone-steak",section:"Choose your cut",name:"600gm Scotch T-Bone Steak",description:"All served with Grilled Tomato, Portobello Mushroom & your choice of side & sauce",price:4500,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-souter-s-mixed-grill",section:"Choose your cut",name:"Souter\u2019s Mixed Grill",description:"4oz Sirloin / Chicken Breast / Lamb Chop / Pork Escalope; served with Grilled Tomato, Portobello Mushroom & your choice of side & sauce",price:3500,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-chunky-chips-included-side-choice",section:"Side (included)",name:"Chunky Chips (included side choice)",description:"Included side choice with cut",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-baby-boiled-potatoes-included-side-choic",section:"Side (included)",name:"Baby Boiled Potatoes (included side choice)",description:"Included side choice with cut",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-mashed-potato-included-side-choice",section:"Side (included)",name:"Mashed Potato (included side choice)",description:"Included side choice with cut",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-red-wine-jus-included-sauce-choice",section:"Sauce (included)",name:"Red Wine Jus (included sauce choice)",description:"Included sauce choice with cut",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-peppercorn-included-sauce-choice",section:"Sauce (included)",name:"Peppercorn (included sauce choice)",description:"Included sauce choice with cut",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-mustard-included-sauce-choice",section:"Sauce (included)",name:"Mustard (included sauce choice)",description:"Included sauce choice with cut",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-onion-rings",section:"Upgrade extras",name:"Onion Rings",description:"",price:495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-garden-salad",section:"Upgrade extras",name:"Garden Salad",description:"",price:425,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-mixed-vegetables",section:"Upgrade extras",name:"Mixed Vegetables",description:"",price:450,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-haggis-cake",section:"Upgrade extras",name:"Haggis Cake",description:"",price:200,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-mac-cheese",section:"Upgrade extras",name:"Mac & Cheese",description:"",price:525,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-garlic-prawns",section:"Upgrade extras",name:"Garlic Prawns",description:"",price:750,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-souter-s-coleslaw",section:"Upgrade extras",name:"Souter\u2019s Coleslaw",description:"",price:395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0}].map(s=>({...s,restaurantId:"souters",soldOut:!1,signOff:null})),t=215},1139,[]); +__d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ANCHORAGE_SECTIONS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"anchorageMenu",{enumerable:!0,get:function(){return o}});const i=i=>({id:i,name:'Served with',required:!0,multi:!1,choices:[{id:`${i}-custard`,label:'Custard',priceDelta:0,allergens:{}},{id:`${i}-icecream`,label:'Ice cream',priceDelta:0,allergens:{}},{id:`${i}-cream`,label:'Cream',priceDelta:0,allergens:{}},{id:`${i}-vegan`,label:'Vegan ice cream (ask server)',priceDelta:0,allergens:{}}]}),s=(i,s,n)=>({id:i,name:'Portion',required:!0,multi:!1,choices:[{id:`${i}-starter`,label:'Starter',priceDelta:0},{id:`${i}-main`,label:n,priceDelta:s}]}),n=[{id:'a-soup',section:'Starters',name:"Chef's Soup of the Day",description:'A heartwarming bowl of seasonal homemade soup, served with warm crusty bread and butter.',price:600,dietary:[],allergens:{},allergenNotes:'Recipe changes daily \u2014 check the day\u2019s soup.',prepMins:0},{id:'a-skink',section:'Starters',name:'Cullen Skink',description:'Traditional creamy soup made with locally smoked haddock, potatoes and leeks, served with warm crusty bread and butter.',price:900,dietary:[],allergens:{},prepMins:0},{id:'a-salmon',section:'Starters',name:'Scottish Smoked Salmon Roulade',description:'Delicate Scottish smoked salmon rolled with herb-infused cream cheese, served with garlic & herb crostini and dressed salad.',price:900,dietary:[],allergens:{},prepMins:0},{id:'a-haggis',section:'Starters',name:'Haggis Bon Bons',description:'Crisp golden panko-fried haggis balls, finished with a velvety Scotch whisky sauce and caramelised apple gel.',price:800,dietary:[],allergens:{},allergenNotes:'',prepMins:0},{id:'a-crabcakes',section:'Starters',name:'Spiced Crab Cakes',description:'Golden crab cakes, delicately seasoned with herbs and spices, served with crisp seasonal salad and house-made Marie Rose sauce.',price:900,dietary:[],allergens:{},allergenNotes:'',prepMins:0},{id:'a-tempura',section:'Starters',name:'Deluxe Mixed Tempura',description:"King prawns, chicken and lion's mane mushrooms in a light, crispy tempura batter, served with a dressed seasonal salad and house dipping sauce.",price:1e3,dietary:[],allergens:{},allergenNotes:'',prepMins:0,optionGroups:[s('tempura',900,'Main with triple-cooked chips (\xa319.00)')]},{id:'a-kingoyster',section:'Starters',name:"Pan-Seared King Oyster Mushroom 'Scallops' (VG)",description:"King oyster mushroom 'scallops' prepared with the chef's special recipe of the day. Ask your server or see our specials board for today's garnish and accompaniments.",price:1e3,dietary:['VG'],allergens:{},allergenNotes:'Garnish changes daily \u2014 sign-off needed for each version.',prepMins:0,special:!0,unsigned:!0,optionGroups:[s('kingoyster',800,'Main (\xa318.00)')]},{id:'a-fishsupper',section:'Mains',name:'Fish Supper',description:'Locally landed haddock, available beer-battered or breaded, served with buttered peas, triple-cooked chips and homemade tartare sauce.',price:1800,dietary:['GF option'],allergens:{},allergenNotes:'',prepMins:0,optionGroups:[{id:'fs-coat',name:'Coating',required:!0,multi:!1,choices:[{id:'fs-batter',label:'Beer-battered',priceDelta:0},{id:'fs-bread',label:'Breaded',priceDelta:0}]}]},{id:'a-lionsmane',section:'Mains',name:"Southern Fried Lion's Mane Burger (VG)",description:"Crispy southern fried lion's mane mushroom, layered with vegan cheese and garlic aioli, served with triple-cooked chips and golden onion rings.",price:1800,dietary:['VG'],allergens:{},prepMins:0},{id:'a-pie',section:'Mains',name:'Steak & Ale Pie',description:'Slow-braised beef in a rich ale jus beneath golden all-butter puff pastry, served with buttered seasonal vegetables.',price:1800,dietary:[],allergens:{},prepMins:0,optionGroups:[{id:'pie-side',name:'Served with',required:!0,multi:!1,choices:[{id:'chips',label:'Triple-cooked chips',priceDelta:0},{id:'creamed',label:'Creamed potatoes',priceDelta:0,allergens:{}}]}]},{id:'a-bananablossom',section:'Mains',name:"Beer-Battered Banana Blossom 'Fish' Goujons (VG)",description:'Crisp beer-battered banana blossom goujons, dusted with locally foraged truffle seaweed seasoning, served with triple-cooked chips, garden peas and vegan tartare sauce.',price:1700,dietary:['VG'],allergens:{},allergenNotes:'',prepMins:0},{id:'a-chicken',section:'Mains',name:'Roasted Breast of Chicken',description:'Golden pan-roasted chicken breast, served with creamed potatoes, buttered seasonal primaryBtns, and a fragrant lemon & thyme bouillon.',price:1900,dietary:[],allergens:{},prepMins:0},{id:'a-maccheese',section:'Mains',name:'Macaroni Cheese (V)',description:'Rich mature Cheddar macaroni finished with a golden cheese glaze, served with two slices of garlic bread.',price:1700,dietary:['V'],allergens:{},prepMins:0},{id:'a-penne',section:'Mains',name:'Cajun Chicken & Chorizo Penne Pasta',description:'Tender Cajun-spiced chicken strips, mixed peppers, red onion and smoky chorizo, tossed in a bold, creamy Cajun sauce, served with two slices of garlic bread.',price:1700,dietary:[],allergens:{},prepMins:0},{id:'a-caesar',section:'Mains',name:'Chicken Caesar Salad',description:'Tender pan-roasted chicken breast served on a bed of baby gem lettuce with golden garlic croutons, Parmesan and a classic Caesar dressing.',price:1800,dietary:[],allergens:{},allergenNotes:'',prepMins:0,optionGroups:[{id:'caesar-add',name:'Optional extras',required:!1,multi:!0,choices:[{id:'caesar-bacon',label:'Add smoked Ayrshire bacon',priceDelta:150}]}]},{id:'a-moules',section:'Mains',name:'Moules Marini\xe8re',description:'Fresh Scottish mussels, steamed to perfection in a rich, creamy white wine and garlic sauce.',price:1200,dietary:[],allergens:{},prepMins:0,optionGroups:[s('moules',1e3,'Main 500g with triple-cooked chips (\xa322.00)')]},{id:'a-fillet',section:'From the Grill',name:'8oz Fillet Steak',description:'Prime 8oz fillet steak served with truffled woodland mushrooms, seasonal primaryBtns, golden onion rings and triple-cooked chips.',price:3800,dietary:[],allergens:{},prepMins:0,optionGroups:[{id:'steak-sauce',name:'Sauce',required:!1,multi:!1,choices:[{id:'sauce-pepper',label:'Peppercorn sauce',priceDelta:0,allergens:{}},{id:'sauce-garlic',label:'Garlic butter',priceDelta:0,allergens:{}}]},{id:'steak-surf',name:'Surf & turf add-on',required:!1,multi:!1,choices:[{id:'surf-prawns',label:'Garlic prawns',priceDelta:800,allergens:{}},{id:'surf-scallops',label:'Scottish West Coast scallops',priceDelta:1e3,allergens:{}}]}]},{id:'a-claymore',section:'From the Grill',name:'The Claymore Burger',description:'One juicy 6oz homemade Scottish beef burger in a brioche bun with baby gem lettuce, tomato and gherkins, topped with cheese, smoked Ayrshire bacon and onion rings. Served with triple-cooked chips.',price:1800,dietary:[],allergens:{},prepMins:0,optionGroups:[{id:'claymore-add',name:'Optional extras',required:!1,multi:!0,choices:[{id:'claymore-haggis',label:'Add haggis and whisky sauce',priceDelta:150,allergens:{}}]}]},{id:'a-langoustines',section:"Captain's Table",name:'Whole Scottish Grilled Langoustines',description:'Locally caught whole Scottish langoustines grilled in garlic butter, served with a vibrant side salad and burnt lemon.',price:1700,dietary:[],allergens:{},prepMins:0,optionGroups:[s('lang',1200,'Main 500g with triple-cooked chips (\xa329.00)')]},{id:'a-scallops',section:"Captain's Table",name:'Pan-Seared West Coast Scallops',description:"Scottish West Coast scallops prepared to the chef's recipe of the day. Starter and main portions \u2014 see price on Specials Board.",price:null,priceNote:'See specials board',dietary:[],allergens:{},prepMins:0,special:!0,unsigned:!0},{id:'a-lobster',section:"Captain's Table",name:'Grilled Dunure Lobster',description:'Fresh Dunure lobster, caught locally by "Kitty Fisher", finished in rich garlic butter and served with a vibrant side salad, triple-cooked chips and burnt lemon. When available.',price:3500,dietary:[],allergens:{},prepMins:0,optionGroups:[{id:'lobster-size',name:'Size',required:!0,multi:!1,choices:[{id:'lob-half',label:'Half',priceDelta:0},{id:'lob-whole',label:'Whole (\xa365.00)',priceDelta:3e3}]}]},{id:'a-crab',section:"Captain's Table",name:'Grilled Dunure Crab',description:'Freshly landed Dunure brown crab, caught locally by "Kitty Fisher", finished in rich garlic butter and served with a vibrant side salad, triple-cooked chips and burnt lemon. When available.',price:4e3,dietary:[],allergens:{},prepMins:0},{id:'a-smorgasbord',section:'Platters',name:'Seafood Smorgasbord (serves one)',description:"250g langoustines, 3 pan-seared West Coast scallops, 250g fresh mussels, 6 garlic prawns and a roll of Scottish smoked salmon, with dressed side salad and warm crusty bread.",price:5e3,dietary:[],allergens:{},prepMins:0},{id:'a-deluxe',section:'Platters',name:'Deluxe Seafood Platter (serves two)',description:'One whole Dunure lobster, one whole Dunure crab, 500g whole langoustines, 500g moules marini\xe8re, pan-seared scallops, Scottish smoked salmon and 6 garlic prawns, with two portions of chips, side salad and warm crusty bread.',price:16500,dietary:[],allergens:{},prepMins:0},{id:'a-onionrings',section:'Sides',name:'House Beer-Battered Onion Rings (V)',description:'Crisp house beer-battered onion rings, served golden and crunchy.',price:450,dietary:['V'],allergens:{},allergenNotes:'',prepMins:0},{id:'a-garlicbread',section:'Sides',name:'Garlic Bread (V)',description:'Warm toasted garlic bread, finished with garlic & parsley butter.',price:450,dietary:['V'],allergens:{},prepMins:0,optionGroups:[{id:'gb-add',name:'Optional extras',required:!1,multi:!0,choices:[{id:'gb-cheese',label:'Add cheese',priceDelta:100}]}]},{id:'a-chips',section:'Sides',name:'Triple-Cooked Chips (V)',description:'Golden triple-cooked chips, lightly tossed in Maldon sea salt.',price:450,dietary:['V'],allergens:{},allergenNotes:'',prepMins:0,optionGroups:[{id:'chips-add',name:'Optional extras',required:!1,multi:!0,choices:[{id:'chips-cajun',label:'Add Cajun seasoning',priceDelta:0,allergens:{}}]}]},{id:'a-truffle',section:'Sides',name:'Parmesan & Truffle Fries (V)',description:'Crispy fries topped with finely grated parmesan and tossed in a winter truffle infused oil.',price:500,dietary:['V'],allergens:{},allergenNotes:'',prepMins:0},{id:'a-salad',section:'Sides',name:'Side Salad (VG)',description:'Seasonal mixed leaves with cucumber, red onion and mixed peppers, finished with a light vinaigrette.',price:450,dietary:['VG'],allergens:{},prepMins:0},{id:'a-brulee',section:'Desserts',name:"Chef's Cr\xe8me Br\xfbl\xe9e of the Day (V)",description:"Smooth Madagascan custard with a delicately caramelised sugar crust. Ask your server or see our specials board for today's flavour.",price:800,dietary:['V'],allergens:{},prepMins:0},{id:'a-crumble',section:'Desserts',name:'Seasonal Fruit Crumble (V)',description:'Slow-cooked seasonal fruit topped with a golden buttery crumble.',price:800,dietary:['V'],allergens:{},prepMins:0,optionGroups:[i('crumble')]},{id:'a-stp',section:'Desserts',name:'Sticky Toffee Pudding (V)',description:'A rich, homemade steamed date pudding, drenched in our signature homemade butterscotch sauce.',price:800,dietary:['V'],allergens:{},prepMins:0,optionGroups:[i('stp')]},{id:'a-cheesecake',section:'Desserts',name:'Cheesecake of the Day (V)',description:'A smooth, creamy cheesecake on a buttery biscuit base. Gluten-free and vegan options available.',price:800,dietary:['V'],allergens:{},prepMins:0,optionGroups:[i('cheesecake')]},{id:'a-affogato',section:'Desserts',name:'Affogato (V)',description:'Two scoops of creamy vanilla ice cream with a freshly brewed shot of Italian espresso poured over. Vegan options available.',price:800,dietary:['V'],allergens:{},prepMins:0},{id:'a-mini',section:'Mini Anchors (under 12s)',name:'Mini Anchors meal',description:'Under 12s only. Served with peas or beans. Includes a diluting juice drink & 2 scoops of ice cream. GF options available.',price:900,dietary:['GF option'],allergens:{},prepMins:0,optionGroups:[{id:'mini-main',name:'Choose a meal',required:!0,multi:!1,choices:[{id:'mini-burger',label:'Cheeseburger & chips',priceDelta:0,allergens:{}},{id:'mini-fish',label:'Fish goujons & chips',priceDelta:0,allergens:{}},{id:'mini-mac',label:"Mac 'n' cheese & chips (V)",priceDelta:0,allergens:{}},{id:'mini-chicken',label:'Chicken goujons & chips',priceDelta:0,allergens:{}}]},{id:'mini-veg',name:'With',required:!0,multi:!1,choices:[{id:'mini-peas',label:'Peas',priceDelta:0},{id:'mini-beans',label:'Beans',priceDelta:0}]}]}],t=['Starters','Mains','From the Grill',"Captain's Table",'Platters','Sides','Desserts','Mini Anchors (under 12s)'],o=n.map(({unsigned:i,soldOut:s,...n})=>({...n,allergens:{},allergenNotes:'',prepMins:0,optionGroups:n.optionGroups?.map(i=>({...i,choices:i.choices.map(i=>({...i,allergens:{}}))})),restaurantId:"anchorage",soldOut:!!s,signOff:null}))},1140,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SCOTTISH_BANK_HOLIDAYS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"BANK_HOLIDAY_SOURCE",{enumerable:!0,get:function(){return n}});const t=[{date:"2026-11-30",title:"St Andrew\u2019s Day",notes:""},{date:"2026-12-25",title:"Christmas Day",notes:""},{date:"2026-12-28",title:"Boxing Day",notes:"Substitute day"},{date:"2027-01-01",title:"New Year\u2019s Day",notes:""},{date:"2027-01-04",title:"2nd January",notes:"Substitute day"},{date:"2027-03-26",title:"Good Friday",notes:""},{date:"2027-05-03",title:"Early May bank holiday",notes:""},{date:"2027-05-31",title:"Spring bank holiday",notes:""},{date:"2027-08-02",title:"Summer bank holiday",notes:""},{date:"2027-11-30",title:"St Andrew\u2019s Day",notes:""},{date:"2027-12-27",title:"Christmas Day",notes:"Substitute day"},{date:"2027-12-28",title:"Boxing Day",notes:"Substitute day"},{date:"2028-01-03",title:"New Year\u2019s Day",notes:"Substitute day"},{date:"2028-01-04",title:"2nd January",notes:"Substitute day"},{date:"2028-04-14",title:"Good Friday",notes:""},{date:"2028-05-01",title:"Early May bank holiday",notes:""},{date:"2028-05-29",title:"Spring bank holiday",notes:""},{date:"2028-08-07",title:"Summer bank holiday",notes:""},{date:"2028-11-30",title:"St Andrew\u2019s Day",notes:""},{date:"2028-12-25",title:"Christmas Day",notes:""},{date:"2028-12-26",title:"Boxing Day",notes:""}],n='gov.uk/bank-holidays.json (Scotland)'},1141,[]); +__d(function(g,r,_i,_a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"setMenuCardBridge",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"menuCardBridge",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"resolveItem",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"resolveMenu",{enumerable:!0,get:function(){return m}}),e.sortMenu=c;var t=r(d[0]);let n=null;const o=t=>{n=t},u=()=>n,i=o=>(0,t.overlayItem)(o,n?.cardFor(o.id)),m=t=>c(t.map(i));function c(t){return t.some(t=>'number'==typeof t.sort)?t.map((t,n)=>({m:t,i:n,k:'number'==typeof t.sort?t.sort:10*n})).sort((t,n)=>t.k-n.k||t.i-n.i).map(t=>t.m):t}},1142,[1143]); +__d(function(_g,_r,_i,_a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"canEditCards",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"canSignOffCards",{enumerable:!0,get:function(){return i}}),e.suggestForIngredient=a,e.suggestAllergens=o,Object.defineProperty(e,"suggestedBy",{enumerable:!0,get:function(){return l}}),e.unresolved=c,e.applySuggestions=function(n){const t={...n.allergens};for(const i of c(n))t[i]='contains';return t},Object.defineProperty(e,"cardState",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"STATE_LABEL",{enumerable:!0,get:function(){return f}}),e.signOffBlock=function(n){if(!n.dish.trim())return'Give the dish a name first.';const t=c(n);return t.length?`Check the suggested allergens first: ${t.map(g).join(', ')}.`:n.allergensConfirmed?null:'Confirm the allergen list first.'},Object.defineProperty(e,"allergenList",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"CONTENT_FIELDS",{enumerable:!0,get:function(){return p}}),e.editCard=function(n,t,i,r){const{confirmAllergens:s,...a}=t,l=Object.keys(a).filter(t=>!h(a[t],n[t]));let u={...n};for(const n of l)u[n]=a[n];const f=l.some(n=>'allergens'===n||'dismissed'===n||'ingredients'===n);f&&!h(o(u.ingredients),o(n.ingredients))&&(u.allergensConfirmed=void 0);f&&(l.includes('allergens')||l.includes('dismissed'))&&(u.allergensConfirmed=void 0);let g=!1;!s||u.allergensConfirmed||c(u).length||(u.allergensConfirmed={by:i,at:r},g=!0);const m=l.length>0||g,p=l.length>0&&!!n.signOff;if(!m)return{card:n,changed:!1,resetSignOff:!1};l.length&&(u={...u,signOff:null,version:n.version+1});return{card:{...u,updatedAt:r,updatedBy:i},changed:m,resetSignOff:p}},e.signOffCard=function(n,t,i){return{...n,signOff:{by:t,at:i},wasLive:!0,updatedAt:i,updatedBy:t}},e.overlayItem=function(n,t){return t?{...n,name:t.dish,section:t.section,price:t.price,allergens:t.allergens,allergenNotes:t.allergenNotes,signOff:t.signOff?{by:t.signOff.by,at:t.signOff.at.slice(0,10)}:null,hidden:n.hidden||!t.signOff&&!t.wasLive,recipeCardId:t.id}:n},e.dishesFor=function(n,t){const i=n.filter(n=>!n.hidden),r=i.filter(n=>t.some(t=>'contains'===n.allergens[t])),s=i.filter(n=>!r.includes(n)&&t.some(t=>'may'===n.allergens[t])),a=i.filter(n=>!r.includes(n)&&!s.includes(n));return{contains:r,may:s,free:a}},e.filterCards=function(n,t,i,r="free-from"){const s=t.toLowerCase().split(/\s+/).filter(Boolean);return n.filter(n=>{const t=[n.dish,n.section,...n.ingredients.map(n=>n.name)].join(' ').toLowerCase();return!!s.every(n=>t.includes(n))&&(!i.length||('free-from'===r?i.every(t=>!n.allergens[t]):i.some(t=>!!n.allergens[t])))})},e.uuid=function(){const n=globalThis.crypto;if(n?.randomUUID)return n.randomUUID();const t=Array.from({length:16},()=>Math.floor(256*Math.random()));t[6]=15&t[6]|64,t[8]=63&t[8]|128;const i=t.map(n=>n.toString(16).padStart(2,'0')).join('');return`${i.slice(0,8)}-${i.slice(8,12)}-${i.slice(12,16)}-${i.slice(16,20)}-${i.slice(20)}`},e.uuidFrom=function(n){let t='';for(let i=0;i<4;i++){let r=2166136261^2654435761*i;for(let t=0;t>>0;t+=r.toString(16).padStart(8,'0')}const i=t.slice(0,12)+'4'+t.slice(13,16)+(3&parseInt(t[16],16)|8).toString(16)+t.slice(17,32);return`${i.slice(0,8)}-${i.slice(8,12)}-${i.slice(12,16)}-${i.slice(16,20)}-${i.slice(20,32)}`},Object.defineProperty(e,"RECIPE_CARD_EXTRA_COLUMNS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"STEP_SEP",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"photoPath",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"RECIPE_PHOTO_BUCKET",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"RECIPE_CARD_TABLE",{enumerable:!0,get:function(){return v}}),e.cardToRow=function(n,t){return{row:{id:n.id,venue_id:t,dish:n.dish,ingredients:n.ingredients.map(({name:n,qty:t,unit:i,allergens:r})=>({name:n,qty:t,unit:i,...r?.length?{allergens:r}:{}})),method:n.steps.join(y),allergens:m(n.allergens,'contains'),may_contain:m(n.allergens,'may'),photo_url:!n.photo||n.photo.startsWith('local:')||n.photo.startsWith('asset:')?null:n.photo,signed_off_by:n.signOff?.by??null,signed_off_at:n.signOff?.at??null,updated_at:n.updatedAt},extra:{menu_item_id:n.menuItemId,section:n.section,price_pence:n.price,dismissed:n.dismissed,allergen_notes:n.allergenNotes??null,allergens_confirmed_by:n.allergensConfirmed?.by??null,allergens_confirmed_at:n.allergensConfirmed?.at??null,was_live:n.wasLive,origin:n.origin,version:n.version,updated_by:n.updatedBy}}},e.rowToCard=function(n,t,i={}){const r={};n.may_contain.forEach(n=>{r[n]='may'}),n.allergens.forEach(n=>{r[n]='contains'});const s=n.updated_at??(new Date).toISOString();return{id:n.id,restaurantId:t,menuItemId:i.menu_item_id??n.id,dish:n.dish,section:i.section??'Mains',price:i.price_pence??null,photo:n.photo_url??void 0,ingredients:n.ingredients.map((t,i)=>({id:`${n.id}-i${i}`,...t})),steps:n.method?n.method.split(y).filter(n=>n.trim()):[],allergens:r,dismissed:i.dismissed??[],allergenNotes:i.allergen_notes??void 0,allergensConfirmed:i.allergens_confirmed_by?{by:i.allergens_confirmed_by,at:i.allergens_confirmed_at}:void 0,signOff:n.signed_off_by&&n.signed_off_at?{by:n.signed_off_by,at:n.signed_off_at}:null,wasLive:i.was_live??!!n.signed_off_by,origin:i.origin??'new',version:i.version??1,createdAt:s,updatedAt:s,updatedBy:i.updated_by??''}};var n=_r(d[0]);const t=n=>'head-chef'===n||'manager'===n||'owner'===n,i=n=>'head-chef'===n,r=[[/\b(flour(?!y)|wheat|bread|crumb|panko|pastry|brioche|buns?\b|crouton|crostini|batter|beer|ale\b|lager|stout|barley|malt|rye|spelt|oat|couscous|semolina|pasta|penne|macaroni|spaghetti|noodle|biscuit|sponge|crumble|roux|tempura|digestive|self.raising)/i,['gluten']],[/\b(prawn|langoustine|lobster|crab|shrimp|crayfish|scampi|shellfish)/i,['crustaceans']],[/\b(mussel|scallop|clam|cockle|squid|calamari|octopus|whelk|winkle|oyster(?! mushroom)|oyster sauce)/i,['molluscs']],[/\b(egg|mayonnaise|mayo|aioli|tartare|hollandaise|meringue|custard|brioche|bearnaise)/i,['eggs']],[/\b(fish(?!er)|haddock|cod|salmon|hake|anchov|tuna|mackerel|trout|sea bass|monkfish|pollock|halibut|kipper|worcester|fish sauce|caesar)/i,['fish']],[/\b(peanut|groundnut|satay)/i,['peanuts']],[/\b(almond|hazelnut|walnut|cashew|pecan|pistachio|macadamia|brazil nut|praline|frangipane|marzipan|pesto)/i,['treenuts']],[/\b(soy|soya|tofu|edamame|miso|tamari|tempeh)/i,['soya']],[/\b(milk|butter(?!nut)|cream|cheese|cheddar|parmesan|mozzarella|brie|yoghurt|yogurt|cr[e\xe8]me|ghee|ice cream|custard|butterscotch|toffee|fudge|buttermilk|mascarpone|ricotta|whey)/i,['milk']],[/\b(celery|celeriac|stock cube|beef stock|chicken stock|veg(etable)? stock)/i,['celery']],[/\b(mustard|dijon|vinaigrette|piccalilli)/i,['mustard']],[/\b(sesame|tahini|hummus|houmous)/i,['sesame']],[/\b(wine|vinegar|dried apricot|dried fruit|sulphite|sulfite|prosecco|cider|port\b|sherry|dates?\b|raisin|sultana)/i,['sulphites']],[/\blupin/i,['lupin']]],s=[[/gluten.free|\bgf\b/i,'gluten'],[/dairy.free|vegan (butter|cheese|cream)|oat milk|plant.based/i,'milk'],[/egg.free|vegan mayo/i,'eggs']];function a(t){const i=new Set(t.allergens??[]);for(const[n,s]of r)n.test(t.name)&&s.forEach(n=>i.add(n));for(const[n,r]of s)n.test(t.name)&&!(t.allergens??[]).includes(r)&&i.delete(r);return n.ALLERGENS.map(n=>n.id).filter(n=>i.has(n))}function o(t){const i=new Set(t.flatMap(a));return n.ALLERGENS.map(n=>n.id).filter(n=>i.has(n))}const l=(n,t)=>n.filter(n=>a(n).includes(t)).map(n=>n.name);function c(n){return o(n.ingredients).filter(t=>!n.allergens[t]&&!n.dismissed.includes(t))}const u=n=>n.signOff?'signed-off':'awaiting',f={'signed-off':'Signed off',awaiting:'Awaiting sign-off'};const g=t=>n.ALLERGENS.find(n=>n.id===t)?.short??t,m=(t,i)=>n.ALLERGENS.filter(n=>i?t[n.id]===i:!!t[n.id]).map(n=>n.id),p=['dish','section','price','photo','ingredients','steps','allergens','dismissed','allergenNotes'],h=(n,t)=>JSON.stringify(n??null)===JSON.stringify(t??null);const b={menu_item_id:'text',section:'text',price_pence:'integer null',dismissed:'text[]',allergen_notes:'text',allergens_confirmed_by:'text',allergens_confirmed_at:'timestamptz',was_live:'boolean',origin:'text',version:'integer',updated_by:'text'},y='\n',_=(n,t)=>`${n}/${t.id}-v${t.version}.jpg`,O='recipe-photos',v='recipe_cards'},1143,[814]); +__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"MESSAGING_CONFIG",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"previewProvider",{enumerable:!0,get:function(){return t}}),_e.relayProvider=n,Object.defineProperty(_e,"isLive",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"activeProvider",{enumerable:!0,get:function(){return s}});const e={mode:'preview',endpoint:'',smsService:'Twilio',emailService:'Postmark',smsSenderId:'ANCHORAGE',fromEmail:'bookings@your-venue.co.uk'},t={id:'preview',label:'Preview mode (nothing is sent)',live:!1,deliver:async()=>({ok:!0})};function n(e){return{id:'relay',label:'Your messaging server',live:!0,deliver:async t=>{try{const n=await fetch(e,{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({channel:t.channel,to:t.to,subject:t.subject,body:t.body,html:t.html,ref:t.ref,kind:t.kind,restaurantId:t.restaurantId})});if(!n.ok)return{ok:!1,error:`Server said ${n.status}`};return{ok:!0,providerId:(await n.json().catch(()=>({}))).id}}catch(e){return{ok:!1,error:e?.message??'Network error'}}}}}const o=()=>'live'===e.mode&&!!e.endpoint,s=()=>o()?n(e.endpoint):t},1144,[]); +__d(function(g,_r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TEMPLATE_LABEL",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"DEFAULT_TEMPLATES",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"PLACEHOLDERS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"teamName",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"longDate",{enumerable:!0,get:function(){return u}}),e.bookingVars=function(n,r){const o=n.allergies.map(n=>`${(0,t.allergenLabel)(n.allergen).toLowerCase()}`).join(', '),a=n.allergies.map(n=>`${(0,t.allergenLabel)(n.allergen)} (${(0,t.severityLabel)(n.severity).toLowerCase()})`).join(', '),i=`${n.partySize} ${1===n.partySize?'person':'people'}`,s={...c(r),first:l(n.name),name:n.name.trim(),date:u(n.date),time:n.time,covers:i,ref:n.ref};return{sms:{...s,allergy:n.allergies.length?` We\u2019ve noted the allergy (${o}) and the team will check it with you when you arrive.`:'',note:'',details:''},email:{...s,allergy:n.allergies.length?`Thank you for telling us about: ${a}. Our team will go through this with you when you arrive, and every dish for your table is checked at each step, from the kitchen to your table.`:'',note:n.notes.trim()?`Your note to us: "${n.notes.trim()}". We\u2019ll make sure the team sees it.`:'',details:[`Date: ${u(n.date)}`,`Time: ${n.time}`,`Table for: ${i}`,`Reference: ${n.ref}`].join('\n')}}},e.orderVars=function(r,o){const a=r.lines.reduce((t,n)=>t+n.qty,0),i=r.readyBy??r.slotTime,s=i?`at ${m(i)}`:'time to be confirmed',d=r.allergies.map(n=>(0,t.allergenLabel)(n.allergen).toLowerCase()).join(', '),u=r.allergies.map(n=>`${(0,t.allergenLabel)(n.allergen)} (${(0,t.severityLabel)(n.severity).toLowerCase()})`).join(', '),y={...c(o),first:l(r.customerName),name:r.customerName,ref:r.ref,items:`${a} ${1===a?'item':'items'}`,total:(0,n.gbp)(r.total),collect:s,date:'',time:i?m(i):'',covers:''};return{sms:{...y,allergy:r.allergies.length?` We\u2019ve noted your allergy (${d}); the kitchen checks every item.`:'',itemList:'',details:'',note:''},email:{...y,allergy:r.allergies.length?`You told us about: ${u}. The kitchen signs off every item against it before your order leaves the pass.`:'',itemList:r.lines.map(t=>`${t.qty} \xd7 ${t.name}${t.choices.length?` (${t.choices.join(', ')})`:''}`).join('\n'),details:[`Order: ${r.ref}`,`Collection: ${i?m(i):'time to be confirmed'}`,`Items: ${a}`,`Total: ${(0,n.gbp)(r.total)}`].join('\n'),note:''}}},e.fill=y,Object.defineProperty(e,"fillEmailText",{enumerable:!0,get:function(){return h}}),e.emailHtml=function(t,n){const r=n.accent??'#B8893E',o=t.split(/\n{2,}/).map(t=>{const n=t.split('\n');return n.length>1&&n.every(t=>/^[^:]{2,22}:\s.+/.test(t))?`${n.map(t=>{const n=t.indexOf(':');return``}).join('')}
${p(t.slice(0,n))}${p(t.slice(n+1).trim())}
`:n.length>1&&n.every(t=>/^\d+ \xd7/.test(t))?`
    ${n.map(t=>`
  • ${p(t)}
  • `).join('')}
`:`

${n.map(p).join('
')}

`}).join('');return`${p(n.preheader??'')}
${p(n.venue.toUpperCase())}
${o}
You\u2019re getting this because you made a booking or order with ${p(n.venue)}. It\u2019s about your booking only, not marketing.
`},e.smsParts=function(t){const n=b(t),r=!f.test(n),o=n.length,a=r?o<=70?1:Math.ceil(o/67):o<=160?1:Math.ceil(o/153);return{chars:o,parts:a,unicode:r}},Object.defineProperty(e,"toGsm",{enumerable:!0,get:function(){return b}});var t=_r(_d[0]),n=_r(_d[1]);const r={booking:{title:'Booking confirmed',when:'Every booking: online, phone or in person (and when you confirm a request)'},request:{title:'Booking request received',when:'Online bookings that need you to confirm them first'},declined:{title:'Booking request declined',when:'When you decline a booking request'},order:{title:'Takeaway order confirmed',when:'Every takeaway order from the app (and phone orders with a number)'}},o={booking:{sms:'Hi {first}, you\u2019re booked in at {venue}: {date} at {time}, {covers}. Ref {ref}.{allergy} Need to change or cancel? Just call {venuePhone}. See you soon, {team}',subject:'You\u2019re booked in at {venue}: {date} at {time}',body:'Hi {first},\n\nThank you for booking with us. We\u2019re really looking forward to welcoming you.\n\n{details}\n\n{allergy}\n\n{note}\n\nIf your plans change, just give us a ring on {venuePhone} and we\u2019ll happily move or cancel it for you. Please quote {ref}.\n\nYou\u2019ll find us at {address}.\n\nWarm wishes,\n{team}'},request:{sms:'Hi {first}, thanks for your booking request at {venue} for {date} at {time}, {covers}. We\u2019ll text you shortly to confirm. Ref {ref}. Questions? Call {venuePhone}. {team}',subject:'We\u2019ve got your booking request for {date}',body:'Hi {first},\n\nThank you for your booking request. A member of the team will look at it and confirm with you very shortly.\n\n{details}\n\n{allergy}\n\n{note}\n\nIf you have any questions in the meantime, call us on {venuePhone} and quote {ref}.\n\nWarm wishes,\n{team}'},declined:{sms:'Hi {first}, we\u2019re so sorry, we can\u2019t fit {covers} in on {date} at {time}. Please call {venuePhone} and we\u2019ll do our best to find another time. {team}',subject:'About your booking request for {date}',body:'Hi {first},\n\nThank you for asking to book with us. We\u2019re really sorry, but we can\u2019t fit your party in on {date} at {time}.\n\nWe\u2019d love to find another time that works. Give us a ring on {venuePhone} and we\u2019ll do our best.\n\nWith apologies and warm wishes,\n{team}'},order:{sms:'Hi {first}, thanks for your order {ref} from {venue}: {items}, {total}. Collection {collect}.{allergy} Questions? Call {venuePhone}. {team}',subject:'Your {venue} order {ref}',body:'Hi {first},\n\nThank you for your order. The kitchen has it and we\u2019ll have it ready for you.\n\n{details}\n\n{itemList}\n\n{allergy}\n\nAny questions, or need to change something? Call us on {venuePhone} and quote {ref}.\n\nYou\u2019ll find us at {address}.\n\nEnjoy!\n{team}'}},a=[{key:'first',what:'Guest\u2019s first name'},{key:'name',what:'Name on the booking'},{key:'venue',what:'Venue name'},{key:'date',what:'Day and date'},{key:'time',what:'Time'},{key:'covers',what:'e.g. 4 people'},{key:'ref',what:'Reference'},{key:'venuePhone',what:'Venue phone'},{key:'address',what:'Venue address'},{key:'team',what:'e.g. The Anchorage team'},{key:'allergy',what:'Allergy reassurance (only if one was noted)'},{key:'note',what:'Their note (email only)'},{key:'details',what:'Details box (email only)'},{key:'items',what:'Orders: e.g. 3 items'},{key:'total',what:'Orders: total'},{key:'collect',what:'Orders: collection time'},{key:'itemList',what:'Orders: list of items (email)'}],i=t=>/^the\s/i.test(t.trim())?`${t.trim()} team`:`The ${t.trim()} team`,l=t=>t.trim().replace(/^(mr|mrs|ms|miss|dr)\.?\s+/i,'').split(/\s+/)[0]||'there',s=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],d=['January','February','March','April','May','June','July','August','September','October','November','December'],u=t=>{const[n,r,o]=t.split('-').map(Number),a=new Date(n,r-1,o,12);return`${s[a.getDay()]} ${o} ${d[r-1]}`},m=t=>{const n=new Date(t);return`${String(n.getHours()).padStart(2,'0')}:${String(n.getMinutes()).padStart(2,'0')}`};function c(t){return{venue:t.name,venuePhone:t.phone||'the restaurant',address:t.address||t.location,team:i(t.name)}}function y(t,n){return t.replace(/\{(\w+)\}/g,(t,r)=>r in n?n[r]:t).replace(/[ \t]{2,}/g,' ').replace(/ +([.,])/g,'$1').trim()}const h=(t,n)=>y(t,n).split(/\n{2,}/).map(t=>t.trim()).filter(Boolean).join('\n\n'),p=t=>t.replace(/&/g,'&').replace(//g,'>').replace(/"/g,'"');const f=/^[A-Za-z0-9 \r\n@\xa3$\xa5\xe8\xe9\xf9\xec\xf2\xc7\xd8\xf8\xc5\xe5\u0394_\u03a6\u0393\u039b\u03a9\u03a0\u03a8\u03a3\u0398\u039e\xc6\xe6\xdf\xc9!"#\xa4%&'()*+,\-./:;<=>?\xa1\xc4\xd6\xd1\xdc\xa7\xbf\xe4\xf6\xf1\xfc\xe0^{}\\[~\]|\u20ac]*$/;const b=t=>t.replace(/[\u2018\u2019]/g,"'").replace(/[\u201c\u201d]/g,'"').replace(/[\u2013\u2014]/g,'-').replace(/\u2026/g,'...').replace(/\xd7/g,'x')},1145,[814,816]); +__d(function(g,r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.ukPhone=function(t){const s=(t??'').trim();if(!s)return{ok:!1,error:'A phone number is needed so we can send the confirmation.'};let l=s.replace(/[\s\-().]/g,'');l.startsWith('+44')?l='0'+l.slice(3):l.startsWith('0044')?l='0'+l.slice(4):/^44\d{10}$/.test(l)&&(l='0'+l.slice(2));l.startsWith('0(0)')&&(l=l.replace('0(0)','0'));l.startsWith('00')&&(l=l.slice(1));if(!/^0\d+$/.test(l))return{ok:!1,error:'Please use numbers only, for example 07700 900123.'};const n=/^07\d{9}$/.test(l),o=/^0[1238]\d{8,9}$/.test(l);if(!n&&!o)return{ok:!1,error:'That doesn\u2019t look like a UK mobile or landline. For example 07700 900123 or 01292 502826.'};const c=n?`${l.slice(0,5)} ${l.slice(5)}`:/^02/.test(l)?`${l.slice(0,3)} ${l.slice(3,7)} ${l.slice(7)}`:/^0(3|8)/.test(l)?`${l.slice(0,4)} ${l.slice(4,7)} ${l.slice(7)}`:`${l.slice(0,5)} ${l.slice(5)}`;return{ok:!0,e164:'+44'+l.slice(1),pretty:c,kind:n?'mobile':'landline'}},e.emailOk=function(t){const s=(t??'').trim();return!s||/^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/.test(s)}},1146,[]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"uuid",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"isUuid",{enumerable:!0,get:function(){return t}});const x=()=>globalThis.crypto&&'randomUUID'in globalThis.crypto?globalThis.crypto.randomUUID():'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g,x=>{const t=16*Math.random()|0;return('x'===x?t:3&t|8).toString(16)}),t=x=>'string'==typeof x&&/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(x)},1147,[]); +__d(function(g,r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useShellStore",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"localShellfish",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"shellfish",{enumerable:!0,get:function(){return E}}),Object.defineProperty(_e,"useStockItems",{enumerable:!0,get:function(){return I}}),_e.venueCounts=w,_e.useShellfish=function(e,t,s){const a=I(e).filter(t=>'chef'!==s||(0,n.chefCanSee)(e,t)),o=_(t=>!!t.server[e]),d=_((0,l.useShallow)(t=>t.events.filter(s=>s.rid===e&&(!t.server[e]||k(s))))),u=_((0,l.useShallow)(t=>w(t,e))),c=(0,f.lastUndoable)(d),v=e=>a.find(t=>t.key===e);return{items:a,events:d,counts:u,undoable:c,synced:o,itemOf:v,isLow:e=>(0,f.isLowItem)(v(e),u[e]??0),sell:(n,a=!1)=>{const o=v(n),d=o&&(0,i.fishInStone)(e,o)?i.HALF_STONE_KG:a?.5:1;return!((u[n]??0){i>0&&E.append({rid:e,kind:n,delta:i,reason:'delivery',by:t,app:s})},recount:(n,i)=>{const a=i-(u[n]??0);a&&E.append({rid:e,kind:n,delta:a,reason:'count',by:t,app:s})},undoLast:()=>{c&&E.append({rid:e,kind:c.kind,delta:-c.delta,reason:'undo',by:t,app:s,undoes:c.id})}}};var e,t=r(_d[0]),s=r(_d[1]),n=r(_d[2]),i=r(_d[3]),a=r(_d[4]),o=r(_d[5]),d=(e=o)&&e.__esModule?e:{default:e};r(_d[6]);var u=r(_d[7]),c=r(_d[8]),l=r(_d[9]),f=r(_d[10]),v=r(_d[11]),p=r(_d[12]);const S=()=>{try{return(0,p.nowFrom)(p.useStore.getState().clock)}catch{return new Date}},h='covercharge-shellfish-v1',y='anchorage',_=(0,u.create)()((0,c.persist)(e=>({events:[],items:a.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD?{}:{[y]:f.ANCHORAGE_STOCK.map(e=>({...e}))},server:{},saveItem:(t,s)=>e(e=>{const n=e.items[t]??[];return{items:{...e.items,[t]:n.some(e=>e.key===s.key)?n.map(e=>e.key===s.key?s:e):[...n,s]}}}),removeItem:(t,s)=>e(e=>({items:{...e.items,[t]:(e.items[t]??[]).filter(e=>e.key!==s)}}))}),{name:h,storage:(0,c.createJSONStorage)(()=>d.default),version:4,partialize:e=>({events:e.events,items:e.items,server:e.server}),migrate:async e=>{t.LIVE_VENUE_BUILD&&e&&await(0,s.archiveChefCache)('tracked-stock',e);const n=e??{};return{events:(i=n.events,(i??[]).filter(e=>!e.id.startsWith('sf-seed-'))),items:n.items??(a.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD?{}:{[y]:f.ANCHORAGE_STOCK.map(e=>({...e}))}),server:n.server??{}};var i}})),b={list:e=>_.getState().events.filter(t=>t.rid===e),append:e=>{const t={...e,id:(0,v.uuid)(),at:e.at??S().toISOString()};return _.setState(e=>({events:[t,...e.events].slice(0,500)})),t},subscribe:e=>_.subscribe(e)},E=b;'undefined'!=typeof window&&window.addEventListener('storage',e=>{e.key===h&&_.persist.rehydrate()});const O=[],I=(e,t=!1)=>{const s=_(t=>t.items[e])??O;return t?s:s.filter(e=>e.active).sort((e,t)=>e.sort-t.sort)},k=e=>!e.id.startsWith('sf-');function w(e,t){const s=e.items[t]??[],n=e.server[t],i=e.events.filter(e=>e.rid===t);if(!n)return(0,f.countsOf)(i,s);const a=new Set(n.seen),o=new Date(Date.now()-2592e5).toISOString();return(0,f.countsOf)(i.filter(e=>k(e)&&!a.has(e.id)&&e.at>=o),s,n.counts)}},1148,[833,1137,1125,1149,5,1024,122,1008,1025,871,1151,1147,870]); +__d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"KG_PER_STONE",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"HALF_STONE_KG",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"isFishName",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"fishInStone",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"halfStone",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"toStone",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"fromStone",{enumerable:!0,get:function(){return c}}),e.stoneText=b,e.stoneSpeech=h,Object.defineProperty(e,"fishQtyText",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"fishQtySpeech",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"quantityStep",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"stepQuantity",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"inputQuantity",{enumerable:!0,get:function(){return P}}),Object.defineProperty(e,"quantityUnit",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"displayedCost",{enumerable:!0,get:function(){return k}}),e.parseStoneAmount=function(t){if('number'==typeof t)return Number.isFinite(t)?t:void 0;const n=t.toLowerCase().trim();if(/\b(?:kg|kilos?|kilograms?|grams?)\b/.test(n))return;const i=n.match(/(?:^|\s)(\d+(?:[.,]\d+)?)(\xbd)?(?:\s*(?:stone|st)\b|$)/);if(i)return Number(i[1].replace(',','.'))+(i[2]?.5:0);const o=n.match(/\b(zero|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve|thirteen|fourteen|fifteen|sixteen|seventeen|eighteen|nineteen|twenty)(?: and a half)?(?: stone| st|$)/);return o?l.indexOf(o[1])+(/and a half/.test(o[0])?.5:0):/(?:^|\s)(?:\xbd|(?:a )?half(?: a)?)(?: stone| st|$)/.test(n)?.5:void 0};var t=r(d[0]);const n=6.35029318,i=3.17514659,o=(t="")=>!/\b(?:vegan|vegetarian|banana|blossom|mushroom|sauce|stock|oil)\b|\(vg\)/i.test(t)&&/\b(?:fish|haddock|salmon|cod|hake|halibut|plaice|sole|turbot|trout|mackerel|monkfish|seabass|sea bass|seabream|sea bream|tuna|pollock|coley|whiting|sardines?|anchov(?:y|ies)|herring)\b/i.test(t),u=(n,i)=>(0,t.isAnchorage)(n)&&/^(kg|kilos?|kilograms?|st|stone)$/i.test(i.unit||'')&&o(i.name),s=t=>Math.round(2*(t+Number.EPSILON))/2,f=(t,i="kg")=>/^(st|stone)$/i.test(i)?t:t/n,c=(t,i="kg")=>/^(st|stone)$/i.test(i)?t:t*n;function b(t){const n=s(Math.abs(t)),i=Math.floor(n);return`${t<0&&n?'\u2212':''}${n%1?`${i||''}\xbd`:i} stone`}const l=['zero','one','two','three','four','five','six','seven','eight','nine','ten','eleven','twelve','thirteen','fourteen','fifteen','sixteen','seventeen','eighteen','nineteen','twenty'];function h(t){const n=s(Math.abs(t)),i=Math.floor(n);return`${t<0&&n?'minus ':''}${n%1?i?`${l[i]||i} and a half`:'half a':l[i]||i} stone`}const y=(t,n,i)=>u(t,n)?b(f(i,n.unit)):`${i} ${n.unit||''}`.trim(),p=(t,n,i)=>u(t,n)?h(f(i,n.unit)):y(t,n,i),O=(t,n)=>u(t,n)?c(.5,n.unit):'kg'===n.unit?.5:1,v=(t,n,i,o)=>u(t,n)?c(Math.max(0,s(f(i,n.unit))+.5*o),n.unit):Math.max(0,i+o*O(t,n)),P=(t,n,i)=>u(t,n)?c(s(i),n.unit):i,j=(t,n)=>u(t,n)?'stone':n.unit||'',k=(t,n,i)=>u(t,n)?i*c(1,n.unit):i},1149,[1125]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"shallow",{enumerable:!0,get:function(){return c}});const t=t=>Symbol.iterator in t,n=t=>"entries"in t,o=(t,n)=>{const o=t instanceof Map?t:new Map(t.entries()),s=n instanceof Map?n:new Map(n.entries());if(o.size!==s.size)return!1;for(const[t,n]of o)if(!s.has(t)||!Object.is(n,s.get(t)))return!1;return!0},s=(t,n)=>{const o=t[Symbol.iterator](),s=n[Symbol.iterator]();let c=o.next(),u=s.next();for(;!c.done&&!u.done;){if(!Object.is(c.value,u.value))return!1;c=o.next(),u=s.next()}return!!c.done&&!!u.done};function c(c,u){return!!Object.is(c,u)||"object"==typeof c&&null!==c&&"object"==typeof u&&null!==u&&(Object.getPrototypeOf(c)===Object.getPrototypeOf(u)&&(t(c)&&t(u)?n(c)&&n(u)?o(c,u):s(c,u):o({entries:()=>Object.entries(c)},{entries:()=>Object.entries(u)})))}},1150,[]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ANCHORAGE_STOCK",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"stockKey",{enumerable:!0,get:function(){return n}}),_e.countsOf=function(e,t=[],n={}){const s={...n};for(const e of t)s[e.key]=s[e.key]??0;for(const t of e)s[t.kind]=(s[t.kind]??0)+t.delta;const i=new Map(t.map(e=>[e.key,e]));return Object.fromEntries(Object.entries(s).map(([e,t])=>[e,o(i.get(e),t)]))},_e.lastUndoable=function(e){const t=new Set(e.filter(e=>e.undoes).map(e=>e.undoes));return e.find(e=>'undo'!==e.reason&&'count'!==e.reason&&!t.has(e.id))},Object.defineProperty(_e,"fmtCount",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"fmtStockCount",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"speakStockCount",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"isLowItem",{enumerable:!0,get:function(){return c}}),_e.describe=function(e,t){const n=(t?.name??e.kind).toLowerCase(),o=(t?.plural??`${e.kind}s`).toLowerCase(),u=t?i(e.rid,t,Math.abs(e.delta)):s(Math.abs(e.delta));return'delivery'===e.reason?`Delivery in: +${u} ${1===Math.abs(e.delta)?n:o}`:'sold-half'===e.reason?`Sold: half ${n}`:'sold'===e.reason?`Sold: ${u} ${1===Math.abs(e.delta)?n:o}`:'undo'===e.reason?`Undo (${e.delta>0?'+':'\u2212'}${u} ${n})`:`Count: ${u} ${o}`};var e=r(d[0]);const t=[{key:'lobster',name:'Lobster',plural:'Lobsters',unit:'half',lowAt:4,supplierId:'os-kittyfisher',icon:'\ud83e\udd9e',sort:1,active:!0},{key:'crab',name:'Crab',plural:'Crabs',unit:'whole',lowAt:4,supplierId:'os-kittyfisher',icon:'\ud83e\udd80',sort:2,active:!0}],n=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,'-').replace(/^-|-$/g,'').slice(0,40)||'item',o=(e,t)=>Math.max(0,'kg'===e?.unit?t:'half'===e?.unit?Math.round(2*t)/2:Math.round(t));const s=e=>{const t=Math.floor(e);return e-t>=.5?t?`${t}\xbd`:'\xbd':String(t)},i=(t,n,o)=>'kg'===n.unit?(0,e.fishQtyText)(t,n,o):s(o),u=(t,n,o)=>'kg'===n.unit?(0,e.fishQtySpeech)(t,n,o):s(o),c=(e,t)=>t<=(e?.lowAt??4)},1151,[1149]); +__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"EXAMPLE_TAG",{enumerable:!0,get:function(){return t}}),_e.exampleCards=function(t){return l.flatMap(l=>{const h=t.find(e=>e.id===l.menuItemId);if(!h)return[];return[{id:(0,e.uuidFrom)(`card:${h.restaurantId}:${h.id}`),restaurantId:h.restaurantId,menuItemId:h.id,dish:h.name,section:h.section,price:h.price,photo:l.photo,ingredients:o(l.menuItemId,l.ings),steps:l.steps,allergens:l.allergens,dismissed:l.dismissed??[],allergenNotes:l.notes,allergensConfirmed:{by:s.by,at:s.at},signOff:l.awaiting?null:s,wasLive:!0,origin:'example',version:l.awaiting?2:1,createdAt:n,updatedAt:l.awaiting?'2026-10-28T15:20:00.000Z':n,updatedBy:l.awaiting?'Example edit (demo)':s.by}]})},_e.importedCard=function(t,s){return{id:(0,e.uuidFrom)(`card:${t.restaurantId}:${t.id}`),restaurantId:t.restaurantId,menuItemId:t.id,dish:t.name,section:t.section,price:t.price,ingredients:[],steps:[],allergens:{...t.allergens},dismissed:[],allergenNotes:t.allergenNotes,allergensConfirmed:t.signOff?{by:t.signOff.by,at:t.signOff.at}:void 0,signOff:t.signOff?{by:t.signOff.by,at:t.signOff.at}:null,wasLive:!t.hidden||!!t.signOff,origin:'imported',version:1,createdAt:s,updatedAt:s,updatedBy:'Imported from the menu'}};var e=r(d[0]);const t='Example data',s={by:'Example sign-off (demo)',at:'2026-10-26T10:00:00.000Z'},n='2026-10-26T09:00:00.000Z',o=(e,t)=>t.map(([t,s,n],o)=>({id:`${e}-i${o}`,qty:t,unit:s,name:n})),l=[{menuItemId:'a-lobster',photo:'asset:lobster',ings:[['1','whole','Live Dunure lobster (c. 600 g, Kitty Fisher)'],['60','g','Garlic butter'],['\xbd','','Lemon, charred'],['60','g','Mixed leaves, cucumber and red onion'],['15','ml','House vinaigrette (Dijon mustard)'],['200','g','Triple-cooked chips']],steps:['Chill the lobster for 20 minutes, then dispatch humanely and split lengthways. Remove the stomach sac and the intestinal tract.','Crack the claws. Season the flesh and spoon over half the garlic butter.','Grill flesh side up for 6\u20138 minutes until just opaque; baste with the rest of the butter.','Char the lemon on the grill. Dress the salad at the pass.','Plate on the long board: lobster, claws alongside, salad, chips in the cone, lemon and a pot of the pan butter.'],allergens:{crustaceans:'contains',milk:'contains',mustard:'contains',gluten:'may',fish:'may'},notes:'Chips are cooked in a shared fryer (gluten, fish, crustaceans may be present).'},{menuItemId:'a-skink',photo:'asset:skink',ings:[['120','g','Smoked haddock, undyed'],['200','ml','Whole milk'],['20','g','Butter'],['60','g','Leek, sliced'],['40','g','Onion, diced'],['120','g','Floury potato, diced'],['1','tbsp','Parsley, chopped'],['1','slice','Crusty bread'],['10','g','Butter (portion)']],steps:['Poach the haddock in the milk for 5 minutes. Lift out, flake and keep the milk.','Sweat the leek and onion in the butter until soft, with no colour.','Add the potato and the poaching milk; simmer for 15 minutes until the potato breaks down.','Crush a third of the potato for body, return the haddock and season with pepper.','Serve in the warm bowl, parsley on top, bread and butter on the side.'],allergens:{fish:'contains',milk:'contains',gluten:'contains'}},{menuItemId:'a-fishsupper',photo:'asset:fishsupper',ings:[['200','g','Haddock fillet, locally landed'],['80','g','Self-raising flour'],['100','ml','Beer (lager)'],['250','g','Triple-cooked chips'],['80','g','Garden peas'],['10','g','Butter'],['40','g','Tartare sauce (mayonnaise, capers, gherkins)'],['\xbc','','Lemon']],steps:['Whisk the flour and cold beer to a thick batter; rest for 10 minutes.','Dust the haddock in flour, dip in the batter and lower into the fryer at 180 \xb0C for 5\u20136 minutes.','Fry the chips at 190 \xb0C until golden.','Warm the peas with the butter.','Plate the fish on the chips, peas in the ramekin, tartare and lemon on the side.'],allergens:{fish:'contains',gluten:'contains',eggs:'contains',milk:'contains',mustard:'may',crustaceans:'may',sulphites:'may'},notes:'Shared fryer. Tartare is made with mayonnaise (egg, may contain mustard). The beer in the batter may contain sulphites.'},{menuItemId:'a-moules',photo:'asset:moules',ings:[['500','g','Scottish rope mussels, cleaned'],['30','g','Butter'],['1','','Shallot, finely diced'],['2','cloves','Garlic, sliced'],['100','ml','Dry white wine'],['60','ml','Double cream'],['1','tbsp','Parsley, chopped'],['2','slices','Crusty bread']],steps:['Check every mussel: discard any that are cracked or stay open when tapped.','Sweat the shallot and garlic in the butter for 2 minutes.','Add the mussels and wine, cover and steam on a high heat for 3\u20134 minutes until they open.','Discard any that stay shut. Stir in the cream and parsley.','Serve in the deep bowl with the bread and an empty-shell bowl.'],allergens:{molluscs:'contains',milk:'contains',sulphites:'contains',gluten:'contains'}},{menuItemId:'a-stp',photo:'asset:stp',awaiting:!0,ings:[['30','g','Medjool dates, chopped'],['40','ml','Boiling water'],['25','g','Butter'],['30','g','Dark muscovado sugar'],['1','','Egg (\xbd per portion)'],['35','g','Self-raising flour'],['60','ml','Butterscotch sauce (butter, cream, brown sugar)']],steps:['Soak the dates in the boiling water for 10 minutes, then blitz.','Cream the butter and sugar, beat in the egg, fold in the flour and the dates.','Steam in buttered moulds for 35 minutes.','Warm the butterscotch sauce.','Turn out, pour over the sauce and serve with the guest\u2019s choice of custard, ice cream or cream.'],allergens:{gluten:'contains',milk:'contains',eggs:'contains',sulphites:'may'},notes:'Dried dates may contain sulphites. Accompaniments are chosen at order (see the dish options).'}]},1152,[1143]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/owner-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg",width:800,height:600,toString(){return this.uri}}},1153,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/owner-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg",width:800,height:600,toString(){return this.uri}}},1154,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/owner-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg",width:800,height:600,toString(){return this.uri}}},1155,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/owner-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg",width:800,height:600,toString(){return this.uri}}},1156,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/owner-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg",width:800,height:600,toString(){return this.uri}}},1157,[]); +__d(function(g,r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"gid",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"SEED_CALC_INGREDIENTS",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"SEED_CALC_DISHES",{enumerable:!0,get:function(){return I}}),_e.stripGpSamples=y,Object.defineProperty(_e,"useGpCalc",{enumerable:!0,get:function(){return v}}),_e.useGpCalcView=function(){const e=v();return(0,t.useMemo)(()=>i.LIVE_VENUE_BUILD?{...e,...y(e)}:e,[e])};var e,i=r(_d[0]),t=r(_d[1]),s=r(_d[2]),a=r(_d[3]),n=r(_d[4]),c=(e=n)&&e.__esModule?e:{default:e},d=r(_d[5]),o=r(_d[6]),p=r(_d[7]);let l=0;const f=e=>`${e}-${Date.now().toString(36)}${(l++).toString(36)}`,h=(e,i,t,s,a,n=0,c=[])=>({id:e,name:i,packSize:t,packUnit:s,packPrice:a,wastePct:n,allergens:c}),u=e=>new Date(Date.now()-864e5*e).toISOString(),k={'gi-haddock':[8100,8700,8500],'gi-chicken':[4500,4600,4750],'gi-steak':[6200,5900,6e3],'gi-potato':[1450,1500,1600],'gi-oil':[3400,3300,3200]},S=[h('gi-haddock','Haddock fillet',5,'kg',8500,5,['fish']),h('gi-potato','Potatoes (chipping)',25,'kg',1600,20),h('gi-batter','Batter mix',3.5,'kg',770,0,['gluten']),h('gi-oil','Rapeseed oil',20,'L',3200),h('gi-peas','Garden peas (frozen)',2.5,'kg',450),h('gi-lemon','Lemons',80,'each',1600),h('gi-mayo','Mayonnaise',5,'L',1250,0,['eggs','mustard']),h('gi-capers','Capers',1,'kg',900,0,['sulphites']),h('gi-gherkin','Gherkins',2,'kg',700,0,['sulphites']),h('gi-steak','Braising steak',5,'kg',6e3,10),h('gi-pastry','Puff pastry',5,'kg',2250,0,['gluten','milk']),h('gi-onion','Onions',10,'kg',1e3,10),h('gi-stock','Beef stock',1,'L',350,0,['celery']),h('gi-chicken','Chicken breast',5,'kg',4750),h('gi-leaves','Cos lettuce',12,'each',960,15),h('gi-parmesan','Parmesan',1,'kg',1800,0,['milk']),h('gi-bread','Sourdough loaf',1,'each',300,0,['gluten']),h('gi-anchovy','Anchovies',.5,'kg',900,0,['fish']),h('gi-sponge','Date sponge (tray of 12)',1,'each',600,0,['gluten','eggs','milk']),h('gi-toffee','Toffee sauce',2,'L',1100,0,['milk']),h('gi-icecream','Vanilla ice cream',4,'L',1800,0,['milk','eggs'])].map(e=>({...e,prices:(k[e.id]??[e.packPrice]).map((e,i,t)=>({p:e,at:u(7*(t.length-i))}))})),P=(e,i,t,s,a,n,c,d="")=>({id:e,name:i,category:t,lines:s.map(([e,i,t])=>({ingId:e,qty:i,unit:t})),portions:a,target:70,menuPrice:n,status:c,description:d,allergens:[]}),I=[P('gd-chips','Chips (portion)','Sides',[['gi-potato',300,'g'],['gi-oil',50,'ml']],1,450,'ready','Hand-cut, twice-cooked chips.'),P('gd-tartare','Tartare sauce (batch of 20)','Sauces & extras',[['gi-mayo',1,'L'],['gi-capers',100,'g'],['gi-gherkin',150,'g'],['gi-lemon',2,'each']],20,void 0,'draft'),P('gd-fish','Fish & chips (example)','Mains',[['gi-haddock',220,'g'],['gi-batter',60,'g'],['dish:gd-chips',1,'each'],['gi-peas',80,'g'],['dish:gd-tartare',1,'each'],['gi-lemon',1,'each']],1,1695,'ready','Beer-battered haddock, chips, peas and tartare sauce.'),P('gd-pie','Steak pie (example)','Mains',[['gi-steak',2,'kg'],['gi-pastry',800,'g'],['gi-onion',500,'g'],['gi-stock',1,'L']],10,1595,'draft','Slow-braised steak under a puff pastry lid. Batch of 10.'),P('gd-caesar','Chicken Caesar (example)','Starters',[['gi-chicken',160,'g'],['gi-leaves',.5,'each'],['gi-parmesan',15,'g'],['gi-bread',.1,'each'],['gi-anchovy',8,'g']],1,1150,'draft'),P('gd-stp','Sticky toffee pudding (example)','Desserts',[['gi-sponge',.083,'each'],['gi-toffee',60,'ml'],['gi-icecream',70,'ml']],1,695,'ready','Warm date sponge, toffee sauce, vanilla ice cream.')];function y(e){const i=e=>I.some(i=>i.id===e.id&&JSON.stringify(i)===JSON.stringify(e))||/\(example\)/i.test(e.name),t=new Set(e.dishes.filter(e=>!i(e)).map(e=>e.id));let s=!0;for(;s;){s=!1;for(const i of e.dishes.filter(e=>t.has(e.id)))for(const e of i.lines)e.ingId.startsWith('dish:')&&!t.has(e.ingId.slice(5))&&(t.add(e.ingId.slice(5)),s=!0)}const a=e.dishes.filter(e=>t.has(e.id)),n=new Set(a.flatMap(e=>e.lines.map(e=>e.ingId))),c=e=>{const i=S.find(i=>i.id===e.id);if(!i)return!1;const t=({prices:e,...i})=>JSON.stringify(i);return t(i)===t(e)&&(!e.prices?.length||JSON.stringify(e.prices.map(e=>e.p))===JSON.stringify(i.prices?.map(e=>e.p)))};return{dishes:a,ingredients:e.ingredients.filter(e=>n.has(e.id)||!c(e))}}const v=(0,d.create)()((0,o.persist)((e,t)=>({ingredients:a.IS_ISOLATED_VENUE||i.LIVE_VENUE_BUILD?[]:S,dishes:a.IS_ISOLATED_VENUE||i.LIVE_VENUE_BUILD?[]:I,settings:{vatPct:20,pricePoints:!0,defaultTarget:70,multipleBasis:'inc',priceBasis:'latest',avgOf:5},alerts:[],saveIngredient:i=>{const s=t(),a=s.ingredients.find(e=>e.id===i.id),n=s.ingredients.map(e=>e.id===i.id?i:e);let c=s.alerts;if(a&&(a.packPrice!==i.packPrice||a.packSize!==i.packSize||a.wastePct!==i.wastePct)){const e=s.settings.vatPct,t=s.dishes.filter(e=>e.menuPrice).map(i=>{const t=(0,p.gpOf)((0,p.portionCost)(i,s.ingredients,s.dishes),i.menuPrice,e).gpPct,a=(0,p.gpOf)((0,p.portionCost)(i,n,s.dishes),i.menuPrice,e).gpPct;return{id:i.id,name:i.name,before:t,after:a,belowTarget:ae.aftere.packPrice/e.packSize/(1-(e.wastePct||0)/100),o=(d(i)-d(a))/d(a)*100;t.length&&(c=[{id:f('ma'),at:(new Date).toISOString(),ingredient:i.name,change:`${o>=0?'+':''}${o.toFixed(0)}%`,dishes:t},...c].slice(0,20))}e({ingredients:n,alerts:c})},addPricePaid:(e,i,s)=>{const a=t(),n=a.ingredients.find(i=>i.id===e);if(!(n&&i>0))return;const c=[...n.prices?.length?n.prices:[{p:n.packPrice,at:''}],{p:Math.round(i),at:s??(new Date).toISOString()}].slice(-20),d={...n,prices:c};t().saveIngredient({...d,packPrice:(0,p.costingPrice)(d,a.settings.priceBasis,a.settings.avgOf??5)})},addIngredient:i=>{const t=f('gi');return e(e=>({ingredients:[...e.ingredients,{...i,id:t}]})),t},saveDish:i=>e(e=>({dishes:e.dishes.some(e=>e.id===i.id)?e.dishes.map(e=>e.id===i.id?{...i,updatedAt:(new Date).toISOString()}:e):[{...i,updatedAt:(new Date).toISOString()},...e.dishes]})),removeDish:i=>e(e=>({dishes:e.dishes.filter(e=>e.id!==i)})),setSettings:i=>{const s={...t().settings,...i};if(e({settings:s}),void 0!==i.priceBasis||void 0!==i.avgOf)for(const e of t().ingredients){const i=(0,p.costingPrice)(e,s.priceBasis,s.avgOf??5);i!==e.packPrice&&t().saveIngredient({...e,packPrice:i})}},dismissAlert:i=>e(e=>({alerts:e.alerts.filter(e=>e.id!==i)}))}),{name:'covercharge-gpcalc-v1',storage:(0,o.createJSONStorage)(()=>c.default),version:4,migrate:async(e,t)=>(i.LIVE_VENUE_BUILD&&e&&(await(0,s.archiveChefCache)('gpcalc',e),e={...e,...y({...e,dishes:e.dishes||[],ingredients:e.ingredients||[]})}),t<2&&e&&(e.ingredients=(e.ingredients??[]).map(e=>e.prices?.length?e:{...e,prices:[{p:e.packPrice,at:(new Date).toISOString()}]}),e.settings={priceBasis:'latest',avgOf:5,...e.settings??{}}),e)}))},1158,[833,30,1137,5,1024,1008,1025,1159]); +__d(function(g,r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DISH_CATEGORIES",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"pricesOf",{enumerable:!0,get:function(){return n}}),e.priceStats=i,Object.defineProperty(e,"costingPrice",{enumerable:!0,get:function(){return c}}),e.avgMenuPrice=function(t,n,i){const c=t.filter(t=>t.category===n&&t.menuPrice&&t.id!==i).map(t=>t.menuPrice);return c.length?{avg:Math.round(c.reduce((t,n)=>t+n,0)/c.length),count:c.length}:null},Object.defineProperty(e,"unitsFor",{enumerable:!0,get:function(){return a}}),e.lineCost=s,Object.defineProperty(e,"portionCost",{enumerable:!0,get:function(){return u}}),e.suggestAllergens=function t(n,i,c=[],o=0){const a=new Set;for(const s of n.lines)if(s.ingId.startsWith('dish:')){const n=c.find(t=>t.id===s.ingId.slice(5));n&&o<4&&((n.allergens??[]).forEach(t=>a.add(t)),t(n,i,c,o+1).forEach(t=>a.add(t)))}else i.find(t=>t.id===s.ingId)?.allergens?.forEach(t=>a.add(t));return[...a]},Object.defineProperty(e,"exVat",{enumerable:!0,get:function(){return d}}),e.gpOf=function(t,n,i){const c=d(n,i);return{ex:c,gpPct:c>0?(c-t)/c*100:0,cashGp:c-t,foodCostPct:c>0?t/c*100:0}},e.toPricePoint=f,e.suggestPrice=function(t,n,i,c){const o=Math.min(95,Math.max(0,n)),a=t/(1-o/100)*(1+i/100);return c?f(Math.ceil(a)):Math.ceil(a)},Object.defineProperty(e,"toneFor",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"money",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"pct",{enumerable:!0,get:function(){return p}}),e.multipleOf=function(t,n,i,c="inc"){return t<=0?0:('inc'===c?n:d(n,i))/t},Object.defineProperty(e,"fmtX",{enumerable:!0,get:function(){return h}}),e.suggestForMultiple=function(t,n,i,c,o){const a=t*Math.max(0,n)*('ex'===c?1+i/100:1);return o?f(Math.ceil(a)):Math.ceil(a)};const t=['Starters','Mains','From the Grill','Sides','Desserts','Specials','Kids','Sauces & extras'],n=t=>t.prices?.length?t.prices:[{p:t.packPrice,at:''}];function i(t,i=5){const c=n(t),o=c.slice(-Math.max(1,i)),a=Math.round(o.reduce((t,n)=>t+n.p,0)/o.length);return{latest:c[c.length-1].p,avg:a,count:o.length,min:Math.min(...o.map(t=>t.p)),max:Math.max(...o.map(t=>t.p))}}const c=(t,n="latest",c=5)=>'average'===n?i(t,c).avg:i(t,c).latest;const o={kg:{dim:'mass',f:1e3},g:{dim:'mass',f:1},L:{dim:'vol',f:1e3},ml:{dim:'vol',f:1},each:{dim:'each',f:1}},a=t=>'mass'===o[t].dim?['g','kg']:'vol'===o[t].dim?['ml','L']:['each'];function s(t,n,i=[],c=0){if(t.ingId.startsWith('dish:')){const o=i.find(n=>n.id===t.ingId.slice(5));return o&&c<4?u(o,n,i,c+1)*t.qty:0}const a=n.find(n=>n.id===t.ingId);if(!a||!a.packSize)return 0;const s=o[a.packUnit],d=o[t.unit];if(!d||s.dim!==d.dim)return 0;const f=a.packPrice/(a.packSize*s.f),l=Math.min(95,Math.max(0,t.wastePct??a.wastePct??0));return t.qty*d.f*f/(1-l/100)}const u=(t,n,i=[],c=0)=>t.lines.reduce((t,o)=>t+s(o,n,i,c),0)/Math.max(1,t.portions||1);const d=(t,n)=>t/(1+n/100);function f(t){const n=Math.floor(t/100),i=t-100*n;return i<=50?100*n+50:i<=95?100*n+95:100*(n+1)+50}const l=(t,n)=>t>=n-.05?'ok':t>=n-5?'amber':'red',m=t=>`\xa3${(Math.round(t)/100).toFixed(2)}`,p=t=>`${t.toFixed(1)}%`;const h=t=>`${t.toFixed(1)}x`},1159,[]); +__d(function(g,_r,i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"MIN_RADIUS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"MAX_RADIUS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"ACCURACY_CAP",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"DEFAULT_BREAK_OPTIONS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"DEFAULT_CLOCK_AREA",{enumerable:!0,get:function(){return r}}),e.distanceM=s,Object.defineProperty(e,"validLat",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"validLng",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"areaSet",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"clampRadius",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"accuracyAllowance",{enumerable:!0,get:function(){return p}}),e.isInside=h,e.cleanArea=function(t){const n=(t.breakOptions??a).map(t=>Math.round(Number(t))).filter(t=>Number.isFinite(t)&&t>0&&t<=180);return{...r,...t,lat:c(t.lat)?t.lat:null,lng:l(t.lng)?t.lng:null,radius:f(t.radius??r.radius),on:!1!==t.on,offRotaPrompt:!1!==t.offRotaPrompt,breakOptions:[...new Set(n)].sort((t,n)=>t-n).slice(0,12),offRotaTitle:(t.offRotaTitle??'').trim().slice(0,80)||r.offRotaTitle,offRotaBody:(t.offRotaBody??'').trim().slice(0,160)||r.offRotaBody}},Object.defineProperty(e,"ACTION_WORD",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"DENIED_TEXT",{enumerable:!0,get:function(){return m}}),e.gate=function(t,n,o,a,r="browser"){if(!t.on||!d(t)){const r={action:n,at:a,inside:null,unchecked:!0};return'object'==typeof o&&Object.assign(r,{lat:y(o.lat),lng:y(o.lng),acc:Math.round(o.acc)}),{allowed:!0,geo:r,warn:t.on?'The clock-in area isn\u2019t set yet, so location isn\u2019t checked.':void 0}}if('object'!=typeof o){const t='app-phone-off'===r?m['app-phone-off']:'denied'===o?m[r]:'timeout'===o?'Your phone couldn\u2019t find your location in time. Step outside or near a window and try again.':'unsupported'===o?'This phone or browser can\u2019t share its location. Ask a manager to record it for you.':'Your phone couldn\u2019t find your location. Check Location is on, then try again.';return{allowed:!1,message:`You need to be at the venue to ${b[n]}. ${t}`,geo:{action:n,at:a,inside:!1}}}const u=h(t,o),s={action:n,at:a,lat:y(o.lat),lng:y(o.lng),acc:Math.round(o.acc),dist:u.dist,inside:u.inside};if(u.inside)return{allowed:!0,geo:s};const c=u.dist>=1e3?`${(u.dist/1e3).toFixed(1)} km`:`${u.dist} m`;return{allowed:!1,geo:s,message:`You need to be at the venue to ${b[n]}. You look to be about ${c} away (allowed ${u.limit} m). If you\u2019re at the venue, try again in a moment or ask a manager to record it for you.`}},e.overrideGeo=function(t,n,o,a){const r=a.trim();return r.length<3?null:{action:t,at:n,inside:null,override:{by:o.name,byId:o.id,reason:r.slice(0,200)}}},e.offRotaDue=function(t){return!(!(t.area.offRotaPrompt&&d(t.area)&&t.inside)||t.clockedIn||t.dismissedToday)&&!t.shifts.some(n=>t.nowHours>=n.start-1&&t.nowHours<(n.end<=n.start?n.end+24:n.end))},Object.defineProperty(e,"breakLabel",{enumerable:!0,get:function(){return O}});const t=50,n=2e3,o=50,a=[5,10,15,20,30,45,60],r={lat:null,lng:null,radius:100,on:!0,breakOptions:[...a],offRotaPrompt:!0,offRotaTitle:'Do you want to sign in?',offRotaBody:'Should you be on the rota?'},u=t=>t*Math.PI/180;function s(t,n){const o=u(n.lat-t.lat),a=u(n.lng-t.lng),r=Math.sin(o/2)**2+Math.cos(u(t.lat))*Math.cos(u(n.lat))*Math.sin(a/2)**2;return 12742017.6*Math.asin(Math.min(1,Math.sqrt(r)))}const c=t=>'number'==typeof t&&Number.isFinite(t)&&t>=-90&&t<=90,l=t=>'number'==typeof t&&Number.isFinite(t)&&t>=-180&&t<=180,d=t=>c(t.lat)&&l(t.lng),f=o=>Number.isFinite(o)?Math.min(n,Math.max(t,Math.round(o))):r.radius,p=t=>Number.isFinite(t)&&t>0?Math.min(t,o):0;function h(t,n){const o=s({lat:t.lat,lng:t.lng},n),a=f(t.radius)+p(n.acc);return{inside:o<=a,dist:Math.round(o),limit:Math.round(a)}}const b={in:'clock in',out:'clock out',break_start:'start a break',break_end:'end your break'},m={browser:'Location is turned off for this browser. Turn it on in your phone\u2019s settings (Location \u203a allow for this browser), then try again.',iphone:'Location is turned off for this app. On your iPhone open Settings \u203a Privacy & Security \u203a Location Services \u203a Safari Websites and choose While Using the App, then try again.',app:'Location is turned off for this app. Tap Open app settings, then Permissions \u203a Location \u203a Allow only while using the app. Then come back and try again.','app-old':'This version of the app can\u2019t use location. Tap Update the app at the bottom of the screen, then tap Allow when your phone asks.','app-phone-off':'Location is switched off on your phone. Tap Open location settings, turn on Use location, then come back and try again.'};const y=t=>Math.round(1e6*t)/1e6;const O=t=>60===t?'1 hour':t%60==0?t/60+" hours":t>60?`${Math.floor(t/60)} h ${t%60} min`:`${t} min`},1160,[]); +__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.inviteFromLocation=function(n,t){const o=new URLSearchParams(n).get('invite');if(o)return o;const s=(t||'').match(/[#&]invite=([A-Za-z0-9_-]{10,})/);return s?s[1]:null},e.addressWithoutInvite=function(n){try{const t=new URL(n);t.searchParams.delete('invite');const o=t.hash.replace(/^#/,'').split('&').filter(n=>n&&!n.startsWith('invite=')).join('&');return t.hash=o?`#${o}`:'',t.toString()}catch{return n}},e.inviteRefusal=function(n){return/already been used/i.test(n)?'This link has already been used on another device. Ask your manager for a new one.':/expired/i.test(n)?'This link has expired. Ask your manager for a new one.':/replaced|switched off|not valid|invalid|unknown invite/i.test(n)?'This link has been replaced or switched off. Ask your manager for a new one.':/personal app link is incomplete/i.test(n)?'Open the complete personal iPhone link your manager sent.':/no longer active/i.test(n)?'This person is no longer on the team. Ask your manager if this is wrong.':null},Object.defineProperty(e,"WIPE_PREFIXES",{enumerable:!0,get:function(){return n}}),e.keysToWipe=function(t){return t.filter(t=>n.some(n=>t.startsWith(n)))};const n=['covercharge-','cc-sync:','cc-','sb-']},1161,[]); +__d(function(g,r,_i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"hrRemote",{enumerable:!0,get:function(){return y}}),_e.exampleHr=f,_e.stripHrSamples=m,Object.defineProperty(_e,"useHr",{enumerable:!0,get:function(){return q}});var e,t=r(_d[0]),s=r(_d[1]),n=r(_d[2]),o=r(_d[3]),i=r(_d[4]),u=(e=i)&&e.__esModule?e:{default:e},d=r(_d[5]),l=r(_d[6]),c=r(_d[7]),h=r(_d[8]);const y={live:!1,checkout:null,post:null,vote:null,moderate:null,reply:null,trend:null,shouts:null,log:null,refresh:null},v=(e,t,s)=>(0,c.oneWayToken)(e,`shift:${t}:${s}`),p=(e,t)=>{const s=new Date(`${e}T12:00:00Z`);return s.setUTCDate(s.getUTCDate()+t),s.toISOString().slice(0,10)};function f(e,t){const s=[];for(let n=14;n>=1;n--){const o=p(t,-n),i=4===n?2:4+7*n%4;for(let t=0;t!((0,s.isAnchorage)(e.venue)&&e.example)),questions:e.questions.filter(e=>!((0,s.isAnchorage)(e.venue)&&/^hrq-ex-[123]$/.test(e.id))),shouts:e.shouts.filter(e=>!((0,s.isAnchorage)(e.venue)&&/^hrs-ex-[123]$/.test(e.id)))}}const q=(0,d.create)()((0,l.persist)((e,t)=>({secret:(0,c.newSecret)(),answered:[],voted:{},checkins:[],questions:[],shouts:[],log:[],seeded:{},ensure:(s,i)=>{if(n.LIVE_VENUE_BUILD||o.IS_ISOLATED_VENUE||['souters','kirkmichael','wildings'].includes(s)||t().seeded[s]||y.live)return;const u=f(s,i);e(e=>({seeded:{...e.seeded,[s]:!0},checkins:[...e.checkins,...u.checkins],questions:[...e.questions,...u.questions],shouts:[...e.shouts,...u.shouts]}))},hasAnswered:(e,s)=>t().answered.includes(v(t().secret,e,s)),submit:s=>{const n=t(),o=v(n.secret,s.rid,s.shiftKey);if(n.answered.includes(o))return'already';const i=(0,c.checkInPayload)({venue:s.rid,day:s.day,token:o,morale:s.morale,staffing:s.staffing}),u=s.question?(0,c.cleanQuestion)(s.question):null,d=s.shoutTo?.trim().slice(0,80)||void 0,l=s.shoutBody?.trim().slice(0,280)||void 0;return e({answered:[...n.answered,o].slice(-300)}),y.live&&y.checkout?(y.checkout({rid:s.rid,shiftKey:'',day:i.day,morale:i.morale,staffing:i.staffing,question:u??void 0,kind:s.kind??'up',shoutTo:d,shoutBody:l,token:o}),'queued'):(e(e=>({checkins:[...e.checkins,{venue:i.venue,day:i.day,morale:i.morale,staffing:i.staffing}],questions:u?[...e.questions,{id:(0,h.uuid)(),venue:s.rid,body:u,kind:s.kind??'up',up:0,yes:0,no:0,hidden:!1,postedOn:s.day}]:e.questions,shouts:d?[...e.shouts,{id:(0,h.uuid)(),venue:s.rid,day:s.day,to:d,body:l}]:e.shouts})),'ok')},skip:(s,n)=>{const o=t(),i=v(o.secret,s,n);o.answered.includes(i)||e({answered:[...o.answered,i].slice(-300)})},post:(t,s,n,o)=>{const i=(0,c.cleanQuestion)(s);if(!i)return null;const u=(0,h.uuid)();return e(e=>({questions:[...e.questions,{id:u,venue:t,body:i,kind:n,up:0,yes:0,no:0,hidden:!1,postedOn:o}]})),y.live&&y.post&&y.post(t,u,i,n),u},vote:(s,n)=>{const o=t();if(o.voted[s])return!1;const i=o.questions.find(e=>e.id===s);if(!i||i.hidden)return!1;const u='up'===i.kind?1:n;return e({voted:{...o.voted,[s]:u},questions:o.questions.map(e=>e.id===s?(0,c.applyVote)(e,u):e)}),y.live&&y.vote&&y.vote(s,(0,c.oneWayToken)(o.secret,`vote:${s}`),u),!0},moderate:(s,n,o,i)=>{const u=t().questions.find(e=>e.id===s);u&&(e(e=>({questions:e.questions.map(e=>e.id===s?{...e,hidden:'hide'===n}:e),log:[{id:(0,h.uuid)(),venue:u.venue,questionId:s,action:n,reason:o.trim()||void 0,by:i,at:(new Date).toISOString()},...e.log].slice(0,500)})),y.live&&y.moderate&&y.moderate(s,n,o.trim()))},reply:(s,n,o)=>{const i=n.trim().slice(0,600),u=t().questions.find(e=>e.id===s);if(!u)return;const d=(new Date).toISOString();e(e=>({questions:e.questions.map(e=>e.id===s?{...e,reply:i||void 0,replyAt:i?d:void 0}:e),log:[{id:(0,h.uuid)(),venue:u.venue,questionId:s,action:'reply',by:o,at:d},...e.log].slice(0,500)})),y.live&&y.reply&&y.reply(s,i)},setRemoteBoard:(t,s)=>e(e=>({questions:[...e.questions.filter(e=>e.venue!==t),...s]})),upsertRemote:t=>e(e=>({questions:e.questions.some(e=>e.id===t.id)?e.questions.map(e=>e.id===t.id?t:e):[...e.questions,t]}))}),{name:'covercharge-hr-v1',version:3,storage:(0,l.createJSONStorage)(()=>u.default),migrate:async e=>n.LIVE_VENUE_BUILD&&e?(await(0,t.archiveChefCache)('hr',e),{...e,...m(e)}):e}))},1162,[1137,1125,833,5,1024,1008,1025,1163,1147]); +__d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"MIN_ANSWERS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"DEFAULT_WORDING",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"DEFAULT_HR",{enumerable:!0,get:function(){return r}}),e.hrSettingsOf=function(t){const n=t??{},r=n.wording??{},s=Object.fromEntries(Object.entries(o).map(([t,n])=>[t,a(r[t],'intro'===t||'staffing'===t||'question'===t?160:60,n)]));return{on:!1!==n.on,askQuestion:!1!==n.askQuestion,askShout:!1!==n.askShout,board:!1!==n.board,wording:s}},Object.defineProperty(e,"MORALE_STEPS",{enumerable:!0,get:function(){return s}}),e.moraleWord=function(t,n=o){return t<=1?n.moraleLow:t>=5?n.moraleHigh:2===t?'Fairly low':3===t?'OK':'Good'},Object.defineProperty(e,"STAFF_STOPS",{enumerable:!0,get:function(){return u}}),e.snapStaffing=i,e.staffingWord=function(t,n=o){const r=i(t);return r<=12?n.staffLow:r<45?"A bit short":r<=55?n.staffMid:r<88?"A bit over":n.staffHigh},e.oneWayToken=function(n,o){return(0,t.sha256HexSync)(`cc-hr:${n}:${o}`).slice(0,40)},e.newSecret=function(){let t='';const n=globalThis.crypto;if(n?.getRandomValues){return n.getRandomValues(new Uint8Array(24)).forEach(n=>{t+=n.toString(16).padStart(2,'0')}),t}for(let n=0;n<48;n++)t+=Math.floor(16*Math.random()).toString(16);return t},e.checkInPayload=function(t){const n=Math.max(1,Math.min(5,Math.round(t.morale)));return{venue:t.venue,day:t.day,token:t.token,morale:n,staffing:null==t.staffing?null:i(t.staffing)}},e.dayResults=function(t,o=n){const r=new Map;for(const n of t){const t=r.get(n.day)??[];t.push(n),r.set(n.day,t)}const a=[];let s=0;for(const[t,n]of[...r.entries()].sort(([t],[n])=>t.localeCompare(n))){if(n.lengtht.staffing).filter(t=>null!=t);a.push({day:t,answers:n.length,morale:Math.round(n.reduce((t,n)=>t+n.morale,0)/n.length*10)/10,staffing:r.length?Math.round(r.reduce((t,n)=>t+n,0)/r.length):null,short:r.filter(t=>t<45).length,perfect:r.filter(t=>t>=45&&t<=55).length,over:r.filter(t=>t>55).length})}return{shown:a,held:s}},Object.defineProperty(e,"QUESTION_MAX",{enumerable:!0,get:function(){return f}}),e.cleanQuestion=function(t){const n=t.replace(/\s+/g,' ').trim().slice(0,f);return n.length>=3?n:null},e.boardOrder=function(t,n){const o=t=>'up'===t.kind?t.up:t.yes+t.no;return t.filter(t=>n||!t.hidden).sort((t,n)=>Number(t.hidden)-Number(n.hidden)||o(n)-o(t)||n.postedOn.localeCompare(t.postedOn)||t.id.localeCompare(n.id))},e.applyVote=function(t,n){return'up'===t.kind?{...t,up:t.up+1}:1===n?{...t,yes:t.yes+1}:{...t,no:t.no+1}};var t=_r(d[0]);const n=3,o={intro:'Before you go: 3 quick taps, about 15 seconds. Your name is never saved with your answers.',morale:'How was team morale today?',moraleLow:'Low',moraleHigh:'High',staffing:'Was there enough staff on today for the number of customers?',staffLow:'Not enough',staffMid:'Perfect',staffHigh:'Overstaffed',question:'Got a question you\u2019d like to post anonymously for the team to vote on?',shout:'Shout out a teammate?'},r={on:!0,askQuestion:!0,askShout:!0,board:!0,wording:o},a=(t,n,o)=>('string'==typeof t?t.trim().slice(0,n):'')||o;const s=[1,2,3,4,5];const u=[0,12.5,25,37.5,50,62.5,75,87.5,100].map(t=>Math.round(t));function i(t){const n=Math.max(0,Math.min(100,Number.isFinite(t)?t:50));return u.reduce((t,o)=>Math.abs(o-n)>>0;o.push(c>>>24&255,c>>>16&255,c>>>8&255,255&c,h>>>24&255,h>>>16&255,h>>>8&255,255&h);const l=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),u=new Uint32Array(64),f=(t,n)=>t>>>n|t<<32-n;for(let n=0;n>>3,e=f(u[t-2],17)^f(u[t-2],19)^u[t-2]>>>10;u[t]=u[t-16]+n+u[t-7]+e>>>0}let e=l[0],s=l[1],c=l[2],h=l[3],a=l[4],i=l[5],p=l[6],d=l[7];for(let n=0;n<64;n++){const o=d+(f(a,6)^f(a,11)^f(a,25))+(a&i^~a&p)+t[n]+u[n]>>>0,l=(f(e,2)^f(e,13)^f(e,22))+(e&s^e&c^s&c)>>>0;d=p,p=i,i=a,a=h+o>>>0,h=c,c=s,s=e,e=o+l>>>0}l[0]=l[0]+e>>>0,l[1]=l[1]+s>>>0,l[2]=l[2]+c>>>0,l[3]=l[3]+h>>>0,l[4]=l[4]+a>>>0,l[5]=l[5]+i>>>0,l[6]=l[6]+p>>>0,l[7]=l[7]+d>>>0}return Array.from(l).map(t=>t.toString(16).padStart(8,'0')).join('')};const t=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function n(t){const n=[];for(let e=0;e=55296&&o<=56319&&e+1=56320&&n<=57343&&(o=65536+(o-55296<<10)+(n-56320),e++)}o<128?n.push(o):o<2048?n.push(192|o>>6,128|63&o):o<65536?n.push(224|o>>12,128|o>>6&63,128|63&o):n.push(240|o>>18,128|o>>12&63,128|o>>6&63,128|63&o)}return n}},1164,[]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"FunctionRegion",{enumerable:!0,get:function(){return e.FunctionRegion}}),Object.defineProperty(_e,"FunctionsError",{enumerable:!0,get:function(){return e.FunctionsError}}),Object.defineProperty(_e,"FunctionsFetchError",{enumerable:!0,get:function(){return e.FunctionsFetchError}}),Object.defineProperty(_e,"FunctionsHttpError",{enumerable:!0,get:function(){return e.FunctionsHttpError}}),Object.defineProperty(_e,"FunctionsRelayError",{enumerable:!0,get:function(){return e.FunctionsRelayError}}),Object.defineProperty(_e,"PostgrestError",{enumerable:!0,get:function(){return t.PostgrestError}}),Object.defineProperty(_e,"StorageApiError",{enumerable:!0,get:function(){return r.StorageApiError}}),Object.defineProperty(_e,"SupabaseClient",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"createClient",{enumerable:!0,get:function(){return N}});var e=_r(d[0]),t=_r(d[1]),n=_r(d[2]);Object.keys(n).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return n[e]}})});var r=_r(d[3]),s=_r(d[4]);Object.keys(s).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return s[e]}})});let o,i="";var c;if("undefined"!=typeof Deno)i="deno",o=null===(c=Deno.version)||void 0===c?void 0:c.deno;else if("undefined"!=typeof document)i="web";else if("undefined"!=typeof navigator&&"ReactNative"===navigator.product)i="react-native";else{var u;i="node",o="undefined"!=typeof process?null===(u=process.version)||void 0===u?void 0:u.replace(/^v/,""):void 0}const l=[`runtime=${i}`];o&&l.push(`runtime-version=${o}`);const h={headers:{"X-Client-Info":`supabase-js/2.109.0; ${l.join("; ")}`}},f={schema:"public"},p={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},b={},v={enabled:!1,respectSamplingDecision:!0};let y=null;function w(){return e=this,t=void 0,r=function*(){try{const e=yield(null===y&&(y=import("@opentelemetry/api").catch(()=>null)),y);if(!e||!e.propagation||!e.context)return null;const t={};e.propagation.inject(e.context.active(),t);const n=t.traceparent;return n?{traceparent:n,tracestate:t.tracestate,baggage:t.baggage}:null}catch(e){return null}},new((n=void 0)||(n=Promise))(function(s,o){function i(e){try{u(r.next(e))}catch(e){o(e)}}function c(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(i,c)}u((r=r.apply(e,t||[])).next())});var e,t,n,r}function k(e){if(!e||"string"!=typeof e)return null;const t=e.split("-");if(4!==t.length)return null;const[n,r,s,o]=t;if(2!==n.length||32!==r.length||16!==s.length||2!==o.length)return null;const i=/^[0-9a-f]+$/i;return i.test(n)&&i.test(r)&&i.test(s)&&i.test(o)?"00000000000000000000000000000000"===r||"0000000000000000"===s?null:{version:n,traceId:r,parentId:s,traceFlags:o,isSampled:!(1&~parseInt(o,16))}:null}function O(e,t){if(!e||!t||0===t.length)return!1;let n;if(e instanceof URL)n=e;else try{n=new URL(e)}catch(e){return!1}for(const e of t)try{if("string"==typeof e){if(T(n.hostname,e))return!0}else if(e instanceof RegExp){if(e.test(n.hostname))return!0}else if("function"==typeof e&&e(n))return!0}catch(e){continue}return!1}function T(e,t){if(t===e)return!0;if(t.startsWith("*.")){const n=t.slice(2);if(e.endsWith(n)&&(e===n||e.endsWith("."+n)))return!0}return!1}function P(e){const t=[];try{const n=new URL(e);t.push(n.hostname)}catch(e){}return t.push("*.supabase.co","*.supabase.in"),t.push("localhost","127.0.0.1","[::1]"),t}function S(e){return(S="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function j(e,t){if("object"!=S(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=S(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function E(e){var t=j(e,"string");return"symbol"==S(t)?t:t+""}function U(e,t,n){return(t=E(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function A(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function R(e){for(var t=1;te?(...t)=>e(...t):(...e)=>fetch(...e),F=(e,t,n,r,s)=>{const o=C(r),i=Headers,c=!0===(null==s?void 0:s.enabled),u=!1!==(null==s?void 0:s.respectSamplingDecision),l=c?P(t):null;return async(t,r)=>{var s;const c=null!==(s=await n())&&void 0!==s?s:e;let h=new i(null==r?void 0:r.headers);if(h.has("apikey")||h.set("apikey",e),h.has("Authorization")||h.set("Authorization",`Bearer ${c}`),l){const e=await _(t,l,u);e&&(e.traceparent&&!h.has("traceparent")&&h.set("traceparent",e.traceparent),e.tracestate&&!h.has("tracestate")&&h.set("tracestate",e.tracestate),e.baggage&&!h.has("baggage")&&h.set("baggage",e.baggage))}return o(t,R(R({},r),{},{headers:h}))}};async function _(e,t,n){if(!O("string"==typeof e||e instanceof URL?e:e.url,t))return null;const r=await w();if(!r||!r.traceparent)return null;if(n){const e=k(r.traceparent);if(e&&!e.isSampled)return null}return r}function L(e){return"boolean"==typeof e?{enabled:e}:e}function I(e,t){var n,r,s,o,i,c;const{db:u,auth:l,realtime:h,global:f}=e,{db:p,auth:b,realtime:v,global:y}=t,w=L(e.tracePropagation),k=L(t.tracePropagation),O={db:R(R({},p),u),auth:R(R({},b),l),realtime:R(R({},v),h),storage:{},global:R(R(R({},y),f),{},{headers:R(R({},null!==(n=null==y?void 0:y.headers)&&void 0!==n?n:{}),null!==(r=null==f?void 0:f.headers)&&void 0!==r?r:{})}),tracePropagation:{enabled:null!==(s=null!==(o=null==w?void 0:w.enabled)&&void 0!==o?o:null==k?void 0:k.enabled)&&void 0!==s&&s,respectSamplingDecision:null===(i=null!==(c=null==w?void 0:w.respectSamplingDecision)&&void 0!==c?c:null==k?void 0:k.respectSamplingDecision)||void 0===i||i},accessToken:async()=>""};return e.accessToken?O.accessToken=e.accessToken:delete O.accessToken,O}function D(e){const t=null==e?void 0:e.trim();if(!t)throw new Error("supabaseUrl is required.");if(!t.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL((n=t).endsWith("/")?n:n+"/")}catch(e){throw Error("Invalid supabaseUrl: Provided URL is malformed.")}var n}var K=class extends s.AuthClient{constructor(e){super(e)}},x=class{constructor(e,n,s){var o,i;this.supabaseUrl=e,this.supabaseKey=n;const c=D(e);if(!n)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",c),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",c),this.storageUrl=new URL("storage/v1",c),this.functionsUrl=new URL("functions/v1",c);const u=`sb-${c.hostname.split(".")[0]}-auth-token`,l=I(null!=s?s:{},{db:f,realtime:b,auth:R(R({},p),{},{storageKey:u}),global:h,tracePropagation:v});var y;(this.settings=l,this.storageKey=null!==(o=l.auth.storageKey)&&void 0!==o?o:"",this.headers=null!==(i=l.global.headers)&&void 0!==i?i:{},l.accessToken)?(this.accessToken=l.accessToken,this.auth=new Proxy({},{get:(e,t)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(t)} is not possible`)}})):this.auth=this._initSupabaseAuthClient(null!==(y=l.auth)&&void 0!==y?y:{},this.headers,l.global.fetch);this.fetch=F(n,e,this._getAccessToken.bind(this),l.global.fetch,l.tracePropagation),this.realtime=this._initRealtimeClient(R({headers:this.headers,accessToken:this._getAccessToken.bind(this),fetch:this.fetch},l.realtime)),this.accessToken&&Promise.resolve(this.accessToken()).then(e=>this.realtime.setAuth(e)).catch(e=>console.warn("Failed to set initial Realtime auth token:",e)),this.rest=new t.PostgrestClient(new URL("rest/v1",c).href,{headers:this.headers,schema:l.db.schema,fetch:this.fetch,timeout:l.db.timeout,urlLengthLimit:l.db.urlLengthLimit}),this.storage=new r.StorageClient(this.storageUrl.href,this.headers,this.fetch,null==s?void 0:s.storage),l.accessToken||this._listenForAuthEvents()}get functions(){return new e.FunctionsClient(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e,t={},n={head:!1,get:!1,count:void 0}){return this.rest.rpc(e,t,n)}channel(e,t={config:{}}){return this.realtime.channel(e,t)}getChannels(){return this.realtime.getChannels()}removeChannel(e){return this.realtime.removeChannel(e)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var e,t,n=this;if(n.accessToken)return await n.accessToken();const{data:r}=await n.auth.getSession();return null!==(e=null===(t=r.session)||void 0===t?void 0:t.access_token)&&void 0!==e?e:n.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:t,detectSessionInUrl:n,storage:r,userStorage:s,storageKey:o,flowType:i,lock:c,debug:u,throwOnError:l,experimental:h,lockAcquireTimeout:f,skipAutoInitialize:p},b,v){const y={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new K({url:this.authUrl.href,headers:R(R({},y),b),storageKey:o,autoRefreshToken:e,persistSession:t,detectSessionInUrl:n,storage:r,userStorage:s,flowType:i,lock:c,debug:u,throwOnError:l,experimental:h,fetch:v,lockAcquireTimeout:f,skipAutoInitialize:p,hasCustomAuthorizationHeader:Object.keys(this.headers).some(e=>"authorization"===e.toLowerCase())})}_initRealtimeClient(e){return new n.RealtimeClient(this.realtimeUrl.href,R(R({},e),{},{params:R(R({},{apikey:this.supabaseKey}),null==e?void 0:e.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((e,t)=>{this._handleTokenChanged(e,"CLIENT",null==t?void 0:t.access_token)})}_handleTokenChanged(e,t,n){"TOKEN_REFRESHED"!==e&&"SIGNED_IN"!==e||this.changedAccessToken===n?"SIGNED_OUT"===e&&(this.realtime.setAuth(),"STORAGE"==t&&this.auth.signOut(),this.changedAccessToken=void 0):(this.changedAccessToken=n,this.realtime.setAuth(n))}};const N=(e,t,n)=>new x(e,t,n);(function(){if("undefined"!=typeof window)return!1;const e=globalThis.process;if(!e)return!1;const t=e.version;if(null==t)return!1;const n=t.match(/^v(\d+)\./);return!!n&&parseInt(n[1],10)<=18})()&&console.warn("\u26a0\ufe0f Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217")},1165,[1166,1171,1172,1187,1189]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"FunctionsClient",{enumerable:!0,get:function(){return n.FunctionsClient}}),Object.defineProperty(e,"FunctionsError",{enumerable:!0,get:function(){return t.FunctionsError}}),Object.defineProperty(e,"FunctionsFetchError",{enumerable:!0,get:function(){return t.FunctionsFetchError}}),Object.defineProperty(e,"FunctionsHttpError",{enumerable:!0,get:function(){return t.FunctionsHttpError}}),Object.defineProperty(e,"FunctionsRelayError",{enumerable:!0,get:function(){return t.FunctionsRelayError}}),Object.defineProperty(e,"FunctionRegion",{enumerable:!0,get:function(){return t.FunctionRegion}});var n=r(d[0]),t=r(d[1])},1166,[1167,1170]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"FunctionsClient",{enumerable:!0,get:function(){return s}});var t=r(d[0]),n=r(d[1]),o=r(d[2]);class s{constructor(t,{headers:s={},customFetch:c,region:l=o.FunctionRegion.Any}={}){this.url=t,this.headers=s,this.region=l,this.fetch=(0,n.resolveFetch)(c)}setAuth(t){this.headers.Authorization=`Bearer ${t}`}invoke(n){return(0,t.__awaiter)(this,arguments,void 0,function*(t,n={}){var s;let c,l;try{const{headers:u,method:f,body:h,signal:p,timeout:y}=n;let b={},{region:F}=n;F||(F=this.region);const v=new URL(`${this.url}/${t}`);let w;F&&'any'!==F&&(b['x-region']=F,v.searchParams.set('forceFunctionRegion',F));const j=!!u&&Object.keys(u).some(t=>'content-type'===t.toLowerCase());h&&!j?'undefined'!=typeof Blob&&h instanceof Blob||h instanceof ArrayBuffer?(b['Content-Type']='application/octet-stream',w=h):'string'==typeof h?(b['Content-Type']='text/plain',w=h):'undefined'!=typeof FormData&&h instanceof FormData?w=h:(b['Content-Type']='application/json',w=JSON.stringify(h)):w=!h||'string'==typeof h||'undefined'!=typeof Blob&&h instanceof Blob||h instanceof ArrayBuffer||'undefined'!=typeof FormData&&h instanceof FormData?h:JSON.stringify(h);let O=p;y&&(l=new AbortController,c=setTimeout(()=>l.abort(),y),p?(O=l.signal,p.addEventListener('abort',()=>l.abort())):O=l.signal);const x=yield this.fetch(v.toString(),{method:f||'POST',headers:Object.assign(Object.assign(Object.assign({},b),this.headers),u),body:w,signal:O}).catch(t=>{throw new o.FunctionsFetchError(t)}),B=x.headers.get('x-relay-error');if(B&&'true'===B)throw new o.FunctionsRelayError(x);if(!x.ok)throw new o.FunctionsHttpError(x);let C,T=(null!==(s=x.headers.get('Content-Type'))&&void 0!==s?s:'text/plain').split(';')[0].trim();return C='application/json'===T?yield x.json():'application/octet-stream'===T||'application/pdf'===T?yield x.blob():'text/event-stream'===T?x:'multipart/form-data'===T?yield x.formData():yield x.text(),{data:C,error:null,response:x}}catch(t){return{data:null,error:t,response:t instanceof o.FunctionsHttpError||t instanceof o.FunctionsRelayError?t.context:void 0}}finally{c&&clearTimeout(c)}})}}},1167,[1168,1169,1170]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return G}}),_e.__extends=t,Object.defineProperty(_e,"__assign",{enumerable:!0,get:function(){return r}}),_e.__rest=n,_e.__decorate=o,_e.__param=a,_e.__esDecorate=i,_e.__runInitializers=c,_e.__propKey=u,_e.__setFunctionName=s,_e.__metadata=f,_e.__awaiter=l,_e.__generator=p,Object.defineProperty(_e,"__createBinding",{enumerable:!0,get:function(){return y}}),_e.__exportStar=_,_e.__values=d,_e.__read=h,_e.__spread=b,_e.__spreadArrays=v,_e.__spreadArray=w,_e.__await=m,_e.__asyncGenerator=g,_e.__asyncDelegator=O,_e.__asyncValues=j,_e.__makeTemplateObject=P,_e.__importStar=x,_e.__importDefault=T,_e.__classPrivateFieldGet=I,_e.__classPrivateFieldSet=D,_e.__classPrivateFieldIn=R,_e.__addDisposableResource=k,_e.__disposeResources=F,_e.__rewriteRelativeImportExtension=C;var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};function t(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}var r=function(){return r=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=0;c--)(o=e[c])&&(i=(a<3?o(i):a>3?o(t,r,i):o(t,r))||i);return a>3&&i&&Object.defineProperty(t,r,i),i}function a(e,t){return function(r,n){t(r,n,e)}}function i(e,t,r,n,o,a){function i(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var c,u=n.kind,s="getter"===u?"get":"setter"===u?"set":"value",f=!t&&e?n.static?e:e.prototype:null,l=t||(f?Object.getOwnPropertyDescriptor(f,n.name):{}),p=!1,y=r.length-1;y>=0;y--){var _={};for(var d in n)_[d]="access"===d?{}:n[d];for(var d in n.access)_.access[d]=n.access[d];_.addInitializer=function(e){if(p)throw new TypeError("Cannot add initializers after decoration has completed");a.push(i(e||null))};var h=(0,r[y])("accessor"===u?{get:l.get,set:l.set}:l[s],_);if("accessor"===u){if(void 0===h)continue;if(null===h||"object"!=typeof h)throw new TypeError("Object expected");(c=i(h.get))&&(l.get=c),(c=i(h.set))&&(l.set=c),(c=i(h.init))&&o.unshift(c)}else(c=i(h))&&("field"===u?o.unshift(c):l[s]=c)}f&&Object.defineProperty(f,n.name,l),p=!0}function c(e,t,r){for(var n=arguments.length>2,o=0;o0&&o[o.length-1])||6!==c[0]&&2!==c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function h(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,a=r.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)i.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(o)throw o.error}}return i}function b(){for(var e=[],t=0;t1||c(e,t)})},t&&(n[e]=t(n[e])))}function c(e,t){try{(r=o[e](t)).value instanceof m?Promise.resolve(r.value.v).then(u,s):f(a[0][2],r)}catch(e){f(a[0][3],e)}var r}function u(e){c("next",e)}function s(e){c("throw",e)}function f(e,t){e(t),a.shift(),a.length&&c(a[0][0],a[0][1])}}function O(e){var t,r;return t={},n("next"),n("throw",function(e){throw e}),n("return"),t[Symbol.iterator]=function(){return this},t;function n(n,o){t[n]=e[n]?function(t){return(r=!r)?{value:m(e[n](t)),done:!1}:o?o(t):t}:o}}function j(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=d(e),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise(function(n,a){o(n,a,(t=e[r](t)).done,t.value)})}}function o(e,t,r,n){Promise.resolve(n).then(function(t){e({value:t,done:r})},t)}}function P(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var S=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t},E=function(e){return E=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t},E(e)};function x(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r=E(e),n=0;nt?(...n)=>t(...n):(...t)=>fetch(...t)},1169,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"FunctionsError",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"FunctionsFetchError",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"FunctionsRelayError",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"FunctionsHttpError",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"FunctionRegion",{enumerable:!0,get:function(){return u}});class t extends Error{constructor(t,n="FunctionsError",s){super(t),this.name=n,this.context=s}toJSON(){return{name:this.name,message:this.message,context:this.context}}}class n extends t{constructor(t){super('Failed to send a request to the Edge Function','FunctionsFetchError',t)}}class s extends t{constructor(t){super('Relay Error invoking the Edge Function','FunctionsRelayError',t)}}class o extends t{constructor(t){super('Edge Function returned a non-2xx status code','FunctionsHttpError',t)}}var u;!(function(t){t.Any="any",t.ApNortheast1="ap-northeast-1",t.ApNortheast2="ap-northeast-2",t.ApSouth1="ap-south-1",t.ApSoutheast1="ap-southeast-1",t.ApSoutheast2="ap-southeast-2",t.CaCentral1="ca-central-1",t.EuCentral1="eu-central-1",t.EuWest1="eu-west-1",t.EuWest2="eu-west-2",t.EuWest3="eu-west-3",t.SaEast1="sa-east-1",t.UsEast1="us-east-1",t.UsWest1="us-west-1",t.UsWest2="us-west-2"})(u||(u={}))},1170,[]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"PostgrestBuilder",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"PostgrestClient",{enumerable:!0,get:function(){return $}}),Object.defineProperty(_e,"PostgrestError",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"PostgrestFilterBuilder",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"PostgrestQueryBuilder",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"PostgrestTransformBuilder",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return w}});const e=e=>Math.min(1e3*2**e,3e4),t=[520,503],r=["GET","HEAD","OPTIONS"];var s=class extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.code=e.code}toJSON(){return{name:this.name,message:this.message,details:this.details,hint:this.hint,code:this.code}}};function n(e,t){return new Promise(r=>{if(null==t?void 0:t.aborted)return void r();const s=setTimeout(()=>{null==t||t.removeEventListener("abort",n),r()},e);function n(){clearTimeout(s),r()}null==t||t.addEventListener("abort",n)})}function i(e,s,n,i){return!(!i||n>=3)&&(!!r.includes(e)&&!!t.includes(s))}var l=class{constructor(e){var t,r,s,n,i;this.shouldThrowOnError=!1,this.retryEnabled=!0,this.method=e.method,this.url=e.url,this.headers=new Headers(e.headers),this.schema=e.schema,this.body=e.body,this.shouldThrowOnError=null!==(t=e.shouldThrowOnError)&&void 0!==t&&t,this.signal=e.signal,this.isMaybeSingle=null!==(r=e.isMaybeSingle)&&void 0!==r&&r,this.shouldStripNulls=null!==(s=e.shouldStripNulls)&&void 0!==s&&s,this.urlLengthLimit=null!==(n=e.urlLengthLimit)&&void 0!==n?n:8e3,this.retryEnabled=null===(i=e.retry)||void 0===i||i,e.fetch?this.fetch=e.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}stripNulls(){if("text/csv"===this.headers.get("Accept"))throw new Error("stripNulls() cannot be used with csv()");return this.shouldStripNulls=!0,this}setHeader(e,t){return this.headers=new Headers(this.headers),this.headers.set(e,t),this}retry(e){return this.retryEnabled=e,this}then(t,s){var l=this;if(void 0===this.schema||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),"GET"!==this.method&&"HEAD"!==this.method&&this.headers.set("Content-Type","application/json"),this.shouldStripNulls){const e=this.headers.get("Accept");"application/vnd.pgrst.object+json"===e?this.headers.set("Accept","application/vnd.pgrst.object+json;nulls=stripped"):e&&"application/json"!==e||this.headers.set("Accept","application/vnd.pgrst.array+json;nulls=stripped")}const o=this.fetch;let h=(async()=>{let t=0;for(;;){const u={};let c;l.headers.forEach((e,t)=>{u[t]=e}),t>0&&(u["X-Retry-Count"]=String(t));try{c=await o(l.url.toString(),{method:l.method,headers:u,body:JSON.stringify(l.body,(e,t)=>"bigint"==typeof t?t.toString():t),signal:l.signal})}catch(s){if("AbortError"===(null==s?void 0:s.name)||"ABORT_ERR"===(null==s?void 0:s.code))throw s;if(!r.includes(l.method))throw s;if(l.retryEnabled&&t<3){const r=e(t);t++,await n(r,l.signal);continue}throw s}if(i(l.method,c.status,t,l.retryEnabled)){var s,h;const r=null!==(s=null===(h=c.headers)||void 0===h?void 0:h.get("Retry-After"))&&void 0!==s?s:null,i=null!==r?1e3*Math.max(0,parseInt(r,10)||0):e(t);await c.text(),t++,await n(i,l.signal);continue}return await l.processResponse(c)}})();return this.shouldThrowOnError||(h=h.catch(e=>{var t;let r="",s="",n="";const i=null==e?void 0:e.cause;if(i){var l,o,h,u;const t=null!==(l=null==i?void 0:i.message)&&void 0!==l?l:"",s=null!==(o=null==i?void 0:i.code)&&void 0!==o?o:"";r=`${null!==(h=null==e?void 0:e.name)&&void 0!==h?h:"FetchError"}: ${null==e?void 0:e.message}`,r+=`\n\nCaused by: ${null!==(u=null==i?void 0:i.name)&&void 0!==u?u:"Error"}: ${t}`,s&&(r+=` (${s})`),(null==i?void 0:i.stack)&&(r+=`\n${i.stack}`)}else{var c;r=null!==(c=null==e?void 0:e.stack)&&void 0!==c?c:""}const p=this.url.toString().length;return"AbortError"===(null==e?void 0:e.name)||"ABORT_ERR"===(null==e?void 0:e.code)?(n="",s="Request was aborted (timeout or manual cancellation)",p>this.urlLengthLimit&&(s+=`. Note: Your request URL is ${p} characters, which may exceed server limits. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [many IDs])), consider using an RPC function to pass values server-side.`)):"HeadersOverflowError"!==(null==i?void 0:i.name)&&"UND_ERR_HEADERS_OVERFLOW"!==(null==i?void 0:i.code)||(n="",s="HTTP headers exceeded server limits (typically 16KB)",p>this.urlLengthLimit&&(s+=`. Your request URL is ${p} characters. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [200+ IDs])), consider using an RPC function instead.`)),{success:!1,error:{message:`${null!==(t=null==e?void 0:e.name)&&void 0!==t?t:"FetchError"}: ${null==e?void 0:e.message}`,details:r,hint:s,code:n},data:null,count:null,status:0,statusText:""}})),h.then(t,s)}async processResponse(e){var t=this;let r=null,n=null,i=null,l=e.status,o=e.statusText;if(e.ok){var h,u;if("HEAD"!==t.method){var c;const i=await e.text();if(""===i);else if("text/csv"===t.headers.get("Accept"))n=i;else if(t.headers.get("Accept")&&(null===(c=t.headers.get("Accept"))||void 0===c?void 0:c.includes("application/vnd.pgrst.plan+text")))n=i;else try{n=JSON.parse(i)}catch(e){if(r={message:i},n=null,t.shouldThrowOnError)throw new s({message:i,details:"",hint:"",code:""})}}const p=null===(h=t.headers.get("Prefer"))||void 0===h?void 0:h.match(/count=(exact|planned|estimated)/),f=null===(u=e.headers.get("content-range"))||void 0===u?void 0:u.split("/");p&&f&&f.length>1&&(i=parseInt(f[1])),t.isMaybeSingle&&Array.isArray(n)&&(n.length>1?(r={code:"PGRST116",details:`Results contain ${n.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},n=null,i=null,l=406,o="Not Acceptable"):n=1===n.length?n[0]:null)}else{const i=await e.text();try{r=JSON.parse(i),Array.isArray(r)&&404===e.status&&(n=[],r=null,l=200,o="OK")}catch(t){404===e.status&&""===i?(l=204,o="No Content"):r={message:i}}if(r&&t.shouldThrowOnError)throw new s(r)}return{success:null===r,error:r,data:n,count:i,status:l,statusText:o}}returns(){return this}overrideTypes(){return this}},o=class extends l{throwOnError(){return super.throwOnError()}select(e){let t=!1;const r=(null!=e?e:"*").split("").map(e=>/\s/.test(e)&&!t?"":("\""===e&&(t=!t),e)).join("");return this.url.searchParams.set("select",r),this.headers.append("Prefer","return=representation"),this}order(e,{ascending:t=!0,nullsFirst:r,foreignTable:s,referencedTable:n=s}={}){const i=n?`${n}.order`:"order",l=this.url.searchParams.get(i);return this.url.searchParams.set(i,`${l?`${l},`:""}${e}.${t?"asc":"desc"}${void 0===r?"":r?".nullsfirst":".nullslast"}`),this}limit(e,{foreignTable:t,referencedTable:r=t}={}){const s=void 0===r?"limit":`${r}.limit`;return this.url.searchParams.set(s,`${e}`),this}range(e,t,{foreignTable:r,referencedTable:s=r}={}){const n=void 0===s?"offset":`${s}.offset`,i=void 0===s?"limit":`${s}.limit`;return this.url.searchParams.set(n,`${e}`),this.url.searchParams.set(i,""+(t-e+1)),this}abortSignal(e){return this.signal=e,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:e=!1,verbose:t=!1,settings:r=!1,buffers:s=!1,wal:n=!1,format:i="text"}={}){var l;const o=[e?"analyze":null,t?"verbose":null,r?"settings":null,s?"buffers":null,n?"wal":null].filter(Boolean).join("|"),h=null!==(l=this.headers.get("Accept"))&&void 0!==l?l:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${i}; for="${h}"; options=${o};`),this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(e){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${e}`),this}};const h=new RegExp("[,()]");var u=class extends o{throwOnError(){return super.throwOnError()}eq(e,t){return this.url.searchParams.append(e,`eq.${t}`),this}neq(e,t){return this.url.searchParams.append(e,`neq.${t}`),this}gt(e,t){return this.url.searchParams.append(e,`gt.${t}`),this}gte(e,t){return this.url.searchParams.append(e,`gte.${t}`),this}lt(e,t){return this.url.searchParams.append(e,`lt.${t}`),this}lte(e,t){return this.url.searchParams.append(e,`lte.${t}`),this}like(e,t){return this.url.searchParams.append(e,`like.${t}`),this}likeAllOf(e,t){return this.url.searchParams.append(e,`like(all).{${t.join(",")}}`),this}likeAnyOf(e,t){return this.url.searchParams.append(e,`like(any).{${t.join(",")}}`),this}ilike(e,t){return this.url.searchParams.append(e,`ilike.${t}`),this}ilikeAllOf(e,t){return this.url.searchParams.append(e,`ilike(all).{${t.join(",")}}`),this}ilikeAnyOf(e,t){return this.url.searchParams.append(e,`ilike(any).{${t.join(",")}}`),this}regexMatch(e,t){return this.url.searchParams.append(e,`match.${t}`),this}regexIMatch(e,t){return this.url.searchParams.append(e,`imatch.${t}`),this}is(e,t){return this.url.searchParams.append(e,`is.${t}`),this}isDistinct(e,t){return this.url.searchParams.append(e,`isdistinct.${t}`),this}in(e,t){const r=Array.from(new Set(t)).map(e=>"string"==typeof e&&h.test(e)?`"${e}"`:`${e}`).join(",");return this.url.searchParams.append(e,`in.(${r})`),this}notIn(e,t){const r=Array.from(new Set(t)).map(e=>"string"==typeof e&&h.test(e)?`"${e}"`:`${e}`).join(",");return this.url.searchParams.append(e,`not.in.(${r})`),this}contains(e,t){return"string"==typeof t?this.url.searchParams.append(e,`cs.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cs.{${t.join(",")}}`):this.url.searchParams.append(e,`cs.${JSON.stringify(t)}`),this}containedBy(e,t){return"string"==typeof t?this.url.searchParams.append(e,`cd.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cd.{${t.join(",")}}`):this.url.searchParams.append(e,`cd.${JSON.stringify(t)}`),this}rangeGt(e,t){return this.url.searchParams.append(e,`sr.${t}`),this}rangeGte(e,t){return this.url.searchParams.append(e,`nxl.${t}`),this}rangeLt(e,t){return this.url.searchParams.append(e,`sl.${t}`),this}rangeLte(e,t){return this.url.searchParams.append(e,`nxr.${t}`),this}rangeAdjacent(e,t){return this.url.searchParams.append(e,`adj.${t}`),this}overlaps(e,t){return"string"==typeof t?this.url.searchParams.append(e,`ov.${t}`):this.url.searchParams.append(e,`ov.{${t.join(",")}}`),this}textSearch(e,t,{config:r,type:s}={}){let n="";"plain"===s?n="pl":"phrase"===s?n="ph":"websearch"===s&&(n="w");const i=void 0===r?"":`(${r})`;return this.url.searchParams.append(e,`${n}fts${i}.${t}`),this}match(e){return Object.entries(e).filter(([e,t])=>void 0!==t).forEach(([e,t])=>{this.url.searchParams.append(e,`eq.${t}`)}),this}not(e,t,r){return this.url.searchParams.append(e,`not.${t}.${r}`),this}or(e,{foreignTable:t,referencedTable:r=t}={}){const s=r?`${r}.or`:"or";return this.url.searchParams.append(s,`(${e})`),this}filter(e,t,r){return this.url.searchParams.append(e,`${t}.${r}`),this}},c=class{constructor(e,{headers:t={},schema:r,fetch:s,urlLengthLimit:n=8e3,retry:i}){this.url=e,this.headers=new Headers(t),this.schema=r,this.fetch=s,this.urlLengthLimit=n,this.retry=i}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(e,t){const{head:r=!1,count:s}=null!=t?t:{},n=r?"HEAD":"GET";let i=!1;const l=(null!=e?e:"*").split("").map(e=>/\s/.test(e)&&!i?"":("\""===e&&(i=!i),e)).join(""),{url:o,headers:h}=this.cloneRequestState();return o.searchParams.set("select",l),s&&h.append("Prefer",`count=${s}`),new u({method:n,url:o,headers:h,schema:this.schema,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}insert(e,{count:t,defaultToNull:r=!0}={}){var s;const{url:n,headers:i}=this.cloneRequestState();if(t&&i.append("Prefer",`count=${t}`),r||i.append("Prefer","missing=default"),Array.isArray(e)){const t=e.reduce((e,t)=>e.concat(Object.keys(t)),[]);if(t.length>0){const e=[...new Set(t)].map(e=>`"${e}"`);n.searchParams.set("columns",e.join(","))}}return new u({method:"POST",url:n,headers:i,schema:this.schema,body:e,fetch:null!==(s=this.fetch)&&void 0!==s?s:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}upsert(e,{onConflict:t,ignoreDuplicates:r=!1,count:s,defaultToNull:n=!0}={}){var i;const{url:l,headers:o}=this.cloneRequestState();if(o.append("Prefer",`resolution=${r?"ignore":"merge"}-duplicates`),void 0!==t&&l.searchParams.set("on_conflict",t),s&&o.append("Prefer",`count=${s}`),n||o.append("Prefer","missing=default"),Array.isArray(e)){const t=e.reduce((e,t)=>e.concat(Object.keys(t)),[]);if(t.length>0){const e=[...new Set(t)].map(e=>`"${e}"`);l.searchParams.set("columns",e.join(","))}}return new u({method:"POST",url:l,headers:o,schema:this.schema,body:e,fetch:null!==(i=this.fetch)&&void 0!==i?i:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}update(e,{count:t}={}){var r;const{url:s,headers:n}=this.cloneRequestState();return t&&n.append("Prefer",`count=${t}`),new u({method:"PATCH",url:s,headers:n,schema:this.schema,body:e,fetch:null!==(r=this.fetch)&&void 0!==r?r:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}delete({count:e}={}){var t;const{url:r,headers:s}=this.cloneRequestState();return e&&s.append("Prefer",`count=${e}`),new u({method:"DELETE",url:r,headers:s,schema:this.schema,fetch:null!==(t=this.fetch)&&void 0!==t?t:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};function p(e){return(p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function f(e,t){if("object"!=p(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var s=r.call(e,t||"default");if("object"!=p(s))return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function y(e){var t=f(e,"string");return"symbol"==p(t)?t:t+""}function v(e,t,r){return(t=y(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function b(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,s)}return r}function P(e){for(var t=1;t0?(e,t)=>{const r=new AbortController,s=setTimeout(()=>r.abort(),n),i=null==t?void 0:t.signal;if(i){if(i.aborted)return clearTimeout(s),o(e,t);const n=()=>{clearTimeout(s),r.abort()};return i.addEventListener("abort",n,{once:!0}),o(e,P(P({},t),{},{signal:r.signal})).finally(()=>{clearTimeout(s),i.removeEventListener("abort",n)})}return o(e,P(P({},t),{},{signal:r.signal})).finally(()=>clearTimeout(s))}:o,this.retry=l}from(e){if(!e||"string"!=typeof e||""===e.trim())throw new Error("Invalid relation name: relation must be a non-empty string.");return new c(new URL(`${this.url}/${e}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}schema(t){return new e(this.url,{headers:this.headers,schema:t,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}rpc(e,t={},{head:r=!1,get:s=!1,count:n}={}){var i;let l;const o=new URL(`${this.url}/rpc/${e}`);let h;const c=e=>null!==e&&"object"==typeof e&&(!Array.isArray(e)||e.some(c)),p=r&&Object.values(t).some(c);p?(l="POST",h=t):r||s?(l=r?"HEAD":"GET",Object.entries(t).filter(([e,t])=>void 0!==t).map(([e,t])=>[e,Array.isArray(t)?`{${t.join(",")}}`:`${t}`]).forEach(([e,t])=>{o.searchParams.append(e,t)})):(l="POST",h=t);const f=new Headers(this.headers);return p?f.set("Prefer",n?`count=${n},return=minimal`:"return=minimal"):n&&f.set("Prefer",`count=${n}`),new u({method:l,url:o,headers:f,schema:this.schemaName,body:h,fetch:null!==(i=this.fetch)&&void 0!==i?i:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}},w={PostgrestClient:$,PostgrestQueryBuilder:c,PostgrestFilterBuilder:u,PostgrestTransformBuilder:o,PostgrestBuilder:l,PostgrestError:s}},1171,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"RealtimePresence",{enumerable:!0,get:function(){return o.default}}),Object.defineProperty(_e,"RealtimeChannel",{enumerable:!0,get:function(){return E.default}}),Object.defineProperty(_e,"RealtimeClient",{enumerable:!0,get:function(){return t.default}}),Object.defineProperty(_e,"RealtimePostgresFilterBuilder",{enumerable:!0,get:function(){return n.RealtimePostgresFilterBuilder}}),Object.defineProperty(_e,"postgresChangesFilter",{enumerable:!0,get:function(){return n.postgresChangesFilter}}),Object.defineProperty(_e,"REALTIME_LISTEN_TYPES",{enumerable:!0,get:function(){return n.REALTIME_LISTEN_TYPES}}),Object.defineProperty(_e,"REALTIME_POSTGRES_CHANGES_LISTEN_EVENT",{enumerable:!0,get:function(){return n.REALTIME_POSTGRES_CHANGES_LISTEN_EVENT}}),Object.defineProperty(_e,"REALTIME_PRESENCE_LISTEN_EVENTS",{enumerable:!0,get:function(){return u.REALTIME_PRESENCE_LISTEN_EVENTS}}),Object.defineProperty(_e,"REALTIME_SUBSCRIBE_STATES",{enumerable:!0,get:function(){return n.REALTIME_SUBSCRIBE_STATES}}),Object.defineProperty(_e,"REALTIME_CHANNEL_STATES",{enumerable:!0,get:function(){return n.REALTIME_CHANNEL_STATES}}),Object.defineProperty(_e,"WebSocketFactory",{enumerable:!0,get:function(){return l.default}});var t=e(r(d[0])),n=r(d[1]),E=e(n),u=r(d[2]),o=e(u),l=e(r(d[3]))},1172,[1173,1179,1180,1174]); +__d(function(g,r,i,a,m,_e2,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"default",{enumerable:!0,get:function(){return f}});var t=e(r(d[0])),n=r(d[1]),s=e(r(d[2])),o=r(d[3]),c=e(r(d[4])),l=e(r(d[5]));const h=25e3,u=[1e3,2e3,5e3,1e4];function k(){const e=new Map;return{get length(){return e.size},clear(){e.clear()},getItem:t=>e.has(t)?e.get(t):null,key(t){var n;return null!==(n=Array.from(e.keys())[t])&&void 0!==n?n:null},removeItem(t){e.delete(t)},setItem(t,n){e.set(t,String(n))}}}function p(){try{if('undefined'!=typeof globalThis&&globalThis.sessionStorage)return globalThis.sessionStorage}catch(e){}return k()}class f{get endPoint(){return this.socketAdapter.endPoint}get timeout(){return this.socketAdapter.timeout}get transport(){return this.socketAdapter.transport}get heartbeatCallback(){return this.socketAdapter.heartbeatCallback}get heartbeatIntervalMs(){return this.socketAdapter.heartbeatIntervalMs}get heartbeatTimer(){return this.worker?this._workerHeartbeatTimer:this.socketAdapter.heartbeatTimer}get pendingHeartbeatRef(){return this.worker?this._pendingWorkerHeartbeatRef:this.socketAdapter.pendingHeartbeatRef}get reconnectTimer(){return this.socketAdapter.reconnectTimer}get vsn(){return this.socketAdapter.vsn}get encode(){return this.socketAdapter.encode}get decode(){return this.socketAdapter.decode}get reconnectAfterMs(){return this.socketAdapter.reconnectAfterMs}get sendBuffer(){return this.socketAdapter.sendBuffer}get stateChangeCallbacks(){return this.socketAdapter.stateChangeCallbacks}constructor(e,t){var n;if(this.channels=new Array,this.accessTokenValue=null,this.accessToken=null,this.apiKey=null,this.httpEndpoint='',this.headers={},this.params={},this.ref=0,this.serializer=new s.default,this._manuallySetToken=!1,this._authPromise=null,this._workerHeartbeatTimer=void 0,this._pendingWorkerHeartbeatRef=null,this._pendingDisconnectTimer=null,this._disconnectOnEmptyChannelsAfterMs=0,this._resolveFetch=e=>e?(...t)=>e(...t):(...e)=>fetch(...e),!(null===(n=null==t?void 0:t.params)||void 0===n?void 0:n.apikey))throw new Error('API key is required to connect to Realtime');this.apiKey=t.params.apikey;const c=this._initializeOptions(t);this.socketAdapter=new l.default(e,c),this.httpEndpoint=(0,o.httpEndpointURL)(e),this.fetch=this._resolveFetch(null==t?void 0:t.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.isConnected())){this.accessToken&&!this._authPromise&&this._setAuthSafely('connect'),this._setupConnectionHandlers();try{this.socketAdapter.connect()}catch(e){const t=e.message;if(t.includes('Node.js'))throw new Error(`${t}\n\nTo use Realtime in Node.js, you need to provide a WebSocket implementation:\n\nOption 1: Use Node.js 22+ which has native WebSocket support\nOption 2: Install and provide the "ws" package:\n\n npm install ws\n\n import ws from "ws"\n const client = new RealtimeClient(url, {\n ...options,\n transport: ws\n })`);throw new Error(`WebSocket not available: ${t}`)}this._handleNodeJsRaceCondition()}}endpointURL(){return this.socketAdapter.endPointURL()}async disconnect(e,t){return this._cancelPendingDisconnect(),this.isDisconnecting()?'ok':await this.socketAdapter.disconnect(()=>{clearInterval(this._workerHeartbeatTimer),this._terminateWorker()},e,t)}getChannels(){return this.channels}async removeChannel(e){const t=await e.unsubscribe();return'ok'===t&&e.teardown(),t}async removeAllChannels(){const e=this.channels.map(async e=>{const t=await e.unsubscribe();return e.teardown(),t}),t=await Promise.all(e);return await this.disconnect(),t}log(e,t,n){this.socketAdapter.log(e,t,n)}connectionState(){return this.socketAdapter.connectionState()||n.CONNECTION_STATE.closed}isConnected(){return this.socketAdapter.isConnected()}isConnecting(){return this.socketAdapter.isConnecting()}isDisconnecting(){return this.socketAdapter.isDisconnecting()}channel(e,t={config:{}}){const n=`realtime:${e}`,s=this.getChannels().find(e=>e.topic===n);if(s)return s;{const n=new c.default(`realtime:${e}`,t,this);return this._cancelPendingDisconnect(),this.channels.push(n),n}}push(e){this.socketAdapter.push(e)}async setAuth(e=null){this._authPromise=this._performAuth(e);try{await this._authPromise}finally{this._authPromise=null}}_isManualToken(){return this._manuallySetToken}async sendHeartbeat(){this.socketAdapter.sendHeartbeat()}onHeartbeat(e){this.socketAdapter.heartbeatCallback=this._wrapHeartbeatCallback(e)}_makeRef(){return this.socketAdapter.makeRef()}_remove(e){this.channels=this.channels.filter(t=>t.topic!==e.topic),0===this.channels.length&&(this.log('transport','no channels remaining, scheduling disconnect'),this._schedulePendingDisconnect())}_schedulePendingDisconnect(){if(this._cancelPendingDisconnect(),0===this._disconnectOnEmptyChannelsAfterMs)return this.log('transport','disconnecting immediately - no channels'),void this.disconnect();this._pendingDisconnectTimer=setTimeout(()=>{this._pendingDisconnectTimer=null,0===this.channels.length&&(this.log('transport','deferred disconnect fired - no channels, disconnecting'),this.disconnect())},this._disconnectOnEmptyChannelsAfterMs),this.log('transport',`deferred disconnect scheduled in ${this._disconnectOnEmptyChannelsAfterMs}ms`)}_cancelPendingDisconnect(){null!==this._pendingDisconnectTimer&&(this.log('transport','pending disconnect cancelled - channel activity detected'),clearTimeout(this._pendingDisconnectTimer),this._pendingDisconnectTimer=null)}async _performAuth(e=null){let t,s=!1;if(e)t=e,s=!0;else if(this.accessToken)try{t=await this.accessToken()}catch(e){this.log('error','Error fetching access token from callback',e),t=this.accessTokenValue}else t=this.accessTokenValue;s?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=t&&(this.accessTokenValue=t,this.channels.forEach(e=>{const s={access_token:t,version:n.DEFAULT_VERSION};t&&e.updateJoinPayload(s),e.joinedOnce&&e.channelAdapter.isJoined()&&e.channelAdapter.push(n.CHANNEL_EVENTS.access_token,{access_token:t})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(e="general"){this._isManualToken()||this.setAuth().catch(t=>{this.log('error',`Error setting auth in ${e}`,t)})}_setupConnectionHandlers(){this.socketAdapter.onOpen(()=>{(this._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).catch(e=>{this.log('error','error waiting for auth on connect',e)}),this.worker&&!this.workerRef&&this._startWorkerHeartbeat()}),this.socketAdapter.onClose(()=>{this.worker&&this.workerRef&&this._terminateWorker()}),this.socketAdapter.onMessage(e=>{e.ref&&e.ref===this._pendingWorkerHeartbeatRef&&(this._pendingWorkerHeartbeatRef=null)})}_handleNodeJsRaceCondition(){this.socketAdapter.isConnected()&&this.socketAdapter.getSocket().onConnOpen()}_wrapHeartbeatCallback(e){return(t,n)=>{'sent'==t&&this._setAuthSafely(),e&&e(t,n)}}_startWorkerHeartbeat(){this.workerUrl?this.log('worker',`starting worker for from ${this.workerUrl}`):this.log('worker',"starting default worker");const e=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(e),this.workerRef.onerror=e=>{this.log('worker','worker error',e.message),this._terminateWorker(),this.disconnect()},this.workerRef.onmessage=e=>{'keepAlive'===e.data.event&&this.sendHeartbeat()},this.workerRef.postMessage({event:'start',interval:this.heartbeatIntervalMs})}_terminateWorker(){this.workerRef&&(this.log('worker','terminating worker'),this.workerRef.terminate(),this.workerRef=void 0)}_workerObjectUrl(e){let t;if(e)t=e;else{const e=new Blob(["\n addEventListener(\"message\", (e) => {\n if (e.data.event === \"start\") {\n setInterval(() => postMessage({ event: \"keepAlive\" }), e.data.interval);\n }\n });"],{type:'application/javascript'});t=URL.createObjectURL(e)}return t}_initializeOptions(e){var s,o,c,l,k,f,_,v,w,b,A,T;this.worker=null!==(s=null==e?void 0:e.worker)&&void 0!==s&&s,this.accessToken=null!==(o=null==e?void 0:e.accessToken)&&void 0!==o?o:null;const y={};let C,R;y.timeout=null!==(c=null==e?void 0:e.timeout)&&void 0!==c?c:n.DEFAULT_TIMEOUT,y.heartbeatIntervalMs=null!==(l=null==e?void 0:e.heartbeatIntervalMs)&&void 0!==l?l:h,this._disconnectOnEmptyChannelsAfterMs=null!==(k=null==e?void 0:e.disconnectOnEmptyChannelsAfterMs)&&void 0!==k?k:2*(null!==(f=null==e?void 0:e.heartbeatIntervalMs)&&void 0!==f?f:h),y.transport=null!==(_=null==e?void 0:e.transport)&&void 0!==_?_:t.default.getWebSocketConstructor(),y.params=null==e?void 0:e.params,y.logger=null==e?void 0:e.logger,y.heartbeatCallback=this._wrapHeartbeatCallback(null==e?void 0:e.heartbeatCallback),y.sessionStorage=null!==(v=null==e?void 0:e.sessionStorage)&&void 0!==v?v:p(),y.reconnectAfterMs=null!==(w=null==e?void 0:e.reconnectAfterMs)&&void 0!==w?w:e=>u[e-1]||1e4;const E=null!==(b=null==e?void 0:e.vsn)&&void 0!==b?b:n.DEFAULT_VSN;switch(E){case n.VSN_1_0_0:C=(e,t)=>t(JSON.stringify(e)),R=(e,t)=>t(JSON.parse(e));break;case n.VSN_2_0_0:C=this.serializer.encode.bind(this.serializer),R=this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${y.vsn}`)}if(y.vsn=E,y.encode=null!==(A=null==e?void 0:e.encode)&&void 0!==A?A:C,y.decode=null!==(T=null==e?void 0:e.decode)&&void 0!==T?T:R,y.beforeReconnect=this._reconnectAuth.bind(this),((null==e?void 0:e.logLevel)||(null==e?void 0:e.log_level))&&(this.logLevel=e.logLevel||e.log_level,y.params=Object.assign(Object.assign({},y.params),{log_level:this.logLevel})),this.worker){if('undefined'!=typeof window&&!window.Worker)throw new Error('Web Worker is not supported');this.workerUrl=null==e?void 0:e.workerUrl,y.autoSendHeartbeat=!this.worker}return y}async _reconnectAuth(){await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()}}},1173,[1174,1175,1177,1178,1179,1186]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"WebSocketFactory",{enumerable:!0,get:function(){return t}});class t{constructor(){}static detectEnvironment(){var t;if('undefined'!=typeof WebSocket)return{type:'native',wsConstructor:WebSocket};const o=globalThis;if('undefined'!=typeof globalThis&&void 0!==o.WebSocket)return{type:'native',wsConstructor:o.WebSocket};const n=void 0!==g?g:void 0;if(n&&void 0!==n.WebSocket)return{type:'native',wsConstructor:n.WebSocket};if('undefined'!=typeof globalThis&&void 0!==o.WebSocketPair&&void 0===globalThis.WebSocket)return{type:'cloudflare',error:'Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.',workaround:'Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime.'};if('undefined'!=typeof globalThis&&o.EdgeRuntime||'undefined'!=typeof navigator&&(null===(t=navigator.userAgent)||void 0===t?void 0:t.includes('Vercel-Edge')))return{type:'unsupported',error:'Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.',workaround:'Use serverless functions or a different deployment target for WebSocket functionality.'};const s=globalThis.process;if(s){const t=s.versions;if(t&&t.node){const o=t.node,n=parseInt(o.replace(/^v/,'').split('.')[0]);return n>=22?void 0!==globalThis.WebSocket?{type:'native',wsConstructor:globalThis.WebSocket}:{type:'unsupported',error:`Node.js ${n} detected but native WebSocket not found.`,workaround:'Provide a WebSocket implementation via the transport option.'}:{type:'unsupported',error:`Node.js ${n} detected without native WebSocket support.`,workaround:"For Node.js < 22, install \"ws\" package and provide it via the transport option:\nimport ws from \"ws\"\nnew RealtimeClient(url, { transport: ws })"}}}return{type:'unsupported',error:'Unknown JavaScript runtime without WebSocket support.',workaround:"Ensure you're running in a supported environment (browser, Node.js, Deno) or provide a custom WebSocket implementation."}}static getWebSocketConstructor(){const t=this.detectEnvironment();if(t.wsConstructor)return t.wsConstructor;let o=t.error||'WebSocket not supported in this environment.';throw t.workaround&&(o+=`\n\nSuggested solution: ${t.workaround}`),new Error(o)}static isWebSocketSupported(){try{const t=this.detectEnvironment();return'native'===t.type||'ws'===t.type}catch(t){return!1}}}var o=t},1174,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DEFAULT_VERSION",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"VSN_1_0_0",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"VSN_2_0_0",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"DEFAULT_VSN",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"VERSION",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"DEFAULT_TIMEOUT",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"WS_CLOSE_NORMAL",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"MAX_PUSH_BUFFER_SIZE",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"SOCKET_STATES",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"CHANNEL_STATES",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"CHANNEL_EVENTS",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"TRANSPORTS",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"CONNECTION_STATE",{enumerable:!0,get:function(){return E}});var n=r(d[0]);const t=`realtime-js/${n.version}`,o='1.0.0',c='2.0.0',u=c,l=n.version,b=1e4,_=1e3,f=100,p={connecting:0,open:1,closing:2,closed:3},s={closed:'closed',errored:'errored',joined:'joined',joining:'joining',leaving:'leaving'},O={close:'phx_close',error:'phx_error',join:'phx_join',reply:'phx_reply',leave:'phx_leave',access_token:'access_token'},j={websocket:'websocket'},E={connecting:'connecting',open:'open',closing:'closing',closed:'closed'}},1175,[1176]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"version",{enumerable:!0,get:function(){return t}});const t='2.109.0'},1176,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}});class t{constructor(t){this.HEADER_LENGTH=1,this.USER_BROADCAST_PUSH_META_LENGTH=6,this.KINDS={userBroadcastPush:3,userBroadcast:4},this.BINARY_ENCODING=0,this.JSON_ENCODING=1,this.BROADCAST_EVENT='broadcast',this.allowedMetadataKeys=[],this.allowedMetadataKeys=null!=t?t:[]}encode(t,n){if(t.event===this.BROADCAST_EVENT&&!(t.payload instanceof ArrayBuffer)&&'string'==typeof t.payload.event)return n(this._binaryEncodeUserBroadcastPush(t));let s=[t.join_ref,t.ref,t.topic,t.event,t.payload];return n(JSON.stringify(s))}_binaryEncodeUserBroadcastPush(t){var n;return this._isArrayBuffer(null===(n=t.payload)||void 0===n?void 0:n.payload)?this._encodeBinaryUserBroadcastPush(t):this._encodeJsonUserBroadcastPush(t)}_encodeBinaryUserBroadcastPush(t){var n,s;const o=null!==(s=null===(n=t.payload)||void 0===n?void 0:n.payload)&&void 0!==s?s:new ArrayBuffer(0);return this._encodeUserBroadcastPush(t,this.BINARY_ENCODING,o)}_encodeJsonUserBroadcastPush(t){var n,s;const o=null!==(s=null===(n=t.payload)||void 0===n?void 0:n.payload)&&void 0!==s?s:{},c=(new TextEncoder).encode(JSON.stringify(o)).buffer;return this._encodeUserBroadcastPush(t,this.JSON_ENCODING,c)}_encodeUserBroadcastPush(t,n,s){var o,c;const l=t.topic,h=null!==(o=t.ref)&&void 0!==o?o:'',u=null!==(c=t.join_ref)&&void 0!==c?c:'',f=t.payload.event,y=this.allowedMetadataKeys?this._pick(t.payload,this.allowedMetadataKeys):{},_=0===Object.keys(y).length?'':JSON.stringify(y);if(u.length>255)throw new Error(`joinRef length ${u.length} exceeds maximum of 255`);if(h.length>255)throw new Error(`ref length ${h.length} exceeds maximum of 255`);if(l.length>255)throw new Error(`topic length ${l.length} exceeds maximum of 255`);if(f.length>255)throw new Error(`userEvent length ${f.length} exceeds maximum of 255`);if(_.length>255)throw new Error(`metadata length ${_.length} exceeds maximum of 255`);const A=this.USER_BROADCAST_PUSH_META_LENGTH+u.length+h.length+l.length+f.length+_.length,E=new ArrayBuffer(this.HEADER_LENGTH+A);let U=new DataView(E),B=0;U.setUint8(B++,this.KINDS.userBroadcastPush),U.setUint8(B++,u.length),U.setUint8(B++,h.length),U.setUint8(B++,l.length),U.setUint8(B++,f.length),U.setUint8(B++,_.length),U.setUint8(B++,n),Array.from(u,t=>U.setUint8(B++,t.charCodeAt(0))),Array.from(h,t=>U.setUint8(B++,t.charCodeAt(0))),Array.from(l,t=>U.setUint8(B++,t.charCodeAt(0))),Array.from(f,t=>U.setUint8(B++,t.charCodeAt(0))),Array.from(_,t=>U.setUint8(B++,t.charCodeAt(0)));var N=new Uint8Array(E.byteLength+s.byteLength);return N.set(new Uint8Array(E),0),N.set(new Uint8Array(s),E.byteLength),N.buffer}decode(t,n){if(this._isArrayBuffer(t)){return n(this._binaryDecode(t))}if('string'==typeof t){const s=JSON.parse(t),[o,c,l,h,u]=s;return n({join_ref:o,ref:c,topic:l,event:h,payload:u})}return n({})}_binaryDecode(t){const n=new DataView(t),s=n.getUint8(0),o=new TextDecoder;if(s===this.KINDS.userBroadcast)return this._decodeUserBroadcast(t,n,o)}_decodeUserBroadcast(t,n,s){const o=n.getUint8(1),c=n.getUint8(2),l=n.getUint8(3),h=n.getUint8(4);let u=this.HEADER_LENGTH+4;const f=s.decode(t.slice(u,u+o));u+=o;const y=s.decode(t.slice(u,u+c));u+=c;const _=s.decode(t.slice(u,u+l));u+=l;const A=t.slice(u,t.byteLength),E=h===this.JSON_ENCODING?JSON.parse(s.decode(A)):A,U={type:this.BROADCAST_EVENT,event:y,payload:E};return l>0&&(U.meta=JSON.parse(_)),{join_ref:null,ref:null,topic:f,event:this.BROADCAST_EVENT,payload:U}}_isArrayBuffer(t){var n;return t instanceof ArrayBuffer||'ArrayBuffer'===(null===(n=null==t?void 0:t.constructor)||void 0===n?void 0:n.name)}_pick(t,n){return t&&'object'==typeof t?Object.fromEntries(Object.entries(t).filter(([t])=>n.includes(t))):{}}}},1177,[]); +__d(function(g,r,i,a,m,e,d){"use strict";var t;Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PostgresTypes",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"convertChangeData",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"convertColumn",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"convertCell",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"toBoolean",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"toNumber",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"toJson",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"toArray",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"toTimestampString",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"httpEndpointURL",{enumerable:!0,get:function(){return y}}),(function(t){t.abstime="abstime",t.bool="bool",t.date="date",t.daterange="daterange",t.float4="float4",t.float8="float8",t.int2="int2",t.int4="int4",t.int4range="int4range",t.int8="int8",t.int8range="int8range",t.json="json",t.jsonb="jsonb",t.money="money",t.numeric="numeric",t.oid="oid",t.reltime="reltime",t.text="text",t.time="time",t.timestamp="timestamp",t.timestamptz="timestamptz",t.timetz="timetz",t.tsrange="tsrange",t.tstzrange="tstzrange"})(t||(t={}));const n=(t,n,o={})=>{var s;const u=null!==(s=o.skipTypes)&&void 0!==s?s:[];return n?Object.keys(n).reduce((o,s)=>(o[s]=c(s,t,n,u),o),{}):{}},c=(t,n,c,u)=>{const p=n.find(n=>n.name===t),l=null==p?void 0:p.type,f=c[t];return l&&!u.includes(l)?o(l,f):s(f)},o=(n,c)=>{if('_'===n.charAt(0)){const t=n.slice(1,n.length);return f(c,t)}switch(n){case t.bool:return u(c);case t.float4:case t.float8:case t.int2:case t.int4:case t.int8:case t.numeric:case t.oid:return p(c);case t.json:case t.jsonb:return l(c);case t.timestamp:return b(c);case t.abstime:case t.date:case t.daterange:case t.int4range:case t.int8range:case t.money:case t.reltime:case t.text:case t.time:case t.timestamptz:case t.timetz:case t.tsrange:case t.tstzrange:default:return s(c)}},s=t=>t,u=t=>{switch(t){case't':return!0;case'f':return!1;default:return t}},p=t=>{if('string'==typeof t){const n=parseFloat(t);if(!Number.isNaN(n))return n}return t},l=t=>{if('string'==typeof t)try{return JSON.parse(t)}catch(n){return t}return t},f=(t,n)=>{if('string'!=typeof t)return t;const c=t.length-1,s=t[c];if('{'===t[0]&&'}'===s){let s;const u=t.slice(1,c);try{s=JSON.parse('['+u+']')}catch(t){s=u?u.split(','):[]}return s.map(t=>o(n,t))}return t},b=t=>'string'==typeof t?t.replace(' ','T'):t,y=t=>{const n=new URL(t);return n.protocol=n.protocol.replace(/^ws/i,'http'),n.pathname=n.pathname.replace(/\/+$/,'').replace(/\/socket\/websocket$/i,'').replace(/\/socket$/i,'').replace(/\/websocket$/i,''),''===n.pathname||'/'===n.pathname?n.pathname='/api/broadcast':n.pathname=n.pathname+'/api/broadcast',n.href}},1178,[]); +__d(function(g,_r,_i,a,m,_e2,_d2){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"RealtimePostgresFilterBuilder",{enumerable:!0,get:function(){return d.RealtimePostgresFilterBuilder}}),Object.defineProperty(_e2,"postgresChangesFilter",{enumerable:!0,get:function(){return d.postgresChangesFilter}}),Object.defineProperty(_e2,"default",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e2,"REALTIME_POSTGRES_CHANGES_LISTEN_EVENT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e2,"REALTIME_LISTEN_TYPES",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e2,"REALTIME_SUBSCRIBE_STATES",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e2,"REALTIME_CHANNEL_STATES",{enumerable:!0,get:function(){return h}});var t,n,i,s=_r(_d2[0]),r=e(_r(_d2[1])),o=_r(_d2[2]),c=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(n){if('default'!==n){var i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,t})(o),l=_r(_d2[3]),u=e(_r(_d2[4])),d=_r(_d2[5]);!(function(e){e.ALL="*",e.INSERT="INSERT",e.UPDATE="UPDATE",e.DELETE="DELETE"})(t||(t={})),(function(e){e.BROADCAST="broadcast",e.PRESENCE="presence",e.POSTGRES_CHANGES="postgres_changes",e.SYSTEM="system"})(n||(n={})),(function(e){e.SUBSCRIBED="SUBSCRIBED",e.TIMED_OUT="TIMED_OUT",e.CLOSED="CLOSED",e.CHANNEL_ERROR="CHANNEL_ERROR"})(i||(i={}));const h=s.CHANNEL_STATES;class p{get state(){return this.channelAdapter.state}set state(e){this.channelAdapter.state=e}get joinedOnce(){return this.channelAdapter.joinedOnce}get timeout(){return this.socket.timeout}get joinPush(){return this.channelAdapter.joinPush}get rejoinTimer(){return this.channelAdapter.rejoinTimer}constructor(e,t={config:{}},n){var i,s;if(this.topic=e,this.params=t,this.socket=n,this.bindings={},this.subTopic=e.replace(/^realtime:/i,''),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:'',enabled:!1},private:!1},t.config),this.channelAdapter=new u.default(this.socket.socketAdapter,e,this.params),this.presence=new r.default(this),this._onClose(()=>{this.socket._remove(this)}),this._updateFilterTransform(),this.broadcastEndpointURL=(0,o.httpEndpointURL)(this.socket.socketAdapter.endPointURL()),this.private=this.params.config.private||!1,!this.private&&(null===(s=null===(i=this.params.config)||void 0===i?void 0:i.broadcast)||void 0===s?void 0:s.replay))throw new Error(`tried to use replay on public channel '${this.topic}'. It must be a private channel.`)}subscribe(e,t=this.timeout){var r,o,c;if(this.socket.isConnected()||this.socket.connect(),this.channelAdapter.isClosed()){const{config:{broadcast:u,presence:d,private:h}}=this.params,p=null!==(o=null===(r=this.bindings.postgres_changes)||void 0===r?void 0:r.map(e=>e.filter))&&void 0!==o?o:[],E=!!this.bindings[n.PRESENCE]&&this.bindings[n.PRESENCE].length>0||!0===(null===(c=this.params.config.presence)||void 0===c?void 0:c.enabled),b={},f={broadcast:u,presence:Object.assign(Object.assign({},d),{enabled:E}),postgres_changes:p,private:h};this.socket.accessTokenValue&&(b.access_token=this.socket.accessTokenValue),this._onError(t=>{null==e||e(i.CHANNEL_ERROR,(0,l.normalizeChannelError)(t))}),this._onClose(()=>null==e?void 0:e(i.CLOSED)),this.updateJoinPayload(Object.assign({config:f},b)),this._updateFilterMessage(),this.channelAdapter.subscribe(t).receive('ok',async({postgres_changes:t})=>{this.socket._isManualToken()||this.socket.setAuth(),void 0!==t?this._updatePostgresBindings(t,e):null==e||e(i.SUBSCRIBED)}).receive('error',t=>{this.state=s.CHANNEL_STATES.errored;const n=Object.values(t).join(', ')||'error';null==e||e(i.CHANNEL_ERROR,new Error(n,{cause:t}))}).receive('timeout',()=>{null==e||e(i.TIMED_OUT)})}return this}_updatePostgresBindings(e,t){var n;const r=this.bindings.postgres_changes,o=null!==(n=null==r?void 0:r.length)&&void 0!==n?n:0,c=[];for(let n=0;n{var i,s,r;const o=this.channelAdapter.push(e.type,e,t.timeout||this.timeout);'broadcast'!==e.type||(null===(r=null===(s=null===(i=this.params)||void 0===i?void 0:i.config)||void 0===s?void 0:s.broadcast)||void 0===r?void 0:r.ack)||n('ok'),o.receive('ok',()=>n('ok')),o.receive('error',()=>n('error')),o.receive('timeout',()=>n('timed out'))});{console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated in the future. Please use httpSend() explicitly for REST delivery.");const{event:s,payload:r}=e,o={apikey:this.socket.apiKey?this.socket.apiKey:'','Content-Type':'application/json'};this.socket.accessTokenValue&&(o.Authorization=`Bearer ${this.socket.accessTokenValue}`);const c={method:'POST',headers:o,body:JSON.stringify({messages:[{topic:this.subTopic,event:s,payload:r,private:this.private}]})};try{const e=await this._fetchWithTimeout(this.broadcastEndpointURL,c,null!==(n=t.timeout)&&void 0!==n?n:this.timeout);return await(null===(i=e.body)||void 0===i?void 0:i.cancel()),e.ok?'ok':'error'}catch(e){return e instanceof Error&&'AbortError'===e.name?'timed out':'error'}}}updateJoinPayload(e){this.channelAdapter.updateJoinPayload(e)}async unsubscribe(e=this.timeout){return new Promise(t=>{this.channelAdapter.unsubscribe(e).receive('ok',()=>t('ok')).receive('timeout',()=>t('timed out')).receive('error',()=>t('error'))})}teardown(){this.channelAdapter.teardown()}async _fetchWithTimeout(e,t,n){const i=new AbortController,s=setTimeout(()=>i.abort(),n),r=await this.socket.fetch(e,Object.assign(Object.assign({},t),{signal:i.signal}));return clearTimeout(s),r}_on(e,t,n){const i=e.toLocaleLowerCase(),s=null==t?void 0:t.filter;(s instanceof d.RealtimePostgresFilterBuilder||'object'==typeof s&&null!==s&&'function'==typeof s.build)&&(t=Object.assign(Object.assign({},t),{filter:s.build()}));const r={type:i,filter:t,callback:n,ref:this.channelAdapter.on(e,n)};return this.bindings[i]?this.bindings[i].push(r):this.bindings[i]=[r],this._updateFilterMessage(),this}_onClose(e){this.channelAdapter.onClose(e)}_onError(e){this.channelAdapter.onError(e)}_updateFilterMessage(){this.channelAdapter.updateFilterBindings((e,t,n)=>{var i,s,r,o,c,l,u;const d=e.event.toLocaleLowerCase();if(this._notThisChannelEvent(d,n))return!1;const h=null===(i=this.bindings[d])||void 0===i?void 0:i.find(t=>t.ref===e.ref);if(!h)return!0;if(['broadcast','presence','postgres_changes'].includes(d)){if('id'in h){const e=h.id,n=null===(s=h.filter)||void 0===s?void 0:s.event;return e&&(null===(r=t.ids)||void 0===r?void 0:r.includes(e))&&('*'===n||(null==n?void 0:n.toLocaleLowerCase())===(null===(o=t.data)||void 0===o?void 0:o.type.toLocaleLowerCase()))}{const e=null===(l=null===(c=null==h?void 0:h.filter)||void 0===c?void 0:c.event)||void 0===l?void 0:l.toLocaleLowerCase();return'*'===e||e===(null===(u=null==t?void 0:t.event)||void 0===u?void 0:u.toLocaleLowerCase())}}return h.type.toLocaleLowerCase()===d})}_notThisChannelEvent(e,t){const{close:n,error:i,leave:r,join:o}=s.CHANNEL_EVENTS;return t&&[n,i,r,o].includes(e)&&t!==this.joinPush.ref}_updateFilterTransform(){this.channelAdapter.updatePayloadTransform((e,t,n)=>{if('object'==typeof t&&'ids'in t){const e=t.data,{schema:n,table:i,commit_timestamp:s,type:r,errors:o}=e,c={schema:n,table:i,commit_timestamp:s,eventType:r,new:{},old:{},errors:o};return Object.assign(Object.assign({},c),this._getPayloadRecords(e))}return t})}copyBindings(e){if(this.joinedOnce)throw new Error('cannot copy bindings into joined channel');for(const t in e.bindings)for(const n of e.bindings[t])this._on(n.type,n.filter,n.callback)}static isFilterValueEqual(e,t){return(null!=e?e:void 0)===(null!=t?t:void 0)}_getPayloadRecords(e){const t={new:{},old:{}};return'INSERT'!==e.type&&'UPDATE'!==e.type||(t.new=c.convertChangeData(e.columns,e.record)),'UPDATE'!==e.type&&'DELETE'!==e.type||(t.old=c.convertChangeData(e.columns,e.old_record)),t}}},1179,[1175,1180,1178,1183,1184,1185]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"REALTIME_PRESENCE_LISTEN_EVENTS",{enumerable:!0,get:function(){return t}});var e,t,n=r(d[0]),c=(e=n)&&e.__esModule?e:{default:e};!(function(e){e.SYNC="sync",e.JOIN="join",e.LEAVE="leave"})(t||(t={}));class u{get state(){return this.presenceAdapter.state}constructor(e,t){this.channel=e,this.presenceAdapter=new c.default(this.channel.channelAdapter,t)}}},1180,[1181]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}});var n=r(d[0]);class t{constructor(s,c){const u=o(c);this.presence=new n.Presence(s.getChannel(),u),this.presence.onJoin((n,c,o)=>{const u=t.onJoinPayload(n,c,o);s.getChannel().trigger('presence',u)}),this.presence.onLeave((n,c,o)=>{const u=t.onLeavePayload(n,c,o);s.getChannel().trigger('presence',u)}),this.presence.onSync(()=>{s.getChannel().trigger('presence',{event:'sync'})})}get state(){return t.transformState(this.presence.state)}static transformState(n){return n=c(n),Object.getOwnPropertyNames(n).reduce((t,c)=>{const o=n[c];return t[c]=s(o),t},{})}static onJoinPayload(n,t,c){return{event:'join',key:n,currentPresences:u(t),newPresences:s(c)}}static onLeavePayload(n,t,c){return{event:'leave',key:n,currentPresences:u(t),leftPresences:s(c)}}}function s(n){return n.metas.map(n=>(n.presence_ref=n.phx_ref,delete n.phx_ref,delete n.phx_ref_prev,n))}function c(n){return JSON.parse(JSON.stringify(n))}function o(n){return(null==n?void 0:n.events)&&{events:n.events}}function u(n){return(null==n?void 0:n.metas)?s(n):[]}},1181,[1182]); +__d(function(g,r,_i,a,_m,_e2,d){"use strict";Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"Channel",{enumerable:!0,get:function(){return A}}),Object.defineProperty(_e2,"LongPoll",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e2,"Presence",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e2,"Push",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e2,"Serializer",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e2,"Socket",{enumerable:!0,get:function(){return $}}),Object.defineProperty(_e2,"Timer",{enumerable:!0,get:function(){return w}});var e=e=>{if("function"==typeof e)return e;return function(){return e}},t="undefined"!=typeof self?self:null,s="undefined"!=typeof window?window:null,i=t||s||globalThis,n=0,o=1,h=2,c=3,l="closed",u="errored",f="joined",p="joining",m="leaving",b="phx_close",k="phx_error",T="phx_join",y="phx_reply",C="phx_leave",v="longpoll",R="websocket",j=4,E="base64url.bearer.phx.",S=class{constructor(e,t,s,i){this.channel=e,this.event=t,this.payload=s||function(){return{}},this.receivedResp=null,this.timeout=i,this.timeoutTimer=null,this.recHooks=[],this.sent=!1,this.ref=void 0}resend(e){this.timeout=e,this.reset(),this.send()}send(){this.hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload(),ref:this.ref,join_ref:this.channel.joinRef()}))}receive(e,t){return this.hasReceived(e)&&t(this.receivedResp.response),this.recHooks.push({status:e,callback:t}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}destroy(){this.cancelRefEvent(),this.cancelTimeout()}matchReceive({status:e,response:t,_ref:s}){this.recHooks.filter(t=>t.status===e).forEach(e=>e.callback(t))}cancelRefEvent(){this.refEvent&&this.channel.off(this.refEvent)}cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null}startTimeout(){this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,e=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=e,this.matchReceive(e)}),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}trigger(e,t){this.channel.trigger(this.refEvent,{status:e,response:t})}},w=class{constructor(e,t){this.callback=e,this.timerCalc=t,this.timer=void 0,this.tries=0}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}},A=class{constructor(t,s,i){this.state=l,this.topic=t,this.params=e(s||{}),this.socket=i,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new S(this,T,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new w(()=>{this.socket.isConnected()&&this.rejoin()},this.socket.rejoinAfterMs),this.stateChangeRefs.push(this.socket.onError(()=>this.rejoinTimer.reset())),this.stateChangeRefs.push(this.socket.onOpen(()=>{this.rejoinTimer.reset(),this.isErrored()&&this.rejoin()})),this.joinPush.receive("ok",()=>{this.state=f,this.rejoinTimer.reset(),this.pushBuffer.forEach(e=>e.send()),this.pushBuffer=[]}),this.joinPush.receive("error",e=>{this.state=u,this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,e),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.onClose(()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log("channel",`close ${this.topic}`),this.state=l,this.socket.remove(this)}),this.onError(e=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,e),this.isJoining()&&this.joinPush.reset(),this.state=u,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.joinPush.receive("timeout",()=>{this.socket.hasLogger()&&this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),new S(this,C,e({}),this.timeout).send(),this.state=u,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(y,(e,t)=>{this.trigger(this.replyEventName(t),e)})}join(e=this.timeout){if(this.joinedOnce)throw new Error("tried to join multiple times. 'join' can only be called a single time per channel instance");return this.timeout=e,this.joinedOnce=!0,this.rejoin(),this.joinPush}teardown(){this.pushBuffer.forEach(e=>e.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=l,this.bindings=[]}onClose(e){this.on(b,e)}onError(e){return this.on(k,t=>e(t))}on(e,t){let s=this.bindingRef++;return this.bindings.push({event:e,ref:s,callback:t}),s}off(e,t){this.bindings=this.bindings.filter(s=>!(s.event===e&&(void 0===t||t===s.ref)))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(e,t,s=this.timeout){if(t=t||{},!this.joinedOnce)throw new Error(`tried to push '${e}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let i=new S(this,e,function(){return t},s);return this.canPush()?i.send():(i.startTimeout(),this.pushBuffer.push(i)),i}leave(t=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=m;let s=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(b,"leave")},i=new S(this,C,e({}),t);return i.receive("ok",()=>s()).receive("timeout",()=>s()),i.send(),this.canPush()||i.trigger("ok",{}),i}onMessage(e,t,s){return t}filterBindings(e,t,s){return!0}isMember(e,t,s,i){return this.topic===e&&(!i||i===this.joinRef()||(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:e,event:t,payload:s,joinRef:i}),!1))}joinRef(){return this.joinPush.ref}rejoin(e=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=p,this.joinPush.resend(e))}trigger(e,t,s,i){let n=this.onMessage(e,t,s,i);if(t&&!n)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let o=this.bindings.filter(i=>i.event===e&&this.filterBindings(i,t,s));for(let e=0;eu.abort(),o);l.signal=u.signal}return i.fetch(t,l).then(e=>e.text()).then(e=>this.parseJSON(e)).then(e=>c&&c(e)).catch(e=>{"AbortError"===e.name&&h?h():c&&c(null)}),u}static xdomainRequest(e,t,s,i,n,o,h){return e.timeout=n,e.open(t,s),e.onload=()=>{let t=this.parseJSON(e.responseText);h&&h(t)},o&&(e.ontimeout=o),e.onprogress=()=>{},e.send(i),e}static xhrRequest(e,t,s,i,n,o,h,c){e.open(t,s,!0),e.timeout=o;for(let[t,s]of Object.entries(i))e.setRequestHeader(t,s);return e.onerror=()=>c&&c(null),e.onreadystatechange=()=>{if(e.readyState===j&&c){let t=this.parseJSON(e.responseText);c(t)}},h&&(e.ontimeout=h),e.send(n),e}static parseJSON(e){if(!e||""===e)return null;try{return JSON.parse(e)}catch{return console&&console.log("failed to parse JSON response",e),null}}static serialize(e,t){let s=[];for(var i in e){if(!Object.prototype.hasOwnProperty.call(e,i))continue;let n=t?`${t}[${i}]`:i,o=e[i];"object"==typeof o?s.push(this.serialize(o,n)):s.push(encodeURIComponent(n)+"="+encodeURIComponent(o))}return s.join("&")}static appendParams(e,t){if(0===Object.keys(t).length)return e;let s=e.match(/\?/)?"&":"?";return`${e}${s}${this.serialize(t)}`}},L=e=>{let t="",s=new Uint8Array(e),i=s.byteLength;for(let e=0;ethis.poll(),0)}normalizeEndpoint(e){return e.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+R),"$1/"+v)}endpointURL(){return H.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(e,t,s){this.close(e,t,s),this.readyState=n}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===o||this.readyState===n}poll(){const e={Accept:"application/json"};this.authToken&&(e["X-Phoenix-AuthToken"]=this.authToken),this.ajax("GET",e,null,()=>this.ontimeout(),e=>{if(e){var{status:t,token:s,messages:i}=e;if(410===t&&null!==this.token)return this.onerror(410),void this.closeAndRetry(3410,"session_gone",!1);this.token=s}else t=0;switch(t){case 200:i.forEach(e=>{setTimeout(()=>this.onmessage({data:e}),0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=o,this.onopen({}),this.poll();break;case 403:this.onerror(403),this.close(1008,"forbidden",!1);break;case 0:case 500:this.onerror(500),this.closeAndRetry(1011,"internal server error",500);break;default:throw new Error(`unhandled poll status ${t}`)}})}send(e){"string"!=typeof e&&(e=L(e)),this.currentBatch?this.currentBatch.push(e):this.awaitingBatchAck?this.batchBuffer.push(e):(this.currentBatch=[e],this.currentBatchTimer=setTimeout(()=>{this.batchSend(this.currentBatch),this.currentBatch=null},0))}batchSend(e){this.awaitingBatchAck=!0,this.ajax("POST",{"Content-Type":"application/x-ndjson"},e.join("\n"),()=>this.onerror("timeout"),e=>{this.awaitingBatchAck=!1,e&&200===e.status?this.batchBuffer.length>0&&(this.batchSend(this.batchBuffer),this.batchBuffer=[]):(this.onerror(e&&e.status),this.closeAndRetry(1011,"internal server error",!1))})}close(e,t,s){for(let e of this.reqs)e.abort();this.readyState=c;let i=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:e,reason:t,wasClean:s});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,"undefined"!=typeof CloseEvent?this.onclose(new CloseEvent("close",i)):this.onclose(i)}ajax(e,t,s,i,n){let o;o=H.request(e,this.endpointURL(),t,s,this.timeout,()=>{this.reqs.delete(o),i()},e=>{this.reqs.delete(o),this.isActive()&&n(e)}),this.reqs.add(o)}},B=class e{constructor(t,s={}){let i=s.events||{state:"presence_state",diff:"presence_diff"};this.state={},this.pendingDiffs=[],this.channel=t,this.joinRef=null,this.caller={onJoin:function(){},onLeave:function(){},onSync:function(){}},this.channel.on(i.state,t=>{let{onJoin:s,onLeave:i,onSync:n}=this.caller;this.joinRef=this.channel.joinRef(),this.state=e.syncState(this.state,t,s,i),this.pendingDiffs.forEach(t=>{this.state=e.syncDiff(this.state,t,s,i)}),this.pendingDiffs=[],n()}),this.channel.on(i.diff,t=>{let{onJoin:s,onLeave:i,onSync:n}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(t):(this.state=e.syncDiff(this.state,t,s,i),n())})}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}list(t){return e.list(this.state,t)}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel.joinRef()}static syncState(e,t,s,i){let n=this.clone(e),o={},h={};return this.map(n,(e,s)=>{t[e]||(h[e]=s)}),this.map(t,(e,t)=>{let s=n[e];if(s){let i=t.metas.map(e=>e.phx_ref),n=s.metas.map(e=>e.phx_ref),c=t.metas.filter(e=>n.indexOf(e.phx_ref)<0),l=s.metas.filter(e=>i.indexOf(e.phx_ref)<0);c.length>0&&(o[e]=t,o[e].metas=c),l.length>0&&(h[e]=this.clone(s),h[e].metas=l)}else o[e]=t}),this.syncDiff(n,{joins:o,leaves:h},s,i)}static syncDiff(e,t,s,i){let{joins:n,leaves:o}=this.clone(t);return s||(s=function(){}),i||(i=function(){}),this.map(n,(t,i)=>{let n=e[t];if(e[t]=this.clone(i),n){let s=e[t].metas.map(e=>e.phx_ref),i=n.metas.filter(e=>s.indexOf(e.phx_ref)<0);e[t].metas.unshift(...i)}s(t,n,i)}),this.map(o,(t,s)=>{let n=e[t];if(!n)return;let o=s.metas.map(e=>e.phx_ref);n.metas=n.metas.filter(e=>o.indexOf(e.phx_ref)<0),i(t,n,s),0===n.metas.length&&delete e[t]}),e}static list(e,t){return t||(t=function(e,t){return t}),this.map(e,(e,s)=>t(e,s))}static map(e,t){return Object.getOwnPropertyNames(e).map(s=>t(s,e[s]))}static clone(e){return JSON.parse(JSON.stringify(e))}},O={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(e,t){if(e.payload.constructor===ArrayBuffer)return t(this.binaryEncode(e));{let s=[e.join_ref,e.ref,e.topic,e.event,e.payload];return t(JSON.stringify(s))}},decode(e,t){if(e.constructor===ArrayBuffer)return t(this.binaryDecode(e));{let[s,i,n,o,h]=JSON.parse(e);return t({join_ref:s,ref:i,topic:n,event:o,payload:h})}},binaryEncode(e){let{join_ref:t,ref:s,event:i,topic:n,payload:o}=e,h=this.META_LENGTH+t.length+s.length+n.length+i.length,c=new ArrayBuffer(this.HEADER_LENGTH+h),l=new DataView(c),u=0;l.setUint8(u++,this.KINDS.push),l.setUint8(u++,t.length),l.setUint8(u++,s.length),l.setUint8(u++,n.length),l.setUint8(u++,i.length),Array.from(t,e=>l.setUint8(u++,e.charCodeAt(0))),Array.from(s,e=>l.setUint8(u++,e.charCodeAt(0))),Array.from(n,e=>l.setUint8(u++,e.charCodeAt(0))),Array.from(i,e=>l.setUint8(u++,e.charCodeAt(0)));var f=new Uint8Array(c.byteLength+o.byteLength);return f.set(new Uint8Array(c),0),f.set(new Uint8Array(o),c.byteLength),f.buffer},binaryDecode(e){let t=new DataView(e),s=t.getUint8(0),i=new TextDecoder;switch(s){case this.KINDS.push:return this.decodePush(e,t,i);case this.KINDS.reply:return this.decodeReply(e,t,i);case this.KINDS.broadcast:return this.decodeBroadcast(e,t,i)}},decodePush(e,t,s){let i=t.getUint8(1),n=t.getUint8(2),o=t.getUint8(3),h=this.HEADER_LENGTH+this.META_LENGTH-1,c=s.decode(e.slice(h,h+i));h+=i;let l=s.decode(e.slice(h,h+n));h+=n;let u=s.decode(e.slice(h,h+o));return h+=o,{join_ref:c,ref:null,topic:l,event:u,payload:e.slice(h,e.byteLength)}},decodeReply(e,t,s){let i=t.getUint8(1),n=t.getUint8(2),o=t.getUint8(3),h=t.getUint8(4),c=this.HEADER_LENGTH+this.META_LENGTH,l=s.decode(e.slice(c,c+i));c+=i;let u=s.decode(e.slice(c,c+n));c+=n;let f=s.decode(e.slice(c,c+o));c+=o;let p=s.decode(e.slice(c,c+h));c+=h;let m=e.slice(c,e.byteLength);return{join_ref:l,ref:u,topic:f,event:y,payload:{status:p,response:m}}},decodeBroadcast(e,t,s){let i=t.getUint8(1),n=t.getUint8(2),o=this.HEADER_LENGTH+2,h=s.decode(e.slice(o,o+i));o+=i;let c=s.decode(e.slice(o,o+n));return o+=n,{join_ref:null,ref:null,topic:h,event:c,payload:e.slice(o,e.byteLength)}}},$=class{constructor(t,n={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=n.timeout||1e4,this.transport=n.transport||i.WebSocket||P,this.conn=void 0,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=n.longPollFallbackMs,this.fallbackTimer=null;let o=null;try{o=i&&i.sessionStorage}catch{}this.sessionStore=n.sessionStorage||o,this.establishedConnections=0,this.defaultEncoder=O.encode.bind(O),this.defaultDecoder=O.decode.bind(O),this.closeWasClean=!0,this.disconnecting=!1,this.binaryType=n.binaryType||"arraybuffer",this.connectClock=1,this.pageHidden=!1,this.encode=void 0,this.decode=void 0,this.transport!==P?(this.encode=n.encode||this.defaultEncoder,this.decode=n.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let h=null;s&&s.addEventListener&&(s.addEventListener("pagehide",e=>{this.conn&&(this.disconnect(),h=this.connectClock)}),s.addEventListener("pageshow",e=>{h===this.connectClock&&(h=null,this.connect())}),s.addEventListener("visibilitychange",()=>{"hidden"===document.visibilityState?this.pageHidden=!0:(this.pageHidden=!1,this.isConnected()||this.closeWasClean||this.teardown(()=>this.connect()))})),this.heartbeatIntervalMs=n.heartbeatIntervalMs||3e4,this.autoSendHeartbeat=n.autoSendHeartbeat??!0,this.heartbeatCallback=n.heartbeatCallback??(()=>{}),this.rejoinAfterMs=e=>n.rejoinAfterMs?n.rejoinAfterMs(e):[1e3,2e3,5e3][e-1]||1e4,this.reconnectAfterMs=e=>n.reconnectAfterMs?n.reconnectAfterMs(e):[10,50,100,150,200,250,500,1e3,2e3][e-1]||5e3,this.logger=n.logger||null,!this.logger&&n.debug&&(this.logger=(e,t,s)=>{console.log(`${e}: ${t}`,s)}),this.longpollerTimeout=n.longpollerTimeout||2e4,this.params=e(n.params||{}),this.endPoint=`${t}/${R}`,this.vsn=n.vsn||"2.0.0",this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.heartbeatSentAt=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new w(()=>{if(this.pageHidden)return this.log("Not reconnecting as page is hidden!"),void this.teardown();this.teardown(async()=>{n.beforeReconnect&&await n.beforeReconnect(),this.connect()})},this.reconnectAfterMs),this.authToken=n.authToken}getLongPollTransport(){return P}replaceTransport(e){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.conn&&(this.conn.close(),this.conn=null),this.transport=e}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let e=H.appendParams(H.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return"/"!==e.charAt(0)?e:"/"===e.charAt(1)?`${this.protocol()}:${e}`:`${this.protocol()}://${location.host}${e}`}disconnect(e,t,s){this.connectClock++,this.disconnecting=!0,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(()=>{this.disconnecting=!1,e&&e()},t,s)}connect(t){t&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=e(t)),this.conn&&!this.disconnecting||(this.longPollFallbackMs&&this.transport!==P?this.connectWithFallback(P,this.longPollFallbackMs):this.transportConnect())}log(e,t,s){this.logger&&this.logger(e,t,s)}hasLogger(){return null!==this.logger}onOpen(e){let t=this.makeRef();return this.stateChangeCallbacks.open.push([t,e]),t}onClose(e){let t=this.makeRef();return this.stateChangeCallbacks.close.push([t,e]),t}onError(e){let t=this.makeRef();return this.stateChangeCallbacks.error.push([t,e]),t}onMessage(e){let t=this.makeRef();return this.stateChangeCallbacks.message.push([t,e]),t}onHeartbeat(e){this.heartbeatCallback=e}ping(e){if(!this.isConnected())return!1;let t=this.makeRef(),s=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:t});let i=this.onMessage(n=>{n.ref===t&&(this.off([i]),e(Date.now()-s))});return!0}transportName(e){return e===P?"LongPoll":e.name}transportConnect(){let e;this.connectClock++,this.closeWasClean=!1,this.authToken&&(e=["phoenix",`${E}${btoa(this.authToken).replace(/=/g,"")}`]),this.conn=new this.transport(this.endPointURL(),e),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=()=>this.onConnOpen(),this.conn.onerror=e=>this.onConnError(e),this.conn.onmessage=e=>this.onConnMessage(e),this.conn.onclose=e=>this.onConnClose(e)}getSession(e){return this.sessionStore&&this.sessionStore.getItem(e)}storeSession(e,t){this.sessionStore&&this.sessionStore.setItem(e,t)}connectWithFallback(e,t=2500){clearTimeout(this.fallbackTimer);let s,i=!1,n=!0,o=this.transportName(e),h=t=>{this.log("transport",`falling back to ${o}...`,t),this.off([void 0,s]),n=!1,this.replaceTransport(e),this.transportConnect()};if(this.getSession(`phx:fallback:${o}`))return h("memorized");this.fallbackTimer=setTimeout(h,t),s=this.onError(e=>{this.log("transport","error",e),n&&!i&&(clearTimeout(this.fallbackTimer),h(e))}),this.fallbackRef&&this.off([this.fallbackRef]),this.fallbackRef=this.onOpen(()=>{if(i=!0,!n){let t=this.transportName(e);return this.primaryPassedHealthCheck||this.storeSession(`phx:fallback:${t}`,"true"),this.log("transport",`established ${t} fallback`)}clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(h,t),this.ping(e=>{this.log("transport","connected to primary after",e),this.primaryPassedHealthCheck=!0,clearTimeout(this.fallbackTimer)})}),this.transportConnect()}clearHeartbeats(){clearTimeout(this.heartbeatTimer),clearTimeout(this.heartbeatTimeoutTimer)}onConnOpen(){this.hasLogger()&&this.log("transport",`connected to ${this.endPointURL()}`),this.closeWasClean=!1,this.disconnecting=!1,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.autoSendHeartbeat&&this.resetHeartbeat(),this.triggerStateCallbacks("open")}heartbeatTimeout(){if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.hasLogger()&&this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(e){this.log("error","error in heartbeat callback",e)}this.triggerChanError(new Error("heartbeat timeout")),this.closeWasClean=!1,this.teardown(()=>this.reconnectTimer.scheduleTimeout(),1e3,"heartbeat timeout")}}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}teardown(e,t,s){if(!this.conn)return e&&e();const i=this.conn;this.waitForBufferDone(i,()=>{t?i.close(t,s||""):i.close(),this.waitForSocketClosed(i,()=>{this.conn===i&&(this.conn.onopen=function(){},this.conn.onerror=function(){},this.conn.onmessage=function(){},this.conn.onclose=function(){},this.conn=null),e&&e()})})}waitForBufferDone(e,t,s=1){5!==s&&e.bufferedAmount?setTimeout(()=>{this.waitForBufferDone(e,t,s+1)},150*s):t()}waitForSocketClosed(e,t,s=1){5!==s&&e.readyState!==c?setTimeout(()=>{this.waitForSocketClosed(e,t,s+1)},150*s):t()}onConnClose(e){this.conn&&(this.conn.onclose=()=>{}),this.hasLogger()&&this.log("transport","close",e),this.triggerChanError(e),this.clearHeartbeats(),this.closeWasClean||this.reconnectTimer.scheduleTimeout(),this.triggerStateCallbacks("close",e)}onConnError(e){this.hasLogger()&&this.log("transport","error",e);let t=this.transport,s=this.establishedConnections;this.triggerStateCallbacks("error",e,t,s),(t===this.transport||s>0)&&this.triggerChanError(e)}triggerChanError(e){this.channels.forEach(t=>{t.isErrored()||t.isLeaving()||t.isClosed()||t.trigger(k,e)})}connectionState(){switch(this.conn&&this.conn.readyState){case n:return"connecting";case o:return"open";case h:return"closing";default:return"closed"}}isConnected(){return"open"===this.connectionState()}remove(e){this.off(e.stateChangeRefs),this.channels=this.channels.filter(t=>t!==e)}off(e){for(let t in this.stateChangeCallbacks)this.stateChangeCallbacks[t]=this.stateChangeCallbacks[t].filter(([t])=>-1===e.indexOf(t))}channel(e,t={}){let s=new A(e,t,this);return this.channels.push(s),s}push(e){if(this.hasLogger()){let{topic:t,event:s,payload:i,ref:n,join_ref:o}=e;this.log("push",`${t} ${s} (${o}, ${n})`,i)}this.isConnected()?this.encode(e,e=>this.conn.send(e)):this.sendBuffer.push(()=>this.encode(e,e=>this.conn.send(e)))}makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}sendHeartbeat(){if(this.isConnected())if(this.pendingHeartbeatRef)this.heartbeatTimeout();else{this.pendingHeartbeatRef=this.makeRef(),this.heartbeatSentAt=Date.now(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(e){this.log("error","error in heartbeat callback",e)}this.heartbeatTimeoutTimer=setTimeout(()=>this.heartbeatTimeout(),this.heartbeatIntervalMs)}else try{this.heartbeatCallback("disconnected")}catch(e){this.log("error","error in heartbeat callback",e)}}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}onConnMessage(e){this.decode(e.data,e=>{let{topic:t,event:s,payload:i,ref:n,join_ref:o}=e;if(n&&n===this.pendingHeartbeatRef){const e=this.heartbeatSentAt?Date.now()-this.heartbeatSentAt:void 0;this.clearHeartbeats();try{this.heartbeatCallback("ok"===i.status?"ok":"error",e)}catch(e){this.log("error","error in heartbeat callback",e)}this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.autoSendHeartbeat&&(this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}this.hasLogger()&&this.log("receive",`${i.status||""} ${t} ${s} ${n&&"("+n+")"||""}`.trim(),i);for(let e=0;e{try{i(...t)}catch(t){this.log("error",`error in ${e} callback`,t)}})}catch(t){this.log("error",`error triggering ${e} callbacks`,t)}}leaveOpenTopic(e){let t=this.channels.find(t=>t.topic===e&&(t.isJoined()||t.isJoining()));t&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${e}"`),t.leave())}}},1182,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.normalizeChannelError=function(n){if(n instanceof Error)return n;if('string'==typeof n)return new Error(n);if(n&&'object'==typeof n){const o=n;if('number'==typeof o.code){const t='string'==typeof o.reason&&o.reason?` (${o.reason})`:'';return new Error(`socket closed: ${o.code}${t}`,{cause:n})}return new Error('channel error: transport failure',{cause:n})}return new Error('channel error: connection lost')}},1183,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}});var n=r(d[0]);class t{constructor(n,t,s){const h=(o=s,{config:Object.assign({broadcast:{ack:!1,self:!1},presence:{key:'',enabled:!1},private:!1},o.config)});var o;this.channel=n.getSocket().channel(t,h),this.socket=n}get state(){return this.channel.state}set state(n){this.channel.state=n}get joinedOnce(){return this.channel.joinedOnce}get joinPush(){return this.channel.joinPush}get rejoinTimer(){return this.channel.rejoinTimer}on(n,t){return this.channel.on(n,t)}off(n,t){this.channel.off(n,t)}subscribe(n){return this.channel.join(n)}unsubscribe(n){return this.channel.leave(n)}teardown(){this.channel.teardown()}onClose(n){this.channel.onClose(n)}onError(n){return this.channel.onError(n)}push(t,s,h){let o;try{o=this.channel.push(t,s,h)}catch(n){throw new Error(`tried to push '${t}' to '${this.channel.topic}' before joining. Use channel.subscribe() before pushing events`)}if(this.channel.pushBuffer.length>n.MAX_PUSH_BUFFER_SIZE){const n=this.channel.pushBuffer.shift();n.cancelTimeout(),this.socket.log('channel',`discarded push due to buffer overflow: ${n.event}`,n.payload())}return o}updateJoinPayload(n){const t=this.channel.joinPush.payload();this.channel.joinPush.payload=()=>Object.assign(Object.assign({},t),n)}canPush(){return this.socket.isConnected()&&this.state===n.CHANNEL_STATES.joined}isJoined(){return this.state===n.CHANNEL_STATES.joined}isJoining(){return this.state===n.CHANNEL_STATES.joining}isClosed(){return this.state===n.CHANNEL_STATES.closed}isLeaving(){return this.state===n.CHANNEL_STATES.leaving}updateFilterBindings(n){this.channel.filterBindings=n}updatePayloadTransform(n){this.channel.onMessage=n}getChannel(){return this.channel}}},1184,[1175]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"RealtimePostgresFilterBuilder",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"postgresChangesFilter",{enumerable:!0,get:function(){return c}});const t=/[,()"\\]/,n=n=>t.test(n)||n!==n.trim(),s=t=>`"${t.replace(/\\/g,'\\\\').replace(/"/g,'\\"')}"`,u=t=>{const u=null===t?'null':String(t);return n(u)?s(u):u},l=t=>null===t?'null':String(t),h=(t,n)=>{if('in'===t){const t=Array.isArray(n)?n:[n];if(0===t.length)throw new Error('Realtime `in` filter requires at least one value.');return`in.(${Array.from(new Set(t)).map(t=>u(t)).join(',')})`}return'is'===t?`is.${l(n)}`:`${t}.${u(n)}`};class o{constructor(){this.filters=[]}add(t,n,s,u=!1){const l=u?'not.':'';return this.filters.push(`${t}=${l}${h(n,s)}`),this}eq(t,n){return this.add(t,'eq',n)}neq(t,n){return this.add(t,'neq',n)}gt(t,n){return this.add(t,'gt',n)}gte(t,n){return this.add(t,'gte',n)}lt(t,n){return this.add(t,'lt',n)}lte(t,n){return this.add(t,'lte',n)}in(t,n){return this.add(t,'in',n)}like(t,n){return this.add(t,'like',n)}ilike(t,n){return this.add(t,'ilike',n)}match(t,n){return this.add(t,'match',n)}imatch(t,n){return this.add(t,'imatch',n)}is(t,n){return this.add(t,'is',n)}isDistinct(t,n){return this.add(t,'isdistinct',n)}not(t,n,s){return this.add(t,n,s,!0)}build(){return this.filters.join(',')}toString(){return this.build()}}const c=()=>new o},1185,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return s}});var t=r(d[0]),n=r(d[1]);class s{constructor(n,s){this.socket=new t.Socket(n,s)}get timeout(){return this.socket.timeout}get endPoint(){return this.socket.endPoint}get transport(){return this.socket.transport}get heartbeatIntervalMs(){return this.socket.heartbeatIntervalMs}get heartbeatCallback(){return this.socket.heartbeatCallback}set heartbeatCallback(t){this.socket.heartbeatCallback=t}get heartbeatTimer(){return this.socket.heartbeatTimer}get pendingHeartbeatRef(){return this.socket.pendingHeartbeatRef}get reconnectTimer(){return this.socket.reconnectTimer}get vsn(){return this.socket.vsn}get encode(){return this.socket.encode}get decode(){return this.socket.decode}get reconnectAfterMs(){return this.socket.reconnectAfterMs}get sendBuffer(){return this.socket.sendBuffer}get stateChangeCallbacks(){return this.socket.stateChangeCallbacks}connect(){this.socket.connect()}disconnect(t,n,s,o=1e4){return new Promise(c=>{setTimeout(()=>c('timeout'),o),this.socket.disconnect(()=>{t(),c('ok')},n,s)})}push(t){this.socket.push(t)}log(t,n,s){this.socket.log(t,n,s)}makeRef(){return this.socket.makeRef()}onOpen(t){this.socket.onOpen(t)}onClose(t){this.socket.onClose(t)}onError(t){this.socket.onError(t)}onMessage(t){this.socket.onMessage(t)}isConnected(){return this.socket.isConnected()}isConnecting(){return this.socket.connectionState()==n.CONNECTION_STATE.connecting}isDisconnecting(){return this.socket.connectionState()==n.CONNECTION_STATE.closing}connectionState(){return this.socket.connectionState()}endPointURL(){return this.socket.endPointURL()}sendHeartbeat(){this.socket.sendHeartbeat()}getSocket(){return this.socket}}},1186,[1182,1175]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"StorageAnalyticsClient",{enumerable:!0,get:function(){return H}}),Object.defineProperty(_e,"StorageApiError",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"StorageClient",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(_e,"StorageError",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"StorageUnknownError",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"StorageVectorsApiError",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"StorageVectorsClient",{enumerable:!0,get:function(){return X}}),Object.defineProperty(_e,"StorageVectorsError",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"StorageVectorsErrorCode",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"StorageVectorsUnknownError",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"VectorBucketApi",{enumerable:!0,get:function(){return W}}),Object.defineProperty(_e,"VectorBucketScope",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(_e,"VectorDataApi",{enumerable:!0,get:function(){return G}}),Object.defineProperty(_e,"VectorIndexApi",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(_e,"VectorIndexScope",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(_e,"isStorageError",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"isStorageVectorsError",{enumerable:!0,get:function(){return f}});var e=_r(d[0]);function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(e,r){if("object"!=t(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,r||"default");if("object"!=t(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}function n(e){var n=r(e,"string");return"symbol"==t(n)?n:n+""}function o(e,t,r){return(t=n(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function c(e){for(var t=1;t{if("object"!=typeof e||null===e)return!1;const t=Object.getPrototypeOf(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},k=e=>{if(Array.isArray(e))return e.map(e=>k(e));if("function"==typeof e||e!==Object(e))return e;const t={};return Object.entries(e).forEach(([e,r])=>{const n=e.replace(/([-_][a-z])/gi,e=>e.toUpperCase().replace(/[-_]/g,""));t[n]=k(r)}),t},x=e=>!(!e||"string"!=typeof e)&&(!(0===e.length||e.length>100)&&(e.trim()===e&&(!e.includes("/")&&!e.includes("\\")&&/^[\w!.\*'() &$@=;:+,?-]+$/.test(e)))),$=e=>{if("object"==typeof e&&null!==e){const t=e;if("string"==typeof t.msg)return t.msg;if("string"==typeof t.message)return t.message;if("string"==typeof t.error_description)return t.error_description;if("string"==typeof t.error)return t.error;if("object"==typeof t.error&&null!==t.error){const e=t.error;if("string"==typeof e.message)return e.message}}return JSON.stringify(e)},j=async(e,t,r,n)=>{if(null!==e&&"object"==typeof e&&"json"in e&&"function"==typeof e.json){const r=e;let o=parseInt(String(r.status),10);Number.isFinite(o)||(o=500),r.json().then(e=>{const r=(null==e?void 0:e.statusCode)||(null==e?void 0:e.code)||o+"";t(new l($(e),o,r,n))}).catch(()=>{const e=o+"";t(new l(r.statusText||`HTTP ${o} error`,o,e,n))})}else t(new h($(e),e,n))},B=(e,t,r,n)=>{const o={method:e,headers:(null==t?void 0:t.headers)||{}};if("GET"===e||"HEAD"===e||!n)return c(c({},o),r);if(S(n)){var s;const e=(null==t?void 0:t.headers)||{};let r;for(const[t,n]of Object.entries(e))"content-type"===t.toLowerCase()&&(r=n);o.headers=w(e,"Content-Type",null!==(s=r)&&void 0!==s?s:"application/json"),o.body=JSON.stringify(n)}else o.body=n;return(null==t?void 0:t.duplex)&&(o.duplex=t.duplex),c(c({},o),r)};async function P(e,t,r,n,o,s,c){return new Promise((i,u)=>{e(r,B(t,n,o,s)).then(e=>{if(!e.ok)throw e;if(null==n?void 0:n.noResolveJson)return e;if("vectors"===c){const t=e.headers.get("content-type");if("0"===e.headers.get("content-length")||204===e.status)return{};if(!t||!t.includes("application/json"))return{}}return e.json()}).then(e=>i(e)).catch(e=>j(e,u,0,c))})}function N(e="storage"){return{get:async(t,r,n,o)=>P(t,"GET",r,n,o,void 0,e),post:async(t,r,n,o,s)=>P(t,"POST",r,o,s,n,e),put:async(t,r,n,o,s)=>P(t,"PUT",r,o,s,n,e),head:async(t,r,n,o)=>P(t,"HEAD",r,c(c({},n),{},{noResolveJson:!0}),o,void 0,e),remove:async(t,r,n,o,s)=>P(t,"DELETE",r,o,s,n,e)}}const E=N("storage"),{get:C,post:V,put:I,head:T,remove:U}=E,_=N("vectors");var F=class{constructor(e,t={},r,n="storage"){var o;this.shouldThrowOnError=!1,this.url=e,this.headers=O(t),this.fetch=(o=r)?(...e)=>o(...e):(...e)=>fetch(...e),this.namespace=n}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,t){return this.headers=w(this.headers,e,t),this}async handleOperation(e){try{return{data:await e(),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(u(e))return{data:null,error:e};throw e}}};let R;R=Symbol.toStringTag;var L=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[R]="StreamDownloadBuilder",this.promise=null}then(e,t){return this.getPromise().then(e,t)}catch(e){return this.getPromise().catch(e)}finally(e){return this.getPromise().finally(e)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){try{return{data:(await this.downloadFn()).body,error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(u(e))return{data:null,error:e};throw e}}};let D;D=Symbol.toStringTag;var A=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[D]="BlobDownloadBuilder",this.promise=null}asStream(){return new L(this.downloadFn,this.shouldThrowOnError)}then(e,t){return this.getPromise().then(e,t)}catch(e){return this.getPromise().catch(e)}finally(e){return this.getPromise().finally(e)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){try{return{data:await(await this.downloadFn()).blob(),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(u(e))return{data:null,error:e};throw e}}};const M={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},z={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var J=class extends F{constructor(e,t={},r,n){super(e,t,n,"storage"),this.bucketId=r}async uploadOrUpdate(e,t,r,n){var o=this;return o.handleOperation(async()=>{let s;const i=c(c({},z),n);let u=c(c({},o.headers),"POST"===e&&{"x-upsert":String(i.upsert)});const l=i.metadata;if("undefined"!=typeof Blob&&r instanceof Blob?(s=new FormData,s.append("cacheControl",i.cacheControl),l&&s.append("metadata",o.encodeMetadata(l)),s.append("",r)):"undefined"!=typeof FormData&&r instanceof FormData?(s=r,s.has("cacheControl")||s.append("cacheControl",i.cacheControl),l&&!s.has("metadata")&&s.append("metadata",o.encodeMetadata(l))):(s=r,u["cache-control"]=`max-age=${i.cacheControl}`,u["content-type"]=i.contentType,l&&(u["x-metadata"]=o.toBase64(o.encodeMetadata(l))),("undefined"!=typeof ReadableStream&&s instanceof ReadableStream||s&&"object"==typeof s&&"pipe"in s&&"function"==typeof s.pipe)&&!i.duplex&&(i.duplex="half")),null==n?void 0:n.headers)for(const[e,t]of Object.entries(n.headers))u=w(u,e,t);const h=o._removeEmptyFolders(t),p=o._getFinalPath(h),f=await("PUT"==e?I:V)(o.fetch,`${o.url}/object/${p}`,s,c({headers:u},(null==i?void 0:i.duplex)?{duplex:i.duplex}:{}));return{path:h,id:f.Id,fullPath:f.Key}})}async upload(e,t,r){return this.uploadOrUpdate("POST",e,t,r)}async uploadToSignedUrl(e,t,r,n){var o=this;const s=o._removeEmptyFolders(e),i=o._getFinalPath(s),u=new URL(o.url+`/object/upload/sign/${i}`);return u.searchParams.set("token",t),o.handleOperation(async()=>{let e;const t=c(c({},z),n);let i=c(c({},o.headers),{"x-upsert":String(t.upsert)});const l=t.metadata;if("undefined"!=typeof Blob&&r instanceof Blob?(e=new FormData,e.append("cacheControl",t.cacheControl),l&&e.append("metadata",o.encodeMetadata(l)),e.append("",r)):"undefined"!=typeof FormData&&r instanceof FormData?(e=r,e.has("cacheControl")||e.append("cacheControl",t.cacheControl),l&&!e.has("metadata")&&e.append("metadata",o.encodeMetadata(l))):(e=r,i["cache-control"]=`max-age=${t.cacheControl}`,i["content-type"]=t.contentType,l&&(i["x-metadata"]=o.toBase64(o.encodeMetadata(l))),("undefined"!=typeof ReadableStream&&e instanceof ReadableStream||e&&"object"==typeof e&&"pipe"in e&&"function"==typeof e.pipe)&&!t.duplex&&(t.duplex="half")),null==n?void 0:n.headers)for(const[e,t]of Object.entries(n.headers))i=w(i,e,t);return{path:s,fullPath:(await I(o.fetch,u.toString(),e,c({headers:i},(null==t?void 0:t.duplex)?{duplex:t.duplex}:{}))).Key}})}async createSignedUploadUrl(e,t){var r=this;return r.handleOperation(async()=>{let n=r._getFinalPath(e);const o=c({},r.headers);(null==t?void 0:t.upsert)&&(o["x-upsert"]="true");const s=await V(r.fetch,`${r.url}/object/upload/sign/${n}`,{},{headers:o}),u=new URL(r.url+s.url),l=u.searchParams.get("token");if(!l)throw new i("No token returned by API");return{signedUrl:u.toString(),path:e,token:l}})}async update(e,t,r){return this.uploadOrUpdate("PUT",e,t,r)}async move(e,t,r){var n=this;return n.handleOperation(async()=>await V(n.fetch,`${n.url}/object/move`,{bucketId:n.bucketId,sourceKey:e,destinationKey:t,destinationBucket:null==r?void 0:r.destinationBucket},{headers:n.headers}))}async copy(e,t,r){var n=this;return n.handleOperation(async()=>({path:(await V(n.fetch,`${n.url}/object/copy`,{bucketId:n.bucketId,sourceKey:e,destinationKey:t,destinationBucket:null==r?void 0:r.destinationBucket},{headers:n.headers})).Key}))}async createSignedUrl(e,t,r){var n=this;return n.handleOperation(async()=>{let o=n._getFinalPath(e);const s="object"==typeof(null==r?void 0:r.transform)&&null!==r.transform&&Object.keys(r.transform).length>0;let i=await V(n.fetch,`${n.url}/object/sign/${o}`,c({expiresIn:t},s?{transform:r.transform}:{}),{headers:n.headers});const u=new URLSearchParams;(null==r?void 0:r.download)&&u.set("download",!0===r.download?"":r.download),null!=(null==r?void 0:r.cacheNonce)&&u.set("cacheNonce",String(r.cacheNonce));const l=u.toString();return{signedUrl:encodeURI(`${n.url}${i.signedURL}${l?`&${l}`:""}`)}})}async createSignedUrls(e,t,r){var n=this;return n.handleOperation(async()=>{const o=await V(n.fetch,`${n.url}/object/sign/${n.bucketId}`,{expiresIn:t,paths:e},{headers:n.headers}),s=new URLSearchParams;(null==r?void 0:r.download)&&s.set("download",!0===r.download?"":r.download),null!=(null==r?void 0:r.cacheNonce)&&s.set("cacheNonce",String(r.cacheNonce));const i=s.toString();return o.map(e=>c(c({},e),{},{signedUrl:e.signedURL?encodeURI(`${n.url}${e.signedURL}${i?`&${i}`:""}`):null}))})}download(e,t,r){const n="object"==typeof(null==t?void 0:t.transform)&&null!==t.transform&&Object.keys(t.transform).length>0?"render/image/authenticated":"object",o=new URLSearchParams;(null==t?void 0:t.transform)&&this.applyTransformOptsToQuery(o,t.transform),null!=(null==t?void 0:t.cacheNonce)&&o.set("cacheNonce",String(t.cacheNonce));const s=o.toString(),c=this._getFinalPath(e);return new A(()=>C(this.fetch,`${this.url}/${n}/${c}${s?`?${s}`:""}`,{headers:this.headers,noResolveJson:!0},r),this.shouldThrowOnError)}async info(e){var t=this;const r=t._getFinalPath(e);return t.handleOperation(async()=>k(await C(t.fetch,`${t.url}/object/info/${r}`,{headers:t.headers})))}async exists(e){var t=this;const r=t._getFinalPath(e);try{return await T(t.fetch,`${t.url}/object/${r}`,{headers:t.headers}),{data:!0,error:null}}catch(e){if(t.shouldThrowOnError)throw e;if(u(e)){var n;const t=e instanceof l?e.status:e instanceof h?null===(n=e.originalError)||void 0===n?void 0:n.status:void 0;if(void 0!==t&&[400,404].includes(t))return{data:!1,error:e}}throw e}}getPublicUrl(e,t){const r=this._getFinalPath(e),n=new URLSearchParams;(null==t?void 0:t.download)&&n.set("download",!0===t.download?"":t.download),(null==t?void 0:t.transform)&&this.applyTransformOptsToQuery(n,t.transform),null!=(null==t?void 0:t.cacheNonce)&&n.set("cacheNonce",String(t.cacheNonce));const o=n.toString(),s="object"==typeof(null==t?void 0:t.transform)&&null!==t.transform&&Object.keys(t.transform).length>0?"render/image":"object";return{data:{publicUrl:encodeURI(`${this.url}/${s}/public/${r}`)+(o?`?${o}`:"")}}}async remove(e){var t=this;return t.handleOperation(async()=>await U(t.fetch,`${t.url}/object/${t.bucketId}`,{prefixes:e},{headers:t.headers}))}async purgeCache(e,t,r){var n=this;return n.handleOperation(async()=>{const o=n._getFinalPath(e),s=new URLSearchParams;(null==t?void 0:t.transformations)&&s.set("transformations","true");const c=s.toString();return await U(n.fetch,`${n.url}/cdn/${o}${c?`?${c}`:""}`,{},{headers:n.headers},r)})}async list(e,t,r){var n=this;return n.handleOperation(async()=>{const o=(null==t?void 0:t.sortBy)?c(c({},M.sortBy),t.sortBy):M.sortBy,s=c(c(c({},M),t),{},{sortBy:o,prefix:e||""});return await V(n.fetch,`${n.url}/object/list/${n.bucketId}`,s,{headers:n.headers},r)})}async listV2(e,t){var r=this;return r.handleOperation(async()=>{const n=c({},e);return await V(r.fetch,`${r.url}/object/list-v2/${r.bucketId}`,n,{headers:r.headers},t)})}encodeMetadata(e){return JSON.stringify(e)}toBase64(e){return"undefined"!=typeof Buffer?Buffer.from(e).toString("base64"):btoa(e)}_getFinalPath(e){return`${this.bucketId}/${e.replace(/^\/+/,"")}`}_removeEmptyFolders(e){return e.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}applyTransformOptsToQuery(e,t){return t.width&&e.set("width",t.width.toString()),t.height&&e.set("height",t.height.toString()),t.resize&&e.set("resize",t.resize),t.format&&e.set("format",t.format),t.quality&&e.set("quality",t.quality.toString()),e}};const K={"X-Client-Info":"storage-js/2.109.0"};var q=class extends F{constructor(e,t={},r,n){const o=new URL(e);(null==n?void 0:n.useNewHostname)&&/supabase\.(co|in|red)$/.test(o.hostname)&&!o.hostname.includes("storage.supabase.")&&(o.hostname=o.hostname.replace("supabase.","storage.supabase."));super(o.href.replace(/\/$/,""),c(c({},K),t),r,"storage")}async listBuckets(e){var t=this;return t.handleOperation(async()=>{const r=t.listBucketOptionsToQueryString(e);return await C(t.fetch,`${t.url}/bucket${r}`,{headers:t.headers})})}async getBucket(e){var t=this;return t.handleOperation(async()=>await C(t.fetch,`${t.url}/bucket/${e}`,{headers:t.headers}))}async createBucket(e,t={public:!1}){var r=this;return r.handleOperation(async()=>await V(r.fetch,`${r.url}/bucket`,{id:e,name:e,type:t.type,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:r.headers}))}async updateBucket(e,t){var r=this;return r.handleOperation(async()=>await I(r.fetch,`${r.url}/bucket/${e}`,{id:e,name:e,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:r.headers}))}async emptyBucket(e){var t=this;return t.handleOperation(async()=>await V(t.fetch,`${t.url}/bucket/${e}/empty`,{},{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await U(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}))}async purgeBucketCache(e,t,r){var n=this;return n.handleOperation(async()=>{const o=new URLSearchParams;(null==t?void 0:t.transformations)&&o.set("transformations","true");const s=o.toString();return await U(n.fetch,`${n.url}/cdn/${e}${s?`?${s}`:""}`,{},{headers:n.headers},r)})}listBucketOptionsToQueryString(e){const t={};return e&&("limit"in e&&(t.limit=String(e.limit)),"offset"in e&&(t.offset=String(e.offset)),e.search&&(t.search=e.search),e.sortColumn&&(t.sortColumn=e.sortColumn),e.sortOrder&&(t.sortOrder=e.sortOrder)),Object.keys(t).length>0?"?"+new URLSearchParams(t).toString():""}},H=class extends F{constructor(e,t={},r){super(e.replace(/\/$/,""),c(c({},K),t),r,"storage")}async createBucket(e){var t=this;return t.handleOperation(async()=>await V(t.fetch,`${t.url}/bucket`,{name:e},{headers:t.headers}))}async listBuckets(e){var t=this;return t.handleOperation(async()=>{const r=new URLSearchParams;void 0!==(null==e?void 0:e.limit)&&r.set("limit",e.limit.toString()),void 0!==(null==e?void 0:e.offset)&&r.set("offset",e.offset.toString()),(null==e?void 0:e.sortColumn)&&r.set("sortColumn",e.sortColumn),(null==e?void 0:e.sortOrder)&&r.set("sortOrder",e.sortOrder),(null==e?void 0:e.search)&&r.set("search",e.search);const n=r.toString(),o=n?`${t.url}/bucket?${n}`:`${t.url}/bucket`;return await C(t.fetch,o,{headers:t.headers})})}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await U(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}))}from(t){var r=this;if(!x(t))throw new i("Invalid bucket name: File, folder, and bucket names must follow AWS object key naming guidelines and should avoid the use of any other characters.");const n=new e.IcebergRestCatalog({baseUrl:this.url,catalogName:t,auth:{type:"custom",getHeaders:async()=>r.headers},fetch:this.fetch}),o=this.shouldThrowOnError;return new Proxy(n,{get(e,t){const r=e[t];return"function"!=typeof r?r:async(...t)=>{try{return{data:await r.apply(e,t),error:null}}catch(e){if(o)throw e;return{data:null,error:e}}}}})}},Q=class extends F{constructor(e,t={},r){super(e.replace(/\/$/,""),c(c({},K),{},{"Content-Type":"application/json"},t),r,"vectors")}async createIndex(e){var t=this;return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/CreateIndex`,e,{headers:t.headers})||{})}async getIndex(e,t){var r=this;return r.handleOperation(async()=>await _.post(r.fetch,`${r.url}/GetIndex`,{vectorBucketName:e,indexName:t},{headers:r.headers}))}async listIndexes(e){var t=this;return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/ListIndexes`,e,{headers:t.headers}))}async deleteIndex(e,t){var r=this;return r.handleOperation(async()=>await _.post(r.fetch,`${r.url}/DeleteIndex`,{vectorBucketName:e,indexName:t},{headers:r.headers})||{})}},G=class extends F{constructor(e,t={},r){super(e.replace(/\/$/,""),c(c({},K),{},{"Content-Type":"application/json"},t),r,"vectors")}async putVectors(e){var t=this;if(e.vectors.length<1||e.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/PutVectors`,e,{headers:t.headers})||{})}async getVectors(e){var t=this;return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/GetVectors`,e,{headers:t.headers}))}async listVectors(e){var t=this;if(void 0!==e.segmentCount){if(e.segmentCount<1||e.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(void 0!==e.segmentIndex&&(e.segmentIndex<0||e.segmentIndex>=e.segmentCount))throw new Error("segmentIndex must be between 0 and "+(e.segmentCount-1))}return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/ListVectors`,e,{headers:t.headers}))}async queryVectors(e){var t=this;return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/QueryVectors`,e,{headers:t.headers}))}async deleteVectors(e){var t=this;if(e.keys.length<1||e.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/DeleteVectors`,e,{headers:t.headers})||{})}},W=class extends F{constructor(e,t={},r){super(e.replace(/\/$/,""),c(c({},K),{},{"Content-Type":"application/json"},t),r,"vectors")}async createBucket(e){var t=this;return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}async getBucket(e){var t=this;return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/GetVectorBucket`,{vectorBucketName:e},{headers:t.headers}))}async listBuckets(e={}){var t=this;return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/ListVectorBuckets`,e,{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}},X=class extends W{constructor(e,t={}){super(e,t.headers||{},t.fetch)}from(e){return new Y(this.url,this.headers,e,this.fetch)}async createBucket(e){return(()=>super.createBucket)().call(this,e)}async getBucket(e){return(()=>super.getBucket)().call(this,e)}async listBuckets(e={}){return(()=>super.listBuckets)().call(this,e)}async deleteBucket(e){return(()=>super.deleteBucket)().call(this,e)}},Y=class extends Q{constructor(e,t,r,n){super(e,t,n),this.vectorBucketName=r}async createIndex(e){return(()=>super.createIndex)().call(this,c(c({},e),{},{vectorBucketName:this.vectorBucketName}))}async listIndexes(e={}){return(()=>super.listIndexes)().call(this,c(c({},e),{},{vectorBucketName:this.vectorBucketName}))}async getIndex(e){return(()=>super.getIndex)().call(this,this.vectorBucketName,e)}async deleteIndex(e){return(()=>super.deleteIndex)().call(this,this.vectorBucketName,e)}index(e){return new Z(this.url,this.headers,this.vectorBucketName,e,this.fetch)}},Z=class extends G{constructor(e,t,r,n,o){super(e,t,o),this.vectorBucketName=r,this.indexName=n}async putVectors(e){var t=this;return(()=>super.putVectors)().call(t,c(c({},e),{},{vectorBucketName:t.vectorBucketName,indexName:t.indexName}))}async getVectors(e){var t=this;return(()=>super.getVectors)().call(t,c(c({},e),{},{vectorBucketName:t.vectorBucketName,indexName:t.indexName}))}async listVectors(e={}){var t=this;return(()=>super.listVectors)().call(t,c(c({},e),{},{vectorBucketName:t.vectorBucketName,indexName:t.indexName}))}async queryVectors(e){var t=this;return(()=>super.queryVectors)().call(t,c(c({},e),{},{vectorBucketName:t.vectorBucketName,indexName:t.indexName}))}async deleteVectors(e){var t=this;return(()=>super.deleteVectors)().call(t,c(c({},e),{},{vectorBucketName:t.vectorBucketName,indexName:t.indexName}))}},ee=class extends q{constructor(e,t={},r,n){super(e,t,r,n)}from(e){return new J(this.url,this.headers,e,this.fetch)}get vectors(){return new X(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new H(this.url+"/iceberg",this.headers,this.fetch)}}},1187,[1188]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IcebergError",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"IcebergRestCatalog",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"getCurrentSchema",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"isDecimalType",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"isFixedType",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"parseDecimalType",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"parseFixedType",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"typesEqual",{enumerable:!0,get:function(){return x}});var t=class extends Error{constructor(t,a){super(t),this.name="IcebergError",this.status=a.status,this.icebergType=a.icebergType,this.icebergCode=a.icebergCode,this.details=a.details,this.isCommitStateUnknown="CommitStateUnknownException"===a.icebergType||[500,502,504].includes(a.status)&&!0===a.icebergType?.includes("CommitState")}isNotFound(){return 404===this.status}isConflict(){return 409===this.status}isAuthenticationTimeout(){return 419===this.status}};function a(t,a,s){const n=new URL(a,t);if(s)for(const[t,a]of Object.entries(s))void 0!==a&&n.searchParams.set(t,a);return n.toString()}async function s(t){return t&&"none"!==t.type?"bearer"===t.type?{Authorization:`Bearer ${t.token}`}:"header"===t.type?{[t.name]:t.value}:"custom"===t.type?await t.getHeaders():{}:{}}function n(n){const c=n.fetchImpl??globalThis.fetch;return{async request({method:o,path:p,query:u,body:l,headers:h}){const b=a(n.baseUrl,p,u),f=await s(n.auth),y=await c(b,{method:o,headers:{...l?{"Content-Type":"application/json"}:{},...f,...h},body:l?JSON.stringify(l):void 0}),T=await y.text(),w=(y.headers.get("content-type")||"").includes("application/json"),x=w&&T?JSON.parse(T):T;if(!y.ok){const a=w?x:void 0,s=a?.error;throw new t(s?.message??`Request failed with status ${y.status}`,{status:y.status,icebergType:s?.type,icebergCode:s?.code,details:a})}return{status:y.status,headers:y.headers,data:x}}}}function c(t){return t.join("\x1f")}var o=class{constructor(t,a=""){this.client=t,this.prefix=a}async listNamespaces(t){const a=t?{parent:c(t.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:a})).data.namespaces.map(t=>({namespace:t}))}async createNamespace(t,a){const s={namespace:t.namespace,properties:a?.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:s})).data}async dropNamespace(t){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${c(t.namespace)}`})}async loadNamespaceMetadata(t){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${c(t.namespace)}`})).data.properties}}async namespaceExists(a){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${c(a.namespace)}`}),!0}catch(a){if(a instanceof t&&404===a.status)return!1;throw a}}async createNamespaceIfNotExists(a,s){try{return await this.createNamespace(a,s)}catch(a){if(a instanceof t&&409===a.status)return;throw a}}};function p(t){return t.join("\x1f")}var u=class{constructor(t,a="",s){this.client=t,this.prefix=a,this.accessDelegation=s}async listTables(t){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${p(t.namespace)}/tables`})).data.identifiers}async createTable(t,a){const s={};this.accessDelegation&&(s["X-Iceberg-Access-Delegation"]=this.accessDelegation);return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${p(t.namespace)}/tables`,body:a,headers:s})).data.metadata}async updateTable(t,a){const s=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${p(t.namespace)}/tables/${t.name}`,body:a});return{"metadata-location":s.data["metadata-location"],metadata:s.data.metadata}}async dropTable(t,a){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${p(t.namespace)}/tables/${t.name}`,query:{purgeRequested:String(a?.purge??!1)}})}async loadTable(t){const a={};this.accessDelegation&&(a["X-Iceberg-Access-Delegation"]=this.accessDelegation);return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${p(t.namespace)}/tables/${t.name}`,headers:a})).data.metadata}async tableExists(a){const s={};this.accessDelegation&&(s["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${p(a.namespace)}/tables/${a.name}`,headers:s}),!0}catch(a){if(a instanceof t&&404===a.status)return!1;throw a}}async createTableIfNotExists(a,s){try{return await this.createTable(a,s)}catch(n){if(n instanceof t&&409===n.status)return await this.loadTable({namespace:a.namespace,name:s.name});throw n}}},l=class{constructor(t){let a="v1";t.catalogName&&(a+=`/${t.catalogName}`);const s=t.baseUrl.endsWith("/")?t.baseUrl:`${t.baseUrl}/`;this.client=n({baseUrl:s,auth:t.auth,fetchImpl:t.fetch}),this.accessDelegation=t.accessDelegation?.join(","),this.namespaceOps=new o(this.client,a),this.tableOps=new u(this.client,a,this.accessDelegation)}async listNamespaces(t){return this.namespaceOps.listNamespaces(t)}async createNamespace(t,a){return this.namespaceOps.createNamespace(t,a)}async dropNamespace(t){await this.namespaceOps.dropNamespace(t)}async loadNamespaceMetadata(t){return this.namespaceOps.loadNamespaceMetadata(t)}async listTables(t){return this.tableOps.listTables(t)}async createTable(t,a){return this.tableOps.createTable(t,a)}async updateTable(t,a){return this.tableOps.updateTable(t,a)}async dropTable(t,a){await this.tableOps.dropTable(t,a)}async loadTable(t){return this.tableOps.loadTable(t)}async namespaceExists(t){return this.namespaceOps.namespaceExists(t)}async tableExists(t){return this.tableOps.tableExists(t)}async createNamespaceIfNotExists(t,a){return this.namespaceOps.createNamespaceIfNotExists(t,a)}async createTableIfNotExists(t,a){return this.tableOps.createTableIfNotExists(t,a)}},h=/^decimal\s*\(\s*(\d+)\s*,\s*(\d+)\s*\)$/,b=/^fixed\s*\[\s*(\d+)\s*\]$/;function f(t){const a=t.match(h);return a?{precision:parseInt(a[1],10),scale:parseInt(a[2],10)}:null}function y(t){const a=t.match(b);return a?{length:parseInt(a[1],10)}:null}function T(t){return h.test(t)}function w(t){return b.test(t)}function x(t,a){const s=f(t),n=f(a);if(s&&n)return s.precision===n.precision&&s.scale===n.scale;const c=y(t),o=y(a);return c&&o?c.length===o.length:t===a}function O(t){return t.schemas.find(a=>a["schema-id"]===t["current-schema-id"])}},1188,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"navigatorLock",{enumerable:!0,get:function(){return l.navigatorLock}}),Object.defineProperty(_e,"NavigatorLockAcquireTimeoutError",{enumerable:!0,get:function(){return l.NavigatorLockAcquireTimeoutError}}),Object.defineProperty(_e,"lockInternals",{enumerable:!0,get:function(){return l.internals}}),Object.defineProperty(_e,"processLock",{enumerable:!0,get:function(){return l.processLock}}),Object.defineProperty(_e,"GoTrueAdminApi",{enumerable:!0,get:function(){return t.default}}),Object.defineProperty(_e,"GoTrueClient",{enumerable:!0,get:function(){return n.default}}),Object.defineProperty(_e,"AuthAdminApi",{enumerable:!0,get:function(){return o.default}}),Object.defineProperty(_e,"AuthClient",{enumerable:!0,get:function(){return u.default}});var t=e(r(d[0])),n=e(r(d[1])),o=e(r(d[2])),u=e(r(d[3])),c=r(d[4]);Object.keys(c).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return c[e]}})});var f=r(d[5]);Object.keys(f).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return f[e]}})});var l=r(d[6])},1189,[1190,1198,1205,1206,1197,1195,1200]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return u}});var t=r(d[0]),s=r(d[1]),n=r(d[2]),o=r(d[3]),h=r(d[4]);class u{constructor({url:t="",headers:s={},fetch:o,experimental:h}){this.url=t,this.headers=s,this.fetch=(0,n.resolveFetch)(o),this.experimental=null!=h?h:{},this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)},this.oauth={listClients:this._listOAuthClients.bind(this),createClient:this._createOAuthClient.bind(this),getClient:this._getOAuthClient.bind(this),updateClient:this._updateOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)},this.customProviders={listProviders:this._listCustomProviders.bind(this),createProvider:this._createCustomProvider.bind(this),getProvider:this._getCustomProvider.bind(this),updateProvider:this._updateCustomProvider.bind(this),deleteProvider:this._deleteCustomProvider.bind(this)},this.passkey={listPasskeys:this._adminListPasskeys.bind(this),deletePasskey:this._adminDeletePasskey.bind(this)}}async signOut(t,n=o.SIGN_OUT_SCOPES[0]){if(o.SIGN_OUT_SCOPES.indexOf(n)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${o.SIGN_OUT_SCOPES.join(', ')}`);try{return await(0,s._request)(this.fetch,'POST',`${this.url}/logout?scope=${n}`,{headers:this.headers,jwt:t,noResolveJson:!0}),{data:null,error:null}}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async inviteUserByEmail(t,n={}){try{return await(0,s._request)(this.fetch,'POST',`${this.url}/invite`,{body:{email:t,data:n.data},headers:this.headers,redirectTo:n.redirectTo,xform:s._userResponse})}catch(t){if((0,h.isAuthError)(t))return{data:{user:null},error:t};throw t}}async generateLink(n){try{const{options:o}=n,h=(0,t.__rest)(n,["options"]),u=Object.assign(Object.assign({},h),o);return'newEmail'in h&&(u.new_email=null==h?void 0:h.newEmail,delete u.newEmail),await(0,s._request)(this.fetch,'POST',`${this.url}/admin/generate_link`,{body:u,headers:this.headers,xform:s._generateLinkResponse,redirectTo:null==o?void 0:o.redirectTo})}catch(t){if((0,h.isAuthError)(t))return{data:{properties:null,user:null},error:t};throw t}}async createUser(t){try{return await(0,s._request)(this.fetch,'POST',`${this.url}/admin/users`,{body:t,headers:this.headers,xform:s._userResponse})}catch(t){if((0,h.isAuthError)(t))return{data:{user:null},error:t};throw t}}async listUsers(t){var n,o,u,l,c,f,_;try{const h={nextPage:null,lastPage:0,total:0},y=await(0,s._request)(this.fetch,'GET',`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:null!==(o=null===(n=null==t?void 0:t.page)||void 0===n?void 0:n.toString())&&void 0!==o?o:'',per_page:null!==(l=null===(u=null==t?void 0:t.perPage)||void 0===u?void 0:u.toString())&&void 0!==l?l:''},xform:s._noResolveJsonResponse});if(y.error)throw y.error;const v=await y.json(),p=null!==(c=y.headers.get('x-total-count'))&&void 0!==c?c:0,E=null!==(_=null===(f=y.headers.get('link'))||void 0===f?void 0:f.split(','))&&void 0!==_?_:[];return E.length>0&&(E.forEach(t=>{const s=parseInt(t.split(';')[0].split('=')[1].substring(0,1)),n=JSON.parse(t.split(';')[1].split('=')[1]);h[`${n}Page`]=s}),h.total=parseInt(p)),{data:Object.assign(Object.assign({},v),h),error:null}}catch(t){if((0,h.isAuthError)(t))return{data:{users:[]},error:t};throw t}}async getUserById(t){(0,n.validateUUID)(t);try{return await(0,s._request)(this.fetch,'GET',`${this.url}/admin/users/${t}`,{headers:this.headers,xform:s._userResponse})}catch(t){if((0,h.isAuthError)(t))return{data:{user:null},error:t};throw t}}async updateUserById(t,o){(0,n.validateUUID)(t);try{return await(0,s._request)(this.fetch,'PUT',`${this.url}/admin/users/${t}`,{body:o,headers:this.headers,xform:s._userResponse})}catch(t){if((0,h.isAuthError)(t))return{data:{user:null},error:t};throw t}}async deleteUser(t,o=!1){(0,n.validateUUID)(t);try{return await(0,s._request)(this.fetch,'DELETE',`${this.url}/admin/users/${t}`,{headers:this.headers,body:{should_soft_delete:o},xform:s._userResponse})}catch(t){if((0,h.isAuthError)(t))return{data:{user:null},error:t};throw t}}async _listFactors(t){(0,n.validateUUID)(t.userId);try{const{data:n,error:o}=await(0,s._request)(this.fetch,'GET',`${this.url}/admin/users/${t.userId}/factors`,{headers:this.headers,xform:t=>({data:{factors:t},error:null})});return{data:n,error:o}}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _deleteFactor(t){(0,n.validateUUID)(t.userId),(0,n.validateUUID)(t.id);try{return{data:await(0,s._request)(this.fetch,'DELETE',`${this.url}/admin/users/${t.userId}/factors/${t.id}`,{headers:this.headers}),error:null}}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _listOAuthClients(t){var n,o,u,l,c,f,_;try{const h={nextPage:null,lastPage:0,total:0},y=await(0,s._request)(this.fetch,'GET',`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:null!==(o=null===(n=null==t?void 0:t.page)||void 0===n?void 0:n.toString())&&void 0!==o?o:'',per_page:null!==(l=null===(u=null==t?void 0:t.perPage)||void 0===u?void 0:u.toString())&&void 0!==l?l:''},xform:s._noResolveJsonResponse});if(y.error)throw y.error;const v=await y.json(),p=null!==(c=y.headers.get('x-total-count'))&&void 0!==c?c:0,E=null!==(_=null===(f=y.headers.get('link'))||void 0===f?void 0:f.split(','))&&void 0!==_?_:[];return E.length>0&&(E.forEach(t=>{const s=parseInt(t.split(';')[0].split('=')[1].substring(0,1)),n=JSON.parse(t.split(';')[1].split('=')[1]);h[`${n}Page`]=s}),h.total=parseInt(p)),{data:Object.assign(Object.assign({},v),h),error:null}}catch(t){if((0,h.isAuthError)(t))return{data:{clients:[]},error:t};throw t}}async _createOAuthClient(t){try{return await(0,s._request)(this.fetch,'POST',`${this.url}/admin/oauth/clients`,{body:t,headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _getOAuthClient(t){try{return await(0,s._request)(this.fetch,'GET',`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _updateOAuthClient(t,n){try{return await(0,s._request)(this.fetch,'PUT',`${this.url}/admin/oauth/clients/${t}`,{body:n,headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _deleteOAuthClient(t){try{return await(0,s._request)(this.fetch,'DELETE',`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _regenerateOAuthClientSecret(t){try{return await(0,s._request)(this.fetch,'POST',`${this.url}/admin/oauth/clients/${t}/regenerate_secret`,{headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _listCustomProviders(t){try{const n={};return(null==t?void 0:t.type)&&(n.type=t.type),await(0,s._request)(this.fetch,'GET',`${this.url}/admin/custom-providers`,{headers:this.headers,query:n,xform:t=>{var s;return{data:{providers:null!==(s=null==t?void 0:t.providers)&&void 0!==s?s:[]},error:null}}})}catch(t){if((0,h.isAuthError)(t))return{data:{providers:[]},error:t};throw t}}async _createCustomProvider(t){try{return await(0,s._request)(this.fetch,'POST',`${this.url}/admin/custom-providers`,{body:t,headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _getCustomProvider(t){try{return await(0,s._request)(this.fetch,'GET',`${this.url}/admin/custom-providers/${t}`,{headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _updateCustomProvider(t,n){try{return await(0,s._request)(this.fetch,'PUT',`${this.url}/admin/custom-providers/${t}`,{body:n,headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _deleteCustomProvider(t){try{return await(0,s._request)(this.fetch,'DELETE',`${this.url}/admin/custom-providers/${t}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _adminListPasskeys(t){(0,n.assertPasskeyExperimentalEnabled)(this.experimental),(0,n.validateUUID)(t.userId);try{return await(0,s._request)(this.fetch,'GET',`${this.url}/admin/users/${t.userId}/passkeys`,{headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _adminDeletePasskey(t){(0,n.assertPasskeyExperimentalEnabled)(this.experimental),(0,n.validateUUID)(t.userId),(0,n.validateUUID)(t.passkeyId);try{return await(0,s._request)(this.fetch,'DELETE',`${this.url}/admin/users/${t.userId}/passkeys/${t.passkeyId}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}}},1190,[1168,1191,1194,1197,1195]); +__d(function(g,r,_i,_a2,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.handleError=i,_e._request=async function(e,o,t,n){var a;const i=Object.assign({},null==n?void 0:n.headers);i[s.API_VERSION_HEADER_NAME]||(i[s.API_VERSION_HEADER_NAME]=s.API_VERSIONS['2024-01-01'].name);(null==n?void 0:n.jwt)&&(i.Authorization=`Bearer ${n.jwt}`);const u=null!==(a=null==n?void 0:n.query)&&void 0!==a?a:{};(null==n?void 0:n.redirectTo)&&(u.redirect_to=n.redirectTo);const l=Object.keys(u).length?'?'+new URLSearchParams(u).toString():'',_=await c(e,o,t+l,{headers:i,noResolveJson:null==n?void 0:n.noResolveJson},{},null==n?void 0:n.body);return(null==n?void 0:n.xform)?null==n?void 0:n.xform(_):{data:Object.assign({},_),error:null}},_e._sessionResponse=l,_e._sessionResponsePassword=function(e){const s=l(e);!s.error&&e.weak_password&&'object'==typeof e.weak_password&&Array.isArray(e.weak_password.reasons)&&e.weak_password.reasons.length&&e.weak_password.message&&'string'==typeof e.weak_password.message&&e.weak_password.reasons.reduce((e,s)=>e&&'string'==typeof s,!0)&&(s.data.weak_password=e.weak_password);return s},_e._userResponse=function(e){var s;return{data:{user:null!==(s=e.user)&&void 0!==s?s:e},error:null}},_e._ssoResponse=function(e){return{data:e,error:null}},_e._generateLinkResponse=function(s){const{action_link:o,email_otp:t,hashed_token:n,redirect_to:a,verification_type:i}=s,u=(0,e.__rest)(s,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),c={action_link:o,email_otp:t,hashed_token:n,redirect_to:a,verification_type:i},l=Object.assign({},u);return{data:{properties:c,user:l},error:null}},_e._noResolveJsonResponse=function(e){return e};var e=r(d[0]),s=r(d[1]),o=r(d[2]),t=r(d[3]);const n=e=>{if('object'==typeof e&&null!==e){const s=e;if('string'==typeof s.msg)return s.msg;if('string'==typeof s.message)return s.message;if('string'==typeof s.error_description)return s.error_description;if('string'==typeof s.error)return s.error}return JSON.stringify(e)},a=[500,501,502,503,504,520,521,522,523,524,525,526,527,528,529,530];async function i(e){var i;if(!(0,o.looksLikeFetchResponse)(e))throw new t.AuthRetryableFetchError(n(e),0);if(a.includes(e.status))throw new t.AuthRetryableFetchError(n(e),e.status);let u,c;try{u=await e.json()}catch(e){throw new t.AuthUnknownError(n(e),e)}const l=(0,o.parseResponseAPIVersion)(e);if(l&&l.getTime()>=s.API_VERSIONS['2024-01-01'].timestamp&&'object'==typeof u&&u&&'string'==typeof u.code?c=u.code:'object'==typeof u&&u&&'string'==typeof u.error_code&&(c=u.error_code),c){if('weak_password'===c)throw new t.AuthWeakPasswordError(n(u),e.status,(null===(i=u.weak_password)||void 0===i?void 0:i.reasons)||[]);if('session_not_found'===c)throw new t.AuthSessionMissingError}else if('object'==typeof u&&u&&'object'==typeof u.weak_password&&u.weak_password&&Array.isArray(u.weak_password.reasons)&&u.weak_password.reasons.length&&u.weak_password.reasons.reduce((e,s)=>e&&'string'==typeof s,!0))throw new t.AuthWeakPasswordError(n(u),e.status,u.weak_password.reasons);throw new t.AuthApiError(n(u),e.status||500,c)}const u=(e,s,o,t)=>{const n={method:e,headers:(null==s?void 0:s.headers)||{}};return'GET'===e?n:(n.headers=Object.assign({'Content-Type':'application/json;charset=UTF-8'},null==s?void 0:s.headers),n.body=JSON.stringify(t),Object.assign(Object.assign({},n),o))};async function c(e,s,o,a,c,l){const _=u(s,a,c,l);let p;try{p=await e(o,Object.assign({},_))}catch(e){throw console.error(e),new t.AuthRetryableFetchError(n(e),0)}if(p.ok||await i(p),null==a?void 0:a.noResolveJson)return p;try{return await p.json()}catch(e){await i(e)}}function l(e){var s;let t=null;_(e)&&(t=Object.assign({},e),e.expires_at||(t.expires_at=(0,o.expiresAt)(e.expires_in)));return{data:{session:t,user:null!==(s=e.user)&&void 0!==s?s:'string'==typeof(null==e?void 0:e.id)?e:null},error:null}}function _(e){return!!e.access_token&&!!e.refresh_token&&!!e.expires_in}},1191,[1168,1192,1194,1195]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"AUTO_REFRESH_TICK_DURATION_MS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"AUTO_REFRESH_TICK_THRESHOLD",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"EXPIRY_MARGIN_MS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"REFRESH_FAILURE_COOLDOWN_MS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"GOTRUE_URL",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"STORAGE_KEY",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"AUDIENCE",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"DEFAULT_HEADERS",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"NETWORK_FAILURE",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"API_VERSION_HEADER_NAME",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"API_VERSIONS",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"BASE64URL_REGEX",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"JWKS_TTL",{enumerable:!0,get:function(){return A}});var t=r(d[0]);const n=3e4,u=3,o=9e4,c=6e4,E='http://localhost:9999',_='supabase.auth.token',b='',f={'X-Client-Info':`gotrue-js/${t.version}`},R={MAX_RETRIES:10,RETRY_INTERVAL:2},O='X-Supabase-Api-Version',p={'2024-01-01':{timestamp:Date.parse('2024-01-01T00:00:00.0Z'),name:'2024-01-01'}},l=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,A=6e5},1192,[1193]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"version",{enumerable:!0,get:function(){return t}});const t='2.109.0'},1193,[]); +__d(function(g,r,_i,a,m,_e2,d){"use strict";Object.defineProperty(_e2,'__esModule',{value:!0}),_e2.expiresAt=function(e){return Math.round(Date.now()/1e3)+e},_e2.generateCallbackId=function(){return Symbol('auth-callback')},Object.defineProperty(_e2,"isBrowser",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e2,"supportsLocalStorage",{enumerable:!0,get:function(){return i}}),_e2.parseParametersFromURL=function(e){const t={},n=new URL(e);if(n.hash&&'#'===n.hash[0])try{new URLSearchParams(n.hash.substring(1)).forEach((e,n)=>{t[n]=e})}catch(e){}return n.searchParams.forEach((e,n)=>{t[n]=e}),t},Object.defineProperty(_e2,"resolveFetch",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e2,"looksLikeFetchResponse",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e2,"setItemAsync",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e2,"getItemAsync",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e2,"removeItemAsync",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e2,"Deferred",{enumerable:!0,get:function(){return p}}),_e2.decodeJWT=function(o){const s=o.split('.');if(3!==s.length)throw new t.AuthInvalidJwtError('Invalid JWT structure');for(let n=0;n{setTimeout(()=>t(null),e)})},_e2.retryable=function(e,t){return new Promise((n,o)=>{(async()=>{for(let s=0;s<1/0;s++)try{const o=await e(s);if(!t(s,null,o))return void n(o)}catch(e){if(!t(s,e))return void o(e)}})()})},_e2.generatePKCEVerifier=b,_e2.generatePKCEChallenge=S,_e2.getCodeChallengeAndMethod=async function(e,t,n=!1){const o=b();let s=o;n&&(s+='/recovery');await l(e,`${t}-code-verifier`,s);const i=await S(o);return[i,o===i?'plain':'s256']},_e2.parseResponseAPIVersion=function(t){const n=t.headers.get(e.API_VERSION_HEADER_NAME);if(!n)return null;if(!n.match(P))return null;try{return new Date(`${n}T00:00:00.0Z`)}catch(e){return null}},_e2.validateExp=function(e){if(!e)throw new Error('Missing exp claim');const t=Math.floor(Date.now()/1e3);if(e<=t)throw new Error('JWT has expired')},_e2.getAlgorithm=function(e){switch(e){case'RS256':return{name:'RSASSA-PKCS1-v1_5',hash:{name:'SHA-256'}};case'ES256':return{name:'ECDSA',namedCurve:'P-256',hash:{name:'SHA-256'}};default:throw new Error('Invalid alg claim')}},_e2.validateUUID=function(e){if(!A.test(e))throw new Error('@supabase/auth-js: Expected parameter to be UUID but is not')},_e2.assertPasskeyExperimentalEnabled=function(e){if(!e.passkey)throw new Error('@supabase/auth-js: the passkey API is experimental and disabled by default. Enable it by passing `auth: { experimental: { passkey: true } }` to createClient (or to the GoTrueClient constructor).')},_e2.userNotAvailableProxy=function(){return new Proxy({},{get:(e,t)=>{if('__isUserNotAvailableProxy'===t)return!0;if('symbol'==typeof t){const e=t.toString();if('Symbol(Symbol.toPrimitive)'===e||'Symbol(Symbol.toStringTag)'===e||'Symbol(util.inspect.custom)'===e)return}throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${t}" property of the session object is not supported. Please use getUser() instead.`)},set:(e,t)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${t}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(e,t)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${t}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})},_e2.insecureUserWarningProxy=function(e,t){return new Proxy(e,{get:(e,n,o)=>{if('__isInsecureUserWarningProxy'===n)return!0;if('symbol'==typeof n){const t=n.toString();if('Symbol(Symbol.toPrimitive)'===t||'Symbol(Symbol.toStringTag)'===t||'Symbol(util.inspect.custom)'===t||'Symbol(nodejs.util.inspect.custom)'===t)return Reflect.get(e,n,o)}return t.value||'string'!=typeof n||(console.warn('Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server.'),t.value=!0),Reflect.get(e,n,o)}})},_e2.deepClone=function(e){return JSON.parse(JSON.stringify(e))};var e=r(d[0]),t=r(d[1]),n=r(d[2]);const o=()=>'undefined'!=typeof window&&'undefined'!=typeof document,s={tested:!1,writable:!1},i=()=>{if(!o())return!1;try{if('object'!=typeof globalThis.localStorage)return!1}catch(e){return!1}if(s.tested)return s.writable;const e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),s.tested=!0,s.writable=!0}catch(e){s.tested=!0,s.writable=!1}return s.writable};const u=e=>e?(...t)=>e(...t):(...e)=>fetch(...e),c=e=>'object'==typeof e&&null!==e&&'status'in e&&'ok'in e&&'json'in e&&'function'==typeof e.json,l=async(e,t,n)=>{await e.setItem(t,JSON.stringify(n))},f=async(e,t)=>{const n=await e.getItem(t);if(!n)return null;try{return JSON.parse(n)}catch(e){return null}},h=async(e,t)=>{await e.removeItem(t)};class p{constructor(){this.promise=new p.promiseConstructor((e,t)=>{this.resolve=e,this.reject=t})}}function y(e){return('0'+e.toString(16)).substr(-2)}function b(){const e=new Uint32Array(56);if('undefined'==typeof crypto){const e='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~',t=e.length;let n='';for(let o=0;o<56;o++)n+=e.charAt(Math.floor(Math.random()*t));return n}return crypto.getRandomValues(e),Array.from(e,y).join('')}async function w(e){const t=(new TextEncoder).encode(e),n=await crypto.subtle.digest('SHA-256',t),o=new Uint8Array(n);return Array.from(o).map(e=>String.fromCharCode(e)).join('')}async function S(e){if(!('undefined'!=typeof crypto&&void 0!==crypto.subtle&&'undefined'!=typeof TextEncoder))return console.warn('WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256.'),e;const t=await w(e);return btoa(t).replace(/\+/g,'-').replace(/\//g,'_').replace(/=+$/,'')}p.promiseConstructor=Promise;const P=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;const A=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/},1194,[1192,1195,1196]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"AuthError",{enumerable:!0,get:function(){return t}}),e.isAuthError=s,Object.defineProperty(e,"AuthApiError",{enumerable:!0,get:function(){return n}}),e.isAuthApiError=function(t){return s(t)&&'AuthApiError'===t.name},Object.defineProperty(e,"AuthUnknownError",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"CustomAuthError",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"AuthSessionMissingError",{enumerable:!0,get:function(){return c}}),e.isAuthSessionMissingError=function(t){return s(t)&&'AuthSessionMissingError'===t.name},Object.defineProperty(e,"AuthInvalidTokenResponseError",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"AuthInvalidCredentialsError",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"AuthImplicitGrantRedirectError",{enumerable:!0,get:function(){return f}}),e.isAuthImplicitGrantRedirectError=function(t){return s(t)&&'AuthImplicitGrantRedirectError'===t.name},Object.defineProperty(e,"AuthPKCEGrantCodeExchangeError",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"AuthPKCECodeVerifierMissingError",{enumerable:!0,get:function(){return A}}),e.isAuthPKCECodeVerifierMissingError=function(t){return s(t)&&'AuthPKCECodeVerifierMissingError'===t.name},Object.defineProperty(e,"AuthRetryableFetchError",{enumerable:!0,get:function(){return p}}),e.isAuthRetryableFetchError=function(t){return s(t)&&'AuthRetryableFetchError'===t.name},Object.defineProperty(e,"AuthRefreshDiscardedError",{enumerable:!0,get:function(){return b}}),e.isAuthRefreshDiscardedError=function(t){return s(t)&&'AuthRefreshDiscardedError'===t.name},Object.defineProperty(e,"AuthWeakPasswordError",{enumerable:!0,get:function(){return O}}),e.isAuthWeakPasswordError=function(t){return s(t)&&'AuthWeakPasswordError'===t.name},Object.defineProperty(e,"AuthInvalidJwtError",{enumerable:!0,get:function(){return P}});class t extends Error{constructor(t,s,n){super(t),this.__isAuthError=!0,this.name='AuthError',this.status=s,this.code=n}toJSON(){return{name:this.name,message:this.message,status:this.status,code:this.code}}}function s(t){return'object'==typeof t&&null!==t&&'__isAuthError'in t}class n extends t{constructor(t,s,n){super(t,s,n),this.name='AuthApiError',this.status=s,this.code=n}}class o extends t{constructor(t,s){super(t),this.name='AuthUnknownError',this.originalError=s}}class u extends t{constructor(t,s,n,o){super(t,n,o),this.name=s,this.status=n}}class c extends u{constructor(){super('Auth session missing!','AuthSessionMissingError',400,void 0)}}class h extends u{constructor(){super('Auth session or user missing','AuthInvalidTokenResponseError',500,void 0)}}class l extends u{constructor(t){super(t,'AuthInvalidCredentialsError',400,void 0)}}class f extends u{constructor(t,s=null){super(t,'AuthImplicitGrantRedirectError',500,void 0),this.details=null,this.details=s}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}class E extends u{constructor(t,s=null){super(t,'AuthPKCEGrantCodeExchangeError',500,void 0),this.details=null,this.details=s}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}class A extends u{constructor(){super("PKCE code verifier not found in storage. This can happen if the auth flow was initiated in a different browser or device, or if the storage was cleared. For SSR frameworks (Next.js, SvelteKit, etc.), use @supabase/ssr on both the server and client to store the code verifier in cookies.",'AuthPKCECodeVerifierMissingError',400,'pkce_code_verifier_not_found')}}class p extends u{constructor(t,s){super(t,'AuthRetryableFetchError',s,void 0)}}class b extends u{constructor(t="Refresh result discarded: session state changed mid-flight (e.g., concurrent signOut)"){super(t,'AuthRefreshDiscardedError',409,void 0)}}class O extends u{constructor(t,s,n){super(t,'AuthWeakPasswordError',s,'weak_password'),this.reasons=n}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{reasons:this.reasons})}}class P extends u{constructor(t){super(t,'AuthInvalidJwtError',400,'invalid_jwt')}}},1195,[]); +__d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.byteToBase64URL=o,e.byteFromBase64URL=i,e.stringToBase64URL=function(t){const u=[],n=t=>{u.push(t)},i={queue:0,queuedBits:0};return f(t,t=>{o(t,i,n)}),o(null,i,n),u.join('')},e.stringFromBase64URL=function(t){const u=[],n=t=>{u.push(String.fromCodePoint(t))},o={utf8seq:0,codepoint:0},s={queue:0,queuedBits:0},f=t=>{c(t,o,n)};for(let u=0;u{u.push(t)};for(let u=0;uu.push(t)),new Uint8Array(u)},e.bytesToBase64URL=function(t){const u=[],n={queue:0,queuedBits:0},i=t=>{u.push(t)};return t.forEach(t=>o(t,n,i)),o(null,n,i),u.join('')};const t='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_'.split(''),u=' \t\n\r='.split(''),n=(()=>{const n=new Array(128);for(let t=0;t=6;){const u=n.queue>>n.queuedBits-6&63;o(t[u]),n.queuedBits-=6}else if(n.queuedBits>0)for(n.queue=n.queue<<6-n.queuedBits,n.queuedBits=6;n.queuedBits>=6;){const u=n.queue>>n.queuedBits-6&63;o(t[u]),n.queuedBits-=6}}function i(t,u,o){const i=n[t];if(!(i>-1)){if(-2===i)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(t)}"`)}for(u.queue=u.queue<<6|i,u.queuedBits+=6;u.queuedBits>=8;)o(u.queue>>u.queuedBits-8&255),u.queuedBits-=8}function s(t,u){if(!(t<=127)){if(t<=2047)return u(192|t>>6),void u(128|63&t);if(t<=65535)return u(224|t>>12),u(128|t>>6&63),void u(128|63&t);if(t<=1114111)return u(240|t>>18),u(128|t>>12&63),u(128|t>>6&63),void u(128|63&t);throw new Error(`Unrecognized Unicode codepoint: ${t.toString(16)}`)}u(t)}function f(t,u){for(let n=0;n55295&&o<=56319){const u=1024*(o-55296)&65535;o=65536+(t.charCodeAt(n+1)-56320&65535|u),n+=1}s(o,u)}}function c(t,u,n){if(0===u.utf8seq){if(t<=127)return void n(t);for(let n=1;n<6;n+=1)if(!(t>>7-n&1)){u.utf8seq=n;break}if(2===u.utf8seq)u.codepoint=31&t;else if(3===u.utf8seq)u.codepoint=15&t;else{if(4!==u.utf8seq)throw new Error('Invalid UTF-8 sequence');u.codepoint=7&t}u.utf8seq-=1}else if(u.utf8seq>0){if(t<=127)throw new Error('Invalid UTF-8 sequence');u.codepoint=u.codepoint<<6|63&t,u.utf8seq-=1,0===u.utf8seq&&n(u.codepoint)}}},1196,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SIGN_OUT_SCOPES",{enumerable:!0,get:function(){return t}});const t=['global','local','others']},1197,[]); +__d(function(e,t,s,r,i,n,a){"use strict";Object.defineProperty(n,'__esModule',{value:!0}),Object.defineProperty(n,"default",{enumerable:!0,get:function(){return A}});var o,l=t(a[0]),u=(o=l)&&o.__esModule?o:{default:o},h=t(a[1]),c=t(a[2]),d=t(a[3]),_=t(a[4]),g=t(a[5]),w=t(a[6]),y=t(a[7]),f=t(a[8]),p=t(a[9]),v=t(a[10]),b=t(a[11]);(0,y.polyfillGlobalThis)();const k={url:h.GOTRUE_URL,storageKey:h.STORAGE_KEY,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:h.DEFAULT_HEADERS,flowType:'implicit',debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:5e3,skipAutoInitialize:!1,experimental:{}},m={};class R{get jwks(){var e,t;return null!==(t=null===(e=m[this.storageKey])||void 0===e?void 0:e.jwks)&&void 0!==t?t:{keys:[]}}set jwks(e){m[this.storageKey]=Object.assign(Object.assign({},m[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,t;return null!==(t=null===(e=m[this.storageKey])||void 0===e?void 0:e.cachedAt)&&void 0!==t?t:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){m[this.storageKey]=Object.assign(Object.assign({},m[this.storageKey]),{cachedAt:e})}constructor(e){var t,s,r;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.autoRefreshTickTimeout=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.lastRefreshFailure=null,this._sessionRemovalEpoch=0,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lock=null,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log;const i=Object.assign(Object.assign({},k),e);if(this.storageKey=i.storageKey,this.instanceID=null!==(t=R.nextInstanceID[this.storageKey])&&void 0!==t?t:0,R.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!i.debug,'function'==typeof i.debug&&(this.logger=i.debug),this.instanceID>0&&(0,_.isBrowser)()){const e=`${this._logPrefix()} Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.`;console.warn(e),this.logDebugMessages&&console.trace(e)}if(this.persistSession=i.persistSession,this.autoRefreshToken=i.autoRefreshToken,this.experimental=null!==(s=i.experimental)&&void 0!==s?s:{},this.admin=new u.default({url:i.url,headers:i.headers,fetch:i.fetch,experimental:this.experimental}),this.url=i.url,this.headers=i.headers,this.fetch=(0,_.resolveFetch)(i.fetch),this.detectSessionInUrl=i.detectSessionInUrl,this.flowType=i.flowType,this.hasCustomAuthorizationHeader=i.hasCustomAuthorizationHeader,this.throwOnError=i.throwOnError,this.lockAcquireTimeout=i.lockAcquireTimeout,null!=i.lock&&(this.lock=i.lock),this.jwks||(this.jwks={keys:[]},this.jwks_cached_at=Number.MIN_SAFE_INTEGER),this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this),webauthn:new b.WebAuthnApi(this)},this.oauth={getAuthorizationDetails:this._getAuthorizationDetails.bind(this),approveAuthorization:this._approveAuthorization.bind(this),denyAuthorization:this._denyAuthorization.bind(this),listGrants:this._listOAuthGrants.bind(this),revokeGrant:this._revokeOAuthGrant.bind(this)},this.passkey={startRegistration:this._startPasskeyRegistration.bind(this),verifyRegistration:this._verifyPasskeyRegistration.bind(this),startAuthentication:this._startPasskeyAuthentication.bind(this),verifyAuthentication:this._verifyPasskeyAuthentication.bind(this),list:this._listPasskeys.bind(this),update:this._updatePasskey.bind(this),delete:this._deletePasskey.bind(this)},this.persistSession?(i.storage?this.storage=i.storage:(0,_.supportsLocalStorage)()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=(0,g.memoryLocalStorageAdapter)(this.memoryStorage)),i.userStorage&&(this.userStorage=i.userStorage)):(this.memoryStorage={},this.storage=(0,g.memoryLocalStorageAdapter)(this.memoryStorage)),(0,_.isBrowser)()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(e){console.error('Failed to create a new BroadcastChannel, multi-tab state changes will not be available',e)}null===(r=this.broadcastChannel)||void 0===r||r.addEventListener('message',async e=>{this._debug('received broadcast notification from other tab or client',e),'TOKEN_REFRESHED'!==e.data.event&&'SIGNED_IN'!==e.data.event||(this.lastRefreshFailure=null);try{await this._notifyAllSubscribers(e.data.event,e.data.session,!1)}catch(e){this._debug('#broadcastChannel','error',e)}})}i.skipAutoInitialize||this.initialize().catch(e=>{this._debug('#initialize()','error',e)})}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(e){if(this.throwOnError&&e&&e.error)throw e.error;return e}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${f.version}) ${(new Date).toISOString()}`}_debug(...e){return this.logDebugMessages&&this.logger(this._logPrefix(),...e),this}async initialize(){return this.initializePromise||(this.initializePromise=(async()=>null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._initialize()):await this._initialize())()),await this.initializePromise}async _initialize(){var e;try{let t={},s='none';if((0,_.isBrowser)()&&(t=(0,_.parseParametersFromURL)(window.location.href),this._isImplicitGrantCallback(t)?s='implicit':await this._isPKCECallback(t)&&(s='pkce')),(0,_.isBrowser)()&&this.detectSessionInUrl&&'none'!==s){const{data:r,error:i}=await this._getSessionFromURL(t,s);if(i){if(this._debug('#_initialize()','error detecting session from URL',i),(0,c.isAuthImplicitGrantRedirectError)(i)){const t=null===(e=i.details)||void 0===e?void 0:e.code;if('identity_already_exists'===t||'identity_not_found'===t||'single_identity_not_deletable'===t)return{error:i}}return{error:i}}const{session:n,redirectType:a}=r;return this._debug('#_initialize()','detected session in URL',n,'redirect type',a),await this._saveSession(n),setTimeout(async()=>{'recovery'===a?await this._notifyAllSubscribers('PASSWORD_RECOVERY',n):await this._notifyAllSubscribers('SIGNED_IN',n)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(e){return(0,c.isAuthError)(e)?this._returnResult({error:e}):this._returnResult({error:new c.AuthUnknownError('Unexpected error during initialization',e)})}finally{await this._handleVisibilityChange(),this._debug('#_initialize()','end')}}async signInAnonymously(e){var t,s,r;try{const i=await(0,d._request)(this.fetch,'POST',`${this.url}/signup`,{headers:this.headers,body:{data:null!==(s=null===(t=null==e?void 0:e.options)||void 0===t?void 0:t.data)&&void 0!==s?s:{},gotrue_meta_security:{captcha_token:null===(r=null==e?void 0:e.options)||void 0===r?void 0:r.captchaToken}},xform:d._sessionResponse}),{data:n,error:a}=i;if(a||!n)return this._returnResult({data:{user:null,session:null},error:a});const o=n.session,l=n.user;return n.session&&(await this._saveSession(n.session),await this._notifyAllSubscribers('SIGNED_IN',o)),this._returnResult({data:{user:l,session:o},error:null})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signUp(e){var t,s,r;try{let i;if('email'in e){const{email:s,password:r,options:n}=e;let a=null,o=null;'pkce'===this.flowType&&([a,o]=await(0,_.getCodeChallengeAndMethod)(this.storage,this.storageKey)),i=await(0,d._request)(this.fetch,'POST',`${this.url}/signup`,{headers:this.headers,redirectTo:null==n?void 0:n.emailRedirectTo,body:{email:s,password:r,data:null!==(t=null==n?void 0:n.data)&&void 0!==t?t:{},gotrue_meta_security:{captcha_token:null==n?void 0:n.captchaToken},code_challenge:a,code_challenge_method:o},xform:d._sessionResponse})}else{if(!('phone'in e))throw new c.AuthInvalidCredentialsError('You must provide either an email or phone number and a password');{const{phone:t,password:n,options:a}=e;i=await(0,d._request)(this.fetch,'POST',`${this.url}/signup`,{headers:this.headers,body:{phone:t,password:n,data:null!==(s=null==a?void 0:a.data)&&void 0!==s?s:{},channel:null!==(r=null==a?void 0:a.channel)&&void 0!==r?r:'sms',gotrue_meta_security:{captcha_token:null==a?void 0:a.captchaToken}},xform:d._sessionResponse})}}const{data:n,error:a}=i;if(a||!n)return await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:a});const o=n.session,l=n.user;return n.session&&(await this._saveSession(n.session),await this._notifyAllSubscribers('SIGNED_IN',o)),this._returnResult({data:{user:l,session:o},error:null})}catch(e){if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),(0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signInWithPassword(e){try{let t;if('email'in e){const{email:s,password:r,options:i}=e;t=await(0,d._request)(this.fetch,'POST',`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:s,password:r,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken}},xform:d._sessionResponsePassword})}else{if(!('phone'in e))throw new c.AuthInvalidCredentialsError('You must provide either an email or phone number and a password');{const{phone:s,password:r,options:i}=e;t=await(0,d._request)(this.fetch,'POST',`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:s,password:r,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken}},xform:d._sessionResponsePassword})}}const{data:s,error:r}=t;if(r)return this._returnResult({data:{user:null,session:null},error:r});if(!s||!s.session||!s.user){const e=new c.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null},error:e})}return s.session&&(await this._saveSession(s.session),await this._notifyAllSubscribers('SIGNED_IN',s.session)),this._returnResult({data:Object.assign({user:s.user,session:s.session},s.weak_password?{weakPassword:s.weak_password}:null),error:r})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signInWithOAuth(e){var t,s,r,i;return await this._handleProviderSignIn(e.provider,{redirectTo:null===(t=e.options)||void 0===t?void 0:t.redirectTo,scopes:null===(s=e.options)||void 0===s?void 0:s.scopes,queryParams:null===(r=e.options)||void 0===r?void 0:r.queryParams,skipBrowserRedirect:null===(i=e.options)||void 0===i?void 0:i.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,null!=this.lock?this._acquireLock(this.lockAcquireTimeout,async()=>this._exchangeCodeForSession(e)):this._exchangeCodeForSession(e)}async signInWithWeb3(e){const{chain:t}=e;switch(t){case'ethereum':return await this.signInWithEthereum(e);case'solana':return await this.signInWithSolana(e);default:throw new Error(`@supabase/auth-js: Unsupported chain "${t}"`)}}async signInWithEthereum(e){var t,s,r,i,n,a,o,l,u,h,g;let w,y;if('message'in e)w=e.message,y=e.signature;else{const{chain:h,wallet:c,statement:d,options:g}=e;let f;if((0,_.isBrowser)())if('object'==typeof c)f=c;else{const e=window;if(!('ethereum'in e)||'object'!=typeof e.ethereum||!('request'in e.ethereum)||'function'!=typeof e.ethereum.request)throw new Error("@supabase/auth-js: No compatible Ethereum wallet interface on the window object (window.ethereum) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'ethereum', wallet: resolvedUserWallet }) instead.");f=e.ethereum}else{if('object'!=typeof c||!(null==g?void 0:g.url))throw new Error('@supabase/auth-js: Both wallet and url must be specified in non-browser environments.');f=c}const p=new URL(null!==(t=null==g?void 0:g.url)&&void 0!==t?t:window.location.href),b=await f.request({method:'eth_requestAccounts'}).then(e=>e).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!b||0===b.length)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const k=(0,v.getAddress)(b[0]);let m=null===(s=null==g?void 0:g.signInWithEthereum)||void 0===s?void 0:s.chainId;if(!m){const e=await f.request({method:'eth_chainId'});m=(0,v.fromHex)(e)}const R={domain:p.host,address:k,statement:d,uri:p.href,version:'1',chainId:m,nonce:null===(r=null==g?void 0:g.signInWithEthereum)||void 0===r?void 0:r.nonce,issuedAt:null!==(n=null===(i=null==g?void 0:g.signInWithEthereum)||void 0===i?void 0:i.issuedAt)&&void 0!==n?n:new Date,expirationTime:null===(a=null==g?void 0:g.signInWithEthereum)||void 0===a?void 0:a.expirationTime,notBefore:null===(o=null==g?void 0:g.signInWithEthereum)||void 0===o?void 0:o.notBefore,requestId:null===(l=null==g?void 0:g.signInWithEthereum)||void 0===l?void 0:l.requestId,resources:null===(u=null==g?void 0:g.signInWithEthereum)||void 0===u?void 0:u.resources};w=(0,v.createSiweMessage)(R),y=await f.request({method:'personal_sign',params:[(0,v.toHex)(w),k]})}try{const{data:t,error:s}=await(0,d._request)(this.fetch,'POST',`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:'ethereum',message:w,signature:y},(null===(h=e.options)||void 0===h?void 0:h.captchaToken)?{gotrue_meta_security:{captcha_token:null===(g=e.options)||void 0===g?void 0:g.captchaToken}}:null),xform:d._sessionResponse});if(s)throw s;if(!t||!t.session||!t.user){const e=new c.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null},error:e})}return t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers('SIGNED_IN',t.session)),this._returnResult({data:Object.assign({},t),error:s})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signInWithSolana(e){var t,s,r,i,n,a,o,l,u,h,g,w;let y,f;if('message'in e)y=e.message,f=e.signature;else{const{chain:c,wallet:d,statement:g,options:w}=e;let p;if((0,_.isBrowser)())if('object'==typeof d)p=d;else{const e=window;if(!('solana'in e)||'object'!=typeof e.solana||!('signIn'in e.solana&&'function'==typeof e.solana.signIn||'signMessage'in e.solana&&'function'==typeof e.solana.signMessage))throw new Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.");p=e.solana}else{if('object'!=typeof d||!(null==w?void 0:w.url))throw new Error('@supabase/auth-js: Both wallet and url must be specified in non-browser environments.');p=d}const v=new URL(null!==(t=null==w?void 0:w.url)&&void 0!==t?t:window.location.href);if('signIn'in p&&p.signIn){const e=await p.signIn(Object.assign(Object.assign(Object.assign({issuedAt:(new Date).toISOString()},null==w?void 0:w.signInWithSolana),{version:'1',domain:v.host,uri:v.href}),g?{statement:g}:null));let t;if(Array.isArray(e)&&e[0]&&'object'==typeof e[0])t=e[0];else{if(!(e&&'object'==typeof e&&'signedMessage'in e&&'signature'in e))throw new Error('@supabase/auth-js: Wallet method signIn() returned unrecognized value');t=e}if(!('signedMessage'in t&&'signature'in t&&('string'==typeof t.signedMessage||t.signedMessage instanceof Uint8Array)&&t.signature instanceof Uint8Array))throw new Error('@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields');y='string'==typeof t.signedMessage?t.signedMessage:(new TextDecoder).decode(t.signedMessage),f=t.signature}else{if(!('signMessage'in p&&'function'==typeof p.signMessage&&'publicKey'in p&&'object'==typeof p&&p.publicKey&&'toBase58'in p.publicKey&&'function'==typeof p.publicKey.toBase58))throw new Error('@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API');y=[`${v.host} wants you to sign in with your Solana account:`,p.publicKey.toBase58(),...g?['',g,'']:[''],'Version: 1',`URI: ${v.href}`,`Issued At: ${null!==(r=null===(s=null==w?void 0:w.signInWithSolana)||void 0===s?void 0:s.issuedAt)&&void 0!==r?r:(new Date).toISOString()}`,...(null===(i=null==w?void 0:w.signInWithSolana)||void 0===i?void 0:i.notBefore)?[`Not Before: ${w.signInWithSolana.notBefore}`]:[],...(null===(n=null==w?void 0:w.signInWithSolana)||void 0===n?void 0:n.expirationTime)?[`Expiration Time: ${w.signInWithSolana.expirationTime}`]:[],...(null===(a=null==w?void 0:w.signInWithSolana)||void 0===a?void 0:a.chainId)?[`Chain ID: ${w.signInWithSolana.chainId}`]:[],...(null===(o=null==w?void 0:w.signInWithSolana)||void 0===o?void 0:o.nonce)?[`Nonce: ${w.signInWithSolana.nonce}`]:[],...(null===(l=null==w?void 0:w.signInWithSolana)||void 0===l?void 0:l.requestId)?[`Request ID: ${w.signInWithSolana.requestId}`]:[],...(null===(h=null===(u=null==w?void 0:w.signInWithSolana)||void 0===u?void 0:u.resources)||void 0===h?void 0:h.length)?['Resources',...w.signInWithSolana.resources.map(e=>`- ${e}`)]:[]].join('\n');const e=await p.signMessage((new TextEncoder).encode(y),'utf8');if(!(e&&e instanceof Uint8Array))throw new Error('@supabase/auth-js: Wallet signMessage() API returned an recognized value');f=e}}try{const{data:t,error:s}=await(0,d._request)(this.fetch,'POST',`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:'solana',message:y,signature:(0,p.bytesToBase64URL)(f)},(null===(g=e.options)||void 0===g?void 0:g.captchaToken)?{gotrue_meta_security:{captcha_token:null===(w=e.options)||void 0===w?void 0:w.captchaToken}}:null),xform:d._sessionResponse});if(s)throw s;if(!t||!t.session||!t.user){const e=new c.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null},error:e})}return t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers('SIGNED_IN',t.session)),this._returnResult({data:Object.assign({},t),error:s})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async _exchangeCodeForSession(e){const t=await(0,_.getItemAsync)(this.storage,`${this.storageKey}-code-verifier`),[s,r]=(null!=t?t:'').split('/');try{if(!s&&'pkce'===this.flowType)throw new c.AuthPKCECodeVerifierMissingError;const{data:t,error:i}=await(0,d._request)(this.fetch,'POST',`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:s},xform:d._sessionResponse});if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),i)throw i;if(!t||!t.session||!t.user){const e=new c.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null,redirectType:null},error:e})}return t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers('recovery'===r?'PASSWORD_RECOVERY':'SIGNED_IN',t.session)),this._returnResult({data:Object.assign(Object.assign({},t),{redirectType:null!=r?r:null}),error:i})}catch(e){if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),(0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null,redirectType:null},error:e});throw e}}async signInWithIdToken(e){try{const{options:t,provider:s,token:r,access_token:i,nonce:n}=e,a=await(0,d._request)(this.fetch,'POST',`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:s,id_token:r,access_token:i,nonce:n,gotrue_meta_security:{captcha_token:null==t?void 0:t.captchaToken}},xform:d._sessionResponse}),{data:o,error:l}=a;if(l)return this._returnResult({data:{user:null,session:null},error:l});if(!o||!o.session||!o.user){const e=new c.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null},error:e})}return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers('SIGNED_IN',o.session)),this._returnResult({data:o,error:l})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signInWithOtp(e){var t,s,r,i,n;try{if('email'in e){const{email:r,options:i}=e;let n=null,a=null;'pkce'===this.flowType&&([n,a]=await(0,_.getCodeChallengeAndMethod)(this.storage,this.storageKey));const{error:o}=await(0,d._request)(this.fetch,'POST',`${this.url}/otp`,{headers:this.headers,body:{email:r,data:null!==(t=null==i?void 0:i.data)&&void 0!==t?t:{},create_user:null===(s=null==i?void 0:i.shouldCreateUser)||void 0===s||s,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken},code_challenge:n,code_challenge_method:a},redirectTo:null==i?void 0:i.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:o})}if('phone'in e){const{phone:t,options:s}=e,{data:a,error:o}=await(0,d._request)(this.fetch,'POST',`${this.url}/otp`,{headers:this.headers,body:{phone:t,data:null!==(r=null==s?void 0:s.data)&&void 0!==r?r:{},create_user:null===(i=null==s?void 0:s.shouldCreateUser)||void 0===i||i,gotrue_meta_security:{captcha_token:null==s?void 0:s.captchaToken},channel:null!==(n=null==s?void 0:s.channel)&&void 0!==n?n:'sms'}});return this._returnResult({data:{user:null,session:null,messageId:null==a?void 0:a.message_id},error:o})}throw new c.AuthInvalidCredentialsError('You must provide either an email or phone number.')}catch(e){if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),(0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async verifyOtp(e){var t,s;try{let r,i;'options'in e&&(r=null===(t=e.options)||void 0===t?void 0:t.redirectTo,i=null===(s=e.options)||void 0===s?void 0:s.captchaToken);const{data:n,error:a}=await(0,d._request)(this.fetch,'POST',`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:i}}),redirectTo:r,xform:d._sessionResponse});if(a)throw a;if(!n){throw new Error('An error occurred on token verification.')}const o=n.session,l=n.user;return(null==o?void 0:o.access_token)&&(await this._saveSession(o),await this._notifyAllSubscribers('recovery'==e.type?'PASSWORD_RECOVERY':'SIGNED_IN',o)),this._returnResult({data:{user:l,session:o},error:null})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signInWithSSO(e){var t,s,r,i,n;try{let a=null,o=null;'pkce'===this.flowType&&([a,o]=await(0,_.getCodeChallengeAndMethod)(this.storage,this.storageKey));const l=await(0,d._request)(this.fetch,'POST',`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},'providerId'in e?{provider_id:e.providerId}:null),'domain'in e?{domain:e.domain}:null),{redirect_to:null!==(s=null===(t=e.options)||void 0===t?void 0:t.redirectTo)&&void 0!==s?s:void 0}),(null===(r=null==e?void 0:e.options)||void 0===r?void 0:r.captchaToken)?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:a,code_challenge_method:o}),headers:this.headers,xform:d._ssoResponse});return(null===(i=l.data)||void 0===i?void 0:i.url)&&(0,_.isBrowser)()&&!(null===(n=e.options)||void 0===n?void 0:n.skipBrowserRedirect)&&window.location.assign(l.data.url),this._returnResult(l)}catch(e){if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),(0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async reauthenticate(){return await this.initializePromise,null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._reauthenticate()):await this._reauthenticate()}async _reauthenticate(){try{return await this._useSession(async e=>{const{data:{session:t},error:s}=e;if(s)throw s;if(!t)throw new c.AuthSessionMissingError;const{error:r}=await(0,d._request)(this.fetch,'GET',`${this.url}/reauthenticate`,{headers:this.headers,jwt:t.access_token});return this._returnResult({data:{user:null,session:null},error:r})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async resend(e){try{const t=`${this.url}/resend`;if('email'in e){const{email:s,type:r,options:i}=e;let n=null,a=null;'pkce'===this.flowType&&([n,a]=await(0,_.getCodeChallengeAndMethod)(this.storage,this.storageKey));const{error:o}=await(0,d._request)(this.fetch,'POST',t,{headers:this.headers,body:{email:s,type:r,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken},code_challenge:n,code_challenge_method:a},redirectTo:null==i?void 0:i.emailRedirectTo});return o&&await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:o})}if('phone'in e){const{phone:s,type:r,options:i}=e,{data:n,error:a}=await(0,d._request)(this.fetch,'POST',t,{headers:this.headers,body:{phone:s,type:r,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:null==n?void 0:n.message_id},error:a})}throw new c.AuthInvalidCredentialsError('You must provide either an email or phone number and a type')}catch(e){if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),(0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async getSession(){return await this.initializePromise,null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>this._useSession(async e=>e)):await this._useSession(async e=>e)}async _acquireLock(e,t){this._debug('#_acquireLock','begin',e);try{if(this.lockAcquired){const e=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),s=(async()=>(await e,await t()))();return this.pendingInLock.push((async()=>{try{await s}catch(e){}})()),s}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug('#_acquireLock','lock acquired for storage key',this.storageKey);try{this.lockAcquired=!0;const e=t();for(this.pendingInLock.push((async()=>{try{await e}catch(e){}})()),await e;this.pendingInLock.length;){const e=[...this.pendingInLock];await Promise.all(e),this.pendingInLock.splice(0,e.length)}return await e}finally{this._debug('#_acquireLock','lock released for storage key',this.storageKey),this.lockAcquired=!1}})}finally{this._debug('#_acquireLock','end')}}async _useSession(e){this._debug('#_useSession','begin');try{const t=await this.__loadSession();return await e(t)}finally{this._debug('#_useSession','end')}}async __loadSession(){this._debug('#__loadSession()','begin'),null==this.lock||this.lockAcquired||this._debug('#__loadSession()','used outside of an acquired lock!',(new Error).stack);try{let e=null;const t=await(0,_.getItemAsync)(this.storage,this.storageKey);if(this._debug('#getSession()','session from storage',t),null!==t&&(this._isValidSession(t)?e=t:(this._debug('#getSession()','session from storage is not valid'),await this._removeSession())),!e)return{data:{session:null},error:null};const s=!!e.expires_at&&1e3*e.expires_at-Date.now()Date.now())){const t=await(0,_.getItemAsync)(this.storage,this.storageKey);if(t&&t.refresh_token===e.refresh_token)return this._returnResult({data:{session:e},error:null})}return this._returnResult({data:{session:null},error:i})}return this._returnResult({data:{session:r},error:null})}finally{this._debug('#__loadSession()','end')}}async getUser(e){if(e)return await this._getUser(e);let t;return await this.initializePromise,t=null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser()):await this._getUser(),t.data.user&&(this.suppressGetSessionWarning=!0),t}async _getUser(e){try{return e?await(0,d._request)(this.fetch,'GET',`${this.url}/user`,{headers:this.headers,jwt:e,xform:d._userResponse}):await this._useSession(async e=>{var t,s,r;const{data:i,error:n}=e;if(n)throw n;return(null===(t=i.session)||void 0===t?void 0:t.access_token)||this.hasCustomAuthorizationHeader?await(0,d._request)(this.fetch,'GET',`${this.url}/user`,{headers:this.headers,jwt:null!==(r=null===(s=i.session)||void 0===s?void 0:s.access_token)&&void 0!==r?r:void 0,xform:d._userResponse}):{data:{user:null},error:new c.AuthSessionMissingError}})}catch(e){if((0,c.isAuthError)(e))return(0,c.isAuthSessionMissingError)(e)&&(await this._removeSession(),await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:e});throw e}}async updateUser(e,t={}){return await this.initializePromise,null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(e,t)):await this._updateUser(e,t)}async _updateUser(e,t={}){try{return await this._useSession(async s=>{const{data:r,error:i}=s;if(i)throw i;if(!r.session)throw new c.AuthSessionMissingError;const n=r.session;let a=null,o=null;'pkce'===this.flowType&&null!=e.email&&([a,o]=await(0,_.getCodeChallengeAndMethod)(this.storage,this.storageKey));const{data:l,error:u}=await(0,d._request)(this.fetch,'PUT',`${this.url}/user`,{headers:this.headers,redirectTo:null==t?void 0:t.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:a,code_challenge_method:o}),jwt:n.access_token,xform:d._userResponse});if(u)throw u;return n.user=l.user,await this._saveSession(n),await this._notifyAllSubscribers('USER_UPDATED',n),this._returnResult({data:{user:n.user},error:null})})}catch(e){if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),(0,c.isAuthError)(e))return this._returnResult({data:{user:null},error:e});throw e}}async setSession(e){return await this.initializePromise,null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._setSession(e)):await this._setSession(e)}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new c.AuthSessionMissingError;const t=Date.now()/1e3;let s=t,r=!0,i=null;const{payload:n}=(0,_.decodeJWT)(e.access_token);if(n.exp&&(s=n.exp,r=s<=t),r){const{data:t,error:s}=await this._callRefreshToken(e.refresh_token);if(s)return this._returnResult({data:{user:null,session:null},error:s});if(!t)return{data:{user:null,session:null},error:null};i=t}else{const{data:r,error:n}=await this._getUser(e.access_token);if(n)return this._returnResult({data:{user:null,session:null},error:n});i={access_token:e.access_token,refresh_token:e.refresh_token,user:r.user,token_type:'bearer',expires_in:s-t,expires_at:s},await this._saveSession(i),await this._notifyAllSubscribers('SIGNED_IN',i)}return this._returnResult({data:{user:i.user,session:i},error:null})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{session:null,user:null},error:e});throw e}}async refreshSession(e){return await this.initializePromise,null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._refreshSession(e)):await this._refreshSession(e)}async _refreshSession(e){try{return await this._useSession(async t=>{var s;if(!e){const{data:r,error:i}=t;if(i)throw i;e=null!==(s=r.session)&&void 0!==s?s:void 0}if(!(null==e?void 0:e.refresh_token))throw new c.AuthSessionMissingError;const{data:r,error:i}=await this._callRefreshToken(e.refresh_token);return i?this._returnResult({data:{user:null,session:null},error:i}):r?this._returnResult({data:{user:r.user,session:r},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async _getSessionFromURL(e,t){var s;try{if(!(0,_.isBrowser)())throw new c.AuthImplicitGrantRedirectError('No browser detected.');if(e.error||e.error_description||e.error_code)throw new c.AuthImplicitGrantRedirectError(e.error_description||'Error in URL with unspecified error_description',{error:e.error||'unspecified_error',code:e.error_code||'unspecified_code'});switch(t){case'implicit':if('pkce'===this.flowType)throw new c.AuthPKCEGrantCodeExchangeError('Not a valid PKCE flow url.');break;case'pkce':if('implicit'===this.flowType)throw new c.AuthImplicitGrantRedirectError('Not a valid implicit grant flow url.')}if('pkce'===t){if(this._debug('#_initialize()','begin','is PKCE flow',!0),!e.code)throw new c.AuthPKCEGrantCodeExchangeError('No code detected.');const{data:t,error:r}=await this._exchangeCodeForSession(e.code);if(r)throw r;const i=new URL(window.location.href);return i.searchParams.delete('code'),window.history.replaceState(window.history.state,'',i.toString()),{data:{session:t.session,redirectType:null!==(s=t.redirectType)&&void 0!==s?s:null},error:null}}const{provider_token:r,provider_refresh_token:i,access_token:n,refresh_token:a,expires_in:o,expires_at:l,token_type:u}=e;if(!(n&&o&&a&&u))throw new c.AuthImplicitGrantRedirectError('No session defined in URL');const d=Math.round(Date.now()/1e3),g=parseInt(o);let w=d+g;l&&(w=parseInt(l));const y=w-d;1e3*y<=h.AUTO_REFRESH_TICK_DURATION_MS&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${y}s, should have been closer to ${g}s`);const f=w-g;d-f>=120?console.warn('@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale',f,w,d):d-f<0&&console.warn('@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew',f,w,d);const{data:p,error:v}=await this._getUser(n);if(v)throw v;const b={provider_token:r,provider_refresh_token:i,access_token:n,expires_in:g,expires_at:w,refresh_token:a,token_type:u,user:p.user};return window.location.hash='',this._debug('#_getSessionFromURL()','clearing window.location.hash'),this._returnResult({data:{session:b,redirectType:e.type},error:null})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{session:null,redirectType:null},error:e});throw e}}_isImplicitGrantCallback(e){return'function'==typeof this.detectSessionInUrl?this.detectSessionInUrl(new URL(window.location.href),e):Boolean(e.access_token||e.error||e.error_description||e.error_code)}async _isPKCECallback(e){const t=await(0,_.getItemAsync)(this.storage,`${this.storageKey}-code-verifier`);return!(!e.code||!t)}async signOut(e={scope:'global'}){return await this.initializePromise,null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(e)):await this._signOut(e)}async _signOut({scope:e}={scope:'global'}){return await this._useSession(async t=>{var s;const{data:r,error:i}=t;if(i&&!(0,c.isAuthSessionMissingError)(i))return this._returnResult({error:i});const n=null===(s=r.session)||void 0===s?void 0:s.access_token;if(n){const{error:t}=await this.admin.signOut(n,e);if(t&&(!(0,c.isAuthApiError)(t)||404!==t.status&&401!==t.status&&403!==t.status)&&!(0,c.isAuthSessionMissingError)(t))return this._returnResult({error:t})}return'others'!==e&&(await this._removeSession(),await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(e){const t=(0,_.generateCallbackId)(),s={id:t,callback:e,unsubscribe:()=>{this._debug('#unsubscribe()','state change callback with id removed',t),this.stateChangeEmitters.delete(t)}};return this._debug('#onAuthStateChange()','registered callback with id',t),this.stateChangeEmitters.set(t,s),(async()=>{await this.initializePromise,null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(t)}):await this._emitInitialSession(t)})(),{data:{subscription:s}}}async _emitInitialSession(e){return await this._useSession(async t=>{var s,r;try{const{data:{session:r},error:i}=t;if(i)throw i;await(null===(s=this.stateChangeEmitters.get(e))||void 0===s?void 0:s.callback('INITIAL_SESSION',r)),this._debug('INITIAL_SESSION','callback id',e,'session',r)}catch(t){await(null===(r=this.stateChangeEmitters.get(e))||void 0===r?void 0:r.callback('INITIAL_SESSION',null)),this._debug('INITIAL_SESSION','callback id',e,'error',t),(0,c.isAuthSessionMissingError)(t)?console.warn(t):console.error(t)}})}async resetPasswordForEmail(e,t={}){let s=null,r=null;'pkce'===this.flowType&&([s,r]=await(0,_.getCodeChallengeAndMethod)(this.storage,this.storageKey,!0));try{return await(0,d._request)(this.fetch,'POST',`${this.url}/recover`,{body:{email:e,code_challenge:s,code_challenge_method:r,gotrue_meta_security:{captcha_token:t.captchaToken}},headers:this.headers,redirectTo:t.redirectTo})}catch(e){if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),(0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async getUserIdentities(){var e;try{const{data:t,error:s}=await this.getUser();if(s)throw s;return this._returnResult({data:{identities:null!==(e=t.user.identities)&&void 0!==e?e:[]},error:null})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async linkIdentity(e){return'token'in e?this.linkIdentityIdToken(e):this.linkIdentityOAuth(e)}async linkIdentityOAuth(e){var t;try{const{data:s,error:r}=await this._useSession(async t=>{var s,r,i,n,a;const{data:o,error:l}=t;if(l)throw l;const u=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:null===(s=e.options)||void 0===s?void 0:s.redirectTo,scopes:null===(r=e.options)||void 0===r?void 0:r.scopes,queryParams:null===(i=e.options)||void 0===i?void 0:i.queryParams,skipBrowserRedirect:!0});return await(0,d._request)(this.fetch,'GET',u,{headers:this.headers,jwt:null!==(a=null===(n=o.session)||void 0===n?void 0:n.access_token)&&void 0!==a?a:void 0})});if(r)throw r;return(0,_.isBrowser)()&&!(null===(t=e.options)||void 0===t?void 0:t.skipBrowserRedirect)&&window.location.assign(null==s?void 0:s.url),this._returnResult({data:{provider:e.provider,url:null==s?void 0:s.url},error:null})}catch(t){if((0,c.isAuthError)(t))return this._returnResult({data:{provider:e.provider,url:null},error:t});throw t}}async linkIdentityIdToken(e){return await this._useSession(async t=>{var s;try{const{error:r,data:{session:i}}=t;if(r)throw r;const{options:n,provider:a,token:o,access_token:l,nonce:u}=e,h=await(0,d._request)(this.fetch,'POST',`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:null!==(s=null==i?void 0:i.access_token)&&void 0!==s?s:void 0,body:{provider:a,id_token:o,access_token:l,nonce:u,link_identity:!0,gotrue_meta_security:{captcha_token:null==n?void 0:n.captchaToken}},xform:d._sessionResponse}),{data:_,error:g}=h;return g?this._returnResult({data:{user:null,session:null},error:g}):_&&_.session&&_.user?(_.session&&(await this._saveSession(_.session),await this._notifyAllSubscribers('USER_UPDATED',_.session)),this._returnResult({data:_,error:g})):this._returnResult({data:{user:null,session:null},error:new c.AuthInvalidTokenResponseError})}catch(e){if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),(0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}})}async unlinkIdentity(e){try{return await this._useSession(async t=>{var s,r;const{data:i,error:n}=t;if(n)throw n;return await(0,d._request)(this.fetch,'DELETE',`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:null!==(r=null===(s=i.session)||void 0===s?void 0:s.access_token)&&void 0!==r?r:void 0})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _refreshAccessToken(e){const t="#_refreshAccessToken()";this._debug(t,'begin');try{const s=Date.now();return await(0,_.retryable)(async s=>(s>0&&await(0,_.sleep)(200*Math.pow(2,s-1)),this._debug(t,'refreshing attempt',s),await(0,d._request)(this.fetch,'POST',`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:d._sessionResponse})),(e,t)=>{const r=200*Math.pow(2,e);return t&&(0,c.isAuthRetryableFetchError)(t)&&Date.now()+r-sDate.now())?this._debug(r,'proactive refresh failed, access token still valid \u2014 preserving session'):await this._removeSession()}return this.lastRefreshFailure={refreshToken:e,result:s,expiresAt:Date.now()+h.REFRESH_FAILURE_COOLDOWN_MS},null===(t=this.refreshingDeferred)||void 0===t||t.resolve(s),s}throw null===(s=this.refreshingDeferred)||void 0===s||s.reject(i),i}finally{this.refreshingDeferred=null,this._debug(r,'end')}}async _notifyAllSubscribers(e,t,s=!0){const r=`#_notifyAllSubscribers(${e})`;this._debug(r,'begin',t,`broadcast = ${s}`);try{this.broadcastChannel&&s&&this.broadcastChannel.postMessage({event:e,session:t});const r=[],i=Array.from(this.stateChangeEmitters.values()).map(async s=>{try{await s.callback(e,t)}catch(e){r.push(e)}});if(await Promise.all(i),r.length>0){for(let e=0;ethis._autoRefreshTokenTick(),h.AUTO_REFRESH_TICK_DURATION_MS);this.autoRefreshTicker=e,e&&'object'==typeof e&&'function'==typeof e.unref?e.unref():'undefined'!=typeof Deno&&'function'==typeof Deno.unrefTimer&&Deno.unrefTimer(e);const t=setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0);this.autoRefreshTickTimeout=t,t&&'object'==typeof t&&'function'==typeof t.unref?t.unref():'undefined'!=typeof Deno&&'function'==typeof Deno.unrefTimer&&Deno.unrefTimer(t)}async _stopAutoRefresh(){this._debug('#_stopAutoRefresh()');const e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e);const t=this.autoRefreshTickTimeout;this.autoRefreshTickTimeout=null,t&&clearTimeout(t)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async dispose(){var e;this._removeVisibilityChangedCallback(),await this._stopAutoRefresh(),null===(e=this.broadcastChannel)||void 0===e||e.close(),this.broadcastChannel=null,this.stateChangeEmitters.clear()}async _autoRefreshTokenTick(){if(this._debug('#_autoRefreshTokenTick()','begin'),null==this.lock)if(null===this.refreshingDeferred)try{const e=Date.now();try{await this._useSession(async t=>{const{data:{session:s}}=t;if(!s||!s.refresh_token||!s.expires_at)return void this._debug('#_autoRefreshTokenTick()','no session');const r=Math.floor((1e3*s.expires_at-e)/h.AUTO_REFRESH_TICK_DURATION_MS);this._debug('#_autoRefreshTokenTick()',`access token expires in ${r} ticks, a tick lasts ${h.AUTO_REFRESH_TICK_DURATION_MS}ms, refresh threshold is ${h.AUTO_REFRESH_TICK_THRESHOLD} ticks`),r<=h.AUTO_REFRESH_TICK_THRESHOLD&&await this._callRefreshToken(s.refresh_token)})}catch(e){console.error('Auto refresh tick failed with error. This is likely a transient error.',e)}}finally{this._debug('#_autoRefreshTokenTick()','end')}else this._debug('#_autoRefreshTokenTick()','refresh already in flight, skipping');else try{await this._acquireLock(0,async()=>{try{const e=Date.now();try{return await this._useSession(async t=>{const{data:{session:s}}=t;if(!s||!s.refresh_token||!s.expires_at)return void this._debug('#_autoRefreshTokenTick()','no session');const r=Math.floor((1e3*s.expires_at-e)/h.AUTO_REFRESH_TICK_DURATION_MS);this._debug('#_autoRefreshTokenTick()',`access token expires in ${r} ticks, a tick lasts ${h.AUTO_REFRESH_TICK_DURATION_MS}ms, refresh threshold is ${h.AUTO_REFRESH_TICK_THRESHOLD} ticks`),r<=h.AUTO_REFRESH_TICK_THRESHOLD&&await this._callRefreshToken(s.refresh_token)})}catch(e){console.error('Auto refresh tick failed with error. This is likely a transient error.',e)}}finally{this._debug('#_autoRefreshTokenTick()','end')}})}catch(e){if(!(e instanceof w.LockAcquireTimeoutError))throw e;this._debug('auto refresh token tick lock not available')}}async _handleVisibilityChange(){if(this._debug('#_handleVisibilityChange()'),!(0,_.isBrowser)()||!(null===window||void 0===window?void 0:window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>{try{await this._onVisibilityChanged(!1)}catch(e){this._debug('#visibilityChangedCallback','error',e)}},null===window||void 0===window||window.addEventListener('visibilitychange',this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error('_handleVisibilityChange',e)}}async _onVisibilityChanged(e){const t=`#_onVisibilityChanged(${e})`;if(this._debug(t,'visibilityState',document.visibilityState),'visible'===document.visibilityState){if(this.autoRefreshToken&&this._startAutoRefresh(),!e)if(await this.initializePromise,null!=this.lock)await this._acquireLock(this.lockAcquireTimeout,async()=>{'visible'===document.visibilityState?await this._recoverAndRefresh():this._debug(t,'acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting')});else{if('visible'!==document.visibilityState)return void this._debug(t,'visibilityState is no longer visible, skipping recovery');await this._recoverAndRefresh()}}else'hidden'===document.visibilityState&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(e,t,s){const r=[`provider=${encodeURIComponent(t)}`];if((null==s?void 0:s.redirectTo)&&r.push(`redirect_to=${encodeURIComponent(s.redirectTo)}`),(null==s?void 0:s.scopes)&&r.push(`scopes=${encodeURIComponent(s.scopes)}`),'pkce'===this.flowType){const[e,t]=await(0,_.getCodeChallengeAndMethod)(this.storage,this.storageKey),s=new URLSearchParams({code_challenge:`${encodeURIComponent(e)}`,code_challenge_method:`${encodeURIComponent(t)}`});r.push(s.toString())}if(null==s?void 0:s.queryParams){const e=new URLSearchParams(s.queryParams);r.push(e.toString())}return(null==s?void 0:s.skipBrowserRedirect)&&r.push(`skip_http_redirect=${s.skipBrowserRedirect}`),`${e}?${r.join('&')}`}async _unenroll(e){try{return await this._useSession(async t=>{var s;const{data:r,error:i}=t;return i?this._returnResult({data:null,error:i}):await(0,d._request)(this.fetch,'DELETE',`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:null===(s=null==r?void 0:r.session)||void 0===s?void 0:s.access_token})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _enroll(e){try{return await this._useSession(async t=>{var s,r;const{data:i,error:n}=t;if(n)return this._returnResult({data:null,error:n});const a=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},'phone'===e.factorType?{phone:e.phone}:'totp'===e.factorType?{issuer:e.issuer}:{}),{data:o,error:l}=await(0,d._request)(this.fetch,'POST',`${this.url}/factors`,{body:a,headers:this.headers,jwt:null===(s=null==i?void 0:i.session)||void 0===s?void 0:s.access_token});return l?this._returnResult({data:null,error:l}):('totp'===e.factorType&&'totp'===o.type&&(null===(r=null==o?void 0:o.totp)||void 0===r?void 0:r.qr_code)&&(o.totp.qr_code=`data:image/svg+xml;utf-8,${o.totp.qr_code}`),this._returnResult({data:o,error:null}))})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _verify(e){const t=async()=>{try{return await this._useSession(async t=>{var s;const{data:r,error:i}=t;if(i)return this._returnResult({data:null,error:i});const n=Object.assign({challenge_id:e.challengeId},'webauthn'in e?{webauthn:Object.assign(Object.assign({},e.webauthn),{credential_response:'create'===e.webauthn.type?(0,b.serializeCredentialCreationResponse)(e.webauthn.credential_response):(0,b.serializeCredentialRequestResponse)(e.webauthn.credential_response)})}:{code:e.code}),{data:a,error:o}=await(0,d._request)(this.fetch,'POST',`${this.url}/factors/${e.factorId}/verify`,{body:n,headers:this.headers,jwt:null===(s=null==r?void 0:r.session)||void 0===s?void 0:s.access_token});return o?this._returnResult({data:null,error:o}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+a.expires_in},a)),await this._notifyAllSubscribers('MFA_CHALLENGE_VERIFIED',a),this._returnResult({data:a,error:o}))})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}};return null!=this.lock?this._acquireLock(this.lockAcquireTimeout,t):t()}async _challenge(e){const t=async()=>{try{return await this._useSession(async t=>{var s;const{data:r,error:i}=t;if(i)return this._returnResult({data:null,error:i});const n=await(0,d._request)(this.fetch,'POST',`${this.url}/factors/${e.factorId}/challenge`,{body:e,headers:this.headers,jwt:null===(s=null==r?void 0:r.session)||void 0===s?void 0:s.access_token});if(n.error)return n;const{data:a}=n;if('webauthn'!==a.type)return{data:a,error:null};switch(a.webauthn.type){case'create':return{data:Object.assign(Object.assign({},a),{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_options:Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:(0,b.deserializeCredentialCreationOptions)(a.webauthn.credential_options.publicKey)})})}),error:null};case'request':return{data:Object.assign(Object.assign({},a),{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_options:Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:(0,b.deserializeCredentialRequestOptions)(a.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}};return null!=this.lock?this._acquireLock(this.lockAcquireTimeout,t):t()}async _challengeAndVerify(e){const{data:t,error:s}=await this._challenge({factorId:e.factorId});return s?this._returnResult({data:null,error:s}):await this._verify({factorId:e.factorId,challengeId:t.id,code:e.code})}async _listFactors(){var e;const{data:{user:t},error:s}=await this.getUser();if(s)return{data:null,error:s};const r={all:[],phone:[],totp:[],webauthn:[]};for(const s of null!==(e=null==t?void 0:t.factors)&&void 0!==e?e:[])r.all.push(s),'verified'===s.status&&r[s.factor_type].push(s);return{data:r,error:null}}async _getAuthenticatorAssuranceLevel(e){var t,s,r,i;if(e)try{const{payload:r}=(0,_.decodeJWT)(e);let i=null;r.aal&&(i=r.aal);let n=i;const{data:{user:a},error:o}=await this.getUser(e);if(o)return this._returnResult({data:null,error:o});(null!==(s=null===(t=null==a?void 0:a.factors)||void 0===t?void 0:t.filter(e=>'verified'===e.status))&&void 0!==s?s:[]).length>0&&(n='aal2');return{data:{currentLevel:i,nextLevel:n,currentAuthenticationMethods:r.amr||[]},error:null}}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}const{data:{session:n},error:a}=await this.getSession();if(a)return this._returnResult({data:null,error:a});if(!n)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:o}=(0,_.decodeJWT)(n.access_token);let l=null;o.aal&&(l=o.aal);let u=l;(null!==(i=null===(r=n.user.factors)||void 0===r?void 0:r.filter(e=>'verified'===e.status))&&void 0!==i?i:[]).length>0&&(u='aal2');return{data:{currentLevel:l,nextLevel:u,currentAuthenticationMethods:o.amr||[]},error:null}}async _getAuthorizationDetails(e){try{return await this._useSession(async t=>{const{data:{session:s},error:r}=t;return r?this._returnResult({data:null,error:r}):s?await(0,d._request)(this.fetch,'GET',`${this.url}/oauth/authorizations/${e}`,{headers:this.headers,jwt:s.access_token,xform:e=>({data:e,error:null})}):this._returnResult({data:null,error:new c.AuthSessionMissingError})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _approveAuthorization(e,t){try{return await this._useSession(async s=>{const{data:{session:r},error:i}=s;if(i)return this._returnResult({data:null,error:i});if(!r)return this._returnResult({data:null,error:new c.AuthSessionMissingError});const n=await(0,d._request)(this.fetch,'POST',`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:r.access_token,body:{action:'approve'},xform:e=>({data:e,error:null})});return n.data&&n.data.redirect_url&&(0,_.isBrowser)()&&!(null==t?void 0:t.skipBrowserRedirect)&&window.location.assign(n.data.redirect_url),n})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _denyAuthorization(e,t){try{return await this._useSession(async s=>{const{data:{session:r},error:i}=s;if(i)return this._returnResult({data:null,error:i});if(!r)return this._returnResult({data:null,error:new c.AuthSessionMissingError});const n=await(0,d._request)(this.fetch,'POST',`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:r.access_token,body:{action:'deny'},xform:e=>({data:e,error:null})});return n.data&&n.data.redirect_url&&(0,_.isBrowser)()&&!(null==t?void 0:t.skipBrowserRedirect)&&window.location.assign(n.data.redirect_url),n})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _listOAuthGrants(){try{return await this._useSession(async e=>{const{data:{session:t},error:s}=e;return s?this._returnResult({data:null,error:s}):t?await(0,d._request)(this.fetch,'GET',`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:t.access_token,xform:e=>({data:e,error:null})}):this._returnResult({data:null,error:new c.AuthSessionMissingError})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _revokeOAuthGrant(e){try{return await this._useSession(async t=>{const{data:{session:s},error:r}=t;return r?this._returnResult({data:null,error:r}):s?(await(0,d._request)(this.fetch,'DELETE',`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:s.access_token,query:{client_id:e.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new c.AuthSessionMissingError})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async fetchJwk(e,t={keys:[]}){let s=t.keys.find(t=>t.kid===e);if(s)return s;const r=Date.now();if(s=this.jwks.keys.find(t=>t.kid===e),s&&this.jwks_cached_at+h.JWKS_TTL>r)return s;const{data:i,error:n}=await(0,d._request)(this.fetch,'GET',`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(n)throw n;return i.keys&&0!==i.keys.length?(this.jwks=i,this.jwks_cached_at=r,s=i.keys.find(t=>t.kid===e),s||null):null}async getClaims(e,t={}){try{let s=e;if(!s){const{data:e,error:t}=await this.getSession();if(t||!e.session)return this._returnResult({data:null,error:t});s=e.session.access_token}const{header:r,payload:i,signature:n,raw:{header:a,payload:o}}=(0,_.decodeJWT)(s);if(!(null==t?void 0:t.allowExpired))try{(0,_.validateExp)(i.exp)}catch(e){throw new c.AuthInvalidJwtError(e instanceof Error?e.message:'JWT validation failed')}const l=r.alg&&!r.alg.startsWith('HS')&&r.kid&&'crypto'in globalThis&&'subtle'in globalThis.crypto?await this.fetchJwk(r.kid,(null==t?void 0:t.keys)?{keys:t.keys}:null==t?void 0:t.jwks):null;if(!l){const{error:e}=await this.getUser(s);if(e)throw e;return{data:{claims:i,header:r,signature:n},error:null}}const u=(0,_.getAlgorithm)(r.alg),h=await crypto.subtle.importKey('jwk',l,u,!0,['verify']);if(!await crypto.subtle.verify(u,h,n,(0,p.stringToUint8Array)(`${a}.${o}`)))throw new c.AuthInvalidJwtError('Invalid JWT signature');return{data:{claims:i,header:r,signature:n},error:null}}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async signInWithPasskey(e){var t,s,r;(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{if(!(0,b.browserSupportsWebAuthn)())return this._returnResult({data:null,error:new c.AuthUnknownError('Browser does not support WebAuthn',null)});const{data:i,error:n}=await this._startPasskeyAuthentication({options:{captchaToken:null===(t=null==e?void 0:e.options)||void 0===t?void 0:t.captchaToken}});if(n||!i)return this._returnResult({data:null,error:n});const a=(0,b.deserializeCredentialRequestOptions)(i.options),o=null!==(r=null===(s=null==e?void 0:e.options)||void 0===s?void 0:s.signal)&&void 0!==r?r:b.webAuthnAbortService.createNewAbortSignal(),{data:l,error:u}=await(0,b.getCredential)({publicKey:a,signal:o});if(u||!l)return this._returnResult({data:null,error:null!=u?u:new c.AuthUnknownError('WebAuthn ceremony failed',null)});const h=(0,b.serializeCredentialRequestResponse)(l);return this._verifyPasskeyAuthentication({challengeId:i.challenge_id,credential:h})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async registerPasskey(e){var t,s;(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{if(!(0,b.browserSupportsWebAuthn)())return this._returnResult({data:null,error:new c.AuthUnknownError('Browser does not support WebAuthn',null)});const{data:r,error:i}=await this._startPasskeyRegistration();if(i||!r)return this._returnResult({data:null,error:i});const n=(0,b.deserializeCredentialCreationOptions)(r.options),a=null!==(s=null===(t=null==e?void 0:e.options)||void 0===t?void 0:t.signal)&&void 0!==s?s:b.webAuthnAbortService.createNewAbortSignal(),{data:o,error:l}=await(0,b.createCredential)({publicKey:n,signal:a});if(l||!o)return this._returnResult({data:null,error:null!=l?l:new c.AuthUnknownError('WebAuthn ceremony failed',null)});const u=(0,b.serializeCredentialCreationResponse)(o);return this._verifyPasskeyRegistration({challengeId:r.challenge_id,credential:u})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _startPasskeyRegistration(){(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{return await this._useSession(async e=>{const{data:{session:t},error:s}=e;if(s)return this._returnResult({data:null,error:s});if(!t)return this._returnResult({data:null,error:new c.AuthSessionMissingError});const{data:r,error:i}=await(0,d._request)(this.fetch,'POST',`${this.url}/passkeys/registration/options`,{headers:this.headers,jwt:t.access_token,body:{}});return i?this._returnResult({data:null,error:i}):this._returnResult({data:r,error:null})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _verifyPasskeyRegistration(e){(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{return await this._useSession(async t=>{const{data:{session:s},error:r}=t;if(r)return this._returnResult({data:null,error:r});if(!s)return this._returnResult({data:null,error:new c.AuthSessionMissingError});const{data:i,error:n}=await(0,d._request)(this.fetch,'POST',`${this.url}/passkeys/registration/verify`,{headers:this.headers,jwt:s.access_token,body:{challenge_id:e.challengeId,credential:e.credential}});return n?this._returnResult({data:null,error:n}):this._returnResult({data:i,error:null})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _startPasskeyAuthentication(e){var t;(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{const{data:s,error:r}=await(0,d._request)(this.fetch,'POST',`${this.url}/passkeys/authentication/options`,{headers:this.headers,body:{gotrue_meta_security:{captcha_token:null===(t=null==e?void 0:e.options)||void 0===t?void 0:t.captchaToken}}});return r?this._returnResult({data:null,error:r}):this._returnResult({data:s,error:null})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _verifyPasskeyAuthentication(e){(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{const{data:t,error:s}=await(0,d._request)(this.fetch,'POST',`${this.url}/passkeys/authentication/verify`,{headers:this.headers,body:{challenge_id:e.challengeId,credential:e.credential},xform:d._sessionResponse});return s?this._returnResult({data:null,error:s}):(t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers('SIGNED_IN',t.session)),this._returnResult({data:t,error:null}))}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _listPasskeys(){(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{return await this._useSession(async e=>{const{data:{session:t},error:s}=e;if(s)return this._returnResult({data:null,error:s});if(!t)return this._returnResult({data:null,error:new c.AuthSessionMissingError});const{data:r,error:i}=await(0,d._request)(this.fetch,'GET',`${this.url}/passkeys`,{headers:this.headers,jwt:t.access_token,xform:e=>({data:e,error:null})});return i?this._returnResult({data:null,error:i}):this._returnResult({data:r,error:null})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _updatePasskey(e){(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{return await this._useSession(async t=>{const{data:{session:s},error:r}=t;if(r)return this._returnResult({data:null,error:r});if(!s)return this._returnResult({data:null,error:new c.AuthSessionMissingError});const{data:i,error:n}=await(0,d._request)(this.fetch,'PATCH',`${this.url}/passkeys/${e.passkeyId}`,{headers:this.headers,jwt:s.access_token,body:{friendly_name:e.friendlyName}});return n?this._returnResult({data:null,error:n}):this._returnResult({data:i,error:null})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _deletePasskey(e){(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{return await this._useSession(async t=>{const{data:{session:s},error:r}=t;if(r)return this._returnResult({data:null,error:r});if(!s)return this._returnResult({data:null,error:new c.AuthSessionMissingError});const{error:i}=await(0,d._request)(this.fetch,'DELETE',`${this.url}/passkeys/${e.passkeyId}`,{headers:this.headers,jwt:s.access_token,noResolveJson:!0});return i?this._returnResult({data:null,error:i}):this._returnResult({data:null,error:null})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}}R.nextInstanceID={};var A=R},1198,[1190,1192,1195,1191,1194,1199,1200,1201,1193,1196,1202,1203]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.memoryLocalStorageAdapter=function(t={}){return{getItem:o=>t[o]||null,setItem:(o,n)=>{t[o]=n},removeItem:o=>{delete t[o]}}}},1199,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"internals",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"LockAcquireTimeoutError",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"NavigatorLockAcquireTimeoutError",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"ProcessLockAcquireTimeoutError",{enumerable:!0,get:function(){return s}}),_e.navigatorLock=async function(e,t,s){o.debug&&console.log('@supabase/gotrue-js: navigatorLock: acquire lock',e,t);const c=new globalThis.AbortController;let l;t>0&&(l=setTimeout(()=>{c.abort(),o.debug&&console.log('@supabase/gotrue-js: navigatorLock acquire timed out',e)},t));await Promise.resolve();try{return await globalThis.navigator.locks.request(e,0===t?{mode:'exclusive',ifAvailable:!0}:{mode:'exclusive',signal:c.signal},async c=>{if(!c){if(0===t)throw o.debug&&console.log('@supabase/gotrue-js: navigatorLock: not immediately available',e),new n(`Acquiring an exclusive Navigator LockManager lock "${e}" immediately failed`);if(o.debug)try{const e=await globalThis.navigator.locks.query();console.log('@supabase/gotrue-js: Navigator LockManager state',JSON.stringify(e,null,' '))}catch(e){console.warn('@supabase/gotrue-js: Error when querying Navigator LockManager state',e)}return console.warn('@supabase/gotrue-js: Navigator LockManager returned a null lock when using #request without ifAvailable set to true, it appears this browser is not following the LockManager spec https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request'),clearTimeout(l),await s()}clearTimeout(l),o.debug&&console.log('@supabase/gotrue-js: navigatorLock: acquired',e,c.name);try{return await s()}finally{o.debug&&console.log('@supabase/gotrue-js: navigatorLock: released',e,c.name)}})}catch(u){if(t>0&&clearTimeout(l),null!==u&&'object'==typeof u&&'name'in u&&'AbortError'===u.name&&t>0){if(c.signal.aborted)return o.debug&&console.log('@supabase/gotrue-js: navigatorLock: acquire timeout, recovering by stealing lock',e),console.warn(`@supabase/gotrue-js: Lock "${e}" was not released within ${t}ms. This may indicate an orphaned lock from a component unmount (e.g., React Strict Mode). Forcefully acquiring the lock to recover.`),await Promise.resolve().then(()=>globalThis.navigator.locks.request(e,{mode:'exclusive',steal:!0},async t=>{if(!t)return console.warn('@supabase/gotrue-js: Navigator LockManager returned null lock even with steal: true'),await s();o.debug&&console.log('@supabase/gotrue-js: navigatorLock: recovered (stolen)',e,t.name);try{return await s()}finally{o.debug&&console.log('@supabase/gotrue-js: navigatorLock: released (stolen)',e,t.name)}}));throw o.debug&&console.log('@supabase/gotrue-js: navigatorLock: lock was stolen by another request',e),new n(`Lock "${e}" was released because another request stole it`)}throw u}},_e.processLock=async function(e,o,n){var l;const u=null!==(l=c[e])&&void 0!==l?l:Promise.resolve(),b=(async()=>{try{return await u,null}catch(e){return null}})(),k=(async()=>{let c=null;try{const t=o>=0?new Promise((t,n)=>{c=setTimeout(()=>{console.warn(`@supabase/gotrue-js: Lock "${e}" acquisition timed out after ${o}ms. This may be caused by another operation holding the lock. Consider increasing lockAcquireTimeout or checking for stuck operations.`),n(new s(`Acquiring process lock with name "${e}" timed out`))},o)}):null;await Promise.race([b,t].filter(e=>e)),null!==c&&clearTimeout(c)}catch(e){if(null!==c&&clearTimeout(c),e instanceof t)throw e}return await n()})();return c[e]=(async()=>{try{return await k}catch(e){if(e instanceof t){try{await u}catch(e){}return null}throw e}})(),await k};var e=r(d[0]);const o={debug:!!(globalThis&&(0,e.supportsLocalStorage)()&&globalThis.localStorage&&'true'===globalThis.localStorage.getItem('supabase.gotrue-js.locks.debug'))};class t extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class n extends t{}class s extends t{}const c={}},1200,[1194]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.polyfillGlobalThis=function(){if('object'==typeof globalThis)return;try{Object.defineProperty(Object.prototype,'__magic__',{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch(e){'undefined'!=typeof self&&(self.globalThis=self)}}},1201,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(t){if(!/^0x[a-fA-F0-9]{40}$/.test(t))throw new Error(`@supabase/auth-js: Address "${t}" is invalid.`);return t.toLowerCase()}Object.defineProperty(e,'__esModule',{value:!0}),e.getAddress=t,e.fromHex=function(t){return parseInt(t,16)},e.toHex=function(t){const n=(new TextEncoder).encode(t);return'0x'+Array.from(n,t=>t.toString(16).padStart(2,'0')).join('')},e.createSiweMessage=function(n){var s;const{chainId:o,domain:u,expirationTime:c,issuedAt:l=new Date,nonce:f,notBefore:I,requestId:v,resources:h,scheme:$,uri:w,version:E}=n;if(!Number.isInteger(o))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${o}`);if(!u)throw new Error("@supabase/auth-js: Invalid SIWE message field \"domain\". Domain must be provided.");if(f&&f.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${f}`);if(!w)throw new Error("@supabase/auth-js: Invalid SIWE message field \"uri\". URI must be provided.");if('1'!==E)throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${E}`);if(null===(s=n.statement)||void 0===s?void 0:s.includes('\n'))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${n.statement}`);const S=t(n.address),b=$?`${$}://${u}`:u,p=n.statement?`${n.statement}\n`:'',j=`${b} wants you to sign in with your Ethereum account:\n${S}\n\n${p}`;let x=`URI: ${w}\nVersion: ${E}\nChain ID: ${o}${f?`\nNonce: ${f}`:''}\nIssued At: ${l.toISOString()}`;c&&(x+=`\nExpiration Time: ${c.toISOString()}`);I&&(x+=`\nNot Before: ${I.toISOString()}`);v&&(x+=`\nRequest ID: ${v}`);if(h){let t='\nResources:';for(const n of h){if(!n||'string'!=typeof n)throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${n}`);t+=`\n- ${n}`}x+=t}return`${j}\n${x}`}},1202,[]); +__d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"WebAuthnError",{enumerable:!0,get:function(){return l.WebAuthnError}}),Object.defineProperty(e,"isWebAuthnError",{enumerable:!0,get:function(){return l.isWebAuthnError}}),Object.defineProperty(e,"identifyRegistrationError",{enumerable:!0,get:function(){return l.identifyRegistrationError}}),Object.defineProperty(e,"identifyAuthenticationError",{enumerable:!0,get:function(){return l.identifyAuthenticationError}}),Object.defineProperty(e,"WebAuthnAbortService",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"webAuthnAbortService",{enumerable:!0,get:function(){return u}}),e.deserializeCredentialCreationOptions=function(i){if(!i)throw new Error('Credential creation options are required');if('undefined'!=typeof PublicKeyCredential&&'parseCreationOptionsFromJSON'in PublicKeyCredential&&'function'==typeof PublicKeyCredential.parseCreationOptionsFromJSON)return PublicKeyCredential.parseCreationOptionsFromJSON(i);const{challenge:o,user:l,excludeCredentials:s}=i,u=(0,t.__rest)(i,["challenge","user","excludeCredentials"]),c=(0,n.base64UrlToUint8Array)(o).buffer,f=Object.assign(Object.assign({},l),{id:(0,n.base64UrlToUint8Array)(l.id).buffer}),h=Object.assign(Object.assign({},u),{challenge:c,user:f});if(s&&s.length>0){h.excludeCredentials=new Array(s.length);for(let t=0;t0){c.allowCredentials=new Array(l.length);for(let t=0;tnull!==t&&'object'==typeof t&&!Array.isArray(t),i=t=>t instanceof ArrayBuffer||ArrayBuffer.isView(t),o={};for(const l of t)if(l)for(const t in l){const s=l[t];if(void 0!==s)if(Array.isArray(s))o[t]=s;else if(i(s))o[t]=s;else if(n(s)){const i=o[t];n(i)?o[t]=p(i,s):o[t]=p(s)}else o[t]=s}return o}function w(t,n){return p(b,t,n||{})}function A(t,n){return p(y,t,n||{})}class O{constructor(t){this.client=t,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(t){return this.client.mfa.enroll(Object.assign(Object.assign({},t),{factorType:'webauthn'}))}async _challenge({factorId:t,webauthn:n,friendlyName:o,signal:l},s){var c;try{const{data:i,error:b}=await this.client.mfa.challenge({factorId:t,webauthn:n});if(!i)return{data:null,error:b};const y=null!=l?l:u.createNewAbortSignal();if('create'===i.webauthn.type){const{user:t}=i.webauthn.credential_options.publicKey;if(!t.name){const n=o;if(n)t.name=`${t.id}:${n}`;else{const n=(await this.client.getUser()).data.user,i=(null===(c=null==n?void 0:n.user_metadata)||void 0===c?void 0:c.name)||(null==n?void 0:n.email)||(null==n?void 0:n.id)||'User';t.name=`${t.id}:${i}`}}t.displayName||(t.displayName=t.name)}switch(i.webauthn.type){case'create':{const n=w(i.webauthn.credential_options.publicKey,null==s?void 0:s.create),{data:o,error:l}=await f({publicKey:n,signal:y});return o?{data:{factorId:t,challengeId:i.id,webauthn:{type:i.webauthn.type,credential_response:o}},error:null}:{data:null,error:l}}case'request':{const n=A(i.webauthn.credential_options.publicKey,null==s?void 0:s.request),{data:o,error:l}=await h(Object.assign(Object.assign({},i.webauthn.credential_options),{publicKey:n,signal:y}));return o?{data:{factorId:t,challengeId:i.id,webauthn:{type:i.webauthn.type,credential_response:o}},error:null}:{data:null,error:l}}}}catch(t){return(0,i.isAuthError)(t)?{data:null,error:t}:{data:null,error:new i.AuthUnknownError('Unexpected error in challenge',t)}}}async _verify({challengeId:t,factorId:n,webauthn:i}){return this.client.mfa.verify({factorId:n,challengeId:t,webauthn:i})}async _authenticate({factorId:t,webauthn:{rpId:n=('undefined'!=typeof window?window.location.hostname:void 0),rpOrigins:o=('undefined'!=typeof window?[window.location.origin]:void 0),signal:l}={}},s){if(!n)return{data:null,error:new i.AuthError('rpId is required for WebAuthn authentication')};try{if(!c())return{data:null,error:new i.AuthUnknownError('Browser does not support WebAuthn',null)};const{data:u,error:f}=await this.challenge({factorId:t,webauthn:{rpId:n,rpOrigins:o},signal:l},{request:s});if(!u)return{data:null,error:f};const{webauthn:h}=u;return this._verify({factorId:t,challengeId:u.challengeId,webauthn:{type:h.type,rpId:n,rpOrigins:o,credential_response:h.credential_response}})}catch(t){return(0,i.isAuthError)(t)?{data:null,error:t}:{data:null,error:new i.AuthUnknownError('Unexpected error in authenticate',t)}}}async _register({friendlyName:t,webauthn:{rpId:n=('undefined'!=typeof window?window.location.hostname:void 0),rpOrigins:o=('undefined'!=typeof window?[window.location.origin]:void 0),signal:l}={}},s){if(!n)return{data:null,error:new i.AuthError('rpId is required for WebAuthn registration')};try{if(!c())return{data:null,error:new i.AuthUnknownError('Browser does not support WebAuthn',null)};const{data:u,error:f}=await this._enroll({friendlyName:t});if(!u)return await this.client.mfa.listFactors().then(n=>{var i;return null===(i=n.data)||void 0===i?void 0:i.all.find(n=>'webauthn'===n.factor_type&&n.friendly_name===t&&'unverified'!==n.status)}).then(t=>t?this.client.mfa.unenroll({factorId:null==t?void 0:t.id}):void 0),{data:null,error:f};const{data:h,error:b}=await this._challenge({factorId:u.id,friendlyName:u.friendly_name,webauthn:{rpId:n,rpOrigins:o},signal:l},{create:s});return h?this._verify({factorId:u.id,challengeId:h.challengeId,webauthn:{rpId:n,rpOrigins:o,type:h.webauthn.type,credential_response:h.webauthn.credential_response}}):{data:null,error:b}}catch(t){return(0,i.isAuthError)(t)?{data:null,error:t}:{data:null,error:new i.AuthUnknownError('Unexpected error in register',t)}}}}},1203,[1168,1196,1195,1194,1204]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"WebAuthnError",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"WebAuthnUnknownError",{enumerable:!0,get:function(){return t}}),e.isWebAuthnError=function(n){return'object'==typeof n&&null!==n&&'__isWebAuthnError'in n},e.identifyRegistrationError=function({error:t,options:s}){var u,c,R;const{publicKey:E}=s;if(!E)throw Error('options was missing required publicKey property');if('AbortError'===t.name){if(s.signal instanceof AbortSignal)return new o({message:'Registration ceremony was sent an abort signal',code:'ERROR_CEREMONY_ABORTED',cause:t})}else if('ConstraintError'===t.name){if(!0===(null===(u=E.authenticatorSelection)||void 0===u?void 0:u.requireResidentKey))return new o({message:'Discoverable credentials were required but no available authenticator supported it',code:'ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT',cause:t});if('conditional'===s.mediation&&'required'===(null===(c=E.authenticatorSelection)||void 0===c?void 0:c.userVerification))return new o({message:'User verification was required during automatic registration but it could not be performed',code:'ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE',cause:t});if('required'===(null===(R=E.authenticatorSelection)||void 0===R?void 0:R.userVerification))return new o({message:'User verification was required but no available authenticator supported it',code:'ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT',cause:t})}else{if('InvalidStateError'===t.name)return new o({message:'The authenticator was previously registered',code:'ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED',cause:t});if('NotAllowedError'===t.name)return new o({message:t.message,code:'ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY',cause:t});if('NotSupportedError'===t.name){return 0===E.pubKeyCredParams.filter(n=>'public-key'===n.type).length?new o({message:'No entry in pubKeyCredParams was of type "public-key"',code:'ERROR_MALFORMED_PUBKEYCREDPARAMS',cause:t}):new o({message:'No available authenticator supported any of the specified pubKeyCredParams algorithms',code:'ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG',cause:t})}if('SecurityError'===t.name){const s=window.location.hostname;if(!(0,n.isValidDomain)(s))return new o({message:`${window.location.hostname} is an invalid domain`,code:'ERROR_INVALID_DOMAIN',cause:t});if(E.rp.id!==s)return new o({message:`The RP ID "${E.rp.id}" is invalid for this domain`,code:'ERROR_INVALID_RP_ID',cause:t})}else if('TypeError'===t.name){if(E.user.id.byteLength<1||E.user.id.byteLength>64)return new o({message:'User ID was not between 1 and 64 characters',code:'ERROR_INVALID_USER_ID_LENGTH',cause:t})}else if('UnknownError'===t.name)return new o({message:'The authenticator was unable to process the specified options, or could not create a new credential',code:'ERROR_AUTHENTICATOR_GENERAL_ERROR',cause:t})}return new o({message:'a Non-Webauthn related error has occurred',code:'ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY',cause:t})},e.identifyAuthenticationError=function({error:t,options:s}){const{publicKey:u}=s;if(!u)throw Error('options was missing required publicKey property');if('AbortError'===t.name){if(s.signal instanceof AbortSignal)return new o({message:'Authentication ceremony was sent an abort signal',code:'ERROR_CEREMONY_ABORTED',cause:t})}else{if('NotAllowedError'===t.name)return new o({message:t.message,code:'ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY',cause:t});if('SecurityError'===t.name){const s=window.location.hostname;if(!(0,n.isValidDomain)(s))return new o({message:`${window.location.hostname} is an invalid domain`,code:'ERROR_INVALID_DOMAIN',cause:t});if(u.rpId!==s)return new o({message:`The RP ID "${u.rpId}" is invalid for this domain`,code:'ERROR_INVALID_RP_ID',cause:t})}else if('UnknownError'===t.name)return new o({message:'The authenticator was unable to process the specified options, or could not create a new assertion signature',code:'ERROR_AUTHENTICATOR_GENERAL_ERROR',cause:t})}return new o({message:'a Non-Webauthn related error has occurred',code:'ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY',cause:t})};var n=r(d[0]);class o extends Error{constructor({message:n,code:o,cause:t,name:s}){var u;super(n,{cause:t}),this.__isWebAuthnError=!0,this.name=null!==(u=null!=s?s:t instanceof Error?t.name:void 0)&&void 0!==u?u:'Unknown Error',this.code=o}toJSON(){return{name:this.name,message:this.message,code:this.code}}}class t extends o{constructor(n,o){super({code:'ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY',cause:o,message:n}),this.name='WebAuthnUnknownError',this.originalError=o}}},1204,[1203]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u}});var e,t=r(d[0]);var u=((e=t)&&e.__esModule?e:{default:e}).default},1205,[1190]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u}});var e,t=r(d[0]);var u=((e=t)&&e.__esModule?e:{default:e}).default},1206,[1198]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.setSyncNamespace=function(e){s=t.IS_ISOLATED_VENUE?`cc-sync:${t.VENUE_RID}:${e}:`:`cc-sync:${e}:`},Object.defineProperty(_e,"syncNamespace",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"kv",{enumerable:!0,get:function(){return i}}),_e.uuid=function(){const e=globalThis.crypto;if(e?.randomUUID)return e.randomUUID();const t=new Uint8Array(16);if(e?.getRandomValues)e.getRandomValues(t);else for(let e=0;e<16;e++)t[e]=Math.floor(256*Math.random());t[6]=15&t[6]|64,t[8]=63&t[8]|128;const n=Array.from(t,e=>e.toString(16).padStart(2,'0')).join('');return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20)}`};var e,t=r(d[0]),n=r(d[1]),c=(e=n)&&e.__esModule?e:{default:e};let s=t.IS_ISOLATED_VENUE?`cc-sync:${t.VENUE_RID}:`:'cc-sync:';const o=()=>s,i={async get(e,t){try{const n=await c.default.getItem(s+e);return null==n?t:JSON.parse(n)}catch{return t}},async set(e,t){try{await c.default.setItem(s+e,JSON.stringify(t))}catch{}},async remove(e){try{await c.default.removeItem(s+e)}catch{}}}},1207,[5,1024]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"isOnline",{enumerable:!0,get:function(){return t}}),_e.setOnline=o,_e.onConnectivity=function(e){return n.add(e),()=>{n.delete(e)}},_e.isNetworkError=function(e){if(!e)return!1;const n=String(e.message??e).toLowerCase();return 0===e.status||/network|fetch failed|failed to fetch|timeout|timed out|offline|econn|enotfound|socket/.test(n)};let e=!0;const n=new Set,t=()=>e;function o(t){t!==e&&(e=t,n.forEach(n=>n(e)))}const s=globalThis.window;s?.addEventListener&&('boolean'==typeof s.navigator?.onLine&&(e=s.navigator.onLine),s.addEventListener('online',()=>o(!0)),s.addEventListener('offline',()=>o(!1)))},1208,[]); +__d(function(g,_r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TableRepository",{enumerable:!0,get:function(){return u}}),e.executeMutation=async function(t){const s=(t,s)=>{throw Object.assign(t,{status:s})};if('rpc'===t.kind){const{error:n,status:r}=await o().rpc(t.fn,t.values??{});return n&&s(n,r),'ok'}const n=o().from(t.table);if('upsert'===t.kind||'insert'===t.kind){const{error:r,status:o}=await n.upsert(t.values??{},{onConflict:t.conflictKey??'id',ignoreDuplicates:'insert'===t.kind});return r&&s(r,o),'ok'}let r='update'===t.kind?n.update(t.values??{}):n.delete();for(const[s,n]of Object.entries(t.match??{}))r=r.eq(s,n);const{data:u,error:c,status:h}=await r.select();c&&s(c,h);return'update'!==t.kind||u&&0!==u.length?'ok':'conflict'};var t=_r(d[0]),s=_r(d[1]),n=_r(d[2]),r=_r(d[3]);const o=()=>(0,s.getSupabase)();class u{constructor(t,s={}){this.table=t,this.opts=s,this.keyOf=s.keyOf??(t=>String(t.id)),this.keyColumns=s.keyColumns??['id'],this.venueCol=s.venueColumn??'venue_id'}rows(s){return t.cache.rows(this.table,s)}get(s,n){return t.cache.get(this.table,s,n)}subscribe(s,n){return t.cache.subscribe(this.table,s,n)}hydrate(s){return t.cache.hydrate(this.table,s)}async refresh(s,n={}){let u=o().from(this.table).select('*').eq(this.venueCol,s);this.opts.orderBy&&(u=u.order(this.opts.orderBy.column,{ascending:this.opts.orderBy.ascending??!0})),n.filter&&(u=n.filter(u));const{data:c,error:h}=await u.limit(this.opts.limit??1e3);if(h)throw h;const l=c??[];return t.cache.replace(this.table,s,l.map(t=>[this.keyOf(t),t]),t=>r.mutationQueue.hasPending(this.table,s,t)),l}async create(s,o){const u={...1===this.keyColumns.length&&'id'===this.keyColumns[0]?{id:(0,n.uuid)()}:{},...o,[this.venueCol]:s},c=this.keyOf(u);return t.cache.put(this.table,s,c,u),await r.mutationQueue.enqueue({table:this.table,venueId:s,kind:'insert'===this.opts.writeMode?'insert':'upsert',rowKey:c,values:u,conflictKey:this.opts.conflictKey??'id'}),u}async update(s,n,o,u={}){const c=t.cache.get(this.table,s,n),h={...this.matchFor(n,c),...u,[this.venueCol]:s};t.cache.patch(this.table,s,n,{...o,updated_at:(new Date).toISOString()}),await r.mutationQueue.enqueue({table:this.table,venueId:s,kind:'update',rowKey:n,values:o,match:h})}async remove(s,n){const o=t.cache.get(this.table,s,n),u={...this.matchFor(n,o),[this.venueCol]:s};t.cache.remove(this.table,s,n),await r.mutationQueue.enqueue({table:this.table,venueId:s,kind:'delete',rowKey:n,match:u})}matchFor(t,s){if(1===this.keyColumns.length&&'id'===this.keyColumns[0])return{id:t};const n={};for(const t of this.keyColumns)n[t]=s?.[t];return n}}},1209,[1210,862,1207,1120]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"cache",{enumerable:!0,get:function(){return w}});var t=r(d[0]);const n=new Map,s=new Map,c=new Map,o=new Map,u=new Set,l=(t,n)=>`cache:${t}:${n}`;function f(t){let s=n.get(t);return s||(s=new Map,n.set(t,s)),s}function p(n){s.delete(n),c.get(n)?.forEach(t=>t());const u=o.get(n);u&&clearTimeout(u),o.set(n,setTimeout(()=>{o.delete(n),t.kv.set(n,Array.from(f(n).entries()))},250))}const w={async hydrate(n,s){const c=l(n,s);if(u.has(c))return;u.add(c);const o=await t.kv.get(c,[]),w=f(c);let h=0;for(const[t,n]of o)w.has(t)||(w.set(t,n),h++);h&&p(c)},rows(t,n){const c=l(t,n);let o=s.get(c);return o||(o=Array.from(f(c).values()),s.set(c,o)),o},get:(t,n,s)=>f(l(t,n)).get(s),put(t,n,s,c){f(l(t,n)).set(s,c),p(l(t,n))},patch(t,n,s,c){const o=f(l(t,n)),u=o.get(s);u&&(o.set(s,{...u,...c}),p(l(t,n)))},remove(t,n,s){f(l(t,n)).delete(s)&&p(l(t,n))},replace(t,s,c,o=()=>!1){const u=l(t,s),w=f(u),h=new Map(c);w.forEach((t,n)=>{o(n)&&h.set(n,t)}),n.set(u,h),p(u)},subscribe(t,n,s){const o=l(t,n);let u=c.get(o);return u||(u=new Set,c.set(o,u)),u.add(s),()=>{u?.delete(s)}},async clearVenue(o,f){for(const p of f){const f=l(p,o);n.delete(f),s.delete(f),u.delete(f),await t.kv.remove(f),c.get(f)?.forEach(t=>t())}}}},1210,[1207]); +__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.classifyWriteError=function(o){if((0,e.isNetworkError)(o))return'network';const{code:n,status:c,msg:l}=t(o);return s(o)?'refused':/^(08|53|57|58)/.test(n)||['40001','40P01','55P03','23505','23503'].includes(n)||/^PGRST30[0-3]$/.test(n)||/jwt|token.*expired/i.test(l)||401===c||408===c||425===c||429===c||c>=500?'retry':409!==c||n?'refused':'retry'},Object.defineProperty(_e,"retryDelayMs",{enumerable:!0,get:function(){return o}}),_e.describeWrite=function(e){const t='rpc'===e.kind?(e.fn??'change').replace(/_/g,' '):n[e.table]??e.table.replace(/_/g,' ').replace(/s$/,''),s=e.values??{},o=s.guest_name??s.name??s.display_name??s.title??s.reason,c='string'==typeof o&&o.trim()?` for ${o.trim().slice(0,60)}`:'';return'delete'===e.kind?`deleting a ${t}${c}`:`the ${t}${c}`},_e.plainReason=function(e,o){const{code:n,status:c,msg:l}=t(e);if('refused'===o)return s(e)?'more than 20 deletes in 10 minutes from one sign-in are stopped to keep your data safe':'42501'===n||403===c||/row-level security|permission/i.test(l)?'your sign-in isn\u2019t allowed to change this':'conflict'===n?'it was changed or removed on another device first':/^(22|23)/.test(n)?'the shared system says some of the details aren\u2019t valid':'P0001'===n&&l?l.slice(0,140):l?`the shared system said: ${l.slice(0,120)}`:'the shared system refused it';return'23505'===n?'the shared system already has another copy of it':'23503'===n?'a related change has to save first':/^PGRST30/.test(n)||401===c||/jwt/i.test(l)?'your sign-in is being refreshed':'the shared system is busy'};var e=r(d[0]);const t=e=>{const t=e&&'object'==typeof e?e:{};return{msg:String(t.message??e??''),code:String(t.code??''),status:Number(t.status??0)||0,hint:String(t.hint??'')}},s=e=>{const s=t(e);return/delete guard/i.test(s.hint)||/too many .* deleted in 10 minutes/i.test(s.msg)};const o=e=>Math.min(5e3*Math.pow(3,Math.max(0,e-1)),3e5),n={bookings:'booking',walk_ins:'walk-in',blocks:'blocked time',sold_out_items:'sold-out mark',sold_out_links:'dish stock link',staff:'staff details',rota_shifts:'rota shift',stock_items:'stock item',stock_events:'stock count',stock_counts:'stock count',chat_messages:'chat message',recipe_cards:'recipe card',order_lists:'order list',order_list_items:'order list item',daily_task_ticks:'task tick',daily_tasks:'daily task',attendance:'clock in or out',cash_ups:'cash-up',table_plans:'table plan',guest_profiles:'guest profile',floor_live:'table status',venues:'venue settings',time_requests:'time-off request',scheduled_notifications:'reminder',suppliers:'supplier',supplier_orders:'supplier order',takeaway_orders:'takeaway order'}},1211,[1208]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"SEED_INGREDIENTS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"SEED_RECIPES",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"WASTE_REASONS",{enumerable:!0,get:function(){return f}}),_e.stripKitchenExamples=S,Object.defineProperty(_e,"useKitchen",{enumerable:!0,get:function(){return w}});var e,t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),n=_r(_d[3]),r=_r(_d[4]),o=_r(_d[5]),d=(e=o)&&e.__esModule?e:{default:e},c=_r(_d[6]),l=_r(_d[7]);const p=(e,t,s,i,n,r,o,d=[],c)=>({id:e,name:t,unit:s,cost:i,supplierId:n,par:r,onHand:o,allergens:d,prevCost:c}),u=[p('haddock','Haddock fillet','kg',1848,'sup-1',14,9.5,['fish'],1650),p('smk-haddock','Smoked haddock','kg',1500,'sup-1',4,3.2,['fish']),p('smk-salmon','Smoked salmon','kg',2800,'sup-1',3,1.1,['fish']),p('crab','White and brown crab meat','kg',3800,'sup-1',3,2.4,['crustaceans']),p('mussels','Rope mussels','kg',450,'sup-1',12,0,['molluscs']),p('langoustine','Langoustines','kg',2600,'sup-1',6,4.5,['crustaceans']),p('lobster','Lobster (whole)','each',1800,'sup-1',6,4,['crustaceans']),p('prawns','Prawns (cooked, peeled)','kg',1400,'sup-1',3,2.6,['crustaceans']),p('beef-fillet','Beef fillet','kg',4800,'sup-2',4,2.9),p('steak','Braising steak','kg',1200,'sup-2',8,6.2),p('patty','Burger patty 6 oz','each',160,'sup-2',40,18),p('chicken','Chicken breast','kg',950,'sup-2',10,7.5),p('chorizo','Chorizo','kg',1400,'sup-2',2,1.6,['sulphites']),p('haggis','Haggis','kg',900,'sup-2',4,3.5,['gluten','celery']),p('potatoes','Potatoes (chipping)','kg',90,'sup-3',75,40),p('onions','Onions','kg',110,'sup-3',15,11),p('leaves','Salad leaves','kg',700,'sup-3',3,.8),p('lemons','Lemons','each',25,'sup-3',60,44),p('milk','Whole milk','L',110,'sup-4',20,14,['milk']),p('cream','Double cream','L',380,'sup-4',12,9,['milk']),p('butter','Butter','kg',850,'sup-4',6,4.5,['milk']),p('cheddar','Mature cheddar','kg',900,'sup-4',5,3.8,['milk']),p('parmesan','Parmesan','kg',1800,'sup-4',2,1.4,['milk']),p('eggs','Free-range eggs','each',28,'sup-4',120,90,['eggs']),p('ice-cream','Vanilla ice cream','L',450,'sup-4',10,7,['milk','eggs']),p('flour','Plain flour','kg',90,'sup-5',16,12,['gluten']),p('batter','Beer batter mix','kg',220,'sup-5',12,3.5,['gluten']),p('pastry','Puff pastry','kg',450,'sup-5',6,4.2,['gluten','milk']),p('macaroni','Macaroni','kg',180,'sup-5',6,5,['gluten']),p('penne','Penne','kg',180,'sup-5',6,4.5,['gluten']),p('buns','Brioche buns','each',45,'sup-5',40,30,['gluten','eggs','milk','sesame']),p('baguette','Garlic baguette','each',90,'sup-5',24,16,['gluten','milk']),p('oil','Rapeseed oil (fryer)','L',200,'sup-5',60,32),p('sponge','Sticky toffee sponge (portion)','each',95,'sup-5',30,22,['gluten','eggs','milk']),p('truffle-oil','Truffle oil','L',3e3,'sup-5',1,.6)],k=(e,t,s)=>({dishId:e,yield:t,lines:s.map(([e,t])=>({ing:e,qty:t}))}),h=[k('a-fishsupper','1 portion (220 g fillet)',[['haddock',.22],['batter',.06],['potatoes',.35],['oil',.05],['lemons',1]]),k('a-skink','1 bowl',[['smk-haddock',.08],['potatoes',.1],['milk',.15],['cream',.05],['onions',.03],['butter',.01]]),k('a-salmon','1 plate',[['smk-salmon',.07],['cream',.03],['leaves',.02],['lemons',1]]),k('a-haggis','1 plate',[['haggis',.1],['flour',.02],['eggs',1],['oil',.03]]),k('a-crabcakes','2 cakes',[['crab',.08],['potatoes',.06],['flour',.02],['eggs',1],['leaves',.02]]),k('a-tempura','1 plate',[['haddock',.07],['prawns',.05],['onions',.05],['batter',.06],['oil',.04],['lemons',1]]),k('a-mini','Kids fish & chips + ice cream',[['haddock',.1],['potatoes',.2],['batter',.03],['oil',.03],['ice-cream',.05]]),k('a-pie','1 pie',[['steak',.22],['pastry',.08],['onions',.05],['potatoes',.3],['oil',.03]]),k('a-chicken','1 plate',[['chicken',.22],['potatoes',.25],['cream',.05],['butter',.02]]),k('a-maccheese','1 bowl',[['macaroni',.12],['cheddar',.08],['milk',.2],['butter',.02],['flour',.015]]),k('a-penne','1 bowl',[['penne',.12],['chicken',.15],['chorizo',.04],['cream',.08],['parmesan',.01]]),k('a-caesar','1 plate',[['chicken',.16],['leaves',.08],['parmesan',.015],['eggs',1],['baguette',.25]]),k('a-moules','1 pot',[['mussels',.5],['cream',.08],['onions',.03],['baguette',.5]]),k('a-fillet','8 oz steak',[['beef-fillet',.227],['potatoes',.35],['onions',.05],['oil',.05],['butter',.02]]),k('a-claymore','1 burger',[['patty',1],['buns',1],['cheddar',.03],['potatoes',.3],['onions',.06],['batter',.03],['oil',.05]]),k('a-langoustines','1 plate',[['langoustine',.35],['butter',.03],['baguette',.5],['leaves',.03],['lemons',1]]),k('a-lobster','1 lobster',[['lobster',1],['butter',.04],['potatoes',.3],['oil',.04],['leaves',.03],['lemons',1]]),k('a-smorgasbord','Serves one',[['langoustine',.3],['mussels',.3],['crab',.08],['prawns',.1],['smk-salmon',.06],['leaves',.05],['lemons',2]]),k('a-deluxe','Serves two',[['lobster',1],['langoustine',.5],['crab',.15],['mussels',.5],['prawns',.15],['smk-salmon',.1],['leaves',.1],['lemons',3],['baguette',1]]),k('a-chips','1 side',[['potatoes',.35],['oil',.05]]),k('a-onionrings','1 side',[['onions',.15],['batter',.06],['oil',.04]]),k('a-garlicbread','1 side',[['baguette',.5],['butter',.02]]),k('a-truffle','1 side',[['potatoes',.35],['oil',.05],['parmesan',.015],['truffle-oil',.005]]),k('a-salad','1 side',[['leaves',.06],['lemons',.5]]),k('a-stp','1 portion',[['sponge',1],['cream',.05],['butter',.02],['ice-cream',.08]])],f=['Out of date','Spoiled','Over-production','Dropped / burnt','Returned by customer','Prep trim'],b=(e,t=10)=>{const s=new Date;return s.setDate(s.getDate()-e),s.setHours(t,0,0,0),s.toISOString()},y=e=>`${e}-${Math.random().toString(36).slice(2,8)}`;function v(){return{ingredients:u.map(e=>({...e})),recipes:h,targetGp:70,deliveries:[{id:'dl-today-fish',supplierId:'sup-1',due:'today',status:'expected',lines:[{ing:'haddock',ordered:10,received:8,price:1848},{ing:'mussels',ordered:12,received:12,price:450},{ing:'langoustine',ordered:3,received:3,price:2750},{ing:'smk-salmon',ordered:2,received:2,price:2800}]},{id:'dl-today-veg',supplierId:'sup-3',due:'today',status:'expected',lines:[{ing:'potatoes',ordered:50,received:50,price:90},{ing:'leaves',ordered:3,received:2,price:700},{ing:'lemons',ordered:30,received:30,price:25}]}],stockTakes:[{id:'stk-1',at:b(7,22),by:'Head Chef (example)',lines:[{ing:'haddock',expected:6,counted:5.4,cost:1650},{ing:'potatoes',expected:30,counted:28,cost:90},{ing:'cream',expected:8,counted:8,cost:380},{ing:'beef-fillet',expected:3.2,counted:3,cost:4800}]}],waste:[{id:'w1',at:b(1,21),by:'Head Chef (example)',item:'Haddock fillet',ing:'haddock',qty:.6,unit:'kg',reason:'Over-production',cost:1109},{id:'w2',at:b(2,15),by:'Head Chef (example)',item:'Salad leaves',ing:'leaves',qty:.5,unit:'kg',reason:'Spoiled',cost:350},{id:'w3',at:b(3,20),by:'Head Chef (example)',item:'Fish supper',qty:1,unit:'portion',reason:'Dropped / burnt',cost:517},{id:'w4',at:b(4,11),by:'Head Chef (example)',item:'Double cream',ing:'cream',qty:1,unit:'L',reason:'Out of date',cost:380},{id:'w5',at:b(5,22),by:'Head Chef (example)',item:'Chips',ing:'potatoes',qty:3,unit:'kg',reason:'Over-production',cost:270}],orders:[{id:'po-1',supplierId:'sup-1',at:b(1,13),by:'Head Chef (example)',status:'placed (by phone)',lines:[{ing:'haddock',qty:10,cost:1848},{ing:'mussels',qty:12,cost:450},{ing:'langoustine',qty:3,cost:2600},{ing:'smk-salmon',qty:2,cost:2800}],total:30520},{id:'po-2',supplierId:'sup-3',at:b(1,18),by:'Head Chef (example)',status:'placed (on website)',lines:[{ing:'potatoes',qty:50,cost:90},{ing:'leaves',qty:3,cost:700},{ing:'lemons',qty:30,cost:25}],total:7350}],prepTicks:{},temps:[{id:'t1',at:b(0,9),by:'Head Chef (example)',kind:'fridge',unit:'Walk-in fridge',temp:3},{id:'t2',at:b(0,9),by:'Head Chef (example)',kind:'freezer',unit:'Chest freezer',temp:-20}]}}function S(e){const t=v(),s=(e,t)=>t.some(t=>JSON.stringify(t)===JSON.stringify(e)),i=e.recipes.filter(e=>!s(e,t.recipes)),r=e.deliveries.filter(e=>!t.deliveries.some(t=>t.id===e.id&&t.supplierId===e.supplierId&&t.due===e.due&&'expected'===e.status&&!e.checkedBy&&!e.note&&JSON.stringify(t.lines)===JSON.stringify(e.lines))),o=e.stockTakes.filter(e=>!(0,n.demoActor)(e.by)),d=e.waste.filter(e=>!(0,n.demoActor)(e.by)),c=e.orders.filter(e=>!(0,n.demoActor)(e.by)),l=e.temps.filter(e=>!(0,n.demoActor)(e.by)),p=new Set([...i,...r,...o,...c].flatMap(e=>e.lines.map(e=>e.ing)));return d.forEach(e=>{e.ing&&p.add(e.ing)}),{ingredients:e.ingredients.filter(e=>p.has(e.id)||!s(e,t.ingredients)),recipes:i,deliveries:r,stockTakes:o,waste:d,orders:c,temps:l}}const w=(0,c.create)()((0,l.persist)(e=>({...r.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD?{targetGp:70,ingredients:[],recipes:[],deliveries:[],stockTakes:[],waste:[],orders:[],prepTicks:{},temps:[]}:v(),setTarget:t=>e({targetGp:Math.max(40,Math.min(90,Math.round(t)))}),setIngredient:(t,s)=>e(e=>({ingredients:e.ingredients.map(e=>e.id===t?{...e,...s}:e)})),setRecipeQty:(t,s,i)=>e(e=>({recipes:e.recipes.map(e=>e.dishId!==t?e:{...e,lines:i>0?e.lines.some(e=>e.ing===s)?e.lines.map(e=>e.ing===s?{...e,qty:i}:e):[...e.lines,{ing:s,qty:i}]:e.lines.filter(e=>e.ing!==s)})})),acceptDelivery:(t,i,n,o)=>e(e=>({deliveries:e.deliveries.map(e=>e.id===t?{...e,lines:i,status:'accepted',checkedBy:n,at:(new Date).toISOString(),note:o}:e),ingredients:e.ingredients.map(e=>{const t=i.find(t=>t.ing===e.id);return t?{...e,onHand:(0,s.fishInStone)(r.VENUE_RID,e)?e.onHand+t.received:Math.round(100*(e.onHand+t.received))/100,...t.price!==e.cost?{prevCost:e.cost,cost:t.price}:{}}:e})})),saveStockTake:(t,s)=>e(e=>({stockTakes:[{id:y('stk'),at:(new Date).toISOString(),by:s,lines:Object.entries(t).map(([t,s])=>{const i=e.ingredients.find(e=>e.id===t);return{ing:t,expected:i.onHand,counted:s,cost:i.cost}})},...e.stockTakes],ingredients:e.ingredients.map(e=>e.id in t?{...e,onHand:t[e.id]}:e)})),addWaste:t=>e(e=>({waste:[{...t,id:y('w'),at:(new Date).toISOString()},...e.waste],ingredients:t.ing?e.ingredients.map(e=>e.id===t.ing?{...e,onHand:Math.max(0,(0,s.fishInStone)(r.VENUE_RID,e)?e.onHand-t.qty:Math.round(100*(e.onHand-t.qty))/100)}:e):e.ingredients})),addOrder:t=>{const s=y('po');return e(e=>({orders:[{...t,id:s,at:(new Date).toISOString()},...e.orders]})),s},setOrderStatus:(t,s)=>e(e=>({orders:e.orders.map(e=>e.id===t?{...e,status:s}:e)})),tickPrep:(t,s)=>e(e=>{const i={...e.prepTicks};return s?i[t]={by:s,at:(new Date).toISOString()}:delete i[t],{prepTicks:i}}),addTemp:t=>e(e=>({temps:[{...t,id:y('t'),at:(new Date).toISOString()},...e.temps]})),reset:()=>e(r.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD?{targetGp:70,ingredients:[],recipes:[],deliveries:[],stockTakes:[],waste:[],orders:[],prepTicks:{},temps:[]}:v())}),{name:'covercharge-kitchen-v1',version:3,storage:(0,l.createJSONStorage)(()=>d.default),migrate:async e=>{const s=e;return t.LIVE_VENUE_BUILD?(await(0,i.archiveChefCache)('kitchen',s),{...s,...S(s)}):s}}))},1212,[833,1149,1137,1125,5,1024,1008,1025]); +__d(function(g,r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ACCIDENT_CATEGORIES",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"RIDDOR_CATEGORIES",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"sid",{enumerable:!0,get:function(){return u}}),_e.isSeedAccident=w,Object.defineProperty(_e,"useSafety",{enumerable:!0,get:function(){return b}});var e,t=r(_d[0]),n=r(_d[1]),a=r(_d[2]),s=r(_d[3]),o=(e=s)&&e.__esModule?e:{default:e},d=r(_d[4]),c=r(_d[5]),l=r(_d[6]);const p=['Near miss','Slip, trip or fall','Cut','Burn or scald','Manual handling','Struck by an object','Allergic reaction','Fall from height','Fracture or dislocation','Taken to hospital','Lost consciousness','Off work more than 7 days','Other'],f=['Fall from height','Fracture or dislocation','Taken to hospital','Lost consciousness','Off work more than 7 days'];let y=0;const u=e=>`${e}-${Date.now().toString(36)}${(y++).toString(36)}`,h=(e,t,n)=>({id:e,when:t,location:'',person:'',personType:'Staff',category:'Near miss',what:'',injury:'None',firstAid:'None needed',witnesses:'',reportedBy:'',reportedById:'',app:'staff',createdAt:`${t}:00`,...n});function S(){const e=new Date,t=(t,n)=>{const a=new Date(e);return a.setDate(a.getDate()-t),`${a.toISOString().slice(0,10)}T${n}`};return[h('acc-ex1',t(3,'19:40'),{location:'Kitchen pass',person:'Server (example)',category:'Near miss',what:'Example: water on the floor by the pass after the glass washer leaked. Nobody slipped.',firstAid:'None needed',witnesses:'Bar (example)',reportedBy:'Server (example)',reportedById:'st-4',app:'staff'}),h('acc-ex2',t(6,'12:15'),{location:'Kitchen: fryer section',person:'Head Chef (example)',category:'Burn or scald',what:'Example: splash of hot oil on the back of the hand while changing the basket.',injury:'Small burn, back of left hand',firstAid:'Cooled under running water for 20 minutes, sterile dressing',witnesses:'None',reportedBy:'Head Chef (example)',reportedById:'st-3',app:'chef'})]}function w(e){const t=({when:e,createdAt:t,...n})=>JSON.stringify(n);return S().some(n=>n.id===e.id&&t(n)===t(e))}const b=(0,d.create)()((0,c.persist)(e=>({points:l.DEFAULT_POINTS,entries:[],accidents:a.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD?[]:S(),probes:[],diary:[],daySigns:[],weekly:[],addNote:t=>e(e=>({diary:[{...t,id:u('dn')},...e.diary??[]]})),signDay:t=>e(e=>({daySigns:[...(e.daySigns??[]).filter(e=>e.date!==t.date),t]})),signWeek:t=>e(e=>({weekly:[{...t,id:u('wk')},...(e.weekly??[]).filter(e=>e.week!==t.week)]})),addProbe:t=>e(e=>({probes:[...e.probes??[],{...t,id:u('pr'),status:'not-connected'}]})),removeProbe:t=>e(e=>({probes:(e.probes??[]).filter(e=>e.id!==t)})),addEntries:t=>e(e=>({entries:[...t.map(e=>({...e,id:u('hc')})),...e.entries]})),setPoint:(t,n)=>e(e=>({points:e.points.map(e=>e.id===t?{...e,...n}:e)})),addPoint:t=>e(e=>({points:[...e.points,{...t,id:u('cp')}]})),resetPoints:()=>e({points:l.DEFAULT_POINTS}),addAccident:t=>e(e=>({accidents:[{...t,id:u('acc'),createdAt:(new Date).toISOString()},...e.accidents]})),setRiddorNote:(t,n)=>e(e=>({accidents:e.accidents.map(e=>e.id===t?{...e,riddorNote:n}:e)}))}),{name:'covercharge-safety-v1',storage:(0,c.createJSONStorage)(()=>o.default),version:4,migrate:async(e,a)=>{if(t.LIVE_VENUE_BUILD&&e&&await(0,n.archiveChefCache)('safety',e),e&&a<2){const t=new Set((e.points??[]).map(e=>e.id));e.points=[...e.points??[],...l.DEFAULT_POINTS.filter(e=>!t.has(e.id))],e.diary=e.diary??[],e.daySigns=e.daySigns??[],e.weekly=e.weekly??[]}return t.LIVE_VENUE_BUILD&&e&&(e.accidents=(e.accidents||[]).filter(e=>!w(e))),e}}))},1213,[833,1137,5,1024,1008,1025,1214]); +__d(function(g,_r,i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"KIND_LABEL",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"TEMP_KINDS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"isTempKind",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"SECTIONS",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"SECTION_LABEL",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"sectionOf",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"initialsOf",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"DEFAULT_POINTS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"limitText",{enumerable:!0,get:function(){return d}}),_e.inRange=u,_e.spokenNumber=p,_e.parseQuick=function(e,n){return e.split(/[,;\n]+|\s+and\s+|\.\s+/i).map(e=>e.trim()).filter(Boolean).map(e=>{const r=e.toLowerCase().replace(/[\u2010\u2013]/g,'-').replace(/-(?!\d)/g,' '),o=` ${r.replace(/[^a-z0-9.\- ]/g,' ').replace(/\s+/g,' ')} `;let a,l=0;for(const e of n)for(const n of[e.name.toLowerCase(),...e.aliases]){const t=n.replace(/-/g,' ').replace(/[^a-z0-9 ]/g,' ').replace(/\s+/g,' ').trim();t&&o.includes(` ${t} `)&&t.length>l&&(a=e,l=t.length)}const s=p(r);return a?t(a.kind)?null==s?{text:e,point:a,value:null,problem:'No temperature heard \u2014 type it in.'}:{text:e,point:a,value:s}:{text:e,point:a,value:null}:{text:e,value:s,problem:'Not sure which check this is \u2014 pick it below or type it.'}})},_e.missedChecks=function(e,n,t){const r=new Date(t);r.setHours(0,0,0,0);const o=60*t.getHours()+t.getMinutes(),a=[];for(const l of e){const e=l.due.filter(e=>f(e)<=o);if(!e.length)continue;const s=e[e.length-1],c=r.getTime()+6e4*f(e[0])-108e5,d=n.filter(e=>e.pointId===l.id&&new Date(e.at).getTime()>=c&&new Date(e.at).getTime()<=t.getTime()),u=e.length;d.lengthe.map(y).join(',')).join('\r\n')+'\r\n'},Object.defineProperty(_e,"SLOTS",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"SLOT_LABEL",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"SLOT_HINT",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"slotOf",{enumerable:!0,get:function(){return C}}),_e.todayTasks=function(e,n,t){const r=new Date(t);r.setHours(0,0,0,0);const o=60*t.getHours()+t.getMinutes(),a=[];for(const l of e){const e=[...l.due].sort();if(!e.length)continue;const s=r.getTime()+6e4*f(e[0])-108e5,c=n.filter(e=>e.pointId===l.id&&new Date(e.at).getTime()>=s&&new Date(e.at).getTime()<=t.getTime()).reverse().sort((e,n)=>e.at.localeCompare(n.at));e.forEach((e,n)=>{const t=c[n],r=f(e),s=t?'done':o>=r?'overdue':o>=r-60?'due':'upcoming';a.push({key:`${l.id}@${e}`,point:l,due:e,slot:C(e),status:s,entry:t})})}return a.sort((e,n)=>e.due.localeCompare(n.due)||e.point.name.localeCompare(n.point.name))},_e.unitStatus=function(e,n,t){const r=n.filter(n=>n.pointId===e.id&&null!=n.value).reverse().sort((e,n)=>e.at.localeCompare(n.at)),o=r[r.length-1];if(!o)return{rag:'none',history:r,why:'No readings yet'};const a=o.value;if(!u(e,a))return{rag:'red',latest:o,history:r,why:'Out of range'};const l=new Date(t);if(l.setHours(0,0,0,0),new Date(o.at).getTime()e.max-1||null!=e.min&&an.includes(e),r=['cross','cleaning','chilling','cooking','management'],o={cross:'Cross-contamination',cleaning:'Cleaning',chilling:'Chilling',cooking:'Cooking',management:'Management'},a={fridge:'chilling',freezer:'chilling',cool:'chilling',delivery:'chilling',cook:'cooking',hothold:'cooking',cleaning:'cleaning',allergen:'cross',check:'management'},l=e=>e.section??a[e.kind],s=e=>e.replace(' (example)','').split(/\s+/).filter(Boolean).map(e=>e[0]).join('').slice(0,3).toUpperCase(),c=[{id:'cp-walkin',name:'Walk-in fridge',kind:'fridge',max:5,due:['09:00','16:00'],aliases:['walk in fridge','walkin fridge','walk in','walk-in','walkin','cold room']},{id:'cp-prep',name:'Prep fridge',kind:'fridge',max:5,due:['09:00','16:00'],aliases:['prep fridge','prep']},{id:'cp-bar',name:'Bar fridge',kind:'fridge',max:5,due:['16:00'],aliases:['bar fridge','bar']},{id:'cp-freezer',name:'Freezer',kind:'freezer',max:-18,due:['09:00','16:00'],aliases:['freezer','chest freezer']},{id:'cp-cook',name:'Cooking: core temperature',kind:'cook',min:75,due:[],aliases:['core','cook','cooking','probe']},{id:'cp-cool',name:'Cooling: within 90 minutes',kind:'cool',max:8,due:[],aliases:['cooling','cool']},{id:'cp-hothold',name:'Hot hold: bain-marie',kind:'hothold',min:63,due:['18:00'],aliases:['hot hold','bain marie','bain-marie','hothold']},{id:'cp-del-chill',name:'Delivery: chilled',kind:'delivery',max:8,due:[],aliases:['chilled delivery','delivery chilled','delivery']},{id:'cp-del-frozen',name:'Delivery: frozen',kind:'delivery',max:-15,due:[],aliases:['frozen delivery','delivery frozen']},{id:'cp-clean',name:'Close-down clean signed off',kind:'cleaning',due:['23:00'],aliases:['cleaning','clean down','close down']},{id:'cp-allergen',name:'Allergen matrix checked against today\u2019s specials',kind:'allergen',due:['11:00'],aliases:['allergen','allergens']},{id:'cp-open-equip',name:'Fridges, freezers and other equipment working',kind:'check',section:'management',due:['09:00'],aliases:['equipment']},{id:'cp-open-staff',name:'Staff fit for work, in clean work clothes',kind:'check',section:'management',due:['09:00'],aliases:['staff fit']},{id:'cp-open-surfaces',name:'Prep areas, surfaces and utensils clean and disinfected',kind:'cleaning',due:['09:00'],aliases:['surfaces','prep areas']},{id:'cp-open-pests',name:'No signs of pests',kind:'check',section:'cleaning',due:['09:00'],aliases:['pests','pest']},{id:'cp-open-hands',name:'Hand-wash basins: hot water, soap and paper towels',kind:'check',section:'cross',due:['09:00'],aliases:['hand wash','handwash','soap']},{id:'cp-open-probe',name:'Probe thermometer working, probe wipes available',kind:'check',section:'management',due:['09:00'],aliases:['probe wipes','thermometer']},{id:'cp-mid-boards',name:'Raw and ready-to-eat kept apart; colour-coded boards in use',kind:'check',section:'cross',due:['12:00'],aliases:['boards','raw and ready to eat']},{id:'cp-close-stored',name:'Food covered, labelled, dated and put away',kind:'check',section:'chilling',due:['22:00'],aliases:['labelled','covered']},{id:'cp-close-useby',name:'Food past its use-by date thrown away',kind:'check',section:'chilling',due:['22:00'],aliases:['use by','use-by']},{id:'cp-close-waste',name:'Waste removed and bins relined',kind:'check',section:'cleaning',due:['22:00'],aliases:['waste','bins']}],d=e=>null!=e.min&&null!=e.max?`${e.min}\xb0C to ${e.max}\xb0C`:null!=e.max?`${e.max}\xb0C or colder`:null!=e.min?`${e.min}\xb0C or hotter`:'Done / not done';function u(e,n){return(null==e.min||n>=e.min)&&(null==e.max||n<=e.max)}const m={zero:0,nought:0,one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12,thirteen:13,fourteen:14,fifteen:15,sixteen:16,seventeen:17,eighteen:18,nineteen:19,twenty:20,thirty:30,forty:40,fifty:50,sixty:60,seventy:70,eighty:80,ninety:90};function p(e){const n=e.toLowerCase().replace(/\u2212/g,'-').replace(/degrees?|\xb0c?|celsius|centigrade/g,' '),t=/\b(minus|negative)\b/.test(n),r=n.match(/-?\d+(?:[.,]\d+)?/);if(r){const e=Number(r[0].replace(',','.'));return t&&e>0?-e:e}const o=n.split(/[^a-z]+/).filter(Boolean);let a=null,l=null,s=!1;for(const e of o)if('point'!==e){if(e in m){if(s){l=m[e];break}a=(a??0)+m[e]}}else s=!0;if(null==a)return null;const c=null!=l?Number(`${a}.${l}`):a;return t?-c:c}const f=e=>{const[n,t]=e.split(':').map(Number);return 60*n+t};const h=e=>null!=e.value?`${e.value}\xb0C`:e.done?'Done':'Not done',y=e=>{const n=null==e?'':String(e);return/[",\n]/.test(n)?`"${n.replace(/"/g,'""')}"`:n},k=['Date','Time','Check','Type','Reading','Safe limit','Result','Corrective action','Note','Recorded by','Entry'];function b(n,t){return n.map(n=>{const r=new Date(n.at),o=t.find(e=>e.id===n.pointId);return[r.toLocaleDateString('en-GB'),r.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}),n.name,e[n.kind],h(n),o?d(o):'',n.ok?'OK':'OUT OF RANGE',n.corrective??'',n.note??'',n.by,'probe'===n.source?'Wireless probe':'voice'===n.source?'Voice (confirmed)':'Typed']})}const w=['opening','midday','closing'],v={opening:'Opening',midday:'Midday',closing:'Closing'},O={opening:'until 11:00',midday:'11:00 to 16:00',closing:'from 16:00'},C=e=>{const n=f(e);return n<660?'opening':n<960?'midday':'closing'};const T=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`,x=['Opening and closing checks were done every day (or the reason is in the diary)','Every out-of-range reading has a corrective action','Probe thermometers checked (iced water / boiling water) this week','Allergen information is up to date for menu and special changes','Cleaning schedule followed; no signs of pests','Staff trained on any changed safe methods']},1214,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"GREENSIDE_PALETTE",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"GREENSIDE_DISPLAY",{enumerable:!0,get:function(){return o}});const t={bg:'#1A1A1A',surface:'#222222',surface2:'#292929',border:'#62675E',gold:'#7DB754',goldLight:'#AED28E',goldTint:'#25321E',goldMuted:'#A1C783',tile:'#222222',tilePressed:'#2D3428',accentBg:'rgba(125,183,84,0.13)',accentBorder:'rgba(125,183,84,0.55)',onGold:'#1A1A1A',ok:'#AED28E',okBg:'#25321E',blue:'#AED28E',blueBg:'#25321E'},o={quietBorder:'rgba(125,183,84,0.55)',quietPressed:'rgba(125,183,84,0.16)',primaryPressed:'#6D9F49'}},1215,[]); +__d(function(_g,_r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SHIFT_FILTER_LABEL",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"NOTIF_DAY_NAMES",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"NOTIF_GROUP_LABEL",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"IN_APP_WINDOW_MINS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"PUSH_WINDOW_MINS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"KITCHEN_OPEN_DAYS",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"TITLE_MAX",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"MESSAGE_MAX",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"validHm",{enumerable:!0,get:function(){return u}}),e.ukNow=p,Object.defineProperty(e,"timeOn",{enumerable:!0,get:function(){return m}}),e.notifDue=function(t,n,r=s){const o=p(n),d=m(t,o.dow);if(t.paused||t.removed||!u(d)||!t.days.includes(o.dow))return{due:!1,forDate:o.ymd,at:d};const f=l(d);return{due:o.mins>=f&&o.minst.days.includes(n));if(!r.length)return'No days ticked';const s=new Map;for(const n of r){const r=m(t,n);s.set(r,[...s.get(r)??[],n])}const o=t=>7===t.length?'Every day':t.map(t=>n[t]).join(', ');return[...s.entries()].map(([t,n])=>`${o(n)} at ${t}`).join('; ')+' (UK time)'},e.validateNotif=function(t){if(!t.title.trim())return'Give it a name.';if(t.title.length>f)return`Keep the name under ${f} letters.`;if(!t.message.trim())return'Type the message people will see.';if(t.message.length>c)return`Keep the message under ${c} letters.`;if(!u(t.time))return'Type the time as HH:MM, e.g. 21:00.';for(const n of Object.values(t.dayTimes??{}))if(!u(n))return'Type each day\u2019s time as HH:MM.';return t.days.length?t.recipients.staff.length||t.recipients.groups.length||(t.recipients.onShiftIn??[]).length?t.sendBy.inApp||t.sendBy.push?null:'Choose how to send it.':'Tick at least one person or group.':'Tick at least one day.'},e.anchorageSeeds=function(t,n,r){const s={staff:[n,r].filter(Boolean),groups:[]},o={inApp:!0,push:!0};return[{id:t('mills-milk'),seed:'mills-milk',title:'Mills milk order',message:'Make sure an order before 9:30',days:[...d],time:'21:00',dayTimes:{5:'20:55',0:'20:55'},recipients:s,sendBy:o},{id:t('peronis'),seed:'peronis',title:"Pieroni's order",message:"order Pieroni's by phone",days:[...d],time:'21:05',recipients:s,sendBy:o},{id:t('veg-second'),seed:'veg-second',title:'Veg order',message:'Order veg on the app before 11 PM',days:[...d],time:'21:15',recipients:s,sendBy:o},{id:t('reeds'),seed:'reeds',title:'Reeds order',message:'Order reeds',days:[3,4],time:'21:25',recipients:s,sendBy:o},{id:t('spezbona'),seed:'spezbona',title:'Spes Bona order',message:'Do we need anything from Spes Bona for this week? Message Anna if we do for Friday delivery.',days:[3],time:'15:00',recipients:s,sendBy:o},{id:t('olsens'),seed:'olsens',title:"Olsen's order",message:"Place Olsen's order before 3:30 PM. By phone.",days:[2],time:'13:00',recipients:{staff:[r],groups:[]},sendBy:o},{id:t('allsons-list'),seed:'allsons-list',title:'Alsons drinks list',message:'Add anything extra to the Alsons drinks list.',days:[0],time:'20:00',recipients:{staff:['st-finn'],groups:[]},sendBy:o,open:{page:'orderlists',list:'allsons'}},{id:t('tea-towels'),seed:'tea-towels',title:'Tea towels',message:'Put a load of tea towels on to wash.',days:[...d],time:'15:00',recipients:{staff:[],groups:[],onShiftIn:['kp'],fallback:{staff:[],groups:['head_chef']}},sendBy:o},{id:t('rota-upload'),seed:'rota-upload',title:'Rota upload',message:"Make sure you have uploaded next week's rota.",days:[0],time:'20:50',recipients:s,sendBy:o}]};const t={kitchen:'On shift: Kitchen',foh:'On shift: Front of house',bar:'On shift: Bar',kp:'On shift: KPs',chefs:'On shift: Chefs'},n=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],r={on_shift:'Everyone on shift',everyone:'Everyone',managers:'Owners and managers',head_chef:'Head Chef',kitchen:'Kitchen team',foh:'Front of house'},s=120,o=15,d=[3,4,5,6,0],f=60,c=160,u=t=>/^([01]\d|2[0-3]):[0-5]\d$/.test(t),l=t=>60*Number(t.slice(0,2))+Number(t.slice(3,5));function p(t){const r='number'==typeof t?new Date(t):t,s={};for(const t of new Intl.DateTimeFormat('en-GB',{timeZone:'Europe/London',weekday:'short',year:'numeric',month:'2-digit',day:'2-digit',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}).formatToParts(r))s[t.type]=t.value;return{dow:n.indexOf(String(s.weekday).slice(0,3)),mins:60*Number(s.hour)+Number(s.minute),ymd:`${s.year}-${s.month}-${s.day}`}}const m=(t,n)=>{const r=t.dayTimes?.[String(n)];return r&&u(r)?r:t.time};const h=t=>t.open?`./?open=${t.open.page}${t.open.list?`&list=${encodeURIComponent(t.open.list)}`:''}`:'./',y=(t,n)=>`${t.id}:${n}`,g=t=>(t??'').toLowerCase(),b=t=>t.level?['owner','manager'].includes(g(t.level)):['owner','manager'].includes(g(t.role)),O=t=>'head_chef'===g(t.role)||'head chef'===g(t.level)||'chef'===g(t.app)||/head chef/.test(g(t.job)),P=t=>'kitchen'===g(t.department)||/chef|kitchen|kp|porter/.test(g(t.job))||O(t),k=t=>/\bkp\b|kitchen porter/.test(g(t.job));function j(t,n){const r=g(n.department);return'kitchen'===t?P(n):'kp'===t?k(n):'chefs'===t?O(n)||/chef|commis/.test(g(n.job)):'bar'===t?'bar'===r||/\bbar/.test(g(n.job)):'front of house'===r||!r&&!P(n)&&!b(n)}function _(t,n,r=[]){const s=v(t.recipients,n,r),o=t.recipients.fallback;return s.length||!o?s:v({staff:o.staff,groups:o.groups},n,r)}const w=(t,n,r=[])=>!!t.recipients.fallback&&!v(t.recipients,n,r).length;function v(t,n,r){const s=t,o=n.filter(t=>!1!==t.active),d=new Set;for(const t of s.staff)o.some(n=>n.id===t)&&d.add(t);for(const t of s.groups)for(const n of o)('everyone'===t||'on_shift'===t&&r.includes(n.id)||'managers'===t&&b(n)||'head_chef'===t&&O(n)||'kitchen'===t&&P(n)||'foh'===t&&!P(n)&&!b(n))&&d.add(n.id);for(const t of s.onShiftIn??[])for(const n of o)r.includes(n.id)&&j(t,n)&&d.add(n.id);return[...d].sort()}const M=t=>({id:t.external_ref,role:t.roles?.key??void 0,job:t.job_title??'',department:t.department??'',active:!1!==t.active}),T=(t,n,r,s=[])=>_(t,r,s).includes(n)},1216,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.fixSupplierNames=function(n){return n?s.reduce((s,[n,b])=>s.replace(n,b),n):n};const s=[[/\bAl{2}sons?'?s?\b|\bAlson's\b/g,'Alsons'],[/\bSpe[zs] ?[Bb]ona\b|\bSpezbona\b/g,'Spes Bona']]},1217,[]); +__d(function(g,r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DEFAULT_ORDER_LIST_SETTINGS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"UNITS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"DAY_FULL",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"normName",{enumerable:!0,get:function(){return a}}),e.findDuplicate=function(t,n,i,s){return t.find(t=>t.listId===n&&!t.removed&&'open'===t.status&&a(t.name)===a(i)&&u(t.unit)===u(s))},e.bumpQty=function(t,n,i,a,u){return{...t,qty:Math.round(100*(t.qty+n))/100,bumps:[...t.bumps??[],{by:i,name:a,qty:n,at:u}],updatedAt:u}},Object.defineProperty(e,"qtyText",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"validQty",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"liveItems",{enumerable:!0,get:function(){return d}}),e.finishOrder=function(t,n,i,a,u,s){const o=d(n,t.id),l=o.filter(t=>'got'!==t.status),c={id:s(),listId:t.id,listName:t.name,finishedAt:u,finishedBy:a.id,finishedByName:a.name,items:o.map(t=>({name:t.name,qty:t.qty,unit:t.unit,note:t.note,status:t.status,addedByName:t.addedByName})),carried:i?l.length:0},p=i?l.map(t=>({...t,status:'open',carried:'missing'===t.status?'missing':'not-got',statusBy:void 0,statusAt:void 0,updatedAt:u})):[],m=new Set(p.map(t=>t.id));return{round:c,drop:o.filter(t=>!m.has(t.id)).map(t=>t.id),carriedOver:p}},e.nextTripDate=p,e.tripText=function(t,n,a){const u=p(t,n,a);if(!u)return'Running list';const[,s,o]=u.split('-').map(Number);return"Next trip "+(u===n?'today':u===l(n,1)?'tomorrow':`${i[c(u)]} ${o} ${['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'][s-1]}`)},e.initials=function(t){const n=t.replace(/\(.*?\)/g,' ').split(/[^A-Za-z0-9]+/).filter(t=>t&&!['and','the','of','&'].includes(t.toLowerCase()));return n.length?(1===n.length?n[0].slice(0,2):n[0][0]+n[1][0]).toUpperCase():'?'},e.telHref=function(t){if(!t)return null;const n=t.trim().replace(/[^\d+]/g,'').replace(/(?!^)\+/g,'');return n.replace(/\D/g,'').length>=6?`tel:${n}`:null};const t={allowStaff:!0,defaultTripDay:5},n=['','cases','bottles','kegs','boxes','bags','packs','kg','litres','each'],i=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],a=t=>t.trim().toLowerCase().replace(/[\u2019']/g,"'").replace(/\s+/g,' ').replace(/s$/,''),u=t=>t.trim().toLowerCase().replace(/s$/,'');const s=t=>`${Number.isInteger(t.qty)?t.qty:t.qty.toFixed(2).replace(/0$/,'')}${t.unit?` ${t.unit}`:''}`,o=t=>Number.isFinite(t)&&t>0&&t<=9999,d=(t,n)=>t.filter(t=>t.listId===n&&!t.removed).sort((t,n)=>('open'===t.status?0:1)-('open'===n.status?0:1)||t.addedAt.localeCompare(n.addedAt));const l=(t,n)=>{const[i,a,u]=t.split('-').map(Number);return new Date(Date.UTC(i,a-1,u+n)).toISOString().slice(0,10)},c=t=>{const[n,i,a]=t.split('-').map(Number);return new Date(Date.UTC(n,i-1,a)).getUTCDay()};function p(n,i,a=t.defaultTripDay){if('trip'!==n.kind)return null;if(n.nextTrip&&n.nextTrip>=i)return n.nextTrip;const u=n.tripDay??a;return l(i,(u-c(i)+7)%7)}},1218,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useClockArea",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"areaOf",{enumerable:!0,get:function(){return _}});var e,t=r(d[0]),n=r(d[1]),s=r(d[2]),u=(e=s)&&e.__esModule?e:{default:e},c=r(d[3]),l=r(d[4]),E=r(d[5]);const o=(0,c.create)()((0,l.persist)(e=>({areas:(0,n.privateClockVenue)(t.VENUE_RID)?{[t.VENUE_RID]:(0,n.venueClockArea)(t.VENUE_RID)}:{},visiting:{},set:(s,u,c)=>e(e=>t.IS_ISOLATED_VENUE&&s!==t.VENUE_RID?e:{areas:{...e.areas,[s]:{...(0,n.venueClockArea)(s,{...e.areas[s]??{},...u}),updatedAt:(new Date).toISOString(),updatedBy:c}}}),reset:(s,u)=>e(e=>t.IS_ISOLATED_VENUE&&s!==t.VENUE_RID?e:{areas:{...e.areas,[s]:{...(0,n.venueClockArea)(s,{lat:e.areas[s]?.lat??null,lng:e.areas[s]?.lng??null}),updatedAt:(new Date).toISOString(),updatedBy:u}}}),setVisiting:t=>e(e=>({visiting:Object.fromEntries([...Object.entries(e.visiting).slice(-60),[t,!0]])}))}),{name:'covercharge-clock-area-v1',version:1,storage:(0,l.createJSONStorage)(()=>u.default)})),_=e=>t.IS_ISOLATED_VENUE&&e!==t.VENUE_RID?(0,E.cleanArea)(E.DEFAULT_CLOCK_AREA):(0,n.venueClockArea)(e,o.getState().areas[e]??{})},1219,[5,1074,1024,1008,1025,1160]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.inviteStatus=function(){return{'st-tracy':{state:'used',usedAt:s(3e3),devices:2},'st-gordon':{state:'used',usedAt:s(2940),devices:2},'st-bisto':{state:'used',usedAt:s(1800),devices:1},'st-agate':{state:'used',usedAt:s(1680),devices:1},'st-lenny':{state:'used',usedAt:s(1560),devices:1},'st-finn':{state:'unused',expiresAt:a(52),devices:0},'st-eilidh':{state:'used',usedAt:s(1200),devices:1},'st-emily':{state:'expired',devices:0},'st-lillie':{state:'used',usedAt:s(480),devices:1},'st-jack':{state:'unused',expiresAt:a(70),devices:0}}},e.reissueInvite=async function(t){const s='st-bisto'===t?'chef':['st-tracy','st-gordon','st-agate'].includes(t)?'owner':'staff';return{ok:!0,token:'DEMO-link-not-real-0000',expiresAt:a(72),app:s}},e.unlockCashUp=async function(s,a,n){const c=new Date(Date.now()+18e5).toISOString();'cashup'===s?t.useCashUp.setState(t=>({cashUps:t.cashUps.map(t=>t.id===a?{...t,unlockedUntil:c}:t)})):t.useCashUp.setState(t=>({sales:t.sales.map(t=>t.id===a?{...t,unlockedUntil:c}:t)}));return{ok:!0,until:c}},e.cashAudit=async function(t){return[{at:s(780),action:'unlocked',by:'Morgan',tbl:'cash_ups',reason:'Card total keyed as 1,284 not 1,248',changed:[]},{at:s(768),action:'changed',by:'Alex',tbl:'cash_ups',changed:['card']},{at:s(840),action:'created',by:'Alex',tbl:'cash_ups',changed:[]}]},e.pitchRpc=function(t,s){switch(t){case'list_displays':return n;case'create_display_code':case'new_code_for_display':return[{code:'DEMO7K2QX',expires_at:a(24*Number(s.p_hours?Number(s.p_hours)/24:7))}];default:return[]}};var t=r(d[0]);const s=t=>new Date(Date.now()-6e4*t).toISOString(),a=t=>new Date(Date.now()+36e5*t).toISOString();const n=[{id:'pd-1',label:'Front desk tablet',can_write:!0,created_at:s(17280),last_seen_at:s(2),revoked_at:null,sessions:1,open_codes:0},{id:'pd-2',label:'Kitchen pass tablet',can_write:!1,created_at:s(12960),last_seen_at:s(5),revoked_at:null,sessions:1,open_codes:0}]},1220,[983]); +__d(function(g,r,_i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TASK_MAX",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"cleanTaskText",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"appliesOn",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"tasksFor",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"tickKey",{enumerable:!0,get:function(){return u}}),e.progress=function(t,n,o,u,c){const s=i(t,c),f=new Set(n.filter(t=>t.staffRef===o&&t.forDate===u).map(t=>t.taskId));return{done:s.filter(t=>f.has(t.id)).length,total:s.length}},e.move=function(t,n,o){const i=n+o;if(n<0||i<0||n>=t.length||i>=t.length)return t;const u=[...t];return[u[n],u[i]]=[u[i],u[n]],u},Object.defineProperty(e,"hasTask",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"DEFAULT_LIBRARY",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"TASK_DAY_NAMES",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"isHeadChefP",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"isKitchenP",{enumerable:!0,get:function(){return d}}),e.canEditTasks=function(t,n){return!!t&&('owner'===t.role||'manager'===t.role||!!l(t)&&(t.id!==n.id&&'staff'===n.role&&!l(n)&&d(n)))};const t=80,n=n=>n.replace(/\s+/g,' ').trim().slice(0,t),o=(t,n)=>!t.days||0===t.days.length||t.days.includes(n),i=(t,n)=>t.filter(t=>o(t,n)),u=(t,n,o)=>`${t}|${n}|${o}`;const c=(t,o)=>t.some(t=>t.text.toLowerCase()===n(o).toLowerCase()),s=['Restock the bar fridges','Wipe down the menus','Check the toilets','Set the tables','Polish glasses','Empty the bins','Clean the coffee machine','Take out the recycling'],f=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],l=t=>'staff'===t.role&&('Head Chef'===t.level||/^head chef/i.test(t.job??'')),d=t=>'kitchen'===(t.dept??'').trim().toLowerCase()},1221,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useChatSync",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"chatSynced",{enumerable:!0,get:function(){return n}});const t=(0,r(d[0]).create)(()=>({synced:!1,checked:!1})),n=()=>t.getState().synced},1222,[1008]); +__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useKitchenExtra",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"isManagerish",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"isHeadChef",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"isKitchenStaff",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"kitchenByRule",{enumerable:!0,get:function(){return l}}),_e.inKitchen=b,_e.inChannel=function(e,t){return!!t&&(e.startsWith('dm:')?e.split(':').slice(1).includes(t.id):'all'===e||('kitchen'===e?b(t):'managers'===e?o(t):'foh'===e&&(o(t)||/front|bar|server|waiting/i.test(t.job))))},Object.defineProperty(_e,"dmId",{enumerable:!0,get:function(){return h}});var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},c=r(d[1]),a=r(d[2]);const u=(0,c.create)()((0,a.persist)(e=>({extra:{},set:(t,n)=>e(e=>{const c={...e.extra};return null==n?delete c[t]:c[t]=n,{extra:c}})}),{name:'covercharge-kitchen-chat-v1',version:1,storage:(0,a.createJSONStorage)(()=>n.default)})),o=e=>!!e&&'staff'!==e.role,s=e=>!!e&&/head chef/i.test((e.level??'')+' '+e.job),f=e=>!!e&&(/^kitchen$/i.test(e.dept??'')||/chef|kitchen|\bkp\b|porter/i.test(e.job)),l=e=>!!e&&(o(e)||s(e)||f(e));function b(e){if(!e||!e.active)return!1;return u.getState().extra[e.id]??l(e)}const h=(e,t)=>`dm:${[e,t].sort().join(':')}`},1223,[1024,1008,1025]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1224,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var u in n)Object.defineProperty(t,u,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,u).get})})(e,{get Badge(){return x.Badge},get DarkTheme(){return y.DarkTheme},get DefaultTheme(){return _.DefaultTheme},get ErrorBoundary(){return v.ErrorBoundary},get ExperimentalStack(){return U.ExperimentalStack},get ExpoRoot(){return c.ExpoRoot},get Icon(){return x.Icon},get IsWithinNativeNavigator(){return B.IsWithinNativeNavigator},get Label(){return x.Label},get LocaleProvider(){return I.LocaleProvider},get NativeStackView(){return E.NativeStackView},get NavigationAwareActivity(){return R.NavigationAwareActivity},get Navigator(){return t.Navigator},get RouterActionHandling(){return C.RouterActionHandling},get Sitemap(){return b.Sitemap},get Slot(){return t.Slot},get SplashScreen(){return S},get StackRouter(){return C.StackRouter},get SuspenseFallback(){return f.SuspenseFallback},get TabRouter(){return C.TabRouter},get Tabs(){return M.Tabs},get ThemeProvider(){return T.ThemeProvider},get Unmatched(){return l.Unmatched},get VectorIcon(){return x.VectorIcon},get attachRouteState(){return C.attachRouteState},get createBaseStackProps(){return j.createBaseStackProps},get createBaseTabProps(){return D.createBaseTabProps},get createNativeStackProps(){return W.createNativeStackProps},get createStandardRouterNavigator(){return B.createStandardRouterNavigator},get enableLegacyHeaderAppearance(){return F.enableLegacyHeaderAppearance},get extendRouter(){return C.extendRouter},get extendRouterActions(){return C.extendRouterActions},get integrateWithRouter(){return B.integrateWithRouter},get isActionHandled(){return C.isActionHandled},get router(){return u.router},get unstable_PerformanceObserver(){return G.unstable_PerformanceObserver},get unstable_createStandardRouterNavigator(){return B.unstable_createStandardRouterNavigator},get unstable_enablePerformanceIntegration(){return G.unstable_enablePerformanceIntegration},get unstable_integrateWithRouter(){return B.unstable_integrateWithRouter},get unstable_performance(){return G.unstable_performance},get unstable_useIsNavigating(){return o.useIsNavigating},get unstable_useReconcileTabHistory(){return H.useReconcileTabHistory},get useCanGoBack(){return n.useCanGoBack},get useCurrentRouteInfo(){return n.useCurrentRouteInfo},get useFocusEffect(){return h.useFocusEffect},get useGlobalSearchParams(){return n.useGlobalSearchParams},get useIsFocused(){return N.useIsFocused},get useLoaderData(){return n.useLoaderData},get useLocalSearchParams(){return n.useLocalSearchParams},get useNavigation(){return P.useNavigation},get useNavigationContainerRef(){return n.useNavigationContainerRef},get usePathname(){return n.usePathname},get usePreventRemove(){return L.usePreventRemove},get useRootNavigation(){return n.useRootNavigation},get useRootNavigationState(){return n.useRootNavigationState},get useRoute(){return A.useRoute},get useRoutePath(){return O.useRoutePath},get useRouter(){return n.useRouter},get useScrollToTop(){return w.useScrollToTop},get useSegments(){return n.useSegments},get useSitemap(){return p.useSitemap},get useTheme(){return k.useTheme},get useUnstableGlobalHref(){return n.useUnstableGlobalHref},get withLayoutContext(){return s.withLayoutContext}});const t=r(d[0]),n=r(d[1]),u=r(d[2]),o=r(d[3]),s=r(d[4]),c=r(d[5]),l=r(d[6]),b=r(d[7]),p=r(d[8]),v=r(d[9]),f=r(d[10]),R=r(d[11]),S=q(r(d[12])),P=r(d[13]),h=r(d[14]),N=r(d[15]),y=r(d[16]),_=r(d[17]),T=r(d[18]),k=r(d[19]),I=r(d[20]),O=r(d[21]),w=r(d[22]),A=r(d[23]),L=r(d[24]),x=r(d[25]),B=r(d[26]),H=r(d[27]),j=r(d[28]),D=r(d[29]),W=r(d[30]),C=r(d[31]),E=r(d[32]),F=r(d[33]),G=r(d[34]),M=r(d[35]),U=r(d[36]);function V(t){if("function"!=typeof WeakMap)return null;var n=new WeakMap,u=new WeakMap;return(V=function(t){return t?u:n})(t)}function q(t,n){if(!n&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var u=V(n);if(u&&u.has(t))return u.get(t);var o={__proto__:null},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var c in t)if("default"!==c&&Object.prototype.hasOwnProperty.call(t,c)){var l=s?Object.getOwnPropertyDescriptor(t,c):null;l&&(l.get||l.set)?Object.defineProperty(o,c,l):o[c]=t[c]}return o.default=t,u&&u.set(t,o),o}},1225,[694,419,512,1226,712,32,766,757,760,1227,664,662,667,533,537,542,481,483,447,448,1228,488,489,478,476,524,711,657,725,1229,724,358,703,708,378,1230,1233]); +__d(function(g,r,i,a,m,e,d){"use strict";function n(){const t=r(d[0]);return n=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"useIsNavigating",{enumerable:!0,get:function(){return u}});const t=r(d[1]);function u(){return(0,n().use)(t.NavigationPendingContext)}},1226,[30,375]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const o=r(d[0]);return t=function(){return o},o}function o(){const t=r(d[1]);return o=function(){return t},t}function n(){const t=r(d[2]);return n=function(){return t},t}function l(){const t=r(d[3]);return l=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"ErrorBoundary",{enumerable:!0,get:function(){return f}});r(d[4]);const s=r(d[5]),c=r(d[6]),u=r(d[7]);function h({error:o}){return(0,t().jsxs)(n().View,{style:{marginBottom:12,gap:4,flexWrap:'wrap'},children:[(0,t().jsx)(n().Text,{role:"heading","aria-level":1,style:y.title,children:"Something went wrong"}),(0,t().jsxs)(n().Text,{testID:"router_error_message",role:"heading","aria-level":2,style:y.errorMessage,children:["Error: ",o.message]})]})}function f({error:f,retry:x}){const w=(0,o().use)(s.BottomTabBarHeightContext)?n().View:l().SafeAreaView,S=f instanceof c.ReactServerError;return(0,t().jsx)(n().View,{style:y.container,children:(0,t().jsxs)(w,{style:{flex:1,gap:8,maxWidth:720,marginHorizontal:'auto'},children:[S?(0,t().jsx)(b,{error:f}):(0,t().jsx)(h,{error:f}),(0,t().jsx)(n().View,{style:{flex:1}}),!1,(0,t().jsx)(u.Pressable,{testID:"router_error_retry",onPress:x,children:({hovered:o,pressed:l})=>(0,t().jsx)(n().View,{style:[y.buttonInner,(o||l)&&{backgroundColor:'white'}],children:(0,t().jsx)(n().Text,{style:[y.buttonText,{color:o||l?'black':'white'}],children:"Retry"})})})]})})}const x={404:'NOT_FOUND',500:'INTERNAL_SERVER_ERROR',503:'SERVICE_UNAVAILABLE',504:'GATEWAY_TIMEOUT'};function b({error:o}){let l=String(o.statusCode);l+=': '+(x[o.statusCode]??'Server Error');const s=o.headers.get('cf-ray'),c=o.headers.get('Date');return(0,t().jsxs)(n().View,{style:{padding:12,gap:8},children:[(0,t().jsx)(n().Text,{selectable:!0,allowFontScaling:!0,style:{fontSize:n().Platform.select({web:24,default:16}),fontWeight:'bold',marginBottom:4,color:'white'},children:l}),(0,t().jsx)(n().ScrollView,{style:{borderColor:'rgba(255,255,255,0.5)',borderTopWidth:n().StyleSheet.hairlineWidth,borderBottomWidth:n().StyleSheet.hairlineWidth,maxHeight:150},contentContainerStyle:{paddingVertical:4},children:(0,t().jsx)(n().Text,{testID:"router_error_message",selectable:!0,allowFontScaling:!0,style:{color:'white'},children:o.message})}),(0,t().jsx)(w,{title:"Code",right:o.statusCode}),s&&(0,t().jsx)(w,{title:"ID",right:s}),c&&(0,t().jsx)(w,{title:"Date",right:c}),o.url&&(0,t().jsx)(n().Text,{selectable:!0,allowFontScaling:!0,style:{fontSize:14,opacity:.5,color:'white'},children:o.url})]})}function w({title:o,right:l}){const s={fontSize:16,color:'white'};return(0,t().jsxs)(n().View,{style:{flexDirection:'row',justifyContent:'space-between'},children:[(0,t().jsx)(n().Text,{selectable:!0,allowFontScaling:!0,style:s,children:o}),l&&(0,t().jsx)(n().Text,{selectable:!0,allowFontScaling:!0,style:[s,y.code],children:l})]})}const y=n().StyleSheet.create({container:{flex:1,backgroundColor:'black',padding:24,alignItems:'stretch',justifyContent:'center'},title:{color:'white',fontSize:n().Platform.select({web:32,default:24}),fontWeight:'bold'},buttonText:{fontSize:18,fontWeight:'bold',color:'black',...n().Platform.select({web:{transitionDuration:'100ms'}})},buttonInner:{...n().Platform.select({web:{transitionDuration:'100ms'}}),paddingVertical:12,paddingHorizontal:24,borderColor:'white',borderWidth:2,marginLeft:8,justifyContent:'center',alignItems:'center'},code:{fontFamily:n().Platform.select({default:'Courier',ios:'Courier New',android:'monospace'}),fontWeight:'500'},errorMessage:{color:'white',fontSize:16},subtitle:{color:'white',fontSize:14,marginBottom:12},link:{color:'rgba(255,255,255,0.4)',textDecorationStyle:'solid',textDecorationLine:'underline',fontSize:14,textAlign:'center'}})},1227,[24,30,33,289,508,545,666,759]); +__d(function(g,r,i,a,m,e,d){"use strict";function n(){const t=r(d[0]);return n=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"LocaleProvider",{enumerable:!0,get:function(){return o}});const t=r(d[1]);function o({direction:o,children:c}){return(0,n().jsx)(t.LocaleDirContext.Provider,{value:o,children:c})}},1228,[24,429]); +__d(function(g,r,i,a,m,e,d){"use strict";function t({dispatch:t,isPreloaded:o,isRemovalPrevented:n,state:s}){return{isPreloaded:o,isRemovalPrevented:n,routeNames:s.routeNames,preload:o=>t({type:'PRELOAD',payload:{name:o}})}}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"createBaseTabProps",{enumerable:!0,get:function(){return t}})},1229,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),(function(t,o){for(var n in o)Object.defineProperty(t,n,{enumerable:!0,get:Object.getOwnPropertyDescriptor(o,n).get})})(e,{get BottomTabBar(){return n.BottomTabBar},get BottomTabBarHeightCallbackContext(){return n.BottomTabBarHeightCallbackContext},get BottomTabBarHeightContext(){return n.BottomTabBarHeightContext},get BottomTabView(){return n.BottomTabView},get SceneStyleInterpolators(){return u},get Tabs(){return n.default},get TransitionPresets(){return c},get TransitionSpecs(){return f},get createJSTabsProps(){return n.createJSTabsProps},get createStandardBottomTabNavigator(){return n.createStandardBottomTabNavigator},get default(){return s},get useBottomTabBarHeight(){return n.useBottomTabBarHeight}});const t=r(d[0]),o=r(d[1]),n=b(r(d[2])),u=b(r(d[3])),c=b(r(d[4])),f=b(r(d[5]));function l(t){if("function"!=typeof WeakMap)return null;var o=new WeakMap,n=new WeakMap;return(l=function(t){return t?n:o})(t)}function b(t,o){if(!o&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var n=l(o);if(n&&n.has(t))return n.get(t);var u={__proto__:null},c=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var f in t)if("default"!==f&&Object.prototype.hasOwnProperty.call(t,f)){var b=c?Object.getOwnPropertyDescriptor(t,f):null;b&&(b.get||b.set)?Object.defineProperty(u,f,b):u[f]=t[f]}return u.default=t,n&&n.set(t,u),u}n.default.Screen=o.Screen,n.default.Protected=t.Protected;const s=n.default},1230,[718,719,1231,546,547,548]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}function n(){const t=r(d[1]);return n=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get createJSTabsProps(){return h},get default(){return y}});const o=r(d[2]),s=r(d[3]),c=r(d[4]),u=r(d[5]),p=r(d[6]),f=r(d[7]);var l,b;function h(t){const{dispatch:n,state:o}=t;return{...(0,f.createBaseTabProps)(t),popNestedStackToTop:t=>{const s=o.routes.find(n=>n.key===t)?.state;s?.key&&n({...c.StackActions.popToTop(),target:s.key})}}}l=r(d[8]),b=e,Object.keys(l).forEach(function(t){"default"===t||Object.prototype.hasOwnProperty.call(b,t)||Object.defineProperty(b,t,{enumerable:!0,get:function(){return l[t]}})});const y=(0,u.integrateWithRouter)(s.createStandardBottomTabNavigator,c.TabRouter,{activityDefaultThreshold:1,processDescriptors:p.appendMissingPlaceholderTabDescriptors,processState:p.appendMissingPlaceholderTabRoutes,createProps:h,processScreens:s=>s.map(s=>{if('function'!=typeof s.options&&void 0!==s.options?.href){const{href:c,...u}=s.options;if(u.tabBarButton)throw new Error('Cannot use `href` and `tabBarButton` together.');return null===c?{...s,options:{...u,hidden:!0}}:{...s,options:{...u,tabBarButton:s=>{const u='web'===n().Platform.OS?s.children:(0,t().jsx)(n().Pressable,{children:s.children});return(0,t().jsx)(o.Link,{...s,style:[{display:'flex'},s.style],href:c,asChild:'web'!==n().Platform.OS,children:u})}}}}return s})})},1231,[24,33,508,652,427,711,1232,1229,545]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(t,n,o){const s=n.routeNames.filter(t=>!n.routes.some(n=>n.name===t));if(0===s.length)return t;const u=s.reduce((t,n)=>(t[n]=o({key:void 0,name:n}),t),{});return{...t,...u}}function n(t,n){if(!t.routeNames.some(n=>!t.routes.some(t=>t.name===n)))return t;const s=t.routes[t.index]?.key,u=t.routeNames.map(s=>{const u=t.routes.find(t=>t.name===s);return u||o(s,n)}),c=Math.max(0,u.findIndex(t=>t.key===s));return{...t,index:c,routes:u}}function o(t,n){const o=n[t];if(!o)throw new Error(`Could not find a descriptor for route "${t}". This is most likely a bug in expo-router. Please report it at https://github.com/expo/expo/issues.`);return{...o.route,key:t,name:t}}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get appendMissingPlaceholderTabDescriptors(){return t},get appendMissingPlaceholderTabRoutes(){return n}})},1232,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var u in n)Object.defineProperty(t,u,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,u).get})})(e,{get ExperimentalStack(){return c},get default(){return o}});const n=u(r(d[1]));function u(t){return t&&t.__esModule?t:{default:t}}const c=Object.assign(u=>(0,t().jsx)(n.default,{...u}),{Screen:n.default.Screen,Protected:n.default.Protected}),o=c},1233,[24,1234]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),(function(t,u){for(var n in u)Object.defineProperty(t,n,{enumerable:!0,get:Object.getOwnPropertyDescriptor(u,n).get})})(e,{get Stack(){return t.default},get default(){return l}});const t=c(r(d[0])),u=r(d[1]),n=r(d[2]);function c(t){return t&&t.__esModule?t:{default:t}}t.default.Screen=u.StackScreen,t.default.Header=u.StackHeader,t.default.Title=u.StackTitle,t.default.Toolbar=n.StackToolbar;const l=t.default},1234,[695,728,733]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t.default}});const t=o((n=r(d[0]),u=e,Object.keys(n).forEach(function(t){"default"===t||Object.prototype.hasOwnProperty.call(u,t)||Object.defineProperty(u,t,{enumerable:!0,get:function(){return n[t]}})}),n));var n,u;function o(t){return t&&t.__esModule?t:{default:t}}},1235,[1234]); +__d(function(g,r,i,a,m,e,d){"use strict";var t,n;Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get useIsPreview(){return s.useIsPreview},get usePreventZoomTransitionDismissal(){return o.usePreventZoomTransitionDismissal}}),t=r(d[0]),n=e,Object.keys(t).forEach(function(o){"default"===o||Object.prototype.hasOwnProperty.call(n,o)||Object.defineProperty(n,o,{enumerable:!0,get:function(){return t[o]}})});const o=r(d[1]),s=r(d[2])},1236,[508,1237,421]); +__d(function(g,r,i,a,m,e,d){"use strict";function n(n){}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"usePreventZoomTransitionDismissal",{enumerable:!0,get:function(){return n}})},1237,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"Color",{enumerable:!0,get:function(){return y}});r(d[0]);function t(t,n){return Object.keys(t).forEach(function(u){"default"===u||Object.prototype.hasOwnProperty.call(n,u)||Object.defineProperty(n,u,{enumerable:!0,get:function(){return t[u]}})}),t}t(r(d[1]),e),t(r(d[2]),e),t(r(d[3]),e),t(r(d[4]),e),t(r(d[5]),e);const n=new Proxy({},{get:(t,n)=>null}),u=new Proxy({},{get:(t,n)=>null}),o=new Proxy({},{get:(t,n)=>null}),l=new Proxy({},{get:(t,n)=>null}),c=new Proxy({get attr(){return u},get material(){return o},get dynamic(){return l}},{get:(t,n)=>n in t?t[n]:null}),y={get ios(){return n},get android(){return c}}},1238,[1239,1240,1241,1242,1243,1244]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(t){return null}function n(t){return null}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get Material3Color(){return n},get Material3DynamicColor(){return t}})},1239,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1240,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1241,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1242,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1243,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1244,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"LIVE_HEAD_CHEF",{enumerable:!0,get:function(){return o}});var t=r(d[0]),n=r(d[1]),c=r(d[2]),_=r(d[3]);const o='chef'===t.APP_VARIANT&&(0,c.isAnchorage)(_.VENUE_RID)&&!n.PITCH},1245,[806,2,1125,5]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.useLiveState=function(){const e=(0,s.useSync)(e=>e.mode),n=(0,s.useSync)(e=>e.venueId),o=(0,s.useSync)(e=>e.lastSyncAt);return l.PITCH||n&&o?'ready':'signin'===e||'local'===e||'off'===e||'unpaired'===e?'nolink':'offline'===e?'offline':'connecting'},_e.LiveWait=function({state:n,title:o,testID:s}){const l='nolink'===n&&'display'===e.APP_VARIANT?h:p[n];return(0,f.jsxs)(t.default,{testID:s,accessible:!0,accessibilityLabel:`${o}: ${l}`,style:{borderRadius:16,borderWidth:1,borderColor:c.colours.border,backgroundColor:c.colours.surface,padding:14,gap:4},children:[(0,f.jsx)(u.T,{size:12,weight:"semibold",colour:c.colours.goldMuted,children:o.toUpperCase()}),(0,f.jsx)(u.T,{size:18,weight:"semibold",children:l})]})};var e=r(d[0]);r(d[1]);var n,o=r(d[2]),t=(n=o)&&n.__esModule?n:{default:n},s=r(d[3]),l=r(d[4]),c=r(d[5]),u=r(d[6]),f=r(d[7]);const p={connecting:'Connecting\u2026',offline:'No connection. The live numbers show again when this phone is back online.',nolink:'Not connected to the venue. Open your personal link from your manager on this phone to see live numbers.'},h="This Display isn't paired yet. Tap Not paired to pair it."},1246,[806,30,127,820,2,821,813,24]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"QUEUED_BRAND",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"QUEUED_PALETTE",{enumerable:!0,get:function(){return l}});var t=r(d[0]),n=r(d[1]);const c=n.queuedVenues[t.VENUE_RID]?.branding,l={bg:c?.ink,surface:'#222222',surface2:'#292929',border:'#686868',gold:c?.accent,goldLight:c?.smallTextAccent,goldMuted:c?.smallTextAccent,onGold:c?.onAccent,goldTint:'#292929',tile:'#222222',tilePressed:'#292929',ok:c?.smallTextAccent,okBg:'#292929',blue:c?.smallTextAccent,blueBg:'#292929'}},1247,[5,6]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ABBOTSFORD_BRAND_ACCENT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"ABBOTSFORD_PALETTE",{enumerable:!0,get:function(){return n}});const t='#B89362',n={bg:'#32373C',surface:'#2A2F34',surface2:'#252A2F',tile:'#2A2F34',tilePressed:'#3D4349',border:'#777C81',gold:'#E5D08D',goldLight:'#F0DEA4',goldTint:'#3C372B',goldMuted:'#E5D08D',accentBg:'rgba(184,147,98,0.13)',accentBorder:'rgba(229,208,141,0.65)',onGold:'#0B0B0B',text:'#F8F4EA',muted:'#D7D1C7',ok:'#E5D08D',okBg:'#3C372B',blue:'#E5D08D',blueBg:'#3C372B'}},1248,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"KIRKTON_PALETTE",{enumerable:!0,get:function(){return t}});const t={bg:'#0B0B0B',surface:'#111111',surface2:'#141414',border:'#65554F',gold:'#B46C54',goldLight:'#D4A18E',goldTint:'#241A16',goldMuted:'#C99A86',tile:'#111111',tilePressed:'#141414',accentBg:'rgba(180,108,84,0.13)',accentBorder:'rgba(180,108,84,0.55)',onGold:'#0B0B0B',ok:'#D4A18E',okBg:'#241A16',blue:'#D4A18E',blueBg:'#241A16'}},1249,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"space",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"type",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"LINE",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"LINE_TIGHT",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"MIN_LINE",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"lineFor",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"radii",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"control",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"caps",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"layout",{enumerable:!0,get:function(){return y}});const t={xxs:2,xs:4,s:8,m:12,l:16,xl:24,xxl:32},n={micro:11,caption:12,small:14,body:16,large:18,title:22,hero:30,display:40},u=1.4,o=1.25,c=1.2,l=(t,n=u)=>Math.ceil(t*Math.max(n,c)),b={xs:4,s:8,m:12,button:14,l:16,xl:20,pill:999},f={min:48,tall:52,hero:56},p={letterSpacing:1.6},y={contentMax:640,headerSide:96}},1250,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.webLine=function(e,t){const u=n.default.flatten(e)||{},f='number'==typeof u.fontSize?u.fontSize:t,l='number'==typeof u.lineHeight?u.lineHeight:(0,o.lineFor)(f);return{lineHeight:String(Math.max(l/f,o.MIN_LINE))}},r(d[0]);var e,t=r(d[1]),n=(e=t)&&e.__esModule?e:{default:e},o=r(d[2])},1251,[122,46,1250]); +__d(function(g,_r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"localRepositories",{enumerable:!0,get:function(){return s}});var e=_r(d[0]);const a=()=>e.useStore.getState(),t=e=>Promise.resolve(e),s={customers:{update:async e=>a().updateCustomer(e),setAllergy:async(e,t)=>a().setAllergy(e,t)},menu:{updateItem:async(e,t)=>a().updateMenuItem(e,t),setSignOff:async(e,t)=>a().setSignOff(e,t)},orders:{placeFromBasket:e=>t(a().placeOrder(e)),accept:async(e,t,s)=>a().acceptOrder(e,t,s),setStatus:async(e,t,s)=>a().setOrderStatus(e,t,s),acknowledgeAllergy:async(e,t)=>a().ackOrderAllergy(e,t),acknowledgeReadiness:async(e,t,s)=>a().ackReadiness(e,t,s),recordHandoverCheck:async(e,t)=>a().handoverCheck(e,t),signAllergyStep:async(e,t,s)=>a().signAllergyStep(e,t,s),customerSignal:async(e,t)=>a().customerSignal(e,t),setSplit:async(e,t,s)=>a().setSplit(e,t,s),payTable:async(e,t)=>a().payTable(e,t)},bookings:{create:e=>t(a().createBooking(e)),setStatus:async(e,t)=>a().setBookingStatus(e,t),decide:async(e,t,s)=>a().decideBooking(e,t,s),acknowledgeAllergy:async(e,t)=>a().ackBookingAllergy(e,t),seatWalkIn:(e,s,n,c)=>t(a().seatWalkIn(e,s,n,c)),assignTable:async(e,t)=>a().setBookingTable(e,t),undoWalkIn:async e=>a().undoWalkIn(e),update:async(e,t)=>a().updateBooking(e,t)},waitlist:{join:(e,s,n,c)=>t(a().joinWaitlist(e,s,n,c)),setStatus:async(e,t)=>a().setWaitlistStatus(e,t),addWalkIn:async(e,t)=>a().addWalkIn(e,t)},loyalty:{addStamp:async(e,t,s)=>a().addStamp(e,t,s),redeemReward:async(e,t)=>a().redeemReward(e,t)},giftCards:{purchase:(e,s,n,c)=>t(a().buyGiftCard(e,s,n,c))},calendar:{addEvent:async e=>a().addEvent(e)},feedback:{add:async e=>a().addRating(e)},restaurants:{updateSettings:async(e,t)=>a().updateSettings(e,t)},alerts:{acknowledge:async(e,t)=>a().ackAlert(e,t)}}},1252,[870]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/owner-app/assets/assets/brand/3idiots.df4a76d2130f0e5b0042f06a8c88693a.png",width:1024,height:1024,toString(){return this.uri}}},1253,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/owner-app/assets/assets/brand/cecchinis.ebf752fef363247848ae7c0d91938765.png",width:1024,height:1024,toString(){return this.uri}}},1254,[]); +__d(function(s,t,i,r,e,n,a){"use strict";e.exports={uri:"/wildings/owner-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png",width:1024,height:1024,toString(){return this.uri}}},1255,[]); +__d(function(s,t,i,n,r,e,a){"use strict";r.exports={uri:"/wildings/owner-app/assets/assets/brand/yasmins.8482602e9f0a965655924835625cb02b.png",width:1024,height:1024,toString(){return this.uri}}},1256,[]); +__d(function(s,t,i,a,e,r,n){"use strict";e.exports={uri:"/wildings/owner-app/assets/assets/brand/williewastles.055a77893ced99bf3a6c5402ba5baac6.png",width:1024,height:1024,toString(){return this.uri}}},1257,[]); +__d(function(e,t,r,s,i,n,d){"use strict";i.exports={uri:"/wildings/owner-app/assets/assets/brand/rupeeroom.689e6fb536dc0845eeb174a1ec7bd346.png",width:1024,height:1024,toString(){return this.uri}}},1258,[]); +__d(function(t,s,i,a,n,r,e){"use strict";n.exports={uri:"/wildings/owner-app/assets/assets/brand/smokinggoat.20a3a1970596ab43c5d6468d4ed549a7.png",width:1024,height:1024,toString(){return this.uri}}},1259,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/owner-app/assets/assets/brand/pizzaioli.db8c000b62ee407121aa8b90ce45e170.png",width:1024,height:1024,toString(){return this.uri}}},1260,[]); +__d(function(t,s,e,i,n,r,a){"use strict";n.exports={uri:"/wildings/owner-app/assets/assets/brand/drunkencoo.f6d92af3b14e4205a3deaf4434754c51.png",width:1024,height:1024,toString(){return this.uri}}},1261,[]); +__d(function(t,s,i,r,a,e,n){"use strict";a.exports={uri:"/wildings/owner-app/assets/assets/brand/abbotsford.b26602bba5ce4969733c5422a45ad053.png",width:1024,height:1024,toString(){return this.uri}}},1262,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/owner-app/assets/assets/brand/kirkton.bcf8d846df4861474d224a7a77f498fb.png",width:1024,height:1024,toString(){return this.uri}}},1263,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/owner-app/assets/assets/brand/greenside.9d1556db97dcb903a3c57e2063ee2255.png",width:1024,height:1024,toString(){return this.uri}}},1264,[]); +__d(function(i,s,t,n,r,d,e){"use strict";r.exports={uri:"/wildings/owner-app/assets/assets/brand/wildings.076f4fcd06d19a0af0205c410f461b14.png",width:1024,height:1024,toString(){return this.uri}}},1265,[]); +__d(function(i,t,s,e,r,n,a){"use strict";r.exports={uri:"/wildings/owner-app/assets/assets/brand/kirkmichael.63b13cde7fd82eb622622b39ac80c394.png",width:1024,height:1024,toString(){return this.uri}}},1266,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/owner-app/assets/assets/brand/souters.f4c58d9349b6e1700fe5abcc9e9b665c.png",width:1024,height:1024,toString(){return this.uri}}},1267,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/owner-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png",width:512,height:512,toString(){return this.uri}}},1268,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/owner-app/assets/assets/brand/saltmarsh.85a6a65732635e5148478d743d9ca884.png",width:512,height:512,toString(){return this.uri}}},1269,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/owner-app/assets/assets/brand/brae.8de9e89ac30966c6669de990370d8e40.png",width:512,height:512,toString(){return this.uri}}},1270,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/owner-app/assets/assets/brand/3idiots-hero.e5dfd53739f05086b1956e72d585a66a.png",width:1024,height:1024,toString(){return this.uri}}},1271,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/owner-app/assets/assets/brand/cecchinis-hero.f77780fcc94fd668cf35d66d6dc52d81.png",width:1024,height:1024,toString(){return this.uri}}},1272,[]); +__d(function(s,r,t,i,e,n,a){"use strict";e.exports={uri:"/wildings/owner-app/assets/assets/brand/mrbasrais-hero.4ce74641cfcf52d099157c84005b9d2a.png",width:1024,height:1024,toString(){return this.uri}}},1273,[]); +__d(function(s,e,t,i,r,a,n){"use strict";r.exports={uri:"/wildings/owner-app/assets/assets/brand/yasmins-hero.a5aef62e37dfcecbe0afc056186f4ad9.png",width:1024,height:1024,toString(){return this.uri}}},1274,[]); +__d(function(s,t,i,e,r,n,a){"use strict";r.exports={uri:"/wildings/owner-app/assets/assets/brand/williewastles-hero.b9d53d27b66f903b5618a7177b2ffad4.png",width:1024,height:1024,toString(){return this.uri}}},1275,[]); +__d(function(r,t,a,s,e,i,n){"use strict";e.exports={uri:"/wildings/owner-app/assets/assets/brand/rupeeroom-hero.969fa372add526aaacf3a6c009b8ac92.png",width:1024,height:1024,toString(){return this.uri}}},1276,[]); +__d(function(t,s,e,i,r,n,d){"use strict";r.exports={uri:"/wildings/owner-app/assets/assets/brand/smokinggoat-hero.0588f17ef0eed7f757f22916cd4d37db.png",width:1600,height:900,toString(){return this.uri}}},1277,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/owner-app/assets/assets/brand/pizzaioli-hero.1896657c08264cefb49b401891d5448d.png",width:1024,height:1024,toString(){return this.uri}}},1278,[]); +__d(function(t,r,s,e,i,n,c){"use strict";i.exports={uri:"/wildings/owner-app/assets/assets/brand/drunkencoo-hero.65c21c4da9e466cf4bffc969639a1427.png",width:1600,height:900,toString(){return this.uri}}},1279,[]); +__d(function(t,e,s,r,i,n,o){"use strict";i.exports={uri:"/wildings/owner-app/assets/assets/brand/abbotsford-hero.78fcb8ee06ee22c4ca659c9254db7512.png",width:1024,height:1024,toString(){return this.uri}}},1280,[]); +__d(function(t,i,r,s,n,e,d){"use strict";n.exports={uri:"/wildings/owner-app/assets/assets/brand/kirkton-hero.9d0837b292c2f4f30f4521d806bb28c3.png",width:1024,height:1024,toString(){return this.uri}}},1281,[]); +__d(function(e,s,t,i,r,n,c){"use strict";r.exports={uri:"/wildings/owner-app/assets/assets/brand/greenside-hero.1caec5a6cb939434cccb5f3a613b50f8.png",width:1024,height:1024,toString(){return this.uri}}},1282,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/owner-app/assets/assets/brand/wildings-hero-logo-text.4661e4b935726f2511f9c17a1567c89a.png",width:1024,height:1024,toString(){return this.uri}}},1283,[]); +__d(function(i,t,e,r,s,n,a){"use strict";s.exports={uri:"/wildings/owner-app/assets/assets/brand/kirkmichael-hero.63b13cde7fd82eb622622b39ac80c394.png",width:1024,height:1024,toString(){return this.uri}}},1284,[]); +__d(function(t,r,s,e,i,n,a){"use strict";i.exports={uri:"/wildings/owner-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png",width:1024,height:1024,toString(){return this.uri}}},1285,[]); +__d(function(_g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.getFix=function(e=1e4){const t='undefined'!=typeof navigator?navigator.geolocation:void 0;return t?new Promise(o=>{let n=!1;const c=e=>{n||(n=!0,o(e))},u=setTimeout(()=>c('timeout'),e+1500);try{t.getCurrentPosition(e=>{clearTimeout(u),c({lat:e.coords.latitude,lng:e.coords.longitude,acc:e.coords.accuracy??999})},e=>{clearTimeout(u),c(1===e.code?'denied':3===e.code?'timeout':'unavailable')},{enableHighAccuracy:!0,timeout:e,maximumAge:0})}catch{clearTimeout(u),c('unsupported')}}):Promise.resolve('unsupported')},_e.locationAllowed=async function(){try{const e=await(navigator.permissions?.query({name:'geolocation'}));return'granted'===e?.state}catch{return!1}}},1286,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"VAPID_PUBLIC_KEY",{enumerable:!0,get:function(){return t}});const t='BC3MoXpycbFY4Nf3czfBMaiD0iaMd1ugc70iUWZUiaScERZibFBsI9cmPAiNrlPN0b2_wJR-wgutj4eC8suarQ0'},1287,[]); +__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.payFor=u,_e.useVenuePay=function(s){const r=(0,n.useRestaurant)(s),o=(0,t.useOnboard)(e=>e.answers);return(0,e.useMemo)(()=>u(s,r?.settings.pay,o),[s,r?.settings.pay,o])},_e.venueRange=function(e,n,t,s){const u='wage'===n?(0,r.wagePeriod)(e,(0,r.ymdOf)(s),t):(0,r.tipsPeriod)(e,(0,r.ymdOf)(s),t),o=(0,r.dateOf)(u.start);o.setHours(0,0,0,0);const y=(0,r.dateOf)(u.end);return y.setHours(0,0,0,0),{s:o,e:y,key:u.key,payday:u.payday}};var e=_r(d[0]),n=_r(d[1]),t=_r(d[2]),s=_r(d[3]),r=_r(d[4]);function u(e,n,t){if(n)return{pay:(0,r.cleanPay)(n),source:'settings'};const u=t[e]?.pay??s.SEEDED_ANSWERS[e]?.pay;return u?{pay:(0,r.cleanPay)(u),source:'questionnaire'}:{pay:r.FALLBACK_PAY,source:'none'}}},1288,[30,1019,1020,1021,1023]); +__d(function(e,a,n,s,o,r,t){o.exports={version:1,venueId:"greenside",source:"from-config",submittedAt:"2026-11-06",venue:{name:"The Greenside Restaurant",tagline:"Restaurant \u2022 Wood Fired Pizza \u2022 Maybole",address:"5 Greenside, Maybole, South Ayrshire KA19 7DG",phone:"01655 889685",email:"info@thegreensiderestaurant.co.uk",website:"https://thegreensiderestaurant.co.uk/",hasLogo:!0,emailNeedsConfirmation:!0},hours:{days:{0:["10:00","00:00"],1:null,2:null,3:["10:00","23:00"],4:["10:00","23:00"],5:["10:00","00:00"],6:["10:00","00:00"]},note:"Closed Monday and Tuesday. Venue Wednesday and Thursday 10:00\u201323:00, Friday to Sunday 10:00\u201300:00. Kitchen Wednesday, Thursday and Sunday 10:00\u201320:00; Friday and Saturday 10:00\u201321:00. Cash only."},tables:{template:"restaurant",tables:null,covers:null,areas:["Restaurant","Beer garden"],needsConfirmation:!0,note:"Historical figure about 50 covers inside and about 48 in seasonal beer garden (former GM LinkedIn). Names, tables and covers need Gordon's confirmation. Bar and restaurant only \u2014 no accommodation."},team:[],suppliers:[],accounts:[],features:{bookings:!0,takeaway:!1,orderAtTable:!1,tips:!0,rota:!0,games:!0,specials:!0},notes:"Separate greenside tenant. No staff, invites or table plan yet. Cash only; no card payments or deposits. CoverCharge manager-confirmed table requests only, with Call01655 889685 as backup. Menu, allergens, public email, pay settings and deposit policy need confirmation. No external booking or ordering links."}},1289,[]); +__d(function(e,o,a,t,r,n,s){r.exports={version:1,venueId:"abbotsford",source:"from-config",submittedAt:"2026-11-06",venue:{name:"The Abbotsford Hotel",tagline:"Get Hungry. Get Curious.",address:"14 Corsehill Road, Ayr KA7 2ST",phone:"01292 261506",email:"info@abbotsfordhotel.co.uk",website:"https://www.abbotsfordhotel.co.uk/",hasLogo:!0},hours:{days:{0:["10:00","20:30"],1:["10:00","20:30"],2:["10:00","20:30"],3:["10:00","20:30"],4:["10:00","20:30"],5:["10:00","20:30"],6:["10:00","20:30"]},note:"Daily 10:00\u201320:30 \u2014 to confirm with the hotel. Copper Bar hours to confirm."},tables:{template:"restaurant",tables:null,covers:null,areas:[],needsConfirmation:!0,note:"Rowan seats up to 120 (published). Restaurant and bar covers/tables unknown."},team:[],suppliers:[],accounts:[{provider:"facebook",handle:"TheAbbotsfordHotel"},{provider:"instagram",handle:"@abbotsfordhotelayr"},{provider:"tiktok",handle:"@the.abbotsford.hotel.ayr"}],features:{bookings:!0,takeaway:!1,orderAtTable:!1,tips:!0,rota:!0,games:!0,specials:!0},notes:"Separate abbotsford tenant. Epicurious restaurant and The Copper Bar. CoverCharge dining and room requests require manager confirmation. No external booking links, no room inventory module or external booking integrations. Zero staff/invites/sample data. Deposit, manager, team, table plan/covers, Copper Bar hours, dog policy and allergens to confirm."}},1290,[]); +__d(function(e,n,t,a,o,r,i){o.exports={version:1,venueId:"kirkton",source:"from-config",submittedAt:"2026-11-06",venue:{name:"The Kirkton Inn",tagline:"Bar and restaurant in Dalrymple, Ayrshire \u2014 Burns country hospitality",address:"1-3 Main Street, Dalrymple, East Ayrshire KA6 6DF",phone:"",email:"",website:"",hasLogo:!0},hours:{days:{0:null,1:null,2:null,3:null,4:null,5:null,6:null},note:"Current opening and kitchen hours to confirm. No service times set."},tables:{template:"restaurant",tables:null,covers:null,areas:[],needsConfirmation:!0,note:"Table plan and capacity to confirm."},team:[],suppliers:[],accounts:[],features:{bookings:!0,takeaway:!1,orderAtTable:!1,tips:!0,rota:!0,games:!0,specials:!0},notes:"Separate kirkton tenant. No staff or personal links. Room inventory and current letting to confirm; room functionality deferred. No external booking integrations. Phone, public email, website, current hours, capacity, table plan, takeaway, pay and deposit policy to confirm. Archived 2019 menus are provisional and not saleable stock."}},1291,[]); +__d(function(e,o,r,s,a,t,n){a.exports={version:1,venueId:"souters",source:"from-config",submittedAt:"2026-11-05",onboardedAt:"2026-11-05",venue:{name:"Souter's Inn",tagline:"Culinary excellence meets country hospitality in Kirkoswald",address:"47 Main Road, Kirkoswald, South Ayrshire KA19 8HY",phone:"01655 760653",email:"souters@southernayr.com",website:"https://www.soutersinn.com/",hasLogo:!0},hours:{days:{0:["09:00","21:00"],1:["09:00","21:00"],2:["09:00","21:00"],3:["09:00","21:00"],4:["09:00","21:00"],5:["09:00","21:00"],6:["09:00","21:00"]},note:"Open daily 9am\u20139pm. Breakfast 9\u201311.45am; main food service from noon. Confirm last orders with the venue."},tables:{template:"restaurant",tables:0,covers:130,areas:[]},team:[],suppliers:[{name:"Pollok Williamson Butchers",category:"Meat",phone:"",email:""}],accounts:[{provider:"instagram",handle:"@soutersinn"},{provider:"facebook",handle:"Souter's Inn"},{provider:"gmail",handle:"souters@southernayr.com"},{provider:"tripadvisor",handle:"Souter's Inn Kirkoswald"},{provider:"google-business",handle:"Souter's Inn"}],features:{bookings:!0,takeaway:!0,orderAtTable:!1,tips:!0,rota:!0,games:!0,specials:!0},notes:"Part of Southern Ayr Limited (Brian Daly). Sister venues: Abbotsford Hotel, The Brig, Bridges Bar, Wellingtons. Bookings: guests request a table in CoverCharge. Deposit default suggested \xa310pp from party of 6 \u2014 confirm with venue (published \xa310pp for some events). Regional Scottish Thistle Award Best Eating Experience 2026. Brand accent from official logo SVG fill #A4622E. Real table plan, manager contact, team, priced menu and deposit confirmation still required; no tables or staff seeded."}},1292,[]); +__d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.pickPhotos=function(t={}){const a=t.source??'camera';return'undefined'==typeof document?n(a):new Promise(t=>{const n=document.createElement('input');n.type='file',n.accept='image/*',n.multiple=!0,'camera'===a&&n.setAttribute('capture','environment'),n.setAttribute('data-testid','camera'===a?'photo-input':'gallery-input'),n.style.display='none',n.onchange=async()=>{const a=Array.from(n.files??[]).slice(0,8),o=[];for(const t of a)try{o.push(await r(t))}catch{}n.remove(),t(o)},document.body.appendChild(n),n.click()})},e.shrink=r,e.uploadPhoto=async function(n,r,o,c){const i=a.useSync.getState();if('staff'!==i.kind||!i.venueId)return null;try{const a=await(await fetch(o)).blob(),s=`${i.venueId}/${n}/${r}-${Date.now()}-${c}.jpg`,{error:u}=await(0,t.getSupabase)().storage.from('cashup-photos').upload(s,a,{contentType:'image/jpeg',upsert:!1});return u?null:s}catch{return null}},e.photoUrl=async function(a){if(a.startsWith('data:'))return a;try{const{data:n}=await(0,t.getSupabase)().storage.from('cashup-photos').createSignedUrl(a,600);return n?.signedUrl??null}catch{return null}},_r(d[0]);var t=_r(d[1]),a=_r(d[2]);async function n(t){try{const a=_r(d[3],"expo-image-picker"),n={mediaTypes:['images'],quality:.7,base64:!0,allowsMultipleSelection:'gallery'===t,selectionLimit:8};if('camera'===t){if(!(await a.requestCameraPermissionsAsync()).granted)return[]}const r='camera'===t?await a.launchCameraAsync(n):await a.launchImageLibraryAsync(n);return r.canceled?[]:r.assets.filter(t=>t.base64).map(t=>`data:image/jpeg;base64,${t.base64}`)}catch{return[]}}function r(t,a=1600){return new Promise((n,r)=>{const o=URL.createObjectURL(t),c=new Image;c.onload=()=>{const t=Math.min(1,a/Math.max(c.width,c.height)),r=document.createElement('canvas');r.width=Math.round(c.width*t),r.height=Math.round(c.height*t),r.getContext('2d').drawImage(c,0,0,r.width,r.height),URL.revokeObjectURL(o),n(r.toDataURL('image/jpeg',.78))},c.onerror=()=>{URL.revokeObjectURL(o),r(new Error('not an image'))},c.src=o})}},1293,[122,862,820,1006]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return c}});var t=r(d[0]),n=r(d[1]),s=r(d[2]);const o={images:'image/*',videos:'video/mp4,video/quicktime,video/x-m4v,video/*',livePhotos:''};var c={launchImageLibraryAsync:async({mediaTypes:t=['images'],allowsMultipleSelection:n=!1,base64:s=!1})=>'undefined'==typeof window||'undefined'==typeof document?{canceled:!0,assets:null}:await u({mediaTypes:t,allowsMultipleSelection:n,base64:s}),launchCameraAsync:async({mediaTypes:t=['images'],allowsMultipleSelection:n=!1,base64:s=!1,cameraType:o})=>'undefined'==typeof window||'undefined'==typeof document?{canceled:!0,assets:null}:await u({mediaTypes:t,allowsMultipleSelection:n,capture:o??!0,base64:s}),getCameraPermissionsAsync:async()=>l(),requestCameraPermissionsAsync:async()=>l(),getMediaLibraryPermissionsAsync:async t=>l(),requestMediaLibraryPermissionsAsync:async t=>l()};function l(){return{status:t.PermissionStatus.GRANTED,expires:'never',granted:!0,canAskAgain:!0}}function u({mediaTypes:t,capture:o=!1,allowsMultipleSelection:c=!1,base64:l}){const u=w((0,s.parseMediaTypes)(t)),p=document.createElement('input');if(p.style.display='none',p.setAttribute('type','file'),p.setAttribute('accept',u),p.setAttribute('id',String(Math.random())),p.setAttribute('data-testid','file-input'),c&&p.setAttribute('multiple','multiple'),o)switch(o){case!0:p.setAttribute('capture','camera');break;case n.CameraType.front:p.setAttribute('capture','user');break;case n.CameraType.back:p.setAttribute('capture','environment')}return document.body.appendChild(p),new Promise(t=>{p.addEventListener('change',async()=>{if(p.files?.length){const n=c?p.files:[p.files[0]];try{const s=await Promise.all(Array.from(n).filter(t=>null!=t).map(t=>f(t,{base64:l})));t({canceled:!1,assets:s})}catch(n){t(Promise.reject(n))}}else t({canceled:!0,assets:null});document.body.removeChild(p)}),p.addEventListener('cancel',()=>{p.dispatchEvent(new Event('change'))});const n=new MouseEvent('click');p.dispatchEvent(n)})}async function p(t){return new Promise(n=>{const s=new Image;s.onload=()=>{n({width:s.naturalWidth??s.width,height:s.naturalHeight??s.height})},s.onerror=()=>n({width:0,height:0}),s.src=t})}async function y(t){return new Promise(n=>{const s=document.createElement('video');s.preload='metadata',s.onloadedmetadata=()=>{n({width:s.videoWidth,height:s.videoHeight,duration:s.duration})},s.onerror=()=>n({width:0,height:0,duration:0}),s.src=t})}async function h(t){return new Promise((n,s)=>{const o=new FileReader;o.onerror=()=>{s(new Error('Failed to read the selected media because the operation failed.'))},o.onload=t=>{const o=t.target?.result;'string'==typeof o?n(o.split(',')?.[1]??''):s(new Error('Failed to read file as base64'))},o.readAsDataURL(t)})}async function f(t,n){const s=t.type,o=URL.createObjectURL(t);let c,l;if(s.startsWith('image/'))c=await p(o);else{if(!s.startsWith('video/'))throw new Error(`Unsupported file type: ${s}. Only images and videos are supported.`);c=await y(o)}return n.base64&&(l=await h(t)),{uri:o,width:c.width,height:c.height,type:s.startsWith('image/')?'image':'video',mimeType:s,fileName:t.name,fileSize:t.size,file:t,...void 0!==c.duration&&{duration:c.duration},...l&&{base64:l}}}function w(t){const n=t.filter(t=>'livePhotos'!==t);if(0===n.length)return'image/*';let s='';for(const t of n)s.includes(o[t])||(s=s.concat(',',o[t]));return s}},1294,[570,1295,1296]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"MediaTypeOptions",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"VideoExportPreset",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"UIImagePickerControllerQualityType",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"UIImagePickerPresentationStyle",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"UIImagePickerPreferredAssetRepresentationMode",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"CameraType",{enumerable:!0,get:function(){return l}});let t=(function(t){return t.All="All",t.Videos="Videos",t.Images="Images",t})({}),n=(function(t){return t[t.Passthrough=0]="Passthrough",t[t.LowQuality=1]="LowQuality",t[t.MediumQuality=2]="MediumQuality",t[t.HighestQuality=3]="HighestQuality",t[t.H264_640x480=4]="H264_640x480",t[t.H264_960x540=5]="H264_960x540",t[t.H264_1280x720=6]="H264_1280x720",t[t.H264_1920x1080=7]="H264_1920x1080",t[t.H264_3840x2160=8]="H264_3840x2160",t[t.HEVC_1920x1080=9]="HEVC_1920x1080",t[t.HEVC_3840x2160=10]="HEVC_3840x2160",t})({}),u=(function(t){return t[t.High=0]="High",t[t.Medium=1]="Medium",t[t.Low=2]="Low",t[t.VGA640x480=3]="VGA640x480",t[t.IFrame1280x720=4]="IFrame1280x720",t[t.IFrame960x540=5]="IFrame960x540",t})({}),o=(function(t){return t.FULL_SCREEN="fullScreen",t.PAGE_SHEET="pageSheet",t.FORM_SHEET="formSheet",t.CURRENT_CONTEXT="currentContext",t.OVER_FULL_SCREEN="overFullScreen",t.OVER_CURRENT_CONTEXT="overCurrentContext",t.POPOVER="popover",t.AUTOMATIC="automatic",t})({}),c=(function(t){return t.Automatic="automatic",t.Compatible="compatible",t.Current="current",t})({}),l=(function(t){return t.back="back",t.front="front",t})({})},1295,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.parseMediaTypes=p,e.mapDeprecatedOptions=function(s){if(!s.mediaTypes)return s;return{...s,mediaTypes:p(s.mediaTypes??[])}};var s=r(d[0]);function p(p){const n={Images:['images'],Videos:['videos'],All:['images','videos']};return p===s.MediaTypeOptions.Images||p===s.MediaTypeOptions.Videos||p===s.MediaTypeOptions.All?(console.warn('[expo-image-picker] `ImagePicker.MediaTypeOptions` have been deprecated. Use `ImagePicker.MediaType` or an array of `ImagePicker.MediaType` instead.'),n[p]):'string'==typeof p?[p]:p}},1296,[1295]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.readSheet=async function(l,u,c){const f=u.filter(t=>!t.startsWith('data:'));try{const u=n.useSync.getState();if('staff'!==u.kind||!u.venueId||!f.length)return{vals:o(c),reader:null,note:s};const{data:h,error:y}=await(0,t.getSupabase)().functions.invoke('cashup-read',{body:{kind:l,venueId:u.venueId,paths:f,fields:c.filter(t=>'text'!==t.kind).map(t=>({key:t.key,label:t.label,kind:t.kind}))}});if(y||!h||'object'!=typeof h||!h.vals)return{vals:o(c),reader:null,note:s};const p=o(c);for(const t of c){const n=h.vals[t.key];'number'==typeof n&&Number.isFinite(n)&&(p[t.key]=Math.round(100*n)/100)}const v=Object.values(p).filter(t=>null!=t).length;return v?{vals:p,categories:Array.isArray(h.categories)?h.categories:[],reader:String(h.reader??'photo reader'),note:`${v} figure${1===v?'':'s'} read from the photo. Check each one against the photo before you confirm.`}:{vals:p,reader:null,note:'The photo couldn\u2019t be read clearly, so type the figures from it.'}}catch{return{vals:o(c),reader:null,note:s}}};var t=r(d[0]),n=r(d[1]);const o=t=>Object.fromEntries(t.map(t=>[t.key,null])),s='Automatic reading isn\u2019t switched on yet, so type the figures from the photo. Nothing is filled in for you.'},1297,[862,820]); +__d(function(g,_r,_i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.pickSpreadsheet=function(){return'undefined'==typeof document?Promise.resolve({error:'Upload a spreadsheet from the Managers app in a web browser.'}):new Promise(e=>{const s=document.createElement('input');s.type='file',s.accept='.csv,.xlsx,text/csv,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',s.setAttribute('data-testid','sheet-input'),s.style.display='none',s.onchange=async()=>{const t=s.files?.[0];if(s.remove(),!t)return e(null);if(t.size>5242880)return e({error:'That file is over 5 MB. Export just the takings columns and try again.'});try{const s=/\.xlsx$/i.test(t.name)?await(0,c.readXlsx)(await t.arrayBuffer()):(0,r.parseCsv)(await t.text());e(s.length?{name:t.name,rows:s}:{error:'The file looks empty.'})}catch(s){e({error:s instanceof Error?s.message:'The file couldn\u2019t be read. Try saving it as CSV.'})}},document.body.appendChild(s),s.click()})},_e.SpreadsheetImport=function({rid:e,file:t,who:c,onClose:v,onSaved:w,locked:x}){const[y,$]=(0,s.useState)(!0),b=y?t.rows[0]:t.rows[0].map((e,s)=>`Column ${s+1}`),[j,k]=(0,s.useState)(()=>(0,r.guessMapping)(t.rows[0])),[C,T]=(0,s.useState)(!1),[D,S]=(0,s.useState)('map'),B=(0,n.useCashUp)(e=>e.cashUps),I=(0,s.useMemo)(()=>new Set(B.filter(s=>s.rid===e&&s.confirmedAt&&null!=(0,i.grossOf)(s.vals)).map(e=>e.date)),[B,e]),M=(0,s.useMemo)(()=>(0,r.buildPreview)(t.rows,j,y,I),[t.rows,j,y,I]),P=M.filter(e=>e.ok&&!(e.date&&x(e.date))),R=P.filter(e=>'saved'!==e.dup||C),z=P.filter(e=>'saved'===e.dup).length,L=M.filter(e=>!e.ok).length,U=M.filter(e=>e.ok&&e.date&&x(e.date)).length,E=null!=j.date&&null!=j.gross;return(0,u.jsxs)(l.Sheet,{visible:!0,onClose:v,title:"Upload a spreadsheet",maxWidth:1e3,testID:"sheet-import",children:[(0,u.jsx)(l.Muted,{children:`${t.name} \xb7 ${t.rows.length-(y?1:0)} row${t.rows.length-(y?1:0)==1?'':'s'}`}),'map'===D?(0,u.jsxs)(o.default,{style:{gap:10},testID:"sheet-map",children:[(0,u.jsx)(l.T,{size:17,weight:"semibold",children:"1. Which column is which?"}),(0,u.jsx)(l.Muted,{children:"Tip: Date and Gross takings are needed. Food, drink, card and cash are optional. Leave a column as \u201cNot in the file\u201d if you don\u2019t have it."}),(0,u.jsx)(l.Toggle,{testID:"sheet-header",label:"The first row is headings",value:y,onChange:$}),r.COLS.map(e=>(0,u.jsxs)(o.default,{style:{gap:4},testID:`sheet-col-${e.key}`,children:[(0,u.jsxs)(l.Row,{gap:6,children:[(0,u.jsx)(l.T,{weight:"semibold",children:e.label}),e.required?(0,u.jsx)(l.Badge,{kind:"gold",label:"NEEDED"}):(0,u.jsx)(l.Muted,{children:"optional"})]}),(0,u.jsxs)(l.Row,{wrap:!0,gap:6,children:[e.required?null:(0,u.jsx)(l.Chip,{label:"Not in the file",selected:null==j[e.key],onPress:()=>k({...j,[e.key]:void 0})}),b.map((s,o)=>(0,u.jsx)(l.Chip,{testID:`sheet-col-${e.key}-${o}`,label:s||`Column ${o+1}`,sub:y?void 0:t.rows[0][o],selected:j[e.key]===o,onPress:()=>{const s={...j};Object.keys(s).forEach(e=>{s[e]===o&&delete s[e]}),s[e.key]=o,k(s)}},o))]})]},e.key)),(0,u.jsx)(l.Button,{testID:"sheet-to-preview",label:"Preview",disabled:!E,onPress:()=>{S('preview'),f(`${M.filter(e=>e.ok).length} rows ready, ${L} with problems.`)}})]}):null,'preview'===D?(0,u.jsxs)(o.default,{style:{gap:10},testID:"sheet-preview",children:[(0,u.jsx)(l.T,{size:17,weight:"semibold",children:"2. Check the preview"}),(0,u.jsx)(o.default,{accessibilityLiveRegion:"polite",children:(0,u.jsx)(l.T,{testID:"sheet-summary",children:`${P.length} night${1===P.length?'':'s'} ready${L?` \xb7 ${L} row${1===L?'':'s'} with a problem (not saved)`:''}${U?` \xb7 ${U} signed off and locked (not changed)`:''}`})}),z?(0,u.jsx)(l.Banner,{kind:"warn",title:`${z} date${1===z?' already has':'s already have'} takings in CoverCharge`,children:(0,u.jsxs)(o.default,{style:{gap:6},children:[(0,u.jsx)(l.Toggle,{testID:"sheet-replace",label:"Replace those nights\u2019 takings with the spreadsheet",value:C,onChange:T}),(0,u.jsx)(l.Muted,{children:C?'Those nights will be replaced (the change is logged).':'Those nights are skipped; their saved takings are kept.'})]})}):null,M.slice(0,62).map(e=>{const s=e.ok&&'saved'===e.dup&&!C,t=e.ok&&!!e.date&&x(e.date),n=e.ok?t?'Locked: not changed':s?'Already saved: skipped':'saved'===e.dup?'Replaces saved takings':'Ready':e.errors.join('; ');return(0,u.jsxs)(o.default,{testID:`sheet-row-${e.line}`,accessible:!0,accessibilityLabel:`Row ${e.line}: ${e.date?m(e.date):'no date'}, gross ${p(e.vals.gross)}. ${n}`,style:{paddingVertical:8,gap:2,borderBottomWidth:1,borderBottomColor:h.colours.hairline,opacity:!e.ok||s||t?.75:1},children:[(0,u.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(l.T,{size:15,weight:"semibold",children:`Row ${e.line} \xb7 ${e.date?m(e.date):'no date'}`}),(0,u.jsx)(l.T,{size:15,weight:"semibold",colour:h.colours.goldLight,children:p(e.vals.gross)})]}),(()=>{const s=['food','drink','card','cash'].filter(s=>null!=j[s]&&null!=e.vals[s]).map(s=>`${s[0].toUpperCase()}${s.slice(1)} ${p(e.vals[s])}`);return s.length?(0,u.jsx)(l.T,{size:13,colour:h.colours.text,children:s.join(' \xb7 ')}):null})(),(0,u.jsx)(l.T,{size:13,colour:e.ok?h.colours.muted:h.colours.amber,children:n})]},e.line)}),M.length>62?(0,u.jsx)(l.Muted,{children:`\u2026and ${M.length-62} more rows.`}):null,(0,u.jsxs)(o.default,{style:{gap:8},children:[(0,u.jsx)(l.Button,{testID:"sheet-to-confirm",label:`Next: save ${R.length} night${1===R.length?'':'s'}`,disabled:!R.length,onPress:()=>S('confirm')}),(0,u.jsx)(l.Button,{kind:"secondary",label:"Change columns",onPress:()=>S('map')})]})]}):null,'confirm'===D?(0,u.jsxs)(o.default,{style:{gap:10},testID:"sheet-confirm",children:[(0,u.jsx)(l.T,{size:17,weight:"semibold",children:"3. Confirm"}),(0,u.jsxs)(o.default,{style:{borderWidth:1.5,borderColor:h.colours.gold,borderRadius:14,padding:12,gap:4,backgroundColor:h.colours.goldTint},accessibilityLiveRegion:"polite",children:[(0,u.jsx)(l.T,{size:18,weight:"semibold",colour:h.colours.gold,children:`Save takings for ${R.length} night${1===R.length?'':'s'}`}),(0,u.jsx)(l.T,{children:R.length?`${m(R.map(e=>e.date).sort()[0])} to ${m(R.map(e=>e.date).sort().slice(-1)[0])} \xb7 gross ${p(Math.round(100*R.reduce((e,s)=>e+(s.vals.gross??0),0))/100)} in total`:''}),(0,u.jsx)(l.Muted,{children:`Saved as confirmed by ${c.name}. Each night is logged. ${C&&z?`${z} saved night${1===z?' is':'s are'} replaced.`:z?`${z} already-saved night${1===z?' is':'s are'} skipped.`:''}`})]}),(0,u.jsx)(l.Button,{testID:"sheet-save",label:"Confirm and save",onPress:()=>{const s=(new Date).toISOString(),o=n.useCashUp.getState();for(const l of R){const n=o.cashUps.find(s=>s.rid===e&&s.date===l.date);o.saveCashUp({rid:e,date:l.date,vals:{...n?.vals??{},...(0,r.rowVals)(l)},photos:n?.photos??[],confirmedBy:c.name,confirmedAt:s,readBy:`spreadsheet: ${t.name}`.slice(0,80)})}const l=R.length,i=`Takings saved for ${l} night${1===l?'':'s'} from ${t.name}.`;f(i),w(i)}}),(0,u.jsx)(l.Button,{kind:"secondary",label:"Back to the preview",onPress:()=>S('preview')})]}):null]})};var s=_r(d[0]),t=e(_r(d[1]));_r(d[2]);var o=e(_r(d[3])),l=_r(d[4]),n=_r(d[5]),i=_r(d[6]),r=_r(d[7]),h=_r(d[8]),c=_r(d[9]),u=_r(d[10]);const p=e=>null==e?'\u2014':`\xa3${e.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`,m=e=>new Date(`${e}T12:00:00Z`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',year:'numeric',timeZone:'UTC'}),f=e=>{try{t.default.announceForAccessibility?.(e)}catch{}}},1298,[30,118,122,127,813,983,984,1299,821,1300,24]); +__d(function(g,_r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"COLS",{enumerable:!0,get:function(){return n}}),e.parseCsv=function(t){const n=t.replace(/^\uFEFF/,''),r=n.split(/\r?\n/,1)[0]??'',s=t=>r.split(t).length-1,a=[',',';','\t'].sort((t,n)=>s(n)-s(t))[0],o=[];let l=[],d='',i=!1;for(let t=0;tt.some(t=>''!==t.trim())).map(t=>t.map(t=>t.trim()))},e.guessMapping=function(t){const n={},s=new Set;for(const a of['date','food','drink','card','cash','gross']){const o=t.findIndex((t,n)=>!s.has(n)&&r[a].test(t)&&!('gross'===a&&/tips?/i.test(t))&&!('cash'===a&&/tips?|float/i.test(t)));o>=0&&(n[a]=o,s.add(o))}return n},e.parseDateCell=l,e.buildPreview=function(r,s,a,o){const d=a?r.slice(1):r,i=new Map,u=d.map((r,o)=>{const d=[],i=t=>null==s[t]?'':(r[s[t]]??'').trim(),u=null==s.date?null:l(i('date'));u||d.push(i('date')?`Date \u201c${i('date')}\u201d not understood`:'No date');const c={};for(const r of n){if('date'===r.key||null==s[r.key])continue;const n=i(r.key);if(!n){c[r.key]=null,r.required&&d.push(`No ${r.label.toLowerCase()}`);continue}const a=(0,t.parseAmount)(n.replace(/^\((.*)\)$/,'-$1'));null==a&&d.push(`${r.label} \u201c${n}\u201d not a \xa3 amount`),c[r.key]=a}return null==s.gross&&d.push('No gross column'),{line:o+(a?2:1),date:u,vals:c,errors:d,dup:null,ok:!1}});for(const t of u)t.date&&i.set(t.date,(i.get(t.date)??0)+1);for(const t of u)t.date&&(i.get(t.date)??0)>1?(t.dup='file',t.errors.push('This date is in the file more than once')):t.date&&o.has(t.date)&&(t.dup='saved'),t.ok=!t.errors.length;return u},e.rowVals=function(t){const n={};for(const r of['gross','food','drink','card','cash'])r in t.vals&&(n[r]=t.vals[r]??null);return n};var t=_r(_d[0]);const n=[{key:'date',label:'Date',required:!0},{key:'gross',label:'Gross takings',required:!0},{key:'food',label:'Food'},{key:'drink',label:'Drink'},{key:'card',label:'Card'},{key:'cash',label:'Cash'}];const r={date:/^(date|day|night|trading ?date|business ?date)\b/i,gross:/(gross|total ?takings|takings|total ?sales|sales ?total|turnover|^total$)/i,food:/\bfood\b|kitchen/i,drink:/\bdrinks?\b|\bbar\b|bev(erage)?s?|wet/i,card:/\bcard\b|pdq|debit|credit/i,cash:/\bcash\b/i};const s=['jan','feb','mar','apr','may','jun','jul','aug','sep','oct','nov','dec'],a=t=>String(t).padStart(2,'0'),o=(t,n,r)=>{const s=new Date(Date.UTC(t,n-1,r));return s.getUTCFullYear()===t&&s.getUTCMonth()===n-1&&s.getUTCDate()===r?`${t}-${a(n)}-${a(r)}`:null};function l(t){const n=t.trim();let r;if(r=n.match(/^(\d{4})-(\d{1,2})-(\d{1,2})(?:[ T].*)?$/))return o(+r[1],+r[2],+r[3]);if(r=n.match(/^(\d{1,2})[/.-](\d{1,2})[/.-](\d{2}|\d{4})(?: .*)?$/))return o(2===r[3].length?+r[3]+2e3:+r[3],+r[2],+r[1]);if(r=n.match(/^(?:[a-z]+,? )?(\d{1,2})(?:st|nd|rd|th)? ([a-z]{3})[a-z]*,? (\d{4})$/i)){const t=s.indexOf(r[2].toLowerCase());return t<0?null:o(+r[3],t+1,+r[1])}if(/^\d{5}(\.\d+)?$/.test(n)){const t=Math.floor(+n);if(t<36526||t>73050)return null;const r=new Date(Date.UTC(1899,11,30)+864e5*t);return o(r.getUTCFullYear(),r.getUTCMonth()+1,r.getUTCDate())}return null}},1299,[984]); +__d(function(g,_r,_i,a,_m,e,_d){"use strict";async function t(t){const r=globalThis.DecompressionStream;if(!r)throw new Error('This browser can\u2019t open .xlsx files. Save the sheet as CSV and upload that.');const n=new Blob([t]).stream().pipeThrough(new r('deflate-raw'));return new Uint8Array(await new Response(n).arrayBuffer())}async function r(r,n){const s=new Uint8Array(r),o=new DataView(r),i={};let c=-1;for(let t=s.length-22;t>=Math.max(0,s.length-66e3);t--)if(101010256===o.getUint32(t,!0)){c=t;break}if(c<0)throw new Error('This isn\u2019t a readable .xlsx file.');const l=o.getUint16(c+10,!0);let h=o.getUint32(c+16,!0);const f=new TextDecoder;for(let r=0;r'xl/sharedStrings.xml'===t||/^xl\/worksheets\/sheet\d+\.xml$/.test(t)),i=Object.keys(o).filter(t=>t.startsWith('xl/worksheets/')).sort()[0];if(!i)throw new Error('No worksheet found in this file.');const c=[...(o['xl/sharedStrings.xml']??'').matchAll(/([\s\S]*?)<\/si>/g)].map(t=>n([...t[1].matchAll(/]*>([\s\S]*?)<\/t>/g)].map(t=>t[1]).join(''))),l=[];for(const t of o[i].matchAll(/]*>([\s\S]*?)<\/row>/g)){const r=[];for(const o of t[1].matchAll(/]*?)(?:\/>|>([\s\S]*?)<\/c>)/g)){const t=o[1],i=o[2]??'',l=t.match(/r="([A-Z]+\d+)"/)?.[1],h=t.match(/t="(\w+)"/)?.[1],f=i.match(/([\s\S]*?)<\/v>/)?.[1],w=i.match(/]*>([\s\S]*?)<\/t>/)?.[1],m='s'===h?c[Number(f)]??'':n('inlineStr'===h?w??'':f??'');r[l?s(l):r.length]=m}l.push(Array.from(r,t=>(t??'').trim()))}return l.filter(t=>t.some(t=>''!==t))};const n=t=>t.replace(/</g,'<').replace(/>/g,'>').replace(/"/g,'"').replace(/'/g,"'").replace(/&#(\d+);/g,(t,r)=>String.fromCharCode(+r)).replace(/&/g,'&'),s=t=>{const r=t.replace(/\d+/g,'');let n=0;for(const t of r)n=26*n+(t.charCodeAt(0)-64);return n-1}},1300,[]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.useLockedFor=function(e){const n=(0,c.useCashUp)(e=>e.cashUps),s=(0,c.useCashUp)(e=>e.sales);return(0,o.useCallback)((o,l)=>{const i='cashup'===o?n.find(n=>n.rid===e&&n.date===l):s.find(n=>n.rid===e&&n.weekStart===l);return!!i&&(0,h.cashLocked)(t.PITCH&&i.confirmedAt?{...i,onServer:!0}:i)},[n,s,e])},Object.defineProperty(_e,"lockedMessage",{enumerable:!0,get:function(){return y}}),_e.auditLine=j,_e.CashLockControls=function({kind:e,item:s,label:c}){const y=(0,k.useSync)(e=>'staff'===e.kind&&!!e.venueId)||t.PITCH,b=(0,k.useSync)(e=>e.perms.includes('*')||e.perms.includes('roles.manage')),x=(0,u.useOwner)(e=>e.previewRole),C=b||t.PITCH&&'owner'===x,[$,w]=(0,o.useState)(!1),[I,S]=(0,o.useState)(''),[P,L]=(0,o.useState)(!1),[T,U]=(0,o.useState)(null);if(!y||!(s.onServer||t.PITCH&&s.confirmedAt))return null;const v=(0,h.cashLocked)(t.PITCH?{...s,onServer:!0}:s),H=async()=>{L(!0);const n=await(0,k.unlockCashUp)(e,s.id,I.trim());L(!1),n.ok?(w(!1),S(''),(0,f.notify)({id:'cash-unlock',icon:'\ud83d\udd11',title:`${c} unlocked for 30 minutes`,body:'Correct it now. It locks again by itself, and the change is logged with your name.',timeoutMs:8e3})):(0,f.notify)({id:'cash-unlock',tone:'warn',title:'Not unlocked',body:n.message,timeoutMs:8e3})};return(0,p.jsxs)(l.default,{testID:`cash-lock-${s.id}`,style:{gap:4},children:[(0,p.jsxs)(i.Row,{gap:6,wrap:!0,children:[v?(0,p.jsx)(i.Badge,{kind:"gold",label:"Signed off"}):(0,p.jsx)(i.Badge,{kind:"neutral",label:`Unlocked until ${new Date(s.unlockedUntil??'').toLocaleTimeString('en-GB',{timeZone:'Europe/London',hour:'2-digit',minute:'2-digit'})}`}),v&&C&&!$?(0,p.jsx)(i.Button,{small:!0,kind:"ghost",testID:`cash-unlock-${s.id}`,label:"Unlock to correct",onPress:()=>w(!0)}):null,(0,p.jsx)(i.Button,{small:!0,kind:"ghost",testID:`cash-history-${s.id}`,label:T?'Hide history \u25b4':'History \u25be',onPress:()=>{T?U(null):(0,k.readCashAudit)(s.id).then(U)}})]}),v&&!C?(0,p.jsx)(i.Muted,{size:12,children:"Only an owner can unlock it to make a correction."}):null,$?(0,p.jsxs)(l.default,{style:{gap:4},children:[(0,p.jsx)(n.TextInput,{testID:`cash-unlock-reason-${s.id}`,value:I,onChangeText:S,placeholder:"Why does it need changing?",placeholderTextColor:r.colours.muted,maxLength:200,style:{minHeight:36,borderRadius:8,borderWidth:1,borderColor:r.colours.hairline,color:r.colours.text,paddingHorizontal:8}}),(0,p.jsxs)(i.Row,{gap:6,children:[(0,p.jsx)(i.Button,{small:!0,testID:`cash-unlock-yes-${s.id}`,label:P?'Unlocking\u2026':'Unlock for 30 minutes',disabled:P||I.trim().length<3,onPress:()=>{H()}}),(0,p.jsx)(i.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>{w(!1),S('')}})]})]}):null,T?T.length?T.map((e,n)=>(0,p.jsx)(i.Muted,{size:12,children:j(e)},n)):(0,p.jsx)(i.Muted,{size:12,children:"No history yet."}):null]})};var e,n=_r(d[0]),t=_r(d[1]),o=_r(d[2]),s=_r(d[3]),l=(e=s)&&e.__esModule?e:{default:e},i=_r(d[4]),r=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]),k=_r(d[9]),f=_r(d[10]),p=_r(d[11]);const y=(e,n)=>`The ${'cashup'===e?'cash up':'weekly sales report'} for ${n} is signed off and locked. An owner can tap \u201cUnlock to correct\u201d on it.`,b={created:'signed off',changed:'changed',unlocked:'unlocked',deleted:'removed'},x=e=>new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'});function j(e){const n=e.changed.length&&'changed'===e.action?` (${e.changed.slice(0,6).join(', ')}${e.changed.length>6?'\u2026':''})`:'';return`${x(e.at)} \xb7 ${e.by} ${b[e.action]??e.action}${n}${e.reason?`: \u201c${e.reason}\u201d`:''}`}},1301,[874,2,30,127,813,821,983,854,984,820,1041,24]); +__d(function(_g,_r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.clockAction=async function(n,u){if((0,t.privateClockVenue)(u.rid)&&'in'!==n)return c(n,u,{action:n,at:u.at,inside:null,unchecked:!0});const f=(0,a.areaOf)(u.rid),k=f.on&&null!=f.lat&&null!=f.lng,l=k?await(u.fixFn??r.getFix)():'unavailable';if((0,t.privateClockVenue)(u.rid)&&'object'==typeof l&&(!Number.isFinite(l.acc)||l.acc>150))return{ok:!1,message:'Your phone\u2019s location is not accurate enough to confirm you are at the pub. Enable precise location, step near a window and try again, or ask a manager to record your clock-in with a reason.'};const g=k&&'object'!=typeof l?(0,s.locWhere)():'browser',p=(0,o.gate)(f,n,k?l:'unavailable',u.at,g);if(!p.allowed){const a='object'==typeof l?void 0:'app'===g&&'denied'===l?'settings':'app-phone-off'===g?'location':'app-old'===g&&'denied'===l?'update':void 0;return'update'===a&&(0,s.checkAppUpdate)(),{ok:!1,message:(p.message??'You need to be at the venue.')+((0,t.privateClockVenue)(u.rid)?' Ask a manager to record your clock-in with a reason using Record it for someone.':''),fix:a}}const w=c(n,u,p.geo);return w.ok&&p.warn?{...w,warn:p.warn}:w},e.managerClockAction=function(t,a,r,s){const u=(0,o.overrideGeo)(t,a.at,r,s);if(!u)return{ok:!1,message:'Type a short reason (at least 3 letters).'};const f=n.useOwner.getState().staff.find(t=>t.id===a.staffId)?.name??'staff',k=c(t,a,u,{adjusted:{by:r.name,at:a.at,reason:u.override.reason}});if(k.ok){const o={in:'clocked in',out:'clocked out',break_start:'started a break for',break_end:'ended a break for'}[t],s=`${r.name} ${o} ${f} (manager, no location check): ${u.override.reason}`;n.useOwner.setState(t=>({attLog:[{id:`al-${Date.now().toString(36)}`,at:a.at,text:s},...t.attLog]}))}return k};var t=_r(d[0]),a=_r(d[1]),n=_r(d[2]),o=_r(d[3]),r=_r(d[4]),s=_r(d[5]);function c(a,o,r,s={}){const c=(0,t.venueClockGeo)(o.rid,r),u=c?!1!==c.inside:void 0,f=n.useOwner.getState(),k=(0,n.openShiftOf)(f.attendance,o.staffId,o.at);if('in'===a){if(k)return{ok:!1,message:'You\u2019re already clocked in.'};f.clock(o.staffId,o.date,'in',o.at,u);const t=(0,n.openShiftOf)(n.useOwner.getState().attendance,o.staffId,o.at);return t&&n.useOwner.getState().patchAttendance(t.id,{...o.offRota?{offRota:!0}:{},...s},c),{ok:!0,att:t&&n.useOwner.getState().attendance.find(a=>a.id===t.id)}}if(!k)return{ok:!1,message:'You\u2019re not clocked in.'};if('out'===a){let t=o.breakMins;if(o.addedBreak&&o.addedBreak>0&&!k.breaks?.length){const a=new Date(o.at).getTime(),r=new Date(Math.max(new Date(k.in).getTime(),a-6e4*o.addedBreak)).toISOString();n.useOwner.getState().patchAttendance(k.id,{breaks:[{start:r,end:o.at}],breakAddedAtClockOut:o.addedBreak}),t=Math.round((a-new Date(r).getTime())/6e4)}return n.useOwner.getState().clock(o.staffId,o.date,'out',o.at,u,t),n.useOwner.getState().patchAttendance(k.id,s,c),{ok:!0,att:n.useOwner.getState().attendance.find(t=>t.id===k.id)}}return n.useOwner.getState().breakToggle(o.staffId,'break_start'===a?'start':'end',o.at)?(n.useOwner.getState().patchAttendance(k.id,s,c),{ok:!0,att:n.useOwner.getState().attendance.find(t=>t.id===k.id)}):{ok:!1,message:'break_start'===a?'You\u2019re already on a break.':'You\u2019re not on a break.'}}},1302,[1074,1219,854,1160,1286,1303]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"inPhoneApp",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"canOpenAppSettings",{enumerable:!0,get:function(){return c}}),e.openAppSettings=function(){try{t()?.openSettings?.()}catch{}},e.openLocationSettings=function(){try{t()?.openLocationSettings?.()}catch{}},e.appLocationPermission=function(){try{return t()?.locationPermission?.()??null}catch{return null}},e.phoneLocationOn=p,e.checkAppUpdate=function(){try{t()?.checkUpdate?.()}catch{}},e.locWhere=function(){if(!o()){const t=String(n()?.navigator?.userAgent??'');return/iPhone|iPad|iPod/.test(t)||/Macintosh/.test(t)&&(n()?.navigator?.maxTouchPoints??0)>1?'iphone':'browser'}return c()?p()?'app':'app-phone-off':'app-old'};const n=()=>'undefined'!=typeof window?window:void 0,t=()=>{const t=n()?.CoverChargeNative;return t&&'object'==typeof t?t:null},o=()=>/CoverChargePhone\//.test(String(n()?.navigator?.userAgent??'')),c=()=>'function'==typeof t()?.openSettings;function p(){try{const n=t()?.locationOn?.();return!1!==n}catch{return!0}}},1303,[]); +__d(function(g,r,_i,a,m,_e,d){"use strict";function t(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.SplitFlap=function({value:t,height:e=52,colour:o="#F5F1E8",min:i=2,sound:n,testID:u}){const s=String(Math.max(0,Math.round(t))).padStart(i,' '),h=Math.round(.68*e);return(0,c.jsx)(l.default,{testID:u,accessible:!0,accessibilityLabel:String(Math.max(0,Math.round(t))),style:{flexDirection:'row',gap:3},children:s.split('').map((t,i)=>(0,c.jsx)(x,{ch:' '===t?'':t,h:e,colour:o,size:h,sound:n&&i===s.length-1},s.length-i))})};var e=r(d[0]),o=t(r(d[1])),i=t(r(d[2])),n=t(r(d[3])),l=t(r(d[4])),u=r(d[5]),s=r(d[6]),c=r(d[7]);let h=!1;o.default.isReduceMotionEnabled?.().then(t=>{h=!!t}).catch(()=>{}),o.default.addEventListener?.('reduceMotionChanged',t=>{h=!!t});const f='#1B1A1D',p='#201F22';function b({ch:t,h:e,w:o,colour:n,part:u,size:h}){return(0,c.jsx)(l.default,{style:{height:e/2,width:o,overflow:'hidden',backgroundColor:'top'===u?p:f,borderTopLeftRadius:'top'===u?8:0,borderTopRightRadius:'top'===u?8:0,borderBottomLeftRadius:'bottom'===u?8:0,borderBottomRightRadius:'bottom'===u?8:0},children:(0,c.jsx)(i.default.Text,{allowFontScaling:!1,style:{position:'absolute',left:0,right:0,top:'top'===u?0:-e/2,height:e,lineHeight:e,textAlign:'center',fontSize:h,fontFamily:s.fonts.bold,color:n,includeFontPadding:!1},children:t})})}function x({ch:t,h:o,colour:s,size:f,sound:p}){const x=Math.round(.7*o),[j,v]=(0,e.useState)(t),[w,R]=(0,e.useState)(t),y=(0,e.useRef)(new i.default.Value(0)).current,M=(0,e.useRef)(new i.default.Value(1)).current,V=(0,e.useRef)(!0);(0,e.useEffect)(()=>{if(V.current)return V.current=!1,v(t),void R(t);if(t!==j){if(h)return R(t),void v(t);R(j),v(t),y.setValue(0),M.setValue(1),p&&(0,u.flapClick)(),i.default.sequence([i.default.timing(y,{toValue:1,duration:210,easing:n.default.in(n.default.quad),useNativeDriver:!0}),i.default.timing(M,{toValue:0,duration:210,easing:n.default.out(n.default.quad),useNativeDriver:!0})]).start(()=>R(t))}},[t]);const z=o/4,F=y.interpolate({inputRange:[0,1],outputRange:['0deg','-90deg']}),S=M.interpolate({inputRange:[0,1],outputRange:['0deg','90deg']}),D=w!==j;return(0,c.jsxs)(l.default,{style:{width:x,height:o},children:[(0,c.jsx)(b,{ch:j,h:o,w:x,colour:s,part:"top",size:f}),(0,c.jsx)(b,{ch:D?w:j,h:o,w:x,colour:s,part:"bottom",size:f}),D?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(i.default.View,{style:{position:'absolute',top:0,left:0,transform:[{perspective:400},{translateY:z},{rotateX:F},{translateY:-z}],backfaceVisibility:'hidden'},children:(0,c.jsx)(b,{ch:w,h:o,w:x,colour:s,part:"top",size:f})}),(0,c.jsx)(i.default.View,{style:{position:'absolute',top:o/2,left:0,transform:[{perspective:400},{translateY:-z},{rotateX:S},{translateY:z}],backfaceVisibility:'hidden'},children:(0,c.jsx)(b,{ch:j,h:o,w:x,colour:s,part:"bottom",size:f})})]}):null,(0,c.jsx)(l.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:o/2-.5,height:1,backgroundColor:'rgba(0,0,0,0.75)'}})]})}},1304,[30,118,120,224,127,1012,821,24]); +__d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DAY_BACK",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"DAY_AHEAD",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"DAY_IDLE_MS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"dayOffset",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"shiftDay",{enumerable:!0,get:function(){return h}}),_e.dayWord=p,Object.defineProperty(_e,"dayLong",{enumerable:!0,get:function(){return x}}),_e.bookingsForDay=D,_e.dayCovers=function(e,t,o){if(t>=o)return(0,s.coversToday)(e,t);const n=D(e,t,o),d=(c=n.filter(e=>(0,s.coverDone)(e)||'seated'===(0,s.shownStatus)(e)),c.reduce((e,t)=>e+t.partySize,0)),l=(0,s.coversToday)(e,t).total;var c;return{done:d,toCome:Math.max(0,l-d),total:l}},_e.DaySwitch=function({day:e,today:s,onDay:b,back:D=u,ahead:j=y,idPrefix:$="display-day",stacked:P=!1}){const T=f(e,s),v=t=>{const o=h(e,t);b(o===s?null:o)},w=h(e,-1),C=h(e,1),Y=0!==T,I=(e,o,s,d,u)=>(0,c.jsx)(t.default,{testID:u,accessibilityRole:"button",accessibilityLabel:o,accessibilityState:{disabled:d},disabled:d,onPress:s,style:({pressed:e})=>({minHeight:44,minWidth:P?0:92,flex:P?1:void 0,paddingHorizontal:P?6:12,borderRadius:12,alignItems:'center',justifyContent:'center',borderWidth:1,borderColor:l.colours.hairline,opacity:d?.35:1,backgroundColor:e?l.colours.tilePressed:'rgba(255,255,255,0.03)'}),children:(0,c.jsx)(n.T,{center:P,size:P?16:14,weight:"semibold",colour:l.colours.goldLight,numberOfLines:P?void 0:1,children:e})}),L=p(e,s);return P?(0,c.jsxs)(o.default,{testID:`${$}-switch`,style:{gap:10,padding:12,borderRadius:14,borderWidth:1,borderColor:Y?l.colours.gold:l.colours.hairline,backgroundColor:Y?l.colours.goldTint:l.colours.surface},children:[(0,c.jsxs)(o.default,{testID:`${$}-label`,accessible:!0,accessibilityRole:"header",accessibilityLabel:`Showing ${L}, ${x(e)}`,style:{gap:2,alignItems:'center'},children:[(0,c.jsx)(n.T,{center:!0,size:20,weight:"semibold",colour:l.colours.goldLight,children:L}),(0,c.jsx)(n.T,{center:!0,size:16,children:x(e)})]}),(0,c.jsxs)(o.default,{style:{flexDirection:'row',gap:8,justifyContent:'center'},children:[I('\u2039 Previous',`Previous day, ${x(w)}`,()=>v(-1),T<=-D,`${$}-prev`),I('Today','Back to today',()=>b(null),!1,'back-to-today'),I('Next \u203a',`Next day, ${x(C)}`,()=>v(1),T>=j,`${$}-next`)]})]}):(0,c.jsxs)(o.default,{testID:`${$}-switch`,style:{flexDirection:'row',alignItems:'center',gap:8},children:[I('\u2039 Previous',`Previous day, ${x(w)}`,()=>v(-1),T<=-D,`${$}-prev`),(0,c.jsxs)(t.default,{testID:`${$}-label`,accessibilityRole:Y?'button':'text',disabled:!Y,onPress:()=>b(null),accessibilityLabel:Y?`Showing ${L===(0,d.niceDate)((0,d.parseYmd)(e))?'':`${L}, `}${x(e)}. Back to today`:`Showing today, ${x(e)}`,style:({pressed:e})=>({flex:1,minWidth:0,minHeight:44,borderRadius:12,alignItems:'center',justifyContent:'center',paddingHorizontal:6,borderWidth:Y?1:0,borderColor:l.colours.gold,backgroundColor:e?l.colours.tilePressed:Y?l.colours.goldTint:'transparent'}),children:[(0,c.jsx)(n.T,{size:15,weight:"semibold",colour:Y?l.colours.gold:l.colours.text,numberOfLines:1,children:Y&&L!==(0,d.niceDate)((0,d.parseYmd)(e))?`${L} \xb7 ${(0,d.niceDate)((0,d.parseYmd)(e))}`:L}),Y?(0,c.jsx)(n.T,{size:11,colour:l.colours.muted,numberOfLines:1,children:"Tap for today"}):null]}),I('Next \u203a',`Next day, ${x(C)}`,()=>v(1),T>=j,`${$}-next`)]})},r(_d[0]);var t=e(r(_d[1])),o=e(r(_d[2])),n=r(_d[3]),s=r(_d[4]),d=r(_d[5]),l=r(_d[6]),c=r(_d[7]);const u=365,y=365,b=12e4,f=(e,t)=>Math.round(((0,d.parseYmd)(e).getTime()-(0,d.parseYmd)(t).getTime())/864e5),h=(e,t)=>(0,d.ymd)((0,d.addMins)((0,d.parseYmd)(e),1440*t+120));function p(e,t){const o=f(e,t);return 0===o?'Today':-1===o?'Yesterday':1===o?'Tomorrow':(0,d.niceDate)((0,d.parseYmd)(e))}const x=e=>(0,d.parseYmd)(e).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'});function D(e,t,o){return e.filter(e=>e.date===t&&(0,s.ACTIVE)(e))}},1305,[30,263,127,813,828,818,821,24]); +__d(function(_g,_r,i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.nextTablesFree=function(t,r,o,l,u=[]){const m=`${l.getFullYear()}-${String(l.getMonth()+1).padStart(2,'0')}-${String(l.getDate()).padStart(2,'0')}`,f=(0,a.lastFoodOn)(t,m),d=f?new Date(`${m}T${f.time}:00`):null,b=t=>o.filter(a=>a.date===m&&'confirmed'===a.status&&(a.table??'').split('+').map(t=>t.trim()).includes(t)).map(t=>new Date(`${t.date}T${t.time}:00`)).filter(t=>t>=s(l,-20)).sort((t,a)=>t.getTime()-a.getTime())[0],c=[],g=[];for(const o of Object.values(r)){const r=o.table.name,m=b(r);if('free'===o.status){(!m||m>s(l,60))&&c.push(r);continue}if(!n.includes(o.status)||!o.booking)continue;const f=o.booking,h=f.seatedAt?new Date(f.seatedAt):new Date(`${f.date}T${f.time}:00`),$=(0,a.dwellFor)(t,f.partySize,u);let w=s(h,$.mins),T='maybe',p=`seated ${Math.max(0,Math.round((l.getTime()-h.getTime())/6e4))} min, usual ${$.mins} min`;'bill'===o.status?(w=s(l,10),T='likely',p='bill requested'):'dessert'===o.status?(w=new Date(Math.min(w.getTime(),s(l,25).getTime())),T='likely',p='on dessert'):'mains'===o.status&&(w=new Date(Math.min(Math.max(w.getTime(),s(l,35).getTime()),s(l,60).getTime())),p='mains out'),w=d?{drinksOnly:!0}:{}})}g.sort((t,a)=>t.at.getTime()-a.at.getTime());const h=Object.values(r).filter(t=>'blocked'!==t.status).length,$=h>0&&c.length<=Math.max(1,Math.round(.1*h));return{full:$,freeNow:c,list:g,waitFor:t=>g.find(a=>a.seats>=t)??null}},Object.defineProperty(e,"hhmm",{enumerable:!0,get:function(){return r}}),e.nextFreeSentence=function(a,n){if(a.freeNow.length&&!a.full)return`There are ${a.freeNow.length} tables free now: ${a.freeNow.slice(0,4).map(t=>`table ${t}`).join(', ')}.`;const s=a.list[0];if(!s)return a.freeNow.length?`${(0,t.tableNumbers)(a.freeNow[0])} is free now.`:'No table is due to free up before the bookings that follow; check the bookings list.';const o=Math.max(5,Math.round((s.at.getTime()-n.getTime())/6e4)),l=a.waitFor(2),u=a.waitFor(4);return`Next table free about ${r(s.at)} (table ${s.table}, ${s.seats} seats), ${s.confidence}, in about ${o} minutes.${l?` A table for 2: about ${r(l.at)}.`:''}${u?` A table for 4: about ${r(u.at)}.`:''}${s.drinksOnly?' That\u2019s after last food orders, so drinks only.':''}`};var t=_r(_d[0]),a=_r(_d[1]);const n=['seated','mains','dessert','bill'],s=(t,a)=>new Date(t.getTime()+6e4*a);const r=t=>`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`},1306,[808,809]); +__d(function(_g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"MAX",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"TARGET",{enumerable:!0,get:function(){return t}}),_e.compressOnWeb=r,_e.capturePlatingPhoto=async function(e){{const n=await(t='camera'===e,new Promise(e=>{const n=document.createElement('input');n.type='file',n.accept='image/*',t&&n.setAttribute('capture','environment'),n.style.display='none',n.setAttribute('data-testid',t?'photo-input-camera':'photo-input-library'),n.onchange=()=>{const t=n.files?.[0]??null;n.remove(),e(t)},n.oncancel=()=>{n.remove(),e(null)},document.body.appendChild(n),n.click()}));if(!n)return null;return{...await r(n),originalBytes:n.size}}var t},Object.defineProperty(_e,"kb",{enumerable:!0,get:function(){return a}});!(function(e){if(e&&e.__esModule)return e;var t={};e&&Object.keys(e).forEach(function(n){if('default'!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e})(_r(_d[0]));_r(_d[1]);const e=1024,t=225280,n=e=>Math.round(3*(e.length-e.indexOf(',')-1)/4);async function r(r,a=e,o=t){const i='string'==typeof r?r:URL.createObjectURL(r);try{const e=await new Promise((e,t)=>{const n=new window.Image;n.onload=()=>e(n),n.onerror=()=>t(new Error('That file is not a photo we can read.')),n.src=i}),t=Math.min(1,a/Math.max(e.naturalWidth,e.naturalHeight)),r=Math.max(1,Math.round(e.naturalWidth*t)),c=Math.max(1,Math.round(e.naturalHeight*t)),u=document.createElement('canvas');u.width=r,u.height=c;const l=u.getContext('2d');l.fillStyle='#ffffff',l.fillRect(0,0,r,c),l.drawImage(e,0,0,r,c);let f=.8,s=u.toDataURL('image/jpeg',f);for(;n(s)>o&&f>.4;)f-=.1,s=u.toDataURL('image/jpeg',f);return{dataUrl:s,width:r,height:c,bytes:n(s)}}finally{'string'!=typeof r&&URL.revokeObjectURL(i)}}const a=e=>`${Math.max(1,Math.round(e/1024))} KB`},1307,[1006,122]); +__d(function(_g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useLogoCache",{enumerable:!0,get:function(){return s}}),_e.squareLogo=async function(e,t=256){const n=await new Promise((t,n)=>{const o=new window.Image;o.onload=()=>t(o),o.onerror=()=>n(new Error('That file is not a picture we can read.')),o.src=e}),o=Math.min(n.naturalWidth,n.naturalHeight),i=(n.naturalWidth-o)/2,s=(n.naturalHeight-o)/2,c=document.createElement('canvas');c.width=t,c.height=t;const u=c.getContext('2d');return u.fillStyle='#ffffff',u.fillRect(0,0,t,t),u.drawImage(n,i,s,o,o,0,0,t,t),c.toDataURL('image/jpeg',.85)};var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},o=r(d[1]),i=r(d[2]);const s=(0,o.create)()((0,i.persist)(e=>({byList:{},put:(t,n)=>e(e=>({byList:{...e.byList,[t]:n}})),drop:t=>e(e=>{const n={...e.byList};return delete n[t],{byList:n}})}),{name:'covercharge-order-logos-v1',storage:(0,i.createJSONStorage)(()=>n.default)}))},1308,[1024,1008,1025]); +__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TodaysBookings=function({rid:o,today:s,by:p,app:x}){const v=(0,l.useBookings)(o).filter(e=>e.date===s&&(0,u.ACTIVE)(e)).sort((e,t)=>e.time.localeCompare(t.time)),B=v.reduce((e,t)=>e+(t.diet?.vegan??0),0),C=v.reduce((e,t)=>e+(t.diet?.vegetarian??0),0);return(0,y.jsxs)(n.default,{style:{gap:12},testID:"todays-bookings",children:[(0,y.jsx)(j.CoversToday,{rid:o}),(0,y.jsx)(h.PlattersBooked,{rid:o,date:s,label:"Platters booked today"}),B||C?(0,y.jsxs)(a.T,{colour:c.colours.ok,children:["\u24cb ",B?`${B} vegan`:'',B&&C?' \xb7 ':'',C?`${C} vegetarian`:''," today"]}):null,(0,y.jsx)(h.KitchenSignoffs,{rid:o,today:s,by:p,app:x,showAll:!0}),v.length?v.map(s=>(0,y.jsxs)(n.default,{style:{gap:6,padding:14,borderRadius:16,borderWidth:1,borderColor:c.colours.hairline,backgroundColor:c.colours.surface},children:[(0,y.jsxs)(a.T,{weight:"semibold",children:[s.time," \xb7 ",s.walkIn?`Walk-in ${s.ref}`:s.name," \xb7 ",s.partySize," covers",s.table?` \xb7 ${(0,e.tableNumbers)(s.table)}`:'']}),(0,y.jsx)(t.DepositChip,{b:s,money:!0,testID:`kitchen-deposit-${s.id}`}),(0,y.jsx)(b.BookingTableButton,{rid:o,booking:s,readOnly:'chef'===x}),'chef'!==x&&s.walkIn?(0,y.jsx)(k.CancelWalkInButton,{rid:o,b:s,small:!0}):null,s.notes?(0,y.jsxs)(a.T,{size:16,testID:`kitchen-notes-${s.id}`,children:["Notes: ",s.notes]}):null,(0,y.jsx)(f.BookingEditButton,{rid:o,booking:s,who:p,inStaffApp:'staff'===x}),(0,y.jsx)(h.BookingNeeds,{b:s}),'seated'===(0,u.shownStatus)(s)?(0,y.jsx)(a.Muted,{children:"Seated"}):'finished'===s.status?(0,y.jsx)(a.Muted,{children:"Finished"}):null]},s.id)):(0,y.jsx)(a.Muted,{children:"No bookings today yet."})]})};var e=r(d[0]),t=r(d[1]);r(d[2]);var o,s=r(d[3]),n=(o=s)&&o.__esModule?o:{default:o},a=r(d[4]),l=r(d[5]),u=r(d[6]),c=r(d[7]),h=r(d[8]),b=r(d[9]),k=r(d[10]),f=r(d[11]),j=r(d[12]),y=r(d[13])},1309,[808,1310,30,127,813,819,828,821,976,1311,1318,1319,971,24]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.DepositChip=function({b:e,money:o,big:n,testID:b}){const f=(0,s.depositView)(e,o);if(!f)return null;const h={gold:[t.colours.goldTint,t.colours.goldLight,t.colours.gold],amber:[t.colours.amberBg,'#FFE2A8',t.colours.amber],red:[t.colours.redBg,'#FFD9D4',t.colours.red],neutral:[t.colours.surface2,t.colours.muted,t.colours.border]}[f.kind];return(0,u.jsxs)(l.default,{accessible:!0,accessibilityRole:"text",accessibilityLabel:f.a11y,testID:b??'deposit-chip',style:{alignSelf:'flex-start',maxWidth:'100%'},children:[(0,u.jsx)(l.default,{style:{backgroundColor:h[0],borderColor:h[2],borderWidth:n?2:1,borderRadius:8,paddingHorizontal:n?12:8,paddingVertical:n?6:3},children:(0,u.jsx)(c.T,{size:16,weight:"semibold",colour:h[1],children:f.label})}),f.note?(0,u.jsx)(c.Muted,{size:12,children:f.note}):null]})},r(d[0]);var e,o=r(d[1]),l=(e=o)&&e.__esModule?e:{default:e},s=r(d[2]),t=r(d[3]),c=r(d[4]),u=r(d[5])},1310,[30,127,13,821,813,24]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingTableButton=function({rid:e,booking:l,readOnly:y,turnBase:B=90,testID:f}){const[h,j]=(0,t.useState)(!1),k=(0,s.tableButtonLabel)(l.table),x=f??`table-btn-${l.id}`;if(y)return(0,c.jsx)(n.default,{testID:x,accessible:!0,accessibilityLabel:(0,s.tableButtonA11y)(l.table,!0),style:{minHeight:44,justifyContent:'center'},children:(0,c.jsx)(b.T,{size:16,weight:"semibold",colour:o.colours.goldLight,children:k})});return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(b.Button,{kind:"secondary",label:k,testID:x,accessibilityLabel:(0,s.tableButtonA11y)(l.table),onPress:()=>j(!0),style:{minHeight:44}}),h?(0,c.jsx)(u.TablePicker,{rid:e,booking:l,name:l.walkIn?'Walk-in':(l.name??'').replace(' (example)',''),turnBase:B,onClose:()=>j(!1)}):null]})};var e,t=r(d[0]),l=r(d[1]),n=(e=l)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),u=r(d[4]),b=r(d[5]),c=r(d[6])},1311,[30,127,1312,821,1313,813,24]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"tableButtonLabel",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"tableButtonA11y",{enumerable:!0,get:function(){return s}}),e.tableOptions=function(t,n,o){const s=t.tables.map(t=>t.name).sort(l),c=new Set;return(t.joins??[]).forEach(t=>{t.tables.length>1&&c.add(t.tables.slice().sort(l).join('+'))}),[...n.map(t=>t.table),o].forEach(t=>{const n=a(t);n.length>1&&c.add(n.slice().sort(l).join('+'))}),[...s,...[...c].sort(l)]},e.tableOverlaps=function(t,l,o,s=90){const c=a(l);if(!c.length)return[];const b={...t,table:l};return o.filter(l=>l.id!==t.id&&l.date===t.date&&!['cancelled','noshow','finished'].includes(l.status)&&a(l.table).some(t=>c.includes(t))&&(0,n.startOf)(b)<(0,n.endOf)(l,s)&&(0,n.startOf)(l)<(0,n.endOf)(b,s))},Object.defineProperty(e,"tablePatch",{enumerable:!0,get:function(){return c}});var t=r(d[0]),n=r(d[1]);const a=t=>t?t.split('+').map(t=>t.trim()).filter(Boolean):[],l=(t,n)=>t.localeCompare(n,'en-GB',{numeric:!0}),o=n=>(0,t.tableNumbers)(n)||'No table',s=(n,a)=>`${(0,t.tableNumbersA11y)(n)}${a?'':', change table'}`;const c=t=>({table:t||void 0,tableSetHere:!0})},1312,[808,826]); +__d(function(_g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.saveBookingTables=j,_e.TablePicker=function({rid:e,booking:u,name:p,turnBase:f=90,onClose:v,onSaved:w,onPickOnPlan:T}){const $=(0,b.usePlan)(e),C=(0,c.useBookings)(e),[L,P]=(0,s.useState)(()=>(0,b.tablesOf)((0,h.tableKey)((0,b.tablesOf)(u.table)))),S=(0,s.useMemo)(()=>(0,h.pickGroups)($),[$]),W=C.filter(e=>e.date===u.date),z=(0,h.seatsOf)($,L),O=(0,h.seatLine)(z.total,u.partySize),D=(0,h.pickClashes)(u,L,W,f),I=e=>(0,h.pickClashes)(u,[e],W,f)[0]?.with,B=(0,h.tableKey)(L)!==(0,h.tableKey)((0,b.tablesOf)(u.table)),_=e=>P(l=>(0,h.toggleTable)(l,e)),M=async l=>{await j(e,u,l),w?.((0,h.savedWords)(p,u.partySize,l,(0,h.seatsOf)($,l).total)),v()},R=(0,k.jsxs)(n.default,{style:{gap:8},children:[(0,k.jsxs)(n.default,{testID:"table-pick-total",accessible:!0,accessibilityLabel:`${(0,h.tablesWords)(L)} picked. ${O.text}.`,children:[(0,k.jsx)(y.T,{size:18,weight:"semibold",colour:g.colours.goldLight,children:(0,h.tablesWords)(L)}),(0,k.jsx)(y.T,{size:17,colour:g.colours.text,children:O.text})]}),D.length?(0,k.jsx)(n.default,{testID:"table-pick-clash",accessible:!0,accessibilityLabel:`Warning. ${(0,h.clashWords)(D)} You can still save.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:g.colours.gold},children:(0,k.jsxs)(y.T,{size:16,weight:"semibold",colour:g.colours.goldLight,children:[(0,h.clashWords)(D)," You can still save."]})}):null,(0,k.jsxs)(y.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(y.Button,{testID:"table-pick-save",label:D.length?'Save anyway':'Save tables',disabled:!B||!L.length,accessibilityLabel:`${D.length?'Save anyway, ':'Save, '}${(0,h.tablesWords)(L)} for ${p}. ${O.text}.${D.length?` ${(0,h.clashWords)(D)}`:''}`,onPress:()=>M(L),style:[x,{flexGrow:1}]}),(0,b.tablesOf)(u.table).length?(0,k.jsx)(y.Button,{testID:"table-pick-clear",kind:"secondary",label:"Clear table",accessibilityLabel:`Clear table, take ${(0,h.tablesWords)((0,b.tablesOf)(u.table)).toLowerCase()} off ${p}`,onPress:()=>M([]),style:x}):null,(0,k.jsx)(y.Button,{testID:"table-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",onPress:v,style:x})]})]});return(0,k.jsxs)(y.Sheet,{visible:!0,onClose:v,title:`Tables \xb7 ${u.time} ${p} \xb7 ${u.partySize} Covers`,maxWidth:760,testID:"table-picker",footer:R,children:[(0,k.jsx)(l.TableNumberWarning,{plan:$}),(0,k.jsx)(y.T,{size:16,colour:g.colours.text,children:"Tap one table, or several to join them. Tap again to take one off."}),T?(0,k.jsx)(y.Button,{kind:"secondary",testID:"table-pick-on-plan",label:"Pick on the table plan",accessibilityLabel:`Pick on the table plan instead, for ${p}`,onPress:()=>T(L),style:x}):null,S.map(e=>(0,k.jsxs)(n.default,{style:{gap:6},accessibilityLabel:e.area,children:[(0,k.jsx)(y.T,{size:15,weight:"semibold",colour:g.colours.gold,children:e.area}),(0,k.jsx)(y.Row,{gap:8,wrap:!0,children:e.tables.map(e=>{const l=L.includes(e.name),s=I(e.name);return(0,k.jsxs)(o.default,{testID:`table-pick-${e.name}`,accessibilityRole:"checkbox",accessibilityState:{checked:l},'aria-checked':l,accessibilityLabel:(0,h.pickA11y)(e.name,e.seats,l,s),onPress:()=>_(e.name),style:({pressed:e})=>({minWidth:92,minHeight:64,paddingHorizontal:10,paddingVertical:6,borderRadius:12,alignItems:'center',justifyContent:'center',borderWidth:l?2:1,borderColor:l?g.colours.gold:s?g.colours.goldMuted:g.colours.hairline,borderStyle:s&&!l?'dashed':'solid',backgroundColor:l?g.colours.gold:e?g.colours.tilePressed:g.colours.tile}),children:[(0,k.jsx)(y.T,{size:18,weight:"semibold",colour:l?g.colours.onGold:g.colours.text,children:(0,t.tableNumbers)(e.name)}),(0,k.jsxs)(y.T,{size:14,colour:l?g.colours.onGold:g.colours.muted,children:[e.seats," seats",s?' \xb7 booked':'']})]},e.name)})})]},e.area)),S.length?null:(0,k.jsx)(y.Muted,{children:"No tables on the plan yet. Add them in Setup \u203a Table plan."})]})};var l=r(d[0]),t=r(d[1]),s=r(d[2]),o=e(r(d[3])),n=e(r(d[4])),c=r(d[5]),b=r(d[6]),u=r(d[7]),h=r(d[8]),g=r(d[9]),p=r(d[10]),y=r(d[11]),f=r(d[12]),k=r(d[13]);const x={minHeight:56};async function j(e,l,t){const s=(0,h.tableKey)(t),o=(0,b.tablesOf)(l.table);await c.repo.bookings.update(l.id,(0,u.tablePatch)(s||null)),'seated'===l.status&&l.date===(0,p.venueYmd)(new Date)&&(o.filter(e=>!(0,b.tablesOf)(s).includes(e)).forEach(l=>b.useFloor.getState().setLive(e,l,{stage:void 0,dirty:!0})),s&&(0,f.resetTableLive)(e,s))}},1313,[1314,808,30,263,127,819,825,1312,1315,821,818,813,989,24]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.TableNumberWarning=function({plan:u}){const c=(0,n.numberClashes)(u.tables),o=[...new Set([...c.acrossAreas,...u.tables.filter(n=>c.sameArea.has(n.name)).map(n.tableNumber)])];return o.length?(0,l.jsxs)(t.T,{testID:"duplicate-table-numbers",size:16,colour:s.colours.goldLight,children:["Duplicate table numbers: ",o.join(', '),". Kept unchanged. Ask a manager to check the areas before assigning."]}):null},r(d[0]);var n=r(d[1]),s=r(d[2]),t=r(d[3]),l=r(d[4])},1314,[30,1022,821,813,24]); +__d(function(_g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"byNum",{enumerable:!0,get:function(){return s}}),e.tableKey=o,e.toggleTable=function(t,n){return t.includes(n)?t.filter(t=>t!==n):a(o([...t,n]))},e.seatsOf=function(t,n){const a={};for(const s of n)a[s]=t.tables.find(t=>t.name===s)?.maxSeats??0;return{per:a,total:Object.values(a).reduce((t,n)=>t+n,0)}},e.seatLine=function(t,n){const a=Math.max(0,n-t);return{text:`${t} ${1===t?'seat':'seats'} for ${l(n)}${a?`: ${a} short`:''}`,short:a,fits:0===a&&t>0}},e.pickClashes=function(t,l,u,c=90){if(!l.length)return[];const f={...t,table:o(l)},b=[];for(const s of u)if(s.id!==t.id&&s.date===t.date&&!['cancelled','noshow','finished'].includes(s.status)&&(0,n.startOf)(f)<(0,n.endOf)(s,c)&&(0,n.startOf)(s)<(0,n.endOf)(f,c))for(const t of a(s.table))l.includes(t)&&b.push({table:t,with:s});return b.sort((t,n)=>s(t.table,n.table))},e.clashWords=function(n){return n.map(n=>`${(0,t.tableNumbers)(n.table)} has ${n.with.walkIn?'a walk-in':(n.with.name||'a booking').replace(' (example)','')} at ${n.with.time}`).join('. ')+(n.length?'.':'')},e.tablesWords=u,e.pickA11y=function(n,a,s,l){return`Table ${(0,t.tableNumbers)(n)}, ${a} ${1===a?'seat':'seats'}${s?', selected':''}${l?`, has ${l.walkIn?'a walk-in':l.name} at ${l.time}`:''}`},e.pickGroups=function(t){return t.areas.map(n=>({area:n.name,tables:t.tables.filter(t=>t.areaId===n.id).map(t=>({name:t.name,seats:t.maxSeats})).sort((t,n)=>s(t.name,n.name))})).filter(t=>t.tables.length)},e.savedWords=function(t,n,a,s){return a.length?`${t}, ${l(n)}: ${u(a)} (${s} seats).`:`${t}: table taken off.`},e.tableActions=function(t,n){const s=a(t.table);if(['cancelled','noshow'].includes(t.status))return[];const o=[s.length?{id:'assign',label:'Change table',a11y:`Change table for ${n}, ${l(t.partySize)}, now ${u(s).toLowerCase()}. You can pick several tables to join.`}:{id:'assign',label:'Assign table',a11y:`Assign table for ${n}, ${l(t.partySize)}. You can pick several tables to join.`}];s.length&&o.push({id:'clear',label:'Clear table',a11y:`Clear table for ${n}, take ${u(s).toLowerCase()} off this booking`});return o},e.dragTables=function(t,n,s){if(!s||'__none'===s||s===n)return null;const l=a(t);if(l.includes(s))return null;return o('__none'!==n&&l.includes(n)?l.map(t=>t===n?s:t):[s])};var t=r(d[0]),n=r(d[1]);const a=t=>t?t.split('+').map(t=>t.trim()).filter(Boolean):[],s=(t,n)=>t.localeCompare(n,'en-GB',{numeric:!0}),l=t=>`${t} ${1===t?'person':'people'}`;function o(t){return[...new Set(t.map(t=>String(t).trim()).filter(Boolean))].sort(s).join('+')}function u(n){const s=a(o(n));return s.length?(0,t.tableListNumbers)(s):'No table'}},1315,[808,826]); +__d(function(g,_r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.nextDays=c,Object.defineProperty(_e,"openOn",{enumerable:!0,get:function(){return u}}),_e.BookingDatePicker=function({r:e,today:l,value:b,onChange:m}){const[f,x]=(0,t.useState)(!1),p=(0,r.ymd)(l),j=c(l,9),D=(e,t)=>0===t?'Today':1===t?'Tomorrow':`${(0,r.dayShort)(e)} ${e.getDate()}`,w=j.some(e=>(0,r.ymd)(e)===b),C=(0,r.parseYmd)(b),[P,T]=(0,t.useState)(()=>({y:C.getFullYear(),m:C.getMonth()})),v=(new Date(P.y,P.m,1,12).getDay()+6)%7,M=new Date(P.y,P.m+1,0).getDate(),R=[...Array.from({length:v},()=>null),...Array.from({length:M},(e,t)=>new Date(P.y,P.m,t+1,12))];for(;R.length%7;)R.push(null);const k=12*(P.y-l.getFullYear())+P.m-l.getMonth(),F=e=>T(({y:t,m:o})=>{const s=new Date(t,o+e,1);return{y:s.getFullYear(),m:s.getMonth()}});return(0,i.jsxs)(s.default,{testID:"nb-date",style:{gap:6},children:[(0,i.jsxs)(d.Row,{wrap:!0,gap:6,children:[j.map((t,o)=>(0,i.jsx)(d.Chip,{label:D(t,o),sub:u(e,t)?void 0:'Closed',selected:b===(0,r.ymd)(t),onPress:()=>{m((0,r.ymd)(t)),x(!1)}},(0,r.ymd)(t))),w?null:(0,i.jsx)(d.Chip,{label:(0,r.niceDate)(C),sub:u(e,C)?void 0:'Closed',selected:!0,onPress:()=>x(!0)}),(0,i.jsx)(d.Chip,{label:f?'Close calendar':'\ud83d\udcc5 Pick date',selected:f,onPress:()=>{f||T({y:C.getFullYear(),m:C.getMonth()}),x(!f)}})]}),f?(0,i.jsxs)(s.default,{testID:"nb-calendar",style:{borderWidth:1,borderColor:n.colours.border,borderRadius:14,padding:10,gap:6,backgroundColor:n.colours.surface2,maxWidth:420},children:[(0,i.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,i.jsx)(o.default,{accessibilityRole:"button",accessibilityLabel:"Previous month",disabled:k<=0,onPress:()=>F(-1),style:{padding:8,opacity:k<=0?.3:1},children:(0,i.jsx)(d.T,{size:20,colour:n.colours.gold,children:"\u2039"})}),(0,i.jsxs)(d.T,{weight:"semibold",children:[(0,r.monthLong)(P.m)," ",P.y]}),(0,i.jsx)(o.default,{accessibilityRole:"button",accessibilityLabel:"Next month",disabled:k>=h,onPress:()=>F(1),style:{padding:8,opacity:k>=h?.3:1},children:(0,i.jsx)(d.T,{size:20,colour:n.colours.gold,children:"\u203a"})})]}),(0,i.jsx)(s.default,{style:{flexDirection:'row'},children:y.map(e=>(0,i.jsx)(d.T,{size:12,colour:n.colours.muted,center:!0,style:{flex:1},children:e},e))}),Array.from({length:R.length/7},(t,l)=>(0,i.jsx)(s.default,{style:{flexDirection:'row',gap:4},children:R.slice(7*l,7*l+7).map((t,l)=>{if(!t)return(0,i.jsx)(s.default,{style:{flex:1,height:40}},l);const c=(0,r.ymd)(t),y=c{m(c),x(!1)},style:{flex:1,height:40,borderRadius:10,alignItems:'center',justifyContent:'center',borderWidth:c===p?1.5:0,borderColor:n.colours.gold,backgroundColor:h?n.colours.gold:'transparent',opacity:y?.3:1},children:(0,i.jsx)(d.T,{size:15,weight:h?'bold':'regular',colour:h?n.colours.onGold:f?n.colours.muted:n.colours.text,style:f&&!y?{textDecorationLine:'line-through'}:void 0,children:t.getDate()})},l)})},l)),(0,i.jsx)(d.Muted,{children:"Past dates can\u2019t be booked. Crossed-out days: closed (per the venue\u2019s hours)."})]}):null]})};var t=_r(_d[0]),o=e(_r(_d[1])),s=e(_r(_d[2])),l=_r(_d[3]),r=_r(_d[4]),n=_r(_d[5]),d=_r(_d[6]),i=_r(_d[7]);function c(e,t){const o=new Date(e);return o.setHours(12,0,0,0),Array.from({length:t},(e,t)=>{const s=new Date(o);return s.setDate(o.getDate()+t),s})}const u=(e,t)=>!!(0,l.hoursFor)(e,t),y=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],h=12},1316,[30,263,127,815,818,821,813,24]); +__d(function(g,r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.MenuAllergyCheck=function({rid:e,allergens:j,audience:m="guest"}){const b=(0,t.useMenu)(e),[x,y]=(0,s.useState)(!1);if(!j.length)return null;const{contains:p,may:M,free:k}=(0,c.dishesFor)(b,j),w=k.filter(e=>!e.signOff),S=k.filter(e=>e.signOff),_=j.map(o.allergenLabel).join(', '),C=e=>e.map(e=>e.name).join(', ')||'none';return(0,f.jsxs)(l.default,{testID:"menu-allergy-check",style:{gap:6,borderWidth:1,borderColor:p.length?h.colours.red:h.colours.border,borderRadius:12,padding:10,backgroundColor:h.colours.surface2},children:[(0,f.jsxs)(u.T,{weight:"semibold",children:["Allergy check against the menu (",_,")"]}),(0,f.jsxs)(u.T,{size:14,colour:h.colours.red,children:["Contains: ",p.length," dish",1===p.length?'':'es']}),(0,f.jsxs)(u.T,{size:14,colour:h.colours.amber,children:["May contain: ",M.length]}),(0,f.jsxs)(u.T,{size:14,colour:h.colours.ok,children:["Free from ",1===j.length?'it':'them'," (signed off): ",S.length]}),w.length?(0,f.jsxs)(u.Muted,{children:[w.length," more awaiting the head chef's sign-off, so not shown as safe."]}):null,(0,f.jsx)(n.default,{testID:"menu-allergy-details",accessibilityRole:"button",onPress:()=>y(!x),hitSlop:6,children:(0,f.jsx)(u.T,{size:14,colour:h.colours.gold,children:x?'Hide dishes':'Show dishes'})}),x?(0,f.jsxs)(l.default,{style:{gap:4},children:[(0,f.jsxs)(u.Muted,{children:["Contains: ",C(p)]}),(0,f.jsxs)(u.Muted,{children:["May contain: ",C(M)]}),(0,f.jsxs)(u.Muted,{children:["Free from: ",C(S)]})]}):null,(0,f.jsx)(u.Muted,{children:'guest'===m?'From the kitchen\u2019s signed-off recipe cards. Specials on the board are checked by staff on the day.':'From the signed-off recipe cards. Specials on the board have their own allergens. Still check with the guest and the kitchen.'})]})};var s=r(d[0]),n=e(r(d[1])),l=e(r(d[2])),t=r(d[3]),o=r(d[4]),c=r(d[5]),h=r(d[6]),u=r(d[7]),f=r(d[8])},1317,[30,263,127,819,814,1143,821,813,24]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"canCancelWalkIn",{enumerable:!0,get:function(){return w}}),_e.cancelWalkInWords=y,_e.cancelWalkInNow=$,_e.CancelWalkInButton=function({rid:e,b:l,onDone:t,small:s}){const[c,o]=(0,n.useState)(!1);return w(l)?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(u.Button,{kind:"secondary",small:s,label:"Cancel walk-in",testID:`cancel-walkin-${l.id}`,accessibilityLabel:`Cancel walk-in ${l.ref}, ${l.partySize} Covers`,onPress:()=>o(!0),style:s?{minHeight:44}:k}),c?(0,f.jsx)(h,{rid:e,b:l,onClose:()=>o(!1),onDone:t}):null]}):null},_e.CancelWalkInConfirm=h;var e,n=r(d[0]),l=r(d[1]),t=(e=l)&&e.__esModule?e:{default:e},s=r(d[2]),c=r(d[3]),o=r(d[4]),b=r(d[5]),u=r(d[6]),f=r(d[7]);const k={minHeight:56},w=e=>!!e.walkIn&&('seated'===e.status||'confirmed'===e.status);function y(e){const n=(0,c.tablesOf)(e.table),l=(0,o.tablesWords)(n);return`Cancel walk-in ${e.ref}, ${e.partySize} Covers${n.length?` at ${l}`:''}, arrived ${e.time}? It comes off the Covers${n.length?` and ${l} ${n.length>1?'go':'goes'} back to Free`:''}.`}async function $(e,n){await s.repo.bookings.setStatus(n.id,'cancelled'),(0,c.tablesOf)(n.table).forEach(n=>c.useFloor.getState().setLive(e,n,{stage:void 0,dirty:!1}))}function h({rid:e,b:n,onClose:l,onDone:s}){const w=y(n);return(0,f.jsxs)(u.Sheet,{visible:!0,onClose:l,title:"Cancel walk-in?",maxWidth:560,testID:"cancel-walkin-confirm",children:[(0,f.jsx)(t.default,{accessible:!0,accessibilityLabel:w,children:(0,f.jsx)(u.T,{size:18,colour:b.colours.text,children:w})}),(0,f.jsxs)(u.Row,{gap:8,wrap:!0,children:[(0,f.jsx)(u.Button,{label:"Yes, cancel walk-in",testID:"cancel-walkin-yes",accessibilityLabel:`Yes, cancel walk-in ${n.ref}`,style:[k,{flexGrow:1}],onPress:async()=>{await $(e,n),l(),s?.(`Walk-in ${n.ref} cancelled.${(0,c.tablesOf)(n.table).length?` ${(0,o.tablesWords)((0,c.tablesOf)(n.table))} free.`:''}`)}}),(0,f.jsx)(u.Button,{kind:"secondary",label:"Keep walk-in",testID:"cancel-walkin-no",accessibilityLabel:`Keep walk-in ${n.ref}`,onPress:l,style:k})]})]})}},1318,[30,127,819,825,1315,821,813,24]); +__d(function(g,_r,i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingEditButton=function({rid:e,booking:a,who:l,role:s,inStaffApp:o,shiftManager:n,big:d,testID:h}){const[u,b]=(0,t.useState)(!1);return a.walkIn||!(0,c.canEditBooking)({variant:r.APP_VARIANT,inStaffApp:o,role:s,shiftManager:n})?null:(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(p.Button,{kind:"secondary",small:!d,label:"Edit booking",testID:h??`edit-booking-${a.id}`,accessibilityLabel:`Edit booking, ${a.name}, ${a.time}`,onPress:()=>b(!0),style:{minHeight:d?64:44}}),u?(0,x.jsx)(j,{rid:e,id:a.id,who:l,onClose:()=>b(!1)}):null]})},_e.EditBookingPicker=function({rid:e,today:a,who:l,onClose:o,hidePrivate:n}){const[d,r]=(0,t.useState)(null),c=(0,s.useBookings)(e).filter(e=>!e.walkIn&&e.date>=a&&!['cancelled','noshow','finished'].includes(e.status)).sort((e,t)=>e.date.localeCompare(t.date)||e.time.localeCompare(t.time)).slice(0,60);return d?(0,x.jsx)(j,{rid:e,id:d,who:l,hidePrivate:n,onClose:o}):(0,x.jsxs)(p.Sheet,{visible:!0,onClose:o,title:"Edit booking \xb7 pick a booking",maxWidth:640,testID:"edit-booking-picker",children:[(0,x.jsx)(p.T,{size:16,colour:u.colours.text,children:"Tip: tap the booking you want to change."}),c.length?c.map(e=>(0,x.jsx)(p.Button,{kind:"secondary",testID:`edit-pick-${e.id}`,label:`${e.date===a?'Today':e.date} ${e.time} \xb7 ${e.name} \xb7 ${e.partySize} ${1===e.partySize?'cover':'covers'}`,sub:e.notes?`Notes: ${e.notes}`:void 0,accessibilityLabel:`Edit booking, ${e.name}, ${e.date===a?'today':e.date}, ${e.time}, ${e.partySize} covers`,onPress:()=>r(e.id),style:{minHeight:56,alignItems:'flex-start'}},e.id)):(0,x.jsx)(p.Muted,{children:"No bookings to edit from today on."}),(0,x.jsx)(p.Button,{kind:"ghost",label:"Close",onPress:o,style:{minHeight:44}})]})},_e.EditBookingSheet=j;var e,t=_r(_d[0]),a=_r(_d[1]),l=(e=a)&&e.__esModule?e:{default:e},s=_r(_d[2]),o=_r(_d[3]),n=_r(_d[4]),d=_r(_d[5]),r=_r(_d[6]),c=_r(_d[7]),h=_r(_d[8]),u=_r(_d[9]),b=_r(_d[10]),m=_r(_d[11]),p=_r(_d[12]),x=_r(_d[13]);const y=/^([01]\d|2[0-3]):[0-5]\d$/,k=e=>{const t=e.trim().replace('.',':').match(/^(\d{1,2}):?(\d{2})$/);return t?`${t[1].padStart(2,'0')}:${t[2]}`:e.trim()};function j({rid:e,id:a,who:j,onClose:f,hidePrivate:v='display'===r.APP_VARIANT}){const T=(0,s.useBookings)(e),I=T.find(e=>e.id===a),C=(0,d.useRestaurant)(e),D=(0,o.usePlan)(e),P=(0,n.useBlocks)(e=>e.blocks),[$,w]=(0,t.useState)(I?(0,c.draftOf)(I):null),[B,S]=(0,t.useState)(null),[E,A]=(0,t.useState)(null);if(!I||!$||!C)return null;const z=e=>{S(null),A(null),w({...$,...e})},L=k($.time),_=y.test(L),F=(0,h.tableOptions)(D,T.filter(e=>e.date===$.date),$.table),N=(0,c.changedFields)(I,{...$,time:L}),W=C.settings.turnMins??90,R=async()=>{const t=(0,c.editPatch)(I,{...$,time:L},{by:j||'Team member',app:r.APP_VARIANT});if(Object.keys(t).length&&await s.repo.bookings.update(I.id,t),'seated'===I.status&&'table'in t&&t.table!==I.table){const a=e=>e?e.split('+').map(e=>e.trim()).filter(Boolean):[],l=a(I.table),s=a(t.table),n=o.useFloor.getState(),d=l.map(t=>n.live[e]?.[t]?.stage).find(Boolean)??'seated';l.filter(e=>!s.includes(e)).forEach(t=>n.setLive(e,t,{stage:void 0,dirty:!0})),s.forEach(t=>n.setLive(e,t,{stage:d,dirty:!1}))}A(`Saved. Changed: ${(0,c.editedWords)(N)}.`),S(null),f()};return(0,x.jsxs)(p.Sheet,{visible:!0,onClose:f,title:`Edit booking \xb7 ${I.name} \xb7 ${I.ref}`,maxWidth:760,testID:"edit-booking-sheet",children:[(0,x.jsx)(m.DepositChip,{b:I,money:!0,big:!0,testID:"edit-deposit"}),(0,c.isWixBooking)(I)?(0,x.jsx)(l.default,{testID:"edit-wix-note",accessible:!0,accessibilityLabel:c.WIX_EDIT_NOTE,style:{padding:12,borderRadius:12,borderWidth:1,borderColor:u.colours.gold},children:(0,x.jsx)(p.T,{size:16,colour:u.colours.goldLight,children:c.WIX_EDIT_NOTE})}):null,(0,x.jsx)(p.T,{size:16,colour:u.colours.text,children:"Tip: change what you need, then press Save changes."}),(0,x.jsx)(b.BookingDatePicker,{r:C,today:new Date,value:$.date,onChange:e=>z({date:e})}),(0,x.jsx)(p.Field,{label:"Time (24-hour, for example 19:30)",value:$.time,onChangeText:e=>z({time:e}),testID:"edit-time"}),_?null:(0,x.jsx)(p.T,{size:15,colour:u.colours.amber,children:"Write the time like 19:30."}),(0,x.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(p.T,{size:18,children:"Covers"}),(0,x.jsx)(p.Stepper,{value:$.partySize,onChange:e=>z({partySize:e}),min:1,max:60,label:"covers",testID:"edit-covers"})]}),(0,x.jsx)(p.Field,{label:"Name",value:$.name,onChangeText:e=>z({name:e}),testID:"edit-name"}),v?(0,x.jsx)(p.Muted,{children:"Phone and email can be changed in the Managers app; the Display never shows them."}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(p.Field,{label:"Phone",value:$.phone,onChangeText:e=>z({phone:e}),keyboardType:"phone-pad",testID:"edit-phone"}),(0,x.jsx)(p.Field,{label:"Email",value:$.email,onChangeText:e=>z({email:e}),keyboardType:"email-address",autoCapitalize:"none",testID:"edit-email"})]}),(0,x.jsx)(p.Field,{label:"Notes",value:$.notes,onChangeText:e=>z({notes:e}),placeholder:c.NOTES_PLACEHOLDER,multiline:!0,numberOfLines:3,testID:"edit-notes"}),I.allergies.length||I.allergyNote?(0,x.jsx)(p.Muted,{children:"Allergies are kept separately and are not changed here."}):null,(0,x.jsx)(p.T,{size:18,weight:"semibold",children:(0,h.tableButtonLabel)($.table)}),(0,x.jsxs)(p.Row,{gap:8,wrap:!0,children:[(0,x.jsx)(p.Button,{kind:$.table?'secondary':'primary',label:"No table",accessibilityLabel:"No table"+($.table?'':', chosen'),onPress:()=>z({table:''}),style:{minHeight:44,minWidth:96},testID:"edit-table-none"}),F.map(e=>(0,x.jsx)(p.Button,{kind:e===$.table?'primary':'secondary',label:(0,h.tableButtonLabel)(e),accessibilityLabel:`Table ${(0,h.tableButtonLabel)(e)}${e===$.table?', chosen':''}`,onPress:()=>z({table:e}),style:{minHeight:44,minWidth:64},testID:`edit-table-${e}`},e))]}),B?(0,x.jsxs)(l.default,{testID:"edit-warn",style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:u.colours.amber,backgroundColor:u.colours.amberBg},children:[B.map(e=>(0,x.jsx)(p.T,{size:16,colour:"#FFE2A8",children:e},e)),(0,x.jsx)(p.T,{size:16,colour:"#FFE2A8",children:"You can still save."})]}):null,E?(0,x.jsx)(p.T,{size:16,colour:u.colours.goldLight,children:E}):null,(0,x.jsxs)(p.Row,{gap:8,wrap:!0,children:[(0,x.jsx)(p.Button,{label:B?'Save anyway':'Save changes',testID:"edit-save",disabled:!_||$.name.trim().length<1||!N.length,onPress:()=>{const t=_?(0,n.blockAt)(P,e,$.date,L):void 0,a=(0,c.editWarnings)(I,{...$,time:L},T,t,W);!a.length||B?R():S(a)},style:{minHeight:56,flex:1}}),(0,x.jsx)(p.Button,{kind:"ghost",label:"Cancel",onPress:f,style:{minHeight:56}})]})]})}},1319,[30,127,819,825,824,1019,806,812,1312,821,1316,1310,813,24]); +__d(function(g,_r,_i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"VAT",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"exVat",{enumerable:!0,get:function(){return n}}),e.dishCost=i,Object.defineProperty(e,"gpPct",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"priceForTarget",{enumerable:!0,get:function(){return c}}),e.costings=function(r,c,s,u){const d=(0,t.dishStats)(r);return c.map(t=>{const c=r.find(r=>r.id===t.dishId);if(!c||null==c.price)return null;const p=i(t,s),l=n(c.price),f=o(p,c.price),b=d.find(t=>t.item.id===c.id)?.sold??0;return{item:c,recipe:t,cost:p,priceInc:c.price,priceEx:l,gp:f,cashGp:l-p,below:ft.prevCost&&t.prevCost!==t.cost).map(s=>{const u=(s.cost-(s.prevCost??s.cost))/(s.prevCost??1)*100,d=r.filter(t=>t.lines.some(t=>t.ing===s.id)).map(r=>{const u=t.find(t=>t.id===r.dishId);if(!u||null==u.price)return null;const d=o(i(r,n,{ing:s.id,cost:s.prevCost}),u.price),p=o(i(r,n),u.price);return{item:u,before:d,after:p,dropped:d>=c&&pt.dropped),below:d.filter(t=>t.below)}})},e.weekGp=function(t,r,n){const i=t.reduce((t,r)=>t+r.priceEx*r.soldWeek,0),o=t.reduce((t,r)=>t+r.cost*r.soldWeek,0),c=o+r+Math.max(0,n);return{sales:i,theoCost:o,actualCost:c,theo:i?(i-o)/i*100:0,actual:i?(i-c)/i*100:0}},Object.defineProperty(e,"fmtQty",{enumerable:!0,get:function(){return s}});var t=_r(_d[0]);const r=.2,n=t=>Math.round(t/1.2);function i(t,r,n){return Math.round(t.lines.reduce((t,i)=>{const o=r.find(t=>t.id===i.ing);return t+(n&&n.ing===i.ing?n.cost:o?.cost??0)*i.qty},0))}const o=(t,r)=>{const i=n(r);return i>0?(i-t)/i*100:0},c=(t,r)=>50*Math.ceil(t/(1-r/100)*1.2/50);const s=(t,r)=>`${Number.isInteger(t)?t:t.toFixed(t<1?3:2).replace(/0+$/,'').replace(/\.$/,'')} ${'each'===r?'':r}`.trim()},1320,[980]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"CHEF_ID",{enumerable:!0,get:function(){return x}}),_e.useChef=C,Object.defineProperty(_e,"isLow",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"stockValue",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"within7",{enumerable:!0,get:function(){return v}}),_e.useWeek=function(){const{k:e,c:r,now:t}=C(6e4),o=e.waste.filter(e=>v(e.at,t)).reduce((e,r)=>e+r.cost,0),n=e.stockTakes[0],s=n?n.lines.reduce((e,r)=>e+(r.expected-r.counted)*r.cost,0):0;return{...(0,b.weekGp)(r,o,s),wasteWeek:o,variance:Math.round(s)}},_e.useForecast=function(){const{r:e,rid:r,now:t}=C(6e4),o=(0,i.useBookings)(r),n=(0,i.useOrders)(r),s=(0,i.useEvents)(r),d=(0,u.useRealHistory)(r,t),c=(0,l.forecastToday)(e,o,n,s,t,d??void 0),f=c.hours.reduce((e,r)=>e+r.covers,0),b=c.hours.reduce((e,r)=>e+r.booked,0),p=c.hours.reduce((e,r)=>e+r.historicalCovers,0),y=c.enough&&p?Math.round((f-p)/p*100):0,w=['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'][(0,h.weekday)(t)],x=c.enough?`${w} ${y>=0?'+':''}${y}%${c.example?' (example figures)':''}`:'Not enough history yet';return{f:c,covers:f,booked:b,typical:p,pct:y,day:w,label:x,enough:c.enough,example:c.example}},_e.Tile=function({label:e,value:r,sub:t,tone:o,onPress:s,testID:i}){const d='red'===o?f.colours.red:'amber'===o?f.colours.amber:'ok'===o?f.colours.ok:f.colours.text;return(0,w.jsxs)(n.default,{testID:i,accessibilityRole:s?'button':void 0,accessibilityLabel:`${e}: ${r}`,onPress:s,style:({pressed:e})=>({flexGrow:1,flexBasis:150,minWidth:140,padding:12,borderRadius:14,borderWidth:1,borderColor:'red'===o?f.colours.red:f.colours.border,backgroundColor:e?'#1d1a14':f.colours.surface,gap:2}),children:[(0,w.jsx)(c.Muted,{children:e}),(0,w.jsx)(c.T,{size:22,weight:"bold",colour:d,children:r}),t?(0,w.jsx)(c.T,{size:12,colour:f.colours.muted,children:t}):null]})},_e.Seg=function({value:e,options:r,onChange:t}){return(0,w.jsx)(c.Row,{wrap:!0,gap:6,children:r.map(r=>(0,w.jsx)(n.default,{accessibilityRole:"tab",accessibilityState:{selected:e===r.id},accessibilityLabel:r.label,onPress:()=>t(r.id),style:{paddingHorizontal:12,paddingVertical:7,minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center',borderRadius:999,borderWidth:1,borderColor:e===r.id?f.colours.gold:f.colours.border,backgroundColor:e===r.id?f.colours.goldTint:'transparent'},children:(0,w.jsx)(c.T,{size:13,weight:e===r.id?'semibold':'regular',colour:e===r.id?f.colours.goldLight:f.colours.text,children:r.label})},r.id))})},_e.Bar=function({pct:e,colour:r=f.colours.gold}){return(0,w.jsx)(s.default,{style:{height:6,borderRadius:3,backgroundColor:f.colours.surface2,overflow:'hidden'},children:(0,w.jsx)(s.default,{style:{width:`${Math.max(0,Math.min(100,e))}%`,height:6,backgroundColor:r}})})},Object.defineProperty(_e,"pct1",{enumerable:!0,get:function(){return S}});var r=_r(_d[0]),t=e(_r(_d[1])),o=_r(_d[2]),n=e(_r(_d[3])),s=e(_r(_d[4])),i=_r(_d[5]),d=_r(_d[6]),u=_r(_d[7]),l=_r(_d[8]),c=_r(_d[9]),f=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),p=_r(_d[13]),y=_r(_d[14]),w=_r(_d[15]);const x=y.ROSTER.find(e=>'chef'===e.app)?.id??'';function C(e=3e4){const n=(0,d.useOwner)(e=>e.site),s=(0,i.useRestaurant)(n),u=(0,d.useOwner)(e=>e.staff),l=u.find(e=>e.id===x)?.name??'Head Chef',c=(0,i.useNow)(e),f=(0,i.useAllMenu)(n),h=(0,p.useKitchen)(),y=t.default.useMemo(()=>{const e=r.LIVE_HEAD_CHEF?{...h,...(0,p.stripKitchenExamples)(h)}:h,t=e.ingredients.filter(e=>(0,o.chefCanSee)(n,e)),s=new Set(e.ingredients.filter(e=>!(0,o.chefCanSee)(n,e)).map(e=>e.id));return{...e,ingredients:t,temps:e.temps.filter(e=>(0,o.chefCanSee)(n,e)),waste:e.waste.filter(e=>(0,o.chefCanSee)(n,e)&&!s.has(e.ing||'')),deliveries:e.deliveries.filter(e=>(0,o.chefCanSee)(n,e)).map(e=>({...e,lines:e.lines.filter(e=>!s.has(e.ing))})),orders:e.orders.filter(e=>(0,o.chefCanSee)(n,e)).map(e=>({...e,lines:e.lines.filter(e=>!s.has(e.ing))}))}},[h,n]),w=(0,b.costings)(f,y.recipes,y.ingredients,y.targetGp);return{rid:n,r:s,me:l,now:c,menu:f,k:y,c:w}}const k=(e,r)=>e>0&&e<.5*r,j=e=>Math.round(e.reduce((e,r)=>e+r.onHand*r.cost,0)),v=(e,r)=>r.getTime()-new Date(e).getTime()<6048e5;const S=e=>`${e.toFixed(1)}%`},1321,[1245,30,1125,263,127,819,854,981,868,813,821,954,1320,1212,14,24]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GpScreen=function({initial:e="dishes"}){const[t,l]=(0,s.useState)(e),{k:o}=(0,c.useChef)(),d=(0,a.useKitchen)(e=>e.setTarget);return(0,h.jsxs)(i.default,{style:{gap:12},children:[(0,h.jsx)(n.Card,{children:(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsxs)(i.default,{style:{flex:1},children:[(0,h.jsx)(n.T,{weight:"semibold",children:"Target GP"}),(0,h.jsx)(n.Muted,{children:"Dishes under target are flagged red."})]}),(0,h.jsx)(n.Button,{small:!0,kind:"secondary",label:"\u2212",accessibilityLabel:"Lower target",onPress:()=>d(o.targetGp-1)}),(0,h.jsxs)(n.T,{size:22,weight:"bold",colour:r.colours.gold,children:[o.targetGp,"%"]}),(0,h.jsx)(n.Button,{small:!0,kind:"secondary",label:"+",accessibilityLabel:"Raise target",onPress:()=>d(o.targetGp+1)})]})}),(0,h.jsx)(c.Seg,{value:t,onChange:l,options:[{id:'dishes',label:'Recipe cards & GP'},{id:'changes',label:'Price changes'},{id:'week',label:'Theoretical vs actual'},{id:'engineering',label:'Menu engineering'}]}),'dishes'===t?(0,h.jsx)(u,{}):'changes'===t?(0,h.jsx)(j,{}):'week'===t?(0,h.jsx)(b,{}):(0,h.jsx)(w,{})]})};var s=_r(_d[0]),t=e(_r(_d[1])),i=e(_r(_d[2])),n=_r(_d[3]),l=_r(_d[4]),r=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),a=_r(_d[9]),h=_r(_d[10]);function u(){const{c:e,k:t}=(0,c.useChef)(),[l,r]=(0,s.useState)(null),o=e.filter(e=>e.below),d=[...e].sort((e,s)=>e.gp-s.gp),a=e.find(e=>e.item.id===l);return e.length?(0,h.jsxs)(i.default,{style:{gap:10},children:[(0,h.jsx)(n.Muted,{children:"Menu prices include VAT (20%). GP is worked out on the price ex VAT: (price ex VAT \u2212 dish cost) \xf7 price ex VAT. VAT figures are for information only."}),o.length?(0,h.jsxs)(n.Banner,{kind:"danger",title:`${o.length} of ${e.length} dishes below ${t.targetGp}%`,children:[o.slice(0,6).map(e=>e.item.name).join(', '),o.length>6?'\u2026':'']}):(0,h.jsx)(n.Banner,{kind:"success",title:"All costed dishes on target"}),d.map(e=>(0,h.jsx)(p,{d:e,onPress:()=>r(e.item.id)},e.item.id)),(0,h.jsx)(n.Sheet,{visible:!!a,onClose:()=>r(null),title:a?.item.name??'',children:a?(0,h.jsx)(x,{d:a}):null})]}):(0,h.jsx)(n.Muted,{children:"No costed dishes yet. Add your real recipes and ingredient costs to see GP."})}function p({d:e,onPress:s}){return(0,h.jsxs)(t.default,{accessibilityRole:"button",accessibilityLabel:`${e.item.name}, GP ${e.gp.toFixed(1)} percent`,onPress:s,style:({pressed:s})=>({padding:12,borderRadius:12,borderWidth:1,borderColor:e.below?r.colours.red:r.colours.border,backgroundColor:s?'#1d1a14':e.below?r.colours.redBg:r.colours.surface,gap:2}),children:[(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{weight:"medium",style:{flex:1},children:e.item.name}),(0,h.jsx)(n.T,{weight:"bold",colour:e.below?r.colours.red:r.colours.ok,children:(0,c.pct1)(e.gp)})]}),(0,h.jsxs)(n.Muted,{children:["Cost ",(0,l.gbp)(e.cost)," \xb7 ",(0,l.gbp)(e.priceInc)," inc VAT (",(0,l.gbp)(e.priceEx)," ex) \xb7 cash GP ",(0,l.gbp)(e.cashGp)]}),e.below?(0,h.jsxs)(n.T,{size:12,colour:r.colours.red,children:["Below ",e.target,"%: price for target ",(0,l.gbp)((0,d.priceForTarget)(e.cost,e.target))," inc VAT"]}):null]})}function x({d:e}){const s=(0,a.useKitchen)(),t=s.recipes.find(s=>s.dishId===e.item.id);return(0,h.jsxs)(i.default,{style:{gap:8},children:[(0,h.jsxs)(n.Muted,{children:["Recipe card \xb7 ",t.yield]}),t.lines.map(t=>{const r=s.ingredients.find(e=>e.id===t.ing);if(!r)return null;const o='each'===r.unit?1:'kg'===r.unit&&t.qty<.1?.005:.01;return(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsxs)(i.default,{style:{flex:1},children:[(0,h.jsx)(n.T,{size:14,children:r.name}),(0,h.jsxs)(n.Muted,{children:[(0,l.gbp)(r.cost)," per ",r.unit]})]}),(0,h.jsx)(n.Button,{small:!0,kind:"ghost",label:"\u2212",accessibilityLabel:`Less ${r.name}`,onPress:()=>s.setRecipeQty(e.item.id,t.ing,Math.max(0,Math.round(1e3*(t.qty-o))/1e3))}),(0,h.jsx)(n.T,{size:13,style:{width:64,textAlign:'center'},children:(0,d.fmtQty)(t.qty,r.unit)}),(0,h.jsx)(n.Button,{small:!0,kind:"ghost",label:"+",accessibilityLabel:`More ${r.name}`,onPress:()=>s.setRecipeQty(e.item.id,t.ing,Math.round(1e3*(t.qty+o))/1e3)}),(0,h.jsx)(n.T,{size:13,style:{width:60,textAlign:'right'},children:(0,l.gbp)(Math.round(r.cost*t.qty))})]},t.ing)}),(0,h.jsxs)(i.default,{style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:8,gap:4},children:[(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{children:"Dish cost"}),(0,h.jsx)(n.T,{weight:"semibold",children:(0,l.gbp)(e.cost)})]}),(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{children:"Selling price inc VAT"}),(0,h.jsx)(n.T,{children:(0,l.gbp)(e.priceInc)})]}),(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.Muted,{children:"VAT (20%, for info)"}),(0,h.jsx)(n.Muted,{children:(0,l.gbp)(e.priceInc-e.priceEx)})]}),(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{children:"Price ex VAT"}),(0,h.jsx)(n.T,{children:(0,l.gbp)(e.priceEx)})]}),(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{children:"Cash GP"}),(0,h.jsx)(n.T,{weight:"semibold",children:(0,l.gbp)(e.cashGp)})]}),(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{children:"GP %"}),(0,h.jsx)(n.T,{weight:"bold",colour:e.below?r.colours.red:r.colours.ok,children:(0,c.pct1)(e.gp)})]}),(0,h.jsxs)(n.Banner,{kind:e.below?'warn':'info',title:`Price that hits ${e.target}%: ${(0,l.gbp)((0,d.priceForTarget)(e.cost,e.target))} inc VAT`,children:["Or bring the dish cost down to ",(0,l.gbp)(Math.floor(e.priceEx*(1-e.target/100))),". Prices are changed in CoverCharge for Managers (Menu & allergens)."]})]})]})}function j(){const{menu:e,k:s}=(0,c.useChef)(),t=(0,d.priceImpacts)(e,s.recipes,s.ingredients,s.targetGp);return t.length?(0,h.jsx)(i.default,{style:{gap:10},children:t.map(e=>(0,h.jsxs)(n.Card,{highlight:e.dropped.length?r.colours.red:void 0,children:[(0,h.jsxs)(n.T,{weight:"semibold",children:[e.ing.name," ",e.pct>0?'+':'',e.pct.toFixed(0),"%: ",e.dropped.length," dish",1===e.dropped.length?'':'es'," drop below target"]}),(0,h.jsxs)(n.Muted,{children:[(0,l.gbp)(e.ing.prevCost??0)," \u2192 ",(0,l.gbp)(e.ing.cost)," per ",e.ing.unit]}),e.dishes.map(e=>(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{size:14,style:{flex:1},children:e.item.name}),(0,h.jsxs)(n.T,{size:13,colour:r.colours.muted,children:[(0,c.pct1)(e.before)," \u2192 "]}),(0,h.jsx)(n.T,{size:13,weight:"semibold",colour:e.below?r.colours.red:r.colours.ok,children:(0,c.pct1)(e.after)}),e.dropped?(0,h.jsx)(n.Badge,{kind:"red",label:"NOW BELOW"}):null]},e.item.id))]},e.ing.id))}):(0,h.jsx)(n.Muted,{children:"No ingredient price changes since the last deliveries."})}function b(){const{k:e}=(0,c.useChef)(),s=(0,c.useWeek)();return s.sales?(0,h.jsxs)(i.default,{style:{gap:10},children:[(0,h.jsxs)(n.Row,{wrap:!0,gap:10,children:[(0,h.jsx)(c.Tile,{label:"Theoretical GP (recipes \xd7 sales)",value:(0,c.pct1)(s.theo),tone:s.theoe.soldWeek>0),t=s.reduce((e,s)=>e+s.soldWeek,0)/Math.max(1,s.length),r=s.reduce((e,s)=>e+s.cashGp,0)/Math.max(1,s.length),d={Star:[],'Plough horse':[],Puzzle:[],Dog:[]};return s.forEach(e=>d[(0,o.quadrant)(e.soldWeek,e.cashGp,t,r)].push(e)),(0,h.jsxs)(i.default,{style:{gap:10},children:[s.length?(0,h.jsx)(n.Muted,{children:"Popularity (sold per week) against cash GP per dish, using the live menu from CoverCharge for Managers. Example sales figures."}):(0,h.jsx)(n.Muted,{children:"Needs dish sales figures, which CoverCharge doesn't have on a real venue yet (no till link). Nothing is guessed."}),Object.keys(d).map(e=>(0,h.jsxs)(n.Card,{children:[(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{weight:"semibold",children:'Star'===e?'\u2b50 Stars':'Plough horse'===e?'\ud83d\udc0e Plough horses':'Puzzle'===e?'\u2754 Puzzles':'\ud83d\udc15 Dogs'}),(0,h.jsx)(n.Badge,{kind:"gold",label:`${d[e].length}`})]}),(0,h.jsx)(n.Muted,{children:o.QUADRANT_TIP[e]}),d[e].map(e=>(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{size:14,style:{flex:1},children:e.item.name}),(0,h.jsxs)(n.Muted,{children:[e.soldWeek,"/wk \xb7 ",(0,l.gbp)(e.cashGp)," \xb7 ",(0,c.pct1)(e.gp)]})]},e.item.id))]},e))]})}},1322,[30,263,127,813,816,821,980,1320,1321,1212,24]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.PrepScreen=function(){const{k:e,menu:t,me:s,now:i}=(0,M.useChef)(),{covers:n,label:r,typical:l,enough:a,booked:o,f:c}=(0,M.useForecast)(),f=(0,w.ymd)(i),m=(0,T.dishStats)(t).filter(t=>e.recipes.some(e=>e.dishId===t.item.id)&&!['Sides','Desserts'].includes(t.item.section)),p=m.reduce((e,t)=>e+t.sold,0)||1,x=m.map(e=>({id:e.item.id,name:e.item.name,qty:Math.ceil(.85*n*(e.sold/p)*1.1)})).filter(e=>e.qty>0).sort((e,t)=>t.qty-e.qty),y={};x.forEach(t=>e.recipes.find(e=>e.dishId===t.id)?.lines.forEach(e=>{y[e.ing]=(y[e.ing]??0)+e.qty*t.qty}));const b=[{id:'haddock',text:`Portion ${x.filter(e=>['a-fishsupper','a-mini','a-tempura'].includes(e.id)).reduce((e,t)=>e+t.qty,0)} haddock portions (fish supper, tempura, Mini Anchors)`},{id:'chips',text:`Peel, cut and blanch ${(0,v.fmtQty)(Math.ceil(2*(y.potatoes??0))/2,'kg')} chipping potatoes`},{id:'batter',text:`Make up ${(0,v.fmtQty)(Math.ceil(10*(y.batter??0))/10+.5,'kg')} beer batter`},{id:'leaves',text:`Wash and spin ${(0,v.fmtQty)(Math.ceil(10*(y.leaves??0))/10,'kg')} salad leaves`},{id:'mussels',text:`Clean and debeard ${(0,v.fmtQty)(Math.ceil(2*(y.mussels??0))/2,'kg')} mussels (discard any open that don't close)`},{id:'sauce',text:'Garlic butter, tartare and Marie Rose: check, make and date-label'}],j=(0,B.useKitchen)(e=>e.tickPrep),C=[...b.map(e=>({key:`${f}:task:${e.id}`,text:e.text})),...x.map(e=>({key:`${f}:dish:${e.id}`,text:`${e.qty} \xd7 ${e.name}`}))],S=C.filter(t=>e.prepTicks[t.key]).length;return e.recipes.length&&e.ingredients.length?(0,D.jsxs)(h.default,{style:{gap:10},children:[a?null:(0,D.jsx)(u.Banner,{kind:"info",title:`Booked so far: ${o} covers`,children:`Not enough history yet. Forecasts start once CoverCharge has ${c.minWeeks} weeks of your bookings and cash-ups. Prep from what is booked and your own judgement.`}),a?(0,D.jsxs)(u.Banner,{kind:"info",title:`${r}: ${n} covers forecast`,children:["A typical ",r.split(' ')[0]," is about ",l," covers. Portions below are scaled from the forecast, bookings and the usual dish mix, plus 10% cover."]}):null,(0,D.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,D.jsx)(u.T,{weight:"semibold",children:"Prep list for today"}),(0,D.jsx)(u.Badge,{kind:S===C.length?'ok':'gold',label:`${S}/${C.length} done`})]}),C.map((t,i)=>{const n=e.prepTicks[t.key];return(0,D.jsxs)(d.default,{accessibilityRole:"checkbox",accessibilityState:{checked:!!n},accessibilityLabel:t.text,onPress:()=>j(t.key,n?null:s),style:{flexDirection:'row',gap:10,alignItems:'center',padding:10,borderRadius:10,borderWidth:1,borderColor:n?k.colours.ok:k.colours.border,backgroundColor:k.colours.surface,marginTop:i===b.length?8:0},children:[(0,D.jsx)(u.T,{size:18,colour:n?k.colours.ok:k.colours.muted,children:n?'\u2611':'\u2610'}),(0,D.jsxs)(h.default,{style:{flex:1},children:[(0,D.jsx)(u.T,{size:14,style:n?{textDecorationLine:'line-through',color:k.colours.muted}:void 0,children:t.text}),n?(0,D.jsxs)(u.Muted,{children:[n.by," \xb7 ",new Date(n.at).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})]}):null]})]},t.key)})]}):(0,D.jsx)(u.Muted,{children:"No prep list yet. Add your real recipe costs and ingredients to build it."})},_e.WasteScreen=function(){const{k:e,me:n,now:r,rid:l}=(0,M.useChef)(),a=(0,M.useWeek)(),d=(0,B.useKitchen)(e=>e.addWaste),[f,m]=(0,o.useState)(e.ingredients[0]?.id),[p,x]=(0,o.useState)(''),[y,j]=(0,o.useState)('Over-production'),w=e.ingredients.find(e=>e.id===f),C=Number(p.replace(',','.'))||0,S=C>=0&&(!w||!(0,s.fishInStone)(l,w)||Number.isInteger(2*C)),T=w&&S?(0,s.inputQuantity)(l,w,C):0,v=e.waste.filter(e=>(0,M.within7)(e.at,r));return w?(0,D.jsxs)(h.default,{style:{gap:10},children:[(0,D.jsxs)(u.Row,{wrap:!0,gap:10,children:[(0,D.jsx)(M.Tile,{label:"Waste this week",value:(0,b.gbp)(a.wasteWeek),sub:`${v.length} entries`,tone:a.sales&&a.wasteWeek/a.sales>.02?'amber':'ok'}),(0,D.jsx)(M.Tile,{label:"Waste as % of food sales",value:a.sales?(0,M.pct1)(a.wasteWeek/a.sales*100):'\u2014',sub:a.sales?'Food sales ex VAT, this week':'Needs dish sales (no till link yet)'})]}),(0,D.jsxs)(u.Card,{children:[(0,D.jsx)(u.T,{weight:"semibold",children:"Log waste"}),(0,D.jsx)(c.default,{horizontal:!0,showsHorizontalScrollIndicator:!1,children:(0,D.jsx)(u.Row,{gap:6,children:e.ingredients.map(e=>(0,D.jsx)(u.Chip,{label:e.name,selected:e.id===f,onPress:()=>m(e.id)},e.id))})}),(0,D.jsxs)(u.Row,{gap:8,children:[(0,D.jsx)(t.TextInput,{accessibilityLabel:`Waste quantity in ${(0,s.quantityUnit)(l,w)}`,accessibilityValue:{text:(0,i.ingredientSpeech)(l,w,T)},keyboardType:"decimal-pad",value:p,onChangeText:x,placeholder:`qty (${(0,s.quantityUnit)(l,w)})`,placeholderTextColor:k.colours.muted,style:{flex:1,minHeight:44,borderWidth:1,borderColor:k.colours.border,borderRadius:8,padding:8,color:k.colours.text}}),(0,D.jsx)(u.T,{children:(0,s.quantityUnit)(l,w)}),(0,D.jsx)(u.T,{weight:"semibold",colour:k.colours.gold,children:(0,b.gbp)(Math.round(T*w.cost))})]}),(0,s.fishInStone)(l,w)?(0,D.jsxs)(u.Row,{children:[(0,D.jsx)(u.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:`Waste half a stone less ${w.name}`,onPress:()=>x(String(Math.max(0,(0,s.halfStone)(C)-.5)))}),(0,D.jsx)(u.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:`Waste half a stone more ${w.name}`,onPress:()=>x(String((0,s.halfStone)(C)+.5))}),(0,D.jsx)(u.Muted,{children:"Half-stone amounts"})]}):null,(0,D.jsx)(u.Row,{wrap:!0,gap:6,children:B.WASTE_REASONS.map(e=>(0,D.jsx)(u.Chip,{label:e,selected:e===y,onPress:()=>j(e)},e))}),(0,D.jsx)(u.Button,{label:"Add to waste log",disabled:T<=0,onPress:()=>{d({by:n,item:w.name,ing:w.id,qty:T,unit:w.unit,reason:y,cost:Math.round(T*w.cost)}),x('')}}),(0,D.jsx)(u.Muted,{children:"Logged waste also comes off stock."})]}),e.waste.slice(0,20).map(e=>(0,D.jsxs)(u.Row,{style:{justifyContent:'space-between',paddingVertical:2},children:[(0,D.jsxs)(h.default,{style:{flex:1},children:[(0,D.jsxs)(u.T,{size:14,children:[e.item," \xb7 ",(0,i.ingredientQty)(l,{name:e.item,unit:e.unit},e.qty)]}),(0,D.jsxs)(u.Muted,{children:[e.reason," \xb7 ",new Date(e.at).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'})," \xb7 ",e.by]})]}),(0,D.jsx)(u.T,{size:14,children:(0,b.gbp)(e.cost)})]},e.id))]}):(0,D.jsx)(u.Muted,{children:"No stock items yet. Add your real ingredients before logging waste."})},_e.AllergenScreen=function({openCards:e}={}){const{k:t,me:s,rid:i}=(0,M.useChef)(),n=(0,f.useRecipeCards)(i),r=(0,x.auditView)('chef',(0,f.useAudit)(i)).filter(e=>/allergen|recipe card|sign/i.test(e.text)).slice(0,12),l=n.slice().sort((e,t)=>e.section.localeCompare(t.section)||e.dish.localeCompare(t.dish)).map(e=>{const s=t.recipes.find(t=>t.dishId===e.menuItemId),i=new Set(s?s.lines.flatMap(e=>t.ingredients.find(t=>t.id===e.ing)?.allergens??[]):[]),n=[...i].filter(t=>!e.allergens[t]);return{card:e,fromCosting:i,missing:n}}),a={name:s,role:'head-chef'};return(0,D.jsxs)(h.default,{style:{gap:10},testID:"allergen-matrix",children:[(0,D.jsx)(u.Muted,{children:"The 14 allergens from each recipe card (C contains, m may contain). These are what guests see on the menu, takeaway and the booking allergy check. A red cell means the costing recipe uses an ingredient with that allergen but the card doesn't list it."}),e?(0,D.jsx)(u.Button,{testID:"open-recipe-cards",small:!0,kind:"secondary",label:"Open recipe cards \u203a",onPress:e}):null,(0,D.jsx)(c.default,{horizontal:!0,children:(0,D.jsxs)(h.default,{children:[(0,D.jsxs)(u.Row,{gap:0,children:[(0,D.jsx)(h.default,{style:{width:150},children:(0,D.jsx)(u.Muted,{children:"Dish"})}),y.ALLERGENS.map(e=>(0,D.jsx)(h.default,{style:{width:34,alignItems:'center'},children:(0,D.jsx)(u.T,{size:10,colour:k.colours.muted,children:e.short})},e.id))]}),l.map(({card:e,fromCosting:t})=>(0,D.jsxs)(u.Row,{gap:0,style:{borderTopWidth:1,borderColor:k.colours.border,paddingVertical:4},children:[(0,D.jsx)(h.default,{style:{width:150},children:(0,D.jsx)(u.T,{size:12,numberOfLines:2,children:e.dish})}),y.ALLERGENS.map(s=>{const i=e.allergens[s.id],n=t.has(s.id)&&!i;return(0,D.jsx)(h.default,{accessibilityLabel:`${e.dish} ${s.label}: ${'contains'===i?'contains':'may'===i?'may contain':n?'in the costing recipe, not on the card':'no'}`,style:{width:34,height:24,alignItems:'center',justifyContent:'center',backgroundColor:n?k.colours.redBg:'transparent'},children:(0,D.jsx)(u.T,{size:11,weight:'contains'===i?'bold':'regular',colour:n?k.colours.red:'contains'===i?k.colours.gold:i?k.colours.muted:'#444',children:'contains'===i?'C':'may'===i?'m':n?'!':'\xb7'})},s.id)})]},e.id))]})}),(0,D.jsx)(u.Muted,{children:"C card says contains \xb7 m may contain \xb7 ! in the costing recipe but not on the card"}),l.filter(e=>e.missing.length||!e.card.signOff).map(({card:t,missing:s})=>(0,D.jsxs)(u.Card,{highlight:s.length?k.colours.red:k.colours.amber,children:[(0,D.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,D.jsx)(u.T,{weight:"semibold",style:{flex:1},children:t.dish}),t.signOff?(0,D.jsx)(u.Badge,{kind:"ok",label:"Signed off"}):(0,D.jsx)(u.Badge,{kind:"amber",label:"Awaiting sign-off"})]}),s.length?(0,D.jsxs)(u.T,{size:13,colour:k.colours.red,children:["Costing recipe has ",s.map(e=>y.ALLERGENS.find(t=>t.id===e)?.short).join(', '),", not on the card"]}):null,(0,D.jsxs)(u.Row,{wrap:!0,gap:8,children:[s.length?(0,D.jsx)(u.Button,{small:!0,label:"Add to the card",onPress:()=>{const e={...t.allergens};s.forEach(t=>{e[t]='contains'}),(0,m.recipeCards)().update(t.id,{allergens:e},a).catch(()=>{})}}):null,e?(0,D.jsx)(u.Button,{small:!0,kind:"secondary",label:"Check and sign off on the card",onPress:e}):null]})]},t.id)),(0,D.jsxs)(u.Card,{children:[(0,D.jsx)(u.T,{weight:"semibold",children:"Audit log"}),r.length?r.map(e=>(0,D.jsxs)(u.Muted,{children:[new Date(e.at).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})," \xb7 ",e.text]},e.id)):(0,D.jsx)(u.Muted,{children:"No allergen changes yet."})]})]})},_e.ComplianceScreen=function(){const{k:e,me:s,now:i,rid:r}=(0,M.useChef)(),l=(0,w.ymd)(i),a=(0,B.useKitchen)(e=>e.addTemp),c=(0,p.useOwner)(e=>e.checks),{tick:f,untick:m}=p.useOwner.getState(),[x,y]=(0,o.useState)('fridge'),b=A.find(e=>e.id===x),j={...b,units:b.units.filter(e=>(0,n.chefCanSee)(r,e))},[C,S]=(0,o.useState)(j.units[0]),[T,v]=(0,o.useState)(''),R=Number(T.replace(',','.')),$=T.trim()&&!Number.isNaN(R)?j.ok(R):null,I=e.temps.filter(e=>e.at.slice(0,10)===l),L=(e,t,i)=>{const n=c[e];return(0,D.jsxs)(d.default,{accessibilityRole:"checkbox",accessibilityState:{checked:!!n},accessibilityLabel:t,onPress:()=>n?m(e):f(e,s,(new Date).toISOString()),style:{flexDirection:'row',gap:10,alignItems:'center',paddingVertical:6},children:[(0,D.jsx)(u.T,{size:18,colour:n?k.colours.ok:k.colours.muted,children:n?'\u2611':'\u2610'}),(0,D.jsxs)(h.default,{style:{flex:1},children:[(0,D.jsx)(u.T,{size:14,children:t}),(0,D.jsx)(u.Muted,{children:n?`${n.by} \xb7 ${new Date(n.at).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})}`:i??''})]})]},e)};return(0,D.jsxs)(h.default,{style:{gap:10},children:[(0,D.jsxs)(u.Card,{children:[(0,D.jsx)(u.T,{weight:"semibold",children:"Record a temperature"}),(0,D.jsx)(u.Row,{wrap:!0,gap:6,children:A.map(e=>(0,D.jsx)(u.Chip,{label:e.label,selected:e.id===x,onPress:()=>{y(e.id),S(e.units.filter(e=>(0,n.chefCanSee)(r,e))[0])}},e.id))}),(0,D.jsx)(u.Row,{wrap:!0,gap:6,children:j.units.map(e=>(0,D.jsx)(u.Chip,{label:e,selected:e===C,onPress:()=>S(e)},e))}),(0,D.jsx)(u.Muted,{children:j.rule}),(0,D.jsxs)(u.Row,{gap:8,children:[(0,D.jsx)(t.TextInput,{accessibilityLabel:"Temperature in degrees C",keyboardType:"numbers-and-punctuation",value:T,onChangeText:v,placeholder:"\xb0C",placeholderTextColor:k.colours.muted,style:{width:90,borderWidth:1,borderColor:k.colours.border,borderRadius:8,padding:8,color:k.colours.text}}),null===$?null:(0,D.jsx)(u.Badge,{kind:!0===$?'ok':'warn'===$?'amber':'red',label:!0===$?'OK':'warn'===$?'CHECK':'OUT OF RANGE'}),(0,D.jsx)(u.Button,{small:!0,label:"Save",disabled:null===$,onPress:()=>{a({by:s,kind:x,unit:C,temp:R,note:!0===$?void 0:'Action needed'}),v('')}})]}),!1===$?(0,D.jsx)(u.Banner,{kind:"danger",title:"Out of range",children:"Record what you did (e.g. moved food, called the engineer, cooked longer) and re-check."}):null]}),(0,D.jsxs)(u.Card,{children:[(0,D.jsxs)(u.T,{weight:"semibold",children:["Today's readings (",I.length,")"]}),I.length?I.map(e=>{const t=A.find(t=>t.id===e.kind)?.ok(e.temp);return(0,D.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,D.jsx)(u.T,{size:14,style:{flex:1},children:e.unit}),(0,D.jsx)(u.Muted,{children:new Date(e.at).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})}),(0,D.jsxs)(u.T,{size:14,weight:"semibold",colour:!0===t?k.colours.ok:'warn'===t?k.colours.amber:k.colours.red,children:[e.temp,"\xb0C"]})]},e.id)}):(0,D.jsx)(u.Muted,{children:"None yet today."})]}),(0,D.jsxs)(u.Card,{children:[(0,D.jsx)(u.T,{weight:"semibold",children:"Opening and closing checks"}),(0,D.jsx)(u.Muted,{children:"Day-to-day checks in the style of a CookSafe diary. Your own CookSafe manual is the record that counts."}),P.map(e=>L(`${l}:kc-${e.id}`,e.text))]}),(0,D.jsxs)(u.Card,{children:[(0,D.jsx)(u.T,{weight:"semibold",children:"Cleaning schedule"}),N.map(e=>L('Daily'===e.freq?`${l}:kcl-${e.id}`:`wk${Math.floor(i.getTime()/6048e5)}:kcl-${e.id}`,e.text,e.freq))]})]})},_e.TeamScreen=function(){const{rid:e,r:t,me:s,now:i,menu:n}=(0,M.useChef)(15e3),[r,a]=(0,o.useState)('live'),d=(0,S.useSignedIn)(),c=(0,o.useMemo)(()=>({meId:d?.id??M.CHEF_ID,role:'staff'}),[d?.id]);return(0,D.jsx)(C.ChatAsCtx.Provider,{value:c,children:(0,D.jsxs)(h.default,{style:{gap:10},children:[(0,D.jsx)(q,{sub:r,setSub:a}),'live'===r?(0,D.jsx)(E,{}):'soldout'===r?(0,D.jsx)(l.SoldOutList,{rid:e,by:s}):'team'===r?(0,D.jsx)(G,{}):(0,D.jsx)(W,{}),void 0,void 0,void 0,void 0,void 0]})})};var t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),n=_r(_d[3]),r=_r(_d[4]),l=_r(_d[5]),a=_r(_d[6]),o=_r(_d[7]),d=e(_r(_d[8])),c=e(_r(_d[9])),h=e(_r(_d[10])),u=_r(_d[11]),f=_r(_d[12]),m=_r(_d[13]),p=_r(_d[14]),x=_r(_d[15]),y=_r(_d[16]),b=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),k=_r(_d[20]),C=_r(_d[21]),S=_r(_d[22]),T=_r(_d[23]),v=_r(_d[24]),R=_r(_d[25]),$=_r(_d[26]),M=_r(_d[27]),B=_r(_d[28]),I=_r(_d[29]),L=_r(_d[30]),O=_r(_d[31]),z=_r(_d[32]),D=_r(_d[33]);const A=[{id:'fridge',label:'Fridge',units:['Walk-in fridge','Prep fridge','Bar fridge'],rule:'Target 5\xb0C or below (8\xb0C maximum)',ok:e=>e<=5||e<=8&&'warn'},{id:'freezer',label:'Freezer',units:['Chest freezer','Upright freezer'],rule:'Target \u221218\xb0C or below',ok:e=>e<=-18||e<=-15&&'warn'},{id:'cook',label:'Cooking (core)',units:['Fish','Chicken','Pie','Burger'],rule:'Core 75\xb0C or above',ok:e=>e>=75},{id:'reheat',label:'Reheating',units:['Soup','Skink','Sauce'],rule:'Core 82\xb0C or above (Scotland)',ok:e=>e>=82},{id:'hot hold',label:'Hot holding',units:['Bain-marie','Soup kettle'],rule:'63\xb0C or above',ok:e=>e>=63},{id:'cool',label:'Cooling',units:['Stock','Rice','Braise'],rule:'Below 8\xb0C, cooled as quickly as possible (aim for 90 minutes)',ok:e=>e<8||'warn'}],N=[{id:'surfaces',text:'Work surfaces and boards cleaned and sanitised',freq:'Daily'},{id:'fryers',text:'Fryers filtered, oil checked',freq:'Daily'},{id:'floors',text:'Floors and drains',freq:'Daily'},{id:'handwash',text:'Wash-hand basins stocked (soap, towels)',freq:'Daily'},{id:'fridges',text:'Fridges emptied and cleaned',freq:'Weekly'},{id:'extract',text:'Extraction canopy filters',freq:'Weekly'}],P=[{id:'open-temps',text:'Opening: fridge and freezer temperatures recorded',when:'Opening'},{id:'open-fit',text:'Opening: staff fit for work (no sickness or diarrhoea in 48 hours)',when:'Opening'},{id:'open-probe',text:'Opening: probe thermometer checked and wiped',when:'Opening'},{id:'close-label',text:'Closing: food covered, labelled and dated',when:'Closing'},{id:'close-dates',text:'Closing: anything past its use-by removed',when:'Closing'},{id:'close-clean',text:'Closing: cleaning schedule done',when:'Closing'}];function q({sub:e,setSub:t}){const{total:s}=(0,C.useChatUnread)();return(0,D.jsx)(M.Seg,{value:e,onChange:t,options:[{id:'live',label:'Live tickets'},{id:'soldout',label:'Sold out'},{id:'team',label:"Who's on & rota"},{id:'chat',label:s?`Chat (${s})`:'Chat'}]})}function W(){return(0,D.jsx)(C.Chat,{go:()=>{}})}function E(){const{rid:e,r:t,me:s,now:i}=(0,M.useChef)(15e3),n=(0,f.useStore)(e=>e.bookings),l=(0,f.useOrders)(e),o=l.filter(e=>(0,a.waitingForStaff)(e)).length,d=l.filter(a.kitchenCanSee).filter(e=>['new','acknowledged','preparing'].includes(e.status)||'ready'===e.status&&'pass'===(0,$.nextStep)(e,(0,$.linkedBooking)(e,n))),c=(e,t)=>!!(0,$.statusBlock)(e,t,(0,$.linkedBooking)(e,n)),m=(0,x.ticketView)('chef',d),p=(0,f.useStore)(e=>e.setOrderStatus),b=(0,f.useStore)(e=>e.ackReadiness),w=d.flatMap(e=>(0,j.readinessFor)(e,t,i)).filter(e=>'due'===e.state||'overdue'===e.state);return(0,D.jsxs)(h.default,{style:{gap:8},children:[w.length?(0,D.jsx)(u.Banner,{kind:"warn",title:`${w.length} readiness alert${w.length>1?'s':''}`,children:w.map(e=>e.detail).join(' \xb7 ')}):(0,D.jsx)(u.Muted,{children:"No readiness alerts right now."}),o?(0,D.jsxs)(u.Muted,{children:[o," table order",o>1?'s':''," waiting for front of house to accept (the first order from a new phone). It shows here once accepted."]}):null,m.length?m.map(e=>(0,D.jsxs)(u.Card,{highlight:e.allergies.length&&(0,$.nextStep)(e,(0,$.linkedBooking)(e,n))&&'ready'!==e.status?k.colours.red:void 0,children:[(0,D.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,D.jsxs)(u.T,{weight:"semibold",children:['table'===e.type?`${(0,r.tableNumbers)(e.tableNo)}`:`Takeaway ${e.slotTime?new Date(e.slotTime).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}):''}`," \xb7 ",e.ref]}),(0,D.jsx)(u.Badge,{kind:'new'===e.status?'amber':'gold',label:e.status.toUpperCase()})]}),e.lines.map((e,t)=>(0,D.jsxs)(u.T,{size:14,children:[e.qty," \xd7 ",e.name]},t)),e.allergies.length?(0,D.jsxs)(u.T,{size:13,colour:k.colours.red,children:["\u26a0 Allergy: ",e.allergies.map(e=>`${y.ALLERGENS.find(t=>t.id===e.allergen)?.label} (${e.severity})`).join(', ')]}):null,'takeaway'===e.type&&e.accepted?(0,D.jsxs)(u.T,{size:13,colour:k.colours.ok,children:["\u2713 Confirmed by ",e.accepted.by,Object.keys(e.allergyTicks??{}).length?` \xb7 kitchen checked: ${Object.keys(e.allergyTicks).map(e=>y.ALLERGENS.find(t=>t.id===e)?.label??e).join(', ')}`:'']}):null,e.allergies.length?(0,D.jsx)(R.AllergyChain,{o:e,me:s}):null,(0,D.jsxs)(u.Row,{wrap:!0,gap:8,children:['preparing'!==e.status&&'ready'!==e.status?(0,D.jsx)(u.Button,{small:!0,label:"Start",testID:`start-${e.ref}`,disabled:c(e,'preparing'),onPress:()=>{p(e.id,'preparing',s),'takeaway'===e.type&&b(e.id,'cook',s)}}):null,'ready'!==e.status?(0,D.jsx)(u.Button,{small:!0,kind:"success",label:"Ready",testID:`ready-${e.ref}`,disabled:c(e,'ready'),onPress:()=>p(e.id,'ready',s)}):null]})]},e.id)):(0,D.jsx)(u.Muted,{children:"No live tickets. New orders from the customer app and the Staff app show here."})]})}const F=(e,t)=>{const[s,i,n]=e.split('-').map(Number);return(0,w.ymd)(new Date(s,i-1,n+t))};function G(){const{now:e,today:t}={...(0,M.useChef)(6e4),today:(0,w.ymd)(new Date)},{staff:s,shifts:i}=(0,x.rotaView)('chef',(0,p.useOwner)(e=>e.staff),(0,p.useOwner)(e=>e.shifts)),n=(0,p.useOwner)(e=>e.attendance).filter(e=>e.date===t&&e.in&&!e.out),r=(0,S.weekday)(e),l=s.filter(e=>/kitchen|chef|kp/i.test(e.job+e.name)),a=(0,O.useSession)(e=>e.meId),o=(0,z.useSync)(e=>e.staffRef),d=a??o??M.CHEF_ID,c=(0,p.useOwner)(e=>e.staff.find(e=>e.id===d)?.name??'Chef').replace(/\s*\(.*\)$/,'');return(0,D.jsxs)(h.default,{style:{gap:10},children:[(0,D.jsx)(L.BreakRoomCard,{staffId:d,name:c,now:e}),(0,D.jsxs)(u.Card,{children:[(0,D.jsx)(u.T,{weight:"semibold",children:"On now"}),n.length?n.map(e=>(0,D.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,D.jsxs)(u.Row,{gap:8,style:{flex:1},children:[(0,D.jsx)(I.StaffAvatar,{id:e.staffId,size:28}),(0,D.jsx)(u.T,{size:14,children:s.find(t=>t.id===e.staffId)?.name??e.staffId})]}),(0,D.jsxs)(u.Muted,{children:["since ",new Date(e.in).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})]})]},e.id)):(0,D.jsx)(u.Muted,{children:"Nobody clocked in yet."})]}),(0,D.jsxs)(u.Card,{children:[(0,D.jsxs)(u.T,{weight:"semibold",children:["Today on the rota (",S.DAY3[r],")"]}),i.filter(e=>e.date===t).map(e=>(0,D.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,D.jsxs)(u.Row,{gap:8,style:{flex:1},children:[(0,D.jsx)(I.StaffAvatar,{id:e.staffId,size:28}),(0,D.jsx)(u.T,{size:14,children:s.find(t=>t.id===e.staffId)?.name})]}),(0,D.jsxs)(u.Muted,{children:[(0,S.fmtH)(e.start),"\u2013",(0,S.fmtH)(e.end)]})]},e.id))]}),(0,D.jsxs)(u.Card,{children:[(0,D.jsx)(u.T,{weight:"semibold",children:"Kitchen rota this week"}),l.map(e=>(0,D.jsxs)(h.default,{style:{gap:4},children:[(0,D.jsx)(u.T,{size:14,children:e.name}),(0,D.jsx)(u.Row,{wrap:!0,gap:4,children:S.DAY3.map((s,n)=>{const l=i.find(s=>s.staffId===e.id&&s.date===F(t,n-r));return(0,D.jsxs)(h.default,{style:{width:44,padding:4,borderRadius:6,backgroundColor:l?k.colours.goldTint:k.colours.surface2,alignItems:'center'},children:[(0,D.jsx)(u.T,{size:10,colour:k.colours.muted,children:s}),(0,D.jsx)(u.T,{size:10,children:l?`${(0,S.fmtH)(l.start).slice(0,2)}\u2013${(0,S.fmtH)(l.end).slice(0,2)}`:'off'})]},s)})})]},e.id)),(0,D.jsx)(u.Muted,{children:"Rota changes, swaps and leave are made in CoverCharge for Managers. This view shows shifts only."})]})]})}},1323,[874,1149,1324,1125,808,1035,873,30,263,151,127,813,819,831,854,807,814,816,978,818,821,960,954,980,1320,986,987,1321,1212,955,1348,858,820,24]); +__d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ingredientQty",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"ingredientSpeech",{enumerable:!0,get:function(){return f}});var t=r(d[0]),n=r(d[1]);const i=(i,f,u)=>(0,n.fishInStone)(i,f)?(0,n.fishQtyText)(i,f,u):(0,t.fmtQty)(u,f.unit||''),f=(t,f,u)=>(0,n.fishInStone)(t,f)?(0,n.fishQtySpeech)(t,f,u):i(t,f,u)},1324,[1320,1149]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"inlineStyles",{enumerable:!0,get:function(){return n.inlineStyles}}),Object.defineProperty(_e,"loadLocalRawResource",{enumerable:!0,get:function(){return n.loadLocalRawResource}}),Object.defineProperty(_e,"LocalSvg",{enumerable:!0,get:function(){return n.LocalSvg}}),Object.defineProperty(_e,"SvgCss",{enumerable:!0,get:function(){return n.SvgCss}}),Object.defineProperty(_e,"SvgCssUri",{enumerable:!0,get:function(){return n.SvgCssUri}}),Object.defineProperty(_e,"SvgWithCss",{enumerable:!0,get:function(){return n.SvgWithCss}}),Object.defineProperty(_e,"SvgWithCssUri",{enumerable:!0,get:function(){return n.SvgWithCssUri}}),Object.defineProperty(_e,"WithLocalSvg",{enumerable:!0,get:function(){return n.WithLocalSvg}}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return f.default}}),Object.defineProperty(_e,"camelCase",{enumerable:!0,get:function(){return e.camelCase}}),Object.defineProperty(_e,"fetchText",{enumerable:!0,get:function(){return t.fetchText}}),Object.defineProperty(_e,"parse",{enumerable:!0,get:function(){return e.parse}}),Object.defineProperty(_e,"SvgAst",{enumerable:!0,get:function(){return e.SvgAst}}),Object.defineProperty(_e,"SvgFromUri",{enumerable:!0,get:function(){return e.SvgFromUri}}),Object.defineProperty(_e,"SvgFromXml",{enumerable:!0,get:function(){return e.SvgFromXml}}),Object.defineProperty(_e,"SvgUri",{enumerable:!0,get:function(){return e.SvgUri}}),Object.defineProperty(_e,"SvgXml",{enumerable:!0,get:function(){return e.SvgXml}});var e=r(d[0]),t=r(d[1]),n=r(d[2]),u=r(d[3]);Object.keys(u).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return u[e]}})});var o=r(d[4]);Object.keys(o).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return o[e]}})});var c,f=(c=o)&&c.__esModule?c:{default:c}},1325,[1326,1327,1346,1347,1329]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.SvgAst=c,_e.SvgXml=l,_e.SvgUri=function(r){const{onError:o=i,uri:s,onLoad:c,fallback:u}=r,[f,p]=(0,t.useState)(null),[d,h]=(0,t.useState)(!1);if((0,t.useEffect)(()=>{s?(0,n.fetchText)(s).then(t=>{p(t),d&&h(!1),c?.()}).catch(t=>{o(t),h(!0)}):p(null)},[o,s,c]),d)return u??null;return e.createElement(l,{xml:f,override:r,fallback:u})},Object.defineProperty(_e,"SvgFromXml",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"SvgFromUri",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"camelCase",{enumerable:!0,get:function(){return d}}),_e.getStyle=h,_e.astToReact=x,_e.parse=j,Object.defineProperty(_e,"tags",{enumerable:!0,get:function(){return r.tags}});var t=_r(_d[0]),e=(function(t){if(t&&t.__esModule)return t;var e={};return t&&Object.keys(t).forEach(function(n){if('default'!==n){var r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:function(){return t[n]}})}}),e.default=t,e})(t),n=_r(_d[1]),r=_r(_d[2]);function o(){return o=Object.assign?Object.assign.bind():function(t){for(var e=1;enull!==o?j(o):null,[o]);return e.createElement(c,{ast:r,override:s||n})}catch(t){return r(t),l??null}}class u extends t.Component{state={ast:null};componentDidMount(){this.parse(this.props.xml)}componentDidUpdate(t){const{xml:e}=this.props;e!==t.xml&&this.parse(e)}parse(t){const{onError:e=i}=this.props;try{this.setState({ast:t?j(t):null})}catch(t){const n=t;e({...n,message:`[RNSVG] Couldn't parse SVG, reason: ${n.message}`})}}render(){const{props:t,state:{ast:n}}=this;return e.createElement(c,{ast:n,override:t.override||t})}}class f extends t.Component{state={xml:null};componentDidMount(){this.fetch(this.props.uri)}componentDidUpdate(t){const{uri:e}=this.props;e!==t.uri&&this.fetch(e)}async fetch(t){try{this.setState({xml:t?await(0,n.fetchText)(t):null})}catch(t){console.error(t)}}render(){const{props:t,state:{xml:n}}=this;return e.createElement(u,{xml:n,override:t,onError:t.onError})}}const p=(t,e)=>e.toUpperCase(),d=t=>t.replace(/[:-]([a-z])/g,p);function h(t){const e={},n=t.split(';').filter(t=>t.trim()),{length:r}=n;for(let t=0;tb(' ',t.length);function v(t,e){const n=t.split('\n'),r=n.length;let o=e,s=0;for(;s=t))break;o-=t}const c=t.slice(0,e).replace(/^\t+/,y),i=/(^|\n).*$/.exec(c),l=i&&i[0]||'',u=t.slice(e),f=/.*(\n|$)/.exec(u);return{line:s,column:o,snippet:`${l}${f&&f[0]}\n${b(' ',l.length)}^`}}const E=/[a-zA-Z0-9:_-]/,O=/
Wildings Hotel & Restaurant
- + diff --git a/wildings/owner-app/owner.html b/wildings/owner-app/owner.html index 9845b4c5181ccefb8ace248b486d6c50da49e08e..873d4aecccb3440f09dd90bb525b341f5a08da87 100644 --- a/wildings/owner-app/owner.html +++ b/wildings/owner-app/owner.html @@ -35,6 +35,6 @@
Wildings Hotel & Restaurant
- + diff --git a/wildings/owner-app/sw.js b/wildings/owner-app/sw.js index cb650f4f547545d28d428a6bd9f0d5be1dc7c21e..943c7a7440068b5154bc08d20782a87c741dcc5c 100644 --- a/wildings/owner-app/sw.js +++ b/wildings/owner-app/sw.js @@ -1,4 +1,4 @@ -const V="cc-wildings-owner-142991e728b3",B="/wildings/owner-app/",P=["/wildings/owner-app/apple-touch-icon.png", "/wildings/owner-app/favicon.ico", "/wildings/owner-app/icon-192.png", "/wildings/owner-app/icon-512.png", "/wildings/owner-app/brand-logo.png", "/wildings/owner-app/index.html", "/wildings/owner-app/manifest.webmanifest", "/wildings/owner-app/brand-hero.png", "/wildings/owner-app/owner.html", "/wildings/owner-app/_expo/static/js/web/[section]-7680005b9f9a2edf6bc1f22af6918f1c.js", "/wildings/owner-app/_expo/static/js/web/index-9ce99f41a3c26a869e4827a24ebd3aca.js", "/wildings/owner-app/_expo/static/js/web/waitlist-0320ee6701e15c6f75e009195ede6649.js", "/wildings/owner-app/_expo/static/js/web/index-374f32ca8b3acd4c473cb67f0be4a5c1.js", "/wildings/owner-app/_expo/static/js/web/basket-b8721424d77f8fff3bcb7938bf6f00a9.js", "/wildings/owner-app/_expo/static/js/web/index-973ada74f56035815426979f31f74d4e.js", "/wildings/owner-app/_expo/static/js/web/lost-8f9c0dd7edb0230b1a7643d0a4db9b94.js", "/wildings/owner-app/_expo/static/js/web/index-0994a8297a116c063b7c5486cd93f4cf.js", "/wildings/owner-app/_expo/static/js/web/whatson-9d1e33597e23613f788dd1a65097d805.js", "/wildings/owner-app/_expo/static/js/web/index-aa80a45d20901c92ac80bce3e7f15e09.js", "/wildings/owner-app/_expo/static/js/web/feedback-d9f2534b23e5222df62036cf5c589115.js", "/wildings/owner-app/_expo/static/js/web/demo-83f3a2ec0a7b15fde8c581deca3aacba.js", "/wildings/owner-app/_expo/static/js/web/profile-8ee64849d80e5e4fbc355334da657495.js", "/wildings/owner-app/_expo/static/js/web/_layout-6055aeb8c7e983c2b5c125bd96b483b2.js", "/wildings/owner-app/_expo/static/js/web/book-e85de1237680ea1ed22194e431f4aae4.js", "/wildings/owner-app/_expo/static/js/web/[token]-54437c1584595973844c5162a52a3951.js", "/wildings/owner-app/_expo/static/js/web/[did]-227a2f79a620251d29d8f8e716ee8bdb.js", "/wildings/owner-app/_expo/static/js/web/__expo-metro-runtime-8c088df87a31e4e6accd81c554ec290d.js", "/wildings/owner-app/_expo/static/js/web/__common-d7964a445c88197ff066d3bfa62cd491.js", "/wildings/owner-app/_expo/static/js/web/gift-816d52e2568f34226fab48f95bd8cd2d.js", "/wildings/owner-app/_expo/static/js/web/refer-e81d5904668ca019b14c4a55cb5fe496.js", "/wildings/owner-app/_expo/static/js/web/index-9b73737315d8d526628ed6b975f9a47d.js", "/wildings/owner-app/_expo/static/js/web/loyalty-839ff8850648a9e774e292154875f015.js", "/wildings/owner-app/_expo/static/js/web/index-143b26e6eb99ac456c60de17036d7b2f.js", "/wildings/owner-app/_expo/static/js/web/index-6ff9008e6ddc971ef1cd72c414e77874.js", "/wildings/owner-app/_expo/static/js/web/[n]-3078b1d37581aff4da1ffebe18afde8a.js", "/wildings/owner-app/_expo/static/js/web/index-341ebaa02dc0bade68b09d177ce4e155.js", "/wildings/owner-app/_expo/static/js/web/offers-9686678f09e067586de55260ff3a98e5.js", "/wildings/owner-app/_expo/static/js/web/[oid]-79da5afa34641052ac0acd9d446a2fdc.js", "/wildings/owner-app/_expo/static/js/web/merch-f6c0131852806f70f1f5125fabbb0386.js", "/wildings/owner-app/_expo/static/js/web/index-755444069a2b09ea576f72e8e2ec346e.js", "/wildings/owner-app/_expo/static/js/web/+not-found-a9acde932f0ed95cf1e7409e88874f97.js", "/wildings/owner-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/wildings/owner-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/wildings/owner-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/wildings/owner-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/wildings/owner-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/wildings/owner-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/wildings/owner-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/wildings/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/wildings/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/wildings/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/wildings/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/wildings/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/wildings/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/wildings/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/wildings/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/wildings/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/wildings/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/wildings/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/wildings/owner-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/wildings/owner-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/wildings/owner-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/wildings/owner-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/wildings/owner-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/wildings/owner-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/wildings/owner-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/wildings/owner-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/wildings/owner-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/wildings/owner-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/wildings/owner-app/assets/assets/brand/wildings.076f4fcd06d19a0af0205c410f461b14.png", "/wildings/owner-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/wildings/owner-app/assets/assets/brand/kirkmichael.63b13cde7fd82eb622622b39ac80c394.png", "/wildings/owner-app/assets/assets/brand/brae.8de9e89ac30966c6669de990370d8e40.png", "/wildings/owner-app/assets/assets/brand/kirkmichael-hero.63b13cde7fd82eb622622b39ac80c394.png", "/wildings/owner-app/assets/assets/brand/greenside.9d1556db97dcb903a3c57e2063ee2255.png", "/wildings/owner-app/assets/assets/brand/abbotsford-hero.78fcb8ee06ee22c4ca659c9254db7512.png", "/wildings/owner-app/assets/assets/brand/kirkton.bcf8d846df4861474d224a7a77f498fb.png", "/wildings/owner-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/wildings/owner-app/assets/assets/brand/wildings-hero-logo-text.4661e4b935726f2511f9c17a1567c89a.png", "/wildings/owner-app/assets/assets/brand/kirkton-hero.9d0837b292c2f4f30f4521d806bb28c3.png", "/wildings/owner-app/assets/assets/brand/saltmarsh.85a6a65732635e5148478d743d9ca884.png", "/wildings/owner-app/assets/assets/brand/souters.f4c58d9349b6e1700fe5abcc9e9b665c.png", "/wildings/owner-app/assets/assets/brand/greenside-hero.1caec5a6cb939434cccb5f3a613b50f8.png", "/wildings/owner-app/assets/assets/brand/abbotsford.b26602bba5ce4969733c5422a45ad053.png"]; +const V="cc-wildings-owner-ce0c2d8f0c96",B="/wildings/owner-app/",P=["/wildings/owner-app/apple-touch-icon.png", "/wildings/owner-app/favicon.ico", "/wildings/owner-app/icon-192.png", "/wildings/owner-app/icon-512.png", "/wildings/owner-app/brand-logo.png", "/wildings/owner-app/index.html", "/wildings/owner-app/manifest.webmanifest", "/wildings/owner-app/brand-hero.png", "/wildings/owner-app/owner.html", "/wildings/owner-app/_expo/static/js/web/feedback-3a26c70c9f758c4e362493c3b124ff43.js", "/wildings/owner-app/_expo/static/js/web/[n]-ced785c534ba69ad6c9c35369d7ecc36.js", "/wildings/owner-app/_expo/static/js/web/index-f9b07e7c25cec3623c10876ff1e01e58.js", "/wildings/owner-app/_expo/static/js/web/index-e196fd8b19ecc6189ee08bcd5ff2f404.js", "/wildings/owner-app/_expo/static/js/web/[section]-93e8e4ffe952e5b3c505e21ca771e570.js", "/wildings/owner-app/_expo/static/js/web/index-a39af53b0c36f30a0cc27647d3da5a52.js", "/wildings/owner-app/_expo/static/js/web/offers-3f4e351ccaa73514bd508bf7bd2a3fa2.js", "/wildings/owner-app/_expo/static/js/web/[oid]-7fa4f78cb447d1c659e81fff8893269f.js", "/wildings/owner-app/_expo/static/js/web/__common-e34bda0c77453cf83fbff6f618cb9cc0.js", "/wildings/owner-app/_expo/static/js/web/index-c7e2d26b899345aed640aa075a97d318.js", "/wildings/owner-app/_expo/static/js/web/[token]-3c722cbf6e54dbbeb30a3a3ee3ece670.js", "/wildings/owner-app/_expo/static/js/web/[did]-2a2aaaa129307f15140971a22b834cd3.js", "/wildings/owner-app/_expo/static/js/web/demo-6323990816bb686dcab3b33d7e6ec148.js", "/wildings/owner-app/_expo/static/js/web/book-b68aff7cd8daa9b5d327ece648db8831.js", "/wildings/owner-app/_expo/static/js/web/index-abf44c56ecfe3a6ee457b5a1c56cb955.js", "/wildings/owner-app/_expo/static/js/web/_layout-16df75e3022851522728da6199adf2f7.js", "/wildings/owner-app/_expo/static/js/web/waitlist-93752bc9a9a8df911b095d236fa3f385.js", "/wildings/owner-app/_expo/static/js/web/__expo-metro-runtime-8c088df87a31e4e6accd81c554ec290d.js", "/wildings/owner-app/_expo/static/js/web/merch-dcc4bf2e12c5c983cc8637b3dae25ae6.js", "/wildings/owner-app/_expo/static/js/web/index-c5020b233ebbd28d31f5543dd1865865.js", "/wildings/owner-app/_expo/static/js/web/refer-9cf3652c6de6015e443d52d85aa73db7.js", "/wildings/owner-app/_expo/static/js/web/profile-7858c56bba02a864da6a44be8f8ce02f.js", "/wildings/owner-app/_expo/static/js/web/index-0b428a479ff6b089927064a714ba6dc8.js", "/wildings/owner-app/_expo/static/js/web/gift-eb5daa22c1465e33034a87271e1b8b3b.js", "/wildings/owner-app/_expo/static/js/web/lost-53fa50fd975a0e31c68fdd69575c2342.js", "/wildings/owner-app/_expo/static/js/web/index-3c5f820b3b21978c61372b3163c55b0a.js", "/wildings/owner-app/_expo/static/js/web/+not-found-585f3164ae74e5ff35af71a4ba7360a3.js", "/wildings/owner-app/_expo/static/js/web/loyalty-f6d17fe0987432e6c679359636231949.js", "/wildings/owner-app/_expo/static/js/web/index-10b44538fce9f65ce117321a623552df.js", "/wildings/owner-app/_expo/static/js/web/basket-4d740db9aeba1d77232a0091a5892917.js", "/wildings/owner-app/_expo/static/js/web/index-837efe1be9c39737e9750ae18a91c7cb.js", "/wildings/owner-app/_expo/static/js/web/whatson-0608a899f634d91b081b758137ce1d33.js", "/wildings/owner-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/wildings/owner-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/wildings/owner-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/wildings/owner-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/wildings/owner-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/wildings/owner-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/wildings/owner-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/wildings/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/wildings/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/wildings/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/wildings/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/wildings/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/wildings/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/wildings/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/wildings/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/wildings/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/wildings/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/wildings/owner-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/wildings/owner-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/wildings/owner-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/wildings/owner-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/wildings/owner-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/wildings/owner-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/wildings/owner-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/wildings/owner-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/wildings/owner-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/wildings/owner-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/wildings/owner-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/wildings/owner-app/assets/assets/brand/wildings.076f4fcd06d19a0af0205c410f461b14.png", "/wildings/owner-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/wildings/owner-app/assets/assets/brand/3idiots-hero.e5dfd53739f05086b1956e72d585a66a.png", "/wildings/owner-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png", "/wildings/owner-app/assets/assets/brand/cecchinis.ebf752fef363247848ae7c0d91938765.png", "/wildings/owner-app/assets/assets/brand/kirkmichael.63b13cde7fd82eb622622b39ac80c394.png", "/wildings/owner-app/assets/assets/brand/3idiots.df4a76d2130f0e5b0042f06a8c88693a.png", "/wildings/owner-app/assets/assets/brand/brae.8de9e89ac30966c6669de990370d8e40.png", "/wildings/owner-app/assets/assets/brand/rupeeroom-hero.969fa372add526aaacf3a6c009b8ac92.png", "/wildings/owner-app/assets/assets/brand/kirkmichael-hero.63b13cde7fd82eb622622b39ac80c394.png", "/wildings/owner-app/assets/assets/brand/williewastles.055a77893ced99bf3a6c5402ba5baac6.png", "/wildings/owner-app/assets/assets/brand/drunkencoo-hero.65c21c4da9e466cf4bffc969639a1427.png", "/wildings/owner-app/assets/assets/brand/pizzaioli-hero.1896657c08264cefb49b401891d5448d.png", "/wildings/owner-app/assets/assets/brand/drunkencoo.f6d92af3b14e4205a3deaf4434754c51.png", "/wildings/owner-app/assets/assets/brand/smokinggoat.20a3a1970596ab43c5d6468d4ed549a7.png", "/wildings/owner-app/assets/assets/brand/greenside.9d1556db97dcb903a3c57e2063ee2255.png", "/wildings/owner-app/assets/assets/brand/abbotsford-hero.78fcb8ee06ee22c4ca659c9254db7512.png", "/wildings/owner-app/assets/assets/brand/rupeeroom.689e6fb536dc0845eeb174a1ec7bd346.png", "/wildings/owner-app/assets/assets/brand/kirkton.bcf8d846df4861474d224a7a77f498fb.png", "/wildings/owner-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/wildings/owner-app/assets/assets/brand/williewastles-hero.b9d53d27b66f903b5618a7177b2ffad4.png", "/wildings/owner-app/assets/assets/brand/pizzaioli.db8c000b62ee407121aa8b90ce45e170.png", "/wildings/owner-app/assets/assets/brand/yasmins-hero.a5aef62e37dfcecbe0afc056186f4ad9.png", "/wildings/owner-app/assets/assets/brand/wildings-hero-logo-text.4661e4b935726f2511f9c17a1567c89a.png", "/wildings/owner-app/assets/assets/brand/yasmins.8482602e9f0a965655924835625cb02b.png", "/wildings/owner-app/assets/assets/brand/kirkton-hero.9d0837b292c2f4f30f4521d806bb28c3.png", "/wildings/owner-app/assets/assets/brand/saltmarsh.85a6a65732635e5148478d743d9ca884.png", "/wildings/owner-app/assets/assets/brand/souters.f4c58d9349b6e1700fe5abcc9e9b665c.png", "/wildings/owner-app/assets/assets/brand/greenside-hero.1caec5a6cb939434cccb5f3a613b50f8.png", "/wildings/owner-app/assets/assets/brand/abbotsford.b26602bba5ce4969733c5422a45ad053.png", "/wildings/owner-app/assets/assets/brand/smokinggoat-hero.0588f17ef0eed7f757f22916cd4d37db.png", "/wildings/owner-app/assets/assets/brand/cecchinis-hero.f77780fcc94fd668cf35d66d6dc52d81.png", "/wildings/owner-app/assets/assets/brand/mrbasrais-hero.4ce74641cfcf52d099157c84005b9d2a.png"]; self.addEventListener('install',e=>e.waitUntil(caches.open(V).then(c=>Promise.all(P.map(u=>fetch(u).then(r=>r.blob().then(b=>c.put(u,new Response(b,{status:200,headers:{'Content-Type':r.headers.get('Content-Type')||b.type}}))))))).then(()=>self.skipWaiting()))); self.addEventListener('activate',e=>e.waitUntil(caches.keys().then(ks=>Promise.all(ks.filter(k=>k.startsWith('cc-wildings-owner-')&&k!==V).map(k=>caches.delete(k)))).then(()=>self.clients.claim()))); self.addEventListener('fetch',e=>{const u=new URL(e.request.url);if(e.request.method!=='GET'||u.origin!==location.origin||!u.pathname.startsWith(B))return;if(e.request.mode==='navigate'){e.respondWith(fetch(e.request).then(r=>r.ok?r:caches.match(B+'index.html')).catch(()=>caches.match(B+'index.html')));return;}e.respondWith(caches.match(e.request,{ignoreSearch:true}).then(r=>r||fetch(e.request)));}); \ No newline at end of file diff --git a/wildings/staff-app/_expo/static/js/web/+not-found-585f3164ae74e5ff35af71a4ba7360a3.js b/wildings/staff-app/_expo/static/js/web/+not-found-585f3164ae74e5ff35af71a4ba7360a3.js new file mode 100644 index 0000000000000000000000000000000000000000..cf2e6d94e8ca98606e0f8533c347ea51139bfdb7 --- /dev/null +++ b/wildings/staff-app/_expo/static/js/web/+not-found-585f3164ae74e5ff35af71a4ba7360a3.js @@ -0,0 +1 @@ +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return c}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]);function c(){return(0,u.jsx)(t.Redirect,{href:n.ENTRY[n.APP_VARIANT]})}},801,[804,30,806,24]); \ No newline at end of file diff --git a/wildings/staff-app/_expo/static/js/web/[did]-2a2aaaa129307f15140971a22b834cd3.js b/wildings/staff-app/_expo/static/js/web/[did]-2a2aaaa129307f15140971a22b834cd3.js new file mode 100644 index 0000000000000000000000000000000000000000..1f0ffb8d5093d5a183dc2a9c0fb7062951faa5c1 --- /dev/null +++ b/wildings/staff-app/_expo/static/js/web/[did]-2a2aaaa129307f15140971a22b834cd3.js @@ -0,0 +1 @@ +__d(function(_g,_r,i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return f}});var t=_r(_d[0]),n=_r(_d[1]),l=e(_r(_d[2])),s=e(_r(_d[3])),r=_r(_d[4]),a=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),g=_r(_d[11]),p=_r(_d[12]);function f(){const{rid:e,did:f}=(0,t.useLocalSearchParams)(),b=(0,u.useRestaurant)(e),j=(0,u.useMenu)(e).find(e=>e.id===f),x=(0,u.useCustomer)(),m=(0,u.useRecipeCards)(e).find(e=>e.id===j?.recipeCardId),y=m?.signOff&&m.photo?(0,h.recipeCards)().photoSource(m.photo):null,k=(0,u.useStore)(e=>e.addLine),[v,w]=(0,n.useState)(()=>(j?.optionGroups??[]).filter(e=>e.required).map(e=>e.choices[0].id)),[S,C]=(0,n.useState)(1),[B,$]=(0,n.useState)(''),[I,P]=(0,n.useState)(!1),[L,T]=(0,n.useState)(!1),[D,O]=(0,n.useState)(!1),[A,M]=(0,n.useState)(!1),R=(0,n.useMemo)(()=>j?(0,d.effectiveAllergens)(j,v):{},[j,v]);if(!b||!j)return(0,p.jsx)(o.Screen,{title:"Not found",children:(0,p.jsx)(o.T,{children:"Dish not found."})});const q=(0,d.conflictsFor)(R,x.allergies),_=(j.price??0)+(j.optionGroups??[]).flatMap(e=>e.choices).filter(e=>v.includes(e.id)).reduce((e,t)=>e+t.priceDelta,0),N=j.soldOut||!j.signOff||null===j.price,G=(e,t)=>{const n=j.optionGroups.find(t=>t.id===e);w(e=>{const l=n.choices.map(e=>e.id);return n.multi?e.includes(t)?e.filter(e=>e!==t):[...e,t]:e.includes(t)&&!n.required?e.filter(e=>e!==t):[...e.filter(e=>!l.includes(e)),t]})},z=e=>{u.useStore.getState().basket.restaurantId!==b.id&&u.useStore.getState().startBasket(b.id,'takeaway'),k({itemId:j.id,qty:S,choiceIds:v,notes:B,override:e?{allergens:q.contains,at:(new Date).toISOString()}:void 0}),P(!1),M(!0)};return(0,p.jsxs)(o.Screen,{title:j.name,subtitle:b.name,right:(0,p.jsx)(a.BasketButton,{}),children:[y?(0,p.jsx)(l.default,{testID:"dish-photo",source:y,accessibilityLabel:`${j.name}${'example'===m?.origin?' (example photo)':''}`,style:{width:'100%',height:200,borderRadius:12},resizeMode:"cover"}):null,(0,p.jsxs)(o.Row,{wrap:!0,gap:6,children:[(0,p.jsx)(o.T,{weight:"bold",size:20,colour:g.colours.gold,children:null===j.price?j.priceNote:(0,c.gbp)(_)}),j.dietary.map(e=>(0,p.jsx)(o.Badge,{kind:"ok",label:e},e))]}),(0,p.jsx)(o.T,{children:j.description}),q.contains.length?(0,p.jsx)(o.Banner,{kind:"danger",title:`Blocked: contains ${q.contains.map(d.allergenLabel).join(', ')}`,children:`You\u2019ve told us: ${x.allergies.filter(e=>q.contains.includes(e.allergen)).map(e=>`${(0,d.allergenLabel)(e.allergen)} \u2014 ${(0,d.severityLabel)(e.severity)}`).join('; ')}. This dish can\u2019t be added unless you deliberately override (for example, ordering for someone else).`}):null,q.may.length?(0,p.jsx)(o.Banner,{kind:"warn",title:`Warning: may contain ${q.may.map(d.allergenLabel).join(', ')}`,children:"Cross-contact is possible (e.g. shared fryer). Please speak to staff before ordering."}):null,(j.optionGroups??[]).map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsxs)(o.T,{weight:"semibold",children:[e.name,e.required?' (required)':' (optional)']}),(0,p.jsx)(o.Row,{wrap:!0,gap:6,children:e.choices.map(t=>(0,p.jsx)(o.Chip,{label:t.label,sub:t.priceDelta?`+${(0,c.gbp)(t.priceDelta)}`:void 0,selected:v.includes(t.id),onPress:()=>G(e.id,t.id)},t.id))})]},e.id)),(0,p.jsx)(o.Card,{children:(0,p.jsx)(r.AllergenPanel,{item:j,map:R,declared:x.allergies})}),b.fictional?null:(0,p.jsx)(o.ExampleAllergenNotice,{}),(0,p.jsx)(o.Field,{label:"Notes for the kitchen (optional)",placeholder:"e.g. no gherkins",value:B,onChangeText:$}),(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Quantity"}),(0,p.jsx)(o.Stepper,{value:S,onChange:C,label:"quantity"})]}),A?(0,p.jsx)(o.Banner,{kind:"success",title:"Added to basket",children:q.contains.length?'Allergy override recorded \u2014 the kitchen will see a large allergy alert.':'Carry on browsing or go to your basket.'}):null,N?(0,p.jsx)(o.Banner,{kind:"warn",children:j.soldOut?'Sold out today.':j.signOff?'Price on the specials board \u2014 ask staff.':'Not available to order online until the head chef signs off its allergens.'}):q.contains.length?(0,p.jsxs)(s.default,{style:{gap:8},children:[(0,p.jsx)(o.Button,{kind:"secondary",label:"Choose something else",onPress:()=>t.router.back()}),(0,p.jsx)(o.Button,{kind:"danger",label:"Override and add anyway\u2026",onPress:()=>{T(!1),O(!1),P(!0)},testID:"override-open"})]}):(0,p.jsxs)(o.Row,{gap:8,children:[(0,p.jsx)(o.Button,{style:{flex:1},label:`Add ${S} to basket \xb7 ${(0,c.gbp)(_*S)}`,onPress:()=>z(!1),testID:"add-to-basket"}),A?(0,p.jsx)(o.Button,{kind:"secondary",label:"Basket",onPress:()=>t.router.push('/customer/basket')}):null]}),(0,p.jsxs)(o.Sheet,{visible:I,onClose:()=>P(!1),title:"Allergy override",children:[(0,p.jsx)(o.Banner,{kind:"danger",title:`${j.name} contains ${q.contains.map(d.allergenLabel).join(', ')}`,children:`Your profile says: ${x.allergies.filter(e=>q.contains.includes(e.allergen)).map(e=>`${(0,d.allergenLabel)(e.allergen)} \u2014 ${(0,d.severityLabel)(e.severity)}`).join('; ')}.`}),(0,p.jsx)(o.Toggle,{label:"I understand this dish contains an allergen I have declared",value:L,onChange:T}),(0,p.jsx)(o.Toggle,{label:"It is for someone without this allergy, or I have spoken to staff",value:D,onChange:O}),(0,p.jsx)(o.Muted,{children:"The override is logged and shown to the kitchen as an allergy alert that must be acknowledged."}),(0,p.jsx)(o.Button,{kind:"danger",disabled:!L||!D,label:"Confirm override and add",onPress:()=>z(!0),testID:"override-confirm"})]})]})}},778,[804,30,196,127,829,830,813,814,816,819,831,821,24]); \ No newline at end of file diff --git a/wildings/staff-app/_expo/static/js/web/[n]-ced785c534ba69ad6c9c35369d7ecc36.js b/wildings/staff-app/_expo/static/js/web/[n]-ced785c534ba69ad6c9c35369d7ecc36.js new file mode 100644 index 0000000000000000000000000000000000000000..c1ced89e3ab9de89839af726f375c95f9fe94a33 --- /dev/null +++ b/wildings/staff-app/_expo/static/js/web/[n]-ced785c534ba69ad6c9c35369d7ecc36.js @@ -0,0 +1 @@ +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return f}});var t=_r(d[0]),r=_r(d[1]),n=_r(d[2]),o=_r(d[3]),u=_r(d[4]),c=_r(d[5]),s=_r(d[6]),l=_r(d[7]);function f(){const{n:f,r:b}=(0,r.useLocalSearchParams)(),E=(0,u.useStore)(t=>t.startBasket),[_,h]=(0,n.useState)(!1),S=b??c.VENUE_RID,j=(0,u.useOrderAtTable)(S),I=(0,s.guestServer)();return(0,n.useEffect)(()=>{t.LIVE_VENUE_BUILD||I||(j&&E(S,'table',String(f)),h(!0))},[S,f,j,I]),t.LIVE_VENUE_BUILD||I?(0,l.jsx)(o.Screen,{title:"Order at the table",children:(0,l.jsx)(o.Banner,{kind:"demo",title:"Scan the code on your table",children:"To order from your table, scan the QR code printed on it. Or order at the bar."})}):_?(0,l.jsx)(r.Redirect,{href:`/customer/${S}`}):null}},794,[833,804,30,813,819,5,836,24]); \ No newline at end of file diff --git a/wildings/staff-app/_expo/static/js/web/[oid]-7fa4f78cb447d1c659e81fff8893269f.js b/wildings/staff-app/_expo/static/js/web/[oid]-7fa4f78cb447d1c659e81fff8893269f.js new file mode 100644 index 0000000000000000000000000000000000000000..f0fcaabb7a82273cae61ec240fcab227e980b17e --- /dev/null +++ b/wildings/staff-app/_expo/static/js/web/[oid]-7fa4f78cb447d1c659e81fff8893269f.js @@ -0,0 +1 @@ +__d(function(g,_r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return f}});var e,t=_r(d[0]),s=_r(d[1]),l=_r(d[2]),r=_r(d[3]),n=(e=r)&&e.__esModule?e:{default:e},o=_r(d[4]),i=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]),p=_r(d[9]),b=_r(d[10]),y=_r(d[11]),j=_r(d[12]);const x=[['new','Placed'],['acknowledged','Accepted'],['preparing','Cooking'],['ready','Ready to collect'],['collected','Collected']],w=[['new','Sent'],['acknowledged','Accepted'],['preparing','Cooking'],['served','Food out'],['closed','Paid']];function f(){const{oid:e}=(0,s.useLocalSearchParams)(),r=(0,b.useOrder)(e),f=(0,b.useRestaurant)(r?.restaurantId),[C,S]=(0,l.useState)(0),[k,T]=(0,l.useState)(''),[v,P]=(0,l.useState)(!1),[M,$]=(0,l.useState)(!1),[R,A]=(0,l.useState)(1),[I,N]=(0,l.useState)(0),[O,B]=(0,l.useState)(r?.split?.ways??1);if(!r||!f)return(0,j.jsx)(c.Screen,{title:"Order",children:(0,j.jsx)(c.T,{children:"Order not found."})});const H='takeaway'===r.type?x:w,_=Math.max(0,H.findIndex(([e])=>e===r.status)),D=Math.round(r.subtotal*I/100),F='table'===r.type?r.subtotal+(r.split?r.tip:D):r.total,q=F-r.paid,L=r.split?.ways??O,W=r.split?.paidShares??0,Y=Math.ceil(F/L),E='collected'===r.status||'closed'===r.status;return(0,j.jsxs)(c.Screen,{title:`Order ${r.ref}`,subtitle:`${f.name} \xb7 ${'table'===r.type?`${(0,t.tableNumbers)(r.tableNo)}`:`Collection at ${r.slotTime?(0,p.hm)(new Date(r.slotTime)):'\u2014'}`}`,children:['takeaway'===r.type?(0,j.jsx)(c.Banner,{kind:"success",title:'ready'===r.status?'Your order is ready!':'Order placed',children:'ready'===r.status?'Head to the bar and give your order number. Staff will check allergies with you at handover.':`Show order number ${r.ref} at the bar when you arrive.`}):null,(0,j.jsxs)(c.Card,{children:[(0,j.jsx)(c.H2,{children:"Status"}),H.map(([e,t],s)=>(0,j.jsxs)(c.Row,{gap:10,children:[(0,j.jsx)(n.default,{style:{width:22,height:22,borderRadius:11,backgroundColor:s<=_?y.colours.gold:y.colours.surface2,borderWidth:1,borderColor:y.colours.gold}}),(0,j.jsx)(c.T,{weight:s===_?'semibold':'regular',colour:s<=_?y.colours.text:y.colours.muted,children:t})]},e)),r.allergyAck?(0,j.jsxs)(c.Muted,{children:["Kitchen signed off your allergies (",r.allergyAck.by,", ",(0,p.hm)(new Date(r.allergyAck.at)),")"]}):r.allergies.length?(0,j.jsx)(c.Muted,{children:"Waiting for the kitchen to sign off your allergies\u2026"}):null,'takeaway'!==r.type||E?null:(0,j.jsxs)(c.Row,{gap:8,children:[(0,j.jsx)(c.Button,{small:!0,kind:'on-my-way'===r.customerSignal?'primary':'secondary',label:"On my way",onPress:()=>b.repo.orders.customerSignal(r.id,'on-my-way')}),(0,j.jsx)(c.Button,{small:!0,kind:'here'===r.customerSignal?'primary':'secondary',label:"I\u2019m here",onPress:()=>b.repo.orders.customerSignal(r.id,'here')})]})]}),(0,j.jsxs)(c.Card,{children:[(0,j.jsx)(c.H2,{children:"Items"}),r.lines.map((e,t)=>(0,j.jsxs)(n.default,{children:[(0,j.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(c.T,{style:{flex:1},children:[e.qty,"\xd7 ",e.name]}),(0,j.jsx)(c.T,{children:(0,h.gbp)(e.unitPrice*e.qty)})]}),e.choices.length?(0,j.jsx)(c.Muted,{children:e.choices.join(' \xb7 ')}):null,e.overridden?(0,j.jsx)(c.Badge,{kind:"red",label:`Allergy override: ${e.contains.map(u.allergenLabel).join(', ')}`}):null]},t)),(0,j.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(c.Muted,{children:"Subtotal"}),(0,j.jsx)(c.T,{children:(0,h.gbp)(r.subtotal)})]}),r.giftCardApplied?(0,j.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(c.Muted,{children:"Of which gift card"}),(0,j.jsxs)(c.T,{colour:y.colours.ok,children:["\u2212",(0,h.gbp)(r.giftCardApplied)]})]}):null,r.tip?(0,j.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(c.Muted,{children:"Tip"}),(0,j.jsx)(c.T,{children:(0,h.gbp)(r.tip)})]}):null,(0,j.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(c.T,{weight:"semibold",children:"Paid (test, no real money)"}),(0,j.jsx)(c.T,{weight:"semibold",colour:y.colours.gold,children:(0,h.gbp)(r.paid)})]})]}),'table'===r.type&&'closed'!==r.status&&'cancelled'!==r.status?(0,j.jsxs)(c.Card,{highlight:y.colours.gold,children:[(0,j.jsxs)(c.H2,{children:["Your bill \u2014 ",(0,t.tableNumbers)(r.tableNo)]}),r.split?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(c.T,{children:["Total ",(0,h.gbp)(F)," \xb7 split ",L," way",L>1?'s':''," \xb7 ",(0,h.gbp)(Y)," each"]}),(0,j.jsxs)(c.T,{children:["Shares paid: ",W," of ",L," \xb7 remaining ",(0,h.gbp)(q)]}),L>1?(0,j.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(c.T,{children:"Shares to pay now"}),(0,j.jsx)(c.Stepper,{value:R,onChange:A,min:1,max:L-W,label:"shares"})]}):null,(0,j.jsx)(c.Button,{label:`Pay ${L>1?`${R} share${R>1?'s':''}`:'bill'} \xb7 ${(0,h.gbp)(Math.min(q,Y*R))}`,onPress:()=>$(!0),testID:"pay-bill"})]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(c.T,{weight:"semibold",children:"Add a tip?"}),(0,j.jsx)(c.Row,{wrap:!0,children:[0,10,12.5,15].map(e=>(0,j.jsx)(c.Chip,{label:e?`${e}%`:'No tip',selected:I===e,onPress:()=>N(e)},e))}),(0,j.jsx)(c.Muted,{children:"Tips go to staff under the restaurant\u2019s tipping policy (Employment (Allocation of Tips) Act 2023)."}),(0,j.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(c.T,{weight:"semibold",children:"Split evenly between"}),(0,j.jsx)(c.Stepper,{value:O,onChange:B,min:1,max:8,label:"people"})]}),(0,j.jsxs)(c.T,{children:["Total ",(0,h.gbp)(r.subtotal+D),O>1?` \xb7 ${(0,h.gbp)(Math.ceil((r.subtotal+D)/O))} each`:'']}),(0,j.jsx)(c.Button,{label:"Get the bill",onPress:()=>b.repo.orders.setSplit(r.id,O,D),testID:"get-bill"})]})]}):null,!E||r.rated||v?null:(0,j.jsxs)(c.Card,{highlight:y.colours.gold,children:[(0,j.jsx)(c.H2,{children:"How was everything?"}),(0,j.jsxs)(c.Muted,{children:["One tap \u2014 this goes privately to ",f.name," only, never published."]}),(0,j.jsx)(i.Stars,{value:C,onChange:S}),C?(0,j.jsx)(c.Field,{label:"Anything to add? (optional)",value:k,onChangeText:T}):null,(0,j.jsx)(c.Button,{label:"Send feedback",disabled:!C,onPress:()=>{b.repo.feedback.add({restaurantId:f.id,orderId:r.id,customerId:r.customerId,customerName:r.customerName,stars:C,comment:k,context:'table'===r.type?`${(0,t.tableNumbers)(r.tableNo)}`:`Takeaway ${r.ref}`}),P(!0)},testID:"send-rating"})]}),v||r.rated?(0,j.jsx)(c.Banner,{kind:"success",children:"Thanks \u2014 your feedback went privately to the restaurant."}):null,E?(0,j.jsx)(c.Button,{kind:"secondary",label:"View stamp card",onPress:()=>s.router.push(`/customer/${f.id}/loyalty`)}):null,(0,j.jsx)(o.MockPay,{visible:M,onClose:()=>$(!1),amount:Math.min(q,Y*R),restaurantId:f.id,title:`Pay \u2014 ${(0,t.tableNumbers)(r.tableNo)}`,onPaid:e=>{b.repo.orders.payTable(r.id,{shares:R,giftCardCode:e.giftCardCode}),$(!1),A(1)}})]})}},791,[808,804,30,127,834,832,813,814,816,818,819,821,24]); \ No newline at end of file diff --git a/wildings/staff-app/_expo/static/js/web/[section]-93e8e4ffe952e5b3c505e21ca771e570.js b/wildings/staff-app/_expo/static/js/web/[section]-93e8e4ffe952e5b3c505e21ca771e570.js new file mode 100644 index 0000000000000000000000000000000000000000..11f3bab84de38d8d8874b5ec2723dd3ea24b04a1 --- /dev/null +++ b/wildings/staff-app/_expo/static/js/web/[section]-93e8e4ffe952e5b3c505e21ca771e570.js @@ -0,0 +1 @@ +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return s}});var t=r(d[0]);r(d[1]);var n=r(d[2]),c=r(d[3]),o=r(d[4]),f=r(d[5]);function s(){const{section:s}=(0,t.useLocalSearchParams)();return(0,c.canShow)('chef')?s&&(0,o.chefSectionAllowed)(String(s))?(0,f.jsx)(n.ChefApp,{section:String(s)},String(s)):(0,f.jsx)(t.Redirect,{href:"/kitchen"}):(0,f.jsx)(t.Redirect,{href:c.ENTRY[c.APP_VARIANT]})}},775,[804,30,805,806,807,24]); \ No newline at end of file diff --git a/wildings/staff-app/_expo/static/js/web/[token]-6c815095a584dc0399e5918b52874b98.js b/wildings/staff-app/_expo/static/js/web/[token]-6c815095a584dc0399e5918b52874b98.js new file mode 100644 index 0000000000000000000000000000000000000000..bbb9c120ac56fbfa8ba9e0a1c2e306f6558c994f --- /dev/null +++ b/wildings/staff-app/_expo/static/js/web/[token]-6c815095a584dc0399e5918b52874b98.js @@ -0,0 +1,3 @@ +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return u}});var t=r(d[0]);r(d[1]);var n=r(d[2]),o=r(d[3]),c=r(d[4]),s=r(d[5]),l=r(d[6]);function u(){const{token:u}=(0,t.useLocalSearchParams)(),h=(0,c.cleanToken)(u);return h?(0,s.guestServer)()?(0,l.jsx)(o.TableOrderLive,{token:h}):(0,l.jsx)(n.Screen,{title:"Order at the table",children:(0,l.jsx)(n.Banner,{kind:"demo",title:"Not connected",children:"This preview isn't connected to a venue, so table orders can't be sent from here."})}):(0,l.jsx)(n.Screen,{title:"Order at the table",children:(0,l.jsx)(n.Banner,{kind:"warn",title:"This code isn't working",children:"Please scan the QR code on your table again, or ask a member of staff."})})}},795,[804,30,813,874,876,836,24]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TableOrderLive=function({token:e}){const[s,b]=(0,n.useState)(null),[m,f]=(0,n.useState)(null),[j,y]=(0,n.useState)([]),[k,w]=(0,n.useState)(null),T=(0,h.useCustomer)(),[C,S]=(0,n.useState)(()=>(T?.allergies??[]).map(e=>e.allergen)),[v,P]=(0,n.useState)(''),[O,N]=(0,n.useState)(''),[B,I]=(0,n.useState)(!1),[L,M]=(0,n.useState)(null),[R,$]=(0,n.useState)([]),A=(0,n.useCallback)(async()=>{try{b(await(0,c.tablePublic)(e)),f(null)}catch(e){f(e?.message??'Could not load the menu.')}},[e]),D=(0,n.useCallback)(async()=>{try{$(await(0,c.myTableOrders)(e))}catch{}},[e]);(0,n.useEffect)(()=>{A(),D();const e=setInterval(()=>{D(),A()},8e3);return()=>clearInterval(e)},[A,D]);const _=s?.menu??[];(0,n.useEffect)(()=>{y(e=>e.filter(e=>_.some(t=>t.id===e.id&&!t.soldOut)))},[s]);const q=(0,n.useMemo)(()=>{const e=new Map;for(const t of _)e.set(t.section,[...e.get(t.section)??[],t]);return[...e.entries()]},[s]),Y=(0,d.cartTotal)(j,_),W='yes'===k?C.map(e=>({allergen:e,severity:T?.allergies?.find(t=>t.allergen===e)?.severity??'allergy'})):[],E=(0,d.allergyClashes)(j,_,W.map(e=>e.allergen)),z=e=>j.find(t=>t.id===e)?.qty??0,G=(e,t)=>y(l=>t<=0?l.filter(t=>t.id!==e):l.some(t=>t.id===e)?l.map(l=>l.id===e?{...l,qty:t}:l):[...l,{id:e,qty:t,note:''}]),H=(e,t)=>y(l=>l.map(l=>l.id===e?{...l,note:t}:l)),V=async()=>{I(!0),M(null);try{const t=await(0,c.sendTableOrder)(e,j,{note:O,name:v,allergies:W});y([]),N(''),M({kind:'success',text:t.held?`Order ${t.ref} sent. A member of staff will check it, then it goes to the kitchen.`:`Order ${t.ref} sent to the kitchen.`}),D()}catch(e){M({kind:'warn',text:e?.message??'The order was not sent. Please try again or ask a member of staff.'}),A()}finally{I(!1)}};if(m)return(0,x.jsxs)(r.Screen,{title:"Order at the table",children:[(0,x.jsx)(r.Banner,{kind:"warn",title:"Couldn't open the menu",children:m}),(0,x.jsx)(r.Button,{label:"Try again",onPress:()=>{A()}})]});if(!s)return(0,x.jsx)(r.Screen,{title:"Order at the table",children:(0,x.jsx)(r.Muted,{children:"Opening the menu\u2026"})});if(!s.ok)return(0,x.jsx)(r.Screen,{title:"Order at the table",children:(0,x.jsx)(r.Banner,{kind:"warn",title:"This code isn't working",children:s.reason??'Please ask a member of staff.'})});const F=s.open&&j.length>0&&null!==k&&('none'===k||C.length>0)&&!B;return(0,x.jsxs)(r.Screen,{title:`${(0,l.tableNumbers)(s.table)}`,subtitle:s.venueName,footer:s.open?(0,x.jsx)(r.Button,{label:B?'Sending\u2026':j.length?`Send order to the kitchen (${(0,o.gbp)(Y)})`:'Add a dish to order',disabled:!F,onPress:()=>{V()},testID:"send-table-order-live"}):void 0,children:[(0,x.jsxs)(r.Muted,{children:["Tip: add dishes, answer the allergy question, then send. Staff bring it to ",(0,l.tableNumbers)(s.table),". ",d.PAY_WORDS]}),s.tip?(0,x.jsx)(r.Banner,{kind:"demo",children:s.tip}):null,s.open?null:(0,x.jsx)(r.Banner,{kind:"warn",title:"Not taking table orders right now",children:s.reason}),s.open&&s.staffAccept&&!R.some(e=>e.accepted)?(0,x.jsx)(r.Muted,{children:"The first order from your phone is checked by a member of staff before it goes to the kitchen."}):null,L?(0,x.jsx)(r.Banner,{kind:L.kind,children:L.text}):null,R.length?(0,x.jsx)(a.default,{testID:"my-table-orders",children:(0,x.jsxs)(r.Card,{children:[(0,x.jsx)(r.T,{weight:"semibold",children:"Your orders at this table"}),R.map(e=>(0,x.jsxs)(a.default,{style:{gap:2,paddingVertical:4},children:[(0,x.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(r.T,{children:e.ref}),(0,x.jsx)(r.T,{size:13,colour:'cancelled'===e.status?u.colours.amber:u.colours.gold,children:(0,d.guestStatusWords)(e)})]}),(0,x.jsxs)(r.Muted,{children:[e.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')," \xb7 ",(0,o.gbp)(e.totalPence)," to pay at the bar or till"]})]},e.id))]})}):null,s.open?q.map(([e,t])=>(0,x.jsxs)(a.default,{style:{gap:8},children:[(0,x.jsx)(r.H2,{children:e}),t.map(e=>(0,x.jsxs)(r.Card,{children:[(0,x.jsxs)(r.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,x.jsxs)(a.default,{style:{flex:1,gap:2},children:[(0,x.jsx)(r.T,{weight:"semibold",children:e.name}),e.description?(0,x.jsx)(r.Muted,{children:e.description}):null,(0,x.jsxs)(r.T,{size:13,colour:u.colours.muted,children:[e.allergens.length?`Contains: ${e.allergens.map(i.allergenLabel).join(', ')}`:'No allergens listed: ask staff if unsure',e.mayContain.length?` \xb7 May contain: ${e.mayContain.map(i.allergenLabel).join(', ')}`:'']})]}),(0,x.jsx)(r.T,{weight:"semibold",colour:u.colours.gold,children:(0,o.gbp)(e.pricePence)})]}),e.soldOut?(0,x.jsx)(r.Badge,{kind:"amber",label:"Sold out today"}):z(e.id)?(0,x.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(r.Stepper,{value:z(e.id),min:0,max:20,onChange:t=>G(e.id,t),label:e.name}),(0,x.jsx)(r.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>G(e.id,0)})]}):(0,x.jsx)(r.Button,{small:!0,kind:"secondary",label:"Add",accessibilityLabel:`Add ${e.name}`,onPress:()=>G(e.id,1)})]},e.id))]},e)):null,s.open&&!_.length?(0,x.jsx)(r.Banner,{kind:"demo",title:"No dishes to order yet",children:"The venue hasn't put any priced dishes on the table menu yet. Please order at the bar."}):null,s.open&&j.length?(0,x.jsx)(a.default,{testID:"table-cart",children:(0,x.jsxs)(r.Card,{children:[(0,x.jsx)(r.T,{weight:"semibold",children:"Your order"}),j.map(e=>{const l=_.find(t=>t.id===e.id);return(0,x.jsxs)(a.default,{style:{gap:4},children:[(0,x.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsxs)(r.T,{children:[e.qty,"\xd7 ",l?.name]}),(0,x.jsx)(r.T,{children:(0,o.gbp)(e.qty*(l?.pricePence??0))})]}),(0,x.jsx)(t.TextInput,{style:p,value:e.note,onChangeText:t=>H(e.id,t),placeholder:"Note for the kitchen (optional), e.g. no onions",placeholderTextColor:u.colours.muted,maxLength:140,accessibilityLabel:`Note for ${l?.name}`,testID:`table-note-${e.id}`})]},e.id)}),(0,x.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(r.T,{weight:"semibold",children:"Total"}),(0,x.jsx)(r.T,{weight:"semibold",children:(0,o.gbp)(Y)})]})]})}):null,s.open?(0,x.jsx)(a.default,{testID:"table-allergy",children:(0,x.jsxs)(r.Card,{children:[(0,x.jsx)(r.T,{weight:"semibold",children:"Does anyone at the table have a food allergy?"}),(0,x.jsx)(r.Muted,{children:"We ask everyone, so the kitchen can keep you safe."}),(0,x.jsxs)(r.Row,{gap:8,children:[(0,x.jsx)(r.Chip,{label:"No allergies",selected:'none'===k,onPress:()=>w('none')}),(0,x.jsx)(r.Chip,{label:"Yes, allergies",selected:'yes'===k,onPress:()=>w('yes')})]}),'yes'===k?(0,x.jsx)(r.Row,{wrap:!0,gap:6,children:i.ALLERGENS.map(e=>(0,x.jsx)(r.Chip,{label:e.short,selected:C.includes(e.id),onPress:()=>S(t=>t.includes(e.id)?t.filter(t=>t!==e.id):[...t,e.id])},e.id))}):null,E.length?(0,x.jsxs)(r.Banner,{kind:"warn",title:"Check with staff",children:[E.map(e=>e.name).join(', ')," ",E.length>1?'contain':'contains'," or may contain an allergy you picked. The kitchen will see your allergies on the ticket."]}):null]})}):null,s.open?(0,x.jsxs)(r.Card,{children:[(0,x.jsx)(r.T,{weight:"semibold",children:"Anything else?"}),(0,x.jsx)(t.TextInput,{style:p,value:v,onChangeText:P,placeholder:"Your first name (optional)",placeholderTextColor:u.colours.muted,maxLength:40,accessibilityLabel:"Your first name (optional)"}),(0,x.jsx)(t.TextInput,{style:p,value:O,onChangeText:N,placeholder:"Note for the staff (optional)",placeholderTextColor:u.colours.muted,maxLength:300,accessibilityLabel:"Note for the staff (optional)"})]}):null,(0,x.jsx)(a.default,{testID:"pay-placeholder",children:(0,x.jsxs)(r.Card,{children:[(0,x.jsx)(r.T,{weight:"semibold",children:"Paying"}),(0,x.jsx)(r.T,{children:d.PAY_WORDS}),(0,x.jsx)(r.Muted,{children:"No card details are asked for or kept in this app."})]})})]})};var e,t=_r(_d[0]),l=_r(_d[1]),n=_r(_d[2]),s=_r(_d[3]),a=(e=s)&&e.__esModule?e:{default:e},r=_r(_d[4]),i=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),x=_r(_d[11]);const p={borderWidth:1,borderColor:u.colours.border,borderRadius:10,padding:10,color:u.colours.text,backgroundColor:u.colours.surface2}},874,[877,808,30,127,813,814,816,876,875,819,821,24]); +__d(function(g,_r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"tablePublic",{enumerable:!0,get:function(){return s}}),e.sendTableOrder=async function(t,r,a){if(!await(0,n.guestSession)())throw new Error('No connection. Try again when you are back online.');return(0,n.rpc)('guest_table_order',{p_token:t,p_lines:r.map(t=>({id:t.id,qty:t.qty,note:t.note.trim().slice(0,140)})),p_note:a.note.trim().slice(0,300)||null,p_allergies:a.allergies.map(t=>({allergen:t.allergen,severity:t.severity})),p_name:a.name.trim().slice(0,40)||null})},e.myTableOrders=async function(t){return await(0,n.guestSession)()?await(0,n.rpc)('guest_table_my_orders',{p_token:t})??[]:[]},e.loadTableSettings=async function(){const{data:t,error:n}=await a().from('table_order_settings').select('*').eq('venue_id',o()).maybeSingle();if(n)throw n;return(0,r.fromRow)(t)},e.saveTableSettings=async function(t,n){const{error:s}=await a().from('table_order_settings').upsert({venue_id:o(),...(0,r.toRow)(t),updated_at:(new Date).toISOString(),updated_by:n.slice(0,80)});if(s)throw s},e.listTableCodes=async function(){const{data:t,error:n}=await a().from('table_qr_codes').select('table_no, token, created_at').eq('venue_id',o()).eq('is_on',!0);if(n)throw n;return(t??[]).map(t=>({table:String(t.table_no),token:String(t.token),createdAt:String(t.created_at)})).sort((t,n)=>Number(t.table)-Number(n.table))},Object.defineProperty(e,"makeTableCodes",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"renewTableCode",{enumerable:!0,get:function(){return c}}),e.watchTableSettings=function(t){const r=n.useSync.getState().venueId;if(!r)return()=>{};const o=a().channel(`tos-${r}-${Math.random().toString(36).slice(2,8)}`).on('postgres_changes',{event:'*',schema:'public',table:'table_order_settings',filter:`venue_id=eq.${r}`},()=>t()).subscribe();return()=>{a().removeChannel(o)}};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]);const a=()=>(0,t.getSupabase)(),o=()=>{const t=n.useSync.getState().venueId;if(!t)throw new Error('Not connected to the venue yet.');return t},s=t=>(0,n.rpc)('table_public',{p_token:t});const l=t=>(0,n.rpc)('table_qr_make',{p_venue:o(),p_tables:t}),c=t=>(0,n.rpc)('table_qr_renew',{p_venue:o(),p_table:t})},875,[863,820,876]); \ No newline at end of file diff --git a/wildings/staff-app/_expo/static/js/web/__common-d0c175ab7fec95d4778dc07f4318794d.js b/wildings/staff-app/_expo/static/js/web/__common-d0c175ab7fec95d4778dc07f4318794d.js new file mode 100644 index 0000000000000000000000000000000000000000..11997749b67ec0beafbe7f9d33481bea29552372 --- /dev/null +++ b/wildings/staff-app/_expo/static/js/web/__common-d0c175ab7fec95d4778dc07f4318794d.js @@ -0,0 +1,462 @@ +__d(function(g,r,i,a,m,e,d){"use strict";function t(t,n){return Object.keys(t).forEach(function(c){"default"===c||Object.prototype.hasOwnProperty.call(n,c)||Object.defineProperty(n,c,{enumerable:!0,get:function(){return t[c]}})}),t}Object.defineProperty(e,"__esModule",{value:!0}),r(d[0]),t(r(d[1]),e),t(r(d[2]),e),t(r(d[3]),e),t(r(d[4]),e)},804,[1210,1211,1221,1222,1224]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ChefApp=function({section:e}={}){const{r:s,rid:t,me:i,now:$}=(0,G.useChef)(3e4),_=(0,W.useSignedIn)(),K=_?.id??G.CHEF_ID;(0,o.useSoldOutLink)(!0,(_?.name??i).replace(' (example)',''));const V=e?me[e]:void 0,[ue,je]=(0,P.useState)(V?.tab??'home'),[we,Ce]=(0,P.useState)(V?.k??null),[Te,ve]=(0,P.useState)(V?.stock??'levels'),[Se,Pe]=(0,P.useState)(void 0),[Ie,Re]=(0,P.useState)(V?.gp??'dishes'),Be=(0,P.useRef)(null),He=(0,f.ymd)($),Ae=(0,f.ymd)(new Date($.getTime()+864e5));(0,u.useTipsPosted)(t,He);const Oe=(0,Q.useTravelDay)('chef',He),De='home'===ue&&!Oe;(0,v.useKitchenTodoChime)(t,He,()=>Fe('kitchen','bookings')),(0,de.useAlertWatcher)(t,{kinds:['takeaway']}),(0,P.useEffect)(()=>{(0,W.ensureAttendance)((new Date).toISOString().slice(0,10),$)},[]);const Le=(0,P.useRef)({t:'home',k:null});Le.current={t:ue,k:we};const Ee=(0,P.useRef)([]),$e=(0,n.useScrollMemory)(Be),Fe=(0,P.useCallback)((e,s=null)=>{const t=Le.current;t.t===e&&t.k===s||(Ee.current=[...Ee.current,{...t,y:$e.leave()}].slice(-30),$e.restore(0)),je(e),Ce(s)},[]),We=(0,P.useCallback)(()=>{if((0,l.runBackLayer)())return!0;const e=Le.current;let s=Ee.current.pop();for(;s&&s.t===e.t&&s.k===e.k;)s=Ee.current.pop();if(!s&&'home'===e.t&&!e.k)return!1;const t=s??{t:'home',k:null};return $e.leave(),je(t.t),Ce(t.k),$e.restore(t.y??0),!0},[]);(0,l.useWebBack)(We);const Ge=(0,l.useInnerBackShown)();(0,P.useEffect)(()=>{d.PITCH&&(globalThis.__pitchGo=(e,s=null,t)=>{'stock'===e&&t&&ve(t),'gp'===e&&t&&Re(t),Fe(e,s)})},[Fe]),(0,p.useShiftReminders)({rid:t,staffId:K,name:i,kitchen:!0}),(0,C.useScheduledNotices)({rid:t,staffId:_?.id??'',name:i,onOpen:()=>Fe('kitchen','orderlists')}),(0,T.useOffRotaPrompt)({rid:t,staffId:_?.id??''}),(0,P.useEffect)(()=>{const e=I.default.addEventListener('hardwareBackPress',We);return()=>e.remove()},[We]);const Me=we?ye.find(e=>e.id===we):null,Ne=(0,H.default)().width<430,ze=Me?Me.title:{home:'Today in the kitchen',stock:'Stock',gp:'GP & costing',creator:ie.CREATOR_TITLE,orders:'Ordering',kitchen:'Kitchen'}[ue];return(0,be.jsxs)(O.SafeAreaView,{style:{flex:1,backgroundColor:F.colours.bg},edges:['top','bottom'],children:[(0,be.jsxs)(A.default,{style:{paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:F.colours.border,gap:6},children:[(0,be.jsx)(A.default,{style:{alignItems:'center'},children:(0,be.jsx)(A.default,{testID:"header-me",accessibilityLabel:`Signed in as ${i.replace(' (example)','')}, Head Chef`,style:{borderWidth:1,borderColor:F.colours.gold,borderRadius:16,paddingHorizontal:10,paddingVertical:4,maxWidth:'86%'},children:(0,be.jsxs)(E.Row,{gap:6,children:[(0,be.jsx)(se.StaffAvatar,{id:G.CHEF_ID,size:24,ring:!1}),(0,be.jsxs)(E.T,{size:13,weight:"semibold",colour:F.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[i.replace(' (example)','')," \xb7 Head Chef"]})]})})}),(0,be.jsxs)(E.Row,{gap:10,children:[(0,be.jsx)(D.RestaurantLogo,{rid:t,size:Ne?36:44}),(0,be.jsxs)(A.default,{style:{flex:1,minWidth:0},children:[(0,be.jsxs)(E.Row,{gap:6,children:[(0,be.jsx)(E.T,{weight:"semibold",size:Ne?15:17,numberOfLines:1,style:{flexShrink:1},children:s.name}),(0,be.jsx)(w.AppBadge,{label:"CHEF"})]}),(0,be.jsx)(E.T,{size:12,colour:F.colours.muted,numberOfLines:1,children:"Head Chef app"}),(0,be.jsx)(D.PoweredBy,{})]}),(0,be.jsx)(R.default,{accessibilityRole:"button",accessibilityLabel:"Open CoverCharge for Staff",onPress:()=>{const e=(0,te.appUrl)('staff');e&&window.location.assign(e)},style:{borderWidth:1,borderColor:F.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:3,minHeight:44,justifyContent:'center'},children:(0,be.jsx)(E.T,{size:13,colour:F.colours.gold,children:"Staff app \u203a"})}),(0,be.jsx)(L.VoiceSlot,{})]})]}),(0,be.jsxs)(B.default,{ref:Be,...$e.props,contentContainerStyle:{padding:14,paddingBottom:60,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:[(0,be.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:['home'===ue&&!we||Ge?null:(0,be.jsx)(l.BackButton,{onPress:We}),(0,be.jsx)(E.T,{size:22,weight:"bold",style:{flex:1,textAlign:'home'===ue&&!we||Ge?'left':'right'},children:ze})]}),'home'===ue?(0,be.jsx)(Q.DayBar,{app:"chef",today:He}):null,'home'===ue&&Oe?(0,be.jsx)(Q.DayView,{rid:t,day:Oe,today:He,app:"chef"}):null,'home'===ue?(0,be.jsx)(ee.WhoBar,{}):null,De&&_?(0,be.jsx)(h.MyTasksToday,{rid:t,staffId:_.id,name:_.name,onShift:(0,p.shiftNow)(_.id,$.getTime()).on}):null,De?(0,be.jsx)(u.TodaysTipsCard,{rid:t,today:He}):null,De?(0,be.jsx)(u.TipsPotCard,{rid:t,today:He}):null,De?(0,be.jsx)(b.CoversToday,{rid:t,onPress:()=>Fe('kitchen','bookings')}):null,De?(0,be.jsx)(k.LastFoodBanner,{rid:t,now:$}):null,De?(0,be.jsx)(y.NextTableFreeCard,{rid:t,now:$}):null,De?(0,be.jsx)(x.KitchenSignoffs,{rid:t,today:He,by:i,app:"chef"}):null,De?(0,be.jsxs)(A.default,{style:{gap:4},children:[(0,be.jsx)(x.PlattersBooked,{rid:t,date:He,label:"Platters booked today"}),(0,be.jsx)(x.PlattersBooked,{rid:t,date:Ae,label:"Platters booked tomorrow"})]}):null,De?(0,be.jsx)(pe.ChefAssistantButton,{}):null,De?(0,be.jsx)(xe,{go:(e,s)=>{'stock'===e&&s&&ve(s),'gp'===e&&s&&Re(s),'orders'===e&&Pe(s),Fe(e,'kitchen'===e?s??null:null)}}):null,'stock'===ue?(0,be.jsx)(U.StockScreen,{initial:Te},Te):null,'gp'===ue?(0,be.jsx)(M.GpScreen,{initial:Ie},Ie):null,'creator'===ue?(0,be.jsx)(ie.DishCreator,{rid:t,canPublish:!1}):null,'orders'===ue?(0,be.jsx)(z.OrdersScreen,{focus:Se},Se??'all'):null,'kitchen'!==ue||Me?null:(0,be.jsxs)(A.default,{style:{gap:10},children:[(0,be.jsx)(A.default,{style:{borderRadius:14,borderWidth:1,borderColor:F.colours.border,backgroundColor:F.colours.surface,overflow:'hidden'},children:ye.map((e,s)=>(0,be.jsx)(R.default,{accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>Fe(ue,e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:F.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,be.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,be.jsxs)(A.default,{style:{flex:1},children:[(0,be.jsx)(E.T,{weight:"medium",children:e.title}),(0,be.jsx)(E.Muted,{children:e.sub})]}),(0,be.jsx)(E.T,{colour:F.colours.muted,children:"\u203a"})]})},e.id))}),(0,be.jsx)(E.Muted,{children:"Head Chef sees kitchen, stock, food costs and GP. Payroll, wages and the restaurant's billing stay in CoverCharge for Managers."}),(0,be.jsxs)(E.Muted,{center:!0,children:["Head Chef app \xb7 ",r.APP_VERSION," \xb7 ",'live'===ge.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),'myshift'===we&&K?(0,be.jsxs)(A.default,{style:{gap:10},testID:"chef-myshift",children:[(0,be.jsx)(X.ClockInOut,{}),(0,be.jsx)(Z.MyUpcomingShifts,{staffId:K})]}):null,'mypay'===we?(0,be.jsxs)(A.default,{style:{gap:10},testID:"chef-mypay",children:[(0,be.jsx)(Y.MyPeriods,{staffId:K}),(0,be.jsx)(q.MyHoursPay,{staffId:K}),(0,be.jsx)(J.MyTips,{staffId:K}),(0,be.jsxs)(E.Card,{children:[(0,be.jsx)(E.T,{weight:"semibold",children:"Phone notifications"}),(0,be.jsx)(E.Muted,{children:"Get reminders like \u201cMills milk order\u201d on this phone, even with the app closed (once your manager switches phone notifications on). iPhone: add the app to your Home Screen first (iOS 16.4 or later)."}),(0,be.jsx)(c.PushButton,{})]})]}):null,'bookings'===we?(0,be.jsx)(S.TodaysBookings,{rid:t,today:He,by:i,app:"chef"}):null,'specials'===we?(0,be.jsx)(le.SpecialsEditor,{rid:t,me:i,app:"chef",now:$}):null,'prep'===we?(0,be.jsx)(N.PrepScreen,{}):null,'live'===we?(0,be.jsx)(N.TeamScreen,{}):null,'waste'===we?(0,be.jsx)(N.WasteScreen,{}):null,'recipes'===we?(0,be.jsx)(ce.RecipeCards,{rid:t,actor:{name:i,role:'head-chef'},mode:"edit"}):null,'allergens'===we?(0,be.jsx)(N.AllergenScreen,{openCards:()=>Fe('kitchen','recipes')}):null,'compliance'===we?(0,be.jsx)(N.ComplianceScreen,{}):null,'takings'===we?(0,be.jsx)(u.CashUpScreen,{rid:t,today:He,canEdit:!1,chartsOnly:!0,who:{id:K,name:i.replace(' (example)','')}}):null,'board'===we?(0,be.jsx)(he.QuestionBoard,{rid:t,today:He,manager:!1,by:""}):null,'teamtasks'===we?(0,be.jsx)(h.KitchenTeamTasks,{rid:t,actor:_}):null,'orderlists'===we?(0,be.jsx)(j.OrderListsScreen,{rid:t,today:He,editor:!0,who:{id:K,name:i.replace(' (example)','')}}):null,'foodsafety'===we?(0,be.jsx)(c.FoodSafetyCard,{children:(0,be.jsx)(R.default,{accessibilityRole:"button",onPress:()=>Fe('kitchen','haccp'),children:(0,be.jsx)(E.T,{colour:F.colours.gold,children:"Today\u2019s temperature log \u203a"})})}):null,'haccp'===we?(0,be.jsx)(ne.HaccpLog,{mode:"chef",me:i,meId:G.CHEF_ID,now:$}):null,'accidents'===we?(0,be.jsx)(oe.AccidentBook,{app:"chef",me:i,meId:G.CHEF_ID,now:$,seeAll:!1}):null]}),(0,be.jsx)(A.default,{accessibilityRole:"tablist",style:{flexDirection:'row',borderTopWidth:1,borderColor:F.colours.border,backgroundColor:F.colours.surface},children:ke.map(e=>{const s=ue===e.id;return(0,be.jsxs)(R.default,{accessibilityRole:"tab",accessibilityState:{selected:s},accessibilityLabel:e.label,onPress:()=>Fe(e.id),style:{flex:1,alignItems:'center',paddingVertical:8,paddingHorizontal:2,minHeight:52,gap:2},children:[(0,be.jsx)(fe.Icon,{name:e.icon,colour:s?F.colours.gold:F.colours.muted}),(0,be.jsx)(E.T,{size:e.label.length>10?10:11,weight:s?'semibold':'regular',colour:s?F.colours.gold:F.colours.muted,center:!0,children:e.label})]},e.id)})}),(0,be.jsx)(pe.ChefAssistantSheet,{go:(e,s)=>{'orders'===e?(Pe(s),Fe('orders')):'gp'===e?Fe('gp'):Fe('kitchen',e)}}),(0,be.jsx)(re.AlertHost,{variant:"chef",rid:t,skipTakeaway:!0}),(0,be.jsx)(ae.KitchenFlash,{rid:t,me:i})]})};var s=_r(_d[0]),t=_r(_d[1]),o=_r(_d[2]),i=_r(_d[3]),n=_r(_d[4]),l=_r(_d[5]),r=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]),f=_r(_d[12]),b=_r(_d[13]),k=_r(_d[14]),y=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),w=_r(_d[18]),C=_r(_d[19]),T=_r(_d[20]),v=_r(_d[21]),S=_r(_d[22]),P=_r(_d[23]),I=e(_r(_d[24]));_r(_d[25]);var R=e(_r(_d[26])),B=e(_r(_d[27])),H=e(_r(_d[28])),A=e(_r(_d[29])),O=_r(_d[30]),D=_r(_d[31]),L=_r(_d[32]),E=_r(_d[33]),$=_r(_d[34]),F=_r(_d[35]),W=_r(_d[36]),_=_r(_d[37]),G=_r(_d[38]),M=_r(_d[39]),N=_r(_d[40]),z=_r(_d[41]),K=_r(_d[42]),V=_r(_d[43]),U=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),Y=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),se=_r(_d[52]),te=_r(_d[53]),oe=_r(_d[54]),ie=_r(_d[55]),ne=_r(_d[56]),le=_r(_d[57]),re=_r(_d[58]),ae=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),he=_r(_d[62]),ue=_r(_d[63]),pe=_r(_d[64]),ge=_r(_d[65]),fe=_r(_d[66]),be=_r(_d[67]);s.LIVE_HEAD_CHEF&&(0,t.requireRealData)();const ke=[{id:'home',label:'Home',icon:'home'},{id:'stock',label:'Stock',icon:'box'},{id:'gp',label:'GP',icon:'forecast'},{id:'creator',label:ie.CREATOR_TITLE,icon:'sparkle'},{id:'orders',label:'Orders',icon:'orders'},{id:'kitchen',label:'Kitchen',icon:'platter'}],ye=[{id:'myshift',title:'My shifts & clock in',sub:'Clock in and out (checks you are at the venue), breaks, and your shifts on the rota'},{id:'mypay',title:'My pay & tips',sub:'Your hours, tips share, tip goal, paydays and payslip info. Only you see this'},{id:'takings',title:'Takings & tips graphs',sub:'Daily cash ups, weekly sales, this week vs last, categories and the Tips pot (view only)'},{id:'bookings',title:'Today\u2019s bookings',sub:'Covers, allergens to sign off, platters and other reservations, dogs, access and vegan/vegetarian'},{id:'recipes',title:'Recipe cards',sub:'Plating photo, ingredients, method, allergens, section and price; you sign each card off before it goes live'},{id:'specials',title:'Specials board',sub:'Photo of the chalkboard or typed specials with allergens; shown in the customer app'},{id:'board',title:'Question board',sub:'Ask the team anything anonymously, and vote'},{id:'teamtasks',title:'Kitchen team tasks',sub:'Daily tasks for your chefs, commis and KPs'},{id:'orderlists',title:'Order lists',sub:'Alsons drinks, Cash and carry: add items, tick on the day, finish and carry over'},{id:'foodsafety',title:'Food safety (CookSafe)',sub:'Based on CookSafe (Food Standards Scotland). Full logs coming in the next update'},{id:'haccp',title:'Food safety log (HACCP)',sub:'Temperatures, cleaning and allergen checks; voice entry; limits; EHO export'},{id:'accidents',title:'Accident book',sub:'Accidents and near misses; you see your own entries'},{id:'prep',title:'Prep list',sub:'From the forecast and bookings, tick off as you go'},{id:'live',title:'Live tickets, sold out, team & chat',sub:'Orders, readiness alerts, sold out, who\u2019s on, rota, team chat and private messages'},{id:'waste',title:'Waste log',sub:'Item, quantity, reason and cost; weekly total and % of sales'},{id:'allergens',title:'Allergens',sub:'14-allergen matrix from the recipe cards, costing cross-check and audit log'},{id:'compliance',title:'Kitchen compliance',sub:'Fridge, freezer, cooking and cooling temps; cleaning; daily checks'}],me={stock:{tab:'stock',stock:'levels'},'stock-take':{tab:'stock',stock:'take'},deliveries:{tab:'stock',stock:'deliveries'},gp:{tab:'gp',gp:'dishes'},'price-changes':{tab:'gp',gp:'changes'},'gp-week':{tab:'gp',gp:'week'},'menu-engineering':{tab:'gp',gp:'engineering'},orders:{tab:'orders'},prep:{tab:'kitchen',k:'prep'},live:{tab:'kitchen',k:'live'},waste:{tab:'kitchen',k:'waste'},recipes:{tab:'kitchen',k:'recipes'},'recipe-cards':{tab:'kitchen',k:'recipes'},allergens:{tab:'kitchen',k:'allergens'},compliance:{tab:'kitchen',k:'compliance'},haccp:{tab:'kitchen',k:'haccp'},specials:{tab:'kitchen',k:'specials'},accidents:{tab:'kitchen',k:'accidents'},'new-dish':{tab:'creator'}};function xe({go:e}){const{k:s,c:t,menu:o,now:n,rid:l,me:r}=(0,G.useChef)(3e4),d=(0,K.useSheetReminders)(),c=(0,G.useWeek)(),{covers:h,label:u,enough:p,booked:f}=(0,G.useForecast)(),b=(0,z.useSuggestions)(),k=s.ingredients.filter(e=>e.onHand<=0||(0,G.isLow)(e.onHand,e.par)),y=b.filter(e=>e.ordersToday&&!e.placedToday),x=(0,_.priceImpacts)(o,s.recipes,s.ingredients,s.targetGp).filter(e=>e.dropped.length),j=s.deliveries.filter(e=>'expected'===e.status),w=!s.recipes.length||!s.ingredients.length,C=w?[]:t.filter(e=>e.below),T=(0,i.useLiveState)(),v=(0,ue.useRecipeCards)(l).filter(e=>!e.signOff);return(0,be.jsxs)(A.default,{style:{gap:12},testID:"chef-dashboard",children:[(0,be.jsx)(ne.MissedBanner,{mode:"chef",now:n,onPress:()=>e('kitchen','haccp')}),d.map(s=>(0,be.jsx)(R.default,{accessibilityRole:"button",onPress:()=>e('orders',s.supplierId),children:(0,be.jsxs)(E.Banner,{kind:'red'===s.tone?'danger':'warn',title:`\u23f0 ${s.text}`,children:["Tap to open the ",s.name," order sheet. Nothing is sent until you press Send."]})},s.supplierId)),v.length?(0,be.jsx)(R.default,{testID:"cards-awaiting",accessibilityRole:"button",onPress:()=>e('kitchen','recipes'),children:(0,be.jsxs)(E.Banner,{kind:"warn",title:`${v.length} recipe card${1===v.length?'':'s'} awaiting your sign-off`,children:[v.slice(0,4).map(e=>e.dish).join(', '),". Guests see \"awaiting allergen sign-off\" and cannot order these until you sign them off."]})}):null,(0,be.jsx)(V.ShellfishTile,{rid:l,by:r,app:"chef",onOrder:()=>e('orders','os-kittyfisher')}),(0,be.jsxs)(E.Row,{wrap:!0,gap:10,children:[w?(0,be.jsx)(G.Tile,{testID:"tile-gp",label:"GP this week vs target",value:"Nothing yet",sub:"Add ingredients and recipe costs to see GP",onPress:()=>e('gp','week')}):(0,be.jsx)(G.Tile,{testID:"tile-gp",label:"GP this week vs target",value:(0,G.pct1)(c.theo),sub:`Target ${s.targetGp}% \xb7 actual ${(0,G.pct1)(c.actual)}`,tone:c.theoe('gp','week')}),(0,be.jsx)(G.Tile,{testID:"tile-stock",label:"Stock value",value:s.ingredients.length?(0,$.gbp)((0,G.stockValue)(s.ingredients)):'Nothing yet',sub:s.ingredients.length?'At cost':'No stock counted yet',onPress:()=>e('stock','levels')}),(0,be.jsx)(G.Tile,{label:"Items low or out",value:s.ingredients.length?`${k.length}`:'Nothing yet',sub:s.ingredients.length?k.slice(0,3).map(e=>e.name).join(', '):'No stock counted yet',tone:k.some(e=>e.onHand<=0)?'red':k.length?'amber':'ok',onPress:()=>e('stock','levels')}),(0,be.jsx)(G.Tile,{label:"Waste this week",value:s.waste.length?(0,$.gbp)(c.wasteWeek):'Nothing yet',sub:c.sales?`${(0,G.pct1)(c.wasteWeek/c.sales*100)} of food sales`:'',onPress:()=>e('kitchen','waste')}),p?(0,be.jsx)(G.Tile,{label:"Covers forecast today",value:`${h}`,sub:u,onPress:()=>e('kitchen','prep')}):(0,be.jsx)(G.Tile,{label:"Booked so far today",value:'ready'===T?`${f}`:'connecting'===T?'Connecting\u2026':'Not connected',sub:"Not enough history for a forecast yet",onPress:()=>e('kitchen','prep')}),(0,be.jsx)(G.Tile,{label:"Orders due today",value:`${y.length}`,sub:y.map(e=>`${e.s.name} by ${e.s.cutoff}`).join(' \xb7 ')||'None',tone:y.some(e=>e.cutPassed)?'red':y.length?'amber':'ok',onPress:()=>e('orders')})]}),x.map(e=>(0,be.jsxs)(E.Banner,{kind:"danger",title:`${e.ing.name} ${e.pct>0?'+':''}${e.pct.toFixed(0)}%: ${e.dropped.length} dish${1===e.dropped.length?'':'es'} drop below target`,children:[e.dropped.map(e=>e.item.name).join(', '),". Open GP \u203a Price changes."]},e.ing.id)),j.length?(0,be.jsx)(R.default,{accessibilityRole:"button",onPress:()=>e('stock','deliveries'),children:(0,be.jsx)(E.Banner,{kind:"info",title:`${j.length} deliver${1===j.length?'y':'ies'} to check in today`,children:"Count in against the order, flag shorts and price changes."})}):null,C.length?(0,be.jsx)(R.default,{accessibilityRole:"button",onPress:()=>e('gp','dishes'),children:(0,be.jsxs)(E.Banner,{kind:"warn",title:`${C.length} dishes below ${s.targetGp}% GP`,children:[C.slice(0,4).map(e=>e.item.name).join(', '),C.length>4?'\u2026':'']})}):null,(0,be.jsx)(E.Row,{wrap:!0,gap:8,children:[['Recipe cards','recipes'],['Food safety log','haccp'],['Specials board','specials'],[ie.CREATOR_TITLE,'creator'],['Prep list','prep'],['Live tickets & sold out','live'],['Allergens','allergens'],['Accident book','accidents']].map(([s,t])=>(0,be.jsx)(R.default,{accessibilityRole:"button",accessibilityLabel:s,onPress:()=>'creator'===t?e('creator'):e('kitchen',t),style:{flexGrow:1,flexBasis:140,padding:12,borderRadius:12,borderWidth:1.5,borderColor:F.colours.gold,backgroundColor:F.colours.surface},children:(0,be.jsxs)(E.T,{weight:"semibold",children:[s," \u203a"]})},t))}),(0,be.jsx)(E.Badge,{kind:"neutral",label:"Nothing is ordered or sent from here"})]})}},805,[1231,1119,918,1232,990,991,993,2,1003,994,995,959,818,921,1292,1293,950,1002,920,1000,1001,924,1296,30,233,122,263,151,287,127,289,861,925,813,816,821,927,1300,1304,1307,1308,1335,1336,938,1337,1007,922,1008,1010,1009,1343,989,953,859,1011,1344,1012,1348,932,1356,934,997,998,819,1357,820,1006,24]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"APP_VARIANT",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"ENTRY",{enumerable:!0,get:function(){return s}}),_e.isAllowedPath=function(e,n=c){return!(t.IS_ISOLATED_VENUE&&/^\/(customer|table)(\/|$)/.test(e)&&![`/customer/${t.VENUE_RID}`,`/customer/${t.VENUE_RID}/`].includes(e))&&('/'===e||''===e||f[n].test(e))},_e.canShow=function(e,t=c){return t===e||'owner'===t&&'customer'===e};var e,t=r(d[0]),n=r(d[1]),o=(e=n)&&e.__esModule?e:{default:e};const u=o.default.expoConfig?.extra?.appVariant??void 0??'owner',c=['owner','staff','customer','display','chef'].includes(u)?u:'owner',s={owner:'/owner',staff:'/team',customer:`/customer/${t.VENUE_RID}`,display:'/display',chef:'/kitchen'},f={owner:/^\/(owner|customer|table)(\/|$)/,customer:/^\/(customer|table)(\/|$)/,staff:/^\/team(\/|$)/,display:/^\/display(\/|$)/,chef:/^\/kitchen(\/|$)/}},806,[5,408]); +__d(function(g,r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"PERMISSIONS",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"can",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"CHEF_SECTIONS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"chefSectionAllowed",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"rotaView",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"chatView",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"ticketView",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"supplierView",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"auditView",{enumerable:!0,get:function(){return p}});const e={owner:'all',manager:'all',staff:new Set(['rota-shifts','tickets','eighty-six','allergens']),chef:new Set(['stock','costing','gp','waste','dish-sales','prep','ordering','allergens','compliance','rota-shifts','kitchen-chat','tickets','eighty-six','specials'])},t=(t,n)=>{const a=e[t];return'all'===a||a.has(n)},n={stock:'stock','stock-take':'stock',deliveries:'stock',gp:'gp','price-changes':'gp','gp-week':'gp','menu-engineering':'dish-sales',orders:'ordering',prep:'prep',live:'tickets',waste:'waste',allergens:'allergens',compliance:'compliance',haccp:'compliance',accidents:'compliance','new-dish':'gp',specials:'specials',recipes:'allergens','recipe-cards':'allergens'},a=e=>e in n&&t('chef',n[e]),s=(e,n,a)=>t(e,'staff-personal')?{staff:n,shifts:a}:{staff:n.filter(e=>e.active).map(e=>({id:e.id,name:e.name,...e.nickname?{nickname:e.nickname}:{},job:e.job})),shifts:a.filter(e=>e.published).map(({id:e,staffId:t,date:n,day:a,start:s,end:c,published:l})=>({id:e,staffId:t,date:n,day:a,start:s,end:c,published:l}))},c=(e,t)=>'chef'===e?t.filter(e=>'kitchen'===e.ch&&!e.removed):t,l=(e,n)=>t(e,'customer-personal')?n:n.map(({id:e,ref:t,type:n,tableNo:a,slotTime:s,lines:c,status:l,allergies:o,allergyAck:p,handoverCheck:f,allergyChain:u,bookingId:m,readiness:h,createdAt:b,restaurantId:k,notes:y,accepted:w,allergyTicks:j})=>({id:e,ref:t,type:n,tableNo:a,slotTime:s,lines:c,status:l,allergies:o,allergyAck:p,handoverCheck:f,allergyChain:u,bookingId:m,readiness:h,createdAt:b,restaurantId:k,notes:y,accepted:w,allergyTicks:j})),o=(e,n)=>t(e,'supplier-email')?n:n.map(e=>({...e,email:''})),p=(e,n)=>t(e,'audit-all')?n:n.filter(e=>'menu'===e.kind&&/allergen|sign-off|recipe card/i.test(e.text))},807,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(t){const n=String(t??'').trim(),l=n.match(/\d+/g);return 1===l?.length?l[0].replace(/^0+(?=\d)/,''):n}Object.defineProperty(e,'__esModule',{value:!0}),e.plainTableNumber=t,Object.defineProperty(e,"tableNumbers",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"tableListNumbers",{enumerable:!0,get:function(){return l}}),e.tableNumbersA11y=function(t){const l=n(t).split('+').filter(Boolean);return l.length?`${1===l.length?'Table':'Tables'} ${l.join(', ')}`:'No table'};const n=n=>String(n??'').split('+').map(t).filter(Boolean).join('+'),l=(t,l=" + ")=>t.map(n).filter(Boolean).join(l)},808,[]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEFAULT_DWELL",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"dwellBands",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"bandLabel",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"fmtMins",{enumerable:!0,get:function(){return o}}),_e.dwellFor=function(e,t,r=[]){const o=n(e),i=Math.max(0,o.findIndex(e=>t<=e.upTo)),s=o[i]??o[o.length-1];if(!1===e?.settings.dwellLearn)return{mins:s.mins,learned:!1,samples:0};const a=0===i?1:o[i-1].upTo+1,u=r.filter(e=>'finished'===e.status&&e.seatedAt&&e.finishedAt&&e.partySize>=a&&e.partySize<=s.upTo).map(e=>(new Date(e.finishedAt).getTime()-new Date(e.seatedAt).getTime())/6e4).filter(e=>e>=20&&e<=360).sort((e,t)=>e-t);if(u.length<8)return{mins:s.mins,learned:!1,samples:u.length};const l=u[Math.floor(u.length/2)];return{mins:5*Math.round((s.mins+l)/2/5),learned:!0,samples:u.length}},Object.defineProperty(_e,"DAYS",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"ruleText",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"ANCHORAGE_EVENTS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"regularEventsOf",{enumerable:!0,get:function(){return l}}),_e.occursOn=m,_e.nextOccurrence=function(e,t){const n=f(t);for(let t=0;t<400;t++){const r=c(new Date(n.getFullYear(),n.getMonth(),n.getDate()+t));if(m(e,r))return r}return null},_e.expandEvents=function(e,t,n,r){const o=[];if(!t.some(e=>e.active))return o;const i=f(n),s=f(r);for(let n=i;n<=s;n=new Date(n.getFullYear(),n.getMonth(),n.getDate()+1)){const r=c(n);for(const n of t)m(n,r)&&o.push({id:`${n.id}:${r}`,restaurantId:e,date:r,title:n.name,kind:'event',example:!1,source:'regular',description:[n.time?`from ${n.time}`:'',n.lastFood?`last food orders ${n.lastFood}`:'',n.notes??''].filter(Boolean).join(' \xb7 '),busier:n.busier,lastFood:n.lastFood,time:n.time})}return o},_e.lastFoodOn=function(t,n){if(!t)return null;const r=f(n).getDay(),o=t.settings.lastFoodByDay?.[r],s=(0,e.kitchenHoursOn)(t,f(n));let a=s?{time:s[1],reason:'kitchen closes'}:null;o&&(!a||oe?.settings.dwellBands?.length?e.settings.dwellBands:t,r=(e,t)=>{const n=0===t?1:e[t-1].upTo+1,r=e[t].upTo;return r>=9999?`${n} or more covers`:n===r?`${n} cover${1===n?'':'s'}`:`${n}\u2013${r} covers`},o=e=>e%60==0?`${e/60} hour${60===e?'':'s'}`:e>60?`${Math.floor(e/60)} h ${e%60} min`:`${e} min`;const i=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],s=['','first','second','third','fourth'],a=e=>'last'===e.kind?`Last ${i[e.weekday]} of every month`:'nth'===e.kind?`${s[e.n][0].toUpperCase()}${s[e.n].slice(1)} ${i[e.weekday]} of every month`:'weekly'===e.kind?`Every ${i[e.weekday]}`:`One-off: ${e.date}`,u=[{id:'ev-music-night',name:'Open Mic Night',rule:{kind:'last',weekday:0},time:'20:00',notes:'Live music from 8pm.',busier:!0,lastFood:'19:00',active:!0}],l=e=>e?.settings.regularEvents??('anchorage'===e?.id?u:[]),d=e=>String(e).padStart(2,'0'),c=e=>`${e.getFullYear()}-${d(e.getMonth()+1)}-${d(e.getDate())}`,f=e=>new Date(Number(e.slice(0,4)),Number(e.slice(5,7))-1,Number(e.slice(8,10)));function m(e,t){if(!e.active)return!1;const n=e.rule;if('once'===n.kind)return n.date===t;const r=f(t);return r.getDay()===n.weekday&&('weekly'===n.kind||('nth'===n.kind?Math.ceil(r.getDate()/7)===n.n:new Date(r.getFullYear(),r.getMonth(),r.getDate()+7).getMonth()!==r.getMonth()))}const b=e=>e?.settings.afterLastFood??'drinks',p=e=>{const[t,n]=e.split(':').map(Number);return`${t%12||12}${n?`:${d(n)}`:''}${t<12?'am':'pm'}`},y=e=>e?.settings.showTakeaway??'anchorage'!==e?.id,h=e=>!1!==e?.settings.coversCounter,O=e=>!1!==e?.settings.nextTableFree,$=e=>!1!==e?.settings.dogQuestion,w=e=>!1!==e?.settings.dietQuestion,F=e=>!1!==e?.settings.accessQuestion,k=(e,t)=>e?.settings.holidayFullNames?t:t.replace(/\s*\(substitute day\)/gi,'').trim()},809,[815]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Honeypot=function({value:t,onChange:n}){return(0,l.jsx)(o.default,{"aria-hidden":!0,pointerEvents:"none",style:{position:'absolute',left:-1e4,top:0,width:1,height:1,overflow:'hidden',opacity:0},children:(0,l.jsx)(e.TextInput,{testID:"hp-field",accessibilityLabel:"Leave this empty",value:t,onChangeText:n,tabIndex:-1,autoComplete:'off',name:'cc_extra_info','aria-hidden':!0})})};var e=r(d[0]);r(d[1]),r(d[2]);var t,n=r(d[3]),o=(t=n)&&t.__esModule?t:{default:t},l=r(d[4])},810,[877,30,122,127,24]); +__d(function(_g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.startForm=function(t=Date.now()){return{openedAt:t,hp:''}},e.guardFor=function(t,n=Date.now()){return{hp:t.hp,formMs:Math.max(0,Math.round(n-t.openedAt))}},e.rememberGuard=function(n,o){t.set(n,o)},e.takeGuard=function(n){const o=t.get(n);return o?(t.delete(n),o):{}};const t=new Map},811,[]); +__d(function(g,r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"NOTES_PLACEHOLDER",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"WIX_EDIT_NOTE",{enumerable:!0,get:function(){return o}}),e.canEditBooking=function(t){return'customer'!==t.variant&&('staff'===t.variant||t.inStaffApp?!!t.shiftManager:'display'===t.variant||'chef'===t.variant||'staff'!==t.role)},Object.defineProperty(e,"isWixBooking",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"EDIT_FIELDS",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"FIELD_WORDS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"draftOf",{enumerable:!0,get:function(){return c}}),e.changedFields=f,e.editPatch=function(t,n,o,s=(new Date).toISOString()){const d=f(t,n);if(!d.length)return{};const l={};for(const t of d){const o=u(t,n[t]);l[t]='partySize'===t?Math.max(1,Math.min(200,o)):'phone'===t||'email'===t||'table'===t?o||void 0:o}d.includes('table')&&(l.tableSetHere=!0);const c=t;return l.locallyEdited=!0,l.editedFields=[...new Set([...c.editedFields??[],...d])],l.editLog=[...c.editLog??[],{at:s,by:o.by.slice(0,80),app:o.app,fields:d}].slice(-50),l},e.editWarnings=function(n,o,s,d,l=90){const c=[],u={...n,date:o.date,time:o.time,partySize:o.partySize};if(o.table){const n=(0,t.tableOverlaps)(u,o.table,s.filter(t=>t.date===o.date),l);n.length&&c.push(`The table already has a booking at about the same time: ${n.map(t=>`${t.time} ${t.walkIn?'walk-in':t.name}`).join(', ')}.`)}d&&c.push(`Bookings are paused ${d.from} to ${d.to}${d.reason?` (${d.reason})`:''}.`);return c},Object.defineProperty(e,"editedWords",{enumerable:!0,get:function(){return b}});var t=r(_d[0]);const n='For example: birthday, high chair, dog, window seat',o='This booking came from the website. Changes here are not sent to website bookings yet.';const s=t=>{const n=t;return'Wix'===n.importedFrom||!!n.wix||(t.tags??[]).includes('Wix')},d=['date','time','partySize','name','phone','email','notes','table'],l={date:'date',time:'time',partySize:'covers',name:'name',phone:'phone',email:'email',notes:'notes',table:'table'},c=t=>({date:t.date,time:t.time,partySize:t.partySize,name:t.name,phone:t.phone??'',email:t.email??'',notes:t.notes??'',table:t.table??''}),u=(t,n)=>'partySize'===t?Number(n):String(n??'').trim();function f(t,n){const o=c(t);return d.filter(t=>u(t,o[t])!==u(t,n[t]))}const b=t=>t.map(t=>l[t]).join(', ')},812,[1297]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"webLine",{enumerable:!0,get:function(){return j.webLine}}),_e.T=I,Object.defineProperty(_e,"H1",{enumerable:!0,get:function(){return R}}),Object.defineProperty(_e,"H2",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"Muted",{enumerable:!0,get:function(){return W}}),_e.BrandBar=D,_e.Screen=function({children:e,title:t,subtitle:o,back:l=!0,right:n,maxWidth:s=640,footer:u,scroll:b=!0}){const f=(0,w.jsx)(h.default,{style:{width:'100%',maxWidth:s,alignSelf:'center',padding:16,gap:12,alignItems:'stretch'},children:e});return(0,w.jsxs)(y.SafeAreaView,{style:{flex:1,backgroundColor:p.colours.bg},edges:['top','left','right'],children:[(0,w.jsx)(h.default,{style:{width:'100%',maxWidth:s,alignSelf:'center'},children:(0,w.jsx)(D,{title:t,subtitle:o,back:l,right:n})}),b?(0,w.jsx)(c.default,{contentContainerStyle:{paddingBottom:40},children:f}):(0,w.jsx)(h.default,{style:{flex:1},children:f}),u?(0,w.jsx)(h.default,{style:H.footer,children:(0,w.jsx)(h.default,{style:{width:'100%',maxWidth:s,alignSelf:'center'},children:u})}):null]})},_e.Button=function({label:e,sub:t,onPress:o,kind:l="primary",disabled:n,small:c,style:u,accessibilityLabel:b,testID:h}){const f={primary:p.colours.gold,secondary:p.colours.tile,danger:p.colours.redSolid,ghost:'transparent',success:p.colours.accentBg}[l],y={primary:p.colours.onGold,secondary:p.colours.text,danger:'#FFFFFF',ghost:p.colours.gold,success:p.colours.goldLight}[l],j={primary:'transparent',secondary:p.colours.hairline,danger:'transparent',ghost:'transparent',success:p.colours.accentBorder}[l];return(0,w.jsxs)(s.default,{testID:h,accessibilityRole:"button",accessibilityLabel:b??e,accessibilityState:{disabled:!!n},disabled:n,onPress:o,style:({pressed:e})=>[H.btn,{backgroundColor:e&&'secondary'===l?p.colours.tilePressed:f,borderColor:j,opacity:n?.4:e?.85:1},c&&{paddingVertical:8,paddingHorizontal:14,minHeight:x.control.min,minWidth:44},u],children:[(0,w.jsx)(I,{weight:"semibold",size:c?p.font.small:p.font.body,colour:y,center:!0,children:e}),t?(0,w.jsx)(I,{size:c?p.font.small-2:p.font.small,colour:y,center:!0,testID:h?`${h}-sub`:void 0,children:t}):null]})},_e.Card=function({children:e,style:t,onPress:o,highlight:l}){const n=l===p.colours.gold||l===p.colours.accentBorder,c=(0,w.jsx)(h.default,{style:[H.card,{alignItems:'center'},l?{borderColor:n?p.colours.accentBorder:l,borderWidth:n?1:2}:null,t],children:e});return o?(0,w.jsx)(s.default,{accessibilityRole:"button",onPress:o,style:({pressed:e})=>({opacity:e?.85:1}),children:c}):c},_e.Badge=function({label:e,kind:t="neutral"}){const o={neutral:[p.colours.surface2,p.colours.muted,p.colours.border],gold:[p.colours.goldTint,p.colours.goldLight,p.colours.gold],red:[p.colours.redBg,'#FFD9D4',p.colours.red],amber:[p.colours.amberBg,'#FFE2A8',p.colours.amber],ok:[p.colours.okBg,p.colours.goldLight,p.colours.ok],blue:[p.colours.blueBg,p.colours.goldLight,p.colours.blue]}[t];return(0,w.jsx)(h.default,{style:[H.badge,{backgroundColor:o[0],borderColor:o[2],maxWidth:'100%'}],children:(0,w.jsx)(I,{size:13,weight:"medium",colour:o[1],style:{flexShrink:1},children:e})})},_e.Banner=F,Object.defineProperty(_e,"ExampleAllergenNotice",{enumerable:!0,get:function(){return z}}),Object.defineProperty(_e,"DemoPaymentNotice",{enumerable:!0,get:function(){return P}}),_e.Row=L,Object.defineProperty(_e,"Divider",{enumerable:!0,get:function(){return v}}),_e.Field=function({label:e,...o}){return(0,w.jsxs)(h.default,{style:{gap:4,alignSelf:'stretch',width:'100%'},children:[(0,w.jsx)(I,{size:p.font.small,weight:"medium",colour:p.colours.muted,center:!0,children:e}),(0,w.jsx)(t.TextInput,{accessibilityLabel:e,placeholderTextColor:"#7D776C",...o,style:[H.input,o.multiline&&{minHeight:70,textAlignVertical:'top'},o.style]})]})},_e.Chip=function({label:e,selected:t,onPress:o,disabled:l,sub:n,testID:c}){return(0,w.jsxs)(s.default,{testID:c,accessibilityRole:"button",accessibilityState:{selected:!!t,disabled:!!l},accessibilityLabel:`${e}${n?`, ${n}`:''}${t?', selected':''}`,'aria-pressed':!!t,disabled:l,onPress:o,style:[H.chip,t&&{backgroundColor:p.colours.gold,borderColor:p.colours.gold},l&&{opacity:.35}],children:[(0,w.jsx)(I,{size:p.font.small,weight:"medium",colour:t?p.colours.onGold:p.colours.text,center:!0,children:e}),n?(0,w.jsx)(I,{size:12,colour:t?p.colours.onGold:p.colours.muted,center:!0,children:n}):null]})},_e.Toggle=function({value:e,onChange:t,label:o,testID:l,disabled:n,a11y:s}){return(0,w.jsxs)(L,{style:{justifyContent:'space-between',flexShrink:1,minWidth:0},children:[(0,w.jsx)(I,{style:{flex:1,flexShrink:1},children:o}),(0,w.jsx)(b.default,{testID:l,disabled:n,accessibilityLabel:s??o,value:e,onValueChange:t,trackColor:{true:p.colours.gold,false:'#444'},thumbColor:e?'#FFF6E0':'#BBB',activeThumbColor:'#FFF6E0',activeTrackColor:p.colours.gold})]})},_e.Stepper=function({value:e,onChange:t,min:o=1,max:l=20,label:n,step:c=1,format:u,testID:b}){const f=u?u(e):String(e),y=e=>Math.round(e/c)*c;return(0,w.jsxs)(L,{gap:10,children:[(0,w.jsx)(s.default,{testID:b?`${b}-down`:void 0,accessibilityRole:"button",accessibilityLabel:`Decrease ${n??''}`,disabled:e<=o,onPress:()=>t(Math.max(o,y(e-c))),style:[H.stepBtn,e<=o?{opacity:.4}:null],children:(0,w.jsx)(I,{size:20,colour:p.colours.gold,children:"\u2212"})}),(0,w.jsx)(h.default,{testID:b?`${b}-value`:void 0,accessibilityLabel:n?`${n}: ${f}`:f,children:(0,w.jsx)(I,{weight:"semibold",size:p.font.large,style:{minWidth:u?64:28,textAlign:'center'},children:f})}),(0,w.jsx)(s.default,{testID:b?`${b}-up`:void 0,accessibilityRole:"button",accessibilityLabel:`Increase ${n??''}`,disabled:e>=l,onPress:()=>t(Math.min(l,y(e+c))),style:[H.stepBtn,e>=l?{opacity:.4}:null],children:(0,w.jsx)(I,{size:20,colour:p.colours.gold,children:"+"})})]})},_e.Sheet=function({visible:e,onClose:t,title:o,children:u,maxWidth:b,testID:x,footer:j}){const{height:C}=(0,f.default)(),k=l.default.useContext(y.SafeAreaInsetsContext)??{top:0,bottom:0,left:0,right:0},B=Math.max(320,C-k.top-k.bottom-24);return(0,w.jsx)(n.default,{visible:e,transparent:!0,animationType:"fade",onRequestClose:t,children:(0,w.jsx)(h.default,{style:[H.overlay,{padding:12,paddingTop:12+k.top,paddingBottom:12+k.bottom}],children:(0,w.jsxs)(h.default,{style:[H.sheet,{maxHeight:B},b?{maxWidth:b}:null],testID:x,children:[(0,w.jsxs)(L,{style:{justifyContent:'space-between',marginBottom:8,gap:8},children:[(0,w.jsx)(T,{style:{flex:1},children:o}),(0,w.jsx)(s.default,{accessibilityRole:"button",accessibilityLabel:"Close",onPress:t,hitSlop:8,testID:"sheet-close",style:{minWidth:48,minHeight:48,width:S?72:48,alignItems:'center',justifyContent:'center',marginRight:-8,marginTop:-6},children:(0,w.jsx)(I,{size:S?18:24,colour:p.colours.text,children:S?'Close':'\u2715'})})]}),(0,w.jsx)(c.default,{style:{flexShrink:1},contentContainerStyle:{gap:12,paddingTop:2,paddingBottom:4},children:u}),j?(0,w.jsx)(h.default,{style:{borderTopWidth:1,borderTopColor:p.colours.border,paddingTop:10,marginTop:8},testID:x?`${x}-footer`:void 0,children:j}):null]})})})},_e.SectionTitle=function({children:e}){return(0,w.jsx)(I,{weight:"semibold",size:12,colour:p.colours.goldMuted,center:!0,style:{textTransform:'uppercase',letterSpacing:1.6,marginTop:8},children:e})},Object.defineProperty(_e,"styles",{enumerable:!0,get:function(){return H}});var t=r(d[0]),o=r(d[1]),l=e(r(d[2])),n=e(r(d[3])),s=e(r(d[4])),c=e(r(d[5])),u=e(r(d[6])),b=e(r(d[7])),h=e(r(d[8])),f=e(r(d[9])),y=r(d[10]),p=r(d[11]),x=r(d[12]),j=r(d[13]),C=r(d[14]),k=r(d[15]),B=r(d[16]),w=r(d[17]);const S=['kirkton','abbotsford'].includes(C.VENUE_RID);function I({children:e,style:o,size:l=p.font.body,weight:n="regular",colour:s=p.colours.text,numberOfLines:c,center:u,testID:b,accessibilityRole:h}){return(0,w.jsx)(t.Text,{testID:b,accessibilityRole:h,numberOfLines:c,style:[{fontFamily:p.fonts[n],fontSize:l,color:s,lineHeight:(0,x.lineFor)(l)},u&&{textAlign:'center'},o,(0,j.webLine)(o,l)],children:e})}const R=e=>(0,w.jsx)(I,{size:p.font.title,weight:"semibold",center:!0,...e}),T=e=>(0,w.jsx)(I,{size:p.font.large,weight:"semibold",center:!0,...e}),W=e=>(0,w.jsx)(I,{colour:p.colours.muted,size:p.font.small,...e});function D({title:e,back:t=!0,right:l,subtitle:n}){return(0,w.jsxs)(h.default,{style:H.brandBar,children:[(0,w.jsxs)(h.default,{style:H.row,children:[(0,w.jsx)(h.default,{style:H.brandSide,children:t?(0,w.jsx)(s.default,{accessibilityRole:"button",accessibilityLabel:"Back",onPress:()=>o.router.canGoBack()?o.router.back():o.router.replace(k.ENTRY[k.APP_VARIANT]),style:H.backBtn,hitSlop:10,children:(0,w.jsx)(I,{size:18,weight:"semibold",colour:p.colours.gold,children:"\u2039 Back"})}):null}),(0,w.jsx)(s.default,{onPress:()=>o.router.push(k.ENTRY[k.APP_VARIANT]),accessibilityLabel:"Home",style:H.brandCenter,children:(0,w.jsx)(B.RestaurantBrand,{size:B.HEADER_LOGO})}),(0,w.jsx)(h.default,{style:[H.brandSide,{alignItems:'flex-end'}],children:l?(0,w.jsx)(h.default,{style:{flexShrink:0},children:l}):null})]}),e?(0,w.jsx)(R,{style:{marginTop:10,alignSelf:'stretch'},children:e}):null,n?(0,w.jsx)(W,{center:!0,style:{alignSelf:'stretch'},children:n}):null]})}function F({kind:e="info",title:t,children:o}){const n={info:[p.colours.surface,p.colours.gold,p.colours.text],warn:[p.colours.amberBg,p.colours.amber,'#FFE2A8'],danger:[p.colours.redBg,p.colours.red,'#FFE3DF'],success:[p.colours.okBg,p.colours.ok,p.colours.goldLight],example:[p.colours.amberBg,p.colours.amber,'#FFE2A8'],demo:[p.colours.goldTint,p.colours.gold,p.colours.goldLight]}[e];return(0,w.jsxs)(h.default,{accessibilityRole:"summary",style:[H.banner,{backgroundColor:n[0],borderLeftColor:n[1]}],children:[t?(0,w.jsx)(I,{weight:"semibold",colour:n[2],center:!0,children:t}):null,l.default.Children.toArray(o).every(e=>'string'==typeof e||'number'==typeof e)?(0,w.jsx)(I,{size:p.font.small,colour:n[2],center:!0,children:o}):o]})}const z=()=>(0,w.jsx)(F,{kind:"example",title:"Allergens awaiting kitchen verification",children:"This allergen information has not been verified by the kitchen. Head chef sign-off is required. Always speak to staff about allergies."}),P=()=>(0,w.jsx)(F,{kind:"demo",title:"Card payments: not set up yet",children:"No card is charged and no payment provider is contacted."});function L({children:e,style:t,gap:o=8,wrap:l}){return(0,w.jsx)(h.default,{style:[H.row,{gap:o},l&&{flexWrap:'wrap',justifyContent:'center'},t],children:e})}const v=()=>(0,w.jsx)(h.default,{style:{height:1,backgroundColor:p.colours.border,marginVertical:4}});const H=u.default.create({row:{flexDirection:'row',alignItems:'center'},brandBar:{paddingHorizontal:16,paddingTop:8,paddingBottom:8,borderBottomWidth:1,borderBottomColor:p.colours.border},brandSide:{width:96,minHeight:48,justifyContent:'center'},brandCenter:{flex:1,alignItems:'center',justifyContent:'center',minHeight:48},backBtn:{paddingRight:12,minHeight:48,minWidth:88,justifyContent:'center'},btn:{borderRadius:x.radii.button,paddingVertical:12,paddingHorizontal:18,borderWidth:1,alignItems:'center',justifyContent:'center',minHeight:x.control.min,alignSelf:'stretch'},card:{backgroundColor:p.colours.surface,borderRadius:p.radius.l,padding:16,borderWidth:1,borderColor:p.colours.hairline,gap:8},badge:{borderRadius:999,paddingHorizontal:9,paddingVertical:2,borderWidth:1,alignSelf:'flex-start'},banner:{borderRadius:p.radius.m,padding:12,borderLeftWidth:5,gap:2},input:{minWidth:0,backgroundColor:p.colours.surface2,borderColor:p.colours.border,borderWidth:1,borderRadius:p.radius.m,paddingHorizontal:12,paddingVertical:10,color:p.colours.text,fontSize:p.font.body,fontFamily:p.fonts.regular},chip:{borderWidth:1,borderColor:p.colours.border,borderRadius:p.radius.m,paddingHorizontal:12,paddingVertical:8,backgroundColor:p.colours.surface2,minWidth:64,minHeight:44,justifyContent:'center'},stepBtn:{width:44,height:44,borderRadius:22,borderWidth:1.5,borderColor:p.colours.gold,alignItems:'center',justifyContent:'center'},overlay:{flex:1,backgroundColor:'rgba(0,0,0,0.7)',justifyContent:'center',alignItems:'center',padding:16},sheet:{backgroundColor:p.colours.surface,borderRadius:x.radii.xl,padding:18,width:'100%',maxWidth:520,maxHeight:'90%',borderWidth:1,borderColor:p.colours.gold},footer:{borderTopWidth:1,borderTopColor:p.colours.border,backgroundColor:p.colours.surface,padding:12}})},813,[877,804,30,256,263,151,46,271,127,287,289,821,1236,1238,5,806,861,24]); +__d(function(_g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ALLERGENS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"allergenLabel",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"SEVERITIES",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"severityLabel",{enumerable:!0,get:function(){return s}}),e.effectiveAllergens=function(l,n=[]){const t={...l.allergens};for(const s of l.optionGroups??[])for(const l of s.choices)if(n.includes(l.id)&&l.allergens)for(const[n,s]of Object.entries(l.allergens))'contains'!==t[n]&&(t[n]=s);return t},e.conflictsFor=function(l,n){const t=[],s=[];for(const a of n)'contains'===l[a.allergen]?t.push(a.allergen):'may'===l[a.allergen]&&s.push(a.allergen);return{contains:t,may:s}},Object.defineProperty(e,"hasConflict",{enumerable:!0,get:function(){return a}});const l=[{id:'gluten',label:'Cereals containing gluten',short:'Gluten'},{id:'crustaceans',label:'Crustaceans',short:'Crustaceans'},{id:'molluscs',label:'Molluscs',short:'Molluscs'},{id:'eggs',label:'Eggs',short:'Eggs'},{id:'fish',label:'Fish',short:'Fish'},{id:'peanuts',label:'Peanuts',short:'Peanuts'},{id:'treenuts',label:'Tree nuts',short:'Tree nuts'},{id:'soya',label:'Soya',short:'Soya'},{id:'milk',label:'Milk',short:'Milk'},{id:'celery',label:'Celery',short:'Celery'},{id:'mustard',label:'Mustard',short:'Mustard'},{id:'sesame',label:'Sesame',short:'Sesame'},{id:'sulphites',label:'Sulphur dioxide / sulphites',short:'Sulphites'},{id:'lupin',label:'Lupin',short:'Lupin'}],n=n=>l.find(l=>l.id===n)?.short??n,t=[{id:'intolerance',label:'Intolerance'},{id:'allergy',label:'Allergy'},{id:'coeliac',label:'Coeliac disease'},{id:'anaphylaxis',label:'Severe \u2014 anaphylaxis risk'}],s=l=>t.find(n=>n.id===l)?.label??l;const a=l=>l.contains.length>0||l.may.length>0},814,[]); +__d(function(g,_r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ANCHORAGE_SEASONS",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"hourSetsOf",{enumerable:!0,get:function(){return n}}),e.seasonOn=s,e.kitchenHoursOn=l,e.hoursFor=function(r,n){const u=l(r,n);return u?{open:(0,t.atTime)(n,u[0]),close:(0,t.atTime)(n,u[1])}:null};var t=_r(_d[0]);const r=[{id:'winter',name:'Winter',hours:{0:['12:30','19:00'],1:null,2:null,3:['12:00','19:00'],4:['12:00','19:00'],5:['12:00','20:00'],6:['12:00','20:00']}},{id:'summer',name:'Summer',hours:null}],n=t=>t.settings.hourSets??('anchorage'===t.id?r:[]),u=t=>`${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`,o=t=>`${t.getFullYear()}-${u(t)}`;function s(t,r){const o=n(t).filter(t=>t.hours);if(!o.length)return null;const s=o.filter(t=>t.start).sort((t,r)=>t.start.localeCompare(r.start));if(s.length<2)return s[0]??o[0];const l=u(r);return[...s].reverse().find(t=>t.start<=l)??s[s.length-1]}function l(t,r){const n=(t.settings.hourOverrides??[]).find(t=>t.date===o(r));if(n)return n.hours;const u=s(t,r);return u?.hours?u.hours[r.getDay()]??null:t.kitchenHours[r.getDay()]??null}},815,[818]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"gbp",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"pounds",{enumerable:!0,get:function(){return n}});const t=t=>`\xa3${(t/100).toFixed(2)}`,n=t=>Math.round(100*t)},816,[]); +__d(function(g,_r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.takeawaySlots=function(s,o,r){const l=(0,t.hoursFor)(s,r);if(!l)return[];const d=s.settings.slotMinutes,u=(0,n.addMins)(r,s.settings.leadMins),c=[];for(let t=new Date(l.open);t<=l.close;t=(0,n.addMins)(t,d)){if(tn.restaurantId===s.id&&'takeaway'===n.type&&'cancelled'!==n.status&&n.slotTime&&new Date(n.slotTime).getTime()===t.getTime()).length;c.push({time:new Date(t),label:(0,n.hm)(t),taken:r,cap:s.settings.slotCap,full:r>=s.settings.slotCap})}return c},e.bookingSlots=function(r,l,d,u,c){const f=(0,t.hoursFor)(r,l);if(!f)return[];const p=[],M=(0,n.addMins)(f.close,-60),h=(0,s.lastFoodOn)(r,o(l)),k=h?(0,n.addMins)((0,n.atTime)(l,h.time),-60):M,S='drinks'===(0,s.afterLastFood)(r);for(let t=new Date(f.open);t<=M;t=(0,n.addMins)(t,30)){const s=(0,n.hm)(t),o=t>k;if(o&&!S)continue;const l=r.settings.bookingCoversPerSlot-d(s),f=t.getTime()=u,...o?{drinksOnly:!0}:{}})}return p};var t=_r(_d[0]),n=_r(_d[1]),s=_r(_d[2]);const o=t=>`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`},817,[815,818,809]); +__d(function(g,r,i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"pad",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"ymd",{enumerable:!0,get:function(){return n}}),e.venueYmd=function(t,u="Europe/London"){try{const n=new Intl.DateTimeFormat('en-CA',{timeZone:u,year:'numeric',month:'2-digit',day:'2-digit'}).format(t);if(/^\d{4}-\d{2}-\d{2}$/.test(n))return n}catch{}return n(t)},Object.defineProperty(e,"hm",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"parseYmd",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"toMins",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"fromMins",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"atTime",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"addMins",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"dayShort",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"dayLong",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"monthLong",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"niceDate",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"niceDateYear",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"minsBetween",{enumerable:!0,get:function(){return P}});const t=t=>String(t).padStart(2,'0'),n=n=>`${n.getFullYear()}-${t(n.getMonth()+1)}-${t(n.getDate())}`;const u=n=>`${t(n.getHours())}:${t(n.getMinutes())}`,a=t=>{const[n,u,a]=t.split('-').map(Number);return new Date(n,u-1,a)},o=t=>{const[n,u]=t.split(':').map(Number);return 60*n+u},c=n=>`${t(Math.floor(n/60))}:${t(n%60)}`,d=(t,n)=>{const u=new Date(t);return u.setHours(0,0,0,0),u.setMinutes(o(n)),u},m=(t,n)=>new Date(t.getTime()+6e4*n),b=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],y=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],f=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],l=['January','February','March','April','May','June','July','August','September','October','November','December'],p=t=>b[t.getDay()],s=t=>y[t.getDay()],O=t=>l[t],M=t=>`${b[t.getDay()]} ${t.getDate()} ${f[t.getMonth()]}`,j=t=>`${M(t)} ${t.getFullYear()}`,P=(t,n)=>Math.round((n.getTime()-t.getTime())/6e4)},818,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"repo",{enumerable:!0,get:function(){return o}});var t=r(d[0]),n=r(d[1]);Object.keys(n).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})});const o=t.localRepositories},819,[1239,1021]); +__d(function(_g,_r2,_i2,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"inviteRefusal",{enumerable:!0,get:function(){return p.inviteRefusal}}),Object.defineProperty(_e,"keysToWipe",{enumerable:!0,get:function(){return p.keysToWipe}}),Object.defineProperty(_e,"changedFields",{enumerable:!0,get:function(){return m.changedFields}}),Object.defineProperty(_e,"useSync",{enumerable:!0,get:function(){return re}}),Object.defineProperty(_e,"can",{enumerable:!0,get:function(){return de}}),Object.defineProperty(_e,"isLive",{enumerable:!0,get:function(){return ue}}),_e.setTempManagerAccess=async function(e,t,a){const s=re.getState().venueId;if(!s||'staff'!==re.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{error:i}=await ne().rpc('set_staff_manager_access',{p_venue:s,p_staff_ref:e,p_on:t,p_reason:a.trim()||null});return i?{ok:!1,message:/owner/i.test(i.message)?'Only an owner can change this.':'Could not save. Try again.'}:(P.useOwner.setState(a=>({staff:a.staff.map(a=>a.id===e?{...a,...t?{role:'manager',managerAccess:!0}:{role:'staff',managerAccess:void 0}}:a)})),{ok:!0})}catch{return{ok:!1,message:'Could not save. Try again when the app is online.'}}},_e.setTempOwnerAccess=async function(e,t,a){const s=re.getState().venueId;if(!s||'staff'!==re.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{error:i}=await ne().rpc('set_staff_owner_access',{p_venue:s,p_staff_ref:e,p_on:t,p_reason:a.trim()||null});if(i)return{ok:!1,message:/owner/i.test(i.message)?'Only an owner can change this.':'Could not save. Try again.'};const n=e=>'Manager'===e.level||'Supervisor'===e.level?'manager':'staff';return P.useOwner.setState(a=>({staff:a.staff.map(a=>a.id===e?{...a,...t?{role:'owner',ownerAccess:!0}:{role:a.managerAccess?'manager':n(a),ownerAccess:void 0}}:a)})),{ok:!0}}catch{return{ok:!1,message:'Could not save. Try again when the app is online.'}}},_e.setManagerAccess=async function(e,t){const a=re.getState().venueId;if(!a||'staff'!==re.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:s,error:i}=await ne().rpc('set_manager_access',{p_venue:a,p_staff_ref:e,p_on:t});if(i)return{ok:!1,message:i.message.replace(/^.*?:\s*/,'')||'Not allowed'};const n=String(s??'');return P.useOwner.setState(t=>({staff:t.staff.map(t=>t.id===e?{...t,...Ge(n)}:t)})),{ok:!0,role:n}}catch(e){return{ok:!1,message:String(e?.message??e)}}},_e.unlockCashUp=async function(e,t,a){if(H.PITCH)return Q.unlockCashUp(e,t,a);const s=re.getState().venueId;if(!s||'staff'!==re.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:i,error:n}=await ne().rpc('unlock_cash_up',{p_venue:s,p_kind:e,p_id:t,p_reason:a});if(n)return{ok:!1,message:n.message};const r=String(i);return'cashup'===e?B.useCashUp.setState(e=>({cashUps:e.cashUps.map(e=>e.id===t?{...e,unlockedUntil:r}:e)})):B.useCashUp.setState(e=>({sales:e.sales.map(e=>e.id===t?{...e,unlockedUntil:r}:e)})),{ok:!0,until:r}}catch(e){return{ok:!1,message:String(e?.message??e)}}},_e.readCashAudit=async function(e){if(H.PITCH)return Q.cashAudit(e);const t=re.getState().venueId;if(!t)return[];let a=ne().from('cash_up_audit').select('at, action, changed_by_name, tbl, for_date, reason, old_row, new_row').eq('venue_id',t).order('at',{ascending:!1}).limit(50);e&&(a=a.eq('row_id',e));const{data:s,error:i}=await a;return i||!Array.isArray(s)?[]:s.map(e=>({at:String(e.at),action:String(e.action),by:String(e.changed_by_name??'\u2014'),tbl:String(e.tbl),forDate:e.for_date??void 0,reason:e.reason??void 0,changed:(0,m.changedFields)(e.old_row,e.new_row)}))},_e.setPushLive=async function(e){const t=re.getState().venueId;if(!t)return{ok:!1,message:'Connect to the venue first.'};const{data:a,error:s}=await ne().rpc('set_push_live',{p_venue:t,p_on:e});return s?{ok:!1,message:s.message}:(qt.setState({live:!!a,known:!0}),{ok:!0})},_e.readPushLive=Kt,_e.readAccessLog=async function(){const e=re.getState().venueId;if(!e)return[];try{const{data:t}=await ne().from('staff_access_log').select('*').eq('venue_id',e).order('changed_at',{ascending:!1}).limit(30);return t??[]}catch{return[]}},Object.defineProperty(_e,"ORDER_LOGO_BUCKET",{enumerable:!0,get:function(){return xt}}),_e.uploadOrderLogo=async function(e,t){const a=re.getState().venueId;if(!a||'staff'!==re.getState().kind)return{ok:!1,message:'offline'};try{const s=await(await fetch(t)).blob(),i=`${a}/${e}-${Date.now()}.jpg`,{error:n}=await ne().storage.from(xt).upload(i,s,{upsert:!0,contentType:'image/jpeg'});return n?{ok:!1,message:n.message}:{ok:!0,path:i}}catch(e){return{ok:!1,message:String(e?.message??e)}}},_e.orderLogoUrl=async function(e){const t=Lt.get(e);if(t&&t.until>Date.now())return t.url;try{const{data:t}=await ne().storage.from(xt).createSignedUrl(e,3600);if(t?.signedUrl)return Lt.set(e,{url:t.signedUrl,until:Date.now()+3e6}),t.signedUrl}catch{}return null},_e.removeOrderLogo=async function(e){try{await ne().storage.from(xt).remove([e])}catch{}},Object.defineProperty(_e,"usePushLive",{enumerable:!0,get:function(){return qt}}),_e.claimInvite=Zt,_e.signedInHereAs=async function(e){fe();const t=await k.kv.get(Ht,null);return!!t&&'staff'===t.kind&&t.staffRef===e},_e.rememberedInviteHere=async function(e){return fe(),await k.kv.get(Gt,null)===e},_e.kirkmichaelStaffAppUrl=async function(){const t=re.getState();if(!e.IS_KIRKMICHAEL||'staff'!==t.kind||t.venueId!==e.VENUE_UUID||t.staffRef!==g.useSession.getState().meId)return null;fe();const a=await k.kv.get(Gt,null);return a?(0,g.appUrl)('staff',a):null},_e.wildingsStaffAppUrl=async function(){const t=re.getState();if(!e.IS_WILDINGS||'staff'!==t.kind||t.venueId!==e.VENUE_UUID||t.staffRef!==g.useSession.getState().meId)return null;fe();const a=await k.kv.get(Gt,null);return a?(0,g.appUrl)('staff',a):null},_e.forgetSignInHere=async function(){fe(),await k.kv.remove(Ht),await k.kv.remove(Gt),oe({mode:'signin',perms:[]});try{await ta()}catch{}},_e.approveShiftSwap=async function(e,t,a){const s=re.getState().venueId;if(H.PITCH||!s||'staff'!==re.getState().kind)return{ok:!0};if(!(0,$.isUuid)(e))return{ok:!1,message:'This shift isn\u2019t on the shared rota yet.'};try{return await Yt('approve_shift_swap',{p_venue:s,p_shift:e,p_to_ref:t,p_kind:a}),{ok:!0}}catch(e){return{ok:!1,message:String(e?.message??e).replace(/^.*?:\s*/,'')||'Not allowed'}}},_e.claimInviteForSync=async function(e){const t=await Zt(e);return'ok'===t.status?t.id:null},_e.reissueInvite=async function(e){if(H.PITCH)return Q.reissueInvite(e);const t=re.getState().venueId;if(!t||'staff'!==re.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:a,error:s}=await ne().rpc('reissue_invite',{p_venue:t,p_staff_ref:e});if(s)return{ok:!1,message:s.message.replace(/^.*?:\s*/,'')||'Not allowed'};const i=a,n=String(i.app??'staff');return{ok:!0,token:String(i.token),expiresAt:String(i.expiresAt),app:'owner'===n||'chef'===n?n:'staff'}}catch(e){return{ok:!1,message:String(e?.message??e)}}},_e.ensureStaffAppLinks=async function(e){const t=re.getState().venueId;if(!t||'staff'!==re.getState().kind)throw new Error('Connect to the venue first.');return Yt('ensure_staff_app_links',{p_venue:t,p_staff_ref:e})},_e.staffAppLinkHistory=async function(e){return Yt('staff_app_link_history',{p_venue:re.getState().venueId,p_staff_ref:e})},_e.revokeStaffAppLink=async function(e){await Yt('revoke_staff_app_link',{p_venue:re.getState().venueId,p_link_id:e})},_e.readInviteStatus=async function(){if(H.PITCH)return Q.inviteStatus();const e=re.getState().venueId;if(!e)return{};const{data:t,error:a}=await ne().rpc('invite_status',{p_venue:e});if(a||!Array.isArray(t))return{};const s={};for(const e of t)s[String(e.staff_ref)]={state:e.state,expiresAt:e.expires_at??void 0,usedAt:e.used_at??void 0,devices:Number(e.devices??0)};return s},_e.pairWithCode=async function(t){if(!(0,v.isSupabaseConfigured)())return{ok:!1,error:'This build has no shared backend.'};try{await zt();const{data:a,error:s}=await ne().rpc(e.IS_QUEUED_VENUE?'claim_'+e.VENUE_RID+'_pairing_code':e.IS_GREENSIDE?'claim_greenside_pairing_code':e.IS_ABBOTSFORD?'claim_abbotsford_pairing_code':e.IS_KIRKTON?'claim_kirkton_pairing_code':e.IS_WILDINGS?'claim_wildings_pairing_code':e.IS_KIRKMICHAEL?'claim_kirkmichael_pairing_code':e.IS_ISOLATED_VENUE?'claim_souters_pairing_code':'claim_pairing_code',{p_code:t});if(s)throw s;const i=a?.[0];if(!i)return{ok:!1,error:'That code was not accepted. It may have expired. Ask a manager for a new one.'};const n={kind:'device',venueId:i.venue_id,venueSlug:i.venue_slug,venueName:i.venue_name,canWrite:i.can_write,label:i.label};return await k.kv.set(Vt,n),aa(),{ok:!0,venueName:i.venue_name}}catch(e){const t=String(e?.message??e);return/fetch|network/i.test(t)?{ok:!1,error:'No connection. Check the tablet\u2019s Wi-Fi and try again.'}:/rate|too many/i.test(t)?{ok:!1,error:'Too many tries from this network. Wait a little and try again.'}:{ok:!1,error:/valid|switched off/i.test(t)?t:`Couldn\u2019t pair: ${t}`}}},_e.unpairDisplay=async function(){await k.kv.remove(Vt),await ta();try{await ne().auth.signOut()}catch{}oe({mode:'unpaired',venueId:void 0,venueName:void 0,perms:[]})},_e.disconnectStaff=async function(){await k.kv.remove(Ht),await k.kv.remove(Gt),await ta();try{await ne().auth.signOut()}catch{}oe({mode:'signin',venueId:void 0,venueName:void 0,perms:[],kind:void 0,role:void 0,staffRef:void 0,message:'Disconnected. Open your personal invite link to connect again.'})},_e.wipeThisDevice=async function(t={}){try{await ta()}catch{}try{(0,v.isSupabaseConfigured)()&&await ne().auth.signOut({scope:'local'})}catch{}let a=0;try{const e='undefined'!=typeof navigator?navigator:null,t=await(e?.serviceWorker?.getRegistration?.()),a=await(t?.pushManager?.getSubscription?.());a&&await a.unsubscribe()}catch{}for(const t of['undefined'!=typeof localStorage?localStorage:null,'undefined'!=typeof sessionStorage?sessionStorage:null])if(t)try{const s=[];for(let e=0;et.startsWith(`cc-venue:${e.VENUE_RID}:`)):(0,p.keysToWipe)(s).filter(e=>!e.startsWith('cc-venue:')))t.removeItem(i),a++}catch{}try{const t='undefined'!=typeof caches?caches:null;if(t)for(const a of await t.keys())!e.IS_ISOLATED_VENUE&&/data|api|photo/i.test(a)&&await t.delete(a)}catch{}oe({mode:'signin',venueId:void 0,venueName:void 0,perms:[],kind:void 0,role:void 0,staffRef:void 0,message:'This device has been wiped.'}),!1!==t.reload&&'undefined'!=typeof window&&window.location&&window.location.replace(window.location.pathname);return a},_e.guestSession=Xt,Object.defineProperty(_e,"rpc",{enumerable:!0,get:function(){return Yt}}),_e.startAppSync=async function(t=e.VENUE_RID){if(e.IS_ISOLATED_VENUE&&t!==e.VENUE_RID)return;if(ge)return;ge=!0,sa=t,'customer'===le&&'live'!==U.useStore.getState().clock.mode&&U.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}});if(fe(),'customer'!==le){const e=e=>new Promise(t=>{try{if(!e?.persist||e.persist.hasHydrated())return t();const a=e.persist.onFinishHydration(()=>{a?.(),t()});setTimeout(t,3e3)}catch{t()}}),a='chef'===le&&(0,d.isAnchorage)(t)?[U.useStore,P.useOwner,L.useKitchen,q.useSafety,N.useCardStore,r.useGpCalc,M.useOrderSheets,o.useSpecials,_.useHr]:[U.useStore,P.useOwner,L.useKitchen];if(await Promise.all(a.map(e)),'chef'===le&&(0,d.isAnchorage)(t)&&a.some(e=>!e.persist.hasHydrated()))return void oe({mode:'offline',message:'Saved kitchen data could not be backed up. Nothing was cleared. Free some device storage, then reopen.',lastError:'Legacy kitchen archive not ready'});try{await wa(t)}catch{if(s.LIVE_VENUE_BUILD&&(0,s.isLiveVenue)(t))return void oe({mode:'offline',message:'Device backup failed. Nothing was cleared. Free some storage, then reopen.',lastError:'Legacy kitchen archive failed'})}'live'!==U.useStore.getState().clock.mode&&U.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}})}if(!(0,v.isSupabaseConfigured)())return void oe({mode:'off'});R.mutationQueue.subscribe(()=>{const e=R.mutationQueue.waiting,t=e[0];oe({pending:R.mutationQueue.pending.length,failed:R.mutationQueue.failed.length,waiting:e.length,waitingWhat:t?`${(0,O.describeWrite)(t)}: ${(0,O.plainReason)({...t.lastErr},'retry')}`:void 0})}),R.mutationQueue.onFailed(e=>oe({lastError:`${e.table}: ${e.lastError??'rejected'}`,failed:R.mutationQueue.failed.length,refused:{what:(0,O.describeWrite)(e),why:'conflict'===e.reason?(0,O.plainReason)({code:'conflict'},'refused'):(0,O.plainReason)({...e.lastErr,message:e.lastErr?.message??e.lastError},'refused'),at:e.failedAt}})),me.push((0,b.onConnectivity)(e=>oe({mode:e?re.getState().venueId?'live':re.getState().mode:re.getState().venueId?'offline':re.getState().mode}))),await ia()},Object.defineProperty(_e,"syncInternals",{enumerable:!0,get:function(){return fa}}),_e.goLive=ma,Object.defineProperty(_e,"usePublicDayStore",{enumerable:!0,get:function(){return Ca}}),_e.publicDay=function(e,a){const s=`${e}|${a}`,i=Ea.get(s);if('customer'!==le||!(0,v.isSupabaseConfigured)())return null;(!i||Date.now()-i.at>6e4)&&(i?i.at=Date.now():Ea.set(s,{at:Date.now(),v:{bookings:[],blocks:[]}}),Yt('public_day',{p_venue_slug:(0,t.queuedDatabaseSlug)(e),p_date:a}).then(t=>{const i=[],n=[];(t??[]).forEach((t,s)=>{'booking'===t.kind?i.push({id:`pub-${a}-${s}`,ref:'',restaurantId:e,customerId:null,name:'',date:a,time:ye(t.booking_time),partySize:Number(t.covers)||0,table:(t.table_ids??[]).join('+')||void 0,durationMins:t.duration_mins??void 0,status:'confirmed',allergies:[],createdAt:''}):n.push({id:`pubblk-${a}-${s}`,rid:e,date:a,from:ye(t.from_time),to:ye(t.to_time),areaId:t.area_id??void 0,tables:Array.isArray(t.table_ids)&&t.table_ids.length?t.table_ids.map(String):void 0,by:'',createdAt:''})}),Ea.set(s,{at:Date.now(),v:{bookings:i,blocks:n},ok:!0}),Ca.setState(e=>({n:e.n+1}))}).catch(()=>{const e=Ea.get(s);e&&!e.ok&&Ea.delete(s)}));const n=Ea.get(s);return n?.ok?n.v:null};var e=_r2(_d[0]),t=_r2(_d[1]),a=_r2(_d[2]),s=_r2(_d[3]),i=_r2(_d[4]),n=_r2(_d[5]),r=_r2(_d[6]),o=_r2(_d[7]),d=_r2(_d[8]),u=_r2(_d[9]),l=_r2(_d[10]),c=_r2(_d[11]),f=_r2(_d[12]),p=_r2(_d[13]),m=_r2(_d[14]),g=_r2(_d[15]),_=_r2(_d[16]),S=_r2(_d[17]),h=_r2(_d[18]),y=_r2(_d[19]),w=_r2(_d[20]),v=_r2(_d[21]),b=_r2(_d[22]),k=_r2(_d[23]),I=_r2(_d[24]),O=_r2(_d[25]),R=_r2(_d[26]),A=_r2(_d[27]),U=_r2(_d[28]),D=_r2(_d[29]),E=_r2(_d[30]),C=_r2(_d[31]),T=_r2(_d[32]),N=_r2(_d[33]),M=_r2(_d[34]),K=_r2(_d[35]),x=_r2(_d[36]),L=_r2(_d[37]),q=_r2(_d[38]),P=_r2(_d[39]),$=_r2(_d[40]),j=_r2(_d[41]),B=_r2(_d[42]),F=_r2(_d[43]),W=_r2(_d[44]),V=_r2(_d[45]),H=_r2(_d[46]),G=_r2(_d[47]),Q=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(a){if('default'!==a){var s=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(t,a,s.get?s:{enumerable:!0,get:function(){return e[a]}})}}),t.default=e,t})(G),J=_r2(_d[48]),z=_r2(_d[49]),Z=_r2(_d[50]),X=_r2(_d[51]),Y=_r2(_d[52]),ee=_r2(_d[53]),te=_r2(_d[54]),ae=_r2(_d[55]),se=_r2(_d[56]),ie=_r2(_d[57]);const ne=()=>(0,w.getSupabase)();R.mutationQueue.setExecutor(I.executeMutation);const re=(0,y.create)(()=>({mode:'off',perms:[],pending:0,failed:0})),oe=e=>re.setState(e),de=e=>{const t=re.getState().perms;return t.includes('*')||t.includes(e)},ue=()=>{const e=re.getState().mode;return'live'===e||'offline'===e||'connecting'===e};re.subscribe(()=>(0,ae.setLiveData)(ue()));let le=D.APP_VARIANT,ce=!1;const fe=()=>{ce||((0,k.setSyncNamespace)(le),ce=!0)};let pe=[],me=[],ge=!1;const Se=()=>(new Date).toISOString().slice(0,10),he=e=>new Date(Date.now()-864e5*e).toISOString().slice(0,10),ye=e=>e?e.slice(0,5):'',we=e=>Array.isArray(e)?e.filter(e=>e&&'object'==typeof e&&'string'==typeof e.allergen&&['gluten','crustaceans','molluscs','eggs','fish','peanuts','treenuts','soya','milk','celery','mustard','sesame','sulphites','lupin'].includes(e.allergen)&&(!e.severity||['intolerance','allergy','coeliac','anaphylaxis'].includes(e.severity))):[],ve=e=>JSON.parse(JSON.stringify(e));function be(e,t){const a=he(120);return{name:t?'walk_ins':'bookings',table:t?'walk_ins':'bookings',list:()=>U.useStore.getState().bookings.filter(a=>a.restaurantId===e&&!!a.walkIn===t),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id),writable:()=>'guest'!==re.getState().kind,filter:e=>e.gte(t?'walk_date':'booking_date',a),inWindow:e=>e.date>=a,toRow:(e,a)=>{const s=ve(e);return t?{id:e.id,venue_id:a,walk_date:e.date,arrived_at:e.seatedAt??e.createdAt,covers:Math.max(1,Math.min(200,e.partySize)),table_ids:e.table?e.table.split('+').map(e=>e.trim()).filter(Boolean):[],dog:!!e.dog,allergies:we(e.allergies),note:e.notes??'',status:'finished'===e.status?'left':'cancelled'===e.status||'noshow'===e.status?'undone':'seated',created_at:e.createdAt,doc:s}:{id:e.id,venue_id:a,ref:e.ref,customer_id:(0,$.isUuid)(e.customerId)?e.customerId:null,guest_name:e.name||'Guest',phone:e.phone??null,email:e.email??null,booking_date:e.date,booking_time:e.time,duration_mins:e.durationMins&&e.durationMins>=15&&e.durationMins<=720?e.durationMins:null,covers:Math.max(1,Math.min(200,e.partySize)),table_ids:e.table?e.table.split('+').map(e=>e.trim()).filter(Boolean):[],dog:!!e.dog,allergies:we(e.allergies),allergy_ack_by:e.allergyAck?.by??null,allergy_ack_at:e.allergyAck?.at??null,notes:e.notes??'',tags:e.tags??[],occasion:e.occasion??null,status:e.status,source:e.source??'in-person',security:e.security??'none',deposit_paid:e.depositPaid??0,seated_at:e.seatedAt??null,finished_at:e.finishedAt??null,created_at:e.createdAt,doc:s}},fromRow:a=>{if(!a.doc||'object'!=typeof a.doc)return null;const s={...a.doc,id:String(a.id),restaurantId:e};return!t&&a.status&&'declined'!==a.status&&(s.status=a.status),t&&(s.walkIn=!0),'saved-card'===s.security&&(s.security='none'),s},apply:(e,t)=>U.useStore.setState(a=>{const s=new Set(t),i=new Map(e.map(e=>[e.id,e])),n=a.bookings.filter(e=>!s.has(e.id)).map(e=>i.get(e.id)??e),r=new Set(n.map(e=>e.id));return{bookings:[...n,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>U.useStore.subscribe((t,a)=>{t.bookings!==a.bookings&&e()}),protect:!0}}function ke(e){const t=new Date(Date.now()-18144e5).toISOString();return{name:'orders',table:'takeaway_orders',list:()=>U.useStore.getState().orders.filter(t=>t.restaurantId===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id),writable:()=>'guest'!==re.getState().kind,filter:e=>e.gte('created_at',t),inWindow:e=>e.createdAt>=t,toRow:(e,t)=>({id:e.id,venue_id:t,ref:e.ref,customer_id:(0,$.isUuid)(e.customerId)?e.customerId:null,customer_name:e.customerName||'Guest',phone:e.phone??null,email:e.email??null,items:ve(e.lines??[]),allergies:we(e.allergies),notes:e.notes??null,slot_time:e.slotTime??null,ready_by:e.readyBy??null,subtotal:Math.round(e.subtotal??0),tip:Math.round(e.tip??0),total:Math.round(e.total??0),paid:Math.round(e.paid??0),status:e.status,channel:e.channel??null,confirmed_by:e.accepted?e.accepted.by:null,confirmed_at:e.accepted?e.accepted.at:null,created_at:e.createdAt,allergy_chain:ve(e.allergyChain??{}),readiness:ve(e.readiness??{}),allergy_ticks:ve(e.allergyTicks??{}),handover_check:e.handoverCheck?ve(e.handoverCheck):null,accepted:e.accepted?ve(e.accepted):null,doc:ve(e)}),fromRow:t=>t.doc&&'object'==typeof t.doc?{...t.doc,id:String(t.id),restaurantId:e,status:t.status??t.doc.status}:null,apply:(e,t)=>U.useStore.setState(a=>{const s=new Set(t),i=new Map(e.map(e=>[e.id,e])),n=a.orders.filter(e=>!s.has(e.id)).map(e=>i.get(e.id)??e),r=new Set(n.map(e=>e.id));return{orders:[...e.filter(e=>!r.has(e.id)),...n]}}),subscribe:e=>U.useStore.subscribe((t,a)=>{t.orders!==a.orders&&e()})}}function Ie(e){const t=he(60);return{protect:!0,name:'blocks',table:'blocks',list:()=>[...E.useBlocks.getState().blocks,...E.useBlocks.getState().removed].filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id)&&e.to>e.from,writable:()=>'guest'!==re.getState().kind,filter:e=>e.gte('block_date',t),inWindow:e=>e.date>=t,toRow:(e,t)=>({id:e.id,venue_id:t,block_date:e.date,from_time:e.from,to_time:e.to,reason:e.reason??null,note:e.note??null,area_id:e.areaId??null,area_name:e.areaName??null,created_by:e.by,created_at:e.createdAt,doc:ve(e)}),fromRow:t=>t.doc?{...t.doc,id:String(t.id),rid:e}:{id:String(t.id),rid:e,date:t.block_date,from:ye(t.from_time),to:ye(t.to_time),reason:t.reason??void 0,note:t.note??void 0,by:t.created_by??'',createdAt:t.created_at,areaId:t.area_id??void 0,areaName:t.area_name??void 0},apply:(e,t)=>E.useBlocks.setState(a=>{const s=new Set(t),i=new Map(e.map(e=>[e.id,e])),n=[...a.blocks,...a.removed].filter(e=>!s.has(e.id)).map(e=>i.get(e.id)??e),r=new Set(n.map(e=>e.id)),o=[...n,...e.filter(e=>!r.has(e.id))];return{blocks:o.filter(e=>!e.removedAt),removed:o.filter(e=>!!e.removedAt)}}),subscribe:e=>E.useBlocks.subscribe((t,a)=>{t.blocks===a.blocks&&t.removed===a.removed||e()})}}let Oe=null;function Re(e){const t=e=>ve({areas:e.areas??[],tables:e.tables??[],joins:e.joins??[],sections:e.sections??[],fixtures:e.fixtures??[]});return{name:'table_plan',table:'table_plans',list:()=>[t(C.useFloor.getState().plans[e]??(0,C.planOf)(e))],key:()=>'plan',rowKey:()=>'plan',syncable:()=>!0,writable:()=>de('floor.manage'),filter:e=>e.eq('is_active',!0),deletes:!1,toRow:(e,a)=>({id:Oe??(0,se.uuidFrom)(`plan:${a}`),venue_id:a,name:'Main',is_active:!0,...t(e),updated_by:re.getState().staffRef??le}),fromRow:e=>(Oe=String(e.id),t({areas:e.areas,tables:e.tables,joins:e.joins,sections:e.sections,fixtures:e.fixtures})),apply:t=>{const a=t[0]?(0,ie.withSeedBest)(e,t[0]):void 0;a&&C.useFloor.setState(t=>({plans:{...t.plans,[e]:a}}))},subscribe:e=>C.useFloor.subscribe((t,a)=>{t.plans!==a.plans&&e()})}}function Ae(e){return{protect:!0,name:'stock_items',table:'stock_items',conflict:'venue_id,key',list:()=>T.useShellStore.getState().items[e]??[],key:e=>e.key,rowKey:e=>String(e.key),syncable:()=>!0,writable:()=>de('stock.manage'),matchKey:e=>({key:e}),toRow:(e,t)=>({venue_id:t,key:e.key,name:e.name,plural:e.plural,unit:e.unit,low_at:e.lowAt,supplier_id:e.supplierId?(0,$.isUuid)(e.supplierId)?e.supplierId:(0,se.uuidFrom)(`sup:${t}:${e.supplierId}`):null,icon:e.icon,sort:e.sort,active:e.active}),fromRow:e=>{return{key:e.key,name:e.name,plural:e.plural,unit:e.unit,lowAt:Number(e.low_at),icon:e.icon??'\u2022',sort:e.sort??0,active:!1!==e.active,...e.supplier_id?{supplierId:(t=String(e.supplier_id),Le.get(t)??t)}:{}};var t},apply:(t,a)=>T.useShellStore.setState(s=>{const i=new Set(a),n=new Map(t.map(e=>[e.key,e])),r=(s.items[e]??[]).filter(e=>!i.has(e.key)).map(e=>n.get(e.key)??e),o=new Set(r.map(e=>e.key));return{items:{...s.items,[e]:[...r,...t.filter(e=>!o.has(e.key))]}}}),subscribe:e=>T.useShellStore.subscribe((t,a)=>{t.items!==a.items&&e()})}}const Ue=new Set;function De(e){const t=new Date(Date.now()-2592e5).toISOString();return{name:'stock_events',table:'stock_events',mode:'insert',list:()=>T.useShellStore.getState().events.filter(t=>t.rid===e&&(0,$.isUuid)(t.id)),key:e=>e.id,rowKey:e=>String(e.id),syncable:t=>(0,$.isUuid)(t.id)&&!!(T.useShellStore.getState().items[e]??[]).find(e=>e.key===t.kind),writable:()=>'guest'!==re.getState().kind&&('device'!==re.getState().kind||de('device.write')),filter:e=>e.gte('at',t).order('at',{ascending:!1}),inWindow:e=>e.at>=t,toRow:(e,t)=>({id:e.id,venue_id:t,item:e.kind,delta:e.delta,reason:e.reason,undoes:e.undoes&&(0,$.isUuid)(e.undoes)?e.undoes:null,by_name:e.by||'Team',app:e.app,at:e.at}),fromRow:t=>(Ue.add(String(t.id)),{id:String(t.id),rid:e,kind:t.item,delta:Number(t.delta),reason:t.reason,by:t.by_name??'',app:t.app??'',at:new Date(t.at).toISOString(),...t.undoes?{undoes:String(t.undoes)}:{}}),apply:(e,t)=>T.useShellStore.setState(a=>{const s=new Set(t),i=new Map(e.map(e=>[e.id,e])),n=a.events.filter(e=>!s.has(e.id)).map(e=>i.get(e.id)??e),r=new Set(n.map(e=>e.id));return{events:[...e.filter(e=>!r.has(e.id)),...n].sort((e,t)=>t.at.localeCompare(e.at)).slice(0,500)}}),subscribe:e=>T.useShellStore.subscribe((t,a)=>{t.events!==a.events&&e()})}}function Ee(e){let t={};return{name:'stock_counts',table:'stock_counts',list:()=>Object.entries(T.useShellStore.getState().server[e]?.counts??{}).map(([e,t])=>({item:e,quantity:t})),key:e=>e.item,rowKey:e=>String(e.item),syncable:()=>!1,writable:()=>!1,toRow:()=>({}),fromRow:e=>({item:String(e.item),quantity:Number(e.quantity)}),apply:(a,s)=>{t={...T.useShellStore.getState().server[e]?.counts??{}};for(const e of s)delete t[e];for(const e of a)t[e.item]=e.quantity;T.useShellStore.setState(a=>({server:{...a.server,[e]:{counts:t,seen:[...Ue]}}}))},afterRead:()=>{T.useShellStore.getState().server[e]||T.useShellStore.setState(t=>({server:{...t.server,[e]:{counts:{},seen:[...Ue]}}}))},subscribe:()=>()=>{}}}const Ce=new Set;function Te(e){return{name:'recipe_cards',table:'recipe_cards',list:()=>{const t=U.useStore.getState().menu;return N.useCardStore.getState().cards.filter(t=>t.restaurantId===e).map(e=>({card:e,item:t.find(t=>t.id===e.menuItemId)}))},key:e=>e.card.id,rowKey:e=>String(e.id),syncable:t=>(0,$.isUuid)(t.card.id)&&!((0,d.isAnchorage)(e)&&(0,d.isDemoCard)(t.card)),writable:()=>de('recipes.edit'),toRow:(t,a)=>{let s=t.card;(0,d.isAnchorage)(e)&&(s={...s,signOff:(0,d.demoActor)(s.signOff?.by)?null:s.signOff,allergensConfirmed:(0,d.demoActor)(s.allergensConfirmed?.by)?void 0:s.allergensConfirmed});const i=t.item&&(0,d.isAnchorage)(e)&&(0,d.demoActor)(t.item.signOff?.by)?{...t.item,signOff:null}:t.item;if(s.photo?.startsWith('local:')){const e=(0,se.photoPath)(a,s),t=Ne(s.photo);t&&((0,N.cachePhotoAs)(e,t),Me(e,t)),s={...s,photo:e}}const{row:n,extra:r}=(0,se.cardToRow)(s,a);return{...n,...r,doc:ve({card:s,item:i})}},fromRow:t=>{const a=t.doc;if(!a?.card)return null;const s=t.signed_off_by&&t.signed_off_at?{by:t.signed_off_by,at:new Date(t.signed_off_at).toISOString()}:null;return{card:{...a.card,id:String(t.id),restaurantId:e,signOff:s&&a.card.signOff?a.card.signOff:s,...t.photo_url?{photo:t.photo_url}:{}},item:a.item?{...a.item,restaurantId:e,signOff:(0,d.isAnchorage)(e)&&(0,d.demoActor)(a.item.signOff?.by)?null:a.item.signOff}:void 0}},supersededBy:(e,t)=>t.some(t=>t.card.menuItemId===e.card.menuItemId&&t.card.id!==e.card.id),apply:(e,t)=>{if(!de('recipes.edit')&&t.length){const e=new Set(t);N.useCardStore.setState(t=>({cards:t.cards.map(t=>e.has(t.id)&&t.signOff?{...t,signOff:null}:t)})),t=[]}const a=new Set(t);N.useCardStore.setState(t=>{const s=new Map(e.map(e=>[e.card.id,e.card])),i=new Set(e.map(e=>e.card.menuItemId)),n=t.cards.filter(e=>a.has(e.id)).map(e=>e.menuItemId),r=t.cards.filter(e=>!a.has(e.id)&&(s.has(e.id)||!i.has(e.menuItemId))).map(e=>s.get(e.id)??e),o=new Set(r.map(e=>e.id));return n.length&&U.useStore.setState(e=>({menu:e.menu.map(e=>n.includes(e.id)?{...e,hidden:!0}:e)})),{cards:[...r,...e.filter(e=>!o.has(e.card.id)).map(e=>e.card)],removed:[...t.removed,...n]}});const s=e.map(e=>e.item).filter(Boolean);s.length&&U.useStore.setState(e=>{const t=new Map(s.map(e=>[e.id,e])),a=e.menu.map(e=>t.get(e.id)??e),i=new Set(a.map(e=>e.id));return{menu:[...a,...s.filter(e=>!i.has(e.id))]}})},subscribe:e=>{const t=N.useCardStore.subscribe((t,a)=>{t.cards!==a.cards&&e()}),a=U.useStore.subscribe((t,a)=>{t.menu!==a.menu&&e()});return()=>{t(),a()}}}}const Ne=e=>(0,N.readLocalPhoto)(e);async function Me(e,t){if(!Ce.has(e)){Ce.add(e);try{const a=await(await fetch(t)).blob(),{error:s}=await ne().storage.from(se.RECIPE_PHOTO_BUCKET).upload(e,a,{upsert:!0,contentType:a.type||'image/jpeg'});if(s)throw s}catch(t){Ce.delete(e),oe({lastError:`Photo upload: ${String(t?.message??t)}`})}}}const Ke=new Map,xe=(0,y.create)(()=>({n:0}));(0,N.setStoragePhotoResolver)(e=>{const t=Ke.get(e);return t&&Date.now()-t.at<3e6?t.url:(0,v.isSupabaseConfigured)()&&'off'!==re.getState().mode?(t||(Ke.set(e,{url:'',at:Date.now()}),ne().storage.from(se.RECIPE_PHOTO_BUCKET).createSignedUrl(e,3600).then(({data:t})=>{t?.signedUrl&&(Ke.set(e,{url:t.signedUrl,at:Date.now()}),xe.setState(e=>({n:e.n+1})),N.useCardStore.setState(e=>({cards:[...e.cards]})))}).catch(()=>{})),t?.url||null):null});const Le=new Map;const qe=(e,t)=>{const a=(0,$.isUuid)(t)?t:(0,se.uuidFrom)(`sup:${e}:${t}`);return Le.set(a,t),a};function Pe(e){return{name:'order_sheets',table:'suppliers',list:()=>M.useOrderSheets.getState().sheets[e]??[],key:e=>e.id,rowKey:e=>String(e.doc?.localId??e.id),syncable:t=>!((0,d.isAnchorage)(e)&&'os-veg'===t.id&&t.placeholder),writable:()=>de('suppliers.manage'),toRow:(e,t)=>({id:qe(t,e.id),venue_id:t,name:e.name||'Supplier',category:e.goods||null,contact:e.contact??null,phones:e.number?[e.number]:[],website:e.url||null,cutoff:e.cutoff||null,order_days:e.orderDays,delivery_days:e.deliveryDays,notes:e.notes||null,doc:{kind:'sheet',localId:e.id,sheet:ve(e)}}),fromRow:e=>'sheet'!==e.doc?.kind?null:(Le.set(String(e.id),String(e.doc.localId)),e.doc.sheet),apply:(t,a)=>M.useOrderSheets.setState(s=>{const i=new Set(a),n=new Map(t.map(e=>[e.id,e])),r=(s.sheets[e]??[]).filter(e=>!i.has(e.id)).map(e=>n.get(e.id)??e),o=new Set(r.map(e=>e.id));return{sheets:{...s.sheets,[e]:[...r,...t.filter(e=>!o.has(e.id))]}}}),subscribe:e=>M.useOrderSheets.subscribe((t,a)=>{t.sheets!==a.sheets&&e()}),matchKey:e=>({id:(0,$.isUuid)(e)?e:(0,se.uuidFrom)(`sup:${re.getState().venueId}:${e}`)})}}let $e=!1,je=!1;const Be=new Map,Fe=new Map,We=new Map,Ve=new Map,He=e=>'owner'===e.role?'owner':'manager'===e.role?'Supervisor'===e.level?'supervisor':'manager':'Head Chef'===e.level?'head_chef':'staff',Ge=e=>'owner'===e?{role:'owner',level:'Owner'}:'manager'===e?{role:'manager',level:'Manager'}:'supervisor'===e?{role:'manager',level:'Supervisor'}:'head_chef'===e?{role:'staff',level:'Head Chef'}:{role:'staff',level:'Staff'},Qe=(e,t)=>t&&'owner'!==e.role&&'manager'!==e.role?{role:'manager',level:e.level,managerAccess:!0}:{...e,managerAccess:void 0},Je=e=>ve({id:e.id,name:e.name,role:e.role,job:e.job,active:e.active,level:e.level??Ge(He(e)).level,dept:e.dept??'',nickname:e.nickname,displayClock:e.displayClock,temp:e.temp,tempUntil:e.tempUntil,managerAccess:e.managerAccess||void 0,ownerAccess:e.ownerAccess||void 0,...e.temp&&e.tempUntil&&e.tempUntil(new Date).toLocaleDateString('en-CA',{timeZone:'Europe/London'});const Ze=(e=new Date)=>{const t=new Date(e);return t.setDate(t.getDate()-(t.getDay()+6)%7),t.toISOString().slice(0,10)},Xe=e=>{const t=Math.round(60*e)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`};function Ye(){return{name:'rota',table:'rota_shifts',list:()=>P.useOwner.getState().shifts,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id)&&Be.has(e.staffId),writable:()=>de('rota.manage'),toRow:(e,t)=>({id:e.id,venue_id:t,staff_id:Be.get(e.staffId),staff_ref:e.staffId,shift_date:e.date??(()=>{const t=new Date(Ze());return t.setDate(t.getDate()+(e.day??0)),t.toISOString().slice(0,10)})(),start_time:Xe(e.start),end_time:Xe(e.end),published:!!e.published,doc:ve(e)}),fromRow:e=>{if(!e.doc)return null;const t=e.doc,a=t.date??String(e.shift_date).slice(0,10),[s,i,n]=a.split('-').map(Number);return{...t,id:String(e.id),date:a,day:(new Date(s,i-1,n).getDay()+6)%7,published:!!e.published}},apply:(e,t)=>P.useOwner.setState(a=>{const s=new Set(t),i=new Map(e.map(e=>[e.id,e])),n=a.shifts.filter(e=>!s.has(e.id)).map(e=>i.get(e.id)??e),r=new Set(n.map(e=>e.id));return{shifts:[...n,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>P.useOwner.subscribe((t,a)=>{t.shifts!==a.shifts&&e()})}}function et(){const t=he(62),a=e=>de('rota.manage')||e.staffId===re.getState().staffRef;return{name:'attendance',table:'attendance',list:()=>P.useOwner.getState().attendance,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id)&&a(e),writable:()=>'staff'===re.getState().kind,filter:e=>e.gte('work_date',t),inWindow:e=>e.date>=t,toRow:(t,a)=>({id:t.id,venue_id:a,staff_id:Be.get(t.staffId)??null,staff_ref:t.staffId,work_date:t.date,clock_in:t.in??null,clock_out:t.out??null,breaks:ve(t.breaks??[]),break_mins:t.breakMins??0,doc:ve((0,u.privateAttendance)(e.VENUE_RID,t))}),fromRow:t=>{if(!t.doc)return null;const a=(0,u.privateAttendance)(e.VENUE_RID,{...t.doc,id:String(t.id)});return'confirmed'===t.status?a.signOff={by:String(t.confirmed_by_name??a.signOff?.by??'Manager'),byId:a.signOff?.byId??'',at:t.confirmed_at?new Date(t.confirmed_at).toISOString():a.signOff?.at??''}:delete a.signOff,a},apply:(e,t)=>P.useOwner.setState(a=>{const s=new Set(t),i=new Map(e.map(e=>[e.id,e])),n=a.attendance.filter(e=>!s.has(e.id)).map(e=>i.get(e.id)??e),r=new Set(n.map(e=>e.id));return{attendance:[...n,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>P.useOwner.subscribe((t,a)=>{t.attendance!==a.attendance&&e()})}}function tt(){const e=he(62);return{name:'time_requests',table:'time_requests',mode:'insert',deletes:!1,list:()=>P.useOwner.getState().timeRequests,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id)&&e.staffId===re.getState().staffRef&&'open'===e.status,writable:()=>'staff'===re.getState().kind,filter:t=>t.gte('work_date',e),inWindow:t=>t.date>=e,toRow:(e,t)=>({id:e.id,venue_id:t,staff_id:Be.get(e.staffId)??null,staff_ref:e.staffId,work_date:e.date,attendance_id:e.attendanceId&&(0,$.isUuid)(e.attendanceId)?e.attendanceId:null,kind:e.kind,suggested_in:e.suggestedIn??null,suggested_out:e.suggestedOut??null,note:(e.note??'').slice(0,300)||null,status:'open',doc:ve({...e,status:'open'})}),fromRow:e=>{const t=e.doc??{};return{...t,id:String(e.id),staffId:String(e.staff_ref),date:String(e.work_date).slice(0,10),attendanceId:e.attendance_id?String(e.attendance_id):t.attendanceId,kind:e.kind,suggestedIn:e.suggested_in?new Date(e.suggested_in).toISOString():void 0,suggestedOut:e.suggested_out?new Date(e.suggested_out).toISOString():void 0,note:e.note??'',at:t.at??new Date(e.created_at).toISOString(),status:e.status,resolvedBy:e.resolved_by_name??void 0,resolvedAt:e.resolved_at?new Date(e.resolved_at).toISOString():void 0}},apply:(e,t)=>P.useOwner.setState(a=>{const s=new Set(t),i=new Map(e.map(e=>[e.id,e])),n=a.timeRequests.filter(e=>!s.has(e.id)).map(e=>i.get(e.id)??e),r=new Set(n.map(e=>e.id));return{timeRequests:[...e.filter(e=>!r.has(e.id)),...n]}}),subscribe:e=>P.useOwner.subscribe((t,a)=>{t.timeRequests!==a.timeRequests&&e()})}}function at(t){P.timesheetRemote.send=(a,s)=>{if(!de('rota.manage')||!(0,$.isUuid)(s.id))return!1;if('time_request_resolve'===a){const e=s;return R.mutationQueue.enqueue({table:'time_requests',venueId:t,kind:'rpc',fn:a,rowKey:e.id,values:{p_id:e.id,p_status:e.status,p_doc:ve(e)}}),!0}const i=s;if('attendance_confirm'===a)return R.mutationQueue.enqueue({table:'attendance',venueId:t,kind:'rpc',fn:a,rowKey:i.id,values:{p_id:i.id,p_doc:ve((0,u.privateAttendance)(e.VENUE_RID,i))}}),!0;if(!i.in)return!1;const n=i.adjusted?.reason??'';return R.mutationQueue.enqueue({table:'attendance',venueId:t,kind:'rpc',fn:'attendance_override',rowKey:i.id,values:{p_id:i.id,p_venue:t,p_staff_ref:i.staffId,p_work_date:i.date,p_clock_in:i.in,p_clock_out:i.out??null,p_break_mins:i.breakMins??0,p_breaks:ve(i.breaks??[]),p_reason:n,p_doc:ve((0,u.privateAttendance)(e.VENUE_RID,i))}}),!0},me.push(()=>{P.timesheetRemote.send=null})}function st(e){return{name:'outbox',table:'outbox',mode:'insert',list:()=>U.useStore.getState().outbox.filter(t=>t.restaurantId===e),key:e=>e.id,rowKey:e=>String(e.local_id??e.id),syncable:()=>!0,writable:()=>'staff'===re.getState().kind,filter:e=>e.gte('created_at',new Date(Date.now()-2592e6).toISOString()),inWindow:()=>!1,toRow:(e,t)=>{return{id:(a=e.id,(0,$.isUuid)(a)?a:(0,se.uuidFrom)(`outbox:${a}`)),local_id:e.id,venue_id:t,channel:e.channel,kind:e.kind,to_address:e.to||'',to_name:e.toName||null,subject:e.subject??null,body:e.body,html:e.html??null,ref_type:e.refType,ref_id:(0,$.isUuid)(e.refId)?e.refId:null,ref:e.ref,status:e.status,provider:e.provider,error:e.error??null,created_at:e.at,doc:ve(e)};var a},fromRow:t=>t.doc?{...t.doc,restaurantId:e}:null,apply:e=>U.useStore.setState(t=>{const a=new Set(t.outbox.map(e=>e.id));return{outbox:[...e.filter(e=>!a.has(e.id)),...t.outbox].sort((e,t)=>t.at.localeCompare(e.at)).slice(0,300)}}),subscribe:e=>U.useStore.subscribe((t,a)=>{t.outbox!==a.outbox&&e()})}}const it=e=>U.useStore.getState().events.filter(t=>t.restaurantId===e&&!t.example);function nt(e,t){if(!Array.isArray(t))return;const a=t.filter(e=>e&&'string'==typeof e.id&&'string'==typeof e.date&&'string'==typeof e.title).map(t=>({...t,restaurantId:e,example:!1}));U.useStore.setState(t=>({events:[...t.events.filter(t=>!(t.restaurantId===e&&!t.example)),...a]}))}function rt(e){return{name:'venue',table:'venues',venueColumn:'id',mode:'update',list:()=>{const t=U.useStore.getState(),a=t.restaurants.find(t=>t.id===e);return[ve({restaurant:a,msgTemplates:t.msgTemplates[e]??{},display:C.useFloor.getState().settings[e]??{},games:!1!==a?.settings?.games,events:it(e)})]},key:()=>'venue',rowKey:()=>'venue',syncable:()=>!0,writable:()=>de('venue.settings'),matchKey:()=>({}),toRow:e=>({name:e.restaurant?.name,settings:{...dt??{},whatsapp:e.restaurant?.settings?.whatsapp||null,app:{...dt?.app??{},restaurant:e.restaurant,events:e.events??[]},ops:{...dt?.ops??{},msgTemplates:e.msgTemplates,display:e.display}},feature_flags:{...ot??{},games:e.games,takeaway:!e.restaurant?.settings?.takeawayPaused}}),fromRow:t=>{ot=t.feature_flags??{},dt=t.settings??{};const a=t.settings?.app?.restaurant;if(!a)return null;const s='string'==typeof t.settings?.whatsapp?t.settings.whatsapp:void 0;return s&&!a.settings?.whatsapp&&(a.settings={...a.settings,whatsapp:s}),ve({restaurant:{...a,id:e},msgTemplates:t.settings?.ops?.msgTemplates??{},display:t.settings?.ops?.display??{},games:!1!==t.feature_flags?.games,...Array.isArray(t.settings?.app?.events)?{events:t.settings.app.events}:{}})},apply:t=>{const s=t[0];s&&(U.useStore.setState(t=>({restaurants:t.restaurants.map(t=>t.id===e&&s.restaurant?(0,a.withWildingsAddress)({...s.restaurant,id:e,settings:{...s.restaurant.settings,games:s.games}}):t),msgTemplates:{...t.msgTemplates,[e]:s.msgTemplates??{}}})),s.display&&Object.keys(s.display).length&&C.useFloor.setState(t=>({settings:{...t.settings,[e]:s.display}})),s.events&&nt(e,s.events))},subscribe:e=>{const t=U.useStore.subscribe((t,a)=>{t.restaurants===a.restaurants&&t.msgTemplates===a.msgTemplates&&t.events===a.events||e()}),a=C.useFloor.subscribe((t,a)=>{t.settings!==a.settings&&e()});return()=>{t(),a()}}}}let ot=null,dt=null;const ut=()=>new Date(Date.now()-2592e6).toISOString(),lt=e=>{if(!e.startsWith('dm:'))return['all','kitchen','foh','managers'].includes(e)?e:null;const t=e.split(':').slice(1).map(e=>Be.get(e));return 2===t.length&&t[0]&&t[1]?`dm:${[t[0],t[1]].sort().join(':')}`:null},ct=e=>{if(!e.startsWith('dm:'))return e;const t=e.split(':').slice(1).map(e=>Fe.get(e));return 2===t.length&&t[0]&&t[1]?(0,X.dmId)(t[0],t[1]):null},ft=()=>re.getState().perms.includes('*');function pt(){const e=()=>re.getState().staffRef;return{name:'chat',table:'chat_messages',deletes:!1,list:()=>P.useOwner.getState().chat.filter(e=>(0,$.isUuid)(e.id)).map(e=>ve({id:e.id,ch:e.ch,from:e.from,text:e.text,photo:e.photo,at:e.at,removed:!!e.removed})),key:e=>e.id,rowKey:e=>String(e.id),syncable:t=>!!lt(t.ch)&&(t.from===e()||ft()&&!t.ch.startsWith('dm:')&&t.removed),writable:()=>'staff'===re.getState().kind,filter:e=>e.gte('created_at',ut()).order('created_at',{ascending:!1}),inWindow:e=>e.at>=ut(),toRow:(e,t)=>{const a=lt(e.ch);if(!a)throw new Error('chat: unknown person');const s='system'===e.from?null:Be.get(e.from)??null;return{id:e.id,venue_id:t,channel:a,from_staff:s,body:e.text??null,photo:e.photo??null,removed:e.removed,created_at:e.at}},fromRow:e=>{const t=ct(String(e.channel));if(!t)return null;const a=e.from_staff?Fe.get(String(e.from_staff)):'system';return a?ve({id:String(e.id),ch:t,from:a,text:e.body??void 0,photo:e.photo??void 0,at:new Date(e.created_at).toISOString(),removed:!!e.removed}):null},apply:(t,a)=>P.useOwner.setState(s=>{const i=new Set(a),n=new Map(t.map(e=>[e.id,e])),r=e(),o=s.chat.filter(e=>!i.has(e.id)).map(e=>n.has(e.id)?{...e,...n.get(e.id)}:e),d=new Set(o.map(e=>e.id)),u=t.filter(e=>!d.has(e.id)).map(e=>({...e,reactions:{},seenBy:e.from===r?[e.from]:[]}));return{chat:u.length?[...o,...u].sort((e,t)=>e.at.localeCompare(t.at)):o}}),subscribe:e=>P.useOwner.subscribe((t,a)=>{t.chat!==a.chat&&e()}),onRemote:(t,a)=>{if('upsert'!==a||t.removed)return;const s=t.from_staff?Fe.get(String(t.from_staff)):'system',i=ct(String(t.channel)),n=e();if(!i||!n||s===n||Date.now()-new Date(t.created_at).getTime()>12e4)return;const r=P.useOwner.getState();if((r.chatMuted[n]??[]).includes(i))return;if(!(0,X.inChannel)(i,r.staff.find(e=>e.id===n)))return;if((0,Y.soundAllowed)())try{(0,Y.chime)('soft')}catch{}const o=r.staff.find(e=>e.id===s)?.name?.replace(' (example)','')??'The team',d=i.startsWith('dm:')?'sent you a message':`in ${'all'===i?'Everyone':'foh'===i?'Front of house':'kitchen'===i?'Kitchen':'managers'===i?'Managers':i}`,u=String(t.body??t.text??'').slice(0,120);(0,c.notify)({id:`chat:${t.id}`,icon:'\ud83d\udcac',kicker:'NEW MESSAGE',title:`${o} ${d}`,body:u||void 0,timeoutMs:7e3,testID:'chat-notice'})}}}function mt(e){return{name:'reminders',table:'venue_reminders',list:()=>{const t=S.useReminders.getState(),a=t.reminders.filter(t=>t.rid===e&&(0,$.isUuid)(t.id)).map(e=>{const{rid:t,...a}=e;return{id:e.id,kind:'reminder',doc:ve(a)}}),s=t.rules[e];return s?[...a,{id:s.id,kind:'break_rules',doc:ve(s)}]:a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id),writable:()=>de('venue.settings'),toRow:(e,t)=>({id:e.id,venue_id:t,kind:e.kind,doc:e.doc,updated_at:(new Date).toISOString()}),fromRow:e=>({id:String(e.id),kind:'break_rules'===e.kind?'break_rules':'reminder',doc:e.doc??{}}),apply:(t,a)=>S.useReminders.setState(s=>{const i=new Set(a),n={...s.rules},r=t.filter(e=>'break_rules'===e.kind);for(const t of r)n[e]={...(0,h.clampRules)(t.doc),id:t.id,updatedAt:t.doc.updatedAt};n[e]&&i.has(n[e].id)&&delete n[e];const o=new Map(t.filter(e=>'reminder'===e.kind).map(t=>[t.id,{...t.doc,id:t.id,rid:e}])),d=s.reminders.filter(e=>!i.has(e.id)).map(e=>o.get(e.id)??e),u=new Set(d.map(e=>e.id));return{rules:n,reminders:[...d,...[...o.values()].filter(e=>!u.has(e.id))]}}),subscribe:e=>S.useReminders.subscribe((t,a)=>{t.reminders===a.reminders&&t.rules===a.rules||e()})}}function gt(e){const t=he(14);return{name:'reminder_done',table:'reminder_done',mode:'insert',deletes:!1,list:()=>S.useReminders.getState().done.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id)&&(0,$.isUuid)(e.reminderId)&&e.staffRef===re.getState().staffRef,writable:()=>'staff'===re.getState().kind,filter:e=>e.gte('for_date',t).order('done_at',{ascending:!1}),inWindow:e=>e.forDate>=t,toRow:(e,t)=>({id:e.id,venue_id:t,reminder_id:e.reminderId,for_date:e.forDate,staff_ref:e.staffRef,staff_name:e.staffName.slice(0,80),done_at:e.at}),fromRow:t=>({id:String(t.id),rid:e,reminderId:String(t.reminder_id),forDate:String(t.for_date).slice(0,10),staffRef:t.staff_ref??'',staffName:t.staff_name??'Team',at:new Date(t.done_at).toISOString()}),apply:(e,t)=>S.useReminders.setState(a=>{const s=new Set(t),i=new Map(e.map(e=>[e.id,e])),n=a.done.filter(e=>!s.has(e.id)).map(e=>i.get(e.id)??e),r=new Set(n.map(e=>e.id));return{done:[...e.filter(e=>!r.has(e.id)),...n].sort((e,t)=>t.at.localeCompare(e.at)).slice(0,400)}}),subscribe:e=>S.useReminders.subscribe((t,a)=>{t.done!==a.done&&e()})}}function _t(e,t,a,s=()=>!0){const i=new Set(a),n=new Map(t.map(e=>[e.id,e])),r=e.filter(e=>!s(e)||!i.has(e.id)).map(e=>s(e)&&n.has(e.id)?n.get(e.id):e),o=new Set(r.map(e=>e.id));return[...r,...t.filter(e=>!o.has(e.id))]}const St=e=>null==e||''===e?null:Number(e),ht=e=>e.filter(e=>!e.startsWith('data:'));function yt(e){return{name:'cash_ups',table:'cash_ups',list:()=>B.useCashUp.getState().cashUps.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id)&&!!e.confirmedAt,writable:()=>de('wages.manage')||(0,l.hasCashUpAccess)(),deletes:!1,filter:e=>e.gte('for_date',he(400)),toRow:(e,t)=>({id:e.id,venue_id:t,for_date:e.date,vals:ve(e.vals),cash_tips:'number'==typeof e.vals.cashTips?e.vals.cashTips:null,card_tips:'number'==typeof e.vals.cardTips?e.vals.cardTips:null,photos:ht(e.photos),read_by:e.readBy??null,confirmed_by:e.confirmedBy??null,confirmed_at:e.confirmedAt??null,updated_at:(new Date).toISOString()}),fromRow:t=>({id:String(t.id),rid:e,date:String(t.for_date),vals:t.vals??{},photos:t.photos??[],readBy:t.read_by??null,confirmedBy:t.confirmed_by??void 0,confirmedAt:t.confirmed_at??void 0,onServer:!0,unlockedUntil:t.unlocked_until??void 0,unlockedBy:t.unlocked_by??void 0}),apply:(t,a)=>B.useCashUp.setState(s=>({cashUps:_t(s.cashUps,t.map(e=>{const t=s.cashUps.find(t=>t.id===e.id);return t&&!e.photos.length?{...e,photos:t.photos}:e}),a,t=>t.rid===e)})),subscribe:e=>B.useCashUp.subscribe((t,a)=>{t.cashUps!==a.cashUps&&e()})}}function wt(e){return{name:'sales_reports',table:'sales_reports',list:()=>B.useCashUp.getState().sales.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id)&&!!e.confirmedAt,writable:()=>de('wages.manage')||(0,l.hasCashUpAccess)(),deletes:!1,toRow:(e,t)=>({id:e.id,venue_id:t,week_start:e.weekStart,vals:ve(e.vals),categories:e.categories,photos:ht(e.photos),read_by:e.readBy??null,confirmed_by:e.confirmedBy??null,confirmed_at:e.confirmedAt??null,updated_at:(new Date).toISOString()}),fromRow:t=>({id:String(t.id),rid:e,weekStart:String(t.week_start),vals:t.vals??{},categories:t.categories??[],photos:t.photos??[],readBy:t.read_by??null,confirmedBy:t.confirmed_by??void 0,confirmedAt:t.confirmed_at??void 0,onServer:!0,unlockedUntil:t.unlocked_until??void 0,unlockedBy:t.unlocked_by??void 0}),apply:(t,a)=>B.useCashUp.setState(s=>({sales:_t(s.sales,t.map(e=>{const t=s.sales.find(t=>t.id===e.id);return t&&!e.photos.length?{...e,photos:t.photos}:e}),a,t=>t.rid===e)})),subscribe:e=>B.useCashUp.subscribe((t,a)=>{t.sales!==a.sales&&e()})}}function vt(e){return{name:'cashup_settings',table:'cashup_settings',conflict:'venue_id',list:()=>{const t=B.useCashUp.getState().settings[e];return t?[t]:[]},key:e=>e.id,rowKey:()=>(0,B.cashSettingsId)(e),syncable:e=>!!e.updatedAt,writable:()=>de('wages.manage'),deletes:!1,toRow:(e,t)=>({venue_id:t,doc:ve({cashFields:e.cashFields,salesFields:e.salesFields}),updated_at:(new Date).toISOString()}),fromRow:t=>({...t.doc,id:(0,B.cashSettingsId)(e),updatedAt:t.updated_at??void 0}),apply:t=>B.useCashUp.setState(a=>t[0]?{settings:{...a.settings,[e]:t[0]}}:a),subscribe:e=>B.useCashUp.subscribe((t,a)=>{t.settings!==a.settings&&e()})}}function bt(e){return{name:'day_tips',table:'day_tips',list:()=>B.useCashUp.getState().tips.filter(t=>t.rid===e).map(e=>({...e,id:e.date})),key:e=>e.id,rowKey:e=>String(e.for_date),syncable:()=>!1,writable:()=>!1,deletes:!1,filter:e=>e.gte('for_date',he(120)),toRow:()=>({}),fromRow:t=>({id:String(t.for_date),rid:e,date:String(t.for_date),total:Number(t.total),postedAt:String(t.posted_at),postedBy:t.posted_by??void 0}),apply:t=>B.useCashUp.setState(a=>{const s=new Map(t.map(e=>[e.date,e])),i=a.tips.filter(t=>!(t.rid===e&&s.has(t.date)));return{tips:[...t.map(({id:e,...t})=>t),...i]}}),subscribe:e=>B.useCashUp.subscribe((t,a)=>{t.tips!==a.tips&&e()})}}function kt(e){return{name:'tips_pot_events',table:'tips_pot_events',mode:'insert',deletes:!1,list:()=>B.useCashUp.getState().pot.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id),writable:()=>de('wages.manage'),toRow:(e,t)=>({id:e.id,venue_id:t,kind:e.kind,for_date:e.forDate??null,through_date:e.throughDate??null,amount:e.amount,reason:e.reason??null,by_name:e.by,at:e.at}),fromRow:t=>({id:String(t.id),rid:e,kind:'payout'===t.kind?'payout':'correction',forDate:t.for_date??void 0,throughDate:t.through_date??void 0,amount:St(t.amount)??0,reason:t.reason??void 0,by:String(t.by_name),at:String(t.at)}),apply:(t,a)=>B.useCashUp.setState(s=>({pot:_t(s.pot,t,a,t=>t.rid===e)})),subscribe:e=>B.useCashUp.subscribe((t,a)=>{t.pot!==a.pot&&e()})}}function It(e){return{name:'tips_settings',table:'tips_settings',conflict:'venue_id',deletes:!1,list:()=>{const t=B.useCashUp.getState().show[e];return t?[{id:'show',...t}]:[]},key:e=>e.id,rowKey:()=>'show',syncable:()=>!0,writable:()=>de('wages.manage'),toRow:(e,t)=>({venue_id:t,show_today:e.showToday,show_pot:e.showPot,updated_at:(new Date).toISOString()}),fromRow:e=>({id:'show',showToday:!1!==e.show_today,showPot:!1!==e.show_pot}),apply:t=>B.useCashUp.setState(a=>t[0]?{show:{...a.show,[e]:{showToday:t[0].showToday,showPot:t[0].showPot}}}:a),subscribe:e=>B.useCashUp.subscribe((t,a)=>{t.show!==a.show&&e()})}}function Ot(e){return{name:'scheduled_notifications',table:'scheduled_notifications',list:()=>j.useNotifs.getState().items.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id),writable:()=>de('venue.settings'),deletes:!1,toRow:(e,t)=>{const{rid:a,...s}=e;return{id:e.id,venue_id:t,doc:ve(s),updated_at:(new Date).toISOString()}},fromRow:t=>({...t.doc,id:String(t.id),rid:e}),apply:(t,a)=>j.useNotifs.setState(s=>({items:_t(s.items,t,a,t=>t.rid===e)})),subscribe:e=>j.useNotifs.subscribe((t,a)=>{t.items!==a.items&&e()})}}function Rt(e){return{name:'order_lists',table:'order_lists',list:()=>{const t=F.useOrderLists.getState(),a=t.lists.filter(t=>t.rid===e&&(0,$.isUuid)(t.id)).map(e=>{const{rid:t,...a}=e;return{id:e.id,kind:'list',doc:ve(a)}}),s=t.settings[e];return s?[...a,{id:s.id,kind:'settings',doc:ve(s)}]:a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id),writable:()=>de('venue.settings')||de('suppliers.order'),deletes:!1,toRow:(e,t)=>({id:e.id,venue_id:t,kind:e.kind,doc:e.doc,updated_at:(new Date).toISOString()}),fromRow:e=>({id:String(e.id),kind:'settings'===e.kind?'settings':'list',doc:e.doc??{}}),apply:(t,a)=>F.useOrderLists.setState(s=>{const i={...s.settings};for(const a of t.filter(e=>'settings'===e.kind))i[e]={...W.DEFAULT_ORDER_LIST_SETTINGS,...a.doc,id:a.id};const n=t.filter(e=>'list'===e.kind).map(t=>({...t.doc,id:t.id,rid:e}));return{settings:i,lists:_t(s.lists,n,a,t=>t.rid===e)}}),subscribe:e=>F.useOrderLists.subscribe((t,a)=>{t.lists===a.lists&&t.settings===a.settings||e()})}}function At(e){const t=()=>de('venue.settings')||de('suppliers.order');return{name:'order_list_items',table:'order_list_items',list:()=>F.useOrderLists.getState().items.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:a=>(0,$.isUuid)(a.id)&&(0,$.isUuid)(a.listId)&&(t()||'open'===a.status&&(0,F.orderSettingsOf)(e).allowStaff),writable:()=>'staff'===re.getState().kind,deletes:!0,toRow:(e,a)=>{const{rid:s,...i}=e;return{id:e.id,venue_id:a,list_id:e.listId,status:e.status,added_by_ref:(t()?e.addedBy:re.getState().staffRef)||null,doc:ve(i),updated_at:(new Date).toISOString()}},fromRow:t=>({...t.doc,id:String(t.id),listId:String(t.list_id),status:t.status??'open',rid:e}),apply:(t,a)=>F.useOrderLists.setState(s=>({items:_t(s.items,t,a,t=>t.rid===e)})),subscribe:e=>F.useOrderLists.subscribe((t,a)=>{t.items!==a.items&&e()})}}function Ut(e){const t=he(400);return{name:'order_list_history',table:'order_list_history',mode:'insert',deletes:!1,list:()=>F.useOrderLists.getState().history.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id),writable:()=>de('venue.settings')||de('suppliers.order'),filter:e=>e.gte('finished_at',t).order('finished_at',{ascending:!1}).limit(300),toRow:(e,t)=>{const{rid:a,...s}=e;return{id:e.id,venue_id:t,list_id:e.listId,finished_at:e.finishedAt,finished_by:e.finishedByName.slice(0,80),doc:ve(s)}},fromRow:t=>({...t.doc,id:String(t.id),rid:e}),apply:(t,a)=>F.useOrderLists.setState(s=>({history:_t(s.history,t,a,t=>t.rid===e).sort((e,t)=>t.finishedAt.localeCompare(e.finishedAt)).slice(0,300)})),subscribe:e=>F.useOrderLists.subscribe((t,a)=>{t.history!==a.history&&e()})}}function Dt(e){return{name:'venue_clock_area',table:'venue_clock_area',conflict:'venue_id',deletes:!1,list:()=>{const t=V.useClockArea.getState().areas[e];return t&&t.updatedAt?[{id:'area',doc:ve(t)}]:[]},key:()=>'area',rowKey:()=>'area',syncable:()=>!0,matchKey:()=>({}),writable:()=>de('venue.settings'),toRow:(e,t)=>({venue_id:t,doc:e.doc,updated_at:(new Date).toISOString()}),fromRow:e=>({id:'area',doc:e.doc??{}}),apply:t=>{const a=t[0];a&&V.useClockArea.setState(t=>({areas:{...t.areas,[e]:{...(0,u.venueClockArea)(e,a.doc),updatedAt:a.doc.updatedAt,updatedBy:a.doc.updatedBy}}}))},subscribe:e=>V.useClockArea.subscribe((t,a)=>{t.areas!==a.areas&&e()})}}function Et(e){return{name:'daily_tasks',table:'daily_tasks',deletes:!1,list:()=>{const t=J.useDailyTasks.getState(),a=[],s=t.library[e];s?.updatedAt&&a.push({id:(0,J.libraryRowId)(e),kind:'library',doc:ve({items:s.items,updatedAt:s.updatedAt})});for(const[s,i]of Object.entries(t.people)){const[t,n]=s.split('|');t===e&&i.updatedAt&&a.push({id:(0,J.personRowId)(e,n),kind:'person',staffRef:n,doc:ve({tasks:i.tasks,updatedAt:i.updatedAt})})}return a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>{const t=P.useOwner.getState().staff.find(e=>e.id===re.getState().staffRef);if(!t)return!1;if('staff'!==t.role)return!0;if('person'!==e.kind)return!1;const a=P.useOwner.getState().staff.find(t=>t.id===e.staffRef);return!!a&&(0,z.canEditTasks)(t,a)},writable:()=>'staff'===re.getState().kind,toRow:(e,t)=>({id:e.id,venue_id:t,kind:e.kind,staff_ref:e.staffRef??null,doc:e.doc,updated_at:(new Date).toISOString()}),fromRow:e=>({id:String(e.id),kind:'library'===e.kind?'library':'person',staffRef:e.staff_ref??void 0,doc:e.doc??{}}),apply:t=>J.useDailyTasks.setState(a=>{const s={...a.library},i={...a.people};for(const a of t)'library'===a.kind?s[e]={items:a.doc.items??[],updatedAt:a.doc.updatedAt}:a.staffRef&&(i[(0,J.personKey)(e,a.staffRef)]={tasks:a.doc.tasks??[],updatedAt:a.doc.updatedAt});return{library:s,people:i}}),subscribe:e=>J.useDailyTasks.subscribe((t,a)=>{t.library===a.library&&t.people===a.people||e()})}}function Ct(e){const t=he(7);return{name:'daily_task_ticks',table:'daily_task_ticks',list:()=>J.useDailyTasks.getState().ticks.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>{const t=re.getState();return e.byRef===t.staffRef||de('staff.manage')},writable:()=>'staff'===re.getState().kind,filter:e=>e.gte('for_date',t),inWindow:e=>e.forDate>=t,toRow:(e,t)=>({id:e.id,venue_id:t,staff_ref:e.staffRef,task_id:e.taskId,for_date:e.forDate,ticked_by_ref:e.byRef,ticked_by_name:e.byName.slice(0,80),ticked_at:e.at}),fromRow:t=>({id:String(t.id),rid:e,staffRef:String(t.staff_ref),taskId:String(t.task_id),forDate:String(t.for_date).slice(0,10),byRef:String(t.ticked_by_ref??''),byName:String(t.ticked_by_name??''),at:String(t.ticked_at)}),apply:(t,a)=>J.useDailyTasks.setState(s=>({ticks:_t(s.ticks,t,a,t=>t.rid===e)})),subscribe:e=>J.useDailyTasks.subscribe((t,a)=>{t.ticks!==a.ticks&&e()})}}function Tt(e,t=!1){const a=he(14);return{name:'sold_out_items',table:'sold_out_items',conflict:'venue_id,item_id',list:()=>ee.useSoldOut.getState().entries.filter(t=>t.rid===e),key:e=>e.itemId,rowKey:e=>String(e.item_id),syncable:()=>!0,deletes:!1,writable:()=>'staff'===re.getState().kind,filter:e=>e.gte('marked_at',a),inWindow:e=>e.at.slice(0,10)>=a,toRow:(e,a)=>({id:(0,se.uuidFrom)(`soldout:${a}:${e.itemId}`),venue_id:a,item_id:e.itemId.slice(0,80),name:e.name.slice(0,120),is_on:e.on,marked_at:e.at,by_name:(e.by||'Staff').slice(0,80),clear_after:e.clearAfter??null,...t?{auto:!!e.auto,kept:!!e.kept}:{}}),fromRow:a=>({rid:e,itemId:String(a.item_id),name:String(a.name??''),on:!0===a.is_on,at:String(a.marked_at),by:String(a.by_name??''),clearAfter:a.clear_after?String(a.clear_after):void 0,...t?{auto:!0===a.auto,kept:!0===a.kept}:{}}),apply:(t,a)=>ee.useSoldOut.setState(s=>{const i=new Set(a);return{entries:[...s.entries.filter(a=>!(a.rid===e&&(i.has(a.itemId)||t.some(e=>{return s=a,(t=e).rid===s.rid&&t.itemId===s.itemId;var t,s})))),...t]}}),subscribe:e=>ee.useSoldOut.subscribe((t,a)=>{t.entries!==a.entries&&e()}),afterRead:()=>{te.autoSync.soldOutRead.add(e)}}}function Nt(e){return{name:'sold_out_links',table:'sold_out_links',conflict:'venue_id,item_id',list:()=>te.useSoldOutLinks.getState().links.filter(t=>t.rid===e),key:e=>e.itemId,rowKey:e=>String(e.item_id),syncable:()=>!0,deletes:!1,writable:()=>'staff'===re.getState().kind,toRow:(e,t)=>({id:(0,se.uuidFrom)(`soldoutlink:${t}:${e.itemId}`),venue_id:t,item_id:e.itemId.slice(0,80),uses:e.uses.slice(0,10).map(e=>({key:String(e.key).slice(0,40),qty:Math.max(0,Math.min(99,Number(e.qty)||0))})),auto:!!e.auto,updated_at:e.at,updated_by:(e.by||'Staff').slice(0,80)}),fromRow:t=>({rid:e,itemId:String(t.item_id),uses:(Array.isArray(t.uses)?t.uses:[]).map(e=>({key:String(e.key??''),qty:Number(e.qty)||0})).filter(e=>e.key&&e.qty>0),at:String(t.updated_at??''),by:String(t.updated_by??''),...!0===t.auto?{auto:!0}:{}}),apply:(t,a)=>te.useSoldOutLinks.setState(s=>{const i=new Set(a);return{links:[...s.links.filter(a=>!(a.rid===e&&(i.has(a.itemId)||t.some(e=>e.itemId===a.itemId)))),...t]}}),subscribe:e=>te.useSoldOutLinks.subscribe((t,a)=>{t.links!==a.links&&e()}),afterRead:()=>{te.autoSync.linksRead.add(e)}}}async function Mt(e,t="*"){const a='*'===t?`table:${e}`:`table:${e}.${t}`;try{const s=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:i}=await Promise.race([ne().from(e).select(t,{head:!0,count:'exact'}).limit(1),s]);return i?!!/fetch|network|Failed/i.test(i.message)&&k.kv.get(a,!1):(k.kv.set(a,!0),!0)}catch{return k.kv.get(a,!1)}}async function Kt(){const e=re.getState().venueId;if(e)try{const{data:t}=await ne().from('push_settings').select('push_live').eq('venue_id',e).maybeSingle();qt.setState({live:!!t?.push_live,known:!0})}catch{}}const xt='order-list-logos';const Lt=new Map;const qt=(0,y.create)(()=>({live:!1,known:!1}));async function Pt(){try{const e=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:t}=await Promise.race([ne().from('venue_reminders').select('id').limit(1),e]);return t?!!/fetch|network|Failed/i.test(t.message)&&k.kv.get('reminders:ok',!1):(k.kv.set('reminders:ok',!0),!0)}catch{return k.kv.get('reminders:ok',!1)}}async function $t(){try{const e=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:t}=await Promise.race([ne().from('chat_messages').select('id').limit(1),e]);return t?!!/fetch|network|Failed/i.test(t.message)&&k.kv.get('chat:ok',!1):(k.kv.set('chat:ok',!0),!0)}catch{return k.kv.get('chat:ok',!1)}}const jt=(e,t)=>ve({id:String(e.id),venue:t,body:String(e.body??''),kind:'yesno'===e.kind?'yesno':'up',up:Number(e.up_count??0),yes:Number(e.yes_count??0),no:Number(e.no_count??0),hidden:!!e.hidden,reply:e.reply??void 0,replyAt:e.reply_at??void 0,postedOn:String(e.posted_on??'').slice(0,10)}),Bt='id,body,kind,up_count,yes_count,no_count,hidden,reply,reply_at,posted_on';function Ft(e){return{name:'hr_questions',table:'hr_questions',deletes:!1,list:()=>_.useHr.getState().questions.filter(t=>t.venue===e&&(0,$.isUuid)(t.id)),key:e=>e.id,rowKey:e=>String(e.id),syncable:()=>!1,writable:()=>!1,toRow:e=>({id:e.id}),fromRow:t=>jt(t,e),filter:e=>e.gte('posted_on',new Date(Date.now()-10368e6).toISOString().slice(0,10)),apply:(e,t)=>{const a=new Set(t);_.useHr.setState(t=>{const s=new Map(e.map(e=>[e.id,e])),i=t.questions.filter(e=>!a.has(e.id)).map(e=>s.get(e.id)??e),n=new Set(i.map(e=>e.id));return{questions:[...i,...e.filter(e=>!n.has(e.id))]}})},subscribe:e=>_.useHr.subscribe((t,a)=>{t.questions!==a.questions&&e()})}}function Wt(e,t){const a=(t,a,s)=>{R.mutationQueue.enqueue({table:'hr_questions',venueId:e,kind:'rpc',fn:t,rowKey:a,values:s})};Object.assign(_.hrRemote,{live:!0,checkout:t=>a('hr_checkout',t.token,{p_venue:e,p_day:t.day,p_token:t.token,p_morale:t.morale,p_staffing:t.staffing,p_question:t.question??null,p_kind:t.kind??'up',p_shout_to:t.shoutTo??null,p_shout_body:t.shoutBody??null}),post:(t,s,i,n)=>a('hr_post_question',s,{p_venue:e,p_id:s,p_body:i,p_kind:n}),vote:(e,t,s)=>a('hr_vote',e,{p_question:e,p_token:t,p_vote:s}),moderate:(e,t,s)=>a('hr_moderate',e,{p_question:e,p_action:t,p_reason:s}),reply:(e,t)=>a('hr_reply',e,{p_question:e,p_reply:t}),trend:async(t,a,s)=>{try{const{data:t,error:i}=await ne().rpc('hr_trend',{p_venue:e,p_from:a,p_to:s});return i?null:(t??[]).map(e=>({day:String(e.day).slice(0,10),answers:Number(e.answers),morale:Number(e.morale),staffing:null==e.staffing?null:Number(e.staffing),short:Number(e.short),perfect:Number(e.perfect),over:Number(e.over)}))}catch{return null}},shouts:async(a,s)=>{try{const{data:a,error:i}=await ne().from('hr_shoutouts').select('id,day,to_name,body').eq('venue_id',e).gte('day',s).order('day',{ascending:!1}).limit(20);return i?null:(a??[]).map(e=>({id:String(e.id),venue:t,day:String(e.day).slice(0,10),to:String(e.to_name),body:e.body??void 0}))}catch{return null}},log:async()=>{try{const{data:a,error:s}=await ne().from('hr_mod_log').select('id,question_id,action,reason,by_name,at').eq('venue_id',e).order('at',{ascending:!1}).limit(30);return s?null:(a??[]).map(e=>({id:String(e.id),venue:t,questionId:String(e.question_id??''),action:e.action,reason:e.reason??void 0,by:String(e.by_name??'A manager'),at:String(e.at)}))}catch{return null}},refresh:async()=>{try{const{data:a,error:s}=await ne().from('hr_questions').select(Bt).eq('venue_id',e).order('posted_on',{ascending:!1}).limit(200);s||_.useHr.getState().setRemoteBoard(t,(a??[]).map(e=>jt(e,t)))}catch{}}}),me.push(()=>{Object.assign(_.hrRemote,{live:!1,checkout:null,post:null,vote:null,moderate:null,reply:null,trend:null,shouts:null,log:null,refresh:null})})}const Vt='pair:v1',Ht='staff:v1',Gt='staff:rejoin:v1';async function Qt(){if('display'===le||'customer'===le||H.PITCH)return'none';const t=await k.kv.get(Gt,null);if(!t)return'none';try{await zt();const{data:a,error:s}=await ne().rpc(e.IS_QUEUED_VENUE?'claim_'+e.VENUE_RID+'_invite':e.IS_GREENSIDE?'claim_greenside_invite':e.IS_ABBOTSFORD?'claim_abbotsford_invite':e.IS_KIRKTON?'claim_kirkton_invite':e.IS_WILDINGS?'claim_wildings_invite':e.IS_KIRKMICHAEL?'claim_kirkmichael_invite':e.IS_ISOLATED_VENUE?'claim_souters_invite':'claim_invite',{p_token:t,p_app:le,p_device:(0,g.deviceId)()});if(s)return(0,p.inviteRefusal)(s.message)?(await k.kv.remove(Gt),await k.kv.remove(Ht),'refused'):'offline';const i=a?.[0];return i?(await k.kv.set(Ht,{kind:'staff',venueId:i.venue_id,venueSlug:i.venue_slug,venueName:i.venue_name,staffRef:i.external_ref,staffUuid:i.staff_id,role:i.role_key,displayName:i.display_name}),'ok'):(await k.kv.remove(Gt),'refused')}catch{return'offline'}}const Jt=e=>/jwt|refresh|token|401|not authenticated|invalid claim|session/i.test(String(e?.message??e))&&!/fetch|network/i.test(String(e?.message??e));async function zt(){fe();const{data:e}=await ne().auth.getSession();if(!e.session)for(let e=0;;e++){const{error:t}=await ne().auth.signInAnonymously();if(!t)return;const a=429===t.status||/rate|too many/i.test(t.message);if(!a||e>=2){if(a)throw new Error('Too many people are connecting from this network right now. Wait a few minutes, or switch to mobile data, and open the link again.');throw t}oe({message:'Lots of people are connecting at once. Trying again in a moment\u2026'}),await new Promise(t=>setTimeout(t,0===e?15e3:45e3))}}async function Zt(t){if(H.PITCH)return{status:'refused',message:'This link has been replaced or switched off. Ask your manager for a new one.'};if(!(0,v.isSupabaseConfigured)())return{status:'off'};try{await zt();const{data:a,error:s}=await ne().rpc(e.IS_QUEUED_VENUE?'claim_'+e.VENUE_RID+'_invite':e.IS_GREENSIDE?'claim_greenside_invite':e.IS_ABBOTSFORD?'claim_abbotsford_invite':e.IS_KIRKTON?'claim_kirkton_invite':e.IS_WILDINGS?'claim_wildings_invite':e.IS_KIRKMICHAEL?'claim_kirkmichael_invite':e.IS_ISOLATED_VENUE?'claim_souters_invite':'claim_invite',{p_token:t,p_app:le,p_device:(0,g.deviceId)()});if(s){const t=(0,p.inviteRefusal)(s.message);if(t){try{localStorage.removeItem((0,e.venueKey)(`cc-pending-invite:${le}`))}catch{}return{status:'refused',message:t}}throw s}const i=a?.[0];if(!i)return{status:'refused',message:'This link has been replaced or switched off. Ask your manager for a new one.'};const n={kind:'staff',venueId:i.venue_id,venueSlug:i.venue_slug,venueName:i.venue_name,staffRef:i.external_ref,staffUuid:i.staff_id,role:i.role_key,displayName:i.display_name};return await k.kv.set(Ht,n),await k.kv.set(Gt,t),ge&&aa(),{status:'ok',id:n}}catch(e){const t=String(e?.message??e);return oe({lastError:`Sign-in: ${t}`}),{status:'offline',message:t}}}async function Xt(){if(!(0,v.isSupabaseConfigured)())return!1;try{return await zt(),!0}catch{return!1}}const Yt=async(e,t={})=>{if(H.PITCH)return(0,G.pitchRpc)(e,t);const{data:a,error:s}=await ne().rpc(e,t);if(s)throw s;return a};let ea=null;async function ta(){for(const e of me)try{e()}catch{}me=[],pe.forEach(e=>e.stop()),pe=[],ea&&(clearInterval(ea),ea=null)}async function aa(){await ta(),await ia()}let sa=e.VENUE_RID;async function ia(){try{const e='undefined'!=typeof navigator?navigator.storage:null;e?.persist&&e.persist()}catch{}try{const e='undefined'!=typeof window?window.CoverChargeNative:null;e&&'function'==typeof e.checkUpdate&&/CoverChargePhone\//.test(navigator.userAgent)&&e.checkUpdate()}catch{}const t=sa;try{if(oe({mode:'connecting'}),await R.mutationQueue.load(),'customer'===le)return void await da(t);const a=await k.kv.get(Vt,null);let s=await k.kv.get(Ht,null);if(e.IS_ISOLATED_VENUE&&(a&&!(0,e.venueIdentityAllowed)(a.venueId,a.venueSlug)||s&&!(0,e.venueIdentityAllowed)(s.venueId,s.venueSlug)))return void oe({mode:'display'===le?'unpaired':'signin',perms:[],message:'This sign-in belongs to a different venue.'});let{data:i}=await ne().auth.getSession();if('display'!==le&&s&&!i.session){const e=await Qt();if('offline'===e)return oe({venueId:s.venueId,venueSlug:s.venueSlug,venueName:s.venueName,kind:s.kind,role:s.role,staffRef:s.staffRef,staffUuid:s.staffUuid,mode:'offline'}),void setTimeout(()=>{sa===t&&aa()},6e4);'refused'===e&&s.staffRef&&g.useSession.getState().meId===s.staffRef&&g.useSession.getState().signOut(),s=await k.kv.get(Ht,null),({data:i}=await ne().auth.getSession())}const n='display'===le?a:s;if(!i.session||!n)return void oe({mode:'display'===le?'unpaired':'signin',perms:[]});let r=[];try{const e=(await Yt('whoami')??[]).filter(e=>e.venue_id===n.venueId);if(!e.length)return'display'===le?await k.kv.remove(Vt):(await k.kv.remove(Ht),await k.kv.remove(Gt)),'staff'===n.kind&&n.staffRef&&g.useSession.getState().meId===n.staffRef&&g.useSession.getState().signOut(),void oe({mode:'display'===le?'unpaired':'signin',perms:[],message:'display'===le?'This display was unpaired by a manager.':'Open your invite link again to connect.'});r=[...new Set(e.flatMap(e=>e.permissions??[]))],'device'===n.kind&&n.canWrite&&r.push('device.write')}catch(e){if(!(0,b.isOnline)()||/fetch|network/i.test(String(e?.message)))oe({mode:'offline'});else if(Jt(e)&&'display'!==le){const{error:e}=await ne().auth.refreshSession();e&&'ok'===await Qt()&&setTimeout(()=>{sa===t&&aa()},500)}r=re.getState().perms}oe({venueId:n.venueId,venueSlug:n.venueSlug,venueName:n.venueName,kind:n.kind,role:n.role,staffRef:n.staffRef,staffUuid:n.staffUuid,perms:r}),'staff'===n.kind&&n.staffRef&&g.useSession.getState().meId!==n.staffRef&&(g.useSession.getState().signIn(n.staffRef),P.useOwner.setState({staffAs:n.staffRef})),await ra(n.venueId,t,n.kind)}catch(e){oe({mode:'local',lastError:String(e?.message??e)})}}const na=new Set(['venues','staff','bookings','walk_ins','blocks','table_plans','takeaway_orders','stock_items','stock_events','stock_counts','recipe_cards','suppliers','supplier_orders','rota_shifts','attendance','time_requests','game_scores','floor_live','chat_messages','venue_reminders','reminder_done']);async function ra(t,a,s){if(!(0,e.venueIdentityAllowed)(t,a))throw new Error('Different venue: sync refused.');await ma(a),me.push(Da(t));try{const{data:e}=await ne().from('roles').select('id,key').eq('venue_id',t);for(const t of e??[])We.set(t.key,t.id),Ve.set(t.id,t.key)}catch{}const i=[rt(a),{protect:!0,name:'staff',table:'staff',conflict:'venue_id,external_ref',list:()=>P.useOwner.getState().staff.map(Je),key:e=>e.id,rowKey:e=>String(e.external_ref??e.id),syncable:e=>!e.name.includes('(example)'),writable:()=>de('staff.manage'),deletes:!1,toRow:(e,t)=>({venue_id:t,external_ref:e.id,display_name:e.name,...$e?{nickname:e.nickname?.trim()||null}:{},job_title:e.job||null,department:e.dept||null,active:e.active,...je?{display_clock:!!e.displayClock,temp:!!e.temp,temp_until:e.tempUntil||null}:{},...e.managerAccess||e.ownerAccess||!We.get(He(e))?{}:{role_id:We.get(He(e))}}),fromRow:e=>e.external_ref?(Be.set(String(e.external_ref),String(e.id)),Fe.set(String(e.id),String(e.external_ref)),Oa.set(String(e.external_ref),e.avatar_path??null),ve({id:String(e.external_ref),name:e.display_name,...$e&&'nickname'in e?{nickname:e.nickname??void 0}:{},job:e.job_title??'',active:!1!==e.active,dept:e.department??'',...je&&'display_clock'in e?{displayClock:!!e.display_clock,temp:!!e.temp||void 0,tempUntil:e.temp_until??void 0}:{},...Qe(Ge(Ve.get(String(e.role_id))),!0===e.manager_access),...!0===e.owner_access&&'owner'!==Ge(Ve.get(String(e.role_id))).role?{role:'owner',ownerAccess:!0}:{}})):null,apply:e=>P.useOwner.setState(t=>{const a=new Map(e.map(e=>[e.id,e])),s=t.staff.map(e=>a.has(e.id)?{...e,...a.get(e.id)}:e),i=new Set(s.map(e=>e.id));return{staff:[...s,...e.filter(e=>!i.has(e.id)).map(e=>({...e}))]}}),subscribe:e=>P.useOwner.subscribe((t,a)=>{t.staff!==a.staff&&e()}),afterRead:()=>{Ua()},onRemote:()=>{Ua()}},{name:'pay',table:'staff_private',conflict:'staff_id',list:()=>{const e=P.useOwner.getState(),t=x.useSetup.getState().sites[sa]?.staffGrade??{};return e.staff.filter(e=>Be.has(e.id)).map(a=>ve({id:a.id,hourly:e.hourly[a.id]??null,salaried:!!a.salaried,noTax:!!a.noTax,grade:t[a.id]||void 0}))},key:e=>e.id,rowKey:e=>Fe.get(String(e.staff_id))??String(e.staff_id),syncable:e=>Be.has(e.id),writable:()=>de('wages.manage'),deletes:!1,toRow:(e,t)=>({staff_id:Be.get(e.id),venue_id:t,hourly_rate:null==e.hourly?null:e.hourly/100,salaried:e.salaried,no_tax:e.noTax,pay_grade:e.grade??null}),fromRow:e=>{const t=Fe.get(String(e.staff_id));return t?ve({id:t,hourly:null==e.hourly_rate?null:Math.round(100*Number(e.hourly_rate)),salaried:!!e.salaried,noTax:!!e.no_tax,grade:e.pay_grade||void 0}):null},apply:e=>P.useOwner.setState(t=>{const a={...t.hourly},s=new Map(e.map(e=>[e.id,e]));for(const t of e)null==t.hourly?delete a[t.id]:a[t.id]=t.hourly;if(e.length){const t=x.useSetup.getState().sites[sa],a={...t?.staffGrade??{}};let s=!1;for(const t of e)(a[t.id]||void 0)!==t.grade&&(s=!0,t.grade?a[t.id]=t.grade:delete a[t.id]);s&&x.useSetup.getState().patch(sa,{staffGrade:a})}return{hourly:a,staff:t.staff.map(e=>s.has(e.id)?{...e,salaried:s.get(e.id).salaried,noTax:s.get(e.id).noTax}:e)}}),subscribe:e=>{const t=P.useOwner.subscribe((t,a)=>{t.hourly===a.hourly&&t.staff===a.staff||e()}),a=x.useSetup.subscribe((t,a)=>{t.sites[sa]?.staffGrade!==a.sites[sa]?.staffGrade&&e()});return()=>{t(),a()}}},be(a,!1),be(a,!0),Ie(a),Re(a),ke(a),Ae(a),De(a),Ee(a),Pe(a),{name:'supplier_directory',table:'suppliers',list:()=>P.useOwner.getState().suppliers,key:e=>e.id,rowKey:e=>String(e.doc?.localId??e.id),syncable:e=>(0,$.isUuid)(e.id),writable:()=>de('suppliers.manage'),toRow:(e,t)=>({id:e.id,venue_id:t,name:e.name||'Supplier',category:e.category,contact:e.contact||null,phones:e.phones.filter(Boolean),email:e.email||null,website:e.website||null,account_ref:e.account||null,cutoff:e.cutoff||null,order_days:e.orderDays,delivery_days:e.deliveryDays,doc:{kind:'directory',localId:e.id,supplier:ve(e)}}),fromRow:e=>'directory'===e.doc?.kind?e.doc.supplier:null,apply:(e,t)=>P.useOwner.setState(a=>{const s=new Set(t),i=new Map(e.map(e=>[e.id,e])),n=a.suppliers.filter(e=>!s.has(e.id)).map(e=>i.get(e.id)??e),r=new Set(n.map(e=>e.id));return{suppliers:[...n,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>P.useOwner.subscribe((t,a)=>{t.suppliers!==a.suppliers&&e()})},{name:'supplier_orders',table:'supplier_orders',list:()=>P.useOwner.getState().supplierOrders,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id)&&(0,$.isUuid)(e.supplierId),writable:()=>de('suppliers.order')||de('suppliers.manage'),toRow:(e,t)=>({id:e.id,venue_id:t,supplier_id:e.supplierId,order_date:e.date||Se(),items:[{text:e.items}],amount:Math.round(e.amount||0),status:'sent',by_name:e.by,doc:ve(e)}),fromRow:e=>e.doc?{...e.doc,id:String(e.id)}:null,apply:(e,t)=>P.useOwner.setState(a=>{const s=new Set(t),i=new Map(e.map(e=>[e.id,e])),n=a.supplierOrders.filter(e=>!s.has(e.id)).map(e=>i.get(e.id)??e),r=new Set(n.map(e=>e.id));return{supplierOrders:[...e.filter(e=>!r.has(e.id)),...n]}}),subscribe:e=>P.useOwner.subscribe((t,a)=>{t.supplierOrders!==a.supplierOrders&&e()})},Te(a),ba(a)];de('wages.view')&&i.push(ka(a)),'staff'===s&&(i.push(Ye(),et(),tt(),st(a)),at(t));const n='staff'===s&&await $t();if(Z.useChatSync.setState({synced:n,checked:!0}),me.push(()=>Z.useChatSync.setState({synced:!1})),n&&i.push(pt(),{name:'chat_extra',table:'chat_channel_extra',conflict:'venue_id,channel,staff_id',list:()=>Object.entries(X.useKitchenExtra.getState().extra).map(([e,t])=>({id:e,include:t})),key:e=>e.id,rowKey:e=>Fe.get(String(e.staff_id))??String(e.staff_id),syncable:e=>Be.has(e.id),writable:()=>de('staff.manage'),filter:e=>e.eq('channel','kitchen'),matchKey:e=>({channel:'kitchen',staff_id:Be.get(e)??e}),toRow:(e,t)=>({venue_id:t,channel:'kitchen',staff_id:Be.get(e.id),include:e.include}),fromRow:e=>{const t=Fe.get(String(e.staff_id));return t?{id:t,include:!!e.include}:null},apply:(e,t)=>X.useKitchenExtra.setState(a=>{const s={...a.extra};return t.forEach(e=>{delete s[e]}),e.forEach(e=>{s[e.id]=e.include}),{extra:s}}),subscribe:e=>X.useKitchenExtra.subscribe((t,a)=>{t.extra!==a.extra&&e()})}),'staff'===s&&await Mt('hr_questions')&&(i.push(Ft(a)),na.add('hr_questions'),Wt(t,a)),'guest'!==s&&await Mt('sold_out_items')?(i.push(Tt(a,await Mt('sold_out_items','auto'))),na.add('sold_out_items')):te.autoSync.soldOutRead.add(a),'guest'!==s&&await Mt('sold_out_links')?(i.push(Nt(a)),na.add('sold_out_links')):te.autoSync.linksRead.add(a),S.useReminders.getState().ensure(a),'guest'!==s&&await Pt()&&(i.push(mt(a)),'staff'===s&&i.push(gt(a))),j.useNotifs.getState().ensure(a),F.useOrderLists.getState().ensure(a),'staff'===s){$e=await Mt('staff','nickname'),je=await Mt('staff','display_clock');const[e,t,s,n]=await Promise.all([Mt('scheduled_notifications'),Mt('order_lists'),Mt('venue_clock_area'),Mt('daily_tasks')]);J.useDailyTasks.getState().ensure(a),n&&(i.push(Et(a),Ct(a)),na.add('daily_tasks'),na.add('daily_task_ticks')),e&&(i.push(Ot(a)),Kt()),t&&i.push(Rt(a),At(a),Ut(a)),s&&i.push(Dt(a));for(const[a,i]of[[e,'scheduled_notifications'],[t,'order_lists'],[t,'order_list_items'],[t,'order_list_history'],[s,'venue_clock_area']])a&&na.add(i)}if('guest'!==s&&await Mt('day_tips')){i.push(bt(a));for(const e of['day_tips','tips_pot_events','tips_settings'])na.add(e);await Mt('tips_pot_events')&&i.push(kt(a),It(a)),'staff'===s&&(i.push(yt(a),wt(a),vt(a)),na.add('cash_ups'),na.add('sales_reports'),_r2(_d[59])(_d[58],_d.paths).then(e=>e.refreshCashAccess()))}'device'===s&&(i.push(Ye(),et()),await Mt('scheduled_notifications')&&i.push(Ot(a)));let r=!1;const o={onActivity:()=>oe({lastSyncAt:(new Date).toISOString()}),onError:(e,t)=>oe({lastError:`${e}: ${t}`}),onSuspect:(e,s)=>{oe({lastError:`${e}: held back, ${s}`}),r||(r=!0,(async()=>{try{if(!(await Yt('whoami')??[]).some(e=>e.venue_id===t))return void(sa===a&&aa());for(const a of pe){if(a.spec.name!==e)continue;const{count:s,error:i}=await ne().from(a.spec.table).select('*',{count:'exact',head:!0}).eq(a.spec.venueColumn??'venue_id',t);!i&&(s??0)>0&&a.allowMassRemoveOnce()}}catch{}finally{r=!1}})())}};pe=i.map(e=>new A.EntityBridge(e,t,o)),await Promise.all(pe.map(e=>e.start()));const d=async()=>{if('staff'===s&&(0,b.isOnline)())try{const e=await Yt('whoami');if(!e?.some(e=>e.venue_id===t))return void(sa===a&&aa())}catch(e){if(Jt(e)){const e=await Qt();return void('ok'!==e&&'refused'!==e||sa===a&&aa())}}let e=0;for(const[t,a]of pe.entries()){const s='chat'===i[t]?.name;try{await a.read(),e++,s&&Z.useChatSync.getState().error&&Z.useChatSync.setState({error:void 0})}catch(e){const t=String(e?.message??e);if((s||/fetch|network|Failed/i.test(t))&&Z.useChatSync.setState({error:t||'unknown error'}),/fetch|network|Failed/i.test(t))break}}if(e?(oe({mode:(0,b.isOnline)()?'live':'offline',lastSyncAt:(new Date).toISOString()}),R.mutationQueue.flush()):oe({mode:'offline'}),!de('wages.view')){const e=re.getState().staffRef;P.useOwner.setState(t=>({hourly:e&&null!=t.hourly[e]?{[e]:t.hourly[e]}:{}}))}};await d();const u=new Map;for(const e of pe)u.set(e.spec.table,[...u.get(e.spec.table)??[],e]);const l=[...u.keys()].filter(e=>na.has(e)).map(e=>({table:e,venueColumn:u.get(e)[0].spec.venueColumn}));let c=!1;const f=(0,A.venueChannel)(t,l,(e,t,a)=>{for(const s of u.get(e)??[])s.remote(t,a);oe({lastSyncAt:(new Date).toISOString()})},e=>{oe({realtime:e}),'SUBSCRIBED'===e?(c&&d(),c=!1):'CHANNEL_ERROR'!==e&&'TIMED_OUT'!==e&&'CLOSED'!==e||(c=!0)});me.push(()=>{ne().removeChannel(f)}),ea=setInterval(()=>{d()},6e4),me.push((0,b.onConnectivity)(e=>{e&&d()}))}'undefined'!=typeof window&&(window.__ccSync=()=>({...re.getState(),queue:R.mutationQueue.pending.map(e=>e.table),failedTables:R.mutationQueue.failed.map(e=>`${e.table}: ${e.lastError??''}`.slice(0,200))}));const oa='guest:sent:v1';async function da(s){oe({kind:'guest',venueSlug:s,perms:[]});try{const i=(await Yt('public_venue',{p_venue_slug:(0,t.queuedDatabaseSlug)(s)}))?.[0];if(i&&(!e.IS_ISOLATED_VENUE||i.id===e.VENUE_UUID)){oe({venueId:i.id,venueName:i.name}),await ma(s);const e=i.app?.restaurant;e&&U.useStore.setState(t=>({restaurants:t.restaurants.map(t=>t.id===s?(0,a.withWildingsAddress)({...e,id:s}):t)})),nt(s,i.app?.events)}await ua(s),oe({mode:'live',lastSyncAt:(new Date).toISOString()})}catch{oe({mode:(0,b.isOnline)()?'local':'offline'})}const i=setInterval(()=>{ua(s).catch(()=>{})},6e4);me.push(()=>clearInterval(i)),e.IS_ISOLATED_VENUE||await la(s)}async function ua(e){const a=await Yt('public_menu',{p_venue_slug:(0,t.queuedDatabaseSlug)(e)})??[];if(a.length){const t=new Map(a.map(e=>[String(e.menu_item_id??e.doc?.item?.id??''),e]));N.useCardStore.setState(a=>({cards:a.cards.map(a=>{if(a.restaurantId!==e)return a;const s=t.get(a.menuItemId);if(!s)return a.signOff?{...a,signOff:null}:a;const i=s.updated_at?new Date(s.updated_at).toISOString():a.updatedAt;return{...a,photo:s.photo_url||void 0,signOff:a.signOff??{by:'Head chef',at:i}}})}))}const s=a.map(e=>e.doc?.item).filter(e=>!!e&&!!e.id).map(t=>({...t,restaurantId:e}));s.length&&U.useStore.setState(e=>{const t=new Map(s.map(e=>[e.id,e])),a=e.menu.map(e=>t.get(e.id)??e),i=new Set(a.map(e=>e.id));return{menu:[...a,...s.filter(e=>!i.has(e.id))]}})}async function la(e){let a=await k.kv.get(oa,{}),s=!1;const i=new Date(Date.now()-1728e5).toISOString(),n=async()=>{if(!s){s=!0;try{const s=U.useStore.getState(),n=s.bookings.filter(t=>t.restaurantId===e&&(0,$.isUuid)(t.id)&&!t.walkIn&&!a[t.id]&&t.createdAt>=i),r=s.orders.filter(t=>t.restaurantId===e&&(0,$.isUuid)(t.id)&&!a[t.id]&&t.createdAt>=i&&'table'!==t.type);if(n.length||r.length){if(!await Xt())return;for(const s of n)try{const i=(await Yt('guest_create_booking',{p_venue_slug:(0,t.queuedDatabaseSlug)(e),p_booking:{...ve(s),...(0,f.takeGuard)(s.id),allergies:we(s.allergies)}}))?.[0];a={...a,[s.id]:'booking'};const n={};i?.status&&i.status!==s.status&&(n.status=i.status),'string'==typeof i?.ref&&i.ref&&i.ref!==s.ref&&(n.ref=i.ref),Object.keys(n).length&&U.useStore.setState(e=>({bookings:e.bookings.map(e=>e.id===s.id?{...e,...n}:e)}))}catch(e){/fetch|network/i.test(String(e?.message))||(a={...a,[s.id]:'failed'},oe({lastError:`Booking: ${e?.message}`}))}for(const s of r)try{await Yt('guest_create_takeaway',{p_venue_slug:(0,t.queuedDatabaseSlug)(e),p_order:{...ve(s),...(0,f.takeGuard)(s.id),allergies:we(s.allergies)}}),a={...a,[s.id]:'order'}}catch(e){/fetch|network/i.test(String(e?.message))||(a={...a,[s.id]:'failed'},oe({lastError:`Order: ${e?.message}`}))}await k.kv.set(oa,a)}for(const e of s.bookings)if('booking'===a[e.id]&&'cancelled'===e.status)try{await Yt('guest_cancel_booking',{p_id:e.id}),a={...a,[e.id]:'cancelled'},await k.kv.set(oa,a)}catch{}if(Object.values(a).some(e=>'booking'===e||'order'===e)){const e=await Yt('guest_my_items')??[],t=new Map(e.map(e=>[String(e.id),e]));U.useStore.setState(e=>({bookings:e.bookings.map(e=>{const a=t.get(e.id);return a&&a.status&&a.status!==e.status&&'declined'!==a.status?{...e,status:a.status}:'declined'===a?.status&&'cancelled'!==e.status?{...e,status:'cancelled'}:e}),orders:e.orders.map(e=>{const a=t.get(e.id);if(!a)return e;const s=a.doc??{},i={...e,status:a.status??e.status,readyBy:s.readyBy??e.readyBy,accepted:s.accepted??e.accepted};return ca(i)===ca(e)?e:i})})),oe({mode:'live',lastSyncAt:(new Date).toISOString()})}}catch{oe({mode:(0,b.isOnline)()?re.getState().mode:'offline'})}finally{s=!1}}};me.push(U.useStore.subscribe((e,t)=>{e.bookings===t.bookings&&e.orders===t.orders||setTimeout(()=>{n()},200)})),ea=setInterval(()=>{n()},15e3),n()}const ca=e=>JSON.stringify([e.status,e.readyBy,e.accepted]),fa={bridges:()=>pe,restart:aa},pa='golive:v1:';async function ma(e){'live'!==U.useStore.getState().clock.mode&&U.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}}),s.LIVE_VENUE_BUILD&&(0,s.isLiveVenue)(e)?await wa(e):(await k.kv.get(pa+e,!1)||await wa(e),await k.kv.get(ha+e,!1)||(ya(e),await k.kv.set(ha+e,!0)),await k.kv.get(ga+e,!1)||(Sa(),await k.kv.set(ga+e,!0)))}const ga='golive:v3:';function Sa(){const e=e=>JSON.stringify(e).includes('(example)');try{L.useKitchen.setState(t=>({waste:t.waste.filter(t=>!e(t)),stockTakes:t.stockTakes.filter(t=>!e(t)),deliveries:t.deliveries.filter(e=>'dl-today-fish'!==e.id&&'dl-today-veg'!==e.id)}))}catch{}}const ha='golive:v2:';function ya(e){const t=e=>JSON.stringify(e).includes('(example)');U.useStore.setState(t=>({customer:{...t.customer,name:'',email:'',phone:'',allergies:[],allergyConsent:!1,marketingOptIn:{}},stampCards:t.stampCards.filter(t=>t.restaurantId!==e),giftCards:t.giftCards.filter(t=>t.restaurantId!==e),ratings:t.ratings.filter(t=>t.restaurantId!==e),events:t.events.filter(t=>!(t.example&&(t.restaurantId===e||null===t.restaurantId)))})),P.useOwner.setState(e=>({referrals:[],coats:[],merchOrders:[],lost:[],customerTags:{},offers:e.offers.filter(e=>!t(e)),changeRequests:e.changeRequests.filter(e=>!t(e)),campaigns:e.campaigns.filter(e=>!t(e)),supplierOrders:e.supplierOrders.filter(e=>!t(e)),chat:e.chat.filter(e=>e.id.startsWith('m-seed-')).map((e,t)=>({...e,at:new Date(Date.now()-6e4*(5-t)).toISOString()}))}))}async function wa(e){if(s.LIVE_VENUE_BUILD&&(0,s.isLiveVenue)(e)){const t=(0,i.stripCoreLiveSamples)(U.useStore.getState()),a=(0,L.stripKitchenExamples)(L.useKitchen.getState()),o=P.useOwner.getState(),u=(0,i.stripOwnerLiveSamples)(o),l={accidents:q.useSafety.getState().accidents.filter(e=>!(0,q.isSeedAccident)(e))},c=(e,t)=>Object.keys(t).some(a=>JSON.stringify(e[a])!==JSON.stringify(t[a]));c(U.useStore.getState(),t)&&(await(0,n.archiveChefCache)('core',U.useStore.getState()),U.useStore.setState(t)),c(L.useKitchen.getState(),a)&&(await(0,n.archiveChefCache)('kitchen',L.useKitchen.getState()),L.useKitchen.setState(a)),c(o,u)&&(await(0,n.archiveChefCache)('owner',o),P.useOwner.setState(u)),c(q.useSafety.getState(),l)&&(await(0,n.archiveChefCache)('safety',q.useSafety.getState()),q.useSafety.setState(l));const f=(0,_.stripHrSamples)(_.useHr.getState());c(_.useHr.getState(),f)&&(await(0,n.archiveChefCache)('hr',_.useHr.getState()),_.useHr.setState(f));const p=(0,r.stripGpSamples)(r.useGpCalc.getState());c(r.useGpCalc.getState(),p)&&(await(0,n.archiveChefCache)('gp',r.useGpCalc.getState()),r.useGpCalc.setState(p));const m=M.useOrderSheets.getState(),g={sheets:{...m.sheets,anchorage:(m.sheets.anchorage||[]).filter(e=>!('os-veg'===e.id&&e.placeholder))}};c(m,g)&&(await(0,n.archiveChefCache)('order-sheets',m),M.useOrderSheets.setState(g));const S=N.useCardStore.getState(),h={cards:S.cards.filter(e=>!(0,s.isLiveVenue)(e.restaurantId)||!(0,d.isDemoCard)(e)),log:S.log.filter(e=>!(0,d.demoActor)(e.by))};return c(S,h)&&(await(0,n.archiveChefCache)('recipe-cards',S),N.useCardStore.setState(h)),void await k.kv.set(pa+e,!0)}const t=t=>t.restaurantId===e&&!(0,$.isUuid)(t.id);U.useStore.setState(a=>({bookings:a.bookings.filter(e=>!t(e)),orders:a.orders.filter(e=>!t(e)),waitlist:a.waitlist.filter(t=>t.restaurantId!==e),walkIns:Object.fromEntries(Object.entries(a.walkIns).filter(([t])=>!t.includes(e)))})),E.useBlocks.setState(t=>({blocks:t.blocks.filter(t=>t.rid!==e||(0,$.isUuid)(t.id))})),C.useFloor.setState(t=>({live:{...t.live,[e]:{}}})),P.useOwner.setState(e=>({shifts:e.shifts.filter(e=>(0,$.isUuid)(e.id)),attendance:e.attendance.filter(e=>(0,$.isUuid)(e.id)),timeRequests:e.timeRequests.filter(e=>(0,$.isUuid)(e.id)),leave:[],swaps:[]}));try{L.useKitchen.setState(e=>(0,L.stripKitchenExamples)(e))}catch{}P.useOwner.setState(e=>({suppliers:e.suppliers.filter(e=>(0,$.isUuid)(e.id)),supplierOrders:e.supplierOrders.filter(e=>(0,$.isUuid)(e.id)&&(0,$.isUuid)(e.supplierId))}));try{q.useSafety.setState(e=>({accidents:e.accidents.filter(e=>{return!String(e.id).startsWith('acc-ex')&&(t=e,!JSON.stringify(t).includes('(example)'));var t})}))}catch{}await k.kv.set(pa+e,!0)}const va=(e,t)=>ve({name:e,stage:t.stage||void 0,dirty:t.dirty||void 0,blocked:t.blocked||void 0,note:t.note||void 0});function ba(e){return{name:'floor_live',table:'floor_live',conflict:'venue_id,table_name',list:()=>Object.entries(C.useFloor.getState().live[e]??{}).map(([e,t])=>va(e,t)),key:e=>e.name,rowKey:e=>String(e.table_name),syncable:e=>e.name.length>0&&e.name.length<=20,writable:()=>'staff'===re.getState().kind||de('device.write'),deletes:!1,matchKey:e=>({table_name:e}),toRow:(e,t)=>({venue_id:t,table_name:e.name,stage:e.stage??null,dirty:!!e.dirty,blocked:!!e.blocked,note:e.note?e.note.slice(0,200):null,updated_by:re.getState().staffRef??le}),fromRow:e=>va(String(e.table_name),{stage:e.stage??void 0,dirty:!!e.dirty,blocked:!!e.blocked,note:e.note??void 0}),apply:(t,a)=>C.useFloor.setState(s=>{const i={...s.live[e]??{}};for(const e of t){const{name:t,...a}=e;i[t]=a}for(const e of a)delete i[e];return{live:{...s.live,[e]:i}}}),subscribe:e=>C.useFloor.subscribe((t,a)=>{t.live!==a.live&&e()})}}function ka(e){return{name:'pay_grades',table:'pay_grades',conflict:'venue_id,grade_id',list:()=>(x.useSetup.getState().sites[e]?.grades??x.DEFAULT_GRADES).map((e,t)=>({id:e.id,name:e.name,pence:e.pence,sort:t})),key:e=>e.id,rowKey:e=>String(e.grade_id),syncable:e=>!!e.id&&!!e.name,writable:()=>de('wages.manage'),matchKey:e=>({grade_id:e}),toRow:(e,t)=>({venue_id:t,grade_id:e.id,name:e.name.slice(0,60),pence:Math.max(0,Math.min(1e5,Math.round(e.pence))),sort:e.sort}),fromRow:e=>({id:String(e.grade_id),name:String(e.name),pence:Number(e.pence),sort:Number(e.sort??0)}),apply:(t,a)=>{if(!t.length&&!a.length)return;const s=x.useSetup.getState().sites[e]?.grades??[],i=new Map(s.map((e,t)=>[e.id,{...e,sort:t}]));for(const e of t)i.set(e.id,e);for(const e of a)i.delete(e);const n=[...i.values()].sort((e,t)=>e.sort-t.sort).map(e=>({id:e.id,name:e.name,pence:e.pence}));x.useSetup.getState().patch(e,{grades:n})},subscribe:t=>x.useSetup.subscribe((a,s)=>{a.sites[e]?.grades!==s.sites[e]?.grades&&t()})}}const Ia='staff-avatars',Oa=new Map;let Ra=!1;const Aa=e=>new Promise((t,a)=>{const s=new FileReader;s.onload=()=>t(String(s.result)),s.onerror=a,s.readAsDataURL(e)});async function Ua(){if(!Ra){Ra=!0;try{for(const[e,t]of Oa){const a=K.useAvatars.getState().photos[e];if(!t){a?.path&&K.useAvatars.setState(t=>{const a={...t.photos};return delete a[e],{photos:a}});continue}if(a?.path===t)continue;if(a&&!a.path&&e===re.getState().staffRef)continue;const{data:s,error:i}=await ne().storage.from(Ia).download(t);if(i||!s)continue;const n=await Aa(s);n.startsWith('data:image/')&&K.useAvatars.setState(a=>({photos:{...a.photos,[e]:{dataUrl:n,at:(new Date).toISOString(),path:t}}}))}}catch{}finally{Ra=!1}}}function Da(e){const t=async()=>{const t=re.getState().staffRef,a=t?Be.get(t)??re.getState().staffUuid:void 0;if(!t||!a||'staff'!==re.getState().kind)return;const s=K.useAvatars.getState().photos[t];try{const i=Oa.get(t),n=t=>{t&&t.startsWith(`${e}/${a}-`)&&ne().storage.from(Ia).remove([t]).catch(()=>{})};if(!s)return void(i&&(await Yt('set_staff_avatar',{p_staff_ref:t,p_path:null}),Oa.set(t,null),n(i)));if(s.path)return;const r=await(await fetch(s.dataUrl)).blob();if(r.size>512e3)return void oe({lastError:'Avatar: picture too large to share'});const o='image/jpeg'===r.type?'jpg':'image/webp'===r.type?'webp':'png',d=`${e}/${a}-${Date.now().toString(36)}.${o}`,{error:u}=await ne().storage.from(Ia).upload(d,r,{upsert:!1,contentType:r.type||'image/png'});if(u)throw u;await Yt('set_staff_avatar',{p_staff_ref:t,p_path:d}),Oa.set(t,d),i!==d&&n(i),K.useAvatars.setState(e=>e.photos[t]?.dataUrl===s.dataUrl?{photos:{...e.photos,[t]:{...s,path:d}}}:e)}catch(e){oe({lastError:`Avatar: ${String(e?.message??e)}`})}},a={photos:K.useAvatars.getState().photos},s=K.useAvatars.subscribe(e=>{const s=a.photos;if(a.photos=e.photos,t(),de('staff.manage'))for(const t of Object.keys(s))if(!e.photos[t]&&s[t]?.path&&t!==re.getState().staffRef){const e=s[t].path;Oa.set(t,null),Yt('set_staff_avatar',{p_staff_ref:t,p_path:null}).then(()=>ne().storage.from(Ia).remove([e])).catch(()=>{})}});return t(),s}const Ea=new Map,Ca=(0,y.create)(()=>({n:0}))},820,{"0":5,"1":6,"2":1128,"3":833,"4":1129,"5":1132,"6":1148,"7":857,"8":1024,"9":988,"10":996,"11":947,"12":811,"13":1150,"14":1109,"15":859,"16":1151,"17":957,"18":1108,"19":952,"20":863,"21":1096,"22":1197,"23":1196,"24":1198,"25":1200,"26":1095,"27":1092,"28":872,"29":806,"30":824,"31":825,"32":1026,"33":1094,"34":1027,"35":1201,"36":1202,"37":1203,"38":1105,"39":856,"40":1033,"41":956,"42":1093,"43":1004,"44":1206,"45":1207,"46":2,"47":1208,"48":1106,"49":1107,"50":1209,"51":1118,"52":923,"53":918,"54":942,"55":1119,"56":1104,"57":945,"58":1017,"59":28,"paths":{}}); +__d(function(_g,_r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"colours",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"fonts",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"font",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"radius",{enumerable:!0,get:function(){return A}}),e.brandColour=function(I,S=n.gold){const r=/^#([0-9a-f]{6})$/i.exec(I??'');if(!r)return S;const _=parseInt(r[1],16),t=(_>>16)/255,E=(_>>8&255)/255,o=(255&_)/255,F=Math.max(t,E,o),A=Math.min(t,E,o),l=F-A;if(l<.12)return I;const D=F===t?((E-o)/l+6)%6*60:F===E?60*((o-t)/l+2):60*((t-E)/l+4);return D>65&&D<320?S:I};var I=_r(_d[0]),S=_r(_d[1]),r=_r(_d[2]),_=_r(_d[3]),t=_r(_d[4]),E=_r(_d[5]);const n={bg:I.IS_SOUTERS?'#56152A':I.IS_WILDINGS?'#272A2F':'#0B0B0B',surface:I.IS_SOUTERS?'#43122F':I.IS_WILDINGS?'#30343B':'#141414',surface2:I.IS_SOUTERS?'#43122F':I.IS_WILDINGS?'#363A42':'#1D1C1A',border:I.IS_SOUTERS?'#87435B':I.IS_WILDINGS?'#50545C':'#34302A',gold:I.IS_WILDINGS?'#FFE3A5':I.IS_KIRKMICHAEL?'#B87754':I.IS_SOUTERS?'#A4622E':'#CFA45F',goldLight:I.IS_WILDINGS?'#FFF0CF':I.IS_KIRKMICHAEL?'#D8AF95':I.IS_SOUTERS?'#D9AD8A':'#E2C489',goldTint:I.IS_WILDINGS?'#39352C':I.IS_KIRKMICHAEL?'#2C211B':I.IS_SOUTERS?'#43122F':'#2A2216',goldMuted:I.IS_WILDINGS?'#DDC694':I.IS_KIRKMICHAEL?'#C2937A':I.IS_SOUTERS?'#C18F67':'#BFA06C',hairline:'rgba(255,255,255,0.09)',tile:I.IS_SOUTERS?'#43122F':I.IS_WILDINGS?'#30343B':'#18171A',tilePressed:I.IS_SOUTERS?'#64223B':I.IS_WILDINGS?'#393D45':'#211F1C',accentBg:I.IS_WILDINGS?'rgba(255,227,165,0.13)':I.IS_KIRKMICHAEL?'rgba(184,119,84,0.13)':I.IS_SOUTERS?'rgba(164,98,46,0.13)':'rgba(207,164,95,0.13)',accentBorder:I.IS_WILDINGS?'rgba(255,227,165,0.38)':I.IS_KIRKMICHAEL?'rgba(184,119,84,0.38)':I.IS_SOUTERS?'rgba(164,98,46,0.38)':'rgba(207,164,95,0.38)',text:'#F5F1E8',muted:'#B8B0A0',onGold:I.IS_WILDINGS?'#272A2F':I.IS_KIRKMICHAEL?'#0B0B0B':I.IS_SOUTERS?'#FFFFFF':'#0B0B0B',red:'#FF6B5E',redBg:'#4A1310',redSolid:'#C62F22',amber:'#FFB547',amberBg:'#3F2C05',ok:I.IS_WILDINGS?'#FFF0CF':I.IS_KIRKMICHAEL?'#D8AF95':I.IS_SOUTERS?'#D9AD8A':'#E2C489',okBg:I.IS_WILDINGS?'#39352C':I.IS_KIRKMICHAEL?'#2C211B':I.IS_SOUTERS?'#43122F':'#2A2216',blue:I.IS_WILDINGS?'#FFF0CF':I.IS_KIRKMICHAEL?'#D8AF95':I.IS_SOUTERS?'#D9AD8A':'#E2C489',blueBg:I.IS_SOUTERS?'#43122F':I.IS_WILDINGS?'#39352C':'#1E1A12',...I.IS_GREENSIDE?r.GREENSIDE_PALETTE:{},...I.IS_QUEUED_VENUE?S.QUEUED_PALETTE:{},...I.IS_KIRKTON?t.KIRKTON_PALETTE:{},...I.IS_ABBOTSFORD?_.ABBOTSFORD_PALETTE:{}},o={regular:'Poppins_400Regular',medium:'Poppins_500Medium',semibold:'Poppins_600SemiBold',bold:'Poppins_700Bold'},F={small:E.type.small,body:E.type.body,large:E.type.large,title:E.type.title,hero:E.type.hero},A={s:E.radii.s,m:E.radii.m,l:E.radii.l}},821,[5,1233,1204,1234,1235,1236]); +__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.waNumber=o,_e.waMeLink=function(e,t){const n=o(e);return n?t?`https://wa.me/${n}?text=${encodeURIComponent(t)}`:`https://wa.me/${n}`:null},Object.defineProperty(_e,"guestWhatsAppText",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"staffWhatsAppTexts",{enumerable:!0,get:function(){return p}}),_e.openWhatsApp=async function(e){try{return await n.default.openURL(e),!0}catch{return!1}};var e,t=r(_d[0]),n=(e=t)&&e.__esModule?e:{default:e};function o(e,t="44"){if(!e)return null;let n=String(e).trim().replace(/[\s().\-]/g,'');return n.startsWith('+')?n=n.slice(1):n.startsWith('00')?n=n.slice(2):n.startsWith('0')&&(n=t+n.slice(1)),n=n.replace(/^440/,'44'),/^[1-9][0-9]{6,14}$/.test(n)?n:null}const s=e=>{const[t,n,o]=e.split('-').map(Number);return new Date(t,n-1,o).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',year:'numeric'})},u=e=>{const[t,n,o]=e.split('-').map(Number);return new Date(t,n-1,o).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'})},c=e=>e.slice(0,5),l=e=>e.replace(' (example)','').trim().split(/\s+/)[0]||'there',m=(e,t)=>`Hi ${t}, it's ${e.name.trim()} about my booking${e.ref?` ${e.ref}`:''}: ${s(e.date)} at ${c(e.time)}, table for ${e.partySize}. `,p=(e,t,n)=>({confirm:`Hi ${l(e.name)}, it's ${t}${n?` in ${n}`:''}. Just confirming your table for ${e.partySize} on ${u(e.date)} at ${c(e.time)}${e.ref?` (ref ${e.ref})`:''}. Any questions, just reply here.`,change:`Hi ${l(e.name)}, it's ${t} about your booking on ${u(e.date)} at ${c(e.time)}. `})},822,[239]); +__d(function(g,_r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.templatesFor=function(t){const n={...r.DEFAULT_TEMPLATES};for(const o of Object.keys(r.DEFAULT_TEMPLATES))n[o]={...r.DEFAULT_TEMPLATES[o],...t?.[o]??{}};return n},e.composeBooking=function(t,n,o,c,u){if(n.walkIn)return[];return s(t,'booking-confirmation'===t?'booking':'booking-request'===t?'request':'declined',(0,r.bookingVars)(n,o),{phone:n.phone,email:n.email,name:n.name},{refType:'booking',refId:n.id,ref:n.ref},o,c,u)},e.composeOrder=function(t,n,o,c){return'takeaway'!==t.type?[]:s('order-confirmation','order',(0,r.orderVars)(t,n),{phone:t.phone,email:t.email,name:t.customerName},{refType:'order',refId:t.id,ref:t.ref},n,o,c)},e.deliverQueued=async function(r,n){if(!(0,t.isLive)())return;const o=(0,t.activeProvider)();for(const t of r){const r=await o.deliver(t);n(t.id,r.ok?{status:'sent'}:{status:'failed',error:r.error})}},e.statusLabel=function(t){const r='sms'===t.channel?'Text':'Email';return'preview'===t.status?`${r}: Ready (preview mode)`:'queued'===t.status?`${r}: Sending\u2026`:'sent'===t.status?`${r} sent`:`${r}: Not sent (failed)`},Object.defineProperty(e,"PREVIEW_BANNER",{enumerable:!0,get:function(){return c}});var t=_r(d[0]);Object.keys(t).forEach(function(r){'default'===r||Object.prototype.hasOwnProperty.call(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[r]}})});var r=_r(d[1]);Object.keys(r).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return r[t]}})});var n=_r(d[2]);Object.keys(n).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})});const o=()=>`msg-${Math.random().toString(36).slice(2,8)}${Date.now().toString(36).slice(-4)}`;function s(s,c,u,l,f,m,p,b){const y=[],v=(0,t.isLive)()?'queued':'preview',h=(0,t.activeProvider)().id,k=(0,n.ukPhone)(l.phone);if(k.ok&&y.push({id:o(),restaurantId:m.id,at:b,channel:'sms',kind:s,to:k.pretty,toName:l.name,body:(0,r.toGsm)((0,r.fill)(p[c].sms,u.sms)),...f,status:v,provider:h}),l.email?.trim()){const t=(0,r.fillEmailText)(p[c].body,u.email),n=(0,r.fill)(p[c].subject,u.email);y.push({id:o(),restaurantId:m.id,at:b,channel:'email',kind:s,to:l.email.trim(),toName:l.name,subject:n,body:t,html:(0,r.emailHtml)(t,{venue:m.name,preheader:n}),...f,status:v,provider:h})}return y}const c='Preview mode, not sent yet. Connect a text and email service to go live.'},823,[1138,1139,1140]); +__d(function(g,r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"BLOCK_REASONS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"useBlocks",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"venueWide",{enumerable:!0,get:function(){return f}}),_e.blockedTablesAt=m,Object.defineProperty(_e,"blocksOn",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"areaBlocksOn",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"tableKey",{enumerable:!0,get:function(){return p}}),_e.closedAreasAt=function(e,t,o,n){const s=(0,l.toMins)(n),a=v(e,t,o).filter(e=>s>=(0,l.toMins)(e.from)&&s<(0,l.toMins)(e.to)).map(e=>e.areaId);return new Set([...a,...[...m(e,t,o,n)].map(p)])},_e.blockAt=M,_e.currentBlocks=function(e,t,o,n){return e.filter(e=>e.rid===t&&!e.removedAt&&(e.date>o||e.date===o&&(0,l.toMins)(e.to)>(0,l.toMins)(n))).sort((e,t)=>e.date===t.date?(0,l.toMins)(e.from)-(0,l.toMins)(t.from):e.date({blocks:[],removed:[],add:t=>{const o={...t,id:(0,s.uuid)(),createdAt:(new Date).toISOString(),source:'covercharge'};return e(e=>({blocks:[...e.blocks,o]})),o},addMany:t=>{const o=(new Date).toISOString(),n=t.map(e=>({...e,id:(0,s.uuid)(),createdAt:o,source:'covercharge'}));return e(e=>({blocks:[...e.blocks,...n]})),n},update:(t,o,n)=>e(e=>({blocks:e.blocks.map(e=>e.id===t?{...e,...o,id:t,editedAt:(new Date).toISOString(),editedBy:n}:e)})),remove:(t,o)=>e(e=>{const n=e.blocks.find(e=>e.id===t);return n?{blocks:e.blocks.filter(e=>e.id!==t),removed:[...e.removed,{...n,removedAt:(new Date).toISOString(),removedBy:o??n.by}]}:e}),put:t=>e(e=>{const o=e.blocks.filter(e=>e.id!==t.id),n=e.removed.filter(e=>e.id!==t.id);return t.removedAt?{blocks:o,removed:[...n,t]}:{blocks:[...o,t],removed:n}})}),{name:'covercharge-blocks-v1',storage:(0,c.createJSONStorage)(()=>n.default),version:2,migrate:e=>{const t=e??{};return{blocks:t.blocks??[],removed:t.removed??[]}}})),f=e=>!e.areaId&&!e.tables?.length;function m(e,t,o,n){const s=(0,l.toMins)(n);return new Set(e.filter(e=>e.rid===t&&e.date===o&&!e.removedAt&&e.tables?.length&&s>=(0,l.toMins)(e.from)&&s<(0,l.toMins)(e.to)).flatMap(e=>e.tables))}const k=(e,t,o)=>e.filter(e=>e.rid===t&&e.date===o&&!e.removedAt&&f(e)).sort((e,t)=>(0,l.toMins)(e.from)-(0,l.toMins)(t.from)),v=(e,t,o)=>e.filter(e=>e.rid===t&&e.date===o&&!e.removedAt&&!!e.areaId).sort((e,t)=>(0,l.toMins)(e.from)-(0,l.toMins)(t.from)),p=e=>`tbl:${e}`;function M(e,t,o,n){const s=(0,l.toMins)(n);return k(e,t,o).find(e=>s>=(0,l.toMins)(e.from)&&s<(0,l.toMins)(e.to))}const O=(e,t,o,n)=>M(e,t,o,n),y=e=>e.tables?.length?`${e.tables.map(t.tableNumbers).join(', ')} blocked until ${e.to}${e.reason?` \xb7 ${e.reason}`:''}`:e.areaId?`${e.areaName??'Area'} closed until ${e.to}${e.reason?` \xb7 ${e.reason}`:''}`:`Bookings paused until ${e.to}${e.reason?` \xb7 ${e.reason}`:''}`,A=(e,t)=>{const o=b(e=>e.blocks);return k(o,e,t)}},824,[808,1116,1033,952,1117,818]); +__d(function(g,r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEFAULT_SETTINGS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"seedPlan",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"useFloor",{enumerable:!0,get:function(){return p}}),_e.hashOldPins=f,Object.defineProperty(_e,"usePlan",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"useDisplaySettings",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"planOf",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"tablesOf",{enumerable:!0,get:function(){return j}}),_e.tablesLabel=function(e){const n=j((0,t.tableNumbers)(e));if(!n.length)return'';if(1===n.length)return n[0];const a=n.map(e=>/^\d+$/.test(e)?Number(e):NaN),s=a.every(e=>!Number.isNaN(e))?[...n].sort((e,n)=>Number(e)-Number(n)):n;return a.every(e=>!Number.isNaN(e))&&s.length>=3&&s.every((e,n)=>0===n||Number(e)===Number(s[n-1])+1)?`${s[0]}\u2013${s[s.length-1]}`:s.join(' + ')},Object.defineProperty(_e,"joinTables",{enumerable:!0,get:function(){return v}});var e,n=r(d[0]),t=r(d[1]),a=r(d[2]),s=(e=a)&&e.__esModule?e:{default:e},i=r(d[3]),l=r(d[4]),o=r(d[5]),c=r(d[6]);Object.keys(c).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return c[e]}})});const u={privacy:!0,idleMins:2,pinOn:!1,...i.DEFAULT_WAKE,tonightCards:!0},b=e=>'souters'===e||n.IS_ISOLATED_VENUE&&'souters'===n.VENUE_RID?{areas:[{id:'su-restaurant',name:'Restaurant'},{id:'su-bar',name:'Bar'},{id:'su-mezzanine',name:'Mezzanine / private dining'},{id:'su-garden',name:'Beer garden',outdoor:!0},{id:'su-icecream',name:'Ice cream & cake corner'}],tables:[],joins:[],sections:[],fixtures:[]}:'kirkmichael'===e||n.IS_ISOLATED_VENUE&&'kirkmichael'===n.VENUE_RID?{areas:[{id:'km-restaurant',name:'Restaurant'},{id:'km-bar',name:'Bar'},{id:'km-private',name:'Private dining',label:'The Room (about 18 covers) \u2014 table plan to confirm'}],tables:[],joins:[],sections:[],fixtures:[]}:['wildings','greenside'].includes(e)||n.IS_ISOLATED_VENUE?{areas:[],tables:[],joins:[],sections:[],fixtures:[]}:'anchorage'===e?(0,c.anchoragePlan)():(0,c.starterPlan)(),p=(0,l.create)()((0,o.persist)((e,t)=>{const a=e=>t().plans[e]??b(e);return{plans:n.IS_ISOLATED_VENUE?{[n.VENUE_RID]:b(n.VENUE_RID)}:{anchorage:(0,c.anchoragePlan)()},live:{},settings:{},smsLog:[],setPlan:(n,t)=>e(e=>({plans:{...e.plans,[n]:t}})),updateTable:(n,t,s)=>{const i=a(n);e(e=>({plans:{...e.plans,[n]:{...i,tables:i.tables.map(e=>e.id===t?{...e,...s}:e)}}}))},addTable:(n,t)=>{const s=a(n);e(e=>({plans:{...e.plans,[n]:{...s,tables:[...s.tables,t]}}}))},removeTable:(n,t)=>{const s=a(n),i=s.tables.find(e=>e.id===t);e(e=>({plans:{...e.plans,[n]:{...s,tables:s.tables.filter(e=>e.id!==t),joins:s.joins.filter(e=>!i||!e.tables.includes(i.name))}}}))},setLive:(n,t,a)=>e(e=>({live:{...e.live,[n]:{...e.live[n]??{},[t]:{...e.live[n]?.[t]??{},...a}}}})),setSettings:(n,t)=>e(e=>({settings:{...e.settings,[n]:{...u,...e.settings[n]??{},...t}}})),logSms:(n,t,a)=>e(e=>{return{smsLog:[{id:(s='sms',`${s}-${Date.now().toString(36)}${Math.random().toString(36).slice(2,6)}`),rid:n,at:t,text:a},...e.smsLog].slice(0,50)};var s}),resetPlan:n=>e(e=>({plans:{...e.plans,[n]:b(n)}}))}},{name:'covercharge-floor-v1',version:6,storage:(0,o.createJSONStorage)(()=>s.default),migrate:(e,n)=>{const t=e??{};let a=t;if(n<2){const e={};for(const[n,a]of Object.entries(t.plans??{}))e[n]='anchorage'===n?(0,c.anchoragePlan)():(0,c.normalisePlan)(a);e.anchorage=(0,c.anchoragePlan)(),a={...t,plans:e,live:{}}}else if(n<3)a={...t,plans:{...t.plans??{},anchorage:(0,c.anchoragePlan)()}};else if(n<4){const e=t.plans?.anchorage;e&&(a={...t,plans:{...t.plans,anchorage:{...e,joins:(e.joins??[]).filter(e=>!(2===e.tables.length&&e.tables.includes('1')&&e.tables.includes('2')))}}})}return n<5&&(a={...a,settings:f(a.settings)}),n<6&&a.plans?.anchorage&&(a={...a,plans:{...a.plans,anchorage:(0,c.withSeedBest)('anchorage',a.plans.anchorage)}}),a}}));function f(e){const n={};for(const[t,a]of Object.entries(e??{})){const{pin:e,...s}=a??{};n[t]={...u,...s,...'pinHash'in s?{}:(0,i.fromOldPin)(e)}}return n}const h=e=>p(n=>n.plans[e])??E(e),N={};function E(e){return N[e]??=b(e)}const O=e=>{const n=p(n=>n.settings[e]);return n?{...u,...n}:u},P=e=>p.getState().plans[e]??E(e),j=e=>e?e.split('+').map(e=>e.trim()).filter(Boolean):[];const v=e=>[...new Set(e)].sort((e,n)=>/^\d+$/.test(e)&&/^\d+$/.test(n)?Number(e)-Number(n):e.localeCompare(n)).join('+')},825,[5,808,1116,946,952,1117,945]); +__d(function(_g,r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"STATUS",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"STAGE_LABEL",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"STAGES",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"turnFor",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"startOf",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"durOf",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"endOf",{enumerable:!0,get:function(){return f}}),e.clashes=function(a,s=90){const n=new Set,l=a.filter(t=>g(t)&&t.table);for(let a=0;a(0,t.tablesOf)(d.table).includes(a))&&(u(o)t.date===n&&!['cancelled','noshow'].includes(t.status)).sort((t,a)=>t.time.localeCompare(a.time));for(const s of a.tables){const a=i.filter(a=>(0,t.tablesOf)(a.table).includes(s.name)),n=a[0],o=(0,t.tablesOf)(n?.table);l[s.name]={table:s,status:n?'soon':'free',next:n,covers:n?.partySize??0,dayBookings:a.length?a:void 0,group:o.length>1?o:void 0,allergy:!(!n?.allergies?.length&&!n?.allergyNote),vip:n?.tags?.find(t=>'VIP'===t)??n?.tags?.find(t=>'Regular'===t),occasion:n?.occasion??h(n?.notes)}}return l},e.floorView=function(a,n,l,i,o,d=90,c){const b={},g=n.filter(t=>t.date===O(o));for(const n of a.tables){const a=i[n.name]??{},y=g.filter(a=>(0,t.tablesOf)(a.table).includes(n.name)),O=y.find(t=>'seated'===(0,s.shownStatus)(t)),v=y.filter(t=>'confirmed'===t.status).sort((t,a)=>t.time.localeCompare(a.time)).find(t=>S(o,t)>=-20),T=v?Math.round(S(o,v)):void 0,w=O?void 0:p(y,o,d),F=l.find(t=>'table'===t.type&&t.tableNo===n.name&&!['closed','cancelled','collected'].includes(t.status));let j='free';a.blocked?j='blocked':O?j=a.stage??'seated':!c?.has(n.areaId)&&!c?.has(`tbl:${n.name}`)||F?a.dirty?j='dirty':F?j=a.stage??'seated':v&&void 0!==T&&T<=45&&(j='soon'):j='blocked';const A=O,P=A?.tags?.find(t=>'VIP'===t)??A?.tags?.find(t=>'Regular'===t)??(A?void 0:v?.tags?.[0]);b[n.name]={table:n,status:j,booking:A,next:v,due:w,nextIn:T,covers:A?.partySize??0,group:(()=>{const a=(0,t.tablesOf)((A??('soon'===j?v:void 0))?.table);return a.length>1?a:void 0})(),orderOnly:!A&&!!F,note:a.note,seatedMins:A?Math.max(0,Math.round((o.getTime()-u(A).getTime())/6e4)):void 0,freeAt:A?f(A,d):void 0,allergy:!!(A?.allergies?.length||A?.allergyNote||!A&&(v?.allergies?.length||v?.allergyNote)||F?.allergies?.length),vip:P,occasion:A?.occasion??(A?void 0:v?.occasion??h(v?.notes))??h(A?.notes)}}return b},e.dueOnTable=p,Object.defineProperty(e,"OCCASION_ICON",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"tableAllowed",{enumerable:!0,get:function(){return v}}),e.suggestTable=function(s,n,l,i,o,d,c=90,b,p){const h=[...s.tables.map(t=>({name:t.name,seats:t.maxSeats,min:t.minSeats,parts:[t.name]})),...s.joins.map(t=>{const a=s.tables.filter(a=>t.tables.includes(a.name));return{name:t.tables.join('+'),seats:a.reduce((t,a)=>t+a.maxSeats,0),min:a.reduce((t,a)=>t+a.minSeats,0),parts:t.tables}})].filter(t=>t.parts.every(t=>v(s,t,p))),y=o.getTime()+6e4*d,S=new Set((0,a.bestTables)(s));let O=null;for(const a of h){if(a.seats['blocked'].includes(l[t]?.status)))continue;const s=!!l&&a.parts.some(t=>['seated','mains','dessert','bill','dirty'].includes(l[t]?.status)),d=n.filter(s=>s.id!==b&&g(s)&&(0,t.tablesOf)(s.table).some(t=>a.parts.includes(t))&&u(s).getTime()o.getTime()).length,p=1===a.parts.length&&S.has(a.parts[0])?12:0,h=(s?1e3:0)+100*d+10*(a.seats-i)+(i({name:t.name,seats:t.maxSeats,parts:[t.name]})),...s.joins.map(t=>({name:t.tables.join('+'),seats:s.tables.filter(a=>t.tables.includes(a.name)).reduce((t,a)=>t+a.maxSeats,0),parts:t.tables}))].filter(t=>t.seats>=l&&t.parts.every(t=>v(s,t,c))).filter(a=>!n.some(s=>s.id!==b&&g(s)&&(0,t.tablesOf)(s.table).some(t=>a.parts.includes(t))&&u(s).getTime()i.getTime())),y=new Set((0,a.bestTables)(s)),S=t=>1===t.parts.length&&y.has(t.parts[0])?0:1;return h.sort((t,a)=>t.seats-a.seats||t.parts.length-a.parts.length||S(t)-S(a)).map(t=>({table:t.name,seats:t.seats,area:s.areas.find(a=>a.id===s.tables.find(a=>a.name===t.parts[0])?.areaId)?.name??''}))};var t=r(_d[0]),a=r(_d[1]),s=r(_d[2]);const n={colour:'#3A2F1E',fg:'#F1DDB0'},l={colour:'#CFA45F',fg:'#0B0B0B'},i={free:{label:'Free',...n},soon:{label:'Free',...n},seated:{label:'Seated',...l},mains:{label:'Seated',...l},dessert:{label:'Seated',...l},bill:{label:'Seated',...l},dirty:{label:'Needs clearing',colour:'#6E6555',fg:'#FFFFFF'},blocked:{label:'Blocked',...n}},o={seated:'Seated',mains:'Mains',dessert:'Dessert',bill:'Bill requested'},d=['seated','mains','dessert','bill'],c=(t,a=90)=>Math.min(a+60,a+15*Math.max(0,Math.ceil((t-2)/2))),u=t=>'seated'===(0,s.shownStatus)(t)&&t.seatedAt?new Date(t.seatedAt):new Date(`${t.date}T${t.time}:00`),b=(t,a=90)=>t.durationMins??c(t.partySize,a),f=(t,a=90)=>new Date(u(t).getTime()+6e4*b(t,a)),g=t=>!['cancelled','noshow','finished'].includes(t.status);function p(t,a,s=90){return t.filter(t=>'confirmed'===t.status&&S(a,t)<=45&&-S(a,t)t.time.localeCompare(a.time))[0]}const h=t=>t?/birthday/i.test(t)?'birthday':/anniversary/i.test(t)?'anniversary':void 0:void 0,y={birthday:'\ud83c\udf82',anniversary:'\ud83d\udc9d',celebration:'\ud83e\udd42'},S=(t,a)=>(new Date(`${a.date}T${a.time}:00`).getTime()-t.getTime())/6e4,O=t=>`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`,v=(t,a,s)=>{const n=t.tables.find(t=>t.name===a);if(!n)return!1;const l=t.areas.find(t=>t.id===n.areaId);return!(s?.dog&&!(void 0!==n.dogOk?n.dogOk:l?.dogs))&&(!s?.closed?.has(n.areaId)&&!s?.closed?.has(`tbl:${n.name}`))}},826,[825,945,828]); +__d(function(g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"emptyNeeds",{enumerable:!0,get:function(){return w}}),_e.needsMissing=function(e,l=[]){const s=[];null===e.allergy?s.push('Answer the allergy question first'):'yes'!==e.allergy||e.allergens.length||l.length||e.allergyNote.trim()||s.push('Pick the allergens or describe them');null===e.dog&&s.push('Say whether a dog is coming');return s},_e.needsPatch=function(e,l=[]){const s='yes'===e.allergy?e.allergens.filter(e=>!l.some(l=>l.allergen===e)).map(l=>({allergen:l,severity:e.severity})):[],t=Object.entries(e.holds).filter(([,e])=>e>0).map(([e,l])=>({kind:e.startsWith('item:')?'item':'stock',id:e.slice(5),qty:l})),a=e.dog?Math.max(1,e.dogs):0,n={...e.wheelchair?{wheelchair:e.wheelchair}:{},...e.stepFree?{stepFree:!0}:{},...e.toilet?{toilet:!0}:{},...e.assistDog?{assistDog:!0}:{},...e.accessNote.trim()?{note:e.accessNote.trim()}:{}},r={...e.vegan?{vegan:e.vegan}:{},...e.vegetarian?{vegetarian:e.vegetarian}:{}};return{allergies:[...l,...s],allergyNone:'none'===e.allergy&&!l.length||void 0,allergyPeople:'yes'===e.allergy?e.allergyPeople:void 0,allergyNote:'yes'===e.allergy&&e.allergyNote.trim()?e.allergyNote.trim():void 0,dog:a>0,dogs:a||void 0,access:Object.keys(n).length?n:void 0,diet:Object.keys(r).length?r:void 0,holds:t.length?t:void 0,tableReq:e.tableReq.length?e.tableReq:void 0}},_e.FirstQuestions=function({rid:e,value:l,onChange:a,party:r,audience:i,profile:o=[]}){const p=e=>a({...l,...e}),b=(0,y.usePlan)(e),[x,j]=(0,t.useState)(!1),k=(0,s.dogQuestionOn)((0,u.useRestaurant)(e));(0,t.useEffect)(()=>{k||null!==l.dog||a({...l,dog:!1})},[k,l.dog]);const w=x?m.ALLERGENS:m.ALLERGENS.filter(e=>['gluten','milk','peanuts','treenuts','crustaceans','molluscs','fish','eggs','sesame'].includes(e.id)||l.allergens.includes(e.id)),M=[...o.map(e=>e.allergen),...l.allergens],q=(0,f.dogSetUp)(b);return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)(R,{tone:"red",testID:"q-allergens",children:[(0,v.jsx)(C,{sub:'guest'===i?'We ask everyone first, so the kitchen can keep you safe.':'Ask every guest first. It goes to the kitchen in red.',children:"\u26a0\ufe0f Does anyone in the party have a food allergy?"}),o.length?(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:o.map(e=>(0,v.jsx)(h.Badge,{kind:"red",label:`${m.ALLERGENS.find(l=>l.id===e.allergen)?.short} (from your profile)`},e.allergen))}):null,(0,v.jsxs)(h.Row,{gap:8,children:[(0,v.jsx)(n.default,{style:{flex:1},children:(0,v.jsx)(h.Chip,{label:"No allergies",selected:'none'===l.allergy,onPress:()=>p({allergy:'none',allergens:[]})})}),(0,v.jsx)(n.default,{style:{flex:1},children:(0,v.jsx)(h.Chip,{label:"Yes, allergies",selected:'yes'===l.allergy,onPress:()=>p({allergy:'yes'})})})]}),'none'===l.allergy&&o.length?(0,v.jsx)(h.Muted,{children:"Your profile allergies above are still shared with the kitchen."}):null,'yes'===l.allergy?(0,v.jsxs)(n.default,{style:{gap:10},testID:"allergen-picker",children:[(0,v.jsx)(h.T,{size:14,weight:"semibold",children:"Which allergens? (the 14 UK allergens)"}),(0,v.jsxs)(h.Row,{wrap:!0,gap:6,children:[w.map(e=>(0,v.jsx)(h.Chip,{label:e.short,selected:l.allergens.includes(e.id)||o.some(l=>l.allergen===e.id),disabled:o.some(l=>l.allergen===e.id),onPress:()=>p({allergens:l.allergens.includes(e.id)?l.allergens.filter(l=>l!==e.id):[...l.allergens,e.id]})},e.id)),x?null:(0,v.jsx)(h.Chip,{label:"All 14\u2026",onPress:()=>j(!0)})]}),(0,v.jsx)(h.T,{size:14,weight:"semibold",children:"How serious?"}),(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:m.SEVERITIES.map(e=>(0,v.jsx)(h.Chip,{label:e.label,selected:l.severity===e.id,onPress:()=>p({severity:e.id})},e.id))}),(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.T,{size:14,children:"How many people with allergies?"}),(0,v.jsx)(h.Stepper,{value:Math.min(l.allergyPeople,r),onChange:e=>p({allergyPeople:e}),min:1,max:Math.max(1,r),label:"people with allergies"})]}),(0,v.jsx)(h.Field,{label:"Anything else the kitchen should know? (optional)",value:l.allergyNote,onChangeText:e=>p({allergyNote:e}),placeholder:"e.g. traces of sesame, one child with coeliac disease",testID:"allergy-note"}),M.length?(0,v.jsx)(c.MenuAllergyCheck,{rid:e,allergens:M,audience:i}):null]}):null]}),k?(0,v.jsxs)(R,{tone:"gold",testID:"q-dogs",children:[(0,v.jsx)(C,{sub:q?'Well-behaved dogs are welcome at our dog-friendly tables.':'staff'===i?'Dog-friendly tables aren\u2019t marked yet (Managers \u203a Booking options), so any table is offered for now.':void 0,children:"\ud83d\udc15 Are you bringing a dog?"}),(0,v.jsxs)(h.Row,{gap:8,children:[(0,v.jsx)(n.default,{style:{flex:1},children:(0,v.jsx)(h.Chip,{label:"No",selected:!1===l.dog,onPress:()=>p({dog:!1})})}),(0,v.jsx)(n.default,{style:{flex:1},children:(0,v.jsx)(h.Chip,{label:"Yes",selected:!0===l.dog,onPress:()=>p({dog:!0,dogs:Math.max(1,l.dogs)})})})]}),l.dog?(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.T,{size:14,children:"How many dogs?"}),(0,v.jsx)(h.Stepper,{value:l.dogs,onChange:e=>p({dogs:e}),min:1,max:4,label:"dogs"})]}):null]}):null]})},_e.useReserveAvailability=M,_e.MoreQuestions=function({rid:e,r:l,value:a,onChange:r,party:i,date:o,time:c,today:p,bookings:m,audience:b,showTables:x}){const j=e=>r({...a,...e}),w=l.settings,S=(0,u.useMenu)(e),P=(0,t.useMemo)(()=>S.filter(e=>/\((V|VG|Ve)\)|vegan|vegetarian/i.test(`${e.name} ${e.tags?.join(' ')??''}`)).slice(0,4),[S.length]),N=M(e,l,o,p,m,b),T=e=>a.holds[e]??0,$=(0,f.stockNeed)({holds:Object.entries(a.holds).map(([e,l])=>({kind:e.startsWith('item:')?'item':'stock',id:e.slice(5),qty:l}))},N.items),D=(e,l)=>Math.min(10,...e.map(e=>{const s=($[e.key]??0)-T(l)*e.qty;return Math.floor(((N.free[e.key]??0)-s)/e.qty)})),A=(e,l,s,t)=>{const r=T(e),i=t<=0&&0===r;return(0,v.jsxs)(n.default,{style:{flexDirection:'row',alignItems:'center',gap:10,opacity:i?.55:1},testID:`reserve-${e.replace(':','-')}`,children:[(0,v.jsxs)(n.default,{style:{flex:1,minWidth:0},children:[(0,v.jsx)(h.T,{weight:"semibold",children:l}),(0,v.jsx)(h.Muted,{children:i?'Unavailable \u2014 none left for this day':s})]}),i?(0,v.jsx)(h.Badge,{kind:"neutral",label:"Unavailable"}):(0,v.jsx)(h.Stepper,{value:r,onChange:l=>j({holds:{...a.holds,[e]:Math.max(0,Math.min(l,Math.max(r,t)))}}),min:0,max:Math.max(r,Math.min(10,t)),label:l})]},e)},I=N.items.length>0||!1!==w.reserveStock&&N.stock.length>0,O=(0,y.usePlan)(e);return(0,v.jsxs)(v.Fragment,{children:[(0,s.accessQuestionOn)(l)?(0,v.jsxs)(R,{tone:"plain",testID:"q-access",children:[(0,v.jsx)(C,{sub:"Optional. Tell us and we\u2019ll have the right table ready.",children:"\u267f Access needs"}),(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.T,{size:14,children:"Wheelchair users"}),(0,v.jsx)(h.Stepper,{value:a.wheelchair,onChange:e=>j({wheelchair:e}),min:0,max:Math.max(1,i),label:"wheelchair users"})]}),(0,v.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,v.jsx)(h.Chip,{label:"Step-free access",selected:a.stepFree,onPress:()=>j({stepFree:!a.stepFree})}),(0,v.jsx)(h.Chip,{label:"Accessible toilet",selected:a.toilet,onPress:()=>j({toilet:!a.toilet})}),(0,v.jsx)(h.Chip,{label:"Assistance dog",selected:a.assistDog,onPress:()=>j({assistDog:!a.assistDog})})]}),(0,v.jsx)(h.Field,{label:"Anything else? (optional)",value:a.accessNote,onChangeText:e=>j({accessNote:e}),placeholder:"e.g. needs a chair with arms"}),w.accessStatement?.trim()?(0,v.jsx)(h.Muted,{children:w.accessStatement.trim()}):null]}):null,(0,s.dietQuestionOn)(l)?(0,v.jsxs)(R,{tone:"plain",testID:"q-veg",children:[(0,v.jsx)(C,{sub:"We\u2019d love to look after you. Optional.",children:"\u24cb Any vegans or vegetarians?"}),(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.T,{size:14,children:"Vegan"}),(0,v.jsx)(h.Stepper,{value:a.vegan,onChange:e=>j({vegan:e}),min:0,max:Math.max(1,i),label:"vegans"})]}),(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.T,{size:14,children:"Vegetarian"}),(0,v.jsx)(h.Stepper,{value:a.vegetarian,onChange:e=>j({vegetarian:e}),min:0,max:Math.max(1,i),label:"vegetarians"})]}),!1!==w.vegTeaser&&P.length&&(a.vegan||a.vegetarian)?(0,v.jsxs)(h.Muted,{children:["On the menu: ",P.map(e=>e.name).join(' \xb7 ')]}):null]}):null,I?(0,v.jsxs)(R,{tone:"gold",testID:"q-reserve",children:[(0,v.jsx)(C,{sub:N.known?'Held for you from today\u2019s count.':o>p||'guest'===b?'Held for you; the kitchen confirms and orders in.':void 0,children:"\ud83e\udd9e Reserve with your table"}),N.items.map(e=>A(`item:${e.id}`,`${e.name}${k(e.price)}`,e.description||e.uses.map(e=>`${e.qty} ${N.stock.find(l=>l.key===e.key)?.name.toLowerCase()??e.key}`).join(' + '),D(e.uses,`item:${e.id}`))),!1!==w.reserveStock?N.stock.map(e=>A(`stock:${e.key}`,`Reserve ${e.name.toLowerCase()}`,N.known?`${N.free[e.key]} available today`:'Held for the kitchen to order',D([{key:e.key,qty:1}],`stock:${e.key}`))):null,'staff'===b&&N.known?(0,v.jsxs)(h.Muted,{children:["Today: ",N.stock.map(e=>`${N.free[e.key]} ${e.plural.toLowerCase()} free (${N.reserved[e.key]??0} reserved)`).join(' \xb7 ')]}):null]}):null,x&&!1!==w.tableRequests&&O.tables.length?(0,v.jsx)(q,{rid:e,value:a,onChange:r,party:i,hide:w.tableRequestHide??[]}):null]})},_e.dogTimeOk=function(e,l,s,t,a){if(!a)return!0;const n=e.settings.maxDogsPerSlot;return!n||(0,f.dogsAt)(l,s,t)+a<=n},Object.defineProperty(_e,"accessibleSetUp",{enumerable:!0,get:function(){return f.accessibleSetUp}});var e,l=_r(d[0]),s=_r(d[1]),t=_r(d[2]),a=_r(d[3]),n=(e=a)&&e.__esModule?e:{default:e},r=_r(d[4]),i=_r(d[5]),o=_r(d[6]),c=_r(d[7]),h=_r(d[8]),u=_r(d[9]),y=_r(d[10]),p=_r(d[11]),m=_r(d[12]),b=_r(d[13]),x=_r(d[14]),f=_r(d[15]),j=_r(d[16]),v=_r(d[17]);const k=e=>'display'===x.APP_VARIANT?'':` \xb7 ${(0,b.gbp)(e)}`,w=()=>({allergy:null,allergens:[],severity:'allergy',allergyPeople:1,allergyNote:'',dog:null,dogs:1,wheelchair:0,stepFree:!1,toilet:!1,assistDog:!1,accessNote:'',vegan:0,vegetarian:0,holds:{},tableReq:[]});const R=({children:e,tone:l,testID:s})=>(0,v.jsx)(n.default,{testID:s,style:{gap:10,padding:16,borderRadius:16,borderWidth:'plain'===l?1:1.5,borderColor:'red'===l?j.colours.red:'gold'===l?j.colours.accentBorder:j.colours.hairline,backgroundColor:'red'===l?'#1E1110':j.colours.surface},children:e}),C=({children:e,sub:l})=>(0,v.jsxs)(n.default,{style:{gap:2},children:[(0,v.jsx)(h.T,{weight:"semibold",size:17,children:e}),l?(0,v.jsx)(h.Muted,{children:l}):null]});function M(e,l,s,t,a,n,i){const o=(0,f.reservablesOf)(l),c=(0,p.useStockItems)(e),h=(0,p.useShellStore)((0,r.useShallow)(l=>(0,p.venueCounts)(l,e))),u=(0,p.useShellStore)(l=>!!l.server[e]),y=(0,f.reservedOn)(a,s,o,i),m=s===t&&('staff'===n||u),b={};for(const e of c)b[e.key]=m?Math.max(0,Math.floor((h[e.key]??0)-(y[e.key]??0))):1/0;return{items:o,stock:c,free:b,reserved:y,known:m}}function q({rid:e,value:s,onChange:a,party:r,hide:c}){const u=(0,y.usePlan)(e),p=u.areas.filter(e=>u.tables.some(l=>l.areaId===e.id&&!c.includes(l.name))),[m,b]=(0,t.useState)(p[0]?.id??''),x=s.dog?s.dogs:0,k=e=>c.includes(e)?'Not bookable':(0,f.tableBlockReason)(u,e,r,x,s.wheelchair>0||s.stepFree),w=Object.fromEntries(u.tables.map(e=>[e.name,{table:e,status:k(e.name)?'blocked':'free',covers:0,allergy:!1}])),M=e=>{if(k(e))return;const l=s.tableReq.includes(e)?s.tableReq.filter(l=>l!==e):[...s.tableReq,e].slice(-2);a({...s,tableReq:l})},q=u.tables.filter(e=>e.areaId===m&&!c.includes(e.name));return(0,v.jsxs)(R,{tone:"plain",testID:"q-table",children:[(0,v.jsx)(C,{sub:"Table requests aren\u2019t guaranteed, but we\u2019ll do our best.",children:"\ud83e\ude91 Request a table (optional)"}),p.length>1?(0,v.jsx)(i.AreaTabs,{plan:u,area:m,onPick:b}):null,(0,v.jsx)(n.default,{style:{borderRadius:12,overflow:'hidden',borderWidth:1,borderColor:j.colours.hairline},children:(0,v.jsx)(o.FloorCanvas,{plan:u,areaId:m,mode:"live",view:w,privacy:!0,fit:"contain",crop:!0,maxH:260,highlight:s.tableReq,onTap:e=>M(e.name)})}),(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:q.map(e=>{const t=k(e.name),a=s.tableReq.indexOf(e.name);return(0,v.jsx)(h.Chip,{label:`${(0,l.tableNumbers)(e.name)}`,sub:t||(0===a?'1st choice':1===a?'2nd choice':`${e.maxSeats} seats`),selected:a>=0,disabled:!!t,onPress:()=>M(e.name)},e.name)})}),s.tableReq.length?(0,v.jsxs)(h.T,{size:14,colour:j.colours.goldLight,children:["Requested: ",s.tableReq.map((e,s)=>`${(0,l.tableNumbers)(e)}${s?' (2nd choice)':''}`).join(', ')]}):(0,v.jsx)(h.Muted,{children:"Tap a table; tap another for a second choice."})]})}},827,[808,809,30,127,873,929,928,1299,813,819,825,1026,814,816,806,828,821,24]); +__d(function(g,_r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ACTIVE",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"ANCHORAGE_RESERVABLES",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"reservablesOf",{enumerable:!0,get:function(){return i}}),e.stockNeed=s,e.reservedOn=a,e.usedOn=function(t,r,n){const o={};for(const i of t)if(i.date===r)for(const t of i.holds??[])if(t.served)for(const[r,a]of Object.entries(s({...i,holds:[{...t,served:void 0}]},n)))o[r]=(o[r]??0)+a;return o},e.heldSummary=function(t,r,o){const i={},s={};for(const o of t)if(o.date===r&&n(o))for(const t of o.holds??[])t.served||('item'===t.kind?i[t.id]=(i[t.id]??0)+t.qty:s[t.id]=(s[t.id]??0)+t.qty);return{platters:Object.values(i).reduce((t,r)=>t+r,0),byItem:i,single:s,stock:a(t,r,o)}},e.holdsText=function(t,r,n){return(t.holds??[]).filter(t=>t.qty>0).map(t=>`${'item'===t.kind?c(r.find(r=>r.id===t.id)?.name??'Reserved item'):n.find(r=>r.key===t.id)?.name??t.id} x${t.qty}${t.served?' (served)':''}`).join(', ')},Object.defineProperty(e,"shortItem",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"needsAllergenSeen",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"needsHoldOk",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"hasAllergens",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"allergenText",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"dogCount",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"hasAccess",{enumerable:!0,get:function(){return y}}),e.accessText=function(t){const r=t.access;return r?[r.wheelchair?`${r.wheelchair} wheelchair user${1===r.wheelchair?'':'s'}`:'',r.stepFree?'step-free access':'',r.toilet?'accessible toilet':'',r.assistDog?'assistance dog':'',r.note?.trim()??''].filter(Boolean).join(', '):''},Object.defineProperty(e,"dietText",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"accessibleSetUp",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"dogSetUp",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"isAccessible",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"isDogOk",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"dogsAt",{enumerable:!0,get:function(){return P}}),e.tableBlockReason=function(t,n,o,i,s){const a=t.tables.find(t=>t.name===n);return a?a.maxSeats0&&O(t)&&!(0,r.tableDogOk)(t,a)?'No dogs here':s&&h(t)&&!a.accessible?'Not step-free':'':'Not available'},Object.defineProperty(e,"holidayName",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"coverDone",{enumerable:!0,get:function(){return A}}),e.shownStatus=S,e.coversToday=function(t,r){const o=t.filter(t=>t.date===r&&n(t)),i=o.filter(A),s=o.filter(t=>!A(t)&&['confirmed','pending','seated'].includes(S(t))),a=t=>t.reduce((t,r)=>t+r.partySize,0);return{done:a(i),toCome:a(s),total:a(i)+a(s)}};var t=_r(_d[0]),r=_r(_d[1]);const n=t=>!['cancelled','noshow'].includes(t.status),o=[{id:'seafood-platter-2',name:'Seafood Platter for 2',price:16e3,description:'Whole crab and lobster with all the trimmings, for two to share.',uses:[{key:'crab',qty:1},{key:'lobster',qty:1}],active:!0}],i=t=>(t?.settings.reservables??('anchorage'===t?.id?o:[])).filter(t=>t.active);function s(t,r,n=!1){const o={};for(const i of t.holds??[])if(!i.served||n)if('stock'===i.kind)o[i.id]=(o[i.id]??0)+i.qty;else for(const t of r.find(t=>t.id===i.id)?.uses??[])o[t.key]=(o[t.key]??0)+t.qty*i.qty;return o}function a(t,r,o,i){const a={};for(const c of t)if(c.date===r&&n(c)&&'finished'!==c.status&&c.id!==i)for(const[t,r]of Object.entries(s(c,o)))a[t]=(a[t]??0)+r;return a}const c=t=>/platter/i.test(t)?'Platter':t.replace(/ for \d+$/i,''),l=t=>n(t)&&(t.allergies.length>0||!!t.allergyNote?.trim())&&!t.allergyAck,d=t=>n(t)&&(t.holds??[]).some(t=>t.qty>0&&!t.served)&&!t.holdOk,f=t=>t.allergies.length>0||!!t.allergyNote?.trim(),u=r=>[r.allergies.map(r=>(0,t.allergenLabel)(r.allergen)).join(', '),r.allergyNote?.trim()].filter(Boolean).join(' \xb7 ')+(r.allergyPeople?` (${r.allergyPeople} ${1===r.allergyPeople?'person':'people'})`:''),b=t=>t.dogs??(t.dog?1:0),y=t=>!(!t.access||!(t.access.wheelchair||t.access.stepFree||t.access.toilet||t.access.assistDog||t.access.note?.trim()));const p=t=>[t.diet?.vegan?`${t.diet.vegan} vegan`:'',t.diet?.vegetarian?`${t.diet.vegetarian} vegetarian`:''].filter(Boolean).join(', '),h=t=>t.tables.some(t=>t.accessible),O=t=>t.tables.some(t=>void 0!==t.dogOk)||t.areas.some(t=>t.dogs),v=(t,r)=>r.split('+').every(r=>!!t.tables.find(t=>t.name===r.trim())?.accessible),j=(t,n)=>n.split('+').every(n=>{const o=t.tables.find(t=>t.name===n.trim());return!!o&&(0,r.tableDogOk)(t,o)}),P=(t,r,o,i)=>t.filter(t=>t.id!==i&&t.date===r&&t.time===o&&n(t)).reduce((t,r)=>t+b(r),0);const k=t=>t.replace(/\s*\(substitute day\)/gi,'').trim(),A=t=>'finished'===t.status;function S(t){if('seated'===t.status&&t.seatedAt){const r=new Date(t.seatedAt);if((isNaN(r.getTime())?t.date:r.toLocaleDateString('en-CA',{timeZone:'Europe/London'})){const l=n[e.id],c=u.find(l=>l.allergen===e.id),f='contains'===l?t.colours.redBg:'may'===l?t.colours.amberBg:t.colours.surface2,h='contains'===l?'#FFD9D4':'may'===l?'#FFE2A8':t.colours.muted;return(0,d.jsxs)(s.default,{style:{width:'48%',flexGrow:1,backgroundColor:f,borderRadius:8,padding:8,borderWidth:c?2:1,borderColor:c?t.colours.red:t.colours.border},children:[(0,d.jsx)(o.T,{size:14,weight:"medium",colour:l?h:t.colours.text,children:e.label}),(0,d.jsxs)(o.T,{size:13,colour:h,children:['contains'===l?'Contains':'may'===l?'May contain':'Not listed',c?` \xb7 YOUR ALLERGY (${(0,a.severityLabel)(c.severity)})`:'']})]},e.id)})}),e.allergenNotes?(0,d.jsxs)(o.Muted,{children:["Notes: ",e.allergenNotes]}):null,(0,d.jsx)(s.default,{testID:"allergen-signoff",children:(0,d.jsx)(o.Muted,{children:e.signOff?`From the dish's recipe card. Signed off by ${e.signOff.by} on ${c(e.signOff.at)}.`:"Awaiting the head chef's allergen sign-off: not available to order online."})}),(0,d.jsx)(o.Muted,{children:"Always tell staff about allergies when you order or arrive."})]})},_e.AllergenChips=function({map:e,declared:l}){const n=Object.entries(e);return n.length?(0,d.jsx)(o.Row,{wrap:!0,gap:5,children:n.sort((e,l)=>e[1]===l[1]?0:'contains'===e[1]?-1:1).map(([e,n])=>{const s=l.some(l=>l.allergen===e);return(0,d.jsx)(o.Badge,{label:`${s?'\u26a0 ':''}${(0,a.allergenLabel)(e)}${'may'===n?' (may)':''}`,kind:s?'contains'===n?'red':'amber':'neutral'},e)})}):(0,d.jsx)(o.Muted,{children:"No listed allergens"})},r(_d[0]);var e,l=r(_d[1]),n=r(_d[2]),s=(e=n)&&e.__esModule?e:{default:e},a=r(_d[3]),t=r(_d[4]),o=r(_d[5]),d=r(_d[6]);const c=e=>{const l=new Date(`${e.slice(0,10)}T12:00:00`);return isNaN(+l)?e:l.toLocaleDateString('en-GB',{day:'numeric',month:'long',year:'numeric'})}},829,[30,1032,127,814,821,813,24]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BasketButton=function(){const s=(0,l.useBasket)().lines.reduce((e,s)=>e+s.qty,0);return s?(0,c.jsx)(o.default,{accessibilityRole:"button",accessibilityLabel:`Basket, ${s} items`,onPress:()=>e.router.push('/customer/basket'),style:{backgroundColor:u.colours.gold,borderRadius:999,paddingHorizontal:12,paddingVertical:6},children:(0,c.jsxs)(n.T,{weight:"semibold",colour:u.colours.onGold,size:14,children:["Basket \xb7 ",s]})}):null};var e=r(d[0]);r(d[1]);var s,t=r(d[2]),o=(s=t)&&s.__esModule?s:{default:s},l=r(d[3]),u=r(d[4]),n=r(d[5]),c=r(d[6])},830,[804,30,263,819,821,813,24]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.setRecipeCardRepository=function(n){t=n,r.forEach(t=>t())},e.recipeCards=function(){if(!t)throw new Error('Recipe card repository not set up');return t},Object.defineProperty(e,"hasRecipeCards",{enumerable:!0,get:function(){return n}}),e.onRepositorySwap=function(t){return r.add(t),()=>{r.delete(t)}};let t=null;const r=new Set;const n=()=>!!t},831,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Stars=function({value:e,onChange:s,size:n=36}){return(0,c.jsx)(t.Row,{gap:6,children:[1,2,3,4,5].map(u=>(0,c.jsx)(l.default,{disabled:!s,accessibilityRole:"button",accessibilityLabel:`${u} star${u>1?'s':''}`,onPress:()=>s?.(u),hitSlop:4,children:(0,c.jsx)(t.T,{size:n,colour:u<=e?o.colours.gold:'#555',children:"\u2605"})},u))})},r(d[0]);var e,s=r(d[1]),l=(e=s)&&e.__esModule?e:{default:e},o=r(d[2]),t=r(d[3]),c=r(d[4])},832,[30,263,821,813,24]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"LIVE_VENUE_SLUGS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"LIVE_VENUE_BUILD",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"isLiveVenue",{enumerable:!0,get:function(){return n}});var c=r(d[0]);const b=['anchorage','souters','kirkmichael','wildings','kirkton','abbotsford','greenside',"3idiots","cecchinis","mrbasrais","yasmins","williewastles","rupeeroom","smokinggoat","pizzaioli","drunkencoo"],f=b.includes(c.VENUE_RID),n=c=>b.includes(c)||['6349aa07-3fec-46e9-8c69-7b1b08494793','41ce63ca-ae46-432d-a5ba-25e1b801e64d','43c8da91-b8b8-4ce9-9ab7-f00c84c5f4f6','47f86b36-4c99-466a-be9c-30eb3d79f1e1','e0afad1d-cbc1-414a-add6-92e47d302139','24624ea5-d1e3-4182-b0d1-73402b8a1532','1bc2a056-2ef6-4585-abfd-b7d21c84f215',"59766322-119e-4036-a18a-f6909f60a8d2","596c6f7e-9797-4e16-84fe-db4a99fa1bdc","5d500571-e205-4ead-bb58-60e986b6f40e","f43f20ad-55d0-4008-88c8-7738dc1698df","6abc2793-93ab-4e23-a705-b4011a5cc011","78bff97d-5f07-440a-bb99-f6a6118da7a3","cd985ff5-2443-458d-ac8b-342d553628cf","35f870fc-772c-4aad-bb9e-09a9a16bc925","f500ef12-b405-438b-9671-e54289bec5dd"].includes(c)},833,[5]); +__d(function(_g,r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.MockPay=function({visible:e,onClose:j,amount:p,restaurantId:b,allowGiftCard:x=!0,onPaid:f,title:g="Pay"}){const y=(0,o.useGiftCards)(b).filter(e=>e.balance>0),[m,w]=(0,s.useState)(),[P,C]=(0,s.useState)('Test card \u2022\u2022\u2022\u2022 4242'),[T,M]=(0,s.useState)(!1),_=y.find(e=>e.code===m),v=_?Math.min(_.balance,p):0,R=p-v;return(0,h.jsxs)(u.Sheet,{visible:e,onClose:j,title:g,children:[(0,h.jsx)(u.DemoPaymentNotice,{}),x&&y.length>0?(0,h.jsxs)(l.default,{style:{gap:6},children:[(0,h.jsx)(u.T,{weight:"semibold",children:"Use a gift card"}),(0,h.jsxs)(u.Row,{wrap:!0,children:[(0,h.jsx)(u.Chip,{label:"None",selected:!m,onPress:()=>w(void 0)}),y.map(e=>(0,h.jsx)(u.Chip,{label:`${e.code.slice(0,8)}\u2026`,sub:`${(0,n.gbp)(e.balance)} left`,selected:m===e.code,onPress:()=>w(e.code)},e.id))]})]}):null,(0,h.jsx)(u.T,{weight:"semibold",children:"Payment method"}),(0,h.jsx)(u.Row,{wrap:!0,children:['Test card \u2022\u2022\u2022\u2022 4242','Apple Pay (test)','Google Pay (test)'].map(e=>(0,h.jsx)(u.Chip,{label:e,selected:P===e,onPress:()=>C(e)},e))}),(0,h.jsxs)(l.default,{style:{gap:2},children:[(0,h.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(u.Muted,{children:"Amount"}),(0,h.jsx)(u.T,{children:(0,n.gbp)(p)})]}),v?(0,h.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(u.Muted,{children:"Gift card"}),(0,h.jsxs)(u.T,{colour:c.colours.ok,children:["\u2212",(0,n.gbp)(v)]})]}):null,(0,h.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(u.T,{weight:"semibold",children:"To pay now"}),(0,h.jsx)(u.T,{weight:"bold",size:20,colour:c.colours.gold,children:(0,n.gbp)(R)})]})]}),T?(0,h.jsx)(t.default,{color:c.colours.gold}):(0,h.jsx)(u.Button,{label:`Pay ${(0,n.gbp)(R)} \u2014 demo`,onPress:()=>{M(!0),setTimeout(()=>{M(!1),f({giftCardCode:m,giftApplied:v,method:P})},700)},testID:"mock-pay-confirm"})]})};var s=r(d[0]),t=e(r(d[1])),l=e(r(d[2])),o=r(d[3]),n=r(d[4]),c=r(d[5]),u=r(d[6]),h=r(d[7])},834,[30,246,127,819,816,821,813,24]); +__d(function(_g,_r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.GiftLive=function({slug:e,venue:n}){const{info:x,mine:b,err:S,load:w,pay:k}=j(e),[T,P]=(0,t.useState)(null),[D,C]=(0,t.useState)(''),[O,$]=(0,t.useState)(''),[v,B]=(0,t.useState)(''),[I,M]=(0,t.useState)(''),[E,L]=(0,t.useState)(!1),[R,A]=(0,t.useState)(''),[_,H]=(0,t.useState)(null),F=f(e);if(!x)return(0,h.jsx)(a.Screen,{title:"Gift cards",subtitle:n,children:S?(0,h.jsx)(a.Banner,{kind:"warn",title:S}):(0,h.jsx)(a.Muted,{children:"Loading\u2026"})});const N=D?(0,o.poundsToPence)(D)??0:T??x.amounts[1]??x.amounts[0]??0;return(0,h.jsxs)(a.Screen,{title:"Gift cards",subtitle:`${n}: used only at ${n}`,children:[_?(0,h.jsx)(s.default,{testID:"gift-made",children:(0,h.jsx)(a.Card,{highlight:u.colours.gold,children:(0,h.jsxs)(s.default,{style:{gap:6},children:[(0,h.jsx)(a.H2,{children:"Your gift card code"}),(0,h.jsx)(a.T,{size:26,weight:"bold",colour:u.colours.gold,center:!0,children:_.code}),(0,h.jsxs)(a.Muted,{center:!0,children:["Shown once and kept on this phone. Write it down or take a screenshot to give it to ",O||'them',"."]}),(0,h.jsxs)(a.Banner,{kind:"warn",title:`Pay ${(0,l.gbp)(_.pence)} at the bar or till`,children:["Show reference ",_.ref,". The card works once staff mark it paid.",k.cardOn?'':' Card payment in the app is coming soon.']}),(0,h.jsx)(m,{slug:e,kind:"gift",id:_.id,pay:k})]})})}):null,(0,h.jsx)(g,{onDone:w}),(0,h.jsx)(s.default,{testID:"gift-mine",children:(0,h.jsx)(a.Card,{children:(0,h.jsxs)(s.default,{style:{gap:6},children:[(0,h.jsx)(a.H2,{children:"Your gift cards"}),b.cards.length?b.cards.map(t=>(0,h.jsxs)(s.default,{style:{gap:2},children:[(0,h.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(a.T,{style:{flex:1},children:F[t.id]??`\u2022\u2022\u2022\u2022 ${t.last4}`}),(0,h.jsxs)(a.T,{weight:"semibold",colour:u.colours.gold,children:[(0,l.gbp)(t.balancePence)," of ",(0,l.gbp)(t.initialPence)]})]}),(0,h.jsxs)(a.Muted,{size:12,children:[o.STATUS_WORDS[t.status]??t.status,t.expiresAt?` \xb7 use by ${p(t.expiresAt)}`:'','waiting-payment'===t.status?` \xb7 reference ${t.ref}`:'']}),'waiting-payment'===t.status&&_?.id!==t.id?(0,h.jsx)(m,{slug:e,kind:"gift",id:t.id,pay:k}):null]},t.id)):(0,h.jsx)(a.Muted,{children:"None yet."})]})})}),x.giftsOn?(0,h.jsx)(s.default,{testID:"gift-buy",children:(0,h.jsx)(a.Card,{children:(0,h.jsxs)(s.default,{style:{gap:8},children:[(0,h.jsx)(a.H2,{children:"Buy a gift card"}),(0,h.jsx)(a.Row,{wrap:!0,children:x.amounts.map(e=>(0,h.jsx)(a.Chip,{label:(0,l.gbp)(e),selected:!D&&N===e,onPress:()=>{C(''),P(e)}},e))}),(0,h.jsx)(a.Field,{label:`Or another amount (\xa3${x.minPence/100} to \xa3${x.maxPence/100})`,keyboardType:"decimal-pad",value:D,onChangeText:C,placeholder:"e.g. 40",testID:"gift-custom"}),(0,h.jsx)(a.Field,{label:"Who it\u2019s for",value:O,onChangeText:$,testID:"gift-recipient"}),(0,h.jsx)(a.Field,{label:"From",value:v,onChangeText:B}),(0,h.jsx)(a.Field,{label:"Message",value:I,onChangeText:M,multiline:!0,placeholder:"Happy birthday!"}),(0,h.jsxs)(a.Muted,{size:12,children:["Use within ",(0,o.expiryWords)(x.expiryMonths)," of paying. Part-use leaves a balance.",x.terms?` ${x.terms}`:'']}),(0,h.jsx)(s.default,{testID:"gift-pay-placeholder",children:(0,h.jsx)(a.Banner,{kind:"demo",title:"Payment",children:o.PAY_PLACEHOLDER})}),R?(0,h.jsx)(a.Banner,{kind:"warn",title:R}):null,(0,h.jsx)(a.Button,{label:E?'Saving\u2026':`Get a ${(0,l.gbp)(N)} gift card, pay at the till`,testID:"gift-buy-btn",disabled:E||Nx.maxPence,onPress:async()=>{L(!0),A('');try{const t=await(0,c.buyGift)(e,{amount:N,recipient:O,from:v,message:I});t.code&&y(e,t.id,t.code),H({id:t.id,code:t.code??'',ref:t.ref,pence:t.initialPence}),w()}catch(e){A((0,r.plainError)(e))}finally{L(!1)}}})]})})}):(0,h.jsx)(a.Banner,{kind:"demo",title:`${n} isn\u2019t selling gift cards in the app yet`,children:"Ask at the bar."})]})},_e.ShopLive=function({slug:e,venue:n,guestName:p}){const{info:x,mine:f,err:y,load:b,pay:S}=j(e),[w,k]=(0,t.useState)({}),[T,P]=(0,t.useState)(p),[D,C]=(0,t.useState)(!1),[O,$]=(0,t.useState)(''),[v,B]=(0,t.useState)(null);if(!x)return(0,h.jsx)(a.Screen,{title:"Shop",subtitle:n,children:y?(0,h.jsx)(a.Banner,{kind:"warn",title:y}):(0,h.jsx)(a.Muted,{children:"Loading\u2026"})});const I=Object.entries(w).filter(([,e])=>e>0).map(([e,t])=>({id:e,qty:t})),M=(0,o.basketTotal)(I,x.products);return(0,h.jsxs)(a.Screen,{title:"Shop",subtitle:`${n}: collect at the venue`,children:[v?(0,h.jsxs)(s.default,{testID:"shop-done",children:[(0,h.jsxs)(a.Banner,{kind:"warn",title:`Order ${v.ref}: pay ${(0,l.gbp)(v.total)} at the bar or till`,children:["Staff will have it ready to collect once it\u2019s paid.",S.cardOn?'':' Card payment in the app is coming soon.']}),(0,h.jsx)(m,{slug:e,kind:"shop",id:v.id,pay:S})]}):null,(0,h.jsx)(g,{onDone:b}),x.shopOn?(0,h.jsxs)(h.Fragment,{children:[x.products.length?x.products.map(e=>(0,h.jsx)(s.default,{testID:`shop-item-${e.id}`,children:(0,h.jsx)(a.Card,{children:(0,h.jsxs)(s.default,{style:{gap:4},children:[(0,h.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(a.T,{weight:"semibold",style:{flex:1},children:e.name}),(0,h.jsx)(a.T,{colour:u.colours.gold,children:(0,l.gbp)(e.pricePence)})]}),e.details?(0,h.jsx)(a.Muted,{children:e.details}):null,e.soldOut?(0,h.jsx)(a.Badge,{kind:"amber",label:"Sold out"}):(0,h.jsxs)(a.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,h.jsx)(a.Muted,{children:"How many"}),(0,h.jsx)(a.Stepper,{value:w[e.id]??0,min:0,max:20,label:`${e.name} quantity`,onChange:t=>k({...w,[e.id]:t})})]})]})})},e.id)):(0,h.jsx)(a.Muted,{children:"Nothing in the shop yet."}),I.length?(0,h.jsx)(s.default,{testID:"shop-basket",children:(0,h.jsx)(a.Card,{children:(0,h.jsxs)(s.default,{style:{gap:6},children:[(0,h.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(a.T,{weight:"semibold",children:"Total"}),(0,h.jsx)(a.T,{weight:"semibold",colour:u.colours.gold,children:(0,l.gbp)(M)})]}),(0,h.jsx)(a.Field,{label:"Name for collection",value:T,onChangeText:P,testID:"shop-name"}),(0,h.jsx)(a.Banner,{kind:"demo",title:"Payment",children:o.PAY_PLACEHOLDER}),O?(0,h.jsx)(a.Banner,{kind:"warn",title:O}):null,(0,h.jsx)(a.Button,{label:D?'Sending\u2026':'Order, pay at the till',testID:"shop-order-btn",disabled:D||!T.trim(),onPress:async()=>{C(!0),$('');try{const t=await(0,c.shopOrder)(e,I,T);B({id:t.id,ref:t.ref,total:t.totalPence}),k({}),b()}catch(e){$((0,r.plainError)(e))}finally{C(!1)}}})]})})}):null]}):(0,h.jsx)(a.Banner,{kind:"demo",title:`${n}\u2019s shop isn\u2019t open in the app yet`,children:"Ask at the bar."}),f.orders.length?(0,h.jsx)(s.default,{testID:"shop-mine",children:(0,h.jsx)(a.Card,{children:(0,h.jsxs)(s.default,{style:{gap:4},children:[(0,h.jsx)(a.H2,{children:"Your shop orders"}),f.orders.map(e=>(0,h.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsxs)(a.T,{style:{flex:1},children:[e.ref," \xb7 ",e.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')]}),(0,h.jsx)(a.Muted,{children:o.STATUS_WORDS[e.status]??e.status})]},e.ref))]})})}):null]})};var e,t=_r(d[0]),n=_r(d[1]),s=(e=n)&&e.__esModule?e:{default:e},a=_r(d[2]),l=_r(d[3]),r=_r(d[4]),o=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]);const p=e=>{if(!e)return'';try{return new Date(e).toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric',timeZone:'Europe/London'})}catch{return e.slice(0,10)}},x=e=>`cc-gift-codes:${e}:v1`;function f(e){try{return JSON.parse(globalThis.localStorage?.getItem(x(e))||'{}')}catch{return{}}}function y(e,t,n){try{const s=f(e);s[t]=n,globalThis.localStorage?.setItem(x(e),JSON.stringify(s))}catch{}}function j(e){const[n,s]=(0,t.useState)(null),[a,l]=(0,t.useState)({cards:[],orders:[]}),[o,u]=(0,t.useState)(''),[h,p]=(0,t.useState)({provider:'none',cardOn:!1,testMode:!0}),x=(0,t.useCallback)(()=>{u(''),(0,c.shopPublic)(e).then(s).catch(e=>u((0,r.plainError)(e))),(0,c.myShop)(e).then(l).catch(()=>{}),(0,c.payPublic)(e).then(p)},[e]);return(0,t.useEffect)(()=>{x()},[x]),{info:n,mine:a,err:o,load:x,pay:h}}function g({onDone:e}){const[n,l]=(0,t.useState)('');return(0,t.useEffect)(()=>{const t='undefined'!=typeof window?new URLSearchParams(window.location.search).get('paid'):null;if(!t||!/^[0-9a-f-]{36}$/.test(t))return;let n=0;const s=()=>(0,c.payStatus)(t).then(t=>{l(t.status),'paid'===t.status?e():n++<10&&setTimeout(s,2e3)}).catch(()=>{});s()},[e]),n?(0,h.jsx)(s.default,{testID:"pay-back",children:(0,h.jsx)(a.Banner,{kind:'paid'===n?'success':'warn',title:'paid'===n?'Paid by card (TEST MODE: no real money)':'expired'===n?'The card payment timed out. Pay at the bar or till.':'Checking the card payment\u2026'})}):null}function m({slug:e,kind:n,id:l,pay:o}){const[u,p]=(0,t.useState)(!1),[x,f]=(0,t.useState)('');return o.cardOn?(0,h.jsxs)(s.default,{testID:`pay-card-${n}`,style:{gap:4},children:[(0,h.jsx)(a.Button,{label:u?'Opening card payment\u2026':'Pay by card (TEST MODE)',kind:"secondary",disabled:u,onPress:async()=>{p(!0),f('');try{const t=await(0,c.payStart)(e,n,l);window.location.assign(t.url)}catch(e){f((0,r.plainError)(e))}finally{p(!1)}}}),(0,h.jsx)(a.Muted,{size:12,children:"Test mode: use a Stripe test card. No real money is taken."}),x?(0,h.jsx)(a.Banner,{kind:"warn",title:x}):null]}):null}},835,[30,127,813,816,1014,1015,1016,821,24]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"guestServer",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"staffServer",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"useGuestLoyalty",{enumerable:!0,get:function(){return _}}),e.refreshGuest=async function(t){if(!c())return;_.setState(n=>({loading:{...n.loading,[t]:!0}}));try{const n=await(0,o.rpc)('loyalty_public',{p_venue_slug:t});if(_.setState(r=>({info:{...r.info,[t]:n}})),await(0,o.guestSession)()){const n=await(0,o.rpc)('loyalty_my_card',{p_venue_slug:t});_.setState(r=>({card:{...r.card,[t]:n??null}}))}}finally{_.setState(n=>({loading:{...n.loading,[t]:!1}}))}},e.guestJoin=async function(t,n){if(!await(0,o.guestSession)())throw new Error('No connection. Try again when you are back online.');const r=await(0,o.rpc)('loyalty_guest_join',{p_venue_slug:t,p_name:n.name.trim(),p_phone:n.phone.trim()||null,p_email:n.email.trim()||null,p_consent:n.consent,p_consent_text:n.consentText,p_referral:n.referral?(0,l.cleanCode)(n.referral):null});return p(t,r),r},e.guestClaim=async function(t,n){if(!await(0,o.guestSession)())return{ok:!1,error:'No connection. Try again when you are back online.'};const r=await(0,o.rpc)('loyalty_guest_claim',{p_venue_slug:t,p_code:(0,l.cleanCode)(n)});return r?.error?{ok:!1,error:String(r.error)}:(p(t,r),{ok:!0,card:r,linked:!!r.linked})},e.guestLinkCode=async function(t){return(0,o.rpc)('loyalty_guest_link_code',{p_venue_slug:t})},e.guestLeave=async function(t){await(0,o.rpc)('loyalty_guest_leave',{p_venue_slug:t}),p(t,null)},Object.defineProperty(e,"staffFind",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"staffCard",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"staffStamp",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"staffRedeem",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"staffJoin",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"staffCode",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"staffRemove",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"loyaltySummary",{enumerable:!0,get:function(){return P}}),e.readSettings=async function(){const{data:t,error:n}=await u().from('loyalty_settings').select('*').eq('venue_id',y()).maybeSingle();if(n)throw n;return(0,l.settingsFromRow)(t)},e.saveSettings=async function(t){const{error:n}=await u().from('loyalty_settings').upsert({venue_id:y(),...(0,l.settingsToRow)(t),updated_by:(o.useSync.getState().staffRef??'').slice(0,80)||'manager',updated_at:(new Date).toISOString()},{onConflict:'venue_id'});if(n)throw n},e.readOffers=k,e.saveOffer=C,e.watchLoyalty=function(t){if(!f())return()=>{};const n=y();let r=u().channel(`cc-loyalty:${n}:${Math.random().toString(36).slice(2,8)}`);for(const o of['loyalty_settings','loyalty_offers','loyalty_guests','loyalty_stamps','loyalty_rewards','loyalty_referrals'])r=r.on('postgres_changes',{event:'*',schema:'public',table:o,filter:`venue_id=eq.${n}`},()=>t());return r.subscribe(),()=>{try{u().removeChannel(r)}catch{}}},e.migrateLocalOnce=async function(t,n,r){if(!f())return 0;const o=`loyalty:migrated:${y()}`;if(await n(o))return 0;let s=0;if(!(await k()).length)for(const n of t.offers.filter(t=>'offer'===t.kind&&!JSON.stringify(t).includes('(example)')))await C({title:n.title.slice(0,80),details:(n.body??'').slice(0,500),startsOn:null,endsOn:n.until??null,isOn:!!n.live}),s++;return await r(o),s};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]),o=_r(d[3]),s=_r(d[4]),l=_r(d[5]);const u=()=>(0,n.getSupabase)(),c=()=>(0,r.isSupabaseConfigured)()&&!s.PITCH,f=()=>c()&&'staff'===o.useSync.getState().kind&&!!o.useSync.getState().venueId,y=()=>{const t=o.useSync.getState().venueId;if(!t)throw new Error('Not connected to the venue yet.');return t},_=(0,t.create)(()=>({info:{},card:{},loading:{}}));const p=(t,n)=>_.setState(r=>({card:{...r.card,[t]:n}}));const b=t=>(0,o.rpc)('loyalty_staff_find',{p_venue:y(),p_q:t}),w=t=>(0,o.rpc)('loyalty_staff_card',{p_guest:t}),v=t=>(0,o.rpc)('loyalty_staff_stamp',{p_guest:t}),S=t=>(0,o.rpc)('loyalty_staff_redeem',{p_reward:t}),O=t=>(0,o.rpc)('loyalty_staff_join',{p_venue:y(),p_name:t.name.trim(),p_phone:t.phone.trim()||null,p_email:t.email.trim()||null,p_consent:t.consent,p_consent_text:t.consentText}),h=(t,n)=>(0,o.rpc)('loyalty_staff_code',{p_venue:y(),p_kind:t,p_guest:n??null}),j=t=>(0,o.rpc)('loyalty_staff_remove',{p_guest:t}),P=()=>(0,o.rpc)('loyalty_summary',{p_venue:y()});async function k(){const{data:t,error:n}=await u().from('loyalty_offers').select('*').eq('venue_id',y()).order('created_at');if(n)throw n;return(t??[]).map(l.offerFromRow)}async function C(t){const n={venue_id:y(),title:t.title.trim(),details:t.details.trim(),starts_on:t.startsOn||null,ends_on:t.endsOn||null,is_on:t.isOn,updated_at:(new Date).toISOString()},{error:r}=t.id?await u().from('loyalty_offers').update(n).eq('id',t.id):await u().from('loyalty_offers').insert(n);if(r)throw r}},836,[952,863,1096,820,2,1014]); +__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.SoutersCustomerHome=function(){const[e,n]=(0,t.useState)(!1),[p,m]=(0,t.useState)(!1),[b,y]=(0,t.useState)('All'),S=(0,h.useMenu)('souters'),M=(0,t.useMemo)(()=>['All',...Array.from(new Set(S.map(e=>e.section)))],[S]),k=S.filter(e=>'All'===b||e.section===b);if(e)return(0,j.jsx)(u.Screen,{title:"Souter's Inn",back:!1,children:(0,j.jsx)(c.VenueRequestForm,{rid:"souters",kind:"table",onClose:()=>n(!1)})});if(p)return(0,j.jsxs)(u.Screen,{title:"Menu",subtitle:"Souter's Inn",back:!1,children:[(0,j.jsx)(u.Button,{kind:"ghost",label:"\u2039 Back",onPress:()=>m(!1)}),(0,j.jsxs)(u.Muted,{children:[x.SOUTERS_MENU_COUNT," dishes. Please speak to staff about allergens \u2014 nothing is signed off for ordering yet."]}),(0,j.jsx)(u.Row,{wrap:!0,gap:6,children:M.slice(0,12).map(e=>(0,j.jsx)(u.Chip,{label:e,selected:b===e,onPress:()=>y(e)},e))}),k.map(e=>(0,j.jsx)(o.default,{testID:`souters-dish-${e.id}`,children:(0,j.jsxs)(u.Card,{children:[(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,j.jsx)(u.T,{weight:"semibold",style:{flex:1},children:e.name}),(0,j.jsx)(u.T,{children:null==e.price?e.priceNote||'Ask staff':(0,f.gbp)(e.price)})]}),e.description?(0,j.jsx)(u.Muted,{children:e.description}):null,(0,j.jsx)(u.Muted,{children:"Awaiting allergen sign-off \xb7 not orderable yet"})]})},e.id))]});return(0,j.jsxs)(u.Screen,{title:"Souter's Inn",subtitle:"Kirkoswald \xb7 Southern Ayr",children:[(0,j.jsx)(l.RestaurantHero,{rid:"souters",size:160}),(0,j.jsx)(s.FindPub,{rid:"souters"}),(0,j.jsx)(u.Card,{children:(0,j.jsxs)(o.default,{testID:"souters-book-table",style:{gap:8},children:[(0,j.jsx)(u.T,{weight:"bold",children:"Book a table"}),(0,j.jsx)(u.Muted,{children:"Send a request to the venue. No deposit and no payment here \u2014 staff will confirm."}),(0,j.jsx)(u.Button,{label:"Book a table",onPress:()=>n(!0)})]})}),(0,j.jsx)(u.Card,{children:(0,j.jsxs)(o.default,{testID:"souters-menu-card",style:{gap:8},children:[(0,j.jsx)(u.T,{weight:"bold",children:"Menu"}),(0,j.jsxs)(u.Muted,{children:[x.SOUTERS_MENU_COUNT," dishes from the venue menus. Allergen information is not signed off yet \u2014 please speak to staff about allergens. Ordering stays off until the Head Chef signs each dish off."]}),(0,j.jsx)(u.Button,{kind:"secondary",label:"Browse the menu",onPress:()=>m(!0)})]})}),(0,j.jsx)(u.Muted,{children:"Table deposits are not set. Closing time (9pm or 10pm) to confirm. No payment is taken here."})]})},_e.SoutersStaffHome=function({app:e}){return(0,j.jsxs)(o.default,{testID:"souters-setup-home",style:{flex:1,padding:24,justifyContent:'center',gap:16,maxWidth:680,width:'100%',alignSelf:'center'},children:[(0,j.jsx)(l.RestaurantHero,{rid:"souters",size:180}),(0,j.jsx)(u.T,{size:24,weight:"bold",center:!0,children:e}),(0,j.jsxs)(u.Card,{children:[(0,j.jsx)(u.T,{weight:"bold",children:"Ready for venue setup"}),(0,j.jsx)(u.Muted,{children:"Contact: souters@southernayr.com \xb7 01655 760653. No named manager or staff list yet \u2014 no personal links have been created."})]}),(0,j.jsx)(u.Muted,{center:!0,children:"Areas are set (Restaurant, Bar, Mezzanine, Beer garden, Ice cream & cake corner). Table plan to confirm \u2014 no sample tables. Menu seeded without allergen sign-off."}),(0,j.jsx)(u.Muted,{center:!0,children:"Guests request a table in the Customer app. Proposed closing time to confirm."})]})};var e,s=r(d[0]),t=r(d[1]),n=r(d[2]),o=(e=n)&&e.__esModule?e:{default:e},l=r(d[3]),u=r(d[4]),c=r(d[5]),h=r(d[6]),f=r(d[7]),x=r(d[8]),j=r(d[9])},854,[862,30,127,861,813,864,819,816,1135,24]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"LAUNCHER_LINE",{enumerable:!0,get:function(){return u}}),_e.LauncherLine=function(){return(0,c.jsx)(l.default,{style:{borderTopWidth:1,borderColor:n.colours.border,paddingTop:10,marginTop:4},children:(0,c.jsx)(s.Muted,{center:!0,children:u})})},_e.HubTile=function({icon:e,label:u,sub:h,onPress:p,badge:f}){return(0,c.jsxs)(o.default,{accessibilityRole:"button",accessibilityLabel:u,onPress:p,style:({pressed:e})=>({flexBasis:'30%',flexGrow:1,maxWidth:'31.5%',minWidth:96,backgroundColor:e?'#1d1a14':n.colours.surface,borderRadius:14,borderWidth:1,borderColor:n.colours.border,padding:10,gap:2,alignItems:'center'}),children:[b.includes(e)?(0,c.jsx)(t.Icon,{name:e,size:24,colour:n.colours.gold}):(0,c.jsx)(s.T,{size:22,children:e}),(0,c.jsx)(s.T,{size:13,weight:"semibold",center:!0,children:u}),h?(0,c.jsx)(s.T,{size:11,colour:n.colours.muted,center:!0,children:h}):null,f?(0,c.jsx)(l.default,{style:{position:'absolute',top:6,right:6,backgroundColor:n.colours.gold,borderRadius:8,paddingHorizontal:5},children:(0,c.jsx)(s.T,{size:10,weight:"bold",colour:n.colours.onGold,children:f})}):null]})},r(d[0]);var o=e(r(d[1])),l=e(r(d[2])),s=r(d[3]),n=r(d[4]),t=r(d[5]),c=r(d[6]);const u='Card payments: not set up yet';const b=['bag','phone','box','calendarPlus','clock','star','userPlus','gift','alert','tag','sparkle','chat','hanger']},855,[30,263,127,813,821,1006,24]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"attStatus",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"isConfirmed",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"timesheetRemote",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"weekdayOf",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"addDays",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"mondayOfDate",{enumerable:!0,get:function(){return I}}),Object.defineProperty(_e,"shiftsOn",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"shiftOf",{enumerable:!0,get:function(){return E}}),Object.defineProperty(_e,"visibleShifts",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"SUPPLIER_CATS",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"NLW_PENCE",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"MAX_CUSTOM_LINKS",{enumerable:!0,get:function(){return R}}),Object.defineProperty(_e,"WIX_IDS",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"isWixLink",{enumerable:!0,get:function(){return L}}),Object.defineProperty(_e,"DEFAULT_QUICK_LINKS",{enumerable:!0,get:function(){return T}}),_e.openShiftOf=$,_e.loggedBreakMins=D,Object.defineProperty(_e,"isOnBreak",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"DISPLAY_CLOCK_DEFAULT",{enumerable:!0,get:function(){return N}}),Object.defineProperty(_e,"useOwner",{enumerable:!0,get:function(){return V}}),Object.defineProperty(_e,"wageLabel",{enumerable:!0,get:function(){return q}}),Object.defineProperty(_e,"ROLE_LABEL",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"CAN",{enumerable:!0,get:function(){return K}}),_e.staffLabel=function(e){const t=e.nickname?.trim(),n=e.name.replace(/\s*\(([^)]*)\)\s*$/,(e,n)=>t&&n.trim().toLowerCase()===t.toLowerCase()?'':e);return t?`${n} (${t})`:n},Object.defineProperty(_e,"staffCalls",{enumerable:!0,get:function(){return W}}),Object.defineProperty(_e,"staffCalled",{enumerable:!0,get:function(){return F}}),Object.defineProperty(_e,"staffMatches",{enumerable:!0,get:function(){return G}});var e,t=_r(_d[0]),n=_r(_d[1]),a=_r(_d[2]),i=_r(_d[3]),s=_r(_d[4]),r=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),c=(e=d)&&e.__esModule?e:{default:e},u=_r(_d[8]),f=_r(_d[9]),l=_r(_d[10]),p=_r(_d[11]);const m=e=>e.out?e.signOff?'confirmed':'awaiting':'open',g=e=>!!e.out&&!!e.signOff,h={send:null},b=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`,k=e=>{const[t,n,a]=e.split('-').map(Number);return(new Date(t,n-1,a).getDay()+6)%7},y=(e,t)=>{const[n,a,i]=e.split('-').map(Number);return b(new Date(n,a-1,i+t))},I=e=>y(e,-k(e)),w=(e,t)=>e.filter(e=>e.date===t),E=(e,t,n)=>e.find(e=>e.staffId===t&&e.date===n),S=(e,t)=>t?e:e.filter(e=>e.published),O=['Fish & seafood','Meat','Fruit & veg','Dairy','Dry goods','Drinks/brewery','Cleaning','Packaging','Equipment/maintenance'],v=1271,R=6,_=['ql-wix-view','ql-wix-edit'],L=e=>_.includes(e.id)||'Website bookings'===e.group,T=[{id:'ql-gmail',label:'Work email (Gmail)',url:'',icon:'\u2709\ufe0f',kind:'gmail',staff:!1,builtIn:!0},{id:'ql-wix-view',label:'View site',url:'https://www.anchoragedunure.com',icon:'\ud83c\udf10',kind:'link',group:'Website bookings',staff:!1,builtIn:!0},{id:'ql-wix-edit',label:'Edit site',url:'https://manage.wix.com',icon:'\ud83d\udd8a\ufe0f',kind:'link',group:'Website bookings',staff:!1,builtIn:!0}];function $(e,t,n){const a=new Date(n).getTime();return e.filter(e=>e.staffId===t&&e.in&&!e.out&&a-new Date(e.in).getTime()<72e6).sort((e,t)=>t.in.localeCompare(e.in))[0]}function D(e,t=new Date){const n=new Date(t).getTime();return Math.round((e.breaks??[]).reduce((e,t)=>e+Math.max(0,(t.end?new Date(t.end).getTime():n)-new Date(t.start).getTime()),0)/6e4)}const P=e=>!!e?.breaks?.some(e=>!e.end),A=e=>`${e}-${Math.random().toString(36).slice(2,8)}`,M=['#2A3B4C','#4A3A22','#40362A','#3E2A2A','#2E2E40'];function j(){return l.ROSTER.map(e=>({id:e.id,name:e.name,...e.nickname?{nickname:e.nickname}:{},role:e.role,job:e.job,active:!0,level:e.level,dept:e.dept,salaried:e.salaried,noTax:e.noTax,...N.includes(e.id)?{displayClock:!0}:{}}))}const N=['st-jack'];function C(){return Object.fromEntries(l.ROSTER.filter(e=>null!=e.hourlyPence).map(e=>[e.id,e.hourlyPence]))}const U=()=>{const e={tronc:{method:'hours',points:{FOH:1,Bar:1,Kitchen:.8,KP:.6,Manager:1},includeManagers:!0,includeOwner:!1,custom:{},text:'The Anchorage tipping policy (template)\n\n1. 100% of tips paid by card and cash tips put in the tip jar go to staff. Nothing is deducted.\n2. Tips are pooled and shared by paid hours worked in each pay period (breaks excluded).\n3. The owner does not take a share. Managers share only for hours worked on the floor or in the kitchen.\n4. Tips are paid with wages, no later than the end of the month after the tip was paid.\n5. Tip records are kept for 3 years. Ask a manager for your records at any time.'},troncCash:{},troncHistory:[],troncLog:[],chat:[],chatMuted:{},referral:{giverReward:'Free dessert',friendReward:'\xa35 off first order',active:!0},referrals:[],reminders:{h24:!0,h2:!0,confirmText:!0},coats:[],merch:[],merchOrders:[],marketingDraft:void 0,socialAccounts:{facebook:!0,instagram:!0,tiktok:!0,youtube:!0},socialPosts:[],socialDraft:void 0,quickLinks:T.map(e=>({...e})),workEmail:'',staff:j(),rosterVersion:l.ROSTER_VERSION,previewRole:'owner',staffAs:l.ROSTER.find(e=>'staff'===e.app)?.id??l.ROSTER[0]?.id??'',offers:[],photos:[],changeRequests:[],changesUsed:2,site:t.VENUE_RID,branding:{},checks:{},lost:[],lostReports:[],campaigns:[],shifts:[],rotaPublished:void 0,leave:[],swaps:[],availability:{},attendance:[],attLog:[],timeRequests:[],geofence:{lat:55.4047,lng:-4.7606,radius:100},simLocation:'venue',consent:{},hourly:C(),payPeriod:'weekly',suppliers:[],supplierOrders:[],staffCanViewSuppliers:!1,readNotes:{},customerTags:{'cust-demo':['Allergy','Regular'],'cr-2':['VIP'],'cr-5':['Takeaway']}};if(s.LIVE_VENUE_BUILD&&!t.IS_ISOLATED_VENUE)return{...e,changesUsed:0,customerTags:{},socialAccounts:{facebook:!1,instagram:!1,tiktok:!1,youtube:!1},referral:{...e.referral,active:!1}};if(!t.IS_ISOLATED_VENUE)return e;for(const t of Object.keys(e))Array.isArray(e[t])&&(e[t]=[]);return{...e,site:t.VENUE_RID,staffAs:'',hourly:{},customerTags:{},geofence:{lat:0,lng:0,radius:100},tronc:{...e.tronc,text:t.IS_QUEUED_VENUE?n.queuedVenues[t.VENUE_RID].name+' tipping policy \u2014 to confirm.':t.IS_ABBOTSFORD?'The Abbotsford Hotel tipping policy \u2014 awaiting venue confirmation.':t.IS_KIRKTON?'The Kirkton Inn tipping policy \u2014 awaiting venue confirmation.':t.IS_GREENSIDE?'The Greenside Restaurant tipping policy \u2014 awaiting venue confirmation.':t.IS_WILDINGS?'Wildings Hotel & Restaurant tipping policy \u2014 awaiting venue confirmation.':t.IS_KIRKMICHAEL?"The Kirkmichael Arms tipping policy \u2014 awaiting venue confirmation.":"Souter's Inn tipping policy \u2014 awaiting venue confirmation."},changesUsed:0,socialAccounts:{facebook:!1,instagram:!1,tiktok:!1,youtube:!1},referral:{...e.referral,active:!1},quickLinks:t.IS_QUEUED_VENUE||t.IS_ABBOTSFORD||t.IS_KIRKTON?[]:t.IS_GREENSIDE?[{id:'greenside-phone',label:'Call 01655 889685',url:'tel:01655889685',icon:'',kind:'link',group:'Bookings',staff:!0,builtIn:!0}]:t.IS_WILDINGS?[{id:'wildings-phone',label:'Call to book',url:'tel:01655331401',icon:'\ud83c\udf10',kind:'link',group:'Bookings',staff:!0,builtIn:!0},{id:'wildings-email',label:'Email to book',url:'mailto:bookings@wildingsrestaurant-hotel.co.uk',icon:'\ud83c\udf10',kind:'link',group:'Bookings',staff:!0,builtIn:!0}]:t.IS_KIRKMICHAEL?[{id:'kirkmichael-site',label:'Venue website',url:'https://www.kirkmichaelarms.co.uk/',icon:'\ud83c\udf10',kind:'link',group:'Website',staff:!0,builtIn:!0}]:[{id:'souters-book',label:'Guest table requests',url:'https://covercharge-apps.static.hf.space/souters/customer-app/',icon:'\ud83c\udf10',kind:'link',group:'Bookings',staff:!0,builtIn:!0}],branding:{[t.VENUE_RID]:{accent:t.IS_QUEUED_VENUE?n.queuedVenues[t.VENUE_RID].branding.accent:t.IS_ABBOTSFORD?'#B89362':t.IS_KIRKTON?'#B46C54':t.IS_GREENSIDE?a.GREENSIDE_PALETTE.gold:t.IS_WILDINGS?'#FFE3A5':t.IS_KIRKMICHAEL?'#B87754':'#A4622E'}}}},V=(0,u.create)()((0,f.persist)((e,n)=>({...U(),setPreviewRole:t=>e({previewRole:t}),addStaff:(t,n,a)=>e(e=>({staff:[...e.staff,{id:A('st'),name:t,role:n,job:a,active:!0,level:x[n]}]})),saveSupplier:t=>e(e=>({suppliers:e.suppliers.some(e=>e.id===t.id)?e.suppliers.map(e=>e.id===t.id?t:e):[...e.suppliers,t]})),setRate:(t,n)=>e(e=>({hourly:{...e.hourly,[t]:Math.max(0,Math.round(n))}})),clearRate:t=>e(e=>{const n={...e.hourly};return delete n[t],{hourly:n}}),updateStaff:(t,n)=>e(e=>({staff:e.staff.map(e=>e.id===t?{...e,...n}:e)})),addOffer:t=>e(e=>({offers:[{...t,id:A('of')},...e.offers]})),updateOffer:(t,n)=>e(e=>({offers:e.offers.map(e=>e.id===t?{...e,...n}:e)})),addPhoto:t=>e(e=>({photos:[...e.photos,{id:A('ph'),caption:t,tone:M[e.photos.length%M.length]}]})),removePhoto:t=>e(e=>({photos:e.photos.filter(e=>e.id!==t)})),requestChange:(t,n)=>e(e=>e.changesUsed>=5?e:{changesUsed:e.changesUsed+1,changeRequests:[{id:A('cr'),text:t,at:n,status:'requested'},...e.changeRequests]}),setSite:n=>e({site:t.IS_ISOLATED_VENUE?t.VENUE_RID:n}),setBranding:(t,n)=>e(e=>{const a={...e.branding};return n?a[t]={...a[t],...n}:delete a[t],{branding:a}}),setOwner:t=>e(t),addSocialPost:t=>e(e=>({socialPosts:[{...t,id:A('sp')},...e.socialPosts]})),setSocialPost:(t,n)=>e(e=>({socialPosts:e.socialPosts.map(e=>e.id===t?{...e,...n}:e)})),chatSend:t=>e(e=>({chat:[...e.chat,{...t,id:(0,p.uuid)(),reactions:{},seenBy:t.seenBy??('system'===t.from?[]:[t.from])}]})),chatReact:(t,n,a)=>e(e=>({chat:e.chat.map(e=>{if(e.id!==t)return e;const i=e.reactions[n]??[];return{...e,reactions:{...e.reactions,[n]:i.includes(a)?i.filter(e=>e!==a):[...i,a]}}})})),chatSeen:(t,n)=>e(e=>e.chat.some(e=>e.ch===t&&!e.seenBy.includes(n))?{chat:e.chat.map(e=>e.ch!==t||e.seenBy.includes(n)?e:{...e,seenBy:[...e.seenBy,n]})}:e),chatPatch:(t,n)=>e(e=>({chat:e.chat.map(e=>e.id===t?{...e,...n}:e)})),chatMute:(t,n)=>e(e=>{const a=e.chatMuted[t]??[];return{chatMuted:{...e.chatMuted,[t]:a.includes(n)?a.filter(e=>e!==n):[...a,n]}}}),sys:(t,n,a)=>e(e=>({chat:[...e.chat,{id:A('m'),ch:t,from:'system',text:n,at:a,reactions:{},seenBy:[]}]})),tick:(t,n,a,i)=>e(e=>({checks:{...e.checks,[t]:{by:n,at:a,value:i}}})),untick:t=>e(e=>{const n={...e.checks};return delete n[t],{checks:n}}),addLost:t=>e(e=>({lost:[{...t,id:A('lp'),status:'held'},...e.lost]})),setLost:(t,n)=>e(e=>({lost:e.lost.map(e=>e.id===t?{...e,...n}:e)})),addCampaign:t=>e(e=>({campaigns:[{...t,id:A('cp')},...e.campaigns]})),setCampaign:(t,n)=>e(e=>({campaigns:e.campaigns.map(e=>e.id===t?{...e,...n}:e)})),setShifts:t=>e({shifts:t.map(e=>e.date?{...e,day:k(e.date)}:e)}),addShift:t=>e(e=>({shifts:[...e.shifts,{...t,day:k(t.date),published:!1,id:(0,p.uuid)()}]})),copyWeek:(t,a)=>{const i=n(),s=new Set(i.staff.filter(e=>e.active).map(e=>e.id)),r=[];for(let e=0;e<7;e++){const n=y(t,e),o=y(a,e);i.shifts.filter(e=>e.date===n&&s.has(e.staffId)&&!i.shifts.some(t=>t.staffId===e.staffId&&t.date===o)&&!r.some(t=>t.staffId===e.staffId&&t.date===o)).forEach(e=>r.push({id:(0,p.uuid)(),staffId:e.staffId,date:o,day:k(o),start:e.start,end:e.end,note:e.note,published:!1}))}return r.length&&e({shifts:[...i.shifts,...r]}),r.length},publishWeek:t=>{const n=y(t,6);let a=0;return e(e=>({shifts:e.shifts.map(e=>e.daten||e.published&&!e.changed?e:(a++,{...e,published:!0,changed:!1})),rotaPublished:(new Date).toISOString()})),a},removeShift:t=>e(e=>({shifts:e.shifts.filter(e=>e.id!==t)})),markRead:t=>e(e=>({readNotes:{...e.readNotes,...Object.fromEntries(t.map(e=>[e,!0]))}})),toggleTag:(t,n)=>e(e=>{const a=e.customerTags[t]??[];return{customerTags:{...e.customerTags,[t]:a.includes(n)?a.filter(e=>e!==n):[...a,n]}}}),publishRota:t=>e({rotaPublished:t}),addLeave:t=>e(e=>({leave:[{...t,id:A('lv'),status:'pending'},...e.leave]})),setLeave:(t,n)=>e(e=>({leave:e.leave.map(e=>e.id===t?{...e,status:n}:e)})),addSwap:t=>e(e=>({swaps:[{...t,id:A('sw'),status:'open'},...e.swaps]})),setSwap:(t,n)=>e(e=>{const a=e.swaps.find(e=>e.id===t);return{shifts:'approved'===n&&a?.toId?e.shifts.map(e=>e.id===a.shiftId?{...e,staffId:a.toId}:e):e.shifts,swaps:e.swaps.map(e=>e.id===t?{...e,status:n}:e)}}),toggleAvail:(t,n)=>e(e=>{const a=e.availability[t]??[];return{availability:{...e.availability,[t]:a.includes(n)?a.filter(e=>e!==n):[...a,n]}}}),clock:(t,n,a,i,s,r)=>e(e=>{const o=e.attendance.filter(e=>e.staffId===t&&e.in&&!e.out&&new Date(i).getTime()-new Date(e.in).getTime()<72e6).sort((e,t)=>t.in.localeCompare(e.in))[0];if('in'===a)return o?e:{attendance:[...e.attendance,{id:(0,p.uuid)(),staffId:t,date:n,in:i,inSite:s}]};const d=e=>e?.map(e=>e.end?e:{...e,end:i});return o?{attendance:e.attendance.map(e=>e.id===o.id?{...e,out:i,outSite:s,breakMins:r??D({...e,breaks:d(e.breaks)}),breaks:d(e.breaks)}:e)}:e}),adjustClock:(t,n,a,i,s,r)=>e(e=>{const o=e.attendance.find(e=>e.id===t),d=e.staff.find(e=>e.id===o?.staffId),c=o?.[n]?new Date(o[n]).toTimeString().slice(0,5):'none';return{attendance:e.attendance.map(e=>e.id===t?{...e,[n]:a,adjusted:{by:i,at:r,reason:s}}:e),attLog:[{id:A('al'),at:r,text:`${i} changed ${d?.name??'staff'} clock-${n} from ${c} to ${new Date(a).toTimeString().slice(0,5)}: ${s}`},...e.attLog]}}),patchAttendance:(t,n,a)=>e(e=>({attendance:e.attendance.map(e=>e.id===t?{...e,...n,geo:a?[...e.geo??[],a].slice(-20):e.geo}:e)})),breakToggle:(t,a,i)=>{const s=n(),r=$(s.attendance,t,i);if(!r)return!1;const o=r.breaks??[],d=o.some(e=>!e.end);if('start'===a?d:!d)return!1;const c='start'===a?[...o,{start:i}]:o.map(e=>e.end?e:{...e,end:i});return e({attendance:s.attendance.map(e=>e.id===r.id?{...e,breaks:c,breakMins:D({breaks:c})}:e)}),!0},adjustBreak:(t,n,a,i,s)=>e(e=>{const r=e.attendance.find(e=>e.id===t),o=e.staff.find(e=>e.id===r?.staffId);return{attendance:e.attendance.map(e=>e.id===t?{...e,breakMins:n,adjusted:{by:a,at:s,reason:i}}:e),attLog:[{id:A('al'),at:s,text:`${a} changed ${o?.name??'staff'} break from ${r?.breakMins??0}m to ${n}m: ${i}`},...e.attLog]}}),overrideEntry:t=>{const a=n(),i=t.id?a.attendance.find(e=>e.id===t.id):void 0,s=t.reason.trim();if(s.length<3)return null;if(t.out&&t.out<=t.in)return null;const r=e=>e?new Date(e).toTimeString().slice(0,5):'none',o=(e,n,a)=>({at:t.now,by:t.by,byId:t.byId,action:e,from:n,to:a,reason:s}),d=a.staff.find(e=>e.id===t.staffId)?.name??'staff';let c;const u=[];if(i){const e=[...i.audit??[]];if(i.signOff&&(e.push(o('reopened','Confirmed','Awaiting sign-off')),u.push(`${t.by} reopened ${d}'s confirmed ${i.date} entry`)),i.in!==t.in&&(e.push(o('clock_in',r(i.in),r(t.in))),u.push(`${t.by} changed ${d} clock-in from ${r(i.in)} to ${r(t.in)}: ${s}`)),(i.out??'')!==(t.out??'')&&(e.push(o('clock_out',r(i.out),r(t.out))),u.push(`${t.by} changed ${d} clock-out from ${r(i.out)} to ${r(t.out)}: ${s}`)),(i.breakMins??0)!==t.breakMins&&(e.push(o('break',`${i.breakMins??0}m`,`${t.breakMins}m`)),u.push(`${t.by} changed ${d} break from ${i.breakMins??0}m to ${t.breakMins}m: ${s}`)),e.length===(i.audit??[]).length)return i;const n=t.out?i.breaks?.map(e=>e.end?e:{...e,end:t.out}):i.breaks;c={...i,in:t.in,out:t.out,breakMins:t.breakMins,breaks:n,signOff:void 0,adjusted:{by:t.by,at:t.now,reason:s},audit:e}}else c={id:t.id??(0,p.uuid)(),staffId:t.staffId,date:t.date,in:t.in,out:t.out,breakMins:t.breakMins,added:!0,adjusted:{by:t.by,at:t.now,reason:s},audit:[o('added',void 0,`${r(t.in)}\u2013${t.out?r(t.out):'open'}, break ${t.breakMins}m`)]},u.push(`${t.by} added ${d}'s ${t.date} entry ${r(t.in)}\u2013${t.out?r(t.out):'open'} (break ${t.breakMins}m): ${s}`);return t.request&&(c={...c,audit:[...c.audit??[],o('request_applied')]}),h.send?.('attendance_override',c,{reason:s}),e(e=>({attendance:i?e.attendance.map(e=>e.id===i.id?c:e):[...e.attendance,c],attLog:[...u.reverse().map(e=>({id:A('al'),at:t.now,text:e})),...e.attLog]})),c},confirmEntries:(t,a,i,s)=>{const r=n(),o=new Set(t),d=[],c=r.attendance.map(e=>{if(!o.has(e.id)||!e.out||e.signOff)return e;const t={...e,signOff:{by:a,byId:i,at:s},audit:[...e.audit??[],{at:s,by:a,byId:i,action:'confirmed',from:'Awaiting sign-off',to:'Confirmed'}]};return d.push(t),t});return d.length?(d.forEach(e=>h.send?.('attendance_confirm',e)),e({attendance:c,attLog:[{id:A('al'),at:s,text:`${a} confirmed ${d.length} ${1===d.length?'entry':'entries'} (${[...new Set(d.map(e=>e.date))].join(', ')})`},...r.attLog]}),d.length):0},addTimeRequest:t=>e(e=>({timeRequests:[{...t,id:(0,p.uuid)(),status:'open'},...e.timeRequests]})),resolveTimeRequest:(t,a,i,s)=>{const r=n().timeRequests.find(e=>e.id===t);if(!r||'open'!==r.status)return;const o={...r,status:a,resolvedBy:i,resolvedAt:s};h.send?.('time_request_resolve',o),e(e=>({timeRequests:e.timeRequests.map(e=>e.id===t?o:e)}))},setGeofence:t=>e(e=>({geofence:{...e.geofence,...t}})),setSimLocation:t=>e({simLocation:t}),giveConsent:(t,n)=>e(e=>({consent:{...e.consent,[t]:n}})),resetOwner:()=>e(U()),syncRoster:()=>e(e=>{if(t.IS_ISOLATED_VENUE||e.rosterVersion===l.ROSTER_VERSION)return e;const n=new Map(e.staff.map(e=>[e.id,e]));return{staff:[...j().map(e=>({...e,active:n.get(e.id)?.active??!0})),...e.staff.filter(e=>!l.ROSTER.some(t=>t.id===e.id)&&!B.includes(e.id))],hourly:{...e.hourly,...C()},rosterVersion:l.ROSTER_VERSION}})}),{name:'covercharge-owner-v1',version:6,storage:(0,f.createJSONStorage)(()=>c.default),migrate:async(e,t)=>{if(s.LIVE_VENUE_BUILD&&e)return await(0,o.archiveChefCache)('owner',e),{...e,...(0,i.stripOwnerLiveSamples)(e)};if(e&&t<2&&Array.isArray(e.quickLinks)&&(e.quickLinks=e.quickLinks.map(e=>_.includes(e.id)||'Website bookings'===e.group?{...e,staff:!1}:e)),e&&t<3){const t=U();Object.assign(e,{staff:t.staff,hourly:t.hourly,shifts:t.shifts,leave:t.leave,swaps:t.swaps,availability:t.availability,attendance:[],attLog:[],consent:{},chat:[],chatMuted:{},troncHistory:[],staffAs:t.staffAs,previewRole:'owner',rosterVersion:l.ROSTER_VERSION,rotaPublished:void 0})}if(e&&t<4){const t=I(b(new Date));e.shifts=(e.shifts??[]).map(e=>e.date?e:{...e,date:y(t,e.day??0),published:!0}),e.timeRequests=e.timeRequests??[]}return s.LIVE_VENUE_BUILD&&e&&(Object.assign(e,(0,i.stripOwnerLiveSamples)(e)),e.chat=(e.chat||[]).filter(e=>!(0,r.isSeedChefChat)(e)),e.suppliers=(e.suppliers||[]).filter(e=>!/^sup-[1-9]$/.test(e.id)||!/^(Example|Sample)\b/.test(e.name)),e.supplierOrders=(e.supplierOrders||[]).filter(e=>!/\(example\)/i.test(e.by||''))),e}})),q=(e,t,n)=>e?.salaried&&null==t?'Owner, no hourly wage':null==t?'Not set':`${n(t)}/h`,B=['st-2','st-3','st-4','st-5'],x={owner:'Owner',manager:'Manager',staff:'Staff'},K={forecasts:e=>'staff'!==e,manage:e=>'staff'!==e,staffAdmin:e=>'owner'===e,billing:e=>'owner'===e,takings:e=>'staff'!==e,publishSocial:e=>'staff'!==e};const W=e=>[e.name.replace(/\s*\([^)]*\)\s*$/,'').replace(' (example)',''),e.nickname??''].map(e=>e.trim().toLowerCase()).filter(Boolean).flatMap(e=>[e,e.split(' ')[0]]).filter((e,t,n)=>n.indexOf(e)===t),F=(e,t)=>{const n=t.trim().toLowerCase();if(!n)return!1;const a=W(e);return a.includes(n)||a.includes(n.split(' ')[0])},G=(e,t)=>{const n=t.trim().toLowerCase();return!n||[e.name,e.nickname,e.job,e.dept].some(e=>(e??'').toLowerCase().includes(n))}},856,[5,6,1204,1129,833,1024,1132,1116,952,1117,14,1033]); +__d(function(g,r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useSpecials",{enumerable:!0,get:function(){return _}});var e,t=r(_d[0]),s=r(_d[1]),i=r(_d[2]),n=r(_d[3]),o=r(_d[4]),c=(e=o)&&e.__esModule?e:{default:e},l=r(_d[5]),d=r(_d[6]),h=r(_d[7]),u=r(_d[8]),y=r(_d[9]);const p=()=>{try{return(0,u.nowFrom)(u.useStore.getState().clock)}catch{return new Date}};let S=0;const f=()=>`sb-${Date.now().toString(36)}${(S++).toString(36)}`,b=(e,t)=>u.useStore.setState(s=>({audit:[{id:`au-${f()}`,restaurantId:e,at:p().toISOString(),kind:'allergy',text:t},...s.audit].slice(0,300)})),_=(0,l.create)()((0,d.persist)((e,t)=>({...n.IS_ISOLATED_VENUE||s.LIVE_VENUE_BUILD?{current:{},history:[]}:(0,h.seedSpecials)(p()),post:(t,s,i,n)=>{e(e=>(0,h.postBoard)(e,t,s,i,n,p(),f())),s.items.length&&b(t,`Specials board: allergens for ${s.items.length} typed special${1===s.items.length?'':'s'} checked and signed off by ${i}`)},clear:(t,s)=>{e(e=>(0,h.clearBoard)(e,t)),b(t,`Specials board cleared by ${s}`)},reuse:(s,i,n,o)=>{const c=t().history.find(e=>e.id===i);e(e=>(0,h.reuseBoard)(e,s,i,n,o,p(),f())),c?.items.length&&b(s,`Specials board re-used: ${c.items.length} typed special${1===c.items.length?'':'s'}, allergens as previously checked, signed off by ${n}`)},remove:t=>e(e=>(0,h.deleteFromHistory)(e,t))}),{name:'covercharge-specials-v1',storage:(0,d.createJSONStorage)(()=>c.default),version:1,partialize:e=>({current:e.current,history:e.history})})),E=async()=>{if(!(0,y.liveData)())return;const e=_.getState(),n=e=>String(e.id).startsWith('sb-seed')&&(!s.LIVE_VENUE_BUILD||(0,t.demoActor)(e.postedBy)&&(!e.allergenCheck||(0,t.demoActor)(e.allergenCheck.by))&&(!e.photo||e.photo===h.SAMPLE_PHOTO)&&e.items.every(e=>/\(sample\)/i.test(e.name))),o=Object.fromEntries(Object.entries(e.current).filter(([,e])=>!(e&&n(e)))),c=e.history.filter(e=>!n(e));Object.keys(o).length===Object.keys(e.current).length&&c.length===e.history.length||(s.LIVE_VENUE_BUILD&&await(0,i.archiveChefCache)('specials',{current:e.current,history:e.history}),_.setState({current:o,history:c}))};(0,y.onDataModeChange)(E);try{_.persist?.onFinishHydration?.(E)}catch{}E()},857,[1024,833,1132,5,1116,952,1117,858,872,1119]); +__d(function(g,r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SAMPLE_PHOTO",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"HISTORY_MAX",{enumerable:!0,get:function(){return n}}),e.parsePrice=function(t){const n=t.trim().replace(/^\xa3\s*/,'');return n?/^\d{1,3}(\.\d{1,2})?$/.test(n)?Math.round(100*parseFloat(n)):NaN:null},Object.defineProperty(e,"priceText",{enumerable:!0,get:function(){return s}}),e.itemProblems=a,e.draftProblems=i,e.cycleAllergen=function(t,n){const s={...t};s[n]?'contains'===s[n]?s[n]='may':delete s[n]:s[n]='contains';return s},e.postBoard=function(t,n,s,a,l,c,d){const u=i(s);if(u.length)throw new Error(u[0]);const p={id:d,restaurantId:n,photo:s.photo,app:l,postedBy:a,postedAt:c.toISOString(),items:s.items.map(t=>({...t,name:t.name.trim(),description:t.description.trim()})),allergenCheck:s.items.length?{by:a,at:c.toISOString()}:null};return{current:{...t.current,[n]:p},history:o(t.history,t.current[n],n)}},e.clearBoard=function(t,n){return{current:{...t.current,[n]:null},history:o(t.history,t.current[n],n)}},e.reuseBoard=function(t,n,s,a,i,l,c){const d=t.history.find(t=>t.id===s&&t.restaurantId===n);if(!d)return t;const u={...d,id:c,app:i,postedBy:a,postedAt:l.toISOString(),reusedFrom:d.id,allergenCheck:d.items.length?{by:a,at:l.toISOString()}:null},p={...t,history:t.history.filter(t=>t.id!==s)};return{current:{...t.current,[n]:u},history:o(p.history,t.current[n],n)}},e.deleteFromHistory=function(t,n){return{...t,history:t.history.filter(t=>t.id!==n)}},Object.defineProperty(e,"historyFor",{enumerable:!0,get:function(){return l}}),e.whenText=h,Object.defineProperty(e,"isToday",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"freshness",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"lastUpdated",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"boardSummary",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"SAMPLE_ITEMS",{enumerable:!0,get:function(){return k}}),e.seedSpecials=function(n){const s=60*n.getHours()+n.getMinutes()>=702?S(n,0,11,42):new Date(n.getTime()-6e5),a=S(n,1,11,20),i=S(n,3,12,5);return{current:{anchorage:{id:'sb-seed-today',restaurantId:'anchorage',photo:null,items:k,postedAt:s.toISOString(),postedBy:'Head Chef (example)',app:'chef',allergenCheck:{by:'Head Chef (example)',at:s.toISOString()}}},history:[{id:'sb-seed-yday',restaurantId:'anchorage',photo:null,postedAt:a.toISOString(),postedBy:'Duty Manager (example)',app:'managers',allergenCheck:{by:'Duty Manager (example)',at:a.toISOString()},items:[{id:'sp-y1',name:'Pan-fried sea bass, samphire, brown shrimp butter (sample)',description:'Sample dish.',price:2100,allergens:{fish:'contains',crustaceans:'contains',milk:'contains'}},{id:'sp-y2',name:'Smoked haddock fishcake, poached egg (sample)',description:'Sample dish: with wholegrain mustard sauce.',price:1250,allergens:{fish:'contains',eggs:'contains',gluten:'contains',milk:'contains',mustard:'contains'}},{id:'sp-y3',name:'Lemon posset, shortbread (sample)',description:'Sample pudding.',price:750,allergens:{milk:'contains',gluten:'contains'}}]},{id:'sb-seed-photo',restaurantId:'anchorage',photo:t,items:[],postedAt:i.toISOString(),postedBy:'Head Chef (example)',app:'chef',allergenCheck:null}]}};const t='sample:chalkboard',n=8;const s=t=>null===t?'Ask your server':`\xa3${(t/100).toFixed(2)}`;function a(t){const n=[];t.name.trim().length<3&&n.push('Add a dish name'),null!==t.price&&(!Number.isFinite(t.price)||t.price<=0||t.price>5e4)&&n.push('Check the price');const s=Object.keys(t.allergens).length;return s||t.noAllergens||n.push('Choose its allergens, or tick \u201cNone of the 14\u201d'),s&&t.noAllergens&&n.push('Allergens chosen and \u201cNone of the 14\u201d both ticked'),n}function i(t){const n=[];return t.photo||t.items.length||n.push('Add a photo of the board or type at least one special'),t.items.forEach((t,s)=>a(t).forEach(t=>n.push(`Special ${s+1}: ${t}`))),t.items.length&&!t.allergensChecked&&n.push('Confirm you have checked the allergens'),n}const o=(t,s,a)=>{if(!s)return t;return[...[s,...t.filter(t=>t.restaurantId===a&&t.id!==s.id)].slice(0,n),...t.filter(t=>t.restaurantId!==a)]};const l=(t,n)=>t.history.filter(t=>t.restaurantId===n),c=t=>String(t).padStart(2,'0'),d=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],u=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],p=(t,n)=>t.getFullYear()===n.getFullYear()&&t.getMonth()===n.getMonth()&&t.getDate()===n.getDate();function h(t,n){const s=new Date(t),a=`${c(s.getHours())}:${c(s.getMinutes())}`;if(p(s,n))return`today at ${a}`;const i=new Date(n);return i.setDate(i.getDate()-1),p(s,i)?`yesterday at ${a}`:`${d[s.getDay()]} ${s.getDate()} ${u[s.getMonth()]} at ${a}`}const m=(t,n)=>p(new Date(t),n),y=(t,n)=>`Updated ${h(t.postedAt,n)}`,f=(t,n)=>`Last updated ${h(t.postedAt,n)} by ${t.postedBy}`,b=t=>[t.photo?'Photo':'',t.items.length?`${t.items.length} typed special${1===t.items.length?'':'s'}`:''].filter(Boolean).join(' + '),S=(t,n,s,a)=>{const i=new Date(t);return i.setDate(i.getDate()-n),i.setHours(s,a,0,0),i},k=[{id:'sp-hake',name:'Grilled hake, crushed new potatoes, salsa verde (sample)',description:'Sample dish: day-boat hake, lemon and caper salsa verde.',price:1950,allergens:{fish:'contains',mustard:'contains',sulphites:'may'}},{id:'sp-scallops',name:'Half-shell scallops, garlic and herb butter (sample)',description:'Sample dish: three scallops grilled in the shell, crusty bread.',price:1400,allergens:{molluscs:'contains',milk:'contains',gluten:'contains'}},{id:'sp-crab',name:'Crab and chilli linguine (sample)',description:'Sample dish: brown and white crab meat, chilli, parsley, lemon.',price:1850,allergens:{crustaceans:'contains',gluten:'contains',eggs:'contains',molluscs:'may'}},{id:'sp-mussels',name:'Mussels in cider and leek cream (sample)',description:'Sample dish: rope-grown mussels, dry cider, leeks, cream. Main with chips.',price:1300,allergens:{molluscs:'contains',milk:'contains',sulphites:'contains',celery:'may'}}]},858,[]); +__d(function(g,r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"addressWithoutInvite",{enumerable:!0,get:function(){return u.addressWithoutInvite}}),Object.defineProperty(_e,"inviteFromLocation",{enumerable:!0,get:function(){return u.inviteFromLocation}}),Object.defineProperty(_e,"useSession",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"rosterPerson",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"APP_NAME",{enumerable:!0,get:function(){return w}}),_e.sha256Hex=h,_e.inviteFromText=function(e){const t=e.trim(),n=t.match(/[?&#](?:invite|i)=([A-Za-z0-9_-]{10,})/);return n?n[1]:/^[A-Za-z0-9_-]{10,}$/.test(t)?t:null},_e.personForInvite=async function(e){if(a.IS_ISOLATED_VENUE)return;const t=await h(e);return t?l.ROSTER.find(e=>e.tokenHash===t):void 0},Object.defineProperty(_e,"DEVICE_KEY",{enumerable:!0,get:function(){return m}}),_e.deviceId=function(){try{if('undefined'==typeof localStorage)return null;let e=localStorage.getItem(m);if(!e||!/^[A-Za-z0-9_-]{16,64}$/.test(e)){const t=new Uint8Array(18);if(globalThis.crypto?.getRandomValues?.(t),!t.some(e=>e))for(let e=0;ee.toString(16).padStart(2,'0')).join(''),localStorage.setItem(m,e)}return e}catch{return null}},Object.defineProperty(_e,"START_INVITE",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"START_GO",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"START_LOYALTY_CODE",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"START_TABLE_TOKEN",{enumerable:!0,get:function(){return v}}),_e.appUrl=function(e,t){if('undefined'==typeof window||!window.location)return null;const{origin:n,pathname:o}=window.location,i=o.match(/^(.*?\/)(owner|staff|chef|display|customer)-app(\/|$)/),a=i?i[1]:'/';return`${n}${a}${e}-app/index.html${t?`#invite=${encodeURIComponent(t)}`:''}`},_e.levelJob=function(e,t){const n=(e??'').trim(),o=(t??'').trim();return n?!o||o.toLowerCase().startsWith(n.toLowerCase())?o||n:`${n} \xb7 ${o}`:o};var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},o=r(d[1]),i=r(d[2]),a=r(d[3]),c=r(d[4]),l=r(d[5]),u=r(d[6]);const s=(0,o.create)()((0,i.persist)(e=>({meId:null,welcomed:{},signIn:t=>e({meId:t,signedInAt:(new Date).toISOString()}),signOut:()=>e({meId:null,signedInAt:void 0}),markWelcomed:t=>e(e=>({welcomed:{...e.welcomed,[t]:(new Date).toISOString()}}))}),{name:'covercharge-session-v1',storage:(0,i.createJSONStorage)(()=>n.default),version:1})),f=e=>!a.IS_ISOLATED_VENUE&&e?l.ROSTER.find(t=>t.id===e):void 0,w={owner:'CoverCharge for Managers',staff:'CoverCharge for Staff',chef:'CoverCharge for Head Chef'};async function h(e){const t=globalThis.crypto?.subtle;if(!t)return null;const n=await t.digest('SHA-256',(new TextEncoder).encode(e));return Array.from(new Uint8Array(n)).map(e=>e.toString(16).padStart(2,'0')).join('')}const m=(0,a.venueKey)('covercharge-device-id');const p=(()=>{try{if('undefined'==typeof window||!window.location)return null;const e=(0,a.venueKey)(`cc-pending-invite:${c.APP_VARIANT}`);let t=(0,u.inviteFromLocation)(window.location.search,window.location.hash);try{t?localStorage.setItem(e,t):t=localStorage.getItem(e)}catch{}if(t&&!/^[A-Za-z0-9_-]{10,64}$/.test(t)&&(t=null),t&&window.history?.replaceState){const e=()=>{try{/[?&#]invite=/.test(window.location.href)&&window.history.replaceState(window.history.state,'',(0,u.addressWithoutInvite)(window.location.href))}catch{}};e();try{const e=window.history;for(const t of['pushState','replaceState']){const n=e[t].bind(e);e[t]=(e,t,o)=>n(e,t,null==o?o:/[?&#]invite=/.test(String(o))?(0,u.addressWithoutInvite)(new URL(String(o),window.location.href).toString()):o)}}catch{}for(const t of[300,1e3,2500,5e3,1e4,2e4])setTimeout(e,t)}return t}catch{return null}})(),y=(()=>{try{return'undefined'!=typeof window&&window.location?new URLSearchParams(window.location.search).get('go'):null}catch{return null}})(),S=(()=>{try{const e='undefined'!=typeof window&&window.location?new URLSearchParams(window.location.search).get('loyalty'):null;return e&&/^[A-Za-z0-9-]{4,12}$/.test(e)?e.toUpperCase():null}catch{return null}})(),v=(()=>{try{const e='undefined'!=typeof window&&window.location?new URLSearchParams(window.location.search).get('table'):null;return e&&/^[A-Za-z2-9]{16}$/.test(e)?e.toUpperCase():null}catch{return null}})()},859,[1116,952,1117,5,806,14,1150]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.LoyaltyLive=function({slug:e,venue:r}){const{info:t,card:l,loading:i,err:u,load:y}=p(e),[S,v]=(0,n.useState)('');return t?t.cardOn||l?(0,f.jsxs)(o.Screen,{title:"Stamp card",subtitle:`${r}. This card is just for ${r}.`,children:[S?(0,f.jsx)(o.Banner,{kind:"success",title:S}):null,t.cardOn?null:(0,f.jsxs)(o.Banner,{kind:"info",children:[r," has paused the stamp card. Your stamps and rewards are kept."]}),l?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(o.H2,{children:[l.stamps," of ",l.needed," stamps"]}),(0,f.jsxs)(o.T,{colour:h.colours.gold,weight:"semibold",children:["Reward: ",l.reward]})]}),(0,f.jsx)(w,{n:l.stamps,of:l.needed}),(0,f.jsxs)(o.Muted,{children:["Staff add a stamp when you visit. ",t.stampExpiryDays?`Stamps last ${t.stampExpiryDays} days.`:'']})]}),l.rewards.length?(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsx)(o.H2,{children:"Ready to use"}),l.rewards.map(e=>(0,f.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(o.T,{weight:"semibold",style:{flex:1},children:e.title}),(0,f.jsx)(o.Muted,{children:e.expiresAt?`Use by ${x(e.expiresAt)}`:''})]},e.id)),(0,f.jsx)(o.Muted,{children:"Show this screen or your card to staff when you'd like to use a reward. Staff mark it used; each one works once."})]}):null,(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Your card"}),(0,f.jsx)(o.Muted,{children:"Staff scan this, or look you up by name, to add a stamp."}),(0,f.jsx)(s.QR,{value:(0,c.cardQr)(e,l.cardNo),size:170}),(0,f.jsx)(o.T,{center:!0,weight:"semibold",children:l.name}),(0,f.jsx)(o.T,{center:!0,size:20,weight:"bold",colour:h.colours.gold,children:(0,c.prettyCardNo)(l.cardNo)})]}),(0,f.jsx)(b,{slug:e,joined:!0,onDone:v}),t.referralOn?(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Bring a friend"}),(0,f.jsx)(o.T,{children:"Your code"}),(0,f.jsx)(o.T,{size:28,weight:"bold",colour:h.colours.gold,center:!0,children:l.referralCode}),(0,f.jsxs)(o.Muted,{children:["Your friend types it when they join. After their first stamp you get: ",t.referralGiver,". They get: ",t.referralFriend,"."]}),(0,f.jsxs)(o.Muted,{children:["Waiting: ",l.referrals.waiting," \xb7 Rewarded: ",l.referrals.rewarded]})]}):null,(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"History"}),l.history.length?l.history.map((e,n)=>(0,f.jsxs)(o.Muted,{children:[x(e.at)," ",j(e.at)," \xb7 ",e.what]},n)):(0,f.jsx)(o.Muted,{children:"No stamps yet."})]}),(0,f.jsx)(C,{slug:e}),(0,f.jsx)(k,{slug:e})]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsxs)(o.H2,{children:[t.needed," stamps = ",t.reward]}),(0,f.jsx)(w,{n:0,of:t.needed})]}),(0,f.jsx)(T,{slug:e,venue:r,referralOn:t.referralOn,onJoined:e=>v(e.note?`You're in. ${e.note}`:"You're in. Show your card to staff on your next visit.")}),(0,f.jsx)(b,{slug:e,joined:!1,onDone:v})]}),(0,f.jsxs)(o.Muted,{children:["Tip: your card is saved by ",r,", not on this phone, so you won't lose it. Rewards are kept on food, not drinks."]})]}):(0,f.jsxs)(o.Screen,{title:"Stamp card",subtitle:r,children:[(0,f.jsx)(o.Banner,{kind:"info",title:`${r} hasn't started a stamp card yet`,children:"When they do, you can join here."}),(0,f.jsxs)(o.Muted,{children:["Tip: offers from ",r," are under Offers on the home screen."]})]}):(0,f.jsxs)(o.Screen,{title:"Stamp card",subtitle:r,children:[u?(0,f.jsx)(o.Banner,{kind:"warn",title:"Couldn't load the stamp card",children:u}):(0,f.jsx)(o.Muted,{children:i?'Loading your card\u2026':'Loading\u2026'}),u?(0,f.jsx)(o.Button,{kind:"secondary",label:"Try again",onPress:y}):null,(0,f.jsxs)(o.Muted,{children:["Tip: your card is saved by ",r,", so it's the same on any phone once you sign in with a code."]})]})},_e.OffersLive=function({slug:e,venue:n}){const{info:r,err:t,load:s}=p(e);return(0,f.jsxs)(o.Screen,{title:"Offers",subtitle:n,children:[!r&&t?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(o.Banner,{kind:"warn",title:"Couldn't load offers",children:t}),(0,f.jsx)(o.Button,{kind:"secondary",label:"Try again",onPress:s})]}):null,r?r.offers.length?r.offers.map(e=>(0,f.jsxs)(o.Card,{children:[(0,f.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(o.T,{weight:"semibold",style:{flex:1},children:e.title}),(0,f.jsx)(o.Badge,{kind:"gold",label:"Offer"})]}),e.details?(0,f.jsx)(o.Muted,{children:e.details}):null,e.endsOn?(0,f.jsxs)(o.Muted,{children:["Until ",x(e.endsOn+'T12:00:00Z')]}):null]},e.id)):(0,f.jsxs)(o.Muted,{children:["No offers from ",n," right now."]}):t?null:(0,f.jsx)(o.Muted,{children:"Loading\u2026"}),(0,f.jsxs)(o.Muted,{children:["Tip: offers are set by ",n," and shown here only. Nothing is sent to your phone. Drinks promotions follow Scottish licensing rules."]})]})},_e.ReferLive=function({slug:e,venue:n}){const{info:r,card:t}=p(e);return(0,f.jsxs)(o.Screen,{title:"Bring a friend",subtitle:n,children:[r?r.referralOn?(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsxs)(o.H2,{children:["You get: ",r.referralGiver]}),(0,f.jsxs)(o.T,{children:["Your friend gets: ",r.referralFriend]}),(0,f.jsx)(o.Muted,{children:"Your friend joins the stamp card with your code. You both get your reward after their first stamp."}),t?(0,f.jsx)(o.T,{size:30,weight:"bold",colour:h.colours.gold,center:!0,children:t.referralCode}):(0,f.jsx)(o.Banner,{kind:"info",children:"Join the stamp card first to get your code."}),t?(0,f.jsxs)(o.Muted,{children:["Waiting: ",t.referrals.waiting," \xb7 Rewarded: ",t.referrals.rewarded]}):null]}):(0,f.jsxs)(o.Banner,{kind:"info",children:[n," isn't running Bring a friend right now."]}):(0,f.jsx)(o.Muted,{children:"Loading\u2026"}),(0,f.jsxs)(o.Muted,{children:["Tip: tell your friend the code yourself. One reward per friend; it doesn't work on your own card, and ",n," may cap it each month."]})]})},_e.useLiveTile=function(e){const r=(0,u.useGuestLoyalty)(n=>n.info[e]),t=(0,u.useGuestLoyalty)(n=>n.card[e]);return(0,n.useEffect)(()=>{(0,u.refreshGuest)(e).catch(()=>{})},[e]),{stamps:r?t?`${t.stamps} of ${t.needed}`:r.cardOn?'Join':void 0:void 0,offers:r?.offers.length}};var n=_r(d[0]),r=e(n),t=e(_r(d[1])),s=_r(d[2]),o=_r(d[3]),l=_r(d[4]),i=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]),f=_r(d[9]);const x=e=>{try{return new Date(e).toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric',timeZone:'Europe/London'})}catch{return e.slice(0,10)}},j=e=>{try{return new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return''}};let y=!1;function p(e){const t=(0,u.useGuestLoyalty)(n=>n.info[e]),s=(0,u.useGuestLoyalty)(n=>n.card[e]),o=(0,u.useGuestLoyalty)(n=>!!n.loading[e]),[l,i]=(0,n.useState)(''),h=r.default.useCallback(()=>{i(''),(0,u.refreshGuest)(e).catch(e=>i((0,c.plainError)(e)))},[e]);return(0,n.useEffect)(()=>{h();const e=setInterval(h,3e4);return()=>clearInterval(e)},[h]),{info:t,card:s,loading:o,err:l,load:h}}function w({n:e,of:n}){return(0,f.jsx)(t.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:10,justifyContent:'center',paddingVertical:8},children:Array.from({length:n}).map((n,r)=>(0,f.jsx)(t.default,{accessibilityLabel:r!y&&i.START_LOYALTY_CODE?(y=!0,i.START_LOYALTY_CODE):''),[h,x]=(0,n.useState)(!1),[j,p]=(0,n.useState)('');return(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:r?'Got a code from staff?':'Already have a card?'}),(0,f.jsx)(o.Muted,{children:r?'Staff can give you a one-time code for a stamp. Type it here.':'Ask staff for a sign-in code, or make one on your other phone (Stamp card \u203a Use on another phone). Type it here to open your card.'}),(0,f.jsx)(o.Field,{label:"Code",value:s,onChangeText:e=>l(e.toUpperCase()),autoCapitalize:"characters",maxLength:9,placeholder:"e.g. 7KQ2MX",testID:"loyalty-code"}),j?(0,f.jsx)(o.Banner,{kind:"warn",children:j}):null,(0,f.jsx)(o.Button,{label:h?'Checking\u2026':'Use code',disabled:h||s.replace(/[^A-Za-z0-9]/g,'').length<6,onPress:async()=>{x(!0),p('');try{const n=await(0,u.guestClaim)(e,s);n.ok?(l(''),t(n.linked?'This phone now shows your card.':n.card.newReward?`Stamp added. You've earned: ${n.card.rewards[n.card.rewards.length-1]?.title??'a reward'}!`:'Stamp added.')):p(n.error)}catch(e){p((0,c.plainError)(e))}finally{x(!1)}},testID:"loyalty-use-code"})]})}function T({slug:e,venue:r,referralOn:t,onJoined:s}){const i=(0,l.useCustomer)(),[x,j]=(0,n.useState)(i.name??''),[y,p]=(0,n.useState)(i.phone??''),[w,b]=(0,n.useState)(i.email??''),[T,C]=(0,n.useState)(''),[k,S]=(0,n.useState)(!1),[v,L]=(0,n.useState)(!1),[M,B]=(0,n.useState)('');return(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsx)(o.H2,{children:"Join the stamp card"}),(0,f.jsx)(o.Muted,{children:"Only your name is needed. A phone number or email helps staff find your card if you lose this phone. Nothing is sent to you."}),(0,f.jsx)(o.Field,{label:"Your name",value:x,onChangeText:j,maxLength:60,testID:"loyalty-name"}),(0,f.jsx)(o.Field,{label:"Phone (optional)",value:y,onChangeText:p,keyboardType:"phone-pad",maxLength:20}),(0,f.jsx)(o.Field,{label:"Email (optional)",value:w,onChangeText:b,keyboardType:"email-address",autoCapitalize:"none",maxLength:120}),t?(0,f.jsx)(o.Field,{label:"Friend's code (optional)",value:T,onChangeText:e=>C(e.toUpperCase()),autoCapitalize:"characters",maxLength:8}):null,(0,f.jsx)(o.Toggle,{label:(0,c.consentText)(r),value:k,onChange:S,testID:"loyalty-consent"}),M?(0,f.jsx)(o.Banner,{kind:"warn",children:M}):null,(0,f.jsx)(o.Button,{label:v?'Joining\u2026':'Join',disabled:v||!k||!x.trim(),onPress:async()=>{L(!0),B('');try{s(await(0,u.guestJoin)(e,{name:x,phone:y,email:w,consent:k,consentText:(0,c.consentText)(r),referral:T}))}catch(e){B((0,c.plainError)(e))}finally{L(!1)}},testID:"loyalty-join"})]})}function C({slug:e}){const[r,t]=(0,n.useState)(null),[s,l]=(0,n.useState)('');return(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Use on another phone"}),(0,f.jsxs)(o.Muted,{children:["Make a code here, then on the other phone open ","the stamp card"," and type it under \"Already have a card?\". The code works once, for 15 minutes."]}),r?(0,f.jsx)(o.T,{size:30,weight:"bold",colour:h.colours.gold,center:!0,children:r.code}):null,r?(0,f.jsxs)(o.Muted,{center:!0,children:["Works until ",j(r.expiresAt)]}):null,s?(0,f.jsx)(o.Banner,{kind:"warn",children:s}):null,(0,f.jsx)(o.Button,{kind:"secondary",label:r?'Make a new code':'Make a code',onPress:()=>{l(''),(0,u.guestLinkCode)(e).then(t).catch(e=>l((0,c.plainError)(e)))}})]})}function k({slug:e}){const[r,t]=(0,n.useState)(!1),[s,l]=(0,n.useState)('');return(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Leave the stamp card"}),(0,f.jsx)(o.Muted,{children:"Your name, phone and email are removed and your stamps and rewards go. This can't be undone."}),s?(0,f.jsx)(o.Banner,{kind:"warn",children:s}):null,r?(0,f.jsxs)(o.Row,{gap:8,children:[(0,f.jsx)(o.Button,{kind:"danger",label:"Yes, remove me",onPress:()=>(0,u.guestLeave)(e).catch(e=>l((0,c.plainError)(e)))}),(0,f.jsx)(o.Button,{kind:"ghost",label:"Keep my card",onPress:()=>t(!1)})]}):(0,f.jsx)(o.Button,{kind:"ghost",label:"Leave the stamp card",onPress:()=>t(!0)})]})}},860,[30,127,869,813,819,859,1014,836,821,24]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"BUILTIN_LOGOS",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"HERO_LOGOS",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"HEADER_LOGO",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"ACCENTS",{enumerable:!0,get:function(){return z}}),_e.useBrandRid=k,_e.useBrand=L,_e.PoweredBy=O,_e.RestaurantLogo=S,_e.RestaurantHero=function({rid:e,size:o=200,showPlace:r=!0}){const c=L(e),u='wildings'===c.rid||'greenside'===c.rid||'kirkton'===c.rid||'abbotsford'===c.rid||(0,t.isQueuedVenue)(c.rid),b='yasmins'===c.rid?c.logo:u?w[c.rid]:c.custom?c.logo:w[c.rid]??c.logo;return(0,j.jsxs)(l.default,{testID:"restaurant-hero",style:{alignItems:'center',gap:6},children:[b?(0,j.jsx)(s.default,{source:b,accessibilityLabel:`${c.name} logo`,style:{width:o,height:o,borderRadius:!u&&c.custom?o/2:0},resizeMode:"contain"}):(0,j.jsx)(S,{rid:c.rid,size:o}),u?null:(0,j.jsx)(n.Text,{testID:"restaurant-hero-name",style:[{fontFamily:f.fonts.semibold,fontSize:26,lineHeight:34,color:f.colours.text,textAlign:'center'},(0,h.webLine)({lineHeight:34},26)],children:c.name}),r&&c.place?(0,j.jsx)(n.Text,{style:[{fontFamily:f.fonts.regular,fontSize:14,lineHeight:20,color:c.accentText,textAlign:'center'},(0,h.webLine)({lineHeight:20},14)],children:c.place}):null]})},_e.RestaurantBrand=function({rid:e,sub:t,size:o=T,nameSuffix:r}){const s=L(e);return(0,j.jsxs)(l.default,{style:{gap:2,flexShrink:1},children:[(0,j.jsx)(O,{}),(0,j.jsxs)(l.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,j.jsx)(S,{rid:s.rid,size:o}),(0,j.jsxs)(l.default,{style:{flexShrink:1},children:[(0,j.jsxs)(n.Text,{numberOfLines:1,style:[{fontFamily:f.fonts.semibold,fontSize:17,lineHeight:22,color:f.colours.text},(0,h.webLine)({lineHeight:22},17)],children:[s.name,r??'']}),t?(0,j.jsx)(n.Text,{numberOfLines:1,style:[{fontFamily:f.fonts.regular,fontSize:12,lineHeight:16,color:s.accentText},(0,h.webLine)({lineHeight:16},12)],children:t}):null]})]})]})};var t=_r(d[0]),n=_r(d[1]),o=_r(d[2]),r=e(_r(d[3])),s=e(_r(d[4])),l=e(_r(d[5])),c=_r(d[6]),u=_r(d[7]),f=_r(d[8]),h=_r(d[9]),b=_r(d[10]),x=_r(d[11]),y=_r(d[12]),j=_r(d[13]);const p={"3idiots":_r(d[14]),cecchinis:_r(d[15]),mrbasrais:_r(d[16]),yasmins:_r(d[17]),williewastles:_r(d[18]),rupeeroom:_r(d[19]),smokinggoat:_r(d[20]),pizzaioli:_r(d[21]),drunkencoo:_r(d[22]),abbotsford:_r(d[23]),kirkton:_r(d[24]),greenside:_r(d[25]),wildings:_r(d[26]),kirkmichael:_r(d[27]),souters:_r(d[28]),anchorage:_r(d[29]),saltmarsh:_r(d[30]),brae:_r(d[31])},w={"3idiots":_r(d[32]),cecchinis:_r(d[33]),mrbasrais:_r(d[34]),yasmins:_r(d[35]),williewastles:_r(d[36]),rupeeroom:_r(d[37]),smokinggoat:_r(d[38]),pizzaioli:_r(d[39]),drunkencoo:_r(d[40]),abbotsford:_r(d[41]),kirkton:_r(d[42]),greenside:_r(d[43]),wildings:_r(d[44]),kirkmichael:_r(d[45]),souters:_r(d[28]),anchorage:_r(d[46])};x.PITCH&&(delete p.anchorage,delete w.anchorage);const T=48,z=['#CFA45F','#D4AF61','#C9A24A','#E2C489','#F2EDE4','#A88B5A','#B08D57','#D9774B'];function k(e){const t=(0,o.useGlobalSearchParams)(),n=(0,u.useOwner)(e=>e.site),r='string'==typeof t.rid?t.rid:void 0;return b.IS_ISOLATED_VENUE?b.VENUE_RID:e??r??n??b.VENUE_RID}function L(e){const t=k(e),n=(0,c.useStore)(e=>e.restaurants.find(e=>e.id===t)),o=(0,u.useOwner)(e=>e.branding[t]),s=o?.logoUri?{uri:o.logoUri}:p[t],l=o?.accent??f.colours.gold,h=r.default.useMemo(()=>(0,y.checkAccent)(l,f.colours.bg,f.colours.onGold,f.colours.text),[l]);return{rid:t,name:n?.name??'Restaurant',place:n?.location??'',logo:s,accent:l,accentText:h.accentText,onAccent:h.onAccent,custom:!!o?.logoUri}}function O({size:e=10}){return(0,j.jsxs)(n.Text,{accessibilityLabel:"powered by CoverCharge",style:[{fontFamily:f.fonts.regular,fontSize:e,lineHeight:Math.round(1.35*e),color:f.colours.muted},(0,h.webLine)({lineHeight:Math.round(1.35*e)},e)],children:["powered by ",(0,j.jsx)(n.Text,{style:{fontFamily:f.fonts.semibold,color:f.colours.text},children:"Cover"}),(0,j.jsx)(n.Text,{style:{fontFamily:f.fonts.semibold,color:f.colours.gold},children:"Charge"})]})}function S({rid:e,size:t=T}){const o=L(e);if(o.logo)return(0,j.jsx)(s.default,{source:o.logo,accessibilityLabel:`${o.name} logo`,style:{width:t,height:t,borderRadius:o.custom?t/2:0},resizeMode:"contain"});const r=o.name.replace(/^The /,'').split(/\s+/).map(e=>e[0]).join('').slice(0,2).toUpperCase();return(0,j.jsx)(l.default,{accessibilityLabel:`${o.name} logo`,style:{width:t,height:t,borderRadius:t/2,borderWidth:2,borderColor:o.accentText,alignItems:'center',justifyContent:'center'},children:(0,j.jsx)(n.Text,{style:{fontFamily:f.fonts.bold,color:o.accentText,fontSize:.36*t},children:r})})}},861,[6,877,804,30,196,127,819,856,821,1238,5,2,1237,24,1241,1242,1243,1244,1245,1246,1247,1248,1249,1250,1251,1252,1253,1254,1255,1256,1257,1258,1259,1260,1261,1262,1263,1264,1265,1266,1267,1268,1269,1270,1271,1272,1273]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.FindPub=function({rid:e}){const p=(0,l.pubLocation)(e),[b,y]=(0,n.useState)(!1),[f,x]=(0,n.useState)(!1),[j,w]=(0,n.useState)(null),[I,v]=(0,n.useState)(null);if(!p)return null;const D=async()=>{y(!1),x(!0),v(null);const e=await(0,u.getFix)();x(!1),'object'==typeof e?(w(Math.round((0,c.distanceM)(p,e))),v(null)):(w(null),v('Your location was not shared. You can still use the address and open directions.'))};return(0,h.jsx)(o.Card,{children:(0,h.jsxs)(t.default,{testID:"find-pub",style:{gap:10},children:[(0,h.jsx)(o.T,{accessibilityRole:"header",weight:"bold",children:"Find us"}),(0,h.jsx)(o.T,{children:p.address}),(0,h.jsx)(o.Muted,{children:"See your approximate distance, or open directions. Location is optional and is never saved."}),(0,h.jsx)(o.Button,{testID:"find-pub-distance",label:f?'Finding your distance\u2026':'Find us \u2014 show my distance',accessibilityLabel:`Find ${p.name}, show my distance using my location once`,disabled:f,onPress:()=>y(!0)}),(0,h.jsxs)(t.default,{accessibilityLiveRegion:"polite",testID:"find-pub-result",children:[null!=j?(0,h.jsxs)(o.T,{children:["About ",j<1e3?`${j} m`:`${(j/1e3).toFixed(1)} km`," away, in a straight line."]}):null,I?(0,h.jsx)(o.T,{children:I}):null]}),(0,h.jsx)(o.Button,{testID:"find-pub-directions",kind:"secondary",label:"Open directions in Maps",accessibilityLabel:`Open directions to ${p.name}, ${p.address}, without sharing my location with CoverCharge`,onPress:()=>{s.default.openURL(`https://www.google.com/maps/dir/?api=1&destination=${encodeURIComponent(p.address)}`)}}),(0,h.jsx)(o.Sheet,{visible:b,onClose:()=>y(!1),title:"Use your location for distance?",testID:"find-pub-reason",children:(0,h.jsxs)(t.default,{style:{gap:12},children:[(0,h.jsxs)(o.T,{children:["We use your phone\u2019s location once to estimate how far you are from ",p.name,". Your position stays on this screen only: it is not stored or sent to the pub."]}),(0,h.jsx)(o.T,{children:"You can refuse location and still see the address and use directions."}),(0,h.jsx)(o.Button,{testID:"find-pub-allow",label:"Use my location once",onPress:()=>{D()}}),(0,h.jsx)(o.Button,{testID:"find-pub-cancel",kind:"secondary",label:"Not now \u2014 keep the address",onPress:()=>y(!1)})]})})]})})};var n=r(d[0]),s=e(r(d[1])),t=e(r(d[2])),o=r(d[3]),l=r(d[4]),c=r(d[5]),u=r(d[6]),h=r(d[7])},862,[30,239,127,813,988,954,1274,24]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.getSupabase=function(){if(_)return _;if(!(0,u.isSupabaseConfigured)())throw new Error('Supabase is not configured: set EXPO_PUBLIC_SUPABASE_URL and EXPO_PUBLIC_SUPABASE_ANON_KEY in .env.local');return _=(0,s.createClient)(u.SUPABASE_URL,u.SUPABASE_ANON_KEY,{auth:{storage:n.default,persistSession:!0,autoRefreshToken:!0,detectSessionInUrl:!1,storageKey:`${(0,o.syncNamespace)()}auth`},realtime:{params:{eventsPerSecond:10}}}),_},_e.setSupabaseClient=function(e){_=e};var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},s=r(d[1]),u=r(d[2]),o=r(d[3]);let _=null},863,[1116,1154,1096,1196]); +__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.VenueRequestForm=function({rid:e,kind:l,hotel:c,allDayHours:j,sessionHours:q,onClose:T}){const[D,f]=(0,o.useState)({name:'',phone:'',email:'',notes:'',date:(0,p.localDate)(),service:(0,t.isQueuedVenue)(e)||'greenside'===e?void 0:'Lunch',time:j||'greenside'===e?'10:00':'12:00',covers:2,checkIn:(0,p.localDate)(),checkOut:'',roomType:c?.roomTypes[0]?.id,guests:2,addDinner:!1}),v=e=>f(t=>({...t,...e})),[C,I]=(0,o.useState)(''),[S,w]=(0,o.useState)(''),[B,P]=(0,o.useState)(null),[R,Y]=(0,o.useState)(''),[M,N]=(0,o.useState)(!1),[$,V]=(0,o.useState)(!1),z=(0,o.useRef)(!1);(0,o.useEffect)(()=>{let s=!0;return(0,b.requestChallenge)(e,l).then(e=>{s&&P(e)}).catch(n=>{s&&Y((0,t.isQueuedVenue)(e)||['greenside','kirkton'].includes(e)?(0,b.requestMessage)(n).replace(/the hotel/g,'the restaurant'):(0,b.requestMessage)(n))}),()=>{s=!1}},[e,l]);const L=async()=>{if(z.current)return;const o=(0,t.isQueuedVenue)(e)?(0,s.queuedRequestError)(e,D,q):j&&'table'===l?(0,r.allDayRequestError)(D,j):(0,n.errorForVenue)(e,l,D,c);if(o)Y(o);else if(B&&C.trim()){z.current=!0,V(!0),Y('');try{await(0,b.sendVenueRequest)(e,l,D,B.id,C,S),N(!0)}catch(s){Y((0,t.isQueuedVenue)(e)||['greenside','kirkton'].includes(e)?(0,b.requestMessage)(s).replace(/the hotel/g,'the restaurant'):(0,b.requestMessage)(s))}finally{z.current=!1,V(!1)}}else Y('Complete the security check.')},F={minHeight:48,fontSize:18,color:y.colours.text};return(0,x.jsxs)(u.default,{testID:`venue-${l}-form`,style:{gap:16,alignItems:'stretch'},children:[(0,x.jsx)(h.H2,{children:'table'===l?'Book a table':'Book a room'}),(0,x.jsx)(h.T,{size:18,center:!0,children:'greenside'===e?'No payment is taken for this request. Deposit terms to confirm. This is a request, not an instant confirmation.':'No deposit. No payment. This is a request, not an instant confirmation.'}),M?(0,x.jsx)(h.Banner,{kind:"info",title:'greenside'===e?'Request sent. A Greenside manager must confirm your table.':c?.enabled?'Request sent. The hotel will contact you to confirm.':'Request sent. The venue will contact you to confirm.',children:"Nothing has been charged. No email or text is sent by this app."}):(0,x.jsxs)(x.Fragment,{children:['table'===l?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(k,{label:"Date (YYYY-MM-DD)",testID:"request-date",value:D.date,onChangeText:e=>v({date:e}),placeholder:"2026-11-20",style:F}),(0,t.isQueuedVenue)(e)||'greenside'===e||j?null:(0,x.jsx)(h.Row,{wrap:!0,children:['Lunch','Dinner'].map(e=>(0,x.jsx)(h.Button,{testID:`request-service-${e.toLowerCase()}`,label:e+(D.service===e?' \xb7 selected':''),kind:D.service===e?'primary':'secondary',onPress:()=>v({service:e,time:'Lunch'===e?'12:00':'18:00'}),style:{alignSelf:'auto'}},e))}),(0,x.jsx)(h.T,{size:18,weight:"semibold",center:!0,children:"Time within kitchen hours"}),(0,x.jsx)(h.Row,{wrap:!0,children:((0,t.isQueuedVenue)(e)?(0,s.queuedRequestSlots)(e,D.date||'',q):j?(0,r.allDaySlots)(D.date||'',j):(0,n.slotsForVenue)(e,D.date||'',D.service||'Lunch')).map(e=>(0,x.jsx)(h.Button,{testID:`request-time-${e.replace(':','')}`,label:e+(D.time===e?' \xb7 selected':''),kind:D.time===e?'primary':'secondary',onPress:()=>v({time:e}),style:{alignSelf:'auto'}},e))}),(0,x.jsx)(k,{label:"Covers",testID:"request-covers",keyboardType:"number-pad",value:String(D.covers??''),onChangeText:e=>v({covers:Number(e)}),style:F})]}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(h.T,{size:18,center:!0,children:[null==c?.bedrooms?'':`${c.bedrooms} bedrooms. `,c?.priceNote,"."]}),(0,x.jsx)(k,{label:"Check-in date (YYYY-MM-DD)",testID:"request-check-in",value:D.checkIn,onChangeText:e=>v({checkIn:e}),style:F}),(0,x.jsx)(k,{label:"Check-out date (YYYY-MM-DD)",testID:"request-check-out",value:D.checkOut,onChangeText:e=>v({checkOut:e}),style:F}),(0,x.jsx)(h.T,{size:18,weight:"semibold",center:!0,children:"Room type"}),c?.roomTypes.map(e=>(0,x.jsx)(h.Button,{testID:`request-room-${e.id}`,label:`${e.name} \xb7 ${null==e.pricePence?'Price to confirm with the hotel':`${e.from?'from ':''}\xa3${e.pricePence/100}`} \xb7 ${c.breakfast}${D.roomType===e.id?' \xb7 selected':''}`,kind:D.roomType===e.id?'primary':'secondary',onPress:()=>v({roomType:e.id})},e.id)),(0,x.jsx)(k,{label:"Guests",testID:"request-guests",keyboardType:"number-pad",value:String(D.guests??''),onChangeText:e=>v({guests:Number(e)}),style:F}),(0,x.jsx)(h.Button,{testID:"request-add-dinner",label:"Add dinner \xb7 "+(D.addDinner?'Yes':'No'),kind:D.addDinner?'primary':'secondary',onPress:()=>v({addDinner:!D.addDinner})}),(0,x.jsx)(h.T,{size:18,center:!0,children:"The hotel will arrange dinner details with you."})]}),(0,x.jsx)(k,{label:"Name",testID:"request-name",autoComplete:"name",value:D.name,onChangeText:e=>v({name:e}),style:F}),(0,x.jsx)(k,{label:"Phone",testID:"request-phone",keyboardType:"phone-pad",autoComplete:"tel",value:D.phone,onChangeText:e=>v({phone:e}),style:F}),(0,x.jsx)(k,{label:"Email",testID:"request-email",keyboardType:"email-address",autoCapitalize:"none",autoComplete:"email",value:D.email,onChangeText:e=>v({email:e}),style:F}),(0,x.jsx)(k,{label:'table'===l?'Notes (allergies, occasion)':'Notes',testID:"request-notes",multiline:!0,maxLength:2e3,value:D.notes,onChangeText:e=>v({notes:e}),style:F}),(0,x.jsx)(u.default,{style:{display:'none'},accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",children:(0,x.jsx)(k,{label:"Leave this empty",value:S,onChangeText:w})}),B?(0,x.jsx)(k,{label:`Security check: ${B.question} = ?`,testID:"request-answer",keyboardType:"number-pad",value:C,onChangeText:I,style:F}):(0,x.jsx)(h.T,{size:18,center:!0,children:"Preparing security check\u2026"}),R?(0,x.jsx)(h.Banner,{kind:"warn",title:"Please check your request",children:R}):null,(0,x.jsx)(h.Button,{testID:"request-submit",label:$?'Sending request\u2026':'Send request',disabled:$||!B,onPress:()=>{L()}})]}),(0,x.jsx)(h.Button,{kind:"secondary",label:M?'greenside'===e?'Back to the restaurant':c?.enabled?'Back to the hotel':'Back to Customer home':'Back to Customer home',onPress:T})]})};var e,t=_r(d[0]),s=_r(d[1]),n=_r(d[2]),r=_r(d[3]),o=_r(d[4]),l=_r(d[5]),u=(e=l)&&e.__esModule?e:{default:e},c=_r(d[6]),h=_r(d[7]),y=_r(d[8]),p=_r(d[9]),b=_r(d[10]),x=_r(d[11]);function k({label:e,...t}){return(0,x.jsxs)(u.default,{style:{gap:6,alignSelf:'stretch',width:'100%'},children:[(0,x.jsx)(h.T,{size:18,weight:"semibold",center:!0,children:e}),(0,x.jsx)(c.TextInput,{accessibilityLabel:e,placeholderTextColor:y.colours.muted,...t,style:[{minHeight:48,fontSize:18,color:y.colours.text,backgroundColor:y.colours.surface2,borderWidth:1,borderColor:y.colours.border,borderRadius:12,padding:12},t.multiline?{minHeight:96,textAlignVertical:'top'}:null,t.style]})]})}},864,[6,941,1392,1393,30,127,877,813,821,11,1020,24]); +__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"STEP_IDS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"STEP_TITLE",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"TEMPLATE_LABEL",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"DAY_NAMES",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"WEEK_ORDER",{enumerable:!0,get:function(){return u}}),e.cleanQuestionnaire=function(t,s){if(!t||'object'!=typeof t)return null;const o=t,n=o.venue??{},u=l(n.name,80);if(!u)return null;const b={};for(let a=0;a<7;a++){const t=o.hours?.days?.[a],s=Array.isArray(t)?p(t[0]):null,n=Array.isArray(t)?p(t[1]):null;b[a]=s&&n?[s,n]:null}const y=['cafe','bistro','restaurant','custom'].includes(o.tables?.template)?o.tables.template:'custom',f=(a,t)=>'number'==typeof a&&a>=0&&a<=t?Math.round(a):void 0,h=o.features??{};return{version:1,venueId:l(s??o.venueId,60)||'venue',source:'signup-form'===o.source||'from-config'===o.source?o.source:'imported',submittedAt:l(o.submittedAt,10),onboardedAt:l(o.onboardedAt,10),venue:{name:u,tagline:l(n.tagline,120),address:l(n.address,200),phone:l(n.phone,30),email:l(n.email,120),website:l(n.website,120),hasLogo:!!n.hasLogo},hours:{days:b,note:l(o.hours?.note,300)},tables:{template:y,tables:f(o.tables?.tables,300),covers:f(o.tables?.covers,2e3),areas:Array.isArray(o.tables?.areas)?o.tables.areas.map(a=>l(a,40)).filter(Boolean).slice(0,12):void 0},team:Array.isArray(o.team)?o.team.map(a=>({name:l(a?.name,60)??'',role:d.includes(a?.role)?a.role:'staff',job:l(a?.job,60),email:l(a?.email,120),phone:l(a?.phone,30)})).filter(a=>a.name).slice(0,200):[],suppliers:Array.isArray(o.suppliers)?o.suppliers.map(a=>({name:l(a?.name,80)??'',category:l(a?.category,40),phone:l(a?.phone,30),email:l(a?.email,120)})).filter(a=>a.name).slice(0,100):[],pay:o.pay&&'object'==typeof o.pay?(0,a.cleanPay)(o.pay):void 0,accounts:Array.isArray(o.accounts)?o.accounts.map(a=>({provider:l(a?.provider,40)??'',handle:l(a?.handle,120)})).filter(a=>/^[a-z0-9-]+$/.test(a.provider)).slice(0,40):void 0,features:{bookings:c(h.bookings,!0),takeaway:c(h.takeaway,!0),orderAtTable:c(h.orderAtTable,!1),tips:c(h.tips,!0),rota:c(h.rota,!0),games:c(h.games,!0),specials:c(h.specials,!0)},notes:l(o.notes,1e3)}},e.questionnaireFromFacts=function(a,t){const s=a.tables??0,o=0===s?'custom':s<=9?'cafe':s<=16?'bistro':'restaurant';return{version:1,venueId:a.id,source:'from-config',venue:{name:a.name,tagline:a.tagline,address:a.address,phone:a.phone,website:a.website,hasLogo:a.hasLogo},hours:{days:{...a.hours},note:a.hoursNote},tables:{template:a.tables?'custom':o,tables:a.tables,covers:a.covers,areas:a.areas},team:a.team,suppliers:a.suppliers,pay:a.pay,features:{bookings:!0,takeaway:!1!==a.takeaway,orderAtTable:!!a.orderAtTable,tips:!0,rota:!0,games:!1!==a.games,specials:!0},...t}},e.mergeQuestionnaire=function(a,t){if(!t)return a;const s={},o=Object.values(t.hours?.days??{}).some(Boolean);for(let n=0;n<7;n++)s[n]=o?t.hours.days[n]??null:a.hours.days[n]??null;return{...a,...t,venue:{...a.venue,...Object.fromEntries(Object.entries(t.venue).filter(([,a])=>void 0!==a&&''!==a))},hours:{days:s,note:t.hours?.note??a.hours.note},tables:{...a.tables,...Object.fromEntries(Object.entries(t.tables).filter(([,a])=>void 0!==a))},team:t.team.length?t.team:a.team,suppliers:t.suppliers.length?t.suppliers:a.suppliers,pay:t.pay??a.pay,accounts:t.accounts?.length?t.accounts:a.accounts,features:{...a.features,...t.features}}},e.hoursLines=function(a){return u.map(t=>({day:n[t],text:a[t]?`${a[t][0]} to ${a[t][1]}`:'Closed'}))},Object.defineProperty(e,"EXAMPLE_QUESTIONNAIRE",{enumerable:!0,get:function(){return b}});var a=r(_d[0]);const t=['venue','hours','tables','team','suppliers','accounts','pay','features'],s={venue:'Your venue',hours:'Opening hours',tables:'Table plan',team:'Your team',suppliers:'Suppliers',accounts:'Connected accounts',pay:'Pay & tips',features:'Features'},o={cafe:'Small caf\xe9 (about 8 tables)',bistro:'Bistro (about 14 tables)',restaurant:'Restaurant (about 24 tables, 2 areas)',custom:'My own layout'},n=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],u=[1,2,3,4,5,6,0],l=(a,t=200)=>'string'==typeof a?a.trim().slice(0,t):void 0,c=(a,t)=>'boolean'==typeof a?a:t,p=a=>'string'==typeof a&&/^([01]\d|2[0-3]):[0-5]\d$/.test(a)?a:null,d=['owner','manager','staff'];const b={version:1,venueId:'example',source:'signup-form',submittedAt:'2026-10-20',venue:{name:'Example Harbour Caf\xe9',tagline:'Coffee, cakes and crab rolls',address:'1 Example Quay, Exampletown',phone:'01632 960000',email:'hello@example.com',website:'example.com',hasLogo:!1},hours:{days:{0:['10:00','16:00'],1:null,2:['09:00','16:00'],3:['09:00','16:00'],4:['09:00','16:00'],5:['09:00','20:00'],6:['09:00','20:00']},note:'Shorter hours in winter'},tables:{template:'cafe',tables:8,covers:30,areas:['Inside','Terrace']},team:[{name:'Alex Example',role:'owner'},{name:'Sam Example',role:'manager',job:'Front of house manager'},{name:'Jo Example',role:'staff',job:'Barista'}],suppliers:[{name:'Example Dairy',category:'Dairy'},{name:'Example Fish Co',category:'Fish & seafood'}],pay:{tipsFrequency:'fortnightly',tipsAnchorPayday:'2026-11-02',tipsEndsDaysBefore:1,wagePayDay:28,wageCutoffDay:23,weekendRule:'none'},features:{bookings:!0,takeaway:!0,orderAtTable:!1,tips:!0,rota:!0,games:!0,specials:!0}}},865,[1110]); +__d(function(e,a,i,n,r,o,s){r.exports={version:1,venueId:"kirkmichael",source:"from-config",submittedAt:"2026-11-05",onboardedAt:"2026-11-05",venue:{name:"The Kirkmichael Arms",tagline:"Michelin-listed restaurant and bar in Kirkmichael, Ayrshire",address:"3-5 Straiton Road, Kirkmichael, South Ayrshire KA19 7PH",phone:"01655 750 200",email:"enquiries@thekirkmichaelarms.co.uk",website:"https://www.kirkmichaelarms.co.uk/",hasLogo:!0},hours:{days:{0:["13:00","22:30"],1:null,2:null,3:null,4:["13:00","22:30"],5:["13:00","22:30"],6:["13:00","22:30"]},note:"Thu\u2013Sun from 1pm; schema close 22:30. Michelin lists Sunday from 12:30 \u2014 confirm. Closed Mon\u2013Wed."},tables:{template:"restaurant",tables:null,covers:56,areas:["Restaurant","Bar","Private dining (The Room)"],needsConfirmation:!0,note:"56 covers from historical sale listing; private dining about 18. Table count unknown \u2014 ask Gordon/Justin."},team:[{name:"Justin Galea",role:"owner",job:"Chef & Owner",email:"enquiries@thekirkmichaelarms.co.uk",phone:"01655 750 200"}],suppliers:[],accounts:[{provider:"instagram",handle:"@kirkmichaelarms_unfiltered"},{provider:"facebook",handle:"kirkmichaelarms"},{provider:"gmail",handle:"enquiries@thekirkmichaelarms.co.uk"},{provider:"tripadvisor",handle:"The Kirkmichael Arms"},{provider:"google-business",handle:"The Kirkmichael Arms"}],pay:{tipsFrequency:"fortnightly",tipsAnchorPayday:"2026-11-07",tipsEndsDaysBefore:1,wagePayDay:28,wageCutoffDay:23,weekendRule:"none"},features:{bookings:!0,takeaway:!1,orderAtTable:!1,tips:!0,rota:!0,games:!0,specials:!0},notes:"Seed as venue_id kirkmichael (separate tenant). Chef-owner Justin Galea. Brand accent #B87754 (whisky amber); lion emblem + wordmark in branding/. Deposit amount unknown \u2014 leave off until Gordon confirms. Bookings currently via own site /booking (own website booking page noted in research only). Menu from live Sample menus 2026-11-05; specials board changes often. Never blend with other venues' data."}},866,[]); +__d(function(e,n,a,o,s,t,i){s.exports={version:1,venueId:"wildings",source:"from-config",submittedAt:"2026-11-05",venue:{name:"Wildings Hotel & Restaurant",tagline:"Coastal cuisine with character",address:"Maidens Road, Maidens, KA26 9NR",phone:"01655 331 401",email:"bookings@wildingsrestaurant-hotel.co.uk",website:"https://www.wildingshotel.com/",hasLogo:!0},hours:{days:{0:["12:00","21:00"],1:["12:00","21:00"],2:["12:00","21:00"],3:["12:00","21:00"],4:["12:00","21:00"],5:["12:00","21:00"],6:["12:00","21:00"]},note:"Lunch Mon\u2013Sat 12:00\u201314:00, Sun 12:00\u201314:30; dinner daily 18:00\u201321:00 (closed 14:00\u201318:00). Bar hours not published. Sunday lunch end time to confirm."},tables:{template:"restaurant",tables:null,covers:null,areas:["Dining room 1","Dining room 2"],needsConfirmation:!0,note:"Two dining rooms per website; names, tables and covers unknown."},team:[],suppliers:[],accounts:[{provider:"facebook",handle:"profile.php?id=100057663900963"},{provider:"instagram",handle:"@wildingsmaidens"}],pay:{tipsFrequency:"fortnightly",tipsAnchorPayday:"2026-11-07",tipsEndsDaysBefore:1,wagePayDay:28,wageCutoffDay:23,weekendRule:"none"},features:{bookings:!0,takeaway:!1,orderAtTable:!1,tips:!0,rota:!0,games:!0,specials:!0},notes:"Separate tenant, venue id wildings. Accent #FFE3A5 (logo star gold) on ink #272A2F. No demo/local roster. Authorised real team is loaded from this venue\u2019s server; remaining staff list and personal manager contacts are to confirm. Deposit off until confirmed. Bookings are by phone/email today; site is Duda, so no Wix sync. Pay settings are app defaults, to confirm. Never blend with other venues' data.",onboardedAt:"2026-11-05"}},867,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SOUTERS_BG",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"SOUTERS_SURFACE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"SOUTERS_TYPE_SCALE",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"soutersFont",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"soutersSurface",{enumerable:!0,get:function(){return f}}),e.soutersInk=function(o){if(!t.IS_SOUTERS)return o;const c=(0,n.normaliseHex)(o);return c?'#A4622E'===c?'#D9AD8A':(0,n.contrast)(c,u)<4.5?'#FFFFFF':o:o};var t=r(d[0]),n=r(d[1]);const u='#56152A',o='#43122F',c=.88,S=n=>t.IS_SOUTERS?Math.round(n*c*100)/100:n,f=n=>t.IS_SOUTERS?o:n},868,[5,1237]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.QR=function({value:e,size:t=180}){return(0,n.jsx)(o.default,{style:{padding:12,backgroundColor:'#FFFFFF',borderRadius:12,alignSelf:'center',borderWidth:3,borderColor:u.colours.gold},children:(0,n.jsx)(l.default,{value:e,size:t,color:"#0B0B0B",backgroundColor:"#FFFFFF"})})},r(d[0]);var o=e(r(d[1])),l=e(r(d[2])),u=r(d[3]),n=r(d[4])},869,[30,127,1358,821,24]); +__d(function(g,_r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.forecastToday=function(i,u,l,h,f,y){const v=(0,s.examplesAllowed)(),k=(0,a.clampWeeks)(i.settings.forecastMinWeeks),M=v?null:y??(0,a.buildHistory)(i.id,u,l,[],f,k),w=v||!!M?.enough,b=(0,o.hoursFor)(i,f),H=[],O=(0,r.ymd)(f);let S=1;for(const e of h.filter(e=>e.date===O&&(null===e.restaurantId||e.restaurantId===i.id)))H.push(e.title.replace(/\s*\(substitute day\)/gi,'')),!1!==e.busier&&(S*='bank-holiday'===e.kind?1.25:'event'===e.kind?1.15:1.1);if(!b)return{open:!1,hours:[],restOfDay:{covers:0,low:0,high:0,takeaway:0,booked:0},flags:H,suggestions:['Kitchen closed today (per listed hours).'],multiplier:S,example:v,enough:w,minWeeks:k};const I=v?t.EXAMPLE_HISTORY[i.id]??t.EXAMPLE_HISTORY.default:w&&M?M:{covers:{},takeaway:{}},x=f.getDay(),E=c(i,f),C=(0,e.lastFoodOn)(i,O);let N=b.close.getMinutes()>0?b.close.getHours():b.close.getHours()-1;if(C){const[e,t]=C.time.split(':').map(Number);N=Math.min(N,t>0?e:e-1),'kitchen closes'!==C.reason&&H.push(`Last food orders ${C.time} (${C.reason})`)}const $=u.filter(e=>e.restaurantId===i.id&&e.date===O&&['confirmed','seated','finished'].includes(e.status)),_=$.filter(e=>!e.walkIn&&'finished'!==e.status).map(e=>Number(e.time.slice(0,2))),P=Math.min(E[0],b.open.getHours(),..._),T=Math.max(E[1],N,..._),A=[];for(let e=P;e<=T;e++){const t=e>=b.open.getHours()&&e<=N,o=I.covers[x]?.[e]??0,s=I.takeaway[x]?.[e]??0,a=$.filter(t=>!t.walkIn&&'finished'!==t.status&&Number(t.time.slice(0,2))===e).reduce((e,t)=>e+t.partySize,0),n=$.filter(t=>t.walkIn&&['seated','finished'].includes(t.status)&&Number(t.time.slice(0,2))===e).reduce((e,t)=>e+t.partySize,0),u=t?Math.round(o*i.settings.walkInShare*S):0,c=w&&t?Math.max(0,Math.round(o*S*(1-i.settings.walkInShare))-a):0,h=Math.max(n,u)+c,f=a+h,p=l.filter(t=>t.restaurantId===i.id&&'takeaway'===t.type&&'cancelled'!==t.status&&t.slotTime&&new Date(t.slotTime).getHours()===e&&(0,r.ymd)(new Date(t.slotTime))===O).length,y=t?Math.max(p,Math.round(s*S)):p;A.push({hour:e,booked:a,walkIns:h,covers:f,coversLow:w?Math.round(.8*f):f,coversHigh:w?Math.round(1.2*f):f,takeawayPlaced:p,takeaway:y,historicalCovers:o})}const L=p(i,x);if(w&&L){const e=L-A.reduce((e,t)=>e+t.covers,0),t=A.filter(e=>e.hour>=b.open.getHours()&&e.hour<=N);if(e>0&&t.length){const o=t.map(e=>e.historicalCovers),r=n(e,o.reduce((e,t)=>e+t,0)>0?o:t.map(()=>1));t.forEach((e,t)=>{const o=r[t];o&&(e.floorAdded=o,e.walkIns+=o,e.covers+=o,e.coversHigh=Math.max(e.coversHigh,Math.round(1.2*e.covers)))})}const o=A.reduce((e,t)=>e+t.coversLow,0);if(oMath.max(1,e.covers)));t.forEach((t,o)=>{t.coversLow=Math.min(t.covers,t.coversLow+e[o])})}}const R=f.getHours()+(f.getMinutes()>=30?1:0),D=A.filter(e=>e.hour>=R),j=D[0],W=e=>D.reduce((t,o)=>t+e(o),0),F={covers:W(e=>e.covers),low:W(e=>e.coversLow),high:W(e=>e.coversHigh),takeaway:W(e=>e.takeaway),booked:W(e=>e.booked)},G=[],z=i.settings.capacityPerHour,B=D.reduce((e,t)=>!e||t.covers>e.covers?t:e,void 0);B&&B.covers>=.85*z&&G.push(`Dining room near capacity around ${String(B.hour).padStart(2,'0')}:00 (about ${B.covers} of ${z} covers) \u2014 consider pausing or capping takeaway slots then.`);const V=D.find(e=>e.historicalCovers>0&&e.covers>1.1*e.historicalCovers);V&&G.push(`Busier than a usual ${['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'][x]} from ${String(V.hour).padStart(2,'0')}:00 \u2014 consider one more on the floor.`);F.takeaway>=10&&G.push(`About ${F.takeaway} takeaway orders expected \u2014 prep extra haddock and chips.`);w||G.unshift(`Not enough history yet. ${(0,s.notEnoughTip)(k)}`);G.length||G.push('Looks like a normal service \u2014 no action suggested.');return{open:!0,nextHour:j,hours:A,restOfDay:F,flags:H,suggestions:G,multiplier:S,example:v,enough:w,minWeeks:k,minCovers:L??void 0}},_e.spread=n,Object.defineProperty(_e,"ANCHORAGE_FORECAST_HOURS",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"forecastHoursOf",{enumerable:!0,get:function(){return u}}),_e.forecastWindow=c,Object.defineProperty(_e,"ANCHORAGE_MIN_COVERS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"MIN_COVERS_NOTE",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"minCoversOf",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"minCoversOn",{enumerable:!0,get:function(){return p}}),_e.coversRange=function(e,t,o=!0){const r=Math.min(e,t),s=Math.max(e,t),a=r===s?String(r):`${r} to ${s}`;return o?`${a} ${1===s?'cover':'covers'}`:a};var e=_r(d[0]),t=_r(d[1]),o=_r(d[2]),r=_r(d[3]),s=_r(d[4]),a=_r(d[5]);function n(e,t){const o=t.reduce((e,t)=>e+t,0)||1,r=t.map(t=>e*t/o),s=r.map(Math.floor);let a=e-s.reduce((e,t)=>e+t,0);return r.map((e,t)=>[e-Math.floor(e),t]).sort((e,t)=>t[0]-e[0]).forEach(([,e])=>{a>0&&(s[e]++,a--)}),s}const i={0:['12:00','22:00'],1:null,2:null,3:['12:00','22:00'],4:['12:00','22:00'],5:['12:00','22:00'],6:['12:00','22:00']},u=e=>e.settings.forecastHours??('anchorage'===e.id?i:{});function c(e,t){const r=(0,o.hoursFor)(e,t),s=r.close.getMinutes()>0?r.close.getHours():r.close.getHours()-1,a=u(e)[t.getDay()];if(!a)return[r.open.getHours(),s];const[n]=a[0].split(':').map(Number),[i,c]=a[1].split(':').map(Number);return[Math.min(n,r.open.getHours()),Math.max(c>0?i:i-1,s)]}const l={0:50,6:50},h='Gordon, 4 Nov 2026',f=e=>e.settings.minCoversByDay??('anchorage'===e.id?l:{}),p=(e,t)=>{const o=f(e)[t];return o&&o>0?Math.round(o):null}},870,[809,1302,815,818,1119,1303]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.estimateWait=function(t,n,u){const o=Math.max(6,Math.round(n/6*u));return t*o}},871,[]); +__d(function(_g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"uuid",{enumerable:!0,get:function(){return y.uuid}}),_e.nowFrom=S,_e.linesFromBasket=w,Object.defineProperty(_e,"useStore",{enumerable:!0,get:function(){return C}}),Object.defineProperty(_e,"DEMO_CUSTOMER_ID",{enumerable:!0,get:function(){return u.DEMO_CUSTOMER_ID}});var e,t=_r(d[0]),a=_r(d[1]),r=_r(d[2]),n=_r(d[3]),s=_r(d[4]),i=_r(d[5]),o=(e=i)&&e.__esModule?e:{default:e},l=_r(d[6]),c=_r(d[7]),u=_r(d[8]),g=_r(d[9]),m=_r(d[10]),p=_r(d[11]),b=_r(d[12]),f=_r(d[13]),k=_r(d[14]),y=_r(d[15]);const $=(e,t,a)=>e.reduce((e,a)=>a.startsWith(t)?Math.max(e,Number(a.slice(t.length))||0):e,a)+1,I=e=>`${e}-${Math.random().toString(36).slice(2,8)}${Date.now().toString(36).slice(-3)}`;function S(e){return'live'===e.mode?new Date:new Date(e.simStartMs+(Date.now()-e.anchorRealMs))}function h(){const e=(0,u.defaultSimStart)();return{clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()},...(0,u.buildSeed)(e),outbox:[],msgTemplates:{}}}function w(e,t,a){return e.lines.flatMap(e=>{const r=t.find(t=>t.id===e.itemId);if(!r)return[];const n=(0,b.resolveItem)(r),s=(n.optionGroups??[]).flatMap(t=>t.choices.filter(t=>e.choiceIds.includes(t.id))),i=(n.price??0)+s.reduce((e,t)=>e+t.priceDelta,0),o=(0,p.conflictsFor)((0,p.effectiveAllergens)(n,e.choiceIds),a);return[{itemId:n.id,name:n.name,qty:e.qty,unitPrice:i,choices:s.map(e=>e.label),notes:e.notes,contains:o.contains,may:o.may,overridden:!!e.override&&o.contains.every(t=>e.override.allergens.includes(t)),prepMins:n.prepMins}]})}const O=e=>{const t='ABCDEFGHJKLMNPQRSTUVWXYZ23456789',a=()=>Array.from({length:4},()=>t[Math.floor(32*Math.random())]).join('');return`${e}-${a()}-${a()}-${a()}`},C=(0,l.create)()((0,c.persist)((e,t)=>{const a=()=>S(t().clock),r=(t,r,n)=>e(e=>({audit:[{id:I('au'),restaurantId:t,at:a().toISOString(),kind:r,text:n},...e.audit].slice(0,300)})),n=(a,n,s)=>{if(!a||s<=0)return 0;const i=t().giftCards.find(e=>e.code===a&&e.restaurantId===n);if(!i||i.balance<=0)return 0;const o=Math.min(i.balance,s);return e(e=>({giftCards:e.giftCards.map(e=>e.id===i.id?{...e,balance:e.balance-o}:e)})),r(n,'giftcard',`Gift card ${a.slice(0,8)}\u2026 redeemed \xa3${(o/100).toFixed(2)} (balance \xa3${((i.balance-o)/100).toFixed(2)})`),o},s=e=>{const a=t().restaurants.find(t=>t.id===e.restaurantId);a&&e.customerId===t().customer.id&&e.subtotal>=a.settings.stampMinSpend&&t().addStamp(e.restaurantId,e.customerId,'takeaway'===e.type?'Takeaway (auto on collection)':'Table QR bill (auto on payment)')},i=e=>(0,f.templatesFor)(t().msgTemplates[e]),o=a=>{a.length&&(e(e=>({outbox:[...a,...e.outbox].slice(0,300)})),(0,f.deliverQueued)(a.filter(e=>'queued'===e.status),(e,a)=>t().updateOutbox(e,a)))},l=(e,r)=>{const n=t().restaurants.find(e=>e.id===r.restaurantId);n&&o((0,f.composeBooking)(e,r,n,i(n.id),a().toISOString()))},c=e=>{const r=t().restaurants.find(t=>t.id===e.restaurantId);r&&o((0,f.composeOrder)(e,r,i(r.id),a().toISOString()))};return{...h(),resetDemo:()=>e(h()),setClockMode:()=>e({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}}),skipMinutes:()=>{},updateCustomer:t=>e(e=>({customer:{...e.customer,...t}})),setAllergy:(t,a)=>e(e=>{const r=e.customer.allergies.filter(e=>e.allergen!==t);return{customer:{...e.customer,allergies:a?[...r,{allergen:t,severity:a}]:r}}}),startBasket:(t,a,r)=>e(e=>{const n=e.basket.restaurantId===t&&e.basket.mode===a&&e.basket.tableNo===r;return{basket:{restaurantId:t,mode:a,tableNo:r,lines:n?e.basket.lines:[]}}}),addLine:t=>e(e=>({basket:{...e.basket,lines:[...e.basket.lines,{...t,key:I('ln')}]}})),setLineQty:(t,a)=>e(e=>({basket:{...e.basket,lines:a<=0?e.basket.lines.filter(e=>e.key!==t):e.basket.lines.map(e=>e.key===t?{...e,qty:a}:e)}})),overrideLine:(t,r)=>e(e=>({basket:{...e.basket,lines:e.basket.lines.map(e=>e.key===t?{...e,override:{allergens:r,at:a().toISOString()}}:e)}})),clearBasket:()=>e(e=>({basket:{...e.basket,lines:[]}})),placeOrder:({slotTime:s,tip:i,giftCardCode:o,notes:l,paidNow:u,phone:g,email:m})=>{const p=t(),b=p.basket,f=b.restaurantId,k=w(b,p.menu,p.customer.allergies),I=k.reduce((e,t)=>e+t.unitPrice*t.qty,0),S='table'===b.mode,h=$(p.orders.filter(e=>e.restaurantId===f).map(e=>e.ref),S?'Q-':'T-',S?p.counters.table:p.counters.order),O=u?n(o,f,I+i):0,C=I+i,v={id:(0,y.uuid)(),ref:`${S?'Q':'T'}-${h}`,restaurantId:f,customerId:p.customer.id,customerName:p.customer.name,type:b.mode,tableNo:b.tableNo,slotTime:s,lines:k,subtotal:I,tip:i,giftCardApplied:O,giftCardCode:O?o:void 0,total:C,paid:u?C:0,status:'new',createdAt:a().toISOString(),allergies:p.customer.allergies,readiness:{},notes:l,channel:'app',...'takeaway'===b.mode?{phone:g??p.customer.phone,email:m??p.customer.email}:{}};e(e=>({orders:[v,...e.orders],basket:{...e.basket,lines:[]},counters:S?{...e.counters,table:h}:{...e.counters,order:h}}));const A=k.filter(e=>e.overridden);return r(f,'order',`Order ${v.ref} placed (${S?`Table ${b.tableNo}`:'takeaway'})${A.length?` \u2014 ALLERGY OVERRIDE on ${A.map(e=>e.name).join(', ')}`:''}`),v.allergies.length&&r(f,'allergy',`Allergies declared and confirmed by customer on ${v.ref}: ${v.allergies.map(e=>`${e.allergen} (${e.severity})`).join(', ')}`),c(v),v},setOrderStatus:(a,n,i)=>{const o=t().orders.find(e=>e.id===a);o&&((0,k.statusBlock)(o,n,(0,k.linkedBooking)(o,t().bookings))||(e(e=>({orders:e.orders.map(e=>e.id===a?{...e,status:n}:e)})),r(o.restaurantId,'order',`${o.ref} \u2192 ${n}${i?` by ${i}`:''}`),'collected'===n&&'takeaway'===o.type&&s(o)))},ackOrderAllergy:(n,s)=>{const i=t().orders.find(e=>e.id===n);if(!i||!(0,k.canSign)(i,'kitchen',(0,k.linkedBooking)(i,t().bookings)))return;const o={by:s,at:a().toISOString()};e(e=>({orders:e.orders.map(e=>e.id===n?{...e,allergyAck:o,status:'new'===e.status?'acknowledged':e.status}:e)})),r(i.restaurantId,'allergy',`Allergen sign-off 3/5 Kitchen on ${i.ref}: ${s} (chef signed off before cooking)`)},tickOrderAllergy:(n,s,i,o=!0)=>{const l=t().orders.find(e=>e.id===n);if(!l)return;const c={...l.allergyTicks??{}};o?c[s]={by:i,at:a().toISOString()}:delete c[s],e(e=>({orders:e.orders.map(e=>e.id===n?{...e,allergyTicks:c}:e)})),r(l.restaurantId,'allergy',`${l.ref}: kitchen ${o?'confirmed':'unticked'} ${s} (${i})`)},ackReadiness:(n,s,i)=>{const o=t().orders.find(e=>e.id===n);o&&('cook'===s&&(0,k.statusBlock)(o,'preparing',(0,k.linkedBooking)(o,t().bookings))||(e(e=>({orders:e.orders.map(e=>e.id===n?{...e,readiness:{...e.readiness,[s]:{by:i,at:a().toISOString()}},status:'cook'===s&&['new','acknowledged'].includes(e.status)?'preparing':e.status}:e)})),r(o.restaurantId,'order',`${o.ref}: ${'cook'===s?'started cooking':'bagged'} (${i})`)))},handoverCheck:(n,s)=>{const i=t().orders.find(e=>e.id===n);i&&(0,k.canSign)(i,'table',(0,k.linkedBooking)(i,t().bookings))&&(e(e=>({orders:e.orders.map(e=>e.id===n?{...e,handoverCheck:{by:s,at:a().toISOString()}}:e)})),r(i.restaurantId,'allergy',`Allergen sign-off 5/5 Table on ${i.ref}: ${s} (served and checked with the guest; chain complete)`))},signAllergyStep:(n,s,i)=>{const o=t().orders.find(e=>e.id===n);if(!o||!i.trim())return!1;const l=(0,k.linkedBooking)(o,t().bookings);if(!(0,k.canSign)(o,s,l))return!1;if('kitchen'===s)return t().ackOrderAllergy(n,i),!0;if('table'===s)return t().handoverCheck(n,i),!0;const c={by:i,at:a().toISOString()};'booked'===s&&l&&l.allergies.length&&!l.allergyAck?e(e=>({bookings:e.bookings.map(e=>e.id===l.id?{...e,allergyAck:c}:e)})):e(e=>({orders:e.orders.map(e=>e.id===n?{...e,allergyChain:{...e.allergyChain,[s]:c}}:e)}));const u=(0,k.stepInfo)(s);return r(o.restaurantId,'allergy',`Allergen sign-off ${u.n}/5 ${u.label} on ${o.ref}: ${i} (${u.what.toLowerCase()})`),!0},customerSignal:(t,a)=>e(e=>({orders:e.orders.map(e=>e.id===t?{...e,customerSignal:a}:e)})),setSplit:(t,a,r)=>e(e=>({orders:e.orders.map(e=>e.id===t?{...e,tip:r,total:e.subtotal+r,split:{ways:a,paidShares:e.split?.paidShares??0}}:e)})),payTable:(a,{shares:i,giftCardCode:o})=>{const l=t().orders.find(e=>e.id===a);if(!l)return;const c=l.split?.ways??1,u=Math.ceil(l.total/c),g=Math.min(c,(l.split?.paidShares??0)+i),m=g>=c,p=m?l.total-l.paid:Math.min(l.total-l.paid,u*i),b=n(o,l.restaurantId,p),f={...l,giftCardApplied:l.giftCardApplied+b,giftCardCode:b?o:l.giftCardCode,paid:l.paid+p,split:{ways:c,paidShares:g},status:m?'closed':l.status};e(e=>({orders:e.orders.map(e=>e.id===a?f:e)})),r(l.restaurantId,'order',`${l.ref} (Table ${l.tableNo}) ${m?'bill paid in full':`share ${g}/${c} paid`} (paid at the till)`),m&&s(f)},createBooking:n=>{const s=$(t().bookings.filter(e=>e.restaurantId===n.restaurantId).map(e=>e.ref),'BK-',t().counters.booking),i=t().restaurants.find(e=>e.id===n.restaurantId)?.settings,o='online'===n.source&&!!i&&(n.partySize>(i.autoAcceptUpTo??7)||!!i.reviewRequests&&!!n.notes.trim()),c={...n,id:(0,y.uuid)(),ref:`BK-${s}`,status:o?'pending':'confirmed',createdAt:a().toISOString()};return e(e=>({bookings:[...e.bookings,c],counters:{...e.counters,booking:s}})),r(c.restaurantId,'booking',`Booking ${o?'request ':''}${c.ref}: ${c.name}, ${c.partySize} on ${c.date} ${c.time}${c.source?` (${c.source})`:''}${c.allergies.length?' \u2014 allergies declared':''}`),l(o?'booking-request':'booking-confirmation',c),c},decideBooking:(n,s,i)=>{const o=t().bookings.find(e=>e.id===n);if(!o||'pending'!==o.status)return;const c={by:i,at:a().toISOString(),outcome:s},u='confirmed'===s?'confirmed':'cancelled';e(e=>({bookings:e.bookings.map(e=>e.id===n?{...e,status:u,decided:c}:e)})),r(o.restaurantId,'booking',`Booking request ${o.ref} (${o.name}, ${o.partySize}) ${s} by ${i}`),l('confirmed'===s?'booking-confirmation':'booking-declined',{...o,status:u})},addOutbox:t=>e(e=>({outbox:[...t,...e.outbox].slice(0,300)})),updateOutbox:(t,a)=>e(e=>({outbox:e.outbox.map(e=>e.id===t?{...e,...a}:e)})),clearOutbox:t=>e(e=>({outbox:e.outbox.filter(e=>e.restaurantId!==t)})),setTemplate:(t,a,r)=>e(e=>{const n={...e.msgTemplates[t]??{}};return null===r?delete n[a]:n[a]={...n[a]??{},...r},{msgTemplates:{...e.msgTemplates,[t]:n}}}),acceptOrder:(n,s,i)=>{const o=t().orders.find(e=>e.id===n);if(!o)return!1;const l='new'===o.status&&!!(0,k.statusBlock)(o,'acknowledged',(0,k.linkedBooking)(o,t().bookings)),c=a(),u=i?new Date(c.getTime()+6e4*i).toISOString():o.readyBy;return e(e=>({orders:e.orders.map(e=>e.id===n?{...e,status:'new'!==e.status||l?e.status:'acknowledged',accepted:e.accepted??{by:s,at:c.toISOString()},readyBy:u}:e)})),r(o.restaurantId,'order',`${o.ref} accepted by ${s}${i?`, ready by ${String(new Date(u).getHours()).padStart(2,'0')}:${String(new Date(u).getMinutes()).padStart(2,'0')}`:''}`),!l},setBookingStatus:(n,s)=>{const i=t().bookings.find(e=>e.id===n),o=a().toISOString();e(e=>({bookings:e.bookings.map(e=>e.id===n?{...e,status:s,...'seated'===s?{seatedAt:o}:'finished'===s?{finishedAt:o}:{}}:e)})),i&&r(i.restaurantId,'booking',`${i.ref} ${i.name} \u2192 ${s}`)},seatWalkIn:(n,s,i,o)=>{const l=a(),c=`${l.getFullYear()}-${String(l.getMonth()+1).padStart(2,'0')}-${String(l.getDate()).padStart(2,'0')}`,u=`${String(l.getHours()).padStart(2,'0')}:${String(l.getMinutes()).padStart(2,'0')}`,g=t().bookings.filter(e=>e.restaurantId===n&&e.walkIn&&e.date===c).reduce((e,t)=>Math.max(e,Number(t.ref.slice(2))||0),0)+1,m={id:(0,y.uuid)(),ref:`W-${g}`,restaurantId:n,customerId:null,name:'Walk-in',partySize:s,date:c,time:u,table:i||void 0,allergies:[],notes:(o??'').trim(),status:'seated',security:'none',depositPaid:0,createdAt:l.toISOString(),seatedAt:l.toISOString(),walkIn:!0,source:'walk-in'};return e(e=>({bookings:[...e.bookings,m]})),r(n,'walkin',`Walk-in ${m.ref} seated: ${s} cover(s)${i?`, Table ${i}`:', table to assign'}`),m},setBookingTable:(a,n)=>{const s=t().bookings.find(e=>e.id===a);e(e=>({bookings:e.bookings.map(e=>e.id===a?{...e,table:n}:e)})),s&&r(s.restaurantId,'booking',`${s.ref} ${s.name} \u2192 ${n?n.includes('+')?`Tables ${n.split('+').join(' + ')}`:`Table ${n}`:'no table'}`)},updateBooking:(a,n)=>{const s=t().bookings.find(e=>e.id===a);e(e=>({bookings:e.bookings.map(e=>e.id===a?{...e,...n}:e)})),s&&r(s.restaurantId,'booking',`${s.ref} ${s.walkIn?'Walk-in':s.name} moved/updated${n.table?` \u2192 Table ${n.table}`:''}${n.time?` at ${n.time}`:''}${n.durationMins?` for ${n.durationMins} min`:''}`)},undoWalkIn:a=>{const n=t().bookings.find(e=>e.id===a);n&&n.walkIn&&(e(e=>({bookings:e.bookings.filter(e=>e.id!==a)})),r(n.restaurantId,'walkin',`Walk-in ${n.ref} undone`))},ackBookingAllergy:(n,s)=>{const i=t().bookings.find(e=>e.id===n);i&&!i.allergyAck&&(e(e=>({bookings:e.bookings.map(e=>e.id===n?{...e,allergyAck:{by:s,at:a().toISOString()}}:e)})),r(i.restaurantId,'allergy',`Allergen sign-off 1/5 Booked on ${i.ref} (${i.name}): ${s} (allergy recorded)`))},joinWaitlist:(n,s,i,o)=>{const l=t().waitlist.filter(e=>e.restaurantId===n).reduce((e,t)=>Math.max(e,t.number),0)+1,c={id:I('wl'),restaurantId:n,number:l,name:s,partySize:i,joinedAt:a().toISOString(),status:'waiting',customerId:o};return e(e=>({waitlist:[...e.waitlist,c]})),r(n,'waitlist',`${s} (${i}) joined the waitlist as #${l}`),c},setWaitlistStatus:(a,n)=>{const s=t().waitlist.find(e=>e.id===a);e(e=>({waitlist:e.waitlist.map(e=>e.id===a?{...e,status:n}:e)})),s&&(r(s.restaurantId,'waitlist',`Waitlist #${s.number} ${s.name} \u2192 ${n}`),'seated'===n&&t().addWalkIn(s.restaurantId,s.partySize))},addWalkIn:(t,a)=>{e(e=>({walkIns:{...e.walkIns,[t]:(e.walkIns[t]??0)+a}})),r(t,'walkin',`Walk-in seated: ${a} cover(s)`)},addStamp:(n,s,i)=>{const o=t().restaurants.find(e=>e.id===n);o&&(e(e=>{const t=e.stampCards.find(e=>e.restaurantId===n&&e.customerId===s),r=t??{restaurantId:n,customerId:s,stamps:0,rewardsAvailable:0,history:[]};let l=r.stamps+1,c=r.rewardsAvailable;l>=o.settings.stampTarget&&(l=0,c+=1);const u={...r,stamps:l,rewardsAvailable:c,history:[{at:a().toISOString(),source:i},...r.history]};return{stampCards:t?e.stampCards.map(e=>e===t?u:e):[...e.stampCards,u]}}),r(n,'stamp',`Stamp added (${i})`))},redeemReward:(t,a)=>{e(e=>({stampCards:e.stampCards.map(e=>e.restaurantId===t&&e.customerId===a&&e.rewardsAvailable>0?{...e,rewardsAvailable:e.rewardsAvailable-1}:e)})),r(t,'stamp','Loyalty reward redeemed')},buyGiftCard:(n,s,i,o)=>{const l=n.slice(0,3).toUpperCase(),c={id:I('gc'),code:O(l),restaurantId:n,initial:s,balance:s,ownerId:t().customer.id,recipientName:i,message:o,createdAt:a().toISOString()};return e(e=>({giftCards:[c,...e.giftCards]})),r(n,'giftcard',`Gift card sold \xa3${(s/100).toFixed(2)} (demo payment)`),c},redeemGiftCard:(a,n,s)=>{const i=t().giftCards.find(e=>e.code.toUpperCase()===a.trim().toUpperCase());return!(!i||n<=0||n>i.balance)&&(e(e=>({giftCards:e.giftCards.map(e=>e.id===i.id?{...e,balance:e.balance-n}:e)})),r(i.restaurantId,'giftcard',`Gift card ${i.code} redeemed \xa3${(n/100).toFixed(2)} by ${s}`),!0)},honourLegacyCard:(t,n,s,i)=>{const o={id:I('gc'),code:n.trim().toUpperCase(),restaurantId:t,initial:s,balance:s,ownerId:'legacy',recipientName:'Legacy website bookings gift card',message:`Honoured by ${i}`,createdAt:a().toISOString().slice(0,10),legacy:!0};return e(e=>({giftCards:[o,...e.giftCards]})),r(t,'giftcard',`Legacy website bookings gift card ${o.code} honoured (\xa3${(s/100).toFixed(2)}) by ${i}`),o},addEvent:t=>e(e=>({events:[...e.events,{...t,id:I('ev')}]})),addRating:t=>{e(e=>({ratings:[{...t,id:I('rt'),createdAt:a().toISOString()},...e.ratings],orders:t.orderId?e.orders.map(e=>e.id===t.orderId?{...e,rated:!0}:e):e.orders})),r(t.restaurantId,'rating',`Private rating ${t.stars}/5 from ${t.customerName}`)},updateMenuItem:(a,n)=>{const{name:s,section:i,price:o,allergens:l,allergenNotes:c,...u}=n,g={};void 0!==s&&(g.dish=s),void 0!==i&&(g.section=i),'price'in n&&(g.price=o??null),void 0!==l&&(g.allergens=l),'allergenNotes'in n&&(g.allergenNotes=c);const m='optionGroups'in n,p=(0,b.menuCardBridge)();p&&(Object.keys(g).length||m)&&p.menuEdited(a,g,'CoverCharge for Managers',m);const f=p?u:n;Object.keys(f).length&&e(e=>({menu:e.menu.map(e=>e.id===a?{...e,...f}:e)}));const k=t().menu.find(e=>e.id===a);k&&Object.keys(f).length&&r(k.restaurantId,'menu',`Menu: ${(0,b.resolveItem)(k).name} updated`)},setSignOff:(t,r)=>{const n=(0,b.menuCardBridge)();n?r?n.signOff(t,r):n.menuEdited(t,{},'CoverCharge for Managers',!0):e(e=>({menu:e.menu.map(e=>e.id===t?{...e,signOff:r?{by:r,at:a().toISOString().slice(0,10)}:null}:e)}))},addAudit:(e,t,a)=>r(e,t,a),updateSettings:(t,a)=>{e(e=>({restaurants:e.restaurants.map(e=>e.id===t?{...e,settings:{...e.settings,...a}}:e)})),'takeawayPaused'in a&&r(t,'order',"Takeaway slots "+(a.takeawayPaused?'PAUSED':'resumed'))},addMenuItem:t=>{const a=I('m');return e(e=>({menu:[...e.menu,{...t,id:a}]})),(0,b.menuCardBridge)()?.menuItemAdded({...t,id:a}),r(t.restaurantId,'menu',`Menu: ${t.name} added (recipe card awaiting head chef sign-off)`),a},updateRestaurant:(t,a)=>{e(e=>({restaurants:e.restaurants.map(e=>e.id===t?{...e,...a}:e)})),r(t,'menu',`Restaurant info updated (${Object.keys(a).join(', ')})`)},placeManualOrder:({restaurantId:n,type:s,channel:i,customerName:o,phone:l,email:u,tableNo:g,slotTime:m,lines:f,allergies:k,notes:I,by:S})=>{const h=t(),w=f.flatMap(({itemId:e,qty:t})=>{const a=h.menu.find(t=>t.id===e);if(!a||t<=0)return[];const r=(0,b.resolveItem)(a),n=(0,p.conflictsFor)((0,p.effectiveAllergens)(r),k);return[{itemId:e,name:r.name,qty:t,unitPrice:r.price??0,choices:[],notes:'',contains:n.contains,may:n.may,overridden:!1,prepMins:r.prepMins}]}),O=w.reduce((e,t)=>e+t.unitPrice*t.qty,0),C='table'===s,v=$(h.orders.filter(e=>e.restaurantId===n).map(e=>e.ref),C?'Q-':'T-',C?h.counters.table:h.counters.order),A={id:(0,y.uuid)(),ref:`${C?'Q':'T'}-${v}`,restaurantId:n,customerId:`manual-${i}`,customerName:o||(C?`Table ${g}`:'Walk-in'),type:s,tableNo:g,slotTime:m,lines:w,subtotal:O,tip:0,giftCardApplied:0,total:O,paid:0,status:'new',createdAt:a().toISOString(),allergies:k,readiness:{},notes:I,channel:i,...l?{phone:l}:{},...u?{email:u}:{},...k.length?{allergyChain:{booked:{by:S,at:a().toISOString()}}}:{}};return e(e=>({orders:[A,...e.orders],counters:C?{...e.counters,table:v}:{...e.counters,order:v}})),r(n,'order',`Order ${A.ref} taken by ${S} (${'phone'===i?'phone':'walk-in'===i?'walk-in takeaway':`Table ${g}`})`),k.length&&r(n,'allergy',`Allergen sign-off 1/5 Booked on ${A.ref}: ${S} recorded ${k.map(e=>`${e.allergen} (${e.severity})`).join(', ')}`),(l||u)&&c(A),A},ackAlert:(t,r)=>e(e=>({alertAcks:{...e.alertAcks,[t]:{by:r,at:a().toISOString()}}}))}},{name:'covercharge-demo-v1',version:9,migrate:async(e,t)=>{if(!e)return e;if(n.LIVE_VENUE_BUILD)return await(0,s.archiveChefCache)('core',e),Object.assign(e,(0,r.stripCoreLiveSamples)(e)),e.clock={mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()},e;if(e.clock={mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()},t<6){try{e.restaurants=(e.restaurants??[]).map(e=>'saltmarsh'===e?.id?{...e,name:'The Venue'}:e)}catch{}try{e.restaurants=(e.restaurants??[]).map(e=>'anchorage'===e?.id&&JSON.stringify(e.kitchenHours)===JSON.stringify(g.ANCHORAGE_KITCHEN_OLD)?{...e,kitchenHours:g.ANCHORAGE_KITCHEN,hoursNote:'Kitchen (food) hours from Gordon, 30 Oct 2026: closed Mon\u2013Tue. The closing time is last food orders. Bar hours not set.'}:e)}catch{}}if(t<5)try{e.events=(e.events??[]).map(e=>'string'==typeof e?.title&&/\(substitute day\)/i.test(e.title)?{...e,title:e.title.replace(/\s*\(substitute day\)/gi,'').trim()}:e)}catch{}if(t<4)try{e.restaurants=(e.restaurants??[]).map(e=>'anchorage'===e.id&&e.settings&&!e.settings.pay?{...e,settings:{...e.settings,pay:g.ANCHORAGE_PAY}}:e)}catch{}if(t<3)try{e.restaurants=(e.restaurants??[]).map(e=>'anchorage'===e.id?{...e,settings:{...e.settings,orderAtTable:!1}}:e),e.orders=(e.orders??[]).filter(e=>'ord-seed-3'!==e.id&&'Q-2018'!==e.ref),e.audit=(e.audit??[]).filter(e=>!String(e.text??'').includes('Q-2018'))}catch{}if(t>=2)return e;try{const t=(0,u.buildSeed)((0,u.defaultSimStart)()),a=new Map(t.bookings.map(e=>[e.id,e])),r=new Set((0,m.anchoragePlan)().tables.map(e=>e.name)),n=e=>!e||e.split('+').every(e=>r.has(e));e.bookings=(e.bookings??[]).map(e=>{const t=a.get(e.id);return t?{...e,table:t.table,dog:t.dog,notes:t.notes}:'anchorage'!==e.restaurantId||n(e.table)?e:{...e,table:void 0}})}catch{}return e},merge:(e,r)=>{const n={...r,...e};return a.IS_WILDINGS&&(n.restaurants=n.restaurants.map(t.withWildingsAddress)),n},storage:(0,c.createJSONStorage)(()=>o.default)}))},872,[1128,5,1129,833,1132,1116,952,1117,1133,3,945,814,1114,823,940,1033]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useShallow",{enumerable:!0,get:function(){return o}});var e,t=r(d[0]),u=(e=t)&&e.__esModule?e:{default:e},n=r(d[1]);function o(e){const t=u.default.useRef(void 0);return u=>{const o=e(u);return(0,n.shallow)(t.current,o)?t.current:t.current=o}}},873,[30,1141]); +__d(function(g,_r,i,_a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TABLE_ORDER_DEFAULT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"cleanToken",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"isTableNo",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"fromRow",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"toRow",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"hm",{enumerable:!0,get:function(){return s}}),e.openAt=function(t,r){const n=a(r),o=t.openFrom?a(t.openFrom):null,l=t.lastOrders?a(t.lastOrders):null;return null!==o&&null!==l?o<=l?n>=o&&n=o||n=o:null===l||n{const r=(t??'').trim().toUpperCase();return/^[A-Z2-9]{16}$/.test(r)?r:null},n=t=>/^[0-9]{1,4}$/.test(t),o=r=>r?{on:!!r.is_on,tables:Array.isArray(r.tables)?r.tables.map(String):null,staffAccept:!1!==r.staff_accept,openFrom:r.open_from?String(r.open_from).slice(0,5):null,lastOrders:r.last_orders?String(r.last_orders).slice(0,5):null,guestTip:r.guest_tip??''}:{...t},l=t=>({is_on:t.on,tables:t.tables&&t.tables.length?t.tables.filter(n):null,staff_accept:t.staffAccept,open_from:t.openFrom,last_orders:t.lastOrders,guest_tip:t.guestTip.slice(0,300)}),a=t=>{const[r,n]=t.split(':').map(Number);return 60*r+n},s=t=>`${String(Math.floor(t/60)%24).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`;const c=(t,r)=>t.reduce((t,n)=>t+n.qty*(r.find(t=>t.id===n.id)?.pricePence??0),0),u=(t,r,n)=>t.map(t=>r.find(r=>r.id===t.id)).filter(t=>!!t&&(t.allergens.some(t=>n.includes(t))||t.mayContain.some(t=>n.includes(t)))),f=(t,r)=>`${t.replace(/\/$/,'')}/customer-app/index.html?table=${r}`,p=t=>'table'===t.type&&'table-qr'===t.channel,b=t=>p(t)&&!!t.held&&!t.accepted&&'cancelled'!==t.status,m=t=>!b(t),y=t=>'cancelled'===t.status?t.cancelReason?`Cancelled: ${t.cancelReason}`:'Cancelled by the staff.':t.held&&!t.accepted?'Sent. Waiting for a member of staff to accept it.':'served'===t.status||'collected'===t.status||'closed'===t.status?'Served. Enjoy!':'ready'===t.status?'Ready: on its way to your table.':'Accepted: the kitchen has your order.',O=['Sold out','Wrong table','Sent twice','Kitchen closed','Guest asked to cancel'],h='Please pay at the bar or till. Paying by card from your phone is coming later.'},876,[]); +__d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.venueTextStyle=d,Object.defineProperty(_e,"Text",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"TextInput",{enumerable:!0,get:function(){return h}});var t=r(_d[0]),n=r(_d[1]),o=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(n){if('default'!==n){var o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,t})(r(_d[2])),f=e(r(_d[3])),u=e(r(_d[4])),l=e(r(_d[5])),c=r(_d[6]),s=r(_d[7]);function d(e){if(!t.IS_SOUTERS)return e;const n=l.default.flatten(e)||{};return{...n,...'number'==typeof n.fontSize?{fontSize:(0,c.soutersFont)(n.fontSize)}:{},...'number'==typeof n.lineHeight?{lineHeight:(0,c.soutersFont)(n.lineHeight)}:{},...'string'==typeof n.color?{color:(0,c.soutersInk)(n.color)}:{}}}const y=o.forwardRef(function({style:e,...t},n){return(0,s.jsx)(f.default,{...t,ref:n,style:d(e)})}),p=o.forwardRef(function({style:e,placeholderTextColor:t,...n},o){const f=d([{fontSize:14,color:'#F5F1E8'},e]),y=l.default.flatten(f)||{};return(0,s.jsx)(u.default,{...n,ref:o,placeholderTextColor:'string'==typeof t?(0,c.soutersInk)(t):'#B8B0A0',style:[f,{minHeight:Math.max(44,'number'==typeof y.minHeight?y.minHeight:44),minWidth:Math.max(44,'number'==typeof y.minWidth?y.minWidth:44)}]})}),S=o.forwardRef(function({style:e,...t},o){const u=l.default.flatten(e)||{};return(0,s.jsx)(f.default,{...t,ref:o,style:[u,{color:u.color===n.QUEUED_BRAND?.accent?n.QUEUED_BRAND.smallTextAccent:u.color}]})}),_=t.IS_QUEUED_VENUE?S:t.IS_SOUTERS?y:f.default,h=t.IS_SOUTERS?p:u.default},877,[5,1233,30,206,273,46,868,24]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.TableNumberWarning=function({plan:u}){const c=(0,n.numberClashes)(u.tables),o=[...new Set([...c.acrossAreas,...u.tables.filter(n=>c.sameArea.has(n.name)).map(n.tableNumber)])];return o.length?(0,l.jsxs)(t.T,{testID:"duplicate-table-numbers",size:16,colour:s.colours.goldLight,children:["Duplicate table numbers: ",o.join(', '),". Kept unchanged. Ask a manager to check the areas before assigning."]}):null},r(d[0]);var n=r(d[1]),s=r(d[2]),t=r(d[3]),l=r(d[4])},914,[30,945,821,813,24]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingTableButton=function({rid:e,booking:l,readOnly:y,turnBase:B=90,testID:f}){const[h,j]=(0,t.useState)(!1),k=(0,s.tableButtonLabel)(l.table),x=f??`table-btn-${l.id}`;if(y)return(0,c.jsx)(n.default,{testID:x,accessible:!0,accessibilityLabel:(0,s.tableButtonA11y)(l.table,!0),style:{minHeight:44,justifyContent:'center'},children:(0,c.jsx)(b.T,{size:16,weight:"semibold",colour:o.colours.goldLight,children:k})});return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(b.Button,{kind:"secondary",label:k,testID:x,accessibilityLabel:(0,s.tableButtonA11y)(l.table),onPress:()=>j(!0),style:{minHeight:44}}),h?(0,c.jsx)(u.TablePicker,{rid:e,booking:l,name:l.walkIn?'Walk-in':(l.name??'').replace(' (example)',''),turnBase:B,onClose:()=>j(!1)}):null]})};var e,t=r(d[0]),l=r(d[1]),n=(e=l)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),u=r(d[4]),b=r(d[5]),c=r(d[6])},915,[30,127,1297,821,930,813,24]); +__d(function(g,_r,i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingEditButton=function({rid:e,booking:a,who:l,role:s,inStaffApp:o,shiftManager:n,big:d,testID:h}){const[u,b]=(0,t.useState)(!1);return a.walkIn||!(0,c.canEditBooking)({variant:r.APP_VARIANT,inStaffApp:o,role:s,shiftManager:n})?null:(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(p.Button,{kind:"secondary",small:!d,label:"Edit booking",testID:h??`edit-booking-${a.id}`,accessibilityLabel:`Edit booking, ${a.name}, ${a.time}`,onPress:()=>b(!0),style:{minHeight:d?64:44}}),u?(0,x.jsx)(j,{rid:e,id:a.id,who:l,onClose:()=>b(!1)}):null]})},_e.EditBookingPicker=function({rid:e,today:a,who:l,onClose:o,hidePrivate:n}){const[d,r]=(0,t.useState)(null),c=(0,s.useBookings)(e).filter(e=>!e.walkIn&&e.date>=a&&!['cancelled','noshow','finished'].includes(e.status)).sort((e,t)=>e.date.localeCompare(t.date)||e.time.localeCompare(t.time)).slice(0,60);return d?(0,x.jsx)(j,{rid:e,id:d,who:l,hidePrivate:n,onClose:o}):(0,x.jsxs)(p.Sheet,{visible:!0,onClose:o,title:"Edit booking \xb7 pick a booking",maxWidth:640,testID:"edit-booking-picker",children:[(0,x.jsx)(p.T,{size:16,colour:u.colours.text,children:"Tip: tap the booking you want to change."}),c.length?c.map(e=>(0,x.jsx)(p.Button,{kind:"secondary",testID:`edit-pick-${e.id}`,label:`${e.date===a?'Today':e.date} ${e.time} \xb7 ${e.name} \xb7 ${e.partySize} ${1===e.partySize?'cover':'covers'}`,sub:e.notes?`Notes: ${e.notes}`:void 0,accessibilityLabel:`Edit booking, ${e.name}, ${e.date===a?'today':e.date}, ${e.time}, ${e.partySize} covers`,onPress:()=>r(e.id),style:{minHeight:56,alignItems:'flex-start'}},e.id)):(0,x.jsx)(p.Muted,{children:"No bookings to edit from today on."}),(0,x.jsx)(p.Button,{kind:"ghost",label:"Close",onPress:o,style:{minHeight:44}})]})},_e.EditBookingSheet=j;var e,t=_r(_d[0]),a=_r(_d[1]),l=(e=a)&&e.__esModule?e:{default:e},s=_r(_d[2]),o=_r(_d[3]),n=_r(_d[4]),d=_r(_d[5]),r=_r(_d[6]),c=_r(_d[7]),h=_r(_d[8]),u=_r(_d[9]),b=_r(_d[10]),m=_r(_d[11]),p=_r(_d[12]),x=_r(_d[13]);const y=/^([01]\d|2[0-3]):[0-5]\d$/,k=e=>{const t=e.trim().replace('.',':').match(/^(\d{1,2}):?(\d{2})$/);return t?`${t[1].padStart(2,'0')}:${t[2]}`:e.trim()};function j({rid:e,id:a,who:j,onClose:f,hidePrivate:v='display'===r.APP_VARIANT}){const T=(0,s.useBookings)(e),I=T.find(e=>e.id===a),C=(0,d.useRestaurant)(e),D=(0,o.usePlan)(e),P=(0,n.useBlocks)(e=>e.blocks),[$,w]=(0,t.useState)(I?(0,c.draftOf)(I):null),[B,S]=(0,t.useState)(null),[E,A]=(0,t.useState)(null);if(!I||!$||!C)return null;const z=e=>{S(null),A(null),w({...$,...e})},L=k($.time),_=y.test(L),F=(0,h.tableOptions)(D,T.filter(e=>e.date===$.date),$.table),N=(0,c.changedFields)(I,{...$,time:L}),W=C.settings.turnMins??90,R=async()=>{const t=(0,c.editPatch)(I,{...$,time:L},{by:j||'Team member',app:r.APP_VARIANT});if(Object.keys(t).length&&await s.repo.bookings.update(I.id,t),'seated'===I.status&&'table'in t&&t.table!==I.table){const a=e=>e?e.split('+').map(e=>e.trim()).filter(Boolean):[],l=a(I.table),s=a(t.table),n=o.useFloor.getState(),d=l.map(t=>n.live[e]?.[t]?.stage).find(Boolean)??'seated';l.filter(e=>!s.includes(e)).forEach(t=>n.setLive(e,t,{stage:void 0,dirty:!0})),s.forEach(t=>n.setLive(e,t,{stage:d,dirty:!1}))}A(`Saved. Changed: ${(0,c.editedWords)(N)}.`),S(null),f()};return(0,x.jsxs)(p.Sheet,{visible:!0,onClose:f,title:`Edit booking \xb7 ${I.name} \xb7 ${I.ref}`,maxWidth:760,testID:"edit-booking-sheet",children:[(0,x.jsx)(m.DepositChip,{b:I,money:!0,big:!0,testID:"edit-deposit"}),(0,c.isWixBooking)(I)?(0,x.jsx)(l.default,{testID:"edit-wix-note",accessible:!0,accessibilityLabel:c.WIX_EDIT_NOTE,style:{padding:12,borderRadius:12,borderWidth:1,borderColor:u.colours.gold},children:(0,x.jsx)(p.T,{size:16,colour:u.colours.goldLight,children:c.WIX_EDIT_NOTE})}):null,(0,x.jsx)(p.T,{size:16,colour:u.colours.text,children:"Tip: change what you need, then press Save changes."}),(0,x.jsx)(b.BookingDatePicker,{r:C,today:new Date,value:$.date,onChange:e=>z({date:e})}),(0,x.jsx)(p.Field,{label:"Time (24-hour, for example 19:30)",value:$.time,onChangeText:e=>z({time:e}),testID:"edit-time"}),_?null:(0,x.jsx)(p.T,{size:15,colour:u.colours.amber,children:"Write the time like 19:30."}),(0,x.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(p.T,{size:18,children:"Covers"}),(0,x.jsx)(p.Stepper,{value:$.partySize,onChange:e=>z({partySize:e}),min:1,max:60,label:"covers",testID:"edit-covers"})]}),(0,x.jsx)(p.Field,{label:"Name",value:$.name,onChangeText:e=>z({name:e}),testID:"edit-name"}),v?(0,x.jsx)(p.Muted,{children:"Phone and email can be changed in the Managers app; the Display never shows them."}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(p.Field,{label:"Phone",value:$.phone,onChangeText:e=>z({phone:e}),keyboardType:"phone-pad",testID:"edit-phone"}),(0,x.jsx)(p.Field,{label:"Email",value:$.email,onChangeText:e=>z({email:e}),keyboardType:"email-address",autoCapitalize:"none",testID:"edit-email"})]}),(0,x.jsx)(p.Field,{label:"Notes",value:$.notes,onChangeText:e=>z({notes:e}),placeholder:c.NOTES_PLACEHOLDER,multiline:!0,numberOfLines:3,testID:"edit-notes"}),I.allergies.length||I.allergyNote?(0,x.jsx)(p.Muted,{children:"Allergies are kept separately and are not changed here."}):null,(0,x.jsx)(p.T,{size:18,weight:"semibold",children:(0,h.tableButtonLabel)($.table)}),(0,x.jsxs)(p.Row,{gap:8,wrap:!0,children:[(0,x.jsx)(p.Button,{kind:$.table?'secondary':'primary',label:"No table",accessibilityLabel:"No table"+($.table?'':', chosen'),onPress:()=>z({table:''}),style:{minHeight:44,minWidth:96},testID:"edit-table-none"}),F.map(e=>(0,x.jsx)(p.Button,{kind:e===$.table?'primary':'secondary',label:(0,h.tableButtonLabel)(e),accessibilityLabel:`Table ${(0,h.tableButtonLabel)(e)}${e===$.table?', chosen':''}`,onPress:()=>z({table:e}),style:{minHeight:44,minWidth:64},testID:`edit-table-${e}`},e))]}),B?(0,x.jsxs)(l.default,{testID:"edit-warn",style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:u.colours.amber,backgroundColor:u.colours.amberBg},children:[B.map(e=>(0,x.jsx)(p.T,{size:16,colour:"#FFE2A8",children:e},e)),(0,x.jsx)(p.T,{size:16,colour:"#FFE2A8",children:"You can still save."})]}):null,E?(0,x.jsx)(p.T,{size:16,colour:u.colours.goldLight,children:E}):null,(0,x.jsxs)(p.Row,{gap:8,wrap:!0,children:[(0,x.jsx)(p.Button,{label:B?'Save anyway':'Save changes',testID:"edit-save",disabled:!_||$.name.trim().length<1||!N.length,onPress:()=>{const t=_?(0,n.blockAt)(P,e,$.date,L):void 0,a=(0,c.editWarnings)(I,{...$,time:L},T,t,W);!a.length||B?R():S(a)},style:{minHeight:56,flex:1}}),(0,x.jsx)(p.Button,{kind:"ghost",label:"Cancel",onPress:f,style:{minHeight:56}})]})]})}},916,[30,127,819,825,824,1021,806,812,1297,821,1298,951,813,24]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useScreensaverAsleep",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"useDisplayToolsH",{enumerable:!0,get:function(){return s}});var t=r(d[0]);const n=(0,t.create)(t=>({asleep:!1,set:n=>t({asleep:n})})),s=(0,t.create)(()=>({h:65}))},917,[952]); +__d(function(g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useSoldOut",{enumerable:!0,get:function(){return f}}),_e.setSoldOutBy=m,_e.setSoldOut=function(e,t,n){if(!s.useStore.getState().menu.find(t=>t.id===e))return;n&&m(n);s.useStore.getState().updateMenuItem(e,{soldOut:t})},_e.soldOutNow=function(e,t=c()){return(0,o.activeSoldOut)(f.getState().entries,e,t)},_e.linkSoldOut=O,_e.useSoldOutLink=function(e,t,n=!0){const r=_r(d[9]);r.useEffect(()=>{n&&O({adopt:e})},[e,n]),r.useEffect(()=>{n&&m(t)},[t,n])};var e,t=_r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},r=_r(d[1]),a=_r(d[2]),o=_r(d[3]),i=_r(d[4]),s=_r(d[5]),u=_r(d[6]),l=_r(d[7]);const c=()=>{try{return(0,s.nowFrom)(s.useStore.getState().clock)}catch{return new Date}},f=(0,r.create)()((0,a.persist)((e,t)=>({entries:[],adopted:{},mark:(t,n,r,a)=>{const u=c(),l=s.useStore.getState().restaurants.find(e=>e.id===t),f=(0,o.soldOutSettingsOf)(l?.settings?.soldOut),S=l?(0,i.hoursFor)(l,u)?.close??null:null,m=(0,o.clearAfterFor)(u,f,S),p={rid:t,itemId:n,name:r.slice(0,120),on:!0,at:u.toISOString(),by:a.slice(0,80),clearAfter:m?.toISOString(),auto:!1,kept:!1};e(e=>({entries:[...e.entries.filter(e=>!(e.rid===t&&e.itemId===n)),p]}))},back:(n,r,a)=>{const o=t().entries.find(e=>e.rid===n&&e.itemId===r);o&&o.on&&e(e=>({entries:e.entries.map(e=>e===o?{...e,on:!1,at:c().toISOString(),by:a.slice(0,80),clearAfter:void 0,kept:!!e.auto}:e)}))},expire:(n,r)=>{const a=(0,o.expiredSoldOut)(t().entries,n,r);if(!a.length)return 0;const i=new Set(a.map(e=>e.itemId));return e(e=>({entries:e.entries.map(e=>e.rid===n&&i.has(e.itemId)?{...e,on:!1,by:'Cleared automatically',clearAfter:void 0}:e)})),a.length}}),{name:'covercharge-soldout-v1',version:1,storage:(0,a.createJSONStorage)(()=>n.default),partialize:e=>({entries:e.entries.slice(-500),adopted:e.adopted})}));let S='Staff';function m(e){e&&(S=e.replace(' (example)',''))}let p=null;function O(e){if(p)return p;let t=!1;const n=(e=s.useStore.getState().menu)=>new Map(e.map(e=>[e.id,e.soldOut]));let r=n();if(e.adopt){const e={...f.getState().adopted},t=[];for(const t of s.useStore.getState().menu)e[t.restaurantId];for(const t of s.useStore.getState().menu)e[t.restaurantId]=!0;f.setState(n=>({entries:[...n.entries,...t],adopted:e}))}const a=()=>{const e=c(),a=f.getState().entries,o=s.useStore.getState().menu,i=new Map;for(const t of a){const n=t.on&&(!t.clearAfter||new Date(t.clearAfter).getTime()>e.getTime());i.set(`${t.rid}|${t.itemId}`,n)}const u=o.filter(e=>i.has(`${e.restaurantId}|${e.id}`)&&i.get(`${e.restaurantId}|${e.id}`)!==e.soldOut);if(u.length){t=!0;try{const e=new Map(u.map(e=>[e.id,i.get(`${e.restaurantId}|${e.id}`)]));s.useStore.setState(t=>({menu:t.menu.map(t=>e.has(t.id)?{...t,soldOut:e.get(t.id)}:t)}))}finally{t=!1,r=n()}}},o=s.useStore.subscribe((e,a)=>{if(e.menu===a.menu)return;const o=n(e.menu);if(!t)for(const t of e.menu){const e=r.get(t.id);void 0!==e&&e!==t.soldOut&&(t.soldOut?f.getState().mark(t.restaurantId,t.id,t.name,S):f.getState().back(t.restaurantId,t.id,S))}r=o}),i=f.subscribe((e,t)=>{e.entries!==t.entries&&a()}),u=()=>{const e=c(),t=new Set(f.getState().entries.filter(e=>e.on).map(e=>e.rid));for(const n of t)f.getState().expire(n,e)};u(),a();const l=setInterval(u,3e4);let m=null;if(e.adopt)try{m=_r(d[8],"./autoSoldOutStore").startAutoSoldOut()}catch{m=null}return p=()=>{o(),i(),clearInterval(l),m&&m(),p=null},p}u.PITCH&&'undefined'!=typeof globalThis&&(globalThis.__pitchLive=e=>(0,l.setLiveData)(!!e),globalThis.__pitchSoldOut=e=>{const t=s.useStore.getState(),n=t.restaurants[0]?.id;if(!n)return;const r=t.menu.filter(e=>e.restaurantId===n&&!e.hidden),a=['Sticky toffee pudding','Cullen skink','Fish supper','Steak pie','Haggis bon bons','Cranachan','Lemon tart','Mussels','Scampi','Venison burger','Chips (large)','Oysters','Lobster thermidor','Crab claws','Tablet ice cream','Beef shin','Smoked salmon','Cheeseboard','Halibut','Clootie dumpling'],o=(new Date).toISOString(),i=Array.from({length:e},(e,t)=>r[t]?{id:r[t].id,name:r[t].name}:{id:`pitch-so-${t}`,name:a[t%a.length]});f.setState(e=>({entries:[...e.entries.filter(e=>e.rid!==n||!i.some(t=>t.id===e.itemId)).map(e=>e.rid===n?{...e,on:!1}:e),...i.map(e=>({rid:n,itemId:e.id,name:e.name,on:!0,at:o,by:'Chef'}))]}))})},918,[1116,952,1117,944,815,872,2,1119,942,30]); +__d(function(g,r,i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"dismissNotice",{enumerable:!0,get:function(){return u.dismissNotice}}),Object.defineProperty(_e,"notify",{enumerable:!0,get:function(){return u.notify}}),Object.defineProperty(_e,"useSliders",{enumerable:!0,get:function(){return u.useSliders}}),Object.defineProperty(_e,"SLIDER",{enumerable:!0,get:function(){return y}}),_e.SliderButton=w,_e.SliderCard=S,_e.SliderHost=function(){x();const e=(0,u.useSliders)(e=>e.queue),n=e[0],o=(0,t.useRef)(null);if((0,t.useEffect)(()=>{if(f)return window.ccSlider=e=>(0,u.notify)(e),()=>{delete window.ccSlider}},[]),(0,t.useEffect)(()=>{if(o.current&&clearTimeout(o.current),!n)return;const e=void 0!==n.timeoutMs?n.timeoutMs:n.actions?.length||n.content?null:6e3;return e&&(o.current=setTimeout(()=>u.useSliders.getState().dismiss(n.id),e)),()=>{o.current&&clearTimeout(o.current)}},[n?.id,n?.timeoutMs]),!n)return null;const s=f?'fixed':'absolute';return(0,b.jsxs)(b.Fragment,{children:[n.modal?(0,b.jsx)(l.default,{...h('dim'),style:{position:s,left:0,right:0,top:0,bottom:0,zIndex:2147482990,backgroundColor:'rgba(0,0,0,0.72)'}}):null,(0,b.jsx)(l.default,{testID:"cc-slider-host",pointerEvents:"box-none",style:{position:s,left:12,right:12,bottom:12,zIndex:2147483e3,alignItems:'center',...f?{bottom:'calc(12px + env(safe-area-inset-bottom))'}:{}},children:(0,b.jsx)(S,{n:n,waiting:e.length-1,onClose:()=>u.useSliders.getState().dismiss(n.id)},n.id+':'+(n.seq??0))})]})};var t=r(d[0]);r(d[1]);var n=e(r(d[2])),o=e(r(d[3])),l=e(r(d[4])),s=e(r(d[5])),c=r(d[6]),a=r(d[7]),u=r(d[8]),b=r(d[9]);const f='undefined'!=typeof document,p="\n[data-ccsl=\"in\"]{animation:ccsl-in .45s cubic-bezier(.2,1,.3,1) both}\n@keyframes ccsl-in{from{opacity:0;transform:translate3d(0,110%,0)}to{opacity:1;transform:none}}\n[data-ccsl=\"urgent\"]{animation:ccsl-in .45s cubic-bezier(.2,1,.3,1) both,ccsl-red 1.6s ease-in-out .45s infinite}\n@keyframes ccsl-red{0%,100%{box-shadow:0 10px 30px rgba(0,0,0,.6),0 0 0 1px rgba(255,107,94,.55)}50%{box-shadow:0 10px 40px rgba(0,0,0,.6),0 0 0 2px #FF6B5E,0 0 34px rgba(255,107,94,.45)}}\n[data-ccsl=\"dim\"]{animation:ccsl-dim .3s ease both}\n@keyframes ccsl-dim{from{opacity:0}to{opacity:1}}\n@media (prefers-reduced-motion: reduce){[data-ccsl]{animation:none !important}}\n",h=e=>f?{dataSet:{ccsl:e}}:{};function x(){(0,t.useEffect)(()=>{if(!f||document.getElementById('cc-slider-css'))return;const e=document.createElement('style');e.id='cc-slider-css',e.textContent=p,document.head.appendChild(e)},[])}const y={bg:'#17140F',border:'rgba(207,164,95,.55)',text:'#F5F1E8',quiet:'#A89A80',gold:c.colours.gold,ink:'#17130D'},j=(e="normal")=>'urgent'===e?c.colours.red:'warn'===e?c.colours.amber:c.colours.gold,k=(e="normal")=>'urgent'===e?'rgba(255,107,94,.75)':'warn'===e?'rgba(255,181,71,.65)':y.border;function w({a:e,onDone:t,big:o}){const l=e.kind??'primary';return(0,b.jsx)(n.default,{testID:e.testID,accessibilityRole:"button",accessibilityLabel:e.label,onPress:()=>{try{e.onPress?.()}finally{e.keepOpen||t()}},style:({pressed:e})=>({minHeight:o?56:44,minWidth:44,paddingHorizontal:'ghost'===l?10:o?24:18,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:'primary'===l?y.gold:'transparent',borderWidth:'danger'===l?1:0,borderColor:c.colours.red,opacity:e?.8:1}),children:(0,b.jsx)(a.T,{size:o?18:'ghost'===l?14:15,weight:'primary'===l?'bold':'medium',colour:'primary'===l?y.ink:'danger'===l?c.colours.red:y.quiet,children:e.label})})}function S({n:e,onClose:t,waiting:n=0,maxWidth:c=520}){x();const u=e.tone??'normal',p=j(u),S=e.content,C=!!e.big,{height:I}=(0,s.default)(),D=e.actions??[];return(0,b.jsxs)(l.default,{testID:e.testID??'cc-slider',accessibilityRole:"summary",accessibilityLabel:`${e.kicker?e.kicker+': ':''}${e.title}`,...h('urgent'===u?'urgent':'in'),style:{width:'100%',maxWidth:C?Math.max(c,900):c,alignSelf:'center',borderRadius:14,backgroundColor:y.bg,borderWidth:1,borderColor:k(u),overflow:'hidden',...f?{boxShadow:'0 10px 30px rgba(0,0,0,.6)'}:{elevation:12}},children:['normal'!==u?(0,b.jsx)(l.default,{style:{position:'absolute',left:0,top:0,bottom:0,width:5,backgroundColor:p}}):null,(0,b.jsxs)(o.default,{style:{maxHeight:Math.max(220,I-40)},contentContainerStyle:{paddingVertical:C?18:12,paddingLeft:'normal'!==u?C?24:18:C?20:14,paddingRight:C?20:14,gap:C?10:6},children:[(0,b.jsxs)(l.default,{style:{flexDirection:'row',alignItems:'center',gap:12},children:[e.icon?(0,b.jsx)(a.T,{size:C?34:22,children:e.icon}):null,(0,b.jsxs)(l.default,{style:{flex:1,gap:2},children:[e.kicker?(0,b.jsx)(a.T,{size:C?15:11,weight:"bold",colour:p,style:{letterSpacing:1.4},children:e.kicker}):null,(0,b.jsx)(a.T,{size:C?24:15,weight:"medium",colour:y.text,children:e.title}),e.body?(0,b.jsx)(a.T,{size:C?18:13,colour:y.quiet,children:e.body}):null]}),D.length||S?null:(0,b.jsx)(w,{a:{label:'OK',kind:'ghost',testID:'cc-slider-ok'},onDone:t,big:C})]}),S?(0,b.jsx)(S,{close:t}):null,D.length?(0,b.jsx)(l.default,{style:{flexDirection:'row',flexWrap:'wrap',alignItems:'center',gap:8,justifyContent:'flex-end'},children:D.map(e=>(0,b.jsx)(w,{a:e,onDone:t,big:C},e.label))}):null,n>0?(0,b.jsxs)(a.T,{size:C?14:11,colour:y.quiet,children:[n," more waiting"]}):null]})]})}},919,[30,122,263,151,127,287,821,813,947,24]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AppBadge=function({label:o}){return(0,c.jsx)(t.default,{testID:"app-badge",accessibilityLabel:`${o} app`,style:{borderWidth:1,borderColor:s.colours.gold,borderRadius:6,paddingHorizontal:6,paddingVertical:1,backgroundColor:(0,e.soutersSurface)('#1c1a16')},children:(0,c.jsx)(u.T,{size:10,weight:"bold",colour:s.colours.gold,children:o})})};var e=r(d[0]);r(d[1]);var o,l=r(d[2]),t=(o=l)&&o.__esModule?o:{default:o},s=r(d[3]),u=r(d[4]),c=r(d[5])},920,[868,30,127,821,813,24]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.CoversToday=function({rid:e,onPress:v,big:$,sound:p,testID:x="covers-today",day:C,compact:j=!1}){const w=(0,c.useBookings)(e),k=(0,c.useNow)(3e4),T=(0,h.venueYmd)(k),D=C&&C!==T?C:T,I=D!==T,L=I?(0,y.dayCovers)(w,D,T):(0,u.coversToday)(w,T),_=(0,y.dayWord)(D,T),M=/^(Today|Yesterday|Tomorrow)$/.test(_),R=`COVERS ${_.toUpperCase()}`,S=I?`${M?`${_}\u2019s`:_} bookings \u203a`:'Today\u2019s bookings \u203a',O=I?`${M?`${_}, `:''}${(0,y.dayLong)(D)}`:'today',P=(0,o.useLiveState)();if('ready'!==P)return(0,f.jsx)(o.LiveWait,{state:P,title:"Covers today",testID:`${x}-wait`});const W=$?64:44,z=L.total?Math.min(1,L.done/L.total):0,B=(e,o,t,c)=>(0,f.jsxs)(s.default,{style:{flex:1,alignItems:'center',gap:6,minWidth:0},children:[(0,f.jsx)(l.SplitFlap,{value:o,height:W,colour:t,testID:`covers-${c}`,sound:p}),(0,f.jsx)(n.T,{size:$||j?14:12,weight:"semibold",colour:b.colours.muted,numberOfLines:j?void 0:1,center:j,style:{letterSpacing:.4},children:e})]});return(0,f.jsxs)(t.default,{testID:x,accessibilityRole:"button",disabled:!v,onPress:v,accessibilityLabel:`Covers ${O}: ${L.done} done, ${L.toCome} ${D({backgroundColor:e?b.colours.tilePressed:b.colours.surface,borderRadius:16,borderWidth:1,borderColor:b.colours.hairline,padding:16,gap:12}),children:[(0,f.jsxs)(s.default,{style:{flexDirection:j?'column':'row',justifyContent:'space-between',alignItems:'center',gap:j?6:void 0},children:[(0,f.jsx)(n.T,{center:j,size:j?16:12,weight:"semibold",colour:b.colours.goldMuted,style:{letterSpacing:1.6},children:R}),v?(0,f.jsx)(n.T,{center:j,size:j?14:12,colour:b.colours.muted,children:S}):null]}),(0,f.jsxs)(s.default,{style:{flexDirection:'row',gap:8},children:[B('Done',L.done,b.colours.text,'done'),B(De.set),d=a??t,[n,u]=j[e];return(0,r.useEffect)(()=>{if('display'!==e||!a)return;const t=setTimeout(()=>o(e,null),12e4);return()=>clearTimeout(t)},[e,a,o]),(0,D.jsxs)(l.default,{testID:"day-bar",style:{gap:8},children:[(0,D.jsx)(s.DaySwitch,{day:d,today:t,onDay:t=>o(e,t),back:-n,ahead:u,idPrefix:"day"}),a?(0,D.jsx)(c.Button,{testID:"day-today",kind:"secondary",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>o(e,null),style:{minHeight:48}}):null]})},_e.DayView=function({rid:e,day:s,today:r,app:d}){const n=(0,u.useRestaurant)(e),x=(0,u.useBookings)(e),j=(0,u.useEvents)(e),_=(0,p.parseYmd)(s),B=se.date===s),O=(0,f.regularEventsOf)(n).filter(e=>(0,f.occursOn)(e,s)),T=x.filter(e=>e.date===s).sort((e,t)=>e.time.localeCompare(t.time)).filter(y.ACTIVE),E='display'===d;return(0,D.jsxs)(l.default,{testID:"day-view",style:{gap:12},children:[(0,D.jsxs)(c.Card,{children:[(0,D.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,D.jsxs)(c.T,{weight:"semibold",colour:b.colours.gold,children:[(0,p.niceDate)(_),$?` \xb7 ${$.name} hours`:'']}),(0,D.jsx)(c.Badge,{kind:"gold",label:B?'LOOKING BACK':'LOOKING AHEAD'})]}),(0,D.jsxs)(c.T,{size:E?18:15,children:[C?`Kitchen ${k(C[0])}\u2013${k(C[1])}`:'Kitchen closed',C&&v&&'kitchen closes'!==v.reason?` \xb7 last food orders ${k(v.time)} (${v.reason})`:'']}),O.map(e=>(0,D.jsxs)(c.T,{size:14,colour:b.colours.goldLight,children:["\u266a ",e.name,e.time?` from ${k(e.time)}`:'',e.busier?' \xb7 expect busier':'']},e.id)),w.map(e=>(0,D.jsxs)(c.T,{size:14,colour:b.colours.goldLight,children:["\u2605 ",(0,y.holidayName)(e.title)]},e.id)),(0,D.jsx)(c.Muted,{children:"Read-only. Nothing here changes today\u2019s service."})]}),(0,D.jsx)(a.CoversToday,{rid:e,day:s}),(0,D.jsx)(m.PlattersBooked,{rid:e,date:s,label:B?'Platters that day':'Platters booked'}),T.length?T.map(s=>(0,D.jsxs)(l.default,{style:{gap:6,padding:14,borderRadius:16,borderWidth:1,borderColor:b.colours.hairline,backgroundColor:b.colours.surface},children:[(0,D.jsxs)(c.T,{weight:"semibold",children:[s.time," \xb7 ",s.walkIn?`Walk-in ${s.ref}`:s.name," \xb7 ",s.partySize," covers",s.table?` \xb7 ${(0,t.tableNumbers)(s.table)}`:'']}),(0,D.jsx)(o.DepositChip,{b:s,money:!0,testID:`day-deposit-${s.id}`}),(0,D.jsx)(m.BookingNeeds,{b:s}),'display'!==d&&!B&&['confirmed','pending'].includes(s.status)?(0,D.jsx)(l.default,{style:{flexDirection:'row'},children:(0,D.jsx)(A.WhatsAppGuest,{b:s,rid:e,kind:"auto"})}):null]},s.id)):(0,D.jsx)(c.Muted,{children:B?'No bookings that day.':'No bookings yet for this day.'})]})};var e,t=_r(_d[0]),s=_r(_d[1]),a=_r(_d[2]),o=_r(_d[3]),r=_r(_d[4]),d=_r(_d[5]),l=(e=d)&&e.__esModule?e:{default:e},n=_r(_d[6]),c=_r(_d[7]),u=_r(_d[8]),y=_r(_d[9]),h=_r(_d[10]),f=_r(_d[11]),p=_r(_d[12]),b=_r(_d[13]),m=_r(_d[14]),A=_r(_d[15]),D=_r(_d[16]);const x=(0,n.create)(e=>({day:{},set:(t,s)=>e(e=>({day:{...e.day,[t]:s??void 0}}))})),j={owner:[-s.DAY_BACK,s.DAY_AHEAD],chef:[-s.DAY_BACK,s.DAY_AHEAD],display:[-s.DAY_BACK,s.DAY_AHEAD],staff:[-s.DAY_BACK,s.DAY_AHEAD]},k=e=>{const[t,s]=e.split(':').map(Number);return`${t%12||12}${s?`:${String(s).padStart(2,'0')}`:''}${t<12?'am':'pm'}`};function _(e,t){const s=x(t=>t.day[e]);return s&&s!==t?s:null}},922,[808,936,921,951,30,127,952,813,819,828,815,809,818,821,950,1019,24]); +__d(function(_g,r,_i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"setDisplaySilent",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"soundAllowed",{enumerable:!0,get:function(){return u}}),e.chime=function(t="bright"){if(!u())return void l('__ccChimesBlocked');try{const n=o();if(!n)return;('bright'===t?[880,1318.5]:[659.3]).forEach((o,c)=>{const i=n.currentTime+.16*c,u=n.createOscillator(),l=n.createGain();u.type='sine',u.frequency.value=o,l.gain.setValueAtTime(1e-4,i),l.gain.exponentialRampToValueAtTime('bright'===t?.12:.07,i+.02),l.gain.exponentialRampToValueAtTime(1e-4,i+.9),u.connect(l).connect(n.destination),u.start(i),u.stop(i+.95)}),l('__ccChimes')}catch{}},Object.defineProperty(e,"LOW_CHIME_MIN",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"LOW_CHIME_MAX",{enumerable:!0,get:function(){return d}}),e.lowChime=function(t=0){if(!u())return void l('__ccChimesBlocked');const n=s+.095*Math.max(0,Math.min(1,t));'undefined'!=typeof window&&(window.__ccLowChimeLevels=[...window.__ccLowChimeLevels??[],Math.round(1e3*n)/1e3].slice(-40));try{const t=o();if(!t)return;[220,164.8].forEach((o,c)=>{const i=t.currentTime+.42*c,u=t.createOscillator(),l=t.createGain(),s=t.createBiquadFilter?.();u.type='triangle',u.frequency.value=o,l.gain.setValueAtTime(1e-4,i),l.gain.exponentialRampToValueAtTime(n,i+.12),l.gain.exponentialRampToValueAtTime(1e-4,i+1.6),s?(s.type='lowpass',s.frequency.value=900,u.connect(s).connect(l).connect(t.destination)):u.connect(l).connect(t.destination),u.start(i),u.stop(i+1.7)}),l('__ccLowChimes')}catch{}},Object.defineProperty(e,"flapSoundOn",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"setFlapSound",{enumerable:!0,get:function(){return w}}),e.flapClick=function(){if('display'!==t.APP_VARIANT&&!c)return;if(!p())return;try{const t=o();if(!t)return;const n=t.currentTime,c=Math.floor(.03*t.sampleRate),i=t.createBuffer(1,c,t.sampleRate),u=i.getChannelData(0);for(let t=0;t{if('undefined'==typeof window)return null;const t=window.AudioContext||window.webkitAudioContext;return t?(n||(n=new t),'suspended'===n.state&&n.resume?.().catch?.(()=>{}),n):null};if('undefined'!=typeof window){const t=()=>{try{o()}catch{}window.removeEventListener('pointerdown',t)};window.addEventListener('pointerdown',t)}let c=!1;const i=t=>{c=t},u=()=>'display'!==t.APP_VARIANT&&!c,l=t=>{'undefined'!=typeof window&&(window[t]=(window[t]??0)+1)};const s=.015,d=.11;const f='cc-flap-sound',p=()=>{try{return'undefined'!=typeof localStorage&&'1'===localStorage.getItem(f)}catch{return!1}},w=t=>{try{localStorage.setItem(f,t?'1':'0')}catch{}}},923,[122,806]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.SeatAllergenReminder=function({rid:c}){const u=(0,n.useRef)(new Set);return(0,n.useEffect)(()=>s.useStore.subscribe((n,s)=>{if(n.bookings===s.bookings)return;const h=new Map(s.bookings.map(t=>[t.id,t.status]));for(const s of n.bookings){if(s.restaurantId!==c||'seated'!==s.status||!(0,l.hasAllergens)(s)||u.current.has(s.id))continue;const n=h.get(s.id);n&&'seated'!==n&&(u.current.add(s.id),(0,o.notify)({id:`seat-allergen:${s.id}`,tone:'urgent',testID:'seat-allergen-reminder',icon:'\u26a0\ufe0f',kicker:'RE-CONFIRM ALLERGENS AT THE TABLE',title:`${s.name} \xb7 ${s.partySize} covers${s.table?` \xb7 ${(0,t.tableNumbers)(s.table)}`:''}`,body:`${(0,l.allergenText)(s)}. Before taking the order, check the allergens with the guests again and tell the kitchen about any change.`,actions:[{label:'Done, re-confirmed with the guests',testID:'seat-allergen-ok'}]}))}}),[c]),null},e.useKitchenTodoChime=function(t,u,h){const f=(0,s.useStore)(n=>n.bookings.filter(n=>n.restaurantId===t&&n.date>=u&&!n.walkIn&&((0,l.needsAllergenSeen)(n)||(0,l.needsHoldOk)(n))).map(t=>t.id).sort().join(',')),k=f?f.split(',').length:0,b=(0,n.useRef)(null);return(0,n.useEffect)(()=>{const t=s.useStore.getState().bookings.filter(t=>f.split(',').includes(t.id)),n=b.current;if(b.current=t.map(t=>t.id),null===n)return;const k=t.filter(t=>!n.includes(t.id));if(k.length){(0,c.soundAllowed)()&&(0,c.chime)('bright');for(const t of k){const n=(0,l.needsAllergenSeen)(t);(0,o.notify)({id:`kitchen-todo:${t.id}`,tone:n?'urgent':'warn',testID:'kitchen-todo-notice',icon:n?'\u26a0\ufe0f':'\ud83c\udf7d\ufe0f',kicker:n?'ALLERGENS TO SIGN OFF':'PLATTER TO SIGN OFF',title:`${t.name} \xb7 ${t.partySize} covers \xb7 ${t.date===u?'today':t.date} ${t.time}`,body:n?`${(0,l.allergenText)(t)}. Tap Allergens seen on the booking once the kitchen has read it.`:'A platter is booked. Tap Platter OK on the booking once the kitchen can do it.',actions:[...h?[{label:'Open bookings',onPress:h}]:[],{label:'Later',kind:'ghost'}]})}}},[f]),k};var t=r(d[0]),n=r(d[1]),o=r(d[2]),s=r(d[3]),l=r(d[4]),c=r(d[5])},924,[808,30,947,819,828,923]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useVoiceSlot",{enumerable:!0,get:function(){return w}}),_e.voiceAppFor=S,_e.useVoiceTarget=p,_e.VoiceSlot=function({size:e=56}){const t=p(),u=(0,n.useRef)(null),c=(0,n.useRef)(y++).current,{width:l,height:f}=(0,o.default)(),S=()=>u.current?.measureInWindow((e,t,n)=>{n&&w.setState({rect:{x:e,y:t,size:n},owner:c})});return(0,n.useEffect)(()=>{const e=setTimeout(S,50);return()=>clearTimeout(e)},[l,f,t?.on]),(0,n.useEffect)(()=>()=>{w.getState().owner===c&&w.setState({rect:null,owner:0})},[]),(0,n.useEffect)(()=>{t?.on||w.getState().owner!==c||w.setState({rect:null,owner:0})},[t?.on]),t?.on?(0,h.jsx)(s.default,{ref:u,testID:"voice-slot",onLayout:S,style:{width:e,height:e,flexShrink:0}}):null};var t=r(d[0]),n=r(d[1]),o=e(r(d[2])),s=e(r(d[3])),u=r(d[4]),c=r(d[5]),l=r(d[6]),f=r(d[7]),h=r(d[8]);const w=(0,u.create)(()=>({rect:null,owner:0}));function S(e){return'customer'===c.APP_VARIANT||/^\/(customer|table|demo)/.test(e)?null:e.startsWith('/owner')||e.startsWith('/admin')?'owner':e.startsWith('/team')?'staff':e.startsWith('/kitchen')?'chef':e.startsWith('/display')?'display':null}function p(){const e=(0,t.usePathname)()||'/',n=(0,l.useCtx)(6e4),o=(0,f.useVoiceSettings)(e=>e.enabled),s=S(e);if(!s)return null;const u='owner'===s?'owner'===n.role?'owner':'manager'===n.role?'manager':'staff':s;return{app:s,role:u,actions:'staff'===u?'staff':s,on:(0,f.voiceOn)(o,n.rid,u)}}let y=1},925,[804,30,287,127,952,806,927,1099,24]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"TABLES",{enumerable:!0,get:function(){return P}}),_e.useTableNames=O,_e.resetTableLive=z,_e.seatBookingNow=async function(e,t){await h.repo.bookings.setStatus(t.id,'seated'),z(e,t.table)},_e.finishBookingNow=async function(e,t){await h.repo.bookings.setStatus(t.id,'finished'),(0,w.tablesOf)(t.table).forEach(t=>w.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!0}))},_e.useTableUse=B,Object.defineProperty(_e,"walkInLabel",{enumerable:!0,get:function(){return M}}),_e.TablePicker=N,_e.WalkInSheet=F,_e.AssignTableSheet=A,_e.undoNotice=L,_e.NewBookingSheet=W,_e.useFrontDoor=function(e,t){const[s,o]=(0,a.useState)(!1),[l,i]=(0,a.useState)(!1),[r,d]=(0,a.useState)(null);return{openWalkIn:()=>o({}),openWalkInAt:e=>o({table:e}),openBooking:()=>i(!0),assignTable:e=>d({b:e}),combineTables:e=>d({b:e,combine:!0}),elements:(0,I.jsxs)(I.Fragment,{children:[s?(0,I.jsx)(F,{wide:t,initialTable:s.table,onClose:()=>o(!1),onSeated:L}):null,l?(0,I.jsx)(W,{wide:t,date:e,onClose:()=>i(!1),onSaved:e=>(0,n.notify)({id:`booked:${Date.now()}`,testID:'booking-saved-toast',timeoutMs:5e3,icon:'\u2713',title:`Booked: ${e.name} \xb7 ${(0,y.niceDate)((0,y.parseYmd)(e.date))} at ${e.time}`})}):null,r?(0,I.jsx)(A,{booking:r.b,combine:r.combine,onClose:()=>d(null)}):null]})}};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),n=_r(_d[4]),a=_r(_d[5]),i=e(a),r=_r(_d[6]),d=e(_r(_d[7])),u=e(_r(_d[8])),c=_r(_d[9]),b=_r(_d[10]),h=_r(_d[11]),p=_r(_d[12]),f=_r(_d[13]),y=_r(_d[14]),x=_r(_d[15]),k=_r(_d[16]),j=_r(_d[17]),w=_r(_d[18]),T=_r(_d[19]),S=_r(_d[20]),C=_r(_d[21]),v=_r(_d[22]),D=_r(_d[23]),$=_r(_d[24]),I=_r(_d[25]);const P=Array.from({length:12},(e,t)=>String(t+1));function O(e){const t=(0,w.usePlan)(e);return t.areas.flatMap(e=>t.tables.filter(t=>t.areaId===e.id).map(e=>e.name))}function z(e,t){(0,w.tablesOf)(t).forEach(t=>w.useFloor.getState().setLive(e,t,{stage:'seated',dirty:!1}))}function B(e,t){const s=(0,h.useBookings)(e),o=(0,h.useOrders)(e),l=O(e),n=(0,w.useFloor)(t=>t.live[e])??{},a=(0,w.usePlan)(e),i=(0,T.useBlocks)(e=>e.blocks),r=(0,y.ymd)(t),d=(0,T.closedAreasAt)(i,e,r,(0,y.hm)(t)),u={};for(const e of l)u[e]=n[e]?.blocked||d.has(`tbl:${e}`)?{busy:!0,label:'Blocked'}:d.has(a.tables.find(t=>t.name===e)?.areaId??'')?{busy:!0,label:'Closed'}:n[e]?.dirty?{busy:!0,label:'Needs clearing'}:{busy:!1,label:'Free'};for(const e of s)if(e.date===r&&e.table)for(const s of(0,w.tablesOf)(e.table))if(u[s])if('seated'===e.status)u[s]={busy:!0,label:`${e.walkIn?'Walk-in':`${e.name.slice(0,1)}.`} \xb7 ${e.partySize}`};else if('confirmed'===e.status&&!u[s].busy){const o=(0,y.minsBetween)(t,new Date(`${e.date}T${e.time}:00`));o>=-15&&o<=90&&(u[s]={...u[s],soon:`Booked ${e.time}`})}for(const e of o)'table'===e.type&&e.tableNo&&u[e.tableNo]&&!['closed','cancelled','collected'].includes(e.status)&&!u[e.tableNo].busy&&(u[e.tableNo]={busy:!0,label:'Open order'});return u}const M=e=>e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;function N({use:e,value:t,onPick:o,big:l,best:n,dense:i,bestSet:r,picked:c}){const b=Object.keys(e),[h,p]=(0,a.useState)(0),f=i?6:8,y=i?64:l?92:76,k=h?Math.max(3,Math.floor((h+f)/(y+f))):0,T=k?Math.floor((h-f*(k-1))/k):y,S=new Set(r??[]),C=n?(0,w.tablesOf)(n)[0]:null;return(0,I.jsx)(u.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:f},testID:"table-picker",onLayout:e=>p(Math.floor(e.nativeEvent.layout.width)),children:b.map(l=>{const n=e[l],a=t===l||!!c?.includes(l),r=S.has(l),b=C===l&&!a,h=n.busy?['Blocked','Needs clearing','Closed'].includes(n.label)?n.label:'In use':n.soon??'Free';return(0,I.jsxs)(d.default,{accessibilityRole:"button",testID:`pick-table-${l}`,accessibilityLabel:`Table ${(0,s.tableNumbers)(l)}${c?a?', picked':', not picked':''}, ${n.busy?`in use (${n.label})`:n.soon?`free, ${n.soon}`:'free'}${r?', best table':''}${b?', suggested for this party':''}`,accessibilityState:{selected:a,disabled:'Closed'===n.label},disabled:'Closed'===n.label,onPress:()=>o(l),style:{width:T,minHeight:i?58:64,borderRadius:12,borderWidth:a||b?2.5:1.5,paddingVertical:i?3:6,paddingHorizontal:4,alignItems:'center',justifyContent:'center',gap:2,borderColor:a||b?x.colours.gold:n.busy?x.colours.red:x.colours.ok,backgroundColor:a?x.colours.goldTint:n.busy?x.colours.redBg:x.colours.surface2,opacity:'Closed'!==n.label||a?1:.55},children:[(0,I.jsxs)(u.default,{style:{flexDirection:'row',alignItems:'center',gap:4},children:[(0,I.jsx)(j.T,{weight:"bold",size:22,colour:a?x.colours.goldLight:x.colours.text,children:(0,s.tableNumbers)(l)}),r?(0,I.jsx)(u.default,{testID:"best-table",style:{backgroundColor:x.colours.gold,borderRadius:5,paddingHorizontal:4,paddingVertical:1},children:(0,I.jsx)(j.T,{size:11,weight:"bold",colour:x.colours.onGold,children:"BEST"})}):null]}),(0,I.jsx)(j.T,{size:i?13:14,colour:n.busy?'#FFD9D4':n.soon?'#FFE2A8':'#E2C489',center:!0,numberOfLines:1,children:h})]},l)})})}const R=[1,2,3,4,5,6,7,8];function F({onClose:e,onSeated:o,wide:l,initialTable:n}){const{rid:p,r:k,now:S}=(0,b.useCtx)(15e3),C=B(p,S),[v,D]=(0,a.useState)(2),[$,P]=(0,a.useState)(!1),[O,M]=(0,a.useState)(n??null),F=(0,w.usePlan)(p),A=(0,h.useBookings)(p),L=(0,T.useBlocks)(e=>e.blocks),W=(0,T.closedAreasAt)(L,p,(0,y.ymd)(S),(0,y.hm)(S)),E=i.default.useMemo(()=>{const e=Object.fromEntries(Object.entries(C).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,f.suggestTable)(F,A.filter(e=>e.date===(0,y.ymd)(S)),e,v,S,(0,f.turnFor)(v,k.settings.turnMins),90,void 0,{closed:W})?.table??null},[F,A,C,v,W.size,S.getTime()]);(0,a.useEffect)(()=>{O&&(0,w.tablesOf)(O).some(e=>'Closed'===C[e]?.label)&&M(null)},[O,W.size]);const[H,_]=(0,a.useState)(!1),[U,q]=(0,a.useState)(''),V=(e,t=String(e),s=()=>{P(!1),D(e)})=>{const o='9+'===t?$:!$&&v===e;return(0,I.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:'9+'===t?'Party of 9 or more':`Party of ${e}`,accessibilityState:{selected:o},onPress:s,style:{width:l?58:60,height:l?58:56,borderRadius:14,borderWidth:2,borderColor:x.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:o?x.colours.gold:'transparent'},children:(0,I.jsx)(j.T,{weight:"bold",size:22,colour:o?x.colours.onGold:x.colours.gold,children:t})},t)},G=(0,I.jsxs)(j.Row,{gap:12,style:{justifyContent:'center'},children:[(0,I.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:"One fewer",onPress:()=>D(e=>Math.max(9,e-1)),style:{width:56,height:56,borderRadius:28,borderWidth:2,borderColor:x.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,I.jsx)(j.T,{size:26,colour:x.colours.gold,children:"\u2212"})}),(0,I.jsx)(j.T,{weight:"bold",size:26,children:v}),(0,I.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:"One more",onPress:()=>D(e=>Math.min(40,e+1)),style:{width:56,height:56,borderRadius:28,borderWidth:2,borderColor:x.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,I.jsx)(j.T,{size:26,colour:x.colours.gold,children:"+"})})]}),K=(0,I.jsxs)(u.default,{style:{gap:8,width:l?256:void 0},children:[(0,I.jsx)(j.T,{weight:"semibold",children:"How many people?"}),(0,I.jsxs)(u.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"walkin-party",children:[R.map(e=>V(e)),V(9,'9+',()=>{P(!0),D(e=>e>=9?e:9)})]}),$?G:null]}),[Q,Y]=(0,a.useState)(!1),J=async(t=O)=>{if(!Q){Y(!0);try{const s=await h.repo.bookings.seatWalkIn(p,v,t??void 0,U);z(p,t??void 0),o(s),e()}finally{Y(!1)}}},X=(0,I.jsxs)(u.default,{style:{gap:8,flex:l?1:void 0,minWidth:0},children:[(0,I.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,I.jsxs)(j.T,{weight:"semibold",children:["Table ",(0,I.jsx)(j.T,{colour:x.colours.muted,size:14,children:"(optional)"})]}),O?(0,I.jsx)(j.Button,{small:!0,kind:"ghost",label:"Clear table",onPress:()=>M(null)}):null]}),(0,I.jsx)(N,{use:C,value:O,onPick:e=>{C[e]&&!C[e].busy?J(e):M(O===e?null:e)},big:l,dense:l,best:E,bestSet:(0,r.bestTables)(F)}),(0,I.jsxs)(j.Muted,{children:["Tap a free table to seat them there",E&&!O?` (suggested for ${v}: ${(0,s.tableNumbers)(E)})`:'',", or Seat for no table yet. BEST marks the venue\u2019s best tables."]})]});return(0,I.jsxs)(j.Sheet,{visible:!0,onClose:e,title:`Walk-in \xb7 ${(0,y.hm)(S)}`,maxWidth:l?1100:void 0,testID:"walkin-sheet",children:[(0,I.jsx)(j.Button,{label:`Seat walk-in \xb7 ${v} ${1===v?'person':'people'}${O?` \xb7 ${(0,s.tableNumbers)(O)}`:''}`,disabled:Q,onPress:()=>{J()},testID:"seat-walkin",style:{minHeight:52}}),l?(0,I.jsxs)(j.Row,{gap:16,style:{alignItems:'flex-start'},children:[K,X]}):(0,I.jsxs)(I.Fragment,{children:[K,X]}),(0,I.jsxs)(j.Row,{gap:10,wrap:!0,style:{alignItems:'center'},children:[H?(0,I.jsx)(t.TextInput,{accessibilityLabel:"Walk-in note",placeholder:"Note (optional), e.g. high chair",placeholderTextColor:"#7D776C",value:U,onChangeText:q,style:[j.styles.input,{flex:1,minWidth:220}],autoFocus:!0}):(0,I.jsx)(j.Button,{small:!0,kind:"ghost",label:"Add a note (optional)",onPress:()=>_(!0)}),(0,I.jsx)(u.default,{style:{flex:1,minWidth:220},children:(0,I.jsxs)(j.Muted,{children:["No name needed. Counts in today's covers.",'staff'!==c.APP_VARIANT?' Using website bookings too? Mark the table there as well.':'']})})]})]})}function A({booking:e,onClose:t,combine:o}){const{rid:l,r:n,now:d}=(0,b.useCtx)(15e3),c=B(l,d),p=(0,w.usePlan)(l),k=(0,h.useBookings)(l),T=(0,w.tablesOf)(e.table),S=i.default.useMemo(()=>Object.fromEntries(Object.entries(c).map(([e,t])=>[e,T.includes(e)?{busy:!1,label:'This party',soon:'This party'}:t])),[c,e.table]),C=i.default.useMemo(()=>{const t=Object.fromEntries(Object.entries(S).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,f.suggestTable)(p,k.filter(e=>e.date===(0,y.ymd)(d)),t,e.partySize,d,(0,f.turnFor)(e.partySize,n.settings.turnMins),90,e.id)?.table??null},[p,k,S,e.partySize,d.getTime()]),[v,D]=(0,a.useState)(!!o||T.length>1),[$,P]=(0,a.useState)(T),O=e=>p.tables.find(t=>t.name===e)?.maxSeats??0,R=$.reduce((e,t)=>e+O(t),0),F=$.length>0&&R{const o=(0,w.joinTables)(s);await h.repo.bookings.assignTable(e.id,o);T.filter(e=>!s.includes(e)).forEach(t=>w.useFloor.getState().setLive(l,t,{stage:void 0,dirty:'seated'===e.status})),'seated'===e.status&&z(l,o),t()},L=v?(0,I.jsxs)(u.default,{style:{gap:8},testID:"assign-table-tip",children:[(0,I.jsx)(u.default,{accessibilityLiveRegion:"polite",children:(0,I.jsx)(j.T,{size:17,weight:"semibold",colour:x.colours.text,children:$.length?`${(0,w.tablesLabel)((0,w.joinTables)($))} \xb7 ${R} seats for ${e.partySize} covers`:'No tables picked yet'})}),F?(0,I.jsx)(u.default,{testID:"combine-short",children:(0,I.jsxs)(j.T,{size:15,weight:"semibold",colour:"#FFD9D4",children:["Not enough seats yet: ",e.partySize-R," more needed. Add another table."]})}):null,(0,I.jsx)(j.T,{size:15,colour:x.colours.text,children:"Tap each table to add or remove it, then tap Done. All of them show as taken until the party has finished."}),(0,I.jsxs)(j.Row,{gap:8,wrap:!0,children:[(0,I.jsx)(j.Button,{label:"Done",testID:"combine-done",disabled:!$.length,accessibilityLabel:$.length?`Done, save ${(0,w.tablesLabel)((0,w.joinTables)($))}`:'Done',onPress:()=>A($)}),(0,I.jsx)(j.Button,{kind:"ghost",label:"Cancel",onPress:t})]})]}):(0,I.jsx)(u.default,{style:{gap:8},testID:"assign-table-tip",children:(0,I.jsx)(j.T,{size:15,colour:x.colours.text,children:"Red tables are in use right now; you can still pick one (e.g. joining a table). BEST marks the venue\u2019s best tables. Big party? Tap Combine tables."})});return(0,I.jsxs)(j.Sheet,{visible:!0,onClose:t,title:`${v?'Combine tables':'Assign table'} \xb7 ${M(e)}`,testID:"assign-table-sheet",footer:L,children:[C&&!v?(0,I.jsx)(u.default,{testID:"assign-suggested",children:(0,I.jsxs)(j.T,{size:16,weight:"semibold",colour:x.colours.goldLight,children:["Suggested for ",e.partySize,": ",(0,s.tableNumbers)(C)]})}):null,v?null:(0,I.jsx)(j.Button,{kind:"secondary",label:"Combine tables",testID:"combine-start",accessibilityLabel:"Combine tables: pick several tables for this party",onPress:()=>D(!0)}),(0,I.jsx)(N,{use:S,best:v?null:C,bestSet:(0,r.bestTables)(p),picked:v?$:void 0,onPick:v?e=>P(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]):async e=>{await A([e])}})]})}function L(e){(0,n.notify)({id:`walkin:${e.id}`,testID:'walkin-toast',timeoutMs:6e3,title:`${M(e)} seated \xb7 ${e.table?`${(0,s.tableNumbers)(e.table)}`:'table to assign'} (${e.ref})`,actions:[{label:'Undo',testID:'undo-walkin',onPress:()=>h.repo.bookings.undoWalkIn(e.id)},{label:'OK',kind:'ghost'}]})}function W({date:e,onClose:t,wide:n,onSaved:i}){const{rid:r,r:d,now:c,role:P,meId:O}=(0,b.useCtx)(6e4),z=(0,y.ymd)(c),[B,M]=(0,a.useState)(ee.blocks),[F,A]=(0,a.useState)(!1),[L,W]=(0,a.useState)(''),[E,H]=(0,a.useState)(2),[_,U]=(0,a.useState)(null),[q,V]=(0,a.useState)(''),[G,K]=(0,a.useState)(''),[Q,Y]=(0,a.useState)(''),[J,X]=(0,a.useState)('phone'),[Z,ee]=(0,a.useState)((0,C.emptyNeeds)()),te=(0,C.needsMissing)(Z),[se,oe]=(0,a.useState)(null),le=(0,w.usePlan)(r),ne=(0,$.dogSetUp)(le),ae=!0===Z.dog&&ne,ie=Z.dog?Z.dogs:0,re=(0,y.parseYmd)(B),de=(0,f.turnFor)(E,d.settings.turnMins),ue=N.filter(e=>e.date===B),ce=e=>(0,f.freeTablesAt)(le,ue,E,new Date(`${B}${(0,s.tableNumbers)(e)}:00`),de,d.settings.turnMins,{dog:!0,closed:(0,T.closedAreasAt)(R,r,B,e)}),be=ae&&_?ce(_):[];(0,a.useEffect)(()=>{oe(null)},[ae,_,E]);const he=(0,p.bookingSlots)(d,re,e=>N.filter(t=>t.date===B&&t.time===e&&'cancelled'!==t.status&&!t.walkIn).reduce((e,t)=>e+t.partySize,0),E,B===(0,y.ymd)(c)?c:(0,y.addMins)(re,0)),ge=(0,k.ukPhone)(G),pe=_?(0,T.blockAt)(R,r,B,_):void 0,me='staff'!==P,fe=!!_&&!(0,C.dogTimeOk)(d,N,B,_,ie),ye=!te.length&&L.trim().length>=2&&!!_&&ge.ok&&(0,k.emailOk)(Q)&&(!pe||me&&F)&&(!ae||be.length>0)&&!fe,xe=Z.wheelchair>0||Z.stepFree;return(0,I.jsxs)(j.Sheet,{visible:!0,onClose:t,title:`New booking \xb7 ${(0,y.niceDate)(re)}`,maxWidth:n?760:void 0,testID:"booking-sheet",children:[(0,I.jsx)(C.FirstQuestions,{rid:r,value:Z,onChange:ee,party:E,audience:"staff"}),Z.dog&&!ne?(0,I.jsx)(j.T,{size:13,colour:x.colours.amber,children:"Dog-friendly tables aren\u2019t marked yet. Managers \u203a Booking options \u203a Tables. Booking is allowed; check where the dog can sit."}):null,(0,I.jsx)(S.BookingDatePicker,{r:d,today:c,value:B,onChange:e=>{e!==B&&(M(e),U(null),A(!1))}}),(0,I.jsxs)(j.Row,{gap:6,children:[(0,I.jsx)(j.Chip,{label:"Phone",selected:'phone'===J,onPress:()=>X('phone')}),(0,I.jsx)(j.Chip,{label:"In person",selected:'in-person'===J,onPress:()=>X('in-person')})]}),(0,I.jsx)(j.Field,{label:"Name",value:L,onChangeText:W,placeholder:"e.g. Reid",testID:"nb-name"}),(0,I.jsx)(j.Field,{label:"Mobile or phone number (needed)",value:G,onChangeText:K,keyboardType:"phone-pad",placeholder:"e.g. 07700 900123",testID:"nb-phone"}),!ge.ok&&G?(0,I.jsx)(j.T,{size:13,colour:x.colours.amber,children:ge.error}):null,(0,I.jsx)(j.Field,{label:"Email (optional)",value:Q,onChangeText:Y,keyboardType:"email-address",autoCapitalize:"none",placeholder:"For an email confirmation too",testID:"nb-email"}),(0,k.emailOk)(Q)?null:(0,I.jsx)(j.T,{size:13,colour:x.colours.amber,children:"That email doesn\u2019t look quite right."}),(0,I.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,I.jsx)(j.T,{children:"Covers"}),(0,I.jsx)(j.Stepper,{value:E,onChange:H,min:1,max:20,label:"covers"})]}),(0,I.jsx)(j.Row,{wrap:!0,gap:6,children:he.map(e=>{const t=ae&&e.available&&!ce(e.time).length||!(0,C.dogTimeOk)(d,N,B,e.time,ie);return(0,I.jsx)(j.Chip,{label:e.time,sub:(0,T.blockAt)(R,r,B,e.time)?'Paused':t?'Dogs full':e.drinksOnly?'Drinks only':`${e.left} left`,disabled:!e.available||t,selected:_===e.time,onPress:()=>{U(e.time),A(!1)}},e.time)})}),ae&&_?(0,I.jsxs)(u.default,{style:{gap:6},testID:"nb-dog-tables",children:[(0,I.jsxs)(j.T,{size:14,weight:"semibold",children:["Dog-friendly table ",(0,I.jsxs)(j.T,{size:13,colour:x.colours.muted,children:["(",le.areas.filter(e=>e.dogs).map(e=>e.name).join(' or '),")"]})]}),be.length?(0,I.jsx)(j.Row,{wrap:!0,gap:6,children:be.slice(0,10).map((e,t)=>(0,I.jsx)(j.Chip,{label:`${(0,s.tableNumbers)(e.table)}`,sub:`${e.area} \xb7 ${e.seats}${0===t?' \xb7 best':''}${xe&&(0,$.accessibleSetUp)(le)&&!(0,$.isAccessible)(le,e.table)?' \xb7 not step-free':''}`,selected:(se??be[0].table)===e.table,onPress:()=>oe(e.table)},e.table))}):(0,I.jsxs)(j.T,{size:14,colour:x.colours.amber,children:["No dog-friendly table free for ",E," at ",_,". Try another time."]})]}):null,pe?(0,I.jsxs)(u.default,{testID:"nb-block-warning",style:{borderWidth:1.5,borderColor:x.colours.amber,backgroundColor:x.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[(0,I.jsxs)(j.T,{weight:"semibold",colour:x.colours.amber,children:["Bookings are paused ",pe.from,"\u2013",pe.to,pe.reason?` (${pe.reason})`:'']}),me?(0,I.jsx)(j.Chip,{label:F?'Manager override on':'Override and book anyway',selected:F,onPress:()=>A(e=>!e)}):(0,I.jsx)(j.Muted,{children:"Ask a manager to override, or pick another time."})]}):null,he.length?null:(0,I.jsx)(u.default,{testID:"nb-closed",children:(0,I.jsxs)(j.T,{size:14,weight:"semibold",colour:x.colours.amber,children:["Closed on ",(0,y.niceDate)(re)," (per the venue\u2019s opening hours). Pick another date."]})}),(0,I.jsx)(C.MoreQuestions,{rid:r,r:d,value:Z,onChange:ee,party:E,date:B,time:_,today:(0,y.ymd)(c),bookings:N,audience:"staff",showTables:!1!==d.settings.tableRequests}),xe&&!(0,$.accessibleSetUp)(le)?(0,I.jsx)(j.T,{size:13,colour:x.colours.amber,children:"Step-free tables aren\u2019t marked yet (Managers \u203a Booking options \u203a Tables). Check the table works for a wheelchair."}):null,(0,I.jsx)(j.Field,{label:"Notes (optional)",value:q,onChangeText:V,placeholder:v.NOTES_PLACEHOLDER,multiline:!0,numberOfLines:3,testID:"nb-notes"}),(0,l.depositDue)((0,l.depositOf)(d.settings),E)?(0,I.jsxs)(j.Muted,{children:["Deposit due: ",(0,o.gbp)((0,l.depositDue)((0,l.depositOf)(d.settings),E))," (",(0,o.gbp)((0,l.depositOf)(d.settings).perPersonPence)," per person for ",(0,l.depositOf)(d.settings).fromParty,"+). Deposits are paid through website bookings or to you, never in CoverCharge: tick Deposit paid on the booking once the guest has paid."]}):null,(0,I.jsxs)(j.Muted,{children:["The guest gets a confirmation text",Q.trim()?' and email':''," automatically (preview mode: shown in the Outbox, not sent)."]}),fe?(0,I.jsxs)(j.T,{size:14,colour:x.colours.amber,children:["We already have the most dogs we can look after at ",_,". Try another time: dogs are very welcome then."]}):null,(0,I.jsx)(j.Button,{label:te.length?te[0]:'Save booking',testID:"nb-save",disabled:!ye,onPress:()=>{if(B<(0,y.ymd)(c))return;const e=(0,C.needsPatch)(Z),s=Z.tableReq.find(e=>!ae||be.some(t=>t.table===e));h.repo.bookings.create({restaurantId:r,customerId:null,name:L.trim(),partySize:E,date:B,time:_,notes:q.trim(),security:(0,l.depositDue)((0,l.depositOf)(d.settings),E)?'deposit':'none',depositPaid:0,...(0,l.depositDue)((0,l.depositOf)(d.settings),E)?{depositDue:(0,l.depositDue)((0,l.depositOf)(d.settings),E),depositPolicy:(0,l.depositWords)((0,l.depositOf)(d.settings),E,d.name).join(' '),depositRefundable:(0,l.depositOf)(d.settings).refundable,depositCutoffHours:(0,l.depositOf)(d.settings).cutoffHours}:{},phone:ge.pretty,email:Q.trim()||void 0,source:J,...e,...he.find(e=>e.time===_)?.drinksOnly?{drinksOnly:!0}:{},allergies:e.allergies??[],...ae?{table:se??s??be[0]?.table}:{}}).then(e=>(0,D.postNewBookingToKitchen)(e,O)).catch(()=>{}),i?.({date:B,time:_,name:L.trim()}),t()}})]})}},926,[877,808,816,13,919,30,945,263,127,806,927,819,817,826,818,821,823,813,825,824,1298,827,812,950,828,24]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"fmtH",{enumerable:!0,get:function(){return d.fmtH}}),Object.defineProperty(_e,"fmtHDay",{enumerable:!0,get:function(){return d.fmtHDay}}),Object.defineProperty(_e,"clampRole",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"StaffAppCtx",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"useInStaffApp",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"ShiftMgrScope",{enumerable:!0,get:function(){return y}}),_e.useShiftManager=D,_e.useSignedIn=b,_e.useCtx=function(e=1e4){const o=(0,t.useContext)(p),u=(0,r.useOwner)(e=>e.site),i=(0,r.useOwner)(e=>e.previewRole),f=(0,r.useOwner)(e=>e.staffAs),d=b(),m=o||'staff'===s.APP_VARIANT,w=(0,t.useContext)(y),h=D(),O=m?w&&h?'manager':'staff':d?l(i,d.role):i,S=(0,r.useOwner)(e=>e.staff),M=(0,n.useRestaurant)(u),A=(0,n.useNow)(e),I=d?d.id:m&&f?f:c[O],P=S.find(e=>e.id===I)?.name??'Team member';return{rid:u,r:M,now:A,role:O,me:P,meId:I,today:(0,a.venueYmd)(A),signedIn:!!d}},Object.defineProperty(_e,"weekday",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"DAY3",{enumerable:!0,get:function(){return O}}),_e.ensureAttendance=function(t,n){if(e.LIVE_VENUE_BUILD||(0,o.isLive)())return;const s=r.useOwner.getState(),u=[],i=s.staff.find(e=>e.active&&'manager'===e.role)??s.staff.find(e=>e.active&&'owner'===e.role),f=new Date(n);f.setDate(n.getDate()-h(n));const d=(0,a.ymd)(f),c=(0,a.ymd)(new Date(f.getFullYear(),f.getMonth(),f.getDate()+6)),m=(e,t,n)=>{const r=new Date(e);return r.setHours(0,0,0,0),r.setMinutes(Math.round(60*t)+n),r.toISOString()};for(let e=42;e>=1;e--){const t=new Date(n);t.setDate(t.getDate()-e);const r=(0,a.ymd)(t);if(s.attendance.some(e=>e.date===r))continue;const o=s.shifts.filter(e=>e.date===r&&!1!==e.published);(o.length?o:s.shifts.filter(e=>e.day===h(t)&&e.date>=d&&e.date<=c&&!1!==e.published)).forEach((n,a)=>{const s=e=>Math.round((7*r.charCodeAt(9)+13*a+e)%17-5),o=n.end-n.start,f=o>8?30:o>6?20:0,d=e>2&&i?{signOff:{by:i.name,byId:i.id,at:m(t,34,a)}}:{};u.push({id:`at-${r}-${n.staffId}`,staffId:n.staffId,date:r,in:m(t,n.start,s(1)),out:m(t,n.end,s(2)),inSite:!0,outSite:!0,breakMins:f,...d})})}u.length&&r.useOwner.setState({attendance:[...r.useOwner.getState().attendance,...u]})},_e.paidMins=function(e,t){if(!e.in)return{worked:0,brk:0,paid:0};const n=Math.max(0,Math.round(((e.out?new Date(e.out):t).getTime()-new Date(e.in).getTime())/6e4)),r=e.breakMins??0;return{worked:n,brk:r,paid:Math.max(0,n-r)}},Object.defineProperty(_e,"hmDur",{enumerable:!0,get:function(){return S}}),_e.payRange=function(e,t,n){const r=new Date(n);if(r.setHours(0,0,0,0),'monthly'===e){const e=new Date(r.getFullYear(),r.getMonth()+t,1),n=new Date(e.getFullYear(),e.getMonth()+1,0);return{s:e,e:n,key:`m-${(0,a.ymd)(e)}`}}const s='weekly'===e?7:14,o=new Date(r);o.setDate(r.getDate()-h(r));let u=new Date(o);if('fortnightly'===e){const e=new Date(2026,0,5);(Math.round((o.getTime()-e.getTime())/6048e5)%2+2)%2==1&&u.setDate(u.getDate()-7)}u.setDate(u.getDate()+t*s);const i=new Date(u);return i.setDate(u.getDate()+s-1),{s:u,e:i,key:`${e[0]}-${(0,a.ymd)(u)}`}},_e.useHourly=function(){const e=b(),t=(0,r.useOwner)(e=>e.hourly);return e?t:M};var e=_r(_d[0]),t=_r(_d[1]),n=_r(_d[2]),r=_r(_d[3]),a=_r(_d[4]),s=_r(_d[5]),o=_r(_d[6]),u=_r(_d[7]),i=_r(_d[8]),f=_r(_d[9]),d=_r(_d[10]);const c={owner:f.ROSTER.find(e=>'owner'===e.role)?.id??'',manager:f.ROSTER.find(e=>'manager'===e.role)?.id??'',staff:f.ROSTER.find(e=>'staff'===e.app)?.id??''},m={staff:0,manager:1,owner:2},l=(e,t)=>m[e]>m[t]?t:e,p=(0,t.createContext)(!1),w=()=>(0,t.useContext)(p),y=(0,t.createContext)(!1);function D(){const e=(0,t.useContext)(p)||'staff'===s.APP_VARIANT,n=b(),r=(0,o.useSync)(e=>!!e.venueId&&'staff'===e.kind),a=(0,o.useSync)(e=>e.perms);return(0,u.shiftManagerOn)({inStaffApp:e,managerAccess:n?.managerAccess,role:n?.role,app:(0,i.rosterPerson)(n?.id)?.app,live:r,perms:a})}function b(){const e=(0,i.useSession)(e=>e.meId),t=(0,r.useOwner)(e=>e.staff);return e?t.find(t=>t.id===e&&t.active):void 0}const h=e=>(e.getDay()+6)%7,O=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'];const S=e=>`${Math.floor(e/60)}h ${String(e%60).padStart(2,'0')}m`;const M={}},927,[833,30,819,856,818,806,820,1031,859,14,1030]); +__d(function(_g,_r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"snap",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"fitLabel",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"BIG_LABEL_MIN",{enumerable:!0,get:function(){return y}}),_e.areaBounds=w,_e.minReadableScale=function(e,t){return Math.max(0,...e.tables.filter(e=>e.areaId===t).map(e=>{const t='round'===e.shape?.85:1,o=(7.4399999999999995*Math.max(1,(0,c.tableNumber)(e).length)+6)/(e.w*t),n=22/Math.min(e.w,e.h);return Math.max(o,n)}))},_e.seatSpots=M,_e.FixtureShape=j,_e.FloorCanvas=function(e){const[v,k]=(0,n.useState)({w:0,h:0}),C=e.plan.tables.filter(t=>t.areaId===e.areaId),I=e.crop&&C.length?w(e.plan,e.areaId):{x:0,y:0,w:s.PLAN_W,h:s.PLAN_H},z={x:I.x,y:I.y,r:I.x+I.w,b:I.y+I.h},R=v.w?'width'===e.fit?Math.min(v.w/s.PLAN_W,e.maxH?e.maxH/s.PLAN_H:9):Math.min(v.w/I.w,v.h/I.h):0,S=e.fill&&'contain'===e.fit&&R>0&&v.h>0,$=S?(v.w/R-I.w)/2:0,A=S?(v.h/R-I.h)/2:0,T={x:z.x-$,y:z.y-A,r:z.r+$,b:z.b+A},L=T.r-T.x,E=T.b-T.y,[N,F]=(0,n.useState)(null),_=(0,n.useRef)(null),B=t=>e.plan.sections.find(e=>e.id===t.sectionId),P=t=>e.plan.joins.find(e=>e.tables.includes(t.name)),D=r.default.useMemo(()=>(0,c.numberClashes)(e.plan.tables).sameArea,[e.plan.tables]),O=(t,o)=>({onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>!0,onResponderTerminationRequest:()=>!1,onResponderGrant:e=>{_.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY,id:t.id,kind:o}},onResponderMove:n=>{const r=_.current;if(!r)return;const i=n.nativeEvent.pageX-r.x,s=n.nativeEvent.pageY-r.y;Math.abs(i)+Math.abs(s)<6&&!N||('live'!==e.mode||e.onDrop&&e.view&&['seated','mains','dessert','bill'].includes(e.view[t.name]?.status)&&e.view[t.name]?.booking)&&F({id:t.id,dx:i,dy:s,kind:o})},onResponderRelease:n=>{const r=_.current;_.current=null;const i=n.nativeEvent.pageX-(r?.x??0),a=n.nativeEvent.pageY-(r?.y??0);if(F(null),Math.abs(i)+Math.abs(a)<6||!R)return void('move'===o&&e.onTap?.(t));const l=i/R,u=a/R;if('edit'===e.mode&&'move'===o)e.onMove?.(t,p(g(t.x+l,e.snapOn),0,s.PLAN_W-t.w),p(g(t.y+u,e.snapOn),0,s.PLAN_H-t.h));else if('edit'===e.mode&&'resize'===o)e.onResize?.(t,p(g(t.w+l,e.snapOn),50,400),p(g(t.h+u,e.snapOn),50,300));else if('live'===e.mode&&e.onDrop){const o=t.x+t.w/2+l,n=t.y+t.h/2+u,r=C.find(e=>e.id!==t.id&&o>=e.x-10&&o<=e.x+e.w+10&&n>=e.y-10&&n<=e.y+e.h+10);r&&e.onDrop(t,r)}}}),W=e=>e*R,H='width'===e.fit?s.PLAN_H*R||200:void 0;return(0,b.jsx)(i.default,{testID:"floor-canvas",onLayout:e=>k({w:e.nativeEvent.layout.width,h:e.nativeEvent.layout.height}),style:[{width:'100%',borderRadius:16,overflow:'hidden'},'contain'===e.fit?{flex:1}:{height:H}],children:R?(0,b.jsx)(i.default,{style:{width:W(L),height:W(E),alignSelf:'center',backgroundColor:(0,t.soutersSurface)('#0F0E0C'),borderRadius:16,borderWidth:1,borderColor:l.colours.border,overflow:'hidden'},children:(0,b.jsxs)(i.default,{style:{position:'absolute',left:-W(T.x),top:-W(T.y),width:W(s.PLAN_W),height:W(s.PLAN_H)},children:['edit'===e.mode?Array.from({length:s.PLAN_W/(2*s.GRID)},(e,o)=>(0,b.jsx)(i.default,{style:{position:'absolute',left:W(o*s.GRID*2),top:0,bottom:0,width:1,backgroundColor:(0,t.soutersSurface)('#1E1B16')}},`v${o}`)):null,'edit'===e.mode?Array.from({length:s.PLAN_H/(2*s.GRID)},(e,o)=>(0,b.jsx)(i.default,{style:{position:'absolute',top:W(o*s.GRID*2),left:0,right:0,height:1,backgroundColor:(0,t.soutersSurface)('#1E1B16')}},`h${o}`)):null,(e.plan.fixtures??[]).filter(t=>t.areaId===e.areaId).map(t=>(0,b.jsx)(j,{f:t,S:W,live:'live'===e.mode},t.id)),e.plan.joins.map(e=>{const t=C.filter(t=>e.tables.includes(t.name));if(t.length<2)return null;const[o,n]=t,r=o.x+o.w/2,s=o.y+o.h/2,a=n.x+n.w/2,l=n.y+n.h/2,u=Math.hypot(a-r,l-s),h=Math.atan2(l-s,a-r);return(0,b.jsx)(i.default,{testID:`join-${e.tables.join('+')}`,style:{position:'absolute',left:W((r+a)/2-u/2),top:W((s+l)/2)-3,width:W(u),height:6,borderRadius:3,backgroundColor:'rgba(207,164,95,0.55)',transform:[{rotate:`${h}rad`}]}},e.id)}),C.map(n=>{const g=e.view?.[n.name],p=g?a.STATUS[g.status]:a.STATUS.free,v=N?.id===n.id,w=v&&'resize'===N.kind?Math.max(50,n.w+N.dx/R):n.w,j=v&&'resize'===N.kind?Math.max(50,n.h+N.dy/R):n.h,k=v&&'move'===N.kind?n.x+N.dx/R:n.x,C=v&&'move'===N.kind?n.y+N.dy/R:n.y,I=e.selected===n.id||e.highlight?.includes(n.name),z=B(n),S='edit'===e.mode?'#2A2419':p.colour,$='edit'===e.mode?l.colours.text:p.fg,A='round'===n.shape?W(Math.min(w,j))/2:W(10),T='live'===e.mode?(0,c.liveTableLabel)(n,D):(0,s.tableLabel)(n),L=W(Math.min(w,j))<64,E=f(e.big?Math.max(13,Math.min(34,W(Math.min(w,j))/3)):Math.max(11,Math.min(22,W(Math.min(w,j))/4)),T,W(w)*('round'===n.shape?.85:1),e.big?y:9),F=Math.max(e.big?11:12,Math.round(.62*E)),_=(W(j)-6-1.4*E)/(1.4*F),H=_>=2&&W(w)>=5*F?2:_>=1?1:0,G=g?g.booking&&void 0!==g.seatedMins?g.booking.time:g.next?.time:void 0,X='edit'===e.mode?`${(0,o.tableNumbers)(T)}, ${(0,s.shapeLabel)(n.shape).toLowerCase()}, ${n.minSeats}\u2013${n.maxSeats} seats${n.online?', bookable online':''}`:`${(0,o.tableNumbers)(T)}, ${p.label}${void 0!==g?.seatedMins?`, seated ${g.seatedMins} min`:''}${g?.covers?`, ${g.covers} covers`:''}${void 0!==g?.nextIn&&'seated'!==g.status?`, next booking ${g.next?.time}`:''}${g?.dayBookings?.length?`, booked: ${g.dayBookings.map(e=>`${e.time}, ${e.partySize} Covers`).join('; ')}`:''}${g?.group?`, combined with ${g.group.filter(e=>e!==n.name).map(e=>`table ${e}`).join(', ')}`:''}`,Y=void 0!==g?.seatedMins&&g.booking?Math.min(1.2,g.seatedMins/(g.booking.durationMins??(0,a.turnFor)(g.booking.partySize,e.turnBase))):null;return(0,b.jsxs)(r.default.Fragment,{children:[M({...n,w:w,h:j}).map((t,o)=>(0,b.jsx)(i.default,{pointerEvents:"none",style:[{position:'absolute',left:W(k+t.x)-Math.max(4,W(8)),top:W(C+t.y)-Math.max(4,W(8)),width:Math.max(8,W(16)),height:Math.max(8,W(16)),borderRadius:99,backgroundColor:'edit'===e.mode?'#5A4C33':'rgba(255,255,255,0.16)',borderWidth:1,borderColor:'edit'===e.mode?l.colours.gold:'rgba(255,255,255,0.25)'},x()]},o)),'live'===e.mode&&(W(w)<44||W(j)<44)?(0,b.jsx)(i.default,{accessible:!1,importantForAccessibility:"no-hide-descendants",'aria-hidden':!0,...O(n,'move'),style:{position:'absolute',left:W(k+w/2)-Math.max(44,W(w))/2,top:W(C+j/2)-Math.max(44,W(j))/2,width:Math.max(44,W(w)),height:Math.max(44,W(j)),zIndex:2}}):null,(0,b.jsxs)(i.default,{testID:`table-${n.name}`,accessibilityRole:"button",accessibilityLabel:X,onAccessibilityTap:()=>e.onTap?.(n),onKeyDown:t=>{'Enter'!==t?.key&&' '!==t?.key||e.onTap?.(n)},tabIndex:0,...O(n,'move'),style:[{position:'absolute',left:W(k),top:W(C),width:W(w),height:W(j),borderRadius:A,backgroundColor:S,alignItems:'center',justifyContent:'center',padding:2,borderWidth:I?3:e.sectionColours&&z?2.5:1.5,borderColor:I?'#FFFFFF':e.sectionColours&&z?(0,l.brandColour)(z.colour):'edit'===e.mode?l.colours.gold:'rgba(0,0,0,0.35)',transform:[{scale:v?1.06:1}],zIndex:v?50:3,opacity:v&&'live'===e.mode?.85:1,shadowColor:'#000',shadowOpacity:v?.6:.3,shadowRadius:v?14:6,cursor:'edit'===e.mode?'grab':'pointer',touchAction:'none'},v?null:x()],children:[(0,b.jsxs)(i.default,{style:{alignItems:'center'},pointerEvents:"none",children:[(0,b.jsx)(u.T,{weight:"bold",size:E,colour:$,center:!0,numberOfLines:1,children:T}),'live'===e.mode&&'blocked'===g?.status?(0,b.jsx)(u.T,{size:Math.max(10,Math.round(.5*E)),weight:"semibold",colour:$,center:!0,numberOfLines:1,children:"Blocked"}):null,e.big&&'live'===e.mode&&g&&1===H?g.covers||G?(0,b.jsx)(u.T,{size:F,weight:"bold",colour:$,center:!0,numberOfLines:1,children:'free'===g.status||'soon'===g.status?G?`${g.dayBookings?'Booked':'Next'} ${G}`:'':[g.covers?`${g.covers}`:'',G??''].filter(Boolean).join(' \xb7 ')}):null:e.big&&'live'===e.mode&&g&&2===H?(0,b.jsxs)(b.Fragment,{children:[g.covers?(0,b.jsxs)(u.T,{size:F,weight:"semibold",colour:$,center:!0,children:[g.covers," cover",1===g.covers?'':'s']}):'free'!==g.status||L?null:(0,b.jsxs)(u.T,{size:F,colour:$,center:!0,children:[n.minSeats,"\u2013",n.maxSeats]}),G?(0,b.jsx)(u.T,{size:F,weight:"bold",colour:$,center:!0,children:'free'===g.status||'soon'===g.status?`${g.dayBookings?'Booked':'Next'} ${G}`:G}):'dirty'===g.status?(0,b.jsx)(u.T,{size:F,colour:$,center:!0,children:"Clear"}):null]}):e.big&&'live'===e.mode?null:'edit'===e.mode?L?null:(0,b.jsxs)(u.T,{size:11,colour:l.colours.muted,center:!0,children:[n.minSeats,"\u2013",n.maxSeats,n.online?' \xb7 online':'']}):g?(0,b.jsxs)(b.Fragment,{children:['free'!==g.status||L?null:(0,b.jsxs)(u.T,{size:11,colour:$,center:!0,children:[n.minSeats,"\u2013",n.maxSeats," seats"]}),void 0!==g.seatedMins?(0,b.jsxs)(u.T,{size:12,weight:"semibold",colour:$,center:!0,children:[g.seatedMins,"m \xb7 ",g.covers,"\ud83d\udc65"]}):g.orderOnly?(0,b.jsx)(u.T,{size:11,colour:$,center:!0,children:"Open order"}):null,'soon'===g.status&&g.next?(0,b.jsxs)(u.T,{size:11,weight:"semibold",colour:$,center:!0,children:[g.next.time," \xb7 ",void 0===g.nextIn?`${g.next.partySize} Covers`:g.nextIn<=0?'due':`${g.nextIn}m`]}):null,'dirty'!==g.status||L?null:(0,b.jsx)(u.T,{size:11,colour:$,center:!0,children:"Clear"}),!L||g.allergy||g.vip?(0,b.jsxs)(u.T,{size:11,colour:$,center:!0,children:[g.allergy?'\u26a0':'',g.vip?'VIP'===g.vip?'\u2605':'\u2665':'',g.occasion?a.OCCASION_ICON[g.occasion]:'',g.note?'\u270e':'']}):null]}):null]}),null,'live'===e.mode&&g&&!L&&(g.booking??g.next)&&(0,h.needsIcons)(g.booking??g.next).replace('\u26a0\ufe0f','').trim()?(0,b.jsx)(i.default,{pointerEvents:"none",testID:`needs-${n.name}`,style:{position:'absolute',bottom:e.big?-Math.max(9,.55*F):2,right:e.big?-6:4,backgroundColor:(0,t.soutersSurface)('rgba(11,11,11,0.85)'),borderRadius:8,paddingHorizontal:4,borderWidth:1,borderColor:'rgba(255,255,255,0.15)'},children:(0,b.jsx)(u.T,{size:e.big?Math.max(11,.75*F):10,children:(0,h.needsIcons)(g.booking??g.next).replace('\u26a0\ufe0f','').trim()})}):null,z&&'live'===e.mode&&e.sectionColours&&!L&&!e.big?(0,b.jsx)(i.default,{pointerEvents:"none",style:{position:'absolute',top:3,right:6,backgroundColor:(0,l.brandColour)(z.colour),borderRadius:6,paddingHorizontal:3},children:(0,b.jsx)(u.T,{size:9,weight:"bold",colour:"#0B0B0B",children:z.server})}):null,null===Y||L?null:(0,b.jsx)(i.default,{pointerEvents:"none",style:{position:'absolute',left:'15%',right:'15%',bottom:5,height:4,borderRadius:2,backgroundColor:'rgba(0,0,0,0.25)'},children:(0,b.jsx)(i.default,{style:{width:`${Math.min(100,100*Y)}%`,height:4,borderRadius:2,backgroundColor:Y>=1?'#B3261E':'rgba(0,0,0,0.6)'}})}),'live'===e.mode&&g?.group?(0,b.jsx)(i.default,{pointerEvents:"none",testID:`group-${n.name}`,style:{position:'absolute',top:e.big?-Math.max(10,.6*F):2,right:e.big?-6:3,backgroundColor:(0,t.soutersSurface)('#0B0B0B'),borderRadius:8,paddingHorizontal:5,borderWidth:1.5,borderColor:l.colours.gold},children:(0,b.jsxs)(u.T,{size:e.big?Math.max(12,.8*F):10,weight:"bold",colour:l.colours.goldLight,children:["\u26d3 ",(U=g.group,(0,s.tablesLabel)(U.join('+')).replace(/^Tables? /,'').replace(/ \+ /g,'+'))]})}):null,P(n)&&'edit'===e.mode?(0,b.jsx)(i.default,{pointerEvents:"none",style:{position:'absolute',bottom:2,left:4},children:(0,b.jsx)(u.T,{size:10,colour:l.colours.gold,children:"\u26d3"})}):null]}),'edit'===e.mode&&e.selected===n.id?(0,b.jsx)(i.default,{testID:"resize-handle",accessibilityLabel:"Resize table",...O(n,'resize'),style:{position:'absolute',left:W(k+w)-14,top:W(C+j)-14,width:28,height:28,borderRadius:14,backgroundColor:l.colours.gold,borderWidth:2,borderColor:'#fff',zIndex:60,cursor:'nwse-resize',touchAction:'none'}}):null]},n.id);var U}),0===C.length?(0,b.jsx)(i.default,{style:{position:'absolute',left:0,right:0,top:'45%'},children:(0,b.jsxs)(u.T,{center:!0,colour:l.colours.muted,children:["No tables in this area yet",'edit'===e.mode?' \u2014 add some in Tables':'',"."]})}):null]})}):null})};var t=_r(d[0]),o=_r(d[1]),n=_r(d[2]),r=e(n);_r(d[3]);var i=e(_r(d[4])),s=_r(d[5]),a=_r(d[6]),l=_r(d[7]),u=_r(d[8]),h=_r(d[9]),c=_r(d[10]),b=_r(d[11]);const x=(e=250)=>({transitionProperty:'background-color, border-color, transform, left, top, width, height',transitionDuration:`${e}ms`}),g=(e,t=!0)=>t?Math.round(e/s.GRID)*s.GRID:Math.round(e),p=(e,t,o)=>Math.max(t,Math.min(o,e)),f=(e,t,o,n=9)=>Math.max(n,Math.min(e,(o-6)/(.62*Math.max(1,t.length)))),y=12,v=46;function w(e,t){const o=e.tables.filter(e=>e.areaId===t);if(!o.length)return{x:0,y:0,w:s.PLAN_W,h:s.PLAN_H};const n=Math.max(0,Math.min(...o.map(e=>e.x))-v),r=Math.max(0,Math.min(...o.map(e=>e.y))-v);return{x:n,y:r,w:Math.min(s.PLAN_W,Math.max(...o.map(e=>e.x+e.w))+v)-n,h:Math.min(s.PLAN_H,Math.max(...o.map(e=>e.y+e.h))+v)-r}}function M(e){const t=Math.max(1,e.maxSeats),o=[];if('round'===e.shape){const n=e.w/2+9.6,r=e.h/2+9.6;for(let i=0;ie.w,r=Math.ceil(t/2),i=t-r;if(n){for(let t=0;te.w,a=n?{borderColor:'#FFFFFF',borderWidth:2}:null;return'bar'===e.kind?(0,b.jsx)(i.default,{pointerEvents:"none",style:[r,{backgroundColor:o?'#2A2216':'#3A2E1C',borderRadius:8,borderWidth:1.5,borderColor:o?'#5A4A30':l.colours.gold},a],children:(0,b.jsx)(u.T,{size:Math.max(9,Math.min(14,t(e.h)/2.4)),weight:"semibold",colour:l.colours.goldLight,children:"BAR"})}):'wall'===e.kind?(0,b.jsx)(i.default,{pointerEvents:"none",style:[r,{backgroundColor:o?'#3A3631':'#5C574F',borderRadius:2},a]}):'window'===e.kind?(0,b.jsx)(i.default,{pointerEvents:"none",style:[r,{backgroundColor:'rgba(226,196,137,0.16)',borderColor:'rgba(226,196,137,0.6)',borderWidth:1,borderRadius:2},a],children:!o&&t(s?e.h:e.w)>60?(0,b.jsx)(u.T,{size:9,colour:"#BFDDFF",style:s?{transform:[{rotate:'90deg'}]}:void 0,children:"WINDOW"}):null}):(0,b.jsx)(i.default,{pointerEvents:"none",style:[r,{borderColor:o?'#7A6440':l.colours.gold,borderWidth:1.5,borderStyle:'dashed',borderRadius:3,backgroundColor:'rgba(207,164,95,0.08)'},a],children:t(s?e.h:e.w)>40?(0,b.jsx)(u.T,{size:9,colour:l.colours.goldLight,style:s?{transform:[{rotate:'90deg'}]}:void 0,children:"DOOR"}):null})}},928,[868,808,30,122,127,825,826,821,813,950,945,24]); +__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"areaMarks",{enumerable:!0,get:function(){return u}}),_e.AreaTabs=function({plan:o,area:e,onPick:n,counts:a,closed:b}){return(0,c.jsx)(t.Row,{wrap:!0,gap:6,style:{alignItems:'center'},children:o.areas.map(o=>{const f=o.id===e,h=b?.has(o.id);return(0,c.jsx)(l.default,{testID:`area-${o.id}`,accessibilityRole:"tab",accessibilityLabel:`Area ${o.name}${o.dogs?', dogs allowed':''}${o.outdoor?', outdoor':''}${h?', closed for weather':''}`,accessibilityState:{selected:f},onPress:()=>n(o.id),style:{minHeight:48,paddingHorizontal:16,borderRadius:24,borderWidth:1.5,borderColor:f?s.colours.gold:h?s.colours.blue:s.colours.border,backgroundColor:f?s.colours.gold:s.colours.surface,justifyContent:'center'},children:(0,c.jsxs)(t.T,{weight:"semibold",size:15,colour:f?s.colours.onGold:s.colours.text,children:[o.name,u(o),h?(0,c.jsx)(t.T,{size:12,colour:f?s.colours.onGold:s.colours.blue,children:" closed"}):null,a?.[o.id]?(0,c.jsxs)(t.T,{size:12,colour:f?s.colours.onGold:s.colours.muted,children:[" ",a[o.id]]}):null]})},o.id)})})},r(d[0]);var o,e=r(d[1]),l=(o=e)&&o.__esModule?o:{default:o},s=r(d[2]),t=r(d[3]),c=r(d[4]);const u=o=>`${o.dogs?' \ud83d\udc3e':''}${o.outdoor?' \ud83c\udf26':''}`},929,[30,263,821,813,24]); +__d(function(_g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.saveBookingTables=j,_e.TablePicker=function({rid:e,booking:u,name:p,turnBase:f=90,onClose:v,onSaved:w,onPickOnPlan:T}){const $=(0,b.usePlan)(e),C=(0,c.useBookings)(e),[L,P]=(0,s.useState)(()=>(0,b.tablesOf)((0,h.tableKey)((0,b.tablesOf)(u.table)))),S=(0,s.useMemo)(()=>(0,h.pickGroups)($),[$]),W=C.filter(e=>e.date===u.date),z=(0,h.seatsOf)($,L),O=(0,h.seatLine)(z.total,u.partySize),D=(0,h.pickClashes)(u,L,W,f),I=e=>(0,h.pickClashes)(u,[e],W,f)[0]?.with,B=(0,h.tableKey)(L)!==(0,h.tableKey)((0,b.tablesOf)(u.table)),_=e=>P(l=>(0,h.toggleTable)(l,e)),M=async l=>{await j(e,u,l),w?.((0,h.savedWords)(p,u.partySize,l,(0,h.seatsOf)($,l).total)),v()},R=(0,k.jsxs)(n.default,{style:{gap:8},children:[(0,k.jsxs)(n.default,{testID:"table-pick-total",accessible:!0,accessibilityLabel:`${(0,h.tablesWords)(L)} picked. ${O.text}.`,children:[(0,k.jsx)(y.T,{size:18,weight:"semibold",colour:g.colours.goldLight,children:(0,h.tablesWords)(L)}),(0,k.jsx)(y.T,{size:17,colour:g.colours.text,children:O.text})]}),D.length?(0,k.jsx)(n.default,{testID:"table-pick-clash",accessible:!0,accessibilityLabel:`Warning. ${(0,h.clashWords)(D)} You can still save.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:g.colours.gold},children:(0,k.jsxs)(y.T,{size:16,weight:"semibold",colour:g.colours.goldLight,children:[(0,h.clashWords)(D)," You can still save."]})}):null,(0,k.jsxs)(y.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(y.Button,{testID:"table-pick-save",label:D.length?'Save anyway':'Save tables',disabled:!B||!L.length,accessibilityLabel:`${D.length?'Save anyway, ':'Save, '}${(0,h.tablesWords)(L)} for ${p}. ${O.text}.${D.length?` ${(0,h.clashWords)(D)}`:''}`,onPress:()=>M(L),style:[x,{flexGrow:1}]}),(0,b.tablesOf)(u.table).length?(0,k.jsx)(y.Button,{testID:"table-pick-clear",kind:"secondary",label:"Clear table",accessibilityLabel:`Clear table, take ${(0,h.tablesWords)((0,b.tablesOf)(u.table)).toLowerCase()} off ${p}`,onPress:()=>M([]),style:x}):null,(0,k.jsx)(y.Button,{testID:"table-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",onPress:v,style:x})]})]});return(0,k.jsxs)(y.Sheet,{visible:!0,onClose:v,title:`Tables \xb7 ${u.time} ${p} \xb7 ${u.partySize} Covers`,maxWidth:760,testID:"table-picker",footer:R,children:[(0,k.jsx)(l.TableNumberWarning,{plan:$}),(0,k.jsx)(y.T,{size:16,colour:g.colours.text,children:"Tap one table, or several to join them. Tap again to take one off."}),T?(0,k.jsx)(y.Button,{kind:"secondary",testID:"table-pick-on-plan",label:"Pick on the table plan",accessibilityLabel:`Pick on the table plan instead, for ${p}`,onPress:()=>T(L),style:x}):null,S.map(e=>(0,k.jsxs)(n.default,{style:{gap:6},accessibilityLabel:e.area,children:[(0,k.jsx)(y.T,{size:15,weight:"semibold",colour:g.colours.gold,children:e.area}),(0,k.jsx)(y.Row,{gap:8,wrap:!0,children:e.tables.map(e=>{const l=L.includes(e.name),s=I(e.name);return(0,k.jsxs)(o.default,{testID:`table-pick-${e.name}`,accessibilityRole:"checkbox",accessibilityState:{checked:l},'aria-checked':l,accessibilityLabel:(0,h.pickA11y)(e.name,e.seats,l,s),onPress:()=>_(e.name),style:({pressed:e})=>({minWidth:92,minHeight:64,paddingHorizontal:10,paddingVertical:6,borderRadius:12,alignItems:'center',justifyContent:'center',borderWidth:l?2:1,borderColor:l?g.colours.gold:s?g.colours.goldMuted:g.colours.hairline,borderStyle:s&&!l?'dashed':'solid',backgroundColor:l?g.colours.gold:e?g.colours.tilePressed:g.colours.tile}),children:[(0,k.jsx)(y.T,{size:18,weight:"semibold",colour:l?g.colours.onGold:g.colours.text,children:(0,t.tableNumbers)(e.name)}),(0,k.jsxs)(y.T,{size:14,colour:l?g.colours.onGold:g.colours.muted,children:[e.seats," seats",s?' \xb7 booked':'']})]},e.name)})})]},e.area)),S.length?null:(0,k.jsx)(y.Muted,{children:"No tables on the plan yet. Add them in Setup \u203a Table plan."})]})};var l=r(d[0]),t=r(d[1]),s=r(d[2]),o=e(r(d[3])),n=e(r(d[4])),c=r(d[5]),b=r(d[6]),u=r(d[7]),h=r(d[8]),g=r(d[9]),p=r(d[10]),y=r(d[11]),f=r(d[12]),k=r(d[13]);const x={minHeight:56};async function j(e,l,t){const s=(0,h.tableKey)(t),o=(0,b.tablesOf)(l.table);await c.repo.bookings.update(l.id,(0,u.tablePatch)(s||null)),'seated'===l.status&&l.date===(0,p.venueYmd)(new Date)&&(o.filter(e=>!(0,b.tablesOf)(s).includes(e)).forEach(l=>b.useFloor.getState().setLive(e,l,{stage:void 0,dirty:!0})),s&&(0,f.resetTableLive)(e,s))}},930,[914,808,30,263,127,819,825,1297,931,821,818,813,926,24]); +__d(function(_g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"byNum",{enumerable:!0,get:function(){return s}}),e.tableKey=o,e.toggleTable=function(t,n){return t.includes(n)?t.filter(t=>t!==n):a(o([...t,n]))},e.seatsOf=function(t,n){const a={};for(const s of n)a[s]=t.tables.find(t=>t.name===s)?.maxSeats??0;return{per:a,total:Object.values(a).reduce((t,n)=>t+n,0)}},e.seatLine=function(t,n){const a=Math.max(0,n-t);return{text:`${t} ${1===t?'seat':'seats'} for ${l(n)}${a?`: ${a} short`:''}`,short:a,fits:0===a&&t>0}},e.pickClashes=function(t,l,u,c=90){if(!l.length)return[];const f={...t,table:o(l)},b=[];for(const s of u)if(s.id!==t.id&&s.date===t.date&&!['cancelled','noshow','finished'].includes(s.status)&&(0,n.startOf)(f)<(0,n.endOf)(s,c)&&(0,n.startOf)(s)<(0,n.endOf)(f,c))for(const t of a(s.table))l.includes(t)&&b.push({table:t,with:s});return b.sort((t,n)=>s(t.table,n.table))},e.clashWords=function(n){return n.map(n=>`${(0,t.tableNumbers)(n.table)} has ${n.with.walkIn?'a walk-in':(n.with.name||'a booking').replace(' (example)','')} at ${n.with.time}`).join('. ')+(n.length?'.':'')},e.tablesWords=u,e.pickA11y=function(n,a,s,l){return`Table ${(0,t.tableNumbers)(n)}, ${a} ${1===a?'seat':'seats'}${s?', selected':''}${l?`, has ${l.walkIn?'a walk-in':l.name} at ${l.time}`:''}`},e.pickGroups=function(t){return t.areas.map(n=>({area:n.name,tables:t.tables.filter(t=>t.areaId===n.id).map(t=>({name:t.name,seats:t.maxSeats})).sort((t,n)=>s(t.name,n.name))})).filter(t=>t.tables.length)},e.savedWords=function(t,n,a,s){return a.length?`${t}, ${l(n)}: ${u(a)} (${s} seats).`:`${t}: table taken off.`},e.tableActions=function(t,n){const s=a(t.table);if(['cancelled','noshow'].includes(t.status))return[];const o=[s.length?{id:'assign',label:'Change table',a11y:`Change table for ${n}, ${l(t.partySize)}, now ${u(s).toLowerCase()}. You can pick several tables to join.`}:{id:'assign',label:'Assign table',a11y:`Assign table for ${n}, ${l(t.partySize)}. You can pick several tables to join.`}];s.length&&o.push({id:'clear',label:'Clear table',a11y:`Clear table for ${n}, take ${u(s).toLowerCase()} off this booking`});return o},e.dragTables=function(t,n,s){if(!s||'__none'===s||s===n)return null;const l=a(t);if(l.includes(s))return null;return o('__none'!==n&&l.includes(n)?l.map(t=>t===n?s:t):[s])};var t=r(d[0]),n=r(d[1]);const a=t=>t?t.split('+').map(t=>t.trim()).filter(Boolean):[],s=(t,n)=>t.localeCompare(n,'en-GB',{numeric:!0}),l=t=>`${t} ${1===t?'person':'people'}`;function o(t){return[...new Set(t.map(t=>String(t).trim()).filter(Boolean))].sort(s).join('+')}function u(n){const s=a(o(n));return s.length?(0,t.tableListNumbers)(s):'No table'}},931,[808,826]); +__d(function(g,r,i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ds",{enumerable:!0,get:function(){return h}}),_e.useCss=function(){(0,n.useEffect)(()=>{if(!x||document.getElementById('cc-alert-css'))return;const e=document.createElement('style');e.id='cc-alert-css',e.textContent=k,document.head.appendChild(e)},[])},_e.KindIcon=function({kind:e,size:t=22,colour:n}){const a={stroke:n??m.KIND_META[e].colour,strokeWidth:2,fill:'none',strokeLinecap:'round',strokeLinejoin:'round'};return(0,b.jsxs)(l.default,{width:t,height:t,viewBox:"0 0 24 24",children:['booking'===e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...a}),(0,b.jsx)(o.Path,{d:"M3 10h18M8 3v4M16 3v4M9 15l2 2 4-4",...a})]}):null,'pending'===e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Circle,{cx:"12",cy:"13",r:"8",...a}),(0,b.jsx)(o.Path,{d:"M12 9v4l2.5 2M9 2h6",...a})]}):null,'takeaway'===e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Path,{d:"M5 8h14l-1.2 12H6.2z",...a}),(0,b.jsx)(o.Path,{d:"M9 8V6a3 3 0 0 1 6 0v2",...a})]}):null,'email'===e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Rect,{x:"3",y:"5",width:"18",height:"14",rx:"2",...a}),(0,b.jsx)(o.Path,{d:"M3 7l9 6 9-6",...a})]}):null,'test'===e?(0,b.jsx)(o.Path,{d:"M12 2l2.4 6.6L21 9l-5.2 4.3L17.5 20 12 16.3 6.5 20l1.7-6.7L3 9l6.6-.4z",...a}):null]})},_e.SoundToggle=function({big:e}){const t=(0,m.useAlerts)(e=>e.prefs.muted);return(0,b.jsx)(a.default,{accessibilityRole:"switch",accessibilityState:{checked:!t},accessibilityLabel:t?'Alert sound off, tap to turn on':'Alert sound on, tap to mute',onPress:()=>m.useAlerts.getState().setPrefs({muted:!t}),style:{alignSelf:'flex-end',paddingHorizontal:12,paddingVertical:e?8:5,borderRadius:999,backgroundColor:'rgba(0,0,0,0.75)',borderWidth:1,borderColor:d.colours.border},children:(0,b.jsx)(u.T,{size:e?15:12,colour:t?d.colours.muted:d.colours.gold,children:t?'Sound off':'Sound on'})})},_e.AlertHost=function({variant:e,rid:t,me:a,onOpen:s,skipTakeaway:o}){const l=(0,m.useAlerts)(e=>e.live).filter(n=>!(n.rid!==t||'chef'===e&&'takeaway'!==n.kind||o&&'takeaway'===n.kind&&!n.test)),c=e=>'booking'===e.kind||'pending'===e.kind,d=l.filter(c),u=l.filter(e=>!c(e));A('managers'===e);const x=u.map(e=>e.id+':'+e.at).join('|'),h=(0,n.useRef)({me:a,onOpen:s});return h.current={me:a,onOpen:s},(0,n.useEffect)(()=>{const t=new Set(u.map(e=>`alert:${e.id}`));f.useSliders.getState().dismissWhere(e=>e.id.startsWith('alert:')&&!t.has(e.id)&&!e.id.startsWith('alert-keep:'));for(const t of u){const n=m.KIND_META[t.kind],a='display'===e;(0,f.notify)({id:`alert:${t.id}`,tone:T(t),big:a,testID:'alert-slider',kicker:`${n.kicker}${t.test?' \xb7 TEST':''}${t.nag?` \xb7 REMINDER ${t.nag}`:''} \xb7 ${y(t.at)}`,title:t.name,timeoutMs:S(t,e),content:({close:n})=>(0,b.jsx)(I,{a:t,variant:e,big:a,me:h.current.me,onOpen:h.current.onOpen,close:n}),onClose:()=>m.useAlerts.getState().dismiss(t.id)})}},[x,e]),(0,n.useEffect)(()=>()=>f.useSliders.getState().dismissWhere(e=>e.id.startsWith('alert:')),[]),(0,b.jsx)(p.BookingBanners,{alerts:d,big:'display'===e,managers:'managers'===e,me:a,onOpen:s,onClose:e=>m.useAlerts.getState().dismiss(e.id)})};var t=r(_d[0]),n=r(_d[1]);r(_d[2]);var a=e(r(_d[3])),s=e(r(_d[4])),o=r(_d[5]),l=e(o),c=r(_d[6]),d=r(_d[7]),u=r(_d[8]),p=r(_d[9]),f=r(_d[10]),m=r(_d[11]),b=r(_d[12]);const x='undefined'!=typeof document,h=e=>({dataSet:{ccal:e}}),k="\n[data-ccal=\"drop\"]{animation:ccal-drop .62s cubic-bezier(.16,1.1,.3,1) both}\n@keyframes ccal-drop{0%{opacity:0;transform:translate3d(0,-70px,0) scale(.94)}60%{opacity:1}100%{opacity:1;transform:none}}\n[data-ccal=\"big\"]{animation:ccal-big .8s cubic-bezier(.16,1.05,.3,1) both}\n@keyframes ccal-big{0%{opacity:0;transform:translate3d(0,-120px,0) scale(.86)}100%{opacity:1;transform:none}}\n[data-ccal=\"fade\"]{animation:ccal-fade .5s ease both}\n@keyframes ccal-fade{from{opacity:0}to{opacity:1}}\n[data-ccal=\"glow-gold\"]{animation:ccal-glow-gold 2.4s ease-in-out infinite}\n[data-ccal=\"glow-amber\"]{animation:ccal-glow-amber 1.6s ease-in-out infinite}\n[data-ccal=\"glow-ok\"]{animation:ccal-glow-ok 2.4s ease-in-out infinite}\n[data-ccal=\"glow-blue\"]{animation:ccal-glow-blue 2.4s ease-in-out infinite}\n@keyframes ccal-glow-gold{0%,100%{box-shadow:0 0 0 1.5px rgba(207,164,95,.9),0 10px 40px rgba(207,164,95,.28)}50%{box-shadow:0 0 0 1.5px #CFA45F,0 10px 70px rgba(207,164,95,.6)}}\n@keyframes ccal-glow-amber{0%,100%{box-shadow:0 0 0 1.5px rgba(255,181,71,.9),0 10px 40px rgba(255,181,71,.25)}50%{box-shadow:0 0 0 1.5px #FFB547,0 10px 70px rgba(255,181,71,.6)}}\n@keyframes ccal-glow-ok{0%,100%{box-shadow:0 0 0 1.5px rgba(207,164,95,.9),0 10px 40px rgba(207,164,95,.22)}50%{box-shadow:0 0 0 1.5px #CFA45F,0 10px 70px rgba(207,164,95,.5)}}\n@keyframes ccal-glow-blue{0%,100%{box-shadow:0 0 0 1.5px rgba(226,196,137,.9),0 10px 40px rgba(226,196,137,.22)}50%{box-shadow:0 0 0 1.5px #E2C489,0 10px 70px rgba(226,196,137,.5)}}\n[data-ccal=\"stars\"]{position:absolute;top:0;left:0;right:0;bottom:0;pointer-events:none;background-image:radial-gradient(1.2px 1.2px at 23px 41px,#fff,transparent),radial-gradient(1px 1px at 97px 13px,#fff9,transparent),radial-gradient(1.4px 1.4px at 151px 120px,#f5e6c8,transparent),radial-gradient(1px 1px at 61px 163px,#fffa,transparent),radial-gradient(1.6px 1.6px at 183px 77px,#CFA45F,transparent);background-size:211px 199px;opacity:.55;animation:ccal-drift 50s linear infinite}\n@keyframes ccal-drift{to{background-position:-211px 199px}}\n[data-ccal=\"space\"]{background:radial-gradient(ellipse at 50% 120%,#2a1f0c 0%,#0a0805 40%,#000 72%)}\n[data-ccal=\"sheen\"]{position:absolute;top:0;bottom:0;width:35%;left:-50%;pointer-events:none;background:linear-gradient(100deg,transparent,rgba(255,255,255,.09),transparent);animation:ccal-sheen 3.6s ease-in-out .5s infinite}\n@keyframes ccal-sheen{0%{left:-50%}40%,100%{left:130%}}\n[data-ccal=\"dot\"]{animation:ccal-dot 1s ease-in-out infinite alternate}\n@keyframes ccal-dot{from{opacity:.25}to{opacity:1}}\n[data-ccal=\"bar\"]{animation-name:ccal-bar;animation-timing-function:linear;animation-fill-mode:both}\n@keyframes ccal-bar{from{transform:scaleX(1)}to{transform:scaleX(0)}}\n[data-ccal=\"ring\"]{animation:ccal-ring 1.4s ease-out infinite}\n@keyframes ccal-ring{0%{transform:scale(1);opacity:.7}100%{transform:scale(1.9);opacity:0}}\n[data-ccal=\"phase-gold\"]{animation:ccal-phase 1.8s ease-in-out infinite}\n@keyframes ccal-phase{0%,100%{background-color:rgba(40,28,6,.92)}50%{background-color:rgba(255,181,71,.55)}}\n[data-ccal=\"flash-red\"]{animation:ccal-red 1s steps(2,jump-none) infinite}\n@keyframes ccal-red{0%{background-color:#5A0E08}100%{background-color:#D9302A}}\n[data-ccal=\"pulse-btn\"]{animation:ccal-pulse 1.2s ease-in-out infinite}\n@keyframes ccal-pulse{0%,100%{transform:scale(1)}50%{transform:scale(1.04)}}\n@media (prefers-reduced-motion: reduce){[data-ccal]{animation:none !important;transition:none !important}}\n";const y=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`};function w({label:e,value:t,big:n}){return(0,b.jsxs)(s.default,{style:{minWidth:n?130:66,flexGrow:1,paddingVertical:n?10:6,paddingHorizontal:n?14:10,borderRadius:10,backgroundColor:'rgba(255,255,255,0.04)',borderWidth:1,borderColor:'rgba(207,164,95,0.22)'},children:[(0,b.jsx)(u.T,{size:n?13:10,weight:"semibold",colour:f.SLIDER.quiet,style:{letterSpacing:1.4},children:e}),(0,b.jsx)(u.T,{size:n?28:16,weight:"bold",numberOfLines:1,children:t})]})}function j({label:e,onPress:t,kind:n="primary",testID:a,big:s}){return(0,b.jsx)(f.SliderButton,{a:{label:e,kind:n,testID:a,onPress:t,keepOpen:!0},onDone:()=>{},big:s})}const S=(e,t)=>'display'===t?12e3:'chef'===t?15e3:'pending'===e.kind||'takeaway'===e.kind?null:1e4,T=e=>e.allergy?'urgent':'pending'===e.kind?'warn':'normal';function I({a:e,variant:a,big:o,me:l,onOpen:p,close:m}){const[x,h]=(0,n.useState)(!1),[k,y]=(0,n.useState)(null),S=e=>{y(e),setTimeout(m,1800)},T='managers'===a,I=l??'Manager',A='takeaway'===e.kind?[['ORDER',e.orderNo??''],['ITEMS',String(e.items??'')],['TOTAL',e.total??''],['COLLECT',e.collect??'']]:'email'===e.kind?[]:[['TIME',e.when??''],['COVERS',String(e.covers??'')],...e.table?[['TABLE',(0,t.tableNumbers)(e.table)]]:[],['SOURCE',e.source??'']];return(0,b.jsxs)(s.default,{testID:`alert-${e.kind}`,style:{gap:o?12:8},children:['email'===e.kind?(0,b.jsx)(u.T,{size:o?22:14,numberOfLines:2,children:e.subject}):null,A.length?(0,b.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:o?10:6},children:A.map(([e,t])=>(0,b.jsx)(w,{label:e,value:t,big:o},e))}):null,e.allergy?(0,b.jsxs)(s.default,{testID:"alert-allergy",style:{flexDirection:'row',gap:10,alignItems:'center',borderLeftWidth:4,borderColor:d.colours.red,backgroundColor:'rgba(255,107,94,0.10)',borderRadius:8,padding:o?12:8},children:[(0,b.jsx)(u.T,{size:o?16:11,weight:"bold",colour:d.colours.red,style:{letterSpacing:1.6},children:"ALLERGY"}),(0,b.jsxs)(s.default,{style:{flex:1},children:[(0,b.jsx)(u.T,{size:o?22:14,weight:"semibold",colour:"#FFE1DC",children:e.allergy}),e.allergyStep?(0,b.jsx)(u.T,{size:o?15:11,colour:"#FFC4BB",children:e.allergyStep}):null]})]}):null,'pending'===e.kind&&'managers'!==a?(0,b.jsx)(u.T,{size:o?18:13,colour:d.colours.amber,children:"Waiting for a manager to confirm it in the Managers app."}):null,'email'===e.kind&&e.test?(0,b.jsx)(u.T,{size:12,colour:f.SLIDER.quiet,children:"Test only. No venue email is connected yet."}):null,k?(0,b.jsx)(u.T,{size:14,weight:"semibold",colour:d.colours.goldLight,children:k}):null,(0,b.jsxs)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'flex-end',alignItems:'center'},children:[T&&!k?'pending'===e.kind?x?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(u.T,{size:14,colour:"#FFE1DC",style:{flexBasis:'100%'},children:["Decline this booking? We\u2019ll let ",e.name," know by text",e.test?' (test: nothing happens)':' (preview mode)',"."]}),(0,b.jsx)(j,{kind:"danger",label:"Yes, decline it",testID:"alert-decline-yes",onPress:()=>{e.refId&&!e.test&&c.repo.bookings.decide(e.refId,'declined',I),S('Declined. The guest\u2019s message is in the Outbox.')}}),(0,b.jsx)(j,{kind:"ghost",label:"Keep it",onPress:()=>h(!1)})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(j,{label:"Confirm",testID:"alert-confirm",onPress:()=>{e.refId&&!e.test&&c.repo.bookings.decide(e.refId,'confirmed',I),S(e.test?'Test alert: nothing to confirm.':'Confirmed. Their confirmation is ready in the Outbox.')}}),(0,b.jsx)(j,{kind:"danger",label:"Decline",testID:"alert-decline",onPress:()=>h(!0)})]}):'takeaway'===e.kind?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(j,{label:"Accept",testID:"alert-accept",onPress:async()=>{const t=!(e.refId&&!e.test)||await c.repo.orders.accept(e.refId,I);S(t?'Accepted.':'Accepted. The allergy sign-off is still needed before cooking.')}}),[15,20,30].map(t=>(0,b.jsx)(j,{kind:"ghost",label:`Ready in ${t}`,onPress:async()=>{const n=!(e.refId&&!e.test)||await c.repo.orders.accept(e.refId,I,t);S(`Accepted, ready in ${t} minutes.${n?'':' Allergy sign-off still needed.'}`)}},t))]}):'booking'===e.kind&&p?(0,b.jsx)(j,{kind:"ghost",label:"View bookings",onPress:()=>{m(),p(e)}}):null:null,k?null:(0,b.jsx)(j,{kind:"ghost",label:!T||'pending'!==e.kind&&'takeaway'!==e.kind?'Close':'Later',testID:"alert-close",onPress:m})]})]})}function A(e){const t=(0,m.useAlerts)(e=>e.askedSystem);(0,n.useEffect)(()=>{if(!e||t||'default'!==(0,m.systemSupport)())return;const n=setTimeout(()=>(0,f.notify)({id:'notify-prompt',testID:'notify-prompt',icon:'\ud83d\udd14',title:'Get booking alerts on this device?',body:'We\u2019ll let you know about new bookings, requests to confirm and takeaway orders, even when the app is in the background. You can change this any time in More, Alerts and sounds.',actions:[{label:'Turn on alerts',testID:'notify-allow',onPress:()=>{(0,m.requestSystemPermission)().then(()=>m.useAlerts.getState().setAsked())}},{label:'Not now',kind:'ghost',onPress:()=>m.useAlerts.getState().setAsked()}]}),2500);return()=>clearTimeout(n)},[e,t])}},932,[808,30,122,263,127,948,819,821,813,1349,919,934,24]); +__d(function(g,r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"unconfirmedTakeaways",{enumerable:!0,get:function(){return x}}),_e.useBuildingChime=function(e,s=4e3,i=6e4){const o=(0,a.useAlerts)(e=>e.prefs.muted);(0,t.useEffect)(()=>{if(!e||o)return;const t=Date.now(),l=()=>(0,c.lowChime)(Math.min(1,(Date.now()-t)/i));l();const n=setInterval(l,s);return()=>clearInterval(n)},[e,o,s,i])},_e.TakeawayFacts=b,_e.TakeawayTakeover=function({rid:e,me:i}){const o=(0,l.useOrders)(e),n=x(o),a=n[0],c=s.default.useRef(i);return c.current=i,(0,t.useEffect)(()=>{a?(0,f.notify)({id:'takeaway-takeover',tone:a.allergies.length?'urgent':'warn',modal:!0,big:!0,testID:'takeaway-takeover',icon:'\ud83e\udd61',kicker:'NEW TAKEAWAY ORDER',title:`Order ${a.ref}: read it, then tap Confirm`,body:"This stays on screen until someone confirms."+(n.length>1?` ${n.length-1} more waiting.`:''),timeoutMs:null,content:()=>(0,j.jsx)(y,{rid:e,id:a.id,me:c.current})}):(0,f.dismissNotice)('takeaway-takeover')},[a?.id,n.length,e]),(0,t.useEffect)(()=>()=>(0,f.dismissNotice)('takeaway-takeover'),[]),null};var t=r(d[0]),s=e(t),i=e(r(d[1])),o=e(r(d[2])),l=r(d[3]),n=r(d[4]),a=r(d[5]),c=r(d[6]),u=r(d[7]),h=r(d[8]),f=r(d[9]),j=r(d[10]);const w=e=>e?new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}):'As soon as possible',x=e=>e.filter(e=>'takeaway'===e.type&&'new'===e.status&&!e.accepted).sort((e,t)=>e.createdAt.localeCompare(t.createdAt));function b({o:e,big:t,personal:s=!0}){const o=t?1:.8;return(0,j.jsxs)(i.default,{style:{gap:10},children:[(0,j.jsxs)(i.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:18},children:[(0,j.jsxs)(i.default,{children:[(0,j.jsx)(h.T,{size:13*o+2,colour:u.colours.muted,children:"Collection"}),(0,j.jsx)(h.T,{size:34*o,weight:"bold",colour:u.colours.goldLight,children:w(e.slotTime)})]}),s?(0,j.jsxs)(i.default,{children:[(0,j.jsx)(h.T,{size:13*o+2,colour:u.colours.muted,children:"Customer"}),(0,j.jsx)(h.T,{size:26*o,weight:"semibold",children:e.customerName})]}):null,s?(0,j.jsxs)(i.default,{children:[(0,j.jsx)(h.T,{size:13*o+2,colour:u.colours.muted,children:"Phone"}),(0,j.jsx)(h.T,{size:26*o,weight:"semibold",children:e.phone??'Not given'})]}):null,(0,j.jsxs)(i.default,{children:[(0,j.jsx)(h.T,{size:13*o+2,colour:u.colours.muted,children:"Order"}),(0,j.jsx)(h.T,{size:26*o,weight:"semibold",children:e.ref})]})]}),e.allergies.length?(0,j.jsxs)(i.default,{testID:"takeover-allergy",style:{backgroundColor:'#7A140D',borderRadius:12,padding:12,borderWidth:2,borderColor:'#FFB3AB'},children:[(0,j.jsxs)(h.T,{size:22*o,weight:"bold",colour:"#FFFFFF",children:["\u26a0 ALLERGY: ",e.allergies.map(e=>`${(0,n.allergenLabel)(e.allergen)} (${(0,n.severityLabel)(e.severity)})`).join(', ')]}),e.lines.filter(e=>e.overridden).map((e,t)=>(0,j.jsxs)(h.T,{size:16*o,weight:"semibold",colour:"#FFE3DF",children:["Customer overrode a warning: ",e.name," contains ",e.contains.map(n.allergenLabel).join(', ')]},t))]}):(0,j.jsx)(h.T,{size:16*o,colour:u.colours.ok,children:"No allergies declared"}),(0,j.jsx)(i.default,{style:{gap:4},children:e.lines.map((e,t)=>(0,j.jsxs)(h.T,{size:22*o,weight:"semibold",children:[e.qty," \xd7 ",e.name,e.choices.length?` (${e.choices.join(', ')})`:'',e.notes?` \xb7 \u201c${e.notes}\u201d`:'']},t))})]})}function y({rid:e,id:t,me:s}){const n=(0,l.useOrders)(e).find(e=>e.id===t),{width:a}=(0,o.default)();return n?(0,j.jsxs)(i.default,{style:{gap:12},children:[(0,j.jsx)(b,{o:n,big:a>=700}),(0,j.jsx)(h.Button,{label:`Confirm order ${n.ref}`,testID:"takeover-confirm",onPress:()=>{l.repo.orders.accept(n.id,s)},style:{minHeight:72,borderRadius:14}})]}):null}},933,[30,127,287,819,814,934,923,821,813,919,24]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"chime",{enumerable:!0,get:function(){return l.chime}}),e.sendTestAlert=function(t,a){const o={rid:t,at:Date.now(),test:!0},c='pending'===a?{...o,id:`test-pending:${Date.now()}`,kind:'pending',name:'Test guest',when:'Today 19:30',covers:10,source:'Online'}:'takeaway'===a?{...o,id:`test-takeaway:${Date.now()}`,kind:'takeaway',name:'Test guest',orderNo:'T-TEST',items:3,total:'\xa324.50',collect:'18:45',source:'Online',allergy:'Milk (allergy)',allergyStep:'Test only: no sign-off needed'}:'email'===a?{...o,id:`test-email:${Date.now()}`,kind:'email',name:'CoverCharge test',subject:'This is a test alert. No real email was received.'}:{...o,id:`test-booking:${Date.now()}`,kind:'test'===a?'test':'booking',name:'Test guest',when:'Today 19:30',covers:4,table:'7',source:'Phone',allergy:'Peanuts (allergy)',allergyStep:'Test only: no sign-off needed'};n.useAlerts.getState().raise(c)};var t=r(d[0]);Object.keys(t).forEach(function(n){'default'===n||Object.prototype.hasOwnProperty.call(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[n]}})});var n=r(d[1]);Object.keys(n).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})});var a=r(d[2]);Object.keys(a).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return a[t]}})});var o=r(d[3]);Object.keys(o).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return o[t]}})});var c=r(d[4]);Object.keys(c).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return c[t]}})});var l=r(d[5]),s=r(d[6]);Object.keys(s).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return s[t]}})})},934,[1350,1351,1353,1352,1354,923,1355]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BlockList=p,_e.BlockBookingsSheet=B,_e.BlocksBanner=function({rid:e,now:o,big:s,by:l="staff"}){const t=(0,i.useBlocks)(e=>e.blocks),r=(0,i.useBlocks)(e=>e.remove),a=(0,i.activeBlock)(t,e,(0,c.ymd)(o),(0,c.hm)(o));return a?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(M,{rid:e,now:o,big:s}),(0,f.jsxs)(n.default,{testID:"blocks-banner",accessibilityRole:"summary",style:{flexDirection:'row',alignItems:'center',gap:10,backgroundColor:u.colours.amberBg,borderColor:u.colours.amber,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[(0,f.jsx)(b.T,{size:s?20:16,children:"\u23f8"}),(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",colour:u.colours.amber,style:{flex:1},children:(0,i.pausedLine)(a)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Undo",testID:"blocks-undo",onPress:()=>{r(a.id,l),(0,m.pushBlocksToWix)(e,[a.id],'remove')}})]})]}):(0,f.jsx)(M,{rid:e,now:o,big:s})},_e.BlockBookingsButton=function({rid:e,r:o,now:a,by:d,wide:m,big:x,quiet:j,tile:k,display:p}){const[y,w]=(0,s.useState)(!1),C=(0,i.useBlocks)(e=>e.blocks),v=(0,i.currentBlocks)(C,e,(0,c.ymd)(a),(0,c.hm)(a)).length;return k?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(l.ActionTile,{testID:"block-bookings",icon:"pause",label:"Block bookings",sub:v?`${v} block${1===v?'':'s'} on now`:'Pause online times',count:v||void 0,onPress:()=>w(!0),accessibilityLabel:"Block bookings"}),y?(0,f.jsx)(B,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>w(!1)}):null]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(r.default,{testID:"block-bookings",accessibilityRole:"button",accessibilityLabel:"Block bookings",onPress:()=>w(!0),style:({pressed:e})=>j?{...t.look.quiet(e),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:u.colours.gold,borderRadius:16,paddingVertical:x?14:10,paddingHorizontal:18,backgroundColor:e?u.colours.goldTint:'transparent'},children:[j?null:(0,f.jsx)(b.T,{size:x?22:17,colour:u.colours.gold,children:"\u23f8"}),(0,f.jsx)(b.T,{size:j?15:x?22:17,weight:"semibold",colour:j?u.colours.goldLight:u.colours.gold,children:"Block bookings"}),v?(0,f.jsx)(n.default,{style:{backgroundColor:u.colours.amber,borderRadius:10,minWidth:22,paddingHorizontal:6},children:(0,f.jsx)(b.T,{size:13,weight:"bold",colour:u.colours.onGold,center:!0,children:v})}):null]}),y?p?(0,f.jsx)(h.DisplayBlocksMenu,{rid:e,r:o,now:a,by:d,onClose:()=>w(!1)}):(0,f.jsx)(B,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>w(!1)}):null]})},_e.closeOutdoor=C,_e.useOutdoor=v,_e.CloseGardenButton=function({rid:e,r:o,now:s,by:n,big:a,quiet:d,short:c,tile:h}){const m=v(e,s);if(!m.outdoor.length)return null;const x=m.allClosed;return h?(0,f.jsx)(l.ActionTile,{testID:x?'reopen-garden':'close-garden',icon:x?'sun':'rain',tone:x?'blue':'gold',label:x?'Reopen garden':'Close garden',sub:x?'Closed for weather':'For weather',accessibilityLabel:x?'Reopen garden':'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):C(e,o,s,n,m.outdoor.filter(e=>!m.closed.has(e.id)))}):(0,f.jsxs)(r.default,{testID:x?'reopen-garden':'close-garden',accessibilityRole:"button",accessibilityLabel:x?'Reopen garden':'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):C(e,o,s,n,m.outdoor.filter(e=>!m.closed.has(e.id))),style:({pressed:e})=>d?{...t.look.quiet(e,x?'blue':'gold'),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:x?u.colours.blue:u.colours.gold,borderRadius:16,paddingVertical:a?14:10,paddingHorizontal:16,minHeight:48,backgroundColor:e?u.colours.goldTint:x?u.colours.blueBg:'transparent'},children:[d?null:(0,f.jsx)(b.T,{size:a?22:17,children:x?'\u2600\ufe0f':'\ud83c\udf27'}),(0,f.jsx)(b.T,{size:d?15:a?20:16,weight:"semibold",colour:x?u.colours.blue:d?u.colours.goldLight:u.colours.gold,children:x?'Reopen garden':c?'Close garden':'Close garden for weather'})]})},_e.GardenBanner=M;var o=_r(_d[0]),s=_r(_d[1]),l=_r(_d[2]),t=_r(_d[3]),r=e(_r(_d[4])),n=e(_r(_d[5])),i=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),b=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),f=_r(_d[14]);const x=e=>(0,c.fromMins)(15*Math.floor((60*e.getHours()+e.getMinutes())/15)),j=(e,o)=>e.date===o?'Today':(0,c.niceDate)((0,c.parseYmd)(e.date));function k({title:e,sub:o,onPress:s,testID:l,disabled:t}){return(0,f.jsxs)(r.default,{testID:l,accessibilityRole:"button",accessibilityLabel:e,disabled:t,onPress:s,style:({pressed:e})=>({borderWidth:1.5,borderColor:u.colours.gold,borderRadius:16,padding:16,backgroundColor:e?u.colours.goldTint:u.colours.surface2,opacity:t?.4:1}),children:[(0,f.jsx)(b.T,{size:20,weight:"semibold",colour:u.colours.gold,children:e}),o?(0,f.jsx)(b.Muted,{children:o}):null]})}function p({rid:e,now:l,by:t="staff"}){const r=(0,i.useBlocks)(e=>e.blocks),a=(0,i.useBlocks)(e=>e.remove),[d,h]=(0,s.useState)(null),x=(0,c.ymd)(l),k=(0,i.currentBlocks)(r,e,x,(0,c.hm)(l));return k.length?(0,f.jsxs)(n.default,{style:{gap:8},testID:"block-list",children:[k.map(e=>{const s=e.date===x&&(0,c.toMins)(e.from)<=(0,c.toMins)((0,c.hm)(l));return(0,f.jsxs)(b.Row,{style:{justifyContent:'space-between',borderWidth:1,borderColor:s?u.colours.amber:u.colours.border,borderRadius:12,padding:10},children:[(0,f.jsxs)(n.default,{style:{flex:1},children:[(0,f.jsxs)(b.T,{weight:"semibold",children:[e.areaId?`${e.areaName??'Area'} closed \xb7 `:'',e.tables?.length?`${e.tables.map(o.tableNumbers).join(', ')} \xb7 `:'',j(e,x)," \xb7 ",e.from,"\u2013",e.to,s?' \xb7 now':'']}),(0,f.jsxs)(b.Muted,{children:[e.reason??'No reason given'," \xb7 by ",e.by,e.areaId?' \xb7 the rest of the venue stays open':'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Remove",testID:`block-remove-${e.id}`,onPress:()=>h(e)})]},e.id)}),d?(0,f.jsxs)(b.Sheet,{visible:!0,onClose:()=>h(null),title:"Remove this block?",testID:"block-remove-confirm",children:[(0,f.jsx)(b.T,{children:`${j(d,x)}, ${d.from}\u2013${d.to}. Bookings open again for that time.`}),(0,f.jsx)(b.Button,{testID:"block-remove-yes",label:"Remove block",onPress:()=>{a(d.id,t),(0,m.pushBlocksToWix)(e,[d.id],'remove'),h(null)}}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Keep it",onPress:()=>h(null)})]}):null]}):(0,f.jsx)(b.Muted,{children:"No bookings paused. Online and staff bookings are open as normal."})}function y({value:e,onChange:o}){return(0,f.jsxs)(n.default,{style:{gap:6},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Reason (optional)"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:i.BLOCK_REASONS.map(s=>(0,f.jsx)(b.Chip,{label:s,selected:e===s,onPress:()=>o(e===s?void 0:s)},s))})]})}function w({label:e,value:o,onChange:s,min:l,max:t}){return(0,f.jsxs)(b.Row,{gap:8,children:[(0,f.jsx)(b.T,{style:{width:52},children:e}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"\u221230",accessibilityLabel:`${e} 30 minutes earlier`,onPress:()=>s(Math.max(l,o-30))}),(0,f.jsx)(b.T,{size:22,weight:"semibold",colour:u.colours.gold,style:{minWidth:70,textAlign:'center'},children:(0,c.fromMins)(o)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"+30",accessibilityLabel:`${e} 30 minutes later`,onPress:()=>s(Math.min(t,o+30))})]})}function B({rid:e,r:o,now:l,by:t,onClose:r,wide:a}){const u=(0,i.useBlocks)(e=>e.add),[h,m]=(0,s.useState)('menu'),[j,B]=(0,s.useState)(),C=(0,c.ymd)(l),v=(0,d.hoursFor)(o,l),M=v?(0,c.hm)(v.close):null,P=x(l),T=!!v&&(0,c.toMins)(P)<(0,c.toMins)(M),I=(0,c.fromMins)((0,c.toMins)(P)+60),R=(0,s.useMemo)(()=>{const e=[];for(let s=1;s<=28;s++){const t=new Date(l);t.setHours(12,0,0,0),t.setDate(t.getDate()+s),(0,d.hoursFor)(o,t)&&e.push(t)}return e},[C,o.id]),[$,z]=(0,s.useState)(R[0]?(0,c.ymd)(R[0]):C),S=(0,d.hoursFor)(o,(0,c.parseYmd)($)),L=S?(0,c.toMins)((0,c.hm)(S.open)):720,F=S?(0,c.toMins)((0,c.hm)(S.close)):1260,[W,A]=(0,s.useState)(null),N=W??{from:L,to:F},H=(o,s,l)=>{u({rid:e,date:o,from:s,to:l,reason:j,by:t}),r()};return(0,f.jsx)(b.Sheet,{visible:!0,onClose:r,title:"Block bookings",maxWidth:a?720:void 0,testID:"block-sheet",children:'menu'===h?(0,f.jsxs)(n.default,{style:{gap:10},children:[(0,f.jsx)(b.Muted,{children:"Pause new bookings for a while. The customer app stops offering those times, and staff get a warning."}),(0,f.jsx)(k,{testID:"block-today",title:"Today",sub:T?`Now until close (${M}) or for 1 hour`:'Closed for the rest of today',disabled:!T,onPress:()=>m('today')}),(0,f.jsx)(k,{testID:"block-future",title:"Future dates",sub:"Pick a date and a time window",onPress:()=>m('future')}),(0,f.jsx)(D,{rid:e,r:o,now:l,by:t,onDone:r}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Active and upcoming"}),(0,f.jsx)(p,{rid:e,now:l})]}):'today'===h?(0,f.jsxs)(n.default,{style:{gap:10},children:[(0,f.jsx)(y,{value:j,onChange:B}),(0,f.jsx)(k,{testID:"block-until-close",title:"From now until close",sub:`${P} to ${M} (kitchen close, from opening hours)`,onPress:()=>H(C,P,M)}),(0,f.jsx)(k,{testID:"block-one-hour",title:"From now for 1 hour",sub:`${P} to ${I}`,onPress:()=>H(C,P,I)}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]}):(0,f.jsxs)(n.default,{style:{gap:10},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Date"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:R.map(e=>(0,f.jsx)(b.Chip,{label:(0,c.niceDate)(e),selected:$===(0,c.ymd)(e),onPress:()=>{z((0,c.ymd)(e)),A(null)}},(0,c.ymd)(e)))}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Time window"}),(0,f.jsxs)(b.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(b.Chip,{label:"All day",selected:N.from===L&&N.to===F,onPress:()=>A({from:L,to:F})}),L<1020?(0,f.jsx)(b.Chip,{label:`Lunch ${(0,c.fromMins)(L)}\u201317:00`,selected:N.from===L&&1020===N.to,onPress:()=>A({from:L,to:Math.min(1020,F)})}):null,F>1020?(0,f.jsx)(b.Chip,{label:`Evening 17:00\u2013${(0,c.fromMins)(F)}`,selected:1020===N.from&&N.to===F,onPress:()=>A({from:Math.max(1020,L),to:F})}):null]}),(0,f.jsx)(w,{label:"From",value:N.from,min:L,max:N.to-30,onChange:e=>A({...N,from:e})}),(0,f.jsx)(w,{label:"To",value:N.to,min:N.from+30,max:F,onChange:e=>A({...N,to:e})}),(0,f.jsx)(y,{value:j,onChange:B}),(0,f.jsx)(b.Button,{testID:"block-save-future",label:`Block ${(0,c.niceDate)((0,c.parseYmd)($))} ${(0,c.fromMins)(N.from)}\u2013${(0,c.fromMins)(N.to)}`,disabled:!R.length,onPress:()=>H($,(0,c.fromMins)(N.from),(0,c.fromMins)(N.to))}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]})})}function C(e,o,s,l,t){const r=(0,d.hoursFor)(o,s),n=x(s),a=r?(0,c.hm)(r.close):null,u=a&&(0,c.toMins)(a)>(0,c.toMins)(n)?a:'23:59';return t.map(o=>i.useBlocks.getState().add({rid:e,date:(0,c.ymd)(s),from:n,to:u,reason:'Weather',by:l,areaId:o.id,areaName:o.name}))}function v(e,o){const s=(0,a.usePlan)(e),l=(0,i.useBlocks)(e=>e.blocks),t=s.areas.filter(e=>e.outdoor),r=(0,i.closedAreasAt)(l,e,(0,c.ymd)(o),(0,c.hm)(o)),n=l.filter(s=>s.rid===e&&s.areaId&&s.date===(0,c.ymd)(o)&&(0,c.toMins)((0,c.hm)(o))>=(0,c.toMins)(s.from)&&(0,c.toMins)((0,c.hm)(o))<(0,c.toMins)(s.to));return{plan:s,outdoor:t,closed:r,active:n,allClosed:t.length>0&&t.every(e=>r.has(e.id))}}function D({rid:e,r:o,now:s,by:l,onDone:t}){const r=v(e,s);return!r.outdoor.length||r.allClosed?null:(0,f.jsx)(k,{testID:"block-garden",title:"Close garden for weather",sub:`${r.outdoor.map(e=>e.name).join(', ')} only \xb7 the rest of the venue stays bookable`,onPress:()=>{C(e,o,s,l,r.outdoor.filter(e=>!r.closed.has(e.id))),t()}})}function M({rid:e,now:o,big:s}){const l=v(e,o);if(!l.active.length)return null;const t=[...new Set(l.active.map(e=>e.areaName??'Garden'))].join(', '),r=l.active.map(e=>e.to).sort().slice(-1)[0],a=l.plan.areas.filter(e=>e.dogs&&!l.closed.has(e.id)).map(e=>e.name);return(0,f.jsxs)(n.default,{testID:"garden-banner",accessibilityRole:"summary",style:{flexDirection:'row',alignItems:'center',gap:10,backgroundColor:u.colours.blueBg,borderColor:u.colours.blue,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[(0,f.jsx)(b.T,{size:s?20:16,children:"\ud83c\udf27"}),(0,f.jsxs)(n.default,{style:{flex:1},children:[(0,f.jsxs)(b.T,{size:s?20:16,weight:"semibold",colour:u.colours.blue,children:[t," closed for weather until ",r]}),(0,f.jsxs)(b.T,{size:13,colour:"#E2C489",children:["No bookings or walk-ins are offered there.",a.length?` Dogs can still sit in the ${a.join(' or ')}.`:'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Reopen",testID:"garden-reopen",onPress:()=>l.active.forEach(e=>i.useBlocks.getState().remove(e.id))})]})}},935,[808,30,1339,937,263,127,824,825,815,818,821,813,1023,1395,24]); +__d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DAY_BACK",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"DAY_AHEAD",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"DAY_IDLE_MS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"dayOffset",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"shiftDay",{enumerable:!0,get:function(){return h}}),_e.dayWord=p,Object.defineProperty(_e,"dayLong",{enumerable:!0,get:function(){return x}}),_e.bookingsForDay=D,_e.dayCovers=function(e,t,o){if(t>=o)return(0,s.coversToday)(e,t);const n=D(e,t,o),d=(c=n.filter(e=>(0,s.coverDone)(e)||'seated'===(0,s.shownStatus)(e)),c.reduce((e,t)=>e+t.partySize,0)),l=(0,s.coversToday)(e,t).total;var c;return{done:d,toCome:Math.max(0,l-d),total:l}},_e.DaySwitch=function({day:e,today:s,onDay:b,back:D=u,ahead:j=y,idPrefix:$="display-day",stacked:P=!1}){const T=f(e,s),v=t=>{const o=h(e,t);b(o===s?null:o)},w=h(e,-1),C=h(e,1),Y=0!==T,I=(e,o,s,d,u)=>(0,c.jsx)(t.default,{testID:u,accessibilityRole:"button",accessibilityLabel:o,accessibilityState:{disabled:d},disabled:d,onPress:s,style:({pressed:e})=>({minHeight:44,minWidth:P?0:92,flex:P?1:void 0,paddingHorizontal:P?6:12,borderRadius:12,alignItems:'center',justifyContent:'center',borderWidth:1,borderColor:l.colours.hairline,opacity:d?.35:1,backgroundColor:e?l.colours.tilePressed:'rgba(255,255,255,0.03)'}),children:(0,c.jsx)(n.T,{center:P,size:P?16:14,weight:"semibold",colour:l.colours.goldLight,numberOfLines:P?void 0:1,children:e})}),L=p(e,s);return P?(0,c.jsxs)(o.default,{testID:`${$}-switch`,style:{gap:10,padding:12,borderRadius:14,borderWidth:1,borderColor:Y?l.colours.gold:l.colours.hairline,backgroundColor:Y?l.colours.goldTint:l.colours.surface},children:[(0,c.jsxs)(o.default,{testID:`${$}-label`,accessible:!0,accessibilityRole:"header",accessibilityLabel:`Showing ${L}, ${x(e)}`,style:{gap:2,alignItems:'center'},children:[(0,c.jsx)(n.T,{center:!0,size:20,weight:"semibold",colour:l.colours.goldLight,children:L}),(0,c.jsx)(n.T,{center:!0,size:16,children:x(e)})]}),(0,c.jsxs)(o.default,{style:{flexDirection:'row',gap:8,justifyContent:'center'},children:[I('\u2039 Previous',`Previous day, ${x(w)}`,()=>v(-1),T<=-D,`${$}-prev`),I('Today','Back to today',()=>b(null),!1,'back-to-today'),I('Next \u203a',`Next day, ${x(C)}`,()=>v(1),T>=j,`${$}-next`)]})]}):(0,c.jsxs)(o.default,{testID:`${$}-switch`,style:{flexDirection:'row',alignItems:'center',gap:8},children:[I('\u2039 Previous',`Previous day, ${x(w)}`,()=>v(-1),T<=-D,`${$}-prev`),(0,c.jsxs)(t.default,{testID:`${$}-label`,accessibilityRole:Y?'button':'text',disabled:!Y,onPress:()=>b(null),accessibilityLabel:Y?`Showing ${L===(0,d.niceDate)((0,d.parseYmd)(e))?'':`${L}, `}${x(e)}. Back to today`:`Showing today, ${x(e)}`,style:({pressed:e})=>({flex:1,minWidth:0,minHeight:44,borderRadius:12,alignItems:'center',justifyContent:'center',paddingHorizontal:6,borderWidth:Y?1:0,borderColor:l.colours.gold,backgroundColor:e?l.colours.tilePressed:Y?l.colours.goldTint:'transparent'}),children:[(0,c.jsx)(n.T,{size:15,weight:"semibold",colour:Y?l.colours.gold:l.colours.text,numberOfLines:1,children:Y&&L!==(0,d.niceDate)((0,d.parseYmd)(e))?`${L} \xb7 ${(0,d.niceDate)((0,d.parseYmd)(e))}`:L}),Y?(0,c.jsx)(n.T,{size:11,colour:l.colours.muted,numberOfLines:1,children:"Tap for today"}):null]}),I('Next \u203a',`Next day, ${x(C)}`,()=>v(1),T>=j,`${$}-next`)]})},r(_d[0]);var t=e(r(_d[1])),o=e(r(_d[2])),n=r(_d[3]),s=r(_d[4]),d=r(_d[5]),l=r(_d[6]),c=r(_d[7]);const u=365,y=365,b=12e4,f=(e,t)=>Math.round(((0,d.parseYmd)(e).getTime()-(0,d.parseYmd)(t).getTime())/864e5),h=(e,t)=>(0,d.ymd)((0,d.addMins)((0,d.parseYmd)(e),1440*t+120));function p(e,t){const o=f(e,t);return 0===o?'Today':-1===o?'Yesterday':1===o?'Tomorrow':(0,d.niceDate)((0,d.parseYmd)(e))}const x=e=>(0,d.parseYmd)(e).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'});function D(e,t,o){return e.filter(e=>e.date===t&&(0,s.ACTIVE)(e))}},936,[30,263,127,813,828,818,821,24]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"look",{enumerable:!0,get:function(){return D}});var E=r(d[0]),I=r(d[1]),S=r(d[2]),o=r(d[3]);r(d[4]);var _=r(d[5]);const b=E=>E,D={panel:{backgroundColor:E.IS_QUEUED_VENUE?I.QUEUED_BRAND.ink:E.IS_ABBOTSFORD?'#2A2F34':E.IS_KIRKTON?'#141414':E.IS_GREENSIDE?'#222222':E.IS_WILDINGS?'#30343B':(0,o.soutersSurface)('#121110'),borderRadius:_.radii.xl,borderWidth:1,borderColor:'rgba(255,255,255,0.07)',boxShadow:'0 1px 0 rgba(255,255,255,0.04) inset, 0 12px 28px rgba(0,0,0,0.45)'},quiet:(o,b="gold")=>({minHeight:_.control.tall,borderRadius:_.radii.button,borderWidth:1,borderColor:E.IS_QUEUED_VENUE?I.QUEUED_BRAND.smallTextAccent:E.IS_ABBOTSFORD?'rgba(229,208,141,0.65)':E.IS_KIRKTON?'rgba(180,108,84,0.55)':E.IS_GREENSIDE?S.GREENSIDE_DISPLAY.quietBorder:E.IS_WILDINGS?'rgba(255,227,165,0.55)':E.IS_KIRKMICHAEL?'rgba(184,119,84,0.55)':E.IS_ISOLATED_VENUE?'rgba(164,98,46,0.55)':'blue'===b?'rgba(226,196,137,0.55)':'rgba(207,164,95,0.38)',backgroundColor:E.IS_ISOLATED_VENUE?o?E.IS_ABBOTSFORD?'rgba(184,147,98,0.16)':E.IS_KIRKTON?'rgba(180,108,84,0.16)':E.IS_GREENSIDE?S.GREENSIDE_DISPLAY.quietPressed:E.IS_WILDINGS?'rgba(255,227,165,0.16)':E.IS_KIRKMICHAEL?'rgba(184,119,84,0.16)':'rgba(164,98,46,0.16)':'rgba(255,255,255,0.035)':o?'rgba(207,164,95,0.16)':'blue'===b?'rgba(226,196,137,0.10)':'rgba(255,255,255,0.035)',paddingHorizontal:14,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,boxShadow:'0 1px 0 rgba(255,255,255,0.05) inset',transition:'background-color 120ms ease'}),primary:o=>E.IS_ISOLATED_VENUE?{backgroundColor:E.IS_QUEUED_VENUE?I.QUEUED_BRAND.accent:E.IS_ABBOTSFORD?'#B89362':E.IS_KIRKTON?'#B46C54':E.IS_GREENSIDE?o?S.GREENSIDE_DISPLAY.primaryPressed:S.GREENSIDE_PALETTE.gold:E.IS_WILDINGS?o?'#E6CC94':'#FFE3A5':E.IS_KIRKMICHAEL?o?'#A66949':'#B87754':o?'#8C5226':'#A4622E',borderWidth:1,borderColor:E.IS_QUEUED_VENUE?I.QUEUED_BRAND.smallTextAccent:E.IS_ABBOTSFORD?'#E5D08D':E.IS_KIRKTON?'#D6A28E':E.IS_GREENSIDE?S.GREENSIDE_PALETTE.goldLight:E.IS_WILDINGS?'#FFF0CF':E.IS_KIRKMICHAEL?'#C2937A':'#C18F67',backgroundImage:'none',boxShadow:'0 4px 12px rgba(0,0,0,0.35)'}:{backgroundColor:o?'#B8904F':'#CFA45F',borderWidth:1,borderColor:'rgba(255,226,170,0.55)',backgroundImage:o?'linear-gradient(180deg, #BE9552 0%, #A88143 100%)':'linear-gradient(180deg, #E0BA77 0%, #C69A55 100%)',boxShadow:o?'0 2px 8px rgba(0,0,0,0.4)':'0 1px 0 rgba(255,255,255,0.28) inset, 0 10px 24px rgba(207,164,95,0.22), 0 4px 10px rgba(0,0,0,0.45)',transition:'box-shadow 120ms ease'},onPrimary:E.IS_QUEUED_VENUE?I.QUEUED_BRAND.onAccent:E.IS_ABBOTSFORD||E.IS_KIRKTON?'#0B0B0B':E.IS_GREENSIDE?'#1A1A1A':E.IS_WILDINGS?'#272A2F':E.IS_KIRKMICHAEL?'#0B0B0B':E.IS_ISOLATED_VENUE?'#FFFFFF':'#17130D',web:b}},937,[5,1233,1204,868,122,1236]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useReservedToday=k,_e.ShellfishTile=function({rid:e,by:t,app:l,big:c,onOrder:h,style:b}){const y=(0,d.useShellfish)(e,t,l),p=k(e),[w,C]=(0,s.useState)(!1),S=x(e,y.items.find(e=>e.supplierId)?.supplierId),L=(0,o.useLiveState)();if('ready'!==L)return(0,f.jsx)(o.LiveWait,{state:L,title:"Lobsters & crabs",testID:"shellfish-wait"});if(!y.items.length)return null;const $=y.items.filter(e=>y.isLow(e.key)),T=y.items.length<=3?y.items.map(e=>e.plural.toUpperCase()).join(' & '):'LIVE STOCK';return(0,f.jsxs)(r.default,{testID:"shellfish-tile",style:[{borderRadius:16,borderWidth:1.5,borderColor:$.length?u.colours.amber:u.colours.border,backgroundColor:u.colours.surface,padding:c?10:12,gap:6},b],children:[(0,f.jsxs)(i.default,{accessibilityRole:"button",accessibilityLabel:`${y.items.map(t=>`${t.plural} ${(0,a.fmtStockCount)(e,t,y.counts[t.key]??0)}`).join(', ')}. Tap to update`,onPress:()=>C(!0),style:{gap:4,flex:c?1:void 0},children:[(0,f.jsxs)(n.Row,{wrap:!0,gap:6,style:{justifyContent:'space-between'},children:[(0,f.jsxs)(n.T,{size:12,weight:"semibold",colour:u.colours.gold,children:["LIVE \xb7 ",T]}),(0,f.jsx)(n.T,{size:12,colour:u.colours.muted,children:"Tap to update \u203a"})]}),(0,f.jsx)(n.Row,{gap:c?14:18,style:{flex:c?1:void 0,alignItems:'center'},children:y.items.map(t=>{const s=y.counts[t.key]??0,o=y.isLow(t.key);return(0,f.jsxs)(r.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,a.speakStockCount)(e,t,s)}`,style:{flex:1,alignItems:'center'},children:[(0,f.jsx)(n.T,{size:c?42:34,weight:"bold",colour:s<=0?u.colours.red:o?u.colours.amber:u.colours.text,style:{lineHeight:c?50:42},children:(0,a.fmtStockCount)(e,t,s)}),(0,f.jsxs)(n.T,{size:13,colour:o?u.colours.amber:u.colours.muted,children:[t.icon," ",t.plural,s<=0?' \xb7 out':o?' \xb7 low':'']}),p[t.key]?(0,f.jsxs)(n.T,{size:12,weight:"semibold",colour:u.colours.goldLight,children:["Reserved: ",(0,a.fmtStockCount)(e,t,p[t.key])," \xb7 free ",(0,a.fmtStockCount)(e,t,Math.max(0,s-p[t.key]))]}):null]},t.key)})})]}),!c&&$.length?(0,f.jsxs)(r.default,{testID:"shellfish-low",style:{backgroundColor:u.colours.amberBg,borderRadius:10,padding:8,gap:6},children:[(0,f.jsxs)(n.T,{size:13,weight:"semibold",colour:"#FFE2A8",children:["Low stock: ",$.map(t=>`${(0,a.fmtStockCount)(e,t,y.counts[t.key]??0)} ${t.plural.toLowerCase()} (warns at ${(0,a.fmtStockCount)(e,t,t.lowAt)})`).join(', ')]}),h?(0,f.jsx)(n.Button,{small:!0,label:S?`Order from ${S} \u203a`:'Order sheets \u203a',testID:"shellfish-order",onPress:h}):null]}):null,c||$.length||!h?null:(0,f.jsx)(i.default,{accessibilityRole:"button",onPress:h,style:{minHeight:44,justifyContent:'center'},children:(0,f.jsx)(n.T,{size:13,colour:u.colours.gold,children:S?`${S} order sheet \u203a`:'Order sheets \u203a'})}),w?(0,f.jsx)(j,{rid:e,by:t,app:l,onClose:()=>C(!1),onOrder:h?()=>{C(!1),h()}:void 0}):null]})},_e.ShellfishStrip=function({rid:e,by:t,app:o,height:c=76}){const h=(0,d.useShellfish)(e,t,o),b=k(e),[y,p]=(0,s.useState)(!1);if(!h.items.length)return null;const x=c>=80,w=Math.max(28,Math.min(52,Math.round(.6*c))),C=Math.max(22,Math.min(34,Math.round(.42*c)));return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(i.default,{testID:"shellfish-tile",accessibilityRole:"button",accessibilityLabel:`${h.items.map(t=>`${t.plural} ${(0,a.fmtStockCount)(e,t,h.counts[t.key]??0)}`).join(', ')}. Tap to update`,onPress:()=>p(!0),style:({pressed:e})=>({flexDirection:'row',alignItems:'stretch',height:c,backgroundColor:e?'#181612':'#100F0D',borderBottomWidth:1,borderBottomColor:'rgba(207,164,95,0.12)',borderTopWidth:1,borderTopColor:'rgba(255,255,255,0.04)',...l.look.web({backgroundImage:'linear-gradient(180deg, rgba(207,164,95,0.07) 0%, rgba(207,164,95,0.015) 100%)',cursor:'pointer'})}),children:h.items.map((t,s)=>{const o=h.counts[t.key]??0,i=b[t.key]??0,d=Math.max(0,o-i),y=d<=0,p=y||h.isLow(t.key);return(0,f.jsxs)(r.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,a.speakStockCount)(e,t,d)}`,style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:x?16:12,borderLeftWidth:s?1:0,borderLeftColor:'rgba(207,164,95,0.16)',backgroundColor:p?'rgba(255,107,94,0.07)':'transparent',...l.look.web(p?{backgroundImage:'linear-gradient(180deg, rgba(255,107,94,0.11) 0%, rgba(255,107,94,0.035) 100%)'}:{})},children:[(0,f.jsx)(n.T,{size:C,children:t.icon}),(0,f.jsx)(n.T,{size:w,weight:"bold",colour:p?'#FF8E82':u.colours.text,style:{lineHeight:Math.round(1.15*w),letterSpacing:-.5,minWidth:Math.round(.85*w),textAlign:'center'},children:(0,a.fmtStockCount)(e,t,d)}),(0,f.jsxs)(r.default,{style:{gap:0},children:[(0,f.jsx)(n.T,{size:x?15:13,weight:"semibold",colour:p?'#FFB3AA':u.colours.goldLight,style:{letterSpacing:2},children:t.plural.toUpperCase()}),p&&c>=60?(0,f.jsx)(n.T,{size:11,weight:"semibold",colour:"#FF8E82",style:{letterSpacing:1.5},children:y?'NONE LEFT':`LOW \xb7 WARNS AT ${(0,a.fmtStockCount)(e,t,t.lowAt)}`}):null,(0,f.jsxs)(n.T,{size:x?14:12,weight:"semibold",colour:i?u.colours.goldLight:'#857D6E',style:{letterSpacing:.5},children:["Reserved: ",(0,a.fmtStockCount)(e,t,i)]})]})]},t.key)})}),y?(0,f.jsx)(j,{rid:e,by:t,app:o,onClose:()=>p(!1)}):null]})},_e.ShellfishPanel=j,_e.ShellfishChip=function({rid:e,by:t,app:o,size:c="m"}){const h=(0,d.useShellfish)(e,t,o),b=k(e),[y,p]=(0,s.useState)(!1);if(!h.items.length)return null;const x='s'===c?17:20;return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(i.default,{testID:"shellfish-tile",accessibilityRole:"button",accessibilityLabel:`${h.items.map(t=>`${t.plural} ${(0,a.fmtStockCount)(e,t,Math.max(0,(h.counts[t.key]??0)-(b[t.key]??0)))} available`).join(', ')}. Tap to update`,onPress:()=>p(!0),style:({pressed:e})=>({flexDirection:'row',alignItems:'center',minHeight:44,borderRadius:14,borderWidth:1,borderColor:'rgba(207,164,95,0.30)',overflow:'hidden',backgroundColor:e?'#1C1913':'rgba(207,164,95,0.06)',...l.look.web({cursor:'pointer'})}),children:h.items.map((t,s)=>{const o=h.counts[t.key]??0,l=b[t.key]??0,i=Math.max(0,o-l),d=i<=0,c=d||h.isLow(t.key);return(0,f.jsxs)(r.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,a.speakStockCount)(e,t,i)}`,style:{flexDirection:'row',alignItems:'center',gap:6,paddingHorizontal:9,paddingVertical:3,borderLeftWidth:s?1:0,borderLeftColor:'rgba(207,164,95,0.18)',backgroundColor:c?'rgba(255,107,94,0.10)':'transparent'},children:[(0,f.jsx)(n.T,{size:x-2,children:t.icon}),(0,f.jsx)(n.T,{size:x,weight:"bold",colour:d?u.colours.red:c?u.colours.amber:u.colours.text,style:{lineHeight:x+4},children:(0,a.fmtStockCount)(e,t,i)}),l||d||c?(0,f.jsx)(n.T,{size:10,weight:"semibold",colour:d||c?'#FFB3AA':u.colours.goldLight,children:d?'none left':l?`${(0,a.fmtStockCount)(e,t,l)} res`:'low'}):null]},t.key)})}),y?(0,f.jsx)(j,{rid:e,by:t,app:o,onClose:()=>p(!1)}):null]})};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),i=e(_r(_d[4])),r=e(_r(_d[5])),n=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),y=_r(_d[13]),f=_r(_d[14]);const p=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'});function k(e){const t=(0,h.useBookings)(e),s=(0,h.useRestaurant)(e),o=(0,y.ymd)((0,h.useNow)(6e4));return(0,b.reservedOn)(t,o,(0,b.reservablesOf)(s))}function x(e,t){const s=(0,c.useSheets)(e);return t?s.find(e=>e.id===t)?.name:void 0}function j({rid:e,by:o,app:l,onClose:i,onOrder:c}){const h=(0,d.useShellfish)(e,o,l),[b,y]=(0,s.useState)({}),[k,j]=(0,s.useState)(null),w=x(e,h.items.find(e=>e.supplierId)?.supplierId),C=(s,o)=>{const l=h.itemOf(s);l&&y(i=>({...i,[s]:(0,t.fishInStone)(e,l)?(0,t.stepQuantity)(e,l,i[s]||0,o):Math.max(0,Math.min(99,(i[s]||0)+o))}))},S=(e,t=!1)=>{const s=h.itemOf(e);h.sell(e,t)&&j(('kg'===s?.unit?`Half a stone ${s.name.toLowerCase()}`:t?`Half ${s?.name.toLowerCase()}`:`1 ${s?.name.toLowerCase()}`)+" sold.")},L=Object.values(b).reduce((e,t)=>e+t,0);return(0,f.jsxs)(n.Sheet,{visible:!0,onClose:i,title:h.items.map(e=>e.plural).join(' & ')||'Tracked stock',maxWidth:620,testID:"shellfish-panel",children:[(0,f.jsx)(n.Row,{gap:10,wrap:!0,style:{alignItems:'stretch'},children:h.items.map(s=>{const o=h.counts[s.key]??0;return(0,f.jsxs)(r.default,{style:{flex:1,minWidth:160,gap:8,padding:10,borderRadius:14,borderWidth:1,borderColor:h.isLow(s.key)?u.colours.amber:u.colours.border,backgroundColor:u.colours.surface2},children:[(0,f.jsxs)(n.T,{center:!0,size:13,colour:u.colours.muted,children:[s.icon," ",s.plural]}),(0,f.jsx)(n.T,{center:!0,size:48,weight:"bold",colour:h.isLow(s.key)?u.colours.amber:u.colours.text,style:{lineHeight:56},children:(0,a.fmtStockCount)(e,s,o)}),(0,f.jsx)(n.Button,{label:(0,t.fishInStone)(e,s)?`Sold half a stone ${s.name.toLowerCase()}`:`Sold 1 ${s.name.toLowerCase()} \u22121`,testID:`sell-${s.key}`,disabled:o<((0,t.fishInStone)(e,s)?t.HALF_STONE_KG:1),onPress:()=>S(s.key),style:{minHeight:56}}),'half'===s.unit?(0,f.jsx)(n.Button,{kind:"secondary",label:"Sold a half \u2212\xbd",testID:`sell-${s.key}-half`,disabled:o<.5,onPress:()=>S(s.key,!0),style:{minHeight:52}}):(0,f.jsx)(r.default,{style:{minHeight:52}})]},s.key)})}),(0,f.jsx)(n.Button,{kind:"ghost",label:h.undoable?`\u21b6 Undo: ${(0,a.describe)(h.undoable,h.itemOf(h.undoable.kind))}`:'\u21b6 Nothing to undo',testID:"shellfish-undo",disabled:!h.undoable,onPress:()=>{const e=h.undoable;h.undoLast(),e&&j(`Undone: ${(0,a.describe)(e,h.itemOf(e.kind))}.`)}}),k?(0,f.jsx)(n.Banner,{kind:"success",title:k}):null,(0,f.jsxs)(r.default,{testID:"delivery-in",style:{gap:8,padding:10,borderRadius:14,borderWidth:1,borderColor:u.colours.gold,backgroundColor:u.colours.goldTint},children:[(0,f.jsx)(n.T,{weight:"semibold",colour:u.colours.goldLight,children:"Delivery in"}),h.items.map(s=>(0,f.jsxs)(n.Row,{gap:10,children:[(0,f.jsxs)(n.T,{style:{flex:1},children:[s.icon," ",s.plural]}),(0,f.jsx)(n.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:`${(0,t.fishInStone)(e,s)?'Half a stone less':'Fewer'} ${s.plural.toLowerCase()} in`,onPress:()=>C(s.key,-1),style:{minWidth:48,minHeight:48}}),(0,f.jsx)(n.T,{size:24,weight:"bold",style:{minWidth:76,textAlign:'center'},children:(0,a.fmtStockCount)(e,s,b[s.key]||0)}),(0,f.jsx)(n.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:`${(0,t.fishInStone)(e,s)?'Half a stone more':'More'} ${s.plural.toLowerCase()} in`,testID:`in-plus-${s.key}`,onPress:()=>C(s.key,1),style:{minWidth:48,minHeight:48}}),(0,t.fishInStone)(e,s)?null:(0,f.jsx)(n.Button,{small:!0,kind:"ghost",label:"Add five",onPress:()=>C(s.key,5)})]},s.key)),(0,f.jsx)(n.Button,{kind:"success",label:L?`Add to stock: ${h.items.filter(e=>b[e.key]).map(t=>`${(0,a.fmtStockCount)(e,t,b[t.key])} ${(1===b[t.key]?t.name:t.plural).toLowerCase()}`).join(' and ')}`:'Add to stock',testID:"delivery-add",disabled:!L,onPress:()=>{h.items.forEach(e=>h.deliver(e.key,b[e.key]??0)),j('Delivery added to the count.'),y({})},style:{minHeight:54}})]}),c?(0,f.jsx)(n.Button,{kind:"secondary",label:w?`${w} order sheet \u203a`:'Order sheets \u203a',onPress:c}):null,(0,f.jsxs)(r.default,{style:{gap:2},children:[(0,f.jsx)(n.T,{size:12,weight:"semibold",colour:u.colours.gold,children:"RECENT"}),h.events.slice(0,6).map(e=>(0,f.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(n.T,{size:13,style:{flex:1},children:(0,a.describe)(e,h.itemOf(e.kind))}),(0,f.jsxs)(n.Muted,{children:[p(e.at)," \xb7 ",e.by.replace(' (example)','')]})]},e.id))]}),(0,f.jsx)(n.Row,{wrap:!0,gap:6,children:h.synced?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(n.Badge,{kind:"ok",label:"Shared live"}),(0,f.jsx)(n.Muted,{children:"Every paired device sees the same count."})]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(n.Badge,{kind:"neutral",label:"Saved on this device"}),(0,f.jsx)(n.Muted,{children:"Not connected to the shared venue yet."})]})})]})}},938,[1025,30,1232,937,263,127,813,1028,1026,1027,821,819,828,818,24]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AllergyChain=j,_e.BookingAllergyChain=function({b:l,me:s,readOnly:k}){const p=(0,i.useOrders)(l.restaurantId),A=(0,n.useStore)(e=>e.ackBookingAllergy);if(!l.allergies.length)return null;const S=p.find(e=>e.allergies.length&&!['cancelled','closed'].includes(e.status)&&(e.bookingId===l.id||!e.bookingId&&(0,c.linkedBooking)(e,[l])?.id===l.id));if(S)return(0,h.jsx)(j,{o:S,me:s,readOnly:k,compact:!0});const w={booked:l.allergyAck,ordered:void 0,kitchen:void 0,pass:void 0,table:void 0};return(0,h.jsxs)(t.default,{testID:`allergy-chain-${l.ref}`,style:{gap:6,padding:8,borderRadius:10,borderWidth:1,borderColor:l.allergyAck?u.colours.border:u.colours.red,backgroundColor:(0,e.soutersSurface)('#140f0e')},children:[(0,h.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsxs)(o.T,{size:13,weight:"semibold",colour:"#FFD9D4",children:["Allergen sign-off \xb7 ",l.ref]}),(0,h.jsx)(o.Badge,{kind:l.allergyAck?'amber':'red',label:(l.allergyAck?1:0)+" of 5"})]}),(0,h.jsx)(y,{chain:w,next:l.allergyAck?null:'booked',testID:`allergy-steps-${l.ref}`}),l.allergyAck?(0,h.jsxs)(o.Row,{gap:6,children:[(0,h.jsx)(f.StaffAvatar,{name:l.allergyAck.by,size:20,ring:!1}),(0,h.jsxs)(o.Muted,{style:{flex:1},children:["1. Booked: ",x(l.allergyAck.by)," at ",b(l.allergyAck.at),". Steps 2 to 5 are signed on the table's order."]})]}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(o.T,{size:13,children:"Next: 1. Booked. Allergy recorded (who took it)."}),k?null:(0,h.jsxs)(o.Row,{wrap:!0,gap:8,children:[(0,h.jsx)(o.Button,{small:!0,kind:"danger",label:"Sign off",testID:`sign-off-${l.ref}`,accessibilityLabel:`Sign off Booked on ${l.ref}`,disabled:!s.trim(),onPress:()=>A(l.id,s)}),(0,h.jsxs)(o.Muted,{children:["as ",x(s)]})]})]})]})};var e=r(d[0]);r(d[1]);var l,s=r(d[2]),t=(l=s)&&l.__esModule?l:{default:l},o=r(d[3]),i=r(d[4]),n=r(d[5]),c=r(d[6]),u=r(d[7]),f=r(d[8]),h=r(d[9]);const b=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}),x=e=>e.replace(' (example)','');function y({chain:e,next:l,testID:s}){return(0,h.jsx)(t.default,{testID:s,accessibilityLabel:`Allergen sign-off ${c.CHAIN_STEPS.filter(l=>e[l.id]).length} of 5`,style:{flexDirection:'row',alignItems:'flex-start'},children:c.CHAIN_STEPS.map((s,i)=>{const n=!!e[s.id],c=l===s.id,f=n?u.colours.ok:c?u.colours.gold:u.colours.border;return(0,h.jsxs)(t.default,{style:{flex:1,alignItems:'center'},children:[(0,h.jsxs)(t.default,{style:{flexDirection:'row',alignItems:'center',width:'100%'},children:[(0,h.jsx)(t.default,{style:{flex:1,height:2,backgroundColor:i?n||c?f:u.colours.border:'transparent'}}),(0,h.jsx)(t.default,{style:{width:26,height:26,borderRadius:13,borderWidth:2,borderColor:f,backgroundColor:n?u.colours.ok:'transparent',alignItems:'center',justifyContent:'center'},children:(0,h.jsx)(o.T,{size:12,weight:"bold",colour:n?'#0B0B0B':c?u.colours.gold:u.colours.muted,children:n?'\u2713':String(s.n)})}),(0,h.jsx)(t.default,{style:{flex:1,height:2,backgroundColor:i<4?n?u.colours.ok:u.colours.border:'transparent'}})]}),(0,h.jsx)(o.T,{size:11,weight:c?'semibold':'regular',colour:n?u.colours.text:c?u.colours.gold:u.colours.muted,center:!0,children:s.label}),e[s.id]?(0,h.jsxs)(o.T,{size:10,colour:u.colours.muted,center:!0,numberOfLines:2,children:[x(e[s.id].by).split(' ')[0]," ",b(e[s.id].at)]}):null]},s.id)})})}function j({o:l,me:s,readOnly:j,compact:k}){const p=(0,i.useBookings)(l.restaurantId),A=(0,n.useStore)(e=>e.signAllergyStep);if(!l.allergies.length)return null;const S=(0,c.linkedBooking)(l,p),w=(0,c.orderChain)(l,S),I=(0,c.nextStep)(l,S),C=c.CHAIN_STEPS.filter(e=>w[e.id]).length,B=I?(0,c.stepInfo)(I):null,D='table'===I&&!['ready','served','collected'].includes(l.status);return(0,h.jsxs)(t.default,{testID:`allergy-chain-${l.ref}`,style:{gap:6,padding:8,borderRadius:10,borderWidth:1,borderColor:I?u.colours.red:u.colours.ok,backgroundColor:(0,e.soutersSurface)('#140f0e')},children:[(0,h.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsxs)(o.T,{size:13,weight:"semibold",colour:I?'#FFD9D4':'#E2C489',children:["Allergen sign-off \xb7 ",l.ref]}),(0,h.jsx)(o.Badge,{kind:I?'red':'ok',label:I?`${C} of 5`:'Complete'})]}),(0,h.jsx)(y,{chain:w,next:I,testID:`allergy-steps-${l.ref}`}),k?null:c.CHAIN_STEPS.filter(e=>w[e.id]).map(e=>(0,h.jsxs)(o.Row,{gap:6,children:[(0,h.jsx)(f.StaffAvatar,{name:w[e.id].by,size:20,ring:!1}),(0,h.jsxs)(o.Muted,{style:{flex:1},children:[e.n,". ",e.label,": ",x(w[e.id].by)," at ",b(w[e.id].at)]})]},e.id)),B?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(o.T,{size:13,children:["Next: ",B.n,". ",B.label,". ",B.what,"."]}),j?null:(0,h.jsxs)(o.Row,{wrap:!0,gap:8,children:[(0,h.jsx)(o.Button,{small:!0,kind:"danger",label:"Sign off",testID:`sign-off-${l.ref}`,accessibilityLabel:`Sign off ${B.label} on ${l.ref}`,disabled:!s.trim()||D,onPress:()=>A(l.id,I,s)}),(0,h.jsxs)(o.Muted,{children:["as ",x(s)]})]}),D?(0,h.jsx)(o.Muted,{children:"Signed off at the pass. The table step is signed when the dish is served."}):(0,h.jsx)(o.Muted,{children:"The ticket can't move on until this step is signed off."})]}):(0,h.jsx)(o.Muted,{children:"All five steps signed off. The full chain is in the allergen audit log."})]})}},939,[868,30,127,813,1021,872,940,821,953,24]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CHAIN_STEPS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"stepInfo",{enumerable:!0,get:function(){return t}}),e.linkedBooking=l,e.orderChain=o,e.nextStep=s,Object.defineProperty(e,"doneCount",{enumerable:!0,get:function(){return c}}),e.canSign=function(n,t,l){return s(n,l)===t},e.statusBlock=function(n,l,s){if(!n.allergies.length||'cancelled'===l)return null;const c=o(n,s),u=n=>c[n]?null:`${t(n).n}. ${t(n).label} needs signing off first`;return'acknowledged'===l||'preparing'===l||'ready'===l?u('booked')??u('ordered')??u('kitchen'):'served'===l?u('booked')??u('ordered')??u('kitchen')??u('pass'):'collected'===l||'closed'===l?u('booked')??u('ordered')??u('kitchen')??u('pass')??u('table'):null},e.chainNeedsAction=function(n,t){const o=s(n,l(n,t));return!(!o||'table'===o&&!['ready','served'].includes(n.status))},e.bookingNeedsAction=function(n,t){return n.allergies.length>0&&!n.allergyAck&&!t.some(t=>t.allergies.length&&l(t,[n])?.id===n.id)};const n=[{id:'booked',n:1,label:'Booked',what:'Allergy recorded (who took it)'},{id:'ordered',n:2,label:'Ordered',what:'Server confirms with the guest'},{id:'kitchen',n:3,label:'Kitchen',what:'Chef signs off before cooking'},{id:'pass',n:4,label:'Pass',what:'Checked before it leaves the pass'},{id:'table',n:5,label:'Table',what:'Server signs off when served'}],t=t=>n.find(n=>n.id===t);function l(n,t){return n.bookingId?t.find(t=>t.id===n.bookingId):'table'===n.type&&n.tableNo?t.find(t=>t.restaurantId===n.restaurantId&&'seated'===t.status&&!!t.table&&t.table.split('+').includes(String(n.tableNo))):void 0}function o(n,t){return{booked:n.allergyChain?.booked??(t?.allergies.length?t.allergyAck:void 0),ordered:n.allergyChain?.ordered,kitchen:n.allergyAck,pass:n.allergyChain?.pass,table:n.handoverCheck}}function s(t,l){if(!t.allergies.length)return null;const s=o(t,l);return n.find(n=>!s[n.id])?.id??null}const c=(t,l)=>{const s=o(t,l);return n.filter(n=>s[n.id]).length}},940,[]); +__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.queuedSessions=o,e.queuedRequestSlots=u,e.queuedRequestError=function(t,o,s,a=new Date){if(o.name.trim().length<2||o.name.trim().length>100||!/^[0-9 +()\-]{7,30}$/.test(o.phone)||!/^[0-9]{7,15}$/.test(o.phone.replace(/\D/g,''))||o.email.length>254||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(o.email))return'Enter your name, phone number and email.';if(o.notes.length>2e3)return'Keep notes under 2000 characters.';const c=(0,n.localDate)(a),d=(0,n.localDate)(new Date(+a+63072e6));if(!o.date||o.dated||!u(t,o.date,s).includes(o.time||''))return'Choose a future date and a time within confirmed kitchen service hours.';const l=new Intl.DateTimeFormat('en-GB',{timeZone:'Europe/London',hour:'2-digit',minute:'2-digit',hour12:!1}).format(a);return o.date===c&&(o.time||'')<=l?'Choose a future time.':!Number.isInteger(o.covers)||o.covers<1||o.covers>200?'Enter 1 to 200 Covers.':''};var t=r(_d[0]),n=r(_d[1]);function o(n){const o=t.queuedVenues[n];return o?.kitchenSessionsByDay??o?.hours.sessionsByDay??void 0}const s=t=>60*+t.slice(0,2)+ +t.slice(3);function u(n,u,a){if(!/^\d{4}-\d{2}-\d{2}$/.test(u))return[];const c=new Date(u+'T12:00:00Z');if(!Number.isFinite(+c)||c.toISOString().slice(0,10)!==u)return[];const d=(a??o(n))?.[c.getUTCDay()];if(!Array.isArray(d))return[];const l=[],f=t.queuedVenues[n]?.booking.lastSittingMinutesBeforeClose??0;for(const t of d){if(!Array.isArray(t)||2!==t.length||!t.every(t=>'string'==typeof t&&/^([01]\d|2[0-3]):[0-5]\d$/.test(t)))continue;const n=s(t[0]),o=s(t[1]);if(!(n>=o))for(let t=n;te.id===t)?.uses??[],r=O(e),i=c.useStore.getState().menu.find(e=>e.id===t)?.name??'';return(0,u.dishReason)(i,(0,u.shortOf)(s,r),r,b(e))},_e.runAutoSoldOut=y,_e.startAutoSoldOut=function(){if(w)return w;let e=null;const t=()=>{e||(e=setTimeout(()=>{e=null,y()},400))},n=[d.useShellStore.subscribe((e,n)=>{e.events===n.events&&e.server===n.server&&e.items===n.items||t()}),h.subscribe(t),S.useCardStore.subscribe((e,n)=>{e.cards!==n.cards&&t()}),c.useStore.subscribe((e,n)=>{e.menu===n.menu&&e.restaurants===n.restaurants||t()}),f.useSoldOut.subscribe((e,n)=>{e.entries!==n.entries&&t()})],s=setInterval(t,6e4);return t(),w=()=>{n.forEach(e=>e()),clearInterval(s),e&&clearTimeout(e),w=null},w},_e.useAutoSoldOutView=function(e){const t=(0,c.useStore)(e=>e.menu),n=h(e=>e.links),s=(0,S.useCardStore)(e=>e.cards),r=(0,d.useShellStore)(t=>t.items[e]);(0,d.useShellStore)(e=>e.events),(0,d.useShellStore)(t=>t.server[e]);const i=(r??[]).filter(e=>e.active).map(e=>({key:e.key,name:e.name,plural:e.plural,unit:e.unit,active:e.active})),o=p(e,t,n,s,i),l=O(e);return{dishes:o,counts:l,items:i,reason:e=>{const t=o.find(t=>t.id===e);return t?(0,u.dishReason)(t.name,(0,u.shortOf)(t.uses,l),l,i):''},links:n}};var e,t=_r(_d[0]),n=(e=t)&&e.__esModule?e:{default:e},s=_r(_d[1]),r=_r(_d[2]),u=_r(_d[3]),i=_r(_d[4]),o=_r(_d[5]),l=_r(_d[6]),c=_r(_d[7]),d=_r(_d[8]),S=_r(_d[9]),f=_r(_d[10]);const m=()=>{try{return(0,c.nowFrom)(c.useStore.getState().clock)}catch{return new Date}},h=(0,s.create)()((0,r.persist)(e=>({links:[],setLink:(t,n,s,r)=>e(e=>{const u=e.links.filter(e=>!(e.rid===t&&e.itemId===n));return{links:[...u,{rid:t,itemId:n,uses:s?s.filter(e=>e.qty>0).slice(0,10):[],at:m().toISOString(),by:r.slice(0,80),...s?{}:{auto:!0}}]}})}),{name:'covercharge-soldout-links-v1',version:1,storage:(0,r.createJSONStorage)(()=>n.default)})),k=e=>!!e&&!0===e.auto,v={soldOutRead:new Set,linksRead:new Set};function b(e){return(d.useShellStore.getState().items[e]??[]).filter(e=>e.active).map(e=>({key:e.key,name:e.name,plural:e.plural,unit:e.unit,active:e.active}))}function p(e,t=c.useStore.getState().menu,n=h.getState().links,s=S.useCardStore.getState().cards,r=b(e)){const i=[];for(const o of t){if(o.restaurantId!==e||o.hidden)continue;const t=s.find(t=>t.restaurantId===e&&t.menuItemId===o.id),l=n.find(t=>t.rid===e&&t.itemId===o.id),c=(0,u.inferUses)(o,t,r),d=k(l)?c:(0,u.usesFor)(o,l,t,r);i.push({id:o.id,name:o.name,uses:d.uses,source:d.source,guess:c.uses})}return i}function O(e){return(0,d.venueCounts)(d.useShellStore.getState(),e)}function I(e){const t={};for(const n of d.useShellStore.getState().events)n.rid===e&&(!t[n.kind]||n.at>t[n.kind])&&(t[n.kind]=n.at);return t}function y(e=m()){const t=c.useStore.getState();let n=0;for(const s of t.restaurants){const t=s.id;if((0,o.liveData)()&&(!d.useShellStore.getState().server[t]||!v.soldOutRead.has(t)||!v.linksRead.has(t)))continue;const r=(0,i.soldOutSettingsOf)(s.settings?.soldOut).auto,l=p(t),c=(0,u.planAuto)({rid:t,enabled:r,dishes:l,counts:O(t),entries:f.useSoldOut.getState().entries,lastChange:I(t),now:e});if(!c.mark.length&&!c.clear.length)continue;const S=e.toISOString();f.useSoldOut.setState(e=>{const n=new Set(c.clear),s=new Map(c.mark.map(e=>[e.itemId,e.name])),r=e.entries.filter(e=>!(e.rid===t&&s.has(e.itemId))).map(e=>e.rid===t&&n.has(e.itemId)?{...e,on:!1,at:S,by:'Count back up',kept:!1,clearAfter:void 0}:e);return{entries:[...r,...c.mark.map(e=>({rid:t,itemId:e.itemId,name:e.name.slice(0,120),on:!0,at:S,by:'Live count',auto:!0,kept:!1}))]}}),n+=c.mark.length+c.clear.length}return n}let w=null;l.PITCH&&'undefined'!=typeof globalThis&&(globalThis.__pitchCounts=e=>{const t=c.useStore.getState().restaurants[0]?.id;if(!t)return;const n=O(t),s=m().toISOString(),r=Object.entries(e).filter(([e,t])=>(n[e]??0)!==t).map(([e,r],u)=>({id:`pitch-count-${Date.now()}-${u}`,rid:t,kind:e,delta:r-(n[e]??0),reason:'count',by:'Chef',app:'chef',at:s}));return r.length&&d.useShellStore.setState(e=>({events:[...e.events,...r]})),y()})},942,[1116,952,1117,943,944,1119,2,872,1026,1094,918]); +__d(function(_g,r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.parseQty=i,_e.inferUses=u,_e.usesFor=function(e,t,n,o){const s=new Set(o.filter(e=>!1!==e.active).map(e=>e.key));return t?{uses:t.uses.filter(e=>s.has(e.key)&&e.qty>0),source:t.uses.length?'link':'none'}:u(e,n,o)},_e.shortOf=c,_e.shortReason=f,_e.dishReason=function(e,t,n,o){if(!t.length)return'';const i=e.replace(/\([^)]*\)/g,'').trim(),a=e=>{const t=o.find(t=>t.key===e);return!!t&&new RegExp(`\\b(${s(t)})$`,'i').test(i)},l=t.filter(e=>!a(e.key));return l.length?f(l,n,o):t.some(e=>(n[e.key]??0)>0)?'not enough left':'none left'},Object.defineProperty(_e,"withReason",{enumerable:!0,get:function(){return h}}),_e.usesText=function(e,t){return e.length?e.map(e=>{const n=t.find(t=>t.key===e.key),o=(n?.name??e.key).toLowerCase(),s=(n?.plural??`${o}s`).toLowerCase();return`${.5===e.qty?'\xbd':Number.isInteger(e.qty)?String(e.qty):`${Math.floor(e.qty)}\xbd`} ${e.qty>1?s:o}`}).join(', '):'Not linked to the counts'},_e.planAuto=function(e){const{rid:t,enabled:n,dishes:o,counts:s,entries:i,lastChange:a,now:l}=e,u={mark:[],clear:[]},f=new Map(i.filter(e=>e.rid===t).map(e=>[e.itemId,e])),h=l.getTime(),m=e=>e.on&&(!e.clearAfter||new Date(e.clearAfter).getTime()>h),d=new Set;for(const e of o){d.add(e.id);const t=f.get(e.id),o=n?c(e.uses,s):[];if(o.length){if(t&&m(t))continue;if(t&&t.kept){const e=o.map(e=>a[e.key]??'').sort().pop()??'';if(!e||e<=t.at)continue}u.mark.push({itemId:e.id,name:e.name})}else t&&t.auto&&m(t)&&u.clear.push(e.id)}for(const e of f.values())e.auto&&m(e)&&!d.has(e.itemId)&&u.clear.push(e.itemId);return u};const e='meat|bisque|stock|cakes?|claws?|sauce|butter|oil|paste|salad|mayo|mayonnaise|thermidor|tails?|bon|croquettes?|p\xe2t\xe9|pate|rolls?|soup|linguine|ravioli',t=/^(g|kg|gram|grams|ml|l|litre|litres|oz|lb|lbs|cl)$/i,n={a:1,an:1,one:1,two:2,three:3,four:4,five:5,six:6,half:.5,'\xbd':.5},o=e=>e.replace(/[.*+?^${}()|[\]\\]/g,'\\$&'),s=e=>{const t=new Set([e.name,e.plural].map(e=>e.trim().toLowerCase()).filter(Boolean));for(const e of[...t])e.endsWith('s')?t.add(e.slice(0,-1)):t.add(e+'s');return[...t].sort((e,t)=>t.length-e.length).map(o).join('|')};function i(e){const t=(e||'').trim().toLowerCase();if(!t)return 1;if(/^\xbd$|^half\b/.test(t))return.5;const o=t.match(/^(\d+(?:\.\d+)?)\s*(\xbd)?/);if(o)return Number(o[1])+(o[2]?.5:0);const s=t.split(/\s+/)[0];return n[s]??1}const a=(e,t)=>'half'===e.unit?Math.max(.5,Math.round(2*t)/2):Math.max(1,Math.round(t)),l=e=>(e.optionGroups??[]).some(e=>e.choices.some(e=>/\bhalf\b/i.test(e.label)));function u(n,o,u){const c=u.filter(e=>!1!==e.active&&'kg'!==e.unit),f=(e,t)=>({source:e,uses:t.map(t=>{const o=c.find(e=>e.key===t.key),s='half'===o.unit&&l(n)&&'description'!==e?.5:t.qty;return{key:t.key,qty:a(o,s)}})});if(o){const e=[];for(const n of c){const a=new RegExp(`\\b(${s(n)})\\b`,'i'),l=o.ingredients.find(e=>a.test(e.name)&&!t.test((e.unit||'').trim())&&!/\b(meat|stock|bisque|oil|butter|paste)\b/i.test(e.name));l&&e.push({key:n.key,qty:i(`${l.qty} ${l.unit}`)})}if(e.length)return f('card',e)}const h=n.description??'';{const t=[];for(const n of c){const o=new RegExp(`\\b(half an?|a|an|one|two|three|four|five|six|\\d+(?:\\.\\d+)?|\xbd)\\s+(?:(?:whole|fresh|live|dressed|local)\\s+)?(?:[A-Za-z'\u2019-]+\\s+){0,2}?(${s(n)})\\b(?!\\s+(?:${e}))`,'i'),a=h.match(o);a&&t.push({key:n.key,qty:i(a[1])})}if(t.length)return f('description',t)}{const e=n.name.replace(/\([^)]*\)/g,'').trim(),t=[];for(const n of c)new RegExp(`\\b(${s(n)})$`,'i').test(e)&&t.push({key:n.key,qty:1});if(t.length)return f('name',t)}return{uses:[],source:'none'}}function c(e,t){return e.filter(e=>(t[e.key]??0)(n.find(t=>t.key===e)?.name??e).toLowerCase(),s=e.filter(e=>(t[e.key]??0)<=0).map(e=>o(e.key)),i=e.filter(e=>(t[e.key]??0)>0).map(e=>o(e.key)),a=e=>e.length<=2?e.join(' or '):`${e.slice(0,-1).join(', ')} or ${e[e.length-1]}`;return[s.length?`no ${a(s)}`:'',i.length?`not enough ${a(i)}`:''].filter(Boolean).join(', ')}const h=(e,t)=>t?`${e.replace(/\s*\([^)]*\)\s*$/,'').trim()||e} (${t})`:e},943,[]); +__d(function(g,r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEFAULT_SOLD_OUT",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"SOLD_OUT_CLEAR_LABEL",{enumerable:!0,get:function(){return t}}),_e.soldOutSettingsOf=function(t){const n='morning'===t?.clear||'manual'===t?.clear||'close'===t?.clear?t.clear:e.clear,o=/^([01]\d|2[0-3]):[0-5]\d$/.test(t?.morningAt??'')?t.morningAt:e.morningAt;return{clear:n,morningAt:o,auto:!1!==t?.auto}},_e.clearAfterFor=function(e,t,o){if('manual'===t.clear)return;const c=(()=>{const o=n(e,t.morningAt);return ee.getTime()?o:c},_e.activeSoldOut=function(e,t,n){const o=n.getTime();return e.filter(e=>e.rid===t&&e.on&&(!e.clearAfter||new Date(e.clearAfter).getTime()>o)).sort((e,t)=>t.at.localeCompare(e.at)||e.name.localeCompare(t.name))},_e.expiredSoldOut=function(e,t,n){const o=n.getTime();return e.filter(e=>e.rid===t&&e.on&&!!e.clearAfter&&new Date(e.clearAfter).getTime()<=o)},_e.stripText=o,_e.stripNeedsTicker=function(e,t,n){return o(e).length*n*.56>Math.max(0,t-150)},_e.soldOutCount=function(e){return 1===e?'1 dish sold out':`${e} dishes sold out`};const e={clear:'close',morningAt:'05:00',auto:!0},t={close:'When the kitchen closes',morning:'Next morning',manual:'Only when someone taps Back on'};const n=(e,t,n=0)=>{const[o,c]=t.split(':').map(Number);return new Date(e.getFullYear(),e.getMonth(),e.getDate()+n,o,c,0,0)};function o(e){return e.join(' \xb7 ')}},944,[]); +__d(function(_g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"SHAPES",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"shapeLabel",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"tableLabel",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"tableNumber",{enumerable:!0,get:function(){return u}}),_e.numberClashes=function(e){const t=new Map;for(const n of e){const e=u(n);t.set(e,[...t.get(e)??[],{name:n.name,areaId:n.areaId}])}const n=new Set,r=[];for(const[e,a]of t){if(a.length<2)continue;const t=new Map;a.forEach(e=>t.set(e.areaId,[...t.get(e.areaId)??[],e.name]));for(const e of t.values())e.length>1&&e.forEach(e=>n.add(e));t.size>1&&r.push(e)}return{sameArea:n,acrossAreas:r}},Object.defineProperty(_e,"liveTableLabel",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"FIXTURES",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"PLAN_W",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"PLAN_H",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"GRID",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"snap",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"clamp",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"fid",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"slug",{enumerable:!0,get:function(){return w}}),_e.sizeFor=y,Object.defineProperty(_e,"minFor",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"numOf",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"byNumber",{enumerable:!0,get:function(){return P}}),_e.newTable=j,_e.autoArrange=M,_e.placeNew=S,_e.rotate90=function(e){const t=e.x+e.w/2,n=e.y+e.h/2;return{...e,w:e.h,h:e.w,x:h(f(t-e.h/2),0,c-e.h),y:h(f(n-e.w/2),0,b-e.w)}},_e.normalisePlan=function(e){return{...e,fixtures:e.fixtures??[],tables:e.tables.map(e=>{const t=e.shape;let n='booth'===t||'rect'===t?'rect':'round'===t?'round':'square',{w:r,h:a}=e;if('square'===n||'round'===n){const e=Math.max(r,a);r=e,a=e}if(90===e.rot||270===e.rot){const e=r;r=a,a=e}return'rect'===n&&r===a&&(n='square'),{...e,shape:n,w:r,h:a,rot:0}})}},Object.defineProperty(_e,"SECTION_COLOURS",{enumerable:!0,get:function(){return I}}),_e.buildPlan=k,_e.anchoragePlan=$,_e.starterPlan=function(){return k({areas:[{name:'Main room',tables:[[1,2],[2,4],[3,6],[4,4],[5,2],[6,6]],fixtures:[A(450,600)]}]},['SV'])},Object.defineProperty(_e,"TEMPLATES",{enumerable:!0,get:function(){return v}}),_e.parseTableList=function(e){const t=[],n=[];let r;for(const a of e.split(/\r?\n/)){const e=a.trim();if(!e)continue;if(!/\d/.test(e)){r=e.replace(/[:\-\u2013]+$/,'').trim()||r;continue}const o=e.match(/^(?:table|tbl|tab|t)?\s*(?:no\.?|number|#)?\s*([a-z]?\d+[a-z]?)\b[^\d]*?(\d+)/i);if(!o){n.push(e);continue}const s=parseInt(o[2],10);!s||s>30?n.push(e):t.push({area:r,name:o[1].toUpperCase(),seats:s})}return{items:t,skipped:n}},Object.defineProperty(_e,"planCounts",{enumerable:!0,get:function(){return C}}),Object.defineProperty(_e,"tableDogOk",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e,"dogTables",{enumerable:!0,get:function(){return L}}),Object.defineProperty(_e,"areaOfTable",{enumerable:!0,get:function(){return q}}),_e.bestTables=E,Object.defineProperty(_e,"isBestTable",{enumerable:!0,get:function(){return _}}),_e.withSeedBest=function(e,t){if('anchorage'!==e||!t?.areas?.some(e=>void 0===e.best))return t;const n=$();return{...t,areas:t.areas.map(e=>{if(void 0!==e.best)return e;const r=n.areas.find(t=>t.id===e.id||t.name===e.name),a=(r?.best??[]).filter(n=>t.tables.some(t=>t.name===n&&t.areaId===e.id));return a.length?{...e,best:a}:e})}};var e,t=_r(d[0]),n=_r(d[1]),r=(e=n)&&e.__esModule?e:{default:e};const a=[{id:'square',label:'Square'},{id:'rect',label:'Rectangle'},{id:'round',label:'Round'}],o=e=>'rect'===e?'Rectangle':'round'===e?'Round':'Square',s=e=>/\d/.test(e.name)?(0,t.plainTableNumber)(e.name):(0,t.plainTableNumber)(e.label?.trim()||e.name),u=s;const l=(e,t)=>u(e),i=[{id:'bar',label:'Bar',w:300,h:50},{id:'wall',label:'Wall',w:250,h:25},{id:'door',label:'Door',w:100,h:25},{id:'window',label:'Window',w:200,h:25}],c=1e3,b=625,m=25,f=e=>Math.round(e/m)*m,h=(e,t,n)=>Math.max(t,Math.min(n,e));let p=0;const g=e=>`${e}-${Date.now().toString(36)}${(p++).toString(36)}`,w=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,'-').replace(/^-|-$/g,'')||'area';function y(e){return e<=2?{shape:'square',w:75,h:75}:e<=4?{shape:'square',w:100,h:100}:e<=6?{shape:'rect',w:150,h:100}:e<=8?{shape:'rect',w:200,h:100}:e<=10?{shape:'rect',w:250,h:100}:{shape:'rect',w:300,h:100}}const x=e=>e<=2?1:Math.max(2,Math.ceil(e/2)),O=e=>{const t=e.match(/\d+/);return t?parseInt(t[0],10):9999},P=(e,t)=>O(e.name)-O(t.name)||e.name.localeCompare(t.name);function j(e,t,n,r){const a=y(n);return{id:`t-${e}-${g('x').slice(2)}`,name:e,areaId:t,shape:a.shape,minSeats:x(n),maxSeats:n,x:0,y:0,w:a.w,h:a.h,rot:0,online:!0,sectionId:r}}function M(e,t=125,n=75){const r=[...e].sort(P);if(!r.length)return r;let a=75;const o=e=>{const t=[];let n=[],a=0;for(const o of r){const r=(n.length?e:0)+o.w;n.length&&a+r>850&&(t.push(n),n=[],a=0),n.push(o),a+=(n.length>1?e:0)+o.w}return n.length&&t.push(n),t};let s=o(a);const u=(e,t)=>e.reduce((e,t)=>e+Math.max(...t.map(e=>e.h)),0)+t*(e.length-1);for(;u(s,a)>b-t-n&&a>25;)a-=25,s=o(a);const l=u(s,a),i=b-t-n,p=s.length>1?Math.min(150,a+Math.max(0,Math.floor((i-l)/(s.length-1)/m)*m)):0,g=s.reduce((e,t)=>e+Math.max(...t.map(e=>e.h)),0)+p*(s.length-1);let w=f(t+Math.max(0,(i-g)/2));const y=[];for(const e of s){const t=Math.max(...e.map(e=>e.h)),n=e.reduce((e,t)=>e+t.w,0)+a*(e.length-1);let r=f((c-n)/2);for(const n of e)y.push({...n,x:h(r,0,c-n.w),y:h(f(w+(t-n.h)/2),0,b-n.h),rot:0}),r+=n.w+a;w+=t+p}return y}function S(e,t,n=[]){const r=[...e,...n].map(e=>({x:e.x,y:e.y,w:e.w,h:e.h})),a=[];for(const e of t){let t=null;for(let n=50;n<=b-e.h-25&&!t;n+=m)for(let a=50;a<=c-e.w-25&&!t;a+=m){const o=50;r.some(t=>at.x&&nt.y)||(t={x:a,y:n})}const n=t??{x:50,y:50},o={...e,x:n.x,y:n.y};r.push({x:o.x,y:o.y,w:o.w,h:o.h}),a.push(o)}return a}const I=['#CFA45F','#E2C489','#A88B5A','#8C6A3A','#FFB547','#D9B98A'];function k(e,t=[]){const n=[],r=[],a=[],o=[];e.areas.forEach((e,s)=>{const u=w(e.name),l=e.best?e.best.map(String).filter(t=>e.tables.some(([e])=>String(e)===t)):void 0;n.push({id:u,name:e.name,dogs:!!e.dogs,outdoor:!!e.outdoor,...e.label?{label:e.label}:{},...e.colour?{colour:e.colour}:{},...l?{best:l}:{}});const i=`s-${u}`;o.push({id:i,name:e.name,colour:e.colour??I[s%I.length],server:t[s]??''});const m=(e.fixtures??[]).map((e,t)=>({...e,id:`fx-${u}-${t}`,areaId:u}));a.push(...m);const f=m.some(e=>e.y<100&&('bar'===e.kind||e.w>=300))?150:100,p=e.tables.map(([e,t])=>({...j(String(e),u,t,i),id:`t-${e}`})),g=e.layout??{},y=p.filter(e=>g[e.name]).map(e=>{const t=g[e.name],n=t.shape??(t.w===t.h?'square':'rect'),r=h(Math.round(t.w),50,c),a=h(Math.round('rect'===n?t.h:t.w),50,b);return{...e,shape:n,w:r,h:a,x:h(Math.round(t.x),0,c-r),y:h(Math.round(t.y),0,b-a),...t.label?{label:t.label}:{}}}),x=p.filter(e=>!g[e.name]);y.length?r.push(...y,...S(y,x,m)):r.push(...M(p,f,75))});const s=new Set(r.map(e=>e.name)),u=(e.joins??[]).filter(e=>e.every(e=>s.has(e))).map(e=>({id:`j-${e.join('-')}`,tables:e}));return{areas:n,tables:r,joins:u,sections:o,fixtures:a}}const T=(e,t,n=0,r=25)=>({kind:'window',x:e,y:n,w:t,h:r}),A=(e,t,n=100,r=25)=>({kind:'door',x:e,y:t,w:n,h:r});function $(){const e=r.default;return k({areas:e.areas.map(e=>({name:e.name,dogs:!!e.dogFriendly,outdoor:!(!e.outdoor&&!e.weatherDependent),label:e.label,colour:e.colour,tables:e.tables.map(([e,t])=>[e,t]),layout:e.layout,fixtures:[],best:e.best?.map(String)})),joins:e.joins??[]},e.areas.map(e=>e.server??''))}const v=[{id:'anchorage',name:'The Anchorage',sub:'4 areas \xb7 29 tables \xb7 119 seats',make:$},{id:'cafe',name:'Small caf\xe9',sub:'1 room \xb7 8 tables \xb7 dogs welcome',make:()=>k({areas:[{name:'Caf\xe9',dogs:!0,tables:[[1,2],[2,2],[3,4],[4,4],[5,2],[6,4],[7,2],[8,6]],fixtures:[{kind:'bar',x:300,y:25,w:400,h:50},A(450,600)]}]})},{id:'pub',name:'Pub with garden',sub:'Bar, lounge and beer garden',make:()=>k({areas:[{name:'Bar',dogs:!0,tables:[[1,2],[2,4],[3,4],[4,2],[5,4],[6,6]],fixtures:[{kind:'bar',x:250,y:25,w:500,h:75}]},{name:'Lounge',tables:[[7,4],[8,4],[9,2],[10,6],[11,4],[12,2],[13,4],[14,8]],fixtures:[T(150,700)]},{name:'Beer garden',dogs:!0,outdoor:!0,tables:[[20,6],[21,6],[22,4],[23,4],[24,6],[25,6]]}]})},{id:'restaurant',name:'Restaurant and terrace',sub:'Dining room with an outdoor terrace',make:()=>k({areas:[{name:'Dining room',tables:[[1,2],[2,2],[3,4],[4,4],[5,4],[6,6],[7,2],[8,2],[9,4],[10,4],[11,6],[12,8]],fixtures:[T(100,800),A(450,600)]},{name:'Terrace',outdoor:!0,tables:[[20,2],[21,4],[22,4],[23,2]]}]})},{id:'blank',name:'Blank',sub:'One empty room to start from',make:()=>k({areas:[{name:'Main room',tables:[]}]})}];const C=(e,t)=>{const n=t?e.tables.filter(e=>e.areaId===t):e.tables;return{tables:n.length,seats:n.reduce((e,t)=>e+t.maxSeats,0)}},B=(e,t)=>void 0!==t.dogOk?t.dogOk:!!e.areas.find(e=>e.id===t.areaId)?.dogs,L=e=>new Set(e.tables.filter(t=>B(e,t)).map(e=>e.name)),q=(e,t)=>e.areas.find(n=>n.id===e.tables.find(e=>e.name===t)?.areaId);function E(e,t){return e.areas.filter(e=>!t||e.id===t).flatMap(t=>(t.best??[]).filter(n=>e.tables.some(e=>e.name===n&&e.areaId===t.id)))}const _=(e,t)=>E(e).includes(t)},945,[808,17]); +__d(function(g,r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DEFAULT_WAKE_PIN",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"DEFAULT_WAKE_SALT",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"hashWakePin",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"DEFAULT_WAKE",{enumerable:!0,get:function(){return o}}),e.newSalt=u,e.wakePinProblem=function(n){return/^\d{6,8}$/.test(n)?/^(\d)\1+$/.test(n)||'0123456789012'.includes(n)||'9876543210987'.includes(n)?'Pick a PIN that is harder to guess (not all the same digit or a run like 123456).':n===t?'Pick a new PIN, not the starting one.':null:'The wake PIN must be 6 to 8 digits.'},e.makeWakePin=function(n,t=u()){return{pinHash:a(n,t),pinSalt:t,pinLen:n.length,pinDefault:!1}},Object.defineProperty(e,"wakePinMatches",{enumerable:!0,get:function(){return l}}),e.fromOldPin=function(n){const i='string'==typeof n&&/^\d{4,8}$/.test(n)?n:t;if(i===t)return{...o};const l=u();return{pinHash:a(i,l),pinSalt:l,pinLen:i.length,pinDefault:!1}};var n=r(d[0]);const t='2580',i='cc-wake-default',a=(t,i)=>(0,n.sha256HexSync)(`cc-wake:${i}:${t}`),o={pinHash:a(t,i),pinSalt:i,pinLen:4,pinDefault:!0};function u(){const n=globalThis.crypto,t=new Uint8Array(12);if(n?.getRandomValues)n.getRandomValues(t);else for(let n=0;nn.toString(16).padStart(2,'0')).join('')}const l=(n,t)=>a(t,n.pinSalt)===n.pinHash},946,[1153]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useSliders",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"notify",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"dismissNotice",{enumerable:!0,get:function(){return c}});var t=r(d[0]);let u=0;const s=t=>'urgent'===t.tone?0:'warn'===t.tone?1:2,n=(0,t.create)()((t,n)=>({queue:[],push:n=>t(t=>{const o=t.queue.find(t=>t.id===n.id),c=o?t.queue.map(t=>t.id===n.id?{...n,seq:o.seq}:t):[...t.queue,{...n,seq:++u}];return{queue:(f=c,[...f].sort((t,u)=>s(t)-s(u)||(t.seq??0)-(u.seq??0))).slice(0,40)};var f}),dismiss:u=>{const s=n().queue.find(t=>t.id===u);if(s){t(t=>({queue:t.queue.filter(t=>t.id!==u)}));try{s.onClose?.()}catch{}}},dismissWhere:t=>{for(const u of n().queue.filter(t))n().dismiss(u.id)}})),o=t=>n.getState().push(t),c=t=>n.getState().dismiss(t)},947,[952]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return n.default}});var e=r(d[0]);Object.keys(e).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(_e,t)||Object.defineProperty(_e,t,{enumerable:!0,get:function(){return e[t]}})});var t,n=(t=e)&&t.__esModule?t:{default:t}},948,[1311]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"canCancelWalkIn",{enumerable:!0,get:function(){return w}}),_e.cancelWalkInWords=y,_e.cancelWalkInNow=$,_e.CancelWalkInButton=function({rid:e,b:l,onDone:t,small:s}){const[c,o]=(0,n.useState)(!1);return w(l)?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(u.Button,{kind:"secondary",small:s,label:"Cancel walk-in",testID:`cancel-walkin-${l.id}`,accessibilityLabel:`Cancel walk-in ${l.ref}, ${l.partySize} Covers`,onPress:()=>o(!0),style:s?{minHeight:44}:k}),c?(0,f.jsx)(h,{rid:e,b:l,onClose:()=>o(!1),onDone:t}):null]}):null},_e.CancelWalkInConfirm=h;var e,n=r(d[0]),l=r(d[1]),t=(e=l)&&e.__esModule?e:{default:e},s=r(d[2]),c=r(d[3]),o=r(d[4]),b=r(d[5]),u=r(d[6]),f=r(d[7]);const k={minHeight:56},w=e=>!!e.walkIn&&('seated'===e.status||'confirmed'===e.status);function y(e){const n=(0,c.tablesOf)(e.table),l=(0,o.tablesWords)(n);return`Cancel walk-in ${e.ref}, ${e.partySize} Covers${n.length?` at ${l}`:''}, arrived ${e.time}? It comes off the Covers${n.length?` and ${l} ${n.length>1?'go':'goes'} back to Free`:''}.`}async function $(e,n){await s.repo.bookings.setStatus(n.id,'cancelled'),(0,c.tablesOf)(n.table).forEach(n=>c.useFloor.getState().setLive(e,n,{stage:void 0,dirty:!1}))}function h({rid:e,b:n,onClose:l,onDone:s}){const w=y(n);return(0,f.jsxs)(u.Sheet,{visible:!0,onClose:l,title:"Cancel walk-in?",maxWidth:560,testID:"cancel-walkin-confirm",children:[(0,f.jsx)(t.default,{accessible:!0,accessibilityLabel:w,children:(0,f.jsx)(u.T,{size:18,colour:b.colours.text,children:w})}),(0,f.jsxs)(u.Row,{gap:8,wrap:!0,children:[(0,f.jsx)(u.Button,{label:"Yes, cancel walk-in",testID:"cancel-walkin-yes",accessibilityLabel:`Yes, cancel walk-in ${n.ref}`,style:[k,{flexGrow:1}],onPress:async()=>{await $(e,n),l(),s?.(`Walk-in ${n.ref} cancelled.${(0,c.tablesOf)(n.table).length?` ${(0,o.tablesWords)((0,c.tablesOf)(n.table))} free.`:''}`)}}),(0,f.jsx)(u.Button,{kind:"secondary",label:"Keep walk-in",testID:"cancel-walkin-no",accessibilityLabel:`Keep walk-in ${n.ref}`,onPress:l,style:k})]})]})}},949,[30,127,819,825,931,821,813,24]); +__d(function(g,_r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AllergenBar=p,_e.NeedsPills=k,_e.BookingNeeds=x,Object.defineProperty(_e,"needsIcons",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"confirmHolds",{enumerable:!0,get:function(){return S}}),_e.serveHolds=y,_e.postNewBookingToKitchen=function(e,t){if(!t||'system'===t)return;const s=o.useStore.getState().restaurants.find(t=>t.id===e.restaurantId),l=[],r=`${e.name}, ${(0,c.niceDate)((0,c.parseYmd)(e.date)).slice(0,3)} ${e.time}${e.table?`, table ${e.table}`:''}`;if((e.holds??[]).filter(e=>e.qty>0).length){const t=I(e.restaurantId);l.push(`${(0,u.holdsText)(e,(0,u.reservablesOf)(s),t)} reserved: ${r}. Tap Platter OK in the Head Chef app.`)}(0,u.hasAllergens)(e)&&l.push(`\u26a0\ufe0f Allergens: ${(0,u.allergenText)(e)} \u2014 ${r}. Please sign \u2018Allergens seen\u2019.`);if(!l.length)return;a.useOwner.getState().chatSend({ch:'kitchen',from:t,text:l.join('\n'),at:(new Date).toISOString()})},_e.useKitchenTodo=D,_e.KitchenSignoffs=function({rid:t,today:s,by:a,app:f,canConfirm:p=!0,showAll:k}){const j=D(t,s),I=(0,o.useBookings)(t),T=(0,o.useRestaurant)(t),O=(0,n.useStockItems)(t),$=(0,u.reservablesOf)(T),A=I.filter(e=>e.date===s&&!['cancelled','noshow'].includes(e.status)&&(e.holds??[]).some(e=>e.qty>0)),v=k?[...j,...A.filter(e=>!j.includes(e))]:j;return v.length?(0,b.jsxs)(l.default,{testID:"kitchen-signoffs",style:{gap:10,padding:16,borderRadius:16,borderWidth:1.5,borderColor:j.length?h.colours.amber:h.colours.hairline,backgroundColor:h.colours.surface},children:[(0,b.jsx)(r.T,{size:12,weight:"semibold",colour:j.length?h.colours.amber:h.colours.goldMuted,style:{letterSpacing:1.6},children:j.length?`KITCHEN SIGN-OFF NEEDED (${j.length})`:'RESERVED TODAY'}),v.map(t=>(0,b.jsxs)(l.default,{style:{gap:6,paddingTop:8,borderTopWidth:1,borderColor:h.colours.hairline},testID:`signoff-${t.ref}`,children:[(0,b.jsxs)(r.T,{weight:"semibold",children:[t.name," \xb7 ",t.partySize," covers \xb7 ",t.date===s?'Today':(0,c.niceDate)((0,c.parseYmd)(t.date))," ",t.time,t.table?` \xb7 ${(0,e.tableNumbers)(t.table)}`:'']}),(0,b.jsx)(x,{b:t}),p?(0,b.jsxs)(r.Row,{wrap:!0,gap:8,children:[(0,u.needsAllergenSeen)(t)?(0,b.jsx)(r.Button,{small:!0,kind:"danger",label:"Allergens seen",testID:`allergens-seen-${t.ref}`,onPress:()=>o.useStore.getState().ackBookingAllergy(t.id,a)}):null,(0,u.needsHoldOk)(t)?(0,b.jsx)(r.Button,{small:!0,kind:"success",label:/platter/i.test((0,u.holdsText)(t,$,O))?'Platter OK':'Reservation OK',testID:`platter-ok-${t.ref}`,onPress:()=>S(t.id,a)}):null,t.date===s&&t.holdOk&&(t.holds??[]).some(e=>!e.served)&&['seated','confirmed'].includes(t.status)?(0,b.jsx)(r.Button,{small:!0,kind:"secondary",label:"Served",testID:`served-${t.ref}`,onPress:()=>y(t,a,f)}):null]}):(0,b.jsx)(r.Muted,{children:"The kitchen signs these off."})]},t.id))]}):null},_e.PlattersBooked=function({rid:e,date:t,label:s}){const a=(0,o.useBookings)(e),c=(0,o.useRestaurant)(e),f=(0,n.useStockItems)(e),p=(0,u.heldSummary)(a,t,(0,u.reservablesOf)(c)),k=Object.entries(p.stock).filter(([,e])=>e>0).map(([e,t])=>`${t} ${(f.find(t=>t.key===e)?.name??e).toLowerCase()}`);return p.platters||k.length?(0,b.jsx)(l.default,{testID:"platters-booked",children:(0,b.jsxs)(r.T,{weight:"semibold",colour:h.colours.goldLight,children:[s??'Platters booked',": ",p.platters,k.length?` (${k.join(', ')})`:'']})}):null};var e=_r(d[0]);_r(d[1]);var t,s=_r(d[2]),l=(t=s)&&t.__esModule?t:{default:t},r=_r(d[3]),o=_r(d[4]),n=_r(d[5]),a=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),b=_r(d[10]);const f=({label:e,bg:t,fg:s,border:o,testID:n})=>(0,b.jsx)(l.default,{testID:n,style:{backgroundColor:t,borderColor:o,borderWidth:1,borderRadius:999,paddingHorizontal:9,paddingVertical:2},children:(0,b.jsx)(r.T,{size:13,weight:"semibold",colour:s,children:e})});function p({b:e,big:t}){return(0,u.hasAllergens)(e)?(0,b.jsxs)(l.default,{testID:`allergen-bar-${e.ref}`,style:{backgroundColor:h.colours.redSolid,borderRadius:10,paddingHorizontal:10,paddingVertical:t?8:5,gap:2},children:[(0,b.jsxs)(r.T,{size:t?16:13,weight:"bold",colour:"#FFFFFF",children:["\u26a0\ufe0f ALLERGENS: ",(0,u.allergenText)(e)]}),e.allergyAck?(0,b.jsxs)(r.T,{size:12,colour:"#FFE3DF",children:["Seen by kitchen: ",e.allergyAck.by]}):(0,b.jsx)(r.T,{size:12,colour:"#FFE3DF",children:"Kitchen hasn\u2019t signed \u2018Allergens seen\u2019 yet"})]}):null}function k({b:t,r:s}){const l=(0,n.useStockItems)(t.restaurantId),o=(0,u.reservablesOf)(s),a=(t.holds??[]).some(e=>e.qty>0),c=[];return t.drinksOnly&&c.push((0,b.jsx)(f,{testID:"pill-drinks",label:"\ud83c\udf77 Drinks only (after last food orders)",bg:h.colours.surface2,fg:h.colours.goldLight,border:h.colours.accentBorder},"x")),(0,u.hasAccess)(t)&&c.push((0,b.jsx)(f,{testID:"pill-access",label:`\u267f ${(0,u.accessText)(t)}`,bg:h.colours.blueBg,fg:"#E2C489",border:h.colours.blue},"a")),(0,u.dogCount)(t)&&c.push((0,b.jsx)(f,{testID:"pill-dog",label:"\ud83d\udc15 "+((0,u.dogCount)(t)>1?`${(0,u.dogCount)(t)} dogs`:'Dog'),bg:h.colours.surface2,fg:h.colours.text,border:h.colours.hairline},"d")),(0,u.dietText)(t)&&c.push((0,b.jsx)(f,{testID:"pill-veg",label:`\u24cb ${(0,u.dietText)(t)}`,bg:"#2A2216",fg:"#E2C489",border:"#CFA45F"},"v")),a&&c.push(t.holdOk?(0,b.jsx)(f,{testID:"pill-platter",label:`\u2713 ${(0,u.holdsText)(t,o,l)} \xb7 confirmed`,bg:h.colours.okBg,fg:"#E2C489",border:h.colours.ok},"h"):(0,b.jsx)(f,{testID:"pill-platter",label:`\ud83e\udd9e ${(0,u.holdsText)(t,o,l)} \xb7 awaiting kitchen`,bg:h.colours.amberBg,fg:"#FFE2A8",border:h.colours.amber},"h")),t.tableReq?.length&&c.push((0,b.jsx)(f,{testID:"pill-request",label:`Requested: ${t.tableReq.map(t=>`${(0,e.tableNumbers)(t)}`).join(' or ')}`,bg:h.colours.goldTint,fg:h.colours.goldLight,border:h.colours.accentBorder},"t")),c.length?(0,b.jsx)(r.Row,{wrap:!0,gap:6,children:c}):null}function x({b:e,big:t}){const s=(0,o.useRestaurant)(e.restaurantId);return(0,b.jsxs)(l.default,{style:{gap:6},children:[(0,b.jsx)(p,{b:e,big:t}),(0,b.jsx)(k,{b:e,r:s})]})}const j=e=>[(0,u.hasAllergens)(e)?'\u26a0\ufe0f':'',(0,u.hasAccess)(e)?'\u267f':'',(0,u.dogCount)(e)?'\ud83d\udc15':'',(0,u.dietText)(e)?'\u24cb':'',(e.holds??[]).some(e=>e.qty>0)?e.holdOk?'\ud83e\udd9e\u2713':'\ud83e\udd9e':''].filter(Boolean).join(' '),S=(e,t)=>o.useStore.getState().updateBooking(e,{holdOk:{by:t,at:(new Date).toISOString()}});function y(e,t,s){const l=o.useStore.getState().restaurants.find(t=>t.id===e.restaurantId),r=(0,u.stockNeed)(e,(0,u.reservablesOf)(l));for(const[l,o]of Object.entries(r))o>0&&n.shellfish.append({rid:e.restaurantId,kind:l,delta:-o,reason:'sold',by:t,app:s});const a=(new Date).toISOString();o.useStore.getState().updateBooking(e.id,{holds:(e.holds??[]).map(e=>e.served?e:{...e,served:{by:t,at:a}})})}const I=e=>n.useShellStore.getState().items[e]??[];function D(e,t){return(0,o.useBookings)(e).filter(e=>e.date>=t&&!e.walkIn&&((0,u.needsAllergenSeen)(e)||(0,u.needsHoldOk)(e))).sort((e,t)=>(e.date+e.time).localeCompare(t.date+t.time))}},950,[808,30,127,813,819,1026,856,828,818,821,24]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.DepositChip=function({b:e,money:o,big:n,testID:b}){const f=(0,s.depositView)(e,o);if(!f)return null;const h={gold:[t.colours.goldTint,t.colours.goldLight,t.colours.gold],amber:[t.colours.amberBg,'#FFE2A8',t.colours.amber],red:[t.colours.redBg,'#FFD9D4',t.colours.red],neutral:[t.colours.surface2,t.colours.muted,t.colours.border]}[f.kind];return(0,u.jsxs)(l.default,{accessible:!0,accessibilityRole:"text",accessibilityLabel:f.a11y,testID:b??'deposit-chip',style:{alignSelf:'flex-start',maxWidth:'100%'},children:[(0,u.jsx)(l.default,{style:{backgroundColor:h[0],borderColor:h[2],borderWidth:n?2:1,borderRadius:8,paddingHorizontal:n?12:8,paddingVertical:n?6:3},children:(0,u.jsx)(c.T,{size:16,weight:"semibold",colour:h[1],children:f.label})}),f.note?(0,u.jsx)(c.Muted,{size:12,children:f.note}):null]})},r(d[0]);var e,o=r(d[1]),l=(e=o)&&e.__esModule?e:{default:e},s=r(d[2]),t=r(d[3]),c=r(d[4]),u=r(d[5])},951,[30,127,13,821,813,24]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0});var t=r(d[0]);Object.keys(t).forEach(function(n){'default'===n||Object.prototype.hasOwnProperty.call(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[n]}})});var n=r(d[1]);Object.keys(n).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})})},952,[1126,1127]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";function i(i){return i&&i.__esModule?i:{default:i}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEFAULT_AVATARS",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"AVATAR_BGS",{enumerable:!0,get:function(){return F}}),Object.defineProperty(_e,"AVATAR_RINGS",{enumerable:!0,get:function(){return u}}),_e.specFor=E,_e.AvatarArt=$,_e.useStaffMember=v,_e.StaffAvatar=function({id:i,name:t,size:s=34,ring:c=!0}){const f=v(i,t),y=f?.id??i,F=(0,n.useAvatars)(i=>y?i.photos[y]:void 0),u=(0,o.useSetup)(i=>y?i.looks[y]:void 0),j=`${(f?.name??t??'Team member').replace(' (example)','')}'s avatar`;return(0,h.jsx)(r.default,{testID:y?`avatar-${y}`:'avatar',accessibilityLabel:j,accessibilityRole:"image",style:{width:s,height:s,borderRadius:s/2,overflow:'hidden',borderWidth:c?Math.max(1,s/22):0,borderColor:x.colours.gold,backgroundColor:(0,l.soutersSurface)('#111')},children:F?(0,h.jsx)(e.default,{source:{uri:F.dataUrl},style:{width:'100%',height:'100%'},accessibilityIgnoresInvertColors:!0}):(0,h.jsx)($,{spec:null!=u?E(`${y}#look${u}`):E(y,f?.name??t),size:s-(c?2*Math.max(1,s/22):0)})})};var l=_r(d[0]);_r(d[1]);var e=i(_r(d[2])),r=i(_r(d[3])),t=_r(d[4]),s=i(t),c=_r(d[5]),n=_r(d[6]),o=_r(d[7]),x=_r(d[8]),f=_r(d[9]),h=_r(d[10]);const y=Object.fromEntries(f.ROSTER.map(i=>[i.id,i.avatar])),F=['#2A2520','#B89A72','#D9A441','#4A3F35','#3A3029','#8A6A3B'],u=['#E9B949','#CFA45F'],j=F,C=['#F1C7A5','#E8B48F','#C68B5E','#8D5B3E','#F4D2B8','#A86B45'],p=['#2B1B12','#7A4E2A','#151515','#C2462E','#D9B26A'],A=['quiff','flip','crop','beehive','bob','curls'],b=i=>{let l=7;for(const e of i)l=31*l+e.charCodeAt(0)>>>0;return l};function E(i,l){if(i&&y[i])return y[i];const e=b(i||l||'crew');return{bg:j[e%6],ring:u[e%2],skin:C[(e>>3)%6],hair:p[(e>>6)%5],hairStyle:A[(e>>9)%6],suit:'#F2EAD8',antenna:['ball','star','none'][(e>>12)%3]}}const k=(i,l,e)=>`M${i} ${l-e} Q${i+.18*e} ${l-.18*e} ${i+e} ${l} Q${i+.18*e} ${l+.18*e} ${i} ${l+e} Q${i-.18*e} ${l+.18*e} ${i-e} ${l} Q${i-.18*e} ${l-.18*e} ${i} ${l-e}Z`;function $({spec:i,size:l=40}){const e=i,r='#1B1B1B',c='flip'===e.hairStyle?(0,h.jsx)(t.Path,{d:"M29 50 C26 30 40 22 50 22 C60 22 74 30 71 50 C75 56 79 60 76 65 C72 60 69 58 66 57 L34 57 C31 58 28 60 24 65 C21 60 25 56 29 50Z",fill:e.hair}):'bob'===e.hairStyle?(0,h.jsx)(t.Path,{d:"M30 58 C27 32 40 24 50 24 C60 24 73 32 70 58 L66 60 L34 60Z",fill:e.hair}):'beehive'===e.hairStyle?(0,h.jsxs)(t.G,{children:[(0,h.jsx)(t.Ellipse,{cx:50,cy:25,rx:15,ry:14,fill:e.hair}),(0,h.jsx)(t.Path,{d:"M31 54 C28 34 40 27 50 27 C60 27 72 34 69 54 Z",fill:e.hair})]}):'curls'===e.hairStyle?(0,h.jsx)(t.G,{children:[[34,34],[40,27],[50,24],[60,27],[66,34],[69,43],[31,43]].map(([i,l],r)=>(0,h.jsx)(t.Circle,{cx:i,cy:l,r:7,fill:e.hair},r))}):null,n='quiff'===e.hairStyle?(0,h.jsxs)(t.G,{children:[(0,h.jsx)(t.Path,{d:"M32 42 C31 27 43 23 51 25 C61 22 70 30 68 42 C63 35 57 33 50 34 C43 34 37 37 32 42Z",fill:e.hair}),(0,h.jsx)(t.Path,{d:"M46 26 C51 14 66 14 66 23 C61 20 54 21 50 28Z",fill:e.hair})]}):'crop'===e.hairStyle?(0,h.jsx)(t.Path,{d:"M32 42 C31 28 42 25 50 25 C58 25 69 28 68 42 C64 36 58 33 50 33 C42 33 36 36 32 42Z",fill:e.hair}):'curls'===e.hairStyle?null:(0,h.jsx)(t.Path,{d:"M32 43 C33 30 42 27 50 27 C58 27 67 30 68 43 C61 38 57 33 51 33 C47 37 39 41 32 43Z",fill:e.hair});return(0,h.jsxs)(s.default,{width:l,height:l,viewBox:"0 0 100 100",children:[(0,h.jsx)(t.Circle,{cx:50,cy:50,r:50,fill:e.bg}),(0,h.jsx)(t.Ellipse,{cx:50,cy:50,rx:46,ry:13,fill:"none",stroke:"#FFF4E0",strokeOpacity:.28,strokeWidth:1.6,transform:"rotate(-28 50 50)"}),(0,h.jsx)(t.Path,{d:k(16,24,6),fill:"#FFF4E0",fillOpacity:.85}),(0,h.jsx)(t.Path,{d:k(84,34,4),fill:"#FFF4E0",fillOpacity:.7}),(0,h.jsx)(t.Circle,{cx:80,cy:16,r:1.6,fill:"#FFF4E0",fillOpacity:.8}),(0,h.jsx)(t.Circle,{cx:22,cy:70,r:1.3,fill:"#FFF4E0",fillOpacity:.6}),(0,h.jsx)(t.Path,{d:"M12 100 C14 82 31 74 50 74 C69 74 86 82 88 100 Z",fill:e.suit}),(0,h.jsx)(t.Path,{d:"M36 100 L40 84 L50 90 L60 84 L64 100Z",fill:e.ring,fillOpacity:.35}),(0,h.jsx)(t.Rect,{x:44,y:60,width:12,height:12,fill:e.skin}),c,(0,h.jsx)(t.Ellipse,{cx:50,cy:46,rx:17,ry:18.5,fill:e.skin}),n,e.specs?(0,h.jsxs)(t.G,{stroke:r,strokeWidth:1.6,fill:"#FFFFFF",fillOpacity:.25,children:[(0,h.jsx)(t.Rect,{x:37,y:42,width:11,height:8,rx:4}),(0,h.jsx)(t.Rect,{x:52,y:42,width:11,height:8,rx:4}),(0,h.jsx)(t.Line,{x1:48,y1:45,x2:52,y2:45})]}):null,(0,h.jsx)(t.Ellipse,{cx:42.5,cy:46.5,rx:2.1,ry:2.7,fill:r}),(0,h.jsx)(t.Ellipse,{cx:57.5,cy:46.5,rx:2.1,ry:2.7,fill:r}),(0,h.jsx)(t.Circle,{cx:43.3,cy:45.5,r:.8,fill:"#FFFFFF"}),(0,h.jsx)(t.Circle,{cx:58.3,cy:45.5,r:.8,fill:"#FFFFFF"}),(0,h.jsx)(t.Circle,{cx:38,cy:53,r:3,fill:"#F08A7E",fillOpacity:.55}),(0,h.jsx)(t.Circle,{cx:62,cy:53,r:3,fill:"#F08A7E",fillOpacity:.55}),(0,h.jsx)(t.Path,{d:"M44.5 55 Q50 60 55.5 55",stroke:r,strokeWidth:1.8,fill:"none",strokeLinecap:"round"}),(0,h.jsx)(t.Ellipse,{cx:50,cy:74,rx:21,ry:5.5,fill:e.ring}),(0,h.jsx)(t.Ellipse,{cx:50,cy:73,rx:16,ry:3,fill:"#000000",fillOpacity:.18}),(0,h.jsx)(t.Circle,{cx:50,cy:88,r:4,fill:e.ring}),(0,h.jsx)(t.Circle,{cx:50,cy:88,r:1.6,fill:e.bg}),(0,h.jsx)(t.Circle,{cx:50,cy:45,r:29,fill:"#FFF4E0",fillOpacity:.1,stroke:"#FFF4E0",strokeOpacity:.85,strokeWidth:2}),(0,h.jsx)(t.Path,{d:"M29 36 A23 23 0 0 1 41 22",stroke:"#FFFFFF",strokeOpacity:.85,strokeWidth:3.2,fill:"none",strokeLinecap:"round"}),(0,h.jsx)(t.Circle,{cx:28.5,cy:42,r:1.5,fill:"#FFFFFF",fillOpacity:.85}),'none'!==e.antenna?(0,h.jsx)(t.Line,{x1:50,y1:16,x2:50,y2:8,stroke:e.ring,strokeWidth:2}):null,'ball'===e.antenna?(0,h.jsx)(t.Circle,{cx:50,cy:6.5,r:3.3,fill:e.ring}):'star'===e.antenna?(0,h.jsx)(t.Path,{d:k(50,6.5,4.5),fill:e.ring}):null]})}const O=i=>(i??'').replace(' (example)','').trim().toLowerCase();function v(i,l){const e=(0,c.useOwner)(i=>i.staff);return i?e.find(l=>l.id===i):l?e.find(i=>O(i.name)===O(l)):void 0}},953,[868,30,196,127,948,856,1201,1202,821,14,24]); +__d(function(g,_r,i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"MIN_RADIUS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"MAX_RADIUS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"ACCURACY_CAP",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"DEFAULT_BREAK_OPTIONS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"DEFAULT_CLOCK_AREA",{enumerable:!0,get:function(){return r}}),e.distanceM=s,Object.defineProperty(e,"validLat",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"validLng",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"areaSet",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"clampRadius",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"accuracyAllowance",{enumerable:!0,get:function(){return p}}),e.isInside=h,e.cleanArea=function(t){const n=(t.breakOptions??a).map(t=>Math.round(Number(t))).filter(t=>Number.isFinite(t)&&t>0&&t<=180);return{...r,...t,lat:c(t.lat)?t.lat:null,lng:l(t.lng)?t.lng:null,radius:f(t.radius??r.radius),on:!1!==t.on,offRotaPrompt:!1!==t.offRotaPrompt,breakOptions:[...new Set(n)].sort((t,n)=>t-n).slice(0,12),offRotaTitle:(t.offRotaTitle??'').trim().slice(0,80)||r.offRotaTitle,offRotaBody:(t.offRotaBody??'').trim().slice(0,160)||r.offRotaBody}},Object.defineProperty(e,"ACTION_WORD",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"DENIED_TEXT",{enumerable:!0,get:function(){return m}}),e.gate=function(t,n,o,a,r="browser"){if(!t.on||!d(t)){const r={action:n,at:a,inside:null,unchecked:!0};return'object'==typeof o&&Object.assign(r,{lat:y(o.lat),lng:y(o.lng),acc:Math.round(o.acc)}),{allowed:!0,geo:r,warn:t.on?'The clock-in area isn\u2019t set yet, so location isn\u2019t checked.':void 0}}if('object'!=typeof o){const t='app-phone-off'===r?m['app-phone-off']:'denied'===o?m[r]:'timeout'===o?'Your phone couldn\u2019t find your location in time. Step outside or near a window and try again.':'unsupported'===o?'This phone or browser can\u2019t share its location. Ask a manager to record it for you.':'Your phone couldn\u2019t find your location. Check Location is on, then try again.';return{allowed:!1,message:`You need to be at the venue to ${b[n]}. ${t}`,geo:{action:n,at:a,inside:!1}}}const u=h(t,o),s={action:n,at:a,lat:y(o.lat),lng:y(o.lng),acc:Math.round(o.acc),dist:u.dist,inside:u.inside};if(u.inside)return{allowed:!0,geo:s};const c=u.dist>=1e3?`${(u.dist/1e3).toFixed(1)} km`:`${u.dist} m`;return{allowed:!1,geo:s,message:`You need to be at the venue to ${b[n]}. You look to be about ${c} away (allowed ${u.limit} m). If you\u2019re at the venue, try again in a moment or ask a manager to record it for you.`}},e.overrideGeo=function(t,n,o,a){const r=a.trim();return r.length<3?null:{action:t,at:n,inside:null,override:{by:o.name,byId:o.id,reason:r.slice(0,200)}}},e.offRotaDue=function(t){return!(!(t.area.offRotaPrompt&&d(t.area)&&t.inside)||t.clockedIn||t.dismissedToday)&&!t.shifts.some(n=>t.nowHours>=n.start-1&&t.nowHours<(n.end<=n.start?n.end+24:n.end))},Object.defineProperty(e,"breakLabel",{enumerable:!0,get:function(){return O}});const t=50,n=2e3,o=50,a=[5,10,15,20,30,45,60],r={lat:null,lng:null,radius:100,on:!0,breakOptions:[...a],offRotaPrompt:!0,offRotaTitle:'Do you want to sign in?',offRotaBody:'Should you be on the rota?'},u=t=>t*Math.PI/180;function s(t,n){const o=u(n.lat-t.lat),a=u(n.lng-t.lng),r=Math.sin(o/2)**2+Math.cos(u(t.lat))*Math.cos(u(n.lat))*Math.sin(a/2)**2;return 12742017.6*Math.asin(Math.min(1,Math.sqrt(r)))}const c=t=>'number'==typeof t&&Number.isFinite(t)&&t>=-90&&t<=90,l=t=>'number'==typeof t&&Number.isFinite(t)&&t>=-180&&t<=180,d=t=>c(t.lat)&&l(t.lng),f=o=>Number.isFinite(o)?Math.min(n,Math.max(t,Math.round(o))):r.radius,p=t=>Number.isFinite(t)&&t>0?Math.min(t,o):0;function h(t,n){const o=s({lat:t.lat,lng:t.lng},n),a=f(t.radius)+p(n.acc);return{inside:o<=a,dist:Math.round(o),limit:Math.round(a)}}const b={in:'clock in',out:'clock out',break_start:'start a break',break_end:'end your break'},m={browser:'Location is turned off for this browser. Turn it on in your phone\u2019s settings (Location \u203a allow for this browser), then try again.',iphone:'Location is turned off for this app. On your iPhone open Settings \u203a Privacy & Security \u203a Location Services \u203a Safari Websites and choose While Using the App, then try again.',app:'Location is turned off for this app. Tap Open app settings, then Permissions \u203a Location \u203a Allow only while using the app. Then come back and try again.','app-old':'This version of the app can\u2019t use location. Tap Update the app at the bottom of the screen, then tap Allow when your phone asks.','app-phone-off':'Location is switched off on your phone. Tap Open location settings, turn on Use location, then come back and try again.'};const y=t=>Math.round(1e6*t)/1e6;const O=t=>60===t?'1 hour':t%60==0?t/60+" hours":t>60?`${Math.floor(t/60)} h ${t%60} min`:`${t} min`},954,[]); +__d(function(g,_r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"pinProblem",{enumerable:!0,get:function(){return r.pinProblem}}),Object.defineProperty(_e,"ERROR_TEXT",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"errorText",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"useDisplayTiles",{enumerable:!0,get:function(){return u}}),_e.refreshTiles=async function(){const e=await l('display_staff_list',{});Array.isArray(e)&&u.setState({tiles:e,at:Date.now()});const t=await l('display_pin_lengths',{});t&&'object'==typeof t&&!('ok'in t)&&u.setState({lens:t})},_e.refreshManagers=async function(){const e=await l('display_managers',{});Array.isArray(e)&&u.setState({managers:e})},Object.defineProperty(_e,"displayClock",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"displayChangePin",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"displayAddTemp",{enumerable:!0,get:function(){return y}}),_e.setStaffPin=async function(e,n,a=4){const o=_();if(!o)return{ok:!1,error:'Sign in to the venue to set PINs (they are kept on the server only).'};const s=(0,r.pinProblem)(n,a);if(s)return{ok:!1,error:s};try{const{error:r}=await(0,t.getSupabase)().rpc('set_staff_pin',{p_venue:o,p_staff_ref:e,p_pin:n});return r?{ok:!1,error:r.message.replace(/^.*?:\s*(?=The PIN|Pick a PIN)/,'')}:{ok:!0}}catch{return{ok:!1,error:'No connection. Try again in a moment.'}}},_e.addTempStaff=async function(e){const n=_();if(!n)return{ok:!1,error:'Sign in to the venue to add temp staff (the code is made and kept on the server).'};try{const{data:r,error:a}=await(0,t.getSupabase)().rpc('add_temp_staff',{p_venue:n,p_name:e.name,p_dept:e.dept??null,p_rate:e.rate??null,p_until:e.until||null});return a?{ok:!1,error:a.message}:{ok:!0,...r}}catch{return{ok:!1,error:'No connection. Try again in a moment.'}}},Object.defineProperty(_e,"usePinStatus",{enumerable:!0,get:function(){return k}}),_e.refreshPinStatus=async function(){const e=_();if(!e)return;try{const{data:n}=await(0,t.getSupabase)().rpc('staff_pin_status',{p_venue:e});Array.isArray(n)&&k.setState(Object.fromEntries(n.map(e=>[e.staff_ref,{hasPin:e.has_pin,locked:e.locked}])),!0)}catch{}},_e.localTiles=function(e,t){return e.filter(e=>e.active&&e.displayClock&&!(e.temp&&e.tempUntil&&e.tempUntil({ref:e.id,name:e.name,nickname:e.nickname,dept:e.dept,temp:!!e.temp})).sort((e,t)=>Number(!!e.temp)-Number(!!t.temp)||e.name.localeCompare(t.name))},Object.defineProperty(_e,"displayBlockChange",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"displayBlockEdit",{enumerable:!0,get:function(){return h}});var e=_r(d[0]),t=_r(d[1]),n=_r(d[2]),r=_r(d[3]),a=_r(d[4]),o=_r(d[5]);const s={wrong:'That PIN is not right. Try again.',locked:'Too many wrong tries. Locked for 15 minutes, or ask a manager to reset your PIN.',nopin:'No PIN set yet. Ask a manager to set one in Staff & roles.',notallowed:'This person can\u2019t clock in at the Display. A manager can turn it on in Staff & roles.',already:'Already clocked in.',notin:'Not clocked in yet.',onbreak:'Already on a break.',notmanager:'Only an owner or manager can add temp staff.',format:'The new PIN must be 4 to 8 digits (6 or more for managers and owners).',weak:'Pick a PIN that is harder to guess (not all the same digit or a run like 1234).',devicelocked:'Too many wrong PINs on this Display. Wait 15 minutes, then try again.',unpaired:'Pair this Display first (Settings \u203a Devices on the Managers app), then try again.',offline:'No connection. Try again in a moment.'},c=(e,t)=>'format'===e&&t?.min?`The new PIN must be ${t.min} to 8 digits.`:s[e??'']??(e||'Something went wrong. Try again.'),p=()=>'device'===n.useSync.getState().kind&&!!n.useSync.getState().venueId;async function l(e,n){if(a.PITCH)return(0,o.pitchClock)(e,n);if(!p())return{ok:!1,error:'unpaired'};try{const{data:r,error:a}=await(0,t.getSupabase)().rpc(e,n);return a?{ok:!1,error:/paired Display/.test(a.message)?'unpaired':a.message}:r}catch{return{ok:!1,error:'offline'}}}const u=(0,e.create)(()=>({tiles:null,managers:[],lens:{}}));const f=(e,t,n,r={})=>l('display_clock',{p_staff_ref:e,p_pin:t,p_action:n,p_break_mins:r.breakMins??null,p_off_rota:!!r.offRota}),m=(e,t,n)=>l('display_change_pin',{p_staff_ref:e,p_old:t,p_new:n}),y=(e,t,n)=>l('display_add_temp',{p_manager_ref:e,p_manager_pin:t,p_name:n.name,p_dept:n.dept??null,p_rate:n.rate??null,p_until:n.until||null}),_=()=>'staff'===n.useSync.getState().kind?n.useSync.getState().venueId:void 0;const k=(0,e.create)(()=>({}));const b=(e,t,n,r,a)=>l('display_block_change',{p_manager_ref:e,p_manager_pin:t,p_block_id:n,p_action:r,p_doc:a}),h=(e,t,n,r)=>l('display_block_edit',{p_block_id:e,p_action:t,p_doc:n,p_by:r})},955,[952,863,820,1396,2,1397]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"notifSeedId",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"headChefId",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"gmId",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"seedsFor",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"useNotifs",{enumerable:!0,get:function(){return v}});var e,t=r(d[0]),i=(e=t)&&e.__esModule?e:{default:e},s=r(d[1]),n=r(d[2]),o=r(d[3]),u=r(d[4]),p=r(d[5]),f=r(d[6]),c=r(d[7]);const l=(e,t)=>(0,o.uuidFrom)(`sched-notif:${t}:${e}`),S=()=>p.ROSTER.find(e=>'Head Chef'===e.level)?.id??p.ROSTER.find(e=>'chef'===e.app)?.id??'',b=()=>p.ROSTER.find(e=>'Manager'===e.level)?.id??'',h=e=>'anchorage'===e?(0,u.anchorageSeeds)(t=>l(e,t),S(),b()):[],O=()=>(new Date).toISOString(),v=(0,s.create)()((0,n.persist)((e,t)=>({items:[],snooze:{},ensure:i=>{const s=t().items,n=s.map(e=>(0,c.fixSupplierNames)(e.title)!==e.title||(0,c.fixSupplierNames)(e.message)!==e.message?{...e,title:(0,c.fixSupplierNames)(e.title),message:(0,c.fixSupplierNames)(e.message),updatedAt:O()}:e);n.some((e,t)=>e!==s[t])&&e({items:n});const o=new Set(t().items.map(e=>e.id)),u=h(i).filter(e=>!o.has(e.id)).map(e=>({...e,rid:i}));u.length&&e(e=>({items:[...e.items,...u]}))},add:(t,i)=>{const s=(0,f.uuid)();return e(e=>({items:[...e.items,{...i,id:s,rid:t,updatedAt:O()}]})),s},update:(t,i)=>e(e=>({items:e.items.map(e=>e.id===t?{...e,...i,updatedAt:O()}:e)})),remove:t=>e(e=>({items:e.items.flatMap(e=>e.id!==t?[e]:e.seed?[{...e,removed:!0,paused:!0,updatedAt:O()}]:[])})),resetSeeds:t=>{const i=new Map(h(t).map(e=>[e.id,e]));e(e=>{const s=e.items.map(e=>i.has(e.id)?{...i.get(e.id),rid:t,updatedAt:O()}:e),n=new Set(s.map(e=>e.id));return{items:[...s,...[...i.values()].filter(e=>!n.has(e.id)).map(e=>({...e,rid:t,updatedAt:O()}))]}})},setSnooze:(t,i)=>e(e=>({snooze:Object.fromEntries([...Object.entries(e.snooze).filter(([,e])=>e>Date.now()-864e5),[t,i]])}))}),{name:'covercharge-sched-notifs-v1',version:1,storage:(0,n.createJSONStorage)(()=>i.default)}))},956,[1116,952,1117,1104,958,14,1033,1205]); +__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"chairsId",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"rulesId",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"useReminders",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"rulesOf",{enumerable:!0,get:function(){return A}});var e,r=_r(d[0]),t=(e=r)&&e.__esModule?e:{default:e},n=_r(d[1]),s=_r(d[2]),u=_r(d[3]),o=_r(d[4]),l=_r(d[5]);const c=e=>(0,u.uuidFrom)(`reminder:chairs:${e}`),p=e=>(0,u.uuidFrom)(`break-rules:${e}`),f=()=>(new Date).toISOString(),b=(0,n.create)()((0,s.persist)((e,r)=>({reminders:[],rules:{},done:[],snooze:{},ensure:t=>{const n=r(),s={};n.reminders.some(e=>e.id===c(t))||(s.reminders=[...n.reminders,{...(0,o.defaultChairs)(c(t)),rid:t}]),n.rules[t]||(s.rules={...n.rules,[t]:{...o.DEFAULT_BREAK_RULES,id:p(t)}}),Object.keys(s).length&&e(s)},add:(r,t)=>{const n=(0,l.uuid)();return e(e=>({reminders:[...e.reminders,{...t,id:n,rid:r,updatedAt:f()}]})),n},update:(r,t)=>e(e=>({reminders:e.reminders.map(e=>e.id===r?{...e,...t,updatedAt:f()}:e)})),remove:r=>e(e=>({reminders:e.reminders.flatMap(e=>e.id!==r?[e]:e.builtIn?[{...e,removed:!0,paused:!0,updatedAt:f()}]:[])})),resetReminder:r=>e(e=>({reminders:e.reminders.map(e=>e.id===r&&'chairs'===e.builtIn?{...(0,o.defaultChairs)(r),rid:e.rid,updatedAt:f()}:e)})),setRules:(r,t)=>e(e=>({rules:{...e.rules,[r]:{...(0,o.clampRules)({...e.rules[r]??o.DEFAULT_BREAK_RULES,...t}),id:p(r),updatedAt:f()}}})),resetRules:r=>e(e=>({rules:{...e.rules,[r]:{...o.DEFAULT_BREAK_RULES,id:p(r),updatedAt:f()}}})),markDone:r=>e(e=>({done:[{...r,id:(0,l.uuid)(),at:r.at??f()},...e.done].slice(0,400)})),setSnooze:(r,t)=>e(e=>({snooze:Object.fromEntries([...Object.entries(e.snooze).filter(([,e])=>e>Date.now()-864e5),[r,t]])}))}),{name:'covercharge-reminders-v1',version:1,storage:(0,s.createJSONStorage)(()=>t.default)})),A=e=>(0,o.clampRules)(b.getState().rules[e]??o.DEFAULT_BREAK_RULES)},957,[1116,952,1117,1104,1108,1033]); +__d(function(_g,_r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SHIFT_FILTER_LABEL",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"NOTIF_DAY_NAMES",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"NOTIF_GROUP_LABEL",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"IN_APP_WINDOW_MINS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"PUSH_WINDOW_MINS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"KITCHEN_OPEN_DAYS",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"TITLE_MAX",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"MESSAGE_MAX",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"validHm",{enumerable:!0,get:function(){return u}}),e.ukNow=p,Object.defineProperty(e,"timeOn",{enumerable:!0,get:function(){return m}}),e.notifDue=function(t,n,r=s){const o=p(n),d=m(t,o.dow);if(t.paused||t.removed||!u(d)||!t.days.includes(o.dow))return{due:!1,forDate:o.ymd,at:d};const f=l(d);return{due:o.mins>=f&&o.minst.days.includes(n));if(!r.length)return'No days ticked';const s=new Map;for(const n of r){const r=m(t,n);s.set(r,[...s.get(r)??[],n])}const o=t=>7===t.length?'Every day':t.map(t=>n[t]).join(', ');return[...s.entries()].map(([t,n])=>`${o(n)} at ${t}`).join('; ')+' (UK time)'},e.validateNotif=function(t){if(!t.title.trim())return'Give it a name.';if(t.title.length>f)return`Keep the name under ${f} letters.`;if(!t.message.trim())return'Type the message people will see.';if(t.message.length>c)return`Keep the message under ${c} letters.`;if(!u(t.time))return'Type the time as HH:MM, e.g. 21:00.';for(const n of Object.values(t.dayTimes??{}))if(!u(n))return'Type each day\u2019s time as HH:MM.';return t.days.length?t.recipients.staff.length||t.recipients.groups.length||(t.recipients.onShiftIn??[]).length?t.sendBy.inApp||t.sendBy.push?null:'Choose how to send it.':'Tick at least one person or group.':'Tick at least one day.'},e.anchorageSeeds=function(t,n,r){const s={staff:[n,r].filter(Boolean),groups:[]},o={inApp:!0,push:!0};return[{id:t('mills-milk'),seed:'mills-milk',title:'Mills milk order',message:'Make sure an order before 9:30',days:[...d],time:'21:00',dayTimes:{5:'20:55',0:'20:55'},recipients:s,sendBy:o},{id:t('peronis'),seed:'peronis',title:"Pieroni's order",message:"order Pieroni's by phone",days:[...d],time:'21:05',recipients:s,sendBy:o},{id:t('veg-second'),seed:'veg-second',title:'Veg order',message:'Order veg on the app before 11 PM',days:[...d],time:'21:15',recipients:s,sendBy:o},{id:t('reeds'),seed:'reeds',title:'Reeds order',message:'Order reeds',days:[3,4],time:'21:25',recipients:s,sendBy:o},{id:t('spezbona'),seed:'spezbona',title:'Spes Bona order',message:'Do we need anything from Spes Bona for this week? Message Anna if we do for Friday delivery.',days:[3],time:'15:00',recipients:s,sendBy:o},{id:t('olsens'),seed:'olsens',title:"Olsen's order",message:"Place Olsen's order before 3:30 PM. By phone.",days:[2],time:'13:00',recipients:{staff:[r],groups:[]},sendBy:o},{id:t('allsons-list'),seed:'allsons-list',title:'Alsons drinks list',message:'Add anything extra to the Alsons drinks list.',days:[0],time:'20:00',recipients:{staff:['st-finn'],groups:[]},sendBy:o,open:{page:'orderlists',list:'allsons'}},{id:t('tea-towels'),seed:'tea-towels',title:'Tea towels',message:'Put a load of tea towels on to wash.',days:[...d],time:'15:00',recipients:{staff:[],groups:[],onShiftIn:['kp'],fallback:{staff:[],groups:['head_chef']}},sendBy:o},{id:t('rota-upload'),seed:'rota-upload',title:'Rota upload',message:"Make sure you have uploaded next week's rota.",days:[0],time:'20:50',recipients:s,sendBy:o}]};const t={kitchen:'On shift: Kitchen',foh:'On shift: Front of house',bar:'On shift: Bar',kp:'On shift: KPs',chefs:'On shift: Chefs'},n=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],r={on_shift:'Everyone on shift',everyone:'Everyone',managers:'Owners and managers',head_chef:'Head Chef',kitchen:'Kitchen team',foh:'Front of house'},s=120,o=15,d=[3,4,5,6,0],f=60,c=160,u=t=>/^([01]\d|2[0-3]):[0-5]\d$/.test(t),l=t=>60*Number(t.slice(0,2))+Number(t.slice(3,5));function p(t){const r='number'==typeof t?new Date(t):t,s={};for(const t of new Intl.DateTimeFormat('en-GB',{timeZone:'Europe/London',weekday:'short',year:'numeric',month:'2-digit',day:'2-digit',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}).formatToParts(r))s[t.type]=t.value;return{dow:n.indexOf(String(s.weekday).slice(0,3)),mins:60*Number(s.hour)+Number(s.minute),ymd:`${s.year}-${s.month}-${s.day}`}}const m=(t,n)=>{const r=t.dayTimes?.[String(n)];return r&&u(r)?r:t.time};const h=t=>t.open?`./?open=${t.open.page}${t.open.list?`&list=${encodeURIComponent(t.open.list)}`:''}`:'./',y=(t,n)=>`${t.id}:${n}`,g=t=>(t??'').toLowerCase(),b=t=>t.level?['owner','manager'].includes(g(t.level)):['owner','manager'].includes(g(t.role)),O=t=>'head_chef'===g(t.role)||'head chef'===g(t.level)||'chef'===g(t.app)||/head chef/.test(g(t.job)),P=t=>'kitchen'===g(t.department)||/chef|kitchen|kp|porter/.test(g(t.job))||O(t),k=t=>/\bkp\b|kitchen porter/.test(g(t.job));function j(t,n){const r=g(n.department);return'kitchen'===t?P(n):'kp'===t?k(n):'chefs'===t?O(n)||/chef|commis/.test(g(n.job)):'bar'===t?'bar'===r||/\bbar/.test(g(n.job)):'front of house'===r||!r&&!P(n)&&!b(n)}function _(t,n,r=[]){const s=v(t.recipients,n,r),o=t.recipients.fallback;return s.length||!o?s:v({staff:o.staff,groups:o.groups},n,r)}const w=(t,n,r=[])=>!!t.recipients.fallback&&!v(t.recipients,n,r).length;function v(t,n,r){const s=t,o=n.filter(t=>!1!==t.active),d=new Set;for(const t of s.staff)o.some(n=>n.id===t)&&d.add(t);for(const t of s.groups)for(const n of o)('everyone'===t||'on_shift'===t&&r.includes(n.id)||'managers'===t&&b(n)||'head_chef'===t&&O(n)||'kitchen'===t&&P(n)||'foh'===t&&!P(n)&&!b(n))&&d.add(n.id);for(const t of s.onShiftIn??[])for(const n of o)r.includes(n.id)&&j(t,n)&&d.add(n.id);return[...d].sort()}const M=t=>({id:t.external_ref,role:t.roles?.key??void 0,job:t.job_title??'',department:t.department??'',active:!1!==t.active}),T=(t,n,r,s=[])=>_(t,r,s).includes(n)},958,[]); +__d(function(g,_r,i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.shiftNow=l,e.useShiftReminders=function({rid:c,staffId:k,name:h,kitchen:b,onStartBreak:S}){const D=(0,t.useRef)(S);D.current=S;const I=(0,t.useRef)(h);I.current=h;const v=(0,s.useReminders)(t=>`${t.reminders.length}:${t.done.length}:${JSON.stringify(t.rules[c]??{})}:${t.reminders.map(t=>t.updatedAt??'').join()}`),w=(0,r.useOwner)(t=>`${t.attendance.length}:${t.shifts.length}`);(0,t.useEffect)(()=>{s.useReminders.getState().ensure(c);const t=()=>{const t=u(),{att:h,shift:S,on:v}=l(k,t),w=s.useReminders.getState();if(!v||!k)return w.reminders.forEach(t=>(0,a.dismissNotice)(`rem:${t.id}`)),void(0,a.dismissNotice)('break-reminder');const R=(0,s.rulesOf)(c),$=h?.in?new Date(h.in).getTime():void 0,p=!!h?.breaks?.length,y=`break:${h?.id??S?.id??''}`,M=(0,o.breakDue)({now:t,clockIn:$,shiftStart:S?m(S.date,S.start):void 0,shiftEnd:S?m(S.date,S.end):void 0,rotaBreak:void 0!==S?.breakAt?m(S.date,S.breakAt):void 0,hadBreak:p,rules:R},w.snooze[y]??0);if(M){const r=$??(S?m(S.date,S.start):t);(0,a.notify)({id:'break-reminder',tone:3===M.stage?'warn':'normal',icon:'\ud83e\uded6',kicker:'BREAK REMINDER',testID:'break-reminder',timeoutMs:null,title:M.label,body:`${$?'Clocked in':'Shift started'} at ${f(r)}. ${3===M.stage?'':'Over 6 hours needs a 20-minute break.'}`.trim(),actions:[{label:'Start break',testID:'break-reminder-start',onPress:()=>{if(!h)return D.current?.(),void(0,a.notify)({id:'break-clock-first',title:'Clock in first, then tap Start break.',body:'Your break is started from the clock screen.',timeoutMs:6e3});const t=new Date(u()).toISOString();(0,n.clockAction)('break_start',{rid:c,staffId:k,date:t.slice(0,10),at:t}).then(t=>{t.ok||(0,a.notify)({id:'break-blocked',tone:'warn',title:'Break not started',body:t.message,timeoutMs:1e4}),D.current?.()})}},{label:'Later',kind:'ghost',testID:'break-reminder-later',onPress:()=>s.useReminders.getState().setSnooze(y,u()+6e4*R.snoozeMins)}]})}else(0,a.dismissNotice)('break-reminder');const N=r.useOwner.getState().staff.find(t=>t.id===k),O=b??(0,d.inKitchen)(N);for(const n of w.reminders){if(n.rid!==c)continue;const r=`rem:${n.id}`;if(n.removed||!(0,o.audienceMatch)(n.audience,O)){(0,a.dismissNotice)(r);continue}const{due:d,forDate:f}=(0,o.reminderDue)(n,t),m=w.done.find(t=>t.reminderId===n.id&&t.forDate===f),l=`rem:${n.id}:${f}`;!d||m||(w.snooze[l]??0)>t?(0,a.dismissNotice)(r):(0,a.notify)({id:r,icon:'\ud83e\ude91',kicker:'REMINDER',title:n.text,testID:'venue-reminder',timeoutMs:null,body:`For everyone on shift${'all'===n.audience?'':'kitchen'===n.audience?' in the kitchen':' front of house'}. Tap Done once it\u2019s done.`,actions:[{label:'Done',testID:'venue-reminder-done',onPress:()=>s.useReminders.getState().markDone({rid:c,reminderId:n.id,forDate:f,at:new Date(u()).toISOString(),staffRef:k,staffName:I.current.replace(' (example)','')})},{label:'Later',kind:'ghost',onPress:()=>s.useReminders.getState().setSnooze(l,u()+6e4*R.snoozeMins)}]})}};t();const h=setInterval(t,2e4);return()=>clearInterval(h)},[c,k,v,w,b])};var t=_r(_d[0]),n=_r(_d[1]),r=_r(_d[2]),s=_r(_d[3]),o=_r(_d[4]),a=_r(_d[5]),d=_r(_d[6]),c=_r(_d[7]);const u=()=>{try{return(0,c.nowFrom)(c.useStore.getState().clock).getTime()}catch{return Date.now()}},f=t=>new Date(t).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}),m=(t,n)=>{const[r,s,o]=t.split('-').map(Number);return new Date(r,s-1,o,Math.floor(n),Math.round(n%1*60)).getTime()};function l(t,n){const s=r.useOwner.getState(),a=(0,r.openShiftOf)(s.attendance,t,new Date(n)),d=(0,o.ukClock)(n).ymd,c=s.shifts.find(r=>r.staffId===t&&r.date===d&&!1!==r.published&&m(r.date,r.start)<=n&&nn.staffId===t&&n.date===d&&!1!==n.published):void 0),u=!a&&!!c&&s.attendance.some(n=>n.staffId===t&&n.date===d&&!!n.out&&new Date(n.out).getTime()>=m(c.date,c.start));return{att:a,shift:c,on:!!a||!!c&&!u}}},959,[30,1103,856,957,1108,947,1118,872]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"START_PAIR",{enumerable:!0,get:function(){return t}});const t=(()=>{try{if('undefined'==typeof window||!window.location)return null;const t=new URL(window.location.href),n=new URLSearchParams(t.hash.replace(/^#/,'')),c=t.searchParams.get('pair')||n.get('pair');if(!c)return null;t.searchParams.delete('pair'),n.delete('pair');const o=n.toString();return window.history.replaceState(null,'',t.pathname+(t.search?t.search:'')+(o?`#${o}`:'')),c}catch{return null}})()},960,[]); +__d(function(_g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PUB_LOCATIONS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"privateClockVenue",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"pubLocation",{enumerable:!0,get:function(){return s}}),e.venueClockArea=function(a,o={}){if((0,t.isQueuedVenue)(a)&&!t.queuedVenues[a].clockArea.on)return(0,n.cleanArea)({...o,on:!0===o.on&&'number'==typeof o.lat&&'number'==typeof o.lng,offRotaPrompt:!1});const l=s(a);if(!l)return(0,n.cleanArea)(o);const c=(0,n.cleanArea)({lat:l.lat,lng:l.lng,radius:150,...o});return{...c,lat:c.lat??l.lat,lng:c.lng??l.lng,on:!0,offRotaPrompt:!1}},e.venueClockGeo=l,e.privateAttendance=function(n,a){if(!o(n)&&!(0,t.isQueuedVenue)(n))return a;const s={...a};for(const t of['lat','lng','latitude','longitude','coords','position','location','acc','dist','accuracy','distance','outSite'])delete s[t];a.geo&&(s.geo=a.geo.map(t=>l(n,t)).filter(t=>!!t));return s};var t=r(d[0]),n=r(d[1]);const a={"3idiots":{name:"3 Idiots",address:"10 George Street, Ayr, KA8 0BL",lat:55.4650286,lng:-4.6283062,source:"Verified exact-address venue pack"},cecchinis:{name:"Cecchinis",address:"72 Fort Street, Wellington Square, Ayr, South Ayrshire KA7 1EH",lat:55.461505,lng:-4.6345736,source:"Verified exact-address venue pack"},williewastles:{name:"Willie Wastle's",address:"16-18 New Bridge Street, Ayr, South Ayrshire, KA7 1JX",lat:55.4646261,lng:-4.6323929,source:"Verified exact-address venue pack"},smokinggoat:{name:"Smoking Goat",address:"2A Academy Street, Ayr KA7 1HS",lat:55.464226,lng:-4.6326035,source:"Verified exact-address venue pack"},drunkencoo:{name:"The Drunken Coo",address:"22 Beresford Terrace, Ayr KA7 2EG",lat:55.4570308,lng:-4.6294663,source:"Verified exact-address venue pack"},abbotsford:{name:'The Abbotsford Hotel',address:'14 Corsehill Road, Ayr KA7 2ST',lat:55.4488797,lng:-4.6314856,source:'Official FSA1696388, exact address match verified6 Nov2026'},kirkton:{name:'The Kirkton Inn',address:'1-3 Main Street, Dalrymple, East Ayrshire KA6 6DF',lat:55.3971215,lng:-4.5920177,source:'Public FSA establishment1955433 verified6 November2026'},greenside:{name:'The Greenside Restaurant',address:'5 Greenside, Maybole, South Ayrshire KA19 7DG',lat:55.3542369,lng:-4.6851418,source:'Official Find us Google Maps link, place point, verified 6 November 2026'},kirkmichael:{name:'The Kirkmichael Arms',address:'3-5 Straiton Road, Kirkmichael, South Ayrshire KA19 7PH',lat:55.3458202,lng:-4.6180793,source:'venue-profile.json geo, matched to the venue address'},souters:{name:"Souter\u2019s Inn",address:'47 Main Road, Kirkoswald, South Ayrshire KA19 8HY',lat:55.3297218,lng:-4.7772979,source:'Food Standards Agency establishment 1863840, address matched'}},o=t=>Object.prototype.hasOwnProperty.call(a,t),s=t=>o(t)?a[t]:void 0;function l(n,a){return o(n)||(0,t.isQueuedVenue)(n)?'in'===a.action?{action:'in',at:a.at,inside:a.inside,...a.override?{override:{by:a.override.by,byId:a.override.byId,reason:a.override.reason}}:{}}:void 0:a}},988,[6,954]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.WhoBar=function(){const e=(0,n.useSignedIn)();if(!e)return null;const l=`Signed in as ${e.name.replace(' (example)','')}${e.level?` \xb7 ${e.level}`:''}`;return(0,o.jsx)(s.default,{testID:"who-bar",accessible:!0,accessibilityLabel:l,style:{paddingVertical:4},children:(0,o.jsx)(c.T,{size:18,weight:"semibold",colour:t.colours.gold,children:l})})},r(d[0]);var e,l=r(d[1]),s=(e=l)&&e.__esModule?e:{default:e},n=r(d[2]),t=r(d[3]),c=r(d[4]),o=r(d[5])},989,[30,127,927,821,813,24]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"currentScrollY",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"screenGeneration",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"restoreScroll",{enumerable:!0,get:function(){return o}}),_e.useScrollMemory=function(u){const c=(0,e.useRef)(0),o=(0,e.useRef)(0),l=(0,e.useRef)(0),s=(0,e.useRef)(0),f=(0,e.useRef)(0),v=(0,e.useRef)(null),y=(0,e.useRef)([]),h=()=>{y.current.forEach(clearTimeout),y.current=[]},b=()=>{const e=v.current;null!=e&&(u.current?.scrollTo({y:e,animated:!1}),f.current-s.current>=e-2&&(c.current=e,o.current=e,v.current=null,h()))},p=(0,e.useCallback)(e=>{if(h(),v.current=Math.max(0,e),e<=0)return v.current=null,u.current?.scrollTo({y:0,animated:!1}),c.current=0,void(o.current=0);for(const e of[0,30,80,160,320,600,1e3,1600,2500])y.current.push(setTimeout(b,e));y.current.push(setTimeout(()=>{v.current=null},2600))},[]);t={y:()=>o.current,restore:p};const R=(0,e.useCallback)(()=>{n++;return o.current},[]);return{props:{scrollEventThrottle:32,onScroll:e=>{const t=e.nativeEvent.contentOffset.y;c.current=t,s.current=e.nativeEvent.layoutMeasurement.height,f.current=e.nativeEvent.contentSize.height,Date.now()-l.current>250&&null==v.current&&(o.current=t)},onScrollBeginDrag:()=>{v.current=null,h()},onContentSizeChange:(e,t)=>{f.current=t,l.current=Date.now(),b()},onLayout:e=>{s.current=e.nativeEvent.layout.height}},restore:p,leave:R}};var e=r(d[0]);let t=null,n=0;const u=()=>t?t.y():0,c=()=>n,o=e=>t?.restore(e)},990,[30]); +__d(function(_g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useBackLayers",{enumerable:!0,get:function(){return y}}),_e.runBackLayer=function(){const e=y.getState().layers,t=e[e.length-1];return!!t&&(t.fn(),!0)},_e.useBackLayer=function(t,n,s=!0){const o=(0,e.useRef)(n);o.current=n,(0,e.useEffect)(()=>{if(!t)return;const e=++w,n=(0,l.currentScrollY)(),c=(0,l.screenGeneration)();return y.setState(t=>({layers:[...t.layers,{id:e,fn:()=>o.current(),own:s}]})),()=>{y.setState(t=>({layers:t.layers.filter(t=>t.id!==e)})),(0,l.screenGeneration)()===c&&(0,l.restoreScroll)(n)}},[t,s])},Object.defineProperty(_e,"useInnerBackShown",{enumerable:!0,get:function(){return h}}),_e.BackButton=function({onPress:e,testID:t="screen-back",label:n="Back"}){return(0,f.jsx)(s.default,{testID:t,accessibilityRole:"button",accessibilityLabel:n,onPress:e,hitSlop:8,style:({pressed:e})=>({minHeight:48,minWidth:96,justifyContent:'center',paddingRight:12,opacity:e?.6:1,alignSelf:'flex-start'}),children:(0,f.jsxs)(u.T,{size:18,weight:"semibold",colour:c.colours.gold,children:["\u2039 ",n]})})},_e.useWebBack=function(t){const n=(0,e.useRef)(t);n.current=t,(0,e.useEffect)(()=>{if('undefined'==typeof window||!window.history?.pushState)return;const e=()=>{try{window.history.pushState({...window.history.state??{},ccBack:Date.now()},'',window.location.href)}catch{}};e();const t=t=>{n.current()&&(t.stopImmediatePropagation?.(),e())};return window.addEventListener('popstate',t,!0),()=>window.removeEventListener('popstate',t,!0)},[])};var e=r(d[0]);r(d[1]);var t,n=r(d[2]),s=(t=n)&&t.__esModule?t:{default:t},o=r(d[3]),c=r(d[4]),u=r(d[5]),l=r(d[6]),f=r(d[7]);const y=(0,o.create)(()=>({layers:[]}));let w=0;const h=()=>y(e=>e.layers.some(e=>e.own))},991,[30,122,263,952,821,813,990,24]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.SoldOutList=function({rid:e,by:n,canMark:a=!0}){const f=(0,r.useSoldOut)(e=>e.entries),b=(0,i.useStore)(e=>e.clock),j=(0,i.useStore)(e=>e.menu),w=(0,i.useStore)(t=>t.restaurants.find(t=>t.id===e)),[S,I]=(0,s.useState)(''),$=(0,h.nowFrom)(b),C=(0,d.activeSoldOut)(f,e,$),D=new Set(C.map(e=>e.itemId)),M=(0,d.soldOutSettingsOf)(w?.settings?.soldOut),T=(0,u.useAutoSoldOutView)(e),L=f.filter(t=>t.rid===e&&!t.on&&t.kept&&T.reason(t.itemId)),v=(0,s.useMemo)(()=>j.filter(t=>t.restaurantId===e&&!t.hidden&&!D.has(t.id)&&(!S.trim()||t.name.toLowerCase().includes(S.trim().toLowerCase()))).sort((e,t)=>e.name.localeCompare(t.name)),[j,e,S,C.length]),B=(t,s)=>{const o=f.some(s=>s.rid===e&&s.itemId===t&&s.auto&&T.reason(t));j.some(e=>e.id===t)?(0,r.setSoldOut)(t,!1,n):r.useSoldOut.getState().back(e,t,n),x(`Back on: ${s}${o?' (kept on until the count changes)':''}`)};return(0,y.jsxs)(o.default,{testID:"soldout-list",style:{gap:10},children:[(0,y.jsx)(l.Muted,{children:"A reminder for staff. Dishes you mark sold out show on the Display and in the Sold out list in every staff app, within seconds. It doesn't change your till."}),(0,y.jsxs)(l.Card,{children:[(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'center'},wrap:!0,children:[(0,y.jsx)(l.T,{weight:"semibold",size:17,children:"Sold out now"}),(0,y.jsx)(l.T,{size:13,colour:C.length?m.colours.amber:m.colours.muted,children:C.length?(0,d.soldOutCount)(C.length):'Nothing sold out'})]}),C.length?C.map(e=>(0,y.jsxs)(o.default,{testID:`soldout-row-${e.itemId}`,style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'space-between',alignItems:'center',paddingVertical:6,borderTopWidth:1,borderTopColor:m.colours.border},children:[(0,y.jsxs)(o.default,{style:{flexShrink:1,flexGrow:1,flexBasis:160,gap:2},children:[(0,y.jsx)(l.T,{weight:"semibold",children:(0,c.withReason)(e.name,T.reason(e.itemId))}),(0,y.jsxs)(l.Muted,{children:["Since ",k(e.at),e.auto?' \xb7 Auto, from the counts \xb7 clears when the count is back up':`${e.by?` \xb7 ${e.by}`:''}${e.clearAfter?` \xb7 clears at ${k(e.clearAfter)}`:''}`]})]}),a?(0,y.jsx)(l.Button,{small:!0,kind:"secondary",label:"Back on",testID:`soldout-back-${e.itemId}`,accessibilityLabel:`Back on: ${e.name}`,onPress:()=>B(e.itemId,e.name)}):null]},e.itemId)):(0,y.jsx)(l.Muted,{children:"When a dish runs out, mark it here so everyone knows."}),L.length?(0,y.jsx)(o.default,{testID:"soldout-kept",children:(0,y.jsxs)(l.Muted,{children:["Kept on by hand while the count is short: ",L.map(e=>e.name).join(', '),". They stay on until the count changes."]})}):null,(0,y.jsxs)(l.Muted,{children:["Clears by itself: ",d.SOLD_OUT_CLEAR_LABEL[M.clear].toLowerCase(),". ",M.auto?'Dishes marked from the counts clear when the count is back up. ':'',"Managers can change this in Settings \u203a Advanced."]})]}),T.items.length?(0,y.jsx)(p,{rid:e,by:n,canEdit:a,auto:M.auto,view:T}):null,a?(0,y.jsxs)(l.Card,{children:[(0,y.jsx)(l.T,{weight:"semibold",size:17,children:"Mark a dish sold out"}),(0,y.jsx)(t.TextInput,{testID:"soldout-search",value:S,onChangeText:I,placeholder:"Find a dish",placeholderTextColor:m.colours.muted,accessibilityLabel:"Find a dish",style:{minHeight:46,borderRadius:12,borderWidth:1,borderColor:m.colours.accentBorder,backgroundColor:m.colours.surface2,color:m.colours.text,paddingHorizontal:12,fontSize:16}}),v.slice(0,60).map(e=>(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingVertical:4},wrap:!0,children:[(0,y.jsxs)(o.default,{style:{flexShrink:1,flexGrow:1,flexBasis:160},children:[(0,y.jsx)(l.T,{children:e.name}),(0,y.jsx)(l.Muted,{children:e.section})]}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"Mark sold out",testID:`soldout-mark-${e.id}`,accessibilityLabel:`Mark sold out: ${e.name}`,onPress:()=>{return t=e.id,s=e.name,(0,r.setSoldOut)(t,!0,n),void x(`Sold out: ${s}`);var t,s}})]},e.id)),v.length?null:(0,y.jsx)(l.Muted,{children:S?'No dish matches that.':'Every dish is marked sold out.'})]}):null]})};var e,t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),o=(e=n)&&e.__esModule?e:{default:e},l=_r(_d[3]),i=_r(_d[4]),r=_r(_d[5]),a=_r(_d[6]),d=_r(_d[7]),u=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),m=_r(_d[11]),y=_r(_d[12]);const k=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`},x=e=>{const t=new Date(globalThis.__ccNow??Date.now()).toISOString();for(const s of['kitchen','foh'])a.useOwner.getState().sys(s,e,t)};const f={link:'set by staff',card:'from its recipe card',description:'from its description',name:'from its name',none:''},b=e=>.5===e?'\xbd':Number.isInteger(e)?String(e):`${Math.floor(e)}\xbd`;function p({rid:e,by:t,canEdit:n,auto:i,view:r}){const[a,d]=(0,s.useState)(!1),[h,k]=(0,s.useState)(null),[x,p]=(0,s.useState)([]),j=r.dishes.filter(t=>t.uses.length||'none'===t.source&&r.links.some(s=>s.rid===e&&s.itemId===t.id&&!s.auto)),w=(a?r.dishes:j).slice().sort((e,t)=>e.name.localeCompare(t.name)),S=r.items.map(e=>`${e.name.toLowerCase()} ${b(r.counts[e.key]??0)}`).join(', '),I=(e,t,s)=>p(n=>n.map(n=>n.key===e?{...n,qty:Math.max(0,Math.min(20,n.qty+s*('half'===t.unit?.5:1)))}:n)),$=(s,n)=>{u.useSoldOutLinks.getState().setLink(e,s,n,t),k(null)};return(0,y.jsx)(o.default,{testID:"soldout-links",children:(0,y.jsxs)(l.Card,{children:[(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'center'},wrap:!0,children:[(0,y.jsx)(l.T,{weight:"semibold",size:17,children:"Dishes linked to the counts"}),(0,y.jsx)(o.default,{testID:"soldout-links-counts",children:(0,y.jsxs)(l.T,{size:13,colour:m.colours.muted,children:["Counts now: ",S]})})]}),(0,y.jsx)(l.Muted,{children:i?'When a count runs out, or drops below what a dish needs, the dish is marked sold out by itself, and put back on when the count is back up. Dishes you mark by hand are left alone.':'Marking dishes from the counts is off for this venue (Settings \u203a Advanced \u203a Sold out reminders).'}),w.map(e=>(0,y.jsxs)(o.default,{testID:`soldout-link-${e.id}`,style:{paddingVertical:6,borderTopWidth:1,borderTopColor:m.colours.border,gap:6},children:[(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'center'},wrap:!0,children:[(0,y.jsxs)(o.default,{style:{flexShrink:1,flexGrow:1,flexBasis:160},children:[(0,y.jsx)(l.T,{weight:"semibold",children:e.name}),(0,y.jsxs)(l.Muted,{children:[e.uses.length?`Uses ${(0,c.usesText)(e.uses,r.items)}`:'Not linked to the counts',f[e.source]?` \xb7 ${f[e.source]}`:'']})]}),n&&h!==e.id?(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"Change",testID:`soldout-link-edit-${e.id}`,accessibilityLabel:`Change what ${e.name} uses`,onPress:()=>{return t=e.id,s=e.uses,k(t),void p(r.items.map(e=>({key:e.key,qty:s.find(t=>t.key===e.key)?.qty??0})));var t,s}}):null]}),h===e.id?(0,y.jsxs)(o.default,{style:{gap:6},children:[r.items.map(t=>{const s=x.find(e=>e.key===t.key)?.qty??0;return(0,y.jsxs)(l.Row,{style:{alignItems:'center',gap:8},children:[(0,y.jsx)(l.T,{style:{flexGrow:1},children:t.name}),(0,y.jsx)(l.Button,{small:!0,kind:"secondary",label:"\u2013",testID:`soldout-link-${e.id}-${t.key}-minus`,accessibilityLabel:`Fewer ${t.plural.toLowerCase()}`,onPress:()=>I(t.key,t,-1)}),(0,y.jsx)(o.default,{testID:`soldout-link-${e.id}-${t.key}-qty`,style:{minWidth:28},children:(0,y.jsx)(l.T,{weight:"semibold",style:{textAlign:'center'},children:b(s)})}),(0,y.jsx)(l.Button,{small:!0,kind:"secondary",label:"+",testID:`soldout-link-${e.id}-${t.key}-plus`,accessibilityLabel:`More ${t.plural.toLowerCase()}`,onPress:()=>I(t.key,t,1)})]},t.key)}),(0,y.jsxs)(l.Muted,{children:["Per portion. ",x.some(e=>e.qty>0)?`Uses ${(0,c.usesText)(x.filter(e=>e.qty>0),r.items)}.`:'Not linked: never marked from the counts.']}),(0,y.jsxs)(l.Row,{style:{gap:8},wrap:!0,children:[(0,y.jsx)(l.Button,{small:!0,label:"Save",testID:`soldout-link-save-${e.id}`,onPress:()=>$(e.id,x.filter(e=>e.qty>0))}),(0,y.jsx)(l.Button,{small:!0,kind:"secondary",label:"Back to automatic",testID:`soldout-link-reset-${e.id}`,accessibilityLabel:`Back to automatic: ${e.guess.length?(0,c.usesText)(e.guess,r.items):'not linked'}`,onPress:()=>$(e.id,null)}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>k(null)})]}),(0,y.jsxs)(l.Muted,{children:["Automatic: ",e.guess.length?(0,c.usesText)(e.guess,r.items):'not linked'," (from the recipe card, description or name)."]})]}):null]},e.id)),w.length?null:(0,y.jsx)(l.Muted,{children:"No dish is linked yet."}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:a?'Show linked dishes only':'Link another dish',testID:"soldout-links-all",onPress:()=>d(!a)})]})})}},992,[877,30,127,813,819,918,856,944,942,943,872,821,24]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"APP_VERSION",{enumerable:!0,get:function(){return t}});const t='v0.3.12.77'},993,[]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useTasksProgress=function(e,s){const t=(0,d.useDailyTasks)(t=>t.people[(0,d.personKey)(e,s)]?.tasks)??[],i=(0,d.useDailyTasks)(e=>e.ticks),{ymd:l,dow:o}=b();return(0,r.progress)(t,i,s,l,o)},_e.DailyTasksEditor=T,_e.MyTasksToday=function({rid:e,staffId:s,name:t,onShift:c}){const u=(0,d.useDailyTasks)(t=>t.people[(0,d.personKey)(e,s)]?.tasks)??[],h=(0,d.useDailyTasks)(e=>e.ticks),{ymd:y,dow:k}=b(),p=(0,r.tasksFor)(u,k);if(!s||!p.length)return null;const T=(0,r.progress)(u,h,s,y,k);return(0,x.jsx)(l.default,{testID:"my-tasks-today",children:(0,x.jsxs)(o.Card,{children:[(0,x.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(o.T,{weight:"semibold",colour:n.colours.gold,children:"My tasks today"}),(0,x.jsx)(o.Badge,{kind:T.done===T.total?'gold':'neutral',label:`${T.done} of ${T.total}`})]}),c?null:(0,x.jsx)(o.Muted,{size:12,children:"You\u2019re not on shift right now. You can still tick these when you are."}),p.map(r=>{const u=h.find(t=>t.id===(0,d.tickId)(e,s,r.id,y));return(0,x.jsxs)(i.default,{testID:`my-task-${r.id}`,accessibilityRole:"checkbox",accessibilityState:{checked:!!u},disabled:!c,onPress:()=>d.useDailyTasks.getState().toggleTick(e,s,r.id,y,{id:s,name:t.replace(' (example)','')}),style:{flexDirection:'row',alignItems:'center',gap:10,paddingVertical:8,opacity:c?1:.6},children:[(0,x.jsx)(l.default,{style:{width:24,height:24,borderRadius:6,borderWidth:1.5,borderColor:n.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:u?'#2a2414':'transparent'},children:u?(0,x.jsx)(o.T,{colour:n.colours.gold,children:"\u2713"}):null}),(0,x.jsxs)(l.default,{style:{flex:1},children:[(0,x.jsx)(o.T,{style:{textDecorationLine:u?'line-through':'none'},children:r.text}),u?(0,x.jsxs)(o.Muted,{size:12,children:["Done at ",f(u.at)]}):null]})]},r.id)}),(0,x.jsx)(o.Muted,{size:12,children:"Tip: tick each one as you finish it. Your manager sees how you\u2019re getting on. They start fresh every day."})]})})},_e.TaskLibrarySettings=function({rid:e}){(0,t.useEffect)(()=>{d.useDailyTasks.getState().ensure(e)},[e]);const i=(0,d.useDailyTasks)(s=>s.library[e]?.items)??[],[c,u]=(0,t.useState)(''),[y,p]=(0,t.useState)({}),f=d.useDailyTasks.getState(),b=s=>f.setLibrary(e,s);return(0,x.jsxs)(l.default,{style:{gap:8},testID:"task-library",children:[(0,x.jsx)(o.Muted,{size:13,children:"Tip: these are quick picks when you add someone\u2019s daily tasks (Staff & roles \u203a a person \u203a Daily tasks). You can always type a new one there too."}),i.map((e,t)=>(0,x.jsxs)(o.Row,{gap:6,style:{opacity:e.archived?.5:1},children:[(0,x.jsx)(s.TextInput,{accessibilityLabel:`Rename ${e.text}`,value:y[e.id]??e.text,onChangeText:s=>p(t=>({...t,[e.id]:s})),onBlur:()=>{const s=(0,r.cleanTaskText)(y[e.id]??'');s&&s!==e.text&&b(i.map(t=>t.id===e.id?{...t,text:s}:t))},style:{...k,flex:1,minWidth:0}}),(0,x.jsx)(o.Button,{small:!0,kind:"ghost",label:"\u2191",disabled:0===t,onPress:()=>b((0,r.move)(i,t,-1))}),(0,x.jsx)(o.Button,{small:!0,kind:"ghost",label:"\u2193",disabled:t===i.length-1,onPress:()=>b((0,r.move)(i,t,1))}),(0,x.jsx)(o.Button,{small:!0,kind:"ghost",label:e.archived?'Bring back':'Archive',onPress:()=>b(i.map(s=>s.id===e.id?{...s,archived:!s.archived}:s))})]},e.id)),(0,x.jsxs)(o.Row,{gap:6,children:[(0,x.jsx)(s.TextInput,{accessibilityLabel:"New library task",testID:"task-lib-new",value:c,onChangeText:u,placeholder:"e.g. Check the beer garden",placeholderTextColor:n.colours.muted,style:{...k,flex:1}}),(0,x.jsx)(o.Button,{small:!0,label:"Add",disabled:!(0,r.cleanTaskText)(c),onPress:()=>{b([...i,{id:(0,h.uuid)(),text:(0,r.cleanTaskText)(c)}]),u('')}})]})]})},_e.KitchenTeamTasks=function({rid:e,actor:s}){const t=(0,y.useOwner)(e=>e.staff).filter(e=>e.active&&s&&(0,r.canEditTasks)(s,e));return(0,x.jsxs)(l.default,{style:{gap:10},testID:"kitchen-team-tasks",children:[(0,x.jsx)(o.Muted,{size:13,children:"Tip: set the daily tasks for your kitchen team here. They see them as \u2018My tasks today\u2019 when they\u2019re on shift and tick them off. Your own list and front of house lists are set by a manager."}),s?null:(0,x.jsx)(o.Muted,{children:"Sign in to change your team\u2019s tasks."}),s&&!t.length?(0,x.jsx)(o.Muted,{children:"No kitchen staff found. A manager can set each person\u2019s department in Staff & roles."}):null,t.map(t=>(0,x.jsxs)(o.Card,{children:[(0,x.jsx)(o.T,{weight:"semibold",children:(0,y.staffLabel)(t).replace(' (example)','')}),(0,x.jsxs)(o.Muted,{size:12,children:[t.job,t.dept?` \xb7 ${t.dept}`:'']}),(0,x.jsx)(T,{rid:e,person:t,actor:s})]},t.id))]})};var s=_r(_d[0]),t=_r(_d[1]),i=e(_r(_d[2])),l=e(_r(_d[3])),o=_r(_d[4]),n=_r(_d[5]),d=_r(_d[6]),r=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),y=_r(_d[11]),x=_r(_d[12]);const k={minHeight:42,borderRadius:10,borderWidth:1,borderColor:n.colours.hairline,backgroundColor:n.colours.surface2,color:n.colours.text,paddingHorizontal:10,fontSize:15},p=[1,2,3,4,5,6,0],f=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}),b=(e=Date.now())=>{const s=(0,c.ukClock)(e);return{ymd:s.ymd,dow:new Date(`${s.ymd}T12:00:00Z`).getUTCDay()}};function T({rid:e,person:c,actor:h}){(0,t.useEffect)(()=>{d.useDailyTasks.getState().ensure(e)},[e]);const y=(0,d.useDailyTasks)(s=>s.people[(0,d.personKey)(e,c.id)]?.tasks)??[],T=((0,d.useDailyTasks)(s=>s.library[e]?.items)??[]).filter(e=>!e.archived),j=(0,d.useDailyTasks)(e=>e.ticks),[w,D]=(0,t.useState)(!1),[v,S]=(0,t.useState)(''),[C,$]=(0,t.useState)(null),I=d.useDailyTasks.getState(),M=(0,r.canEditTasks)(h,c),{ymd:P,dow:R}=b(),L=(0,r.progress)(y,j,c.id,P,R),B=s=>I.setTasks(e,c.id,s),z=e=>{const s=y;B(y.filter(s=>s.id!==e.id)),(0,u.notify)({id:`task-undo-${e.id}`,title:`Removed \u201c${e.text}\u201d`,timeoutMs:8e3,actions:[{label:'Undo',testID:'task-undo',onPress:()=>B(s)}]})};return(0,x.jsxs)(l.default,{testID:`tasks-${c.id}`,style:{gap:6},children:[(0,x.jsx)(i.default,{accessibilityRole:"button",testID:`tasks-open-${c.id}`,onPress:()=>D(!w),children:(0,x.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsxs)(o.T,{weight:"semibold",colour:n.colours.gold,children:["Daily tasks ",w?'\u25b4':'\u25be']}),(0,x.jsx)(o.Muted,{size:12,children:y.length?`${L.done} of ${L.total} done today`:'None yet'})]})}),w?(0,x.jsxs)(l.default,{style:{gap:6},children:[y.map((s,t)=>{const i=j.find(t=>t.id===(0,d.tickId)(e,c.id,s.id,P));return(0,x.jsxs)(l.default,{testID:`task-row-${t}`,style:{borderTopWidth:1,borderColor:n.colours.hairline,paddingTop:6,gap:4},children:[(0,x.jsxs)(o.Row,{gap:6,children:[(0,x.jsxs)(o.T,{style:{flex:1},colour:i?n.colours.gold:n.colours.text,children:[i?'\u2713 ':'',s.text]}),M?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(o.Button,{small:!0,kind:"ghost",label:"\u2191",accessibilityLabel:`Move ${s.text} up`,disabled:0===t,onPress:()=>B((0,r.move)(y,t,-1))}),(0,x.jsx)(o.Button,{small:!0,kind:"ghost",label:"\u2193",accessibilityLabel:`Move ${s.text} down`,disabled:t===y.length-1,onPress:()=>B((0,r.move)(y,t,1))}),(0,x.jsx)(o.Button,{small:!0,kind:"ghost",label:"Days",onPress:()=>$(C===s.id?null:s.id)}),(0,x.jsx)(o.Button,{small:!0,kind:"ghost",testID:`task-remove-${t}`,label:"\u2715",accessibilityLabel:`Remove ${s.text}`,onPress:()=>z(s)})]}):null]}),(0,x.jsxs)(o.Muted,{size:12,children:[s.days?.length?s.days.map(e=>r.TASK_DAY_NAMES[e]).join(', '):'Every day',i?` \xb7 ticked by ${i.byName.split(' ')[0]} at ${f(i.at)}`:'']}),C===s.id?(0,x.jsx)(o.Row,{wrap:!0,gap:4,children:p.map(e=>{const t=!!s.days?.includes(e);return(0,x.jsx)(o.Chip,{label:r.TASK_DAY_NAMES[e],selected:t,onPress:()=>B(y.map(i=>i.id===s.id?{...i,days:t?(i.days??[]).filter(s=>s!==e):[...i.days??[],e].sort()}:i))},e)})}):null]},s.id)}),M?(0,x.jsxs)(l.default,{style:{gap:6},children:[(0,x.jsx)(o.Row,{wrap:!0,gap:4,children:T.filter(e=>!y.some(s=>s.text.toLowerCase()===e.text.toLowerCase())).slice(0,12).map(s=>(0,x.jsx)(o.Chip,{testID:"task-lib-chip",label:`${s.text}`,onPress:()=>I.addTask(e,c.id,s.text,s.id)},s.id))}),(0,x.jsxs)(o.Row,{gap:6,children:[(0,x.jsx)(s.TextInput,{accessibilityLabel:"New task",testID:`task-new-${c.id}`,value:v,onChangeText:S,placeholder:"Type a task, e.g. Restock the bar fridges",placeholderTextColor:n.colours.muted,style:{...k,flex:1},onSubmitEditing:()=>{(0,r.cleanTaskText)(v)&&(I.addTask(e,c.id,v),S(''))}}),(0,x.jsx)(o.Button,{small:!0,testID:`task-add-${c.id}`,label:"Add",disabled:!(0,r.cleanTaskText)(v),onPress:()=>{I.addTask(e,c.id,v),S('')}})]})]}):(0,x.jsx)(o.Muted,{size:12,children:'staff'===h?.role?'You can\u2019t change this list.':''})]}):null]})}},994,[877,30,263,127,813,821,1106,1107,1108,947,1033,856,24]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.readBack=S,_e.ReviewSheet=I,_e.Bars=P,_e.CashCharts=M,_e.CashUpScreen=function({rid:e,today:t,canEdit:s,who:l,chartsOnly:n}){const r=(0,p.useCashSettings)(e),h=(0,p.useCashUp)(e=>e.cashUps).filter(t=>t.rid===e).sort((e,t)=>t.date.localeCompare(e.date)),m=(0,p.useCashUp)(e=>e.sales).filter(t=>t.rid===e).sort((e,t)=>t.weekStart.localeCompare(e.weekStart)),[f,x]=(0,a.useState)(null),[D,P]=(0,a.useState)(null),$=(0,w.useLockedFor)(e),[B,R]=(0,a.useState)(!1),[L,A]=(0,a.useState)(null),z=async(e,s,a,o)=>{const l=a??('cashup'===e?t:(0,y.weekStartOf)((0,y.addDaysYmd)(t,-7)));if($(e,l))return void P((0,w.lockedMessage)(e,l));const n=s?await(0,k.pickPhotos)({source:s}):[];if(s&&!n.length)return void P('No photo taken. Try again, choose one from the gallery, or type the figures by hand.');const i='cashup'===e?r.cashFields:r.salesFields;let d,u={vals:{},reader:null,note:'Type the figures from the sheet.',categories:[]};n.length&&(R(!0),P('Reading the photo\u2026'),d=await Promise.all(n.map((t,s)=>(0,k.uploadPhoto)(e,l,t,s))),u=await(0,j.readSheet)(e,d.filter(e=>!!e),i),R(!1),P(null));const c=o&&'cashup'===e?h.find(e=>e.date===l)?.vals:void 0;x({kind:e,key:l,photos:n,vals:c?{...u.vals,...c}:u.vals,categories:u.categories??[],unread:(0,y.missing)(i,u.vals),note:u.note,reader:o?'edit':u.reader,uploaded:d,only:o})},E=[0,1,2].map(e=>({label:0===e?'Today':1===e?'Yesterday':v((0,y.addDaysYmd)(t,-e)),value:(0,y.addDaysYmd)(t,-e)})),N=[0,1,2].map(e=>{const s=(0,y.weekStartOf)((0,y.addDaysYmd)(t,-7*e));return{label:0===e?'This week':1===e?'Last week':`w/c ${v(s)}`,value:s}});return(0,C.jsxs)(d.default,{testID:"cashup-screen",style:{gap:12},children:[(0,C.jsx)(u.Muted,{children:"Tip: at the end of the night, tap Take a picture of the taking sheet: the figures are filled in from the photo for you to check beside it, then Confirm. Bigger venues can Upload a spreadsheet (CSV or Excel) for one night or several. Gross takings feed Spend per head. Head Chefs can see the graphs."}),D?(0,C.jsx)(u.Banner,{kind:"info",children:D}):null,(0,C.jsx)(U,{rid:e,today:t,manage:s,who:l}),s&&!n?(0,C.jsxs)(u.Card,{highlight:c.colours.gold,children:[(0,C.jsx)(u.T,{weight:"semibold",children:"End of night cash up"}),(0,C.jsx)(i.default,{testID:"upload-cashup",accessibilityRole:"button",accessibilityLabel:"Take a picture of the taking sheet. Opens the camera; the figures are filled in for you to check.",disabled:B,onPress:()=>{z('cashup','camera')},style:({pressed:e})=>({minHeight:64,borderRadius:16,backgroundColor:e?c.colours.goldLight:c.colours.gold,alignItems:'center',justifyContent:'center',paddingHorizontal:18,opacity:B?.5:1}),children:(0,C.jsx)(u.T,{size:20,weight:"semibold",colour:c.colours.onGold,children:B?'Reading the photo\u2026':'Take a picture of the taking sheet'})}),(0,C.jsxs)(u.Row,{wrap:!0,gap:8,children:[(0,C.jsx)(u.Button,{testID:"cashup-gallery",kind:"secondary",label:"Choose from gallery",accessibilityLabel:"Choose a photo of the cash up from the gallery",onPress:()=>{z('cashup','gallery')}}),(0,C.jsx)(u.Button,{testID:"cashup-by-hand",kind:"secondary",label:"Type it in",onPress:()=>{z('cashup',null)}}),(0,C.jsx)(u.Button,{testID:"cashup-sheet",kind:"secondary",label:"Upload a spreadsheet",accessibilityLabel:"Upload a spreadsheet of takings, CSV or Excel, for one night or several",onPress:async()=>{const e=await(0,b.pickSpreadsheet)();e&&('error'in e?P(e.error):A(e))}}),(0,C.jsx)(u.Button,{testID:"cashup-takings",kind:"secondary",label:"Enter takings",accessibilityLabel:"Enter tonight's takings: gross, and food and drink if you have them",onPress:()=>{z('cashup',null,t,y.TAKINGS_KEYS)}})]}),(0,C.jsx)(u.T,{weight:"semibold",style:{marginTop:8},children:"Weekly sales report"}),(0,C.jsxs)(u.Row,{wrap:!0,gap:8,children:[(0,C.jsx)(u.Button,{testID:"upload-sales",label:"Upload weekly sales report",onPress:()=>{z('sales','camera')}}),(0,C.jsx)(u.Button,{testID:"sales-gallery",kind:"secondary",label:"Choose from gallery",onPress:()=>{z('sales','gallery')}}),(0,C.jsx)(u.Button,{testID:"sales-by-hand",kind:"secondary",label:"Type it in",onPress:()=>{z('sales',null)}})]}),(0,C.jsx)(u.Muted,{children:"Several pages? Pick them all at once. Fields can be changed in Settings \u203a Advanced \u203a Cash up."})]}):null,(0,C.jsx)(M,{rid:e,today:t}),(0,C.jsxs)(u.Card,{children:[(0,C.jsx)(u.T,{weight:"semibold",children:"Recent cash ups"}),h.length?h.slice(0,10).map(e=>(0,C.jsxs)(d.default,{testID:`cashup-row-${e.date}`,style:{paddingVertical:6,borderTopWidth:1,borderTopColor:'rgba(255,255,255,0.06)',gap:2},children:[(0,C.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsx)(u.T,{weight:"semibold",children:v(e.date)}),(0,C.jsx)(u.T,{colour:c.colours.goldLight,children:T((0,y.takings)(e.vals))})]}),(0,C.jsx)(u.Muted,{children:r.cashFields.filter(e=>'text'!==e.kind&&'card'!==e.key&&'cash'!==e.key).map(t=>`${t.label} ${(0,y.isBlank)(e.vals[t.key])?'\u2014':'money'===t.kind?T(e.vals[t.key]):e.vals[t.key]}`).join(' \xb7 ')}),(0,C.jsxs)(u.Muted,{children:["Confirmed by ",e.confirmedBy??'\u2014',e.photos.length?` \xb7 ${e.photos.length} photo${e.photos.length>1?'s':''}`:'']}),s&&!$('cashup',e.date)?(0,C.jsxs)(u.Row,{gap:6,children:[(0,C.jsx)(u.Button,{small:!0,kind:"ghost",label:"Edit",onPress:()=>x({kind:'cashup',key:e.date,photos:e.photos,vals:e.vals,categories:[],unread:[],note:'',reader:'edit'})}),(0,C.jsx)(u.Button,{small:!0,kind:"ghost",testID:`takings-edit-${e.date}`,label:null==(0,y.grossOf)(e.vals)?'Add takings':'Edit takings',onPress:()=>x({kind:'cashup',key:e.date,photos:[],vals:e.vals,categories:[],unread:[],note:'',reader:'edit',only:y.TAKINGS_KEYS})})]}):null,s?(0,C.jsx)(w.CashLockControls,{kind:"cashup",item:e,label:v(e.date)}):null]},e.id)):(0,C.jsx)(u.Muted,{children:"None yet."})]}),(0,C.jsxs)(u.Card,{children:[(0,C.jsx)(u.T,{weight:"semibold",children:"Weekly sales reports"}),m.length?m.slice(0,8).map(e=>(0,C.jsxs)(d.default,{style:{paddingVertical:6,borderTopWidth:1,borderTopColor:'rgba(255,255,255,0.06)'},children:[(0,C.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsxs)(u.T,{weight:"semibold",children:["w/c ",v(e.weekStart)]}),(0,C.jsx)(u.T,{colour:c.colours.goldLight,children:T('number'==typeof e.vals.net?e.vals.net:null)})]}),(0,C.jsx)(u.Muted,{children:r.salesFields.filter(e=>'net'!==e.key).map(t=>`${t.label} ${(0,y.isBlank)(e.vals[t.key])?'\u2014':'money'===t.kind?T(e.vals[t.key]):e.vals[t.key]}`).join(' \xb7 ')}),s?(0,C.jsx)(w.CashLockControls,{kind:"sales",item:e,label:`w/c ${v(e.weekStart)}`}):null]},e.id)):(0,C.jsx)(u.Muted,{children:"None yet."})]}),L?(0,C.jsx)(b.SpreadsheetImport,{rid:e,file:L,who:l,locked:e=>$('cashup',e),onClose:()=>A(null),onSaved:e=>{P(e),A(null)}}):null,f?(0,C.jsx)(I,{draft:f,fields:'cashup'===f.kind?r.cashFields:r.salesFields,onClose:()=>x(null),onConfirm:async(t,s)=>{if(!f)return;if($(f.kind,f.key))return P((0,w.lockedMessage)(f.kind,f.key)),void x(null);const a=f.uploaded&&f.uploaded.length===f.photos.length?f.uploaded:await Promise.all(f.photos.map((e,t)=>(0,k.uploadPhoto)(f.kind,f.key,e,t))),n=f.photos.map((e,t)=>a[t]??e),r=(new Date).toISOString();if('cashup'===f.kind){const s=h.find(e=>e.date===f.key),a=f.only&&s?{...s.vals,...t}:t;p.useCashUp.getState().saveCashUp({rid:e,date:f.key,vals:a,photos:f.only&&s?s.photos:n,confirmedBy:l.name,confirmedAt:r,readBy:f.reader});const i=(0,y.combinedTips)(a),d=S(a);P(`Cash up for ${v(f.key)} saved${d?`: ${d}`:''}${null==i||f.only?'':`. Today\u2019s tips (${T(i)}) are now showing in the staff apps`}.`);try{o.default.announceForAccessibility?.(`Saved. ${d}`)}catch{}}else p.useCashUp.getState().saveSales({rid:e,weekStart:f.key,vals:t,categories:s,photos:n,confirmedBy:l.name,confirmedAt:r,readBy:f.reader}),P(`Weekly sales for the week of ${v(f.key)} saved.`);a.some(e=>null==e)&&f.photos.length&&P(e=>`${e??''} The photo is kept on this device only (not signed in or offline).`),x(null)},keyLabel:'cashup'===f.kind?'Day':'Week starting',keyChoices:'cashup'===f.kind?E:N,onKey:e=>x({...f,key:e})},`${f.kind}-${f.photos.length}`):null]})},_e.TodaysTipsCard=function({rid:e,today:t,big:s}){const a=(0,p.useTipsShow)(e),o=(0,p.useCashUp)(e=>e.tips).filter(s=>s.rid===e&&(s.date===t||s.date===(0,y.addDaysYmd)(t,-1))).sort((e,t)=>t.date.localeCompare(e.date))[0],l=R(o?.total??0);return a.showToday&&o?(0,C.jsx)(u.Card,{highlight:c.colours.gold,children:(0,C.jsxs)(d.default,{testID:"todays-tips",style:{flexDirection:'row',alignItems:'center',gap:14},children:[(0,C.jsx)($,{n:Math.ceil(o.total/25)}),(0,C.jsxs)(d.default,{style:{flex:1,gap:2},children:[(0,C.jsx)(u.T,{size:12,weight:"semibold",colour:c.colours.gold,style:{letterSpacing:1.5},children:o.date===t?'TODAY\u2019S TIPS':'LAST NIGHT\u2019S TIPS'}),(0,C.jsx)(u.T,{size:s?40:32,weight:"bold",colour:c.colours.goldLight,children:T(l)}),(0,C.jsxs)(u.Muted,{children:["Cash + card tips for the whole team \xb7 ",v(o.date),". Thank you, everyone."]})]})]})}):null},_e.TipsPotCard=U,_e.useTipsPosted=function(e,t,s=!0){const o=(0,p.useCashUp)(e=>e.tips),l=(0,p.useTipsShow)(e);(0,a.useEffect)(()=>{if(!s||!l.showToday)return;const a=o.filter(s=>s.rid===e&&s.date>=(0,y.addDaysYmd)(t,-1)&&s.date<=t).sort((e,t)=>t.date.localeCompare(e.date))[0];if(!a)return;const n=`${e}:${a.date}`;p.useCashUp.getState().seen[n]!==a.total&&(p.useCashUp.getState().markSeen(n,a.total),(0,x.notify)({id:`tips-${n}`,icon:'\ud83e\ude99',kicker:'TIPS',title:`${a.date===t?'Today\u2019s':'Last night\u2019s'} tips: ${T(a.total)}`,body:'Cash + card tips for the whole team. Added to the Tips pot. Thank you, everyone.',testID:'tips-notice',timeoutMs:12e3,actions:[{label:'Nice',testID:'tips-notice-ok',onPress:()=>{}}]}))},[e,t,o,l.showToday,s])},_e.CashUpSettings=function({rid:e}){const t=(0,p.useCashSettings)(e),a=(t,s)=>p.useCashUp.getState().setFields(e,t,s),o=(e,o)=>(0,C.jsxs)(d.default,{style:{gap:6},children:[(0,C.jsx)(u.T,{weight:"semibold",children:o}),t[e].map((o,l)=>(0,C.jsxs)(u.Row,{gap:6,children:[(0,C.jsx)(s.TextInput,{testID:`cf-${e}-${o.key}`,value:o.label,onChangeText:s=>a(e,t[e].map((e,t)=>t===l?{...e,label:s.slice(0,40)}:e)),style:{flex:1,minHeight:38,borderRadius:8,borderWidth:1,borderColor:'rgba(255,255,255,0.15)',color:c.colours.text,paddingHorizontal:8}}),(0,C.jsx)(u.Muted,{children:'money'===o.kind?'\xa3':'number'===o.kind?'#':'text'}),o.fixed?(0,C.jsx)(u.Muted,{children:"needed"}):(0,C.jsx)(u.Button,{small:!0,kind:"ghost",label:"\u2715",accessibilityLabel:`Remove ${o.label}`,onPress:()=>a(e,t[e].filter((e,t)=>t!==l))})]},o.key)),(0,C.jsxs)(u.Row,{gap:6,children:[(0,C.jsx)(u.Button,{small:!0,kind:"secondary",label:"Money figure",onPress:()=>a(e,[...t[e],{key:`f${Date.now().toString(36)}`,label:'New figure',kind:'money'}])}),(0,C.jsx)(u.Button,{small:!0,kind:"secondary",label:"Number",onPress:()=>a(e,[...t[e],{key:`n${Date.now().toString(36)}`,label:'New number',kind:'number'}])})]})]});return(0,C.jsxs)(d.default,{testID:"cashup-settings",style:{gap:12},children:[(0,C.jsx)(u.Muted,{children:"Tip: match these to the boxes on your paper cash up sheet and till printout. Cash tips total and Card tips total are needed for Today\u2019s tips and the Tips pot."}),o('cashFields','Cash up sheet'),o('salesFields','Weekly sales report')]})},_e.TipsSettings=function({rid:e}){const t=(0,p.useTipsShow)(e);return(0,C.jsxs)(d.default,{testID:"tips-settings",style:{gap:8},children:[(0,C.jsx)(u.Muted,{children:"Staff only ever see the team total: never anyone\u2019s share or pay. The Display never shows tips or money."}),(0,C.jsx)(u.Toggle,{testID:"tips-show-today",label:"Show Today\u2019s tips in the staff apps",value:t.showToday,onChange:t=>p.useCashUp.getState().setShow(e,{showToday:t})}),(0,C.jsx)(u.Toggle,{testID:"tips-show-pot",label:"Show the Tips pot in the staff apps",value:t.showPot,onChange:t=>p.useCashUp.getState().setShow(e,{showPot:t})})]})};var t=_r(_d[0]),s=_r(_d[1]),a=_r(_d[2]),o=e(_r(_d[3])),l=e(_r(_d[4])),n=e(_r(_d[5])),r=e(_r(_d[6])),i=e(_r(_d[7])),d=e(_r(_d[8])),h=e(_r(_d[9])),u=_r(_d[10]),c=_r(_d[11]),p=_r(_d[12]),y=_r(_d[13]),m=_r(_d[14]),f=_r(_d[15]),x=_r(_d[16]),k=_r(_d[17]),j=_r(_d[18]),b=_r(_d[19]),w=_r(_d[20]),C=_r(_d[21]);const T=e=>null==e?'\u2014':`\xa3${e.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`,v=e=>new Date(`${e}T12:00:00Z`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'UTC'});function S(e){const t=t=>'number'==typeof e[t]?e[t]:null,s=(0,y.combinedTips)(e);return[['Gross',t('gross')],['card',t('card')],['cash',t('cash')],['tips',s],['food',t('food')],['drink',t('drink')]].filter(([,e])=>null!=e).map(([e,t])=>`${e} ${T(t)}`).join(', ')}function D({p:e,h:s}){const[o,l]=(0,a.useState)(e.startsWith('data:')?e:null);return(0,a.useEffect)(()=>{o||(0,k.photoUrl)(e).then(l)},[e]),o?(0,C.jsx)(r.default,{source:{uri:o},style:{width:'100%',height:s,borderRadius:10,backgroundColor:(0,t.soutersSurface)('#111')},resizeMode:"contain"}):(0,C.jsx)(d.default,{style:{height:s,borderRadius:10,backgroundColor:(0,t.soutersSurface)('#1B1A18'),alignItems:'center',justifyContent:'center'},children:(0,C.jsx)(u.Muted,{children:"Photo"})})}function I({draft:e,fields:t,onClose:o,onConfirm:l,keyLabel:n,onKey:r,keyChoices:i}){const{width:p,height:m}=(0,h.default)(),f=p>=820;e.only&&(t=t.filter(t=>e.only.includes(t.key)));const[x,k]=(0,a.useState)(()=>Object.fromEntries(t.map(t=>[t.key,(0,y.isBlank)(e.vals[t.key])?'':String(e.vals[t.key])]))),[j,b]=(0,a.useState)(()=>e.categories.map(e=>({name:e.name,amount:String(e.amount)}))),[w,T]=(0,a.useState)(!1),v=Object.fromEntries(t.map(e=>[e.key,'text'===e.kind?x[e.key]?.trim()||null:(0,y.parseAmount)(x[e.key]??'',e.kind)])),S=t.filter(e=>'text'!==e.kind&&(x[e.key]??'').trim()&&null==v[e.key]).map(e=>e.key),I=(0,y.missing)(t,v),P=j.map(e=>({name:e.name.trim(),amount:(0,y.parseAmount)(e.amount)})).filter(e=>e.name),M=P.some(e=>null==e.amount),$=e=>({minHeight:42,borderRadius:10,borderWidth:e?2:1,borderColor:e?c.colours.amber:'rgba(255,255,255,0.15)',backgroundColor:e?'rgba(232,168,56,0.08)':'#141312',color:c.colours.text,paddingHorizontal:10,fontSize:17}),B=(0,C.jsx)(d.default,{testID:"review-photos",style:{gap:8,flex:f?1:void 0},children:e.photos.length?e.photos.map((t,s)=>(0,C.jsx)(D,{p:t,h:f?Math.max(300,.62*m/Math.min(2,e.photos.length)):260},s)):(0,C.jsx)(u.Muted,{children:"No photo: typed by hand."})}),R=(0,C.jsxs)(d.default,{testID:"review-fields",style:{gap:8,flex:f?1:void 0},children:[(0,C.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,C.jsx)(u.Muted,{children:n}),i.map(t=>(0,C.jsx)(u.Chip,{label:t.label,selected:e.key===t.value,onPress:()=>r(t.value)},t.value))]}),t.map(e=>{const t='text'!==e.kind&&!(x[e.key]??'').trim()||S.includes(e.key);return(0,C.jsxs)(d.default,{style:{gap:3},children:[(0,C.jsxs)(u.Row,{gap:6,children:[(0,C.jsx)(u.T,{weight:"semibold",size:14,children:e.label}),t&&'text'!==e.kind?(0,C.jsx)(u.Badge,{kind:"amber",label:S.includes(e.key)?'Check this':'Not read: type it'}):null]}),(0,C.jsx)(s.TextInput,{testID:`review-${e.key}`,value:x[e.key]??'',onChangeText:t=>k(s=>({...s,[e.key]:t})),keyboardType:'text'===e.kind?'default':'decimal-pad',placeholder:'money'===e.kind?'\xa3':'number'===e.kind?'Number':'Optional',placeholderTextColor:"#777",style:$(t)})]},e.key)}),'sales'===e.kind?(0,C.jsxs)(d.default,{testID:"review-categories",style:{gap:6},children:[(0,C.jsx)(u.T,{weight:"semibold",size:14,children:"Sales by category (if the printout has them)"}),j.map((e,t)=>(0,C.jsxs)(u.Row,{gap:6,children:[(0,C.jsx)(s.TextInput,{value:e.name,onChangeText:e=>b(s=>s.map((s,a)=>a===t?{...s,name:e}:s)),placeholder:"e.g. Food",placeholderTextColor:"#777",style:[$(!1),{flex:2}]}),(0,C.jsx)(s.TextInput,{value:e.amount,onChangeText:e=>b(s=>s.map((s,a)=>a===t?{...s,amount:e}:s)),placeholder:"\xa3",placeholderTextColor:"#777",keyboardType:"decimal-pad",style:[$(!e.amount.trim()||null==(0,y.parseAmount)(e.amount)),{flex:1}]}),(0,C.jsx)(u.Button,{small:!0,kind:"ghost",label:"\u2715",accessibilityLabel:"Remove category",onPress:()=>b(e=>e.filter((e,s)=>s!==t))})]},t)),(0,C.jsx)(u.Button,{small:!0,kind:"secondary",testID:"review-add-cat",label:"Add a category",onPress:()=>b(e=>[...e,{name:'',amount:''}])})]}):null]});return(0,C.jsxs)(u.Sheet,{visible:!0,onClose:o,title:'cashup'===e.kind?'Check the cash up':'Check the weekly sales',maxWidth:1100,testID:"review-sheet",children:[(0,C.jsx)(u.Muted,{children:"Tip: check each figure against the photo. Nothing is saved until you tap Confirm. Amber boxes weren\u2019t read: type them, or leave them blank if the sheet doesn\u2019t have them."}),'edit'===e.reader||e.only?null:e.reader?(0,C.jsx)(u.Banner,{kind:"info",title:"Read from the photo",children:e.note}):e.photos.length?(0,C.jsx)(u.Banner,{kind:"info",title:"Type it from the photo",children:e.note}):null,f?(0,C.jsxs)(d.default,{style:{flexDirection:'row',gap:14},children:[B,R]}):(0,C.jsxs)(C.Fragment,{children:[B,R]}),I.length?(0,C.jsxs)(u.Muted,{children:[I.length," figure",1===I.length?'':'s'," still blank. Blank means \u201cnot on the sheet\u201d, never zero."]}):null,(0,C.jsxs)(u.Row,{gap:8,children:[(0,C.jsx)(u.Button,{testID:"review-confirm",label:w?'Saving\u2026':'Confirm and save',disabled:w||!!S.length||M||!t.some(e=>'text'!==e.kind&&null!=v[e.key]),onPress:async()=>{T(!0),await l(v,P.map(e=>({name:e.name,amount:e.amount}))),T(!1)}}),(0,C.jsx)(u.Button,{kind:"secondary",label:"Cancel",onPress:o})]})]})}function P({data:e,height:t=140,testID:s,fmt:a=T}){const o=Math.max(1,...e.map(e=>e.value??0));return(0,C.jsxs)(d.default,{testID:s,style:{gap:4},children:[(0,C.jsx)(d.default,{style:{flexDirection:'row',alignItems:'flex-end',gap:4,height:t},children:e.map((e,s)=>(0,C.jsxs)(d.default,{style:{flex:1,alignItems:'center',justifyContent:'flex-end',height:t},children:[null!=e.value?(0,C.jsx)(u.T,{size:9,colour:c.colours.muted,children:a(e.value).replace('.00','')}):null,(0,C.jsx)(d.default,{style:{width:'80%',height:null==e.value?2:Math.max(3,e.value/o*(t-16)),borderRadius:4,backgroundColor:null==e.value?'#333':e.hi?c.colours.goldLight:c.colours.gold,opacity:null==e.value?.6:1}})]},s))}),(0,C.jsx)(d.default,{style:{flexDirection:'row',gap:4},children:e.map((e,t)=>(0,C.jsx)(u.T,{size:9,colour:c.colours.muted,style:{flex:1,textAlign:'center'},children:e.label},t))})]})}function M({rid:e,today:s}){const a=(0,p.useCashUp)(e=>e.cashUps).filter(t=>t.rid===e),o=(0,p.useCashUp)(e=>e.sales).filter(t=>t.rid===e),l=(0,y.dailySeries)(a,s,14),n=(0,y.dailySeries)(a,s,14,y.combinedTips),r=(0,y.weekStartOf)(s),i=Array.from({length:8},(e,t)=>(0,y.addDaysYmd)(r,7*(t-7))).map(e=>{const t=o.find(t=>t.weekStart===e&&t.confirmedAt),s=t?.vals.net;return{label:v(e).split(' ').slice(1).join(' '),value:'number'==typeof s?s:null,hi:e===r}}),h=[...o].filter(e=>e.confirmedAt).sort((e,t)=>t.weekStart.localeCompare(e.weekStart))[0],m=h?(0,y.weekCompare)(o,h.weekStart):null,f=h?.categories??[],x=Math.max(1,...f.map(e=>e.amount)),k=h?(0,y.weekCompare)(o,h.weekStart,'covers'):null;return(0,C.jsxs)(d.default,{testID:"cash-charts",style:{gap:12},children:[(0,C.jsxs)(u.Card,{children:[(0,C.jsx)(u.T,{weight:"semibold",children:"Takings, last 14 days"}),(0,C.jsx)(u.Muted,{children:"Card + cash from confirmed cash ups. A grey line means no cash up that day."}),(0,C.jsx)(P,{testID:"chart-daily",data:l.map(e=>({label:v(e.date).split(' ')[1],value:e.value,hi:e.date===s}))})]}),(0,C.jsxs)(u.Card,{children:[(0,C.jsx)(u.T,{weight:"semibold",children:"Tips, last 14 days"}),(0,C.jsx)(u.Muted,{children:"Cash + card tips, team total."}),(0,C.jsx)(P,{testID:"chart-tips",height:100,data:n.map(e=>({label:v(e.date).split(' ')[1],value:e.value,hi:e.date===s}))})]}),(0,C.jsxs)(u.Card,{children:[(0,C.jsx)(u.T,{weight:"semibold",children:"Weekly net sales"}),m&&null!=m.now?(0,C.jsx)(d.default,{testID:"week-compare",children:(0,C.jsxs)(u.T,{size:15,children:["Week of ",v(h.weekStart),": ",T(m.now),null!=m.prev?` \xb7 week before ${T(m.prev)}`:'',null!=m.change?` \xb7 ${m.change>=0?'\u25b2':'\u25bc'} ${Math.abs(m.change)}%`:'']})}):(0,C.jsx)(u.Muted,{children:"No weekly sales report yet."}),k&&null!=k.now?(0,C.jsxs)(u.Muted,{children:["Covers ",k.now,null!=k.prev?` (week before ${k.prev})`:'']}):null,(0,C.jsx)(P,{testID:"chart-weekly",data:i})]}),f.length?(0,C.jsxs)(u.Card,{children:[(0,C.jsxs)(u.T,{weight:"semibold",children:["By category, week of ",v(h.weekStart)]}),(0,C.jsx)(d.default,{testID:"chart-categories",style:{gap:6},children:f.map(e=>(0,C.jsxs)(d.default,{style:{gap:2},children:[(0,C.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsx)(u.T,{size:14,children:e.name}),(0,C.jsx)(u.T,{size:14,colour:c.colours.goldLight,children:T(e.amount)})]}),(0,C.jsx)(d.default,{style:{height:10,borderRadius:5,backgroundColor:(0,t.soutersSurface)('#2A2826')},children:(0,C.jsx)(d.default,{style:{width:e.amount/x*100+"%",height:10,borderRadius:5,backgroundColor:c.colours.gold}})})]},e.name))})]}):null]})}function $({n:e,testID:t}){const s=Math.max(1,Math.min(14,e));return(0,C.jsx)(d.default,{testID:t,style:{width:64,height:114,justifyContent:'flex-end'},children:Array.from({length:s}).map((e,t)=>(0,C.jsx)(B,{delay:50*t},t))})}function B({delay:e}){const t=(0,a.useRef)(new l.default.Value(1)).current;return(0,a.useEffect)(()=>{l.default.timing(t,{toValue:0,duration:420,delay:e,easing:n.default.out(n.default.back(1.6)),useNativeDriver:!1}).start()},[]),(0,C.jsx)(l.default.View,{style:{height:7,transform:[{translateY:t.interpolate({inputRange:[0,1],outputRange:[0,-120]})}],opacity:t.interpolate({inputRange:[0,1],outputRange:[1,0]})},children:(0,C.jsx)(d.default,{style:{width:60,height:12,borderRadius:30,backgroundColor:c.colours.gold,borderWidth:1,borderColor:c.colours.goldLight}})})}function R(e){const[t,s]=(0,a.useState)(e),o=(0,a.useRef)(e);return(0,a.useEffect)(()=>{const t=o.current,a=e;if(t===a)return;const l=Date.now(),n=setInterval(()=>{const e=Math.min(1,(Date.now()-l)/1200);s(Math.round(100*(t+(a-t)*(1-Math.pow(1-e,3))))/100),e>=1&&(clearInterval(n),o.current=a)},40);return()=>clearInterval(n)},[e]),t}function U({rid:e,today:t,manage:s,who:o,big:l}){const n=(0,p.useTipsShow)(e),r=(0,p.useCashUp)(e=>e.tips).filter(t=>t.rid===e),i=(0,p.useCashUp)(e=>e.pot).filter(t=>t.rid===e),h=(0,f.useVenuePay)(e).pay,x=(0,m.tipsPeriod)(h,t),k=(0,a.useMemo)(()=>(0,y.tipsPot)(r,i,x.start,t),[r,i,x.start,t]),j=R(k.total),[b,w]=(0,a.useState)(null);return n.showPot||s?(0,C.jsxs)(u.Card,{highlight:c.colours.gold,children:[(0,C.jsxs)(d.default,{testID:"tips-pot",style:{flexDirection:'row',alignItems:'center',gap:14},children:[(0,C.jsx)($,{n:Math.ceil(k.total/100),testID:"tips-pot-coins"},k.total),(0,C.jsxs)(d.default,{style:{flex:1,gap:2},children:[(0,C.jsx)(u.T,{size:12,weight:"semibold",colour:c.colours.gold,style:{letterSpacing:1.5},children:"TIPS POT"}),(0,C.jsx)(u.T,{size:l?40:32,weight:"bold",colour:c.colours.goldLight,children:T(j)}),(0,C.jsxs)(u.Muted,{children:["Tips held for the team since ",v(k.from),x.payday?` \xb7 next tip payday ${v(x.payday)}`:'',". Confirmed cash ups only.",n.showPot?'':' (Hidden from staff.)']})]})]}),s?(0,C.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,C.jsx)(u.Button,{small:!0,kind:"secondary",testID:"pot-payout",label:"Mark payout done",onPress:()=>w('payout')}),(0,C.jsx)(u.Button,{small:!0,kind:"ghost",testID:"pot-correct",label:"Correct an entry",onPress:()=>w('correct')}),(0,C.jsx)(u.Button,{small:!0,kind:"ghost",testID:"pot-history",label:"Past pots",onPress:()=>w('history')})]}):null,'payout'===b?(0,C.jsxs)(u.Sheet,{visible:!0,onClose:()=>w(null),title:"Mark payout done",maxWidth:520,testID:"pot-payout-sheet",children:[(0,C.jsxs)(u.T,{children:["Pay out ",T(k.total)," (tips from ",v(k.from)," to ",v(t),")?"]}),(0,C.jsx)(u.Muted,{children:"The pot goes back to \xa30.00 for the next period. This is logged and kept in Past pots. No money is moved by the app."}),(0,C.jsx)(u.Button,{testID:"pot-payout-confirm",label:"Yes, payout done",onPress:()=>{p.useCashUp.getState().addPotEvent({rid:e,kind:'payout',throughDate:t,amount:k.total,by:o?.name??'Manager'}),w(null)}})]}):null,'correct'===b?(0,C.jsx)(L,{rid:e,today:t,who:o,onClose:()=>w(null)}):null,'history'===b?(0,C.jsxs)(u.Sheet,{visible:!0,onClose:()=>w(null),title:"Past pots and corrections",maxWidth:560,testID:"pot-history-sheet",children:[k.history.length||i.some(e=>'correction'===e.kind)?null:(0,C.jsx)(u.Muted,{children:"No payouts or corrections yet."}),i.slice().sort((e,t)=>t.at.localeCompare(e.at)).map(e=>(0,C.jsxs)(d.default,{style:{paddingVertical:4},children:[(0,C.jsx)(u.T,{weight:"semibold",children:'payout'===e.kind?`Paid out ${T(e.amount)}`:`Correction ${e.amount>=0?'+':'\u2212'}${T(Math.abs(e.amount))} for ${v(e.forDate)}`}),(0,C.jsxs)(u.Muted,{children:['payout'===e.kind?`Tips to ${v(e.throughDate)}`:`\u201c${e.reason}\u201d`," \xb7 ",e.by," \xb7 ",new Date(e.at).toLocaleString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})]})]},e.id))]}):null]}):null}function L({rid:e,today:o,who:l,onClose:n}){const[r,i]=(0,a.useState)(o),[d,h]=(0,a.useState)(''),[m,f]=(0,a.useState)(''),x=(0,y.parseAmount)(d),k={minHeight:42,borderRadius:10,borderWidth:1,borderColor:'rgba(255,255,255,0.15)',backgroundColor:(0,t.soutersSurface)('#141312'),color:c.colours.text,paddingHorizontal:10,fontSize:16};return(0,C.jsxs)(u.Sheet,{visible:!0,onClose:n,title:"Correct an entry",maxWidth:520,testID:"pot-correct-sheet",children:[(0,C.jsx)(u.Muted,{children:"Tip: add or take off an amount for a day (use a minus for less, e.g. -5). Every correction is logged with your name and the reason."}),(0,C.jsx)(u.Row,{wrap:!0,gap:6,children:[0,1,2,3].map(e=>{const t=(0,y.addDaysYmd)(o,-e);return(0,C.jsx)(u.Chip,{label:0===e?'Today':v(t),selected:r===t,onPress:()=>i(t)},t)})}),(0,C.jsx)(s.TextInput,{testID:"pot-correct-amount",value:d,onChangeText:h,placeholder:"\xa3 e.g. -5.00",placeholderTextColor:"#777",keyboardType:"numbers-and-punctuation",style:k}),(0,C.jsx)(s.TextInput,{testID:"pot-correct-reason",value:m,onChangeText:f,placeholder:"Reason (required)",placeholderTextColor:"#777",maxLength:200,style:k}),(0,C.jsx)(u.Button,{testID:"pot-correct-save",label:"Save correction",disabled:null==x||0===x||!m.trim(),onPress:()=>{p.useCashUp.getState().addPotEvent({rid:e,kind:'correction',forDate:r,amount:x,reason:m.trim(),by:l?.name??'Manager'}),n()}})]})}},995,[868,877,30,118,120,224,196,263,127,287,813,821,1093,1109,1110,1111,947,1281,1285,1286,1289,24]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useCashAccess",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"hasCashUpAccess",{enumerable:!0,get:function(){return n}});const t=(0,r(d[0]).create)(()=>({byRef:{},mine:null,loaded:!1})),n=()=>!0===t.getState().mine},996,[952]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"fmtDate",{enumerable:!0,get:function(){return m}}),_e.SignOffLine=b,_e.CardView=w,_e.CardEditor=I,_e.RecipeCards=function({rid:e,actor:n,mode:d}){const f=(0,o.useRecipeCards)(e),[j,b]=(0,t.useState)(''),[C,k]=(0,t.useState)([]),[D,v]=(0,t.useState)('free-from'),[T,S]=(0,t.useState)('all'),[B,$]=(0,t.useState)(null),[P,R]=(0,t.useState)(null),L='edit'===d&&(0,h.canEditCards)(n.role),A=L?f:f.filter(e=>!!e.signOff),M=(0,t.useMemo)(()=>{const e='all'===T?A:A.filter(e=>(0,h.cardState)(e)===T);return(0,h.filterCards)(e,j,C,D).slice().sort((e,s)=>e.section.localeCompare(s.section)||e.dish.localeCompare(s.dish))},[A,j,C,D,T]),E=f.filter(e=>!e.signOff).length,N=B?f.find(e=>e.id===B):void 0,O=P&&'new'!==P?f.find(e=>e.id===P)??null:null,H=e=>k(s=>s.includes(e)?s.filter(s=>s!==e):[...s,e]);return(0,p.jsxs)(l.default,{testID:"recipe-cards",style:{gap:12},children:['read'===d?(0,p.jsx)(a.Banner,{kind:"info",title:"Read-only",children:"Signed-off recipe cards only. The head chef keeps these up to date."}):(0,p.jsx)(a.Muted,{children:(0,h.canSignOffCards)(n.role)?'You can add, edit and sign off cards. A card only goes live once you sign it off; any edit sets it back to Awaiting sign-off.':'You can add and edit cards. The head chef signs them off before they go live; any edit sets a card back to Awaiting sign-off.'}),f.some(e=>'example'===e.origin)?(0,p.jsx)(a.Banner,{kind:"example",title:"Example data",children:"Cards marked \u201cExample data\u201d are made-up examples to show how recipe cards work. Replace them with your own dishes."}):null,L?(0,p.jsx)(a.Button,{testID:"new-card",label:"New recipe card",onPress:()=>R('new')}):null,(0,p.jsx)(s.TextInput,{testID:"card-search",accessibilityLabel:"Search recipe cards",value:j,onChangeText:b,placeholder:"Search dishes or ingredients",placeholderTextColor:"#7D776C",style:a.styles.input}),(0,p.jsxs)(a.Row,{gap:6,wrap:!0,children:[(0,p.jsx)(a.T,{size:r.font.small,colour:r.colours.muted,children:"Allergens:"}),(0,p.jsx)(a.Chip,{label:"Free from",selected:'free-from'===D,onPress:()=>v('free-from')}),(0,p.jsx)(a.Chip,{label:"Contains",selected:'contains'===D,onPress:()=>v('contains')}),C.length?(0,p.jsx)(a.Chip,{label:"Clear",onPress:()=>k([])}):null]}),(0,p.jsx)(a.Row,{gap:6,wrap:!0,children:c.ALLERGENS.map(e=>(0,p.jsx)(i.default,{testID:`filter-${e.id}`,accessibilityRole:"button",accessibilityState:{selected:C.includes(e.id)},onPress:()=>H(e.id),style:{paddingVertical:5,paddingHorizontal:10,minHeight:44,minWidth:44,justifyContent:'center',borderRadius:14,borderWidth:1,borderColor:C.includes(e.id)?r.colours.gold:r.colours.border,backgroundColor:C.includes(e.id)?r.colours.gold:'transparent'},children:(0,p.jsx)(a.T,{size:13,colour:C.includes(e.id)?r.colours.onGold:r.colours.text,children:e.short})},e.id))}),L?(0,p.jsxs)(a.Row,{gap:6,wrap:!0,children:[(0,p.jsx)(a.Chip,{label:`All (${f.length})`,selected:'all'===T,onPress:()=>S('all')}),(0,p.jsx)(a.Chip,{label:`Awaiting sign-off (${E})`,selected:'awaiting'===T,onPress:()=>S('awaiting')}),(0,p.jsx)(a.Chip,{label:`Signed off (${f.length-E})`,selected:'signed-off'===T,onPress:()=>S('signed-off')})]}):null,(0,p.jsx)(l.default,{testID:"card-count",children:(0,p.jsxs)(a.Muted,{children:[M.length," ",1===M.length?'card':'cards',C.length?` ${'free-from'===D?'free from':'containing'} ${C.map(c.allergenLabel).join('free-from'===D?' and ':' or ')}`:'']})}),M.map(e=>(0,p.jsx)(i.default,{testID:`card-${e.menuItemId}`,accessibilityRole:"button",accessibilityLabel:`${e.dish}, ${e.signOff?'signed off':'awaiting sign-off'}`,onPress:()=>$(e.id),children:(0,p.jsx)(a.Card,{highlight:!e.signOff&&L?r.colours.amber:void 0,children:(0,p.jsxs)(a.Row,{gap:12,style:{alignItems:'flex-start'},children:[(0,p.jsx)(l.default,{style:{width:84},children:(0,p.jsx)(y,{card:e,height:64})}),(0,p.jsxs)(l.default,{style:{flex:1,gap:4},children:[(0,p.jsx)(a.T,{weight:"semibold",children:e.dish}),(0,p.jsxs)(a.Muted,{children:[e.section," \xb7 ",x(e.price),'example'===e.origin?` \xb7 ${u.EXAMPLE_TAG}`:'']}),(0,p.jsxs)(a.Row,{gap:4,wrap:!0,children:[e.signOff?(0,p.jsx)(a.Badge,{label:`\u2713 ${m(e.signOff.at)}`,kind:"ok"}):(0,p.jsx)(a.Badge,{label:h.STATE_LABEL.awaiting,kind:"amber"}),c.ALLERGENS.filter(s=>e.allergens[s.id]).map(s=>(0,p.jsx)(a.Badge,{label:'may'===e.allergens[s.id]?`${s.short}?`:s.short,kind:'may'===e.allergens[s.id]?'amber':'red'},s.id))]})]})]})})},e.id)),M.length?null:(0,p.jsx)(a.Muted,{children:"No cards match."}),(0,p.jsx)(a.Sheet,{visible:!!N&&!P,onClose:()=>$(null),title:N?.dish??'',maxWidth:640,testID:"card-sheet",children:N?(0,p.jsx)(w,{card:N,actor:'read'===d?{...n,role:'staff'}:n,onEdit:L?()=>R(N.id):void 0}):null}),(0,p.jsx)(a.Sheet,{visible:!!P,onClose:()=>R(null),title:'new'===P?'New recipe card':`Edit: ${O?.dish??''}`,maxWidth:680,testID:"editor-sheet",children:P?(0,p.jsx)(I,{rid:e,card:O,actor:n,onDone:e=>{R(null),$(e)}},P):null})]})};var s=_r(_d[0]),t=_r(_d[1]),n=e(_r(_d[2])),i=e(_r(_d[3])),l=e(_r(_d[4])),r=_r(_d[5]),a=_r(_d[6]),o=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),u=_r(_d[11]),f=_r(_d[12]),p=_r(_d[13]);const m=e=>{const s=new Date(e.length<=10?`${e}T12:00:00`:e);return isNaN(+s)?e:s.toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric'})},x=e=>null==e?'Price on the board':`\xa3${(e/100).toFixed(2)}`,j={example:u.EXAMPLE_TAG,imported:'Imported from the menu',new:null};function b({card:e,testID:s}){return e.signOff?(0,p.jsxs)(l.default,{testID:s,style:{gap:2},children:[(0,p.jsx)(a.Badge,{label:`\u2713 ${h.STATE_LABEL['signed-off']}`,kind:"ok"}),(0,p.jsxs)(a.T,{size:r.font.small,colour:r.colours.ok,children:["Signed off by ",e.signOff.by," on ",m(e.signOff.at)]})]}):(0,p.jsxs)(l.default,{testID:s,style:{gap:2},children:[(0,p.jsx)(a.Badge,{label:h.STATE_LABEL.awaiting,kind:"amber"}),(0,p.jsx)(a.T,{size:r.font.small,colour:r.colours.amber,children:e.wasLive?'Edited since the last sign-off. The dish shows "awaiting allergen sign-off" to guests and cannot be ordered until the head chef signs it off.':'New dish: it stays off the menu until the head chef signs it off.'})]})}function y({card:e,height:s=180,pending:t}){const i=t?{uri:t}:e.photo?(0,d.recipeCards)().photoSource(e.photo):null;return i?(0,p.jsx)(n.default,{testID:"card-photo",accessibilityLabel:`Plating photo: ${e.dish}`,source:i,style:{width:'100%',height:s,borderRadius:12,backgroundColor:r.colours.surface2},resizeMode:"cover"}):(0,p.jsx)(l.default,{style:{height:s,borderRadius:12,backgroundColor:r.colours.surface2,alignItems:'center',justifyContent:'center',borderWidth:1,borderColor:r.colours.border},children:(0,p.jsx)(a.Muted,{children:"No plating photo yet"})})}function C({map:e}){const s=c.ALLERGENS.filter(s=>e[s.id]).map(e=>e.id);return s.length?(0,p.jsx)(a.Row,{wrap:!0,gap:6,children:s.map(s=>(0,p.jsx)(a.Badge,{label:'may'===e[s]?`May contain ${(0,c.allergenLabel)(s).toLowerCase()}`:(0,c.allergenLabel)(s),kind:'may'===e[s]?'amber':'red'},s))}):(0,p.jsx)(a.Muted,{children:"None of the UK 14 allergens."})}function w({card:e,actor:s,onEdit:n}){const[i,o]=(0,t.useState)(null),c=(0,h.signOffBlock)(e),u=j[e.origin];return(0,p.jsxs)(l.default,{testID:"card-view",style:{gap:12},children:[(0,p.jsx)(y,{card:e,height:200}),(0,p.jsxs)(a.Row,{wrap:!0,gap:6,children:[u?(0,p.jsx)(a.Badge,{label:u,kind:'example'===e.origin?'blue':'neutral'}):null,(0,p.jsx)(a.Badge,{label:e.section,kind:"gold"}),(0,p.jsx)(a.Badge,{label:x(e.price)})]}),(0,p.jsx)(b,{card:e,testID:"card-status"}),(0,p.jsx)(a.Divider,{}),(0,p.jsx)(a.H2,{children:"Allergens"}),(0,p.jsx)(l.default,{testID:"card-allergens",children:(0,p.jsx)(C,{map:e.allergens})}),e.allergenNotes?(0,p.jsx)(a.Muted,{children:e.allergenNotes}):null,e.allergensConfirmed?(0,p.jsxs)(a.Muted,{children:["Allergen list confirmed by ",e.allergensConfirmed.by," on ",m(e.allergensConfirmed.at),"."]}):null,(0,p.jsx)(a.Divider,{}),(0,p.jsx)(a.H2,{children:"Ingredients"}),e.ingredients.length?e.ingredients.map(e=>(0,p.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(a.T,{style:{flex:1},children:e.name}),(0,p.jsx)(a.T,{colour:r.colours.goldLight,children:[e.qty,e.unit].filter(Boolean).join(' ')})]},e.id)):(0,p.jsx)(a.Muted,{children:"No ingredients on this card yet."}),(0,p.jsx)(a.Divider,{}),(0,p.jsx)(a.H2,{children:"Method"}),e.steps.length?e.steps.map((e,s)=>(0,p.jsxs)(a.Row,{gap:10,style:{alignItems:'flex-start'},children:[(0,p.jsx)(l.default,{style:{width:26,height:26,borderRadius:13,backgroundColor:r.colours.goldTint,alignItems:'center',justifyContent:'center'},children:(0,p.jsx)(a.T,{size:r.font.small,colour:r.colours.gold,children:s+1})}),(0,p.jsx)(a.T,{style:{flex:1},children:e})]},s)):(0,p.jsxs)(a.Muted,{children:["No method yet.",(0,h.canEditCards)(s.role)?' Tap Edit to add the steps.':'']}),(0,p.jsxs)(a.Muted,{children:["Version ",e.version," \xb7 last changed ",m(e.updatedAt)," by ",e.updatedBy]}),(0,h.canEditCards)(s.role)&&n?(0,p.jsx)(a.Button,{testID:"edit-card",kind:"secondary",label:"Edit card",onPress:n}):null,(0,h.canSignOffCards)(s.role)&&!e.signOff?(0,p.jsxs)(l.default,{style:{gap:6},children:[c?(0,p.jsx)(a.Banner,{kind:"warn",title:"Not ready to sign off",children:c}):null,(0,p.jsx)(a.Button,{testID:"sign-off",kind:"success",label:`Sign off as ${s.name}`,disabled:!!c,onPress:async()=>{try{await(0,d.recipeCards)().signOff(e.id,s),o(null)}catch(e){o(e?.message??'Could not sign off.')}}})]}):null,!(0,h.canEditCards)(s.role)||(0,h.canSignOffCards)(s.role)||e.signOff?null:(0,p.jsx)(a.Banner,{kind:"info",title:"Head chef sign-off",children:"Only the head chef can sign off a recipe card, in the Head Chef app."}),i?(0,p.jsx)(a.Banner,{kind:"danger",children:i}):null]})}const k=()=>`i-${Math.random().toString(36).slice(2,9)}`,D=(e,s)=>e?{id:e.id,dish:e.dish,section:e.section,price:null==e.price?'':(e.price/100).toFixed(2),description:'',ingredients:e.ingredients.map(e=>({...e})),steps:[...e.steps],allergens:{...e.allergens},dismissed:[...e.dismissed],allergenNotes:e.allergenNotes??'',photo:e.photo,pending:null,confirm:!!e.allergensConfirmed}:{id:(0,h.uuid)(),dish:'',section:s,price:'',description:'',ingredients:[{id:k(),name:'',qty:'',unit:''}],steps:[''],allergens:{},dismissed:[],allergenNotes:'',pending:null,confirm:!1},v=e=>{const s=e.replace(/[\xa3\s]/g,'');if(!s)return null;const t=Number(s);return isFinite(t)&&t>=0?Math.round(100*t):'bad'};function I({rid:e,card:n,actor:u,onDone:m}){const x=(0,o.useRestaurant)(e),j=x?.sections??['Mains'],[b,C]=(0,t.useState)(()=>D(n,j[0]??'Mains')),[w,I]=(0,t.useState)(null),[T,S]=(0,t.useState)(null),[B,$]=(0,t.useState)(!1),P=e=>C(s=>({...s,...e})),R=b.ingredients.filter(e=>e.name.trim()),L={ingredients:R,allergens:b.allergens,dismissed:b.dismissed},A=(0,h.suggestAllergens)(R),M=(0,h.unresolved)(L),E=e=>{const s=b.allergens[e],t={...b.allergens};s?'contains'===s?t[e]='may':delete t[e]:t[e]='contains',P({allergens:t,dismissed:b.dismissed.filter(s=>s!==e),confirm:!1})},N=e=>{const s={...b.allergens};delete s[e],P({allergens:s,dismissed:[...new Set([...b.dismissed,e])],confirm:!1})},O=(e,s)=>P({ingredients:b.ingredients.map((t,n)=>n===e?{...t,...s}:t),confirm:!1}),H=(e,s)=>P({steps:b.steps.map((t,n)=>n===e?s:t)}),F=(e,s)=>{const t=[...b.steps],n=e+s;n<0||n>=t.length||([t[e],t[n]]=[t[n],t[e]],P({steps:t}))},_=async e=>{S(null);try{const s=await(0,f.capturePlatingPhoto)(e);s&&(P({pending:s}),S(`Compressed on this device: ${s.width}\xd7${s.height}, ${(0,f.kb)(s.bytes)}${s.originalBytes?` (was ${(0,f.kb)(s.originalBytes)})`:''}.`))}catch(e){S(e?.message??'Could not read that photo.')}},[z,W]=(0,t.useState)(!1),G=n??{id:b.id,dish:b.dish,photo:b.photo};return(0,p.jsxs)(l.default,{testID:"card-editor",style:{gap:12},children:[n?.signOff?(0,p.jsx)(a.Banner,{kind:"warn",title:"Saving a change resets the sign-off",children:"This card is signed off. Any change you save sets it back to \"Awaiting sign-off\" until the head chef signs it off again."}):null,(0,p.jsx)(a.Field,{testID:"dish-name",label:"Dish name",value:b.dish,onChangeText:e=>P({dish:e}),placeholder:"e.g. Cullen skink"}),n?null:(0,p.jsx)(a.Field,{testID:"dish-description",label:"Menu description (optional)",value:b.description,onChangeText:e=>P({description:e}),placeholder:"What guests read on the menu"}),(0,p.jsx)(a.T,{size:r.font.small,weight:"medium",colour:r.colours.muted,children:"Menu section"}),(0,p.jsx)(a.Row,{wrap:!0,gap:6,children:j.map(e=>(0,p.jsx)(a.Chip,{label:e,selected:b.section===e,onPress:()=>P({section:e})},e))}),(0,p.jsx)(a.Field,{testID:"dish-price",label:"Price (\xa3)",value:b.price,onChangeText:e=>P({price:e}),placeholder:"Blank = price on the board",keyboardType:"decimal-pad"}),(0,p.jsx)(a.Divider,{}),(0,p.jsx)(a.H2,{children:"Plating photo"}),(0,p.jsx)(y,{card:G,pending:b.pending?.dataUrl??null,height:170}),(0,p.jsxs)(a.Row,{gap:8,wrap:!0,children:[(0,p.jsx)(a.Button,{testID:"photo-camera",small:!0,kind:"secondary",label:b.pending||b.photo?'Retake photo':'Take photo',onPress:()=>_('camera')}),(0,p.jsx)(a.Button,{testID:"photo-library",small:!0,kind:"secondary",label:b.pending||b.photo?'Replace photo':'Choose photo',onPress:()=>_('library')}),b.pending||b.photo?(0,p.jsx)(a.Button,{testID:"photo-remove",small:!0,kind:"ghost",label:"Remove photo",onPress:()=>P({pending:null,photo:void 0})}):null]}),T?(0,p.jsx)(l.default,{testID:"photo-info",children:(0,p.jsx)(a.Muted,{children:T})}):(0,p.jsx)(a.Muted,{children:'shared'===(0,d.recipeCards)().mode?'Photos are shrunk on this device, then shared with the team. Staff and guests only see the photo once the card is signed off.':'Photos are shrunk on this device before they are saved.'}),(0,p.jsx)(a.Divider,{}),(0,p.jsx)(a.H2,{children:"Ingredients"}),(0,p.jsx)(a.Muted,{children:"Quantity, unit and ingredient. We suggest allergens from the ingredient names."}),b.ingredients.map((e,t)=>{const n=e.name.trim()?(0,h.suggestAllergens)([e]):[];return(0,p.jsxs)(l.default,{style:{gap:4},children:[(0,p.jsxs)(a.Row,{gap:6,children:[(0,p.jsx)(s.TextInput,{testID:`ing-qty-${t}`,accessibilityLabel:`Quantity ${t+1}`,value:e.qty,onChangeText:e=>O(t,{qty:e}),placeholder:"Qty",placeholderTextColor:"#7D776C",style:[a.styles.input,{width:64}]}),(0,p.jsx)(s.TextInput,{testID:`ing-unit-${t}`,accessibilityLabel:`Unit ${t+1}`,value:e.unit,onChangeText:e=>O(t,{unit:e}),placeholder:"g / ml / each",placeholderTextColor:"#7D776C",style:[a.styles.input,{width:92}]}),(0,p.jsx)(s.TextInput,{testID:`ing-name-${t}`,accessibilityLabel:`Ingredient ${t+1}`,value:e.name,onChangeText:e=>O(t,{name:e}),placeholder:"Ingredient",placeholderTextColor:"#7D776C",style:[a.styles.input,{flex:1}]}),(0,p.jsx)(i.default,{accessibilityLabel:`Remove ingredient ${t+1}`,onPress:()=>P({ingredients:b.ingredients.filter((e,s)=>s!==t)}),hitSlop:8,children:(0,p.jsx)(a.T,{colour:r.colours.muted,children:"\u2715"})})]}),n.length?(0,p.jsxs)(a.Muted,{children:["Suggests: ",n.map(c.allergenLabel).join(', ')]}):null]},e.id)}),(0,p.jsx)(a.Button,{testID:"ing-add",small:!0,kind:"ghost",label:"Add ingredient",onPress:()=>P({ingredients:[...b.ingredients,{id:k(),name:'',qty:'',unit:''}]})}),(0,p.jsx)(a.Divider,{}),(0,p.jsx)(a.H2,{children:"Method"}),b.steps.map((e,t)=>(0,p.jsxs)(a.Row,{gap:6,style:{alignItems:'flex-start'},children:[(0,p.jsx)(a.T,{colour:r.colours.gold,style:{width:20,paddingTop:10},children:t+1}),(0,p.jsx)(s.TextInput,{testID:`step-${t}`,accessibilityLabel:`Step ${t+1}`,value:e,onChangeText:e=>H(t,e),multiline:!0,placeholder:"Describe this step",placeholderTextColor:"#7D776C",style:[a.styles.input,{flex:1,minHeight:56,textAlignVertical:'top'}]}),(0,p.jsxs)(l.default,{style:{gap:4},children:[(0,p.jsx)(i.default,{accessibilityLabel:`Move step ${t+1} up`,onPress:()=>F(t,-1),hitSlop:6,children:(0,p.jsx)(a.T,{colour:r.colours.muted,children:"\u25b2"})}),(0,p.jsx)(i.default,{accessibilityLabel:`Move step ${t+1} down`,onPress:()=>F(t,1),hitSlop:6,children:(0,p.jsx)(a.T,{colour:r.colours.muted,children:"\u25bc"})}),(0,p.jsx)(i.default,{accessibilityLabel:`Remove step ${t+1}`,onPress:()=>P({steps:b.steps.filter((e,s)=>s!==t)}),hitSlop:6,children:(0,p.jsx)(a.T,{colour:r.colours.muted,children:"\u2715"})})]})]},t)),(0,p.jsx)(a.Button,{testID:"step-add",small:!0,kind:"ghost",label:"Add step",onPress:()=>P({steps:[...b.steps,'']})}),(0,p.jsx)(a.Divider,{}),(0,p.jsx)(a.H2,{children:"Allergens (UK 14)"}),(0,p.jsx)(a.Muted,{children:"Tap to cycle: contains \u2192 may contain \u2192 none. Suggested allergens are marked \u201c?\u201d until you add or rule them out."}),M.length?(0,p.jsxs)(l.default,{testID:"allergen-suggestions",style:{gap:6},children:[(0,p.jsx)(a.Banner,{kind:"warn",title:`Check ${M.length} suggested allergen${1===M.length?'':'s'}`,children:M.map(e=>`${(0,c.allergenLabel)(e)} (from ${(0,h.suggestedBy)(R,e).join(', ')})`).join('; ')}),M.map(e=>(0,p.jsxs)(a.Row,{gap:6,wrap:!0,children:[(0,p.jsx)(a.T,{style:{flex:1},children:(0,c.allergenLabel)(e)}),(0,p.jsx)(a.Button,{testID:`suggest-add-${e}`,small:!0,label:"Contains",onPress:()=>P({allergens:{...b.allergens,[e]:'contains'},confirm:!1})}),(0,p.jsx)(a.Button,{testID:`suggest-may-${e}`,small:!0,kind:"secondary",label:"May contain",onPress:()=>P({allergens:{...b.allergens,[e]:'may'},confirm:!1})}),(0,p.jsx)(a.Button,{testID:`suggest-dismiss-${e}`,small:!0,kind:"ghost",label:"Not in this dish",onPress:()=>N(e)})]},e)),(0,p.jsx)(a.Button,{testID:"apply-suggestions",small:!0,kind:"secondary",label:"Add all suggestions as \u2018contains\u2019",onPress:()=>{const e={...b.allergens};M.forEach(s=>{e[s]='contains'}),P({allergens:e,confirm:!1})}})]}):null,(0,p.jsx)(a.Row,{wrap:!0,gap:6,children:c.ALLERGENS.map(e=>{const s=b.allergens[e.id],t=A.includes(e.id)&&!s&&!b.dismissed.includes(e.id),n='contains'===s?r.colours.redBg:'may'===s?r.colours.amberBg:r.colours.surface2,l='contains'===s?r.colours.red:'may'===s?r.colours.amber:t?r.colours.gold:r.colours.border;return(0,p.jsx)(i.default,{testID:`allergen-${e.id}`,accessibilityRole:"button",accessibilityLabel:`${e.short}: ${'contains'===s?'contains':'may'===s?'may contain':'not marked'}`,onPress:()=>E(e.id),style:{paddingVertical:6,paddingHorizontal:10,borderRadius:16,borderWidth:t?2:1,borderStyle:t?'dashed':'solid',borderColor:l,backgroundColor:n},children:(0,p.jsxs)(a.T,{size:r.font.small,colour:'contains'===s?'#FFD9D4':'may'===s?'#FFE2A8':r.colours.text,children:[e.short,'may'===s?' (may)':'',t?' ?':'']})},e.id)})}),b.dismissed.length?(0,p.jsxs)(a.Muted,{children:["Ruled out: ",b.dismissed.map(c.allergenLabel).join(', ')]}):null,(0,p.jsx)(a.Field,{testID:"allergen-notes",label:"Allergen notes (optional)",value:b.allergenNotes,onChangeText:e=>P({allergenNotes:e}),placeholder:"e.g. Cooked in the shared fryer"}),(0,p.jsxs)(i.default,{testID:"confirm-allergens",accessibilityRole:"checkbox",accessibilityState:{checked:b.confirm,disabled:M.length>0},disabled:M.length>0,onPress:()=>P({confirm:!b.confirm}),style:{flexDirection:'row',gap:10,alignItems:'center',padding:10,borderRadius:10,borderWidth:1,borderColor:b.confirm?r.colours.ok:r.colours.border,opacity:M.length?.5:1},children:[(0,p.jsx)(l.default,{style:{width:22,height:22,borderRadius:4,borderWidth:2,borderColor:b.confirm?r.colours.ok:r.colours.muted,alignItems:'center',justifyContent:'center',backgroundColor:b.confirm?r.colours.okBg:'transparent'},children:b.confirm?(0,p.jsx)(a.T,{colour:r.colours.ok,children:"\u2713"}):null}),(0,p.jsx)(a.T,{style:{flex:1},children:M.length?'Check the suggested allergens above first':`I have checked the allergen list against the ingredients (${u.name})`})]}),w?(0,p.jsx)(a.Banner,{kind:"danger",children:w}):null,(0,p.jsx)(a.Button,{testID:"card-save",label:z?'Saving\u2026':n?'Save changes':'Save card',disabled:z,onPress:async()=>{I(null);const s=v(b.price);if(!b.dish.trim())return I('Give the dish a name.');if('bad'===s)return I('Price should be in pounds, e.g. 14.50 (or leave it blank for "price on the board").');const t=(0,d.recipeCards)();W(!0);try{let i=b.photo;b.pending&&(i=await t.savePhoto(e,b.id,b.pending));const l=b.steps.map(e=>e.trim()).filter(Boolean),r={dish:b.dish.trim(),section:b.section,price:s,ingredients:R.map(e=>({...e,name:e.name.trim(),qty:e.qty.trim(),unit:e.unit.trim()})),steps:l,allergens:b.allergens,dismissed:b.dismissed,allergenNotes:b.allergenNotes.trim()||void 0,photo:i};if(n)await t.update(n.id,{...r,confirmAllergens:b.confirm},u),m(n.id);else{const s=await t.create(e,{...r,id:b.id,description:b.description.trim()||void 0},u);b.confirm&&await t.update(s.id,{confirmAllergens:!0},u),m(s.id)}}catch(e){I(e?.message??'Could not save the card.')}finally{W(!1)}}}),(0,p.jsx)(a.Muted,{children:(0,h.canSignOffCards)(u.role)?'After saving, sign the card off so it goes live.':'After saving, the head chef signs it off in the Head Chef app before it goes live.'}),n?B?(0,p.jsxs)(a.Row,{gap:8,children:[(0,p.jsx)(a.Button,{testID:"card-delete-yes",small:!0,kind:"danger",label:"Yes, remove this dish",onPress:async()=>{if(n)try{await(0,d.recipeCards)().remove(n.id,u),m(null)}catch(e){I(e?.message??'Could not remove the card.')}}}),(0,p.jsx)(a.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>$(!1)})]}):(0,p.jsx)(a.Button,{testID:"card-delete",small:!0,kind:"ghost",label:"Remove card and dish from the menu",onPress:()=>$(!0)}):null]})}},997,[877,30,196,263,127,821,813,819,831,814,1104,1142,1294,24]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useHrSettings",{enumerable:!0,get:function(){return f}}),_e.MoraleScale=b,_e.StaffingSlider=j,_e.ShiftCheckout=function({rid:e,shiftKey:o,day:a,meId:d,onClose:y}){const w=f(e),S=w.wording,k=(0,i.useOwner)(e=>e.staff),C=(0,i.useOwner)(e=>e.attendance),[v,T]=(0,s.useState)(null),[R,M]=(0,s.useState)(null),[I,D]=(0,s.useState)(''),[H,L]=(0,s.useState)('up'),[z,P]=(0,s.useState)(null),[W,A]=(0,s.useState)(''),[q,B]=(0,s.useState)(null),[N,E]=(0,s.useState)(!1),$=(0,s.useMemo)(()=>{const e=new Set(C.filter(e=>e.date===a&&e.staffId!==d).map(e=>e.staffId)),t=k.filter(e=>e.active&&e.id!==d&&!e.temp);return[...t.filter(t=>e.has(t.id)),...t.filter(t=>!e.has(t.id))].slice(0,14)},[k,C,a,d]),O=()=>{u.useHr.getState().skip(e,o),y()};return(0,c.jsx)(n.Sheet,{visible:!0,onClose:O,title:"How was today?",testID:"hr-checkout",children:N?(0,c.jsxs)(l.default,{testID:"hr-checkout-thanks",style:{gap:6,paddingVertical:10},children:[(0,c.jsx)(n.T,{size:18,weight:"semibold",colour:r.colours.goldLight,center:!0,children:"Thanks. Sent anonymously."}),(0,c.jsx)(n.Muted,{center:!0,children:"Have a good evening."})]}):(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(n.Muted,{size:13,children:S.intro}),(0,c.jsxs)(l.default,{style:{gap:8},children:[(0,c.jsx)(n.T,{weight:"semibold",children:S.morale}),(0,c.jsx)(b,{value:v,onChange:T,w:S})]}),(0,c.jsxs)(l.default,{style:{gap:8},children:[(0,c.jsx)(n.T,{weight:"semibold",children:S.staffing}),(0,c.jsx)(j,{value:R,onChange:M,w:S})]}),w.askQuestion||w.askShout?(0,c.jsxs)(n.Row,{wrap:!0,gap:6,children:[w.askQuestion?(0,c.jsx)(n.Chip,{testID:"hr-more-question",label:"\uff0b Ask the team a question",selected:'q'===q,onPress:()=>B('q'===q?null:'q')}):null,w.askShout?(0,c.jsx)(n.Chip,{testID:"hr-more-shout",label:"\uff0b Shout out a teammate",selected:'shout'===q,onPress:()=>B('shout'===q?null:'shout')}):null]}):null,'q'===q&&w.askQuestion?(0,c.jsxs)(l.default,{style:{gap:6},children:[(0,c.jsxs)(n.Muted,{size:13,children:[S.question," Optional."]}),(0,c.jsx)(t.TextInput,{testID:"hr-question",accessibilityLabel:"Your question",value:I,onChangeText:D,maxLength:280,multiline:!0,placeholder:"e.g. Could we start staff meals earlier?",placeholderTextColor:r.colours.muted,style:[x,{minHeight:64}]}),(0,c.jsxs)(n.Row,{wrap:!0,gap:6,children:[(0,c.jsx)(n.Chip,{label:"Vote up",selected:'up'===H,onPress:()=>L('up')}),(0,c.jsx)(n.Chip,{label:"Yes / No",selected:'yesno'===H,onPress:()=>L('yesno')})]})]}):null,'shout'===q&&w.askShout?(0,c.jsxs)(l.default,{style:{gap:6},children:[(0,c.jsxs)(n.Muted,{size:13,children:[S.shout," Optional. Your name isn\u2019t shown."]}),(0,c.jsx)(n.Row,{wrap:!0,gap:6,children:$.map(e=>(0,c.jsx)(n.Chip,{testID:`hr-shout-${e.id}`,label:p(e.nickname||e.name).split(' ')[0],selected:z===p(e.nickname||e.name).split(' ')[0],onPress:()=>{const t=p(e.nickname||e.name).split(' ')[0];P(z===t?null:t)}},e.id))}),z?(0,c.jsx)(t.TextInput,{testID:"hr-shout-note",accessibilityLabel:"What for (optional)",value:W,onChangeText:A,maxLength:140,placeholder:"What for? (optional)",placeholderTextColor:r.colours.muted,style:x}):null]}):null,(0,c.jsxs)(n.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(n.Button,{testID:"hr-checkout-send",label:"Send anonymously",disabled:null==v&&null==R,onPress:()=>{u.useHr.getState().submit({rid:e,shiftKey:o,day:a,morale:v??3,staffing:R,question:w.askQuestion&&I.trim()?I:void 0,kind:H,shoutTo:w.askShout&&z?z:void 0,shoutBody:W||void 0}),E(!0),setTimeout(y,2400)},style:{flexGrow:1}}),(0,c.jsx)(n.Button,{testID:"hr-checkout-skip",kind:"ghost",label:"Skip",onPress:O})]}),(0,c.jsxs)(n.Muted,{size:12,children:["No name, no staff number and no clock time is saved with these answers. Managers only see a day once ",h.MIN_ANSWERS," or more people have answered."]})]})})},_e.QuestionBoard=function({rid:e,today:i,manager:a,by:d}){const p=f(e);(0,s.useEffect)(()=>{u.useHr.getState().ensure(e,i),u.hrRemote.live&&u.hrRemote.refresh&&u.hrRemote.refresh()},[e,i]);const y=(0,u.useHr)(e=>e.questions),b=(0,u.useHr)(e=>e.voted),j=(0,u.useHr)(e=>e.log),[S,k]=(0,s.useState)(''),[C,v]=(0,s.useState)('up'),[T,R]=(0,s.useState)(null),[M,I]=(0,s.useState)(null),[D,H]=(0,s.useState)(''),[L,z]=(0,s.useState)(null),[P,W]=(0,s.useState)(''),[A,q]=(0,s.useState)(!1),[B,N]=(0,s.useState)(null);(0,s.useEffect)(()=>{a&&A&&u.hrRemote.live&&u.hrRemote.log&&u.hrRemote.log(e).then(e=>N(e))},[a,A,e,j.length]);const E=(0,h.boardOrder)(y.filter(t=>t.venue===e),a),$=(B??j.filter(t=>t.venue===e)).slice(0,30);if(!p.board)return(0,c.jsx)(n.Card,{children:(0,c.jsxs)(n.Muted,{children:["The question board is switched off for this venue.",a?' Turn it on in Settings \u203a Advanced \u203a Shift check-out & question board.':'']})});return(0,c.jsxs)(l.default,{style:{gap:10},testID:"hr-board",children:[(0,c.jsx)(n.Muted,{children:"Ask anything about work. No names are shown or saved, not even to managers. Vote on what matters to you."}),(0,c.jsxs)(n.Card,{children:[(0,c.jsx)(n.T,{weight:"semibold",children:"Post a question"}),(0,c.jsx)(t.TextInput,{testID:"hr-board-input",accessibilityLabel:"Your question",value:S,onChangeText:e=>{k(e),R(null)},maxLength:280,multiline:!0,placeholder:"e.g. Can the rota go up by Thursday?",placeholderTextColor:r.colours.muted,style:[x,{minHeight:64}]}),(0,c.jsxs)(n.Row,{wrap:!0,gap:6,style:{justifyContent:'space-between'},children:[(0,c.jsxs)(n.Row,{wrap:!0,gap:6,children:[(0,c.jsx)(n.Chip,{label:"Vote up",selected:'up'===C,onPress:()=>v('up')}),(0,c.jsx)(n.Chip,{label:"Yes / No",selected:'yesno'===C,onPress:()=>v('yesno')})]}),(0,c.jsx)(n.Button,{small:!0,testID:"hr-board-post",label:"Post anonymously",disabled:!(0,h.cleanQuestion)(S),onPress:()=>{u.useHr.getState().post(e,S,C,i)?(k(''),R('Posted anonymously.')):R('Write a few more words first.')}})]}),T?(0,c.jsx)(n.Muted,{size:13,children:T}):null]}),E.length?E.map(e=>(0,c.jsx)(w,{q:e,mine:b[e.id],manager:a,onHide:()=>{I(e),H('')},onReply:()=>{z(e),W(e.reply??'')},by:d},e.id)):(0,c.jsx)(n.Muted,{center:!0,children:"No questions yet. Be the first."}),a?(0,c.jsxs)(n.Card,{children:[(0,c.jsx)(o.default,{testID:"hr-log-toggle",accessibilityRole:"button",onPress:()=>q(!A),children:(0,c.jsxs)(n.Row,{style:{justifyContent:'space-between',minHeight:44},children:[(0,c.jsx)(n.T,{weight:"semibold",style:{flex:1},children:"Moderation log"}),(0,c.jsx)(n.T,{colour:r.colours.gold,children:A?'Hide':'Show'})]})}),(0,c.jsx)(n.Muted,{size:13,children:"Every hide, unhide and reply is logged with who did it and when. Questions never show who asked."}),A?$.length?$.map(e=>(0,c.jsxs)(l.default,{testID:"hr-log-row",style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:6},children:[(0,c.jsxs)(n.T,{size:14,children:['hide'===e.action?'Hidden':'unhide'===e.action?'Shown again':'Replied'," by ",e.by]}),(0,c.jsxs)(n.Muted,{size:12,children:[new Date(e.at).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'}),e.reason?` \xb7 ${e.reason}`:'']})]},e.id)):(0,c.jsx)(n.Muted,{children:"Nothing logged yet."}):null]}):null,(0,c.jsxs)(n.Sheet,{visible:!!M,onClose:()=>I(null),title:"Hide this question?",testID:"hr-hide-sheet",children:[(0,c.jsx)(n.Muted,{children:"It disappears for staff straight away. You can show it again later. This is logged with your name."}),(0,c.jsx)(t.TextInput,{testID:"hr-hide-reason",accessibilityLabel:"Reason",value:D,onChangeText:H,maxLength:140,placeholder:"Reason, e.g. rude or names someone",placeholderTextColor:r.colours.muted,style:x}),(0,c.jsxs)(n.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(n.Button,{testID:"hr-hide-confirm",kind:"danger",label:"Hide",disabled:D.trim().length<3,onPress:()=>{M&&u.useHr.getState().moderate(M.id,'hide',D,d),I(null)}}),(0,c.jsx)(n.Button,{kind:"ghost",label:"Cancel",onPress:()=>I(null)})]})]}),(0,c.jsxs)(n.Sheet,{visible:!!L,onClose:()=>z(null),title:"Reply to the team",testID:"hr-reply-sheet",children:[L?(0,c.jsxs)(n.Muted,{children:["\u201c",L.body,"\u201d"]}):null,(0,c.jsx)(t.TextInput,{testID:"hr-reply-input",accessibilityLabel:"Your reply",value:P,onChangeText:W,maxLength:600,multiline:!0,placeholder:"Your reply, shown under the question",placeholderTextColor:r.colours.muted,style:[x,{minHeight:80}]}),(0,c.jsx)(n.Muted,{size:12,children:"Shown as \u201cReply from the managers\u201d. Your name is kept in the moderation log only."}),(0,c.jsxs)(n.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(n.Button,{testID:"hr-reply-save",label:"Post reply",disabled:!P.trim(),onPress:()=>{L&&u.useHr.getState().reply(L.id,P,d),z(null)}}),(0,c.jsx)(n.Button,{kind:"ghost",label:"Cancel",onPress:()=>z(null)})]})]})]})},_e.coversByDay=k,_e.exampleCovers=C,_e.MoraleTrend=function({rid:e,today:t}){const o=f(e).wording;(0,s.useEffect)(()=>{u.useHr.getState().ensure(e,t)},[e,t]);const[i,a]=(0,s.useState)(14),p=(0,u.useHr)(e=>e.checkins),x=(0,u.useHr)(e=>e.shouts),b=(0,d.useBookings)(e),j=(0,s.useMemo)(()=>k(b),[b]),w=e=>j[e]??(z?C(e):void 0),v=S(t,-i),[T,R]=(0,s.useState)(null),[M,I]=(0,s.useState)(null);(0,s.useEffect)(()=>{let s=!0;return u.hrRemote.live&&u.hrRemote.trend&&u.hrRemote.trend(e,v,t).then(e=>{s&&R(e)}),u.hrRemote.live&&u.hrRemote.shouts&&u.hrRemote.shouts(e,S(t,-30)).then(e=>{s&&I(e)}),()=>{s=!1}},[e,v,t]);const D=(0,s.useMemo)(()=>(0,h.dayResults)(p.filter(s=>s.venue===e&&s.day>=v&&s.day<=t)),[p,e,v,t]),H=u.hrRemote.live,L=H?T??[]:D.shown,z=!H&&p.some(t=>t.venue===e&&t.example),P=(H?M??[]:x.filter(t=>t.venue===e)).slice().sort((e,t)=>t.day.localeCompare(e.day)).slice(0,8),W=L.length?Math.round(L.reduce((e,t)=>e+t.morale,0)/L.length*10)/10:null,A=Array.from({length:i},(e,s)=>S(t,1-i+s)),q=new Map(L.map(e=>[e.day,e]));return(0,c.jsxs)(l.default,{style:{gap:10},testID:"hr-trend",children:[(0,c.jsxs)(n.Muted,{children:["From the anonymous check-out when people clock out. A day only shows once ",h.MIN_ANSWERS," or more people have answered."]}),z?(0,c.jsx)(n.Banner,{kind:"example",title:"Example answers",children:"These are made-up answers so you can see how it looks. Real answers replace them once your team is signed in."}):null,(0,c.jsx)(n.Row,{wrap:!0,gap:6,children:[14,28,56].map(e=>(0,c.jsx)(n.Chip,{label:14===e?'2 weeks':28===e?'4 weeks':'8 weeks',selected:i===e,onPress:()=>a(e)},e))}),(0,c.jsxs)(n.Card,{children:[(0,c.jsxs)(n.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,c.jsx)(n.T,{weight:"semibold",style:{flexShrink:1},children:"Team morale"}),null!=W?(0,c.jsx)(n.Badge,{kind:"gold",label:`AVERAGE ${W} \xb7 ${(0,h.moraleWord)(Math.round(W),o).toUpperCase()}`}):null]}),(0,c.jsx)(l.default,{testID:"hr-trend-chart",accessibilityLabel:`Morale over the last ${i} days`,style:{height:110,flexDirection:'row',alignItems:'flex-end',gap:i>30?1:3,borderBottomWidth:1,borderColor:r.colours.border},children:A.map(e=>{const t=q.get(e);return(0,c.jsx)(l.default,{style:{flex:1,minWidth:0,height:'100%',justifyContent:'flex-end',alignItems:'center'},children:t?(0,c.jsx)(l.default,{style:{width:'100%',maxWidth:22,height:t.morale/5*100+"%",borderTopLeftRadius:4,borderTopRightRadius:4,backgroundColor:t.morale<2.5?r.colours.amber:r.colours.gold}}):(0,c.jsx)(l.default,{style:{width:4,height:4,borderRadius:2,backgroundColor:r.colours.border,marginBottom:2}})},e)})}),(0,c.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(n.Muted,{size:12,children:y(A[0])}),(0,c.jsx)(n.Muted,{size:12,children:y(A[A.length-1])})]}),(0,c.jsxs)(n.Muted,{size:12,children:["Bar height: average morale (1 low to 5 high). Amber: below 2.5. A dot: fewer than ",h.MIN_ANSWERS," answers or none."]})]}),(0,c.jsxs)(n.Card,{children:[(0,c.jsx)(n.T,{weight:"semibold",children:"Staffing vs covers, night by night"}),L.length?L.slice().reverse().map(e=>(0,c.jsxs)(l.default,{testID:"hr-trend-row",style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:8,gap:4},children:[(0,c.jsxs)(n.Row,{style:{justifyContent:'space-between'},gap:6,wrap:!0,children:[(0,c.jsx)(n.T,{weight:"semibold",style:{flexShrink:1},children:y(e.day)}),(0,c.jsx)(n.T,{size:14,colour:r.colours.goldLight,style:{flexShrink:1},children:null!=w(e.day)?`${w(e.day)} covers`:'No bookings'})]}),(0,c.jsxs)(n.Row,{gap:8,style:{alignItems:'center'},children:[(0,c.jsxs)(l.default,{style:{flex:1,minWidth:60,height:6,borderRadius:3,backgroundColor:r.colours.border},children:[null!=e.staffing?(0,c.jsx)(l.default,{style:{position:'absolute',left:`${e.staffing}%`,marginLeft:-6,top:-3,width:12,height:12,borderRadius:6,backgroundColor:r.colours.gold}}):null,(0,c.jsx)(l.default,{style:{position:'absolute',left:'50%',marginLeft:-1,top:-4,width:2,height:14,backgroundColor:r.colours.goldMuted}})]}),(0,c.jsx)(n.T,{size:13,style:{flexShrink:1,maxWidth:'55%'},children:null!=e.staffing?(0,h.staffingWord)(e.staffing,o):'\u2014'})]}),(0,c.jsxs)(n.Muted,{size:12,children:["Morale ",e.morale," \xb7 ",e.answers," answers \xb7 ",e.short," said short, ",e.perfect," perfect, ",e.over," over"]})]},e.day)):(0,c.jsxs)(n.Muted,{children:["No days with ",h.MIN_ANSWERS," or more answers yet."]}),!H&&D.held?(0,c.jsxs)(n.Muted,{size:12,children:[D.held," day",1===D.held?'':'s'," held back (fewer than ",h.MIN_ANSWERS," answers)."]}):null,(0,c.jsx)(n.Muted,{size:12,children:"Covers come from that day\u2019s bookings (cancelled and no-shows left out)."})]}),(0,c.jsxs)(n.Card,{children:[(0,c.jsx)(n.T,{weight:"semibold",children:"Shout-outs"}),P.length?P.map(e=>(0,c.jsxs)(l.default,{testID:"hr-shout-row",style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:6},children:[(0,c.jsxs)(n.T,{size:14,children:[(0,c.jsx)(n.T,{size:14,weight:"semibold",colour:r.colours.goldLight,children:e.to}),e.body?`: ${e.body}`:'']}),(0,c.jsxs)(n.Muted,{size:12,children:[y(e.day)," \xb7 from a teammate"]})]},e.id)):(0,c.jsx)(n.Muted,{children:"No shout-outs yet."})]})]})},_e.HrSettingsCard=function({rid:e}){const o=(0,a.useStore)(t=>t.restaurants.find(t=>t.id===e)?.settings?.hr),i=(0,h.hrSettingsOf)(o),d=t=>a.useStore.getState().updateSettings(e,{hr:{...i,...t}}),[u,f]=(0,s.useState)({});return(0,c.jsxs)(l.default,{style:{gap:8},testID:"hr-settings",children:[(0,c.jsx)(n.Toggle,{testID:"hr-set-on",label:"Ask a quick check-out when people clock out",value:i.on,onChange:e=>d({on:e})}),(0,c.jsx)(n.Toggle,{label:"Let them post a question for the board",value:i.askQuestion,onChange:e=>d({askQuestion:e})}),(0,c.jsx)(n.Toggle,{label:"Let them shout out a teammate",value:i.askShout,onChange:e=>d({askShout:e})}),(0,c.jsx)(n.Toggle,{testID:"hr-set-board",label:"Question board in the Staff, Head Chef and Managers apps",value:i.board,onChange:e=>d({board:e})}),(0,c.jsx)(n.Muted,{size:13,children:"Tip: it only shows after Clock out, never at clock in, and anyone can tap Skip. It\u2019s a card in the app, not a phone notification."}),(0,c.jsxs)(n.Muted,{size:13,children:["Tip: answers are anonymous. No name or staff number is saved, and a day\u2019s results only show once ",h.MIN_ANSWERS," people have answered."]}),(0,c.jsx)(n.T,{weight:"semibold",style:{marginTop:4},children:"Wording"}),v.map(({k:e,label:s})=>(0,c.jsxs)(l.default,{style:{gap:4},children:[(0,c.jsx)(n.Muted,{size:13,children:s}),(0,c.jsx)(t.TextInput,{testID:`hr-word-${e}`,accessibilityLabel:s,value:u[e]??i.wording[e],onChangeText:t=>f({...u,[e]:t}),onBlur:()=>{null!=u[e]&&(d({wording:{...i.wording,[e]:u[e].trim()||h.DEFAULT_HR.wording[e]}}),f(t=>{const s={...t};return delete s[e],s}))},maxLength:'intro'===e||'staffing'===e||'question'===e?160:60,multiline:'intro'===e||'staffing'===e||'question'===e,placeholderTextColor:r.colours.muted,style:[x,'intro'===e||'staffing'===e||'question'===e?{minHeight:92,textAlignVertical:'top'}:null]})]},e)),(0,c.jsx)(n.Muted,{size:13,children:"Tip: keep it short and plain. Leave a box empty to go back to the standard words."})]})};var t=_r(_d[0]),s=_r(_d[1]),o=e(_r(_d[2])),l=e(_r(_d[3])),n=_r(_d[4]),r=_r(_d[5]),i=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),c=_r(_d[11]);const f=e=>(0,h.hrSettingsOf)((0,a.useStore)(t=>t.restaurants.find(t=>t.id===e)?.settings?.hr)),p=e=>e.replace(' (example)','').trim(),x={minHeight:46,borderRadius:12,borderWidth:1,borderColor:r.colours.accentBorder,backgroundColor:r.colours.surface2,color:r.colours.text,paddingHorizontal:12,paddingVertical:10,fontSize:16},y=e=>new Date(`${e}T12:00:00`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'});function b({value:e,onChange:t,w:s}){return(0,c.jsxs)(l.default,{style:{gap:6},testID:"hr-morale",children:[(0,c.jsx)(n.Row,{gap:6,style:{justifyContent:'space-between'},children:h.MORALE_STEPS.map(l=>{const i=e===l;return(0,c.jsx)(o.default,{testID:`hr-morale-${l}`,accessibilityRole:"button",accessibilityState:{selected:i},accessibilityLabel:`Morale ${l} of 5: ${(0,h.moraleWord)(l,s)}`,onPress:()=>t(l),hitSlop:4,style:{flex:1,minWidth:0,minHeight:48,borderRadius:12,borderWidth:1,borderColor:i?r.colours.gold:r.colours.border,backgroundColor:i?r.colours.goldTint:r.colours.surface2,alignItems:'center',justifyContent:'center'},children:(0,c.jsx)(n.T,{size:18,weight:"bold",colour:i?r.colours.goldLight:r.colours.text,children:l})},l)})}),(0,c.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(n.Muted,{size:13,style:{flexShrink:1},children:s.moraleLow}),e?(0,c.jsx)(n.T,{size:13,weight:"semibold",colour:r.colours.goldLight,style:{flexShrink:1,textAlign:'center'},children:(0,h.moraleWord)(e,s)}):null,(0,c.jsx)(n.Muted,{size:13,style:{flexShrink:1,textAlign:'right'},children:s.moraleHigh})]})]})}function j({value:e,onChange:t,w:i}){const a=(0,s.useRef)(null),d=(0,s.useRef)(0),u=(0,s.useRef)(1),f=()=>{a.current?.measureInWindow?.((e,t,s)=>{d.current=e,u.current=Math.max(1,s)})},p=e=>t((0,h.snapStaffing)((e-d.current)/u.current*100)),x=e??50,y=null!=e;return(0,c.jsxs)(l.default,{style:{gap:6},children:[(0,c.jsx)(l.default,{testID:"hr-staffing",accessible:!0,accessibilityRole:"adjustable",accessibilityLabel:`Staffing: ${y?(0,h.staffingWord)(x,i):'not answered'}`,accessibilityActions:[{name:'increment'},{name:'decrement'}],onAccessibilityAction:e=>{const s=h.STAFF_STOPS.indexOf((0,h.snapStaffing)(x)),o='increment'===e.nativeEvent.actionName?Math.min(8,s+1):Math.max(0,s-1);t(h.STAFF_STOPS[o])},onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>!0,onResponderGrant:e=>{f(),p(e.nativeEvent.pageX)},onResponderMove:e=>p(e.nativeEvent.pageX),style:{height:48,justifyContent:'center',paddingHorizontal:15},children:(0,c.jsxs)(l.default,{ref:a,onLayout:f,style:{height:48,justifyContent:'center'},children:[(0,c.jsx)(l.default,{style:{height:6,borderRadius:3,backgroundColor:r.colours.border}}),(0,c.jsx)(l.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:0,bottom:0,flexDirection:'row',justifyContent:'space-between',alignItems:'center'},children:h.STAFF_STOPS.map(e=>(0,c.jsx)(l.default,{style:{width:e%50==0?4:2,height:e%50==0?18:10,borderRadius:2,backgroundColor:e%50==0?r.colours.goldMuted:r.colours.muted}},e))}),(0,c.jsx)(l.default,{pointerEvents:"none",style:{position:'absolute',left:`${x}%`,top:10,marginLeft:-14,width:28,height:28,borderRadius:14,borderWidth:2,borderColor:y?r.colours.gold:r.colours.muted,backgroundColor:y?r.colours.gold:r.colours.surface}})]})}),(0,c.jsx)(n.Row,{style:{justifyContent:'space-between',gap:8},children:[[0,i.staffLow],[50,i.staffMid],[100,i.staffHigh]].map(([e,s],l)=>(0,c.jsx)(o.default,{testID:`hr-staffing-${e}`,accessibilityRole:"button",accessibilityLabel:s,onPress:()=>t(e),hitSlop:6,style:{flexShrink:1,flexGrow:0,minWidth:0},children:(0,c.jsx)(n.T,{size:13,colour:y&&(0,h.snapStaffing)(x)===e?r.colours.goldLight:r.colours.muted,weight:y&&(0,h.snapStaffing)(x)===e?'semibold':'regular',style:{textAlign:0===l?'left':1===l?'center':'right'},children:s})},e))}),y&&(0,h.snapStaffing)(x)%50!=0?(0,c.jsx)(n.T,{size:13,colour:r.colours.goldLight,center:!0,children:(0,h.staffingWord)(x,i)}):null]})}function w({q:e,mine:t,manager:s,onHide:o,onReply:i,by:a}){const d=e.yes+e.no,h=d?Math.round(e.yes/d*100):0;return(0,c.jsx)(n.Card,{style:e.hidden?{opacity:.75}:void 0,children:(0,c.jsxs)(l.default,{testID:"hr-question-card",style:{gap:8},children:[(0,c.jsxs)(n.Row,{gap:8,style:{alignItems:'flex-start'},children:[(0,c.jsx)(n.T,{style:{flex:1,minWidth:0},children:e.body}),e.hidden?(0,c.jsx)(n.Badge,{kind:"amber",label:"HIDDEN"}):null]}),(0,c.jsxs)(n.Muted,{size:12,children:["Asked ",y(e.postedOn)," \xb7 anonymous"]}),'up'===e.kind?(0,c.jsx)(n.Row,{gap:8,wrap:!0,children:(0,c.jsx)(n.Button,{small:!0,testID:"hr-vote-up",kind:t?'success':'secondary',label:t?`\u25b2 Voted \xb7 ${e.up}`:`\u25b2 Vote up \xb7 ${e.up}`,disabled:!!t||e.hidden,onPress:()=>u.useHr.getState().vote(e.id,1)})}):(0,c.jsxs)(l.default,{style:{gap:6},children:[(0,c.jsxs)(n.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(n.Button,{small:!0,testID:"hr-vote-yes",kind:1===t?'success':'secondary',label:`Yes \xb7 ${e.yes}`,disabled:!!t||e.hidden,onPress:()=>u.useHr.getState().vote(e.id,1)}),(0,c.jsx)(n.Button,{small:!0,testID:"hr-vote-no",kind:-1===t?'success':'secondary',label:`No \xb7 ${e.no}`,disabled:!!t||e.hidden,onPress:()=>u.useHr.getState().vote(e.id,-1)})]}),d?(0,c.jsx)(l.default,{style:{height:6,borderRadius:3,backgroundColor:r.colours.border,overflow:'hidden'},children:(0,c.jsx)(l.default,{style:{width:`${h}%`,height:6,backgroundColor:r.colours.gold}})}):null,d?(0,c.jsxs)(n.Muted,{size:12,children:[h,"% yes from ",d," vote",1===d?'':'s']}):null]}),t?(0,c.jsx)(n.Muted,{size:12,children:"You\u2019ve voted. Votes are anonymous."}):null,e.reply?(0,c.jsxs)(l.default,{style:{borderLeftWidth:3,borderColor:r.colours.gold,paddingLeft:10,gap:2},children:[(0,c.jsx)(n.T,{size:13,weight:"semibold",colour:r.colours.goldLight,children:"Reply from the managers"}),(0,c.jsx)(n.T,{size:14,children:e.reply})]}):null,s?(0,c.jsxs)(n.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(n.Button,{small:!0,kind:"ghost",testID:"hr-reply",label:e.reply?'Edit reply':'Reply',onPress:i}),e.hidden?(0,c.jsx)(n.Button,{small:!0,kind:"ghost",testID:"hr-unhide",label:"Show again",onPress:()=>u.useHr.getState().moderate(e.id,'unhide','',a)}):(0,c.jsx)(n.Button,{small:!0,kind:"ghost",testID:"hr-hide",label:"Hide",onPress:o})]}):null]})})}const S=(e,t)=>{const s=new Date(`${e}T12:00:00Z`);return s.setUTCDate(s.getUTCDate()+t),s.toISOString().slice(0,10)};function k(e){const t={};for(const s of e)'cancelled'!==s.status&&'noshow'!==s.status&&(t[s.date]=(t[s.date]??0)+(s.partySize||0));return t}function C(e){let t=0;for(const s of e)t=(31*t+s.charCodeAt(0))%997;return 40+t%90}const v=[{k:'intro',label:'Opening line'},{k:'morale',label:'Morale question'},{k:'moraleLow',label:'Morale: low end'},{k:'moraleHigh',label:'Morale: high end'},{k:'staffing',label:'Staffing question'},{k:'staffLow',label:'Staffing: left'},{k:'staffMid',label:'Staffing: middle'},{k:'staffHigh',label:'Staffing: right'},{k:'question',label:'Question prompt'},{k:'shout',label:'Shout-out prompt'}]},998,[877,30,263,127,813,821,856,872,1021,1151,1152,24]); +__d(function(g,r,_i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ChatAsCtx",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"CHANNELS",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"dmId",{enumerable:!0,get:function(){return p.dmId}}),Object.defineProperty(_e,"inChannel",{enumerable:!0,get:function(){return p.inChannel}}),_e.autoPost=function(e,t){const n=new Date(globalThis.__ccNow??Date.now()).toISOString();(Array.isArray(e)?e:[e]).forEach(e=>u.useOwner.getState().sys(e,t,n))},_e.ensureChat=O,_e.useChatUnread=R,_e.Chat=function({go:e}){return(0,y.jsx)(M,{children:(0,y.jsx)(z,{go:e})})};var t=r(d[0]),n=r(d[1]),s=r(d[2]),a=r(d[3]),o=r(d[4]),i=r(d[5]),l=e(r(d[6])),c=e(r(d[7])),h=r(d[8]),u=r(d[9]),m=r(d[10]),f=r(d[11]),x=r(d[12]),b=r(d[13]),p=r(d[14]),j=r(d[15]),y=r(d[16]);const w=(0,o.createContext)(null);function C(e){const t=(0,x.useCtx)(e),n=(0,o.useContext)(w);return n?{...t,meId:n.meId,role:n.role}:t}const v=[{id:'all',name:'Team',icon:'\ud83d\udce2'},{id:'kitchen',name:'Kitchen',icon:'\ud83c\udf73',pinned:!0},{id:'foh',name:'Front of house',icon:'\ud83c\udf7d\ufe0f'},{id:'managers',name:'Managers',icon:'\ud83d\udd11'}],S=[],k=e=>(e??'').replace(' (example)','');function O(e){if(s.LIVE_VENUE_BUILD)return;if(a.IS_WILDINGS)return;const t=u.useOwner.getState();if(t.chat.some(e=>'m-seed-all'===e.id&&/this phone only/.test(e.text??''))&&u.useOwner.getState().chatPatch('m-seed-all',{text:'Welcome to the team chat on CoverCharge.'}),t.chat.length)return;const n=(t,n,s,a={})=>{return{id:`m-seed-${t}`,ch:t,from:'system',text:s,at:(o=n,new Date(e.getTime()-6e4*o).toISOString()),reactions:{},seenBy:[],...a};var o};u.useOwner.setState({chat:[n('all',5,'Welcome to the team chat on CoverCharge.',{pinned:!0}),n('kitchen',4,'Kitchen channel: Head Chef, kitchen team and managers.'),n('foh',3,'Front of house channel: front of house, bar and managers.'),n('managers',2,'Managers channel: owners, managers and the supervisor only.')]})}function R(){const{meId:e}=C(3e4),{role:t}=C(3e4),n=(0,u.useOwner)(e=>e.chat),s=(0,u.useOwner)(e=>e.staff),a=(0,u.useOwner)(t=>t.chatMuted[e]??S),i=(0,o.useMemo)(()=>T(s,e,t),[s,e,t]);return(0,o.useMemo)(()=>{const t={};return n.forEach(n=>{n.removed||n.from===e||n.seenBy.includes(e)||!(0,p.inChannel)(n.ch,i)||(t[n.ch]=(t[n.ch]??0)+1)}),{by:t,total:Object.entries(t).filter(([e])=>!a.includes(e)).reduce((e,[,t])=>e+t,0)}},[n,e,a,i])}function T(e,t,n){const s=e.find(e=>e.id===t);return s||!t?s:{id:t,name:'You',role:n,job:'',active:!0,level:'owner'===n?'Owner':'manager'===n?'Manager':'Staff',dept:''}}class M extends o.Component{state={err:null};static getDerivedStateFromError(e){return{err:String(e?.message??e)}}componentDidUpdate(e){e.resetKey!==this.props.resetKey&&this.state.err&&this.setState({err:null})}render(){return this.state.err?(0,y.jsxs)(c.default,{style:{gap:10},testID:"chat-error",children:[(0,y.jsx)(h.Banner,{kind:"warn",title:"Chat couldn\u2019t open",children:"Something went wrong showing this chat. Your messages are still saved on this phone. Go back and try again; if it keeps happening, close and reopen the app."}),(0,y.jsx)(h.Button,{kind:"secondary",label:"Back to chats",onPress:()=>{this.setState({err:null}),this.props.onBack?.()}})]}):this.props.children}}const I={owner:f.colours.gold,manager:f.colours.blue,staff:'#7a6f5c'};function P({s:e,size:n=34}){return e?(0,y.jsx)(b.StaffAvatar,{id:e.id,size:n}):(0,y.jsx)(c.default,{style:{width:n,height:n,borderRadius:n/2,backgroundColor:(0,t.soutersSurface)('#333'),alignItems:'center',justifyContent:'center'},children:(0,y.jsx)(h.T,{size:.38*n,weight:"bold",colour:"#111",children:"CC"})})}const B=[{caption:'Specials board',tone:'#4A3A22'},{caption:'Plating: Cullen skink',tone:'#3E2A2A'},{caption:'Delivery arrived',tone:'#40362A'},{caption:'Spillage by the bar',tone:'#2E2E40'}],D=['\ud83d\udc4d','\u2764\ufe0f','\ud83d\ude04','\ud83d\udc4f','\ud83d\udd25'];function E({ch:e,go:s,back:a}){const{now:b,meId:w,role:S,today:O}=C(1e4),R=(0,u.useOwner)(e=>e.staff),T=(0,u.useOwner)(e=>e.chat),M=(0,u.useOwner)(e=>e.shifts),E=T.filter(t=>t.ch===e).sort((e,t)=>e.at.localeCompare(t.at)),[z,A]=(R.find(e=>e.id===w),(0,o.useState)('')),[L,$]=(0,o.useState)(null),[N,_]=(0,o.useState)(!1),[W,H]=(0,o.useState)(!1),K=e.startsWith('dm:')?e.split(':').slice(1).length:R.filter(t=>t.active&&(0,p.inChannel)(e,t)).length;(0,o.useEffect)(()=>{u.useOwner.getState().chatSeen(e,w)},[e,w,E.length]);const U=t=>u.useOwner.getState().chatSend({ch:e,from:w,at:b.toISOString(),...t});(0,i.useBackLayer)(!0,a);const Y=E.filter(e=>e.pinned&&!e.removed),V=e.startsWith('dm:')?k(R.find(t=>t.id===e.split(':').slice(1).find(e=>e!==w))?.name):v.find(t=>t.id===e)?.name,F=(0,j.useChatSync)(e=>e.synced),q=M.filter(e=>e.staffId===w&&e.published&&e.date>=O).sort((e,t)=>e.date.localeCompare(t.date)).slice(0,10);return(0,y.jsxs)(c.default,{style:{gap:8},children:[(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(i.BackButton,{onPress:a,testID:"chat-thread-back"}),(0,y.jsxs)(c.default,{style:{flex:1,alignItems:'flex-end'},children:[(0,y.jsx)(h.T,{weight:"semibold",size:18,children:V}),(0,y.jsxs)(h.Muted,{children:[K," members"]})]})]}),Y.map(e=>(0,y.jsxs)(h.Card,{highlight:f.colours.gold,children:[(0,y.jsxs)(h.T,{size:12,colour:f.colours.gold,children:["\ud83d\udccc ",'system'===e.from?'Pinned note':`Pinned by ${k(R.find(t=>t.id===e.from)?.name)}`]}),(0,y.jsx)(h.T,{size:14,children:e.text})]},e.id)),E.map((n,a)=>{const o=R.find(e=>e.id===n.from),i=n.from===w,x=n.seenBy.filter(e=>e!==n.from).length,b=0===a||n.at.slice(0,10)!==E[a-1].at.slice(0,10);return'system'===n.from?(0,y.jsxs)(c.default,{style:{alignItems:'center',gap:2},children:[b?(0,y.jsx)(h.Muted,{children:(0,m.niceDate)(new Date(n.at))}):null,(0,y.jsx)(c.default,{style:{backgroundColor:(0,t.soutersSurface)('#1c1a14'),borderRadius:10,paddingHorizontal:10,paddingVertical:5,borderWidth:1,borderColor:f.colours.border},children:(0,y.jsxs)(h.T,{size:13,colour:/Allergy|86|Sold out/.test(n.text??'')?f.colours.amber:f.colours.muted,children:["CoverCharge \xb7 ",n.text," \xb7 ",(0,m.hm)(new Date(n.at))]})})]},n.id):(0,y.jsxs)(c.default,{style:{gap:2},children:[b?(0,y.jsx)(h.Muted,{center:!0,children:(0,m.niceDate)(new Date(n.at))}):null,(0,y.jsxs)(h.Row,{style:{alignItems:'flex-start',flexDirection:i?'row-reverse':'row'},children:[(0,y.jsx)(P,{s:o}),(0,y.jsxs)(l.default,{accessibilityRole:"button",accessibilityLabel:`Message from ${o?.name}`,onPress:()=>$(L===n.id?null:n.id),style:{maxWidth:'78%',backgroundColor:i?'#3a2f12':f.colours.surface,borderRadius:14,padding:9,borderWidth:1,borderColor:n.pinned?f.colours.gold:f.colours.border,gap:3},children:[(0,y.jsxs)(h.Row,{gap:6,children:[(0,y.jsx)(h.T,{size:12,weight:"semibold",colour:o?I[o.role]:f.colours.muted,children:k(o?.name)}),(0,y.jsxs)(h.T,{size:11,colour:f.colours.muted,children:[o?u.ROLE_LABEL[o.role]:''," \xb7 ",(0,m.hm)(new Date(n.at))]})]}),n.removed?(0,y.jsx)(h.T,{size:14,colour:f.colours.muted,children:"Message removed by the owner"}):(0,y.jsxs)(y.Fragment,{children:[n.photo?(0,y.jsx)(c.default,{style:{width:200,height:120,borderRadius:10,backgroundColor:n.photo.tone,justifyContent:'flex-end',padding:6},children:(0,y.jsxs)(h.T,{size:12,children:[n.photo.caption," (example image)"]})}):null,n.text?(0,y.jsx)(h.T,{size:15,children:n.text}):null,'cover'===n.action?(0,y.jsx)(h.Button,{small:!0,kind:"secondary",label:"Open cover requests on the rota",onPress:()=>s('more','rota')}):null]}),Object.entries(n.reactions).filter(([,e])=>e.length).length?(0,y.jsx)(h.Row,{wrap:!0,gap:4,children:Object.entries(n.reactions).filter(([,e])=>e.length).map(([e,t])=>(0,y.jsx)(c.default,{style:{borderRadius:10,paddingHorizontal:6,backgroundColor:t.includes(w)?'#4a3c16':'#222'},children:(0,y.jsxs)(h.T,{size:12,children:[e," ",t.length]})},e))}):null,i?(0,y.jsx)(h.T,{size:11,colour:f.colours.muted,children:x?`Seen by ${x}`:'Sent'}):null]})]}),L!==n.id||n.removed?null:(0,y.jsxs)(h.Row,{wrap:!0,gap:6,style:{justifyContent:i?'flex-end':'flex-start',paddingLeft:i?0:40},children:[D.map(e=>(0,y.jsx)(l.default,{accessibilityLabel:`React ${e}`,onPress:()=>{u.useOwner.getState().chatReact(n.id,e,w),$(null)},style:{padding:4},children:(0,y.jsx)(h.T,{size:20,children:e})},e)),'staff'===S||e.startsWith('dm:')?null:(0,y.jsx)(h.Button,{small:!0,kind:"ghost",label:n.pinned?'Unpin':'Pin',onPress:()=>{u.useOwner.getState().chatPatch(n.id,{pinned:!n.pinned}),$(null)}}),'owner'!==S||i?null:(0,y.jsx)(h.Button,{small:!0,kind:"danger",label:"Remove",onPress:()=>{u.useOwner.getState().chatPatch(n.id,{removed:!0,pinned:!1}),$(null)}})]})]},n.id)}),(0,y.jsxs)(h.Row,{gap:6,children:[(0,y.jsx)(l.default,{accessibilityRole:"button",accessibilityLabel:"Send a photo",onPress:()=>_(!0),style:{padding:8},children:(0,y.jsx)(h.T,{size:20,children:"\ud83c\udf9e\ufe0f"})}),(0,y.jsx)(n.TextInput,{accessibilityLabel:"Message",placeholder:`Message ${V}`,placeholderTextColor:"#7D776C",value:z,onChangeText:A,style:[h.styles.input,{flex:1}]}),(0,y.jsx)(h.Button,{small:!0,label:"Send",disabled:!z.trim(),onPress:()=>{U({text:z.trim()}),A('')}})]}),(0,y.jsx)(h.Row,{wrap:!0,gap:6,children:(0,y.jsx)(h.Button,{small:!0,kind:"secondary",label:"Ask for shift cover",onPress:()=>H(!0)})}),F?null:(0,y.jsx)(h.Muted,{center:!0,children:"Not shared yet: this message stays on this phone only. Nobody else will see it."}),(0,y.jsx)(h.Sheet,{visible:N,onClose:()=>_(!1),title:"Send a photo",children:(0,y.jsx)(h.Row,{wrap:!0,gap:8,children:B.map(e=>(0,y.jsx)(l.default,{accessibilityRole:"button",accessibilityLabel:e.caption,onPress:()=>{U({photo:e}),_(!1)},style:{width:'47%',height:100,borderRadius:10,backgroundColor:e.tone,justifyContent:'flex-end',padding:6},children:(0,y.jsx)(h.T,{size:12,children:e.caption})},e.caption))})}),(0,y.jsxs)(h.Sheet,{visible:W,onClose:()=>H(!1),title:"Ask for shift cover",children:[q.length?null:(0,y.jsx)(h.Muted,{children:"You have no shifts on the rota this week."}),q.map(e=>(0,y.jsx)(h.Button,{kind:"secondary",label:`${x.DAY3[e.day]} ${Number(e.date.slice(8))} ${(0,x.fmtH)(e.start)}\u2013${(0,x.fmtH)(e.end)}`,onPress:()=>{const t=`${x.DAY3[e.day]} ${Number(e.date.slice(8))} ${(0,x.fmtH)(e.start)}\u2013${(0,x.fmtH)(e.end)}`;u.useOwner.getState().addSwap({shiftId:e.id,fromId:w,kind:'cover',note:`Cover asked in chat for ${t}`}),U({text:`Can anyone cover my ${t} shift? I\u2019ve added a cover request on the rota.`,action:'cover'}),H(!1)}},e.id)),(0,y.jsx)(h.Muted,{children:"Creates a cover request in Rota \u203a Swaps & leave for a manager to approve."})]})]})}function z({go:e}){const{now:n,meId:s,role:a}=C(3e4),i=(0,u.useOwner)(e=>e.staff),x=(0,u.useOwner)(e=>e.chat),b=(0,u.useOwner)(e=>e.chatMuted[s]??S),{by:w}=R(),I=(0,j.useChatSync)(e=>e.synced),B=(0,j.useChatSync)(e=>e.error),D=(0,p.useKitchenExtra)(e=>e.extra),[z,A]=(0,o.useState)(null),[L,$]=(0,o.useState)(!1),[N,_]=(0,o.useState)(!1);(0,o.useEffect)(()=>{O(n)},[]),(0,o.useEffect)(()=>{A(null)},[s]);const W=T(i,s,a);if(z)return(0,y.jsx)(M,{resetKey:z,onBack:()=>A(null),children:(0,y.jsx)(E,{ch:z,go:e,back:()=>A(null)})});const H=e=>x.filter(t=>t.ch===e).sort((e,t)=>t.at.localeCompare(e.at))[0],K=i.filter(e=>e.active&&e.id!==s).map(e=>{const t=(0,p.dmId)(s,e.id);return{x:e,id:t,u:w[t]??0,l:H(t)?.at??''}}).sort((e,t)=>t.u-e.u||t.l.localeCompare(e.l)||k(e.x.name).localeCompare(k(t.x.name))),U='owner'===a||'manager'===a,Y=({id:e,name:n,icon:s,avatar:a})=>{const o=H(e),u=w[e]??0,x=b.includes(e);return(0,y.jsx)(l.default,{accessibilityRole:"button",accessibilityLabel:`Open ${n}`,onPress:()=>A(e),style:{padding:12,borderTopWidth:1,borderColor:f.colours.border},children:(0,y.jsxs)(h.Row,{children:[a?(0,y.jsx)(P,{s:a}):(0,y.jsx)(c.default,{style:{width:34,height:34,borderRadius:17,backgroundColor:(0,t.soutersSurface)('#222'),alignItems:'center',justifyContent:'center'},children:(0,y.jsx)(h.T,{size:16,children:s})}),(0,y.jsxs)(c.default,{style:{flex:1},children:[(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsxs)(h.T,{weight:u?'bold':'medium',children:[n,x?' \ud83d\udd15':'']}),o?(0,y.jsx)(h.Muted,{children:(0,m.hm)(new Date(o.at))}):null]}),(0,y.jsx)(h.Muted,{numberOfLines:1,children:o?o.removed?'Message removed':`${'system'===o.from?'CoverCharge':k(i.find(e=>e.id===o.from)?.name)}: ${o.text??'Photo'}`:'No messages yet'})]}),u?(0,y.jsx)(c.default,{style:{backgroundColor:x?'#555':f.colours.red,borderRadius:10,minWidth:20,height:20,alignItems:'center',justifyContent:'center',paddingHorizontal:5},children:(0,y.jsx)(h.T,{size:11,weight:"bold",children:u})}):null]})})};return(0,y.jsxs)(c.default,{style:{gap:10},children:[I?(0,y.jsx)(c.default,{testID:"chat-synced",children:(0,y.jsx)(h.Muted,{children:"\u2713 Shared with the team: messages reach everyone in the chat on their own phone."})}):(0,y.jsx)(h.Banner,{kind:"warn",title:"On this device only for now",children:"You\u2019re not connected with your personal link (or chat sharing isn\u2019t switched on yet), so anything you send stays on this device and nobody else will see it. Open your personal invite link to share chat with the team. Use your usual group chat for anything urgent."}),I&&B?(0,y.jsx)(c.default,{testID:"chat-sync-error",children:(0,y.jsx)(h.Banner,{kind:"warn",title:"Can\u2019t reach the server right now",children:"Showing the messages on this phone. New messages will be sent and others\u2019 messages will appear when the connection is back; it retries automatically."})}):null,(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsxs)(h.Muted,{children:["Signed in as ",k(W?.name)," (",'Head Chef'===W?.level?'Head Chef':u.ROLE_LABEL[a],")"]}),(0,y.jsx)(h.Button,{small:!0,kind:"ghost",label:"Chat settings",onPress:()=>_(!0)})]}),(0,y.jsxs)(c.default,{style:{borderRadius:14,borderWidth:1,borderColor:f.colours.border,backgroundColor:f.colours.surface,overflow:'hidden'},children:[(0,y.jsx)(h.T,{size:12,weight:"semibold",colour:f.colours.gold,style:{padding:10},children:"TEAM CHATS"}),v.filter(e=>'all'===e.id||(0,p.inChannel)(e.id,W)).map(e=>(0,y.jsx)(Y,{id:e.id,name:e.pinned?`${e.name} \ud83d\udccc`:e.name,icon:e.icon},e.id))]}),(0,y.jsxs)(c.default,{style:{borderRadius:14,borderWidth:1,borderColor:f.colours.border,backgroundColor:f.colours.surface,overflow:'hidden'},children:[(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between',padding:10},children:[(0,y.jsx)(h.T,{size:12,weight:"semibold",colour:f.colours.gold,children:"PRIVATE MESSAGES"}),(0,y.jsx)(h.Button,{small:!0,kind:"success",label:"New message",testID:"chat-new-pm",onPress:()=>$(!0)})]}),K.map(e=>(0,y.jsx)(Y,{id:e.id,name:k(e.x.name),avatar:e.x},e.id)),K.length?null:(0,y.jsx)(h.Muted,{style:{padding:10},children:"Nobody else on the team yet."})]}),(0,y.jsx)(h.Muted,{children:"Private messages can only be read by the two people in them; owners and managers can\u2019t read other people\u2019s private messages. The Kitchen chat is for owners, managers, head chefs and kitchen staff, and can\u2019t be left."}),(0,y.jsx)(h.Sheet,{visible:L,onClose:()=>$(!1),title:"New private message",children:i.filter(e=>e.active&&e.id!==s).map(e=>(0,y.jsx)(l.default,{accessibilityRole:"button",accessibilityLabel:`Message ${e.name}`,onPress:()=>{$(!1),A((0,p.dmId)(s,e.id))},style:{paddingVertical:8},children:(0,y.jsxs)(h.Row,{children:[(0,y.jsx)(P,{s:e}),(0,y.jsxs)(c.default,{children:[(0,y.jsx)(h.T,{children:k(e.name)}),(0,y.jsxs)(h.Muted,{children:[u.ROLE_LABEL[e.role]," \xb7 ",e.job]})]})]})},e.id))}),(0,y.jsxs)(h.Sheet,{visible:N,onClose:()=>_(!1),title:"Chat settings",children:[(0,y.jsx)(h.Banner,{kind:"info",title:"Privacy",children:"Chat is for work. Managers and the owner see messages in the channels they belong to and the owner can remove messages in group chats. Private messages can only be read by the two people in them: the server enforces this, so nobody else (not even the owner) can read them. Don\u2019t share customer card or health details beyond what\u2019s needed for service."}),(0,y.jsx)(h.T,{weight:"semibold",children:"Mute channels"}),v.filter(e=>(0,p.inChannel)(e.id,W)).map(e=>(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsxs)(h.T,{children:[e.icon," ",e.name]}),(0,y.jsx)(h.Toggle,{label:`Mute ${e.name}`,value:b.includes(e.id),onChange:()=>u.useOwner.getState().chatMute(s,e.id)})]},e.id)),(0,y.jsx)(h.Muted,{children:"Muted channels don\u2019t count towards the tab badge. The Kitchen chat can be muted but not left."}),U?(0,y.jsxs)(c.default,{style:{gap:6},testID:"kitchen-members",children:[(0,y.jsx)(h.T,{weight:"semibold",children:"Kitchen chat members"}),(0,y.jsxs)(h.Muted,{children:["Automatic: owners, managers, head chefs and kitchen staff (chefs, kitchen porters). Change who else is in it here",I?'':'; saved on this device for now',"."]}),i.filter(e=>e.active).map(e=>{const t=D[e.id]??(0,p.kitchenByRule)(e);return(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsxs)(h.T,{children:[k(e.name),null!=D[e.id]?' (changed)':'']}),(0,y.jsx)(h.Toggle,{label:`Kitchen chat: ${k(e.name)}`,value:t,onChange:t=>p.useKitchenExtra.getState().set(e.id,t===(0,p.kitchenByRule)(e)?null:t)})]},e.id)})]}):null]})]})}},999,[868,877,833,5,30,991,263,127,813,856,818,821,927,953,1118,1209,24]); +__d(function(g,r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SNOOZE_MINS",{enumerable:!0,get:function(){return S}}),e.useScheduledNotices=function({rid:d,staffId:S,name:h,onOpen:w}){const D=(0,t.useRef)(h);D.current=h;const I=(0,t.useRef)(w);I.current=w,(0,t.useEffect)(()=>{if('undefined'==typeof window||!window.location?.search)return;const t=new URLSearchParams(window.location.search);'orderlists'===t.get('open')&&(o.useListOpen.getState().request(t.get('list')??void 0),setTimeout(()=>I.current?.('orderlists'),0))},[]);const N=(0,s.useNotifs)(t=>t.items.map(t=>`${t.id}:${t.updatedAt??''}`).join()),v=(0,c.useReminders)(t=>t.done.length);(0,t.useEffect)(()=>{s.useNotifs.getState().ensure(d);const t=()=>{const t=p(),h=s.useNotifs.getState(),w=n.useOwner.getState().staff.map(t=>({id:t.id,role:t.role,level:t.level,job:t.job,department:t.dept,active:t.active})),N=w.filter(s=>!1!==s.active&&(0,l.shiftNow)(s.id,t).on).map(t=>t.id);for(const n of h.items){if(n.rid!==d)continue;const l=`sched:${n.id}`;if(!S||n.removed||n.paused||!n.sendBy.inApp||!(0,u.isRecipient)(n,S,w,N)){(0,f.dismissNotice)(l);continue}const{due:v,forDate:O}=(0,u.notifDue)(n,t),b=c.useReminders.getState().done.find(t=>t.reminderId===n.id&&t.forDate===O),R=`sched:${n.id}:${O}`;!v||b||(h.snooze[R]??0)>t?(0,f.dismissNotice)(l):(0,f.notify)({id:l,icon:'\ud83d\udd14',kicker:'NOTICE',title:n.title,body:n.message,testID:'sched-notice',timeoutMs:null,actions:[{label:'Done',testID:'sched-notice-done',onPress:()=>c.useReminders.getState().markDone({rid:d,reminderId:n.id,forDate:O,at:new Date(p()).toISOString(),staffRef:S,staffName:D.current.replace(' (example)','')})},...'orderlists'===n.open?.page&&I.current?[{label:'Open list',testID:'sched-notice-open',onPress:()=>{o.useListOpen.getState().request(n.open?.list),I.current?.('orderlists')}}]:[],{label:'Later',kind:'ghost',testID:'sched-notice-later',onPress:()=>s.useNotifs.getState().setSnooze(R,p()+9e5)}]})}};t();const h=setInterval(t,2e4);return()=>clearInterval(h)},[d,S,N,v])};var t=r(_d[0]),s=r(_d[1]),n=r(_d[2]),o=r(_d[3]),c=r(_d[4]),d=r(_d[5]),u=r(_d[6]),f=r(_d[7]),l=r(_d[8]);const p=()=>{try{return(0,d.nowFrom)(d.useStore.getState().clock).getTime()}catch{return Date.now()}},S=15},1000,[30,956,856,1004,957,872,958,947,959]); +__d(function(g,_r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useOffRotaPrompt=function({rid:r,staffId:k}){const w=(0,o.useRef)(!1),h=(0,n.useClockArea)(o=>{const n=o.areas[r];return!(0,t.privateClockVenue)(r)&&!!n&&!1!==n.offRotaPrompt&&null!=n.lat});(0,o.useEffect)(()=>{if(!h||!k)return;const t=async()=>{if(w.current||'undefined'!=typeof document&&'hidden'===document.visibilityState)return;const t=(0,n.areaOf)(r);if(!(0,a.areaSet)(t)||!t.offRotaPrompt)return;const o=l(),y=(0,f.ukClock)(o).ymd,h=`${y}:${k}`,b=s.useOwner.getState();if(n.useClockArea.getState().visiting[h]||(0,s.openShiftOf)(b.attendance,k,new Date(o)))return void(0,d.dismissNotice)('off-rota');if(!await(0,c.locationAllowed)())return;w.current=!0;const v=await(0,c.getFix)();if(w.current=!1,'object'!=typeof v)return;const S=new Date(o),I=b.shifts.filter(t=>t.staffId===k&&t.date===y&&!1!==t.published);(0,a.offRotaDue)({area:t,inside:(0,a.isInside)(t,v).inside,clockedIn:!1,shifts:I,nowHours:S.getHours()+S.getMinutes()/60,dismissedToday:!1})?(0,d.notify)({id:'off-rota',icon:'\ud83d\udccd',kicker:'AT THE VENUE',title:t.offRotaTitle,body:t.offRotaBody,testID:'off-rota',timeoutMs:null,actions:[{label:'Yes, clock me in',testID:'off-rota-yes',onPress:()=>{(0,u.clockAction)('in',{rid:r,staffId:k,date:y,at:new Date(l()).toISOString(),offRota:!0}).then(t=>{(0,d.notify)(t.ok?{id:'off-rota-done',title:'Clocked in',body:'Your manager will see you weren\u2019t on the rota today.',timeoutMs:6e3}:{id:'off-rota-done',tone:'warn',title:'Not clocked in',body:t.message,timeoutMs:9e3})})}},{label:'No, just visiting',kind:'ghost',testID:'off-rota-no',onPress:()=>n.useClockArea.getState().setVisiting(h)}]}):(0,d.dismissNotice)('off-rota')};t();const o=setInterval(()=>{t()},y),b=()=>{'visible'===document.visibilityState&&t()};return'undefined'!=typeof document&&document.addEventListener('visibilitychange',b),()=>{clearInterval(o),'undefined'!=typeof document&&document.removeEventListener('visibilitychange',b)}},[r,k,h])},e.useOffRotaAlerts=function({enabled:t}){const n=(0,o.useRef)(new Set),r=(0,s.useOwner)(t=>t.attendance);(0,o.useEffect)(()=>{if(!t)return;const o=(0,f.ukClock)(l()).ymd;for(const t of r){if(!t.offRota||t.date!==o||n.current.has(t.id))continue;n.current.add(t.id);const r=s.useOwner.getState().staff.find(o=>o.id===t.staffId)?.name??'Someone',a=t.in?new Date(t.in).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}):'';(0,d.notify)({id:`off-rota-mgr:${t.id}`,icon:'\ud83d\udccd',kicker:'NOT ON THE ROTA',title:`${r} clocked in at ${a}`,body:'They weren\u2019t on today\u2019s rota. Check Hours if that\u2019s not right.',timeoutMs:null,actions:[{label:'OK',testID:'off-rota-mgr-ok',onPress:()=>{}}]})}},[r,t])};var t=_r(_d[0]),o=_r(_d[1]),n=_r(_d[2]),s=_r(_d[3]),r=_r(_d[4]),a=_r(_d[5]),f=_r(_d[6]),c=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]);const l=()=>{try{return(0,r.nowFrom)(r.useStore.getState().clock).getTime()}catch{return Date.now()}},y=24e4},1001,[988,30,1207,856,872,954,1108,1274,947,1103]); +__d(function(g,r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ListBadge=C,_e.OrderListsScreen=function({rid:e,who:t,editor:s,today:i}){(0,o.useEffect)(()=>{x.useOrderLists.getState().ensure(e)},[e]);const d=(0,x.useOrderLists)(e=>e.lists).filter(t=>t.rid===e&&!t.archived),n=(0,x.useOrderLists)(e=>e.items);(0,x.useOrderLists)(t=>t.settings[e]);const l=(0,x.orderSettingsOf)(e).allowStaff,h=(0,x.useListOpen)(e=>e.seed),[y,j]=(0,o.useState)(null);(0,o.useEffect)(()=>{if(!h)return;const e=d.find(e=>e.seed===h);e&&(j(e.id),x.useListOpen.getState().request(void 0))},[h,d.length]);const f=s||l;if(!s&&!l)return(0,w.jsxs)(c.Card,{children:[(0,w.jsx)(c.T,{children:"Order lists are for managers and the Head Chef here."}),(0,w.jsx)(c.Muted,{children:"Ask a manager to switch on \u201cLet all staff add items\u201d."})]});const b=d.find(e=>e.id===y);if(b)return(0,w.jsx)($,{rid:e,list:b,editor:s,canAdd:f,who:t,today:i,onBack:()=>j(null)});const I=(0,x.orderSettingsOf)(e).defaultTripDay;return(0,w.jsxs)(u.default,{style:{gap:10},testID:"order-lists",children:[(0,w.jsxs)(c.Muted,{size:13,children:["Tip: add what\u2019s running low as you notice it. ",s?'On the day, tick what you got, then Finish order.':'A manager or the Head Chef places the order.']}),d.map(t=>{const s=(0,p.liveItems)(n.filter(t=>t.rid===e),t.id).filter(e=>'open'===e.status).length;return(0,w.jsx)(c.Card,{onPress:()=>j(t.id),children:(0,w.jsx)(u.default,{testID:`order-list-card-${t.seed??t.id}`,children:(0,w.jsxs)(c.Row,{gap:10,children:[(0,w.jsx)(C,{list:t}),(0,w.jsxs)(u.default,{style:{flex:1},children:[(0,w.jsx)(c.T,{weight:"semibold",children:t.name}),(0,w.jsx)(c.Muted,{size:12,children:(0,p.tripText)(t,i,I)})]}),(0,w.jsx)(c.Badge,{kind:s?'gold':'neutral',label:`${s} to get`})]})})},t.id)}),d.length?null:(0,w.jsx)(c.Muted,{children:"No order lists yet. Add one in Settings \u203a Advanced \u203a Order lists."})]})};var t=r(_d[0]),s=r(_d[1]),i=r(_d[2]),o=r(_d[3]),d=e(r(_d[4])),n=e(r(_d[5]));r(_d[6]);var l=e(r(_d[7])),u=e(r(_d[8])),c=r(_d[9]),h=r(_d[10]),x=r(_d[11]),p=r(_d[12]),y=r(_d[13]),j=r(_d[14]),f=r(_d[15]),b=r(_d[16]),w=r(_d[17]);const I={minHeight:44,borderRadius:10,borderWidth:1,borderColor:h.colours.hairline,backgroundColor:h.colours.surface2,color:h.colours.text,paddingHorizontal:10,fontSize:15},L=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'}):'',v=e=>e.replace(' (example)','').split(' ')[0];function C({list:e,size:s=40}){const i=(0,f.useLogoCache)(t=>t.byList[e.id]),[n,l]=(0,o.useState)(null);(0,o.useEffect)(()=>{let t=!0;return!i&&e.logo&&(0,b.orderLogoUrl)(e.logo).then(e=>{t&&l(e)}),()=>{t=!1}},[e.logo,i]);const x=i??n;return x?(0,w.jsx)(d.default,{testID:`list-logo-${e.seed??e.id}`,source:{uri:x},accessibilityLabel:`${e.name} logo`,style:{width:s,height:s,borderRadius:s/2,borderWidth:1,borderColor:h.colours.gold}}):(0,w.jsx)(u.default,{testID:`list-initials-${e.seed??e.id}`,accessibilityLabel:`${e.name}`,style:{width:s,height:s,borderRadius:s/2,backgroundColor:(0,t.soutersSurface)('#1c1a16'),borderWidth:1,borderColor:h.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,w.jsx)(c.T,{size:.38*s,weight:"bold",colour:h.colours.gold,children:(0,p.initials)(e.name)})})}function D({phone:e}){const t=(0,p.telHref)(e);if(!e||!t)return null;return'undefined'!=typeof navigator&&/Android|iPhone|iPad|iPod/i.test(navigator.userAgent)?(0,w.jsx)(l.default,{testID:"list-phone",accessibilityRole:"link",onPress:()=>{n.default.openURL(t)},children:(0,w.jsxs)(c.T,{colour:h.colours.gold,children:["\ud83d\udcde Call ",e]})}):(0,w.jsxs)(c.Row,{gap:8,children:[(0,w.jsx)(u.default,{testID:"list-phone",children:(0,w.jsxs)(c.T,{children:["\ud83d\udcde ",e]})}),(0,w.jsx)(c.Button,{small:!0,kind:"ghost",testID:"list-phone-copy",label:"Copy",onPress:()=>{navigator.clipboard?.writeText(e).then(()=>(0,y.notify)({id:'copied',title:'Number copied',timeoutMs:3e3}))}})]})}function T({list:e}){const t=x.useOrderLists.getState(),s=(0,f.useLogoCache)(t=>!!t.byList[e.id])||!!e.logo,i=async s=>{try{const i=await(0,j.capturePlatingPhoto)(s);if(!i)return;const o=await(0,f.squareLogo)(i.dataUrl,256);f.useLogoCache.getState().put(e.id,o);const d=await(0,b.uploadOrderLogo)(e.id,o);if(d.ok){const s=e.logo;t.updateList(e.id,{logo:d.path}),s&&(0,b.removeOrderLogo)(s)}else'offline'!==d.message&&(0,y.notify)({id:'logo',tone:'warn',title:'Logo saved on this device only',body:d.message,timeoutMs:7e3})}catch(e){(0,y.notify)({id:'logo',tone:'warn',title:'Couldn\u2019t use that picture',body:String(e.message),timeoutMs:7e3})}};return(0,w.jsxs)(c.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(c.Button,{small:!0,kind:"secondary",testID:"logo-camera",label:s?'Replace: take photo':'Logo: take photo',onPress:()=>{i('camera')}}),(0,w.jsx)(c.Button,{small:!0,kind:"secondary",testID:"logo-library",label:s?'Replace: choose':'Logo: choose image',onPress:()=>{i('library')}}),s?(0,w.jsx)(c.Button,{small:!0,kind:"ghost",testID:"logo-remove",label:"Remove logo",onPress:()=>{f.useLogoCache.getState().drop(e.id),e.logo&&(0,b.removeOrderLogo)(e.logo),t.updateList(e.id,{logo:void 0})}}):null]})}function S({rid:e,list:t,who:i}){const[d,n]=(0,o.useState)(''),[l,y]=(0,o.useState)('1'),[j,f]=(0,o.useState)(''),[b,L]=(0,o.useState)(''),[C,D]=(0,o.useState)(null),T=x.useOrderLists.getState(),S=Number(l.replace(',','.')),B=d.trim().length>0&&(0,p.validQty)(S),$=()=>{n(''),y('1'),L(''),D(null)};return(0,w.jsxs)(u.default,{testID:"order-add",style:{gap:6},children:[(0,w.jsxs)(c.Row,{gap:6,children:[(0,w.jsx)(s.TextInput,{accessibilityLabel:"Item",testID:"order-add-name",value:d,onChangeText:n,placeholder:"Item, e.g. Tennent\u2019s",placeholderTextColor:h.colours.muted,style:{...I,flex:1}}),(0,w.jsx)(s.TextInput,{accessibilityLabel:"Quantity",testID:"order-add-qty",value:l,onChangeText:y,keyboardType:"decimal-pad",style:{...I,width:64,borderColor:(0,p.validQty)(S)?h.colours.hairline:h.colours.red}})]}),(0,w.jsx)(c.Row,{wrap:!0,gap:4,children:p.UNITS.map(e=>(0,w.jsx)(c.Chip,{label:e||'no unit',selected:j===e,onPress:()=>f(e)},e||'none'))}),(0,w.jsxs)(c.Row,{gap:6,children:[(0,w.jsx)(s.TextInput,{accessibilityLabel:"Note",testID:"order-add-note",value:b,onChangeText:L,placeholder:"Note (optional)",placeholderTextColor:h.colours.muted,style:{...I,flex:1}}),(0,w.jsx)(c.Button,{testID:"order-add-save",label:"Add",disabled:!B,onPress:()=>{const s=(0,p.findDuplicate)(T.items.filter(t=>t.rid===e),t.id,d,j);s?D(s):(T.addItem(e,{listId:t.id,name:d.trim(),qty:S,unit:j,note:b.trim()||void 0,addedBy:i.id,addedByName:i.name}),$())}})]}),(0,w.jsxs)(c.Sheet,{visible:!!C,onClose:()=>D(null),title:"Already on the list",testID:"order-dup",children:[(0,w.jsx)(c.T,{children:C?`${C.name}: ${(0,p.qtyText)(C)} (added by ${v(C.addedByName)})`:''}),(0,w.jsxs)(c.Row,{gap:8,children:[(0,w.jsx)(c.Button,{testID:"order-dup-bump",label:`Add ${l} more`,onPress:()=>{C&&T.bump(C.id,S,i),$()}}),(0,w.jsx)(c.Button,{kind:"ghost",label:"Add as separate item",onPress:()=>{T.addItem(e,{listId:t.id,name:d.trim(),qty:S,unit:j,note:b.trim()||void 0,addedBy:i.id,addedByName:i.name}),$()}})]})]})]})}function B({item:e,editor:t,who:s}){const i=x.useOrderLists.getState(),o='got'===e.status?h.colours.gold:'missing'===e.status?h.colours.amber:h.colours.text;return(0,w.jsxs)(u.default,{testID:`order-item-${e.id}`,style:{borderTopWidth:1,borderColor:h.colours.hairline,paddingVertical:8,gap:4},children:[(0,w.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(c.T,{weight:"semibold",colour:o,style:{flex:1,textDecorationLine:'got'===e.status?'line-through':'none'},children:e.name}),(0,w.jsx)(c.T,{weight:"semibold",children:(0,p.qtyText)(e)})]}),e.note?(0,w.jsxs)(c.Muted,{size:12,children:["Note: ",e.note]}):null,(0,w.jsxs)(c.Muted,{size:12,children:["Added by ",v(e.addedByName)," \xb7 ",L(e.addedAt),e.bumps?.length?` \xb7 +${e.bumps.map(e=>`${e.qty} ${v(e.name)}`).join(', ')}`:'',e.carried?' \xb7 carried over':'']}),'open'!==e.status?(0,w.jsxs)(c.Muted,{size:12,children:['got'===e.status?'Got / ordered':'Missing / not in stock'," \xb7 ",e.statusBy," ",L(e.statusAt)]}):null,t?(0,w.jsxs)(c.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(c.Chip,{testID:`order-got-${e.id}`,label:"\u2713 Got / ordered",selected:'got'===e.status,onPress:()=>i.setStatus(e.id,'got'===e.status?'open':'got',s)}),(0,w.jsx)(c.Chip,{testID:`order-missing-${e.id}`,label:"Missing / not in stock",selected:'missing'===e.status,onPress:()=>i.setStatus(e.id,'missing'===e.status?'open':'missing',s)}),(0,w.jsx)(c.Chip,{testID:`order-remove-${e.id}`,label:"Remove",onPress:()=>{i.removeItem(e.id),(0,y.notify)({id:`undo-${e.id}`,title:`Removed ${e.name}`,timeoutMs:8e3,actions:[{label:'Undo',testID:'order-undo',onPress:()=>i.undoRemove(e.id)}]})}})]}):null]})}function $({rid:e,list:t,editor:d,canAdd:n,who:l,today:j,onBack:f}){(0,i.useBackLayer)(!0,f);const b=(0,x.useOrderLists)(e=>e.items),$=(0,x.useOrderLists)(e=>e.history).filter(e=>e.listId===t.id),P=(0,p.liveItems)(b.filter(t=>t.rid===e),t.id),[k,R]=(0,o.useState)(!1),[O,M]=(0,o.useState)(!1),[A,z]=(0,o.useState)(t.phone??''),N=x.useOrderLists.getState(),q=P.filter(e=>'got'!==e.status).length,H=(0,x.orderSettingsOf)(e).defaultTripDay;return(0,w.jsxs)(u.default,{style:{gap:10},testID:`order-list-${t.seed??t.id}`,children:[(0,w.jsx)(i.BackButton,{onPress:f,testID:"order-list-back"}),(0,w.jsxs)(c.Card,{children:[(0,w.jsxs)(c.Row,{gap:10,children:[(0,w.jsx)(C,{list:t,size:48}),(0,w.jsxs)(u.default,{style:{flex:1},children:[(0,w.jsx)(c.T,{size:18,weight:"semibold",children:t.name}),(0,w.jsx)(c.Muted,{size:12,children:(0,p.tripText)(t,j,H)})]})]}),(0,w.jsx)(D,{phone:t.phone}),'trip'===t.kind&&d?(0,w.jsxs)(u.default,{style:{gap:4},children:[(0,w.jsx)(c.Muted,{size:12,children:"Trip day for this trip"}),(0,w.jsx)(c.Row,{wrap:!0,gap:4,children:[1,2,3,4,5,6,0].map(e=>(0,w.jsx)(c.Chip,{testID:`trip-day-${e}`,label:p.DAY_FULL[e].slice(0,3),selected:(t.tripDay??H)===e,onPress:()=>N.updateList(t.id,{tripDay:e})},e))})]}):null,d?(0,w.jsxs)(u.default,{style:{gap:6},children:[(0,w.jsx)(c.Row,{gap:6,children:(0,w.jsx)(s.TextInput,{accessibilityLabel:"Phone number",testID:"list-phone-edit",value:A,onChangeText:z,onBlur:()=>N.updateList(t.id,{phone:A.trim()||void 0}),placeholder:"Phone (optional)",placeholderTextColor:h.colours.muted,style:{...I,flex:1}})}),(0,w.jsx)(T,{list:t})]}):null]}),n?(0,w.jsxs)(c.Card,{children:[(0,w.jsx)(c.T,{weight:"semibold",children:"Add to this list"}),(0,w.jsx)(S,{rid:e,list:t,who:l})]}):null,(0,w.jsxs)(c.Card,{children:[(0,w.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(c.T,{weight:"semibold",children:"On the list"}),(0,w.jsx)(c.Badge,{kind:"neutral",label:`${P.length}`})]}),P.length?P.map(e=>(0,w.jsx)(B,{item:e,editor:d,who:l},e.id)):(0,w.jsx)(c.Muted,{children:"Nothing on this list yet."}),d&&P.length?(0,w.jsx)(c.Button,{testID:"order-finish",label:"Finish order",onPress:()=>R(!0)}):null]}),(0,w.jsx)(c.Button,{small:!0,kind:"ghost",testID:"order-history",label:O?'Hide history \u25b4':`History (${$.length}) \u25be`,onPress:()=>M(!O)}),O?$.map(e=>(0,w.jsxs)(c.Card,{children:[(0,w.jsxs)(c.T,{weight:"semibold",children:[L(e.finishedAt)," \xb7 ",v(e.finishedByName)]}),(0,w.jsx)(c.Muted,{size:12,children:e.items.map(e=>`${e.name} ${(0,p.qtyText)(e)}${'missing'===e.status?' (missing)':'open'===e.status?' (not got)':''}`).join(' \xb7 ')}),e.carried?(0,w.jsxs)(c.Muted,{size:12,children:[e.carried," carried over"]}):null]},e.id)):null,(0,w.jsxs)(c.Sheet,{visible:k,onClose:()=>R(!1),title:"Finish this order?",testID:"order-finish-sheet",children:[(0,w.jsxs)(c.T,{children:[P.length-q," got or ordered",q?`, ${q} not got (missing or still open)`:'',"."]}),(0,w.jsx)(c.Muted,{children:"It goes into History with today\u2019s date and your name."}),q?(0,w.jsxs)(c.T,{weight:"semibold",children:["Carry over the ",q," not got to the next order?"]}):null,(0,w.jsxs)(c.Row,{wrap:!0,gap:8,children:[q?(0,w.jsx)(c.Button,{testID:"order-finish-carry",label:"Finish and carry over",onPress:()=>{N.finish(e,t.id,!0,l),R(!1),(0,y.notify)({id:'order-done',title:`${t.name}: order finished`,body:`${q} carried over`,timeoutMs:6e3})}}):null,(0,w.jsx)(c.Button,{testID:"order-finish-clear",kind:q?'secondary':'primary',label:q?'Finish, don\u2019t carry over':'Finish order',onPress:()=>{N.finish(e,t.id,!1,l),R(!1),(0,y.notify)({id:'order-done',title:`${t.name}: order finished`,timeoutMs:6e3})}}),(0,w.jsx)(c.Button,{kind:"ghost",label:"Cancel",onPress:()=>R(!1)})]})]})]})}},1002,[868,877,991,30,196,239,122,263,127,813,821,1004,1206,947,1294,1295,820,24]); +__d(function(_g,_r,i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.NotificationsSettings=function({rid:e}){(0,n.useEffect)(()=>{c.useNotifs.getState().ensure(e),(0,j.readPushLive)()},[e]);const t=(0,c.useNotifs)(e=>e.items).filter(t=>t.rid===e&&!t.removed),s=(0,h.useOwner)(e=>e.staff),o=(0,j.usePushLive)(),[l,p]=(0,n.useState)(null),[f,g]=(0,n.useState)(null),[x,b]=(0,n.useState)(!1),y=c.useNotifs.getState(),T=s.map(e=>({id:e.id,role:e.role,level:e.level,job:e.job,department:e.dept,active:e.active})),v=e=>{const t=(0,u.resolveRecipients)(e,T,[]),n=[...e.recipients.groups.map(e=>u.NOTIF_GROUP_LABEL[e]),...(e.recipients.onShiftIn??[]).map(e=>u.SHIFT_FILTER_LABEL[e])];e.recipients.fallback&&n.push(`else ${[...e.recipients.fallback.groups.map(e=>u.NOTIF_GROUP_LABEL[e]),...e.recipients.fallback.staff.map(e=>I(s.find(t=>t.id===e)?.name??e))].join(', ')}`);const o=e.recipients.staff.map(e=>I(s.find(t=>t.id===e)?.name??e));return[...n,...o].join(', ')+(t.length||(e.recipients.onShiftIn??[]).length?'':' (nobody yet)')};return(0,k.jsxs)(a.default,{style:{gap:10},testID:"notif-settings",children:[(0,k.jsx)(r.Muted,{size:13,children:"Tip: these remind people at a set time, e.g. the Mills milk order. They show in the app as a gold slider with Done and Later. Done is logged with the name and time. Times are UK time."}),(0,k.jsxs)(a.default,{testID:"push-live-status",style:{borderWidth:1,borderColor:d.colours.accentBorder,borderRadius:10,padding:8,gap:4},children:[(0,k.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(r.T,{weight:"semibold",children:"Send to phones"}),(0,k.jsx)(r.Badge,{kind:o.live?'gold':'neutral',label:o.live?'ON':'OFF'})]}),(0,k.jsx)(r.Muted,{size:12,children:o.live?'Phone notifications go to people who turned them on.':'Off: nothing goes to anyone\u2019s phone yet. In-app reminders still work.'}),(0,k.jsx)(r.Button,{small:!0,kind:"secondary",testID:"push-live-toggle",label:o.live?'Switch phone notifications off':'Switch phone notifications on\u2026',onPress:()=>b(!0)})]}),(0,k.jsx)(R,{}),t.map(e=>l===e.id?(0,k.jsx)(D,{init:e,onCancel:()=>p(null),onSave:t=>{y.update(e.id,t),p(null)}},e.id):(0,k.jsxs)(a.default,{testID:`notif-${e.seed??e.id}`,style:{borderWidth:1,borderColor:d.colours.hairline,borderRadius:12,padding:10,gap:4,opacity:e.paused?.6:1},children:[(0,k.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(r.T,{weight:"semibold",style:{flex:1},children:e.title}),e.paused?(0,k.jsx)(r.Badge,{kind:"neutral",label:"Off"}):null]}),(0,k.jsx)(r.Muted,{size:13,children:e.message}),(0,k.jsxs)(r.Muted,{size:12,children:[(0,u.scheduleText)(e)," \xb7 ",v(e)," \xb7 ",[e.sendBy.inApp?'In app':'',e.sendBy.push?'Phone':''].filter(Boolean).join(' + ')]}),(0,k.jsxs)(r.Row,{gap:6,children:[(0,k.jsx)(r.Button,{small:!0,kind:"secondary",testID:`notif-edit-${e.seed??e.id}`,label:"Edit",onPress:()=>p(e.id)}),(0,k.jsx)(r.Button,{small:!0,kind:"ghost",label:e.paused?'Switch on':'Switch off',onPress:()=>y.update(e.id,{paused:!e.paused})}),(0,k.jsx)(r.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>g(e)})]})]},e.id)),'new'===l?(0,k.jsx)(D,{init:C,onCancel:()=>p(null),onSave:t=>{y.add(e,t),p(null)}}):(0,k.jsx)(r.Button,{small:!0,testID:"notif-add",label:"Add a notification",onPress:()=>p('new')}),(0,k.jsxs)(r.Sheet,{visible:!!f,onClose:()=>g(null),title:"Remove this notification?",children:[(0,k.jsx)(r.T,{children:f?.title}),(0,k.jsx)(r.Muted,{children:"Nobody gets it after this. Reset to default restores the configured rules."}),(0,k.jsxs)(r.Row,{gap:8,children:[(0,k.jsx)(r.Button,{label:"Remove",onPress:()=>{f&&y.remove(f.id),g(null)}}),(0,k.jsx)(r.Button,{kind:"ghost",label:"Cancel",onPress:()=>g(null)})]})]}),(0,k.jsxs)(r.Sheet,{visible:x,onClose:()=>b(!1),title:o.live?'Switch phone notifications off?':'Switch phone notifications on?',testID:"push-live-confirm",children:[(0,k.jsx)(r.T,{children:o.live?'Nothing more goes to phones. In-app reminders keep working.':'From the next scheduled time, everyone ticked on a notification with \u201cPhone notification\u201d gets it on any phone where they turned phone notifications on.'}),(0,k.jsxs)(r.Row,{gap:8,children:[(0,k.jsx)(r.Button,{testID:"push-live-yes",label:o.live?'Switch off':'Yes, switch on',onPress:()=>{(0,j.setPushLive)(!o.live).then(e=>(0,w.notify)({id:'push-live',tone:e.ok?'normal':'warn',title:e.ok?o.live?'Phone notifications are off':'Phone notifications are on':'Not changed',body:e.message??'',timeoutMs:7e3})),b(!1)}}),(0,k.jsx)(r.Button,{kind:"ghost",label:"Cancel",onPress:()=>b(!1)})]})]})]})},_e.PushButton=R,_e.OrderListsSettings=function({rid:e}){(0,n.useEffect)(()=>{p.useOrderLists.getState().ensure(e)},[e]);const s=(0,p.useOrderLists)(e=>e.lists).filter(t=>t.rid===e),o=(0,p.orderSettingsOf)(e);(0,p.useOrderLists)(t=>t.settings[e]);const l=p.useOrderLists.getState(),[c,u]=(0,n.useState)(''),[h,g]=(0,n.useState)({});return(0,k.jsxs)(a.default,{style:{gap:10},testID:"order-list-settings",children:[(0,k.jsx)(r.Muted,{size:13,children:"Tip: running lists (like Alsons drinks) collect items until you order; trip lists (like Cash and carry) are for one shopping day. Logos and phone numbers are set on each list."}),(0,k.jsx)(r.Toggle,{testID:"order-allow-staff",label:"Let all staff add items",value:o.allowStaff,onChange:t=>l.setSettings(e,{allowStaff:t})}),(0,k.jsx)(r.Muted,{size:12,children:"Staff can add items and see the lists. Only managers and the Head Chef tick, remove or finish an order."}),(0,k.jsx)(r.T,{weight:"semibold",children:"Default trip day"}),(0,k.jsx)(r.Row,{wrap:!0,gap:6,children:v.map(t=>(0,k.jsx)(r.Chip,{label:f.DAY_FULL[t].slice(0,3),selected:o.defaultTripDay===t,onPress:()=>l.setSettings(e,{defaultTripDay:t})},t))}),s.map(e=>(0,k.jsxs)(a.default,{testID:`order-list-row-${e.seed??e.id}`,style:{borderWidth:1,borderColor:d.colours.hairline,borderRadius:10,padding:8,gap:6,opacity:e.archived?.55:1},children:[(0,k.jsxs)(r.Row,{gap:6,children:[(0,k.jsx)(t.TextInput,{accessibilityLabel:`Rename ${e.name}`,value:h[e.id]??e.name,onChangeText:t=>g(s=>({...s,[e.id]:t})),onBlur:()=>{const t=(h[e.id]??'').trim();t&&t!==e.name&&l.updateList(e.id,{name:t})},style:{...T,flex:1,minWidth:0}}),(0,k.jsx)(r.Badge,{kind:"neutral",label:'trip'===e.kind?'Trip':'Running'})]}),'trip'===e.kind?(0,k.jsx)(r.Row,{wrap:!0,gap:6,children:v.map(t=>(0,k.jsx)(r.Chip,{label:f.DAY_FULL[t].slice(0,3),selected:(e.tripDay??o.defaultTripDay)===t,onPress:()=>l.updateList(e.id,{tripDay:t})},t))}):null,(0,k.jsx)(r.Row,{gap:6,children:(0,k.jsx)(r.Button,{small:!0,kind:"ghost",label:e.archived?'Bring back':'Archive',onPress:()=>l.updateList(e.id,{archived:!e.archived})})})]},e.id)),(0,k.jsxs)(r.Row,{gap:6,wrap:!0,children:[(0,k.jsx)(t.TextInput,{accessibilityLabel:"New list name",testID:"order-new-name",value:c,onChangeText:u,placeholder:"e.g. Butcher",placeholderTextColor:d.colours.muted,style:{...T,flexGrow:1,flexBasis:160,minWidth:0}}),(0,k.jsx)(r.Button,{small:!0,label:"Add running",disabled:c.trim().length<2,onPress:()=>{l.addList(e,{name:c.trim(),kind:'running'}),u('')}}),(0,k.jsx)(r.Button,{small:!0,kind:"secondary",label:"Add trip",disabled:c.trim().length<2,onPress:()=>{l.addList(e,{name:c.trim(),kind:'trip',tripDay:o.defaultTripDay}),u('')}})]})]})},Object.defineProperty(_e,"resetOrderLists",{enumerable:!0,get:function(){return B}}),_e.ClockAreaSettings=function({rid:e,me:c}){(0,g.useClockArea)(t=>t.areas[e]);const u=(0,g.areaOf)(e);const h=g.useClockArea.getState(),p=(0,s.privateClockVenue)(e),[f,j]=(0,n.useState)(null==u.lat?'':String(u.lat)),[y,w]=(0,n.useState)(null==u.lng?'':String(u.lng)),[v,S]=(0,n.useState)(!1),[I,C]=(0,n.useState)(''),[L,D]=(0,n.useState)(u.breakOptions.join(', ')),R=(t,s)=>{const n=Number(t),o=Number(s);t.trim()||s.trim()?Number.isFinite(n)&&Number.isFinite(o)&&Math.abs(n)<=90&&Math.abs(o)<=180&&h.set(e,{lat:n,lng:o},c):h.set(e,{lat:null,lng:null},c)},B=async()=>{if(p)return;S(!0),C('');const t=await(0,b.getFix)();if(S(!1),'object'!=typeof t)return void C('denied'===t?'Location is blocked for this app. Allow it in your browser or phone settings.':'Couldn\u2019t get your location. Try again outside or near a window.');const s=t.lat.toFixed(6),n=t.lng.toFixed(6);j(s),w(n),h.set(e,{lat:Number(s),lng:Number(n)},c),C(`Centre set to where you are (accurate to about ${Math.round(t.acc)} m).`)},P=(0,x.areaSet)(u);return(0,k.jsxs)(a.default,{style:{gap:10},testID:"clock-area-settings",children:[(0,k.jsx)(r.Muted,{size:13,children:p?'The address-matched pub centre is configured below. Only clock-in checks location; only pass/fail is saved. No background, clock-out or break checks. Change the radius or centre here; use a manager override for a refused check.':'Tip: stand in the middle of the venue and tap \u201cUse my current location\u201d. Clocking in, out and breaks then only work within the distance below. Rota and pay screens are never blocked.'}),P?null:(0,k.jsx)(r.Banner,{kind:"warn",title:"Clock-in area not set yet",children:"Until you set the centre, staff can clock in from anywhere."}),p?(0,k.jsx)(r.Muted,{children:"Clock-in at the pub is required. A manager can record an exception with a reason."}):(0,k.jsx)(r.Toggle,{testID:"clock-area-on",label:"Check people are at the venue",value:u.on,onChange:t=>h.set(e,{on:t},c)}),p?null:(0,k.jsx)(r.Button,{testID:"clock-area-here",label:v?'Finding you\u2026':'\ud83d\udccd Use my current location',disabled:v,onPress:()=>{B()}}),I?(0,k.jsx)(r.Muted,{size:13,children:I}):null,(0,k.jsxs)(r.Row,{wrap:!0,gap:8,children:[(0,k.jsxs)(a.default,{style:{gap:2},children:[(0,k.jsx)(r.Muted,{size:12,children:"Latitude"}),(0,k.jsx)(t.TextInput,{accessibilityLabel:"Latitude",testID:"clock-area-lat",value:f,onChangeText:j,onBlur:()=>R(f,y),placeholder:"55.40\u2026",placeholderTextColor:d.colours.muted,style:{...T,width:130}})]}),(0,k.jsxs)(a.default,{style:{gap:2},children:[(0,k.jsx)(r.Muted,{size:12,children:"Longitude"}),(0,k.jsx)(t.TextInput,{accessibilityLabel:"Longitude",testID:"clock-area-lng",value:y,onChangeText:w,onBlur:()=>R(f,y),placeholder:"-4.75\u2026",placeholderTextColor:d.colours.muted,style:{...T,width:130}})]})]}),P?(0,k.jsx)(l.default,{accessibilityRole:"link",testID:"clock-area-map",onPress:()=>{o.default.openURL(`https://www.openstreetmap.org/?mlat=${u.lat}&mlon=${u.lng}#map=18/${u.lat}/${u.lng}`)},children:(0,k.jsx)(r.T,{size:13,colour:d.colours.gold,children:"See the pin on a map \u203a"})}):null,(0,k.jsx)(r.T,{weight:"semibold",children:"How far from the centre"}),(0,k.jsxs)(r.Row,{gap:8,children:[(0,k.jsx)(r.Button,{small:!0,kind:"secondary",label:"\u2212",onPress:()=>h.set(e,{radius:(0,x.clampRadius)(u.radius-10)},c)}),(0,k.jsxs)(r.T,{weight:"semibold",style:{minWidth:70,textAlign:'center'},children:[u.radius," m"]}),(0,k.jsx)(r.Button,{small:!0,kind:"secondary",label:"+",onPress:()=>h.set(e,{radius:(0,x.clampRadius)(u.radius+10)},c)})]}),(0,k.jsxs)(r.Muted,{size:12,children:["At least ",x.MIN_RADIUS," m. Phones aren\u2019t exact, so up to 50 m of the phone\u2019s own accuracy is added on top."]}),(0,k.jsx)(r.T,{weight:"semibold",children:"Forgotten break: lengths to offer at clock-out"}),(0,k.jsx)(t.TextInput,{accessibilityLabel:"Break lengths in minutes",testID:"clock-break-options",value:L,onChangeText:D,onBlur:()=>{const t=L.split(/[ ,]+/).map(Number).filter(e=>Number.isFinite(e)&&e>0&&e<=180);t.length&&h.set(e,{breakOptions:[...new Set(t)].sort((e,t)=>e-t)},c),D((0,g.areaOf)(e).breakOptions.join(', '))},style:T}),(0,k.jsxs)(r.Muted,{size:12,children:["Minutes, e.g. 5, 10, 15, 20, 30, 45, 60. Shows as ",u.breakOptions.map(x.breakLabel).join(', ')," and \u201cNo break\u201d."]}),p?(0,k.jsx)(r.Muted,{children:"No automatic arrival checks: staff location is used only at clock-in."}):(0,k.jsxs)(k.Fragment,{children:[" ",(0,k.jsx)(r.T,{weight:"semibold",children:"Not on the rota"}),(0,k.jsx)(r.Toggle,{testID:"clock-offrota-on",label:"Ask people at the venue who aren\u2019t on the rota if they want to clock in",value:u.offRotaPrompt,onChange:t=>h.set(e,{offRotaPrompt:t},c)}),(0,k.jsx)(t.TextInput,{accessibilityLabel:"Off-rota question",testID:"clock-offrota-title",value:u.offRotaTitle,onChangeText:t=>h.set(e,{offRotaTitle:t||x.DEFAULT_CLOCK_AREA.offRotaTitle},c),style:T}),(0,k.jsx)(t.TextInput,{accessibilityLabel:"Off-rota second line",testID:"clock-offrota-body",value:u.offRotaBody,onChangeText:t=>h.set(e,{offRotaBody:t||x.DEFAULT_CLOCK_AREA.offRotaBody},c),style:T}),(0,k.jsx)(r.Muted,{size:12,children:"This only checks while the app is open (web apps can\u2019t watch location in the background; that would need a native app)."})]})]})},Object.defineProperty(_e,"resetClockArea",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"COOKSAFE_URL",{enumerable:!0,get:function(){return O}}),_e.FoodSafetyCard=function({children:e}){return(0,k.jsx)(r.Card,{children:(0,k.jsxs)(a.default,{testID:"food-safety",style:{gap:6},children:[(0,k.jsx)(r.T,{size:17,weight:"semibold",children:"Food safety"}),(0,k.jsxs)(r.T,{children:["Based on ",(0,k.jsx)(r.T,{weight:"bold",colour:d.colours.gold,children:"CookSafe"})," (Food Standards Scotland)"]}),(0,k.jsx)(r.Muted,{size:12,children:"CoverCharge is not endorsed by Food Standards Scotland."}),(0,k.jsx)(l.default,{accessibilityRole:"link",testID:"cooksafe-link",onPress:()=>{o.default.openURL(O)},children:(0,k.jsx)(r.T,{size:14,colour:d.colours.gold,children:"Open the CookSafe guidance \u203a"})}),(0,k.jsx)(r.Muted,{size:13,children:"Full logs coming in the next update."}),e]})})};var t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),o=e(_r(_d[3])),l=e(_r(_d[4])),a=e(_r(_d[5])),r=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),f=_r(_d[12]),g=_r(_d[13]),x=_r(_d[14]),b=_r(_d[15]),j=_r(_d[16]),y=_r(_d[17]),w=_r(_d[18]),k=_r(_d[19]);const T={minHeight:44,borderRadius:10,borderWidth:1,borderColor:d.colours.hairline,backgroundColor:d.colours.surface2,color:d.colours.text,paddingHorizontal:10,fontSize:15},v=[1,2,3,4,5,6,0],S=['on_shift','everyone','managers','head_chef','kitchen','foh'],I=e=>e.replace(' (example)',''),C={title:'',message:'',days:[3,4,5,6,0],time:'21:00',recipients:{staff:[],groups:[]},sendBy:{inApp:!0,push:!1}};function L({value:e,onChange:t}){const s=(0,h.useOwner)(e=>e.staff).filter(e=>e.active);return(0,k.jsxs)(a.default,{style:{gap:6},testID:"notif-recipients",children:[(0,k.jsx)(r.T,{weight:"semibold",children:"Who gets it"}),(0,k.jsx)(r.Muted,{size:12,children:"Tick people, or pick a group (groups follow the team as it changes)."}),(0,k.jsx)(r.Row,{wrap:!0,gap:6,children:S.map(s=>(0,k.jsx)(r.Chip,{testID:`notif-group-${s}`,label:u.NOTIF_GROUP_LABEL[s],selected:e.groups.includes(s),onPress:()=>t({...e,groups:e.groups.includes(s)?e.groups.filter(e=>e!==s):[...e.groups,s]})},s))}),(0,k.jsx)(r.Muted,{size:12,children:"Only people on shift when it goes, in:"}),(0,k.jsx)(r.Row,{wrap:!0,gap:6,children:Object.keys(u.SHIFT_FILTER_LABEL).map(s=>{const n=(e.onShiftIn??[]).includes(s);return(0,k.jsx)(r.Chip,{testID:`notif-onshift-${s}`,label:u.SHIFT_FILTER_LABEL[s],selected:n,onPress:()=>t({...e,onShiftIn:n?(e.onShiftIn??[]).filter(e=>e!==s):[...e.onShiftIn??[],s]})},s)})}),(0,k.jsx)(a.default,{style:{gap:2},children:s.map(s=>{const n=e.staff.includes(s.id);return(0,k.jsxs)(l.default,{testID:`notif-tick-${s.id}`,accessibilityRole:"checkbox",accessibilityState:{checked:n},onPress:()=>t({...e,staff:n?e.staff.filter(e=>e!==s.id):[...e.staff,s.id]}),style:{flexDirection:'row',alignItems:'center',gap:10,paddingVertical:6},children:[(0,k.jsx)(a.default,{style:{width:22,height:22,borderRadius:5,borderWidth:1.5,borderColor:d.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:n?'#2a2414':'transparent'},children:n?(0,k.jsx)(r.T,{size:14,colour:d.colours.gold,children:"\u2713"}):null}),(0,k.jsx)(r.T,{style:{flex:1},children:(0,h.staffLabel)({name:I(s.name),nickname:s.nickname})}),(0,k.jsx)(r.Muted,{size:12,children:'Head Chef'===s.level?'Head Chef':s.job})]},s.id)})}),(0,k.jsx)(r.Muted,{size:12,children:"If nobody above matches when it goes, send it to:"}),(0,k.jsxs)(r.Row,{wrap:!0,gap:6,children:[S.filter(e=>'on_shift'!==e).map(s=>{const n=e.fallback??{staff:[],groups:[]},o=n.groups.includes(s);return(0,k.jsx)(r.Chip,{testID:`notif-fallback-${s}`,label:u.NOTIF_GROUP_LABEL[s],selected:o,onPress:()=>{const l=o?n.groups.filter(e=>e!==s):[...n.groups,s];t({...e,fallback:l.length||n.staff.length?{...n,groups:l}:void 0})}},s)}),s.map(s=>{const n=e.fallback??{staff:[],groups:[]},o=n.staff.includes(s.id);return(0,k.jsx)(r.Chip,{testID:`notif-fallback-${s.id}`,label:I(s.name),selected:o,onPress:()=>{const l=o?n.staff.filter(e=>e!==s.id):[...n.staff,s.id];t({...e,fallback:l.length||n.groups.length?{...n,staff:l}:void 0})}},s.id)})]})]})}function D({init:e,onSave:s,onCancel:o}){const[l,c]=(0,n.useState)(e),[h,p]=(0,n.useState)(!!e.dayTimes&&Object.keys(e.dayTimes).length>0),f=(0,u.validateNotif)(l),g=e=>c(t=>({...t,...e}));return(0,k.jsxs)(a.default,{testID:"notif-editor",style:{gap:8,borderWidth:1,borderColor:d.colours.accentBorder,borderRadius:12,padding:10},children:[(0,k.jsx)(r.T,{weight:"semibold",children:"Title"}),(0,k.jsx)(t.TextInput,{accessibilityLabel:"Notification title",testID:"notif-title",value:l.title,onChangeText:e=>g({title:e}),maxLength:60,style:T}),(0,k.jsx)(r.T,{weight:"semibold",children:"Message"}),(0,k.jsx)(t.TextInput,{accessibilityLabel:"Notification message",testID:"notif-message",value:l.message,onChangeText:e=>g({message:e}),maxLength:160,style:T}),(0,k.jsx)(r.T,{weight:"semibold",children:"Days"}),(0,k.jsx)(r.Row,{wrap:!0,gap:6,children:v.map(e=>(0,k.jsx)(r.Chip,{testID:`notif-day-${e}`,label:u.NOTIF_DAY_NAMES[e],selected:l.days.includes(e),onPress:()=>g({days:l.days.includes(e)?l.days.filter(t=>t!==e):[...l.days,e]})},e))}),(0,k.jsxs)(r.Row,{gap:8,children:[(0,k.jsx)(r.T,{weight:"semibold",children:"Time (UK)"}),(0,k.jsx)(t.TextInput,{accessibilityLabel:"Time",testID:"notif-time",value:l.time,onChangeText:e=>g({time:e}),placeholder:"21:00",style:{...T,width:90,borderColor:(0,u.validHm)(l.time)?d.colours.hairline:d.colours.red}})]}),(0,k.jsx)(r.Toggle,{label:"A different time on some days",value:h,onChange:e=>{p(e),e||g({dayTimes:void 0})}}),h?(0,k.jsx)(r.Row,{wrap:!0,gap:8,children:v.filter(e=>l.days.includes(e)).map(e=>(0,k.jsxs)(r.Row,{gap:4,children:[(0,k.jsx)(r.T,{size:13,children:u.NOTIF_DAY_NAMES[e]}),(0,k.jsx)(t.TextInput,{accessibilityLabel:`${u.NOTIF_DAY_NAMES[e]} time`,testID:`notif-daytime-${e}`,value:l.dayTimes?.[String(e)]??'',placeholder:l.time,onChangeText:t=>{const s={...l.dayTimes??{}};t.trim()?s[String(e)]=t.trim():delete s[String(e)],g({dayTimes:s})},style:{...T,width:74}})]},e))}):null,(0,k.jsx)(L,{value:l.recipients,onChange:e=>g({recipients:e})}),(0,k.jsx)(r.T,{weight:"semibold",children:"Send by"}),(0,k.jsx)(r.Toggle,{testID:"notif-inapp",label:"In the app (gold slider, Done / Later)",value:l.sendBy.inApp,onChange:e=>g({sendBy:{...l.sendBy,inApp:e}})}),(0,k.jsx)(r.Toggle,{testID:"notif-push",label:"Phone notification (when phones are switched on)",value:l.sendBy.push,onChange:e=>g({sendBy:{...l.sendBy,push:e}})}),f?(0,k.jsx)(r.Muted,{size:13,children:f}):null,(0,k.jsxs)(r.Row,{gap:8,style:{justifyContent:'flex-end'},children:[(0,k.jsx)(r.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:o}),(0,k.jsx)(r.Button,{small:!0,testID:"notif-save",label:"Save",disabled:!!f,onPress:()=>s({...l,title:l.title.trim(),message:l.message.trim(),days:[...l.days].sort()})})]})]})}function R(){const[e,t]=(0,n.useState)(null),[s,o]=(0,n.useState)('');return(0,n.useEffect)(()=>{(0,y.pushState)().then(t)},[]),e&&'unsupported'!==e?(0,k.jsxs)(a.default,{testID:"push-button",style:{gap:4},children:[(0,k.jsx)(r.Button,{small:!0,kind:'on'===e?'ghost':'secondary',testID:"push-turn-on",label:'on'===e?'Phone notifications are on for this phone \xb7 Turn off':'\ud83d\udd14 Turn on phone notifications',onPress:()=>{('on'===e?(0,y.turnOffPush)():(0,y.turnOnPush)()).then(e=>{o(e.message),(0,y.pushState)().then(t)})}}),(0,k.jsx)(r.Muted,{size:12,children:s||('ios-home-screen'===e?'iPhone: add this app to your Home Screen first (iOS 16.4 or later).':'For this phone only. Each person turns it on on their own phone.')})]}):null}const B=e=>p.useOrderLists.getState().resetSettings(e);const P=(e,t)=>g.useClockArea.getState().reset(e,t),O='https://www.foodstandards.gov.scot/publications-and-research/publications/cooksafe-manual'},1003,[877,988,30,239,263,127,813,821,956,958,856,1004,1206,1207,954,1274,820,1097,947,24]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"orderListSeedId",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"orderListSettingsId",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"orderListSeeds",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"useOrderLists",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"orderSettingsOf",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"useListOpen",{enumerable:!0,get:function(){return y}});var e,t=r(d[0]),s=(e=t)&&e.__esModule?e:{default:e},i=r(d[1]),n=r(d[2]),u=r(d[3]),o=r(d[4]),p=r(d[5]),l=r(d[6]);const c=(e,t)=>(0,u.uuidFrom)(`order-list:${t}:${e}`),S=e=>(0,u.uuidFrom)(`order-list-settings:${e}`),f=e=>'anchorage'===e?[{id:c(e,'allsons'),seed:'allsons',name:'Alsons (drinks)',kind:'running'},{id:c(e,'cash-carry'),seed:'cash-carry',name:'Cash and carry',kind:'trip',tripDay:5}]:[],A=()=>(new Date).toISOString(),O=(0,i.create)()((0,n.persist)((e,t)=>({lists:[],items:[],history:[],settings:{},ensure:s=>{const i=t(),n=new Set(i.lists.map(e=>e.id)),u=f(s).filter(e=>!n.has(e.id)).map(e=>({...e,rid:s})),p={},c=i.lists.map(e=>(0,l.fixSupplierNames)(e.name)!==e.name?{...e,name:(0,l.fixSupplierNames)(e.name),updatedAt:A()}:e);c.some((e,t)=>e!==i.lists[t])&&(p.lists=c),u.length&&(p.lists=[...p.lists??i.lists,...u]),i.settings[s]||(p.settings={...i.settings,[s]:{...o.DEFAULT_ORDER_LIST_SETTINGS,id:S(s)}}),Object.keys(p).length&&e(p)},addList:(t,s)=>{const i=(0,p.uuid)();return e(e=>({lists:[...e.lists,{...s,id:i,rid:t,updatedAt:A()}]})),i},updateList:(t,s)=>e(e=>({lists:e.lists.map(e=>e.id===t?{...e,...s,updatedAt:A()}:e)})),addItem:(t,s)=>{const i=(0,p.uuid)(),n=s.addedAt??A();return e(e=>({items:[...e.items,{...s,id:i,rid:t,status:'open',addedAt:n,updatedAt:n}]})),i},bump:(t,s,i)=>e(e=>({items:e.items.map(e=>e.id===t?{...(0,o.bumpQty)(e,s,i.id,i.name,A()),rid:e.rid}:e)})),updateItem:(t,s)=>e(e=>({items:e.items.map(e=>e.id===t?{...e,...s,updatedAt:A()}:e)})),setStatus:(t,s,i)=>e(e=>({items:e.items.map(e=>e.id===t?{...e,status:s,statusBy:'open'===s?void 0:i.name,statusAt:'open'===s?void 0:A(),updatedAt:A()}:e)})),removeItem:t=>e(e=>({items:e.items.map(e=>e.id===t?{...e,removed:!0,updatedAt:A()}:e)})),undoRemove:t=>e(e=>({items:e.items.map(e=>e.id===t?{...e,removed:!1,updatedAt:A()}:e)})),finish:(s,i,n,u)=>{const l=t().lists.find(e=>e.id===i);if(!l)return null;const c=A(),{round:S,drop:f,carriedOver:O}=(0,o.finishOrder)(l,t().items,n,u,c,p.uuid),_=new Set(f),y=new Map(O.map(e=>[e.id,e])),T={...S,rid:s};return e(e=>({items:e.items.filter(e=>!_.has(e.id)).map(e=>y.has(e.id)?{...y.get(e.id),rid:e.rid}:e),history:[T,...e.history].slice(0,300),lists:e.lists.map(e=>e.id===i?{...e,nextTrip:void 0,updatedAt:c}:e)})),T},setSettings:(t,s)=>e(e=>({settings:{...e.settings,[t]:{...o.DEFAULT_ORDER_LIST_SETTINGS,...e.settings[t],...s,id:S(t),updatedAt:A()}}})),resetSettings:t=>e(e=>({settings:{...e.settings,[t]:{...o.DEFAULT_ORDER_LIST_SETTINGS,id:S(t),updatedAt:A()}}}))}),{name:'covercharge-order-lists-v1',version:1,storage:(0,n.createJSONStorage)(()=>s.default)})),_=e=>({...o.DEFAULT_ORDER_LIST_SETTINGS,...O.getState().settings[e]}),y=(0,i.create)()(e=>({request:t=>e({seed:t})}))},1004,[1116,952,1117,1104,1206,1033,1205]); +__d(function(g,_r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"APP_USED_TEXT",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"APP_NOT_SET_UP_TEXT",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"allowedHere",{enumerable:!0,get:function(){return C}}),Object.defineProperty(_e,"movedMessage",{enumerable:!0,get:function(){return N}}),_e.personFromStaff=E,_e.signInWithText=z,_e.SignInWithLink=M,_e.useSignedOutGate=function(){const e=(0,m.useSession)(e=>e.meId);return _.includes(b.APP_VARIANT)&&!A.PITCH&&!e},_e.InviteGate=function(){const[e,R]=(0,f.useState)(m.useSession.persist.hasHydrated()),[E,z]=(0,f.useState)(m.START_INVITE?'checking':'done'),[V,F]=(0,f.useState)(null),[W,D]=(0,f.useState)(0),[K,U]=(0,f.useState)(!1),[G,Y]=(0,f.useState)(null),B=(0,m.useSession)(e=>e.meId),$=(0,m.useSession)(e=>!B||!!e.welcomed[B]);if((0,f.useEffect)(()=>{const e=m.useSession.persist.onFinishHydration(()=>R(!0));return m.useSession.persist.hasHydrated()&&R(!0),e},[]),(0,f.useEffect)(()=>{if(!e||!_.includes(b.APP_VARIANT))return;let n,t=!0;return(async()=>{const e=m.useSession.getState().meId;if(m.START_INVITE&&!(e&&await(0,I.signedInHereAs)(e)&&await(0,I.rememberedInviteHere)(m.START_INVITE))){const e=await H(m.START_INVITE,e=>{t&&F(e)});if(!t)return;if('refused'===e.kind)return F(e.message),void z('done');if('offline'===e.kind)return U(!0),void(n=setTimeout(()=>{t&&D(e=>e+1)},1e4));if(U(!1),'bad'===e.kind)return void z('bad')}const s=O(m.useSession.getState().meId),o=s&&!1!==P.useOwner.getState().staff.find(e=>e.id===s.id)?.active;if(s&&!o)m.useSession.getState().signOut();else if(s&&!C(s)&&!m.START_INVITE&&await(0,I.signedInHereAs)(s.id)){if(await(0,I.forgetSignInHere)(),!t)return;m.useSession.getState().signOut(),Y(N(s.app))}else if(s&&!C(s)){const e=(0,m.appUrl)(s.app,m.START_INVITE);if(e)return void window.location.replace(e)}z('done')})(),()=>{t=!1,n&&clearTimeout(n)}},[e,W]),!_.includes(b.APP_VARIANT))return null;if(n.IS_QUEUED_VENUE&&!B)return(0,x.jsx)(h.default,{style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(t.QueuedVenueWelcome,{app:m.APP_NAME[b.APP_VARIANT]??'Team',message:V?'This link cannot be used here. Ask your authorised manager.':K?'Waiting for a connection.':void 0})});if(n.IS_GREENSIDE&&!B)return(0,x.jsx)(h.default,{style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(s.GreensideStaffHome,{app:m.APP_NAME[b.APP_VARIANT]??'Team',message:V?`This link can\u2019t be used here. ${V}`:K?'Waiting for a connection.':e&&'checking'!==E?'bad'===E?'This link is not recognised. Ask the authorised manager for access after setup.':void 0:'Opening your Greenside app\u2026'})});if(n.IS_ABBOTSFORD&&!B)return(0,x.jsx)(h.default,{style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(l.AbbotsfordStaffHome,{app:m.APP_NAME[b.APP_VARIANT]??'Team',message:V?'This link cannot be used here. Ask your authorised manager.':K?'Waiting for a connection.':void 0})});if(n.IS_KIRKTON&&!B)return(0,x.jsx)(h.default,{style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(u.KirktonStaffHome,{app:m.APP_NAME[b.APP_VARIANT]??'Team',message:V?`This link can\u2019t be used here. ${V}`:K?'Waiting for a connection.':e&&'checking'!==E?'bad'===E?'This link is not recognised. Ask the authorised manager for access after setup.':void 0:'Opening your Kirkton app\u2026'})});if(n.IS_WILDINGS&&!B)return(0,x.jsx)(h.default,{style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(o.WildingsStaffHome,{app:m.APP_NAME[b.APP_VARIANT]??'Team',message:V?`This link can\u2019t be used here. ${V}`:K?'Waiting for a connection. Your personal app signs you in automatically when it returns.':e&&'checking'!==E?'bad'===E?'This link is not recognised. Open the complete private link your manager gave you.':void 0:'Opening your personal Wildings app\u2026'})});if(n.IS_KIRKMICHAEL&&!B)return(0,x.jsx)(h.default,{style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(r.KirkmichaelStaffHome,{app:m.APP_NAME[b.APP_VARIANT]??'Team',message:V?`This link can\u2019t be used here. ${V}`:K?'Waiting for a connection. Your personal app signs you in automatically when it returns.':e&&'checking'!==E?'bad'===E?'This link is not recognised. Open the complete private link your manager gave you.':void 0:'Opening your personal Kirkmichael app\u2026'})});if(n.IS_SOUTERS&&!B)return(0,x.jsx)(h.default,{style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(c.SoutersStaffHome,{app:m.APP_NAME[b.APP_VARIANT]??'Team'})});if(K)return w('Waiting for a connection. Your app will sign you in automatically.','invite-waiting');if(!e||'checking'===E)return(0,x.jsx)(h.default,{style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}]});if((0,S.inPhoneApp)()&&!B&&!A.PITCH)return V&&/already been used/i.test(V)?w(j,'invite-app-used'):V?w(V,'invite-app-refused'):w(v,'invite-app-notsetup');if('bad'===E)return(0,x.jsxs)(h.default,{testID:"invite-bad",style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,x.jsx)(T.T,{size:22,weight:"bold",center:!0,children:"This link isn\u2019t recognised"}),(0,x.jsx)(T.Muted,{center:!0,children:"Part of the link may be missing. Go back to the message from your manager and tap the whole link, rather than copying part of it. If it still doesn't work, ask your manager for your personal CoverCharge link."}),(0,x.jsx)(T.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>z('done')}),(0,x.jsx)(T.Muted,{center:!0,children:"Offline, CoverCharge uses made-up data, and nothing you do there is shared with the team."})]});if(V&&!B)return(0,x.jsxs)(h.default,{testID:"invite-refused",style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,x.jsx)(T.T,{size:22,weight:"bold",center:!0,children:"This link can\u2019t be used here"}),(0,x.jsx)(T.Muted,{center:!0,children:V}),(0,x.jsx)(T.Muted,{center:!0,children:"Each personal link works on one phone only and lasts 30 days before first use, so nobody else can sign in as you."}),(0,x.jsx)(T.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>F(null)})]});if(G&&!B)return(0,x.jsxs)(h.default,{testID:"invite-moved",style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,x.jsx)(T.T,{size:22,weight:"bold",center:!0,children:"This app is signed out"}),(0,x.jsx)(T.Muted,{center:!0,children:G}),(0,x.jsx)(M,{})]});if(!B&&!A.PITCH)return(0,x.jsxs)(h.default,{testID:"invite-signin",style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,x.jsx)(T.T,{size:22,weight:"bold",center:!0,children:V?'This link can\u2019t be used here':'Sign in to CoverCharge'}),V?(0,x.jsx)(T.Muted,{center:!0,children:V}):null,(0,x.jsx)(T.Muted,{center:!0,children:"Open the personal link your manager sent you on this phone. Each link signs in one person on one phone and lasts 30 days before first use. If it has already been used on another phone or browser, ask your manager for a new one."}),(0,x.jsx)(M,{})]});const L=(0,m.rosterPerson)(B);return L&&!$&&C(L)?(0,x.jsx)(y.LaunchWelcome,{p:L,onDone:()=>m.useSession.getState().markWelcomed(L.id)}):null};var n=_r(d[0]),t=_r(d[1]),s=_r(d[2]),o=_r(d[3]),r=_r(d[4]),l=_r(d[5]),u=_r(d[6]),c=_r(d[7]),f=_r(d[8]);_r(d[9]);var p=e(_r(d[10])),h=e(_r(d[11])),b=_r(d[12]),m=_r(d[13]),k=_r(d[14]),y=_r(d[15]),T=_r(d[16]),I=_r(d[17]),A=_r(d[18]),S=_r(d[19]),P=_r(d[20]),x=_r(d[21]);const j='This app copy has already been set up on another phone. Ask your manager for a new link.',v='This app copy isn\u2019t set up for anyone yet. Ask your manager for your link, and download the app from it.',w=(e,n)=>(0,x.jsx)(h.default,{testID:n,style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:(0,x.jsx)(T.T,{size:22,weight:"bold",center:!0,children:e})}),_=['owner','staff','chef'],C=e=>'staff'===b.APP_VARIANT||e.app===b.APP_VARIANT,N=e=>`You now use ${m.APP_NAME[e]??'another CoverCharge app'}. This app is signed out on this phone. Open the new personal link your manager sent you.`;function R(e){m.useSession.getState().signIn(e.id);const n=P.useOwner.getState();P.useOwner.setState({staffAs:e.id,previewRole:'staff'===e.role?n.previewRole:e.role})}function E(e){const n='owner'===e.role?'Owner':'manager'===e.role?'Manager':'Head Chef'===e.level?'Head Chef':'Staff';return{id:e.id,name:e.name,level:n,role:e.role,job:e.job,nickname:e.nickname,dept:e.dept??'',app:'staff'===e.role?'Head Chef'===n?'chef':'staff':'owner',tokenHash:'',hourlyPence:null,salaried:!!e.salaried,noTax:!!e.noTax,avatar:void 0}}const O=e=>{const n=(0,m.rosterPerson)(e);if(n)return n;const t=e?P.useOwner.getState().staff.find(n=>n.id===e):void 0;return t?E(t):void 0};async function H(e,n){const t=await(0,m.personForInvite)(e);if(t)return R(t),C(t)?((0,I.claimInvite)(e).then(e=>{if('refused'===e.status&&m.useSession.getState().meId===t.id&&(m.useSession.getState().signOut(),n(e.message)),'ok'===e.status&&e.id.staffRef&&e.id.staffRef!==m.useSession.getState().meId){const n=O(e.id.staffRef);n&&R(n)}}),{kind:'ok',p:t}):{kind:'ok',p:t};const s=await(0,I.claimInvite)(e);if('refused'===s.status)return{kind:'refused',message:s.message};if('offline'===s.status)return{kind:'offline'};if('ok'!==s.status||!s.id.staffRef)return{kind:'bad'};const o=O(s.id.staffRef)??E({id:s.id.staffRef,name:s.id.displayName||s.id.staffRef,role:'owner'===s.id.role?'owner':'manager'===s.id.role?'manager':'staff',level:'head_chef'===s.id.role?'Head Chef':void 0,job:'',active:!0});return R(o),{kind:'ok',p:o}}async function z(e,n=()=>{}){const t=(0,m.inviteFromText)(e);if(!t)return'bad';const s=await H(t,n);if('refused'===s.kind)return{refused:s.message};if('bad'===s.kind||'offline'===s.kind)return'bad';const o=s.p;if(!C(o)){const e=(0,m.appUrl)(o.app,t);if(e)return window.location.replace(e),'moved'}return'ok'}function M(){const[e,n]=(0,f.useState)(''),[t,s]=(0,f.useState)('');return(0,x.jsxs)(h.default,{style:{gap:6},children:[(0,x.jsx)(T.Field,{label:"Your personal link (paste it here)",value:e,onChangeText:n,placeholder:"Your complete Android or iPhone link",autoCapitalize:"none",autoCorrect:!1}),(0,x.jsx)(T.Button,{label:"Sign in",disabled:!e.trim(),onPress:async()=>{const t=await z(e,s);s('bad'===t?'That link was not recognised. Check you copied all of it, or ask your manager for a new one.':'object'==typeof t?t.refused:''),'ok'===t&&n('')}}),t?(0,x.jsx)(T.T,{size:13,colour:k.colours.red,children:t}):null]})}},1005,[5,1398,1399,1400,1401,1402,1403,854,30,122,46,127,806,859,821,1404,813,820,2,1290,856,24]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Icon=function({name:l,size:x=22,colour:t}){const n={stroke:t,strokeWidth:2,fill:'none',strokeLinecap:'round',strokeLinejoin:'round'};return(0,e.jsxs)(h.default,{width:x,height:x,viewBox:"0 0 24 24",children:['home'===l?(0,e.jsx)(s.Path,{d:"M3 11l9-7 9 7v9a1 1 0 0 1-1 1h-5v-6H9v6H4a1 1 0 0 1-1-1z",...n}):null,'orders'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"5",y:"3",width:"14",height:"18",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M9 8h6M9 12h6M9 16h4",...n})]}):null,'bookings'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4",...n})]}):null,'forecast'===l?(0,e.jsx)(s.Path,{d:"M4 20V10M10 20V4M16 20v-7M22 20H2",...n}):null,'more'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"5",cy:"12",r:"1.6",fill:t}),(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"1.6",fill:t}),(0,e.jsx)(s.Circle,{cx:"19",cy:"12",r:"1.6",fill:t})]}):null,'search'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"11",r:"7",...n}),(0,e.jsx)(s.Path,{d:"M20 20l-4-4",...n})]}):null,'bell'===l?(0,e.jsx)(s.Path,{d:"M6 16V11a6 6 0 0 1 12 0v5l2 2H4zM10 20a2 2 0 0 0 4 0",...n}):null,'chat'===l?(0,e.jsx)(s.Path,{d:"M4 5h16v11H9l-5 4z",...n}):null,'clock'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M12 7v5l3 2",...n})]}):null,'user'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"8",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M4 21a8 8 0 0 1 16 0",...n})]}):null,'walkin'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"13",cy:"4.5",r:"1.8",...n}),(0,e.jsx)(s.Path,{d:"M10 21l2-6 3 3v3M9 12l2-4 4 1 2 3M11 8l-1 5",...n})]}):null,'calendarPlus'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4M12 13v5M9.5 15.5h5",...n})]}):null,'pause'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M10 9v6M14 9v6",...n})]}):null,'rain'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M7 15a4 4 0 0 1-.6-7.95A5.5 5.5 0 0 1 17 7.5a3.75 3.75 0 0 1 .5 7.5z",...n}),(0,e.jsx)(s.Path,{d:"M9 18l-1 2.5M13 18l-1 2.5M17 18l-1 2.5",...n})]}):null,'sun'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M12 2v2M12 20v2M2 12h2M20 12h2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4",...n})]}):null,'payroll'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"4",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M7 9h6M7 13h4M15 12.5a2 2 0 1 0 0 .01M7 17h10",...n})]}):null,'tips'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M14.5 9a2.5 2.5 0 0 0-5 0c0 2.5 0 4-1.5 6h7M9 12.5h4",...n})]}):null,'sparkle'===l?(0,e.jsx)(s.Path,{d:"M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8zM19 16l.7 1.8 1.8.7-1.8.7L19 21l-.7-1.8-1.8-.7 1.8-.7z",...n}):null,'platter'===l?(0,e.jsx)(e.Fragment,{children:(0,e.jsx)(s.Path,{d:"M3 15h18M5 15a7 7 0 0 1 14 0M12 6v2M2 18h20",...n})}):null,'check'===l?(0,e.jsx)(s.Path,{d:"M5 12.5l4.5 4.5L19 7.5",...n}):null,'alert'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M12 3l9.5 17h-19z",...n}),(0,e.jsx)(s.Path,{d:"M12 10v4M12 17.2v.1",...n})]}):null,'access'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"4.5",r:"1.8",...n}),(0,e.jsx)(s.Path,{d:"M11 7.5v6h5l2.5 5M11 10h5M8 11.5a5.5 5.5 0 1 0 7.5 6.5",...n})]}):null,'dog'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 10l1-5 3 3h4l3-3 1 5v4a5 5 0 0 1-5 5h-2a5 5 0 0 1-5-5z",...n}),(0,e.jsx)(s.Path,{d:"M10 13v.1M14 13v.1M11 16h2",...n})]}):null,'leaf'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 19c0-8 5-14 15-14 0 10-6 15-14 15",...n}),(0,e.jsx)(s.Path,{d:"M5 19l8-8",...n})]}):null,'table'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"4",y:"8",width:"16",height:"8",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M8 16v4M16 16v4M8 4v4M16 4v4",...n})]}):null,'bag'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 8h14l-1 12H6z",...n}),(0,e.jsx)(s.Path,{d:"M9 10V7a3 3 0 0 1 6 0v3",...n})]}):null,'phone'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"7",y:"2.5",width:"10",height:"19",rx:"2.5",...n}),(0,e.jsx)(s.Path,{d:"M11 18.5h2",...n})]}):null,'swap'===l?(0,e.jsx)(s.Path,{d:"M7 4L3 8l4 4M3 8h14M17 20l4-4-4-4M21 16H7",...n}):null,'box'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M3.5 8L12 4l8.5 4v8L12 20l-8.5-4z",...n}),(0,e.jsx)(s.Path,{d:"M3.5 8L12 12l8.5-4M12 12v8",...n})]}):null,'star'===l?(0,e.jsx)(s.Path,{d:"M12 3.5l2.6 5.4 5.9.8-4.3 4.1 1 5.8L12 16.8l-5.2 2.8 1-5.8L3.5 9.7l5.9-.8z",...n}):null,'userPlus'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"10",cy:"8",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M3 21a7 7 0 0 1 14 0M19 8v6M16 11h6",...n})]}):null,'gift'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3.5",y:"8.5",width:"17",height:"4",rx:"1",...n}),(0,e.jsx)(s.Path,{d:"M5 12.5V20h14v-7.5M12 8.5V20M12 8.5C10 8.5 7.5 7.8 7.5 5.8S10.5 4 12 8.5c1.5-4.5 4.5-4.7 4.5-2.7S14 8.5 12 8.5z",...n})]}):null,'tag'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M3.5 12.5V4h8.5l8.5 8.5-8.5 8.5z",...n}),(0,e.jsx)(s.Circle,{cx:"8",cy:"8.5",r:"1.4",...n})]}):null,'hanger'===l?(0,e.jsx)(s.Path,{d:"M12 7.5a2 2 0 1 1 2-2M12 7.5v2L3 16.5h18L12 9.5",...n}):null]})},r(d[0]);var l,s=r(d[1]),h=(l=s)&&l.__esModule?l:{default:l},e=r(d[2])},1006,[30,948,24]); +__d(function(g,_r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.usePay=j,_e.periodPay=T,_e.MyHoursPay=C,_e.Payroll=function(){const{role:e}=(0,y.useCtx)(6e4),r='owner'===e,c=!!(0,y.useSignedIn)(),p=c&&('owner'===e||'manager'===e),j=(0,a.useOwner)(e=>e.staff),k=(0,i.useMemo)(()=>j.filter(e=>e.active),[j]),D=(0,y.useHourly)(),R=(0,a.useOwner)(e=>e.attendance),z=(0,a.useOwner)(e=>e.troncHistory),{now:M,rid:N}=(0,y.useCtx)(6e4),v=(0,b.useVenuePay)(N).pay,[B,O]=(0,i.useState)(-1),[L,$]=(0,i.useState)(null),[S,H]=(0,i.useState)(''),[I,W]=(0,i.useState)(null),E=(0,i.useMemo)(()=>k.map(e=>({...T(e.id,B,M,R,D[e.id]??0,v,z),person:e})),[k,B,R,D,v,z]),_=E.reduce((e,s)=>({paid:e.paid+s.paid,gross:e.gross+s.gross,tips:e.tips+s.tips,total:e.total+s.total}),{paid:0,gross:0,tips:0,total:0}),V=E[0]?.label??'',F=k.find(e=>e.id===L),G=Math.round(100*Number(S));return(0,f.jsxs)(n.default,{style:{gap:10},children:[(0,f.jsx)(l.Muted,{children:"Periods follow your venue's pay dates (Settings \u203a Pay & tips). For hours to copy into a spreadsheet, use Payroll hours."}),(0,f.jsxs)(l.Muted,{children:["Pay period (venue setting",r?'':', owner only',"). Used for staff pay, the tip splitter and payroll."]}),(0,f.jsx)(P,{label:V,offset:B,setOffset:O,badge:0===B?'Current period':void 0}),(0,f.jsx)(t.WideTable,{children:(0,f.jsxs)(n.default,{children:[(0,f.jsx)(t.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:h.colours.border,paddingBottom:4},children:['Staff','Rate/h','Paid hrs','Gross','Tips','Total'].map((e,s)=>(0,f.jsx)(l.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{width:[120,96,64,72,64,76][s]},children:e},e))}),E.map(e=>(0,f.jsxs)(t.TRow,{heads:['Staff','Rate/h','Paid hrs','Gross','Tips','Total'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,f.jsxs)(o.default,{accessibilityRole:"button",accessibilityLabel:`Pay for ${e.person.name}`,onPress:()=>W(e.person.id),style:{width:120,minHeight:44,justifyContent:'center'},children:[(0,f.jsx)(l.T,{size:13,colour:h.colours.gold,numberOfLines:1,children:x(e.person.name)}),c&&e.person.noTax?(0,f.jsx)(l.T,{size:10,colour:h.colours.amber,children:"No tax deducted"}):null]}),(0,f.jsx)(o.default,{accessibilityRole:"button",accessibilityLabel:`Edit rate for ${e.person.name}`,disabled:!p,onPress:()=>{$(e.person.id),H(null==D[e.person.id]?'':(D[e.person.id]/100).toFixed(2))},style:{width:96,minHeight:44,justifyContent:'center'},children:(0,f.jsxs)(l.T,{size:13,colour:null==D[e.person.id]?h.colours.muted:'owner'!==e.person.role&&D[e.person.id]$(null),title:`Hourly rate: ${x(F?.name)}`,children:[(0,f.jsx)(l.Muted,{children:F?`${F.level??a.ROLE_LABEL[F.role]} \xb7 ${F.job}${F.noTax?' \xb7 No tax deducted':''} \xb7 now: ${(0,a.wageLabel)(F,D[F.id],u.gbp)}`:''}),(0,f.jsx)(s.TextInput,{accessibilityLabel:"Hourly rate \xa3",keyboardType:"decimal-pad",value:S,onChangeText:H,style:l.styles.input}),Number.isFinite(G)&&G>0&&G{a.useOwner.getState().setRate(L,G),$(null)}}),L&&null!=D[L]?(0,f.jsx)(l.Button,{kind:"secondary",label:"Clear (Not set)",onPress:()=>{a.useOwner.getState().clearRate(L),$(null)}}):null]}),(0,f.jsx)(l.Sheet,{visible:!!I,onClose:()=>W(null),title:`What ${x(k.find(e=>e.id===I)?.name)} sees`,children:I?(0,f.jsx)(C,{staffId:I}):null})]})};var s=_r(d[0]),t=_r(d[1]),i=_r(d[2]),o=e(_r(d[3])),n=e(_r(d[4])),r=e(_r(d[5])),l=_r(d[6]),a=_r(d[7]),u=_r(d[8]),c=_r(d[9]),h=_r(d[10]),p=_r(d[11]),y=_r(d[12]),b=_r(d[13]),f=_r(d[14]);const x=e=>(e??'').replace(' (example)',''),w='Before tax and deductions, estimate';function j(e,s){const{now:t,rid:o}=(0,y.useCtx)(6e4),n=(0,a.useOwner)(e=>e.attendance),r=(0,y.useHourly)()[e]??0,l=(0,b.useVenuePay)(o).pay,u=(0,a.useOwner)(e=>e.troncHistory);return(0,i.useMemo)(()=>T(e,s,t,n,r,l,u),[e,s,n,r,l,u,Math.floor(t.getTime()/6e4)])}function T(e,s,t,i,o,n,r){const{s:l,e:u,key:h}=(0,b.venueRange)(n,'wage',s,t),p=(0,c.ymd)(l),f=(0,c.ymd)(u),x=i.filter(s=>s.staffId===e&&s.date>=p&&s.date<=f&&s.in).sort((e,s)=>e.date.localeCompare(s.date)).map(e=>{const s=(0,y.paidMins)(e,t);return{a:e,...s,gross:Math.round(s.paid/60*o),open:!e.out,confirmed:(0,a.isConfirmed)(e)}}),w=x.filter(e=>e.confirmed),j=w.reduce((e,s)=>e+s.paid,0),T=w.reduce((e,s)=>e+s.gross,0),P=x.filter(e=>!e.open&&!e.confirmed).reduce((e,s)=>e+s.paid,0),C=r.filter(e=>e.end>=p&&e.end<=f).map(s=>({label:s.label,amount:s.rows.find(s=>s.staffId===e)?.amount??0})).filter(e=>e.amount>0),k=C.reduce((e,s)=>e+s.amount,0);return{s:l,e:u,key:h,label:`${(0,c.niceDate)(l)} \u2013 ${(0,c.niceDate)(u)} ${u.getFullYear()}`,shifts:x,paid:j,pending:P,gross:T,tips:k,tipItems:C,total:T+k,rate:o}}function P({label:e,offset:s,setOffset:t,badge:i}){return(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",disabled:s<=-12,onPress:()=>t(s-1)}),(0,f.jsxs)(n.default,{style:{alignItems:'center',flex:1},children:[(0,f.jsx)(l.T,{weight:"semibold",children:e}),i?(0,f.jsx)(l.Badge,{kind:0===s?'amber':'neutral',label:i}):null]}),(0,f.jsx)(l.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:s>=0,onPress:()=>t(s+1)})]})}function C({staffId:e}){const{meId:s,now:C,rid:k}=(0,y.useCtx)(6e4),D=e??s,R=(0,b.useVenuePay)(k).pay,z=(0,a.useOwner)(e=>e.staff).find(e=>e.id===D),M=(0,a.useOwner)(e=>e.attendance),N=(0,a.useOwner)(e=>e.troncHistory),v=(0,y.useHourly)(),B=v[D]??0,O=null!=v[D],[L,$]=(0,i.useState)(0),S=j(D,L),H=(0,r.default)().width<520,I=(0,i.useMemo)(()=>[-1,-2,-3,-4,-5,-6].map(e=>({o:e,...T(D,e,C,M,B,R,N)})),[D,M,B,R,N]);return(0,f.jsxs)(n.default,{style:{gap:10},children:[(0,f.jsx)(l.Banner,{kind:"info",title:w,children:"Gross pay from your clocked hours at your hourly rate, plus tips shared to you. Tax, National Insurance and pension come off in payroll."}),(0,f.jsxs)(l.Muted,{children:[x(z?.name)," \xb7 ",z?.job," \xb7 ",O?`${(0,u.gbp)(B)}/hour`:'Hourly rate not set yet'," \xb7 Paid on the ",R.wagePayDay,[1,21,31].includes(R.wagePayDay)?'st':[2,22].includes(R.wagePayDay)?'nd':[3,23].includes(R.wagePayDay)?'rd':'th',", cut-off the ",R.wageCutoffDay,[1,21].includes(R.wageCutoffDay)?'st':[2,22].includes(R.wageCutoffDay)?'nd':[3,23].includes(R.wageCutoffDay)?'rd':'th',e?'':' (set by your manager)']}),(0,f.jsx)(P,{label:S.label,offset:L,setOffset:$,badge:0===L?'Current period':void 0}),(0,f.jsxs)(l.Card,{children:[(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{children:"Confirmed paid hours"}),(0,f.jsx)(l.T,{weight:"semibold",children:(0,y.hmDur)(S.paid)})]}),S.pending?(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{colour:h.colours.amber,children:"Pending sign-off"}),(0,f.jsx)(l.T,{colour:h.colours.amber,children:(0,y.hmDur)(S.pending)})]}):null,(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{children:"Gross pay from hours"}),(0,f.jsx)(l.T,{weight:"semibold",children:(0,u.gbp)(S.gross)})]}),(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{children:"Tips allocated"}),(0,f.jsx)(l.T,{weight:"semibold",children:(0,u.gbp)(S.tips)})]}),S.tipItems.map(e=>(0,f.jsxs)(l.Muted,{children:[" Tips for ",e.label,": ",(0,u.gbp)(e.amount)]},e.label)),(0,f.jsx)(n.default,{style:{height:1,backgroundColor:h.colours.border}}),(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{weight:"bold",children:"Total gross"}),(0,f.jsx)(l.T,{size:20,weight:"bold",colour:h.colours.gold,children:(0,u.gbp)(S.total)})]}),(0,f.jsxs)(l.Muted,{children:[w,". Tips are shown separately and only once a tip period is approved."]})]}),(0,f.jsx)(p.SectionHead,{title:"Shifts",sub:"Paid hours = clock out \u2212 clock in \u2212 break"}),H?(0,f.jsxs)(n.default,{testID:"pay-shifts-list",children:[S.shifts.map(e=>(0,f.jsxs)(n.default,{style:{paddingVertical:8,borderBottomWidth:1,borderColor:'#222',gap:2},children:[(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{size:14,weight:"semibold",children:(0,c.niceDate)(new Date(e.a.date+'T12:00:00'))}),(0,f.jsx)(l.T,{size:14,weight:"semibold",colour:e.open||e.confirmed?void 0:h.colours.amber,children:e.open?'On now':e.confirmed?(0,u.gbp)(e.gross):'Pending'})]}),(0,f.jsxs)(l.Muted,{children:[(0,c.hm)(new Date(e.a.in)),"\u2013",e.a.out?(0,c.hm)(new Date(e.a.out)):'now',e.open?'':` \xb7 ${e.brk}m break \xb7 ${(0,y.hmDur)(e.paid)} paid`]})]},e.a.id)),S.shifts.length?null:(0,f.jsx)(l.Muted,{style:{paddingVertical:8},children:"No clocked shifts in this period."}),S.shifts.length?(0,f.jsxs)(l.Muted,{children:["At ",(0,u.gbp)(S.rate),"/hour."]}):null]}):(0,f.jsx)(t.WideTable,{children:(0,f.jsxs)(n.default,{children:[(0,f.jsx)(t.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:h.colours.border,paddingBottom:4},children:['Date','In','Out','Break','Paid','Rate','Gross'].map((e,s)=>(0,f.jsx)(l.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{width:[86,50,50,50,62,56,64][s]},children:e},e))}),S.shifts.map(e=>(0,f.jsxs)(t.TRow,{heads:['Date','In','Out','Break','Paid','Rate','Gross'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,f.jsx)(l.T,{size:13,style:{width:86},children:(0,c.niceDate)(new Date(e.a.date+'T12:00:00'))}),(0,f.jsx)(l.T,{size:13,style:{width:50},children:(0,c.hm)(new Date(e.a.in))}),(0,f.jsx)(l.T,{size:13,style:{width:50},children:e.a.out?(0,c.hm)(new Date(e.a.out)):'on now'}),(0,f.jsx)(l.T,{size:13,style:{width:50},children:e.open?'\u2013':`${e.brk}m`}),(0,f.jsx)(l.T,{size:13,style:{width:62},children:e.open?'\u2013':(0,y.hmDur)(e.paid)}),(0,f.jsx)(l.T,{size:13,style:{width:56},children:(0,u.gbp)(S.rate)}),(0,f.jsx)(l.T,{size:13,weight:"semibold",style:{width:64},colour:e.open||e.confirmed?void 0:h.colours.amber,children:e.open?'\u2013':e.confirmed?(0,u.gbp)(e.gross):'Pending'})]},e.a.id)),S.shifts.length?null:(0,f.jsx)(l.Muted,{style:{paddingVertical:8},children:"No clocked shifts in this period."})]})}),S.shifts.some(e=>e.open)?(0,f.jsx)(l.Muted,{children:"The shift you\u2019re on now is added once you clock out."}):null,S.pending?(0,f.jsx)(l.Muted,{children:"Hours marked Pending count once a manager signs them off."}):null,(0,f.jsx)(p.SectionHead,{title:"History"}),I.map(e=>(0,f.jsx)(o.default,{accessibilityRole:"button",accessibilityLabel:`Pay period ${e.label}`,onPress:()=>$(e.o),children:(0,f.jsxs)(l.Card,{children:[(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{weight:"semibold",children:e.label}),(0,f.jsx)(l.T,{weight:"bold",children:(0,u.gbp)(e.total)})]}),(0,f.jsxs)(l.Muted,{children:[(0,y.hmDur)(e.paid)," paid \xb7 ",(0,u.gbp)(e.gross)," from hours",e.tips?` + ${(0,u.gbp)(e.tips)} tips`:''," \xb7 ",w.toLowerCase()]})]})},e.o))]})}},1007,[877,1338,30,263,127,287,813,856,816,818,821,1018,927,1111,24]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"payFor",{enumerable:!0,get:function(){return b.payFor}}),Object.defineProperty(_e,"useVenuePay",{enumerable:!0,get:function(){return b.useVenuePay}}),_e.PayTipsSettings=function({go:e}){const{rid:s,today:t}=(0,x.useCtx)(6e4),{pay:n,source:r}=(0,b.useVenuePay)(s),[l,c]=(0,o.useState)(n),[p,y]=(0,o.useState)((0,u.ukDate)(n.tipsAnchorPayday)),[C,S]=(0,o.useState)(null),D=(0,u.parseUk)(p),M=(0,u.cleanPay)({...l,tipsAnchorPayday:D??l.tipsAnchorPayday}),B=JSON.stringify(M)!==JSON.stringify(n)||'settings'!==r,R=(0,u.nextToPay)(M,'tips',t).period,z=(0,u.nextToPay)(M,'wage',t).period,v=(0,u.tipsPeriod)(M,R.start,1),$=(0,u.wagePeriod)(M,z.start,1),O=e=>{c({...l,...e}),S(null)};return(0,j.jsxs)(d.default,{style:{gap:12},testID:"pay-settings",children:['none'===r?(0,j.jsx)(i.Banner,{kind:"warn",title:"Pay dates not set up yet",children:"Set your tips and wage dates here. Until then the app uses calendar months and weekly tips."}):null,'questionnaire'===r?(0,j.jsx)(i.Banner,{kind:"info",title:"From your sign-up answers",children:"These dates came from your questionnaire. Check them and tap Save to make them your venue's pay dates."}):null,(0,j.jsx)(f.SectionHead,{title:"Tips (tronc)",sub:"How often tips are paid out, and which days each payout covers."}),(0,j.jsxs)(i.Card,{children:[(0,j.jsx)(i.T,{weight:"semibold",children:"How often"}),(0,j.jsx)(i.Row,{wrap:!0,gap:6,children:['weekly','fortnightly','monthly'].map(e=>(0,j.jsx)(i.Chip,{label:w[e],selected:l.tipsFrequency===e,onPress:()=>O({tipsFrequency:e})},e))}),(0,j.jsx)(i.Field,{label:"A tips payday (DD/MM/YYYY). Every other one is worked out from it",value:p,onChangeText:e=>{y(e),S(null)},placeholder:"02/11/2026",keyboardType:"numbers-and-punctuation"}),D?(0,j.jsxs)(i.Muted,{children:[(0,u.dayMonth)(D)," ",D.slice(0,4)]}):(0,j.jsx)(i.T,{size:13,colour:h.colours.red,children:"Enter a date like 02/11/2026"}),(0,j.jsx)(i.T,{weight:"semibold",children:"Each tips period ends"}),(0,j.jsxs)(i.Row,{children:[(0,j.jsx)(i.Stepper,{label:"days before payday",value:l.tipsEndsDaysBefore,min:0,max:13,onChange:e=>O({tipsEndsDaysBefore:e})}),(0,j.jsx)(i.Muted,{style:{flex:1},children:0===l.tipsEndsDaysBefore?'on payday':1===l.tipsEndsDaysBefore?'day before payday (a Monday payday covers up to the Sunday)':'days before payday'})]})]}),(0,j.jsx)(f.SectionHead,{title:"Wages",sub:"Monthly pay: the cut-off starts each pay period."}),(0,j.jsxs)(i.Card,{children:[(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(i.T,{weight:"semibold",style:{flex:1},children:"Pay day of the month"}),(0,j.jsx)(i.Stepper,{label:"pay day",value:l.wagePayDay,min:1,max:31,onChange:e=>O({wagePayDay:e})})]}),(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(i.T,{weight:"semibold",style:{flex:1},children:"Cut-off (first day of each period)"}),(0,j.jsx)(i.Stepper,{label:"cut-off day",value:l.wageCutoffDay,min:1,max:28,onChange:e=>O({wageCutoffDay:e})})]}),(0,j.jsxs)(i.Muted,{children:["Period runs the ",P(l.wageCutoffDay)," to the ",P(1===l.wageCutoffDay?31:l.wageCutoffDay-1),1===l.wageCutoffDay?' (end of the month)':' of the next month',". A pay day past the month end uses the last day."]}),(0,j.jsx)(i.T,{weight:"semibold",children:"A pay day on a weekend"}),(0,j.jsx)(i.Row,{wrap:!0,gap:6,children:['none','before','after'].map(e=>(0,j.jsx)(i.Chip,{label:T[e],selected:(l.weekendRule??'none')===e,onPress:()=>O({weekendRule:e})},e))})]}),(0,j.jsx)(f.SectionHead,{title:"Preview"}),(0,j.jsxs)(i.Card,{highlight:h.colours.gold,children:[(0,j.jsx)(k,{label:"Next tips payday",day:R.payday,period:R}),(0,j.jsx)(k,{label:"Then",day:v.payday,period:v}),(0,j.jsx)(d.default,{style:{height:1,backgroundColor:h.colours.border}}),(0,j.jsx)(k,{label:"Next payday",day:z.payday,period:z}),(0,j.jsx)(k,{label:"Then",day:$.payday,period:$})]}),(0,j.jsx)(i.Button,{kind:"success",label:'settings'===r?'Save pay dates':'Save as our pay dates',disabled:!D||!B,testID:"save-pay",onPress:()=>{a.useStore.getState().updateSettings(s,{pay:M}),S('Saved. Everyone in the venue sees these dates.')}}),C?(0,j.jsx)(i.Banner,{kind:"success",title:C}):null,(0,j.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Payroll hours",onPress:()=>e('more','hours')}),(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Tips day",onPress:()=>e('more','tipsday')})]})]})},_e.hoursIn=S,Object.defineProperty(_e,"toTsv",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"toCsv",{enumerable:!0,get:function(){return $}}),_e.summaryTable=O,_e.detailTable=H,_e.copyText=I,_e.periodOptions=W,_e.PayrollHours=function({go:e}){const{rid:s,today:n,now:a,r:y}=(0,x.useCtx)(6e4),{pay:f,source:w}=(0,b.useVenuePay)(s),T=(0,l.useOwner)(e=>e.staff),P=(0,l.useOwner)(e=>e.attendance),k=(0,x.useHourly)(),C=(0,o.useMemo)(()=>W(f,n),[f,n]),[B,R]=(0,o.useState)('wage'),[z,F]=(0,o.useState)(null),[V,A]=(0,o.useState)(!1),[E,Y]=(0,o.useState)({}),[G,U]=(0,o.useState)(null),_='custom'===B&&z?z:(C.find(e=>e.id===B)??C[0]).period,q=(0,o.useMemo)(()=>S(_,T,P,a,k),[_.key,T,P,k,Math.floor(a.getTime()/6e4)]),J=q.some(e=>null!=e.rate),K='tips'===_.kind,Q=q.reduce((e,s)=>({c:e.c+s.confirmed,p:e.p+s.pending,s:e.s+s.shifts,g:e.g+(s.gross??0)}),{c:0,p:0,s:0,g:0}),X=q.filter(e=>e.pending>0).length,Z=`${y.name}: hours ${(0,u.rangeText)(_.start,_.end)}`,ee=`hours-${_.start}-to-${_.end}`,se=e=>{U(e),setTimeout(()=>U(null),6e3)};return(0,j.jsxs)(d.default,{style:{gap:10},testID:"payroll-hours",children:['none'===w?(0,j.jsxs)(i.Banner,{kind:"warn",title:"Pay dates not set up",children:[(0,j.jsx)(i.Muted,{children:"Using calendar months for now."}),(0,j.jsx)(i.Button,{small:!0,kind:"ghost",label:"Set your pay dates \u203a",onPress:()=>e('more','paysettings')})]}):null,(0,j.jsxs)(i.Row,{wrap:!0,gap:6,children:[C.map(e=>(0,j.jsx)(i.Chip,{label:e.label,sub:e.sub,selected:B===e.id,onPress:()=>{R(e.id),A(!1)}},e.id)),(0,j.jsx)(i.Chip,{label:"Custom dates",sub:z&&'custom'===B?(0,u.rangeText)(z.start,z.end):'Pick any range',selected:'custom'===B,onPress:()=>A(!V)})]}),V?(0,j.jsx)(N,{onSet:e=>{F(e),R('custom'),A(!1)}}):null,(0,j.jsx)(i.Card,{highlight:h.colours.gold,children:(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,j.jsxs)(d.default,{style:{flexShrink:1,minWidth:0},children:[(0,j.jsxs)(i.T,{weight:"bold",size:18,children:[(0,u.rangeText)(_.start,_.end)," ",_.end.slice(0,4)]}),(0,j.jsxs)(i.Muted,{children:[(0,u.ukDate)(_.start)," to ",(0,u.ukDate)(_.end),_.payday?` \xb7 ${_.payday>=n?'pays':'paid'} ${(0,u.dayMonth)(_.payday)}`:'',K?' \xb7 tips period':'wage'===_.kind?' \xb7 wage period':'']})]}),(0,j.jsxs)(d.default,{style:{alignItems:'flex-end'},children:[(0,j.jsxs)(i.T,{size:22,weight:"bold",colour:h.colours.gold,children:[(0,u.decH)(Q.c)," h"]}),(0,j.jsxs)(i.Muted,{children:["confirmed (",(0,u.hMm)(Q.c),")"]})]})]})}),X?(0,j.jsx)(r.default,{accessibilityRole:"button",accessibilityLabel:"Sign off pending hours",onPress:()=>e('more','signoff'),testID:"pending-banner",children:(0,j.jsxs)(d.default,{style:{backgroundColor:h.colours.amberBg,borderRadius:12,padding:12,borderLeftWidth:6,borderLeftColor:h.colours.amber,gap:4},children:[(0,j.jsxs)(i.T,{weight:"bold",colour:h.colours.amber,children:["\u26a0 ",(0,u.decH)(Q.p)," h still waiting for sign-off (",X," ",1===X?'person':'people',")"]}),(0,j.jsx)(i.T,{size:14,children:"Pending hours are not in the totals or the exports' confirmed columns. Sign them off first so everyone is paid in full."}),(0,j.jsx)(i.T,{weight:"semibold",colour:h.colours.gold,children:"Sign off hours \u203a"})]})}):(0,j.jsx)(i.Banner,{kind:"success",title:"All hours in this period are signed off"}),(0,j.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(i.Button,{small:!0,kind:"success",label:"Copy for spreadsheet",testID:"copy-tsv",onPress:async()=>{const e=await I(v(O(q,_,J,K)));se(e?`Copied ${q.length} rows. Paste into the first cell of your spreadsheet.`:'Copy is not available here. Use Download CSV.')}}),(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Download CSV",onPress:()=>{(0,p.downloadText)(`${ee}.csv`,$(O(q,_,J,K))),se('CSV downloaded (summary).')}}),(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Download CSV (daily detail)",onPress:()=>{(0,p.downloadText)(`${ee}-daily.csv`,$(H(q))),se('CSV downloaded (one line per shift).')}}),(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Print / PDF",onPress:()=>{const e=O(q,_,J,K);(0,p.printTable)(Z,`${(0,u.ukDate)(_.start)} to ${(0,u.ukDate)(_.end)} \xb7 confirmed hours only in the totals \xb7 printed ${(0,u.ukDate)(n)}`,e[0],e.slice(1))}})]}),G?(0,j.jsx)(i.Banner,{kind:"success",title:G}):null,(0,j.jsx)(t.WideTable,{children:(0,j.jsxs)(d.default,{testID:"hours-table",children:[(0,j.jsx)(t.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:h.colours.border,paddingBottom:4},children:['Name','Shifts','Confirmed','Pending',K?'Tips h':'h:mm',J?'Rate':'',J?'Gross':''].map((e,s)=>(0,j.jsx)(i.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{width:L[s]},children:e},s))}),q.map(e=>{const s=!!E[e.person.id];return(0,j.jsxs)(d.default,{style:{borderBottomWidth:1,borderColor:'#222'},children:[(0,j.jsx)(r.default,{accessibilityRole:"button",accessibilityLabel:`${M(e.person)} daily hours`,onPress:()=>Y({...E,[e.person.id]:!s}),style:{paddingVertical:7},children:(0,j.jsxs)(t.TRow,{heads:['Name','Shifts','Confirmed','Pending',K?'Tips h':'h:mm',J?'Rate':'',J?'Gross':''],children:[(0,j.jsxs)(d.default,{style:{width:L[0]},children:[(0,j.jsxs)(i.T,{size:14,weight:"semibold",numberOfLines:1,children:[s?'\u25be':'\u25b8'," ",M(e.person)]}),(0,j.jsx)(i.Muted,{numberOfLines:1,children:D(e.person)})]}),(0,j.jsx)(i.T,{size:14,style:{width:L[1]},children:e.shifts}),(0,j.jsx)(i.T,{size:14,weight:"semibold",style:{width:L[2]},children:(0,u.decH)(e.confirmed)}),(0,j.jsx)(i.T,{size:14,weight:e.pending?'bold':'regular',colour:e.pending?h.colours.amber:h.colours.muted,style:{width:L[3]},children:e.pending?`\u26a0 ${(0,u.decH)(e.pending)}`:'0.00'}),(0,j.jsx)(i.T,{size:14,style:{width:L[4]},children:K?(0,u.decH)(e.confirmed):(0,u.hMm)(e.confirmed)}),(0,j.jsx)(i.T,{size:14,colour:h.colours.muted,style:{width:L[5]},children:J?null!=e.rate?(0,c.gbp)(e.rate):'\u2013':''}),(0,j.jsx)(i.T,{size:14,weight:"semibold",style:{width:L[6]},children:J?null!=e.gross?(0,c.gbp)(e.gross):'\u2013':''})]})}),s?(0,j.jsxs)(d.default,{style:{backgroundColor:h.colours.surface2,borderRadius:8,padding:8,marginBottom:8,gap:2},testID:`daily-${e.person.id}`,children:[(0,j.jsx)(t.TRow,{head:!0,children:['Date','In','Out','Break','Paid','Status'].map((e,s)=>(0,j.jsx)(i.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{width:[96,52,52,52,56,90][s]},children:e},e))}),e.days.map(e=>(0,j.jsxs)(t.TRow,{heads:['Date','In','Out','Break','Paid','Status'],children:[(0,j.jsx)(i.T,{size:13,style:{width:96},children:(0,u.dayMonth)(e.date)}),(0,j.jsx)(i.T,{size:13,style:{width:52},children:e.inT}),(0,j.jsx)(i.T,{size:13,style:{width:52},children:e.outT||'\u2013'}),(0,j.jsx)(i.T,{size:13,style:{width:52},children:'On now'===e.status?'\u2013':`${e.brk}m`}),(0,j.jsx)(i.T,{size:13,style:{width:56},children:'On now'===e.status?'\u2013':(0,u.hMm)(e.paid)}),(0,j.jsx)(i.T,{size:13,weight:"semibold",style:{width:90},colour:'Confirmed'===e.status?h.colours.ok:'Pending'===e.status?h.colours.amber:h.colours.blue,children:e.status})]},e.a.id)),e.days.length?null:(0,j.jsx)(i.Muted,{children:"No clocked shifts in this period."})]}):null]},e.person.id)}),(0,j.jsxs)(t.TRow,{heads:['','Shifts','Confirmed','Pending',K?'Tips h':'h:mm','',J?'Gross':''],style:{paddingVertical:8,borderTopWidth:2,borderColor:h.colours.gold},children:[(0,j.jsxs)(i.T,{size:14,weight:"bold",style:{width:L[0]},children:["Total (",q.length,")"]}),(0,j.jsx)(i.T,{size:14,weight:"bold",style:{width:L[1]},children:Q.s}),(0,j.jsx)(i.T,{size:14,weight:"bold",colour:h.colours.gold,style:{width:L[2]},children:(0,u.decH)(Q.c)}),(0,j.jsx)(i.T,{size:14,weight:"bold",colour:Q.p?h.colours.amber:h.colours.muted,style:{width:L[3]},children:(0,u.decH)(Q.p)}),(0,j.jsx)(i.T,{size:14,weight:"bold",style:{width:L[4]},children:K?(0,u.decH)(Q.c):(0,u.hMm)(Q.c)}),(0,j.jsx)(i.T,{size:14,style:{width:L[5]},children:" "}),(0,j.jsx)(i.T,{size:14,weight:"bold",style:{width:L[6]},children:J?(0,c.gbp)(Q.g):''})]})]})}),(0,j.jsxs)(i.Muted,{children:["Tap a name for each day. Hours are decimal (37.50 = 37 hours 30 minutes); h:mm is also in the export. Paid hours = clock out \u2212 clock in \u2212 break. ",J?'Gross is before tax, from confirmed hours only.':'Rates and gross show once you sign in with your personal link.']}),K?(0,j.jsx)(i.Button,{kind:"success",label:"Tips day: split tips for this period \u203a",onPress:()=>e('more','tipsday')}):null]})},_e.TipsDay=function({go:e}){const{rid:n,today:a,now:f}=(0,x.useCtx)(6e4),{pay:w,source:T}=(0,b.useVenuePay)(n),P=(0,l.useOwner)(e=>e.staff),k=(0,l.useOwner)(e=>e.attendance),C=(0,l.useOwner)(e=>e.tronc),R=(0,u.nextToPay)(w,'tips',a),[z,O]=(0,o.useState)(0),H=(0,u.tipsPeriod)(w,R.period.start,z),[W,N]=(0,o.useState)(''),[L,F]=(0,o.useState)({}),[V,A]=(0,o.useState)(null),E=(0,o.useMemo)(()=>S(H,P,k,f,{}),[H.key,P,k]),Y=e=>'owner'===e.role&&!C.includeOwner||'manager'===e.role&&!C.includeManagers,G=e=>L[e.id]??Y(e),U=E.filter(e=>e.confirmed>0||e.pending>0),_=Math.round(100*Number(W.replace(/[\xa3,\s]/g,''))),q=Number.isFinite(_)&&_>0&&_<=1e8&&/^\s*\xa3?\s*[\d,]+(\.\d{0,2})?\s*$/.test(W),J=U.filter(e=>!G(e.person)&&e.confirmed>0),{amounts:K}=(0,y.allocate)(q?_:0,J.map(e=>e.confirmed)),Q={};J.forEach((e,s)=>{Q[e.person.id]=K[s]});const X=J.reduce((e,s)=>e+s.confirmed,0),Z=Object.values(Q).reduce((e,s)=>e+s,0),ee=U.filter(e=>e.pending>0&&!G(e.person)),se=ee.reduce((e,s)=>e+s.pending,0),te=()=>[['Name','Role','Period start','Period end','Payday','Confirmed hours','Confirmed h:mm','Share %','Tips \xa3'],...U.map(e=>{const s=!G(e.person)&&e.confirmed>0;return[M(e.person),D(e.person),(0,u.ukDate)(H.start),(0,u.ukDate)(H.end),H.payday?(0,u.ukDate)(H.payday):'',(0,u.decH)(e.confirmed),(0,u.hMm)(e.confirmed),s&&X?(e.confirmed/X*100).toFixed(2):'0.00',s?B(Q[e.person.id]??0):G(e.person)?'excluded':'0.00']}),['TOTAL','',(0,u.ukDate)(H.start),(0,u.ukDate)(H.end),H.payday?(0,u.ukDate)(H.payday):'',(0,u.decH)(X),(0,u.hMm)(X),X?'100.00':'0.00',B(Z)]],oe=e=>{A(e),setTimeout(()=>A(null),6e3)};return(0,j.jsxs)(d.default,{style:{gap:10},testID:"tips-day",children:[(0,j.jsx)(i.Banner,{kind:"info",title:"Saving payouts and notifying staff are coming next",children:"For now this works out the split and exports it. Nothing is saved to the team, sent or paid."}),'none'===T?(0,j.jsxs)(i.Banner,{kind:"warn",title:"Tips dates not set up",children:[(0,j.jsx)(i.Muted,{children:"Using weekly tips for now."}),(0,j.jsx)(i.Button,{small:!0,kind:"ghost",label:"Set your pay dates \u203a",onPress:()=>e('more','paysettings')})]}):null,(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(i.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",disabled:z<=-6,onPress:()=>O(z-1)}),(0,j.jsxs)(d.default,{style:{alignItems:'center',flex:1},children:[(0,j.jsx)(i.T,{weight:"bold",size:18,children:(0,u.rangeText)(H.start,H.end)}),(0,j.jsxs)(i.Muted,{children:[(0,u.ukDate)(H.start)," to ",(0,u.ukDate)(H.end)," \xb7 ",H.payday>=a?'paid':'was paid'," ",(0,u.dayMonth)(H.payday)]}),0===z?(0,j.jsx)(i.Badge,{kind:"gold",label:"Paid next"}):null]}),(0,j.jsx)(i.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:z>=1,onPress:()=>O(z+1)})]}),(0,j.jsxs)(i.Card,{highlight:h.colours.gold,children:[(0,j.jsx)(i.T,{weight:"semibold",children:"Total tips to share"}),(0,j.jsxs)(i.Row,{style:{alignItems:'center'},children:[(0,j.jsx)(i.T,{size:28,weight:"bold",colour:h.colours.gold,children:"\xa3"}),(0,j.jsx)(s.TextInput,{testID:"tips-total",accessibilityLabel:"Total tips in pounds",value:W,onChangeText:N,placeholder:"0.00",placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",style:[i.styles.input,{flex:1,fontSize:26,fontWeight:'700'}]})]}),W&&!q?(0,j.jsx)(i.T,{size:13,colour:h.colours.red,children:"Enter an amount like 1250.00"}):(0,j.jsx)(i.Muted,{children:"Shared by confirmed hours: share = total \xd7 (their hours \xf7 everyone's hours). Rounded to the penny; leftover pennies go to the largest shares so it adds up exactly."})]}),ee.length?(0,j.jsx)(r.default,{accessibilityRole:"button",onPress:()=>e('more','signoff'),testID:"tips-pending",children:(0,j.jsxs)(d.default,{style:{backgroundColor:h.colours.redBg,borderRadius:12,padding:12,borderLeftWidth:6,borderLeftColor:h.colours.red,gap:4},children:[(0,j.jsxs)(i.T,{weight:"bold",colour:h.colours.red,children:["\u26a0 Don't pay out yet: ",(0,u.decH)(se)," h not signed off"]}),(0,j.jsxs)(i.T,{size:14,children:[ee.map(e=>`${M(e.person)} (${(0,u.decH)(e.pending)} h)`).join(', '),". Pending hours are left out of the split, so these people would get less than they should."]}),(0,j.jsx)(i.T,{weight:"semibold",colour:h.colours.gold,children:"Sign off hours \u203a"})]})}):U.length?(0,j.jsx)(i.Banner,{kind:"success",title:"All hours in this fortnight are signed off"}):null,(0,j.jsx)(t.WideTable,{children:(0,j.jsxs)(d.default,{testID:"tips-table",children:[(0,j.jsx)(t.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:h.colours.border,paddingBottom:4},children:['Include','Name','Confirmed','Share','Tips'].map((e,s)=>(0,j.jsx)(i.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{width:[64,150,80,64,84][s]},children:e},e))}),U.map(e=>{const s=G(e.person),o=Q[e.person.id]??0;return(0,j.jsxs)(t.TRow,{heads:['Include','Name','Confirmed','Share','Tips'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222',opacity:s?.5:1},children:[(0,j.jsx)(r.default,{accessibilityRole:"checkbox",accessibilityState:{checked:!s},accessibilityLabel:`Include ${M(e.person)}`,onPress:()=>F({...L,[e.person.id]:!s}),style:{width:64,minHeight:44,justifyContent:'center'},children:(0,j.jsx)(d.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:s?h.colours.muted:h.colours.ok,backgroundColor:s?'transparent':h.colours.okBg,alignItems:'center',justifyContent:'center'},children:(0,j.jsx)(i.T,{size:14,colour:h.colours.ok,children:s?'':'\u2713'})})}),(0,j.jsxs)(d.default,{style:{width:150},children:[(0,j.jsx)(i.T,{size:14,weight:"semibold",numberOfLines:1,children:M(e.person)}),(0,j.jsxs)(i.Muted,{numberOfLines:1,children:[s?'Excluded':D(e.person),e.pending?` \xb7 \u26a0 ${(0,u.decH)(e.pending)} h pending`:'']})]}),(0,j.jsxs)(i.T,{size:14,style:{width:80},children:[(0,u.decH)(e.confirmed)," h"]}),(0,j.jsx)(i.T,{size:14,colour:h.colours.muted,style:{width:64},children:!s&&X?`${(e.confirmed/X*100).toFixed(1)}%`:'\u2013'}),(0,j.jsx)(i.T,{size:15,weight:"bold",colour:s?h.colours.muted:h.colours.gold,style:{width:84},children:s?'\u2013':(0,c.gbp)(o)})]},e.person.id)}),(0,j.jsxs)(t.TRow,{heads:['','','Confirmed','Share','Tips'],style:{paddingVertical:8,borderTopWidth:2,borderColor:h.colours.gold},children:[(0,j.jsx)(i.T,{size:14,style:{width:64},children:" "}),(0,j.jsxs)(i.T,{size:14,weight:"bold",style:{width:150},children:["Total (",J.length," people)"]}),(0,j.jsxs)(i.T,{size:14,weight:"bold",style:{width:80},children:[(0,u.decH)(X)," h"]}),(0,j.jsx)(i.T,{size:14,style:{width:64},children:X?'100%':'\u2013'}),(0,j.jsx)(i.T,{size:15,weight:"bold",colour:q&&Z===_?h.colours.ok:h.colours.text,style:{width:84},children:(0,c.gbp)(Z)})]})]})}),U.length?null:(0,j.jsx)(i.Muted,{children:"No clocked hours in this fortnight yet."}),q&&X?(0,j.jsxs)(i.Muted,{children:["Check: ",J.length," shares add up to ",(0,c.gbp)(Z)," of ",(0,c.gbp)(_)," ",Z===_?'\u2713':'',". \xa3",(_/100/(X/60)).toFixed(4)," per confirmed hour."]}):null,(0,j.jsxs)(i.Muted,{children:["Owner ",C.includeOwner?'included':'left out'," and managers ",C.includeManagers?'included':'left out'," by default (your tipping policy in Tips (tronc)). Tick or untick anyone for this split."]}),(0,j.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(i.Button,{small:!0,kind:"success",label:"Copy for spreadsheet",testID:"tips-copy",disabled:!q,onPress:async()=>{const e=await I(v(te()));oe(e?'Copied. Paste into the first cell of your spreadsheet.':'Copy is not available here. Use Download CSV.')}}),(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Download CSV",disabled:!q,onPress:()=>{(0,p.downloadText)(`tips-${H.start}-to-${H.end}.csv`,$(te())),oe('CSV downloaded.')}}),(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Print / PDF",disabled:!q,onPress:()=>{const e=te();(0,p.printTable)(`Tips ${(0,u.rangeText)(H.start,H.end)} (paid ${(0,u.dayMonth)(H.payday)})`,`Total ${(0,c.gbp)(_)} shared by confirmed hours${ee.length?` \xb7 WARNING ${(0,u.decH)(se)} h not signed off`:''}`,e[0],e.slice(1))}})]}),V?(0,j.jsx)(i.Banner,{kind:"success",title:V}):null]})},_e.PaydaysCard=function({go:e}){const{rid:s,today:t}=(0,x.useCtx)(6e4),{pay:o,source:r}=(0,b.useVenuePay)(s),a=(0,u.nextToPay)(o,'tips',t).period,l=(0,u.nextToPay)(o,'wage',t).period;return(0,j.jsxs)(d.default,{testID:"paydays-card",style:{backgroundColor:h.colours.surface,borderRadius:16,borderWidth:1,borderColor:h.colours.hairline,padding:16,gap:8},children:[(0,j.jsx)(n.CardHeading,{right:'none'===r?(0,j.jsx)(i.Badge,{kind:"amber",label:"Not set up"}):null,children:"Paydays"}),(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,j.jsxs)(i.T,{children:["Next tips payday: ",(0,j.jsx)(i.T,{weight:"semibold",colour:h.colours.goldLight,children:a.payday===t?'today':(0,u.dayMonth)(a.payday)})]}),(0,j.jsx)(i.Muted,{children:(0,u.rangeText)(a.start,a.end)})]}),(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,j.jsxs)(i.T,{children:["Next payday: ",(0,j.jsx)(i.T,{weight:"semibold",colour:h.colours.goldLight,children:l.payday===t?'today':(0,u.dayMonth)(l.payday)})]}),(0,j.jsxs)(i.Muted,{children:["period ",(0,u.rangeText)(l.start,l.end)]})]}),(0,j.jsxs)(n.ActionGrid,{testID:"paydays-actions",children:[(0,j.jsx)(n.ActionTile,{primary:!0,icon:"payroll",label:"Payroll hours",sub:"Copy or export",onPress:()=>e('more','hours'),testID:"paydays-hours"}),(0,j.jsx)(n.ActionTile,{icon:"tips",label:"Tips day",sub:"Share out tips",onPress:()=>e('more','tipsday'),testID:"paydays-tips"})]}),'settings'!==r?(0,j.jsx)(i.Button,{small:!0,kind:"ghost",label:"Pay & tips settings",onPress:()=>e('more','paysettings'),style:{alignSelf:'flex-start'}}):null]})},_e.MyPeriods=function({staffId:e}){const{rid:s,today:t,now:o,meId:n}=(0,x.useCtx)(6e4),r=e??n,{pay:a}=(0,b.useVenuePay)(s),c=(0,l.useOwner)(e=>e.attendance),p=(0,l.useOwner)(e=>e.staff.find(e=>e.id===r)),y=(0,u.wagePeriod)(a,t,0),f=(0,u.tipsPeriod)(a,t,0),w=e=>p?S(e,[p],c,o,{})[0]??null:null,T=(e,s,o)=>(0,j.jsxs)(d.default,{style:{flexGrow:1,flexBasis:160,backgroundColor:h.colours.surface,borderRadius:14,borderWidth:1,borderColor:h.colours.border,padding:12,gap:2},children:[(0,j.jsx)(i.T,{size:13,weight:"semibold",colour:h.colours.gold,children:e.toUpperCase()}),(0,j.jsxs)(i.Muted,{children:[(0,u.rangeText)(s.start,s.end)," \xb7 ",s.payday>=t?'paid':'was paid'," ",(0,u.dayMonth)(s.payday)]}),(0,j.jsxs)(i.T,{size:24,weight:"bold",children:[(0,u.decH)(o?.confirmed??0)," h"]}),(0,j.jsxs)(i.Muted,{children:["confirmed (",(0,u.hMm)(o?.confirmed??0),") \xb7 ",o?.shifts??0," shifts"]}),o?.pending?(0,j.jsxs)(i.T,{size:13,colour:h.colours.amber,children:["+ ",(0,u.decH)(o.pending)," h waiting for sign-off"]}):null]},e);return(0,j.jsx)(i.Row,{wrap:!0,gap:8,style:{alignItems:'stretch'},children:[T('This pay period',y,w(y)),T('This tips fortnight',f,w(f))]})};var s=_r(_d[0]),t=_r(_d[1]),o=_r(_d[2]),n=_r(_d[3]);_r(_d[4]);var r=e(_r(_d[5])),d=e(_r(_d[6])),i=_r(_d[7]),a=_r(_d[8]),l=_r(_d[9]),c=_r(_d[10]),u=_r(_d[11]),h=_r(_d[12]),p=_r(_d[13]),y=_r(_d[14]),f=_r(_d[15]),x=_r(_d[16]),b=_r(_d[17]),j=_r(_d[18]);const w={weekly:'Weekly',fortnightly:'Fortnightly',monthly:'Monthly'},T={none:'Keep the date',before:'Friday before',after:'Monday after'};const P=e=>`${e}${e%10==1&&11!==e?'st':e%10==2&&12!==e?'nd':e%10==3&&13!==e?'rd':'th'}`;function k({label:e,day:s,period:t}){return(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,j.jsxs)(i.T,{children:[e,": ",(0,j.jsx)(i.T,{weight:"bold",colour:h.colours.gold,children:(0,u.dayMonth)(s)})]}),(0,j.jsx)(i.Muted,{children:(0,u.rangeText)(t.start,t.end)})]})}const C=e=>{if(!e)return'';const s=new Date(e);return`${String(s.getHours()).padStart(2,'0')}:${String(s.getMinutes()).padStart(2,'0')}`};function S(e,s,t,o,n){const r=t.filter(s=>s.in&&s.date>=e.start&&s.date<=e.end);return s.map(e=>{const s=r.filter(s=>s.staffId===e.id).sort((e,s)=>e.date.localeCompare(s.date)||(e.in??'').localeCompare(s.in??'')).map(e=>{const s=(0,x.paidMins)(e,o),t=(0,l.attStatus)(e);return{a:e,date:e.date,inT:C(e.in),outT:C(e.out),brk:s.brk,paid:s.paid,status:'open'===t?'On now':'awaiting'===t?'Pending':'Confirmed'}}),t=e=>s.filter(s=>s.status===e).reduce((e,s)=>e+s.paid,0),d=t('Confirmed'),i=n[e.id];return{person:e,confirmed:d,pending:t('Pending'),open:t('On now'),shifts:s.filter(e=>'On now'!==e.status).length,days:s,rate:i,gross:null!=i?Math.round(d/60*i):void 0}}).filter(e=>e.days.length>0||e.person.active&&'owner'!==e.person.role)}const D=e=>`${l.ROLE_LABEL[e.role]}${e.job?` \xb7 ${e.job}`:''}`,M=e=>e.name.replace(' (example)',''),B=e=>null==e?'':(e/100).toFixed(2),R=e=>e.replace(/[\t\r\n]+/g,' '),z=e=>/[",\n]/.test(e)?`"${e.replace(/"/g,'""')}"`:e,v=e=>e.map(e=>e.map(R).join('\t')).join('\n'),$=e=>e.map(e=>e.map(z).join(',')).join('\r\n');function O(e,s,t,o){const n=['Name','Role','Period start','Period end','Confirmed hours','Confirmed h:mm','Pending hours','Pending h:mm','Shifts',...o?['Tips hours']:[],...t?['Rate \xa3/h','Gross \xa3']:[]],r=e.map(e=>[M(e.person),D(e.person),(0,u.ukDate)(s.start),(0,u.ukDate)(s.end),(0,u.decH)(e.confirmed),(0,u.hMm)(e.confirmed),(0,u.decH)(e.pending),(0,u.hMm)(e.pending),String(e.shifts),...o?[(0,u.decH)(e.confirmed)]:[],...t?[B(e.rate),B(e.gross)]:[]]),d=e.reduce((e,s)=>({c:e.c+s.confirmed,p:e.p+s.pending,s:e.s+s.shifts,g:e.g+(s.gross??0)}),{c:0,p:0,s:0,g:0});return[n,...r,['TOTAL','',(0,u.ukDate)(s.start),(0,u.ukDate)(s.end),(0,u.decH)(d.c),(0,u.hMm)(d.c),(0,u.decH)(d.p),(0,u.hMm)(d.p),String(d.s),...o?[(0,u.decH)(d.c)]:[],...t?['',B(d.g)]:[]]]}function H(e){return[['Name','Role','Date','In','Out','Break mins','Paid hours','Paid h:mm','Status'],...e.flatMap(e=>e.days.map(s=>[M(e.person),D(e.person),(0,u.ukDate)(s.date),s.inT,s.outT,'On now'===s.status?'':String(s.brk),'On now'===s.status?'':(0,u.decH)(s.paid),'On now'===s.status?'':(0,u.hMm)(s.paid),s.status]))]}async function I(e){if('undefined'==typeof document)return!1;try{if(navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}try{const s=document.createElement('textarea');s.value=e,s.style.position='fixed',s.style.opacity='0',document.body.appendChild(s),s.select();const t=document.execCommand('copy');return s.remove(),t}catch{return!1}}function W(e,s){const t=(0,u.nextToPay)(e,'wage',s),o=(0,u.nextToPay)(e,'tips',s),n=(0,u.wagePeriod)(e,t.period.start,-1),r=(0,u.tipsPeriod)(e,o.period.start,-1),d=e=>e.payday>=s?e.payday===s?'Pays today':`Pays ${(0,u.dayMonth)(e.payday)}`:`Paid ${(0,u.dayMonth)(e.payday)}`;return[{id:'wage',label:`Wages ${(0,u.rangeText)(t.period.start,t.period.end)}`,sub:d(t.period),period:t.period},{id:'wagePrev',label:`Wages ${(0,u.rangeText)(n.start,n.end)}`,sub:d(n),period:n},{id:'tips',label:`Tips ${(0,u.rangeText)(o.period.start,o.period.end)}`,sub:d(o.period),period:o.period},{id:'tipsPrev',label:`Tips ${(0,u.rangeText)(r.start,r.end)}`,sub:d(r),period:r}]}function N({onSet:e}){const[s,t]=(0,o.useState)(''),[n,r]=(0,o.useState)(''),a=(0,u.parseUk)(s),l=(0,u.parseUk)(n),c=!!a&&!!l&&l>=a&&(0,u.plusDays)(a,92)>=l;return(0,j.jsxs)(i.Row,{wrap:!0,gap:6,style:{alignItems:'flex-end'},children:[(0,j.jsx)(d.default,{style:{flexBasis:130,flexGrow:1},children:(0,j.jsx)(i.Field,{label:"From (DD/MM/YYYY)",value:s,onChangeText:t,placeholder:"23/10/2026"})}),(0,j.jsx)(d.default,{style:{flexBasis:130,flexGrow:1},children:(0,j.jsx)(i.Field,{label:"To (DD/MM/YYYY)",value:n,onChangeText:r,placeholder:"22/11/2026"})}),(0,j.jsx)(i.Button,{small:!0,kind:"success",label:"Show",disabled:!c,onPress:()=>c&&e((0,u.customPeriod)(a,l))}),s&&n&&!c?(0,j.jsx)(i.T,{size:13,colour:h.colours.red,children:"Use two dates, the second on or after the first, up to 3 months apart."}):null]})}const L=[150,54,62,62,48,62,70]},1008,[877,1338,30,1339,122,263,127,813,872,856,816,1110,821,1340,1010,1018,927,1111,24]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useWeekSales=F,_e.Rota=function(){const{now:e,role:t,meId:n}=(0,C.useCtx)(6e4),o=(0,f.useOwner)(e=>e.staff).filter(e=>e.active),i=(0,f.useOwner)(e=>e.shifts),h=(0,C.useHourly)(),m=(0,f.useOwner)(e=>e.availability),p=(0,f.useOwner)(e=>e.leave),x=(0,f.useOwner)(e=>e.swaps),[I,v]=(0,l.useState)(0),[D,T]=(0,l.useState)(null),[$,M]=(0,l.useState)(null),[R,P]=(0,l.useState)('week'),[z,H]=(0,l.useState)(''),[W,E]=(0,l.useState)(''),[_,q]=(0,l.useState)(''),K='staff'!==t,U=(0,b.addMins)(L(e),7*I*1440);U.setHours(0,0,0,0);const V=F(U),G=V.sales,X='none'===V.mode,J=Array.from({length:7},(e,t)=>{const s=new Date(U);return s.setDate(U.getDate()+t),(0,b.ymd)(s)}),Q=(0,f.visibleShifts)(i,K).filter(e=>e.date>=J[0]&&e.date<=J[6]),Z=(()=>{const e=new Date(U);return e.setDate(e.getDate()-7),(0,b.ymd)(e)})(),ee=Q.filter(e=>!e.published||e.changed).length,te=i.filter(e=>e.date>=Z&&e.datep.some(s=>s.staffId===e&&'approved'===s.status&&s.from<=t&&t<=s.to),ne=J.map(e=>Q.filter(t=>t.date===e).reduce((e,t)=>{return e+(A(s=t)-Y(A(s)))*(h[s.staffId]??0);var s},0)),ae=ne.reduce((e,t)=>e+t,0),oe=G.reduce((e,t)=>e+t,0),ie=(e,t)=>t?Math.round(e/t*100):0,le=K?o:o.filter(e=>e.id===n),re=(0,a.useNarrow)(),de=Math.max(0,J.indexOf((0,b.ymd)(e))),[ce,ue]=(0,l.useState)(null),he=ce??de,fe=(e,t)=>!re||t===he,me=re?150:74;return(0,B.jsxs)(c.default,{style:{gap:10},children:[(0,B.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,B.jsx)(u.Chip,{label:"Week",selected:'week'===R,onPress:()=>P('week')}),(0,B.jsx)(u.Chip,{label:`Swaps & leave (${x.filter(e=>'open'===e.status).length+p.filter(e=>'pending'===e.status).length})`,selected:'requests'===R,onPress:()=>P('requests')}),(0,B.jsx)(u.Chip,{label:"Availability",selected:'availability'===R,onPress:()=>P('availability')})]}),'week'===R?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsx)(u.Button,{small:!0,kind:"ghost",label:"\u2039 Prev",accessibilityLabel:"Previous week",onPress:()=>{v(I-1),T(null)}}),(0,B.jsxs)(c.default,{style:{alignItems:'center',flex:1},children:[(0,B.jsxs)(u.T,{weight:"semibold",children:["Week of ",(0,b.niceDate)(U)]}),(0,B.jsxs)(u.Muted,{children:[0===I?'This week':1===I?'Next week':-1===I?'Last week':I>0?`In ${I} weeks`:-I+" weeks ago",K?' \xb7 tap a cell to add or edit':' \xb7 your shifts']})]}),(0,B.jsx)(u.Button,{small:!0,kind:"ghost",label:"Next \u203a",accessibilityLabel:"Next week",onPress:()=>{v(I+1),T(null)}})]}),K?(0,B.jsxs)(u.Row,{wrap:!0,gap:8,style:{alignItems:'center'},children:[(0,B.jsx)(u.Button,{small:!0,kind:"secondary",label:"Copy last week"+(te?` (${te})`:''),disabled:!te,testID:"rota-copy",onPress:()=>{const e=f.useOwner.getState().copyWeek(Z,J[0]);T(e?`Copied ${e} ${1===e?'shift':'shifts'} from last week as drafts. Check them, then publish.`:'Nothing to copy: those days are already filled.')}}),(0,B.jsx)(u.Button,{small:!0,kind:"success",label:ee?`Publish ${ee} ${1===ee?'change':'changes'}`:'Week published',disabled:!ee,testID:"rota-publish",onPress:()=>{const e=f.useOwner.getState().publishWeek(J[0]);T(`Published ${e} ${1===e?'shift':'shifts'}. Staff see them in their app.`)}}),ee?(0,B.jsx)(u.Badge,{kind:"amber",label:`${ee} unpublished`}):Q.length?(0,B.jsx)(u.Badge,{kind:"ok",label:"Visible to staff"}):null]}):null,D?(0,B.jsx)(u.Banner,{kind:"success",title:D}):null,re?(0,B.jsx)(u.Row,{wrap:!0,gap:6,children:C.DAY3.map((e,t)=>(0,B.jsx)(u.Chip,{label:`${e} ${(0,b.parseYmd)(J[t]).getDate()}`,selected:t===he,onPress:()=>ue(t)},e))}):null,(0,B.jsx)(d.default,{horizontal:!re,showsHorizontalScrollIndicator:!0,children:(0,B.jsxs)(c.default,{style:{gap:4},children:[(0,B.jsxs)(u.Row,{gap:4,children:[(0,B.jsx)(c.default,{style:{width:126}}),C.DAY3.map((t,s)=>(0,B.jsx)(c.default,{style:{width:me,alignItems:'center'},children:(0,B.jsxs)(u.T,{size:12,weight:"semibold",colour:J[s]===(0,b.ymd)(e)?w.colours.gold:w.colours.text,children:[t," ",(0,b.parseYmd)(J[s]).getDate()]})},t)).filter(fe)]}),le.map(e=>(0,B.jsxs)(u.Row,{gap:4,children:[(0,B.jsxs)(u.Row,{gap:6,style:{width:126},children:[(0,B.jsx)(S.StaffAvatar,{id:e.id,size:26}),(0,B.jsxs)(c.default,{style:{flex:1},children:[(0,B.jsx)(u.T,{size:12,numberOfLines:1,children:e.name.replace(' (example)','')}),(0,B.jsx)(u.Muted,{numberOfLines:1,children:e.job})]})]}),C.DAY3.map((t,s)=>{const n=(0,f.shiftOf)(Q,e.id,J[s]),a=(m[e.id]??[]).includes(s),o=se(e.id,J[s]);return(0,B.jsxs)(r.default,{accessibilityRole:"button",accessibilityLabel:`${e.name} ${C.DAY3[s]} ${n?`${(0,C.fmtH)(n.start)} to ${(0,C.fmtH)(n.end)}`:'no shift'}`,disabled:!K,onPress:()=>M({staffId:e.id,date:J[s],shift:n}),style:{width:me,height:48,borderRadius:10,borderWidth:1,borderStyle:n&&!n.published?'dashed':'solid',borderColor:n?n.published?w.colours.gold:w.colours.amber:w.colours.border,backgroundColor:n?n.published?'#2b2414':'#241f14':o?'#1d2a3a':a?'#2a1d1d':'transparent',alignItems:'center',justifyContent:'center'},children:[n?(0,B.jsxs)(u.T,{size:11,weight:"semibold",children:[(0,C.fmtH)(n.start),"\u2013",(0,C.fmtH)(n.end)]}):(0,B.jsx)(u.T,{size:11,colour:w.colours.muted,children:o?'Leave':a?'Unavail.':K?'Add':'\u2013'}),n&&(a||o)?(0,B.jsx)(u.T,{size:9,colour:w.colours.red,children:o?'on leave!':'unavailable'}):n&&K&&(!n.published||n.changed)?(0,B.jsx)(u.T,{size:9,colour:w.colours.amber,children:n.published?'changed':'draft'}):null]},s)}).filter(fe)]},e.id)),K?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(u.Row,{gap:4,children:[(0,B.jsx)(c.default,{style:{width:96},children:(0,B.jsx)(u.Muted,{children:"Labour"})}),ne.map((e,t)=>(0,B.jsx)(c.default,{style:{width:me,alignItems:'center'},children:(0,B.jsx)(u.T,{size:11,children:(0,j.gbp)(e).replace('.00','')})},t)).filter(fe)]}),X?null:(0,B.jsxs)(u.Row,{gap:4,children:[(0,B.jsx)(c.default,{style:{width:96},children:(0,B.jsx)(u.Muted,{children:'example'===V.mode?'Fcst sales (ex.)':'Fcst sales'})}),G.map((e,t)=>(0,B.jsx)(c.default,{style:{width:me,alignItems:'center'},children:(0,B.jsx)(u.T,{size:11,colour:w.colours.muted,children:e?`\xa3${Math.round(e/100)}`:'shut'})},t)).filter(fe)]}),X?null:(0,B.jsxs)(u.Row,{gap:4,children:[(0,B.jsx)(c.default,{style:{width:96},children:(0,B.jsx)(u.Muted,{children:"Labour %"})}),ne.map((e,t)=>{const s=ie(e,G[t]);return(0,B.jsx)(c.default,{style:{width:me,alignItems:'center'},children:(0,B.jsx)(u.T,{size:11,weight:"semibold",colour:G[t]?s>32?w.colours.red:s>26?w.colours.amber:w.colours.ok:w.colours.muted,children:G[t]?`${s}%`:'\u2013'})},t)}).filter(fe)]})]}):null]})}),K&&X?(0,B.jsx)(u.Card,{children:(0,B.jsxs)(c.default,{testID:"labour-no-forecast",style:{gap:6},children:[(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsx)(u.T,{weight:"semibold",children:"Labour this week"}),(0,B.jsx)(c.default,{testID:"labour-week-cost",children:(0,B.jsx)(u.T,{weight:"semibold",children:(0,j.gbp)(ae)})})]}),(0,B.jsxs)(u.Muted,{children:[(0,j.gbp)(ae)," labour from the rota (paid hours \xd7 hourly rates, owner salaries excluded)."]}),(0,B.jsx)(u.T,{weight:"semibold",colour:w.colours.gold,children:"Not enough history yet for labour vs sales"}),(0,B.jsx)(u.Muted,{children:`Forecasts start once CoverCharge has ${1===V.weeks?'1 week':`${V.weeks} weeks`} of your bookings and cash-ups. Until then no sales forecast or labour % is shown.`}),V.booked?(0,B.jsx)(c.default,{testID:"labour-booked",children:(0,B.jsxs)(u.T,{children:["Booked so far: ",V.booked," covers this week"]})}):null]})}):null,K&&!X?(0,B.jsxs)(u.Card,{children:[(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsx)(u.T,{weight:"semibold",children:"Labour vs forecast sales"}),(0,B.jsxs)(u.Row,{gap:6,children:['example'===V.mode?(0,B.jsx)(O.ExampleBadge,{}):null,(0,B.jsx)(u.Badge,{kind:ie(ae,oe)>30?'red':'ok',label:`${ie(ae,oe)}% this week`})]})]}),(0,B.jsxs)(u.Muted,{children:[(0,j.gbp)(ae)," labour (paid hours \xd7 hourly rates, owner salaries excluded) vs about ",(0,j.gbp)(oe)," forecast sales. Target 25\u201330%. ",'example'===V.mode?'Example figures: forecast sales use an example spend per cover.':'Forecast sales are your average takings for each weekday from your cash-ups.']}),(()=>{const e=ie(ne[5],G[5]);return e&&e<24?(0,B.jsxs)(u.T,{size:14,colour:w.colours.gold,children:["Tip: Saturday is forecast busy and labour is only ",e,"%. Consider an extra server 18:00\u201321:00."]}):null})()]}):null,K?(0,B.jsx)(u.Muted,{center:!0,children:"New and copied shifts are drafts (dashed) until you publish. Publishing only makes shifts visible in the Staff app and on the Display. Nothing is sent by text or email."}):null]}):null,'requests'===R?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(k.SectionHead,{title:"Shift swaps & cover"}),x.filter(e=>K||e.fromId===n||e.toId===n).map(e=>{const t=i.find(t=>t.id===e.shiftId),s=o.find(t=>t.id===e.fromId),n=o.find(t=>t.id===e.toId);return(0,B.jsxs)(u.Card,{children:[(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsxs)(u.T,{weight:"semibold",style:{flex:1},children:['swap'===e.kind?'Swap':'Cover needed',": ",s?.name]}),(0,B.jsx)(u.Badge,{kind:'open'===e.status?'amber':'approved'===e.status?'ok':'neutral',label:e.status})]}),(0,B.jsxs)(u.Muted,{children:[t?`${C.DAY3[t.day]} ${(0,C.fmtH)(t.start)}\u2013${(0,C.fmtH)(t.end)}`:'Shift',n?` \u2192 ${n.name}`:''," \xb7 ",e.note]}),'open'===e.status&&K?(0,B.jsxs)(u.Row,{gap:6,children:['cover'!==e.kind||e.toId?null:o.filter(t=>t.id!==e.fromId&&'owner'!==t.role).map(t=>(0,B.jsx)(u.Chip,{label:`Give to ${t.name.split(' ')[0]}`,onPress:()=>{f.useOwner.setState(s=>({swaps:s.swaps.map(s=>s.id===e.id?{...s,toId:t.id}:s)}))}},t.id)),(0,B.jsx)(u.Button,{small:!0,label:"Approve",disabled:!e.toId,onPress:()=>{f.useOwner.getState().setSwap(e.id,'approved');const s=e=>(o.find(t=>t.id===e)?.name??'').replace(' (example)','');(0,y.autoPost)('all','swap'===e.kind?`Shift swap: ${s(e.fromId)} \u2194 ${s(e.toId)} approved`:`Cover approved: ${s(e.toId)} covers ${s(e.fromId)}${t?` (${C.DAY3[t.day]} ${(0,C.fmtH)(t.start)}\u2013${(0,C.fmtH)(t.end)})`:''}`)}}),(0,B.jsx)(u.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>f.useOwner.getState().setSwap(e.id,'declined')})]}):null]},e.id)}),K?null:(0,B.jsxs)(u.Card,{children:[(0,B.jsx)(u.T,{weight:"semibold",children:"Ask for a swap or cover"}),(0,B.jsx)(u.Muted,{children:"Your shifts this week. Your manager approves every swap."}),Q.filter(e=>e.staffId===n).sort((e,t)=>e.date.localeCompare(t.date)).map(e=>{const t=x.some(t=>t.shiftId===e.id&&'open'===t.status);return(0,B.jsxs)(c.default,{style:{gap:4,paddingVertical:4},children:[(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsxs)(u.T,{size:14,weight:"medium",children:[C.DAY3[e.day]," ",(0,C.fmtH)(e.start),"\u2013",(0,C.fmtH)(e.end)]}),t?(0,B.jsx)(u.Badge,{kind:"amber",label:"Request open"}):null]}),t?null:(0,B.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,B.jsx)(u.Chip,{label:"Ask for cover",onPress:()=>{f.useOwner.getState().addSwap({shiftId:e.id,fromId:n,kind:'cover',note:'Can anyone cover?'}),(0,y.autoPost)('all',`Cover needed: ${C.DAY3[e.day]} ${(0,C.fmtH)(e.start)}\u2013${(0,C.fmtH)(e.end)} (${(o.find(e=>e.id===n)?.name??'').replace(' (example)','')})`)}}),o.filter(e=>e.id!==n&&'staff'===e.role).map(t=>(0,B.jsx)(u.Chip,{label:`Swap with ${t.name.replace(' (example)','')}`,onPress:()=>f.useOwner.getState().addSwap({shiftId:e.id,fromId:n,toId:t.id,kind:'swap',note:'Agreed between us'})},t.id))]})]},e.id)}),Q.some(e=>e.staffId===n)?null:(0,B.jsx)(u.Muted,{children:"No shifts on the rota this week."})]}),(0,B.jsx)(k.SectionHead,{title:"Holiday & leave"}),p.filter(e=>K||e.staffId===n).map(e=>(0,B.jsxs)(u.Card,{children:[(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsx)(u.T,{weight:"semibold",children:o.find(t=>t.id===e.staffId)?.name}),(0,B.jsx)(u.Badge,{kind:'pending'===e.status?'amber':'approved'===e.status?'ok':'red',label:e.status})]}),(0,B.jsxs)(u.Muted,{children:[(0,b.niceDate)((0,b.parseYmd)(e.from))," \u2013 ",(0,b.niceDate)((0,b.parseYmd)(e.to))," \xb7 ",e.reason]}),'pending'===e.status&&K?(0,B.jsxs)(u.Row,{gap:6,children:[(0,B.jsx)(u.Button,{small:!0,label:"Approve",onPress:()=>f.useOwner.getState().setLeave(e.id,'approved')}),(0,B.jsx)(u.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>f.useOwner.getState().setLeave(e.id,'declined')})]}):null]},e.id)),(0,B.jsxs)(u.Card,{children:[(0,B.jsxs)(u.T,{weight:"semibold",children:["Request leave",K?' (as yourself)':'']}),(0,B.jsxs)(u.Row,{gap:6,children:[(0,B.jsx)(s.TextInput,{accessibilityLabel:"From date",placeholder:"From YYYY-MM-DD",placeholderTextColor:"#7D776C",value:z,onChangeText:H,style:[u.styles.input,{flex:1}]}),(0,B.jsx)(s.TextInput,{accessibilityLabel:"To date",placeholder:"To YYYY-MM-DD",placeholderTextColor:"#7D776C",value:W,onChangeText:E,style:[u.styles.input,{flex:1}]})]}),(0,B.jsx)(u.Field,{label:"Reason",value:_,onChangeText:q}),(0,B.jsx)(u.Button,{small:!0,label:"Send request",disabled:!/^\d{4}-\d{2}-\d{2}$/.test(z)||!/^\d{4}-\d{2}-\d{2}$/.test(W)||W{f.useOwner.getState().addLeave({staffId:n,from:z,to:W,reason:_.trim()||'Holiday'}),H(''),E(''),q('')}})]})]}):null,'availability'===R?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(u.Muted,{children:["Days each person can\u2019t work. ",K?'Tap to toggle.':'Tap to set your own.'," The rota flags clashes."]}),le.filter(e=>'owner'!==e.role||!K).map(e=>(0,B.jsxs)(u.Card,{children:[(0,B.jsxs)(u.Row,{gap:8,children:[(0,B.jsx)(S.StaffAvatar,{id:e.id,size:30}),(0,B.jsx)(u.T,{weight:"semibold",children:e.name})]}),(0,B.jsx)(u.Row,{wrap:!0,gap:4,children:C.DAY3.map((t,s)=>{const n=(m[e.id]??[]).includes(s);return(0,B.jsx)(u.Chip,{label:`${t} ${n?'\u2715':'\u2713'}`,selected:!n,onPress:()=>f.useOwner.getState().toggleAvail(e.id,s)},t)})})]},e.id))]}):null,$?(0,B.jsx)(N,{init:$,onClose:()=>M(null)}):null]})},_e.ClockInOut=function(){const{now:e,today:t,role:s,meId:a,me:d,r:h,rid:m}=(0,C.useCtx)(5e3),x=((0,I.useClockArea)(e=>e.areas[m]),(0,I.areaOf)(m));const j=(0,v.privateClockVenue)(m),[k,y]=(0,l.useState)(!1),O=(0,f.useOwner)(e=>e.consent[a]),R=(0,f.useOwner)(e=>e.attendance),P=(0,f.useOwner)(e=>e.shifts),[z,H]=(0,l.useState)(!1),[A,Y]=(0,l.useState)(null),[L,F]=(0,l.useState)(null),[N,_]=(0,l.useState)(void 0),[q,K]=(0,l.useState)(null),[U,V]=(0,l.useState)(!1),[G,X]=(0,l.useState)(null),J=R.filter(t=>t.staffId===a&&t.in&&!t.out&&e.getTime()-new Date(t.in).getTime()<72e6).sort((e,t)=>t.in.localeCompare(e.in))[0],Q=J&&(0,f.isOnBreak)(J)?J.breaks[J.breaks.length-1]:void 0,Z=(0,f.visibleShifts)(P,'staff'!==s).find(e=>e.staffId===a&&e.date===t),ee='staff'!==s,te=J?(0,C.paidMins)({in:J.in},e).worked:0,se=x.on&&(0,D.areaSet)(x),ne=J?.geo?.[J.geo.length-1],ae=async(s,n={})=>{Y(s),F(null),_(void 0);const l=await(0,T.clockAction)(s,{rid:m,staffId:a,date:t,at:new Date(e.getTime()).toISOString(),...n});return Y(null),l.ok?('out'===s&&l.att&&(K(l.att),(0,i.hrSettingsOf)(h.settings?.hr).on&&!o.useHr.getState().hasAnswered(m,l.att.id)&&X(l.att)),'in'===s&&K(null),!0):(F(l.message),_(l.fix),(0,$.notify)({id:'clock-blocked',tone:'warn',icon:'\ud83d\udccd',kicker:'CLOCK',title:l.message.split('. ')[0]+'.',body:l.message.split('. ').slice(1).join('. '),timeoutMs:9e3,testID:'clock-blocked'}),!1)};return O?(0,B.jsxs)(c.default,{style:{gap:10},children:[(0,B.jsxs)(u.Card,{highlight:w.colours.gold,children:[(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsxs)(u.Row,{gap:10,style:{flex:1},children:[(0,B.jsx)(S.StaffAvatar,{id:a,size:48}),(0,B.jsx)(u.T,{weight:"semibold",style:{flex:1},children:d})]}),(0,B.jsx)(u.Badge,{kind:J?'ok':'neutral',label:J?`On shift since ${(0,b.hm)(new Date(J.in))}`:'Not clocked in'})]}),(0,B.jsx)(u.Muted,{children:Z?`Today's shift: ${(0,C.fmtH)(Z.start)}\u2013${(0,C.fmtH)(Z.end)}`:'No shift on the rota today'}),(0,B.jsx)(c.default,{testID:"clock-area-line",children:(0,B.jsx)(u.T,{size:14,colour:w.colours.muted,children:se?j?`Location is checked only when you choose Clock in, at ${h.name}. Only pass or fail is saved.`:`\ud83d\udccd Your location is checked when you tap a button. You need to be at ${h.name}.`:x.on?'\ud83d\udccd The clock-in area isn\u2019t set yet, so location isn\u2019t checked.':'\ud83d\udccd Location checks are switched off for this venue.'})}),ne&&!0===ne.inside&&null!=ne.dist?(0,B.jsxs)(u.Muted,{children:["Last check: at the venue (about ",ne.dist," m from the centre)."]}):null,J?(0,B.jsx)(u.T,{size:30,weight:"bold",center:!0,children:(0,C.hmDur)(te)}):null,J&&Q?(0,B.jsx)(c.default,{testID:"on-break",children:(0,B.jsxs)(u.T,{size:15,weight:"semibold",colour:w.colours.gold,center:!0,children:["On a break since ",(0,b.hm)(new Date(Q.start))," \xb7 ",(0,f.loggedBreakMins)(J,e)," min so far"]})}):null,J?(0,B.jsxs)(B.Fragment,{children:[Q?(0,B.jsx)(u.Button,{testID:"break-end",kind:"success",label:'break_end'===A?'Checking your location\u2026':'End break',disabled:!!A,onPress:()=>{ae('break_end')}}):(0,B.jsx)(u.Button,{testID:"break-start",kind:"secondary",label:'break_start'===A?'Checking your location\u2026':'Start break',disabled:!!A,onPress:()=>{ae('break_start')}}),(0,B.jsx)(u.Button,{testID:"clock-out",kind:"danger",label:'out'===A?'Checking your location\u2026':'Clock out',disabled:!!A,onPress:()=>{J.breaks?.length?ae('out'):(F(null),H(!0))}})]}):(0,B.jsx)(u.Button,{testID:"clock-in",kind:"success",label:'in'===A?'Checking your location\u2026':'Clock in',disabled:!!A,onPress:()=>{j?y(!0):ae('in')}}),J?.breaks?.length?(0,B.jsxs)(u.Muted,{center:!0,children:["Breaks today: ",J.breaks.map(e=>`${(0,b.hm)(new Date(e.start))}\u2013${e.end?(0,b.hm)(new Date(e.end)):'now'}`).join(', ')," (",(0,f.loggedBreakMins)(J,e)," min)"]}):null,L?(0,B.jsx)(c.default,{testID:"clock-message",children:(0,B.jsx)(u.Banner,{kind:"warn",title:"Not recorded",children:L})}):null,L&&'settings'===N?(0,B.jsx)(u.Button,{testID:"clock-open-settings",label:"Open app settings",accessibilityLabel:"Open app settings, to allow location",onPress:M.openAppSettings}):null,L&&'location'===N?(0,B.jsx)(u.Button,{testID:"clock-open-location",label:"Open location settings",accessibilityLabel:"Open location settings, to turn on location",onPress:M.openLocationSettings}):null,L&&'update'===N?(0,B.jsx)(u.Button,{testID:"clock-check-update",label:"Look for the app update",accessibilityLabel:"Look for the app update",onPress:M.checkAppUpdate}):null]}),ee&&!(0,D.areaSet)(x)?(0,B.jsx)(c.default,{testID:"clock-area-warning",children:(0,B.jsx)(u.Banner,{kind:"warn",title:"Set the clock-in area",children:"Location isn\u2019t checked until a manager sets the venue\u2019s centre. Stand at the venue and go to Settings \u203a Advanced \u203a Clock-in area \u203a Use my current location."})}):null,(0,B.jsx)(r.default,{testID:"forgot-link",accessibilityRole:"button",onPress:()=>V(!0),style:{alignSelf:'center',padding:6},children:(0,B.jsx)(u.T,{size:14,colour:w.colours.gold,children:"Forgot to clock in or out?"})}),U?(0,B.jsx)(E,{onClose:()=>V(!1)}):null,(0,B.jsx)(p.BreakRoomCard,{staffId:a,name:d,now:e}),q?(()=>{const t=(0,C.paidMins)(q,e);return(0,B.jsxs)(u.Card,{highlight:w.colours.gold,children:[(0,B.jsxs)(u.T,{weight:"semibold",colour:w.colours.gold,children:["Clocked out at ",(0,b.hm)(new Date(q.out))]}),(0,B.jsxs)(u.T,{size:18,weight:"bold",children:["Clocked ",(0,C.hmDur)(t.worked),", break ",t.brk,"m, paid ",(0,C.hmDur)(t.paid)]}),(0,B.jsxs)(u.Muted,{children:["In ",(0,b.hm)(new Date(q.in))," \xb7 out ",(0,b.hm)(new Date(q.out))," \xb7 paid hours = (out \u2212 in) \u2212 break",q.breakAddedAtClockOut?' \xb7 break added at clock-out':'']}),t.worked>360&&0===t.brk?(0,B.jsx)(u.Banner,{kind:"info",title:"A note on breaks",children:"UK workers are generally entitled to a 20-minute rest break when working more than 6 hours. Your clock-out is saved; have a word with your manager if you didn\u2019t get one."}):null]})})():null,(0,B.jsx)(u.Sheet,{visible:k,onClose:()=>y(!1),title:"Why we ask for location",testID:"clock-location-reason",children:(0,B.jsxs)(c.default,{style:{gap:12},children:[(0,B.jsxs)(u.T,{children:["We check once that you are at ",h.name,", within about ",x.radius," m, when you clock in. Only pass or fail is saved, not your position. We never track you in the background."]}),(0,B.jsx)(u.T,{children:"If you refuse or are too far away, no clock-in is made. A manager can override it with a recorded reason."}),(0,B.jsx)(u.Button,{testID:"clock-location-continue",label:"Check my location and clock in",accessibilityLabel:"Check my location once and clock in at the pub",onPress:()=>{y(!1),ae('in')}}),(0,B.jsx)(u.Button,{testID:"clock-location-cancel",kind:"secondary",label:"Not now",onPress:()=>y(!1)})]})}),ee?(0,B.jsx)(W,{rid:m,today:t,now:e}):null,G?(0,B.jsx)(n.ShiftCheckout,{rid:m,shiftKey:G.id,day:G.date,meId:a,onClose:()=>X(null)}):null,(0,B.jsx)(u.Sheet,{visible:z,onClose:()=>H(!1),title:"Did you take a break? If so, how long?",children:(0,B.jsxs)(c.default,{testID:"forgot-break-prompt",style:{gap:10},children:[(0,B.jsx)(u.Muted,{children:"No break was recorded on this shift. Pick how long it was, or No break. Your manager can change it later in Hours."}),(0,B.jsx)(u.Row,{wrap:!0,gap:6,children:x.breakOptions.map(e=>(0,B.jsx)(u.Chip,{testID:`forgot-break-${e}`,label:(0,D.breakLabel)(e),disabled:e>=te,onPress:()=>{H(!1),ae('out',{addedBreak:e})}},e))}),(0,B.jsx)(u.Button,{testID:"forgot-break-none",kind:"secondary",label:"No break",onPress:()=>{H(!1),ae('out',{breakMins:0})}}),te>360?(0,B.jsx)(u.Muted,{children:"UK workers are generally entitled to a 20-minute rest break when working more than 6 hours."}):null,(0,B.jsx)(u.Muted,{children:j?'Clock-out and breaks do not use your location.':'Tip: your location is checked when you clock out, like clocking in.'})]})})]}):(0,B.jsx)(c.default,{style:{gap:10},children:(0,B.jsxs)(u.Card,{highlight:w.colours.gold,children:[(0,B.jsx)(u.T,{weight:"semibold",colour:w.colours.gold,children:"Before you clock in: location & your privacy"}),j?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(u.T,{size:14,children:["When you choose Clock in, we ask once for your phone\u2019s location to check you are at ",h.name,", within about ",x.radius," m."]}),(0,B.jsx)(u.T,{size:14,children:"Only pass or fail is kept with your clock-in time. Your map position, accuracy and distance are not saved. No location trails, background checks, clock-out checks or break checks."})]}):(0,B.jsxs)(B.Fragment,{children:[" ",(0,B.jsxs)(u.T,{size:14,children:["CoverCharge checks your phone\u2019s location ",(0,B.jsx)(u.T,{size:14,weight:"bold",children:"only at the moment you tap Clock in, Clock out, Start break or End break"}),", to confirm you are at ",h.name," (within about ",x.radius," m)."]}),(0,B.jsx)(u.T,{size:14,children:"\u2022 Your location is never tracked continuously or in the background."}),(0,B.jsx)(u.T,{size:14,children:"\u2022 With each clock record we keep that one reading (map position and how accurate the phone said it was), whether it was inside the area, and the time."}),(0,B.jsx)(u.T,{size:14,children:"\u2022 If the app is open while you\u2019re at the venue and you\u2019re not on the rota, it may ask whether you want to clock in (only if you have already allowed location)."})]}),(0,B.jsx)(u.T,{size:14,children:"\u2022 Your employer uses this for timesheets and pay (UK GDPR lawful basis: contract / legitimate interests)."}),(0,B.jsx)(u.T,{size:14,children:"\u2022 If your phone can\u2019t share its location, a manager can record it for you instead. You can see your own records anytime."}),(0,B.jsx)(u.T,{size:14,children:"\u2022 Records are kept for payroll (6 years, HMRC) and then deleted."}),(0,B.jsx)(u.Button,{label:"I understand \u2014 continue",onPress:()=>f.useOwner.getState().giveConsent(a,e.toISOString())})]})})},_e.Timesheets=function(){const{now:e,today:t,role:s,meId:n}=(0,C.useCtx)(3e4);return s!=='staff'?(0,B.jsx)(q,{now:e,today:t,meId:n}):(0,B.jsx)(_,{})};var t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),a=_r(_d[3]),o=_r(_d[4]),i=_r(_d[5]),l=_r(_d[6]),r=e(_r(_d[7])),d=e(_r(_d[8])),c=e(_r(_d[9])),u=_r(_d[10]),h=_r(_d[11]),f=_r(_d[12]),m=_r(_d[13]),p=_r(_d[14]),x=_r(_d[15]),j=_r(_d[16]),b=_r(_d[17]),w=_r(_d[18]),k=_r(_d[19]),y=_r(_d[20]),C=_r(_d[21]),S=_r(_d[22]),I=_r(_d[23]),v=_r(_d[24]),D=_r(_d[25]),T=_r(_d[26]),$=_r(_d[27]),M=_r(_d[28]),O=_r(_d[29]),R=_r(_d[30]),P=_r(_d[31]),B=_r(_d[32]);const z=2650,H=1900,A=e=>e.end-e.start,Y=e=>e>8?.5:e>6?.3333333333333333:0,L=e=>{const t=new Date(e);return t.setHours(0,0,0,0),t.setDate(t.getDate()-(0,C.weekday)(e)),t};function F(e){const{rid:t,r:s,now:n}=(0,C.useCtx)(6e4),a=(0,h.useBookings)(t),o=(0,h.useOrders)(t),i=(0,h.useEvents)(t),r=(0,O.useRealHistory)(t,n);return(0,l.useMemo)(()=>{const t=Array.from({length:7},(t,s)=>{const n=(0,b.addMins)(e,1440*s);return n.setHours(11,0,0,0),n}),n=a.filter(e=>!e.walkIn&&'confirmed'===e.status&&t.some(t=>(0,b.ymd)(t)===e.date)).reduce((e,t)=>e+t.partySize,0),l=(0,R.clampWeeks)(s.settings.forecastMinWeeks);return r?r.salesEnough?{mode:'real',weeks:l,booked:n,sales:t.map(e=>s.kitchenHours[e.getDay()]?r.takingsByDay[e.getDay()]??0:0)}:{mode:'none',weeks:l,booked:n,sales:t.map(()=>0)}:{mode:'example',weeks:l,booked:n,sales:t.map(e=>{const t=(0,x.forecastToday)(s,a,o,i,e);return t.open?t.restOfDay.covers*z+t.restOfDay.takeaway*H:0})}},[s,a,o,i,r,(0,b.ymd)(e)])}function N({init:e,onClose:t}){const s=(0,f.useOwner)(e=>e.staff),[n,a]=(0,l.useState)(e.shift?.start??12),[o,i]=(0,l.useState)(e.shift?.end??20),[r,d]=(0,l.useState)(e.shift?.breakAt),h=void 0===r||r>n&&rt.id===e.staffId);return(0,B.jsxs)(u.Sheet,{visible:!0,onClose:t,title:(0,P.shiftTitle)(m?.name??'',e.date),testID:"shift-sheet",children:[(0,B.jsx)(u.Row,{wrap:!0,gap:6,children:[['Lunch',11,16],['Dinner',16.5,22.5],['Double',11,21],['Close',17,23.5],['Late close',18,25]].map(([e,t,s])=>(0,B.jsx)(u.Chip,{label:`${e} ${(0,C.fmtH)(t)}\u2013${(0,C.fmtH)(s)}`,selected:n===t&&o===s,onPress:()=>{a(t),i(s)}},e))}),(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsx)(u.T,{children:"Start"}),(0,B.jsx)(u.Stepper,{testID:"shift-start",value:n,step:.5,min:P.SHIFT_MIN_START,max:o-1,onChange:a,format:C.fmtH,label:"Start time"})]}),(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,B.jsx)(u.T,{children:"End"}),(0,B.jsxs)(c.default,{style:{alignItems:'flex-end'},children:[(0,B.jsx)(u.Stepper,{testID:"shift-end",value:o,step:.5,min:n+1,max:P.SHIFT_MAX_END,onChange:i,format:C.fmtH,label:"End time"}),o>=24?(0,B.jsx)(u.Muted,{children:"next day"}):null]})]}),(0,B.jsxs)(u.Muted,{children:[(o-n).toFixed(1),"h scheduled",Y(o-n)?`, ${Math.round(60*Y(o-n))}m planned break`:'']}),(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,B.jsx)(u.T,{children:void 0===r?'Break: not set':'Break at'}),void 0===r?(0,B.jsx)(u.Chip,{label:"Set a break time",onPress:()=>d(Math.min(o-.5,Math.max(n+.5,Math.round(4*(n+Math.min(4,(o-n)/2)))/4)))}):(0,B.jsxs)(u.Row,{gap:6,children:[(0,B.jsx)(u.Stepper,{testID:"shift-break",value:r,step:.25,min:n+.25,max:o-.25,onChange:d,format:C.fmtH,label:"Break time"}),(0,B.jsx)(u.Chip,{label:"No set time",onPress:()=>d(void 0)})]})]}),(0,B.jsx)(u.Muted,{children:"Tip: with a break time, the person on this shift gets a break reminder at that time. Without one, they get it 4 hours after clocking in (change this in Settings, Advanced, Reminders)."}),(0,B.jsx)(u.Button,{label:e.shift?'Save shift':'Add shift',onPress:()=>{const s=f.useOwner.getState();e.shift?s.setShifts(s.shifts.map(t=>t.id===e.shift.id?{...t,start:n,end:o,breakAt:h?r:void 0,changed:!!t.published||t.changed}:t)):s.addShift({staffId:e.staffId,date:e.date,start:n,end:o,...void 0!==r&&h?{breakAt:r}:{}}),t()}}),(0,B.jsx)(u.Muted,{children:e.shift?.published?'Published: the change shows in the Staff app straight away and is marked as changed until you publish the week again.':'Draft: staff see it once you publish the week.'}),e.shift?(0,B.jsx)(u.Button,{kind:"danger",label:"Remove shift",onPress:()=>{f.useOwner.getState().removeShift(e.shift.id),t()}}):null]})}function W({rid:e,today:t,now:s}){const n=(0,f.useOwner)(e=>e.staff).filter(e=>e.active),a=(0,f.useOwner)(e=>e.attendance),o=(0,C.useSignedIn)(),{me:i,meId:r}=(0,C.useCtx)(3e4),[d,c]=(0,l.useState)(null),[h,m]=(0,l.useState)(''),[p,x]=(0,l.useState)(null),j=d?a.filter(e=>e.staffId===d&&e.in&&!e.out&&s.getTime()-new Date(e.in).getTime()<72e6)[0]:void 0,b=!!j&&(0,f.isOnBreak)(j),k=s=>{if(!d)return;const a=(0,T.managerClockAction)(s,{rid:e,staffId:d,date:t,at:(new Date).toISOString()},{id:o?.id??r,name:o?.name??i},h);if(!a.ok)return void x(a.message);const l=n.find(e=>e.id===d)?.name??'them';(0,$.notify)({id:'mgr-clock',title:`Recorded for ${l}`,body:`Reason kept with the record: ${h.trim()}`,timeoutMs:6e3}),m(''),x(null)};return(0,B.jsxs)(u.Card,{children:[(0,B.jsx)(u.T,{weight:"semibold",children:"Record it for someone"}),(0,B.jsx)(u.Muted,{children:"If someone\u2019s phone can\u2019t share its location, you can clock them in or out, or start or end their break. No location check; your reason is kept with the record."}),(0,B.jsx)(u.Row,{wrap:!0,gap:6,children:n.map(e=>(0,B.jsx)(u.Chip,{label:e.name,selected:d===e.id,onPress:()=>c(e.id)},e.id))}),d?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(u.Field,{label:"Reason (kept with the record)",value:h,onChangeText:m,placeholder:"e.g. Phone out of battery"}),(0,B.jsx)(u.Row,{wrap:!0,gap:6,children:j?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(u.Button,{kind:"secondary",label:b?'End their break':'Start their break',onPress:()=>k(b?'break_end':'break_start')}),(0,B.jsx)(u.Button,{kind:"secondary",label:"Clock them out",onPress:()=>k('out')})]}):(0,B.jsx)(u.Button,{testID:"mgr-clock-in",kind:"secondary",label:"Clock them in",onPress:()=>k('in')})}),p?(0,B.jsx)(u.T,{size:13,colour:w.colours.red,children:p}):null]}):null]})}function E({onClose:e}){const{now:t,today:s,meId:n}=(0,C.useCtx)(3e4),a=(0,f.useOwner)(e=>e.attendance),o=(0,f.useOwner)(e=>e.shifts),i=Array.from({length:7},(e,t)=>(0,b.ymd)((0,b.addMins)((0,b.parseYmd)(s),1440*-t))),[r,d]=(0,l.useState)(s),c=a.filter(e=>e.staffId===n&&e.date===r&&e.in).sort((e,t)=>t.in.localeCompare(e.in))[0],h=(0,f.visibleShifts)(o,!1).find(e=>e.staffId===n&&e.date===r),[p,x]=(0,l.useState)(c&&!c.out?'out':'in'),[j,k]=(0,l.useState)(h?Math.round(60*h.start):720),[y,S]=(0,l.useState)(h?Math.round(60*h.end):1200),[I,v]=(0,l.useState)(''),[D,T]=(0,l.useState)(!1),$=e=>`${String(Math.floor(e%1440/60)).padStart(2,'0')}:${String(e%60).padStart(2,'0')}`,M='out'!==p,O='in'!==p,R=M&&O&&y<=j,P=(e,t)=>(0,B.jsx)(u.Row,{gap:4,children:[-15,-5,5,15].map(s=>(0,B.jsx)(u.Button,{small:!0,kind:"ghost",label:s>0?`+${s}`:`${s}`,onPress:()=>e(Math.max(0,Math.min(2160,t+s)))},s))});return D?(0,B.jsxs)(u.Sheet,{visible:!0,onClose:e,title:"Request sent",children:[(0,B.jsx)(u.Banner,{kind:"success",title:"Sent to your manager",children:"They\u2019ll see it on the sign-off screen and fix the time. You\u2019ll see the change on your timesheet. Nothing is sent by text or email."}),(0,B.jsx)(u.Button,{label:"Done",onPress:e})]}):(0,B.jsxs)(u.Sheet,{visible:!0,onClose:e,title:"I forgot to clock in or out",testID:"request-sheet",children:[(0,B.jsx)(u.Muted,{children:"Pick the day and suggest the right time. Your manager checks it before it counts."}),(0,B.jsx)(u.Row,{wrap:!0,gap:6,children:i.map(e=>(0,B.jsx)(u.Chip,{label:e===s?'Today':(0,b.niceDate)((0,b.parseYmd)(e)).slice(0,10),selected:r===e,onPress:()=>d(e)},e))}),(0,B.jsxs)(u.Muted,{children:[h?`Your rota that day: ${(0,C.fmtH)(h.start)}\u2013${(0,C.fmtH)(h.end)}`:'Not on the rota that day',c?` \xb7 clocked ${(0,b.hm)(new Date(c.in))}\u2013${c.out?(0,b.hm)(new Date(c.out)):'no clock-out'}`:' \xb7 no clock record']}),(0,B.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,B.jsx)(u.Chip,{label:"Forgot to clock in",selected:'in'===p,onPress:()=>x('in')}),(0,B.jsx)(u.Chip,{label:"Forgot to clock out",selected:'out'===p,onPress:()=>x('out')}),(0,B.jsx)(u.Chip,{label:"Forgot both",selected:'both'===p,onPress:()=>x('both')})]}),M?(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsxs)(u.T,{size:18,weight:"bold",children:["In ",$(j)]}),P(k,j)]}):null,O?(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsxs)(u.T,{size:18,weight:"bold",children:["Out ",$(y),y>=1440?' (next day)':'']}),P(S,y)]}):null,R?(0,B.jsx)(u.T,{size:13,colour:w.colours.red,children:"Clock-out must be after clock-in."}):null,(0,B.jsx)(u.Field,{label:"Note for your manager (optional)",value:I,onChangeText:v,placeholder:"e.g. phone died",maxLength:200}),(0,B.jsx)(u.Button,{testID:"request-send",kind:"success",label:"Send to my manager",disabled:R,onPress:()=>{f.useOwner.getState().addTimeRequest({staffId:n,date:r,attendanceId:c?.id,kind:p,suggestedIn:M?(0,m.isoAt)(r,j):void 0,suggestedOut:O?(0,m.isoAt)(r,y):void 0,note:I.trim(),at:t.toISOString()}),T(!0)}})]})}function _(){const{now:e,today:t,meId:s}=(0,C.useCtx)(3e4),n=(0,f.useOwner)(e=>e.attendance),a=(0,f.useOwner)(e=>e.shifts),o=(0,f.useOwner)(e=>e.timeRequests),[i,r]=(0,l.useState)(!1),[d,h]=(0,l.useState)(null),p=(0,b.ymd)(L(e)),x=n.filter(e=>e.staffId===s&&e.in&&e.date>=(0,b.ymd)((0,b.addMins)((0,b.parseYmd)(t),-38880))).sort((e,t)=>t.date.localeCompare(e.date)||t.in.localeCompare(e.in)),j=x.filter(e=>e.date>=p),y=j.filter(f.isConfirmed).reduce((t,s)=>t+(0,C.paidMins)(s,e).paid,0),S=j.filter(e=>!(0,f.isConfirmed)(e)).reduce((t,s)=>t+(0,C.paidMins)(s,e).paid,0),I=o.filter(e=>e.staffId===s).sort((e,t)=>t.at.localeCompare(e.at)).slice(0,6);return(0,B.jsxs)(c.default,{style:{gap:10},testID:"my-timesheet",children:[(0,B.jsxs)(u.Card,{children:[(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between',alignItems:'flex-end'},children:[(0,B.jsxs)(c.default,{children:[(0,B.jsx)(u.T,{size:12,colour:w.colours.muted,children:"CONFIRMED THIS WEEK"}),(0,B.jsx)(u.T,{size:28,weight:"bold",colour:w.colours.ok,children:(0,C.hmDur)(y)})]}),(0,B.jsxs)(c.default,{style:{alignItems:'flex-end'},children:[(0,B.jsx)(u.T,{size:12,colour:w.colours.muted,children:"PENDING SIGN-OFF"}),(0,B.jsx)(u.T,{size:18,weight:"semibold",colour:S?w.colours.amber:w.colours.muted,children:(0,C.hmDur)(S)})]})]}),(0,B.jsx)(u.Muted,{children:"Your manager signs off your hours. Only confirmed hours count for pay. You can\u2019t change your own times; ask for a correction instead."})]}),(0,B.jsx)(u.Button,{testID:"forgot-clock",kind:"secondary",label:"I forgot to clock in or out",onPress:()=>r(!0)}),I.length?(0,B.jsx)(k.SectionHead,{title:"My correction requests"}):null,I.map(e=>(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between',paddingVertical:4},children:[(0,B.jsxs)(c.default,{style:{flex:1},children:[(0,B.jsxs)(u.T,{size:14,children:[(0,b.niceDate)((0,b.parseYmd)(e.date))," \xb7 ",'in'===e.kind?'Forgot to clock in':'out'===e.kind?'Forgot to clock out':'Forgot both']}),(0,B.jsxs)(u.Muted,{children:[e.suggestedIn?`in ${(0,b.hm)(new Date(e.suggestedIn))} `:'',e.suggestedOut?`out ${(0,b.hm)(new Date(e.suggestedOut))}`:'',e.resolvedBy?` \xb7 ${'applied'===e.status?'applied':'declined'} by ${e.resolvedBy.replace(' (example)','')}`:'']})]}),(0,B.jsx)(u.Badge,{kind:'open'===e.status?'blue':'applied'===e.status?'ok':'neutral',label:'open'===e.status?'Waiting':'applied'===e.status?'Applied':'Declined'})]},e.id)),(0,B.jsx)(k.SectionHead,{title:"My shifts",sub:"Last 4 weeks"}),x.map(t=>{const s=(0,f.shiftOf)((0,f.visibleShifts)(a,!1),t.staffId,t.date),n=(0,C.paidMins)(t,e),o=t.audit?.filter(e=>'confirmed'!==e.action).slice(-1)[0];return(0,B.jsxs)(u.Card,{onPress:()=>h(d===t.id?null:t.id),children:[(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsxs)(c.default,{style:{flex:1},children:[(0,B.jsx)(u.T,{weight:"semibold",children:(0,b.niceDate)((0,b.parseYmd)(t.date))}),(0,B.jsxs)(u.Muted,{children:[(0,b.hm)(new Date(t.in)),"\u2013",t.out?(0,b.hm)(new Date(t.out)):'on now',t.out?` \xb7 ${n.brk}m break \xb7 ${(0,C.hmDur)(n.paid)} paid`:'',s?` \xb7 rota ${(0,C.fmtH)(s.start)}\u2013${(0,C.fmtH)(s.end)}`:'']})]}),(0,B.jsx)(u.Badge,{kind:(0,m.statusKind)(t),label:'awaiting'===(0,f.attStatus)(t)?t.adjusted?'Adjusted \xb7 pending':'Pending':(0,m.statusLabel)(t)})]}),o?(0,B.jsxs)(u.T,{size:13,colour:w.colours.gold,children:["Adjusted by ",o.by.replace(' (example)',''),o.reason?`: ${o.reason}`:'']}):null,t.signOff?(0,B.jsxs)(u.Muted,{children:["Confirmed by ",t.signOff.by.replace(' (example)','')]}):null,d===t.id?(0,B.jsx)(m.AuditTrail,{a:t}):null]},t.id)}),x.length?null:(0,B.jsx)(u.Muted,{children:"No clocked shifts yet."}),i?(0,B.jsx)(E,{onClose:()=>r(!1)}):null]})}function q({now:e,today:s}){const n=(0,f.useOwner)(e=>e.staff),o=(0,f.useOwner)(e=>e.shifts),i=(0,C.useHourly)(),d=(0,f.useOwner)(e=>e.attendance),h=(0,f.useOwner)(e=>e.timeRequests),p=(0,f.useOwner)(e=>e.attLog),[x,y]=(0,l.useState)(s),[I,v]=(0,l.useState)(null),[D,T]=(0,l.useState)(!1),$=!!(0,C.useSignedIn)(),M=Array.from({length:7},(e,t)=>(0,b.ymd)((0,b.addMins)((0,b.parseYmd)(s),1440*-t))),O=d.filter(e=>e.date===x&&e.in),R=o.filter(e=>e.date===x&&!1!==e.published).filter(e=>!O.some(t=>t.staffId===e.staffId)),P=d.filter(e=>M.includes(e.date)&&e.out),z=P.filter(f.isConfirmed),H=z.reduce((t,s)=>t+(0,C.paidMins)(s,e).paid,0),A=P.filter(e=>!(0,f.isConfirmed)(e)).reduce((t,s)=>t+(0,C.paidMins)(s,e).paid,0),Y=z.reduce((t,s)=>t+(0,C.paidMins)(s,e).paid/60*(i[s.staffId]??0),0),L=['Staff,Date,Rostered,In,Out,Break (min),Paid hours,Rate,Pay,Status,Confirmed by,Tax note'].concat(z.sort((e,t)=>e.date.localeCompare(t.date)).map(t=>{const s=n.find(e=>e.id===t.staffId),a=(0,f.shiftOf)(o,t.staffId,t.date),l=(0,C.paidMins)(t,e),r=i[t.staffId]??0;return`${s?.name},${t.date},${a?`${(0,C.fmtH)(a.start)}-${(0,C.fmtH)(a.end)}`:'-'},${(0,b.hm)(new Date(t.in))},${(0,b.hm)(new Date(t.out))},${l.brk},${(l.paid/60).toFixed(2)},${(r/100).toFixed(2)},${(l.paid/60*r/100).toFixed(2)},${t.adjusted?'Confirmed (adjusted)':'Confirmed'},${t.signOff?.by??''},${s?.salaried?'Owner, no hourly wage':null==i[t.staffId]?'Rate not set':s?.noTax&&$?'No tax deducted':''}`}));return(0,B.jsxs)(c.default,{style:{gap:10},children:[(0,B.jsx)(u.Row,{wrap:!0,gap:6,children:M.map(e=>(0,B.jsx)(u.Chip,{label:e===s?'Today':(0,b.niceDate)((0,b.parseYmd)(e)).slice(0,6),selected:x===e,onPress:()=>y(e)},e))}),(0,B.jsxs)(u.Card,{children:[(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsx)(u.T,{weight:"semibold",children:"Last 7 days"}),(0,B.jsx)(u.Badge,{kind:"ok",label:`${(0,C.hmDur)(H)} confirmed`})]}),A?(0,B.jsxs)(u.T,{size:13,colour:w.colours.amber,children:[(0,C.hmDur)(A)," pending sign-off (not counted yet)"]}):null,(0,B.jsxs)(u.Muted,{children:["Labour cost ",(0,j.gbp)(Math.round(Y))," from confirmed hours (paid hours \xd7 hourly rates; owner salaries excluded). Sign off in Team \u203a Sign off hours."]})]}),(0,B.jsx)(a.WideTable,{children:(0,B.jsxs)(c.default,{style:{gap:2},children:[(0,B.jsx)(a.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:w.colours.border,paddingBottom:4},children:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''].map((e,t)=>(0,B.jsx)(u.T,{size:12,weight:"semibold",colour:w.colours.gold,style:{width:[110,86,52,52,52,74,120,140,50][t]},children:e},e+t))}),O.map(t=>{const i=n.find(e=>e.id===t.staffId),l=(0,f.shiftOf)(o,t.staffId,x),d=(0,C.paidMins)(t,e),c=(0,m.flagsFor)(t,l,e,s,h).map(e=>e.label);return(0,B.jsxs)(a.TRow,{heads:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,B.jsxs)(u.Row,{gap:4,style:{width:110},children:[(0,B.jsx)(S.StaffAvatar,{id:t.staffId,size:20,ring:!1}),(0,B.jsx)(u.T,{size:12,style:{flex:1},numberOfLines:1,children:i?.name.replace(' (example)','')})]}),(0,B.jsx)(u.T,{size:12,style:{width:86},colour:w.colours.muted,children:l?`${(0,C.fmtH)(l.start)}\u2013${(0,C.fmtH)(l.end)}`:'\u2013'}),(0,B.jsx)(u.T,{size:12,style:{width:52},children:(0,b.hm)(new Date(t.in))}),(0,B.jsx)(u.T,{size:12,style:{width:52},children:t.out?(0,b.hm)(new Date(t.out)):'on'}),(0,B.jsx)(u.T,{size:12,style:{width:52},children:t.out?`${d.brk}m`:'\u2013'}),(0,B.jsx)(u.T,{size:12,weight:"semibold",style:{width:74},children:t.out?(0,C.hmDur)(d.paid):`${(0,C.hmDur)(d.worked)}\u2026`}),(0,B.jsx)(u.T,{size:11,style:{width:120},colour:'confirmed'===(0,f.attStatus)(t)?w.colours.ok:'open'===(0,f.attStatus)(t)?w.colours.blue:w.colours.amber,children:(0,m.statusLabel)(t)}),(0,B.jsx)(u.T,{size:11,style:{width:140},colour:c.length?w.colours.amber:w.colours.ok,children:c.join(', ')||'OK'}),(0,B.jsx)(r.default,{accessibilityRole:"button",accessibilityLabel:`Edit ${i?.name}`,onPress:()=>v(t),style:{width:50,minHeight:44,justifyContent:'center'},children:(0,B.jsx)(u.T,{size:12,colour:w.colours.gold,children:"Edit"})})]},t.id)}),R.map(t=>(0,B.jsxs)(a.TRow,{heads:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''],style:{paddingVertical:6},children:[(0,B.jsx)(u.T,{size:12,style:{width:110},children:n.find(e=>e.id===t.staffId)?.name.replace(' (example)','')}),(0,B.jsxs)(u.T,{size:12,style:{width:86},colour:w.colours.muted,children:[(0,C.fmtH)(t.start),"\u2013",(0,C.fmtH)(t.end)]}),(0,B.jsx)(u.T,{size:12,colour:x===s&&60*t.start>60*e.getHours()+e.getMinutes()?w.colours.muted:w.colours.red,children:x===s&&60*t.start>60*e.getHours()+e.getMinutes()?'Not started yet':'No clock-in'})]},t.id))]})}),O.length||R.length?null:(0,B.jsx)(u.Muted,{children:"No shifts or clock records for this day."}),(0,B.jsx)(u.Muted,{children:"Paid hours = (clock-out \u2212 clock-in) \u2212 break. Only confirmed hours count for pay, tips and the export."}),(0,B.jsx)(u.Button,{kind:"secondary",label:"Payroll export (CSV preview)",onPress:()=>T(!0)}),(0,B.jsx)(k.SectionHead,{title:"Audit log",sub:"Every manual change and sign-off"}),p.length?p.slice(0,12).map(e=>(0,B.jsxs)(u.Muted,{children:[(0,b.niceDate)(new Date(e.at))," ",(0,b.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,B.jsx)(u.Muted,{children:"No manual changes yet."}),I?(0,B.jsx)(m.OverrideSheet,{a:I,staffId:I.staffId,date:I.date,onClose:()=>v(null)}):null,(0,B.jsxs)(u.Sheet,{visible:D,onClose:()=>T(!1),title:"Payroll export",children:[(0,B.jsxs)(u.Banner,{kind:"demo",title:"Preview: nothing is sent",children:["Confirmed hours only. ",A?`${(0,C.hmDur)(A)} still pending sign-off is left out.`:'']}),(0,B.jsxs)(c.default,{style:{backgroundColor:(0,t.soutersSurface)('#111'),borderRadius:8,padding:8},children:[L.slice(0,14).map((e,t)=>(0,B.jsx)(u.T,{size:10,colour:t?w.colours.text:w.colours.gold,children:e},t)),L.length>14?(0,B.jsxs)(u.Muted,{children:["\u2026 ",L.length-14," more rows"]}):null]}),(0,B.jsxs)(u.Muted,{children:[L.length-1," confirmed rows \xb7 paid hours (after breaks)."]})]})]})}},1009,[868,877,998,1338,1151,1152,30,263,151,127,813,819,856,1342,1029,870,816,818,821,1018,999,927,953,1207,988,954,1103,947,1290,1305,1303,1030,24]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"category",{enumerable:!0,get:function(){return C}}),_e.allocate=S,_e.Tips=function({go:e}={}){const{rid:w,now:M,today:v,role:$,meId:P,me:B}=(0,x.useCtx)(6e4),I=(0,a.useOwner)(e=>e.staff),R=(0,a.useOwner)(e=>e.attendance),A=(0,a.useOwner)(e=>e.shifts),F=(0,a.useOwner)(e=>e.tronc),D=(0,a.useOwner)(e=>e.troncCash),E=(0,a.useOwner)(e=>e.troncHistory),z=(0,a.useOwner)(e=>e.troncLog),L=(0,d.useOrders)(w),q=(0,f.useVenuePay)(w).pay,[V,N]=(0,n.useState)(-1),[H,_]=(0,n.useState)(''),[Y,K]=(0,n.useState)(!1),[W,U]=(0,n.useState)(!1),[G,Q]=(0,n.useState)(F.text),[J,X]=(0,n.useState)(null),Z='staff'!==$,ee='owner'===$,{s:te,e:se,key:oe}=(0,f.venueRange)(q,'tips',V,M),ne=`${(0,u.niceDate)(te)} \u2013 ${(0,u.niceDate)(se)} ${se.getFullYear()}`,ie=E.find(e=>e.key===oe),re=e=>a.useOwner.getState().setOwner({tronc:{...F,...e}}),le=(0,j.useSync)(e=>!!e.venueId&&'guest'!==e.kind),de=Math.round((se.getTime()-te.getTime())/864e5)+1,ae=(0,n.useMemo)(()=>{let e=L.filter(e=>e.createdAt.slice(0,10)>=(0,u.ymd)(te)&&e.createdAt.slice(0,10)<=(0,u.ymd)(se)).reduce((e,t)=>e+(t.tip??0),0);if(!o.LIVE_VENUE_BUILD&&!le)for(let t=0;tM)break;const o=(0,x.weekday)(s);0!==o&&1!==o&&(e+=Math.round(6e3+9e3*(0,y.hash)((0,u.ymd)(s)+'tip')))}return e},[oe,L.length,le]),ce=D[oe]??0,ue=ie?ie.pot:ae+ce,he=(0,n.useMemo)(()=>{const e={};for(let t=0;tv)break;const o=(0,u.ymd)(s);I.forEach(t=>{const s=R.filter(e=>e.staffId===t.id&&e.date===o&&e.out),n=s.filter(a.isConfirmed).reduce((e,t)=>e+(0,x.paidMins)(t,M).paid,0),i=s.filter(e=>!(0,a.isConfirmed)(e)).reduce((e,t)=>e+(0,x.paidMins)(t,M).paid,0);(n||i)&&(e[t.id]={paid:(e[t.id]?.paid??0)+n,est:(e[t.id]?.est??!1)||i>0})})}return e},[oe,R.length,A.length,I.length]),pe=I.filter(e=>e.active&&('staff'===e.role||'manager'===e.role&&F.includeManagers||'owner'===e.role&&F.includeOwner)),me=(0,n.useMemo)(()=>{if(ie)return ie.rows;const e=pe.map(e=>{const t=(he[e.id]?.paid??0)/60,s=F.points[C(e)]??1;return'hours'===F.method?t:'points'===F.method?t*s:'equal'===F.method?t>0?1:0:F.custom[e.id]??0}),{amounts:t}=S(ue,e),s=e.reduce((e,t)=>e+t,0);return pe.map((o,n)=>({staffId:o.id,hours:(he[o.id]?.paid??0)/60,points:F.points[C(o)]??1,pct:s?e[n]/s*100:0,amount:t[n]}))},[ie,pe.map(e=>e.id).join(),he,F,ue]),ge=me.reduce((e,t)=>e+t.amount,0),xe=ie?0:(()=>{const e=me.map(e=>e.pct);return S(ue,e).remainder})(),fe=Object.entries(F.custom).filter(([e])=>pe.some(t=>t.id===e)).reduce((e,[,t])=>e+t,0),ye='custom'===F.method&&Math.abs(fe-100)>.01,je=new Date(se.getFullYear(),se.getMonth()+2,0),we=[...E].sort((e,t)=>t.end.localeCompare(e.end))[0],be=0!==E.length&&(0,u.parseYmd)(we.end)<(0,u.addMins)(M,-89280),Te=['Staff,Category,Paid hours,Points,Share %,Amount \xa3'].concat(me.map(e=>{const t=I.find(t=>t.id===e.staffId);return`${k(t.name)},${C(t)},${e.hours.toFixed(2)},${e.points},${e.pct.toFixed(2)},${(e.amount/100).toFixed(2)}`}),[`TOTAL,,,,100.00,${(ge/100).toFixed(2)}`]);return Z?(0,b.jsxs)(r.default,{style:{gap:10},children:[(0,b.jsxs)(l.Card,{highlight:h.colours.gold,children:[(0,b.jsx)(l.T,{weight:"semibold",children:"Quick split: Tips day"}),(0,b.jsx)(l.Muted,{children:"Enter the total and it's shared by confirmed hours for the fortnight, to the penny. Tips periods follow your pay dates (Settings \u203a Pay & tips)."}),(0,b.jsxs)(l.Row,{wrap:!0,gap:6,children:[(0,b.jsx)(l.Button,{small:!0,kind:"success",label:"Open Tips day",onPress:()=>e?.('more','tipsday')}),(0,b.jsx)(l.Button,{small:!0,kind:"ghost",label:"Pay & tips settings",onPress:()=>e?.('more','paysettings')})]})]}),(0,b.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(l.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",onPress:()=>N(V-1)}),(0,b.jsxs)(r.default,{style:{alignItems:'center',flex:1},children:[(0,b.jsx)(l.T,{weight:"semibold",children:ne}),ie?(0,b.jsx)(l.Badge,{kind:"ok",label:`Approved & locked ${ie.lockedAt}`}):V>=0?(0,b.jsx)(l.Badge,{kind:"amber",label:"Period in progress"}):(0,b.jsx)(l.Badge,{kind:"neutral",label:"Not yet approved"})]}),(0,b.jsx)(l.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:V>=0,onPress:()=>N(V+1)})]}),(0,b.jsxs)(l.Card,{children:[(0,b.jsx)(l.T,{weight:"semibold",children:"Tip pot"}),(0,b.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(l.T,{children:"Card tips on orders"}),(0,b.jsx)(l.T,{children:(0,c.gbp)(ie?ie.card:ae)})]}),(0,b.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(l.T,{children:"Cash tips"}),(0,b.jsx)(l.T,{children:(0,c.gbp)(ie?ie.cash:ce)})]}),ie?null:(0,b.jsxs)(l.Row,{gap:6,children:[(0,b.jsx)(s.TextInput,{accessibilityLabel:"Cash tips \xa3",placeholder:"Cash tips \xa3",placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",value:H,onChangeText:_,style:[l.styles.input,{flex:1}]}),(0,b.jsx)(l.Button,{small:!0,kind:"secondary",label:"Set cash",disabled:!(Number(H)>=0)||''===H.trim(),onPress:()=>{a.useOwner.getState().setOwner({troncCash:{...D,[oe]:Math.round(100*Number(H))}}),_('')}})]}),(0,b.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(l.T,{weight:"bold",children:"Total pot"}),(0,b.jsx)(l.T,{size:20,weight:"bold",colour:h.colours.gold,children:(0,c.gbp)(ue)})]}),(0,b.jsx)(l.Muted,{children:le?'Card tips are the tips taken on orders in CoverCharge. Add cash tips above.':'Card tips are the tips on orders saved on this device (not connected to your venue yet).'})]}),ie?(0,b.jsxs)(l.Muted,{children:["Locked with method: ",T[ie.method],"."]}):(0,b.jsxs)(l.Card,{children:[(0,b.jsx)(l.T,{weight:"semibold",children:"Split method (venue policy)"}),(0,b.jsx)(l.Row,{wrap:!0,gap:6,children:Object.keys(T).map(e=>(0,b.jsx)(l.Chip,{label:T[e],selected:F.method===e,onPress:()=>ee&&re({method:e})},e))}),ee?null:(0,b.jsx)(l.Muted,{children:"Only the owner can change the policy."}),'points'===F.method?Object.entries(F.points).map(([e,t])=>(0,b.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(l.T,{children:e}),(0,b.jsx)(l.Row,{gap:6,children:(0,b.jsx)(l.Stepper,{value:t,step:.1,min:0,max:2,onChange:t=>ee&&re({points:{...F.points,[e]:Math.round(10*t)/10}}),format:e=>e.toFixed(1),label:`${e} points`})})]},e)):null,'custom'===F.method?(0,b.jsxs)(b.Fragment,{children:[pe.map(e=>(0,b.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(l.T,{style:{flex:1},children:k(e.name)}),(0,b.jsx)(s.TextInput,{accessibilityLabel:`${e.name} percent`,keyboardType:"decimal-pad",defaultValue:String(F.custom[e.id]??''),placeholder:"%",placeholderTextColor:"#7D776C",onEndEditing:t=>re({custom:{...F.custom,[e.id]:Number(t.nativeEvent.text)||0}}),onBlur:t=>{const s=Number(t?.target?.value??t?.nativeEvent?.text);Number.isFinite(s)&&re({custom:{...a.useOwner.getState().tronc.custom,[e.id]:s}})},style:[l.styles.input,{width:80,paddingVertical:4}]})]},e.id)),(0,b.jsxs)(l.T,{size:13,colour:ye?h.colours.red:h.colours.ok,children:["Total ",fe.toFixed(1),"%",ye?' (must be 100%)':' \u2713']})]}):null,(0,b.jsx)(l.Toggle,{label:"Include managers",value:F.includeManagers,onChange:e=>ee&&re({includeManagers:e})}),(0,b.jsx)(l.Toggle,{label:"Include owner",value:F.includeOwner,onChange:e=>ee&&re({includeOwner:e})}),F.includeOwner?(0,b.jsx)(l.Banner,{kind:"warn",title:"Owner included",children:"Employers must not keep tips. An owner may only share in tips for qualifying work they personally do; check the statutory Code of Practice before including yourself."}):null]}),(0,b.jsx)(i.default,{horizontal:!0,children:(0,b.jsxs)(r.default,{children:[(0,b.jsx)(l.Row,{gap:0,style:{borderBottomWidth:1,borderColor:h.colours.border,paddingBottom:4},children:['Staff','Paid hrs','Points','Share','Amount'].map((e,t)=>(0,b.jsx)(l.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{width:[130,70,54,64,80][t]},children:e},e))}),me.map(e=>{const t=I.find(t=>t.id===e.staffId);return(0,b.jsxs)(l.Row,{gap:0,style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,b.jsxs)(l.T,{size:13,style:{width:130},numberOfLines:1,children:[k(t?.name),he[e.staffId]?.est&&!ie?'*':'']}),(0,b.jsx)(l.T,{size:13,style:{width:70},children:e.hours.toFixed(2)}),(0,b.jsx)(l.T,{size:13,style:{width:54},children:'points'===F.method||'points'===ie?.method?e.points.toFixed(1):'\u2013'}),(0,b.jsxs)(l.T,{size:13,style:{width:64},children:[e.pct.toFixed(1),"%"]}),(0,b.jsx)(l.T,{size:13,weight:"semibold",style:{width:80},children:(0,c.gbp)(e.amount)})]},e.staffId)}),(0,b.jsxs)(l.Row,{gap:0,style:{paddingVertical:6},children:[(0,b.jsx)(l.T,{size:13,weight:"bold",style:{width:318},children:"Total"}),(0,b.jsx)(l.T,{size:13,weight:"bold",colour:ge===ue?h.colours.ok:h.colours.red,style:{width:80},children:(0,c.gbp)(ge)})]})]})}),(0,b.jsxs)(l.Muted,{children:[ge===ue?`\u2713 Total equals the pot (${(0,c.gbp)(ue)}).`:'\u2717 Total does not equal the pot.',xe?` Rounding: ${xe}p left after rounding down went to the largest fractions, 1p each.`:''," * has hours still awaiting sign-off, which don\u2019t count until a manager confirms them. Paid hours already exclude breaks."]}),ie?null:(0,b.jsx)(l.Button,{label:"Approve & lock period",disabled:!ee||V>=0||ye||ge!==ue||ue<=0,onPress:()=>{const e=`${(0,u.niceDate)(M)} ${M.toTimeString().slice(0,5)}`,t={id:`tp-${oe}`,key:oe,label:ne,end:(0,u.ymd)(se),pot:ue,card:ae,cash:ce,method:F.method,rows:me,lockedAt:e,by:B};a.useOwner.getState().setOwner({troncHistory:[t,...E],troncLog:[{id:`tl-${Date.now()}`,at:M.toISOString(),text:`${B} approved & locked tips for ${ne}: ${(0,c.gbp)(ue)} split ${T[F.method].toLowerCase()} between ${me.filter(e=>e.amount>0).length} staff`},...z]})}}),!ie&&V>=0?(0,b.jsx)(l.Muted,{center:!0,children:"The current period can be approved once it has ended."}):null,ee||ie?null:(0,b.jsx)(l.Muted,{center:!0,children:"Only the owner can approve tips."}),(0,b.jsxs)(l.Row,{wrap:!0,gap:6,children:[(0,b.jsx)(l.Button,{small:!0,kind:"secondary",label:"Export CSV / PDF summary",onPress:()=>K(!0)}),ie?(0,b.jsx)(l.Button,{small:!0,kind:"secondary",label:ie.shared?'Shared \u2713':'Share with staff (chat)',disabled:!!ie.shared,onPress:()=>{(0,p.autoPost)('all',`Tips for ${ne} approved: ${(0,c.gbp)(ie.pot)} shared between ${ie.rows.filter(e=>e.amount>0).length} staff. See your own share in Team \u203a Tips.`),a.useOwner.getState().setOwner({troncHistory:E.map(e=>e.id===ie.id?{...e,shared:(0,u.niceDate)(M)}:e)}),X('Posted to All staff chat. Demo, nothing is sent.')}}):null]}),J?(0,b.jsx)(l.Banner,{kind:"demo",title:J}):null,(0,b.jsx)(m.SectionHead,{title:"Compliance checklist",sub:"Employment (Allocation of Tips) Act 2023, in force since 1 Oct 2024. Summary only, not legal advice."}),(0,b.jsxs)(l.Card,{children:[[[!0,'100% of qualifying tips passed to workers, no deductions',`Pot ${(0,c.gbp)(ue)} = allocated ${(0,c.gbp)(ge)}`],[F.text.trim().length>40,'Written tipping policy, available to staff','Stored in the app (template below)'],[!be,'Tips allocated by the end of the following month',`This period: by ${(0,u.niceDate)(je)} ${je.getFullYear()}`],[!0,'Tip records kept for 3 years',`${E.length} approved period(s) in the history`],[!0,'Staff can request their tip records',`${z.filter(e=>/requested/.test(e.text)).length} request(s) logged`]].map(([e,t,s])=>(0,b.jsxs)(l.Row,{style:{alignItems:'flex-start'},children:[(0,b.jsx)(l.T,{colour:e?h.colours.ok:h.colours.red,children:e?'\u2713':'\u2717'}),(0,b.jsxs)(r.default,{style:{flex:1},children:[(0,b.jsx)(l.T,{size:14,children:t}),(0,b.jsx)(l.Muted,{children:s})]})]},String(t))),(0,b.jsx)(l.Button,{small:!0,kind:"ghost",label:"View / edit tipping policy",onPress:()=>{Q(F.text),U(!0)}})]}),(0,b.jsx)(m.SectionHead,{title:"Tip history & audit log"}),E.map(e=>(0,b.jsxs)(l.Card,{children:[(0,b.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(l.T,{weight:"semibold",children:e.label}),(0,b.jsx)(l.T,{weight:"bold",children:(0,c.gbp)(e.pot)})]}),(0,b.jsxs)(l.Muted,{children:[T[e.method]," \xb7 ",e.rows.filter(e=>e.amount>0).length," staff \xb7 locked ",e.lockedAt," by ",e.by,e.shared?` \xb7 shared ${e.shared}`:'']})]},e.id)),z.map(e=>(0,b.jsxs)(l.Muted,{children:[(0,u.niceDate)(new Date(e.at))," \xb7 ",e.text]},e.id)),E.length||z.length?null:(0,b.jsx)(l.Muted,{children:"No approved periods yet."}),(0,b.jsxs)(l.Sheet,{visible:Y,onClose:()=>K(!1),title:"Tips summary export",children:[(0,b.jsx)(l.Banner,{kind:"demo",title:"Payroll export: not set up yet",children:"Nothing is sent. This will download a CSV or PDF payslip summary for payroll."}),(0,b.jsx)(r.default,{style:{backgroundColor:(0,t.soutersSurface)('#111'),borderRadius:8,padding:8},children:Te.map((e,t)=>(0,b.jsx)(l.T,{size:11,colour:t?h.colours.text:h.colours.gold,children:e},t))}),(0,b.jsxs)(l.Muted,{children:[ne," \xb7 ",T[ie?.method??F.method]]})]}),(0,b.jsxs)(l.Sheet,{visible:W,onClose:()=>U(!1),title:"Tipping policy",children:[(0,b.jsx)(s.TextInput,{accessibilityLabel:"Tipping policy",multiline:!0,editable:ee,value:G,onChangeText:Q,style:[l.styles.input,{minHeight:220,textAlignVertical:'top'}]}),ee?(0,b.jsx)(l.Button,{label:"Save policy",onPress:()=>{re({text:G}),U(!1)}}):null,(0,b.jsx)(l.Muted,{children:"Template only. Adapt it to your business."})]})]}):(0,b.jsx)(O,{})},_e.MyTips=O;var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),n=_r(_d[3]),i=e(_r(_d[4])),r=e(_r(_d[5])),l=_r(_d[6]),d=_r(_d[7]),a=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),p=_r(_d[12]),m=_r(_d[13]),x=_r(_d[14]),f=_r(_d[15]),y=_r(_d[16]),j=_r(_d[17]),w=_r(_d[18]),b=_r(_d[19]);const T={hours:'By paid hours',points:'Hours \xd7 role points',equal:'Equal share',custom:'Custom %'},C=e=>'staff'!==e.role?'Manager':/porter|KP/i.test(e.job)?'KP':/kitchen|chef/i.test(e.job)?'Kitchen':/bar/i.test(e.job)?'Bar':'FOH',k=e=>(e??'').replace(' (example)','');function S(e,t){const s=t.reduce((e,t)=>e+t,0);if(!s||e<=0)return{amounts:t.map(()=>0),remainder:0};const o=t.map(t=>e*t/s),n=o.map(Math.floor);let i=e-n.reduce((e,t)=>e+t,0);const r=i;return o.map((e,t)=>({i:t,f:e-Math.floor(e)})).sort((e,t)=>t.f-e.f).forEach(({i:e})=>{i>0&&(n[e]+=1,i-=1)}),{amounts:n,remainder:r}}function O({staffId:e}={}){const t=(0,x.useCtx)(6e4),{now:s,me:o}=t,i=e??t.meId,d=(0,a.useOwner)(e=>e.tronc),u=(0,a.useOwner)(e=>e.troncHistory),p=(0,a.useOwner)(e=>e.troncLog),[m,f]=(0,n.useState)(!1),[y,j]=(0,n.useState)(null),C=u.flatMap(e=>e.rows.filter(e=>e.staffId===i).map(t=>({h:e,r:t})));return(0,b.jsxs)(r.default,{style:{gap:10},children:[(0,b.jsx)(w.TipGoalCard,{staffId:i}),(0,b.jsxs)(l.Card,{children:[(0,b.jsx)(l.T,{weight:"semibold",children:"My tips"}),(0,b.jsx)(l.Muted,{children:"Only your own tip history is shown. 100% of tips go to staff; nothing is deducted."})]}),C.map(({h:e,r:t})=>(0,b.jsxs)(l.Card,{children:[(0,b.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(l.T,{weight:"semibold",children:e.label}),(0,b.jsx)(l.T,{weight:"bold",colour:h.colours.gold,children:(0,c.gbp)(t.amount)})]}),(0,b.jsxs)(l.Muted,{children:[(0,x.hmDur)(Math.round(60*t.hours))," paid \xb7 ",t.pct.toFixed(1),"% share \xb7 ",T[e.method]," \xb7 approved ",e.lockedAt]})]},e.id)),C.length?null:(0,b.jsx)(l.Muted,{children:"No approved tip periods yet. (Preview: approve a period in the Owner view first.)"}),(0,b.jsx)(l.Button,{kind:"secondary",label:"Request my tip records",onPress:()=>{a.useOwner.getState().setOwner({troncLog:[{id:`tl-${Date.now()}`,at:s.toISOString(),text:`${o} requested their tip records`},...p]}),j('Request logged for your manager (demo, nothing is sent).')}}),y?(0,b.jsx)(l.Banner,{kind:"success",title:y}):null,(0,b.jsx)(l.Button,{kind:"ghost",label:"Read the tipping policy",onPress:()=>f(!0)}),(0,b.jsx)(l.Sheet,{visible:m,onClose:()=>f(!1),title:"Tipping policy",children:(0,b.jsx)(l.T,{size:14,children:d.text})})]})}},1010,[868,877,833,30,151,127,813,819,856,816,818,821,999,1018,927,1111,1301,820,1341,24]); +__d(function(g,r,i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.AccidentBook=function({me:e,meId:t,now:n,app:d,seeAll:h}){const p=(0,l.useSafety)(e=>e.accidents),[y,b]=(0,s.useState)(h?'list':'add'),w=p.filter(e=>e.reportedById===t),f=p.length-w.length;return(0,u.jsxs)(a.default,{style:{gap:12},testID:"accident-book",children:[(0,u.jsx)(c.Tabs,{value:y,onChange:b,options:[{id:'add',label:'Report an accident or near miss'},{id:'list',label:h?`All entries (${p.length})`:`My entries (${w.length})`}]}),'add'===y?(0,u.jsx)(x,{me:e,meId:t,now:n,app:d,onSaved:()=>b('list')}):null,'list'===y?(0,u.jsxs)(c.Box,{testID:"accident-list",children:[(h?p:w).length?(h?p:w).map(e=>(0,u.jsx)(j,{a:e,manager:h},e.id)):(0,u.jsx)(o.Muted,{children:"No entries yet."}),!h&&f>0?(0,u.jsx)(a.default,{testID:"accident-others",children:(0,u.jsxs)(o.Muted,{children:[f," other entr",1===f?'y is':'ies are'," in the book. Only managers can see other people\u2019s entries and personal details."]})}):null]}):null,(0,u.jsx)(o.Muted,{children:"In an emergency call 999 first. The accident book is kept on this device for now; nothing is sent or reported to anyone."})]})};var t=r(_d[0]),s=r(_d[1]),n=e(r(_d[2])),a=e(r(_d[3])),o=r(_d[4]),l=r(_d[5]),d=r(_d[6]),c=r(_d[7]),u=r(_d[8]);const h=e=>String(e).padStart(2,'0'),p=e=>`${e.getFullYear()}-${h(e.getMonth()+1)}-${h(e.getDate())}T${h(e.getHours())}:${h(e.getMinutes())}`,y=e=>{const t=new Date(e);return Number.isNaN(t.getTime())?e:`${t.toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',year:'numeric'})} ${h(t.getHours())}:${h(t.getMinutes())}`};function x({me:e,meId:n,now:h,app:y,onSaved:x}){const[j,b]=(0,s.useState)({date:p(h).slice(0,10),time:p(h).slice(11),location:'',person:'',personType:'Staff',category:'',what:'',injury:'',firstAid:'',witnesses:'',reportedBy:e.replace(' (example)','')}),[w,f]=(0,s.useState)(''),[T,D]=(0,s.useState)(''),I=e=>b({...j,...e}),S='Near miss'===j.category,C=(e,s,n,l=!1)=>(0,u.jsxs)(a.default,{style:{gap:4},children:[(0,u.jsx)(o.T,{size:14,weight:"medium",colour:d.colours.muted,children:e}),(0,u.jsx)(t.TextInput,{accessibilityLabel:e,value:String(j[s]),onChangeText:e=>I({[s]:e}),placeholder:n,placeholderTextColor:"#7D776C",multiline:l,style:[o.styles.input,l&&{minHeight:70,textAlignVertical:'top'}]})]});return(0,u.jsxs)(c.Box,{testID:"accident-form",children:[(0,u.jsx)(o.T,{size:18,weight:"semibold",children:"Report an accident or near miss"}),(0,u.jsxs)(o.Row,{gap:8,children:[(0,u.jsxs)(a.default,{style:{flex:1,gap:4},children:[(0,u.jsx)(o.T,{size:14,weight:"medium",colour:d.colours.muted,children:"Date"}),(0,u.jsx)(t.TextInput,{accessibilityLabel:"Date",value:j.date,onChangeText:e=>I({date:e}),placeholder:"YYYY-MM-DD",placeholderTextColor:"#7D776C",style:[o.styles.input,{minWidth:0,width:40}]})]}),(0,u.jsxs)(a.default,{style:{width:110,gap:4},children:[(0,u.jsx)(o.T,{size:14,weight:"medium",colour:d.colours.muted,children:"Time"}),(0,u.jsx)(t.TextInput,{accessibilityLabel:"Time",value:j.time,onChangeText:e=>I({time:e}),placeholder:"HH:MM",placeholderTextColor:"#7D776C",style:o.styles.input})]})]}),(0,u.jsx)(o.T,{size:14,weight:"medium",colour:d.colours.muted,children:"What kind?"}),(0,u.jsx)(o.Row,{wrap:!0,gap:6,children:l.ACCIDENT_CATEGORIES.map(e=>(0,u.jsx)(o.Chip,{label:e,selected:j.category===e,onPress:()=>I({category:e})},e))}),C('Where it happened','location','e.g. kitchen pass, cellar steps, terrace'),C('Person involved','person','Name'),(0,u.jsx)(o.Row,{wrap:!0,gap:6,children:['Staff','Customer','Contractor','Visitor'].map(e=>(0,u.jsx)(o.Chip,{label:e,selected:j.personType===e,onPress:()=>I({personType:e})},e))}),C('What happened','what','Describe what happened, in order',!0),C('Injury','injury',S?'None (near miss)':'e.g. small cut to left thumb'),C('First aid given','firstAid','e.g. cleaned and plaster applied by \u2026'),C('Witnesses','witnesses','Names, or none'),C('Reported by','reportedBy','Your name'),w?(0,u.jsx)(o.Banner,{kind:"warn",children:w}):null,(0,u.jsx)(o.Button,{label:"Save to the accident book",testID:"accident-save",onPress:()=>/^\d{4}-\d{2}-\d{2}$/.test(j.date)&&/^([01]\d|2[0-3]):[0-5]\d$/.test(j.time)?j.category?j.location.trim()&&j.person.trim()&&j.what.trim()?(l.useSafety.getState().addAccident({when:`${j.date}T${j.time}`,location:j.location.trim(),person:j.person.trim(),personType:j.personType,category:j.category,what:j.what.trim(),injury:j.injury.trim()||(S?'None (near miss)':'Not recorded'),firstAid:j.firstAid.trim()||'None recorded',witnesses:j.witnesses.trim()||'None',reportedBy:j.reportedBy.trim()||e,reportedById:n,app:y}),D(`Saved to the accident book: ${j.category}, ${j.location.trim()}.`),f(''),b({...j,location:'',person:'',category:'',what:'',injury:'',firstAid:'',witnesses:''}),void x()):f('Fill in where it happened, who was involved and what happened.'):f('Pick what kind of accident or near miss it was.'):f('Enter the date as YYYY-MM-DD and the time as HH:MM.')}),T?(0,u.jsx)(a.default,{testID:"accident-saved",children:(0,u.jsx)(o.T,{size:14,colour:d.colours.ok,children:T})}):null,(0,u.jsx)(o.Muted,{children:"Personal details are only visible to managers. You can see your own entries."})]})}function j({a:e,manager:c}){const h=l.RIDDOR_CATEGORIES.includes(e.category),[p,x]=(0,s.useState)(e.riddorNote??''),[j,b]=(0,s.useState)(!1);return(0,u.jsxs)(a.default,{testID:"accident-entry",style:{paddingVertical:10,borderTopWidth:1,borderColor:d.colours.border,gap:4},children:[(0,u.jsxs)(n.default,{accessibilityRole:"button",accessibilityLabel:`${e.category} at ${e.location}`,onPress:()=>b(!j),children:[(0,u.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsxs)(o.T,{weight:"semibold",style:{flex:1},children:[e.category," \xb7 ",e.location]}),(0,u.jsx)(o.Badge,{kind:'Near miss'===e.category?'blue':h?'red':'amber',label:'Near miss'===e.category?'Near miss':h?'Serious':'Accident'})]}),(0,u.jsxs)(o.Muted,{children:[y(e.when)," \xb7 ",e.person," (",e.personType,") \xb7 reported by ",e.reportedBy]})]}),j||c?(0,u.jsxs)(a.default,{style:{gap:2},children:[(0,u.jsxs)(o.T,{size:14,children:["What happened: ",e.what]}),(0,u.jsxs)(o.T,{size:14,children:["Injury: ",e.injury]}),(0,u.jsxs)(o.T,{size:14,children:["First aid: ",e.firstAid]}),(0,u.jsxs)(o.T,{size:14,children:["Witnesses: ",e.witnesses]})]}):null,c&&h?(0,u.jsxs)(a.default,{testID:"riddor-prompt",style:{gap:6},children:[(0,u.jsx)(o.Banner,{kind:"danger",title:"Consider RIDDOR",children:"This may need reporting to the HSE under RIDDOR (for example a specified injury, over-7-day incapacitation, or a member of the public taken to hospital). Check the HSE\u2019s RIDDOR guidance and decide. CoverCharge never reports anything for you."}),(0,u.jsx)(t.TextInput,{accessibilityLabel:"RIDDOR decision note",value:p,onChangeText:x,placeholder:"Your decision, e.g. reported on \u2026 ref \u2026, or not reportable because \u2026",placeholderTextColor:"#7D776C",style:o.styles.input}),(0,u.jsx)(o.Button,{small:!0,label:"Save note",disabled:p===(e.riddorNote??''),onPress:()=>l.useSafety.getState().setRiddorNote(e.id,p)}),e.riddorNote?(0,u.jsxs)(o.Muted,{children:["Saved note: ",e.riddorNote]}):null]}):null]})}},1011,[877,30,263,127,813,1105,821,1340,24]); +__d(function(g,_r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.MissedBanner=v,_e.HaccpLog=function({me:e,meId:t,now:n,mode:s}){const[o,l]=(0,i.useState)('today'),r=(e,t)=>({id:e,label:t}),u='chef'===s?[r('today','Today'),r('units','Fridges & units'),r('record','Quick entry'),r('diary','Diary'),r('weekly','Weekly sign-off'),r('report','EHO report'),r('history','History'),r('limits','Safe limits'),r('probes','Wireless probes')]:'managers'===s?[r('today','Today'),r('units','Fridges & units'),r('diary','Diary'),r('weekly','Weekly sign-off'),r('report','EHO report'),r('history','History'),r('limits','Safe limits'),r('probes','Wireless probes')]:[r('today','Today'),r('record','Quick entry'),r('diary','Diary'),r('history','My entries')],h={me:e,meId:t,now:n,mode:s};return(0,y.jsxs)(d.default,{style:{gap:12},testID:"haccp-log",children:['today'!==o?(0,y.jsx)(v,{mode:s,now:n,onPress:()=>l('today')}):null,(0,y.jsx)(x.Tabs,{value:o,onChange:l,options:u}),'today'===o?(0,y.jsx)(b.TodayView,{who:h}):null,'units'===o?(0,y.jsx)(b.UnitsView,{who:h}):null,'record'===o?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(C,{who:h}),(0,y.jsx)(T,{who:h})]}):null,'diary'===o?(0,y.jsx)(b.DiaryView,{who:h}):null,'weekly'===o?(0,y.jsx)(b.WeeklyView,{who:h}):null,'report'===o?(0,y.jsx)(b.ReportView,{who:h}):null,'history'===o?(0,y.jsx)(S,{who:h}):null,'limits'===o?(0,y.jsx)(I,{mode:s,editable:'chef'===s}):null,'probes'===o?(0,y.jsx)(B,{mode:s,me:e,now:n}):null,(0,y.jsx)(c.Muted,{children:"Every reading here was entered by a person; the app never fills in or estimates a value. Sections follow Safer Food, Better Business (cross-contamination, cleaning, chilling, cooking, management). Your own HACCP plan (e.g. CookSafe) sets the limits that count. Saved on this device."})]})};var t=_r(_d[0]),n=_r(_d[1]),s=_r(_d[2]),o=_r(_d[3]),i=_r(_d[4]),l=e(_r(_d[5])),r=e(_r(_d[6])),d=e(_r(_d[7])),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),m=_r(_d[12]),x=_r(_d[13]),b=_r(_d[14]),y=_r(_d[15]);const f=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}),j=e=>new Date(e).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'}),w=e=>{const t=e.trim().replace(',','.').replace(/^\u2212/,'-');return t&&/^-?\d+(\.\d+)?$/.test(t)?Number(t):null};function v({now:e,onPress:t,mode:s="managers"}){const o=(0,n.useSafetyView)(s).points,i=(0,n.useSafetyView)(s).entries,l=(0,h.missedChecks)(o,i,e);if(!l.length)return(0,y.jsx)(d.default,{testID:"haccp-uptodate",children:(0,y.jsx)(c.Banner,{kind:"success",title:"Food safety checks up to date",children:"No checks overdue right now."})});const u=(0,y.jsx)(d.default,{testID:"haccp-missed",children:(0,y.jsx)(c.Banner,{kind:"warn",title:`${l.length} food safety check${1===l.length?'':'s'} overdue`,children:l.map(e=>`${e.point.name} (due ${e.due})`).join(' \xb7 ')})});return t?(0,y.jsx)(r.default,{accessibilityRole:"button",accessibilityLabel:"Open the food safety log",onPress:t,children:u}):u}function k(e,t){u.useSafety.getState().addEntries(t.filter(t=>'chef'!==e.mode||(0,s.chefCanSee)(o.useOwner.getState().site,t.point)).map(t=>{const n=(0,h.isTempKind)(t.point.kind)?(0,h.inRange)(t.point,t.value):!!t.done;return{pointId:t.point.id,name:t.point.name,kind:t.point.kind,at:e.now.toISOString(),by:e.me.replace(' (example)',''),byId:e.meId,app:e.mode,value:t.value,done:t.done,ok:n,corrective:t.corrective?.trim()||void 0,note:t.note?.trim()||void 0,source:t.source,initials:(0,h.initialsOf)(e.me)}}))}function C({who:e}){const l=(0,n.useSafetyView)(e.mode).points,[u,m]=(0,i.useState)(''),[b,f]=(0,i.useState)(null),[j,v]=(0,i.useState)(''),[C,T]=(0,i.useState)(!1),[S,D]=(0,i.useState)(!1),I=(0,i.useRef)(null),P=(t,n)=>{if('chef'===e.mode&&!(0,s.chefCanSee)(o.useOwner.getState().site,t))return f(null),void v('That check is managed in the Managers app.');const i=(0,h.parseQuick)(t,l);D(n),v(''),f(i.map((e,t)=>({key:`${t}-${e.text}`,text:e.text,pointId:e.point?.id,value:null==e.value?'':String(e.value),done:!(!e.point||(0,h.isTempKind)(e.point.kind)||!/\b(done|yes|complete|completed|ok|signed)\b/i.test(e.text))||void 0,corrective:'',problem:e.problem})))},R=(e,t)=>f(n=>n&&n.map(n=>n.key===e?{...n,...t}:n)),B=(b??[]).map(e=>{const t=l.find(t=>t.id===e.pointId),n=w(e.value),s=!!t&&(0,h.isTempKind)(t.kind),o=!!t&&(s?null!=n:void 0!==e.done),i=t?s?null!=n?(0,h.inRange)(t,n):null:void 0===e.done?null:e.done:null;return{d:e,point:t,v:n,temp:s,ready:o,ok:i,needsAction:!1===i&&!e.corrective.trim()}}),L=B.length>0&&B.every(e=>e.ready&&!e.needsAction);return(0,y.jsxs)(x.Box,{testID:"haccp-quick",children:[(0,y.jsx)(c.T,{weight:"semibold",size:17,children:"Quick entry: say or type readings"}),(0,y.jsx)(c.Muted,{children:"For example \u201cwalk-in fridge 3, freezer minus 19\u201d. You check every value before anything is saved."}),(0,y.jsxs)(c.Row,{gap:8,children:[(0,y.jsx)(t.TextInput,{accessibilityLabel:"Readings",value:u,onChangeText:m,placeholder:"walk-in fridge 3, freezer minus 19",placeholderTextColor:"#7D776C",onSubmitEditing:()=>P(u,!1),style:[c.styles.input,{flex:1,minWidth:0,width:40}]}),(0,y.jsx)(r.default,{accessibilityRole:"button",accessibilityLabel:"Speak readings",testID:"haccp-mic",onPress:()=>{const e=(0,x.speechRecognition)();if(!e)return void v("Voice input isn't available in this browser (for example Huawei Browser). Please type the readings instead.");if(C)return void I.current?.stop();const t=new e;I.current=t,t.lang='en-GB',t.interimResults=!1,t.maxAlternatives=1,t.onresult=e=>{const t=e.results?.[0]?.[0]?.transcript??'';m(t),t&&P(t,!0)},t.onerror=()=>v("Didn't catch that. Try again or type the readings."),t.onend=()=>T(!1);try{t.start(),T(!0)}catch{v("Voice input couldn't start. Please type the readings.")}},style:{width:48,height:48,borderRadius:24,borderWidth:1.5,borderColor:p.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:C?p.colours.gold:'transparent'},children:(0,y.jsx)(c.T,{size:20,children:C?'\u25a0':'\ud83c\udfa4'})})]}),(0,y.jsx)(c.Button,{label:"Check readings",disabled:!u.trim(),onPress:()=>P(u,!1)}),j?(0,y.jsx)(d.default,{testID:"haccp-quick-msg",children:(0,y.jsx)(c.Banner,{kind:"info",children:j})}):null,b?(0,y.jsxs)(d.default,{style:{gap:10},testID:"haccp-confirm",children:[(0,y.jsxs)(c.T,{weight:"semibold",children:["Check these ",b.length," reading",1===b.length?'':'s']}),B.map(({d:e,point:n,temp:s,ok:o,needsAction:i})=>(0,y.jsxs)(d.default,{testID:"haccp-draft",style:{gap:6,padding:10,borderRadius:12,borderWidth:1,borderColor:!1===o?p.colours.red:p.colours.border,backgroundColor:p.colours.surface2},children:[(0,y.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsxs)(c.Muted,{style:{flex:1},children:["Heard: \u201c",e.text,"\u201d"]}),(0,y.jsx)(r.default,{accessibilityRole:"button",accessibilityLabel:`Remove ${n?.name??e.text}`,onPress:()=>f(t=>t.filter(t=>t.key!==e.key)),children:(0,y.jsx)(c.T,{colour:p.colours.muted,children:"\u2715"})})]}),n?(0,y.jsxs)(c.T,{weight:"semibold",children:[n.name," ",(0,y.jsxs)(c.Muted,{children:["\xb7 safe: ",(0,h.limitText)(n)]})]}):(0,y.jsxs)(d.default,{style:{gap:6},children:[(0,y.jsx)(c.T,{colour:p.colours.amber,children:e.problem}),(0,y.jsx)(c.Row,{wrap:!0,gap:6,children:l.map(t=>(0,y.jsx)(c.Chip,{label:t.name,onPress:()=>R(e.key,{pointId:t.id,problem:void 0})},t.id))})]}),n&&s?(0,y.jsxs)(c.Row,{gap:8,children:[(0,y.jsx)(t.TextInput,{accessibilityLabel:`Reading for ${n.name}`,value:e.value,onChangeText:t=>R(e.key,{value:t}),placeholder:"\xb0C",placeholderTextColor:"#7D776C",keyboardType:"numbers-and-punctuation",style:[c.styles.input,{width:96,fontSize:20}]}),(0,y.jsx)(c.T,{size:18,children:"\xb0C"}),null===o?(0,y.jsx)(c.Badge,{kind:"amber",label:"Type the reading"}):(0,y.jsx)(c.Badge,{kind:o?'ok':'red',label:o?'OK':'OUT OF RANGE'})]}):null,n&&!s?(0,y.jsxs)(c.Row,{gap:6,children:[(0,y.jsx)(c.Chip,{label:"Done",selected:!0===e.done,onPress:()=>R(e.key,{done:!0})}),(0,y.jsx)(c.Chip,{label:"Not done",selected:!1===e.done,onPress:()=>R(e.key,{done:!1})})]}):null,!1===o?(0,y.jsx)(t.TextInput,{accessibilityLabel:`Corrective action for ${n.name}`,value:e.corrective,onChangeText:t=>R(e.key,{corrective:t}),placeholder:"What did you do? e.g. moved stock, called engineer, re-checked",placeholderTextColor:"#7D776C",style:[c.styles.input,i&&{borderColor:p.colours.red}]}):null,i?(0,y.jsx)(c.T,{size:13,colour:p.colours.red,children:"A corrective action note is needed before saving."}):null]},e.key)),(0,y.jsxs)(c.Row,{gap:8,children:[(0,y.jsx)(c.Button,{label:`Save ${B.length} reading${1===B.length?'':'s'}`,testID:"haccp-save-quick",disabled:!L,onPress:()=>{k(e,B.map(e=>({point:e.point,value:e.temp?e.v:void 0,done:e.temp?void 0:e.d.done,corrective:e.d.corrective,source:S?'voice':'typed'}))),v(`Saved ${B.length} reading${1===B.length?'':'s'}.`),f(null),m('')},style:{flex:1}}),(0,y.jsx)(c.Button,{kind:"secondary",label:"Cancel",onPress:()=>{f(null),v('Nothing saved.')}})]}),(0,y.jsx)(c.Muted,{children:"Nothing is saved until you tap Save."})]}):null]})}function T({who:e}){const s=(0,n.useSafetyView)(e.mode).points,[o,l]=(0,i.useState)(s[0]?.id),[r,d]=(0,i.useState)(''),[u,m]=(0,i.useState)(),[b,f]=(0,i.useState)(''),[j,v]=(0,i.useState)(''),[C,T]=(0,i.useState)(''),S=s.find(e=>e.id===o),D=!!S&&(0,h.isTempKind)(S.kind),I=w(r),P=S?D?null==I?null:(0,h.inRange)(S,I):void 0===u?null:u:null,R=null!==P&&(P||b.trim());return(0,y.jsxs)(x.Box,{testID:"haccp-manual",children:[(0,y.jsx)(c.T,{weight:"semibold",size:17,children:"Record one check"}),(0,y.jsx)(c.Row,{wrap:!0,gap:6,children:s.map(e=>(0,y.jsx)(c.Chip,{label:e.name,selected:e.id===o,onPress:()=>{l(e.id),d(''),m(void 0),f(''),T('')}},e.id))}),S?(0,y.jsxs)(c.Muted,{children:[h.KIND_LABEL[S.kind]," \xb7 safe: ",(0,h.limitText)(S)]}):null,D?(0,y.jsxs)(c.Row,{gap:8,children:[(0,y.jsx)(t.TextInput,{accessibilityLabel:"Temperature reading",value:r,onChangeText:d,placeholder:"\xb0C",placeholderTextColor:"#7D776C",keyboardType:"numbers-and-punctuation",style:[c.styles.input,{width:110,fontSize:22}]}),(0,y.jsx)(c.T,{size:18,children:"\xb0C"}),null===P?null:(0,y.jsx)(c.Badge,{kind:P?'ok':'red',label:P?'OK':'OUT OF RANGE'})]}):(0,y.jsxs)(c.Row,{gap:6,children:[(0,y.jsx)(c.Chip,{label:"Done",selected:!0===u,onPress:()=>m(!0)}),(0,y.jsx)(c.Chip,{label:"Not done",selected:!1===u,onPress:()=>m(!1)})]}),!1===P?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(c.Banner,{kind:"danger",title:D?'Out of range':'Check not done',children:"Write what you did about it before saving (e.g. moved food, discarded, called the engineer, re-checked in 30 minutes)."}),(0,y.jsx)(t.TextInput,{accessibilityLabel:"Corrective action",value:b,onChangeText:f,placeholder:"Corrective action taken",placeholderTextColor:"#7D776C",style:c.styles.input})]}):null,(0,y.jsx)(t.TextInput,{accessibilityLabel:"Note (optional)",value:j,onChangeText:v,placeholder:"Note (optional), e.g. probe used, batch",placeholderTextColor:"#7D776C",style:c.styles.input}),(0,y.jsx)(c.Button,{label:"Save check",testID:"haccp-save-one",disabled:!R,onPress:()=>{k(e,[{point:S,value:D?I:void 0,done:D?void 0:u,corrective:b,note:j,source:'typed'}]),d(''),m(void 0),f(''),v(''),T(`Saved: ${S.name}.`)}}),C?(0,y.jsx)(c.T,{size:14,colour:p.colours.ok,children:C}):null]})}function S({who:e}){const t=(0,n.useSafetyView)(e.mode).entries,s=(0,n.useSafetyView)(e.mode).points,[o,l]=(0,i.useState)('7'),[r,u]=(0,i.useState)('all'),[m,b]=(0,i.useState)(!1),[f,j]=(0,i.useState)(''),w='staff'===e.mode,v=(0,i.useMemo)(()=>{const n=new Date(e.now);n.setHours(0,0,0,0);const s='today'===o?n.getTime():'all'===o?0:e.now.getTime()-864e5*Number(o);return t.filter(t=>!(w&&t.byId!==e.meId||!(new Date(t.at).getTime()>=s)||'all'!==r&&t.kind!==r||m&&t.ok))},[t,o,r,m,w,e.meId,e.now.getTime()]),k=Array.from(new Set(s.map(e=>e.kind))),C=e.now.toISOString().slice(0,10);return(0,y.jsxs)(x.Box,{testID:"haccp-history",children:[(0,y.jsx)(c.T,{weight:"semibold",size:17,children:w?'My entries':'Food safety log'}),(0,y.jsx)(c.Row,{wrap:!0,gap:6,children:[['today','Today'],['7','7 days'],['30','30 days'],['all','All']].map(([e,t])=>(0,y.jsx)(c.Chip,{label:t,selected:o===e,onPress:()=>l(e)},e))}),(0,y.jsxs)(c.Row,{wrap:!0,gap:6,children:[(0,y.jsx)(c.Chip,{label:"All checks",selected:'all'===r,onPress:()=>u('all')}),k.map(e=>(0,y.jsx)(c.Chip,{label:h.KIND_LABEL[e],selected:r===e,onPress:()=>u(e)},e))]}),(0,y.jsx)(c.Toggle,{label:"Out of range only",value:m,onChange:b}),(0,y.jsx)(d.default,{testID:"haccp-count",children:(0,y.jsxs)(c.Muted,{children:[v.length," entr",1===v.length?'y':'ies',v.filter(e=>!e.ok).length?` \xb7 ${v.filter(e=>!e.ok).length} out of range`:'']})}),v.length?v.slice(0,200).map(e=>(0,y.jsx)(D,{e:e},e.id)):(0,y.jsx)(c.Muted,{children:"No entries for these filters yet."}),w?null:(0,y.jsxs)(c.Row,{wrap:!0,gap:8,children:[(0,y.jsx)(c.Button,{small:!0,label:"Download CSV",testID:"haccp-csv",disabled:!v.length,onPress:()=>j((0,x.downloadText)(`food-safety-log-${C}.csv`,(0,h.toCsv)(v,s))?`CSV downloaded: ${v.length} entries.`:'Downloads work in the web app.')}),(0,y.jsx)(c.Button,{small:!0,kind:"secondary",label:"Print for EHO",testID:"haccp-print",disabled:!v.length,onPress:()=>j((0,x.printTable)('Food safety log (HACCP)',`${v.length} entries \xb7 printed ${e.now.toLocaleString('en-GB')} \xb7 all readings entered by staff`,h.LOG_HEAD,(0,h.logRows)(v,s))?'Print view opened in a new tab.':'Pop-ups are blocked: allow them to print.')})]}),f?(0,y.jsx)(c.T,{size:14,colour:p.colours.ok,children:f}):null]})}function D({e:e}){return(0,y.jsxs)(d.default,{testID:"haccp-row",style:{paddingVertical:8,borderTopWidth:1,borderColor:p.colours.border,gap:2},children:[(0,y.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(c.T,{size:15,weight:"medium",style:{flex:1},children:e.name}),(0,y.jsx)(c.T,{size:17,weight:"bold",colour:e.ok?p.colours.ok:p.colours.red,children:(0,h.fmtEntryValue)(e)})]}),(0,y.jsxs)(c.Row,{gap:6,children:[(0,y.jsx)(m.StaffAvatar,{id:e.byId,name:e.by,size:20,ring:!1}),(0,y.jsxs)(c.Muted,{style:{flex:1},children:[j(e.at)," ",f(e.at)," \xb7 ",e.initials??(0,h.initialsOf)(e.by)," ",e.by,'voice'===e.source?' \xb7 voice, confirmed':'probe'===e.source?' \xb7 probe':'',e.ok?'':' \xb7 OUT OF RANGE']})]}),e.corrective?(0,y.jsxs)(c.T,{size:13,colour:p.colours.amber,children:["Action: ",e.corrective]}):null,e.note?(0,y.jsxs)(c.Muted,{children:["Note: ",e.note]}):null,e.photo?(0,y.jsx)(l.default,{source:{uri:e.photo},style:{width:72,height:72,borderRadius:8},accessibilityLabel:"Corrective action photo"}):null]})}function I({editable:e,mode:t}){const s=(0,n.useSafetyView)(t).points,[o,l]=(0,i.useState)('');return(0,y.jsxs)(x.Box,{testID:"haccp-limits",children:[(0,y.jsx)(c.T,{weight:"semibold",size:17,children:"Check points and safe limits"}),(0,y.jsx)(c.Muted,{children:e?'Set the limits from your own HACCP plan. Leave min or max empty if it doesn\u2019t apply. Due times are daily reminders (24 h, comma separated).':'Set by the Head Chef in CoverCharge for Head Chef.'}),s.map(t=>(0,y.jsx)(P,{p:t,editable:e,onSaved:()=>l(`Saved limits for ${t.name}.`)},t.id)),e?(0,y.jsx)(R,{onAdded:e=>l(`Added ${e}.`)}):null,o?(0,y.jsx)(c.T,{size:14,colour:p.colours.ok,children:o}):null]})}function P({p:e,editable:n,onSaved:s}){const[o,l]=(0,i.useState)(null==e.min?'':String(e.min)),[r,m]=(0,i.useState)(null==e.max?'':String(e.max)),[x,b]=(0,i.useState)(e.due.join(', ')),f=(0,h.isTempKind)(e.kind),j=''===x.trim()||x.split(',').every(e=>/^\s*([01]\d|2[0-3]):[0-5]\d\s*$/.test(e)),v=o!==(null==e.min?'':String(e.min))||r!==(null==e.max?'':String(e.max))||x!==e.due.join(', '),k=j&&(''===o||null!=w(o))&&(''===r||null!=w(r));return n?(0,y.jsxs)(d.default,{style:{gap:6,paddingVertical:8,borderTopWidth:1,borderColor:p.colours.border},testID:`limit-${e.id}`,children:[(0,y.jsxs)(c.T,{weight:"medium",children:[e.name," ",(0,y.jsxs)(c.Muted,{children:["\xb7 ",h.KIND_LABEL[e.kind]]})]}),(0,y.jsxs)(c.Row,{wrap:!0,gap:8,children:[f?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(t.TextInput,{accessibilityLabel:`Minimum for ${e.name}`,value:o,onChangeText:l,placeholder:"min \xb0C",placeholderTextColor:"#7D776C",style:[c.styles.input,{width:90}]}),(0,y.jsx)(t.TextInput,{accessibilityLabel:`Maximum for ${e.name}`,value:r,onChangeText:m,placeholder:"max \xb0C",placeholderTextColor:"#7D776C",style:[c.styles.input,{width:90}]})]}):null,(0,y.jsx)(t.TextInput,{accessibilityLabel:`Due times for ${e.name}`,value:x,onChangeText:b,placeholder:"e.g. 09:00, 16:00",placeholderTextColor:"#7D776C",style:[c.styles.input,{flex:1,minWidth:140,width:40}]}),v?(0,y.jsx)(c.Button,{small:!0,label:"Save",disabled:!k,onPress:()=>{u.useSafety.getState().setPoint(e.id,{min:''===o?void 0:w(o),max:''===r?void 0:w(r),due:x.split(',').map(e=>e.trim()).filter(Boolean).sort()}),s()}}):null]}),j?null:(0,y.jsx)(c.T,{size:13,colour:p.colours.red,children:"Use 24-hour times like 09:00, 16:00."})]}):(0,y.jsxs)(c.Row,{style:{justifyContent:'space-between',paddingVertical:4},children:[(0,y.jsx)(c.T,{size:14,style:{flex:1},children:e.name}),(0,y.jsxs)(c.Muted,{children:[(0,h.limitText)(e),e.due.length?` \xb7 due ${e.due.join(', ')}`:'']})]})}function R({onAdded:e}){const[n,l]=(0,i.useState)(''),[r,m]=(0,i.useState)('fridge');return(0,y.jsxs)(d.default,{style:{gap:6,paddingTop:8,borderTopWidth:1,borderColor:p.colours.border},children:[(0,y.jsx)(c.T,{weight:"medium",children:"Add a check point"}),(0,y.jsx)(t.TextInput,{accessibilityLabel:"New check point name",value:n,onChangeText:l,placeholder:"e.g. Dessert fridge",placeholderTextColor:"#7D776C",style:c.styles.input}),(0,y.jsx)(c.Row,{wrap:!0,gap:6,children:Object.keys(h.KIND_LABEL).map(e=>(0,y.jsx)(c.Chip,{label:h.KIND_LABEL[e],selected:e===r,onPress:()=>m(e)},e))}),(0,y.jsx)(c.Button,{small:!0,label:"Add check point",disabled:!n.trim()||!(0,s.chefCanSee)(o.useOwner.getState().site,n),onPress:()=>{if(!(0,s.chefCanSee)(o.useOwner.getState().site,n))return;const t='fridge'===r?{max:5}:'freezer'===r?{max:-18}:'cook'===r?{min:75}:'hothold'===r?{min:63}:'cool'===r||'delivery'===r?{max:8}:{};u.useSafety.getState().addPoint({name:n.trim(),kind:r,due:[],aliases:[n.trim().toLowerCase()],...t}),e(n.trim()),l('')}})]})}function B({me:e,now:l,mode:r}){const h=(0,n.useSafetyView)(r).probes??[],m=(0,n.useSafetyView)(r).points.filter(e=>'fridge'===e.kind||'freezer'===e.kind),[b,f]=(0,i.useState)(!1),[j,w]=(0,i.useState)(''),[v,k]=(0,i.useState)(''),[C,T]=(0,i.useState)(null),[S,D]=(0,i.useState)(''),I=m.find(e=>e.id===v);return(0,y.jsxs)(x.Box,{testID:"haccp-probes",children:[(0,y.jsx)(c.T,{weight:"semibold",size:17,children:"Wireless probes"}),(0,y.jsx)(c.Muted,{children:"Wireless fridge and freezer probes. Once a probe is connected, its readings go into the food safety log tagged \u201cprobe\u201d with the time they were taken. Out-of-range probe readings still need a corrective action from a person."}),h.length?h.map(e=>(0,y.jsxs)(d.default,{testID:"probe-row",style:{gap:6,paddingVertical:10,borderTopWidth:1,borderColor:p.colours.border},children:[(0,y.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsxs)(d.default,{style:{flex:1,gap:2},children:[(0,y.jsx)(c.T,{weight:"semibold",children:e.name}),(0,y.jsx)(c.Muted,{children:e.location})]}),(0,y.jsx)(c.Badge,{kind:'connected'===e.status?'ok':'amber',label:'connected'===e.status?'Connected':'Not connected'})]}),(0,y.jsxs)(c.Row,{wrap:!0,gap:6,children:[(0,y.jsx)(c.Button,{small:!0,label:"Connect your probe",accessibilityLabel:`Connect your probe: ${e.name}`,onPress:()=>T(C===e.id?null:e.id)}),(0,y.jsx)(c.Button,{small:!0,kind:"ghost",label:"Remove",accessibilityLabel:`Remove probe ${e.name}`,onPress:()=>u.useSafety.getState().removeProbe(e.id)})]}),C===e.id?(0,y.jsxs)(d.default,{testID:"probe-connect",style:{gap:6,padding:10,borderRadius:12,borderWidth:1,borderColor:p.colours.gold},children:[(0,y.jsx)(c.T,{weight:"semibold",children:"Connect your probe"}),(0,y.jsxs)(c.T,{size:14,children:["1. Put the probe in ",e.location," and switch it on."]}),(0,y.jsx)(c.T,{size:14,children:"2. Keep this device near the probe."}),(0,y.jsx)(c.T,{size:14,children:"3. Tap Search for probe and pick it from the list."}),(0,y.jsx)(c.Button,{small:!0,kind:"secondary",label:"Search for probe",onPress:()=>D(`No probe found for ${e.name}. Probe hardware isn\u2019t set up yet, so it stays Not connected and nothing is added to the log.`)})]}):null]},e.id)):(0,y.jsx)(d.default,{testID:"probes-empty",children:(0,y.jsx)(c.Muted,{children:"No probes yet."})}),S?(0,y.jsx)(d.default,{testID:"probe-msg",children:(0,y.jsx)(c.Banner,{kind:"info",children:S})}):null,b?(0,y.jsxs)(d.default,{testID:"probe-add",style:{gap:8,padding:10,borderRadius:12,borderWidth:1,borderColor:p.colours.gold},children:[(0,y.jsx)(t.TextInput,{accessibilityLabel:"Probe name",value:j,onChangeText:w,placeholder:"e.g. Walk-in probe 1",placeholderTextColor:"#7D776C",style:[c.styles.input,{minWidth:0}]}),(0,y.jsx)(c.Muted,{children:"Where is it?"}),(0,y.jsx)(c.Row,{wrap:!0,gap:6,children:m.map(e=>(0,y.jsx)(c.Chip,{label:e.name,selected:v===e.id,onPress:()=>k(e.id)},e.id))}),(0,y.jsxs)(c.Row,{gap:8,children:[(0,y.jsx)(c.Button,{label:"Save probe",disabled:!j.trim()||!I,onPress:()=>{j.trim()&&I&&('chef'!==r||(0,s.chefCanSee)(o.useOwner.getState().site,I))&&(u.useSafety.getState().addProbe({name:j.trim(),pointId:I.id,location:I.name,addedBy:e.replace(' (example)',''),addedAt:l.toISOString()}),D(`Added \u201c${j.trim()}\u201d for ${I.name}. Next: connect your probe.`),w(''),k(''),f(!1))}}),(0,y.jsx)(c.Button,{kind:"ghost",label:"Cancel",onPress:()=>f(!1)})]})]}):(0,y.jsx)(c.Button,{kind:"secondary",label:"Add probe",onPress:()=>{f(!0),D('')}}),(0,y.jsx)(c.Muted,{children:"No probe hardware is connected, so no probe readings appear. The app never makes up a temperature."})]})}},1012,[877,1345,1024,856,30,196,263,127,813,1105,1113,821,953,1340,1346,24]); +__d(function(_g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.styliseOnDevice=p,_e.pickPhoto=b,_e.AvatarMaker=function({meId:e,me:h}){const u=(0,n.useAvatars)(t=>t.photos[e]),[g,f]=(0,t.useState)(null),[v,y]=(0,t.useState)(null),[x,j]=(0,t.useState)(!1),[w,I]=(0,t.useState)(!1),[k,P]=(0,t.useState)('');(0,t.useEffect)(()=>()=>{g&&URL.revokeObjectURL(g)},[g]);const M='undefined'!=typeof document,R=async e=>{P('');const t=await b(e);if(t){I(!0),j(!1);try{const e=await p(t);g&&URL.revokeObjectURL(g),f(URL.createObjectURL(t)),y(e)}catch{P("That photo couldn't be opened. Try a different one (JPEG or PNG).")}finally{I(!1)}}},S=()=>{g&&URL.revokeObjectURL(g),f(null),y(null),j(!1)},B=h.replace(' (example)','');return(0,c.jsxs)(o.default,{style:{gap:12},testID:"avatar-maker",children:[(0,c.jsxs)(d.Box,{children:[(0,c.jsxs)(s.Row,{gap:14,children:[(0,c.jsx)(l.StaffAvatar,{id:e,size:88}),(0,c.jsxs)(o.default,{style:{flex:1,gap:4},children:[(0,c.jsx)(s.T,{weight:"semibold",size:17,children:B}),(0,c.jsxs)(s.Muted,{children:[u?`Your avatar from a photo (made ${new Date(u.at).toLocaleDateString('en-GB')}).`:'Your default space-age avatar.'," It shows on rotas, chat, clock-in and sign-offs."]})]})]}),u?(0,c.jsx)(s.Button,{small:!0,kind:"secondary",label:"Back to my default avatar",testID:"avatar-own-reset",onPress:()=>{n.useAvatars.getState().reset(e,{id:e,role:'staff',name:B}),P('Back to your default avatar.')}}):null]}),(0,c.jsxs)(d.Box,{testID:"avatar-create",children:[(0,c.jsx)(s.T,{weight:"semibold",size:17,children:"Create my avatar from a photo"}),(0,c.jsx)(s.Muted,{children:"Upload a photo or take a selfie. Your phone turns it into a retro space-age avatar. The photo never leaves this device and isn't saved: only the finished avatar is kept."}),M?v?(0,c.jsxs)(o.default,{style:{gap:10},testID:"avatar-preview",children:[(0,c.jsxs)(s.Row,{gap:12,style:{justifyContent:'center'},children:[(0,c.jsxs)(o.default,{style:{alignItems:'center',gap:4},children:[g?(0,c.jsx)(a.default,{source:{uri:g},style:{width:96,height:96,borderRadius:12},accessibilityLabel:"Your photo"}):null,(0,c.jsx)(s.Muted,{children:"Your photo"})]}),(0,c.jsx)(s.T,{size:22,colour:i.colours.gold,children:"\u2192"}),(0,c.jsxs)(o.default,{style:{alignItems:'center',gap:4},children:[(0,c.jsx)(a.default,{source:{uri:v},style:{width:120,height:120,borderRadius:60,borderWidth:3,borderColor:i.colours.gold},accessibilityLabel:"Your new avatar preview",testID:"avatar-result"}),(0,c.jsx)(s.Muted,{children:"Your avatar"})]})]}),(0,c.jsxs)(r.default,{accessibilityRole:"checkbox",accessibilityState:{checked:x},accessibilityLabel:"I agree to use this avatar",testID:"avatar-consent",onPress:()=>j(!x),style:{flexDirection:'row',gap:10,alignItems:'flex-start',padding:10,borderRadius:12,borderWidth:1,borderColor:x?i.colours.gold:i.colours.border},children:[(0,c.jsx)(o.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:i.colours.gold,backgroundColor:x?i.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:x?(0,c.jsx)(s.T,{size:15,weight:"bold",colour:"#111",children:"\u2713"}):null}),(0,c.jsx)(s.T,{size:14,style:{flex:1},children:"I\u2019m happy for this avatar, made from my photo, to be shown to my team in CoverCharge. Only the finished avatar is shared; my photo isn\u2019t uploaded or kept, and a manager can reset my avatar."})]}),(0,c.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,c.jsx)(s.Button,{label:"Use as my avatar",testID:"avatar-save",disabled:!x,onPress:()=>{const t=n.useAvatars.getState().setOwn(e,e,v,B);P(t?'Saved: this is your avatar now.':"Couldn't save the avatar."),t&&S()}}),(0,c.jsx)(s.Button,{kind:"secondary",label:"Try another photo",onPress:S})]})]}):(0,c.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,c.jsx)(s.Button,{label:w?'Making your avatar\u2026':'Upload a photo',testID:"avatar-upload",disabled:w,onPress:()=>R(!1)}),(0,c.jsx)(s.Button,{kind:"secondary",label:"Take a selfie",testID:"avatar-selfie",disabled:w,onPress:()=>R(!0)})]}):(0,c.jsx)(s.Muted,{children:"Available in the web app."}),k?(0,c.jsx)(o.default,{testID:"avatar-msg",children:(0,c.jsx)(s.T,{size:14,colour:i.colours.ok,children:k})}):null,(0,c.jsx)(s.Banner,{kind:"info",title:"Coming soon: AI avatars",children:"A future version will use AI to draw you as a full cartoon in the same style. For now it's a simple filter that runs on your phone."})]})]})};var t=_r(_d[0]),a=e(_r(_d[1]));_r(_d[2]);var r=e(_r(_d[3])),o=e(_r(_d[4])),s=_r(_d[5]),l=_r(_d[6]),n=_r(_d[7]),i=_r(_d[8]),d=_r(_d[9]),c=_r(_d[10]);const h=['#1B1B1B','#4A3F35','#B89A72','#E9B949','#FFF4E0'].map(e=>[1,3,5].map(t=>parseInt(e.slice(t,t+2),16))),u=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5];function g(e){return new Promise((t,a)=>{const r=URL.createObjectURL(e),o=new window.Image;o.onload=()=>t({img:o,url:r}),o.onerror=()=>{URL.revokeObjectURL(r),a(new Error('bad image'))},o.src=r})}function f(e,t,a,r){e.beginPath(),e.moveTo(t,a-r),e.quadraticCurveTo(t+.18*r,a-.18*r,t+r,a),e.quadraticCurveTo(t+.18*r,a+.18*r,t,a+r),e.quadraticCurveTo(t-.18*r,a+.18*r,t-r,a),e.quadraticCurveTo(t-.18*r,a-.18*r,t,a-r),e.fill()}async function p(e){const{img:t,url:a}=await g(e);try{const e=112,a=256,r=document.createElement('canvas');r.width=e,r.height=e;const o=r.getContext('2d'),s=Math.min(t.width,t.height);o.drawImage(t,(t.width-s)/2,Math.max(0,(t.height-s)/2-.04*s),s,s,0,0,e,e);const l=o.getImageData(0,0,e,e),n=l.data,i=[];for(let e=0;ee-t),c=d[Math.floor(.04*d.length)],g=d[Math.floor(.96*d.length)]||255;for(let t=0;t{const a=document.createElement('input');a.type='file',a.accept='image/*',e&&a.setAttribute('capture','user'),a.onchange=()=>t(a.files?.[0]??null),a.click()})}},1013,[30,196,122,263,127,813,953,1201,821,1340,24]); +__d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEFAULT_LOYALTY",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"consentText",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"prettyCardNo",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"cleanCode",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"cardQr",{enumerable:!0,get:function(){return s}}),_e.readCardQr=function(e){const r=/^covercharge:card:[^:]+:([A-Za-z0-9-]{8,9})$/.exec(e.trim());return r?n(r[1]):null},Object.defineProperty(_e,"codeQr",{enumerable:!0,get:function(){return o}}),_e.checkSettings=function(e){return!Number.isInteger(e.stampsNeeded)||e.stampsNeeded<2||e.stampsNeeded>30?'Stamps needed must be between 2 and 30.':e.reward.trim()?e.reward.length>80?'Keep the reward under 80 letters.':e.gapMinutes<0||e.gapMinutes>1440?'Time between stamps must be 0 to 24 hours.':e.maxPerDay<1||e.maxPerDay>10?'Stamps a day must be 1 to 10.':!Number.isInteger(e.stampExpiryDays)||e.stampExpiryDays<0||e.stampExpiryDays>1095?'Stamps last 0 (never run out) to 1095 days.':!Number.isInteger(e.rewardExpiryDays)||e.rewardExpiryDays<0||e.rewardExpiryDays>1095?'Rewards last 0 (never run out) to 1095 days.':!e.referralOn||e.referralGiver.trim()&&e.referralFriend.trim()?e.referralMonthlyCap<0||e.referralMonthlyCap>50?'Friend rewards a month must be 0 to 50.':null:'Say what both people get before you switch Bring a friend on.':'Say what the reward is, for example Free dessert.'},_e.checkOffer=function(e){if(!e.title.trim())return'Give the offer a title.';if(e.title.length>80)return'Keep the title under 80 letters.';if(e.details.length>500)return'Keep the details under 500 letters.';const r=/^\d{4}-\d{2}-\d{2}$/;return e.startsOn&&!r.test(e.startsOn)?'Start date should look like 2026-11-30.':e.endsOn&&!r.test(e.endsOn)?'End date should look like 2026-11-30.':e.startsOn&&e.endsOn&&e.endsOn`I agree to ${e} keeping my name and the phone or email I give, only to run my stamp card and offers here. I can leave at any time and my details are removed.`,t=e=>e&&8===e.length?`${e.slice(0,4)}-${e.slice(4)}`:e,n=e=>e.toUpperCase().replace(/[^A-Z0-9]/g,''),s=(e,r)=>`covercharge:card:${e}:${r}`;const o=(e,r,t)=>`${e.replace(/\/$/,'')}/customer/${r}/loyalty?code=${t}`;const l=(e,r)=>e.isOn&&(!e.startsOn||e.startsOn<=r)&&(!e.endsOn||e.endsOn>=r),p=r=>r?{saved:!!r.updated_by,cardOn:!!r.card_on,stampsNeeded:r.stamps_needed??8,reward:r.reward??'',stampExpiryDays:r.stamp_expiry_days??0,rewardExpiryDays:r.reward_expiry_days??0,gapMinutes:r.gap_minutes??60,maxPerDay:r.max_per_day??1,referralOn:!!r.referral_on,referralGiver:r.referral_giver??'',referralFriend:r.referral_friend??'',referralMonthlyCap:r.referral_monthly_cap??5}:{...e},u=e=>({card_on:e.cardOn,stamps_needed:e.stampsNeeded,reward:e.reward.trim(),stamp_expiry_days:e.stampExpiryDays,reward_expiry_days:e.rewardExpiryDays,gap_minutes:e.gapMinutes,max_per_day:e.maxPerDay,referral_on:e.referralOn,referral_giver:e.referralGiver.trim(),referral_friend:e.referralFriend.trim(),referral_monthly_cap:e.referralMonthlyCap}),y=e=>({id:String(e.id),title:e.title??'',details:e.details??'',startsOn:e.starts_on??null,endsOn:e.ends_on??null,isOn:!1!==e.is_on})},1014,[]); +__d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SHOP_DEFAULT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"PAY_PLACEHOLDER",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"STATUS_WORDS",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"cleanGiftCode",{enumerable:!0,get:function(){return o}}),e.prettyGiftCode=function(t){const n=o(t);return 16===n.length?n.match(/.{4}/g).join('-'):n},e.poundsToPence=i,e.redeemKey=function(t=Math.random){const n='abcdefghijkmnpqrstuvwxyz23456789';let r='r-';for(let o=0;o<20;o++)r+=n[Math.floor(32*t())%32];return r},Object.defineProperty(e,"expiryWords",{enumerable:!0,get:function(){return c}}),e.amountsFromText=function(t){const n=t.split(/[,\s]+/).filter(Boolean).map(i);return!n.length||n.length>6||n.some(t=>null===t||t<100)?null:[...new Set(n)].sort((t,n)=>t-n)},e.basketTotal=function(t,n){return t.reduce((t,r)=>t+(n.find(t=>t.id===r.id)?.pricePence??0)*r.qty,0)},Object.defineProperty(e,"settingsFromRow",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"settingsToRow",{enumerable:!0,get:function(){return a}});const t={giftsOn:!1,shopOn:!1,expiryMonths:24,amounts:[2500,5e3,1e4],minPence:500,maxPence:25e3,terms:''},n='Gift cards are sold through your website. You can also pay at the bar or till.',r={'waiting-payment':'Waiting for payment at the till',active:'Ready to use',used:'Used up',expired:'Expired',void:'Cancelled',paid:'Paid',ready:'Ready to collect',collected:'Collected',cancelled:'Cancelled'},o=t=>(t??'').toUpperCase().replace(/[^A-Z0-9]/g,'');function i(t){const n=(t??'').trim().replace(/^\xa3/,'');return/^\d{1,4}(\.\d{1,2})?$/.test(n)?Math.round(100*Number(n)):null}const c=t=>t%12==0?`${t/12} year${12===t?'':'s'}`:`${t} months`;const s=n=>n?{giftsOn:!!n.gifts_on,shopOn:!!n.shop_on,expiryMonths:n.expiry_months??24,amounts:n.amounts??t.amounts,minPence:n.min_pence??500,maxPence:n.max_pence??25e3,terms:n.terms??''}:{...t},a=t=>({gifts_on:t.giftsOn,shop_on:t.shopOn,expiry_months:t.expiryMonths,amounts:t.amounts,min_pence:t.minPence,max_pence:t.maxPence,terms:t.terms})},1015,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"shopPublic",{enumerable:!0,get:function(){return p}}),e.myShop=async function(t){return await(0,n.guestSession)()?(0,n.rpc)('guest_my_shop',{p_slug:t}):{cards:[],orders:[]}},e.buyGift=async function(t,o){if(!await(0,n.guestSession)())throw new Error('No connection. Try again when you are back online.');return(0,n.rpc)('guest_gift_buy',{p_slug:t,p_amount:o.amount,p_recipient:o.recipient,p_from:o.from,p_message:o.message})},e.shopOrder=async function(t,o,c){if(!await(0,n.guestSession)())throw new Error('No connection. Try again when you are back online.');return(0,n.rpc)('guest_shop_order',{p_slug:t,p_lines:o,p_name:c})},Object.defineProperty(e,"giftCheck",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"giftRedeem",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"giftActivate",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"giftIssue",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"giftHonourWix",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"giftVoid",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"giftSummary",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"shopStatus",{enumerable:!0,get:function(){return v}}),e.waitingCards=async function(){const{data:t,error:n}=await c().from('gift_cards').select('id,last4,ref,initial_pence,balance_pence,status,source,recipient_name,issued_at,expires_at').eq('venue_id',s()).order('issued_at',{ascending:!1}).limit(60);if(n)throw n;return t??[]},e.shopOrders=async function(){const{data:t,error:n}=await c().from('shop_orders').select('*').eq('venue_id',s()).order('created_at',{ascending:!1}).limit(60);if(n)throw n;return t??[]},e.readShopSettings=async function(){const{data:t,error:n}=await c().from('shop_settings').select('*').eq('venue_id',s()).maybeSingle();if(n)throw n;return(0,o.settingsFromRow)(t)},e.saveShopSettings=async function(t){const{error:n}=await c().from('shop_settings').upsert({venue_id:s(),...(0,o.settingsToRow)(t),updated_by:u(),updated_at:(new Date).toISOString()},{onConflict:'venue_id'});if(n)throw n},e.readProducts=async function(){const{data:t,error:n}=await c().from('shop_products').select('*').eq('venue_id',s()).order('sort').order('name');if(n)throw n;return t??[]},e.saveProduct=async function(t){const n={venue_id:s(),name:t.name.trim(),details:t.details.trim(),price_pence:t.pricePence,stock:t.stock,is_live:t.live,updated_by:u(),updated_at:(new Date).toISOString()},{error:o}=t.id?await c().from('shop_products').update(n).eq('id',t.id):await c().from('shop_products').insert(n);if(o)throw o},Object.defineProperty(e,"payPublic",{enumerable:!0,get:function(){return S}}),e.payStart=async function(t,o,s){if(!await(0,n.guestSession)())throw new Error('No connection. Try again when you are back online.');const u='undefined'!=typeof window?window.location.href.split('?')[0]:'',{data:p,error:_}=await c().functions.invoke('pay-checkout',{body:{slug:t,kind:o,target:s,successUrl:u,cancelUrl:u}});if(_||!p?.url)throw new Error(p?.error??'Card payment isn\u2019t available yet. Pay at the bar or till.');if(!/^https:\/\/checkout\.stripe\.com\//.test(p.url))throw new Error('Card payment isn\u2019t available yet. Pay at the bar or till.');return p},Object.defineProperty(e,"payStatus",{enumerable:!0,get:function(){return P}}),e.readPaySettings=async function(){const{data:t,error:n}=await c().from('payment_settings').select('*').eq('venue_id',s()).maybeSingle();if(n)throw n;return{provider:t?.provider??'none',cardOn:!!t?.card_on,account:t?.stripe_account_id??''}},Object.defineProperty(e,"savePaySettings",{enumerable:!0,get:function(){return O}}),e.recentPayments=async function(){const{data:t,error:n}=await c().from('payments').select('id,kind,amount_pence,status,provider,created_at,paid_at').eq('venue_id',s()).order('created_at',{ascending:!1}).limit(20);if(n)throw n;return t??[]};var t=r(d[0]),n=r(d[1]),o=r(d[2]);const c=()=>(0,t.getSupabase)(),s=()=>{const t=n.useSync.getState().venueId;if(!t)throw new Error('Not connected to the venue yet.');return t},u=()=>(n.useSync.getState().staffRef??'').slice(0,80)||null,p=t=>(0,n.rpc)('shop_public',{p_slug:t});const _=t=>(0,n.rpc)('staff_gift_check',{p_venue:s(),p_code:t}),f=(t,o,c,u)=>(0,n.rpc)('staff_gift_redeem',{p_venue:s(),p_code:t,p_amount:o,p_key:c,p_by:u}),y=(t,o)=>(0,n.rpc)('staff_gift_activate',{p_card:t,p_by:o}),l=(t,o,c)=>(0,n.rpc)('staff_gift_issue',{p_venue:s(),p_amount:t,p_recipient:o,p_by:c}),b=(t,o,c)=>(0,n.rpc)('staff_gift_honour_wix',{p_venue:s(),p_code:t,p_balance:o,p_by:c}),w=(t,o,c)=>(0,n.rpc)('staff_gift_void',{p_card:t,p_reason:o,p_by:c}),h=()=>(0,n.rpc)('staff_gift_summary',{p_venue:s()}),v=(t,o,c,s)=>(0,n.rpc)('staff_shop_status',{p_order:t,p_status:o,p_reason:c,p_by:s});const S=async t=>{try{return await(0,n.rpc)('pay_public',{p_slug:t})}catch{return{provider:'none',cardOn:!1,testMode:!0}}};const P=t=>(0,n.rpc)('guest_pay_status',{p_payment:t});const O=t=>(0,n.rpc)('staff_payment_settings_save',{p_venue:s(),p_provider:t.provider,p_card_on:t.cardOn,p_account:t.account,p_by:u()})},1016,[863,820,1015]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.refreshCashAccess=r,e.setStaffCashUp=async function(c,o){const f=s.useSync.getState().venueId;if(!f)return{ok:!1,error:'Not connected. Try again when the app is online.'};const u=(0,t.getSupabase)();try{const{data:t}=await u.from('staff').select('id').eq('venue_id',f).eq('external_ref',c).maybeSingle();if(!t?.id)return{ok:!1,error:'This person isn\u2019t on the shared team list yet.'};const{error:s}=await u.rpc('set_staff_cash_up',{p_staff:t.id,p_on:o});return s?{ok:!1,error:/owner or manager/i.test(s.message)?'Only an owner or manager can change this.':'Could not save. Try again.'}:(n.useCashAccess.setState(t=>({byRef:{...t.byRef,[c]:o}})),r(),{ok:!0})}catch{return{ok:!1,error:'Could not save. Try again when the app is online.'}}};var t=_r(d[0]),s=_r(d[1]),n=_r(d[2]);async function r(){const r=s.useSync.getState().venueId;if(!r||'staff'!==s.useSync.getState().kind)return;const c=(0,t.getSupabase)();try{const[{data:t},{data:s}]=await Promise.all([c.rpc('my_cash_up_access',{p_venue:r}),c.from('staff').select('external_ref, can_cash_up').eq('venue_id',r)]),o={};if(Array.isArray(s))for(const t of s)t.external_ref&&(o[t.external_ref]=!!t.can_cash_up);n.useCashAccess.setState({mine:'boolean'==typeof t?t:n.useCashAccess.getState().mine,byRef:Array.isArray(s)?o:n.useCashAccess.getState().byRef,loaded:!0})}catch{}}},1017,[863,820,996]); +__d(function(g,_r,i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"RID",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"statusKind",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"statusLabel",{enumerable:!0,get:function(){return d}}),_e.nextStatus=function(e){return'new'===e.status||'acknowledged'===e.status?{to:'preparing',label:'Start preparing'}:'preparing'===e.status?{to:'ready',label:'takeaway'===e.type?'Mark ready (notify customer)':'Mark ready'}:'ready'===e.status?'takeaway'===e.type?{to:'collected',label:'Collected'}:{to:'served',label:'Served'}:null},Object.defineProperty(_e,"LIVE",{enumerable:!0,get:function(){return a}}),_e.busyLevel=b,_e.restOfDayLevel=function(e,r){const t=e.hours.filter(r=>!e.nextHour||r.hour>=e.nextHour.hour).reduce((e,r)=>!e||r.covers>e.covers?r:e,void 0);return{level:b(t?.covers??0,r.settings.capacityPerHour),peak:t}},_e.Tile=function({label:e,value:n,sub:c,onPress:u,accent:d,children:a}){const b=(0,s.jsxs)(t.default,{style:{flexGrow:1,flexBasis:150,backgroundColor:o.colours.surface,borderRadius:14,padding:12,borderWidth:1,borderColor:d??o.colours.border,gap:2},children:[(0,s.jsx)(l.T,{size:13,weight:"medium",colour:o.colours.muted,children:e}),(0,s.jsx)(l.T,{size:24,weight:"bold",colour:d??o.colours.text,children:n}),c?(0,s.jsx)(l.T,{size:13,colour:o.colours.muted,children:c}):null,a]});return u?(0,s.jsx)(r.default,{accessibilityRole:"button",accessibilityLabel:e,onPress:u,style:{flexGrow:1,flexBasis:150},children:b}):b},_e.SectionHead=function({title:e,right:r,sub:n}){return(0,s.jsxs)(t.default,{style:{gap:2,marginTop:6},children:[(0,s.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,s.jsx)(l.T,{weight:"semibold",size:o.font.large,colour:o.colours.gold,children:e}),r]}),n?(0,s.jsx)(l.Muted,{children:n}):null]})},_e.AlertBox=function({colour:e,title:r,children:n}){return(0,s.jsxs)(t.default,{style:{backgroundColor:o.colours.surface2,borderRadius:12,padding:10,borderLeftWidth:6,borderLeftColor:e,gap:6},children:[(0,s.jsx)(l.T,{weight:"bold",colour:e,children:r}),n]})},_e.Bars=function({data:e,max:r,highlight:n,height:c=110}){return(0,s.jsx)(l.Row,{gap:4,style:{alignItems:'flex-end'},children:e.map(e=>{const u=e.key===n,d=e.a+(e.b??0);return(0,s.jsxs)(t.default,{style:{alignItems:'center',flex:1,minWidth:26},children:[(0,s.jsx)(l.T,{size:11,colour:u?o.colours.gold:o.colours.muted,children:e.note??String(d)}),(0,s.jsxs)(t.default,{style:{height:c,width:'70%',justifyContent:'flex-end',borderBottomWidth:1,borderColor:o.colours.border},children:[e.b?(0,s.jsx)(t.default,{style:{height:Math.max(0,e.b/r*c),backgroundColor:u?o.colours.goldLight:'#6B5A3A'}}):null,(0,s.jsx)(t.default,{style:{height:Math.max(d?2:0,e.a/r*c),backgroundColor:u?o.colours.gold:'#9C7C45'}})]}),(0,s.jsx)(l.T,{size:11,colour:u?o.colours.gold:o.colours.muted,children:e.label})]},e.key)})})},Object.defineProperty(_e,"DemoTag",{enumerable:!0,get:function(){return f}}),_r(_d[0]);var r=e(_r(_d[1])),t=e(_r(_d[2])),l=_r(_d[3]),o=_r(_d[4]),n=_r(_d[5]),s=_r(_d[6]);const c=n.VENUE_RID,u=e=>'new'===e?'red':'ready'===e?'ok':'preparing'===e||'acknowledged'===e?'amber':'served'===e||'collected'===e?'blue':'neutral',d=e=>({new:'New',acknowledged:'Accepted',preparing:'Preparing',ready:'Ready',collected:'Collected',served:'Served',closed:'Closed',cancelled:'Cancelled'}[e.status]);const a=e=>!['collected','served','closed','cancelled'].includes(e.status);function b(e,r){const t=r?e/r:0;return t<.35?{label:'Quiet',colour:o.colours.ok,pct:t}:t<.6?{label:'Steady',colour:o.colours.blue,pct:t}:t<.85?{label:'Busy',colour:o.colours.amber,pct:t}:{label:'Very busy',colour:o.colours.red,pct:t}}const f=({label:e="DEMO"})=>(0,s.jsx)(l.Badge,{kind:"amber",label:e})},1018,[30,263,127,813,821,5,24]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.WhatsAppGuest=function({b:p,rid:o,kind:u="change"}){const c=(0,n.useRestaurant)(o);if(!c?.settings?.whatsapp||!(0,s.waNumber)(c.settings.whatsapp)||p.walkIn||!(0,s.waNumber)(p.phone))return null;const l=c.location?.split(',')[1]?.trim(),f=(0,s.staffWhatsAppTexts)({name:p.name,ref:p.ref,date:p.date,time:p.time,partySize:p.partySize},c.name,l&&!/fictional/i.test(l)?l:void 0),h='auto'===u?['confirmed','pending'].includes(p.status)?'confirm':'change':u,b=(0,s.waMeLink)(p.phone,'confirm'===h?f.confirm:f.change);return b?(0,r.jsx)(t.Button,{small:!0,kind:"secondary",label:"\ud83d\udcac WhatsApp guest",testID:`wa-guest-${p.ref}`,accessibilityLabel:`WhatsApp ${p.name}`,onPress:()=>{(0,s.openWhatsApp)(b)}}):null},_r(d[0]);var t=_r(d[1]),n=_r(d[2]),s=_r(d[3]),r=_r(d[4])},1019,[30,813,819,822,24]); +__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.requestChallenge=async function(t,s){const{data:u,error:o}=await n().rpc('venue_request_challenge',{p_slug:(0,e.queuedDatabaseSlug)(t),p_kind:s});if(o)throw o;return u},_e.sendVenueRequest=async function(t,s,u,o,c,l){const{data:_,error:p}=await n().rpc('submit_venue_request',{p_slug:(0,e.queuedDatabaseSlug)(t),p_kind:s,p_payload:u,p_challenge:o,p_answer:c,p_website:l});if(p)throw p;return _},_e.listVenueRequests=async function(e,t){const{data:s,error:u}=await n().from('venue_booking_requests').select('*').eq('venue_id',e).eq('kind',t).order('status',{ascending:!1}).order('created_at',{ascending:!1}).limit(100);if(u)throw u;return s||[]},_e.decideVenueRequest=async function(e,t){const{data:s,error:u}=await n().rpc('decide_venue_request',{p_id:e,p_decision:t});if(u)throw u;return s},Object.defineProperty(_e,"requestMessage",{enumerable:!0,get:function(){return s}});var e=r(d[0]),t=r(d[1]);const n=()=>(0,t.getSupabase)();const s=e=>{const t=String(e?.message||'');return/^(Requests are not enabled|Too many|Please complete|Enter your|Choose |This request|Only this venue)/.test(t)?t:'Unable to send or load requests. Check your connection and try again, or call the hotel.'}},1020,[6,863]); +__d(function(_g,_r,i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useStore",{enumerable:!0,get:function(){return n.useStore}}),_e.useNow=function(e=1e4){const r=(0,n.useStore)(e=>e.clock),[,u]=(0,t.useState)(0);return(0,t.useEffect)(()=>{const t=setInterval(()=>u(e=>e+1),e);return()=>clearInterval(t)},[e]),(0,n.nowFrom)(r)},Object.defineProperty(_e,"useRestaurant",{enumerable:!0,get:function(){return a}}),_e.useRecipeCards=c,_e.useAllMenu=f,_e.useMenu=function(e){const r=f(e);return(0,t.useMemo)(()=>r.filter(e=>!e.hidden),[r])},Object.defineProperty(_e,"useCustomer",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"useBasket",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"useOrders",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"useOrderAtTable",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"useOrder",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"useBookings",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"useWaitlist",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"useEvents",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"useStampCard",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"useGiftCards",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"useRatings",{enumerable:!0,get:function(){return M}}),Object.defineProperty(_e,"useAudit",{enumerable:!0,get:function(){return v}});var e=_r(_d[0]),t=_r(_d[1]),r=_r(_d[2]),n=_r(_d[3]),u=_r(_d[4]),s=_r(_d[5]),o=_r(_d[6]);_r(_d[7]);const a=e=>(0,n.useStore)(t=>t.restaurants.find(t=>t.id===e)),l=e=>(0,o.recipeCards)().subscribe(e),d=[];function c(e){return(0,t.useSyncExternalStore)(l,()=>e?(0,o.recipeCards)().list(e):d,()=>e?(0,o.recipeCards)().list(e):d)}function f(e){const u=(0,n.useStore)((0,r.useShallow)(t=>t.menu.filter(t=>t.restaurantId===e))),o=c(e);return(0,t.useMemo)(()=>(0,s.resolveMenu)(u),[u,o])}const b=()=>(0,n.useStore)(e=>e.customer),S=()=>(0,n.useStore)(e=>e.basket),g=(e,t)=>'table'!==t.type||(0,u.orderAtTableOn)(e.restaurants.find(e=>e.id===t.restaurantId)),m=e=>(0,n.useStore)((0,r.useShallow)(t=>t.orders.filter(r=>(!e||r.restaurantId===e)&&g(t,r)))),p=e=>(0,n.useStore)(t=>(0,u.orderAtTableOn)(t.restaurants.find(t=>t.id===e))),O=e=>(0,n.useStore)(t=>t.orders.find(t=>t.id===e)),y=e=>(0,n.useStore)((0,r.useShallow)(t=>e?t.bookings.filter(t=>t.restaurantId===e):t.bookings)),w=e=>(0,n.useStore)((0,r.useShallow)(t=>t.waitlist.filter(t=>t.restaurantId===e))),I=[],j=u=>{const s=(0,n.useStore)((0,r.useShallow)(e=>e.events.filter(e=>null===e.restaurantId||e.restaurantId===u))),o=(0,n.useStore)(e=>e.restaurants.find(e=>e.id===u)),a=o?(0,e.regularEventsOf)(o):I,l=(new Date).toISOString().slice(0,7);return(0,t.useMemo)(()=>{if(!u||!a.length)return s;const t=new Date,r=new Date(t.getFullYear(),t.getMonth()-2,1),n=new Date(t.getFullYear()+1,t.getMonth()+1,0),o=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`;return[...s,...(0,e.expandEvents)(u,a,o(r),o(n))]},[s,a,u,l])},P=e=>(0,n.useStore)(t=>t.stampCards.find(r=>r.restaurantId===e&&r.customerId===t.customer.id)),h=e=>(0,n.useStore)((0,r.useShallow)(t=>t.giftCards.filter(r=>(!e||r.restaurantId===e)&&r.ownerId===t.customer.id))),M=e=>(0,n.useStore)((0,r.useShallow)(t=>t.ratings.filter(t=>t.restaurantId===e))),v=e=>(0,n.useStore)((0,r.useShallow)(t=>t.audit.filter(t=>t.restaurantId===e)))},1021,[809,30,873,872,1240,1114,831,1094]); +__d(function(g,r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"METHOD_LABEL",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"DAY3",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"DAYS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"wd",{enumerable:!0,get:function(){return i}}),e.dayRange=function(t){const n=[...new Set(t)].sort((t,n)=>t-n);if(!n.length)return'';if(7===n.length)return'every day';return n.every((t,o)=>o===0||t===n[o-1]+1)&&n.length>=3?`${o[n[0]]} to ${o[n[n.length-1]]}`:n.map(t=>o[t]).join(', ')},e.nextDelivery=a,Object.defineProperty(e,"niceDay",{enumerable:!0,get:function(){return d}}),e.remindersFor=function(t,n,o={}){const d=i(n);return t.filter(t=>t.orderDays.includes(d)).flatMap(t=>{if(o[t.id]&&new Date(o[t.id]).toDateString()===n.toDateString())return[];let d=!1;if(/^\d\d:\d\d$/.test(t.cutoff)){const[o,s]=t.cutoff.split(':').map(Number),i=new Date(n);i.setHours(o,s,0,0),d=n>i}const l=a(t,n),c=t.reminder||`Order ${t.name} today${l?` for ${s[i(l)]}`:''}`;return[{supplierId:t.id,name:t.name,text:`${c}${t.cutoff?d?` (cut-off ${t.cutoff} passed)`:` by ${t.cutoff}`:''}`,tone:d?'red':'amber',cutoffPassed:d}]})},e.orderLines=function(n,o,s,i=""){const a=n.items.filter(t=>(o[t.id]??0)>0).map(n=>`${(0,t.fishInStone)(i,n)?(0,t.fishQtyText)(i,n,o[n.id]):`${l(o[n.id])} ${n.unit}`} ${n.name}`.replace(/\s+/g,' ').trim());return s.split('\n').map(t=>t.trim()).filter(Boolean).forEach(t=>a.push(t)),a},e.orderMessage=function(t,n,o,s,i,l){const c=a(t,l);return[`Hi ${t.contact||t.name.split(' (')[0]}, order from ${n}${o?`, ${o}`:''}${c?` for ${d(c)}`:''}:`,...s.map(t=>`- ${t}`),'',`Thanks, ${i}`].join('\n')},e.intlDigits=c,Object.defineProperty(e,"smsLink",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"waLink",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"telLink",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"sid",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"ANCHORAGE_SHEETS",{enumerable:!0,get:function(){return k}});var t=r(_d[0]);const n={online:'Online',phone:'Phone',text:'Text message',whatsapp:'WhatsApp',tbc:'To be decided'},o=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],s=['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'],i=t=>(t.getDay()+6)%7;function a(t,n){const o=null!=t.deliversOn?[t.deliversOn]:t.deliveryDays;if(!o.length)return null;for(let t=1;t<=7;t++){const s=new Date(n);if(s.setDate(s.getDate()+t),o.includes(i(s)))return s}return null}const d=t=>t.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'});const l=t=>Number.isInteger(t)?String(t):t.toFixed(1).replace(/\.0$/,'');function c(t){const n=t.replace(/[^\d+]/g,'').replace(/^\+/,'');return n.startsWith('00')?n.slice(2):n.startsWith('0')?`44${n.slice(1)}`:n}const u=(t,n)=>`sms:${t.replace(/[^\d+]/g,'')}?&body=${encodeURIComponent(n)}`,m=(t,n)=>`https://wa.me/${c(t)}?text=${encodeURIComponent(n)}`,f=t=>`tel:${t.replace(/[^\d+]/g,'')}`;let p=0;const h=(t="os")=>`${t}-${Date.now().toString(36)}${(p++).toString(36)}`,y=(t,n,o)=>({id:t,name:n,unit:o}),b=t=>({number:'',url:'',deliveryDays:[],orderDays:[],cutoff:'',frequency:'',reminder:'',priceCapPerKg:0,seller:'',items:[],notes:'',...t}),k=[b({id:'os-reids',name:'Reids',goods:'Dry goods and frozen',method:'online',urlLabel:'Open Coldweb',deliveryDays:[0,1,2,3,4],frequency:'Order on Coldweb',items:[y('rd-chips','Frozen chips','boxes'),y('rd-oil','Fryer oil','tubs'),y('rd-flour','Flour','bags'),y('rd-rice','Rice','bags'),y('rd-peas','Frozen peas','bags')],notes:'Order on their Coldweb ordering site. Add the Coldweb link in Managers \u203a Settings \u203a Supplier order sheets, or here.'}),b({id:'os-veg',name:'Veg',goods:'Fruit and veg (supplier to be added)',method:'tbc',placeholder:!0,frequency:'To be added by Gordon',notes:'Placeholder: Gordon will add the veg supplier, how to order and delivery days.'}),b({id:'os-peroni',name:'J. Pieroni & Sons',goods:'Seafood (fish merchant, Ayr)',method:'phone',url:'https://pieronis.com',urlLabel:'Open pieronis.com',deliveryDays:[0,1,2,3,4,5],frequency:'Phone order',items:[y('pa-haddock','Haddock fillets','kg'),y('pa-mussels','Mussels','kg'),y('pa-scallops','Scallops','kg'),y('pa-salmon','Salmon','kg')],notes:'Phone order. Press Call, then read the order from the screen.'}),b({id:'os-spesbona',name:'Spes Bona',goods:'Langoustines and smoked haddock',method:'text',orderDays:[2],deliversOn:4,deliveryDays:[4],frequency:'Text on Wednesday for Friday',reminder:'Text Spes Bona today for Friday\u2019s langoustines and smoked haddock',items:[y('sb-langs','Langoustines','kg'),y('sb-smoked','Smoked haddock','kg')]}),b({id:'os-tarelgin',name:'Tarelgin',goods:'Butcher',method:'text',frequency:'Text order',items:[y('tg-steak','Ribeye steaks',''),y('tg-mince','Steak mince','kg'),y('tg-chicken','Chicken breasts',''),y('tg-sausage','Sausages','kg')]}),b({id:'os-mills',name:'Mills',goods:'Milk',method:'whatsapp',frequency:'WhatsApp message',items:[y('ml-milk','Milk','litres'),y('ml-cream','Double cream','litres'),y('ml-butter','Butter','kg')]}),b({id:'os-kittyfisher',name:'Kittyfisher boat (Big Sean)',goods:'Lobsters and crabs',method:'text',contact:'Sean',frequency:'Whenever stock is low',shellfish:!0,items:[y('kf-lobster','Lobsters',''),y('kf-crab','Crabs','')],notes:'Text Big Sean whenever the lobster or crab count runs low.'}),b({id:'os-lionsmane',name:'Lion\u2019s mane mushroom',goods:'Lion\u2019s mane mushrooms',method:'online',urlLabel:'Open seller',frequency:'Weekly or fortnightly',priceCapPerKg:2500,seller:'Cheapest UK seller (to be chosen)',items:[y('lm-kg','Lion\u2019s mane mushroom','kg')],notes:'Order online from the cheapest UK seller under the price cap. Check the price per kg before you buy.'})]},1022,[1025]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BigText=D,_e.TimeGrid=v,_e.ScopePicker=I,_e.BlockNowSheet=B,_e.DatePicker=C,_e.AddBlockSheet=P,_e.FutureBlocksList=R,_e.BlocksScreen=L,_e.DisplayBlocksScreen=W,_e.DisplayBlocksMenu=function({rid:e,r:t,now:o,by:l,onClose:n}){const[a,i]=(0,s.useState)('menu');return'now'===a?(0,y.jsx)(B,{rid:e,r:t,now:o,by:l,wide:!0,onClose:n}):'future'===a?(0,y.jsx)(P,{rid:e,r:t,now:o,by:l,wide:!0,onClose:n}):'list'===a?(0,y.jsx)(W,{rid:e,r:t,now:o,by:l,onBack:n}):(0,y.jsxs)(m.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:560,testID:"display-blocks-menu",children:[(0,y.jsx)(D,{wide:!0,testID:"dbm-now",label:"Block now",sub:"Pause bookings today",onPress:()=>i('now')}),(0,y.jsx)(D,{wide:!0,testID:"dbm-future",label:"Block future",sub:"A future date, time or tables",onPress:()=>i('future')}),(0,y.jsx)(D,{wide:!0,testID:"dbm-list",label:"All blocked times",sub:"See, change or remove a block",onPress:()=>i('list')}),(0,y.jsx)(m.Muted,{children:"Tip: anyone on the Display can add, change or remove a block. Removing asks you to confirm, and every change is logged."})]})};var t=_r(_d[0]),s=_r(_d[1]),o=e(_r(_d[2])),l=e(_r(_d[3])),n=e(_r(_d[4])),a=e(_r(_d[5])),i=e(_r(_d[6])),d=_r(_d[7]),r=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),g=_r(_d[13]),m=_r(_d[14]),x=_r(_d[15]),p=_r(_d[16]),f=_r(_d[17]),y=_r(_d[18]);const k=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],w=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],j=e=>{try{o.default.announceForAccessibility?.(e)}catch{}};function D({label:e,sub:t,onPress:s,selected:o,disabled:l,testID:a,a11y:i,wide:d}){return(0,y.jsxs)(n.default,{testID:a,accessibilityRole:"button",accessibilityLabel:i??(t?`${e}, ${t}`:e),accessibilityState:{selected:!!o,disabled:!!l},disabled:l,onPress:s,style:({pressed:e})=>({minHeight:52,minWidth:d?void 0:84,flexGrow:d?1:0,paddingHorizontal:14,paddingVertical:8,borderRadius:14,borderWidth:1.5,borderColor:o?b.colours.gold:b.colours.border,backgroundColor:o?b.colours.gold:e?b.colours.goldTint:b.colours.surface2,opacity:l?.35:1,justifyContent:'center'}),children:[(0,y.jsx)(m.T,{size:18,weight:"semibold",colour:o?b.colours.onGold:b.colours.goldLight,center:!0,children:e}),t?(0,y.jsx)(m.T,{size:13,colour:o?b.colours.onGold:b.colours.muted,center:!0,children:t}):null]})}function v({from:e,to:t,min:o,max:l,onChange:n,testID:a="time-grid"}){const[d,r]=(0,s.useState)(e?'to':'from'),c=(0,u.quarterTimes)(o,l),g=t=>{if('from'===d||!e||(0,h.toMins)(t)<=(0,h.toMins)(e))return n(t,void 0),r('to'),void j(`From ${(0,u.rangeText)(t,t).split('\u2013')[0]}. Now pick the end time.`);n(e,t),r('from'),j(`Block ${(0,u.rangeText)(e,t)}`)};return c.length?(0,y.jsxs)(i.default,{testID:a,style:{gap:6},children:[(0,y.jsxs)(m.T,{size:15,weight:"semibold",colour:b.colours.gold,children:['from'!==d&&e?'Now tap the end time':'Tap the start time',e?` \xb7 ${(0,u.rangeText)(e,t??e)}`:'']}),(0,y.jsx)(i.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:6},children:c.map(s=>{const o=!!e&&!!t&&(0,h.toMins)(s)>=(0,h.toMins)(e)&&(0,h.toMins)(s)<=(0,h.toMins)(t);return(0,y.jsx)(D,{testID:`${a}-${s.replace(':','')}`,label:(0,u.rangeText)(s,s).split('\u2013')[0],a11y:`${'from'===d?'From':'To'} ${(0,u.rangeText)(s,s).split('\u2013')[0]}`,selected:s===e||s===t||o,onPress:()=>g(s)},s)})})]}):(0,y.jsx)(m.Muted,{children:"No times left today."})}function I({rid:e,value:o,onChange:l}){const n=(0,c.usePlan)(e),[a,d]=(0,s.useState)(!!o.tables?.length);return(0,y.jsxs)(i.default,{style:{gap:6},testID:"block-scope",children:[(0,y.jsx)(m.T,{size:15,weight:"semibold",children:"Where (optional)"}),(0,y.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,y.jsx)(m.Chip,{testID:"scope-all",label:"All areas",selected:!o.areaId&&!o.tables?.length&&!a,onPress:()=>{d(!1),l({})}}),n.areas.map(e=>(0,y.jsx)(m.Chip,{testID:`scope-area-${e.id}`,label:e.name,selected:o.areaId===e.id,onPress:()=>{d(!1),l({areaId:e.id,areaName:e.name})}},e.id)),(0,y.jsx)(m.Chip,{testID:"scope-tables",label:"Some tables",selected:a,onPress:()=>{d(!0),l({tables:o.tables??[]})}})]}),a?(0,y.jsx)(m.Row,{wrap:!0,gap:6,children:n.tables.map(e=>{const s=!!o.tables?.includes(e.name);return(0,y.jsx)(m.Chip,{testID:`scope-table-${e.name}`,label:(0,t.tableNumbers)(e.name),selected:s,onPress:()=>l({tables:s?(o.tables??[]).filter(t=>t!==e.name):[...o.tables??[],e.name]})},e.id)})}):null]})}function T({value:e,note:t,onChange:s,onNote:o}){return(0,y.jsxs)(i.default,{style:{gap:6},children:[(0,y.jsx)(m.T,{size:15,weight:"semibold",children:"Reason (optional)"}),(0,y.jsx)(m.Row,{wrap:!0,gap:6,children:r.BLOCK_REASONS.map(t=>(0,y.jsx)(m.Chip,{label:t,selected:e===t,onPress:()=>s(e===t?void 0:t)},t))}),(0,y.jsx)(m.Field,{label:"Note (optional)",value:t,onChangeText:e=>o(e.slice(0,120)),placeholder:"e.g. Christening party",testID:"block-note"})]})}function S({line:e,clashes:t,testID:o="block-confirm"}){return(0,s.useEffect)(()=>{j(`${e}. ${t?`${t} booking${1===t?' is':'s are'} already in this time and will be kept.`:''}`)},[e,t]),(0,y.jsxs)(i.default,{testID:o,accessibilityLiveRegion:"polite",style:{borderWidth:1.5,borderColor:b.colours.gold,borderRadius:14,padding:12,gap:6,backgroundColor:b.colours.goldTint},children:[(0,y.jsx)(m.T,{size:19,weight:"semibold",colour:b.colours.gold,children:e}),t?(0,y.jsx)(m.T,{size:15,colour:b.colours.amber,testID:"block-clash-warning",children:`${t} booking${1===t?' is':'s are'} already in this time. ${1===t?'It is':'They are'} kept: call the guest${1===t?'':'s'} if needed.`}):(0,y.jsx)(m.Muted,{children:"No bookings in this time yet."})]})}const $=e=>(0,u.roundUpQuarter)(60*e.getHours()+e.getMinutes())-(e.getMinutes()%15==0?0:15);function B({rid:e,r:t,now:o,by:l,onClose:n,wide:a}){const g=(0,h.ymd)(o),p=(0,c.useDisplaySettings)(e),f=(0,u.openWindow)(t,g),k=(0,u.servicesOn)(t,g,p.serviceWindows),w=Math.max(f?.from??0,$(o)),B=(0,d.useBookings)(e),C=(0,c.usePlan)(e),[P,M]=(0,s.useState)({}),[R,L]=(0,s.useState)(!1),[W,z]=(0,s.useState)({}),[N,E]=(0,s.useState)(),[A,F]=(0,s.useState)(''),[O,_]=(0,s.useState)('pick'),[G,Y]=(0,s.useState)(''),q=!!f&&we&&e.to>w?{from:(0,h.fromMins)(Math.max(e.from,w)),to:(0,h.fromMins)(e.to)}:null,U=H(k.lunch),K=H(k.dinner),Q=q?[{id:'rest',label:'Rest of today',w:{from:(0,h.fromMins)(w),to:(0,h.fromMins)(f.to)}},{id:'hour',label:'Next hour',w:{from:(0,h.fromMins)(w),to:(0,h.fromMins)(Math.min(f.to,w+60))}},{id:'lunch',label:'Lunch',w:U},{id:'dinner',label:'Dinner',w:K}]:[],V=!!P.from&&!!P.to&&(0,h.toMins)(P.to)>(0,h.toMins)(P.from)&&!(W.tables&&!W.tables.length),J=V?(0,u.confirmLine)({dates:[g],from:P.from,to:P.to,today:g,...W}):'',X=V?(0,u.bookingsInWindow)(B,[g],P.from,P.to,W,e=>C.tables.find(t=>t.name===e)?.areaId).length:0;return(0,y.jsx)(m.Sheet,{visible:!0,onClose:n,title:"Block now",maxWidth:a?760:void 0,testID:"block-now-sheet",children:'done'===O?(0,y.jsxs)(i.default,{style:{gap:10},accessibilityLiveRegion:"polite",children:[(0,y.jsx)(m.T,{size:19,weight:"semibold",colour:b.colours.gold,testID:"block-now-done",children:G}),(0,y.jsx)(m.Muted,{children:"The customer app stops offering these times. Staff see the block on the plan and the timeline."}),(0,y.jsx)(m.Button,{label:"Done",onPress:n,testID:"block-now-close"})]}):'confirm'===O?(0,y.jsxs)(i.default,{style:{gap:10},children:[(0,y.jsx)(S,{line:J,clashes:X}),(0,y.jsx)(m.Button,{testID:"block-now-save",label:"Save block",onPress:()=>{const t=r.useBlocks.getState().add({rid:e,date:g,from:P.from,to:P.to,reason:N,note:A.trim()||void 0,by:l,...W});(0,x.pushBlocksToWix)(e,[t.id],'add'),Y(`Saved. ${J.replace(/^Block/,'Blocked')}.`),j(`Saved. ${J}`),_('done')}}),(0,y.jsx)(m.Button,{kind:"ghost",label:"Change",onPress:()=>_('pick')})]}):(0,y.jsxs)(i.default,{style:{gap:12},children:[(0,y.jsx)(m.Muted,{children:"Tip: pick a time, then check the one-line summary before you save. Bookings already made are kept."}),q?(0,y.jsxs)(i.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"block-now-quick",children:[Q.map(e=>(0,y.jsx)(D,{wide:!0,testID:`block-now-${e.id}`,label:e.label,sub:e.w?(0,u.rangeText)(e.w.from,e.w.to):'Not today',disabled:!e.w,selected:!R&&P.label===e.id,onPress:()=>{L(!1),M({...e.w,label:e.id})}},e.id)),(0,y.jsx)(D,{wide:!0,testID:"block-now-custom",label:"From\u2013To",sub:"Pick the times",selected:R,onPress:()=>{L(!0),M({})}})]}):(0,y.jsx)(m.T,{colour:b.colours.amber,children:"Closed for the rest of today. Use Add a block for another day."}),q&&R?(0,y.jsx)(v,{min:w,max:f.to,from:P.from,to:P.to,onChange:(e,t)=>M({from:e,to:t}),testID:"block-now-grid"}):null,q?(0,y.jsx)(I,{rid:e,value:W,onChange:z}):null,q?(0,y.jsx)(T,{value:N,note:A,onChange:E,onNote:F}):null,V?(0,y.jsx)(m.T,{size:16,weight:"semibold",colour:b.colours.goldLight,testID:"block-now-line",children:J}):null,(0,y.jsx)(m.Button,{testID:"block-now-next",label:"Check and save",disabled:!V,onPress:()=>_('confirm')})]})})}function C({value:e,end:t,range:o,min:l,onPick:a,testID:d="block-cal"}){const[r,c]=(0,s.useState)(()=>(e??l).slice(0,7)),g=(0,h.parseYmd)(`${r}-01`),x=(g.getDay()+6)%7,p=[...Array(x).fill(null)];for(let e=new Date(g);e.getMonth()===g.getMonth();e.setDate(e.getDate()+1))p.push((0,h.ymd)(e));const f=e=>{const t=(0,h.parseYmd)(`${r}-01`);t.setMonth(t.getMonth()+e),c((0,h.ymd)(t).slice(0,7))},k=s=>{if(!o||!e||t||sf(-1)}),(0,y.jsx)(m.T,{size:18,weight:"semibold",colour:b.colours.gold,accessibilityRole:"header",children:(0,u.monthLabel)(`${r}-01`)}),(0,y.jsx)(m.Button,{small:!0,kind:"secondary",label:"Later \u203a",accessibilityLabel:"Next month",onPress:()=>f(1)})]}),(0,y.jsx)(i.default,{style:{flexDirection:'row'},children:['Mon','Tue','Wed','Thu','Fri','Sat','Sun'].map(e=>(0,y.jsx)(m.T,{size:13,colour:b.colours.muted,center:!0,style:{flex:1},children:e},e))}),(0,y.jsx)(i.default,{style:{flexDirection:'row',flexWrap:'wrap'},children:p.map((s,o)=>{if(!s)return(0,y.jsx)(i.default,{style:{width:"14.285714285714286%",height:48}},`e${o}`);const a=se&&sk(s),style:{height:46,borderRadius:10,alignItems:'center',justifyContent:'center',backgroundColor:r?b.colours.gold:b.colours.surface2,borderWidth:1,borderColor:r?b.colours.gold:b.colours.border,opacity:a?.3:1},children:(0,y.jsx)(m.T,{size:17,weight:"semibold",colour:r?b.colours.onGold:b.colours.text,children:String((0,h.parseYmd)(s).getDate())})})},s)})})]})}function P({rid:e,r:t,now:o,by:l,onClose:n,wide:a,edit:g,onEdit:p}){const f=(0,h.ymd)(o),$=(0,d.useBookings)(e),B=(0,c.usePlan)(e),[P,M]=(0,s.useState)(g?.date),[R,L]=(0,s.useState)(),[W,z]=(0,s.useState)(!1),[N,E]=(0,s.useState)(g?!!g.wholeDay:null),[A,F]=(0,s.useState)(g&&!g.wholeDay?g.from:void 0),[O,_]=(0,s.useState)(g&&!g.wholeDay?g.to:void 0),[G,Y]=(0,s.useState)(g?{areaId:g.areaId,areaName:g.areaName,tables:g.tables}:{}),[q,H]=(0,s.useState)(g?.reason),[U,K]=(0,s.useState)(g?.note??''),[Q,V]=(0,s.useState)('none'),[J,X]=(0,s.useState)([]),[Z,ee]=(0,s.useState)(),[te,se]=(0,s.useState)(!1),[oe,le]=(0,s.useState)('pick'),[ne,ae]=(0,s.useState)(''),ie=P?(0,u.openWindow)(t,P):null,de=ie?.from??540,re=ie?.to??1380,ce=P?(0,h.parseYmd)(P).getDay():0,ue='weekly'===Q?{kind:'weekly',days:J.length?J:[ce]}:'last'===Q?{kind:'last',weekday:ce}:{kind:'none'},he=P?g?[P]:(0,u.blockDates)(P,W?R:void 0,ue,Z):[],be=N?'00:00':A,ge=N?'23:59':O,me=!!P&&he.length>0&&null!=N&&!!be&&!!ge&&(0,h.toMins)(ge)>(0,h.toMins)(be)&&('none'===Q||!!Z)&&!(G.tables&&!G.tables.length),xe=(0,u.repeatText)(ue,Z),pe=me?(0,u.confirmLine)({dates:he,from:be,to:ge,wholeDay:!!N,today:f,repeat:xe,...G}):'',fe=me?(0,u.bookingsInWindow)($,he,be,ge,G,e=>B.tables.find(t=>t.name===e)?.areaId).filter(e=>e.id!==g?.id).length:0;return(0,y.jsx)(m.Sheet,{visible:!0,onClose:n,title:g?'Edit block':'Add a block',maxWidth:a?760:void 0,testID:"add-block-sheet",children:'done'===oe?(0,y.jsxs)(i.default,{style:{gap:10},accessibilityLiveRegion:"polite",children:[(0,y.jsx)(m.T,{size:19,weight:"semibold",colour:b.colours.gold,testID:"add-block-done",children:ne}),(0,y.jsx)(m.Muted,{children:"It shows in Future blocks. The customer app won't offer these times."}),(0,y.jsx)(m.Button,{label:"Done",onPress:n,testID:"add-block-close"})]}):'confirm'===oe?(0,y.jsxs)(i.default,{style:{gap:10},children:[(0,y.jsx)(S,{line:pe,clashes:fe,testID:"add-block-confirm"}),(0,y.jsx)(m.Button,{testID:"add-block-save",label:g?'Save changes':'Save block',onPress:()=>{const t={from:be,to:ge,wholeDay:!!N||void 0,reason:q,note:U.trim()||void 0,areaId:G.areaId,areaName:G.areaName,tables:G.tables?.length?G.tables:void 0};if(g)return p?.({...t,date:P}),ae(`Saved. ${pe.replace(/^Block/,'Blocked')}.`),void le('done');const s=he.length>1?`s-${Date.now().toString(36)}`:void 0,o=r.useBlocks.getState().addMany(he.map(o=>({rid:e,date:o,by:l,...t,seriesId:s,repeatText:xe??(he.length>1?`${(0,u.longDate)(he[0])} to ${(0,u.longDate)(he[he.length-1])}`:void 0),until:'none'!==Q?Z:void 0})));(0,x.pushBlocksToWix)(e,o.map(e=>e.id),'add'),ae(`Saved. ${pe.replace(/^Block/,'Blocked')}.`),j(`Saved. ${pe}`),le('done')}}),(0,y.jsx)(m.Button,{kind:"ghost",label:"Change",onPress:()=>le('pick')})]}):(0,y.jsxs)(i.default,{style:{gap:12},children:[(0,y.jsx)(m.Muted,{children:"Tip: tap a date (or a first and last date for a range), choose Whole day or the times, then check the summary."}),g?null:(0,y.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,y.jsx)(m.Chip,{testID:"add-single",label:"One date",selected:!W,onPress:()=>{z(!1),L(void 0)}}),(0,y.jsx)(m.Chip,{testID:"add-range",label:"A range of dates",selected:W,onPress:()=>{z(!0),V('none')}})]}),(0,y.jsx)(C,{value:P,end:R,range:W&&!g,min:f,onPick:(e,t)=>{M(e),L(t)}}),P?(0,y.jsx)(m.T,{size:16,weight:"semibold",colour:b.colours.goldLight,testID:"add-dates",children:W&&R?`${(0,u.longDate)(P)} to ${(0,u.longDate)(R)}`:(0,u.longDate)(P)}):null,P?(0,y.jsxs)(i.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,y.jsx)(D,{wide:!0,testID:"add-whole-day",label:"Whole day",selected:!0===N,onPress:()=>E(!0)}),(0,y.jsx)(D,{wide:!0,testID:"add-times",label:"From\u2013To",sub:ie?`Open ${(0,u.rangeText)((0,h.fromMins)(ie.from),(0,h.fromMins)(ie.to))}`:'Closed that day',selected:!1===N,onPress:()=>E(!1)})]}):null,P&&!1===N?(0,y.jsx)(v,{min:de,max:re,from:A,to:O,onChange:(e,t)=>{F(e),_(t)},testID:"add-grid"}):null,P?(0,y.jsx)(I,{rid:e,value:G,onChange:Y}):null,P?(0,y.jsx)(T,{value:q,note:U,onChange:H,onNote:K}):null,!P||g||W?null:(0,y.jsxs)(i.default,{style:{gap:6},testID:"add-repeat",children:[(0,y.jsx)(m.T,{size:15,weight:"semibold",children:"Repeat (optional)"}),(0,y.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,y.jsx)(m.Chip,{testID:"repeat-none",label:"Does not repeat",selected:'none'===Q,onPress:()=>V('none')}),(0,y.jsx)(m.Chip,{testID:"repeat-weekly",label:"Every week",selected:'weekly'===Q,onPress:()=>{V('weekly'),J.length||X([ce])}}),(0,y.jsx)(m.Chip,{testID:"repeat-last",label:`Last ${k[ce]} of the month`,selected:'last'===Q,onPress:()=>V('last')})]}),'weekly'===Q?(0,y.jsx)(m.Row,{wrap:!0,gap:6,children:w.map((e,t)=>(0,y.jsx)(m.Chip,{testID:`repeat-day-${t}`,label:e,selected:J.includes(t),onPress:()=>X(J.includes(t)?J.filter(e=>e!==t):[...J,t])},e))}):null,'none'!==Q?(0,y.jsxs)(i.default,{style:{gap:6},children:[(0,y.jsx)(m.T,{size:15,weight:"semibold",children:"Until (needed)"}),(0,y.jsxs)(m.Row,{wrap:!0,gap:6,children:[[1,3,6,12].map(e=>{const t=(0,h.parseYmd)(P);t.setMonth(t.getMonth()+e);const s=(0,h.ymd)(t);return(0,y.jsx)(m.Chip,{testID:`until-${e}`,label:12===e?'1 year':`${e} month${e>1?'s':''}`,selected:Z===s,onPress:()=>{ee(s),se(!1)}},e)}),(0,y.jsx)(m.Chip,{testID:"until-pick",label:"Pick a date",selected:te,onPress:()=>se(!0)})]}),te?(0,y.jsx)(C,{value:Z,min:(0,u.addDays)(P,1),onPick:e=>ee(e),testID:"until-cal"}):null,Z?(0,y.jsx)(m.Muted,{children:`${xe} \xb7 ${he.length} date${1===he.length?'':'s'}`}):null]}):null]}),me?(0,y.jsx)(m.T,{size:16,weight:"semibold",colour:b.colours.goldLight,testID:"add-line",children:pe}):null,(0,y.jsx)(m.Button,{testID:"add-block-next",label:"Check and save",disabled:!me,onPress:()=>le('confirm')})]})})}function M({b:e,onEdit:t,onRemove:s}){const o=(0,u.whatText)(e);return(0,y.jsxs)(i.default,{testID:`fb-${e.id}`,style:{borderWidth:1,borderColor:b.colours.border,borderRadius:12,padding:12,gap:4,backgroundColor:b.colours.surface2},accessible:!1,children:[(0,y.jsxs)(m.T,{size:17,weight:"semibold",colour:b.colours.goldLight,children:[(0,u.longDate)(e.date)," \xb7 ",(0,u.rangeText)(e.from,e.to,e.wholeDay)]}),(0,y.jsxs)(m.T,{children:[o,e.reason?` \xb7 ${e.reason}`:'',e.note?` \xb7 ${e.note}`:'']}),e.repeatText?(0,y.jsx)(m.Muted,{children:e.repeatText}):null,(0,y.jsxs)(m.Muted,{size:13,children:["Added by ",e.by||'staff',e.editedBy?` \xb7 changed by ${e.editedBy}`:'']}),(0,y.jsxs)(m.Row,{gap:8,children:[(0,y.jsx)(m.Button,{small:!0,kind:"secondary",label:"Edit",accessibilityLabel:`Edit the block on ${(0,u.longDate)(e.date)}`,testID:`fb-edit-${e.id}`,onPress:t}),(0,y.jsx)(m.Button,{small:!0,kind:"ghost",label:"Remove",accessibilityLabel:`Remove the block on ${(0,u.longDate)(e.date)}`,testID:`fb-remove-${e.id}`,onPress:s})]})]})}function R({rid:e,r:t,now:o,by:l,display:n,wide:a}){const d=(0,r.useBlocks)(e=>e.blocks),c=(0,h.ymd)(o),g=(0,u.groupByMonth)(d,e,c,(0,h.hm)(o)),k=(0,s.useMemo)(()=>(0,u.ruleRows)(t,c),[t.id,c]),[w,D]=(0,s.useState)(null),[v,I]=(0,s.useState)(null),[T,S]=(0,s.useState)(''),$=e=>e.seriesId?d.filter(t=>t.seriesId===e.seriesId&&t.date>=c):[e],B=t=>{const s=t.length>1?`${t.length} blocks removed`:`Block on ${(0,u.longDate)(t[0].date)} removed`;if(!n)return t.forEach(e=>r.useBlocks.getState().remove(e.id,l)),(0,x.pushBlocksToWix)(e,t.map(e=>e.id),'remove'),S(`${s}. Bookings are open again for that time.`),j(s),void I(null);(async()=>{for(const e of t){if(!((0,f.isLive)()?await(0,p.displayBlockEdit)(e.id,'remove',{},l):{ok:!0}).ok)return void S('Could not remove it. Try again.');(0,f.isLive)()||r.useBlocks.getState().remove(e.id,l)}(0,x.pushBlocksToWix)(e,t.map(e=>e.id),'remove'),S(`${s}. Bookings are open again for that time.`),j(s),I(null)})()},C=(t,s)=>{if(!n)return r.useBlocks.getState().update(t.id,s,l),void(0,x.pushBlocksToWix)(e,[t.id],'edit');(async()=>{((0,f.isLive)()?await(0,p.displayBlockEdit)(t.id,'edit',s,l):{ok:!0}).ok?((0,f.isLive)()||r.useBlocks.getState().update(t.id,s,l),(0,x.pushBlocksToWix)(e,[t.id],'edit'),S(`Block on ${(0,u.longDate)(s.date??t.date)} changed.`)):S('Could not change it. Try again.')})()},R=[...new Set([...g.map(e=>e.month),...k.map(e=>(0,u.monthLabel)(e.date))])].sort((e,t)=>Date.parse(`1 ${e}`)-Date.parse(`1 ${t}`));return(0,y.jsxs)(i.default,{style:{gap:12},testID:"future-blocks",children:[T?(0,y.jsx)(i.default,{accessibilityLiveRegion:"polite",children:(0,y.jsx)(m.T,{colour:b.colours.goldLight,testID:"fb-msg",children:T})}):null,g.length?null:(0,y.jsx)(m.Muted,{testID:"fb-empty",children:"No blocks coming up. Online and staff bookings are open as normal."}),R.map(e=>{const t=g.find(t=>t.month===e)?.items??[],s=k.filter(t=>(0,u.monthLabel)(t.date)===e);return(0,y.jsxs)(i.default,{style:{gap:8},children:[(0,y.jsx)(m.T,{size:18,weight:"semibold",colour:b.colours.gold,accessibilityRole:"header",children:e}),t.map(e=>(0,y.jsx)(M,{b:e,onEdit:()=>D(e),onRemove:()=>I(e)},e.id)),s.map(e=>(0,y.jsxs)(i.default,{testID:`fb-rule-${e.date}`,style:{borderWidth:1,borderStyle:'dashed',borderColor:b.colours.border,borderRadius:12,padding:10,gap:2},children:[(0,y.jsxs)(m.T,{weight:"semibold",children:[(0,u.longDate)(e.date)," \xb7 ",e.name]}),(0,y.jsxs)(m.Muted,{children:[e.text," \xb7 regular rule, set in Settings \u203a Advanced \u203a Regular events"]})]},`${e.name}-${e.date}`))]},e)}),w?(0,y.jsx)(P,{rid:e,r:t,now:o,by:l,wide:a,edit:w,onClose:()=>D(null),onEdit:e=>C(w,e)}):null,v?(0,y.jsxs)(m.Sheet,{visible:!0,onClose:()=>I(null),title:"Remove this block?",testID:"fb-remove-confirm",children:[(0,y.jsx)(m.T,{size:17,children:`${(0,u.longDate)(v.date)}, ${(0,u.rangeText)(v.from,v.to,v.wholeDay)}, ${(0,u.whatText)(v).toLowerCase()}.`}),(0,y.jsx)(m.Muted,{children:"Bookings open again for that time. The removal is kept in the log."}),(0,y.jsx)(m.Button,{testID:"fb-remove-one",label:$(v).length>1?'Remove this date only':'Remove block',onPress:()=>B([v])}),$(v).length>1?(0,y.jsx)(m.Button,{testID:"fb-remove-series",kind:"secondary",label:`Remove all ${$(v).length} in this series`,onPress:()=>B($(v))}):null,(0,y.jsx)(m.Button,{kind:"ghost",label:"Keep it",onPress:()=>I(null)})]}):null]})}function L({rid:e,r:t,now:o,by:l,display:n,wide:a}){const[d,r]=(0,s.useState)(null);return(0,y.jsxs)(i.default,{style:{gap:12},testID:"blocks-screen",children:[(0,y.jsx)(m.Muted,{children:"Tip: Block now pauses new bookings today. Add a block closes a future date, a time, an area or some tables, once or every week. Existing bookings are always kept."}),(0,y.jsxs)(i.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,y.jsx)(D,{wide:!0,testID:"blocks-now",label:"Block now",sub:"Today",onPress:()=>r('now')}),(0,y.jsx)(D,{wide:!0,testID:"blocks-add",label:"Add a block",sub:"Future dates",onPress:()=>r('add')})]}),(0,y.jsx)(m.T,{size:20,weight:"semibold",children:"Future blocks"}),(0,y.jsx)(R,{rid:e,r:t,now:o,by:l,display:n,wide:a}),'now'===d?(0,y.jsx)(B,{rid:e,r:t,now:o,by:l,wide:a,onClose:()=>r(null)}):null,'add'===d?(0,y.jsx)(P,{rid:e,r:t,now:o,by:l,wide:a,onClose:()=>r(null)}):null]})}function W({rid:e,r:t,now:s,by:o,onBack:n}){return(0,g.useBackLayer)(!0,n),(0,y.jsx)(l.default,{visible:!0,animationType:"fade",onRequestClose:n,children:(0,y.jsxs)(i.default,{style:{flex:1,backgroundColor:b.colours.bg,padding:16},testID:"display-blocks-screen",children:[(0,y.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(g.BackButton,{onPress:n,testID:"display-blocks-back"}),(0,y.jsx)(m.T,{size:22,weight:"semibold",colour:b.colours.gold,children:"Block bookings"}),(0,y.jsx)(i.default,{style:{width:96}})]}),(0,y.jsx)(a.default,{contentContainerStyle:{paddingBottom:40,maxWidth:900,width:'100%',alignSelf:'center'},children:(0,y.jsx)(L,{rid:e,r:t,now:s,by:o,display:!0,wide:!0})})]})})}},1023,[808,30,118,256,263,151,127,819,824,825,1394,818,821,991,813,1395,955,820,24]); +__d(function(g,_r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ANCHORAGE_ID",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"isAnchorage",{enumerable:!0,get:function(){return n}}),e.isBarFridge=r,Object.defineProperty(e,"chefCanSee",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"demoActor",{enumerable:!0,get:function(){return s}}),e.hasRealSignature=c,e.isDemoCard=function(t){return!c(t)&&(['example','sample','demo'].includes(t.origin||'')||s(t.updatedBy))},Object.defineProperty(e,"isSeedChefChat",{enumerable:!0,get:function(){return u}});const t='6349aa07-3fec-46e9-8c69-7b1b08494793',n=n=>'anchorage'===n||n===t;function r(t){if('string'==typeof t)return/\bbar[\s_-]*(?:fridge|refrigerat)|\b(?:fridge|refrigerator)[\s_-]*(?:in[\s_-]*the[\s_-]*)?bar\b|^cp-bar$/i.test(t);if(!t||'object'!=typeof t)return!1;const n=t;return!!r(['name','label','kind','unit','location','storage','storageLocation'].map(t=>n[t]).filter(t=>'string'==typeof t).join(' '))||['id','key','pointId','name','label','unit','location','storage','storageLocation','aliases'].some(t=>Array.isArray(n[t])?n[t].some(r):'string'==typeof n[t]&&r(n[t]))}const o=(t,o)=>!n(t)||!r(o),s=t=>'string'==typeof t&&/(?:\b(?:example|sample|demo)\b)/i.test(t);function c(t){return[t.signOff?.by,t.allergensConfirmed?.by].some(t=>!!t&&!s(t))}const f={'m-seed-all':'Welcome to the team chat on CoverCharge.','m-seed-kitchen':'Kitchen channel: Head Chef, kitchen team and managers.','m-seed-foh':'Front of house channel: front of house, bar and managers.','m-seed-managers':'Managers channel: owners, managers and the supervisor only.'},u=t=>'system'===t.from&&(!!f[t.id]&&f[t.id]===t.text||'m-seed-all'===t.id&&/this phone only/.test(t.text||''))},1024,[]); +__d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"KG_PER_STONE",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"HALF_STONE_KG",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"isFishName",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"fishInStone",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"halfStone",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"toStone",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"fromStone",{enumerable:!0,get:function(){return c}}),e.stoneText=b,e.stoneSpeech=h,Object.defineProperty(e,"fishQtyText",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"fishQtySpeech",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"quantityStep",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"stepQuantity",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"inputQuantity",{enumerable:!0,get:function(){return P}}),Object.defineProperty(e,"quantityUnit",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"displayedCost",{enumerable:!0,get:function(){return k}}),e.parseStoneAmount=function(t){if('number'==typeof t)return Number.isFinite(t)?t:void 0;const n=t.toLowerCase().trim();if(/\b(?:kg|kilos?|kilograms?|grams?)\b/.test(n))return;const i=n.match(/(?:^|\s)(\d+(?:[.,]\d+)?)(\xbd)?(?:\s*(?:stone|st)\b|$)/);if(i)return Number(i[1].replace(',','.'))+(i[2]?.5:0);const o=n.match(/\b(zero|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve|thirteen|fourteen|fifteen|sixteen|seventeen|eighteen|nineteen|twenty)(?: and a half)?(?: stone| st|$)/);return o?l.indexOf(o[1])+(/and a half/.test(o[0])?.5:0):/(?:^|\s)(?:\xbd|(?:a )?half(?: a)?)(?: stone| st|$)/.test(n)?.5:void 0};var t=r(d[0]);const n=6.35029318,i=3.17514659,o=(t="")=>!/\b(?:vegan|vegetarian|banana|blossom|mushroom|sauce|stock|oil)\b|\(vg\)/i.test(t)&&/\b(?:fish|haddock|salmon|cod|hake|halibut|plaice|sole|turbot|trout|mackerel|monkfish|seabass|sea bass|seabream|sea bream|tuna|pollock|coley|whiting|sardines?|anchov(?:y|ies)|herring)\b/i.test(t),u=(n,i)=>(0,t.isAnchorage)(n)&&/^(kg|kilos?|kilograms?|st|stone)$/i.test(i.unit||'')&&o(i.name),s=t=>Math.round(2*(t+Number.EPSILON))/2,f=(t,i="kg")=>/^(st|stone)$/i.test(i)?t:t/n,c=(t,i="kg")=>/^(st|stone)$/i.test(i)?t:t*n;function b(t){const n=s(Math.abs(t)),i=Math.floor(n);return`${t<0&&n?'\u2212':''}${n%1?`${i||''}\xbd`:i} stone`}const l=['zero','one','two','three','four','five','six','seven','eight','nine','ten','eleven','twelve','thirteen','fourteen','fifteen','sixteen','seventeen','eighteen','nineteen','twenty'];function h(t){const n=s(Math.abs(t)),i=Math.floor(n);return`${t<0&&n?'minus ':''}${n%1?i?`${l[i]||i} and a half`:'half a':l[i]||i} stone`}const y=(t,n,i)=>u(t,n)?b(f(i,n.unit)):`${i} ${n.unit||''}`.trim(),p=(t,n,i)=>u(t,n)?h(f(i,n.unit)):y(t,n,i),O=(t,n)=>u(t,n)?c(.5,n.unit):'kg'===n.unit?.5:1,v=(t,n,i,o)=>u(t,n)?c(Math.max(0,s(f(i,n.unit))+.5*o),n.unit):Math.max(0,i+o*O(t,n)),P=(t,n,i)=>u(t,n)?c(s(i),n.unit):i,j=(t,n)=>u(t,n)?'stone':n.unit||'',k=(t,n,i)=>u(t,n)?i*c(1,n.unit):i},1025,[1024]); +__d(function(g,r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useShellStore",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"localShellfish",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"shellfish",{enumerable:!0,get:function(){return E}}),Object.defineProperty(_e,"useStockItems",{enumerable:!0,get:function(){return I}}),_e.venueCounts=w,_e.useShellfish=function(e,t,s){const a=I(e).filter(t=>'chef'!==s||(0,n.chefCanSee)(e,t)),o=_(t=>!!t.server[e]),d=_((0,l.useShallow)(t=>t.events.filter(s=>s.rid===e&&(!t.server[e]||k(s))))),u=_((0,l.useShallow)(t=>w(t,e))),c=(0,f.lastUndoable)(d),v=e=>a.find(t=>t.key===e);return{items:a,events:d,counts:u,undoable:c,synced:o,itemOf:v,isLow:e=>(0,f.isLowItem)(v(e),u[e]??0),sell:(n,a=!1)=>{const o=v(n),d=o&&(0,i.fishInStone)(e,o)?i.HALF_STONE_KG:a?.5:1;return!((u[n]??0){i>0&&E.append({rid:e,kind:n,delta:i,reason:'delivery',by:t,app:s})},recount:(n,i)=>{const a=i-(u[n]??0);a&&E.append({rid:e,kind:n,delta:a,reason:'count',by:t,app:s})},undoLast:()=>{c&&E.append({rid:e,kind:c.kind,delta:-c.delta,reason:'undo',by:t,app:s,undoes:c.id})}}};var e,t=r(_d[0]),s=r(_d[1]),n=r(_d[2]),i=r(_d[3]),a=r(_d[4]),o=r(_d[5]),d=(e=o)&&e.__esModule?e:{default:e};r(_d[6]);var u=r(_d[7]),c=r(_d[8]),l=r(_d[9]),f=r(_d[10]),v=r(_d[11]),p=r(_d[12]);const S=()=>{try{return(0,p.nowFrom)(p.useStore.getState().clock)}catch{return new Date}},h='covercharge-shellfish-v1',y='anchorage',_=(0,u.create)()((0,c.persist)(e=>({events:[],items:a.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD?{}:{[y]:f.ANCHORAGE_STOCK.map(e=>({...e}))},server:{},saveItem:(t,s)=>e(e=>{const n=e.items[t]??[];return{items:{...e.items,[t]:n.some(e=>e.key===s.key)?n.map(e=>e.key===s.key?s:e):[...n,s]}}}),removeItem:(t,s)=>e(e=>({items:{...e.items,[t]:(e.items[t]??[]).filter(e=>e.key!==s)}}))}),{name:h,storage:(0,c.createJSONStorage)(()=>d.default),version:4,partialize:e=>({events:e.events,items:e.items,server:e.server}),migrate:async e=>{t.LIVE_VENUE_BUILD&&e&&await(0,s.archiveChefCache)('tracked-stock',e);const n=e??{};return{events:(i=n.events,(i??[]).filter(e=>!e.id.startsWith('sf-seed-'))),items:n.items??(a.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD?{}:{[y]:f.ANCHORAGE_STOCK.map(e=>({...e}))}),server:n.server??{}};var i}})),b={list:e=>_.getState().events.filter(t=>t.rid===e),append:e=>{const t={...e,id:(0,v.uuid)(),at:e.at??S().toISOString()};return _.setState(e=>({events:[t,...e.events].slice(0,500)})),t},subscribe:e=>_.subscribe(e)},E=b;'undefined'!=typeof window&&window.addEventListener('storage',e=>{e.key===h&&_.persist.rehydrate()});const O=[],I=(e,t=!1)=>{const s=_(t=>t.items[e])??O;return t?s:s.filter(e=>e.active).sort((e,t)=>e.sort-t.sort)},k=e=>!e.id.startsWith('sf-');function w(e,t){const s=e.items[t]??[],n=e.server[t],i=e.events.filter(e=>e.rid===t);if(!n)return(0,f.countsOf)(i,s);const a=new Set(n.seen),o=new Date(Date.now()-2592e5).toISOString();return(0,f.countsOf)(i.filter(e=>k(e)&&!a.has(e.id)&&e.at>=o),s,n.counts)}},1026,[833,1132,1024,1025,5,1116,122,952,1117,873,1028,1033,872]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useOrderSheets",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"useSheets",{enumerable:!0,get:function(){return f}});var e,s=r(d[0]),t=r(d[1]),h=r(d[2]),n=r(d[3]),o=(e=n)&&e.__esModule?e:{default:e},c=r(d[4]),i=r(d[5]),u=r(d[6]);const p=()=>h.IS_ISOLATED_VENUE||s.LIVE_VENUE_BUILD?{}:{anchorage:u.ANCHORAGE_SHEETS.filter(e=>!e.placeholder).map(e=>({...e,items:e.items.map(e=>({...e}))}))},l=(0,c.create)()((0,i.persist)(e=>({sheets:p(),opened:{},upsert:(s,t)=>e(e=>{const h=e.sheets[s]??[];return{sheets:{...e.sheets,[s]:h.some(e=>e.id===t.id)?h.map(e=>e.id===t.id?t:e):[...h,t]}}}),patch:(s,t,h)=>e(e=>({sheets:{...e.sheets,[s]:(e.sheets[s]??[]).map(e=>e.id===t?{...e,...h}:e)}})),remove:(s,t)=>e(e=>({sheets:{...e.sheets,[s]:(e.sheets[s]??[]).filter(e=>e.id!==t)}})),markOpened:(s,t)=>e(e=>({opened:{...e.opened,[s]:t}})),reset:s=>e(e=>({sheets:{...e.sheets,[s]:'anchorage'===s&&p().anchorage||[]}}))}),{name:'covercharge-ordersheets-v1',storage:(0,i.createJSONStorage)(()=>o.default),version:3,migrate:async e=>{const h=e;return s.LIVE_VENUE_BUILD?(await(0,t.archiveChefCache)('order-sheets',h),{...h,sheets:{...h.sheets,anchorage:(h.sheets.anchorage||[]).filter(e=>!('os-veg'===e.id&&e.placeholder))}}):h}})),_=[],f=e=>l(s=>s.sheets[e])??_},1027,[833,1132,5,1116,952,1117,1022]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ANCHORAGE_STOCK",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"stockKey",{enumerable:!0,get:function(){return n}}),_e.countsOf=function(e,t=[],n={}){const s={...n};for(const e of t)s[e.key]=s[e.key]??0;for(const t of e)s[t.kind]=(s[t.kind]??0)+t.delta;const i=new Map(t.map(e=>[e.key,e]));return Object.fromEntries(Object.entries(s).map(([e,t])=>[e,o(i.get(e),t)]))},_e.lastUndoable=function(e){const t=new Set(e.filter(e=>e.undoes).map(e=>e.undoes));return e.find(e=>'undo'!==e.reason&&'count'!==e.reason&&!t.has(e.id))},Object.defineProperty(_e,"fmtCount",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"fmtStockCount",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"speakStockCount",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"isLowItem",{enumerable:!0,get:function(){return c}}),_e.describe=function(e,t){const n=(t?.name??e.kind).toLowerCase(),o=(t?.plural??`${e.kind}s`).toLowerCase(),u=t?i(e.rid,t,Math.abs(e.delta)):s(Math.abs(e.delta));return'delivery'===e.reason?`Delivery in: +${u} ${1===Math.abs(e.delta)?n:o}`:'sold-half'===e.reason?`Sold: half ${n}`:'sold'===e.reason?`Sold: ${u} ${1===Math.abs(e.delta)?n:o}`:'undo'===e.reason?`Undo (${e.delta>0?'+':'\u2212'}${u} ${n})`:`Count: ${u} ${o}`};var e=r(d[0]);const t=[{key:'lobster',name:'Lobster',plural:'Lobsters',unit:'half',lowAt:4,supplierId:'os-kittyfisher',icon:'\ud83e\udd9e',sort:1,active:!0},{key:'crab',name:'Crab',plural:'Crabs',unit:'whole',lowAt:4,supplierId:'os-kittyfisher',icon:'\ud83e\udd80',sort:2,active:!0}],n=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,'-').replace(/^-|-$/g,'').slice(0,40)||'item',o=(e,t)=>Math.max(0,'kg'===e?.unit?t:'half'===e?.unit?Math.round(2*t)/2:Math.round(t));const s=e=>{const t=Math.floor(e);return e-t>=.5?t?`${t}\xbd`:'\xbd':String(t)},i=(t,n,o)=>'kg'===n.unit?(0,e.fishQtyText)(t,n,o):s(o),u=(t,n,o)=>'kg'===n.unit?(0,e.fishQtySpeech)(t,n,o):s(o),c=(e,t)=>t<=(e?.lowAt??4)},1028,[1025]); +__d(function(g,_r,i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.gamesOn=function(){const e=m.useStore.getState().restaurants.find(e=>e.id===p.VENUE_RID);return!1!==e?.settings?.games},_e.usePlayable=v,Object.defineProperty(_e,"LENNY_GAME_URL",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"validGameUrl",{enumerable:!0,get:function(){return I}}),_e.gameBase=function(){const e=m.useStore.getState().restaurants.find(e=>e.id===p.VENUE_RID);return I(e?.settings?.gameUrl)??j},_e.BreakRoomCard=function({staffId:e,name:t,now:s}){const n=(0,m.useStore)(e=>!1!==e.restaurants.find(e=>e.id===p.VENUE_RID)?.settings?.games),[o,l]=(0,r.useState)(!1),c=v(e,s);return n?(0,k.jsxs)(u.Card,{children:[(0,k.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(u.T,{weight:"semibold",children:"\ud83e\uded6 Break room"}),(0,k.jsx)(u.T,{size:13,colour:c?w.colours.ok:w.colours.muted,children:c?'Open':'Opens on your break'})]}),(0,k.jsx)(u.Muted,{children:"Lenny\u2019s Kitchen Chaos, with the team as characters and a shared leaderboard. Playable on a break or when you\u2019re not clocked in."}),(0,k.jsx)(u.Button,{testID:"break-room-open",kind:"secondary",label:"Open the Break room",onPress:()=>l(!0)}),o?(0,k.jsx)(R,{staffId:e,name:t,playable:c,onClose:()=>l(!1)}):null]}):null},Object.defineProperty(_e,"displayName",{enumerable:!0,get:function(){return S}}),_e.BreakRoom=R;var t=_r(_d[0]),r=_r(_d[1]),s=e(r),n=e(_r(_d[2]));_r(_d[3]);var o=e(_r(_d[4])),l=e(_r(_d[5])),c=_r(_d[6]),u=_r(_d[7]),d=_r(_d[8]),f=_r(_d[9]),y=_r(_d[10]),m=_r(_d[11]),p=_r(_d[12]),h=_r(_d[13]),b=_r(_d[14]),w=_r(_d[15]),k=_r(_d[16]);function v(e,t){const r=(0,f.useOwner)(e=>e.attendance);if(!e)return!0;const s=(0,f.openShiftOf)(r,e,t);return!s||(0,f.isOnBreak)(s)}const j='https://lennys-kitchen-chaos-13e285.deed.page/',I=e=>{try{const t=new URL(String(e??'').trim());return'https:'!==t.protocol||t.username||t.password?null:t.toString()}catch{return null}};function x(e){if('undefined'==typeof window)return null;const t=new URL(e);for(const e of['demo','unlock','name','staffId'])t.searchParams.delete(e);return t.searchParams.set('host','covercharge'),t.searchParams.set('hostOrigin',window.location.origin),{src:t.toString(),origin:t.origin}}const S=e=>String(e??'').replace(/\s*\(.*\)$/,'').replace(/\s+/g,' ').trim().slice(0,24).trim();function R({staffId:e,name:v,playable:R,onClose:E}){const C=(0,f.useOwner)(e=>e.staff),T=(0,d.useAvatars)(e=>e.photos),M=(0,y.useSetup)(e=>e.looks),P=(0,r.useRef)(null),[O,L]=(0,r.useState)({}),[U,N]=(0,r.useState)(!1),[_,B]=(0,r.useState)(null),D=(0,m.useStore)(e=>I(e.restaurants.find(e=>e.id===p.VENUE_RID)?.settings?.gameUrl)??j),$=(0,r.useMemo)(()=>x(D),[D]),q=$?.origin??'',A=(0,b.useSync)(e=>'staff'===e.kind?e.staffRef??null:null),z=!(!A||!e||A===e),G=z?null:A??e??null,V=S(v),[H,W]=(0,r.useState)(''),[F,K]=(0,r.useState)(null),Y=(0,r.useRef)(null),J=(0,r.useRef)(0),Q=(0,r.useRef)(null),X=(0,r.useRef)(R);X.current=R;const Z=(0,r.useMemo)(()=>C.filter(e=>e.active&&!e.name.includes('(example)')),[C]);(0,r.useEffect)(()=>{const e=setTimeout(()=>{const e={};for(const t of Z){const r=document.getElementById(`cc-av-${t.id}`)?.querySelector('svg');r&&(e[t.id]=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(r.outerHTML.includes('xmlns')?r.outerHTML:r.outerHTML.replace('clearTimeout(e)},[Z,M]);const ee=(0,r.useMemo)(()=>Z.map(e=>{const t=T[e.id]?.dataUrl??O[e.id],r={id:e.id,name:S(e.name),role:e.job||e.level||e.role};return t&&(r.avatarUrl=t),r}),[Z,T,O]),te=(0,r.useCallback)(e=>{try{q&&P.current?.contentWindow?.postMessage(e,q)}catch{}},[q]);return(0,r.useEffect)(()=>{const e=async e=>{if(!q||e.origin!==q||e.source!==P.current?.contentWindow)return;const t=e.data;if('string'!=typeof t?.type||!t.type.startsWith('lenny:'))return;if('lenny:ready'===t.type)return B('string'==typeof t.version?String(t.version).slice(0,12):null),void N(!0);const r=String(t.levelId??'').slice(0,40);if('lenny:scores:list'===t.type&&te({type:'lenny:scores:result',reqId:t.reqId,result:await(0,h.listScores)(r,Math.min(50,Number(t.limit)||10))}),'lenny:scores:submit'===t.type){const e=t.entry??{};if(!G||'string'==typeof e.staffId&&e.staffId!==G)return void te({type:'lenny:scores:result',reqId:t.reqId,result:{rank:null,entries:await(0,h.listScores)(r,10),id:null}});const s='string'==typeof e.characterId?e.characterId.slice(0,80):void 0;te({type:'lenny:scores:result',reqId:t.reqId,result:await(0,h.submitScore)(r,{score:Number(e.score)||0,stars:Number(e.stars)||0,badges:Array.isArray(e.badges)?e.badges.map(String).slice(0,30):[],stats:'object'==typeof e.stats&&e.stats?e.stats:{},characterId:s,character:'string'==typeof e.character?e.character.slice(0,60):void 0,staffId:G,name:V})})}'lenny:roundAbandoned'===t.type&&W('The last round was stopped because the player changed. No score was saved.'),'lenny:roundStart'===t.type&&W(''),'lenny:progress'===t.type&&G&&t.staffId===G&&(0,h.saveProgress)(G,t.progress),'lenny:gameComplete'===t.type&&G&&t.staffId===G&&W(!0===t.firstTime?'Game complete! Character select is now unlocked.':'Game complete again. Nice work!')};return window.addEventListener('message',e),()=>window.removeEventListener('message',e)},[te,G,V,q]),(0,r.useEffect)(()=>{N(!1),Y.current=null,Q.current=null},[$?.src]),(0,r.useEffect)(()=>{if(!U)return;const e=e=>{Q.current!==e&&(Q.current=e,te({type:'lenny:setPlayable',playable:e}))},t=z?null:`${G??''}|${V}`;if(t&&Y.current===t)return void e(R);const r=++J.current;Y.current=null,Q.current&&e(!1),t&&(0,h.loadProgress)(G).catch(()=>null).then(s=>{r===J.current&&(te({type:'lenny:setPlayer',name:V,staffId:G,...s?{progress:s}:{}}),Y.current=t,e(X.current))})},[U,z,G,V,R,te]),(0,r.useEffect)(()=>{U&&te({type:'lenny:setRoster',staff:ee})},[U,ee,te]),(0,r.useEffect)(()=>{U&&null!==F&&te({type:'lenny:setMuted',muted:F})},[U,F,te]),(0,k.jsx)(n.default,{visible:!0,animationType:"slide",onRequestClose:E,children:(0,k.jsxs)(l.default,{testID:"break-room",style:{flex:1,backgroundColor:(0,t.soutersSurface)('#000')},children:[(0,k.jsxs)(u.Row,{style:{justifyContent:'space-between',padding:10,backgroundColor:w.colours.bg},children:[(0,k.jsx)(u.T,{weight:"semibold",children:"\ud83e\uded6 Break room"}),(0,k.jsx)(l.default,{testID:R&&!z?'break-playable':'break-locked',accessibilityLabel:_?`Game version ${_}`:void 0,children:(0,k.jsx)(u.T,{size:13,colour:R?w.colours.ok:w.colours.gold,children:z?'Switching player\u2026':R?'On your break: enjoy!':'Back to work! Start a break to play.'})}),(0,k.jsxs)(u.Row,{gap:4,children:[(0,k.jsx)(o.default,{testID:"break-room-mute",accessibilityRole:"button",accessibilityLabel:F?'Turn sound and voice on':'Mute sound and voice',onPress:()=>K(!F),style:{padding:6},children:(0,k.jsx)(u.T,{weight:"semibold",colour:w.colours.gold,children:F?'Sound on':'Mute'})}),(0,k.jsx)(o.default,{testID:"break-room-close",accessibilityRole:"button",onPress:E,style:{padding:6},children:(0,k.jsx)(u.T,{weight:"semibold",colour:w.colours.gold,children:"Close"})})]})]}),H?(0,k.jsx)(l.default,{testID:"break-notice",style:{paddingHorizontal:10,paddingVertical:6,backgroundColor:w.colours.surface},children:(0,k.jsx)(u.T,{size:13,colour:w.colours.muted,children:H})}):null,$?s.default.createElement('iframe',{ref:P,src:$.src,key:$.src,title:'Lenny\u2019s Kitchen Chaos','data-testid':'break-game',allow:'autoplay; fullscreen',style:{flex:1,width:'100%',height:'100%',border:0,background:'#000'}}):(0,k.jsx)(l.default,{style:{flex:1,alignItems:'center',justifyContent:'center'},children:(0,k.jsx)(u.Muted,{children:"The Break room opens in the web app."})}),(0,k.jsx)(l.default,{style:{position:'absolute',left:-9999,top:0,width:64,height:64,opacity:0},pointerEvents:"none",children:Z.map(e=>(0,k.jsx)(l.default,{nativeID:`cc-av-${e.id}`,children:(0,k.jsx)(c.AvatarArt,{spec:null!=M[e.id]?(0,c.specFor)(`${e.id}#look${M[e.id]}`):(0,c.specFor)(e.id,e.name),size:96})},e.id))})]})})}},1029,[868,30,256,122,263,127,953,813,1201,856,1202,872,5,1334,820,821,24]); +__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"fmtH",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"fmtHDay",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"SHIFT_MIN_START",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"SHIFT_MAX_END",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"shiftTitle",{enumerable:!0,get:function(){return f}});var t=r(d[0]);const n=t=>{const n=(Math.round(60*t)%1440+1440)%1440;return`${String(Math.floor(n/60)).padStart(2,'0')}:${String(n%60).padStart(2,'0')}`},u=t=>`${n(t)}${t>=24?' (next day)':''}`,o=7,c=28,f=(n,u)=>`${n.replace(' (example)','')} \xb7 ${(0,t.niceDate)((0,t.parseYmd)(u))}`},1030,[818]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SHIFT_MANAGER_PERMS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"SHIFT_MANAGER_FEATURES",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"SHIFT_MANAGER_EXCLUDED",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"SHIFT_MANAGER_EXCLUDED_WORDS",{enumerable:!0,get:function(){return o}}),e.shiftManagerOn=function(n){return!(!n.inStaffApp||!n.managerAccess||'owner'===n.role)&&(n.live?n.perms.includes('shift.manager'):'staff'===n.app)},e.swapTargets=function(n,t){return n.filter(n=>n.active&&n.id!==t&&'owner'!==n.role)};const n=['bookings.manage','floor.manage','stock.manage','attendance.view','rota.swap','shift.manager'],t=['New, edit and cancel bookings; walk-ins; seat, move and finish tables; deposit status','Tables to clear','Block bookings and close the garden','Allergy checks','Sold out (86) and tracked stock','Who\u2019s clocked in','Approve shift swaps and cover'],s=['wages.view','wages.manage','orders.manage','staff.manage','roles.manage','venue.settings','devices.manage','rota.manage','suppliers.manage','suppliers.order','recipes.edit','recipes.signoff','outbox.view'],o='takings, wages, tips and payouts, HR, billing, venue settings and owner access'},1031,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"isLiveVenue",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"useLiveVenue",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"NOT_SET_UP",{enumerable:!0,get:function(){return f}});var t=r(d[0]),n=r(d[1]);const u=n=>!(t.PITCH||'live'!==n.mode&&'offline'!==n.mode||!n.venueId),o=()=>u(n.useSync.getState()),c=()=>(0,n.useSync)(t=>u(t)),f='Not set up yet'},1032,[2,820]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"uuid",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"isUuid",{enumerable:!0,get:function(){return t}});const x=()=>globalThis.crypto&&'randomUUID'in globalThis.crypto?globalThis.crypto.randomUUID():'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g,x=>{const t=16*Math.random()|0;return('x'===x?t:3&t|8).toString(16)}),t=x=>'string'==typeof x&&/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(x)},1033,[]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"venueInfo",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"useVenueInfo",{enumerable:!0,get:function(){return o}});var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]);const u=(t,n)=>{const r=n?.name??'Your venue',u=n?.location??'';return{rid:t,name:r,place:u,address:n?.address??[r,u].filter(Boolean).join(', '),tag:'#'+r.replace(/[^A-Za-z0-9]/g,'')}},s=s=>{const o=r.IS_ISOLATED_VENUE?r.VENUE_RID:s??n.useOwner.getState().site??r.VENUE_RID;return u(o,t.useStore.getState().restaurants.find(t=>t.id===o))},o=s=>{const o=(0,n.useOwner)(t=>t.site),c=r.IS_ISOLATED_VENUE?r.VENUE_RID:s??o??r.VENUE_RID,E=(0,t.useStore)(t=>t.restaurants.find(t=>t.id===c));return u(c,E)}},1034,[872,856,5]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.getCameraPermissionsAsync=l,_e.getMediaLibraryPermissionsAsync=y,_e.requestCameraPermissionsAsync=f,_e.requestMediaLibraryPermissionsAsync=b,Object.defineProperty(_e,"useMediaLibraryPermissions",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"useCameraPermissions",{enumerable:!0,get:function(){return w}}),_e.getPendingResultAsync=async function(){if(s.default.getPendingResultAsync)return s.default.getPendingResultAsync();return null},_e.launchCameraAsync=async function(e={}){if(!s.default.launchCameraAsync)throw new n.UnavailabilityError('ImagePicker','launchCameraAsync');const t=(0,o.mapDeprecatedOptions)(e);return await s.default.launchCameraAsync(c(t))},_e.launchImageLibraryAsync=async function(e={}){const t=(0,o.mapDeprecatedOptions)(e);if(!s.default.launchImageLibraryAsync)throw new n.UnavailabilityError('ImagePicker','launchImageLibraryAsync');t?.allowsEditing&&t.allowsMultipleSelection&&console.warn("[expo-image-picker] `allowsEditing` is not supported when `allowsMultipleSelection` is enabled and will be ignored.Disable either 'allowsEditing' or 'allowsMultipleSelection' in 'launchImageLibraryAsync' to fix this warning.");return await s.default.launchImageLibraryAsync(t)},Object.defineProperty(_e,"PermissionStatus",{enumerable:!0,get:function(){return n.PermissionStatus}});var e,n=r(d[0]),t=r(d[1]),s=(e=t)&&e.__esModule?e:{default:e},o=r(d[2]),u=r(d[3]);function c(e){const{aspect:t,quality:s,videoMaxDuration:o}=e;if(null!=t){const[e,s]=t;if(e<=0||s<=0)throw new n.CodedError('ERR_INVALID_ARGUMENT',`Invalid aspect ratio values ${e}:${s}. Provide positive numbers.`)}if(s&&(s<0||s>1))throw new n.CodedError('ERR_INVALID_ARGUMENT',`Invalid 'quality' value ${s}. Provide a value between 0 and 1.`);if(o&&o<0)throw new n.CodedError('ERR_INVALID_ARGUMENT',`Invalid 'videoMaxDuration' value ${o}. Provide a non-negative number.`);return e}async function l(){return s.default.getCameraPermissionsAsync()}async function y(e=!1){return s.default.getMediaLibraryPermissionsAsync(e)}async function f(){return s.default.requestCameraPermissionsAsync()}async function b(e=!1){return(0,s.default.requestMediaLibraryPermissionsAsync)(e)}Object.keys(u).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return u[e]}})});const P=(0,n.createPermissionHook)({getMethod:e=>y(e?.writeOnly),requestMethod:e=>b(e?.writeOnly)}),w=(0,n.createPermissionHook)({getMethod:l,requestMethod:f})},1035,[570,1282,1284,1283]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"hashOf",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"MASS_REMOVE",{enumerable:!0,get:function(){return c}}),_e.quietly=async function(e){l++;try{await e()}finally{l--;for(const e of u)e.resnapshot()}},Object.defineProperty(_e,"isQuiet",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"EntityBridge",{enumerable:!0,get:function(){return f}}),_e.venueChannel=function(e,t,n,s){let o=i().channel(`cc-live:${e}:${Math.random().toString(36).slice(2,8)}`);for(const{table:s,venueColumn:i}of t)o=o.on('postgres_changes',{event:'*',schema:'public',table:s,filter:`${i??'venue_id'}=eq.${e}`},e=>{n(s,'DELETE'===e.eventType?'delete':'upsert','DELETE'===e.eventType?e.old:e.new)});return o.subscribe(e=>s(e)),o},Object.defineProperty(_e,"onConnectivity",{enumerable:!0,get:function(){return t.onConnectivity}});var e=r(d[0]),t=r(d[1]),n=r(d[2]),s=r(d[3]);const i=()=>(0,e.getSupabase)(),o=e=>{if(null===e||'object'!=typeof e)return JSON.stringify(e)??'null';if(Array.isArray(e))return`[${e.map(o).join(',')}]`;const t=e;return`{${Object.keys(t).filter(e=>void 0!==t[e]).sort().map(e=>`${JSON.stringify(e)}:${o(t[e])}`).join(',')}}`},h=e=>{const t=o(e);let n=2166136261;for(let e=0;e>>0;return`${n.toString(36)}.${t.length}`},c=5;let l=0;const u=new Set;const p=()=>l>0;class f{known={};last=new Map;reconciled=!1;applying=!1;massOk=!1;unsub=null;constructor(e,t,n={}){this.spec=e,this.venueId=t,this.ev=n,this.kvKey=`known:${t}:${e.name}`}async start(){this.known=await n.kv.get(this.kvKey,{}),this.snapshotLocal(),u.add(this),this.unsub=this.spec.subscribe(()=>{l>0?this.snapshotLocal():!this.applying&&this.reconciled&&this.pushLocalChanges()})}stop(){this.unsub?.(),this.unsub=null,u.delete(this)}resnapshot(){this.snapshotLocal()}allowMassRemoveOnce(){this.massOk=!0}snapshotLocal(){this.last=new Map(this.spec.list().map(e=>[this.spec.key(e),h(e)]))}saveKnown(){n.kv.set(this.kvKey,this.known)}pending(e){return s.mutationQueue.hasPending(this.spec.table,this.venueId,e)}async read(){let e=i().from(this.spec.table).select('*').eq(this.spec.venueColumn??'venue_id',this.venueId);this.spec.filter&&(e=this.spec.filter(e));const{data:t,error:n}=await e.limit(2e3);if(n)throw n;const s=t??[];this.merge(s,!this.reconciled),this.reconciled=!0,this.spec.afterRead?.(s)}merge(e,t){const n=this.spec,s=new Map(n.list().map(e=>[n.key(e),e])),i=new Set,o=[],l=[],u=[],p=[];for(const t of e){const e=n.rowKey(t),c=n.fromRow(t);if(!c)continue;i.add(e),p.push(c);const l=h(c),f=s.get(e);if(!this.pending(e)){if(f){const t=h(f);if(t===l){this.known[e]=l;continue}if(this.known[e]&&t!==this.known[e]&&n.writable()&&n.syncable(f)){u.push(f);continue}}o.push(c),this.known[e]=l}}for(const[e,t]of s)i.has(e)||this.pending(e)||!n.syncable(t)||n.inWindow&&!n.inWindow(t)||(this.known[e]?l.push(e):n.writable()&&!n.supersededBy?.(t,p)&&u.push(t));const f=this.massOk;if(this.massOk=!1,l.length>c&&!f)this.ev.onSuspect?.(n.name,`read would remove ${l.length} of ${s.size}`),l.length=0,u.length=0;else for(const e of l)delete this.known[e];this.applyRemote(o,l);for(const e of u)this.write(e);this.saveKnown()}applyRemote(e,t){if(e.length||t.length){this.applying=!0;try{this.spec.apply(e,t)}finally{this.applying=!1}this.snapshotLocal(),this.ev.onActivity?.()}}remote(e,t){if(!this.reconciled)return;const n=this.spec,s=n.rowKey(t);if(this.pending(s))return;if('delete'===e){if(!this.last.has(s))return;return delete this.known[s],this.applyRemote([],[s]),this.saveKnown(),void n.onRemote?.(t,e)}const i=n.fromRow(t);if(!i)return;const o=h(i);this.known[s]=o,this.saveKnown(),this.last.get(s)!==o&&this.applyRemote([i],[]),n.onRemote?.(t,e)}pushLocalChanges(){const e=this.spec,t=new Map(e.list().map(t=>[e.key(t),t]));for(const[n,s]of t){const t=h(s);this.last.get(n)!==t&&(this.last.set(n,t),e.syncable(s)&&e.writable()&&this.known[n]!==t&&this.write(s))}const n=[...this.last.keys()].filter(e=>!t.has(e));for(const e of n)this.last.delete(e);const i=e.writable()&&!1!==e.deletes&&'insert'!==e.mode&&'update'!==e.mode?n.filter(e=>this.known[e]):[];if(e.protect&&i.length>c)return this.ev.onSuspect?.(e.name,`${i.length} items vanished at once; not deleted`),void this.saveKnown();for(const t of i)delete this.known[t],s.mutationQueue.enqueue({table:e.table,venueId:this.venueId,kind:'delete',rowKey:t,match:{...this.deleteMatch(t),venue_id:this.venueId}});this.saveKnown()}deleteMatch(e){return this.spec.matchKey?this.spec.matchKey(e):{id:e}}write(e){const t=this.spec,n=t.key(e);let i;try{i=t.toRow(e,this.venueId)}catch(e){return void this.ev.onError?.(t.name,String(e?.message??e))}if(this.known[n]=h(e),'update'===t.mode){const e=t.venueColumn??'venue_id';s.mutationQueue.enqueue({table:t.table,venueId:this.venueId,kind:'update',rowKey:n,values:i,match:{...t.matchKey?t.matchKey(n):{},[e]:this.venueId}})}else s.mutationQueue.enqueue({table:t.table,venueId:this.venueId,kind:'insert'===t.mode?'insert':'upsert',rowKey:n,values:i,conflictKey:t.conflict??'id'});this.ev.onActivity?.()}}},1092,[863,1197,1196,1095]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"cashUpId",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"salesId",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"cashSettingsId",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"defaultCashSettings",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"useCashUp",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"useCashSettings",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"useTipsShow",{enumerable:!0,get:function(){return y}});var t=e(_r(d[0])),s=e(_r(d[1])),r=_r(d[2]),n=_r(d[3]),o=_r(d[4]),u=_r(d[5]),l=_r(d[6]);const c=(e,t)=>(0,o.uuidFrom)(`cashup:${e}:${t}`),p=(e,t)=>(0,o.uuidFrom)(`sales:${e}:${t}`),h=e=>(0,o.uuidFrom)(`cashup-settings:${e}`),f=e=>({id:h(e),cashFields:u.DEFAULT_CASHUP_FIELDS.map(e=>({...e})),salesFields:u.DEFAULT_SALES_FIELDS.map(e=>({...e}))}),S=e=>{const t='number'==typeof e.vals.cashTips?e.vals.cashTips:null,s='number'==typeof e.vals.cardTips?e.vals.cardTips:null;return!e.confirmedAt||null==t&&null==s?null:{rid:e.rid,date:e.date,total:Math.round(100*((t??0)+(s??0)))/100,postedAt:e.confirmedAt,postedBy:e.confirmedBy}},b=(0,r.create)()((0,n.persist)((e,t)=>({cashUps:[],sales:[],tips:[],pot:[],settings:{},show:{},seen:{},saveCashUp:t=>{const s={...t,id:c(t.rid,t.date)},r=S(s);return e(e=>({cashUps:[s,...e.cashUps.filter(e=>e.id!==s.id)],tips:r?[r,...e.tips.filter(e=>!(e.rid===r.rid&&e.date===r.date))]:e.tips})),s},saveSales:t=>{const s={...t,id:p(t.rid,t.weekStart)};return e(e=>({sales:[s,...e.sales.filter(e=>e.id!==s.id)]})),s},setFields:(t,s,r)=>e(e=>({settings:{...e.settings,[t]:{...e.settings[t]??f(t),[s]:r,updatedAt:(new Date).toISOString()}}})),resetFields:t=>e(e=>({settings:{...e.settings,[t]:{...f(t),updatedAt:(new Date).toISOString()}}})),setShow:(t,s)=>e(e=>({show:{...e.show,[t]:{...e.show[t]??{showToday:!0,showPot:!0},...s}}})),addPotEvent:t=>e(e=>({pot:[{...t,id:(0,l.uuid)(),at:(new Date).toISOString()},...e.pot]})),markSeen:(t,s)=>e(e=>({seen:{...e.seen,[t]:s}}))}),{name:'covercharge-cashup-v1',storage:(0,n.createJSONStorage)(()=>s.default),partialize:e=>({...e,cashUps:e.cashUps.map(e=>({...e,photos:e.photos.filter(e=>!e.startsWith('data:'))})),sales:e.sales.map(e=>({...e,photos:e.photos.filter(e=>!e.startsWith('data:'))}))})})),w=e=>{const s=b(t=>t.settings[e])??f(e);return t.default.useMemo(()=>({...s,cashFields:(0,u.withTakingsFields)(s.cashFields)}),[s])},y=e=>b(t=>t.show[e])??{showToday:!0,showPot:!0}},1093,[30,1116,952,1117,1104,1109,1033]); +__d(function(g,_r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useCardStore",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"photoStorageFull",{enumerable:!0,get:function(){return E}}),_e.setStoragePhotoResolver=function(e){j=e},_e.cachePhotoAs=function(e,t){if(C.getState().photos[e]===t)return;C.setState(r=>({photos:{...r.photos,[e]:t}}))},Object.defineProperty(_e,"readLocalPhoto",{enumerable:!0,get:function(){return M}}),Object.defineProperty(_e,"localRecipeCards",{enumerable:!0,get:function(){return $}}),_e.ensureCards=F;var e,t=_r(d[0]),r=_r(d[1]),n=_r(d[2]),s=_r(d[3]),o=_r(d[4]),a=_r(d[5]),c=(e=a)&&e.__esModule?e:{default:e};_r(d[6]);var u=_r(d[7]),l=_r(d[8]),f=_r(d[9]),m=_r(d[10]),h=_r(d[11]),p=_r(d[12]),S=_r(d[13]);const I='covercharge-recipecards-v1',y='covercharge-recipephotos-v1',O=()=>{try{return(0,S.nowFrom)(S.useStore.getState().clock)}catch{return new Date}},b=(0,u.create)()((0,l.persist)(()=>({cards:[],removed:[],log:[]}),{name:I,storage:(0,l.createJSONStorage)(()=>c.default),version:3,migrate:async e=>{const n=e;return t.LIVE_VENUE_BUILD?(await(0,r.archiveChefCache)('recipe-cards',n),{...n,cards:n.cards.filter(e=>!(0,s.isDemoCard)(e)),log:n.log.filter(e=>!(0,s.demoActor)(e.by))}):n}}));let w=!1;const v={getItem:e=>c.default.getItem(e),setItem:async(e,t)=>{try{await c.default.setItem(e,t),w=!1}catch{w=!0}},removeItem:e=>c.default.removeItem(e)},E=()=>w,C=(0,u.create)()((0,l.persist)(()=>({photos:{}}),{name:y,storage:(0,l.createJSONStorage)(()=>v),version:1})),_={lobster:_r(d[14]),skink:_r(d[15]),fishsupper:_r(d[16]),moules:_r(d[17]),stp:_r(d[18])};let A=0;const L=(e,t,r)=>{const n={id:`cl-${Date.now().toString(36)}${(A++).toString(36)}`,cardId:e.id,rid:e.restaurantId,at:O().toISOString(),by:t,text:r};b.setState(e=>({log:[n,...e.log].slice(0,300)}));try{S.useStore.getState().addAudit(e.restaurantId,'menu',`Recipe card: ${e.dish}: ${r} (${t})`)}catch{}},P=e=>b.setState(t=>({cards:t.cards.some(t=>t.id===e.id)?t.cards.map(t=>t.id===e.id?e:t):[...t.cards,e]}));let B=null,D=null;function U(){const e=b.getState().cards,r=t.LIVE_VENUE_BUILD?e.filter(e=>!(0,s.isDemoCard)(e)).map(e=>({...e,signOff:(0,s.demoActor)(e.signOff?.by)?null:e.signOff,allergensConfirmed:(0,s.demoActor)(e.allergensConfirmed?.by)?void 0:e.allergensConfirmed})):e;if(!D||B!==e){B=e;const t=new Map,n=new Map;for(const e of r)t.set(e.restaurantId,[...t.get(e.restaurantId)??[],e]),n.set(e.menuItemId,e);D={cards:r,byRid:t,byItem:n}}return D}const N=[];function V(e){if(!(0,f.canEditCards)(e.role))throw new Error('Only the head chef and managers can edit recipe cards.')}let j=null;const M=e=>C.getState().photos[e],$={mode:'local',list:e=>U().byRid.get(e)??N,get:e=>U().cards.find(t=>t.id===e),byMenuItem:e=>U().byItem.get(e),subscribe:e=>{const t=b.subscribe(e),r=C.subscribe(e);return()=>{t(),r()}},async create(e,t,r){V(r);const n=O().toISOString();k=!0;let s=t.menuItemId;try{s||(s=S.useStore.getState().addMenuItem({restaurantId:e,section:t.section,name:t.dish,description:t.description??'',price:t.price,dietary:[],allergens:t.allergens??{},prepMins:12,soldOut:!1,signOff:null}));const o={id:t.id??(0,f.uuid)(),restaurantId:e,menuItemId:s,dish:t.dish,section:t.section,price:t.price,photo:t.photo,ingredients:t.ingredients??[],steps:t.steps??[],allergens:t.allergens??{},dismissed:t.dismissed??[],allergenNotes:t.allergenNotes,signOff:null,wasLive:!1,origin:'new',version:1,createdAt:n,updatedAt:n,updatedBy:r.name};return b.setState(e=>({cards:[...e.cards.filter(e=>e.menuItemId!==o.menuItemId),o]})),L(o,r.name,'card created, awaiting sign-off'),o}finally{k=!1}},async update(e,t,r){V(r);const n=$.get(e);if(!n)throw new Error('Card not found');const s=(0,f.editCard)(n,t,r.name,O().toISOString());return s.changed&&(P(s.card),L(s.card,r.name,s.resetSignOff?'edited, sign-off reset to Awaiting sign-off':t.confirmAllergens&&1===Object.keys(t).length?'allergens confirmed':'edited')),s.card},async signOff(e,t){if(!(0,f.canSignOffCards)(t.role))throw new Error('Only the head chef can sign off a recipe card.');const r=$.get(e);if(!r)throw new Error('Card not found');const n=(0,f.signOffBlock)(r);if(n)throw new Error(n);const s=(0,f.signOffCard)(r,t.name,O().toISOString());return P(s),L(s,t.name,'signed off'),s},async remove(e,t){V(t);const r=$.get(e);r&&(b.setState(t=>({cards:t.cards.filter(t=>t.id!==e),removed:[...t.removed,r.menuItemId]})),S.useStore.setState(e=>({menu:e.menu.map(e=>e.id===r.menuItemId?{...e,hidden:!0}:e)})),L(r,t.name,'card removed (dish hidden from the menu)'))},async savePhoto(e,t,r){const n=`local:${t}:${Date.now().toString(36)}`;return C.setState(e=>({photos:{...Object.fromEntries(Object.entries(e.photos).filter(([e])=>!e.startsWith(`local:${t}:`))),[n]:r.dataUrl}})),n},photoSource(e){if(!e)return null;if(e.startsWith('asset:'))return _[e.slice(6)]??null;if(e.startsWith('local:')){const t=C.getState().photos[e];return t?{uri:t}:null}if(/^(https?:|data:)/.test(e))return{uri:e};const t=C.getState().photos[e];if(t)return{uri:t};const r=j?.(e);return r?{uri:r}:null}};let k=!1,R=!1;function F(){if(k)return;const e=S.useStore.getState().menu,{cards:r,removed:a}=b.getState(),c=new Set(r.map(e=>e.menuItemId)),u=e.filter(e=>!c.has(e.id)&&!a.includes(e.id));if(!u.length)return;const l=O().toISOString(),f=o.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD||!(0,n.examplesAllowed)()?[]:(0,p.exampleCards)(u),m=new Set(f.map(e=>e.menuItemId)),h=[...f,...u.filter(e=>!m.has(e.id)).map(e=>(0,p.importedCard)(t.LIVE_VENUE_BUILD&&(0,s.demoActor)(e.signOff?.by)?{...e,signOff:null}:e,l))];b.setState(e=>({cards:[...e.cards,...h]}))}(0,h.setMenuCardBridge)({cardFor:e=>U().byItem.get(e),menuItemAdded:e=>{if(k||!R)return;const t=O().toISOString(),r={...(0,p.importedCard)(e,t),id:(0,f.uuid)(),signOff:null,allergensConfirmed:void 0,wasLive:!1,origin:'new',updatedBy:'Added to the menu'};P(r),L(r,r.updatedBy,'card created from the menu, awaiting sign-off')},menuEdited:(e,t,r,n)=>{const s=U().byItem.get(e);if(!s)return;let o=(0,f.editCard)(s,t,r,O().toISOString()).card;n&&o.signOff&&(o={...o,signOff:null,version:o.version+1,updatedAt:O().toISOString(),updatedBy:r}),o!==s&&(P(o),L(o,r,s.signOff&&!o.signOff?'edited from the menu, sign-off reset':'edited from the menu'))},signOff:(e,t)=>{const r=U().byItem.get(e);r&&$.signOff(r.id,{name:t,role:'head-chef'}).catch(()=>{})}}),(0,m.setRecipeCardRepository)($);const x=e=>new Promise(t=>{e.hasHydrated()?t():e.onFinishHydration(()=>t())});Promise.all([x(S.useStore.persist),x(b.persist)]).then(()=>{R=!0,F(),S.useStore.subscribe((e,t)=>{e.menu!==t.menu&&F()})}),'undefined'!=typeof window&&window.addEventListener('storage',e=>{e.key===(0,o.venueKey)(I)&&b.persist.rehydrate(),e.key===(0,o.venueKey)(y)&&C.persist.rehydrate()})},1094,[833,1132,1119,1024,5,1116,122,952,1117,1104,831,1114,1142,872,1143,1144,1145,1146,1147]); +__d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"MutationQueue",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"mutationQueue",{enumerable:!0,get:function(){return l}});var t=_r(d[0]),e=_r(d[1]),s=_r(d[2]);const r='queue:v1',n='queue:failed:v1',h=t=>`${t.table}|${t.venueId}|${t.rowKey}`;class o{items=[];failedItems=[];loaded=null;flushing=null;exec=null;listeners=new Set;onFailure=new Set;onSaved=new Set;retryTimer=null;waitTimer=null;backoffMs=2e3;now=()=>Date.now();constructor(){(0,t.onConnectivity)(t=>{t&&this.flush()})}setExecutor(t){this.exec=t}load(){return this.loaded||(this.loaded=(async()=>{const t=await e.kv.get(r,[]);this.items=[...t.map(t=>({...t,nextAt:void 0})),...this.items],this.failedItems=await e.kv.get(n,[]),this.emit()})()),this.loaded}get pending(){return this.items}get waiting(){return this.items.filter(t=>t.attempts>0)}get failed(){return this.failedItems}hasPending(t,e,s){return this.items.some(r=>r.table===t&&r.venueId===e&&r.rowKey===s)}async enqueue(t){await this.load();const s={...t,id:(0,e.uuid)(),createdAt:(new Date).toISOString(),attempts:0};return this.items.push(s),await this.persist(),this.flush(),s}nextReady(){const t=new Set,e=this.now();for(const s of this.items){const r=h(s);if(!t.has(r)){if(!(s.nextAt&&s.nextAt>e))return s;t.add(r)}}}remove(t){this.items=this.items.filter(e=>e!==t)}flush(){return this.flushing||(this.flushing=(async()=>{for(await this.load();this.exec;){const e=this.nextReady();if(!e)break;if(!(0,t.isOnline)()){this.scheduleRetry();break}try{const t=await this.exec(e);this.remove(e),this.backoffMs=2e3,'conflict'===t?this.fail(e,'conflict','Row changed on the server (version conflict) or is not visible to you'):this.onSaved.forEach(t=>t(e))}catch(r){e.attempts+=1,e.lastError=String(r?.message??r);const n=r??{};e.lastErr={code:n.code?String(n.code):void 0,status:Number(n.status)||void 0,message:e.lastError.slice(0,300)};const h=(0,s.classifyWriteError)(r);if('network'===h){e.attempts-=1,(0,t.setOnline)(!1),this.scheduleRetry(),await this.persist();break}'retry'===h?e.nextAt=this.now()+(0,s.retryDelayMs)(e.attempts):(this.remove(e),this.fail(e,'rejected',e.lastError))}await this.persist()}this.flushing=null,this.scheduleWaiting()})()),this.flushing}retryNow(){for(const t of this.items)t.nextAt=void 0;return this.flush()}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}onFailed(t){return this.onFailure.add(t),()=>{this.onFailure.delete(t)}}onDone(t){return this.onSaved.add(t),()=>{this.onSaved.delete(t)}}async clearFailed(){this.failedItems=[],await e.kv.set(n,[]),this.emit()}fail(t,s,r){const h={...t,lastError:r,failedAt:(new Date).toISOString(),reason:s};this.failedItems=[h,...this.failedItems].slice(0,100),e.kv.set(n,this.failedItems),this.onFailure.forEach(t=>t(h))}scheduleWaiting(){this.waitTimer&&(clearTimeout(this.waitTimer),this.waitTimer=null);const t=this.items.map(t=>t.nextAt??0).filter(t=>t>0);if(!t.length)return;const e=Math.max(500,Math.min(...t)-this.now());this.waitTimer=setTimeout(()=>{this.waitTimer=null,this.flush()},e)}scheduleRetry(){if(this.retryTimer)return;const e=this.backoffMs;this.backoffMs=Math.min(2*this.backoffMs,6e4),this.retryTimer=setTimeout(()=>{this.retryTimer=null,(0,t.setOnline)(!0),this.flush()},e)}async persist(){await e.kv.set(r,this.items),this.emit()}emit(){this.listeners.forEach(t=>t())}}const l=new o},1095,[1197,1196,1200]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SUPABASE_URL",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"SUPABASE_ANON_KEY",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"isSupabaseConfigured",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"REALTIME_TABLES",{enumerable:!0,get:function(){return s}});var t=r(d[0]);const n="https://rowdoidkftriylijobuy.supabase.co",o="sb_publishable_rPm723MQz6FwmFVHy6e1SA_ko-_-6GR",u=()=>!t.PITCH&&n.startsWith('https://')&&o.length>20,s=['bookings','walk_ins','blocks','table_plans','takeaway_orders','stock_counts']},1096,[2]); +__d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.pushState=f,e.turnOnPush=async function(){const u=await f();if('ios-home-screen'===u)return{ok:!1,message:'On iPhone, add this app to your Home Screen first (Share \u203a Add to Home Screen, iOS 16.4 or later), then open it from there.'};if('unsupported'===u)return{ok:!1,message:'This browser can\u2019t get phone notifications. Try Chrome on Android, or the app from your iPhone Home Screen.'};if('blocked'===u)return{ok:!1,message:'Notifications are blocked for this app. Allow them in your phone\u2019s settings, then try again.'};const c=i.useSync.getState();if('staff'!==c.kind||!c.venueId||!c.staffRef)return{ok:!1,message:'Sign in from your personal link first.'};if('granted'!==await Notification.requestPermission())return{ok:!1,message:'You didn\u2019t allow notifications, so nothing changed.'};const p=await navigator.serviceWorker.ready,h=(await p.pushManager.getSubscription()??await p.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:s(n.VAPID_PUBLIC_KEY)})).toJSON();if(!h.endpoint||!h.keys?.p256dh||!h.keys?.auth)return{ok:!1,message:'Your browser didn\u2019t give a usable subscription. Try again.'};const l=(0,t.getSupabase)(),{error:y}=await l.from('push_subscriptions').upsert({venue_id:c.venueId,staff_ref:c.staffRef,app:o.APP_VARIANT,endpoint:h.endpoint,p256dh:h.keys.p256dh,auth:h.keys.auth,user_agent:navigator.userAgent.slice(0,200)},{onConflict:'user_id,endpoint'});return y?{ok:!1,message:`Couldn\u2019t save this phone: ${y.message}`}:{ok:!0,message:'Phone notifications are on for this device.'}},e.turnOffPush=async function(){const n=await(navigator.serviceWorker?.getRegistration()),i=await(n?.pushManager.getSubscription());if(!i)return{ok:!0,message:'Phone notifications are off for this device.'};const o=i.endpoint;await i.unsubscribe();try{const n=(0,t.getSupabase)();await n.from('push_subscriptions').delete().eq('endpoint',o)}catch{}return{ok:!0,message:'Phone notifications are off for this device.'}};var n=r(d[0]),t=r(d[1]),i=r(d[2]),o=r(d[3]);const s=n=>{const t=atob(n.replace(/-/g,'+').replace(/_/g,'/')+'='.repeat((4-n.length%4)%4)),i=new Uint8Array(t.length);for(let n=0;n'undefined'!=typeof navigator&&/iPhone|iPad|iPod/.test(navigator.userAgent),c=()=>'undefined'!=typeof window&&(window.matchMedia?.('(display-mode: standalone)').matches||!0===navigator.standalone);async function f(){if('undefined'==typeof window||!('serviceWorker'in navigator))return'unsupported';if(!('PushManager'in window)||'undefined'==typeof Notification)return u()&&!c()?'ios-home-screen':'unsupported';if('denied'===Notification.permission)return'blocked';const n=await navigator.serviceWorker.getRegistration();return await(n?.pushManager.getSubscription())?'on':'off'}},1097,[1275,863,820,806]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SOON_TEXT",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"setVenueWords",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"getVenueWords",{enumerable:!0,get:function(){return u}}),e.askServer=async function(o,c,u,p){try{const l=(0,t.getSupabase)().functions.invoke(n,{body:{app:o,text:c,tools:u,...p?{receipt:p,spoken:!0,vocab:s}:{}}}),y=new Promise(t=>setTimeout(()=>t({data:null,error:new Error('timeout')}),1e4)),{data:f,error:b}=await Promise.race([l,y]);return b||!f||!0!==f.ready||f.busy?{kind:'soon'}:f.call?.name?{kind:'call',name:String(f.call.name),args:f.call.args??{}}:'string'==typeof f.text&&f.text.trim()?{kind:'text',text:f.text.trim()}:{kind:'soon'}}catch{return{kind:'soon'}}},e.transcribe=async function(n,o,c=8e3){try{const u=/mp4|m4a|aac/.test(o.type)?'m4a':/ogg/.test(o.type)?'ogg':/wav/.test(o.type)?'wav':'webm',l=new FormData;l.append('app',n),s.length&&l.append('keyterms',JSON.stringify(s)),l.append('file',o,`speech.${u}`);const y=(0,t.getSupabase)().functions.invoke(p,{body:l}),f=new Promise(t=>setTimeout(()=>t({data:null,error:new Error('timeout')}),c)),{data:b,error:k}=await Promise.race([y,f]);return k?{ok:!1,reason:'timeout'===String(k?.message)?'timeout':'offline'}:!0===b?.ok?{ok:!0,text:String(b.text??''),receipt:'string'==typeof b.receipt?b.receipt:void 0}:{ok:!1,reason:String(b?.reason??'busy'),text:'string'==typeof b?.text?b.text:void 0}}catch{return{ok:!1,reason:'offline'}}};var t=r(d[0]);const n='voice-assistant',o='Voice assistant is switching on soon. Until then I can do the everyday things, for example';let s=[];const c=t=>{s=t.slice(0,100)},u=()=>s;const p='voice-transcribe'},1098,[863]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"VOICE_ROLES",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"VOICE_ROLE_LABEL",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"useVoiceSettings",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"voiceOn",{enumerable:!0,get:function(){return f}}),_e.micExplainedFor=function(e){try{if('1'===b()?.getItem(s(e)))return!0}catch{}return u.getState().micExplained},_e.setMicExplainedFor=function(e){try{b()?.setItem(s(e),'1')}catch{}u.getState().setMicExplained(!0)};var e,n=r(d[0]),t=(e=n)&&e.__esModule?e:{default:e},c=r(d[1]),l=r(d[2]);const o=['owner','manager','staff','chef','display'],p={owner:'Owner (Managers app)',manager:'Managers (Managers app)',staff:'Staff app (full voice assistant, no money or HR)',chef:'Head Chef app',display:'Main Display'},u=(0,c.create)()((0,l.persist)(e=>({enabled:{},micExplained:!1,setEnabled:(n,t,c)=>e(e=>({enabled:{...e.enabled,[n]:{...e.enabled[n]??{},[t]:c}}})),setMicExplained:n=>e({micExplained:n})}),{name:'covercharge-voice-v1',version:4,storage:(0,l.createJSONStorage)(()=>t.default),migrate:(e,n)=>({enabled:n<2?{}:e?.enabled??{},micExplained:!!e?.micExplained}),merge:(e,n)=>({...n,enabled:e?.enabled??n.enabled,micExplained:e?.micExplained??n.micExplained}),partialize:e=>({enabled:e.enabled,micExplained:e.micExplained})})),f=(e,n,t)=>!1!==e[n]?.[t],s=e=>`cc-voice-mic-explained-${e}`,b=()=>{try{return'undefined'!=typeof window?window.localStorage:void 0}catch{return}}},1099,[1116,952,1117]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"desktopStt",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"desktopSttState",{enumerable:!0,get:function(){return u}}),_e.warmDesktopStt=function(){o()&&l()},Object.defineProperty(_e,"cleanHeard",{enumerable:!0,get:function(){return d}}),Object.defineProperty(_e,"tabletWithoutMic",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"canRecord",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"canListen",{enumerable:!0,get:function(){return w}}),_e.micPermission=b,Object.defineProperty(_e,"RATE",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"PRE_ROLL_MS",{enumerable:!0,get:function(){return M}}),Object.defineProperty(_e,"HANG_MS",{enumerable:!0,get:function(){return A}}),_e.releaseMic=O,Object.defineProperty(_e,"echoWanted",{enumerable:!0,get:function(){return R}}),Object.defineProperty(_e,"micConstraints",{enumerable:!0,get:function(){return j}}),_e.warmMic=async function(){try{if(o()||!y())return;if(!S&&'granted'!==await b())return;if(await D(),C){C.armedUntil=Date.now()+1500;try{C.ctx.resume?.()}catch{}}x()}catch{}},_e.disarmMic=function(){C&&!C.rec&&(C.armedUntil=0,C.ring=[],C.ringLen=0)},_e.askMic=async function(){try{return await D(),x(),!0}catch{return!1}},_e.wavOf=L,Object.defineProperty(_e,"MAX_CLIP_MS",{enumerable:!0,get:function(){return _}}),_e.listen=B,Object.defineProperty(_e,"CloudRecognition",{enumerable:!0,get:function(){return I}}),Object.defineProperty(_e,"speechRecognizer",{enumerable:!0,get:function(){return N}}),_e.levelMeter=async function(e){const t=n()?.navigator?.mediaDevices,r=n()?.AudioContext||n()?.webkitAudioContext;if(!t?.getUserMedia||!r)return()=>{};let o,i,a=0,c=!1;try{if(o=await t.getUserMedia({audio:!0}),c)return o.getTracks().forEach(e=>e.stop()),()=>{};i=new r;const s=i.createMediaStreamSource(o),u=i.createAnalyser();u.fftSize=512,s.connect(u);const l=new Uint8Array(u.fftSize),d=()=>{u.getByteTimeDomainData(l);let t=0;for(let e=0;e{}}return()=>{c=!0;try{n().cancelAnimationFrame(a)}catch{}try{o?.getTracks().forEach(e=>e.stop())}catch{}try{i?.close()}catch{}}},_e.yesNo=function(e){const t=e.toLowerCase().trim().replace(/[.!,]/g,'');return/^(yes|yeah|yep|yup|aye|confirm|confirmed|do it|go ahead|correct|that's right|ok|okay|yes please)\b/.test(t)?'yes':/^(no|nope|cancel|stop|don't|do not|wrong|never mind)\b/.test(t)?'no':null},Object.defineProperty(_e,"buzz",{enumerable:!0,get:function(){return W}});var e=_r(_d[0]),t=_r(_d[1]);const n=()=>'undefined'==typeof window?void 0:window,r=()=>n()?.ccDesktop,o=()=>!!r()?.stt&&!!r()?.sttWorker;let i=null,a=0;const c=new Map;let s='cold';const u=()=>s;function l(){if(i)return i;const e=n()?.Worker,t=r()?.sttWorker;return e&&t?(i=new e(t,{type:'module'}),s='loading',i.onmessage=e=>{const t=e.data??{};if(t.ready)return void(s='ready');t.failed&&(s='failed');const n=c.get(t.id);n&&(c.delete(t.id),n(t))},i.onerror=()=>{s='failed',c.forEach(e=>e({error:'stt-failed'})),c.clear()},i.postMessage({warm:!0}),i):null}const d=e=>e.replace(/\[[^\]]*\]|\([^)]*\)/g,' ').replace(/\s+/g,' ').trim();function f(e,t){let o,i,s,u,f=!1,p=!1;const y=[];let w=16e3;const b=()=>{try{s?.disconnect(),u?.disconnect()}catch{}try{o?.getTracks().forEach(e=>e.stop())}catch{}try{i?.close()}catch{}if(p)return;const n=y.reduce((e,t)=>e+t.length,0);if(n<.35*w)return void t('');const r=new Float32Array(n);let f=0;for(const e of y)r.set(e,f),f+=e.length;const b=16e3===w?r:h(r,w,16e3),v=l();if(!v)return void t('','stt-failed');e('Turning speech into text on this Mac\u2026');const M=++a;c.set(M,e=>t(d(e.text??''),e.error)),v.postMessage({id:M,audio:b},[b.buffer])};return(async()=>{try{if(r()?.askMic){if(!await r().askMic())return void t('','not-allowed')}if(o=await n().navigator.mediaDevices.getUserMedia({audio:{channelCount:1,echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0}}),f)return void b();const e=n().AudioContext||n().webkitAudioContext;try{i=new e({sampleRate:16e3})}catch{i=new e}w=i.sampleRate,u=i.createMediaStreamSource(o),s=i.createScriptProcessor(4096,1,1),s.onaudioprocess=e=>{f||y.push(new Float32Array(e.inputBuffer.getChannelData(0)))},u.connect(s),s.connect(i.destination),l()}catch(e){t('','NotAllowedError'===e?.name?'not-allowed':'audio-capture')}})(),{stop:()=>{f||(f=!0,b())},abort:()=>{p=!0,f=!0,b()}}}function h(e,t,n){const r=Math.round(e.length*n/t),o=new Float32Array(r),i=t/n;for(let t=0;t{const e=String(n()?.navigator?.userAgent??'');return/CoverChargeTablet\//.test(e)&&!/CoverChargeTablet\/[\d.]+ mic/.test(e)},y=()=>!p()&&!(!n()?.MediaRecorder||!n()?.navigator?.mediaDevices?.getUserMedia),w=()=>o()||y();async function b(){try{const e=n()?.navigator?.permissions?.query;if(!e)return'unknown';const t=await Promise.race([n().navigator.permissions.query({name:'microphone'}),new Promise(e=>setTimeout(()=>e(null),1500))]);return'granted'===t?.state||'denied'===t?.state||'prompt'===t?.state?t.state:'unknown'}catch{return'unknown'}}const v=16e3,M=500,A=450;let P,S=null,T=!1,k=!1,C=null;function U(){const e=C;if(C=null,e){try{e.node.disconnect(),e.src.disconnect()}catch{}try{e.ctx.close()}catch{}e.ring=[],e.rec=null}}function O(){clearTimeout(P),U();try{S?.getTracks().forEach(e=>e.stop())}catch{}S=null}const x=()=>{clearTimeout(P),P=setTimeout(O,/iPhone|iPad|iPod|Macintosh/.test(String(n()?.navigator?.userAgent??''))&&!r()?.mac?6e5:6e4)},R=()=>!1,j=(e=R())=>({audio:{channelCount:{ideal:1},sampleRate:{ideal:v},sampleSize:{ideal:16},echoCancellation:e,noiseSuppression:!0,autoGainControl:!0}});async function D(){clearTimeout(P);const e=R();if(S&&T===e&&S.getAudioTracks().some(e=>'live'===e.readyState))return S;if(S&&O(),S=await n().navigator.mediaDevices.getUserMedia(j(e)),T=e,!k){k=!0;try{n().document.addEventListener('visibilitychange',()=>{'hidden'===n().document.visibilityState&&O()})}catch{}}return E(S),S}function E(e){U();try{const t=n().AudioContext||n().webkitAudioContext;if(!t)return;let r;try{r=new t({sampleRate:v})}catch{r=new t}const o=r.createMediaStreamSource(e),i=r.createScriptProcessor(2048,1,1),a={ctx:r,node:i,src:o,rate:r.sampleRate,ring:[],ringLen:0,rec:null,frames:0,armedUntil:0,level:()=>{}},c=Math.round(.5*a.rate);i.onaudioprocess=e=>{const t=new Float32Array(e.inputBuffer.getChannelData(0));if(a.frames+=t.length,a.rec&&a.rec.push(t),!a.rec&&Date.now()>a.armedUntil)return a.ring=[],void(a.ringLen=0);for(a.ring.push(t),a.ringLen+=t.length;a.ring.length>1&&a.ringLen-a.ring[0].length>=c;)a.ringLen-=a.ring[0].length,a.ring.shift();let n=0;for(let e=0;ee+t.length,0),r=new Float32Array(n);let o=0;for(const t of e)r.set(t,o),o+=t.length;const i=t===v?r:h(r,t,v),a=new ArrayBuffer(44+2*i.length),c=new DataView(a),s=(e,t)=>{for(let n=0;n{clearTimeout(c),clearTimeout(s),S&&(S.rec=null,S.level=()=>{}),x()},k=(e,t,n)=>{h||f||(h=!0,o(e,t,n))};let U=!1;const O=async()=>{if(U)return;U=!0;const n=b,o=S?S.frames-P:0;if(T(),f)return;const i=Date.now()-y,a=!!n&&n.length>0&&o/M*1e3>.6*i?L(n,M):new Blob(w,{type:(p?.mimeType||w[0]?.type||'audio/webm').split(';')[0]});if(i<350||a.size<500)return void k('');r('Turning speech into text\u2026');const c=await(0,e.transcribe)(t,a);c.ok?k(c.text.trim(),void 0,{receipt:c.receipt}):k('',c.reason,{message:c.text})};(async()=>{try{const e=await D();if(d)return T(),void k('');if(S=C,S){try{S.ctx.resume?.()}catch{}b=[...S.ring],M=S.rate,P=S.frames-S.ringLen,S.rec=b,S.level=e=>{i?.(e),a&&!d&&(e>.12?(u=!0,l=0):u&&e<.05&&(l=l||Date.now(),Date.now()-l>1500&&j()))}}const t=F();p=new(n().MediaRecorder)(e,t?{mimeType:t,audioBitsPerSecond:48e3}:void 0),p.ondataavailable=e=>{e.data?.size&&w.push(e.data)},p.onstop=()=>{O()},p.onerror=()=>{b?.length?O():(T(),k('','audio-capture'))},p.start(),y=Date.now(),c=setTimeout(()=>{r('That\u2019s the 30-second limit. Sending now\u2026'),R()},_)}catch(e){T(),k('','NotAllowedError'===e?.name||'SecurityError'===e?.name?'not-allowed':'audio-capture')}})();const R=()=>{try{p&&'inactive'!==p.state?p.stop():O()}catch{O()}},j=()=>{d||(d=!0,p&&(s=setTimeout(R,a?0:A)))};return{stop:j,abort:()=>{f=!0,d=!0,clearTimeout(s);try{p&&'inactive'!==p.state&&p.stop()}catch{}T()}}}function B(e,t,n="owner",r,i=!1){return o()?f(e,t):y()?z(n,e,t,r,i):null}class I{lang='en-GB';interimResults=!1;continuous=!1;maxAlternatives=1;onresult=null;onerror=null;onend=null;l=null;start(){const e='customer'===t.APP_VARIANT?'owner':t.APP_VARIANT;if(this.l=B(()=>{},(e,t)=>{if(this.l=null,t)this.onerror?.({error:t});else if(e){const t=Object.assign([{transcript:e,confidence:1}],{isFinal:!0});this.onresult?.({resultIndex:0,results:[t]})}this.onend?.()},e,void 0,!0),!this.l)throw new Error('not-supported')}stop(){this.l?.stop()}abort(){const e=this.l;this.l=null,e?.abort(),e&&this.onend?.()}}const N=()=>w()?I:null;const W=(e=30)=>{try{n()?.navigator?.vibrate?.(e)}catch{}}},1100,[1098,806]); +__d(function(g,r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"HISTORY_LABEL",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"HISTORY_NOTE",{enumerable:!0,get:function(){return t}}),e.validPastDate=n,e.exactHistoryDate=function(o,t){if(1!==(o.match(/\b(?:\d{4}-\d{2}-\d{2}|\d{1,2}\/\d{1,2}\/\d{4}|\d{1,2}(?:st|nd|rd|th)?\s+[a-z]+\s+\d{4})\b/gi)??[]).length)return;const d=o.match(/\b(\d{4}-\d{2}-\d{2})\b/);let s=d?.[1];if(!s){const t=o.match(/\b(\d{1,2})\/(\d{1,2})\/(\d{4})\b/);t&&(s=`${t[3]}-${t[2].padStart(2,'0')}-${t[1].padStart(2,'0')}`)}if(!s){const t=o.toLowerCase().match(/\b(\d{1,2})(?:st|nd|rd|th)?\s+(january|february|march|april|may|june|july|august|september|october|november|december|jan|feb|mar|apr|jun|jul|aug|sep|sept|oct|nov|dec)\s+(\d{4})\b/),n=['jan','feb','mar','apr','may','jun','jul','aug','sep','oct','nov','dec'];t&&(s=`${t[3]}-${String(n.indexOf(t[2].slice(0,3))+1).padStart(2,'0')}-${t[1].padStart(2,'0')}`)}return s&&n(s,t)?s:void 0},Object.defineProperty(e,"historyDateLabel",{enumerable:!0,get:function(){return d}}),e.bookingDayText=function(o){const n=`Booked covers on ${d(o.date)}: ${null===o.booked_covers?'not recorded':o.booked_covers}.`,s=o.bookings.map(o=>`${o.time??'Time not recorded'}: party size ${null===o.covers?'not recorded':`${o.covers} Covers`}; ${o.table?`table ${o.table}`:'table not recorded'}; ${o.status??'status not recorded'}${o.counted?'':', excluded from Booked covers'}.`);return[n,...s,o.historical_records?"Includes previous booking system history (incomplete).":'',t,o.bookings.length?'':'No booking records found; incomplete history does not prove there were no bookings.',o.missing_covers?`${o.missing_covers} booking records have no party size; left blank.`:''].filter(Boolean).join(' ')};const o='Includes previous booking system history (incomplete)',t='Recovered booking records, not confirmed attendance. Cancelled bookings are shown but excluded from Booked covers.';function n(o,t){if(!/^\d{4}-\d{2}-\d{2}$/.test(o))return!1;const n=new Date(o+'T12:00:00Z');return!Number.isNaN(n.getTime())&&n.toISOString().slice(0,10)===o&&onew Date(o+'T12:00:00Z').toLocaleDateString('en-GB',{day:'numeric',month:'long',year:'numeric',timeZone:'Europe/London'})},1101,[]); +__d(function(_g,_r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.clockAction=async function(n,u){if((0,t.privateClockVenue)(u.rid)&&'in'!==n)return c(n,u,{action:n,at:u.at,inside:null,unchecked:!0});const f=(0,a.areaOf)(u.rid),k=f.on&&null!=f.lat&&null!=f.lng,l=k?await(u.fixFn??r.getFix)():'unavailable';if((0,t.privateClockVenue)(u.rid)&&'object'==typeof l&&(!Number.isFinite(l.acc)||l.acc>150))return{ok:!1,message:'Your phone\u2019s location is not accurate enough to confirm you are at the pub. Enable precise location, step near a window and try again, or ask a manager to record your clock-in with a reason.'};const g=k&&'object'!=typeof l?(0,s.locWhere)():'browser',p=(0,o.gate)(f,n,k?l:'unavailable',u.at,g);if(!p.allowed){const a='object'==typeof l?void 0:'app'===g&&'denied'===l?'settings':'app-phone-off'===g?'location':'app-old'===g&&'denied'===l?'update':void 0;return'update'===a&&(0,s.checkAppUpdate)(),{ok:!1,message:(p.message??'You need to be at the venue.')+((0,t.privateClockVenue)(u.rid)?' Ask a manager to record your clock-in with a reason using Record it for someone.':''),fix:a}}const w=c(n,u,p.geo);return w.ok&&p.warn?{...w,warn:p.warn}:w},e.managerClockAction=function(t,a,r,s){const u=(0,o.overrideGeo)(t,a.at,r,s);if(!u)return{ok:!1,message:'Type a short reason (at least 3 letters).'};const f=n.useOwner.getState().staff.find(t=>t.id===a.staffId)?.name??'staff',k=c(t,a,u,{adjusted:{by:r.name,at:a.at,reason:u.override.reason}});if(k.ok){const o={in:'clocked in',out:'clocked out',break_start:'started a break for',break_end:'ended a break for'}[t],s=`${r.name} ${o} ${f} (manager, no location check): ${u.override.reason}`;n.useOwner.setState(t=>({attLog:[{id:`al-${Date.now().toString(36)}`,at:a.at,text:s},...t.attLog]}))}return k};var t=_r(d[0]),a=_r(d[1]),n=_r(d[2]),o=_r(d[3]),r=_r(d[4]),s=_r(d[5]);function c(a,o,r,s={}){const c=(0,t.venueClockGeo)(o.rid,r),u=c?!1!==c.inside:void 0,f=n.useOwner.getState(),k=(0,n.openShiftOf)(f.attendance,o.staffId,o.at);if('in'===a){if(k)return{ok:!1,message:'You\u2019re already clocked in.'};f.clock(o.staffId,o.date,'in',o.at,u);const t=(0,n.openShiftOf)(n.useOwner.getState().attendance,o.staffId,o.at);return t&&n.useOwner.getState().patchAttendance(t.id,{...o.offRota?{offRota:!0}:{},...s},c),{ok:!0,att:t&&n.useOwner.getState().attendance.find(a=>a.id===t.id)}}if(!k)return{ok:!1,message:'You\u2019re not clocked in.'};if('out'===a){let t=o.breakMins;if(o.addedBreak&&o.addedBreak>0&&!k.breaks?.length){const a=new Date(o.at).getTime(),r=new Date(Math.max(new Date(k.in).getTime(),a-6e4*o.addedBreak)).toISOString();n.useOwner.getState().patchAttendance(k.id,{breaks:[{start:r,end:o.at}],breakAddedAtClockOut:o.addedBreak}),t=Math.round((a-new Date(r).getTime())/6e4)}return n.useOwner.getState().clock(o.staffId,o.date,'out',o.at,u,t),n.useOwner.getState().patchAttendance(k.id,s,c),{ok:!0,att:n.useOwner.getState().attendance.find(t=>t.id===k.id)}}return n.useOwner.getState().breakToggle(o.staffId,'break_start'===a?'start':'end',o.at)?(n.useOwner.getState().patchAttendance(k.id,s,c),{ok:!0,att:n.useOwner.getState().attendance.find(t=>t.id===k.id)}):{ok:!1,message:'break_start'===a?'You\u2019re already on a break.':'You\u2019re not on a break.'}}},1103,[988,1207,856,954,1274,1290]); +__d(function(_g,_r,_i,_a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"canEditCards",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"canSignOffCards",{enumerable:!0,get:function(){return i}}),e.suggestForIngredient=a,e.suggestAllergens=o,Object.defineProperty(e,"suggestedBy",{enumerable:!0,get:function(){return l}}),e.unresolved=c,e.applySuggestions=function(n){const t={...n.allergens};for(const i of c(n))t[i]='contains';return t},Object.defineProperty(e,"cardState",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"STATE_LABEL",{enumerable:!0,get:function(){return f}}),e.signOffBlock=function(n){if(!n.dish.trim())return'Give the dish a name first.';const t=c(n);return t.length?`Check the suggested allergens first: ${t.map(g).join(', ')}.`:n.allergensConfirmed?null:'Confirm the allergen list first.'},Object.defineProperty(e,"allergenList",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"CONTENT_FIELDS",{enumerable:!0,get:function(){return p}}),e.editCard=function(n,t,i,r){const{confirmAllergens:s,...a}=t,l=Object.keys(a).filter(t=>!h(a[t],n[t]));let u={...n};for(const n of l)u[n]=a[n];const f=l.some(n=>'allergens'===n||'dismissed'===n||'ingredients'===n);f&&!h(o(u.ingredients),o(n.ingredients))&&(u.allergensConfirmed=void 0);f&&(l.includes('allergens')||l.includes('dismissed'))&&(u.allergensConfirmed=void 0);let g=!1;!s||u.allergensConfirmed||c(u).length||(u.allergensConfirmed={by:i,at:r},g=!0);const m=l.length>0||g,p=l.length>0&&!!n.signOff;if(!m)return{card:n,changed:!1,resetSignOff:!1};l.length&&(u={...u,signOff:null,version:n.version+1});return{card:{...u,updatedAt:r,updatedBy:i},changed:m,resetSignOff:p}},e.signOffCard=function(n,t,i){return{...n,signOff:{by:t,at:i},wasLive:!0,updatedAt:i,updatedBy:t}},e.overlayItem=function(n,t){return t?{...n,name:t.dish,section:t.section,price:t.price,allergens:t.allergens,allergenNotes:t.allergenNotes,signOff:t.signOff?{by:t.signOff.by,at:t.signOff.at.slice(0,10)}:null,hidden:n.hidden||!t.signOff&&!t.wasLive,recipeCardId:t.id}:n},e.dishesFor=function(n,t){const i=n.filter(n=>!n.hidden),r=i.filter(n=>t.some(t=>'contains'===n.allergens[t])),s=i.filter(n=>!r.includes(n)&&t.some(t=>'may'===n.allergens[t])),a=i.filter(n=>!r.includes(n)&&!s.includes(n));return{contains:r,may:s,free:a}},e.filterCards=function(n,t,i,r="free-from"){const s=t.toLowerCase().split(/\s+/).filter(Boolean);return n.filter(n=>{const t=[n.dish,n.section,...n.ingredients.map(n=>n.name)].join(' ').toLowerCase();return!!s.every(n=>t.includes(n))&&(!i.length||('free-from'===r?i.every(t=>!n.allergens[t]):i.some(t=>!!n.allergens[t])))})},e.uuid=function(){const n=globalThis.crypto;if(n?.randomUUID)return n.randomUUID();const t=Array.from({length:16},()=>Math.floor(256*Math.random()));t[6]=15&t[6]|64,t[8]=63&t[8]|128;const i=t.map(n=>n.toString(16).padStart(2,'0')).join('');return`${i.slice(0,8)}-${i.slice(8,12)}-${i.slice(12,16)}-${i.slice(16,20)}-${i.slice(20)}`},e.uuidFrom=function(n){let t='';for(let i=0;i<4;i++){let r=2166136261^2654435761*i;for(let t=0;t>>0;t+=r.toString(16).padStart(8,'0')}const i=t.slice(0,12)+'4'+t.slice(13,16)+(3&parseInt(t[16],16)|8).toString(16)+t.slice(17,32);return`${i.slice(0,8)}-${i.slice(8,12)}-${i.slice(12,16)}-${i.slice(16,20)}-${i.slice(20,32)}`},Object.defineProperty(e,"RECIPE_CARD_EXTRA_COLUMNS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"STEP_SEP",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"photoPath",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"RECIPE_PHOTO_BUCKET",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"RECIPE_CARD_TABLE",{enumerable:!0,get:function(){return v}}),e.cardToRow=function(n,t){return{row:{id:n.id,venue_id:t,dish:n.dish,ingredients:n.ingredients.map(({name:n,qty:t,unit:i,allergens:r})=>({name:n,qty:t,unit:i,...r?.length?{allergens:r}:{}})),method:n.steps.join(y),allergens:m(n.allergens,'contains'),may_contain:m(n.allergens,'may'),photo_url:!n.photo||n.photo.startsWith('local:')||n.photo.startsWith('asset:')?null:n.photo,signed_off_by:n.signOff?.by??null,signed_off_at:n.signOff?.at??null,updated_at:n.updatedAt},extra:{menu_item_id:n.menuItemId,section:n.section,price_pence:n.price,dismissed:n.dismissed,allergen_notes:n.allergenNotes??null,allergens_confirmed_by:n.allergensConfirmed?.by??null,allergens_confirmed_at:n.allergensConfirmed?.at??null,was_live:n.wasLive,origin:n.origin,version:n.version,updated_by:n.updatedBy}}},e.rowToCard=function(n,t,i={}){const r={};n.may_contain.forEach(n=>{r[n]='may'}),n.allergens.forEach(n=>{r[n]='contains'});const s=n.updated_at??(new Date).toISOString();return{id:n.id,restaurantId:t,menuItemId:i.menu_item_id??n.id,dish:n.dish,section:i.section??'Mains',price:i.price_pence??null,photo:n.photo_url??void 0,ingredients:n.ingredients.map((t,i)=>({id:`${n.id}-i${i}`,...t})),steps:n.method?n.method.split(y).filter(n=>n.trim()):[],allergens:r,dismissed:i.dismissed??[],allergenNotes:i.allergen_notes??void 0,allergensConfirmed:i.allergens_confirmed_by?{by:i.allergens_confirmed_by,at:i.allergens_confirmed_at}:void 0,signOff:n.signed_off_by&&n.signed_off_at?{by:n.signed_off_by,at:n.signed_off_at}:null,wasLive:i.was_live??!!n.signed_off_by,origin:i.origin??'new',version:i.version??1,createdAt:s,updatedAt:s,updatedBy:i.updated_by??''}};var n=_r(d[0]);const t=n=>'head-chef'===n||'manager'===n||'owner'===n,i=n=>'head-chef'===n,r=[[/\b(flour(?!y)|wheat|bread|crumb|panko|pastry|brioche|buns?\b|crouton|crostini|batter|beer|ale\b|lager|stout|barley|malt|rye|spelt|oat|couscous|semolina|pasta|penne|macaroni|spaghetti|noodle|biscuit|sponge|crumble|roux|tempura|digestive|self.raising)/i,['gluten']],[/\b(prawn|langoustine|lobster|crab|shrimp|crayfish|scampi|shellfish)/i,['crustaceans']],[/\b(mussel|scallop|clam|cockle|squid|calamari|octopus|whelk|winkle|oyster(?! mushroom)|oyster sauce)/i,['molluscs']],[/\b(egg|mayonnaise|mayo|aioli|tartare|hollandaise|meringue|custard|brioche|bearnaise)/i,['eggs']],[/\b(fish(?!er)|haddock|cod|salmon|hake|anchov|tuna|mackerel|trout|sea bass|monkfish|pollock|halibut|kipper|worcester|fish sauce|caesar)/i,['fish']],[/\b(peanut|groundnut|satay)/i,['peanuts']],[/\b(almond|hazelnut|walnut|cashew|pecan|pistachio|macadamia|brazil nut|praline|frangipane|marzipan|pesto)/i,['treenuts']],[/\b(soy|soya|tofu|edamame|miso|tamari|tempeh)/i,['soya']],[/\b(milk|butter(?!nut)|cream|cheese|cheddar|parmesan|mozzarella|brie|yoghurt|yogurt|cr[e\xe8]me|ghee|ice cream|custard|butterscotch|toffee|fudge|buttermilk|mascarpone|ricotta|whey)/i,['milk']],[/\b(celery|celeriac|stock cube|beef stock|chicken stock|veg(etable)? stock)/i,['celery']],[/\b(mustard|dijon|vinaigrette|piccalilli)/i,['mustard']],[/\b(sesame|tahini|hummus|houmous)/i,['sesame']],[/\b(wine|vinegar|dried apricot|dried fruit|sulphite|sulfite|prosecco|cider|port\b|sherry|dates?\b|raisin|sultana)/i,['sulphites']],[/\blupin/i,['lupin']]],s=[[/gluten.free|\bgf\b/i,'gluten'],[/dairy.free|vegan (butter|cheese|cream)|oat milk|plant.based/i,'milk'],[/egg.free|vegan mayo/i,'eggs']];function a(t){const i=new Set(t.allergens??[]);for(const[n,s]of r)n.test(t.name)&&s.forEach(n=>i.add(n));for(const[n,r]of s)n.test(t.name)&&!(t.allergens??[]).includes(r)&&i.delete(r);return n.ALLERGENS.map(n=>n.id).filter(n=>i.has(n))}function o(t){const i=new Set(t.flatMap(a));return n.ALLERGENS.map(n=>n.id).filter(n=>i.has(n))}const l=(n,t)=>n.filter(n=>a(n).includes(t)).map(n=>n.name);function c(n){return o(n.ingredients).filter(t=>!n.allergens[t]&&!n.dismissed.includes(t))}const u=n=>n.signOff?'signed-off':'awaiting',f={'signed-off':'Signed off',awaiting:'Awaiting sign-off'};const g=t=>n.ALLERGENS.find(n=>n.id===t)?.short??t,m=(t,i)=>n.ALLERGENS.filter(n=>i?t[n.id]===i:!!t[n.id]).map(n=>n.id),p=['dish','section','price','photo','ingredients','steps','allergens','dismissed','allergenNotes'],h=(n,t)=>JSON.stringify(n??null)===JSON.stringify(t??null);const b={menu_item_id:'text',section:'text',price_pence:'integer null',dismissed:'text[]',allergen_notes:'text',allergens_confirmed_by:'text',allergens_confirmed_at:'timestamptz',was_live:'boolean',origin:'text',version:'integer',updated_by:'text'},y='\n',_=(n,t)=>`${n}/${t.id}-v${t.version}.jpg`,O='recipe-photos',v='recipe_cards'},1104,[814]); +__d(function(g,r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ACCIDENT_CATEGORIES",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"RIDDOR_CATEGORIES",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"sid",{enumerable:!0,get:function(){return u}}),_e.isSeedAccident=w,Object.defineProperty(_e,"useSafety",{enumerable:!0,get:function(){return b}});var e,t=r(_d[0]),n=r(_d[1]),a=r(_d[2]),s=r(_d[3]),o=(e=s)&&e.__esModule?e:{default:e},d=r(_d[4]),c=r(_d[5]),l=r(_d[6]);const p=['Near miss','Slip, trip or fall','Cut','Burn or scald','Manual handling','Struck by an object','Allergic reaction','Fall from height','Fracture or dislocation','Taken to hospital','Lost consciousness','Off work more than 7 days','Other'],f=['Fall from height','Fracture or dislocation','Taken to hospital','Lost consciousness','Off work more than 7 days'];let y=0;const u=e=>`${e}-${Date.now().toString(36)}${(y++).toString(36)}`,h=(e,t,n)=>({id:e,when:t,location:'',person:'',personType:'Staff',category:'Near miss',what:'',injury:'None',firstAid:'None needed',witnesses:'',reportedBy:'',reportedById:'',app:'staff',createdAt:`${t}:00`,...n});function S(){const e=new Date,t=(t,n)=>{const a=new Date(e);return a.setDate(a.getDate()-t),`${a.toISOString().slice(0,10)}T${n}`};return[h('acc-ex1',t(3,'19:40'),{location:'Kitchen pass',person:'Server (example)',category:'Near miss',what:'Example: water on the floor by the pass after the glass washer leaked. Nobody slipped.',firstAid:'None needed',witnesses:'Bar (example)',reportedBy:'Server (example)',reportedById:'st-4',app:'staff'}),h('acc-ex2',t(6,'12:15'),{location:'Kitchen: fryer section',person:'Head Chef (example)',category:'Burn or scald',what:'Example: splash of hot oil on the back of the hand while changing the basket.',injury:'Small burn, back of left hand',firstAid:'Cooled under running water for 20 minutes, sterile dressing',witnesses:'None',reportedBy:'Head Chef (example)',reportedById:'st-3',app:'chef'})]}function w(e){const t=({when:e,createdAt:t,...n})=>JSON.stringify(n);return S().some(n=>n.id===e.id&&t(n)===t(e))}const b=(0,d.create)()((0,c.persist)(e=>({points:l.DEFAULT_POINTS,entries:[],accidents:a.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD?[]:S(),probes:[],diary:[],daySigns:[],weekly:[],addNote:t=>e(e=>({diary:[{...t,id:u('dn')},...e.diary??[]]})),signDay:t=>e(e=>({daySigns:[...(e.daySigns??[]).filter(e=>e.date!==t.date),t]})),signWeek:t=>e(e=>({weekly:[{...t,id:u('wk')},...(e.weekly??[]).filter(e=>e.week!==t.week)]})),addProbe:t=>e(e=>({probes:[...e.probes??[],{...t,id:u('pr'),status:'not-connected'}]})),removeProbe:t=>e(e=>({probes:(e.probes??[]).filter(e=>e.id!==t)})),addEntries:t=>e(e=>({entries:[...t.map(e=>({...e,id:u('hc')})),...e.entries]})),setPoint:(t,n)=>e(e=>({points:e.points.map(e=>e.id===t?{...e,...n}:e)})),addPoint:t=>e(e=>({points:[...e.points,{...t,id:u('cp')}]})),resetPoints:()=>e({points:l.DEFAULT_POINTS}),addAccident:t=>e(e=>({accidents:[{...t,id:u('acc'),createdAt:(new Date).toISOString()},...e.accidents]})),setRiddorNote:(t,n)=>e(e=>({accidents:e.accidents.map(e=>e.id===t?{...e,riddorNote:n}:e)}))}),{name:'covercharge-safety-v1',storage:(0,c.createJSONStorage)(()=>o.default),version:4,migrate:async(e,a)=>{if(t.LIVE_VENUE_BUILD&&e&&await(0,n.archiveChefCache)('safety',e),e&&a<2){const t=new Set((e.points??[]).map(e=>e.id));e.points=[...e.points??[],...l.DEFAULT_POINTS.filter(e=>!t.has(e.id))],e.diary=e.diary??[],e.daySigns=e.daySigns??[],e.weekly=e.weekly??[]}return t.LIVE_VENUE_BUILD&&e&&(e.accidents=(e.accidents||[]).filter(e=>!w(e))),e}}))},1105,[833,1132,5,1116,952,1117,1113]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"libraryRowId",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"personRowId",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"tickId",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"personKey",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"useDailyTasks",{enumerable:!0,get:function(){return L}}),Object.defineProperty(_e,"tasksOf",{enumerable:!0,get:function(){return O}});var e,t=r(d[0]),i=(e=t)&&e.__esModule?e:{default:e},s=r(d[1]),n=r(d[2]),o=r(d[3]),u=r(d[4]),c=r(d[5]);const l=e=>(0,o.uuidFrom)(`daily-task-library:${e}`),y=(e,t)=>(0,o.uuidFrom)(`daily-tasks:${e}:${t}`),b=(e,t,i,s)=>(0,o.uuidFrom)(`daily-task-tick:${e}:${(0,u.tickKey)(t,i,s)}`),f=()=>(new Date).toISOString(),k=(e,t)=>`${e}|${t}`,p=e=>u.DEFAULT_LIBRARY.map((t,i)=>({id:(0,o.uuidFrom)(`daily-task-lib:${e}:${i}`),text:t})),L=(0,s.create)()((0,n.persist)((e,t)=>({library:{},people:{},ticks:[],ensure:i=>{t().library[i]||e(e=>({library:{...e.library,[i]:{items:p(i)}}}))},setLibrary:(t,i)=>e(e=>({library:{...e.library,[t]:{items:i,updatedAt:f()}}})),addLibrary:(e,i)=>{const s=(0,u.cleanTaskText)(i);if(!s)return;const n=t().library[e]?.items??p(e);n.some(e=>e.text.toLowerCase()===s.toLowerCase()&&!e.archived)||t().setLibrary(e,[...n,{id:(0,c.uuid)(),text:s}])},setTasks:(t,i,s)=>e(e=>({people:{...e.people,[k(t,i)]:{tasks:s,updatedAt:f()}}})),addTask:(e,i,s,n)=>{const o=(0,u.cleanTaskText)(s);if(!o)return;const l=t().people[k(e,i)]?.tasks??[];l.some(e=>e.text.toLowerCase()===o.toLowerCase())||t().setTasks(e,i,[...l,{id:(0,c.uuid)(),text:o,...n?{libraryId:n}:{}}])},toggleTick:(t,i,s,n,o)=>e(e=>{const u=b(t,i,s,n);if(e.ticks.some(e=>e.id===u))return{ticks:e.ticks.filter(e=>e.id!==u)};const c=new Date(Date.now()-12096e5).toISOString().slice(0,10);return{ticks:[...e.ticks.filter(e=>e.forDate>=c),{id:u,rid:t,staffRef:i,taskId:s,forDate:n,byRef:o.id,byName:o.name,at:f()}]}}),resetLibrary:e=>t().setLibrary(e,p(e))}),{name:'covercharge-daily-tasks-v1',version:1,storage:(0,n.createJSONStorage)(()=>i.default)})),O=(e,t)=>L.getState().people[k(e,t)]?.tasks??[]},1106,[1116,952,1117,1104,1107,1033]); +__d(function(g,r,_i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TASK_MAX",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"cleanTaskText",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"appliesOn",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"tasksFor",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"tickKey",{enumerable:!0,get:function(){return u}}),e.progress=function(t,n,o,u,c){const s=i(t,c),f=new Set(n.filter(t=>t.staffRef===o&&t.forDate===u).map(t=>t.taskId));return{done:s.filter(t=>f.has(t.id)).length,total:s.length}},e.move=function(t,n,o){const i=n+o;if(n<0||i<0||n>=t.length||i>=t.length)return t;const u=[...t];return[u[n],u[i]]=[u[i],u[n]],u},Object.defineProperty(e,"hasTask",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"DEFAULT_LIBRARY",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"TASK_DAY_NAMES",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"isHeadChefP",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"isKitchenP",{enumerable:!0,get:function(){return d}}),e.canEditTasks=function(t,n){return!!t&&('owner'===t.role||'manager'===t.role||!!l(t)&&(t.id!==n.id&&'staff'===n.role&&!l(n)&&d(n)))};const t=80,n=n=>n.replace(/\s+/g,' ').trim().slice(0,t),o=(t,n)=>!t.days||0===t.days.length||t.days.includes(n),i=(t,n)=>t.filter(t=>o(t,n)),u=(t,n,o)=>`${t}|${n}|${o}`;const c=(t,o)=>t.some(t=>t.text.toLowerCase()===n(o).toLowerCase()),s=['Restock the bar fridges','Wipe down the menus','Check the toilets','Set the tables','Polish glasses','Empty the bins','Clean the coffee machine','Take out the recycling'],f=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],l=t=>'staff'===t.role&&('Head Chef'===t.level||/^head chef/i.test(t.job??'')),d=t=>'kitchen'===(t.dept??'').trim().toLowerCase()},1107,[]); +__d(function(g,_r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"LEGAL_LIMIT_MINS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"DEFAULT_BREAK_RULES",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"REMINDER_WINDOW_MINS",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"CHAIRS_TEXT",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"defaultChairs",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"DAY_NAMES",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"AUDIENCE_LABEL",{enumerable:!0,get:function(){return u}}),e.clampRules=s,Object.defineProperty(e,"validTime",{enumerable:!0,get:function(){return c}}),e.ukClock=d,e.reminderDue=function(t,n){const o=d(n);if(t.paused||!c(t.time)||!t.days.includes(o.dow))return{due:!1,forDate:o.ymd};const i=l(t.time);return{due:o.mins>=i&&o.mins=t.shiftEnd))return null;const r=m(t).filter(n=>n.at<=t.now),o=r.length?r[r.length-1]:null;if(!o)return null;if(t.nowr?o:null}return o};const t=360,n={on:!0,afterMins:240,repeatMins:30,snoozeMins:15},r=180,o='Time to put the chairs up on the tables',i=t=>({id:t,text:o,days:[5,0],time:'21:00',audience:'all',builtIn:'chairs'}),a=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],u={all:'Everyone on shift',foh:'Front of house',kitchen:'Kitchen'};function s(r){const o=(t,n,r,o)=>{const i=Math.round(Number(t));return Number.isFinite(i)?Math.min(o,Math.max(r,i)):n};return{on:!1!==r.on,afterMins:o(r.afterMins,n.afterMins,30,t),repeatMins:o(r.repeatMins,n.repeatMins,5,120),snoozeMins:o(r.snoozeMins,n.snoozeMins,5,60)}}const c=t=>/^([01]\d|2[0-3]):[0-5]\d$/.test(t);function d(t){const n='number'==typeof t?new Date(t):t,r=Object.fromEntries(new Intl.DateTimeFormat('en-GB',{timeZone:'Europe/London',weekday:'short',year:'numeric',month:'2-digit',day:'2-digit',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}).formatToParts(n).map(t=>[t.type,t.value]));return{dow:a.indexOf(String(r.weekday).slice(0,3)),mins:60*Number(r.hour)+Number(r.minute),ymd:`${r.year}-${r.month}-${r.day}`}}const l=t=>60*Number(t.slice(0,2))+Number(t.slice(3,5));const f=(t,n)=>'all'===t||('kitchen'===t?n:!n);function m(t){const n=s(t.rules),r=t.clockIn??t.shiftStart;if(!n.on||void 0===r||t.hadBreak)return[];const o=r+216e5,i=Math.min(void 0!==t.rotaBreak&&t.rotaBreak>r?t.rotaBreak:r+6e4*n.afterMins,o),a=[{stage:1,at:i,label:void 0!==t.rotaBreak&&t.rotaBreak>r&&t.rotaBreak<=o?'Your break on the rota is now.':'Time for your break.'}],u=i+6e4*n.repeatMins;return a.push({stage:2,at:u,label:'Reminder: you haven\u2019t had your break yet.'}),o>u&&a.push({stage:3,at:o,label:'You\u2019ve worked 6 hours without a break. You need a 20-minute break (UK law).'}),a}},1108,[]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"TAKINGS_FIELDS",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"NO_SERVICE_SPLIT",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"TAKINGS_KEYS",{enumerable:!0,get:function(){return t}}),_e.withTakingsFields=function(t){t=t.filter(e=>!n.includes(e.key));const r=new Set(t.map(e=>e.key)),o=e.filter(e=>!r.has(e.key)).map(e=>({...e}));if(!o.length)return t;const l=t.findIndex(e=>'cash'===e.key),i=l<0?t.length:l+1;return[...t.slice(0,i),...o,...t.slice(i)]},Object.defineProperty(_e,"grossOf",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"DEFAULT_CASHUP_FIELDS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"DEFAULT_SALES_FIELDS",{enumerable:!0,get:function(){return l}}),_e.parseAmount=function(e,n="money"){const t=e.replace(/[\xa3,\s]/g,'');return t?'number'===n?/^\d{1,6}$/.test(t)?Number(t):null:/^-?\d{1,7}(\.\d{1,2})?$/.test(t)?Math.round(100*Number(t))/100:null:null},Object.defineProperty(_e,"isBlank",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"ymdUTC",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"addDaysYmd",{enumerable:!0,get:function(){return u}}),_e.weekStartOf=function(e){const n=(s(e).getUTCDay()+6)%7;return u(e,-n)},_e.combinedTips=function(e){const n='number'==typeof e.cashTips?e.cashTips:null,t='number'==typeof e.cardTips?e.cardTips:null;return null==n&&null==t?null:Math.round(100*((n??0)+(t??0)))/100},Object.defineProperty(_e,"takings",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"missing",{enumerable:!0,get:function(){return d}}),_e.dailySeries=function(e,n,t,r=c){const o=new Map(e.filter(e=>e.confirmedAt).map(e=>[e.date,e]));return Array.from({length:t},(e,l)=>{const i=u(n,l-t+1),a=o.get(i);return{date:i,value:a?r(a.vals):null}})},_e.weekCompare=function(e,n,t="net"){const r=n=>{const r=e.find(e=>e.weekStart===n&&e.confirmedAt),o=r?.vals[t];return'number'==typeof o?o:null},o=r(n),l=r(u(n,-7)),i=null!=o&&null!=l&&0!==l?Math.round((o-l)/l*1e3)/10:null;return{now:o,prev:l,change:i}},_e.tipsPot=function(e,n,t,r){const o=n.filter(e=>'payout'===e.kind&&e.throughDate).sort((e,n)=>e.at.localeCompare(n.at)),l=o[o.length-1],i=l?u(l.throughDate,1):t,a=e.filter(e=>e.date>=i&&e.date<=r).sort((e,n)=>e.date.localeCompare(n.date)),s=n.filter(e=>'correction'===e.kind&&e.forDate&&e.forDate>=i&&e.forDate<=r&&(!l||e.at>l.at)),c=Math.round(100*(a.reduce((e,n)=>e+n.total,0)+s.reduce((e,n)=>e+n.amount,0)))/100;return{from:i,total:Math.max(0,c),days:a,corrections:s,lastPayout:l??null,history:o.slice().reverse()}},_e.cashLocked=function(e,n=Date.now()){return!(!e.onServer||!e.confirmedAt)&&!(e.unlockedUntil&&Date.parse(e.unlockedUntil)>n)},_e.changedFields=function(e,n){const t=e??{},r=n??{},o=[],l=t.vals??{},i=r.vals??{};for(const e of new Set([...Object.keys(l),...Object.keys(i)]))JSON.stringify(l[e])!==JSON.stringify(i[e])&&o.push(e);JSON.stringify(t.categories??null)!==JSON.stringify(r.categories??null)&&(t.categories||r.categories)&&o.push('categories');JSON.stringify(t.photos??[])!==JSON.stringify(r.photos??[])&&e&&n&&o.push('photos');return o};const e=[{key:'gross',label:'Gross takings',kind:'money',fixed:!0,optional:!0},{key:'food',label:'Food takings (optional)',kind:'money',fixed:!0,optional:!0},{key:'drink',label:'Drink takings (optional)',kind:'money',fixed:!0,optional:!0}],n=['lunchGross','dinnerGross'],t=e.map(e=>e.key);const r=e=>'number'==typeof e.gross?e.gross:null,o=[{key:'card',label:'Card takings',kind:'money'},{key:'cash',label:'Cash takings',kind:'money'},...e,{key:'float',label:'Float (tills)',kind:'money'},{key:'cashTips',label:'Cash tips total',kind:'money',fixed:!0},{key:'cardTips',label:'Card tips total',kind:'money',fixed:!0},{key:'overUnder',label:'Over / under (discrepancy)',kind:'money'},{key:'notes',label:'Notes',kind:'text'}],l=[{key:'gross',label:'Gross sales',kind:'money'},{key:'net',label:'Net sales',kind:'money',fixed:!0},{key:'vat',label:'VAT',kind:'money'},{key:'covers',label:'Covers',kind:'number'},{key:'discounts',label:'Discounts',kind:'money'},{key:'refunds',label:'Refunds',kind:'money'}];const i=e=>null==e||''===e,a=e=>e.toISOString().slice(0,10),s=e=>new Date(`${e}T12:00:00Z`),u=(e,n)=>{const t=s(e);return t.setUTCDate(t.getUTCDate()+n),a(t)};const c=e=>{const n='number'==typeof e.card?e.card:null,t='number'==typeof e.cash?e.cash:null;return null==n&&null==t?null:(n??0)+(t??0)},d=(e,n)=>e.filter(e=>'text'!==e.kind&&!e.optional&&i(n[e.key])).map(e=>e.key)},1109,[]); +__d(function(g,r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"FALLBACK_PAY",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"ymdOf",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"dateOf",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"plusDays",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"daysBetween",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"isValidYmd",{enumerable:!0,get:function(){return y}}),_e.cleanPay=function(t){const n={...e,...t??{}};return{tipsFrequency:['weekly','fortnightly','monthly'].includes(n.tipsFrequency)?n.tipsFrequency:'fortnightly',tipsAnchorPayday:y(String(n.tipsAnchorPayday))?n.tipsAnchorPayday:e.tipsAnchorPayday,tipsEndsDaysBefore:Math.max(0,Math.min(13,Math.round(Number(n.tipsEndsDaysBefore)||0))),wagePayDay:Math.max(1,Math.min(31,Math.round(Number(n.wagePayDay)||28))),wageCutoffDay:Math.max(1,Math.min(28,Math.round(Number(n.wageCutoffDay)||1))),weekendRule:'before'===n.weekendRule||'after'===n.weekendRule?n.weekendRule:'none'}},_e.adjustWeekend=s,_e.wagePeriod=f,_e.tipsPeriod=m,_e.nextToPay=function(e,t,n){for(let a=-2;a<=2;a++){const u='wage'===t?f(e,n,a):m(e,n,a);if((u.payday??u.end)>=n)return{period:u,offset:a}}return{period:'wage'===t?f(e,n,0):m(e,n,0),offset:0}},_e.customPeriod=function(e,t){return{kind:'custom',start:e,end:t,key:`c-${e}-${t}`}},Object.defineProperty(_e,"ukDate",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"dayMonth",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"dm",{enumerable:!0,get:function(){return M}}),Object.defineProperty(_e,"rangeText",{enumerable:!0,get:function(){return $}}),_e.parseUk=function(e){const n=e.trim();if(y(n))return n;const a=/^(\d{1,2})[/.-](\d{1,2})[/.-](\d{2}|\d{4})$/.exec(n);if(!a)return null;const u=`${2===a[3].length?2e3+Number(a[3]):Number(a[3])}-${t(Number(a[2]))}-${t(Number(a[1]))}`;return y(u)?u:null},Object.defineProperty(_e,"decH",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"hMm",{enumerable:!0,get:function(){return F}});const e={tipsFrequency:'weekly',tipsAnchorPayday:'2026-01-05',tipsEndsDaysBefore:1,wagePayDay:31,wageCutoffDay:1,weekendRule:'none'},t=e=>String(e).padStart(2,'0'),n=e=>`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}`,a=e=>{const[t,n,a]=e.split('-').map(Number);return new Date(t,n-1,a,12)},u=(e,t)=>{const u=a(e);return u.setDate(u.getDate()+t),n(u)},o=(e,t)=>Math.round((a(t).getTime()-a(e).getTime())/864e5),i=(e,t)=>new Date(e,t+1,0).getDate(),c=(e,t,a)=>{const u=new Date(e,t,1,12),o=u.getFullYear(),c=u.getMonth();return n(new Date(o,c,Math.min(a,i(o,c)),12))},y=e=>/^\d{4}-\d{2}-\d{2}$/.test(e)&&n(a(e))===e;function s(e,t="none"){if('none'===t)return e;const n=a(e).getDay();return 6===n?u(e,'before'===t?-1:2):0===n?u(e,'before'===t?-2:1):e}function d(e,t,n){const o=c(t,n,e.wageCutoffDay),i=u(c(t,n+1,e.wageCutoffDay),-1),y=a(i);let d=c(y.getFullYear(),y.getMonth(),e.wagePayDay);return dn.end))break;a++}}return a}function m(e,t,n=0){return p(e,h(e,t)+n)}const b=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],D=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],w=e=>{const[t,n,a]=e.split('-');return`${a}/${n}/${t}`},P=e=>{const t=a(e);return`${b[t.getDay()]} ${t.getDate()} ${D[t.getMonth()]}`},M=e=>{const t=a(e);return`${t.getDate()} ${D[t.getMonth()]}`},$=(e,t,n=" to ")=>e.slice(0,4)===t.slice(0,4)?`${M(e)}${n}${M(t)}`:`${M(e)} ${e.slice(0,4)}${n}${M(t)} ${t.slice(0,4)}`;const k=e=>(Math.round(e/60*100)/100).toFixed(2),F=e=>`${Math.floor(e/60)}:${t(Math.round(e)%60)}`},1110,[]); +__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.payFor=u,_e.useVenuePay=function(s){const r=(0,n.useRestaurant)(s),o=(0,t.useOnboard)(e=>e.answers);return(0,e.useMemo)(()=>u(s,r?.settings.pay,o),[s,r?.settings.pay,o])},_e.venueRange=function(e,n,t,s){const u='wage'===n?(0,r.wagePeriod)(e,(0,r.ymdOf)(s),t):(0,r.tipsPeriod)(e,(0,r.ymdOf)(s),t),o=(0,r.dateOf)(u.start);o.setHours(0,0,0,0);const y=(0,r.dateOf)(u.end);return y.setHours(0,0,0,0),{s:o,e:y,key:u.key,payday:u.payday}};var e=_r(d[0]),n=_r(d[1]),t=_r(d[2]),s=_r(d[3]),r=_r(d[4]);function u(e,n,t){if(n)return{pay:(0,r.cleanPay)(n),source:'settings'};const u=t[e]?.pay??s.SEEDED_ANSWERS[e]?.pay;return u?{pay:(0,r.cleanPay)(u),source:'questionnaire'}:{pay:r.FALLBACK_PAY,source:'none'}}},1111,[30,1021,1112,1276,1110]); +__d(function(_g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useOnboard",{enumerable:!0,get:function(){return l}});var e,s=r(_d[0]),t=(e=s)&&e.__esModule?e:{default:e},p=r(_d[1]),u=r(_d[2]);const n=()=>{const e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`},l=(0,p.create)()((0,u.persist)(e=>({setup:{},answers:{},goals:{},replay:null,markStep:(s,t,p)=>e(e=>({setup:{...e.setup,[s]:{...e.setup[s]??{steps:{}},steps:{...e.setup[s]?.steps??{},[t]:p}}}})),welcome:s=>e(e=>({setup:{...e.setup,[s]:{...e.setup[s]??{steps:{}},welcomed:n()}}})),finish:s=>e(e=>({replay:null,setup:{...e.setup,[s]:{...e.setup[s]??{steps:{}},welcomed:e.setup[s]?.welcomed??n(),finished:n()}}})),restart:s=>e(e=>({setup:{...e.setup,[s]:{steps:{}}}})),setReplay:s=>e({replay:s}),saveAnswers:(s,t)=>e(e=>({answers:{...e.answers,[s]:t}})),setGoal:(s,t)=>e(e=>{const p={...e.goals};return t?p[s]=t:delete p[s],{goals:p}})}),{name:'covercharge-onboard-v1',version:1,storage:(0,u.createJSONStorage)(()=>t.default),partialize:e=>({setup:e.setup,answers:e.answers,goals:e.goals})}))},1112,[1116,952,1117]); +__d(function(g,_r,i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"KIND_LABEL",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"TEMP_KINDS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"isTempKind",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"SECTIONS",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"SECTION_LABEL",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"sectionOf",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"initialsOf",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"DEFAULT_POINTS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"limitText",{enumerable:!0,get:function(){return d}}),_e.inRange=u,_e.spokenNumber=p,_e.parseQuick=function(e,n){return e.split(/[,;\n]+|\s+and\s+|\.\s+/i).map(e=>e.trim()).filter(Boolean).map(e=>{const r=e.toLowerCase().replace(/[\u2010\u2013]/g,'-').replace(/-(?!\d)/g,' '),o=` ${r.replace(/[^a-z0-9.\- ]/g,' ').replace(/\s+/g,' ')} `;let a,l=0;for(const e of n)for(const n of[e.name.toLowerCase(),...e.aliases]){const t=n.replace(/-/g,' ').replace(/[^a-z0-9 ]/g,' ').replace(/\s+/g,' ').trim();t&&o.includes(` ${t} `)&&t.length>l&&(a=e,l=t.length)}const s=p(r);return a?t(a.kind)?null==s?{text:e,point:a,value:null,problem:'No temperature heard \u2014 type it in.'}:{text:e,point:a,value:s}:{text:e,point:a,value:null}:{text:e,value:s,problem:'Not sure which check this is \u2014 pick it below or type it.'}})},_e.missedChecks=function(e,n,t){const r=new Date(t);r.setHours(0,0,0,0);const o=60*t.getHours()+t.getMinutes(),a=[];for(const l of e){const e=l.due.filter(e=>f(e)<=o);if(!e.length)continue;const s=e[e.length-1],c=r.getTime()+6e4*f(e[0])-108e5,d=n.filter(e=>e.pointId===l.id&&new Date(e.at).getTime()>=c&&new Date(e.at).getTime()<=t.getTime()),u=e.length;d.lengthe.map(y).join(',')).join('\r\n')+'\r\n'},Object.defineProperty(_e,"SLOTS",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"SLOT_LABEL",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"SLOT_HINT",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"slotOf",{enumerable:!0,get:function(){return C}}),_e.todayTasks=function(e,n,t){const r=new Date(t);r.setHours(0,0,0,0);const o=60*t.getHours()+t.getMinutes(),a=[];for(const l of e){const e=[...l.due].sort();if(!e.length)continue;const s=r.getTime()+6e4*f(e[0])-108e5,c=n.filter(e=>e.pointId===l.id&&new Date(e.at).getTime()>=s&&new Date(e.at).getTime()<=t.getTime()).reverse().sort((e,n)=>e.at.localeCompare(n.at));e.forEach((e,n)=>{const t=c[n],r=f(e),s=t?'done':o>=r?'overdue':o>=r-60?'due':'upcoming';a.push({key:`${l.id}@${e}`,point:l,due:e,slot:C(e),status:s,entry:t})})}return a.sort((e,n)=>e.due.localeCompare(n.due)||e.point.name.localeCompare(n.point.name))},_e.unitStatus=function(e,n,t){const r=n.filter(n=>n.pointId===e.id&&null!=n.value).reverse().sort((e,n)=>e.at.localeCompare(n.at)),o=r[r.length-1];if(!o)return{rag:'none',history:r,why:'No readings yet'};const a=o.value;if(!u(e,a))return{rag:'red',latest:o,history:r,why:'Out of range'};const l=new Date(t);if(l.setHours(0,0,0,0),new Date(o.at).getTime()e.max-1||null!=e.min&&an.includes(e),r=['cross','cleaning','chilling','cooking','management'],o={cross:'Cross-contamination',cleaning:'Cleaning',chilling:'Chilling',cooking:'Cooking',management:'Management'},a={fridge:'chilling',freezer:'chilling',cool:'chilling',delivery:'chilling',cook:'cooking',hothold:'cooking',cleaning:'cleaning',allergen:'cross',check:'management'},l=e=>e.section??a[e.kind],s=e=>e.replace(' (example)','').split(/\s+/).filter(Boolean).map(e=>e[0]).join('').slice(0,3).toUpperCase(),c=[{id:'cp-walkin',name:'Walk-in fridge',kind:'fridge',max:5,due:['09:00','16:00'],aliases:['walk in fridge','walkin fridge','walk in','walk-in','walkin','cold room']},{id:'cp-prep',name:'Prep fridge',kind:'fridge',max:5,due:['09:00','16:00'],aliases:['prep fridge','prep']},{id:'cp-bar',name:'Bar fridge',kind:'fridge',max:5,due:['16:00'],aliases:['bar fridge','bar']},{id:'cp-freezer',name:'Freezer',kind:'freezer',max:-18,due:['09:00','16:00'],aliases:['freezer','chest freezer']},{id:'cp-cook',name:'Cooking: core temperature',kind:'cook',min:75,due:[],aliases:['core','cook','cooking','probe']},{id:'cp-cool',name:'Cooling: within 90 minutes',kind:'cool',max:8,due:[],aliases:['cooling','cool']},{id:'cp-hothold',name:'Hot hold: bain-marie',kind:'hothold',min:63,due:['18:00'],aliases:['hot hold','bain marie','bain-marie','hothold']},{id:'cp-del-chill',name:'Delivery: chilled',kind:'delivery',max:8,due:[],aliases:['chilled delivery','delivery chilled','delivery']},{id:'cp-del-frozen',name:'Delivery: frozen',kind:'delivery',max:-15,due:[],aliases:['frozen delivery','delivery frozen']},{id:'cp-clean',name:'Close-down clean signed off',kind:'cleaning',due:['23:00'],aliases:['cleaning','clean down','close down']},{id:'cp-allergen',name:'Allergen matrix checked against today\u2019s specials',kind:'allergen',due:['11:00'],aliases:['allergen','allergens']},{id:'cp-open-equip',name:'Fridges, freezers and other equipment working',kind:'check',section:'management',due:['09:00'],aliases:['equipment']},{id:'cp-open-staff',name:'Staff fit for work, in clean work clothes',kind:'check',section:'management',due:['09:00'],aliases:['staff fit']},{id:'cp-open-surfaces',name:'Prep areas, surfaces and utensils clean and disinfected',kind:'cleaning',due:['09:00'],aliases:['surfaces','prep areas']},{id:'cp-open-pests',name:'No signs of pests',kind:'check',section:'cleaning',due:['09:00'],aliases:['pests','pest']},{id:'cp-open-hands',name:'Hand-wash basins: hot water, soap and paper towels',kind:'check',section:'cross',due:['09:00'],aliases:['hand wash','handwash','soap']},{id:'cp-open-probe',name:'Probe thermometer working, probe wipes available',kind:'check',section:'management',due:['09:00'],aliases:['probe wipes','thermometer']},{id:'cp-mid-boards',name:'Raw and ready-to-eat kept apart; colour-coded boards in use',kind:'check',section:'cross',due:['12:00'],aliases:['boards','raw and ready to eat']},{id:'cp-close-stored',name:'Food covered, labelled, dated and put away',kind:'check',section:'chilling',due:['22:00'],aliases:['labelled','covered']},{id:'cp-close-useby',name:'Food past its use-by date thrown away',kind:'check',section:'chilling',due:['22:00'],aliases:['use by','use-by']},{id:'cp-close-waste',name:'Waste removed and bins relined',kind:'check',section:'cleaning',due:['22:00'],aliases:['waste','bins']}],d=e=>null!=e.min&&null!=e.max?`${e.min}\xb0C to ${e.max}\xb0C`:null!=e.max?`${e.max}\xb0C or colder`:null!=e.min?`${e.min}\xb0C or hotter`:'Done / not done';function u(e,n){return(null==e.min||n>=e.min)&&(null==e.max||n<=e.max)}const m={zero:0,nought:0,one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12,thirteen:13,fourteen:14,fifteen:15,sixteen:16,seventeen:17,eighteen:18,nineteen:19,twenty:20,thirty:30,forty:40,fifty:50,sixty:60,seventy:70,eighty:80,ninety:90};function p(e){const n=e.toLowerCase().replace(/\u2212/g,'-').replace(/degrees?|\xb0c?|celsius|centigrade/g,' '),t=/\b(minus|negative)\b/.test(n),r=n.match(/-?\d+(?:[.,]\d+)?/);if(r){const e=Number(r[0].replace(',','.'));return t&&e>0?-e:e}const o=n.split(/[^a-z]+/).filter(Boolean);let a=null,l=null,s=!1;for(const e of o)if('point'!==e){if(e in m){if(s){l=m[e];break}a=(a??0)+m[e]}}else s=!0;if(null==a)return null;const c=null!=l?Number(`${a}.${l}`):a;return t?-c:c}const f=e=>{const[n,t]=e.split(':').map(Number);return 60*n+t};const h=e=>null!=e.value?`${e.value}\xb0C`:e.done?'Done':'Not done',y=e=>{const n=null==e?'':String(e);return/[",\n]/.test(n)?`"${n.replace(/"/g,'""')}"`:n},k=['Date','Time','Check','Type','Reading','Safe limit','Result','Corrective action','Note','Recorded by','Entry'];function b(n,t){return n.map(n=>{const r=new Date(n.at),o=t.find(e=>e.id===n.pointId);return[r.toLocaleDateString('en-GB'),r.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}),n.name,e[n.kind],h(n),o?d(o):'',n.ok?'OK':'OUT OF RANGE',n.corrective??'',n.note??'',n.by,'probe'===n.source?'Wireless probe':'voice'===n.source?'Voice (confirmed)':'Typed']})}const w=['opening','midday','closing'],v={opening:'Opening',midday:'Midday',closing:'Closing'},O={opening:'until 11:00',midday:'11:00 to 16:00',closing:'from 16:00'},C=e=>{const n=f(e);return n<660?'opening':n<960?'midday':'closing'};const T=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`,x=['Opening and closing checks were done every day (or the reason is in the diary)','Every out-of-range reading has a corrective action','Probe thermometers checked (iced water / boiling water) this week','Allergen information is up to date for menu and special changes','Cleaning schedule followed; no signs of pests','Staff trained on any changed safe methods']},1113,[]); +__d(function(g,r,_i,_a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"setMenuCardBridge",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"menuCardBridge",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"resolveItem",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"resolveMenu",{enumerable:!0,get:function(){return m}}),e.sortMenu=c;var t=r(d[0]);let n=null;const o=t=>{n=t},u=()=>n,i=o=>(0,t.overlayItem)(o,n?.cardFor(o.id)),m=t=>c(t.map(i));function c(t){return t.some(t=>'number'==typeof t.sort)?t.map((t,n)=>({m:t,i:n,k:'number'==typeof t.sort?t.sort:10*n})).sort((t,n)=>t.k-n.k||t.i-n.i).map(t=>t.m):t}},1114,[1104]); +__d(function(_g,_r,i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.nextTablesFree=function(t,r,o,l,u=[]){const m=`${l.getFullYear()}-${String(l.getMonth()+1).padStart(2,'0')}-${String(l.getDate()).padStart(2,'0')}`,f=(0,a.lastFoodOn)(t,m),d=f?new Date(`${m}T${f.time}:00`):null,b=t=>o.filter(a=>a.date===m&&'confirmed'===a.status&&(a.table??'').split('+').map(t=>t.trim()).includes(t)).map(t=>new Date(`${t.date}T${t.time}:00`)).filter(t=>t>=s(l,-20)).sort((t,a)=>t.getTime()-a.getTime())[0],c=[],g=[];for(const o of Object.values(r)){const r=o.table.name,m=b(r);if('free'===o.status){(!m||m>s(l,60))&&c.push(r);continue}if(!n.includes(o.status)||!o.booking)continue;const f=o.booking,h=f.seatedAt?new Date(f.seatedAt):new Date(`${f.date}T${f.time}:00`),$=(0,a.dwellFor)(t,f.partySize,u);let w=s(h,$.mins),T='maybe',p=`seated ${Math.max(0,Math.round((l.getTime()-h.getTime())/6e4))} min, usual ${$.mins} min`;'bill'===o.status?(w=s(l,10),T='likely',p='bill requested'):'dessert'===o.status?(w=new Date(Math.min(w.getTime(),s(l,25).getTime())),T='likely',p='on dessert'):'mains'===o.status&&(w=new Date(Math.min(Math.max(w.getTime(),s(l,35).getTime()),s(l,60).getTime())),p='mains out'),w=d?{drinksOnly:!0}:{}})}g.sort((t,a)=>t.at.getTime()-a.at.getTime());const h=Object.values(r).filter(t=>'blocked'!==t.status).length,$=h>0&&c.length<=Math.max(1,Math.round(.1*h));return{full:$,freeNow:c,list:g,waitFor:t=>g.find(a=>a.seats>=t)??null}},Object.defineProperty(e,"hhmm",{enumerable:!0,get:function(){return r}}),e.nextFreeSentence=function(a,n){if(a.freeNow.length&&!a.full)return`There are ${a.freeNow.length} tables free now: ${a.freeNow.slice(0,4).map(t=>`table ${t}`).join(', ')}.`;const s=a.list[0];if(!s)return a.freeNow.length?`${(0,t.tableNumbers)(a.freeNow[0])} is free now.`:'No table is due to free up before the bookings that follow; check the bookings list.';const o=Math.max(5,Math.round((s.at.getTime()-n.getTime())/6e4)),l=a.waitFor(2),u=a.waitFor(4);return`Next table free about ${r(s.at)} (table ${s.table}, ${s.seats} seats), ${s.confidence}, in about ${o} minutes.${l?` A table for 2: about ${r(l.at)}.`:''}${u?` A table for 4: about ${r(u.at)}.`:''}${s.drinksOnly?' That\u2019s after last food orders, so drinks only.':''}`};var t=_r(_d[0]),a=_r(_d[1]);const n=['seated','mains','dessert','bill'],s=(t,a)=>new Date(t.getTime()+6e4*a);const r=t=>`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`},1115,[808,809]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return f}});var e,t=r(d[0]),u=(e=t)&&e.__esModule?e:{default:e},n=r(d[1]),f={getItem:e=>u.default.getItem((0,n.venueKey)(e)),setItem:(e,t)=>u.default.setItem((0,n.venueKey)(e),t),removeItem:e=>u.default.removeItem((0,n.venueKey)(e))}},1116,[1120,5]); +__d(function(g,_r,i,_a3,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"combine",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"createJSONStorage",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"devtools",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"persist",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"redux",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"subscribeWithSelector",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"unstable_ssrSafe",{enumerable:!0,get:function(){return S}});const e=(e,t)=>(n,r,o)=>(o.dispatch=t=>(n(n=>e(n,t),!1,t),t),o.dispatchFromDevtools=!0,{dispatch:(...e)=>o.dispatch(...e),...t}),t=e=>!!e.dispatchFromDevtools&&"function"==typeof e.dispatch,n=new Map,r=e=>{const t=n.get(e);return t?Object.fromEntries(Object.entries(t.stores).map(([e,t])=>[e,t.getState()])):{}},o=(e,t,r)=>{if(void 0===e)return{type:"untracked",connection:t.connect(r)};const o=n.get(r.name);if(o)return{type:"tracked",store:e,...o};const s={connection:t.connect(r),stores:{}};return n.set(r.name,s),{type:"tracked",store:e,...s}},s=(e,t,r)=>{if(void 0===t)return;const o=n.get(e);(null==o?void 0:o.stores[t])===r&&(delete o.stores[t],0===Object.keys(o.stores).length&&n.delete(e))},a=/^at (?:new |async )?(.+?) \(/,l=/^([^@]+)@/;function c(e){var t,n,r;if(!e)return;const o=e.split("\n"),s=o.findIndex(e=>e.includes("api.setState"));if(s<0)return;const c=(null==(t=o[s+1])?void 0:t.trim())||"";return(null==(n=a.exec(c))?void 0:n[1])||(null==(r=l.exec(c))?void 0:r[1])}const u=(e,a={})=>(l,u,p)=>{const{enabled:f,anonymousActionType:y,store:h,...b}=a;let S;try{S=(null!=f?f:"production"!==(globalThis.__ExpoImportMetaRegistry.env?globalThis.__ExpoImportMetaRegistry.env.MODE:void 0))&&window.__REDUX_DEVTOOLS_EXTENSION__}catch(e){}if(!S)return e(l,u,p);const{connection:O,..._}=o(h,S,b);let w,E=!0;p.setState=(e,t,n)=>{const o=l(e,t);if(!E)return o;const s=void 0===n?{type:y||c((new Error).stack)||"anonymous"}:"string"==typeof n?{type:n}:n;return void 0===h?(null==O||O.send(s,u()),o):(null==O||O.send({...s,type:`${h}/${s.type}`},{...r(b.name),[h]:p.getState()}),o)},p.devtools={cleanup:()=>{null==w||w(),w=void 0,s(b.name,h,p),void 0!==h&&n.has(b.name)||!O||"function"!=typeof O.unsubscribe||O.unsubscribe()}};const I=(...e)=>{const t=E;E=!1,l(...e),E=t},j=e(p.setState,u,p);if("untracked"===_.type?null==O||O.init(j):(_.stores[_.store]=p,null==O||O.init(Object.fromEntries(Object.entries(_.stores).map(([e,t])=>[e,e===_.store?j:t.getState()])))),t(p)){let e=!1;const t=p.dispatch;p.dispatch=(...n)=>{"production"===(globalThis.__ExpoImportMetaRegistry.env?globalThis.__ExpoImportMetaRegistry.env.MODE:void 0)||"__setState"!==n[0].type||e||(console.warn('[zustand devtools middleware] "__setState" action type is reserved to set state from the devtools. Avoid using it.'),e=!0),t(...n)}}return w=O.subscribe(e=>{var n;const o="object"==typeof b.serialize?b.serialize.reviver:void 0;switch(e.type){case"ACTION":return"string"!=typeof e.payload?void console.error("[zustand devtools middleware] Unsupported action format"):v(e.payload,o,e=>{if("__setState"===e.type){if(void 0===h)return void I(e.state);1!==Object.keys(e.state).length&&console.error("\n [zustand devtools middleware] Unsupported __setState action format.\n When using 'store' option in devtools(), the 'state' should have only one key, which is a value of 'store' that was passed in devtools(),\n and value of this only key should be a state object. Example: { \"type\": \"__setState\", \"state\": { \"abc123Store\": { \"foo\": \"bar\" } } }\n ");const t=e.state[h];if(null==t)return;return void(JSON.stringify(p.getState())!==JSON.stringify(t)&&I(t))}t(p)&&p.dispatch(e)});case"DISPATCH":switch(e.payload.type){case"RESET":return I(j),void 0===h?null==O?void 0:O.init(p.getState()):null==O?void 0:O.init(r(b.name));case"COMMIT":return void 0===h?void(null==O||O.init(p.getState())):null==O?void 0:O.init(r(b.name));case"ROLLBACK":return v(e.state,o,e=>{if(void 0===h)return I(e),void(null==O||O.init(p.getState()));I(e[h]),null==O||O.init(r(b.name))});case"JUMP_TO_STATE":case"JUMP_TO_ACTION":return v(e.state,o,e=>{void 0!==h?JSON.stringify(p.getState())!==JSON.stringify(e[h])&&I(e[h]):I(e)});case"IMPORT_STATE":{const{nextLiftedState:t}=e.payload,r=null==(n=t.computedStates.slice(-1)[0])?void 0:n.state;if(!r)return;return I(void 0===h?r:r[h]),void(null==O||O.send(null,t))}case"PAUSE_RECORDING":return E=!E}return}}),j},v=(e,t,n)=>{let r;try{r=JSON.parse(e,t)}catch(e){console.error("[zustand devtools middleware] Could not parse the received json",e)}void 0!==r&&n(r)},p=e=>(t,n,r)=>{const o=r.subscribe;r.subscribe=(e,t,n)=>{let s=e;if(t){const o=(null==n?void 0:n.equalityFn)||Object.is;let a=e(r.getState());s=n=>{const r=e(n);if(!o(a,r)){const e=a;t(a=r,e)}},(null==n?void 0:n.fireImmediately)&&t(a,a)}return o(s)};return e(t,n,r)};function f(e,t){return(...n)=>Object.assign({},e,t(...n))}function y(e,t){let n;try{n=e()}catch(e){return}return{getItem:e=>{var r;const o=e=>null===e?null:JSON.parse(e,null==t?void 0:t.reviver),s=null!=(r=n.getItem(e))?r:null;return s instanceof Promise?s.then(o):o(s)},setItem:(e,r)=>n.setItem(e,JSON.stringify(r,null==t?void 0:t.replacer)),removeItem:e=>n.removeItem(e)}}const h=e=>t=>{try{const n=e(t);return n instanceof Promise?n:{then:e=>h(e)(n),catch(e){return this}}}catch(e){return{then(e){return this},catch:t=>h(t)(e)}}},b=(e,t)=>(n,r,o)=>{let s={storage:y(()=>window.localStorage),partialize:e=>e,version:0,merge:(e,t)=>({...t,...e}),...t},a=!1,l=0;const c=new Set,u=new Set;let v=s.storage;if(!v)return e((...e)=>{console.warn(`[zustand persist middleware] Unable to update item '${s.name}', the given storage is currently unavailable.`),n(...e)},r,o);const p=()=>{const e=s.partialize({...r()});return v.setItem(s.name,{state:e,version:s.version})},f=o.setState;o.setState=(...e)=>(f(...e),p());const b=e((...e)=>(n(...e),p()),r,o);let S;o.getInitialState=()=>b;const O=()=>{var e,t;if(!v)return;const o=++l;a=!1,c.forEach(e=>{var t;return e(null!=(t=r())?t:b)});const f=(null==(t=s.onRehydrateStorage)?void 0:t.call(s,null!=(e=r())?e:b))||void 0;return h(v.getItem.bind(v))(s.name).then(e=>{if(e){if("number"!=typeof e.version||e.version===s.version)return[!1,e.state];if(s.migrate){const t=s.migrate(e.state,e.version);return t instanceof Promise?t.then(e=>[!0,e]):[!0,t]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}return[!1,void 0]}).then(e=>{var t;if(o!==l)return;const[a,c]=e;return S=s.merge(c,null!=(t=r())?t:b),n(S,!0),a?p():void 0}).then(()=>{o===l&&(null==f||f(r(),void 0),S=r(),a=!0,u.forEach(e=>e(S)))}).catch(e=>{o===l&&(null==f||f(void 0,e))})};return o.persist={setOptions:e=>{s={...s,...e},e.storage&&(v=e.storage)},clearStorage:()=>{++l,null==v||v.removeItem(s.name)},getOptions:()=>s,rehydrate:()=>O(),hasHydrated:()=>a,onHydrate:e=>(c.add(e),()=>{c.delete(e)}),onFinishHydration:e=>(u.add(e),()=>{u.delete(e)})},s.skipHydration||O(),S||b};function S(e,t="undefined"==typeof window){return(n,r,o)=>{if(!t)return e(n,r,o);const s=()=>{throw new Error("Cannot set state of Zustand store in SSR")};return o.setState=s,e(s,r,o)}}},1117,[]); +__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useKitchenExtra",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"isManagerish",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"isHeadChef",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"isKitchenStaff",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"kitchenByRule",{enumerable:!0,get:function(){return l}}),_e.inKitchen=b,_e.inChannel=function(e,t){return!!t&&(e.startsWith('dm:')?e.split(':').slice(1).includes(t.id):'all'===e||('kitchen'===e?b(t):'managers'===e?o(t):'foh'===e&&(o(t)||/front|bar|server|waiting/i.test(t.job))))},Object.defineProperty(_e,"dmId",{enumerable:!0,get:function(){return h}});var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},c=r(d[1]),a=r(d[2]);const u=(0,c.create)()((0,a.persist)(e=>({extra:{},set:(t,n)=>e(e=>{const c={...e.extra};return null==n?delete c[t]:c[t]=n,{extra:c}})}),{name:'covercharge-kitchen-chat-v1',version:1,storage:(0,a.createJSONStorage)(()=>n.default)})),o=e=>!!e&&'staff'!==e.role,s=e=>!!e&&/head chef/i.test((e.level??'')+' '+e.job),f=e=>!!e&&(/^kitchen$/i.test(e.dept??'')||/chef|kitchen|\bkp\b|porter/i.test(e.job)),l=e=>!!e&&(o(e)||s(e)||f(e));function b(e){if(!e||!e.active)return!1;return u.getState().extra[e.id]??l(e)}const h=(e,t)=>`dm:${[e,t].sort().join(':')}`},1118,[1116,952,1117]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.setLiveData=c,e.requireRealData=function(){t=!0,c(!0)},Object.defineProperty(e,"liveData",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"examplesAllowed",{enumerable:!0,get:function(){return l}}),e.onDataModeChange=function(n){return s.add(n),()=>{s.delete(n)}},Object.defineProperty(e,"EXAMPLE_LABEL",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"notEnoughTip",{enumerable:!0,get:function(){return b}});const n=['anchorage','souters','kirkmichael','wildings','kirkton','abbotsford','greenside',"3idiots","cecchinis","mrbasrais","yasmins","williewastles","rupeeroom","smokinggoat","pizzaioli","drunkencoo"].includes("wildings");let t=n,o=n;const s=new Set;function c(n){o!==(n=t||n)&&(o=n,s.forEach(n=>n()))}const u=()=>o,l=()=>!o;const f='Example figures',b=n=>`Forecasts start once CoverCharge has ${1===n?'1 week':`${n} weeks`} of your bookings and cash-ups.`},1119,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useAsyncStorage",{enumerable:!0,get:function(){return n.useAsyncStorage}}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return o}});var e,t=r(d[0]),u=(e=t)&&e.__esModule?e:{default:e},n=r(d[1]),o=u.default},1120,[1121,1125]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return i}});var e,t=r(d[0]);const o=((e=t)&&e.__esModule?e:{default:e}).default.bind({concatArrays:!0,ignoreUndefined:!0});function n(e,t){const n=window.localStorage.getItem(e);if(n){const l=JSON.parse(n),c=JSON.parse(t),s=JSON.stringify(o(l,c));window.localStorage.setItem(e,s)}else window.localStorage.setItem(e,t)}function l(e,t){return new Promise((o,n)=>{try{const n=e();t?.(null,n),o(n)}catch(e){t?.(e),n(e)}})}function c(e,t,o){return Promise.all(e).then(e=>{const n=o?.(e)??null;return t?.(null,n),Promise.resolve(n)},e=>(t?.(e),Promise.reject(e)))}const s={getItem:(e,t)=>l(()=>window.localStorage.getItem(e),t),setItem:(e,t,o)=>l(()=>window.localStorage.setItem(e,t),o),removeItem:(e,t)=>l(()=>window.localStorage.removeItem(e),t),mergeItem:(e,t,o)=>l(()=>n(e,t),o),clear:e=>l(()=>window.localStorage.clear(),e),getAllKeys:e=>l(()=>{const e=window.localStorage.length,t=[];for(let o=0;o{},multiGet:(e,t)=>c(e.map(e=>s.getItem(e)),t,t=>t.map((t,o)=>[e[o],t])),multiSet:(e,t)=>c(e.map(e=>s.setItem(e[0],e[1])),t),multiRemove:(e,t)=>c(e.map(e=>s.removeItem(e)),t),multiMerge:(e,t)=>c(e.map(e=>s.mergeItem(e[0],e[1])),t)};var i=s},1121,[1122]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u}});var e,t=r(d[0]),u=((e=t)&&e.__esModule?e:{default:e}).default},1122,[1123]); +__d(function(g,r,i,a,m,e,d){'use strict';const t=r(d[0]),{hasOwnProperty:n}=Object.prototype,{propertyIsEnumerable:o}=Object,c=(t,n,o)=>Object.defineProperty(t,n,{value:o,writable:!0,enumerable:!0,configurable:!0}),s=this,f={concatArrays:!1,ignoreUndefined:!1},l=t=>{const c=[];for(const o in t)n.call(t,o)&&c.push(o);if(Object.getOwnPropertySymbols){const n=Object.getOwnPropertySymbols(t);for(const s of n)o.call(t,s)&&c.push(s)}return c};function u(n){return Array.isArray(n)?y(n):t(n)?p(n):n}function y(t){const n=t.slice(0,0);return l(t).forEach(o=>{c(n,o,u(t[o]))}),n}function p(t){const n=null===Object.getPrototypeOf(t)?Object.create(null):{};return l(t).forEach(o=>{c(n,o,u(t[o]))}),n}const b=(t,n,o,s)=>(o.forEach(o=>{void 0===n[o]&&s.ignoreUndefined||(o in t&&t[o]!==Object.getPrototypeOf(t)?c(t,o,h(t[o],n[o],s)):c(t,o,u(n[o])))}),t),O=(t,o,s)=>{let f=t.slice(0,0),y=0;return[t,o].forEach(o=>{const p=[];for(let s=0;s!p.includes(t)),s)}),f};function h(n,o,c){return c.concatArrays&&Array.isArray(n)&&Array.isArray(o)?O(n,o,c):t(o)&&t(n)?b(n,o,l(o),c):u(o)}m.exports=function(...n){const o=h(u(f),this!==s&&this||{},f);let c={_:{}};for(const s of n)if(void 0!==s){if(!t(s))throw new TypeError('`'+s+'` is not an Option Object');c=h(c,{_:s},o)}return c._}},1123,[1124]); +__d(function(g,r,i,a,m,e,d){'use strict';m.exports=t=>{if('[object Object]'!==Object.prototype.toString.call(t))return!1;const o=Object.getPrototypeOf(t);return null===o||o===Object.prototype}},1124,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.useAsyncStorage=function(e){return{getItem:(...t)=>u.default.getItem(e,...t),setItem:(...t)=>u.default.setItem(e,...t),mergeItem:(...t)=>u.default.mergeItem(e,...t),removeItem:(...t)=>u.default.removeItem(e,...t)}};var e,t=r(d[0]),u=(e=t)&&e.__esModule?e:{default:e}},1125,[1121]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"createStore",{enumerable:!0,get:function(){return n}});const t=t=>{let n;const c=new Set,o=(t,o)=>{const s="function"==typeof t?t(n):t;if(!Object.is(s,n)){const t=n;n=(null!=o?o:"object"!=typeof s||null===s)?s:Object.assign({},n,s),c.forEach(c=>c(n,t))}},s=()=>n,u={setState:o,getState:s,getInitialState:()=>l,subscribe:t=>(c.add(t),()=>c.delete(t))},l=n=t(o,s,u);return u},n=n=>n?t(n):t},1126,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"create",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"useStore",{enumerable:!0,get:function(){return o}});var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},u=r(d[1]);const c=e=>e;function o(e,t=c){const u=n.default.useSyncExternalStore(e.subscribe,n.default.useCallback(()=>t(e.getState()),[e,t]),()=>t(e.getInitialState()));return n.default.useDebugValue(u),u}const s=e=>{const t=(0,u.createStore)(e),n=e=>o(t,e);return Object.assign(n,t),n},l=e=>e?s(e):s},1127,[30,1126]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"WILDINGS_LOCATION",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"WILDINGS_ADDRESS",{enumerable:!0,get:function(){return t}}),e.withWildingsAddress=function(r){return'wildings'===r.id?{...r,location:n,address:t}:r},e.withWildingsQuestionnaireAddress=function(n,r){return'wildings'===n&&r?{...r,venue:{...r.venue,address:t}}:r};const n='Maidens, KA26 9NR',t='Maidens Road, Maidens, KA26 9NR'},1128,[]); +__d(function(g,r,_i,_a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.sampleFingerprint=i,e.stripOwnerLiveSamples=function(n){const a={};for(const[s,o]of Object.entries(t.OWNER_SAMPLE_HASHES)){const t=n[s]||[];a[s]=t.filter(t=>!o.includes(i(t)))}a.chat=(n.chat||[]).filter(t=>!(0,s.isSeedChefChat)(t));const o=(n.changeRequests||[]).length-a.changeRequests.length;o&&(a.changesUsed=Math.max(0,(n.changesUsed||0)-o));return a},e.stripCoreLiveSamples=function(a){const c={...(0,n.stripCoreChefSamples)(a)};c.giftCards=(a.giftCards||[]).filter(s=>!t.CORE_SAMPLE_HASHES.giftCards.includes(i(s))),c.stampCards=(a.stampCards||[]).filter(s=>!t.CORE_SAMPLE_HASHES.stampCards.includes(i(s))),c.ratings=(a.ratings||[]).filter(t=>!(/^rt-[123]$/.test(t.id)&&(0,s.demoActor)(t.customerName))),i(a.customer)===t.LEGACY_CUSTOMER_HASH&&(c.customer={...a.customer,id:'',name:'',email:'',phone:'',allergies:[],allergyConsent:!1,referralCode:'',marketingOptIn:{}});return c.restaurants=(a.restaurants||[]).filter(t=>!('saltmarsh'===t.id&&['The Venue','Saltmarsh Bistro'].includes(t.name))),c.menu=(c.menu||a.menu||[]).filter(t=>'saltmarsh'!==t.restaurantId).map(t=>t.signOff?t:o(t)),c};var t=r(d[0]),s=r(d[1]),n=r(d[2]);const a=t=>Array.isArray(t)?t.map(a):t&&'object'==typeof t?Object.fromEntries(Object.entries(t).filter(([,t])=>void 0!==t&&'function'!=typeof t).sort(([t],[s])=>ts?1:0).map(([t,s])=>[t,a(s)])):t;function i(t){const s=JSON.stringify(a(t))??"null";let n=2166136261;for(let t=0;t>>0).toString(16)}const o=t=>Array.isArray(t)?t.map(o):t&&'object'==typeof t?Object.fromEntries(Object.entries(t).map(([t,s])=>[t,'allergenNotes'===t&&'string'==typeof s&&/\(example\)/i.test(s)?'':o(s)])):t},1129,[1130,1024,1131]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"OWNER_SAMPLE_HASHES",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"CORE_SAMPLE_HASHES",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"LEGACY_CUSTOMER_HASH",{enumerable:!0,get:function(){return b}});const c={referrals:["43f09bc0","c438fbad","96bf8c62","3399d421"],coats:["f51097ad","2f7efa3a"],merch:["ef6e14e","dbbc0999","dc233c1d"],merchOrders:["13b15512","bc27f242"],offers:["ad0fcde0","59e6c0cf"],photos:["53a60fd9","ab778a74","95de43cd"],changeRequests:["81c5be12","6819542c"],lost:["5bbf0d77","7d3aa9ed","850c049e"],campaigns:["9cdf8346","82150e7"],suppliers:["41df06e7","466e32ac","fa3d8eea","dfafa674","1e26fbd0","c195b120","5fc49e74","6aa8b0af","602fc2e4"],supplierOrders:["22636226","464d6a6a"]},f={giftCards:["b1bba36d","f029bc0e"],stampCards:["e7bedf6f","a3c8404d"]},b="4b1e9971"},1130,[]); +__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.stripCoreChefSamples=function(n){return{bookings:(n.bookings||[]).filter(n=>!((0,e.isAnchorage)(n.restaurantId)&&t[n.id]===n.name)),orders:(n.orders||[]).filter(t=>!((0,e.isAnchorage)(t.restaurantId)&&('ord-seed-1'===t.id&&'R. Gilmour'===t.customerName||'ord-seed-2'===t.id&&'Table 3 guest'===t.customerName))),waitlist:(n.waitlist||[]).filter(t=>!((0,e.isAnchorage)(t.restaurantId)&&('wl-1'===t.id&&'Paterson'===t.name||'wl-2'===t.id&&'Duncan'===t.name))),menu:(n.menu||[]).map(t=>(0,e.isAnchorage)(t.restaurantId)&&(0,e.demoActor)(t.signOff?.by)?{...t,signOff:null}:t),events:(n.events||[]).filter(e=>!(e.example&&('anchorage'===e.restaurantId||null===e.restaurantId))),audit:(n.audit||[]).filter(e=>!('anchorage'===e.restaurantId&&/Example sign-off \(demo\)/i.test(e.text)))}};var e=r(d[0]);const t={'bk-101':'Campbell','bk-102':'Fraser','bk-103':'McLeod','bk-104':'Kerr','bk-105':'Wallace','bk-106':'Boyd','bk-107':'Hamilton','bk-108':'Stewart','bk-109':'Murray'}},1131,[1024]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.archiveChefCache=async function(e,t){const n=JSON.stringify(t);let o=2166136261;for(let e=0;e>>0).toString(16)}`;const c=await i.default.getItem(s);if(c){if(JSON.stringify(JSON.parse(c).rows)===n)return;s+=`:${Date.now()}`}await i.default.setItem(s,JSON.stringify({at:(new Date).toISOString(),store:e,rows:t}))};var e,t=r(d[0]),i=(e=t)&&e.__esModule?e:{default:e}},1132,[1116]); +__d(function(g,_r,_i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEMO_CUSTOMER_ID",{enumerable:!0,get:function(){return c}}),_e.defaultSimStart=function(e=new Date){const t=new Date(e),r=(5-t.getDay()+7)%7;return t.setDate(t.getDate()+r),t.setHours(17,30,0,0),t},_e.buildSeed=function(d){if(r.LIVE_VENUE_BUILD&&!t.IS_ISOLATED_VENUE){const e=u(d);return{...e,restaurants:e.restaurants.filter(e=>'anchorage'===e.id),menu:o.anchorageMenu.map(e=>({...e,signOff:null})),bookings:[],waitlist:[],orders:[],stampCards:[],giftCards:[],events:e.events.filter(e=>!e.example),ratings:[],walkIns:{},counters:{order:0,table:0,booking:0},customer:{...e.customer,id:'',referralCode:'',name:'',email:'',phone:'',allergies:[],allergyConsent:!1,marketingOptIn:{}}}}return t.IS_ISOLATED_VENUE?{restaurants:[t.IS_QUEUED_VENUE?(0,e.queuedRestaurant)(t.VENUE_RID):t.IS_ABBOTSFORD?n.ABBOTSFORD_RESTAURANT:t.IS_KIRKTON?n.KIRKTON_RESTAURANT:t.IS_GREENSIDE?n.GREENSIDE_RESTAURANT:t.IS_WILDINGS?n.WILDINGS_RESTAURANT:t.IS_KIRKMICHAEL?n.KIRKMICHAEL_RESTAURANT:s.SOUTERS_RESTAURANT],menu:t.IS_SOUTERS?i.SOUTERS_MENU:[],customer:{id:'',name:'',email:'',phone:'',allergies:[],allergyConsent:!1,referralCode:'',marketingOptIn:{}},bookings:[],waitlist:[],orders:[],stampCards:[],giftCards:[],events:[],ratings:[],audit:[],alertAcks:{},walkIns:{},basket:{restaurantId:null,mode:'takeaway',lines:[]},counters:{order:0,table:0,booking:0}}:u(d)};var e=_r(_d[0]),t=_r(_d[1]),r=_r(_d[2]),n=_r(_d[3]),s=_r(_d[4]),i=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),l=_r(_d[8]);const c='cust-demo';function u(e){const t=(0,l.ymd)(e),r=e=>e.toISOString(),s=n.restaurants.map(e=>'anchorage'===e.id?{...e,sections:o.ANCHORAGE_SECTIONS}:e),i={id:c,name:'Alex Morgan',email:'alex.demo@example.com',phone:'07700 900123',allergies:[{allergen:'crustaceans',severity:'anaphylaxis'},{allergen:'mustard',severity:'allergy'}],allergyConsent:!0,referralCode:'ALEX-7K2Q',marketingOptIn:{anchorage:!0}},u=(n,s,i,o,d={})=>({id:n,ref:`BK-${n.slice(-3).toUpperCase()}`,restaurantId:'anchorage',customerId:null,name:s,partySize:i,date:t,time:o,allergies:[],notes:'',status:'confirmed',security:i>=6?'deposit':'none',depositPaid:0,...i>=6?{depositDue:1e3*i}:{},createdAt:r((0,l.addMins)(e,-4320)),...d}),m=[u('bk-101','Campbell',2,'17:00',{table:'12',status:'seated',seatedAt:r((0,l.addMins)(e,-28)),tags:['Regular']}),u('bk-102','Fraser',4,'17:30',{table:'10',tags:['VIP']}),u('bk-103','McLeod',2,'18:00',{table:'11',allergies:[{allergen:'gluten',severity:'coeliac'}],notes:'Anniversary',occasion:'anniversary'}),u('bk-104','Kerr',6,'18:00',{table:'18'}),u('bk-105','Wallace',3,'18:30',{table:'13'}),u('bk-106','Boyd',8,'19:00',{table:'1+2',dog:!0,allergies:[{allergen:'peanuts',severity:'anaphylaxis'}],notes:'Birthday \u2014 bringing a dog',occasion:'birthday'}),u('bk-107','Hamilton',2,'19:00',{table:'5'}),u('bk-108','Stewart',4,'19:30',{table:'19',tags:['Regular']}),u('bk-109','Murray',2,'20:00',{table:'16'})],p=[{id:'wl-1',restaurantId:'anchorage',number:1,name:'Paterson',partySize:2,joinedAt:r((0,l.addMins)(e,-12)),status:'waiting'},{id:'wl-2',restaurantId:'anchorage',number:2,name:'Duncan',partySize:4,joinedAt:r((0,l.addMins)(e,-4)),status:'waiting'}],h=(0,l.atTime)(e,'17:45'),I=[{id:'ord-seed-1',ref:'T-1041',restaurantId:'anchorage',customerId:'cust-other',customerName:'R. Gilmour',type:'takeaway',slotTime:r(h),lines:[{itemId:'a-fishsupper',name:'Fish Supper',qty:2,unitPrice:1800,choices:['Beer-battered'],notes:'',contains:[],may:[],overridden:!1,prepMins:12},{itemId:'a-chips',name:'Triple-Cooked Chips (V)',qty:1,unitPrice:450,choices:[],notes:'Extra salt',contains:[],may:[],overridden:!1,prepMins:6}],subtotal:4050,tip:0,giftCardApplied:0,total:4050,paid:4050,status:'acknowledged',createdAt:r((0,l.addMins)(e,-50)),allergies:[],readiness:{}},{id:'ord-seed-2',ref:'Q-2017',restaurantId:'anchorage',customerId:'cust-other2',customerName:'Table 3 guest',type:'table',tableNo:'3',lines:[{itemId:'a-moules',name:'Moules Marini\xe8re',qty:1,unitPrice:2200,choices:['Main 500g with triple-cooked chips (\xa322.00)'],notes:'',contains:[],may:[],overridden:!1,prepMins:10},{itemId:'a-claymore',name:'The Claymore Burger',qty:1,unitPrice:1800,choices:[],notes:'No gherkins',contains:[],may:[],overridden:!1,prepMins:14}],subtotal:4e3,tip:0,giftCardApplied:0,total:4e3,paid:0,status:'preparing',createdAt:r((0,l.addMins)(e,-18)),allergies:[],readiness:{}}],y=[{restaurantId:'anchorage',customerId:c,stamps:5,rewardsAvailable:0,history:[{at:'2026-08-15',source:'Dine-in (staff scan)'},{at:'2026-08-29',source:'Takeaway'},{at:'2026-09-12',source:'Table QR bill'},{at:'2026-10-02',source:'Takeaway'},{at:'2026-10-16',source:'Referral \u2014 friend\u2019s first visit'}]},{restaurantId:'saltmarsh',customerId:c,stamps:2,rewardsAvailable:0,history:[{at:'2026-09-01',source:'Dine-in'},{at:'2026-10-01',source:'Dine-in'}]}],b=[{id:'gc-1',code:'ANC-G7QX-4M2P-9TRE',restaurantId:'anchorage',initial:5e3,balance:2500,ownerId:c,recipientName:'Alex',message:'Happy birthday! (example)',createdAt:'2026-09-20'},{id:'gc-2',code:'WEB-OLD-10-EXAMPLE',restaurantId:'anchorage',initial:1e3,balance:1e3,ownerId:'legacy',recipientName:'Legacy website bookings voucher (example)',message:'',createdAt:'2026-06-01',legacy:!0}],k=[...d.SCOTTISH_BANK_HOLIDAYS.map((e,t)=>({id:`bh-${t}`,restaurantId:null,date:e.date,title:e.title+(e.notes&&!/substitute/i.test(e.notes)?` (${e.notes.toLowerCase()})`:''),kind:'bank-holiday',description:'Scottish bank holiday',example:!1,source:d.BANK_HOLIDAY_SOURCE})),{id:'ev-halloween',restaurantId:'anchorage',date:(0,l.ymd)(new Date(e.getFullYear(),9,31)),title:'Halloween weekend (example)',kind:'event',description:'Example event \u2014 busy weekend flag for the forecast.',example:!0},{id:'ev-xmas-party',restaurantId:'anchorage',date:'2026-12-04',title:'Christmas party nights begin (example)',kind:'event',description:'Example: festive set menu, deposit required for parties of 8+.',example:!0},{id:'ev-hogmanay',restaurantId:null,date:'2026-12-31',title:'Hogmanay',kind:'occasion',description:'Key dining date.',example:!1},{id:'ev-burns',restaurantId:'anchorage',date:'2027-01-25',title:'Burns Night Supper (example)',kind:'event',description:'EXAMPLE event: haggis, neeps & tatties, address to the haggis, set menu \xa348pp. Booking opens via the app.',example:!0},{id:'ev-valentines',restaurantId:null,date:'2027-02-14',title:"Valentine's Day",kind:'occasion',description:'Key dining date.',example:!1},{id:'ev-mothering',restaurantId:null,date:'2027-03-07',title:'Mothering Sunday (UK)',kind:'occasion',description:'Key dining date.',example:!1},{id:'ev-live',restaurantId:'anchorage',date:'2026-11-14',title:'Live acoustic music (example)',kind:'event',description:'EXAMPLE: local folk duo from 7pm.',example:!0},{id:'ev-school-xmas',restaurantId:null,date:'2026-12-23',title:'South Ayrshire schools close for Christmas',kind:'school-holiday',description:'23 Dec 2026 \u2013 4 Jan 2027',example:!1},{id:'ev-salt-quiz',restaurantId:'saltmarsh',date:'2026-11-05',title:'Quiz night (fictional)',kind:'event',description:'Fictional demo restaurant event.',example:!0}];return{restaurants:s,menu:[...o.anchorageMenu,...n.demoMenus],customer:i,bookings:m,waitlist:p,orders:I,stampCards:y,giftCards:b,events:k,ratings:[{id:'rt-1',restaurantId:'anchorage',customerId:'cust-x1',customerName:'Fiona (example)',stars:5,comment:'Best fish supper on the coast, and the staff were brilliant with my son\u2019s nut allergy.',createdAt:r((0,l.addMins)(e,-1560)),context:'Takeaway T-1032'},{id:'rt-2',restaurantId:'anchorage',customerId:'cust-x2',customerName:'Iain (example)',stars:4,comment:'Lovely langoustines. Bit of a wait for a table at 7.',createdAt:r((0,l.addMins)(e,-3e3)),context:'Dine-in, Table 6'},{id:'rt-3',restaurantId:'anchorage',customerId:'cust-x3',customerName:'Morag (example)',stars:2,comment:'Chips were cold by the time we collected.',createdAt:r((0,l.addMins)(e,-4320)),context:'Takeaway T-1019'}],audit:[],alertAcks:{},walkIns:{anchorage:6},basket:{restaurantId:null,mode:'takeaway',lines:[]},counters:{order:1042,table:2018,booking:110}}}},1133,[6,5,833,3,1134,1135,1136,1137,818]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SOUTERS_RESTAURANT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"SOUTERS_BOOKING_URL",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"SOUTERS_CONTACTS",{enumerable:!0,get:function(){return n}});const t={id:'souters',name:"Souter's Inn",tagline:'Culinary excellence meets country hospitality in Kirkoswald',location:'Kirkoswald, South Ayrshire',address:'47 Main Road, Kirkoswald, South Ayrshire KA19 8HY',phone:'01655 760653',website:'https://www.soutersinn.com/',fictional:!1,kitchenHours:{0:['09:00','21:00'],1:['09:00','21:00'],2:['09:00','21:00'],3:['09:00','21:00'],4:['09:00','21:00'],5:['09:00','21:00'],6:['09:00','21:00']},hoursNote:'Public hours: daily from 9am; food listed to 9pm. Closing time (9pm or 10pm) to confirm with the venue. Breakfast until 11.45am; main food from noon.',sections:[],settings:{slotMinutes:15,slotCap:3,bufferMins:5,leadMins:20,takeawayPaused:!0,bookingCoversPerSlot:16,stampTarget:8,stampReward:'',stampMinSpend:1e3,capacityPerHour:0,walkInShare:.35,turnMins:75,orderAtTable:!1,showTakeaway:!1,tableRequests:!0,shortName:"Souter's",deposit:{on:!1,perPersonPence:null,fromParty:null,refundable:null,cutoffHours:null,needsConfirmation:!0,wixLinksOn:!1,policy:'Table deposit policy not set. Ticketed event deposits are separate and are not a table policy.'}}},o='',n={email:'souters@southernayr.com',phone:'01655 760653'}},1134,[]); +__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SOUTERS_MENU",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"SOUTERS_MENU_COUNT",{enumerable:!0,get:function(){return t}});const s=[{id:"su-breakfast-full-breakfast",section:"Breakfast",name:"Full Breakfast",description:"Ayrshire Bacon, Link Sausage, Black Pudding, Potato Scone, Beans, Tomato, Mushrooms & Two Eggs (Poached, Scrambled or Fried) with White or Wholemeal Toast",price:1195,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-eggs-benedict",section:"Breakfast",name:"Eggs Benedict",description:"Two Poached Eggs along with Ayrshire Bacon served on Toasted Muffin topped with Hollandaise Sauce",price:1050,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-french-toast",section:"Breakfast",name:"French Toast",description:"Two Slices of Bloomer Eggy Bread with Ayrshire Bacon and a side of Maple Syrup",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-light-breakfast",section:"Breakfast",name:"Light Breakfast",description:"Ayrshire Bacon, Link Sausage, Beans, Tomato and Two Eggs served Poached, Scrambled or Fried with White or Wholemeal Toast",price:950,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-eggs-royale",section:"Breakfast",name:"Eggs Royale",description:"Two Poached Eggs with Flaked Smoked Salmon served on Toasted Muffin topped with Hollandaise Sauce",price:1150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-fried-scottish-pancakes",section:"Breakfast",name:"Fried Scottish Pancakes",description:"Scottish Pancakes with Ayrshire Bacon and a side of Maple Syrup",price:950,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-add-banana-to-fried-scottish-pancakes",section:"Breakfast add-ons",name:"Add Banana (to Fried Scottish Pancakes)",description:"",price:150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-add-two-eggs-poached-fried-or-scrambled-",section:"Breakfast add-ons",name:"Add Two Eggs \u2013 Poached, Fried or Scrambled (to Fried Scottish Pancakes)",description:"",price:200,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-vegetarian-breakfast",section:"Breakfast",name:"Vegetarian Breakfast",description:"Potato Scone, Tomato, Mushrooms, Beans and Two Eggs served Poached, Scrambled or Fried with White or Wholemeal Toast",price:925,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-smashed-avocado-benedict",section:"Breakfast",name:"Smashed Avocado Benedict",description:"Smashed Avocado Guacamole, 2 Poached Eggs served on Toasted Muffin topped with Hollandaise Sauce",price:1095,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-granola-bowl",section:"Breakfast",name:"Granola Bowl",description:"Almond and Raisin Granola topped with Berries, Natural Yoghurt and Honey",price:895,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-breakfast-burrito",section:"Breakfast",name:"Breakfast Burrito",description:"Crispy Bacon, Two Fried Eggs, Jalape\xf1o Salsa, Guacamole, Cheddar Cheese, Salad & Sour Cream",price:1150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-pancake-stack",section:"Breakfast",name:"Pancake Stack",description:"American style pancakes with Biscoff, Nutella, Chocolate Sauce & Fresh Strawberries",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-breakfast-roll",section:"Breakfast",name:"Breakfast Roll",description:"with a choice of Ayrshire Bacon, Pork Link Sausage, Potato Scone or Egg; 2 Items \xa34.75 | 3 Items \xa35.50",price:425,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-kids-breakfast",section:"Junior / Kids",name:"Kids Breakfast",description:"Pork Link Sausage, Beans, Potato Scone, served with a Slice of Toast",price:495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-kids-pancakes",section:"Junior / Kids",name:"Kids Pancakes",description:"American Style Pancakes served with Syrup, Nutella or Butter & Jam",price:495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-add-banana-or-strawberries-to-kids-panca",section:"Junior / Kids add-ons",name:"Add Banana or Strawberries (to Kids Pancakes)",description:"",price:150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-black-pudding-add-on",section:"Add-ons",name:"Black Pudding (add-on)",description:"",price:150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-beans-add-on",section:"Add-ons",name:"Beans (add-on)",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-smashed-avocado-add-on",section:"Add-ons",name:"Smashed Avocado (add-on)",description:"",price:200,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-pork-link-sausage-add-on",section:"Add-ons",name:"Pork Link Sausage (add-on)",description:"",price:150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-mushrooms-add-on",section:"Add-ons",name:"Mushrooms (add-on)",description:"",price:150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-tomato-add-on",section:"Add-ons",name:"Tomato (add-on)",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-ayrshire-bacon-2-add-on",section:"Add-ons",name:"Ayrshire Bacon (2) (add-on)",description:"",price:150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-haggis-add-on",section:"Add-ons",name:"Haggis (add-on)",description:"",price:150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-egg-add-on",section:"Add-ons",name:"Egg (add-on)",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-potato-scone-add-on",section:"Add-ons",name:"Potato Scone (add-on)",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-bucket-of-chips",section:"Add-ons",name:"Bucket of Chips",description:"",price:425,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-toasted-white-or-wholemeal-bread",section:"Add-ons",name:"Toasted White or Wholemeal Bread",description:"served with Butter and Preserve",price:450,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-white-coffee",section:"Coffee",name:"White Coffee",description:"",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-latte",section:"Coffee",name:"Latte",description:"",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-espresso",section:"Coffee",name:"Espresso",description:"",price:325,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-cappuccino",section:"Coffee",name:"Cappuccino",description:"",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-americano",section:"Coffee",name:"Americano",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-double-espresso",section:"Coffee",name:"Double Espresso",description:"",price:395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-macchiato",section:"Coffee",name:"Macchiato",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-flavour-shot-add-on",section:"Coffee add-ons",name:"Flavour Shot (add-on)",description:"",price:75,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-extra-shot-of-coffee-add-on",section:"Coffee add-ons",name:"Extra Shot of Coffee (add-on)",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-breakfast-tea",section:"Tea",name:"Breakfast Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-camomile-tea",section:"Tea",name:"Camomile Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-earl-grey-tea",section:"Tea",name:"Earl Grey Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-green-tea",section:"Tea",name:"Green Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-peppermint-tea",section:"Tea",name:"Peppermint Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-red-berry-tea",section:"Tea",name:"Red Berry Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-lemon-ginger-tea",section:"Tea",name:"Lemon & Ginger Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-hot-chocolate",section:"Hot chocolate",name:"Hot Chocolate",description:"",price:425,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-luxury-hot-chocolate",section:"Hot chocolate",name:"Luxury Hot Chocolate",description:"with Cream & Marshmallows",price:475,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-freshly-baked-basket-of-bread-with-butte",section:"Starters / bread",name:"Freshly Baked Basket Of Bread With Butter",description:"",price:450,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-add-olive-oil-balsamic-vinegar",section:"Starters / bread",name:"Add Olive Oil & Balsamic Vinegar",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-soup-of-the-day",section:"Starters",name:"Soup of The Day",description:"served with Crusty Bread & Butter",price:650,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-a-la-carte-salad-of-poached-pear-blue-cheese",section:"Starters",name:"Salad Of Poached Pear & Blue Cheese",description:"with Candied Walnuts & French Vinaigrette",price:850,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-fresh-water-prawns",section:"Starters",name:"Fresh Water Prawns",description:"coated in Spicy Bang Bang Sauce, topped with Chopped Chilli, Peanuts & Coriander",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-sliced-melon-fresh-fruits",section:"Starters",name:"Sliced Melon & Fresh Fruits",description:"with Coulis & Raspberry Sorbet",price:850,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-chicken-liver-p-t",section:"Starters",name:"Chicken Liver P\xe2t\xe9",description:"with Oatcakes, Plum & Apple Chutney",price:850,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-crispy-salt-pepper-calamari",section:"Starters",name:"Crispy Salt & Pepper Calamari",description:"served with Garlic Mayo & Oriental Dressing",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-steamed-mussels",section:"Starters",name:"Steamed Mussels",description:"with White Wine, Garlic, Shallots & Cream, served with Garlic Bread",price:1150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-creamy-baked-garlic-mushrooms",section:"Starters",name:"Creamy Baked Garlic Mushrooms",description:"with a Cheddar Cheese Gratin",price:895,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-boiled-egg-crispy-bacon-caesar-salad",section:"Starters",name:"Boiled Egg & Crispy Bacon Caesar Salad",description:"with Parmesan & Croutons",price:850,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-grilled-honey-glazed-goat-s-cheese-salad",section:"Starters",name:"Grilled Honey Glazed Goat\u2019s Cheese Salad",description:"with Roquito Peppers & Chilli Jam",price:850,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-sticky-bbq-ribs-in-a-korean-gochujang-sa",section:"Starters",name:"Sticky BBQ Ribs in a Korean Gochujang Sauce",description:"with Onions, Peppers & Sesame Seeds",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-cioppino-fish-soup",section:"Starters",name:"Cioppino Fish Soup",description:"fired up with Fresh Chillies & Smoked Paprika, topped with Croutons & Parmesan",price:1095,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-8oz-fillet-steak",section:"From the grill",name:"8oz Fillet Steak",description:"All served with Tomatoes, Portobello Mushrooms, Onion Rings & your choice of Chips, Boiled or Mashed Potatoes. Includes choice of Peppercorn, Mustard or Red Wine Jus",price:3695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-10oz-sirloin-steak",section:"From the grill",name:"10oz Sirloin Steak",description:"All served with Tomatoes, Portobello Mushrooms, Onion Rings & your choice of Chips, Boiled or Mashed Potatoes. Includes choice of Peppercorn, Mustard or Red Wine Jus",price:3395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-rosemary-garlic-lamb-chops",section:"From the grill",name:"Rosemary & Garlic Lamb Chops",description:"All served with Tomatoes, Portobello Mushrooms, Onion Rings & your choice of Chips, Boiled or Mashed Potatoes. Includes choice of Peppercorn, Mustard or Red Wine Jus",price:2750,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-top-with-breaded-haggis-grill",section:"From the grill add-ons",name:"Top with Breaded Haggis (grill)",description:"",price:250,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-top-with-6-garlic-buttered-prawns-grill",section:"From the grill add-ons",name:"Top with 6 Garlic Buttered Prawns (grill)",description:"",price:750,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-steamed-fillet-of-salmon-with-cheese-gla",section:"Main courses",name:"Steamed Fillet of Salmon with Cheese Glaze",description:"served with Buttered Greens & Creamed Potatoes",price:2150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-breaded-haddock-chips",section:"Main courses",name:"Breaded Haddock & Chips",description:"with Homemade Tartare Sauce & Side Salad",price:1850,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-fish-of-the-day",section:"Main courses",name:"Fish of the Day",description:"Check Chef\u2019s Daily Specials",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,priceNote:"Ask staff",special:!0},{id:"su-a-la-carte-locally-caught-haggis-with-neeps-tatties",section:"Main courses",name:"Locally Caught Haggis with Neeps & Tatties",description:"served with Whisky Peppercorn Sauce & Greentails",price:1795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-breast-of-cajun-spiced-chicken",section:"Main courses",name:"Breast Of Cajun Spiced Chicken",description:"with Capsicums, Rice Pilaf & a Curried Coconut & Mango Chutney Sauce",price:1850,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-chicken-schnitzel",section:"Main courses",name:"Chicken Schnitzel",description:"Pan-Fried in Breadcrumbs, served with Crispy Bacon, Grilled Pineapple & Chips",price:1895,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-beef-steak-butcher-s-sausage-pie",section:"Main courses",name:"Beef Steak & Butcher\u2019s Sausage Pie",description:"with Creamed Potatoes & Buttered Carrots",price:1895,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-madras-spiced-lamb-curry",section:"Main courses",name:"Madras Spiced Lamb Curry",description:"with Chillies, Pineapple & Coriander, served with Aromatic Rice, Spiced Onions & a Poppadom",price:1895,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-pan-fried-lambs-liver",section:"Main courses",name:"Pan-Fried Lambs Liver",description:"with Saut\xe9ed Onions, Smoked Bacon, Grilled Tomato, Creamed Potatoes & Red Wine Gravy",price:1750,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-8oz-cheeseburger",section:"Main courses",name:"8oz Cheeseburger",description:"with Bacon, Peppered Mayo, Pickles & Tomato, served with Coleslaw & Chips",price:1795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-add-haggis-to-cheeseburger",section:"Main courses add-ons",name:"Add Haggis (to Cheeseburger)",description:"",price:250,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-panko-breaded-chicken-burger",section:"Main courses",name:"Panko Breaded Chicken Burger",description:"in a Toasted Brioche Bun, with Curried Slaw, Katsu Sauce & Chips",price:1795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-macaroni-cheese",section:"Main courses",name:"Macaroni Cheese",description:"with Leeks, English Mustard & Matured Cheddar, served with Garlic Bread",price:1795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-add-bacon-to-macaroni-cheese",section:"Main courses add-ons",name:"Add Bacon (to Macaroni Cheese)",description:"",price:150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-penne-pasta-arrabbiata",section:"Main courses",name:"Penne Pasta Arrabbiata",description:"with Peppers, Vine Tomatoes, Chilli & Basil, served with Garlic Bread",price:1795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-melon-prawn-salad",section:"Salads",name:"Melon & Prawn Salad",description:"with Marie Rose Cocktail Dressing; served with a choice of Chips or Boiled Potatoes",price:1795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-ploughman-s-salad",section:"Salads",name:"Ploughman\u2019s Salad",description:"Souter\u2019s Sausage Roll, Matured Cheddar, Pickle, Gammon, Boiled Egg & Crusty Bread; served with a choice of Chips or Boiled Potatoes",price:1695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-cajun-spiced-fillet-of-salmon",section:"Salads",name:"Cajun Spiced Fillet Of Salmon",description:"with Curried Coleslaw, Cashew Nuts & a Chilli, Ginger & Citrus Dressing; served with a choice of Chips or Boiled Potatoes",price:1850,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-garlic-chicken-caesar-salad",section:"Salads",name:"Garlic Chicken Caesar Salad",description:"with Croutons, Parmesan, Baby Gem Lettuce, Boiled Egg & Caesar Dressing; served with a choice of Chips or Boiled Potatoes",price:1795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-prawn-smoked-salmon-sandwich",section:"Sandwiches",name:"Prawn & Smoked Salmon Sandwich",description:"with Rocket & Marie Rose Sauce; served on White or Malted Bread with Kettle Chips, Coleslaw & Side Salad. Available 12 Noon\u20135pm",price:1195,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-tuna-mayonnaise-sandwich",section:"Sandwiches",name:"Tuna Mayonnaise Sandwich",description:"with Red Onion, Cucumber & Gem Lettuce; served on White or Malted Bread with Kettle Chips, Coleslaw & Side Salad. Available 12 Noon\u20135pm",price:1050,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-spicy-bang-bang-chicken-sandwich",section:"Sandwiches",name:"Spicy Bang Bang Chicken Sandwich",description:"with Sriracha Mayonnaise, Peppers & Coriander; served on White or Malted Bread with Kettle Chips, Coleslaw & Side Salad. Available 12 Noon\u20135pm",price:1195,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-basil-pesto-chicken-sandwich",section:"Sandwiches",name:"Basil Pesto Chicken Sandwich",description:"with Tomatoes, Red Onion & Mayonnaise; served on White or Malted Bread with Kettle Chips, Coleslaw & Side Salad. Available 12 Noon\u20135pm",price:1095,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-smoked-ham-matured-cheddar-cheese-sandwi",section:"Sandwiches",name:"Smoked Ham & Matured Cheddar Cheese Sandwich",description:"with Mustard Mayonnaise; served on White or Malted Bread with Kettle Chips, Coleslaw & Side Salad. Available 12 Noon\u20135pm",price:1095,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-egg-mayonnaise-sandwich",section:"Sandwiches",name:"Egg Mayonnaise Sandwich",description:"with Spring Onion & Chives; served on White or Malted Bread with Kettle Chips, Coleslaw & Side Salad. Available 12 Noon\u20135pm",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-add-a-cup-of-soup-with-any-sandwich",section:"Sandwiches add-ons",name:"Add a Cup of Soup (with any Sandwich)",description:"",price:395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-chips",section:"Sides",name:"Chips",description:"",price:425,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-cajun-chips",section:"Sides",name:"Cajun Chips",description:"",price:495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-creamed-potatoes",section:"Sides",name:"Creamed Potatoes",description:"",price:450,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-onion-rings",section:"Sides",name:"Onion Rings",description:"",price:495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-mac-cheese-side",section:"Sides",name:"Mac & Cheese (side)",description:"",price:595,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-seasonal-mixed-vegetables",section:"Sides",name:"Seasonal Mixed Vegetables",description:"",price:450,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-souter-s-coleslaw",section:"Sides",name:"Souter\u2019s Coleslaw",description:"",price:395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-curried-coleslaw",section:"Sides",name:"Curried Coleslaw",description:"",price:395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-souter-s-side-salad",section:"Sides",name:"Souter\u2019s Side Salad",description:"",price:425,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-garlic-bread",section:"Sides",name:"Garlic Bread",description:"",price:395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-garlic-bread-with-cheese",section:"Sides",name:"Garlic Bread with Cheese",description:"",price:450,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-fresh-fruit-salad-sorbet",section:"Starters",name:"Fresh Fruit Salad & Sorbet",description:"",price:300,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-soup-of-the-day",section:"Starters",name:"Soup of the Day",description:"",price:300,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-kids-garlic-bread-with-or-without-cheese",section:"Starters",name:"Garlic Bread (with or without Cheese)",description:"",price:300,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-macaroni-cheese",section:"Main courses",name:"Macaroni Cheese",description:"All main dishes served with carrots, peas and a choice of chips or mash",price:695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-breaded-goujons-of-chicken",section:"Main courses",name:"Breaded Goujons of Chicken",description:"All main dishes served with carrots, peas and a choice of chips or mash",price:695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-mini-breaded-fish",section:"Main courses",name:"Mini Breaded Fish",description:"All main dishes served with carrots, peas and a choice of chips or mash",price:695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-roast-chicken-salad",section:"Main courses",name:"Roast Chicken Salad",description:"All main dishes served with carrots, peas and a choice of chips or mash",price:695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-grilled-sausages-or-chicken-with-gravy",section:"Main courses",name:"Grilled Sausages or Chicken with Gravy",description:"All main dishes served with carrots, peas and a choice of chips or mash",price:695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-sticky-toffee-pudding",section:"Sweet treats",name:"Sticky Toffee Pudding",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-cone-from-the-counter",section:"Sweet treats",name:"Cone from the Counter",description:"",price:185,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-kids-ice-cream-sundae",section:"Sweet treats",name:"Kids Ice Cream Sundae",description:"Two scoops, Sprinkles, Flakes, along with a choice of Sauce \u2013 Chocolate / Strawberry",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-kids-juice-apple-orange-pineapple",section:"Drinks",name:"Juice \u2013 Apple / Orange / Pineapple",description:"",price:185,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-simply-fruit-shoot-orange-blackcurrant",section:"Drinks",name:"Simply Fruit Shoot \u2013 Orange / Blackcurrant",description:"",price:200,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-diluting-juice-orange-blackcurrant",section:"Drinks",name:"Diluting Juice \u2013 Orange / Blackcurrant",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-milk",section:"Drinks",name:"Milk",description:"",price:175,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-coke-diet-coke-lemonade",section:"Drinks",name:"Coke / Diet Coke / Lemonade",description:"",price:200,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-kids-milk-shake-chocolate-strawberry",section:"Drinks",name:"Kids Milk Shake \u2013 Chocolate / Strawberry",description:"",price:250,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-souter-s-sticky-toffee-pudding",section:"Dessert",name:"Souter\u2019s Sticky Toffee Pudding",description:"with Butterscotch Sauce & Vanilla Ice Cream",price:795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-cherry-almond-tart",section:"Dessert",name:"Cherry & Almond Tart",description:"with Cr\xe8me Anglaise & Wild Cherry Ripple Ice Cream",price:795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-individual-banoffee-pie",section:"Dessert",name:"Individual Banoffee Pie",description:"topped with Chocolate Shavings, served with Salted Caramel Sauce & Banana Ice Cream",price:795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-souter-s-cheesecake-of-the-day",section:"Dessert",name:"Souter\u2019s Cheesecake of the Day",description:"Please ask your Server for Today\u2019s Choice",price:795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-desserts-warm-chocolate-fudge-cake",section:"Dessert",name:"Warm Chocolate Fudge Cake",description:"with Fresh Berries & Honeycomb Ice Cream",price:795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-lemon-meringue-pie",section:"Dessert",name:"Lemon Meringue Pie",description:"with Raspberries & Raspberry Ripple Ice Cream",price:795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-fresh-fruit-salad",section:"Dessert",name:"Fresh Fruit Salad",description:"with Citrus Syrup served with Pouring Cream, Ice Cream or Sorbet",price:700,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-cheeseboard",section:"Dessert",name:"Cheeseboard",description:"A Selection of British & Continental Cheeses with Grapes, Fruit Chutney & Biscuits",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-affogato",section:"Dessert",name:"Affogato",description:"Vanilla Ice Cream with a Shot of Espresso",price:650,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-ice-cream-one-scoop",section:"Ice cream",name:"Ice Cream \u2013 One Scoop",description:"Please ask your Server for Today\u2019s Flavours",price:395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-desserts-ice-cream-two-scoops",section:"Ice cream",name:"Ice Cream \u2013 Two Scoops",description:"Please ask your Server for Today\u2019s Flavours",price:495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-desserts-ice-cream-three-scoops",section:"Ice cream",name:"Ice Cream \u2013 Three Scoops",description:"Please ask your Server for Today\u2019s Flavours",price:595,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-desserts-strawberry-snowball-delight",section:"Sundaes",name:"Strawberry Snowball Delight",description:"Vanilla & Strawberry Ice cream, Crushed Meringue, Fresh Strawberries, Strawberry Sauce, topped with a Snowball & a Wafer",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-biscoff-sundae",section:"Sundaes",name:"Biscoff Sundae",description:"Biscoff & Toffee Fudge Ice Cream, Whipped Cream, Crushed Lotus Biscoff Biscuits, Biscoff Topping Sauce & a Wafer",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-kinder-bueno-sundae",section:"Sundaes",name:"Kinder Bueno Sundae",description:"Kinder Bueno & Chocolate Ice Cream, Whipped Cream, Kinder Bueno Pieces, Chocolate Sauce & a Wafer",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-white-coffee",section:"Coffee",name:"White Coffee",description:"",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-latte",section:"Coffee",name:"Latte",description:"",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-cappuccino",section:"Coffee",name:"Cappuccino",description:"",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-macchiato",section:"Coffee",name:"Macchiato",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-americano",section:"Coffee",name:"Americano",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-espresso",section:"Coffee",name:"Espresso",description:"",price:325,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-double-espresso",section:"Coffee",name:"Double Espresso",description:"",price:395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-flavour-shot-add-on",section:"Coffee add-ons",name:"Flavour Shot (add-on)",description:"",price:75,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-extra-shot-of-coffee-add-on",section:"Coffee add-ons",name:"Extra Shot of Coffee (add-on)",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-breakfast-tea",section:"Tea",name:"Breakfast Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-camomile-tea",section:"Tea",name:"Camomile Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-earl-grey-tea",section:"Tea",name:"Earl Grey Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-green-tea",section:"Tea",name:"Green Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-peppermint-tea",section:"Tea",name:"Peppermint Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-red-berry-tea",section:"Tea",name:"Red Berry Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-lemon-ginger-tea",section:"Tea",name:"Lemon & Ginger Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-hot-chocolate",section:"Hot chocolate",name:"Hot Chocolate",description:"",price:425,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-luxury-hot-chocolate",section:"Hot chocolate",name:"Luxury Hot Chocolate",description:"with Cream & Marshmallows",price:475,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-chilled-melon-seasonal-fruits",section:"Starters",name:"Chilled Melon & Seasonal Fruits",description:"with Fruit Coulis & Sorbet",price:850,dietary:["V","VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-creamy-garlic-mushrooms",section:"Starters",name:"Creamy Garlic Mushrooms",description:"with Cheddar Cheese & Crusty Bread",price:895,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-mediterranean-tomato-chunky-vegetable-so",section:"Starters",name:"Mediterranean Tomato & Chunky Vegetable Soup",description:"with Crusty Bread",price:650,dietary:["V","VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-honey-glazed-goats-cheese",section:"Starters",name:"Honey Glazed Goats Cheese",description:"with Tomato & Rocket Salad, Basil Pesto & Balsamic Dressing",price:850,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-freshly-baked-basket-of-bread",section:"Starters",name:"Freshly Baked Basket of Bread",description:"with Butter",price:450,dietary:["V","VG"],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-vegetarian-vegan-add-olive-oil-balsamic",section:"Starters",name:"Add Olive Oil & Balsamic",description:"",price:100,dietary:["V","VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-boiled-egg-caesar-salad",section:"Starters",name:"Boiled Egg Caesar Salad",description:"with Croutons, Garlic Dressing & Vegetarian Cheese Shavings",price:795,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-salad-of-poached-pear-candied-walnuts",section:"Starters",name:"Salad of Poached Pear & Candied Walnuts",description:"with French Vinaigrette",price:795,dietary:["V","VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-stuffed-peppers",section:"Main courses",name:"Stuffed Peppers",description:"with Braised Rice, Tomatoes, Basil & Brie, served with a Side Salad & a Bucket of Chips; without Brie is vegan",price:1795,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-vegetable-cashew-nut-stir-fry",section:"Main courses",name:"Vegetable & Cashew Nut Stir Fry",description:"with Hoisin, Ginger & Garlic, served with Aromatic Rice",price:1795,dietary:["V","VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-macaroni-cheese",section:"Main courses",name:"Macaroni Cheese",description:"with Coleman\u2019s Mustard, Leeks & Matured Cheddar, served with Garlic Bread",price:1795,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-pasta-arrabbiata",section:"Main courses",name:"Pasta Arrabbiata",description:"with Peppers, Tomatoes, Chilli & Basil, served with Garlic Bread",price:1795,dietary:["V","VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-creamy-coconut-vegetable-curry",section:"Main courses",name:"Creamy Coconut Vegetable Curry",description:"with Almonds, Cashew Nuts & Coriander, served with Rice, Spiced Onions & a Poppadom",price:1795,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-katsu-vegetable-curry",section:"Main courses",name:"Katsu Vegetable Curry",description:"with Almonds, Cashew Nuts & Coriander, served with Rice, Spiced Onions & a Poppadom",price:1795,dietary:["VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-fresh-fruit-salad",section:"Desserts",name:"Fresh Fruit Salad",description:"with Sorbet",price:700,dietary:["V","VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-sticky-toffee-pudding",section:"Desserts",name:"Sticky Toffee Pudding",description:"with Hot Caramel Sauce & Vanilla Ice Cream",price:795,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-cherry-almond-tart",section:"Desserts",name:"Cherry & Almond Tart",description:"with Wild Cherry Ripple Ice Cream",price:795,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-trillionaire-tart",section:"Desserts",name:"Trillionaire Tart",description:"with Chocolate Pastry, Caramel Toffee & Chocolate Style Ganache, served with Vegan Vanilla Ice Cream",price:795,dietary:["VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-individual-banoffee-pie",section:"Desserts",name:"Individual Banoffee Pie",description:"topped with Chocolate Shavings, served with Salted Caramel Sauce & Banana Ice Cream",price:795,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-warm-chocolate-fudge-cake",section:"Desserts",name:"Warm Chocolate Fudge Cake",description:"with Fresh Berries & Honeycomb Ice Cream",price:795,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-cheeseboard",section:"Desserts",name:"Cheeseboard",description:"served with Oatcakes & Seasonal Chutney",price:995,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-affogato",section:"Desserts",name:"Affogato",description:"1 Scoop of Plain Ice Cream with a shot of Espresso Coffee",price:650,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-floured-bap-with-ayrshire-bacon",section:"Morning (9am\u201312pm)",name:"Floured Bap with Ayrshire Bacon",description:"Available 9am\u201312pm",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-floured-bap-with-pork-link-sausage",section:"Morning (9am\u201312pm)",name:"Floured Bap with Pork Link Sausage",description:"Available 9am\u201312pm",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-floured-bap-with-poached-scrambled-fried",section:"Morning (9am\u201312pm)",name:"Floured Bap with Poached / Scrambled / Fried Egg",description:"Available 9am\u201312pm",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-extra-item-on-floured-bap",section:"Morning (9am\u201312pm)",name:"Extra Item (on Floured Bap)",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-traybakes",section:"Sweet treats",name:"Traybakes",description:"",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-takeaway-freshly-baked-cakes",section:"Sweet treats",name:"Freshly Baked Cakes",description:"",price:450,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-freshly-baked-plain-fruit-scone",section:"Sweet treats",name:"Freshly Baked Plain / Fruit Scone",description:"",price:175,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-soup-of-the-day",section:"Hot food (12pm\u20139pm)",name:"Soup of the Day",description:"with Crusty Bread; available 12pm\u20139pm",price:450,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-takeaway-breaded-haddock-chips",section:"Hot food (12pm\u20139pm)",name:"Breaded Haddock & Chips",description:"with Tartare Sauce",price:1375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-steak-sausage-pie",section:"Hot food (12pm\u20139pm)",name:"Steak & Sausage Pie",description:"with Chips & Gravy",price:1375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-macaroni-cheese",section:"Hot food (12pm\u20139pm)",name:"Macaroni Cheese",description:"with Leeks, Mustard & Matured Cheddar, served with Chips",price:1375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-8oz-burger",section:"Hot food (12pm\u20139pm)",name:"8oz Burger",description:"with Bacon & Cheese, served with Chips",price:1375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-breaded-katsu-chicken-burger",section:"Hot food (12pm\u20139pm)",name:"Breaded Katsu Chicken Burger",description:"with Curried Slaw, served with Chips",price:1375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-cajun-chicken",section:"Hot food (12pm\u20139pm)",name:"Cajun Chicken",description:"with Rice & Coconut Curry Sauce",price:1375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-breaded-goat-s-cheese",section:"Hot food (12pm\u20139pm)",name:"Breaded Goat\u2019s Cheese",description:"with Tomato Salad, Pesto & Chutney, served with Chips",price:1375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-basil-pesto-chicken-sandwich",section:"Sandwiches (12pm\u20135pm)",name:"Basil Pesto Chicken Sandwich",description:"with Tomatoes, Red Onion & Mayonnaise; sandwiches 12pm\u20135pm",price:695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-spicy-bang-bang-chicken-sandwich",section:"Sandwiches (12pm\u20135pm)",name:"Spicy Bang Bang Chicken Sandwich",description:"with Sriracha Mayonnaise, Peppers & Coriander; sandwiches 12pm\u20135pm",price:695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-smoked-ham-matured-cheddar-cheese-sandwi",section:"Sandwiches (12pm\u20135pm)",name:"Smoked Ham & Matured Cheddar Cheese Sandwich",description:"with Mustard Mayonnaise; sandwiches 12pm\u20135pm",price:695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-tuna-mayonnaise-sandwich",section:"Sandwiches (12pm\u20135pm)",name:"Tuna Mayonnaise Sandwich",description:"with Red Onion, Cucumber & Gem Lettuce; sandwiches 12pm\u20135pm",price:595,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-egg-mayonnaise-sandwich",section:"Sandwiches (12pm\u20135pm)",name:"Egg Mayonnaise Sandwich",description:"with Spring Onion & Chives; sandwiches 12pm\u20135pm",price:595,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-pork-fillet-escalopes",section:"Choose your cut",name:"Pork Fillet Escalopes",description:"All served with Grilled Tomato, Portobello Mushroom & your choice of side & sauce",price:2e3,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-8oz-scotch-beef-fillet",section:"Choose your cut",name:"8oz Scotch Beef Fillet",description:"All served with Grilled Tomato, Portobello Mushroom & your choice of side & sauce",price:3e3,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-8oz-scotch-sirloin",section:"Choose your cut",name:"8oz Scotch Sirloin",description:"All served with Grilled Tomato, Portobello Mushroom & your choice of side & sauce",price:2500,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-10oz-scotch-ribeye",section:"Choose your cut",name:"10oz Scotch Ribeye",description:"All served with Grilled Tomato, Portobello Mushroom & your choice of side & sauce",price:3e3,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-scotch-lamb-chops",section:"Choose your cut",name:"Scotch Lamb Chops",description:"All served with Grilled Tomato, Portobello Mushroom & your choice of side & sauce",price:2500,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-600gm-scotch-t-bone-steak",section:"Choose your cut",name:"600gm Scotch T-Bone Steak",description:"All served with Grilled Tomato, Portobello Mushroom & your choice of side & sauce",price:4500,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-souter-s-mixed-grill",section:"Choose your cut",name:"Souter\u2019s Mixed Grill",description:"4oz Sirloin / Chicken Breast / Lamb Chop / Pork Escalope; served with Grilled Tomato, Portobello Mushroom & your choice of side & sauce",price:3500,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-chunky-chips-included-side-choice",section:"Side (included)",name:"Chunky Chips (included side choice)",description:"Included side choice with cut",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-baby-boiled-potatoes-included-side-choic",section:"Side (included)",name:"Baby Boiled Potatoes (included side choice)",description:"Included side choice with cut",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-mashed-potato-included-side-choice",section:"Side (included)",name:"Mashed Potato (included side choice)",description:"Included side choice with cut",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-red-wine-jus-included-sauce-choice",section:"Sauce (included)",name:"Red Wine Jus (included sauce choice)",description:"Included sauce choice with cut",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-peppercorn-included-sauce-choice",section:"Sauce (included)",name:"Peppercorn (included sauce choice)",description:"Included sauce choice with cut",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-mustard-included-sauce-choice",section:"Sauce (included)",name:"Mustard (included sauce choice)",description:"Included sauce choice with cut",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-onion-rings",section:"Upgrade extras",name:"Onion Rings",description:"",price:495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-garden-salad",section:"Upgrade extras",name:"Garden Salad",description:"",price:425,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-mixed-vegetables",section:"Upgrade extras",name:"Mixed Vegetables",description:"",price:450,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-haggis-cake",section:"Upgrade extras",name:"Haggis Cake",description:"",price:200,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-mac-cheese",section:"Upgrade extras",name:"Mac & Cheese",description:"",price:525,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-garlic-prawns",section:"Upgrade extras",name:"Garlic Prawns",description:"",price:750,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-souter-s-coleslaw",section:"Upgrade extras",name:"Souter\u2019s Coleslaw",description:"",price:395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0}].map(s=>({...s,restaurantId:"souters",soldOut:!1,signOff:null})),t=215},1135,[]); +__d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ANCHORAGE_SECTIONS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"anchorageMenu",{enumerable:!0,get:function(){return o}});const i=i=>({id:i,name:'Served with',required:!0,multi:!1,choices:[{id:`${i}-custard`,label:'Custard',priceDelta:0,allergens:{}},{id:`${i}-icecream`,label:'Ice cream',priceDelta:0,allergens:{}},{id:`${i}-cream`,label:'Cream',priceDelta:0,allergens:{}},{id:`${i}-vegan`,label:'Vegan ice cream (ask server)',priceDelta:0,allergens:{}}]}),s=(i,s,n)=>({id:i,name:'Portion',required:!0,multi:!1,choices:[{id:`${i}-starter`,label:'Starter',priceDelta:0},{id:`${i}-main`,label:n,priceDelta:s}]}),n=[{id:'a-soup',section:'Starters',name:"Chef's Soup of the Day",description:'A heartwarming bowl of seasonal homemade soup, served with warm crusty bread and butter.',price:600,dietary:[],allergens:{},allergenNotes:'Recipe changes daily \u2014 check the day\u2019s soup.',prepMins:0},{id:'a-skink',section:'Starters',name:'Cullen Skink',description:'Traditional creamy soup made with locally smoked haddock, potatoes and leeks, served with warm crusty bread and butter.',price:900,dietary:[],allergens:{},prepMins:0},{id:'a-salmon',section:'Starters',name:'Scottish Smoked Salmon Roulade',description:'Delicate Scottish smoked salmon rolled with herb-infused cream cheese, served with garlic & herb crostini and dressed salad.',price:900,dietary:[],allergens:{},prepMins:0},{id:'a-haggis',section:'Starters',name:'Haggis Bon Bons',description:'Crisp golden panko-fried haggis balls, finished with a velvety Scotch whisky sauce and caramelised apple gel.',price:800,dietary:[],allergens:{},allergenNotes:'',prepMins:0},{id:'a-crabcakes',section:'Starters',name:'Spiced Crab Cakes',description:'Golden crab cakes, delicately seasoned with herbs and spices, served with crisp seasonal salad and house-made Marie Rose sauce.',price:900,dietary:[],allergens:{},allergenNotes:'',prepMins:0},{id:'a-tempura',section:'Starters',name:'Deluxe Mixed Tempura',description:"King prawns, chicken and lion's mane mushrooms in a light, crispy tempura batter, served with a dressed seasonal salad and house dipping sauce.",price:1e3,dietary:[],allergens:{},allergenNotes:'',prepMins:0,optionGroups:[s('tempura',900,'Main with triple-cooked chips (\xa319.00)')]},{id:'a-kingoyster',section:'Starters',name:"Pan-Seared King Oyster Mushroom 'Scallops' (VG)",description:"King oyster mushroom 'scallops' prepared with the chef's special recipe of the day. Ask your server or see our specials board for today's garnish and accompaniments.",price:1e3,dietary:['VG'],allergens:{},allergenNotes:'Garnish changes daily \u2014 sign-off needed for each version.',prepMins:0,special:!0,unsigned:!0,optionGroups:[s('kingoyster',800,'Main (\xa318.00)')]},{id:'a-fishsupper',section:'Mains',name:'Fish Supper',description:'Locally landed haddock, available beer-battered or breaded, served with buttered peas, triple-cooked chips and homemade tartare sauce.',price:1800,dietary:['GF option'],allergens:{},allergenNotes:'',prepMins:0,optionGroups:[{id:'fs-coat',name:'Coating',required:!0,multi:!1,choices:[{id:'fs-batter',label:'Beer-battered',priceDelta:0},{id:'fs-bread',label:'Breaded',priceDelta:0}]}]},{id:'a-lionsmane',section:'Mains',name:"Southern Fried Lion's Mane Burger (VG)",description:"Crispy southern fried lion's mane mushroom, layered with vegan cheese and garlic aioli, served with triple-cooked chips and golden onion rings.",price:1800,dietary:['VG'],allergens:{},prepMins:0},{id:'a-pie',section:'Mains',name:'Steak & Ale Pie',description:'Slow-braised beef in a rich ale jus beneath golden all-butter puff pastry, served with buttered seasonal vegetables.',price:1800,dietary:[],allergens:{},prepMins:0,optionGroups:[{id:'pie-side',name:'Served with',required:!0,multi:!1,choices:[{id:'chips',label:'Triple-cooked chips',priceDelta:0},{id:'creamed',label:'Creamed potatoes',priceDelta:0,allergens:{}}]}]},{id:'a-bananablossom',section:'Mains',name:"Beer-Battered Banana Blossom 'Fish' Goujons (VG)",description:'Crisp beer-battered banana blossom goujons, dusted with locally foraged truffle seaweed seasoning, served with triple-cooked chips, garden peas and vegan tartare sauce.',price:1700,dietary:['VG'],allergens:{},allergenNotes:'',prepMins:0},{id:'a-chicken',section:'Mains',name:'Roasted Breast of Chicken',description:'Golden pan-roasted chicken breast, served with creamed potatoes, buttered seasonal primaryBtns, and a fragrant lemon & thyme bouillon.',price:1900,dietary:[],allergens:{},prepMins:0},{id:'a-maccheese',section:'Mains',name:'Macaroni Cheese (V)',description:'Rich mature Cheddar macaroni finished with a golden cheese glaze, served with two slices of garlic bread.',price:1700,dietary:['V'],allergens:{},prepMins:0},{id:'a-penne',section:'Mains',name:'Cajun Chicken & Chorizo Penne Pasta',description:'Tender Cajun-spiced chicken strips, mixed peppers, red onion and smoky chorizo, tossed in a bold, creamy Cajun sauce, served with two slices of garlic bread.',price:1700,dietary:[],allergens:{},prepMins:0},{id:'a-caesar',section:'Mains',name:'Chicken Caesar Salad',description:'Tender pan-roasted chicken breast served on a bed of baby gem lettuce with golden garlic croutons, Parmesan and a classic Caesar dressing.',price:1800,dietary:[],allergens:{},allergenNotes:'',prepMins:0,optionGroups:[{id:'caesar-add',name:'Optional extras',required:!1,multi:!0,choices:[{id:'caesar-bacon',label:'Add smoked Ayrshire bacon',priceDelta:150}]}]},{id:'a-moules',section:'Mains',name:'Moules Marini\xe8re',description:'Fresh Scottish mussels, steamed to perfection in a rich, creamy white wine and garlic sauce.',price:1200,dietary:[],allergens:{},prepMins:0,optionGroups:[s('moules',1e3,'Main 500g with triple-cooked chips (\xa322.00)')]},{id:'a-fillet',section:'From the Grill',name:'8oz Fillet Steak',description:'Prime 8oz fillet steak served with truffled woodland mushrooms, seasonal primaryBtns, golden onion rings and triple-cooked chips.',price:3800,dietary:[],allergens:{},prepMins:0,optionGroups:[{id:'steak-sauce',name:'Sauce',required:!1,multi:!1,choices:[{id:'sauce-pepper',label:'Peppercorn sauce',priceDelta:0,allergens:{}},{id:'sauce-garlic',label:'Garlic butter',priceDelta:0,allergens:{}}]},{id:'steak-surf',name:'Surf & turf add-on',required:!1,multi:!1,choices:[{id:'surf-prawns',label:'Garlic prawns',priceDelta:800,allergens:{}},{id:'surf-scallops',label:'Scottish West Coast scallops',priceDelta:1e3,allergens:{}}]}]},{id:'a-claymore',section:'From the Grill',name:'The Claymore Burger',description:'One juicy 6oz homemade Scottish beef burger in a brioche bun with baby gem lettuce, tomato and gherkins, topped with cheese, smoked Ayrshire bacon and onion rings. Served with triple-cooked chips.',price:1800,dietary:[],allergens:{},prepMins:0,optionGroups:[{id:'claymore-add',name:'Optional extras',required:!1,multi:!0,choices:[{id:'claymore-haggis',label:'Add haggis and whisky sauce',priceDelta:150,allergens:{}}]}]},{id:'a-langoustines',section:"Captain's Table",name:'Whole Scottish Grilled Langoustines',description:'Locally caught whole Scottish langoustines grilled in garlic butter, served with a vibrant side salad and burnt lemon.',price:1700,dietary:[],allergens:{},prepMins:0,optionGroups:[s('lang',1200,'Main 500g with triple-cooked chips (\xa329.00)')]},{id:'a-scallops',section:"Captain's Table",name:'Pan-Seared West Coast Scallops',description:"Scottish West Coast scallops prepared to the chef's recipe of the day. Starter and main portions \u2014 see price on Specials Board.",price:null,priceNote:'See specials board',dietary:[],allergens:{},prepMins:0,special:!0,unsigned:!0},{id:'a-lobster',section:"Captain's Table",name:'Grilled Dunure Lobster',description:'Fresh Dunure lobster, caught locally by "Kitty Fisher", finished in rich garlic butter and served with a vibrant side salad, triple-cooked chips and burnt lemon. When available.',price:3500,dietary:[],allergens:{},prepMins:0,optionGroups:[{id:'lobster-size',name:'Size',required:!0,multi:!1,choices:[{id:'lob-half',label:'Half',priceDelta:0},{id:'lob-whole',label:'Whole (\xa365.00)',priceDelta:3e3}]}]},{id:'a-crab',section:"Captain's Table",name:'Grilled Dunure Crab',description:'Freshly landed Dunure brown crab, caught locally by "Kitty Fisher", finished in rich garlic butter and served with a vibrant side salad, triple-cooked chips and burnt lemon. When available.',price:4e3,dietary:[],allergens:{},prepMins:0},{id:'a-smorgasbord',section:'Platters',name:'Seafood Smorgasbord (serves one)',description:"250g langoustines, 3 pan-seared West Coast scallops, 250g fresh mussels, 6 garlic prawns and a roll of Scottish smoked salmon, with dressed side salad and warm crusty bread.",price:5e3,dietary:[],allergens:{},prepMins:0},{id:'a-deluxe',section:'Platters',name:'Deluxe Seafood Platter (serves two)',description:'One whole Dunure lobster, one whole Dunure crab, 500g whole langoustines, 500g moules marini\xe8re, pan-seared scallops, Scottish smoked salmon and 6 garlic prawns, with two portions of chips, side salad and warm crusty bread.',price:16500,dietary:[],allergens:{},prepMins:0},{id:'a-onionrings',section:'Sides',name:'House Beer-Battered Onion Rings (V)',description:'Crisp house beer-battered onion rings, served golden and crunchy.',price:450,dietary:['V'],allergens:{},allergenNotes:'',prepMins:0},{id:'a-garlicbread',section:'Sides',name:'Garlic Bread (V)',description:'Warm toasted garlic bread, finished with garlic & parsley butter.',price:450,dietary:['V'],allergens:{},prepMins:0,optionGroups:[{id:'gb-add',name:'Optional extras',required:!1,multi:!0,choices:[{id:'gb-cheese',label:'Add cheese',priceDelta:100}]}]},{id:'a-chips',section:'Sides',name:'Triple-Cooked Chips (V)',description:'Golden triple-cooked chips, lightly tossed in Maldon sea salt.',price:450,dietary:['V'],allergens:{},allergenNotes:'',prepMins:0,optionGroups:[{id:'chips-add',name:'Optional extras',required:!1,multi:!0,choices:[{id:'chips-cajun',label:'Add Cajun seasoning',priceDelta:0,allergens:{}}]}]},{id:'a-truffle',section:'Sides',name:'Parmesan & Truffle Fries (V)',description:'Crispy fries topped with finely grated parmesan and tossed in a winter truffle infused oil.',price:500,dietary:['V'],allergens:{},allergenNotes:'',prepMins:0},{id:'a-salad',section:'Sides',name:'Side Salad (VG)',description:'Seasonal mixed leaves with cucumber, red onion and mixed peppers, finished with a light vinaigrette.',price:450,dietary:['VG'],allergens:{},prepMins:0},{id:'a-brulee',section:'Desserts',name:"Chef's Cr\xe8me Br\xfbl\xe9e of the Day (V)",description:"Smooth Madagascan custard with a delicately caramelised sugar crust. Ask your server or see our specials board for today's flavour.",price:800,dietary:['V'],allergens:{},prepMins:0},{id:'a-crumble',section:'Desserts',name:'Seasonal Fruit Crumble (V)',description:'Slow-cooked seasonal fruit topped with a golden buttery crumble.',price:800,dietary:['V'],allergens:{},prepMins:0,optionGroups:[i('crumble')]},{id:'a-stp',section:'Desserts',name:'Sticky Toffee Pudding (V)',description:'A rich, homemade steamed date pudding, drenched in our signature homemade butterscotch sauce.',price:800,dietary:['V'],allergens:{},prepMins:0,optionGroups:[i('stp')]},{id:'a-cheesecake',section:'Desserts',name:'Cheesecake of the Day (V)',description:'A smooth, creamy cheesecake on a buttery biscuit base. Gluten-free and vegan options available.',price:800,dietary:['V'],allergens:{},prepMins:0,optionGroups:[i('cheesecake')]},{id:'a-affogato',section:'Desserts',name:'Affogato (V)',description:'Two scoops of creamy vanilla ice cream with a freshly brewed shot of Italian espresso poured over. Vegan options available.',price:800,dietary:['V'],allergens:{},prepMins:0},{id:'a-mini',section:'Mini Anchors (under 12s)',name:'Mini Anchors meal',description:'Under 12s only. Served with peas or beans. Includes a diluting juice drink & 2 scoops of ice cream. GF options available.',price:900,dietary:['GF option'],allergens:{},prepMins:0,optionGroups:[{id:'mini-main',name:'Choose a meal',required:!0,multi:!1,choices:[{id:'mini-burger',label:'Cheeseburger & chips',priceDelta:0,allergens:{}},{id:'mini-fish',label:'Fish goujons & chips',priceDelta:0,allergens:{}},{id:'mini-mac',label:"Mac 'n' cheese & chips (V)",priceDelta:0,allergens:{}},{id:'mini-chicken',label:'Chicken goujons & chips',priceDelta:0,allergens:{}}]},{id:'mini-veg',name:'With',required:!0,multi:!1,choices:[{id:'mini-peas',label:'Peas',priceDelta:0},{id:'mini-beans',label:'Beans',priceDelta:0}]}]}],t=['Starters','Mains','From the Grill',"Captain's Table",'Platters','Sides','Desserts','Mini Anchors (under 12s)'],o=n.map(({unsigned:i,soldOut:s,...n})=>({...n,allergens:{},allergenNotes:'',prepMins:0,optionGroups:n.optionGroups?.map(i=>({...i,choices:i.choices.map(i=>({...i,allergens:{}}))})),restaurantId:"anchorage",soldOut:!!s,signOff:null}))},1136,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SCOTTISH_BANK_HOLIDAYS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"BANK_HOLIDAY_SOURCE",{enumerable:!0,get:function(){return n}});const t=[{date:"2026-11-30",title:"St Andrew\u2019s Day",notes:""},{date:"2026-12-25",title:"Christmas Day",notes:""},{date:"2026-12-28",title:"Boxing Day",notes:"Substitute day"},{date:"2027-01-01",title:"New Year\u2019s Day",notes:""},{date:"2027-01-04",title:"2nd January",notes:"Substitute day"},{date:"2027-03-26",title:"Good Friday",notes:""},{date:"2027-05-03",title:"Early May bank holiday",notes:""},{date:"2027-05-31",title:"Spring bank holiday",notes:""},{date:"2027-08-02",title:"Summer bank holiday",notes:""},{date:"2027-11-30",title:"St Andrew\u2019s Day",notes:""},{date:"2027-12-27",title:"Christmas Day",notes:"Substitute day"},{date:"2027-12-28",title:"Boxing Day",notes:"Substitute day"},{date:"2028-01-03",title:"New Year\u2019s Day",notes:"Substitute day"},{date:"2028-01-04",title:"2nd January",notes:"Substitute day"},{date:"2028-04-14",title:"Good Friday",notes:""},{date:"2028-05-01",title:"Early May bank holiday",notes:""},{date:"2028-05-29",title:"Spring bank holiday",notes:""},{date:"2028-08-07",title:"Summer bank holiday",notes:""},{date:"2028-11-30",title:"St Andrew\u2019s Day",notes:""},{date:"2028-12-25",title:"Christmas Day",notes:""},{date:"2028-12-26",title:"Boxing Day",notes:""}],n='gov.uk/bank-holidays.json (Scotland)'},1137,[]); +__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"MESSAGING_CONFIG",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"previewProvider",{enumerable:!0,get:function(){return t}}),_e.relayProvider=n,Object.defineProperty(_e,"isLive",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"activeProvider",{enumerable:!0,get:function(){return s}});const e={mode:'preview',endpoint:'',smsService:'Twilio',emailService:'Postmark',smsSenderId:'ANCHORAGE',fromEmail:'bookings@your-venue.co.uk'},t={id:'preview',label:'Preview mode (nothing is sent)',live:!1,deliver:async()=>({ok:!0})};function n(e){return{id:'relay',label:'Your messaging server',live:!0,deliver:async t=>{try{const n=await fetch(e,{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({channel:t.channel,to:t.to,subject:t.subject,body:t.body,html:t.html,ref:t.ref,kind:t.kind,restaurantId:t.restaurantId})});if(!n.ok)return{ok:!1,error:`Server said ${n.status}`};return{ok:!0,providerId:(await n.json().catch(()=>({}))).id}}catch(e){return{ok:!1,error:e?.message??'Network error'}}}}}const o=()=>'live'===e.mode&&!!e.endpoint,s=()=>o()?n(e.endpoint):t},1138,[]); +__d(function(g,_r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TEMPLATE_LABEL",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"DEFAULT_TEMPLATES",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"PLACEHOLDERS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"teamName",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"longDate",{enumerable:!0,get:function(){return u}}),e.bookingVars=function(n,r){const o=n.allergies.map(n=>`${(0,t.allergenLabel)(n.allergen).toLowerCase()}`).join(', '),a=n.allergies.map(n=>`${(0,t.allergenLabel)(n.allergen)} (${(0,t.severityLabel)(n.severity).toLowerCase()})`).join(', '),i=`${n.partySize} ${1===n.partySize?'person':'people'}`,s={...c(r),first:l(n.name),name:n.name.trim(),date:u(n.date),time:n.time,covers:i,ref:n.ref};return{sms:{...s,allergy:n.allergies.length?` We\u2019ve noted the allergy (${o}) and the team will check it with you when you arrive.`:'',note:'',details:''},email:{...s,allergy:n.allergies.length?`Thank you for telling us about: ${a}. Our team will go through this with you when you arrive, and every dish for your table is checked at each step, from the kitchen to your table.`:'',note:n.notes.trim()?`Your note to us: "${n.notes.trim()}". We\u2019ll make sure the team sees it.`:'',details:[`Date: ${u(n.date)}`,`Time: ${n.time}`,`Table for: ${i}`,`Reference: ${n.ref}`].join('\n')}}},e.orderVars=function(r,o){const a=r.lines.reduce((t,n)=>t+n.qty,0),i=r.readyBy??r.slotTime,s=i?`at ${m(i)}`:'time to be confirmed',d=r.allergies.map(n=>(0,t.allergenLabel)(n.allergen).toLowerCase()).join(', '),u=r.allergies.map(n=>`${(0,t.allergenLabel)(n.allergen)} (${(0,t.severityLabel)(n.severity).toLowerCase()})`).join(', '),y={...c(o),first:l(r.customerName),name:r.customerName,ref:r.ref,items:`${a} ${1===a?'item':'items'}`,total:(0,n.gbp)(r.total),collect:s,date:'',time:i?m(i):'',covers:''};return{sms:{...y,allergy:r.allergies.length?` We\u2019ve noted your allergy (${d}); the kitchen checks every item.`:'',itemList:'',details:'',note:''},email:{...y,allergy:r.allergies.length?`You told us about: ${u}. The kitchen signs off every item against it before your order leaves the pass.`:'',itemList:r.lines.map(t=>`${t.qty} \xd7 ${t.name}${t.choices.length?` (${t.choices.join(', ')})`:''}`).join('\n'),details:[`Order: ${r.ref}`,`Collection: ${i?m(i):'time to be confirmed'}`,`Items: ${a}`,`Total: ${(0,n.gbp)(r.total)}`].join('\n'),note:''}}},e.fill=y,Object.defineProperty(e,"fillEmailText",{enumerable:!0,get:function(){return h}}),e.emailHtml=function(t,n){const r=n.accent??'#B8893E',o=t.split(/\n{2,}/).map(t=>{const n=t.split('\n');return n.length>1&&n.every(t=>/^[^:]{2,22}:\s.+/.test(t))?`${n.map(t=>{const n=t.indexOf(':');return``}).join('')}
${p(t.slice(0,n))}${p(t.slice(n+1).trim())}
`:n.length>1&&n.every(t=>/^\d+ \xd7/.test(t))?`
    ${n.map(t=>`
  • ${p(t)}
  • `).join('')}
`:`

${n.map(p).join('
')}

`}).join('');return`${p(n.preheader??'')}
${p(n.venue.toUpperCase())}
${o}
You\u2019re getting this because you made a booking or order with ${p(n.venue)}. It\u2019s about your booking only, not marketing.
`},e.smsParts=function(t){const n=b(t),r=!f.test(n),o=n.length,a=r?o<=70?1:Math.ceil(o/67):o<=160?1:Math.ceil(o/153);return{chars:o,parts:a,unicode:r}},Object.defineProperty(e,"toGsm",{enumerable:!0,get:function(){return b}});var t=_r(_d[0]),n=_r(_d[1]);const r={booking:{title:'Booking confirmed',when:'Every booking: online, phone or in person (and when you confirm a request)'},request:{title:'Booking request received',when:'Online bookings that need you to confirm them first'},declined:{title:'Booking request declined',when:'When you decline a booking request'},order:{title:'Takeaway order confirmed',when:'Every takeaway order from the app (and phone orders with a number)'}},o={booking:{sms:'Hi {first}, you\u2019re booked in at {venue}: {date} at {time}, {covers}. Ref {ref}.{allergy} Need to change or cancel? Just call {venuePhone}. See you soon, {team}',subject:'You\u2019re booked in at {venue}: {date} at {time}',body:'Hi {first},\n\nThank you for booking with us. We\u2019re really looking forward to welcoming you.\n\n{details}\n\n{allergy}\n\n{note}\n\nIf your plans change, just give us a ring on {venuePhone} and we\u2019ll happily move or cancel it for you. Please quote {ref}.\n\nYou\u2019ll find us at {address}.\n\nWarm wishes,\n{team}'},request:{sms:'Hi {first}, thanks for your booking request at {venue} for {date} at {time}, {covers}. We\u2019ll text you shortly to confirm. Ref {ref}. Questions? Call {venuePhone}. {team}',subject:'We\u2019ve got your booking request for {date}',body:'Hi {first},\n\nThank you for your booking request. A member of the team will look at it and confirm with you very shortly.\n\n{details}\n\n{allergy}\n\n{note}\n\nIf you have any questions in the meantime, call us on {venuePhone} and quote {ref}.\n\nWarm wishes,\n{team}'},declined:{sms:'Hi {first}, we\u2019re so sorry, we can\u2019t fit {covers} in on {date} at {time}. Please call {venuePhone} and we\u2019ll do our best to find another time. {team}',subject:'About your booking request for {date}',body:'Hi {first},\n\nThank you for asking to book with us. We\u2019re really sorry, but we can\u2019t fit your party in on {date} at {time}.\n\nWe\u2019d love to find another time that works. Give us a ring on {venuePhone} and we\u2019ll do our best.\n\nWith apologies and warm wishes,\n{team}'},order:{sms:'Hi {first}, thanks for your order {ref} from {venue}: {items}, {total}. Collection {collect}.{allergy} Questions? Call {venuePhone}. {team}',subject:'Your {venue} order {ref}',body:'Hi {first},\n\nThank you for your order. The kitchen has it and we\u2019ll have it ready for you.\n\n{details}\n\n{itemList}\n\n{allergy}\n\nAny questions, or need to change something? Call us on {venuePhone} and quote {ref}.\n\nYou\u2019ll find us at {address}.\n\nEnjoy!\n{team}'}},a=[{key:'first',what:'Guest\u2019s first name'},{key:'name',what:'Name on the booking'},{key:'venue',what:'Venue name'},{key:'date',what:'Day and date'},{key:'time',what:'Time'},{key:'covers',what:'e.g. 4 people'},{key:'ref',what:'Reference'},{key:'venuePhone',what:'Venue phone'},{key:'address',what:'Venue address'},{key:'team',what:'e.g. The Anchorage team'},{key:'allergy',what:'Allergy reassurance (only if one was noted)'},{key:'note',what:'Their note (email only)'},{key:'details',what:'Details box (email only)'},{key:'items',what:'Orders: e.g. 3 items'},{key:'total',what:'Orders: total'},{key:'collect',what:'Orders: collection time'},{key:'itemList',what:'Orders: list of items (email)'}],i=t=>/^the\s/i.test(t.trim())?`${t.trim()} team`:`The ${t.trim()} team`,l=t=>t.trim().replace(/^(mr|mrs|ms|miss|dr)\.?\s+/i,'').split(/\s+/)[0]||'there',s=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],d=['January','February','March','April','May','June','July','August','September','October','November','December'],u=t=>{const[n,r,o]=t.split('-').map(Number),a=new Date(n,r-1,o,12);return`${s[a.getDay()]} ${o} ${d[r-1]}`},m=t=>{const n=new Date(t);return`${String(n.getHours()).padStart(2,'0')}:${String(n.getMinutes()).padStart(2,'0')}`};function c(t){return{venue:t.name,venuePhone:t.phone||'the restaurant',address:t.address||t.location,team:i(t.name)}}function y(t,n){return t.replace(/\{(\w+)\}/g,(t,r)=>r in n?n[r]:t).replace(/[ \t]{2,}/g,' ').replace(/ +([.,])/g,'$1').trim()}const h=(t,n)=>y(t,n).split(/\n{2,}/).map(t=>t.trim()).filter(Boolean).join('\n\n'),p=t=>t.replace(/&/g,'&').replace(//g,'>').replace(/"/g,'"');const f=/^[A-Za-z0-9 \r\n@\xa3$\xa5\xe8\xe9\xf9\xec\xf2\xc7\xd8\xf8\xc5\xe5\u0394_\u03a6\u0393\u039b\u03a9\u03a0\u03a8\u03a3\u0398\u039e\xc6\xe6\xdf\xc9!"#\xa4%&'()*+,\-./:;<=>?\xa1\xc4\xd6\xd1\xdc\xa7\xbf\xe4\xf6\xf1\xfc\xe0^{}\\[~\]|\u20ac]*$/;const b=t=>t.replace(/[\u2018\u2019]/g,"'").replace(/[\u201c\u201d]/g,'"').replace(/[\u2013\u2014]/g,'-').replace(/\u2026/g,'...').replace(/\xd7/g,'x')},1139,[814,816]); +__d(function(g,r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.ukPhone=function(t){const s=(t??'').trim();if(!s)return{ok:!1,error:'A phone number is needed so we can send the confirmation.'};let l=s.replace(/[\s\-().]/g,'');l.startsWith('+44')?l='0'+l.slice(3):l.startsWith('0044')?l='0'+l.slice(4):/^44\d{10}$/.test(l)&&(l='0'+l.slice(2));l.startsWith('0(0)')&&(l=l.replace('0(0)','0'));l.startsWith('00')&&(l=l.slice(1));if(!/^0\d+$/.test(l))return{ok:!1,error:'Please use numbers only, for example 07700 900123.'};const n=/^07\d{9}$/.test(l),o=/^0[1238]\d{8,9}$/.test(l);if(!n&&!o)return{ok:!1,error:'That doesn\u2019t look like a UK mobile or landline. For example 07700 900123 or 01292 502826.'};const c=n?`${l.slice(0,5)} ${l.slice(5)}`:/^02/.test(l)?`${l.slice(0,3)} ${l.slice(3,7)} ${l.slice(7)}`:/^0(3|8)/.test(l)?`${l.slice(0,4)} ${l.slice(4,7)} ${l.slice(7)}`:`${l.slice(0,5)} ${l.slice(5)}`;return{ok:!0,e164:'+44'+l.slice(1),pretty:c,kind:n?'mobile':'landline'}},e.emailOk=function(t){const s=(t??'').trim();return!s||/^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/.test(s)}},1140,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"shallow",{enumerable:!0,get:function(){return c}});const t=t=>Symbol.iterator in t,n=t=>"entries"in t,o=(t,n)=>{const o=t instanceof Map?t:new Map(t.entries()),s=n instanceof Map?n:new Map(n.entries());if(o.size!==s.size)return!1;for(const[t,n]of o)if(!s.has(t)||!Object.is(n,s.get(t)))return!1;return!0},s=(t,n)=>{const o=t[Symbol.iterator](),s=n[Symbol.iterator]();let c=o.next(),u=s.next();for(;!c.done&&!u.done;){if(!Object.is(c.value,u.value))return!1;c=o.next(),u=s.next()}return!!c.done&&!!u.done};function c(c,u){return!!Object.is(c,u)||"object"==typeof c&&null!==c&&"object"==typeof u&&null!==u&&(Object.getPrototypeOf(c)===Object.getPrototypeOf(u)&&(t(c)&&t(u)?n(c)&&n(u)?o(c,u):s(c,u):o({entries:()=>Object.entries(c)},{entries:()=>Object.entries(u)})))}},1141,[]); +__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"EXAMPLE_TAG",{enumerable:!0,get:function(){return t}}),_e.exampleCards=function(t){return l.flatMap(l=>{const h=t.find(e=>e.id===l.menuItemId);if(!h)return[];return[{id:(0,e.uuidFrom)(`card:${h.restaurantId}:${h.id}`),restaurantId:h.restaurantId,menuItemId:h.id,dish:h.name,section:h.section,price:h.price,photo:l.photo,ingredients:o(l.menuItemId,l.ings),steps:l.steps,allergens:l.allergens,dismissed:l.dismissed??[],allergenNotes:l.notes,allergensConfirmed:{by:s.by,at:s.at},signOff:l.awaiting?null:s,wasLive:!0,origin:'example',version:l.awaiting?2:1,createdAt:n,updatedAt:l.awaiting?'2026-10-28T15:20:00.000Z':n,updatedBy:l.awaiting?'Example edit (demo)':s.by}]})},_e.importedCard=function(t,s){return{id:(0,e.uuidFrom)(`card:${t.restaurantId}:${t.id}`),restaurantId:t.restaurantId,menuItemId:t.id,dish:t.name,section:t.section,price:t.price,ingredients:[],steps:[],allergens:{...t.allergens},dismissed:[],allergenNotes:t.allergenNotes,allergensConfirmed:t.signOff?{by:t.signOff.by,at:t.signOff.at}:void 0,signOff:t.signOff?{by:t.signOff.by,at:t.signOff.at}:null,wasLive:!t.hidden||!!t.signOff,origin:'imported',version:1,createdAt:s,updatedAt:s,updatedBy:'Imported from the menu'}};var e=r(d[0]);const t='Example data',s={by:'Example sign-off (demo)',at:'2026-10-26T10:00:00.000Z'},n='2026-10-26T09:00:00.000Z',o=(e,t)=>t.map(([t,s,n],o)=>({id:`${e}-i${o}`,qty:t,unit:s,name:n})),l=[{menuItemId:'a-lobster',photo:'asset:lobster',ings:[['1','whole','Live Dunure lobster (c. 600 g, Kitty Fisher)'],['60','g','Garlic butter'],['\xbd','','Lemon, charred'],['60','g','Mixed leaves, cucumber and red onion'],['15','ml','House vinaigrette (Dijon mustard)'],['200','g','Triple-cooked chips']],steps:['Chill the lobster for 20 minutes, then dispatch humanely and split lengthways. Remove the stomach sac and the intestinal tract.','Crack the claws. Season the flesh and spoon over half the garlic butter.','Grill flesh side up for 6\u20138 minutes until just opaque; baste with the rest of the butter.','Char the lemon on the grill. Dress the salad at the pass.','Plate on the long board: lobster, claws alongside, salad, chips in the cone, lemon and a pot of the pan butter.'],allergens:{crustaceans:'contains',milk:'contains',mustard:'contains',gluten:'may',fish:'may'},notes:'Chips are cooked in a shared fryer (gluten, fish, crustaceans may be present).'},{menuItemId:'a-skink',photo:'asset:skink',ings:[['120','g','Smoked haddock, undyed'],['200','ml','Whole milk'],['20','g','Butter'],['60','g','Leek, sliced'],['40','g','Onion, diced'],['120','g','Floury potato, diced'],['1','tbsp','Parsley, chopped'],['1','slice','Crusty bread'],['10','g','Butter (portion)']],steps:['Poach the haddock in the milk for 5 minutes. Lift out, flake and keep the milk.','Sweat the leek and onion in the butter until soft, with no colour.','Add the potato and the poaching milk; simmer for 15 minutes until the potato breaks down.','Crush a third of the potato for body, return the haddock and season with pepper.','Serve in the warm bowl, parsley on top, bread and butter on the side.'],allergens:{fish:'contains',milk:'contains',gluten:'contains'}},{menuItemId:'a-fishsupper',photo:'asset:fishsupper',ings:[['200','g','Haddock fillet, locally landed'],['80','g','Self-raising flour'],['100','ml','Beer (lager)'],['250','g','Triple-cooked chips'],['80','g','Garden peas'],['10','g','Butter'],['40','g','Tartare sauce (mayonnaise, capers, gherkins)'],['\xbc','','Lemon']],steps:['Whisk the flour and cold beer to a thick batter; rest for 10 minutes.','Dust the haddock in flour, dip in the batter and lower into the fryer at 180 \xb0C for 5\u20136 minutes.','Fry the chips at 190 \xb0C until golden.','Warm the peas with the butter.','Plate the fish on the chips, peas in the ramekin, tartare and lemon on the side.'],allergens:{fish:'contains',gluten:'contains',eggs:'contains',milk:'contains',mustard:'may',crustaceans:'may',sulphites:'may'},notes:'Shared fryer. Tartare is made with mayonnaise (egg, may contain mustard). The beer in the batter may contain sulphites.'},{menuItemId:'a-moules',photo:'asset:moules',ings:[['500','g','Scottish rope mussels, cleaned'],['30','g','Butter'],['1','','Shallot, finely diced'],['2','cloves','Garlic, sliced'],['100','ml','Dry white wine'],['60','ml','Double cream'],['1','tbsp','Parsley, chopped'],['2','slices','Crusty bread']],steps:['Check every mussel: discard any that are cracked or stay open when tapped.','Sweat the shallot and garlic in the butter for 2 minutes.','Add the mussels and wine, cover and steam on a high heat for 3\u20134 minutes until they open.','Discard any that stay shut. Stir in the cream and parsley.','Serve in the deep bowl with the bread and an empty-shell bowl.'],allergens:{molluscs:'contains',milk:'contains',sulphites:'contains',gluten:'contains'}},{menuItemId:'a-stp',photo:'asset:stp',awaiting:!0,ings:[['30','g','Medjool dates, chopped'],['40','ml','Boiling water'],['25','g','Butter'],['30','g','Dark muscovado sugar'],['1','','Egg (\xbd per portion)'],['35','g','Self-raising flour'],['60','ml','Butterscotch sauce (butter, cream, brown sugar)']],steps:['Soak the dates in the boiling water for 10 minutes, then blitz.','Cream the butter and sugar, beat in the egg, fold in the flour and the dates.','Steam in buttered moulds for 35 minutes.','Warm the butterscotch sauce.','Turn out, pour over the sauce and serve with the guest\u2019s choice of custard, ice cream or cream.'],allergens:{gluten:'contains',milk:'contains',eggs:'contains',sulphites:'may'},notes:'Dried dates may contain sulphites. Accompaniments are chosen at order (see the dish options).'}]},1142,[1104]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/staff-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg",width:800,height:600,toString(){return this.uri}}},1143,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/staff-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg",width:800,height:600,toString(){return this.uri}}},1144,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/staff-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg",width:800,height:600,toString(){return this.uri}}},1145,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/staff-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg",width:800,height:600,toString(){return this.uri}}},1146,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/staff-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg",width:800,height:600,toString(){return this.uri}}},1147,[]); +__d(function(g,r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"gid",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"SEED_CALC_INGREDIENTS",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"SEED_CALC_DISHES",{enumerable:!0,get:function(){return I}}),_e.stripGpSamples=y,Object.defineProperty(_e,"useGpCalc",{enumerable:!0,get:function(){return v}}),_e.useGpCalcView=function(){const e=v();return(0,t.useMemo)(()=>i.LIVE_VENUE_BUILD?{...e,...y(e)}:e,[e])};var e,i=r(_d[0]),t=r(_d[1]),s=r(_d[2]),a=r(_d[3]),n=r(_d[4]),c=(e=n)&&e.__esModule?e:{default:e},d=r(_d[5]),o=r(_d[6]),p=r(_d[7]);let l=0;const f=e=>`${e}-${Date.now().toString(36)}${(l++).toString(36)}`,h=(e,i,t,s,a,n=0,c=[])=>({id:e,name:i,packSize:t,packUnit:s,packPrice:a,wastePct:n,allergens:c}),u=e=>new Date(Date.now()-864e5*e).toISOString(),k={'gi-haddock':[8100,8700,8500],'gi-chicken':[4500,4600,4750],'gi-steak':[6200,5900,6e3],'gi-potato':[1450,1500,1600],'gi-oil':[3400,3300,3200]},S=[h('gi-haddock','Haddock fillet',5,'kg',8500,5,['fish']),h('gi-potato','Potatoes (chipping)',25,'kg',1600,20),h('gi-batter','Batter mix',3.5,'kg',770,0,['gluten']),h('gi-oil','Rapeseed oil',20,'L',3200),h('gi-peas','Garden peas (frozen)',2.5,'kg',450),h('gi-lemon','Lemons',80,'each',1600),h('gi-mayo','Mayonnaise',5,'L',1250,0,['eggs','mustard']),h('gi-capers','Capers',1,'kg',900,0,['sulphites']),h('gi-gherkin','Gherkins',2,'kg',700,0,['sulphites']),h('gi-steak','Braising steak',5,'kg',6e3,10),h('gi-pastry','Puff pastry',5,'kg',2250,0,['gluten','milk']),h('gi-onion','Onions',10,'kg',1e3,10),h('gi-stock','Beef stock',1,'L',350,0,['celery']),h('gi-chicken','Chicken breast',5,'kg',4750),h('gi-leaves','Cos lettuce',12,'each',960,15),h('gi-parmesan','Parmesan',1,'kg',1800,0,['milk']),h('gi-bread','Sourdough loaf',1,'each',300,0,['gluten']),h('gi-anchovy','Anchovies',.5,'kg',900,0,['fish']),h('gi-sponge','Date sponge (tray of 12)',1,'each',600,0,['gluten','eggs','milk']),h('gi-toffee','Toffee sauce',2,'L',1100,0,['milk']),h('gi-icecream','Vanilla ice cream',4,'L',1800,0,['milk','eggs'])].map(e=>({...e,prices:(k[e.id]??[e.packPrice]).map((e,i,t)=>({p:e,at:u(7*(t.length-i))}))})),P=(e,i,t,s,a,n,c,d="")=>({id:e,name:i,category:t,lines:s.map(([e,i,t])=>({ingId:e,qty:i,unit:t})),portions:a,target:70,menuPrice:n,status:c,description:d,allergens:[]}),I=[P('gd-chips','Chips (portion)','Sides',[['gi-potato',300,'g'],['gi-oil',50,'ml']],1,450,'ready','Hand-cut, twice-cooked chips.'),P('gd-tartare','Tartare sauce (batch of 20)','Sauces & extras',[['gi-mayo',1,'L'],['gi-capers',100,'g'],['gi-gherkin',150,'g'],['gi-lemon',2,'each']],20,void 0,'draft'),P('gd-fish','Fish & chips (example)','Mains',[['gi-haddock',220,'g'],['gi-batter',60,'g'],['dish:gd-chips',1,'each'],['gi-peas',80,'g'],['dish:gd-tartare',1,'each'],['gi-lemon',1,'each']],1,1695,'ready','Beer-battered haddock, chips, peas and tartare sauce.'),P('gd-pie','Steak pie (example)','Mains',[['gi-steak',2,'kg'],['gi-pastry',800,'g'],['gi-onion',500,'g'],['gi-stock',1,'L']],10,1595,'draft','Slow-braised steak under a puff pastry lid. Batch of 10.'),P('gd-caesar','Chicken Caesar (example)','Starters',[['gi-chicken',160,'g'],['gi-leaves',.5,'each'],['gi-parmesan',15,'g'],['gi-bread',.1,'each'],['gi-anchovy',8,'g']],1,1150,'draft'),P('gd-stp','Sticky toffee pudding (example)','Desserts',[['gi-sponge',.083,'each'],['gi-toffee',60,'ml'],['gi-icecream',70,'ml']],1,695,'ready','Warm date sponge, toffee sauce, vanilla ice cream.')];function y(e){const i=e=>I.some(i=>i.id===e.id&&JSON.stringify(i)===JSON.stringify(e))||/\(example\)/i.test(e.name),t=new Set(e.dishes.filter(e=>!i(e)).map(e=>e.id));let s=!0;for(;s;){s=!1;for(const i of e.dishes.filter(e=>t.has(e.id)))for(const e of i.lines)e.ingId.startsWith('dish:')&&!t.has(e.ingId.slice(5))&&(t.add(e.ingId.slice(5)),s=!0)}const a=e.dishes.filter(e=>t.has(e.id)),n=new Set(a.flatMap(e=>e.lines.map(e=>e.ingId))),c=e=>{const i=S.find(i=>i.id===e.id);if(!i)return!1;const t=({prices:e,...i})=>JSON.stringify(i);return t(i)===t(e)&&(!e.prices?.length||JSON.stringify(e.prices.map(e=>e.p))===JSON.stringify(i.prices?.map(e=>e.p)))};return{dishes:a,ingredients:e.ingredients.filter(e=>n.has(e.id)||!c(e))}}const v=(0,d.create)()((0,o.persist)((e,t)=>({ingredients:a.IS_ISOLATED_VENUE||i.LIVE_VENUE_BUILD?[]:S,dishes:a.IS_ISOLATED_VENUE||i.LIVE_VENUE_BUILD?[]:I,settings:{vatPct:20,pricePoints:!0,defaultTarget:70,multipleBasis:'inc',priceBasis:'latest',avgOf:5},alerts:[],saveIngredient:i=>{const s=t(),a=s.ingredients.find(e=>e.id===i.id),n=s.ingredients.map(e=>e.id===i.id?i:e);let c=s.alerts;if(a&&(a.packPrice!==i.packPrice||a.packSize!==i.packSize||a.wastePct!==i.wastePct)){const e=s.settings.vatPct,t=s.dishes.filter(e=>e.menuPrice).map(i=>{const t=(0,p.gpOf)((0,p.portionCost)(i,s.ingredients,s.dishes),i.menuPrice,e).gpPct,a=(0,p.gpOf)((0,p.portionCost)(i,n,s.dishes),i.menuPrice,e).gpPct;return{id:i.id,name:i.name,before:t,after:a,belowTarget:ae.aftere.packPrice/e.packSize/(1-(e.wastePct||0)/100),o=(d(i)-d(a))/d(a)*100;t.length&&(c=[{id:f('ma'),at:(new Date).toISOString(),ingredient:i.name,change:`${o>=0?'+':''}${o.toFixed(0)}%`,dishes:t},...c].slice(0,20))}e({ingredients:n,alerts:c})},addPricePaid:(e,i,s)=>{const a=t(),n=a.ingredients.find(i=>i.id===e);if(!(n&&i>0))return;const c=[...n.prices?.length?n.prices:[{p:n.packPrice,at:''}],{p:Math.round(i),at:s??(new Date).toISOString()}].slice(-20),d={...n,prices:c};t().saveIngredient({...d,packPrice:(0,p.costingPrice)(d,a.settings.priceBasis,a.settings.avgOf??5)})},addIngredient:i=>{const t=f('gi');return e(e=>({ingredients:[...e.ingredients,{...i,id:t}]})),t},saveDish:i=>e(e=>({dishes:e.dishes.some(e=>e.id===i.id)?e.dishes.map(e=>e.id===i.id?{...i,updatedAt:(new Date).toISOString()}:e):[{...i,updatedAt:(new Date).toISOString()},...e.dishes]})),removeDish:i=>e(e=>({dishes:e.dishes.filter(e=>e.id!==i)})),setSettings:i=>{const s={...t().settings,...i};if(e({settings:s}),void 0!==i.priceBasis||void 0!==i.avgOf)for(const e of t().ingredients){const i=(0,p.costingPrice)(e,s.priceBasis,s.avgOf??5);i!==e.packPrice&&t().saveIngredient({...e,packPrice:i})}},dismissAlert:i=>e(e=>({alerts:e.alerts.filter(e=>e.id!==i)}))}),{name:'covercharge-gpcalc-v1',storage:(0,o.createJSONStorage)(()=>c.default),version:4,migrate:async(e,t)=>(i.LIVE_VENUE_BUILD&&e&&(await(0,s.archiveChefCache)('gpcalc',e),e={...e,...y({...e,dishes:e.dishes||[],ingredients:e.ingredients||[]})}),t<2&&e&&(e.ingredients=(e.ingredients??[]).map(e=>e.prices?.length?e:{...e,prices:[{p:e.packPrice,at:(new Date).toISOString()}]}),e.settings={priceBasis:'latest',avgOf:5,...e.settings??{}}),e)}))},1148,[833,30,1132,5,1116,952,1117,1149]); +__d(function(g,r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DISH_CATEGORIES",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"pricesOf",{enumerable:!0,get:function(){return n}}),e.priceStats=i,Object.defineProperty(e,"costingPrice",{enumerable:!0,get:function(){return c}}),e.avgMenuPrice=function(t,n,i){const c=t.filter(t=>t.category===n&&t.menuPrice&&t.id!==i).map(t=>t.menuPrice);return c.length?{avg:Math.round(c.reduce((t,n)=>t+n,0)/c.length),count:c.length}:null},Object.defineProperty(e,"unitsFor",{enumerable:!0,get:function(){return a}}),e.lineCost=s,Object.defineProperty(e,"portionCost",{enumerable:!0,get:function(){return u}}),e.suggestAllergens=function t(n,i,c=[],o=0){const a=new Set;for(const s of n.lines)if(s.ingId.startsWith('dish:')){const n=c.find(t=>t.id===s.ingId.slice(5));n&&o<4&&((n.allergens??[]).forEach(t=>a.add(t)),t(n,i,c,o+1).forEach(t=>a.add(t)))}else i.find(t=>t.id===s.ingId)?.allergens?.forEach(t=>a.add(t));return[...a]},Object.defineProperty(e,"exVat",{enumerable:!0,get:function(){return d}}),e.gpOf=function(t,n,i){const c=d(n,i);return{ex:c,gpPct:c>0?(c-t)/c*100:0,cashGp:c-t,foodCostPct:c>0?t/c*100:0}},e.toPricePoint=f,e.suggestPrice=function(t,n,i,c){const o=Math.min(95,Math.max(0,n)),a=t/(1-o/100)*(1+i/100);return c?f(Math.ceil(a)):Math.ceil(a)},Object.defineProperty(e,"toneFor",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"money",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"pct",{enumerable:!0,get:function(){return p}}),e.multipleOf=function(t,n,i,c="inc"){return t<=0?0:('inc'===c?n:d(n,i))/t},Object.defineProperty(e,"fmtX",{enumerable:!0,get:function(){return h}}),e.suggestForMultiple=function(t,n,i,c,o){const a=t*Math.max(0,n)*('ex'===c?1+i/100:1);return o?f(Math.ceil(a)):Math.ceil(a)};const t=['Starters','Mains','From the Grill','Sides','Desserts','Specials','Kids','Sauces & extras'],n=t=>t.prices?.length?t.prices:[{p:t.packPrice,at:''}];function i(t,i=5){const c=n(t),o=c.slice(-Math.max(1,i)),a=Math.round(o.reduce((t,n)=>t+n.p,0)/o.length);return{latest:c[c.length-1].p,avg:a,count:o.length,min:Math.min(...o.map(t=>t.p)),max:Math.max(...o.map(t=>t.p))}}const c=(t,n="latest",c=5)=>'average'===n?i(t,c).avg:i(t,c).latest;const o={kg:{dim:'mass',f:1e3},g:{dim:'mass',f:1},L:{dim:'vol',f:1e3},ml:{dim:'vol',f:1},each:{dim:'each',f:1}},a=t=>'mass'===o[t].dim?['g','kg']:'vol'===o[t].dim?['ml','L']:['each'];function s(t,n,i=[],c=0){if(t.ingId.startsWith('dish:')){const o=i.find(n=>n.id===t.ingId.slice(5));return o&&c<4?u(o,n,i,c+1)*t.qty:0}const a=n.find(n=>n.id===t.ingId);if(!a||!a.packSize)return 0;const s=o[a.packUnit],d=o[t.unit];if(!d||s.dim!==d.dim)return 0;const f=a.packPrice/(a.packSize*s.f),l=Math.min(95,Math.max(0,t.wastePct??a.wastePct??0));return t.qty*d.f*f/(1-l/100)}const u=(t,n,i=[],c=0)=>t.lines.reduce((t,o)=>t+s(o,n,i,c),0)/Math.max(1,t.portions||1);const d=(t,n)=>t/(1+n/100);function f(t){const n=Math.floor(t/100),i=t-100*n;return i<=50?100*n+50:i<=95?100*n+95:100*(n+1)+50}const l=(t,n)=>t>=n-.05?'ok':t>=n-5?'amber':'red',m=t=>`\xa3${(Math.round(t)/100).toFixed(2)}`,p=t=>`${t.toFixed(1)}%`;const h=t=>`${t.toFixed(1)}x`},1149,[]); +__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.inviteFromLocation=function(n,t){const o=new URLSearchParams(n).get('invite');if(o)return o;const s=(t||'').match(/[#&]invite=([A-Za-z0-9_-]{10,})/);return s?s[1]:null},e.addressWithoutInvite=function(n){try{const t=new URL(n);t.searchParams.delete('invite');const o=t.hash.replace(/^#/,'').split('&').filter(n=>n&&!n.startsWith('invite=')).join('&');return t.hash=o?`#${o}`:'',t.toString()}catch{return n}},e.inviteRefusal=function(n){return/already been used/i.test(n)?'This link has already been used on another device. Ask your manager for a new one.':/expired/i.test(n)?'This link has expired. Ask your manager for a new one.':/replaced|switched off|not valid|invalid|unknown invite/i.test(n)?'This link has been replaced or switched off. Ask your manager for a new one.':/personal app link is incomplete/i.test(n)?'Open the complete personal iPhone link your manager sent.':/no longer active/i.test(n)?'This person is no longer on the team. Ask your manager if this is wrong.':null},Object.defineProperty(e,"WIPE_PREFIXES",{enumerable:!0,get:function(){return n}}),e.keysToWipe=function(t){return t.filter(t=>n.some(n=>t.startsWith(n)))};const n=['covercharge-','cc-sync:','cc-','sb-']},1150,[]); +__d(function(g,r,_i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"hrRemote",{enumerable:!0,get:function(){return y}}),_e.exampleHr=f,_e.stripHrSamples=m,Object.defineProperty(_e,"useHr",{enumerable:!0,get:function(){return q}});var e,t=r(_d[0]),s=r(_d[1]),n=r(_d[2]),o=r(_d[3]),i=r(_d[4]),u=(e=i)&&e.__esModule?e:{default:e},d=r(_d[5]),l=r(_d[6]),c=r(_d[7]),h=r(_d[8]);const y={live:!1,checkout:null,post:null,vote:null,moderate:null,reply:null,trend:null,shouts:null,log:null,refresh:null},v=(e,t,s)=>(0,c.oneWayToken)(e,`shift:${t}:${s}`),p=(e,t)=>{const s=new Date(`${e}T12:00:00Z`);return s.setUTCDate(s.getUTCDate()+t),s.toISOString().slice(0,10)};function f(e,t){const s=[];for(let n=14;n>=1;n--){const o=p(t,-n),i=4===n?2:4+7*n%4;for(let t=0;t!((0,s.isAnchorage)(e.venue)&&e.example)),questions:e.questions.filter(e=>!((0,s.isAnchorage)(e.venue)&&/^hrq-ex-[123]$/.test(e.id))),shouts:e.shouts.filter(e=>!((0,s.isAnchorage)(e.venue)&&/^hrs-ex-[123]$/.test(e.id)))}}const q=(0,d.create)()((0,l.persist)((e,t)=>({secret:(0,c.newSecret)(),answered:[],voted:{},checkins:[],questions:[],shouts:[],log:[],seeded:{},ensure:(s,i)=>{if(n.LIVE_VENUE_BUILD||o.IS_ISOLATED_VENUE||['souters','kirkmichael','wildings'].includes(s)||t().seeded[s]||y.live)return;const u=f(s,i);e(e=>({seeded:{...e.seeded,[s]:!0},checkins:[...e.checkins,...u.checkins],questions:[...e.questions,...u.questions],shouts:[...e.shouts,...u.shouts]}))},hasAnswered:(e,s)=>t().answered.includes(v(t().secret,e,s)),submit:s=>{const n=t(),o=v(n.secret,s.rid,s.shiftKey);if(n.answered.includes(o))return'already';const i=(0,c.checkInPayload)({venue:s.rid,day:s.day,token:o,morale:s.morale,staffing:s.staffing}),u=s.question?(0,c.cleanQuestion)(s.question):null,d=s.shoutTo?.trim().slice(0,80)||void 0,l=s.shoutBody?.trim().slice(0,280)||void 0;return e({answered:[...n.answered,o].slice(-300)}),y.live&&y.checkout?(y.checkout({rid:s.rid,shiftKey:'',day:i.day,morale:i.morale,staffing:i.staffing,question:u??void 0,kind:s.kind??'up',shoutTo:d,shoutBody:l,token:o}),'queued'):(e(e=>({checkins:[...e.checkins,{venue:i.venue,day:i.day,morale:i.morale,staffing:i.staffing}],questions:u?[...e.questions,{id:(0,h.uuid)(),venue:s.rid,body:u,kind:s.kind??'up',up:0,yes:0,no:0,hidden:!1,postedOn:s.day}]:e.questions,shouts:d?[...e.shouts,{id:(0,h.uuid)(),venue:s.rid,day:s.day,to:d,body:l}]:e.shouts})),'ok')},skip:(s,n)=>{const o=t(),i=v(o.secret,s,n);o.answered.includes(i)||e({answered:[...o.answered,i].slice(-300)})},post:(t,s,n,o)=>{const i=(0,c.cleanQuestion)(s);if(!i)return null;const u=(0,h.uuid)();return e(e=>({questions:[...e.questions,{id:u,venue:t,body:i,kind:n,up:0,yes:0,no:0,hidden:!1,postedOn:o}]})),y.live&&y.post&&y.post(t,u,i,n),u},vote:(s,n)=>{const o=t();if(o.voted[s])return!1;const i=o.questions.find(e=>e.id===s);if(!i||i.hidden)return!1;const u='up'===i.kind?1:n;return e({voted:{...o.voted,[s]:u},questions:o.questions.map(e=>e.id===s?(0,c.applyVote)(e,u):e)}),y.live&&y.vote&&y.vote(s,(0,c.oneWayToken)(o.secret,`vote:${s}`),u),!0},moderate:(s,n,o,i)=>{const u=t().questions.find(e=>e.id===s);u&&(e(e=>({questions:e.questions.map(e=>e.id===s?{...e,hidden:'hide'===n}:e),log:[{id:(0,h.uuid)(),venue:u.venue,questionId:s,action:n,reason:o.trim()||void 0,by:i,at:(new Date).toISOString()},...e.log].slice(0,500)})),y.live&&y.moderate&&y.moderate(s,n,o.trim()))},reply:(s,n,o)=>{const i=n.trim().slice(0,600),u=t().questions.find(e=>e.id===s);if(!u)return;const d=(new Date).toISOString();e(e=>({questions:e.questions.map(e=>e.id===s?{...e,reply:i||void 0,replyAt:i?d:void 0}:e),log:[{id:(0,h.uuid)(),venue:u.venue,questionId:s,action:'reply',by:o,at:d},...e.log].slice(0,500)})),y.live&&y.reply&&y.reply(s,i)},setRemoteBoard:(t,s)=>e(e=>({questions:[...e.questions.filter(e=>e.venue!==t),...s]})),upsertRemote:t=>e(e=>({questions:e.questions.some(e=>e.id===t.id)?e.questions.map(e=>e.id===t.id?t:e):[...e.questions,t]}))}),{name:'covercharge-hr-v1',version:3,storage:(0,l.createJSONStorage)(()=>u.default),migrate:async e=>n.LIVE_VENUE_BUILD&&e?(await(0,t.archiveChefCache)('hr',e),{...e,...m(e)}):e}))},1151,[1132,1024,833,5,1116,952,1117,1152,1033]); +__d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"MIN_ANSWERS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"DEFAULT_WORDING",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"DEFAULT_HR",{enumerable:!0,get:function(){return r}}),e.hrSettingsOf=function(t){const n=t??{},r=n.wording??{},s=Object.fromEntries(Object.entries(o).map(([t,n])=>[t,a(r[t],'intro'===t||'staffing'===t||'question'===t?160:60,n)]));return{on:!1!==n.on,askQuestion:!1!==n.askQuestion,askShout:!1!==n.askShout,board:!1!==n.board,wording:s}},Object.defineProperty(e,"MORALE_STEPS",{enumerable:!0,get:function(){return s}}),e.moraleWord=function(t,n=o){return t<=1?n.moraleLow:t>=5?n.moraleHigh:2===t?'Fairly low':3===t?'OK':'Good'},Object.defineProperty(e,"STAFF_STOPS",{enumerable:!0,get:function(){return u}}),e.snapStaffing=i,e.staffingWord=function(t,n=o){const r=i(t);return r<=12?n.staffLow:r<45?"A bit short":r<=55?n.staffMid:r<88?"A bit over":n.staffHigh},e.oneWayToken=function(n,o){return(0,t.sha256HexSync)(`cc-hr:${n}:${o}`).slice(0,40)},e.newSecret=function(){let t='';const n=globalThis.crypto;if(n?.getRandomValues){return n.getRandomValues(new Uint8Array(24)).forEach(n=>{t+=n.toString(16).padStart(2,'0')}),t}for(let n=0;n<48;n++)t+=Math.floor(16*Math.random()).toString(16);return t},e.checkInPayload=function(t){const n=Math.max(1,Math.min(5,Math.round(t.morale)));return{venue:t.venue,day:t.day,token:t.token,morale:n,staffing:null==t.staffing?null:i(t.staffing)}},e.dayResults=function(t,o=n){const r=new Map;for(const n of t){const t=r.get(n.day)??[];t.push(n),r.set(n.day,t)}const a=[];let s=0;for(const[t,n]of[...r.entries()].sort(([t],[n])=>t.localeCompare(n))){if(n.lengtht.staffing).filter(t=>null!=t);a.push({day:t,answers:n.length,morale:Math.round(n.reduce((t,n)=>t+n.morale,0)/n.length*10)/10,staffing:r.length?Math.round(r.reduce((t,n)=>t+n,0)/r.length):null,short:r.filter(t=>t<45).length,perfect:r.filter(t=>t>=45&&t<=55).length,over:r.filter(t=>t>55).length})}return{shown:a,held:s}},Object.defineProperty(e,"QUESTION_MAX",{enumerable:!0,get:function(){return f}}),e.cleanQuestion=function(t){const n=t.replace(/\s+/g,' ').trim().slice(0,f);return n.length>=3?n:null},e.boardOrder=function(t,n){const o=t=>'up'===t.kind?t.up:t.yes+t.no;return t.filter(t=>n||!t.hidden).sort((t,n)=>Number(t.hidden)-Number(n.hidden)||o(n)-o(t)||n.postedOn.localeCompare(t.postedOn)||t.id.localeCompare(n.id))},e.applyVote=function(t,n){return'up'===t.kind?{...t,up:t.up+1}:1===n?{...t,yes:t.yes+1}:{...t,no:t.no+1}};var t=_r(d[0]);const n=3,o={intro:'Before you go: 3 quick taps, about 15 seconds. Your name is never saved with your answers.',morale:'How was team morale today?',moraleLow:'Low',moraleHigh:'High',staffing:'Was there enough staff on today for the number of customers?',staffLow:'Not enough',staffMid:'Perfect',staffHigh:'Overstaffed',question:'Got a question you\u2019d like to post anonymously for the team to vote on?',shout:'Shout out a teammate?'},r={on:!0,askQuestion:!0,askShout:!0,board:!0,wording:o},a=(t,n,o)=>('string'==typeof t?t.trim().slice(0,n):'')||o;const s=[1,2,3,4,5];const u=[0,12.5,25,37.5,50,62.5,75,87.5,100].map(t=>Math.round(t));function i(t){const n=Math.max(0,Math.min(100,Number.isFinite(t)?t:50));return u.reduce((t,o)=>Math.abs(o-n)>>0;o.push(c>>>24&255,c>>>16&255,c>>>8&255,255&c,h>>>24&255,h>>>16&255,h>>>8&255,255&h);const l=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),u=new Uint32Array(64),f=(t,n)=>t>>>n|t<<32-n;for(let n=0;n>>3,e=f(u[t-2],17)^f(u[t-2],19)^u[t-2]>>>10;u[t]=u[t-16]+n+u[t-7]+e>>>0}let e=l[0],s=l[1],c=l[2],h=l[3],a=l[4],i=l[5],p=l[6],d=l[7];for(let n=0;n<64;n++){const o=d+(f(a,6)^f(a,11)^f(a,25))+(a&i^~a&p)+t[n]+u[n]>>>0,l=(f(e,2)^f(e,13)^f(e,22))+(e&s^e&c^s&c)>>>0;d=p,p=i,i=a,a=h+o>>>0,h=c,c=s,s=e,e=o+l>>>0}l[0]=l[0]+e>>>0,l[1]=l[1]+s>>>0,l[2]=l[2]+c>>>0,l[3]=l[3]+h>>>0,l[4]=l[4]+a>>>0,l[5]=l[5]+i>>>0,l[6]=l[6]+p>>>0,l[7]=l[7]+d>>>0}return Array.from(l).map(t=>t.toString(16).padStart(8,'0')).join('')};const t=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function n(t){const n=[];for(let e=0;e=55296&&o<=56319&&e+1=56320&&n<=57343&&(o=65536+(o-55296<<10)+(n-56320),e++)}o<128?n.push(o):o<2048?n.push(192|o>>6,128|63&o):o<65536?n.push(224|o>>12,128|o>>6&63,128|63&o):n.push(240|o>>18,128|o>>12&63,128|o>>6&63,128|63&o)}return n}},1153,[]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"FunctionRegion",{enumerable:!0,get:function(){return e.FunctionRegion}}),Object.defineProperty(_e,"FunctionsError",{enumerable:!0,get:function(){return e.FunctionsError}}),Object.defineProperty(_e,"FunctionsFetchError",{enumerable:!0,get:function(){return e.FunctionsFetchError}}),Object.defineProperty(_e,"FunctionsHttpError",{enumerable:!0,get:function(){return e.FunctionsHttpError}}),Object.defineProperty(_e,"FunctionsRelayError",{enumerable:!0,get:function(){return e.FunctionsRelayError}}),Object.defineProperty(_e,"PostgrestError",{enumerable:!0,get:function(){return t.PostgrestError}}),Object.defineProperty(_e,"StorageApiError",{enumerable:!0,get:function(){return r.StorageApiError}}),Object.defineProperty(_e,"SupabaseClient",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"createClient",{enumerable:!0,get:function(){return N}});var e=_r(d[0]),t=_r(d[1]),n=_r(d[2]);Object.keys(n).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return n[e]}})});var r=_r(d[3]),s=_r(d[4]);Object.keys(s).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return s[e]}})});let o,i="";var c;if("undefined"!=typeof Deno)i="deno",o=null===(c=Deno.version)||void 0===c?void 0:c.deno;else if("undefined"!=typeof document)i="web";else if("undefined"!=typeof navigator&&"ReactNative"===navigator.product)i="react-native";else{var u;i="node",o="undefined"!=typeof process?null===(u=process.version)||void 0===u?void 0:u.replace(/^v/,""):void 0}const l=[`runtime=${i}`];o&&l.push(`runtime-version=${o}`);const h={headers:{"X-Client-Info":`supabase-js/2.109.0; ${l.join("; ")}`}},f={schema:"public"},p={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},b={},v={enabled:!1,respectSamplingDecision:!0};let y=null;function w(){return e=this,t=void 0,r=function*(){try{const e=yield(null===y&&(y=import("@opentelemetry/api").catch(()=>null)),y);if(!e||!e.propagation||!e.context)return null;const t={};e.propagation.inject(e.context.active(),t);const n=t.traceparent;return n?{traceparent:n,tracestate:t.tracestate,baggage:t.baggage}:null}catch(e){return null}},new((n=void 0)||(n=Promise))(function(s,o){function i(e){try{u(r.next(e))}catch(e){o(e)}}function c(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(i,c)}u((r=r.apply(e,t||[])).next())});var e,t,n,r}function k(e){if(!e||"string"!=typeof e)return null;const t=e.split("-");if(4!==t.length)return null;const[n,r,s,o]=t;if(2!==n.length||32!==r.length||16!==s.length||2!==o.length)return null;const i=/^[0-9a-f]+$/i;return i.test(n)&&i.test(r)&&i.test(s)&&i.test(o)?"00000000000000000000000000000000"===r||"0000000000000000"===s?null:{version:n,traceId:r,parentId:s,traceFlags:o,isSampled:!(1&~parseInt(o,16))}:null}function O(e,t){if(!e||!t||0===t.length)return!1;let n;if(e instanceof URL)n=e;else try{n=new URL(e)}catch(e){return!1}for(const e of t)try{if("string"==typeof e){if(T(n.hostname,e))return!0}else if(e instanceof RegExp){if(e.test(n.hostname))return!0}else if("function"==typeof e&&e(n))return!0}catch(e){continue}return!1}function T(e,t){if(t===e)return!0;if(t.startsWith("*.")){const n=t.slice(2);if(e.endsWith(n)&&(e===n||e.endsWith("."+n)))return!0}return!1}function P(e){const t=[];try{const n=new URL(e);t.push(n.hostname)}catch(e){}return t.push("*.supabase.co","*.supabase.in"),t.push("localhost","127.0.0.1","[::1]"),t}function S(e){return(S="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function j(e,t){if("object"!=S(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=S(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function E(e){var t=j(e,"string");return"symbol"==S(t)?t:t+""}function U(e,t,n){return(t=E(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function A(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function R(e){for(var t=1;te?(...t)=>e(...t):(...e)=>fetch(...e),F=(e,t,n,r,s)=>{const o=C(r),i=Headers,c=!0===(null==s?void 0:s.enabled),u=!1!==(null==s?void 0:s.respectSamplingDecision),l=c?P(t):null;return async(t,r)=>{var s;const c=null!==(s=await n())&&void 0!==s?s:e;let h=new i(null==r?void 0:r.headers);if(h.has("apikey")||h.set("apikey",e),h.has("Authorization")||h.set("Authorization",`Bearer ${c}`),l){const e=await _(t,l,u);e&&(e.traceparent&&!h.has("traceparent")&&h.set("traceparent",e.traceparent),e.tracestate&&!h.has("tracestate")&&h.set("tracestate",e.tracestate),e.baggage&&!h.has("baggage")&&h.set("baggage",e.baggage))}return o(t,R(R({},r),{},{headers:h}))}};async function _(e,t,n){if(!O("string"==typeof e||e instanceof URL?e:e.url,t))return null;const r=await w();if(!r||!r.traceparent)return null;if(n){const e=k(r.traceparent);if(e&&!e.isSampled)return null}return r}function L(e){return"boolean"==typeof e?{enabled:e}:e}function I(e,t){var n,r,s,o,i,c;const{db:u,auth:l,realtime:h,global:f}=e,{db:p,auth:b,realtime:v,global:y}=t,w=L(e.tracePropagation),k=L(t.tracePropagation),O={db:R(R({},p),u),auth:R(R({},b),l),realtime:R(R({},v),h),storage:{},global:R(R(R({},y),f),{},{headers:R(R({},null!==(n=null==y?void 0:y.headers)&&void 0!==n?n:{}),null!==(r=null==f?void 0:f.headers)&&void 0!==r?r:{})}),tracePropagation:{enabled:null!==(s=null!==(o=null==w?void 0:w.enabled)&&void 0!==o?o:null==k?void 0:k.enabled)&&void 0!==s&&s,respectSamplingDecision:null===(i=null!==(c=null==w?void 0:w.respectSamplingDecision)&&void 0!==c?c:null==k?void 0:k.respectSamplingDecision)||void 0===i||i},accessToken:async()=>""};return e.accessToken?O.accessToken=e.accessToken:delete O.accessToken,O}function D(e){const t=null==e?void 0:e.trim();if(!t)throw new Error("supabaseUrl is required.");if(!t.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL((n=t).endsWith("/")?n:n+"/")}catch(e){throw Error("Invalid supabaseUrl: Provided URL is malformed.")}var n}var K=class extends s.AuthClient{constructor(e){super(e)}},x=class{constructor(e,n,s){var o,i;this.supabaseUrl=e,this.supabaseKey=n;const c=D(e);if(!n)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",c),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",c),this.storageUrl=new URL("storage/v1",c),this.functionsUrl=new URL("functions/v1",c);const u=`sb-${c.hostname.split(".")[0]}-auth-token`,l=I(null!=s?s:{},{db:f,realtime:b,auth:R(R({},p),{},{storageKey:u}),global:h,tracePropagation:v});var y;(this.settings=l,this.storageKey=null!==(o=l.auth.storageKey)&&void 0!==o?o:"",this.headers=null!==(i=l.global.headers)&&void 0!==i?i:{},l.accessToken)?(this.accessToken=l.accessToken,this.auth=new Proxy({},{get:(e,t)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(t)} is not possible`)}})):this.auth=this._initSupabaseAuthClient(null!==(y=l.auth)&&void 0!==y?y:{},this.headers,l.global.fetch);this.fetch=F(n,e,this._getAccessToken.bind(this),l.global.fetch,l.tracePropagation),this.realtime=this._initRealtimeClient(R({headers:this.headers,accessToken:this._getAccessToken.bind(this),fetch:this.fetch},l.realtime)),this.accessToken&&Promise.resolve(this.accessToken()).then(e=>this.realtime.setAuth(e)).catch(e=>console.warn("Failed to set initial Realtime auth token:",e)),this.rest=new t.PostgrestClient(new URL("rest/v1",c).href,{headers:this.headers,schema:l.db.schema,fetch:this.fetch,timeout:l.db.timeout,urlLengthLimit:l.db.urlLengthLimit}),this.storage=new r.StorageClient(this.storageUrl.href,this.headers,this.fetch,null==s?void 0:s.storage),l.accessToken||this._listenForAuthEvents()}get functions(){return new e.FunctionsClient(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e,t={},n={head:!1,get:!1,count:void 0}){return this.rest.rpc(e,t,n)}channel(e,t={config:{}}){return this.realtime.channel(e,t)}getChannels(){return this.realtime.getChannels()}removeChannel(e){return this.realtime.removeChannel(e)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var e,t,n=this;if(n.accessToken)return await n.accessToken();const{data:r}=await n.auth.getSession();return null!==(e=null===(t=r.session)||void 0===t?void 0:t.access_token)&&void 0!==e?e:n.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:t,detectSessionInUrl:n,storage:r,userStorage:s,storageKey:o,flowType:i,lock:c,debug:u,throwOnError:l,experimental:h,lockAcquireTimeout:f,skipAutoInitialize:p},b,v){const y={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new K({url:this.authUrl.href,headers:R(R({},y),b),storageKey:o,autoRefreshToken:e,persistSession:t,detectSessionInUrl:n,storage:r,userStorage:s,flowType:i,lock:c,debug:u,throwOnError:l,experimental:h,fetch:v,lockAcquireTimeout:f,skipAutoInitialize:p,hasCustomAuthorizationHeader:Object.keys(this.headers).some(e=>"authorization"===e.toLowerCase())})}_initRealtimeClient(e){return new n.RealtimeClient(this.realtimeUrl.href,R(R({},e),{},{params:R(R({},{apikey:this.supabaseKey}),null==e?void 0:e.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((e,t)=>{this._handleTokenChanged(e,"CLIENT",null==t?void 0:t.access_token)})}_handleTokenChanged(e,t,n){"TOKEN_REFRESHED"!==e&&"SIGNED_IN"!==e||this.changedAccessToken===n?"SIGNED_OUT"===e&&(this.realtime.setAuth(),"STORAGE"==t&&this.auth.signOut(),this.changedAccessToken=void 0):(this.changedAccessToken=n,this.realtime.setAuth(n))}};const N=(e,t,n)=>new x(e,t,n);(function(){if("undefined"!=typeof window)return!1;const e=globalThis.process;if(!e)return!1;const t=e.version;if(null==t)return!1;const n=t.match(/^v(\d+)\./);return!!n&&parseInt(n[1],10)<=18})()&&console.warn("\u26a0\ufe0f Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217")},1154,[1155,1160,1161,1176,1178]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"FunctionsClient",{enumerable:!0,get:function(){return n.FunctionsClient}}),Object.defineProperty(e,"FunctionsError",{enumerable:!0,get:function(){return t.FunctionsError}}),Object.defineProperty(e,"FunctionsFetchError",{enumerable:!0,get:function(){return t.FunctionsFetchError}}),Object.defineProperty(e,"FunctionsHttpError",{enumerable:!0,get:function(){return t.FunctionsHttpError}}),Object.defineProperty(e,"FunctionsRelayError",{enumerable:!0,get:function(){return t.FunctionsRelayError}}),Object.defineProperty(e,"FunctionRegion",{enumerable:!0,get:function(){return t.FunctionRegion}});var n=r(d[0]),t=r(d[1])},1155,[1156,1159]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"FunctionsClient",{enumerable:!0,get:function(){return s}});var t=r(d[0]),n=r(d[1]),o=r(d[2]);class s{constructor(t,{headers:s={},customFetch:c,region:l=o.FunctionRegion.Any}={}){this.url=t,this.headers=s,this.region=l,this.fetch=(0,n.resolveFetch)(c)}setAuth(t){this.headers.Authorization=`Bearer ${t}`}invoke(n){return(0,t.__awaiter)(this,arguments,void 0,function*(t,n={}){var s;let c,l;try{const{headers:u,method:f,body:h,signal:p,timeout:y}=n;let b={},{region:F}=n;F||(F=this.region);const v=new URL(`${this.url}/${t}`);let w;F&&'any'!==F&&(b['x-region']=F,v.searchParams.set('forceFunctionRegion',F));const j=!!u&&Object.keys(u).some(t=>'content-type'===t.toLowerCase());h&&!j?'undefined'!=typeof Blob&&h instanceof Blob||h instanceof ArrayBuffer?(b['Content-Type']='application/octet-stream',w=h):'string'==typeof h?(b['Content-Type']='text/plain',w=h):'undefined'!=typeof FormData&&h instanceof FormData?w=h:(b['Content-Type']='application/json',w=JSON.stringify(h)):w=!h||'string'==typeof h||'undefined'!=typeof Blob&&h instanceof Blob||h instanceof ArrayBuffer||'undefined'!=typeof FormData&&h instanceof FormData?h:JSON.stringify(h);let O=p;y&&(l=new AbortController,c=setTimeout(()=>l.abort(),y),p?(O=l.signal,p.addEventListener('abort',()=>l.abort())):O=l.signal);const x=yield this.fetch(v.toString(),{method:f||'POST',headers:Object.assign(Object.assign(Object.assign({},b),this.headers),u),body:w,signal:O}).catch(t=>{throw new o.FunctionsFetchError(t)}),B=x.headers.get('x-relay-error');if(B&&'true'===B)throw new o.FunctionsRelayError(x);if(!x.ok)throw new o.FunctionsHttpError(x);let C,T=(null!==(s=x.headers.get('Content-Type'))&&void 0!==s?s:'text/plain').split(';')[0].trim();return C='application/json'===T?yield x.json():'application/octet-stream'===T||'application/pdf'===T?yield x.blob():'text/event-stream'===T?x:'multipart/form-data'===T?yield x.formData():yield x.text(),{data:C,error:null,response:x}}catch(t){return{data:null,error:t,response:t instanceof o.FunctionsHttpError||t instanceof o.FunctionsRelayError?t.context:void 0}}finally{c&&clearTimeout(c)}})}}},1156,[1157,1158,1159]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return G}}),_e.__extends=t,Object.defineProperty(_e,"__assign",{enumerable:!0,get:function(){return r}}),_e.__rest=n,_e.__decorate=o,_e.__param=a,_e.__esDecorate=i,_e.__runInitializers=c,_e.__propKey=u,_e.__setFunctionName=s,_e.__metadata=f,_e.__awaiter=l,_e.__generator=p,Object.defineProperty(_e,"__createBinding",{enumerable:!0,get:function(){return y}}),_e.__exportStar=_,_e.__values=d,_e.__read=h,_e.__spread=b,_e.__spreadArrays=v,_e.__spreadArray=w,_e.__await=m,_e.__asyncGenerator=g,_e.__asyncDelegator=O,_e.__asyncValues=j,_e.__makeTemplateObject=P,_e.__importStar=x,_e.__importDefault=T,_e.__classPrivateFieldGet=I,_e.__classPrivateFieldSet=D,_e.__classPrivateFieldIn=R,_e.__addDisposableResource=k,_e.__disposeResources=F,_e.__rewriteRelativeImportExtension=C;var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};function t(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}var r=function(){return r=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=0;c--)(o=e[c])&&(i=(a<3?o(i):a>3?o(t,r,i):o(t,r))||i);return a>3&&i&&Object.defineProperty(t,r,i),i}function a(e,t){return function(r,n){t(r,n,e)}}function i(e,t,r,n,o,a){function i(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var c,u=n.kind,s="getter"===u?"get":"setter"===u?"set":"value",f=!t&&e?n.static?e:e.prototype:null,l=t||(f?Object.getOwnPropertyDescriptor(f,n.name):{}),p=!1,y=r.length-1;y>=0;y--){var _={};for(var d in n)_[d]="access"===d?{}:n[d];for(var d in n.access)_.access[d]=n.access[d];_.addInitializer=function(e){if(p)throw new TypeError("Cannot add initializers after decoration has completed");a.push(i(e||null))};var h=(0,r[y])("accessor"===u?{get:l.get,set:l.set}:l[s],_);if("accessor"===u){if(void 0===h)continue;if(null===h||"object"!=typeof h)throw new TypeError("Object expected");(c=i(h.get))&&(l.get=c),(c=i(h.set))&&(l.set=c),(c=i(h.init))&&o.unshift(c)}else(c=i(h))&&("field"===u?o.unshift(c):l[s]=c)}f&&Object.defineProperty(f,n.name,l),p=!0}function c(e,t,r){for(var n=arguments.length>2,o=0;o0&&o[o.length-1])||6!==c[0]&&2!==c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function h(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,a=r.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)i.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(o)throw o.error}}return i}function b(){for(var e=[],t=0;t1||c(e,t)})},t&&(n[e]=t(n[e])))}function c(e,t){try{(r=o[e](t)).value instanceof m?Promise.resolve(r.value.v).then(u,s):f(a[0][2],r)}catch(e){f(a[0][3],e)}var r}function u(e){c("next",e)}function s(e){c("throw",e)}function f(e,t){e(t),a.shift(),a.length&&c(a[0][0],a[0][1])}}function O(e){var t,r;return t={},n("next"),n("throw",function(e){throw e}),n("return"),t[Symbol.iterator]=function(){return this},t;function n(n,o){t[n]=e[n]?function(t){return(r=!r)?{value:m(e[n](t)),done:!1}:o?o(t):t}:o}}function j(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=d(e),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise(function(n,a){o(n,a,(t=e[r](t)).done,t.value)})}}function o(e,t,r,n){Promise.resolve(n).then(function(t){e({value:t,done:r})},t)}}function P(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var S=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t},E=function(e){return E=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t},E(e)};function x(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r=E(e),n=0;nt?(...n)=>t(...n):(...t)=>fetch(...t)},1158,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"FunctionsError",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"FunctionsFetchError",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"FunctionsRelayError",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"FunctionsHttpError",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"FunctionRegion",{enumerable:!0,get:function(){return u}});class t extends Error{constructor(t,n="FunctionsError",s){super(t),this.name=n,this.context=s}toJSON(){return{name:this.name,message:this.message,context:this.context}}}class n extends t{constructor(t){super('Failed to send a request to the Edge Function','FunctionsFetchError',t)}}class s extends t{constructor(t){super('Relay Error invoking the Edge Function','FunctionsRelayError',t)}}class o extends t{constructor(t){super('Edge Function returned a non-2xx status code','FunctionsHttpError',t)}}var u;!(function(t){t.Any="any",t.ApNortheast1="ap-northeast-1",t.ApNortheast2="ap-northeast-2",t.ApSouth1="ap-south-1",t.ApSoutheast1="ap-southeast-1",t.ApSoutheast2="ap-southeast-2",t.CaCentral1="ca-central-1",t.EuCentral1="eu-central-1",t.EuWest1="eu-west-1",t.EuWest2="eu-west-2",t.EuWest3="eu-west-3",t.SaEast1="sa-east-1",t.UsEast1="us-east-1",t.UsWest1="us-west-1",t.UsWest2="us-west-2"})(u||(u={}))},1159,[]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"PostgrestBuilder",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"PostgrestClient",{enumerable:!0,get:function(){return $}}),Object.defineProperty(_e,"PostgrestError",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"PostgrestFilterBuilder",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"PostgrestQueryBuilder",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"PostgrestTransformBuilder",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return w}});const e=e=>Math.min(1e3*2**e,3e4),t=[520,503],r=["GET","HEAD","OPTIONS"];var s=class extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.code=e.code}toJSON(){return{name:this.name,message:this.message,details:this.details,hint:this.hint,code:this.code}}};function n(e,t){return new Promise(r=>{if(null==t?void 0:t.aborted)return void r();const s=setTimeout(()=>{null==t||t.removeEventListener("abort",n),r()},e);function n(){clearTimeout(s),r()}null==t||t.addEventListener("abort",n)})}function i(e,s,n,i){return!(!i||n>=3)&&(!!r.includes(e)&&!!t.includes(s))}var l=class{constructor(e){var t,r,s,n,i;this.shouldThrowOnError=!1,this.retryEnabled=!0,this.method=e.method,this.url=e.url,this.headers=new Headers(e.headers),this.schema=e.schema,this.body=e.body,this.shouldThrowOnError=null!==(t=e.shouldThrowOnError)&&void 0!==t&&t,this.signal=e.signal,this.isMaybeSingle=null!==(r=e.isMaybeSingle)&&void 0!==r&&r,this.shouldStripNulls=null!==(s=e.shouldStripNulls)&&void 0!==s&&s,this.urlLengthLimit=null!==(n=e.urlLengthLimit)&&void 0!==n?n:8e3,this.retryEnabled=null===(i=e.retry)||void 0===i||i,e.fetch?this.fetch=e.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}stripNulls(){if("text/csv"===this.headers.get("Accept"))throw new Error("stripNulls() cannot be used with csv()");return this.shouldStripNulls=!0,this}setHeader(e,t){return this.headers=new Headers(this.headers),this.headers.set(e,t),this}retry(e){return this.retryEnabled=e,this}then(t,s){var l=this;if(void 0===this.schema||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),"GET"!==this.method&&"HEAD"!==this.method&&this.headers.set("Content-Type","application/json"),this.shouldStripNulls){const e=this.headers.get("Accept");"application/vnd.pgrst.object+json"===e?this.headers.set("Accept","application/vnd.pgrst.object+json;nulls=stripped"):e&&"application/json"!==e||this.headers.set("Accept","application/vnd.pgrst.array+json;nulls=stripped")}const o=this.fetch;let h=(async()=>{let t=0;for(;;){const u={};let c;l.headers.forEach((e,t)=>{u[t]=e}),t>0&&(u["X-Retry-Count"]=String(t));try{c=await o(l.url.toString(),{method:l.method,headers:u,body:JSON.stringify(l.body,(e,t)=>"bigint"==typeof t?t.toString():t),signal:l.signal})}catch(s){if("AbortError"===(null==s?void 0:s.name)||"ABORT_ERR"===(null==s?void 0:s.code))throw s;if(!r.includes(l.method))throw s;if(l.retryEnabled&&t<3){const r=e(t);t++,await n(r,l.signal);continue}throw s}if(i(l.method,c.status,t,l.retryEnabled)){var s,h;const r=null!==(s=null===(h=c.headers)||void 0===h?void 0:h.get("Retry-After"))&&void 0!==s?s:null,i=null!==r?1e3*Math.max(0,parseInt(r,10)||0):e(t);await c.text(),t++,await n(i,l.signal);continue}return await l.processResponse(c)}})();return this.shouldThrowOnError||(h=h.catch(e=>{var t;let r="",s="",n="";const i=null==e?void 0:e.cause;if(i){var l,o,h,u;const t=null!==(l=null==i?void 0:i.message)&&void 0!==l?l:"",s=null!==(o=null==i?void 0:i.code)&&void 0!==o?o:"";r=`${null!==(h=null==e?void 0:e.name)&&void 0!==h?h:"FetchError"}: ${null==e?void 0:e.message}`,r+=`\n\nCaused by: ${null!==(u=null==i?void 0:i.name)&&void 0!==u?u:"Error"}: ${t}`,s&&(r+=` (${s})`),(null==i?void 0:i.stack)&&(r+=`\n${i.stack}`)}else{var c;r=null!==(c=null==e?void 0:e.stack)&&void 0!==c?c:""}const p=this.url.toString().length;return"AbortError"===(null==e?void 0:e.name)||"ABORT_ERR"===(null==e?void 0:e.code)?(n="",s="Request was aborted (timeout or manual cancellation)",p>this.urlLengthLimit&&(s+=`. Note: Your request URL is ${p} characters, which may exceed server limits. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [many IDs])), consider using an RPC function to pass values server-side.`)):"HeadersOverflowError"!==(null==i?void 0:i.name)&&"UND_ERR_HEADERS_OVERFLOW"!==(null==i?void 0:i.code)||(n="",s="HTTP headers exceeded server limits (typically 16KB)",p>this.urlLengthLimit&&(s+=`. Your request URL is ${p} characters. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [200+ IDs])), consider using an RPC function instead.`)),{success:!1,error:{message:`${null!==(t=null==e?void 0:e.name)&&void 0!==t?t:"FetchError"}: ${null==e?void 0:e.message}`,details:r,hint:s,code:n},data:null,count:null,status:0,statusText:""}})),h.then(t,s)}async processResponse(e){var t=this;let r=null,n=null,i=null,l=e.status,o=e.statusText;if(e.ok){var h,u;if("HEAD"!==t.method){var c;const i=await e.text();if(""===i);else if("text/csv"===t.headers.get("Accept"))n=i;else if(t.headers.get("Accept")&&(null===(c=t.headers.get("Accept"))||void 0===c?void 0:c.includes("application/vnd.pgrst.plan+text")))n=i;else try{n=JSON.parse(i)}catch(e){if(r={message:i},n=null,t.shouldThrowOnError)throw new s({message:i,details:"",hint:"",code:""})}}const p=null===(h=t.headers.get("Prefer"))||void 0===h?void 0:h.match(/count=(exact|planned|estimated)/),f=null===(u=e.headers.get("content-range"))||void 0===u?void 0:u.split("/");p&&f&&f.length>1&&(i=parseInt(f[1])),t.isMaybeSingle&&Array.isArray(n)&&(n.length>1?(r={code:"PGRST116",details:`Results contain ${n.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},n=null,i=null,l=406,o="Not Acceptable"):n=1===n.length?n[0]:null)}else{const i=await e.text();try{r=JSON.parse(i),Array.isArray(r)&&404===e.status&&(n=[],r=null,l=200,o="OK")}catch(t){404===e.status&&""===i?(l=204,o="No Content"):r={message:i}}if(r&&t.shouldThrowOnError)throw new s(r)}return{success:null===r,error:r,data:n,count:i,status:l,statusText:o}}returns(){return this}overrideTypes(){return this}},o=class extends l{throwOnError(){return super.throwOnError()}select(e){let t=!1;const r=(null!=e?e:"*").split("").map(e=>/\s/.test(e)&&!t?"":("\""===e&&(t=!t),e)).join("");return this.url.searchParams.set("select",r),this.headers.append("Prefer","return=representation"),this}order(e,{ascending:t=!0,nullsFirst:r,foreignTable:s,referencedTable:n=s}={}){const i=n?`${n}.order`:"order",l=this.url.searchParams.get(i);return this.url.searchParams.set(i,`${l?`${l},`:""}${e}.${t?"asc":"desc"}${void 0===r?"":r?".nullsfirst":".nullslast"}`),this}limit(e,{foreignTable:t,referencedTable:r=t}={}){const s=void 0===r?"limit":`${r}.limit`;return this.url.searchParams.set(s,`${e}`),this}range(e,t,{foreignTable:r,referencedTable:s=r}={}){const n=void 0===s?"offset":`${s}.offset`,i=void 0===s?"limit":`${s}.limit`;return this.url.searchParams.set(n,`${e}`),this.url.searchParams.set(i,""+(t-e+1)),this}abortSignal(e){return this.signal=e,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:e=!1,verbose:t=!1,settings:r=!1,buffers:s=!1,wal:n=!1,format:i="text"}={}){var l;const o=[e?"analyze":null,t?"verbose":null,r?"settings":null,s?"buffers":null,n?"wal":null].filter(Boolean).join("|"),h=null!==(l=this.headers.get("Accept"))&&void 0!==l?l:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${i}; for="${h}"; options=${o};`),this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(e){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${e}`),this}};const h=new RegExp("[,()]");var u=class extends o{throwOnError(){return super.throwOnError()}eq(e,t){return this.url.searchParams.append(e,`eq.${t}`),this}neq(e,t){return this.url.searchParams.append(e,`neq.${t}`),this}gt(e,t){return this.url.searchParams.append(e,`gt.${t}`),this}gte(e,t){return this.url.searchParams.append(e,`gte.${t}`),this}lt(e,t){return this.url.searchParams.append(e,`lt.${t}`),this}lte(e,t){return this.url.searchParams.append(e,`lte.${t}`),this}like(e,t){return this.url.searchParams.append(e,`like.${t}`),this}likeAllOf(e,t){return this.url.searchParams.append(e,`like(all).{${t.join(",")}}`),this}likeAnyOf(e,t){return this.url.searchParams.append(e,`like(any).{${t.join(",")}}`),this}ilike(e,t){return this.url.searchParams.append(e,`ilike.${t}`),this}ilikeAllOf(e,t){return this.url.searchParams.append(e,`ilike(all).{${t.join(",")}}`),this}ilikeAnyOf(e,t){return this.url.searchParams.append(e,`ilike(any).{${t.join(",")}}`),this}regexMatch(e,t){return this.url.searchParams.append(e,`match.${t}`),this}regexIMatch(e,t){return this.url.searchParams.append(e,`imatch.${t}`),this}is(e,t){return this.url.searchParams.append(e,`is.${t}`),this}isDistinct(e,t){return this.url.searchParams.append(e,`isdistinct.${t}`),this}in(e,t){const r=Array.from(new Set(t)).map(e=>"string"==typeof e&&h.test(e)?`"${e}"`:`${e}`).join(",");return this.url.searchParams.append(e,`in.(${r})`),this}notIn(e,t){const r=Array.from(new Set(t)).map(e=>"string"==typeof e&&h.test(e)?`"${e}"`:`${e}`).join(",");return this.url.searchParams.append(e,`not.in.(${r})`),this}contains(e,t){return"string"==typeof t?this.url.searchParams.append(e,`cs.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cs.{${t.join(",")}}`):this.url.searchParams.append(e,`cs.${JSON.stringify(t)}`),this}containedBy(e,t){return"string"==typeof t?this.url.searchParams.append(e,`cd.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cd.{${t.join(",")}}`):this.url.searchParams.append(e,`cd.${JSON.stringify(t)}`),this}rangeGt(e,t){return this.url.searchParams.append(e,`sr.${t}`),this}rangeGte(e,t){return this.url.searchParams.append(e,`nxl.${t}`),this}rangeLt(e,t){return this.url.searchParams.append(e,`sl.${t}`),this}rangeLte(e,t){return this.url.searchParams.append(e,`nxr.${t}`),this}rangeAdjacent(e,t){return this.url.searchParams.append(e,`adj.${t}`),this}overlaps(e,t){return"string"==typeof t?this.url.searchParams.append(e,`ov.${t}`):this.url.searchParams.append(e,`ov.{${t.join(",")}}`),this}textSearch(e,t,{config:r,type:s}={}){let n="";"plain"===s?n="pl":"phrase"===s?n="ph":"websearch"===s&&(n="w");const i=void 0===r?"":`(${r})`;return this.url.searchParams.append(e,`${n}fts${i}.${t}`),this}match(e){return Object.entries(e).filter(([e,t])=>void 0!==t).forEach(([e,t])=>{this.url.searchParams.append(e,`eq.${t}`)}),this}not(e,t,r){return this.url.searchParams.append(e,`not.${t}.${r}`),this}or(e,{foreignTable:t,referencedTable:r=t}={}){const s=r?`${r}.or`:"or";return this.url.searchParams.append(s,`(${e})`),this}filter(e,t,r){return this.url.searchParams.append(e,`${t}.${r}`),this}},c=class{constructor(e,{headers:t={},schema:r,fetch:s,urlLengthLimit:n=8e3,retry:i}){this.url=e,this.headers=new Headers(t),this.schema=r,this.fetch=s,this.urlLengthLimit=n,this.retry=i}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(e,t){const{head:r=!1,count:s}=null!=t?t:{},n=r?"HEAD":"GET";let i=!1;const l=(null!=e?e:"*").split("").map(e=>/\s/.test(e)&&!i?"":("\""===e&&(i=!i),e)).join(""),{url:o,headers:h}=this.cloneRequestState();return o.searchParams.set("select",l),s&&h.append("Prefer",`count=${s}`),new u({method:n,url:o,headers:h,schema:this.schema,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}insert(e,{count:t,defaultToNull:r=!0}={}){var s;const{url:n,headers:i}=this.cloneRequestState();if(t&&i.append("Prefer",`count=${t}`),r||i.append("Prefer","missing=default"),Array.isArray(e)){const t=e.reduce((e,t)=>e.concat(Object.keys(t)),[]);if(t.length>0){const e=[...new Set(t)].map(e=>`"${e}"`);n.searchParams.set("columns",e.join(","))}}return new u({method:"POST",url:n,headers:i,schema:this.schema,body:e,fetch:null!==(s=this.fetch)&&void 0!==s?s:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}upsert(e,{onConflict:t,ignoreDuplicates:r=!1,count:s,defaultToNull:n=!0}={}){var i;const{url:l,headers:o}=this.cloneRequestState();if(o.append("Prefer",`resolution=${r?"ignore":"merge"}-duplicates`),void 0!==t&&l.searchParams.set("on_conflict",t),s&&o.append("Prefer",`count=${s}`),n||o.append("Prefer","missing=default"),Array.isArray(e)){const t=e.reduce((e,t)=>e.concat(Object.keys(t)),[]);if(t.length>0){const e=[...new Set(t)].map(e=>`"${e}"`);l.searchParams.set("columns",e.join(","))}}return new u({method:"POST",url:l,headers:o,schema:this.schema,body:e,fetch:null!==(i=this.fetch)&&void 0!==i?i:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}update(e,{count:t}={}){var r;const{url:s,headers:n}=this.cloneRequestState();return t&&n.append("Prefer",`count=${t}`),new u({method:"PATCH",url:s,headers:n,schema:this.schema,body:e,fetch:null!==(r=this.fetch)&&void 0!==r?r:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}delete({count:e}={}){var t;const{url:r,headers:s}=this.cloneRequestState();return e&&s.append("Prefer",`count=${e}`),new u({method:"DELETE",url:r,headers:s,schema:this.schema,fetch:null!==(t=this.fetch)&&void 0!==t?t:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};function p(e){return(p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function f(e,t){if("object"!=p(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var s=r.call(e,t||"default");if("object"!=p(s))return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function y(e){var t=f(e,"string");return"symbol"==p(t)?t:t+""}function v(e,t,r){return(t=y(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function b(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,s)}return r}function P(e){for(var t=1;t0?(e,t)=>{const r=new AbortController,s=setTimeout(()=>r.abort(),n),i=null==t?void 0:t.signal;if(i){if(i.aborted)return clearTimeout(s),o(e,t);const n=()=>{clearTimeout(s),r.abort()};return i.addEventListener("abort",n,{once:!0}),o(e,P(P({},t),{},{signal:r.signal})).finally(()=>{clearTimeout(s),i.removeEventListener("abort",n)})}return o(e,P(P({},t),{},{signal:r.signal})).finally(()=>clearTimeout(s))}:o,this.retry=l}from(e){if(!e||"string"!=typeof e||""===e.trim())throw new Error("Invalid relation name: relation must be a non-empty string.");return new c(new URL(`${this.url}/${e}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}schema(t){return new e(this.url,{headers:this.headers,schema:t,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}rpc(e,t={},{head:r=!1,get:s=!1,count:n}={}){var i;let l;const o=new URL(`${this.url}/rpc/${e}`);let h;const c=e=>null!==e&&"object"==typeof e&&(!Array.isArray(e)||e.some(c)),p=r&&Object.values(t).some(c);p?(l="POST",h=t):r||s?(l=r?"HEAD":"GET",Object.entries(t).filter(([e,t])=>void 0!==t).map(([e,t])=>[e,Array.isArray(t)?`{${t.join(",")}}`:`${t}`]).forEach(([e,t])=>{o.searchParams.append(e,t)})):(l="POST",h=t);const f=new Headers(this.headers);return p?f.set("Prefer",n?`count=${n},return=minimal`:"return=minimal"):n&&f.set("Prefer",`count=${n}`),new u({method:l,url:o,headers:f,schema:this.schemaName,body:h,fetch:null!==(i=this.fetch)&&void 0!==i?i:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}},w={PostgrestClient:$,PostgrestQueryBuilder:c,PostgrestFilterBuilder:u,PostgrestTransformBuilder:o,PostgrestBuilder:l,PostgrestError:s}},1160,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"RealtimePresence",{enumerable:!0,get:function(){return o.default}}),Object.defineProperty(_e,"RealtimeChannel",{enumerable:!0,get:function(){return E.default}}),Object.defineProperty(_e,"RealtimeClient",{enumerable:!0,get:function(){return t.default}}),Object.defineProperty(_e,"RealtimePostgresFilterBuilder",{enumerable:!0,get:function(){return n.RealtimePostgresFilterBuilder}}),Object.defineProperty(_e,"postgresChangesFilter",{enumerable:!0,get:function(){return n.postgresChangesFilter}}),Object.defineProperty(_e,"REALTIME_LISTEN_TYPES",{enumerable:!0,get:function(){return n.REALTIME_LISTEN_TYPES}}),Object.defineProperty(_e,"REALTIME_POSTGRES_CHANGES_LISTEN_EVENT",{enumerable:!0,get:function(){return n.REALTIME_POSTGRES_CHANGES_LISTEN_EVENT}}),Object.defineProperty(_e,"REALTIME_PRESENCE_LISTEN_EVENTS",{enumerable:!0,get:function(){return u.REALTIME_PRESENCE_LISTEN_EVENTS}}),Object.defineProperty(_e,"REALTIME_SUBSCRIBE_STATES",{enumerable:!0,get:function(){return n.REALTIME_SUBSCRIBE_STATES}}),Object.defineProperty(_e,"REALTIME_CHANNEL_STATES",{enumerable:!0,get:function(){return n.REALTIME_CHANNEL_STATES}}),Object.defineProperty(_e,"WebSocketFactory",{enumerable:!0,get:function(){return l.default}});var t=e(r(d[0])),n=r(d[1]),E=e(n),u=r(d[2]),o=e(u),l=e(r(d[3]))},1161,[1162,1168,1169,1163]); +__d(function(g,r,i,a,m,_e2,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"default",{enumerable:!0,get:function(){return f}});var t=e(r(d[0])),n=r(d[1]),s=e(r(d[2])),o=r(d[3]),c=e(r(d[4])),l=e(r(d[5]));const h=25e3,u=[1e3,2e3,5e3,1e4];function k(){const e=new Map;return{get length(){return e.size},clear(){e.clear()},getItem:t=>e.has(t)?e.get(t):null,key(t){var n;return null!==(n=Array.from(e.keys())[t])&&void 0!==n?n:null},removeItem(t){e.delete(t)},setItem(t,n){e.set(t,String(n))}}}function p(){try{if('undefined'!=typeof globalThis&&globalThis.sessionStorage)return globalThis.sessionStorage}catch(e){}return k()}class f{get endPoint(){return this.socketAdapter.endPoint}get timeout(){return this.socketAdapter.timeout}get transport(){return this.socketAdapter.transport}get heartbeatCallback(){return this.socketAdapter.heartbeatCallback}get heartbeatIntervalMs(){return this.socketAdapter.heartbeatIntervalMs}get heartbeatTimer(){return this.worker?this._workerHeartbeatTimer:this.socketAdapter.heartbeatTimer}get pendingHeartbeatRef(){return this.worker?this._pendingWorkerHeartbeatRef:this.socketAdapter.pendingHeartbeatRef}get reconnectTimer(){return this.socketAdapter.reconnectTimer}get vsn(){return this.socketAdapter.vsn}get encode(){return this.socketAdapter.encode}get decode(){return this.socketAdapter.decode}get reconnectAfterMs(){return this.socketAdapter.reconnectAfterMs}get sendBuffer(){return this.socketAdapter.sendBuffer}get stateChangeCallbacks(){return this.socketAdapter.stateChangeCallbacks}constructor(e,t){var n;if(this.channels=new Array,this.accessTokenValue=null,this.accessToken=null,this.apiKey=null,this.httpEndpoint='',this.headers={},this.params={},this.ref=0,this.serializer=new s.default,this._manuallySetToken=!1,this._authPromise=null,this._workerHeartbeatTimer=void 0,this._pendingWorkerHeartbeatRef=null,this._pendingDisconnectTimer=null,this._disconnectOnEmptyChannelsAfterMs=0,this._resolveFetch=e=>e?(...t)=>e(...t):(...e)=>fetch(...e),!(null===(n=null==t?void 0:t.params)||void 0===n?void 0:n.apikey))throw new Error('API key is required to connect to Realtime');this.apiKey=t.params.apikey;const c=this._initializeOptions(t);this.socketAdapter=new l.default(e,c),this.httpEndpoint=(0,o.httpEndpointURL)(e),this.fetch=this._resolveFetch(null==t?void 0:t.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.isConnected())){this.accessToken&&!this._authPromise&&this._setAuthSafely('connect'),this._setupConnectionHandlers();try{this.socketAdapter.connect()}catch(e){const t=e.message;if(t.includes('Node.js'))throw new Error(`${t}\n\nTo use Realtime in Node.js, you need to provide a WebSocket implementation:\n\nOption 1: Use Node.js 22+ which has native WebSocket support\nOption 2: Install and provide the "ws" package:\n\n npm install ws\n\n import ws from "ws"\n const client = new RealtimeClient(url, {\n ...options,\n transport: ws\n })`);throw new Error(`WebSocket not available: ${t}`)}this._handleNodeJsRaceCondition()}}endpointURL(){return this.socketAdapter.endPointURL()}async disconnect(e,t){return this._cancelPendingDisconnect(),this.isDisconnecting()?'ok':await this.socketAdapter.disconnect(()=>{clearInterval(this._workerHeartbeatTimer),this._terminateWorker()},e,t)}getChannels(){return this.channels}async removeChannel(e){const t=await e.unsubscribe();return'ok'===t&&e.teardown(),t}async removeAllChannels(){const e=this.channels.map(async e=>{const t=await e.unsubscribe();return e.teardown(),t}),t=await Promise.all(e);return await this.disconnect(),t}log(e,t,n){this.socketAdapter.log(e,t,n)}connectionState(){return this.socketAdapter.connectionState()||n.CONNECTION_STATE.closed}isConnected(){return this.socketAdapter.isConnected()}isConnecting(){return this.socketAdapter.isConnecting()}isDisconnecting(){return this.socketAdapter.isDisconnecting()}channel(e,t={config:{}}){const n=`realtime:${e}`,s=this.getChannels().find(e=>e.topic===n);if(s)return s;{const n=new c.default(`realtime:${e}`,t,this);return this._cancelPendingDisconnect(),this.channels.push(n),n}}push(e){this.socketAdapter.push(e)}async setAuth(e=null){this._authPromise=this._performAuth(e);try{await this._authPromise}finally{this._authPromise=null}}_isManualToken(){return this._manuallySetToken}async sendHeartbeat(){this.socketAdapter.sendHeartbeat()}onHeartbeat(e){this.socketAdapter.heartbeatCallback=this._wrapHeartbeatCallback(e)}_makeRef(){return this.socketAdapter.makeRef()}_remove(e){this.channels=this.channels.filter(t=>t.topic!==e.topic),0===this.channels.length&&(this.log('transport','no channels remaining, scheduling disconnect'),this._schedulePendingDisconnect())}_schedulePendingDisconnect(){if(this._cancelPendingDisconnect(),0===this._disconnectOnEmptyChannelsAfterMs)return this.log('transport','disconnecting immediately - no channels'),void this.disconnect();this._pendingDisconnectTimer=setTimeout(()=>{this._pendingDisconnectTimer=null,0===this.channels.length&&(this.log('transport','deferred disconnect fired - no channels, disconnecting'),this.disconnect())},this._disconnectOnEmptyChannelsAfterMs),this.log('transport',`deferred disconnect scheduled in ${this._disconnectOnEmptyChannelsAfterMs}ms`)}_cancelPendingDisconnect(){null!==this._pendingDisconnectTimer&&(this.log('transport','pending disconnect cancelled - channel activity detected'),clearTimeout(this._pendingDisconnectTimer),this._pendingDisconnectTimer=null)}async _performAuth(e=null){let t,s=!1;if(e)t=e,s=!0;else if(this.accessToken)try{t=await this.accessToken()}catch(e){this.log('error','Error fetching access token from callback',e),t=this.accessTokenValue}else t=this.accessTokenValue;s?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=t&&(this.accessTokenValue=t,this.channels.forEach(e=>{const s={access_token:t,version:n.DEFAULT_VERSION};t&&e.updateJoinPayload(s),e.joinedOnce&&e.channelAdapter.isJoined()&&e.channelAdapter.push(n.CHANNEL_EVENTS.access_token,{access_token:t})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(e="general"){this._isManualToken()||this.setAuth().catch(t=>{this.log('error',`Error setting auth in ${e}`,t)})}_setupConnectionHandlers(){this.socketAdapter.onOpen(()=>{(this._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).catch(e=>{this.log('error','error waiting for auth on connect',e)}),this.worker&&!this.workerRef&&this._startWorkerHeartbeat()}),this.socketAdapter.onClose(()=>{this.worker&&this.workerRef&&this._terminateWorker()}),this.socketAdapter.onMessage(e=>{e.ref&&e.ref===this._pendingWorkerHeartbeatRef&&(this._pendingWorkerHeartbeatRef=null)})}_handleNodeJsRaceCondition(){this.socketAdapter.isConnected()&&this.socketAdapter.getSocket().onConnOpen()}_wrapHeartbeatCallback(e){return(t,n)=>{'sent'==t&&this._setAuthSafely(),e&&e(t,n)}}_startWorkerHeartbeat(){this.workerUrl?this.log('worker',`starting worker for from ${this.workerUrl}`):this.log('worker',"starting default worker");const e=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(e),this.workerRef.onerror=e=>{this.log('worker','worker error',e.message),this._terminateWorker(),this.disconnect()},this.workerRef.onmessage=e=>{'keepAlive'===e.data.event&&this.sendHeartbeat()},this.workerRef.postMessage({event:'start',interval:this.heartbeatIntervalMs})}_terminateWorker(){this.workerRef&&(this.log('worker','terminating worker'),this.workerRef.terminate(),this.workerRef=void 0)}_workerObjectUrl(e){let t;if(e)t=e;else{const e=new Blob(["\n addEventListener(\"message\", (e) => {\n if (e.data.event === \"start\") {\n setInterval(() => postMessage({ event: \"keepAlive\" }), e.data.interval);\n }\n });"],{type:'application/javascript'});t=URL.createObjectURL(e)}return t}_initializeOptions(e){var s,o,c,l,k,f,_,v,w,b,A,T;this.worker=null!==(s=null==e?void 0:e.worker)&&void 0!==s&&s,this.accessToken=null!==(o=null==e?void 0:e.accessToken)&&void 0!==o?o:null;const y={};let C,R;y.timeout=null!==(c=null==e?void 0:e.timeout)&&void 0!==c?c:n.DEFAULT_TIMEOUT,y.heartbeatIntervalMs=null!==(l=null==e?void 0:e.heartbeatIntervalMs)&&void 0!==l?l:h,this._disconnectOnEmptyChannelsAfterMs=null!==(k=null==e?void 0:e.disconnectOnEmptyChannelsAfterMs)&&void 0!==k?k:2*(null!==(f=null==e?void 0:e.heartbeatIntervalMs)&&void 0!==f?f:h),y.transport=null!==(_=null==e?void 0:e.transport)&&void 0!==_?_:t.default.getWebSocketConstructor(),y.params=null==e?void 0:e.params,y.logger=null==e?void 0:e.logger,y.heartbeatCallback=this._wrapHeartbeatCallback(null==e?void 0:e.heartbeatCallback),y.sessionStorage=null!==(v=null==e?void 0:e.sessionStorage)&&void 0!==v?v:p(),y.reconnectAfterMs=null!==(w=null==e?void 0:e.reconnectAfterMs)&&void 0!==w?w:e=>u[e-1]||1e4;const E=null!==(b=null==e?void 0:e.vsn)&&void 0!==b?b:n.DEFAULT_VSN;switch(E){case n.VSN_1_0_0:C=(e,t)=>t(JSON.stringify(e)),R=(e,t)=>t(JSON.parse(e));break;case n.VSN_2_0_0:C=this.serializer.encode.bind(this.serializer),R=this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${y.vsn}`)}if(y.vsn=E,y.encode=null!==(A=null==e?void 0:e.encode)&&void 0!==A?A:C,y.decode=null!==(T=null==e?void 0:e.decode)&&void 0!==T?T:R,y.beforeReconnect=this._reconnectAuth.bind(this),((null==e?void 0:e.logLevel)||(null==e?void 0:e.log_level))&&(this.logLevel=e.logLevel||e.log_level,y.params=Object.assign(Object.assign({},y.params),{log_level:this.logLevel})),this.worker){if('undefined'!=typeof window&&!window.Worker)throw new Error('Web Worker is not supported');this.workerUrl=null==e?void 0:e.workerUrl,y.autoSendHeartbeat=!this.worker}return y}async _reconnectAuth(){await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()}}},1162,[1163,1164,1166,1167,1168,1175]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"WebSocketFactory",{enumerable:!0,get:function(){return t}});class t{constructor(){}static detectEnvironment(){var t;if('undefined'!=typeof WebSocket)return{type:'native',wsConstructor:WebSocket};const o=globalThis;if('undefined'!=typeof globalThis&&void 0!==o.WebSocket)return{type:'native',wsConstructor:o.WebSocket};const n=void 0!==g?g:void 0;if(n&&void 0!==n.WebSocket)return{type:'native',wsConstructor:n.WebSocket};if('undefined'!=typeof globalThis&&void 0!==o.WebSocketPair&&void 0===globalThis.WebSocket)return{type:'cloudflare',error:'Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.',workaround:'Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime.'};if('undefined'!=typeof globalThis&&o.EdgeRuntime||'undefined'!=typeof navigator&&(null===(t=navigator.userAgent)||void 0===t?void 0:t.includes('Vercel-Edge')))return{type:'unsupported',error:'Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.',workaround:'Use serverless functions or a different deployment target for WebSocket functionality.'};const s=globalThis.process;if(s){const t=s.versions;if(t&&t.node){const o=t.node,n=parseInt(o.replace(/^v/,'').split('.')[0]);return n>=22?void 0!==globalThis.WebSocket?{type:'native',wsConstructor:globalThis.WebSocket}:{type:'unsupported',error:`Node.js ${n} detected but native WebSocket not found.`,workaround:'Provide a WebSocket implementation via the transport option.'}:{type:'unsupported',error:`Node.js ${n} detected without native WebSocket support.`,workaround:"For Node.js < 22, install \"ws\" package and provide it via the transport option:\nimport ws from \"ws\"\nnew RealtimeClient(url, { transport: ws })"}}}return{type:'unsupported',error:'Unknown JavaScript runtime without WebSocket support.',workaround:"Ensure you're running in a supported environment (browser, Node.js, Deno) or provide a custom WebSocket implementation."}}static getWebSocketConstructor(){const t=this.detectEnvironment();if(t.wsConstructor)return t.wsConstructor;let o=t.error||'WebSocket not supported in this environment.';throw t.workaround&&(o+=`\n\nSuggested solution: ${t.workaround}`),new Error(o)}static isWebSocketSupported(){try{const t=this.detectEnvironment();return'native'===t.type||'ws'===t.type}catch(t){return!1}}}var o=t},1163,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DEFAULT_VERSION",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"VSN_1_0_0",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"VSN_2_0_0",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"DEFAULT_VSN",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"VERSION",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"DEFAULT_TIMEOUT",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"WS_CLOSE_NORMAL",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"MAX_PUSH_BUFFER_SIZE",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"SOCKET_STATES",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"CHANNEL_STATES",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"CHANNEL_EVENTS",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"TRANSPORTS",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"CONNECTION_STATE",{enumerable:!0,get:function(){return E}});var n=r(d[0]);const t=`realtime-js/${n.version}`,o='1.0.0',c='2.0.0',u=c,l=n.version,b=1e4,_=1e3,f=100,p={connecting:0,open:1,closing:2,closed:3},s={closed:'closed',errored:'errored',joined:'joined',joining:'joining',leaving:'leaving'},O={close:'phx_close',error:'phx_error',join:'phx_join',reply:'phx_reply',leave:'phx_leave',access_token:'access_token'},j={websocket:'websocket'},E={connecting:'connecting',open:'open',closing:'closing',closed:'closed'}},1164,[1165]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"version",{enumerable:!0,get:function(){return t}});const t='2.109.0'},1165,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}});class t{constructor(t){this.HEADER_LENGTH=1,this.USER_BROADCAST_PUSH_META_LENGTH=6,this.KINDS={userBroadcastPush:3,userBroadcast:4},this.BINARY_ENCODING=0,this.JSON_ENCODING=1,this.BROADCAST_EVENT='broadcast',this.allowedMetadataKeys=[],this.allowedMetadataKeys=null!=t?t:[]}encode(t,n){if(t.event===this.BROADCAST_EVENT&&!(t.payload instanceof ArrayBuffer)&&'string'==typeof t.payload.event)return n(this._binaryEncodeUserBroadcastPush(t));let s=[t.join_ref,t.ref,t.topic,t.event,t.payload];return n(JSON.stringify(s))}_binaryEncodeUserBroadcastPush(t){var n;return this._isArrayBuffer(null===(n=t.payload)||void 0===n?void 0:n.payload)?this._encodeBinaryUserBroadcastPush(t):this._encodeJsonUserBroadcastPush(t)}_encodeBinaryUserBroadcastPush(t){var n,s;const o=null!==(s=null===(n=t.payload)||void 0===n?void 0:n.payload)&&void 0!==s?s:new ArrayBuffer(0);return this._encodeUserBroadcastPush(t,this.BINARY_ENCODING,o)}_encodeJsonUserBroadcastPush(t){var n,s;const o=null!==(s=null===(n=t.payload)||void 0===n?void 0:n.payload)&&void 0!==s?s:{},c=(new TextEncoder).encode(JSON.stringify(o)).buffer;return this._encodeUserBroadcastPush(t,this.JSON_ENCODING,c)}_encodeUserBroadcastPush(t,n,s){var o,c;const l=t.topic,h=null!==(o=t.ref)&&void 0!==o?o:'',u=null!==(c=t.join_ref)&&void 0!==c?c:'',f=t.payload.event,y=this.allowedMetadataKeys?this._pick(t.payload,this.allowedMetadataKeys):{},_=0===Object.keys(y).length?'':JSON.stringify(y);if(u.length>255)throw new Error(`joinRef length ${u.length} exceeds maximum of 255`);if(h.length>255)throw new Error(`ref length ${h.length} exceeds maximum of 255`);if(l.length>255)throw new Error(`topic length ${l.length} exceeds maximum of 255`);if(f.length>255)throw new Error(`userEvent length ${f.length} exceeds maximum of 255`);if(_.length>255)throw new Error(`metadata length ${_.length} exceeds maximum of 255`);const A=this.USER_BROADCAST_PUSH_META_LENGTH+u.length+h.length+l.length+f.length+_.length,E=new ArrayBuffer(this.HEADER_LENGTH+A);let U=new DataView(E),B=0;U.setUint8(B++,this.KINDS.userBroadcastPush),U.setUint8(B++,u.length),U.setUint8(B++,h.length),U.setUint8(B++,l.length),U.setUint8(B++,f.length),U.setUint8(B++,_.length),U.setUint8(B++,n),Array.from(u,t=>U.setUint8(B++,t.charCodeAt(0))),Array.from(h,t=>U.setUint8(B++,t.charCodeAt(0))),Array.from(l,t=>U.setUint8(B++,t.charCodeAt(0))),Array.from(f,t=>U.setUint8(B++,t.charCodeAt(0))),Array.from(_,t=>U.setUint8(B++,t.charCodeAt(0)));var N=new Uint8Array(E.byteLength+s.byteLength);return N.set(new Uint8Array(E),0),N.set(new Uint8Array(s),E.byteLength),N.buffer}decode(t,n){if(this._isArrayBuffer(t)){return n(this._binaryDecode(t))}if('string'==typeof t){const s=JSON.parse(t),[o,c,l,h,u]=s;return n({join_ref:o,ref:c,topic:l,event:h,payload:u})}return n({})}_binaryDecode(t){const n=new DataView(t),s=n.getUint8(0),o=new TextDecoder;if(s===this.KINDS.userBroadcast)return this._decodeUserBroadcast(t,n,o)}_decodeUserBroadcast(t,n,s){const o=n.getUint8(1),c=n.getUint8(2),l=n.getUint8(3),h=n.getUint8(4);let u=this.HEADER_LENGTH+4;const f=s.decode(t.slice(u,u+o));u+=o;const y=s.decode(t.slice(u,u+c));u+=c;const _=s.decode(t.slice(u,u+l));u+=l;const A=t.slice(u,t.byteLength),E=h===this.JSON_ENCODING?JSON.parse(s.decode(A)):A,U={type:this.BROADCAST_EVENT,event:y,payload:E};return l>0&&(U.meta=JSON.parse(_)),{join_ref:null,ref:null,topic:f,event:this.BROADCAST_EVENT,payload:U}}_isArrayBuffer(t){var n;return t instanceof ArrayBuffer||'ArrayBuffer'===(null===(n=null==t?void 0:t.constructor)||void 0===n?void 0:n.name)}_pick(t,n){return t&&'object'==typeof t?Object.fromEntries(Object.entries(t).filter(([t])=>n.includes(t))):{}}}},1166,[]); +__d(function(g,r,i,a,m,e,d){"use strict";var t;Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PostgresTypes",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"convertChangeData",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"convertColumn",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"convertCell",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"toBoolean",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"toNumber",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"toJson",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"toArray",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"toTimestampString",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"httpEndpointURL",{enumerable:!0,get:function(){return y}}),(function(t){t.abstime="abstime",t.bool="bool",t.date="date",t.daterange="daterange",t.float4="float4",t.float8="float8",t.int2="int2",t.int4="int4",t.int4range="int4range",t.int8="int8",t.int8range="int8range",t.json="json",t.jsonb="jsonb",t.money="money",t.numeric="numeric",t.oid="oid",t.reltime="reltime",t.text="text",t.time="time",t.timestamp="timestamp",t.timestamptz="timestamptz",t.timetz="timetz",t.tsrange="tsrange",t.tstzrange="tstzrange"})(t||(t={}));const n=(t,n,o={})=>{var s;const u=null!==(s=o.skipTypes)&&void 0!==s?s:[];return n?Object.keys(n).reduce((o,s)=>(o[s]=c(s,t,n,u),o),{}):{}},c=(t,n,c,u)=>{const p=n.find(n=>n.name===t),l=null==p?void 0:p.type,f=c[t];return l&&!u.includes(l)?o(l,f):s(f)},o=(n,c)=>{if('_'===n.charAt(0)){const t=n.slice(1,n.length);return f(c,t)}switch(n){case t.bool:return u(c);case t.float4:case t.float8:case t.int2:case t.int4:case t.int8:case t.numeric:case t.oid:return p(c);case t.json:case t.jsonb:return l(c);case t.timestamp:return b(c);case t.abstime:case t.date:case t.daterange:case t.int4range:case t.int8range:case t.money:case t.reltime:case t.text:case t.time:case t.timestamptz:case t.timetz:case t.tsrange:case t.tstzrange:default:return s(c)}},s=t=>t,u=t=>{switch(t){case't':return!0;case'f':return!1;default:return t}},p=t=>{if('string'==typeof t){const n=parseFloat(t);if(!Number.isNaN(n))return n}return t},l=t=>{if('string'==typeof t)try{return JSON.parse(t)}catch(n){return t}return t},f=(t,n)=>{if('string'!=typeof t)return t;const c=t.length-1,s=t[c];if('{'===t[0]&&'}'===s){let s;const u=t.slice(1,c);try{s=JSON.parse('['+u+']')}catch(t){s=u?u.split(','):[]}return s.map(t=>o(n,t))}return t},b=t=>'string'==typeof t?t.replace(' ','T'):t,y=t=>{const n=new URL(t);return n.protocol=n.protocol.replace(/^ws/i,'http'),n.pathname=n.pathname.replace(/\/+$/,'').replace(/\/socket\/websocket$/i,'').replace(/\/socket$/i,'').replace(/\/websocket$/i,''),''===n.pathname||'/'===n.pathname?n.pathname='/api/broadcast':n.pathname=n.pathname+'/api/broadcast',n.href}},1167,[]); +__d(function(g,_r,_i,a,m,_e2,_d2){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"RealtimePostgresFilterBuilder",{enumerable:!0,get:function(){return d.RealtimePostgresFilterBuilder}}),Object.defineProperty(_e2,"postgresChangesFilter",{enumerable:!0,get:function(){return d.postgresChangesFilter}}),Object.defineProperty(_e2,"default",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e2,"REALTIME_POSTGRES_CHANGES_LISTEN_EVENT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e2,"REALTIME_LISTEN_TYPES",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e2,"REALTIME_SUBSCRIBE_STATES",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e2,"REALTIME_CHANNEL_STATES",{enumerable:!0,get:function(){return h}});var t,n,i,s=_r(_d2[0]),r=e(_r(_d2[1])),o=_r(_d2[2]),c=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(n){if('default'!==n){var i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,t})(o),l=_r(_d2[3]),u=e(_r(_d2[4])),d=_r(_d2[5]);!(function(e){e.ALL="*",e.INSERT="INSERT",e.UPDATE="UPDATE",e.DELETE="DELETE"})(t||(t={})),(function(e){e.BROADCAST="broadcast",e.PRESENCE="presence",e.POSTGRES_CHANGES="postgres_changes",e.SYSTEM="system"})(n||(n={})),(function(e){e.SUBSCRIBED="SUBSCRIBED",e.TIMED_OUT="TIMED_OUT",e.CLOSED="CLOSED",e.CHANNEL_ERROR="CHANNEL_ERROR"})(i||(i={}));const h=s.CHANNEL_STATES;class p{get state(){return this.channelAdapter.state}set state(e){this.channelAdapter.state=e}get joinedOnce(){return this.channelAdapter.joinedOnce}get timeout(){return this.socket.timeout}get joinPush(){return this.channelAdapter.joinPush}get rejoinTimer(){return this.channelAdapter.rejoinTimer}constructor(e,t={config:{}},n){var i,s;if(this.topic=e,this.params=t,this.socket=n,this.bindings={},this.subTopic=e.replace(/^realtime:/i,''),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:'',enabled:!1},private:!1},t.config),this.channelAdapter=new u.default(this.socket.socketAdapter,e,this.params),this.presence=new r.default(this),this._onClose(()=>{this.socket._remove(this)}),this._updateFilterTransform(),this.broadcastEndpointURL=(0,o.httpEndpointURL)(this.socket.socketAdapter.endPointURL()),this.private=this.params.config.private||!1,!this.private&&(null===(s=null===(i=this.params.config)||void 0===i?void 0:i.broadcast)||void 0===s?void 0:s.replay))throw new Error(`tried to use replay on public channel '${this.topic}'. It must be a private channel.`)}subscribe(e,t=this.timeout){var r,o,c;if(this.socket.isConnected()||this.socket.connect(),this.channelAdapter.isClosed()){const{config:{broadcast:u,presence:d,private:h}}=this.params,p=null!==(o=null===(r=this.bindings.postgres_changes)||void 0===r?void 0:r.map(e=>e.filter))&&void 0!==o?o:[],E=!!this.bindings[n.PRESENCE]&&this.bindings[n.PRESENCE].length>0||!0===(null===(c=this.params.config.presence)||void 0===c?void 0:c.enabled),b={},f={broadcast:u,presence:Object.assign(Object.assign({},d),{enabled:E}),postgres_changes:p,private:h};this.socket.accessTokenValue&&(b.access_token=this.socket.accessTokenValue),this._onError(t=>{null==e||e(i.CHANNEL_ERROR,(0,l.normalizeChannelError)(t))}),this._onClose(()=>null==e?void 0:e(i.CLOSED)),this.updateJoinPayload(Object.assign({config:f},b)),this._updateFilterMessage(),this.channelAdapter.subscribe(t).receive('ok',async({postgres_changes:t})=>{this.socket._isManualToken()||this.socket.setAuth(),void 0!==t?this._updatePostgresBindings(t,e):null==e||e(i.SUBSCRIBED)}).receive('error',t=>{this.state=s.CHANNEL_STATES.errored;const n=Object.values(t).join(', ')||'error';null==e||e(i.CHANNEL_ERROR,new Error(n,{cause:t}))}).receive('timeout',()=>{null==e||e(i.TIMED_OUT)})}return this}_updatePostgresBindings(e,t){var n;const r=this.bindings.postgres_changes,o=null!==(n=null==r?void 0:r.length)&&void 0!==n?n:0,c=[];for(let n=0;n{var i,s,r;const o=this.channelAdapter.push(e.type,e,t.timeout||this.timeout);'broadcast'!==e.type||(null===(r=null===(s=null===(i=this.params)||void 0===i?void 0:i.config)||void 0===s?void 0:s.broadcast)||void 0===r?void 0:r.ack)||n('ok'),o.receive('ok',()=>n('ok')),o.receive('error',()=>n('error')),o.receive('timeout',()=>n('timed out'))});{console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated in the future. Please use httpSend() explicitly for REST delivery.");const{event:s,payload:r}=e,o={apikey:this.socket.apiKey?this.socket.apiKey:'','Content-Type':'application/json'};this.socket.accessTokenValue&&(o.Authorization=`Bearer ${this.socket.accessTokenValue}`);const c={method:'POST',headers:o,body:JSON.stringify({messages:[{topic:this.subTopic,event:s,payload:r,private:this.private}]})};try{const e=await this._fetchWithTimeout(this.broadcastEndpointURL,c,null!==(n=t.timeout)&&void 0!==n?n:this.timeout);return await(null===(i=e.body)||void 0===i?void 0:i.cancel()),e.ok?'ok':'error'}catch(e){return e instanceof Error&&'AbortError'===e.name?'timed out':'error'}}}updateJoinPayload(e){this.channelAdapter.updateJoinPayload(e)}async unsubscribe(e=this.timeout){return new Promise(t=>{this.channelAdapter.unsubscribe(e).receive('ok',()=>t('ok')).receive('timeout',()=>t('timed out')).receive('error',()=>t('error'))})}teardown(){this.channelAdapter.teardown()}async _fetchWithTimeout(e,t,n){const i=new AbortController,s=setTimeout(()=>i.abort(),n),r=await this.socket.fetch(e,Object.assign(Object.assign({},t),{signal:i.signal}));return clearTimeout(s),r}_on(e,t,n){const i=e.toLocaleLowerCase(),s=null==t?void 0:t.filter;(s instanceof d.RealtimePostgresFilterBuilder||'object'==typeof s&&null!==s&&'function'==typeof s.build)&&(t=Object.assign(Object.assign({},t),{filter:s.build()}));const r={type:i,filter:t,callback:n,ref:this.channelAdapter.on(e,n)};return this.bindings[i]?this.bindings[i].push(r):this.bindings[i]=[r],this._updateFilterMessage(),this}_onClose(e){this.channelAdapter.onClose(e)}_onError(e){this.channelAdapter.onError(e)}_updateFilterMessage(){this.channelAdapter.updateFilterBindings((e,t,n)=>{var i,s,r,o,c,l,u;const d=e.event.toLocaleLowerCase();if(this._notThisChannelEvent(d,n))return!1;const h=null===(i=this.bindings[d])||void 0===i?void 0:i.find(t=>t.ref===e.ref);if(!h)return!0;if(['broadcast','presence','postgres_changes'].includes(d)){if('id'in h){const e=h.id,n=null===(s=h.filter)||void 0===s?void 0:s.event;return e&&(null===(r=t.ids)||void 0===r?void 0:r.includes(e))&&('*'===n||(null==n?void 0:n.toLocaleLowerCase())===(null===(o=t.data)||void 0===o?void 0:o.type.toLocaleLowerCase()))}{const e=null===(l=null===(c=null==h?void 0:h.filter)||void 0===c?void 0:c.event)||void 0===l?void 0:l.toLocaleLowerCase();return'*'===e||e===(null===(u=null==t?void 0:t.event)||void 0===u?void 0:u.toLocaleLowerCase())}}return h.type.toLocaleLowerCase()===d})}_notThisChannelEvent(e,t){const{close:n,error:i,leave:r,join:o}=s.CHANNEL_EVENTS;return t&&[n,i,r,o].includes(e)&&t!==this.joinPush.ref}_updateFilterTransform(){this.channelAdapter.updatePayloadTransform((e,t,n)=>{if('object'==typeof t&&'ids'in t){const e=t.data,{schema:n,table:i,commit_timestamp:s,type:r,errors:o}=e,c={schema:n,table:i,commit_timestamp:s,eventType:r,new:{},old:{},errors:o};return Object.assign(Object.assign({},c),this._getPayloadRecords(e))}return t})}copyBindings(e){if(this.joinedOnce)throw new Error('cannot copy bindings into joined channel');for(const t in e.bindings)for(const n of e.bindings[t])this._on(n.type,n.filter,n.callback)}static isFilterValueEqual(e,t){return(null!=e?e:void 0)===(null!=t?t:void 0)}_getPayloadRecords(e){const t={new:{},old:{}};return'INSERT'!==e.type&&'UPDATE'!==e.type||(t.new=c.convertChangeData(e.columns,e.record)),'UPDATE'!==e.type&&'DELETE'!==e.type||(t.old=c.convertChangeData(e.columns,e.old_record)),t}}},1168,[1164,1169,1167,1172,1173,1174]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"REALTIME_PRESENCE_LISTEN_EVENTS",{enumerable:!0,get:function(){return t}});var e,t,n=r(d[0]),c=(e=n)&&e.__esModule?e:{default:e};!(function(e){e.SYNC="sync",e.JOIN="join",e.LEAVE="leave"})(t||(t={}));class u{get state(){return this.presenceAdapter.state}constructor(e,t){this.channel=e,this.presenceAdapter=new c.default(this.channel.channelAdapter,t)}}},1169,[1170]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}});var n=r(d[0]);class t{constructor(s,c){const u=o(c);this.presence=new n.Presence(s.getChannel(),u),this.presence.onJoin((n,c,o)=>{const u=t.onJoinPayload(n,c,o);s.getChannel().trigger('presence',u)}),this.presence.onLeave((n,c,o)=>{const u=t.onLeavePayload(n,c,o);s.getChannel().trigger('presence',u)}),this.presence.onSync(()=>{s.getChannel().trigger('presence',{event:'sync'})})}get state(){return t.transformState(this.presence.state)}static transformState(n){return n=c(n),Object.getOwnPropertyNames(n).reduce((t,c)=>{const o=n[c];return t[c]=s(o),t},{})}static onJoinPayload(n,t,c){return{event:'join',key:n,currentPresences:u(t),newPresences:s(c)}}static onLeavePayload(n,t,c){return{event:'leave',key:n,currentPresences:u(t),leftPresences:s(c)}}}function s(n){return n.metas.map(n=>(n.presence_ref=n.phx_ref,delete n.phx_ref,delete n.phx_ref_prev,n))}function c(n){return JSON.parse(JSON.stringify(n))}function o(n){return(null==n?void 0:n.events)&&{events:n.events}}function u(n){return(null==n?void 0:n.metas)?s(n):[]}},1170,[1171]); +__d(function(g,r,_i,a,_m,_e2,d){"use strict";Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"Channel",{enumerable:!0,get:function(){return A}}),Object.defineProperty(_e2,"LongPoll",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e2,"Presence",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e2,"Push",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e2,"Serializer",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e2,"Socket",{enumerable:!0,get:function(){return $}}),Object.defineProperty(_e2,"Timer",{enumerable:!0,get:function(){return w}});var e=e=>{if("function"==typeof e)return e;return function(){return e}},t="undefined"!=typeof self?self:null,s="undefined"!=typeof window?window:null,i=t||s||globalThis,n=0,o=1,h=2,c=3,l="closed",u="errored",f="joined",p="joining",m="leaving",b="phx_close",k="phx_error",T="phx_join",y="phx_reply",C="phx_leave",v="longpoll",R="websocket",j=4,E="base64url.bearer.phx.",S=class{constructor(e,t,s,i){this.channel=e,this.event=t,this.payload=s||function(){return{}},this.receivedResp=null,this.timeout=i,this.timeoutTimer=null,this.recHooks=[],this.sent=!1,this.ref=void 0}resend(e){this.timeout=e,this.reset(),this.send()}send(){this.hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload(),ref:this.ref,join_ref:this.channel.joinRef()}))}receive(e,t){return this.hasReceived(e)&&t(this.receivedResp.response),this.recHooks.push({status:e,callback:t}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}destroy(){this.cancelRefEvent(),this.cancelTimeout()}matchReceive({status:e,response:t,_ref:s}){this.recHooks.filter(t=>t.status===e).forEach(e=>e.callback(t))}cancelRefEvent(){this.refEvent&&this.channel.off(this.refEvent)}cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null}startTimeout(){this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,e=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=e,this.matchReceive(e)}),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}trigger(e,t){this.channel.trigger(this.refEvent,{status:e,response:t})}},w=class{constructor(e,t){this.callback=e,this.timerCalc=t,this.timer=void 0,this.tries=0}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}},A=class{constructor(t,s,i){this.state=l,this.topic=t,this.params=e(s||{}),this.socket=i,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new S(this,T,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new w(()=>{this.socket.isConnected()&&this.rejoin()},this.socket.rejoinAfterMs),this.stateChangeRefs.push(this.socket.onError(()=>this.rejoinTimer.reset())),this.stateChangeRefs.push(this.socket.onOpen(()=>{this.rejoinTimer.reset(),this.isErrored()&&this.rejoin()})),this.joinPush.receive("ok",()=>{this.state=f,this.rejoinTimer.reset(),this.pushBuffer.forEach(e=>e.send()),this.pushBuffer=[]}),this.joinPush.receive("error",e=>{this.state=u,this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,e),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.onClose(()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log("channel",`close ${this.topic}`),this.state=l,this.socket.remove(this)}),this.onError(e=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,e),this.isJoining()&&this.joinPush.reset(),this.state=u,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.joinPush.receive("timeout",()=>{this.socket.hasLogger()&&this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),new S(this,C,e({}),this.timeout).send(),this.state=u,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(y,(e,t)=>{this.trigger(this.replyEventName(t),e)})}join(e=this.timeout){if(this.joinedOnce)throw new Error("tried to join multiple times. 'join' can only be called a single time per channel instance");return this.timeout=e,this.joinedOnce=!0,this.rejoin(),this.joinPush}teardown(){this.pushBuffer.forEach(e=>e.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=l,this.bindings=[]}onClose(e){this.on(b,e)}onError(e){return this.on(k,t=>e(t))}on(e,t){let s=this.bindingRef++;return this.bindings.push({event:e,ref:s,callback:t}),s}off(e,t){this.bindings=this.bindings.filter(s=>!(s.event===e&&(void 0===t||t===s.ref)))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(e,t,s=this.timeout){if(t=t||{},!this.joinedOnce)throw new Error(`tried to push '${e}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let i=new S(this,e,function(){return t},s);return this.canPush()?i.send():(i.startTimeout(),this.pushBuffer.push(i)),i}leave(t=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=m;let s=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(b,"leave")},i=new S(this,C,e({}),t);return i.receive("ok",()=>s()).receive("timeout",()=>s()),i.send(),this.canPush()||i.trigger("ok",{}),i}onMessage(e,t,s){return t}filterBindings(e,t,s){return!0}isMember(e,t,s,i){return this.topic===e&&(!i||i===this.joinRef()||(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:e,event:t,payload:s,joinRef:i}),!1))}joinRef(){return this.joinPush.ref}rejoin(e=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=p,this.joinPush.resend(e))}trigger(e,t,s,i){let n=this.onMessage(e,t,s,i);if(t&&!n)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let o=this.bindings.filter(i=>i.event===e&&this.filterBindings(i,t,s));for(let e=0;eu.abort(),o);l.signal=u.signal}return i.fetch(t,l).then(e=>e.text()).then(e=>this.parseJSON(e)).then(e=>c&&c(e)).catch(e=>{"AbortError"===e.name&&h?h():c&&c(null)}),u}static xdomainRequest(e,t,s,i,n,o,h){return e.timeout=n,e.open(t,s),e.onload=()=>{let t=this.parseJSON(e.responseText);h&&h(t)},o&&(e.ontimeout=o),e.onprogress=()=>{},e.send(i),e}static xhrRequest(e,t,s,i,n,o,h,c){e.open(t,s,!0),e.timeout=o;for(let[t,s]of Object.entries(i))e.setRequestHeader(t,s);return e.onerror=()=>c&&c(null),e.onreadystatechange=()=>{if(e.readyState===j&&c){let t=this.parseJSON(e.responseText);c(t)}},h&&(e.ontimeout=h),e.send(n),e}static parseJSON(e){if(!e||""===e)return null;try{return JSON.parse(e)}catch{return console&&console.log("failed to parse JSON response",e),null}}static serialize(e,t){let s=[];for(var i in e){if(!Object.prototype.hasOwnProperty.call(e,i))continue;let n=t?`${t}[${i}]`:i,o=e[i];"object"==typeof o?s.push(this.serialize(o,n)):s.push(encodeURIComponent(n)+"="+encodeURIComponent(o))}return s.join("&")}static appendParams(e,t){if(0===Object.keys(t).length)return e;let s=e.match(/\?/)?"&":"?";return`${e}${s}${this.serialize(t)}`}},L=e=>{let t="",s=new Uint8Array(e),i=s.byteLength;for(let e=0;ethis.poll(),0)}normalizeEndpoint(e){return e.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+R),"$1/"+v)}endpointURL(){return H.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(e,t,s){this.close(e,t,s),this.readyState=n}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===o||this.readyState===n}poll(){const e={Accept:"application/json"};this.authToken&&(e["X-Phoenix-AuthToken"]=this.authToken),this.ajax("GET",e,null,()=>this.ontimeout(),e=>{if(e){var{status:t,token:s,messages:i}=e;if(410===t&&null!==this.token)return this.onerror(410),void this.closeAndRetry(3410,"session_gone",!1);this.token=s}else t=0;switch(t){case 200:i.forEach(e=>{setTimeout(()=>this.onmessage({data:e}),0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=o,this.onopen({}),this.poll();break;case 403:this.onerror(403),this.close(1008,"forbidden",!1);break;case 0:case 500:this.onerror(500),this.closeAndRetry(1011,"internal server error",500);break;default:throw new Error(`unhandled poll status ${t}`)}})}send(e){"string"!=typeof e&&(e=L(e)),this.currentBatch?this.currentBatch.push(e):this.awaitingBatchAck?this.batchBuffer.push(e):(this.currentBatch=[e],this.currentBatchTimer=setTimeout(()=>{this.batchSend(this.currentBatch),this.currentBatch=null},0))}batchSend(e){this.awaitingBatchAck=!0,this.ajax("POST",{"Content-Type":"application/x-ndjson"},e.join("\n"),()=>this.onerror("timeout"),e=>{this.awaitingBatchAck=!1,e&&200===e.status?this.batchBuffer.length>0&&(this.batchSend(this.batchBuffer),this.batchBuffer=[]):(this.onerror(e&&e.status),this.closeAndRetry(1011,"internal server error",!1))})}close(e,t,s){for(let e of this.reqs)e.abort();this.readyState=c;let i=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:e,reason:t,wasClean:s});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,"undefined"!=typeof CloseEvent?this.onclose(new CloseEvent("close",i)):this.onclose(i)}ajax(e,t,s,i,n){let o;o=H.request(e,this.endpointURL(),t,s,this.timeout,()=>{this.reqs.delete(o),i()},e=>{this.reqs.delete(o),this.isActive()&&n(e)}),this.reqs.add(o)}},B=class e{constructor(t,s={}){let i=s.events||{state:"presence_state",diff:"presence_diff"};this.state={},this.pendingDiffs=[],this.channel=t,this.joinRef=null,this.caller={onJoin:function(){},onLeave:function(){},onSync:function(){}},this.channel.on(i.state,t=>{let{onJoin:s,onLeave:i,onSync:n}=this.caller;this.joinRef=this.channel.joinRef(),this.state=e.syncState(this.state,t,s,i),this.pendingDiffs.forEach(t=>{this.state=e.syncDiff(this.state,t,s,i)}),this.pendingDiffs=[],n()}),this.channel.on(i.diff,t=>{let{onJoin:s,onLeave:i,onSync:n}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(t):(this.state=e.syncDiff(this.state,t,s,i),n())})}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}list(t){return e.list(this.state,t)}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel.joinRef()}static syncState(e,t,s,i){let n=this.clone(e),o={},h={};return this.map(n,(e,s)=>{t[e]||(h[e]=s)}),this.map(t,(e,t)=>{let s=n[e];if(s){let i=t.metas.map(e=>e.phx_ref),n=s.metas.map(e=>e.phx_ref),c=t.metas.filter(e=>n.indexOf(e.phx_ref)<0),l=s.metas.filter(e=>i.indexOf(e.phx_ref)<0);c.length>0&&(o[e]=t,o[e].metas=c),l.length>0&&(h[e]=this.clone(s),h[e].metas=l)}else o[e]=t}),this.syncDiff(n,{joins:o,leaves:h},s,i)}static syncDiff(e,t,s,i){let{joins:n,leaves:o}=this.clone(t);return s||(s=function(){}),i||(i=function(){}),this.map(n,(t,i)=>{let n=e[t];if(e[t]=this.clone(i),n){let s=e[t].metas.map(e=>e.phx_ref),i=n.metas.filter(e=>s.indexOf(e.phx_ref)<0);e[t].metas.unshift(...i)}s(t,n,i)}),this.map(o,(t,s)=>{let n=e[t];if(!n)return;let o=s.metas.map(e=>e.phx_ref);n.metas=n.metas.filter(e=>o.indexOf(e.phx_ref)<0),i(t,n,s),0===n.metas.length&&delete e[t]}),e}static list(e,t){return t||(t=function(e,t){return t}),this.map(e,(e,s)=>t(e,s))}static map(e,t){return Object.getOwnPropertyNames(e).map(s=>t(s,e[s]))}static clone(e){return JSON.parse(JSON.stringify(e))}},O={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(e,t){if(e.payload.constructor===ArrayBuffer)return t(this.binaryEncode(e));{let s=[e.join_ref,e.ref,e.topic,e.event,e.payload];return t(JSON.stringify(s))}},decode(e,t){if(e.constructor===ArrayBuffer)return t(this.binaryDecode(e));{let[s,i,n,o,h]=JSON.parse(e);return t({join_ref:s,ref:i,topic:n,event:o,payload:h})}},binaryEncode(e){let{join_ref:t,ref:s,event:i,topic:n,payload:o}=e,h=this.META_LENGTH+t.length+s.length+n.length+i.length,c=new ArrayBuffer(this.HEADER_LENGTH+h),l=new DataView(c),u=0;l.setUint8(u++,this.KINDS.push),l.setUint8(u++,t.length),l.setUint8(u++,s.length),l.setUint8(u++,n.length),l.setUint8(u++,i.length),Array.from(t,e=>l.setUint8(u++,e.charCodeAt(0))),Array.from(s,e=>l.setUint8(u++,e.charCodeAt(0))),Array.from(n,e=>l.setUint8(u++,e.charCodeAt(0))),Array.from(i,e=>l.setUint8(u++,e.charCodeAt(0)));var f=new Uint8Array(c.byteLength+o.byteLength);return f.set(new Uint8Array(c),0),f.set(new Uint8Array(o),c.byteLength),f.buffer},binaryDecode(e){let t=new DataView(e),s=t.getUint8(0),i=new TextDecoder;switch(s){case this.KINDS.push:return this.decodePush(e,t,i);case this.KINDS.reply:return this.decodeReply(e,t,i);case this.KINDS.broadcast:return this.decodeBroadcast(e,t,i)}},decodePush(e,t,s){let i=t.getUint8(1),n=t.getUint8(2),o=t.getUint8(3),h=this.HEADER_LENGTH+this.META_LENGTH-1,c=s.decode(e.slice(h,h+i));h+=i;let l=s.decode(e.slice(h,h+n));h+=n;let u=s.decode(e.slice(h,h+o));return h+=o,{join_ref:c,ref:null,topic:l,event:u,payload:e.slice(h,e.byteLength)}},decodeReply(e,t,s){let i=t.getUint8(1),n=t.getUint8(2),o=t.getUint8(3),h=t.getUint8(4),c=this.HEADER_LENGTH+this.META_LENGTH,l=s.decode(e.slice(c,c+i));c+=i;let u=s.decode(e.slice(c,c+n));c+=n;let f=s.decode(e.slice(c,c+o));c+=o;let p=s.decode(e.slice(c,c+h));c+=h;let m=e.slice(c,e.byteLength);return{join_ref:l,ref:u,topic:f,event:y,payload:{status:p,response:m}}},decodeBroadcast(e,t,s){let i=t.getUint8(1),n=t.getUint8(2),o=this.HEADER_LENGTH+2,h=s.decode(e.slice(o,o+i));o+=i;let c=s.decode(e.slice(o,o+n));return o+=n,{join_ref:null,ref:null,topic:h,event:c,payload:e.slice(o,e.byteLength)}}},$=class{constructor(t,n={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=n.timeout||1e4,this.transport=n.transport||i.WebSocket||P,this.conn=void 0,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=n.longPollFallbackMs,this.fallbackTimer=null;let o=null;try{o=i&&i.sessionStorage}catch{}this.sessionStore=n.sessionStorage||o,this.establishedConnections=0,this.defaultEncoder=O.encode.bind(O),this.defaultDecoder=O.decode.bind(O),this.closeWasClean=!0,this.disconnecting=!1,this.binaryType=n.binaryType||"arraybuffer",this.connectClock=1,this.pageHidden=!1,this.encode=void 0,this.decode=void 0,this.transport!==P?(this.encode=n.encode||this.defaultEncoder,this.decode=n.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let h=null;s&&s.addEventListener&&(s.addEventListener("pagehide",e=>{this.conn&&(this.disconnect(),h=this.connectClock)}),s.addEventListener("pageshow",e=>{h===this.connectClock&&(h=null,this.connect())}),s.addEventListener("visibilitychange",()=>{"hidden"===document.visibilityState?this.pageHidden=!0:(this.pageHidden=!1,this.isConnected()||this.closeWasClean||this.teardown(()=>this.connect()))})),this.heartbeatIntervalMs=n.heartbeatIntervalMs||3e4,this.autoSendHeartbeat=n.autoSendHeartbeat??!0,this.heartbeatCallback=n.heartbeatCallback??(()=>{}),this.rejoinAfterMs=e=>n.rejoinAfterMs?n.rejoinAfterMs(e):[1e3,2e3,5e3][e-1]||1e4,this.reconnectAfterMs=e=>n.reconnectAfterMs?n.reconnectAfterMs(e):[10,50,100,150,200,250,500,1e3,2e3][e-1]||5e3,this.logger=n.logger||null,!this.logger&&n.debug&&(this.logger=(e,t,s)=>{console.log(`${e}: ${t}`,s)}),this.longpollerTimeout=n.longpollerTimeout||2e4,this.params=e(n.params||{}),this.endPoint=`${t}/${R}`,this.vsn=n.vsn||"2.0.0",this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.heartbeatSentAt=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new w(()=>{if(this.pageHidden)return this.log("Not reconnecting as page is hidden!"),void this.teardown();this.teardown(async()=>{n.beforeReconnect&&await n.beforeReconnect(),this.connect()})},this.reconnectAfterMs),this.authToken=n.authToken}getLongPollTransport(){return P}replaceTransport(e){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.conn&&(this.conn.close(),this.conn=null),this.transport=e}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let e=H.appendParams(H.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return"/"!==e.charAt(0)?e:"/"===e.charAt(1)?`${this.protocol()}:${e}`:`${this.protocol()}://${location.host}${e}`}disconnect(e,t,s){this.connectClock++,this.disconnecting=!0,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(()=>{this.disconnecting=!1,e&&e()},t,s)}connect(t){t&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=e(t)),this.conn&&!this.disconnecting||(this.longPollFallbackMs&&this.transport!==P?this.connectWithFallback(P,this.longPollFallbackMs):this.transportConnect())}log(e,t,s){this.logger&&this.logger(e,t,s)}hasLogger(){return null!==this.logger}onOpen(e){let t=this.makeRef();return this.stateChangeCallbacks.open.push([t,e]),t}onClose(e){let t=this.makeRef();return this.stateChangeCallbacks.close.push([t,e]),t}onError(e){let t=this.makeRef();return this.stateChangeCallbacks.error.push([t,e]),t}onMessage(e){let t=this.makeRef();return this.stateChangeCallbacks.message.push([t,e]),t}onHeartbeat(e){this.heartbeatCallback=e}ping(e){if(!this.isConnected())return!1;let t=this.makeRef(),s=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:t});let i=this.onMessage(n=>{n.ref===t&&(this.off([i]),e(Date.now()-s))});return!0}transportName(e){return e===P?"LongPoll":e.name}transportConnect(){let e;this.connectClock++,this.closeWasClean=!1,this.authToken&&(e=["phoenix",`${E}${btoa(this.authToken).replace(/=/g,"")}`]),this.conn=new this.transport(this.endPointURL(),e),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=()=>this.onConnOpen(),this.conn.onerror=e=>this.onConnError(e),this.conn.onmessage=e=>this.onConnMessage(e),this.conn.onclose=e=>this.onConnClose(e)}getSession(e){return this.sessionStore&&this.sessionStore.getItem(e)}storeSession(e,t){this.sessionStore&&this.sessionStore.setItem(e,t)}connectWithFallback(e,t=2500){clearTimeout(this.fallbackTimer);let s,i=!1,n=!0,o=this.transportName(e),h=t=>{this.log("transport",`falling back to ${o}...`,t),this.off([void 0,s]),n=!1,this.replaceTransport(e),this.transportConnect()};if(this.getSession(`phx:fallback:${o}`))return h("memorized");this.fallbackTimer=setTimeout(h,t),s=this.onError(e=>{this.log("transport","error",e),n&&!i&&(clearTimeout(this.fallbackTimer),h(e))}),this.fallbackRef&&this.off([this.fallbackRef]),this.fallbackRef=this.onOpen(()=>{if(i=!0,!n){let t=this.transportName(e);return this.primaryPassedHealthCheck||this.storeSession(`phx:fallback:${t}`,"true"),this.log("transport",`established ${t} fallback`)}clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(h,t),this.ping(e=>{this.log("transport","connected to primary after",e),this.primaryPassedHealthCheck=!0,clearTimeout(this.fallbackTimer)})}),this.transportConnect()}clearHeartbeats(){clearTimeout(this.heartbeatTimer),clearTimeout(this.heartbeatTimeoutTimer)}onConnOpen(){this.hasLogger()&&this.log("transport",`connected to ${this.endPointURL()}`),this.closeWasClean=!1,this.disconnecting=!1,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.autoSendHeartbeat&&this.resetHeartbeat(),this.triggerStateCallbacks("open")}heartbeatTimeout(){if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.hasLogger()&&this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(e){this.log("error","error in heartbeat callback",e)}this.triggerChanError(new Error("heartbeat timeout")),this.closeWasClean=!1,this.teardown(()=>this.reconnectTimer.scheduleTimeout(),1e3,"heartbeat timeout")}}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}teardown(e,t,s){if(!this.conn)return e&&e();const i=this.conn;this.waitForBufferDone(i,()=>{t?i.close(t,s||""):i.close(),this.waitForSocketClosed(i,()=>{this.conn===i&&(this.conn.onopen=function(){},this.conn.onerror=function(){},this.conn.onmessage=function(){},this.conn.onclose=function(){},this.conn=null),e&&e()})})}waitForBufferDone(e,t,s=1){5!==s&&e.bufferedAmount?setTimeout(()=>{this.waitForBufferDone(e,t,s+1)},150*s):t()}waitForSocketClosed(e,t,s=1){5!==s&&e.readyState!==c?setTimeout(()=>{this.waitForSocketClosed(e,t,s+1)},150*s):t()}onConnClose(e){this.conn&&(this.conn.onclose=()=>{}),this.hasLogger()&&this.log("transport","close",e),this.triggerChanError(e),this.clearHeartbeats(),this.closeWasClean||this.reconnectTimer.scheduleTimeout(),this.triggerStateCallbacks("close",e)}onConnError(e){this.hasLogger()&&this.log("transport","error",e);let t=this.transport,s=this.establishedConnections;this.triggerStateCallbacks("error",e,t,s),(t===this.transport||s>0)&&this.triggerChanError(e)}triggerChanError(e){this.channels.forEach(t=>{t.isErrored()||t.isLeaving()||t.isClosed()||t.trigger(k,e)})}connectionState(){switch(this.conn&&this.conn.readyState){case n:return"connecting";case o:return"open";case h:return"closing";default:return"closed"}}isConnected(){return"open"===this.connectionState()}remove(e){this.off(e.stateChangeRefs),this.channels=this.channels.filter(t=>t!==e)}off(e){for(let t in this.stateChangeCallbacks)this.stateChangeCallbacks[t]=this.stateChangeCallbacks[t].filter(([t])=>-1===e.indexOf(t))}channel(e,t={}){let s=new A(e,t,this);return this.channels.push(s),s}push(e){if(this.hasLogger()){let{topic:t,event:s,payload:i,ref:n,join_ref:o}=e;this.log("push",`${t} ${s} (${o}, ${n})`,i)}this.isConnected()?this.encode(e,e=>this.conn.send(e)):this.sendBuffer.push(()=>this.encode(e,e=>this.conn.send(e)))}makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}sendHeartbeat(){if(this.isConnected())if(this.pendingHeartbeatRef)this.heartbeatTimeout();else{this.pendingHeartbeatRef=this.makeRef(),this.heartbeatSentAt=Date.now(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(e){this.log("error","error in heartbeat callback",e)}this.heartbeatTimeoutTimer=setTimeout(()=>this.heartbeatTimeout(),this.heartbeatIntervalMs)}else try{this.heartbeatCallback("disconnected")}catch(e){this.log("error","error in heartbeat callback",e)}}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}onConnMessage(e){this.decode(e.data,e=>{let{topic:t,event:s,payload:i,ref:n,join_ref:o}=e;if(n&&n===this.pendingHeartbeatRef){const e=this.heartbeatSentAt?Date.now()-this.heartbeatSentAt:void 0;this.clearHeartbeats();try{this.heartbeatCallback("ok"===i.status?"ok":"error",e)}catch(e){this.log("error","error in heartbeat callback",e)}this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.autoSendHeartbeat&&(this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}this.hasLogger()&&this.log("receive",`${i.status||""} ${t} ${s} ${n&&"("+n+")"||""}`.trim(),i);for(let e=0;e{try{i(...t)}catch(t){this.log("error",`error in ${e} callback`,t)}})}catch(t){this.log("error",`error triggering ${e} callbacks`,t)}}leaveOpenTopic(e){let t=this.channels.find(t=>t.topic===e&&(t.isJoined()||t.isJoining()));t&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${e}"`),t.leave())}}},1171,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.normalizeChannelError=function(n){if(n instanceof Error)return n;if('string'==typeof n)return new Error(n);if(n&&'object'==typeof n){const o=n;if('number'==typeof o.code){const t='string'==typeof o.reason&&o.reason?` (${o.reason})`:'';return new Error(`socket closed: ${o.code}${t}`,{cause:n})}return new Error('channel error: transport failure',{cause:n})}return new Error('channel error: connection lost')}},1172,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}});var n=r(d[0]);class t{constructor(n,t,s){const h=(o=s,{config:Object.assign({broadcast:{ack:!1,self:!1},presence:{key:'',enabled:!1},private:!1},o.config)});var o;this.channel=n.getSocket().channel(t,h),this.socket=n}get state(){return this.channel.state}set state(n){this.channel.state=n}get joinedOnce(){return this.channel.joinedOnce}get joinPush(){return this.channel.joinPush}get rejoinTimer(){return this.channel.rejoinTimer}on(n,t){return this.channel.on(n,t)}off(n,t){this.channel.off(n,t)}subscribe(n){return this.channel.join(n)}unsubscribe(n){return this.channel.leave(n)}teardown(){this.channel.teardown()}onClose(n){this.channel.onClose(n)}onError(n){return this.channel.onError(n)}push(t,s,h){let o;try{o=this.channel.push(t,s,h)}catch(n){throw new Error(`tried to push '${t}' to '${this.channel.topic}' before joining. Use channel.subscribe() before pushing events`)}if(this.channel.pushBuffer.length>n.MAX_PUSH_BUFFER_SIZE){const n=this.channel.pushBuffer.shift();n.cancelTimeout(),this.socket.log('channel',`discarded push due to buffer overflow: ${n.event}`,n.payload())}return o}updateJoinPayload(n){const t=this.channel.joinPush.payload();this.channel.joinPush.payload=()=>Object.assign(Object.assign({},t),n)}canPush(){return this.socket.isConnected()&&this.state===n.CHANNEL_STATES.joined}isJoined(){return this.state===n.CHANNEL_STATES.joined}isJoining(){return this.state===n.CHANNEL_STATES.joining}isClosed(){return this.state===n.CHANNEL_STATES.closed}isLeaving(){return this.state===n.CHANNEL_STATES.leaving}updateFilterBindings(n){this.channel.filterBindings=n}updatePayloadTransform(n){this.channel.onMessage=n}getChannel(){return this.channel}}},1173,[1164]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"RealtimePostgresFilterBuilder",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"postgresChangesFilter",{enumerable:!0,get:function(){return c}});const t=/[,()"\\]/,n=n=>t.test(n)||n!==n.trim(),s=t=>`"${t.replace(/\\/g,'\\\\').replace(/"/g,'\\"')}"`,u=t=>{const u=null===t?'null':String(t);return n(u)?s(u):u},l=t=>null===t?'null':String(t),h=(t,n)=>{if('in'===t){const t=Array.isArray(n)?n:[n];if(0===t.length)throw new Error('Realtime `in` filter requires at least one value.');return`in.(${Array.from(new Set(t)).map(t=>u(t)).join(',')})`}return'is'===t?`is.${l(n)}`:`${t}.${u(n)}`};class o{constructor(){this.filters=[]}add(t,n,s,u=!1){const l=u?'not.':'';return this.filters.push(`${t}=${l}${h(n,s)}`),this}eq(t,n){return this.add(t,'eq',n)}neq(t,n){return this.add(t,'neq',n)}gt(t,n){return this.add(t,'gt',n)}gte(t,n){return this.add(t,'gte',n)}lt(t,n){return this.add(t,'lt',n)}lte(t,n){return this.add(t,'lte',n)}in(t,n){return this.add(t,'in',n)}like(t,n){return this.add(t,'like',n)}ilike(t,n){return this.add(t,'ilike',n)}match(t,n){return this.add(t,'match',n)}imatch(t,n){return this.add(t,'imatch',n)}is(t,n){return this.add(t,'is',n)}isDistinct(t,n){return this.add(t,'isdistinct',n)}not(t,n,s){return this.add(t,n,s,!0)}build(){return this.filters.join(',')}toString(){return this.build()}}const c=()=>new o},1174,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return s}});var t=r(d[0]),n=r(d[1]);class s{constructor(n,s){this.socket=new t.Socket(n,s)}get timeout(){return this.socket.timeout}get endPoint(){return this.socket.endPoint}get transport(){return this.socket.transport}get heartbeatIntervalMs(){return this.socket.heartbeatIntervalMs}get heartbeatCallback(){return this.socket.heartbeatCallback}set heartbeatCallback(t){this.socket.heartbeatCallback=t}get heartbeatTimer(){return this.socket.heartbeatTimer}get pendingHeartbeatRef(){return this.socket.pendingHeartbeatRef}get reconnectTimer(){return this.socket.reconnectTimer}get vsn(){return this.socket.vsn}get encode(){return this.socket.encode}get decode(){return this.socket.decode}get reconnectAfterMs(){return this.socket.reconnectAfterMs}get sendBuffer(){return this.socket.sendBuffer}get stateChangeCallbacks(){return this.socket.stateChangeCallbacks}connect(){this.socket.connect()}disconnect(t,n,s,o=1e4){return new Promise(c=>{setTimeout(()=>c('timeout'),o),this.socket.disconnect(()=>{t(),c('ok')},n,s)})}push(t){this.socket.push(t)}log(t,n,s){this.socket.log(t,n,s)}makeRef(){return this.socket.makeRef()}onOpen(t){this.socket.onOpen(t)}onClose(t){this.socket.onClose(t)}onError(t){this.socket.onError(t)}onMessage(t){this.socket.onMessage(t)}isConnected(){return this.socket.isConnected()}isConnecting(){return this.socket.connectionState()==n.CONNECTION_STATE.connecting}isDisconnecting(){return this.socket.connectionState()==n.CONNECTION_STATE.closing}connectionState(){return this.socket.connectionState()}endPointURL(){return this.socket.endPointURL()}sendHeartbeat(){this.socket.sendHeartbeat()}getSocket(){return this.socket}}},1175,[1171,1164]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"StorageAnalyticsClient",{enumerable:!0,get:function(){return H}}),Object.defineProperty(_e,"StorageApiError",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"StorageClient",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(_e,"StorageError",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"StorageUnknownError",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"StorageVectorsApiError",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"StorageVectorsClient",{enumerable:!0,get:function(){return X}}),Object.defineProperty(_e,"StorageVectorsError",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"StorageVectorsErrorCode",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"StorageVectorsUnknownError",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"VectorBucketApi",{enumerable:!0,get:function(){return W}}),Object.defineProperty(_e,"VectorBucketScope",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(_e,"VectorDataApi",{enumerable:!0,get:function(){return G}}),Object.defineProperty(_e,"VectorIndexApi",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(_e,"VectorIndexScope",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(_e,"isStorageError",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"isStorageVectorsError",{enumerable:!0,get:function(){return f}});var e=_r(d[0]);function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(e,r){if("object"!=t(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,r||"default");if("object"!=t(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}function n(e){var n=r(e,"string");return"symbol"==t(n)?n:n+""}function o(e,t,r){return(t=n(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function c(e){for(var t=1;t{if("object"!=typeof e||null===e)return!1;const t=Object.getPrototypeOf(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},k=e=>{if(Array.isArray(e))return e.map(e=>k(e));if("function"==typeof e||e!==Object(e))return e;const t={};return Object.entries(e).forEach(([e,r])=>{const n=e.replace(/([-_][a-z])/gi,e=>e.toUpperCase().replace(/[-_]/g,""));t[n]=k(r)}),t},x=e=>!(!e||"string"!=typeof e)&&(!(0===e.length||e.length>100)&&(e.trim()===e&&(!e.includes("/")&&!e.includes("\\")&&/^[\w!.\*'() &$@=;:+,?-]+$/.test(e)))),$=e=>{if("object"==typeof e&&null!==e){const t=e;if("string"==typeof t.msg)return t.msg;if("string"==typeof t.message)return t.message;if("string"==typeof t.error_description)return t.error_description;if("string"==typeof t.error)return t.error;if("object"==typeof t.error&&null!==t.error){const e=t.error;if("string"==typeof e.message)return e.message}}return JSON.stringify(e)},j=async(e,t,r,n)=>{if(null!==e&&"object"==typeof e&&"json"in e&&"function"==typeof e.json){const r=e;let o=parseInt(String(r.status),10);Number.isFinite(o)||(o=500),r.json().then(e=>{const r=(null==e?void 0:e.statusCode)||(null==e?void 0:e.code)||o+"";t(new l($(e),o,r,n))}).catch(()=>{const e=o+"";t(new l(r.statusText||`HTTP ${o} error`,o,e,n))})}else t(new h($(e),e,n))},B=(e,t,r,n)=>{const o={method:e,headers:(null==t?void 0:t.headers)||{}};if("GET"===e||"HEAD"===e||!n)return c(c({},o),r);if(S(n)){var s;const e=(null==t?void 0:t.headers)||{};let r;for(const[t,n]of Object.entries(e))"content-type"===t.toLowerCase()&&(r=n);o.headers=w(e,"Content-Type",null!==(s=r)&&void 0!==s?s:"application/json"),o.body=JSON.stringify(n)}else o.body=n;return(null==t?void 0:t.duplex)&&(o.duplex=t.duplex),c(c({},o),r)};async function P(e,t,r,n,o,s,c){return new Promise((i,u)=>{e(r,B(t,n,o,s)).then(e=>{if(!e.ok)throw e;if(null==n?void 0:n.noResolveJson)return e;if("vectors"===c){const t=e.headers.get("content-type");if("0"===e.headers.get("content-length")||204===e.status)return{};if(!t||!t.includes("application/json"))return{}}return e.json()}).then(e=>i(e)).catch(e=>j(e,u,0,c))})}function N(e="storage"){return{get:async(t,r,n,o)=>P(t,"GET",r,n,o,void 0,e),post:async(t,r,n,o,s)=>P(t,"POST",r,o,s,n,e),put:async(t,r,n,o,s)=>P(t,"PUT",r,o,s,n,e),head:async(t,r,n,o)=>P(t,"HEAD",r,c(c({},n),{},{noResolveJson:!0}),o,void 0,e),remove:async(t,r,n,o,s)=>P(t,"DELETE",r,o,s,n,e)}}const E=N("storage"),{get:C,post:V,put:I,head:T,remove:U}=E,_=N("vectors");var F=class{constructor(e,t={},r,n="storage"){var o;this.shouldThrowOnError=!1,this.url=e,this.headers=O(t),this.fetch=(o=r)?(...e)=>o(...e):(...e)=>fetch(...e),this.namespace=n}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,t){return this.headers=w(this.headers,e,t),this}async handleOperation(e){try{return{data:await e(),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(u(e))return{data:null,error:e};throw e}}};let R;R=Symbol.toStringTag;var L=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[R]="StreamDownloadBuilder",this.promise=null}then(e,t){return this.getPromise().then(e,t)}catch(e){return this.getPromise().catch(e)}finally(e){return this.getPromise().finally(e)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){try{return{data:(await this.downloadFn()).body,error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(u(e))return{data:null,error:e};throw e}}};let D;D=Symbol.toStringTag;var A=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[D]="BlobDownloadBuilder",this.promise=null}asStream(){return new L(this.downloadFn,this.shouldThrowOnError)}then(e,t){return this.getPromise().then(e,t)}catch(e){return this.getPromise().catch(e)}finally(e){return this.getPromise().finally(e)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){try{return{data:await(await this.downloadFn()).blob(),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(u(e))return{data:null,error:e};throw e}}};const M={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},z={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var J=class extends F{constructor(e,t={},r,n){super(e,t,n,"storage"),this.bucketId=r}async uploadOrUpdate(e,t,r,n){var o=this;return o.handleOperation(async()=>{let s;const i=c(c({},z),n);let u=c(c({},o.headers),"POST"===e&&{"x-upsert":String(i.upsert)});const l=i.metadata;if("undefined"!=typeof Blob&&r instanceof Blob?(s=new FormData,s.append("cacheControl",i.cacheControl),l&&s.append("metadata",o.encodeMetadata(l)),s.append("",r)):"undefined"!=typeof FormData&&r instanceof FormData?(s=r,s.has("cacheControl")||s.append("cacheControl",i.cacheControl),l&&!s.has("metadata")&&s.append("metadata",o.encodeMetadata(l))):(s=r,u["cache-control"]=`max-age=${i.cacheControl}`,u["content-type"]=i.contentType,l&&(u["x-metadata"]=o.toBase64(o.encodeMetadata(l))),("undefined"!=typeof ReadableStream&&s instanceof ReadableStream||s&&"object"==typeof s&&"pipe"in s&&"function"==typeof s.pipe)&&!i.duplex&&(i.duplex="half")),null==n?void 0:n.headers)for(const[e,t]of Object.entries(n.headers))u=w(u,e,t);const h=o._removeEmptyFolders(t),p=o._getFinalPath(h),f=await("PUT"==e?I:V)(o.fetch,`${o.url}/object/${p}`,s,c({headers:u},(null==i?void 0:i.duplex)?{duplex:i.duplex}:{}));return{path:h,id:f.Id,fullPath:f.Key}})}async upload(e,t,r){return this.uploadOrUpdate("POST",e,t,r)}async uploadToSignedUrl(e,t,r,n){var o=this;const s=o._removeEmptyFolders(e),i=o._getFinalPath(s),u=new URL(o.url+`/object/upload/sign/${i}`);return u.searchParams.set("token",t),o.handleOperation(async()=>{let e;const t=c(c({},z),n);let i=c(c({},o.headers),{"x-upsert":String(t.upsert)});const l=t.metadata;if("undefined"!=typeof Blob&&r instanceof Blob?(e=new FormData,e.append("cacheControl",t.cacheControl),l&&e.append("metadata",o.encodeMetadata(l)),e.append("",r)):"undefined"!=typeof FormData&&r instanceof FormData?(e=r,e.has("cacheControl")||e.append("cacheControl",t.cacheControl),l&&!e.has("metadata")&&e.append("metadata",o.encodeMetadata(l))):(e=r,i["cache-control"]=`max-age=${t.cacheControl}`,i["content-type"]=t.contentType,l&&(i["x-metadata"]=o.toBase64(o.encodeMetadata(l))),("undefined"!=typeof ReadableStream&&e instanceof ReadableStream||e&&"object"==typeof e&&"pipe"in e&&"function"==typeof e.pipe)&&!t.duplex&&(t.duplex="half")),null==n?void 0:n.headers)for(const[e,t]of Object.entries(n.headers))i=w(i,e,t);return{path:s,fullPath:(await I(o.fetch,u.toString(),e,c({headers:i},(null==t?void 0:t.duplex)?{duplex:t.duplex}:{}))).Key}})}async createSignedUploadUrl(e,t){var r=this;return r.handleOperation(async()=>{let n=r._getFinalPath(e);const o=c({},r.headers);(null==t?void 0:t.upsert)&&(o["x-upsert"]="true");const s=await V(r.fetch,`${r.url}/object/upload/sign/${n}`,{},{headers:o}),u=new URL(r.url+s.url),l=u.searchParams.get("token");if(!l)throw new i("No token returned by API");return{signedUrl:u.toString(),path:e,token:l}})}async update(e,t,r){return this.uploadOrUpdate("PUT",e,t,r)}async move(e,t,r){var n=this;return n.handleOperation(async()=>await V(n.fetch,`${n.url}/object/move`,{bucketId:n.bucketId,sourceKey:e,destinationKey:t,destinationBucket:null==r?void 0:r.destinationBucket},{headers:n.headers}))}async copy(e,t,r){var n=this;return n.handleOperation(async()=>({path:(await V(n.fetch,`${n.url}/object/copy`,{bucketId:n.bucketId,sourceKey:e,destinationKey:t,destinationBucket:null==r?void 0:r.destinationBucket},{headers:n.headers})).Key}))}async createSignedUrl(e,t,r){var n=this;return n.handleOperation(async()=>{let o=n._getFinalPath(e);const s="object"==typeof(null==r?void 0:r.transform)&&null!==r.transform&&Object.keys(r.transform).length>0;let i=await V(n.fetch,`${n.url}/object/sign/${o}`,c({expiresIn:t},s?{transform:r.transform}:{}),{headers:n.headers});const u=new URLSearchParams;(null==r?void 0:r.download)&&u.set("download",!0===r.download?"":r.download),null!=(null==r?void 0:r.cacheNonce)&&u.set("cacheNonce",String(r.cacheNonce));const l=u.toString();return{signedUrl:encodeURI(`${n.url}${i.signedURL}${l?`&${l}`:""}`)}})}async createSignedUrls(e,t,r){var n=this;return n.handleOperation(async()=>{const o=await V(n.fetch,`${n.url}/object/sign/${n.bucketId}`,{expiresIn:t,paths:e},{headers:n.headers}),s=new URLSearchParams;(null==r?void 0:r.download)&&s.set("download",!0===r.download?"":r.download),null!=(null==r?void 0:r.cacheNonce)&&s.set("cacheNonce",String(r.cacheNonce));const i=s.toString();return o.map(e=>c(c({},e),{},{signedUrl:e.signedURL?encodeURI(`${n.url}${e.signedURL}${i?`&${i}`:""}`):null}))})}download(e,t,r){const n="object"==typeof(null==t?void 0:t.transform)&&null!==t.transform&&Object.keys(t.transform).length>0?"render/image/authenticated":"object",o=new URLSearchParams;(null==t?void 0:t.transform)&&this.applyTransformOptsToQuery(o,t.transform),null!=(null==t?void 0:t.cacheNonce)&&o.set("cacheNonce",String(t.cacheNonce));const s=o.toString(),c=this._getFinalPath(e);return new A(()=>C(this.fetch,`${this.url}/${n}/${c}${s?`?${s}`:""}`,{headers:this.headers,noResolveJson:!0},r),this.shouldThrowOnError)}async info(e){var t=this;const r=t._getFinalPath(e);return t.handleOperation(async()=>k(await C(t.fetch,`${t.url}/object/info/${r}`,{headers:t.headers})))}async exists(e){var t=this;const r=t._getFinalPath(e);try{return await T(t.fetch,`${t.url}/object/${r}`,{headers:t.headers}),{data:!0,error:null}}catch(e){if(t.shouldThrowOnError)throw e;if(u(e)){var n;const t=e instanceof l?e.status:e instanceof h?null===(n=e.originalError)||void 0===n?void 0:n.status:void 0;if(void 0!==t&&[400,404].includes(t))return{data:!1,error:e}}throw e}}getPublicUrl(e,t){const r=this._getFinalPath(e),n=new URLSearchParams;(null==t?void 0:t.download)&&n.set("download",!0===t.download?"":t.download),(null==t?void 0:t.transform)&&this.applyTransformOptsToQuery(n,t.transform),null!=(null==t?void 0:t.cacheNonce)&&n.set("cacheNonce",String(t.cacheNonce));const o=n.toString(),s="object"==typeof(null==t?void 0:t.transform)&&null!==t.transform&&Object.keys(t.transform).length>0?"render/image":"object";return{data:{publicUrl:encodeURI(`${this.url}/${s}/public/${r}`)+(o?`?${o}`:"")}}}async remove(e){var t=this;return t.handleOperation(async()=>await U(t.fetch,`${t.url}/object/${t.bucketId}`,{prefixes:e},{headers:t.headers}))}async purgeCache(e,t,r){var n=this;return n.handleOperation(async()=>{const o=n._getFinalPath(e),s=new URLSearchParams;(null==t?void 0:t.transformations)&&s.set("transformations","true");const c=s.toString();return await U(n.fetch,`${n.url}/cdn/${o}${c?`?${c}`:""}`,{},{headers:n.headers},r)})}async list(e,t,r){var n=this;return n.handleOperation(async()=>{const o=(null==t?void 0:t.sortBy)?c(c({},M.sortBy),t.sortBy):M.sortBy,s=c(c(c({},M),t),{},{sortBy:o,prefix:e||""});return await V(n.fetch,`${n.url}/object/list/${n.bucketId}`,s,{headers:n.headers},r)})}async listV2(e,t){var r=this;return r.handleOperation(async()=>{const n=c({},e);return await V(r.fetch,`${r.url}/object/list-v2/${r.bucketId}`,n,{headers:r.headers},t)})}encodeMetadata(e){return JSON.stringify(e)}toBase64(e){return"undefined"!=typeof Buffer?Buffer.from(e).toString("base64"):btoa(e)}_getFinalPath(e){return`${this.bucketId}/${e.replace(/^\/+/,"")}`}_removeEmptyFolders(e){return e.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}applyTransformOptsToQuery(e,t){return t.width&&e.set("width",t.width.toString()),t.height&&e.set("height",t.height.toString()),t.resize&&e.set("resize",t.resize),t.format&&e.set("format",t.format),t.quality&&e.set("quality",t.quality.toString()),e}};const K={"X-Client-Info":"storage-js/2.109.0"};var q=class extends F{constructor(e,t={},r,n){const o=new URL(e);(null==n?void 0:n.useNewHostname)&&/supabase\.(co|in|red)$/.test(o.hostname)&&!o.hostname.includes("storage.supabase.")&&(o.hostname=o.hostname.replace("supabase.","storage.supabase."));super(o.href.replace(/\/$/,""),c(c({},K),t),r,"storage")}async listBuckets(e){var t=this;return t.handleOperation(async()=>{const r=t.listBucketOptionsToQueryString(e);return await C(t.fetch,`${t.url}/bucket${r}`,{headers:t.headers})})}async getBucket(e){var t=this;return t.handleOperation(async()=>await C(t.fetch,`${t.url}/bucket/${e}`,{headers:t.headers}))}async createBucket(e,t={public:!1}){var r=this;return r.handleOperation(async()=>await V(r.fetch,`${r.url}/bucket`,{id:e,name:e,type:t.type,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:r.headers}))}async updateBucket(e,t){var r=this;return r.handleOperation(async()=>await I(r.fetch,`${r.url}/bucket/${e}`,{id:e,name:e,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:r.headers}))}async emptyBucket(e){var t=this;return t.handleOperation(async()=>await V(t.fetch,`${t.url}/bucket/${e}/empty`,{},{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await U(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}))}async purgeBucketCache(e,t,r){var n=this;return n.handleOperation(async()=>{const o=new URLSearchParams;(null==t?void 0:t.transformations)&&o.set("transformations","true");const s=o.toString();return await U(n.fetch,`${n.url}/cdn/${e}${s?`?${s}`:""}`,{},{headers:n.headers},r)})}listBucketOptionsToQueryString(e){const t={};return e&&("limit"in e&&(t.limit=String(e.limit)),"offset"in e&&(t.offset=String(e.offset)),e.search&&(t.search=e.search),e.sortColumn&&(t.sortColumn=e.sortColumn),e.sortOrder&&(t.sortOrder=e.sortOrder)),Object.keys(t).length>0?"?"+new URLSearchParams(t).toString():""}},H=class extends F{constructor(e,t={},r){super(e.replace(/\/$/,""),c(c({},K),t),r,"storage")}async createBucket(e){var t=this;return t.handleOperation(async()=>await V(t.fetch,`${t.url}/bucket`,{name:e},{headers:t.headers}))}async listBuckets(e){var t=this;return t.handleOperation(async()=>{const r=new URLSearchParams;void 0!==(null==e?void 0:e.limit)&&r.set("limit",e.limit.toString()),void 0!==(null==e?void 0:e.offset)&&r.set("offset",e.offset.toString()),(null==e?void 0:e.sortColumn)&&r.set("sortColumn",e.sortColumn),(null==e?void 0:e.sortOrder)&&r.set("sortOrder",e.sortOrder),(null==e?void 0:e.search)&&r.set("search",e.search);const n=r.toString(),o=n?`${t.url}/bucket?${n}`:`${t.url}/bucket`;return await C(t.fetch,o,{headers:t.headers})})}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await U(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}))}from(t){var r=this;if(!x(t))throw new i("Invalid bucket name: File, folder, and bucket names must follow AWS object key naming guidelines and should avoid the use of any other characters.");const n=new e.IcebergRestCatalog({baseUrl:this.url,catalogName:t,auth:{type:"custom",getHeaders:async()=>r.headers},fetch:this.fetch}),o=this.shouldThrowOnError;return new Proxy(n,{get(e,t){const r=e[t];return"function"!=typeof r?r:async(...t)=>{try{return{data:await r.apply(e,t),error:null}}catch(e){if(o)throw e;return{data:null,error:e}}}}})}},Q=class extends F{constructor(e,t={},r){super(e.replace(/\/$/,""),c(c({},K),{},{"Content-Type":"application/json"},t),r,"vectors")}async createIndex(e){var t=this;return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/CreateIndex`,e,{headers:t.headers})||{})}async getIndex(e,t){var r=this;return r.handleOperation(async()=>await _.post(r.fetch,`${r.url}/GetIndex`,{vectorBucketName:e,indexName:t},{headers:r.headers}))}async listIndexes(e){var t=this;return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/ListIndexes`,e,{headers:t.headers}))}async deleteIndex(e,t){var r=this;return r.handleOperation(async()=>await _.post(r.fetch,`${r.url}/DeleteIndex`,{vectorBucketName:e,indexName:t},{headers:r.headers})||{})}},G=class extends F{constructor(e,t={},r){super(e.replace(/\/$/,""),c(c({},K),{},{"Content-Type":"application/json"},t),r,"vectors")}async putVectors(e){var t=this;if(e.vectors.length<1||e.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/PutVectors`,e,{headers:t.headers})||{})}async getVectors(e){var t=this;return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/GetVectors`,e,{headers:t.headers}))}async listVectors(e){var t=this;if(void 0!==e.segmentCount){if(e.segmentCount<1||e.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(void 0!==e.segmentIndex&&(e.segmentIndex<0||e.segmentIndex>=e.segmentCount))throw new Error("segmentIndex must be between 0 and "+(e.segmentCount-1))}return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/ListVectors`,e,{headers:t.headers}))}async queryVectors(e){var t=this;return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/QueryVectors`,e,{headers:t.headers}))}async deleteVectors(e){var t=this;if(e.keys.length<1||e.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/DeleteVectors`,e,{headers:t.headers})||{})}},W=class extends F{constructor(e,t={},r){super(e.replace(/\/$/,""),c(c({},K),{},{"Content-Type":"application/json"},t),r,"vectors")}async createBucket(e){var t=this;return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}async getBucket(e){var t=this;return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/GetVectorBucket`,{vectorBucketName:e},{headers:t.headers}))}async listBuckets(e={}){var t=this;return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/ListVectorBuckets`,e,{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}},X=class extends W{constructor(e,t={}){super(e,t.headers||{},t.fetch)}from(e){return new Y(this.url,this.headers,e,this.fetch)}async createBucket(e){return(()=>super.createBucket)().call(this,e)}async getBucket(e){return(()=>super.getBucket)().call(this,e)}async listBuckets(e={}){return(()=>super.listBuckets)().call(this,e)}async deleteBucket(e){return(()=>super.deleteBucket)().call(this,e)}},Y=class extends Q{constructor(e,t,r,n){super(e,t,n),this.vectorBucketName=r}async createIndex(e){return(()=>super.createIndex)().call(this,c(c({},e),{},{vectorBucketName:this.vectorBucketName}))}async listIndexes(e={}){return(()=>super.listIndexes)().call(this,c(c({},e),{},{vectorBucketName:this.vectorBucketName}))}async getIndex(e){return(()=>super.getIndex)().call(this,this.vectorBucketName,e)}async deleteIndex(e){return(()=>super.deleteIndex)().call(this,this.vectorBucketName,e)}index(e){return new Z(this.url,this.headers,this.vectorBucketName,e,this.fetch)}},Z=class extends G{constructor(e,t,r,n,o){super(e,t,o),this.vectorBucketName=r,this.indexName=n}async putVectors(e){var t=this;return(()=>super.putVectors)().call(t,c(c({},e),{},{vectorBucketName:t.vectorBucketName,indexName:t.indexName}))}async getVectors(e){var t=this;return(()=>super.getVectors)().call(t,c(c({},e),{},{vectorBucketName:t.vectorBucketName,indexName:t.indexName}))}async listVectors(e={}){var t=this;return(()=>super.listVectors)().call(t,c(c({},e),{},{vectorBucketName:t.vectorBucketName,indexName:t.indexName}))}async queryVectors(e){var t=this;return(()=>super.queryVectors)().call(t,c(c({},e),{},{vectorBucketName:t.vectorBucketName,indexName:t.indexName}))}async deleteVectors(e){var t=this;return(()=>super.deleteVectors)().call(t,c(c({},e),{},{vectorBucketName:t.vectorBucketName,indexName:t.indexName}))}},ee=class extends q{constructor(e,t={},r,n){super(e,t,r,n)}from(e){return new J(this.url,this.headers,e,this.fetch)}get vectors(){return new X(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new H(this.url+"/iceberg",this.headers,this.fetch)}}},1176,[1177]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IcebergError",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"IcebergRestCatalog",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"getCurrentSchema",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"isDecimalType",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"isFixedType",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"parseDecimalType",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"parseFixedType",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"typesEqual",{enumerable:!0,get:function(){return x}});var t=class extends Error{constructor(t,a){super(t),this.name="IcebergError",this.status=a.status,this.icebergType=a.icebergType,this.icebergCode=a.icebergCode,this.details=a.details,this.isCommitStateUnknown="CommitStateUnknownException"===a.icebergType||[500,502,504].includes(a.status)&&!0===a.icebergType?.includes("CommitState")}isNotFound(){return 404===this.status}isConflict(){return 409===this.status}isAuthenticationTimeout(){return 419===this.status}};function a(t,a,s){const n=new URL(a,t);if(s)for(const[t,a]of Object.entries(s))void 0!==a&&n.searchParams.set(t,a);return n.toString()}async function s(t){return t&&"none"!==t.type?"bearer"===t.type?{Authorization:`Bearer ${t.token}`}:"header"===t.type?{[t.name]:t.value}:"custom"===t.type?await t.getHeaders():{}:{}}function n(n){const c=n.fetchImpl??globalThis.fetch;return{async request({method:o,path:p,query:u,body:l,headers:h}){const b=a(n.baseUrl,p,u),f=await s(n.auth),y=await c(b,{method:o,headers:{...l?{"Content-Type":"application/json"}:{},...f,...h},body:l?JSON.stringify(l):void 0}),T=await y.text(),w=(y.headers.get("content-type")||"").includes("application/json"),x=w&&T?JSON.parse(T):T;if(!y.ok){const a=w?x:void 0,s=a?.error;throw new t(s?.message??`Request failed with status ${y.status}`,{status:y.status,icebergType:s?.type,icebergCode:s?.code,details:a})}return{status:y.status,headers:y.headers,data:x}}}}function c(t){return t.join("\x1f")}var o=class{constructor(t,a=""){this.client=t,this.prefix=a}async listNamespaces(t){const a=t?{parent:c(t.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:a})).data.namespaces.map(t=>({namespace:t}))}async createNamespace(t,a){const s={namespace:t.namespace,properties:a?.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:s})).data}async dropNamespace(t){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${c(t.namespace)}`})}async loadNamespaceMetadata(t){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${c(t.namespace)}`})).data.properties}}async namespaceExists(a){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${c(a.namespace)}`}),!0}catch(a){if(a instanceof t&&404===a.status)return!1;throw a}}async createNamespaceIfNotExists(a,s){try{return await this.createNamespace(a,s)}catch(a){if(a instanceof t&&409===a.status)return;throw a}}};function p(t){return t.join("\x1f")}var u=class{constructor(t,a="",s){this.client=t,this.prefix=a,this.accessDelegation=s}async listTables(t){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${p(t.namespace)}/tables`})).data.identifiers}async createTable(t,a){const s={};this.accessDelegation&&(s["X-Iceberg-Access-Delegation"]=this.accessDelegation);return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${p(t.namespace)}/tables`,body:a,headers:s})).data.metadata}async updateTable(t,a){const s=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${p(t.namespace)}/tables/${t.name}`,body:a});return{"metadata-location":s.data["metadata-location"],metadata:s.data.metadata}}async dropTable(t,a){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${p(t.namespace)}/tables/${t.name}`,query:{purgeRequested:String(a?.purge??!1)}})}async loadTable(t){const a={};this.accessDelegation&&(a["X-Iceberg-Access-Delegation"]=this.accessDelegation);return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${p(t.namespace)}/tables/${t.name}`,headers:a})).data.metadata}async tableExists(a){const s={};this.accessDelegation&&(s["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${p(a.namespace)}/tables/${a.name}`,headers:s}),!0}catch(a){if(a instanceof t&&404===a.status)return!1;throw a}}async createTableIfNotExists(a,s){try{return await this.createTable(a,s)}catch(n){if(n instanceof t&&409===n.status)return await this.loadTable({namespace:a.namespace,name:s.name});throw n}}},l=class{constructor(t){let a="v1";t.catalogName&&(a+=`/${t.catalogName}`);const s=t.baseUrl.endsWith("/")?t.baseUrl:`${t.baseUrl}/`;this.client=n({baseUrl:s,auth:t.auth,fetchImpl:t.fetch}),this.accessDelegation=t.accessDelegation?.join(","),this.namespaceOps=new o(this.client,a),this.tableOps=new u(this.client,a,this.accessDelegation)}async listNamespaces(t){return this.namespaceOps.listNamespaces(t)}async createNamespace(t,a){return this.namespaceOps.createNamespace(t,a)}async dropNamespace(t){await this.namespaceOps.dropNamespace(t)}async loadNamespaceMetadata(t){return this.namespaceOps.loadNamespaceMetadata(t)}async listTables(t){return this.tableOps.listTables(t)}async createTable(t,a){return this.tableOps.createTable(t,a)}async updateTable(t,a){return this.tableOps.updateTable(t,a)}async dropTable(t,a){await this.tableOps.dropTable(t,a)}async loadTable(t){return this.tableOps.loadTable(t)}async namespaceExists(t){return this.namespaceOps.namespaceExists(t)}async tableExists(t){return this.tableOps.tableExists(t)}async createNamespaceIfNotExists(t,a){return this.namespaceOps.createNamespaceIfNotExists(t,a)}async createTableIfNotExists(t,a){return this.tableOps.createTableIfNotExists(t,a)}},h=/^decimal\s*\(\s*(\d+)\s*,\s*(\d+)\s*\)$/,b=/^fixed\s*\[\s*(\d+)\s*\]$/;function f(t){const a=t.match(h);return a?{precision:parseInt(a[1],10),scale:parseInt(a[2],10)}:null}function y(t){const a=t.match(b);return a?{length:parseInt(a[1],10)}:null}function T(t){return h.test(t)}function w(t){return b.test(t)}function x(t,a){const s=f(t),n=f(a);if(s&&n)return s.precision===n.precision&&s.scale===n.scale;const c=y(t),o=y(a);return c&&o?c.length===o.length:t===a}function O(t){return t.schemas.find(a=>a["schema-id"]===t["current-schema-id"])}},1177,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"navigatorLock",{enumerable:!0,get:function(){return l.navigatorLock}}),Object.defineProperty(_e,"NavigatorLockAcquireTimeoutError",{enumerable:!0,get:function(){return l.NavigatorLockAcquireTimeoutError}}),Object.defineProperty(_e,"lockInternals",{enumerable:!0,get:function(){return l.internals}}),Object.defineProperty(_e,"processLock",{enumerable:!0,get:function(){return l.processLock}}),Object.defineProperty(_e,"GoTrueAdminApi",{enumerable:!0,get:function(){return t.default}}),Object.defineProperty(_e,"GoTrueClient",{enumerable:!0,get:function(){return n.default}}),Object.defineProperty(_e,"AuthAdminApi",{enumerable:!0,get:function(){return o.default}}),Object.defineProperty(_e,"AuthClient",{enumerable:!0,get:function(){return u.default}});var t=e(r(d[0])),n=e(r(d[1])),o=e(r(d[2])),u=e(r(d[3])),c=r(d[4]);Object.keys(c).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return c[e]}})});var f=r(d[5]);Object.keys(f).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return f[e]}})});var l=r(d[6])},1178,[1179,1187,1194,1195,1186,1184,1189]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return u}});var t=r(d[0]),s=r(d[1]),n=r(d[2]),o=r(d[3]),h=r(d[4]);class u{constructor({url:t="",headers:s={},fetch:o,experimental:h}){this.url=t,this.headers=s,this.fetch=(0,n.resolveFetch)(o),this.experimental=null!=h?h:{},this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)},this.oauth={listClients:this._listOAuthClients.bind(this),createClient:this._createOAuthClient.bind(this),getClient:this._getOAuthClient.bind(this),updateClient:this._updateOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)},this.customProviders={listProviders:this._listCustomProviders.bind(this),createProvider:this._createCustomProvider.bind(this),getProvider:this._getCustomProvider.bind(this),updateProvider:this._updateCustomProvider.bind(this),deleteProvider:this._deleteCustomProvider.bind(this)},this.passkey={listPasskeys:this._adminListPasskeys.bind(this),deletePasskey:this._adminDeletePasskey.bind(this)}}async signOut(t,n=o.SIGN_OUT_SCOPES[0]){if(o.SIGN_OUT_SCOPES.indexOf(n)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${o.SIGN_OUT_SCOPES.join(', ')}`);try{return await(0,s._request)(this.fetch,'POST',`${this.url}/logout?scope=${n}`,{headers:this.headers,jwt:t,noResolveJson:!0}),{data:null,error:null}}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async inviteUserByEmail(t,n={}){try{return await(0,s._request)(this.fetch,'POST',`${this.url}/invite`,{body:{email:t,data:n.data},headers:this.headers,redirectTo:n.redirectTo,xform:s._userResponse})}catch(t){if((0,h.isAuthError)(t))return{data:{user:null},error:t};throw t}}async generateLink(n){try{const{options:o}=n,h=(0,t.__rest)(n,["options"]),u=Object.assign(Object.assign({},h),o);return'newEmail'in h&&(u.new_email=null==h?void 0:h.newEmail,delete u.newEmail),await(0,s._request)(this.fetch,'POST',`${this.url}/admin/generate_link`,{body:u,headers:this.headers,xform:s._generateLinkResponse,redirectTo:null==o?void 0:o.redirectTo})}catch(t){if((0,h.isAuthError)(t))return{data:{properties:null,user:null},error:t};throw t}}async createUser(t){try{return await(0,s._request)(this.fetch,'POST',`${this.url}/admin/users`,{body:t,headers:this.headers,xform:s._userResponse})}catch(t){if((0,h.isAuthError)(t))return{data:{user:null},error:t};throw t}}async listUsers(t){var n,o,u,l,c,f,_;try{const h={nextPage:null,lastPage:0,total:0},y=await(0,s._request)(this.fetch,'GET',`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:null!==(o=null===(n=null==t?void 0:t.page)||void 0===n?void 0:n.toString())&&void 0!==o?o:'',per_page:null!==(l=null===(u=null==t?void 0:t.perPage)||void 0===u?void 0:u.toString())&&void 0!==l?l:''},xform:s._noResolveJsonResponse});if(y.error)throw y.error;const v=await y.json(),p=null!==(c=y.headers.get('x-total-count'))&&void 0!==c?c:0,E=null!==(_=null===(f=y.headers.get('link'))||void 0===f?void 0:f.split(','))&&void 0!==_?_:[];return E.length>0&&(E.forEach(t=>{const s=parseInt(t.split(';')[0].split('=')[1].substring(0,1)),n=JSON.parse(t.split(';')[1].split('=')[1]);h[`${n}Page`]=s}),h.total=parseInt(p)),{data:Object.assign(Object.assign({},v),h),error:null}}catch(t){if((0,h.isAuthError)(t))return{data:{users:[]},error:t};throw t}}async getUserById(t){(0,n.validateUUID)(t);try{return await(0,s._request)(this.fetch,'GET',`${this.url}/admin/users/${t}`,{headers:this.headers,xform:s._userResponse})}catch(t){if((0,h.isAuthError)(t))return{data:{user:null},error:t};throw t}}async updateUserById(t,o){(0,n.validateUUID)(t);try{return await(0,s._request)(this.fetch,'PUT',`${this.url}/admin/users/${t}`,{body:o,headers:this.headers,xform:s._userResponse})}catch(t){if((0,h.isAuthError)(t))return{data:{user:null},error:t};throw t}}async deleteUser(t,o=!1){(0,n.validateUUID)(t);try{return await(0,s._request)(this.fetch,'DELETE',`${this.url}/admin/users/${t}`,{headers:this.headers,body:{should_soft_delete:o},xform:s._userResponse})}catch(t){if((0,h.isAuthError)(t))return{data:{user:null},error:t};throw t}}async _listFactors(t){(0,n.validateUUID)(t.userId);try{const{data:n,error:o}=await(0,s._request)(this.fetch,'GET',`${this.url}/admin/users/${t.userId}/factors`,{headers:this.headers,xform:t=>({data:{factors:t},error:null})});return{data:n,error:o}}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _deleteFactor(t){(0,n.validateUUID)(t.userId),(0,n.validateUUID)(t.id);try{return{data:await(0,s._request)(this.fetch,'DELETE',`${this.url}/admin/users/${t.userId}/factors/${t.id}`,{headers:this.headers}),error:null}}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _listOAuthClients(t){var n,o,u,l,c,f,_;try{const h={nextPage:null,lastPage:0,total:0},y=await(0,s._request)(this.fetch,'GET',`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:null!==(o=null===(n=null==t?void 0:t.page)||void 0===n?void 0:n.toString())&&void 0!==o?o:'',per_page:null!==(l=null===(u=null==t?void 0:t.perPage)||void 0===u?void 0:u.toString())&&void 0!==l?l:''},xform:s._noResolveJsonResponse});if(y.error)throw y.error;const v=await y.json(),p=null!==(c=y.headers.get('x-total-count'))&&void 0!==c?c:0,E=null!==(_=null===(f=y.headers.get('link'))||void 0===f?void 0:f.split(','))&&void 0!==_?_:[];return E.length>0&&(E.forEach(t=>{const s=parseInt(t.split(';')[0].split('=')[1].substring(0,1)),n=JSON.parse(t.split(';')[1].split('=')[1]);h[`${n}Page`]=s}),h.total=parseInt(p)),{data:Object.assign(Object.assign({},v),h),error:null}}catch(t){if((0,h.isAuthError)(t))return{data:{clients:[]},error:t};throw t}}async _createOAuthClient(t){try{return await(0,s._request)(this.fetch,'POST',`${this.url}/admin/oauth/clients`,{body:t,headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _getOAuthClient(t){try{return await(0,s._request)(this.fetch,'GET',`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _updateOAuthClient(t,n){try{return await(0,s._request)(this.fetch,'PUT',`${this.url}/admin/oauth/clients/${t}`,{body:n,headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _deleteOAuthClient(t){try{return await(0,s._request)(this.fetch,'DELETE',`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _regenerateOAuthClientSecret(t){try{return await(0,s._request)(this.fetch,'POST',`${this.url}/admin/oauth/clients/${t}/regenerate_secret`,{headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _listCustomProviders(t){try{const n={};return(null==t?void 0:t.type)&&(n.type=t.type),await(0,s._request)(this.fetch,'GET',`${this.url}/admin/custom-providers`,{headers:this.headers,query:n,xform:t=>{var s;return{data:{providers:null!==(s=null==t?void 0:t.providers)&&void 0!==s?s:[]},error:null}}})}catch(t){if((0,h.isAuthError)(t))return{data:{providers:[]},error:t};throw t}}async _createCustomProvider(t){try{return await(0,s._request)(this.fetch,'POST',`${this.url}/admin/custom-providers`,{body:t,headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _getCustomProvider(t){try{return await(0,s._request)(this.fetch,'GET',`${this.url}/admin/custom-providers/${t}`,{headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _updateCustomProvider(t,n){try{return await(0,s._request)(this.fetch,'PUT',`${this.url}/admin/custom-providers/${t}`,{body:n,headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _deleteCustomProvider(t){try{return await(0,s._request)(this.fetch,'DELETE',`${this.url}/admin/custom-providers/${t}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _adminListPasskeys(t){(0,n.assertPasskeyExperimentalEnabled)(this.experimental),(0,n.validateUUID)(t.userId);try{return await(0,s._request)(this.fetch,'GET',`${this.url}/admin/users/${t.userId}/passkeys`,{headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _adminDeletePasskey(t){(0,n.assertPasskeyExperimentalEnabled)(this.experimental),(0,n.validateUUID)(t.userId),(0,n.validateUUID)(t.passkeyId);try{return await(0,s._request)(this.fetch,'DELETE',`${this.url}/admin/users/${t.userId}/passkeys/${t.passkeyId}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}}},1179,[1157,1180,1183,1186,1184]); +__d(function(g,r,_i,_a2,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.handleError=i,_e._request=async function(e,o,t,n){var a;const i=Object.assign({},null==n?void 0:n.headers);i[s.API_VERSION_HEADER_NAME]||(i[s.API_VERSION_HEADER_NAME]=s.API_VERSIONS['2024-01-01'].name);(null==n?void 0:n.jwt)&&(i.Authorization=`Bearer ${n.jwt}`);const u=null!==(a=null==n?void 0:n.query)&&void 0!==a?a:{};(null==n?void 0:n.redirectTo)&&(u.redirect_to=n.redirectTo);const l=Object.keys(u).length?'?'+new URLSearchParams(u).toString():'',_=await c(e,o,t+l,{headers:i,noResolveJson:null==n?void 0:n.noResolveJson},{},null==n?void 0:n.body);return(null==n?void 0:n.xform)?null==n?void 0:n.xform(_):{data:Object.assign({},_),error:null}},_e._sessionResponse=l,_e._sessionResponsePassword=function(e){const s=l(e);!s.error&&e.weak_password&&'object'==typeof e.weak_password&&Array.isArray(e.weak_password.reasons)&&e.weak_password.reasons.length&&e.weak_password.message&&'string'==typeof e.weak_password.message&&e.weak_password.reasons.reduce((e,s)=>e&&'string'==typeof s,!0)&&(s.data.weak_password=e.weak_password);return s},_e._userResponse=function(e){var s;return{data:{user:null!==(s=e.user)&&void 0!==s?s:e},error:null}},_e._ssoResponse=function(e){return{data:e,error:null}},_e._generateLinkResponse=function(s){const{action_link:o,email_otp:t,hashed_token:n,redirect_to:a,verification_type:i}=s,u=(0,e.__rest)(s,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),c={action_link:o,email_otp:t,hashed_token:n,redirect_to:a,verification_type:i},l=Object.assign({},u);return{data:{properties:c,user:l},error:null}},_e._noResolveJsonResponse=function(e){return e};var e=r(d[0]),s=r(d[1]),o=r(d[2]),t=r(d[3]);const n=e=>{if('object'==typeof e&&null!==e){const s=e;if('string'==typeof s.msg)return s.msg;if('string'==typeof s.message)return s.message;if('string'==typeof s.error_description)return s.error_description;if('string'==typeof s.error)return s.error}return JSON.stringify(e)},a=[500,501,502,503,504,520,521,522,523,524,525,526,527,528,529,530];async function i(e){var i;if(!(0,o.looksLikeFetchResponse)(e))throw new t.AuthRetryableFetchError(n(e),0);if(a.includes(e.status))throw new t.AuthRetryableFetchError(n(e),e.status);let u,c;try{u=await e.json()}catch(e){throw new t.AuthUnknownError(n(e),e)}const l=(0,o.parseResponseAPIVersion)(e);if(l&&l.getTime()>=s.API_VERSIONS['2024-01-01'].timestamp&&'object'==typeof u&&u&&'string'==typeof u.code?c=u.code:'object'==typeof u&&u&&'string'==typeof u.error_code&&(c=u.error_code),c){if('weak_password'===c)throw new t.AuthWeakPasswordError(n(u),e.status,(null===(i=u.weak_password)||void 0===i?void 0:i.reasons)||[]);if('session_not_found'===c)throw new t.AuthSessionMissingError}else if('object'==typeof u&&u&&'object'==typeof u.weak_password&&u.weak_password&&Array.isArray(u.weak_password.reasons)&&u.weak_password.reasons.length&&u.weak_password.reasons.reduce((e,s)=>e&&'string'==typeof s,!0))throw new t.AuthWeakPasswordError(n(u),e.status,u.weak_password.reasons);throw new t.AuthApiError(n(u),e.status||500,c)}const u=(e,s,o,t)=>{const n={method:e,headers:(null==s?void 0:s.headers)||{}};return'GET'===e?n:(n.headers=Object.assign({'Content-Type':'application/json;charset=UTF-8'},null==s?void 0:s.headers),n.body=JSON.stringify(t),Object.assign(Object.assign({},n),o))};async function c(e,s,o,a,c,l){const _=u(s,a,c,l);let p;try{p=await e(o,Object.assign({},_))}catch(e){throw console.error(e),new t.AuthRetryableFetchError(n(e),0)}if(p.ok||await i(p),null==a?void 0:a.noResolveJson)return p;try{return await p.json()}catch(e){await i(e)}}function l(e){var s;let t=null;_(e)&&(t=Object.assign({},e),e.expires_at||(t.expires_at=(0,o.expiresAt)(e.expires_in)));return{data:{session:t,user:null!==(s=e.user)&&void 0!==s?s:'string'==typeof(null==e?void 0:e.id)?e:null},error:null}}function _(e){return!!e.access_token&&!!e.refresh_token&&!!e.expires_in}},1180,[1157,1181,1183,1184]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"AUTO_REFRESH_TICK_DURATION_MS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"AUTO_REFRESH_TICK_THRESHOLD",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"EXPIRY_MARGIN_MS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"REFRESH_FAILURE_COOLDOWN_MS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"GOTRUE_URL",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"STORAGE_KEY",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"AUDIENCE",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"DEFAULT_HEADERS",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"NETWORK_FAILURE",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"API_VERSION_HEADER_NAME",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"API_VERSIONS",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"BASE64URL_REGEX",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"JWKS_TTL",{enumerable:!0,get:function(){return A}});var t=r(d[0]);const n=3e4,u=3,o=9e4,c=6e4,E='http://localhost:9999',_='supabase.auth.token',b='',f={'X-Client-Info':`gotrue-js/${t.version}`},R={MAX_RETRIES:10,RETRY_INTERVAL:2},O='X-Supabase-Api-Version',p={'2024-01-01':{timestamp:Date.parse('2024-01-01T00:00:00.0Z'),name:'2024-01-01'}},l=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,A=6e5},1181,[1182]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"version",{enumerable:!0,get:function(){return t}});const t='2.109.0'},1182,[]); +__d(function(g,r,_i,a,m,_e2,d){"use strict";Object.defineProperty(_e2,'__esModule',{value:!0}),_e2.expiresAt=function(e){return Math.round(Date.now()/1e3)+e},_e2.generateCallbackId=function(){return Symbol('auth-callback')},Object.defineProperty(_e2,"isBrowser",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e2,"supportsLocalStorage",{enumerable:!0,get:function(){return i}}),_e2.parseParametersFromURL=function(e){const t={},n=new URL(e);if(n.hash&&'#'===n.hash[0])try{new URLSearchParams(n.hash.substring(1)).forEach((e,n)=>{t[n]=e})}catch(e){}return n.searchParams.forEach((e,n)=>{t[n]=e}),t},Object.defineProperty(_e2,"resolveFetch",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e2,"looksLikeFetchResponse",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e2,"setItemAsync",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e2,"getItemAsync",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e2,"removeItemAsync",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e2,"Deferred",{enumerable:!0,get:function(){return p}}),_e2.decodeJWT=function(o){const s=o.split('.');if(3!==s.length)throw new t.AuthInvalidJwtError('Invalid JWT structure');for(let n=0;n{setTimeout(()=>t(null),e)})},_e2.retryable=function(e,t){return new Promise((n,o)=>{(async()=>{for(let s=0;s<1/0;s++)try{const o=await e(s);if(!t(s,null,o))return void n(o)}catch(e){if(!t(s,e))return void o(e)}})()})},_e2.generatePKCEVerifier=b,_e2.generatePKCEChallenge=S,_e2.getCodeChallengeAndMethod=async function(e,t,n=!1){const o=b();let s=o;n&&(s+='/recovery');await l(e,`${t}-code-verifier`,s);const i=await S(o);return[i,o===i?'plain':'s256']},_e2.parseResponseAPIVersion=function(t){const n=t.headers.get(e.API_VERSION_HEADER_NAME);if(!n)return null;if(!n.match(P))return null;try{return new Date(`${n}T00:00:00.0Z`)}catch(e){return null}},_e2.validateExp=function(e){if(!e)throw new Error('Missing exp claim');const t=Math.floor(Date.now()/1e3);if(e<=t)throw new Error('JWT has expired')},_e2.getAlgorithm=function(e){switch(e){case'RS256':return{name:'RSASSA-PKCS1-v1_5',hash:{name:'SHA-256'}};case'ES256':return{name:'ECDSA',namedCurve:'P-256',hash:{name:'SHA-256'}};default:throw new Error('Invalid alg claim')}},_e2.validateUUID=function(e){if(!A.test(e))throw new Error('@supabase/auth-js: Expected parameter to be UUID but is not')},_e2.assertPasskeyExperimentalEnabled=function(e){if(!e.passkey)throw new Error('@supabase/auth-js: the passkey API is experimental and disabled by default. Enable it by passing `auth: { experimental: { passkey: true } }` to createClient (or to the GoTrueClient constructor).')},_e2.userNotAvailableProxy=function(){return new Proxy({},{get:(e,t)=>{if('__isUserNotAvailableProxy'===t)return!0;if('symbol'==typeof t){const e=t.toString();if('Symbol(Symbol.toPrimitive)'===e||'Symbol(Symbol.toStringTag)'===e||'Symbol(util.inspect.custom)'===e)return}throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${t}" property of the session object is not supported. Please use getUser() instead.`)},set:(e,t)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${t}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(e,t)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${t}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})},_e2.insecureUserWarningProxy=function(e,t){return new Proxy(e,{get:(e,n,o)=>{if('__isInsecureUserWarningProxy'===n)return!0;if('symbol'==typeof n){const t=n.toString();if('Symbol(Symbol.toPrimitive)'===t||'Symbol(Symbol.toStringTag)'===t||'Symbol(util.inspect.custom)'===t||'Symbol(nodejs.util.inspect.custom)'===t)return Reflect.get(e,n,o)}return t.value||'string'!=typeof n||(console.warn('Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server.'),t.value=!0),Reflect.get(e,n,o)}})},_e2.deepClone=function(e){return JSON.parse(JSON.stringify(e))};var e=r(d[0]),t=r(d[1]),n=r(d[2]);const o=()=>'undefined'!=typeof window&&'undefined'!=typeof document,s={tested:!1,writable:!1},i=()=>{if(!o())return!1;try{if('object'!=typeof globalThis.localStorage)return!1}catch(e){return!1}if(s.tested)return s.writable;const e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),s.tested=!0,s.writable=!0}catch(e){s.tested=!0,s.writable=!1}return s.writable};const u=e=>e?(...t)=>e(...t):(...e)=>fetch(...e),c=e=>'object'==typeof e&&null!==e&&'status'in e&&'ok'in e&&'json'in e&&'function'==typeof e.json,l=async(e,t,n)=>{await e.setItem(t,JSON.stringify(n))},f=async(e,t)=>{const n=await e.getItem(t);if(!n)return null;try{return JSON.parse(n)}catch(e){return null}},h=async(e,t)=>{await e.removeItem(t)};class p{constructor(){this.promise=new p.promiseConstructor((e,t)=>{this.resolve=e,this.reject=t})}}function y(e){return('0'+e.toString(16)).substr(-2)}function b(){const e=new Uint32Array(56);if('undefined'==typeof crypto){const e='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~',t=e.length;let n='';for(let o=0;o<56;o++)n+=e.charAt(Math.floor(Math.random()*t));return n}return crypto.getRandomValues(e),Array.from(e,y).join('')}async function w(e){const t=(new TextEncoder).encode(e),n=await crypto.subtle.digest('SHA-256',t),o=new Uint8Array(n);return Array.from(o).map(e=>String.fromCharCode(e)).join('')}async function S(e){if(!('undefined'!=typeof crypto&&void 0!==crypto.subtle&&'undefined'!=typeof TextEncoder))return console.warn('WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256.'),e;const t=await w(e);return btoa(t).replace(/\+/g,'-').replace(/\//g,'_').replace(/=+$/,'')}p.promiseConstructor=Promise;const P=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;const A=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/},1183,[1181,1184,1185]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"AuthError",{enumerable:!0,get:function(){return t}}),e.isAuthError=s,Object.defineProperty(e,"AuthApiError",{enumerable:!0,get:function(){return n}}),e.isAuthApiError=function(t){return s(t)&&'AuthApiError'===t.name},Object.defineProperty(e,"AuthUnknownError",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"CustomAuthError",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"AuthSessionMissingError",{enumerable:!0,get:function(){return c}}),e.isAuthSessionMissingError=function(t){return s(t)&&'AuthSessionMissingError'===t.name},Object.defineProperty(e,"AuthInvalidTokenResponseError",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"AuthInvalidCredentialsError",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"AuthImplicitGrantRedirectError",{enumerable:!0,get:function(){return f}}),e.isAuthImplicitGrantRedirectError=function(t){return s(t)&&'AuthImplicitGrantRedirectError'===t.name},Object.defineProperty(e,"AuthPKCEGrantCodeExchangeError",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"AuthPKCECodeVerifierMissingError",{enumerable:!0,get:function(){return A}}),e.isAuthPKCECodeVerifierMissingError=function(t){return s(t)&&'AuthPKCECodeVerifierMissingError'===t.name},Object.defineProperty(e,"AuthRetryableFetchError",{enumerable:!0,get:function(){return p}}),e.isAuthRetryableFetchError=function(t){return s(t)&&'AuthRetryableFetchError'===t.name},Object.defineProperty(e,"AuthRefreshDiscardedError",{enumerable:!0,get:function(){return b}}),e.isAuthRefreshDiscardedError=function(t){return s(t)&&'AuthRefreshDiscardedError'===t.name},Object.defineProperty(e,"AuthWeakPasswordError",{enumerable:!0,get:function(){return O}}),e.isAuthWeakPasswordError=function(t){return s(t)&&'AuthWeakPasswordError'===t.name},Object.defineProperty(e,"AuthInvalidJwtError",{enumerable:!0,get:function(){return P}});class t extends Error{constructor(t,s,n){super(t),this.__isAuthError=!0,this.name='AuthError',this.status=s,this.code=n}toJSON(){return{name:this.name,message:this.message,status:this.status,code:this.code}}}function s(t){return'object'==typeof t&&null!==t&&'__isAuthError'in t}class n extends t{constructor(t,s,n){super(t,s,n),this.name='AuthApiError',this.status=s,this.code=n}}class o extends t{constructor(t,s){super(t),this.name='AuthUnknownError',this.originalError=s}}class u extends t{constructor(t,s,n,o){super(t,n,o),this.name=s,this.status=n}}class c extends u{constructor(){super('Auth session missing!','AuthSessionMissingError',400,void 0)}}class h extends u{constructor(){super('Auth session or user missing','AuthInvalidTokenResponseError',500,void 0)}}class l extends u{constructor(t){super(t,'AuthInvalidCredentialsError',400,void 0)}}class f extends u{constructor(t,s=null){super(t,'AuthImplicitGrantRedirectError',500,void 0),this.details=null,this.details=s}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}class E extends u{constructor(t,s=null){super(t,'AuthPKCEGrantCodeExchangeError',500,void 0),this.details=null,this.details=s}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}class A extends u{constructor(){super("PKCE code verifier not found in storage. This can happen if the auth flow was initiated in a different browser or device, or if the storage was cleared. For SSR frameworks (Next.js, SvelteKit, etc.), use @supabase/ssr on both the server and client to store the code verifier in cookies.",'AuthPKCECodeVerifierMissingError',400,'pkce_code_verifier_not_found')}}class p extends u{constructor(t,s){super(t,'AuthRetryableFetchError',s,void 0)}}class b extends u{constructor(t="Refresh result discarded: session state changed mid-flight (e.g., concurrent signOut)"){super(t,'AuthRefreshDiscardedError',409,void 0)}}class O extends u{constructor(t,s,n){super(t,'AuthWeakPasswordError',s,'weak_password'),this.reasons=n}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{reasons:this.reasons})}}class P extends u{constructor(t){super(t,'AuthInvalidJwtError',400,'invalid_jwt')}}},1184,[]); +__d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.byteToBase64URL=o,e.byteFromBase64URL=i,e.stringToBase64URL=function(t){const u=[],n=t=>{u.push(t)},i={queue:0,queuedBits:0};return f(t,t=>{o(t,i,n)}),o(null,i,n),u.join('')},e.stringFromBase64URL=function(t){const u=[],n=t=>{u.push(String.fromCodePoint(t))},o={utf8seq:0,codepoint:0},s={queue:0,queuedBits:0},f=t=>{c(t,o,n)};for(let u=0;u{u.push(t)};for(let u=0;uu.push(t)),new Uint8Array(u)},e.bytesToBase64URL=function(t){const u=[],n={queue:0,queuedBits:0},i=t=>{u.push(t)};return t.forEach(t=>o(t,n,i)),o(null,n,i),u.join('')};const t='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_'.split(''),u=' \t\n\r='.split(''),n=(()=>{const n=new Array(128);for(let t=0;t=6;){const u=n.queue>>n.queuedBits-6&63;o(t[u]),n.queuedBits-=6}else if(n.queuedBits>0)for(n.queue=n.queue<<6-n.queuedBits,n.queuedBits=6;n.queuedBits>=6;){const u=n.queue>>n.queuedBits-6&63;o(t[u]),n.queuedBits-=6}}function i(t,u,o){const i=n[t];if(!(i>-1)){if(-2===i)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(t)}"`)}for(u.queue=u.queue<<6|i,u.queuedBits+=6;u.queuedBits>=8;)o(u.queue>>u.queuedBits-8&255),u.queuedBits-=8}function s(t,u){if(!(t<=127)){if(t<=2047)return u(192|t>>6),void u(128|63&t);if(t<=65535)return u(224|t>>12),u(128|t>>6&63),void u(128|63&t);if(t<=1114111)return u(240|t>>18),u(128|t>>12&63),u(128|t>>6&63),void u(128|63&t);throw new Error(`Unrecognized Unicode codepoint: ${t.toString(16)}`)}u(t)}function f(t,u){for(let n=0;n55295&&o<=56319){const u=1024*(o-55296)&65535;o=65536+(t.charCodeAt(n+1)-56320&65535|u),n+=1}s(o,u)}}function c(t,u,n){if(0===u.utf8seq){if(t<=127)return void n(t);for(let n=1;n<6;n+=1)if(!(t>>7-n&1)){u.utf8seq=n;break}if(2===u.utf8seq)u.codepoint=31&t;else if(3===u.utf8seq)u.codepoint=15&t;else{if(4!==u.utf8seq)throw new Error('Invalid UTF-8 sequence');u.codepoint=7&t}u.utf8seq-=1}else if(u.utf8seq>0){if(t<=127)throw new Error('Invalid UTF-8 sequence');u.codepoint=u.codepoint<<6|63&t,u.utf8seq-=1,0===u.utf8seq&&n(u.codepoint)}}},1185,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SIGN_OUT_SCOPES",{enumerable:!0,get:function(){return t}});const t=['global','local','others']},1186,[]); +__d(function(e,t,s,r,i,n,a){"use strict";Object.defineProperty(n,'__esModule',{value:!0}),Object.defineProperty(n,"default",{enumerable:!0,get:function(){return A}});var o,l=t(a[0]),u=(o=l)&&o.__esModule?o:{default:o},h=t(a[1]),c=t(a[2]),d=t(a[3]),_=t(a[4]),g=t(a[5]),w=t(a[6]),y=t(a[7]),f=t(a[8]),p=t(a[9]),v=t(a[10]),b=t(a[11]);(0,y.polyfillGlobalThis)();const k={url:h.GOTRUE_URL,storageKey:h.STORAGE_KEY,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:h.DEFAULT_HEADERS,flowType:'implicit',debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:5e3,skipAutoInitialize:!1,experimental:{}},m={};class R{get jwks(){var e,t;return null!==(t=null===(e=m[this.storageKey])||void 0===e?void 0:e.jwks)&&void 0!==t?t:{keys:[]}}set jwks(e){m[this.storageKey]=Object.assign(Object.assign({},m[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,t;return null!==(t=null===(e=m[this.storageKey])||void 0===e?void 0:e.cachedAt)&&void 0!==t?t:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){m[this.storageKey]=Object.assign(Object.assign({},m[this.storageKey]),{cachedAt:e})}constructor(e){var t,s,r;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.autoRefreshTickTimeout=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.lastRefreshFailure=null,this._sessionRemovalEpoch=0,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lock=null,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log;const i=Object.assign(Object.assign({},k),e);if(this.storageKey=i.storageKey,this.instanceID=null!==(t=R.nextInstanceID[this.storageKey])&&void 0!==t?t:0,R.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!i.debug,'function'==typeof i.debug&&(this.logger=i.debug),this.instanceID>0&&(0,_.isBrowser)()){const e=`${this._logPrefix()} Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.`;console.warn(e),this.logDebugMessages&&console.trace(e)}if(this.persistSession=i.persistSession,this.autoRefreshToken=i.autoRefreshToken,this.experimental=null!==(s=i.experimental)&&void 0!==s?s:{},this.admin=new u.default({url:i.url,headers:i.headers,fetch:i.fetch,experimental:this.experimental}),this.url=i.url,this.headers=i.headers,this.fetch=(0,_.resolveFetch)(i.fetch),this.detectSessionInUrl=i.detectSessionInUrl,this.flowType=i.flowType,this.hasCustomAuthorizationHeader=i.hasCustomAuthorizationHeader,this.throwOnError=i.throwOnError,this.lockAcquireTimeout=i.lockAcquireTimeout,null!=i.lock&&(this.lock=i.lock),this.jwks||(this.jwks={keys:[]},this.jwks_cached_at=Number.MIN_SAFE_INTEGER),this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this),webauthn:new b.WebAuthnApi(this)},this.oauth={getAuthorizationDetails:this._getAuthorizationDetails.bind(this),approveAuthorization:this._approveAuthorization.bind(this),denyAuthorization:this._denyAuthorization.bind(this),listGrants:this._listOAuthGrants.bind(this),revokeGrant:this._revokeOAuthGrant.bind(this)},this.passkey={startRegistration:this._startPasskeyRegistration.bind(this),verifyRegistration:this._verifyPasskeyRegistration.bind(this),startAuthentication:this._startPasskeyAuthentication.bind(this),verifyAuthentication:this._verifyPasskeyAuthentication.bind(this),list:this._listPasskeys.bind(this),update:this._updatePasskey.bind(this),delete:this._deletePasskey.bind(this)},this.persistSession?(i.storage?this.storage=i.storage:(0,_.supportsLocalStorage)()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=(0,g.memoryLocalStorageAdapter)(this.memoryStorage)),i.userStorage&&(this.userStorage=i.userStorage)):(this.memoryStorage={},this.storage=(0,g.memoryLocalStorageAdapter)(this.memoryStorage)),(0,_.isBrowser)()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(e){console.error('Failed to create a new BroadcastChannel, multi-tab state changes will not be available',e)}null===(r=this.broadcastChannel)||void 0===r||r.addEventListener('message',async e=>{this._debug('received broadcast notification from other tab or client',e),'TOKEN_REFRESHED'!==e.data.event&&'SIGNED_IN'!==e.data.event||(this.lastRefreshFailure=null);try{await this._notifyAllSubscribers(e.data.event,e.data.session,!1)}catch(e){this._debug('#broadcastChannel','error',e)}})}i.skipAutoInitialize||this.initialize().catch(e=>{this._debug('#initialize()','error',e)})}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(e){if(this.throwOnError&&e&&e.error)throw e.error;return e}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${f.version}) ${(new Date).toISOString()}`}_debug(...e){return this.logDebugMessages&&this.logger(this._logPrefix(),...e),this}async initialize(){return this.initializePromise||(this.initializePromise=(async()=>null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._initialize()):await this._initialize())()),await this.initializePromise}async _initialize(){var e;try{let t={},s='none';if((0,_.isBrowser)()&&(t=(0,_.parseParametersFromURL)(window.location.href),this._isImplicitGrantCallback(t)?s='implicit':await this._isPKCECallback(t)&&(s='pkce')),(0,_.isBrowser)()&&this.detectSessionInUrl&&'none'!==s){const{data:r,error:i}=await this._getSessionFromURL(t,s);if(i){if(this._debug('#_initialize()','error detecting session from URL',i),(0,c.isAuthImplicitGrantRedirectError)(i)){const t=null===(e=i.details)||void 0===e?void 0:e.code;if('identity_already_exists'===t||'identity_not_found'===t||'single_identity_not_deletable'===t)return{error:i}}return{error:i}}const{session:n,redirectType:a}=r;return this._debug('#_initialize()','detected session in URL',n,'redirect type',a),await this._saveSession(n),setTimeout(async()=>{'recovery'===a?await this._notifyAllSubscribers('PASSWORD_RECOVERY',n):await this._notifyAllSubscribers('SIGNED_IN',n)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(e){return(0,c.isAuthError)(e)?this._returnResult({error:e}):this._returnResult({error:new c.AuthUnknownError('Unexpected error during initialization',e)})}finally{await this._handleVisibilityChange(),this._debug('#_initialize()','end')}}async signInAnonymously(e){var t,s,r;try{const i=await(0,d._request)(this.fetch,'POST',`${this.url}/signup`,{headers:this.headers,body:{data:null!==(s=null===(t=null==e?void 0:e.options)||void 0===t?void 0:t.data)&&void 0!==s?s:{},gotrue_meta_security:{captcha_token:null===(r=null==e?void 0:e.options)||void 0===r?void 0:r.captchaToken}},xform:d._sessionResponse}),{data:n,error:a}=i;if(a||!n)return this._returnResult({data:{user:null,session:null},error:a});const o=n.session,l=n.user;return n.session&&(await this._saveSession(n.session),await this._notifyAllSubscribers('SIGNED_IN',o)),this._returnResult({data:{user:l,session:o},error:null})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signUp(e){var t,s,r;try{let i;if('email'in e){const{email:s,password:r,options:n}=e;let a=null,o=null;'pkce'===this.flowType&&([a,o]=await(0,_.getCodeChallengeAndMethod)(this.storage,this.storageKey)),i=await(0,d._request)(this.fetch,'POST',`${this.url}/signup`,{headers:this.headers,redirectTo:null==n?void 0:n.emailRedirectTo,body:{email:s,password:r,data:null!==(t=null==n?void 0:n.data)&&void 0!==t?t:{},gotrue_meta_security:{captcha_token:null==n?void 0:n.captchaToken},code_challenge:a,code_challenge_method:o},xform:d._sessionResponse})}else{if(!('phone'in e))throw new c.AuthInvalidCredentialsError('You must provide either an email or phone number and a password');{const{phone:t,password:n,options:a}=e;i=await(0,d._request)(this.fetch,'POST',`${this.url}/signup`,{headers:this.headers,body:{phone:t,password:n,data:null!==(s=null==a?void 0:a.data)&&void 0!==s?s:{},channel:null!==(r=null==a?void 0:a.channel)&&void 0!==r?r:'sms',gotrue_meta_security:{captcha_token:null==a?void 0:a.captchaToken}},xform:d._sessionResponse})}}const{data:n,error:a}=i;if(a||!n)return await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:a});const o=n.session,l=n.user;return n.session&&(await this._saveSession(n.session),await this._notifyAllSubscribers('SIGNED_IN',o)),this._returnResult({data:{user:l,session:o},error:null})}catch(e){if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),(0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signInWithPassword(e){try{let t;if('email'in e){const{email:s,password:r,options:i}=e;t=await(0,d._request)(this.fetch,'POST',`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:s,password:r,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken}},xform:d._sessionResponsePassword})}else{if(!('phone'in e))throw new c.AuthInvalidCredentialsError('You must provide either an email or phone number and a password');{const{phone:s,password:r,options:i}=e;t=await(0,d._request)(this.fetch,'POST',`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:s,password:r,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken}},xform:d._sessionResponsePassword})}}const{data:s,error:r}=t;if(r)return this._returnResult({data:{user:null,session:null},error:r});if(!s||!s.session||!s.user){const e=new c.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null},error:e})}return s.session&&(await this._saveSession(s.session),await this._notifyAllSubscribers('SIGNED_IN',s.session)),this._returnResult({data:Object.assign({user:s.user,session:s.session},s.weak_password?{weakPassword:s.weak_password}:null),error:r})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signInWithOAuth(e){var t,s,r,i;return await this._handleProviderSignIn(e.provider,{redirectTo:null===(t=e.options)||void 0===t?void 0:t.redirectTo,scopes:null===(s=e.options)||void 0===s?void 0:s.scopes,queryParams:null===(r=e.options)||void 0===r?void 0:r.queryParams,skipBrowserRedirect:null===(i=e.options)||void 0===i?void 0:i.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,null!=this.lock?this._acquireLock(this.lockAcquireTimeout,async()=>this._exchangeCodeForSession(e)):this._exchangeCodeForSession(e)}async signInWithWeb3(e){const{chain:t}=e;switch(t){case'ethereum':return await this.signInWithEthereum(e);case'solana':return await this.signInWithSolana(e);default:throw new Error(`@supabase/auth-js: Unsupported chain "${t}"`)}}async signInWithEthereum(e){var t,s,r,i,n,a,o,l,u,h,g;let w,y;if('message'in e)w=e.message,y=e.signature;else{const{chain:h,wallet:c,statement:d,options:g}=e;let f;if((0,_.isBrowser)())if('object'==typeof c)f=c;else{const e=window;if(!('ethereum'in e)||'object'!=typeof e.ethereum||!('request'in e.ethereum)||'function'!=typeof e.ethereum.request)throw new Error("@supabase/auth-js: No compatible Ethereum wallet interface on the window object (window.ethereum) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'ethereum', wallet: resolvedUserWallet }) instead.");f=e.ethereum}else{if('object'!=typeof c||!(null==g?void 0:g.url))throw new Error('@supabase/auth-js: Both wallet and url must be specified in non-browser environments.');f=c}const p=new URL(null!==(t=null==g?void 0:g.url)&&void 0!==t?t:window.location.href),b=await f.request({method:'eth_requestAccounts'}).then(e=>e).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!b||0===b.length)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const k=(0,v.getAddress)(b[0]);let m=null===(s=null==g?void 0:g.signInWithEthereum)||void 0===s?void 0:s.chainId;if(!m){const e=await f.request({method:'eth_chainId'});m=(0,v.fromHex)(e)}const R={domain:p.host,address:k,statement:d,uri:p.href,version:'1',chainId:m,nonce:null===(r=null==g?void 0:g.signInWithEthereum)||void 0===r?void 0:r.nonce,issuedAt:null!==(n=null===(i=null==g?void 0:g.signInWithEthereum)||void 0===i?void 0:i.issuedAt)&&void 0!==n?n:new Date,expirationTime:null===(a=null==g?void 0:g.signInWithEthereum)||void 0===a?void 0:a.expirationTime,notBefore:null===(o=null==g?void 0:g.signInWithEthereum)||void 0===o?void 0:o.notBefore,requestId:null===(l=null==g?void 0:g.signInWithEthereum)||void 0===l?void 0:l.requestId,resources:null===(u=null==g?void 0:g.signInWithEthereum)||void 0===u?void 0:u.resources};w=(0,v.createSiweMessage)(R),y=await f.request({method:'personal_sign',params:[(0,v.toHex)(w),k]})}try{const{data:t,error:s}=await(0,d._request)(this.fetch,'POST',`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:'ethereum',message:w,signature:y},(null===(h=e.options)||void 0===h?void 0:h.captchaToken)?{gotrue_meta_security:{captcha_token:null===(g=e.options)||void 0===g?void 0:g.captchaToken}}:null),xform:d._sessionResponse});if(s)throw s;if(!t||!t.session||!t.user){const e=new c.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null},error:e})}return t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers('SIGNED_IN',t.session)),this._returnResult({data:Object.assign({},t),error:s})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signInWithSolana(e){var t,s,r,i,n,a,o,l,u,h,g,w;let y,f;if('message'in e)y=e.message,f=e.signature;else{const{chain:c,wallet:d,statement:g,options:w}=e;let p;if((0,_.isBrowser)())if('object'==typeof d)p=d;else{const e=window;if(!('solana'in e)||'object'!=typeof e.solana||!('signIn'in e.solana&&'function'==typeof e.solana.signIn||'signMessage'in e.solana&&'function'==typeof e.solana.signMessage))throw new Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.");p=e.solana}else{if('object'!=typeof d||!(null==w?void 0:w.url))throw new Error('@supabase/auth-js: Both wallet and url must be specified in non-browser environments.');p=d}const v=new URL(null!==(t=null==w?void 0:w.url)&&void 0!==t?t:window.location.href);if('signIn'in p&&p.signIn){const e=await p.signIn(Object.assign(Object.assign(Object.assign({issuedAt:(new Date).toISOString()},null==w?void 0:w.signInWithSolana),{version:'1',domain:v.host,uri:v.href}),g?{statement:g}:null));let t;if(Array.isArray(e)&&e[0]&&'object'==typeof e[0])t=e[0];else{if(!(e&&'object'==typeof e&&'signedMessage'in e&&'signature'in e))throw new Error('@supabase/auth-js: Wallet method signIn() returned unrecognized value');t=e}if(!('signedMessage'in t&&'signature'in t&&('string'==typeof t.signedMessage||t.signedMessage instanceof Uint8Array)&&t.signature instanceof Uint8Array))throw new Error('@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields');y='string'==typeof t.signedMessage?t.signedMessage:(new TextDecoder).decode(t.signedMessage),f=t.signature}else{if(!('signMessage'in p&&'function'==typeof p.signMessage&&'publicKey'in p&&'object'==typeof p&&p.publicKey&&'toBase58'in p.publicKey&&'function'==typeof p.publicKey.toBase58))throw new Error('@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API');y=[`${v.host} wants you to sign in with your Solana account:`,p.publicKey.toBase58(),...g?['',g,'']:[''],'Version: 1',`URI: ${v.href}`,`Issued At: ${null!==(r=null===(s=null==w?void 0:w.signInWithSolana)||void 0===s?void 0:s.issuedAt)&&void 0!==r?r:(new Date).toISOString()}`,...(null===(i=null==w?void 0:w.signInWithSolana)||void 0===i?void 0:i.notBefore)?[`Not Before: ${w.signInWithSolana.notBefore}`]:[],...(null===(n=null==w?void 0:w.signInWithSolana)||void 0===n?void 0:n.expirationTime)?[`Expiration Time: ${w.signInWithSolana.expirationTime}`]:[],...(null===(a=null==w?void 0:w.signInWithSolana)||void 0===a?void 0:a.chainId)?[`Chain ID: ${w.signInWithSolana.chainId}`]:[],...(null===(o=null==w?void 0:w.signInWithSolana)||void 0===o?void 0:o.nonce)?[`Nonce: ${w.signInWithSolana.nonce}`]:[],...(null===(l=null==w?void 0:w.signInWithSolana)||void 0===l?void 0:l.requestId)?[`Request ID: ${w.signInWithSolana.requestId}`]:[],...(null===(h=null===(u=null==w?void 0:w.signInWithSolana)||void 0===u?void 0:u.resources)||void 0===h?void 0:h.length)?['Resources',...w.signInWithSolana.resources.map(e=>`- ${e}`)]:[]].join('\n');const e=await p.signMessage((new TextEncoder).encode(y),'utf8');if(!(e&&e instanceof Uint8Array))throw new Error('@supabase/auth-js: Wallet signMessage() API returned an recognized value');f=e}}try{const{data:t,error:s}=await(0,d._request)(this.fetch,'POST',`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:'solana',message:y,signature:(0,p.bytesToBase64URL)(f)},(null===(g=e.options)||void 0===g?void 0:g.captchaToken)?{gotrue_meta_security:{captcha_token:null===(w=e.options)||void 0===w?void 0:w.captchaToken}}:null),xform:d._sessionResponse});if(s)throw s;if(!t||!t.session||!t.user){const e=new c.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null},error:e})}return t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers('SIGNED_IN',t.session)),this._returnResult({data:Object.assign({},t),error:s})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async _exchangeCodeForSession(e){const t=await(0,_.getItemAsync)(this.storage,`${this.storageKey}-code-verifier`),[s,r]=(null!=t?t:'').split('/');try{if(!s&&'pkce'===this.flowType)throw new c.AuthPKCECodeVerifierMissingError;const{data:t,error:i}=await(0,d._request)(this.fetch,'POST',`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:s},xform:d._sessionResponse});if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),i)throw i;if(!t||!t.session||!t.user){const e=new c.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null,redirectType:null},error:e})}return t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers('recovery'===r?'PASSWORD_RECOVERY':'SIGNED_IN',t.session)),this._returnResult({data:Object.assign(Object.assign({},t),{redirectType:null!=r?r:null}),error:i})}catch(e){if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),(0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null,redirectType:null},error:e});throw e}}async signInWithIdToken(e){try{const{options:t,provider:s,token:r,access_token:i,nonce:n}=e,a=await(0,d._request)(this.fetch,'POST',`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:s,id_token:r,access_token:i,nonce:n,gotrue_meta_security:{captcha_token:null==t?void 0:t.captchaToken}},xform:d._sessionResponse}),{data:o,error:l}=a;if(l)return this._returnResult({data:{user:null,session:null},error:l});if(!o||!o.session||!o.user){const e=new c.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null},error:e})}return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers('SIGNED_IN',o.session)),this._returnResult({data:o,error:l})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signInWithOtp(e){var t,s,r,i,n;try{if('email'in e){const{email:r,options:i}=e;let n=null,a=null;'pkce'===this.flowType&&([n,a]=await(0,_.getCodeChallengeAndMethod)(this.storage,this.storageKey));const{error:o}=await(0,d._request)(this.fetch,'POST',`${this.url}/otp`,{headers:this.headers,body:{email:r,data:null!==(t=null==i?void 0:i.data)&&void 0!==t?t:{},create_user:null===(s=null==i?void 0:i.shouldCreateUser)||void 0===s||s,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken},code_challenge:n,code_challenge_method:a},redirectTo:null==i?void 0:i.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:o})}if('phone'in e){const{phone:t,options:s}=e,{data:a,error:o}=await(0,d._request)(this.fetch,'POST',`${this.url}/otp`,{headers:this.headers,body:{phone:t,data:null!==(r=null==s?void 0:s.data)&&void 0!==r?r:{},create_user:null===(i=null==s?void 0:s.shouldCreateUser)||void 0===i||i,gotrue_meta_security:{captcha_token:null==s?void 0:s.captchaToken},channel:null!==(n=null==s?void 0:s.channel)&&void 0!==n?n:'sms'}});return this._returnResult({data:{user:null,session:null,messageId:null==a?void 0:a.message_id},error:o})}throw new c.AuthInvalidCredentialsError('You must provide either an email or phone number.')}catch(e){if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),(0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async verifyOtp(e){var t,s;try{let r,i;'options'in e&&(r=null===(t=e.options)||void 0===t?void 0:t.redirectTo,i=null===(s=e.options)||void 0===s?void 0:s.captchaToken);const{data:n,error:a}=await(0,d._request)(this.fetch,'POST',`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:i}}),redirectTo:r,xform:d._sessionResponse});if(a)throw a;if(!n){throw new Error('An error occurred on token verification.')}const o=n.session,l=n.user;return(null==o?void 0:o.access_token)&&(await this._saveSession(o),await this._notifyAllSubscribers('recovery'==e.type?'PASSWORD_RECOVERY':'SIGNED_IN',o)),this._returnResult({data:{user:l,session:o},error:null})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signInWithSSO(e){var t,s,r,i,n;try{let a=null,o=null;'pkce'===this.flowType&&([a,o]=await(0,_.getCodeChallengeAndMethod)(this.storage,this.storageKey));const l=await(0,d._request)(this.fetch,'POST',`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},'providerId'in e?{provider_id:e.providerId}:null),'domain'in e?{domain:e.domain}:null),{redirect_to:null!==(s=null===(t=e.options)||void 0===t?void 0:t.redirectTo)&&void 0!==s?s:void 0}),(null===(r=null==e?void 0:e.options)||void 0===r?void 0:r.captchaToken)?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:a,code_challenge_method:o}),headers:this.headers,xform:d._ssoResponse});return(null===(i=l.data)||void 0===i?void 0:i.url)&&(0,_.isBrowser)()&&!(null===(n=e.options)||void 0===n?void 0:n.skipBrowserRedirect)&&window.location.assign(l.data.url),this._returnResult(l)}catch(e){if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),(0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async reauthenticate(){return await this.initializePromise,null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._reauthenticate()):await this._reauthenticate()}async _reauthenticate(){try{return await this._useSession(async e=>{const{data:{session:t},error:s}=e;if(s)throw s;if(!t)throw new c.AuthSessionMissingError;const{error:r}=await(0,d._request)(this.fetch,'GET',`${this.url}/reauthenticate`,{headers:this.headers,jwt:t.access_token});return this._returnResult({data:{user:null,session:null},error:r})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async resend(e){try{const t=`${this.url}/resend`;if('email'in e){const{email:s,type:r,options:i}=e;let n=null,a=null;'pkce'===this.flowType&&([n,a]=await(0,_.getCodeChallengeAndMethod)(this.storage,this.storageKey));const{error:o}=await(0,d._request)(this.fetch,'POST',t,{headers:this.headers,body:{email:s,type:r,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken},code_challenge:n,code_challenge_method:a},redirectTo:null==i?void 0:i.emailRedirectTo});return o&&await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:o})}if('phone'in e){const{phone:s,type:r,options:i}=e,{data:n,error:a}=await(0,d._request)(this.fetch,'POST',t,{headers:this.headers,body:{phone:s,type:r,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:null==n?void 0:n.message_id},error:a})}throw new c.AuthInvalidCredentialsError('You must provide either an email or phone number and a type')}catch(e){if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),(0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async getSession(){return await this.initializePromise,null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>this._useSession(async e=>e)):await this._useSession(async e=>e)}async _acquireLock(e,t){this._debug('#_acquireLock','begin',e);try{if(this.lockAcquired){const e=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),s=(async()=>(await e,await t()))();return this.pendingInLock.push((async()=>{try{await s}catch(e){}})()),s}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug('#_acquireLock','lock acquired for storage key',this.storageKey);try{this.lockAcquired=!0;const e=t();for(this.pendingInLock.push((async()=>{try{await e}catch(e){}})()),await e;this.pendingInLock.length;){const e=[...this.pendingInLock];await Promise.all(e),this.pendingInLock.splice(0,e.length)}return await e}finally{this._debug('#_acquireLock','lock released for storage key',this.storageKey),this.lockAcquired=!1}})}finally{this._debug('#_acquireLock','end')}}async _useSession(e){this._debug('#_useSession','begin');try{const t=await this.__loadSession();return await e(t)}finally{this._debug('#_useSession','end')}}async __loadSession(){this._debug('#__loadSession()','begin'),null==this.lock||this.lockAcquired||this._debug('#__loadSession()','used outside of an acquired lock!',(new Error).stack);try{let e=null;const t=await(0,_.getItemAsync)(this.storage,this.storageKey);if(this._debug('#getSession()','session from storage',t),null!==t&&(this._isValidSession(t)?e=t:(this._debug('#getSession()','session from storage is not valid'),await this._removeSession())),!e)return{data:{session:null},error:null};const s=!!e.expires_at&&1e3*e.expires_at-Date.now()Date.now())){const t=await(0,_.getItemAsync)(this.storage,this.storageKey);if(t&&t.refresh_token===e.refresh_token)return this._returnResult({data:{session:e},error:null})}return this._returnResult({data:{session:null},error:i})}return this._returnResult({data:{session:r},error:null})}finally{this._debug('#__loadSession()','end')}}async getUser(e){if(e)return await this._getUser(e);let t;return await this.initializePromise,t=null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser()):await this._getUser(),t.data.user&&(this.suppressGetSessionWarning=!0),t}async _getUser(e){try{return e?await(0,d._request)(this.fetch,'GET',`${this.url}/user`,{headers:this.headers,jwt:e,xform:d._userResponse}):await this._useSession(async e=>{var t,s,r;const{data:i,error:n}=e;if(n)throw n;return(null===(t=i.session)||void 0===t?void 0:t.access_token)||this.hasCustomAuthorizationHeader?await(0,d._request)(this.fetch,'GET',`${this.url}/user`,{headers:this.headers,jwt:null!==(r=null===(s=i.session)||void 0===s?void 0:s.access_token)&&void 0!==r?r:void 0,xform:d._userResponse}):{data:{user:null},error:new c.AuthSessionMissingError}})}catch(e){if((0,c.isAuthError)(e))return(0,c.isAuthSessionMissingError)(e)&&(await this._removeSession(),await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:e});throw e}}async updateUser(e,t={}){return await this.initializePromise,null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(e,t)):await this._updateUser(e,t)}async _updateUser(e,t={}){try{return await this._useSession(async s=>{const{data:r,error:i}=s;if(i)throw i;if(!r.session)throw new c.AuthSessionMissingError;const n=r.session;let a=null,o=null;'pkce'===this.flowType&&null!=e.email&&([a,o]=await(0,_.getCodeChallengeAndMethod)(this.storage,this.storageKey));const{data:l,error:u}=await(0,d._request)(this.fetch,'PUT',`${this.url}/user`,{headers:this.headers,redirectTo:null==t?void 0:t.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:a,code_challenge_method:o}),jwt:n.access_token,xform:d._userResponse});if(u)throw u;return n.user=l.user,await this._saveSession(n),await this._notifyAllSubscribers('USER_UPDATED',n),this._returnResult({data:{user:n.user},error:null})})}catch(e){if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),(0,c.isAuthError)(e))return this._returnResult({data:{user:null},error:e});throw e}}async setSession(e){return await this.initializePromise,null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._setSession(e)):await this._setSession(e)}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new c.AuthSessionMissingError;const t=Date.now()/1e3;let s=t,r=!0,i=null;const{payload:n}=(0,_.decodeJWT)(e.access_token);if(n.exp&&(s=n.exp,r=s<=t),r){const{data:t,error:s}=await this._callRefreshToken(e.refresh_token);if(s)return this._returnResult({data:{user:null,session:null},error:s});if(!t)return{data:{user:null,session:null},error:null};i=t}else{const{data:r,error:n}=await this._getUser(e.access_token);if(n)return this._returnResult({data:{user:null,session:null},error:n});i={access_token:e.access_token,refresh_token:e.refresh_token,user:r.user,token_type:'bearer',expires_in:s-t,expires_at:s},await this._saveSession(i),await this._notifyAllSubscribers('SIGNED_IN',i)}return this._returnResult({data:{user:i.user,session:i},error:null})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{session:null,user:null},error:e});throw e}}async refreshSession(e){return await this.initializePromise,null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._refreshSession(e)):await this._refreshSession(e)}async _refreshSession(e){try{return await this._useSession(async t=>{var s;if(!e){const{data:r,error:i}=t;if(i)throw i;e=null!==(s=r.session)&&void 0!==s?s:void 0}if(!(null==e?void 0:e.refresh_token))throw new c.AuthSessionMissingError;const{data:r,error:i}=await this._callRefreshToken(e.refresh_token);return i?this._returnResult({data:{user:null,session:null},error:i}):r?this._returnResult({data:{user:r.user,session:r},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async _getSessionFromURL(e,t){var s;try{if(!(0,_.isBrowser)())throw new c.AuthImplicitGrantRedirectError('No browser detected.');if(e.error||e.error_description||e.error_code)throw new c.AuthImplicitGrantRedirectError(e.error_description||'Error in URL with unspecified error_description',{error:e.error||'unspecified_error',code:e.error_code||'unspecified_code'});switch(t){case'implicit':if('pkce'===this.flowType)throw new c.AuthPKCEGrantCodeExchangeError('Not a valid PKCE flow url.');break;case'pkce':if('implicit'===this.flowType)throw new c.AuthImplicitGrantRedirectError('Not a valid implicit grant flow url.')}if('pkce'===t){if(this._debug('#_initialize()','begin','is PKCE flow',!0),!e.code)throw new c.AuthPKCEGrantCodeExchangeError('No code detected.');const{data:t,error:r}=await this._exchangeCodeForSession(e.code);if(r)throw r;const i=new URL(window.location.href);return i.searchParams.delete('code'),window.history.replaceState(window.history.state,'',i.toString()),{data:{session:t.session,redirectType:null!==(s=t.redirectType)&&void 0!==s?s:null},error:null}}const{provider_token:r,provider_refresh_token:i,access_token:n,refresh_token:a,expires_in:o,expires_at:l,token_type:u}=e;if(!(n&&o&&a&&u))throw new c.AuthImplicitGrantRedirectError('No session defined in URL');const d=Math.round(Date.now()/1e3),g=parseInt(o);let w=d+g;l&&(w=parseInt(l));const y=w-d;1e3*y<=h.AUTO_REFRESH_TICK_DURATION_MS&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${y}s, should have been closer to ${g}s`);const f=w-g;d-f>=120?console.warn('@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale',f,w,d):d-f<0&&console.warn('@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew',f,w,d);const{data:p,error:v}=await this._getUser(n);if(v)throw v;const b={provider_token:r,provider_refresh_token:i,access_token:n,expires_in:g,expires_at:w,refresh_token:a,token_type:u,user:p.user};return window.location.hash='',this._debug('#_getSessionFromURL()','clearing window.location.hash'),this._returnResult({data:{session:b,redirectType:e.type},error:null})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{session:null,redirectType:null},error:e});throw e}}_isImplicitGrantCallback(e){return'function'==typeof this.detectSessionInUrl?this.detectSessionInUrl(new URL(window.location.href),e):Boolean(e.access_token||e.error||e.error_description||e.error_code)}async _isPKCECallback(e){const t=await(0,_.getItemAsync)(this.storage,`${this.storageKey}-code-verifier`);return!(!e.code||!t)}async signOut(e={scope:'global'}){return await this.initializePromise,null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(e)):await this._signOut(e)}async _signOut({scope:e}={scope:'global'}){return await this._useSession(async t=>{var s;const{data:r,error:i}=t;if(i&&!(0,c.isAuthSessionMissingError)(i))return this._returnResult({error:i});const n=null===(s=r.session)||void 0===s?void 0:s.access_token;if(n){const{error:t}=await this.admin.signOut(n,e);if(t&&(!(0,c.isAuthApiError)(t)||404!==t.status&&401!==t.status&&403!==t.status)&&!(0,c.isAuthSessionMissingError)(t))return this._returnResult({error:t})}return'others'!==e&&(await this._removeSession(),await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(e){const t=(0,_.generateCallbackId)(),s={id:t,callback:e,unsubscribe:()=>{this._debug('#unsubscribe()','state change callback with id removed',t),this.stateChangeEmitters.delete(t)}};return this._debug('#onAuthStateChange()','registered callback with id',t),this.stateChangeEmitters.set(t,s),(async()=>{await this.initializePromise,null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(t)}):await this._emitInitialSession(t)})(),{data:{subscription:s}}}async _emitInitialSession(e){return await this._useSession(async t=>{var s,r;try{const{data:{session:r},error:i}=t;if(i)throw i;await(null===(s=this.stateChangeEmitters.get(e))||void 0===s?void 0:s.callback('INITIAL_SESSION',r)),this._debug('INITIAL_SESSION','callback id',e,'session',r)}catch(t){await(null===(r=this.stateChangeEmitters.get(e))||void 0===r?void 0:r.callback('INITIAL_SESSION',null)),this._debug('INITIAL_SESSION','callback id',e,'error',t),(0,c.isAuthSessionMissingError)(t)?console.warn(t):console.error(t)}})}async resetPasswordForEmail(e,t={}){let s=null,r=null;'pkce'===this.flowType&&([s,r]=await(0,_.getCodeChallengeAndMethod)(this.storage,this.storageKey,!0));try{return await(0,d._request)(this.fetch,'POST',`${this.url}/recover`,{body:{email:e,code_challenge:s,code_challenge_method:r,gotrue_meta_security:{captcha_token:t.captchaToken}},headers:this.headers,redirectTo:t.redirectTo})}catch(e){if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),(0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async getUserIdentities(){var e;try{const{data:t,error:s}=await this.getUser();if(s)throw s;return this._returnResult({data:{identities:null!==(e=t.user.identities)&&void 0!==e?e:[]},error:null})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async linkIdentity(e){return'token'in e?this.linkIdentityIdToken(e):this.linkIdentityOAuth(e)}async linkIdentityOAuth(e){var t;try{const{data:s,error:r}=await this._useSession(async t=>{var s,r,i,n,a;const{data:o,error:l}=t;if(l)throw l;const u=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:null===(s=e.options)||void 0===s?void 0:s.redirectTo,scopes:null===(r=e.options)||void 0===r?void 0:r.scopes,queryParams:null===(i=e.options)||void 0===i?void 0:i.queryParams,skipBrowserRedirect:!0});return await(0,d._request)(this.fetch,'GET',u,{headers:this.headers,jwt:null!==(a=null===(n=o.session)||void 0===n?void 0:n.access_token)&&void 0!==a?a:void 0})});if(r)throw r;return(0,_.isBrowser)()&&!(null===(t=e.options)||void 0===t?void 0:t.skipBrowserRedirect)&&window.location.assign(null==s?void 0:s.url),this._returnResult({data:{provider:e.provider,url:null==s?void 0:s.url},error:null})}catch(t){if((0,c.isAuthError)(t))return this._returnResult({data:{provider:e.provider,url:null},error:t});throw t}}async linkIdentityIdToken(e){return await this._useSession(async t=>{var s;try{const{error:r,data:{session:i}}=t;if(r)throw r;const{options:n,provider:a,token:o,access_token:l,nonce:u}=e,h=await(0,d._request)(this.fetch,'POST',`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:null!==(s=null==i?void 0:i.access_token)&&void 0!==s?s:void 0,body:{provider:a,id_token:o,access_token:l,nonce:u,link_identity:!0,gotrue_meta_security:{captcha_token:null==n?void 0:n.captchaToken}},xform:d._sessionResponse}),{data:_,error:g}=h;return g?this._returnResult({data:{user:null,session:null},error:g}):_&&_.session&&_.user?(_.session&&(await this._saveSession(_.session),await this._notifyAllSubscribers('USER_UPDATED',_.session)),this._returnResult({data:_,error:g})):this._returnResult({data:{user:null,session:null},error:new c.AuthInvalidTokenResponseError})}catch(e){if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),(0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}})}async unlinkIdentity(e){try{return await this._useSession(async t=>{var s,r;const{data:i,error:n}=t;if(n)throw n;return await(0,d._request)(this.fetch,'DELETE',`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:null!==(r=null===(s=i.session)||void 0===s?void 0:s.access_token)&&void 0!==r?r:void 0})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _refreshAccessToken(e){const t="#_refreshAccessToken()";this._debug(t,'begin');try{const s=Date.now();return await(0,_.retryable)(async s=>(s>0&&await(0,_.sleep)(200*Math.pow(2,s-1)),this._debug(t,'refreshing attempt',s),await(0,d._request)(this.fetch,'POST',`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:d._sessionResponse})),(e,t)=>{const r=200*Math.pow(2,e);return t&&(0,c.isAuthRetryableFetchError)(t)&&Date.now()+r-sDate.now())?this._debug(r,'proactive refresh failed, access token still valid \u2014 preserving session'):await this._removeSession()}return this.lastRefreshFailure={refreshToken:e,result:s,expiresAt:Date.now()+h.REFRESH_FAILURE_COOLDOWN_MS},null===(t=this.refreshingDeferred)||void 0===t||t.resolve(s),s}throw null===(s=this.refreshingDeferred)||void 0===s||s.reject(i),i}finally{this.refreshingDeferred=null,this._debug(r,'end')}}async _notifyAllSubscribers(e,t,s=!0){const r=`#_notifyAllSubscribers(${e})`;this._debug(r,'begin',t,`broadcast = ${s}`);try{this.broadcastChannel&&s&&this.broadcastChannel.postMessage({event:e,session:t});const r=[],i=Array.from(this.stateChangeEmitters.values()).map(async s=>{try{await s.callback(e,t)}catch(e){r.push(e)}});if(await Promise.all(i),r.length>0){for(let e=0;ethis._autoRefreshTokenTick(),h.AUTO_REFRESH_TICK_DURATION_MS);this.autoRefreshTicker=e,e&&'object'==typeof e&&'function'==typeof e.unref?e.unref():'undefined'!=typeof Deno&&'function'==typeof Deno.unrefTimer&&Deno.unrefTimer(e);const t=setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0);this.autoRefreshTickTimeout=t,t&&'object'==typeof t&&'function'==typeof t.unref?t.unref():'undefined'!=typeof Deno&&'function'==typeof Deno.unrefTimer&&Deno.unrefTimer(t)}async _stopAutoRefresh(){this._debug('#_stopAutoRefresh()');const e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e);const t=this.autoRefreshTickTimeout;this.autoRefreshTickTimeout=null,t&&clearTimeout(t)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async dispose(){var e;this._removeVisibilityChangedCallback(),await this._stopAutoRefresh(),null===(e=this.broadcastChannel)||void 0===e||e.close(),this.broadcastChannel=null,this.stateChangeEmitters.clear()}async _autoRefreshTokenTick(){if(this._debug('#_autoRefreshTokenTick()','begin'),null==this.lock)if(null===this.refreshingDeferred)try{const e=Date.now();try{await this._useSession(async t=>{const{data:{session:s}}=t;if(!s||!s.refresh_token||!s.expires_at)return void this._debug('#_autoRefreshTokenTick()','no session');const r=Math.floor((1e3*s.expires_at-e)/h.AUTO_REFRESH_TICK_DURATION_MS);this._debug('#_autoRefreshTokenTick()',`access token expires in ${r} ticks, a tick lasts ${h.AUTO_REFRESH_TICK_DURATION_MS}ms, refresh threshold is ${h.AUTO_REFRESH_TICK_THRESHOLD} ticks`),r<=h.AUTO_REFRESH_TICK_THRESHOLD&&await this._callRefreshToken(s.refresh_token)})}catch(e){console.error('Auto refresh tick failed with error. This is likely a transient error.',e)}}finally{this._debug('#_autoRefreshTokenTick()','end')}else this._debug('#_autoRefreshTokenTick()','refresh already in flight, skipping');else try{await this._acquireLock(0,async()=>{try{const e=Date.now();try{return await this._useSession(async t=>{const{data:{session:s}}=t;if(!s||!s.refresh_token||!s.expires_at)return void this._debug('#_autoRefreshTokenTick()','no session');const r=Math.floor((1e3*s.expires_at-e)/h.AUTO_REFRESH_TICK_DURATION_MS);this._debug('#_autoRefreshTokenTick()',`access token expires in ${r} ticks, a tick lasts ${h.AUTO_REFRESH_TICK_DURATION_MS}ms, refresh threshold is ${h.AUTO_REFRESH_TICK_THRESHOLD} ticks`),r<=h.AUTO_REFRESH_TICK_THRESHOLD&&await this._callRefreshToken(s.refresh_token)})}catch(e){console.error('Auto refresh tick failed with error. This is likely a transient error.',e)}}finally{this._debug('#_autoRefreshTokenTick()','end')}})}catch(e){if(!(e instanceof w.LockAcquireTimeoutError))throw e;this._debug('auto refresh token tick lock not available')}}async _handleVisibilityChange(){if(this._debug('#_handleVisibilityChange()'),!(0,_.isBrowser)()||!(null===window||void 0===window?void 0:window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>{try{await this._onVisibilityChanged(!1)}catch(e){this._debug('#visibilityChangedCallback','error',e)}},null===window||void 0===window||window.addEventListener('visibilitychange',this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error('_handleVisibilityChange',e)}}async _onVisibilityChanged(e){const t=`#_onVisibilityChanged(${e})`;if(this._debug(t,'visibilityState',document.visibilityState),'visible'===document.visibilityState){if(this.autoRefreshToken&&this._startAutoRefresh(),!e)if(await this.initializePromise,null!=this.lock)await this._acquireLock(this.lockAcquireTimeout,async()=>{'visible'===document.visibilityState?await this._recoverAndRefresh():this._debug(t,'acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting')});else{if('visible'!==document.visibilityState)return void this._debug(t,'visibilityState is no longer visible, skipping recovery');await this._recoverAndRefresh()}}else'hidden'===document.visibilityState&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(e,t,s){const r=[`provider=${encodeURIComponent(t)}`];if((null==s?void 0:s.redirectTo)&&r.push(`redirect_to=${encodeURIComponent(s.redirectTo)}`),(null==s?void 0:s.scopes)&&r.push(`scopes=${encodeURIComponent(s.scopes)}`),'pkce'===this.flowType){const[e,t]=await(0,_.getCodeChallengeAndMethod)(this.storage,this.storageKey),s=new URLSearchParams({code_challenge:`${encodeURIComponent(e)}`,code_challenge_method:`${encodeURIComponent(t)}`});r.push(s.toString())}if(null==s?void 0:s.queryParams){const e=new URLSearchParams(s.queryParams);r.push(e.toString())}return(null==s?void 0:s.skipBrowserRedirect)&&r.push(`skip_http_redirect=${s.skipBrowserRedirect}`),`${e}?${r.join('&')}`}async _unenroll(e){try{return await this._useSession(async t=>{var s;const{data:r,error:i}=t;return i?this._returnResult({data:null,error:i}):await(0,d._request)(this.fetch,'DELETE',`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:null===(s=null==r?void 0:r.session)||void 0===s?void 0:s.access_token})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _enroll(e){try{return await this._useSession(async t=>{var s,r;const{data:i,error:n}=t;if(n)return this._returnResult({data:null,error:n});const a=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},'phone'===e.factorType?{phone:e.phone}:'totp'===e.factorType?{issuer:e.issuer}:{}),{data:o,error:l}=await(0,d._request)(this.fetch,'POST',`${this.url}/factors`,{body:a,headers:this.headers,jwt:null===(s=null==i?void 0:i.session)||void 0===s?void 0:s.access_token});return l?this._returnResult({data:null,error:l}):('totp'===e.factorType&&'totp'===o.type&&(null===(r=null==o?void 0:o.totp)||void 0===r?void 0:r.qr_code)&&(o.totp.qr_code=`data:image/svg+xml;utf-8,${o.totp.qr_code}`),this._returnResult({data:o,error:null}))})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _verify(e){const t=async()=>{try{return await this._useSession(async t=>{var s;const{data:r,error:i}=t;if(i)return this._returnResult({data:null,error:i});const n=Object.assign({challenge_id:e.challengeId},'webauthn'in e?{webauthn:Object.assign(Object.assign({},e.webauthn),{credential_response:'create'===e.webauthn.type?(0,b.serializeCredentialCreationResponse)(e.webauthn.credential_response):(0,b.serializeCredentialRequestResponse)(e.webauthn.credential_response)})}:{code:e.code}),{data:a,error:o}=await(0,d._request)(this.fetch,'POST',`${this.url}/factors/${e.factorId}/verify`,{body:n,headers:this.headers,jwt:null===(s=null==r?void 0:r.session)||void 0===s?void 0:s.access_token});return o?this._returnResult({data:null,error:o}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+a.expires_in},a)),await this._notifyAllSubscribers('MFA_CHALLENGE_VERIFIED',a),this._returnResult({data:a,error:o}))})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}};return null!=this.lock?this._acquireLock(this.lockAcquireTimeout,t):t()}async _challenge(e){const t=async()=>{try{return await this._useSession(async t=>{var s;const{data:r,error:i}=t;if(i)return this._returnResult({data:null,error:i});const n=await(0,d._request)(this.fetch,'POST',`${this.url}/factors/${e.factorId}/challenge`,{body:e,headers:this.headers,jwt:null===(s=null==r?void 0:r.session)||void 0===s?void 0:s.access_token});if(n.error)return n;const{data:a}=n;if('webauthn'!==a.type)return{data:a,error:null};switch(a.webauthn.type){case'create':return{data:Object.assign(Object.assign({},a),{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_options:Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:(0,b.deserializeCredentialCreationOptions)(a.webauthn.credential_options.publicKey)})})}),error:null};case'request':return{data:Object.assign(Object.assign({},a),{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_options:Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:(0,b.deserializeCredentialRequestOptions)(a.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}};return null!=this.lock?this._acquireLock(this.lockAcquireTimeout,t):t()}async _challengeAndVerify(e){const{data:t,error:s}=await this._challenge({factorId:e.factorId});return s?this._returnResult({data:null,error:s}):await this._verify({factorId:e.factorId,challengeId:t.id,code:e.code})}async _listFactors(){var e;const{data:{user:t},error:s}=await this.getUser();if(s)return{data:null,error:s};const r={all:[],phone:[],totp:[],webauthn:[]};for(const s of null!==(e=null==t?void 0:t.factors)&&void 0!==e?e:[])r.all.push(s),'verified'===s.status&&r[s.factor_type].push(s);return{data:r,error:null}}async _getAuthenticatorAssuranceLevel(e){var t,s,r,i;if(e)try{const{payload:r}=(0,_.decodeJWT)(e);let i=null;r.aal&&(i=r.aal);let n=i;const{data:{user:a},error:o}=await this.getUser(e);if(o)return this._returnResult({data:null,error:o});(null!==(s=null===(t=null==a?void 0:a.factors)||void 0===t?void 0:t.filter(e=>'verified'===e.status))&&void 0!==s?s:[]).length>0&&(n='aal2');return{data:{currentLevel:i,nextLevel:n,currentAuthenticationMethods:r.amr||[]},error:null}}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}const{data:{session:n},error:a}=await this.getSession();if(a)return this._returnResult({data:null,error:a});if(!n)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:o}=(0,_.decodeJWT)(n.access_token);let l=null;o.aal&&(l=o.aal);let u=l;(null!==(i=null===(r=n.user.factors)||void 0===r?void 0:r.filter(e=>'verified'===e.status))&&void 0!==i?i:[]).length>0&&(u='aal2');return{data:{currentLevel:l,nextLevel:u,currentAuthenticationMethods:o.amr||[]},error:null}}async _getAuthorizationDetails(e){try{return await this._useSession(async t=>{const{data:{session:s},error:r}=t;return r?this._returnResult({data:null,error:r}):s?await(0,d._request)(this.fetch,'GET',`${this.url}/oauth/authorizations/${e}`,{headers:this.headers,jwt:s.access_token,xform:e=>({data:e,error:null})}):this._returnResult({data:null,error:new c.AuthSessionMissingError})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _approveAuthorization(e,t){try{return await this._useSession(async s=>{const{data:{session:r},error:i}=s;if(i)return this._returnResult({data:null,error:i});if(!r)return this._returnResult({data:null,error:new c.AuthSessionMissingError});const n=await(0,d._request)(this.fetch,'POST',`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:r.access_token,body:{action:'approve'},xform:e=>({data:e,error:null})});return n.data&&n.data.redirect_url&&(0,_.isBrowser)()&&!(null==t?void 0:t.skipBrowserRedirect)&&window.location.assign(n.data.redirect_url),n})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _denyAuthorization(e,t){try{return await this._useSession(async s=>{const{data:{session:r},error:i}=s;if(i)return this._returnResult({data:null,error:i});if(!r)return this._returnResult({data:null,error:new c.AuthSessionMissingError});const n=await(0,d._request)(this.fetch,'POST',`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:r.access_token,body:{action:'deny'},xform:e=>({data:e,error:null})});return n.data&&n.data.redirect_url&&(0,_.isBrowser)()&&!(null==t?void 0:t.skipBrowserRedirect)&&window.location.assign(n.data.redirect_url),n})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _listOAuthGrants(){try{return await this._useSession(async e=>{const{data:{session:t},error:s}=e;return s?this._returnResult({data:null,error:s}):t?await(0,d._request)(this.fetch,'GET',`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:t.access_token,xform:e=>({data:e,error:null})}):this._returnResult({data:null,error:new c.AuthSessionMissingError})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _revokeOAuthGrant(e){try{return await this._useSession(async t=>{const{data:{session:s},error:r}=t;return r?this._returnResult({data:null,error:r}):s?(await(0,d._request)(this.fetch,'DELETE',`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:s.access_token,query:{client_id:e.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new c.AuthSessionMissingError})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async fetchJwk(e,t={keys:[]}){let s=t.keys.find(t=>t.kid===e);if(s)return s;const r=Date.now();if(s=this.jwks.keys.find(t=>t.kid===e),s&&this.jwks_cached_at+h.JWKS_TTL>r)return s;const{data:i,error:n}=await(0,d._request)(this.fetch,'GET',`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(n)throw n;return i.keys&&0!==i.keys.length?(this.jwks=i,this.jwks_cached_at=r,s=i.keys.find(t=>t.kid===e),s||null):null}async getClaims(e,t={}){try{let s=e;if(!s){const{data:e,error:t}=await this.getSession();if(t||!e.session)return this._returnResult({data:null,error:t});s=e.session.access_token}const{header:r,payload:i,signature:n,raw:{header:a,payload:o}}=(0,_.decodeJWT)(s);if(!(null==t?void 0:t.allowExpired))try{(0,_.validateExp)(i.exp)}catch(e){throw new c.AuthInvalidJwtError(e instanceof Error?e.message:'JWT validation failed')}const l=r.alg&&!r.alg.startsWith('HS')&&r.kid&&'crypto'in globalThis&&'subtle'in globalThis.crypto?await this.fetchJwk(r.kid,(null==t?void 0:t.keys)?{keys:t.keys}:null==t?void 0:t.jwks):null;if(!l){const{error:e}=await this.getUser(s);if(e)throw e;return{data:{claims:i,header:r,signature:n},error:null}}const u=(0,_.getAlgorithm)(r.alg),h=await crypto.subtle.importKey('jwk',l,u,!0,['verify']);if(!await crypto.subtle.verify(u,h,n,(0,p.stringToUint8Array)(`${a}.${o}`)))throw new c.AuthInvalidJwtError('Invalid JWT signature');return{data:{claims:i,header:r,signature:n},error:null}}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async signInWithPasskey(e){var t,s,r;(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{if(!(0,b.browserSupportsWebAuthn)())return this._returnResult({data:null,error:new c.AuthUnknownError('Browser does not support WebAuthn',null)});const{data:i,error:n}=await this._startPasskeyAuthentication({options:{captchaToken:null===(t=null==e?void 0:e.options)||void 0===t?void 0:t.captchaToken}});if(n||!i)return this._returnResult({data:null,error:n});const a=(0,b.deserializeCredentialRequestOptions)(i.options),o=null!==(r=null===(s=null==e?void 0:e.options)||void 0===s?void 0:s.signal)&&void 0!==r?r:b.webAuthnAbortService.createNewAbortSignal(),{data:l,error:u}=await(0,b.getCredential)({publicKey:a,signal:o});if(u||!l)return this._returnResult({data:null,error:null!=u?u:new c.AuthUnknownError('WebAuthn ceremony failed',null)});const h=(0,b.serializeCredentialRequestResponse)(l);return this._verifyPasskeyAuthentication({challengeId:i.challenge_id,credential:h})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async registerPasskey(e){var t,s;(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{if(!(0,b.browserSupportsWebAuthn)())return this._returnResult({data:null,error:new c.AuthUnknownError('Browser does not support WebAuthn',null)});const{data:r,error:i}=await this._startPasskeyRegistration();if(i||!r)return this._returnResult({data:null,error:i});const n=(0,b.deserializeCredentialCreationOptions)(r.options),a=null!==(s=null===(t=null==e?void 0:e.options)||void 0===t?void 0:t.signal)&&void 0!==s?s:b.webAuthnAbortService.createNewAbortSignal(),{data:o,error:l}=await(0,b.createCredential)({publicKey:n,signal:a});if(l||!o)return this._returnResult({data:null,error:null!=l?l:new c.AuthUnknownError('WebAuthn ceremony failed',null)});const u=(0,b.serializeCredentialCreationResponse)(o);return this._verifyPasskeyRegistration({challengeId:r.challenge_id,credential:u})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _startPasskeyRegistration(){(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{return await this._useSession(async e=>{const{data:{session:t},error:s}=e;if(s)return this._returnResult({data:null,error:s});if(!t)return this._returnResult({data:null,error:new c.AuthSessionMissingError});const{data:r,error:i}=await(0,d._request)(this.fetch,'POST',`${this.url}/passkeys/registration/options`,{headers:this.headers,jwt:t.access_token,body:{}});return i?this._returnResult({data:null,error:i}):this._returnResult({data:r,error:null})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _verifyPasskeyRegistration(e){(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{return await this._useSession(async t=>{const{data:{session:s},error:r}=t;if(r)return this._returnResult({data:null,error:r});if(!s)return this._returnResult({data:null,error:new c.AuthSessionMissingError});const{data:i,error:n}=await(0,d._request)(this.fetch,'POST',`${this.url}/passkeys/registration/verify`,{headers:this.headers,jwt:s.access_token,body:{challenge_id:e.challengeId,credential:e.credential}});return n?this._returnResult({data:null,error:n}):this._returnResult({data:i,error:null})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _startPasskeyAuthentication(e){var t;(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{const{data:s,error:r}=await(0,d._request)(this.fetch,'POST',`${this.url}/passkeys/authentication/options`,{headers:this.headers,body:{gotrue_meta_security:{captcha_token:null===(t=null==e?void 0:e.options)||void 0===t?void 0:t.captchaToken}}});return r?this._returnResult({data:null,error:r}):this._returnResult({data:s,error:null})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _verifyPasskeyAuthentication(e){(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{const{data:t,error:s}=await(0,d._request)(this.fetch,'POST',`${this.url}/passkeys/authentication/verify`,{headers:this.headers,body:{challenge_id:e.challengeId,credential:e.credential},xform:d._sessionResponse});return s?this._returnResult({data:null,error:s}):(t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers('SIGNED_IN',t.session)),this._returnResult({data:t,error:null}))}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _listPasskeys(){(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{return await this._useSession(async e=>{const{data:{session:t},error:s}=e;if(s)return this._returnResult({data:null,error:s});if(!t)return this._returnResult({data:null,error:new c.AuthSessionMissingError});const{data:r,error:i}=await(0,d._request)(this.fetch,'GET',`${this.url}/passkeys`,{headers:this.headers,jwt:t.access_token,xform:e=>({data:e,error:null})});return i?this._returnResult({data:null,error:i}):this._returnResult({data:r,error:null})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _updatePasskey(e){(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{return await this._useSession(async t=>{const{data:{session:s},error:r}=t;if(r)return this._returnResult({data:null,error:r});if(!s)return this._returnResult({data:null,error:new c.AuthSessionMissingError});const{data:i,error:n}=await(0,d._request)(this.fetch,'PATCH',`${this.url}/passkeys/${e.passkeyId}`,{headers:this.headers,jwt:s.access_token,body:{friendly_name:e.friendlyName}});return n?this._returnResult({data:null,error:n}):this._returnResult({data:i,error:null})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _deletePasskey(e){(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{return await this._useSession(async t=>{const{data:{session:s},error:r}=t;if(r)return this._returnResult({data:null,error:r});if(!s)return this._returnResult({data:null,error:new c.AuthSessionMissingError});const{error:i}=await(0,d._request)(this.fetch,'DELETE',`${this.url}/passkeys/${e.passkeyId}`,{headers:this.headers,jwt:s.access_token,noResolveJson:!0});return i?this._returnResult({data:null,error:i}):this._returnResult({data:null,error:null})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}}R.nextInstanceID={};var A=R},1187,[1179,1181,1184,1180,1183,1188,1189,1190,1182,1185,1191,1192]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.memoryLocalStorageAdapter=function(t={}){return{getItem:o=>t[o]||null,setItem:(o,n)=>{t[o]=n},removeItem:o=>{delete t[o]}}}},1188,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"internals",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"LockAcquireTimeoutError",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"NavigatorLockAcquireTimeoutError",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"ProcessLockAcquireTimeoutError",{enumerable:!0,get:function(){return s}}),_e.navigatorLock=async function(e,t,s){o.debug&&console.log('@supabase/gotrue-js: navigatorLock: acquire lock',e,t);const c=new globalThis.AbortController;let l;t>0&&(l=setTimeout(()=>{c.abort(),o.debug&&console.log('@supabase/gotrue-js: navigatorLock acquire timed out',e)},t));await Promise.resolve();try{return await globalThis.navigator.locks.request(e,0===t?{mode:'exclusive',ifAvailable:!0}:{mode:'exclusive',signal:c.signal},async c=>{if(!c){if(0===t)throw o.debug&&console.log('@supabase/gotrue-js: navigatorLock: not immediately available',e),new n(`Acquiring an exclusive Navigator LockManager lock "${e}" immediately failed`);if(o.debug)try{const e=await globalThis.navigator.locks.query();console.log('@supabase/gotrue-js: Navigator LockManager state',JSON.stringify(e,null,' '))}catch(e){console.warn('@supabase/gotrue-js: Error when querying Navigator LockManager state',e)}return console.warn('@supabase/gotrue-js: Navigator LockManager returned a null lock when using #request without ifAvailable set to true, it appears this browser is not following the LockManager spec https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request'),clearTimeout(l),await s()}clearTimeout(l),o.debug&&console.log('@supabase/gotrue-js: navigatorLock: acquired',e,c.name);try{return await s()}finally{o.debug&&console.log('@supabase/gotrue-js: navigatorLock: released',e,c.name)}})}catch(u){if(t>0&&clearTimeout(l),null!==u&&'object'==typeof u&&'name'in u&&'AbortError'===u.name&&t>0){if(c.signal.aborted)return o.debug&&console.log('@supabase/gotrue-js: navigatorLock: acquire timeout, recovering by stealing lock',e),console.warn(`@supabase/gotrue-js: Lock "${e}" was not released within ${t}ms. This may indicate an orphaned lock from a component unmount (e.g., React Strict Mode). Forcefully acquiring the lock to recover.`),await Promise.resolve().then(()=>globalThis.navigator.locks.request(e,{mode:'exclusive',steal:!0},async t=>{if(!t)return console.warn('@supabase/gotrue-js: Navigator LockManager returned null lock even with steal: true'),await s();o.debug&&console.log('@supabase/gotrue-js: navigatorLock: recovered (stolen)',e,t.name);try{return await s()}finally{o.debug&&console.log('@supabase/gotrue-js: navigatorLock: released (stolen)',e,t.name)}}));throw o.debug&&console.log('@supabase/gotrue-js: navigatorLock: lock was stolen by another request',e),new n(`Lock "${e}" was released because another request stole it`)}throw u}},_e.processLock=async function(e,o,n){var l;const u=null!==(l=c[e])&&void 0!==l?l:Promise.resolve(),b=(async()=>{try{return await u,null}catch(e){return null}})(),k=(async()=>{let c=null;try{const t=o>=0?new Promise((t,n)=>{c=setTimeout(()=>{console.warn(`@supabase/gotrue-js: Lock "${e}" acquisition timed out after ${o}ms. This may be caused by another operation holding the lock. Consider increasing lockAcquireTimeout or checking for stuck operations.`),n(new s(`Acquiring process lock with name "${e}" timed out`))},o)}):null;await Promise.race([b,t].filter(e=>e)),null!==c&&clearTimeout(c)}catch(e){if(null!==c&&clearTimeout(c),e instanceof t)throw e}return await n()})();return c[e]=(async()=>{try{return await k}catch(e){if(e instanceof t){try{await u}catch(e){}return null}throw e}})(),await k};var e=r(d[0]);const o={debug:!!(globalThis&&(0,e.supportsLocalStorage)()&&globalThis.localStorage&&'true'===globalThis.localStorage.getItem('supabase.gotrue-js.locks.debug'))};class t extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class n extends t{}class s extends t{}const c={}},1189,[1183]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.polyfillGlobalThis=function(){if('object'==typeof globalThis)return;try{Object.defineProperty(Object.prototype,'__magic__',{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch(e){'undefined'!=typeof self&&(self.globalThis=self)}}},1190,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(t){if(!/^0x[a-fA-F0-9]{40}$/.test(t))throw new Error(`@supabase/auth-js: Address "${t}" is invalid.`);return t.toLowerCase()}Object.defineProperty(e,'__esModule',{value:!0}),e.getAddress=t,e.fromHex=function(t){return parseInt(t,16)},e.toHex=function(t){const n=(new TextEncoder).encode(t);return'0x'+Array.from(n,t=>t.toString(16).padStart(2,'0')).join('')},e.createSiweMessage=function(n){var s;const{chainId:o,domain:u,expirationTime:c,issuedAt:l=new Date,nonce:f,notBefore:I,requestId:v,resources:h,scheme:$,uri:w,version:E}=n;if(!Number.isInteger(o))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${o}`);if(!u)throw new Error("@supabase/auth-js: Invalid SIWE message field \"domain\". Domain must be provided.");if(f&&f.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${f}`);if(!w)throw new Error("@supabase/auth-js: Invalid SIWE message field \"uri\". URI must be provided.");if('1'!==E)throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${E}`);if(null===(s=n.statement)||void 0===s?void 0:s.includes('\n'))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${n.statement}`);const S=t(n.address),b=$?`${$}://${u}`:u,p=n.statement?`${n.statement}\n`:'',j=`${b} wants you to sign in with your Ethereum account:\n${S}\n\n${p}`;let x=`URI: ${w}\nVersion: ${E}\nChain ID: ${o}${f?`\nNonce: ${f}`:''}\nIssued At: ${l.toISOString()}`;c&&(x+=`\nExpiration Time: ${c.toISOString()}`);I&&(x+=`\nNot Before: ${I.toISOString()}`);v&&(x+=`\nRequest ID: ${v}`);if(h){let t='\nResources:';for(const n of h){if(!n||'string'!=typeof n)throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${n}`);t+=`\n- ${n}`}x+=t}return`${j}\n${x}`}},1191,[]); +__d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"WebAuthnError",{enumerable:!0,get:function(){return l.WebAuthnError}}),Object.defineProperty(e,"isWebAuthnError",{enumerable:!0,get:function(){return l.isWebAuthnError}}),Object.defineProperty(e,"identifyRegistrationError",{enumerable:!0,get:function(){return l.identifyRegistrationError}}),Object.defineProperty(e,"identifyAuthenticationError",{enumerable:!0,get:function(){return l.identifyAuthenticationError}}),Object.defineProperty(e,"WebAuthnAbortService",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"webAuthnAbortService",{enumerable:!0,get:function(){return u}}),e.deserializeCredentialCreationOptions=function(i){if(!i)throw new Error('Credential creation options are required');if('undefined'!=typeof PublicKeyCredential&&'parseCreationOptionsFromJSON'in PublicKeyCredential&&'function'==typeof PublicKeyCredential.parseCreationOptionsFromJSON)return PublicKeyCredential.parseCreationOptionsFromJSON(i);const{challenge:o,user:l,excludeCredentials:s}=i,u=(0,t.__rest)(i,["challenge","user","excludeCredentials"]),c=(0,n.base64UrlToUint8Array)(o).buffer,f=Object.assign(Object.assign({},l),{id:(0,n.base64UrlToUint8Array)(l.id).buffer}),h=Object.assign(Object.assign({},u),{challenge:c,user:f});if(s&&s.length>0){h.excludeCredentials=new Array(s.length);for(let t=0;t0){c.allowCredentials=new Array(l.length);for(let t=0;tnull!==t&&'object'==typeof t&&!Array.isArray(t),i=t=>t instanceof ArrayBuffer||ArrayBuffer.isView(t),o={};for(const l of t)if(l)for(const t in l){const s=l[t];if(void 0!==s)if(Array.isArray(s))o[t]=s;else if(i(s))o[t]=s;else if(n(s)){const i=o[t];n(i)?o[t]=p(i,s):o[t]=p(s)}else o[t]=s}return o}function w(t,n){return p(b,t,n||{})}function A(t,n){return p(y,t,n||{})}class O{constructor(t){this.client=t,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(t){return this.client.mfa.enroll(Object.assign(Object.assign({},t),{factorType:'webauthn'}))}async _challenge({factorId:t,webauthn:n,friendlyName:o,signal:l},s){var c;try{const{data:i,error:b}=await this.client.mfa.challenge({factorId:t,webauthn:n});if(!i)return{data:null,error:b};const y=null!=l?l:u.createNewAbortSignal();if('create'===i.webauthn.type){const{user:t}=i.webauthn.credential_options.publicKey;if(!t.name){const n=o;if(n)t.name=`${t.id}:${n}`;else{const n=(await this.client.getUser()).data.user,i=(null===(c=null==n?void 0:n.user_metadata)||void 0===c?void 0:c.name)||(null==n?void 0:n.email)||(null==n?void 0:n.id)||'User';t.name=`${t.id}:${i}`}}t.displayName||(t.displayName=t.name)}switch(i.webauthn.type){case'create':{const n=w(i.webauthn.credential_options.publicKey,null==s?void 0:s.create),{data:o,error:l}=await f({publicKey:n,signal:y});return o?{data:{factorId:t,challengeId:i.id,webauthn:{type:i.webauthn.type,credential_response:o}},error:null}:{data:null,error:l}}case'request':{const n=A(i.webauthn.credential_options.publicKey,null==s?void 0:s.request),{data:o,error:l}=await h(Object.assign(Object.assign({},i.webauthn.credential_options),{publicKey:n,signal:y}));return o?{data:{factorId:t,challengeId:i.id,webauthn:{type:i.webauthn.type,credential_response:o}},error:null}:{data:null,error:l}}}}catch(t){return(0,i.isAuthError)(t)?{data:null,error:t}:{data:null,error:new i.AuthUnknownError('Unexpected error in challenge',t)}}}async _verify({challengeId:t,factorId:n,webauthn:i}){return this.client.mfa.verify({factorId:n,challengeId:t,webauthn:i})}async _authenticate({factorId:t,webauthn:{rpId:n=('undefined'!=typeof window?window.location.hostname:void 0),rpOrigins:o=('undefined'!=typeof window?[window.location.origin]:void 0),signal:l}={}},s){if(!n)return{data:null,error:new i.AuthError('rpId is required for WebAuthn authentication')};try{if(!c())return{data:null,error:new i.AuthUnknownError('Browser does not support WebAuthn',null)};const{data:u,error:f}=await this.challenge({factorId:t,webauthn:{rpId:n,rpOrigins:o},signal:l},{request:s});if(!u)return{data:null,error:f};const{webauthn:h}=u;return this._verify({factorId:t,challengeId:u.challengeId,webauthn:{type:h.type,rpId:n,rpOrigins:o,credential_response:h.credential_response}})}catch(t){return(0,i.isAuthError)(t)?{data:null,error:t}:{data:null,error:new i.AuthUnknownError('Unexpected error in authenticate',t)}}}async _register({friendlyName:t,webauthn:{rpId:n=('undefined'!=typeof window?window.location.hostname:void 0),rpOrigins:o=('undefined'!=typeof window?[window.location.origin]:void 0),signal:l}={}},s){if(!n)return{data:null,error:new i.AuthError('rpId is required for WebAuthn registration')};try{if(!c())return{data:null,error:new i.AuthUnknownError('Browser does not support WebAuthn',null)};const{data:u,error:f}=await this._enroll({friendlyName:t});if(!u)return await this.client.mfa.listFactors().then(n=>{var i;return null===(i=n.data)||void 0===i?void 0:i.all.find(n=>'webauthn'===n.factor_type&&n.friendly_name===t&&'unverified'!==n.status)}).then(t=>t?this.client.mfa.unenroll({factorId:null==t?void 0:t.id}):void 0),{data:null,error:f};const{data:h,error:b}=await this._challenge({factorId:u.id,friendlyName:u.friendly_name,webauthn:{rpId:n,rpOrigins:o},signal:l},{create:s});return h?this._verify({factorId:u.id,challengeId:h.challengeId,webauthn:{rpId:n,rpOrigins:o,type:h.webauthn.type,credential_response:h.webauthn.credential_response}}):{data:null,error:b}}catch(t){return(0,i.isAuthError)(t)?{data:null,error:t}:{data:null,error:new i.AuthUnknownError('Unexpected error in register',t)}}}}},1192,[1157,1185,1184,1183,1193]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"WebAuthnError",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"WebAuthnUnknownError",{enumerable:!0,get:function(){return t}}),e.isWebAuthnError=function(n){return'object'==typeof n&&null!==n&&'__isWebAuthnError'in n},e.identifyRegistrationError=function({error:t,options:s}){var u,c,R;const{publicKey:E}=s;if(!E)throw Error('options was missing required publicKey property');if('AbortError'===t.name){if(s.signal instanceof AbortSignal)return new o({message:'Registration ceremony was sent an abort signal',code:'ERROR_CEREMONY_ABORTED',cause:t})}else if('ConstraintError'===t.name){if(!0===(null===(u=E.authenticatorSelection)||void 0===u?void 0:u.requireResidentKey))return new o({message:'Discoverable credentials were required but no available authenticator supported it',code:'ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT',cause:t});if('conditional'===s.mediation&&'required'===(null===(c=E.authenticatorSelection)||void 0===c?void 0:c.userVerification))return new o({message:'User verification was required during automatic registration but it could not be performed',code:'ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE',cause:t});if('required'===(null===(R=E.authenticatorSelection)||void 0===R?void 0:R.userVerification))return new o({message:'User verification was required but no available authenticator supported it',code:'ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT',cause:t})}else{if('InvalidStateError'===t.name)return new o({message:'The authenticator was previously registered',code:'ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED',cause:t});if('NotAllowedError'===t.name)return new o({message:t.message,code:'ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY',cause:t});if('NotSupportedError'===t.name){return 0===E.pubKeyCredParams.filter(n=>'public-key'===n.type).length?new o({message:'No entry in pubKeyCredParams was of type "public-key"',code:'ERROR_MALFORMED_PUBKEYCREDPARAMS',cause:t}):new o({message:'No available authenticator supported any of the specified pubKeyCredParams algorithms',code:'ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG',cause:t})}if('SecurityError'===t.name){const s=window.location.hostname;if(!(0,n.isValidDomain)(s))return new o({message:`${window.location.hostname} is an invalid domain`,code:'ERROR_INVALID_DOMAIN',cause:t});if(E.rp.id!==s)return new o({message:`The RP ID "${E.rp.id}" is invalid for this domain`,code:'ERROR_INVALID_RP_ID',cause:t})}else if('TypeError'===t.name){if(E.user.id.byteLength<1||E.user.id.byteLength>64)return new o({message:'User ID was not between 1 and 64 characters',code:'ERROR_INVALID_USER_ID_LENGTH',cause:t})}else if('UnknownError'===t.name)return new o({message:'The authenticator was unable to process the specified options, or could not create a new credential',code:'ERROR_AUTHENTICATOR_GENERAL_ERROR',cause:t})}return new o({message:'a Non-Webauthn related error has occurred',code:'ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY',cause:t})},e.identifyAuthenticationError=function({error:t,options:s}){const{publicKey:u}=s;if(!u)throw Error('options was missing required publicKey property');if('AbortError'===t.name){if(s.signal instanceof AbortSignal)return new o({message:'Authentication ceremony was sent an abort signal',code:'ERROR_CEREMONY_ABORTED',cause:t})}else{if('NotAllowedError'===t.name)return new o({message:t.message,code:'ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY',cause:t});if('SecurityError'===t.name){const s=window.location.hostname;if(!(0,n.isValidDomain)(s))return new o({message:`${window.location.hostname} is an invalid domain`,code:'ERROR_INVALID_DOMAIN',cause:t});if(u.rpId!==s)return new o({message:`The RP ID "${u.rpId}" is invalid for this domain`,code:'ERROR_INVALID_RP_ID',cause:t})}else if('UnknownError'===t.name)return new o({message:'The authenticator was unable to process the specified options, or could not create a new assertion signature',code:'ERROR_AUTHENTICATOR_GENERAL_ERROR',cause:t})}return new o({message:'a Non-Webauthn related error has occurred',code:'ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY',cause:t})};var n=r(d[0]);class o extends Error{constructor({message:n,code:o,cause:t,name:s}){var u;super(n,{cause:t}),this.__isWebAuthnError=!0,this.name=null!==(u=null!=s?s:t instanceof Error?t.name:void 0)&&void 0!==u?u:'Unknown Error',this.code=o}toJSON(){return{name:this.name,message:this.message,code:this.code}}}class t extends o{constructor(n,o){super({code:'ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY',cause:o,message:n}),this.name='WebAuthnUnknownError',this.originalError=o}}},1193,[1192]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u}});var e,t=r(d[0]);var u=((e=t)&&e.__esModule?e:{default:e}).default},1194,[1179]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u}});var e,t=r(d[0]);var u=((e=t)&&e.__esModule?e:{default:e}).default},1195,[1187]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.setSyncNamespace=function(e){s=t.IS_ISOLATED_VENUE?`cc-sync:${t.VENUE_RID}:${e}:`:`cc-sync:${e}:`},Object.defineProperty(_e,"syncNamespace",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"kv",{enumerable:!0,get:function(){return i}}),_e.uuid=function(){const e=globalThis.crypto;if(e?.randomUUID)return e.randomUUID();const t=new Uint8Array(16);if(e?.getRandomValues)e.getRandomValues(t);else for(let e=0;e<16;e++)t[e]=Math.floor(256*Math.random());t[6]=15&t[6]|64,t[8]=63&t[8]|128;const n=Array.from(t,e=>e.toString(16).padStart(2,'0')).join('');return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20)}`};var e,t=r(d[0]),n=r(d[1]),c=(e=n)&&e.__esModule?e:{default:e};let s=t.IS_ISOLATED_VENUE?`cc-sync:${t.VENUE_RID}:`:'cc-sync:';const o=()=>s,i={async get(e,t){try{const n=await c.default.getItem(s+e);return null==n?t:JSON.parse(n)}catch{return t}},async set(e,t){try{await c.default.setItem(s+e,JSON.stringify(t))}catch{}},async remove(e){try{await c.default.removeItem(s+e)}catch{}}}},1196,[5,1116]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"isOnline",{enumerable:!0,get:function(){return t}}),_e.setOnline=o,_e.onConnectivity=function(e){return n.add(e),()=>{n.delete(e)}},_e.isNetworkError=function(e){if(!e)return!1;const n=String(e.message??e).toLowerCase();return 0===e.status||/network|fetch failed|failed to fetch|timeout|timed out|offline|econn|enotfound|socket/.test(n)};let e=!0;const n=new Set,t=()=>e;function o(t){t!==e&&(e=t,n.forEach(n=>n(e)))}const s=globalThis.window;s?.addEventListener&&('boolean'==typeof s.navigator?.onLine&&(e=s.navigator.onLine),s.addEventListener('online',()=>o(!0)),s.addEventListener('offline',()=>o(!1)))},1197,[]); +__d(function(g,_r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TableRepository",{enumerable:!0,get:function(){return u}}),e.executeMutation=async function(t){const s=(t,s)=>{throw Object.assign(t,{status:s})};if('rpc'===t.kind){const{error:n,status:r}=await o().rpc(t.fn,t.values??{});return n&&s(n,r),'ok'}const n=o().from(t.table);if('upsert'===t.kind||'insert'===t.kind){const{error:r,status:o}=await n.upsert(t.values??{},{onConflict:t.conflictKey??'id',ignoreDuplicates:'insert'===t.kind});return r&&s(r,o),'ok'}let r='update'===t.kind?n.update(t.values??{}):n.delete();for(const[s,n]of Object.entries(t.match??{}))r=r.eq(s,n);const{data:u,error:c,status:h}=await r.select();c&&s(c,h);return'update'!==t.kind||u&&0!==u.length?'ok':'conflict'};var t=_r(d[0]),s=_r(d[1]),n=_r(d[2]),r=_r(d[3]);const o=()=>(0,s.getSupabase)();class u{constructor(t,s={}){this.table=t,this.opts=s,this.keyOf=s.keyOf??(t=>String(t.id)),this.keyColumns=s.keyColumns??['id'],this.venueCol=s.venueColumn??'venue_id'}rows(s){return t.cache.rows(this.table,s)}get(s,n){return t.cache.get(this.table,s,n)}subscribe(s,n){return t.cache.subscribe(this.table,s,n)}hydrate(s){return t.cache.hydrate(this.table,s)}async refresh(s,n={}){let u=o().from(this.table).select('*').eq(this.venueCol,s);this.opts.orderBy&&(u=u.order(this.opts.orderBy.column,{ascending:this.opts.orderBy.ascending??!0})),n.filter&&(u=n.filter(u));const{data:c,error:h}=await u.limit(this.opts.limit??1e3);if(h)throw h;const l=c??[];return t.cache.replace(this.table,s,l.map(t=>[this.keyOf(t),t]),t=>r.mutationQueue.hasPending(this.table,s,t)),l}async create(s,o){const u={...1===this.keyColumns.length&&'id'===this.keyColumns[0]?{id:(0,n.uuid)()}:{},...o,[this.venueCol]:s},c=this.keyOf(u);return t.cache.put(this.table,s,c,u),await r.mutationQueue.enqueue({table:this.table,venueId:s,kind:'insert'===this.opts.writeMode?'insert':'upsert',rowKey:c,values:u,conflictKey:this.opts.conflictKey??'id'}),u}async update(s,n,o,u={}){const c=t.cache.get(this.table,s,n),h={...this.matchFor(n,c),...u,[this.venueCol]:s};t.cache.patch(this.table,s,n,{...o,updated_at:(new Date).toISOString()}),await r.mutationQueue.enqueue({table:this.table,venueId:s,kind:'update',rowKey:n,values:o,match:h})}async remove(s,n){const o=t.cache.get(this.table,s,n),u={...this.matchFor(n,o),[this.venueCol]:s};t.cache.remove(this.table,s,n),await r.mutationQueue.enqueue({table:this.table,venueId:s,kind:'delete',rowKey:n,match:u})}matchFor(t,s){if(1===this.keyColumns.length&&'id'===this.keyColumns[0])return{id:t};const n={};for(const t of this.keyColumns)n[t]=s?.[t];return n}}},1198,[1199,863,1196,1095]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"cache",{enumerable:!0,get:function(){return w}});var t=r(d[0]);const n=new Map,s=new Map,c=new Map,o=new Map,u=new Set,l=(t,n)=>`cache:${t}:${n}`;function f(t){let s=n.get(t);return s||(s=new Map,n.set(t,s)),s}function p(n){s.delete(n),c.get(n)?.forEach(t=>t());const u=o.get(n);u&&clearTimeout(u),o.set(n,setTimeout(()=>{o.delete(n),t.kv.set(n,Array.from(f(n).entries()))},250))}const w={async hydrate(n,s){const c=l(n,s);if(u.has(c))return;u.add(c);const o=await t.kv.get(c,[]),w=f(c);let h=0;for(const[t,n]of o)w.has(t)||(w.set(t,n),h++);h&&p(c)},rows(t,n){const c=l(t,n);let o=s.get(c);return o||(o=Array.from(f(c).values()),s.set(c,o)),o},get:(t,n,s)=>f(l(t,n)).get(s),put(t,n,s,c){f(l(t,n)).set(s,c),p(l(t,n))},patch(t,n,s,c){const o=f(l(t,n)),u=o.get(s);u&&(o.set(s,{...u,...c}),p(l(t,n)))},remove(t,n,s){f(l(t,n)).delete(s)&&p(l(t,n))},replace(t,s,c,o=()=>!1){const u=l(t,s),w=f(u),h=new Map(c);w.forEach((t,n)=>{o(n)&&h.set(n,t)}),n.set(u,h),p(u)},subscribe(t,n,s){const o=l(t,n);let u=c.get(o);return u||(u=new Set,c.set(o,u)),u.add(s),()=>{u?.delete(s)}},async clearVenue(o,f){for(const p of f){const f=l(p,o);n.delete(f),s.delete(f),u.delete(f),await t.kv.remove(f),c.get(f)?.forEach(t=>t())}}}},1199,[1196]); +__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.classifyWriteError=function(o){if((0,e.isNetworkError)(o))return'network';const{code:n,status:c,msg:l}=t(o);return s(o)?'refused':/^(08|53|57|58)/.test(n)||['40001','40P01','55P03','23505','23503'].includes(n)||/^PGRST30[0-3]$/.test(n)||/jwt|token.*expired/i.test(l)||401===c||408===c||425===c||429===c||c>=500?'retry':409!==c||n?'refused':'retry'},Object.defineProperty(_e,"retryDelayMs",{enumerable:!0,get:function(){return o}}),_e.describeWrite=function(e){const t='rpc'===e.kind?(e.fn??'change').replace(/_/g,' '):n[e.table]??e.table.replace(/_/g,' ').replace(/s$/,''),s=e.values??{},o=s.guest_name??s.name??s.display_name??s.title??s.reason,c='string'==typeof o&&o.trim()?` for ${o.trim().slice(0,60)}`:'';return'delete'===e.kind?`deleting a ${t}${c}`:`the ${t}${c}`},_e.plainReason=function(e,o){const{code:n,status:c,msg:l}=t(e);if('refused'===o)return s(e)?'more than 20 deletes in 10 minutes from one sign-in are stopped to keep your data safe':'42501'===n||403===c||/row-level security|permission/i.test(l)?'your sign-in isn\u2019t allowed to change this':'conflict'===n?'it was changed or removed on another device first':/^(22|23)/.test(n)?'the shared system says some of the details aren\u2019t valid':'P0001'===n&&l?l.slice(0,140):l?`the shared system said: ${l.slice(0,120)}`:'the shared system refused it';return'23505'===n?'the shared system already has another copy of it':'23503'===n?'a related change has to save first':/^PGRST30/.test(n)||401===c||/jwt/i.test(l)?'your sign-in is being refreshed':'the shared system is busy'};var e=r(d[0]);const t=e=>{const t=e&&'object'==typeof e?e:{};return{msg:String(t.message??e??''),code:String(t.code??''),status:Number(t.status??0)||0,hint:String(t.hint??'')}},s=e=>{const s=t(e);return/delete guard/i.test(s.hint)||/too many .* deleted in 10 minutes/i.test(s.msg)};const o=e=>Math.min(5e3*Math.pow(3,Math.max(0,e-1)),3e5),n={bookings:'booking',walk_ins:'walk-in',blocks:'blocked time',sold_out_items:'sold-out mark',sold_out_links:'dish stock link',staff:'staff details',rota_shifts:'rota shift',stock_items:'stock item',stock_events:'stock count',stock_counts:'stock count',chat_messages:'chat message',recipe_cards:'recipe card',order_lists:'order list',order_list_items:'order list item',daily_task_ticks:'task tick',daily_tasks:'daily task',attendance:'clock in or out',cash_ups:'cash-up',table_plans:'table plan',guest_profiles:'guest profile',floor_live:'table status',venues:'venue settings',time_requests:'time-off request',scheduled_notifications:'reminder',suppliers:'supplier',supplier_orders:'supplier order',takeaway_orders:'takeaway order'}},1200,[1197]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useAvatars",{enumerable:!0,get:function(){return l}});var t,e=r(d[0]),o=(t=e)&&t.__esModule?t:{default:t},s=r(d[1]),n=r(d[2]);const l=(0,s.create)()((0,n.persist)((t,e)=>({photos:{},log:[],setOwn:(e,o,s,n)=>{if(!e||e!==o||!s.startsWith('data:image/'))return!1;const l=(new Date).toISOString();return t(t=>({photos:{...t.photos,[o]:{dataUrl:s,at:l}},log:[{id:`av-${Date.now().toString(36)}`,staffId:o,what:'made',by:n,at:l},...t.log].slice(0,100)})),!0},reset:(o,s)=>{if(s.id!==o&&'staff'===s.role)return!1;if(!e().photos[o])return!1;const n={...e().photos};return delete n[o],t(t=>({photos:n,log:[{id:`av-${Date.now().toString(36)}`,staffId:o,what:'reset',by:s.name,at:(new Date).toISOString()},...t.log].slice(0,100)})),!0}}),{name:'covercharge-avatars-v1',storage:(0,n.createJSONStorage)(()=>o.default),version:1}))},1201,[1116,952,1117]); +__d(function(_g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"SETUP_STEPS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"ACCESS_LEVELS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"ACCESS_ROLE",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"ACCESS_APP",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"accessOf",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"PERMS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"DEFAULT_PERMS",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"DEFAULT_GRADES",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"useSetup",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"useSiteSetup",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"setupProgress",{enumerable:!0,get:function(){return w}});var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},i=r(d[1]),s=r(d[2]);const o=[{id:'venue',title:'Venue details & logo',sub:'Name, address, phone, your logo and order at table'},{id:'hours',title:'Opening hours',sub:'When the kitchen is open each day'},{id:'plan',title:'Areas & table plan',sub:'Your areas, tables and seats'},{id:'paygrades',title:'Pay grades',sub:'Named hourly rates for your team'},{id:'staff',title:'Add staff',sub:'Name, role, access, pay and avatar'},{id:'permissions',title:'Permissions',sub:'What each access level can do'},{id:'email',title:'Link email',sub:'Your work email address'},{id:'website',title:'Link website',sub:'Your website and booking link'},{id:'invites',title:'Staff invite links',sub:'Personal links for each person'}],l=['Owner','Manager','Supervisor','Head Chef','Staff'],u={Owner:'owner',Manager:'manager',Supervisor:'manager','Head Chef':'staff',Staff:'staff'},c={Owner:'Managers',Manager:'Managers',Supervisor:'Managers','Head Chef':'Head Chef',Staff:'Staff'},f=(e,t)=>l.includes(e??'')?e:'owner'===t?'Owner':'manager'===t?'Manager':'Staff',b=[{id:'bookings',label:'Take and change bookings'},{id:'walkins',label:'Seat walk-ins'},{id:'block',label:'Block bookings and close the garden'},{id:'tableplan',label:'Edit the table plan'},{id:'kitchen',label:'Kitchen tickets and allergy ticks'},{id:'menu',label:'Edit the menu and allergens'},{id:'rota',label:'Make the rota'},{id:'timesheets',label:'Approve timesheets'},{id:'pay',label:'See pay and wages'},{id:'takings',label:'See takings and reports'},{id:'staff',label:'Add staff and change access'},{id:'settings',label:'Change venue settings'},{id:'billing',label:'Plan and billing'}],p=e=>Object.fromEntries(b.map(t=>[t.id,e])),g=e=>({...p(!1),...Object.fromEntries(e.map(e=>[e,!0]))}),h={Owner:p(!0),Manager:{...p(!0),staff:!1,billing:!1},Supervisor:g(['bookings','walkins','block','tableplan','kitchen','rota']),'Head Chef':g(['kitchen','menu','rota']),Staff:g(['bookings','walkins'])},S=[{id:'pg-foh',name:'Front of house',pence:1271},{id:'pg-bar',name:'Bar team',pence:1271},{id:'pg-kp',name:'Kitchen porter',pence:1271},{id:'pg-cdp',name:'Chef de partie',pence:1450},{id:'pg-sup',name:'Supervisor',pence:1400}],k=()=>({done:{},grades:S.map(e=>({...e})),staffGrade:{},perms:JSON.parse(JSON.stringify(h)),email:'',website:'',bookingUrl:'',invites:{}}),O=(0,i.create)()((0,s.persist)((e,t)=>({sites:{},looks:{},patch:(t,n)=>e(e=>({sites:{...e.sites,[t]:{...e.sites[t]??k(),...n}}})),markDone:(e,n,i=!0)=>{const s={...(t().sites[e]??k()).done};i?s[n]=(new Date).toISOString():delete s[n],t().patch(e,{done:s})},setPerm:(e,n,i,s)=>{const o=t().sites[e]??k();'Owner'!==n&&t().patch(e,{perms:{...o.perms,[n]:{...o.perms[n],[i]:s}}})},resetPerms:e=>t().patch(e,{perms:JSON.parse(JSON.stringify(h))}),setLook:(t,n)=>e(e=>{const i={...e.looks};return null==n?delete i[t]:i[t]=n,{looks:i}})}),{name:'covercharge-setup-v1',storage:(0,s.createJSONStorage)(()=>n.default),version:1})),P=e=>O(t=>t.sites[e])??y,y=k(),w=e=>{const t=o.filter(t=>e.done[t.id]).length;return{done:t,total:o.length,pct:t/o.length}}},1202,[1116,952,1117]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"SEED_INGREDIENTS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"SEED_RECIPES",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"WASTE_REASONS",{enumerable:!0,get:function(){return f}}),_e.stripKitchenExamples=S,Object.defineProperty(_e,"useKitchen",{enumerable:!0,get:function(){return w}});var e,t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),n=_r(_d[3]),r=_r(_d[4]),o=_r(_d[5]),d=(e=o)&&e.__esModule?e:{default:e},c=_r(_d[6]),l=_r(_d[7]);const p=(e,t,s,i,n,r,o,d=[],c)=>({id:e,name:t,unit:s,cost:i,supplierId:n,par:r,onHand:o,allergens:d,prevCost:c}),u=[p('haddock','Haddock fillet','kg',1848,'sup-1',14,9.5,['fish'],1650),p('smk-haddock','Smoked haddock','kg',1500,'sup-1',4,3.2,['fish']),p('smk-salmon','Smoked salmon','kg',2800,'sup-1',3,1.1,['fish']),p('crab','White and brown crab meat','kg',3800,'sup-1',3,2.4,['crustaceans']),p('mussels','Rope mussels','kg',450,'sup-1',12,0,['molluscs']),p('langoustine','Langoustines','kg',2600,'sup-1',6,4.5,['crustaceans']),p('lobster','Lobster (whole)','each',1800,'sup-1',6,4,['crustaceans']),p('prawns','Prawns (cooked, peeled)','kg',1400,'sup-1',3,2.6,['crustaceans']),p('beef-fillet','Beef fillet','kg',4800,'sup-2',4,2.9),p('steak','Braising steak','kg',1200,'sup-2',8,6.2),p('patty','Burger patty 6 oz','each',160,'sup-2',40,18),p('chicken','Chicken breast','kg',950,'sup-2',10,7.5),p('chorizo','Chorizo','kg',1400,'sup-2',2,1.6,['sulphites']),p('haggis','Haggis','kg',900,'sup-2',4,3.5,['gluten','celery']),p('potatoes','Potatoes (chipping)','kg',90,'sup-3',75,40),p('onions','Onions','kg',110,'sup-3',15,11),p('leaves','Salad leaves','kg',700,'sup-3',3,.8),p('lemons','Lemons','each',25,'sup-3',60,44),p('milk','Whole milk','L',110,'sup-4',20,14,['milk']),p('cream','Double cream','L',380,'sup-4',12,9,['milk']),p('butter','Butter','kg',850,'sup-4',6,4.5,['milk']),p('cheddar','Mature cheddar','kg',900,'sup-4',5,3.8,['milk']),p('parmesan','Parmesan','kg',1800,'sup-4',2,1.4,['milk']),p('eggs','Free-range eggs','each',28,'sup-4',120,90,['eggs']),p('ice-cream','Vanilla ice cream','L',450,'sup-4',10,7,['milk','eggs']),p('flour','Plain flour','kg',90,'sup-5',16,12,['gluten']),p('batter','Beer batter mix','kg',220,'sup-5',12,3.5,['gluten']),p('pastry','Puff pastry','kg',450,'sup-5',6,4.2,['gluten','milk']),p('macaroni','Macaroni','kg',180,'sup-5',6,5,['gluten']),p('penne','Penne','kg',180,'sup-5',6,4.5,['gluten']),p('buns','Brioche buns','each',45,'sup-5',40,30,['gluten','eggs','milk','sesame']),p('baguette','Garlic baguette','each',90,'sup-5',24,16,['gluten','milk']),p('oil','Rapeseed oil (fryer)','L',200,'sup-5',60,32),p('sponge','Sticky toffee sponge (portion)','each',95,'sup-5',30,22,['gluten','eggs','milk']),p('truffle-oil','Truffle oil','L',3e3,'sup-5',1,.6)],k=(e,t,s)=>({dishId:e,yield:t,lines:s.map(([e,t])=>({ing:e,qty:t}))}),h=[k('a-fishsupper','1 portion (220 g fillet)',[['haddock',.22],['batter',.06],['potatoes',.35],['oil',.05],['lemons',1]]),k('a-skink','1 bowl',[['smk-haddock',.08],['potatoes',.1],['milk',.15],['cream',.05],['onions',.03],['butter',.01]]),k('a-salmon','1 plate',[['smk-salmon',.07],['cream',.03],['leaves',.02],['lemons',1]]),k('a-haggis','1 plate',[['haggis',.1],['flour',.02],['eggs',1],['oil',.03]]),k('a-crabcakes','2 cakes',[['crab',.08],['potatoes',.06],['flour',.02],['eggs',1],['leaves',.02]]),k('a-tempura','1 plate',[['haddock',.07],['prawns',.05],['onions',.05],['batter',.06],['oil',.04],['lemons',1]]),k('a-mini','Kids fish & chips + ice cream',[['haddock',.1],['potatoes',.2],['batter',.03],['oil',.03],['ice-cream',.05]]),k('a-pie','1 pie',[['steak',.22],['pastry',.08],['onions',.05],['potatoes',.3],['oil',.03]]),k('a-chicken','1 plate',[['chicken',.22],['potatoes',.25],['cream',.05],['butter',.02]]),k('a-maccheese','1 bowl',[['macaroni',.12],['cheddar',.08],['milk',.2],['butter',.02],['flour',.015]]),k('a-penne','1 bowl',[['penne',.12],['chicken',.15],['chorizo',.04],['cream',.08],['parmesan',.01]]),k('a-caesar','1 plate',[['chicken',.16],['leaves',.08],['parmesan',.015],['eggs',1],['baguette',.25]]),k('a-moules','1 pot',[['mussels',.5],['cream',.08],['onions',.03],['baguette',.5]]),k('a-fillet','8 oz steak',[['beef-fillet',.227],['potatoes',.35],['onions',.05],['oil',.05],['butter',.02]]),k('a-claymore','1 burger',[['patty',1],['buns',1],['cheddar',.03],['potatoes',.3],['onions',.06],['batter',.03],['oil',.05]]),k('a-langoustines','1 plate',[['langoustine',.35],['butter',.03],['baguette',.5],['leaves',.03],['lemons',1]]),k('a-lobster','1 lobster',[['lobster',1],['butter',.04],['potatoes',.3],['oil',.04],['leaves',.03],['lemons',1]]),k('a-smorgasbord','Serves one',[['langoustine',.3],['mussels',.3],['crab',.08],['prawns',.1],['smk-salmon',.06],['leaves',.05],['lemons',2]]),k('a-deluxe','Serves two',[['lobster',1],['langoustine',.5],['crab',.15],['mussels',.5],['prawns',.15],['smk-salmon',.1],['leaves',.1],['lemons',3],['baguette',1]]),k('a-chips','1 side',[['potatoes',.35],['oil',.05]]),k('a-onionrings','1 side',[['onions',.15],['batter',.06],['oil',.04]]),k('a-garlicbread','1 side',[['baguette',.5],['butter',.02]]),k('a-truffle','1 side',[['potatoes',.35],['oil',.05],['parmesan',.015],['truffle-oil',.005]]),k('a-salad','1 side',[['leaves',.06],['lemons',.5]]),k('a-stp','1 portion',[['sponge',1],['cream',.05],['butter',.02],['ice-cream',.08]])],f=['Out of date','Spoiled','Over-production','Dropped / burnt','Returned by customer','Prep trim'],b=(e,t=10)=>{const s=new Date;return s.setDate(s.getDate()-e),s.setHours(t,0,0,0),s.toISOString()},y=e=>`${e}-${Math.random().toString(36).slice(2,8)}`;function v(){return{ingredients:u.map(e=>({...e})),recipes:h,targetGp:70,deliveries:[{id:'dl-today-fish',supplierId:'sup-1',due:'today',status:'expected',lines:[{ing:'haddock',ordered:10,received:8,price:1848},{ing:'mussels',ordered:12,received:12,price:450},{ing:'langoustine',ordered:3,received:3,price:2750},{ing:'smk-salmon',ordered:2,received:2,price:2800}]},{id:'dl-today-veg',supplierId:'sup-3',due:'today',status:'expected',lines:[{ing:'potatoes',ordered:50,received:50,price:90},{ing:'leaves',ordered:3,received:2,price:700},{ing:'lemons',ordered:30,received:30,price:25}]}],stockTakes:[{id:'stk-1',at:b(7,22),by:'Head Chef (example)',lines:[{ing:'haddock',expected:6,counted:5.4,cost:1650},{ing:'potatoes',expected:30,counted:28,cost:90},{ing:'cream',expected:8,counted:8,cost:380},{ing:'beef-fillet',expected:3.2,counted:3,cost:4800}]}],waste:[{id:'w1',at:b(1,21),by:'Head Chef (example)',item:'Haddock fillet',ing:'haddock',qty:.6,unit:'kg',reason:'Over-production',cost:1109},{id:'w2',at:b(2,15),by:'Head Chef (example)',item:'Salad leaves',ing:'leaves',qty:.5,unit:'kg',reason:'Spoiled',cost:350},{id:'w3',at:b(3,20),by:'Head Chef (example)',item:'Fish supper',qty:1,unit:'portion',reason:'Dropped / burnt',cost:517},{id:'w4',at:b(4,11),by:'Head Chef (example)',item:'Double cream',ing:'cream',qty:1,unit:'L',reason:'Out of date',cost:380},{id:'w5',at:b(5,22),by:'Head Chef (example)',item:'Chips',ing:'potatoes',qty:3,unit:'kg',reason:'Over-production',cost:270}],orders:[{id:'po-1',supplierId:'sup-1',at:b(1,13),by:'Head Chef (example)',status:'placed (by phone)',lines:[{ing:'haddock',qty:10,cost:1848},{ing:'mussels',qty:12,cost:450},{ing:'langoustine',qty:3,cost:2600},{ing:'smk-salmon',qty:2,cost:2800}],total:30520},{id:'po-2',supplierId:'sup-3',at:b(1,18),by:'Head Chef (example)',status:'placed (on website)',lines:[{ing:'potatoes',qty:50,cost:90},{ing:'leaves',qty:3,cost:700},{ing:'lemons',qty:30,cost:25}],total:7350}],prepTicks:{},temps:[{id:'t1',at:b(0,9),by:'Head Chef (example)',kind:'fridge',unit:'Walk-in fridge',temp:3},{id:'t2',at:b(0,9),by:'Head Chef (example)',kind:'freezer',unit:'Chest freezer',temp:-20}]}}function S(e){const t=v(),s=(e,t)=>t.some(t=>JSON.stringify(t)===JSON.stringify(e)),i=e.recipes.filter(e=>!s(e,t.recipes)),r=e.deliveries.filter(e=>!t.deliveries.some(t=>t.id===e.id&&t.supplierId===e.supplierId&&t.due===e.due&&'expected'===e.status&&!e.checkedBy&&!e.note&&JSON.stringify(t.lines)===JSON.stringify(e.lines))),o=e.stockTakes.filter(e=>!(0,n.demoActor)(e.by)),d=e.waste.filter(e=>!(0,n.demoActor)(e.by)),c=e.orders.filter(e=>!(0,n.demoActor)(e.by)),l=e.temps.filter(e=>!(0,n.demoActor)(e.by)),p=new Set([...i,...r,...o,...c].flatMap(e=>e.lines.map(e=>e.ing)));return d.forEach(e=>{e.ing&&p.add(e.ing)}),{ingredients:e.ingredients.filter(e=>p.has(e.id)||!s(e,t.ingredients)),recipes:i,deliveries:r,stockTakes:o,waste:d,orders:c,temps:l}}const w=(0,c.create)()((0,l.persist)(e=>({...r.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD?{targetGp:70,ingredients:[],recipes:[],deliveries:[],stockTakes:[],waste:[],orders:[],prepTicks:{},temps:[]}:v(),setTarget:t=>e({targetGp:Math.max(40,Math.min(90,Math.round(t)))}),setIngredient:(t,s)=>e(e=>({ingredients:e.ingredients.map(e=>e.id===t?{...e,...s}:e)})),setRecipeQty:(t,s,i)=>e(e=>({recipes:e.recipes.map(e=>e.dishId!==t?e:{...e,lines:i>0?e.lines.some(e=>e.ing===s)?e.lines.map(e=>e.ing===s?{...e,qty:i}:e):[...e.lines,{ing:s,qty:i}]:e.lines.filter(e=>e.ing!==s)})})),acceptDelivery:(t,i,n,o)=>e(e=>({deliveries:e.deliveries.map(e=>e.id===t?{...e,lines:i,status:'accepted',checkedBy:n,at:(new Date).toISOString(),note:o}:e),ingredients:e.ingredients.map(e=>{const t=i.find(t=>t.ing===e.id);return t?{...e,onHand:(0,s.fishInStone)(r.VENUE_RID,e)?e.onHand+t.received:Math.round(100*(e.onHand+t.received))/100,...t.price!==e.cost?{prevCost:e.cost,cost:t.price}:{}}:e})})),saveStockTake:(t,s)=>e(e=>({stockTakes:[{id:y('stk'),at:(new Date).toISOString(),by:s,lines:Object.entries(t).map(([t,s])=>{const i=e.ingredients.find(e=>e.id===t);return{ing:t,expected:i.onHand,counted:s,cost:i.cost}})},...e.stockTakes],ingredients:e.ingredients.map(e=>e.id in t?{...e,onHand:t[e.id]}:e)})),addWaste:t=>e(e=>({waste:[{...t,id:y('w'),at:(new Date).toISOString()},...e.waste],ingredients:t.ing?e.ingredients.map(e=>e.id===t.ing?{...e,onHand:Math.max(0,(0,s.fishInStone)(r.VENUE_RID,e)?e.onHand-t.qty:Math.round(100*(e.onHand-t.qty))/100)}:e):e.ingredients})),addOrder:t=>{const s=y('po');return e(e=>({orders:[{...t,id:s,at:(new Date).toISOString()},...e.orders]})),s},setOrderStatus:(t,s)=>e(e=>({orders:e.orders.map(e=>e.id===t?{...e,status:s}:e)})),tickPrep:(t,s)=>e(e=>{const i={...e.prepTicks};return s?i[t]={by:s,at:(new Date).toISOString()}:delete i[t],{prepTicks:i}}),addTemp:t=>e(e=>({temps:[{...t,id:y('t'),at:(new Date).toISOString()},...e.temps]})),reset:()=>e(r.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD?{targetGp:70,ingredients:[],recipes:[],deliveries:[],stockTakes:[],waste:[],orders:[],prepTicks:{},temps:[]}:v())}),{name:'covercharge-kitchen-v1',version:3,storage:(0,l.createJSONStorage)(()=>d.default),migrate:async e=>{const s=e;return t.LIVE_VENUE_BUILD?(await(0,i.archiveChefCache)('kitchen',s),{...s,...S(s)}):s}}))},1203,[833,1025,1132,1024,5,1116,952,1117]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"GREENSIDE_PALETTE",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"GREENSIDE_DISPLAY",{enumerable:!0,get:function(){return o}});const t={bg:'#1A1A1A',surface:'#222222',surface2:'#292929',border:'#62675E',gold:'#7DB754',goldLight:'#AED28E',goldTint:'#25321E',goldMuted:'#A1C783',tile:'#222222',tilePressed:'#2D3428',accentBg:'rgba(125,183,84,0.13)',accentBorder:'rgba(125,183,84,0.55)',onGold:'#1A1A1A',ok:'#AED28E',okBg:'#25321E',blue:'#AED28E',blueBg:'#25321E'},o={quietBorder:'rgba(125,183,84,0.55)',quietPressed:'rgba(125,183,84,0.16)',primaryPressed:'#6D9F49'}},1204,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.fixSupplierNames=function(n){return n?s.reduce((s,[n,b])=>s.replace(n,b),n):n};const s=[[/\bAl{2}sons?'?s?\b|\bAlson's\b/g,'Alsons'],[/\bSpe[zs] ?[Bb]ona\b|\bSpezbona\b/g,'Spes Bona']]},1205,[]); +__d(function(g,r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DEFAULT_ORDER_LIST_SETTINGS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"UNITS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"DAY_FULL",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"normName",{enumerable:!0,get:function(){return a}}),e.findDuplicate=function(t,n,i,s){return t.find(t=>t.listId===n&&!t.removed&&'open'===t.status&&a(t.name)===a(i)&&u(t.unit)===u(s))},e.bumpQty=function(t,n,i,a,u){return{...t,qty:Math.round(100*(t.qty+n))/100,bumps:[...t.bumps??[],{by:i,name:a,qty:n,at:u}],updatedAt:u}},Object.defineProperty(e,"qtyText",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"validQty",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"liveItems",{enumerable:!0,get:function(){return d}}),e.finishOrder=function(t,n,i,a,u,s){const o=d(n,t.id),l=o.filter(t=>'got'!==t.status),c={id:s(),listId:t.id,listName:t.name,finishedAt:u,finishedBy:a.id,finishedByName:a.name,items:o.map(t=>({name:t.name,qty:t.qty,unit:t.unit,note:t.note,status:t.status,addedByName:t.addedByName})),carried:i?l.length:0},p=i?l.map(t=>({...t,status:'open',carried:'missing'===t.status?'missing':'not-got',statusBy:void 0,statusAt:void 0,updatedAt:u})):[],m=new Set(p.map(t=>t.id));return{round:c,drop:o.filter(t=>!m.has(t.id)).map(t=>t.id),carriedOver:p}},e.nextTripDate=p,e.tripText=function(t,n,a){const u=p(t,n,a);if(!u)return'Running list';const[,s,o]=u.split('-').map(Number);return"Next trip "+(u===n?'today':u===l(n,1)?'tomorrow':`${i[c(u)]} ${o} ${['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'][s-1]}`)},e.initials=function(t){const n=t.replace(/\(.*?\)/g,' ').split(/[^A-Za-z0-9]+/).filter(t=>t&&!['and','the','of','&'].includes(t.toLowerCase()));return n.length?(1===n.length?n[0].slice(0,2):n[0][0]+n[1][0]).toUpperCase():'?'},e.telHref=function(t){if(!t)return null;const n=t.trim().replace(/[^\d+]/g,'').replace(/(?!^)\+/g,'');return n.replace(/\D/g,'').length>=6?`tel:${n}`:null};const t={allowStaff:!0,defaultTripDay:5},n=['','cases','bottles','kegs','boxes','bags','packs','kg','litres','each'],i=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],a=t=>t.trim().toLowerCase().replace(/[\u2019']/g,"'").replace(/\s+/g,' ').replace(/s$/,''),u=t=>t.trim().toLowerCase().replace(/s$/,'');const s=t=>`${Number.isInteger(t.qty)?t.qty:t.qty.toFixed(2).replace(/0$/,'')}${t.unit?` ${t.unit}`:''}`,o=t=>Number.isFinite(t)&&t>0&&t<=9999,d=(t,n)=>t.filter(t=>t.listId===n&&!t.removed).sort((t,n)=>('open'===t.status?0:1)-('open'===n.status?0:1)||t.addedAt.localeCompare(n.addedAt));const l=(t,n)=>{const[i,a,u]=t.split('-').map(Number);return new Date(Date.UTC(i,a-1,u+n)).toISOString().slice(0,10)},c=t=>{const[n,i,a]=t.split('-').map(Number);return new Date(Date.UTC(n,i-1,a)).getUTCDay()};function p(n,i,a=t.defaultTripDay){if('trip'!==n.kind)return null;if(n.nextTrip&&n.nextTrip>=i)return n.nextTrip;const u=n.tripDay??a;return l(i,(u-c(i)+7)%7)}},1206,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useClockArea",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"areaOf",{enumerable:!0,get:function(){return _}});var e,t=r(d[0]),n=r(d[1]),s=r(d[2]),u=(e=s)&&e.__esModule?e:{default:e},c=r(d[3]),l=r(d[4]),E=r(d[5]);const o=(0,c.create)()((0,l.persist)(e=>({areas:(0,n.privateClockVenue)(t.VENUE_RID)?{[t.VENUE_RID]:(0,n.venueClockArea)(t.VENUE_RID)}:{},visiting:{},set:(s,u,c)=>e(e=>t.IS_ISOLATED_VENUE&&s!==t.VENUE_RID?e:{areas:{...e.areas,[s]:{...(0,n.venueClockArea)(s,{...e.areas[s]??{},...u}),updatedAt:(new Date).toISOString(),updatedBy:c}}}),reset:(s,u)=>e(e=>t.IS_ISOLATED_VENUE&&s!==t.VENUE_RID?e:{areas:{...e.areas,[s]:{...(0,n.venueClockArea)(s,{lat:e.areas[s]?.lat??null,lng:e.areas[s]?.lng??null}),updatedAt:(new Date).toISOString(),updatedBy:u}}}),setVisiting:t=>e(e=>({visiting:Object.fromEntries([...Object.entries(e.visiting).slice(-60),[t,!0]])}))}),{name:'covercharge-clock-area-v1',version:1,storage:(0,l.createJSONStorage)(()=>u.default)})),_=e=>t.IS_ISOLATED_VENUE&&e!==t.VENUE_RID?(0,E.cleanArea)(E.DEFAULT_CLOCK_AREA):(0,n.venueClockArea)(e,o.getState().areas[e]??{})},1207,[5,988,1116,952,1117,954]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.inviteStatus=function(){return{'st-tracy':{state:'used',usedAt:s(3e3),devices:2},'st-gordon':{state:'used',usedAt:s(2940),devices:2},'st-bisto':{state:'used',usedAt:s(1800),devices:1},'st-agate':{state:'used',usedAt:s(1680),devices:1},'st-lenny':{state:'used',usedAt:s(1560),devices:1},'st-finn':{state:'unused',expiresAt:a(52),devices:0},'st-eilidh':{state:'used',usedAt:s(1200),devices:1},'st-emily':{state:'expired',devices:0},'st-lillie':{state:'used',usedAt:s(480),devices:1},'st-jack':{state:'unused',expiresAt:a(70),devices:0}}},e.reissueInvite=async function(t){const s='st-bisto'===t?'chef':['st-tracy','st-gordon','st-agate'].includes(t)?'owner':'staff';return{ok:!0,token:'DEMO-link-not-real-0000',expiresAt:a(72),app:s}},e.unlockCashUp=async function(s,a,n){const c=new Date(Date.now()+18e5).toISOString();'cashup'===s?t.useCashUp.setState(t=>({cashUps:t.cashUps.map(t=>t.id===a?{...t,unlockedUntil:c}:t)})):t.useCashUp.setState(t=>({sales:t.sales.map(t=>t.id===a?{...t,unlockedUntil:c}:t)}));return{ok:!0,until:c}},e.cashAudit=async function(t){return[{at:s(780),action:'unlocked',by:'Morgan',tbl:'cash_ups',reason:'Card total keyed as 1,284 not 1,248',changed:[]},{at:s(768),action:'changed',by:'Alex',tbl:'cash_ups',changed:['card']},{at:s(840),action:'created',by:'Alex',tbl:'cash_ups',changed:[]}]},e.pitchRpc=function(t,s){switch(t){case'list_displays':return n;case'create_display_code':case'new_code_for_display':return[{code:'DEMO7K2QX',expires_at:a(24*Number(s.p_hours?Number(s.p_hours)/24:7))}];default:return[]}};var t=r(d[0]);const s=t=>new Date(Date.now()-6e4*t).toISOString(),a=t=>new Date(Date.now()+36e5*t).toISOString();const n=[{id:'pd-1',label:'Front desk tablet',can_write:!0,created_at:s(17280),last_seen_at:s(2),revoked_at:null,sessions:1,open_codes:0},{id:'pd-2',label:'Kitchen pass tablet',can_write:!1,created_at:s(12960),last_seen_at:s(5),revoked_at:null,sessions:1,open_codes:0}]},1208,[1093]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useChatSync",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"chatSynced",{enumerable:!0,get:function(){return n}});const t=(0,r(d[0]).create)(()=>({synced:!1,checked:!1})),n=()=>t.getState().synced},1209,[952]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1210,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var u in n)Object.defineProperty(t,u,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,u).get})})(e,{get Badge(){return x.Badge},get DarkTheme(){return y.DarkTheme},get DefaultTheme(){return _.DefaultTheme},get ErrorBoundary(){return v.ErrorBoundary},get ExperimentalStack(){return U.ExperimentalStack},get ExpoRoot(){return c.ExpoRoot},get Icon(){return x.Icon},get IsWithinNativeNavigator(){return B.IsWithinNativeNavigator},get Label(){return x.Label},get LocaleProvider(){return I.LocaleProvider},get NativeStackView(){return E.NativeStackView},get NavigationAwareActivity(){return R.NavigationAwareActivity},get Navigator(){return t.Navigator},get RouterActionHandling(){return C.RouterActionHandling},get Sitemap(){return b.Sitemap},get Slot(){return t.Slot},get SplashScreen(){return S},get StackRouter(){return C.StackRouter},get SuspenseFallback(){return f.SuspenseFallback},get TabRouter(){return C.TabRouter},get Tabs(){return M.Tabs},get ThemeProvider(){return T.ThemeProvider},get Unmatched(){return l.Unmatched},get VectorIcon(){return x.VectorIcon},get attachRouteState(){return C.attachRouteState},get createBaseStackProps(){return j.createBaseStackProps},get createBaseTabProps(){return D.createBaseTabProps},get createNativeStackProps(){return W.createNativeStackProps},get createStandardRouterNavigator(){return B.createStandardRouterNavigator},get enableLegacyHeaderAppearance(){return F.enableLegacyHeaderAppearance},get extendRouter(){return C.extendRouter},get extendRouterActions(){return C.extendRouterActions},get integrateWithRouter(){return B.integrateWithRouter},get isActionHandled(){return C.isActionHandled},get router(){return u.router},get unstable_PerformanceObserver(){return G.unstable_PerformanceObserver},get unstable_createStandardRouterNavigator(){return B.unstable_createStandardRouterNavigator},get unstable_enablePerformanceIntegration(){return G.unstable_enablePerformanceIntegration},get unstable_integrateWithRouter(){return B.unstable_integrateWithRouter},get unstable_performance(){return G.unstable_performance},get unstable_useIsNavigating(){return o.useIsNavigating},get unstable_useReconcileTabHistory(){return H.useReconcileTabHistory},get useCanGoBack(){return n.useCanGoBack},get useCurrentRouteInfo(){return n.useCurrentRouteInfo},get useFocusEffect(){return h.useFocusEffect},get useGlobalSearchParams(){return n.useGlobalSearchParams},get useIsFocused(){return N.useIsFocused},get useLoaderData(){return n.useLoaderData},get useLocalSearchParams(){return n.useLocalSearchParams},get useNavigation(){return P.useNavigation},get useNavigationContainerRef(){return n.useNavigationContainerRef},get usePathname(){return n.usePathname},get usePreventRemove(){return L.usePreventRemove},get useRootNavigation(){return n.useRootNavigation},get useRootNavigationState(){return n.useRootNavigationState},get useRoute(){return A.useRoute},get useRoutePath(){return O.useRoutePath},get useRouter(){return n.useRouter},get useScrollToTop(){return w.useScrollToTop},get useSegments(){return n.useSegments},get useSitemap(){return p.useSitemap},get useTheme(){return k.useTheme},get useUnstableGlobalHref(){return n.useUnstableGlobalHref},get withLayoutContext(){return s.withLayoutContext}});const t=r(d[0]),n=r(d[1]),u=r(d[2]),o=r(d[3]),s=r(d[4]),c=r(d[5]),l=r(d[6]),b=r(d[7]),p=r(d[8]),v=r(d[9]),f=r(d[10]),R=r(d[11]),S=q(r(d[12])),P=r(d[13]),h=r(d[14]),N=r(d[15]),y=r(d[16]),_=r(d[17]),T=r(d[18]),k=r(d[19]),I=r(d[20]),O=r(d[21]),w=r(d[22]),A=r(d[23]),L=r(d[24]),x=r(d[25]),B=r(d[26]),H=r(d[27]),j=r(d[28]),D=r(d[29]),W=r(d[30]),C=r(d[31]),E=r(d[32]),F=r(d[33]),G=r(d[34]),M=r(d[35]),U=r(d[36]);function V(t){if("function"!=typeof WeakMap)return null;var n=new WeakMap,u=new WeakMap;return(V=function(t){return t?u:n})(t)}function q(t,n){if(!n&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var u=V(n);if(u&&u.has(t))return u.get(t);var o={__proto__:null},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var c in t)if("default"!==c&&Object.prototype.hasOwnProperty.call(t,c)){var l=s?Object.getOwnPropertyDescriptor(t,c):null;l&&(l.get||l.set)?Object.defineProperty(o,c,l):o[c]=t[c]}return o.default=t,u&&u.set(t,o),o}},1211,[694,419,512,1212,712,32,766,757,760,1213,664,662,667,533,537,542,481,483,447,448,1214,488,489,478,476,524,711,657,725,1215,724,358,703,708,378,1216,1219]); +__d(function(g,r,i,a,m,e,d){"use strict";function n(){const t=r(d[0]);return n=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"useIsNavigating",{enumerable:!0,get:function(){return u}});const t=r(d[1]);function u(){return(0,n().use)(t.NavigationPendingContext)}},1212,[30,375]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const o=r(d[0]);return t=function(){return o},o}function o(){const t=r(d[1]);return o=function(){return t},t}function n(){const t=r(d[2]);return n=function(){return t},t}function l(){const t=r(d[3]);return l=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"ErrorBoundary",{enumerable:!0,get:function(){return f}});r(d[4]);const s=r(d[5]),c=r(d[6]),u=r(d[7]);function h({error:o}){return(0,t().jsxs)(n().View,{style:{marginBottom:12,gap:4,flexWrap:'wrap'},children:[(0,t().jsx)(n().Text,{role:"heading","aria-level":1,style:y.title,children:"Something went wrong"}),(0,t().jsxs)(n().Text,{testID:"router_error_message",role:"heading","aria-level":2,style:y.errorMessage,children:["Error: ",o.message]})]})}function f({error:f,retry:x}){const w=(0,o().use)(s.BottomTabBarHeightContext)?n().View:l().SafeAreaView,S=f instanceof c.ReactServerError;return(0,t().jsx)(n().View,{style:y.container,children:(0,t().jsxs)(w,{style:{flex:1,gap:8,maxWidth:720,marginHorizontal:'auto'},children:[S?(0,t().jsx)(b,{error:f}):(0,t().jsx)(h,{error:f}),(0,t().jsx)(n().View,{style:{flex:1}}),!1,(0,t().jsx)(u.Pressable,{testID:"router_error_retry",onPress:x,children:({hovered:o,pressed:l})=>(0,t().jsx)(n().View,{style:[y.buttonInner,(o||l)&&{backgroundColor:'white'}],children:(0,t().jsx)(n().Text,{style:[y.buttonText,{color:o||l?'black':'white'}],children:"Retry"})})})]})})}const x={404:'NOT_FOUND',500:'INTERNAL_SERVER_ERROR',503:'SERVICE_UNAVAILABLE',504:'GATEWAY_TIMEOUT'};function b({error:o}){let l=String(o.statusCode);l+=': '+(x[o.statusCode]??'Server Error');const s=o.headers.get('cf-ray'),c=o.headers.get('Date');return(0,t().jsxs)(n().View,{style:{padding:12,gap:8},children:[(0,t().jsx)(n().Text,{selectable:!0,allowFontScaling:!0,style:{fontSize:n().Platform.select({web:24,default:16}),fontWeight:'bold',marginBottom:4,color:'white'},children:l}),(0,t().jsx)(n().ScrollView,{style:{borderColor:'rgba(255,255,255,0.5)',borderTopWidth:n().StyleSheet.hairlineWidth,borderBottomWidth:n().StyleSheet.hairlineWidth,maxHeight:150},contentContainerStyle:{paddingVertical:4},children:(0,t().jsx)(n().Text,{testID:"router_error_message",selectable:!0,allowFontScaling:!0,style:{color:'white'},children:o.message})}),(0,t().jsx)(w,{title:"Code",right:o.statusCode}),s&&(0,t().jsx)(w,{title:"ID",right:s}),c&&(0,t().jsx)(w,{title:"Date",right:c}),o.url&&(0,t().jsx)(n().Text,{selectable:!0,allowFontScaling:!0,style:{fontSize:14,opacity:.5,color:'white'},children:o.url})]})}function w({title:o,right:l}){const s={fontSize:16,color:'white'};return(0,t().jsxs)(n().View,{style:{flexDirection:'row',justifyContent:'space-between'},children:[(0,t().jsx)(n().Text,{selectable:!0,allowFontScaling:!0,style:s,children:o}),l&&(0,t().jsx)(n().Text,{selectable:!0,allowFontScaling:!0,style:[s,y.code],children:l})]})}const y=n().StyleSheet.create({container:{flex:1,backgroundColor:'black',padding:24,alignItems:'stretch',justifyContent:'center'},title:{color:'white',fontSize:n().Platform.select({web:32,default:24}),fontWeight:'bold'},buttonText:{fontSize:18,fontWeight:'bold',color:'black',...n().Platform.select({web:{transitionDuration:'100ms'}})},buttonInner:{...n().Platform.select({web:{transitionDuration:'100ms'}}),paddingVertical:12,paddingHorizontal:24,borderColor:'white',borderWidth:2,marginLeft:8,justifyContent:'center',alignItems:'center'},code:{fontFamily:n().Platform.select({default:'Courier',ios:'Courier New',android:'monospace'}),fontWeight:'500'},errorMessage:{color:'white',fontSize:16},subtitle:{color:'white',fontSize:14,marginBottom:12},link:{color:'rgba(255,255,255,0.4)',textDecorationStyle:'solid',textDecorationLine:'underline',fontSize:14,textAlign:'center'}})},1213,[24,30,33,289,508,545,666,759]); +__d(function(g,r,i,a,m,e,d){"use strict";function n(){const t=r(d[0]);return n=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"LocaleProvider",{enumerable:!0,get:function(){return o}});const t=r(d[1]);function o({direction:o,children:c}){return(0,n().jsx)(t.LocaleDirContext.Provider,{value:o,children:c})}},1214,[24,429]); +__d(function(g,r,i,a,m,e,d){"use strict";function t({dispatch:t,isPreloaded:o,isRemovalPrevented:n,state:s}){return{isPreloaded:o,isRemovalPrevented:n,routeNames:s.routeNames,preload:o=>t({type:'PRELOAD',payload:{name:o}})}}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"createBaseTabProps",{enumerable:!0,get:function(){return t}})},1215,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),(function(t,o){for(var n in o)Object.defineProperty(t,n,{enumerable:!0,get:Object.getOwnPropertyDescriptor(o,n).get})})(e,{get BottomTabBar(){return n.BottomTabBar},get BottomTabBarHeightCallbackContext(){return n.BottomTabBarHeightCallbackContext},get BottomTabBarHeightContext(){return n.BottomTabBarHeightContext},get BottomTabView(){return n.BottomTabView},get SceneStyleInterpolators(){return u},get Tabs(){return n.default},get TransitionPresets(){return c},get TransitionSpecs(){return f},get createJSTabsProps(){return n.createJSTabsProps},get createStandardBottomTabNavigator(){return n.createStandardBottomTabNavigator},get default(){return s},get useBottomTabBarHeight(){return n.useBottomTabBarHeight}});const t=r(d[0]),o=r(d[1]),n=b(r(d[2])),u=b(r(d[3])),c=b(r(d[4])),f=b(r(d[5]));function l(t){if("function"!=typeof WeakMap)return null;var o=new WeakMap,n=new WeakMap;return(l=function(t){return t?n:o})(t)}function b(t,o){if(!o&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var n=l(o);if(n&&n.has(t))return n.get(t);var u={__proto__:null},c=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var f in t)if("default"!==f&&Object.prototype.hasOwnProperty.call(t,f)){var b=c?Object.getOwnPropertyDescriptor(t,f):null;b&&(b.get||b.set)?Object.defineProperty(u,f,b):u[f]=t[f]}return u.default=t,n&&n.set(t,u),u}n.default.Screen=o.Screen,n.default.Protected=t.Protected;const s=n.default},1216,[718,719,1217,546,547,548]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}function n(){const t=r(d[1]);return n=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get createJSTabsProps(){return h},get default(){return y}});const o=r(d[2]),s=r(d[3]),c=r(d[4]),u=r(d[5]),p=r(d[6]),f=r(d[7]);var l,b;function h(t){const{dispatch:n,state:o}=t;return{...(0,f.createBaseTabProps)(t),popNestedStackToTop:t=>{const s=o.routes.find(n=>n.key===t)?.state;s?.key&&n({...c.StackActions.popToTop(),target:s.key})}}}l=r(d[8]),b=e,Object.keys(l).forEach(function(t){"default"===t||Object.prototype.hasOwnProperty.call(b,t)||Object.defineProperty(b,t,{enumerable:!0,get:function(){return l[t]}})});const y=(0,u.integrateWithRouter)(s.createStandardBottomTabNavigator,c.TabRouter,{activityDefaultThreshold:1,processDescriptors:p.appendMissingPlaceholderTabDescriptors,processState:p.appendMissingPlaceholderTabRoutes,createProps:h,processScreens:s=>s.map(s=>{if('function'!=typeof s.options&&void 0!==s.options?.href){const{href:c,...u}=s.options;if(u.tabBarButton)throw new Error('Cannot use `href` and `tabBarButton` together.');return null===c?{...s,options:{...u,hidden:!0}}:{...s,options:{...u,tabBarButton:s=>{const u='web'===n().Platform.OS?s.children:(0,t().jsx)(n().Pressable,{children:s.children});return(0,t().jsx)(o.Link,{...s,style:[{display:'flex'},s.style],href:c,asChild:'web'!==n().Platform.OS,children:u})}}}}return s})})},1217,[24,33,508,652,427,711,1218,1215,545]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(t,n,o){const s=n.routeNames.filter(t=>!n.routes.some(n=>n.name===t));if(0===s.length)return t;const u=s.reduce((t,n)=>(t[n]=o({key:void 0,name:n}),t),{});return{...t,...u}}function n(t,n){if(!t.routeNames.some(n=>!t.routes.some(t=>t.name===n)))return t;const s=t.routes[t.index]?.key,u=t.routeNames.map(s=>{const u=t.routes.find(t=>t.name===s);return u||o(s,n)}),c=Math.max(0,u.findIndex(t=>t.key===s));return{...t,index:c,routes:u}}function o(t,n){const o=n[t];if(!o)throw new Error(`Could not find a descriptor for route "${t}". This is most likely a bug in expo-router. Please report it at https://github.com/expo/expo/issues.`);return{...o.route,key:t,name:t}}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get appendMissingPlaceholderTabDescriptors(){return t},get appendMissingPlaceholderTabRoutes(){return n}})},1218,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var u in n)Object.defineProperty(t,u,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,u).get})})(e,{get ExperimentalStack(){return c},get default(){return o}});const n=u(r(d[1]));function u(t){return t&&t.__esModule?t:{default:t}}const c=Object.assign(u=>(0,t().jsx)(n.default,{...u}),{Screen:n.default.Screen,Protected:n.default.Protected}),o=c},1219,[24,1220]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),(function(t,u){for(var n in u)Object.defineProperty(t,n,{enumerable:!0,get:Object.getOwnPropertyDescriptor(u,n).get})})(e,{get Stack(){return t.default},get default(){return l}});const t=c(r(d[0])),u=r(d[1]),n=r(d[2]);function c(t){return t&&t.__esModule?t:{default:t}}t.default.Screen=u.StackScreen,t.default.Header=u.StackHeader,t.default.Title=u.StackTitle,t.default.Toolbar=n.StackToolbar;const l=t.default},1220,[695,728,733]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t.default}});const t=o((n=r(d[0]),u=e,Object.keys(n).forEach(function(t){"default"===t||Object.prototype.hasOwnProperty.call(u,t)||Object.defineProperty(u,t,{enumerable:!0,get:function(){return n[t]}})}),n));var n,u;function o(t){return t&&t.__esModule?t:{default:t}}},1221,[1220]); +__d(function(g,r,i,a,m,e,d){"use strict";var t,n;Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get useIsPreview(){return s.useIsPreview},get usePreventZoomTransitionDismissal(){return o.usePreventZoomTransitionDismissal}}),t=r(d[0]),n=e,Object.keys(t).forEach(function(o){"default"===o||Object.prototype.hasOwnProperty.call(n,o)||Object.defineProperty(n,o,{enumerable:!0,get:function(){return t[o]}})});const o=r(d[1]),s=r(d[2])},1222,[508,1223,421]); +__d(function(g,r,i,a,m,e,d){"use strict";function n(n){}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"usePreventZoomTransitionDismissal",{enumerable:!0,get:function(){return n}})},1223,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"Color",{enumerable:!0,get:function(){return y}});r(d[0]);function t(t,n){return Object.keys(t).forEach(function(u){"default"===u||Object.prototype.hasOwnProperty.call(n,u)||Object.defineProperty(n,u,{enumerable:!0,get:function(){return t[u]}})}),t}t(r(d[1]),e),t(r(d[2]),e),t(r(d[3]),e),t(r(d[4]),e),t(r(d[5]),e);const n=new Proxy({},{get:(t,n)=>null}),u=new Proxy({},{get:(t,n)=>null}),o=new Proxy({},{get:(t,n)=>null}),l=new Proxy({},{get:(t,n)=>null}),c=new Proxy({get attr(){return u},get material(){return o},get dynamic(){return l}},{get:(t,n)=>n in t?t[n]:null}),y={get ios(){return n},get android(){return c}}},1224,[1225,1226,1227,1228,1229,1230]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(t){return null}function n(t){return null}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get Material3Color(){return n},get Material3DynamicColor(){return t}})},1225,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1226,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1227,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1228,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1229,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1230,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"LIVE_HEAD_CHEF",{enumerable:!0,get:function(){return o}});var t=r(d[0]),n=r(d[1]),c=r(d[2]),_=r(d[3]);const o='chef'===t.APP_VARIANT&&(0,c.isAnchorage)(_.VENUE_RID)&&!n.PITCH},1231,[806,2,1024,5]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.useLiveState=function(){const e=(0,s.useSync)(e=>e.mode),n=(0,s.useSync)(e=>e.venueId),o=(0,s.useSync)(e=>e.lastSyncAt);return l.PITCH||n&&o?'ready':'signin'===e||'local'===e||'off'===e||'unpaired'===e?'nolink':'offline'===e?'offline':'connecting'},_e.LiveWait=function({state:n,title:o,testID:s}){const l='nolink'===n&&'display'===e.APP_VARIANT?h:p[n];return(0,f.jsxs)(t.default,{testID:s,accessible:!0,accessibilityLabel:`${o}: ${l}`,style:{borderRadius:16,borderWidth:1,borderColor:c.colours.border,backgroundColor:c.colours.surface,padding:14,gap:4},children:[(0,f.jsx)(u.T,{size:12,weight:"semibold",colour:c.colours.goldMuted,children:o.toUpperCase()}),(0,f.jsx)(u.T,{size:18,weight:"semibold",children:l})]})};var e=r(d[0]);r(d[1]);var n,o=r(d[2]),t=(n=o)&&n.__esModule?n:{default:n},s=r(d[3]),l=r(d[4]),c=r(d[5]),u=r(d[6]),f=r(d[7]);const p={connecting:'Connecting\u2026',offline:'No connection. The live numbers show again when this phone is back online.',nolink:'Not connected to the venue. Open your personal link from your manager on this phone to see live numbers.'},h="This Display isn't paired yet. Tap Not paired to pair it."},1232,[806,30,127,820,2,821,813,24]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"QUEUED_BRAND",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"QUEUED_PALETTE",{enumerable:!0,get:function(){return l}});var t=r(d[0]),n=r(d[1]);const c=n.queuedVenues[t.VENUE_RID]?.branding,l={bg:c?.ink,surface:'#222222',surface2:'#292929',border:'#686868',gold:c?.accent,goldLight:c?.smallTextAccent,goldMuted:c?.smallTextAccent,onGold:c?.onAccent,goldTint:'#292929',tile:'#222222',tilePressed:'#292929',ok:c?.smallTextAccent,okBg:'#292929',blue:c?.smallTextAccent,blueBg:'#292929'}},1233,[5,6]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ABBOTSFORD_BRAND_ACCENT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"ABBOTSFORD_PALETTE",{enumerable:!0,get:function(){return n}});const t='#B89362',n={bg:'#32373C',surface:'#2A2F34',surface2:'#252A2F',tile:'#2A2F34',tilePressed:'#3D4349',border:'#777C81',gold:'#E5D08D',goldLight:'#F0DEA4',goldTint:'#3C372B',goldMuted:'#E5D08D',accentBg:'rgba(184,147,98,0.13)',accentBorder:'rgba(229,208,141,0.65)',onGold:'#0B0B0B',text:'#F8F4EA',muted:'#D7D1C7',ok:'#E5D08D',okBg:'#3C372B',blue:'#E5D08D',blueBg:'#3C372B'}},1234,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"KIRKTON_PALETTE",{enumerable:!0,get:function(){return t}});const t={bg:'#0B0B0B',surface:'#111111',surface2:'#141414',border:'#65554F',gold:'#B46C54',goldLight:'#D4A18E',goldTint:'#241A16',goldMuted:'#C99A86',tile:'#111111',tilePressed:'#141414',accentBg:'rgba(180,108,84,0.13)',accentBorder:'rgba(180,108,84,0.55)',onGold:'#0B0B0B',ok:'#D4A18E',okBg:'#241A16',blue:'#D4A18E',blueBg:'#241A16'}},1235,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"space",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"type",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"LINE",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"LINE_TIGHT",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"MIN_LINE",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"lineFor",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"radii",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"control",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"caps",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"layout",{enumerable:!0,get:function(){return y}});const t={xxs:2,xs:4,s:8,m:12,l:16,xl:24,xxl:32},n={micro:11,caption:12,small:14,body:16,large:18,title:22,hero:30,display:40},u=1.4,o=1.25,c=1.2,l=(t,n=u)=>Math.ceil(t*Math.max(n,c)),b={xs:4,s:8,m:12,button:14,l:16,xl:20,pill:999},f={min:48,tall:52,hero:56},p={letterSpacing:1.6},y={contentMax:640,headerSide:96}},1236,[]); +__d(function(_g,_r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.normaliseHex=n,e.hexToRgb=r,e.rgbToHex=o,e.hsvToRgb=s,Object.defineProperty(e,"hsvToHex",{enumerable:!0,get:function(){return a}}),e.hexToHsv=function(t){const{r:n,g:o,b:s}=r(t),a=n/255,c=o/255,u=s/255,i=Math.max(a,c,u),h=Math.min(a,c,u),l=i-h;let p=0;l&&(p=i===a?(c-u)/l%6:i===c?(u-a)/l+2:(a-c)/l+4);return{h:(60*p+360)%360,s:i?l/i:0,v:i}},e.luminance=c,e.contrast=u,e.shade=i,e.checkAccent=function(t,r,o,s){const a=n(t)??'#CFA45F',c=u(a,o),h=u(a,s),l=c>=h?o:s,p=[];Math.max(c,h)<4.5?p.push('Button text may be hard to read on this colour. We picked the clearer text colour for you, but a lighter or darker shade will read better.'):l===s&&p.push('This is a dark colour, so buttons use light text.');let b=a,d=0;for(;u(b,r)<4.5&&d<20;)b=i(a,.05*(d+1)),d++;b!==a&&p.push('This colour is hard to read on the dark background, so header text uses a lighter shade of it.');return{onAccent:l,accentText:b,tips:p}},e.pushRecent=function(t,r,o=8){const s=n(r);return s?[s,...(t??[]).filter(t=>t!==s)].slice(0,o):t??[]};const t=(t,n=0,r=1)=>Math.min(r,Math.max(n,t));function n(t){const n=t.trim().replace(/^#/,'');return/^[0-9a-fA-F]{3}$/.test(n)?'#'+n.split('').map(t=>t+t).join('').toUpperCase():/^[0-9a-fA-F]{6}$/.test(n)?'#'+n.toUpperCase():null}function r(t){const r=(n(t)??'#000000').slice(1);return{r:parseInt(r.slice(0,2),16),g:parseInt(r.slice(2,4),16),b:parseInt(r.slice(4,6),16)}}function o({r:n,g:r,b:o}){return'#'+[n,r,o].map(n=>Math.round(t(n,0,255)).toString(16).padStart(2,'0')).join('').toUpperCase()}function s({h:t,s:n,v:r}){const o=(t%360+360)%360/60,s=r*n,a=s*(1-Math.abs(o%2-1)),c=r-s,[u,i,h]=o<1?[s,a,0]:o<2?[a,s,0]:o<3?[0,s,a]:o<4?[0,a,s]:o<5?[a,0,s]:[s,0,a];return{r:255*(u+c),g:255*(i+c),b:255*(h+c)}}const a=t=>o(s(t));function c(t){const n=t=>{const n=t/255;return n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4)},{r:o,g:s,b:a}=r(t);return.2126*n(o)+.7152*n(s)+.0722*n(a)}function u(t,n){const r=c(t),o=c(n);return(Math.max(r,o)+.05)/(Math.min(r,o)+.05)}function i(t,n){const{r:s,g:a,b:c}=r(t),u=n>0?255:0,i=Math.abs(n);return o({r:s+(u-s)*i,g:a+(u-a)*i,b:c+(u-c)*i})}},1237,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.webLine=function(e,t){const u=n.default.flatten(e)||{},f='number'==typeof u.fontSize?u.fontSize:t,l='number'==typeof u.lineHeight?u.lineHeight:(0,o.lineFor)(f);return{lineHeight:String(Math.max(l/f,o.MIN_LINE))}},r(d[0]);var e,t=r(d[1]),n=(e=t)&&e.__esModule?e:{default:e},o=r(d[2])},1238,[122,46,1236]); +__d(function(g,_r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"localRepositories",{enumerable:!0,get:function(){return s}});var e=_r(d[0]);const a=()=>e.useStore.getState(),t=e=>Promise.resolve(e),s={customers:{update:async e=>a().updateCustomer(e),setAllergy:async(e,t)=>a().setAllergy(e,t)},menu:{updateItem:async(e,t)=>a().updateMenuItem(e,t),setSignOff:async(e,t)=>a().setSignOff(e,t)},orders:{placeFromBasket:e=>t(a().placeOrder(e)),accept:async(e,t,s)=>a().acceptOrder(e,t,s),setStatus:async(e,t,s)=>a().setOrderStatus(e,t,s),acknowledgeAllergy:async(e,t)=>a().ackOrderAllergy(e,t),acknowledgeReadiness:async(e,t,s)=>a().ackReadiness(e,t,s),recordHandoverCheck:async(e,t)=>a().handoverCheck(e,t),signAllergyStep:async(e,t,s)=>a().signAllergyStep(e,t,s),customerSignal:async(e,t)=>a().customerSignal(e,t),setSplit:async(e,t,s)=>a().setSplit(e,t,s),payTable:async(e,t)=>a().payTable(e,t)},bookings:{create:e=>t(a().createBooking(e)),setStatus:async(e,t)=>a().setBookingStatus(e,t),decide:async(e,t,s)=>a().decideBooking(e,t,s),acknowledgeAllergy:async(e,t)=>a().ackBookingAllergy(e,t),seatWalkIn:(e,s,n,c)=>t(a().seatWalkIn(e,s,n,c)),assignTable:async(e,t)=>a().setBookingTable(e,t),undoWalkIn:async e=>a().undoWalkIn(e),update:async(e,t)=>a().updateBooking(e,t)},waitlist:{join:(e,s,n,c)=>t(a().joinWaitlist(e,s,n,c)),setStatus:async(e,t)=>a().setWaitlistStatus(e,t),addWalkIn:async(e,t)=>a().addWalkIn(e,t)},loyalty:{addStamp:async(e,t,s)=>a().addStamp(e,t,s),redeemReward:async(e,t)=>a().redeemReward(e,t)},giftCards:{purchase:(e,s,n,c)=>t(a().buyGiftCard(e,s,n,c))},calendar:{addEvent:async e=>a().addEvent(e)},feedback:{add:async e=>a().addRating(e)},restaurants:{updateSettings:async(e,t)=>a().updateSettings(e,t)},alerts:{acknowledge:async(e,t)=>a().ackAlert(e,t)}}},1239,[872]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"orderAtTableOn",{enumerable:!0,get:function(){return t}});const t=t=>!!t&&(t.settings.orderAtTable??!0)},1240,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/staff-app/assets/assets/brand/3idiots.df4a76d2130f0e5b0042f06a8c88693a.png",width:1024,height:1024,toString(){return this.uri}}},1241,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/staff-app/assets/assets/brand/cecchinis.ebf752fef363247848ae7c0d91938765.png",width:1024,height:1024,toString(){return this.uri}}},1242,[]); +__d(function(s,t,i,r,a,c,e){"use strict";a.exports={uri:"/wildings/staff-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png",width:1024,height:1024,toString(){return this.uri}}},1243,[]); +__d(function(s,t,i,n,r,a,e){"use strict";r.exports={uri:"/wildings/staff-app/assets/assets/brand/yasmins.8482602e9f0a965655924835625cb02b.png",width:1024,height:1024,toString(){return this.uri}}},1244,[]); +__d(function(s,t,i,a,e,r,n){"use strict";e.exports={uri:"/wildings/staff-app/assets/assets/brand/williewastles.055a77893ced99bf3a6c5402ba5baac6.png",width:1024,height:1024,toString(){return this.uri}}},1245,[]); +__d(function(t,e,s,i,r,n,a){"use strict";r.exports={uri:"/wildings/staff-app/assets/assets/brand/rupeeroom.689e6fb536dc0845eeb174a1ec7bd346.png",width:1024,height:1024,toString(){return this.uri}}},1246,[]); +__d(function(t,s,i,a,n,r,d){"use strict";n.exports={uri:"/wildings/staff-app/assets/assets/brand/smokinggoat.20a3a1970596ab43c5d6468d4ed549a7.png",width:1024,height:1024,toString(){return this.uri}}},1247,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/staff-app/assets/assets/brand/pizzaioli.db8c000b62ee407121aa8b90ce45e170.png",width:1024,height:1024,toString(){return this.uri}}},1248,[]); +__d(function(t,s,i,e,n,r,a){"use strict";n.exports={uri:"/wildings/staff-app/assets/assets/brand/drunkencoo.f6d92af3b14e4205a3deaf4434754c51.png",width:1024,height:1024,toString(){return this.uri}}},1249,[]); +__d(function(t,s,i,a,r,e,n){"use strict";r.exports={uri:"/wildings/staff-app/assets/assets/brand/abbotsford.b26602bba5ce4969733c5422a45ad053.png",width:1024,height:1024,toString(){return this.uri}}},1250,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/staff-app/assets/assets/brand/kirkton.bcf8d846df4861474d224a7a77f498fb.png",width:1024,height:1024,toString(){return this.uri}}},1251,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/staff-app/assets/assets/brand/greenside.9d1556db97dcb903a3c57e2063ee2255.png",width:1024,height:1024,toString(){return this.uri}}},1252,[]); +__d(function(s,t,i,n,r,a,d){"use strict";r.exports={uri:"/wildings/staff-app/assets/assets/brand/wildings.076f4fcd06d19a0af0205c410f461b14.png",width:1024,height:1024,toString(){return this.uri}}},1253,[]); +__d(function(t,i,s,e,r,a,n){"use strict";r.exports={uri:"/wildings/staff-app/assets/assets/brand/kirkmichael.63b13cde7fd82eb622622b39ac80c394.png",width:1024,height:1024,toString(){return this.uri}}},1254,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/staff-app/assets/assets/brand/souters.f4c58d9349b6e1700fe5abcc9e9b665c.png",width:1024,height:1024,toString(){return this.uri}}},1255,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/staff-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png",width:512,height:512,toString(){return this.uri}}},1256,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/staff-app/assets/assets/brand/saltmarsh.85a6a65732635e5148478d743d9ca884.png",width:512,height:512,toString(){return this.uri}}},1257,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/staff-app/assets/assets/brand/brae.8de9e89ac30966c6669de990370d8e40.png",width:512,height:512,toString(){return this.uri}}},1258,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/staff-app/assets/assets/brand/3idiots-hero.e5dfd53739f05086b1956e72d585a66a.png",width:1024,height:1024,toString(){return this.uri}}},1259,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/staff-app/assets/assets/brand/cecchinis-hero.f77780fcc94fd668cf35d66d6dc52d81.png",width:1024,height:1024,toString(){return this.uri}}},1260,[]); +__d(function(s,t,i,r,a,e,n){"use strict";a.exports={uri:"/wildings/staff-app/assets/assets/brand/mrbasrais-hero.4ce74641cfcf52d099157c84005b9d2a.png",width:1024,height:1024,toString(){return this.uri}}},1261,[]); +__d(function(s,t,e,i,a,r,n){"use strict";a.exports={uri:"/wildings/staff-app/assets/assets/brand/yasmins-hero.a5aef62e37dfcecbe0afc056186f4ad9.png",width:1024,height:1024,toString(){return this.uri}}},1262,[]); +__d(function(s,t,i,e,r,a,d){"use strict";r.exports={uri:"/wildings/staff-app/assets/assets/brand/williewastles-hero.b9d53d27b66f903b5618a7177b2ffad4.png",width:1024,height:1024,toString(){return this.uri}}},1263,[]); +__d(function(t,a,s,r,i,e,n){"use strict";i.exports={uri:"/wildings/staff-app/assets/assets/brand/rupeeroom-hero.969fa372add526aaacf3a6c009b8ac92.png",width:1024,height:1024,toString(){return this.uri}}},1264,[]); +__d(function(t,s,i,e,r,d,n){"use strict";r.exports={uri:"/wildings/staff-app/assets/assets/brand/smokinggoat-hero.0588f17ef0eed7f757f22916cd4d37db.png",width:1600,height:900,toString(){return this.uri}}},1265,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/staff-app/assets/assets/brand/pizzaioli-hero.1896657c08264cefb49b401891d5448d.png",width:1024,height:1024,toString(){return this.uri}}},1266,[]); +__d(function(t,s,i,r,e,n,a){"use strict";e.exports={uri:"/wildings/staff-app/assets/assets/brand/drunkencoo-hero.65c21c4da9e466cf4bffc969639a1427.png",width:1600,height:900,toString(){return this.uri}}},1267,[]); +__d(function(t,s,e,i,r,a,n){"use strict";r.exports={uri:"/wildings/staff-app/assets/assets/brand/abbotsford-hero.78fcb8ee06ee22c4ca659c9254db7512.png",width:1024,height:1024,toString(){return this.uri}}},1268,[]); +__d(function(t,s,i,r,n,e,d){"use strict";n.exports={uri:"/wildings/staff-app/assets/assets/brand/kirkton-hero.9d0837b292c2f4f30f4521d806bb28c3.png",width:1024,height:1024,toString(){return this.uri}}},1269,[]); +__d(function(s,t,e,i,r,a,c){"use strict";r.exports={uri:"/wildings/staff-app/assets/assets/brand/greenside-hero.1caec5a6cb939434cccb5f3a613b50f8.png",width:1024,height:1024,toString(){return this.uri}}},1270,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/wildings/staff-app/assets/assets/brand/wildings-hero-logo-text.4661e4b935726f2511f9c17a1567c89a.png",width:1024,height:1024,toString(){return this.uri}}},1271,[]); +__d(function(t,i,s,e,r,a,n){"use strict";r.exports={uri:"/wildings/staff-app/assets/assets/brand/kirkmichael-hero.63b13cde7fd82eb622622b39ac80c394.png",width:1024,height:1024,toString(){return this.uri}}},1272,[]); +__d(function(t,s,i,r,e,n,a){"use strict";e.exports={uri:"/wildings/staff-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png",width:1024,height:1024,toString(){return this.uri}}},1273,[]); +__d(function(_g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.getFix=function(e=1e4){const t='undefined'!=typeof navigator?navigator.geolocation:void 0;return t?new Promise(o=>{let n=!1;const c=e=>{n||(n=!0,o(e))},u=setTimeout(()=>c('timeout'),e+1500);try{t.getCurrentPosition(e=>{clearTimeout(u),c({lat:e.coords.latitude,lng:e.coords.longitude,acc:e.coords.accuracy??999})},e=>{clearTimeout(u),c(1===e.code?'denied':3===e.code?'timeout':'unavailable')},{enableHighAccuracy:!0,timeout:e,maximumAge:0})}catch{clearTimeout(u),c('unsupported')}}):Promise.resolve('unsupported')},_e.locationAllowed=async function(){try{const e=await(navigator.permissions?.query({name:'geolocation'}));return'granted'===e?.state}catch{return!1}}},1274,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"VAPID_PUBLIC_KEY",{enumerable:!0,get:function(){return t}});const t='BC3MoXpycbFY4Nf3czfBMaiD0iaMd1ugc70iUWZUiaScERZibFBsI9cmPAiNrlPN0b2_wJR-wgutj4eC8suarQ0'},1275,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"SEEDED_ANSWERS",{enumerable:!0,get:function(){return f}});var n=r(d[0]),t=e(r(d[1])),l=e(r(d[2])),o=e(r(d[3])),s=e(r(d[4])),u=e(r(d[5])),p=e(r(d[6])),h=r(d[7]),c=r(d[8]);const f={...Object.fromEntries(Object.entries(n.queuedVenues).map(([e,n])=>[e,(0,h.cleanQuestionnaire)(n.questionnaire,e)??{}])),greenside:(0,h.cleanQuestionnaire)(t.default,'greenside')??{},abbotsford:(0,h.cleanQuestionnaire)(l.default,'abbotsford')??{},kirkton:(0,h.cleanQuestionnaire)(o.default,'kirkton')??{},wildings:(0,h.cleanQuestionnaire)(s.default,'wildings')??{},kirkmichael:(0,h.cleanQuestionnaire)(u.default,'kirkmichael')??{},souters:(0,h.cleanQuestionnaire)(p.default,'souters')??{},anchorage:{source:'from-config',submittedAt:'2026-10-01',onboardedAt:'2026-10-01',pay:c.ANCHORAGE_PAY},saltmarsh:{source:'signup-form',submittedAt:'2026-10-27',venue:{name:'The Venue',tagline:'Seasonal small plates by the harbour (fictional)',address:'4 Quay Street, Port Ailsa (fictional)',phone:'01632 960 418',email:'hello@thevenue.example',website:'thevenue.example'},tables:{template:'bistro',tables:14,covers:48,areas:['Inside','Terrace']},team:[{name:'Morven Reid (example)',role:'owner',job:'Owner',email:'morven@thevenue.example'},{name:'Callum Shaw (example)',role:'manager',job:'General manager',email:'callum@thevenue.example'},{name:'Isla Grant (example)',role:'staff',job:'Head chef'},{name:'Ruaridh Bell (example)',role:'staff',job:'Waiter',phone:'07700 900 311'},{name:'Ellie Muir (example)',role:'staff',job:'Waiter'}],suppliers:[{name:'Ailsa Fish Co (example)',category:'Fish',phone:'01632 960 101'},{name:'Hillside Dairy (example)',category:'Dairy',email:'orders@hillside.example'}],pay:{tipsFrequency:'fortnightly',tipsAnchorPayday:'2026-11-06',tipsEndsDaysBefore:5,wagePayDay:28,wageCutoffDay:20,weekendRule:'before'},accounts:[{provider:'gmail',handle:'hello@thevenue.example'},{provider:'wix',handle:'thevenue.example'},{provider:'instagram',handle:'@thevenue.demo'},{provider:'facebook',handle:'The Venue'},{provider:'google-business',handle:'The Venue'},{provider:'sumup',handle:'The Venue'},{provider:'xero',handle:'The Venue Ltd'}],features:{bookings:!0,takeaway:!0,orderAtTable:!0,tips:!0,rota:!0,games:!1,specials:!0},notes:'Fictional example answers for the demo venue.'}}},1276,[6,1277,1278,1279,867,866,1280,865,3]); +__d(function(e,a,n,s,o,r,t){o.exports={version:1,venueId:"greenside",source:"from-config",submittedAt:"2026-11-06",venue:{name:"The Greenside Restaurant",tagline:"Restaurant \u2022 Wood Fired Pizza \u2022 Maybole",address:"5 Greenside, Maybole, South Ayrshire KA19 7DG",phone:"01655 889685",email:"info@thegreensiderestaurant.co.uk",website:"https://thegreensiderestaurant.co.uk/",hasLogo:!0,emailNeedsConfirmation:!0},hours:{days:{0:["10:00","00:00"],1:null,2:null,3:["10:00","23:00"],4:["10:00","23:00"],5:["10:00","00:00"],6:["10:00","00:00"]},note:"Closed Monday and Tuesday. Venue Wednesday and Thursday 10:00\u201323:00, Friday to Sunday 10:00\u201300:00. Kitchen Wednesday, Thursday and Sunday 10:00\u201320:00; Friday and Saturday 10:00\u201321:00. Cash only."},tables:{template:"restaurant",tables:null,covers:null,areas:["Restaurant","Beer garden"],needsConfirmation:!0,note:"Historical figure about 50 covers inside and about 48 in seasonal beer garden (former GM LinkedIn). Names, tables and covers need Gordon's confirmation. Bar and restaurant only \u2014 no accommodation."},team:[],suppliers:[],accounts:[],features:{bookings:!0,takeaway:!1,orderAtTable:!1,tips:!0,rota:!0,games:!0,specials:!0},notes:"Separate greenside tenant. No staff, invites or table plan yet. Cash only; no card payments or deposits. CoverCharge manager-confirmed table requests only, with Call01655 889685 as backup. Menu, allergens, public email, pay settings and deposit policy need confirmation. No external booking or ordering links."}},1277,[]); +__d(function(e,o,a,t,r,n,s){r.exports={version:1,venueId:"abbotsford",source:"from-config",submittedAt:"2026-11-06",venue:{name:"The Abbotsford Hotel",tagline:"Get Hungry. Get Curious.",address:"14 Corsehill Road, Ayr KA7 2ST",phone:"01292 261506",email:"info@abbotsfordhotel.co.uk",website:"https://www.abbotsfordhotel.co.uk/",hasLogo:!0},hours:{days:{0:["10:00","20:30"],1:["10:00","20:30"],2:["10:00","20:30"],3:["10:00","20:30"],4:["10:00","20:30"],5:["10:00","20:30"],6:["10:00","20:30"]},note:"Daily 10:00\u201320:30 \u2014 to confirm with the hotel. Copper Bar hours to confirm."},tables:{template:"restaurant",tables:null,covers:null,areas:[],needsConfirmation:!0,note:"Rowan seats up to 120 (published). Restaurant and bar covers/tables unknown."},team:[],suppliers:[],accounts:[{provider:"facebook",handle:"TheAbbotsfordHotel"},{provider:"instagram",handle:"@abbotsfordhotelayr"},{provider:"tiktok",handle:"@the.abbotsford.hotel.ayr"}],features:{bookings:!0,takeaway:!1,orderAtTable:!1,tips:!0,rota:!0,games:!0,specials:!0},notes:"Separate abbotsford tenant. Epicurious restaurant and The Copper Bar. CoverCharge dining and room requests require manager confirmation. No external booking links, no room inventory module or external booking integrations. Zero staff/invites/sample data. Deposit, manager, team, table plan/covers, Copper Bar hours, dog policy and allergens to confirm."}},1278,[]); +__d(function(e,n,t,a,o,r,i){o.exports={version:1,venueId:"kirkton",source:"from-config",submittedAt:"2026-11-06",venue:{name:"The Kirkton Inn",tagline:"Bar and restaurant in Dalrymple, Ayrshire \u2014 Burns country hospitality",address:"1-3 Main Street, Dalrymple, East Ayrshire KA6 6DF",phone:"",email:"",website:"",hasLogo:!0},hours:{days:{0:null,1:null,2:null,3:null,4:null,5:null,6:null},note:"Current opening and kitchen hours to confirm. No service times set."},tables:{template:"restaurant",tables:null,covers:null,areas:[],needsConfirmation:!0,note:"Table plan and capacity to confirm."},team:[],suppliers:[],accounts:[],features:{bookings:!0,takeaway:!1,orderAtTable:!1,tips:!0,rota:!0,games:!0,specials:!0},notes:"Separate kirkton tenant. No staff or personal links. Room inventory and current letting to confirm; room functionality deferred. No external booking integrations. Phone, public email, website, current hours, capacity, table plan, takeaway, pay and deposit policy to confirm. Archived 2019 menus are provisional and not saleable stock."}},1279,[]); +__d(function(e,o,r,s,a,t,n){a.exports={version:1,venueId:"souters",source:"from-config",submittedAt:"2026-11-05",onboardedAt:"2026-11-05",venue:{name:"Souter's Inn",tagline:"Culinary excellence meets country hospitality in Kirkoswald",address:"47 Main Road, Kirkoswald, South Ayrshire KA19 8HY",phone:"01655 760653",email:"souters@southernayr.com",website:"https://www.soutersinn.com/",hasLogo:!0},hours:{days:{0:["09:00","21:00"],1:["09:00","21:00"],2:["09:00","21:00"],3:["09:00","21:00"],4:["09:00","21:00"],5:["09:00","21:00"],6:["09:00","21:00"]},note:"Open daily 9am\u20139pm. Breakfast 9\u201311.45am; main food service from noon. Confirm last orders with the venue."},tables:{template:"restaurant",tables:0,covers:130,areas:[]},team:[],suppliers:[{name:"Pollok Williamson Butchers",category:"Meat",phone:"",email:""}],accounts:[{provider:"instagram",handle:"@soutersinn"},{provider:"facebook",handle:"Souter's Inn"},{provider:"gmail",handle:"souters@southernayr.com"},{provider:"tripadvisor",handle:"Souter's Inn Kirkoswald"},{provider:"google-business",handle:"Souter's Inn"}],features:{bookings:!0,takeaway:!0,orderAtTable:!1,tips:!0,rota:!0,games:!0,specials:!0},notes:"Part of Southern Ayr Limited (Brian Daly). Sister venues: Abbotsford Hotel, The Brig, Bridges Bar, Wellingtons. Bookings: guests request a table in CoverCharge. Deposit default suggested \xa310pp from party of 6 \u2014 confirm with venue (published \xa310pp for some events). Regional Scottish Thistle Award Best Eating Experience 2026. Brand accent from official logo SVG fill #A4622E. Real table plan, manager contact, team, priced menu and deposit confirmation still required; no tables or staff seeded."}},1280,[]); +__d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.pickPhotos=function(t={}){const a=t.source??'camera';return'undefined'==typeof document?n(a):new Promise(t=>{const n=document.createElement('input');n.type='file',n.accept='image/*',n.multiple=!0,'camera'===a&&n.setAttribute('capture','environment'),n.setAttribute('data-testid','camera'===a?'photo-input':'gallery-input'),n.style.display='none',n.onchange=async()=>{const a=Array.from(n.files??[]).slice(0,8),o=[];for(const t of a)try{o.push(await r(t))}catch{}n.remove(),t(o)},document.body.appendChild(n),n.click()})},e.shrink=r,e.uploadPhoto=async function(n,r,o,c){const i=a.useSync.getState();if('staff'!==i.kind||!i.venueId)return null;try{const a=await(await fetch(o)).blob(),s=`${i.venueId}/${n}/${r}-${Date.now()}-${c}.jpg`,{error:u}=await(0,t.getSupabase)().storage.from('cashup-photos').upload(s,a,{contentType:'image/jpeg',upsert:!1});return u?null:s}catch{return null}},e.photoUrl=async function(a){if(a.startsWith('data:'))return a;try{const{data:n}=await(0,t.getSupabase)().storage.from('cashup-photos').createSignedUrl(a,600);return n?.signedUrl??null}catch{return null}},_r(d[0]);var t=_r(d[1]),a=_r(d[2]);async function n(t){try{const a=_r(d[3],"expo-image-picker"),n={mediaTypes:['images'],quality:.7,base64:!0,allowsMultipleSelection:'gallery'===t,selectionLimit:8};if('camera'===t){if(!(await a.requestCameraPermissionsAsync()).granted)return[]}const r='camera'===t?await a.launchCameraAsync(n):await a.launchImageLibraryAsync(n);return r.canceled?[]:r.assets.filter(t=>t.base64).map(t=>`data:image/jpeg;base64,${t.base64}`)}catch{return[]}}function r(t,a=1600){return new Promise((n,r)=>{const o=URL.createObjectURL(t),c=new Image;c.onload=()=>{const t=Math.min(1,a/Math.max(c.width,c.height)),r=document.createElement('canvas');r.width=Math.round(c.width*t),r.height=Math.round(c.height*t),r.getContext('2d').drawImage(c,0,0,r.width,r.height),URL.revokeObjectURL(o),n(r.toDataURL('image/jpeg',.78))},c.onerror=()=>{URL.revokeObjectURL(o),r(new Error('not an image'))},c.src=o})}},1281,[122,863,820,1035]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return c}});var t=r(d[0]),n=r(d[1]),s=r(d[2]);const o={images:'image/*',videos:'video/mp4,video/quicktime,video/x-m4v,video/*',livePhotos:''};var c={launchImageLibraryAsync:async({mediaTypes:t=['images'],allowsMultipleSelection:n=!1,base64:s=!1})=>'undefined'==typeof window||'undefined'==typeof document?{canceled:!0,assets:null}:await u({mediaTypes:t,allowsMultipleSelection:n,base64:s}),launchCameraAsync:async({mediaTypes:t=['images'],allowsMultipleSelection:n=!1,base64:s=!1,cameraType:o})=>'undefined'==typeof window||'undefined'==typeof document?{canceled:!0,assets:null}:await u({mediaTypes:t,allowsMultipleSelection:n,capture:o??!0,base64:s}),getCameraPermissionsAsync:async()=>l(),requestCameraPermissionsAsync:async()=>l(),getMediaLibraryPermissionsAsync:async t=>l(),requestMediaLibraryPermissionsAsync:async t=>l()};function l(){return{status:t.PermissionStatus.GRANTED,expires:'never',granted:!0,canAskAgain:!0}}function u({mediaTypes:t,capture:o=!1,allowsMultipleSelection:c=!1,base64:l}){const u=w((0,s.parseMediaTypes)(t)),p=document.createElement('input');if(p.style.display='none',p.setAttribute('type','file'),p.setAttribute('accept',u),p.setAttribute('id',String(Math.random())),p.setAttribute('data-testid','file-input'),c&&p.setAttribute('multiple','multiple'),o)switch(o){case!0:p.setAttribute('capture','camera');break;case n.CameraType.front:p.setAttribute('capture','user');break;case n.CameraType.back:p.setAttribute('capture','environment')}return document.body.appendChild(p),new Promise(t=>{p.addEventListener('change',async()=>{if(p.files?.length){const n=c?p.files:[p.files[0]];try{const s=await Promise.all(Array.from(n).filter(t=>null!=t).map(t=>f(t,{base64:l})));t({canceled:!1,assets:s})}catch(n){t(Promise.reject(n))}}else t({canceled:!0,assets:null});document.body.removeChild(p)}),p.addEventListener('cancel',()=>{p.dispatchEvent(new Event('change'))});const n=new MouseEvent('click');p.dispatchEvent(n)})}async function p(t){return new Promise(n=>{const s=new Image;s.onload=()=>{n({width:s.naturalWidth??s.width,height:s.naturalHeight??s.height})},s.onerror=()=>n({width:0,height:0}),s.src=t})}async function y(t){return new Promise(n=>{const s=document.createElement('video');s.preload='metadata',s.onloadedmetadata=()=>{n({width:s.videoWidth,height:s.videoHeight,duration:s.duration})},s.onerror=()=>n({width:0,height:0,duration:0}),s.src=t})}async function h(t){return new Promise((n,s)=>{const o=new FileReader;o.onerror=()=>{s(new Error('Failed to read the selected media because the operation failed.'))},o.onload=t=>{const o=t.target?.result;'string'==typeof o?n(o.split(',')?.[1]??''):s(new Error('Failed to read file as base64'))},o.readAsDataURL(t)})}async function f(t,n){const s=t.type,o=URL.createObjectURL(t);let c,l;if(s.startsWith('image/'))c=await p(o);else{if(!s.startsWith('video/'))throw new Error(`Unsupported file type: ${s}. Only images and videos are supported.`);c=await y(o)}return n.base64&&(l=await h(t)),{uri:o,width:c.width,height:c.height,type:s.startsWith('image/')?'image':'video',mimeType:s,fileName:t.name,fileSize:t.size,file:t,...void 0!==c.duration&&{duration:c.duration},...l&&{base64:l}}}function w(t){const n=t.filter(t=>'livePhotos'!==t);if(0===n.length)return'image/*';let s='';for(const t of n)s.includes(o[t])||(s=s.concat(',',o[t]));return s}},1282,[570,1283,1284]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"MediaTypeOptions",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"VideoExportPreset",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"UIImagePickerControllerQualityType",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"UIImagePickerPresentationStyle",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"UIImagePickerPreferredAssetRepresentationMode",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"CameraType",{enumerable:!0,get:function(){return l}});let t=(function(t){return t.All="All",t.Videos="Videos",t.Images="Images",t})({}),n=(function(t){return t[t.Passthrough=0]="Passthrough",t[t.LowQuality=1]="LowQuality",t[t.MediumQuality=2]="MediumQuality",t[t.HighestQuality=3]="HighestQuality",t[t.H264_640x480=4]="H264_640x480",t[t.H264_960x540=5]="H264_960x540",t[t.H264_1280x720=6]="H264_1280x720",t[t.H264_1920x1080=7]="H264_1920x1080",t[t.H264_3840x2160=8]="H264_3840x2160",t[t.HEVC_1920x1080=9]="HEVC_1920x1080",t[t.HEVC_3840x2160=10]="HEVC_3840x2160",t})({}),u=(function(t){return t[t.High=0]="High",t[t.Medium=1]="Medium",t[t.Low=2]="Low",t[t.VGA640x480=3]="VGA640x480",t[t.IFrame1280x720=4]="IFrame1280x720",t[t.IFrame960x540=5]="IFrame960x540",t})({}),o=(function(t){return t.FULL_SCREEN="fullScreen",t.PAGE_SHEET="pageSheet",t.FORM_SHEET="formSheet",t.CURRENT_CONTEXT="currentContext",t.OVER_FULL_SCREEN="overFullScreen",t.OVER_CURRENT_CONTEXT="overCurrentContext",t.POPOVER="popover",t.AUTOMATIC="automatic",t})({}),c=(function(t){return t.Automatic="automatic",t.Compatible="compatible",t.Current="current",t})({}),l=(function(t){return t.back="back",t.front="front",t})({})},1283,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.parseMediaTypes=p,e.mapDeprecatedOptions=function(s){if(!s.mediaTypes)return s;return{...s,mediaTypes:p(s.mediaTypes??[])}};var s=r(d[0]);function p(p){const n={Images:['images'],Videos:['videos'],All:['images','videos']};return p===s.MediaTypeOptions.Images||p===s.MediaTypeOptions.Videos||p===s.MediaTypeOptions.All?(console.warn('[expo-image-picker] `ImagePicker.MediaTypeOptions` have been deprecated. Use `ImagePicker.MediaType` or an array of `ImagePicker.MediaType` instead.'),n[p]):'string'==typeof p?[p]:p}},1284,[1283]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.readSheet=async function(l,u,c){const f=u.filter(t=>!t.startsWith('data:'));try{const u=n.useSync.getState();if('staff'!==u.kind||!u.venueId||!f.length)return{vals:o(c),reader:null,note:s};const{data:h,error:y}=await(0,t.getSupabase)().functions.invoke('cashup-read',{body:{kind:l,venueId:u.venueId,paths:f,fields:c.filter(t=>'text'!==t.kind).map(t=>({key:t.key,label:t.label,kind:t.kind}))}});if(y||!h||'object'!=typeof h||!h.vals)return{vals:o(c),reader:null,note:s};const p=o(c);for(const t of c){const n=h.vals[t.key];'number'==typeof n&&Number.isFinite(n)&&(p[t.key]=Math.round(100*n)/100)}const v=Object.values(p).filter(t=>null!=t).length;return v?{vals:p,categories:Array.isArray(h.categories)?h.categories:[],reader:String(h.reader??'photo reader'),note:`${v} figure${1===v?'':'s'} read from the photo. Check each one against the photo before you confirm.`}:{vals:p,reader:null,note:'The photo couldn\u2019t be read clearly, so type the figures from it.'}}catch{return{vals:o(c),reader:null,note:s}}};var t=r(d[0]),n=r(d[1]);const o=t=>Object.fromEntries(t.map(t=>[t.key,null])),s='Automatic reading isn\u2019t switched on yet, so type the figures from the photo. Nothing is filled in for you.'},1285,[863,820]); +__d(function(g,_r,_i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.pickSpreadsheet=function(){return'undefined'==typeof document?Promise.resolve({error:'Upload a spreadsheet from the Managers app in a web browser.'}):new Promise(e=>{const s=document.createElement('input');s.type='file',s.accept='.csv,.xlsx,text/csv,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',s.setAttribute('data-testid','sheet-input'),s.style.display='none',s.onchange=async()=>{const t=s.files?.[0];if(s.remove(),!t)return e(null);if(t.size>5242880)return e({error:'That file is over 5 MB. Export just the takings columns and try again.'});try{const s=/\.xlsx$/i.test(t.name)?await(0,c.readXlsx)(await t.arrayBuffer()):(0,r.parseCsv)(await t.text());e(s.length?{name:t.name,rows:s}:{error:'The file looks empty.'})}catch(s){e({error:s instanceof Error?s.message:'The file couldn\u2019t be read. Try saving it as CSV.'})}},document.body.appendChild(s),s.click()})},_e.SpreadsheetImport=function({rid:e,file:t,who:c,onClose:v,onSaved:w,locked:x}){const[y,$]=(0,s.useState)(!0),b=y?t.rows[0]:t.rows[0].map((e,s)=>`Column ${s+1}`),[j,k]=(0,s.useState)(()=>(0,r.guessMapping)(t.rows[0])),[C,T]=(0,s.useState)(!1),[D,S]=(0,s.useState)('map'),B=(0,n.useCashUp)(e=>e.cashUps),I=(0,s.useMemo)(()=>new Set(B.filter(s=>s.rid===e&&s.confirmedAt&&null!=(0,i.grossOf)(s.vals)).map(e=>e.date)),[B,e]),M=(0,s.useMemo)(()=>(0,r.buildPreview)(t.rows,j,y,I),[t.rows,j,y,I]),P=M.filter(e=>e.ok&&!(e.date&&x(e.date))),R=P.filter(e=>'saved'!==e.dup||C),z=P.filter(e=>'saved'===e.dup).length,L=M.filter(e=>!e.ok).length,U=M.filter(e=>e.ok&&e.date&&x(e.date)).length,E=null!=j.date&&null!=j.gross;return(0,u.jsxs)(l.Sheet,{visible:!0,onClose:v,title:"Upload a spreadsheet",maxWidth:1e3,testID:"sheet-import",children:[(0,u.jsx)(l.Muted,{children:`${t.name} \xb7 ${t.rows.length-(y?1:0)} row${t.rows.length-(y?1:0)==1?'':'s'}`}),'map'===D?(0,u.jsxs)(o.default,{style:{gap:10},testID:"sheet-map",children:[(0,u.jsx)(l.T,{size:17,weight:"semibold",children:"1. Which column is which?"}),(0,u.jsx)(l.Muted,{children:"Tip: Date and Gross takings are needed. Food, drink, card and cash are optional. Leave a column as \u201cNot in the file\u201d if you don\u2019t have it."}),(0,u.jsx)(l.Toggle,{testID:"sheet-header",label:"The first row is headings",value:y,onChange:$}),r.COLS.map(e=>(0,u.jsxs)(o.default,{style:{gap:4},testID:`sheet-col-${e.key}`,children:[(0,u.jsxs)(l.Row,{gap:6,children:[(0,u.jsx)(l.T,{weight:"semibold",children:e.label}),e.required?(0,u.jsx)(l.Badge,{kind:"gold",label:"NEEDED"}):(0,u.jsx)(l.Muted,{children:"optional"})]}),(0,u.jsxs)(l.Row,{wrap:!0,gap:6,children:[e.required?null:(0,u.jsx)(l.Chip,{label:"Not in the file",selected:null==j[e.key],onPress:()=>k({...j,[e.key]:void 0})}),b.map((s,o)=>(0,u.jsx)(l.Chip,{testID:`sheet-col-${e.key}-${o}`,label:s||`Column ${o+1}`,sub:y?void 0:t.rows[0][o],selected:j[e.key]===o,onPress:()=>{const s={...j};Object.keys(s).forEach(e=>{s[e]===o&&delete s[e]}),s[e.key]=o,k(s)}},o))]})]},e.key)),(0,u.jsx)(l.Button,{testID:"sheet-to-preview",label:"Preview",disabled:!E,onPress:()=>{S('preview'),f(`${M.filter(e=>e.ok).length} rows ready, ${L} with problems.`)}})]}):null,'preview'===D?(0,u.jsxs)(o.default,{style:{gap:10},testID:"sheet-preview",children:[(0,u.jsx)(l.T,{size:17,weight:"semibold",children:"2. Check the preview"}),(0,u.jsx)(o.default,{accessibilityLiveRegion:"polite",children:(0,u.jsx)(l.T,{testID:"sheet-summary",children:`${P.length} night${1===P.length?'':'s'} ready${L?` \xb7 ${L} row${1===L?'':'s'} with a problem (not saved)`:''}${U?` \xb7 ${U} signed off and locked (not changed)`:''}`})}),z?(0,u.jsx)(l.Banner,{kind:"warn",title:`${z} date${1===z?' already has':'s already have'} takings in CoverCharge`,children:(0,u.jsxs)(o.default,{style:{gap:6},children:[(0,u.jsx)(l.Toggle,{testID:"sheet-replace",label:"Replace those nights\u2019 takings with the spreadsheet",value:C,onChange:T}),(0,u.jsx)(l.Muted,{children:C?'Those nights will be replaced (the change is logged).':'Those nights are skipped; their saved takings are kept.'})]})}):null,M.slice(0,62).map(e=>{const s=e.ok&&'saved'===e.dup&&!C,t=e.ok&&!!e.date&&x(e.date),n=e.ok?t?'Locked: not changed':s?'Already saved: skipped':'saved'===e.dup?'Replaces saved takings':'Ready':e.errors.join('; ');return(0,u.jsxs)(o.default,{testID:`sheet-row-${e.line}`,accessible:!0,accessibilityLabel:`Row ${e.line}: ${e.date?m(e.date):'no date'}, gross ${p(e.vals.gross)}. ${n}`,style:{paddingVertical:8,gap:2,borderBottomWidth:1,borderBottomColor:h.colours.hairline,opacity:!e.ok||s||t?.75:1},children:[(0,u.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(l.T,{size:15,weight:"semibold",children:`Row ${e.line} \xb7 ${e.date?m(e.date):'no date'}`}),(0,u.jsx)(l.T,{size:15,weight:"semibold",colour:h.colours.goldLight,children:p(e.vals.gross)})]}),(()=>{const s=['food','drink','card','cash'].filter(s=>null!=j[s]&&null!=e.vals[s]).map(s=>`${s[0].toUpperCase()}${s.slice(1)} ${p(e.vals[s])}`);return s.length?(0,u.jsx)(l.T,{size:13,colour:h.colours.text,children:s.join(' \xb7 ')}):null})(),(0,u.jsx)(l.T,{size:13,colour:e.ok?h.colours.muted:h.colours.amber,children:n})]},e.line)}),M.length>62?(0,u.jsx)(l.Muted,{children:`\u2026and ${M.length-62} more rows.`}):null,(0,u.jsxs)(o.default,{style:{gap:8},children:[(0,u.jsx)(l.Button,{testID:"sheet-to-confirm",label:`Next: save ${R.length} night${1===R.length?'':'s'}`,disabled:!R.length,onPress:()=>S('confirm')}),(0,u.jsx)(l.Button,{kind:"secondary",label:"Change columns",onPress:()=>S('map')})]})]}):null,'confirm'===D?(0,u.jsxs)(o.default,{style:{gap:10},testID:"sheet-confirm",children:[(0,u.jsx)(l.T,{size:17,weight:"semibold",children:"3. Confirm"}),(0,u.jsxs)(o.default,{style:{borderWidth:1.5,borderColor:h.colours.gold,borderRadius:14,padding:12,gap:4,backgroundColor:h.colours.goldTint},accessibilityLiveRegion:"polite",children:[(0,u.jsx)(l.T,{size:18,weight:"semibold",colour:h.colours.gold,children:`Save takings for ${R.length} night${1===R.length?'':'s'}`}),(0,u.jsx)(l.T,{children:R.length?`${m(R.map(e=>e.date).sort()[0])} to ${m(R.map(e=>e.date).sort().slice(-1)[0])} \xb7 gross ${p(Math.round(100*R.reduce((e,s)=>e+(s.vals.gross??0),0))/100)} in total`:''}),(0,u.jsx)(l.Muted,{children:`Saved as confirmed by ${c.name}. Each night is logged. ${C&&z?`${z} saved night${1===z?' is':'s are'} replaced.`:z?`${z} already-saved night${1===z?' is':'s are'} skipped.`:''}`})]}),(0,u.jsx)(l.Button,{testID:"sheet-save",label:"Confirm and save",onPress:()=>{const s=(new Date).toISOString(),o=n.useCashUp.getState();for(const l of R){const n=o.cashUps.find(s=>s.rid===e&&s.date===l.date);o.saveCashUp({rid:e,date:l.date,vals:{...n?.vals??{},...(0,r.rowVals)(l)},photos:n?.photos??[],confirmedBy:c.name,confirmedAt:s,readBy:`spreadsheet: ${t.name}`.slice(0,80)})}const l=R.length,i=`Takings saved for ${l} night${1===l?'':'s'} from ${t.name}.`;f(i),w(i)}}),(0,u.jsx)(l.Button,{kind:"secondary",label:"Back to the preview",onPress:()=>S('preview')})]}):null]})};var s=_r(d[0]),t=e(_r(d[1]));_r(d[2]);var o=e(_r(d[3])),l=_r(d[4]),n=_r(d[5]),i=_r(d[6]),r=_r(d[7]),h=_r(d[8]),c=_r(d[9]),u=_r(d[10]);const p=e=>null==e?'\u2014':`\xa3${e.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`,m=e=>new Date(`${e}T12:00:00Z`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',year:'numeric',timeZone:'UTC'}),f=e=>{try{t.default.announceForAccessibility?.(e)}catch{}}},1286,[30,118,122,127,813,1093,1109,1287,821,1288,24]); +__d(function(g,_r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"COLS",{enumerable:!0,get:function(){return n}}),e.parseCsv=function(t){const n=t.replace(/^\uFEFF/,''),r=n.split(/\r?\n/,1)[0]??'',s=t=>r.split(t).length-1,a=[',',';','\t'].sort((t,n)=>s(n)-s(t))[0],o=[];let l=[],d='',i=!1;for(let t=0;tt.some(t=>''!==t.trim())).map(t=>t.map(t=>t.trim()))},e.guessMapping=function(t){const n={},s=new Set;for(const a of['date','food','drink','card','cash','gross']){const o=t.findIndex((t,n)=>!s.has(n)&&r[a].test(t)&&!('gross'===a&&/tips?/i.test(t))&&!('cash'===a&&/tips?|float/i.test(t)));o>=0&&(n[a]=o,s.add(o))}return n},e.parseDateCell=l,e.buildPreview=function(r,s,a,o){const d=a?r.slice(1):r,i=new Map,u=d.map((r,o)=>{const d=[],i=t=>null==s[t]?'':(r[s[t]]??'').trim(),u=null==s.date?null:l(i('date'));u||d.push(i('date')?`Date \u201c${i('date')}\u201d not understood`:'No date');const c={};for(const r of n){if('date'===r.key||null==s[r.key])continue;const n=i(r.key);if(!n){c[r.key]=null,r.required&&d.push(`No ${r.label.toLowerCase()}`);continue}const a=(0,t.parseAmount)(n.replace(/^\((.*)\)$/,'-$1'));null==a&&d.push(`${r.label} \u201c${n}\u201d not a \xa3 amount`),c[r.key]=a}return null==s.gross&&d.push('No gross column'),{line:o+(a?2:1),date:u,vals:c,errors:d,dup:null,ok:!1}});for(const t of u)t.date&&i.set(t.date,(i.get(t.date)??0)+1);for(const t of u)t.date&&(i.get(t.date)??0)>1?(t.dup='file',t.errors.push('This date is in the file more than once')):t.date&&o.has(t.date)&&(t.dup='saved'),t.ok=!t.errors.length;return u},e.rowVals=function(t){const n={};for(const r of['gross','food','drink','card','cash'])r in t.vals&&(n[r]=t.vals[r]??null);return n};var t=_r(_d[0]);const n=[{key:'date',label:'Date',required:!0},{key:'gross',label:'Gross takings',required:!0},{key:'food',label:'Food'},{key:'drink',label:'Drink'},{key:'card',label:'Card'},{key:'cash',label:'Cash'}];const r={date:/^(date|day|night|trading ?date|business ?date)\b/i,gross:/(gross|total ?takings|takings|total ?sales|sales ?total|turnover|^total$)/i,food:/\bfood\b|kitchen/i,drink:/\bdrinks?\b|\bbar\b|bev(erage)?s?|wet/i,card:/\bcard\b|pdq|debit|credit/i,cash:/\bcash\b/i};const s=['jan','feb','mar','apr','may','jun','jul','aug','sep','oct','nov','dec'],a=t=>String(t).padStart(2,'0'),o=(t,n,r)=>{const s=new Date(Date.UTC(t,n-1,r));return s.getUTCFullYear()===t&&s.getUTCMonth()===n-1&&s.getUTCDate()===r?`${t}-${a(n)}-${a(r)}`:null};function l(t){const n=t.trim();let r;if(r=n.match(/^(\d{4})-(\d{1,2})-(\d{1,2})(?:[ T].*)?$/))return o(+r[1],+r[2],+r[3]);if(r=n.match(/^(\d{1,2})[/.-](\d{1,2})[/.-](\d{2}|\d{4})(?: .*)?$/))return o(2===r[3].length?+r[3]+2e3:+r[3],+r[2],+r[1]);if(r=n.match(/^(?:[a-z]+,? )?(\d{1,2})(?:st|nd|rd|th)? ([a-z]{3})[a-z]*,? (\d{4})$/i)){const t=s.indexOf(r[2].toLowerCase());return t<0?null:o(+r[3],t+1,+r[1])}if(/^\d{5}(\.\d+)?$/.test(n)){const t=Math.floor(+n);if(t<36526||t>73050)return null;const r=new Date(Date.UTC(1899,11,30)+864e5*t);return o(r.getUTCFullYear(),r.getUTCMonth()+1,r.getUTCDate())}return null}},1287,[1109]); +__d(function(g,_r,_i,a,_m,e,_d){"use strict";async function t(t){const r=globalThis.DecompressionStream;if(!r)throw new Error('This browser can\u2019t open .xlsx files. Save the sheet as CSV and upload that.');const n=new Blob([t]).stream().pipeThrough(new r('deflate-raw'));return new Uint8Array(await new Response(n).arrayBuffer())}async function r(r,n){const s=new Uint8Array(r),o=new DataView(r),i={};let c=-1;for(let t=s.length-22;t>=Math.max(0,s.length-66e3);t--)if(101010256===o.getUint32(t,!0)){c=t;break}if(c<0)throw new Error('This isn\u2019t a readable .xlsx file.');const l=o.getUint16(c+10,!0);let h=o.getUint32(c+16,!0);const f=new TextDecoder;for(let r=0;r'xl/sharedStrings.xml'===t||/^xl\/worksheets\/sheet\d+\.xml$/.test(t)),i=Object.keys(o).filter(t=>t.startsWith('xl/worksheets/')).sort()[0];if(!i)throw new Error('No worksheet found in this file.');const c=[...(o['xl/sharedStrings.xml']??'').matchAll(/([\s\S]*?)<\/si>/g)].map(t=>n([...t[1].matchAll(/]*>([\s\S]*?)<\/t>/g)].map(t=>t[1]).join(''))),l=[];for(const t of o[i].matchAll(/]*>([\s\S]*?)<\/row>/g)){const r=[];for(const o of t[1].matchAll(/]*?)(?:\/>|>([\s\S]*?)<\/c>)/g)){const t=o[1],i=o[2]??'',l=t.match(/r="([A-Z]+\d+)"/)?.[1],h=t.match(/t="(\w+)"/)?.[1],f=i.match(/([\s\S]*?)<\/v>/)?.[1],w=i.match(/]*>([\s\S]*?)<\/t>/)?.[1],m='s'===h?c[Number(f)]??'':n('inlineStr'===h?w??'':f??'');r[l?s(l):r.length]=m}l.push(Array.from(r,t=>(t??'').trim()))}return l.filter(t=>t.some(t=>''!==t))};const n=t=>t.replace(/</g,'<').replace(/>/g,'>').replace(/"/g,'"').replace(/'/g,"'").replace(/&#(\d+);/g,(t,r)=>String.fromCharCode(+r)).replace(/&/g,'&'),s=t=>{const r=t.replace(/\d+/g,'');let n=0;for(const t of r)n=26*n+(t.charCodeAt(0)-64);return n-1}},1288,[]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.useLockedFor=function(e){const n=(0,c.useCashUp)(e=>e.cashUps),s=(0,c.useCashUp)(e=>e.sales);return(0,o.useCallback)((o,l)=>{const i='cashup'===o?n.find(n=>n.rid===e&&n.date===l):s.find(n=>n.rid===e&&n.weekStart===l);return!!i&&(0,h.cashLocked)(t.PITCH&&i.confirmedAt?{...i,onServer:!0}:i)},[n,s,e])},Object.defineProperty(_e,"lockedMessage",{enumerable:!0,get:function(){return y}}),_e.auditLine=j,_e.CashLockControls=function({kind:e,item:s,label:c}){const y=(0,k.useSync)(e=>'staff'===e.kind&&!!e.venueId)||t.PITCH,b=(0,k.useSync)(e=>e.perms.includes('*')||e.perms.includes('roles.manage')),x=(0,u.useOwner)(e=>e.previewRole),C=b||t.PITCH&&'owner'===x,[$,w]=(0,o.useState)(!1),[I,S]=(0,o.useState)(''),[P,L]=(0,o.useState)(!1),[T,U]=(0,o.useState)(null);if(!y||!(s.onServer||t.PITCH&&s.confirmedAt))return null;const v=(0,h.cashLocked)(t.PITCH?{...s,onServer:!0}:s),H=async()=>{L(!0);const n=await(0,k.unlockCashUp)(e,s.id,I.trim());L(!1),n.ok?(w(!1),S(''),(0,f.notify)({id:'cash-unlock',icon:'\ud83d\udd11',title:`${c} unlocked for 30 minutes`,body:'Correct it now. It locks again by itself, and the change is logged with your name.',timeoutMs:8e3})):(0,f.notify)({id:'cash-unlock',tone:'warn',title:'Not unlocked',body:n.message,timeoutMs:8e3})};return(0,p.jsxs)(l.default,{testID:`cash-lock-${s.id}`,style:{gap:4},children:[(0,p.jsxs)(i.Row,{gap:6,wrap:!0,children:[v?(0,p.jsx)(i.Badge,{kind:"gold",label:"Signed off"}):(0,p.jsx)(i.Badge,{kind:"neutral",label:`Unlocked until ${new Date(s.unlockedUntil??'').toLocaleTimeString('en-GB',{timeZone:'Europe/London',hour:'2-digit',minute:'2-digit'})}`}),v&&C&&!$?(0,p.jsx)(i.Button,{small:!0,kind:"ghost",testID:`cash-unlock-${s.id}`,label:"Unlock to correct",onPress:()=>w(!0)}):null,(0,p.jsx)(i.Button,{small:!0,kind:"ghost",testID:`cash-history-${s.id}`,label:T?'Hide history \u25b4':'History \u25be',onPress:()=>{T?U(null):(0,k.readCashAudit)(s.id).then(U)}})]}),v&&!C?(0,p.jsx)(i.Muted,{size:12,children:"Only an owner can unlock it to make a correction."}):null,$?(0,p.jsxs)(l.default,{style:{gap:4},children:[(0,p.jsx)(n.TextInput,{testID:`cash-unlock-reason-${s.id}`,value:I,onChangeText:S,placeholder:"Why does it need changing?",placeholderTextColor:r.colours.muted,maxLength:200,style:{minHeight:36,borderRadius:8,borderWidth:1,borderColor:r.colours.hairline,color:r.colours.text,paddingHorizontal:8}}),(0,p.jsxs)(i.Row,{gap:6,children:[(0,p.jsx)(i.Button,{small:!0,testID:`cash-unlock-yes-${s.id}`,label:P?'Unlocking\u2026':'Unlock for 30 minutes',disabled:P||I.trim().length<3,onPress:()=>{H()}}),(0,p.jsx)(i.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>{w(!1),S('')}})]})]}):null,T?T.length?T.map((e,n)=>(0,p.jsx)(i.Muted,{size:12,children:j(e)},n)):(0,p.jsx)(i.Muted,{size:12,children:"No history yet."}):null]})};var e,n=_r(d[0]),t=_r(d[1]),o=_r(d[2]),s=_r(d[3]),l=(e=s)&&e.__esModule?e:{default:e},i=_r(d[4]),r=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]),k=_r(d[9]),f=_r(d[10]),p=_r(d[11]);const y=(e,n)=>`The ${'cashup'===e?'cash up':'weekly sales report'} for ${n} is signed off and locked. An owner can tap \u201cUnlock to correct\u201d on it.`,b={created:'signed off',changed:'changed',unlocked:'unlocked',deleted:'removed'},x=e=>new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'});function j(e){const n=e.changed.length&&'changed'===e.action?` (${e.changed.slice(0,6).join(', ')}${e.changed.length>6?'\u2026':''})`:'';return`${x(e.at)} \xb7 ${e.by} ${b[e.action]??e.action}${n}${e.reason?`: \u201c${e.reason}\u201d`:''}`}},1289,[877,2,30,127,813,821,1093,856,1109,820,947,24]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"inPhoneApp",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"canOpenAppSettings",{enumerable:!0,get:function(){return c}}),e.openAppSettings=function(){try{t()?.openSettings?.()}catch{}},e.openLocationSettings=function(){try{t()?.openLocationSettings?.()}catch{}},e.appLocationPermission=function(){try{return t()?.locationPermission?.()??null}catch{return null}},e.phoneLocationOn=p,e.checkAppUpdate=function(){try{t()?.checkUpdate?.()}catch{}},e.locWhere=function(){if(!o()){const t=String(n()?.navigator?.userAgent??'');return/iPhone|iPad|iPod/.test(t)||/Macintosh/.test(t)&&(n()?.navigator?.maxTouchPoints??0)>1?'iphone':'browser'}return c()?p()?'app':'app-phone-off':'app-old'};const n=()=>'undefined'!=typeof window?window:void 0,t=()=>{const t=n()?.CoverChargeNative;return t&&'object'==typeof t?t:null},o=()=>/CoverChargePhone\//.test(String(n()?.navigator?.userAgent??'')),c=()=>'function'==typeof t()?.openSettings;function p(){try{const n=t()?.locationOn?.();return!1!==n}catch{return!0}}},1290,[]); +__d(function(g,r,_i,a,m,_e,d){"use strict";function t(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.SplitFlap=function({value:t,height:e=52,colour:o="#F5F1E8",min:i=2,sound:n,testID:u}){const s=String(Math.max(0,Math.round(t))).padStart(i,' '),h=Math.round(.68*e);return(0,c.jsx)(l.default,{testID:u,accessible:!0,accessibilityLabel:String(Math.max(0,Math.round(t))),style:{flexDirection:'row',gap:3},children:s.split('').map((t,i)=>(0,c.jsx)(x,{ch:' '===t?'':t,h:e,colour:o,size:h,sound:n&&i===s.length-1},s.length-i))})};var e=r(d[0]),o=t(r(d[1])),i=t(r(d[2])),n=t(r(d[3])),l=t(r(d[4])),u=r(d[5]),s=r(d[6]),c=r(d[7]);let h=!1;o.default.isReduceMotionEnabled?.().then(t=>{h=!!t}).catch(()=>{}),o.default.addEventListener?.('reduceMotionChanged',t=>{h=!!t});const f='#1B1A1D',p='#201F22';function b({ch:t,h:e,w:o,colour:n,part:u,size:h}){return(0,c.jsx)(l.default,{style:{height:e/2,width:o,overflow:'hidden',backgroundColor:'top'===u?p:f,borderTopLeftRadius:'top'===u?8:0,borderTopRightRadius:'top'===u?8:0,borderBottomLeftRadius:'bottom'===u?8:0,borderBottomRightRadius:'bottom'===u?8:0},children:(0,c.jsx)(i.default.Text,{allowFontScaling:!1,style:{position:'absolute',left:0,right:0,top:'top'===u?0:-e/2,height:e,lineHeight:e,textAlign:'center',fontSize:h,fontFamily:s.fonts.bold,color:n,includeFontPadding:!1},children:t})})}function x({ch:t,h:o,colour:s,size:f,sound:p}){const x=Math.round(.7*o),[j,v]=(0,e.useState)(t),[w,R]=(0,e.useState)(t),y=(0,e.useRef)(new i.default.Value(0)).current,M=(0,e.useRef)(new i.default.Value(1)).current,V=(0,e.useRef)(!0);(0,e.useEffect)(()=>{if(V.current)return V.current=!1,v(t),void R(t);if(t!==j){if(h)return R(t),void v(t);R(j),v(t),y.setValue(0),M.setValue(1),p&&(0,u.flapClick)(),i.default.sequence([i.default.timing(y,{toValue:1,duration:210,easing:n.default.in(n.default.quad),useNativeDriver:!0}),i.default.timing(M,{toValue:0,duration:210,easing:n.default.out(n.default.quad),useNativeDriver:!0})]).start(()=>R(t))}},[t]);const z=o/4,F=y.interpolate({inputRange:[0,1],outputRange:['0deg','-90deg']}),S=M.interpolate({inputRange:[0,1],outputRange:['0deg','90deg']}),D=w!==j;return(0,c.jsxs)(l.default,{style:{width:x,height:o},children:[(0,c.jsx)(b,{ch:j,h:o,w:x,colour:s,part:"top",size:f}),(0,c.jsx)(b,{ch:D?w:j,h:o,w:x,colour:s,part:"bottom",size:f}),D?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(i.default.View,{style:{position:'absolute',top:0,left:0,transform:[{perspective:400},{translateY:z},{rotateX:F},{translateY:-z}],backfaceVisibility:'hidden'},children:(0,c.jsx)(b,{ch:w,h:o,w:x,colour:s,part:"top",size:f})}),(0,c.jsx)(i.default.View,{style:{position:'absolute',top:o/2,left:0,transform:[{perspective:400},{translateY:-z},{rotateX:S},{translateY:z}],backfaceVisibility:'hidden'},children:(0,c.jsx)(b,{ch:j,h:o,w:x,colour:s,part:"bottom",size:f})})]}):null,(0,c.jsx)(l.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:o/2-.5,height:1,backgroundColor:'rgba(0,0,0,0.75)'}})]})}},1291,[30,118,120,224,127,923,821,24]); +__d(function(g,_r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.LastFoodBanner=function({rid:e,now:o,big:c}){const f=(0,l.useRestaurant)(e),h=u(o),$=(0,l.useEvents)(e).filter(e=>e.date===h&&'regular'===e.source),b=f?(0,s.lastFoodOn)(f,h):null;if(!b)return null;const T=new Date(`${h}T${b.time}:00`),p=Math.round((T.getTime()-o.getTime())/6e4),_=$[0],j=_?`${_.title}${_.time?` from ${(0,s.fmt12)(_.time)}`:''}`:'';if(p>90&&!_)return null;if(p<-60)return null;const w=p>=0&&p<=15,x=p<0,D=w?n.colours.redBg:x?n.colours.surface2:n.colours.goldTint,F=w?n.colours.red:x?n.colours.hairline:n.colours.accentBorder,M=w?'#FFD9D4':x?n.colours.muted:n.colours.goldLight,y=c?1.3:1,B=x?`Kitchen closed for food \xb7 last orders were ${(0,s.fmt12)(b.time)}`:w?`Last food orders in ${Math.max(0,p)} min (${(0,s.fmt12)(b.time)})`:`Last food orders ${(0,s.fmt12)(b.time)}`;return(0,d.jsxs)(t.default,{testID:w?'last-food-warning':'last-food-banner',accessibilityRole:"text",style:{borderRadius:14,borderWidth:w?2:1,borderColor:F,backgroundColor:D,paddingVertical:10*y,paddingHorizontal:14,gap:2},children:[(0,d.jsxs)(r.T,{size:17*y,weight:"bold",colour:M,children:[w?'\u23f0 ':'\ud83c\udf7d ',B]}),j||'kitchen closes'!==b.reason?(0,d.jsx)(r.T,{size:13*y,colour:n.colours.muted,children:[j?`Tonight: ${j}`:'','kitchen closes'!==b.reason&&b.reason!==_?.title?`Early last orders (${b.reason})`:''].filter(Boolean).join(' \xb7 ')}):null]})},_r(_d[0]);var e,o=_r(_d[1]),t=(e=o)&&e.__esModule?e:{default:e},r=_r(_d[2]),l=_r(_d[3]),s=_r(_d[4]),n=_r(_d[5]),d=_r(_d[6]);const u=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`},1292,[30,127,813,819,809,821,24]); +__d(function(_g,_r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.useNextFree=j,_e.NextTableFreeCard=function({rid:e,now:s,big:r,always:d}){const u=(0,n.useRestaurant)(e),c=j(e,s);if(!u||!c||!(0,h.nextTableOn)(u))return null;if(!c.full&&!d)return null;const T=c.list.slice(0,3),w=c.waitFor(2),p=c.waitFor(4),y=(0,h.lastFoodOn)(u,x(s)),M=r?1.25:1,F=(e,r)=>(0,g.jsxs)(l.default,{style:{flex:1,borderRadius:12,borderWidth:1,borderColor:f.colours.hairline,backgroundColor:f.colours.tile,padding:10},testID:`wait-for-${e}`,children:[(0,g.jsxs)(o.Muted,{children:["Wait for ",e]}),(0,g.jsx)(o.T,{size:20*M,weight:"bold",colour:f.colours.goldLight,children:r?`About ${Math.max(5,Math.round((r.at.getTime()-s.getTime())/6e4))} min`:'\u2014'}),(0,g.jsx)(o.Muted,{children:r?`${(0,t.tableNumbers)(r.table)} \xb7 ${r.confidence}`:'nothing due yet'})]});return(0,g.jsxs)(l.default,{testID:"next-table-free",accessibilityRole:"summary",style:{borderRadius:16,borderWidth:1,borderColor:f.colours.accentBorder,backgroundColor:f.colours.surface,padding:14,gap:8},children:[(0,g.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,g.jsx)(o.T,{size:12,weight:"semibold",colour:f.colours.goldMuted,style:{letterSpacing:1.4},children:c.full?'FULL \xb7 NEXT TABLE FREE':'NEXT TABLE FREE'}),(0,g.jsx)(o.Badge,{kind:"amber",label:"ESTIMATE"})]}),T.length?(0,g.jsxs)(o.T,{size:22*M,weight:"bold",children:["About ",(0,b.hhmm)(T[0].at)," ",(0,g.jsxs)(o.T,{size:16*M,colour:f.colours.muted,children:["(",(0,t.tableNumbers)(T[0].table),", ",T[0].seats," seats \xb7 ",T[0].confidence,")"]})]}):(0,g.jsx)(o.T,{size:18*M,weight:"semibold",children:c.freeNow.length?`Free now: ${c.freeNow.map(e=>`${(0,t.tableNumbers)(e)}`).join(', ')}`:'No table due to free up before its next booking'}),T.slice(1).map(e=>(0,g.jsxs)(o.Muted,{children:["Then about ",(0,b.hhmm)(e.at)," \xb7 ",(0,t.tableNumbers)(e.table)," (",e.seats," seats) \xb7 ",e.confidence," \xb7 ",e.why]},e.table)),T[0]?(0,g.jsxs)(o.Muted,{children:[(0,t.tableNumbers)(T[0].table),": ",T[0].why,"."]}):null,(0,g.jsxs)(o.Row,{gap:8,children:[F(2,w),F(4,p)]}),T.some(e=>e.drinksOnly)&&y?(0,g.jsxs)(o.T,{size:13,colour:f.colours.amber,children:["After last food orders (",(0,h.fmt12)(y.time),") a table is for drinks only."]}):null,(0,g.jsx)(o.Muted,{children:"Tap Bill requested or Table finished on the plan and this updates straight away."})]})};var e,t=_r(_d[0]),s=_r(_d[1]),r=_r(_d[2]),l=(e=r)&&e.__esModule?e:{default:e},o=_r(_d[3]),n=_r(_d[4]),d=_r(_d[5]),u=_r(_d[6]),c=_r(_d[7]),b=_r(_d[8]),h=_r(_d[9]),f=_r(_d[10]),g=_r(_d[11]);const x=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`,T=e=>(0,b.hhmm)(e);function j(e,t){const r=(0,n.useRestaurant)(e),l=(0,u.usePlan)(e),o=(0,n.useBookings)(e),h=(0,n.useOrders)(e),f=(0,u.useFloor)(t=>t.live[e]),g=(0,d.useBlocks)(e=>e.blocks),j=t.getTime()/6e4|0;return(0,s.useMemo)(()=>{if(!r)return null;const s=x(t),n=(0,d.closedAreasAt)(g,e,s,T(t)),u=(0,c.floorView)(l,o,h,f??{},t,r.settings.turnMins,n);return(0,b.nextTablesFree)(r,u,o.filter(e=>e.date===s),t,o)},[r,l,o,h,f,g,j])}},1293,[808,30,127,813,819,824,825,826,1115,809,821,24]); +__d(function(_g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"MAX",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"TARGET",{enumerable:!0,get:function(){return t}}),_e.compressOnWeb=r,_e.capturePlatingPhoto=async function(e){{const n=await(t='camera'===e,new Promise(e=>{const n=document.createElement('input');n.type='file',n.accept='image/*',t&&n.setAttribute('capture','environment'),n.style.display='none',n.setAttribute('data-testid',t?'photo-input-camera':'photo-input-library'),n.onchange=()=>{const t=n.files?.[0]??null;n.remove(),e(t)},n.oncancel=()=>{n.remove(),e(null)},document.body.appendChild(n),n.click()}));if(!n)return null;return{...await r(n),originalBytes:n.size}}var t},Object.defineProperty(_e,"kb",{enumerable:!0,get:function(){return a}});!(function(e){if(e&&e.__esModule)return e;var t={};e&&Object.keys(e).forEach(function(n){if('default'!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e})(_r(_d[0]));_r(_d[1]);const e=1024,t=225280,n=e=>Math.round(3*(e.length-e.indexOf(',')-1)/4);async function r(r,a=e,o=t){const i='string'==typeof r?r:URL.createObjectURL(r);try{const e=await new Promise((e,t)=>{const n=new window.Image;n.onload=()=>e(n),n.onerror=()=>t(new Error('That file is not a photo we can read.')),n.src=i}),t=Math.min(1,a/Math.max(e.naturalWidth,e.naturalHeight)),r=Math.max(1,Math.round(e.naturalWidth*t)),c=Math.max(1,Math.round(e.naturalHeight*t)),u=document.createElement('canvas');u.width=r,u.height=c;const l=u.getContext('2d');l.fillStyle='#ffffff',l.fillRect(0,0,r,c),l.drawImage(e,0,0,r,c);let f=.8,s=u.toDataURL('image/jpeg',f);for(;n(s)>o&&f>.4;)f-=.1,s=u.toDataURL('image/jpeg',f);return{dataUrl:s,width:r,height:c,bytes:n(s)}}finally{'string'!=typeof r&&URL.revokeObjectURL(i)}}const a=e=>`${Math.max(1,Math.round(e/1024))} KB`},1294,[1035,122]); +__d(function(_g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useLogoCache",{enumerable:!0,get:function(){return s}}),_e.squareLogo=async function(e,t=256){const n=await new Promise((t,n)=>{const o=new window.Image;o.onload=()=>t(o),o.onerror=()=>n(new Error('That file is not a picture we can read.')),o.src=e}),o=Math.min(n.naturalWidth,n.naturalHeight),i=(n.naturalWidth-o)/2,s=(n.naturalHeight-o)/2,c=document.createElement('canvas');c.width=t,c.height=t;const u=c.getContext('2d');return u.fillStyle='#ffffff',u.fillRect(0,0,t,t),u.drawImage(n,i,s,o,o,0,0,t,t),c.toDataURL('image/jpeg',.85)};var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},o=r(d[1]),i=r(d[2]);const s=(0,o.create)()((0,i.persist)(e=>({byList:{},put:(t,n)=>e(e=>({byList:{...e.byList,[t]:n}})),drop:t=>e(e=>{const n={...e.byList};return delete n[t],{byList:n}})}),{name:'covercharge-order-logos-v1',storage:(0,i.createJSONStorage)(()=>n.default)}))},1295,[1116,952,1117]); +__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TodaysBookings=function({rid:o,today:s,by:p,app:x}){const v=(0,l.useBookings)(o).filter(e=>e.date===s&&(0,u.ACTIVE)(e)).sort((e,t)=>e.time.localeCompare(t.time)),B=v.reduce((e,t)=>e+(t.diet?.vegan??0),0),C=v.reduce((e,t)=>e+(t.diet?.vegetarian??0),0);return(0,y.jsxs)(n.default,{style:{gap:12},testID:"todays-bookings",children:[(0,y.jsx)(j.CoversToday,{rid:o}),(0,y.jsx)(h.PlattersBooked,{rid:o,date:s,label:"Platters booked today"}),B||C?(0,y.jsxs)(a.T,{colour:c.colours.ok,children:["\u24cb ",B?`${B} vegan`:'',B&&C?' \xb7 ':'',C?`${C} vegetarian`:''," today"]}):null,(0,y.jsx)(h.KitchenSignoffs,{rid:o,today:s,by:p,app:x,showAll:!0}),v.length?v.map(s=>(0,y.jsxs)(n.default,{style:{gap:6,padding:14,borderRadius:16,borderWidth:1,borderColor:c.colours.hairline,backgroundColor:c.colours.surface},children:[(0,y.jsxs)(a.T,{weight:"semibold",children:[s.time," \xb7 ",s.walkIn?`Walk-in ${s.ref}`:s.name," \xb7 ",s.partySize," covers",s.table?` \xb7 ${(0,e.tableNumbers)(s.table)}`:'']}),(0,y.jsx)(t.DepositChip,{b:s,money:!0,testID:`kitchen-deposit-${s.id}`}),(0,y.jsx)(b.BookingTableButton,{rid:o,booking:s,readOnly:'chef'===x}),'chef'!==x&&s.walkIn?(0,y.jsx)(k.CancelWalkInButton,{rid:o,b:s,small:!0}):null,s.notes?(0,y.jsxs)(a.T,{size:16,testID:`kitchen-notes-${s.id}`,children:["Notes: ",s.notes]}):null,(0,y.jsx)(f.BookingEditButton,{rid:o,booking:s,who:p,inStaffApp:'staff'===x}),(0,y.jsx)(h.BookingNeeds,{b:s}),'seated'===(0,u.shownStatus)(s)?(0,y.jsx)(a.Muted,{children:"Seated"}):'finished'===s.status?(0,y.jsx)(a.Muted,{children:"Finished"}):null]},s.id)):(0,y.jsx)(a.Muted,{children:"No bookings today yet."})]})};var e=r(d[0]),t=r(d[1]);r(d[2]);var o,s=r(d[3]),n=(o=s)&&o.__esModule?o:{default:o},a=r(d[4]),l=r(d[5]),u=r(d[6]),c=r(d[7]),h=r(d[8]),b=r(d[9]),k=r(d[10]),f=r(d[11]),j=r(d[12]),y=r(d[13])},1296,[808,951,30,127,813,819,828,821,950,915,949,916,921,24]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"tableButtonLabel",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"tableButtonA11y",{enumerable:!0,get:function(){return s}}),e.tableOptions=function(t,n,o){const s=t.tables.map(t=>t.name).sort(l),c=new Set;return(t.joins??[]).forEach(t=>{t.tables.length>1&&c.add(t.tables.slice().sort(l).join('+'))}),[...n.map(t=>t.table),o].forEach(t=>{const n=a(t);n.length>1&&c.add(n.slice().sort(l).join('+'))}),[...s,...[...c].sort(l)]},e.tableOverlaps=function(t,l,o,s=90){const c=a(l);if(!c.length)return[];const b={...t,table:l};return o.filter(l=>l.id!==t.id&&l.date===t.date&&!['cancelled','noshow','finished'].includes(l.status)&&a(l.table).some(t=>c.includes(t))&&(0,n.startOf)(b)<(0,n.endOf)(l,s)&&(0,n.startOf)(l)<(0,n.endOf)(b,s))},Object.defineProperty(e,"tablePatch",{enumerable:!0,get:function(){return c}});var t=r(d[0]),n=r(d[1]);const a=t=>t?t.split('+').map(t=>t.trim()).filter(Boolean):[],l=(t,n)=>t.localeCompare(n,'en-GB',{numeric:!0}),o=n=>(0,t.tableNumbers)(n)||'No table',s=(n,a)=>`${(0,t.tableNumbersA11y)(n)}${a?'':', change table'}`;const c=t=>({table:t||void 0,tableSetHere:!0})},1297,[808,826]); +__d(function(g,_r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.nextDays=c,Object.defineProperty(_e,"openOn",{enumerable:!0,get:function(){return u}}),_e.BookingDatePicker=function({r:e,today:l,value:b,onChange:m}){const[f,x]=(0,t.useState)(!1),p=(0,r.ymd)(l),j=c(l,9),D=(e,t)=>0===t?'Today':1===t?'Tomorrow':`${(0,r.dayShort)(e)} ${e.getDate()}`,w=j.some(e=>(0,r.ymd)(e)===b),C=(0,r.parseYmd)(b),[P,T]=(0,t.useState)(()=>({y:C.getFullYear(),m:C.getMonth()})),v=(new Date(P.y,P.m,1,12).getDay()+6)%7,M=new Date(P.y,P.m+1,0).getDate(),R=[...Array.from({length:v},()=>null),...Array.from({length:M},(e,t)=>new Date(P.y,P.m,t+1,12))];for(;R.length%7;)R.push(null);const k=12*(P.y-l.getFullYear())+P.m-l.getMonth(),F=e=>T(({y:t,m:o})=>{const s=new Date(t,o+e,1);return{y:s.getFullYear(),m:s.getMonth()}});return(0,i.jsxs)(s.default,{testID:"nb-date",style:{gap:6},children:[(0,i.jsxs)(d.Row,{wrap:!0,gap:6,children:[j.map((t,o)=>(0,i.jsx)(d.Chip,{label:D(t,o),sub:u(e,t)?void 0:'Closed',selected:b===(0,r.ymd)(t),onPress:()=>{m((0,r.ymd)(t)),x(!1)}},(0,r.ymd)(t))),w?null:(0,i.jsx)(d.Chip,{label:(0,r.niceDate)(C),sub:u(e,C)?void 0:'Closed',selected:!0,onPress:()=>x(!0)}),(0,i.jsx)(d.Chip,{label:f?'Close calendar':'\ud83d\udcc5 Pick date',selected:f,onPress:()=>{f||T({y:C.getFullYear(),m:C.getMonth()}),x(!f)}})]}),f?(0,i.jsxs)(s.default,{testID:"nb-calendar",style:{borderWidth:1,borderColor:n.colours.border,borderRadius:14,padding:10,gap:6,backgroundColor:n.colours.surface2,maxWidth:420},children:[(0,i.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,i.jsx)(o.default,{accessibilityRole:"button",accessibilityLabel:"Previous month",disabled:k<=0,onPress:()=>F(-1),style:{padding:8,opacity:k<=0?.3:1},children:(0,i.jsx)(d.T,{size:20,colour:n.colours.gold,children:"\u2039"})}),(0,i.jsxs)(d.T,{weight:"semibold",children:[(0,r.monthLong)(P.m)," ",P.y]}),(0,i.jsx)(o.default,{accessibilityRole:"button",accessibilityLabel:"Next month",disabled:k>=h,onPress:()=>F(1),style:{padding:8,opacity:k>=h?.3:1},children:(0,i.jsx)(d.T,{size:20,colour:n.colours.gold,children:"\u203a"})})]}),(0,i.jsx)(s.default,{style:{flexDirection:'row'},children:y.map(e=>(0,i.jsx)(d.T,{size:12,colour:n.colours.muted,center:!0,style:{flex:1},children:e},e))}),Array.from({length:R.length/7},(t,l)=>(0,i.jsx)(s.default,{style:{flexDirection:'row',gap:4},children:R.slice(7*l,7*l+7).map((t,l)=>{if(!t)return(0,i.jsx)(s.default,{style:{flex:1,height:40}},l);const c=(0,r.ymd)(t),y=c{m(c),x(!1)},style:{flex:1,height:40,borderRadius:10,alignItems:'center',justifyContent:'center',borderWidth:c===p?1.5:0,borderColor:n.colours.gold,backgroundColor:h?n.colours.gold:'transparent',opacity:y?.3:1},children:(0,i.jsx)(d.T,{size:15,weight:h?'bold':'regular',colour:h?n.colours.onGold:f?n.colours.muted:n.colours.text,style:f&&!y?{textDecorationLine:'line-through'}:void 0,children:t.getDate()})},l)})},l)),(0,i.jsx)(d.Muted,{children:"Past dates can\u2019t be booked. Crossed-out days: closed (per the venue\u2019s hours)."})]}):null]})};var t=_r(_d[0]),o=e(_r(_d[1])),s=e(_r(_d[2])),l=_r(_d[3]),r=_r(_d[4]),n=_r(_d[5]),d=_r(_d[6]),i=_r(_d[7]);function c(e,t){const o=new Date(e);return o.setHours(12,0,0,0),Array.from({length:t},(e,t)=>{const s=new Date(o);return s.setDate(o.getDate()+t),s})}const u=(e,t)=>!!(0,l.hoursFor)(e,t),y=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],h=12},1298,[30,263,127,815,818,821,813,24]); +__d(function(g,r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.MenuAllergyCheck=function({rid:e,allergens:j,audience:m="guest"}){const b=(0,t.useMenu)(e),[x,y]=(0,s.useState)(!1);if(!j.length)return null;const{contains:p,may:M,free:k}=(0,c.dishesFor)(b,j),w=k.filter(e=>!e.signOff),S=k.filter(e=>e.signOff),_=j.map(o.allergenLabel).join(', '),C=e=>e.map(e=>e.name).join(', ')||'none';return(0,f.jsxs)(l.default,{testID:"menu-allergy-check",style:{gap:6,borderWidth:1,borderColor:p.length?h.colours.red:h.colours.border,borderRadius:12,padding:10,backgroundColor:h.colours.surface2},children:[(0,f.jsxs)(u.T,{weight:"semibold",children:["Allergy check against the menu (",_,")"]}),(0,f.jsxs)(u.T,{size:14,colour:h.colours.red,children:["Contains: ",p.length," dish",1===p.length?'':'es']}),(0,f.jsxs)(u.T,{size:14,colour:h.colours.amber,children:["May contain: ",M.length]}),(0,f.jsxs)(u.T,{size:14,colour:h.colours.ok,children:["Free from ",1===j.length?'it':'them'," (signed off): ",S.length]}),w.length?(0,f.jsxs)(u.Muted,{children:[w.length," more awaiting the head chef's sign-off, so not shown as safe."]}):null,(0,f.jsx)(n.default,{testID:"menu-allergy-details",accessibilityRole:"button",onPress:()=>y(!x),hitSlop:6,children:(0,f.jsx)(u.T,{size:14,colour:h.colours.gold,children:x?'Hide dishes':'Show dishes'})}),x?(0,f.jsxs)(l.default,{style:{gap:4},children:[(0,f.jsxs)(u.Muted,{children:["Contains: ",C(p)]}),(0,f.jsxs)(u.Muted,{children:["May contain: ",C(M)]}),(0,f.jsxs)(u.Muted,{children:["Free from: ",C(S)]})]}):null,(0,f.jsx)(u.Muted,{children:'guest'===m?'From the kitchen\u2019s signed-off recipe cards. Specials on the board are checked by staff on the day.':'From the signed-off recipe cards. Specials on the board have their own allergens. Still check with the guest and the kitchen.'})]})};var s=r(d[0]),n=e(r(d[1])),l=e(r(d[2])),t=r(d[3]),o=r(d[4]),c=r(d[5]),h=r(d[6]),u=r(d[7]),f=r(d[8])},1299,[30,263,127,819,814,1104,821,813,24]); +__d(function(g,_r,_i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"VAT",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"exVat",{enumerable:!0,get:function(){return n}}),e.dishCost=i,Object.defineProperty(e,"gpPct",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"priceForTarget",{enumerable:!0,get:function(){return c}}),e.costings=function(r,c,s,u){const d=(0,t.dishStats)(r);return c.map(t=>{const c=r.find(r=>r.id===t.dishId);if(!c||null==c.price)return null;const p=i(t,s),l=n(c.price),f=o(p,c.price),b=d.find(t=>t.item.id===c.id)?.sold??0;return{item:c,recipe:t,cost:p,priceInc:c.price,priceEx:l,gp:f,cashGp:l-p,below:ft.prevCost&&t.prevCost!==t.cost).map(s=>{const u=(s.cost-(s.prevCost??s.cost))/(s.prevCost??1)*100,d=r.filter(t=>t.lines.some(t=>t.ing===s.id)).map(r=>{const u=t.find(t=>t.id===r.dishId);if(!u||null==u.price)return null;const d=o(i(r,n,{ing:s.id,cost:s.prevCost}),u.price),p=o(i(r,n),u.price);return{item:u,before:d,after:p,dropped:d>=c&&pt.dropped),below:d.filter(t=>t.below)}})},e.weekGp=function(t,r,n){const i=t.reduce((t,r)=>t+r.priceEx*r.soldWeek,0),o=t.reduce((t,r)=>t+r.cost*r.soldWeek,0),c=o+r+Math.max(0,n);return{sales:i,theoCost:o,actualCost:c,theo:i?(i-o)/i*100:0,actual:i?(i-c)/i*100:0}},Object.defineProperty(e,"fmtQty",{enumerable:!0,get:function(){return s}});var t=_r(_d[0]);const r=.2,n=t=>Math.round(t/1.2);function i(t,r,n){return Math.round(t.lines.reduce((t,i)=>{const o=r.find(t=>t.id===i.ing);return t+(n&&n.ing===i.ing?n.cost:o?.cost??0)*i.qty},0))}const o=(t,r)=>{const i=n(r);return i>0?(i-t)/i*100:0},c=(t,r)=>50*Math.ceil(t/(1-r/100)*1.2/50);const s=(t,r)=>`${Number.isInteger(t)?t:t.toFixed(t<1?3:2).replace(/0+$/,'').replace(/\.$/,'')} ${'each'===r?'':r}`.trim()},1300,[1301]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"hash",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"CHANNELS",{enumerable:!0,get:function(){return n}}),_e.revenueHistory=function(e,n,r=28){const s=[];if(!(0,o.examplesAllowed)())return s;for(let o=r;o>=1;o--){const r=(0,t.addMins)(n,1440*-o),i=!!e.kitchenHours[r.getDay()],d=[1.05,0,0,.6,.7,1,1.2][r.getDay()]*('anchorage'===e.id?1:.6),l=o=>.85+.3*a((0,t.ymd)(r)+o+e.id),u=i?Math.round(24e4*d*l('d')):0,c=i?Math.round(95e3*d*l('t')):0,p=i?Math.round(52e3*d*l('q')):0;s.push({date:r,label:(0,t.niceDate)(r).slice(0,6),byChannel:{'Dine-in':u,Takeaway:c,'Table QR':p},total:u+c+p,covers:i?Math.round(150*d*l('c')):0})}return s},_e.dishStats=function(e){return(0,o.examplesAllowed)()?e.filter(e=>null!=e.price).map(e=>{const t=Math.round(20+260*a(e.id+'s')),o=.24+.22*a(e.id+'c'),n=e.price??0,r=Math.round(n*(1-o));return{item:e,sold:t,revenue:t*n,costPct:o,margin:r,gp:r*t}}):[]},_e.quadrant=function(e,t,o,a){return e>=o?t>=a?'Star':'Plough horse':t>=a?'Puzzle':'Dog'},Object.defineProperty(_e,"QUADRANT_TIP",{enumerable:!0,get:function(){return r}}),_e.crmCustomers=function(){return(0,o.examplesAllowed)()?s.map((e,t)=>{const o=a(e+t);return{id:0===t?'cust-demo':`cr-${t}`,name:`${e} ${i[t]}${0===t?'':' (example)'}`,phone:`07700 900${String(100+7*t).slice(-3)}`,visits:1+Math.round(18*o),lastVisit:`${1+Math.round(27*o)} days ago`,spend:Math.round(3e3+6e4*o),allergies:0===t?['Crustaceans (anaphylaxis)','Mustard']:o>.8?['Gluten (coeliac)']:o<.1?['Peanuts']:[],stamps:0===t?5:Math.round(7*o),optIn:o>.25,channel:n[Math.floor(3*o)%3],birthday:o>.6?`${1+Math.round(27*o)} Nov`:void 0}}):[]},Object.defineProperty(_e,"STOCK",{enumerable:!0,get:function(){return d}}),Object.defineProperty(_e,"stockList",{enumerable:!0,get:function(){return l}}),_e.insights=function(a,n,r,s,i,l,c){const p=[];if(!(0,o.examplesAllowed)())return u(a,n,r,s,i,l,c);const h=new Date(l);h.setDate(h.getDate()+((6-h.getDay()+7)%7||7)),h.setHours(0,0,0,0);const b=(0,e.forecastToday)(a,n,r,s,h),m=Math.round(b.restOfDay.covers/Math.max(1,b.multiplier)),y=Math.max(35,Math.round(100*(b.multiplier-1))+35);p.push({id:'sat',icon:'\ud83d\udcc8',tone:'gold',title:`${(0,t.niceDate)(h)} forecast +${y}%: add 1 server 6\u20139pm`,body:`Example: about ${Math.round(m*(1+y/100))} covers expected vs about ${m} on a usual Saturday (bookings pace + Halloween weekend flag).`,action:{label:'Open rota',tab:'more',sub:'rota'}});const f=(0,e.forecastToday)(a,n,r,s,l),v=d[0],w=Math.ceil((f.restOfDay.covers+2*f.restOfDay.takeaway)*v.perCover);p.push({id:'haddock',icon:'\ud83d\udc1f',tone:'red',title:`Haddock low: ${v.onHand} portions left`,body:`Tonight\u2019s forecast needs about ${w}. Call the supplier before 18:00 or mark the fish supper sold out at ${v.onHand} sold.`,action:{label:'Prep list',tab:'more',sub:'prep'}});const k=s.find(e=>/Burns/.test(e.title));if(k){const e=Math.max(1,Math.round((new Date(k.date).getTime()-l.getTime())/6048e5));p.push({id:'burns',icon:'\ud83e\udd43',tone:'blue',title:`Burns Night in ${e} weeks: open bookings?`,body:'Last year\u2019s equivalent nights sold out about 3 weeks ahead (example). Publish the set menu and push to opted-in regulars.',action:{label:'Plan campaign',tab:'more',sub:'marketing'}})}const M=n.filter(e=>e.date===(0,t.venueYmd)(l)&&'noshow'===e.status).length;p.push({id:'noshow',icon:'\ud83e\ude91',tone:'amber',title:M?`${M} no-show today: deposits for 6+?`:'Deposits for bigger tables (example)',body:'Deposits are set per venue in Settings \u203a Advanced \u203a Deposits. Consider them on Fri/Sat after 19:00.',action:{label:'Bookings',tab:'bookings'}});const C=i.filter(e=>e.stars<=2).length;C&&p.push({id:'reviews',icon:'\ud83d\udcac',tone:'red',title:`${C} low rating this week: cold chips at collection`,body:'Readiness alerts now time bagging 5 min before pickup. Reply to say thanks and invite them back.',action:{label:'Reviews',tab:'more',sub:'reviews'}});return p.push({id:'commission',icon:'\ud83d\udcb7',tone:'ok',title:'You kept about \xa31,240 in commission this month',body:'Example: \xa34,140 of direct takeaway orders that would have cost about 30% on delivery apps.',action:{label:'Analytics',tab:'more',sub:'analytics'}}),p.push({id:'covers',icon:'\ud83c\udf7d\ufe0f',tone:'gold',title:`${c} covers so far today`,body:'Lobster special is the top add-on tonight. Suggest it with the scallops (example).'}),p};var e=_r(_d[0]),t=_r(_d[1]),o=_r(_d[2]);const a=e=>{let t=2166136261;for(let o=0;o>>0)/4294967295},n=['Dine-in','Takeaway','Table QR'];const r={Star:'Keep: high margin and popular. Feature it.','Plough horse':'Popular, low margin: nudge the price or trim the cost.',Puzzle:'High margin, few sales: promote it or rename it.',Dog:'Low margin, few sales: consider removing it.'},s=['Alex','Fiona','Iain','Morag','Callum','Eilidh','Ross','Kirsty','Euan','Shona','Hamish','Isla','Craig','Ailsa','Neil','Catriona'],i=['Morgan','Campbell','Fraser','McLeod','Kerr','Wallace','Boyd','Hamilton','Stewart','Murray','Paterson','Duncan','Gilmour','Reid','Ross','Grant'];const d=[{cat:'Fish & seafood',id:'haddock',name:'Haddock fillets',unit:'portions',onHand:8,perCover:.22,par:40},{cat:'Fruit & veg',id:'chips',name:'Chipping potatoes',unit:'kg',onHand:25,perCover:.18,par:40},{cat:'Fish & seafood',id:'langoustine',name:'Langoustines',unit:'kg',onHand:4,perCover:.03,par:6},{cat:'Fish & seafood',id:'mussels',name:'Mussels',unit:'kg',onHand:10,perCover:.05,par:12},{cat:'Fish & seafood',id:'scallops',name:'Scallops',unit:'portions',onHand:14,perCover:.06,par:20},{cat:'Meat',id:'beef',name:'Burger patties',unit:'each',onHand:30,perCover:.1,par:40},{cat:'Fruit & veg',id:'peas',name:'Garden peas',unit:'kg',onHand:6,perCover:.04,par:8},{cat:'Dairy',id:'tartare',name:'House tartare sauce',unit:'tubs',onHand:5,perCover:.05,par:10}],l=()=>(0,o.examplesAllowed)()?d:[];function u(o,a,n,r,s,i,d){const l=[],u=(0,e.forecastToday)(o,a,n,r,i);u.enough||l.push({id:'history',icon:'\ud83d\udcc5',tone:'gold',title:'Not enough history yet',body:u.suggestions[0]?.replace(/^Not enough history yet\. /,'')??'',action:{label:'Settings \u203a Advanced',tab:'more',sub:'advanced'}});const c=(0,t.ymd)(i),p=a.filter(e=>e.date===c&&'noshow'===e.status).length;p&&l.push({id:'noshow',icon:'\ud83e\ude91',tone:'amber',title:`${p} no-show${1===p?'':'s'} today`,body:'Think about a deposit for larger parties (Settings \u203a Advanced \u203a Deposits).',action:{label:'Bookings',tab:'bookings'}});const h=s.filter(e=>e.stars<=2).length;h&&l.push({id:'reviews',icon:'\ud83d\udcac',tone:'red',title:`${h} low rating${1===h?'':'s'} to read`,body:'Read what they said, reply to say thanks and invite them back.',action:{label:'Reviews',tab:'more',sub:'reviews'}});const b=r.filter(e=>e.date>=c).sort((e,t)=>e.date.localeCompare(t.date))[0];return b&&l.push({id:'event',icon:'\ud83d\udcc5',tone:'blue',title:`Coming up: ${b.title}`,body:`${(0,t.niceDate)(new Date(b.date+'T12:00:00'))}. Check your rota and think about a promo.`,action:{label:'Forecast',tab:'forecast'}}),l.push({id:'covers',icon:'\ud83c\udf7d\ufe0f',tone:'gold',title:`${d} covers so far today`,body:'Seated bookings and walk-ins recorded in CoverCharge today.'}),l}},1301,[870,818,1119]); +__d(function(g,r,i,a,m,e,_d){"use strict";function t(t,n){const o={};for(let c=0;c<7;c++){o[c]={};const u=n[c]??0;for(const[n,s]of Object.entries(t))o[c][Number(n)]=Math.round(s*u)}return o}Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"EXAMPLE_HISTORY",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"EXAMPLE_ACCURACY",{enumerable:!0,get:function(){return f}});const n={12:18,13:26,14:16,15:9,16:10,17:22,18:36,19:38,20:20},o={12:2,13:2,14:1,15:1,16:2,17:4,18:6,19:5,20:2},c={0:1.05,1:0,2:0,3:.6,4:.7,5:1,6:1.15},u={0:.6,1:.5,2:.5,3:.6,4:.7,5:.9,6:1},s={anchorage:{covers:t(n,c),takeaway:t(o,c)},default:{covers:t(n,u),takeaway:t(o,u)}},f='Example: last 4 weeks within \xb118% of actual covers'},1302,[]); +__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DEFAULT_MIN_WEEKS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"clampWeeks",{enumerable:!0,get:function(){return o}}),e.buildHistory=function(o,a,c,u,d,f=n){const l=(0,t.ymd)(d),y=(0,t.ymd)(new Date(d.getTime()-48384e5)),h=t=>t>=y&&tt.rid===o&&h(t.date));for(const t of k)D.add(t.date);const T=[...D].sort(),w=T.length?s(T[0],l):0,j=w>=7*f&&T.length>=2*f,O=t=>{const n={},o={};for(const t of T){const n=new Date(t+'T12:00:00').getDay();o[n]=(o[n]??0)+1}for(const[o,s]of Object.entries(t)){const t=new Date(o+'T12:00:00').getDay();n[t]??={};for(const[o,a]of Object.entries(s))n[t][Number(o)]=(n[t][Number(o)]??0)+a}for(const t of Object.keys(n))for(const s of Object.keys(n[+t]))n[+t][+s]=n[+t][+s]/(o[+t]||1);return n},M=Array.from({length:7},()=>[]);for(const t of k)'number'==typeof t.takings&&t.takings>0&&M[new Date(t.date+'T12:00:00').getDay()].push(Math.round(100*t.takings));const N=M.map(t=>t.length?Math.round(t.reduce((t,n)=>t+n,0)/t.length):null),_=k.filter(t=>'number'==typeof t.takings&&t.takings>0),E=(_.length?s(_.map(t=>t.date).sort()[0],l):0)>=7*f&&_.length>=2*f;return{covers:O(b),takeaway:O(p),days:T.length,spanDays:w,enough:j,minWeeks:f,takingsByDay:N,cashUps:_.length,salesEnough:E}};var t=r(_d[0]);const n=2,o=t=>{const o=Math.round(Number(t));return Number.isFinite(o)&&o>=1&&o<=8?o:n},s=(t,n)=>Math.round((new Date(n+'T12:00:00').getTime()-new Date(t+'T12:00:00').getTime())/864e5)},1303,[818]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"CHEF_ID",{enumerable:!0,get:function(){return x}}),_e.useChef=C,Object.defineProperty(_e,"isLow",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"stockValue",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"within7",{enumerable:!0,get:function(){return v}}),_e.useWeek=function(){const{k:e,c:r,now:t}=C(6e4),o=e.waste.filter(e=>v(e.at,t)).reduce((e,r)=>e+r.cost,0),n=e.stockTakes[0],s=n?n.lines.reduce((e,r)=>e+(r.expected-r.counted)*r.cost,0):0;return{...(0,b.weekGp)(r,o,s),wasteWeek:o,variance:Math.round(s)}},_e.useForecast=function(){const{r:e,rid:r,now:t}=C(6e4),o=(0,i.useBookings)(r),n=(0,i.useOrders)(r),s=(0,i.useEvents)(r),d=(0,u.useRealHistory)(r,t),c=(0,l.forecastToday)(e,o,n,s,t,d??void 0),f=c.hours.reduce((e,r)=>e+r.covers,0),b=c.hours.reduce((e,r)=>e+r.booked,0),p=c.hours.reduce((e,r)=>e+r.historicalCovers,0),y=c.enough&&p?Math.round((f-p)/p*100):0,w=['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'][(0,h.weekday)(t)],x=c.enough?`${w} ${y>=0?'+':''}${y}%${c.example?' (example figures)':''}`:'Not enough history yet';return{f:c,covers:f,booked:b,typical:p,pct:y,day:w,label:x,enough:c.enough,example:c.example}},_e.Tile=function({label:e,value:r,sub:t,tone:o,onPress:s,testID:i}){const d='red'===o?f.colours.red:'amber'===o?f.colours.amber:'ok'===o?f.colours.ok:f.colours.text;return(0,w.jsxs)(n.default,{testID:i,accessibilityRole:s?'button':void 0,accessibilityLabel:`${e}: ${r}`,onPress:s,style:({pressed:e})=>({flexGrow:1,flexBasis:150,minWidth:140,padding:12,borderRadius:14,borderWidth:1,borderColor:'red'===o?f.colours.red:f.colours.border,backgroundColor:e?'#1d1a14':f.colours.surface,gap:2}),children:[(0,w.jsx)(c.Muted,{children:e}),(0,w.jsx)(c.T,{size:22,weight:"bold",colour:d,children:r}),t?(0,w.jsx)(c.T,{size:12,colour:f.colours.muted,children:t}):null]})},_e.Seg=function({value:e,options:r,onChange:t}){return(0,w.jsx)(c.Row,{wrap:!0,gap:6,children:r.map(r=>(0,w.jsx)(n.default,{accessibilityRole:"tab",accessibilityState:{selected:e===r.id},accessibilityLabel:r.label,onPress:()=>t(r.id),style:{paddingHorizontal:12,paddingVertical:7,minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center',borderRadius:999,borderWidth:1,borderColor:e===r.id?f.colours.gold:f.colours.border,backgroundColor:e===r.id?f.colours.goldTint:'transparent'},children:(0,w.jsx)(c.T,{size:13,weight:e===r.id?'semibold':'regular',colour:e===r.id?f.colours.goldLight:f.colours.text,children:r.label})},r.id))})},_e.Bar=function({pct:e,colour:r=f.colours.gold}){return(0,w.jsx)(s.default,{style:{height:6,borderRadius:3,backgroundColor:f.colours.surface2,overflow:'hidden'},children:(0,w.jsx)(s.default,{style:{width:`${Math.max(0,Math.min(100,e))}%`,height:6,backgroundColor:r}})})},Object.defineProperty(_e,"pct1",{enumerable:!0,get:function(){return S}});var r=_r(_d[0]),t=e(_r(_d[1])),o=_r(_d[2]),n=e(_r(_d[3])),s=e(_r(_d[4])),i=_r(_d[5]),d=_r(_d[6]),u=_r(_d[7]),l=_r(_d[8]),c=_r(_d[9]),f=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),p=_r(_d[13]),y=_r(_d[14]),w=_r(_d[15]);const x=y.ROSTER.find(e=>'chef'===e.app)?.id??'';function C(e=3e4){const n=(0,d.useOwner)(e=>e.site),s=(0,i.useRestaurant)(n),u=(0,d.useOwner)(e=>e.staff),l=u.find(e=>e.id===x)?.name??'Head Chef',c=(0,i.useNow)(e),f=(0,i.useAllMenu)(n),h=(0,p.useKitchen)(),y=t.default.useMemo(()=>{const e=r.LIVE_HEAD_CHEF?{...h,...(0,p.stripKitchenExamples)(h)}:h,t=e.ingredients.filter(e=>(0,o.chefCanSee)(n,e)),s=new Set(e.ingredients.filter(e=>!(0,o.chefCanSee)(n,e)).map(e=>e.id));return{...e,ingredients:t,temps:e.temps.filter(e=>(0,o.chefCanSee)(n,e)),waste:e.waste.filter(e=>(0,o.chefCanSee)(n,e)&&!s.has(e.ing||'')),deliveries:e.deliveries.filter(e=>(0,o.chefCanSee)(n,e)).map(e=>({...e,lines:e.lines.filter(e=>!s.has(e.ing))})),orders:e.orders.filter(e=>(0,o.chefCanSee)(n,e)).map(e=>({...e,lines:e.lines.filter(e=>!s.has(e.ing))}))}},[h,n]),w=(0,b.costings)(f,y.recipes,y.ingredients,y.targetGp);return{rid:n,r:s,me:l,now:c,menu:f,k:y,c:w}}const k=(e,r)=>e>0&&e<.5*r,j=e=>Math.round(e.reduce((e,r)=>e+r.onHand*r.cost,0)),v=(e,r)=>r.getTime()-new Date(e).getTime()<6048e5;const S=e=>`${e.toFixed(1)}%`},1304,[1231,30,1024,263,127,819,856,1305,870,813,821,927,1300,1203,14,24]); +__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.useRealHistory=function(e,t){const o=(0,l.useExamples)(),n=(0,r.useBookings)(e),c=(0,r.useOrders)(e),f=(0,u.useCashUp)(e=>e.cashUps),y=(0,k.clampWeeks)((0,h.useStore)(s=>s.restaurants.find(s=>s.id===e)?.settings.forecastMinWeeks)),b=t.toDateString();return(0,s.useMemo)(()=>o?null:(0,k.buildHistory)(e,n,c,f.map(e=>({rid:e.rid,date:e.date,takings:(0,p.takings)(e.vals)})),t,y),[o,e,n,c,f,y,b])},Object.defineProperty(_e,"ExampleBadge",{enumerable:!0,get:function(){return b}}),_e.NotEnoughHistory=function({weeks:e,booked:s,what:t="Forecasts",testID:r="not-enough-history"}){return(0,y.jsx)(n.Card,{children:(0,y.jsxs)(o.default,{testID:r,style:{gap:6},children:[(0,y.jsx)(n.T,{weight:"semibold",colour:f.colours.gold,children:"Not enough history yet"}),(0,y.jsx)(n.Muted,{children:'Forecasts'===t?(0,c.notEnoughTip)(e):`${t} start once CoverCharge has ${1===e?'1 week':`${e} weeks`} of your bookings and cash-ups.`}),s?(0,y.jsx)(o.default,{testID:`${r}-booked`,children:(0,y.jsxs)(n.T,{children:["Booked so far: ",s," covers"]})}):null,(0,y.jsx)(n.Muted,{children:"Tip: upload or add your bookings and do the cash up each night. Managers can change how much history is needed in Settings \u203a Advanced."})]})})};var e,s=_r(d[0]),t=_r(d[1]),o=(e=t)&&e.__esModule?e:{default:e},n=_r(d[2]),r=_r(d[3]),u=_r(d[4]),c=_r(d[5]),l=_r(d[6]),h=_r(d[7]),p=_r(d[8]),k=_r(d[9]),f=_r(d[10]),y=_r(d[11]);const b=()=>(0,y.jsx)(n.Badge,{kind:"amber",label:c.EXAMPLE_LABEL.toUpperCase()})},1305,[30,127,813,819,1093,1119,1306,872,1109,1303,821,24]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useExamples",{enumerable:!0,get:function(){return l}});var t=r(d[0]),n=r(d[1]);const l=()=>(0,t.useSyncExternalStore)(n.onDataModeChange,n.examplesAllowed,n.examplesAllowed)},1306,[30,1119]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GpScreen=function({initial:e="dishes"}){const[t,l]=(0,s.useState)(e),{k:o}=(0,c.useChef)(),d=(0,a.useKitchen)(e=>e.setTarget);return(0,h.jsxs)(i.default,{style:{gap:12},children:[(0,h.jsx)(n.Card,{children:(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsxs)(i.default,{style:{flex:1},children:[(0,h.jsx)(n.T,{weight:"semibold",children:"Target GP"}),(0,h.jsx)(n.Muted,{children:"Dishes under target are flagged red."})]}),(0,h.jsx)(n.Button,{small:!0,kind:"secondary",label:"\u2212",accessibilityLabel:"Lower target",onPress:()=>d(o.targetGp-1)}),(0,h.jsxs)(n.T,{size:22,weight:"bold",colour:r.colours.gold,children:[o.targetGp,"%"]}),(0,h.jsx)(n.Button,{small:!0,kind:"secondary",label:"+",accessibilityLabel:"Raise target",onPress:()=>d(o.targetGp+1)})]})}),(0,h.jsx)(c.Seg,{value:t,onChange:l,options:[{id:'dishes',label:'Recipe cards & GP'},{id:'changes',label:'Price changes'},{id:'week',label:'Theoretical vs actual'},{id:'engineering',label:'Menu engineering'}]}),'dishes'===t?(0,h.jsx)(u,{}):'changes'===t?(0,h.jsx)(j,{}):'week'===t?(0,h.jsx)(b,{}):(0,h.jsx)(w,{})]})};var s=_r(_d[0]),t=e(_r(_d[1])),i=e(_r(_d[2])),n=_r(_d[3]),l=_r(_d[4]),r=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),a=_r(_d[9]),h=_r(_d[10]);function u(){const{c:e,k:t}=(0,c.useChef)(),[l,r]=(0,s.useState)(null),o=e.filter(e=>e.below),d=[...e].sort((e,s)=>e.gp-s.gp),a=e.find(e=>e.item.id===l);return e.length?(0,h.jsxs)(i.default,{style:{gap:10},children:[(0,h.jsx)(n.Muted,{children:"Menu prices include VAT (20%). GP is worked out on the price ex VAT: (price ex VAT \u2212 dish cost) \xf7 price ex VAT. VAT figures are for information only."}),o.length?(0,h.jsxs)(n.Banner,{kind:"danger",title:`${o.length} of ${e.length} dishes below ${t.targetGp}%`,children:[o.slice(0,6).map(e=>e.item.name).join(', '),o.length>6?'\u2026':'']}):(0,h.jsx)(n.Banner,{kind:"success",title:"All costed dishes on target"}),d.map(e=>(0,h.jsx)(p,{d:e,onPress:()=>r(e.item.id)},e.item.id)),(0,h.jsx)(n.Sheet,{visible:!!a,onClose:()=>r(null),title:a?.item.name??'',children:a?(0,h.jsx)(x,{d:a}):null})]}):(0,h.jsx)(n.Muted,{children:"No costed dishes yet. Add your real recipes and ingredient costs to see GP."})}function p({d:e,onPress:s}){return(0,h.jsxs)(t.default,{accessibilityRole:"button",accessibilityLabel:`${e.item.name}, GP ${e.gp.toFixed(1)} percent`,onPress:s,style:({pressed:s})=>({padding:12,borderRadius:12,borderWidth:1,borderColor:e.below?r.colours.red:r.colours.border,backgroundColor:s?'#1d1a14':e.below?r.colours.redBg:r.colours.surface,gap:2}),children:[(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{weight:"medium",style:{flex:1},children:e.item.name}),(0,h.jsx)(n.T,{weight:"bold",colour:e.below?r.colours.red:r.colours.ok,children:(0,c.pct1)(e.gp)})]}),(0,h.jsxs)(n.Muted,{children:["Cost ",(0,l.gbp)(e.cost)," \xb7 ",(0,l.gbp)(e.priceInc)," inc VAT (",(0,l.gbp)(e.priceEx)," ex) \xb7 cash GP ",(0,l.gbp)(e.cashGp)]}),e.below?(0,h.jsxs)(n.T,{size:12,colour:r.colours.red,children:["Below ",e.target,"%: price for target ",(0,l.gbp)((0,d.priceForTarget)(e.cost,e.target))," inc VAT"]}):null]})}function x({d:e}){const s=(0,a.useKitchen)(),t=s.recipes.find(s=>s.dishId===e.item.id);return(0,h.jsxs)(i.default,{style:{gap:8},children:[(0,h.jsxs)(n.Muted,{children:["Recipe card \xb7 ",t.yield]}),t.lines.map(t=>{const r=s.ingredients.find(e=>e.id===t.ing);if(!r)return null;const o='each'===r.unit?1:'kg'===r.unit&&t.qty<.1?.005:.01;return(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsxs)(i.default,{style:{flex:1},children:[(0,h.jsx)(n.T,{size:14,children:r.name}),(0,h.jsxs)(n.Muted,{children:[(0,l.gbp)(r.cost)," per ",r.unit]})]}),(0,h.jsx)(n.Button,{small:!0,kind:"ghost",label:"\u2212",accessibilityLabel:`Less ${r.name}`,onPress:()=>s.setRecipeQty(e.item.id,t.ing,Math.max(0,Math.round(1e3*(t.qty-o))/1e3))}),(0,h.jsx)(n.T,{size:13,style:{width:64,textAlign:'center'},children:(0,d.fmtQty)(t.qty,r.unit)}),(0,h.jsx)(n.Button,{small:!0,kind:"ghost",label:"+",accessibilityLabel:`More ${r.name}`,onPress:()=>s.setRecipeQty(e.item.id,t.ing,Math.round(1e3*(t.qty+o))/1e3)}),(0,h.jsx)(n.T,{size:13,style:{width:60,textAlign:'right'},children:(0,l.gbp)(Math.round(r.cost*t.qty))})]},t.ing)}),(0,h.jsxs)(i.default,{style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:8,gap:4},children:[(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{children:"Dish cost"}),(0,h.jsx)(n.T,{weight:"semibold",children:(0,l.gbp)(e.cost)})]}),(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{children:"Selling price inc VAT"}),(0,h.jsx)(n.T,{children:(0,l.gbp)(e.priceInc)})]}),(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.Muted,{children:"VAT (20%, for info)"}),(0,h.jsx)(n.Muted,{children:(0,l.gbp)(e.priceInc-e.priceEx)})]}),(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{children:"Price ex VAT"}),(0,h.jsx)(n.T,{children:(0,l.gbp)(e.priceEx)})]}),(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{children:"Cash GP"}),(0,h.jsx)(n.T,{weight:"semibold",children:(0,l.gbp)(e.cashGp)})]}),(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{children:"GP %"}),(0,h.jsx)(n.T,{weight:"bold",colour:e.below?r.colours.red:r.colours.ok,children:(0,c.pct1)(e.gp)})]}),(0,h.jsxs)(n.Banner,{kind:e.below?'warn':'info',title:`Price that hits ${e.target}%: ${(0,l.gbp)((0,d.priceForTarget)(e.cost,e.target))} inc VAT`,children:["Or bring the dish cost down to ",(0,l.gbp)(Math.floor(e.priceEx*(1-e.target/100))),". Prices are changed in CoverCharge for Managers (Menu & allergens)."]})]})]})}function j(){const{menu:e,k:s}=(0,c.useChef)(),t=(0,d.priceImpacts)(e,s.recipes,s.ingredients,s.targetGp);return t.length?(0,h.jsx)(i.default,{style:{gap:10},children:t.map(e=>(0,h.jsxs)(n.Card,{highlight:e.dropped.length?r.colours.red:void 0,children:[(0,h.jsxs)(n.T,{weight:"semibold",children:[e.ing.name," ",e.pct>0?'+':'',e.pct.toFixed(0),"%: ",e.dropped.length," dish",1===e.dropped.length?'':'es'," drop below target"]}),(0,h.jsxs)(n.Muted,{children:[(0,l.gbp)(e.ing.prevCost??0)," \u2192 ",(0,l.gbp)(e.ing.cost)," per ",e.ing.unit]}),e.dishes.map(e=>(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{size:14,style:{flex:1},children:e.item.name}),(0,h.jsxs)(n.T,{size:13,colour:r.colours.muted,children:[(0,c.pct1)(e.before)," \u2192 "]}),(0,h.jsx)(n.T,{size:13,weight:"semibold",colour:e.below?r.colours.red:r.colours.ok,children:(0,c.pct1)(e.after)}),e.dropped?(0,h.jsx)(n.Badge,{kind:"red",label:"NOW BELOW"}):null]},e.item.id))]},e.ing.id))}):(0,h.jsx)(n.Muted,{children:"No ingredient price changes since the last deliveries."})}function b(){const{k:e}=(0,c.useChef)(),s=(0,c.useWeek)();return s.sales?(0,h.jsxs)(i.default,{style:{gap:10},children:[(0,h.jsxs)(n.Row,{wrap:!0,gap:10,children:[(0,h.jsx)(c.Tile,{label:"Theoretical GP (recipes \xd7 sales)",value:(0,c.pct1)(s.theo),tone:s.theoe.soldWeek>0),t=s.reduce((e,s)=>e+s.soldWeek,0)/Math.max(1,s.length),r=s.reduce((e,s)=>e+s.cashGp,0)/Math.max(1,s.length),d={Star:[],'Plough horse':[],Puzzle:[],Dog:[]};return s.forEach(e=>d[(0,o.quadrant)(e.soldWeek,e.cashGp,t,r)].push(e)),(0,h.jsxs)(i.default,{style:{gap:10},children:[s.length?(0,h.jsx)(n.Muted,{children:"Popularity (sold per week) against cash GP per dish, using the live menu from CoverCharge for Managers. Example sales figures."}):(0,h.jsx)(n.Muted,{children:"Needs dish sales figures, which CoverCharge doesn't have on a real venue yet (no till link). Nothing is guessed."}),Object.keys(d).map(e=>(0,h.jsxs)(n.Card,{children:[(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{weight:"semibold",children:'Star'===e?'\u2b50 Stars':'Plough horse'===e?'\ud83d\udc0e Plough horses':'Puzzle'===e?'\u2754 Puzzles':'\ud83d\udc15 Dogs'}),(0,h.jsx)(n.Badge,{kind:"gold",label:`${d[e].length}`})]}),(0,h.jsx)(n.Muted,{children:o.QUADRANT_TIP[e]}),d[e].map(e=>(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{size:14,style:{flex:1},children:e.item.name}),(0,h.jsxs)(n.Muted,{children:[e.soldWeek,"/wk \xb7 ",(0,l.gbp)(e.cashGp)," \xb7 ",(0,c.pct1)(e.gp)]})]},e.item.id))]},e))]})}},1307,[30,263,127,813,816,821,1301,1300,1304,1203,24]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.PrepScreen=function(){const{k:e,menu:t,me:s,now:i}=(0,M.useChef)(),{covers:n,label:r,typical:l,enough:a,booked:o,f:c}=(0,M.useForecast)(),f=(0,w.ymd)(i),m=(0,T.dishStats)(t).filter(t=>e.recipes.some(e=>e.dishId===t.item.id)&&!['Sides','Desserts'].includes(t.item.section)),p=m.reduce((e,t)=>e+t.sold,0)||1,x=m.map(e=>({id:e.item.id,name:e.item.name,qty:Math.ceil(.85*n*(e.sold/p)*1.1)})).filter(e=>e.qty>0).sort((e,t)=>t.qty-e.qty),y={};x.forEach(t=>e.recipes.find(e=>e.dishId===t.id)?.lines.forEach(e=>{y[e.ing]=(y[e.ing]??0)+e.qty*t.qty}));const b=[{id:'haddock',text:`Portion ${x.filter(e=>['a-fishsupper','a-mini','a-tempura'].includes(e.id)).reduce((e,t)=>e+t.qty,0)} haddock portions (fish supper, tempura, Mini Anchors)`},{id:'chips',text:`Peel, cut and blanch ${(0,v.fmtQty)(Math.ceil(2*(y.potatoes??0))/2,'kg')} chipping potatoes`},{id:'batter',text:`Make up ${(0,v.fmtQty)(Math.ceil(10*(y.batter??0))/10+.5,'kg')} beer batter`},{id:'leaves',text:`Wash and spin ${(0,v.fmtQty)(Math.ceil(10*(y.leaves??0))/10,'kg')} salad leaves`},{id:'mussels',text:`Clean and debeard ${(0,v.fmtQty)(Math.ceil(2*(y.mussels??0))/2,'kg')} mussels (discard any open that don't close)`},{id:'sauce',text:'Garlic butter, tartare and Marie Rose: check, make and date-label'}],j=(0,B.useKitchen)(e=>e.tickPrep),C=[...b.map(e=>({key:`${f}:task:${e.id}`,text:e.text})),...x.map(e=>({key:`${f}:dish:${e.id}`,text:`${e.qty} \xd7 ${e.name}`}))],S=C.filter(t=>e.prepTicks[t.key]).length;return e.recipes.length&&e.ingredients.length?(0,D.jsxs)(h.default,{style:{gap:10},children:[a?null:(0,D.jsx)(u.Banner,{kind:"info",title:`Booked so far: ${o} covers`,children:`Not enough history yet. Forecasts start once CoverCharge has ${c.minWeeks} weeks of your bookings and cash-ups. Prep from what is booked and your own judgement.`}),a?(0,D.jsxs)(u.Banner,{kind:"info",title:`${r}: ${n} covers forecast`,children:["A typical ",r.split(' ')[0]," is about ",l," covers. Portions below are scaled from the forecast, bookings and the usual dish mix, plus 10% cover."]}):null,(0,D.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,D.jsx)(u.T,{weight:"semibold",children:"Prep list for today"}),(0,D.jsx)(u.Badge,{kind:S===C.length?'ok':'gold',label:`${S}/${C.length} done`})]}),C.map((t,i)=>{const n=e.prepTicks[t.key];return(0,D.jsxs)(d.default,{accessibilityRole:"checkbox",accessibilityState:{checked:!!n},accessibilityLabel:t.text,onPress:()=>j(t.key,n?null:s),style:{flexDirection:'row',gap:10,alignItems:'center',padding:10,borderRadius:10,borderWidth:1,borderColor:n?k.colours.ok:k.colours.border,backgroundColor:k.colours.surface,marginTop:i===b.length?8:0},children:[(0,D.jsx)(u.T,{size:18,colour:n?k.colours.ok:k.colours.muted,children:n?'\u2611':'\u2610'}),(0,D.jsxs)(h.default,{style:{flex:1},children:[(0,D.jsx)(u.T,{size:14,style:n?{textDecorationLine:'line-through',color:k.colours.muted}:void 0,children:t.text}),n?(0,D.jsxs)(u.Muted,{children:[n.by," \xb7 ",new Date(n.at).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})]}):null]})]},t.key)})]}):(0,D.jsx)(u.Muted,{children:"No prep list yet. Add your real recipe costs and ingredients to build it."})},_e.WasteScreen=function(){const{k:e,me:n,now:r,rid:l}=(0,M.useChef)(),a=(0,M.useWeek)(),d=(0,B.useKitchen)(e=>e.addWaste),[f,m]=(0,o.useState)(e.ingredients[0]?.id),[p,x]=(0,o.useState)(''),[y,j]=(0,o.useState)('Over-production'),w=e.ingredients.find(e=>e.id===f),C=Number(p.replace(',','.'))||0,S=C>=0&&(!w||!(0,s.fishInStone)(l,w)||Number.isInteger(2*C)),T=w&&S?(0,s.inputQuantity)(l,w,C):0,v=e.waste.filter(e=>(0,M.within7)(e.at,r));return w?(0,D.jsxs)(h.default,{style:{gap:10},children:[(0,D.jsxs)(u.Row,{wrap:!0,gap:10,children:[(0,D.jsx)(M.Tile,{label:"Waste this week",value:(0,b.gbp)(a.wasteWeek),sub:`${v.length} entries`,tone:a.sales&&a.wasteWeek/a.sales>.02?'amber':'ok'}),(0,D.jsx)(M.Tile,{label:"Waste as % of food sales",value:a.sales?(0,M.pct1)(a.wasteWeek/a.sales*100):'\u2014',sub:a.sales?'Food sales ex VAT, this week':'Needs dish sales (no till link yet)'})]}),(0,D.jsxs)(u.Card,{children:[(0,D.jsx)(u.T,{weight:"semibold",children:"Log waste"}),(0,D.jsx)(c.default,{horizontal:!0,showsHorizontalScrollIndicator:!1,children:(0,D.jsx)(u.Row,{gap:6,children:e.ingredients.map(e=>(0,D.jsx)(u.Chip,{label:e.name,selected:e.id===f,onPress:()=>m(e.id)},e.id))})}),(0,D.jsxs)(u.Row,{gap:8,children:[(0,D.jsx)(t.TextInput,{accessibilityLabel:`Waste quantity in ${(0,s.quantityUnit)(l,w)}`,accessibilityValue:{text:(0,i.ingredientSpeech)(l,w,T)},keyboardType:"decimal-pad",value:p,onChangeText:x,placeholder:`qty (${(0,s.quantityUnit)(l,w)})`,placeholderTextColor:k.colours.muted,style:{flex:1,minHeight:44,borderWidth:1,borderColor:k.colours.border,borderRadius:8,padding:8,color:k.colours.text}}),(0,D.jsx)(u.T,{children:(0,s.quantityUnit)(l,w)}),(0,D.jsx)(u.T,{weight:"semibold",colour:k.colours.gold,children:(0,b.gbp)(Math.round(T*w.cost))})]}),(0,s.fishInStone)(l,w)?(0,D.jsxs)(u.Row,{children:[(0,D.jsx)(u.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:`Waste half a stone less ${w.name}`,onPress:()=>x(String(Math.max(0,(0,s.halfStone)(C)-.5)))}),(0,D.jsx)(u.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:`Waste half a stone more ${w.name}`,onPress:()=>x(String((0,s.halfStone)(C)+.5))}),(0,D.jsx)(u.Muted,{children:"Half-stone amounts"})]}):null,(0,D.jsx)(u.Row,{wrap:!0,gap:6,children:B.WASTE_REASONS.map(e=>(0,D.jsx)(u.Chip,{label:e,selected:e===y,onPress:()=>j(e)},e))}),(0,D.jsx)(u.Button,{label:"Add to waste log",disabled:T<=0,onPress:()=>{d({by:n,item:w.name,ing:w.id,qty:T,unit:w.unit,reason:y,cost:Math.round(T*w.cost)}),x('')}}),(0,D.jsx)(u.Muted,{children:"Logged waste also comes off stock."})]}),e.waste.slice(0,20).map(e=>(0,D.jsxs)(u.Row,{style:{justifyContent:'space-between',paddingVertical:2},children:[(0,D.jsxs)(h.default,{style:{flex:1},children:[(0,D.jsxs)(u.T,{size:14,children:[e.item," \xb7 ",(0,i.ingredientQty)(l,{name:e.item,unit:e.unit},e.qty)]}),(0,D.jsxs)(u.Muted,{children:[e.reason," \xb7 ",new Date(e.at).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'})," \xb7 ",e.by]})]}),(0,D.jsx)(u.T,{size:14,children:(0,b.gbp)(e.cost)})]},e.id))]}):(0,D.jsx)(u.Muted,{children:"No stock items yet. Add your real ingredients before logging waste."})},_e.AllergenScreen=function({openCards:e}={}){const{k:t,me:s,rid:i}=(0,M.useChef)(),n=(0,f.useRecipeCards)(i),r=(0,x.auditView)('chef',(0,f.useAudit)(i)).filter(e=>/allergen|recipe card|sign/i.test(e.text)).slice(0,12),l=n.slice().sort((e,t)=>e.section.localeCompare(t.section)||e.dish.localeCompare(t.dish)).map(e=>{const s=t.recipes.find(t=>t.dishId===e.menuItemId),i=new Set(s?s.lines.flatMap(e=>t.ingredients.find(t=>t.id===e.ing)?.allergens??[]):[]),n=[...i].filter(t=>!e.allergens[t]);return{card:e,fromCosting:i,missing:n}}),a={name:s,role:'head-chef'};return(0,D.jsxs)(h.default,{style:{gap:10},testID:"allergen-matrix",children:[(0,D.jsx)(u.Muted,{children:"The 14 allergens from each recipe card (C contains, m may contain). These are what guests see on the menu, takeaway and the booking allergy check. A red cell means the costing recipe uses an ingredient with that allergen but the card doesn't list it."}),e?(0,D.jsx)(u.Button,{testID:"open-recipe-cards",small:!0,kind:"secondary",label:"Open recipe cards \u203a",onPress:e}):null,(0,D.jsx)(c.default,{horizontal:!0,children:(0,D.jsxs)(h.default,{children:[(0,D.jsxs)(u.Row,{gap:0,children:[(0,D.jsx)(h.default,{style:{width:150},children:(0,D.jsx)(u.Muted,{children:"Dish"})}),y.ALLERGENS.map(e=>(0,D.jsx)(h.default,{style:{width:34,alignItems:'center'},children:(0,D.jsx)(u.T,{size:10,colour:k.colours.muted,children:e.short})},e.id))]}),l.map(({card:e,fromCosting:t})=>(0,D.jsxs)(u.Row,{gap:0,style:{borderTopWidth:1,borderColor:k.colours.border,paddingVertical:4},children:[(0,D.jsx)(h.default,{style:{width:150},children:(0,D.jsx)(u.T,{size:12,numberOfLines:2,children:e.dish})}),y.ALLERGENS.map(s=>{const i=e.allergens[s.id],n=t.has(s.id)&&!i;return(0,D.jsx)(h.default,{accessibilityLabel:`${e.dish} ${s.label}: ${'contains'===i?'contains':'may'===i?'may contain':n?'in the costing recipe, not on the card':'no'}`,style:{width:34,height:24,alignItems:'center',justifyContent:'center',backgroundColor:n?k.colours.redBg:'transparent'},children:(0,D.jsx)(u.T,{size:11,weight:'contains'===i?'bold':'regular',colour:n?k.colours.red:'contains'===i?k.colours.gold:i?k.colours.muted:'#444',children:'contains'===i?'C':'may'===i?'m':n?'!':'\xb7'})},s.id)})]},e.id))]})}),(0,D.jsx)(u.Muted,{children:"C card says contains \xb7 m may contain \xb7 ! in the costing recipe but not on the card"}),l.filter(e=>e.missing.length||!e.card.signOff).map(({card:t,missing:s})=>(0,D.jsxs)(u.Card,{highlight:s.length?k.colours.red:k.colours.amber,children:[(0,D.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,D.jsx)(u.T,{weight:"semibold",style:{flex:1},children:t.dish}),t.signOff?(0,D.jsx)(u.Badge,{kind:"ok",label:"Signed off"}):(0,D.jsx)(u.Badge,{kind:"amber",label:"Awaiting sign-off"})]}),s.length?(0,D.jsxs)(u.T,{size:13,colour:k.colours.red,children:["Costing recipe has ",s.map(e=>y.ALLERGENS.find(t=>t.id===e)?.short).join(', '),", not on the card"]}):null,(0,D.jsxs)(u.Row,{wrap:!0,gap:8,children:[s.length?(0,D.jsx)(u.Button,{small:!0,label:"Add to the card",onPress:()=>{const e={...t.allergens};s.forEach(t=>{e[t]='contains'}),(0,m.recipeCards)().update(t.id,{allergens:e},a).catch(()=>{})}}):null,e?(0,D.jsx)(u.Button,{small:!0,kind:"secondary",label:"Check and sign off on the card",onPress:e}):null]})]},t.id)),(0,D.jsxs)(u.Card,{children:[(0,D.jsx)(u.T,{weight:"semibold",children:"Audit log"}),r.length?r.map(e=>(0,D.jsxs)(u.Muted,{children:[new Date(e.at).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})," \xb7 ",e.text]},e.id)):(0,D.jsx)(u.Muted,{children:"No allergen changes yet."})]})]})},_e.ComplianceScreen=function(){const{k:e,me:s,now:i,rid:r}=(0,M.useChef)(),l=(0,w.ymd)(i),a=(0,B.useKitchen)(e=>e.addTemp),c=(0,p.useOwner)(e=>e.checks),{tick:f,untick:m}=p.useOwner.getState(),[x,y]=(0,o.useState)('fridge'),b=A.find(e=>e.id===x),j={...b,units:b.units.filter(e=>(0,n.chefCanSee)(r,e))},[C,S]=(0,o.useState)(j.units[0]),[T,v]=(0,o.useState)(''),R=Number(T.replace(',','.')),$=T.trim()&&!Number.isNaN(R)?j.ok(R):null,I=e.temps.filter(e=>e.at.slice(0,10)===l),L=(e,t,i)=>{const n=c[e];return(0,D.jsxs)(d.default,{accessibilityRole:"checkbox",accessibilityState:{checked:!!n},accessibilityLabel:t,onPress:()=>n?m(e):f(e,s,(new Date).toISOString()),style:{flexDirection:'row',gap:10,alignItems:'center',paddingVertical:6},children:[(0,D.jsx)(u.T,{size:18,colour:n?k.colours.ok:k.colours.muted,children:n?'\u2611':'\u2610'}),(0,D.jsxs)(h.default,{style:{flex:1},children:[(0,D.jsx)(u.T,{size:14,children:t}),(0,D.jsx)(u.Muted,{children:n?`${n.by} \xb7 ${new Date(n.at).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})}`:i??''})]})]},e)};return(0,D.jsxs)(h.default,{style:{gap:10},children:[(0,D.jsxs)(u.Card,{children:[(0,D.jsx)(u.T,{weight:"semibold",children:"Record a temperature"}),(0,D.jsx)(u.Row,{wrap:!0,gap:6,children:A.map(e=>(0,D.jsx)(u.Chip,{label:e.label,selected:e.id===x,onPress:()=>{y(e.id),S(e.units.filter(e=>(0,n.chefCanSee)(r,e))[0])}},e.id))}),(0,D.jsx)(u.Row,{wrap:!0,gap:6,children:j.units.map(e=>(0,D.jsx)(u.Chip,{label:e,selected:e===C,onPress:()=>S(e)},e))}),(0,D.jsx)(u.Muted,{children:j.rule}),(0,D.jsxs)(u.Row,{gap:8,children:[(0,D.jsx)(t.TextInput,{accessibilityLabel:"Temperature in degrees C",keyboardType:"numbers-and-punctuation",value:T,onChangeText:v,placeholder:"\xb0C",placeholderTextColor:k.colours.muted,style:{width:90,borderWidth:1,borderColor:k.colours.border,borderRadius:8,padding:8,color:k.colours.text}}),null===$?null:(0,D.jsx)(u.Badge,{kind:!0===$?'ok':'warn'===$?'amber':'red',label:!0===$?'OK':'warn'===$?'CHECK':'OUT OF RANGE'}),(0,D.jsx)(u.Button,{small:!0,label:"Save",disabled:null===$,onPress:()=>{a({by:s,kind:x,unit:C,temp:R,note:!0===$?void 0:'Action needed'}),v('')}})]}),!1===$?(0,D.jsx)(u.Banner,{kind:"danger",title:"Out of range",children:"Record what you did (e.g. moved food, called the engineer, cooked longer) and re-check."}):null]}),(0,D.jsxs)(u.Card,{children:[(0,D.jsxs)(u.T,{weight:"semibold",children:["Today's readings (",I.length,")"]}),I.length?I.map(e=>{const t=A.find(t=>t.id===e.kind)?.ok(e.temp);return(0,D.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,D.jsx)(u.T,{size:14,style:{flex:1},children:e.unit}),(0,D.jsx)(u.Muted,{children:new Date(e.at).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})}),(0,D.jsxs)(u.T,{size:14,weight:"semibold",colour:!0===t?k.colours.ok:'warn'===t?k.colours.amber:k.colours.red,children:[e.temp,"\xb0C"]})]},e.id)}):(0,D.jsx)(u.Muted,{children:"None yet today."})]}),(0,D.jsxs)(u.Card,{children:[(0,D.jsx)(u.T,{weight:"semibold",children:"Opening and closing checks"}),(0,D.jsx)(u.Muted,{children:"Day-to-day checks in the style of a CookSafe diary. Your own CookSafe manual is the record that counts."}),P.map(e=>L(`${l}:kc-${e.id}`,e.text))]}),(0,D.jsxs)(u.Card,{children:[(0,D.jsx)(u.T,{weight:"semibold",children:"Cleaning schedule"}),N.map(e=>L('Daily'===e.freq?`${l}:kcl-${e.id}`:`wk${Math.floor(i.getTime()/6048e5)}:kcl-${e.id}`,e.text,e.freq))]})]})},_e.TeamScreen=function(){const{rid:e,r:t,me:s,now:i,menu:n}=(0,M.useChef)(15e3),[r,a]=(0,o.useState)('live'),d=(0,S.useSignedIn)(),c=(0,o.useMemo)(()=>({meId:d?.id??M.CHEF_ID,role:'staff'}),[d?.id]);return(0,D.jsx)(C.ChatAsCtx.Provider,{value:c,children:(0,D.jsxs)(h.default,{style:{gap:10},children:[(0,D.jsx)(q,{sub:r,setSub:a}),'live'===r?(0,D.jsx)(E,{}):'soldout'===r?(0,D.jsx)(l.SoldOutList,{rid:e,by:s}):'team'===r?(0,D.jsx)(G,{}):(0,D.jsx)(W,{}),void 0,void 0,void 0,void 0,void 0]})})};var t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),n=_r(_d[3]),r=_r(_d[4]),l=_r(_d[5]),a=_r(_d[6]),o=_r(_d[7]),d=e(_r(_d[8])),c=e(_r(_d[9])),h=e(_r(_d[10])),u=_r(_d[11]),f=_r(_d[12]),m=_r(_d[13]),p=_r(_d[14]),x=_r(_d[15]),y=_r(_d[16]),b=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),k=_r(_d[20]),C=_r(_d[21]),S=_r(_d[22]),T=_r(_d[23]),v=_r(_d[24]),R=_r(_d[25]),$=_r(_d[26]),M=_r(_d[27]),B=_r(_d[28]),I=_r(_d[29]),L=_r(_d[30]),O=_r(_d[31]),z=_r(_d[32]),D=_r(_d[33]);const A=[{id:'fridge',label:'Fridge',units:['Walk-in fridge','Prep fridge','Bar fridge'],rule:'Target 5\xb0C or below (8\xb0C maximum)',ok:e=>e<=5||e<=8&&'warn'},{id:'freezer',label:'Freezer',units:['Chest freezer','Upright freezer'],rule:'Target \u221218\xb0C or below',ok:e=>e<=-18||e<=-15&&'warn'},{id:'cook',label:'Cooking (core)',units:['Fish','Chicken','Pie','Burger'],rule:'Core 75\xb0C or above',ok:e=>e>=75},{id:'reheat',label:'Reheating',units:['Soup','Skink','Sauce'],rule:'Core 82\xb0C or above (Scotland)',ok:e=>e>=82},{id:'hot hold',label:'Hot holding',units:['Bain-marie','Soup kettle'],rule:'63\xb0C or above',ok:e=>e>=63},{id:'cool',label:'Cooling',units:['Stock','Rice','Braise'],rule:'Below 8\xb0C, cooled as quickly as possible (aim for 90 minutes)',ok:e=>e<8||'warn'}],N=[{id:'surfaces',text:'Work surfaces and boards cleaned and sanitised',freq:'Daily'},{id:'fryers',text:'Fryers filtered, oil checked',freq:'Daily'},{id:'floors',text:'Floors and drains',freq:'Daily'},{id:'handwash',text:'Wash-hand basins stocked (soap, towels)',freq:'Daily'},{id:'fridges',text:'Fridges emptied and cleaned',freq:'Weekly'},{id:'extract',text:'Extraction canopy filters',freq:'Weekly'}],P=[{id:'open-temps',text:'Opening: fridge and freezer temperatures recorded',when:'Opening'},{id:'open-fit',text:'Opening: staff fit for work (no sickness or diarrhoea in 48 hours)',when:'Opening'},{id:'open-probe',text:'Opening: probe thermometer checked and wiped',when:'Opening'},{id:'close-label',text:'Closing: food covered, labelled and dated',when:'Closing'},{id:'close-dates',text:'Closing: anything past its use-by removed',when:'Closing'},{id:'close-clean',text:'Closing: cleaning schedule done',when:'Closing'}];function q({sub:e,setSub:t}){const{total:s}=(0,C.useChatUnread)();return(0,D.jsx)(M.Seg,{value:e,onChange:t,options:[{id:'live',label:'Live tickets'},{id:'soldout',label:'Sold out'},{id:'team',label:"Who's on & rota"},{id:'chat',label:s?`Chat (${s})`:'Chat'}]})}function W(){return(0,D.jsx)(C.Chat,{go:()=>{}})}function E(){const{rid:e,r:t,me:s,now:i}=(0,M.useChef)(15e3),n=(0,f.useStore)(e=>e.bookings),l=(0,f.useOrders)(e),o=l.filter(e=>(0,a.waitingForStaff)(e)).length,d=l.filter(a.kitchenCanSee).filter(e=>['new','acknowledged','preparing'].includes(e.status)||'ready'===e.status&&'pass'===(0,$.nextStep)(e,(0,$.linkedBooking)(e,n))),c=(e,t)=>!!(0,$.statusBlock)(e,t,(0,$.linkedBooking)(e,n)),m=(0,x.ticketView)('chef',d),p=(0,f.useStore)(e=>e.setOrderStatus),b=(0,f.useStore)(e=>e.ackReadiness),w=d.flatMap(e=>(0,j.readinessFor)(e,t,i)).filter(e=>'due'===e.state||'overdue'===e.state);return(0,D.jsxs)(h.default,{style:{gap:8},children:[w.length?(0,D.jsx)(u.Banner,{kind:"warn",title:`${w.length} readiness alert${w.length>1?'s':''}`,children:w.map(e=>e.detail).join(' \xb7 ')}):(0,D.jsx)(u.Muted,{children:"No readiness alerts right now."}),o?(0,D.jsxs)(u.Muted,{children:[o," table order",o>1?'s':''," waiting for front of house to accept (the first order from a new phone). It shows here once accepted."]}):null,m.length?m.map(e=>(0,D.jsxs)(u.Card,{highlight:e.allergies.length&&(0,$.nextStep)(e,(0,$.linkedBooking)(e,n))&&'ready'!==e.status?k.colours.red:void 0,children:[(0,D.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,D.jsxs)(u.T,{weight:"semibold",children:['table'===e.type?`${(0,r.tableNumbers)(e.tableNo)}`:`Takeaway ${e.slotTime?new Date(e.slotTime).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}):''}`," \xb7 ",e.ref]}),(0,D.jsx)(u.Badge,{kind:'new'===e.status?'amber':'gold',label:e.status.toUpperCase()})]}),e.lines.map((e,t)=>(0,D.jsxs)(u.T,{size:14,children:[e.qty," \xd7 ",e.name]},t)),e.allergies.length?(0,D.jsxs)(u.T,{size:13,colour:k.colours.red,children:["\u26a0 Allergy: ",e.allergies.map(e=>`${y.ALLERGENS.find(t=>t.id===e.allergen)?.label} (${e.severity})`).join(', ')]}):null,'takeaway'===e.type&&e.accepted?(0,D.jsxs)(u.T,{size:13,colour:k.colours.ok,children:["\u2713 Confirmed by ",e.accepted.by,Object.keys(e.allergyTicks??{}).length?` \xb7 kitchen checked: ${Object.keys(e.allergyTicks).map(e=>y.ALLERGENS.find(t=>t.id===e)?.label??e).join(', ')}`:'']}):null,e.allergies.length?(0,D.jsx)(R.AllergyChain,{o:e,me:s}):null,(0,D.jsxs)(u.Row,{wrap:!0,gap:8,children:['preparing'!==e.status&&'ready'!==e.status?(0,D.jsx)(u.Button,{small:!0,label:"Start",testID:`start-${e.ref}`,disabled:c(e,'preparing'),onPress:()=>{p(e.id,'preparing',s),'takeaway'===e.type&&b(e.id,'cook',s)}}):null,'ready'!==e.status?(0,D.jsx)(u.Button,{small:!0,kind:"success",label:"Ready",testID:`ready-${e.ref}`,disabled:c(e,'ready'),onPress:()=>p(e.id,'ready',s)}):null]})]},e.id)):(0,D.jsx)(u.Muted,{children:"No live tickets. New orders from the customer app and the Staff app show here."})]})}const F=(e,t)=>{const[s,i,n]=e.split('-').map(Number);return(0,w.ymd)(new Date(s,i-1,n+t))};function G(){const{now:e,today:t}={...(0,M.useChef)(6e4),today:(0,w.ymd)(new Date)},{staff:s,shifts:i}=(0,x.rotaView)('chef',(0,p.useOwner)(e=>e.staff),(0,p.useOwner)(e=>e.shifts)),n=(0,p.useOwner)(e=>e.attendance).filter(e=>e.date===t&&e.in&&!e.out),r=(0,S.weekday)(e),l=s.filter(e=>/kitchen|chef|kp/i.test(e.job+e.name)),a=(0,O.useSession)(e=>e.meId),o=(0,z.useSync)(e=>e.staffRef),d=a??o??M.CHEF_ID,c=(0,p.useOwner)(e=>e.staff.find(e=>e.id===d)?.name??'Chef').replace(/\s*\(.*\)$/,'');return(0,D.jsxs)(h.default,{style:{gap:10},children:[(0,D.jsx)(L.BreakRoomCard,{staffId:d,name:c,now:e}),(0,D.jsxs)(u.Card,{children:[(0,D.jsx)(u.T,{weight:"semibold",children:"On now"}),n.length?n.map(e=>(0,D.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,D.jsxs)(u.Row,{gap:8,style:{flex:1},children:[(0,D.jsx)(I.StaffAvatar,{id:e.staffId,size:28}),(0,D.jsx)(u.T,{size:14,children:s.find(t=>t.id===e.staffId)?.name??e.staffId})]}),(0,D.jsxs)(u.Muted,{children:["since ",new Date(e.in).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})]})]},e.id)):(0,D.jsx)(u.Muted,{children:"Nobody clocked in yet."})]}),(0,D.jsxs)(u.Card,{children:[(0,D.jsxs)(u.T,{weight:"semibold",children:["Today on the rota (",S.DAY3[r],")"]}),i.filter(e=>e.date===t).map(e=>(0,D.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,D.jsxs)(u.Row,{gap:8,style:{flex:1},children:[(0,D.jsx)(I.StaffAvatar,{id:e.staffId,size:28}),(0,D.jsx)(u.T,{size:14,children:s.find(t=>t.id===e.staffId)?.name})]}),(0,D.jsxs)(u.Muted,{children:[(0,S.fmtH)(e.start),"\u2013",(0,S.fmtH)(e.end)]})]},e.id))]}),(0,D.jsxs)(u.Card,{children:[(0,D.jsx)(u.T,{weight:"semibold",children:"Kitchen rota this week"}),l.map(e=>(0,D.jsxs)(h.default,{style:{gap:4},children:[(0,D.jsx)(u.T,{size:14,children:e.name}),(0,D.jsx)(u.Row,{wrap:!0,gap:4,children:S.DAY3.map((s,n)=>{const l=i.find(s=>s.staffId===e.id&&s.date===F(t,n-r));return(0,D.jsxs)(h.default,{style:{width:44,padding:4,borderRadius:6,backgroundColor:l?k.colours.goldTint:k.colours.surface2,alignItems:'center'},children:[(0,D.jsx)(u.T,{size:10,colour:k.colours.muted,children:s}),(0,D.jsx)(u.T,{size:10,children:l?`${(0,S.fmtH)(l.start).slice(0,2)}\u2013${(0,S.fmtH)(l.end).slice(0,2)}`:'off'})]},s)})})]},e.id)),(0,D.jsx)(u.Muted,{children:"Rota changes, swaps and leave are made in CoverCharge for Managers. This view shows shifts only."})]})]})}},1308,[877,1025,1309,1024,808,992,876,30,263,151,127,813,819,831,856,807,814,816,1310,818,821,999,927,1301,1300,939,940,1304,1203,953,1029,859,820,24]); +__d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ingredientQty",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"ingredientSpeech",{enumerable:!0,get:function(){return f}});var t=r(d[0]),n=r(d[1]);const i=(i,f,u)=>(0,n.fishInStone)(i,f)?(0,n.fishQtyText)(i,f,u):(0,t.fmtQty)(u,f.unit||''),f=(t,f,u)=>(0,n.fishInStone)(t,f)?(0,n.fishQtySpeech)(t,f,u):i(t,f,u)},1309,[1300,1025]); +__d(function(g,_r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.readinessFor=function(a,d,r){if('takeaway'!==a.type||!a.slotTime)return[];if(['collected','cancelled','closed'].includes(a.status))return[];const s=new Date(a.slotTime),n=d.settings.bufferMins,o=a.lines.map(a=>({name:a.name,qty:a.qty,at:(0,t.addMins)(s,-(a.prepMins+n))})),u=o.reduce((t,a)=>a.at{if(a)return'done';const d=r.getTime()-t.getTime();return d<0?'upcoming':d>3e5?'overdue':'due'},y=['ready','collected'].includes(a.status);return[{id:`${a.id}:cook`,orderId:a.id,stage:'cook',due:u,state:l(u,!!a.readiness.cook||y),detail:o.sort((t,a)=>t.at.getTime()-a.at.getTime()).map(t=>{return`${t.qty}\xd7 ${t.name} at ${a=t.at,`${String(a.getHours()).padStart(2,'0')}:${String(a.getMinutes()).padStart(2,'0')}`}`;var a}).join(' \xb7 ')},{id:`${a.id}:bag`,orderId:a.id,stage:'bag',due:c,state:l(c,!!a.readiness.bag||y),detail:'Bag, add sauces/drinks, check against ticket and allergy flags'},{id:`${a.id}:ready`,orderId:a.id,stage:'ready',due:s,state:l(s,y),detail:'Mark ready \u2014 sends the customer a "your order is ready" notification'}]};var t=_r(_d[0])},1310,[818]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"inlineStyles",{enumerable:!0,get:function(){return n.inlineStyles}}),Object.defineProperty(_e,"loadLocalRawResource",{enumerable:!0,get:function(){return n.loadLocalRawResource}}),Object.defineProperty(_e,"LocalSvg",{enumerable:!0,get:function(){return n.LocalSvg}}),Object.defineProperty(_e,"SvgCss",{enumerable:!0,get:function(){return n.SvgCss}}),Object.defineProperty(_e,"SvgCssUri",{enumerable:!0,get:function(){return n.SvgCssUri}}),Object.defineProperty(_e,"SvgWithCss",{enumerable:!0,get:function(){return n.SvgWithCss}}),Object.defineProperty(_e,"SvgWithCssUri",{enumerable:!0,get:function(){return n.SvgWithCssUri}}),Object.defineProperty(_e,"WithLocalSvg",{enumerable:!0,get:function(){return n.WithLocalSvg}}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return f.default}}),Object.defineProperty(_e,"camelCase",{enumerable:!0,get:function(){return e.camelCase}}),Object.defineProperty(_e,"fetchText",{enumerable:!0,get:function(){return t.fetchText}}),Object.defineProperty(_e,"parse",{enumerable:!0,get:function(){return e.parse}}),Object.defineProperty(_e,"SvgAst",{enumerable:!0,get:function(){return e.SvgAst}}),Object.defineProperty(_e,"SvgFromUri",{enumerable:!0,get:function(){return e.SvgFromUri}}),Object.defineProperty(_e,"SvgFromXml",{enumerable:!0,get:function(){return e.SvgFromXml}}),Object.defineProperty(_e,"SvgUri",{enumerable:!0,get:function(){return e.SvgUri}}),Object.defineProperty(_e,"SvgXml",{enumerable:!0,get:function(){return e.SvgXml}});var e=r(d[0]),t=r(d[1]),n=r(d[2]),u=r(d[3]);Object.keys(u).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return u[e]}})});var o=r(d[4]);Object.keys(o).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return o[e]}})});var c,f=(c=o)&&c.__esModule?c:{default:c}},1311,[1312,1313,1332,1333,1315]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.SvgAst=c,_e.SvgXml=l,_e.SvgUri=function(r){const{onError:o=i,uri:s,onLoad:c,fallback:u}=r,[f,p]=(0,t.useState)(null),[d,h]=(0,t.useState)(!1);if((0,t.useEffect)(()=>{s?(0,n.fetchText)(s).then(t=>{p(t),d&&h(!1),c?.()}).catch(t=>{o(t),h(!0)}):p(null)},[o,s,c]),d)return u??null;return e.createElement(l,{xml:f,override:r,fallback:u})},Object.defineProperty(_e,"SvgFromXml",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"SvgFromUri",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"camelCase",{enumerable:!0,get:function(){return d}}),_e.getStyle=h,_e.astToReact=x,_e.parse=j,Object.defineProperty(_e,"tags",{enumerable:!0,get:function(){return r.tags}});var t=_r(_d[0]),e=(function(t){if(t&&t.__esModule)return t;var e={};return t&&Object.keys(t).forEach(function(n){if('default'!==n){var r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:function(){return t[n]}})}}),e.default=t,e})(t),n=_r(_d[1]),r=_r(_d[2]);function o(){return o=Object.assign?Object.assign.bind():function(t){for(var e=1;enull!==o?j(o):null,[o]);return e.createElement(c,{ast:r,override:s||n})}catch(t){return r(t),l??null}}class u extends t.Component{state={ast:null};componentDidMount(){this.parse(this.props.xml)}componentDidUpdate(t){const{xml:e}=this.props;e!==t.xml&&this.parse(e)}parse(t){const{onError:e=i}=this.props;try{this.setState({ast:t?j(t):null})}catch(t){const n=t;e({...n,message:`[RNSVG] Couldn't parse SVG, reason: ${n.message}`})}}render(){const{props:t,state:{ast:n}}=this;return e.createElement(c,{ast:n,override:t.override||t})}}class f extends t.Component{state={xml:null};componentDidMount(){this.fetch(this.props.uri)}componentDidUpdate(t){const{uri:e}=this.props;e!==t.uri&&this.fetch(e)}async fetch(t){try{this.setState({xml:t?await(0,n.fetchText)(t):null})}catch(t){console.error(t)}}render(){const{props:t,state:{xml:n}}=this;return e.createElement(u,{xml:n,override:t,onError:t.onError})}}const p=(t,e)=>e.toUpperCase(),d=t=>t.replace(/[:-]([a-z])/g,p);function h(t){const e={},n=t.split(';').filter(t=>t.trim()),{length:r}=n;for(let t=0;tb(' ',t.length);function v(t,e){const n=t.split('\n'),r=n.length;let o=e,s=0;for(;s=t))break;o-=t}const c=t.slice(0,e).replace(/^\t+/,y),i=/(^|\n).*$/.exec(c),l=i&&i[0]||'',u=t.slice(e),f=/.*(\n|$)/.exec(u);return{line:s,column:o,snippet:`${l}${f&&f[0]}\n${b(' ',l.length)}^`}}const E=/[a-zA-Z0-9:_-]/,O=/
Wildings Hotel & Restaurant
- + diff --git a/wildings/staff-app/sw.js b/wildings/staff-app/sw.js index 2c2398969c7f9a11e74682cdee95d5416e246d8c..3997a8442ec82bd7bf04b3a87972ebd69dafd925 100644 --- a/wildings/staff-app/sw.js +++ b/wildings/staff-app/sw.js @@ -1,4 +1,4 @@ -const V="cc-wildings-staff-cc09ab94598c",B="/wildings/staff-app/",P=["/wildings/staff-app/apple-touch-icon.png", "/wildings/staff-app/favicon.ico", "/wildings/staff-app/team.html", "/wildings/staff-app/icon-192.png", "/wildings/staff-app/icon-512.png", "/wildings/staff-app/brand-logo.png", "/wildings/staff-app/index.html", "/wildings/staff-app/manifest.webmanifest", "/wildings/staff-app/brand-hero.png", "/wildings/staff-app/_expo/static/js/web/index-15099e325366025b48cfc0567013b3aa.js", "/wildings/staff-app/_expo/static/js/web/basket-23b053a78600f85843ac913693772ec7.js", "/wildings/staff-app/_expo/static/js/web/index-dbbfddb04905d086b7f4fc157e5888bb.js", "/wildings/staff-app/_expo/static/js/web/[section]-7680005b9f9a2edf6bc1f22af6918f1c.js", "/wildings/staff-app/_expo/static/js/web/index-a696887a353f7d51648c1e753887f562.js", "/wildings/staff-app/_expo/static/js/web/__common-4ef5607b6e32c251390a2b1b38bfb4a7.js", "/wildings/staff-app/_expo/static/js/web/index-374f32ca8b3acd4c473cb67f0be4a5c1.js", "/wildings/staff-app/_expo/static/js/web/index-973ada74f56035815426979f31f74d4e.js", "/wildings/staff-app/_expo/static/js/web/_layout-9788420114429a3bd0f89098e21e4797.js", "/wildings/staff-app/_expo/static/js/web/profile-1c74baad53640e29d41fc5c9e961f3e3.js", "/wildings/staff-app/_expo/static/js/web/lost-0a5d5326efc5a5dcb2110fd615779f07.js", "/wildings/staff-app/_expo/static/js/web/index-08029b0479f99a2d4c6b46f63ebe2bc0.js", "/wildings/staff-app/_expo/static/js/web/loyalty-bdba91e76a1977daa5ad4379cc66a275.js", "/wildings/staff-app/_expo/static/js/web/whatson-9d1e33597e23613f788dd1a65097d805.js", "/wildings/staff-app/_expo/static/js/web/index-aa80a45d20901c92ac80bce3e7f15e09.js", "/wildings/staff-app/_expo/static/js/web/feedback-d9f2534b23e5222df62036cf5c589115.js", "/wildings/staff-app/_expo/static/js/web/demo-83f3a2ec0a7b15fde8c581deca3aacba.js", "/wildings/staff-app/_expo/static/js/web/index-1184747fb013391b5c68f2bc5f74404d.js", "/wildings/staff-app/_expo/static/js/web/book-e85de1237680ea1ed22194e431f4aae4.js", "/wildings/staff-app/_expo/static/js/web/[did]-227a2f79a620251d29d8f8e716ee8bdb.js", "/wildings/staff-app/_expo/static/js/web/__expo-metro-runtime-8c088df87a31e4e6accd81c554ec290d.js", "/wildings/staff-app/_expo/static/js/web/gift-816d52e2568f34226fab48f95bd8cd2d.js", "/wildings/staff-app/_expo/static/js/web/historicalBookingApi-8df5bad0df5a656a389cbe2d72a17686.js", "/wildings/staff-app/_expo/static/js/web/index-5f6eeaebf7ea3f629802b6a8098f1e73.js", "/wildings/staff-app/_expo/static/js/web/index-6ff9008e6ddc971ef1cd72c414e77874.js", "/wildings/staff-app/_expo/static/js/web/refer-378e1e06d7d4e4950a522cf456508788.js", "/wildings/staff-app/_expo/static/js/web/[n]-3078b1d37581aff4da1ffebe18afde8a.js", "/wildings/staff-app/_expo/static/js/web/offers-3a70cae9a304021a06d107a723b85340.js", "/wildings/staff-app/_expo/static/js/web/[oid]-79da5afa34641052ac0acd9d446a2fdc.js", "/wildings/staff-app/_expo/static/js/web/merch-0c059175e625a9d65fea1c24c9fd49cb.js", "/wildings/staff-app/_expo/static/js/web/waitlist-ad8a10a700c4b24b6910dd9ba40f2c28.js", "/wildings/staff-app/_expo/static/js/web/[token]-71d704981c137007abc843f2f7737ebd.js", "/wildings/staff-app/_expo/static/js/web/+not-found-a9acde932f0ed95cf1e7409e88874f97.js", "/wildings/staff-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/wildings/staff-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/wildings/staff-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/wildings/staff-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/wildings/staff-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/wildings/staff-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/wildings/staff-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/wildings/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/wildings/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/wildings/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/wildings/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/wildings/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/wildings/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/wildings/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/wildings/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/wildings/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/wildings/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/wildings/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/wildings/staff-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/wildings/staff-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/wildings/staff-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/wildings/staff-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/wildings/staff-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/wildings/staff-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/wildings/staff-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/wildings/staff-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/wildings/staff-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/wildings/staff-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/wildings/staff-app/assets/assets/brand/wildings.076f4fcd06d19a0af0205c410f461b14.png", "/wildings/staff-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/wildings/staff-app/assets/assets/brand/kirkmichael.63b13cde7fd82eb622622b39ac80c394.png", "/wildings/staff-app/assets/assets/brand/brae.8de9e89ac30966c6669de990370d8e40.png", "/wildings/staff-app/assets/assets/brand/kirkmichael-hero.63b13cde7fd82eb622622b39ac80c394.png", "/wildings/staff-app/assets/assets/brand/greenside.9d1556db97dcb903a3c57e2063ee2255.png", "/wildings/staff-app/assets/assets/brand/abbotsford-hero.78fcb8ee06ee22c4ca659c9254db7512.png", "/wildings/staff-app/assets/assets/brand/kirkton.bcf8d846df4861474d224a7a77f498fb.png", "/wildings/staff-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/wildings/staff-app/assets/assets/brand/wildings-hero-logo-text.4661e4b935726f2511f9c17a1567c89a.png", "/wildings/staff-app/assets/assets/brand/kirkton-hero.9d0837b292c2f4f30f4521d806bb28c3.png", "/wildings/staff-app/assets/assets/brand/saltmarsh.85a6a65732635e5148478d743d9ca884.png", "/wildings/staff-app/assets/assets/brand/souters.f4c58d9349b6e1700fe5abcc9e9b665c.png", "/wildings/staff-app/assets/assets/brand/greenside-hero.1caec5a6cb939434cccb5f3a613b50f8.png", "/wildings/staff-app/assets/assets/brand/abbotsford.b26602bba5ce4969733c5422a45ad053.png"]; +const V="cc-wildings-staff-26fc6c92be92",B="/wildings/staff-app/",P=["/wildings/staff-app/apple-touch-icon.png", "/wildings/staff-app/favicon.ico", "/wildings/staff-app/team.html", "/wildings/staff-app/icon-192.png", "/wildings/staff-app/icon-512.png", "/wildings/staff-app/brand-logo.png", "/wildings/staff-app/index.html", "/wildings/staff-app/manifest.webmanifest", "/wildings/staff-app/brand-hero.png", "/wildings/staff-app/_expo/static/js/web/__common-d0c175ab7fec95d4778dc07f4318794d.js", "/wildings/staff-app/_expo/static/js/web/feedback-3a26c70c9f758c4e362493c3b124ff43.js", "/wildings/staff-app/_expo/static/js/web/[n]-ced785c534ba69ad6c9c35369d7ecc36.js", "/wildings/staff-app/_expo/static/js/web/index-f9b07e7c25cec3623c10876ff1e01e58.js", "/wildings/staff-app/_expo/static/js/web/[section]-93e8e4ffe952e5b3c505e21ca771e570.js", "/wildings/staff-app/_expo/static/js/web/index-a39af53b0c36f30a0cc27647d3da5a52.js", "/wildings/staff-app/_expo/static/js/web/loyalty-679d7aa42c3cddfce82c3e1207d2d4cf.js", "/wildings/staff-app/_expo/static/js/web/[oid]-7fa4f78cb447d1c659e81fff8893269f.js", "/wildings/staff-app/_expo/static/js/web/index-5c634de6ad187be6c30eaf496c8cd727.js", "/wildings/staff-app/_expo/static/js/web/refer-01535dadf727412eb1a34a61dcc6d53d.js", "/wildings/staff-app/_expo/static/js/web/index-a87fa345a0c01a0150c6e7893fe81768.js", "/wildings/staff-app/_expo/static/js/web/[did]-2a2aaaa129307f15140971a22b834cd3.js", "/wildings/staff-app/_expo/static/js/web/demo-6323990816bb686dcab3b33d7e6ec148.js", "/wildings/staff-app/_expo/static/js/web/_layout-11479c45f3927b12ac4d5cb387414dfb.js", "/wildings/staff-app/_expo/static/js/web/historicalBookingApi-2cd603463f8e0769db6a7ead5b608069.js", "/wildings/staff-app/_expo/static/js/web/book-b68aff7cd8daa9b5d327ece648db8831.js", "/wildings/staff-app/_expo/static/js/web/profile-b82887516ccba728915e95d502c0081a.js", "/wildings/staff-app/_expo/static/js/web/offers-eba5409c285b6031064e79e9f1ea19e0.js", "/wildings/staff-app/_expo/static/js/web/index-1ca3ee630447c7d027b33568fe68d67d.js", "/wildings/staff-app/_expo/static/js/web/merch-63634eac687774d71f27698748247bd2.js", "/wildings/staff-app/_expo/static/js/web/__expo-metro-runtime-8c088df87a31e4e6accd81c554ec290d.js", "/wildings/staff-app/_expo/static/js/web/[token]-6c815095a584dc0399e5918b52874b98.js", "/wildings/staff-app/_expo/static/js/web/gift-eb5daa22c1465e33034a87271e1b8b3b.js", "/wildings/staff-app/_expo/static/js/web/index-73547946916b86db8fd1d5a971b2e558.js", "/wildings/staff-app/_expo/static/js/web/basket-b17831f04afc73d6dfc4107f720f1f19.js", "/wildings/staff-app/_expo/static/js/web/index-3c5f820b3b21978c61372b3163c55b0a.js", "/wildings/staff-app/_expo/static/js/web/+not-found-585f3164ae74e5ff35af71a4ba7360a3.js", "/wildings/staff-app/_expo/static/js/web/lost-817d2886f8973bfa630e2a69674dc584.js", "/wildings/staff-app/_expo/static/js/web/index-837efe1be9c39737e9750ae18a91c7cb.js", "/wildings/staff-app/_expo/static/js/web/whatson-0608a899f634d91b081b758137ce1d33.js", "/wildings/staff-app/_expo/static/js/web/index-d87f9d3a113cde7a590672183ebf209b.js", "/wildings/staff-app/_expo/static/js/web/index-e0afcbc73e9d0490c170d31b787a196f.js", "/wildings/staff-app/_expo/static/js/web/waitlist-119a5ba8531abfe81734f2106aefa476.js", "/wildings/staff-app/assets/node_modules/expo-router/assets/pkg.ab19f4cbc543357183a20571f68380a3.png", "/wildings/staff-app/assets/node_modules/expo-router/assets/sitemap.412dd9275b6b48ad28f5e3d81bb1f626.png", "/wildings/staff-app/assets/node_modules/expo-router/assets/file.19eeb73b9593a38f8e9f418337fc7d10.png", "/wildings/staff-app/assets/node_modules/expo-router/assets/unmatched.20e71bdf79e3a97bf55fd9e164041578.png", "/wildings/staff-app/assets/node_modules/expo-router/assets/forward.d8b800c443b8972542883e0b9de2bdc6.png", "/wildings/staff-app/assets/node_modules/expo-router/assets/error.d1ea1496f9057eb392d5bbf3732a61b7.png", "/wildings/staff-app/assets/node_modules/expo-router/assets/arrow_down.017bc6ba3fc25503e5eb5e53826d48a8.png", "/wildings/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@3x.png", "/wildings/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7.png", "/wildings/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@3x.png", "/wildings/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@4x.png", "/wildings/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/close-icon.808e1b1b9b53114ec2838071a7e6daa7@2x.png", "/wildings/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/search-icon.286d67d3f74808a60a78d3ebf1a5fb57.png", "/wildings/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55.png", "/wildings/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon-mask.0a328cd9c1afd0afe8e3b1ec5165b1b4.png", "/wildings/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@2x.png", "/wildings/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/clear-icon.c94f6478e7ae0cdd9f15de1fcb9e5e55@4x.png", "/wildings/staff-app/assets/node_modules/expo-router/assets/react-navigation/elements/back-icon.35ba0eaec5a4f5ed12ca16fabeae451d.png", "/wildings/staff-app/assets/node_modules/@expo-google-fonts/poppins/500Medium/Poppins_500Medium.bf59c687bc6d3a70204d3944082c5cc0.ttf", "/wildings/staff-app/assets/node_modules/@expo-google-fonts/poppins/600SemiBold/Poppins_600SemiBold.6f1520d107205975713ba09df778f93f.ttf", "/wildings/staff-app/assets/node_modules/@expo-google-fonts/poppins/700Bold/Poppins_700Bold.08c20a487911694291bd8c5de41315ad.ttf", "/wildings/staff-app/assets/node_modules/@expo-google-fonts/poppins/400Regular/Poppins_400Regular.093ee89be9ede30383f39a899c485a82.ttf", "/wildings/staff-app/assets/assets/specials/sample-chalkboard.e7b4e4450a8483d4219bc6a214158d8f.jpg", "/wildings/staff-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg", "/wildings/staff-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg", "/wildings/staff-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg", "/wildings/staff-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg", "/wildings/staff-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg", "/wildings/staff-app/assets/assets/brand/wildings.076f4fcd06d19a0af0205c410f461b14.png", "/wildings/staff-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png", "/wildings/staff-app/assets/assets/brand/3idiots-hero.e5dfd53739f05086b1956e72d585a66a.png", "/wildings/staff-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png", "/wildings/staff-app/assets/assets/brand/cecchinis.ebf752fef363247848ae7c0d91938765.png", "/wildings/staff-app/assets/assets/brand/kirkmichael.63b13cde7fd82eb622622b39ac80c394.png", "/wildings/staff-app/assets/assets/brand/3idiots.df4a76d2130f0e5b0042f06a8c88693a.png", "/wildings/staff-app/assets/assets/brand/brae.8de9e89ac30966c6669de990370d8e40.png", "/wildings/staff-app/assets/assets/brand/rupeeroom-hero.969fa372add526aaacf3a6c009b8ac92.png", "/wildings/staff-app/assets/assets/brand/kirkmichael-hero.63b13cde7fd82eb622622b39ac80c394.png", "/wildings/staff-app/assets/assets/brand/williewastles.055a77893ced99bf3a6c5402ba5baac6.png", "/wildings/staff-app/assets/assets/brand/drunkencoo-hero.65c21c4da9e466cf4bffc969639a1427.png", "/wildings/staff-app/assets/assets/brand/pizzaioli-hero.1896657c08264cefb49b401891d5448d.png", "/wildings/staff-app/assets/assets/brand/drunkencoo.f6d92af3b14e4205a3deaf4434754c51.png", "/wildings/staff-app/assets/assets/brand/smokinggoat.20a3a1970596ab43c5d6468d4ed549a7.png", "/wildings/staff-app/assets/assets/brand/greenside.9d1556db97dcb903a3c57e2063ee2255.png", "/wildings/staff-app/assets/assets/brand/abbotsford-hero.78fcb8ee06ee22c4ca659c9254db7512.png", "/wildings/staff-app/assets/assets/brand/rupeeroom.689e6fb536dc0845eeb174a1ec7bd346.png", "/wildings/staff-app/assets/assets/brand/kirkton.bcf8d846df4861474d224a7a77f498fb.png", "/wildings/staff-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png", "/wildings/staff-app/assets/assets/brand/williewastles-hero.b9d53d27b66f903b5618a7177b2ffad4.png", "/wildings/staff-app/assets/assets/brand/pizzaioli.db8c000b62ee407121aa8b90ce45e170.png", "/wildings/staff-app/assets/assets/brand/yasmins-hero.a5aef62e37dfcecbe0afc056186f4ad9.png", "/wildings/staff-app/assets/assets/brand/wildings-hero-logo-text.4661e4b935726f2511f9c17a1567c89a.png", "/wildings/staff-app/assets/assets/brand/yasmins.8482602e9f0a965655924835625cb02b.png", "/wildings/staff-app/assets/assets/brand/kirkton-hero.9d0837b292c2f4f30f4521d806bb28c3.png", "/wildings/staff-app/assets/assets/brand/saltmarsh.85a6a65732635e5148478d743d9ca884.png", "/wildings/staff-app/assets/assets/brand/souters.f4c58d9349b6e1700fe5abcc9e9b665c.png", "/wildings/staff-app/assets/assets/brand/greenside-hero.1caec5a6cb939434cccb5f3a613b50f8.png", "/wildings/staff-app/assets/assets/brand/abbotsford.b26602bba5ce4969733c5422a45ad053.png", "/wildings/staff-app/assets/assets/brand/smokinggoat-hero.0588f17ef0eed7f757f22916cd4d37db.png", "/wildings/staff-app/assets/assets/brand/cecchinis-hero.f77780fcc94fd668cf35d66d6dc52d81.png", "/wildings/staff-app/assets/assets/brand/mrbasrais-hero.4ce74641cfcf52d099157c84005b9d2a.png"]; self.addEventListener('install',e=>e.waitUntil(caches.open(V).then(c=>Promise.all(P.map(u=>fetch(u).then(r=>r.blob().then(b=>c.put(u,new Response(b,{status:200,headers:{'Content-Type':r.headers.get('Content-Type')||b.type}}))))))).then(()=>self.skipWaiting()))); self.addEventListener('activate',e=>e.waitUntil(caches.keys().then(ks=>Promise.all(ks.filter(k=>k.startsWith('cc-wildings-staff-')&&k!==V).map(k=>caches.delete(k)))).then(()=>self.clients.claim()))); self.addEventListener('fetch',e=>{const u=new URL(e.request.url);if(e.request.method!=='GET'||u.origin!==location.origin||!u.pathname.startsWith(B))return;if(e.request.mode==='navigate'){e.respondWith(fetch(e.request).then(r=>r.ok?r:caches.match(B+'index.html')).catch(()=>caches.match(B+'index.html')));return;}e.respondWith(caches.match(e.request,{ignoreSearch:true}).then(r=>r||fetch(e.request)));}); \ No newline at end of file diff --git a/wildings/staff-app/team.html b/wildings/staff-app/team.html index 60a5706429494a56778457c478a8b0f6af1a7e35..5ec15f9e3c76498be9c13acca8ab08b39fabe30a 100644 --- a/wildings/staff-app/team.html +++ b/wildings/staff-app/team.html @@ -35,6 +35,6 @@
Wildings Hotel & Restaurant
- + diff --git a/williewastles/chef-app/_expo/static/js/web/+not-found-585f3164ae74e5ff35af71a4ba7360a3.js b/williewastles/chef-app/_expo/static/js/web/+not-found-585f3164ae74e5ff35af71a4ba7360a3.js new file mode 100644 index 0000000000000000000000000000000000000000..cf2e6d94e8ca98606e0f8533c347ea51139bfdb7 --- /dev/null +++ b/williewastles/chef-app/_expo/static/js/web/+not-found-585f3164ae74e5ff35af71a4ba7360a3.js @@ -0,0 +1 @@ +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return c}});var t=r(d[0]);r(d[1]);var n=r(d[2]),u=r(d[3]);function c(){return(0,u.jsx)(t.Redirect,{href:n.ENTRY[n.APP_VARIANT]})}},801,[804,30,806,24]); \ No newline at end of file diff --git a/williewastles/chef-app/_expo/static/js/web/[did]-2a2aaaa129307f15140971a22b834cd3.js b/williewastles/chef-app/_expo/static/js/web/[did]-2a2aaaa129307f15140971a22b834cd3.js new file mode 100644 index 0000000000000000000000000000000000000000..1f0ffb8d5093d5a183dc2a9c0fb7062951faa5c1 --- /dev/null +++ b/williewastles/chef-app/_expo/static/js/web/[did]-2a2aaaa129307f15140971a22b834cd3.js @@ -0,0 +1 @@ +__d(function(_g,_r,i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return f}});var t=_r(_d[0]),n=_r(_d[1]),l=e(_r(_d[2])),s=e(_r(_d[3])),r=_r(_d[4]),a=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),g=_r(_d[11]),p=_r(_d[12]);function f(){const{rid:e,did:f}=(0,t.useLocalSearchParams)(),b=(0,u.useRestaurant)(e),j=(0,u.useMenu)(e).find(e=>e.id===f),x=(0,u.useCustomer)(),m=(0,u.useRecipeCards)(e).find(e=>e.id===j?.recipeCardId),y=m?.signOff&&m.photo?(0,h.recipeCards)().photoSource(m.photo):null,k=(0,u.useStore)(e=>e.addLine),[v,w]=(0,n.useState)(()=>(j?.optionGroups??[]).filter(e=>e.required).map(e=>e.choices[0].id)),[S,C]=(0,n.useState)(1),[B,$]=(0,n.useState)(''),[I,P]=(0,n.useState)(!1),[L,T]=(0,n.useState)(!1),[D,O]=(0,n.useState)(!1),[A,M]=(0,n.useState)(!1),R=(0,n.useMemo)(()=>j?(0,d.effectiveAllergens)(j,v):{},[j,v]);if(!b||!j)return(0,p.jsx)(o.Screen,{title:"Not found",children:(0,p.jsx)(o.T,{children:"Dish not found."})});const q=(0,d.conflictsFor)(R,x.allergies),_=(j.price??0)+(j.optionGroups??[]).flatMap(e=>e.choices).filter(e=>v.includes(e.id)).reduce((e,t)=>e+t.priceDelta,0),N=j.soldOut||!j.signOff||null===j.price,G=(e,t)=>{const n=j.optionGroups.find(t=>t.id===e);w(e=>{const l=n.choices.map(e=>e.id);return n.multi?e.includes(t)?e.filter(e=>e!==t):[...e,t]:e.includes(t)&&!n.required?e.filter(e=>e!==t):[...e.filter(e=>!l.includes(e)),t]})},z=e=>{u.useStore.getState().basket.restaurantId!==b.id&&u.useStore.getState().startBasket(b.id,'takeaway'),k({itemId:j.id,qty:S,choiceIds:v,notes:B,override:e?{allergens:q.contains,at:(new Date).toISOString()}:void 0}),P(!1),M(!0)};return(0,p.jsxs)(o.Screen,{title:j.name,subtitle:b.name,right:(0,p.jsx)(a.BasketButton,{}),children:[y?(0,p.jsx)(l.default,{testID:"dish-photo",source:y,accessibilityLabel:`${j.name}${'example'===m?.origin?' (example photo)':''}`,style:{width:'100%',height:200,borderRadius:12},resizeMode:"cover"}):null,(0,p.jsxs)(o.Row,{wrap:!0,gap:6,children:[(0,p.jsx)(o.T,{weight:"bold",size:20,colour:g.colours.gold,children:null===j.price?j.priceNote:(0,c.gbp)(_)}),j.dietary.map(e=>(0,p.jsx)(o.Badge,{kind:"ok",label:e},e))]}),(0,p.jsx)(o.T,{children:j.description}),q.contains.length?(0,p.jsx)(o.Banner,{kind:"danger",title:`Blocked: contains ${q.contains.map(d.allergenLabel).join(', ')}`,children:`You\u2019ve told us: ${x.allergies.filter(e=>q.contains.includes(e.allergen)).map(e=>`${(0,d.allergenLabel)(e.allergen)} \u2014 ${(0,d.severityLabel)(e.severity)}`).join('; ')}. This dish can\u2019t be added unless you deliberately override (for example, ordering for someone else).`}):null,q.may.length?(0,p.jsx)(o.Banner,{kind:"warn",title:`Warning: may contain ${q.may.map(d.allergenLabel).join(', ')}`,children:"Cross-contact is possible (e.g. shared fryer). Please speak to staff before ordering."}):null,(j.optionGroups??[]).map(e=>(0,p.jsxs)(o.Card,{children:[(0,p.jsxs)(o.T,{weight:"semibold",children:[e.name,e.required?' (required)':' (optional)']}),(0,p.jsx)(o.Row,{wrap:!0,gap:6,children:e.choices.map(t=>(0,p.jsx)(o.Chip,{label:t.label,sub:t.priceDelta?`+${(0,c.gbp)(t.priceDelta)}`:void 0,selected:v.includes(t.id),onPress:()=>G(e.id,t.id)},t.id))})]},e.id)),(0,p.jsx)(o.Card,{children:(0,p.jsx)(r.AllergenPanel,{item:j,map:R,declared:x.allergies})}),b.fictional?null:(0,p.jsx)(o.ExampleAllergenNotice,{}),(0,p.jsx)(o.Field,{label:"Notes for the kitchen (optional)",placeholder:"e.g. no gherkins",value:B,onChangeText:$}),(0,p.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(o.T,{weight:"semibold",children:"Quantity"}),(0,p.jsx)(o.Stepper,{value:S,onChange:C,label:"quantity"})]}),A?(0,p.jsx)(o.Banner,{kind:"success",title:"Added to basket",children:q.contains.length?'Allergy override recorded \u2014 the kitchen will see a large allergy alert.':'Carry on browsing or go to your basket.'}):null,N?(0,p.jsx)(o.Banner,{kind:"warn",children:j.soldOut?'Sold out today.':j.signOff?'Price on the specials board \u2014 ask staff.':'Not available to order online until the head chef signs off its allergens.'}):q.contains.length?(0,p.jsxs)(s.default,{style:{gap:8},children:[(0,p.jsx)(o.Button,{kind:"secondary",label:"Choose something else",onPress:()=>t.router.back()}),(0,p.jsx)(o.Button,{kind:"danger",label:"Override and add anyway\u2026",onPress:()=>{T(!1),O(!1),P(!0)},testID:"override-open"})]}):(0,p.jsxs)(o.Row,{gap:8,children:[(0,p.jsx)(o.Button,{style:{flex:1},label:`Add ${S} to basket \xb7 ${(0,c.gbp)(_*S)}`,onPress:()=>z(!1),testID:"add-to-basket"}),A?(0,p.jsx)(o.Button,{kind:"secondary",label:"Basket",onPress:()=>t.router.push('/customer/basket')}):null]}),(0,p.jsxs)(o.Sheet,{visible:I,onClose:()=>P(!1),title:"Allergy override",children:[(0,p.jsx)(o.Banner,{kind:"danger",title:`${j.name} contains ${q.contains.map(d.allergenLabel).join(', ')}`,children:`Your profile says: ${x.allergies.filter(e=>q.contains.includes(e.allergen)).map(e=>`${(0,d.allergenLabel)(e.allergen)} \u2014 ${(0,d.severityLabel)(e.severity)}`).join('; ')}.`}),(0,p.jsx)(o.Toggle,{label:"I understand this dish contains an allergen I have declared",value:L,onChange:T}),(0,p.jsx)(o.Toggle,{label:"It is for someone without this allergy, or I have spoken to staff",value:D,onChange:O}),(0,p.jsx)(o.Muted,{children:"The override is logged and shown to the kitchen as an allergy alert that must be acknowledged."}),(0,p.jsx)(o.Button,{kind:"danger",disabled:!L||!D,label:"Confirm override and add",onPress:()=>z(!0),testID:"override-confirm"})]})]})}},778,[804,30,196,127,829,830,813,814,816,819,831,821,24]); \ No newline at end of file diff --git a/williewastles/chef-app/_expo/static/js/web/[n]-ced785c534ba69ad6c9c35369d7ecc36.js b/williewastles/chef-app/_expo/static/js/web/[n]-ced785c534ba69ad6c9c35369d7ecc36.js new file mode 100644 index 0000000000000000000000000000000000000000..c1ced89e3ab9de89839af726f375c95f9fe94a33 --- /dev/null +++ b/williewastles/chef-app/_expo/static/js/web/[n]-ced785c534ba69ad6c9c35369d7ecc36.js @@ -0,0 +1 @@ +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return f}});var t=_r(d[0]),r=_r(d[1]),n=_r(d[2]),o=_r(d[3]),u=_r(d[4]),c=_r(d[5]),s=_r(d[6]),l=_r(d[7]);function f(){const{n:f,r:b}=(0,r.useLocalSearchParams)(),E=(0,u.useStore)(t=>t.startBasket),[_,h]=(0,n.useState)(!1),S=b??c.VENUE_RID,j=(0,u.useOrderAtTable)(S),I=(0,s.guestServer)();return(0,n.useEffect)(()=>{t.LIVE_VENUE_BUILD||I||(j&&E(S,'table',String(f)),h(!0))},[S,f,j,I]),t.LIVE_VENUE_BUILD||I?(0,l.jsx)(o.Screen,{title:"Order at the table",children:(0,l.jsx)(o.Banner,{kind:"demo",title:"Scan the code on your table",children:"To order from your table, scan the QR code printed on it. Or order at the bar."})}):_?(0,l.jsx)(r.Redirect,{href:`/customer/${S}`}):null}},794,[833,804,30,813,819,5,836,24]); \ No newline at end of file diff --git a/williewastles/chef-app/_expo/static/js/web/[oid]-7fa4f78cb447d1c659e81fff8893269f.js b/williewastles/chef-app/_expo/static/js/web/[oid]-7fa4f78cb447d1c659e81fff8893269f.js new file mode 100644 index 0000000000000000000000000000000000000000..f0fcaabb7a82273cae61ec240fcab227e980b17e --- /dev/null +++ b/williewastles/chef-app/_expo/static/js/web/[oid]-7fa4f78cb447d1c659e81fff8893269f.js @@ -0,0 +1 @@ +__d(function(g,_r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return f}});var e,t=_r(d[0]),s=_r(d[1]),l=_r(d[2]),r=_r(d[3]),n=(e=r)&&e.__esModule?e:{default:e},o=_r(d[4]),i=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]),p=_r(d[9]),b=_r(d[10]),y=_r(d[11]),j=_r(d[12]);const x=[['new','Placed'],['acknowledged','Accepted'],['preparing','Cooking'],['ready','Ready to collect'],['collected','Collected']],w=[['new','Sent'],['acknowledged','Accepted'],['preparing','Cooking'],['served','Food out'],['closed','Paid']];function f(){const{oid:e}=(0,s.useLocalSearchParams)(),r=(0,b.useOrder)(e),f=(0,b.useRestaurant)(r?.restaurantId),[C,S]=(0,l.useState)(0),[k,T]=(0,l.useState)(''),[v,P]=(0,l.useState)(!1),[M,$]=(0,l.useState)(!1),[R,A]=(0,l.useState)(1),[I,N]=(0,l.useState)(0),[O,B]=(0,l.useState)(r?.split?.ways??1);if(!r||!f)return(0,j.jsx)(c.Screen,{title:"Order",children:(0,j.jsx)(c.T,{children:"Order not found."})});const H='takeaway'===r.type?x:w,_=Math.max(0,H.findIndex(([e])=>e===r.status)),D=Math.round(r.subtotal*I/100),F='table'===r.type?r.subtotal+(r.split?r.tip:D):r.total,q=F-r.paid,L=r.split?.ways??O,W=r.split?.paidShares??0,Y=Math.ceil(F/L),E='collected'===r.status||'closed'===r.status;return(0,j.jsxs)(c.Screen,{title:`Order ${r.ref}`,subtitle:`${f.name} \xb7 ${'table'===r.type?`${(0,t.tableNumbers)(r.tableNo)}`:`Collection at ${r.slotTime?(0,p.hm)(new Date(r.slotTime)):'\u2014'}`}`,children:['takeaway'===r.type?(0,j.jsx)(c.Banner,{kind:"success",title:'ready'===r.status?'Your order is ready!':'Order placed',children:'ready'===r.status?'Head to the bar and give your order number. Staff will check allergies with you at handover.':`Show order number ${r.ref} at the bar when you arrive.`}):null,(0,j.jsxs)(c.Card,{children:[(0,j.jsx)(c.H2,{children:"Status"}),H.map(([e,t],s)=>(0,j.jsxs)(c.Row,{gap:10,children:[(0,j.jsx)(n.default,{style:{width:22,height:22,borderRadius:11,backgroundColor:s<=_?y.colours.gold:y.colours.surface2,borderWidth:1,borderColor:y.colours.gold}}),(0,j.jsx)(c.T,{weight:s===_?'semibold':'regular',colour:s<=_?y.colours.text:y.colours.muted,children:t})]},e)),r.allergyAck?(0,j.jsxs)(c.Muted,{children:["Kitchen signed off your allergies (",r.allergyAck.by,", ",(0,p.hm)(new Date(r.allergyAck.at)),")"]}):r.allergies.length?(0,j.jsx)(c.Muted,{children:"Waiting for the kitchen to sign off your allergies\u2026"}):null,'takeaway'!==r.type||E?null:(0,j.jsxs)(c.Row,{gap:8,children:[(0,j.jsx)(c.Button,{small:!0,kind:'on-my-way'===r.customerSignal?'primary':'secondary',label:"On my way",onPress:()=>b.repo.orders.customerSignal(r.id,'on-my-way')}),(0,j.jsx)(c.Button,{small:!0,kind:'here'===r.customerSignal?'primary':'secondary',label:"I\u2019m here",onPress:()=>b.repo.orders.customerSignal(r.id,'here')})]})]}),(0,j.jsxs)(c.Card,{children:[(0,j.jsx)(c.H2,{children:"Items"}),r.lines.map((e,t)=>(0,j.jsxs)(n.default,{children:[(0,j.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsxs)(c.T,{style:{flex:1},children:[e.qty,"\xd7 ",e.name]}),(0,j.jsx)(c.T,{children:(0,h.gbp)(e.unitPrice*e.qty)})]}),e.choices.length?(0,j.jsx)(c.Muted,{children:e.choices.join(' \xb7 ')}):null,e.overridden?(0,j.jsx)(c.Badge,{kind:"red",label:`Allergy override: ${e.contains.map(u.allergenLabel).join(', ')}`}):null]},t)),(0,j.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(c.Muted,{children:"Subtotal"}),(0,j.jsx)(c.T,{children:(0,h.gbp)(r.subtotal)})]}),r.giftCardApplied?(0,j.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(c.Muted,{children:"Of which gift card"}),(0,j.jsxs)(c.T,{colour:y.colours.ok,children:["\u2212",(0,h.gbp)(r.giftCardApplied)]})]}):null,r.tip?(0,j.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(c.Muted,{children:"Tip"}),(0,j.jsx)(c.T,{children:(0,h.gbp)(r.tip)})]}):null,(0,j.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(c.T,{weight:"semibold",children:"Paid (test, no real money)"}),(0,j.jsx)(c.T,{weight:"semibold",colour:y.colours.gold,children:(0,h.gbp)(r.paid)})]})]}),'table'===r.type&&'closed'!==r.status&&'cancelled'!==r.status?(0,j.jsxs)(c.Card,{highlight:y.colours.gold,children:[(0,j.jsxs)(c.H2,{children:["Your bill \u2014 ",(0,t.tableNumbers)(r.tableNo)]}),r.split?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(c.T,{children:["Total ",(0,h.gbp)(F)," \xb7 split ",L," way",L>1?'s':''," \xb7 ",(0,h.gbp)(Y)," each"]}),(0,j.jsxs)(c.T,{children:["Shares paid: ",W," of ",L," \xb7 remaining ",(0,h.gbp)(q)]}),L>1?(0,j.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(c.T,{children:"Shares to pay now"}),(0,j.jsx)(c.Stepper,{value:R,onChange:A,min:1,max:L-W,label:"shares"})]}):null,(0,j.jsx)(c.Button,{label:`Pay ${L>1?`${R} share${R>1?'s':''}`:'bill'} \xb7 ${(0,h.gbp)(Math.min(q,Y*R))}`,onPress:()=>$(!0),testID:"pay-bill"})]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(c.T,{weight:"semibold",children:"Add a tip?"}),(0,j.jsx)(c.Row,{wrap:!0,children:[0,10,12.5,15].map(e=>(0,j.jsx)(c.Chip,{label:e?`${e}%`:'No tip',selected:I===e,onPress:()=>N(e)},e))}),(0,j.jsx)(c.Muted,{children:"Tips go to staff under the restaurant\u2019s tipping policy (Employment (Allocation of Tips) Act 2023)."}),(0,j.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(c.T,{weight:"semibold",children:"Split evenly between"}),(0,j.jsx)(c.Stepper,{value:O,onChange:B,min:1,max:8,label:"people"})]}),(0,j.jsxs)(c.T,{children:["Total ",(0,h.gbp)(r.subtotal+D),O>1?` \xb7 ${(0,h.gbp)(Math.ceil((r.subtotal+D)/O))} each`:'']}),(0,j.jsx)(c.Button,{label:"Get the bill",onPress:()=>b.repo.orders.setSplit(r.id,O,D),testID:"get-bill"})]})]}):null,!E||r.rated||v?null:(0,j.jsxs)(c.Card,{highlight:y.colours.gold,children:[(0,j.jsx)(c.H2,{children:"How was everything?"}),(0,j.jsxs)(c.Muted,{children:["One tap \u2014 this goes privately to ",f.name," only, never published."]}),(0,j.jsx)(i.Stars,{value:C,onChange:S}),C?(0,j.jsx)(c.Field,{label:"Anything to add? (optional)",value:k,onChangeText:T}):null,(0,j.jsx)(c.Button,{label:"Send feedback",disabled:!C,onPress:()=>{b.repo.feedback.add({restaurantId:f.id,orderId:r.id,customerId:r.customerId,customerName:r.customerName,stars:C,comment:k,context:'table'===r.type?`${(0,t.tableNumbers)(r.tableNo)}`:`Takeaway ${r.ref}`}),P(!0)},testID:"send-rating"})]}),v||r.rated?(0,j.jsx)(c.Banner,{kind:"success",children:"Thanks \u2014 your feedback went privately to the restaurant."}):null,E?(0,j.jsx)(c.Button,{kind:"secondary",label:"View stamp card",onPress:()=>s.router.push(`/customer/${f.id}/loyalty`)}):null,(0,j.jsx)(o.MockPay,{visible:M,onClose:()=>$(!1),amount:Math.min(q,Y*R),restaurantId:f.id,title:`Pay \u2014 ${(0,t.tableNumbers)(r.tableNo)}`,onPaid:e=>{b.repo.orders.payTable(r.id,{shares:R,giftCardCode:e.giftCardCode}),$(!1),A(1)}})]})}},791,[808,804,30,127,834,832,813,814,816,818,819,821,24]); \ No newline at end of file diff --git a/williewastles/chef-app/_expo/static/js/web/[section]-93e8e4ffe952e5b3c505e21ca771e570.js b/williewastles/chef-app/_expo/static/js/web/[section]-93e8e4ffe952e5b3c505e21ca771e570.js new file mode 100644 index 0000000000000000000000000000000000000000..11f3bab84de38d8d8874b5ec2723dd3ea24b04a1 --- /dev/null +++ b/williewastles/chef-app/_expo/static/js/web/[section]-93e8e4ffe952e5b3c505e21ca771e570.js @@ -0,0 +1 @@ +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return s}});var t=r(d[0]);r(d[1]);var n=r(d[2]),c=r(d[3]),o=r(d[4]),f=r(d[5]);function s(){const{section:s}=(0,t.useLocalSearchParams)();return(0,c.canShow)('chef')?s&&(0,o.chefSectionAllowed)(String(s))?(0,f.jsx)(n.ChefApp,{section:String(s)},String(s)):(0,f.jsx)(t.Redirect,{href:"/kitchen"}):(0,f.jsx)(t.Redirect,{href:c.ENTRY[c.APP_VARIANT]})}},775,[804,30,805,806,807,24]); \ No newline at end of file diff --git a/williewastles/chef-app/_expo/static/js/web/[token]-bee6add88cca58f03680987578d45fcf.js b/williewastles/chef-app/_expo/static/js/web/[token]-bee6add88cca58f03680987578d45fcf.js new file mode 100644 index 0000000000000000000000000000000000000000..e769ab3ec016c4a4d7d40b77f3a65a57b95b323d --- /dev/null +++ b/williewastles/chef-app/_expo/static/js/web/[token]-bee6add88cca58f03680987578d45fcf.js @@ -0,0 +1,3 @@ +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return u}});var t=r(d[0]);r(d[1]);var n=r(d[2]),o=r(d[3]),c=r(d[4]),s=r(d[5]),l=r(d[6]);function u(){const{token:u}=(0,t.useLocalSearchParams)(),h=(0,c.cleanToken)(u);return h?(0,s.guestServer)()?(0,l.jsx)(o.TableOrderLive,{token:h}):(0,l.jsx)(n.Screen,{title:"Order at the table",children:(0,l.jsx)(n.Banner,{kind:"demo",title:"Not connected",children:"This preview isn't connected to a venue, so table orders can't be sent from here."})}):(0,l.jsx)(n.Screen,{title:"Order at the table",children:(0,l.jsx)(n.Banner,{kind:"warn",title:"This code isn't working",children:"Please scan the QR code on your table again, or ask a member of staff."})})}},795,[804,30,813,872,874,836,24]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TableOrderLive=function({token:e}){const[s,b]=(0,n.useState)(null),[m,f]=(0,n.useState)(null),[j,y]=(0,n.useState)([]),[k,w]=(0,n.useState)(null),T=(0,h.useCustomer)(),[C,S]=(0,n.useState)(()=>(T?.allergies??[]).map(e=>e.allergen)),[v,P]=(0,n.useState)(''),[O,N]=(0,n.useState)(''),[B,I]=(0,n.useState)(!1),[L,M]=(0,n.useState)(null),[R,$]=(0,n.useState)([]),A=(0,n.useCallback)(async()=>{try{b(await(0,c.tablePublic)(e)),f(null)}catch(e){f(e?.message??'Could not load the menu.')}},[e]),D=(0,n.useCallback)(async()=>{try{$(await(0,c.myTableOrders)(e))}catch{}},[e]);(0,n.useEffect)(()=>{A(),D();const e=setInterval(()=>{D(),A()},8e3);return()=>clearInterval(e)},[A,D]);const _=s?.menu??[];(0,n.useEffect)(()=>{y(e=>e.filter(e=>_.some(t=>t.id===e.id&&!t.soldOut)))},[s]);const q=(0,n.useMemo)(()=>{const e=new Map;for(const t of _)e.set(t.section,[...e.get(t.section)??[],t]);return[...e.entries()]},[s]),Y=(0,d.cartTotal)(j,_),W='yes'===k?C.map(e=>({allergen:e,severity:T?.allergies?.find(t=>t.allergen===e)?.severity??'allergy'})):[],E=(0,d.allergyClashes)(j,_,W.map(e=>e.allergen)),z=e=>j.find(t=>t.id===e)?.qty??0,G=(e,t)=>y(l=>t<=0?l.filter(t=>t.id!==e):l.some(t=>t.id===e)?l.map(l=>l.id===e?{...l,qty:t}:l):[...l,{id:e,qty:t,note:''}]),H=(e,t)=>y(l=>l.map(l=>l.id===e?{...l,note:t}:l)),V=async()=>{I(!0),M(null);try{const t=await(0,c.sendTableOrder)(e,j,{note:O,name:v,allergies:W});y([]),N(''),M({kind:'success',text:t.held?`Order ${t.ref} sent. A member of staff will check it, then it goes to the kitchen.`:`Order ${t.ref} sent to the kitchen.`}),D()}catch(e){M({kind:'warn',text:e?.message??'The order was not sent. Please try again or ask a member of staff.'}),A()}finally{I(!1)}};if(m)return(0,x.jsxs)(r.Screen,{title:"Order at the table",children:[(0,x.jsx)(r.Banner,{kind:"warn",title:"Couldn't open the menu",children:m}),(0,x.jsx)(r.Button,{label:"Try again",onPress:()=>{A()}})]});if(!s)return(0,x.jsx)(r.Screen,{title:"Order at the table",children:(0,x.jsx)(r.Muted,{children:"Opening the menu\u2026"})});if(!s.ok)return(0,x.jsx)(r.Screen,{title:"Order at the table",children:(0,x.jsx)(r.Banner,{kind:"warn",title:"This code isn't working",children:s.reason??'Please ask a member of staff.'})});const F=s.open&&j.length>0&&null!==k&&('none'===k||C.length>0)&&!B;return(0,x.jsxs)(r.Screen,{title:`${(0,l.tableNumbers)(s.table)}`,subtitle:s.venueName,footer:s.open?(0,x.jsx)(r.Button,{label:B?'Sending\u2026':j.length?`Send order to the kitchen (${(0,o.gbp)(Y)})`:'Add a dish to order',disabled:!F,onPress:()=>{V()},testID:"send-table-order-live"}):void 0,children:[(0,x.jsxs)(r.Muted,{children:["Tip: add dishes, answer the allergy question, then send. Staff bring it to ",(0,l.tableNumbers)(s.table),". ",d.PAY_WORDS]}),s.tip?(0,x.jsx)(r.Banner,{kind:"demo",children:s.tip}):null,s.open?null:(0,x.jsx)(r.Banner,{kind:"warn",title:"Not taking table orders right now",children:s.reason}),s.open&&s.staffAccept&&!R.some(e=>e.accepted)?(0,x.jsx)(r.Muted,{children:"The first order from your phone is checked by a member of staff before it goes to the kitchen."}):null,L?(0,x.jsx)(r.Banner,{kind:L.kind,children:L.text}):null,R.length?(0,x.jsx)(a.default,{testID:"my-table-orders",children:(0,x.jsxs)(r.Card,{children:[(0,x.jsx)(r.T,{weight:"semibold",children:"Your orders at this table"}),R.map(e=>(0,x.jsxs)(a.default,{style:{gap:2,paddingVertical:4},children:[(0,x.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(r.T,{children:e.ref}),(0,x.jsx)(r.T,{size:13,colour:'cancelled'===e.status?u.colours.amber:u.colours.gold,children:(0,d.guestStatusWords)(e)})]}),(0,x.jsxs)(r.Muted,{children:[e.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')," \xb7 ",(0,o.gbp)(e.totalPence)," to pay at the bar or till"]})]},e.id))]})}):null,s.open?q.map(([e,t])=>(0,x.jsxs)(a.default,{style:{gap:8},children:[(0,x.jsx)(r.H2,{children:e}),t.map(e=>(0,x.jsxs)(r.Card,{children:[(0,x.jsxs)(r.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,x.jsxs)(a.default,{style:{flex:1,gap:2},children:[(0,x.jsx)(r.T,{weight:"semibold",children:e.name}),e.description?(0,x.jsx)(r.Muted,{children:e.description}):null,(0,x.jsxs)(r.T,{size:13,colour:u.colours.muted,children:[e.allergens.length?`Contains: ${e.allergens.map(i.allergenLabel).join(', ')}`:'No allergens listed: ask staff if unsure',e.mayContain.length?` \xb7 May contain: ${e.mayContain.map(i.allergenLabel).join(', ')}`:'']})]}),(0,x.jsx)(r.T,{weight:"semibold",colour:u.colours.gold,children:(0,o.gbp)(e.pricePence)})]}),e.soldOut?(0,x.jsx)(r.Badge,{kind:"amber",label:"Sold out today"}):z(e.id)?(0,x.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(r.Stepper,{value:z(e.id),min:0,max:20,onChange:t=>G(e.id,t),label:e.name}),(0,x.jsx)(r.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>G(e.id,0)})]}):(0,x.jsx)(r.Button,{small:!0,kind:"secondary",label:"Add",accessibilityLabel:`Add ${e.name}`,onPress:()=>G(e.id,1)})]},e.id))]},e)):null,s.open&&!_.length?(0,x.jsx)(r.Banner,{kind:"demo",title:"No dishes to order yet",children:"The venue hasn't put any priced dishes on the table menu yet. Please order at the bar."}):null,s.open&&j.length?(0,x.jsx)(a.default,{testID:"table-cart",children:(0,x.jsxs)(r.Card,{children:[(0,x.jsx)(r.T,{weight:"semibold",children:"Your order"}),j.map(e=>{const l=_.find(t=>t.id===e.id);return(0,x.jsxs)(a.default,{style:{gap:4},children:[(0,x.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsxs)(r.T,{children:[e.qty,"\xd7 ",l?.name]}),(0,x.jsx)(r.T,{children:(0,o.gbp)(e.qty*(l?.pricePence??0))})]}),(0,x.jsx)(t.TextInput,{style:p,value:e.note,onChangeText:t=>H(e.id,t),placeholder:"Note for the kitchen (optional), e.g. no onions",placeholderTextColor:u.colours.muted,maxLength:140,accessibilityLabel:`Note for ${l?.name}`,testID:`table-note-${e.id}`})]},e.id)}),(0,x.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(r.T,{weight:"semibold",children:"Total"}),(0,x.jsx)(r.T,{weight:"semibold",children:(0,o.gbp)(Y)})]})]})}):null,s.open?(0,x.jsx)(a.default,{testID:"table-allergy",children:(0,x.jsxs)(r.Card,{children:[(0,x.jsx)(r.T,{weight:"semibold",children:"Does anyone at the table have a food allergy?"}),(0,x.jsx)(r.Muted,{children:"We ask everyone, so the kitchen can keep you safe."}),(0,x.jsxs)(r.Row,{gap:8,children:[(0,x.jsx)(r.Chip,{label:"No allergies",selected:'none'===k,onPress:()=>w('none')}),(0,x.jsx)(r.Chip,{label:"Yes, allergies",selected:'yes'===k,onPress:()=>w('yes')})]}),'yes'===k?(0,x.jsx)(r.Row,{wrap:!0,gap:6,children:i.ALLERGENS.map(e=>(0,x.jsx)(r.Chip,{label:e.short,selected:C.includes(e.id),onPress:()=>S(t=>t.includes(e.id)?t.filter(t=>t!==e.id):[...t,e.id])},e.id))}):null,E.length?(0,x.jsxs)(r.Banner,{kind:"warn",title:"Check with staff",children:[E.map(e=>e.name).join(', ')," ",E.length>1?'contain':'contains'," or may contain an allergy you picked. The kitchen will see your allergies on the ticket."]}):null]})}):null,s.open?(0,x.jsxs)(r.Card,{children:[(0,x.jsx)(r.T,{weight:"semibold",children:"Anything else?"}),(0,x.jsx)(t.TextInput,{style:p,value:v,onChangeText:P,placeholder:"Your first name (optional)",placeholderTextColor:u.colours.muted,maxLength:40,accessibilityLabel:"Your first name (optional)"}),(0,x.jsx)(t.TextInput,{style:p,value:O,onChangeText:N,placeholder:"Note for the staff (optional)",placeholderTextColor:u.colours.muted,maxLength:300,accessibilityLabel:"Note for the staff (optional)"})]}):null,(0,x.jsx)(a.default,{testID:"pay-placeholder",children:(0,x.jsxs)(r.Card,{children:[(0,x.jsx)(r.T,{weight:"semibold",children:"Paying"}),(0,x.jsx)(r.T,{children:d.PAY_WORDS}),(0,x.jsx)(r.Muted,{children:"No card details are asked for or kept in this app."})]})})]})};var e,t=_r(_d[0]),l=_r(_d[1]),n=_r(_d[2]),s=_r(_d[3]),a=(e=s)&&e.__esModule?e:{default:e},r=_r(_d[4]),i=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),x=_r(_d[11]);const p={borderWidth:1,borderColor:u.colours.border,borderRadius:10,padding:10,color:u.colours.text,backgroundColor:u.colours.surface2}},872,[875,808,30,127,813,814,816,874,873,819,821,24]); +__d(function(g,_r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"tablePublic",{enumerable:!0,get:function(){return s}}),e.sendTableOrder=async function(t,r,a){if(!await(0,n.guestSession)())throw new Error('No connection. Try again when you are back online.');return(0,n.rpc)('guest_table_order',{p_token:t,p_lines:r.map(t=>({id:t.id,qty:t.qty,note:t.note.trim().slice(0,140)})),p_note:a.note.trim().slice(0,300)||null,p_allergies:a.allergies.map(t=>({allergen:t.allergen,severity:t.severity})),p_name:a.name.trim().slice(0,40)||null})},e.myTableOrders=async function(t){return await(0,n.guestSession)()?await(0,n.rpc)('guest_table_my_orders',{p_token:t})??[]:[]},e.loadTableSettings=async function(){const{data:t,error:n}=await a().from('table_order_settings').select('*').eq('venue_id',o()).maybeSingle();if(n)throw n;return(0,r.fromRow)(t)},e.saveTableSettings=async function(t,n){const{error:s}=await a().from('table_order_settings').upsert({venue_id:o(),...(0,r.toRow)(t),updated_at:(new Date).toISOString(),updated_by:n.slice(0,80)});if(s)throw s},e.listTableCodes=async function(){const{data:t,error:n}=await a().from('table_qr_codes').select('table_no, token, created_at').eq('venue_id',o()).eq('is_on',!0);if(n)throw n;return(t??[]).map(t=>({table:String(t.table_no),token:String(t.token),createdAt:String(t.created_at)})).sort((t,n)=>Number(t.table)-Number(n.table))},Object.defineProperty(e,"makeTableCodes",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"renewTableCode",{enumerable:!0,get:function(){return c}}),e.watchTableSettings=function(t){const r=n.useSync.getState().venueId;if(!r)return()=>{};const o=a().channel(`tos-${r}-${Math.random().toString(36).slice(2,8)}`).on('postgres_changes',{event:'*',schema:'public',table:'table_order_settings',filter:`venue_id=eq.${r}`},()=>t()).subscribe();return()=>{a().removeChannel(o)}};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]);const a=()=>(0,t.getSupabase)(),o=()=>{const t=n.useSync.getState().venueId;if(!t)throw new Error('Not connected to the venue yet.');return t},s=t=>(0,n.rpc)('table_public',{p_token:t});const l=t=>(0,n.rpc)('table_qr_make',{p_venue:o(),p_tables:t}),c=t=>(0,n.rpc)('table_qr_renew',{p_venue:o(),p_table:t})},873,[862,820,874]); \ No newline at end of file diff --git a/williewastles/chef-app/_expo/static/js/web/__common-a0a8de6d26af57a1f950079275cb118c.js b/williewastles/chef-app/_expo/static/js/web/__common-a0a8de6d26af57a1f950079275cb118c.js new file mode 100644 index 0000000000000000000000000000000000000000..8fc7ffce60ff175ddd0ca80b8b25690c2a8f5908 --- /dev/null +++ b/williewastles/chef-app/_expo/static/js/web/__common-a0a8de6d26af57a1f950079275cb118c.js @@ -0,0 +1,464 @@ +__d(function(g,r,i,a,m,e,d){"use strict";function t(t,n){return Object.keys(t).forEach(function(c){"default"===c||Object.prototype.hasOwnProperty.call(n,c)||Object.defineProperty(n,c,{enumerable:!0,get:function(){return t[c]}})}),t}Object.defineProperty(e,"__esModule",{value:!0}),r(d[0]),t(r(d[1]),e),t(r(d[2]),e),t(r(d[3]),e),t(r(d[4]),e)},804,[1209,1210,1220,1221,1223]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ChefApp=function({section:e}={}){const{r:s,rid:t,me:i,now:$}=(0,G.useChef)(3e4),_=(0,W.useSignedIn)(),K=_?.id??G.CHEF_ID;(0,o.useSoldOutLink)(!0,(_?.name??i).replace(' (example)',''));const V=e?me[e]:void 0,[ue,je]=(0,P.useState)(V?.tab??'home'),[we,Ce]=(0,P.useState)(V?.k??null),[Te,ve]=(0,P.useState)(V?.stock??'levels'),[Se,Pe]=(0,P.useState)(void 0),[Ie,Re]=(0,P.useState)(V?.gp??'dishes'),Be=(0,P.useRef)(null),He=(0,f.ymd)($),Ae=(0,f.ymd)(new Date($.getTime()+864e5));(0,u.useTipsPosted)(t,He);const Oe=(0,Q.useTravelDay)('chef',He),De='home'===ue&&!Oe;(0,v.useKitchenTodoChime)(t,He,()=>Fe('kitchen','bookings')),(0,de.useAlertWatcher)(t,{kinds:['takeaway']}),(0,P.useEffect)(()=>{(0,W.ensureAttendance)((new Date).toISOString().slice(0,10),$)},[]);const Le=(0,P.useRef)({t:'home',k:null});Le.current={t:ue,k:we};const Ee=(0,P.useRef)([]),$e=(0,n.useScrollMemory)(Be),Fe=(0,P.useCallback)((e,s=null)=>{const t=Le.current;t.t===e&&t.k===s||(Ee.current=[...Ee.current,{...t,y:$e.leave()}].slice(-30),$e.restore(0)),je(e),Ce(s)},[]),We=(0,P.useCallback)(()=>{if((0,l.runBackLayer)())return!0;const e=Le.current;let s=Ee.current.pop();for(;s&&s.t===e.t&&s.k===e.k;)s=Ee.current.pop();if(!s&&'home'===e.t&&!e.k)return!1;const t=s??{t:'home',k:null};return $e.leave(),je(t.t),Ce(t.k),$e.restore(t.y??0),!0},[]);(0,l.useWebBack)(We);const Ge=(0,l.useInnerBackShown)();(0,P.useEffect)(()=>{d.PITCH&&(globalThis.__pitchGo=(e,s=null,t)=>{'stock'===e&&t&&ve(t),'gp'===e&&t&&Re(t),Fe(e,s)})},[Fe]),(0,p.useShiftReminders)({rid:t,staffId:K,name:i,kitchen:!0}),(0,C.useScheduledNotices)({rid:t,staffId:_?.id??'',name:i,onOpen:()=>Fe('kitchen','orderlists')}),(0,T.useOffRotaPrompt)({rid:t,staffId:_?.id??''}),(0,P.useEffect)(()=>{const e=I.default.addEventListener('hardwareBackPress',We);return()=>e.remove()},[We]);const Me=we?ye.find(e=>e.id===we):null,Ne=(0,H.default)().width<430,ze=Me?Me.title:{home:'Today in the kitchen',stock:'Stock',gp:'GP & costing',creator:ie.CREATOR_TITLE,orders:'Ordering',kitchen:'Kitchen'}[ue];return(0,be.jsxs)(O.SafeAreaView,{style:{flex:1,backgroundColor:F.colours.bg},edges:['top','bottom'],children:[(0,be.jsxs)(A.default,{style:{paddingHorizontal:14,paddingTop:6,paddingBottom:8,borderBottomWidth:1,borderColor:F.colours.border,gap:6},children:[(0,be.jsx)(A.default,{style:{alignItems:'center'},children:(0,be.jsx)(A.default,{testID:"header-me",accessibilityLabel:`Signed in as ${i.replace(' (example)','')}, Head Chef`,style:{borderWidth:1,borderColor:F.colours.gold,borderRadius:16,paddingHorizontal:10,paddingVertical:4,maxWidth:'86%'},children:(0,be.jsxs)(E.Row,{gap:6,children:[(0,be.jsx)(se.StaffAvatar,{id:G.CHEF_ID,size:24,ring:!1}),(0,be.jsxs)(E.T,{size:13,weight:"semibold",colour:F.colours.gold,numberOfLines:1,style:{flexShrink:1},children:[i.replace(' (example)','')," \xb7 Head Chef"]})]})})}),(0,be.jsxs)(E.Row,{gap:10,children:[(0,be.jsx)(D.RestaurantLogo,{rid:t,size:Ne?36:44}),(0,be.jsxs)(A.default,{style:{flex:1,minWidth:0},children:[(0,be.jsxs)(E.Row,{gap:6,children:[(0,be.jsx)(E.T,{weight:"semibold",size:Ne?15:17,numberOfLines:1,style:{flexShrink:1},children:s.name}),(0,be.jsx)(w.AppBadge,{label:"CHEF"})]}),(0,be.jsx)(E.T,{size:12,colour:F.colours.muted,numberOfLines:1,children:"Head Chef app"}),(0,be.jsx)(D.PoweredBy,{})]}),(0,be.jsx)(R.default,{accessibilityRole:"button",accessibilityLabel:"Open CoverCharge for Staff",onPress:()=>{const e=(0,te.appUrl)('staff');e&&window.location.assign(e)},style:{borderWidth:1,borderColor:F.colours.gold,borderRadius:14,paddingHorizontal:10,paddingVertical:3,minHeight:44,justifyContent:'center'},children:(0,be.jsx)(E.T,{size:13,colour:F.colours.gold,children:"Staff app \u203a"})}),(0,be.jsx)(L.VoiceSlot,{})]})]}),(0,be.jsxs)(B.default,{ref:Be,...$e.props,contentContainerStyle:{padding:14,paddingBottom:60,gap:12,width:'100%',maxWidth:760,alignSelf:'center'},keyboardShouldPersistTaps:"handled",children:[(0,be.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:['home'===ue&&!we||Ge?null:(0,be.jsx)(l.BackButton,{onPress:We}),(0,be.jsx)(E.T,{size:22,weight:"bold",style:{flex:1,textAlign:'home'===ue&&!we||Ge?'left':'right'},children:ze})]}),'home'===ue?(0,be.jsx)(Q.DayBar,{app:"chef",today:He}):null,'home'===ue&&Oe?(0,be.jsx)(Q.DayView,{rid:t,day:Oe,today:He,app:"chef"}):null,'home'===ue?(0,be.jsx)(ee.WhoBar,{}):null,De&&_?(0,be.jsx)(h.MyTasksToday,{rid:t,staffId:_.id,name:_.name,onShift:(0,p.shiftNow)(_.id,$.getTime()).on}):null,De?(0,be.jsx)(u.TodaysTipsCard,{rid:t,today:He}):null,De?(0,be.jsx)(u.TipsPotCard,{rid:t,today:He}):null,De?(0,be.jsx)(b.CoversToday,{rid:t,onPress:()=>Fe('kitchen','bookings')}):null,De?(0,be.jsx)(k.LastFoodBanner,{rid:t,now:$}):null,De?(0,be.jsx)(y.NextTableFreeCard,{rid:t,now:$}):null,De?(0,be.jsx)(x.KitchenSignoffs,{rid:t,today:He,by:i,app:"chef"}):null,De?(0,be.jsxs)(A.default,{style:{gap:4},children:[(0,be.jsx)(x.PlattersBooked,{rid:t,date:He,label:"Platters booked today"}),(0,be.jsx)(x.PlattersBooked,{rid:t,date:Ae,label:"Platters booked tomorrow"})]}):null,De?(0,be.jsx)(pe.ChefAssistantButton,{}):null,De?(0,be.jsx)(xe,{go:(e,s)=>{'stock'===e&&s&&ve(s),'gp'===e&&s&&Re(s),'orders'===e&&Pe(s),Fe(e,'kitchen'===e?s??null:null)}}):null,'stock'===ue?(0,be.jsx)(U.StockScreen,{initial:Te},Te):null,'gp'===ue?(0,be.jsx)(M.GpScreen,{initial:Ie},Ie):null,'creator'===ue?(0,be.jsx)(ie.DishCreator,{rid:t,canPublish:!1}):null,'orders'===ue?(0,be.jsx)(z.OrdersScreen,{focus:Se},Se??'all'):null,'kitchen'!==ue||Me?null:(0,be.jsxs)(A.default,{style:{gap:10},children:[(0,be.jsx)(A.default,{style:{borderRadius:14,borderWidth:1,borderColor:F.colours.border,backgroundColor:F.colours.surface,overflow:'hidden'},children:ye.map((e,s)=>(0,be.jsx)(R.default,{accessibilityRole:"button",accessibilityLabel:e.title,onPress:()=>Fe(ue,e.id),style:({pressed:e})=>({padding:12,borderTopWidth:s?1:0,borderColor:F.colours.border,backgroundColor:e?'#1d1a14':'transparent'}),children:(0,be.jsxs)(E.Row,{style:{justifyContent:'space-between'},children:[(0,be.jsxs)(A.default,{style:{flex:1},children:[(0,be.jsx)(E.T,{weight:"medium",children:e.title}),(0,be.jsx)(E.Muted,{children:e.sub})]}),(0,be.jsx)(E.T,{colour:F.colours.muted,children:"\u203a"})]})},e.id))}),(0,be.jsx)(E.Muted,{children:"Head Chef sees kitchen, stock, food costs and GP. Payroll, wages and the restaurant's billing stay in CoverCharge for Managers."}),(0,be.jsxs)(E.Muted,{center:!0,children:["Head Chef app \xb7 ",r.APP_VERSION," \xb7 ",'live'===ge.useSync.getState().mode?'shared with your team':'saved on this device until it connects']})]}),'myshift'===we&&K?(0,be.jsxs)(A.default,{style:{gap:10},testID:"chef-myshift",children:[(0,be.jsx)(X.ClockInOut,{}),(0,be.jsx)(Z.MyUpcomingShifts,{staffId:K})]}):null,'mypay'===we?(0,be.jsxs)(A.default,{style:{gap:10},testID:"chef-mypay",children:[(0,be.jsx)(Y.MyPeriods,{staffId:K}),(0,be.jsx)(q.MyHoursPay,{staffId:K}),(0,be.jsx)(J.MyTips,{staffId:K}),(0,be.jsxs)(E.Card,{children:[(0,be.jsx)(E.T,{weight:"semibold",children:"Phone notifications"}),(0,be.jsx)(E.Muted,{children:"Get reminders like \u201cMills milk order\u201d on this phone, even with the app closed (once your manager switches phone notifications on). iPhone: add the app to your Home Screen first (iOS 16.4 or later)."}),(0,be.jsx)(c.PushButton,{})]})]}):null,'bookings'===we?(0,be.jsx)(S.TodaysBookings,{rid:t,today:He,by:i,app:"chef"}):null,'specials'===we?(0,be.jsx)(le.SpecialsEditor,{rid:t,me:i,app:"chef",now:$}):null,'prep'===we?(0,be.jsx)(N.PrepScreen,{}):null,'live'===we?(0,be.jsx)(N.TeamScreen,{}):null,'waste'===we?(0,be.jsx)(N.WasteScreen,{}):null,'recipes'===we?(0,be.jsx)(ce.RecipeCards,{rid:t,actor:{name:i,role:'head-chef'},mode:"edit"}):null,'allergens'===we?(0,be.jsx)(N.AllergenScreen,{openCards:()=>Fe('kitchen','recipes')}):null,'compliance'===we?(0,be.jsx)(N.ComplianceScreen,{}):null,'takings'===we?(0,be.jsx)(u.CashUpScreen,{rid:t,today:He,canEdit:!1,chartsOnly:!0,who:{id:K,name:i.replace(' (example)','')}}):null,'board'===we?(0,be.jsx)(he.QuestionBoard,{rid:t,today:He,manager:!1,by:""}):null,'teamtasks'===we?(0,be.jsx)(h.KitchenTeamTasks,{rid:t,actor:_}):null,'orderlists'===we?(0,be.jsx)(j.OrderListsScreen,{rid:t,today:He,editor:!0,who:{id:K,name:i.replace(' (example)','')}}):null,'foodsafety'===we?(0,be.jsx)(c.FoodSafetyCard,{children:(0,be.jsx)(R.default,{accessibilityRole:"button",onPress:()=>Fe('kitchen','haccp'),children:(0,be.jsx)(E.T,{colour:F.colours.gold,children:"Today\u2019s temperature log \u203a"})})}):null,'haccp'===we?(0,be.jsx)(ne.HaccpLog,{mode:"chef",me:i,meId:G.CHEF_ID,now:$}):null,'accidents'===we?(0,be.jsx)(oe.AccidentBook,{app:"chef",me:i,meId:G.CHEF_ID,now:$,seeAll:!1}):null]}),(0,be.jsx)(A.default,{accessibilityRole:"tablist",style:{flexDirection:'row',borderTopWidth:1,borderColor:F.colours.border,backgroundColor:F.colours.surface},children:ke.map(e=>{const s=ue===e.id;return(0,be.jsxs)(R.default,{accessibilityRole:"tab",accessibilityState:{selected:s},accessibilityLabel:e.label,onPress:()=>Fe(e.id),style:{flex:1,alignItems:'center',paddingVertical:8,paddingHorizontal:2,minHeight:52,gap:2},children:[(0,be.jsx)(fe.Icon,{name:e.icon,colour:s?F.colours.gold:F.colours.muted}),(0,be.jsx)(E.T,{size:e.label.length>10?10:11,weight:s?'semibold':'regular',colour:s?F.colours.gold:F.colours.muted,center:!0,children:e.label})]},e.id)})}),(0,be.jsx)(pe.ChefAssistantSheet,{go:(e,s)=>{'orders'===e?(Pe(s),Fe('orders')):'gp'===e?Fe('gp'):Fe('kitchen',e)}}),(0,be.jsx)(re.AlertHost,{variant:"chef",rid:t,skipTakeaway:!0}),(0,be.jsx)(ae.KitchenFlash,{rid:t,me:i})]})};var s=_r(_d[0]),t=_r(_d[1]),o=_r(_d[2]),i=_r(_d[3]),n=_r(_d[4]),l=_r(_d[5]),r=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),h=_r(_d[9]),u=_r(_d[10]),p=_r(_d[11]),f=_r(_d[12]),b=_r(_d[13]),k=_r(_d[14]),y=_r(_d[15]),x=_r(_d[16]),j=_r(_d[17]),w=_r(_d[18]),C=_r(_d[19]),T=_r(_d[20]),v=_r(_d[21]),S=_r(_d[22]),P=_r(_d[23]),I=e(_r(_d[24]));_r(_d[25]);var R=e(_r(_d[26])),B=e(_r(_d[27])),H=e(_r(_d[28])),A=e(_r(_d[29])),O=_r(_d[30]),D=_r(_d[31]),L=_r(_d[32]),E=_r(_d[33]),$=_r(_d[34]),F=_r(_d[35]),W=_r(_d[36]),_=_r(_d[37]),G=_r(_d[38]),M=_r(_d[39]),N=_r(_d[40]),z=_r(_d[41]),K=_r(_d[42]),V=_r(_d[43]),U=_r(_d[44]),q=_r(_d[45]),Q=_r(_d[46]),Y=_r(_d[47]),J=_r(_d[48]),X=_r(_d[49]),Z=_r(_d[50]),ee=_r(_d[51]),se=_r(_d[52]),te=_r(_d[53]),oe=_r(_d[54]),ie=_r(_d[55]),ne=_r(_d[56]),le=_r(_d[57]),re=_r(_d[58]),ae=_r(_d[59]),de=_r(_d[60]),ce=_r(_d[61]),he=_r(_d[62]),ue=_r(_d[63]),pe=_r(_d[64]),ge=_r(_d[65]),fe=_r(_d[66]),be=_r(_d[67]);s.LIVE_HEAD_CHEF&&(0,t.requireRealData)();const ke=[{id:'home',label:'Home',icon:'home'},{id:'stock',label:'Stock',icon:'box'},{id:'gp',label:'GP',icon:'forecast'},{id:'creator',label:ie.CREATOR_TITLE,icon:'sparkle'},{id:'orders',label:'Orders',icon:'orders'},{id:'kitchen',label:'Kitchen',icon:'platter'}],ye=[{id:'myshift',title:'My shifts & clock in',sub:'Clock in and out (checks you are at the venue), breaks, and your shifts on the rota'},{id:'mypay',title:'My pay & tips',sub:'Your hours, tips share, tip goal, paydays and payslip info. Only you see this'},{id:'takings',title:'Takings & tips graphs',sub:'Daily cash ups, weekly sales, this week vs last, categories and the Tips pot (view only)'},{id:'bookings',title:'Today\u2019s bookings',sub:'Covers, allergens to sign off, platters and other reservations, dogs, access and vegan/vegetarian'},{id:'recipes',title:'Recipe cards',sub:'Plating photo, ingredients, method, allergens, section and price; you sign each card off before it goes live'},{id:'specials',title:'Specials board',sub:'Photo of the chalkboard or typed specials with allergens; shown in the customer app'},{id:'board',title:'Question board',sub:'Ask the team anything anonymously, and vote'},{id:'teamtasks',title:'Kitchen team tasks',sub:'Daily tasks for your chefs, commis and KPs'},{id:'orderlists',title:'Order lists',sub:'Alsons drinks, Cash and carry: add items, tick on the day, finish and carry over'},{id:'foodsafety',title:'Food safety (CookSafe)',sub:'Based on CookSafe (Food Standards Scotland). Full logs coming in the next update'},{id:'haccp',title:'Food safety log (HACCP)',sub:'Temperatures, cleaning and allergen checks; voice entry; limits; EHO export'},{id:'accidents',title:'Accident book',sub:'Accidents and near misses; you see your own entries'},{id:'prep',title:'Prep list',sub:'From the forecast and bookings, tick off as you go'},{id:'live',title:'Live tickets, sold out, team & chat',sub:'Orders, readiness alerts, sold out, who\u2019s on, rota, team chat and private messages'},{id:'waste',title:'Waste log',sub:'Item, quantity, reason and cost; weekly total and % of sales'},{id:'allergens',title:'Allergens',sub:'14-allergen matrix from the recipe cards, costing cross-check and audit log'},{id:'compliance',title:'Kitchen compliance',sub:'Fridge, freezer, cooking and cooling temps; cleaning; daily checks'}],me={stock:{tab:'stock',stock:'levels'},'stock-take':{tab:'stock',stock:'take'},deliveries:{tab:'stock',stock:'deliveries'},gp:{tab:'gp',gp:'dishes'},'price-changes':{tab:'gp',gp:'changes'},'gp-week':{tab:'gp',gp:'week'},'menu-engineering':{tab:'gp',gp:'engineering'},orders:{tab:'orders'},prep:{tab:'kitchen',k:'prep'},live:{tab:'kitchen',k:'live'},waste:{tab:'kitchen',k:'waste'},recipes:{tab:'kitchen',k:'recipes'},'recipe-cards':{tab:'kitchen',k:'recipes'},allergens:{tab:'kitchen',k:'allergens'},compliance:{tab:'kitchen',k:'compliance'},haccp:{tab:'kitchen',k:'haccp'},specials:{tab:'kitchen',k:'specials'},accidents:{tab:'kitchen',k:'accidents'},'new-dish':{tab:'creator'}};function xe({go:e}){const{k:s,c:t,menu:o,now:n,rid:l,me:r}=(0,G.useChef)(3e4),d=(0,K.useSheetReminders)(),c=(0,G.useWeek)(),{covers:h,label:u,enough:p,booked:f}=(0,G.useForecast)(),b=(0,z.useSuggestions)(),k=s.ingredients.filter(e=>e.onHand<=0||(0,G.isLow)(e.onHand,e.par)),y=b.filter(e=>e.ordersToday&&!e.placedToday),x=(0,_.priceImpacts)(o,s.recipes,s.ingredients,s.targetGp).filter(e=>e.dropped.length),j=s.deliveries.filter(e=>'expected'===e.status),w=!s.recipes.length||!s.ingredients.length,C=w?[]:t.filter(e=>e.below),T=(0,i.useLiveState)(),v=(0,ue.useRecipeCards)(l).filter(e=>!e.signOff);return(0,be.jsxs)(A.default,{style:{gap:12},testID:"chef-dashboard",children:[(0,be.jsx)(ne.MissedBanner,{mode:"chef",now:n,onPress:()=>e('kitchen','haccp')}),d.map(s=>(0,be.jsx)(R.default,{accessibilityRole:"button",onPress:()=>e('orders',s.supplierId),children:(0,be.jsxs)(E.Banner,{kind:'red'===s.tone?'danger':'warn',title:`\u23f0 ${s.text}`,children:["Tap to open the ",s.name," order sheet. Nothing is sent until you press Send."]})},s.supplierId)),v.length?(0,be.jsx)(R.default,{testID:"cards-awaiting",accessibilityRole:"button",onPress:()=>e('kitchen','recipes'),children:(0,be.jsxs)(E.Banner,{kind:"warn",title:`${v.length} recipe card${1===v.length?'':'s'} awaiting your sign-off`,children:[v.slice(0,4).map(e=>e.dish).join(', '),". Guests see \"awaiting allergen sign-off\" and cannot order these until you sign them off."]})}):null,(0,be.jsx)(V.ShellfishTile,{rid:l,by:r,app:"chef",onOrder:()=>e('orders','os-kittyfisher')}),(0,be.jsxs)(E.Row,{wrap:!0,gap:10,children:[w?(0,be.jsx)(G.Tile,{testID:"tile-gp",label:"GP this week vs target",value:"Nothing yet",sub:"Add ingredients and recipe costs to see GP",onPress:()=>e('gp','week')}):(0,be.jsx)(G.Tile,{testID:"tile-gp",label:"GP this week vs target",value:(0,G.pct1)(c.theo),sub:`Target ${s.targetGp}% \xb7 actual ${(0,G.pct1)(c.actual)}`,tone:c.theoe('gp','week')}),(0,be.jsx)(G.Tile,{testID:"tile-stock",label:"Stock value",value:s.ingredients.length?(0,$.gbp)((0,G.stockValue)(s.ingredients)):'Nothing yet',sub:s.ingredients.length?'At cost':'No stock counted yet',onPress:()=>e('stock','levels')}),(0,be.jsx)(G.Tile,{label:"Items low or out",value:s.ingredients.length?`${k.length}`:'Nothing yet',sub:s.ingredients.length?k.slice(0,3).map(e=>e.name).join(', '):'No stock counted yet',tone:k.some(e=>e.onHand<=0)?'red':k.length?'amber':'ok',onPress:()=>e('stock','levels')}),(0,be.jsx)(G.Tile,{label:"Waste this week",value:s.waste.length?(0,$.gbp)(c.wasteWeek):'Nothing yet',sub:c.sales?`${(0,G.pct1)(c.wasteWeek/c.sales*100)} of food sales`:'',onPress:()=>e('kitchen','waste')}),p?(0,be.jsx)(G.Tile,{label:"Covers forecast today",value:`${h}`,sub:u,onPress:()=>e('kitchen','prep')}):(0,be.jsx)(G.Tile,{label:"Booked so far today",value:'ready'===T?`${f}`:'connecting'===T?'Connecting\u2026':'Not connected',sub:"Not enough history for a forecast yet",onPress:()=>e('kitchen','prep')}),(0,be.jsx)(G.Tile,{label:"Orders due today",value:`${y.length}`,sub:y.map(e=>`${e.s.name} by ${e.s.cutoff}`).join(' \xb7 ')||'None',tone:y.some(e=>e.cutPassed)?'red':y.length?'amber':'ok',onPress:()=>e('orders')})]}),x.map(e=>(0,be.jsxs)(E.Banner,{kind:"danger",title:`${e.ing.name} ${e.pct>0?'+':''}${e.pct.toFixed(0)}%: ${e.dropped.length} dish${1===e.dropped.length?'':'es'} drop below target`,children:[e.dropped.map(e=>e.item.name).join(', '),". Open GP \u203a Price changes."]},e.ing.id)),j.length?(0,be.jsx)(R.default,{accessibilityRole:"button",onPress:()=>e('stock','deliveries'),children:(0,be.jsx)(E.Banner,{kind:"info",title:`${j.length} deliver${1===j.length?'y':'ies'} to check in today`,children:"Count in against the order, flag shorts and price changes."})}):null,C.length?(0,be.jsx)(R.default,{accessibilityRole:"button",onPress:()=>e('gp','dishes'),children:(0,be.jsxs)(E.Banner,{kind:"warn",title:`${C.length} dishes below ${s.targetGp}% GP`,children:[C.slice(0,4).map(e=>e.item.name).join(', '),C.length>4?'\u2026':'']})}):null,(0,be.jsx)(E.Row,{wrap:!0,gap:8,children:[['Recipe cards','recipes'],['Food safety log','haccp'],['Specials board','specials'],[ie.CREATOR_TITLE,'creator'],['Prep list','prep'],['Live tickets & sold out','live'],['Allergens','allergens'],['Accident book','accidents']].map(([s,t])=>(0,be.jsx)(R.default,{accessibilityRole:"button",accessibilityLabel:s,onPress:()=>'creator'===t?e('creator'):e('kitchen',t),style:{flexGrow:1,flexBasis:140,padding:12,borderRadius:12,borderWidth:1.5,borderColor:F.colours.gold,backgroundColor:F.colours.surface},children:(0,be.jsxs)(E.T,{weight:"semibold",children:[s," \u203a"]})},t))}),(0,be.jsx)(E.Badge,{kind:"neutral",label:"Nothing is ordered or sent from here"})]})}},805,[1230,1118,917,1231,989,990,992,2,1002,993,994,958,818,920,1291,1292,949,1001,919,999,1000,923,1295,30,233,122,263,151,287,127,289,860,924,813,816,821,926,1299,1303,1306,1307,1334,1335,937,1336,1006,921,1007,1009,1008,1342,988,952,858,1010,1343,1011,1347,931,1356,933,996,997,819,1357,820,1005,24]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"APP_VARIANT",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"ENTRY",{enumerable:!0,get:function(){return s}}),_e.isAllowedPath=function(e,n=c){return!(t.IS_ISOLATED_VENUE&&/^\/(customer|table)(\/|$)/.test(e)&&![`/customer/${t.VENUE_RID}`,`/customer/${t.VENUE_RID}/`].includes(e))&&('/'===e||''===e||f[n].test(e))},_e.canShow=function(e,t=c){return t===e||'owner'===t&&'customer'===e};var e,t=r(d[0]),n=r(d[1]),o=(e=n)&&e.__esModule?e:{default:e};const u=o.default.expoConfig?.extra?.appVariant??void 0??'owner',c=['owner','staff','customer','display','chef'].includes(u)?u:'owner',s={owner:'/owner',staff:'/team',customer:`/customer/${t.VENUE_RID}`,display:'/display',chef:'/kitchen'},f={owner:/^\/(owner|customer|table)(\/|$)/,customer:/^\/(customer|table)(\/|$)/,staff:/^\/team(\/|$)/,display:/^\/display(\/|$)/,chef:/^\/kitchen(\/|$)/}},806,[5,408]); +__d(function(g,r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"PERMISSIONS",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"can",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"CHEF_SECTIONS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"chefSectionAllowed",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"rotaView",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"chatView",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"ticketView",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"supplierView",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"auditView",{enumerable:!0,get:function(){return p}});const e={owner:'all',manager:'all',staff:new Set(['rota-shifts','tickets','eighty-six','allergens']),chef:new Set(['stock','costing','gp','waste','dish-sales','prep','ordering','allergens','compliance','rota-shifts','kitchen-chat','tickets','eighty-six','specials'])},t=(t,n)=>{const a=e[t];return'all'===a||a.has(n)},n={stock:'stock','stock-take':'stock',deliveries:'stock',gp:'gp','price-changes':'gp','gp-week':'gp','menu-engineering':'dish-sales',orders:'ordering',prep:'prep',live:'tickets',waste:'waste',allergens:'allergens',compliance:'compliance',haccp:'compliance',accidents:'compliance','new-dish':'gp',specials:'specials',recipes:'allergens','recipe-cards':'allergens'},a=e=>e in n&&t('chef',n[e]),s=(e,n,a)=>t(e,'staff-personal')?{staff:n,shifts:a}:{staff:n.filter(e=>e.active).map(e=>({id:e.id,name:e.name,...e.nickname?{nickname:e.nickname}:{},job:e.job})),shifts:a.filter(e=>e.published).map(({id:e,staffId:t,date:n,day:a,start:s,end:c,published:l})=>({id:e,staffId:t,date:n,day:a,start:s,end:c,published:l}))},c=(e,t)=>'chef'===e?t.filter(e=>'kitchen'===e.ch&&!e.removed):t,l=(e,n)=>t(e,'customer-personal')?n:n.map(({id:e,ref:t,type:n,tableNo:a,slotTime:s,lines:c,status:l,allergies:o,allergyAck:p,handoverCheck:f,allergyChain:u,bookingId:m,readiness:h,createdAt:b,restaurantId:k,notes:y,accepted:w,allergyTicks:j})=>({id:e,ref:t,type:n,tableNo:a,slotTime:s,lines:c,status:l,allergies:o,allergyAck:p,handoverCheck:f,allergyChain:u,bookingId:m,readiness:h,createdAt:b,restaurantId:k,notes:y,accepted:w,allergyTicks:j})),o=(e,n)=>t(e,'supplier-email')?n:n.map(e=>({...e,email:''})),p=(e,n)=>t(e,'audit-all')?n:n.filter(e=>'menu'===e.kind&&/allergen|sign-off|recipe card/i.test(e.text))},807,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(t){const n=String(t??'').trim(),l=n.match(/\d+/g);return 1===l?.length?l[0].replace(/^0+(?=\d)/,''):n}Object.defineProperty(e,'__esModule',{value:!0}),e.plainTableNumber=t,Object.defineProperty(e,"tableNumbers",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"tableListNumbers",{enumerable:!0,get:function(){return l}}),e.tableNumbersA11y=function(t){const l=n(t).split('+').filter(Boolean);return l.length?`${1===l.length?'Table':'Tables'} ${l.join(', ')}`:'No table'};const n=n=>String(n??'').split('+').map(t).filter(Boolean).join('+'),l=(t,l=" + ")=>t.map(n).filter(Boolean).join(l)},808,[]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEFAULT_DWELL",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"dwellBands",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"bandLabel",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"fmtMins",{enumerable:!0,get:function(){return o}}),_e.dwellFor=function(e,t,r=[]){const o=n(e),i=Math.max(0,o.findIndex(e=>t<=e.upTo)),s=o[i]??o[o.length-1];if(!1===e?.settings.dwellLearn)return{mins:s.mins,learned:!1,samples:0};const a=0===i?1:o[i-1].upTo+1,u=r.filter(e=>'finished'===e.status&&e.seatedAt&&e.finishedAt&&e.partySize>=a&&e.partySize<=s.upTo).map(e=>(new Date(e.finishedAt).getTime()-new Date(e.seatedAt).getTime())/6e4).filter(e=>e>=20&&e<=360).sort((e,t)=>e-t);if(u.length<8)return{mins:s.mins,learned:!1,samples:u.length};const l=u[Math.floor(u.length/2)];return{mins:5*Math.round((s.mins+l)/2/5),learned:!0,samples:u.length}},Object.defineProperty(_e,"DAYS",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"ruleText",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"ANCHORAGE_EVENTS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"regularEventsOf",{enumerable:!0,get:function(){return l}}),_e.occursOn=m,_e.nextOccurrence=function(e,t){const n=f(t);for(let t=0;t<400;t++){const r=c(new Date(n.getFullYear(),n.getMonth(),n.getDate()+t));if(m(e,r))return r}return null},_e.expandEvents=function(e,t,n,r){const o=[];if(!t.some(e=>e.active))return o;const i=f(n),s=f(r);for(let n=i;n<=s;n=new Date(n.getFullYear(),n.getMonth(),n.getDate()+1)){const r=c(n);for(const n of t)m(n,r)&&o.push({id:`${n.id}:${r}`,restaurantId:e,date:r,title:n.name,kind:'event',example:!1,source:'regular',description:[n.time?`from ${n.time}`:'',n.lastFood?`last food orders ${n.lastFood}`:'',n.notes??''].filter(Boolean).join(' \xb7 '),busier:n.busier,lastFood:n.lastFood,time:n.time})}return o},_e.lastFoodOn=function(t,n){if(!t)return null;const r=f(n).getDay(),o=t.settings.lastFoodByDay?.[r],s=(0,e.kitchenHoursOn)(t,f(n));let a=s?{time:s[1],reason:'kitchen closes'}:null;o&&(!a||oe?.settings.dwellBands?.length?e.settings.dwellBands:t,r=(e,t)=>{const n=0===t?1:e[t-1].upTo+1,r=e[t].upTo;return r>=9999?`${n} or more covers`:n===r?`${n} cover${1===n?'':'s'}`:`${n}\u2013${r} covers`},o=e=>e%60==0?`${e/60} hour${60===e?'':'s'}`:e>60?`${Math.floor(e/60)} h ${e%60} min`:`${e} min`;const i=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],s=['','first','second','third','fourth'],a=e=>'last'===e.kind?`Last ${i[e.weekday]} of every month`:'nth'===e.kind?`${s[e.n][0].toUpperCase()}${s[e.n].slice(1)} ${i[e.weekday]} of every month`:'weekly'===e.kind?`Every ${i[e.weekday]}`:`One-off: ${e.date}`,u=[{id:'ev-music-night',name:'Open Mic Night',rule:{kind:'last',weekday:0},time:'20:00',notes:'Live music from 8pm.',busier:!0,lastFood:'19:00',active:!0}],l=e=>e?.settings.regularEvents??('anchorage'===e?.id?u:[]),d=e=>String(e).padStart(2,'0'),c=e=>`${e.getFullYear()}-${d(e.getMonth()+1)}-${d(e.getDate())}`,f=e=>new Date(Number(e.slice(0,4)),Number(e.slice(5,7))-1,Number(e.slice(8,10)));function m(e,t){if(!e.active)return!1;const n=e.rule;if('once'===n.kind)return n.date===t;const r=f(t);return r.getDay()===n.weekday&&('weekly'===n.kind||('nth'===n.kind?Math.ceil(r.getDate()/7)===n.n:new Date(r.getFullYear(),r.getMonth(),r.getDate()+7).getMonth()!==r.getMonth()))}const b=e=>e?.settings.afterLastFood??'drinks',p=e=>{const[t,n]=e.split(':').map(Number);return`${t%12||12}${n?`:${d(n)}`:''}${t<12?'am':'pm'}`},y=e=>e?.settings.showTakeaway??'anchorage'!==e?.id,h=e=>!1!==e?.settings.coversCounter,O=e=>!1!==e?.settings.nextTableFree,$=e=>!1!==e?.settings.dogQuestion,w=e=>!1!==e?.settings.dietQuestion,F=e=>!1!==e?.settings.accessQuestion,k=(e,t)=>e?.settings.holidayFullNames?t:t.replace(/\s*\(substitute day\)/gi,'').trim()},809,[815]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Honeypot=function({value:t,onChange:n}){return(0,l.jsx)(o.default,{"aria-hidden":!0,pointerEvents:"none",style:{position:'absolute',left:-1e4,top:0,width:1,height:1,overflow:'hidden',opacity:0},children:(0,l.jsx)(e.TextInput,{testID:"hp-field",accessibilityLabel:"Leave this empty",value:t,onChangeText:n,tabIndex:-1,autoComplete:'off',name:'cc_extra_info','aria-hidden':!0})})};var e=r(d[0]);r(d[1]),r(d[2]);var t,n=r(d[3]),o=(t=n)&&t.__esModule?t:{default:t},l=r(d[4])},810,[875,30,122,127,24]); +__d(function(_g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.startForm=function(t=Date.now()){return{openedAt:t,hp:''}},e.guardFor=function(t,n=Date.now()){return{hp:t.hp,formMs:Math.max(0,Math.round(n-t.openedAt))}},e.rememberGuard=function(n,o){t.set(n,o)},e.takeGuard=function(n){const o=t.get(n);return o?(t.delete(n),o):{}};const t=new Map},811,[]); +__d(function(g,r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"NOTES_PLACEHOLDER",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"WIX_EDIT_NOTE",{enumerable:!0,get:function(){return o}}),e.canEditBooking=function(t){return'customer'!==t.variant&&('staff'===t.variant||t.inStaffApp?!!t.shiftManager:'display'===t.variant||'chef'===t.variant||'staff'!==t.role)},Object.defineProperty(e,"isWixBooking",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"EDIT_FIELDS",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"FIELD_WORDS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"draftOf",{enumerable:!0,get:function(){return c}}),e.changedFields=f,e.editPatch=function(t,n,o,s=(new Date).toISOString()){const d=f(t,n);if(!d.length)return{};const l={};for(const t of d){const o=u(t,n[t]);l[t]='partySize'===t?Math.max(1,Math.min(200,o)):'phone'===t||'email'===t||'table'===t?o||void 0:o}d.includes('table')&&(l.tableSetHere=!0);const c=t;return l.locallyEdited=!0,l.editedFields=[...new Set([...c.editedFields??[],...d])],l.editLog=[...c.editLog??[],{at:s,by:o.by.slice(0,80),app:o.app,fields:d}].slice(-50),l},e.editWarnings=function(n,o,s,d,l=90){const c=[],u={...n,date:o.date,time:o.time,partySize:o.partySize};if(o.table){const n=(0,t.tableOverlaps)(u,o.table,s.filter(t=>t.date===o.date),l);n.length&&c.push(`The table already has a booking at about the same time: ${n.map(t=>`${t.time} ${t.walkIn?'walk-in':t.name}`).join(', ')}.`)}d&&c.push(`Bookings are paused ${d.from} to ${d.to}${d.reason?` (${d.reason})`:''}.`);return c},Object.defineProperty(e,"editedWords",{enumerable:!0,get:function(){return b}});var t=r(_d[0]);const n='For example: birthday, high chair, dog, window seat',o='This booking came from the website. Changes here are not sent to website bookings yet.';const s=t=>{const n=t;return'Wix'===n.importedFrom||!!n.wix||(t.tags??[]).includes('Wix')},d=['date','time','partySize','name','phone','email','notes','table'],l={date:'date',time:'time',partySize:'covers',name:'name',phone:'phone',email:'email',notes:'notes',table:'table'},c=t=>({date:t.date,time:t.time,partySize:t.partySize,name:t.name,phone:t.phone??'',email:t.email??'',notes:t.notes??'',table:t.table??''}),u=(t,n)=>'partySize'===t?Number(n):String(n??'').trim();function f(t,n){const o=c(t);return d.filter(t=>u(t,o[t])!==u(t,n[t]))}const b=t=>t.map(t=>l[t]).join(', ')},812,[1296]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"webLine",{enumerable:!0,get:function(){return j.webLine}}),_e.T=I,Object.defineProperty(_e,"H1",{enumerable:!0,get:function(){return R}}),Object.defineProperty(_e,"H2",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"Muted",{enumerable:!0,get:function(){return W}}),_e.BrandBar=D,_e.Screen=function({children:e,title:t,subtitle:o,back:l=!0,right:n,maxWidth:s=640,footer:u,scroll:b=!0}){const f=(0,w.jsx)(h.default,{style:{width:'100%',maxWidth:s,alignSelf:'center',padding:16,gap:12,alignItems:'stretch'},children:e});return(0,w.jsxs)(y.SafeAreaView,{style:{flex:1,backgroundColor:p.colours.bg},edges:['top','left','right'],children:[(0,w.jsx)(h.default,{style:{width:'100%',maxWidth:s,alignSelf:'center'},children:(0,w.jsx)(D,{title:t,subtitle:o,back:l,right:n})}),b?(0,w.jsx)(c.default,{contentContainerStyle:{paddingBottom:40},children:f}):(0,w.jsx)(h.default,{style:{flex:1},children:f}),u?(0,w.jsx)(h.default,{style:H.footer,children:(0,w.jsx)(h.default,{style:{width:'100%',maxWidth:s,alignSelf:'center'},children:u})}):null]})},_e.Button=function({label:e,sub:t,onPress:o,kind:l="primary",disabled:n,small:c,style:u,accessibilityLabel:b,testID:h}){const f={primary:p.colours.gold,secondary:p.colours.tile,danger:p.colours.redSolid,ghost:'transparent',success:p.colours.accentBg}[l],y={primary:p.colours.onGold,secondary:p.colours.text,danger:'#FFFFFF',ghost:p.colours.gold,success:p.colours.goldLight}[l],j={primary:'transparent',secondary:p.colours.hairline,danger:'transparent',ghost:'transparent',success:p.colours.accentBorder}[l];return(0,w.jsxs)(s.default,{testID:h,accessibilityRole:"button",accessibilityLabel:b??e,accessibilityState:{disabled:!!n},disabled:n,onPress:o,style:({pressed:e})=>[H.btn,{backgroundColor:e&&'secondary'===l?p.colours.tilePressed:f,borderColor:j,opacity:n?.4:e?.85:1},c&&{paddingVertical:8,paddingHorizontal:14,minHeight:x.control.min,minWidth:44},u],children:[(0,w.jsx)(I,{weight:"semibold",size:c?p.font.small:p.font.body,colour:y,center:!0,children:e}),t?(0,w.jsx)(I,{size:c?p.font.small-2:p.font.small,colour:y,center:!0,testID:h?`${h}-sub`:void 0,children:t}):null]})},_e.Card=function({children:e,style:t,onPress:o,highlight:l}){const n=l===p.colours.gold||l===p.colours.accentBorder,c=(0,w.jsx)(h.default,{style:[H.card,{alignItems:'center'},l?{borderColor:n?p.colours.accentBorder:l,borderWidth:n?1:2}:null,t],children:e});return o?(0,w.jsx)(s.default,{accessibilityRole:"button",onPress:o,style:({pressed:e})=>({opacity:e?.85:1}),children:c}):c},_e.Badge=function({label:e,kind:t="neutral"}){const o={neutral:[p.colours.surface2,p.colours.muted,p.colours.border],gold:[p.colours.goldTint,p.colours.goldLight,p.colours.gold],red:[p.colours.redBg,'#FFD9D4',p.colours.red],amber:[p.colours.amberBg,'#FFE2A8',p.colours.amber],ok:[p.colours.okBg,p.colours.goldLight,p.colours.ok],blue:[p.colours.blueBg,p.colours.goldLight,p.colours.blue]}[t];return(0,w.jsx)(h.default,{style:[H.badge,{backgroundColor:o[0],borderColor:o[2],maxWidth:'100%'}],children:(0,w.jsx)(I,{size:13,weight:"medium",colour:o[1],style:{flexShrink:1},children:e})})},_e.Banner=F,Object.defineProperty(_e,"ExampleAllergenNotice",{enumerable:!0,get:function(){return z}}),Object.defineProperty(_e,"DemoPaymentNotice",{enumerable:!0,get:function(){return P}}),_e.Row=L,Object.defineProperty(_e,"Divider",{enumerable:!0,get:function(){return v}}),_e.Field=function({label:e,...o}){return(0,w.jsxs)(h.default,{style:{gap:4,alignSelf:'stretch',width:'100%'},children:[(0,w.jsx)(I,{size:p.font.small,weight:"medium",colour:p.colours.muted,center:!0,children:e}),(0,w.jsx)(t.TextInput,{accessibilityLabel:e,placeholderTextColor:"#7D776C",...o,style:[H.input,o.multiline&&{minHeight:70,textAlignVertical:'top'},o.style]})]})},_e.Chip=function({label:e,selected:t,onPress:o,disabled:l,sub:n,testID:c}){return(0,w.jsxs)(s.default,{testID:c,accessibilityRole:"button",accessibilityState:{selected:!!t,disabled:!!l},accessibilityLabel:`${e}${n?`, ${n}`:''}${t?', selected':''}`,'aria-pressed':!!t,disabled:l,onPress:o,style:[H.chip,t&&{backgroundColor:p.colours.gold,borderColor:p.colours.gold},l&&{opacity:.35}],children:[(0,w.jsx)(I,{size:p.font.small,weight:"medium",colour:t?p.colours.onGold:p.colours.text,center:!0,children:e}),n?(0,w.jsx)(I,{size:12,colour:t?p.colours.onGold:p.colours.muted,center:!0,children:n}):null]})},_e.Toggle=function({value:e,onChange:t,label:o,testID:l,disabled:n,a11y:s}){return(0,w.jsxs)(L,{style:{justifyContent:'space-between',flexShrink:1,minWidth:0},children:[(0,w.jsx)(I,{style:{flex:1,flexShrink:1},children:o}),(0,w.jsx)(b.default,{testID:l,disabled:n,accessibilityLabel:s??o,value:e,onValueChange:t,trackColor:{true:p.colours.gold,false:'#444'},thumbColor:e?'#FFF6E0':'#BBB',activeThumbColor:'#FFF6E0',activeTrackColor:p.colours.gold})]})},_e.Stepper=function({value:e,onChange:t,min:o=1,max:l=20,label:n,step:c=1,format:u,testID:b}){const f=u?u(e):String(e),y=e=>Math.round(e/c)*c;return(0,w.jsxs)(L,{gap:10,children:[(0,w.jsx)(s.default,{testID:b?`${b}-down`:void 0,accessibilityRole:"button",accessibilityLabel:`Decrease ${n??''}`,disabled:e<=o,onPress:()=>t(Math.max(o,y(e-c))),style:[H.stepBtn,e<=o?{opacity:.4}:null],children:(0,w.jsx)(I,{size:20,colour:p.colours.gold,children:"\u2212"})}),(0,w.jsx)(h.default,{testID:b?`${b}-value`:void 0,accessibilityLabel:n?`${n}: ${f}`:f,children:(0,w.jsx)(I,{weight:"semibold",size:p.font.large,style:{minWidth:u?64:28,textAlign:'center'},children:f})}),(0,w.jsx)(s.default,{testID:b?`${b}-up`:void 0,accessibilityRole:"button",accessibilityLabel:`Increase ${n??''}`,disabled:e>=l,onPress:()=>t(Math.min(l,y(e+c))),style:[H.stepBtn,e>=l?{opacity:.4}:null],children:(0,w.jsx)(I,{size:20,colour:p.colours.gold,children:"+"})})]})},_e.Sheet=function({visible:e,onClose:t,title:o,children:u,maxWidth:b,testID:x,footer:j}){const{height:C}=(0,f.default)(),k=l.default.useContext(y.SafeAreaInsetsContext)??{top:0,bottom:0,left:0,right:0},B=Math.max(320,C-k.top-k.bottom-24);return(0,w.jsx)(n.default,{visible:e,transparent:!0,animationType:"fade",onRequestClose:t,children:(0,w.jsx)(h.default,{style:[H.overlay,{padding:12,paddingTop:12+k.top,paddingBottom:12+k.bottom}],children:(0,w.jsxs)(h.default,{style:[H.sheet,{maxHeight:B},b?{maxWidth:b}:null],testID:x,children:[(0,w.jsxs)(L,{style:{justifyContent:'space-between',marginBottom:8,gap:8},children:[(0,w.jsx)(T,{style:{flex:1},children:o}),(0,w.jsx)(s.default,{accessibilityRole:"button",accessibilityLabel:"Close",onPress:t,hitSlop:8,testID:"sheet-close",style:{minWidth:48,minHeight:48,width:S?72:48,alignItems:'center',justifyContent:'center',marginRight:-8,marginTop:-6},children:(0,w.jsx)(I,{size:S?18:24,colour:p.colours.text,children:S?'Close':'\u2715'})})]}),(0,w.jsx)(c.default,{style:{flexShrink:1},contentContainerStyle:{gap:12,paddingTop:2,paddingBottom:4},children:u}),j?(0,w.jsx)(h.default,{style:{borderTopWidth:1,borderTopColor:p.colours.border,paddingTop:10,marginTop:8},testID:x?`${x}-footer`:void 0,children:j}):null]})})})},_e.SectionTitle=function({children:e}){return(0,w.jsx)(I,{weight:"semibold",size:12,colour:p.colours.goldMuted,center:!0,style:{textTransform:'uppercase',letterSpacing:1.6,marginTop:8},children:e})},Object.defineProperty(_e,"styles",{enumerable:!0,get:function(){return H}});var t=r(d[0]),o=r(d[1]),l=e(r(d[2])),n=e(r(d[3])),s=e(r(d[4])),c=e(r(d[5])),u=e(r(d[6])),b=e(r(d[7])),h=e(r(d[8])),f=e(r(d[9])),y=r(d[10]),p=r(d[11]),x=r(d[12]),j=r(d[13]),C=r(d[14]),k=r(d[15]),B=r(d[16]),w=r(d[17]);const S=['kirkton','abbotsford'].includes(C.VENUE_RID);function I({children:e,style:o,size:l=p.font.body,weight:n="regular",colour:s=p.colours.text,numberOfLines:c,center:u,testID:b,accessibilityRole:h}){return(0,w.jsx)(t.Text,{testID:b,accessibilityRole:h,numberOfLines:c,style:[{fontFamily:p.fonts[n],fontSize:l,color:s,lineHeight:(0,x.lineFor)(l)},u&&{textAlign:'center'},o,(0,j.webLine)(o,l)],children:e})}const R=e=>(0,w.jsx)(I,{size:p.font.title,weight:"semibold",center:!0,...e}),T=e=>(0,w.jsx)(I,{size:p.font.large,weight:"semibold",center:!0,...e}),W=e=>(0,w.jsx)(I,{colour:p.colours.muted,size:p.font.small,...e});function D({title:e,back:t=!0,right:l,subtitle:n}){return(0,w.jsxs)(h.default,{style:H.brandBar,children:[(0,w.jsxs)(h.default,{style:H.row,children:[(0,w.jsx)(h.default,{style:H.brandSide,children:t?(0,w.jsx)(s.default,{accessibilityRole:"button",accessibilityLabel:"Back",onPress:()=>o.router.canGoBack()?o.router.back():o.router.replace(k.ENTRY[k.APP_VARIANT]),style:H.backBtn,hitSlop:10,children:(0,w.jsx)(I,{size:18,weight:"semibold",colour:p.colours.gold,children:"\u2039 Back"})}):null}),(0,w.jsx)(s.default,{onPress:()=>o.router.push(k.ENTRY[k.APP_VARIANT]),accessibilityLabel:"Home",style:H.brandCenter,children:(0,w.jsx)(B.RestaurantBrand,{size:B.HEADER_LOGO})}),(0,w.jsx)(h.default,{style:[H.brandSide,{alignItems:'flex-end'}],children:l?(0,w.jsx)(h.default,{style:{flexShrink:0},children:l}):null})]}),e?(0,w.jsx)(R,{style:{marginTop:10,alignSelf:'stretch'},children:e}):null,n?(0,w.jsx)(W,{center:!0,style:{alignSelf:'stretch'},children:n}):null]})}function F({kind:e="info",title:t,children:o}){const n={info:[p.colours.surface,p.colours.gold,p.colours.text],warn:[p.colours.amberBg,p.colours.amber,'#FFE2A8'],danger:[p.colours.redBg,p.colours.red,'#FFE3DF'],success:[p.colours.okBg,p.colours.ok,p.colours.goldLight],example:[p.colours.amberBg,p.colours.amber,'#FFE2A8'],demo:[p.colours.goldTint,p.colours.gold,p.colours.goldLight]}[e];return(0,w.jsxs)(h.default,{accessibilityRole:"summary",style:[H.banner,{backgroundColor:n[0],borderLeftColor:n[1]}],children:[t?(0,w.jsx)(I,{weight:"semibold",colour:n[2],center:!0,children:t}):null,l.default.Children.toArray(o).every(e=>'string'==typeof e||'number'==typeof e)?(0,w.jsx)(I,{size:p.font.small,colour:n[2],center:!0,children:o}):o]})}const z=()=>(0,w.jsx)(F,{kind:"example",title:"Allergens awaiting kitchen verification",children:"This allergen information has not been verified by the kitchen. Head chef sign-off is required. Always speak to staff about allergies."}),P=()=>(0,w.jsx)(F,{kind:"demo",title:"Card payments: not set up yet",children:"No card is charged and no payment provider is contacted."});function L({children:e,style:t,gap:o=8,wrap:l}){return(0,w.jsx)(h.default,{style:[H.row,{gap:o},l&&{flexWrap:'wrap',justifyContent:'center'},t],children:e})}const v=()=>(0,w.jsx)(h.default,{style:{height:1,backgroundColor:p.colours.border,marginVertical:4}});const H=u.default.create({row:{flexDirection:'row',alignItems:'center'},brandBar:{paddingHorizontal:16,paddingTop:8,paddingBottom:8,borderBottomWidth:1,borderBottomColor:p.colours.border},brandSide:{width:96,minHeight:48,justifyContent:'center'},brandCenter:{flex:1,alignItems:'center',justifyContent:'center',minHeight:48},backBtn:{paddingRight:12,minHeight:48,minWidth:88,justifyContent:'center'},btn:{borderRadius:x.radii.button,paddingVertical:12,paddingHorizontal:18,borderWidth:1,alignItems:'center',justifyContent:'center',minHeight:x.control.min,alignSelf:'stretch'},card:{backgroundColor:p.colours.surface,borderRadius:p.radius.l,padding:16,borderWidth:1,borderColor:p.colours.hairline,gap:8},badge:{borderRadius:999,paddingHorizontal:9,paddingVertical:2,borderWidth:1,alignSelf:'flex-start'},banner:{borderRadius:p.radius.m,padding:12,borderLeftWidth:5,gap:2},input:{minWidth:0,backgroundColor:p.colours.surface2,borderColor:p.colours.border,borderWidth:1,borderRadius:p.radius.m,paddingHorizontal:12,paddingVertical:10,color:p.colours.text,fontSize:p.font.body,fontFamily:p.fonts.regular},chip:{borderWidth:1,borderColor:p.colours.border,borderRadius:p.radius.m,paddingHorizontal:12,paddingVertical:8,backgroundColor:p.colours.surface2,minWidth:64,minHeight:44,justifyContent:'center'},stepBtn:{width:44,height:44,borderRadius:22,borderWidth:1.5,borderColor:p.colours.gold,alignItems:'center',justifyContent:'center'},overlay:{flex:1,backgroundColor:'rgba(0,0,0,0.7)',justifyContent:'center',alignItems:'center',padding:16},sheet:{backgroundColor:p.colours.surface,borderRadius:x.radii.xl,padding:18,width:'100%',maxWidth:520,maxHeight:'90%',borderWidth:1,borderColor:p.colours.gold},footer:{borderTopWidth:1,borderTopColor:p.colours.border,backgroundColor:p.colours.surface,padding:12}})},813,[875,804,30,256,263,151,46,271,127,287,289,821,1235,1237,5,806,860,24]); +__d(function(_g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ALLERGENS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"allergenLabel",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"SEVERITIES",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"severityLabel",{enumerable:!0,get:function(){return s}}),e.effectiveAllergens=function(l,n=[]){const t={...l.allergens};for(const s of l.optionGroups??[])for(const l of s.choices)if(n.includes(l.id)&&l.allergens)for(const[n,s]of Object.entries(l.allergens))'contains'!==t[n]&&(t[n]=s);return t},e.conflictsFor=function(l,n){const t=[],s=[];for(const a of n)'contains'===l[a.allergen]?t.push(a.allergen):'may'===l[a.allergen]&&s.push(a.allergen);return{contains:t,may:s}},Object.defineProperty(e,"hasConflict",{enumerable:!0,get:function(){return a}});const l=[{id:'gluten',label:'Cereals containing gluten',short:'Gluten'},{id:'crustaceans',label:'Crustaceans',short:'Crustaceans'},{id:'molluscs',label:'Molluscs',short:'Molluscs'},{id:'eggs',label:'Eggs',short:'Eggs'},{id:'fish',label:'Fish',short:'Fish'},{id:'peanuts',label:'Peanuts',short:'Peanuts'},{id:'treenuts',label:'Tree nuts',short:'Tree nuts'},{id:'soya',label:'Soya',short:'Soya'},{id:'milk',label:'Milk',short:'Milk'},{id:'celery',label:'Celery',short:'Celery'},{id:'mustard',label:'Mustard',short:'Mustard'},{id:'sesame',label:'Sesame',short:'Sesame'},{id:'sulphites',label:'Sulphur dioxide / sulphites',short:'Sulphites'},{id:'lupin',label:'Lupin',short:'Lupin'}],n=n=>l.find(l=>l.id===n)?.short??n,t=[{id:'intolerance',label:'Intolerance'},{id:'allergy',label:'Allergy'},{id:'coeliac',label:'Coeliac disease'},{id:'anaphylaxis',label:'Severe \u2014 anaphylaxis risk'}],s=l=>t.find(n=>n.id===l)?.label??l;const a=l=>l.contains.length>0||l.may.length>0},814,[]); +__d(function(g,_r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ANCHORAGE_SEASONS",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"hourSetsOf",{enumerable:!0,get:function(){return n}}),e.seasonOn=s,e.kitchenHoursOn=l,e.hoursFor=function(r,n){const u=l(r,n);return u?{open:(0,t.atTime)(n,u[0]),close:(0,t.atTime)(n,u[1])}:null};var t=_r(_d[0]);const r=[{id:'winter',name:'Winter',hours:{0:['12:30','19:00'],1:null,2:null,3:['12:00','19:00'],4:['12:00','19:00'],5:['12:00','20:00'],6:['12:00','20:00']}},{id:'summer',name:'Summer',hours:null}],n=t=>t.settings.hourSets??('anchorage'===t.id?r:[]),u=t=>`${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`,o=t=>`${t.getFullYear()}-${u(t)}`;function s(t,r){const o=n(t).filter(t=>t.hours);if(!o.length)return null;const s=o.filter(t=>t.start).sort((t,r)=>t.start.localeCompare(r.start));if(s.length<2)return s[0]??o[0];const l=u(r);return[...s].reverse().find(t=>t.start<=l)??s[s.length-1]}function l(t,r){const n=(t.settings.hourOverrides??[]).find(t=>t.date===o(r));if(n)return n.hours;const u=s(t,r);return u?.hours?u.hours[r.getDay()]??null:t.kitchenHours[r.getDay()]??null}},815,[818]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"gbp",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"pounds",{enumerable:!0,get:function(){return n}});const t=t=>`\xa3${(t/100).toFixed(2)}`,n=t=>Math.round(100*t)},816,[]); +__d(function(g,_r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.takeawaySlots=function(s,o,r){const l=(0,t.hoursFor)(s,r);if(!l)return[];const d=s.settings.slotMinutes,u=(0,n.addMins)(r,s.settings.leadMins),c=[];for(let t=new Date(l.open);t<=l.close;t=(0,n.addMins)(t,d)){if(tn.restaurantId===s.id&&'takeaway'===n.type&&'cancelled'!==n.status&&n.slotTime&&new Date(n.slotTime).getTime()===t.getTime()).length;c.push({time:new Date(t),label:(0,n.hm)(t),taken:r,cap:s.settings.slotCap,full:r>=s.settings.slotCap})}return c},e.bookingSlots=function(r,l,d,u,c){const f=(0,t.hoursFor)(r,l);if(!f)return[];const p=[],M=(0,n.addMins)(f.close,-60),h=(0,s.lastFoodOn)(r,o(l)),k=h?(0,n.addMins)((0,n.atTime)(l,h.time),-60):M,S='drinks'===(0,s.afterLastFood)(r);for(let t=new Date(f.open);t<=M;t=(0,n.addMins)(t,30)){const s=(0,n.hm)(t),o=t>k;if(o&&!S)continue;const l=r.settings.bookingCoversPerSlot-d(s),f=t.getTime()=u,...o?{drinksOnly:!0}:{}})}return p};var t=_r(_d[0]),n=_r(_d[1]),s=_r(_d[2]);const o=t=>`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`},817,[815,818,809]); +__d(function(g,r,i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"pad",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"ymd",{enumerable:!0,get:function(){return n}}),e.venueYmd=function(t,u="Europe/London"){try{const n=new Intl.DateTimeFormat('en-CA',{timeZone:u,year:'numeric',month:'2-digit',day:'2-digit'}).format(t);if(/^\d{4}-\d{2}-\d{2}$/.test(n))return n}catch{}return n(t)},Object.defineProperty(e,"hm",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"parseYmd",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"toMins",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"fromMins",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"atTime",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"addMins",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"dayShort",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"dayLong",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"monthLong",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"niceDate",{enumerable:!0,get:function(){return M}}),Object.defineProperty(e,"niceDateYear",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"minsBetween",{enumerable:!0,get:function(){return P}});const t=t=>String(t).padStart(2,'0'),n=n=>`${n.getFullYear()}-${t(n.getMonth()+1)}-${t(n.getDate())}`;const u=n=>`${t(n.getHours())}:${t(n.getMinutes())}`,a=t=>{const[n,u,a]=t.split('-').map(Number);return new Date(n,u-1,a)},o=t=>{const[n,u]=t.split(':').map(Number);return 60*n+u},c=n=>`${t(Math.floor(n/60))}:${t(n%60)}`,d=(t,n)=>{const u=new Date(t);return u.setHours(0,0,0,0),u.setMinutes(o(n)),u},m=(t,n)=>new Date(t.getTime()+6e4*n),b=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],y=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],f=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],l=['January','February','March','April','May','June','July','August','September','October','November','December'],p=t=>b[t.getDay()],s=t=>y[t.getDay()],O=t=>l[t],M=t=>`${b[t.getDay()]} ${t.getDate()} ${f[t.getMonth()]}`,j=t=>`${M(t)} ${t.getFullYear()}`,P=(t,n)=>Math.round((n.getTime()-t.getTime())/6e4)},818,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"repo",{enumerable:!0,get:function(){return o}});var t=r(d[0]),n=r(d[1]);Object.keys(n).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})});const o=t.localRepositories},819,[1238,1020]); +__d(function(_g,_r2,_i2,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"inviteRefusal",{enumerable:!0,get:function(){return p.inviteRefusal}}),Object.defineProperty(_e,"keysToWipe",{enumerable:!0,get:function(){return p.keysToWipe}}),Object.defineProperty(_e,"changedFields",{enumerable:!0,get:function(){return m.changedFields}}),Object.defineProperty(_e,"useSync",{enumerable:!0,get:function(){return re}}),Object.defineProperty(_e,"can",{enumerable:!0,get:function(){return de}}),Object.defineProperty(_e,"isLive",{enumerable:!0,get:function(){return ue}}),_e.setTempManagerAccess=async function(e,t,a){const s=re.getState().venueId;if(!s||'staff'!==re.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{error:i}=await ne().rpc('set_staff_manager_access',{p_venue:s,p_staff_ref:e,p_on:t,p_reason:a.trim()||null});return i?{ok:!1,message:/owner/i.test(i.message)?'Only an owner can change this.':'Could not save. Try again.'}:(P.useOwner.setState(a=>({staff:a.staff.map(a=>a.id===e?{...a,...t?{role:'manager',managerAccess:!0}:{role:'staff',managerAccess:void 0}}:a)})),{ok:!0})}catch{return{ok:!1,message:'Could not save. Try again when the app is online.'}}},_e.setTempOwnerAccess=async function(e,t,a){const s=re.getState().venueId;if(!s||'staff'!==re.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{error:i}=await ne().rpc('set_staff_owner_access',{p_venue:s,p_staff_ref:e,p_on:t,p_reason:a.trim()||null});if(i)return{ok:!1,message:/owner/i.test(i.message)?'Only an owner can change this.':'Could not save. Try again.'};const n=e=>'Manager'===e.level||'Supervisor'===e.level?'manager':'staff';return P.useOwner.setState(a=>({staff:a.staff.map(a=>a.id===e?{...a,...t?{role:'owner',ownerAccess:!0}:{role:a.managerAccess?'manager':n(a),ownerAccess:void 0}}:a)})),{ok:!0}}catch{return{ok:!1,message:'Could not save. Try again when the app is online.'}}},_e.setManagerAccess=async function(e,t){const a=re.getState().venueId;if(!a||'staff'!==re.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:s,error:i}=await ne().rpc('set_manager_access',{p_venue:a,p_staff_ref:e,p_on:t});if(i)return{ok:!1,message:i.message.replace(/^.*?:\s*/,'')||'Not allowed'};const n=String(s??'');return P.useOwner.setState(t=>({staff:t.staff.map(t=>t.id===e?{...t,...Ge(n)}:t)})),{ok:!0,role:n}}catch(e){return{ok:!1,message:String(e?.message??e)}}},_e.unlockCashUp=async function(e,t,a){if(H.PITCH)return Q.unlockCashUp(e,t,a);const s=re.getState().venueId;if(!s||'staff'!==re.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:i,error:n}=await ne().rpc('unlock_cash_up',{p_venue:s,p_kind:e,p_id:t,p_reason:a});if(n)return{ok:!1,message:n.message};const r=String(i);return'cashup'===e?B.useCashUp.setState(e=>({cashUps:e.cashUps.map(e=>e.id===t?{...e,unlockedUntil:r}:e)})):B.useCashUp.setState(e=>({sales:e.sales.map(e=>e.id===t?{...e,unlockedUntil:r}:e)})),{ok:!0,until:r}}catch(e){return{ok:!1,message:String(e?.message??e)}}},_e.readCashAudit=async function(e){if(H.PITCH)return Q.cashAudit(e);const t=re.getState().venueId;if(!t)return[];let a=ne().from('cash_up_audit').select('at, action, changed_by_name, tbl, for_date, reason, old_row, new_row').eq('venue_id',t).order('at',{ascending:!1}).limit(50);e&&(a=a.eq('row_id',e));const{data:s,error:i}=await a;return i||!Array.isArray(s)?[]:s.map(e=>({at:String(e.at),action:String(e.action),by:String(e.changed_by_name??'\u2014'),tbl:String(e.tbl),forDate:e.for_date??void 0,reason:e.reason??void 0,changed:(0,m.changedFields)(e.old_row,e.new_row)}))},_e.setPushLive=async function(e){const t=re.getState().venueId;if(!t)return{ok:!1,message:'Connect to the venue first.'};const{data:a,error:s}=await ne().rpc('set_push_live',{p_venue:t,p_on:e});return s?{ok:!1,message:s.message}:(qt.setState({live:!!a,known:!0}),{ok:!0})},_e.readPushLive=Kt,_e.readAccessLog=async function(){const e=re.getState().venueId;if(!e)return[];try{const{data:t}=await ne().from('staff_access_log').select('*').eq('venue_id',e).order('changed_at',{ascending:!1}).limit(30);return t??[]}catch{return[]}},Object.defineProperty(_e,"ORDER_LOGO_BUCKET",{enumerable:!0,get:function(){return xt}}),_e.uploadOrderLogo=async function(e,t){const a=re.getState().venueId;if(!a||'staff'!==re.getState().kind)return{ok:!1,message:'offline'};try{const s=await(await fetch(t)).blob(),i=`${a}/${e}-${Date.now()}.jpg`,{error:n}=await ne().storage.from(xt).upload(i,s,{upsert:!0,contentType:'image/jpeg'});return n?{ok:!1,message:n.message}:{ok:!0,path:i}}catch(e){return{ok:!1,message:String(e?.message??e)}}},_e.orderLogoUrl=async function(e){const t=Lt.get(e);if(t&&t.until>Date.now())return t.url;try{const{data:t}=await ne().storage.from(xt).createSignedUrl(e,3600);if(t?.signedUrl)return Lt.set(e,{url:t.signedUrl,until:Date.now()+3e6}),t.signedUrl}catch{}return null},_e.removeOrderLogo=async function(e){try{await ne().storage.from(xt).remove([e])}catch{}},Object.defineProperty(_e,"usePushLive",{enumerable:!0,get:function(){return qt}}),_e.claimInvite=Zt,_e.signedInHereAs=async function(e){fe();const t=await k.kv.get(Ht,null);return!!t&&'staff'===t.kind&&t.staffRef===e},_e.rememberedInviteHere=async function(e){return fe(),await k.kv.get(Gt,null)===e},_e.kirkmichaelStaffAppUrl=async function(){const t=re.getState();if(!e.IS_KIRKMICHAEL||'staff'!==t.kind||t.venueId!==e.VENUE_UUID||t.staffRef!==g.useSession.getState().meId)return null;fe();const a=await k.kv.get(Gt,null);return a?(0,g.appUrl)('staff',a):null},_e.wildingsStaffAppUrl=async function(){const t=re.getState();if(!e.IS_WILDINGS||'staff'!==t.kind||t.venueId!==e.VENUE_UUID||t.staffRef!==g.useSession.getState().meId)return null;fe();const a=await k.kv.get(Gt,null);return a?(0,g.appUrl)('staff',a):null},_e.forgetSignInHere=async function(){fe(),await k.kv.remove(Ht),await k.kv.remove(Gt),oe({mode:'signin',perms:[]});try{await ta()}catch{}},_e.approveShiftSwap=async function(e,t,a){const s=re.getState().venueId;if(H.PITCH||!s||'staff'!==re.getState().kind)return{ok:!0};if(!(0,$.isUuid)(e))return{ok:!1,message:'This shift isn\u2019t on the shared rota yet.'};try{return await Yt('approve_shift_swap',{p_venue:s,p_shift:e,p_to_ref:t,p_kind:a}),{ok:!0}}catch(e){return{ok:!1,message:String(e?.message??e).replace(/^.*?:\s*/,'')||'Not allowed'}}},_e.claimInviteForSync=async function(e){const t=await Zt(e);return'ok'===t.status?t.id:null},_e.reissueInvite=async function(e){if(H.PITCH)return Q.reissueInvite(e);const t=re.getState().venueId;if(!t||'staff'!==re.getState().kind)return{ok:!1,message:'Connect to the venue first (sign in from your link).'};try{const{data:a,error:s}=await ne().rpc('reissue_invite',{p_venue:t,p_staff_ref:e});if(s)return{ok:!1,message:s.message.replace(/^.*?:\s*/,'')||'Not allowed'};const i=a,n=String(i.app??'staff');return{ok:!0,token:String(i.token),expiresAt:String(i.expiresAt),app:'owner'===n||'chef'===n?n:'staff'}}catch(e){return{ok:!1,message:String(e?.message??e)}}},_e.ensureStaffAppLinks=async function(e){const t=re.getState().venueId;if(!t||'staff'!==re.getState().kind)throw new Error('Connect to the venue first.');return Yt('ensure_staff_app_links',{p_venue:t,p_staff_ref:e})},_e.staffAppLinkHistory=async function(e){return Yt('staff_app_link_history',{p_venue:re.getState().venueId,p_staff_ref:e})},_e.revokeStaffAppLink=async function(e){await Yt('revoke_staff_app_link',{p_venue:re.getState().venueId,p_link_id:e})},_e.readInviteStatus=async function(){if(H.PITCH)return Q.inviteStatus();const e=re.getState().venueId;if(!e)return{};const{data:t,error:a}=await ne().rpc('invite_status',{p_venue:e});if(a||!Array.isArray(t))return{};const s={};for(const e of t)s[String(e.staff_ref)]={state:e.state,expiresAt:e.expires_at??void 0,usedAt:e.used_at??void 0,devices:Number(e.devices??0)};return s},_e.pairWithCode=async function(t){if(!(0,v.isSupabaseConfigured)())return{ok:!1,error:'This build has no shared backend.'};try{await zt();const{data:a,error:s}=await ne().rpc(e.IS_QUEUED_VENUE?'claim_'+e.VENUE_RID+'_pairing_code':e.IS_GREENSIDE?'claim_greenside_pairing_code':e.IS_ABBOTSFORD?'claim_abbotsford_pairing_code':e.IS_KIRKTON?'claim_kirkton_pairing_code':e.IS_WILDINGS?'claim_wildings_pairing_code':e.IS_KIRKMICHAEL?'claim_kirkmichael_pairing_code':e.IS_ISOLATED_VENUE?'claim_souters_pairing_code':'claim_pairing_code',{p_code:t});if(s)throw s;const i=a?.[0];if(!i)return{ok:!1,error:'That code was not accepted. It may have expired. Ask a manager for a new one.'};const n={kind:'device',venueId:i.venue_id,venueSlug:i.venue_slug,venueName:i.venue_name,canWrite:i.can_write,label:i.label};return await k.kv.set(Vt,n),aa(),{ok:!0,venueName:i.venue_name}}catch(e){const t=String(e?.message??e);return/fetch|network/i.test(t)?{ok:!1,error:'No connection. Check the tablet\u2019s Wi-Fi and try again.'}:/rate|too many/i.test(t)?{ok:!1,error:'Too many tries from this network. Wait a little and try again.'}:{ok:!1,error:/valid|switched off/i.test(t)?t:`Couldn\u2019t pair: ${t}`}}},_e.unpairDisplay=async function(){await k.kv.remove(Vt),await ta();try{await ne().auth.signOut()}catch{}oe({mode:'unpaired',venueId:void 0,venueName:void 0,perms:[]})},_e.disconnectStaff=async function(){await k.kv.remove(Ht),await k.kv.remove(Gt),await ta();try{await ne().auth.signOut()}catch{}oe({mode:'signin',venueId:void 0,venueName:void 0,perms:[],kind:void 0,role:void 0,staffRef:void 0,message:'Disconnected. Open your personal invite link to connect again.'})},_e.wipeThisDevice=async function(t={}){try{await ta()}catch{}try{(0,v.isSupabaseConfigured)()&&await ne().auth.signOut({scope:'local'})}catch{}let a=0;try{const e='undefined'!=typeof navigator?navigator:null,t=await(e?.serviceWorker?.getRegistration?.()),a=await(t?.pushManager?.getSubscription?.());a&&await a.unsubscribe()}catch{}for(const t of['undefined'!=typeof localStorage?localStorage:null,'undefined'!=typeof sessionStorage?sessionStorage:null])if(t)try{const s=[];for(let e=0;et.startsWith(`cc-venue:${e.VENUE_RID}:`)):(0,p.keysToWipe)(s).filter(e=>!e.startsWith('cc-venue:')))t.removeItem(i),a++}catch{}try{const t='undefined'!=typeof caches?caches:null;if(t)for(const a of await t.keys())!e.IS_ISOLATED_VENUE&&/data|api|photo/i.test(a)&&await t.delete(a)}catch{}oe({mode:'signin',venueId:void 0,venueName:void 0,perms:[],kind:void 0,role:void 0,staffRef:void 0,message:'This device has been wiped.'}),!1!==t.reload&&'undefined'!=typeof window&&window.location&&window.location.replace(window.location.pathname);return a},_e.guestSession=Xt,Object.defineProperty(_e,"rpc",{enumerable:!0,get:function(){return Yt}}),_e.startAppSync=async function(t=e.VENUE_RID){if(e.IS_ISOLATED_VENUE&&t!==e.VENUE_RID)return;if(ge)return;ge=!0,sa=t,'customer'===le&&'live'!==U.useStore.getState().clock.mode&&U.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}});if(fe(),'customer'!==le){const e=e=>new Promise(t=>{try{if(!e?.persist||e.persist.hasHydrated())return t();const a=e.persist.onFinishHydration(()=>{a?.(),t()});setTimeout(t,3e3)}catch{t()}}),a='chef'===le&&(0,d.isAnchorage)(t)?[U.useStore,P.useOwner,L.useKitchen,q.useSafety,N.useCardStore,r.useGpCalc,M.useOrderSheets,o.useSpecials,_.useHr]:[U.useStore,P.useOwner,L.useKitchen];if(await Promise.all(a.map(e)),'chef'===le&&(0,d.isAnchorage)(t)&&a.some(e=>!e.persist.hasHydrated()))return void oe({mode:'offline',message:'Saved kitchen data could not be backed up. Nothing was cleared. Free some device storage, then reopen.',lastError:'Legacy kitchen archive not ready'});try{await wa(t)}catch{if(s.LIVE_VENUE_BUILD&&(0,s.isLiveVenue)(t))return void oe({mode:'offline',message:'Device backup failed. Nothing was cleared. Free some storage, then reopen.',lastError:'Legacy kitchen archive failed'})}'live'!==U.useStore.getState().clock.mode&&U.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}})}if(!(0,v.isSupabaseConfigured)())return void oe({mode:'off'});R.mutationQueue.subscribe(()=>{const e=R.mutationQueue.waiting,t=e[0];oe({pending:R.mutationQueue.pending.length,failed:R.mutationQueue.failed.length,waiting:e.length,waitingWhat:t?`${(0,O.describeWrite)(t)}: ${(0,O.plainReason)({...t.lastErr},'retry')}`:void 0})}),R.mutationQueue.onFailed(e=>oe({lastError:`${e.table}: ${e.lastError??'rejected'}`,failed:R.mutationQueue.failed.length,refused:{what:(0,O.describeWrite)(e),why:'conflict'===e.reason?(0,O.plainReason)({code:'conflict'},'refused'):(0,O.plainReason)({...e.lastErr,message:e.lastErr?.message??e.lastError},'refused'),at:e.failedAt}})),me.push((0,b.onConnectivity)(e=>oe({mode:e?re.getState().venueId?'live':re.getState().mode:re.getState().venueId?'offline':re.getState().mode}))),await ia()},Object.defineProperty(_e,"syncInternals",{enumerable:!0,get:function(){return fa}}),_e.goLive=ma,Object.defineProperty(_e,"usePublicDayStore",{enumerable:!0,get:function(){return Ca}}),_e.publicDay=function(e,a){const s=`${e}|${a}`,i=Ea.get(s);if('customer'!==le||!(0,v.isSupabaseConfigured)())return null;(!i||Date.now()-i.at>6e4)&&(i?i.at=Date.now():Ea.set(s,{at:Date.now(),v:{bookings:[],blocks:[]}}),Yt('public_day',{p_venue_slug:(0,t.queuedDatabaseSlug)(e),p_date:a}).then(t=>{const i=[],n=[];(t??[]).forEach((t,s)=>{'booking'===t.kind?i.push({id:`pub-${a}-${s}`,ref:'',restaurantId:e,customerId:null,name:'',date:a,time:ye(t.booking_time),partySize:Number(t.covers)||0,table:(t.table_ids??[]).join('+')||void 0,durationMins:t.duration_mins??void 0,status:'confirmed',allergies:[],createdAt:''}):n.push({id:`pubblk-${a}-${s}`,rid:e,date:a,from:ye(t.from_time),to:ye(t.to_time),areaId:t.area_id??void 0,tables:Array.isArray(t.table_ids)&&t.table_ids.length?t.table_ids.map(String):void 0,by:'',createdAt:''})}),Ea.set(s,{at:Date.now(),v:{bookings:i,blocks:n},ok:!0}),Ca.setState(e=>({n:e.n+1}))}).catch(()=>{const e=Ea.get(s);e&&!e.ok&&Ea.delete(s)}));const n=Ea.get(s);return n?.ok?n.v:null};var e=_r2(_d[0]),t=_r2(_d[1]),a=_r2(_d[2]),s=_r2(_d[3]),i=_r2(_d[4]),n=_r2(_d[5]),r=_r2(_d[6]),o=_r2(_d[7]),d=_r2(_d[8]),u=_r2(_d[9]),l=_r2(_d[10]),c=_r2(_d[11]),f=_r2(_d[12]),p=_r2(_d[13]),m=_r2(_d[14]),g=_r2(_d[15]),_=_r2(_d[16]),S=_r2(_d[17]),h=_r2(_d[18]),y=_r2(_d[19]),w=_r2(_d[20]),v=_r2(_d[21]),b=_r2(_d[22]),k=_r2(_d[23]),I=_r2(_d[24]),O=_r2(_d[25]),R=_r2(_d[26]),A=_r2(_d[27]),U=_r2(_d[28]),D=_r2(_d[29]),E=_r2(_d[30]),C=_r2(_d[31]),T=_r2(_d[32]),N=_r2(_d[33]),M=_r2(_d[34]),K=_r2(_d[35]),x=_r2(_d[36]),L=_r2(_d[37]),q=_r2(_d[38]),P=_r2(_d[39]),$=_r2(_d[40]),j=_r2(_d[41]),B=_r2(_d[42]),F=_r2(_d[43]),W=_r2(_d[44]),V=_r2(_d[45]),H=_r2(_d[46]),G=_r2(_d[47]),Q=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(a){if('default'!==a){var s=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(t,a,s.get?s:{enumerable:!0,get:function(){return e[a]}})}}),t.default=e,t})(G),J=_r2(_d[48]),z=_r2(_d[49]),Z=_r2(_d[50]),X=_r2(_d[51]),Y=_r2(_d[52]),ee=_r2(_d[53]),te=_r2(_d[54]),ae=_r2(_d[55]),se=_r2(_d[56]),ie=_r2(_d[57]);const ne=()=>(0,w.getSupabase)();R.mutationQueue.setExecutor(I.executeMutation);const re=(0,y.create)(()=>({mode:'off',perms:[],pending:0,failed:0})),oe=e=>re.setState(e),de=e=>{const t=re.getState().perms;return t.includes('*')||t.includes(e)},ue=()=>{const e=re.getState().mode;return'live'===e||'offline'===e||'connecting'===e};re.subscribe(()=>(0,ae.setLiveData)(ue()));let le=D.APP_VARIANT,ce=!1;const fe=()=>{ce||((0,k.setSyncNamespace)(le),ce=!0)};let pe=[],me=[],ge=!1;const Se=()=>(new Date).toISOString().slice(0,10),he=e=>new Date(Date.now()-864e5*e).toISOString().slice(0,10),ye=e=>e?e.slice(0,5):'',we=e=>Array.isArray(e)?e.filter(e=>e&&'object'==typeof e&&'string'==typeof e.allergen&&['gluten','crustaceans','molluscs','eggs','fish','peanuts','treenuts','soya','milk','celery','mustard','sesame','sulphites','lupin'].includes(e.allergen)&&(!e.severity||['intolerance','allergy','coeliac','anaphylaxis'].includes(e.severity))):[],ve=e=>JSON.parse(JSON.stringify(e));function be(e,t){const a=he(120);return{name:t?'walk_ins':'bookings',table:t?'walk_ins':'bookings',list:()=>U.useStore.getState().bookings.filter(a=>a.restaurantId===e&&!!a.walkIn===t),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id),writable:()=>'guest'!==re.getState().kind,filter:e=>e.gte(t?'walk_date':'booking_date',a),inWindow:e=>e.date>=a,toRow:(e,a)=>{const s=ve(e);return t?{id:e.id,venue_id:a,walk_date:e.date,arrived_at:e.seatedAt??e.createdAt,covers:Math.max(1,Math.min(200,e.partySize)),table_ids:e.table?e.table.split('+').map(e=>e.trim()).filter(Boolean):[],dog:!!e.dog,allergies:we(e.allergies),note:e.notes??'',status:'finished'===e.status?'left':'cancelled'===e.status||'noshow'===e.status?'undone':'seated',created_at:e.createdAt,doc:s}:{id:e.id,venue_id:a,ref:e.ref,customer_id:(0,$.isUuid)(e.customerId)?e.customerId:null,guest_name:e.name||'Guest',phone:e.phone??null,email:e.email??null,booking_date:e.date,booking_time:e.time,duration_mins:e.durationMins&&e.durationMins>=15&&e.durationMins<=720?e.durationMins:null,covers:Math.max(1,Math.min(200,e.partySize)),table_ids:e.table?e.table.split('+').map(e=>e.trim()).filter(Boolean):[],dog:!!e.dog,allergies:we(e.allergies),allergy_ack_by:e.allergyAck?.by??null,allergy_ack_at:e.allergyAck?.at??null,notes:e.notes??'',tags:e.tags??[],occasion:e.occasion??null,status:e.status,source:e.source??'in-person',security:e.security??'none',deposit_paid:e.depositPaid??0,seated_at:e.seatedAt??null,finished_at:e.finishedAt??null,created_at:e.createdAt,doc:s}},fromRow:a=>{if(!a.doc||'object'!=typeof a.doc)return null;const s={...a.doc,id:String(a.id),restaurantId:e};return!t&&a.status&&'declined'!==a.status&&(s.status=a.status),t&&(s.walkIn=!0),'saved-card'===s.security&&(s.security='none'),s},apply:(e,t)=>U.useStore.setState(a=>{const s=new Set(t),i=new Map(e.map(e=>[e.id,e])),n=a.bookings.filter(e=>!s.has(e.id)).map(e=>i.get(e.id)??e),r=new Set(n.map(e=>e.id));return{bookings:[...n,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>U.useStore.subscribe((t,a)=>{t.bookings!==a.bookings&&e()}),protect:!0}}function ke(e){const t=new Date(Date.now()-18144e5).toISOString();return{name:'orders',table:'takeaway_orders',list:()=>U.useStore.getState().orders.filter(t=>t.restaurantId===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id),writable:()=>'guest'!==re.getState().kind,filter:e=>e.gte('created_at',t),inWindow:e=>e.createdAt>=t,toRow:(e,t)=>({id:e.id,venue_id:t,ref:e.ref,customer_id:(0,$.isUuid)(e.customerId)?e.customerId:null,customer_name:e.customerName||'Guest',phone:e.phone??null,email:e.email??null,items:ve(e.lines??[]),allergies:we(e.allergies),notes:e.notes??null,slot_time:e.slotTime??null,ready_by:e.readyBy??null,subtotal:Math.round(e.subtotal??0),tip:Math.round(e.tip??0),total:Math.round(e.total??0),paid:Math.round(e.paid??0),status:e.status,channel:e.channel??null,confirmed_by:e.accepted?e.accepted.by:null,confirmed_at:e.accepted?e.accepted.at:null,created_at:e.createdAt,allergy_chain:ve(e.allergyChain??{}),readiness:ve(e.readiness??{}),allergy_ticks:ve(e.allergyTicks??{}),handover_check:e.handoverCheck?ve(e.handoverCheck):null,accepted:e.accepted?ve(e.accepted):null,doc:ve(e)}),fromRow:t=>t.doc&&'object'==typeof t.doc?{...t.doc,id:String(t.id),restaurantId:e,status:t.status??t.doc.status}:null,apply:(e,t)=>U.useStore.setState(a=>{const s=new Set(t),i=new Map(e.map(e=>[e.id,e])),n=a.orders.filter(e=>!s.has(e.id)).map(e=>i.get(e.id)??e),r=new Set(n.map(e=>e.id));return{orders:[...e.filter(e=>!r.has(e.id)),...n]}}),subscribe:e=>U.useStore.subscribe((t,a)=>{t.orders!==a.orders&&e()})}}function Ie(e){const t=he(60);return{protect:!0,name:'blocks',table:'blocks',list:()=>[...E.useBlocks.getState().blocks,...E.useBlocks.getState().removed].filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id)&&e.to>e.from,writable:()=>'guest'!==re.getState().kind,filter:e=>e.gte('block_date',t),inWindow:e=>e.date>=t,toRow:(e,t)=>({id:e.id,venue_id:t,block_date:e.date,from_time:e.from,to_time:e.to,reason:e.reason??null,note:e.note??null,area_id:e.areaId??null,area_name:e.areaName??null,created_by:e.by,created_at:e.createdAt,doc:ve(e)}),fromRow:t=>t.doc?{...t.doc,id:String(t.id),rid:e}:{id:String(t.id),rid:e,date:t.block_date,from:ye(t.from_time),to:ye(t.to_time),reason:t.reason??void 0,note:t.note??void 0,by:t.created_by??'',createdAt:t.created_at,areaId:t.area_id??void 0,areaName:t.area_name??void 0},apply:(e,t)=>E.useBlocks.setState(a=>{const s=new Set(t),i=new Map(e.map(e=>[e.id,e])),n=[...a.blocks,...a.removed].filter(e=>!s.has(e.id)).map(e=>i.get(e.id)??e),r=new Set(n.map(e=>e.id)),o=[...n,...e.filter(e=>!r.has(e.id))];return{blocks:o.filter(e=>!e.removedAt),removed:o.filter(e=>!!e.removedAt)}}),subscribe:e=>E.useBlocks.subscribe((t,a)=>{t.blocks===a.blocks&&t.removed===a.removed||e()})}}let Oe=null;function Re(e){const t=e=>ve({areas:e.areas??[],tables:e.tables??[],joins:e.joins??[],sections:e.sections??[],fixtures:e.fixtures??[]});return{name:'table_plan',table:'table_plans',list:()=>[t(C.useFloor.getState().plans[e]??(0,C.planOf)(e))],key:()=>'plan',rowKey:()=>'plan',syncable:()=>!0,writable:()=>de('floor.manage'),filter:e=>e.eq('is_active',!0),deletes:!1,toRow:(e,a)=>({id:Oe??(0,se.uuidFrom)(`plan:${a}`),venue_id:a,name:'Main',is_active:!0,...t(e),updated_by:re.getState().staffRef??le}),fromRow:e=>(Oe=String(e.id),t({areas:e.areas,tables:e.tables,joins:e.joins,sections:e.sections,fixtures:e.fixtures})),apply:t=>{const a=t[0]?(0,ie.withSeedBest)(e,t[0]):void 0;a&&C.useFloor.setState(t=>({plans:{...t.plans,[e]:a}}))},subscribe:e=>C.useFloor.subscribe((t,a)=>{t.plans!==a.plans&&e()})}}function Ae(e){return{protect:!0,name:'stock_items',table:'stock_items',conflict:'venue_id,key',list:()=>T.useShellStore.getState().items[e]??[],key:e=>e.key,rowKey:e=>String(e.key),syncable:()=>!0,writable:()=>de('stock.manage'),matchKey:e=>({key:e}),toRow:(e,t)=>({venue_id:t,key:e.key,name:e.name,plural:e.plural,unit:e.unit,low_at:e.lowAt,supplier_id:e.supplierId?(0,$.isUuid)(e.supplierId)?e.supplierId:(0,se.uuidFrom)(`sup:${t}:${e.supplierId}`):null,icon:e.icon,sort:e.sort,active:e.active}),fromRow:e=>{return{key:e.key,name:e.name,plural:e.plural,unit:e.unit,lowAt:Number(e.low_at),icon:e.icon??'\u2022',sort:e.sort??0,active:!1!==e.active,...e.supplier_id?{supplierId:(t=String(e.supplier_id),Le.get(t)??t)}:{}};var t},apply:(t,a)=>T.useShellStore.setState(s=>{const i=new Set(a),n=new Map(t.map(e=>[e.key,e])),r=(s.items[e]??[]).filter(e=>!i.has(e.key)).map(e=>n.get(e.key)??e),o=new Set(r.map(e=>e.key));return{items:{...s.items,[e]:[...r,...t.filter(e=>!o.has(e.key))]}}}),subscribe:e=>T.useShellStore.subscribe((t,a)=>{t.items!==a.items&&e()})}}const Ue=new Set;function De(e){const t=new Date(Date.now()-2592e5).toISOString();return{name:'stock_events',table:'stock_events',mode:'insert',list:()=>T.useShellStore.getState().events.filter(t=>t.rid===e&&(0,$.isUuid)(t.id)),key:e=>e.id,rowKey:e=>String(e.id),syncable:t=>(0,$.isUuid)(t.id)&&!!(T.useShellStore.getState().items[e]??[]).find(e=>e.key===t.kind),writable:()=>'guest'!==re.getState().kind&&('device'!==re.getState().kind||de('device.write')),filter:e=>e.gte('at',t).order('at',{ascending:!1}),inWindow:e=>e.at>=t,toRow:(e,t)=>({id:e.id,venue_id:t,item:e.kind,delta:e.delta,reason:e.reason,undoes:e.undoes&&(0,$.isUuid)(e.undoes)?e.undoes:null,by_name:e.by||'Team',app:e.app,at:e.at}),fromRow:t=>(Ue.add(String(t.id)),{id:String(t.id),rid:e,kind:t.item,delta:Number(t.delta),reason:t.reason,by:t.by_name??'',app:t.app??'',at:new Date(t.at).toISOString(),...t.undoes?{undoes:String(t.undoes)}:{}}),apply:(e,t)=>T.useShellStore.setState(a=>{const s=new Set(t),i=new Map(e.map(e=>[e.id,e])),n=a.events.filter(e=>!s.has(e.id)).map(e=>i.get(e.id)??e),r=new Set(n.map(e=>e.id));return{events:[...e.filter(e=>!r.has(e.id)),...n].sort((e,t)=>t.at.localeCompare(e.at)).slice(0,500)}}),subscribe:e=>T.useShellStore.subscribe((t,a)=>{t.events!==a.events&&e()})}}function Ee(e){let t={};return{name:'stock_counts',table:'stock_counts',list:()=>Object.entries(T.useShellStore.getState().server[e]?.counts??{}).map(([e,t])=>({item:e,quantity:t})),key:e=>e.item,rowKey:e=>String(e.item),syncable:()=>!1,writable:()=>!1,toRow:()=>({}),fromRow:e=>({item:String(e.item),quantity:Number(e.quantity)}),apply:(a,s)=>{t={...T.useShellStore.getState().server[e]?.counts??{}};for(const e of s)delete t[e];for(const e of a)t[e.item]=e.quantity;T.useShellStore.setState(a=>({server:{...a.server,[e]:{counts:t,seen:[...Ue]}}}))},afterRead:()=>{T.useShellStore.getState().server[e]||T.useShellStore.setState(t=>({server:{...t.server,[e]:{counts:{},seen:[...Ue]}}}))},subscribe:()=>()=>{}}}const Ce=new Set;function Te(e){return{name:'recipe_cards',table:'recipe_cards',list:()=>{const t=U.useStore.getState().menu;return N.useCardStore.getState().cards.filter(t=>t.restaurantId===e).map(e=>({card:e,item:t.find(t=>t.id===e.menuItemId)}))},key:e=>e.card.id,rowKey:e=>String(e.id),syncable:t=>(0,$.isUuid)(t.card.id)&&!((0,d.isAnchorage)(e)&&(0,d.isDemoCard)(t.card)),writable:()=>de('recipes.edit'),toRow:(t,a)=>{let s=t.card;(0,d.isAnchorage)(e)&&(s={...s,signOff:(0,d.demoActor)(s.signOff?.by)?null:s.signOff,allergensConfirmed:(0,d.demoActor)(s.allergensConfirmed?.by)?void 0:s.allergensConfirmed});const i=t.item&&(0,d.isAnchorage)(e)&&(0,d.demoActor)(t.item.signOff?.by)?{...t.item,signOff:null}:t.item;if(s.photo?.startsWith('local:')){const e=(0,se.photoPath)(a,s),t=Ne(s.photo);t&&((0,N.cachePhotoAs)(e,t),Me(e,t)),s={...s,photo:e}}const{row:n,extra:r}=(0,se.cardToRow)(s,a);return{...n,...r,doc:ve({card:s,item:i})}},fromRow:t=>{const a=t.doc;if(!a?.card)return null;const s=t.signed_off_by&&t.signed_off_at?{by:t.signed_off_by,at:new Date(t.signed_off_at).toISOString()}:null;return{card:{...a.card,id:String(t.id),restaurantId:e,signOff:s&&a.card.signOff?a.card.signOff:s,...t.photo_url?{photo:t.photo_url}:{}},item:a.item?{...a.item,restaurantId:e,signOff:(0,d.isAnchorage)(e)&&(0,d.demoActor)(a.item.signOff?.by)?null:a.item.signOff}:void 0}},supersededBy:(e,t)=>t.some(t=>t.card.menuItemId===e.card.menuItemId&&t.card.id!==e.card.id),apply:(e,t)=>{if(!de('recipes.edit')&&t.length){const e=new Set(t);N.useCardStore.setState(t=>({cards:t.cards.map(t=>e.has(t.id)&&t.signOff?{...t,signOff:null}:t)})),t=[]}const a=new Set(t);N.useCardStore.setState(t=>{const s=new Map(e.map(e=>[e.card.id,e.card])),i=new Set(e.map(e=>e.card.menuItemId)),n=t.cards.filter(e=>a.has(e.id)).map(e=>e.menuItemId),r=t.cards.filter(e=>!a.has(e.id)&&(s.has(e.id)||!i.has(e.menuItemId))).map(e=>s.get(e.id)??e),o=new Set(r.map(e=>e.id));return n.length&&U.useStore.setState(e=>({menu:e.menu.map(e=>n.includes(e.id)?{...e,hidden:!0}:e)})),{cards:[...r,...e.filter(e=>!o.has(e.card.id)).map(e=>e.card)],removed:[...t.removed,...n]}});const s=e.map(e=>e.item).filter(Boolean);s.length&&U.useStore.setState(e=>{const t=new Map(s.map(e=>[e.id,e])),a=e.menu.map(e=>t.get(e.id)??e),i=new Set(a.map(e=>e.id));return{menu:[...a,...s.filter(e=>!i.has(e.id))]}})},subscribe:e=>{const t=N.useCardStore.subscribe((t,a)=>{t.cards!==a.cards&&e()}),a=U.useStore.subscribe((t,a)=>{t.menu!==a.menu&&e()});return()=>{t(),a()}}}}const Ne=e=>(0,N.readLocalPhoto)(e);async function Me(e,t){if(!Ce.has(e)){Ce.add(e);try{const a=await(await fetch(t)).blob(),{error:s}=await ne().storage.from(se.RECIPE_PHOTO_BUCKET).upload(e,a,{upsert:!0,contentType:a.type||'image/jpeg'});if(s)throw s}catch(t){Ce.delete(e),oe({lastError:`Photo upload: ${String(t?.message??t)}`})}}}const Ke=new Map,xe=(0,y.create)(()=>({n:0}));(0,N.setStoragePhotoResolver)(e=>{const t=Ke.get(e);return t&&Date.now()-t.at<3e6?t.url:(0,v.isSupabaseConfigured)()&&'off'!==re.getState().mode?(t||(Ke.set(e,{url:'',at:Date.now()}),ne().storage.from(se.RECIPE_PHOTO_BUCKET).createSignedUrl(e,3600).then(({data:t})=>{t?.signedUrl&&(Ke.set(e,{url:t.signedUrl,at:Date.now()}),xe.setState(e=>({n:e.n+1})),N.useCardStore.setState(e=>({cards:[...e.cards]})))}).catch(()=>{})),t?.url||null):null});const Le=new Map;const qe=(e,t)=>{const a=(0,$.isUuid)(t)?t:(0,se.uuidFrom)(`sup:${e}:${t}`);return Le.set(a,t),a};function Pe(e){return{name:'order_sheets',table:'suppliers',list:()=>M.useOrderSheets.getState().sheets[e]??[],key:e=>e.id,rowKey:e=>String(e.doc?.localId??e.id),syncable:t=>!((0,d.isAnchorage)(e)&&'os-veg'===t.id&&t.placeholder),writable:()=>de('suppliers.manage'),toRow:(e,t)=>({id:qe(t,e.id),venue_id:t,name:e.name||'Supplier',category:e.goods||null,contact:e.contact??null,phones:e.number?[e.number]:[],website:e.url||null,cutoff:e.cutoff||null,order_days:e.orderDays,delivery_days:e.deliveryDays,notes:e.notes||null,doc:{kind:'sheet',localId:e.id,sheet:ve(e)}}),fromRow:e=>'sheet'!==e.doc?.kind?null:(Le.set(String(e.id),String(e.doc.localId)),e.doc.sheet),apply:(t,a)=>M.useOrderSheets.setState(s=>{const i=new Set(a),n=new Map(t.map(e=>[e.id,e])),r=(s.sheets[e]??[]).filter(e=>!i.has(e.id)).map(e=>n.get(e.id)??e),o=new Set(r.map(e=>e.id));return{sheets:{...s.sheets,[e]:[...r,...t.filter(e=>!o.has(e.id))]}}}),subscribe:e=>M.useOrderSheets.subscribe((t,a)=>{t.sheets!==a.sheets&&e()}),matchKey:e=>({id:(0,$.isUuid)(e)?e:(0,se.uuidFrom)(`sup:${re.getState().venueId}:${e}`)})}}let $e=!1,je=!1;const Be=new Map,Fe=new Map,We=new Map,Ve=new Map,He=e=>'owner'===e.role?'owner':'manager'===e.role?'Supervisor'===e.level?'supervisor':'manager':'Head Chef'===e.level?'head_chef':'staff',Ge=e=>'owner'===e?{role:'owner',level:'Owner'}:'manager'===e?{role:'manager',level:'Manager'}:'supervisor'===e?{role:'manager',level:'Supervisor'}:'head_chef'===e?{role:'staff',level:'Head Chef'}:{role:'staff',level:'Staff'},Qe=(e,t)=>t&&'owner'!==e.role&&'manager'!==e.role?{role:'manager',level:e.level,managerAccess:!0}:{...e,managerAccess:void 0},Je=e=>ve({id:e.id,name:e.name,role:e.role,job:e.job,active:e.active,level:e.level??Ge(He(e)).level,dept:e.dept??'',nickname:e.nickname,displayClock:e.displayClock,temp:e.temp,tempUntil:e.tempUntil,managerAccess:e.managerAccess||void 0,ownerAccess:e.ownerAccess||void 0,...e.temp&&e.tempUntil&&e.tempUntil(new Date).toLocaleDateString('en-CA',{timeZone:'Europe/London'});const Ze=(e=new Date)=>{const t=new Date(e);return t.setDate(t.getDate()-(t.getDay()+6)%7),t.toISOString().slice(0,10)},Xe=e=>{const t=Math.round(60*e)%1440;return`${String(Math.floor(t/60)).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`};function Ye(){return{name:'rota',table:'rota_shifts',list:()=>P.useOwner.getState().shifts,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id)&&Be.has(e.staffId),writable:()=>de('rota.manage'),toRow:(e,t)=>({id:e.id,venue_id:t,staff_id:Be.get(e.staffId),staff_ref:e.staffId,shift_date:e.date??(()=>{const t=new Date(Ze());return t.setDate(t.getDate()+(e.day??0)),t.toISOString().slice(0,10)})(),start_time:Xe(e.start),end_time:Xe(e.end),published:!!e.published,doc:ve(e)}),fromRow:e=>{if(!e.doc)return null;const t=e.doc,a=t.date??String(e.shift_date).slice(0,10),[s,i,n]=a.split('-').map(Number);return{...t,id:String(e.id),date:a,day:(new Date(s,i-1,n).getDay()+6)%7,published:!!e.published}},apply:(e,t)=>P.useOwner.setState(a=>{const s=new Set(t),i=new Map(e.map(e=>[e.id,e])),n=a.shifts.filter(e=>!s.has(e.id)).map(e=>i.get(e.id)??e),r=new Set(n.map(e=>e.id));return{shifts:[...n,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>P.useOwner.subscribe((t,a)=>{t.shifts!==a.shifts&&e()})}}function et(){const t=he(62),a=e=>de('rota.manage')||e.staffId===re.getState().staffRef;return{name:'attendance',table:'attendance',list:()=>P.useOwner.getState().attendance,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id)&&a(e),writable:()=>'staff'===re.getState().kind,filter:e=>e.gte('work_date',t),inWindow:e=>e.date>=t,toRow:(t,a)=>({id:t.id,venue_id:a,staff_id:Be.get(t.staffId)??null,staff_ref:t.staffId,work_date:t.date,clock_in:t.in??null,clock_out:t.out??null,breaks:ve(t.breaks??[]),break_mins:t.breakMins??0,doc:ve((0,u.privateAttendance)(e.VENUE_RID,t))}),fromRow:t=>{if(!t.doc)return null;const a=(0,u.privateAttendance)(e.VENUE_RID,{...t.doc,id:String(t.id)});return'confirmed'===t.status?a.signOff={by:String(t.confirmed_by_name??a.signOff?.by??'Manager'),byId:a.signOff?.byId??'',at:t.confirmed_at?new Date(t.confirmed_at).toISOString():a.signOff?.at??''}:delete a.signOff,a},apply:(e,t)=>P.useOwner.setState(a=>{const s=new Set(t),i=new Map(e.map(e=>[e.id,e])),n=a.attendance.filter(e=>!s.has(e.id)).map(e=>i.get(e.id)??e),r=new Set(n.map(e=>e.id));return{attendance:[...n,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>P.useOwner.subscribe((t,a)=>{t.attendance!==a.attendance&&e()})}}function tt(){const e=he(62);return{name:'time_requests',table:'time_requests',mode:'insert',deletes:!1,list:()=>P.useOwner.getState().timeRequests,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id)&&e.staffId===re.getState().staffRef&&'open'===e.status,writable:()=>'staff'===re.getState().kind,filter:t=>t.gte('work_date',e),inWindow:t=>t.date>=e,toRow:(e,t)=>({id:e.id,venue_id:t,staff_id:Be.get(e.staffId)??null,staff_ref:e.staffId,work_date:e.date,attendance_id:e.attendanceId&&(0,$.isUuid)(e.attendanceId)?e.attendanceId:null,kind:e.kind,suggested_in:e.suggestedIn??null,suggested_out:e.suggestedOut??null,note:(e.note??'').slice(0,300)||null,status:'open',doc:ve({...e,status:'open'})}),fromRow:e=>{const t=e.doc??{};return{...t,id:String(e.id),staffId:String(e.staff_ref),date:String(e.work_date).slice(0,10),attendanceId:e.attendance_id?String(e.attendance_id):t.attendanceId,kind:e.kind,suggestedIn:e.suggested_in?new Date(e.suggested_in).toISOString():void 0,suggestedOut:e.suggested_out?new Date(e.suggested_out).toISOString():void 0,note:e.note??'',at:t.at??new Date(e.created_at).toISOString(),status:e.status,resolvedBy:e.resolved_by_name??void 0,resolvedAt:e.resolved_at?new Date(e.resolved_at).toISOString():void 0}},apply:(e,t)=>P.useOwner.setState(a=>{const s=new Set(t),i=new Map(e.map(e=>[e.id,e])),n=a.timeRequests.filter(e=>!s.has(e.id)).map(e=>i.get(e.id)??e),r=new Set(n.map(e=>e.id));return{timeRequests:[...e.filter(e=>!r.has(e.id)),...n]}}),subscribe:e=>P.useOwner.subscribe((t,a)=>{t.timeRequests!==a.timeRequests&&e()})}}function at(t){P.timesheetRemote.send=(a,s)=>{if(!de('rota.manage')||!(0,$.isUuid)(s.id))return!1;if('time_request_resolve'===a){const e=s;return R.mutationQueue.enqueue({table:'time_requests',venueId:t,kind:'rpc',fn:a,rowKey:e.id,values:{p_id:e.id,p_status:e.status,p_doc:ve(e)}}),!0}const i=s;if('attendance_confirm'===a)return R.mutationQueue.enqueue({table:'attendance',venueId:t,kind:'rpc',fn:a,rowKey:i.id,values:{p_id:i.id,p_doc:ve((0,u.privateAttendance)(e.VENUE_RID,i))}}),!0;if(!i.in)return!1;const n=i.adjusted?.reason??'';return R.mutationQueue.enqueue({table:'attendance',venueId:t,kind:'rpc',fn:'attendance_override',rowKey:i.id,values:{p_id:i.id,p_venue:t,p_staff_ref:i.staffId,p_work_date:i.date,p_clock_in:i.in,p_clock_out:i.out??null,p_break_mins:i.breakMins??0,p_breaks:ve(i.breaks??[]),p_reason:n,p_doc:ve((0,u.privateAttendance)(e.VENUE_RID,i))}}),!0},me.push(()=>{P.timesheetRemote.send=null})}function st(e){return{name:'outbox',table:'outbox',mode:'insert',list:()=>U.useStore.getState().outbox.filter(t=>t.restaurantId===e),key:e=>e.id,rowKey:e=>String(e.local_id??e.id),syncable:()=>!0,writable:()=>'staff'===re.getState().kind,filter:e=>e.gte('created_at',new Date(Date.now()-2592e6).toISOString()),inWindow:()=>!1,toRow:(e,t)=>{return{id:(a=e.id,(0,$.isUuid)(a)?a:(0,se.uuidFrom)(`outbox:${a}`)),local_id:e.id,venue_id:t,channel:e.channel,kind:e.kind,to_address:e.to||'',to_name:e.toName||null,subject:e.subject??null,body:e.body,html:e.html??null,ref_type:e.refType,ref_id:(0,$.isUuid)(e.refId)?e.refId:null,ref:e.ref,status:e.status,provider:e.provider,error:e.error??null,created_at:e.at,doc:ve(e)};var a},fromRow:t=>t.doc?{...t.doc,restaurantId:e}:null,apply:e=>U.useStore.setState(t=>{const a=new Set(t.outbox.map(e=>e.id));return{outbox:[...e.filter(e=>!a.has(e.id)),...t.outbox].sort((e,t)=>t.at.localeCompare(e.at)).slice(0,300)}}),subscribe:e=>U.useStore.subscribe((t,a)=>{t.outbox!==a.outbox&&e()})}}const it=e=>U.useStore.getState().events.filter(t=>t.restaurantId===e&&!t.example);function nt(e,t){if(!Array.isArray(t))return;const a=t.filter(e=>e&&'string'==typeof e.id&&'string'==typeof e.date&&'string'==typeof e.title).map(t=>({...t,restaurantId:e,example:!1}));U.useStore.setState(t=>({events:[...t.events.filter(t=>!(t.restaurantId===e&&!t.example)),...a]}))}function rt(e){return{name:'venue',table:'venues',venueColumn:'id',mode:'update',list:()=>{const t=U.useStore.getState(),a=t.restaurants.find(t=>t.id===e);return[ve({restaurant:a,msgTemplates:t.msgTemplates[e]??{},display:C.useFloor.getState().settings[e]??{},games:!1!==a?.settings?.games,events:it(e)})]},key:()=>'venue',rowKey:()=>'venue',syncable:()=>!0,writable:()=>de('venue.settings'),matchKey:()=>({}),toRow:e=>({name:e.restaurant?.name,settings:{...dt??{},whatsapp:e.restaurant?.settings?.whatsapp||null,app:{...dt?.app??{},restaurant:e.restaurant,events:e.events??[]},ops:{...dt?.ops??{},msgTemplates:e.msgTemplates,display:e.display}},feature_flags:{...ot??{},games:e.games,takeaway:!e.restaurant?.settings?.takeawayPaused}}),fromRow:t=>{ot=t.feature_flags??{},dt=t.settings??{};const a=t.settings?.app?.restaurant;if(!a)return null;const s='string'==typeof t.settings?.whatsapp?t.settings.whatsapp:void 0;return s&&!a.settings?.whatsapp&&(a.settings={...a.settings,whatsapp:s}),ve({restaurant:{...a,id:e},msgTemplates:t.settings?.ops?.msgTemplates??{},display:t.settings?.ops?.display??{},games:!1!==t.feature_flags?.games,...Array.isArray(t.settings?.app?.events)?{events:t.settings.app.events}:{}})},apply:t=>{const s=t[0];s&&(U.useStore.setState(t=>({restaurants:t.restaurants.map(t=>t.id===e&&s.restaurant?(0,a.withWildingsAddress)({...s.restaurant,id:e,settings:{...s.restaurant.settings,games:s.games}}):t),msgTemplates:{...t.msgTemplates,[e]:s.msgTemplates??{}}})),s.display&&Object.keys(s.display).length&&C.useFloor.setState(t=>({settings:{...t.settings,[e]:s.display}})),s.events&&nt(e,s.events))},subscribe:e=>{const t=U.useStore.subscribe((t,a)=>{t.restaurants===a.restaurants&&t.msgTemplates===a.msgTemplates&&t.events===a.events||e()}),a=C.useFloor.subscribe((t,a)=>{t.settings!==a.settings&&e()});return()=>{t(),a()}}}}let ot=null,dt=null;const ut=()=>new Date(Date.now()-2592e6).toISOString(),lt=e=>{if(!e.startsWith('dm:'))return['all','kitchen','foh','managers'].includes(e)?e:null;const t=e.split(':').slice(1).map(e=>Be.get(e));return 2===t.length&&t[0]&&t[1]?`dm:${[t[0],t[1]].sort().join(':')}`:null},ct=e=>{if(!e.startsWith('dm:'))return e;const t=e.split(':').slice(1).map(e=>Fe.get(e));return 2===t.length&&t[0]&&t[1]?(0,X.dmId)(t[0],t[1]):null},ft=()=>re.getState().perms.includes('*');function pt(){const e=()=>re.getState().staffRef;return{name:'chat',table:'chat_messages',deletes:!1,list:()=>P.useOwner.getState().chat.filter(e=>(0,$.isUuid)(e.id)).map(e=>ve({id:e.id,ch:e.ch,from:e.from,text:e.text,photo:e.photo,at:e.at,removed:!!e.removed})),key:e=>e.id,rowKey:e=>String(e.id),syncable:t=>!!lt(t.ch)&&(t.from===e()||ft()&&!t.ch.startsWith('dm:')&&t.removed),writable:()=>'staff'===re.getState().kind,filter:e=>e.gte('created_at',ut()).order('created_at',{ascending:!1}),inWindow:e=>e.at>=ut(),toRow:(e,t)=>{const a=lt(e.ch);if(!a)throw new Error('chat: unknown person');const s='system'===e.from?null:Be.get(e.from)??null;return{id:e.id,venue_id:t,channel:a,from_staff:s,body:e.text??null,photo:e.photo??null,removed:e.removed,created_at:e.at}},fromRow:e=>{const t=ct(String(e.channel));if(!t)return null;const a=e.from_staff?Fe.get(String(e.from_staff)):'system';return a?ve({id:String(e.id),ch:t,from:a,text:e.body??void 0,photo:e.photo??void 0,at:new Date(e.created_at).toISOString(),removed:!!e.removed}):null},apply:(t,a)=>P.useOwner.setState(s=>{const i=new Set(a),n=new Map(t.map(e=>[e.id,e])),r=e(),o=s.chat.filter(e=>!i.has(e.id)).map(e=>n.has(e.id)?{...e,...n.get(e.id)}:e),d=new Set(o.map(e=>e.id)),u=t.filter(e=>!d.has(e.id)).map(e=>({...e,reactions:{},seenBy:e.from===r?[e.from]:[]}));return{chat:u.length?[...o,...u].sort((e,t)=>e.at.localeCompare(t.at)):o}}),subscribe:e=>P.useOwner.subscribe((t,a)=>{t.chat!==a.chat&&e()}),onRemote:(t,a)=>{if('upsert'!==a||t.removed)return;const s=t.from_staff?Fe.get(String(t.from_staff)):'system',i=ct(String(t.channel)),n=e();if(!i||!n||s===n||Date.now()-new Date(t.created_at).getTime()>12e4)return;const r=P.useOwner.getState();if((r.chatMuted[n]??[]).includes(i))return;if(!(0,X.inChannel)(i,r.staff.find(e=>e.id===n)))return;if((0,Y.soundAllowed)())try{(0,Y.chime)('soft')}catch{}const o=r.staff.find(e=>e.id===s)?.name?.replace(' (example)','')??'The team',d=i.startsWith('dm:')?'sent you a message':`in ${'all'===i?'Everyone':'foh'===i?'Front of house':'kitchen'===i?'Kitchen':'managers'===i?'Managers':i}`,u=String(t.body??t.text??'').slice(0,120);(0,c.notify)({id:`chat:${t.id}`,icon:'\ud83d\udcac',kicker:'NEW MESSAGE',title:`${o} ${d}`,body:u||void 0,timeoutMs:7e3,testID:'chat-notice'})}}}function mt(e){return{name:'reminders',table:'venue_reminders',list:()=>{const t=S.useReminders.getState(),a=t.reminders.filter(t=>t.rid===e&&(0,$.isUuid)(t.id)).map(e=>{const{rid:t,...a}=e;return{id:e.id,kind:'reminder',doc:ve(a)}}),s=t.rules[e];return s?[...a,{id:s.id,kind:'break_rules',doc:ve(s)}]:a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id),writable:()=>de('venue.settings'),toRow:(e,t)=>({id:e.id,venue_id:t,kind:e.kind,doc:e.doc,updated_at:(new Date).toISOString()}),fromRow:e=>({id:String(e.id),kind:'break_rules'===e.kind?'break_rules':'reminder',doc:e.doc??{}}),apply:(t,a)=>S.useReminders.setState(s=>{const i=new Set(a),n={...s.rules},r=t.filter(e=>'break_rules'===e.kind);for(const t of r)n[e]={...(0,h.clampRules)(t.doc),id:t.id,updatedAt:t.doc.updatedAt};n[e]&&i.has(n[e].id)&&delete n[e];const o=new Map(t.filter(e=>'reminder'===e.kind).map(t=>[t.id,{...t.doc,id:t.id,rid:e}])),d=s.reminders.filter(e=>!i.has(e.id)).map(e=>o.get(e.id)??e),u=new Set(d.map(e=>e.id));return{rules:n,reminders:[...d,...[...o.values()].filter(e=>!u.has(e.id))]}}),subscribe:e=>S.useReminders.subscribe((t,a)=>{t.reminders===a.reminders&&t.rules===a.rules||e()})}}function gt(e){const t=he(14);return{name:'reminder_done',table:'reminder_done',mode:'insert',deletes:!1,list:()=>S.useReminders.getState().done.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id)&&(0,$.isUuid)(e.reminderId)&&e.staffRef===re.getState().staffRef,writable:()=>'staff'===re.getState().kind,filter:e=>e.gte('for_date',t).order('done_at',{ascending:!1}),inWindow:e=>e.forDate>=t,toRow:(e,t)=>({id:e.id,venue_id:t,reminder_id:e.reminderId,for_date:e.forDate,staff_ref:e.staffRef,staff_name:e.staffName.slice(0,80),done_at:e.at}),fromRow:t=>({id:String(t.id),rid:e,reminderId:String(t.reminder_id),forDate:String(t.for_date).slice(0,10),staffRef:t.staff_ref??'',staffName:t.staff_name??'Team',at:new Date(t.done_at).toISOString()}),apply:(e,t)=>S.useReminders.setState(a=>{const s=new Set(t),i=new Map(e.map(e=>[e.id,e])),n=a.done.filter(e=>!s.has(e.id)).map(e=>i.get(e.id)??e),r=new Set(n.map(e=>e.id));return{done:[...e.filter(e=>!r.has(e.id)),...n].sort((e,t)=>t.at.localeCompare(e.at)).slice(0,400)}}),subscribe:e=>S.useReminders.subscribe((t,a)=>{t.done!==a.done&&e()})}}function _t(e,t,a,s=()=>!0){const i=new Set(a),n=new Map(t.map(e=>[e.id,e])),r=e.filter(e=>!s(e)||!i.has(e.id)).map(e=>s(e)&&n.has(e.id)?n.get(e.id):e),o=new Set(r.map(e=>e.id));return[...r,...t.filter(e=>!o.has(e.id))]}const St=e=>null==e||''===e?null:Number(e),ht=e=>e.filter(e=>!e.startsWith('data:'));function yt(e){return{name:'cash_ups',table:'cash_ups',list:()=>B.useCashUp.getState().cashUps.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id)&&!!e.confirmedAt,writable:()=>de('wages.manage')||(0,l.hasCashUpAccess)(),deletes:!1,filter:e=>e.gte('for_date',he(400)),toRow:(e,t)=>({id:e.id,venue_id:t,for_date:e.date,vals:ve(e.vals),cash_tips:'number'==typeof e.vals.cashTips?e.vals.cashTips:null,card_tips:'number'==typeof e.vals.cardTips?e.vals.cardTips:null,photos:ht(e.photos),read_by:e.readBy??null,confirmed_by:e.confirmedBy??null,confirmed_at:e.confirmedAt??null,updated_at:(new Date).toISOString()}),fromRow:t=>({id:String(t.id),rid:e,date:String(t.for_date),vals:t.vals??{},photos:t.photos??[],readBy:t.read_by??null,confirmedBy:t.confirmed_by??void 0,confirmedAt:t.confirmed_at??void 0,onServer:!0,unlockedUntil:t.unlocked_until??void 0,unlockedBy:t.unlocked_by??void 0}),apply:(t,a)=>B.useCashUp.setState(s=>({cashUps:_t(s.cashUps,t.map(e=>{const t=s.cashUps.find(t=>t.id===e.id);return t&&!e.photos.length?{...e,photos:t.photos}:e}),a,t=>t.rid===e)})),subscribe:e=>B.useCashUp.subscribe((t,a)=>{t.cashUps!==a.cashUps&&e()})}}function wt(e){return{name:'sales_reports',table:'sales_reports',list:()=>B.useCashUp.getState().sales.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id)&&!!e.confirmedAt,writable:()=>de('wages.manage')||(0,l.hasCashUpAccess)(),deletes:!1,toRow:(e,t)=>({id:e.id,venue_id:t,week_start:e.weekStart,vals:ve(e.vals),categories:e.categories,photos:ht(e.photos),read_by:e.readBy??null,confirmed_by:e.confirmedBy??null,confirmed_at:e.confirmedAt??null,updated_at:(new Date).toISOString()}),fromRow:t=>({id:String(t.id),rid:e,weekStart:String(t.week_start),vals:t.vals??{},categories:t.categories??[],photos:t.photos??[],readBy:t.read_by??null,confirmedBy:t.confirmed_by??void 0,confirmedAt:t.confirmed_at??void 0,onServer:!0,unlockedUntil:t.unlocked_until??void 0,unlockedBy:t.unlocked_by??void 0}),apply:(t,a)=>B.useCashUp.setState(s=>({sales:_t(s.sales,t.map(e=>{const t=s.sales.find(t=>t.id===e.id);return t&&!e.photos.length?{...e,photos:t.photos}:e}),a,t=>t.rid===e)})),subscribe:e=>B.useCashUp.subscribe((t,a)=>{t.sales!==a.sales&&e()})}}function vt(e){return{name:'cashup_settings',table:'cashup_settings',conflict:'venue_id',list:()=>{const t=B.useCashUp.getState().settings[e];return t?[t]:[]},key:e=>e.id,rowKey:()=>(0,B.cashSettingsId)(e),syncable:e=>!!e.updatedAt,writable:()=>de('wages.manage'),deletes:!1,toRow:(e,t)=>({venue_id:t,doc:ve({cashFields:e.cashFields,salesFields:e.salesFields}),updated_at:(new Date).toISOString()}),fromRow:t=>({...t.doc,id:(0,B.cashSettingsId)(e),updatedAt:t.updated_at??void 0}),apply:t=>B.useCashUp.setState(a=>t[0]?{settings:{...a.settings,[e]:t[0]}}:a),subscribe:e=>B.useCashUp.subscribe((t,a)=>{t.settings!==a.settings&&e()})}}function bt(e){return{name:'day_tips',table:'day_tips',list:()=>B.useCashUp.getState().tips.filter(t=>t.rid===e).map(e=>({...e,id:e.date})),key:e=>e.id,rowKey:e=>String(e.for_date),syncable:()=>!1,writable:()=>!1,deletes:!1,filter:e=>e.gte('for_date',he(120)),toRow:()=>({}),fromRow:t=>({id:String(t.for_date),rid:e,date:String(t.for_date),total:Number(t.total),postedAt:String(t.posted_at),postedBy:t.posted_by??void 0}),apply:t=>B.useCashUp.setState(a=>{const s=new Map(t.map(e=>[e.date,e])),i=a.tips.filter(t=>!(t.rid===e&&s.has(t.date)));return{tips:[...t.map(({id:e,...t})=>t),...i]}}),subscribe:e=>B.useCashUp.subscribe((t,a)=>{t.tips!==a.tips&&e()})}}function kt(e){return{name:'tips_pot_events',table:'tips_pot_events',mode:'insert',deletes:!1,list:()=>B.useCashUp.getState().pot.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id),writable:()=>de('wages.manage'),toRow:(e,t)=>({id:e.id,venue_id:t,kind:e.kind,for_date:e.forDate??null,through_date:e.throughDate??null,amount:e.amount,reason:e.reason??null,by_name:e.by,at:e.at}),fromRow:t=>({id:String(t.id),rid:e,kind:'payout'===t.kind?'payout':'correction',forDate:t.for_date??void 0,throughDate:t.through_date??void 0,amount:St(t.amount)??0,reason:t.reason??void 0,by:String(t.by_name),at:String(t.at)}),apply:(t,a)=>B.useCashUp.setState(s=>({pot:_t(s.pot,t,a,t=>t.rid===e)})),subscribe:e=>B.useCashUp.subscribe((t,a)=>{t.pot!==a.pot&&e()})}}function It(e){return{name:'tips_settings',table:'tips_settings',conflict:'venue_id',deletes:!1,list:()=>{const t=B.useCashUp.getState().show[e];return t?[{id:'show',...t}]:[]},key:e=>e.id,rowKey:()=>'show',syncable:()=>!0,writable:()=>de('wages.manage'),toRow:(e,t)=>({venue_id:t,show_today:e.showToday,show_pot:e.showPot,updated_at:(new Date).toISOString()}),fromRow:e=>({id:'show',showToday:!1!==e.show_today,showPot:!1!==e.show_pot}),apply:t=>B.useCashUp.setState(a=>t[0]?{show:{...a.show,[e]:{showToday:t[0].showToday,showPot:t[0].showPot}}}:a),subscribe:e=>B.useCashUp.subscribe((t,a)=>{t.show!==a.show&&e()})}}function Ot(e){return{name:'scheduled_notifications',table:'scheduled_notifications',list:()=>j.useNotifs.getState().items.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id),writable:()=>de('venue.settings'),deletes:!1,toRow:(e,t)=>{const{rid:a,...s}=e;return{id:e.id,venue_id:t,doc:ve(s),updated_at:(new Date).toISOString()}},fromRow:t=>({...t.doc,id:String(t.id),rid:e}),apply:(t,a)=>j.useNotifs.setState(s=>({items:_t(s.items,t,a,t=>t.rid===e)})),subscribe:e=>j.useNotifs.subscribe((t,a)=>{t.items!==a.items&&e()})}}function Rt(e){return{name:'order_lists',table:'order_lists',list:()=>{const t=F.useOrderLists.getState(),a=t.lists.filter(t=>t.rid===e&&(0,$.isUuid)(t.id)).map(e=>{const{rid:t,...a}=e;return{id:e.id,kind:'list',doc:ve(a)}}),s=t.settings[e];return s?[...a,{id:s.id,kind:'settings',doc:ve(s)}]:a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id),writable:()=>de('venue.settings')||de('suppliers.order'),deletes:!1,toRow:(e,t)=>({id:e.id,venue_id:t,kind:e.kind,doc:e.doc,updated_at:(new Date).toISOString()}),fromRow:e=>({id:String(e.id),kind:'settings'===e.kind?'settings':'list',doc:e.doc??{}}),apply:(t,a)=>F.useOrderLists.setState(s=>{const i={...s.settings};for(const a of t.filter(e=>'settings'===e.kind))i[e]={...W.DEFAULT_ORDER_LIST_SETTINGS,...a.doc,id:a.id};const n=t.filter(e=>'list'===e.kind).map(t=>({...t.doc,id:t.id,rid:e}));return{settings:i,lists:_t(s.lists,n,a,t=>t.rid===e)}}),subscribe:e=>F.useOrderLists.subscribe((t,a)=>{t.lists===a.lists&&t.settings===a.settings||e()})}}function At(e){const t=()=>de('venue.settings')||de('suppliers.order');return{name:'order_list_items',table:'order_list_items',list:()=>F.useOrderLists.getState().items.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:a=>(0,$.isUuid)(a.id)&&(0,$.isUuid)(a.listId)&&(t()||'open'===a.status&&(0,F.orderSettingsOf)(e).allowStaff),writable:()=>'staff'===re.getState().kind,deletes:!0,toRow:(e,a)=>{const{rid:s,...i}=e;return{id:e.id,venue_id:a,list_id:e.listId,status:e.status,added_by_ref:(t()?e.addedBy:re.getState().staffRef)||null,doc:ve(i),updated_at:(new Date).toISOString()}},fromRow:t=>({...t.doc,id:String(t.id),listId:String(t.list_id),status:t.status??'open',rid:e}),apply:(t,a)=>F.useOrderLists.setState(s=>({items:_t(s.items,t,a,t=>t.rid===e)})),subscribe:e=>F.useOrderLists.subscribe((t,a)=>{t.items!==a.items&&e()})}}function Ut(e){const t=he(400);return{name:'order_list_history',table:'order_list_history',mode:'insert',deletes:!1,list:()=>F.useOrderLists.getState().history.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id),writable:()=>de('venue.settings')||de('suppliers.order'),filter:e=>e.gte('finished_at',t).order('finished_at',{ascending:!1}).limit(300),toRow:(e,t)=>{const{rid:a,...s}=e;return{id:e.id,venue_id:t,list_id:e.listId,finished_at:e.finishedAt,finished_by:e.finishedByName.slice(0,80),doc:ve(s)}},fromRow:t=>({...t.doc,id:String(t.id),rid:e}),apply:(t,a)=>F.useOrderLists.setState(s=>({history:_t(s.history,t,a,t=>t.rid===e).sort((e,t)=>t.finishedAt.localeCompare(e.finishedAt)).slice(0,300)})),subscribe:e=>F.useOrderLists.subscribe((t,a)=>{t.history!==a.history&&e()})}}function Dt(e){return{name:'venue_clock_area',table:'venue_clock_area',conflict:'venue_id',deletes:!1,list:()=>{const t=V.useClockArea.getState().areas[e];return t&&t.updatedAt?[{id:'area',doc:ve(t)}]:[]},key:()=>'area',rowKey:()=>'area',syncable:()=>!0,matchKey:()=>({}),writable:()=>de('venue.settings'),toRow:(e,t)=>({venue_id:t,doc:e.doc,updated_at:(new Date).toISOString()}),fromRow:e=>({id:'area',doc:e.doc??{}}),apply:t=>{const a=t[0];a&&V.useClockArea.setState(t=>({areas:{...t.areas,[e]:{...(0,u.venueClockArea)(e,a.doc),updatedAt:a.doc.updatedAt,updatedBy:a.doc.updatedBy}}}))},subscribe:e=>V.useClockArea.subscribe((t,a)=>{t.areas!==a.areas&&e()})}}function Et(e){return{name:'daily_tasks',table:'daily_tasks',deletes:!1,list:()=>{const t=J.useDailyTasks.getState(),a=[],s=t.library[e];s?.updatedAt&&a.push({id:(0,J.libraryRowId)(e),kind:'library',doc:ve({items:s.items,updatedAt:s.updatedAt})});for(const[s,i]of Object.entries(t.people)){const[t,n]=s.split('|');t===e&&i.updatedAt&&a.push({id:(0,J.personRowId)(e,n),kind:'person',staffRef:n,doc:ve({tasks:i.tasks,updatedAt:i.updatedAt})})}return a},key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>{const t=P.useOwner.getState().staff.find(e=>e.id===re.getState().staffRef);if(!t)return!1;if('staff'!==t.role)return!0;if('person'!==e.kind)return!1;const a=P.useOwner.getState().staff.find(t=>t.id===e.staffRef);return!!a&&(0,z.canEditTasks)(t,a)},writable:()=>'staff'===re.getState().kind,toRow:(e,t)=>({id:e.id,venue_id:t,kind:e.kind,staff_ref:e.staffRef??null,doc:e.doc,updated_at:(new Date).toISOString()}),fromRow:e=>({id:String(e.id),kind:'library'===e.kind?'library':'person',staffRef:e.staff_ref??void 0,doc:e.doc??{}}),apply:t=>J.useDailyTasks.setState(a=>{const s={...a.library},i={...a.people};for(const a of t)'library'===a.kind?s[e]={items:a.doc.items??[],updatedAt:a.doc.updatedAt}:a.staffRef&&(i[(0,J.personKey)(e,a.staffRef)]={tasks:a.doc.tasks??[],updatedAt:a.doc.updatedAt});return{library:s,people:i}}),subscribe:e=>J.useDailyTasks.subscribe((t,a)=>{t.library===a.library&&t.people===a.people||e()})}}function Ct(e){const t=he(7);return{name:'daily_task_ticks',table:'daily_task_ticks',list:()=>J.useDailyTasks.getState().ticks.filter(t=>t.rid===e),key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>{const t=re.getState();return e.byRef===t.staffRef||de('staff.manage')},writable:()=>'staff'===re.getState().kind,filter:e=>e.gte('for_date',t),inWindow:e=>e.forDate>=t,toRow:(e,t)=>({id:e.id,venue_id:t,staff_ref:e.staffRef,task_id:e.taskId,for_date:e.forDate,ticked_by_ref:e.byRef,ticked_by_name:e.byName.slice(0,80),ticked_at:e.at}),fromRow:t=>({id:String(t.id),rid:e,staffRef:String(t.staff_ref),taskId:String(t.task_id),forDate:String(t.for_date).slice(0,10),byRef:String(t.ticked_by_ref??''),byName:String(t.ticked_by_name??''),at:String(t.ticked_at)}),apply:(t,a)=>J.useDailyTasks.setState(s=>({ticks:_t(s.ticks,t,a,t=>t.rid===e)})),subscribe:e=>J.useDailyTasks.subscribe((t,a)=>{t.ticks!==a.ticks&&e()})}}function Tt(e,t=!1){const a=he(14);return{name:'sold_out_items',table:'sold_out_items',conflict:'venue_id,item_id',list:()=>ee.useSoldOut.getState().entries.filter(t=>t.rid===e),key:e=>e.itemId,rowKey:e=>String(e.item_id),syncable:()=>!0,deletes:!1,writable:()=>'staff'===re.getState().kind,filter:e=>e.gte('marked_at',a),inWindow:e=>e.at.slice(0,10)>=a,toRow:(e,a)=>({id:(0,se.uuidFrom)(`soldout:${a}:${e.itemId}`),venue_id:a,item_id:e.itemId.slice(0,80),name:e.name.slice(0,120),is_on:e.on,marked_at:e.at,by_name:(e.by||'Staff').slice(0,80),clear_after:e.clearAfter??null,...t?{auto:!!e.auto,kept:!!e.kept}:{}}),fromRow:a=>({rid:e,itemId:String(a.item_id),name:String(a.name??''),on:!0===a.is_on,at:String(a.marked_at),by:String(a.by_name??''),clearAfter:a.clear_after?String(a.clear_after):void 0,...t?{auto:!0===a.auto,kept:!0===a.kept}:{}}),apply:(t,a)=>ee.useSoldOut.setState(s=>{const i=new Set(a);return{entries:[...s.entries.filter(a=>!(a.rid===e&&(i.has(a.itemId)||t.some(e=>{return s=a,(t=e).rid===s.rid&&t.itemId===s.itemId;var t,s})))),...t]}}),subscribe:e=>ee.useSoldOut.subscribe((t,a)=>{t.entries!==a.entries&&e()}),afterRead:()=>{te.autoSync.soldOutRead.add(e)}}}function Nt(e){return{name:'sold_out_links',table:'sold_out_links',conflict:'venue_id,item_id',list:()=>te.useSoldOutLinks.getState().links.filter(t=>t.rid===e),key:e=>e.itemId,rowKey:e=>String(e.item_id),syncable:()=>!0,deletes:!1,writable:()=>'staff'===re.getState().kind,toRow:(e,t)=>({id:(0,se.uuidFrom)(`soldoutlink:${t}:${e.itemId}`),venue_id:t,item_id:e.itemId.slice(0,80),uses:e.uses.slice(0,10).map(e=>({key:String(e.key).slice(0,40),qty:Math.max(0,Math.min(99,Number(e.qty)||0))})),auto:!!e.auto,updated_at:e.at,updated_by:(e.by||'Staff').slice(0,80)}),fromRow:t=>({rid:e,itemId:String(t.item_id),uses:(Array.isArray(t.uses)?t.uses:[]).map(e=>({key:String(e.key??''),qty:Number(e.qty)||0})).filter(e=>e.key&&e.qty>0),at:String(t.updated_at??''),by:String(t.updated_by??''),...!0===t.auto?{auto:!0}:{}}),apply:(t,a)=>te.useSoldOutLinks.setState(s=>{const i=new Set(a);return{links:[...s.links.filter(a=>!(a.rid===e&&(i.has(a.itemId)||t.some(e=>e.itemId===a.itemId)))),...t]}}),subscribe:e=>te.useSoldOutLinks.subscribe((t,a)=>{t.links!==a.links&&e()}),afterRead:()=>{te.autoSync.linksRead.add(e)}}}async function Mt(e,t="*"){const a='*'===t?`table:${e}`:`table:${e}.${t}`;try{const s=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:i}=await Promise.race([ne().from(e).select(t,{head:!0,count:'exact'}).limit(1),s]);return i?!!/fetch|network|Failed/i.test(i.message)&&k.kv.get(a,!1):(k.kv.set(a,!0),!0)}catch{return k.kv.get(a,!1)}}async function Kt(){const e=re.getState().venueId;if(e)try{const{data:t}=await ne().from('push_settings').select('push_live').eq('venue_id',e).maybeSingle();qt.setState({live:!!t?.push_live,known:!0})}catch{}}const xt='order-list-logos';const Lt=new Map;const qt=(0,y.create)(()=>({live:!1,known:!1}));async function Pt(){try{const e=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:t}=await Promise.race([ne().from('venue_reminders').select('id').limit(1),e]);return t?!!/fetch|network|Failed/i.test(t.message)&&k.kv.get('reminders:ok',!1):(k.kv.set('reminders:ok',!0),!0)}catch{return k.kv.get('reminders:ok',!1)}}async function $t(){try{const e=new Promise(e=>setTimeout(()=>e({error:{message:'Failed: timed out'}}),5e3)),{error:t}=await Promise.race([ne().from('chat_messages').select('id').limit(1),e]);return t?!!/fetch|network|Failed/i.test(t.message)&&k.kv.get('chat:ok',!1):(k.kv.set('chat:ok',!0),!0)}catch{return k.kv.get('chat:ok',!1)}}const jt=(e,t)=>ve({id:String(e.id),venue:t,body:String(e.body??''),kind:'yesno'===e.kind?'yesno':'up',up:Number(e.up_count??0),yes:Number(e.yes_count??0),no:Number(e.no_count??0),hidden:!!e.hidden,reply:e.reply??void 0,replyAt:e.reply_at??void 0,postedOn:String(e.posted_on??'').slice(0,10)}),Bt='id,body,kind,up_count,yes_count,no_count,hidden,reply,reply_at,posted_on';function Ft(e){return{name:'hr_questions',table:'hr_questions',deletes:!1,list:()=>_.useHr.getState().questions.filter(t=>t.venue===e&&(0,$.isUuid)(t.id)),key:e=>e.id,rowKey:e=>String(e.id),syncable:()=>!1,writable:()=>!1,toRow:e=>({id:e.id}),fromRow:t=>jt(t,e),filter:e=>e.gte('posted_on',new Date(Date.now()-10368e6).toISOString().slice(0,10)),apply:(e,t)=>{const a=new Set(t);_.useHr.setState(t=>{const s=new Map(e.map(e=>[e.id,e])),i=t.questions.filter(e=>!a.has(e.id)).map(e=>s.get(e.id)??e),n=new Set(i.map(e=>e.id));return{questions:[...i,...e.filter(e=>!n.has(e.id))]}})},subscribe:e=>_.useHr.subscribe((t,a)=>{t.questions!==a.questions&&e()})}}function Wt(e,t){const a=(t,a,s)=>{R.mutationQueue.enqueue({table:'hr_questions',venueId:e,kind:'rpc',fn:t,rowKey:a,values:s})};Object.assign(_.hrRemote,{live:!0,checkout:t=>a('hr_checkout',t.token,{p_venue:e,p_day:t.day,p_token:t.token,p_morale:t.morale,p_staffing:t.staffing,p_question:t.question??null,p_kind:t.kind??'up',p_shout_to:t.shoutTo??null,p_shout_body:t.shoutBody??null}),post:(t,s,i,n)=>a('hr_post_question',s,{p_venue:e,p_id:s,p_body:i,p_kind:n}),vote:(e,t,s)=>a('hr_vote',e,{p_question:e,p_token:t,p_vote:s}),moderate:(e,t,s)=>a('hr_moderate',e,{p_question:e,p_action:t,p_reason:s}),reply:(e,t)=>a('hr_reply',e,{p_question:e,p_reply:t}),trend:async(t,a,s)=>{try{const{data:t,error:i}=await ne().rpc('hr_trend',{p_venue:e,p_from:a,p_to:s});return i?null:(t??[]).map(e=>({day:String(e.day).slice(0,10),answers:Number(e.answers),morale:Number(e.morale),staffing:null==e.staffing?null:Number(e.staffing),short:Number(e.short),perfect:Number(e.perfect),over:Number(e.over)}))}catch{return null}},shouts:async(a,s)=>{try{const{data:a,error:i}=await ne().from('hr_shoutouts').select('id,day,to_name,body').eq('venue_id',e).gte('day',s).order('day',{ascending:!1}).limit(20);return i?null:(a??[]).map(e=>({id:String(e.id),venue:t,day:String(e.day).slice(0,10),to:String(e.to_name),body:e.body??void 0}))}catch{return null}},log:async()=>{try{const{data:a,error:s}=await ne().from('hr_mod_log').select('id,question_id,action,reason,by_name,at').eq('venue_id',e).order('at',{ascending:!1}).limit(30);return s?null:(a??[]).map(e=>({id:String(e.id),venue:t,questionId:String(e.question_id??''),action:e.action,reason:e.reason??void 0,by:String(e.by_name??'A manager'),at:String(e.at)}))}catch{return null}},refresh:async()=>{try{const{data:a,error:s}=await ne().from('hr_questions').select(Bt).eq('venue_id',e).order('posted_on',{ascending:!1}).limit(200);s||_.useHr.getState().setRemoteBoard(t,(a??[]).map(e=>jt(e,t)))}catch{}}}),me.push(()=>{Object.assign(_.hrRemote,{live:!1,checkout:null,post:null,vote:null,moderate:null,reply:null,trend:null,shouts:null,log:null,refresh:null})})}const Vt='pair:v1',Ht='staff:v1',Gt='staff:rejoin:v1';async function Qt(){if('display'===le||'customer'===le||H.PITCH)return'none';const t=await k.kv.get(Gt,null);if(!t)return'none';try{await zt();const{data:a,error:s}=await ne().rpc(e.IS_QUEUED_VENUE?'claim_'+e.VENUE_RID+'_invite':e.IS_GREENSIDE?'claim_greenside_invite':e.IS_ABBOTSFORD?'claim_abbotsford_invite':e.IS_KIRKTON?'claim_kirkton_invite':e.IS_WILDINGS?'claim_wildings_invite':e.IS_KIRKMICHAEL?'claim_kirkmichael_invite':e.IS_ISOLATED_VENUE?'claim_souters_invite':'claim_invite',{p_token:t,p_app:le,p_device:(0,g.deviceId)()});if(s)return(0,p.inviteRefusal)(s.message)?(await k.kv.remove(Gt),await k.kv.remove(Ht),'refused'):'offline';const i=a?.[0];return i?(await k.kv.set(Ht,{kind:'staff',venueId:i.venue_id,venueSlug:i.venue_slug,venueName:i.venue_name,staffRef:i.external_ref,staffUuid:i.staff_id,role:i.role_key,displayName:i.display_name}),'ok'):(await k.kv.remove(Gt),'refused')}catch{return'offline'}}const Jt=e=>/jwt|refresh|token|401|not authenticated|invalid claim|session/i.test(String(e?.message??e))&&!/fetch|network/i.test(String(e?.message??e));async function zt(){fe();const{data:e}=await ne().auth.getSession();if(!e.session)for(let e=0;;e++){const{error:t}=await ne().auth.signInAnonymously();if(!t)return;const a=429===t.status||/rate|too many/i.test(t.message);if(!a||e>=2){if(a)throw new Error('Too many people are connecting from this network right now. Wait a few minutes, or switch to mobile data, and open the link again.');throw t}oe({message:'Lots of people are connecting at once. Trying again in a moment\u2026'}),await new Promise(t=>setTimeout(t,0===e?15e3:45e3))}}async function Zt(t){if(H.PITCH)return{status:'refused',message:'This link has been replaced or switched off. Ask your manager for a new one.'};if(!(0,v.isSupabaseConfigured)())return{status:'off'};try{await zt();const{data:a,error:s}=await ne().rpc(e.IS_QUEUED_VENUE?'claim_'+e.VENUE_RID+'_invite':e.IS_GREENSIDE?'claim_greenside_invite':e.IS_ABBOTSFORD?'claim_abbotsford_invite':e.IS_KIRKTON?'claim_kirkton_invite':e.IS_WILDINGS?'claim_wildings_invite':e.IS_KIRKMICHAEL?'claim_kirkmichael_invite':e.IS_ISOLATED_VENUE?'claim_souters_invite':'claim_invite',{p_token:t,p_app:le,p_device:(0,g.deviceId)()});if(s){const t=(0,p.inviteRefusal)(s.message);if(t){try{localStorage.removeItem((0,e.venueKey)(`cc-pending-invite:${le}`))}catch{}return{status:'refused',message:t}}throw s}const i=a?.[0];if(!i)return{status:'refused',message:'This link has been replaced or switched off. Ask your manager for a new one.'};const n={kind:'staff',venueId:i.venue_id,venueSlug:i.venue_slug,venueName:i.venue_name,staffRef:i.external_ref,staffUuid:i.staff_id,role:i.role_key,displayName:i.display_name};return await k.kv.set(Ht,n),await k.kv.set(Gt,t),ge&&aa(),{status:'ok',id:n}}catch(e){const t=String(e?.message??e);return oe({lastError:`Sign-in: ${t}`}),{status:'offline',message:t}}}async function Xt(){if(!(0,v.isSupabaseConfigured)())return!1;try{return await zt(),!0}catch{return!1}}const Yt=async(e,t={})=>{if(H.PITCH)return(0,G.pitchRpc)(e,t);const{data:a,error:s}=await ne().rpc(e,t);if(s)throw s;return a};let ea=null;async function ta(){for(const e of me)try{e()}catch{}me=[],pe.forEach(e=>e.stop()),pe=[],ea&&(clearInterval(ea),ea=null)}async function aa(){await ta(),await ia()}let sa=e.VENUE_RID;async function ia(){try{const e='undefined'!=typeof navigator?navigator.storage:null;e?.persist&&e.persist()}catch{}try{const e='undefined'!=typeof window?window.CoverChargeNative:null;e&&'function'==typeof e.checkUpdate&&/CoverChargePhone\//.test(navigator.userAgent)&&e.checkUpdate()}catch{}const t=sa;try{if(oe({mode:'connecting'}),await R.mutationQueue.load(),'customer'===le)return void await da(t);const a=await k.kv.get(Vt,null);let s=await k.kv.get(Ht,null);if(e.IS_ISOLATED_VENUE&&(a&&!(0,e.venueIdentityAllowed)(a.venueId,a.venueSlug)||s&&!(0,e.venueIdentityAllowed)(s.venueId,s.venueSlug)))return void oe({mode:'display'===le?'unpaired':'signin',perms:[],message:'This sign-in belongs to a different venue.'});let{data:i}=await ne().auth.getSession();if('display'!==le&&s&&!i.session){const e=await Qt();if('offline'===e)return oe({venueId:s.venueId,venueSlug:s.venueSlug,venueName:s.venueName,kind:s.kind,role:s.role,staffRef:s.staffRef,staffUuid:s.staffUuid,mode:'offline'}),void setTimeout(()=>{sa===t&&aa()},6e4);'refused'===e&&s.staffRef&&g.useSession.getState().meId===s.staffRef&&g.useSession.getState().signOut(),s=await k.kv.get(Ht,null),({data:i}=await ne().auth.getSession())}const n='display'===le?a:s;if(!i.session||!n)return void oe({mode:'display'===le?'unpaired':'signin',perms:[]});let r=[];try{const e=(await Yt('whoami')??[]).filter(e=>e.venue_id===n.venueId);if(!e.length)return'display'===le?await k.kv.remove(Vt):(await k.kv.remove(Ht),await k.kv.remove(Gt)),'staff'===n.kind&&n.staffRef&&g.useSession.getState().meId===n.staffRef&&g.useSession.getState().signOut(),void oe({mode:'display'===le?'unpaired':'signin',perms:[],message:'display'===le?'This display was unpaired by a manager.':'Open your invite link again to connect.'});r=[...new Set(e.flatMap(e=>e.permissions??[]))],'device'===n.kind&&n.canWrite&&r.push('device.write')}catch(e){if(!(0,b.isOnline)()||/fetch|network/i.test(String(e?.message)))oe({mode:'offline'});else if(Jt(e)&&'display'!==le){const{error:e}=await ne().auth.refreshSession();e&&'ok'===await Qt()&&setTimeout(()=>{sa===t&&aa()},500)}r=re.getState().perms}oe({venueId:n.venueId,venueSlug:n.venueSlug,venueName:n.venueName,kind:n.kind,role:n.role,staffRef:n.staffRef,staffUuid:n.staffUuid,perms:r}),'staff'===n.kind&&n.staffRef&&g.useSession.getState().meId!==n.staffRef&&(g.useSession.getState().signIn(n.staffRef),P.useOwner.setState({staffAs:n.staffRef})),await ra(n.venueId,t,n.kind)}catch(e){oe({mode:'local',lastError:String(e?.message??e)})}}const na=new Set(['venues','staff','bookings','walk_ins','blocks','table_plans','takeaway_orders','stock_items','stock_events','stock_counts','recipe_cards','suppliers','supplier_orders','rota_shifts','attendance','time_requests','game_scores','floor_live','chat_messages','venue_reminders','reminder_done']);async function ra(t,a,s){if(!(0,e.venueIdentityAllowed)(t,a))throw new Error('Different venue: sync refused.');await ma(a),me.push(Da(t));try{const{data:e}=await ne().from('roles').select('id,key').eq('venue_id',t);for(const t of e??[])We.set(t.key,t.id),Ve.set(t.id,t.key)}catch{}const i=[rt(a),{protect:!0,name:'staff',table:'staff',conflict:'venue_id,external_ref',list:()=>P.useOwner.getState().staff.map(Je),key:e=>e.id,rowKey:e=>String(e.external_ref??e.id),syncable:e=>!e.name.includes('(example)'),writable:()=>de('staff.manage'),deletes:!1,toRow:(e,t)=>({venue_id:t,external_ref:e.id,display_name:e.name,...$e?{nickname:e.nickname?.trim()||null}:{},job_title:e.job||null,department:e.dept||null,active:e.active,...je?{display_clock:!!e.displayClock,temp:!!e.temp,temp_until:e.tempUntil||null}:{},...e.managerAccess||e.ownerAccess||!We.get(He(e))?{}:{role_id:We.get(He(e))}}),fromRow:e=>e.external_ref?(Be.set(String(e.external_ref),String(e.id)),Fe.set(String(e.id),String(e.external_ref)),Oa.set(String(e.external_ref),e.avatar_path??null),ve({id:String(e.external_ref),name:e.display_name,...$e&&'nickname'in e?{nickname:e.nickname??void 0}:{},job:e.job_title??'',active:!1!==e.active,dept:e.department??'',...je&&'display_clock'in e?{displayClock:!!e.display_clock,temp:!!e.temp||void 0,tempUntil:e.temp_until??void 0}:{},...Qe(Ge(Ve.get(String(e.role_id))),!0===e.manager_access),...!0===e.owner_access&&'owner'!==Ge(Ve.get(String(e.role_id))).role?{role:'owner',ownerAccess:!0}:{}})):null,apply:e=>P.useOwner.setState(t=>{const a=new Map(e.map(e=>[e.id,e])),s=t.staff.map(e=>a.has(e.id)?{...e,...a.get(e.id)}:e),i=new Set(s.map(e=>e.id));return{staff:[...s,...e.filter(e=>!i.has(e.id)).map(e=>({...e}))]}}),subscribe:e=>P.useOwner.subscribe((t,a)=>{t.staff!==a.staff&&e()}),afterRead:()=>{Ua()},onRemote:()=>{Ua()}},{name:'pay',table:'staff_private',conflict:'staff_id',list:()=>{const e=P.useOwner.getState(),t=x.useSetup.getState().sites[sa]?.staffGrade??{};return e.staff.filter(e=>Be.has(e.id)).map(a=>ve({id:a.id,hourly:e.hourly[a.id]??null,salaried:!!a.salaried,noTax:!!a.noTax,grade:t[a.id]||void 0}))},key:e=>e.id,rowKey:e=>Fe.get(String(e.staff_id))??String(e.staff_id),syncable:e=>Be.has(e.id),writable:()=>de('wages.manage'),deletes:!1,toRow:(e,t)=>({staff_id:Be.get(e.id),venue_id:t,hourly_rate:null==e.hourly?null:e.hourly/100,salaried:e.salaried,no_tax:e.noTax,pay_grade:e.grade??null}),fromRow:e=>{const t=Fe.get(String(e.staff_id));return t?ve({id:t,hourly:null==e.hourly_rate?null:Math.round(100*Number(e.hourly_rate)),salaried:!!e.salaried,noTax:!!e.no_tax,grade:e.pay_grade||void 0}):null},apply:e=>P.useOwner.setState(t=>{const a={...t.hourly},s=new Map(e.map(e=>[e.id,e]));for(const t of e)null==t.hourly?delete a[t.id]:a[t.id]=t.hourly;if(e.length){const t=x.useSetup.getState().sites[sa],a={...t?.staffGrade??{}};let s=!1;for(const t of e)(a[t.id]||void 0)!==t.grade&&(s=!0,t.grade?a[t.id]=t.grade:delete a[t.id]);s&&x.useSetup.getState().patch(sa,{staffGrade:a})}return{hourly:a,staff:t.staff.map(e=>s.has(e.id)?{...e,salaried:s.get(e.id).salaried,noTax:s.get(e.id).noTax}:e)}}),subscribe:e=>{const t=P.useOwner.subscribe((t,a)=>{t.hourly===a.hourly&&t.staff===a.staff||e()}),a=x.useSetup.subscribe((t,a)=>{t.sites[sa]?.staffGrade!==a.sites[sa]?.staffGrade&&e()});return()=>{t(),a()}}},be(a,!1),be(a,!0),Ie(a),Re(a),ke(a),Ae(a),De(a),Ee(a),Pe(a),{name:'supplier_directory',table:'suppliers',list:()=>P.useOwner.getState().suppliers,key:e=>e.id,rowKey:e=>String(e.doc?.localId??e.id),syncable:e=>(0,$.isUuid)(e.id),writable:()=>de('suppliers.manage'),toRow:(e,t)=>({id:e.id,venue_id:t,name:e.name||'Supplier',category:e.category,contact:e.contact||null,phones:e.phones.filter(Boolean),email:e.email||null,website:e.website||null,account_ref:e.account||null,cutoff:e.cutoff||null,order_days:e.orderDays,delivery_days:e.deliveryDays,doc:{kind:'directory',localId:e.id,supplier:ve(e)}}),fromRow:e=>'directory'===e.doc?.kind?e.doc.supplier:null,apply:(e,t)=>P.useOwner.setState(a=>{const s=new Set(t),i=new Map(e.map(e=>[e.id,e])),n=a.suppliers.filter(e=>!s.has(e.id)).map(e=>i.get(e.id)??e),r=new Set(n.map(e=>e.id));return{suppliers:[...n,...e.filter(e=>!r.has(e.id))]}}),subscribe:e=>P.useOwner.subscribe((t,a)=>{t.suppliers!==a.suppliers&&e()})},{name:'supplier_orders',table:'supplier_orders',list:()=>P.useOwner.getState().supplierOrders,key:e=>e.id,rowKey:e=>String(e.id),syncable:e=>(0,$.isUuid)(e.id)&&(0,$.isUuid)(e.supplierId),writable:()=>de('suppliers.order')||de('suppliers.manage'),toRow:(e,t)=>({id:e.id,venue_id:t,supplier_id:e.supplierId,order_date:e.date||Se(),items:[{text:e.items}],amount:Math.round(e.amount||0),status:'sent',by_name:e.by,doc:ve(e)}),fromRow:e=>e.doc?{...e.doc,id:String(e.id)}:null,apply:(e,t)=>P.useOwner.setState(a=>{const s=new Set(t),i=new Map(e.map(e=>[e.id,e])),n=a.supplierOrders.filter(e=>!s.has(e.id)).map(e=>i.get(e.id)??e),r=new Set(n.map(e=>e.id));return{supplierOrders:[...e.filter(e=>!r.has(e.id)),...n]}}),subscribe:e=>P.useOwner.subscribe((t,a)=>{t.supplierOrders!==a.supplierOrders&&e()})},Te(a),ba(a)];de('wages.view')&&i.push(ka(a)),'staff'===s&&(i.push(Ye(),et(),tt(),st(a)),at(t));const n='staff'===s&&await $t();if(Z.useChatSync.setState({synced:n,checked:!0}),me.push(()=>Z.useChatSync.setState({synced:!1})),n&&i.push(pt(),{name:'chat_extra',table:'chat_channel_extra',conflict:'venue_id,channel,staff_id',list:()=>Object.entries(X.useKitchenExtra.getState().extra).map(([e,t])=>({id:e,include:t})),key:e=>e.id,rowKey:e=>Fe.get(String(e.staff_id))??String(e.staff_id),syncable:e=>Be.has(e.id),writable:()=>de('staff.manage'),filter:e=>e.eq('channel','kitchen'),matchKey:e=>({channel:'kitchen',staff_id:Be.get(e)??e}),toRow:(e,t)=>({venue_id:t,channel:'kitchen',staff_id:Be.get(e.id),include:e.include}),fromRow:e=>{const t=Fe.get(String(e.staff_id));return t?{id:t,include:!!e.include}:null},apply:(e,t)=>X.useKitchenExtra.setState(a=>{const s={...a.extra};return t.forEach(e=>{delete s[e]}),e.forEach(e=>{s[e.id]=e.include}),{extra:s}}),subscribe:e=>X.useKitchenExtra.subscribe((t,a)=>{t.extra!==a.extra&&e()})}),'staff'===s&&await Mt('hr_questions')&&(i.push(Ft(a)),na.add('hr_questions'),Wt(t,a)),'guest'!==s&&await Mt('sold_out_items')?(i.push(Tt(a,await Mt('sold_out_items','auto'))),na.add('sold_out_items')):te.autoSync.soldOutRead.add(a),'guest'!==s&&await Mt('sold_out_links')?(i.push(Nt(a)),na.add('sold_out_links')):te.autoSync.linksRead.add(a),S.useReminders.getState().ensure(a),'guest'!==s&&await Pt()&&(i.push(mt(a)),'staff'===s&&i.push(gt(a))),j.useNotifs.getState().ensure(a),F.useOrderLists.getState().ensure(a),'staff'===s){$e=await Mt('staff','nickname'),je=await Mt('staff','display_clock');const[e,t,s,n]=await Promise.all([Mt('scheduled_notifications'),Mt('order_lists'),Mt('venue_clock_area'),Mt('daily_tasks')]);J.useDailyTasks.getState().ensure(a),n&&(i.push(Et(a),Ct(a)),na.add('daily_tasks'),na.add('daily_task_ticks')),e&&(i.push(Ot(a)),Kt()),t&&i.push(Rt(a),At(a),Ut(a)),s&&i.push(Dt(a));for(const[a,i]of[[e,'scheduled_notifications'],[t,'order_lists'],[t,'order_list_items'],[t,'order_list_history'],[s,'venue_clock_area']])a&&na.add(i)}if('guest'!==s&&await Mt('day_tips')){i.push(bt(a));for(const e of['day_tips','tips_pot_events','tips_settings'])na.add(e);await Mt('tips_pot_events')&&i.push(kt(a),It(a)),'staff'===s&&(i.push(yt(a),wt(a),vt(a)),na.add('cash_ups'),na.add('sales_reports'),_r2(_d[59])(_d[58],_d.paths).then(e=>e.refreshCashAccess()))}'device'===s&&(i.push(Ye(),et()),await Mt('scheduled_notifications')&&i.push(Ot(a)));let r=!1;const o={onActivity:()=>oe({lastSyncAt:(new Date).toISOString()}),onError:(e,t)=>oe({lastError:`${e}: ${t}`}),onSuspect:(e,s)=>{oe({lastError:`${e}: held back, ${s}`}),r||(r=!0,(async()=>{try{if(!(await Yt('whoami')??[]).some(e=>e.venue_id===t))return void(sa===a&&aa());for(const a of pe){if(a.spec.name!==e)continue;const{count:s,error:i}=await ne().from(a.spec.table).select('*',{count:'exact',head:!0}).eq(a.spec.venueColumn??'venue_id',t);!i&&(s??0)>0&&a.allowMassRemoveOnce()}}catch{}finally{r=!1}})())}};pe=i.map(e=>new A.EntityBridge(e,t,o)),await Promise.all(pe.map(e=>e.start()));const d=async()=>{if('staff'===s&&(0,b.isOnline)())try{const e=await Yt('whoami');if(!e?.some(e=>e.venue_id===t))return void(sa===a&&aa())}catch(e){if(Jt(e)){const e=await Qt();return void('ok'!==e&&'refused'!==e||sa===a&&aa())}}let e=0;for(const[t,a]of pe.entries()){const s='chat'===i[t]?.name;try{await a.read(),e++,s&&Z.useChatSync.getState().error&&Z.useChatSync.setState({error:void 0})}catch(e){const t=String(e?.message??e);if((s||/fetch|network|Failed/i.test(t))&&Z.useChatSync.setState({error:t||'unknown error'}),/fetch|network|Failed/i.test(t))break}}if(e?(oe({mode:(0,b.isOnline)()?'live':'offline',lastSyncAt:(new Date).toISOString()}),R.mutationQueue.flush()):oe({mode:'offline'}),!de('wages.view')){const e=re.getState().staffRef;P.useOwner.setState(t=>({hourly:e&&null!=t.hourly[e]?{[e]:t.hourly[e]}:{}}))}};await d();const u=new Map;for(const e of pe)u.set(e.spec.table,[...u.get(e.spec.table)??[],e]);const l=[...u.keys()].filter(e=>na.has(e)).map(e=>({table:e,venueColumn:u.get(e)[0].spec.venueColumn}));let c=!1;const f=(0,A.venueChannel)(t,l,(e,t,a)=>{for(const s of u.get(e)??[])s.remote(t,a);oe({lastSyncAt:(new Date).toISOString()})},e=>{oe({realtime:e}),'SUBSCRIBED'===e?(c&&d(),c=!1):'CHANNEL_ERROR'!==e&&'TIMED_OUT'!==e&&'CLOSED'!==e||(c=!0)});me.push(()=>{ne().removeChannel(f)}),ea=setInterval(()=>{d()},6e4),me.push((0,b.onConnectivity)(e=>{e&&d()}))}'undefined'!=typeof window&&(window.__ccSync=()=>({...re.getState(),queue:R.mutationQueue.pending.map(e=>e.table),failedTables:R.mutationQueue.failed.map(e=>`${e.table}: ${e.lastError??''}`.slice(0,200))}));const oa='guest:sent:v1';async function da(s){oe({kind:'guest',venueSlug:s,perms:[]});try{const i=(await Yt('public_venue',{p_venue_slug:(0,t.queuedDatabaseSlug)(s)}))?.[0];if(i&&(!e.IS_ISOLATED_VENUE||i.id===e.VENUE_UUID)){oe({venueId:i.id,venueName:i.name}),await ma(s);const e=i.app?.restaurant;e&&U.useStore.setState(t=>({restaurants:t.restaurants.map(t=>t.id===s?(0,a.withWildingsAddress)({...e,id:s}):t)})),nt(s,i.app?.events)}await ua(s),oe({mode:'live',lastSyncAt:(new Date).toISOString()})}catch{oe({mode:(0,b.isOnline)()?'local':'offline'})}const i=setInterval(()=>{ua(s).catch(()=>{})},6e4);me.push(()=>clearInterval(i)),e.IS_ISOLATED_VENUE||await la(s)}async function ua(e){const a=await Yt('public_menu',{p_venue_slug:(0,t.queuedDatabaseSlug)(e)})??[];if(a.length){const t=new Map(a.map(e=>[String(e.menu_item_id??e.doc?.item?.id??''),e]));N.useCardStore.setState(a=>({cards:a.cards.map(a=>{if(a.restaurantId!==e)return a;const s=t.get(a.menuItemId);if(!s)return a.signOff?{...a,signOff:null}:a;const i=s.updated_at?new Date(s.updated_at).toISOString():a.updatedAt;return{...a,photo:s.photo_url||void 0,signOff:a.signOff??{by:'Head chef',at:i}}})}))}const s=a.map(e=>e.doc?.item).filter(e=>!!e&&!!e.id).map(t=>({...t,restaurantId:e}));s.length&&U.useStore.setState(e=>{const t=new Map(s.map(e=>[e.id,e])),a=e.menu.map(e=>t.get(e.id)??e),i=new Set(a.map(e=>e.id));return{menu:[...a,...s.filter(e=>!i.has(e.id))]}})}async function la(e){let a=await k.kv.get(oa,{}),s=!1;const i=new Date(Date.now()-1728e5).toISOString(),n=async()=>{if(!s){s=!0;try{const s=U.useStore.getState(),n=s.bookings.filter(t=>t.restaurantId===e&&(0,$.isUuid)(t.id)&&!t.walkIn&&!a[t.id]&&t.createdAt>=i),r=s.orders.filter(t=>t.restaurantId===e&&(0,$.isUuid)(t.id)&&!a[t.id]&&t.createdAt>=i&&'table'!==t.type);if(n.length||r.length){if(!await Xt())return;for(const s of n)try{const i=(await Yt('guest_create_booking',{p_venue_slug:(0,t.queuedDatabaseSlug)(e),p_booking:{...ve(s),...(0,f.takeGuard)(s.id),allergies:we(s.allergies)}}))?.[0];a={...a,[s.id]:'booking'};const n={};i?.status&&i.status!==s.status&&(n.status=i.status),'string'==typeof i?.ref&&i.ref&&i.ref!==s.ref&&(n.ref=i.ref),Object.keys(n).length&&U.useStore.setState(e=>({bookings:e.bookings.map(e=>e.id===s.id?{...e,...n}:e)}))}catch(e){/fetch|network/i.test(String(e?.message))||(a={...a,[s.id]:'failed'},oe({lastError:`Booking: ${e?.message}`}))}for(const s of r)try{await Yt('guest_create_takeaway',{p_venue_slug:(0,t.queuedDatabaseSlug)(e),p_order:{...ve(s),...(0,f.takeGuard)(s.id),allergies:we(s.allergies)}}),a={...a,[s.id]:'order'}}catch(e){/fetch|network/i.test(String(e?.message))||(a={...a,[s.id]:'failed'},oe({lastError:`Order: ${e?.message}`}))}await k.kv.set(oa,a)}for(const e of s.bookings)if('booking'===a[e.id]&&'cancelled'===e.status)try{await Yt('guest_cancel_booking',{p_id:e.id}),a={...a,[e.id]:'cancelled'},await k.kv.set(oa,a)}catch{}if(Object.values(a).some(e=>'booking'===e||'order'===e)){const e=await Yt('guest_my_items')??[],t=new Map(e.map(e=>[String(e.id),e]));U.useStore.setState(e=>({bookings:e.bookings.map(e=>{const a=t.get(e.id);return a&&a.status&&a.status!==e.status&&'declined'!==a.status?{...e,status:a.status}:'declined'===a?.status&&'cancelled'!==e.status?{...e,status:'cancelled'}:e}),orders:e.orders.map(e=>{const a=t.get(e.id);if(!a)return e;const s=a.doc??{},i={...e,status:a.status??e.status,readyBy:s.readyBy??e.readyBy,accepted:s.accepted??e.accepted};return ca(i)===ca(e)?e:i})})),oe({mode:'live',lastSyncAt:(new Date).toISOString()})}}catch{oe({mode:(0,b.isOnline)()?re.getState().mode:'offline'})}finally{s=!1}}};me.push(U.useStore.subscribe((e,t)=>{e.bookings===t.bookings&&e.orders===t.orders||setTimeout(()=>{n()},200)})),ea=setInterval(()=>{n()},15e3),n()}const ca=e=>JSON.stringify([e.status,e.readyBy,e.accepted]),fa={bridges:()=>pe,restart:aa},pa='golive:v1:';async function ma(e){'live'!==U.useStore.getState().clock.mode&&U.useStore.setState({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}}),s.LIVE_VENUE_BUILD&&(0,s.isLiveVenue)(e)?await wa(e):(await k.kv.get(pa+e,!1)||await wa(e),await k.kv.get(ha+e,!1)||(ya(e),await k.kv.set(ha+e,!0)),await k.kv.get(ga+e,!1)||(Sa(),await k.kv.set(ga+e,!0)))}const ga='golive:v3:';function Sa(){const e=e=>JSON.stringify(e).includes('(example)');try{L.useKitchen.setState(t=>({waste:t.waste.filter(t=>!e(t)),stockTakes:t.stockTakes.filter(t=>!e(t)),deliveries:t.deliveries.filter(e=>'dl-today-fish'!==e.id&&'dl-today-veg'!==e.id)}))}catch{}}const ha='golive:v2:';function ya(e){const t=e=>JSON.stringify(e).includes('(example)');U.useStore.setState(t=>({customer:{...t.customer,name:'',email:'',phone:'',allergies:[],allergyConsent:!1,marketingOptIn:{}},stampCards:t.stampCards.filter(t=>t.restaurantId!==e),giftCards:t.giftCards.filter(t=>t.restaurantId!==e),ratings:t.ratings.filter(t=>t.restaurantId!==e),events:t.events.filter(t=>!(t.example&&(t.restaurantId===e||null===t.restaurantId)))})),P.useOwner.setState(e=>({referrals:[],coats:[],merchOrders:[],lost:[],customerTags:{},offers:e.offers.filter(e=>!t(e)),changeRequests:e.changeRequests.filter(e=>!t(e)),campaigns:e.campaigns.filter(e=>!t(e)),supplierOrders:e.supplierOrders.filter(e=>!t(e)),chat:e.chat.filter(e=>e.id.startsWith('m-seed-')).map((e,t)=>({...e,at:new Date(Date.now()-6e4*(5-t)).toISOString()}))}))}async function wa(e){if(s.LIVE_VENUE_BUILD&&(0,s.isLiveVenue)(e)){const t=(0,i.stripCoreLiveSamples)(U.useStore.getState()),a=(0,L.stripKitchenExamples)(L.useKitchen.getState()),o=P.useOwner.getState(),u=(0,i.stripOwnerLiveSamples)(o),l={accidents:q.useSafety.getState().accidents.filter(e=>!(0,q.isSeedAccident)(e))},c=(e,t)=>Object.keys(t).some(a=>JSON.stringify(e[a])!==JSON.stringify(t[a]));c(U.useStore.getState(),t)&&(await(0,n.archiveChefCache)('core',U.useStore.getState()),U.useStore.setState(t)),c(L.useKitchen.getState(),a)&&(await(0,n.archiveChefCache)('kitchen',L.useKitchen.getState()),L.useKitchen.setState(a)),c(o,u)&&(await(0,n.archiveChefCache)('owner',o),P.useOwner.setState(u)),c(q.useSafety.getState(),l)&&(await(0,n.archiveChefCache)('safety',q.useSafety.getState()),q.useSafety.setState(l));const f=(0,_.stripHrSamples)(_.useHr.getState());c(_.useHr.getState(),f)&&(await(0,n.archiveChefCache)('hr',_.useHr.getState()),_.useHr.setState(f));const p=(0,r.stripGpSamples)(r.useGpCalc.getState());c(r.useGpCalc.getState(),p)&&(await(0,n.archiveChefCache)('gp',r.useGpCalc.getState()),r.useGpCalc.setState(p));const m=M.useOrderSheets.getState(),g={sheets:{...m.sheets,anchorage:(m.sheets.anchorage||[]).filter(e=>!('os-veg'===e.id&&e.placeholder))}};c(m,g)&&(await(0,n.archiveChefCache)('order-sheets',m),M.useOrderSheets.setState(g));const S=N.useCardStore.getState(),h={cards:S.cards.filter(e=>!(0,s.isLiveVenue)(e.restaurantId)||!(0,d.isDemoCard)(e)),log:S.log.filter(e=>!(0,d.demoActor)(e.by))};return c(S,h)&&(await(0,n.archiveChefCache)('recipe-cards',S),N.useCardStore.setState(h)),void await k.kv.set(pa+e,!0)}const t=t=>t.restaurantId===e&&!(0,$.isUuid)(t.id);U.useStore.setState(a=>({bookings:a.bookings.filter(e=>!t(e)),orders:a.orders.filter(e=>!t(e)),waitlist:a.waitlist.filter(t=>t.restaurantId!==e),walkIns:Object.fromEntries(Object.entries(a.walkIns).filter(([t])=>!t.includes(e)))})),E.useBlocks.setState(t=>({blocks:t.blocks.filter(t=>t.rid!==e||(0,$.isUuid)(t.id))})),C.useFloor.setState(t=>({live:{...t.live,[e]:{}}})),P.useOwner.setState(e=>({shifts:e.shifts.filter(e=>(0,$.isUuid)(e.id)),attendance:e.attendance.filter(e=>(0,$.isUuid)(e.id)),timeRequests:e.timeRequests.filter(e=>(0,$.isUuid)(e.id)),leave:[],swaps:[]}));try{L.useKitchen.setState(e=>(0,L.stripKitchenExamples)(e))}catch{}P.useOwner.setState(e=>({suppliers:e.suppliers.filter(e=>(0,$.isUuid)(e.id)),supplierOrders:e.supplierOrders.filter(e=>(0,$.isUuid)(e.id)&&(0,$.isUuid)(e.supplierId))}));try{q.useSafety.setState(e=>({accidents:e.accidents.filter(e=>{return!String(e.id).startsWith('acc-ex')&&(t=e,!JSON.stringify(t).includes('(example)'));var t})}))}catch{}await k.kv.set(pa+e,!0)}const va=(e,t)=>ve({name:e,stage:t.stage||void 0,dirty:t.dirty||void 0,blocked:t.blocked||void 0,note:t.note||void 0});function ba(e){return{name:'floor_live',table:'floor_live',conflict:'venue_id,table_name',list:()=>Object.entries(C.useFloor.getState().live[e]??{}).map(([e,t])=>va(e,t)),key:e=>e.name,rowKey:e=>String(e.table_name),syncable:e=>e.name.length>0&&e.name.length<=20,writable:()=>'staff'===re.getState().kind||de('device.write'),deletes:!1,matchKey:e=>({table_name:e}),toRow:(e,t)=>({venue_id:t,table_name:e.name,stage:e.stage??null,dirty:!!e.dirty,blocked:!!e.blocked,note:e.note?e.note.slice(0,200):null,updated_by:re.getState().staffRef??le}),fromRow:e=>va(String(e.table_name),{stage:e.stage??void 0,dirty:!!e.dirty,blocked:!!e.blocked,note:e.note??void 0}),apply:(t,a)=>C.useFloor.setState(s=>{const i={...s.live[e]??{}};for(const e of t){const{name:t,...a}=e;i[t]=a}for(const e of a)delete i[e];return{live:{...s.live,[e]:i}}}),subscribe:e=>C.useFloor.subscribe((t,a)=>{t.live!==a.live&&e()})}}function ka(e){return{name:'pay_grades',table:'pay_grades',conflict:'venue_id,grade_id',list:()=>(x.useSetup.getState().sites[e]?.grades??x.DEFAULT_GRADES).map((e,t)=>({id:e.id,name:e.name,pence:e.pence,sort:t})),key:e=>e.id,rowKey:e=>String(e.grade_id),syncable:e=>!!e.id&&!!e.name,writable:()=>de('wages.manage'),matchKey:e=>({grade_id:e}),toRow:(e,t)=>({venue_id:t,grade_id:e.id,name:e.name.slice(0,60),pence:Math.max(0,Math.min(1e5,Math.round(e.pence))),sort:e.sort}),fromRow:e=>({id:String(e.grade_id),name:String(e.name),pence:Number(e.pence),sort:Number(e.sort??0)}),apply:(t,a)=>{if(!t.length&&!a.length)return;const s=x.useSetup.getState().sites[e]?.grades??[],i=new Map(s.map((e,t)=>[e.id,{...e,sort:t}]));for(const e of t)i.set(e.id,e);for(const e of a)i.delete(e);const n=[...i.values()].sort((e,t)=>e.sort-t.sort).map(e=>({id:e.id,name:e.name,pence:e.pence}));x.useSetup.getState().patch(e,{grades:n})},subscribe:t=>x.useSetup.subscribe((a,s)=>{a.sites[e]?.grades!==s.sites[e]?.grades&&t()})}}const Ia='staff-avatars',Oa=new Map;let Ra=!1;const Aa=e=>new Promise((t,a)=>{const s=new FileReader;s.onload=()=>t(String(s.result)),s.onerror=a,s.readAsDataURL(e)});async function Ua(){if(!Ra){Ra=!0;try{for(const[e,t]of Oa){const a=K.useAvatars.getState().photos[e];if(!t){a?.path&&K.useAvatars.setState(t=>{const a={...t.photos};return delete a[e],{photos:a}});continue}if(a?.path===t)continue;if(a&&!a.path&&e===re.getState().staffRef)continue;const{data:s,error:i}=await ne().storage.from(Ia).download(t);if(i||!s)continue;const n=await Aa(s);n.startsWith('data:image/')&&K.useAvatars.setState(a=>({photos:{...a.photos,[e]:{dataUrl:n,at:(new Date).toISOString(),path:t}}}))}}catch{}finally{Ra=!1}}}function Da(e){const t=async()=>{const t=re.getState().staffRef,a=t?Be.get(t)??re.getState().staffUuid:void 0;if(!t||!a||'staff'!==re.getState().kind)return;const s=K.useAvatars.getState().photos[t];try{const i=Oa.get(t),n=t=>{t&&t.startsWith(`${e}/${a}-`)&&ne().storage.from(Ia).remove([t]).catch(()=>{})};if(!s)return void(i&&(await Yt('set_staff_avatar',{p_staff_ref:t,p_path:null}),Oa.set(t,null),n(i)));if(s.path)return;const r=await(await fetch(s.dataUrl)).blob();if(r.size>512e3)return void oe({lastError:'Avatar: picture too large to share'});const o='image/jpeg'===r.type?'jpg':'image/webp'===r.type?'webp':'png',d=`${e}/${a}-${Date.now().toString(36)}.${o}`,{error:u}=await ne().storage.from(Ia).upload(d,r,{upsert:!1,contentType:r.type||'image/png'});if(u)throw u;await Yt('set_staff_avatar',{p_staff_ref:t,p_path:d}),Oa.set(t,d),i!==d&&n(i),K.useAvatars.setState(e=>e.photos[t]?.dataUrl===s.dataUrl?{photos:{...e.photos,[t]:{...s,path:d}}}:e)}catch(e){oe({lastError:`Avatar: ${String(e?.message??e)}`})}},a={photos:K.useAvatars.getState().photos},s=K.useAvatars.subscribe(e=>{const s=a.photos;if(a.photos=e.photos,t(),de('staff.manage'))for(const t of Object.keys(s))if(!e.photos[t]&&s[t]?.path&&t!==re.getState().staffRef){const e=s[t].path;Oa.set(t,null),Yt('set_staff_avatar',{p_staff_ref:t,p_path:null}).then(()=>ne().storage.from(Ia).remove([e])).catch(()=>{})}});return t(),s}const Ea=new Map,Ca=(0,y.create)(()=>({n:0}))},820,{"0":5,"1":6,"2":1127,"3":833,"4":1128,"5":1131,"6":1147,"7":856,"8":1023,"9":987,"10":995,"11":946,"12":811,"13":1149,"14":1108,"15":858,"16":1150,"17":956,"18":1107,"19":951,"20":862,"21":1095,"22":1196,"23":1195,"24":1197,"25":1199,"26":1094,"27":1091,"28":870,"29":806,"30":824,"31":825,"32":1025,"33":1093,"34":1026,"35":1200,"36":1201,"37":1202,"38":1104,"39":854,"40":1032,"41":955,"42":1092,"43":1003,"44":1205,"45":1206,"46":2,"47":1207,"48":1105,"49":1106,"50":1208,"51":1117,"52":922,"53":917,"54":941,"55":1118,"56":1103,"57":944,"58":1016,"59":28,"paths":{}}); +__d(function(_g,_r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"colours",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"fonts",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"font",{enumerable:!0,get:function(){return F}}),Object.defineProperty(e,"radius",{enumerable:!0,get:function(){return A}}),e.brandColour=function(I,S=n.gold){const r=/^#([0-9a-f]{6})$/i.exec(I??'');if(!r)return S;const _=parseInt(r[1],16),t=(_>>16)/255,E=(_>>8&255)/255,o=(255&_)/255,F=Math.max(t,E,o),A=Math.min(t,E,o),l=F-A;if(l<.12)return I;const D=F===t?((E-o)/l+6)%6*60:F===E?60*((o-t)/l+2):60*((t-E)/l+4);return D>65&&D<320?S:I};var I=_r(_d[0]),S=_r(_d[1]),r=_r(_d[2]),_=_r(_d[3]),t=_r(_d[4]),E=_r(_d[5]);const n={bg:I.IS_SOUTERS?'#56152A':I.IS_WILDINGS?'#272A2F':'#0B0B0B',surface:I.IS_SOUTERS?'#43122F':I.IS_WILDINGS?'#30343B':'#141414',surface2:I.IS_SOUTERS?'#43122F':I.IS_WILDINGS?'#363A42':'#1D1C1A',border:I.IS_SOUTERS?'#87435B':I.IS_WILDINGS?'#50545C':'#34302A',gold:I.IS_WILDINGS?'#FFE3A5':I.IS_KIRKMICHAEL?'#B87754':I.IS_SOUTERS?'#A4622E':'#CFA45F',goldLight:I.IS_WILDINGS?'#FFF0CF':I.IS_KIRKMICHAEL?'#D8AF95':I.IS_SOUTERS?'#D9AD8A':'#E2C489',goldTint:I.IS_WILDINGS?'#39352C':I.IS_KIRKMICHAEL?'#2C211B':I.IS_SOUTERS?'#43122F':'#2A2216',goldMuted:I.IS_WILDINGS?'#DDC694':I.IS_KIRKMICHAEL?'#C2937A':I.IS_SOUTERS?'#C18F67':'#BFA06C',hairline:'rgba(255,255,255,0.09)',tile:I.IS_SOUTERS?'#43122F':I.IS_WILDINGS?'#30343B':'#18171A',tilePressed:I.IS_SOUTERS?'#64223B':I.IS_WILDINGS?'#393D45':'#211F1C',accentBg:I.IS_WILDINGS?'rgba(255,227,165,0.13)':I.IS_KIRKMICHAEL?'rgba(184,119,84,0.13)':I.IS_SOUTERS?'rgba(164,98,46,0.13)':'rgba(207,164,95,0.13)',accentBorder:I.IS_WILDINGS?'rgba(255,227,165,0.38)':I.IS_KIRKMICHAEL?'rgba(184,119,84,0.38)':I.IS_SOUTERS?'rgba(164,98,46,0.38)':'rgba(207,164,95,0.38)',text:'#F5F1E8',muted:'#B8B0A0',onGold:I.IS_WILDINGS?'#272A2F':I.IS_KIRKMICHAEL?'#0B0B0B':I.IS_SOUTERS?'#FFFFFF':'#0B0B0B',red:'#FF6B5E',redBg:'#4A1310',redSolid:'#C62F22',amber:'#FFB547',amberBg:'#3F2C05',ok:I.IS_WILDINGS?'#FFF0CF':I.IS_KIRKMICHAEL?'#D8AF95':I.IS_SOUTERS?'#D9AD8A':'#E2C489',okBg:I.IS_WILDINGS?'#39352C':I.IS_KIRKMICHAEL?'#2C211B':I.IS_SOUTERS?'#43122F':'#2A2216',blue:I.IS_WILDINGS?'#FFF0CF':I.IS_KIRKMICHAEL?'#D8AF95':I.IS_SOUTERS?'#D9AD8A':'#E2C489',blueBg:I.IS_SOUTERS?'#43122F':I.IS_WILDINGS?'#39352C':'#1E1A12',...I.IS_GREENSIDE?r.GREENSIDE_PALETTE:{},...I.IS_QUEUED_VENUE?S.QUEUED_PALETTE:{},...I.IS_KIRKTON?t.KIRKTON_PALETTE:{},...I.IS_ABBOTSFORD?_.ABBOTSFORD_PALETTE:{}},o={regular:'Poppins_400Regular',medium:'Poppins_500Medium',semibold:'Poppins_600SemiBold',bold:'Poppins_700Bold'},F={small:E.type.small,body:E.type.body,large:E.type.large,title:E.type.title,hero:E.type.hero},A={s:E.radii.s,m:E.radii.m,l:E.radii.l}},821,[5,1232,1203,1233,1234,1235]); +__d(function(g,r,i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.waNumber=o,_e.waMeLink=function(e,t){const n=o(e);return n?t?`https://wa.me/${n}?text=${encodeURIComponent(t)}`:`https://wa.me/${n}`:null},Object.defineProperty(_e,"guestWhatsAppText",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"staffWhatsAppTexts",{enumerable:!0,get:function(){return p}}),_e.openWhatsApp=async function(e){try{return await n.default.openURL(e),!0}catch{return!1}};var e,t=r(_d[0]),n=(e=t)&&e.__esModule?e:{default:e};function o(e,t="44"){if(!e)return null;let n=String(e).trim().replace(/[\s().\-]/g,'');return n.startsWith('+')?n=n.slice(1):n.startsWith('00')?n=n.slice(2):n.startsWith('0')&&(n=t+n.slice(1)),n=n.replace(/^440/,'44'),/^[1-9][0-9]{6,14}$/.test(n)?n:null}const s=e=>{const[t,n,o]=e.split('-').map(Number);return new Date(t,n-1,o).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long',year:'numeric'})},u=e=>{const[t,n,o]=e.split('-').map(Number);return new Date(t,n-1,o).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'})},c=e=>e.slice(0,5),l=e=>e.replace(' (example)','').trim().split(/\s+/)[0]||'there',m=(e,t)=>`Hi ${t}, it's ${e.name.trim()} about my booking${e.ref?` ${e.ref}`:''}: ${s(e.date)} at ${c(e.time)}, table for ${e.partySize}. `,p=(e,t,n)=>({confirm:`Hi ${l(e.name)}, it's ${t}${n?` in ${n}`:''}. Just confirming your table for ${e.partySize} on ${u(e.date)} at ${c(e.time)}${e.ref?` (ref ${e.ref})`:''}. Any questions, just reply here.`,change:`Hi ${l(e.name)}, it's ${t} about your booking on ${u(e.date)} at ${c(e.time)}. `})},822,[239]); +__d(function(g,_r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.templatesFor=function(t){const n={...r.DEFAULT_TEMPLATES};for(const o of Object.keys(r.DEFAULT_TEMPLATES))n[o]={...r.DEFAULT_TEMPLATES[o],...t?.[o]??{}};return n},e.composeBooking=function(t,n,o,c,u){if(n.walkIn)return[];return s(t,'booking-confirmation'===t?'booking':'booking-request'===t?'request':'declined',(0,r.bookingVars)(n,o),{phone:n.phone,email:n.email,name:n.name},{refType:'booking',refId:n.id,ref:n.ref},o,c,u)},e.composeOrder=function(t,n,o,c){return'takeaway'!==t.type?[]:s('order-confirmation','order',(0,r.orderVars)(t,n),{phone:t.phone,email:t.email,name:t.customerName},{refType:'order',refId:t.id,ref:t.ref},n,o,c)},e.deliverQueued=async function(r,n){if(!(0,t.isLive)())return;const o=(0,t.activeProvider)();for(const t of r){const r=await o.deliver(t);n(t.id,r.ok?{status:'sent'}:{status:'failed',error:r.error})}},e.statusLabel=function(t){const r='sms'===t.channel?'Text':'Email';return'preview'===t.status?`${r}: Ready (preview mode)`:'queued'===t.status?`${r}: Sending\u2026`:'sent'===t.status?`${r} sent`:`${r}: Not sent (failed)`},Object.defineProperty(e,"PREVIEW_BANNER",{enumerable:!0,get:function(){return c}});var t=_r(d[0]);Object.keys(t).forEach(function(r){'default'===r||Object.prototype.hasOwnProperty.call(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[r]}})});var r=_r(d[1]);Object.keys(r).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return r[t]}})});var n=_r(d[2]);Object.keys(n).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})});const o=()=>`msg-${Math.random().toString(36).slice(2,8)}${Date.now().toString(36).slice(-4)}`;function s(s,c,u,l,f,m,p,b){const y=[],v=(0,t.isLive)()?'queued':'preview',h=(0,t.activeProvider)().id,k=(0,n.ukPhone)(l.phone);if(k.ok&&y.push({id:o(),restaurantId:m.id,at:b,channel:'sms',kind:s,to:k.pretty,toName:l.name,body:(0,r.toGsm)((0,r.fill)(p[c].sms,u.sms)),...f,status:v,provider:h}),l.email?.trim()){const t=(0,r.fillEmailText)(p[c].body,u.email),n=(0,r.fill)(p[c].subject,u.email);y.push({id:o(),restaurantId:m.id,at:b,channel:'email',kind:s,to:l.email.trim(),toName:l.name,subject:n,body:t,html:(0,r.emailHtml)(t,{venue:m.name,preheader:n}),...f,status:v,provider:h})}return y}const c='Preview mode, not sent yet. Connect a text and email service to go live.'},823,[1137,1138,1139]); +__d(function(g,r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"BLOCK_REASONS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"useBlocks",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"venueWide",{enumerable:!0,get:function(){return f}}),_e.blockedTablesAt=m,Object.defineProperty(_e,"blocksOn",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"areaBlocksOn",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"tableKey",{enumerable:!0,get:function(){return p}}),_e.closedAreasAt=function(e,t,o,n){const s=(0,l.toMins)(n),a=v(e,t,o).filter(e=>s>=(0,l.toMins)(e.from)&&s<(0,l.toMins)(e.to)).map(e=>e.areaId);return new Set([...a,...[...m(e,t,o,n)].map(p)])},_e.blockAt=M,_e.currentBlocks=function(e,t,o,n){return e.filter(e=>e.rid===t&&!e.removedAt&&(e.date>o||e.date===o&&(0,l.toMins)(e.to)>(0,l.toMins)(n))).sort((e,t)=>e.date===t.date?(0,l.toMins)(e.from)-(0,l.toMins)(t.from):e.date({blocks:[],removed:[],add:t=>{const o={...t,id:(0,s.uuid)(),createdAt:(new Date).toISOString(),source:'covercharge'};return e(e=>({blocks:[...e.blocks,o]})),o},addMany:t=>{const o=(new Date).toISOString(),n=t.map(e=>({...e,id:(0,s.uuid)(),createdAt:o,source:'covercharge'}));return e(e=>({blocks:[...e.blocks,...n]})),n},update:(t,o,n)=>e(e=>({blocks:e.blocks.map(e=>e.id===t?{...e,...o,id:t,editedAt:(new Date).toISOString(),editedBy:n}:e)})),remove:(t,o)=>e(e=>{const n=e.blocks.find(e=>e.id===t);return n?{blocks:e.blocks.filter(e=>e.id!==t),removed:[...e.removed,{...n,removedAt:(new Date).toISOString(),removedBy:o??n.by}]}:e}),put:t=>e(e=>{const o=e.blocks.filter(e=>e.id!==t.id),n=e.removed.filter(e=>e.id!==t.id);return t.removedAt?{blocks:o,removed:[...n,t]}:{blocks:[...o,t],removed:n}})}),{name:'covercharge-blocks-v1',storage:(0,c.createJSONStorage)(()=>n.default),version:2,migrate:e=>{const t=e??{};return{blocks:t.blocks??[],removed:t.removed??[]}}})),f=e=>!e.areaId&&!e.tables?.length;function m(e,t,o,n){const s=(0,l.toMins)(n);return new Set(e.filter(e=>e.rid===t&&e.date===o&&!e.removedAt&&e.tables?.length&&s>=(0,l.toMins)(e.from)&&s<(0,l.toMins)(e.to)).flatMap(e=>e.tables))}const k=(e,t,o)=>e.filter(e=>e.rid===t&&e.date===o&&!e.removedAt&&f(e)).sort((e,t)=>(0,l.toMins)(e.from)-(0,l.toMins)(t.from)),v=(e,t,o)=>e.filter(e=>e.rid===t&&e.date===o&&!e.removedAt&&!!e.areaId).sort((e,t)=>(0,l.toMins)(e.from)-(0,l.toMins)(t.from)),p=e=>`tbl:${e}`;function M(e,t,o,n){const s=(0,l.toMins)(n);return k(e,t,o).find(e=>s>=(0,l.toMins)(e.from)&&s<(0,l.toMins)(e.to))}const O=(e,t,o,n)=>M(e,t,o,n),y=e=>e.tables?.length?`${e.tables.map(t.tableNumbers).join(', ')} blocked until ${e.to}${e.reason?` \xb7 ${e.reason}`:''}`:e.areaId?`${e.areaName??'Area'} closed until ${e.to}${e.reason?` \xb7 ${e.reason}`:''}`:`Bookings paused until ${e.to}${e.reason?` \xb7 ${e.reason}`:''}`,A=(e,t)=>{const o=b(e=>e.blocks);return k(o,e,t)}},824,[808,1115,1032,951,1116,818]); +__d(function(g,r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEFAULT_SETTINGS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"seedPlan",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"useFloor",{enumerable:!0,get:function(){return p}}),_e.hashOldPins=f,Object.defineProperty(_e,"usePlan",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"useDisplaySettings",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"planOf",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"tablesOf",{enumerable:!0,get:function(){return j}}),_e.tablesLabel=function(e){const n=j((0,t.tableNumbers)(e));if(!n.length)return'';if(1===n.length)return n[0];const a=n.map(e=>/^\d+$/.test(e)?Number(e):NaN),s=a.every(e=>!Number.isNaN(e))?[...n].sort((e,n)=>Number(e)-Number(n)):n;return a.every(e=>!Number.isNaN(e))&&s.length>=3&&s.every((e,n)=>0===n||Number(e)===Number(s[n-1])+1)?`${s[0]}\u2013${s[s.length-1]}`:s.join(' + ')},Object.defineProperty(_e,"joinTables",{enumerable:!0,get:function(){return v}});var e,n=r(d[0]),t=r(d[1]),a=r(d[2]),s=(e=a)&&e.__esModule?e:{default:e},i=r(d[3]),l=r(d[4]),o=r(d[5]),c=r(d[6]);Object.keys(c).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return c[e]}})});const u={privacy:!0,idleMins:2,pinOn:!1,...i.DEFAULT_WAKE,tonightCards:!0},b=e=>'souters'===e||n.IS_ISOLATED_VENUE&&'souters'===n.VENUE_RID?{areas:[{id:'su-restaurant',name:'Restaurant'},{id:'su-bar',name:'Bar'},{id:'su-mezzanine',name:'Mezzanine / private dining'},{id:'su-garden',name:'Beer garden',outdoor:!0},{id:'su-icecream',name:'Ice cream & cake corner'}],tables:[],joins:[],sections:[],fixtures:[]}:'kirkmichael'===e||n.IS_ISOLATED_VENUE&&'kirkmichael'===n.VENUE_RID?{areas:[{id:'km-restaurant',name:'Restaurant'},{id:'km-bar',name:'Bar'},{id:'km-private',name:'Private dining',label:'The Room (about 18 covers) \u2014 table plan to confirm'}],tables:[],joins:[],sections:[],fixtures:[]}:['wildings','greenside'].includes(e)||n.IS_ISOLATED_VENUE?{areas:[],tables:[],joins:[],sections:[],fixtures:[]}:'anchorage'===e?(0,c.anchoragePlan)():(0,c.starterPlan)(),p=(0,l.create)()((0,o.persist)((e,t)=>{const a=e=>t().plans[e]??b(e);return{plans:n.IS_ISOLATED_VENUE?{[n.VENUE_RID]:b(n.VENUE_RID)}:{anchorage:(0,c.anchoragePlan)()},live:{},settings:{},smsLog:[],setPlan:(n,t)=>e(e=>({plans:{...e.plans,[n]:t}})),updateTable:(n,t,s)=>{const i=a(n);e(e=>({plans:{...e.plans,[n]:{...i,tables:i.tables.map(e=>e.id===t?{...e,...s}:e)}}}))},addTable:(n,t)=>{const s=a(n);e(e=>({plans:{...e.plans,[n]:{...s,tables:[...s.tables,t]}}}))},removeTable:(n,t)=>{const s=a(n),i=s.tables.find(e=>e.id===t);e(e=>({plans:{...e.plans,[n]:{...s,tables:s.tables.filter(e=>e.id!==t),joins:s.joins.filter(e=>!i||!e.tables.includes(i.name))}}}))},setLive:(n,t,a)=>e(e=>({live:{...e.live,[n]:{...e.live[n]??{},[t]:{...e.live[n]?.[t]??{},...a}}}})),setSettings:(n,t)=>e(e=>({settings:{...e.settings,[n]:{...u,...e.settings[n]??{},...t}}})),logSms:(n,t,a)=>e(e=>{return{smsLog:[{id:(s='sms',`${s}-${Date.now().toString(36)}${Math.random().toString(36).slice(2,6)}`),rid:n,at:t,text:a},...e.smsLog].slice(0,50)};var s}),resetPlan:n=>e(e=>({plans:{...e.plans,[n]:b(n)}}))}},{name:'covercharge-floor-v1',version:6,storage:(0,o.createJSONStorage)(()=>s.default),migrate:(e,n)=>{const t=e??{};let a=t;if(n<2){const e={};for(const[n,a]of Object.entries(t.plans??{}))e[n]='anchorage'===n?(0,c.anchoragePlan)():(0,c.normalisePlan)(a);e.anchorage=(0,c.anchoragePlan)(),a={...t,plans:e,live:{}}}else if(n<3)a={...t,plans:{...t.plans??{},anchorage:(0,c.anchoragePlan)()}};else if(n<4){const e=t.plans?.anchorage;e&&(a={...t,plans:{...t.plans,anchorage:{...e,joins:(e.joins??[]).filter(e=>!(2===e.tables.length&&e.tables.includes('1')&&e.tables.includes('2')))}}})}return n<5&&(a={...a,settings:f(a.settings)}),n<6&&a.plans?.anchorage&&(a={...a,plans:{...a.plans,anchorage:(0,c.withSeedBest)('anchorage',a.plans.anchorage)}}),a}}));function f(e){const n={};for(const[t,a]of Object.entries(e??{})){const{pin:e,...s}=a??{};n[t]={...u,...s,...'pinHash'in s?{}:(0,i.fromOldPin)(e)}}return n}const h=e=>p(n=>n.plans[e])??E(e),N={};function E(e){return N[e]??=b(e)}const O=e=>{const n=p(n=>n.settings[e]);return n?{...u,...n}:u},P=e=>p.getState().plans[e]??E(e),j=e=>e?e.split('+').map(e=>e.trim()).filter(Boolean):[];const v=e=>[...new Set(e)].sort((e,n)=>/^\d+$/.test(e)&&/^\d+$/.test(n)?Number(e)-Number(n):e.localeCompare(n)).join('+')},825,[5,808,1115,945,951,1116,944]); +__d(function(_g,r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"STATUS",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"STAGE_LABEL",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"STAGES",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"turnFor",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"startOf",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"durOf",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"endOf",{enumerable:!0,get:function(){return f}}),e.clashes=function(a,s=90){const n=new Set,l=a.filter(t=>g(t)&&t.table);for(let a=0;a(0,t.tablesOf)(d.table).includes(a))&&(u(o)t.date===n&&!['cancelled','noshow'].includes(t.status)).sort((t,a)=>t.time.localeCompare(a.time));for(const s of a.tables){const a=i.filter(a=>(0,t.tablesOf)(a.table).includes(s.name)),n=a[0],o=(0,t.tablesOf)(n?.table);l[s.name]={table:s,status:n?'soon':'free',next:n,covers:n?.partySize??0,dayBookings:a.length?a:void 0,group:o.length>1?o:void 0,allergy:!(!n?.allergies?.length&&!n?.allergyNote),vip:n?.tags?.find(t=>'VIP'===t)??n?.tags?.find(t=>'Regular'===t),occasion:n?.occasion??h(n?.notes)}}return l},e.floorView=function(a,n,l,i,o,d=90,c){const b={},g=n.filter(t=>t.date===O(o));for(const n of a.tables){const a=i[n.name]??{},y=g.filter(a=>(0,t.tablesOf)(a.table).includes(n.name)),O=y.find(t=>'seated'===(0,s.shownStatus)(t)),v=y.filter(t=>'confirmed'===t.status).sort((t,a)=>t.time.localeCompare(a.time)).find(t=>S(o,t)>=-20),T=v?Math.round(S(o,v)):void 0,w=O?void 0:p(y,o,d),F=l.find(t=>'table'===t.type&&t.tableNo===n.name&&!['closed','cancelled','collected'].includes(t.status));let j='free';a.blocked?j='blocked':O?j=a.stage??'seated':!c?.has(n.areaId)&&!c?.has(`tbl:${n.name}`)||F?a.dirty?j='dirty':F?j=a.stage??'seated':v&&void 0!==T&&T<=45&&(j='soon'):j='blocked';const A=O,P=A?.tags?.find(t=>'VIP'===t)??A?.tags?.find(t=>'Regular'===t)??(A?void 0:v?.tags?.[0]);b[n.name]={table:n,status:j,booking:A,next:v,due:w,nextIn:T,covers:A?.partySize??0,group:(()=>{const a=(0,t.tablesOf)((A??('soon'===j?v:void 0))?.table);return a.length>1?a:void 0})(),orderOnly:!A&&!!F,note:a.note,seatedMins:A?Math.max(0,Math.round((o.getTime()-u(A).getTime())/6e4)):void 0,freeAt:A?f(A,d):void 0,allergy:!!(A?.allergies?.length||A?.allergyNote||!A&&(v?.allergies?.length||v?.allergyNote)||F?.allergies?.length),vip:P,occasion:A?.occasion??(A?void 0:v?.occasion??h(v?.notes))??h(A?.notes)}}return b},e.dueOnTable=p,Object.defineProperty(e,"OCCASION_ICON",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"tableAllowed",{enumerable:!0,get:function(){return v}}),e.suggestTable=function(s,n,l,i,o,d,c=90,b,p){const h=[...s.tables.map(t=>({name:t.name,seats:t.maxSeats,min:t.minSeats,parts:[t.name]})),...s.joins.map(t=>{const a=s.tables.filter(a=>t.tables.includes(a.name));return{name:t.tables.join('+'),seats:a.reduce((t,a)=>t+a.maxSeats,0),min:a.reduce((t,a)=>t+a.minSeats,0),parts:t.tables}})].filter(t=>t.parts.every(t=>v(s,t,p))),y=o.getTime()+6e4*d,S=new Set((0,a.bestTables)(s));let O=null;for(const a of h){if(a.seats['blocked'].includes(l[t]?.status)))continue;const s=!!l&&a.parts.some(t=>['seated','mains','dessert','bill','dirty'].includes(l[t]?.status)),d=n.filter(s=>s.id!==b&&g(s)&&(0,t.tablesOf)(s.table).some(t=>a.parts.includes(t))&&u(s).getTime()o.getTime()).length,p=1===a.parts.length&&S.has(a.parts[0])?12:0,h=(s?1e3:0)+100*d+10*(a.seats-i)+(i({name:t.name,seats:t.maxSeats,parts:[t.name]})),...s.joins.map(t=>({name:t.tables.join('+'),seats:s.tables.filter(a=>t.tables.includes(a.name)).reduce((t,a)=>t+a.maxSeats,0),parts:t.tables}))].filter(t=>t.seats>=l&&t.parts.every(t=>v(s,t,c))).filter(a=>!n.some(s=>s.id!==b&&g(s)&&(0,t.tablesOf)(s.table).some(t=>a.parts.includes(t))&&u(s).getTime()i.getTime())),y=new Set((0,a.bestTables)(s)),S=t=>1===t.parts.length&&y.has(t.parts[0])?0:1;return h.sort((t,a)=>t.seats-a.seats||t.parts.length-a.parts.length||S(t)-S(a)).map(t=>({table:t.name,seats:t.seats,area:s.areas.find(a=>a.id===s.tables.find(a=>a.name===t.parts[0])?.areaId)?.name??''}))};var t=r(_d[0]),a=r(_d[1]),s=r(_d[2]);const n={colour:'#3A2F1E',fg:'#F1DDB0'},l={colour:'#CFA45F',fg:'#0B0B0B'},i={free:{label:'Free',...n},soon:{label:'Free',...n},seated:{label:'Seated',...l},mains:{label:'Seated',...l},dessert:{label:'Seated',...l},bill:{label:'Seated',...l},dirty:{label:'Needs clearing',colour:'#6E6555',fg:'#FFFFFF'},blocked:{label:'Blocked',...n}},o={seated:'Seated',mains:'Mains',dessert:'Dessert',bill:'Bill requested'},d=['seated','mains','dessert','bill'],c=(t,a=90)=>Math.min(a+60,a+15*Math.max(0,Math.ceil((t-2)/2))),u=t=>'seated'===(0,s.shownStatus)(t)&&t.seatedAt?new Date(t.seatedAt):new Date(`${t.date}T${t.time}:00`),b=(t,a=90)=>t.durationMins??c(t.partySize,a),f=(t,a=90)=>new Date(u(t).getTime()+6e4*b(t,a)),g=t=>!['cancelled','noshow','finished'].includes(t.status);function p(t,a,s=90){return t.filter(t=>'confirmed'===t.status&&S(a,t)<=45&&-S(a,t)t.time.localeCompare(a.time))[0]}const h=t=>t?/birthday/i.test(t)?'birthday':/anniversary/i.test(t)?'anniversary':void 0:void 0,y={birthday:'\ud83c\udf82',anniversary:'\ud83d\udc9d',celebration:'\ud83e\udd42'},S=(t,a)=>(new Date(`${a.date}T${a.time}:00`).getTime()-t.getTime())/6e4,O=t=>`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`,v=(t,a,s)=>{const n=t.tables.find(t=>t.name===a);if(!n)return!1;const l=t.areas.find(t=>t.id===n.areaId);return!(s?.dog&&!(void 0!==n.dogOk?n.dogOk:l?.dogs))&&(!s?.closed?.has(n.areaId)&&!s?.closed?.has(`tbl:${n.name}`))}},826,[825,944,828]); +__d(function(g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"emptyNeeds",{enumerable:!0,get:function(){return w}}),_e.needsMissing=function(e,l=[]){const s=[];null===e.allergy?s.push('Answer the allergy question first'):'yes'!==e.allergy||e.allergens.length||l.length||e.allergyNote.trim()||s.push('Pick the allergens or describe them');null===e.dog&&s.push('Say whether a dog is coming');return s},_e.needsPatch=function(e,l=[]){const s='yes'===e.allergy?e.allergens.filter(e=>!l.some(l=>l.allergen===e)).map(l=>({allergen:l,severity:e.severity})):[],t=Object.entries(e.holds).filter(([,e])=>e>0).map(([e,l])=>({kind:e.startsWith('item:')?'item':'stock',id:e.slice(5),qty:l})),a=e.dog?Math.max(1,e.dogs):0,n={...e.wheelchair?{wheelchair:e.wheelchair}:{},...e.stepFree?{stepFree:!0}:{},...e.toilet?{toilet:!0}:{},...e.assistDog?{assistDog:!0}:{},...e.accessNote.trim()?{note:e.accessNote.trim()}:{}},r={...e.vegan?{vegan:e.vegan}:{},...e.vegetarian?{vegetarian:e.vegetarian}:{}};return{allergies:[...l,...s],allergyNone:'none'===e.allergy&&!l.length||void 0,allergyPeople:'yes'===e.allergy?e.allergyPeople:void 0,allergyNote:'yes'===e.allergy&&e.allergyNote.trim()?e.allergyNote.trim():void 0,dog:a>0,dogs:a||void 0,access:Object.keys(n).length?n:void 0,diet:Object.keys(r).length?r:void 0,holds:t.length?t:void 0,tableReq:e.tableReq.length?e.tableReq:void 0}},_e.FirstQuestions=function({rid:e,value:l,onChange:a,party:r,audience:i,profile:o=[]}){const p=e=>a({...l,...e}),b=(0,y.usePlan)(e),[x,j]=(0,t.useState)(!1),k=(0,s.dogQuestionOn)((0,u.useRestaurant)(e));(0,t.useEffect)(()=>{k||null!==l.dog||a({...l,dog:!1})},[k,l.dog]);const w=x?m.ALLERGENS:m.ALLERGENS.filter(e=>['gluten','milk','peanuts','treenuts','crustaceans','molluscs','fish','eggs','sesame'].includes(e.id)||l.allergens.includes(e.id)),M=[...o.map(e=>e.allergen),...l.allergens],q=(0,f.dogSetUp)(b);return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)(R,{tone:"red",testID:"q-allergens",children:[(0,v.jsx)(C,{sub:'guest'===i?'We ask everyone first, so the kitchen can keep you safe.':'Ask every guest first. It goes to the kitchen in red.',children:"\u26a0\ufe0f Does anyone in the party have a food allergy?"}),o.length?(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:o.map(e=>(0,v.jsx)(h.Badge,{kind:"red",label:`${m.ALLERGENS.find(l=>l.id===e.allergen)?.short} (from your profile)`},e.allergen))}):null,(0,v.jsxs)(h.Row,{gap:8,children:[(0,v.jsx)(n.default,{style:{flex:1},children:(0,v.jsx)(h.Chip,{label:"No allergies",selected:'none'===l.allergy,onPress:()=>p({allergy:'none',allergens:[]})})}),(0,v.jsx)(n.default,{style:{flex:1},children:(0,v.jsx)(h.Chip,{label:"Yes, allergies",selected:'yes'===l.allergy,onPress:()=>p({allergy:'yes'})})})]}),'none'===l.allergy&&o.length?(0,v.jsx)(h.Muted,{children:"Your profile allergies above are still shared with the kitchen."}):null,'yes'===l.allergy?(0,v.jsxs)(n.default,{style:{gap:10},testID:"allergen-picker",children:[(0,v.jsx)(h.T,{size:14,weight:"semibold",children:"Which allergens? (the 14 UK allergens)"}),(0,v.jsxs)(h.Row,{wrap:!0,gap:6,children:[w.map(e=>(0,v.jsx)(h.Chip,{label:e.short,selected:l.allergens.includes(e.id)||o.some(l=>l.allergen===e.id),disabled:o.some(l=>l.allergen===e.id),onPress:()=>p({allergens:l.allergens.includes(e.id)?l.allergens.filter(l=>l!==e.id):[...l.allergens,e.id]})},e.id)),x?null:(0,v.jsx)(h.Chip,{label:"All 14\u2026",onPress:()=>j(!0)})]}),(0,v.jsx)(h.T,{size:14,weight:"semibold",children:"How serious?"}),(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:m.SEVERITIES.map(e=>(0,v.jsx)(h.Chip,{label:e.label,selected:l.severity===e.id,onPress:()=>p({severity:e.id})},e.id))}),(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.T,{size:14,children:"How many people with allergies?"}),(0,v.jsx)(h.Stepper,{value:Math.min(l.allergyPeople,r),onChange:e=>p({allergyPeople:e}),min:1,max:Math.max(1,r),label:"people with allergies"})]}),(0,v.jsx)(h.Field,{label:"Anything else the kitchen should know? (optional)",value:l.allergyNote,onChangeText:e=>p({allergyNote:e}),placeholder:"e.g. traces of sesame, one child with coeliac disease",testID:"allergy-note"}),M.length?(0,v.jsx)(c.MenuAllergyCheck,{rid:e,allergens:M,audience:i}):null]}):null]}),k?(0,v.jsxs)(R,{tone:"gold",testID:"q-dogs",children:[(0,v.jsx)(C,{sub:q?'Well-behaved dogs are welcome at our dog-friendly tables.':'staff'===i?'Dog-friendly tables aren\u2019t marked yet (Managers \u203a Booking options), so any table is offered for now.':void 0,children:"\ud83d\udc15 Are you bringing a dog?"}),(0,v.jsxs)(h.Row,{gap:8,children:[(0,v.jsx)(n.default,{style:{flex:1},children:(0,v.jsx)(h.Chip,{label:"No",selected:!1===l.dog,onPress:()=>p({dog:!1})})}),(0,v.jsx)(n.default,{style:{flex:1},children:(0,v.jsx)(h.Chip,{label:"Yes",selected:!0===l.dog,onPress:()=>p({dog:!0,dogs:Math.max(1,l.dogs)})})})]}),l.dog?(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.T,{size:14,children:"How many dogs?"}),(0,v.jsx)(h.Stepper,{value:l.dogs,onChange:e=>p({dogs:e}),min:1,max:4,label:"dogs"})]}):null]}):null]})},_e.useReserveAvailability=M,_e.MoreQuestions=function({rid:e,r:l,value:a,onChange:r,party:i,date:o,time:c,today:p,bookings:m,audience:b,showTables:x}){const j=e=>r({...a,...e}),w=l.settings,S=(0,u.useMenu)(e),P=(0,t.useMemo)(()=>S.filter(e=>/\((V|VG|Ve)\)|vegan|vegetarian/i.test(`${e.name} ${e.tags?.join(' ')??''}`)).slice(0,4),[S.length]),N=M(e,l,o,p,m,b),T=e=>a.holds[e]??0,$=(0,f.stockNeed)({holds:Object.entries(a.holds).map(([e,l])=>({kind:e.startsWith('item:')?'item':'stock',id:e.slice(5),qty:l}))},N.items),D=(e,l)=>Math.min(10,...e.map(e=>{const s=($[e.key]??0)-T(l)*e.qty;return Math.floor(((N.free[e.key]??0)-s)/e.qty)})),A=(e,l,s,t)=>{const r=T(e),i=t<=0&&0===r;return(0,v.jsxs)(n.default,{style:{flexDirection:'row',alignItems:'center',gap:10,opacity:i?.55:1},testID:`reserve-${e.replace(':','-')}`,children:[(0,v.jsxs)(n.default,{style:{flex:1,minWidth:0},children:[(0,v.jsx)(h.T,{weight:"semibold",children:l}),(0,v.jsx)(h.Muted,{children:i?'Unavailable \u2014 none left for this day':s})]}),i?(0,v.jsx)(h.Badge,{kind:"neutral",label:"Unavailable"}):(0,v.jsx)(h.Stepper,{value:r,onChange:l=>j({holds:{...a.holds,[e]:Math.max(0,Math.min(l,Math.max(r,t)))}}),min:0,max:Math.max(r,Math.min(10,t)),label:l})]},e)},I=N.items.length>0||!1!==w.reserveStock&&N.stock.length>0,O=(0,y.usePlan)(e);return(0,v.jsxs)(v.Fragment,{children:[(0,s.accessQuestionOn)(l)?(0,v.jsxs)(R,{tone:"plain",testID:"q-access",children:[(0,v.jsx)(C,{sub:"Optional. Tell us and we\u2019ll have the right table ready.",children:"\u267f Access needs"}),(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.T,{size:14,children:"Wheelchair users"}),(0,v.jsx)(h.Stepper,{value:a.wheelchair,onChange:e=>j({wheelchair:e}),min:0,max:Math.max(1,i),label:"wheelchair users"})]}),(0,v.jsxs)(h.Row,{wrap:!0,gap:6,children:[(0,v.jsx)(h.Chip,{label:"Step-free access",selected:a.stepFree,onPress:()=>j({stepFree:!a.stepFree})}),(0,v.jsx)(h.Chip,{label:"Accessible toilet",selected:a.toilet,onPress:()=>j({toilet:!a.toilet})}),(0,v.jsx)(h.Chip,{label:"Assistance dog",selected:a.assistDog,onPress:()=>j({assistDog:!a.assistDog})})]}),(0,v.jsx)(h.Field,{label:"Anything else? (optional)",value:a.accessNote,onChangeText:e=>j({accessNote:e}),placeholder:"e.g. needs a chair with arms"}),w.accessStatement?.trim()?(0,v.jsx)(h.Muted,{children:w.accessStatement.trim()}):null]}):null,(0,s.dietQuestionOn)(l)?(0,v.jsxs)(R,{tone:"plain",testID:"q-veg",children:[(0,v.jsx)(C,{sub:"We\u2019d love to look after you. Optional.",children:"\u24cb Any vegans or vegetarians?"}),(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.T,{size:14,children:"Vegan"}),(0,v.jsx)(h.Stepper,{value:a.vegan,onChange:e=>j({vegan:e}),min:0,max:Math.max(1,i),label:"vegans"})]}),(0,v.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,v.jsx)(h.T,{size:14,children:"Vegetarian"}),(0,v.jsx)(h.Stepper,{value:a.vegetarian,onChange:e=>j({vegetarian:e}),min:0,max:Math.max(1,i),label:"vegetarians"})]}),!1!==w.vegTeaser&&P.length&&(a.vegan||a.vegetarian)?(0,v.jsxs)(h.Muted,{children:["On the menu: ",P.map(e=>e.name).join(' \xb7 ')]}):null]}):null,I?(0,v.jsxs)(R,{tone:"gold",testID:"q-reserve",children:[(0,v.jsx)(C,{sub:N.known?'Held for you from today\u2019s count.':o>p||'guest'===b?'Held for you; the kitchen confirms and orders in.':void 0,children:"\ud83e\udd9e Reserve with your table"}),N.items.map(e=>A(`item:${e.id}`,`${e.name}${k(e.price)}`,e.description||e.uses.map(e=>`${e.qty} ${N.stock.find(l=>l.key===e.key)?.name.toLowerCase()??e.key}`).join(' + '),D(e.uses,`item:${e.id}`))),!1!==w.reserveStock?N.stock.map(e=>A(`stock:${e.key}`,`Reserve ${e.name.toLowerCase()}`,N.known?`${N.free[e.key]} available today`:'Held for the kitchen to order',D([{key:e.key,qty:1}],`stock:${e.key}`))):null,'staff'===b&&N.known?(0,v.jsxs)(h.Muted,{children:["Today: ",N.stock.map(e=>`${N.free[e.key]} ${e.plural.toLowerCase()} free (${N.reserved[e.key]??0} reserved)`).join(' \xb7 ')]}):null]}):null,x&&!1!==w.tableRequests&&O.tables.length?(0,v.jsx)(q,{rid:e,value:a,onChange:r,party:i,hide:w.tableRequestHide??[]}):null]})},_e.dogTimeOk=function(e,l,s,t,a){if(!a)return!0;const n=e.settings.maxDogsPerSlot;return!n||(0,f.dogsAt)(l,s,t)+a<=n},Object.defineProperty(_e,"accessibleSetUp",{enumerable:!0,get:function(){return f.accessibleSetUp}});var e,l=_r(d[0]),s=_r(d[1]),t=_r(d[2]),a=_r(d[3]),n=(e=a)&&e.__esModule?e:{default:e},r=_r(d[4]),i=_r(d[5]),o=_r(d[6]),c=_r(d[7]),h=_r(d[8]),u=_r(d[9]),y=_r(d[10]),p=_r(d[11]),m=_r(d[12]),b=_r(d[13]),x=_r(d[14]),f=_r(d[15]),j=_r(d[16]),v=_r(d[17]);const k=e=>'display'===x.APP_VARIANT?'':` \xb7 ${(0,b.gbp)(e)}`,w=()=>({allergy:null,allergens:[],severity:'allergy',allergyPeople:1,allergyNote:'',dog:null,dogs:1,wheelchair:0,stepFree:!1,toilet:!1,assistDog:!1,accessNote:'',vegan:0,vegetarian:0,holds:{},tableReq:[]});const R=({children:e,tone:l,testID:s})=>(0,v.jsx)(n.default,{testID:s,style:{gap:10,padding:16,borderRadius:16,borderWidth:'plain'===l?1:1.5,borderColor:'red'===l?j.colours.red:'gold'===l?j.colours.accentBorder:j.colours.hairline,backgroundColor:'red'===l?'#1E1110':j.colours.surface},children:e}),C=({children:e,sub:l})=>(0,v.jsxs)(n.default,{style:{gap:2},children:[(0,v.jsx)(h.T,{weight:"semibold",size:17,children:e}),l?(0,v.jsx)(h.Muted,{children:l}):null]});function M(e,l,s,t,a,n,i){const o=(0,f.reservablesOf)(l),c=(0,p.useStockItems)(e),h=(0,p.useShellStore)((0,r.useShallow)(l=>(0,p.venueCounts)(l,e))),u=(0,p.useShellStore)(l=>!!l.server[e]),y=(0,f.reservedOn)(a,s,o,i),m=s===t&&('staff'===n||u),b={};for(const e of c)b[e.key]=m?Math.max(0,Math.floor((h[e.key]??0)-(y[e.key]??0))):1/0;return{items:o,stock:c,free:b,reserved:y,known:m}}function q({rid:e,value:s,onChange:a,party:r,hide:c}){const u=(0,y.usePlan)(e),p=u.areas.filter(e=>u.tables.some(l=>l.areaId===e.id&&!c.includes(l.name))),[m,b]=(0,t.useState)(p[0]?.id??''),x=s.dog?s.dogs:0,k=e=>c.includes(e)?'Not bookable':(0,f.tableBlockReason)(u,e,r,x,s.wheelchair>0||s.stepFree),w=Object.fromEntries(u.tables.map(e=>[e.name,{table:e,status:k(e.name)?'blocked':'free',covers:0,allergy:!1}])),M=e=>{if(k(e))return;const l=s.tableReq.includes(e)?s.tableReq.filter(l=>l!==e):[...s.tableReq,e].slice(-2);a({...s,tableReq:l})},q=u.tables.filter(e=>e.areaId===m&&!c.includes(e.name));return(0,v.jsxs)(R,{tone:"plain",testID:"q-table",children:[(0,v.jsx)(C,{sub:"Table requests aren\u2019t guaranteed, but we\u2019ll do our best.",children:"\ud83e\ude91 Request a table (optional)"}),p.length>1?(0,v.jsx)(i.AreaTabs,{plan:u,area:m,onPick:b}):null,(0,v.jsx)(n.default,{style:{borderRadius:12,overflow:'hidden',borderWidth:1,borderColor:j.colours.hairline},children:(0,v.jsx)(o.FloorCanvas,{plan:u,areaId:m,mode:"live",view:w,privacy:!0,fit:"contain",crop:!0,maxH:260,highlight:s.tableReq,onTap:e=>M(e.name)})}),(0,v.jsx)(h.Row,{wrap:!0,gap:6,children:q.map(e=>{const t=k(e.name),a=s.tableReq.indexOf(e.name);return(0,v.jsx)(h.Chip,{label:`${(0,l.tableNumbers)(e.name)}`,sub:t||(0===a?'1st choice':1===a?'2nd choice':`${e.maxSeats} seats`),selected:a>=0,disabled:!!t,onPress:()=>M(e.name)},e.name)})}),s.tableReq.length?(0,v.jsxs)(h.T,{size:14,colour:j.colours.goldLight,children:["Requested: ",s.tableReq.map((e,s)=>`${(0,l.tableNumbers)(e)}${s?' (2nd choice)':''}`).join(', ')]}):(0,v.jsx)(h.Muted,{children:"Tap a table; tap another for a second choice."})]})}},827,[808,809,30,127,871,928,927,1298,813,819,825,1025,814,816,806,828,821,24]); +__d(function(g,_r,_i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ACTIVE",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"ANCHORAGE_RESERVABLES",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"reservablesOf",{enumerable:!0,get:function(){return i}}),e.stockNeed=s,e.reservedOn=a,e.usedOn=function(t,r,n){const o={};for(const i of t)if(i.date===r)for(const t of i.holds??[])if(t.served)for(const[r,a]of Object.entries(s({...i,holds:[{...t,served:void 0}]},n)))o[r]=(o[r]??0)+a;return o},e.heldSummary=function(t,r,o){const i={},s={};for(const o of t)if(o.date===r&&n(o))for(const t of o.holds??[])t.served||('item'===t.kind?i[t.id]=(i[t.id]??0)+t.qty:s[t.id]=(s[t.id]??0)+t.qty);return{platters:Object.values(i).reduce((t,r)=>t+r,0),byItem:i,single:s,stock:a(t,r,o)}},e.holdsText=function(t,r,n){return(t.holds??[]).filter(t=>t.qty>0).map(t=>`${'item'===t.kind?c(r.find(r=>r.id===t.id)?.name??'Reserved item'):n.find(r=>r.key===t.id)?.name??t.id} x${t.qty}${t.served?' (served)':''}`).join(', ')},Object.defineProperty(e,"shortItem",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"needsAllergenSeen",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"needsHoldOk",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"hasAllergens",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"allergenText",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"dogCount",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"hasAccess",{enumerable:!0,get:function(){return y}}),e.accessText=function(t){const r=t.access;return r?[r.wheelchair?`${r.wheelchair} wheelchair user${1===r.wheelchair?'':'s'}`:'',r.stepFree?'step-free access':'',r.toilet?'accessible toilet':'',r.assistDog?'assistance dog':'',r.note?.trim()??''].filter(Boolean).join(', '):''},Object.defineProperty(e,"dietText",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"accessibleSetUp",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"dogSetUp",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"isAccessible",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"isDogOk",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"dogsAt",{enumerable:!0,get:function(){return P}}),e.tableBlockReason=function(t,n,o,i,s){const a=t.tables.find(t=>t.name===n);return a?a.maxSeats0&&O(t)&&!(0,r.tableDogOk)(t,a)?'No dogs here':s&&h(t)&&!a.accessible?'Not step-free':'':'Not available'},Object.defineProperty(e,"holidayName",{enumerable:!0,get:function(){return k}}),Object.defineProperty(e,"coverDone",{enumerable:!0,get:function(){return A}}),e.shownStatus=S,e.coversToday=function(t,r){const o=t.filter(t=>t.date===r&&n(t)),i=o.filter(A),s=o.filter(t=>!A(t)&&['confirmed','pending','seated'].includes(S(t))),a=t=>t.reduce((t,r)=>t+r.partySize,0);return{done:a(i),toCome:a(s),total:a(i)+a(s)}};var t=_r(_d[0]),r=_r(_d[1]);const n=t=>!['cancelled','noshow'].includes(t.status),o=[{id:'seafood-platter-2',name:'Seafood Platter for 2',price:16e3,description:'Whole crab and lobster with all the trimmings, for two to share.',uses:[{key:'crab',qty:1},{key:'lobster',qty:1}],active:!0}],i=t=>(t?.settings.reservables??('anchorage'===t?.id?o:[])).filter(t=>t.active);function s(t,r,n=!1){const o={};for(const i of t.holds??[])if(!i.served||n)if('stock'===i.kind)o[i.id]=(o[i.id]??0)+i.qty;else for(const t of r.find(t=>t.id===i.id)?.uses??[])o[t.key]=(o[t.key]??0)+t.qty*i.qty;return o}function a(t,r,o,i){const a={};for(const c of t)if(c.date===r&&n(c)&&'finished'!==c.status&&c.id!==i)for(const[t,r]of Object.entries(s(c,o)))a[t]=(a[t]??0)+r;return a}const c=t=>/platter/i.test(t)?'Platter':t.replace(/ for \d+$/i,''),l=t=>n(t)&&(t.allergies.length>0||!!t.allergyNote?.trim())&&!t.allergyAck,d=t=>n(t)&&(t.holds??[]).some(t=>t.qty>0&&!t.served)&&!t.holdOk,f=t=>t.allergies.length>0||!!t.allergyNote?.trim(),u=r=>[r.allergies.map(r=>(0,t.allergenLabel)(r.allergen)).join(', '),r.allergyNote?.trim()].filter(Boolean).join(' \xb7 ')+(r.allergyPeople?` (${r.allergyPeople} ${1===r.allergyPeople?'person':'people'})`:''),b=t=>t.dogs??(t.dog?1:0),y=t=>!(!t.access||!(t.access.wheelchair||t.access.stepFree||t.access.toilet||t.access.assistDog||t.access.note?.trim()));const p=t=>[t.diet?.vegan?`${t.diet.vegan} vegan`:'',t.diet?.vegetarian?`${t.diet.vegetarian} vegetarian`:''].filter(Boolean).join(', '),h=t=>t.tables.some(t=>t.accessible),O=t=>t.tables.some(t=>void 0!==t.dogOk)||t.areas.some(t=>t.dogs),v=(t,r)=>r.split('+').every(r=>!!t.tables.find(t=>t.name===r.trim())?.accessible),j=(t,n)=>n.split('+').every(n=>{const o=t.tables.find(t=>t.name===n.trim());return!!o&&(0,r.tableDogOk)(t,o)}),P=(t,r,o,i)=>t.filter(t=>t.id!==i&&t.date===r&&t.time===o&&n(t)).reduce((t,r)=>t+b(r),0);const k=t=>t.replace(/\s*\(substitute day\)/gi,'').trim(),A=t=>'finished'===t.status;function S(t){if('seated'===t.status&&t.seatedAt){const r=new Date(t.seatedAt);if((isNaN(r.getTime())?t.date:r.toLocaleDateString('en-CA',{timeZone:'Europe/London'})){const l=n[e.id],c=u.find(l=>l.allergen===e.id),f='contains'===l?t.colours.redBg:'may'===l?t.colours.amberBg:t.colours.surface2,h='contains'===l?'#FFD9D4':'may'===l?'#FFE2A8':t.colours.muted;return(0,d.jsxs)(s.default,{style:{width:'48%',flexGrow:1,backgroundColor:f,borderRadius:8,padding:8,borderWidth:c?2:1,borderColor:c?t.colours.red:t.colours.border},children:[(0,d.jsx)(o.T,{size:14,weight:"medium",colour:l?h:t.colours.text,children:e.label}),(0,d.jsxs)(o.T,{size:13,colour:h,children:['contains'===l?'Contains':'may'===l?'May contain':'Not listed',c?` \xb7 YOUR ALLERGY (${(0,a.severityLabel)(c.severity)})`:'']})]},e.id)})}),e.allergenNotes?(0,d.jsxs)(o.Muted,{children:["Notes: ",e.allergenNotes]}):null,(0,d.jsx)(s.default,{testID:"allergen-signoff",children:(0,d.jsx)(o.Muted,{children:e.signOff?`From the dish's recipe card. Signed off by ${e.signOff.by} on ${c(e.signOff.at)}.`:"Awaiting the head chef's allergen sign-off: not available to order online."})}),(0,d.jsx)(o.Muted,{children:"Always tell staff about allergies when you order or arrive."})]})},_e.AllergenChips=function({map:e,declared:l}){const n=Object.entries(e);return n.length?(0,d.jsx)(o.Row,{wrap:!0,gap:5,children:n.sort((e,l)=>e[1]===l[1]?0:'contains'===e[1]?-1:1).map(([e,n])=>{const s=l.some(l=>l.allergen===e);return(0,d.jsx)(o.Badge,{label:`${s?'\u26a0 ':''}${(0,a.allergenLabel)(e)}${'may'===n?' (may)':''}`,kind:s?'contains'===n?'red':'amber':'neutral'},e)})}):(0,d.jsx)(o.Muted,{children:"No listed allergens"})},r(_d[0]);var e,l=r(_d[1]),n=r(_d[2]),s=(e=n)&&e.__esModule?e:{default:e},a=r(_d[3]),t=r(_d[4]),o=r(_d[5]),d=r(_d[6]);const c=e=>{const l=new Date(`${e.slice(0,10)}T12:00:00`);return isNaN(+l)?e:l.toLocaleDateString('en-GB',{day:'numeric',month:'long',year:'numeric'})}},829,[30,1031,127,814,821,813,24]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BasketButton=function(){const s=(0,l.useBasket)().lines.reduce((e,s)=>e+s.qty,0);return s?(0,c.jsx)(o.default,{accessibilityRole:"button",accessibilityLabel:`Basket, ${s} items`,onPress:()=>e.router.push('/customer/basket'),style:{backgroundColor:u.colours.gold,borderRadius:999,paddingHorizontal:12,paddingVertical:6},children:(0,c.jsxs)(n.T,{weight:"semibold",colour:u.colours.onGold,size:14,children:["Basket \xb7 ",s]})}):null};var e=r(d[0]);r(d[1]);var s,t=r(d[2]),o=(s=t)&&s.__esModule?s:{default:s},l=r(d[3]),u=r(d[4]),n=r(d[5]),c=r(d[6])},830,[804,30,263,819,821,813,24]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.setRecipeCardRepository=function(n){t=n,r.forEach(t=>t())},e.recipeCards=function(){if(!t)throw new Error('Recipe card repository not set up');return t},Object.defineProperty(e,"hasRecipeCards",{enumerable:!0,get:function(){return n}}),e.onRepositorySwap=function(t){return r.add(t),()=>{r.delete(t)}};let t=null;const r=new Set;const n=()=>!!t},831,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Stars=function({value:e,onChange:s,size:n=36}){return(0,c.jsx)(t.Row,{gap:6,children:[1,2,3,4,5].map(u=>(0,c.jsx)(l.default,{disabled:!s,accessibilityRole:"button",accessibilityLabel:`${u} star${u>1?'s':''}`,onPress:()=>s?.(u),hitSlop:4,children:(0,c.jsx)(t.T,{size:n,colour:u<=e?o.colours.gold:'#555',children:"\u2605"})},u))})},r(d[0]);var e,s=r(d[1]),l=(e=s)&&e.__esModule?e:{default:e},o=r(d[2]),t=r(d[3]),c=r(d[4])},832,[30,263,821,813,24]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"LIVE_VENUE_SLUGS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"LIVE_VENUE_BUILD",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"isLiveVenue",{enumerable:!0,get:function(){return n}});var c=r(d[0]);const b=['anchorage','souters','kirkmichael','wildings','kirkton','abbotsford','greenside',"3idiots","cecchinis","mrbasrais","yasmins","williewastles","rupeeroom","smokinggoat","pizzaioli","drunkencoo"],f=b.includes(c.VENUE_RID),n=c=>b.includes(c)||['6349aa07-3fec-46e9-8c69-7b1b08494793','41ce63ca-ae46-432d-a5ba-25e1b801e64d','43c8da91-b8b8-4ce9-9ab7-f00c84c5f4f6','47f86b36-4c99-466a-be9c-30eb3d79f1e1','e0afad1d-cbc1-414a-add6-92e47d302139','24624ea5-d1e3-4182-b0d1-73402b8a1532','1bc2a056-2ef6-4585-abfd-b7d21c84f215',"59766322-119e-4036-a18a-f6909f60a8d2","596c6f7e-9797-4e16-84fe-db4a99fa1bdc","5d500571-e205-4ead-bb58-60e986b6f40e","f43f20ad-55d0-4008-88c8-7738dc1698df","6abc2793-93ab-4e23-a705-b4011a5cc011","78bff97d-5f07-440a-bb99-f6a6118da7a3","cd985ff5-2443-458d-ac8b-342d553628cf","35f870fc-772c-4aad-bb9e-09a9a16bc925","f500ef12-b405-438b-9671-e54289bec5dd"].includes(c)},833,[5]); +__d(function(_g,r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.MockPay=function({visible:e,onClose:j,amount:p,restaurantId:b,allowGiftCard:x=!0,onPaid:f,title:g="Pay"}){const y=(0,o.useGiftCards)(b).filter(e=>e.balance>0),[m,w]=(0,s.useState)(),[P,C]=(0,s.useState)('Test card \u2022\u2022\u2022\u2022 4242'),[T,M]=(0,s.useState)(!1),_=y.find(e=>e.code===m),v=_?Math.min(_.balance,p):0,R=p-v;return(0,h.jsxs)(u.Sheet,{visible:e,onClose:j,title:g,children:[(0,h.jsx)(u.DemoPaymentNotice,{}),x&&y.length>0?(0,h.jsxs)(l.default,{style:{gap:6},children:[(0,h.jsx)(u.T,{weight:"semibold",children:"Use a gift card"}),(0,h.jsxs)(u.Row,{wrap:!0,children:[(0,h.jsx)(u.Chip,{label:"None",selected:!m,onPress:()=>w(void 0)}),y.map(e=>(0,h.jsx)(u.Chip,{label:`${e.code.slice(0,8)}\u2026`,sub:`${(0,n.gbp)(e.balance)} left`,selected:m===e.code,onPress:()=>w(e.code)},e.id))]})]}):null,(0,h.jsx)(u.T,{weight:"semibold",children:"Payment method"}),(0,h.jsx)(u.Row,{wrap:!0,children:['Test card \u2022\u2022\u2022\u2022 4242','Apple Pay (test)','Google Pay (test)'].map(e=>(0,h.jsx)(u.Chip,{label:e,selected:P===e,onPress:()=>C(e)},e))}),(0,h.jsxs)(l.default,{style:{gap:2},children:[(0,h.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(u.Muted,{children:"Amount"}),(0,h.jsx)(u.T,{children:(0,n.gbp)(p)})]}),v?(0,h.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(u.Muted,{children:"Gift card"}),(0,h.jsxs)(u.T,{colour:c.colours.ok,children:["\u2212",(0,n.gbp)(v)]})]}):null,(0,h.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(u.T,{weight:"semibold",children:"To pay now"}),(0,h.jsx)(u.T,{weight:"bold",size:20,colour:c.colours.gold,children:(0,n.gbp)(R)})]})]}),T?(0,h.jsx)(t.default,{color:c.colours.gold}):(0,h.jsx)(u.Button,{label:`Pay ${(0,n.gbp)(R)} \u2014 demo`,onPress:()=>{M(!0),setTimeout(()=>{M(!1),f({giftCardCode:m,giftApplied:v,method:P})},700)},testID:"mock-pay-confirm"})]})};var s=r(d[0]),t=e(r(d[1])),l=e(r(d[2])),o=r(d[3]),n=r(d[4]),c=r(d[5]),u=r(d[6]),h=r(d[7])},834,[30,246,127,819,816,821,813,24]); +__d(function(_g,_r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.GiftLive=function({slug:e,venue:n}){const{info:x,mine:b,err:S,load:w,pay:k}=j(e),[T,P]=(0,t.useState)(null),[D,C]=(0,t.useState)(''),[O,$]=(0,t.useState)(''),[v,B]=(0,t.useState)(''),[I,M]=(0,t.useState)(''),[E,L]=(0,t.useState)(!1),[R,A]=(0,t.useState)(''),[_,H]=(0,t.useState)(null),F=f(e);if(!x)return(0,h.jsx)(a.Screen,{title:"Gift cards",subtitle:n,children:S?(0,h.jsx)(a.Banner,{kind:"warn",title:S}):(0,h.jsx)(a.Muted,{children:"Loading\u2026"})});const N=D?(0,o.poundsToPence)(D)??0:T??x.amounts[1]??x.amounts[0]??0;return(0,h.jsxs)(a.Screen,{title:"Gift cards",subtitle:`${n}: used only at ${n}`,children:[_?(0,h.jsx)(s.default,{testID:"gift-made",children:(0,h.jsx)(a.Card,{highlight:u.colours.gold,children:(0,h.jsxs)(s.default,{style:{gap:6},children:[(0,h.jsx)(a.H2,{children:"Your gift card code"}),(0,h.jsx)(a.T,{size:26,weight:"bold",colour:u.colours.gold,center:!0,children:_.code}),(0,h.jsxs)(a.Muted,{center:!0,children:["Shown once and kept on this phone. Write it down or take a screenshot to give it to ",O||'them',"."]}),(0,h.jsxs)(a.Banner,{kind:"warn",title:`Pay ${(0,l.gbp)(_.pence)} at the bar or till`,children:["Show reference ",_.ref,". The card works once staff mark it paid.",k.cardOn?'':' Card payment in the app is coming soon.']}),(0,h.jsx)(m,{slug:e,kind:"gift",id:_.id,pay:k})]})})}):null,(0,h.jsx)(g,{onDone:w}),(0,h.jsx)(s.default,{testID:"gift-mine",children:(0,h.jsx)(a.Card,{children:(0,h.jsxs)(s.default,{style:{gap:6},children:[(0,h.jsx)(a.H2,{children:"Your gift cards"}),b.cards.length?b.cards.map(t=>(0,h.jsxs)(s.default,{style:{gap:2},children:[(0,h.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(a.T,{style:{flex:1},children:F[t.id]??`\u2022\u2022\u2022\u2022 ${t.last4}`}),(0,h.jsxs)(a.T,{weight:"semibold",colour:u.colours.gold,children:[(0,l.gbp)(t.balancePence)," of ",(0,l.gbp)(t.initialPence)]})]}),(0,h.jsxs)(a.Muted,{size:12,children:[o.STATUS_WORDS[t.status]??t.status,t.expiresAt?` \xb7 use by ${p(t.expiresAt)}`:'','waiting-payment'===t.status?` \xb7 reference ${t.ref}`:'']}),'waiting-payment'===t.status&&_?.id!==t.id?(0,h.jsx)(m,{slug:e,kind:"gift",id:t.id,pay:k}):null]},t.id)):(0,h.jsx)(a.Muted,{children:"None yet."})]})})}),x.giftsOn?(0,h.jsx)(s.default,{testID:"gift-buy",children:(0,h.jsx)(a.Card,{children:(0,h.jsxs)(s.default,{style:{gap:8},children:[(0,h.jsx)(a.H2,{children:"Buy a gift card"}),(0,h.jsx)(a.Row,{wrap:!0,children:x.amounts.map(e=>(0,h.jsx)(a.Chip,{label:(0,l.gbp)(e),selected:!D&&N===e,onPress:()=>{C(''),P(e)}},e))}),(0,h.jsx)(a.Field,{label:`Or another amount (\xa3${x.minPence/100} to \xa3${x.maxPence/100})`,keyboardType:"decimal-pad",value:D,onChangeText:C,placeholder:"e.g. 40",testID:"gift-custom"}),(0,h.jsx)(a.Field,{label:"Who it\u2019s for",value:O,onChangeText:$,testID:"gift-recipient"}),(0,h.jsx)(a.Field,{label:"From",value:v,onChangeText:B}),(0,h.jsx)(a.Field,{label:"Message",value:I,onChangeText:M,multiline:!0,placeholder:"Happy birthday!"}),(0,h.jsxs)(a.Muted,{size:12,children:["Use within ",(0,o.expiryWords)(x.expiryMonths)," of paying. Part-use leaves a balance.",x.terms?` ${x.terms}`:'']}),(0,h.jsx)(s.default,{testID:"gift-pay-placeholder",children:(0,h.jsx)(a.Banner,{kind:"demo",title:"Payment",children:o.PAY_PLACEHOLDER})}),R?(0,h.jsx)(a.Banner,{kind:"warn",title:R}):null,(0,h.jsx)(a.Button,{label:E?'Saving\u2026':`Get a ${(0,l.gbp)(N)} gift card, pay at the till`,testID:"gift-buy-btn",disabled:E||Nx.maxPence,onPress:async()=>{L(!0),A('');try{const t=await(0,c.buyGift)(e,{amount:N,recipient:O,from:v,message:I});t.code&&y(e,t.id,t.code),H({id:t.id,code:t.code??'',ref:t.ref,pence:t.initialPence}),w()}catch(e){A((0,r.plainError)(e))}finally{L(!1)}}})]})})}):(0,h.jsx)(a.Banner,{kind:"demo",title:`${n} isn\u2019t selling gift cards in the app yet`,children:"Ask at the bar."})]})},_e.ShopLive=function({slug:e,venue:n,guestName:p}){const{info:x,mine:f,err:y,load:b,pay:S}=j(e),[w,k]=(0,t.useState)({}),[T,P]=(0,t.useState)(p),[D,C]=(0,t.useState)(!1),[O,$]=(0,t.useState)(''),[v,B]=(0,t.useState)(null);if(!x)return(0,h.jsx)(a.Screen,{title:"Shop",subtitle:n,children:y?(0,h.jsx)(a.Banner,{kind:"warn",title:y}):(0,h.jsx)(a.Muted,{children:"Loading\u2026"})});const I=Object.entries(w).filter(([,e])=>e>0).map(([e,t])=>({id:e,qty:t})),M=(0,o.basketTotal)(I,x.products);return(0,h.jsxs)(a.Screen,{title:"Shop",subtitle:`${n}: collect at the venue`,children:[v?(0,h.jsxs)(s.default,{testID:"shop-done",children:[(0,h.jsxs)(a.Banner,{kind:"warn",title:`Order ${v.ref}: pay ${(0,l.gbp)(v.total)} at the bar or till`,children:["Staff will have it ready to collect once it\u2019s paid.",S.cardOn?'':' Card payment in the app is coming soon.']}),(0,h.jsx)(m,{slug:e,kind:"shop",id:v.id,pay:S})]}):null,(0,h.jsx)(g,{onDone:b}),x.shopOn?(0,h.jsxs)(h.Fragment,{children:[x.products.length?x.products.map(e=>(0,h.jsx)(s.default,{testID:`shop-item-${e.id}`,children:(0,h.jsx)(a.Card,{children:(0,h.jsxs)(s.default,{style:{gap:4},children:[(0,h.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(a.T,{weight:"semibold",style:{flex:1},children:e.name}),(0,h.jsx)(a.T,{colour:u.colours.gold,children:(0,l.gbp)(e.pricePence)})]}),e.details?(0,h.jsx)(a.Muted,{children:e.details}):null,e.soldOut?(0,h.jsx)(a.Badge,{kind:"amber",label:"Sold out"}):(0,h.jsxs)(a.Row,{style:{justifyContent:'space-between',alignItems:'center'},children:[(0,h.jsx)(a.Muted,{children:"How many"}),(0,h.jsx)(a.Stepper,{value:w[e.id]??0,min:0,max:20,label:`${e.name} quantity`,onChange:t=>k({...w,[e.id]:t})})]})]})})},e.id)):(0,h.jsx)(a.Muted,{children:"Nothing in the shop yet."}),I.length?(0,h.jsx)(s.default,{testID:"shop-basket",children:(0,h.jsx)(a.Card,{children:(0,h.jsxs)(s.default,{style:{gap:6},children:[(0,h.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(a.T,{weight:"semibold",children:"Total"}),(0,h.jsx)(a.T,{weight:"semibold",colour:u.colours.gold,children:(0,l.gbp)(M)})]}),(0,h.jsx)(a.Field,{label:"Name for collection",value:T,onChangeText:P,testID:"shop-name"}),(0,h.jsx)(a.Banner,{kind:"demo",title:"Payment",children:o.PAY_PLACEHOLDER}),O?(0,h.jsx)(a.Banner,{kind:"warn",title:O}):null,(0,h.jsx)(a.Button,{label:D?'Sending\u2026':'Order, pay at the till',testID:"shop-order-btn",disabled:D||!T.trim(),onPress:async()=>{C(!0),$('');try{const t=await(0,c.shopOrder)(e,I,T);B({id:t.id,ref:t.ref,total:t.totalPence}),k({}),b()}catch(e){$((0,r.plainError)(e))}finally{C(!1)}}})]})})}):null]}):(0,h.jsx)(a.Banner,{kind:"demo",title:`${n}\u2019s shop isn\u2019t open in the app yet`,children:"Ask at the bar."}),f.orders.length?(0,h.jsx)(s.default,{testID:"shop-mine",children:(0,h.jsx)(a.Card,{children:(0,h.jsxs)(s.default,{style:{gap:4},children:[(0,h.jsx)(a.H2,{children:"Your shop orders"}),f.orders.map(e=>(0,h.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsxs)(a.T,{style:{flex:1},children:[e.ref," \xb7 ",e.lines.map(e=>`${e.qty}\xd7 ${e.name}`).join(', ')]}),(0,h.jsx)(a.Muted,{children:o.STATUS_WORDS[e.status]??e.status})]},e.ref))]})})}):null]})};var e,t=_r(d[0]),n=_r(d[1]),s=(e=n)&&e.__esModule?e:{default:e},a=_r(d[2]),l=_r(d[3]),r=_r(d[4]),o=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]);const p=e=>{if(!e)return'';try{return new Date(e).toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric',timeZone:'Europe/London'})}catch{return e.slice(0,10)}},x=e=>`cc-gift-codes:${e}:v1`;function f(e){try{return JSON.parse(globalThis.localStorage?.getItem(x(e))||'{}')}catch{return{}}}function y(e,t,n){try{const s=f(e);s[t]=n,globalThis.localStorage?.setItem(x(e),JSON.stringify(s))}catch{}}function j(e){const[n,s]=(0,t.useState)(null),[a,l]=(0,t.useState)({cards:[],orders:[]}),[o,u]=(0,t.useState)(''),[h,p]=(0,t.useState)({provider:'none',cardOn:!1,testMode:!0}),x=(0,t.useCallback)(()=>{u(''),(0,c.shopPublic)(e).then(s).catch(e=>u((0,r.plainError)(e))),(0,c.myShop)(e).then(l).catch(()=>{}),(0,c.payPublic)(e).then(p)},[e]);return(0,t.useEffect)(()=>{x()},[x]),{info:n,mine:a,err:o,load:x,pay:h}}function g({onDone:e}){const[n,l]=(0,t.useState)('');return(0,t.useEffect)(()=>{const t='undefined'!=typeof window?new URLSearchParams(window.location.search).get('paid'):null;if(!t||!/^[0-9a-f-]{36}$/.test(t))return;let n=0;const s=()=>(0,c.payStatus)(t).then(t=>{l(t.status),'paid'===t.status?e():n++<10&&setTimeout(s,2e3)}).catch(()=>{});s()},[e]),n?(0,h.jsx)(s.default,{testID:"pay-back",children:(0,h.jsx)(a.Banner,{kind:'paid'===n?'success':'warn',title:'paid'===n?'Paid by card (TEST MODE: no real money)':'expired'===n?'The card payment timed out. Pay at the bar or till.':'Checking the card payment\u2026'})}):null}function m({slug:e,kind:n,id:l,pay:o}){const[u,p]=(0,t.useState)(!1),[x,f]=(0,t.useState)('');return o.cardOn?(0,h.jsxs)(s.default,{testID:`pay-card-${n}`,style:{gap:4},children:[(0,h.jsx)(a.Button,{label:u?'Opening card payment\u2026':'Pay by card (TEST MODE)',kind:"secondary",disabled:u,onPress:async()=>{p(!0),f('');try{const t=await(0,c.payStart)(e,n,l);window.location.assign(t.url)}catch(e){f((0,r.plainError)(e))}finally{p(!1)}}}),(0,h.jsx)(a.Muted,{size:12,children:"Test mode: use a Stripe test card. No real money is taken."}),x?(0,h.jsx)(a.Banner,{kind:"warn",title:x}):null]}):null}},835,[30,127,813,816,1013,1014,1015,821,24]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"guestServer",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"staffServer",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"useGuestLoyalty",{enumerable:!0,get:function(){return _}}),e.refreshGuest=async function(t){if(!c())return;_.setState(n=>({loading:{...n.loading,[t]:!0}}));try{const n=await(0,o.rpc)('loyalty_public',{p_venue_slug:t});if(_.setState(r=>({info:{...r.info,[t]:n}})),await(0,o.guestSession)()){const n=await(0,o.rpc)('loyalty_my_card',{p_venue_slug:t});_.setState(r=>({card:{...r.card,[t]:n??null}}))}}finally{_.setState(n=>({loading:{...n.loading,[t]:!1}}))}},e.guestJoin=async function(t,n){if(!await(0,o.guestSession)())throw new Error('No connection. Try again when you are back online.');const r=await(0,o.rpc)('loyalty_guest_join',{p_venue_slug:t,p_name:n.name.trim(),p_phone:n.phone.trim()||null,p_email:n.email.trim()||null,p_consent:n.consent,p_consent_text:n.consentText,p_referral:n.referral?(0,l.cleanCode)(n.referral):null});return p(t,r),r},e.guestClaim=async function(t,n){if(!await(0,o.guestSession)())return{ok:!1,error:'No connection. Try again when you are back online.'};const r=await(0,o.rpc)('loyalty_guest_claim',{p_venue_slug:t,p_code:(0,l.cleanCode)(n)});return r?.error?{ok:!1,error:String(r.error)}:(p(t,r),{ok:!0,card:r,linked:!!r.linked})},e.guestLinkCode=async function(t){return(0,o.rpc)('loyalty_guest_link_code',{p_venue_slug:t})},e.guestLeave=async function(t){await(0,o.rpc)('loyalty_guest_leave',{p_venue_slug:t}),p(t,null)},Object.defineProperty(e,"staffFind",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"staffCard",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"staffStamp",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"staffRedeem",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"staffJoin",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"staffCode",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"staffRemove",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"loyaltySummary",{enumerable:!0,get:function(){return P}}),e.readSettings=async function(){const{data:t,error:n}=await u().from('loyalty_settings').select('*').eq('venue_id',y()).maybeSingle();if(n)throw n;return(0,l.settingsFromRow)(t)},e.saveSettings=async function(t){const{error:n}=await u().from('loyalty_settings').upsert({venue_id:y(),...(0,l.settingsToRow)(t),updated_by:(o.useSync.getState().staffRef??'').slice(0,80)||'manager',updated_at:(new Date).toISOString()},{onConflict:'venue_id'});if(n)throw n},e.readOffers=k,e.saveOffer=C,e.watchLoyalty=function(t){if(!f())return()=>{};const n=y();let r=u().channel(`cc-loyalty:${n}:${Math.random().toString(36).slice(2,8)}`);for(const o of['loyalty_settings','loyalty_offers','loyalty_guests','loyalty_stamps','loyalty_rewards','loyalty_referrals'])r=r.on('postgres_changes',{event:'*',schema:'public',table:o,filter:`venue_id=eq.${n}`},()=>t());return r.subscribe(),()=>{try{u().removeChannel(r)}catch{}}},e.migrateLocalOnce=async function(t,n,r){if(!f())return 0;const o=`loyalty:migrated:${y()}`;if(await n(o))return 0;let s=0;if(!(await k()).length)for(const n of t.offers.filter(t=>'offer'===t.kind&&!JSON.stringify(t).includes('(example)')))await C({title:n.title.slice(0,80),details:(n.body??'').slice(0,500),startsOn:null,endsOn:n.until??null,isOn:!!n.live}),s++;return await r(o),s};var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]),o=_r(d[3]),s=_r(d[4]),l=_r(d[5]);const u=()=>(0,n.getSupabase)(),c=()=>(0,r.isSupabaseConfigured)()&&!s.PITCH,f=()=>c()&&'staff'===o.useSync.getState().kind&&!!o.useSync.getState().venueId,y=()=>{const t=o.useSync.getState().venueId;if(!t)throw new Error('Not connected to the venue yet.');return t},_=(0,t.create)(()=>({info:{},card:{},loading:{}}));const p=(t,n)=>_.setState(r=>({card:{...r.card,[t]:n}}));const b=t=>(0,o.rpc)('loyalty_staff_find',{p_venue:y(),p_q:t}),w=t=>(0,o.rpc)('loyalty_staff_card',{p_guest:t}),v=t=>(0,o.rpc)('loyalty_staff_stamp',{p_guest:t}),S=t=>(0,o.rpc)('loyalty_staff_redeem',{p_reward:t}),O=t=>(0,o.rpc)('loyalty_staff_join',{p_venue:y(),p_name:t.name.trim(),p_phone:t.phone.trim()||null,p_email:t.email.trim()||null,p_consent:t.consent,p_consent_text:t.consentText}),h=(t,n)=>(0,o.rpc)('loyalty_staff_code',{p_venue:y(),p_kind:t,p_guest:n??null}),j=t=>(0,o.rpc)('loyalty_staff_remove',{p_guest:t}),P=()=>(0,o.rpc)('loyalty_summary',{p_venue:y()});async function k(){const{data:t,error:n}=await u().from('loyalty_offers').select('*').eq('venue_id',y()).order('created_at');if(n)throw n;return(t??[]).map(l.offerFromRow)}async function C(t){const n={venue_id:y(),title:t.title.trim(),details:t.details.trim(),starts_on:t.startsOn||null,ends_on:t.endsOn||null,is_on:t.isOn,updated_at:(new Date).toISOString()},{error:r}=t.id?await u().from('loyalty_offers').update(n).eq('id',t.id):await u().from('loyalty_offers').insert(n);if(r)throw r}},836,[951,862,1095,820,2,1013]); +__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.SoutersCustomerHome=function(){const[e,n]=(0,t.useState)(!1),[p,m]=(0,t.useState)(!1),[b,y]=(0,t.useState)('All'),S=(0,h.useMenu)('souters'),M=(0,t.useMemo)(()=>['All',...Array.from(new Set(S.map(e=>e.section)))],[S]),k=S.filter(e=>'All'===b||e.section===b);if(e)return(0,j.jsx)(u.Screen,{title:"Souter's Inn",back:!1,children:(0,j.jsx)(c.VenueRequestForm,{rid:"souters",kind:"table",onClose:()=>n(!1)})});if(p)return(0,j.jsxs)(u.Screen,{title:"Menu",subtitle:"Souter's Inn",back:!1,children:[(0,j.jsx)(u.Button,{kind:"ghost",label:"\u2039 Back",onPress:()=>m(!1)}),(0,j.jsxs)(u.Muted,{children:[x.SOUTERS_MENU_COUNT," dishes. Please speak to staff about allergens \u2014 nothing is signed off for ordering yet."]}),(0,j.jsx)(u.Row,{wrap:!0,gap:6,children:M.slice(0,12).map(e=>(0,j.jsx)(u.Chip,{label:e,selected:b===e,onPress:()=>y(e)},e))}),k.map(e=>(0,j.jsx)(o.default,{testID:`souters-dish-${e.id}`,children:(0,j.jsxs)(u.Card,{children:[(0,j.jsxs)(u.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,j.jsx)(u.T,{weight:"semibold",style:{flex:1},children:e.name}),(0,j.jsx)(u.T,{children:null==e.price?e.priceNote||'Ask staff':(0,f.gbp)(e.price)})]}),e.description?(0,j.jsx)(u.Muted,{children:e.description}):null,(0,j.jsx)(u.Muted,{children:"Awaiting allergen sign-off \xb7 not orderable yet"})]})},e.id))]});return(0,j.jsxs)(u.Screen,{title:"Souter's Inn",subtitle:"Kirkoswald \xb7 Southern Ayr",children:[(0,j.jsx)(l.RestaurantHero,{rid:"souters",size:160}),(0,j.jsx)(s.FindPub,{rid:"souters"}),(0,j.jsx)(u.Card,{children:(0,j.jsxs)(o.default,{testID:"souters-book-table",style:{gap:8},children:[(0,j.jsx)(u.T,{weight:"bold",children:"Book a table"}),(0,j.jsx)(u.Muted,{children:"Send a request to the venue. No deposit and no payment here \u2014 staff will confirm."}),(0,j.jsx)(u.Button,{label:"Book a table",onPress:()=>n(!0)})]})}),(0,j.jsx)(u.Card,{children:(0,j.jsxs)(o.default,{testID:"souters-menu-card",style:{gap:8},children:[(0,j.jsx)(u.T,{weight:"bold",children:"Menu"}),(0,j.jsxs)(u.Muted,{children:[x.SOUTERS_MENU_COUNT," dishes from the venue menus. Allergen information is not signed off yet \u2014 please speak to staff about allergens. Ordering stays off until the Head Chef signs each dish off."]}),(0,j.jsx)(u.Button,{kind:"secondary",label:"Browse the menu",onPress:()=>m(!0)})]})}),(0,j.jsx)(u.Muted,{children:"Table deposits are not set. Closing time (9pm or 10pm) to confirm. No payment is taken here."})]})},_e.SoutersStaffHome=function({app:e}){return(0,j.jsxs)(o.default,{testID:"souters-setup-home",style:{flex:1,padding:24,justifyContent:'center',gap:16,maxWidth:680,width:'100%',alignSelf:'center'},children:[(0,j.jsx)(l.RestaurantHero,{rid:"souters",size:180}),(0,j.jsx)(u.T,{size:24,weight:"bold",center:!0,children:e}),(0,j.jsxs)(u.Card,{children:[(0,j.jsx)(u.T,{weight:"bold",children:"Ready for venue setup"}),(0,j.jsx)(u.Muted,{children:"Contact: souters@southernayr.com \xb7 01655 760653. No named manager or staff list yet \u2014 no personal links have been created."})]}),(0,j.jsx)(u.Muted,{center:!0,children:"Areas are set (Restaurant, Bar, Mezzanine, Beer garden, Ice cream & cake corner). Table plan to confirm \u2014 no sample tables. Menu seeded without allergen sign-off."}),(0,j.jsx)(u.Muted,{center:!0,children:"Guests request a table in the Customer app. Proposed closing time to confirm."})]})};var e,s=r(d[0]),t=r(d[1]),n=r(d[2]),o=(e=n)&&e.__esModule?e:{default:e},l=r(d[3]),u=r(d[4]),c=r(d[5]),h=r(d[6]),f=r(d[7]),x=r(d[8]),j=r(d[9])},852,[861,30,127,860,813,863,819,816,1134,24]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"LAUNCHER_LINE",{enumerable:!0,get:function(){return u}}),_e.LauncherLine=function(){return(0,c.jsx)(l.default,{style:{borderTopWidth:1,borderColor:n.colours.border,paddingTop:10,marginTop:4},children:(0,c.jsx)(s.Muted,{center:!0,children:u})})},_e.HubTile=function({icon:e,label:u,sub:h,onPress:p,badge:f}){return(0,c.jsxs)(o.default,{accessibilityRole:"button",accessibilityLabel:u,onPress:p,style:({pressed:e})=>({flexBasis:'30%',flexGrow:1,maxWidth:'31.5%',minWidth:96,backgroundColor:e?'#1d1a14':n.colours.surface,borderRadius:14,borderWidth:1,borderColor:n.colours.border,padding:10,gap:2,alignItems:'center'}),children:[b.includes(e)?(0,c.jsx)(t.Icon,{name:e,size:24,colour:n.colours.gold}):(0,c.jsx)(s.T,{size:22,children:e}),(0,c.jsx)(s.T,{size:13,weight:"semibold",center:!0,children:u}),h?(0,c.jsx)(s.T,{size:11,colour:n.colours.muted,center:!0,children:h}):null,f?(0,c.jsx)(l.default,{style:{position:'absolute',top:6,right:6,backgroundColor:n.colours.gold,borderRadius:8,paddingHorizontal:5},children:(0,c.jsx)(s.T,{size:10,weight:"bold",colour:n.colours.onGold,children:f})}):null]})},r(d[0]);var o=e(r(d[1])),l=e(r(d[2])),s=r(d[3]),n=r(d[4]),t=r(d[5]),c=r(d[6]);const u='Card payments: not set up yet';const b=['bag','phone','box','calendarPlus','clock','star','userPlus','gift','alert','tag','sparkle','chat','hanger']},853,[30,263,127,813,821,1005,24]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"attStatus",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"isConfirmed",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"timesheetRemote",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"weekdayOf",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"addDays",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"mondayOfDate",{enumerable:!0,get:function(){return I}}),Object.defineProperty(_e,"shiftsOn",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"shiftOf",{enumerable:!0,get:function(){return E}}),Object.defineProperty(_e,"visibleShifts",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"SUPPLIER_CATS",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"NLW_PENCE",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"MAX_CUSTOM_LINKS",{enumerable:!0,get:function(){return R}}),Object.defineProperty(_e,"WIX_IDS",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"isWixLink",{enumerable:!0,get:function(){return L}}),Object.defineProperty(_e,"DEFAULT_QUICK_LINKS",{enumerable:!0,get:function(){return T}}),_e.openShiftOf=$,_e.loggedBreakMins=D,Object.defineProperty(_e,"isOnBreak",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"DISPLAY_CLOCK_DEFAULT",{enumerable:!0,get:function(){return N}}),Object.defineProperty(_e,"useOwner",{enumerable:!0,get:function(){return V}}),Object.defineProperty(_e,"wageLabel",{enumerable:!0,get:function(){return q}}),Object.defineProperty(_e,"ROLE_LABEL",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"CAN",{enumerable:!0,get:function(){return K}}),_e.staffLabel=function(e){const t=e.nickname?.trim(),n=e.name.replace(/\s*\(([^)]*)\)\s*$/,(e,n)=>t&&n.trim().toLowerCase()===t.toLowerCase()?'':e);return t?`${n} (${t})`:n},Object.defineProperty(_e,"staffCalls",{enumerable:!0,get:function(){return W}}),Object.defineProperty(_e,"staffCalled",{enumerable:!0,get:function(){return F}}),Object.defineProperty(_e,"staffMatches",{enumerable:!0,get:function(){return G}});var e,t=_r(_d[0]),n=_r(_d[1]),a=_r(_d[2]),i=_r(_d[3]),s=_r(_d[4]),r=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),c=(e=d)&&e.__esModule?e:{default:e},u=_r(_d[8]),f=_r(_d[9]),l=_r(_d[10]),p=_r(_d[11]);const m=e=>e.out?e.signOff?'confirmed':'awaiting':'open',g=e=>!!e.out&&!!e.signOff,h={send:null},b=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`,k=e=>{const[t,n,a]=e.split('-').map(Number);return(new Date(t,n-1,a).getDay()+6)%7},y=(e,t)=>{const[n,a,i]=e.split('-').map(Number);return b(new Date(n,a-1,i+t))},I=e=>y(e,-k(e)),w=(e,t)=>e.filter(e=>e.date===t),E=(e,t,n)=>e.find(e=>e.staffId===t&&e.date===n),S=(e,t)=>t?e:e.filter(e=>e.published),O=['Fish & seafood','Meat','Fruit & veg','Dairy','Dry goods','Drinks/brewery','Cleaning','Packaging','Equipment/maintenance'],v=1271,R=6,_=['ql-wix-view','ql-wix-edit'],L=e=>_.includes(e.id)||'Website bookings'===e.group,T=[{id:'ql-gmail',label:'Work email (Gmail)',url:'',icon:'\u2709\ufe0f',kind:'gmail',staff:!1,builtIn:!0},{id:'ql-wix-view',label:'View site',url:'https://www.anchoragedunure.com',icon:'\ud83c\udf10',kind:'link',group:'Website bookings',staff:!1,builtIn:!0},{id:'ql-wix-edit',label:'Edit site',url:'https://manage.wix.com',icon:'\ud83d\udd8a\ufe0f',kind:'link',group:'Website bookings',staff:!1,builtIn:!0}];function $(e,t,n){const a=new Date(n).getTime();return e.filter(e=>e.staffId===t&&e.in&&!e.out&&a-new Date(e.in).getTime()<72e6).sort((e,t)=>t.in.localeCompare(e.in))[0]}function D(e,t=new Date){const n=new Date(t).getTime();return Math.round((e.breaks??[]).reduce((e,t)=>e+Math.max(0,(t.end?new Date(t.end).getTime():n)-new Date(t.start).getTime()),0)/6e4)}const P=e=>!!e?.breaks?.some(e=>!e.end),A=e=>`${e}-${Math.random().toString(36).slice(2,8)}`,M=['#2A3B4C','#4A3A22','#40362A','#3E2A2A','#2E2E40'];function j(){return l.ROSTER.map(e=>({id:e.id,name:e.name,...e.nickname?{nickname:e.nickname}:{},role:e.role,job:e.job,active:!0,level:e.level,dept:e.dept,salaried:e.salaried,noTax:e.noTax,...N.includes(e.id)?{displayClock:!0}:{}}))}const N=['st-jack'];function C(){return Object.fromEntries(l.ROSTER.filter(e=>null!=e.hourlyPence).map(e=>[e.id,e.hourlyPence]))}const U=()=>{const e={tronc:{method:'hours',points:{FOH:1,Bar:1,Kitchen:.8,KP:.6,Manager:1},includeManagers:!0,includeOwner:!1,custom:{},text:'The Anchorage tipping policy (template)\n\n1. 100% of tips paid by card and cash tips put in the tip jar go to staff. Nothing is deducted.\n2. Tips are pooled and shared by paid hours worked in each pay period (breaks excluded).\n3. The owner does not take a share. Managers share only for hours worked on the floor or in the kitchen.\n4. Tips are paid with wages, no later than the end of the month after the tip was paid.\n5. Tip records are kept for 3 years. Ask a manager for your records at any time.'},troncCash:{},troncHistory:[],troncLog:[],chat:[],chatMuted:{},referral:{giverReward:'Free dessert',friendReward:'\xa35 off first order',active:!0},referrals:[],reminders:{h24:!0,h2:!0,confirmText:!0},coats:[],merch:[],merchOrders:[],marketingDraft:void 0,socialAccounts:{facebook:!0,instagram:!0,tiktok:!0,youtube:!0},socialPosts:[],socialDraft:void 0,quickLinks:T.map(e=>({...e})),workEmail:'',staff:j(),rosterVersion:l.ROSTER_VERSION,previewRole:'owner',staffAs:l.ROSTER.find(e=>'staff'===e.app)?.id??l.ROSTER[0]?.id??'',offers:[],photos:[],changeRequests:[],changesUsed:2,site:t.VENUE_RID,branding:{},checks:{},lost:[],lostReports:[],campaigns:[],shifts:[],rotaPublished:void 0,leave:[],swaps:[],availability:{},attendance:[],attLog:[],timeRequests:[],geofence:{lat:55.4047,lng:-4.7606,radius:100},simLocation:'venue',consent:{},hourly:C(),payPeriod:'weekly',suppliers:[],supplierOrders:[],staffCanViewSuppliers:!1,readNotes:{},customerTags:{'cust-demo':['Allergy','Regular'],'cr-2':['VIP'],'cr-5':['Takeaway']}};if(s.LIVE_VENUE_BUILD&&!t.IS_ISOLATED_VENUE)return{...e,changesUsed:0,customerTags:{},socialAccounts:{facebook:!1,instagram:!1,tiktok:!1,youtube:!1},referral:{...e.referral,active:!1}};if(!t.IS_ISOLATED_VENUE)return e;for(const t of Object.keys(e))Array.isArray(e[t])&&(e[t]=[]);return{...e,site:t.VENUE_RID,staffAs:'',hourly:{},customerTags:{},geofence:{lat:0,lng:0,radius:100},tronc:{...e.tronc,text:t.IS_QUEUED_VENUE?n.queuedVenues[t.VENUE_RID].name+' tipping policy \u2014 to confirm.':t.IS_ABBOTSFORD?'The Abbotsford Hotel tipping policy \u2014 awaiting venue confirmation.':t.IS_KIRKTON?'The Kirkton Inn tipping policy \u2014 awaiting venue confirmation.':t.IS_GREENSIDE?'The Greenside Restaurant tipping policy \u2014 awaiting venue confirmation.':t.IS_WILDINGS?'Wildings Hotel & Restaurant tipping policy \u2014 awaiting venue confirmation.':t.IS_KIRKMICHAEL?"The Kirkmichael Arms tipping policy \u2014 awaiting venue confirmation.":"Souter's Inn tipping policy \u2014 awaiting venue confirmation."},changesUsed:0,socialAccounts:{facebook:!1,instagram:!1,tiktok:!1,youtube:!1},referral:{...e.referral,active:!1},quickLinks:t.IS_QUEUED_VENUE||t.IS_ABBOTSFORD||t.IS_KIRKTON?[]:t.IS_GREENSIDE?[{id:'greenside-phone',label:'Call 01655 889685',url:'tel:01655889685',icon:'',kind:'link',group:'Bookings',staff:!0,builtIn:!0}]:t.IS_WILDINGS?[{id:'wildings-phone',label:'Call to book',url:'tel:01655331401',icon:'\ud83c\udf10',kind:'link',group:'Bookings',staff:!0,builtIn:!0},{id:'wildings-email',label:'Email to book',url:'mailto:bookings@wildingsrestaurant-hotel.co.uk',icon:'\ud83c\udf10',kind:'link',group:'Bookings',staff:!0,builtIn:!0}]:t.IS_KIRKMICHAEL?[{id:'kirkmichael-site',label:'Venue website',url:'https://www.kirkmichaelarms.co.uk/',icon:'\ud83c\udf10',kind:'link',group:'Website',staff:!0,builtIn:!0}]:[{id:'souters-book',label:'Guest table requests',url:'https://covercharge-apps.static.hf.space/souters/customer-app/',icon:'\ud83c\udf10',kind:'link',group:'Bookings',staff:!0,builtIn:!0}],branding:{[t.VENUE_RID]:{accent:t.IS_QUEUED_VENUE?n.queuedVenues[t.VENUE_RID].branding.accent:t.IS_ABBOTSFORD?'#B89362':t.IS_KIRKTON?'#B46C54':t.IS_GREENSIDE?a.GREENSIDE_PALETTE.gold:t.IS_WILDINGS?'#FFE3A5':t.IS_KIRKMICHAEL?'#B87754':'#A4622E'}}}},V=(0,u.create)()((0,f.persist)((e,n)=>({...U(),setPreviewRole:t=>e({previewRole:t}),addStaff:(t,n,a)=>e(e=>({staff:[...e.staff,{id:A('st'),name:t,role:n,job:a,active:!0,level:x[n]}]})),saveSupplier:t=>e(e=>({suppliers:e.suppliers.some(e=>e.id===t.id)?e.suppliers.map(e=>e.id===t.id?t:e):[...e.suppliers,t]})),setRate:(t,n)=>e(e=>({hourly:{...e.hourly,[t]:Math.max(0,Math.round(n))}})),clearRate:t=>e(e=>{const n={...e.hourly};return delete n[t],{hourly:n}}),updateStaff:(t,n)=>e(e=>({staff:e.staff.map(e=>e.id===t?{...e,...n}:e)})),addOffer:t=>e(e=>({offers:[{...t,id:A('of')},...e.offers]})),updateOffer:(t,n)=>e(e=>({offers:e.offers.map(e=>e.id===t?{...e,...n}:e)})),addPhoto:t=>e(e=>({photos:[...e.photos,{id:A('ph'),caption:t,tone:M[e.photos.length%M.length]}]})),removePhoto:t=>e(e=>({photos:e.photos.filter(e=>e.id!==t)})),requestChange:(t,n)=>e(e=>e.changesUsed>=5?e:{changesUsed:e.changesUsed+1,changeRequests:[{id:A('cr'),text:t,at:n,status:'requested'},...e.changeRequests]}),setSite:n=>e({site:t.IS_ISOLATED_VENUE?t.VENUE_RID:n}),setBranding:(t,n)=>e(e=>{const a={...e.branding};return n?a[t]={...a[t],...n}:delete a[t],{branding:a}}),setOwner:t=>e(t),addSocialPost:t=>e(e=>({socialPosts:[{...t,id:A('sp')},...e.socialPosts]})),setSocialPost:(t,n)=>e(e=>({socialPosts:e.socialPosts.map(e=>e.id===t?{...e,...n}:e)})),chatSend:t=>e(e=>({chat:[...e.chat,{...t,id:(0,p.uuid)(),reactions:{},seenBy:t.seenBy??('system'===t.from?[]:[t.from])}]})),chatReact:(t,n,a)=>e(e=>({chat:e.chat.map(e=>{if(e.id!==t)return e;const i=e.reactions[n]??[];return{...e,reactions:{...e.reactions,[n]:i.includes(a)?i.filter(e=>e!==a):[...i,a]}}})})),chatSeen:(t,n)=>e(e=>e.chat.some(e=>e.ch===t&&!e.seenBy.includes(n))?{chat:e.chat.map(e=>e.ch!==t||e.seenBy.includes(n)?e:{...e,seenBy:[...e.seenBy,n]})}:e),chatPatch:(t,n)=>e(e=>({chat:e.chat.map(e=>e.id===t?{...e,...n}:e)})),chatMute:(t,n)=>e(e=>{const a=e.chatMuted[t]??[];return{chatMuted:{...e.chatMuted,[t]:a.includes(n)?a.filter(e=>e!==n):[...a,n]}}}),sys:(t,n,a)=>e(e=>({chat:[...e.chat,{id:A('m'),ch:t,from:'system',text:n,at:a,reactions:{},seenBy:[]}]})),tick:(t,n,a,i)=>e(e=>({checks:{...e.checks,[t]:{by:n,at:a,value:i}}})),untick:t=>e(e=>{const n={...e.checks};return delete n[t],{checks:n}}),addLost:t=>e(e=>({lost:[{...t,id:A('lp'),status:'held'},...e.lost]})),setLost:(t,n)=>e(e=>({lost:e.lost.map(e=>e.id===t?{...e,...n}:e)})),addCampaign:t=>e(e=>({campaigns:[{...t,id:A('cp')},...e.campaigns]})),setCampaign:(t,n)=>e(e=>({campaigns:e.campaigns.map(e=>e.id===t?{...e,...n}:e)})),setShifts:t=>e({shifts:t.map(e=>e.date?{...e,day:k(e.date)}:e)}),addShift:t=>e(e=>({shifts:[...e.shifts,{...t,day:k(t.date),published:!1,id:(0,p.uuid)()}]})),copyWeek:(t,a)=>{const i=n(),s=new Set(i.staff.filter(e=>e.active).map(e=>e.id)),r=[];for(let e=0;e<7;e++){const n=y(t,e),o=y(a,e);i.shifts.filter(e=>e.date===n&&s.has(e.staffId)&&!i.shifts.some(t=>t.staffId===e.staffId&&t.date===o)&&!r.some(t=>t.staffId===e.staffId&&t.date===o)).forEach(e=>r.push({id:(0,p.uuid)(),staffId:e.staffId,date:o,day:k(o),start:e.start,end:e.end,note:e.note,published:!1}))}return r.length&&e({shifts:[...i.shifts,...r]}),r.length},publishWeek:t=>{const n=y(t,6);let a=0;return e(e=>({shifts:e.shifts.map(e=>e.daten||e.published&&!e.changed?e:(a++,{...e,published:!0,changed:!1})),rotaPublished:(new Date).toISOString()})),a},removeShift:t=>e(e=>({shifts:e.shifts.filter(e=>e.id!==t)})),markRead:t=>e(e=>({readNotes:{...e.readNotes,...Object.fromEntries(t.map(e=>[e,!0]))}})),toggleTag:(t,n)=>e(e=>{const a=e.customerTags[t]??[];return{customerTags:{...e.customerTags,[t]:a.includes(n)?a.filter(e=>e!==n):[...a,n]}}}),publishRota:t=>e({rotaPublished:t}),addLeave:t=>e(e=>({leave:[{...t,id:A('lv'),status:'pending'},...e.leave]})),setLeave:(t,n)=>e(e=>({leave:e.leave.map(e=>e.id===t?{...e,status:n}:e)})),addSwap:t=>e(e=>({swaps:[{...t,id:A('sw'),status:'open'},...e.swaps]})),setSwap:(t,n)=>e(e=>{const a=e.swaps.find(e=>e.id===t);return{shifts:'approved'===n&&a?.toId?e.shifts.map(e=>e.id===a.shiftId?{...e,staffId:a.toId}:e):e.shifts,swaps:e.swaps.map(e=>e.id===t?{...e,status:n}:e)}}),toggleAvail:(t,n)=>e(e=>{const a=e.availability[t]??[];return{availability:{...e.availability,[t]:a.includes(n)?a.filter(e=>e!==n):[...a,n]}}}),clock:(t,n,a,i,s,r)=>e(e=>{const o=e.attendance.filter(e=>e.staffId===t&&e.in&&!e.out&&new Date(i).getTime()-new Date(e.in).getTime()<72e6).sort((e,t)=>t.in.localeCompare(e.in))[0];if('in'===a)return o?e:{attendance:[...e.attendance,{id:(0,p.uuid)(),staffId:t,date:n,in:i,inSite:s}]};const d=e=>e?.map(e=>e.end?e:{...e,end:i});return o?{attendance:e.attendance.map(e=>e.id===o.id?{...e,out:i,outSite:s,breakMins:r??D({...e,breaks:d(e.breaks)}),breaks:d(e.breaks)}:e)}:e}),adjustClock:(t,n,a,i,s,r)=>e(e=>{const o=e.attendance.find(e=>e.id===t),d=e.staff.find(e=>e.id===o?.staffId),c=o?.[n]?new Date(o[n]).toTimeString().slice(0,5):'none';return{attendance:e.attendance.map(e=>e.id===t?{...e,[n]:a,adjusted:{by:i,at:r,reason:s}}:e),attLog:[{id:A('al'),at:r,text:`${i} changed ${d?.name??'staff'} clock-${n} from ${c} to ${new Date(a).toTimeString().slice(0,5)}: ${s}`},...e.attLog]}}),patchAttendance:(t,n,a)=>e(e=>({attendance:e.attendance.map(e=>e.id===t?{...e,...n,geo:a?[...e.geo??[],a].slice(-20):e.geo}:e)})),breakToggle:(t,a,i)=>{const s=n(),r=$(s.attendance,t,i);if(!r)return!1;const o=r.breaks??[],d=o.some(e=>!e.end);if('start'===a?d:!d)return!1;const c='start'===a?[...o,{start:i}]:o.map(e=>e.end?e:{...e,end:i});return e({attendance:s.attendance.map(e=>e.id===r.id?{...e,breaks:c,breakMins:D({breaks:c})}:e)}),!0},adjustBreak:(t,n,a,i,s)=>e(e=>{const r=e.attendance.find(e=>e.id===t),o=e.staff.find(e=>e.id===r?.staffId);return{attendance:e.attendance.map(e=>e.id===t?{...e,breakMins:n,adjusted:{by:a,at:s,reason:i}}:e),attLog:[{id:A('al'),at:s,text:`${a} changed ${o?.name??'staff'} break from ${r?.breakMins??0}m to ${n}m: ${i}`},...e.attLog]}}),overrideEntry:t=>{const a=n(),i=t.id?a.attendance.find(e=>e.id===t.id):void 0,s=t.reason.trim();if(s.length<3)return null;if(t.out&&t.out<=t.in)return null;const r=e=>e?new Date(e).toTimeString().slice(0,5):'none',o=(e,n,a)=>({at:t.now,by:t.by,byId:t.byId,action:e,from:n,to:a,reason:s}),d=a.staff.find(e=>e.id===t.staffId)?.name??'staff';let c;const u=[];if(i){const e=[...i.audit??[]];if(i.signOff&&(e.push(o('reopened','Confirmed','Awaiting sign-off')),u.push(`${t.by} reopened ${d}'s confirmed ${i.date} entry`)),i.in!==t.in&&(e.push(o('clock_in',r(i.in),r(t.in))),u.push(`${t.by} changed ${d} clock-in from ${r(i.in)} to ${r(t.in)}: ${s}`)),(i.out??'')!==(t.out??'')&&(e.push(o('clock_out',r(i.out),r(t.out))),u.push(`${t.by} changed ${d} clock-out from ${r(i.out)} to ${r(t.out)}: ${s}`)),(i.breakMins??0)!==t.breakMins&&(e.push(o('break',`${i.breakMins??0}m`,`${t.breakMins}m`)),u.push(`${t.by} changed ${d} break from ${i.breakMins??0}m to ${t.breakMins}m: ${s}`)),e.length===(i.audit??[]).length)return i;const n=t.out?i.breaks?.map(e=>e.end?e:{...e,end:t.out}):i.breaks;c={...i,in:t.in,out:t.out,breakMins:t.breakMins,breaks:n,signOff:void 0,adjusted:{by:t.by,at:t.now,reason:s},audit:e}}else c={id:t.id??(0,p.uuid)(),staffId:t.staffId,date:t.date,in:t.in,out:t.out,breakMins:t.breakMins,added:!0,adjusted:{by:t.by,at:t.now,reason:s},audit:[o('added',void 0,`${r(t.in)}\u2013${t.out?r(t.out):'open'}, break ${t.breakMins}m`)]},u.push(`${t.by} added ${d}'s ${t.date} entry ${r(t.in)}\u2013${t.out?r(t.out):'open'} (break ${t.breakMins}m): ${s}`);return t.request&&(c={...c,audit:[...c.audit??[],o('request_applied')]}),h.send?.('attendance_override',c,{reason:s}),e(e=>({attendance:i?e.attendance.map(e=>e.id===i.id?c:e):[...e.attendance,c],attLog:[...u.reverse().map(e=>({id:A('al'),at:t.now,text:e})),...e.attLog]})),c},confirmEntries:(t,a,i,s)=>{const r=n(),o=new Set(t),d=[],c=r.attendance.map(e=>{if(!o.has(e.id)||!e.out||e.signOff)return e;const t={...e,signOff:{by:a,byId:i,at:s},audit:[...e.audit??[],{at:s,by:a,byId:i,action:'confirmed',from:'Awaiting sign-off',to:'Confirmed'}]};return d.push(t),t});return d.length?(d.forEach(e=>h.send?.('attendance_confirm',e)),e({attendance:c,attLog:[{id:A('al'),at:s,text:`${a} confirmed ${d.length} ${1===d.length?'entry':'entries'} (${[...new Set(d.map(e=>e.date))].join(', ')})`},...r.attLog]}),d.length):0},addTimeRequest:t=>e(e=>({timeRequests:[{...t,id:(0,p.uuid)(),status:'open'},...e.timeRequests]})),resolveTimeRequest:(t,a,i,s)=>{const r=n().timeRequests.find(e=>e.id===t);if(!r||'open'!==r.status)return;const o={...r,status:a,resolvedBy:i,resolvedAt:s};h.send?.('time_request_resolve',o),e(e=>({timeRequests:e.timeRequests.map(e=>e.id===t?o:e)}))},setGeofence:t=>e(e=>({geofence:{...e.geofence,...t}})),setSimLocation:t=>e({simLocation:t}),giveConsent:(t,n)=>e(e=>({consent:{...e.consent,[t]:n}})),resetOwner:()=>e(U()),syncRoster:()=>e(e=>{if(t.IS_ISOLATED_VENUE||e.rosterVersion===l.ROSTER_VERSION)return e;const n=new Map(e.staff.map(e=>[e.id,e]));return{staff:[...j().map(e=>({...e,active:n.get(e.id)?.active??!0})),...e.staff.filter(e=>!l.ROSTER.some(t=>t.id===e.id)&&!B.includes(e.id))],hourly:{...e.hourly,...C()},rosterVersion:l.ROSTER_VERSION}})}),{name:'covercharge-owner-v1',version:6,storage:(0,f.createJSONStorage)(()=>c.default),migrate:async(e,t)=>{if(s.LIVE_VENUE_BUILD&&e)return await(0,o.archiveChefCache)('owner',e),{...e,...(0,i.stripOwnerLiveSamples)(e)};if(e&&t<2&&Array.isArray(e.quickLinks)&&(e.quickLinks=e.quickLinks.map(e=>_.includes(e.id)||'Website bookings'===e.group?{...e,staff:!1}:e)),e&&t<3){const t=U();Object.assign(e,{staff:t.staff,hourly:t.hourly,shifts:t.shifts,leave:t.leave,swaps:t.swaps,availability:t.availability,attendance:[],attLog:[],consent:{},chat:[],chatMuted:{},troncHistory:[],staffAs:t.staffAs,previewRole:'owner',rosterVersion:l.ROSTER_VERSION,rotaPublished:void 0})}if(e&&t<4){const t=I(b(new Date));e.shifts=(e.shifts??[]).map(e=>e.date?e:{...e,date:y(t,e.day??0),published:!0}),e.timeRequests=e.timeRequests??[]}return s.LIVE_VENUE_BUILD&&e&&(Object.assign(e,(0,i.stripOwnerLiveSamples)(e)),e.chat=(e.chat||[]).filter(e=>!(0,r.isSeedChefChat)(e)),e.suppliers=(e.suppliers||[]).filter(e=>!/^sup-[1-9]$/.test(e.id)||!/^(Example|Sample)\b/.test(e.name)),e.supplierOrders=(e.supplierOrders||[]).filter(e=>!/\(example\)/i.test(e.by||''))),e}})),q=(e,t,n)=>e?.salaried&&null==t?'Owner, no hourly wage':null==t?'Not set':`${n(t)}/h`,B=['st-2','st-3','st-4','st-5'],x={owner:'Owner',manager:'Manager',staff:'Staff'},K={forecasts:e=>'staff'!==e,manage:e=>'staff'!==e,staffAdmin:e=>'owner'===e,billing:e=>'owner'===e,takings:e=>'staff'!==e,publishSocial:e=>'staff'!==e};const W=e=>[e.name.replace(/\s*\([^)]*\)\s*$/,'').replace(' (example)',''),e.nickname??''].map(e=>e.trim().toLowerCase()).filter(Boolean).flatMap(e=>[e,e.split(' ')[0]]).filter((e,t,n)=>n.indexOf(e)===t),F=(e,t)=>{const n=t.trim().toLowerCase();if(!n)return!1;const a=W(e);return a.includes(n)||a.includes(n.split(' ')[0])},G=(e,t)=>{const n=t.trim().toLowerCase();return!n||[e.name,e.nickname,e.job,e.dept].some(e=>(e??'').toLowerCase().includes(n))}},854,[5,6,1203,1128,833,1023,1131,1115,951,1116,14,1032]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"photoSource",{enumerable:!0,get:function(){return C}}),_e.BoardPhoto=T,_e.PhotoZoom=M,_e.SpecialRow=P,_e.SpecialsTab=function({rid:e,declared:t,now:l}){const o=(0,f.useSpecials)(t=>t.current[e]??null),[n,c]=(0,s.useState)(null);if(!o)return(0,w.jsx)(p.Card,{children:(0,w.jsxs)(u.default,{testID:"specials-empty",style:{alignItems:'center',gap:6,paddingVertical:18},children:[(0,w.jsx)(p.T,{size:34,children:"\ud83e\uddd1\u200d\ud83c\udf73"}),(0,w.jsx)(p.T,{weight:"semibold",size:18,center:!0,children:"Today\u2019s specials are on their way"}),(0,w.jsx)(p.Muted,{center:!0,children:"The kitchen posts the specials board here as soon as it\u2019s written up. Check back soon, or ask a member of staff."})]})});const h=o.allergenCheck;return(0,w.jsxs)(u.default,{style:{gap:10},testID:"specials-tab",children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(u.default,{testID:"specials-updated",style:{flex:1},children:(0,w.jsx)(p.T,{weight:"semibold",colour:b.colours.goldLight,children:(0,y.freshness)(o,l)})}),(0,y.isToday)(o.postedAt,l)?(0,w.jsx)(p.Badge,{kind:"ok",label:"Today"}):(0,w.jsx)(p.Badge,{kind:"amber",label:"Not updated today"})]}),(0,y.isToday)(o.postedAt,l)?null:(0,w.jsx)(p.Muted,{children:"These are the most recent specials posted. Today\u2019s may differ, so please ask."}),o.photo?(0,w.jsxs)(u.default,{style:{gap:4},children:[(0,w.jsx)(T,{photo:o.photo,testID:"specials-photo",onPress:()=>c(o.photo)}),(0,w.jsx)(p.Muted,{center:!0,children:"Tap the photo to zoom"})]}):null,o.items.map(e=>(0,w.jsx)(P,{it:e,declared:t,signedBy:h?.by},e.id)),h?(0,w.jsxs)(p.Muted,{children:["Allergens for the typed specials were checked by ",h.by.replace(' (example)','')," at ",(0,j.hm)(new Date(h.at)),"."]}):null,o.photo&&!o.items.length?(0,w.jsx)(p.Muted,{children:"For allergens in these specials, please ask a member of staff before you order."}):null,(0,w.jsx)(p.Muted,{children:"Specials are served in the restaurant while they last. Ask your server to order one."}),(0,w.jsx)(M,{photo:n,onClose:()=>c(null)})]})};var t=r(d[0]),s=r(d[1]),l=e(r(d[2])),o=e(r(d[3])),n=e(r(d[4])),c=e(r(d[5])),u=e(r(d[6])),h=r(d[7]),p=r(d[8]),f=r(d[9]),x=r(d[10]),y=r(d[11]),j=r(d[12]),b=r(d[13]),w=r(d[14]);const k=r(d[15]),C=e=>e===y.SAMPLE_PHOTO?k:{uri:e};function T({photo:e,width:o,onPress:c,testID:h,label:p="Photo of the specials board"}){const[f,x]=(0,s.useState)(.75);(0,s.useEffect)(()=>{e!==y.SAMPLE_PHOTO?l.default.getSize(e,(e,t)=>e&&t&&x(e/t),()=>{}):x(.75)},[e]);const j=(0,w.jsx)(l.default,{source:C(e),resizeMode:"contain",accessibilityLabel:p,style:{width:o??'100%',aspectRatio:f,borderRadius:12,backgroundColor:(0,t.soutersSurface)('#1b1f1d')}});return c?(0,w.jsx)(n.default,{testID:h,accessibilityRole:"button",accessibilityLabel:`${p}. Tap to zoom`,onPress:c,children:j}):(0,w.jsx)(u.default,{testID:h,children:j})}function M({photo:e,onClose:l}){const[h,f]=(0,s.useState)(!1);return(0,s.useEffect)(()=>f(!1),[e]),(0,w.jsx)(o.default,{visible:!!e,transparent:!0,animationType:"fade",onRequestClose:l,children:(0,w.jsxs)(u.default,{testID:"specials-zoom",style:{flex:1,backgroundColor:(0,t.soutersSurface)('rgba(5,5,5,0.97)')},children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between',padding:12},children:[(0,w.jsx)(p.Button,{small:!0,kind:"secondary",label:h?'Zoom out':'Zoom in',onPress:()=>f(!h)}),(0,w.jsx)(p.Button,{small:!0,label:"Close",accessibilityLabel:"Close photo",onPress:l})]}),(0,w.jsx)(c.default,{horizontal:h,contentContainerStyle:{padding:12,alignItems:'center',justifyContent:'center',flexGrow:1},children:(0,w.jsx)(c.default,{contentContainerStyle:{alignItems:'center'},children:e?(0,w.jsx)(n.default,{onPress:()=>f(!h),accessibilityLabel:h?'Zoom out':'Zoom in',children:(0,w.jsx)(T,{photo:e,width:h?820:360})}):null})})]})})}function P({it:e,declared:t,signedBy:s}){const l=(0,x.conflictsFor)(e.allergens,t);return(0,w.jsx)(p.Card,{highlight:l.contains.length?b.colours.red:l.may.length?b.colours.amber:void 0,children:(0,w.jsxs)(u.default,{testID:"special-item",style:{gap:6},children:[(0,w.jsxs)(p.Row,{style:{justifyContent:'space-between',alignItems:'flex-start'},children:[(0,w.jsx)(p.T,{weight:"semibold",style:{flex:1,paddingRight:8},children:e.name}),(0,w.jsx)(p.T,{weight:"semibold",colour:b.colours.gold,children:(0,y.priceText)(e.price)})]}),e.description?(0,w.jsx)(p.Muted,{children:e.description}):null,l.contains.length?(0,w.jsx)(p.Badge,{kind:"red",label:"\u26a0 Contains your allergen"}):l.may.length?(0,w.jsx)(p.Badge,{kind:"amber",label:"\u26a0 May contain your allergen"}):null,e.noAllergens&&!Object.keys(e.allergens).length?(0,w.jsx)(p.Muted,{children:"None of the 14 allergens listed"}):(0,w.jsx)(h.AllergenChips,{map:e.allergens,declared:t}),s?(0,w.jsxs)(p.Muted,{children:["Allergens checked by ",s.replace(' (example)','')]}):null]})})}},855,[912,30,196,256,263,151,127,829,813,856,814,857,818,821,24,1348]); +__d(function(g,r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useSpecials",{enumerable:!0,get:function(){return _}});var e,t=r(_d[0]),s=r(_d[1]),i=r(_d[2]),n=r(_d[3]),o=r(_d[4]),c=(e=o)&&e.__esModule?e:{default:e},l=r(_d[5]),d=r(_d[6]),h=r(_d[7]),u=r(_d[8]),y=r(_d[9]);const p=()=>{try{return(0,u.nowFrom)(u.useStore.getState().clock)}catch{return new Date}};let S=0;const f=()=>`sb-${Date.now().toString(36)}${(S++).toString(36)}`,b=(e,t)=>u.useStore.setState(s=>({audit:[{id:`au-${f()}`,restaurantId:e,at:p().toISOString(),kind:'allergy',text:t},...s.audit].slice(0,300)})),_=(0,l.create)()((0,d.persist)((e,t)=>({...n.IS_ISOLATED_VENUE||s.LIVE_VENUE_BUILD?{current:{},history:[]}:(0,h.seedSpecials)(p()),post:(t,s,i,n)=>{e(e=>(0,h.postBoard)(e,t,s,i,n,p(),f())),s.items.length&&b(t,`Specials board: allergens for ${s.items.length} typed special${1===s.items.length?'':'s'} checked and signed off by ${i}`)},clear:(t,s)=>{e(e=>(0,h.clearBoard)(e,t)),b(t,`Specials board cleared by ${s}`)},reuse:(s,i,n,o)=>{const c=t().history.find(e=>e.id===i);e(e=>(0,h.reuseBoard)(e,s,i,n,o,p(),f())),c?.items.length&&b(s,`Specials board re-used: ${c.items.length} typed special${1===c.items.length?'':'s'}, allergens as previously checked, signed off by ${n}`)},remove:t=>e(e=>(0,h.deleteFromHistory)(e,t))}),{name:'covercharge-specials-v1',storage:(0,d.createJSONStorage)(()=>c.default),version:1,partialize:e=>({current:e.current,history:e.history})})),E=async()=>{if(!(0,y.liveData)())return;const e=_.getState(),n=e=>String(e.id).startsWith('sb-seed')&&(!s.LIVE_VENUE_BUILD||(0,t.demoActor)(e.postedBy)&&(!e.allergenCheck||(0,t.demoActor)(e.allergenCheck.by))&&(!e.photo||e.photo===h.SAMPLE_PHOTO)&&e.items.every(e=>/\(sample\)/i.test(e.name))),o=Object.fromEntries(Object.entries(e.current).filter(([,e])=>!(e&&n(e)))),c=e.history.filter(e=>!n(e));Object.keys(o).length===Object.keys(e.current).length&&c.length===e.history.length||(s.LIVE_VENUE_BUILD&&await(0,i.archiveChefCache)('specials',{current:e.current,history:e.history}),_.setState({current:o,history:c}))};(0,y.onDataModeChange)(E);try{_.persist?.onFinishHydration?.(E)}catch{}E()},856,[1023,833,1131,5,1115,951,1116,857,870,1118]); +__d(function(g,r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SAMPLE_PHOTO",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"HISTORY_MAX",{enumerable:!0,get:function(){return n}}),e.parsePrice=function(t){const n=t.trim().replace(/^\xa3\s*/,'');return n?/^\d{1,3}(\.\d{1,2})?$/.test(n)?Math.round(100*parseFloat(n)):NaN:null},Object.defineProperty(e,"priceText",{enumerable:!0,get:function(){return s}}),e.itemProblems=a,e.draftProblems=i,e.cycleAllergen=function(t,n){const s={...t};s[n]?'contains'===s[n]?s[n]='may':delete s[n]:s[n]='contains';return s},e.postBoard=function(t,n,s,a,l,c,d){const u=i(s);if(u.length)throw new Error(u[0]);const p={id:d,restaurantId:n,photo:s.photo,app:l,postedBy:a,postedAt:c.toISOString(),items:s.items.map(t=>({...t,name:t.name.trim(),description:t.description.trim()})),allergenCheck:s.items.length?{by:a,at:c.toISOString()}:null};return{current:{...t.current,[n]:p},history:o(t.history,t.current[n],n)}},e.clearBoard=function(t,n){return{current:{...t.current,[n]:null},history:o(t.history,t.current[n],n)}},e.reuseBoard=function(t,n,s,a,i,l,c){const d=t.history.find(t=>t.id===s&&t.restaurantId===n);if(!d)return t;const u={...d,id:c,app:i,postedBy:a,postedAt:l.toISOString(),reusedFrom:d.id,allergenCheck:d.items.length?{by:a,at:l.toISOString()}:null},p={...t,history:t.history.filter(t=>t.id!==s)};return{current:{...t.current,[n]:u},history:o(p.history,t.current[n],n)}},e.deleteFromHistory=function(t,n){return{...t,history:t.history.filter(t=>t.id!==n)}},Object.defineProperty(e,"historyFor",{enumerable:!0,get:function(){return l}}),e.whenText=h,Object.defineProperty(e,"isToday",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"freshness",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"lastUpdated",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"boardSummary",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"SAMPLE_ITEMS",{enumerable:!0,get:function(){return k}}),e.seedSpecials=function(n){const s=60*n.getHours()+n.getMinutes()>=702?S(n,0,11,42):new Date(n.getTime()-6e5),a=S(n,1,11,20),i=S(n,3,12,5);return{current:{anchorage:{id:'sb-seed-today',restaurantId:'anchorage',photo:null,items:k,postedAt:s.toISOString(),postedBy:'Head Chef (example)',app:'chef',allergenCheck:{by:'Head Chef (example)',at:s.toISOString()}}},history:[{id:'sb-seed-yday',restaurantId:'anchorage',photo:null,postedAt:a.toISOString(),postedBy:'Duty Manager (example)',app:'managers',allergenCheck:{by:'Duty Manager (example)',at:a.toISOString()},items:[{id:'sp-y1',name:'Pan-fried sea bass, samphire, brown shrimp butter (sample)',description:'Sample dish.',price:2100,allergens:{fish:'contains',crustaceans:'contains',milk:'contains'}},{id:'sp-y2',name:'Smoked haddock fishcake, poached egg (sample)',description:'Sample dish: with wholegrain mustard sauce.',price:1250,allergens:{fish:'contains',eggs:'contains',gluten:'contains',milk:'contains',mustard:'contains'}},{id:'sp-y3',name:'Lemon posset, shortbread (sample)',description:'Sample pudding.',price:750,allergens:{milk:'contains',gluten:'contains'}}]},{id:'sb-seed-photo',restaurantId:'anchorage',photo:t,items:[],postedAt:i.toISOString(),postedBy:'Head Chef (example)',app:'chef',allergenCheck:null}]}};const t='sample:chalkboard',n=8;const s=t=>null===t?'Ask your server':`\xa3${(t/100).toFixed(2)}`;function a(t){const n=[];t.name.trim().length<3&&n.push('Add a dish name'),null!==t.price&&(!Number.isFinite(t.price)||t.price<=0||t.price>5e4)&&n.push('Check the price');const s=Object.keys(t.allergens).length;return s||t.noAllergens||n.push('Choose its allergens, or tick \u201cNone of the 14\u201d'),s&&t.noAllergens&&n.push('Allergens chosen and \u201cNone of the 14\u201d both ticked'),n}function i(t){const n=[];return t.photo||t.items.length||n.push('Add a photo of the board or type at least one special'),t.items.forEach((t,s)=>a(t).forEach(t=>n.push(`Special ${s+1}: ${t}`))),t.items.length&&!t.allergensChecked&&n.push('Confirm you have checked the allergens'),n}const o=(t,s,a)=>{if(!s)return t;return[...[s,...t.filter(t=>t.restaurantId===a&&t.id!==s.id)].slice(0,n),...t.filter(t=>t.restaurantId!==a)]};const l=(t,n)=>t.history.filter(t=>t.restaurantId===n),c=t=>String(t).padStart(2,'0'),d=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],u=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],p=(t,n)=>t.getFullYear()===n.getFullYear()&&t.getMonth()===n.getMonth()&&t.getDate()===n.getDate();function h(t,n){const s=new Date(t),a=`${c(s.getHours())}:${c(s.getMinutes())}`;if(p(s,n))return`today at ${a}`;const i=new Date(n);return i.setDate(i.getDate()-1),p(s,i)?`yesterday at ${a}`:`${d[s.getDay()]} ${s.getDate()} ${u[s.getMonth()]} at ${a}`}const m=(t,n)=>p(new Date(t),n),y=(t,n)=>`Updated ${h(t.postedAt,n)}`,f=(t,n)=>`Last updated ${h(t.postedAt,n)} by ${t.postedBy}`,b=t=>[t.photo?'Photo':'',t.items.length?`${t.items.length} typed special${1===t.items.length?'':'s'}`:''].filter(Boolean).join(' + '),S=(t,n,s,a)=>{const i=new Date(t);return i.setDate(i.getDate()-n),i.setHours(s,a,0,0),i},k=[{id:'sp-hake',name:'Grilled hake, crushed new potatoes, salsa verde (sample)',description:'Sample dish: day-boat hake, lemon and caper salsa verde.',price:1950,allergens:{fish:'contains',mustard:'contains',sulphites:'may'}},{id:'sp-scallops',name:'Half-shell scallops, garlic and herb butter (sample)',description:'Sample dish: three scallops grilled in the shell, crusty bread.',price:1400,allergens:{molluscs:'contains',milk:'contains',gluten:'contains'}},{id:'sp-crab',name:'Crab and chilli linguine (sample)',description:'Sample dish: brown and white crab meat, chilli, parsley, lemon.',price:1850,allergens:{crustaceans:'contains',gluten:'contains',eggs:'contains',molluscs:'may'}},{id:'sp-mussels',name:'Mussels in cider and leek cream (sample)',description:'Sample dish: rope-grown mussels, dry cider, leeks, cream. Main with chips.',price:1300,allergens:{molluscs:'contains',milk:'contains',sulphites:'contains',celery:'may'}}]},857,[]); +__d(function(g,r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"addressWithoutInvite",{enumerable:!0,get:function(){return u.addressWithoutInvite}}),Object.defineProperty(_e,"inviteFromLocation",{enumerable:!0,get:function(){return u.inviteFromLocation}}),Object.defineProperty(_e,"useSession",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"rosterPerson",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"APP_NAME",{enumerable:!0,get:function(){return w}}),_e.sha256Hex=h,_e.inviteFromText=function(e){const t=e.trim(),n=t.match(/[?&#](?:invite|i)=([A-Za-z0-9_-]{10,})/);return n?n[1]:/^[A-Za-z0-9_-]{10,}$/.test(t)?t:null},_e.personForInvite=async function(e){if(a.IS_ISOLATED_VENUE)return;const t=await h(e);return t?l.ROSTER.find(e=>e.tokenHash===t):void 0},Object.defineProperty(_e,"DEVICE_KEY",{enumerable:!0,get:function(){return m}}),_e.deviceId=function(){try{if('undefined'==typeof localStorage)return null;let e=localStorage.getItem(m);if(!e||!/^[A-Za-z0-9_-]{16,64}$/.test(e)){const t=new Uint8Array(18);if(globalThis.crypto?.getRandomValues?.(t),!t.some(e=>e))for(let e=0;ee.toString(16).padStart(2,'0')).join(''),localStorage.setItem(m,e)}return e}catch{return null}},Object.defineProperty(_e,"START_INVITE",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"START_GO",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"START_LOYALTY_CODE",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"START_TABLE_TOKEN",{enumerable:!0,get:function(){return v}}),_e.appUrl=function(e,t){if('undefined'==typeof window||!window.location)return null;const{origin:n,pathname:o}=window.location,i=o.match(/^(.*?\/)(owner|staff|chef|display|customer)-app(\/|$)/),a=i?i[1]:'/';return`${n}${a}${e}-app/index.html${t?`#invite=${encodeURIComponent(t)}`:''}`},_e.levelJob=function(e,t){const n=(e??'').trim(),o=(t??'').trim();return n?!o||o.toLowerCase().startsWith(n.toLowerCase())?o||n:`${n} \xb7 ${o}`:o};var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},o=r(d[1]),i=r(d[2]),a=r(d[3]),c=r(d[4]),l=r(d[5]),u=r(d[6]);const s=(0,o.create)()((0,i.persist)(e=>({meId:null,welcomed:{},signIn:t=>e({meId:t,signedInAt:(new Date).toISOString()}),signOut:()=>e({meId:null,signedInAt:void 0}),markWelcomed:t=>e(e=>({welcomed:{...e.welcomed,[t]:(new Date).toISOString()}}))}),{name:'covercharge-session-v1',storage:(0,i.createJSONStorage)(()=>n.default),version:1})),f=e=>!a.IS_ISOLATED_VENUE&&e?l.ROSTER.find(t=>t.id===e):void 0,w={owner:'CoverCharge for Managers',staff:'CoverCharge for Staff',chef:'CoverCharge for Head Chef'};async function h(e){const t=globalThis.crypto?.subtle;if(!t)return null;const n=await t.digest('SHA-256',(new TextEncoder).encode(e));return Array.from(new Uint8Array(n)).map(e=>e.toString(16).padStart(2,'0')).join('')}const m=(0,a.venueKey)('covercharge-device-id');const p=(()=>{try{if('undefined'==typeof window||!window.location)return null;const e=(0,a.venueKey)(`cc-pending-invite:${c.APP_VARIANT}`);let t=(0,u.inviteFromLocation)(window.location.search,window.location.hash);try{t?localStorage.setItem(e,t):t=localStorage.getItem(e)}catch{}if(t&&!/^[A-Za-z0-9_-]{10,64}$/.test(t)&&(t=null),t&&window.history?.replaceState){const e=()=>{try{/[?&#]invite=/.test(window.location.href)&&window.history.replaceState(window.history.state,'',(0,u.addressWithoutInvite)(window.location.href))}catch{}};e();try{const e=window.history;for(const t of['pushState','replaceState']){const n=e[t].bind(e);e[t]=(e,t,o)=>n(e,t,null==o?o:/[?&#]invite=/.test(String(o))?(0,u.addressWithoutInvite)(new URL(String(o),window.location.href).toString()):o)}}catch{}for(const t of[300,1e3,2500,5e3,1e4,2e4])setTimeout(e,t)}return t}catch{return null}})(),y=(()=>{try{return'undefined'!=typeof window&&window.location?new URLSearchParams(window.location.search).get('go'):null}catch{return null}})(),S=(()=>{try{const e='undefined'!=typeof window&&window.location?new URLSearchParams(window.location.search).get('loyalty'):null;return e&&/^[A-Za-z0-9-]{4,12}$/.test(e)?e.toUpperCase():null}catch{return null}})(),v=(()=>{try{const e='undefined'!=typeof window&&window.location?new URLSearchParams(window.location.search).get('table'):null;return e&&/^[A-Za-z2-9]{16}$/.test(e)?e.toUpperCase():null}catch{return null}})()},858,[1115,951,1116,5,806,14,1149]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.LoyaltyLive=function({slug:e,venue:r}){const{info:t,card:l,loading:i,err:u,load:y}=p(e),[S,v]=(0,n.useState)('');return t?t.cardOn||l?(0,f.jsxs)(o.Screen,{title:"Stamp card",subtitle:`${r}. This card is just for ${r}.`,children:[S?(0,f.jsx)(o.Banner,{kind:"success",title:S}):null,t.cardOn?null:(0,f.jsxs)(o.Banner,{kind:"info",children:[r," has paused the stamp card. Your stamps and rewards are kept."]}),l?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsxs)(o.H2,{children:[l.stamps," of ",l.needed," stamps"]}),(0,f.jsxs)(o.T,{colour:h.colours.gold,weight:"semibold",children:["Reward: ",l.reward]})]}),(0,f.jsx)(w,{n:l.stamps,of:l.needed}),(0,f.jsxs)(o.Muted,{children:["Staff add a stamp when you visit. ",t.stampExpiryDays?`Stamps last ${t.stampExpiryDays} days.`:'']})]}),l.rewards.length?(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsx)(o.H2,{children:"Ready to use"}),l.rewards.map(e=>(0,f.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(o.T,{weight:"semibold",style:{flex:1},children:e.title}),(0,f.jsx)(o.Muted,{children:e.expiresAt?`Use by ${x(e.expiresAt)}`:''})]},e.id)),(0,f.jsx)(o.Muted,{children:"Show this screen or your card to staff when you'd like to use a reward. Staff mark it used; each one works once."})]}):null,(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Your card"}),(0,f.jsx)(o.Muted,{children:"Staff scan this, or look you up by name, to add a stamp."}),(0,f.jsx)(s.QR,{value:(0,c.cardQr)(e,l.cardNo),size:170}),(0,f.jsx)(o.T,{center:!0,weight:"semibold",children:l.name}),(0,f.jsx)(o.T,{center:!0,size:20,weight:"bold",colour:h.colours.gold,children:(0,c.prettyCardNo)(l.cardNo)})]}),(0,f.jsx)(b,{slug:e,joined:!0,onDone:v}),t.referralOn?(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Bring a friend"}),(0,f.jsx)(o.T,{children:"Your code"}),(0,f.jsx)(o.T,{size:28,weight:"bold",colour:h.colours.gold,center:!0,children:l.referralCode}),(0,f.jsxs)(o.Muted,{children:["Your friend types it when they join. After their first stamp you get: ",t.referralGiver,". They get: ",t.referralFriend,"."]}),(0,f.jsxs)(o.Muted,{children:["Waiting: ",l.referrals.waiting," \xb7 Rewarded: ",l.referrals.rewarded]})]}):null,(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"History"}),l.history.length?l.history.map((e,n)=>(0,f.jsxs)(o.Muted,{children:[x(e.at)," ",j(e.at)," \xb7 ",e.what]},n)):(0,f.jsx)(o.Muted,{children:"No stamps yet."})]}),(0,f.jsx)(C,{slug:e}),(0,f.jsx)(k,{slug:e})]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsxs)(o.H2,{children:[t.needed," stamps = ",t.reward]}),(0,f.jsx)(w,{n:0,of:t.needed})]}),(0,f.jsx)(T,{slug:e,venue:r,referralOn:t.referralOn,onJoined:e=>v(e.note?`You're in. ${e.note}`:"You're in. Show your card to staff on your next visit.")}),(0,f.jsx)(b,{slug:e,joined:!1,onDone:v})]}),(0,f.jsxs)(o.Muted,{children:["Tip: your card is saved by ",r,", not on this phone, so you won't lose it. Rewards are kept on food, not drinks."]})]}):(0,f.jsxs)(o.Screen,{title:"Stamp card",subtitle:r,children:[(0,f.jsx)(o.Banner,{kind:"info",title:`${r} hasn't started a stamp card yet`,children:"When they do, you can join here."}),(0,f.jsxs)(o.Muted,{children:["Tip: offers from ",r," are under Offers on the home screen."]})]}):(0,f.jsxs)(o.Screen,{title:"Stamp card",subtitle:r,children:[u?(0,f.jsx)(o.Banner,{kind:"warn",title:"Couldn't load the stamp card",children:u}):(0,f.jsx)(o.Muted,{children:i?'Loading your card\u2026':'Loading\u2026'}),u?(0,f.jsx)(o.Button,{kind:"secondary",label:"Try again",onPress:y}):null,(0,f.jsxs)(o.Muted,{children:["Tip: your card is saved by ",r,", so it's the same on any phone once you sign in with a code."]})]})},_e.OffersLive=function({slug:e,venue:n}){const{info:r,err:t,load:s}=p(e);return(0,f.jsxs)(o.Screen,{title:"Offers",subtitle:n,children:[!r&&t?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(o.Banner,{kind:"warn",title:"Couldn't load offers",children:t}),(0,f.jsx)(o.Button,{kind:"secondary",label:"Try again",onPress:s})]}):null,r?r.offers.length?r.offers.map(e=>(0,f.jsxs)(o.Card,{children:[(0,f.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(o.T,{weight:"semibold",style:{flex:1},children:e.title}),(0,f.jsx)(o.Badge,{kind:"gold",label:"Offer"})]}),e.details?(0,f.jsx)(o.Muted,{children:e.details}):null,e.endsOn?(0,f.jsxs)(o.Muted,{children:["Until ",x(e.endsOn+'T12:00:00Z')]}):null]},e.id)):(0,f.jsxs)(o.Muted,{children:["No offers from ",n," right now."]}):t?null:(0,f.jsx)(o.Muted,{children:"Loading\u2026"}),(0,f.jsxs)(o.Muted,{children:["Tip: offers are set by ",n," and shown here only. Nothing is sent to your phone. Drinks promotions follow Scottish licensing rules."]})]})},_e.ReferLive=function({slug:e,venue:n}){const{info:r,card:t}=p(e);return(0,f.jsxs)(o.Screen,{title:"Bring a friend",subtitle:n,children:[r?r.referralOn?(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsxs)(o.H2,{children:["You get: ",r.referralGiver]}),(0,f.jsxs)(o.T,{children:["Your friend gets: ",r.referralFriend]}),(0,f.jsx)(o.Muted,{children:"Your friend joins the stamp card with your code. You both get your reward after their first stamp."}),t?(0,f.jsx)(o.T,{size:30,weight:"bold",colour:h.colours.gold,center:!0,children:t.referralCode}):(0,f.jsx)(o.Banner,{kind:"info",children:"Join the stamp card first to get your code."}),t?(0,f.jsxs)(o.Muted,{children:["Waiting: ",t.referrals.waiting," \xb7 Rewarded: ",t.referrals.rewarded]}):null]}):(0,f.jsxs)(o.Banner,{kind:"info",children:[n," isn't running Bring a friend right now."]}):(0,f.jsx)(o.Muted,{children:"Loading\u2026"}),(0,f.jsxs)(o.Muted,{children:["Tip: tell your friend the code yourself. One reward per friend; it doesn't work on your own card, and ",n," may cap it each month."]})]})},_e.useLiveTile=function(e){const r=(0,u.useGuestLoyalty)(n=>n.info[e]),t=(0,u.useGuestLoyalty)(n=>n.card[e]);return(0,n.useEffect)(()=>{(0,u.refreshGuest)(e).catch(()=>{})},[e]),{stamps:r?t?`${t.stamps} of ${t.needed}`:r.cardOn?'Join':void 0:void 0,offers:r?.offers.length}};var n=_r(d[0]),r=e(n),t=e(_r(d[1])),s=_r(d[2]),o=_r(d[3]),l=_r(d[4]),i=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]),f=_r(d[9]);const x=e=>{try{return new Date(e).toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric',timeZone:'Europe/London'})}catch{return e.slice(0,10)}},j=e=>{try{return new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'})}catch{return''}};let y=!1;function p(e){const t=(0,u.useGuestLoyalty)(n=>n.info[e]),s=(0,u.useGuestLoyalty)(n=>n.card[e]),o=(0,u.useGuestLoyalty)(n=>!!n.loading[e]),[l,i]=(0,n.useState)(''),h=r.default.useCallback(()=>{i(''),(0,u.refreshGuest)(e).catch(e=>i((0,c.plainError)(e)))},[e]);return(0,n.useEffect)(()=>{h();const e=setInterval(h,3e4);return()=>clearInterval(e)},[h]),{info:t,card:s,loading:o,err:l,load:h}}function w({n:e,of:n}){return(0,f.jsx)(t.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:10,justifyContent:'center',paddingVertical:8},children:Array.from({length:n}).map((n,r)=>(0,f.jsx)(t.default,{accessibilityLabel:r!y&&i.START_LOYALTY_CODE?(y=!0,i.START_LOYALTY_CODE):''),[h,x]=(0,n.useState)(!1),[j,p]=(0,n.useState)('');return(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:r?'Got a code from staff?':'Already have a card?'}),(0,f.jsx)(o.Muted,{children:r?'Staff can give you a one-time code for a stamp. Type it here.':'Ask staff for a sign-in code, or make one on your other phone (Stamp card \u203a Use on another phone). Type it here to open your card.'}),(0,f.jsx)(o.Field,{label:"Code",value:s,onChangeText:e=>l(e.toUpperCase()),autoCapitalize:"characters",maxLength:9,placeholder:"e.g. 7KQ2MX",testID:"loyalty-code"}),j?(0,f.jsx)(o.Banner,{kind:"warn",children:j}):null,(0,f.jsx)(o.Button,{label:h?'Checking\u2026':'Use code',disabled:h||s.replace(/[^A-Za-z0-9]/g,'').length<6,onPress:async()=>{x(!0),p('');try{const n=await(0,u.guestClaim)(e,s);n.ok?(l(''),t(n.linked?'This phone now shows your card.':n.card.newReward?`Stamp added. You've earned: ${n.card.rewards[n.card.rewards.length-1]?.title??'a reward'}!`:'Stamp added.')):p(n.error)}catch(e){p((0,c.plainError)(e))}finally{x(!1)}},testID:"loyalty-use-code"})]})}function T({slug:e,venue:r,referralOn:t,onJoined:s}){const i=(0,l.useCustomer)(),[x,j]=(0,n.useState)(i.name??''),[y,p]=(0,n.useState)(i.phone??''),[w,b]=(0,n.useState)(i.email??''),[T,C]=(0,n.useState)(''),[k,S]=(0,n.useState)(!1),[v,L]=(0,n.useState)(!1),[M,B]=(0,n.useState)('');return(0,f.jsxs)(o.Card,{highlight:h.colours.gold,children:[(0,f.jsx)(o.H2,{children:"Join the stamp card"}),(0,f.jsx)(o.Muted,{children:"Only your name is needed. A phone number or email helps staff find your card if you lose this phone. Nothing is sent to you."}),(0,f.jsx)(o.Field,{label:"Your name",value:x,onChangeText:j,maxLength:60,testID:"loyalty-name"}),(0,f.jsx)(o.Field,{label:"Phone (optional)",value:y,onChangeText:p,keyboardType:"phone-pad",maxLength:20}),(0,f.jsx)(o.Field,{label:"Email (optional)",value:w,onChangeText:b,keyboardType:"email-address",autoCapitalize:"none",maxLength:120}),t?(0,f.jsx)(o.Field,{label:"Friend's code (optional)",value:T,onChangeText:e=>C(e.toUpperCase()),autoCapitalize:"characters",maxLength:8}):null,(0,f.jsx)(o.Toggle,{label:(0,c.consentText)(r),value:k,onChange:S,testID:"loyalty-consent"}),M?(0,f.jsx)(o.Banner,{kind:"warn",children:M}):null,(0,f.jsx)(o.Button,{label:v?'Joining\u2026':'Join',disabled:v||!k||!x.trim(),onPress:async()=>{L(!0),B('');try{s(await(0,u.guestJoin)(e,{name:x,phone:y,email:w,consent:k,consentText:(0,c.consentText)(r),referral:T}))}catch(e){B((0,c.plainError)(e))}finally{L(!1)}},testID:"loyalty-join"})]})}function C({slug:e}){const[r,t]=(0,n.useState)(null),[s,l]=(0,n.useState)('');return(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Use on another phone"}),(0,f.jsxs)(o.Muted,{children:["Make a code here, then on the other phone open ","the stamp card"," and type it under \"Already have a card?\". The code works once, for 15 minutes."]}),r?(0,f.jsx)(o.T,{size:30,weight:"bold",colour:h.colours.gold,center:!0,children:r.code}):null,r?(0,f.jsxs)(o.Muted,{center:!0,children:["Works until ",j(r.expiresAt)]}):null,s?(0,f.jsx)(o.Banner,{kind:"warn",children:s}):null,(0,f.jsx)(o.Button,{kind:"secondary",label:r?'Make a new code':'Make a code',onPress:()=>{l(''),(0,u.guestLinkCode)(e).then(t).catch(e=>l((0,c.plainError)(e)))}})]})}function k({slug:e}){const[r,t]=(0,n.useState)(!1),[s,l]=(0,n.useState)('');return(0,f.jsxs)(o.Card,{children:[(0,f.jsx)(o.H2,{children:"Leave the stamp card"}),(0,f.jsx)(o.Muted,{children:"Your name, phone and email are removed and your stamps and rewards go. This can't be undone."}),s?(0,f.jsx)(o.Banner,{kind:"warn",children:s}):null,r?(0,f.jsxs)(o.Row,{gap:8,children:[(0,f.jsx)(o.Button,{kind:"danger",label:"Yes, remove me",onPress:()=>(0,u.guestLeave)(e).catch(e=>l((0,c.plainError)(e)))}),(0,f.jsx)(o.Button,{kind:"ghost",label:"Keep my card",onPress:()=>t(!1)})]}):(0,f.jsx)(o.Button,{kind:"ghost",label:"Leave the stamp card",onPress:()=>t(!0)})]})}},859,[30,127,867,813,819,858,1013,836,821,24]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"BUILTIN_LOGOS",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"HERO_LOGOS",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"HEADER_LOGO",{enumerable:!0,get:function(){return T}}),Object.defineProperty(_e,"ACCENTS",{enumerable:!0,get:function(){return z}}),_e.useBrandRid=k,_e.useBrand=L,_e.PoweredBy=O,_e.RestaurantLogo=S,_e.RestaurantHero=function({rid:e,size:o=200,showPlace:r=!0}){const c=L(e),u='wildings'===c.rid||'greenside'===c.rid||'kirkton'===c.rid||'abbotsford'===c.rid||(0,t.isQueuedVenue)(c.rid),b='yasmins'===c.rid?c.logo:u?w[c.rid]:c.custom?c.logo:w[c.rid]??c.logo;return(0,j.jsxs)(l.default,{testID:"restaurant-hero",style:{alignItems:'center',gap:6},children:[b?(0,j.jsx)(s.default,{source:b,accessibilityLabel:`${c.name} logo`,style:{width:o,height:o,borderRadius:!u&&c.custom?o/2:0},resizeMode:"contain"}):(0,j.jsx)(S,{rid:c.rid,size:o}),u?null:(0,j.jsx)(n.Text,{testID:"restaurant-hero-name",style:[{fontFamily:f.fonts.semibold,fontSize:26,lineHeight:34,color:f.colours.text,textAlign:'center'},(0,h.webLine)({lineHeight:34},26)],children:c.name}),r&&c.place?(0,j.jsx)(n.Text,{style:[{fontFamily:f.fonts.regular,fontSize:14,lineHeight:20,color:c.accentText,textAlign:'center'},(0,h.webLine)({lineHeight:20},14)],children:c.place}):null]})},_e.RestaurantBrand=function({rid:e,sub:t,size:o=T,nameSuffix:r}){const s=L(e);return(0,j.jsxs)(l.default,{style:{gap:2,flexShrink:1},children:[(0,j.jsx)(O,{}),(0,j.jsxs)(l.default,{style:{flexDirection:'row',alignItems:'center',gap:8},children:[(0,j.jsx)(S,{rid:s.rid,size:o}),(0,j.jsxs)(l.default,{style:{flexShrink:1},children:[(0,j.jsxs)(n.Text,{numberOfLines:1,style:[{fontFamily:f.fonts.semibold,fontSize:17,lineHeight:22,color:f.colours.text},(0,h.webLine)({lineHeight:22},17)],children:[s.name,r??'']}),t?(0,j.jsx)(n.Text,{numberOfLines:1,style:[{fontFamily:f.fonts.regular,fontSize:12,lineHeight:16,color:s.accentText},(0,h.webLine)({lineHeight:16},12)],children:t}):null]})]})]})};var t=_r(d[0]),n=_r(d[1]),o=_r(d[2]),r=e(_r(d[3])),s=e(_r(d[4])),l=e(_r(d[5])),c=_r(d[6]),u=_r(d[7]),f=_r(d[8]),h=_r(d[9]),b=_r(d[10]),x=_r(d[11]),y=_r(d[12]),j=_r(d[13]);const p={"3idiots":_r(d[14]),cecchinis:_r(d[15]),mrbasrais:_r(d[16]),yasmins:_r(d[17]),williewastles:_r(d[18]),rupeeroom:_r(d[19]),smokinggoat:_r(d[20]),pizzaioli:_r(d[21]),drunkencoo:_r(d[22]),abbotsford:_r(d[23]),kirkton:_r(d[24]),greenside:_r(d[25]),wildings:_r(d[26]),kirkmichael:_r(d[27]),souters:_r(d[28]),anchorage:_r(d[29]),saltmarsh:_r(d[30]),brae:_r(d[31])},w={"3idiots":_r(d[32]),cecchinis:_r(d[33]),mrbasrais:_r(d[34]),yasmins:_r(d[35]),williewastles:_r(d[36]),rupeeroom:_r(d[37]),smokinggoat:_r(d[38]),pizzaioli:_r(d[39]),drunkencoo:_r(d[40]),abbotsford:_r(d[41]),kirkton:_r(d[42]),greenside:_r(d[43]),wildings:_r(d[44]),kirkmichael:_r(d[45]),souters:_r(d[28]),anchorage:_r(d[46])};x.PITCH&&(delete p.anchorage,delete w.anchorage);const T=48,z=['#CFA45F','#D4AF61','#C9A24A','#E2C489','#F2EDE4','#A88B5A','#B08D57','#D9774B'];function k(e){const t=(0,o.useGlobalSearchParams)(),n=(0,u.useOwner)(e=>e.site),r='string'==typeof t.rid?t.rid:void 0;return b.IS_ISOLATED_VENUE?b.VENUE_RID:e??r??n??b.VENUE_RID}function L(e){const t=k(e),n=(0,c.useStore)(e=>e.restaurants.find(e=>e.id===t)),o=(0,u.useOwner)(e=>e.branding[t]),s=o?.logoUri?{uri:o.logoUri}:p[t],l=o?.accent??f.colours.gold,h=r.default.useMemo(()=>(0,y.checkAccent)(l,f.colours.bg,f.colours.onGold,f.colours.text),[l]);return{rid:t,name:n?.name??'Restaurant',place:n?.location??'',logo:s,accent:l,accentText:h.accentText,onAccent:h.onAccent,custom:!!o?.logoUri}}function O({size:e=10}){return(0,j.jsxs)(n.Text,{accessibilityLabel:"powered by CoverCharge",style:[{fontFamily:f.fonts.regular,fontSize:e,lineHeight:Math.round(1.35*e),color:f.colours.muted},(0,h.webLine)({lineHeight:Math.round(1.35*e)},e)],children:["powered by ",(0,j.jsx)(n.Text,{style:{fontFamily:f.fonts.semibold,color:f.colours.text},children:"Cover"}),(0,j.jsx)(n.Text,{style:{fontFamily:f.fonts.semibold,color:f.colours.gold},children:"Charge"})]})}function S({rid:e,size:t=T}){const o=L(e);if(o.logo)return(0,j.jsx)(s.default,{source:o.logo,accessibilityLabel:`${o.name} logo`,style:{width:t,height:t,borderRadius:o.custom?t/2:0},resizeMode:"contain"});const r=o.name.replace(/^The /,'').split(/\s+/).map(e=>e[0]).join('').slice(0,2).toUpperCase();return(0,j.jsx)(l.default,{accessibilityLabel:`${o.name} logo`,style:{width:t,height:t,borderRadius:t/2,borderWidth:2,borderColor:o.accentText,alignItems:'center',justifyContent:'center'},children:(0,j.jsx)(n.Text,{style:{fontFamily:f.fonts.bold,color:o.accentText,fontSize:.36*t},children:r})})}},860,[6,875,804,30,196,127,819,854,821,1237,5,2,1236,24,1240,1241,1242,1243,1244,1245,1246,1247,1248,1249,1250,1251,1252,1253,1254,1255,1256,1257,1258,1259,1260,1261,1262,1263,1264,1265,1266,1267,1268,1269,1270,1271,1272]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.FindPub=function({rid:e}){const p=(0,l.pubLocation)(e),[b,y]=(0,n.useState)(!1),[f,x]=(0,n.useState)(!1),[j,w]=(0,n.useState)(null),[I,v]=(0,n.useState)(null);if(!p)return null;const D=async()=>{y(!1),x(!0),v(null);const e=await(0,u.getFix)();x(!1),'object'==typeof e?(w(Math.round((0,c.distanceM)(p,e))),v(null)):(w(null),v('Your location was not shared. You can still use the address and open directions.'))};return(0,h.jsx)(o.Card,{children:(0,h.jsxs)(t.default,{testID:"find-pub",style:{gap:10},children:[(0,h.jsx)(o.T,{accessibilityRole:"header",weight:"bold",children:"Find us"}),(0,h.jsx)(o.T,{children:p.address}),(0,h.jsx)(o.Muted,{children:"See your approximate distance, or open directions. Location is optional and is never saved."}),(0,h.jsx)(o.Button,{testID:"find-pub-distance",label:f?'Finding your distance\u2026':'Find us \u2014 show my distance',accessibilityLabel:`Find ${p.name}, show my distance using my location once`,disabled:f,onPress:()=>y(!0)}),(0,h.jsxs)(t.default,{accessibilityLiveRegion:"polite",testID:"find-pub-result",children:[null!=j?(0,h.jsxs)(o.T,{children:["About ",j<1e3?`${j} m`:`${(j/1e3).toFixed(1)} km`," away, in a straight line."]}):null,I?(0,h.jsx)(o.T,{children:I}):null]}),(0,h.jsx)(o.Button,{testID:"find-pub-directions",kind:"secondary",label:"Open directions in Maps",accessibilityLabel:`Open directions to ${p.name}, ${p.address}, without sharing my location with CoverCharge`,onPress:()=>{s.default.openURL(`https://www.google.com/maps/dir/?api=1&destination=${encodeURIComponent(p.address)}`)}}),(0,h.jsx)(o.Sheet,{visible:b,onClose:()=>y(!1),title:"Use your location for distance?",testID:"find-pub-reason",children:(0,h.jsxs)(t.default,{style:{gap:12},children:[(0,h.jsxs)(o.T,{children:["We use your phone\u2019s location once to estimate how far you are from ",p.name,". Your position stays on this screen only: it is not stored or sent to the pub."]}),(0,h.jsx)(o.T,{children:"You can refuse location and still see the address and use directions."}),(0,h.jsx)(o.Button,{testID:"find-pub-allow",label:"Use my location once",onPress:()=>{D()}}),(0,h.jsx)(o.Button,{testID:"find-pub-cancel",kind:"secondary",label:"Not now \u2014 keep the address",onPress:()=>y(!1)})]})})]})})};var n=r(d[0]),s=e(r(d[1])),t=e(r(d[2])),o=r(d[3]),l=r(d[4]),c=r(d[5]),u=r(d[6]),h=r(d[7])},861,[30,239,127,813,987,953,1273,24]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.getSupabase=function(){if(_)return _;if(!(0,u.isSupabaseConfigured)())throw new Error('Supabase is not configured: set EXPO_PUBLIC_SUPABASE_URL and EXPO_PUBLIC_SUPABASE_ANON_KEY in .env.local');return _=(0,s.createClient)(u.SUPABASE_URL,u.SUPABASE_ANON_KEY,{auth:{storage:n.default,persistSession:!0,autoRefreshToken:!0,detectSessionInUrl:!1,storageKey:`${(0,o.syncNamespace)()}auth`},realtime:{params:{eventsPerSecond:10}}}),_},_e.setSupabaseClient=function(e){_=e};var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},s=r(d[1]),u=r(d[2]),o=r(d[3]);let _=null},862,[1115,1153,1095,1195]); +__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.VenueRequestForm=function({rid:e,kind:l,hotel:c,allDayHours:j,sessionHours:q,onClose:T}){const[D,f]=(0,o.useState)({name:'',phone:'',email:'',notes:'',date:(0,p.localDate)(),service:(0,t.isQueuedVenue)(e)||'greenside'===e?void 0:'Lunch',time:j||'greenside'===e?'10:00':'12:00',covers:2,checkIn:(0,p.localDate)(),checkOut:'',roomType:c?.roomTypes[0]?.id,guests:2,addDinner:!1}),v=e=>f(t=>({...t,...e})),[C,I]=(0,o.useState)(''),[S,w]=(0,o.useState)(''),[B,P]=(0,o.useState)(null),[R,Y]=(0,o.useState)(''),[M,N]=(0,o.useState)(!1),[$,V]=(0,o.useState)(!1),z=(0,o.useRef)(!1);(0,o.useEffect)(()=>{let s=!0;return(0,b.requestChallenge)(e,l).then(e=>{s&&P(e)}).catch(n=>{s&&Y((0,t.isQueuedVenue)(e)||['greenside','kirkton'].includes(e)?(0,b.requestMessage)(n).replace(/the hotel/g,'the restaurant'):(0,b.requestMessage)(n))}),()=>{s=!1}},[e,l]);const L=async()=>{if(z.current)return;const o=(0,t.isQueuedVenue)(e)?(0,s.queuedRequestError)(e,D,q):j&&'table'===l?(0,r.allDayRequestError)(D,j):(0,n.errorForVenue)(e,l,D,c);if(o)Y(o);else if(B&&C.trim()){z.current=!0,V(!0),Y('');try{await(0,b.sendVenueRequest)(e,l,D,B.id,C,S),N(!0)}catch(s){Y((0,t.isQueuedVenue)(e)||['greenside','kirkton'].includes(e)?(0,b.requestMessage)(s).replace(/the hotel/g,'the restaurant'):(0,b.requestMessage)(s))}finally{z.current=!1,V(!1)}}else Y('Complete the security check.')},F={minHeight:48,fontSize:18,color:y.colours.text};return(0,x.jsxs)(u.default,{testID:`venue-${l}-form`,style:{gap:16,alignItems:'stretch'},children:[(0,x.jsx)(h.H2,{children:'table'===l?'Book a table':'Book a room'}),(0,x.jsx)(h.T,{size:18,center:!0,children:'greenside'===e?'No payment is taken for this request. Deposit terms to confirm. This is a request, not an instant confirmation.':'No deposit. No payment. This is a request, not an instant confirmation.'}),M?(0,x.jsx)(h.Banner,{kind:"info",title:'greenside'===e?'Request sent. A Greenside manager must confirm your table.':c?.enabled?'Request sent. The hotel will contact you to confirm.':'Request sent. The venue will contact you to confirm.',children:"Nothing has been charged. No email or text is sent by this app."}):(0,x.jsxs)(x.Fragment,{children:['table'===l?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(k,{label:"Date (YYYY-MM-DD)",testID:"request-date",value:D.date,onChangeText:e=>v({date:e}),placeholder:"2026-11-20",style:F}),(0,t.isQueuedVenue)(e)||'greenside'===e||j?null:(0,x.jsx)(h.Row,{wrap:!0,children:['Lunch','Dinner'].map(e=>(0,x.jsx)(h.Button,{testID:`request-service-${e.toLowerCase()}`,label:e+(D.service===e?' \xb7 selected':''),kind:D.service===e?'primary':'secondary',onPress:()=>v({service:e,time:'Lunch'===e?'12:00':'18:00'}),style:{alignSelf:'auto'}},e))}),(0,x.jsx)(h.T,{size:18,weight:"semibold",center:!0,children:"Time within kitchen hours"}),(0,x.jsx)(h.Row,{wrap:!0,children:((0,t.isQueuedVenue)(e)?(0,s.queuedRequestSlots)(e,D.date||'',q):j?(0,r.allDaySlots)(D.date||'',j):(0,n.slotsForVenue)(e,D.date||'',D.service||'Lunch')).map(e=>(0,x.jsx)(h.Button,{testID:`request-time-${e.replace(':','')}`,label:e+(D.time===e?' \xb7 selected':''),kind:D.time===e?'primary':'secondary',onPress:()=>v({time:e}),style:{alignSelf:'auto'}},e))}),(0,x.jsx)(k,{label:"Covers",testID:"request-covers",keyboardType:"number-pad",value:String(D.covers??''),onChangeText:e=>v({covers:Number(e)}),style:F})]}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(h.T,{size:18,center:!0,children:[null==c?.bedrooms?'':`${c.bedrooms} bedrooms. `,c?.priceNote,"."]}),(0,x.jsx)(k,{label:"Check-in date (YYYY-MM-DD)",testID:"request-check-in",value:D.checkIn,onChangeText:e=>v({checkIn:e}),style:F}),(0,x.jsx)(k,{label:"Check-out date (YYYY-MM-DD)",testID:"request-check-out",value:D.checkOut,onChangeText:e=>v({checkOut:e}),style:F}),(0,x.jsx)(h.T,{size:18,weight:"semibold",center:!0,children:"Room type"}),c?.roomTypes.map(e=>(0,x.jsx)(h.Button,{testID:`request-room-${e.id}`,label:`${e.name} \xb7 ${null==e.pricePence?'Price to confirm with the hotel':`${e.from?'from ':''}\xa3${e.pricePence/100}`} \xb7 ${c.breakfast}${D.roomType===e.id?' \xb7 selected':''}`,kind:D.roomType===e.id?'primary':'secondary',onPress:()=>v({roomType:e.id})},e.id)),(0,x.jsx)(k,{label:"Guests",testID:"request-guests",keyboardType:"number-pad",value:String(D.guests??''),onChangeText:e=>v({guests:Number(e)}),style:F}),(0,x.jsx)(h.Button,{testID:"request-add-dinner",label:"Add dinner \xb7 "+(D.addDinner?'Yes':'No'),kind:D.addDinner?'primary':'secondary',onPress:()=>v({addDinner:!D.addDinner})}),(0,x.jsx)(h.T,{size:18,center:!0,children:"The hotel will arrange dinner details with you."})]}),(0,x.jsx)(k,{label:"Name",testID:"request-name",autoComplete:"name",value:D.name,onChangeText:e=>v({name:e}),style:F}),(0,x.jsx)(k,{label:"Phone",testID:"request-phone",keyboardType:"phone-pad",autoComplete:"tel",value:D.phone,onChangeText:e=>v({phone:e}),style:F}),(0,x.jsx)(k,{label:"Email",testID:"request-email",keyboardType:"email-address",autoCapitalize:"none",autoComplete:"email",value:D.email,onChangeText:e=>v({email:e}),style:F}),(0,x.jsx)(k,{label:'table'===l?'Notes (allergies, occasion)':'Notes',testID:"request-notes",multiline:!0,maxLength:2e3,value:D.notes,onChangeText:e=>v({notes:e}),style:F}),(0,x.jsx)(u.default,{style:{display:'none'},accessibilityElementsHidden:!0,importantForAccessibility:"no-hide-descendants",children:(0,x.jsx)(k,{label:"Leave this empty",value:S,onChangeText:w})}),B?(0,x.jsx)(k,{label:`Security check: ${B.question} = ?`,testID:"request-answer",keyboardType:"number-pad",value:C,onChangeText:I,style:F}):(0,x.jsx)(h.T,{size:18,center:!0,children:"Preparing security check\u2026"}),R?(0,x.jsx)(h.Banner,{kind:"warn",title:"Please check your request",children:R}):null,(0,x.jsx)(h.Button,{testID:"request-submit",label:$?'Sending request\u2026':'Send request',disabled:$||!B,onPress:()=>{L()}})]}),(0,x.jsx)(h.Button,{kind:"secondary",label:M?'greenside'===e?'Back to the restaurant':c?.enabled?'Back to the hotel':'Back to Customer home':'Back to Customer home',onPress:T})]})};var e,t=_r(d[0]),s=_r(d[1]),n=_r(d[2]),r=_r(d[3]),o=_r(d[4]),l=_r(d[5]),u=(e=l)&&e.__esModule?e:{default:e},c=_r(d[6]),h=_r(d[7]),y=_r(d[8]),p=_r(d[9]),b=_r(d[10]),x=_r(d[11]);function k({label:e,...t}){return(0,x.jsxs)(u.default,{style:{gap:6,alignSelf:'stretch',width:'100%'},children:[(0,x.jsx)(h.T,{size:18,weight:"semibold",center:!0,children:e}),(0,x.jsx)(c.TextInput,{accessibilityLabel:e,placeholderTextColor:y.colours.muted,...t,style:[{minHeight:48,fontSize:18,color:y.colours.text,backgroundColor:y.colours.surface2,borderWidth:1,borderColor:y.colours.border,borderRadius:12,padding:12},t.multiline?{minHeight:96,textAlignVertical:'top'}:null,t.style]})]})}},863,[6,940,1392,1393,30,127,875,813,821,11,1019,24]); +__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"STEP_IDS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"STEP_TITLE",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"TEMPLATE_LABEL",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"DAY_NAMES",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"WEEK_ORDER",{enumerable:!0,get:function(){return u}}),e.cleanQuestionnaire=function(t,s){if(!t||'object'!=typeof t)return null;const o=t,n=o.venue??{},u=l(n.name,80);if(!u)return null;const b={};for(let a=0;a<7;a++){const t=o.hours?.days?.[a],s=Array.isArray(t)?p(t[0]):null,n=Array.isArray(t)?p(t[1]):null;b[a]=s&&n?[s,n]:null}const y=['cafe','bistro','restaurant','custom'].includes(o.tables?.template)?o.tables.template:'custom',f=(a,t)=>'number'==typeof a&&a>=0&&a<=t?Math.round(a):void 0,h=o.features??{};return{version:1,venueId:l(s??o.venueId,60)||'venue',source:'signup-form'===o.source||'from-config'===o.source?o.source:'imported',submittedAt:l(o.submittedAt,10),onboardedAt:l(o.onboardedAt,10),venue:{name:u,tagline:l(n.tagline,120),address:l(n.address,200),phone:l(n.phone,30),email:l(n.email,120),website:l(n.website,120),hasLogo:!!n.hasLogo},hours:{days:b,note:l(o.hours?.note,300)},tables:{template:y,tables:f(o.tables?.tables,300),covers:f(o.tables?.covers,2e3),areas:Array.isArray(o.tables?.areas)?o.tables.areas.map(a=>l(a,40)).filter(Boolean).slice(0,12):void 0},team:Array.isArray(o.team)?o.team.map(a=>({name:l(a?.name,60)??'',role:d.includes(a?.role)?a.role:'staff',job:l(a?.job,60),email:l(a?.email,120),phone:l(a?.phone,30)})).filter(a=>a.name).slice(0,200):[],suppliers:Array.isArray(o.suppliers)?o.suppliers.map(a=>({name:l(a?.name,80)??'',category:l(a?.category,40),phone:l(a?.phone,30),email:l(a?.email,120)})).filter(a=>a.name).slice(0,100):[],pay:o.pay&&'object'==typeof o.pay?(0,a.cleanPay)(o.pay):void 0,accounts:Array.isArray(o.accounts)?o.accounts.map(a=>({provider:l(a?.provider,40)??'',handle:l(a?.handle,120)})).filter(a=>/^[a-z0-9-]+$/.test(a.provider)).slice(0,40):void 0,features:{bookings:c(h.bookings,!0),takeaway:c(h.takeaway,!0),orderAtTable:c(h.orderAtTable,!1),tips:c(h.tips,!0),rota:c(h.rota,!0),games:c(h.games,!0),specials:c(h.specials,!0)},notes:l(o.notes,1e3)}},e.questionnaireFromFacts=function(a,t){const s=a.tables??0,o=0===s?'custom':s<=9?'cafe':s<=16?'bistro':'restaurant';return{version:1,venueId:a.id,source:'from-config',venue:{name:a.name,tagline:a.tagline,address:a.address,phone:a.phone,website:a.website,hasLogo:a.hasLogo},hours:{days:{...a.hours},note:a.hoursNote},tables:{template:a.tables?'custom':o,tables:a.tables,covers:a.covers,areas:a.areas},team:a.team,suppliers:a.suppliers,pay:a.pay,features:{bookings:!0,takeaway:!1!==a.takeaway,orderAtTable:!!a.orderAtTable,tips:!0,rota:!0,games:!1!==a.games,specials:!0},...t}},e.mergeQuestionnaire=function(a,t){if(!t)return a;const s={},o=Object.values(t.hours?.days??{}).some(Boolean);for(let n=0;n<7;n++)s[n]=o?t.hours.days[n]??null:a.hours.days[n]??null;return{...a,...t,venue:{...a.venue,...Object.fromEntries(Object.entries(t.venue).filter(([,a])=>void 0!==a&&''!==a))},hours:{days:s,note:t.hours?.note??a.hours.note},tables:{...a.tables,...Object.fromEntries(Object.entries(t.tables).filter(([,a])=>void 0!==a))},team:t.team.length?t.team:a.team,suppliers:t.suppliers.length?t.suppliers:a.suppliers,pay:t.pay??a.pay,accounts:t.accounts?.length?t.accounts:a.accounts,features:{...a.features,...t.features}}},e.hoursLines=function(a){return u.map(t=>({day:n[t],text:a[t]?`${a[t][0]} to ${a[t][1]}`:'Closed'}))},Object.defineProperty(e,"EXAMPLE_QUESTIONNAIRE",{enumerable:!0,get:function(){return b}});var a=r(_d[0]);const t=['venue','hours','tables','team','suppliers','accounts','pay','features'],s={venue:'Your venue',hours:'Opening hours',tables:'Table plan',team:'Your team',suppliers:'Suppliers',accounts:'Connected accounts',pay:'Pay & tips',features:'Features'},o={cafe:'Small caf\xe9 (about 8 tables)',bistro:'Bistro (about 14 tables)',restaurant:'Restaurant (about 24 tables, 2 areas)',custom:'My own layout'},n=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],u=[1,2,3,4,5,6,0],l=(a,t=200)=>'string'==typeof a?a.trim().slice(0,t):void 0,c=(a,t)=>'boolean'==typeof a?a:t,p=a=>'string'==typeof a&&/^([01]\d|2[0-3]):[0-5]\d$/.test(a)?a:null,d=['owner','manager','staff'];const b={version:1,venueId:'example',source:'signup-form',submittedAt:'2026-10-20',venue:{name:'Example Harbour Caf\xe9',tagline:'Coffee, cakes and crab rolls',address:'1 Example Quay, Exampletown',phone:'01632 960000',email:'hello@example.com',website:'example.com',hasLogo:!1},hours:{days:{0:['10:00','16:00'],1:null,2:['09:00','16:00'],3:['09:00','16:00'],4:['09:00','16:00'],5:['09:00','20:00'],6:['09:00','20:00']},note:'Shorter hours in winter'},tables:{template:'cafe',tables:8,covers:30,areas:['Inside','Terrace']},team:[{name:'Alex Example',role:'owner'},{name:'Sam Example',role:'manager',job:'Front of house manager'},{name:'Jo Example',role:'staff',job:'Barista'}],suppliers:[{name:'Example Dairy',category:'Dairy'},{name:'Example Fish Co',category:'Fish & seafood'}],pay:{tipsFrequency:'fortnightly',tipsAnchorPayday:'2026-11-02',tipsEndsDaysBefore:1,wagePayDay:28,wageCutoffDay:23,weekendRule:'none'},features:{bookings:!0,takeaway:!0,orderAtTable:!1,tips:!0,rota:!0,games:!0,specials:!0}}},864,[1109]); +__d(function(e,a,i,n,r,o,s){r.exports={version:1,venueId:"kirkmichael",source:"from-config",submittedAt:"2026-11-05",onboardedAt:"2026-11-05",venue:{name:"The Kirkmichael Arms",tagline:"Michelin-listed restaurant and bar in Kirkmichael, Ayrshire",address:"3-5 Straiton Road, Kirkmichael, South Ayrshire KA19 7PH",phone:"01655 750 200",email:"enquiries@thekirkmichaelarms.co.uk",website:"https://www.kirkmichaelarms.co.uk/",hasLogo:!0},hours:{days:{0:["13:00","22:30"],1:null,2:null,3:null,4:["13:00","22:30"],5:["13:00","22:30"],6:["13:00","22:30"]},note:"Thu\u2013Sun from 1pm; schema close 22:30. Michelin lists Sunday from 12:30 \u2014 confirm. Closed Mon\u2013Wed."},tables:{template:"restaurant",tables:null,covers:56,areas:["Restaurant","Bar","Private dining (The Room)"],needsConfirmation:!0,note:"56 covers from historical sale listing; private dining about 18. Table count unknown \u2014 ask Gordon/Justin."},team:[{name:"Justin Galea",role:"owner",job:"Chef & Owner",email:"enquiries@thekirkmichaelarms.co.uk",phone:"01655 750 200"}],suppliers:[],accounts:[{provider:"instagram",handle:"@kirkmichaelarms_unfiltered"},{provider:"facebook",handle:"kirkmichaelarms"},{provider:"gmail",handle:"enquiries@thekirkmichaelarms.co.uk"},{provider:"tripadvisor",handle:"The Kirkmichael Arms"},{provider:"google-business",handle:"The Kirkmichael Arms"}],pay:{tipsFrequency:"fortnightly",tipsAnchorPayday:"2026-11-07",tipsEndsDaysBefore:1,wagePayDay:28,wageCutoffDay:23,weekendRule:"none"},features:{bookings:!0,takeaway:!1,orderAtTable:!1,tips:!0,rota:!0,games:!0,specials:!0},notes:"Seed as venue_id kirkmichael (separate tenant). Chef-owner Justin Galea. Brand accent #B87754 (whisky amber); lion emblem + wordmark in branding/. Deposit amount unknown \u2014 leave off until Gordon confirms. Bookings currently via own site /booking (own website booking page noted in research only). Menu from live Sample menus 2026-11-05; specials board changes often. Never blend with other venues' data."}},865,[]); +__d(function(e,n,a,o,s,t,i){s.exports={version:1,venueId:"wildings",source:"from-config",submittedAt:"2026-11-05",venue:{name:"Wildings Hotel & Restaurant",tagline:"Coastal cuisine with character",address:"Maidens Road, Maidens, KA26 9NR",phone:"01655 331 401",email:"bookings@wildingsrestaurant-hotel.co.uk",website:"https://www.wildingshotel.com/",hasLogo:!0},hours:{days:{0:["12:00","21:00"],1:["12:00","21:00"],2:["12:00","21:00"],3:["12:00","21:00"],4:["12:00","21:00"],5:["12:00","21:00"],6:["12:00","21:00"]},note:"Lunch Mon\u2013Sat 12:00\u201314:00, Sun 12:00\u201314:30; dinner daily 18:00\u201321:00 (closed 14:00\u201318:00). Bar hours not published. Sunday lunch end time to confirm."},tables:{template:"restaurant",tables:null,covers:null,areas:["Dining room 1","Dining room 2"],needsConfirmation:!0,note:"Two dining rooms per website; names, tables and covers unknown."},team:[],suppliers:[],accounts:[{provider:"facebook",handle:"profile.php?id=100057663900963"},{provider:"instagram",handle:"@wildingsmaidens"}],pay:{tipsFrequency:"fortnightly",tipsAnchorPayday:"2026-11-07",tipsEndsDaysBefore:1,wagePayDay:28,wageCutoffDay:23,weekendRule:"none"},features:{bookings:!0,takeaway:!1,orderAtTable:!1,tips:!0,rota:!0,games:!0,specials:!0},notes:"Separate tenant, venue id wildings. Accent #FFE3A5 (logo star gold) on ink #272A2F. No demo/local roster. Authorised real team is loaded from this venue\u2019s server; remaining staff list and personal manager contacts are to confirm. Deposit off until confirmed. Bookings are by phone/email today; site is Duda, so no Wix sync. Pay settings are app defaults, to confirm. Never blend with other venues' data.",onboardedAt:"2026-11-05"}},866,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.QR=function({value:e,size:t=180}){return(0,n.jsx)(o.default,{style:{padding:12,backgroundColor:'#FFFFFF',borderRadius:12,alignSelf:'center',borderWidth:3,borderColor:u.colours.gold},children:(0,n.jsx)(l.default,{value:e,size:t,color:"#0B0B0B",backgroundColor:"#FFFFFF"})})},r(d[0]);var o=e(r(d[1])),l=e(r(d[2])),u=r(d[3]),n=r(d[4])},867,[30,127,1358,821,24]); +__d(function(g,_r,_i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.forecastToday=function(i,u,l,h,f,y){const v=(0,s.examplesAllowed)(),k=(0,a.clampWeeks)(i.settings.forecastMinWeeks),M=v?null:y??(0,a.buildHistory)(i.id,u,l,[],f,k),w=v||!!M?.enough,b=(0,o.hoursFor)(i,f),H=[],O=(0,r.ymd)(f);let S=1;for(const e of h.filter(e=>e.date===O&&(null===e.restaurantId||e.restaurantId===i.id)))H.push(e.title.replace(/\s*\(substitute day\)/gi,'')),!1!==e.busier&&(S*='bank-holiday'===e.kind?1.25:'event'===e.kind?1.15:1.1);if(!b)return{open:!1,hours:[],restOfDay:{covers:0,low:0,high:0,takeaway:0,booked:0},flags:H,suggestions:['Kitchen closed today (per listed hours).'],multiplier:S,example:v,enough:w,minWeeks:k};const I=v?t.EXAMPLE_HISTORY[i.id]??t.EXAMPLE_HISTORY.default:w&&M?M:{covers:{},takeaway:{}},x=f.getDay(),E=c(i,f),C=(0,e.lastFoodOn)(i,O);let N=b.close.getMinutes()>0?b.close.getHours():b.close.getHours()-1;if(C){const[e,t]=C.time.split(':').map(Number);N=Math.min(N,t>0?e:e-1),'kitchen closes'!==C.reason&&H.push(`Last food orders ${C.time} (${C.reason})`)}const $=u.filter(e=>e.restaurantId===i.id&&e.date===O&&['confirmed','seated','finished'].includes(e.status)),_=$.filter(e=>!e.walkIn&&'finished'!==e.status).map(e=>Number(e.time.slice(0,2))),P=Math.min(E[0],b.open.getHours(),..._),T=Math.max(E[1],N,..._),A=[];for(let e=P;e<=T;e++){const t=e>=b.open.getHours()&&e<=N,o=I.covers[x]?.[e]??0,s=I.takeaway[x]?.[e]??0,a=$.filter(t=>!t.walkIn&&'finished'!==t.status&&Number(t.time.slice(0,2))===e).reduce((e,t)=>e+t.partySize,0),n=$.filter(t=>t.walkIn&&['seated','finished'].includes(t.status)&&Number(t.time.slice(0,2))===e).reduce((e,t)=>e+t.partySize,0),u=t?Math.round(o*i.settings.walkInShare*S):0,c=w&&t?Math.max(0,Math.round(o*S*(1-i.settings.walkInShare))-a):0,h=Math.max(n,u)+c,f=a+h,p=l.filter(t=>t.restaurantId===i.id&&'takeaway'===t.type&&'cancelled'!==t.status&&t.slotTime&&new Date(t.slotTime).getHours()===e&&(0,r.ymd)(new Date(t.slotTime))===O).length,y=t?Math.max(p,Math.round(s*S)):p;A.push({hour:e,booked:a,walkIns:h,covers:f,coversLow:w?Math.round(.8*f):f,coversHigh:w?Math.round(1.2*f):f,takeawayPlaced:p,takeaway:y,historicalCovers:o})}const L=p(i,x);if(w&&L){const e=L-A.reduce((e,t)=>e+t.covers,0),t=A.filter(e=>e.hour>=b.open.getHours()&&e.hour<=N);if(e>0&&t.length){const o=t.map(e=>e.historicalCovers),r=n(e,o.reduce((e,t)=>e+t,0)>0?o:t.map(()=>1));t.forEach((e,t)=>{const o=r[t];o&&(e.floorAdded=o,e.walkIns+=o,e.covers+=o,e.coversHigh=Math.max(e.coversHigh,Math.round(1.2*e.covers)))})}const o=A.reduce((e,t)=>e+t.coversLow,0);if(oMath.max(1,e.covers)));t.forEach((t,o)=>{t.coversLow=Math.min(t.covers,t.coversLow+e[o])})}}const R=f.getHours()+(f.getMinutes()>=30?1:0),D=A.filter(e=>e.hour>=R),j=D[0],W=e=>D.reduce((t,o)=>t+e(o),0),F={covers:W(e=>e.covers),low:W(e=>e.coversLow),high:W(e=>e.coversHigh),takeaway:W(e=>e.takeaway),booked:W(e=>e.booked)},G=[],z=i.settings.capacityPerHour,B=D.reduce((e,t)=>!e||t.covers>e.covers?t:e,void 0);B&&B.covers>=.85*z&&G.push(`Dining room near capacity around ${String(B.hour).padStart(2,'0')}:00 (about ${B.covers} of ${z} covers) \u2014 consider pausing or capping takeaway slots then.`);const V=D.find(e=>e.historicalCovers>0&&e.covers>1.1*e.historicalCovers);V&&G.push(`Busier than a usual ${['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'][x]} from ${String(V.hour).padStart(2,'0')}:00 \u2014 consider one more on the floor.`);F.takeaway>=10&&G.push(`About ${F.takeaway} takeaway orders expected \u2014 prep extra haddock and chips.`);w||G.unshift(`Not enough history yet. ${(0,s.notEnoughTip)(k)}`);G.length||G.push('Looks like a normal service \u2014 no action suggested.');return{open:!0,nextHour:j,hours:A,restOfDay:F,flags:H,suggestions:G,multiplier:S,example:v,enough:w,minWeeks:k,minCovers:L??void 0}},_e.spread=n,Object.defineProperty(_e,"ANCHORAGE_FORECAST_HOURS",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"forecastHoursOf",{enumerable:!0,get:function(){return u}}),_e.forecastWindow=c,Object.defineProperty(_e,"ANCHORAGE_MIN_COVERS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"MIN_COVERS_NOTE",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"minCoversOf",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"minCoversOn",{enumerable:!0,get:function(){return p}}),_e.coversRange=function(e,t,o=!0){const r=Math.min(e,t),s=Math.max(e,t),a=r===s?String(r):`${r} to ${s}`;return o?`${a} ${1===s?'cover':'covers'}`:a};var e=_r(d[0]),t=_r(d[1]),o=_r(d[2]),r=_r(d[3]),s=_r(d[4]),a=_r(d[5]);function n(e,t){const o=t.reduce((e,t)=>e+t,0)||1,r=t.map(t=>e*t/o),s=r.map(Math.floor);let a=e-s.reduce((e,t)=>e+t,0);return r.map((e,t)=>[e-Math.floor(e),t]).sort((e,t)=>t[0]-e[0]).forEach(([,e])=>{a>0&&(s[e]++,a--)}),s}const i={0:['12:00','22:00'],1:null,2:null,3:['12:00','22:00'],4:['12:00','22:00'],5:['12:00','22:00'],6:['12:00','22:00']},u=e=>e.settings.forecastHours??('anchorage'===e.id?i:{});function c(e,t){const r=(0,o.hoursFor)(e,t),s=r.close.getMinutes()>0?r.close.getHours():r.close.getHours()-1,a=u(e)[t.getDay()];if(!a)return[r.open.getHours(),s];const[n]=a[0].split(':').map(Number),[i,c]=a[1].split(':').map(Number);return[Math.min(n,r.open.getHours()),Math.max(c>0?i:i-1,s)]}const l={0:50,6:50},h='Gordon, 4 Nov 2026',f=e=>e.settings.minCoversByDay??('anchorage'===e.id?l:{}),p=(e,t)=>{const o=f(e)[t];return o&&o>0?Math.round(o):null}},868,[809,1301,815,818,1118,1302]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.estimateWait=function(t,n,u){const o=Math.max(6,Math.round(n/6*u));return t*o}},869,[]); +__d(function(_g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"uuid",{enumerable:!0,get:function(){return y.uuid}}),_e.nowFrom=S,_e.linesFromBasket=w,Object.defineProperty(_e,"useStore",{enumerable:!0,get:function(){return C}}),Object.defineProperty(_e,"DEMO_CUSTOMER_ID",{enumerable:!0,get:function(){return u.DEMO_CUSTOMER_ID}});var e,t=_r(d[0]),a=_r(d[1]),r=_r(d[2]),n=_r(d[3]),s=_r(d[4]),i=_r(d[5]),o=(e=i)&&e.__esModule?e:{default:e},l=_r(d[6]),c=_r(d[7]),u=_r(d[8]),g=_r(d[9]),m=_r(d[10]),p=_r(d[11]),b=_r(d[12]),f=_r(d[13]),k=_r(d[14]),y=_r(d[15]);const $=(e,t,a)=>e.reduce((e,a)=>a.startsWith(t)?Math.max(e,Number(a.slice(t.length))||0):e,a)+1,I=e=>`${e}-${Math.random().toString(36).slice(2,8)}${Date.now().toString(36).slice(-3)}`;function S(e){return'live'===e.mode?new Date:new Date(e.simStartMs+(Date.now()-e.anchorRealMs))}function h(){const e=(0,u.defaultSimStart)();return{clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()},...(0,u.buildSeed)(e),outbox:[],msgTemplates:{}}}function w(e,t,a){return e.lines.flatMap(e=>{const r=t.find(t=>t.id===e.itemId);if(!r)return[];const n=(0,b.resolveItem)(r),s=(n.optionGroups??[]).flatMap(t=>t.choices.filter(t=>e.choiceIds.includes(t.id))),i=(n.price??0)+s.reduce((e,t)=>e+t.priceDelta,0),o=(0,p.conflictsFor)((0,p.effectiveAllergens)(n,e.choiceIds),a);return[{itemId:n.id,name:n.name,qty:e.qty,unitPrice:i,choices:s.map(e=>e.label),notes:e.notes,contains:o.contains,may:o.may,overridden:!!e.override&&o.contains.every(t=>e.override.allergens.includes(t)),prepMins:n.prepMins}]})}const O=e=>{const t='ABCDEFGHJKLMNPQRSTUVWXYZ23456789',a=()=>Array.from({length:4},()=>t[Math.floor(32*Math.random())]).join('');return`${e}-${a()}-${a()}-${a()}`},C=(0,l.create)()((0,c.persist)((e,t)=>{const a=()=>S(t().clock),r=(t,r,n)=>e(e=>({audit:[{id:I('au'),restaurantId:t,at:a().toISOString(),kind:r,text:n},...e.audit].slice(0,300)})),n=(a,n,s)=>{if(!a||s<=0)return 0;const i=t().giftCards.find(e=>e.code===a&&e.restaurantId===n);if(!i||i.balance<=0)return 0;const o=Math.min(i.balance,s);return e(e=>({giftCards:e.giftCards.map(e=>e.id===i.id?{...e,balance:e.balance-o}:e)})),r(n,'giftcard',`Gift card ${a.slice(0,8)}\u2026 redeemed \xa3${(o/100).toFixed(2)} (balance \xa3${((i.balance-o)/100).toFixed(2)})`),o},s=e=>{const a=t().restaurants.find(t=>t.id===e.restaurantId);a&&e.customerId===t().customer.id&&e.subtotal>=a.settings.stampMinSpend&&t().addStamp(e.restaurantId,e.customerId,'takeaway'===e.type?'Takeaway (auto on collection)':'Table QR bill (auto on payment)')},i=e=>(0,f.templatesFor)(t().msgTemplates[e]),o=a=>{a.length&&(e(e=>({outbox:[...a,...e.outbox].slice(0,300)})),(0,f.deliverQueued)(a.filter(e=>'queued'===e.status),(e,a)=>t().updateOutbox(e,a)))},l=(e,r)=>{const n=t().restaurants.find(e=>e.id===r.restaurantId);n&&o((0,f.composeBooking)(e,r,n,i(n.id),a().toISOString()))},c=e=>{const r=t().restaurants.find(t=>t.id===e.restaurantId);r&&o((0,f.composeOrder)(e,r,i(r.id),a().toISOString()))};return{...h(),resetDemo:()=>e(h()),setClockMode:()=>e({clock:{mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()}}),skipMinutes:()=>{},updateCustomer:t=>e(e=>({customer:{...e.customer,...t}})),setAllergy:(t,a)=>e(e=>{const r=e.customer.allergies.filter(e=>e.allergen!==t);return{customer:{...e.customer,allergies:a?[...r,{allergen:t,severity:a}]:r}}}),startBasket:(t,a,r)=>e(e=>{const n=e.basket.restaurantId===t&&e.basket.mode===a&&e.basket.tableNo===r;return{basket:{restaurantId:t,mode:a,tableNo:r,lines:n?e.basket.lines:[]}}}),addLine:t=>e(e=>({basket:{...e.basket,lines:[...e.basket.lines,{...t,key:I('ln')}]}})),setLineQty:(t,a)=>e(e=>({basket:{...e.basket,lines:a<=0?e.basket.lines.filter(e=>e.key!==t):e.basket.lines.map(e=>e.key===t?{...e,qty:a}:e)}})),overrideLine:(t,r)=>e(e=>({basket:{...e.basket,lines:e.basket.lines.map(e=>e.key===t?{...e,override:{allergens:r,at:a().toISOString()}}:e)}})),clearBasket:()=>e(e=>({basket:{...e.basket,lines:[]}})),placeOrder:({slotTime:s,tip:i,giftCardCode:o,notes:l,paidNow:u,phone:g,email:m})=>{const p=t(),b=p.basket,f=b.restaurantId,k=w(b,p.menu,p.customer.allergies),I=k.reduce((e,t)=>e+t.unitPrice*t.qty,0),S='table'===b.mode,h=$(p.orders.filter(e=>e.restaurantId===f).map(e=>e.ref),S?'Q-':'T-',S?p.counters.table:p.counters.order),O=u?n(o,f,I+i):0,C=I+i,v={id:(0,y.uuid)(),ref:`${S?'Q':'T'}-${h}`,restaurantId:f,customerId:p.customer.id,customerName:p.customer.name,type:b.mode,tableNo:b.tableNo,slotTime:s,lines:k,subtotal:I,tip:i,giftCardApplied:O,giftCardCode:O?o:void 0,total:C,paid:u?C:0,status:'new',createdAt:a().toISOString(),allergies:p.customer.allergies,readiness:{},notes:l,channel:'app',...'takeaway'===b.mode?{phone:g??p.customer.phone,email:m??p.customer.email}:{}};e(e=>({orders:[v,...e.orders],basket:{...e.basket,lines:[]},counters:S?{...e.counters,table:h}:{...e.counters,order:h}}));const A=k.filter(e=>e.overridden);return r(f,'order',`Order ${v.ref} placed (${S?`Table ${b.tableNo}`:'takeaway'})${A.length?` \u2014 ALLERGY OVERRIDE on ${A.map(e=>e.name).join(', ')}`:''}`),v.allergies.length&&r(f,'allergy',`Allergies declared and confirmed by customer on ${v.ref}: ${v.allergies.map(e=>`${e.allergen} (${e.severity})`).join(', ')}`),c(v),v},setOrderStatus:(a,n,i)=>{const o=t().orders.find(e=>e.id===a);o&&((0,k.statusBlock)(o,n,(0,k.linkedBooking)(o,t().bookings))||(e(e=>({orders:e.orders.map(e=>e.id===a?{...e,status:n}:e)})),r(o.restaurantId,'order',`${o.ref} \u2192 ${n}${i?` by ${i}`:''}`),'collected'===n&&'takeaway'===o.type&&s(o)))},ackOrderAllergy:(n,s)=>{const i=t().orders.find(e=>e.id===n);if(!i||!(0,k.canSign)(i,'kitchen',(0,k.linkedBooking)(i,t().bookings)))return;const o={by:s,at:a().toISOString()};e(e=>({orders:e.orders.map(e=>e.id===n?{...e,allergyAck:o,status:'new'===e.status?'acknowledged':e.status}:e)})),r(i.restaurantId,'allergy',`Allergen sign-off 3/5 Kitchen on ${i.ref}: ${s} (chef signed off before cooking)`)},tickOrderAllergy:(n,s,i,o=!0)=>{const l=t().orders.find(e=>e.id===n);if(!l)return;const c={...l.allergyTicks??{}};o?c[s]={by:i,at:a().toISOString()}:delete c[s],e(e=>({orders:e.orders.map(e=>e.id===n?{...e,allergyTicks:c}:e)})),r(l.restaurantId,'allergy',`${l.ref}: kitchen ${o?'confirmed':'unticked'} ${s} (${i})`)},ackReadiness:(n,s,i)=>{const o=t().orders.find(e=>e.id===n);o&&('cook'===s&&(0,k.statusBlock)(o,'preparing',(0,k.linkedBooking)(o,t().bookings))||(e(e=>({orders:e.orders.map(e=>e.id===n?{...e,readiness:{...e.readiness,[s]:{by:i,at:a().toISOString()}},status:'cook'===s&&['new','acknowledged'].includes(e.status)?'preparing':e.status}:e)})),r(o.restaurantId,'order',`${o.ref}: ${'cook'===s?'started cooking':'bagged'} (${i})`)))},handoverCheck:(n,s)=>{const i=t().orders.find(e=>e.id===n);i&&(0,k.canSign)(i,'table',(0,k.linkedBooking)(i,t().bookings))&&(e(e=>({orders:e.orders.map(e=>e.id===n?{...e,handoverCheck:{by:s,at:a().toISOString()}}:e)})),r(i.restaurantId,'allergy',`Allergen sign-off 5/5 Table on ${i.ref}: ${s} (served and checked with the guest; chain complete)`))},signAllergyStep:(n,s,i)=>{const o=t().orders.find(e=>e.id===n);if(!o||!i.trim())return!1;const l=(0,k.linkedBooking)(o,t().bookings);if(!(0,k.canSign)(o,s,l))return!1;if('kitchen'===s)return t().ackOrderAllergy(n,i),!0;if('table'===s)return t().handoverCheck(n,i),!0;const c={by:i,at:a().toISOString()};'booked'===s&&l&&l.allergies.length&&!l.allergyAck?e(e=>({bookings:e.bookings.map(e=>e.id===l.id?{...e,allergyAck:c}:e)})):e(e=>({orders:e.orders.map(e=>e.id===n?{...e,allergyChain:{...e.allergyChain,[s]:c}}:e)}));const u=(0,k.stepInfo)(s);return r(o.restaurantId,'allergy',`Allergen sign-off ${u.n}/5 ${u.label} on ${o.ref}: ${i} (${u.what.toLowerCase()})`),!0},customerSignal:(t,a)=>e(e=>({orders:e.orders.map(e=>e.id===t?{...e,customerSignal:a}:e)})),setSplit:(t,a,r)=>e(e=>({orders:e.orders.map(e=>e.id===t?{...e,tip:r,total:e.subtotal+r,split:{ways:a,paidShares:e.split?.paidShares??0}}:e)})),payTable:(a,{shares:i,giftCardCode:o})=>{const l=t().orders.find(e=>e.id===a);if(!l)return;const c=l.split?.ways??1,u=Math.ceil(l.total/c),g=Math.min(c,(l.split?.paidShares??0)+i),m=g>=c,p=m?l.total-l.paid:Math.min(l.total-l.paid,u*i),b=n(o,l.restaurantId,p),f={...l,giftCardApplied:l.giftCardApplied+b,giftCardCode:b?o:l.giftCardCode,paid:l.paid+p,split:{ways:c,paidShares:g},status:m?'closed':l.status};e(e=>({orders:e.orders.map(e=>e.id===a?f:e)})),r(l.restaurantId,'order',`${l.ref} (Table ${l.tableNo}) ${m?'bill paid in full':`share ${g}/${c} paid`} (paid at the till)`),m&&s(f)},createBooking:n=>{const s=$(t().bookings.filter(e=>e.restaurantId===n.restaurantId).map(e=>e.ref),'BK-',t().counters.booking),i=t().restaurants.find(e=>e.id===n.restaurantId)?.settings,o='online'===n.source&&!!i&&(n.partySize>(i.autoAcceptUpTo??7)||!!i.reviewRequests&&!!n.notes.trim()),c={...n,id:(0,y.uuid)(),ref:`BK-${s}`,status:o?'pending':'confirmed',createdAt:a().toISOString()};return e(e=>({bookings:[...e.bookings,c],counters:{...e.counters,booking:s}})),r(c.restaurantId,'booking',`Booking ${o?'request ':''}${c.ref}: ${c.name}, ${c.partySize} on ${c.date} ${c.time}${c.source?` (${c.source})`:''}${c.allergies.length?' \u2014 allergies declared':''}`),l(o?'booking-request':'booking-confirmation',c),c},decideBooking:(n,s,i)=>{const o=t().bookings.find(e=>e.id===n);if(!o||'pending'!==o.status)return;const c={by:i,at:a().toISOString(),outcome:s},u='confirmed'===s?'confirmed':'cancelled';e(e=>({bookings:e.bookings.map(e=>e.id===n?{...e,status:u,decided:c}:e)})),r(o.restaurantId,'booking',`Booking request ${o.ref} (${o.name}, ${o.partySize}) ${s} by ${i}`),l('confirmed'===s?'booking-confirmation':'booking-declined',{...o,status:u})},addOutbox:t=>e(e=>({outbox:[...t,...e.outbox].slice(0,300)})),updateOutbox:(t,a)=>e(e=>({outbox:e.outbox.map(e=>e.id===t?{...e,...a}:e)})),clearOutbox:t=>e(e=>({outbox:e.outbox.filter(e=>e.restaurantId!==t)})),setTemplate:(t,a,r)=>e(e=>{const n={...e.msgTemplates[t]??{}};return null===r?delete n[a]:n[a]={...n[a]??{},...r},{msgTemplates:{...e.msgTemplates,[t]:n}}}),acceptOrder:(n,s,i)=>{const o=t().orders.find(e=>e.id===n);if(!o)return!1;const l='new'===o.status&&!!(0,k.statusBlock)(o,'acknowledged',(0,k.linkedBooking)(o,t().bookings)),c=a(),u=i?new Date(c.getTime()+6e4*i).toISOString():o.readyBy;return e(e=>({orders:e.orders.map(e=>e.id===n?{...e,status:'new'!==e.status||l?e.status:'acknowledged',accepted:e.accepted??{by:s,at:c.toISOString()},readyBy:u}:e)})),r(o.restaurantId,'order',`${o.ref} accepted by ${s}${i?`, ready by ${String(new Date(u).getHours()).padStart(2,'0')}:${String(new Date(u).getMinutes()).padStart(2,'0')}`:''}`),!l},setBookingStatus:(n,s)=>{const i=t().bookings.find(e=>e.id===n),o=a().toISOString();e(e=>({bookings:e.bookings.map(e=>e.id===n?{...e,status:s,...'seated'===s?{seatedAt:o}:'finished'===s?{finishedAt:o}:{}}:e)})),i&&r(i.restaurantId,'booking',`${i.ref} ${i.name} \u2192 ${s}`)},seatWalkIn:(n,s,i,o)=>{const l=a(),c=`${l.getFullYear()}-${String(l.getMonth()+1).padStart(2,'0')}-${String(l.getDate()).padStart(2,'0')}`,u=`${String(l.getHours()).padStart(2,'0')}:${String(l.getMinutes()).padStart(2,'0')}`,g=t().bookings.filter(e=>e.restaurantId===n&&e.walkIn&&e.date===c).reduce((e,t)=>Math.max(e,Number(t.ref.slice(2))||0),0)+1,m={id:(0,y.uuid)(),ref:`W-${g}`,restaurantId:n,customerId:null,name:'Walk-in',partySize:s,date:c,time:u,table:i||void 0,allergies:[],notes:(o??'').trim(),status:'seated',security:'none',depositPaid:0,createdAt:l.toISOString(),seatedAt:l.toISOString(),walkIn:!0,source:'walk-in'};return e(e=>({bookings:[...e.bookings,m]})),r(n,'walkin',`Walk-in ${m.ref} seated: ${s} cover(s)${i?`, Table ${i}`:', table to assign'}`),m},setBookingTable:(a,n)=>{const s=t().bookings.find(e=>e.id===a);e(e=>({bookings:e.bookings.map(e=>e.id===a?{...e,table:n}:e)})),s&&r(s.restaurantId,'booking',`${s.ref} ${s.name} \u2192 ${n?n.includes('+')?`Tables ${n.split('+').join(' + ')}`:`Table ${n}`:'no table'}`)},updateBooking:(a,n)=>{const s=t().bookings.find(e=>e.id===a);e(e=>({bookings:e.bookings.map(e=>e.id===a?{...e,...n}:e)})),s&&r(s.restaurantId,'booking',`${s.ref} ${s.walkIn?'Walk-in':s.name} moved/updated${n.table?` \u2192 Table ${n.table}`:''}${n.time?` at ${n.time}`:''}${n.durationMins?` for ${n.durationMins} min`:''}`)},undoWalkIn:a=>{const n=t().bookings.find(e=>e.id===a);n&&n.walkIn&&(e(e=>({bookings:e.bookings.filter(e=>e.id!==a)})),r(n.restaurantId,'walkin',`Walk-in ${n.ref} undone`))},ackBookingAllergy:(n,s)=>{const i=t().bookings.find(e=>e.id===n);i&&!i.allergyAck&&(e(e=>({bookings:e.bookings.map(e=>e.id===n?{...e,allergyAck:{by:s,at:a().toISOString()}}:e)})),r(i.restaurantId,'allergy',`Allergen sign-off 1/5 Booked on ${i.ref} (${i.name}): ${s} (allergy recorded)`))},joinWaitlist:(n,s,i,o)=>{const l=t().waitlist.filter(e=>e.restaurantId===n).reduce((e,t)=>Math.max(e,t.number),0)+1,c={id:I('wl'),restaurantId:n,number:l,name:s,partySize:i,joinedAt:a().toISOString(),status:'waiting',customerId:o};return e(e=>({waitlist:[...e.waitlist,c]})),r(n,'waitlist',`${s} (${i}) joined the waitlist as #${l}`),c},setWaitlistStatus:(a,n)=>{const s=t().waitlist.find(e=>e.id===a);e(e=>({waitlist:e.waitlist.map(e=>e.id===a?{...e,status:n}:e)})),s&&(r(s.restaurantId,'waitlist',`Waitlist #${s.number} ${s.name} \u2192 ${n}`),'seated'===n&&t().addWalkIn(s.restaurantId,s.partySize))},addWalkIn:(t,a)=>{e(e=>({walkIns:{...e.walkIns,[t]:(e.walkIns[t]??0)+a}})),r(t,'walkin',`Walk-in seated: ${a} cover(s)`)},addStamp:(n,s,i)=>{const o=t().restaurants.find(e=>e.id===n);o&&(e(e=>{const t=e.stampCards.find(e=>e.restaurantId===n&&e.customerId===s),r=t??{restaurantId:n,customerId:s,stamps:0,rewardsAvailable:0,history:[]};let l=r.stamps+1,c=r.rewardsAvailable;l>=o.settings.stampTarget&&(l=0,c+=1);const u={...r,stamps:l,rewardsAvailable:c,history:[{at:a().toISOString(),source:i},...r.history]};return{stampCards:t?e.stampCards.map(e=>e===t?u:e):[...e.stampCards,u]}}),r(n,'stamp',`Stamp added (${i})`))},redeemReward:(t,a)=>{e(e=>({stampCards:e.stampCards.map(e=>e.restaurantId===t&&e.customerId===a&&e.rewardsAvailable>0?{...e,rewardsAvailable:e.rewardsAvailable-1}:e)})),r(t,'stamp','Loyalty reward redeemed')},buyGiftCard:(n,s,i,o)=>{const l=n.slice(0,3).toUpperCase(),c={id:I('gc'),code:O(l),restaurantId:n,initial:s,balance:s,ownerId:t().customer.id,recipientName:i,message:o,createdAt:a().toISOString()};return e(e=>({giftCards:[c,...e.giftCards]})),r(n,'giftcard',`Gift card sold \xa3${(s/100).toFixed(2)} (demo payment)`),c},redeemGiftCard:(a,n,s)=>{const i=t().giftCards.find(e=>e.code.toUpperCase()===a.trim().toUpperCase());return!(!i||n<=0||n>i.balance)&&(e(e=>({giftCards:e.giftCards.map(e=>e.id===i.id?{...e,balance:e.balance-n}:e)})),r(i.restaurantId,'giftcard',`Gift card ${i.code} redeemed \xa3${(n/100).toFixed(2)} by ${s}`),!0)},honourLegacyCard:(t,n,s,i)=>{const o={id:I('gc'),code:n.trim().toUpperCase(),restaurantId:t,initial:s,balance:s,ownerId:'legacy',recipientName:'Legacy website bookings gift card',message:`Honoured by ${i}`,createdAt:a().toISOString().slice(0,10),legacy:!0};return e(e=>({giftCards:[o,...e.giftCards]})),r(t,'giftcard',`Legacy website bookings gift card ${o.code} honoured (\xa3${(s/100).toFixed(2)}) by ${i}`),o},addEvent:t=>e(e=>({events:[...e.events,{...t,id:I('ev')}]})),addRating:t=>{e(e=>({ratings:[{...t,id:I('rt'),createdAt:a().toISOString()},...e.ratings],orders:t.orderId?e.orders.map(e=>e.id===t.orderId?{...e,rated:!0}:e):e.orders})),r(t.restaurantId,'rating',`Private rating ${t.stars}/5 from ${t.customerName}`)},updateMenuItem:(a,n)=>{const{name:s,section:i,price:o,allergens:l,allergenNotes:c,...u}=n,g={};void 0!==s&&(g.dish=s),void 0!==i&&(g.section=i),'price'in n&&(g.price=o??null),void 0!==l&&(g.allergens=l),'allergenNotes'in n&&(g.allergenNotes=c);const m='optionGroups'in n,p=(0,b.menuCardBridge)();p&&(Object.keys(g).length||m)&&p.menuEdited(a,g,'CoverCharge for Managers',m);const f=p?u:n;Object.keys(f).length&&e(e=>({menu:e.menu.map(e=>e.id===a?{...e,...f}:e)}));const k=t().menu.find(e=>e.id===a);k&&Object.keys(f).length&&r(k.restaurantId,'menu',`Menu: ${(0,b.resolveItem)(k).name} updated`)},setSignOff:(t,r)=>{const n=(0,b.menuCardBridge)();n?r?n.signOff(t,r):n.menuEdited(t,{},'CoverCharge for Managers',!0):e(e=>({menu:e.menu.map(e=>e.id===t?{...e,signOff:r?{by:r,at:a().toISOString().slice(0,10)}:null}:e)}))},addAudit:(e,t,a)=>r(e,t,a),updateSettings:(t,a)=>{e(e=>({restaurants:e.restaurants.map(e=>e.id===t?{...e,settings:{...e.settings,...a}}:e)})),'takeawayPaused'in a&&r(t,'order',"Takeaway slots "+(a.takeawayPaused?'PAUSED':'resumed'))},addMenuItem:t=>{const a=I('m');return e(e=>({menu:[...e.menu,{...t,id:a}]})),(0,b.menuCardBridge)()?.menuItemAdded({...t,id:a}),r(t.restaurantId,'menu',`Menu: ${t.name} added (recipe card awaiting head chef sign-off)`),a},updateRestaurant:(t,a)=>{e(e=>({restaurants:e.restaurants.map(e=>e.id===t?{...e,...a}:e)})),r(t,'menu',`Restaurant info updated (${Object.keys(a).join(', ')})`)},placeManualOrder:({restaurantId:n,type:s,channel:i,customerName:o,phone:l,email:u,tableNo:g,slotTime:m,lines:f,allergies:k,notes:I,by:S})=>{const h=t(),w=f.flatMap(({itemId:e,qty:t})=>{const a=h.menu.find(t=>t.id===e);if(!a||t<=0)return[];const r=(0,b.resolveItem)(a),n=(0,p.conflictsFor)((0,p.effectiveAllergens)(r),k);return[{itemId:e,name:r.name,qty:t,unitPrice:r.price??0,choices:[],notes:'',contains:n.contains,may:n.may,overridden:!1,prepMins:r.prepMins}]}),O=w.reduce((e,t)=>e+t.unitPrice*t.qty,0),C='table'===s,v=$(h.orders.filter(e=>e.restaurantId===n).map(e=>e.ref),C?'Q-':'T-',C?h.counters.table:h.counters.order),A={id:(0,y.uuid)(),ref:`${C?'Q':'T'}-${v}`,restaurantId:n,customerId:`manual-${i}`,customerName:o||(C?`Table ${g}`:'Walk-in'),type:s,tableNo:g,slotTime:m,lines:w,subtotal:O,tip:0,giftCardApplied:0,total:O,paid:0,status:'new',createdAt:a().toISOString(),allergies:k,readiness:{},notes:I,channel:i,...l?{phone:l}:{},...u?{email:u}:{},...k.length?{allergyChain:{booked:{by:S,at:a().toISOString()}}}:{}};return e(e=>({orders:[A,...e.orders],counters:C?{...e.counters,table:v}:{...e.counters,order:v}})),r(n,'order',`Order ${A.ref} taken by ${S} (${'phone'===i?'phone':'walk-in'===i?'walk-in takeaway':`Table ${g}`})`),k.length&&r(n,'allergy',`Allergen sign-off 1/5 Booked on ${A.ref}: ${S} recorded ${k.map(e=>`${e.allergen} (${e.severity})`).join(', ')}`),(l||u)&&c(A),A},ackAlert:(t,r)=>e(e=>({alertAcks:{...e.alertAcks,[t]:{by:r,at:a().toISOString()}}}))}},{name:'covercharge-demo-v1',version:9,migrate:async(e,t)=>{if(!e)return e;if(n.LIVE_VENUE_BUILD)return await(0,s.archiveChefCache)('core',e),Object.assign(e,(0,r.stripCoreLiveSamples)(e)),e.clock={mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()},e;if(e.clock={mode:'live',simStartMs:Date.now(),anchorRealMs:Date.now()},t<6){try{e.restaurants=(e.restaurants??[]).map(e=>'saltmarsh'===e?.id?{...e,name:'The Venue'}:e)}catch{}try{e.restaurants=(e.restaurants??[]).map(e=>'anchorage'===e?.id&&JSON.stringify(e.kitchenHours)===JSON.stringify(g.ANCHORAGE_KITCHEN_OLD)?{...e,kitchenHours:g.ANCHORAGE_KITCHEN,hoursNote:'Kitchen (food) hours from Gordon, 30 Oct 2026: closed Mon\u2013Tue. The closing time is last food orders. Bar hours not set.'}:e)}catch{}}if(t<5)try{e.events=(e.events??[]).map(e=>'string'==typeof e?.title&&/\(substitute day\)/i.test(e.title)?{...e,title:e.title.replace(/\s*\(substitute day\)/gi,'').trim()}:e)}catch{}if(t<4)try{e.restaurants=(e.restaurants??[]).map(e=>'anchorage'===e.id&&e.settings&&!e.settings.pay?{...e,settings:{...e.settings,pay:g.ANCHORAGE_PAY}}:e)}catch{}if(t<3)try{e.restaurants=(e.restaurants??[]).map(e=>'anchorage'===e.id?{...e,settings:{...e.settings,orderAtTable:!1}}:e),e.orders=(e.orders??[]).filter(e=>'ord-seed-3'!==e.id&&'Q-2018'!==e.ref),e.audit=(e.audit??[]).filter(e=>!String(e.text??'').includes('Q-2018'))}catch{}if(t>=2)return e;try{const t=(0,u.buildSeed)((0,u.defaultSimStart)()),a=new Map(t.bookings.map(e=>[e.id,e])),r=new Set((0,m.anchoragePlan)().tables.map(e=>e.name)),n=e=>!e||e.split('+').every(e=>r.has(e));e.bookings=(e.bookings??[]).map(e=>{const t=a.get(e.id);return t?{...e,table:t.table,dog:t.dog,notes:t.notes}:'anchorage'!==e.restaurantId||n(e.table)?e:{...e,table:void 0}})}catch{}return e},merge:(e,r)=>{const n={...r,...e};return a.IS_WILDINGS&&(n.restaurants=n.restaurants.map(t.withWildingsAddress)),n},storage:(0,c.createJSONStorage)(()=>o.default)}))},870,[1127,5,1128,833,1131,1115,951,1116,1132,3,944,814,1113,823,939,1032]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useShallow",{enumerable:!0,get:function(){return o}});var e,t=r(d[0]),u=(e=t)&&e.__esModule?e:{default:e},n=r(d[1]);function o(e){const t=u.default.useRef(void 0);return u=>{const o=e(u);return(0,n.shallow)(t.current,o)?t.current:t.current=o}}},871,[30,1140]); +__d(function(g,_r,i,_a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TABLE_ORDER_DEFAULT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"cleanToken",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"isTableNo",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"fromRow",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"toRow",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"hm",{enumerable:!0,get:function(){return s}}),e.openAt=function(t,r){const n=a(r),o=t.openFrom?a(t.openFrom):null,l=t.lastOrders?a(t.lastOrders):null;return null!==o&&null!==l?o<=l?n>=o&&n=o||n=o:null===l||n{const r=(t??'').trim().toUpperCase();return/^[A-Z2-9]{16}$/.test(r)?r:null},n=t=>/^[0-9]{1,4}$/.test(t),o=r=>r?{on:!!r.is_on,tables:Array.isArray(r.tables)?r.tables.map(String):null,staffAccept:!1!==r.staff_accept,openFrom:r.open_from?String(r.open_from).slice(0,5):null,lastOrders:r.last_orders?String(r.last_orders).slice(0,5):null,guestTip:r.guest_tip??''}:{...t},l=t=>({is_on:t.on,tables:t.tables&&t.tables.length?t.tables.filter(n):null,staff_accept:t.staffAccept,open_from:t.openFrom,last_orders:t.lastOrders,guest_tip:t.guestTip.slice(0,300)}),a=t=>{const[r,n]=t.split(':').map(Number);return 60*r+n},s=t=>`${String(Math.floor(t/60)%24).padStart(2,'0')}:${String(t%60).padStart(2,'0')}`;const c=(t,r)=>t.reduce((t,n)=>t+n.qty*(r.find(t=>t.id===n.id)?.pricePence??0),0),u=(t,r,n)=>t.map(t=>r.find(r=>r.id===t.id)).filter(t=>!!t&&(t.allergens.some(t=>n.includes(t))||t.mayContain.some(t=>n.includes(t)))),f=(t,r)=>`${t.replace(/\/$/,'')}/customer-app/index.html?table=${r}`,p=t=>'table'===t.type&&'table-qr'===t.channel,b=t=>p(t)&&!!t.held&&!t.accepted&&'cancelled'!==t.status,m=t=>!b(t),y=t=>'cancelled'===t.status?t.cancelReason?`Cancelled: ${t.cancelReason}`:'Cancelled by the staff.':t.held&&!t.accepted?'Sent. Waiting for a member of staff to accept it.':'served'===t.status||'collected'===t.status||'closed'===t.status?'Served. Enjoy!':'ready'===t.status?'Ready: on its way to your table.':'Accepted: the kitchen has your order.',O=['Sold out','Wrong table','Sent twice','Kitchen closed','Guest asked to cancel'],h='Please pay at the bar or till. Paying by card from your phone is coming later.'},874,[]); +__d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.venueTextStyle=d,Object.defineProperty(_e,"Text",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"TextInput",{enumerable:!0,get:function(){return h}});var t=r(_d[0]),n=r(_d[1]),o=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(n){if('default'!==n){var o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,t})(r(_d[2])),f=e(r(_d[3])),u=e(r(_d[4])),l=e(r(_d[5])),c=r(_d[6]),s=r(_d[7]);function d(e){if(!t.IS_SOUTERS)return e;const n=l.default.flatten(e)||{};return{...n,...'number'==typeof n.fontSize?{fontSize:(0,c.soutersFont)(n.fontSize)}:{},...'number'==typeof n.lineHeight?{lineHeight:(0,c.soutersFont)(n.lineHeight)}:{},...'string'==typeof n.color?{color:(0,c.soutersInk)(n.color)}:{}}}const y=o.forwardRef(function({style:e,...t},n){return(0,s.jsx)(f.default,{...t,ref:n,style:d(e)})}),p=o.forwardRef(function({style:e,placeholderTextColor:t,...n},o){const f=d([{fontSize:14,color:'#F5F1E8'},e]),y=l.default.flatten(f)||{};return(0,s.jsx)(u.default,{...n,ref:o,placeholderTextColor:'string'==typeof t?(0,c.soutersInk)(t):'#B8B0A0',style:[f,{minHeight:Math.max(44,'number'==typeof y.minHeight?y.minHeight:44),minWidth:Math.max(44,'number'==typeof y.minWidth?y.minWidth:44)}]})}),S=o.forwardRef(function({style:e,...t},o){const u=l.default.flatten(e)||{};return(0,s.jsx)(f.default,{...t,ref:o,style:[u,{color:u.color===n.QUEUED_BRAND?.accent?n.QUEUED_BRAND.smallTextAccent:u.color}]})}),_=t.IS_QUEUED_VENUE?S:t.IS_SOUTERS?y:f.default,h=t.IS_SOUTERS?p:u.default},875,[5,1232,30,206,273,46,912,24]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SOUTERS_BG",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"SOUTERS_SURFACE",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"SOUTERS_TYPE_SCALE",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"soutersFont",{enumerable:!0,get:function(){return S}}),Object.defineProperty(e,"soutersSurface",{enumerable:!0,get:function(){return f}}),e.soutersInk=function(o){if(!t.IS_SOUTERS)return o;const c=(0,n.normaliseHex)(o);return c?'#A4622E'===c?'#D9AD8A':(0,n.contrast)(c,u)<4.5?'#FFFFFF':o:o};var t=r(d[0]),n=r(d[1]);const u='#56152A',o='#43122F',c=.88,S=n=>t.IS_SOUTERS?Math.round(n*c*100)/100:n,f=n=>t.IS_SOUTERS?o:n},912,[5,1236]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.TableNumberWarning=function({plan:u}){const c=(0,n.numberClashes)(u.tables),o=[...new Set([...c.acrossAreas,...u.tables.filter(n=>c.sameArea.has(n.name)).map(n.tableNumber)])];return o.length?(0,l.jsxs)(t.T,{testID:"duplicate-table-numbers",size:16,colour:s.colours.goldLight,children:["Duplicate table numbers: ",o.join(', '),". Kept unchanged. Ask a manager to check the areas before assigning."]}):null},r(d[0]);var n=r(d[1]),s=r(d[2]),t=r(d[3]),l=r(d[4])},913,[30,944,821,813,24]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingTableButton=function({rid:e,booking:l,readOnly:y,turnBase:B=90,testID:f}){const[h,j]=(0,t.useState)(!1),k=(0,s.tableButtonLabel)(l.table),x=f??`table-btn-${l.id}`;if(y)return(0,c.jsx)(n.default,{testID:x,accessible:!0,accessibilityLabel:(0,s.tableButtonA11y)(l.table,!0),style:{minHeight:44,justifyContent:'center'},children:(0,c.jsx)(b.T,{size:16,weight:"semibold",colour:o.colours.goldLight,children:k})});return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(b.Button,{kind:"secondary",label:k,testID:x,accessibilityLabel:(0,s.tableButtonA11y)(l.table),onPress:()=>j(!0),style:{minHeight:44}}),h?(0,c.jsx)(u.TablePicker,{rid:e,booking:l,name:l.walkIn?'Walk-in':(l.name??'').replace(' (example)',''),turnBase:B,onClose:()=>j(!1)}):null]})};var e,t=r(d[0]),l=r(d[1]),n=(e=l)&&e.__esModule?e:{default:e},s=r(d[2]),o=r(d[3]),u=r(d[4]),b=r(d[5]),c=r(d[6])},914,[30,127,1296,821,929,813,24]); +__d(function(g,_r,i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.BookingEditButton=function({rid:e,booking:a,who:l,role:s,inStaffApp:o,shiftManager:n,big:d,testID:h}){const[u,b]=(0,t.useState)(!1);return a.walkIn||!(0,c.canEditBooking)({variant:r.APP_VARIANT,inStaffApp:o,role:s,shiftManager:n})?null:(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(p.Button,{kind:"secondary",small:!d,label:"Edit booking",testID:h??`edit-booking-${a.id}`,accessibilityLabel:`Edit booking, ${a.name}, ${a.time}`,onPress:()=>b(!0),style:{minHeight:d?64:44}}),u?(0,x.jsx)(j,{rid:e,id:a.id,who:l,onClose:()=>b(!1)}):null]})},_e.EditBookingPicker=function({rid:e,today:a,who:l,onClose:o,hidePrivate:n}){const[d,r]=(0,t.useState)(null),c=(0,s.useBookings)(e).filter(e=>!e.walkIn&&e.date>=a&&!['cancelled','noshow','finished'].includes(e.status)).sort((e,t)=>e.date.localeCompare(t.date)||e.time.localeCompare(t.time)).slice(0,60);return d?(0,x.jsx)(j,{rid:e,id:d,who:l,hidePrivate:n,onClose:o}):(0,x.jsxs)(p.Sheet,{visible:!0,onClose:o,title:"Edit booking \xb7 pick a booking",maxWidth:640,testID:"edit-booking-picker",children:[(0,x.jsx)(p.T,{size:16,colour:u.colours.text,children:"Tip: tap the booking you want to change."}),c.length?c.map(e=>(0,x.jsx)(p.Button,{kind:"secondary",testID:`edit-pick-${e.id}`,label:`${e.date===a?'Today':e.date} ${e.time} \xb7 ${e.name} \xb7 ${e.partySize} ${1===e.partySize?'cover':'covers'}`,sub:e.notes?`Notes: ${e.notes}`:void 0,accessibilityLabel:`Edit booking, ${e.name}, ${e.date===a?'today':e.date}, ${e.time}, ${e.partySize} covers`,onPress:()=>r(e.id),style:{minHeight:56,alignItems:'flex-start'}},e.id)):(0,x.jsx)(p.Muted,{children:"No bookings to edit from today on."}),(0,x.jsx)(p.Button,{kind:"ghost",label:"Close",onPress:o,style:{minHeight:44}})]})},_e.EditBookingSheet=j;var e,t=_r(_d[0]),a=_r(_d[1]),l=(e=a)&&e.__esModule?e:{default:e},s=_r(_d[2]),o=_r(_d[3]),n=_r(_d[4]),d=_r(_d[5]),r=_r(_d[6]),c=_r(_d[7]),h=_r(_d[8]),u=_r(_d[9]),b=_r(_d[10]),m=_r(_d[11]),p=_r(_d[12]),x=_r(_d[13]);const y=/^([01]\d|2[0-3]):[0-5]\d$/,k=e=>{const t=e.trim().replace('.',':').match(/^(\d{1,2}):?(\d{2})$/);return t?`${t[1].padStart(2,'0')}:${t[2]}`:e.trim()};function j({rid:e,id:a,who:j,onClose:f,hidePrivate:v='display'===r.APP_VARIANT}){const T=(0,s.useBookings)(e),I=T.find(e=>e.id===a),C=(0,d.useRestaurant)(e),D=(0,o.usePlan)(e),P=(0,n.useBlocks)(e=>e.blocks),[$,w]=(0,t.useState)(I?(0,c.draftOf)(I):null),[B,S]=(0,t.useState)(null),[E,A]=(0,t.useState)(null);if(!I||!$||!C)return null;const z=e=>{S(null),A(null),w({...$,...e})},L=k($.time),_=y.test(L),F=(0,h.tableOptions)(D,T.filter(e=>e.date===$.date),$.table),N=(0,c.changedFields)(I,{...$,time:L}),W=C.settings.turnMins??90,R=async()=>{const t=(0,c.editPatch)(I,{...$,time:L},{by:j||'Team member',app:r.APP_VARIANT});if(Object.keys(t).length&&await s.repo.bookings.update(I.id,t),'seated'===I.status&&'table'in t&&t.table!==I.table){const a=e=>e?e.split('+').map(e=>e.trim()).filter(Boolean):[],l=a(I.table),s=a(t.table),n=o.useFloor.getState(),d=l.map(t=>n.live[e]?.[t]?.stage).find(Boolean)??'seated';l.filter(e=>!s.includes(e)).forEach(t=>n.setLive(e,t,{stage:void 0,dirty:!0})),s.forEach(t=>n.setLive(e,t,{stage:d,dirty:!1}))}A(`Saved. Changed: ${(0,c.editedWords)(N)}.`),S(null),f()};return(0,x.jsxs)(p.Sheet,{visible:!0,onClose:f,title:`Edit booking \xb7 ${I.name} \xb7 ${I.ref}`,maxWidth:760,testID:"edit-booking-sheet",children:[(0,x.jsx)(m.DepositChip,{b:I,money:!0,big:!0,testID:"edit-deposit"}),(0,c.isWixBooking)(I)?(0,x.jsx)(l.default,{testID:"edit-wix-note",accessible:!0,accessibilityLabel:c.WIX_EDIT_NOTE,style:{padding:12,borderRadius:12,borderWidth:1,borderColor:u.colours.gold},children:(0,x.jsx)(p.T,{size:16,colour:u.colours.goldLight,children:c.WIX_EDIT_NOTE})}):null,(0,x.jsx)(p.T,{size:16,colour:u.colours.text,children:"Tip: change what you need, then press Save changes."}),(0,x.jsx)(b.BookingDatePicker,{r:C,today:new Date,value:$.date,onChange:e=>z({date:e})}),(0,x.jsx)(p.Field,{label:"Time (24-hour, for example 19:30)",value:$.time,onChangeText:e=>z({time:e}),testID:"edit-time"}),_?null:(0,x.jsx)(p.T,{size:15,colour:u.colours.amber,children:"Write the time like 19:30."}),(0,x.jsxs)(p.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(p.T,{size:18,children:"Covers"}),(0,x.jsx)(p.Stepper,{value:$.partySize,onChange:e=>z({partySize:e}),min:1,max:60,label:"covers",testID:"edit-covers"})]}),(0,x.jsx)(p.Field,{label:"Name",value:$.name,onChangeText:e=>z({name:e}),testID:"edit-name"}),v?(0,x.jsx)(p.Muted,{children:"Phone and email can be changed in the Managers app; the Display never shows them."}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(p.Field,{label:"Phone",value:$.phone,onChangeText:e=>z({phone:e}),keyboardType:"phone-pad",testID:"edit-phone"}),(0,x.jsx)(p.Field,{label:"Email",value:$.email,onChangeText:e=>z({email:e}),keyboardType:"email-address",autoCapitalize:"none",testID:"edit-email"})]}),(0,x.jsx)(p.Field,{label:"Notes",value:$.notes,onChangeText:e=>z({notes:e}),placeholder:c.NOTES_PLACEHOLDER,multiline:!0,numberOfLines:3,testID:"edit-notes"}),I.allergies.length||I.allergyNote?(0,x.jsx)(p.Muted,{children:"Allergies are kept separately and are not changed here."}):null,(0,x.jsx)(p.T,{size:18,weight:"semibold",children:(0,h.tableButtonLabel)($.table)}),(0,x.jsxs)(p.Row,{gap:8,wrap:!0,children:[(0,x.jsx)(p.Button,{kind:$.table?'secondary':'primary',label:"No table",accessibilityLabel:"No table"+($.table?'':', chosen'),onPress:()=>z({table:''}),style:{minHeight:44,minWidth:96},testID:"edit-table-none"}),F.map(e=>(0,x.jsx)(p.Button,{kind:e===$.table?'primary':'secondary',label:(0,h.tableButtonLabel)(e),accessibilityLabel:`Table ${(0,h.tableButtonLabel)(e)}${e===$.table?', chosen':''}`,onPress:()=>z({table:e}),style:{minHeight:44,minWidth:64},testID:`edit-table-${e}`},e))]}),B?(0,x.jsxs)(l.default,{testID:"edit-warn",style:{gap:8,padding:12,borderRadius:12,borderWidth:1.5,borderColor:u.colours.amber,backgroundColor:u.colours.amberBg},children:[B.map(e=>(0,x.jsx)(p.T,{size:16,colour:"#FFE2A8",children:e},e)),(0,x.jsx)(p.T,{size:16,colour:"#FFE2A8",children:"You can still save."})]}):null,E?(0,x.jsx)(p.T,{size:16,colour:u.colours.goldLight,children:E}):null,(0,x.jsxs)(p.Row,{gap:8,wrap:!0,children:[(0,x.jsx)(p.Button,{label:B?'Save anyway':'Save changes',testID:"edit-save",disabled:!_||$.name.trim().length<1||!N.length,onPress:()=>{const t=_?(0,n.blockAt)(P,e,$.date,L):void 0,a=(0,c.editWarnings)(I,{...$,time:L},T,t,W);!a.length||B?R():S(a)},style:{minHeight:56,flex:1}}),(0,x.jsx)(p.Button,{kind:"ghost",label:"Cancel",onPress:f,style:{minHeight:56}})]})]})}},915,[30,127,819,825,824,1020,806,812,1296,821,1297,950,813,24]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useScreensaverAsleep",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"useDisplayToolsH",{enumerable:!0,get:function(){return s}});var t=r(d[0]);const n=(0,t.create)(t=>({asleep:!1,set:n=>t({asleep:n})})),s=(0,t.create)(()=>({h:65}))},916,[951]); +__d(function(g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useSoldOut",{enumerable:!0,get:function(){return f}}),_e.setSoldOutBy=m,_e.setSoldOut=function(e,t,n){if(!s.useStore.getState().menu.find(t=>t.id===e))return;n&&m(n);s.useStore.getState().updateMenuItem(e,{soldOut:t})},_e.soldOutNow=function(e,t=c()){return(0,o.activeSoldOut)(f.getState().entries,e,t)},_e.linkSoldOut=O,_e.useSoldOutLink=function(e,t,n=!0){const r=_r(d[9]);r.useEffect(()=>{n&&O({adopt:e})},[e,n]),r.useEffect(()=>{n&&m(t)},[t,n])};var e,t=_r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},r=_r(d[1]),a=_r(d[2]),o=_r(d[3]),i=_r(d[4]),s=_r(d[5]),u=_r(d[6]),l=_r(d[7]);const c=()=>{try{return(0,s.nowFrom)(s.useStore.getState().clock)}catch{return new Date}},f=(0,r.create)()((0,a.persist)((e,t)=>({entries:[],adopted:{},mark:(t,n,r,a)=>{const u=c(),l=s.useStore.getState().restaurants.find(e=>e.id===t),f=(0,o.soldOutSettingsOf)(l?.settings?.soldOut),S=l?(0,i.hoursFor)(l,u)?.close??null:null,m=(0,o.clearAfterFor)(u,f,S),p={rid:t,itemId:n,name:r.slice(0,120),on:!0,at:u.toISOString(),by:a.slice(0,80),clearAfter:m?.toISOString(),auto:!1,kept:!1};e(e=>({entries:[...e.entries.filter(e=>!(e.rid===t&&e.itemId===n)),p]}))},back:(n,r,a)=>{const o=t().entries.find(e=>e.rid===n&&e.itemId===r);o&&o.on&&e(e=>({entries:e.entries.map(e=>e===o?{...e,on:!1,at:c().toISOString(),by:a.slice(0,80),clearAfter:void 0,kept:!!e.auto}:e)}))},expire:(n,r)=>{const a=(0,o.expiredSoldOut)(t().entries,n,r);if(!a.length)return 0;const i=new Set(a.map(e=>e.itemId));return e(e=>({entries:e.entries.map(e=>e.rid===n&&i.has(e.itemId)?{...e,on:!1,by:'Cleared automatically',clearAfter:void 0}:e)})),a.length}}),{name:'covercharge-soldout-v1',version:1,storage:(0,a.createJSONStorage)(()=>n.default),partialize:e=>({entries:e.entries.slice(-500),adopted:e.adopted})}));let S='Staff';function m(e){e&&(S=e.replace(' (example)',''))}let p=null;function O(e){if(p)return p;let t=!1;const n=(e=s.useStore.getState().menu)=>new Map(e.map(e=>[e.id,e.soldOut]));let r=n();if(e.adopt){const e={...f.getState().adopted},t=[];for(const t of s.useStore.getState().menu)e[t.restaurantId];for(const t of s.useStore.getState().menu)e[t.restaurantId]=!0;f.setState(n=>({entries:[...n.entries,...t],adopted:e}))}const a=()=>{const e=c(),a=f.getState().entries,o=s.useStore.getState().menu,i=new Map;for(const t of a){const n=t.on&&(!t.clearAfter||new Date(t.clearAfter).getTime()>e.getTime());i.set(`${t.rid}|${t.itemId}`,n)}const u=o.filter(e=>i.has(`${e.restaurantId}|${e.id}`)&&i.get(`${e.restaurantId}|${e.id}`)!==e.soldOut);if(u.length){t=!0;try{const e=new Map(u.map(e=>[e.id,i.get(`${e.restaurantId}|${e.id}`)]));s.useStore.setState(t=>({menu:t.menu.map(t=>e.has(t.id)?{...t,soldOut:e.get(t.id)}:t)}))}finally{t=!1,r=n()}}},o=s.useStore.subscribe((e,a)=>{if(e.menu===a.menu)return;const o=n(e.menu);if(!t)for(const t of e.menu){const e=r.get(t.id);void 0!==e&&e!==t.soldOut&&(t.soldOut?f.getState().mark(t.restaurantId,t.id,t.name,S):f.getState().back(t.restaurantId,t.id,S))}r=o}),i=f.subscribe((e,t)=>{e.entries!==t.entries&&a()}),u=()=>{const e=c(),t=new Set(f.getState().entries.filter(e=>e.on).map(e=>e.rid));for(const n of t)f.getState().expire(n,e)};u(),a();const l=setInterval(u,3e4);let m=null;if(e.adopt)try{m=_r(d[8],"./autoSoldOutStore").startAutoSoldOut()}catch{m=null}return p=()=>{o(),i(),clearInterval(l),m&&m(),p=null},p}u.PITCH&&'undefined'!=typeof globalThis&&(globalThis.__pitchLive=e=>(0,l.setLiveData)(!!e),globalThis.__pitchSoldOut=e=>{const t=s.useStore.getState(),n=t.restaurants[0]?.id;if(!n)return;const r=t.menu.filter(e=>e.restaurantId===n&&!e.hidden),a=['Sticky toffee pudding','Cullen skink','Fish supper','Steak pie','Haggis bon bons','Cranachan','Lemon tart','Mussels','Scampi','Venison burger','Chips (large)','Oysters','Lobster thermidor','Crab claws','Tablet ice cream','Beef shin','Smoked salmon','Cheeseboard','Halibut','Clootie dumpling'],o=(new Date).toISOString(),i=Array.from({length:e},(e,t)=>r[t]?{id:r[t].id,name:r[t].name}:{id:`pitch-so-${t}`,name:a[t%a.length]});f.setState(e=>({entries:[...e.entries.filter(e=>e.rid!==n||!i.some(t=>t.id===e.itemId)).map(e=>e.rid===n?{...e,on:!1}:e),...i.map(e=>({rid:n,itemId:e.id,name:e.name,on:!0,at:o,by:'Chef'}))]}))})},917,[1115,951,1116,943,815,870,2,1118,941,30]); +__d(function(g,r,i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"dismissNotice",{enumerable:!0,get:function(){return u.dismissNotice}}),Object.defineProperty(_e,"notify",{enumerable:!0,get:function(){return u.notify}}),Object.defineProperty(_e,"useSliders",{enumerable:!0,get:function(){return u.useSliders}}),Object.defineProperty(_e,"SLIDER",{enumerable:!0,get:function(){return y}}),_e.SliderButton=w,_e.SliderCard=S,_e.SliderHost=function(){x();const e=(0,u.useSliders)(e=>e.queue),n=e[0],o=(0,t.useRef)(null);if((0,t.useEffect)(()=>{if(f)return window.ccSlider=e=>(0,u.notify)(e),()=>{delete window.ccSlider}},[]),(0,t.useEffect)(()=>{if(o.current&&clearTimeout(o.current),!n)return;const e=void 0!==n.timeoutMs?n.timeoutMs:n.actions?.length||n.content?null:6e3;return e&&(o.current=setTimeout(()=>u.useSliders.getState().dismiss(n.id),e)),()=>{o.current&&clearTimeout(o.current)}},[n?.id,n?.timeoutMs]),!n)return null;const s=f?'fixed':'absolute';return(0,b.jsxs)(b.Fragment,{children:[n.modal?(0,b.jsx)(l.default,{...h('dim'),style:{position:s,left:0,right:0,top:0,bottom:0,zIndex:2147482990,backgroundColor:'rgba(0,0,0,0.72)'}}):null,(0,b.jsx)(l.default,{testID:"cc-slider-host",pointerEvents:"box-none",style:{position:s,left:12,right:12,bottom:12,zIndex:2147483e3,alignItems:'center',...f?{bottom:'calc(12px + env(safe-area-inset-bottom))'}:{}},children:(0,b.jsx)(S,{n:n,waiting:e.length-1,onClose:()=>u.useSliders.getState().dismiss(n.id)},n.id+':'+(n.seq??0))})]})};var t=r(d[0]);r(d[1]);var n=e(r(d[2])),o=e(r(d[3])),l=e(r(d[4])),s=e(r(d[5])),c=r(d[6]),a=r(d[7]),u=r(d[8]),b=r(d[9]);const f='undefined'!=typeof document,p="\n[data-ccsl=\"in\"]{animation:ccsl-in .45s cubic-bezier(.2,1,.3,1) both}\n@keyframes ccsl-in{from{opacity:0;transform:translate3d(0,110%,0)}to{opacity:1;transform:none}}\n[data-ccsl=\"urgent\"]{animation:ccsl-in .45s cubic-bezier(.2,1,.3,1) both,ccsl-red 1.6s ease-in-out .45s infinite}\n@keyframes ccsl-red{0%,100%{box-shadow:0 10px 30px rgba(0,0,0,.6),0 0 0 1px rgba(255,107,94,.55)}50%{box-shadow:0 10px 40px rgba(0,0,0,.6),0 0 0 2px #FF6B5E,0 0 34px rgba(255,107,94,.45)}}\n[data-ccsl=\"dim\"]{animation:ccsl-dim .3s ease both}\n@keyframes ccsl-dim{from{opacity:0}to{opacity:1}}\n@media (prefers-reduced-motion: reduce){[data-ccsl]{animation:none !important}}\n",h=e=>f?{dataSet:{ccsl:e}}:{};function x(){(0,t.useEffect)(()=>{if(!f||document.getElementById('cc-slider-css'))return;const e=document.createElement('style');e.id='cc-slider-css',e.textContent=p,document.head.appendChild(e)},[])}const y={bg:'#17140F',border:'rgba(207,164,95,.55)',text:'#F5F1E8',quiet:'#A89A80',gold:c.colours.gold,ink:'#17130D'},j=(e="normal")=>'urgent'===e?c.colours.red:'warn'===e?c.colours.amber:c.colours.gold,k=(e="normal")=>'urgent'===e?'rgba(255,107,94,.75)':'warn'===e?'rgba(255,181,71,.65)':y.border;function w({a:e,onDone:t,big:o}){const l=e.kind??'primary';return(0,b.jsx)(n.default,{testID:e.testID,accessibilityRole:"button",accessibilityLabel:e.label,onPress:()=>{try{e.onPress?.()}finally{e.keepOpen||t()}},style:({pressed:e})=>({minHeight:o?56:44,minWidth:44,paddingHorizontal:'ghost'===l?10:o?24:18,borderRadius:12,alignItems:'center',justifyContent:'center',backgroundColor:'primary'===l?y.gold:'transparent',borderWidth:'danger'===l?1:0,borderColor:c.colours.red,opacity:e?.8:1}),children:(0,b.jsx)(a.T,{size:o?18:'ghost'===l?14:15,weight:'primary'===l?'bold':'medium',colour:'primary'===l?y.ink:'danger'===l?c.colours.red:y.quiet,children:e.label})})}function S({n:e,onClose:t,waiting:n=0,maxWidth:c=520}){x();const u=e.tone??'normal',p=j(u),S=e.content,C=!!e.big,{height:I}=(0,s.default)(),D=e.actions??[];return(0,b.jsxs)(l.default,{testID:e.testID??'cc-slider',accessibilityRole:"summary",accessibilityLabel:`${e.kicker?e.kicker+': ':''}${e.title}`,...h('urgent'===u?'urgent':'in'),style:{width:'100%',maxWidth:C?Math.max(c,900):c,alignSelf:'center',borderRadius:14,backgroundColor:y.bg,borderWidth:1,borderColor:k(u),overflow:'hidden',...f?{boxShadow:'0 10px 30px rgba(0,0,0,.6)'}:{elevation:12}},children:['normal'!==u?(0,b.jsx)(l.default,{style:{position:'absolute',left:0,top:0,bottom:0,width:5,backgroundColor:p}}):null,(0,b.jsxs)(o.default,{style:{maxHeight:Math.max(220,I-40)},contentContainerStyle:{paddingVertical:C?18:12,paddingLeft:'normal'!==u?C?24:18:C?20:14,paddingRight:C?20:14,gap:C?10:6},children:[(0,b.jsxs)(l.default,{style:{flexDirection:'row',alignItems:'center',gap:12},children:[e.icon?(0,b.jsx)(a.T,{size:C?34:22,children:e.icon}):null,(0,b.jsxs)(l.default,{style:{flex:1,gap:2},children:[e.kicker?(0,b.jsx)(a.T,{size:C?15:11,weight:"bold",colour:p,style:{letterSpacing:1.4},children:e.kicker}):null,(0,b.jsx)(a.T,{size:C?24:15,weight:"medium",colour:y.text,children:e.title}),e.body?(0,b.jsx)(a.T,{size:C?18:13,colour:y.quiet,children:e.body}):null]}),D.length||S?null:(0,b.jsx)(w,{a:{label:'OK',kind:'ghost',testID:'cc-slider-ok'},onDone:t,big:C})]}),S?(0,b.jsx)(S,{close:t}):null,D.length?(0,b.jsx)(l.default,{style:{flexDirection:'row',flexWrap:'wrap',alignItems:'center',gap:8,justifyContent:'flex-end'},children:D.map(e=>(0,b.jsx)(w,{a:e,onDone:t,big:C},e.label))}):null,n>0?(0,b.jsxs)(a.T,{size:C?14:11,colour:y.quiet,children:[n," more waiting"]}):null]})]})}},918,[30,122,263,151,127,287,821,813,946,24]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AppBadge=function({label:o}){return(0,c.jsx)(t.default,{testID:"app-badge",accessibilityLabel:`${o} app`,style:{borderWidth:1,borderColor:s.colours.gold,borderRadius:6,paddingHorizontal:6,paddingVertical:1,backgroundColor:(0,e.soutersSurface)('#1c1a16')},children:(0,c.jsx)(u.T,{size:10,weight:"bold",colour:s.colours.gold,children:o})})};var e=r(d[0]);r(d[1]);var o,l=r(d[2]),t=(o=l)&&o.__esModule?o:{default:o},s=r(d[3]),u=r(d[4]),c=r(d[5])},919,[912,30,127,821,813,24]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.CoversToday=function({rid:e,onPress:v,big:$,sound:p,testID:x="covers-today",day:C,compact:j=!1}){const w=(0,c.useBookings)(e),k=(0,c.useNow)(3e4),T=(0,h.venueYmd)(k),D=C&&C!==T?C:T,I=D!==T,L=I?(0,y.dayCovers)(w,D,T):(0,u.coversToday)(w,T),_=(0,y.dayWord)(D,T),M=/^(Today|Yesterday|Tomorrow)$/.test(_),R=`COVERS ${_.toUpperCase()}`,S=I?`${M?`${_}\u2019s`:_} bookings \u203a`:'Today\u2019s bookings \u203a',O=I?`${M?`${_}, `:''}${(0,y.dayLong)(D)}`:'today',P=(0,o.useLiveState)();if('ready'!==P)return(0,f.jsx)(o.LiveWait,{state:P,title:"Covers today",testID:`${x}-wait`});const W=$?64:44,z=L.total?Math.min(1,L.done/L.total):0,B=(e,o,t,c)=>(0,f.jsxs)(s.default,{style:{flex:1,alignItems:'center',gap:6,minWidth:0},children:[(0,f.jsx)(l.SplitFlap,{value:o,height:W,colour:t,testID:`covers-${c}`,sound:p}),(0,f.jsx)(n.T,{size:$||j?14:12,weight:"semibold",colour:b.colours.muted,numberOfLines:j?void 0:1,center:j,style:{letterSpacing:.4},children:e})]});return(0,f.jsxs)(t.default,{testID:x,accessibilityRole:"button",disabled:!v,onPress:v,accessibilityLabel:`Covers ${O}: ${L.done} done, ${L.toCome} ${D({backgroundColor:e?b.colours.tilePressed:b.colours.surface,borderRadius:16,borderWidth:1,borderColor:b.colours.hairline,padding:16,gap:12}),children:[(0,f.jsxs)(s.default,{style:{flexDirection:j?'column':'row',justifyContent:'space-between',alignItems:'center',gap:j?6:void 0},children:[(0,f.jsx)(n.T,{center:j,size:j?16:12,weight:"semibold",colour:b.colours.goldMuted,style:{letterSpacing:1.6},children:R}),v?(0,f.jsx)(n.T,{center:j,size:j?14:12,colour:b.colours.muted,children:S}):null]}),(0,f.jsxs)(s.default,{style:{flexDirection:'row',gap:8},children:[B('Done',L.done,b.colours.text,'done'),B(De.set),d=a??t,[n,u]=j[e];return(0,r.useEffect)(()=>{if('display'!==e||!a)return;const t=setTimeout(()=>o(e,null),12e4);return()=>clearTimeout(t)},[e,a,o]),(0,D.jsxs)(l.default,{testID:"day-bar",style:{gap:8},children:[(0,D.jsx)(s.DaySwitch,{day:d,today:t,onDay:t=>o(e,t),back:-n,ahead:u,idPrefix:"day"}),a?(0,D.jsx)(c.Button,{testID:"day-today",kind:"secondary",label:"Back to today",accessibilityLabel:"Back to today",onPress:()=>o(e,null),style:{minHeight:48}}):null]})},_e.DayView=function({rid:e,day:s,today:r,app:d}){const n=(0,u.useRestaurant)(e),x=(0,u.useBookings)(e),j=(0,u.useEvents)(e),_=(0,p.parseYmd)(s),B=se.date===s),O=(0,f.regularEventsOf)(n).filter(e=>(0,f.occursOn)(e,s)),T=x.filter(e=>e.date===s).sort((e,t)=>e.time.localeCompare(t.time)).filter(y.ACTIVE),E='display'===d;return(0,D.jsxs)(l.default,{testID:"day-view",style:{gap:12},children:[(0,D.jsxs)(c.Card,{children:[(0,D.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,D.jsxs)(c.T,{weight:"semibold",colour:b.colours.gold,children:[(0,p.niceDate)(_),$?` \xb7 ${$.name} hours`:'']}),(0,D.jsx)(c.Badge,{kind:"gold",label:B?'LOOKING BACK':'LOOKING AHEAD'})]}),(0,D.jsxs)(c.T,{size:E?18:15,children:[C?`Kitchen ${k(C[0])}\u2013${k(C[1])}`:'Kitchen closed',C&&v&&'kitchen closes'!==v.reason?` \xb7 last food orders ${k(v.time)} (${v.reason})`:'']}),O.map(e=>(0,D.jsxs)(c.T,{size:14,colour:b.colours.goldLight,children:["\u266a ",e.name,e.time?` from ${k(e.time)}`:'',e.busier?' \xb7 expect busier':'']},e.id)),w.map(e=>(0,D.jsxs)(c.T,{size:14,colour:b.colours.goldLight,children:["\u2605 ",(0,y.holidayName)(e.title)]},e.id)),(0,D.jsx)(c.Muted,{children:"Read-only. Nothing here changes today\u2019s service."})]}),(0,D.jsx)(a.CoversToday,{rid:e,day:s}),(0,D.jsx)(m.PlattersBooked,{rid:e,date:s,label:B?'Platters that day':'Platters booked'}),T.length?T.map(s=>(0,D.jsxs)(l.default,{style:{gap:6,padding:14,borderRadius:16,borderWidth:1,borderColor:b.colours.hairline,backgroundColor:b.colours.surface},children:[(0,D.jsxs)(c.T,{weight:"semibold",children:[s.time," \xb7 ",s.walkIn?`Walk-in ${s.ref}`:s.name," \xb7 ",s.partySize," covers",s.table?` \xb7 ${(0,t.tableNumbers)(s.table)}`:'']}),(0,D.jsx)(o.DepositChip,{b:s,money:!0,testID:`day-deposit-${s.id}`}),(0,D.jsx)(m.BookingNeeds,{b:s}),'display'!==d&&!B&&['confirmed','pending'].includes(s.status)?(0,D.jsx)(l.default,{style:{flexDirection:'row'},children:(0,D.jsx)(A.WhatsAppGuest,{b:s,rid:e,kind:"auto"})}):null]},s.id)):(0,D.jsx)(c.Muted,{children:B?'No bookings that day.':'No bookings yet for this day.'})]})};var e,t=_r(_d[0]),s=_r(_d[1]),a=_r(_d[2]),o=_r(_d[3]),r=_r(_d[4]),d=_r(_d[5]),l=(e=d)&&e.__esModule?e:{default:e},n=_r(_d[6]),c=_r(_d[7]),u=_r(_d[8]),y=_r(_d[9]),h=_r(_d[10]),f=_r(_d[11]),p=_r(_d[12]),b=_r(_d[13]),m=_r(_d[14]),A=_r(_d[15]),D=_r(_d[16]);const x=(0,n.create)(e=>({day:{},set:(t,s)=>e(e=>({day:{...e.day,[t]:s??void 0}}))})),j={owner:[-s.DAY_BACK,s.DAY_AHEAD],chef:[-s.DAY_BACK,s.DAY_AHEAD],display:[-s.DAY_BACK,s.DAY_AHEAD],staff:[-s.DAY_BACK,s.DAY_AHEAD]},k=e=>{const[t,s]=e.split(':').map(Number);return`${t%12||12}${s?`:${String(s).padStart(2,'0')}`:''}${t<12?'am':'pm'}`};function _(e,t){const s=x(t=>t.day[e]);return s&&s!==t?s:null}},921,[808,935,920,950,30,127,951,813,819,828,815,809,818,821,949,1018,24]); +__d(function(_g,r,_i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"setDisplaySilent",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"soundAllowed",{enumerable:!0,get:function(){return u}}),e.chime=function(t="bright"){if(!u())return void l('__ccChimesBlocked');try{const n=o();if(!n)return;('bright'===t?[880,1318.5]:[659.3]).forEach((o,c)=>{const i=n.currentTime+.16*c,u=n.createOscillator(),l=n.createGain();u.type='sine',u.frequency.value=o,l.gain.setValueAtTime(1e-4,i),l.gain.exponentialRampToValueAtTime('bright'===t?.12:.07,i+.02),l.gain.exponentialRampToValueAtTime(1e-4,i+.9),u.connect(l).connect(n.destination),u.start(i),u.stop(i+.95)}),l('__ccChimes')}catch{}},Object.defineProperty(e,"LOW_CHIME_MIN",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"LOW_CHIME_MAX",{enumerable:!0,get:function(){return d}}),e.lowChime=function(t=0){if(!u())return void l('__ccChimesBlocked');const n=s+.095*Math.max(0,Math.min(1,t));'undefined'!=typeof window&&(window.__ccLowChimeLevels=[...window.__ccLowChimeLevels??[],Math.round(1e3*n)/1e3].slice(-40));try{const t=o();if(!t)return;[220,164.8].forEach((o,c)=>{const i=t.currentTime+.42*c,u=t.createOscillator(),l=t.createGain(),s=t.createBiquadFilter?.();u.type='triangle',u.frequency.value=o,l.gain.setValueAtTime(1e-4,i),l.gain.exponentialRampToValueAtTime(n,i+.12),l.gain.exponentialRampToValueAtTime(1e-4,i+1.6),s?(s.type='lowpass',s.frequency.value=900,u.connect(s).connect(l).connect(t.destination)):u.connect(l).connect(t.destination),u.start(i),u.stop(i+1.7)}),l('__ccLowChimes')}catch{}},Object.defineProperty(e,"flapSoundOn",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"setFlapSound",{enumerable:!0,get:function(){return w}}),e.flapClick=function(){if('display'!==t.APP_VARIANT&&!c)return;if(!p())return;try{const t=o();if(!t)return;const n=t.currentTime,c=Math.floor(.03*t.sampleRate),i=t.createBuffer(1,c,t.sampleRate),u=i.getChannelData(0);for(let t=0;t{if('undefined'==typeof window)return null;const t=window.AudioContext||window.webkitAudioContext;return t?(n||(n=new t),'suspended'===n.state&&n.resume?.().catch?.(()=>{}),n):null};if('undefined'!=typeof window){const t=()=>{try{o()}catch{}window.removeEventListener('pointerdown',t)};window.addEventListener('pointerdown',t)}let c=!1;const i=t=>{c=t},u=()=>'display'!==t.APP_VARIANT&&!c,l=t=>{'undefined'!=typeof window&&(window[t]=(window[t]??0)+1)};const s=.015,d=.11;const f='cc-flap-sound',p=()=>{try{return'undefined'!=typeof localStorage&&'1'===localStorage.getItem(f)}catch{return!1}},w=t=>{try{localStorage.setItem(f,t?'1':'0')}catch{}}},922,[122,806]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.SeatAllergenReminder=function({rid:c}){const u=(0,n.useRef)(new Set);return(0,n.useEffect)(()=>s.useStore.subscribe((n,s)=>{if(n.bookings===s.bookings)return;const h=new Map(s.bookings.map(t=>[t.id,t.status]));for(const s of n.bookings){if(s.restaurantId!==c||'seated'!==s.status||!(0,l.hasAllergens)(s)||u.current.has(s.id))continue;const n=h.get(s.id);n&&'seated'!==n&&(u.current.add(s.id),(0,o.notify)({id:`seat-allergen:${s.id}`,tone:'urgent',testID:'seat-allergen-reminder',icon:'\u26a0\ufe0f',kicker:'RE-CONFIRM ALLERGENS AT THE TABLE',title:`${s.name} \xb7 ${s.partySize} covers${s.table?` \xb7 ${(0,t.tableNumbers)(s.table)}`:''}`,body:`${(0,l.allergenText)(s)}. Before taking the order, check the allergens with the guests again and tell the kitchen about any change.`,actions:[{label:'Done, re-confirmed with the guests',testID:'seat-allergen-ok'}]}))}}),[c]),null},e.useKitchenTodoChime=function(t,u,h){const f=(0,s.useStore)(n=>n.bookings.filter(n=>n.restaurantId===t&&n.date>=u&&!n.walkIn&&((0,l.needsAllergenSeen)(n)||(0,l.needsHoldOk)(n))).map(t=>t.id).sort().join(',')),k=f?f.split(',').length:0,b=(0,n.useRef)(null);return(0,n.useEffect)(()=>{const t=s.useStore.getState().bookings.filter(t=>f.split(',').includes(t.id)),n=b.current;if(b.current=t.map(t=>t.id),null===n)return;const k=t.filter(t=>!n.includes(t.id));if(k.length){(0,c.soundAllowed)()&&(0,c.chime)('bright');for(const t of k){const n=(0,l.needsAllergenSeen)(t);(0,o.notify)({id:`kitchen-todo:${t.id}`,tone:n?'urgent':'warn',testID:'kitchen-todo-notice',icon:n?'\u26a0\ufe0f':'\ud83c\udf7d\ufe0f',kicker:n?'ALLERGENS TO SIGN OFF':'PLATTER TO SIGN OFF',title:`${t.name} \xb7 ${t.partySize} covers \xb7 ${t.date===u?'today':t.date} ${t.time}`,body:n?`${(0,l.allergenText)(t)}. Tap Allergens seen on the booking once the kitchen has read it.`:'A platter is booked. Tap Platter OK on the booking once the kitchen can do it.',actions:[...h?[{label:'Open bookings',onPress:h}]:[],{label:'Later',kind:'ghost'}]})}}},[f]),k};var t=r(d[0]),n=r(d[1]),o=r(d[2]),s=r(d[3]),l=r(d[4]),c=r(d[5])},923,[808,30,946,819,828,922]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useVoiceSlot",{enumerable:!0,get:function(){return w}}),_e.voiceAppFor=S,_e.useVoiceTarget=p,_e.VoiceSlot=function({size:e=56}){const t=p(),u=(0,n.useRef)(null),c=(0,n.useRef)(y++).current,{width:l,height:f}=(0,o.default)(),S=()=>u.current?.measureInWindow((e,t,n)=>{n&&w.setState({rect:{x:e,y:t,size:n},owner:c})});return(0,n.useEffect)(()=>{const e=setTimeout(S,50);return()=>clearTimeout(e)},[l,f,t?.on]),(0,n.useEffect)(()=>()=>{w.getState().owner===c&&w.setState({rect:null,owner:0})},[]),(0,n.useEffect)(()=>{t?.on||w.getState().owner!==c||w.setState({rect:null,owner:0})},[t?.on]),t?.on?(0,h.jsx)(s.default,{ref:u,testID:"voice-slot",onLayout:S,style:{width:e,height:e,flexShrink:0}}):null};var t=r(d[0]),n=r(d[1]),o=e(r(d[2])),s=e(r(d[3])),u=r(d[4]),c=r(d[5]),l=r(d[6]),f=r(d[7]),h=r(d[8]);const w=(0,u.create)(()=>({rect:null,owner:0}));function S(e){return'customer'===c.APP_VARIANT||/^\/(customer|table|demo)/.test(e)?null:e.startsWith('/owner')||e.startsWith('/admin')?'owner':e.startsWith('/team')?'staff':e.startsWith('/kitchen')?'chef':e.startsWith('/display')?'display':null}function p(){const e=(0,t.usePathname)()||'/',n=(0,l.useCtx)(6e4),o=(0,f.useVoiceSettings)(e=>e.enabled),s=S(e);if(!s)return null;const u='owner'===s?'owner'===n.role?'owner':'manager'===n.role?'manager':'staff':s;return{app:s,role:u,actions:'staff'===u?'staff':s,on:(0,f.voiceOn)(o,n.rid,u)}}let y=1},924,[804,30,287,127,951,806,926,1098,24]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"TABLES",{enumerable:!0,get:function(){return P}}),_e.useTableNames=O,_e.resetTableLive=z,_e.seatBookingNow=async function(e,t){await h.repo.bookings.setStatus(t.id,'seated'),z(e,t.table)},_e.finishBookingNow=async function(e,t){await h.repo.bookings.setStatus(t.id,'finished'),(0,w.tablesOf)(t.table).forEach(t=>w.useFloor.getState().setLive(e,t,{stage:void 0,dirty:!0}))},_e.useTableUse=B,Object.defineProperty(_e,"walkInLabel",{enumerable:!0,get:function(){return M}}),_e.TablePicker=N,_e.WalkInSheet=F,_e.AssignTableSheet=A,_e.undoNotice=L,_e.NewBookingSheet=W,_e.useFrontDoor=function(e,t){const[s,o]=(0,a.useState)(!1),[l,i]=(0,a.useState)(!1),[r,d]=(0,a.useState)(null);return{openWalkIn:()=>o({}),openWalkInAt:e=>o({table:e}),openBooking:()=>i(!0),assignTable:e=>d({b:e}),combineTables:e=>d({b:e,combine:!0}),elements:(0,I.jsxs)(I.Fragment,{children:[s?(0,I.jsx)(F,{wide:t,initialTable:s.table,onClose:()=>o(!1),onSeated:L}):null,l?(0,I.jsx)(W,{wide:t,date:e,onClose:()=>i(!1),onSaved:e=>(0,n.notify)({id:`booked:${Date.now()}`,testID:'booking-saved-toast',timeoutMs:5e3,icon:'\u2713',title:`Booked: ${e.name} \xb7 ${(0,y.niceDate)((0,y.parseYmd)(e.date))} at ${e.time}`})}):null,r?(0,I.jsx)(A,{booking:r.b,combine:r.combine,onClose:()=>d(null)}):null]})}};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),n=_r(_d[4]),a=_r(_d[5]),i=e(a),r=_r(_d[6]),d=e(_r(_d[7])),u=e(_r(_d[8])),c=_r(_d[9]),b=_r(_d[10]),h=_r(_d[11]),p=_r(_d[12]),f=_r(_d[13]),y=_r(_d[14]),x=_r(_d[15]),k=_r(_d[16]),j=_r(_d[17]),w=_r(_d[18]),T=_r(_d[19]),S=_r(_d[20]),C=_r(_d[21]),v=_r(_d[22]),D=_r(_d[23]),$=_r(_d[24]),I=_r(_d[25]);const P=Array.from({length:12},(e,t)=>String(t+1));function O(e){const t=(0,w.usePlan)(e);return t.areas.flatMap(e=>t.tables.filter(t=>t.areaId===e.id).map(e=>e.name))}function z(e,t){(0,w.tablesOf)(t).forEach(t=>w.useFloor.getState().setLive(e,t,{stage:'seated',dirty:!1}))}function B(e,t){const s=(0,h.useBookings)(e),o=(0,h.useOrders)(e),l=O(e),n=(0,w.useFloor)(t=>t.live[e])??{},a=(0,w.usePlan)(e),i=(0,T.useBlocks)(e=>e.blocks),r=(0,y.ymd)(t),d=(0,T.closedAreasAt)(i,e,r,(0,y.hm)(t)),u={};for(const e of l)u[e]=n[e]?.blocked||d.has(`tbl:${e}`)?{busy:!0,label:'Blocked'}:d.has(a.tables.find(t=>t.name===e)?.areaId??'')?{busy:!0,label:'Closed'}:n[e]?.dirty?{busy:!0,label:'Needs clearing'}:{busy:!1,label:'Free'};for(const e of s)if(e.date===r&&e.table)for(const s of(0,w.tablesOf)(e.table))if(u[s])if('seated'===e.status)u[s]={busy:!0,label:`${e.walkIn?'Walk-in':`${e.name.slice(0,1)}.`} \xb7 ${e.partySize}`};else if('confirmed'===e.status&&!u[s].busy){const o=(0,y.minsBetween)(t,new Date(`${e.date}T${e.time}:00`));o>=-15&&o<=90&&(u[s]={...u[s],soon:`Booked ${e.time}`})}for(const e of o)'table'===e.type&&e.tableNo&&u[e.tableNo]&&!['closed','cancelled','collected'].includes(e.status)&&!u[e.tableNo].busy&&(u[e.tableNo]={busy:!0,label:'Open order'});return u}const M=e=>e.walkIn?`Walk-in \xb7 ${e.partySize}`:`${e.name} \xb7 ${e.partySize}`;function N({use:e,value:t,onPick:o,big:l,best:n,dense:i,bestSet:r,picked:c}){const b=Object.keys(e),[h,p]=(0,a.useState)(0),f=i?6:8,y=i?64:l?92:76,k=h?Math.max(3,Math.floor((h+f)/(y+f))):0,T=k?Math.floor((h-f*(k-1))/k):y,S=new Set(r??[]),C=n?(0,w.tablesOf)(n)[0]:null;return(0,I.jsx)(u.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:f},testID:"table-picker",onLayout:e=>p(Math.floor(e.nativeEvent.layout.width)),children:b.map(l=>{const n=e[l],a=t===l||!!c?.includes(l),r=S.has(l),b=C===l&&!a,h=n.busy?['Blocked','Needs clearing','Closed'].includes(n.label)?n.label:'In use':n.soon??'Free';return(0,I.jsxs)(d.default,{accessibilityRole:"button",testID:`pick-table-${l}`,accessibilityLabel:`Table ${(0,s.tableNumbers)(l)}${c?a?', picked':', not picked':''}, ${n.busy?`in use (${n.label})`:n.soon?`free, ${n.soon}`:'free'}${r?', best table':''}${b?', suggested for this party':''}`,accessibilityState:{selected:a,disabled:'Closed'===n.label},disabled:'Closed'===n.label,onPress:()=>o(l),style:{width:T,minHeight:i?58:64,borderRadius:12,borderWidth:a||b?2.5:1.5,paddingVertical:i?3:6,paddingHorizontal:4,alignItems:'center',justifyContent:'center',gap:2,borderColor:a||b?x.colours.gold:n.busy?x.colours.red:x.colours.ok,backgroundColor:a?x.colours.goldTint:n.busy?x.colours.redBg:x.colours.surface2,opacity:'Closed'!==n.label||a?1:.55},children:[(0,I.jsxs)(u.default,{style:{flexDirection:'row',alignItems:'center',gap:4},children:[(0,I.jsx)(j.T,{weight:"bold",size:22,colour:a?x.colours.goldLight:x.colours.text,children:(0,s.tableNumbers)(l)}),r?(0,I.jsx)(u.default,{testID:"best-table",style:{backgroundColor:x.colours.gold,borderRadius:5,paddingHorizontal:4,paddingVertical:1},children:(0,I.jsx)(j.T,{size:11,weight:"bold",colour:x.colours.onGold,children:"BEST"})}):null]}),(0,I.jsx)(j.T,{size:i?13:14,colour:n.busy?'#FFD9D4':n.soon?'#FFE2A8':'#E2C489',center:!0,numberOfLines:1,children:h})]},l)})})}const R=[1,2,3,4,5,6,7,8];function F({onClose:e,onSeated:o,wide:l,initialTable:n}){const{rid:p,r:k,now:S}=(0,b.useCtx)(15e3),C=B(p,S),[v,D]=(0,a.useState)(2),[$,P]=(0,a.useState)(!1),[O,M]=(0,a.useState)(n??null),F=(0,w.usePlan)(p),A=(0,h.useBookings)(p),L=(0,T.useBlocks)(e=>e.blocks),W=(0,T.closedAreasAt)(L,p,(0,y.ymd)(S),(0,y.hm)(S)),E=i.default.useMemo(()=>{const e=Object.fromEntries(Object.entries(C).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,f.suggestTable)(F,A.filter(e=>e.date===(0,y.ymd)(S)),e,v,S,(0,f.turnFor)(v,k.settings.turnMins),90,void 0,{closed:W})?.table??null},[F,A,C,v,W.size,S.getTime()]);(0,a.useEffect)(()=>{O&&(0,w.tablesOf)(O).some(e=>'Closed'===C[e]?.label)&&M(null)},[O,W.size]);const[H,_]=(0,a.useState)(!1),[U,q]=(0,a.useState)(''),V=(e,t=String(e),s=()=>{P(!1),D(e)})=>{const o='9+'===t?$:!$&&v===e;return(0,I.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:'9+'===t?'Party of 9 or more':`Party of ${e}`,accessibilityState:{selected:o},onPress:s,style:{width:l?58:60,height:l?58:56,borderRadius:14,borderWidth:2,borderColor:x.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:o?x.colours.gold:'transparent'},children:(0,I.jsx)(j.T,{weight:"bold",size:22,colour:o?x.colours.onGold:x.colours.gold,children:t})},t)},G=(0,I.jsxs)(j.Row,{gap:12,style:{justifyContent:'center'},children:[(0,I.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:"One fewer",onPress:()=>D(e=>Math.max(9,e-1)),style:{width:56,height:56,borderRadius:28,borderWidth:2,borderColor:x.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,I.jsx)(j.T,{size:26,colour:x.colours.gold,children:"\u2212"})}),(0,I.jsx)(j.T,{weight:"bold",size:26,children:v}),(0,I.jsx)(d.default,{accessibilityRole:"button",accessibilityLabel:"One more",onPress:()=>D(e=>Math.min(40,e+1)),style:{width:56,height:56,borderRadius:28,borderWidth:2,borderColor:x.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,I.jsx)(j.T,{size:26,colour:x.colours.gold,children:"+"})})]}),K=(0,I.jsxs)(u.default,{style:{gap:8,width:l?256:void 0},children:[(0,I.jsx)(j.T,{weight:"semibold",children:"How many people?"}),(0,I.jsxs)(u.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"walkin-party",children:[R.map(e=>V(e)),V(9,'9+',()=>{P(!0),D(e=>e>=9?e:9)})]}),$?G:null]}),[Q,Y]=(0,a.useState)(!1),J=async(t=O)=>{if(!Q){Y(!0);try{const s=await h.repo.bookings.seatWalkIn(p,v,t??void 0,U);z(p,t??void 0),o(s),e()}finally{Y(!1)}}},X=(0,I.jsxs)(u.default,{style:{gap:8,flex:l?1:void 0,minWidth:0},children:[(0,I.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,I.jsxs)(j.T,{weight:"semibold",children:["Table ",(0,I.jsx)(j.T,{colour:x.colours.muted,size:14,children:"(optional)"})]}),O?(0,I.jsx)(j.Button,{small:!0,kind:"ghost",label:"Clear table",onPress:()=>M(null)}):null]}),(0,I.jsx)(N,{use:C,value:O,onPick:e=>{C[e]&&!C[e].busy?J(e):M(O===e?null:e)},big:l,dense:l,best:E,bestSet:(0,r.bestTables)(F)}),(0,I.jsxs)(j.Muted,{children:["Tap a free table to seat them there",E&&!O?` (suggested for ${v}: ${(0,s.tableNumbers)(E)})`:'',", or Seat for no table yet. BEST marks the venue\u2019s best tables."]})]});return(0,I.jsxs)(j.Sheet,{visible:!0,onClose:e,title:`Walk-in \xb7 ${(0,y.hm)(S)}`,maxWidth:l?1100:void 0,testID:"walkin-sheet",children:[(0,I.jsx)(j.Button,{label:`Seat walk-in \xb7 ${v} ${1===v?'person':'people'}${O?` \xb7 ${(0,s.tableNumbers)(O)}`:''}`,disabled:Q,onPress:()=>{J()},testID:"seat-walkin",style:{minHeight:52}}),l?(0,I.jsxs)(j.Row,{gap:16,style:{alignItems:'flex-start'},children:[K,X]}):(0,I.jsxs)(I.Fragment,{children:[K,X]}),(0,I.jsxs)(j.Row,{gap:10,wrap:!0,style:{alignItems:'center'},children:[H?(0,I.jsx)(t.TextInput,{accessibilityLabel:"Walk-in note",placeholder:"Note (optional), e.g. high chair",placeholderTextColor:"#7D776C",value:U,onChangeText:q,style:[j.styles.input,{flex:1,minWidth:220}],autoFocus:!0}):(0,I.jsx)(j.Button,{small:!0,kind:"ghost",label:"Add a note (optional)",onPress:()=>_(!0)}),(0,I.jsx)(u.default,{style:{flex:1,minWidth:220},children:(0,I.jsxs)(j.Muted,{children:["No name needed. Counts in today's covers.",'staff'!==c.APP_VARIANT?' Using website bookings too? Mark the table there as well.':'']})})]})]})}function A({booking:e,onClose:t,combine:o}){const{rid:l,r:n,now:d}=(0,b.useCtx)(15e3),c=B(l,d),p=(0,w.usePlan)(l),k=(0,h.useBookings)(l),T=(0,w.tablesOf)(e.table),S=i.default.useMemo(()=>Object.fromEntries(Object.entries(c).map(([e,t])=>[e,T.includes(e)?{busy:!1,label:'This party',soon:'This party'}:t])),[c,e.table]),C=i.default.useMemo(()=>{const t=Object.fromEntries(Object.entries(S).map(([e,t])=>[e,{status:t.busy?'seated':'free'}]));return(0,f.suggestTable)(p,k.filter(e=>e.date===(0,y.ymd)(d)),t,e.partySize,d,(0,f.turnFor)(e.partySize,n.settings.turnMins),90,e.id)?.table??null},[p,k,S,e.partySize,d.getTime()]),[v,D]=(0,a.useState)(!!o||T.length>1),[$,P]=(0,a.useState)(T),O=e=>p.tables.find(t=>t.name===e)?.maxSeats??0,R=$.reduce((e,t)=>e+O(t),0),F=$.length>0&&R{const o=(0,w.joinTables)(s);await h.repo.bookings.assignTable(e.id,o);T.filter(e=>!s.includes(e)).forEach(t=>w.useFloor.getState().setLive(l,t,{stage:void 0,dirty:'seated'===e.status})),'seated'===e.status&&z(l,o),t()},L=v?(0,I.jsxs)(u.default,{style:{gap:8},testID:"assign-table-tip",children:[(0,I.jsx)(u.default,{accessibilityLiveRegion:"polite",children:(0,I.jsx)(j.T,{size:17,weight:"semibold",colour:x.colours.text,children:$.length?`${(0,w.tablesLabel)((0,w.joinTables)($))} \xb7 ${R} seats for ${e.partySize} covers`:'No tables picked yet'})}),F?(0,I.jsx)(u.default,{testID:"combine-short",children:(0,I.jsxs)(j.T,{size:15,weight:"semibold",colour:"#FFD9D4",children:["Not enough seats yet: ",e.partySize-R," more needed. Add another table."]})}):null,(0,I.jsx)(j.T,{size:15,colour:x.colours.text,children:"Tap each table to add or remove it, then tap Done. All of them show as taken until the party has finished."}),(0,I.jsxs)(j.Row,{gap:8,wrap:!0,children:[(0,I.jsx)(j.Button,{label:"Done",testID:"combine-done",disabled:!$.length,accessibilityLabel:$.length?`Done, save ${(0,w.tablesLabel)((0,w.joinTables)($))}`:'Done',onPress:()=>A($)}),(0,I.jsx)(j.Button,{kind:"ghost",label:"Cancel",onPress:t})]})]}):(0,I.jsx)(u.default,{style:{gap:8},testID:"assign-table-tip",children:(0,I.jsx)(j.T,{size:15,colour:x.colours.text,children:"Red tables are in use right now; you can still pick one (e.g. joining a table). BEST marks the venue\u2019s best tables. Big party? Tap Combine tables."})});return(0,I.jsxs)(j.Sheet,{visible:!0,onClose:t,title:`${v?'Combine tables':'Assign table'} \xb7 ${M(e)}`,testID:"assign-table-sheet",footer:L,children:[C&&!v?(0,I.jsx)(u.default,{testID:"assign-suggested",children:(0,I.jsxs)(j.T,{size:16,weight:"semibold",colour:x.colours.goldLight,children:["Suggested for ",e.partySize,": ",(0,s.tableNumbers)(C)]})}):null,v?null:(0,I.jsx)(j.Button,{kind:"secondary",label:"Combine tables",testID:"combine-start",accessibilityLabel:"Combine tables: pick several tables for this party",onPress:()=>D(!0)}),(0,I.jsx)(N,{use:S,best:v?null:C,bestSet:(0,r.bestTables)(p),picked:v?$:void 0,onPick:v?e=>P(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]):async e=>{await A([e])}})]})}function L(e){(0,n.notify)({id:`walkin:${e.id}`,testID:'walkin-toast',timeoutMs:6e3,title:`${M(e)} seated \xb7 ${e.table?`${(0,s.tableNumbers)(e.table)}`:'table to assign'} (${e.ref})`,actions:[{label:'Undo',testID:'undo-walkin',onPress:()=>h.repo.bookings.undoWalkIn(e.id)},{label:'OK',kind:'ghost'}]})}function W({date:e,onClose:t,wide:n,onSaved:i}){const{rid:r,r:d,now:c,role:P,meId:O}=(0,b.useCtx)(6e4),z=(0,y.ymd)(c),[B,M]=(0,a.useState)(ee.blocks),[F,A]=(0,a.useState)(!1),[L,W]=(0,a.useState)(''),[E,H]=(0,a.useState)(2),[_,U]=(0,a.useState)(null),[q,V]=(0,a.useState)(''),[G,K]=(0,a.useState)(''),[Q,Y]=(0,a.useState)(''),[J,X]=(0,a.useState)('phone'),[Z,ee]=(0,a.useState)((0,C.emptyNeeds)()),te=(0,C.needsMissing)(Z),[se,oe]=(0,a.useState)(null),le=(0,w.usePlan)(r),ne=(0,$.dogSetUp)(le),ae=!0===Z.dog&&ne,ie=Z.dog?Z.dogs:0,re=(0,y.parseYmd)(B),de=(0,f.turnFor)(E,d.settings.turnMins),ue=N.filter(e=>e.date===B),ce=e=>(0,f.freeTablesAt)(le,ue,E,new Date(`${B}${(0,s.tableNumbers)(e)}:00`),de,d.settings.turnMins,{dog:!0,closed:(0,T.closedAreasAt)(R,r,B,e)}),be=ae&&_?ce(_):[];(0,a.useEffect)(()=>{oe(null)},[ae,_,E]);const he=(0,p.bookingSlots)(d,re,e=>N.filter(t=>t.date===B&&t.time===e&&'cancelled'!==t.status&&!t.walkIn).reduce((e,t)=>e+t.partySize,0),E,B===(0,y.ymd)(c)?c:(0,y.addMins)(re,0)),ge=(0,k.ukPhone)(G),pe=_?(0,T.blockAt)(R,r,B,_):void 0,me='staff'!==P,fe=!!_&&!(0,C.dogTimeOk)(d,N,B,_,ie),ye=!te.length&&L.trim().length>=2&&!!_&&ge.ok&&(0,k.emailOk)(Q)&&(!pe||me&&F)&&(!ae||be.length>0)&&!fe,xe=Z.wheelchair>0||Z.stepFree;return(0,I.jsxs)(j.Sheet,{visible:!0,onClose:t,title:`New booking \xb7 ${(0,y.niceDate)(re)}`,maxWidth:n?760:void 0,testID:"booking-sheet",children:[(0,I.jsx)(C.FirstQuestions,{rid:r,value:Z,onChange:ee,party:E,audience:"staff"}),Z.dog&&!ne?(0,I.jsx)(j.T,{size:13,colour:x.colours.amber,children:"Dog-friendly tables aren\u2019t marked yet. Managers \u203a Booking options \u203a Tables. Booking is allowed; check where the dog can sit."}):null,(0,I.jsx)(S.BookingDatePicker,{r:d,today:c,value:B,onChange:e=>{e!==B&&(M(e),U(null),A(!1))}}),(0,I.jsxs)(j.Row,{gap:6,children:[(0,I.jsx)(j.Chip,{label:"Phone",selected:'phone'===J,onPress:()=>X('phone')}),(0,I.jsx)(j.Chip,{label:"In person",selected:'in-person'===J,onPress:()=>X('in-person')})]}),(0,I.jsx)(j.Field,{label:"Name",value:L,onChangeText:W,placeholder:"e.g. Reid",testID:"nb-name"}),(0,I.jsx)(j.Field,{label:"Mobile or phone number (needed)",value:G,onChangeText:K,keyboardType:"phone-pad",placeholder:"e.g. 07700 900123",testID:"nb-phone"}),!ge.ok&&G?(0,I.jsx)(j.T,{size:13,colour:x.colours.amber,children:ge.error}):null,(0,I.jsx)(j.Field,{label:"Email (optional)",value:Q,onChangeText:Y,keyboardType:"email-address",autoCapitalize:"none",placeholder:"For an email confirmation too",testID:"nb-email"}),(0,k.emailOk)(Q)?null:(0,I.jsx)(j.T,{size:13,colour:x.colours.amber,children:"That email doesn\u2019t look quite right."}),(0,I.jsxs)(j.Row,{style:{justifyContent:'space-between'},children:[(0,I.jsx)(j.T,{children:"Covers"}),(0,I.jsx)(j.Stepper,{value:E,onChange:H,min:1,max:20,label:"covers"})]}),(0,I.jsx)(j.Row,{wrap:!0,gap:6,children:he.map(e=>{const t=ae&&e.available&&!ce(e.time).length||!(0,C.dogTimeOk)(d,N,B,e.time,ie);return(0,I.jsx)(j.Chip,{label:e.time,sub:(0,T.blockAt)(R,r,B,e.time)?'Paused':t?'Dogs full':e.drinksOnly?'Drinks only':`${e.left} left`,disabled:!e.available||t,selected:_===e.time,onPress:()=>{U(e.time),A(!1)}},e.time)})}),ae&&_?(0,I.jsxs)(u.default,{style:{gap:6},testID:"nb-dog-tables",children:[(0,I.jsxs)(j.T,{size:14,weight:"semibold",children:["Dog-friendly table ",(0,I.jsxs)(j.T,{size:13,colour:x.colours.muted,children:["(",le.areas.filter(e=>e.dogs).map(e=>e.name).join(' or '),")"]})]}),be.length?(0,I.jsx)(j.Row,{wrap:!0,gap:6,children:be.slice(0,10).map((e,t)=>(0,I.jsx)(j.Chip,{label:`${(0,s.tableNumbers)(e.table)}`,sub:`${e.area} \xb7 ${e.seats}${0===t?' \xb7 best':''}${xe&&(0,$.accessibleSetUp)(le)&&!(0,$.isAccessible)(le,e.table)?' \xb7 not step-free':''}`,selected:(se??be[0].table)===e.table,onPress:()=>oe(e.table)},e.table))}):(0,I.jsxs)(j.T,{size:14,colour:x.colours.amber,children:["No dog-friendly table free for ",E," at ",_,". Try another time."]})]}):null,pe?(0,I.jsxs)(u.default,{testID:"nb-block-warning",style:{borderWidth:1.5,borderColor:x.colours.amber,backgroundColor:x.colours.amberBg,borderRadius:12,padding:10,gap:6},children:[(0,I.jsxs)(j.T,{weight:"semibold",colour:x.colours.amber,children:["Bookings are paused ",pe.from,"\u2013",pe.to,pe.reason?` (${pe.reason})`:'']}),me?(0,I.jsx)(j.Chip,{label:F?'Manager override on':'Override and book anyway',selected:F,onPress:()=>A(e=>!e)}):(0,I.jsx)(j.Muted,{children:"Ask a manager to override, or pick another time."})]}):null,he.length?null:(0,I.jsx)(u.default,{testID:"nb-closed",children:(0,I.jsxs)(j.T,{size:14,weight:"semibold",colour:x.colours.amber,children:["Closed on ",(0,y.niceDate)(re)," (per the venue\u2019s opening hours). Pick another date."]})}),(0,I.jsx)(C.MoreQuestions,{rid:r,r:d,value:Z,onChange:ee,party:E,date:B,time:_,today:(0,y.ymd)(c),bookings:N,audience:"staff",showTables:!1!==d.settings.tableRequests}),xe&&!(0,$.accessibleSetUp)(le)?(0,I.jsx)(j.T,{size:13,colour:x.colours.amber,children:"Step-free tables aren\u2019t marked yet (Managers \u203a Booking options \u203a Tables). Check the table works for a wheelchair."}):null,(0,I.jsx)(j.Field,{label:"Notes (optional)",value:q,onChangeText:V,placeholder:v.NOTES_PLACEHOLDER,multiline:!0,numberOfLines:3,testID:"nb-notes"}),(0,l.depositDue)((0,l.depositOf)(d.settings),E)?(0,I.jsxs)(j.Muted,{children:["Deposit due: ",(0,o.gbp)((0,l.depositDue)((0,l.depositOf)(d.settings),E))," (",(0,o.gbp)((0,l.depositOf)(d.settings).perPersonPence)," per person for ",(0,l.depositOf)(d.settings).fromParty,"+). Deposits are paid through website bookings or to you, never in CoverCharge: tick Deposit paid on the booking once the guest has paid."]}):null,(0,I.jsxs)(j.Muted,{children:["The guest gets a confirmation text",Q.trim()?' and email':''," automatically (preview mode: shown in the Outbox, not sent)."]}),fe?(0,I.jsxs)(j.T,{size:14,colour:x.colours.amber,children:["We already have the most dogs we can look after at ",_,". Try another time: dogs are very welcome then."]}):null,(0,I.jsx)(j.Button,{label:te.length?te[0]:'Save booking',testID:"nb-save",disabled:!ye,onPress:()=>{if(B<(0,y.ymd)(c))return;const e=(0,C.needsPatch)(Z),s=Z.tableReq.find(e=>!ae||be.some(t=>t.table===e));h.repo.bookings.create({restaurantId:r,customerId:null,name:L.trim(),partySize:E,date:B,time:_,notes:q.trim(),security:(0,l.depositDue)((0,l.depositOf)(d.settings),E)?'deposit':'none',depositPaid:0,...(0,l.depositDue)((0,l.depositOf)(d.settings),E)?{depositDue:(0,l.depositDue)((0,l.depositOf)(d.settings),E),depositPolicy:(0,l.depositWords)((0,l.depositOf)(d.settings),E,d.name).join(' '),depositRefundable:(0,l.depositOf)(d.settings).refundable,depositCutoffHours:(0,l.depositOf)(d.settings).cutoffHours}:{},phone:ge.pretty,email:Q.trim()||void 0,source:J,...e,...he.find(e=>e.time===_)?.drinksOnly?{drinksOnly:!0}:{},allergies:e.allergies??[],...ae?{table:se??s??be[0]?.table}:{}}).then(e=>(0,D.postNewBookingToKitchen)(e,O)).catch(()=>{}),i?.({date:B,time:_,name:L.trim()}),t()}})]})}},925,[875,808,816,13,918,30,944,263,127,806,926,819,817,826,818,821,823,813,825,824,1297,827,812,949,828,24]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"fmtH",{enumerable:!0,get:function(){return d.fmtH}}),Object.defineProperty(_e,"fmtHDay",{enumerable:!0,get:function(){return d.fmtHDay}}),Object.defineProperty(_e,"clampRole",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"StaffAppCtx",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"useInStaffApp",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"ShiftMgrScope",{enumerable:!0,get:function(){return y}}),_e.useShiftManager=D,_e.useSignedIn=b,_e.useCtx=function(e=1e4){const o=(0,t.useContext)(p),u=(0,r.useOwner)(e=>e.site),i=(0,r.useOwner)(e=>e.previewRole),f=(0,r.useOwner)(e=>e.staffAs),d=b(),m=o||'staff'===s.APP_VARIANT,w=(0,t.useContext)(y),h=D(),O=m?w&&h?'manager':'staff':d?l(i,d.role):i,S=(0,r.useOwner)(e=>e.staff),M=(0,n.useRestaurant)(u),A=(0,n.useNow)(e),I=d?d.id:m&&f?f:c[O],P=S.find(e=>e.id===I)?.name??'Team member';return{rid:u,r:M,now:A,role:O,me:P,meId:I,today:(0,a.venueYmd)(A),signedIn:!!d}},Object.defineProperty(_e,"weekday",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"DAY3",{enumerable:!0,get:function(){return O}}),_e.ensureAttendance=function(t,n){if(e.LIVE_VENUE_BUILD||(0,o.isLive)())return;const s=r.useOwner.getState(),u=[],i=s.staff.find(e=>e.active&&'manager'===e.role)??s.staff.find(e=>e.active&&'owner'===e.role),f=new Date(n);f.setDate(n.getDate()-h(n));const d=(0,a.ymd)(f),c=(0,a.ymd)(new Date(f.getFullYear(),f.getMonth(),f.getDate()+6)),m=(e,t,n)=>{const r=new Date(e);return r.setHours(0,0,0,0),r.setMinutes(Math.round(60*t)+n),r.toISOString()};for(let e=42;e>=1;e--){const t=new Date(n);t.setDate(t.getDate()-e);const r=(0,a.ymd)(t);if(s.attendance.some(e=>e.date===r))continue;const o=s.shifts.filter(e=>e.date===r&&!1!==e.published);(o.length?o:s.shifts.filter(e=>e.day===h(t)&&e.date>=d&&e.date<=c&&!1!==e.published)).forEach((n,a)=>{const s=e=>Math.round((7*r.charCodeAt(9)+13*a+e)%17-5),o=n.end-n.start,f=o>8?30:o>6?20:0,d=e>2&&i?{signOff:{by:i.name,byId:i.id,at:m(t,34,a)}}:{};u.push({id:`at-${r}-${n.staffId}`,staffId:n.staffId,date:r,in:m(t,n.start,s(1)),out:m(t,n.end,s(2)),inSite:!0,outSite:!0,breakMins:f,...d})})}u.length&&r.useOwner.setState({attendance:[...r.useOwner.getState().attendance,...u]})},_e.paidMins=function(e,t){if(!e.in)return{worked:0,brk:0,paid:0};const n=Math.max(0,Math.round(((e.out?new Date(e.out):t).getTime()-new Date(e.in).getTime())/6e4)),r=e.breakMins??0;return{worked:n,brk:r,paid:Math.max(0,n-r)}},Object.defineProperty(_e,"hmDur",{enumerable:!0,get:function(){return S}}),_e.payRange=function(e,t,n){const r=new Date(n);if(r.setHours(0,0,0,0),'monthly'===e){const e=new Date(r.getFullYear(),r.getMonth()+t,1),n=new Date(e.getFullYear(),e.getMonth()+1,0);return{s:e,e:n,key:`m-${(0,a.ymd)(e)}`}}const s='weekly'===e?7:14,o=new Date(r);o.setDate(r.getDate()-h(r));let u=new Date(o);if('fortnightly'===e){const e=new Date(2026,0,5);(Math.round((o.getTime()-e.getTime())/6048e5)%2+2)%2==1&&u.setDate(u.getDate()-7)}u.setDate(u.getDate()+t*s);const i=new Date(u);return i.setDate(u.getDate()+s-1),{s:u,e:i,key:`${e[0]}-${(0,a.ymd)(u)}`}},_e.useHourly=function(){const e=b(),t=(0,r.useOwner)(e=>e.hourly);return e?t:M};var e=_r(_d[0]),t=_r(_d[1]),n=_r(_d[2]),r=_r(_d[3]),a=_r(_d[4]),s=_r(_d[5]),o=_r(_d[6]),u=_r(_d[7]),i=_r(_d[8]),f=_r(_d[9]),d=_r(_d[10]);const c={owner:f.ROSTER.find(e=>'owner'===e.role)?.id??'',manager:f.ROSTER.find(e=>'manager'===e.role)?.id??'',staff:f.ROSTER.find(e=>'staff'===e.app)?.id??''},m={staff:0,manager:1,owner:2},l=(e,t)=>m[e]>m[t]?t:e,p=(0,t.createContext)(!1),w=()=>(0,t.useContext)(p),y=(0,t.createContext)(!1);function D(){const e=(0,t.useContext)(p)||'staff'===s.APP_VARIANT,n=b(),r=(0,o.useSync)(e=>!!e.venueId&&'staff'===e.kind),a=(0,o.useSync)(e=>e.perms);return(0,u.shiftManagerOn)({inStaffApp:e,managerAccess:n?.managerAccess,role:n?.role,app:(0,i.rosterPerson)(n?.id)?.app,live:r,perms:a})}function b(){const e=(0,i.useSession)(e=>e.meId),t=(0,r.useOwner)(e=>e.staff);return e?t.find(t=>t.id===e&&t.active):void 0}const h=e=>(e.getDay()+6)%7,O=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'];const S=e=>`${Math.floor(e/60)}h ${String(e%60).padStart(2,'0')}m`;const M={}},926,[833,30,819,854,818,806,820,1030,858,14,1029]); +__d(function(_g,_r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"snap",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"fitLabel",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"BIG_LABEL_MIN",{enumerable:!0,get:function(){return y}}),_e.areaBounds=w,_e.minReadableScale=function(e,t){return Math.max(0,...e.tables.filter(e=>e.areaId===t).map(e=>{const t='round'===e.shape?.85:1,o=(7.4399999999999995*Math.max(1,(0,c.tableNumber)(e).length)+6)/(e.w*t),n=22/Math.min(e.w,e.h);return Math.max(o,n)}))},_e.seatSpots=M,_e.FixtureShape=j,_e.FloorCanvas=function(e){const[v,k]=(0,n.useState)({w:0,h:0}),C=e.plan.tables.filter(t=>t.areaId===e.areaId),I=e.crop&&C.length?w(e.plan,e.areaId):{x:0,y:0,w:s.PLAN_W,h:s.PLAN_H},z={x:I.x,y:I.y,r:I.x+I.w,b:I.y+I.h},R=v.w?'width'===e.fit?Math.min(v.w/s.PLAN_W,e.maxH?e.maxH/s.PLAN_H:9):Math.min(v.w/I.w,v.h/I.h):0,S=e.fill&&'contain'===e.fit&&R>0&&v.h>0,$=S?(v.w/R-I.w)/2:0,A=S?(v.h/R-I.h)/2:0,T={x:z.x-$,y:z.y-A,r:z.r+$,b:z.b+A},L=T.r-T.x,E=T.b-T.y,[N,F]=(0,n.useState)(null),_=(0,n.useRef)(null),B=t=>e.plan.sections.find(e=>e.id===t.sectionId),P=t=>e.plan.joins.find(e=>e.tables.includes(t.name)),D=r.default.useMemo(()=>(0,c.numberClashes)(e.plan.tables).sameArea,[e.plan.tables]),O=(t,o)=>({onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>!0,onResponderTerminationRequest:()=>!1,onResponderGrant:e=>{_.current={x:e.nativeEvent.pageX,y:e.nativeEvent.pageY,id:t.id,kind:o}},onResponderMove:n=>{const r=_.current;if(!r)return;const i=n.nativeEvent.pageX-r.x,s=n.nativeEvent.pageY-r.y;Math.abs(i)+Math.abs(s)<6&&!N||('live'!==e.mode||e.onDrop&&e.view&&['seated','mains','dessert','bill'].includes(e.view[t.name]?.status)&&e.view[t.name]?.booking)&&F({id:t.id,dx:i,dy:s,kind:o})},onResponderRelease:n=>{const r=_.current;_.current=null;const i=n.nativeEvent.pageX-(r?.x??0),a=n.nativeEvent.pageY-(r?.y??0);if(F(null),Math.abs(i)+Math.abs(a)<6||!R)return void('move'===o&&e.onTap?.(t));const l=i/R,u=a/R;if('edit'===e.mode&&'move'===o)e.onMove?.(t,p(g(t.x+l,e.snapOn),0,s.PLAN_W-t.w),p(g(t.y+u,e.snapOn),0,s.PLAN_H-t.h));else if('edit'===e.mode&&'resize'===o)e.onResize?.(t,p(g(t.w+l,e.snapOn),50,400),p(g(t.h+u,e.snapOn),50,300));else if('live'===e.mode&&e.onDrop){const o=t.x+t.w/2+l,n=t.y+t.h/2+u,r=C.find(e=>e.id!==t.id&&o>=e.x-10&&o<=e.x+e.w+10&&n>=e.y-10&&n<=e.y+e.h+10);r&&e.onDrop(t,r)}}}),W=e=>e*R,H='width'===e.fit?s.PLAN_H*R||200:void 0;return(0,b.jsx)(i.default,{testID:"floor-canvas",onLayout:e=>k({w:e.nativeEvent.layout.width,h:e.nativeEvent.layout.height}),style:[{width:'100%',borderRadius:16,overflow:'hidden'},'contain'===e.fit?{flex:1}:{height:H}],children:R?(0,b.jsx)(i.default,{style:{width:W(L),height:W(E),alignSelf:'center',backgroundColor:(0,t.soutersSurface)('#0F0E0C'),borderRadius:16,borderWidth:1,borderColor:l.colours.border,overflow:'hidden'},children:(0,b.jsxs)(i.default,{style:{position:'absolute',left:-W(T.x),top:-W(T.y),width:W(s.PLAN_W),height:W(s.PLAN_H)},children:['edit'===e.mode?Array.from({length:s.PLAN_W/(2*s.GRID)},(e,o)=>(0,b.jsx)(i.default,{style:{position:'absolute',left:W(o*s.GRID*2),top:0,bottom:0,width:1,backgroundColor:(0,t.soutersSurface)('#1E1B16')}},`v${o}`)):null,'edit'===e.mode?Array.from({length:s.PLAN_H/(2*s.GRID)},(e,o)=>(0,b.jsx)(i.default,{style:{position:'absolute',top:W(o*s.GRID*2),left:0,right:0,height:1,backgroundColor:(0,t.soutersSurface)('#1E1B16')}},`h${o}`)):null,(e.plan.fixtures??[]).filter(t=>t.areaId===e.areaId).map(t=>(0,b.jsx)(j,{f:t,S:W,live:'live'===e.mode},t.id)),e.plan.joins.map(e=>{const t=C.filter(t=>e.tables.includes(t.name));if(t.length<2)return null;const[o,n]=t,r=o.x+o.w/2,s=o.y+o.h/2,a=n.x+n.w/2,l=n.y+n.h/2,u=Math.hypot(a-r,l-s),h=Math.atan2(l-s,a-r);return(0,b.jsx)(i.default,{testID:`join-${e.tables.join('+')}`,style:{position:'absolute',left:W((r+a)/2-u/2),top:W((s+l)/2)-3,width:W(u),height:6,borderRadius:3,backgroundColor:'rgba(207,164,95,0.55)',transform:[{rotate:`${h}rad`}]}},e.id)}),C.map(n=>{const g=e.view?.[n.name],p=g?a.STATUS[g.status]:a.STATUS.free,v=N?.id===n.id,w=v&&'resize'===N.kind?Math.max(50,n.w+N.dx/R):n.w,j=v&&'resize'===N.kind?Math.max(50,n.h+N.dy/R):n.h,k=v&&'move'===N.kind?n.x+N.dx/R:n.x,C=v&&'move'===N.kind?n.y+N.dy/R:n.y,I=e.selected===n.id||e.highlight?.includes(n.name),z=B(n),S='edit'===e.mode?'#2A2419':p.colour,$='edit'===e.mode?l.colours.text:p.fg,A='round'===n.shape?W(Math.min(w,j))/2:W(10),T='live'===e.mode?(0,c.liveTableLabel)(n,D):(0,s.tableLabel)(n),L=W(Math.min(w,j))<64,E=f(e.big?Math.max(13,Math.min(34,W(Math.min(w,j))/3)):Math.max(11,Math.min(22,W(Math.min(w,j))/4)),T,W(w)*('round'===n.shape?.85:1),e.big?y:9),F=Math.max(e.big?11:12,Math.round(.62*E)),_=(W(j)-6-1.4*E)/(1.4*F),H=_>=2&&W(w)>=5*F?2:_>=1?1:0,G=g?g.booking&&void 0!==g.seatedMins?g.booking.time:g.next?.time:void 0,X='edit'===e.mode?`${(0,o.tableNumbers)(T)}, ${(0,s.shapeLabel)(n.shape).toLowerCase()}, ${n.minSeats}\u2013${n.maxSeats} seats${n.online?', bookable online':''}`:`${(0,o.tableNumbers)(T)}, ${p.label}${void 0!==g?.seatedMins?`, seated ${g.seatedMins} min`:''}${g?.covers?`, ${g.covers} covers`:''}${void 0!==g?.nextIn&&'seated'!==g.status?`, next booking ${g.next?.time}`:''}${g?.dayBookings?.length?`, booked: ${g.dayBookings.map(e=>`${e.time}, ${e.partySize} Covers`).join('; ')}`:''}${g?.group?`, combined with ${g.group.filter(e=>e!==n.name).map(e=>`table ${e}`).join(', ')}`:''}`,Y=void 0!==g?.seatedMins&&g.booking?Math.min(1.2,g.seatedMins/(g.booking.durationMins??(0,a.turnFor)(g.booking.partySize,e.turnBase))):null;return(0,b.jsxs)(r.default.Fragment,{children:[M({...n,w:w,h:j}).map((t,o)=>(0,b.jsx)(i.default,{pointerEvents:"none",style:[{position:'absolute',left:W(k+t.x)-Math.max(4,W(8)),top:W(C+t.y)-Math.max(4,W(8)),width:Math.max(8,W(16)),height:Math.max(8,W(16)),borderRadius:99,backgroundColor:'edit'===e.mode?'#5A4C33':'rgba(255,255,255,0.16)',borderWidth:1,borderColor:'edit'===e.mode?l.colours.gold:'rgba(255,255,255,0.25)'},x()]},o)),'live'===e.mode&&(W(w)<44||W(j)<44)?(0,b.jsx)(i.default,{accessible:!1,importantForAccessibility:"no-hide-descendants",'aria-hidden':!0,...O(n,'move'),style:{position:'absolute',left:W(k+w/2)-Math.max(44,W(w))/2,top:W(C+j/2)-Math.max(44,W(j))/2,width:Math.max(44,W(w)),height:Math.max(44,W(j)),zIndex:2}}):null,(0,b.jsxs)(i.default,{testID:`table-${n.name}`,accessibilityRole:"button",accessibilityLabel:X,onAccessibilityTap:()=>e.onTap?.(n),onKeyDown:t=>{'Enter'!==t?.key&&' '!==t?.key||e.onTap?.(n)},tabIndex:0,...O(n,'move'),style:[{position:'absolute',left:W(k),top:W(C),width:W(w),height:W(j),borderRadius:A,backgroundColor:S,alignItems:'center',justifyContent:'center',padding:2,borderWidth:I?3:e.sectionColours&&z?2.5:1.5,borderColor:I?'#FFFFFF':e.sectionColours&&z?(0,l.brandColour)(z.colour):'edit'===e.mode?l.colours.gold:'rgba(0,0,0,0.35)',transform:[{scale:v?1.06:1}],zIndex:v?50:3,opacity:v&&'live'===e.mode?.85:1,shadowColor:'#000',shadowOpacity:v?.6:.3,shadowRadius:v?14:6,cursor:'edit'===e.mode?'grab':'pointer',touchAction:'none'},v?null:x()],children:[(0,b.jsxs)(i.default,{style:{alignItems:'center'},pointerEvents:"none",children:[(0,b.jsx)(u.T,{weight:"bold",size:E,colour:$,center:!0,numberOfLines:1,children:T}),'live'===e.mode&&'blocked'===g?.status?(0,b.jsx)(u.T,{size:Math.max(10,Math.round(.5*E)),weight:"semibold",colour:$,center:!0,numberOfLines:1,children:"Blocked"}):null,e.big&&'live'===e.mode&&g&&1===H?g.covers||G?(0,b.jsx)(u.T,{size:F,weight:"bold",colour:$,center:!0,numberOfLines:1,children:'free'===g.status||'soon'===g.status?G?`${g.dayBookings?'Booked':'Next'} ${G}`:'':[g.covers?`${g.covers}`:'',G??''].filter(Boolean).join(' \xb7 ')}):null:e.big&&'live'===e.mode&&g&&2===H?(0,b.jsxs)(b.Fragment,{children:[g.covers?(0,b.jsxs)(u.T,{size:F,weight:"semibold",colour:$,center:!0,children:[g.covers," cover",1===g.covers?'':'s']}):'free'!==g.status||L?null:(0,b.jsxs)(u.T,{size:F,colour:$,center:!0,children:[n.minSeats,"\u2013",n.maxSeats]}),G?(0,b.jsx)(u.T,{size:F,weight:"bold",colour:$,center:!0,children:'free'===g.status||'soon'===g.status?`${g.dayBookings?'Booked':'Next'} ${G}`:G}):'dirty'===g.status?(0,b.jsx)(u.T,{size:F,colour:$,center:!0,children:"Clear"}):null]}):e.big&&'live'===e.mode?null:'edit'===e.mode?L?null:(0,b.jsxs)(u.T,{size:11,colour:l.colours.muted,center:!0,children:[n.minSeats,"\u2013",n.maxSeats,n.online?' \xb7 online':'']}):g?(0,b.jsxs)(b.Fragment,{children:['free'!==g.status||L?null:(0,b.jsxs)(u.T,{size:11,colour:$,center:!0,children:[n.minSeats,"\u2013",n.maxSeats," seats"]}),void 0!==g.seatedMins?(0,b.jsxs)(u.T,{size:12,weight:"semibold",colour:$,center:!0,children:[g.seatedMins,"m \xb7 ",g.covers,"\ud83d\udc65"]}):g.orderOnly?(0,b.jsx)(u.T,{size:11,colour:$,center:!0,children:"Open order"}):null,'soon'===g.status&&g.next?(0,b.jsxs)(u.T,{size:11,weight:"semibold",colour:$,center:!0,children:[g.next.time," \xb7 ",void 0===g.nextIn?`${g.next.partySize} Covers`:g.nextIn<=0?'due':`${g.nextIn}m`]}):null,'dirty'!==g.status||L?null:(0,b.jsx)(u.T,{size:11,colour:$,center:!0,children:"Clear"}),!L||g.allergy||g.vip?(0,b.jsxs)(u.T,{size:11,colour:$,center:!0,children:[g.allergy?'\u26a0':'',g.vip?'VIP'===g.vip?'\u2605':'\u2665':'',g.occasion?a.OCCASION_ICON[g.occasion]:'',g.note?'\u270e':'']}):null]}):null]}),null,'live'===e.mode&&g&&!L&&(g.booking??g.next)&&(0,h.needsIcons)(g.booking??g.next).replace('\u26a0\ufe0f','').trim()?(0,b.jsx)(i.default,{pointerEvents:"none",testID:`needs-${n.name}`,style:{position:'absolute',bottom:e.big?-Math.max(9,.55*F):2,right:e.big?-6:4,backgroundColor:(0,t.soutersSurface)('rgba(11,11,11,0.85)'),borderRadius:8,paddingHorizontal:4,borderWidth:1,borderColor:'rgba(255,255,255,0.15)'},children:(0,b.jsx)(u.T,{size:e.big?Math.max(11,.75*F):10,children:(0,h.needsIcons)(g.booking??g.next).replace('\u26a0\ufe0f','').trim()})}):null,z&&'live'===e.mode&&e.sectionColours&&!L&&!e.big?(0,b.jsx)(i.default,{pointerEvents:"none",style:{position:'absolute',top:3,right:6,backgroundColor:(0,l.brandColour)(z.colour),borderRadius:6,paddingHorizontal:3},children:(0,b.jsx)(u.T,{size:9,weight:"bold",colour:"#0B0B0B",children:z.server})}):null,null===Y||L?null:(0,b.jsx)(i.default,{pointerEvents:"none",style:{position:'absolute',left:'15%',right:'15%',bottom:5,height:4,borderRadius:2,backgroundColor:'rgba(0,0,0,0.25)'},children:(0,b.jsx)(i.default,{style:{width:`${Math.min(100,100*Y)}%`,height:4,borderRadius:2,backgroundColor:Y>=1?'#B3261E':'rgba(0,0,0,0.6)'}})}),'live'===e.mode&&g?.group?(0,b.jsx)(i.default,{pointerEvents:"none",testID:`group-${n.name}`,style:{position:'absolute',top:e.big?-Math.max(10,.6*F):2,right:e.big?-6:3,backgroundColor:(0,t.soutersSurface)('#0B0B0B'),borderRadius:8,paddingHorizontal:5,borderWidth:1.5,borderColor:l.colours.gold},children:(0,b.jsxs)(u.T,{size:e.big?Math.max(12,.8*F):10,weight:"bold",colour:l.colours.goldLight,children:["\u26d3 ",(U=g.group,(0,s.tablesLabel)(U.join('+')).replace(/^Tables? /,'').replace(/ \+ /g,'+'))]})}):null,P(n)&&'edit'===e.mode?(0,b.jsx)(i.default,{pointerEvents:"none",style:{position:'absolute',bottom:2,left:4},children:(0,b.jsx)(u.T,{size:10,colour:l.colours.gold,children:"\u26d3"})}):null]}),'edit'===e.mode&&e.selected===n.id?(0,b.jsx)(i.default,{testID:"resize-handle",accessibilityLabel:"Resize table",...O(n,'resize'),style:{position:'absolute',left:W(k+w)-14,top:W(C+j)-14,width:28,height:28,borderRadius:14,backgroundColor:l.colours.gold,borderWidth:2,borderColor:'#fff',zIndex:60,cursor:'nwse-resize',touchAction:'none'}}):null]},n.id);var U}),0===C.length?(0,b.jsx)(i.default,{style:{position:'absolute',left:0,right:0,top:'45%'},children:(0,b.jsxs)(u.T,{center:!0,colour:l.colours.muted,children:["No tables in this area yet",'edit'===e.mode?' \u2014 add some in Tables':'',"."]})}):null]})}):null})};var t=_r(d[0]),o=_r(d[1]),n=_r(d[2]),r=e(n);_r(d[3]);var i=e(_r(d[4])),s=_r(d[5]),a=_r(d[6]),l=_r(d[7]),u=_r(d[8]),h=_r(d[9]),c=_r(d[10]),b=_r(d[11]);const x=(e=250)=>({transitionProperty:'background-color, border-color, transform, left, top, width, height',transitionDuration:`${e}ms`}),g=(e,t=!0)=>t?Math.round(e/s.GRID)*s.GRID:Math.round(e),p=(e,t,o)=>Math.max(t,Math.min(o,e)),f=(e,t,o,n=9)=>Math.max(n,Math.min(e,(o-6)/(.62*Math.max(1,t.length)))),y=12,v=46;function w(e,t){const o=e.tables.filter(e=>e.areaId===t);if(!o.length)return{x:0,y:0,w:s.PLAN_W,h:s.PLAN_H};const n=Math.max(0,Math.min(...o.map(e=>e.x))-v),r=Math.max(0,Math.min(...o.map(e=>e.y))-v);return{x:n,y:r,w:Math.min(s.PLAN_W,Math.max(...o.map(e=>e.x+e.w))+v)-n,h:Math.min(s.PLAN_H,Math.max(...o.map(e=>e.y+e.h))+v)-r}}function M(e){const t=Math.max(1,e.maxSeats),o=[];if('round'===e.shape){const n=e.w/2+9.6,r=e.h/2+9.6;for(let i=0;ie.w,r=Math.ceil(t/2),i=t-r;if(n){for(let t=0;te.w,a=n?{borderColor:'#FFFFFF',borderWidth:2}:null;return'bar'===e.kind?(0,b.jsx)(i.default,{pointerEvents:"none",style:[r,{backgroundColor:o?'#2A2216':'#3A2E1C',borderRadius:8,borderWidth:1.5,borderColor:o?'#5A4A30':l.colours.gold},a],children:(0,b.jsx)(u.T,{size:Math.max(9,Math.min(14,t(e.h)/2.4)),weight:"semibold",colour:l.colours.goldLight,children:"BAR"})}):'wall'===e.kind?(0,b.jsx)(i.default,{pointerEvents:"none",style:[r,{backgroundColor:o?'#3A3631':'#5C574F',borderRadius:2},a]}):'window'===e.kind?(0,b.jsx)(i.default,{pointerEvents:"none",style:[r,{backgroundColor:'rgba(226,196,137,0.16)',borderColor:'rgba(226,196,137,0.6)',borderWidth:1,borderRadius:2},a],children:!o&&t(s?e.h:e.w)>60?(0,b.jsx)(u.T,{size:9,colour:"#BFDDFF",style:s?{transform:[{rotate:'90deg'}]}:void 0,children:"WINDOW"}):null}):(0,b.jsx)(i.default,{pointerEvents:"none",style:[r,{borderColor:o?'#7A6440':l.colours.gold,borderWidth:1.5,borderStyle:'dashed',borderRadius:3,backgroundColor:'rgba(207,164,95,0.08)'},a],children:t(s?e.h:e.w)>40?(0,b.jsx)(u.T,{size:9,colour:l.colours.goldLight,style:s?{transform:[{rotate:'90deg'}]}:void 0,children:"DOOR"}):null})}},927,[912,808,30,122,127,825,826,821,813,949,944,24]); +__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"areaMarks",{enumerable:!0,get:function(){return u}}),_e.AreaTabs=function({plan:o,area:e,onPick:n,counts:a,closed:b}){return(0,c.jsx)(t.Row,{wrap:!0,gap:6,style:{alignItems:'center'},children:o.areas.map(o=>{const f=o.id===e,h=b?.has(o.id);return(0,c.jsx)(l.default,{testID:`area-${o.id}`,accessibilityRole:"tab",accessibilityLabel:`Area ${o.name}${o.dogs?', dogs allowed':''}${o.outdoor?', outdoor':''}${h?', closed for weather':''}`,accessibilityState:{selected:f},onPress:()=>n(o.id),style:{minHeight:48,paddingHorizontal:16,borderRadius:24,borderWidth:1.5,borderColor:f?s.colours.gold:h?s.colours.blue:s.colours.border,backgroundColor:f?s.colours.gold:s.colours.surface,justifyContent:'center'},children:(0,c.jsxs)(t.T,{weight:"semibold",size:15,colour:f?s.colours.onGold:s.colours.text,children:[o.name,u(o),h?(0,c.jsx)(t.T,{size:12,colour:f?s.colours.onGold:s.colours.blue,children:" closed"}):null,a?.[o.id]?(0,c.jsxs)(t.T,{size:12,colour:f?s.colours.onGold:s.colours.muted,children:[" ",a[o.id]]}):null]})},o.id)})})},r(d[0]);var o,e=r(d[1]),l=(o=e)&&o.__esModule?o:{default:o},s=r(d[2]),t=r(d[3]),c=r(d[4]);const u=o=>`${o.dogs?' \ud83d\udc3e':''}${o.outdoor?' \ud83c\udf26':''}`},928,[30,263,821,813,24]); +__d(function(_g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.saveBookingTables=j,_e.TablePicker=function({rid:e,booking:u,name:p,turnBase:f=90,onClose:v,onSaved:w,onPickOnPlan:T}){const $=(0,b.usePlan)(e),C=(0,c.useBookings)(e),[L,P]=(0,s.useState)(()=>(0,b.tablesOf)((0,h.tableKey)((0,b.tablesOf)(u.table)))),S=(0,s.useMemo)(()=>(0,h.pickGroups)($),[$]),W=C.filter(e=>e.date===u.date),z=(0,h.seatsOf)($,L),O=(0,h.seatLine)(z.total,u.partySize),D=(0,h.pickClashes)(u,L,W,f),I=e=>(0,h.pickClashes)(u,[e],W,f)[0]?.with,B=(0,h.tableKey)(L)!==(0,h.tableKey)((0,b.tablesOf)(u.table)),_=e=>P(l=>(0,h.toggleTable)(l,e)),M=async l=>{await j(e,u,l),w?.((0,h.savedWords)(p,u.partySize,l,(0,h.seatsOf)($,l).total)),v()},R=(0,k.jsxs)(n.default,{style:{gap:8},children:[(0,k.jsxs)(n.default,{testID:"table-pick-total",accessible:!0,accessibilityLabel:`${(0,h.tablesWords)(L)} picked. ${O.text}.`,children:[(0,k.jsx)(y.T,{size:18,weight:"semibold",colour:g.colours.goldLight,children:(0,h.tablesWords)(L)}),(0,k.jsx)(y.T,{size:17,colour:g.colours.text,children:O.text})]}),D.length?(0,k.jsx)(n.default,{testID:"table-pick-clash",accessible:!0,accessibilityLabel:`Warning. ${(0,h.clashWords)(D)} You can still save.`,style:{padding:10,borderRadius:10,borderWidth:1,borderColor:g.colours.gold},children:(0,k.jsxs)(y.T,{size:16,weight:"semibold",colour:g.colours.goldLight,children:[(0,h.clashWords)(D)," You can still save."]})}):null,(0,k.jsxs)(y.Row,{gap:8,wrap:!0,children:[(0,k.jsx)(y.Button,{testID:"table-pick-save",label:D.length?'Save anyway':'Save tables',disabled:!B||!L.length,accessibilityLabel:`${D.length?'Save anyway, ':'Save, '}${(0,h.tablesWords)(L)} for ${p}. ${O.text}.${D.length?` ${(0,h.clashWords)(D)}`:''}`,onPress:()=>M(L),style:[x,{flexGrow:1}]}),(0,b.tablesOf)(u.table).length?(0,k.jsx)(y.Button,{testID:"table-pick-clear",kind:"secondary",label:"Clear table",accessibilityLabel:`Clear table, take ${(0,h.tablesWords)((0,b.tablesOf)(u.table)).toLowerCase()} off ${p}`,onPress:()=>M([]),style:x}):null,(0,k.jsx)(y.Button,{testID:"table-pick-cancel",kind:"ghost",label:"Cancel",accessibilityLabel:"Cancel, keep the tables as they were",onPress:v,style:x})]})]});return(0,k.jsxs)(y.Sheet,{visible:!0,onClose:v,title:`Tables \xb7 ${u.time} ${p} \xb7 ${u.partySize} Covers`,maxWidth:760,testID:"table-picker",footer:R,children:[(0,k.jsx)(l.TableNumberWarning,{plan:$}),(0,k.jsx)(y.T,{size:16,colour:g.colours.text,children:"Tap one table, or several to join them. Tap again to take one off."}),T?(0,k.jsx)(y.Button,{kind:"secondary",testID:"table-pick-on-plan",label:"Pick on the table plan",accessibilityLabel:`Pick on the table plan instead, for ${p}`,onPress:()=>T(L),style:x}):null,S.map(e=>(0,k.jsxs)(n.default,{style:{gap:6},accessibilityLabel:e.area,children:[(0,k.jsx)(y.T,{size:15,weight:"semibold",colour:g.colours.gold,children:e.area}),(0,k.jsx)(y.Row,{gap:8,wrap:!0,children:e.tables.map(e=>{const l=L.includes(e.name),s=I(e.name);return(0,k.jsxs)(o.default,{testID:`table-pick-${e.name}`,accessibilityRole:"checkbox",accessibilityState:{checked:l},'aria-checked':l,accessibilityLabel:(0,h.pickA11y)(e.name,e.seats,l,s),onPress:()=>_(e.name),style:({pressed:e})=>({minWidth:92,minHeight:64,paddingHorizontal:10,paddingVertical:6,borderRadius:12,alignItems:'center',justifyContent:'center',borderWidth:l?2:1,borderColor:l?g.colours.gold:s?g.colours.goldMuted:g.colours.hairline,borderStyle:s&&!l?'dashed':'solid',backgroundColor:l?g.colours.gold:e?g.colours.tilePressed:g.colours.tile}),children:[(0,k.jsx)(y.T,{size:18,weight:"semibold",colour:l?g.colours.onGold:g.colours.text,children:(0,t.tableNumbers)(e.name)}),(0,k.jsxs)(y.T,{size:14,colour:l?g.colours.onGold:g.colours.muted,children:[e.seats," seats",s?' \xb7 booked':'']})]},e.name)})})]},e.area)),S.length?null:(0,k.jsx)(y.Muted,{children:"No tables on the plan yet. Add them in Setup \u203a Table plan."})]})};var l=r(d[0]),t=r(d[1]),s=r(d[2]),o=e(r(d[3])),n=e(r(d[4])),c=r(d[5]),b=r(d[6]),u=r(d[7]),h=r(d[8]),g=r(d[9]),p=r(d[10]),y=r(d[11]),f=r(d[12]),k=r(d[13]);const x={minHeight:56};async function j(e,l,t){const s=(0,h.tableKey)(t),o=(0,b.tablesOf)(l.table);await c.repo.bookings.update(l.id,(0,u.tablePatch)(s||null)),'seated'===l.status&&l.date===(0,p.venueYmd)(new Date)&&(o.filter(e=>!(0,b.tablesOf)(s).includes(e)).forEach(l=>b.useFloor.getState().setLive(e,l,{stage:void 0,dirty:!0})),s&&(0,f.resetTableLive)(e,s))}},929,[913,808,30,263,127,819,825,1296,930,821,818,813,925,24]); +__d(function(_g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"byNum",{enumerable:!0,get:function(){return s}}),e.tableKey=o,e.toggleTable=function(t,n){return t.includes(n)?t.filter(t=>t!==n):a(o([...t,n]))},e.seatsOf=function(t,n){const a={};for(const s of n)a[s]=t.tables.find(t=>t.name===s)?.maxSeats??0;return{per:a,total:Object.values(a).reduce((t,n)=>t+n,0)}},e.seatLine=function(t,n){const a=Math.max(0,n-t);return{text:`${t} ${1===t?'seat':'seats'} for ${l(n)}${a?`: ${a} short`:''}`,short:a,fits:0===a&&t>0}},e.pickClashes=function(t,l,u,c=90){if(!l.length)return[];const f={...t,table:o(l)},b=[];for(const s of u)if(s.id!==t.id&&s.date===t.date&&!['cancelled','noshow','finished'].includes(s.status)&&(0,n.startOf)(f)<(0,n.endOf)(s,c)&&(0,n.startOf)(s)<(0,n.endOf)(f,c))for(const t of a(s.table))l.includes(t)&&b.push({table:t,with:s});return b.sort((t,n)=>s(t.table,n.table))},e.clashWords=function(n){return n.map(n=>`${(0,t.tableNumbers)(n.table)} has ${n.with.walkIn?'a walk-in':(n.with.name||'a booking').replace(' (example)','')} at ${n.with.time}`).join('. ')+(n.length?'.':'')},e.tablesWords=u,e.pickA11y=function(n,a,s,l){return`Table ${(0,t.tableNumbers)(n)}, ${a} ${1===a?'seat':'seats'}${s?', selected':''}${l?`, has ${l.walkIn?'a walk-in':l.name} at ${l.time}`:''}`},e.pickGroups=function(t){return t.areas.map(n=>({area:n.name,tables:t.tables.filter(t=>t.areaId===n.id).map(t=>({name:t.name,seats:t.maxSeats})).sort((t,n)=>s(t.name,n.name))})).filter(t=>t.tables.length)},e.savedWords=function(t,n,a,s){return a.length?`${t}, ${l(n)}: ${u(a)} (${s} seats).`:`${t}: table taken off.`},e.tableActions=function(t,n){const s=a(t.table);if(['cancelled','noshow'].includes(t.status))return[];const o=[s.length?{id:'assign',label:'Change table',a11y:`Change table for ${n}, ${l(t.partySize)}, now ${u(s).toLowerCase()}. You can pick several tables to join.`}:{id:'assign',label:'Assign table',a11y:`Assign table for ${n}, ${l(t.partySize)}. You can pick several tables to join.`}];s.length&&o.push({id:'clear',label:'Clear table',a11y:`Clear table for ${n}, take ${u(s).toLowerCase()} off this booking`});return o},e.dragTables=function(t,n,s){if(!s||'__none'===s||s===n)return null;const l=a(t);if(l.includes(s))return null;return o('__none'!==n&&l.includes(n)?l.map(t=>t===n?s:t):[s])};var t=r(d[0]),n=r(d[1]);const a=t=>t?t.split('+').map(t=>t.trim()).filter(Boolean):[],s=(t,n)=>t.localeCompare(n,'en-GB',{numeric:!0}),l=t=>`${t} ${1===t?'person':'people'}`;function o(t){return[...new Set(t.map(t=>String(t).trim()).filter(Boolean))].sort(s).join('+')}function u(n){const s=a(o(n));return s.length?(0,t.tableListNumbers)(s):'No table'}},930,[808,826]); +__d(function(g,r,i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ds",{enumerable:!0,get:function(){return h}}),_e.useCss=function(){(0,n.useEffect)(()=>{if(!x||document.getElementById('cc-alert-css'))return;const e=document.createElement('style');e.id='cc-alert-css',e.textContent=k,document.head.appendChild(e)},[])},_e.KindIcon=function({kind:e,size:t=22,colour:n}){const a={stroke:n??m.KIND_META[e].colour,strokeWidth:2,fill:'none',strokeLinecap:'round',strokeLinejoin:'round'};return(0,b.jsxs)(l.default,{width:t,height:t,viewBox:"0 0 24 24",children:['booking'===e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...a}),(0,b.jsx)(o.Path,{d:"M3 10h18M8 3v4M16 3v4M9 15l2 2 4-4",...a})]}):null,'pending'===e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Circle,{cx:"12",cy:"13",r:"8",...a}),(0,b.jsx)(o.Path,{d:"M12 9v4l2.5 2M9 2h6",...a})]}):null,'takeaway'===e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Path,{d:"M5 8h14l-1.2 12H6.2z",...a}),(0,b.jsx)(o.Path,{d:"M9 8V6a3 3 0 0 1 6 0v2",...a})]}):null,'email'===e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.Rect,{x:"3",y:"5",width:"18",height:"14",rx:"2",...a}),(0,b.jsx)(o.Path,{d:"M3 7l9 6 9-6",...a})]}):null,'test'===e?(0,b.jsx)(o.Path,{d:"M12 2l2.4 6.6L21 9l-5.2 4.3L17.5 20 12 16.3 6.5 20l1.7-6.7L3 9l6.6-.4z",...a}):null]})},_e.SoundToggle=function({big:e}){const t=(0,m.useAlerts)(e=>e.prefs.muted);return(0,b.jsx)(a.default,{accessibilityRole:"switch",accessibilityState:{checked:!t},accessibilityLabel:t?'Alert sound off, tap to turn on':'Alert sound on, tap to mute',onPress:()=>m.useAlerts.getState().setPrefs({muted:!t}),style:{alignSelf:'flex-end',paddingHorizontal:12,paddingVertical:e?8:5,borderRadius:999,backgroundColor:'rgba(0,0,0,0.75)',borderWidth:1,borderColor:d.colours.border},children:(0,b.jsx)(u.T,{size:e?15:12,colour:t?d.colours.muted:d.colours.gold,children:t?'Sound off':'Sound on'})})},_e.AlertHost=function({variant:e,rid:t,me:a,onOpen:s,skipTakeaway:o}){const l=(0,m.useAlerts)(e=>e.live).filter(n=>!(n.rid!==t||'chef'===e&&'takeaway'!==n.kind||o&&'takeaway'===n.kind&&!n.test)),c=e=>'booking'===e.kind||'pending'===e.kind,d=l.filter(c),u=l.filter(e=>!c(e));A('managers'===e);const x=u.map(e=>e.id+':'+e.at).join('|'),h=(0,n.useRef)({me:a,onOpen:s});return h.current={me:a,onOpen:s},(0,n.useEffect)(()=>{const t=new Set(u.map(e=>`alert:${e.id}`));f.useSliders.getState().dismissWhere(e=>e.id.startsWith('alert:')&&!t.has(e.id)&&!e.id.startsWith('alert-keep:'));for(const t of u){const n=m.KIND_META[t.kind],a='display'===e;(0,f.notify)({id:`alert:${t.id}`,tone:T(t),big:a,testID:'alert-slider',kicker:`${n.kicker}${t.test?' \xb7 TEST':''}${t.nag?` \xb7 REMINDER ${t.nag}`:''} \xb7 ${y(t.at)}`,title:t.name,timeoutMs:S(t,e),content:({close:n})=>(0,b.jsx)(I,{a:t,variant:e,big:a,me:h.current.me,onOpen:h.current.onOpen,close:n}),onClose:()=>m.useAlerts.getState().dismiss(t.id)})}},[x,e]),(0,n.useEffect)(()=>()=>f.useSliders.getState().dismissWhere(e=>e.id.startsWith('alert:')),[]),(0,b.jsx)(p.BookingBanners,{alerts:d,big:'display'===e,managers:'managers'===e,me:a,onOpen:s,onClose:e=>m.useAlerts.getState().dismiss(e.id)})};var t=r(_d[0]),n=r(_d[1]);r(_d[2]);var a=e(r(_d[3])),s=e(r(_d[4])),o=r(_d[5]),l=e(o),c=r(_d[6]),d=r(_d[7]),u=r(_d[8]),p=r(_d[9]),f=r(_d[10]),m=r(_d[11]),b=r(_d[12]);const x='undefined'!=typeof document,h=e=>({dataSet:{ccal:e}}),k="\n[data-ccal=\"drop\"]{animation:ccal-drop .62s cubic-bezier(.16,1.1,.3,1) both}\n@keyframes ccal-drop{0%{opacity:0;transform:translate3d(0,-70px,0) scale(.94)}60%{opacity:1}100%{opacity:1;transform:none}}\n[data-ccal=\"big\"]{animation:ccal-big .8s cubic-bezier(.16,1.05,.3,1) both}\n@keyframes ccal-big{0%{opacity:0;transform:translate3d(0,-120px,0) scale(.86)}100%{opacity:1;transform:none}}\n[data-ccal=\"fade\"]{animation:ccal-fade .5s ease both}\n@keyframes ccal-fade{from{opacity:0}to{opacity:1}}\n[data-ccal=\"glow-gold\"]{animation:ccal-glow-gold 2.4s ease-in-out infinite}\n[data-ccal=\"glow-amber\"]{animation:ccal-glow-amber 1.6s ease-in-out infinite}\n[data-ccal=\"glow-ok\"]{animation:ccal-glow-ok 2.4s ease-in-out infinite}\n[data-ccal=\"glow-blue\"]{animation:ccal-glow-blue 2.4s ease-in-out infinite}\n@keyframes ccal-glow-gold{0%,100%{box-shadow:0 0 0 1.5px rgba(207,164,95,.9),0 10px 40px rgba(207,164,95,.28)}50%{box-shadow:0 0 0 1.5px #CFA45F,0 10px 70px rgba(207,164,95,.6)}}\n@keyframes ccal-glow-amber{0%,100%{box-shadow:0 0 0 1.5px rgba(255,181,71,.9),0 10px 40px rgba(255,181,71,.25)}50%{box-shadow:0 0 0 1.5px #FFB547,0 10px 70px rgba(255,181,71,.6)}}\n@keyframes ccal-glow-ok{0%,100%{box-shadow:0 0 0 1.5px rgba(207,164,95,.9),0 10px 40px rgba(207,164,95,.22)}50%{box-shadow:0 0 0 1.5px #CFA45F,0 10px 70px rgba(207,164,95,.5)}}\n@keyframes ccal-glow-blue{0%,100%{box-shadow:0 0 0 1.5px rgba(226,196,137,.9),0 10px 40px rgba(226,196,137,.22)}50%{box-shadow:0 0 0 1.5px #E2C489,0 10px 70px rgba(226,196,137,.5)}}\n[data-ccal=\"stars\"]{position:absolute;top:0;left:0;right:0;bottom:0;pointer-events:none;background-image:radial-gradient(1.2px 1.2px at 23px 41px,#fff,transparent),radial-gradient(1px 1px at 97px 13px,#fff9,transparent),radial-gradient(1.4px 1.4px at 151px 120px,#f5e6c8,transparent),radial-gradient(1px 1px at 61px 163px,#fffa,transparent),radial-gradient(1.6px 1.6px at 183px 77px,#CFA45F,transparent);background-size:211px 199px;opacity:.55;animation:ccal-drift 50s linear infinite}\n@keyframes ccal-drift{to{background-position:-211px 199px}}\n[data-ccal=\"space\"]{background:radial-gradient(ellipse at 50% 120%,#2a1f0c 0%,#0a0805 40%,#000 72%)}\n[data-ccal=\"sheen\"]{position:absolute;top:0;bottom:0;width:35%;left:-50%;pointer-events:none;background:linear-gradient(100deg,transparent,rgba(255,255,255,.09),transparent);animation:ccal-sheen 3.6s ease-in-out .5s infinite}\n@keyframes ccal-sheen{0%{left:-50%}40%,100%{left:130%}}\n[data-ccal=\"dot\"]{animation:ccal-dot 1s ease-in-out infinite alternate}\n@keyframes ccal-dot{from{opacity:.25}to{opacity:1}}\n[data-ccal=\"bar\"]{animation-name:ccal-bar;animation-timing-function:linear;animation-fill-mode:both}\n@keyframes ccal-bar{from{transform:scaleX(1)}to{transform:scaleX(0)}}\n[data-ccal=\"ring\"]{animation:ccal-ring 1.4s ease-out infinite}\n@keyframes ccal-ring{0%{transform:scale(1);opacity:.7}100%{transform:scale(1.9);opacity:0}}\n[data-ccal=\"phase-gold\"]{animation:ccal-phase 1.8s ease-in-out infinite}\n@keyframes ccal-phase{0%,100%{background-color:rgba(40,28,6,.92)}50%{background-color:rgba(255,181,71,.55)}}\n[data-ccal=\"flash-red\"]{animation:ccal-red 1s steps(2,jump-none) infinite}\n@keyframes ccal-red{0%{background-color:#5A0E08}100%{background-color:#D9302A}}\n[data-ccal=\"pulse-btn\"]{animation:ccal-pulse 1.2s ease-in-out infinite}\n@keyframes ccal-pulse{0%,100%{transform:scale(1)}50%{transform:scale(1.04)}}\n@media (prefers-reduced-motion: reduce){[data-ccal]{animation:none !important;transition:none !important}}\n";const y=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`};function w({label:e,value:t,big:n}){return(0,b.jsxs)(s.default,{style:{minWidth:n?130:66,flexGrow:1,paddingVertical:n?10:6,paddingHorizontal:n?14:10,borderRadius:10,backgroundColor:'rgba(255,255,255,0.04)',borderWidth:1,borderColor:'rgba(207,164,95,0.22)'},children:[(0,b.jsx)(u.T,{size:n?13:10,weight:"semibold",colour:f.SLIDER.quiet,style:{letterSpacing:1.4},children:e}),(0,b.jsx)(u.T,{size:n?28:16,weight:"bold",numberOfLines:1,children:t})]})}function j({label:e,onPress:t,kind:n="primary",testID:a,big:s}){return(0,b.jsx)(f.SliderButton,{a:{label:e,kind:n,testID:a,onPress:t,keepOpen:!0},onDone:()=>{},big:s})}const S=(e,t)=>'display'===t?12e3:'chef'===t?15e3:'pending'===e.kind||'takeaway'===e.kind?null:1e4,T=e=>e.allergy?'urgent':'pending'===e.kind?'warn':'normal';function I({a:e,variant:a,big:o,me:l,onOpen:p,close:m}){const[x,h]=(0,n.useState)(!1),[k,y]=(0,n.useState)(null),S=e=>{y(e),setTimeout(m,1800)},T='managers'===a,I=l??'Manager',A='takeaway'===e.kind?[['ORDER',e.orderNo??''],['ITEMS',String(e.items??'')],['TOTAL',e.total??''],['COLLECT',e.collect??'']]:'email'===e.kind?[]:[['TIME',e.when??''],['COVERS',String(e.covers??'')],...e.table?[['TABLE',(0,t.tableNumbers)(e.table)]]:[],['SOURCE',e.source??'']];return(0,b.jsxs)(s.default,{testID:`alert-${e.kind}`,style:{gap:o?12:8},children:['email'===e.kind?(0,b.jsx)(u.T,{size:o?22:14,numberOfLines:2,children:e.subject}):null,A.length?(0,b.jsx)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:o?10:6},children:A.map(([e,t])=>(0,b.jsx)(w,{label:e,value:t,big:o},e))}):null,e.allergy?(0,b.jsxs)(s.default,{testID:"alert-allergy",style:{flexDirection:'row',gap:10,alignItems:'center',borderLeftWidth:4,borderColor:d.colours.red,backgroundColor:'rgba(255,107,94,0.10)',borderRadius:8,padding:o?12:8},children:[(0,b.jsx)(u.T,{size:o?16:11,weight:"bold",colour:d.colours.red,style:{letterSpacing:1.6},children:"ALLERGY"}),(0,b.jsxs)(s.default,{style:{flex:1},children:[(0,b.jsx)(u.T,{size:o?22:14,weight:"semibold",colour:"#FFE1DC",children:e.allergy}),e.allergyStep?(0,b.jsx)(u.T,{size:o?15:11,colour:"#FFC4BB",children:e.allergyStep}):null]})]}):null,'pending'===e.kind&&'managers'!==a?(0,b.jsx)(u.T,{size:o?18:13,colour:d.colours.amber,children:"Waiting for a manager to confirm it in the Managers app."}):null,'email'===e.kind&&e.test?(0,b.jsx)(u.T,{size:12,colour:f.SLIDER.quiet,children:"Test only. No venue email is connected yet."}):null,k?(0,b.jsx)(u.T,{size:14,weight:"semibold",colour:d.colours.goldLight,children:k}):null,(0,b.jsxs)(s.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'flex-end',alignItems:'center'},children:[T&&!k?'pending'===e.kind?x?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(u.T,{size:14,colour:"#FFE1DC",style:{flexBasis:'100%'},children:["Decline this booking? We\u2019ll let ",e.name," know by text",e.test?' (test: nothing happens)':' (preview mode)',"."]}),(0,b.jsx)(j,{kind:"danger",label:"Yes, decline it",testID:"alert-decline-yes",onPress:()=>{e.refId&&!e.test&&c.repo.bookings.decide(e.refId,'declined',I),S('Declined. The guest\u2019s message is in the Outbox.')}}),(0,b.jsx)(j,{kind:"ghost",label:"Keep it",onPress:()=>h(!1)})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(j,{label:"Confirm",testID:"alert-confirm",onPress:()=>{e.refId&&!e.test&&c.repo.bookings.decide(e.refId,'confirmed',I),S(e.test?'Test alert: nothing to confirm.':'Confirmed. Their confirmation is ready in the Outbox.')}}),(0,b.jsx)(j,{kind:"danger",label:"Decline",testID:"alert-decline",onPress:()=>h(!0)})]}):'takeaway'===e.kind?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(j,{label:"Accept",testID:"alert-accept",onPress:async()=>{const t=!(e.refId&&!e.test)||await c.repo.orders.accept(e.refId,I);S(t?'Accepted.':'Accepted. The allergy sign-off is still needed before cooking.')}}),[15,20,30].map(t=>(0,b.jsx)(j,{kind:"ghost",label:`Ready in ${t}`,onPress:async()=>{const n=!(e.refId&&!e.test)||await c.repo.orders.accept(e.refId,I,t);S(`Accepted, ready in ${t} minutes.${n?'':' Allergy sign-off still needed.'}`)}},t))]}):'booking'===e.kind&&p?(0,b.jsx)(j,{kind:"ghost",label:"View bookings",onPress:()=>{m(),p(e)}}):null:null,k?null:(0,b.jsx)(j,{kind:"ghost",label:!T||'pending'!==e.kind&&'takeaway'!==e.kind?'Close':'Later',testID:"alert-close",onPress:m})]})]})}function A(e){const t=(0,m.useAlerts)(e=>e.askedSystem);(0,n.useEffect)(()=>{if(!e||t||'default'!==(0,m.systemSupport)())return;const n=setTimeout(()=>(0,f.notify)({id:'notify-prompt',testID:'notify-prompt',icon:'\ud83d\udd14',title:'Get booking alerts on this device?',body:'We\u2019ll let you know about new bookings, requests to confirm and takeaway orders, even when the app is in the background. You can change this any time in More, Alerts and sounds.',actions:[{label:'Turn on alerts',testID:'notify-allow',onPress:()=>{(0,m.requestSystemPermission)().then(()=>m.useAlerts.getState().setAsked())}},{label:'Not now',kind:'ghost',onPress:()=>m.useAlerts.getState().setAsked()}]}),2500);return()=>clearTimeout(n)},[e,t])}},931,[808,30,122,263,127,947,819,821,813,1349,918,933,24]); +__d(function(g,r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"unconfirmedTakeaways",{enumerable:!0,get:function(){return x}}),_e.useBuildingChime=function(e,s=4e3,i=6e4){const o=(0,a.useAlerts)(e=>e.prefs.muted);(0,t.useEffect)(()=>{if(!e||o)return;const t=Date.now(),l=()=>(0,c.lowChime)(Math.min(1,(Date.now()-t)/i));l();const n=setInterval(l,s);return()=>clearInterval(n)},[e,o,s,i])},_e.TakeawayFacts=b,_e.TakeawayTakeover=function({rid:e,me:i}){const o=(0,l.useOrders)(e),n=x(o),a=n[0],c=s.default.useRef(i);return c.current=i,(0,t.useEffect)(()=>{a?(0,f.notify)({id:'takeaway-takeover',tone:a.allergies.length?'urgent':'warn',modal:!0,big:!0,testID:'takeaway-takeover',icon:'\ud83e\udd61',kicker:'NEW TAKEAWAY ORDER',title:`Order ${a.ref}: read it, then tap Confirm`,body:"This stays on screen until someone confirms."+(n.length>1?` ${n.length-1} more waiting.`:''),timeoutMs:null,content:()=>(0,j.jsx)(y,{rid:e,id:a.id,me:c.current})}):(0,f.dismissNotice)('takeaway-takeover')},[a?.id,n.length,e]),(0,t.useEffect)(()=>()=>(0,f.dismissNotice)('takeaway-takeover'),[]),null};var t=r(d[0]),s=e(t),i=e(r(d[1])),o=e(r(d[2])),l=r(d[3]),n=r(d[4]),a=r(d[5]),c=r(d[6]),u=r(d[7]),h=r(d[8]),f=r(d[9]),j=r(d[10]);const w=e=>e?new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}):'As soon as possible',x=e=>e.filter(e=>'takeaway'===e.type&&'new'===e.status&&!e.accepted).sort((e,t)=>e.createdAt.localeCompare(t.createdAt));function b({o:e,big:t,personal:s=!0}){const o=t?1:.8;return(0,j.jsxs)(i.default,{style:{gap:10},children:[(0,j.jsxs)(i.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:18},children:[(0,j.jsxs)(i.default,{children:[(0,j.jsx)(h.T,{size:13*o+2,colour:u.colours.muted,children:"Collection"}),(0,j.jsx)(h.T,{size:34*o,weight:"bold",colour:u.colours.goldLight,children:w(e.slotTime)})]}),s?(0,j.jsxs)(i.default,{children:[(0,j.jsx)(h.T,{size:13*o+2,colour:u.colours.muted,children:"Customer"}),(0,j.jsx)(h.T,{size:26*o,weight:"semibold",children:e.customerName})]}):null,s?(0,j.jsxs)(i.default,{children:[(0,j.jsx)(h.T,{size:13*o+2,colour:u.colours.muted,children:"Phone"}),(0,j.jsx)(h.T,{size:26*o,weight:"semibold",children:e.phone??'Not given'})]}):null,(0,j.jsxs)(i.default,{children:[(0,j.jsx)(h.T,{size:13*o+2,colour:u.colours.muted,children:"Order"}),(0,j.jsx)(h.T,{size:26*o,weight:"semibold",children:e.ref})]})]}),e.allergies.length?(0,j.jsxs)(i.default,{testID:"takeover-allergy",style:{backgroundColor:'#7A140D',borderRadius:12,padding:12,borderWidth:2,borderColor:'#FFB3AB'},children:[(0,j.jsxs)(h.T,{size:22*o,weight:"bold",colour:"#FFFFFF",children:["\u26a0 ALLERGY: ",e.allergies.map(e=>`${(0,n.allergenLabel)(e.allergen)} (${(0,n.severityLabel)(e.severity)})`).join(', ')]}),e.lines.filter(e=>e.overridden).map((e,t)=>(0,j.jsxs)(h.T,{size:16*o,weight:"semibold",colour:"#FFE3DF",children:["Customer overrode a warning: ",e.name," contains ",e.contains.map(n.allergenLabel).join(', ')]},t))]}):(0,j.jsx)(h.T,{size:16*o,colour:u.colours.ok,children:"No allergies declared"}),(0,j.jsx)(i.default,{style:{gap:4},children:e.lines.map((e,t)=>(0,j.jsxs)(h.T,{size:22*o,weight:"semibold",children:[e.qty," \xd7 ",e.name,e.choices.length?` (${e.choices.join(', ')})`:'',e.notes?` \xb7 \u201c${e.notes}\u201d`:'']},t))})]})}function y({rid:e,id:t,me:s}){const n=(0,l.useOrders)(e).find(e=>e.id===t),{width:a}=(0,o.default)();return n?(0,j.jsxs)(i.default,{style:{gap:12},children:[(0,j.jsx)(b,{o:n,big:a>=700}),(0,j.jsx)(h.Button,{label:`Confirm order ${n.ref}`,testID:"takeover-confirm",onPress:()=>{l.repo.orders.accept(n.id,s)},style:{minHeight:72,borderRadius:14}})]}):null}},932,[30,127,287,819,814,933,922,821,813,918,24]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"chime",{enumerable:!0,get:function(){return l.chime}}),e.sendTestAlert=function(t,a){const o={rid:t,at:Date.now(),test:!0},c='pending'===a?{...o,id:`test-pending:${Date.now()}`,kind:'pending',name:'Test guest',when:'Today 19:30',covers:10,source:'Online'}:'takeaway'===a?{...o,id:`test-takeaway:${Date.now()}`,kind:'takeaway',name:'Test guest',orderNo:'T-TEST',items:3,total:'\xa324.50',collect:'18:45',source:'Online',allergy:'Milk (allergy)',allergyStep:'Test only: no sign-off needed'}:'email'===a?{...o,id:`test-email:${Date.now()}`,kind:'email',name:'CoverCharge test',subject:'This is a test alert. No real email was received.'}:{...o,id:`test-booking:${Date.now()}`,kind:'test'===a?'test':'booking',name:'Test guest',when:'Today 19:30',covers:4,table:'7',source:'Phone',allergy:'Peanuts (allergy)',allergyStep:'Test only: no sign-off needed'};n.useAlerts.getState().raise(c)};var t=r(d[0]);Object.keys(t).forEach(function(n){'default'===n||Object.prototype.hasOwnProperty.call(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[n]}})});var n=r(d[1]);Object.keys(n).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})});var a=r(d[2]);Object.keys(a).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return a[t]}})});var o=r(d[3]);Object.keys(o).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return o[t]}})});var c=r(d[4]);Object.keys(c).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return c[t]}})});var l=r(d[5]),s=r(d[6]);Object.keys(s).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return s[t]}})})},933,[1350,1351,1353,1352,1354,922,1355]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BlockList=p,_e.BlockBookingsSheet=B,_e.BlocksBanner=function({rid:e,now:o,big:s,by:l="staff"}){const t=(0,i.useBlocks)(e=>e.blocks),r=(0,i.useBlocks)(e=>e.remove),a=(0,i.activeBlock)(t,e,(0,c.ymd)(o),(0,c.hm)(o));return a?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(M,{rid:e,now:o,big:s}),(0,f.jsxs)(n.default,{testID:"blocks-banner",accessibilityRole:"summary",style:{flexDirection:'row',alignItems:'center',gap:10,backgroundColor:u.colours.amberBg,borderColor:u.colours.amber,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[(0,f.jsx)(b.T,{size:s?20:16,children:"\u23f8"}),(0,f.jsx)(b.T,{size:s?20:16,weight:"semibold",colour:u.colours.amber,style:{flex:1},children:(0,i.pausedLine)(a)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Undo",testID:"blocks-undo",onPress:()=>{r(a.id,l),(0,m.pushBlocksToWix)(e,[a.id],'remove')}})]})]}):(0,f.jsx)(M,{rid:e,now:o,big:s})},_e.BlockBookingsButton=function({rid:e,r:o,now:a,by:d,wide:m,big:x,quiet:j,tile:k,display:p}){const[y,w]=(0,s.useState)(!1),C=(0,i.useBlocks)(e=>e.blocks),v=(0,i.currentBlocks)(C,e,(0,c.ymd)(a),(0,c.hm)(a)).length;return k?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(l.ActionTile,{testID:"block-bookings",icon:"pause",label:"Block bookings",sub:v?`${v} block${1===v?'':'s'} on now`:'Pause online times',count:v||void 0,onPress:()=>w(!0),accessibilityLabel:"Block bookings"}),y?(0,f.jsx)(B,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>w(!1)}):null]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(r.default,{testID:"block-bookings",accessibilityRole:"button",accessibilityLabel:"Block bookings",onPress:()=>w(!0),style:({pressed:e})=>j?{...t.look.quiet(e),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:u.colours.gold,borderRadius:16,paddingVertical:x?14:10,paddingHorizontal:18,backgroundColor:e?u.colours.goldTint:'transparent'},children:[j?null:(0,f.jsx)(b.T,{size:x?22:17,colour:u.colours.gold,children:"\u23f8"}),(0,f.jsx)(b.T,{size:j?15:x?22:17,weight:"semibold",colour:j?u.colours.goldLight:u.colours.gold,children:"Block bookings"}),v?(0,f.jsx)(n.default,{style:{backgroundColor:u.colours.amber,borderRadius:10,minWidth:22,paddingHorizontal:6},children:(0,f.jsx)(b.T,{size:13,weight:"bold",colour:u.colours.onGold,center:!0,children:v})}):null]}),y?p?(0,f.jsx)(h.DisplayBlocksMenu,{rid:e,r:o,now:a,by:d,onClose:()=>w(!1)}):(0,f.jsx)(B,{rid:e,r:o,now:a,by:d,wide:m,onClose:()=>w(!1)}):null]})},_e.closeOutdoor=C,_e.useOutdoor=v,_e.CloseGardenButton=function({rid:e,r:o,now:s,by:n,big:a,quiet:d,short:c,tile:h}){const m=v(e,s);if(!m.outdoor.length)return null;const x=m.allClosed;return h?(0,f.jsx)(l.ActionTile,{testID:x?'reopen-garden':'close-garden',icon:x?'sun':'rain',tone:x?'blue':'gold',label:x?'Reopen garden':'Close garden',sub:x?'Closed for weather':'For weather',accessibilityLabel:x?'Reopen garden':'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):C(e,o,s,n,m.outdoor.filter(e=>!m.closed.has(e.id)))}):(0,f.jsxs)(r.default,{testID:x?'reopen-garden':'close-garden',accessibilityRole:"button",accessibilityLabel:x?'Reopen garden':'Close garden for weather',onPress:()=>x?m.active.forEach(e=>i.useBlocks.getState().remove(e.id)):C(e,o,s,n,m.outdoor.filter(e=>!m.closed.has(e.id))),style:({pressed:e})=>d?{...t.look.quiet(e,x?'blue':'gold'),flexGrow:1}:{flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,borderWidth:2,borderColor:x?u.colours.blue:u.colours.gold,borderRadius:16,paddingVertical:a?14:10,paddingHorizontal:16,minHeight:48,backgroundColor:e?u.colours.goldTint:x?u.colours.blueBg:'transparent'},children:[d?null:(0,f.jsx)(b.T,{size:a?22:17,children:x?'\u2600\ufe0f':'\ud83c\udf27'}),(0,f.jsx)(b.T,{size:d?15:a?20:16,weight:"semibold",colour:x?u.colours.blue:d?u.colours.goldLight:u.colours.gold,children:x?'Reopen garden':c?'Close garden':'Close garden for weather'})]})},_e.GardenBanner=M;var o=_r(_d[0]),s=_r(_d[1]),l=_r(_d[2]),t=_r(_d[3]),r=e(_r(_d[4])),n=e(_r(_d[5])),i=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),b=_r(_d[11]),h=_r(_d[12]),m=_r(_d[13]),f=_r(_d[14]);const x=e=>(0,c.fromMins)(15*Math.floor((60*e.getHours()+e.getMinutes())/15)),j=(e,o)=>e.date===o?'Today':(0,c.niceDate)((0,c.parseYmd)(e.date));function k({title:e,sub:o,onPress:s,testID:l,disabled:t}){return(0,f.jsxs)(r.default,{testID:l,accessibilityRole:"button",accessibilityLabel:e,disabled:t,onPress:s,style:({pressed:e})=>({borderWidth:1.5,borderColor:u.colours.gold,borderRadius:16,padding:16,backgroundColor:e?u.colours.goldTint:u.colours.surface2,opacity:t?.4:1}),children:[(0,f.jsx)(b.T,{size:20,weight:"semibold",colour:u.colours.gold,children:e}),o?(0,f.jsx)(b.Muted,{children:o}):null]})}function p({rid:e,now:l,by:t="staff"}){const r=(0,i.useBlocks)(e=>e.blocks),a=(0,i.useBlocks)(e=>e.remove),[d,h]=(0,s.useState)(null),x=(0,c.ymd)(l),k=(0,i.currentBlocks)(r,e,x,(0,c.hm)(l));return k.length?(0,f.jsxs)(n.default,{style:{gap:8},testID:"block-list",children:[k.map(e=>{const s=e.date===x&&(0,c.toMins)(e.from)<=(0,c.toMins)((0,c.hm)(l));return(0,f.jsxs)(b.Row,{style:{justifyContent:'space-between',borderWidth:1,borderColor:s?u.colours.amber:u.colours.border,borderRadius:12,padding:10},children:[(0,f.jsxs)(n.default,{style:{flex:1},children:[(0,f.jsxs)(b.T,{weight:"semibold",children:[e.areaId?`${e.areaName??'Area'} closed \xb7 `:'',e.tables?.length?`${e.tables.map(o.tableNumbers).join(', ')} \xb7 `:'',j(e,x)," \xb7 ",e.from,"\u2013",e.to,s?' \xb7 now':'']}),(0,f.jsxs)(b.Muted,{children:[e.reason??'No reason given'," \xb7 by ",e.by,e.areaId?' \xb7 the rest of the venue stays open':'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Remove",testID:`block-remove-${e.id}`,onPress:()=>h(e)})]},e.id)}),d?(0,f.jsxs)(b.Sheet,{visible:!0,onClose:()=>h(null),title:"Remove this block?",testID:"block-remove-confirm",children:[(0,f.jsx)(b.T,{children:`${j(d,x)}, ${d.from}\u2013${d.to}. Bookings open again for that time.`}),(0,f.jsx)(b.Button,{testID:"block-remove-yes",label:"Remove block",onPress:()=>{a(d.id,t),(0,m.pushBlocksToWix)(e,[d.id],'remove'),h(null)}}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Keep it",onPress:()=>h(null)})]}):null]}):(0,f.jsx)(b.Muted,{children:"No bookings paused. Online and staff bookings are open as normal."})}function y({value:e,onChange:o}){return(0,f.jsxs)(n.default,{style:{gap:6},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Reason (optional)"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:i.BLOCK_REASONS.map(s=>(0,f.jsx)(b.Chip,{label:s,selected:e===s,onPress:()=>o(e===s?void 0:s)},s))})]})}function w({label:e,value:o,onChange:s,min:l,max:t}){return(0,f.jsxs)(b.Row,{gap:8,children:[(0,f.jsx)(b.T,{style:{width:52},children:e}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"\u221230",accessibilityLabel:`${e} 30 minutes earlier`,onPress:()=>s(Math.max(l,o-30))}),(0,f.jsx)(b.T,{size:22,weight:"semibold",colour:u.colours.gold,style:{minWidth:70,textAlign:'center'},children:(0,c.fromMins)(o)}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"+30",accessibilityLabel:`${e} 30 minutes later`,onPress:()=>s(Math.min(t,o+30))})]})}function B({rid:e,r:o,now:l,by:t,onClose:r,wide:a}){const u=(0,i.useBlocks)(e=>e.add),[h,m]=(0,s.useState)('menu'),[j,B]=(0,s.useState)(),C=(0,c.ymd)(l),v=(0,d.hoursFor)(o,l),M=v?(0,c.hm)(v.close):null,P=x(l),T=!!v&&(0,c.toMins)(P)<(0,c.toMins)(M),I=(0,c.fromMins)((0,c.toMins)(P)+60),R=(0,s.useMemo)(()=>{const e=[];for(let s=1;s<=28;s++){const t=new Date(l);t.setHours(12,0,0,0),t.setDate(t.getDate()+s),(0,d.hoursFor)(o,t)&&e.push(t)}return e},[C,o.id]),[$,z]=(0,s.useState)(R[0]?(0,c.ymd)(R[0]):C),S=(0,d.hoursFor)(o,(0,c.parseYmd)($)),L=S?(0,c.toMins)((0,c.hm)(S.open)):720,F=S?(0,c.toMins)((0,c.hm)(S.close)):1260,[W,A]=(0,s.useState)(null),N=W??{from:L,to:F},H=(o,s,l)=>{u({rid:e,date:o,from:s,to:l,reason:j,by:t}),r()};return(0,f.jsx)(b.Sheet,{visible:!0,onClose:r,title:"Block bookings",maxWidth:a?720:void 0,testID:"block-sheet",children:'menu'===h?(0,f.jsxs)(n.default,{style:{gap:10},children:[(0,f.jsx)(b.Muted,{children:"Pause new bookings for a while. The customer app stops offering those times, and staff get a warning."}),(0,f.jsx)(k,{testID:"block-today",title:"Today",sub:T?`Now until close (${M}) or for 1 hour`:'Closed for the rest of today',disabled:!T,onPress:()=>m('today')}),(0,f.jsx)(k,{testID:"block-future",title:"Future dates",sub:"Pick a date and a time window",onPress:()=>m('future')}),(0,f.jsx)(D,{rid:e,r:o,now:l,by:t,onDone:r}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Active and upcoming"}),(0,f.jsx)(p,{rid:e,now:l})]}):'today'===h?(0,f.jsxs)(n.default,{style:{gap:10},children:[(0,f.jsx)(y,{value:j,onChange:B}),(0,f.jsx)(k,{testID:"block-until-close",title:"From now until close",sub:`${P} to ${M} (kitchen close, from opening hours)`,onPress:()=>H(C,P,M)}),(0,f.jsx)(k,{testID:"block-one-hour",title:"From now for 1 hour",sub:`${P} to ${I}`,onPress:()=>H(C,P,I)}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]}):(0,f.jsxs)(n.default,{style:{gap:10},children:[(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Date"}),(0,f.jsx)(b.Row,{wrap:!0,gap:6,children:R.map(e=>(0,f.jsx)(b.Chip,{label:(0,c.niceDate)(e),selected:$===(0,c.ymd)(e),onPress:()=>{z((0,c.ymd)(e)),A(null)}},(0,c.ymd)(e)))}),(0,f.jsx)(b.T,{size:14,weight:"semibold",children:"Time window"}),(0,f.jsxs)(b.Row,{wrap:!0,gap:6,children:[(0,f.jsx)(b.Chip,{label:"All day",selected:N.from===L&&N.to===F,onPress:()=>A({from:L,to:F})}),L<1020?(0,f.jsx)(b.Chip,{label:`Lunch ${(0,c.fromMins)(L)}\u201317:00`,selected:N.from===L&&1020===N.to,onPress:()=>A({from:L,to:Math.min(1020,F)})}):null,F>1020?(0,f.jsx)(b.Chip,{label:`Evening 17:00\u2013${(0,c.fromMins)(F)}`,selected:1020===N.from&&N.to===F,onPress:()=>A({from:Math.max(1020,L),to:F})}):null]}),(0,f.jsx)(w,{label:"From",value:N.from,min:L,max:N.to-30,onChange:e=>A({...N,from:e})}),(0,f.jsx)(w,{label:"To",value:N.to,min:N.from+30,max:F,onChange:e=>A({...N,to:e})}),(0,f.jsx)(y,{value:j,onChange:B}),(0,f.jsx)(b.Button,{testID:"block-save-future",label:`Block ${(0,c.niceDate)((0,c.parseYmd)($))} ${(0,c.fromMins)(N.from)}\u2013${(0,c.fromMins)(N.to)}`,disabled:!R.length,onPress:()=>H($,(0,c.fromMins)(N.from),(0,c.fromMins)(N.to))}),(0,f.jsx)(b.Button,{kind:"ghost",label:"Back",onPress:()=>m('menu')})]})})}function C(e,o,s,l,t){const r=(0,d.hoursFor)(o,s),n=x(s),a=r?(0,c.hm)(r.close):null,u=a&&(0,c.toMins)(a)>(0,c.toMins)(n)?a:'23:59';return t.map(o=>i.useBlocks.getState().add({rid:e,date:(0,c.ymd)(s),from:n,to:u,reason:'Weather',by:l,areaId:o.id,areaName:o.name}))}function v(e,o){const s=(0,a.usePlan)(e),l=(0,i.useBlocks)(e=>e.blocks),t=s.areas.filter(e=>e.outdoor),r=(0,i.closedAreasAt)(l,e,(0,c.ymd)(o),(0,c.hm)(o)),n=l.filter(s=>s.rid===e&&s.areaId&&s.date===(0,c.ymd)(o)&&(0,c.toMins)((0,c.hm)(o))>=(0,c.toMins)(s.from)&&(0,c.toMins)((0,c.hm)(o))<(0,c.toMins)(s.to));return{plan:s,outdoor:t,closed:r,active:n,allClosed:t.length>0&&t.every(e=>r.has(e.id))}}function D({rid:e,r:o,now:s,by:l,onDone:t}){const r=v(e,s);return!r.outdoor.length||r.allClosed?null:(0,f.jsx)(k,{testID:"block-garden",title:"Close garden for weather",sub:`${r.outdoor.map(e=>e.name).join(', ')} only \xb7 the rest of the venue stays bookable`,onPress:()=>{C(e,o,s,l,r.outdoor.filter(e=>!r.closed.has(e.id))),t()}})}function M({rid:e,now:o,big:s}){const l=v(e,o);if(!l.active.length)return null;const t=[...new Set(l.active.map(e=>e.areaName??'Garden'))].join(', '),r=l.active.map(e=>e.to).sort().slice(-1)[0],a=l.plan.areas.filter(e=>e.dogs&&!l.closed.has(e.id)).map(e=>e.name);return(0,f.jsxs)(n.default,{testID:"garden-banner",accessibilityRole:"summary",style:{flexDirection:'row',alignItems:'center',gap:10,backgroundColor:u.colours.blueBg,borderColor:u.colours.blue,borderWidth:1.5,borderRadius:14,paddingVertical:s?10:8,paddingHorizontal:14},children:[(0,f.jsx)(b.T,{size:s?20:16,children:"\ud83c\udf27"}),(0,f.jsxs)(n.default,{style:{flex:1},children:[(0,f.jsxs)(b.T,{size:s?20:16,weight:"semibold",colour:u.colours.blue,children:[t," closed for weather until ",r]}),(0,f.jsxs)(b.T,{size:13,colour:"#E2C489",children:["No bookings or walk-ins are offered there.",a.length?` Dogs can still sit in the ${a.join(' or ')}.`:'']})]}),(0,f.jsx)(b.Button,{small:!0,kind:"secondary",label:"Reopen",testID:"garden-reopen",onPress:()=>l.active.forEach(e=>i.useBlocks.getState().remove(e.id))})]})}},934,[808,30,1338,936,263,127,824,825,815,818,821,813,1022,1395,24]); +__d(function(g,r,i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DAY_BACK",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"DAY_AHEAD",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"DAY_IDLE_MS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"dayOffset",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"shiftDay",{enumerable:!0,get:function(){return h}}),_e.dayWord=p,Object.defineProperty(_e,"dayLong",{enumerable:!0,get:function(){return x}}),_e.bookingsForDay=D,_e.dayCovers=function(e,t,o){if(t>=o)return(0,s.coversToday)(e,t);const n=D(e,t,o),d=(c=n.filter(e=>(0,s.coverDone)(e)||'seated'===(0,s.shownStatus)(e)),c.reduce((e,t)=>e+t.partySize,0)),l=(0,s.coversToday)(e,t).total;var c;return{done:d,toCome:Math.max(0,l-d),total:l}},_e.DaySwitch=function({day:e,today:s,onDay:b,back:D=u,ahead:j=y,idPrefix:$="display-day",stacked:P=!1}){const T=f(e,s),v=t=>{const o=h(e,t);b(o===s?null:o)},w=h(e,-1),C=h(e,1),Y=0!==T,I=(e,o,s,d,u)=>(0,c.jsx)(t.default,{testID:u,accessibilityRole:"button",accessibilityLabel:o,accessibilityState:{disabled:d},disabled:d,onPress:s,style:({pressed:e})=>({minHeight:44,minWidth:P?0:92,flex:P?1:void 0,paddingHorizontal:P?6:12,borderRadius:12,alignItems:'center',justifyContent:'center',borderWidth:1,borderColor:l.colours.hairline,opacity:d?.35:1,backgroundColor:e?l.colours.tilePressed:'rgba(255,255,255,0.03)'}),children:(0,c.jsx)(n.T,{center:P,size:P?16:14,weight:"semibold",colour:l.colours.goldLight,numberOfLines:P?void 0:1,children:e})}),L=p(e,s);return P?(0,c.jsxs)(o.default,{testID:`${$}-switch`,style:{gap:10,padding:12,borderRadius:14,borderWidth:1,borderColor:Y?l.colours.gold:l.colours.hairline,backgroundColor:Y?l.colours.goldTint:l.colours.surface},children:[(0,c.jsxs)(o.default,{testID:`${$}-label`,accessible:!0,accessibilityRole:"header",accessibilityLabel:`Showing ${L}, ${x(e)}`,style:{gap:2,alignItems:'center'},children:[(0,c.jsx)(n.T,{center:!0,size:20,weight:"semibold",colour:l.colours.goldLight,children:L}),(0,c.jsx)(n.T,{center:!0,size:16,children:x(e)})]}),(0,c.jsxs)(o.default,{style:{flexDirection:'row',gap:8,justifyContent:'center'},children:[I('\u2039 Previous',`Previous day, ${x(w)}`,()=>v(-1),T<=-D,`${$}-prev`),I('Today','Back to today',()=>b(null),!1,'back-to-today'),I('Next \u203a',`Next day, ${x(C)}`,()=>v(1),T>=j,`${$}-next`)]})]}):(0,c.jsxs)(o.default,{testID:`${$}-switch`,style:{flexDirection:'row',alignItems:'center',gap:8},children:[I('\u2039 Previous',`Previous day, ${x(w)}`,()=>v(-1),T<=-D,`${$}-prev`),(0,c.jsxs)(t.default,{testID:`${$}-label`,accessibilityRole:Y?'button':'text',disabled:!Y,onPress:()=>b(null),accessibilityLabel:Y?`Showing ${L===(0,d.niceDate)((0,d.parseYmd)(e))?'':`${L}, `}${x(e)}. Back to today`:`Showing today, ${x(e)}`,style:({pressed:e})=>({flex:1,minWidth:0,minHeight:44,borderRadius:12,alignItems:'center',justifyContent:'center',paddingHorizontal:6,borderWidth:Y?1:0,borderColor:l.colours.gold,backgroundColor:e?l.colours.tilePressed:Y?l.colours.goldTint:'transparent'}),children:[(0,c.jsx)(n.T,{size:15,weight:"semibold",colour:Y?l.colours.gold:l.colours.text,numberOfLines:1,children:Y&&L!==(0,d.niceDate)((0,d.parseYmd)(e))?`${L} \xb7 ${(0,d.niceDate)((0,d.parseYmd)(e))}`:L}),Y?(0,c.jsx)(n.T,{size:11,colour:l.colours.muted,numberOfLines:1,children:"Tap for today"}):null]}),I('Next \u203a',`Next day, ${x(C)}`,()=>v(1),T>=j,`${$}-next`)]})},r(_d[0]);var t=e(r(_d[1])),o=e(r(_d[2])),n=r(_d[3]),s=r(_d[4]),d=r(_d[5]),l=r(_d[6]),c=r(_d[7]);const u=365,y=365,b=12e4,f=(e,t)=>Math.round(((0,d.parseYmd)(e).getTime()-(0,d.parseYmd)(t).getTime())/864e5),h=(e,t)=>(0,d.ymd)((0,d.addMins)((0,d.parseYmd)(e),1440*t+120));function p(e,t){const o=f(e,t);return 0===o?'Today':-1===o?'Yesterday':1===o?'Tomorrow':(0,d.niceDate)((0,d.parseYmd)(e))}const x=e=>(0,d.parseYmd)(e).toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'});function D(e,t,o){return e.filter(e=>e.date===t&&(0,s.ACTIVE)(e))}},935,[30,263,127,813,828,818,821,24]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"look",{enumerable:!0,get:function(){return D}});var E=r(d[0]),I=r(d[1]),S=r(d[2]),o=r(d[3]);r(d[4]);var _=r(d[5]);const b=E=>E,D={panel:{backgroundColor:E.IS_QUEUED_VENUE?I.QUEUED_BRAND.ink:E.IS_ABBOTSFORD?'#2A2F34':E.IS_KIRKTON?'#141414':E.IS_GREENSIDE?'#222222':E.IS_WILDINGS?'#30343B':(0,o.soutersSurface)('#121110'),borderRadius:_.radii.xl,borderWidth:1,borderColor:'rgba(255,255,255,0.07)',boxShadow:'0 1px 0 rgba(255,255,255,0.04) inset, 0 12px 28px rgba(0,0,0,0.45)'},quiet:(o,b="gold")=>({minHeight:_.control.tall,borderRadius:_.radii.button,borderWidth:1,borderColor:E.IS_QUEUED_VENUE?I.QUEUED_BRAND.smallTextAccent:E.IS_ABBOTSFORD?'rgba(229,208,141,0.65)':E.IS_KIRKTON?'rgba(180,108,84,0.55)':E.IS_GREENSIDE?S.GREENSIDE_DISPLAY.quietBorder:E.IS_WILDINGS?'rgba(255,227,165,0.55)':E.IS_KIRKMICHAEL?'rgba(184,119,84,0.55)':E.IS_ISOLATED_VENUE?'rgba(164,98,46,0.55)':'blue'===b?'rgba(226,196,137,0.55)':'rgba(207,164,95,0.38)',backgroundColor:E.IS_ISOLATED_VENUE?o?E.IS_ABBOTSFORD?'rgba(184,147,98,0.16)':E.IS_KIRKTON?'rgba(180,108,84,0.16)':E.IS_GREENSIDE?S.GREENSIDE_DISPLAY.quietPressed:E.IS_WILDINGS?'rgba(255,227,165,0.16)':E.IS_KIRKMICHAEL?'rgba(184,119,84,0.16)':'rgba(164,98,46,0.16)':'rgba(255,255,255,0.035)':o?'rgba(207,164,95,0.16)':'blue'===b?'rgba(226,196,137,0.10)':'rgba(255,255,255,0.035)',paddingHorizontal:14,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:8,boxShadow:'0 1px 0 rgba(255,255,255,0.05) inset',transition:'background-color 120ms ease'}),primary:o=>E.IS_ISOLATED_VENUE?{backgroundColor:E.IS_QUEUED_VENUE?I.QUEUED_BRAND.accent:E.IS_ABBOTSFORD?'#B89362':E.IS_KIRKTON?'#B46C54':E.IS_GREENSIDE?o?S.GREENSIDE_DISPLAY.primaryPressed:S.GREENSIDE_PALETTE.gold:E.IS_WILDINGS?o?'#E6CC94':'#FFE3A5':E.IS_KIRKMICHAEL?o?'#A66949':'#B87754':o?'#8C5226':'#A4622E',borderWidth:1,borderColor:E.IS_QUEUED_VENUE?I.QUEUED_BRAND.smallTextAccent:E.IS_ABBOTSFORD?'#E5D08D':E.IS_KIRKTON?'#D6A28E':E.IS_GREENSIDE?S.GREENSIDE_PALETTE.goldLight:E.IS_WILDINGS?'#FFF0CF':E.IS_KIRKMICHAEL?'#C2937A':'#C18F67',backgroundImage:'none',boxShadow:'0 4px 12px rgba(0,0,0,0.35)'}:{backgroundColor:o?'#B8904F':'#CFA45F',borderWidth:1,borderColor:'rgba(255,226,170,0.55)',backgroundImage:o?'linear-gradient(180deg, #BE9552 0%, #A88143 100%)':'linear-gradient(180deg, #E0BA77 0%, #C69A55 100%)',boxShadow:o?'0 2px 8px rgba(0,0,0,0.4)':'0 1px 0 rgba(255,255,255,0.28) inset, 0 10px 24px rgba(207,164,95,0.22), 0 4px 10px rgba(0,0,0,0.45)',transition:'box-shadow 120ms ease'},onPrimary:E.IS_QUEUED_VENUE?I.QUEUED_BRAND.onAccent:E.IS_ABBOTSFORD||E.IS_KIRKTON?'#0B0B0B':E.IS_GREENSIDE?'#1A1A1A':E.IS_WILDINGS?'#272A2F':E.IS_KIRKMICHAEL?'#0B0B0B':E.IS_ISOLATED_VENUE?'#FFFFFF':'#17130D',web:b}},936,[5,1232,1203,912,122,1235]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useReservedToday=k,_e.ShellfishTile=function({rid:e,by:t,app:l,big:c,onOrder:h,style:b}){const y=(0,d.useShellfish)(e,t,l),p=k(e),[w,C]=(0,s.useState)(!1),S=x(e,y.items.find(e=>e.supplierId)?.supplierId),L=(0,o.useLiveState)();if('ready'!==L)return(0,f.jsx)(o.LiveWait,{state:L,title:"Lobsters & crabs",testID:"shellfish-wait"});if(!y.items.length)return null;const $=y.items.filter(e=>y.isLow(e.key)),T=y.items.length<=3?y.items.map(e=>e.plural.toUpperCase()).join(' & '):'LIVE STOCK';return(0,f.jsxs)(r.default,{testID:"shellfish-tile",style:[{borderRadius:16,borderWidth:1.5,borderColor:$.length?u.colours.amber:u.colours.border,backgroundColor:u.colours.surface,padding:c?10:12,gap:6},b],children:[(0,f.jsxs)(i.default,{accessibilityRole:"button",accessibilityLabel:`${y.items.map(t=>`${t.plural} ${(0,a.fmtStockCount)(e,t,y.counts[t.key]??0)}`).join(', ')}. Tap to update`,onPress:()=>C(!0),style:{gap:4,flex:c?1:void 0},children:[(0,f.jsxs)(n.Row,{wrap:!0,gap:6,style:{justifyContent:'space-between'},children:[(0,f.jsxs)(n.T,{size:12,weight:"semibold",colour:u.colours.gold,children:["LIVE \xb7 ",T]}),(0,f.jsx)(n.T,{size:12,colour:u.colours.muted,children:"Tap to update \u203a"})]}),(0,f.jsx)(n.Row,{gap:c?14:18,style:{flex:c?1:void 0,alignItems:'center'},children:y.items.map(t=>{const s=y.counts[t.key]??0,o=y.isLow(t.key);return(0,f.jsxs)(r.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,a.speakStockCount)(e,t,s)}`,style:{flex:1,alignItems:'center'},children:[(0,f.jsx)(n.T,{size:c?42:34,weight:"bold",colour:s<=0?u.colours.red:o?u.colours.amber:u.colours.text,style:{lineHeight:c?50:42},children:(0,a.fmtStockCount)(e,t,s)}),(0,f.jsxs)(n.T,{size:13,colour:o?u.colours.amber:u.colours.muted,children:[t.icon," ",t.plural,s<=0?' \xb7 out':o?' \xb7 low':'']}),p[t.key]?(0,f.jsxs)(n.T,{size:12,weight:"semibold",colour:u.colours.goldLight,children:["Reserved: ",(0,a.fmtStockCount)(e,t,p[t.key])," \xb7 free ",(0,a.fmtStockCount)(e,t,Math.max(0,s-p[t.key]))]}):null]},t.key)})})]}),!c&&$.length?(0,f.jsxs)(r.default,{testID:"shellfish-low",style:{backgroundColor:u.colours.amberBg,borderRadius:10,padding:8,gap:6},children:[(0,f.jsxs)(n.T,{size:13,weight:"semibold",colour:"#FFE2A8",children:["Low stock: ",$.map(t=>`${(0,a.fmtStockCount)(e,t,y.counts[t.key]??0)} ${t.plural.toLowerCase()} (warns at ${(0,a.fmtStockCount)(e,t,t.lowAt)})`).join(', ')]}),h?(0,f.jsx)(n.Button,{small:!0,label:S?`Order from ${S} \u203a`:'Order sheets \u203a',testID:"shellfish-order",onPress:h}):null]}):null,c||$.length||!h?null:(0,f.jsx)(i.default,{accessibilityRole:"button",onPress:h,style:{minHeight:44,justifyContent:'center'},children:(0,f.jsx)(n.T,{size:13,colour:u.colours.gold,children:S?`${S} order sheet \u203a`:'Order sheets \u203a'})}),w?(0,f.jsx)(j,{rid:e,by:t,app:l,onClose:()=>C(!1),onOrder:h?()=>{C(!1),h()}:void 0}):null]})},_e.ShellfishStrip=function({rid:e,by:t,app:o,height:c=76}){const h=(0,d.useShellfish)(e,t,o),b=k(e),[y,p]=(0,s.useState)(!1);if(!h.items.length)return null;const x=c>=80,w=Math.max(28,Math.min(52,Math.round(.6*c))),C=Math.max(22,Math.min(34,Math.round(.42*c)));return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(i.default,{testID:"shellfish-tile",accessibilityRole:"button",accessibilityLabel:`${h.items.map(t=>`${t.plural} ${(0,a.fmtStockCount)(e,t,h.counts[t.key]??0)}`).join(', ')}. Tap to update`,onPress:()=>p(!0),style:({pressed:e})=>({flexDirection:'row',alignItems:'stretch',height:c,backgroundColor:e?'#181612':'#100F0D',borderBottomWidth:1,borderBottomColor:'rgba(207,164,95,0.12)',borderTopWidth:1,borderTopColor:'rgba(255,255,255,0.04)',...l.look.web({backgroundImage:'linear-gradient(180deg, rgba(207,164,95,0.07) 0%, rgba(207,164,95,0.015) 100%)',cursor:'pointer'})}),children:h.items.map((t,s)=>{const o=h.counts[t.key]??0,i=b[t.key]??0,d=Math.max(0,o-i),y=d<=0,p=y||h.isLow(t.key);return(0,f.jsxs)(r.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,a.speakStockCount)(e,t,d)}`,style:{flex:1,flexDirection:'row',alignItems:'center',justifyContent:'center',gap:x?16:12,borderLeftWidth:s?1:0,borderLeftColor:'rgba(207,164,95,0.16)',backgroundColor:p?'rgba(255,107,94,0.07)':'transparent',...l.look.web(p?{backgroundImage:'linear-gradient(180deg, rgba(255,107,94,0.11) 0%, rgba(255,107,94,0.035) 100%)'}:{})},children:[(0,f.jsx)(n.T,{size:C,children:t.icon}),(0,f.jsx)(n.T,{size:w,weight:"bold",colour:p?'#FF8E82':u.colours.text,style:{lineHeight:Math.round(1.15*w),letterSpacing:-.5,minWidth:Math.round(.85*w),textAlign:'center'},children:(0,a.fmtStockCount)(e,t,d)}),(0,f.jsxs)(r.default,{style:{gap:0},children:[(0,f.jsx)(n.T,{size:x?15:13,weight:"semibold",colour:p?'#FFB3AA':u.colours.goldLight,style:{letterSpacing:2},children:t.plural.toUpperCase()}),p&&c>=60?(0,f.jsx)(n.T,{size:11,weight:"semibold",colour:"#FF8E82",style:{letterSpacing:1.5},children:y?'NONE LEFT':`LOW \xb7 WARNS AT ${(0,a.fmtStockCount)(e,t,t.lowAt)}`}):null,(0,f.jsxs)(n.T,{size:x?14:12,weight:"semibold",colour:i?u.colours.goldLight:'#857D6E',style:{letterSpacing:.5},children:["Reserved: ",(0,a.fmtStockCount)(e,t,i)]})]})]},t.key)})}),y?(0,f.jsx)(j,{rid:e,by:t,app:o,onClose:()=>p(!1)}):null]})},_e.ShellfishPanel=j,_e.ShellfishChip=function({rid:e,by:t,app:o,size:c="m"}){const h=(0,d.useShellfish)(e,t,o),b=k(e),[y,p]=(0,s.useState)(!1);if(!h.items.length)return null;const x='s'===c?17:20;return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(i.default,{testID:"shellfish-tile",accessibilityRole:"button",accessibilityLabel:`${h.items.map(t=>`${t.plural} ${(0,a.fmtStockCount)(e,t,Math.max(0,(h.counts[t.key]??0)-(b[t.key]??0)))} available`).join(', ')}. Tap to update`,onPress:()=>p(!0),style:({pressed:e})=>({flexDirection:'row',alignItems:'center',minHeight:44,borderRadius:14,borderWidth:1,borderColor:'rgba(207,164,95,0.30)',overflow:'hidden',backgroundColor:e?'#1C1913':'rgba(207,164,95,0.06)',...l.look.web({cursor:'pointer'})}),children:h.items.map((t,s)=>{const o=h.counts[t.key]??0,l=b[t.key]??0,i=Math.max(0,o-l),d=i<=0,c=d||h.isLow(t.key);return(0,f.jsxs)(r.default,{testID:`count-${t.key}`,accessible:!0,accessibilityLabel:`${t.plural} ${(0,a.speakStockCount)(e,t,i)}`,style:{flexDirection:'row',alignItems:'center',gap:6,paddingHorizontal:9,paddingVertical:3,borderLeftWidth:s?1:0,borderLeftColor:'rgba(207,164,95,0.18)',backgroundColor:c?'rgba(255,107,94,0.10)':'transparent'},children:[(0,f.jsx)(n.T,{size:x-2,children:t.icon}),(0,f.jsx)(n.T,{size:x,weight:"bold",colour:d?u.colours.red:c?u.colours.amber:u.colours.text,style:{lineHeight:x+4},children:(0,a.fmtStockCount)(e,t,i)}),l||d||c?(0,f.jsx)(n.T,{size:10,weight:"semibold",colour:d||c?'#FFB3AA':u.colours.goldLight,children:d?'none left':l?`${(0,a.fmtStockCount)(e,t,l)} res`:'low'}):null]},t.key)})}),y?(0,f.jsx)(j,{rid:e,by:t,app:o,onClose:()=>p(!1)}):null]})};var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),l=_r(_d[3]),i=e(_r(_d[4])),r=e(_r(_d[5])),n=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),y=_r(_d[13]),f=_r(_d[14]);const p=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'});function k(e){const t=(0,h.useBookings)(e),s=(0,h.useRestaurant)(e),o=(0,y.ymd)((0,h.useNow)(6e4));return(0,b.reservedOn)(t,o,(0,b.reservablesOf)(s))}function x(e,t){const s=(0,c.useSheets)(e);return t?s.find(e=>e.id===t)?.name:void 0}function j({rid:e,by:o,app:l,onClose:i,onOrder:c}){const h=(0,d.useShellfish)(e,o,l),[b,y]=(0,s.useState)({}),[k,j]=(0,s.useState)(null),w=x(e,h.items.find(e=>e.supplierId)?.supplierId),C=(s,o)=>{const l=h.itemOf(s);l&&y(i=>({...i,[s]:(0,t.fishInStone)(e,l)?(0,t.stepQuantity)(e,l,i[s]||0,o):Math.max(0,Math.min(99,(i[s]||0)+o))}))},S=(e,t=!1)=>{const s=h.itemOf(e);h.sell(e,t)&&j(('kg'===s?.unit?`Half a stone ${s.name.toLowerCase()}`:t?`Half ${s?.name.toLowerCase()}`:`1 ${s?.name.toLowerCase()}`)+" sold.")},L=Object.values(b).reduce((e,t)=>e+t,0);return(0,f.jsxs)(n.Sheet,{visible:!0,onClose:i,title:h.items.map(e=>e.plural).join(' & ')||'Tracked stock',maxWidth:620,testID:"shellfish-panel",children:[(0,f.jsx)(n.Row,{gap:10,wrap:!0,style:{alignItems:'stretch'},children:h.items.map(s=>{const o=h.counts[s.key]??0;return(0,f.jsxs)(r.default,{style:{flex:1,minWidth:160,gap:8,padding:10,borderRadius:14,borderWidth:1,borderColor:h.isLow(s.key)?u.colours.amber:u.colours.border,backgroundColor:u.colours.surface2},children:[(0,f.jsxs)(n.T,{center:!0,size:13,colour:u.colours.muted,children:[s.icon," ",s.plural]}),(0,f.jsx)(n.T,{center:!0,size:48,weight:"bold",colour:h.isLow(s.key)?u.colours.amber:u.colours.text,style:{lineHeight:56},children:(0,a.fmtStockCount)(e,s,o)}),(0,f.jsx)(n.Button,{label:(0,t.fishInStone)(e,s)?`Sold half a stone ${s.name.toLowerCase()}`:`Sold 1 ${s.name.toLowerCase()} \u22121`,testID:`sell-${s.key}`,disabled:o<((0,t.fishInStone)(e,s)?t.HALF_STONE_KG:1),onPress:()=>S(s.key),style:{minHeight:56}}),'half'===s.unit?(0,f.jsx)(n.Button,{kind:"secondary",label:"Sold a half \u2212\xbd",testID:`sell-${s.key}-half`,disabled:o<.5,onPress:()=>S(s.key,!0),style:{minHeight:52}}):(0,f.jsx)(r.default,{style:{minHeight:52}})]},s.key)})}),(0,f.jsx)(n.Button,{kind:"ghost",label:h.undoable?`\u21b6 Undo: ${(0,a.describe)(h.undoable,h.itemOf(h.undoable.kind))}`:'\u21b6 Nothing to undo',testID:"shellfish-undo",disabled:!h.undoable,onPress:()=>{const e=h.undoable;h.undoLast(),e&&j(`Undone: ${(0,a.describe)(e,h.itemOf(e.kind))}.`)}}),k?(0,f.jsx)(n.Banner,{kind:"success",title:k}):null,(0,f.jsxs)(r.default,{testID:"delivery-in",style:{gap:8,padding:10,borderRadius:14,borderWidth:1,borderColor:u.colours.gold,backgroundColor:u.colours.goldTint},children:[(0,f.jsx)(n.T,{weight:"semibold",colour:u.colours.goldLight,children:"Delivery in"}),h.items.map(s=>(0,f.jsxs)(n.Row,{gap:10,children:[(0,f.jsxs)(n.T,{style:{flex:1},children:[s.icon," ",s.plural]}),(0,f.jsx)(n.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:`${(0,t.fishInStone)(e,s)?'Half a stone less':'Fewer'} ${s.plural.toLowerCase()} in`,onPress:()=>C(s.key,-1),style:{minWidth:48,minHeight:48}}),(0,f.jsx)(n.T,{size:24,weight:"bold",style:{minWidth:76,textAlign:'center'},children:(0,a.fmtStockCount)(e,s,b[s.key]||0)}),(0,f.jsx)(n.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:`${(0,t.fishInStone)(e,s)?'Half a stone more':'More'} ${s.plural.toLowerCase()} in`,testID:`in-plus-${s.key}`,onPress:()=>C(s.key,1),style:{minWidth:48,minHeight:48}}),(0,t.fishInStone)(e,s)?null:(0,f.jsx)(n.Button,{small:!0,kind:"ghost",label:"Add five",onPress:()=>C(s.key,5)})]},s.key)),(0,f.jsx)(n.Button,{kind:"success",label:L?`Add to stock: ${h.items.filter(e=>b[e.key]).map(t=>`${(0,a.fmtStockCount)(e,t,b[t.key])} ${(1===b[t.key]?t.name:t.plural).toLowerCase()}`).join(' and ')}`:'Add to stock',testID:"delivery-add",disabled:!L,onPress:()=>{h.items.forEach(e=>h.deliver(e.key,b[e.key]??0)),j('Delivery added to the count.'),y({})},style:{minHeight:54}})]}),c?(0,f.jsx)(n.Button,{kind:"secondary",label:w?`${w} order sheet \u203a`:'Order sheets \u203a',onPress:c}):null,(0,f.jsxs)(r.default,{style:{gap:2},children:[(0,f.jsx)(n.T,{size:12,weight:"semibold",colour:u.colours.gold,children:"RECENT"}),h.events.slice(0,6).map(e=>(0,f.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(n.T,{size:13,style:{flex:1},children:(0,a.describe)(e,h.itemOf(e.kind))}),(0,f.jsxs)(n.Muted,{children:[p(e.at)," \xb7 ",e.by.replace(' (example)','')]})]},e.id))]}),(0,f.jsx)(n.Row,{wrap:!0,gap:6,children:h.synced?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(n.Badge,{kind:"ok",label:"Shared live"}),(0,f.jsx)(n.Muted,{children:"Every paired device sees the same count."})]}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(n.Badge,{kind:"neutral",label:"Saved on this device"}),(0,f.jsx)(n.Muted,{children:"Not connected to the shared venue yet."})]})})]})}},937,[1024,30,1231,936,263,127,813,1027,1025,1026,821,819,828,818,24]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AllergyChain=j,_e.BookingAllergyChain=function({b:l,me:s,readOnly:k}){const p=(0,i.useOrders)(l.restaurantId),A=(0,n.useStore)(e=>e.ackBookingAllergy);if(!l.allergies.length)return null;const S=p.find(e=>e.allergies.length&&!['cancelled','closed'].includes(e.status)&&(e.bookingId===l.id||!e.bookingId&&(0,c.linkedBooking)(e,[l])?.id===l.id));if(S)return(0,h.jsx)(j,{o:S,me:s,readOnly:k,compact:!0});const w={booked:l.allergyAck,ordered:void 0,kitchen:void 0,pass:void 0,table:void 0};return(0,h.jsxs)(t.default,{testID:`allergy-chain-${l.ref}`,style:{gap:6,padding:8,borderRadius:10,borderWidth:1,borderColor:l.allergyAck?u.colours.border:u.colours.red,backgroundColor:(0,e.soutersSurface)('#140f0e')},children:[(0,h.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsxs)(o.T,{size:13,weight:"semibold",colour:"#FFD9D4",children:["Allergen sign-off \xb7 ",l.ref]}),(0,h.jsx)(o.Badge,{kind:l.allergyAck?'amber':'red',label:(l.allergyAck?1:0)+" of 5"})]}),(0,h.jsx)(y,{chain:w,next:l.allergyAck?null:'booked',testID:`allergy-steps-${l.ref}`}),l.allergyAck?(0,h.jsxs)(o.Row,{gap:6,children:[(0,h.jsx)(f.StaffAvatar,{name:l.allergyAck.by,size:20,ring:!1}),(0,h.jsxs)(o.Muted,{style:{flex:1},children:["1. Booked: ",x(l.allergyAck.by)," at ",b(l.allergyAck.at),". Steps 2 to 5 are signed on the table's order."]})]}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(o.T,{size:13,children:"Next: 1. Booked. Allergy recorded (who took it)."}),k?null:(0,h.jsxs)(o.Row,{wrap:!0,gap:8,children:[(0,h.jsx)(o.Button,{small:!0,kind:"danger",label:"Sign off",testID:`sign-off-${l.ref}`,accessibilityLabel:`Sign off Booked on ${l.ref}`,disabled:!s.trim(),onPress:()=>A(l.id,s)}),(0,h.jsxs)(o.Muted,{children:["as ",x(s)]})]})]})]})};var e=r(d[0]);r(d[1]);var l,s=r(d[2]),t=(l=s)&&l.__esModule?l:{default:l},o=r(d[3]),i=r(d[4]),n=r(d[5]),c=r(d[6]),u=r(d[7]),f=r(d[8]),h=r(d[9]);const b=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}),x=e=>e.replace(' (example)','');function y({chain:e,next:l,testID:s}){return(0,h.jsx)(t.default,{testID:s,accessibilityLabel:`Allergen sign-off ${c.CHAIN_STEPS.filter(l=>e[l.id]).length} of 5`,style:{flexDirection:'row',alignItems:'flex-start'},children:c.CHAIN_STEPS.map((s,i)=>{const n=!!e[s.id],c=l===s.id,f=n?u.colours.ok:c?u.colours.gold:u.colours.border;return(0,h.jsxs)(t.default,{style:{flex:1,alignItems:'center'},children:[(0,h.jsxs)(t.default,{style:{flexDirection:'row',alignItems:'center',width:'100%'},children:[(0,h.jsx)(t.default,{style:{flex:1,height:2,backgroundColor:i?n||c?f:u.colours.border:'transparent'}}),(0,h.jsx)(t.default,{style:{width:26,height:26,borderRadius:13,borderWidth:2,borderColor:f,backgroundColor:n?u.colours.ok:'transparent',alignItems:'center',justifyContent:'center'},children:(0,h.jsx)(o.T,{size:12,weight:"bold",colour:n?'#0B0B0B':c?u.colours.gold:u.colours.muted,children:n?'\u2713':String(s.n)})}),(0,h.jsx)(t.default,{style:{flex:1,height:2,backgroundColor:i<4?n?u.colours.ok:u.colours.border:'transparent'}})]}),(0,h.jsx)(o.T,{size:11,weight:c?'semibold':'regular',colour:n?u.colours.text:c?u.colours.gold:u.colours.muted,center:!0,children:s.label}),e[s.id]?(0,h.jsxs)(o.T,{size:10,colour:u.colours.muted,center:!0,numberOfLines:2,children:[x(e[s.id].by).split(' ')[0]," ",b(e[s.id].at)]}):null]},s.id)})})}function j({o:l,me:s,readOnly:j,compact:k}){const p=(0,i.useBookings)(l.restaurantId),A=(0,n.useStore)(e=>e.signAllergyStep);if(!l.allergies.length)return null;const S=(0,c.linkedBooking)(l,p),w=(0,c.orderChain)(l,S),I=(0,c.nextStep)(l,S),C=c.CHAIN_STEPS.filter(e=>w[e.id]).length,B=I?(0,c.stepInfo)(I):null,D='table'===I&&!['ready','served','collected'].includes(l.status);return(0,h.jsxs)(t.default,{testID:`allergy-chain-${l.ref}`,style:{gap:6,padding:8,borderRadius:10,borderWidth:1,borderColor:I?u.colours.red:u.colours.ok,backgroundColor:(0,e.soutersSurface)('#140f0e')},children:[(0,h.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsxs)(o.T,{size:13,weight:"semibold",colour:I?'#FFD9D4':'#E2C489',children:["Allergen sign-off \xb7 ",l.ref]}),(0,h.jsx)(o.Badge,{kind:I?'red':'ok',label:I?`${C} of 5`:'Complete'})]}),(0,h.jsx)(y,{chain:w,next:I,testID:`allergy-steps-${l.ref}`}),k?null:c.CHAIN_STEPS.filter(e=>w[e.id]).map(e=>(0,h.jsxs)(o.Row,{gap:6,children:[(0,h.jsx)(f.StaffAvatar,{name:w[e.id].by,size:20,ring:!1}),(0,h.jsxs)(o.Muted,{style:{flex:1},children:[e.n,". ",e.label,": ",x(w[e.id].by)," at ",b(w[e.id].at)]})]},e.id)),B?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(o.T,{size:13,children:["Next: ",B.n,". ",B.label,". ",B.what,"."]}),j?null:(0,h.jsxs)(o.Row,{wrap:!0,gap:8,children:[(0,h.jsx)(o.Button,{small:!0,kind:"danger",label:"Sign off",testID:`sign-off-${l.ref}`,accessibilityLabel:`Sign off ${B.label} on ${l.ref}`,disabled:!s.trim()||D,onPress:()=>A(l.id,I,s)}),(0,h.jsxs)(o.Muted,{children:["as ",x(s)]})]}),D?(0,h.jsx)(o.Muted,{children:"Signed off at the pass. The table step is signed when the dish is served."}):(0,h.jsx)(o.Muted,{children:"The ticket can't move on until this step is signed off."})]}):(0,h.jsx)(o.Muted,{children:"All five steps signed off. The full chain is in the allergen audit log."})]})}},938,[912,30,127,813,1020,870,939,821,952,24]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"CHAIN_STEPS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"stepInfo",{enumerable:!0,get:function(){return t}}),e.linkedBooking=l,e.orderChain=o,e.nextStep=s,Object.defineProperty(e,"doneCount",{enumerable:!0,get:function(){return c}}),e.canSign=function(n,t,l){return s(n,l)===t},e.statusBlock=function(n,l,s){if(!n.allergies.length||'cancelled'===l)return null;const c=o(n,s),u=n=>c[n]?null:`${t(n).n}. ${t(n).label} needs signing off first`;return'acknowledged'===l||'preparing'===l||'ready'===l?u('booked')??u('ordered')??u('kitchen'):'served'===l?u('booked')??u('ordered')??u('kitchen')??u('pass'):'collected'===l||'closed'===l?u('booked')??u('ordered')??u('kitchen')??u('pass')??u('table'):null},e.chainNeedsAction=function(n,t){const o=s(n,l(n,t));return!(!o||'table'===o&&!['ready','served'].includes(n.status))},e.bookingNeedsAction=function(n,t){return n.allergies.length>0&&!n.allergyAck&&!t.some(t=>t.allergies.length&&l(t,[n])?.id===n.id)};const n=[{id:'booked',n:1,label:'Booked',what:'Allergy recorded (who took it)'},{id:'ordered',n:2,label:'Ordered',what:'Server confirms with the guest'},{id:'kitchen',n:3,label:'Kitchen',what:'Chef signs off before cooking'},{id:'pass',n:4,label:'Pass',what:'Checked before it leaves the pass'},{id:'table',n:5,label:'Table',what:'Server signs off when served'}],t=t=>n.find(n=>n.id===t);function l(n,t){return n.bookingId?t.find(t=>t.id===n.bookingId):'table'===n.type&&n.tableNo?t.find(t=>t.restaurantId===n.restaurantId&&'seated'===t.status&&!!t.table&&t.table.split('+').includes(String(n.tableNo))):void 0}function o(n,t){return{booked:n.allergyChain?.booked??(t?.allergies.length?t.allergyAck:void 0),ordered:n.allergyChain?.ordered,kitchen:n.allergyAck,pass:n.allergyChain?.pass,table:n.handoverCheck}}function s(t,l){if(!t.allergies.length)return null;const s=o(t,l);return n.find(n=>!s[n.id])?.id??null}const c=(t,l)=>{const s=o(t,l);return n.filter(n=>s[n.id]).length}},939,[]); +__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.queuedSessions=o,e.queuedRequestSlots=u,e.queuedRequestError=function(t,o,s,a=new Date){if(o.name.trim().length<2||o.name.trim().length>100||!/^[0-9 +()\-]{7,30}$/.test(o.phone)||!/^[0-9]{7,15}$/.test(o.phone.replace(/\D/g,''))||o.email.length>254||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(o.email))return'Enter your name, phone number and email.';if(o.notes.length>2e3)return'Keep notes under 2000 characters.';const c=(0,n.localDate)(a),d=(0,n.localDate)(new Date(+a+63072e6));if(!o.date||o.dated||!u(t,o.date,s).includes(o.time||''))return'Choose a future date and a time within confirmed kitchen service hours.';const l=new Intl.DateTimeFormat('en-GB',{timeZone:'Europe/London',hour:'2-digit',minute:'2-digit',hour12:!1}).format(a);return o.date===c&&(o.time||'')<=l?'Choose a future time.':!Number.isInteger(o.covers)||o.covers<1||o.covers>200?'Enter 1 to 200 Covers.':''};var t=r(_d[0]),n=r(_d[1]);function o(n){const o=t.queuedVenues[n];return o?.kitchenSessionsByDay??o?.hours.sessionsByDay??void 0}const s=t=>60*+t.slice(0,2)+ +t.slice(3);function u(n,u,a){if(!/^\d{4}-\d{2}-\d{2}$/.test(u))return[];const c=new Date(u+'T12:00:00Z');if(!Number.isFinite(+c)||c.toISOString().slice(0,10)!==u)return[];const d=(a??o(n))?.[c.getUTCDay()];if(!Array.isArray(d))return[];const l=[],f=t.queuedVenues[n]?.booking.lastSittingMinutesBeforeClose??0;for(const t of d){if(!Array.isArray(t)||2!==t.length||!t.every(t=>'string'==typeof t&&/^([01]\d|2[0-3]):[0-5]\d$/.test(t)))continue;const n=s(t[0]),o=s(t[1]);if(!(n>=o))for(let t=n;te.id===t)?.uses??[],r=O(e),i=c.useStore.getState().menu.find(e=>e.id===t)?.name??'';return(0,u.dishReason)(i,(0,u.shortOf)(s,r),r,b(e))},_e.runAutoSoldOut=y,_e.startAutoSoldOut=function(){if(w)return w;let e=null;const t=()=>{e||(e=setTimeout(()=>{e=null,y()},400))},n=[d.useShellStore.subscribe((e,n)=>{e.events===n.events&&e.server===n.server&&e.items===n.items||t()}),h.subscribe(t),S.useCardStore.subscribe((e,n)=>{e.cards!==n.cards&&t()}),c.useStore.subscribe((e,n)=>{e.menu===n.menu&&e.restaurants===n.restaurants||t()}),f.useSoldOut.subscribe((e,n)=>{e.entries!==n.entries&&t()})],s=setInterval(t,6e4);return t(),w=()=>{n.forEach(e=>e()),clearInterval(s),e&&clearTimeout(e),w=null},w},_e.useAutoSoldOutView=function(e){const t=(0,c.useStore)(e=>e.menu),n=h(e=>e.links),s=(0,S.useCardStore)(e=>e.cards),r=(0,d.useShellStore)(t=>t.items[e]);(0,d.useShellStore)(e=>e.events),(0,d.useShellStore)(t=>t.server[e]);const i=(r??[]).filter(e=>e.active).map(e=>({key:e.key,name:e.name,plural:e.plural,unit:e.unit,active:e.active})),o=p(e,t,n,s,i),l=O(e);return{dishes:o,counts:l,items:i,reason:e=>{const t=o.find(t=>t.id===e);return t?(0,u.dishReason)(t.name,(0,u.shortOf)(t.uses,l),l,i):''},links:n}};var e,t=_r(_d[0]),n=(e=t)&&e.__esModule?e:{default:e},s=_r(_d[1]),r=_r(_d[2]),u=_r(_d[3]),i=_r(_d[4]),o=_r(_d[5]),l=_r(_d[6]),c=_r(_d[7]),d=_r(_d[8]),S=_r(_d[9]),f=_r(_d[10]);const m=()=>{try{return(0,c.nowFrom)(c.useStore.getState().clock)}catch{return new Date}},h=(0,s.create)()((0,r.persist)(e=>({links:[],setLink:(t,n,s,r)=>e(e=>{const u=e.links.filter(e=>!(e.rid===t&&e.itemId===n));return{links:[...u,{rid:t,itemId:n,uses:s?s.filter(e=>e.qty>0).slice(0,10):[],at:m().toISOString(),by:r.slice(0,80),...s?{}:{auto:!0}}]}})}),{name:'covercharge-soldout-links-v1',version:1,storage:(0,r.createJSONStorage)(()=>n.default)})),k=e=>!!e&&!0===e.auto,v={soldOutRead:new Set,linksRead:new Set};function b(e){return(d.useShellStore.getState().items[e]??[]).filter(e=>e.active).map(e=>({key:e.key,name:e.name,plural:e.plural,unit:e.unit,active:e.active}))}function p(e,t=c.useStore.getState().menu,n=h.getState().links,s=S.useCardStore.getState().cards,r=b(e)){const i=[];for(const o of t){if(o.restaurantId!==e||o.hidden)continue;const t=s.find(t=>t.restaurantId===e&&t.menuItemId===o.id),l=n.find(t=>t.rid===e&&t.itemId===o.id),c=(0,u.inferUses)(o,t,r),d=k(l)?c:(0,u.usesFor)(o,l,t,r);i.push({id:o.id,name:o.name,uses:d.uses,source:d.source,guess:c.uses})}return i}function O(e){return(0,d.venueCounts)(d.useShellStore.getState(),e)}function I(e){const t={};for(const n of d.useShellStore.getState().events)n.rid===e&&(!t[n.kind]||n.at>t[n.kind])&&(t[n.kind]=n.at);return t}function y(e=m()){const t=c.useStore.getState();let n=0;for(const s of t.restaurants){const t=s.id;if((0,o.liveData)()&&(!d.useShellStore.getState().server[t]||!v.soldOutRead.has(t)||!v.linksRead.has(t)))continue;const r=(0,i.soldOutSettingsOf)(s.settings?.soldOut).auto,l=p(t),c=(0,u.planAuto)({rid:t,enabled:r,dishes:l,counts:O(t),entries:f.useSoldOut.getState().entries,lastChange:I(t),now:e});if(!c.mark.length&&!c.clear.length)continue;const S=e.toISOString();f.useSoldOut.setState(e=>{const n=new Set(c.clear),s=new Map(c.mark.map(e=>[e.itemId,e.name])),r=e.entries.filter(e=>!(e.rid===t&&s.has(e.itemId))).map(e=>e.rid===t&&n.has(e.itemId)?{...e,on:!1,at:S,by:'Count back up',kept:!1,clearAfter:void 0}:e);return{entries:[...r,...c.mark.map(e=>({rid:t,itemId:e.itemId,name:e.name.slice(0,120),on:!0,at:S,by:'Live count',auto:!0,kept:!1}))]}}),n+=c.mark.length+c.clear.length}return n}let w=null;l.PITCH&&'undefined'!=typeof globalThis&&(globalThis.__pitchCounts=e=>{const t=c.useStore.getState().restaurants[0]?.id;if(!t)return;const n=O(t),s=m().toISOString(),r=Object.entries(e).filter(([e,t])=>(n[e]??0)!==t).map(([e,r],u)=>({id:`pitch-count-${Date.now()}-${u}`,rid:t,kind:e,delta:r-(n[e]??0),reason:'count',by:'Chef',app:'chef',at:s}));return r.length&&d.useShellStore.setState(e=>({events:[...e.events,...r]})),y()})},941,[1115,951,1116,942,943,1118,2,870,1025,1093,917]); +__d(function(_g,r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.parseQty=i,_e.inferUses=u,_e.usesFor=function(e,t,n,o){const s=new Set(o.filter(e=>!1!==e.active).map(e=>e.key));return t?{uses:t.uses.filter(e=>s.has(e.key)&&e.qty>0),source:t.uses.length?'link':'none'}:u(e,n,o)},_e.shortOf=c,_e.shortReason=f,_e.dishReason=function(e,t,n,o){if(!t.length)return'';const i=e.replace(/\([^)]*\)/g,'').trim(),a=e=>{const t=o.find(t=>t.key===e);return!!t&&new RegExp(`\\b(${s(t)})$`,'i').test(i)},l=t.filter(e=>!a(e.key));return l.length?f(l,n,o):t.some(e=>(n[e.key]??0)>0)?'not enough left':'none left'},Object.defineProperty(_e,"withReason",{enumerable:!0,get:function(){return h}}),_e.usesText=function(e,t){return e.length?e.map(e=>{const n=t.find(t=>t.key===e.key),o=(n?.name??e.key).toLowerCase(),s=(n?.plural??`${o}s`).toLowerCase();return`${.5===e.qty?'\xbd':Number.isInteger(e.qty)?String(e.qty):`${Math.floor(e.qty)}\xbd`} ${e.qty>1?s:o}`}).join(', '):'Not linked to the counts'},_e.planAuto=function(e){const{rid:t,enabled:n,dishes:o,counts:s,entries:i,lastChange:a,now:l}=e,u={mark:[],clear:[]},f=new Map(i.filter(e=>e.rid===t).map(e=>[e.itemId,e])),h=l.getTime(),m=e=>e.on&&(!e.clearAfter||new Date(e.clearAfter).getTime()>h),d=new Set;for(const e of o){d.add(e.id);const t=f.get(e.id),o=n?c(e.uses,s):[];if(o.length){if(t&&m(t))continue;if(t&&t.kept){const e=o.map(e=>a[e.key]??'').sort().pop()??'';if(!e||e<=t.at)continue}u.mark.push({itemId:e.id,name:e.name})}else t&&t.auto&&m(t)&&u.clear.push(e.id)}for(const e of f.values())e.auto&&m(e)&&!d.has(e.itemId)&&u.clear.push(e.itemId);return u};const e='meat|bisque|stock|cakes?|claws?|sauce|butter|oil|paste|salad|mayo|mayonnaise|thermidor|tails?|bon|croquettes?|p\xe2t\xe9|pate|rolls?|soup|linguine|ravioli',t=/^(g|kg|gram|grams|ml|l|litre|litres|oz|lb|lbs|cl)$/i,n={a:1,an:1,one:1,two:2,three:3,four:4,five:5,six:6,half:.5,'\xbd':.5},o=e=>e.replace(/[.*+?^${}()|[\]\\]/g,'\\$&'),s=e=>{const t=new Set([e.name,e.plural].map(e=>e.trim().toLowerCase()).filter(Boolean));for(const e of[...t])e.endsWith('s')?t.add(e.slice(0,-1)):t.add(e+'s');return[...t].sort((e,t)=>t.length-e.length).map(o).join('|')};function i(e){const t=(e||'').trim().toLowerCase();if(!t)return 1;if(/^\xbd$|^half\b/.test(t))return.5;const o=t.match(/^(\d+(?:\.\d+)?)\s*(\xbd)?/);if(o)return Number(o[1])+(o[2]?.5:0);const s=t.split(/\s+/)[0];return n[s]??1}const a=(e,t)=>'half'===e.unit?Math.max(.5,Math.round(2*t)/2):Math.max(1,Math.round(t)),l=e=>(e.optionGroups??[]).some(e=>e.choices.some(e=>/\bhalf\b/i.test(e.label)));function u(n,o,u){const c=u.filter(e=>!1!==e.active&&'kg'!==e.unit),f=(e,t)=>({source:e,uses:t.map(t=>{const o=c.find(e=>e.key===t.key),s='half'===o.unit&&l(n)&&'description'!==e?.5:t.qty;return{key:t.key,qty:a(o,s)}})});if(o){const e=[];for(const n of c){const a=new RegExp(`\\b(${s(n)})\\b`,'i'),l=o.ingredients.find(e=>a.test(e.name)&&!t.test((e.unit||'').trim())&&!/\b(meat|stock|bisque|oil|butter|paste)\b/i.test(e.name));l&&e.push({key:n.key,qty:i(`${l.qty} ${l.unit}`)})}if(e.length)return f('card',e)}const h=n.description??'';{const t=[];for(const n of c){const o=new RegExp(`\\b(half an?|a|an|one|two|three|four|five|six|\\d+(?:\\.\\d+)?|\xbd)\\s+(?:(?:whole|fresh|live|dressed|local)\\s+)?(?:[A-Za-z'\u2019-]+\\s+){0,2}?(${s(n)})\\b(?!\\s+(?:${e}))`,'i'),a=h.match(o);a&&t.push({key:n.key,qty:i(a[1])})}if(t.length)return f('description',t)}{const e=n.name.replace(/\([^)]*\)/g,'').trim(),t=[];for(const n of c)new RegExp(`\\b(${s(n)})$`,'i').test(e)&&t.push({key:n.key,qty:1});if(t.length)return f('name',t)}return{uses:[],source:'none'}}function c(e,t){return e.filter(e=>(t[e.key]??0)(n.find(t=>t.key===e)?.name??e).toLowerCase(),s=e.filter(e=>(t[e.key]??0)<=0).map(e=>o(e.key)),i=e.filter(e=>(t[e.key]??0)>0).map(e=>o(e.key)),a=e=>e.length<=2?e.join(' or '):`${e.slice(0,-1).join(', ')} or ${e[e.length-1]}`;return[s.length?`no ${a(s)}`:'',i.length?`not enough ${a(i)}`:''].filter(Boolean).join(', ')}const h=(e,t)=>t?`${e.replace(/\s*\([^)]*\)\s*$/,'').trim()||e} (${t})`:e},942,[]); +__d(function(g,r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEFAULT_SOLD_OUT",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"SOLD_OUT_CLEAR_LABEL",{enumerable:!0,get:function(){return t}}),_e.soldOutSettingsOf=function(t){const n='morning'===t?.clear||'manual'===t?.clear||'close'===t?.clear?t.clear:e.clear,o=/^([01]\d|2[0-3]):[0-5]\d$/.test(t?.morningAt??'')?t.morningAt:e.morningAt;return{clear:n,morningAt:o,auto:!1!==t?.auto}},_e.clearAfterFor=function(e,t,o){if('manual'===t.clear)return;const c=(()=>{const o=n(e,t.morningAt);return ee.getTime()?o:c},_e.activeSoldOut=function(e,t,n){const o=n.getTime();return e.filter(e=>e.rid===t&&e.on&&(!e.clearAfter||new Date(e.clearAfter).getTime()>o)).sort((e,t)=>t.at.localeCompare(e.at)||e.name.localeCompare(t.name))},_e.expiredSoldOut=function(e,t,n){const o=n.getTime();return e.filter(e=>e.rid===t&&e.on&&!!e.clearAfter&&new Date(e.clearAfter).getTime()<=o)},_e.stripText=o,_e.stripNeedsTicker=function(e,t,n){return o(e).length*n*.56>Math.max(0,t-150)},_e.soldOutCount=function(e){return 1===e?'1 dish sold out':`${e} dishes sold out`};const e={clear:'close',morningAt:'05:00',auto:!0},t={close:'When the kitchen closes',morning:'Next morning',manual:'Only when someone taps Back on'};const n=(e,t,n=0)=>{const[o,c]=t.split(':').map(Number);return new Date(e.getFullYear(),e.getMonth(),e.getDate()+n,o,c,0,0)};function o(e){return e.join(' \xb7 ')}},943,[]); +__d(function(_g,_r,_i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"SHAPES",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"shapeLabel",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"tableLabel",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"tableNumber",{enumerable:!0,get:function(){return u}}),_e.numberClashes=function(e){const t=new Map;for(const n of e){const e=u(n);t.set(e,[...t.get(e)??[],{name:n.name,areaId:n.areaId}])}const n=new Set,r=[];for(const[e,a]of t){if(a.length<2)continue;const t=new Map;a.forEach(e=>t.set(e.areaId,[...t.get(e.areaId)??[],e.name]));for(const e of t.values())e.length>1&&e.forEach(e=>n.add(e));t.size>1&&r.push(e)}return{sameArea:n,acrossAreas:r}},Object.defineProperty(_e,"liveTableLabel",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"FIXTURES",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"PLAN_W",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"PLAN_H",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"GRID",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"snap",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"clamp",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"fid",{enumerable:!0,get:function(){return g}}),Object.defineProperty(_e,"slug",{enumerable:!0,get:function(){return w}}),_e.sizeFor=y,Object.defineProperty(_e,"minFor",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"numOf",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"byNumber",{enumerable:!0,get:function(){return P}}),_e.newTable=j,_e.autoArrange=M,_e.placeNew=S,_e.rotate90=function(e){const t=e.x+e.w/2,n=e.y+e.h/2;return{...e,w:e.h,h:e.w,x:h(f(t-e.h/2),0,c-e.h),y:h(f(n-e.w/2),0,b-e.w)}},_e.normalisePlan=function(e){return{...e,fixtures:e.fixtures??[],tables:e.tables.map(e=>{const t=e.shape;let n='booth'===t||'rect'===t?'rect':'round'===t?'round':'square',{w:r,h:a}=e;if('square'===n||'round'===n){const e=Math.max(r,a);r=e,a=e}if(90===e.rot||270===e.rot){const e=r;r=a,a=e}return'rect'===n&&r===a&&(n='square'),{...e,shape:n,w:r,h:a,rot:0}})}},Object.defineProperty(_e,"SECTION_COLOURS",{enumerable:!0,get:function(){return I}}),_e.buildPlan=k,_e.anchoragePlan=$,_e.starterPlan=function(){return k({areas:[{name:'Main room',tables:[[1,2],[2,4],[3,6],[4,4],[5,2],[6,6]],fixtures:[A(450,600)]}]},['SV'])},Object.defineProperty(_e,"TEMPLATES",{enumerable:!0,get:function(){return v}}),_e.parseTableList=function(e){const t=[],n=[];let r;for(const a of e.split(/\r?\n/)){const e=a.trim();if(!e)continue;if(!/\d/.test(e)){r=e.replace(/[:\-\u2013]+$/,'').trim()||r;continue}const o=e.match(/^(?:table|tbl|tab|t)?\s*(?:no\.?|number|#)?\s*([a-z]?\d+[a-z]?)\b[^\d]*?(\d+)/i);if(!o){n.push(e);continue}const s=parseInt(o[2],10);!s||s>30?n.push(e):t.push({area:r,name:o[1].toUpperCase(),seats:s})}return{items:t,skipped:n}},Object.defineProperty(_e,"planCounts",{enumerable:!0,get:function(){return C}}),Object.defineProperty(_e,"tableDogOk",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e,"dogTables",{enumerable:!0,get:function(){return L}}),Object.defineProperty(_e,"areaOfTable",{enumerable:!0,get:function(){return q}}),_e.bestTables=E,Object.defineProperty(_e,"isBestTable",{enumerable:!0,get:function(){return _}}),_e.withSeedBest=function(e,t){if('anchorage'!==e||!t?.areas?.some(e=>void 0===e.best))return t;const n=$();return{...t,areas:t.areas.map(e=>{if(void 0!==e.best)return e;const r=n.areas.find(t=>t.id===e.id||t.name===e.name),a=(r?.best??[]).filter(n=>t.tables.some(t=>t.name===n&&t.areaId===e.id));return a.length?{...e,best:a}:e})}};var e,t=_r(d[0]),n=_r(d[1]),r=(e=n)&&e.__esModule?e:{default:e};const a=[{id:'square',label:'Square'},{id:'rect',label:'Rectangle'},{id:'round',label:'Round'}],o=e=>'rect'===e?'Rectangle':'round'===e?'Round':'Square',s=e=>/\d/.test(e.name)?(0,t.plainTableNumber)(e.name):(0,t.plainTableNumber)(e.label?.trim()||e.name),u=s;const l=(e,t)=>u(e),i=[{id:'bar',label:'Bar',w:300,h:50},{id:'wall',label:'Wall',w:250,h:25},{id:'door',label:'Door',w:100,h:25},{id:'window',label:'Window',w:200,h:25}],c=1e3,b=625,m=25,f=e=>Math.round(e/m)*m,h=(e,t,n)=>Math.max(t,Math.min(n,e));let p=0;const g=e=>`${e}-${Date.now().toString(36)}${(p++).toString(36)}`,w=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,'-').replace(/^-|-$/g,'')||'area';function y(e){return e<=2?{shape:'square',w:75,h:75}:e<=4?{shape:'square',w:100,h:100}:e<=6?{shape:'rect',w:150,h:100}:e<=8?{shape:'rect',w:200,h:100}:e<=10?{shape:'rect',w:250,h:100}:{shape:'rect',w:300,h:100}}const x=e=>e<=2?1:Math.max(2,Math.ceil(e/2)),O=e=>{const t=e.match(/\d+/);return t?parseInt(t[0],10):9999},P=(e,t)=>O(e.name)-O(t.name)||e.name.localeCompare(t.name);function j(e,t,n,r){const a=y(n);return{id:`t-${e}-${g('x').slice(2)}`,name:e,areaId:t,shape:a.shape,minSeats:x(n),maxSeats:n,x:0,y:0,w:a.w,h:a.h,rot:0,online:!0,sectionId:r}}function M(e,t=125,n=75){const r=[...e].sort(P);if(!r.length)return r;let a=75;const o=e=>{const t=[];let n=[],a=0;for(const o of r){const r=(n.length?e:0)+o.w;n.length&&a+r>850&&(t.push(n),n=[],a=0),n.push(o),a+=(n.length>1?e:0)+o.w}return n.length&&t.push(n),t};let s=o(a);const u=(e,t)=>e.reduce((e,t)=>e+Math.max(...t.map(e=>e.h)),0)+t*(e.length-1);for(;u(s,a)>b-t-n&&a>25;)a-=25,s=o(a);const l=u(s,a),i=b-t-n,p=s.length>1?Math.min(150,a+Math.max(0,Math.floor((i-l)/(s.length-1)/m)*m)):0,g=s.reduce((e,t)=>e+Math.max(...t.map(e=>e.h)),0)+p*(s.length-1);let w=f(t+Math.max(0,(i-g)/2));const y=[];for(const e of s){const t=Math.max(...e.map(e=>e.h)),n=e.reduce((e,t)=>e+t.w,0)+a*(e.length-1);let r=f((c-n)/2);for(const n of e)y.push({...n,x:h(r,0,c-n.w),y:h(f(w+(t-n.h)/2),0,b-n.h),rot:0}),r+=n.w+a;w+=t+p}return y}function S(e,t,n=[]){const r=[...e,...n].map(e=>({x:e.x,y:e.y,w:e.w,h:e.h})),a=[];for(const e of t){let t=null;for(let n=50;n<=b-e.h-25&&!t;n+=m)for(let a=50;a<=c-e.w-25&&!t;a+=m){const o=50;r.some(t=>at.x&&nt.y)||(t={x:a,y:n})}const n=t??{x:50,y:50},o={...e,x:n.x,y:n.y};r.push({x:o.x,y:o.y,w:o.w,h:o.h}),a.push(o)}return a}const I=['#CFA45F','#E2C489','#A88B5A','#8C6A3A','#FFB547','#D9B98A'];function k(e,t=[]){const n=[],r=[],a=[],o=[];e.areas.forEach((e,s)=>{const u=w(e.name),l=e.best?e.best.map(String).filter(t=>e.tables.some(([e])=>String(e)===t)):void 0;n.push({id:u,name:e.name,dogs:!!e.dogs,outdoor:!!e.outdoor,...e.label?{label:e.label}:{},...e.colour?{colour:e.colour}:{},...l?{best:l}:{}});const i=`s-${u}`;o.push({id:i,name:e.name,colour:e.colour??I[s%I.length],server:t[s]??''});const m=(e.fixtures??[]).map((e,t)=>({...e,id:`fx-${u}-${t}`,areaId:u}));a.push(...m);const f=m.some(e=>e.y<100&&('bar'===e.kind||e.w>=300))?150:100,p=e.tables.map(([e,t])=>({...j(String(e),u,t,i),id:`t-${e}`})),g=e.layout??{},y=p.filter(e=>g[e.name]).map(e=>{const t=g[e.name],n=t.shape??(t.w===t.h?'square':'rect'),r=h(Math.round(t.w),50,c),a=h(Math.round('rect'===n?t.h:t.w),50,b);return{...e,shape:n,w:r,h:a,x:h(Math.round(t.x),0,c-r),y:h(Math.round(t.y),0,b-a),...t.label?{label:t.label}:{}}}),x=p.filter(e=>!g[e.name]);y.length?r.push(...y,...S(y,x,m)):r.push(...M(p,f,75))});const s=new Set(r.map(e=>e.name)),u=(e.joins??[]).filter(e=>e.every(e=>s.has(e))).map(e=>({id:`j-${e.join('-')}`,tables:e}));return{areas:n,tables:r,joins:u,sections:o,fixtures:a}}const T=(e,t,n=0,r=25)=>({kind:'window',x:e,y:n,w:t,h:r}),A=(e,t,n=100,r=25)=>({kind:'door',x:e,y:t,w:n,h:r});function $(){const e=r.default;return k({areas:e.areas.map(e=>({name:e.name,dogs:!!e.dogFriendly,outdoor:!(!e.outdoor&&!e.weatherDependent),label:e.label,colour:e.colour,tables:e.tables.map(([e,t])=>[e,t]),layout:e.layout,fixtures:[],best:e.best?.map(String)})),joins:e.joins??[]},e.areas.map(e=>e.server??''))}const v=[{id:'anchorage',name:'The Anchorage',sub:'4 areas \xb7 29 tables \xb7 119 seats',make:$},{id:'cafe',name:'Small caf\xe9',sub:'1 room \xb7 8 tables \xb7 dogs welcome',make:()=>k({areas:[{name:'Caf\xe9',dogs:!0,tables:[[1,2],[2,2],[3,4],[4,4],[5,2],[6,4],[7,2],[8,6]],fixtures:[{kind:'bar',x:300,y:25,w:400,h:50},A(450,600)]}]})},{id:'pub',name:'Pub with garden',sub:'Bar, lounge and beer garden',make:()=>k({areas:[{name:'Bar',dogs:!0,tables:[[1,2],[2,4],[3,4],[4,2],[5,4],[6,6]],fixtures:[{kind:'bar',x:250,y:25,w:500,h:75}]},{name:'Lounge',tables:[[7,4],[8,4],[9,2],[10,6],[11,4],[12,2],[13,4],[14,8]],fixtures:[T(150,700)]},{name:'Beer garden',dogs:!0,outdoor:!0,tables:[[20,6],[21,6],[22,4],[23,4],[24,6],[25,6]]}]})},{id:'restaurant',name:'Restaurant and terrace',sub:'Dining room with an outdoor terrace',make:()=>k({areas:[{name:'Dining room',tables:[[1,2],[2,2],[3,4],[4,4],[5,4],[6,6],[7,2],[8,2],[9,4],[10,4],[11,6],[12,8]],fixtures:[T(100,800),A(450,600)]},{name:'Terrace',outdoor:!0,tables:[[20,2],[21,4],[22,4],[23,2]]}]})},{id:'blank',name:'Blank',sub:'One empty room to start from',make:()=>k({areas:[{name:'Main room',tables:[]}]})}];const C=(e,t)=>{const n=t?e.tables.filter(e=>e.areaId===t):e.tables;return{tables:n.length,seats:n.reduce((e,t)=>e+t.maxSeats,0)}},B=(e,t)=>void 0!==t.dogOk?t.dogOk:!!e.areas.find(e=>e.id===t.areaId)?.dogs,L=e=>new Set(e.tables.filter(t=>B(e,t)).map(e=>e.name)),q=(e,t)=>e.areas.find(n=>n.id===e.tables.find(e=>e.name===t)?.areaId);function E(e,t){return e.areas.filter(e=>!t||e.id===t).flatMap(t=>(t.best??[]).filter(n=>e.tables.some(e=>e.name===n&&e.areaId===t.id)))}const _=(e,t)=>E(e).includes(t)},944,[808,17]); +__d(function(g,r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DEFAULT_WAKE_PIN",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"DEFAULT_WAKE_SALT",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"hashWakePin",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"DEFAULT_WAKE",{enumerable:!0,get:function(){return o}}),e.newSalt=u,e.wakePinProblem=function(n){return/^\d{6,8}$/.test(n)?/^(\d)\1+$/.test(n)||'0123456789012'.includes(n)||'9876543210987'.includes(n)?'Pick a PIN that is harder to guess (not all the same digit or a run like 123456).':n===t?'Pick a new PIN, not the starting one.':null:'The wake PIN must be 6 to 8 digits.'},e.makeWakePin=function(n,t=u()){return{pinHash:a(n,t),pinSalt:t,pinLen:n.length,pinDefault:!1}},Object.defineProperty(e,"wakePinMatches",{enumerable:!0,get:function(){return l}}),e.fromOldPin=function(n){const i='string'==typeof n&&/^\d{4,8}$/.test(n)?n:t;if(i===t)return{...o};const l=u();return{pinHash:a(i,l),pinSalt:l,pinLen:i.length,pinDefault:!1}};var n=r(d[0]);const t='2580',i='cc-wake-default',a=(t,i)=>(0,n.sha256HexSync)(`cc-wake:${i}:${t}`),o={pinHash:a(t,i),pinSalt:i,pinLen:4,pinDefault:!0};function u(){const n=globalThis.crypto,t=new Uint8Array(12);if(n?.getRandomValues)n.getRandomValues(t);else for(let n=0;nn.toString(16).padStart(2,'0')).join('')}const l=(n,t)=>a(t,n.pinSalt)===n.pinHash},945,[1152]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useSliders",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"notify",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"dismissNotice",{enumerable:!0,get:function(){return c}});var t=r(d[0]);let u=0;const s=t=>'urgent'===t.tone?0:'warn'===t.tone?1:2,n=(0,t.create)()((t,n)=>({queue:[],push:n=>t(t=>{const o=t.queue.find(t=>t.id===n.id),c=o?t.queue.map(t=>t.id===n.id?{...n,seq:o.seq}:t):[...t.queue,{...n,seq:++u}];return{queue:(f=c,[...f].sort((t,u)=>s(t)-s(u)||(t.seq??0)-(u.seq??0))).slice(0,40)};var f}),dismiss:u=>{const s=n().queue.find(t=>t.id===u);if(s){t(t=>({queue:t.queue.filter(t=>t.id!==u)}));try{s.onClose?.()}catch{}}},dismissWhere:t=>{for(const u of n().queue.filter(t))n().dismiss(u.id)}})),o=t=>n.getState().push(t),c=t=>n.getState().dismiss(t)},946,[951]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return n.default}});var e=r(d[0]);Object.keys(e).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(_e,t)||Object.defineProperty(_e,t,{enumerable:!0,get:function(){return e[t]}})});var t,n=(t=e)&&t.__esModule?t:{default:t}},947,[1310]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"canCancelWalkIn",{enumerable:!0,get:function(){return w}}),_e.cancelWalkInWords=y,_e.cancelWalkInNow=$,_e.CancelWalkInButton=function({rid:e,b:l,onDone:t,small:s}){const[c,o]=(0,n.useState)(!1);return w(l)?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(u.Button,{kind:"secondary",small:s,label:"Cancel walk-in",testID:`cancel-walkin-${l.id}`,accessibilityLabel:`Cancel walk-in ${l.ref}, ${l.partySize} Covers`,onPress:()=>o(!0),style:s?{minHeight:44}:k}),c?(0,f.jsx)(h,{rid:e,b:l,onClose:()=>o(!1),onDone:t}):null]}):null},_e.CancelWalkInConfirm=h;var e,n=r(d[0]),l=r(d[1]),t=(e=l)&&e.__esModule?e:{default:e},s=r(d[2]),c=r(d[3]),o=r(d[4]),b=r(d[5]),u=r(d[6]),f=r(d[7]);const k={minHeight:56},w=e=>!!e.walkIn&&('seated'===e.status||'confirmed'===e.status);function y(e){const n=(0,c.tablesOf)(e.table),l=(0,o.tablesWords)(n);return`Cancel walk-in ${e.ref}, ${e.partySize} Covers${n.length?` at ${l}`:''}, arrived ${e.time}? It comes off the Covers${n.length?` and ${l} ${n.length>1?'go':'goes'} back to Free`:''}.`}async function $(e,n){await s.repo.bookings.setStatus(n.id,'cancelled'),(0,c.tablesOf)(n.table).forEach(n=>c.useFloor.getState().setLive(e,n,{stage:void 0,dirty:!1}))}function h({rid:e,b:n,onClose:l,onDone:s}){const w=y(n);return(0,f.jsxs)(u.Sheet,{visible:!0,onClose:l,title:"Cancel walk-in?",maxWidth:560,testID:"cancel-walkin-confirm",children:[(0,f.jsx)(t.default,{accessible:!0,accessibilityLabel:w,children:(0,f.jsx)(u.T,{size:18,colour:b.colours.text,children:w})}),(0,f.jsxs)(u.Row,{gap:8,wrap:!0,children:[(0,f.jsx)(u.Button,{label:"Yes, cancel walk-in",testID:"cancel-walkin-yes",accessibilityLabel:`Yes, cancel walk-in ${n.ref}`,style:[k,{flexGrow:1}],onPress:async()=>{await $(e,n),l(),s?.(`Walk-in ${n.ref} cancelled.${(0,c.tablesOf)(n.table).length?` ${(0,o.tablesWords)((0,c.tablesOf)(n.table))} free.`:''}`)}}),(0,f.jsx)(u.Button,{kind:"secondary",label:"Keep walk-in",testID:"cancel-walkin-no",accessibilityLabel:`Keep walk-in ${n.ref}`,onPress:l,style:k})]})]})}},948,[30,127,819,825,930,821,813,24]); +__d(function(g,_r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.AllergenBar=p,_e.NeedsPills=k,_e.BookingNeeds=x,Object.defineProperty(_e,"needsIcons",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"confirmHolds",{enumerable:!0,get:function(){return S}}),_e.serveHolds=y,_e.postNewBookingToKitchen=function(e,t){if(!t||'system'===t)return;const s=o.useStore.getState().restaurants.find(t=>t.id===e.restaurantId),l=[],r=`${e.name}, ${(0,c.niceDate)((0,c.parseYmd)(e.date)).slice(0,3)} ${e.time}${e.table?`, table ${e.table}`:''}`;if((e.holds??[]).filter(e=>e.qty>0).length){const t=I(e.restaurantId);l.push(`${(0,u.holdsText)(e,(0,u.reservablesOf)(s),t)} reserved: ${r}. Tap Platter OK in the Head Chef app.`)}(0,u.hasAllergens)(e)&&l.push(`\u26a0\ufe0f Allergens: ${(0,u.allergenText)(e)} \u2014 ${r}. Please sign \u2018Allergens seen\u2019.`);if(!l.length)return;a.useOwner.getState().chatSend({ch:'kitchen',from:t,text:l.join('\n'),at:(new Date).toISOString()})},_e.useKitchenTodo=D,_e.KitchenSignoffs=function({rid:t,today:s,by:a,app:f,canConfirm:p=!0,showAll:k}){const j=D(t,s),I=(0,o.useBookings)(t),T=(0,o.useRestaurant)(t),O=(0,n.useStockItems)(t),$=(0,u.reservablesOf)(T),A=I.filter(e=>e.date===s&&!['cancelled','noshow'].includes(e.status)&&(e.holds??[]).some(e=>e.qty>0)),v=k?[...j,...A.filter(e=>!j.includes(e))]:j;return v.length?(0,b.jsxs)(l.default,{testID:"kitchen-signoffs",style:{gap:10,padding:16,borderRadius:16,borderWidth:1.5,borderColor:j.length?h.colours.amber:h.colours.hairline,backgroundColor:h.colours.surface},children:[(0,b.jsx)(r.T,{size:12,weight:"semibold",colour:j.length?h.colours.amber:h.colours.goldMuted,style:{letterSpacing:1.6},children:j.length?`KITCHEN SIGN-OFF NEEDED (${j.length})`:'RESERVED TODAY'}),v.map(t=>(0,b.jsxs)(l.default,{style:{gap:6,paddingTop:8,borderTopWidth:1,borderColor:h.colours.hairline},testID:`signoff-${t.ref}`,children:[(0,b.jsxs)(r.T,{weight:"semibold",children:[t.name," \xb7 ",t.partySize," covers \xb7 ",t.date===s?'Today':(0,c.niceDate)((0,c.parseYmd)(t.date))," ",t.time,t.table?` \xb7 ${(0,e.tableNumbers)(t.table)}`:'']}),(0,b.jsx)(x,{b:t}),p?(0,b.jsxs)(r.Row,{wrap:!0,gap:8,children:[(0,u.needsAllergenSeen)(t)?(0,b.jsx)(r.Button,{small:!0,kind:"danger",label:"Allergens seen",testID:`allergens-seen-${t.ref}`,onPress:()=>o.useStore.getState().ackBookingAllergy(t.id,a)}):null,(0,u.needsHoldOk)(t)?(0,b.jsx)(r.Button,{small:!0,kind:"success",label:/platter/i.test((0,u.holdsText)(t,$,O))?'Platter OK':'Reservation OK',testID:`platter-ok-${t.ref}`,onPress:()=>S(t.id,a)}):null,t.date===s&&t.holdOk&&(t.holds??[]).some(e=>!e.served)&&['seated','confirmed'].includes(t.status)?(0,b.jsx)(r.Button,{small:!0,kind:"secondary",label:"Served",testID:`served-${t.ref}`,onPress:()=>y(t,a,f)}):null]}):(0,b.jsx)(r.Muted,{children:"The kitchen signs these off."})]},t.id))]}):null},_e.PlattersBooked=function({rid:e,date:t,label:s}){const a=(0,o.useBookings)(e),c=(0,o.useRestaurant)(e),f=(0,n.useStockItems)(e),p=(0,u.heldSummary)(a,t,(0,u.reservablesOf)(c)),k=Object.entries(p.stock).filter(([,e])=>e>0).map(([e,t])=>`${t} ${(f.find(t=>t.key===e)?.name??e).toLowerCase()}`);return p.platters||k.length?(0,b.jsx)(l.default,{testID:"platters-booked",children:(0,b.jsxs)(r.T,{weight:"semibold",colour:h.colours.goldLight,children:[s??'Platters booked',": ",p.platters,k.length?` (${k.join(', ')})`:'']})}):null};var e=_r(d[0]);_r(d[1]);var t,s=_r(d[2]),l=(t=s)&&t.__esModule?t:{default:t},r=_r(d[3]),o=_r(d[4]),n=_r(d[5]),a=_r(d[6]),u=_r(d[7]),c=_r(d[8]),h=_r(d[9]),b=_r(d[10]);const f=({label:e,bg:t,fg:s,border:o,testID:n})=>(0,b.jsx)(l.default,{testID:n,style:{backgroundColor:t,borderColor:o,borderWidth:1,borderRadius:999,paddingHorizontal:9,paddingVertical:2},children:(0,b.jsx)(r.T,{size:13,weight:"semibold",colour:s,children:e})});function p({b:e,big:t}){return(0,u.hasAllergens)(e)?(0,b.jsxs)(l.default,{testID:`allergen-bar-${e.ref}`,style:{backgroundColor:h.colours.redSolid,borderRadius:10,paddingHorizontal:10,paddingVertical:t?8:5,gap:2},children:[(0,b.jsxs)(r.T,{size:t?16:13,weight:"bold",colour:"#FFFFFF",children:["\u26a0\ufe0f ALLERGENS: ",(0,u.allergenText)(e)]}),e.allergyAck?(0,b.jsxs)(r.T,{size:12,colour:"#FFE3DF",children:["Seen by kitchen: ",e.allergyAck.by]}):(0,b.jsx)(r.T,{size:12,colour:"#FFE3DF",children:"Kitchen hasn\u2019t signed \u2018Allergens seen\u2019 yet"})]}):null}function k({b:t,r:s}){const l=(0,n.useStockItems)(t.restaurantId),o=(0,u.reservablesOf)(s),a=(t.holds??[]).some(e=>e.qty>0),c=[];return t.drinksOnly&&c.push((0,b.jsx)(f,{testID:"pill-drinks",label:"\ud83c\udf77 Drinks only (after last food orders)",bg:h.colours.surface2,fg:h.colours.goldLight,border:h.colours.accentBorder},"x")),(0,u.hasAccess)(t)&&c.push((0,b.jsx)(f,{testID:"pill-access",label:`\u267f ${(0,u.accessText)(t)}`,bg:h.colours.blueBg,fg:"#E2C489",border:h.colours.blue},"a")),(0,u.dogCount)(t)&&c.push((0,b.jsx)(f,{testID:"pill-dog",label:"\ud83d\udc15 "+((0,u.dogCount)(t)>1?`${(0,u.dogCount)(t)} dogs`:'Dog'),bg:h.colours.surface2,fg:h.colours.text,border:h.colours.hairline},"d")),(0,u.dietText)(t)&&c.push((0,b.jsx)(f,{testID:"pill-veg",label:`\u24cb ${(0,u.dietText)(t)}`,bg:"#2A2216",fg:"#E2C489",border:"#CFA45F"},"v")),a&&c.push(t.holdOk?(0,b.jsx)(f,{testID:"pill-platter",label:`\u2713 ${(0,u.holdsText)(t,o,l)} \xb7 confirmed`,bg:h.colours.okBg,fg:"#E2C489",border:h.colours.ok},"h"):(0,b.jsx)(f,{testID:"pill-platter",label:`\ud83e\udd9e ${(0,u.holdsText)(t,o,l)} \xb7 awaiting kitchen`,bg:h.colours.amberBg,fg:"#FFE2A8",border:h.colours.amber},"h")),t.tableReq?.length&&c.push((0,b.jsx)(f,{testID:"pill-request",label:`Requested: ${t.tableReq.map(t=>`${(0,e.tableNumbers)(t)}`).join(' or ')}`,bg:h.colours.goldTint,fg:h.colours.goldLight,border:h.colours.accentBorder},"t")),c.length?(0,b.jsx)(r.Row,{wrap:!0,gap:6,children:c}):null}function x({b:e,big:t}){const s=(0,o.useRestaurant)(e.restaurantId);return(0,b.jsxs)(l.default,{style:{gap:6},children:[(0,b.jsx)(p,{b:e,big:t}),(0,b.jsx)(k,{b:e,r:s})]})}const j=e=>[(0,u.hasAllergens)(e)?'\u26a0\ufe0f':'',(0,u.hasAccess)(e)?'\u267f':'',(0,u.dogCount)(e)?'\ud83d\udc15':'',(0,u.dietText)(e)?'\u24cb':'',(e.holds??[]).some(e=>e.qty>0)?e.holdOk?'\ud83e\udd9e\u2713':'\ud83e\udd9e':''].filter(Boolean).join(' '),S=(e,t)=>o.useStore.getState().updateBooking(e,{holdOk:{by:t,at:(new Date).toISOString()}});function y(e,t,s){const l=o.useStore.getState().restaurants.find(t=>t.id===e.restaurantId),r=(0,u.stockNeed)(e,(0,u.reservablesOf)(l));for(const[l,o]of Object.entries(r))o>0&&n.shellfish.append({rid:e.restaurantId,kind:l,delta:-o,reason:'sold',by:t,app:s});const a=(new Date).toISOString();o.useStore.getState().updateBooking(e.id,{holds:(e.holds??[]).map(e=>e.served?e:{...e,served:{by:t,at:a}})})}const I=e=>n.useShellStore.getState().items[e]??[];function D(e,t){return(0,o.useBookings)(e).filter(e=>e.date>=t&&!e.walkIn&&((0,u.needsAllergenSeen)(e)||(0,u.needsHoldOk)(e))).sort((e,t)=>(e.date+e.time).localeCompare(t.date+t.time))}},949,[808,30,127,813,819,1025,854,828,818,821,24]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.DepositChip=function({b:e,money:o,big:n,testID:b}){const f=(0,s.depositView)(e,o);if(!f)return null;const h={gold:[t.colours.goldTint,t.colours.goldLight,t.colours.gold],amber:[t.colours.amberBg,'#FFE2A8',t.colours.amber],red:[t.colours.redBg,'#FFD9D4',t.colours.red],neutral:[t.colours.surface2,t.colours.muted,t.colours.border]}[f.kind];return(0,u.jsxs)(l.default,{accessible:!0,accessibilityRole:"text",accessibilityLabel:f.a11y,testID:b??'deposit-chip',style:{alignSelf:'flex-start',maxWidth:'100%'},children:[(0,u.jsx)(l.default,{style:{backgroundColor:h[0],borderColor:h[2],borderWidth:n?2:1,borderRadius:8,paddingHorizontal:n?12:8,paddingVertical:n?6:3},children:(0,u.jsx)(c.T,{size:16,weight:"semibold",colour:h[1],children:f.label})}),f.note?(0,u.jsx)(c.Muted,{size:12,children:f.note}):null]})},r(d[0]);var e,o=r(d[1]),l=(e=o)&&e.__esModule?e:{default:e},s=r(d[2]),t=r(d[3]),c=r(d[4]),u=r(d[5])},950,[30,127,13,821,813,24]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0});var t=r(d[0]);Object.keys(t).forEach(function(n){'default'===n||Object.prototype.hasOwnProperty.call(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[n]}})});var n=r(d[1]);Object.keys(n).forEach(function(t){'default'===t||Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})})},951,[1125,1126]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";function i(i){return i&&i.__esModule?i:{default:i}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEFAULT_AVATARS",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"AVATAR_BGS",{enumerable:!0,get:function(){return F}}),Object.defineProperty(_e,"AVATAR_RINGS",{enumerable:!0,get:function(){return u}}),_e.specFor=E,_e.AvatarArt=$,_e.useStaffMember=v,_e.StaffAvatar=function({id:i,name:t,size:s=34,ring:c=!0}){const f=v(i,t),y=f?.id??i,F=(0,n.useAvatars)(i=>y?i.photos[y]:void 0),u=(0,o.useSetup)(i=>y?i.looks[y]:void 0),j=`${(f?.name??t??'Team member').replace(' (example)','')}'s avatar`;return(0,h.jsx)(r.default,{testID:y?`avatar-${y}`:'avatar',accessibilityLabel:j,accessibilityRole:"image",style:{width:s,height:s,borderRadius:s/2,overflow:'hidden',borderWidth:c?Math.max(1,s/22):0,borderColor:x.colours.gold,backgroundColor:(0,l.soutersSurface)('#111')},children:F?(0,h.jsx)(e.default,{source:{uri:F.dataUrl},style:{width:'100%',height:'100%'},accessibilityIgnoresInvertColors:!0}):(0,h.jsx)($,{spec:null!=u?E(`${y}#look${u}`):E(y,f?.name??t),size:s-(c?2*Math.max(1,s/22):0)})})};var l=_r(d[0]);_r(d[1]);var e=i(_r(d[2])),r=i(_r(d[3])),t=_r(d[4]),s=i(t),c=_r(d[5]),n=_r(d[6]),o=_r(d[7]),x=_r(d[8]),f=_r(d[9]),h=_r(d[10]);const y=Object.fromEntries(f.ROSTER.map(i=>[i.id,i.avatar])),F=['#2A2520','#B89A72','#D9A441','#4A3F35','#3A3029','#8A6A3B'],u=['#E9B949','#CFA45F'],j=F,C=['#F1C7A5','#E8B48F','#C68B5E','#8D5B3E','#F4D2B8','#A86B45'],p=['#2B1B12','#7A4E2A','#151515','#C2462E','#D9B26A'],A=['quiff','flip','crop','beehive','bob','curls'],b=i=>{let l=7;for(const e of i)l=31*l+e.charCodeAt(0)>>>0;return l};function E(i,l){if(i&&y[i])return y[i];const e=b(i||l||'crew');return{bg:j[e%6],ring:u[e%2],skin:C[(e>>3)%6],hair:p[(e>>6)%5],hairStyle:A[(e>>9)%6],suit:'#F2EAD8',antenna:['ball','star','none'][(e>>12)%3]}}const k=(i,l,e)=>`M${i} ${l-e} Q${i+.18*e} ${l-.18*e} ${i+e} ${l} Q${i+.18*e} ${l+.18*e} ${i} ${l+e} Q${i-.18*e} ${l+.18*e} ${i-e} ${l} Q${i-.18*e} ${l-.18*e} ${i} ${l-e}Z`;function $({spec:i,size:l=40}){const e=i,r='#1B1B1B',c='flip'===e.hairStyle?(0,h.jsx)(t.Path,{d:"M29 50 C26 30 40 22 50 22 C60 22 74 30 71 50 C75 56 79 60 76 65 C72 60 69 58 66 57 L34 57 C31 58 28 60 24 65 C21 60 25 56 29 50Z",fill:e.hair}):'bob'===e.hairStyle?(0,h.jsx)(t.Path,{d:"M30 58 C27 32 40 24 50 24 C60 24 73 32 70 58 L66 60 L34 60Z",fill:e.hair}):'beehive'===e.hairStyle?(0,h.jsxs)(t.G,{children:[(0,h.jsx)(t.Ellipse,{cx:50,cy:25,rx:15,ry:14,fill:e.hair}),(0,h.jsx)(t.Path,{d:"M31 54 C28 34 40 27 50 27 C60 27 72 34 69 54 Z",fill:e.hair})]}):'curls'===e.hairStyle?(0,h.jsx)(t.G,{children:[[34,34],[40,27],[50,24],[60,27],[66,34],[69,43],[31,43]].map(([i,l],r)=>(0,h.jsx)(t.Circle,{cx:i,cy:l,r:7,fill:e.hair},r))}):null,n='quiff'===e.hairStyle?(0,h.jsxs)(t.G,{children:[(0,h.jsx)(t.Path,{d:"M32 42 C31 27 43 23 51 25 C61 22 70 30 68 42 C63 35 57 33 50 34 C43 34 37 37 32 42Z",fill:e.hair}),(0,h.jsx)(t.Path,{d:"M46 26 C51 14 66 14 66 23 C61 20 54 21 50 28Z",fill:e.hair})]}):'crop'===e.hairStyle?(0,h.jsx)(t.Path,{d:"M32 42 C31 28 42 25 50 25 C58 25 69 28 68 42 C64 36 58 33 50 33 C42 33 36 36 32 42Z",fill:e.hair}):'curls'===e.hairStyle?null:(0,h.jsx)(t.Path,{d:"M32 43 C33 30 42 27 50 27 C58 27 67 30 68 43 C61 38 57 33 51 33 C47 37 39 41 32 43Z",fill:e.hair});return(0,h.jsxs)(s.default,{width:l,height:l,viewBox:"0 0 100 100",children:[(0,h.jsx)(t.Circle,{cx:50,cy:50,r:50,fill:e.bg}),(0,h.jsx)(t.Ellipse,{cx:50,cy:50,rx:46,ry:13,fill:"none",stroke:"#FFF4E0",strokeOpacity:.28,strokeWidth:1.6,transform:"rotate(-28 50 50)"}),(0,h.jsx)(t.Path,{d:k(16,24,6),fill:"#FFF4E0",fillOpacity:.85}),(0,h.jsx)(t.Path,{d:k(84,34,4),fill:"#FFF4E0",fillOpacity:.7}),(0,h.jsx)(t.Circle,{cx:80,cy:16,r:1.6,fill:"#FFF4E0",fillOpacity:.8}),(0,h.jsx)(t.Circle,{cx:22,cy:70,r:1.3,fill:"#FFF4E0",fillOpacity:.6}),(0,h.jsx)(t.Path,{d:"M12 100 C14 82 31 74 50 74 C69 74 86 82 88 100 Z",fill:e.suit}),(0,h.jsx)(t.Path,{d:"M36 100 L40 84 L50 90 L60 84 L64 100Z",fill:e.ring,fillOpacity:.35}),(0,h.jsx)(t.Rect,{x:44,y:60,width:12,height:12,fill:e.skin}),c,(0,h.jsx)(t.Ellipse,{cx:50,cy:46,rx:17,ry:18.5,fill:e.skin}),n,e.specs?(0,h.jsxs)(t.G,{stroke:r,strokeWidth:1.6,fill:"#FFFFFF",fillOpacity:.25,children:[(0,h.jsx)(t.Rect,{x:37,y:42,width:11,height:8,rx:4}),(0,h.jsx)(t.Rect,{x:52,y:42,width:11,height:8,rx:4}),(0,h.jsx)(t.Line,{x1:48,y1:45,x2:52,y2:45})]}):null,(0,h.jsx)(t.Ellipse,{cx:42.5,cy:46.5,rx:2.1,ry:2.7,fill:r}),(0,h.jsx)(t.Ellipse,{cx:57.5,cy:46.5,rx:2.1,ry:2.7,fill:r}),(0,h.jsx)(t.Circle,{cx:43.3,cy:45.5,r:.8,fill:"#FFFFFF"}),(0,h.jsx)(t.Circle,{cx:58.3,cy:45.5,r:.8,fill:"#FFFFFF"}),(0,h.jsx)(t.Circle,{cx:38,cy:53,r:3,fill:"#F08A7E",fillOpacity:.55}),(0,h.jsx)(t.Circle,{cx:62,cy:53,r:3,fill:"#F08A7E",fillOpacity:.55}),(0,h.jsx)(t.Path,{d:"M44.5 55 Q50 60 55.5 55",stroke:r,strokeWidth:1.8,fill:"none",strokeLinecap:"round"}),(0,h.jsx)(t.Ellipse,{cx:50,cy:74,rx:21,ry:5.5,fill:e.ring}),(0,h.jsx)(t.Ellipse,{cx:50,cy:73,rx:16,ry:3,fill:"#000000",fillOpacity:.18}),(0,h.jsx)(t.Circle,{cx:50,cy:88,r:4,fill:e.ring}),(0,h.jsx)(t.Circle,{cx:50,cy:88,r:1.6,fill:e.bg}),(0,h.jsx)(t.Circle,{cx:50,cy:45,r:29,fill:"#FFF4E0",fillOpacity:.1,stroke:"#FFF4E0",strokeOpacity:.85,strokeWidth:2}),(0,h.jsx)(t.Path,{d:"M29 36 A23 23 0 0 1 41 22",stroke:"#FFFFFF",strokeOpacity:.85,strokeWidth:3.2,fill:"none",strokeLinecap:"round"}),(0,h.jsx)(t.Circle,{cx:28.5,cy:42,r:1.5,fill:"#FFFFFF",fillOpacity:.85}),'none'!==e.antenna?(0,h.jsx)(t.Line,{x1:50,y1:16,x2:50,y2:8,stroke:e.ring,strokeWidth:2}):null,'ball'===e.antenna?(0,h.jsx)(t.Circle,{cx:50,cy:6.5,r:3.3,fill:e.ring}):'star'===e.antenna?(0,h.jsx)(t.Path,{d:k(50,6.5,4.5),fill:e.ring}):null]})}const O=i=>(i??'').replace(' (example)','').trim().toLowerCase();function v(i,l){const e=(0,c.useOwner)(i=>i.staff);return i?e.find(l=>l.id===i):l?e.find(i=>O(i.name)===O(l)):void 0}},952,[912,30,196,127,947,854,1200,1201,821,14,24]); +__d(function(g,_r,i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"MIN_RADIUS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"MAX_RADIUS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"ACCURACY_CAP",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"DEFAULT_BREAK_OPTIONS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"DEFAULT_CLOCK_AREA",{enumerable:!0,get:function(){return r}}),e.distanceM=s,Object.defineProperty(e,"validLat",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"validLng",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"areaSet",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"clampRadius",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"accuracyAllowance",{enumerable:!0,get:function(){return p}}),e.isInside=h,e.cleanArea=function(t){const n=(t.breakOptions??a).map(t=>Math.round(Number(t))).filter(t=>Number.isFinite(t)&&t>0&&t<=180);return{...r,...t,lat:c(t.lat)?t.lat:null,lng:l(t.lng)?t.lng:null,radius:f(t.radius??r.radius),on:!1!==t.on,offRotaPrompt:!1!==t.offRotaPrompt,breakOptions:[...new Set(n)].sort((t,n)=>t-n).slice(0,12),offRotaTitle:(t.offRotaTitle??'').trim().slice(0,80)||r.offRotaTitle,offRotaBody:(t.offRotaBody??'').trim().slice(0,160)||r.offRotaBody}},Object.defineProperty(e,"ACTION_WORD",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"DENIED_TEXT",{enumerable:!0,get:function(){return m}}),e.gate=function(t,n,o,a,r="browser"){if(!t.on||!d(t)){const r={action:n,at:a,inside:null,unchecked:!0};return'object'==typeof o&&Object.assign(r,{lat:y(o.lat),lng:y(o.lng),acc:Math.round(o.acc)}),{allowed:!0,geo:r,warn:t.on?'The clock-in area isn\u2019t set yet, so location isn\u2019t checked.':void 0}}if('object'!=typeof o){const t='app-phone-off'===r?m['app-phone-off']:'denied'===o?m[r]:'timeout'===o?'Your phone couldn\u2019t find your location in time. Step outside or near a window and try again.':'unsupported'===o?'This phone or browser can\u2019t share its location. Ask a manager to record it for you.':'Your phone couldn\u2019t find your location. Check Location is on, then try again.';return{allowed:!1,message:`You need to be at the venue to ${b[n]}. ${t}`,geo:{action:n,at:a,inside:!1}}}const u=h(t,o),s={action:n,at:a,lat:y(o.lat),lng:y(o.lng),acc:Math.round(o.acc),dist:u.dist,inside:u.inside};if(u.inside)return{allowed:!0,geo:s};const c=u.dist>=1e3?`${(u.dist/1e3).toFixed(1)} km`:`${u.dist} m`;return{allowed:!1,geo:s,message:`You need to be at the venue to ${b[n]}. You look to be about ${c} away (allowed ${u.limit} m). If you\u2019re at the venue, try again in a moment or ask a manager to record it for you.`}},e.overrideGeo=function(t,n,o,a){const r=a.trim();return r.length<3?null:{action:t,at:n,inside:null,override:{by:o.name,byId:o.id,reason:r.slice(0,200)}}},e.offRotaDue=function(t){return!(!(t.area.offRotaPrompt&&d(t.area)&&t.inside)||t.clockedIn||t.dismissedToday)&&!t.shifts.some(n=>t.nowHours>=n.start-1&&t.nowHours<(n.end<=n.start?n.end+24:n.end))},Object.defineProperty(e,"breakLabel",{enumerable:!0,get:function(){return O}});const t=50,n=2e3,o=50,a=[5,10,15,20,30,45,60],r={lat:null,lng:null,radius:100,on:!0,breakOptions:[...a],offRotaPrompt:!0,offRotaTitle:'Do you want to sign in?',offRotaBody:'Should you be on the rota?'},u=t=>t*Math.PI/180;function s(t,n){const o=u(n.lat-t.lat),a=u(n.lng-t.lng),r=Math.sin(o/2)**2+Math.cos(u(t.lat))*Math.cos(u(n.lat))*Math.sin(a/2)**2;return 12742017.6*Math.asin(Math.min(1,Math.sqrt(r)))}const c=t=>'number'==typeof t&&Number.isFinite(t)&&t>=-90&&t<=90,l=t=>'number'==typeof t&&Number.isFinite(t)&&t>=-180&&t<=180,d=t=>c(t.lat)&&l(t.lng),f=o=>Number.isFinite(o)?Math.min(n,Math.max(t,Math.round(o))):r.radius,p=t=>Number.isFinite(t)&&t>0?Math.min(t,o):0;function h(t,n){const o=s({lat:t.lat,lng:t.lng},n),a=f(t.radius)+p(n.acc);return{inside:o<=a,dist:Math.round(o),limit:Math.round(a)}}const b={in:'clock in',out:'clock out',break_start:'start a break',break_end:'end your break'},m={browser:'Location is turned off for this browser. Turn it on in your phone\u2019s settings (Location \u203a allow for this browser), then try again.',iphone:'Location is turned off for this app. On your iPhone open Settings \u203a Privacy & Security \u203a Location Services \u203a Safari Websites and choose While Using the App, then try again.',app:'Location is turned off for this app. Tap Open app settings, then Permissions \u203a Location \u203a Allow only while using the app. Then come back and try again.','app-old':'This version of the app can\u2019t use location. Tap Update the app at the bottom of the screen, then tap Allow when your phone asks.','app-phone-off':'Location is switched off on your phone. Tap Open location settings, turn on Use location, then come back and try again.'};const y=t=>Math.round(1e6*t)/1e6;const O=t=>60===t?'1 hour':t%60==0?t/60+" hours":t>60?`${Math.floor(t/60)} h ${t%60} min`:`${t} min`},953,[]); +__d(function(g,_r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"pinProblem",{enumerable:!0,get:function(){return r.pinProblem}}),Object.defineProperty(_e,"ERROR_TEXT",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"errorText",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"useDisplayTiles",{enumerable:!0,get:function(){return u}}),_e.refreshTiles=async function(){const e=await l('display_staff_list',{});Array.isArray(e)&&u.setState({tiles:e,at:Date.now()});const t=await l('display_pin_lengths',{});t&&'object'==typeof t&&!('ok'in t)&&u.setState({lens:t})},_e.refreshManagers=async function(){const e=await l('display_managers',{});Array.isArray(e)&&u.setState({managers:e})},Object.defineProperty(_e,"displayClock",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"displayChangePin",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"displayAddTemp",{enumerable:!0,get:function(){return y}}),_e.setStaffPin=async function(e,n,a=4){const o=_();if(!o)return{ok:!1,error:'Sign in to the venue to set PINs (they are kept on the server only).'};const s=(0,r.pinProblem)(n,a);if(s)return{ok:!1,error:s};try{const{error:r}=await(0,t.getSupabase)().rpc('set_staff_pin',{p_venue:o,p_staff_ref:e,p_pin:n});return r?{ok:!1,error:r.message.replace(/^.*?:\s*(?=The PIN|Pick a PIN)/,'')}:{ok:!0}}catch{return{ok:!1,error:'No connection. Try again in a moment.'}}},_e.addTempStaff=async function(e){const n=_();if(!n)return{ok:!1,error:'Sign in to the venue to add temp staff (the code is made and kept on the server).'};try{const{data:r,error:a}=await(0,t.getSupabase)().rpc('add_temp_staff',{p_venue:n,p_name:e.name,p_dept:e.dept??null,p_rate:e.rate??null,p_until:e.until||null});return a?{ok:!1,error:a.message}:{ok:!0,...r}}catch{return{ok:!1,error:'No connection. Try again in a moment.'}}},Object.defineProperty(_e,"usePinStatus",{enumerable:!0,get:function(){return k}}),_e.refreshPinStatus=async function(){const e=_();if(!e)return;try{const{data:n}=await(0,t.getSupabase)().rpc('staff_pin_status',{p_venue:e});Array.isArray(n)&&k.setState(Object.fromEntries(n.map(e=>[e.staff_ref,{hasPin:e.has_pin,locked:e.locked}])),!0)}catch{}},_e.localTiles=function(e,t){return e.filter(e=>e.active&&e.displayClock&&!(e.temp&&e.tempUntil&&e.tempUntil({ref:e.id,name:e.name,nickname:e.nickname,dept:e.dept,temp:!!e.temp})).sort((e,t)=>Number(!!e.temp)-Number(!!t.temp)||e.name.localeCompare(t.name))},Object.defineProperty(_e,"displayBlockChange",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"displayBlockEdit",{enumerable:!0,get:function(){return h}});var e=_r(d[0]),t=_r(d[1]),n=_r(d[2]),r=_r(d[3]),a=_r(d[4]),o=_r(d[5]);const s={wrong:'That PIN is not right. Try again.',locked:'Too many wrong tries. Locked for 15 minutes, or ask a manager to reset your PIN.',nopin:'No PIN set yet. Ask a manager to set one in Staff & roles.',notallowed:'This person can\u2019t clock in at the Display. A manager can turn it on in Staff & roles.',already:'Already clocked in.',notin:'Not clocked in yet.',onbreak:'Already on a break.',notmanager:'Only an owner or manager can add temp staff.',format:'The new PIN must be 4 to 8 digits (6 or more for managers and owners).',weak:'Pick a PIN that is harder to guess (not all the same digit or a run like 1234).',devicelocked:'Too many wrong PINs on this Display. Wait 15 minutes, then try again.',unpaired:'Pair this Display first (Settings \u203a Devices on the Managers app), then try again.',offline:'No connection. Try again in a moment.'},c=(e,t)=>'format'===e&&t?.min?`The new PIN must be ${t.min} to 8 digits.`:s[e??'']??(e||'Something went wrong. Try again.'),p=()=>'device'===n.useSync.getState().kind&&!!n.useSync.getState().venueId;async function l(e,n){if(a.PITCH)return(0,o.pitchClock)(e,n);if(!p())return{ok:!1,error:'unpaired'};try{const{data:r,error:a}=await(0,t.getSupabase)().rpc(e,n);return a?{ok:!1,error:/paired Display/.test(a.message)?'unpaired':a.message}:r}catch{return{ok:!1,error:'offline'}}}const u=(0,e.create)(()=>({tiles:null,managers:[],lens:{}}));const f=(e,t,n,r={})=>l('display_clock',{p_staff_ref:e,p_pin:t,p_action:n,p_break_mins:r.breakMins??null,p_off_rota:!!r.offRota}),m=(e,t,n)=>l('display_change_pin',{p_staff_ref:e,p_old:t,p_new:n}),y=(e,t,n)=>l('display_add_temp',{p_manager_ref:e,p_manager_pin:t,p_name:n.name,p_dept:n.dept??null,p_rate:n.rate??null,p_until:n.until||null}),_=()=>'staff'===n.useSync.getState().kind?n.useSync.getState().venueId:void 0;const k=(0,e.create)(()=>({}));const b=(e,t,n,r,a)=>l('display_block_change',{p_manager_ref:e,p_manager_pin:t,p_block_id:n,p_action:r,p_doc:a}),h=(e,t,n,r)=>l('display_block_edit',{p_block_id:e,p_action:t,p_doc:n,p_by:r})},954,[951,862,820,1396,2,1397]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"notifSeedId",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"headChefId",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"gmId",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"seedsFor",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"useNotifs",{enumerable:!0,get:function(){return v}});var e,t=r(d[0]),i=(e=t)&&e.__esModule?e:{default:e},s=r(d[1]),n=r(d[2]),o=r(d[3]),u=r(d[4]),p=r(d[5]),f=r(d[6]),c=r(d[7]);const l=(e,t)=>(0,o.uuidFrom)(`sched-notif:${t}:${e}`),S=()=>p.ROSTER.find(e=>'Head Chef'===e.level)?.id??p.ROSTER.find(e=>'chef'===e.app)?.id??'',b=()=>p.ROSTER.find(e=>'Manager'===e.level)?.id??'',h=e=>'anchorage'===e?(0,u.anchorageSeeds)(t=>l(e,t),S(),b()):[],O=()=>(new Date).toISOString(),v=(0,s.create)()((0,n.persist)((e,t)=>({items:[],snooze:{},ensure:i=>{const s=t().items,n=s.map(e=>(0,c.fixSupplierNames)(e.title)!==e.title||(0,c.fixSupplierNames)(e.message)!==e.message?{...e,title:(0,c.fixSupplierNames)(e.title),message:(0,c.fixSupplierNames)(e.message),updatedAt:O()}:e);n.some((e,t)=>e!==s[t])&&e({items:n});const o=new Set(t().items.map(e=>e.id)),u=h(i).filter(e=>!o.has(e.id)).map(e=>({...e,rid:i}));u.length&&e(e=>({items:[...e.items,...u]}))},add:(t,i)=>{const s=(0,f.uuid)();return e(e=>({items:[...e.items,{...i,id:s,rid:t,updatedAt:O()}]})),s},update:(t,i)=>e(e=>({items:e.items.map(e=>e.id===t?{...e,...i,updatedAt:O()}:e)})),remove:t=>e(e=>({items:e.items.flatMap(e=>e.id!==t?[e]:e.seed?[{...e,removed:!0,paused:!0,updatedAt:O()}]:[])})),resetSeeds:t=>{const i=new Map(h(t).map(e=>[e.id,e]));e(e=>{const s=e.items.map(e=>i.has(e.id)?{...i.get(e.id),rid:t,updatedAt:O()}:e),n=new Set(s.map(e=>e.id));return{items:[...s,...[...i.values()].filter(e=>!n.has(e.id)).map(e=>({...e,rid:t,updatedAt:O()}))]}})},setSnooze:(t,i)=>e(e=>({snooze:Object.fromEntries([...Object.entries(e.snooze).filter(([,e])=>e>Date.now()-864e5),[t,i]])}))}),{name:'covercharge-sched-notifs-v1',version:1,storage:(0,n.createJSONStorage)(()=>i.default)}))},955,[1115,951,1116,1103,957,14,1032,1204]); +__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"chairsId",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"rulesId",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"useReminders",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"rulesOf",{enumerable:!0,get:function(){return A}});var e,r=_r(d[0]),t=(e=r)&&e.__esModule?e:{default:e},n=_r(d[1]),s=_r(d[2]),u=_r(d[3]),o=_r(d[4]),l=_r(d[5]);const c=e=>(0,u.uuidFrom)(`reminder:chairs:${e}`),p=e=>(0,u.uuidFrom)(`break-rules:${e}`),f=()=>(new Date).toISOString(),b=(0,n.create)()((0,s.persist)((e,r)=>({reminders:[],rules:{},done:[],snooze:{},ensure:t=>{const n=r(),s={};n.reminders.some(e=>e.id===c(t))||(s.reminders=[...n.reminders,{...(0,o.defaultChairs)(c(t)),rid:t}]),n.rules[t]||(s.rules={...n.rules,[t]:{...o.DEFAULT_BREAK_RULES,id:p(t)}}),Object.keys(s).length&&e(s)},add:(r,t)=>{const n=(0,l.uuid)();return e(e=>({reminders:[...e.reminders,{...t,id:n,rid:r,updatedAt:f()}]})),n},update:(r,t)=>e(e=>({reminders:e.reminders.map(e=>e.id===r?{...e,...t,updatedAt:f()}:e)})),remove:r=>e(e=>({reminders:e.reminders.flatMap(e=>e.id!==r?[e]:e.builtIn?[{...e,removed:!0,paused:!0,updatedAt:f()}]:[])})),resetReminder:r=>e(e=>({reminders:e.reminders.map(e=>e.id===r&&'chairs'===e.builtIn?{...(0,o.defaultChairs)(r),rid:e.rid,updatedAt:f()}:e)})),setRules:(r,t)=>e(e=>({rules:{...e.rules,[r]:{...(0,o.clampRules)({...e.rules[r]??o.DEFAULT_BREAK_RULES,...t}),id:p(r),updatedAt:f()}}})),resetRules:r=>e(e=>({rules:{...e.rules,[r]:{...o.DEFAULT_BREAK_RULES,id:p(r),updatedAt:f()}}})),markDone:r=>e(e=>({done:[{...r,id:(0,l.uuid)(),at:r.at??f()},...e.done].slice(0,400)})),setSnooze:(r,t)=>e(e=>({snooze:Object.fromEntries([...Object.entries(e.snooze).filter(([,e])=>e>Date.now()-864e5),[r,t]])}))}),{name:'covercharge-reminders-v1',version:1,storage:(0,s.createJSONStorage)(()=>t.default)})),A=e=>(0,o.clampRules)(b.getState().rules[e]??o.DEFAULT_BREAK_RULES)},956,[1115,951,1116,1103,1107,1032]); +__d(function(_g,_r,i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SHIFT_FILTER_LABEL",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"NOTIF_DAY_NAMES",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"NOTIF_GROUP_LABEL",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"IN_APP_WINDOW_MINS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"PUSH_WINDOW_MINS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"KITCHEN_OPEN_DAYS",{enumerable:!0,get:function(){return d}}),Object.defineProperty(e,"TITLE_MAX",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"MESSAGE_MAX",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"validHm",{enumerable:!0,get:function(){return u}}),e.ukNow=p,Object.defineProperty(e,"timeOn",{enumerable:!0,get:function(){return m}}),e.notifDue=function(t,n,r=s){const o=p(n),d=m(t,o.dow);if(t.paused||t.removed||!u(d)||!t.days.includes(o.dow))return{due:!1,forDate:o.ymd,at:d};const f=l(d);return{due:o.mins>=f&&o.minst.days.includes(n));if(!r.length)return'No days ticked';const s=new Map;for(const n of r){const r=m(t,n);s.set(r,[...s.get(r)??[],n])}const o=t=>7===t.length?'Every day':t.map(t=>n[t]).join(', ');return[...s.entries()].map(([t,n])=>`${o(n)} at ${t}`).join('; ')+' (UK time)'},e.validateNotif=function(t){if(!t.title.trim())return'Give it a name.';if(t.title.length>f)return`Keep the name under ${f} letters.`;if(!t.message.trim())return'Type the message people will see.';if(t.message.length>c)return`Keep the message under ${c} letters.`;if(!u(t.time))return'Type the time as HH:MM, e.g. 21:00.';for(const n of Object.values(t.dayTimes??{}))if(!u(n))return'Type each day\u2019s time as HH:MM.';return t.days.length?t.recipients.staff.length||t.recipients.groups.length||(t.recipients.onShiftIn??[]).length?t.sendBy.inApp||t.sendBy.push?null:'Choose how to send it.':'Tick at least one person or group.':'Tick at least one day.'},e.anchorageSeeds=function(t,n,r){const s={staff:[n,r].filter(Boolean),groups:[]},o={inApp:!0,push:!0};return[{id:t('mills-milk'),seed:'mills-milk',title:'Mills milk order',message:'Make sure an order before 9:30',days:[...d],time:'21:00',dayTimes:{5:'20:55',0:'20:55'},recipients:s,sendBy:o},{id:t('peronis'),seed:'peronis',title:"Pieroni's order",message:"order Pieroni's by phone",days:[...d],time:'21:05',recipients:s,sendBy:o},{id:t('veg-second'),seed:'veg-second',title:'Veg order',message:'Order veg on the app before 11 PM',days:[...d],time:'21:15',recipients:s,sendBy:o},{id:t('reeds'),seed:'reeds',title:'Reeds order',message:'Order reeds',days:[3,4],time:'21:25',recipients:s,sendBy:o},{id:t('spezbona'),seed:'spezbona',title:'Spes Bona order',message:'Do we need anything from Spes Bona for this week? Message Anna if we do for Friday delivery.',days:[3],time:'15:00',recipients:s,sendBy:o},{id:t('olsens'),seed:'olsens',title:"Olsen's order",message:"Place Olsen's order before 3:30 PM. By phone.",days:[2],time:'13:00',recipients:{staff:[r],groups:[]},sendBy:o},{id:t('allsons-list'),seed:'allsons-list',title:'Alsons drinks list',message:'Add anything extra to the Alsons drinks list.',days:[0],time:'20:00',recipients:{staff:['st-finn'],groups:[]},sendBy:o,open:{page:'orderlists',list:'allsons'}},{id:t('tea-towels'),seed:'tea-towels',title:'Tea towels',message:'Put a load of tea towels on to wash.',days:[...d],time:'15:00',recipients:{staff:[],groups:[],onShiftIn:['kp'],fallback:{staff:[],groups:['head_chef']}},sendBy:o},{id:t('rota-upload'),seed:'rota-upload',title:'Rota upload',message:"Make sure you have uploaded next week's rota.",days:[0],time:'20:50',recipients:s,sendBy:o}]};const t={kitchen:'On shift: Kitchen',foh:'On shift: Front of house',bar:'On shift: Bar',kp:'On shift: KPs',chefs:'On shift: Chefs'},n=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],r={on_shift:'Everyone on shift',everyone:'Everyone',managers:'Owners and managers',head_chef:'Head Chef',kitchen:'Kitchen team',foh:'Front of house'},s=120,o=15,d=[3,4,5,6,0],f=60,c=160,u=t=>/^([01]\d|2[0-3]):[0-5]\d$/.test(t),l=t=>60*Number(t.slice(0,2))+Number(t.slice(3,5));function p(t){const r='number'==typeof t?new Date(t):t,s={};for(const t of new Intl.DateTimeFormat('en-GB',{timeZone:'Europe/London',weekday:'short',year:'numeric',month:'2-digit',day:'2-digit',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}).formatToParts(r))s[t.type]=t.value;return{dow:n.indexOf(String(s.weekday).slice(0,3)),mins:60*Number(s.hour)+Number(s.minute),ymd:`${s.year}-${s.month}-${s.day}`}}const m=(t,n)=>{const r=t.dayTimes?.[String(n)];return r&&u(r)?r:t.time};const h=t=>t.open?`./?open=${t.open.page}${t.open.list?`&list=${encodeURIComponent(t.open.list)}`:''}`:'./',y=(t,n)=>`${t.id}:${n}`,g=t=>(t??'').toLowerCase(),b=t=>t.level?['owner','manager'].includes(g(t.level)):['owner','manager'].includes(g(t.role)),O=t=>'head_chef'===g(t.role)||'head chef'===g(t.level)||'chef'===g(t.app)||/head chef/.test(g(t.job)),P=t=>'kitchen'===g(t.department)||/chef|kitchen|kp|porter/.test(g(t.job))||O(t),k=t=>/\bkp\b|kitchen porter/.test(g(t.job));function j(t,n){const r=g(n.department);return'kitchen'===t?P(n):'kp'===t?k(n):'chefs'===t?O(n)||/chef|commis/.test(g(n.job)):'bar'===t?'bar'===r||/\bbar/.test(g(n.job)):'front of house'===r||!r&&!P(n)&&!b(n)}function _(t,n,r=[]){const s=v(t.recipients,n,r),o=t.recipients.fallback;return s.length||!o?s:v({staff:o.staff,groups:o.groups},n,r)}const w=(t,n,r=[])=>!!t.recipients.fallback&&!v(t.recipients,n,r).length;function v(t,n,r){const s=t,o=n.filter(t=>!1!==t.active),d=new Set;for(const t of s.staff)o.some(n=>n.id===t)&&d.add(t);for(const t of s.groups)for(const n of o)('everyone'===t||'on_shift'===t&&r.includes(n.id)||'managers'===t&&b(n)||'head_chef'===t&&O(n)||'kitchen'===t&&P(n)||'foh'===t&&!P(n)&&!b(n))&&d.add(n.id);for(const t of s.onShiftIn??[])for(const n of o)r.includes(n.id)&&j(t,n)&&d.add(n.id);return[...d].sort()}const M=t=>({id:t.external_ref,role:t.roles?.key??void 0,job:t.job_title??'',department:t.department??'',active:!1!==t.active}),T=(t,n,r,s=[])=>_(t,r,s).includes(n)},957,[]); +__d(function(g,_r,i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.shiftNow=l,e.useShiftReminders=function({rid:c,staffId:k,name:h,kitchen:b,onStartBreak:S}){const D=(0,t.useRef)(S);D.current=S;const I=(0,t.useRef)(h);I.current=h;const v=(0,s.useReminders)(t=>`${t.reminders.length}:${t.done.length}:${JSON.stringify(t.rules[c]??{})}:${t.reminders.map(t=>t.updatedAt??'').join()}`),w=(0,r.useOwner)(t=>`${t.attendance.length}:${t.shifts.length}`);(0,t.useEffect)(()=>{s.useReminders.getState().ensure(c);const t=()=>{const t=u(),{att:h,shift:S,on:v}=l(k,t),w=s.useReminders.getState();if(!v||!k)return w.reminders.forEach(t=>(0,a.dismissNotice)(`rem:${t.id}`)),void(0,a.dismissNotice)('break-reminder');const R=(0,s.rulesOf)(c),$=h?.in?new Date(h.in).getTime():void 0,p=!!h?.breaks?.length,y=`break:${h?.id??S?.id??''}`,M=(0,o.breakDue)({now:t,clockIn:$,shiftStart:S?m(S.date,S.start):void 0,shiftEnd:S?m(S.date,S.end):void 0,rotaBreak:void 0!==S?.breakAt?m(S.date,S.breakAt):void 0,hadBreak:p,rules:R},w.snooze[y]??0);if(M){const r=$??(S?m(S.date,S.start):t);(0,a.notify)({id:'break-reminder',tone:3===M.stage?'warn':'normal',icon:'\ud83e\uded6',kicker:'BREAK REMINDER',testID:'break-reminder',timeoutMs:null,title:M.label,body:`${$?'Clocked in':'Shift started'} at ${f(r)}. ${3===M.stage?'':'Over 6 hours needs a 20-minute break.'}`.trim(),actions:[{label:'Start break',testID:'break-reminder-start',onPress:()=>{if(!h)return D.current?.(),void(0,a.notify)({id:'break-clock-first',title:'Clock in first, then tap Start break.',body:'Your break is started from the clock screen.',timeoutMs:6e3});const t=new Date(u()).toISOString();(0,n.clockAction)('break_start',{rid:c,staffId:k,date:t.slice(0,10),at:t}).then(t=>{t.ok||(0,a.notify)({id:'break-blocked',tone:'warn',title:'Break not started',body:t.message,timeoutMs:1e4}),D.current?.()})}},{label:'Later',kind:'ghost',testID:'break-reminder-later',onPress:()=>s.useReminders.getState().setSnooze(y,u()+6e4*R.snoozeMins)}]})}else(0,a.dismissNotice)('break-reminder');const N=r.useOwner.getState().staff.find(t=>t.id===k),O=b??(0,d.inKitchen)(N);for(const n of w.reminders){if(n.rid!==c)continue;const r=`rem:${n.id}`;if(n.removed||!(0,o.audienceMatch)(n.audience,O)){(0,a.dismissNotice)(r);continue}const{due:d,forDate:f}=(0,o.reminderDue)(n,t),m=w.done.find(t=>t.reminderId===n.id&&t.forDate===f),l=`rem:${n.id}:${f}`;!d||m||(w.snooze[l]??0)>t?(0,a.dismissNotice)(r):(0,a.notify)({id:r,icon:'\ud83e\ude91',kicker:'REMINDER',title:n.text,testID:'venue-reminder',timeoutMs:null,body:`For everyone on shift${'all'===n.audience?'':'kitchen'===n.audience?' in the kitchen':' front of house'}. Tap Done once it\u2019s done.`,actions:[{label:'Done',testID:'venue-reminder-done',onPress:()=>s.useReminders.getState().markDone({rid:c,reminderId:n.id,forDate:f,at:new Date(u()).toISOString(),staffRef:k,staffName:I.current.replace(' (example)','')})},{label:'Later',kind:'ghost',onPress:()=>s.useReminders.getState().setSnooze(l,u()+6e4*R.snoozeMins)}]})}};t();const h=setInterval(t,2e4);return()=>clearInterval(h)},[c,k,v,w,b])};var t=_r(_d[0]),n=_r(_d[1]),r=_r(_d[2]),s=_r(_d[3]),o=_r(_d[4]),a=_r(_d[5]),d=_r(_d[6]),c=_r(_d[7]);const u=()=>{try{return(0,c.nowFrom)(c.useStore.getState().clock).getTime()}catch{return Date.now()}},f=t=>new Date(t).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}),m=(t,n)=>{const[r,s,o]=t.split('-').map(Number);return new Date(r,s-1,o,Math.floor(n),Math.round(n%1*60)).getTime()};function l(t,n){const s=r.useOwner.getState(),a=(0,r.openShiftOf)(s.attendance,t,new Date(n)),d=(0,o.ukClock)(n).ymd,c=s.shifts.find(r=>r.staffId===t&&r.date===d&&!1!==r.published&&m(r.date,r.start)<=n&&nn.staffId===t&&n.date===d&&!1!==n.published):void 0),u=!a&&!!c&&s.attendance.some(n=>n.staffId===t&&n.date===d&&!!n.out&&new Date(n.out).getTime()>=m(c.date,c.start));return{att:a,shift:c,on:!!a||!!c&&!u}}},958,[30,1102,854,956,1107,946,1117,870]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"START_PAIR",{enumerable:!0,get:function(){return t}});const t=(()=>{try{if('undefined'==typeof window||!window.location)return null;const t=new URL(window.location.href),n=new URLSearchParams(t.hash.replace(/^#/,'')),c=t.searchParams.get('pair')||n.get('pair');if(!c)return null;t.searchParams.delete('pair'),n.delete('pair');const o=n.toString();return window.history.replaceState(null,'',t.pathname+(t.search?t.search:'')+(o?`#${o}`:'')),c}catch{return null}})()},959,[]); +__d(function(_g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PUB_LOCATIONS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"privateClockVenue",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"pubLocation",{enumerable:!0,get:function(){return s}}),e.venueClockArea=function(a,o={}){if((0,t.isQueuedVenue)(a)&&!t.queuedVenues[a].clockArea.on)return(0,n.cleanArea)({...o,on:!0===o.on&&'number'==typeof o.lat&&'number'==typeof o.lng,offRotaPrompt:!1});const l=s(a);if(!l)return(0,n.cleanArea)(o);const c=(0,n.cleanArea)({lat:l.lat,lng:l.lng,radius:150,...o});return{...c,lat:c.lat??l.lat,lng:c.lng??l.lng,on:!0,offRotaPrompt:!1}},e.venueClockGeo=l,e.privateAttendance=function(n,a){if(!o(n)&&!(0,t.isQueuedVenue)(n))return a;const s={...a};for(const t of['lat','lng','latitude','longitude','coords','position','location','acc','dist','accuracy','distance','outSite'])delete s[t];a.geo&&(s.geo=a.geo.map(t=>l(n,t)).filter(t=>!!t));return s};var t=r(d[0]),n=r(d[1]);const a={"3idiots":{name:"3 Idiots",address:"10 George Street, Ayr, KA8 0BL",lat:55.4650286,lng:-4.6283062,source:"Verified exact-address venue pack"},cecchinis:{name:"Cecchinis",address:"72 Fort Street, Wellington Square, Ayr, South Ayrshire KA7 1EH",lat:55.461505,lng:-4.6345736,source:"Verified exact-address venue pack"},williewastles:{name:"Willie Wastle's",address:"16-18 New Bridge Street, Ayr, South Ayrshire, KA7 1JX",lat:55.4646261,lng:-4.6323929,source:"Verified exact-address venue pack"},smokinggoat:{name:"Smoking Goat",address:"2A Academy Street, Ayr KA7 1HS",lat:55.464226,lng:-4.6326035,source:"Verified exact-address venue pack"},drunkencoo:{name:"The Drunken Coo",address:"22 Beresford Terrace, Ayr KA7 2EG",lat:55.4570308,lng:-4.6294663,source:"Verified exact-address venue pack"},abbotsford:{name:'The Abbotsford Hotel',address:'14 Corsehill Road, Ayr KA7 2ST',lat:55.4488797,lng:-4.6314856,source:'Official FSA1696388, exact address match verified6 Nov2026'},kirkton:{name:'The Kirkton Inn',address:'1-3 Main Street, Dalrymple, East Ayrshire KA6 6DF',lat:55.3971215,lng:-4.5920177,source:'Public FSA establishment1955433 verified6 November2026'},greenside:{name:'The Greenside Restaurant',address:'5 Greenside, Maybole, South Ayrshire KA19 7DG',lat:55.3542369,lng:-4.6851418,source:'Official Find us Google Maps link, place point, verified 6 November 2026'},kirkmichael:{name:'The Kirkmichael Arms',address:'3-5 Straiton Road, Kirkmichael, South Ayrshire KA19 7PH',lat:55.3458202,lng:-4.6180793,source:'venue-profile.json geo, matched to the venue address'},souters:{name:"Souter\u2019s Inn",address:'47 Main Road, Kirkoswald, South Ayrshire KA19 8HY',lat:55.3297218,lng:-4.7772979,source:'Food Standards Agency establishment 1863840, address matched'}},o=t=>Object.prototype.hasOwnProperty.call(a,t),s=t=>o(t)?a[t]:void 0;function l(n,a){return o(n)||(0,t.isQueuedVenue)(n)?'in'===a.action?{action:'in',at:a.at,inside:a.inside,...a.override?{override:{by:a.override.by,byId:a.override.byId,reason:a.override.reason}}:{}}:void 0:a}},987,[6,953]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.WhoBar=function(){const e=(0,n.useSignedIn)();if(!e)return null;const l=`Signed in as ${e.name.replace(' (example)','')}${e.level?` \xb7 ${e.level}`:''}`;return(0,o.jsx)(s.default,{testID:"who-bar",accessible:!0,accessibilityLabel:l,style:{paddingVertical:4},children:(0,o.jsx)(c.T,{size:18,weight:"semibold",colour:t.colours.gold,children:l})})},r(d[0]);var e,l=r(d[1]),s=(e=l)&&e.__esModule?e:{default:e},n=r(d[2]),t=r(d[3]),c=r(d[4]),o=r(d[5])},988,[30,127,926,821,813,24]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"currentScrollY",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"screenGeneration",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"restoreScroll",{enumerable:!0,get:function(){return o}}),_e.useScrollMemory=function(u){const c=(0,e.useRef)(0),o=(0,e.useRef)(0),l=(0,e.useRef)(0),s=(0,e.useRef)(0),f=(0,e.useRef)(0),v=(0,e.useRef)(null),y=(0,e.useRef)([]),h=()=>{y.current.forEach(clearTimeout),y.current=[]},b=()=>{const e=v.current;null!=e&&(u.current?.scrollTo({y:e,animated:!1}),f.current-s.current>=e-2&&(c.current=e,o.current=e,v.current=null,h()))},p=(0,e.useCallback)(e=>{if(h(),v.current=Math.max(0,e),e<=0)return v.current=null,u.current?.scrollTo({y:0,animated:!1}),c.current=0,void(o.current=0);for(const e of[0,30,80,160,320,600,1e3,1600,2500])y.current.push(setTimeout(b,e));y.current.push(setTimeout(()=>{v.current=null},2600))},[]);t={y:()=>o.current,restore:p};const R=(0,e.useCallback)(()=>{n++;return o.current},[]);return{props:{scrollEventThrottle:32,onScroll:e=>{const t=e.nativeEvent.contentOffset.y;c.current=t,s.current=e.nativeEvent.layoutMeasurement.height,f.current=e.nativeEvent.contentSize.height,Date.now()-l.current>250&&null==v.current&&(o.current=t)},onScrollBeginDrag:()=>{v.current=null,h()},onContentSizeChange:(e,t)=>{f.current=t,l.current=Date.now(),b()},onLayout:e=>{s.current=e.nativeEvent.layout.height}},restore:p,leave:R}};var e=r(d[0]);let t=null,n=0;const u=()=>t?t.y():0,c=()=>n,o=e=>t?.restore(e)},989,[30]); +__d(function(_g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useBackLayers",{enumerable:!0,get:function(){return y}}),_e.runBackLayer=function(){const e=y.getState().layers,t=e[e.length-1];return!!t&&(t.fn(),!0)},_e.useBackLayer=function(t,n,s=!0){const o=(0,e.useRef)(n);o.current=n,(0,e.useEffect)(()=>{if(!t)return;const e=++w,n=(0,l.currentScrollY)(),c=(0,l.screenGeneration)();return y.setState(t=>({layers:[...t.layers,{id:e,fn:()=>o.current(),own:s}]})),()=>{y.setState(t=>({layers:t.layers.filter(t=>t.id!==e)})),(0,l.screenGeneration)()===c&&(0,l.restoreScroll)(n)}},[t,s])},Object.defineProperty(_e,"useInnerBackShown",{enumerable:!0,get:function(){return h}}),_e.BackButton=function({onPress:e,testID:t="screen-back",label:n="Back"}){return(0,f.jsx)(s.default,{testID:t,accessibilityRole:"button",accessibilityLabel:n,onPress:e,hitSlop:8,style:({pressed:e})=>({minHeight:48,minWidth:96,justifyContent:'center',paddingRight:12,opacity:e?.6:1,alignSelf:'flex-start'}),children:(0,f.jsxs)(u.T,{size:18,weight:"semibold",colour:c.colours.gold,children:["\u2039 ",n]})})},_e.useWebBack=function(t){const n=(0,e.useRef)(t);n.current=t,(0,e.useEffect)(()=>{if('undefined'==typeof window||!window.history?.pushState)return;const e=()=>{try{window.history.pushState({...window.history.state??{},ccBack:Date.now()},'',window.location.href)}catch{}};e();const t=t=>{n.current()&&(t.stopImmediatePropagation?.(),e())};return window.addEventListener('popstate',t,!0),()=>window.removeEventListener('popstate',t,!0)},[])};var e=r(d[0]);r(d[1]);var t,n=r(d[2]),s=(t=n)&&t.__esModule?t:{default:t},o=r(d[3]),c=r(d[4]),u=r(d[5]),l=r(d[6]),f=r(d[7]);const y=(0,o.create)(()=>({layers:[]}));let w=0;const h=()=>y(e=>e.layers.some(e=>e.own))},990,[30,122,263,951,821,813,989,24]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.SoldOutList=function({rid:e,by:n,canMark:a=!0}){const f=(0,r.useSoldOut)(e=>e.entries),b=(0,i.useStore)(e=>e.clock),j=(0,i.useStore)(e=>e.menu),w=(0,i.useStore)(t=>t.restaurants.find(t=>t.id===e)),[S,I]=(0,s.useState)(''),$=(0,h.nowFrom)(b),C=(0,d.activeSoldOut)(f,e,$),D=new Set(C.map(e=>e.itemId)),M=(0,d.soldOutSettingsOf)(w?.settings?.soldOut),T=(0,u.useAutoSoldOutView)(e),L=f.filter(t=>t.rid===e&&!t.on&&t.kept&&T.reason(t.itemId)),v=(0,s.useMemo)(()=>j.filter(t=>t.restaurantId===e&&!t.hidden&&!D.has(t.id)&&(!S.trim()||t.name.toLowerCase().includes(S.trim().toLowerCase()))).sort((e,t)=>e.name.localeCompare(t.name)),[j,e,S,C.length]),B=(t,s)=>{const o=f.some(s=>s.rid===e&&s.itemId===t&&s.auto&&T.reason(t));j.some(e=>e.id===t)?(0,r.setSoldOut)(t,!1,n):r.useSoldOut.getState().back(e,t,n),x(`Back on: ${s}${o?' (kept on until the count changes)':''}`)};return(0,y.jsxs)(o.default,{testID:"soldout-list",style:{gap:10},children:[(0,y.jsx)(l.Muted,{children:"A reminder for staff. Dishes you mark sold out show on the Display and in the Sold out list in every staff app, within seconds. It doesn't change your till."}),(0,y.jsxs)(l.Card,{children:[(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'center'},wrap:!0,children:[(0,y.jsx)(l.T,{weight:"semibold",size:17,children:"Sold out now"}),(0,y.jsx)(l.T,{size:13,colour:C.length?m.colours.amber:m.colours.muted,children:C.length?(0,d.soldOutCount)(C.length):'Nothing sold out'})]}),C.length?C.map(e=>(0,y.jsxs)(o.default,{testID:`soldout-row-${e.itemId}`,style:{flexDirection:'row',flexWrap:'wrap',gap:8,justifyContent:'space-between',alignItems:'center',paddingVertical:6,borderTopWidth:1,borderTopColor:m.colours.border},children:[(0,y.jsxs)(o.default,{style:{flexShrink:1,flexGrow:1,flexBasis:160,gap:2},children:[(0,y.jsx)(l.T,{weight:"semibold",children:(0,c.withReason)(e.name,T.reason(e.itemId))}),(0,y.jsxs)(l.Muted,{children:["Since ",k(e.at),e.auto?' \xb7 Auto, from the counts \xb7 clears when the count is back up':`${e.by?` \xb7 ${e.by}`:''}${e.clearAfter?` \xb7 clears at ${k(e.clearAfter)}`:''}`]})]}),a?(0,y.jsx)(l.Button,{small:!0,kind:"secondary",label:"Back on",testID:`soldout-back-${e.itemId}`,accessibilityLabel:`Back on: ${e.name}`,onPress:()=>B(e.itemId,e.name)}):null]},e.itemId)):(0,y.jsx)(l.Muted,{children:"When a dish runs out, mark it here so everyone knows."}),L.length?(0,y.jsx)(o.default,{testID:"soldout-kept",children:(0,y.jsxs)(l.Muted,{children:["Kept on by hand while the count is short: ",L.map(e=>e.name).join(', '),". They stay on until the count changes."]})}):null,(0,y.jsxs)(l.Muted,{children:["Clears by itself: ",d.SOLD_OUT_CLEAR_LABEL[M.clear].toLowerCase(),". ",M.auto?'Dishes marked from the counts clear when the count is back up. ':'',"Managers can change this in Settings \u203a Advanced."]})]}),T.items.length?(0,y.jsx)(p,{rid:e,by:n,canEdit:a,auto:M.auto,view:T}):null,a?(0,y.jsxs)(l.Card,{children:[(0,y.jsx)(l.T,{weight:"semibold",size:17,children:"Mark a dish sold out"}),(0,y.jsx)(t.TextInput,{testID:"soldout-search",value:S,onChangeText:I,placeholder:"Find a dish",placeholderTextColor:m.colours.muted,accessibilityLabel:"Find a dish",style:{minHeight:46,borderRadius:12,borderWidth:1,borderColor:m.colours.accentBorder,backgroundColor:m.colours.surface2,color:m.colours.text,paddingHorizontal:12,fontSize:16}}),v.slice(0,60).map(e=>(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'center',paddingVertical:4},wrap:!0,children:[(0,y.jsxs)(o.default,{style:{flexShrink:1,flexGrow:1,flexBasis:160},children:[(0,y.jsx)(l.T,{children:e.name}),(0,y.jsx)(l.Muted,{children:e.section})]}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"Mark sold out",testID:`soldout-mark-${e.id}`,accessibilityLabel:`Mark sold out: ${e.name}`,onPress:()=>{return t=e.id,s=e.name,(0,r.setSoldOut)(t,!0,n),void x(`Sold out: ${s}`);var t,s}})]},e.id)),v.length?null:(0,y.jsx)(l.Muted,{children:S?'No dish matches that.':'Every dish is marked sold out.'})]}):null]})};var e,t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),o=(e=n)&&e.__esModule?e:{default:e},l=_r(_d[3]),i=_r(_d[4]),r=_r(_d[5]),a=_r(_d[6]),d=_r(_d[7]),u=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),m=_r(_d[11]),y=_r(_d[12]);const k=e=>{const t=new Date(e);return`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`},x=e=>{const t=new Date(globalThis.__ccNow??Date.now()).toISOString();for(const s of['kitchen','foh'])a.useOwner.getState().sys(s,e,t)};const f={link:'set by staff',card:'from its recipe card',description:'from its description',name:'from its name',none:''},b=e=>.5===e?'\xbd':Number.isInteger(e)?String(e):`${Math.floor(e)}\xbd`;function p({rid:e,by:t,canEdit:n,auto:i,view:r}){const[a,d]=(0,s.useState)(!1),[h,k]=(0,s.useState)(null),[x,p]=(0,s.useState)([]),j=r.dishes.filter(t=>t.uses.length||'none'===t.source&&r.links.some(s=>s.rid===e&&s.itemId===t.id&&!s.auto)),w=(a?r.dishes:j).slice().sort((e,t)=>e.name.localeCompare(t.name)),S=r.items.map(e=>`${e.name.toLowerCase()} ${b(r.counts[e.key]??0)}`).join(', '),I=(e,t,s)=>p(n=>n.map(n=>n.key===e?{...n,qty:Math.max(0,Math.min(20,n.qty+s*('half'===t.unit?.5:1)))}:n)),$=(s,n)=>{u.useSoldOutLinks.getState().setLink(e,s,n,t),k(null)};return(0,y.jsx)(o.default,{testID:"soldout-links",children:(0,y.jsxs)(l.Card,{children:[(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'center'},wrap:!0,children:[(0,y.jsx)(l.T,{weight:"semibold",size:17,children:"Dishes linked to the counts"}),(0,y.jsx)(o.default,{testID:"soldout-links-counts",children:(0,y.jsxs)(l.T,{size:13,colour:m.colours.muted,children:["Counts now: ",S]})})]}),(0,y.jsx)(l.Muted,{children:i?'When a count runs out, or drops below what a dish needs, the dish is marked sold out by itself, and put back on when the count is back up. Dishes you mark by hand are left alone.':'Marking dishes from the counts is off for this venue (Settings \u203a Advanced \u203a Sold out reminders).'}),w.map(e=>(0,y.jsxs)(o.default,{testID:`soldout-link-${e.id}`,style:{paddingVertical:6,borderTopWidth:1,borderTopColor:m.colours.border,gap:6},children:[(0,y.jsxs)(l.Row,{style:{justifyContent:'space-between',alignItems:'center'},wrap:!0,children:[(0,y.jsxs)(o.default,{style:{flexShrink:1,flexGrow:1,flexBasis:160},children:[(0,y.jsx)(l.T,{weight:"semibold",children:e.name}),(0,y.jsxs)(l.Muted,{children:[e.uses.length?`Uses ${(0,c.usesText)(e.uses,r.items)}`:'Not linked to the counts',f[e.source]?` \xb7 ${f[e.source]}`:'']})]}),n&&h!==e.id?(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"Change",testID:`soldout-link-edit-${e.id}`,accessibilityLabel:`Change what ${e.name} uses`,onPress:()=>{return t=e.id,s=e.uses,k(t),void p(r.items.map(e=>({key:e.key,qty:s.find(t=>t.key===e.key)?.qty??0})));var t,s}}):null]}),h===e.id?(0,y.jsxs)(o.default,{style:{gap:6},children:[r.items.map(t=>{const s=x.find(e=>e.key===t.key)?.qty??0;return(0,y.jsxs)(l.Row,{style:{alignItems:'center',gap:8},children:[(0,y.jsx)(l.T,{style:{flexGrow:1},children:t.name}),(0,y.jsx)(l.Button,{small:!0,kind:"secondary",label:"\u2013",testID:`soldout-link-${e.id}-${t.key}-minus`,accessibilityLabel:`Fewer ${t.plural.toLowerCase()}`,onPress:()=>I(t.key,t,-1)}),(0,y.jsx)(o.default,{testID:`soldout-link-${e.id}-${t.key}-qty`,style:{minWidth:28},children:(0,y.jsx)(l.T,{weight:"semibold",style:{textAlign:'center'},children:b(s)})}),(0,y.jsx)(l.Button,{small:!0,kind:"secondary",label:"+",testID:`soldout-link-${e.id}-${t.key}-plus`,accessibilityLabel:`More ${t.plural.toLowerCase()}`,onPress:()=>I(t.key,t,1)})]},t.key)}),(0,y.jsxs)(l.Muted,{children:["Per portion. ",x.some(e=>e.qty>0)?`Uses ${(0,c.usesText)(x.filter(e=>e.qty>0),r.items)}.`:'Not linked: never marked from the counts.']}),(0,y.jsxs)(l.Row,{style:{gap:8},wrap:!0,children:[(0,y.jsx)(l.Button,{small:!0,label:"Save",testID:`soldout-link-save-${e.id}`,onPress:()=>$(e.id,x.filter(e=>e.qty>0))}),(0,y.jsx)(l.Button,{small:!0,kind:"secondary",label:"Back to automatic",testID:`soldout-link-reset-${e.id}`,accessibilityLabel:`Back to automatic: ${e.guess.length?(0,c.usesText)(e.guess,r.items):'not linked'}`,onPress:()=>$(e.id,null)}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>k(null)})]}),(0,y.jsxs)(l.Muted,{children:["Automatic: ",e.guess.length?(0,c.usesText)(e.guess,r.items):'not linked'," (from the recipe card, description or name)."]})]}):null]},e.id)),w.length?null:(0,y.jsx)(l.Muted,{children:"No dish is linked yet."}),(0,y.jsx)(l.Button,{small:!0,kind:"ghost",label:a?'Show linked dishes only':'Link another dish',testID:"soldout-links-all",onPress:()=>d(!a)})]})})}},991,[875,30,127,813,819,917,854,943,941,942,870,821,24]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"APP_VERSION",{enumerable:!0,get:function(){return t}});const t='v0.3.12.77'},992,[]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useTasksProgress=function(e,s){const t=(0,d.useDailyTasks)(t=>t.people[(0,d.personKey)(e,s)]?.tasks)??[],i=(0,d.useDailyTasks)(e=>e.ticks),{ymd:l,dow:o}=b();return(0,r.progress)(t,i,s,l,o)},_e.DailyTasksEditor=T,_e.MyTasksToday=function({rid:e,staffId:s,name:t,onShift:c}){const u=(0,d.useDailyTasks)(t=>t.people[(0,d.personKey)(e,s)]?.tasks)??[],h=(0,d.useDailyTasks)(e=>e.ticks),{ymd:y,dow:k}=b(),p=(0,r.tasksFor)(u,k);if(!s||!p.length)return null;const T=(0,r.progress)(u,h,s,y,k);return(0,x.jsx)(l.default,{testID:"my-tasks-today",children:(0,x.jsxs)(o.Card,{children:[(0,x.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsx)(o.T,{weight:"semibold",colour:n.colours.gold,children:"My tasks today"}),(0,x.jsx)(o.Badge,{kind:T.done===T.total?'gold':'neutral',label:`${T.done} of ${T.total}`})]}),c?null:(0,x.jsx)(o.Muted,{size:12,children:"You\u2019re not on shift right now. You can still tick these when you are."}),p.map(r=>{const u=h.find(t=>t.id===(0,d.tickId)(e,s,r.id,y));return(0,x.jsxs)(i.default,{testID:`my-task-${r.id}`,accessibilityRole:"checkbox",accessibilityState:{checked:!!u},disabled:!c,onPress:()=>d.useDailyTasks.getState().toggleTick(e,s,r.id,y,{id:s,name:t.replace(' (example)','')}),style:{flexDirection:'row',alignItems:'center',gap:10,paddingVertical:8,opacity:c?1:.6},children:[(0,x.jsx)(l.default,{style:{width:24,height:24,borderRadius:6,borderWidth:1.5,borderColor:n.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:u?'#2a2414':'transparent'},children:u?(0,x.jsx)(o.T,{colour:n.colours.gold,children:"\u2713"}):null}),(0,x.jsxs)(l.default,{style:{flex:1},children:[(0,x.jsx)(o.T,{style:{textDecorationLine:u?'line-through':'none'},children:r.text}),u?(0,x.jsxs)(o.Muted,{size:12,children:["Done at ",f(u.at)]}):null]})]},r.id)}),(0,x.jsx)(o.Muted,{size:12,children:"Tip: tick each one as you finish it. Your manager sees how you\u2019re getting on. They start fresh every day."})]})})},_e.TaskLibrarySettings=function({rid:e}){(0,t.useEffect)(()=>{d.useDailyTasks.getState().ensure(e)},[e]);const i=(0,d.useDailyTasks)(s=>s.library[e]?.items)??[],[c,u]=(0,t.useState)(''),[y,p]=(0,t.useState)({}),f=d.useDailyTasks.getState(),b=s=>f.setLibrary(e,s);return(0,x.jsxs)(l.default,{style:{gap:8},testID:"task-library",children:[(0,x.jsx)(o.Muted,{size:13,children:"Tip: these are quick picks when you add someone\u2019s daily tasks (Staff & roles \u203a a person \u203a Daily tasks). You can always type a new one there too."}),i.map((e,t)=>(0,x.jsxs)(o.Row,{gap:6,style:{opacity:e.archived?.5:1},children:[(0,x.jsx)(s.TextInput,{accessibilityLabel:`Rename ${e.text}`,value:y[e.id]??e.text,onChangeText:s=>p(t=>({...t,[e.id]:s})),onBlur:()=>{const s=(0,r.cleanTaskText)(y[e.id]??'');s&&s!==e.text&&b(i.map(t=>t.id===e.id?{...t,text:s}:t))},style:{...k,flex:1,minWidth:0}}),(0,x.jsx)(o.Button,{small:!0,kind:"ghost",label:"\u2191",disabled:0===t,onPress:()=>b((0,r.move)(i,t,-1))}),(0,x.jsx)(o.Button,{small:!0,kind:"ghost",label:"\u2193",disabled:t===i.length-1,onPress:()=>b((0,r.move)(i,t,1))}),(0,x.jsx)(o.Button,{small:!0,kind:"ghost",label:e.archived?'Bring back':'Archive',onPress:()=>b(i.map(s=>s.id===e.id?{...s,archived:!s.archived}:s))})]},e.id)),(0,x.jsxs)(o.Row,{gap:6,children:[(0,x.jsx)(s.TextInput,{accessibilityLabel:"New library task",testID:"task-lib-new",value:c,onChangeText:u,placeholder:"e.g. Check the beer garden",placeholderTextColor:n.colours.muted,style:{...k,flex:1}}),(0,x.jsx)(o.Button,{small:!0,label:"Add",disabled:!(0,r.cleanTaskText)(c),onPress:()=>{b([...i,{id:(0,h.uuid)(),text:(0,r.cleanTaskText)(c)}]),u('')}})]})]})},_e.KitchenTeamTasks=function({rid:e,actor:s}){const t=(0,y.useOwner)(e=>e.staff).filter(e=>e.active&&s&&(0,r.canEditTasks)(s,e));return(0,x.jsxs)(l.default,{style:{gap:10},testID:"kitchen-team-tasks",children:[(0,x.jsx)(o.Muted,{size:13,children:"Tip: set the daily tasks for your kitchen team here. They see them as \u2018My tasks today\u2019 when they\u2019re on shift and tick them off. Your own list and front of house lists are set by a manager."}),s?null:(0,x.jsx)(o.Muted,{children:"Sign in to change your team\u2019s tasks."}),s&&!t.length?(0,x.jsx)(o.Muted,{children:"No kitchen staff found. A manager can set each person\u2019s department in Staff & roles."}):null,t.map(t=>(0,x.jsxs)(o.Card,{children:[(0,x.jsx)(o.T,{weight:"semibold",children:(0,y.staffLabel)(t).replace(' (example)','')}),(0,x.jsxs)(o.Muted,{size:12,children:[t.job,t.dept?` \xb7 ${t.dept}`:'']}),(0,x.jsx)(T,{rid:e,person:t,actor:s})]},t.id))]})};var s=_r(_d[0]),t=_r(_d[1]),i=e(_r(_d[2])),l=e(_r(_d[3])),o=_r(_d[4]),n=_r(_d[5]),d=_r(_d[6]),r=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),y=_r(_d[11]),x=_r(_d[12]);const k={minHeight:42,borderRadius:10,borderWidth:1,borderColor:n.colours.hairline,backgroundColor:n.colours.surface2,color:n.colours.text,paddingHorizontal:10,fontSize:15},p=[1,2,3,4,5,6,0],f=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}),b=(e=Date.now())=>{const s=(0,c.ukClock)(e);return{ymd:s.ymd,dow:new Date(`${s.ymd}T12:00:00Z`).getUTCDay()}};function T({rid:e,person:c,actor:h}){(0,t.useEffect)(()=>{d.useDailyTasks.getState().ensure(e)},[e]);const y=(0,d.useDailyTasks)(s=>s.people[(0,d.personKey)(e,c.id)]?.tasks)??[],T=((0,d.useDailyTasks)(s=>s.library[e]?.items)??[]).filter(e=>!e.archived),j=(0,d.useDailyTasks)(e=>e.ticks),[w,D]=(0,t.useState)(!1),[v,S]=(0,t.useState)(''),[C,$]=(0,t.useState)(null),I=d.useDailyTasks.getState(),M=(0,r.canEditTasks)(h,c),{ymd:P,dow:R}=b(),L=(0,r.progress)(y,j,c.id,P,R),B=s=>I.setTasks(e,c.id,s),z=e=>{const s=y;B(y.filter(s=>s.id!==e.id)),(0,u.notify)({id:`task-undo-${e.id}`,title:`Removed \u201c${e.text}\u201d`,timeoutMs:8e3,actions:[{label:'Undo',testID:'task-undo',onPress:()=>B(s)}]})};return(0,x.jsxs)(l.default,{testID:`tasks-${c.id}`,style:{gap:6},children:[(0,x.jsx)(i.default,{accessibilityRole:"button",testID:`tasks-open-${c.id}`,onPress:()=>D(!w),children:(0,x.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,x.jsxs)(o.T,{weight:"semibold",colour:n.colours.gold,children:["Daily tasks ",w?'\u25b4':'\u25be']}),(0,x.jsx)(o.Muted,{size:12,children:y.length?`${L.done} of ${L.total} done today`:'None yet'})]})}),w?(0,x.jsxs)(l.default,{style:{gap:6},children:[y.map((s,t)=>{const i=j.find(t=>t.id===(0,d.tickId)(e,c.id,s.id,P));return(0,x.jsxs)(l.default,{testID:`task-row-${t}`,style:{borderTopWidth:1,borderColor:n.colours.hairline,paddingTop:6,gap:4},children:[(0,x.jsxs)(o.Row,{gap:6,children:[(0,x.jsxs)(o.T,{style:{flex:1},colour:i?n.colours.gold:n.colours.text,children:[i?'\u2713 ':'',s.text]}),M?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(o.Button,{small:!0,kind:"ghost",label:"\u2191",accessibilityLabel:`Move ${s.text} up`,disabled:0===t,onPress:()=>B((0,r.move)(y,t,-1))}),(0,x.jsx)(o.Button,{small:!0,kind:"ghost",label:"\u2193",accessibilityLabel:`Move ${s.text} down`,disabled:t===y.length-1,onPress:()=>B((0,r.move)(y,t,1))}),(0,x.jsx)(o.Button,{small:!0,kind:"ghost",label:"Days",onPress:()=>$(C===s.id?null:s.id)}),(0,x.jsx)(o.Button,{small:!0,kind:"ghost",testID:`task-remove-${t}`,label:"\u2715",accessibilityLabel:`Remove ${s.text}`,onPress:()=>z(s)})]}):null]}),(0,x.jsxs)(o.Muted,{size:12,children:[s.days?.length?s.days.map(e=>r.TASK_DAY_NAMES[e]).join(', '):'Every day',i?` \xb7 ticked by ${i.byName.split(' ')[0]} at ${f(i.at)}`:'']}),C===s.id?(0,x.jsx)(o.Row,{wrap:!0,gap:4,children:p.map(e=>{const t=!!s.days?.includes(e);return(0,x.jsx)(o.Chip,{label:r.TASK_DAY_NAMES[e],selected:t,onPress:()=>B(y.map(i=>i.id===s.id?{...i,days:t?(i.days??[]).filter(s=>s!==e):[...i.days??[],e].sort()}:i))},e)})}):null]},s.id)}),M?(0,x.jsxs)(l.default,{style:{gap:6},children:[(0,x.jsx)(o.Row,{wrap:!0,gap:4,children:T.filter(e=>!y.some(s=>s.text.toLowerCase()===e.text.toLowerCase())).slice(0,12).map(s=>(0,x.jsx)(o.Chip,{testID:"task-lib-chip",label:`${s.text}`,onPress:()=>I.addTask(e,c.id,s.text,s.id)},s.id))}),(0,x.jsxs)(o.Row,{gap:6,children:[(0,x.jsx)(s.TextInput,{accessibilityLabel:"New task",testID:`task-new-${c.id}`,value:v,onChangeText:S,placeholder:"Type a task, e.g. Restock the bar fridges",placeholderTextColor:n.colours.muted,style:{...k,flex:1},onSubmitEditing:()=>{(0,r.cleanTaskText)(v)&&(I.addTask(e,c.id,v),S(''))}}),(0,x.jsx)(o.Button,{small:!0,testID:`task-add-${c.id}`,label:"Add",disabled:!(0,r.cleanTaskText)(v),onPress:()=>{I.addTask(e,c.id,v),S('')}})]})]}):(0,x.jsx)(o.Muted,{size:12,children:'staff'===h?.role?'You can\u2019t change this list.':''})]}):null]})}},993,[875,30,263,127,813,821,1105,1106,1107,946,1032,854,24]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.readBack=S,_e.ReviewSheet=I,_e.Bars=P,_e.CashCharts=M,_e.CashUpScreen=function({rid:e,today:t,canEdit:s,who:l,chartsOnly:n}){const r=(0,p.useCashSettings)(e),h=(0,p.useCashUp)(e=>e.cashUps).filter(t=>t.rid===e).sort((e,t)=>t.date.localeCompare(e.date)),m=(0,p.useCashUp)(e=>e.sales).filter(t=>t.rid===e).sort((e,t)=>t.weekStart.localeCompare(e.weekStart)),[f,x]=(0,a.useState)(null),[D,P]=(0,a.useState)(null),$=(0,w.useLockedFor)(e),[B,R]=(0,a.useState)(!1),[L,A]=(0,a.useState)(null),z=async(e,s,a,o)=>{const l=a??('cashup'===e?t:(0,y.weekStartOf)((0,y.addDaysYmd)(t,-7)));if($(e,l))return void P((0,w.lockedMessage)(e,l));const n=s?await(0,k.pickPhotos)({source:s}):[];if(s&&!n.length)return void P('No photo taken. Try again, choose one from the gallery, or type the figures by hand.');const i='cashup'===e?r.cashFields:r.salesFields;let d,u={vals:{},reader:null,note:'Type the figures from the sheet.',categories:[]};n.length&&(R(!0),P('Reading the photo\u2026'),d=await Promise.all(n.map((t,s)=>(0,k.uploadPhoto)(e,l,t,s))),u=await(0,j.readSheet)(e,d.filter(e=>!!e),i),R(!1),P(null));const c=o&&'cashup'===e?h.find(e=>e.date===l)?.vals:void 0;x({kind:e,key:l,photos:n,vals:c?{...u.vals,...c}:u.vals,categories:u.categories??[],unread:(0,y.missing)(i,u.vals),note:u.note,reader:o?'edit':u.reader,uploaded:d,only:o})},E=[0,1,2].map(e=>({label:0===e?'Today':1===e?'Yesterday':v((0,y.addDaysYmd)(t,-e)),value:(0,y.addDaysYmd)(t,-e)})),N=[0,1,2].map(e=>{const s=(0,y.weekStartOf)((0,y.addDaysYmd)(t,-7*e));return{label:0===e?'This week':1===e?'Last week':`w/c ${v(s)}`,value:s}});return(0,C.jsxs)(d.default,{testID:"cashup-screen",style:{gap:12},children:[(0,C.jsx)(u.Muted,{children:"Tip: at the end of the night, tap Take a picture of the taking sheet: the figures are filled in from the photo for you to check beside it, then Confirm. Bigger venues can Upload a spreadsheet (CSV or Excel) for one night or several. Gross takings feed Spend per head. Head Chefs can see the graphs."}),D?(0,C.jsx)(u.Banner,{kind:"info",children:D}):null,(0,C.jsx)(U,{rid:e,today:t,manage:s,who:l}),s&&!n?(0,C.jsxs)(u.Card,{highlight:c.colours.gold,children:[(0,C.jsx)(u.T,{weight:"semibold",children:"End of night cash up"}),(0,C.jsx)(i.default,{testID:"upload-cashup",accessibilityRole:"button",accessibilityLabel:"Take a picture of the taking sheet. Opens the camera; the figures are filled in for you to check.",disabled:B,onPress:()=>{z('cashup','camera')},style:({pressed:e})=>({minHeight:64,borderRadius:16,backgroundColor:e?c.colours.goldLight:c.colours.gold,alignItems:'center',justifyContent:'center',paddingHorizontal:18,opacity:B?.5:1}),children:(0,C.jsx)(u.T,{size:20,weight:"semibold",colour:c.colours.onGold,children:B?'Reading the photo\u2026':'Take a picture of the taking sheet'})}),(0,C.jsxs)(u.Row,{wrap:!0,gap:8,children:[(0,C.jsx)(u.Button,{testID:"cashup-gallery",kind:"secondary",label:"Choose from gallery",accessibilityLabel:"Choose a photo of the cash up from the gallery",onPress:()=>{z('cashup','gallery')}}),(0,C.jsx)(u.Button,{testID:"cashup-by-hand",kind:"secondary",label:"Type it in",onPress:()=>{z('cashup',null)}}),(0,C.jsx)(u.Button,{testID:"cashup-sheet",kind:"secondary",label:"Upload a spreadsheet",accessibilityLabel:"Upload a spreadsheet of takings, CSV or Excel, for one night or several",onPress:async()=>{const e=await(0,b.pickSpreadsheet)();e&&('error'in e?P(e.error):A(e))}}),(0,C.jsx)(u.Button,{testID:"cashup-takings",kind:"secondary",label:"Enter takings",accessibilityLabel:"Enter tonight's takings: gross, and food and drink if you have them",onPress:()=>{z('cashup',null,t,y.TAKINGS_KEYS)}})]}),(0,C.jsx)(u.T,{weight:"semibold",style:{marginTop:8},children:"Weekly sales report"}),(0,C.jsxs)(u.Row,{wrap:!0,gap:8,children:[(0,C.jsx)(u.Button,{testID:"upload-sales",label:"Upload weekly sales report",onPress:()=>{z('sales','camera')}}),(0,C.jsx)(u.Button,{testID:"sales-gallery",kind:"secondary",label:"Choose from gallery",onPress:()=>{z('sales','gallery')}}),(0,C.jsx)(u.Button,{testID:"sales-by-hand",kind:"secondary",label:"Type it in",onPress:()=>{z('sales',null)}})]}),(0,C.jsx)(u.Muted,{children:"Several pages? Pick them all at once. Fields can be changed in Settings \u203a Advanced \u203a Cash up."})]}):null,(0,C.jsx)(M,{rid:e,today:t}),(0,C.jsxs)(u.Card,{children:[(0,C.jsx)(u.T,{weight:"semibold",children:"Recent cash ups"}),h.length?h.slice(0,10).map(e=>(0,C.jsxs)(d.default,{testID:`cashup-row-${e.date}`,style:{paddingVertical:6,borderTopWidth:1,borderTopColor:'rgba(255,255,255,0.06)',gap:2},children:[(0,C.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsx)(u.T,{weight:"semibold",children:v(e.date)}),(0,C.jsx)(u.T,{colour:c.colours.goldLight,children:T((0,y.takings)(e.vals))})]}),(0,C.jsx)(u.Muted,{children:r.cashFields.filter(e=>'text'!==e.kind&&'card'!==e.key&&'cash'!==e.key).map(t=>`${t.label} ${(0,y.isBlank)(e.vals[t.key])?'\u2014':'money'===t.kind?T(e.vals[t.key]):e.vals[t.key]}`).join(' \xb7 ')}),(0,C.jsxs)(u.Muted,{children:["Confirmed by ",e.confirmedBy??'\u2014',e.photos.length?` \xb7 ${e.photos.length} photo${e.photos.length>1?'s':''}`:'']}),s&&!$('cashup',e.date)?(0,C.jsxs)(u.Row,{gap:6,children:[(0,C.jsx)(u.Button,{small:!0,kind:"ghost",label:"Edit",onPress:()=>x({kind:'cashup',key:e.date,photos:e.photos,vals:e.vals,categories:[],unread:[],note:'',reader:'edit'})}),(0,C.jsx)(u.Button,{small:!0,kind:"ghost",testID:`takings-edit-${e.date}`,label:null==(0,y.grossOf)(e.vals)?'Add takings':'Edit takings',onPress:()=>x({kind:'cashup',key:e.date,photos:[],vals:e.vals,categories:[],unread:[],note:'',reader:'edit',only:y.TAKINGS_KEYS})})]}):null,s?(0,C.jsx)(w.CashLockControls,{kind:"cashup",item:e,label:v(e.date)}):null]},e.id)):(0,C.jsx)(u.Muted,{children:"None yet."})]}),(0,C.jsxs)(u.Card,{children:[(0,C.jsx)(u.T,{weight:"semibold",children:"Weekly sales reports"}),m.length?m.slice(0,8).map(e=>(0,C.jsxs)(d.default,{style:{paddingVertical:6,borderTopWidth:1,borderTopColor:'rgba(255,255,255,0.06)'},children:[(0,C.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsxs)(u.T,{weight:"semibold",children:["w/c ",v(e.weekStart)]}),(0,C.jsx)(u.T,{colour:c.colours.goldLight,children:T('number'==typeof e.vals.net?e.vals.net:null)})]}),(0,C.jsx)(u.Muted,{children:r.salesFields.filter(e=>'net'!==e.key).map(t=>`${t.label} ${(0,y.isBlank)(e.vals[t.key])?'\u2014':'money'===t.kind?T(e.vals[t.key]):e.vals[t.key]}`).join(' \xb7 ')}),s?(0,C.jsx)(w.CashLockControls,{kind:"sales",item:e,label:`w/c ${v(e.weekStart)}`}):null]},e.id)):(0,C.jsx)(u.Muted,{children:"None yet."})]}),L?(0,C.jsx)(b.SpreadsheetImport,{rid:e,file:L,who:l,locked:e=>$('cashup',e),onClose:()=>A(null),onSaved:e=>{P(e),A(null)}}):null,f?(0,C.jsx)(I,{draft:f,fields:'cashup'===f.kind?r.cashFields:r.salesFields,onClose:()=>x(null),onConfirm:async(t,s)=>{if(!f)return;if($(f.kind,f.key))return P((0,w.lockedMessage)(f.kind,f.key)),void x(null);const a=f.uploaded&&f.uploaded.length===f.photos.length?f.uploaded:await Promise.all(f.photos.map((e,t)=>(0,k.uploadPhoto)(f.kind,f.key,e,t))),n=f.photos.map((e,t)=>a[t]??e),r=(new Date).toISOString();if('cashup'===f.kind){const s=h.find(e=>e.date===f.key),a=f.only&&s?{...s.vals,...t}:t;p.useCashUp.getState().saveCashUp({rid:e,date:f.key,vals:a,photos:f.only&&s?s.photos:n,confirmedBy:l.name,confirmedAt:r,readBy:f.reader});const i=(0,y.combinedTips)(a),d=S(a);P(`Cash up for ${v(f.key)} saved${d?`: ${d}`:''}${null==i||f.only?'':`. Today\u2019s tips (${T(i)}) are now showing in the staff apps`}.`);try{o.default.announceForAccessibility?.(`Saved. ${d}`)}catch{}}else p.useCashUp.getState().saveSales({rid:e,weekStart:f.key,vals:t,categories:s,photos:n,confirmedBy:l.name,confirmedAt:r,readBy:f.reader}),P(`Weekly sales for the week of ${v(f.key)} saved.`);a.some(e=>null==e)&&f.photos.length&&P(e=>`${e??''} The photo is kept on this device only (not signed in or offline).`),x(null)},keyLabel:'cashup'===f.kind?'Day':'Week starting',keyChoices:'cashup'===f.kind?E:N,onKey:e=>x({...f,key:e})},`${f.kind}-${f.photos.length}`):null]})},_e.TodaysTipsCard=function({rid:e,today:t,big:s}){const a=(0,p.useTipsShow)(e),o=(0,p.useCashUp)(e=>e.tips).filter(s=>s.rid===e&&(s.date===t||s.date===(0,y.addDaysYmd)(t,-1))).sort((e,t)=>t.date.localeCompare(e.date))[0],l=R(o?.total??0);return a.showToday&&o?(0,C.jsx)(u.Card,{highlight:c.colours.gold,children:(0,C.jsxs)(d.default,{testID:"todays-tips",style:{flexDirection:'row',alignItems:'center',gap:14},children:[(0,C.jsx)($,{n:Math.ceil(o.total/25)}),(0,C.jsxs)(d.default,{style:{flex:1,gap:2},children:[(0,C.jsx)(u.T,{size:12,weight:"semibold",colour:c.colours.gold,style:{letterSpacing:1.5},children:o.date===t?'TODAY\u2019S TIPS':'LAST NIGHT\u2019S TIPS'}),(0,C.jsx)(u.T,{size:s?40:32,weight:"bold",colour:c.colours.goldLight,children:T(l)}),(0,C.jsxs)(u.Muted,{children:["Cash + card tips for the whole team \xb7 ",v(o.date),". Thank you, everyone."]})]})]})}):null},_e.TipsPotCard=U,_e.useTipsPosted=function(e,t,s=!0){const o=(0,p.useCashUp)(e=>e.tips),l=(0,p.useTipsShow)(e);(0,a.useEffect)(()=>{if(!s||!l.showToday)return;const a=o.filter(s=>s.rid===e&&s.date>=(0,y.addDaysYmd)(t,-1)&&s.date<=t).sort((e,t)=>t.date.localeCompare(e.date))[0];if(!a)return;const n=`${e}:${a.date}`;p.useCashUp.getState().seen[n]!==a.total&&(p.useCashUp.getState().markSeen(n,a.total),(0,x.notify)({id:`tips-${n}`,icon:'\ud83e\ude99',kicker:'TIPS',title:`${a.date===t?'Today\u2019s':'Last night\u2019s'} tips: ${T(a.total)}`,body:'Cash + card tips for the whole team. Added to the Tips pot. Thank you, everyone.',testID:'tips-notice',timeoutMs:12e3,actions:[{label:'Nice',testID:'tips-notice-ok',onPress:()=>{}}]}))},[e,t,o,l.showToday,s])},_e.CashUpSettings=function({rid:e}){const t=(0,p.useCashSettings)(e),a=(t,s)=>p.useCashUp.getState().setFields(e,t,s),o=(e,o)=>(0,C.jsxs)(d.default,{style:{gap:6},children:[(0,C.jsx)(u.T,{weight:"semibold",children:o}),t[e].map((o,l)=>(0,C.jsxs)(u.Row,{gap:6,children:[(0,C.jsx)(s.TextInput,{testID:`cf-${e}-${o.key}`,value:o.label,onChangeText:s=>a(e,t[e].map((e,t)=>t===l?{...e,label:s.slice(0,40)}:e)),style:{flex:1,minHeight:38,borderRadius:8,borderWidth:1,borderColor:'rgba(255,255,255,0.15)',color:c.colours.text,paddingHorizontal:8}}),(0,C.jsx)(u.Muted,{children:'money'===o.kind?'\xa3':'number'===o.kind?'#':'text'}),o.fixed?(0,C.jsx)(u.Muted,{children:"needed"}):(0,C.jsx)(u.Button,{small:!0,kind:"ghost",label:"\u2715",accessibilityLabel:`Remove ${o.label}`,onPress:()=>a(e,t[e].filter((e,t)=>t!==l))})]},o.key)),(0,C.jsxs)(u.Row,{gap:6,children:[(0,C.jsx)(u.Button,{small:!0,kind:"secondary",label:"Money figure",onPress:()=>a(e,[...t[e],{key:`f${Date.now().toString(36)}`,label:'New figure',kind:'money'}])}),(0,C.jsx)(u.Button,{small:!0,kind:"secondary",label:"Number",onPress:()=>a(e,[...t[e],{key:`n${Date.now().toString(36)}`,label:'New number',kind:'number'}])})]})]});return(0,C.jsxs)(d.default,{testID:"cashup-settings",style:{gap:12},children:[(0,C.jsx)(u.Muted,{children:"Tip: match these to the boxes on your paper cash up sheet and till printout. Cash tips total and Card tips total are needed for Today\u2019s tips and the Tips pot."}),o('cashFields','Cash up sheet'),o('salesFields','Weekly sales report')]})},_e.TipsSettings=function({rid:e}){const t=(0,p.useTipsShow)(e);return(0,C.jsxs)(d.default,{testID:"tips-settings",style:{gap:8},children:[(0,C.jsx)(u.Muted,{children:"Staff only ever see the team total: never anyone\u2019s share or pay. The Display never shows tips or money."}),(0,C.jsx)(u.Toggle,{testID:"tips-show-today",label:"Show Today\u2019s tips in the staff apps",value:t.showToday,onChange:t=>p.useCashUp.getState().setShow(e,{showToday:t})}),(0,C.jsx)(u.Toggle,{testID:"tips-show-pot",label:"Show the Tips pot in the staff apps",value:t.showPot,onChange:t=>p.useCashUp.getState().setShow(e,{showPot:t})})]})};var t=_r(_d[0]),s=_r(_d[1]),a=_r(_d[2]),o=e(_r(_d[3])),l=e(_r(_d[4])),n=e(_r(_d[5])),r=e(_r(_d[6])),i=e(_r(_d[7])),d=e(_r(_d[8])),h=e(_r(_d[9])),u=_r(_d[10]),c=_r(_d[11]),p=_r(_d[12]),y=_r(_d[13]),m=_r(_d[14]),f=_r(_d[15]),x=_r(_d[16]),k=_r(_d[17]),j=_r(_d[18]),b=_r(_d[19]),w=_r(_d[20]),C=_r(_d[21]);const T=e=>null==e?'\u2014':`\xa3${e.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`,v=e=>new Date(`${e}T12:00:00Z`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',timeZone:'UTC'});function S(e){const t=t=>'number'==typeof e[t]?e[t]:null,s=(0,y.combinedTips)(e);return[['Gross',t('gross')],['card',t('card')],['cash',t('cash')],['tips',s],['food',t('food')],['drink',t('drink')]].filter(([,e])=>null!=e).map(([e,t])=>`${e} ${T(t)}`).join(', ')}function D({p:e,h:s}){const[o,l]=(0,a.useState)(e.startsWith('data:')?e:null);return(0,a.useEffect)(()=>{o||(0,k.photoUrl)(e).then(l)},[e]),o?(0,C.jsx)(r.default,{source:{uri:o},style:{width:'100%',height:s,borderRadius:10,backgroundColor:(0,t.soutersSurface)('#111')},resizeMode:"contain"}):(0,C.jsx)(d.default,{style:{height:s,borderRadius:10,backgroundColor:(0,t.soutersSurface)('#1B1A18'),alignItems:'center',justifyContent:'center'},children:(0,C.jsx)(u.Muted,{children:"Photo"})})}function I({draft:e,fields:t,onClose:o,onConfirm:l,keyLabel:n,onKey:r,keyChoices:i}){const{width:p,height:m}=(0,h.default)(),f=p>=820;e.only&&(t=t.filter(t=>e.only.includes(t.key)));const[x,k]=(0,a.useState)(()=>Object.fromEntries(t.map(t=>[t.key,(0,y.isBlank)(e.vals[t.key])?'':String(e.vals[t.key])]))),[j,b]=(0,a.useState)(()=>e.categories.map(e=>({name:e.name,amount:String(e.amount)}))),[w,T]=(0,a.useState)(!1),v=Object.fromEntries(t.map(e=>[e.key,'text'===e.kind?x[e.key]?.trim()||null:(0,y.parseAmount)(x[e.key]??'',e.kind)])),S=t.filter(e=>'text'!==e.kind&&(x[e.key]??'').trim()&&null==v[e.key]).map(e=>e.key),I=(0,y.missing)(t,v),P=j.map(e=>({name:e.name.trim(),amount:(0,y.parseAmount)(e.amount)})).filter(e=>e.name),M=P.some(e=>null==e.amount),$=e=>({minHeight:42,borderRadius:10,borderWidth:e?2:1,borderColor:e?c.colours.amber:'rgba(255,255,255,0.15)',backgroundColor:e?'rgba(232,168,56,0.08)':'#141312',color:c.colours.text,paddingHorizontal:10,fontSize:17}),B=(0,C.jsx)(d.default,{testID:"review-photos",style:{gap:8,flex:f?1:void 0},children:e.photos.length?e.photos.map((t,s)=>(0,C.jsx)(D,{p:t,h:f?Math.max(300,.62*m/Math.min(2,e.photos.length)):260},s)):(0,C.jsx)(u.Muted,{children:"No photo: typed by hand."})}),R=(0,C.jsxs)(d.default,{testID:"review-fields",style:{gap:8,flex:f?1:void 0},children:[(0,C.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,C.jsx)(u.Muted,{children:n}),i.map(t=>(0,C.jsx)(u.Chip,{label:t.label,selected:e.key===t.value,onPress:()=>r(t.value)},t.value))]}),t.map(e=>{const t='text'!==e.kind&&!(x[e.key]??'').trim()||S.includes(e.key);return(0,C.jsxs)(d.default,{style:{gap:3},children:[(0,C.jsxs)(u.Row,{gap:6,children:[(0,C.jsx)(u.T,{weight:"semibold",size:14,children:e.label}),t&&'text'!==e.kind?(0,C.jsx)(u.Badge,{kind:"amber",label:S.includes(e.key)?'Check this':'Not read: type it'}):null]}),(0,C.jsx)(s.TextInput,{testID:`review-${e.key}`,value:x[e.key]??'',onChangeText:t=>k(s=>({...s,[e.key]:t})),keyboardType:'text'===e.kind?'default':'decimal-pad',placeholder:'money'===e.kind?'\xa3':'number'===e.kind?'Number':'Optional',placeholderTextColor:"#777",style:$(t)})]},e.key)}),'sales'===e.kind?(0,C.jsxs)(d.default,{testID:"review-categories",style:{gap:6},children:[(0,C.jsx)(u.T,{weight:"semibold",size:14,children:"Sales by category (if the printout has them)"}),j.map((e,t)=>(0,C.jsxs)(u.Row,{gap:6,children:[(0,C.jsx)(s.TextInput,{value:e.name,onChangeText:e=>b(s=>s.map((s,a)=>a===t?{...s,name:e}:s)),placeholder:"e.g. Food",placeholderTextColor:"#777",style:[$(!1),{flex:2}]}),(0,C.jsx)(s.TextInput,{value:e.amount,onChangeText:e=>b(s=>s.map((s,a)=>a===t?{...s,amount:e}:s)),placeholder:"\xa3",placeholderTextColor:"#777",keyboardType:"decimal-pad",style:[$(!e.amount.trim()||null==(0,y.parseAmount)(e.amount)),{flex:1}]}),(0,C.jsx)(u.Button,{small:!0,kind:"ghost",label:"\u2715",accessibilityLabel:"Remove category",onPress:()=>b(e=>e.filter((e,s)=>s!==t))})]},t)),(0,C.jsx)(u.Button,{small:!0,kind:"secondary",testID:"review-add-cat",label:"Add a category",onPress:()=>b(e=>[...e,{name:'',amount:''}])})]}):null]});return(0,C.jsxs)(u.Sheet,{visible:!0,onClose:o,title:'cashup'===e.kind?'Check the cash up':'Check the weekly sales',maxWidth:1100,testID:"review-sheet",children:[(0,C.jsx)(u.Muted,{children:"Tip: check each figure against the photo. Nothing is saved until you tap Confirm. Amber boxes weren\u2019t read: type them, or leave them blank if the sheet doesn\u2019t have them."}),'edit'===e.reader||e.only?null:e.reader?(0,C.jsx)(u.Banner,{kind:"info",title:"Read from the photo",children:e.note}):e.photos.length?(0,C.jsx)(u.Banner,{kind:"info",title:"Type it from the photo",children:e.note}):null,f?(0,C.jsxs)(d.default,{style:{flexDirection:'row',gap:14},children:[B,R]}):(0,C.jsxs)(C.Fragment,{children:[B,R]}),I.length?(0,C.jsxs)(u.Muted,{children:[I.length," figure",1===I.length?'':'s'," still blank. Blank means \u201cnot on the sheet\u201d, never zero."]}):null,(0,C.jsxs)(u.Row,{gap:8,children:[(0,C.jsx)(u.Button,{testID:"review-confirm",label:w?'Saving\u2026':'Confirm and save',disabled:w||!!S.length||M||!t.some(e=>'text'!==e.kind&&null!=v[e.key]),onPress:async()=>{T(!0),await l(v,P.map(e=>({name:e.name,amount:e.amount}))),T(!1)}}),(0,C.jsx)(u.Button,{kind:"secondary",label:"Cancel",onPress:o})]})]})}function P({data:e,height:t=140,testID:s,fmt:a=T}){const o=Math.max(1,...e.map(e=>e.value??0));return(0,C.jsxs)(d.default,{testID:s,style:{gap:4},children:[(0,C.jsx)(d.default,{style:{flexDirection:'row',alignItems:'flex-end',gap:4,height:t},children:e.map((e,s)=>(0,C.jsxs)(d.default,{style:{flex:1,alignItems:'center',justifyContent:'flex-end',height:t},children:[null!=e.value?(0,C.jsx)(u.T,{size:9,colour:c.colours.muted,children:a(e.value).replace('.00','')}):null,(0,C.jsx)(d.default,{style:{width:'80%',height:null==e.value?2:Math.max(3,e.value/o*(t-16)),borderRadius:4,backgroundColor:null==e.value?'#333':e.hi?c.colours.goldLight:c.colours.gold,opacity:null==e.value?.6:1}})]},s))}),(0,C.jsx)(d.default,{style:{flexDirection:'row',gap:4},children:e.map((e,t)=>(0,C.jsx)(u.T,{size:9,colour:c.colours.muted,style:{flex:1,textAlign:'center'},children:e.label},t))})]})}function M({rid:e,today:s}){const a=(0,p.useCashUp)(e=>e.cashUps).filter(t=>t.rid===e),o=(0,p.useCashUp)(e=>e.sales).filter(t=>t.rid===e),l=(0,y.dailySeries)(a,s,14),n=(0,y.dailySeries)(a,s,14,y.combinedTips),r=(0,y.weekStartOf)(s),i=Array.from({length:8},(e,t)=>(0,y.addDaysYmd)(r,7*(t-7))).map(e=>{const t=o.find(t=>t.weekStart===e&&t.confirmedAt),s=t?.vals.net;return{label:v(e).split(' ').slice(1).join(' '),value:'number'==typeof s?s:null,hi:e===r}}),h=[...o].filter(e=>e.confirmedAt).sort((e,t)=>t.weekStart.localeCompare(e.weekStart))[0],m=h?(0,y.weekCompare)(o,h.weekStart):null,f=h?.categories??[],x=Math.max(1,...f.map(e=>e.amount)),k=h?(0,y.weekCompare)(o,h.weekStart,'covers'):null;return(0,C.jsxs)(d.default,{testID:"cash-charts",style:{gap:12},children:[(0,C.jsxs)(u.Card,{children:[(0,C.jsx)(u.T,{weight:"semibold",children:"Takings, last 14 days"}),(0,C.jsx)(u.Muted,{children:"Card + cash from confirmed cash ups. A grey line means no cash up that day."}),(0,C.jsx)(P,{testID:"chart-daily",data:l.map(e=>({label:v(e.date).split(' ')[1],value:e.value,hi:e.date===s}))})]}),(0,C.jsxs)(u.Card,{children:[(0,C.jsx)(u.T,{weight:"semibold",children:"Tips, last 14 days"}),(0,C.jsx)(u.Muted,{children:"Cash + card tips, team total."}),(0,C.jsx)(P,{testID:"chart-tips",height:100,data:n.map(e=>({label:v(e.date).split(' ')[1],value:e.value,hi:e.date===s}))})]}),(0,C.jsxs)(u.Card,{children:[(0,C.jsx)(u.T,{weight:"semibold",children:"Weekly net sales"}),m&&null!=m.now?(0,C.jsx)(d.default,{testID:"week-compare",children:(0,C.jsxs)(u.T,{size:15,children:["Week of ",v(h.weekStart),": ",T(m.now),null!=m.prev?` \xb7 week before ${T(m.prev)}`:'',null!=m.change?` \xb7 ${m.change>=0?'\u25b2':'\u25bc'} ${Math.abs(m.change)}%`:'']})}):(0,C.jsx)(u.Muted,{children:"No weekly sales report yet."}),k&&null!=k.now?(0,C.jsxs)(u.Muted,{children:["Covers ",k.now,null!=k.prev?` (week before ${k.prev})`:'']}):null,(0,C.jsx)(P,{testID:"chart-weekly",data:i})]}),f.length?(0,C.jsxs)(u.Card,{children:[(0,C.jsxs)(u.T,{weight:"semibold",children:["By category, week of ",v(h.weekStart)]}),(0,C.jsx)(d.default,{testID:"chart-categories",style:{gap:6},children:f.map(e=>(0,C.jsxs)(d.default,{style:{gap:2},children:[(0,C.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,C.jsx)(u.T,{size:14,children:e.name}),(0,C.jsx)(u.T,{size:14,colour:c.colours.goldLight,children:T(e.amount)})]}),(0,C.jsx)(d.default,{style:{height:10,borderRadius:5,backgroundColor:(0,t.soutersSurface)('#2A2826')},children:(0,C.jsx)(d.default,{style:{width:e.amount/x*100+"%",height:10,borderRadius:5,backgroundColor:c.colours.gold}})})]},e.name))})]}):null]})}function $({n:e,testID:t}){const s=Math.max(1,Math.min(14,e));return(0,C.jsx)(d.default,{testID:t,style:{width:64,height:114,justifyContent:'flex-end'},children:Array.from({length:s}).map((e,t)=>(0,C.jsx)(B,{delay:50*t},t))})}function B({delay:e}){const t=(0,a.useRef)(new l.default.Value(1)).current;return(0,a.useEffect)(()=>{l.default.timing(t,{toValue:0,duration:420,delay:e,easing:n.default.out(n.default.back(1.6)),useNativeDriver:!1}).start()},[]),(0,C.jsx)(l.default.View,{style:{height:7,transform:[{translateY:t.interpolate({inputRange:[0,1],outputRange:[0,-120]})}],opacity:t.interpolate({inputRange:[0,1],outputRange:[1,0]})},children:(0,C.jsx)(d.default,{style:{width:60,height:12,borderRadius:30,backgroundColor:c.colours.gold,borderWidth:1,borderColor:c.colours.goldLight}})})}function R(e){const[t,s]=(0,a.useState)(e),o=(0,a.useRef)(e);return(0,a.useEffect)(()=>{const t=o.current,a=e;if(t===a)return;const l=Date.now(),n=setInterval(()=>{const e=Math.min(1,(Date.now()-l)/1200);s(Math.round(100*(t+(a-t)*(1-Math.pow(1-e,3))))/100),e>=1&&(clearInterval(n),o.current=a)},40);return()=>clearInterval(n)},[e]),t}function U({rid:e,today:t,manage:s,who:o,big:l}){const n=(0,p.useTipsShow)(e),r=(0,p.useCashUp)(e=>e.tips).filter(t=>t.rid===e),i=(0,p.useCashUp)(e=>e.pot).filter(t=>t.rid===e),h=(0,f.useVenuePay)(e).pay,x=(0,m.tipsPeriod)(h,t),k=(0,a.useMemo)(()=>(0,y.tipsPot)(r,i,x.start,t),[r,i,x.start,t]),j=R(k.total),[b,w]=(0,a.useState)(null);return n.showPot||s?(0,C.jsxs)(u.Card,{highlight:c.colours.gold,children:[(0,C.jsxs)(d.default,{testID:"tips-pot",style:{flexDirection:'row',alignItems:'center',gap:14},children:[(0,C.jsx)($,{n:Math.ceil(k.total/100),testID:"tips-pot-coins"},k.total),(0,C.jsxs)(d.default,{style:{flex:1,gap:2},children:[(0,C.jsx)(u.T,{size:12,weight:"semibold",colour:c.colours.gold,style:{letterSpacing:1.5},children:"TIPS POT"}),(0,C.jsx)(u.T,{size:l?40:32,weight:"bold",colour:c.colours.goldLight,children:T(j)}),(0,C.jsxs)(u.Muted,{children:["Tips held for the team since ",v(k.from),x.payday?` \xb7 next tip payday ${v(x.payday)}`:'',". Confirmed cash ups only.",n.showPot?'':' (Hidden from staff.)']})]})]}),s?(0,C.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,C.jsx)(u.Button,{small:!0,kind:"secondary",testID:"pot-payout",label:"Mark payout done",onPress:()=>w('payout')}),(0,C.jsx)(u.Button,{small:!0,kind:"ghost",testID:"pot-correct",label:"Correct an entry",onPress:()=>w('correct')}),(0,C.jsx)(u.Button,{small:!0,kind:"ghost",testID:"pot-history",label:"Past pots",onPress:()=>w('history')})]}):null,'payout'===b?(0,C.jsxs)(u.Sheet,{visible:!0,onClose:()=>w(null),title:"Mark payout done",maxWidth:520,testID:"pot-payout-sheet",children:[(0,C.jsxs)(u.T,{children:["Pay out ",T(k.total)," (tips from ",v(k.from)," to ",v(t),")?"]}),(0,C.jsx)(u.Muted,{children:"The pot goes back to \xa30.00 for the next period. This is logged and kept in Past pots. No money is moved by the app."}),(0,C.jsx)(u.Button,{testID:"pot-payout-confirm",label:"Yes, payout done",onPress:()=>{p.useCashUp.getState().addPotEvent({rid:e,kind:'payout',throughDate:t,amount:k.total,by:o?.name??'Manager'}),w(null)}})]}):null,'correct'===b?(0,C.jsx)(L,{rid:e,today:t,who:o,onClose:()=>w(null)}):null,'history'===b?(0,C.jsxs)(u.Sheet,{visible:!0,onClose:()=>w(null),title:"Past pots and corrections",maxWidth:560,testID:"pot-history-sheet",children:[k.history.length||i.some(e=>'correction'===e.kind)?null:(0,C.jsx)(u.Muted,{children:"No payouts or corrections yet."}),i.slice().sort((e,t)=>t.at.localeCompare(e.at)).map(e=>(0,C.jsxs)(d.default,{style:{paddingVertical:4},children:[(0,C.jsx)(u.T,{weight:"semibold",children:'payout'===e.kind?`Paid out ${T(e.amount)}`:`Correction ${e.amount>=0?'+':'\u2212'}${T(Math.abs(e.amount))} for ${v(e.forDate)}`}),(0,C.jsxs)(u.Muted,{children:['payout'===e.kind?`Tips to ${v(e.throughDate)}`:`\u201c${e.reason}\u201d`," \xb7 ",e.by," \xb7 ",new Date(e.at).toLocaleString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})]})]},e.id))]}):null]}):null}function L({rid:e,today:o,who:l,onClose:n}){const[r,i]=(0,a.useState)(o),[d,h]=(0,a.useState)(''),[m,f]=(0,a.useState)(''),x=(0,y.parseAmount)(d),k={minHeight:42,borderRadius:10,borderWidth:1,borderColor:'rgba(255,255,255,0.15)',backgroundColor:(0,t.soutersSurface)('#141312'),color:c.colours.text,paddingHorizontal:10,fontSize:16};return(0,C.jsxs)(u.Sheet,{visible:!0,onClose:n,title:"Correct an entry",maxWidth:520,testID:"pot-correct-sheet",children:[(0,C.jsx)(u.Muted,{children:"Tip: add or take off an amount for a day (use a minus for less, e.g. -5). Every correction is logged with your name and the reason."}),(0,C.jsx)(u.Row,{wrap:!0,gap:6,children:[0,1,2,3].map(e=>{const t=(0,y.addDaysYmd)(o,-e);return(0,C.jsx)(u.Chip,{label:0===e?'Today':v(t),selected:r===t,onPress:()=>i(t)},t)})}),(0,C.jsx)(s.TextInput,{testID:"pot-correct-amount",value:d,onChangeText:h,placeholder:"\xa3 e.g. -5.00",placeholderTextColor:"#777",keyboardType:"numbers-and-punctuation",style:k}),(0,C.jsx)(s.TextInput,{testID:"pot-correct-reason",value:m,onChangeText:f,placeholder:"Reason (required)",placeholderTextColor:"#777",maxLength:200,style:k}),(0,C.jsx)(u.Button,{testID:"pot-correct-save",label:"Save correction",disabled:null==x||0===x||!m.trim(),onPress:()=>{p.useCashUp.getState().addPotEvent({rid:e,kind:'correction',forDate:r,amount:x,reason:m.trim(),by:l?.name??'Manager'}),n()}})]})}},994,[912,875,30,118,120,224,196,263,127,287,813,821,1092,1108,1109,1110,946,1280,1284,1285,1288,24]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useCashAccess",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"hasCashUpAccess",{enumerable:!0,get:function(){return n}});const t=(0,r(d[0]).create)(()=>({byRef:{},mine:null,loaded:!1})),n=()=>!0===t.getState().mine},995,[951]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"fmtDate",{enumerable:!0,get:function(){return m}}),_e.SignOffLine=b,_e.CardView=w,_e.CardEditor=I,_e.RecipeCards=function({rid:e,actor:n,mode:d}){const f=(0,o.useRecipeCards)(e),[j,b]=(0,t.useState)(''),[C,k]=(0,t.useState)([]),[D,v]=(0,t.useState)('free-from'),[T,S]=(0,t.useState)('all'),[B,$]=(0,t.useState)(null),[P,R]=(0,t.useState)(null),L='edit'===d&&(0,h.canEditCards)(n.role),A=L?f:f.filter(e=>!!e.signOff),M=(0,t.useMemo)(()=>{const e='all'===T?A:A.filter(e=>(0,h.cardState)(e)===T);return(0,h.filterCards)(e,j,C,D).slice().sort((e,s)=>e.section.localeCompare(s.section)||e.dish.localeCompare(s.dish))},[A,j,C,D,T]),E=f.filter(e=>!e.signOff).length,N=B?f.find(e=>e.id===B):void 0,O=P&&'new'!==P?f.find(e=>e.id===P)??null:null,H=e=>k(s=>s.includes(e)?s.filter(s=>s!==e):[...s,e]);return(0,p.jsxs)(l.default,{testID:"recipe-cards",style:{gap:12},children:['read'===d?(0,p.jsx)(a.Banner,{kind:"info",title:"Read-only",children:"Signed-off recipe cards only. The head chef keeps these up to date."}):(0,p.jsx)(a.Muted,{children:(0,h.canSignOffCards)(n.role)?'You can add, edit and sign off cards. A card only goes live once you sign it off; any edit sets it back to Awaiting sign-off.':'You can add and edit cards. The head chef signs them off before they go live; any edit sets a card back to Awaiting sign-off.'}),f.some(e=>'example'===e.origin)?(0,p.jsx)(a.Banner,{kind:"example",title:"Example data",children:"Cards marked \u201cExample data\u201d are made-up examples to show how recipe cards work. Replace them with your own dishes."}):null,L?(0,p.jsx)(a.Button,{testID:"new-card",label:"New recipe card",onPress:()=>R('new')}):null,(0,p.jsx)(s.TextInput,{testID:"card-search",accessibilityLabel:"Search recipe cards",value:j,onChangeText:b,placeholder:"Search dishes or ingredients",placeholderTextColor:"#7D776C",style:a.styles.input}),(0,p.jsxs)(a.Row,{gap:6,wrap:!0,children:[(0,p.jsx)(a.T,{size:r.font.small,colour:r.colours.muted,children:"Allergens:"}),(0,p.jsx)(a.Chip,{label:"Free from",selected:'free-from'===D,onPress:()=>v('free-from')}),(0,p.jsx)(a.Chip,{label:"Contains",selected:'contains'===D,onPress:()=>v('contains')}),C.length?(0,p.jsx)(a.Chip,{label:"Clear",onPress:()=>k([])}):null]}),(0,p.jsx)(a.Row,{gap:6,wrap:!0,children:c.ALLERGENS.map(e=>(0,p.jsx)(i.default,{testID:`filter-${e.id}`,accessibilityRole:"button",accessibilityState:{selected:C.includes(e.id)},onPress:()=>H(e.id),style:{paddingVertical:5,paddingHorizontal:10,minHeight:44,minWidth:44,justifyContent:'center',borderRadius:14,borderWidth:1,borderColor:C.includes(e.id)?r.colours.gold:r.colours.border,backgroundColor:C.includes(e.id)?r.colours.gold:'transparent'},children:(0,p.jsx)(a.T,{size:13,colour:C.includes(e.id)?r.colours.onGold:r.colours.text,children:e.short})},e.id))}),L?(0,p.jsxs)(a.Row,{gap:6,wrap:!0,children:[(0,p.jsx)(a.Chip,{label:`All (${f.length})`,selected:'all'===T,onPress:()=>S('all')}),(0,p.jsx)(a.Chip,{label:`Awaiting sign-off (${E})`,selected:'awaiting'===T,onPress:()=>S('awaiting')}),(0,p.jsx)(a.Chip,{label:`Signed off (${f.length-E})`,selected:'signed-off'===T,onPress:()=>S('signed-off')})]}):null,(0,p.jsx)(l.default,{testID:"card-count",children:(0,p.jsxs)(a.Muted,{children:[M.length," ",1===M.length?'card':'cards',C.length?` ${'free-from'===D?'free from':'containing'} ${C.map(c.allergenLabel).join('free-from'===D?' and ':' or ')}`:'']})}),M.map(e=>(0,p.jsx)(i.default,{testID:`card-${e.menuItemId}`,accessibilityRole:"button",accessibilityLabel:`${e.dish}, ${e.signOff?'signed off':'awaiting sign-off'}`,onPress:()=>$(e.id),children:(0,p.jsx)(a.Card,{highlight:!e.signOff&&L?r.colours.amber:void 0,children:(0,p.jsxs)(a.Row,{gap:12,style:{alignItems:'flex-start'},children:[(0,p.jsx)(l.default,{style:{width:84},children:(0,p.jsx)(y,{card:e,height:64})}),(0,p.jsxs)(l.default,{style:{flex:1,gap:4},children:[(0,p.jsx)(a.T,{weight:"semibold",children:e.dish}),(0,p.jsxs)(a.Muted,{children:[e.section," \xb7 ",x(e.price),'example'===e.origin?` \xb7 ${u.EXAMPLE_TAG}`:'']}),(0,p.jsxs)(a.Row,{gap:4,wrap:!0,children:[e.signOff?(0,p.jsx)(a.Badge,{label:`\u2713 ${m(e.signOff.at)}`,kind:"ok"}):(0,p.jsx)(a.Badge,{label:h.STATE_LABEL.awaiting,kind:"amber"}),c.ALLERGENS.filter(s=>e.allergens[s.id]).map(s=>(0,p.jsx)(a.Badge,{label:'may'===e.allergens[s.id]?`${s.short}?`:s.short,kind:'may'===e.allergens[s.id]?'amber':'red'},s.id))]})]})]})})},e.id)),M.length?null:(0,p.jsx)(a.Muted,{children:"No cards match."}),(0,p.jsx)(a.Sheet,{visible:!!N&&!P,onClose:()=>$(null),title:N?.dish??'',maxWidth:640,testID:"card-sheet",children:N?(0,p.jsx)(w,{card:N,actor:'read'===d?{...n,role:'staff'}:n,onEdit:L?()=>R(N.id):void 0}):null}),(0,p.jsx)(a.Sheet,{visible:!!P,onClose:()=>R(null),title:'new'===P?'New recipe card':`Edit: ${O?.dish??''}`,maxWidth:680,testID:"editor-sheet",children:P?(0,p.jsx)(I,{rid:e,card:O,actor:n,onDone:e=>{R(null),$(e)}},P):null})]})};var s=_r(_d[0]),t=_r(_d[1]),n=e(_r(_d[2])),i=e(_r(_d[3])),l=e(_r(_d[4])),r=_r(_d[5]),a=_r(_d[6]),o=_r(_d[7]),d=_r(_d[8]),c=_r(_d[9]),h=_r(_d[10]),u=_r(_d[11]),f=_r(_d[12]),p=_r(_d[13]);const m=e=>{const s=new Date(e.length<=10?`${e}T12:00:00`:e);return isNaN(+s)?e:s.toLocaleDateString('en-GB',{day:'numeric',month:'short',year:'numeric'})},x=e=>null==e?'Price on the board':`\xa3${(e/100).toFixed(2)}`,j={example:u.EXAMPLE_TAG,imported:'Imported from the menu',new:null};function b({card:e,testID:s}){return e.signOff?(0,p.jsxs)(l.default,{testID:s,style:{gap:2},children:[(0,p.jsx)(a.Badge,{label:`\u2713 ${h.STATE_LABEL['signed-off']}`,kind:"ok"}),(0,p.jsxs)(a.T,{size:r.font.small,colour:r.colours.ok,children:["Signed off by ",e.signOff.by," on ",m(e.signOff.at)]})]}):(0,p.jsxs)(l.default,{testID:s,style:{gap:2},children:[(0,p.jsx)(a.Badge,{label:h.STATE_LABEL.awaiting,kind:"amber"}),(0,p.jsx)(a.T,{size:r.font.small,colour:r.colours.amber,children:e.wasLive?'Edited since the last sign-off. The dish shows "awaiting allergen sign-off" to guests and cannot be ordered until the head chef signs it off.':'New dish: it stays off the menu until the head chef signs it off.'})]})}function y({card:e,height:s=180,pending:t}){const i=t?{uri:t}:e.photo?(0,d.recipeCards)().photoSource(e.photo):null;return i?(0,p.jsx)(n.default,{testID:"card-photo",accessibilityLabel:`Plating photo: ${e.dish}`,source:i,style:{width:'100%',height:s,borderRadius:12,backgroundColor:r.colours.surface2},resizeMode:"cover"}):(0,p.jsx)(l.default,{style:{height:s,borderRadius:12,backgroundColor:r.colours.surface2,alignItems:'center',justifyContent:'center',borderWidth:1,borderColor:r.colours.border},children:(0,p.jsx)(a.Muted,{children:"No plating photo yet"})})}function C({map:e}){const s=c.ALLERGENS.filter(s=>e[s.id]).map(e=>e.id);return s.length?(0,p.jsx)(a.Row,{wrap:!0,gap:6,children:s.map(s=>(0,p.jsx)(a.Badge,{label:'may'===e[s]?`May contain ${(0,c.allergenLabel)(s).toLowerCase()}`:(0,c.allergenLabel)(s),kind:'may'===e[s]?'amber':'red'},s))}):(0,p.jsx)(a.Muted,{children:"None of the UK 14 allergens."})}function w({card:e,actor:s,onEdit:n}){const[i,o]=(0,t.useState)(null),c=(0,h.signOffBlock)(e),u=j[e.origin];return(0,p.jsxs)(l.default,{testID:"card-view",style:{gap:12},children:[(0,p.jsx)(y,{card:e,height:200}),(0,p.jsxs)(a.Row,{wrap:!0,gap:6,children:[u?(0,p.jsx)(a.Badge,{label:u,kind:'example'===e.origin?'blue':'neutral'}):null,(0,p.jsx)(a.Badge,{label:e.section,kind:"gold"}),(0,p.jsx)(a.Badge,{label:x(e.price)})]}),(0,p.jsx)(b,{card:e,testID:"card-status"}),(0,p.jsx)(a.Divider,{}),(0,p.jsx)(a.H2,{children:"Allergens"}),(0,p.jsx)(l.default,{testID:"card-allergens",children:(0,p.jsx)(C,{map:e.allergens})}),e.allergenNotes?(0,p.jsx)(a.Muted,{children:e.allergenNotes}):null,e.allergensConfirmed?(0,p.jsxs)(a.Muted,{children:["Allergen list confirmed by ",e.allergensConfirmed.by," on ",m(e.allergensConfirmed.at),"."]}):null,(0,p.jsx)(a.Divider,{}),(0,p.jsx)(a.H2,{children:"Ingredients"}),e.ingredients.length?e.ingredients.map(e=>(0,p.jsxs)(a.Row,{style:{justifyContent:'space-between'},children:[(0,p.jsx)(a.T,{style:{flex:1},children:e.name}),(0,p.jsx)(a.T,{colour:r.colours.goldLight,children:[e.qty,e.unit].filter(Boolean).join(' ')})]},e.id)):(0,p.jsx)(a.Muted,{children:"No ingredients on this card yet."}),(0,p.jsx)(a.Divider,{}),(0,p.jsx)(a.H2,{children:"Method"}),e.steps.length?e.steps.map((e,s)=>(0,p.jsxs)(a.Row,{gap:10,style:{alignItems:'flex-start'},children:[(0,p.jsx)(l.default,{style:{width:26,height:26,borderRadius:13,backgroundColor:r.colours.goldTint,alignItems:'center',justifyContent:'center'},children:(0,p.jsx)(a.T,{size:r.font.small,colour:r.colours.gold,children:s+1})}),(0,p.jsx)(a.T,{style:{flex:1},children:e})]},s)):(0,p.jsxs)(a.Muted,{children:["No method yet.",(0,h.canEditCards)(s.role)?' Tap Edit to add the steps.':'']}),(0,p.jsxs)(a.Muted,{children:["Version ",e.version," \xb7 last changed ",m(e.updatedAt)," by ",e.updatedBy]}),(0,h.canEditCards)(s.role)&&n?(0,p.jsx)(a.Button,{testID:"edit-card",kind:"secondary",label:"Edit card",onPress:n}):null,(0,h.canSignOffCards)(s.role)&&!e.signOff?(0,p.jsxs)(l.default,{style:{gap:6},children:[c?(0,p.jsx)(a.Banner,{kind:"warn",title:"Not ready to sign off",children:c}):null,(0,p.jsx)(a.Button,{testID:"sign-off",kind:"success",label:`Sign off as ${s.name}`,disabled:!!c,onPress:async()=>{try{await(0,d.recipeCards)().signOff(e.id,s),o(null)}catch(e){o(e?.message??'Could not sign off.')}}})]}):null,!(0,h.canEditCards)(s.role)||(0,h.canSignOffCards)(s.role)||e.signOff?null:(0,p.jsx)(a.Banner,{kind:"info",title:"Head chef sign-off",children:"Only the head chef can sign off a recipe card, in the Head Chef app."}),i?(0,p.jsx)(a.Banner,{kind:"danger",children:i}):null]})}const k=()=>`i-${Math.random().toString(36).slice(2,9)}`,D=(e,s)=>e?{id:e.id,dish:e.dish,section:e.section,price:null==e.price?'':(e.price/100).toFixed(2),description:'',ingredients:e.ingredients.map(e=>({...e})),steps:[...e.steps],allergens:{...e.allergens},dismissed:[...e.dismissed],allergenNotes:e.allergenNotes??'',photo:e.photo,pending:null,confirm:!!e.allergensConfirmed}:{id:(0,h.uuid)(),dish:'',section:s,price:'',description:'',ingredients:[{id:k(),name:'',qty:'',unit:''}],steps:[''],allergens:{},dismissed:[],allergenNotes:'',pending:null,confirm:!1},v=e=>{const s=e.replace(/[\xa3\s]/g,'');if(!s)return null;const t=Number(s);return isFinite(t)&&t>=0?Math.round(100*t):'bad'};function I({rid:e,card:n,actor:u,onDone:m}){const x=(0,o.useRestaurant)(e),j=x?.sections??['Mains'],[b,C]=(0,t.useState)(()=>D(n,j[0]??'Mains')),[w,I]=(0,t.useState)(null),[T,S]=(0,t.useState)(null),[B,$]=(0,t.useState)(!1),P=e=>C(s=>({...s,...e})),R=b.ingredients.filter(e=>e.name.trim()),L={ingredients:R,allergens:b.allergens,dismissed:b.dismissed},A=(0,h.suggestAllergens)(R),M=(0,h.unresolved)(L),E=e=>{const s=b.allergens[e],t={...b.allergens};s?'contains'===s?t[e]='may':delete t[e]:t[e]='contains',P({allergens:t,dismissed:b.dismissed.filter(s=>s!==e),confirm:!1})},N=e=>{const s={...b.allergens};delete s[e],P({allergens:s,dismissed:[...new Set([...b.dismissed,e])],confirm:!1})},O=(e,s)=>P({ingredients:b.ingredients.map((t,n)=>n===e?{...t,...s}:t),confirm:!1}),H=(e,s)=>P({steps:b.steps.map((t,n)=>n===e?s:t)}),F=(e,s)=>{const t=[...b.steps],n=e+s;n<0||n>=t.length||([t[e],t[n]]=[t[n],t[e]],P({steps:t}))},_=async e=>{S(null);try{const s=await(0,f.capturePlatingPhoto)(e);s&&(P({pending:s}),S(`Compressed on this device: ${s.width}\xd7${s.height}, ${(0,f.kb)(s.bytes)}${s.originalBytes?` (was ${(0,f.kb)(s.originalBytes)})`:''}.`))}catch(e){S(e?.message??'Could not read that photo.')}},[z,W]=(0,t.useState)(!1),G=n??{id:b.id,dish:b.dish,photo:b.photo};return(0,p.jsxs)(l.default,{testID:"card-editor",style:{gap:12},children:[n?.signOff?(0,p.jsx)(a.Banner,{kind:"warn",title:"Saving a change resets the sign-off",children:"This card is signed off. Any change you save sets it back to \"Awaiting sign-off\" until the head chef signs it off again."}):null,(0,p.jsx)(a.Field,{testID:"dish-name",label:"Dish name",value:b.dish,onChangeText:e=>P({dish:e}),placeholder:"e.g. Cullen skink"}),n?null:(0,p.jsx)(a.Field,{testID:"dish-description",label:"Menu description (optional)",value:b.description,onChangeText:e=>P({description:e}),placeholder:"What guests read on the menu"}),(0,p.jsx)(a.T,{size:r.font.small,weight:"medium",colour:r.colours.muted,children:"Menu section"}),(0,p.jsx)(a.Row,{wrap:!0,gap:6,children:j.map(e=>(0,p.jsx)(a.Chip,{label:e,selected:b.section===e,onPress:()=>P({section:e})},e))}),(0,p.jsx)(a.Field,{testID:"dish-price",label:"Price (\xa3)",value:b.price,onChangeText:e=>P({price:e}),placeholder:"Blank = price on the board",keyboardType:"decimal-pad"}),(0,p.jsx)(a.Divider,{}),(0,p.jsx)(a.H2,{children:"Plating photo"}),(0,p.jsx)(y,{card:G,pending:b.pending?.dataUrl??null,height:170}),(0,p.jsxs)(a.Row,{gap:8,wrap:!0,children:[(0,p.jsx)(a.Button,{testID:"photo-camera",small:!0,kind:"secondary",label:b.pending||b.photo?'Retake photo':'Take photo',onPress:()=>_('camera')}),(0,p.jsx)(a.Button,{testID:"photo-library",small:!0,kind:"secondary",label:b.pending||b.photo?'Replace photo':'Choose photo',onPress:()=>_('library')}),b.pending||b.photo?(0,p.jsx)(a.Button,{testID:"photo-remove",small:!0,kind:"ghost",label:"Remove photo",onPress:()=>P({pending:null,photo:void 0})}):null]}),T?(0,p.jsx)(l.default,{testID:"photo-info",children:(0,p.jsx)(a.Muted,{children:T})}):(0,p.jsx)(a.Muted,{children:'shared'===(0,d.recipeCards)().mode?'Photos are shrunk on this device, then shared with the team. Staff and guests only see the photo once the card is signed off.':'Photos are shrunk on this device before they are saved.'}),(0,p.jsx)(a.Divider,{}),(0,p.jsx)(a.H2,{children:"Ingredients"}),(0,p.jsx)(a.Muted,{children:"Quantity, unit and ingredient. We suggest allergens from the ingredient names."}),b.ingredients.map((e,t)=>{const n=e.name.trim()?(0,h.suggestAllergens)([e]):[];return(0,p.jsxs)(l.default,{style:{gap:4},children:[(0,p.jsxs)(a.Row,{gap:6,children:[(0,p.jsx)(s.TextInput,{testID:`ing-qty-${t}`,accessibilityLabel:`Quantity ${t+1}`,value:e.qty,onChangeText:e=>O(t,{qty:e}),placeholder:"Qty",placeholderTextColor:"#7D776C",style:[a.styles.input,{width:64}]}),(0,p.jsx)(s.TextInput,{testID:`ing-unit-${t}`,accessibilityLabel:`Unit ${t+1}`,value:e.unit,onChangeText:e=>O(t,{unit:e}),placeholder:"g / ml / each",placeholderTextColor:"#7D776C",style:[a.styles.input,{width:92}]}),(0,p.jsx)(s.TextInput,{testID:`ing-name-${t}`,accessibilityLabel:`Ingredient ${t+1}`,value:e.name,onChangeText:e=>O(t,{name:e}),placeholder:"Ingredient",placeholderTextColor:"#7D776C",style:[a.styles.input,{flex:1}]}),(0,p.jsx)(i.default,{accessibilityLabel:`Remove ingredient ${t+1}`,onPress:()=>P({ingredients:b.ingredients.filter((e,s)=>s!==t)}),hitSlop:8,children:(0,p.jsx)(a.T,{colour:r.colours.muted,children:"\u2715"})})]}),n.length?(0,p.jsxs)(a.Muted,{children:["Suggests: ",n.map(c.allergenLabel).join(', ')]}):null]},e.id)}),(0,p.jsx)(a.Button,{testID:"ing-add",small:!0,kind:"ghost",label:"Add ingredient",onPress:()=>P({ingredients:[...b.ingredients,{id:k(),name:'',qty:'',unit:''}]})}),(0,p.jsx)(a.Divider,{}),(0,p.jsx)(a.H2,{children:"Method"}),b.steps.map((e,t)=>(0,p.jsxs)(a.Row,{gap:6,style:{alignItems:'flex-start'},children:[(0,p.jsx)(a.T,{colour:r.colours.gold,style:{width:20,paddingTop:10},children:t+1}),(0,p.jsx)(s.TextInput,{testID:`step-${t}`,accessibilityLabel:`Step ${t+1}`,value:e,onChangeText:e=>H(t,e),multiline:!0,placeholder:"Describe this step",placeholderTextColor:"#7D776C",style:[a.styles.input,{flex:1,minHeight:56,textAlignVertical:'top'}]}),(0,p.jsxs)(l.default,{style:{gap:4},children:[(0,p.jsx)(i.default,{accessibilityLabel:`Move step ${t+1} up`,onPress:()=>F(t,-1),hitSlop:6,children:(0,p.jsx)(a.T,{colour:r.colours.muted,children:"\u25b2"})}),(0,p.jsx)(i.default,{accessibilityLabel:`Move step ${t+1} down`,onPress:()=>F(t,1),hitSlop:6,children:(0,p.jsx)(a.T,{colour:r.colours.muted,children:"\u25bc"})}),(0,p.jsx)(i.default,{accessibilityLabel:`Remove step ${t+1}`,onPress:()=>P({steps:b.steps.filter((e,s)=>s!==t)}),hitSlop:6,children:(0,p.jsx)(a.T,{colour:r.colours.muted,children:"\u2715"})})]})]},t)),(0,p.jsx)(a.Button,{testID:"step-add",small:!0,kind:"ghost",label:"Add step",onPress:()=>P({steps:[...b.steps,'']})}),(0,p.jsx)(a.Divider,{}),(0,p.jsx)(a.H2,{children:"Allergens (UK 14)"}),(0,p.jsx)(a.Muted,{children:"Tap to cycle: contains \u2192 may contain \u2192 none. Suggested allergens are marked \u201c?\u201d until you add or rule them out."}),M.length?(0,p.jsxs)(l.default,{testID:"allergen-suggestions",style:{gap:6},children:[(0,p.jsx)(a.Banner,{kind:"warn",title:`Check ${M.length} suggested allergen${1===M.length?'':'s'}`,children:M.map(e=>`${(0,c.allergenLabel)(e)} (from ${(0,h.suggestedBy)(R,e).join(', ')})`).join('; ')}),M.map(e=>(0,p.jsxs)(a.Row,{gap:6,wrap:!0,children:[(0,p.jsx)(a.T,{style:{flex:1},children:(0,c.allergenLabel)(e)}),(0,p.jsx)(a.Button,{testID:`suggest-add-${e}`,small:!0,label:"Contains",onPress:()=>P({allergens:{...b.allergens,[e]:'contains'},confirm:!1})}),(0,p.jsx)(a.Button,{testID:`suggest-may-${e}`,small:!0,kind:"secondary",label:"May contain",onPress:()=>P({allergens:{...b.allergens,[e]:'may'},confirm:!1})}),(0,p.jsx)(a.Button,{testID:`suggest-dismiss-${e}`,small:!0,kind:"ghost",label:"Not in this dish",onPress:()=>N(e)})]},e)),(0,p.jsx)(a.Button,{testID:"apply-suggestions",small:!0,kind:"secondary",label:"Add all suggestions as \u2018contains\u2019",onPress:()=>{const e={...b.allergens};M.forEach(s=>{e[s]='contains'}),P({allergens:e,confirm:!1})}})]}):null,(0,p.jsx)(a.Row,{wrap:!0,gap:6,children:c.ALLERGENS.map(e=>{const s=b.allergens[e.id],t=A.includes(e.id)&&!s&&!b.dismissed.includes(e.id),n='contains'===s?r.colours.redBg:'may'===s?r.colours.amberBg:r.colours.surface2,l='contains'===s?r.colours.red:'may'===s?r.colours.amber:t?r.colours.gold:r.colours.border;return(0,p.jsx)(i.default,{testID:`allergen-${e.id}`,accessibilityRole:"button",accessibilityLabel:`${e.short}: ${'contains'===s?'contains':'may'===s?'may contain':'not marked'}`,onPress:()=>E(e.id),style:{paddingVertical:6,paddingHorizontal:10,borderRadius:16,borderWidth:t?2:1,borderStyle:t?'dashed':'solid',borderColor:l,backgroundColor:n},children:(0,p.jsxs)(a.T,{size:r.font.small,colour:'contains'===s?'#FFD9D4':'may'===s?'#FFE2A8':r.colours.text,children:[e.short,'may'===s?' (may)':'',t?' ?':'']})},e.id)})}),b.dismissed.length?(0,p.jsxs)(a.Muted,{children:["Ruled out: ",b.dismissed.map(c.allergenLabel).join(', ')]}):null,(0,p.jsx)(a.Field,{testID:"allergen-notes",label:"Allergen notes (optional)",value:b.allergenNotes,onChangeText:e=>P({allergenNotes:e}),placeholder:"e.g. Cooked in the shared fryer"}),(0,p.jsxs)(i.default,{testID:"confirm-allergens",accessibilityRole:"checkbox",accessibilityState:{checked:b.confirm,disabled:M.length>0},disabled:M.length>0,onPress:()=>P({confirm:!b.confirm}),style:{flexDirection:'row',gap:10,alignItems:'center',padding:10,borderRadius:10,borderWidth:1,borderColor:b.confirm?r.colours.ok:r.colours.border,opacity:M.length?.5:1},children:[(0,p.jsx)(l.default,{style:{width:22,height:22,borderRadius:4,borderWidth:2,borderColor:b.confirm?r.colours.ok:r.colours.muted,alignItems:'center',justifyContent:'center',backgroundColor:b.confirm?r.colours.okBg:'transparent'},children:b.confirm?(0,p.jsx)(a.T,{colour:r.colours.ok,children:"\u2713"}):null}),(0,p.jsx)(a.T,{style:{flex:1},children:M.length?'Check the suggested allergens above first':`I have checked the allergen list against the ingredients (${u.name})`})]}),w?(0,p.jsx)(a.Banner,{kind:"danger",children:w}):null,(0,p.jsx)(a.Button,{testID:"card-save",label:z?'Saving\u2026':n?'Save changes':'Save card',disabled:z,onPress:async()=>{I(null);const s=v(b.price);if(!b.dish.trim())return I('Give the dish a name.');if('bad'===s)return I('Price should be in pounds, e.g. 14.50 (or leave it blank for "price on the board").');const t=(0,d.recipeCards)();W(!0);try{let i=b.photo;b.pending&&(i=await t.savePhoto(e,b.id,b.pending));const l=b.steps.map(e=>e.trim()).filter(Boolean),r={dish:b.dish.trim(),section:b.section,price:s,ingredients:R.map(e=>({...e,name:e.name.trim(),qty:e.qty.trim(),unit:e.unit.trim()})),steps:l,allergens:b.allergens,dismissed:b.dismissed,allergenNotes:b.allergenNotes.trim()||void 0,photo:i};if(n)await t.update(n.id,{...r,confirmAllergens:b.confirm},u),m(n.id);else{const s=await t.create(e,{...r,id:b.id,description:b.description.trim()||void 0},u);b.confirm&&await t.update(s.id,{confirmAllergens:!0},u),m(s.id)}}catch(e){I(e?.message??'Could not save the card.')}finally{W(!1)}}}),(0,p.jsx)(a.Muted,{children:(0,h.canSignOffCards)(u.role)?'After saving, sign the card off so it goes live.':'After saving, the head chef signs it off in the Head Chef app before it goes live.'}),n?B?(0,p.jsxs)(a.Row,{gap:8,children:[(0,p.jsx)(a.Button,{testID:"card-delete-yes",small:!0,kind:"danger",label:"Yes, remove this dish",onPress:async()=>{if(n)try{await(0,d.recipeCards)().remove(n.id,u),m(null)}catch(e){I(e?.message??'Could not remove the card.')}}}),(0,p.jsx)(a.Button,{small:!0,kind:"ghost",label:"Keep it",onPress:()=>$(!1)})]}):(0,p.jsx)(a.Button,{testID:"card-delete",small:!0,kind:"ghost",label:"Remove card and dish from the menu",onPress:()=>$(!0)}):null]})}},996,[875,30,196,263,127,821,813,819,831,814,1103,1141,1293,24]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useHrSettings",{enumerable:!0,get:function(){return f}}),_e.MoraleScale=b,_e.StaffingSlider=j,_e.ShiftCheckout=function({rid:e,shiftKey:o,day:a,meId:d,onClose:y}){const w=f(e),S=w.wording,k=(0,i.useOwner)(e=>e.staff),C=(0,i.useOwner)(e=>e.attendance),[v,T]=(0,s.useState)(null),[R,M]=(0,s.useState)(null),[I,D]=(0,s.useState)(''),[H,L]=(0,s.useState)('up'),[z,P]=(0,s.useState)(null),[W,A]=(0,s.useState)(''),[q,B]=(0,s.useState)(null),[N,E]=(0,s.useState)(!1),$=(0,s.useMemo)(()=>{const e=new Set(C.filter(e=>e.date===a&&e.staffId!==d).map(e=>e.staffId)),t=k.filter(e=>e.active&&e.id!==d&&!e.temp);return[...t.filter(t=>e.has(t.id)),...t.filter(t=>!e.has(t.id))].slice(0,14)},[k,C,a,d]),O=()=>{u.useHr.getState().skip(e,o),y()};return(0,c.jsx)(n.Sheet,{visible:!0,onClose:O,title:"How was today?",testID:"hr-checkout",children:N?(0,c.jsxs)(l.default,{testID:"hr-checkout-thanks",style:{gap:6,paddingVertical:10},children:[(0,c.jsx)(n.T,{size:18,weight:"semibold",colour:r.colours.goldLight,center:!0,children:"Thanks. Sent anonymously."}),(0,c.jsx)(n.Muted,{center:!0,children:"Have a good evening."})]}):(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(n.Muted,{size:13,children:S.intro}),(0,c.jsxs)(l.default,{style:{gap:8},children:[(0,c.jsx)(n.T,{weight:"semibold",children:S.morale}),(0,c.jsx)(b,{value:v,onChange:T,w:S})]}),(0,c.jsxs)(l.default,{style:{gap:8},children:[(0,c.jsx)(n.T,{weight:"semibold",children:S.staffing}),(0,c.jsx)(j,{value:R,onChange:M,w:S})]}),w.askQuestion||w.askShout?(0,c.jsxs)(n.Row,{wrap:!0,gap:6,children:[w.askQuestion?(0,c.jsx)(n.Chip,{testID:"hr-more-question",label:"\uff0b Ask the team a question",selected:'q'===q,onPress:()=>B('q'===q?null:'q')}):null,w.askShout?(0,c.jsx)(n.Chip,{testID:"hr-more-shout",label:"\uff0b Shout out a teammate",selected:'shout'===q,onPress:()=>B('shout'===q?null:'shout')}):null]}):null,'q'===q&&w.askQuestion?(0,c.jsxs)(l.default,{style:{gap:6},children:[(0,c.jsxs)(n.Muted,{size:13,children:[S.question," Optional."]}),(0,c.jsx)(t.TextInput,{testID:"hr-question",accessibilityLabel:"Your question",value:I,onChangeText:D,maxLength:280,multiline:!0,placeholder:"e.g. Could we start staff meals earlier?",placeholderTextColor:r.colours.muted,style:[x,{minHeight:64}]}),(0,c.jsxs)(n.Row,{wrap:!0,gap:6,children:[(0,c.jsx)(n.Chip,{label:"Vote up",selected:'up'===H,onPress:()=>L('up')}),(0,c.jsx)(n.Chip,{label:"Yes / No",selected:'yesno'===H,onPress:()=>L('yesno')})]})]}):null,'shout'===q&&w.askShout?(0,c.jsxs)(l.default,{style:{gap:6},children:[(0,c.jsxs)(n.Muted,{size:13,children:[S.shout," Optional. Your name isn\u2019t shown."]}),(0,c.jsx)(n.Row,{wrap:!0,gap:6,children:$.map(e=>(0,c.jsx)(n.Chip,{testID:`hr-shout-${e.id}`,label:p(e.nickname||e.name).split(' ')[0],selected:z===p(e.nickname||e.name).split(' ')[0],onPress:()=>{const t=p(e.nickname||e.name).split(' ')[0];P(z===t?null:t)}},e.id))}),z?(0,c.jsx)(t.TextInput,{testID:"hr-shout-note",accessibilityLabel:"What for (optional)",value:W,onChangeText:A,maxLength:140,placeholder:"What for? (optional)",placeholderTextColor:r.colours.muted,style:x}):null]}):null,(0,c.jsxs)(n.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(n.Button,{testID:"hr-checkout-send",label:"Send anonymously",disabled:null==v&&null==R,onPress:()=>{u.useHr.getState().submit({rid:e,shiftKey:o,day:a,morale:v??3,staffing:R,question:w.askQuestion&&I.trim()?I:void 0,kind:H,shoutTo:w.askShout&&z?z:void 0,shoutBody:W||void 0}),E(!0),setTimeout(y,2400)},style:{flexGrow:1}}),(0,c.jsx)(n.Button,{testID:"hr-checkout-skip",kind:"ghost",label:"Skip",onPress:O})]}),(0,c.jsxs)(n.Muted,{size:12,children:["No name, no staff number and no clock time is saved with these answers. Managers only see a day once ",h.MIN_ANSWERS," or more people have answered."]})]})})},_e.QuestionBoard=function({rid:e,today:i,manager:a,by:d}){const p=f(e);(0,s.useEffect)(()=>{u.useHr.getState().ensure(e,i),u.hrRemote.live&&u.hrRemote.refresh&&u.hrRemote.refresh()},[e,i]);const y=(0,u.useHr)(e=>e.questions),b=(0,u.useHr)(e=>e.voted),j=(0,u.useHr)(e=>e.log),[S,k]=(0,s.useState)(''),[C,v]=(0,s.useState)('up'),[T,R]=(0,s.useState)(null),[M,I]=(0,s.useState)(null),[D,H]=(0,s.useState)(''),[L,z]=(0,s.useState)(null),[P,W]=(0,s.useState)(''),[A,q]=(0,s.useState)(!1),[B,N]=(0,s.useState)(null);(0,s.useEffect)(()=>{a&&A&&u.hrRemote.live&&u.hrRemote.log&&u.hrRemote.log(e).then(e=>N(e))},[a,A,e,j.length]);const E=(0,h.boardOrder)(y.filter(t=>t.venue===e),a),$=(B??j.filter(t=>t.venue===e)).slice(0,30);if(!p.board)return(0,c.jsx)(n.Card,{children:(0,c.jsxs)(n.Muted,{children:["The question board is switched off for this venue.",a?' Turn it on in Settings \u203a Advanced \u203a Shift check-out & question board.':'']})});return(0,c.jsxs)(l.default,{style:{gap:10},testID:"hr-board",children:[(0,c.jsx)(n.Muted,{children:"Ask anything about work. No names are shown or saved, not even to managers. Vote on what matters to you."}),(0,c.jsxs)(n.Card,{children:[(0,c.jsx)(n.T,{weight:"semibold",children:"Post a question"}),(0,c.jsx)(t.TextInput,{testID:"hr-board-input",accessibilityLabel:"Your question",value:S,onChangeText:e=>{k(e),R(null)},maxLength:280,multiline:!0,placeholder:"e.g. Can the rota go up by Thursday?",placeholderTextColor:r.colours.muted,style:[x,{minHeight:64}]}),(0,c.jsxs)(n.Row,{wrap:!0,gap:6,style:{justifyContent:'space-between'},children:[(0,c.jsxs)(n.Row,{wrap:!0,gap:6,children:[(0,c.jsx)(n.Chip,{label:"Vote up",selected:'up'===C,onPress:()=>v('up')}),(0,c.jsx)(n.Chip,{label:"Yes / No",selected:'yesno'===C,onPress:()=>v('yesno')})]}),(0,c.jsx)(n.Button,{small:!0,testID:"hr-board-post",label:"Post anonymously",disabled:!(0,h.cleanQuestion)(S),onPress:()=>{u.useHr.getState().post(e,S,C,i)?(k(''),R('Posted anonymously.')):R('Write a few more words first.')}})]}),T?(0,c.jsx)(n.Muted,{size:13,children:T}):null]}),E.length?E.map(e=>(0,c.jsx)(w,{q:e,mine:b[e.id],manager:a,onHide:()=>{I(e),H('')},onReply:()=>{z(e),W(e.reply??'')},by:d},e.id)):(0,c.jsx)(n.Muted,{center:!0,children:"No questions yet. Be the first."}),a?(0,c.jsxs)(n.Card,{children:[(0,c.jsx)(o.default,{testID:"hr-log-toggle",accessibilityRole:"button",onPress:()=>q(!A),children:(0,c.jsxs)(n.Row,{style:{justifyContent:'space-between',minHeight:44},children:[(0,c.jsx)(n.T,{weight:"semibold",style:{flex:1},children:"Moderation log"}),(0,c.jsx)(n.T,{colour:r.colours.gold,children:A?'Hide':'Show'})]})}),(0,c.jsx)(n.Muted,{size:13,children:"Every hide, unhide and reply is logged with who did it and when. Questions never show who asked."}),A?$.length?$.map(e=>(0,c.jsxs)(l.default,{testID:"hr-log-row",style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:6},children:[(0,c.jsxs)(n.T,{size:14,children:['hide'===e.action?'Hidden':'unhide'===e.action?'Shown again':'Replied'," by ",e.by]}),(0,c.jsxs)(n.Muted,{size:12,children:[new Date(e.at).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'}),e.reason?` \xb7 ${e.reason}`:'']})]},e.id)):(0,c.jsx)(n.Muted,{children:"Nothing logged yet."}):null]}):null,(0,c.jsxs)(n.Sheet,{visible:!!M,onClose:()=>I(null),title:"Hide this question?",testID:"hr-hide-sheet",children:[(0,c.jsx)(n.Muted,{children:"It disappears for staff straight away. You can show it again later. This is logged with your name."}),(0,c.jsx)(t.TextInput,{testID:"hr-hide-reason",accessibilityLabel:"Reason",value:D,onChangeText:H,maxLength:140,placeholder:"Reason, e.g. rude or names someone",placeholderTextColor:r.colours.muted,style:x}),(0,c.jsxs)(n.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(n.Button,{testID:"hr-hide-confirm",kind:"danger",label:"Hide",disabled:D.trim().length<3,onPress:()=>{M&&u.useHr.getState().moderate(M.id,'hide',D,d),I(null)}}),(0,c.jsx)(n.Button,{kind:"ghost",label:"Cancel",onPress:()=>I(null)})]})]}),(0,c.jsxs)(n.Sheet,{visible:!!L,onClose:()=>z(null),title:"Reply to the team",testID:"hr-reply-sheet",children:[L?(0,c.jsxs)(n.Muted,{children:["\u201c",L.body,"\u201d"]}):null,(0,c.jsx)(t.TextInput,{testID:"hr-reply-input",accessibilityLabel:"Your reply",value:P,onChangeText:W,maxLength:600,multiline:!0,placeholder:"Your reply, shown under the question",placeholderTextColor:r.colours.muted,style:[x,{minHeight:80}]}),(0,c.jsx)(n.Muted,{size:12,children:"Shown as \u201cReply from the managers\u201d. Your name is kept in the moderation log only."}),(0,c.jsxs)(n.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(n.Button,{testID:"hr-reply-save",label:"Post reply",disabled:!P.trim(),onPress:()=>{L&&u.useHr.getState().reply(L.id,P,d),z(null)}}),(0,c.jsx)(n.Button,{kind:"ghost",label:"Cancel",onPress:()=>z(null)})]})]})]})},_e.coversByDay=k,_e.exampleCovers=C,_e.MoraleTrend=function({rid:e,today:t}){const o=f(e).wording;(0,s.useEffect)(()=>{u.useHr.getState().ensure(e,t)},[e,t]);const[i,a]=(0,s.useState)(14),p=(0,u.useHr)(e=>e.checkins),x=(0,u.useHr)(e=>e.shouts),b=(0,d.useBookings)(e),j=(0,s.useMemo)(()=>k(b),[b]),w=e=>j[e]??(z?C(e):void 0),v=S(t,-i),[T,R]=(0,s.useState)(null),[M,I]=(0,s.useState)(null);(0,s.useEffect)(()=>{let s=!0;return u.hrRemote.live&&u.hrRemote.trend&&u.hrRemote.trend(e,v,t).then(e=>{s&&R(e)}),u.hrRemote.live&&u.hrRemote.shouts&&u.hrRemote.shouts(e,S(t,-30)).then(e=>{s&&I(e)}),()=>{s=!1}},[e,v,t]);const D=(0,s.useMemo)(()=>(0,h.dayResults)(p.filter(s=>s.venue===e&&s.day>=v&&s.day<=t)),[p,e,v,t]),H=u.hrRemote.live,L=H?T??[]:D.shown,z=!H&&p.some(t=>t.venue===e&&t.example),P=(H?M??[]:x.filter(t=>t.venue===e)).slice().sort((e,t)=>t.day.localeCompare(e.day)).slice(0,8),W=L.length?Math.round(L.reduce((e,t)=>e+t.morale,0)/L.length*10)/10:null,A=Array.from({length:i},(e,s)=>S(t,1-i+s)),q=new Map(L.map(e=>[e.day,e]));return(0,c.jsxs)(l.default,{style:{gap:10},testID:"hr-trend",children:[(0,c.jsxs)(n.Muted,{children:["From the anonymous check-out when people clock out. A day only shows once ",h.MIN_ANSWERS," or more people have answered."]}),z?(0,c.jsx)(n.Banner,{kind:"example",title:"Example answers",children:"These are made-up answers so you can see how it looks. Real answers replace them once your team is signed in."}):null,(0,c.jsx)(n.Row,{wrap:!0,gap:6,children:[14,28,56].map(e=>(0,c.jsx)(n.Chip,{label:14===e?'2 weeks':28===e?'4 weeks':'8 weeks',selected:i===e,onPress:()=>a(e)},e))}),(0,c.jsxs)(n.Card,{children:[(0,c.jsxs)(n.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,c.jsx)(n.T,{weight:"semibold",style:{flexShrink:1},children:"Team morale"}),null!=W?(0,c.jsx)(n.Badge,{kind:"gold",label:`AVERAGE ${W} \xb7 ${(0,h.moraleWord)(Math.round(W),o).toUpperCase()}`}):null]}),(0,c.jsx)(l.default,{testID:"hr-trend-chart",accessibilityLabel:`Morale over the last ${i} days`,style:{height:110,flexDirection:'row',alignItems:'flex-end',gap:i>30?1:3,borderBottomWidth:1,borderColor:r.colours.border},children:A.map(e=>{const t=q.get(e);return(0,c.jsx)(l.default,{style:{flex:1,minWidth:0,height:'100%',justifyContent:'flex-end',alignItems:'center'},children:t?(0,c.jsx)(l.default,{style:{width:'100%',maxWidth:22,height:t.morale/5*100+"%",borderTopLeftRadius:4,borderTopRightRadius:4,backgroundColor:t.morale<2.5?r.colours.amber:r.colours.gold}}):(0,c.jsx)(l.default,{style:{width:4,height:4,borderRadius:2,backgroundColor:r.colours.border,marginBottom:2}})},e)})}),(0,c.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(n.Muted,{size:12,children:y(A[0])}),(0,c.jsx)(n.Muted,{size:12,children:y(A[A.length-1])})]}),(0,c.jsxs)(n.Muted,{size:12,children:["Bar height: average morale (1 low to 5 high). Amber: below 2.5. A dot: fewer than ",h.MIN_ANSWERS," answers or none."]})]}),(0,c.jsxs)(n.Card,{children:[(0,c.jsx)(n.T,{weight:"semibold",children:"Staffing vs covers, night by night"}),L.length?L.slice().reverse().map(e=>(0,c.jsxs)(l.default,{testID:"hr-trend-row",style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:8,gap:4},children:[(0,c.jsxs)(n.Row,{style:{justifyContent:'space-between'},gap:6,wrap:!0,children:[(0,c.jsx)(n.T,{weight:"semibold",style:{flexShrink:1},children:y(e.day)}),(0,c.jsx)(n.T,{size:14,colour:r.colours.goldLight,style:{flexShrink:1},children:null!=w(e.day)?`${w(e.day)} covers`:'No bookings'})]}),(0,c.jsxs)(n.Row,{gap:8,style:{alignItems:'center'},children:[(0,c.jsxs)(l.default,{style:{flex:1,minWidth:60,height:6,borderRadius:3,backgroundColor:r.colours.border},children:[null!=e.staffing?(0,c.jsx)(l.default,{style:{position:'absolute',left:`${e.staffing}%`,marginLeft:-6,top:-3,width:12,height:12,borderRadius:6,backgroundColor:r.colours.gold}}):null,(0,c.jsx)(l.default,{style:{position:'absolute',left:'50%',marginLeft:-1,top:-4,width:2,height:14,backgroundColor:r.colours.goldMuted}})]}),(0,c.jsx)(n.T,{size:13,style:{flexShrink:1,maxWidth:'55%'},children:null!=e.staffing?(0,h.staffingWord)(e.staffing,o):'\u2014'})]}),(0,c.jsxs)(n.Muted,{size:12,children:["Morale ",e.morale," \xb7 ",e.answers," answers \xb7 ",e.short," said short, ",e.perfect," perfect, ",e.over," over"]})]},e.day)):(0,c.jsxs)(n.Muted,{children:["No days with ",h.MIN_ANSWERS," or more answers yet."]}),!H&&D.held?(0,c.jsxs)(n.Muted,{size:12,children:[D.held," day",1===D.held?'':'s'," held back (fewer than ",h.MIN_ANSWERS," answers)."]}):null,(0,c.jsx)(n.Muted,{size:12,children:"Covers come from that day\u2019s bookings (cancelled and no-shows left out)."})]}),(0,c.jsxs)(n.Card,{children:[(0,c.jsx)(n.T,{weight:"semibold",children:"Shout-outs"}),P.length?P.map(e=>(0,c.jsxs)(l.default,{testID:"hr-shout-row",style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:6},children:[(0,c.jsxs)(n.T,{size:14,children:[(0,c.jsx)(n.T,{size:14,weight:"semibold",colour:r.colours.goldLight,children:e.to}),e.body?`: ${e.body}`:'']}),(0,c.jsxs)(n.Muted,{size:12,children:[y(e.day)," \xb7 from a teammate"]})]},e.id)):(0,c.jsx)(n.Muted,{children:"No shout-outs yet."})]})]})},_e.HrSettingsCard=function({rid:e}){const o=(0,a.useStore)(t=>t.restaurants.find(t=>t.id===e)?.settings?.hr),i=(0,h.hrSettingsOf)(o),d=t=>a.useStore.getState().updateSettings(e,{hr:{...i,...t}}),[u,f]=(0,s.useState)({});return(0,c.jsxs)(l.default,{style:{gap:8},testID:"hr-settings",children:[(0,c.jsx)(n.Toggle,{testID:"hr-set-on",label:"Ask a quick check-out when people clock out",value:i.on,onChange:e=>d({on:e})}),(0,c.jsx)(n.Toggle,{label:"Let them post a question for the board",value:i.askQuestion,onChange:e=>d({askQuestion:e})}),(0,c.jsx)(n.Toggle,{label:"Let them shout out a teammate",value:i.askShout,onChange:e=>d({askShout:e})}),(0,c.jsx)(n.Toggle,{testID:"hr-set-board",label:"Question board in the Staff, Head Chef and Managers apps",value:i.board,onChange:e=>d({board:e})}),(0,c.jsx)(n.Muted,{size:13,children:"Tip: it only shows after Clock out, never at clock in, and anyone can tap Skip. It\u2019s a card in the app, not a phone notification."}),(0,c.jsxs)(n.Muted,{size:13,children:["Tip: answers are anonymous. No name or staff number is saved, and a day\u2019s results only show once ",h.MIN_ANSWERS," people have answered."]}),(0,c.jsx)(n.T,{weight:"semibold",style:{marginTop:4},children:"Wording"}),v.map(({k:e,label:s})=>(0,c.jsxs)(l.default,{style:{gap:4},children:[(0,c.jsx)(n.Muted,{size:13,children:s}),(0,c.jsx)(t.TextInput,{testID:`hr-word-${e}`,accessibilityLabel:s,value:u[e]??i.wording[e],onChangeText:t=>f({...u,[e]:t}),onBlur:()=>{null!=u[e]&&(d({wording:{...i.wording,[e]:u[e].trim()||h.DEFAULT_HR.wording[e]}}),f(t=>{const s={...t};return delete s[e],s}))},maxLength:'intro'===e||'staffing'===e||'question'===e?160:60,multiline:'intro'===e||'staffing'===e||'question'===e,placeholderTextColor:r.colours.muted,style:[x,'intro'===e||'staffing'===e||'question'===e?{minHeight:92,textAlignVertical:'top'}:null]})]},e)),(0,c.jsx)(n.Muted,{size:13,children:"Tip: keep it short and plain. Leave a box empty to go back to the standard words."})]})};var t=_r(_d[0]),s=_r(_d[1]),o=e(_r(_d[2])),l=e(_r(_d[3])),n=_r(_d[4]),r=_r(_d[5]),i=_r(_d[6]),a=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),c=_r(_d[11]);const f=e=>(0,h.hrSettingsOf)((0,a.useStore)(t=>t.restaurants.find(t=>t.id===e)?.settings?.hr)),p=e=>e.replace(' (example)','').trim(),x={minHeight:46,borderRadius:12,borderWidth:1,borderColor:r.colours.accentBorder,backgroundColor:r.colours.surface2,color:r.colours.text,paddingHorizontal:12,paddingVertical:10,fontSize:16},y=e=>new Date(`${e}T12:00:00`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'});function b({value:e,onChange:t,w:s}){return(0,c.jsxs)(l.default,{style:{gap:6},testID:"hr-morale",children:[(0,c.jsx)(n.Row,{gap:6,style:{justifyContent:'space-between'},children:h.MORALE_STEPS.map(l=>{const i=e===l;return(0,c.jsx)(o.default,{testID:`hr-morale-${l}`,accessibilityRole:"button",accessibilityState:{selected:i},accessibilityLabel:`Morale ${l} of 5: ${(0,h.moraleWord)(l,s)}`,onPress:()=>t(l),hitSlop:4,style:{flex:1,minWidth:0,minHeight:48,borderRadius:12,borderWidth:1,borderColor:i?r.colours.gold:r.colours.border,backgroundColor:i?r.colours.goldTint:r.colours.surface2,alignItems:'center',justifyContent:'center'},children:(0,c.jsx)(n.T,{size:18,weight:"bold",colour:i?r.colours.goldLight:r.colours.text,children:l})},l)})}),(0,c.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,c.jsx)(n.Muted,{size:13,style:{flexShrink:1},children:s.moraleLow}),e?(0,c.jsx)(n.T,{size:13,weight:"semibold",colour:r.colours.goldLight,style:{flexShrink:1,textAlign:'center'},children:(0,h.moraleWord)(e,s)}):null,(0,c.jsx)(n.Muted,{size:13,style:{flexShrink:1,textAlign:'right'},children:s.moraleHigh})]})]})}function j({value:e,onChange:t,w:i}){const a=(0,s.useRef)(null),d=(0,s.useRef)(0),u=(0,s.useRef)(1),f=()=>{a.current?.measureInWindow?.((e,t,s)=>{d.current=e,u.current=Math.max(1,s)})},p=e=>t((0,h.snapStaffing)((e-d.current)/u.current*100)),x=e??50,y=null!=e;return(0,c.jsxs)(l.default,{style:{gap:6},children:[(0,c.jsx)(l.default,{testID:"hr-staffing",accessible:!0,accessibilityRole:"adjustable",accessibilityLabel:`Staffing: ${y?(0,h.staffingWord)(x,i):'not answered'}`,accessibilityActions:[{name:'increment'},{name:'decrement'}],onAccessibilityAction:e=>{const s=h.STAFF_STOPS.indexOf((0,h.snapStaffing)(x)),o='increment'===e.nativeEvent.actionName?Math.min(8,s+1):Math.max(0,s-1);t(h.STAFF_STOPS[o])},onStartShouldSetResponder:()=>!0,onMoveShouldSetResponder:()=>!0,onResponderGrant:e=>{f(),p(e.nativeEvent.pageX)},onResponderMove:e=>p(e.nativeEvent.pageX),style:{height:48,justifyContent:'center',paddingHorizontal:15},children:(0,c.jsxs)(l.default,{ref:a,onLayout:f,style:{height:48,justifyContent:'center'},children:[(0,c.jsx)(l.default,{style:{height:6,borderRadius:3,backgroundColor:r.colours.border}}),(0,c.jsx)(l.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:0,bottom:0,flexDirection:'row',justifyContent:'space-between',alignItems:'center'},children:h.STAFF_STOPS.map(e=>(0,c.jsx)(l.default,{style:{width:e%50==0?4:2,height:e%50==0?18:10,borderRadius:2,backgroundColor:e%50==0?r.colours.goldMuted:r.colours.muted}},e))}),(0,c.jsx)(l.default,{pointerEvents:"none",style:{position:'absolute',left:`${x}%`,top:10,marginLeft:-14,width:28,height:28,borderRadius:14,borderWidth:2,borderColor:y?r.colours.gold:r.colours.muted,backgroundColor:y?r.colours.gold:r.colours.surface}})]})}),(0,c.jsx)(n.Row,{style:{justifyContent:'space-between',gap:8},children:[[0,i.staffLow],[50,i.staffMid],[100,i.staffHigh]].map(([e,s],l)=>(0,c.jsx)(o.default,{testID:`hr-staffing-${e}`,accessibilityRole:"button",accessibilityLabel:s,onPress:()=>t(e),hitSlop:6,style:{flexShrink:1,flexGrow:0,minWidth:0},children:(0,c.jsx)(n.T,{size:13,colour:y&&(0,h.snapStaffing)(x)===e?r.colours.goldLight:r.colours.muted,weight:y&&(0,h.snapStaffing)(x)===e?'semibold':'regular',style:{textAlign:0===l?'left':1===l?'center':'right'},children:s})},e))}),y&&(0,h.snapStaffing)(x)%50!=0?(0,c.jsx)(n.T,{size:13,colour:r.colours.goldLight,center:!0,children:(0,h.staffingWord)(x,i)}):null]})}function w({q:e,mine:t,manager:s,onHide:o,onReply:i,by:a}){const d=e.yes+e.no,h=d?Math.round(e.yes/d*100):0;return(0,c.jsx)(n.Card,{style:e.hidden?{opacity:.75}:void 0,children:(0,c.jsxs)(l.default,{testID:"hr-question-card",style:{gap:8},children:[(0,c.jsxs)(n.Row,{gap:8,style:{alignItems:'flex-start'},children:[(0,c.jsx)(n.T,{style:{flex:1,minWidth:0},children:e.body}),e.hidden?(0,c.jsx)(n.Badge,{kind:"amber",label:"HIDDEN"}):null]}),(0,c.jsxs)(n.Muted,{size:12,children:["Asked ",y(e.postedOn)," \xb7 anonymous"]}),'up'===e.kind?(0,c.jsx)(n.Row,{gap:8,wrap:!0,children:(0,c.jsx)(n.Button,{small:!0,testID:"hr-vote-up",kind:t?'success':'secondary',label:t?`\u25b2 Voted \xb7 ${e.up}`:`\u25b2 Vote up \xb7 ${e.up}`,disabled:!!t||e.hidden,onPress:()=>u.useHr.getState().vote(e.id,1)})}):(0,c.jsxs)(l.default,{style:{gap:6},children:[(0,c.jsxs)(n.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(n.Button,{small:!0,testID:"hr-vote-yes",kind:1===t?'success':'secondary',label:`Yes \xb7 ${e.yes}`,disabled:!!t||e.hidden,onPress:()=>u.useHr.getState().vote(e.id,1)}),(0,c.jsx)(n.Button,{small:!0,testID:"hr-vote-no",kind:-1===t?'success':'secondary',label:`No \xb7 ${e.no}`,disabled:!!t||e.hidden,onPress:()=>u.useHr.getState().vote(e.id,-1)})]}),d?(0,c.jsx)(l.default,{style:{height:6,borderRadius:3,backgroundColor:r.colours.border,overflow:'hidden'},children:(0,c.jsx)(l.default,{style:{width:`${h}%`,height:6,backgroundColor:r.colours.gold}})}):null,d?(0,c.jsxs)(n.Muted,{size:12,children:[h,"% yes from ",d," vote",1===d?'':'s']}):null]}),t?(0,c.jsx)(n.Muted,{size:12,children:"You\u2019ve voted. Votes are anonymous."}):null,e.reply?(0,c.jsxs)(l.default,{style:{borderLeftWidth:3,borderColor:r.colours.gold,paddingLeft:10,gap:2},children:[(0,c.jsx)(n.T,{size:13,weight:"semibold",colour:r.colours.goldLight,children:"Reply from the managers"}),(0,c.jsx)(n.T,{size:14,children:e.reply})]}):null,s?(0,c.jsxs)(n.Row,{gap:8,wrap:!0,children:[(0,c.jsx)(n.Button,{small:!0,kind:"ghost",testID:"hr-reply",label:e.reply?'Edit reply':'Reply',onPress:i}),e.hidden?(0,c.jsx)(n.Button,{small:!0,kind:"ghost",testID:"hr-unhide",label:"Show again",onPress:()=>u.useHr.getState().moderate(e.id,'unhide','',a)}):(0,c.jsx)(n.Button,{small:!0,kind:"ghost",testID:"hr-hide",label:"Hide",onPress:o})]}):null]})})}const S=(e,t)=>{const s=new Date(`${e}T12:00:00Z`);return s.setUTCDate(s.getUTCDate()+t),s.toISOString().slice(0,10)};function k(e){const t={};for(const s of e)'cancelled'!==s.status&&'noshow'!==s.status&&(t[s.date]=(t[s.date]??0)+(s.partySize||0));return t}function C(e){let t=0;for(const s of e)t=(31*t+s.charCodeAt(0))%997;return 40+t%90}const v=[{k:'intro',label:'Opening line'},{k:'morale',label:'Morale question'},{k:'moraleLow',label:'Morale: low end'},{k:'moraleHigh',label:'Morale: high end'},{k:'staffing',label:'Staffing question'},{k:'staffLow',label:'Staffing: left'},{k:'staffMid',label:'Staffing: middle'},{k:'staffHigh',label:'Staffing: right'},{k:'question',label:'Question prompt'},{k:'shout',label:'Shout-out prompt'}]},997,[875,30,263,127,813,821,854,870,1020,1150,1151,24]); +__d(function(g,r,_i,_a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ChatAsCtx",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"CHANNELS",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"dmId",{enumerable:!0,get:function(){return p.dmId}}),Object.defineProperty(_e,"inChannel",{enumerable:!0,get:function(){return p.inChannel}}),_e.autoPost=function(e,t){const n=new Date(globalThis.__ccNow??Date.now()).toISOString();(Array.isArray(e)?e:[e]).forEach(e=>u.useOwner.getState().sys(e,t,n))},_e.ensureChat=O,_e.useChatUnread=R,_e.Chat=function({go:e}){return(0,y.jsx)(M,{children:(0,y.jsx)(z,{go:e})})};var t=r(d[0]),n=r(d[1]),s=r(d[2]),a=r(d[3]),o=r(d[4]),i=r(d[5]),l=e(r(d[6])),c=e(r(d[7])),h=r(d[8]),u=r(d[9]),m=r(d[10]),f=r(d[11]),x=r(d[12]),b=r(d[13]),p=r(d[14]),j=r(d[15]),y=r(d[16]);const w=(0,o.createContext)(null);function C(e){const t=(0,x.useCtx)(e),n=(0,o.useContext)(w);return n?{...t,meId:n.meId,role:n.role}:t}const v=[{id:'all',name:'Team',icon:'\ud83d\udce2'},{id:'kitchen',name:'Kitchen',icon:'\ud83c\udf73',pinned:!0},{id:'foh',name:'Front of house',icon:'\ud83c\udf7d\ufe0f'},{id:'managers',name:'Managers',icon:'\ud83d\udd11'}],S=[],k=e=>(e??'').replace(' (example)','');function O(e){if(s.LIVE_VENUE_BUILD)return;if(a.IS_WILDINGS)return;const t=u.useOwner.getState();if(t.chat.some(e=>'m-seed-all'===e.id&&/this phone only/.test(e.text??''))&&u.useOwner.getState().chatPatch('m-seed-all',{text:'Welcome to the team chat on CoverCharge.'}),t.chat.length)return;const n=(t,n,s,a={})=>{return{id:`m-seed-${t}`,ch:t,from:'system',text:s,at:(o=n,new Date(e.getTime()-6e4*o).toISOString()),reactions:{},seenBy:[],...a};var o};u.useOwner.setState({chat:[n('all',5,'Welcome to the team chat on CoverCharge.',{pinned:!0}),n('kitchen',4,'Kitchen channel: Head Chef, kitchen team and managers.'),n('foh',3,'Front of house channel: front of house, bar and managers.'),n('managers',2,'Managers channel: owners, managers and the supervisor only.')]})}function R(){const{meId:e}=C(3e4),{role:t}=C(3e4),n=(0,u.useOwner)(e=>e.chat),s=(0,u.useOwner)(e=>e.staff),a=(0,u.useOwner)(t=>t.chatMuted[e]??S),i=(0,o.useMemo)(()=>T(s,e,t),[s,e,t]);return(0,o.useMemo)(()=>{const t={};return n.forEach(n=>{n.removed||n.from===e||n.seenBy.includes(e)||!(0,p.inChannel)(n.ch,i)||(t[n.ch]=(t[n.ch]??0)+1)}),{by:t,total:Object.entries(t).filter(([e])=>!a.includes(e)).reduce((e,[,t])=>e+t,0)}},[n,e,a,i])}function T(e,t,n){const s=e.find(e=>e.id===t);return s||!t?s:{id:t,name:'You',role:n,job:'',active:!0,level:'owner'===n?'Owner':'manager'===n?'Manager':'Staff',dept:''}}class M extends o.Component{state={err:null};static getDerivedStateFromError(e){return{err:String(e?.message??e)}}componentDidUpdate(e){e.resetKey!==this.props.resetKey&&this.state.err&&this.setState({err:null})}render(){return this.state.err?(0,y.jsxs)(c.default,{style:{gap:10},testID:"chat-error",children:[(0,y.jsx)(h.Banner,{kind:"warn",title:"Chat couldn\u2019t open",children:"Something went wrong showing this chat. Your messages are still saved on this phone. Go back and try again; if it keeps happening, close and reopen the app."}),(0,y.jsx)(h.Button,{kind:"secondary",label:"Back to chats",onPress:()=>{this.setState({err:null}),this.props.onBack?.()}})]}):this.props.children}}const I={owner:f.colours.gold,manager:f.colours.blue,staff:'#7a6f5c'};function P({s:e,size:n=34}){return e?(0,y.jsx)(b.StaffAvatar,{id:e.id,size:n}):(0,y.jsx)(c.default,{style:{width:n,height:n,borderRadius:n/2,backgroundColor:(0,t.soutersSurface)('#333'),alignItems:'center',justifyContent:'center'},children:(0,y.jsx)(h.T,{size:.38*n,weight:"bold",colour:"#111",children:"CC"})})}const B=[{caption:'Specials board',tone:'#4A3A22'},{caption:'Plating: Cullen skink',tone:'#3E2A2A'},{caption:'Delivery arrived',tone:'#40362A'},{caption:'Spillage by the bar',tone:'#2E2E40'}],D=['\ud83d\udc4d','\u2764\ufe0f','\ud83d\ude04','\ud83d\udc4f','\ud83d\udd25'];function E({ch:e,go:s,back:a}){const{now:b,meId:w,role:S,today:O}=C(1e4),R=(0,u.useOwner)(e=>e.staff),T=(0,u.useOwner)(e=>e.chat),M=(0,u.useOwner)(e=>e.shifts),E=T.filter(t=>t.ch===e).sort((e,t)=>e.at.localeCompare(t.at)),[z,A]=(R.find(e=>e.id===w),(0,o.useState)('')),[L,$]=(0,o.useState)(null),[N,_]=(0,o.useState)(!1),[W,H]=(0,o.useState)(!1),K=e.startsWith('dm:')?e.split(':').slice(1).length:R.filter(t=>t.active&&(0,p.inChannel)(e,t)).length;(0,o.useEffect)(()=>{u.useOwner.getState().chatSeen(e,w)},[e,w,E.length]);const U=t=>u.useOwner.getState().chatSend({ch:e,from:w,at:b.toISOString(),...t});(0,i.useBackLayer)(!0,a);const Y=E.filter(e=>e.pinned&&!e.removed),V=e.startsWith('dm:')?k(R.find(t=>t.id===e.split(':').slice(1).find(e=>e!==w))?.name):v.find(t=>t.id===e)?.name,F=(0,j.useChatSync)(e=>e.synced),q=M.filter(e=>e.staffId===w&&e.published&&e.date>=O).sort((e,t)=>e.date.localeCompare(t.date)).slice(0,10);return(0,y.jsxs)(c.default,{style:{gap:8},children:[(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(i.BackButton,{onPress:a,testID:"chat-thread-back"}),(0,y.jsxs)(c.default,{style:{flex:1,alignItems:'flex-end'},children:[(0,y.jsx)(h.T,{weight:"semibold",size:18,children:V}),(0,y.jsxs)(h.Muted,{children:[K," members"]})]})]}),Y.map(e=>(0,y.jsxs)(h.Card,{highlight:f.colours.gold,children:[(0,y.jsxs)(h.T,{size:12,colour:f.colours.gold,children:["\ud83d\udccc ",'system'===e.from?'Pinned note':`Pinned by ${k(R.find(t=>t.id===e.from)?.name)}`]}),(0,y.jsx)(h.T,{size:14,children:e.text})]},e.id)),E.map((n,a)=>{const o=R.find(e=>e.id===n.from),i=n.from===w,x=n.seenBy.filter(e=>e!==n.from).length,b=0===a||n.at.slice(0,10)!==E[a-1].at.slice(0,10);return'system'===n.from?(0,y.jsxs)(c.default,{style:{alignItems:'center',gap:2},children:[b?(0,y.jsx)(h.Muted,{children:(0,m.niceDate)(new Date(n.at))}):null,(0,y.jsx)(c.default,{style:{backgroundColor:(0,t.soutersSurface)('#1c1a14'),borderRadius:10,paddingHorizontal:10,paddingVertical:5,borderWidth:1,borderColor:f.colours.border},children:(0,y.jsxs)(h.T,{size:13,colour:/Allergy|86|Sold out/.test(n.text??'')?f.colours.amber:f.colours.muted,children:["CoverCharge \xb7 ",n.text," \xb7 ",(0,m.hm)(new Date(n.at))]})})]},n.id):(0,y.jsxs)(c.default,{style:{gap:2},children:[b?(0,y.jsx)(h.Muted,{center:!0,children:(0,m.niceDate)(new Date(n.at))}):null,(0,y.jsxs)(h.Row,{style:{alignItems:'flex-start',flexDirection:i?'row-reverse':'row'},children:[(0,y.jsx)(P,{s:o}),(0,y.jsxs)(l.default,{accessibilityRole:"button",accessibilityLabel:`Message from ${o?.name}`,onPress:()=>$(L===n.id?null:n.id),style:{maxWidth:'78%',backgroundColor:i?'#3a2f12':f.colours.surface,borderRadius:14,padding:9,borderWidth:1,borderColor:n.pinned?f.colours.gold:f.colours.border,gap:3},children:[(0,y.jsxs)(h.Row,{gap:6,children:[(0,y.jsx)(h.T,{size:12,weight:"semibold",colour:o?I[o.role]:f.colours.muted,children:k(o?.name)}),(0,y.jsxs)(h.T,{size:11,colour:f.colours.muted,children:[o?u.ROLE_LABEL[o.role]:''," \xb7 ",(0,m.hm)(new Date(n.at))]})]}),n.removed?(0,y.jsx)(h.T,{size:14,colour:f.colours.muted,children:"Message removed by the owner"}):(0,y.jsxs)(y.Fragment,{children:[n.photo?(0,y.jsx)(c.default,{style:{width:200,height:120,borderRadius:10,backgroundColor:n.photo.tone,justifyContent:'flex-end',padding:6},children:(0,y.jsxs)(h.T,{size:12,children:[n.photo.caption," (example image)"]})}):null,n.text?(0,y.jsx)(h.T,{size:15,children:n.text}):null,'cover'===n.action?(0,y.jsx)(h.Button,{small:!0,kind:"secondary",label:"Open cover requests on the rota",onPress:()=>s('more','rota')}):null]}),Object.entries(n.reactions).filter(([,e])=>e.length).length?(0,y.jsx)(h.Row,{wrap:!0,gap:4,children:Object.entries(n.reactions).filter(([,e])=>e.length).map(([e,t])=>(0,y.jsx)(c.default,{style:{borderRadius:10,paddingHorizontal:6,backgroundColor:t.includes(w)?'#4a3c16':'#222'},children:(0,y.jsxs)(h.T,{size:12,children:[e," ",t.length]})},e))}):null,i?(0,y.jsx)(h.T,{size:11,colour:f.colours.muted,children:x?`Seen by ${x}`:'Sent'}):null]})]}),L!==n.id||n.removed?null:(0,y.jsxs)(h.Row,{wrap:!0,gap:6,style:{justifyContent:i?'flex-end':'flex-start',paddingLeft:i?0:40},children:[D.map(e=>(0,y.jsx)(l.default,{accessibilityLabel:`React ${e}`,onPress:()=>{u.useOwner.getState().chatReact(n.id,e,w),$(null)},style:{padding:4},children:(0,y.jsx)(h.T,{size:20,children:e})},e)),'staff'===S||e.startsWith('dm:')?null:(0,y.jsx)(h.Button,{small:!0,kind:"ghost",label:n.pinned?'Unpin':'Pin',onPress:()=>{u.useOwner.getState().chatPatch(n.id,{pinned:!n.pinned}),$(null)}}),'owner'!==S||i?null:(0,y.jsx)(h.Button,{small:!0,kind:"danger",label:"Remove",onPress:()=>{u.useOwner.getState().chatPatch(n.id,{removed:!0,pinned:!1}),$(null)}})]})]},n.id)}),(0,y.jsxs)(h.Row,{gap:6,children:[(0,y.jsx)(l.default,{accessibilityRole:"button",accessibilityLabel:"Send a photo",onPress:()=>_(!0),style:{padding:8},children:(0,y.jsx)(h.T,{size:20,children:"\ud83c\udf9e\ufe0f"})}),(0,y.jsx)(n.TextInput,{accessibilityLabel:"Message",placeholder:`Message ${V}`,placeholderTextColor:"#7D776C",value:z,onChangeText:A,style:[h.styles.input,{flex:1}]}),(0,y.jsx)(h.Button,{small:!0,label:"Send",disabled:!z.trim(),onPress:()=>{U({text:z.trim()}),A('')}})]}),(0,y.jsx)(h.Row,{wrap:!0,gap:6,children:(0,y.jsx)(h.Button,{small:!0,kind:"secondary",label:"Ask for shift cover",onPress:()=>H(!0)})}),F?null:(0,y.jsx)(h.Muted,{center:!0,children:"Not shared yet: this message stays on this phone only. Nobody else will see it."}),(0,y.jsx)(h.Sheet,{visible:N,onClose:()=>_(!1),title:"Send a photo",children:(0,y.jsx)(h.Row,{wrap:!0,gap:8,children:B.map(e=>(0,y.jsx)(l.default,{accessibilityRole:"button",accessibilityLabel:e.caption,onPress:()=>{U({photo:e}),_(!1)},style:{width:'47%',height:100,borderRadius:10,backgroundColor:e.tone,justifyContent:'flex-end',padding:6},children:(0,y.jsx)(h.T,{size:12,children:e.caption})},e.caption))})}),(0,y.jsxs)(h.Sheet,{visible:W,onClose:()=>H(!1),title:"Ask for shift cover",children:[q.length?null:(0,y.jsx)(h.Muted,{children:"You have no shifts on the rota this week."}),q.map(e=>(0,y.jsx)(h.Button,{kind:"secondary",label:`${x.DAY3[e.day]} ${Number(e.date.slice(8))} ${(0,x.fmtH)(e.start)}\u2013${(0,x.fmtH)(e.end)}`,onPress:()=>{const t=`${x.DAY3[e.day]} ${Number(e.date.slice(8))} ${(0,x.fmtH)(e.start)}\u2013${(0,x.fmtH)(e.end)}`;u.useOwner.getState().addSwap({shiftId:e.id,fromId:w,kind:'cover',note:`Cover asked in chat for ${t}`}),U({text:`Can anyone cover my ${t} shift? I\u2019ve added a cover request on the rota.`,action:'cover'}),H(!1)}},e.id)),(0,y.jsx)(h.Muted,{children:"Creates a cover request in Rota \u203a Swaps & leave for a manager to approve."})]})]})}function z({go:e}){const{now:n,meId:s,role:a}=C(3e4),i=(0,u.useOwner)(e=>e.staff),x=(0,u.useOwner)(e=>e.chat),b=(0,u.useOwner)(e=>e.chatMuted[s]??S),{by:w}=R(),I=(0,j.useChatSync)(e=>e.synced),B=(0,j.useChatSync)(e=>e.error),D=(0,p.useKitchenExtra)(e=>e.extra),[z,A]=(0,o.useState)(null),[L,$]=(0,o.useState)(!1),[N,_]=(0,o.useState)(!1);(0,o.useEffect)(()=>{O(n)},[]),(0,o.useEffect)(()=>{A(null)},[s]);const W=T(i,s,a);if(z)return(0,y.jsx)(M,{resetKey:z,onBack:()=>A(null),children:(0,y.jsx)(E,{ch:z,go:e,back:()=>A(null)})});const H=e=>x.filter(t=>t.ch===e).sort((e,t)=>t.at.localeCompare(e.at))[0],K=i.filter(e=>e.active&&e.id!==s).map(e=>{const t=(0,p.dmId)(s,e.id);return{x:e,id:t,u:w[t]??0,l:H(t)?.at??''}}).sort((e,t)=>t.u-e.u||t.l.localeCompare(e.l)||k(e.x.name).localeCompare(k(t.x.name))),U='owner'===a||'manager'===a,Y=({id:e,name:n,icon:s,avatar:a})=>{const o=H(e),u=w[e]??0,x=b.includes(e);return(0,y.jsx)(l.default,{accessibilityRole:"button",accessibilityLabel:`Open ${n}`,onPress:()=>A(e),style:{padding:12,borderTopWidth:1,borderColor:f.colours.border},children:(0,y.jsxs)(h.Row,{children:[a?(0,y.jsx)(P,{s:a}):(0,y.jsx)(c.default,{style:{width:34,height:34,borderRadius:17,backgroundColor:(0,t.soutersSurface)('#222'),alignItems:'center',justifyContent:'center'},children:(0,y.jsx)(h.T,{size:16,children:s})}),(0,y.jsxs)(c.default,{style:{flex:1},children:[(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsxs)(h.T,{weight:u?'bold':'medium',children:[n,x?' \ud83d\udd15':'']}),o?(0,y.jsx)(h.Muted,{children:(0,m.hm)(new Date(o.at))}):null]}),(0,y.jsx)(h.Muted,{numberOfLines:1,children:o?o.removed?'Message removed':`${'system'===o.from?'CoverCharge':k(i.find(e=>e.id===o.from)?.name)}: ${o.text??'Photo'}`:'No messages yet'})]}),u?(0,y.jsx)(c.default,{style:{backgroundColor:x?'#555':f.colours.red,borderRadius:10,minWidth:20,height:20,alignItems:'center',justifyContent:'center',paddingHorizontal:5},children:(0,y.jsx)(h.T,{size:11,weight:"bold",children:u})}):null]})})};return(0,y.jsxs)(c.default,{style:{gap:10},children:[I?(0,y.jsx)(c.default,{testID:"chat-synced",children:(0,y.jsx)(h.Muted,{children:"\u2713 Shared with the team: messages reach everyone in the chat on their own phone."})}):(0,y.jsx)(h.Banner,{kind:"warn",title:"On this device only for now",children:"You\u2019re not connected with your personal link (or chat sharing isn\u2019t switched on yet), so anything you send stays on this device and nobody else will see it. Open your personal invite link to share chat with the team. Use your usual group chat for anything urgent."}),I&&B?(0,y.jsx)(c.default,{testID:"chat-sync-error",children:(0,y.jsx)(h.Banner,{kind:"warn",title:"Can\u2019t reach the server right now",children:"Showing the messages on this phone. New messages will be sent and others\u2019 messages will appear when the connection is back; it retries automatically."})}):null,(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsxs)(h.Muted,{children:["Signed in as ",k(W?.name)," (",'Head Chef'===W?.level?'Head Chef':u.ROLE_LABEL[a],")"]}),(0,y.jsx)(h.Button,{small:!0,kind:"ghost",label:"Chat settings",onPress:()=>_(!0)})]}),(0,y.jsxs)(c.default,{style:{borderRadius:14,borderWidth:1,borderColor:f.colours.border,backgroundColor:f.colours.surface,overflow:'hidden'},children:[(0,y.jsx)(h.T,{size:12,weight:"semibold",colour:f.colours.gold,style:{padding:10},children:"TEAM CHATS"}),v.filter(e=>'all'===e.id||(0,p.inChannel)(e.id,W)).map(e=>(0,y.jsx)(Y,{id:e.id,name:e.pinned?`${e.name} \ud83d\udccc`:e.name,icon:e.icon},e.id))]}),(0,y.jsxs)(c.default,{style:{borderRadius:14,borderWidth:1,borderColor:f.colours.border,backgroundColor:f.colours.surface,overflow:'hidden'},children:[(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between',padding:10},children:[(0,y.jsx)(h.T,{size:12,weight:"semibold",colour:f.colours.gold,children:"PRIVATE MESSAGES"}),(0,y.jsx)(h.Button,{small:!0,kind:"success",label:"New message",testID:"chat-new-pm",onPress:()=>$(!0)})]}),K.map(e=>(0,y.jsx)(Y,{id:e.id,name:k(e.x.name),avatar:e.x},e.id)),K.length?null:(0,y.jsx)(h.Muted,{style:{padding:10},children:"Nobody else on the team yet."})]}),(0,y.jsx)(h.Muted,{children:"Private messages can only be read by the two people in them; owners and managers can\u2019t read other people\u2019s private messages. The Kitchen chat is for owners, managers, head chefs and kitchen staff, and can\u2019t be left."}),(0,y.jsx)(h.Sheet,{visible:L,onClose:()=>$(!1),title:"New private message",children:i.filter(e=>e.active&&e.id!==s).map(e=>(0,y.jsx)(l.default,{accessibilityRole:"button",accessibilityLabel:`Message ${e.name}`,onPress:()=>{$(!1),A((0,p.dmId)(s,e.id))},style:{paddingVertical:8},children:(0,y.jsxs)(h.Row,{children:[(0,y.jsx)(P,{s:e}),(0,y.jsxs)(c.default,{children:[(0,y.jsx)(h.T,{children:k(e.name)}),(0,y.jsxs)(h.Muted,{children:[u.ROLE_LABEL[e.role]," \xb7 ",e.job]})]})]})},e.id))}),(0,y.jsxs)(h.Sheet,{visible:N,onClose:()=>_(!1),title:"Chat settings",children:[(0,y.jsx)(h.Banner,{kind:"info",title:"Privacy",children:"Chat is for work. Managers and the owner see messages in the channels they belong to and the owner can remove messages in group chats. Private messages can only be read by the two people in them: the server enforces this, so nobody else (not even the owner) can read them. Don\u2019t share customer card or health details beyond what\u2019s needed for service."}),(0,y.jsx)(h.T,{weight:"semibold",children:"Mute channels"}),v.filter(e=>(0,p.inChannel)(e.id,W)).map(e=>(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsxs)(h.T,{children:[e.icon," ",e.name]}),(0,y.jsx)(h.Toggle,{label:`Mute ${e.name}`,value:b.includes(e.id),onChange:()=>u.useOwner.getState().chatMute(s,e.id)})]},e.id)),(0,y.jsx)(h.Muted,{children:"Muted channels don\u2019t count towards the tab badge. The Kitchen chat can be muted but not left."}),U?(0,y.jsxs)(c.default,{style:{gap:6},testID:"kitchen-members",children:[(0,y.jsx)(h.T,{weight:"semibold",children:"Kitchen chat members"}),(0,y.jsxs)(h.Muted,{children:["Automatic: owners, managers, head chefs and kitchen staff (chefs, kitchen porters). Change who else is in it here",I?'':'; saved on this device for now',"."]}),i.filter(e=>e.active).map(e=>{const t=D[e.id]??(0,p.kitchenByRule)(e);return(0,y.jsxs)(h.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsxs)(h.T,{children:[k(e.name),null!=D[e.id]?' (changed)':'']}),(0,y.jsx)(h.Toggle,{label:`Kitchen chat: ${k(e.name)}`,value:t,onChange:t=>p.useKitchenExtra.getState().set(e.id,t===(0,p.kitchenByRule)(e)?null:t)})]},e.id)})]}):null]})]})}},998,[912,875,833,5,30,990,263,127,813,854,818,821,926,952,1117,1208,24]); +__d(function(g,r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SNOOZE_MINS",{enumerable:!0,get:function(){return S}}),e.useScheduledNotices=function({rid:d,staffId:S,name:h,onOpen:w}){const D=(0,t.useRef)(h);D.current=h;const I=(0,t.useRef)(w);I.current=w,(0,t.useEffect)(()=>{if('undefined'==typeof window||!window.location?.search)return;const t=new URLSearchParams(window.location.search);'orderlists'===t.get('open')&&(o.useListOpen.getState().request(t.get('list')??void 0),setTimeout(()=>I.current?.('orderlists'),0))},[]);const N=(0,s.useNotifs)(t=>t.items.map(t=>`${t.id}:${t.updatedAt??''}`).join()),v=(0,c.useReminders)(t=>t.done.length);(0,t.useEffect)(()=>{s.useNotifs.getState().ensure(d);const t=()=>{const t=p(),h=s.useNotifs.getState(),w=n.useOwner.getState().staff.map(t=>({id:t.id,role:t.role,level:t.level,job:t.job,department:t.dept,active:t.active})),N=w.filter(s=>!1!==s.active&&(0,l.shiftNow)(s.id,t).on).map(t=>t.id);for(const n of h.items){if(n.rid!==d)continue;const l=`sched:${n.id}`;if(!S||n.removed||n.paused||!n.sendBy.inApp||!(0,u.isRecipient)(n,S,w,N)){(0,f.dismissNotice)(l);continue}const{due:v,forDate:O}=(0,u.notifDue)(n,t),b=c.useReminders.getState().done.find(t=>t.reminderId===n.id&&t.forDate===O),R=`sched:${n.id}:${O}`;!v||b||(h.snooze[R]??0)>t?(0,f.dismissNotice)(l):(0,f.notify)({id:l,icon:'\ud83d\udd14',kicker:'NOTICE',title:n.title,body:n.message,testID:'sched-notice',timeoutMs:null,actions:[{label:'Done',testID:'sched-notice-done',onPress:()=>c.useReminders.getState().markDone({rid:d,reminderId:n.id,forDate:O,at:new Date(p()).toISOString(),staffRef:S,staffName:D.current.replace(' (example)','')})},...'orderlists'===n.open?.page&&I.current?[{label:'Open list',testID:'sched-notice-open',onPress:()=>{o.useListOpen.getState().request(n.open?.list),I.current?.('orderlists')}}]:[],{label:'Later',kind:'ghost',testID:'sched-notice-later',onPress:()=>s.useNotifs.getState().setSnooze(R,p()+9e5)}]})}};t();const h=setInterval(t,2e4);return()=>clearInterval(h)},[d,S,N,v])};var t=r(_d[0]),s=r(_d[1]),n=r(_d[2]),o=r(_d[3]),c=r(_d[4]),d=r(_d[5]),u=r(_d[6]),f=r(_d[7]),l=r(_d[8]);const p=()=>{try{return(0,d.nowFrom)(d.useStore.getState().clock).getTime()}catch{return Date.now()}},S=15},999,[30,955,854,1003,956,870,957,946,958]); +__d(function(g,_r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.useOffRotaPrompt=function({rid:r,staffId:k}){const w=(0,o.useRef)(!1),h=(0,n.useClockArea)(o=>{const n=o.areas[r];return!(0,t.privateClockVenue)(r)&&!!n&&!1!==n.offRotaPrompt&&null!=n.lat});(0,o.useEffect)(()=>{if(!h||!k)return;const t=async()=>{if(w.current||'undefined'!=typeof document&&'hidden'===document.visibilityState)return;const t=(0,n.areaOf)(r);if(!(0,a.areaSet)(t)||!t.offRotaPrompt)return;const o=l(),y=(0,f.ukClock)(o).ymd,h=`${y}:${k}`,b=s.useOwner.getState();if(n.useClockArea.getState().visiting[h]||(0,s.openShiftOf)(b.attendance,k,new Date(o)))return void(0,d.dismissNotice)('off-rota');if(!await(0,c.locationAllowed)())return;w.current=!0;const v=await(0,c.getFix)();if(w.current=!1,'object'!=typeof v)return;const S=new Date(o),I=b.shifts.filter(t=>t.staffId===k&&t.date===y&&!1!==t.published);(0,a.offRotaDue)({area:t,inside:(0,a.isInside)(t,v).inside,clockedIn:!1,shifts:I,nowHours:S.getHours()+S.getMinutes()/60,dismissedToday:!1})?(0,d.notify)({id:'off-rota',icon:'\ud83d\udccd',kicker:'AT THE VENUE',title:t.offRotaTitle,body:t.offRotaBody,testID:'off-rota',timeoutMs:null,actions:[{label:'Yes, clock me in',testID:'off-rota-yes',onPress:()=>{(0,u.clockAction)('in',{rid:r,staffId:k,date:y,at:new Date(l()).toISOString(),offRota:!0}).then(t=>{(0,d.notify)(t.ok?{id:'off-rota-done',title:'Clocked in',body:'Your manager will see you weren\u2019t on the rota today.',timeoutMs:6e3}:{id:'off-rota-done',tone:'warn',title:'Not clocked in',body:t.message,timeoutMs:9e3})})}},{label:'No, just visiting',kind:'ghost',testID:'off-rota-no',onPress:()=>n.useClockArea.getState().setVisiting(h)}]}):(0,d.dismissNotice)('off-rota')};t();const o=setInterval(()=>{t()},y),b=()=>{'visible'===document.visibilityState&&t()};return'undefined'!=typeof document&&document.addEventListener('visibilitychange',b),()=>{clearInterval(o),'undefined'!=typeof document&&document.removeEventListener('visibilitychange',b)}},[r,k,h])},e.useOffRotaAlerts=function({enabled:t}){const n=(0,o.useRef)(new Set),r=(0,s.useOwner)(t=>t.attendance);(0,o.useEffect)(()=>{if(!t)return;const o=(0,f.ukClock)(l()).ymd;for(const t of r){if(!t.offRota||t.date!==o||n.current.has(t.id))continue;n.current.add(t.id);const r=s.useOwner.getState().staff.find(o=>o.id===t.staffId)?.name??'Someone',a=t.in?new Date(t.in).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit',timeZone:'Europe/London'}):'';(0,d.notify)({id:`off-rota-mgr:${t.id}`,icon:'\ud83d\udccd',kicker:'NOT ON THE ROTA',title:`${r} clocked in at ${a}`,body:'They weren\u2019t on today\u2019s rota. Check Hours if that\u2019s not right.',timeoutMs:null,actions:[{label:'OK',testID:'off-rota-mgr-ok',onPress:()=>{}}]})}},[r,t])};var t=_r(_d[0]),o=_r(_d[1]),n=_r(_d[2]),s=_r(_d[3]),r=_r(_d[4]),a=_r(_d[5]),f=_r(_d[6]),c=_r(_d[7]),d=_r(_d[8]),u=_r(_d[9]);const l=()=>{try{return(0,r.nowFrom)(r.useStore.getState().clock).getTime()}catch{return Date.now()}},y=24e4},1000,[987,30,1206,854,870,953,1107,1273,946,1102]); +__d(function(g,r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.ListBadge=C,_e.OrderListsScreen=function({rid:e,who:t,editor:s,today:i}){(0,o.useEffect)(()=>{x.useOrderLists.getState().ensure(e)},[e]);const d=(0,x.useOrderLists)(e=>e.lists).filter(t=>t.rid===e&&!t.archived),n=(0,x.useOrderLists)(e=>e.items);(0,x.useOrderLists)(t=>t.settings[e]);const l=(0,x.orderSettingsOf)(e).allowStaff,h=(0,x.useListOpen)(e=>e.seed),[y,j]=(0,o.useState)(null);(0,o.useEffect)(()=>{if(!h)return;const e=d.find(e=>e.seed===h);e&&(j(e.id),x.useListOpen.getState().request(void 0))},[h,d.length]);const f=s||l;if(!s&&!l)return(0,w.jsxs)(c.Card,{children:[(0,w.jsx)(c.T,{children:"Order lists are for managers and the Head Chef here."}),(0,w.jsx)(c.Muted,{children:"Ask a manager to switch on \u201cLet all staff add items\u201d."})]});const b=d.find(e=>e.id===y);if(b)return(0,w.jsx)($,{rid:e,list:b,editor:s,canAdd:f,who:t,today:i,onBack:()=>j(null)});const I=(0,x.orderSettingsOf)(e).defaultTripDay;return(0,w.jsxs)(u.default,{style:{gap:10},testID:"order-lists",children:[(0,w.jsxs)(c.Muted,{size:13,children:["Tip: add what\u2019s running low as you notice it. ",s?'On the day, tick what you got, then Finish order.':'A manager or the Head Chef places the order.']}),d.map(t=>{const s=(0,p.liveItems)(n.filter(t=>t.rid===e),t.id).filter(e=>'open'===e.status).length;return(0,w.jsx)(c.Card,{onPress:()=>j(t.id),children:(0,w.jsx)(u.default,{testID:`order-list-card-${t.seed??t.id}`,children:(0,w.jsxs)(c.Row,{gap:10,children:[(0,w.jsx)(C,{list:t}),(0,w.jsxs)(u.default,{style:{flex:1},children:[(0,w.jsx)(c.T,{weight:"semibold",children:t.name}),(0,w.jsx)(c.Muted,{size:12,children:(0,p.tripText)(t,i,I)})]}),(0,w.jsx)(c.Badge,{kind:s?'gold':'neutral',label:`${s} to get`})]})})},t.id)}),d.length?null:(0,w.jsx)(c.Muted,{children:"No order lists yet. Add one in Settings \u203a Advanced \u203a Order lists."})]})};var t=r(_d[0]),s=r(_d[1]),i=r(_d[2]),o=r(_d[3]),d=e(r(_d[4])),n=e(r(_d[5]));r(_d[6]);var l=e(r(_d[7])),u=e(r(_d[8])),c=r(_d[9]),h=r(_d[10]),x=r(_d[11]),p=r(_d[12]),y=r(_d[13]),j=r(_d[14]),f=r(_d[15]),b=r(_d[16]),w=r(_d[17]);const I={minHeight:44,borderRadius:10,borderWidth:1,borderColor:h.colours.hairline,backgroundColor:h.colours.surface2,color:h.colours.text,paddingHorizontal:10,fontSize:15},L=e=>e?new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',weekday:'short',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'}):'',v=e=>e.replace(' (example)','').split(' ')[0];function C({list:e,size:s=40}){const i=(0,f.useLogoCache)(t=>t.byList[e.id]),[n,l]=(0,o.useState)(null);(0,o.useEffect)(()=>{let t=!0;return!i&&e.logo&&(0,b.orderLogoUrl)(e.logo).then(e=>{t&&l(e)}),()=>{t=!1}},[e.logo,i]);const x=i??n;return x?(0,w.jsx)(d.default,{testID:`list-logo-${e.seed??e.id}`,source:{uri:x},accessibilityLabel:`${e.name} logo`,style:{width:s,height:s,borderRadius:s/2,borderWidth:1,borderColor:h.colours.gold}}):(0,w.jsx)(u.default,{testID:`list-initials-${e.seed??e.id}`,accessibilityLabel:`${e.name}`,style:{width:s,height:s,borderRadius:s/2,backgroundColor:(0,t.soutersSurface)('#1c1a16'),borderWidth:1,borderColor:h.colours.gold,alignItems:'center',justifyContent:'center'},children:(0,w.jsx)(c.T,{size:.38*s,weight:"bold",colour:h.colours.gold,children:(0,p.initials)(e.name)})})}function D({phone:e}){const t=(0,p.telHref)(e);if(!e||!t)return null;return'undefined'!=typeof navigator&&/Android|iPhone|iPad|iPod/i.test(navigator.userAgent)?(0,w.jsx)(l.default,{testID:"list-phone",accessibilityRole:"link",onPress:()=>{n.default.openURL(t)},children:(0,w.jsxs)(c.T,{colour:h.colours.gold,children:["\ud83d\udcde Call ",e]})}):(0,w.jsxs)(c.Row,{gap:8,children:[(0,w.jsx)(u.default,{testID:"list-phone",children:(0,w.jsxs)(c.T,{children:["\ud83d\udcde ",e]})}),(0,w.jsx)(c.Button,{small:!0,kind:"ghost",testID:"list-phone-copy",label:"Copy",onPress:()=>{navigator.clipboard?.writeText(e).then(()=>(0,y.notify)({id:'copied',title:'Number copied',timeoutMs:3e3}))}})]})}function T({list:e}){const t=x.useOrderLists.getState(),s=(0,f.useLogoCache)(t=>!!t.byList[e.id])||!!e.logo,i=async s=>{try{const i=await(0,j.capturePlatingPhoto)(s);if(!i)return;const o=await(0,f.squareLogo)(i.dataUrl,256);f.useLogoCache.getState().put(e.id,o);const d=await(0,b.uploadOrderLogo)(e.id,o);if(d.ok){const s=e.logo;t.updateList(e.id,{logo:d.path}),s&&(0,b.removeOrderLogo)(s)}else'offline'!==d.message&&(0,y.notify)({id:'logo',tone:'warn',title:'Logo saved on this device only',body:d.message,timeoutMs:7e3})}catch(e){(0,y.notify)({id:'logo',tone:'warn',title:'Couldn\u2019t use that picture',body:String(e.message),timeoutMs:7e3})}};return(0,w.jsxs)(c.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(c.Button,{small:!0,kind:"secondary",testID:"logo-camera",label:s?'Replace: take photo':'Logo: take photo',onPress:()=>{i('camera')}}),(0,w.jsx)(c.Button,{small:!0,kind:"secondary",testID:"logo-library",label:s?'Replace: choose':'Logo: choose image',onPress:()=>{i('library')}}),s?(0,w.jsx)(c.Button,{small:!0,kind:"ghost",testID:"logo-remove",label:"Remove logo",onPress:()=>{f.useLogoCache.getState().drop(e.id),e.logo&&(0,b.removeOrderLogo)(e.logo),t.updateList(e.id,{logo:void 0})}}):null]})}function S({rid:e,list:t,who:i}){const[d,n]=(0,o.useState)(''),[l,y]=(0,o.useState)('1'),[j,f]=(0,o.useState)(''),[b,L]=(0,o.useState)(''),[C,D]=(0,o.useState)(null),T=x.useOrderLists.getState(),S=Number(l.replace(',','.')),B=d.trim().length>0&&(0,p.validQty)(S),$=()=>{n(''),y('1'),L(''),D(null)};return(0,w.jsxs)(u.default,{testID:"order-add",style:{gap:6},children:[(0,w.jsxs)(c.Row,{gap:6,children:[(0,w.jsx)(s.TextInput,{accessibilityLabel:"Item",testID:"order-add-name",value:d,onChangeText:n,placeholder:"Item, e.g. Tennent\u2019s",placeholderTextColor:h.colours.muted,style:{...I,flex:1}}),(0,w.jsx)(s.TextInput,{accessibilityLabel:"Quantity",testID:"order-add-qty",value:l,onChangeText:y,keyboardType:"decimal-pad",style:{...I,width:64,borderColor:(0,p.validQty)(S)?h.colours.hairline:h.colours.red}})]}),(0,w.jsx)(c.Row,{wrap:!0,gap:4,children:p.UNITS.map(e=>(0,w.jsx)(c.Chip,{label:e||'no unit',selected:j===e,onPress:()=>f(e)},e||'none'))}),(0,w.jsxs)(c.Row,{gap:6,children:[(0,w.jsx)(s.TextInput,{accessibilityLabel:"Note",testID:"order-add-note",value:b,onChangeText:L,placeholder:"Note (optional)",placeholderTextColor:h.colours.muted,style:{...I,flex:1}}),(0,w.jsx)(c.Button,{testID:"order-add-save",label:"Add",disabled:!B,onPress:()=>{const s=(0,p.findDuplicate)(T.items.filter(t=>t.rid===e),t.id,d,j);s?D(s):(T.addItem(e,{listId:t.id,name:d.trim(),qty:S,unit:j,note:b.trim()||void 0,addedBy:i.id,addedByName:i.name}),$())}})]}),(0,w.jsxs)(c.Sheet,{visible:!!C,onClose:()=>D(null),title:"Already on the list",testID:"order-dup",children:[(0,w.jsx)(c.T,{children:C?`${C.name}: ${(0,p.qtyText)(C)} (added by ${v(C.addedByName)})`:''}),(0,w.jsxs)(c.Row,{gap:8,children:[(0,w.jsx)(c.Button,{testID:"order-dup-bump",label:`Add ${l} more`,onPress:()=>{C&&T.bump(C.id,S,i),$()}}),(0,w.jsx)(c.Button,{kind:"ghost",label:"Add as separate item",onPress:()=>{T.addItem(e,{listId:t.id,name:d.trim(),qty:S,unit:j,note:b.trim()||void 0,addedBy:i.id,addedByName:i.name}),$()}})]})]})]})}function B({item:e,editor:t,who:s}){const i=x.useOrderLists.getState(),o='got'===e.status?h.colours.gold:'missing'===e.status?h.colours.amber:h.colours.text;return(0,w.jsxs)(u.default,{testID:`order-item-${e.id}`,style:{borderTopWidth:1,borderColor:h.colours.hairline,paddingVertical:8,gap:4},children:[(0,w.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(c.T,{weight:"semibold",colour:o,style:{flex:1,textDecorationLine:'got'===e.status?'line-through':'none'},children:e.name}),(0,w.jsx)(c.T,{weight:"semibold",children:(0,p.qtyText)(e)})]}),e.note?(0,w.jsxs)(c.Muted,{size:12,children:["Note: ",e.note]}):null,(0,w.jsxs)(c.Muted,{size:12,children:["Added by ",v(e.addedByName)," \xb7 ",L(e.addedAt),e.bumps?.length?` \xb7 +${e.bumps.map(e=>`${e.qty} ${v(e.name)}`).join(', ')}`:'',e.carried?' \xb7 carried over':'']}),'open'!==e.status?(0,w.jsxs)(c.Muted,{size:12,children:['got'===e.status?'Got / ordered':'Missing / not in stock'," \xb7 ",e.statusBy," ",L(e.statusAt)]}):null,t?(0,w.jsxs)(c.Row,{wrap:!0,gap:6,children:[(0,w.jsx)(c.Chip,{testID:`order-got-${e.id}`,label:"\u2713 Got / ordered",selected:'got'===e.status,onPress:()=>i.setStatus(e.id,'got'===e.status?'open':'got',s)}),(0,w.jsx)(c.Chip,{testID:`order-missing-${e.id}`,label:"Missing / not in stock",selected:'missing'===e.status,onPress:()=>i.setStatus(e.id,'missing'===e.status?'open':'missing',s)}),(0,w.jsx)(c.Chip,{testID:`order-remove-${e.id}`,label:"Remove",onPress:()=>{i.removeItem(e.id),(0,y.notify)({id:`undo-${e.id}`,title:`Removed ${e.name}`,timeoutMs:8e3,actions:[{label:'Undo',testID:'order-undo',onPress:()=>i.undoRemove(e.id)}]})}})]}):null]})}function $({rid:e,list:t,editor:d,canAdd:n,who:l,today:j,onBack:f}){(0,i.useBackLayer)(!0,f);const b=(0,x.useOrderLists)(e=>e.items),$=(0,x.useOrderLists)(e=>e.history).filter(e=>e.listId===t.id),P=(0,p.liveItems)(b.filter(t=>t.rid===e),t.id),[k,R]=(0,o.useState)(!1),[O,M]=(0,o.useState)(!1),[A,z]=(0,o.useState)(t.phone??''),N=x.useOrderLists.getState(),q=P.filter(e=>'got'!==e.status).length,H=(0,x.orderSettingsOf)(e).defaultTripDay;return(0,w.jsxs)(u.default,{style:{gap:10},testID:`order-list-${t.seed??t.id}`,children:[(0,w.jsx)(i.BackButton,{onPress:f,testID:"order-list-back"}),(0,w.jsxs)(c.Card,{children:[(0,w.jsxs)(c.Row,{gap:10,children:[(0,w.jsx)(C,{list:t,size:48}),(0,w.jsxs)(u.default,{style:{flex:1},children:[(0,w.jsx)(c.T,{size:18,weight:"semibold",children:t.name}),(0,w.jsx)(c.Muted,{size:12,children:(0,p.tripText)(t,j,H)})]})]}),(0,w.jsx)(D,{phone:t.phone}),'trip'===t.kind&&d?(0,w.jsxs)(u.default,{style:{gap:4},children:[(0,w.jsx)(c.Muted,{size:12,children:"Trip day for this trip"}),(0,w.jsx)(c.Row,{wrap:!0,gap:4,children:[1,2,3,4,5,6,0].map(e=>(0,w.jsx)(c.Chip,{testID:`trip-day-${e}`,label:p.DAY_FULL[e].slice(0,3),selected:(t.tripDay??H)===e,onPress:()=>N.updateList(t.id,{tripDay:e})},e))})]}):null,d?(0,w.jsxs)(u.default,{style:{gap:6},children:[(0,w.jsx)(c.Row,{gap:6,children:(0,w.jsx)(s.TextInput,{accessibilityLabel:"Phone number",testID:"list-phone-edit",value:A,onChangeText:z,onBlur:()=>N.updateList(t.id,{phone:A.trim()||void 0}),placeholder:"Phone (optional)",placeholderTextColor:h.colours.muted,style:{...I,flex:1}})}),(0,w.jsx)(T,{list:t})]}):null]}),n?(0,w.jsxs)(c.Card,{children:[(0,w.jsx)(c.T,{weight:"semibold",children:"Add to this list"}),(0,w.jsx)(S,{rid:e,list:t,who:l})]}):null,(0,w.jsxs)(c.Card,{children:[(0,w.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,w.jsx)(c.T,{weight:"semibold",children:"On the list"}),(0,w.jsx)(c.Badge,{kind:"neutral",label:`${P.length}`})]}),P.length?P.map(e=>(0,w.jsx)(B,{item:e,editor:d,who:l},e.id)):(0,w.jsx)(c.Muted,{children:"Nothing on this list yet."}),d&&P.length?(0,w.jsx)(c.Button,{testID:"order-finish",label:"Finish order",onPress:()=>R(!0)}):null]}),(0,w.jsx)(c.Button,{small:!0,kind:"ghost",testID:"order-history",label:O?'Hide history \u25b4':`History (${$.length}) \u25be`,onPress:()=>M(!O)}),O?$.map(e=>(0,w.jsxs)(c.Card,{children:[(0,w.jsxs)(c.T,{weight:"semibold",children:[L(e.finishedAt)," \xb7 ",v(e.finishedByName)]}),(0,w.jsx)(c.Muted,{size:12,children:e.items.map(e=>`${e.name} ${(0,p.qtyText)(e)}${'missing'===e.status?' (missing)':'open'===e.status?' (not got)':''}`).join(' \xb7 ')}),e.carried?(0,w.jsxs)(c.Muted,{size:12,children:[e.carried," carried over"]}):null]},e.id)):null,(0,w.jsxs)(c.Sheet,{visible:k,onClose:()=>R(!1),title:"Finish this order?",testID:"order-finish-sheet",children:[(0,w.jsxs)(c.T,{children:[P.length-q," got or ordered",q?`, ${q} not got (missing or still open)`:'',"."]}),(0,w.jsx)(c.Muted,{children:"It goes into History with today\u2019s date and your name."}),q?(0,w.jsxs)(c.T,{weight:"semibold",children:["Carry over the ",q," not got to the next order?"]}):null,(0,w.jsxs)(c.Row,{wrap:!0,gap:8,children:[q?(0,w.jsx)(c.Button,{testID:"order-finish-carry",label:"Finish and carry over",onPress:()=>{N.finish(e,t.id,!0,l),R(!1),(0,y.notify)({id:'order-done',title:`${t.name}: order finished`,body:`${q} carried over`,timeoutMs:6e3})}}):null,(0,w.jsx)(c.Button,{testID:"order-finish-clear",kind:q?'secondary':'primary',label:q?'Finish, don\u2019t carry over':'Finish order',onPress:()=>{N.finish(e,t.id,!1,l),R(!1),(0,y.notify)({id:'order-done',title:`${t.name}: order finished`,timeoutMs:6e3})}}),(0,w.jsx)(c.Button,{kind:"ghost",label:"Cancel",onPress:()=>R(!1)})]})]})]})}},1001,[912,875,990,30,196,239,122,263,127,813,821,1003,1205,946,1293,1294,820,24]); +__d(function(_g,_r,i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.NotificationsSettings=function({rid:e}){(0,n.useEffect)(()=>{c.useNotifs.getState().ensure(e),(0,j.readPushLive)()},[e]);const t=(0,c.useNotifs)(e=>e.items).filter(t=>t.rid===e&&!t.removed),s=(0,h.useOwner)(e=>e.staff),o=(0,j.usePushLive)(),[l,p]=(0,n.useState)(null),[f,g]=(0,n.useState)(null),[x,b]=(0,n.useState)(!1),y=c.useNotifs.getState(),T=s.map(e=>({id:e.id,role:e.role,level:e.level,job:e.job,department:e.dept,active:e.active})),v=e=>{const t=(0,u.resolveRecipients)(e,T,[]),n=[...e.recipients.groups.map(e=>u.NOTIF_GROUP_LABEL[e]),...(e.recipients.onShiftIn??[]).map(e=>u.SHIFT_FILTER_LABEL[e])];e.recipients.fallback&&n.push(`else ${[...e.recipients.fallback.groups.map(e=>u.NOTIF_GROUP_LABEL[e]),...e.recipients.fallback.staff.map(e=>I(s.find(t=>t.id===e)?.name??e))].join(', ')}`);const o=e.recipients.staff.map(e=>I(s.find(t=>t.id===e)?.name??e));return[...n,...o].join(', ')+(t.length||(e.recipients.onShiftIn??[]).length?'':' (nobody yet)')};return(0,k.jsxs)(a.default,{style:{gap:10},testID:"notif-settings",children:[(0,k.jsx)(r.Muted,{size:13,children:"Tip: these remind people at a set time, e.g. the Mills milk order. They show in the app as a gold slider with Done and Later. Done is logged with the name and time. Times are UK time."}),(0,k.jsxs)(a.default,{testID:"push-live-status",style:{borderWidth:1,borderColor:d.colours.accentBorder,borderRadius:10,padding:8,gap:4},children:[(0,k.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(r.T,{weight:"semibold",children:"Send to phones"}),(0,k.jsx)(r.Badge,{kind:o.live?'gold':'neutral',label:o.live?'ON':'OFF'})]}),(0,k.jsx)(r.Muted,{size:12,children:o.live?'Phone notifications go to people who turned them on.':'Off: nothing goes to anyone\u2019s phone yet. In-app reminders still work.'}),(0,k.jsx)(r.Button,{small:!0,kind:"secondary",testID:"push-live-toggle",label:o.live?'Switch phone notifications off':'Switch phone notifications on\u2026',onPress:()=>b(!0)})]}),(0,k.jsx)(R,{}),t.map(e=>l===e.id?(0,k.jsx)(D,{init:e,onCancel:()=>p(null),onSave:t=>{y.update(e.id,t),p(null)}},e.id):(0,k.jsxs)(a.default,{testID:`notif-${e.seed??e.id}`,style:{borderWidth:1,borderColor:d.colours.hairline,borderRadius:12,padding:10,gap:4,opacity:e.paused?.6:1},children:[(0,k.jsxs)(r.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(r.T,{weight:"semibold",style:{flex:1},children:e.title}),e.paused?(0,k.jsx)(r.Badge,{kind:"neutral",label:"Off"}):null]}),(0,k.jsx)(r.Muted,{size:13,children:e.message}),(0,k.jsxs)(r.Muted,{size:12,children:[(0,u.scheduleText)(e)," \xb7 ",v(e)," \xb7 ",[e.sendBy.inApp?'In app':'',e.sendBy.push?'Phone':''].filter(Boolean).join(' + ')]}),(0,k.jsxs)(r.Row,{gap:6,children:[(0,k.jsx)(r.Button,{small:!0,kind:"secondary",testID:`notif-edit-${e.seed??e.id}`,label:"Edit",onPress:()=>p(e.id)}),(0,k.jsx)(r.Button,{small:!0,kind:"ghost",label:e.paused?'Switch on':'Switch off',onPress:()=>y.update(e.id,{paused:!e.paused})}),(0,k.jsx)(r.Button,{small:!0,kind:"ghost",label:"Remove",onPress:()=>g(e)})]})]},e.id)),'new'===l?(0,k.jsx)(D,{init:C,onCancel:()=>p(null),onSave:t=>{y.add(e,t),p(null)}}):(0,k.jsx)(r.Button,{small:!0,testID:"notif-add",label:"Add a notification",onPress:()=>p('new')}),(0,k.jsxs)(r.Sheet,{visible:!!f,onClose:()=>g(null),title:"Remove this notification?",children:[(0,k.jsx)(r.T,{children:f?.title}),(0,k.jsx)(r.Muted,{children:"Nobody gets it after this. Reset to default restores the configured rules."}),(0,k.jsxs)(r.Row,{gap:8,children:[(0,k.jsx)(r.Button,{label:"Remove",onPress:()=>{f&&y.remove(f.id),g(null)}}),(0,k.jsx)(r.Button,{kind:"ghost",label:"Cancel",onPress:()=>g(null)})]})]}),(0,k.jsxs)(r.Sheet,{visible:x,onClose:()=>b(!1),title:o.live?'Switch phone notifications off?':'Switch phone notifications on?',testID:"push-live-confirm",children:[(0,k.jsx)(r.T,{children:o.live?'Nothing more goes to phones. In-app reminders keep working.':'From the next scheduled time, everyone ticked on a notification with \u201cPhone notification\u201d gets it on any phone where they turned phone notifications on.'}),(0,k.jsxs)(r.Row,{gap:8,children:[(0,k.jsx)(r.Button,{testID:"push-live-yes",label:o.live?'Switch off':'Yes, switch on',onPress:()=>{(0,j.setPushLive)(!o.live).then(e=>(0,w.notify)({id:'push-live',tone:e.ok?'normal':'warn',title:e.ok?o.live?'Phone notifications are off':'Phone notifications are on':'Not changed',body:e.message??'',timeoutMs:7e3})),b(!1)}}),(0,k.jsx)(r.Button,{kind:"ghost",label:"Cancel",onPress:()=>b(!1)})]})]})]})},_e.PushButton=R,_e.OrderListsSettings=function({rid:e}){(0,n.useEffect)(()=>{p.useOrderLists.getState().ensure(e)},[e]);const s=(0,p.useOrderLists)(e=>e.lists).filter(t=>t.rid===e),o=(0,p.orderSettingsOf)(e);(0,p.useOrderLists)(t=>t.settings[e]);const l=p.useOrderLists.getState(),[c,u]=(0,n.useState)(''),[h,g]=(0,n.useState)({});return(0,k.jsxs)(a.default,{style:{gap:10},testID:"order-list-settings",children:[(0,k.jsx)(r.Muted,{size:13,children:"Tip: running lists (like Alsons drinks) collect items until you order; trip lists (like Cash and carry) are for one shopping day. Logos and phone numbers are set on each list."}),(0,k.jsx)(r.Toggle,{testID:"order-allow-staff",label:"Let all staff add items",value:o.allowStaff,onChange:t=>l.setSettings(e,{allowStaff:t})}),(0,k.jsx)(r.Muted,{size:12,children:"Staff can add items and see the lists. Only managers and the Head Chef tick, remove or finish an order."}),(0,k.jsx)(r.T,{weight:"semibold",children:"Default trip day"}),(0,k.jsx)(r.Row,{wrap:!0,gap:6,children:v.map(t=>(0,k.jsx)(r.Chip,{label:f.DAY_FULL[t].slice(0,3),selected:o.defaultTripDay===t,onPress:()=>l.setSettings(e,{defaultTripDay:t})},t))}),s.map(e=>(0,k.jsxs)(a.default,{testID:`order-list-row-${e.seed??e.id}`,style:{borderWidth:1,borderColor:d.colours.hairline,borderRadius:10,padding:8,gap:6,opacity:e.archived?.55:1},children:[(0,k.jsxs)(r.Row,{gap:6,children:[(0,k.jsx)(t.TextInput,{accessibilityLabel:`Rename ${e.name}`,value:h[e.id]??e.name,onChangeText:t=>g(s=>({...s,[e.id]:t})),onBlur:()=>{const t=(h[e.id]??'').trim();t&&t!==e.name&&l.updateList(e.id,{name:t})},style:{...T,flex:1,minWidth:0}}),(0,k.jsx)(r.Badge,{kind:"neutral",label:'trip'===e.kind?'Trip':'Running'})]}),'trip'===e.kind?(0,k.jsx)(r.Row,{wrap:!0,gap:6,children:v.map(t=>(0,k.jsx)(r.Chip,{label:f.DAY_FULL[t].slice(0,3),selected:(e.tripDay??o.defaultTripDay)===t,onPress:()=>l.updateList(e.id,{tripDay:t})},t))}):null,(0,k.jsx)(r.Row,{gap:6,children:(0,k.jsx)(r.Button,{small:!0,kind:"ghost",label:e.archived?'Bring back':'Archive',onPress:()=>l.updateList(e.id,{archived:!e.archived})})})]},e.id)),(0,k.jsxs)(r.Row,{gap:6,wrap:!0,children:[(0,k.jsx)(t.TextInput,{accessibilityLabel:"New list name",testID:"order-new-name",value:c,onChangeText:u,placeholder:"e.g. Butcher",placeholderTextColor:d.colours.muted,style:{...T,flexGrow:1,flexBasis:160,minWidth:0}}),(0,k.jsx)(r.Button,{small:!0,label:"Add running",disabled:c.trim().length<2,onPress:()=>{l.addList(e,{name:c.trim(),kind:'running'}),u('')}}),(0,k.jsx)(r.Button,{small:!0,kind:"secondary",label:"Add trip",disabled:c.trim().length<2,onPress:()=>{l.addList(e,{name:c.trim(),kind:'trip',tripDay:o.defaultTripDay}),u('')}})]})]})},Object.defineProperty(_e,"resetOrderLists",{enumerable:!0,get:function(){return B}}),_e.ClockAreaSettings=function({rid:e,me:c}){(0,g.useClockArea)(t=>t.areas[e]);const u=(0,g.areaOf)(e);const h=g.useClockArea.getState(),p=(0,s.privateClockVenue)(e),[f,j]=(0,n.useState)(null==u.lat?'':String(u.lat)),[y,w]=(0,n.useState)(null==u.lng?'':String(u.lng)),[v,S]=(0,n.useState)(!1),[I,C]=(0,n.useState)(''),[L,D]=(0,n.useState)(u.breakOptions.join(', ')),R=(t,s)=>{const n=Number(t),o=Number(s);t.trim()||s.trim()?Number.isFinite(n)&&Number.isFinite(o)&&Math.abs(n)<=90&&Math.abs(o)<=180&&h.set(e,{lat:n,lng:o},c):h.set(e,{lat:null,lng:null},c)},B=async()=>{if(p)return;S(!0),C('');const t=await(0,b.getFix)();if(S(!1),'object'!=typeof t)return void C('denied'===t?'Location is blocked for this app. Allow it in your browser or phone settings.':'Couldn\u2019t get your location. Try again outside or near a window.');const s=t.lat.toFixed(6),n=t.lng.toFixed(6);j(s),w(n),h.set(e,{lat:Number(s),lng:Number(n)},c),C(`Centre set to where you are (accurate to about ${Math.round(t.acc)} m).`)},P=(0,x.areaSet)(u);return(0,k.jsxs)(a.default,{style:{gap:10},testID:"clock-area-settings",children:[(0,k.jsx)(r.Muted,{size:13,children:p?'The address-matched pub centre is configured below. Only clock-in checks location; only pass/fail is saved. No background, clock-out or break checks. Change the radius or centre here; use a manager override for a refused check.':'Tip: stand in the middle of the venue and tap \u201cUse my current location\u201d. Clocking in, out and breaks then only work within the distance below. Rota and pay screens are never blocked.'}),P?null:(0,k.jsx)(r.Banner,{kind:"warn",title:"Clock-in area not set yet",children:"Until you set the centre, staff can clock in from anywhere."}),p?(0,k.jsx)(r.Muted,{children:"Clock-in at the pub is required. A manager can record an exception with a reason."}):(0,k.jsx)(r.Toggle,{testID:"clock-area-on",label:"Check people are at the venue",value:u.on,onChange:t=>h.set(e,{on:t},c)}),p?null:(0,k.jsx)(r.Button,{testID:"clock-area-here",label:v?'Finding you\u2026':'\ud83d\udccd Use my current location',disabled:v,onPress:()=>{B()}}),I?(0,k.jsx)(r.Muted,{size:13,children:I}):null,(0,k.jsxs)(r.Row,{wrap:!0,gap:8,children:[(0,k.jsxs)(a.default,{style:{gap:2},children:[(0,k.jsx)(r.Muted,{size:12,children:"Latitude"}),(0,k.jsx)(t.TextInput,{accessibilityLabel:"Latitude",testID:"clock-area-lat",value:f,onChangeText:j,onBlur:()=>R(f,y),placeholder:"55.40\u2026",placeholderTextColor:d.colours.muted,style:{...T,width:130}})]}),(0,k.jsxs)(a.default,{style:{gap:2},children:[(0,k.jsx)(r.Muted,{size:12,children:"Longitude"}),(0,k.jsx)(t.TextInput,{accessibilityLabel:"Longitude",testID:"clock-area-lng",value:y,onChangeText:w,onBlur:()=>R(f,y),placeholder:"-4.75\u2026",placeholderTextColor:d.colours.muted,style:{...T,width:130}})]})]}),P?(0,k.jsx)(l.default,{accessibilityRole:"link",testID:"clock-area-map",onPress:()=>{o.default.openURL(`https://www.openstreetmap.org/?mlat=${u.lat}&mlon=${u.lng}#map=18/${u.lat}/${u.lng}`)},children:(0,k.jsx)(r.T,{size:13,colour:d.colours.gold,children:"See the pin on a map \u203a"})}):null,(0,k.jsx)(r.T,{weight:"semibold",children:"How far from the centre"}),(0,k.jsxs)(r.Row,{gap:8,children:[(0,k.jsx)(r.Button,{small:!0,kind:"secondary",label:"\u2212",onPress:()=>h.set(e,{radius:(0,x.clampRadius)(u.radius-10)},c)}),(0,k.jsxs)(r.T,{weight:"semibold",style:{minWidth:70,textAlign:'center'},children:[u.radius," m"]}),(0,k.jsx)(r.Button,{small:!0,kind:"secondary",label:"+",onPress:()=>h.set(e,{radius:(0,x.clampRadius)(u.radius+10)},c)})]}),(0,k.jsxs)(r.Muted,{size:12,children:["At least ",x.MIN_RADIUS," m. Phones aren\u2019t exact, so up to 50 m of the phone\u2019s own accuracy is added on top."]}),(0,k.jsx)(r.T,{weight:"semibold",children:"Forgotten break: lengths to offer at clock-out"}),(0,k.jsx)(t.TextInput,{accessibilityLabel:"Break lengths in minutes",testID:"clock-break-options",value:L,onChangeText:D,onBlur:()=>{const t=L.split(/[ ,]+/).map(Number).filter(e=>Number.isFinite(e)&&e>0&&e<=180);t.length&&h.set(e,{breakOptions:[...new Set(t)].sort((e,t)=>e-t)},c),D((0,g.areaOf)(e).breakOptions.join(', '))},style:T}),(0,k.jsxs)(r.Muted,{size:12,children:["Minutes, e.g. 5, 10, 15, 20, 30, 45, 60. Shows as ",u.breakOptions.map(x.breakLabel).join(', ')," and \u201cNo break\u201d."]}),p?(0,k.jsx)(r.Muted,{children:"No automatic arrival checks: staff location is used only at clock-in."}):(0,k.jsxs)(k.Fragment,{children:[" ",(0,k.jsx)(r.T,{weight:"semibold",children:"Not on the rota"}),(0,k.jsx)(r.Toggle,{testID:"clock-offrota-on",label:"Ask people at the venue who aren\u2019t on the rota if they want to clock in",value:u.offRotaPrompt,onChange:t=>h.set(e,{offRotaPrompt:t},c)}),(0,k.jsx)(t.TextInput,{accessibilityLabel:"Off-rota question",testID:"clock-offrota-title",value:u.offRotaTitle,onChangeText:t=>h.set(e,{offRotaTitle:t||x.DEFAULT_CLOCK_AREA.offRotaTitle},c),style:T}),(0,k.jsx)(t.TextInput,{accessibilityLabel:"Off-rota second line",testID:"clock-offrota-body",value:u.offRotaBody,onChangeText:t=>h.set(e,{offRotaBody:t||x.DEFAULT_CLOCK_AREA.offRotaBody},c),style:T}),(0,k.jsx)(r.Muted,{size:12,children:"This only checks while the app is open (web apps can\u2019t watch location in the background; that would need a native app)."})]})]})},Object.defineProperty(_e,"resetClockArea",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"COOKSAFE_URL",{enumerable:!0,get:function(){return O}}),_e.FoodSafetyCard=function({children:e}){return(0,k.jsx)(r.Card,{children:(0,k.jsxs)(a.default,{testID:"food-safety",style:{gap:6},children:[(0,k.jsx)(r.T,{size:17,weight:"semibold",children:"Food safety"}),(0,k.jsxs)(r.T,{children:["Based on ",(0,k.jsx)(r.T,{weight:"bold",colour:d.colours.gold,children:"CookSafe"})," (Food Standards Scotland)"]}),(0,k.jsx)(r.Muted,{size:12,children:"CoverCharge is not endorsed by Food Standards Scotland."}),(0,k.jsx)(l.default,{accessibilityRole:"link",testID:"cooksafe-link",onPress:()=>{o.default.openURL(O)},children:(0,k.jsx)(r.T,{size:14,colour:d.colours.gold,children:"Open the CookSafe guidance \u203a"})}),(0,k.jsx)(r.Muted,{size:13,children:"Full logs coming in the next update."}),e]})})};var t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),o=e(_r(_d[3])),l=e(_r(_d[4])),a=e(_r(_d[5])),r=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),f=_r(_d[12]),g=_r(_d[13]),x=_r(_d[14]),b=_r(_d[15]),j=_r(_d[16]),y=_r(_d[17]),w=_r(_d[18]),k=_r(_d[19]);const T={minHeight:44,borderRadius:10,borderWidth:1,borderColor:d.colours.hairline,backgroundColor:d.colours.surface2,color:d.colours.text,paddingHorizontal:10,fontSize:15},v=[1,2,3,4,5,6,0],S=['on_shift','everyone','managers','head_chef','kitchen','foh'],I=e=>e.replace(' (example)',''),C={title:'',message:'',days:[3,4,5,6,0],time:'21:00',recipients:{staff:[],groups:[]},sendBy:{inApp:!0,push:!1}};function L({value:e,onChange:t}){const s=(0,h.useOwner)(e=>e.staff).filter(e=>e.active);return(0,k.jsxs)(a.default,{style:{gap:6},testID:"notif-recipients",children:[(0,k.jsx)(r.T,{weight:"semibold",children:"Who gets it"}),(0,k.jsx)(r.Muted,{size:12,children:"Tick people, or pick a group (groups follow the team as it changes)."}),(0,k.jsx)(r.Row,{wrap:!0,gap:6,children:S.map(s=>(0,k.jsx)(r.Chip,{testID:`notif-group-${s}`,label:u.NOTIF_GROUP_LABEL[s],selected:e.groups.includes(s),onPress:()=>t({...e,groups:e.groups.includes(s)?e.groups.filter(e=>e!==s):[...e.groups,s]})},s))}),(0,k.jsx)(r.Muted,{size:12,children:"Only people on shift when it goes, in:"}),(0,k.jsx)(r.Row,{wrap:!0,gap:6,children:Object.keys(u.SHIFT_FILTER_LABEL).map(s=>{const n=(e.onShiftIn??[]).includes(s);return(0,k.jsx)(r.Chip,{testID:`notif-onshift-${s}`,label:u.SHIFT_FILTER_LABEL[s],selected:n,onPress:()=>t({...e,onShiftIn:n?(e.onShiftIn??[]).filter(e=>e!==s):[...e.onShiftIn??[],s]})},s)})}),(0,k.jsx)(a.default,{style:{gap:2},children:s.map(s=>{const n=e.staff.includes(s.id);return(0,k.jsxs)(l.default,{testID:`notif-tick-${s.id}`,accessibilityRole:"checkbox",accessibilityState:{checked:n},onPress:()=>t({...e,staff:n?e.staff.filter(e=>e!==s.id):[...e.staff,s.id]}),style:{flexDirection:'row',alignItems:'center',gap:10,paddingVertical:6},children:[(0,k.jsx)(a.default,{style:{width:22,height:22,borderRadius:5,borderWidth:1.5,borderColor:d.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:n?'#2a2414':'transparent'},children:n?(0,k.jsx)(r.T,{size:14,colour:d.colours.gold,children:"\u2713"}):null}),(0,k.jsx)(r.T,{style:{flex:1},children:(0,h.staffLabel)({name:I(s.name),nickname:s.nickname})}),(0,k.jsx)(r.Muted,{size:12,children:'Head Chef'===s.level?'Head Chef':s.job})]},s.id)})}),(0,k.jsx)(r.Muted,{size:12,children:"If nobody above matches when it goes, send it to:"}),(0,k.jsxs)(r.Row,{wrap:!0,gap:6,children:[S.filter(e=>'on_shift'!==e).map(s=>{const n=e.fallback??{staff:[],groups:[]},o=n.groups.includes(s);return(0,k.jsx)(r.Chip,{testID:`notif-fallback-${s}`,label:u.NOTIF_GROUP_LABEL[s],selected:o,onPress:()=>{const l=o?n.groups.filter(e=>e!==s):[...n.groups,s];t({...e,fallback:l.length||n.staff.length?{...n,groups:l}:void 0})}},s)}),s.map(s=>{const n=e.fallback??{staff:[],groups:[]},o=n.staff.includes(s.id);return(0,k.jsx)(r.Chip,{testID:`notif-fallback-${s.id}`,label:I(s.name),selected:o,onPress:()=>{const l=o?n.staff.filter(e=>e!==s.id):[...n.staff,s.id];t({...e,fallback:l.length||n.groups.length?{...n,staff:l}:void 0})}},s.id)})]})]})}function D({init:e,onSave:s,onCancel:o}){const[l,c]=(0,n.useState)(e),[h,p]=(0,n.useState)(!!e.dayTimes&&Object.keys(e.dayTimes).length>0),f=(0,u.validateNotif)(l),g=e=>c(t=>({...t,...e}));return(0,k.jsxs)(a.default,{testID:"notif-editor",style:{gap:8,borderWidth:1,borderColor:d.colours.accentBorder,borderRadius:12,padding:10},children:[(0,k.jsx)(r.T,{weight:"semibold",children:"Title"}),(0,k.jsx)(t.TextInput,{accessibilityLabel:"Notification title",testID:"notif-title",value:l.title,onChangeText:e=>g({title:e}),maxLength:60,style:T}),(0,k.jsx)(r.T,{weight:"semibold",children:"Message"}),(0,k.jsx)(t.TextInput,{accessibilityLabel:"Notification message",testID:"notif-message",value:l.message,onChangeText:e=>g({message:e}),maxLength:160,style:T}),(0,k.jsx)(r.T,{weight:"semibold",children:"Days"}),(0,k.jsx)(r.Row,{wrap:!0,gap:6,children:v.map(e=>(0,k.jsx)(r.Chip,{testID:`notif-day-${e}`,label:u.NOTIF_DAY_NAMES[e],selected:l.days.includes(e),onPress:()=>g({days:l.days.includes(e)?l.days.filter(t=>t!==e):[...l.days,e]})},e))}),(0,k.jsxs)(r.Row,{gap:8,children:[(0,k.jsx)(r.T,{weight:"semibold",children:"Time (UK)"}),(0,k.jsx)(t.TextInput,{accessibilityLabel:"Time",testID:"notif-time",value:l.time,onChangeText:e=>g({time:e}),placeholder:"21:00",style:{...T,width:90,borderColor:(0,u.validHm)(l.time)?d.colours.hairline:d.colours.red}})]}),(0,k.jsx)(r.Toggle,{label:"A different time on some days",value:h,onChange:e=>{p(e),e||g({dayTimes:void 0})}}),h?(0,k.jsx)(r.Row,{wrap:!0,gap:8,children:v.filter(e=>l.days.includes(e)).map(e=>(0,k.jsxs)(r.Row,{gap:4,children:[(0,k.jsx)(r.T,{size:13,children:u.NOTIF_DAY_NAMES[e]}),(0,k.jsx)(t.TextInput,{accessibilityLabel:`${u.NOTIF_DAY_NAMES[e]} time`,testID:`notif-daytime-${e}`,value:l.dayTimes?.[String(e)]??'',placeholder:l.time,onChangeText:t=>{const s={...l.dayTimes??{}};t.trim()?s[String(e)]=t.trim():delete s[String(e)],g({dayTimes:s})},style:{...T,width:74}})]},e))}):null,(0,k.jsx)(L,{value:l.recipients,onChange:e=>g({recipients:e})}),(0,k.jsx)(r.T,{weight:"semibold",children:"Send by"}),(0,k.jsx)(r.Toggle,{testID:"notif-inapp",label:"In the app (gold slider, Done / Later)",value:l.sendBy.inApp,onChange:e=>g({sendBy:{...l.sendBy,inApp:e}})}),(0,k.jsx)(r.Toggle,{testID:"notif-push",label:"Phone notification (when phones are switched on)",value:l.sendBy.push,onChange:e=>g({sendBy:{...l.sendBy,push:e}})}),f?(0,k.jsx)(r.Muted,{size:13,children:f}):null,(0,k.jsxs)(r.Row,{gap:8,style:{justifyContent:'flex-end'},children:[(0,k.jsx)(r.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:o}),(0,k.jsx)(r.Button,{small:!0,testID:"notif-save",label:"Save",disabled:!!f,onPress:()=>s({...l,title:l.title.trim(),message:l.message.trim(),days:[...l.days].sort()})})]})]})}function R(){const[e,t]=(0,n.useState)(null),[s,o]=(0,n.useState)('');return(0,n.useEffect)(()=>{(0,y.pushState)().then(t)},[]),e&&'unsupported'!==e?(0,k.jsxs)(a.default,{testID:"push-button",style:{gap:4},children:[(0,k.jsx)(r.Button,{small:!0,kind:'on'===e?'ghost':'secondary',testID:"push-turn-on",label:'on'===e?'Phone notifications are on for this phone \xb7 Turn off':'\ud83d\udd14 Turn on phone notifications',onPress:()=>{('on'===e?(0,y.turnOffPush)():(0,y.turnOnPush)()).then(e=>{o(e.message),(0,y.pushState)().then(t)})}}),(0,k.jsx)(r.Muted,{size:12,children:s||('ios-home-screen'===e?'iPhone: add this app to your Home Screen first (iOS 16.4 or later).':'For this phone only. Each person turns it on on their own phone.')})]}):null}const B=e=>p.useOrderLists.getState().resetSettings(e);const P=(e,t)=>g.useClockArea.getState().reset(e,t),O='https://www.foodstandards.gov.scot/publications-and-research/publications/cooksafe-manual'},1002,[875,987,30,239,263,127,813,821,955,957,854,1003,1205,1206,953,1273,820,1096,946,24]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"orderListSeedId",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"orderListSettingsId",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"orderListSeeds",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"useOrderLists",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"orderSettingsOf",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"useListOpen",{enumerable:!0,get:function(){return y}});var e,t=r(d[0]),s=(e=t)&&e.__esModule?e:{default:e},i=r(d[1]),n=r(d[2]),u=r(d[3]),o=r(d[4]),p=r(d[5]),l=r(d[6]);const c=(e,t)=>(0,u.uuidFrom)(`order-list:${t}:${e}`),S=e=>(0,u.uuidFrom)(`order-list-settings:${e}`),f=e=>'anchorage'===e?[{id:c(e,'allsons'),seed:'allsons',name:'Alsons (drinks)',kind:'running'},{id:c(e,'cash-carry'),seed:'cash-carry',name:'Cash and carry',kind:'trip',tripDay:5}]:[],A=()=>(new Date).toISOString(),O=(0,i.create)()((0,n.persist)((e,t)=>({lists:[],items:[],history:[],settings:{},ensure:s=>{const i=t(),n=new Set(i.lists.map(e=>e.id)),u=f(s).filter(e=>!n.has(e.id)).map(e=>({...e,rid:s})),p={},c=i.lists.map(e=>(0,l.fixSupplierNames)(e.name)!==e.name?{...e,name:(0,l.fixSupplierNames)(e.name),updatedAt:A()}:e);c.some((e,t)=>e!==i.lists[t])&&(p.lists=c),u.length&&(p.lists=[...p.lists??i.lists,...u]),i.settings[s]||(p.settings={...i.settings,[s]:{...o.DEFAULT_ORDER_LIST_SETTINGS,id:S(s)}}),Object.keys(p).length&&e(p)},addList:(t,s)=>{const i=(0,p.uuid)();return e(e=>({lists:[...e.lists,{...s,id:i,rid:t,updatedAt:A()}]})),i},updateList:(t,s)=>e(e=>({lists:e.lists.map(e=>e.id===t?{...e,...s,updatedAt:A()}:e)})),addItem:(t,s)=>{const i=(0,p.uuid)(),n=s.addedAt??A();return e(e=>({items:[...e.items,{...s,id:i,rid:t,status:'open',addedAt:n,updatedAt:n}]})),i},bump:(t,s,i)=>e(e=>({items:e.items.map(e=>e.id===t?{...(0,o.bumpQty)(e,s,i.id,i.name,A()),rid:e.rid}:e)})),updateItem:(t,s)=>e(e=>({items:e.items.map(e=>e.id===t?{...e,...s,updatedAt:A()}:e)})),setStatus:(t,s,i)=>e(e=>({items:e.items.map(e=>e.id===t?{...e,status:s,statusBy:'open'===s?void 0:i.name,statusAt:'open'===s?void 0:A(),updatedAt:A()}:e)})),removeItem:t=>e(e=>({items:e.items.map(e=>e.id===t?{...e,removed:!0,updatedAt:A()}:e)})),undoRemove:t=>e(e=>({items:e.items.map(e=>e.id===t?{...e,removed:!1,updatedAt:A()}:e)})),finish:(s,i,n,u)=>{const l=t().lists.find(e=>e.id===i);if(!l)return null;const c=A(),{round:S,drop:f,carriedOver:O}=(0,o.finishOrder)(l,t().items,n,u,c,p.uuid),_=new Set(f),y=new Map(O.map(e=>[e.id,e])),T={...S,rid:s};return e(e=>({items:e.items.filter(e=>!_.has(e.id)).map(e=>y.has(e.id)?{...y.get(e.id),rid:e.rid}:e),history:[T,...e.history].slice(0,300),lists:e.lists.map(e=>e.id===i?{...e,nextTrip:void 0,updatedAt:c}:e)})),T},setSettings:(t,s)=>e(e=>({settings:{...e.settings,[t]:{...o.DEFAULT_ORDER_LIST_SETTINGS,...e.settings[t],...s,id:S(t),updatedAt:A()}}})),resetSettings:t=>e(e=>({settings:{...e.settings,[t]:{...o.DEFAULT_ORDER_LIST_SETTINGS,id:S(t),updatedAt:A()}}}))}),{name:'covercharge-order-lists-v1',version:1,storage:(0,n.createJSONStorage)(()=>s.default)})),_=e=>({...o.DEFAULT_ORDER_LIST_SETTINGS,...O.getState().settings[e]}),y=(0,i.create)()(e=>({request:t=>e({seed:t})}))},1003,[1115,951,1116,1103,1205,1032,1204]); +__d(function(g,_r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"APP_USED_TEXT",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"APP_NOT_SET_UP_TEXT",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"allowedHere",{enumerable:!0,get:function(){return C}}),Object.defineProperty(_e,"movedMessage",{enumerable:!0,get:function(){return N}}),_e.personFromStaff=E,_e.signInWithText=z,_e.SignInWithLink=M,_e.useSignedOutGate=function(){const e=(0,m.useSession)(e=>e.meId);return _.includes(b.APP_VARIANT)&&!A.PITCH&&!e},_e.InviteGate=function(){const[e,R]=(0,f.useState)(m.useSession.persist.hasHydrated()),[E,z]=(0,f.useState)(m.START_INVITE?'checking':'done'),[V,F]=(0,f.useState)(null),[W,D]=(0,f.useState)(0),[K,U]=(0,f.useState)(!1),[G,Y]=(0,f.useState)(null),B=(0,m.useSession)(e=>e.meId),$=(0,m.useSession)(e=>!B||!!e.welcomed[B]);if((0,f.useEffect)(()=>{const e=m.useSession.persist.onFinishHydration(()=>R(!0));return m.useSession.persist.hasHydrated()&&R(!0),e},[]),(0,f.useEffect)(()=>{if(!e||!_.includes(b.APP_VARIANT))return;let n,t=!0;return(async()=>{const e=m.useSession.getState().meId;if(m.START_INVITE&&!(e&&await(0,I.signedInHereAs)(e)&&await(0,I.rememberedInviteHere)(m.START_INVITE))){const e=await H(m.START_INVITE,e=>{t&&F(e)});if(!t)return;if('refused'===e.kind)return F(e.message),void z('done');if('offline'===e.kind)return U(!0),void(n=setTimeout(()=>{t&&D(e=>e+1)},1e4));if(U(!1),'bad'===e.kind)return void z('bad')}const s=O(m.useSession.getState().meId),o=s&&!1!==P.useOwner.getState().staff.find(e=>e.id===s.id)?.active;if(s&&!o)m.useSession.getState().signOut();else if(s&&!C(s)&&!m.START_INVITE&&await(0,I.signedInHereAs)(s.id)){if(await(0,I.forgetSignInHere)(),!t)return;m.useSession.getState().signOut(),Y(N(s.app))}else if(s&&!C(s)){const e=(0,m.appUrl)(s.app,m.START_INVITE);if(e)return void window.location.replace(e)}z('done')})(),()=>{t=!1,n&&clearTimeout(n)}},[e,W]),!_.includes(b.APP_VARIANT))return null;if(n.IS_QUEUED_VENUE&&!B)return(0,x.jsx)(h.default,{style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(t.QueuedVenueWelcome,{app:m.APP_NAME[b.APP_VARIANT]??'Team',message:V?'This link cannot be used here. Ask your authorised manager.':K?'Waiting for a connection.':void 0})});if(n.IS_GREENSIDE&&!B)return(0,x.jsx)(h.default,{style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(s.GreensideStaffHome,{app:m.APP_NAME[b.APP_VARIANT]??'Team',message:V?`This link can\u2019t be used here. ${V}`:K?'Waiting for a connection.':e&&'checking'!==E?'bad'===E?'This link is not recognised. Ask the authorised manager for access after setup.':void 0:'Opening your Greenside app\u2026'})});if(n.IS_ABBOTSFORD&&!B)return(0,x.jsx)(h.default,{style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(l.AbbotsfordStaffHome,{app:m.APP_NAME[b.APP_VARIANT]??'Team',message:V?'This link cannot be used here. Ask your authorised manager.':K?'Waiting for a connection.':void 0})});if(n.IS_KIRKTON&&!B)return(0,x.jsx)(h.default,{style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(u.KirktonStaffHome,{app:m.APP_NAME[b.APP_VARIANT]??'Team',message:V?`This link can\u2019t be used here. ${V}`:K?'Waiting for a connection.':e&&'checking'!==E?'bad'===E?'This link is not recognised. Ask the authorised manager for access after setup.':void 0:'Opening your Kirkton app\u2026'})});if(n.IS_WILDINGS&&!B)return(0,x.jsx)(h.default,{style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(o.WildingsStaffHome,{app:m.APP_NAME[b.APP_VARIANT]??'Team',message:V?`This link can\u2019t be used here. ${V}`:K?'Waiting for a connection. Your personal app signs you in automatically when it returns.':e&&'checking'!==E?'bad'===E?'This link is not recognised. Open the complete private link your manager gave you.':void 0:'Opening your personal Wildings app\u2026'})});if(n.IS_KIRKMICHAEL&&!B)return(0,x.jsx)(h.default,{style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(r.KirkmichaelStaffHome,{app:m.APP_NAME[b.APP_VARIANT]??'Team',message:V?`This link can\u2019t be used here. ${V}`:K?'Waiting for a connection. Your personal app signs you in automatically when it returns.':e&&'checking'!==E?'bad'===E?'This link is not recognised. Open the complete private link your manager gave you.':void 0:'Opening your personal Kirkmichael app\u2026'})});if(n.IS_SOUTERS&&!B)return(0,x.jsx)(h.default,{style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}],children:(0,x.jsx)(c.SoutersStaffHome,{app:m.APP_NAME[b.APP_VARIANT]??'Team'})});if(K)return w('Waiting for a connection. Your app will sign you in automatically.','invite-waiting');if(!e||'checking'===E)return(0,x.jsx)(h.default,{style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3}]});if((0,S.inPhoneApp)()&&!B&&!A.PITCH)return V&&/already been used/i.test(V)?w(j,'invite-app-used'):V?w(V,'invite-app-refused'):w(v,'invite-app-notsetup');if('bad'===E)return(0,x.jsxs)(h.default,{testID:"invite-bad",style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,x.jsx)(T.T,{size:22,weight:"bold",center:!0,children:"This link isn\u2019t recognised"}),(0,x.jsx)(T.Muted,{center:!0,children:"Part of the link may be missing. Go back to the message from your manager and tap the whole link, rather than copying part of it. If it still doesn't work, ask your manager for your personal CoverCharge link."}),(0,x.jsx)(T.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>z('done')}),(0,x.jsx)(T.Muted,{center:!0,children:"Offline, CoverCharge uses made-up data, and nothing you do there is shared with the team."})]});if(V&&!B)return(0,x.jsxs)(h.default,{testID:"invite-refused",style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:[(0,x.jsx)(T.T,{size:22,weight:"bold",center:!0,children:"This link can\u2019t be used here"}),(0,x.jsx)(T.Muted,{center:!0,children:V}),(0,x.jsx)(T.Muted,{center:!0,children:"Each personal link works on one phone only and lasts 30 days before first use, so nobody else can sign in as you."}),(0,x.jsx)(T.Button,{label:"Try CoverCharge offline instead",kind:"secondary",onPress:()=>F(null)})]});if(G&&!B)return(0,x.jsxs)(h.default,{testID:"invite-moved",style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,x.jsx)(T.T,{size:22,weight:"bold",center:!0,children:"This app is signed out"}),(0,x.jsx)(T.Muted,{center:!0,children:G}),(0,x.jsx)(M,{})]});if(!B&&!A.PITCH)return(0,x.jsxs)(h.default,{testID:"invite-signin",style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12}],children:[(0,x.jsx)(T.T,{size:22,weight:"bold",center:!0,children:V?'This link can\u2019t be used here':'Sign in to CoverCharge'}),V?(0,x.jsx)(T.Muted,{center:!0,children:V}):null,(0,x.jsx)(T.Muted,{center:!0,children:"Open the personal link your manager sent you on this phone. Each link signs in one person on one phone and lasts 30 days before first use. If it has already been used on another phone or browser, ask your manager for a new one."}),(0,x.jsx)(M,{})]});const L=(0,m.rosterPerson)(B);return L&&!$&&C(L)?(0,x.jsx)(y.LaunchWelcome,{p:L,onDone:()=>m.useSession.getState().markWelcomed(L.id)}):null};var n=_r(d[0]),t=_r(d[1]),s=_r(d[2]),o=_r(d[3]),r=_r(d[4]),l=_r(d[5]),u=_r(d[6]),c=_r(d[7]),f=_r(d[8]);_r(d[9]);var p=e(_r(d[10])),h=e(_r(d[11])),b=_r(d[12]),m=_r(d[13]),k=_r(d[14]),y=_r(d[15]),T=_r(d[16]),I=_r(d[17]),A=_r(d[18]),S=_r(d[19]),P=_r(d[20]),x=_r(d[21]);const j='This app copy has already been set up on another phone. Ask your manager for a new link.',v='This app copy isn\u2019t set up for anyone yet. Ask your manager for your link, and download the app from it.',w=(e,n)=>(0,x.jsx)(h.default,{testID:n,style:[p.default.absoluteFill,{backgroundColor:k.colours.bg,zIndex:1e3,padding:24,justifyContent:'center',gap:12,alignItems:'center'}],children:(0,x.jsx)(T.T,{size:22,weight:"bold",center:!0,children:e})}),_=['owner','staff','chef'],C=e=>'staff'===b.APP_VARIANT||e.app===b.APP_VARIANT,N=e=>`You now use ${m.APP_NAME[e]??'another CoverCharge app'}. This app is signed out on this phone. Open the new personal link your manager sent you.`;function R(e){m.useSession.getState().signIn(e.id);const n=P.useOwner.getState();P.useOwner.setState({staffAs:e.id,previewRole:'staff'===e.role?n.previewRole:e.role})}function E(e){const n='owner'===e.role?'Owner':'manager'===e.role?'Manager':'Head Chef'===e.level?'Head Chef':'Staff';return{id:e.id,name:e.name,level:n,role:e.role,job:e.job,nickname:e.nickname,dept:e.dept??'',app:'staff'===e.role?'Head Chef'===n?'chef':'staff':'owner',tokenHash:'',hourlyPence:null,salaried:!!e.salaried,noTax:!!e.noTax,avatar:void 0}}const O=e=>{const n=(0,m.rosterPerson)(e);if(n)return n;const t=e?P.useOwner.getState().staff.find(n=>n.id===e):void 0;return t?E(t):void 0};async function H(e,n){const t=await(0,m.personForInvite)(e);if(t)return R(t),C(t)?((0,I.claimInvite)(e).then(e=>{if('refused'===e.status&&m.useSession.getState().meId===t.id&&(m.useSession.getState().signOut(),n(e.message)),'ok'===e.status&&e.id.staffRef&&e.id.staffRef!==m.useSession.getState().meId){const n=O(e.id.staffRef);n&&R(n)}}),{kind:'ok',p:t}):{kind:'ok',p:t};const s=await(0,I.claimInvite)(e);if('refused'===s.status)return{kind:'refused',message:s.message};if('offline'===s.status)return{kind:'offline'};if('ok'!==s.status||!s.id.staffRef)return{kind:'bad'};const o=O(s.id.staffRef)??E({id:s.id.staffRef,name:s.id.displayName||s.id.staffRef,role:'owner'===s.id.role?'owner':'manager'===s.id.role?'manager':'staff',level:'head_chef'===s.id.role?'Head Chef':void 0,job:'',active:!0});return R(o),{kind:'ok',p:o}}async function z(e,n=()=>{}){const t=(0,m.inviteFromText)(e);if(!t)return'bad';const s=await H(t,n);if('refused'===s.kind)return{refused:s.message};if('bad'===s.kind||'offline'===s.kind)return'bad';const o=s.p;if(!C(o)){const e=(0,m.appUrl)(o.app,t);if(e)return window.location.replace(e),'moved'}return'ok'}function M(){const[e,n]=(0,f.useState)(''),[t,s]=(0,f.useState)('');return(0,x.jsxs)(h.default,{style:{gap:6},children:[(0,x.jsx)(T.Field,{label:"Your personal link (paste it here)",value:e,onChangeText:n,placeholder:"Your complete Android or iPhone link",autoCapitalize:"none",autoCorrect:!1}),(0,x.jsx)(T.Button,{label:"Sign in",disabled:!e.trim(),onPress:async()=>{const t=await z(e,s);s('bad'===t?'That link was not recognised. Check you copied all of it, or ask your manager for a new one.':'object'==typeof t?t.refused:''),'ok'===t&&n('')}}),t?(0,x.jsx)(T.T,{size:13,colour:k.colours.red,children:t}):null]})}},1004,[5,1398,1399,1400,1401,1402,1403,852,30,122,46,127,806,858,821,1404,813,820,2,1289,854,24]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.Icon=function({name:l,size:x=22,colour:t}){const n={stroke:t,strokeWidth:2,fill:'none',strokeLinecap:'round',strokeLinejoin:'round'};return(0,e.jsxs)(h.default,{width:x,height:x,viewBox:"0 0 24 24",children:['home'===l?(0,e.jsx)(s.Path,{d:"M3 11l9-7 9 7v9a1 1 0 0 1-1 1h-5v-6H9v6H4a1 1 0 0 1-1-1z",...n}):null,'orders'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"5",y:"3",width:"14",height:"18",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M9 8h6M9 12h6M9 16h4",...n})]}):null,'bookings'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4",...n})]}):null,'forecast'===l?(0,e.jsx)(s.Path,{d:"M4 20V10M10 20V4M16 20v-7M22 20H2",...n}):null,'more'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"5",cy:"12",r:"1.6",fill:t}),(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"1.6",fill:t}),(0,e.jsx)(s.Circle,{cx:"19",cy:"12",r:"1.6",fill:t})]}):null,'search'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"11",r:"7",...n}),(0,e.jsx)(s.Path,{d:"M20 20l-4-4",...n})]}):null,'bell'===l?(0,e.jsx)(s.Path,{d:"M6 16V11a6 6 0 0 1 12 0v5l2 2H4zM10 20a2 2 0 0 0 4 0",...n}):null,'chat'===l?(0,e.jsx)(s.Path,{d:"M4 5h16v11H9l-5 4z",...n}):null,'clock'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M12 7v5l3 2",...n})]}):null,'user'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"8",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M4 21a8 8 0 0 1 16 0",...n})]}):null,'walkin'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"13",cy:"4.5",r:"1.8",...n}),(0,e.jsx)(s.Path,{d:"M10 21l2-6 3 3v3M9 12l2-4 4 1 2 3M11 8l-1 5",...n})]}):null,'calendarPlus'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"5",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M3 10h18M8 3v4M16 3v4M12 13v5M9.5 15.5h5",...n})]}):null,'pause'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M10 9v6M14 9v6",...n})]}):null,'rain'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M7 15a4 4 0 0 1-.6-7.95A5.5 5.5 0 0 1 17 7.5a3.75 3.75 0 0 1 .5 7.5z",...n}),(0,e.jsx)(s.Path,{d:"M9 18l-1 2.5M13 18l-1 2.5M17 18l-1 2.5",...n})]}):null,'sun'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M12 2v2M12 20v2M2 12h2M20 12h2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4",...n})]}):null,'payroll'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3",y:"4",width:"18",height:"16",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M7 9h6M7 13h4M15 12.5a2 2 0 1 0 0 .01M7 17h10",...n})]}):null,'tips'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"12",cy:"12",r:"9",...n}),(0,e.jsx)(s.Path,{d:"M14.5 9a2.5 2.5 0 0 0-5 0c0 2.5 0 4-1.5 6h7M9 12.5h4",...n})]}):null,'sparkle'===l?(0,e.jsx)(s.Path,{d:"M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8zM19 16l.7 1.8 1.8.7-1.8.7L19 21l-.7-1.8-1.8-.7 1.8-.7z",...n}):null,'platter'===l?(0,e.jsx)(e.Fragment,{children:(0,e.jsx)(s.Path,{d:"M3 15h18M5 15a7 7 0 0 1 14 0M12 6v2M2 18h20",...n})}):null,'check'===l?(0,e.jsx)(s.Path,{d:"M5 12.5l4.5 4.5L19 7.5",...n}):null,'alert'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M12 3l9.5 17h-19z",...n}),(0,e.jsx)(s.Path,{d:"M12 10v4M12 17.2v.1",...n})]}):null,'access'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"11",cy:"4.5",r:"1.8",...n}),(0,e.jsx)(s.Path,{d:"M11 7.5v6h5l2.5 5M11 10h5M8 11.5a5.5 5.5 0 1 0 7.5 6.5",...n})]}):null,'dog'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 10l1-5 3 3h4l3-3 1 5v4a5 5 0 0 1-5 5h-2a5 5 0 0 1-5-5z",...n}),(0,e.jsx)(s.Path,{d:"M10 13v.1M14 13v.1M11 16h2",...n})]}):null,'leaf'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 19c0-8 5-14 15-14 0 10-6 15-14 15",...n}),(0,e.jsx)(s.Path,{d:"M5 19l8-8",...n})]}):null,'table'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"4",y:"8",width:"16",height:"8",rx:"2",...n}),(0,e.jsx)(s.Path,{d:"M8 16v4M16 16v4M8 4v4M16 4v4",...n})]}):null,'bag'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M5 8h14l-1 12H6z",...n}),(0,e.jsx)(s.Path,{d:"M9 10V7a3 3 0 0 1 6 0v3",...n})]}):null,'phone'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"7",y:"2.5",width:"10",height:"19",rx:"2.5",...n}),(0,e.jsx)(s.Path,{d:"M11 18.5h2",...n})]}):null,'swap'===l?(0,e.jsx)(s.Path,{d:"M7 4L3 8l4 4M3 8h14M17 20l4-4-4-4M21 16H7",...n}):null,'box'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M3.5 8L12 4l8.5 4v8L12 20l-8.5-4z",...n}),(0,e.jsx)(s.Path,{d:"M3.5 8L12 12l8.5-4M12 12v8",...n})]}):null,'star'===l?(0,e.jsx)(s.Path,{d:"M12 3.5l2.6 5.4 5.9.8-4.3 4.1 1 5.8L12 16.8l-5.2 2.8 1-5.8L3.5 9.7l5.9-.8z",...n}):null,'userPlus'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Circle,{cx:"10",cy:"8",r:"4",...n}),(0,e.jsx)(s.Path,{d:"M3 21a7 7 0 0 1 14 0M19 8v6M16 11h6",...n})]}):null,'gift'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Rect,{x:"3.5",y:"8.5",width:"17",height:"4",rx:"1",...n}),(0,e.jsx)(s.Path,{d:"M5 12.5V20h14v-7.5M12 8.5V20M12 8.5C10 8.5 7.5 7.8 7.5 5.8S10.5 4 12 8.5c1.5-4.5 4.5-4.7 4.5-2.7S14 8.5 12 8.5z",...n})]}):null,'tag'===l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Path,{d:"M3.5 12.5V4h8.5l8.5 8.5-8.5 8.5z",...n}),(0,e.jsx)(s.Circle,{cx:"8",cy:"8.5",r:"1.4",...n})]}):null,'hanger'===l?(0,e.jsx)(s.Path,{d:"M12 7.5a2 2 0 1 1 2-2M12 7.5v2L3 16.5h18L12 9.5",...n}):null]})},r(d[0]);var l,s=r(d[1]),h=(l=s)&&l.__esModule?l:{default:l},e=r(d[2])},1005,[30,947,24]); +__d(function(g,_r,_i,_a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.usePay=j,_e.periodPay=T,_e.MyHoursPay=C,_e.Payroll=function(){const{role:e}=(0,y.useCtx)(6e4),r='owner'===e,c=!!(0,y.useSignedIn)(),p=c&&('owner'===e||'manager'===e),j=(0,a.useOwner)(e=>e.staff),k=(0,i.useMemo)(()=>j.filter(e=>e.active),[j]),D=(0,y.useHourly)(),R=(0,a.useOwner)(e=>e.attendance),z=(0,a.useOwner)(e=>e.troncHistory),{now:M,rid:N}=(0,y.useCtx)(6e4),v=(0,b.useVenuePay)(N).pay,[B,O]=(0,i.useState)(-1),[L,$]=(0,i.useState)(null),[S,H]=(0,i.useState)(''),[I,W]=(0,i.useState)(null),E=(0,i.useMemo)(()=>k.map(e=>({...T(e.id,B,M,R,D[e.id]??0,v,z),person:e})),[k,B,R,D,v,z]),_=E.reduce((e,s)=>({paid:e.paid+s.paid,gross:e.gross+s.gross,tips:e.tips+s.tips,total:e.total+s.total}),{paid:0,gross:0,tips:0,total:0}),V=E[0]?.label??'',F=k.find(e=>e.id===L),G=Math.round(100*Number(S));return(0,f.jsxs)(n.default,{style:{gap:10},children:[(0,f.jsx)(l.Muted,{children:"Periods follow your venue's pay dates (Settings \u203a Pay & tips). For hours to copy into a spreadsheet, use Payroll hours."}),(0,f.jsxs)(l.Muted,{children:["Pay period (venue setting",r?'':', owner only',"). Used for staff pay, the tip splitter and payroll."]}),(0,f.jsx)(P,{label:V,offset:B,setOffset:O,badge:0===B?'Current period':void 0}),(0,f.jsx)(t.WideTable,{children:(0,f.jsxs)(n.default,{children:[(0,f.jsx)(t.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:h.colours.border,paddingBottom:4},children:['Staff','Rate/h','Paid hrs','Gross','Tips','Total'].map((e,s)=>(0,f.jsx)(l.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{width:[120,96,64,72,64,76][s]},children:e},e))}),E.map(e=>(0,f.jsxs)(t.TRow,{heads:['Staff','Rate/h','Paid hrs','Gross','Tips','Total'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,f.jsxs)(o.default,{accessibilityRole:"button",accessibilityLabel:`Pay for ${e.person.name}`,onPress:()=>W(e.person.id),style:{width:120,minHeight:44,justifyContent:'center'},children:[(0,f.jsx)(l.T,{size:13,colour:h.colours.gold,numberOfLines:1,children:x(e.person.name)}),c&&e.person.noTax?(0,f.jsx)(l.T,{size:10,colour:h.colours.amber,children:"No tax deducted"}):null]}),(0,f.jsx)(o.default,{accessibilityRole:"button",accessibilityLabel:`Edit rate for ${e.person.name}`,disabled:!p,onPress:()=>{$(e.person.id),H(null==D[e.person.id]?'':(D[e.person.id]/100).toFixed(2))},style:{width:96,minHeight:44,justifyContent:'center'},children:(0,f.jsxs)(l.T,{size:13,colour:null==D[e.person.id]?h.colours.muted:'owner'!==e.person.role&&D[e.person.id]$(null),title:`Hourly rate: ${x(F?.name)}`,children:[(0,f.jsx)(l.Muted,{children:F?`${F.level??a.ROLE_LABEL[F.role]} \xb7 ${F.job}${F.noTax?' \xb7 No tax deducted':''} \xb7 now: ${(0,a.wageLabel)(F,D[F.id],u.gbp)}`:''}),(0,f.jsx)(s.TextInput,{accessibilityLabel:"Hourly rate \xa3",keyboardType:"decimal-pad",value:S,onChangeText:H,style:l.styles.input}),Number.isFinite(G)&&G>0&&G{a.useOwner.getState().setRate(L,G),$(null)}}),L&&null!=D[L]?(0,f.jsx)(l.Button,{kind:"secondary",label:"Clear (Not set)",onPress:()=>{a.useOwner.getState().clearRate(L),$(null)}}):null]}),(0,f.jsx)(l.Sheet,{visible:!!I,onClose:()=>W(null),title:`What ${x(k.find(e=>e.id===I)?.name)} sees`,children:I?(0,f.jsx)(C,{staffId:I}):null})]})};var s=_r(d[0]),t=_r(d[1]),i=_r(d[2]),o=e(_r(d[3])),n=e(_r(d[4])),r=e(_r(d[5])),l=_r(d[6]),a=_r(d[7]),u=_r(d[8]),c=_r(d[9]),h=_r(d[10]),p=_r(d[11]),y=_r(d[12]),b=_r(d[13]),f=_r(d[14]);const x=e=>(e??'').replace(' (example)',''),w='Before tax and deductions, estimate';function j(e,s){const{now:t,rid:o}=(0,y.useCtx)(6e4),n=(0,a.useOwner)(e=>e.attendance),r=(0,y.useHourly)()[e]??0,l=(0,b.useVenuePay)(o).pay,u=(0,a.useOwner)(e=>e.troncHistory);return(0,i.useMemo)(()=>T(e,s,t,n,r,l,u),[e,s,n,r,l,u,Math.floor(t.getTime()/6e4)])}function T(e,s,t,i,o,n,r){const{s:l,e:u,key:h}=(0,b.venueRange)(n,'wage',s,t),p=(0,c.ymd)(l),f=(0,c.ymd)(u),x=i.filter(s=>s.staffId===e&&s.date>=p&&s.date<=f&&s.in).sort((e,s)=>e.date.localeCompare(s.date)).map(e=>{const s=(0,y.paidMins)(e,t);return{a:e,...s,gross:Math.round(s.paid/60*o),open:!e.out,confirmed:(0,a.isConfirmed)(e)}}),w=x.filter(e=>e.confirmed),j=w.reduce((e,s)=>e+s.paid,0),T=w.reduce((e,s)=>e+s.gross,0),P=x.filter(e=>!e.open&&!e.confirmed).reduce((e,s)=>e+s.paid,0),C=r.filter(e=>e.end>=p&&e.end<=f).map(s=>({label:s.label,amount:s.rows.find(s=>s.staffId===e)?.amount??0})).filter(e=>e.amount>0),k=C.reduce((e,s)=>e+s.amount,0);return{s:l,e:u,key:h,label:`${(0,c.niceDate)(l)} \u2013 ${(0,c.niceDate)(u)} ${u.getFullYear()}`,shifts:x,paid:j,pending:P,gross:T,tips:k,tipItems:C,total:T+k,rate:o}}function P({label:e,offset:s,setOffset:t,badge:i}){return(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",disabled:s<=-12,onPress:()=>t(s-1)}),(0,f.jsxs)(n.default,{style:{alignItems:'center',flex:1},children:[(0,f.jsx)(l.T,{weight:"semibold",children:e}),i?(0,f.jsx)(l.Badge,{kind:0===s?'amber':'neutral',label:i}):null]}),(0,f.jsx)(l.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:s>=0,onPress:()=>t(s+1)})]})}function C({staffId:e}){const{meId:s,now:C,rid:k}=(0,y.useCtx)(6e4),D=e??s,R=(0,b.useVenuePay)(k).pay,z=(0,a.useOwner)(e=>e.staff).find(e=>e.id===D),M=(0,a.useOwner)(e=>e.attendance),N=(0,a.useOwner)(e=>e.troncHistory),v=(0,y.useHourly)(),B=v[D]??0,O=null!=v[D],[L,$]=(0,i.useState)(0),S=j(D,L),H=(0,r.default)().width<520,I=(0,i.useMemo)(()=>[-1,-2,-3,-4,-5,-6].map(e=>({o:e,...T(D,e,C,M,B,R,N)})),[D,M,B,R,N]);return(0,f.jsxs)(n.default,{style:{gap:10},children:[(0,f.jsx)(l.Banner,{kind:"info",title:w,children:"Gross pay from your clocked hours at your hourly rate, plus tips shared to you. Tax, National Insurance and pension come off in payroll."}),(0,f.jsxs)(l.Muted,{children:[x(z?.name)," \xb7 ",z?.job," \xb7 ",O?`${(0,u.gbp)(B)}/hour`:'Hourly rate not set yet'," \xb7 Paid on the ",R.wagePayDay,[1,21,31].includes(R.wagePayDay)?'st':[2,22].includes(R.wagePayDay)?'nd':[3,23].includes(R.wagePayDay)?'rd':'th',", cut-off the ",R.wageCutoffDay,[1,21].includes(R.wageCutoffDay)?'st':[2,22].includes(R.wageCutoffDay)?'nd':[3,23].includes(R.wageCutoffDay)?'rd':'th',e?'':' (set by your manager)']}),(0,f.jsx)(P,{label:S.label,offset:L,setOffset:$,badge:0===L?'Current period':void 0}),(0,f.jsxs)(l.Card,{children:[(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{children:"Confirmed paid hours"}),(0,f.jsx)(l.T,{weight:"semibold",children:(0,y.hmDur)(S.paid)})]}),S.pending?(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{colour:h.colours.amber,children:"Pending sign-off"}),(0,f.jsx)(l.T,{colour:h.colours.amber,children:(0,y.hmDur)(S.pending)})]}):null,(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{children:"Gross pay from hours"}),(0,f.jsx)(l.T,{weight:"semibold",children:(0,u.gbp)(S.gross)})]}),(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{children:"Tips allocated"}),(0,f.jsx)(l.T,{weight:"semibold",children:(0,u.gbp)(S.tips)})]}),S.tipItems.map(e=>(0,f.jsxs)(l.Muted,{children:[" Tips for ",e.label,": ",(0,u.gbp)(e.amount)]},e.label)),(0,f.jsx)(n.default,{style:{height:1,backgroundColor:h.colours.border}}),(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{weight:"bold",children:"Total gross"}),(0,f.jsx)(l.T,{size:20,weight:"bold",colour:h.colours.gold,children:(0,u.gbp)(S.total)})]}),(0,f.jsxs)(l.Muted,{children:[w,". Tips are shown separately and only once a tip period is approved."]})]}),(0,f.jsx)(p.SectionHead,{title:"Shifts",sub:"Paid hours = clock out \u2212 clock in \u2212 break"}),H?(0,f.jsxs)(n.default,{testID:"pay-shifts-list",children:[S.shifts.map(e=>(0,f.jsxs)(n.default,{style:{paddingVertical:8,borderBottomWidth:1,borderColor:'#222',gap:2},children:[(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{size:14,weight:"semibold",children:(0,c.niceDate)(new Date(e.a.date+'T12:00:00'))}),(0,f.jsx)(l.T,{size:14,weight:"semibold",colour:e.open||e.confirmed?void 0:h.colours.amber,children:e.open?'On now':e.confirmed?(0,u.gbp)(e.gross):'Pending'})]}),(0,f.jsxs)(l.Muted,{children:[(0,c.hm)(new Date(e.a.in)),"\u2013",e.a.out?(0,c.hm)(new Date(e.a.out)):'now',e.open?'':` \xb7 ${e.brk}m break \xb7 ${(0,y.hmDur)(e.paid)} paid`]})]},e.a.id)),S.shifts.length?null:(0,f.jsx)(l.Muted,{style:{paddingVertical:8},children:"No clocked shifts in this period."}),S.shifts.length?(0,f.jsxs)(l.Muted,{children:["At ",(0,u.gbp)(S.rate),"/hour."]}):null]}):(0,f.jsx)(t.WideTable,{children:(0,f.jsxs)(n.default,{children:[(0,f.jsx)(t.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:h.colours.border,paddingBottom:4},children:['Date','In','Out','Break','Paid','Rate','Gross'].map((e,s)=>(0,f.jsx)(l.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{width:[86,50,50,50,62,56,64][s]},children:e},e))}),S.shifts.map(e=>(0,f.jsxs)(t.TRow,{heads:['Date','In','Out','Break','Paid','Rate','Gross'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,f.jsx)(l.T,{size:13,style:{width:86},children:(0,c.niceDate)(new Date(e.a.date+'T12:00:00'))}),(0,f.jsx)(l.T,{size:13,style:{width:50},children:(0,c.hm)(new Date(e.a.in))}),(0,f.jsx)(l.T,{size:13,style:{width:50},children:e.a.out?(0,c.hm)(new Date(e.a.out)):'on now'}),(0,f.jsx)(l.T,{size:13,style:{width:50},children:e.open?'\u2013':`${e.brk}m`}),(0,f.jsx)(l.T,{size:13,style:{width:62},children:e.open?'\u2013':(0,y.hmDur)(e.paid)}),(0,f.jsx)(l.T,{size:13,style:{width:56},children:(0,u.gbp)(S.rate)}),(0,f.jsx)(l.T,{size:13,weight:"semibold",style:{width:64},colour:e.open||e.confirmed?void 0:h.colours.amber,children:e.open?'\u2013':e.confirmed?(0,u.gbp)(e.gross):'Pending'})]},e.a.id)),S.shifts.length?null:(0,f.jsx)(l.Muted,{style:{paddingVertical:8},children:"No clocked shifts in this period."})]})}),S.shifts.some(e=>e.open)?(0,f.jsx)(l.Muted,{children:"The shift you\u2019re on now is added once you clock out."}):null,S.pending?(0,f.jsx)(l.Muted,{children:"Hours marked Pending count once a manager signs them off."}):null,(0,f.jsx)(p.SectionHead,{title:"History"}),I.map(e=>(0,f.jsx)(o.default,{accessibilityRole:"button",accessibilityLabel:`Pay period ${e.label}`,onPress:()=>$(e.o),children:(0,f.jsxs)(l.Card,{children:[(0,f.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,f.jsx)(l.T,{weight:"semibold",children:e.label}),(0,f.jsx)(l.T,{weight:"bold",children:(0,u.gbp)(e.total)})]}),(0,f.jsxs)(l.Muted,{children:[(0,y.hmDur)(e.paid)," paid \xb7 ",(0,u.gbp)(e.gross)," from hours",e.tips?` + ${(0,u.gbp)(e.tips)} tips`:''," \xb7 ",w.toLowerCase()]})]})},e.o))]})}},1006,[875,1337,30,263,127,287,813,854,816,818,821,1017,926,1110,24]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"payFor",{enumerable:!0,get:function(){return b.payFor}}),Object.defineProperty(_e,"useVenuePay",{enumerable:!0,get:function(){return b.useVenuePay}}),_e.PayTipsSettings=function({go:e}){const{rid:s,today:t}=(0,x.useCtx)(6e4),{pay:n,source:r}=(0,b.useVenuePay)(s),[l,c]=(0,o.useState)(n),[p,y]=(0,o.useState)((0,u.ukDate)(n.tipsAnchorPayday)),[C,S]=(0,o.useState)(null),D=(0,u.parseUk)(p),M=(0,u.cleanPay)({...l,tipsAnchorPayday:D??l.tipsAnchorPayday}),B=JSON.stringify(M)!==JSON.stringify(n)||'settings'!==r,R=(0,u.nextToPay)(M,'tips',t).period,z=(0,u.nextToPay)(M,'wage',t).period,v=(0,u.tipsPeriod)(M,R.start,1),$=(0,u.wagePeriod)(M,z.start,1),O=e=>{c({...l,...e}),S(null)};return(0,j.jsxs)(d.default,{style:{gap:12},testID:"pay-settings",children:['none'===r?(0,j.jsx)(i.Banner,{kind:"warn",title:"Pay dates not set up yet",children:"Set your tips and wage dates here. Until then the app uses calendar months and weekly tips."}):null,'questionnaire'===r?(0,j.jsx)(i.Banner,{kind:"info",title:"From your sign-up answers",children:"These dates came from your questionnaire. Check them and tap Save to make them your venue's pay dates."}):null,(0,j.jsx)(f.SectionHead,{title:"Tips (tronc)",sub:"How often tips are paid out, and which days each payout covers."}),(0,j.jsxs)(i.Card,{children:[(0,j.jsx)(i.T,{weight:"semibold",children:"How often"}),(0,j.jsx)(i.Row,{wrap:!0,gap:6,children:['weekly','fortnightly','monthly'].map(e=>(0,j.jsx)(i.Chip,{label:w[e],selected:l.tipsFrequency===e,onPress:()=>O({tipsFrequency:e})},e))}),(0,j.jsx)(i.Field,{label:"A tips payday (DD/MM/YYYY). Every other one is worked out from it",value:p,onChangeText:e=>{y(e),S(null)},placeholder:"02/11/2026",keyboardType:"numbers-and-punctuation"}),D?(0,j.jsxs)(i.Muted,{children:[(0,u.dayMonth)(D)," ",D.slice(0,4)]}):(0,j.jsx)(i.T,{size:13,colour:h.colours.red,children:"Enter a date like 02/11/2026"}),(0,j.jsx)(i.T,{weight:"semibold",children:"Each tips period ends"}),(0,j.jsxs)(i.Row,{children:[(0,j.jsx)(i.Stepper,{label:"days before payday",value:l.tipsEndsDaysBefore,min:0,max:13,onChange:e=>O({tipsEndsDaysBefore:e})}),(0,j.jsx)(i.Muted,{style:{flex:1},children:0===l.tipsEndsDaysBefore?'on payday':1===l.tipsEndsDaysBefore?'day before payday (a Monday payday covers up to the Sunday)':'days before payday'})]})]}),(0,j.jsx)(f.SectionHead,{title:"Wages",sub:"Monthly pay: the cut-off starts each pay period."}),(0,j.jsxs)(i.Card,{children:[(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(i.T,{weight:"semibold",style:{flex:1},children:"Pay day of the month"}),(0,j.jsx)(i.Stepper,{label:"pay day",value:l.wagePayDay,min:1,max:31,onChange:e=>O({wagePayDay:e})})]}),(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(i.T,{weight:"semibold",style:{flex:1},children:"Cut-off (first day of each period)"}),(0,j.jsx)(i.Stepper,{label:"cut-off day",value:l.wageCutoffDay,min:1,max:28,onChange:e=>O({wageCutoffDay:e})})]}),(0,j.jsxs)(i.Muted,{children:["Period runs the ",P(l.wageCutoffDay)," to the ",P(1===l.wageCutoffDay?31:l.wageCutoffDay-1),1===l.wageCutoffDay?' (end of the month)':' of the next month',". A pay day past the month end uses the last day."]}),(0,j.jsx)(i.T,{weight:"semibold",children:"A pay day on a weekend"}),(0,j.jsx)(i.Row,{wrap:!0,gap:6,children:['none','before','after'].map(e=>(0,j.jsx)(i.Chip,{label:T[e],selected:(l.weekendRule??'none')===e,onPress:()=>O({weekendRule:e})},e))})]}),(0,j.jsx)(f.SectionHead,{title:"Preview"}),(0,j.jsxs)(i.Card,{highlight:h.colours.gold,children:[(0,j.jsx)(k,{label:"Next tips payday",day:R.payday,period:R}),(0,j.jsx)(k,{label:"Then",day:v.payday,period:v}),(0,j.jsx)(d.default,{style:{height:1,backgroundColor:h.colours.border}}),(0,j.jsx)(k,{label:"Next payday",day:z.payday,period:z}),(0,j.jsx)(k,{label:"Then",day:$.payday,period:$})]}),(0,j.jsx)(i.Button,{kind:"success",label:'settings'===r?'Save pay dates':'Save as our pay dates',disabled:!D||!B,testID:"save-pay",onPress:()=>{a.useStore.getState().updateSettings(s,{pay:M}),S('Saved. Everyone in the venue sees these dates.')}}),C?(0,j.jsx)(i.Banner,{kind:"success",title:C}):null,(0,j.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Payroll hours",onPress:()=>e('more','hours')}),(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Tips day",onPress:()=>e('more','tipsday')})]})]})},_e.hoursIn=S,Object.defineProperty(_e,"toTsv",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"toCsv",{enumerable:!0,get:function(){return $}}),_e.summaryTable=O,_e.detailTable=H,_e.copyText=I,_e.periodOptions=W,_e.PayrollHours=function({go:e}){const{rid:s,today:n,now:a,r:y}=(0,x.useCtx)(6e4),{pay:f,source:w}=(0,b.useVenuePay)(s),T=(0,l.useOwner)(e=>e.staff),P=(0,l.useOwner)(e=>e.attendance),k=(0,x.useHourly)(),C=(0,o.useMemo)(()=>W(f,n),[f,n]),[B,R]=(0,o.useState)('wage'),[z,F]=(0,o.useState)(null),[V,A]=(0,o.useState)(!1),[E,Y]=(0,o.useState)({}),[G,U]=(0,o.useState)(null),_='custom'===B&&z?z:(C.find(e=>e.id===B)??C[0]).period,q=(0,o.useMemo)(()=>S(_,T,P,a,k),[_.key,T,P,k,Math.floor(a.getTime()/6e4)]),J=q.some(e=>null!=e.rate),K='tips'===_.kind,Q=q.reduce((e,s)=>({c:e.c+s.confirmed,p:e.p+s.pending,s:e.s+s.shifts,g:e.g+(s.gross??0)}),{c:0,p:0,s:0,g:0}),X=q.filter(e=>e.pending>0).length,Z=`${y.name}: hours ${(0,u.rangeText)(_.start,_.end)}`,ee=`hours-${_.start}-to-${_.end}`,se=e=>{U(e),setTimeout(()=>U(null),6e3)};return(0,j.jsxs)(d.default,{style:{gap:10},testID:"payroll-hours",children:['none'===w?(0,j.jsxs)(i.Banner,{kind:"warn",title:"Pay dates not set up",children:[(0,j.jsx)(i.Muted,{children:"Using calendar months for now."}),(0,j.jsx)(i.Button,{small:!0,kind:"ghost",label:"Set your pay dates \u203a",onPress:()=>e('more','paysettings')})]}):null,(0,j.jsxs)(i.Row,{wrap:!0,gap:6,children:[C.map(e=>(0,j.jsx)(i.Chip,{label:e.label,sub:e.sub,selected:B===e.id,onPress:()=>{R(e.id),A(!1)}},e.id)),(0,j.jsx)(i.Chip,{label:"Custom dates",sub:z&&'custom'===B?(0,u.rangeText)(z.start,z.end):'Pick any range',selected:'custom'===B,onPress:()=>A(!V)})]}),V?(0,j.jsx)(N,{onSet:e=>{F(e),R('custom'),A(!1)}}):null,(0,j.jsx)(i.Card,{highlight:h.colours.gold,children:(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,j.jsxs)(d.default,{style:{flexShrink:1,minWidth:0},children:[(0,j.jsxs)(i.T,{weight:"bold",size:18,children:[(0,u.rangeText)(_.start,_.end)," ",_.end.slice(0,4)]}),(0,j.jsxs)(i.Muted,{children:[(0,u.ukDate)(_.start)," to ",(0,u.ukDate)(_.end),_.payday?` \xb7 ${_.payday>=n?'pays':'paid'} ${(0,u.dayMonth)(_.payday)}`:'',K?' \xb7 tips period':'wage'===_.kind?' \xb7 wage period':'']})]}),(0,j.jsxs)(d.default,{style:{alignItems:'flex-end'},children:[(0,j.jsxs)(i.T,{size:22,weight:"bold",colour:h.colours.gold,children:[(0,u.decH)(Q.c)," h"]}),(0,j.jsxs)(i.Muted,{children:["confirmed (",(0,u.hMm)(Q.c),")"]})]})]})}),X?(0,j.jsx)(r.default,{accessibilityRole:"button",accessibilityLabel:"Sign off pending hours",onPress:()=>e('more','signoff'),testID:"pending-banner",children:(0,j.jsxs)(d.default,{style:{backgroundColor:h.colours.amberBg,borderRadius:12,padding:12,borderLeftWidth:6,borderLeftColor:h.colours.amber,gap:4},children:[(0,j.jsxs)(i.T,{weight:"bold",colour:h.colours.amber,children:["\u26a0 ",(0,u.decH)(Q.p)," h still waiting for sign-off (",X," ",1===X?'person':'people',")"]}),(0,j.jsx)(i.T,{size:14,children:"Pending hours are not in the totals or the exports' confirmed columns. Sign them off first so everyone is paid in full."}),(0,j.jsx)(i.T,{weight:"semibold",colour:h.colours.gold,children:"Sign off hours \u203a"})]})}):(0,j.jsx)(i.Banner,{kind:"success",title:"All hours in this period are signed off"}),(0,j.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(i.Button,{small:!0,kind:"success",label:"Copy for spreadsheet",testID:"copy-tsv",onPress:async()=>{const e=await I(v(O(q,_,J,K)));se(e?`Copied ${q.length} rows. Paste into the first cell of your spreadsheet.`:'Copy is not available here. Use Download CSV.')}}),(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Download CSV",onPress:()=>{(0,p.downloadText)(`${ee}.csv`,$(O(q,_,J,K))),se('CSV downloaded (summary).')}}),(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Download CSV (daily detail)",onPress:()=>{(0,p.downloadText)(`${ee}-daily.csv`,$(H(q))),se('CSV downloaded (one line per shift).')}}),(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Print / PDF",onPress:()=>{const e=O(q,_,J,K);(0,p.printTable)(Z,`${(0,u.ukDate)(_.start)} to ${(0,u.ukDate)(_.end)} \xb7 confirmed hours only in the totals \xb7 printed ${(0,u.ukDate)(n)}`,e[0],e.slice(1))}})]}),G?(0,j.jsx)(i.Banner,{kind:"success",title:G}):null,(0,j.jsx)(t.WideTable,{children:(0,j.jsxs)(d.default,{testID:"hours-table",children:[(0,j.jsx)(t.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:h.colours.border,paddingBottom:4},children:['Name','Shifts','Confirmed','Pending',K?'Tips h':'h:mm',J?'Rate':'',J?'Gross':''].map((e,s)=>(0,j.jsx)(i.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{width:L[s]},children:e},s))}),q.map(e=>{const s=!!E[e.person.id];return(0,j.jsxs)(d.default,{style:{borderBottomWidth:1,borderColor:'#222'},children:[(0,j.jsx)(r.default,{accessibilityRole:"button",accessibilityLabel:`${M(e.person)} daily hours`,onPress:()=>Y({...E,[e.person.id]:!s}),style:{paddingVertical:7},children:(0,j.jsxs)(t.TRow,{heads:['Name','Shifts','Confirmed','Pending',K?'Tips h':'h:mm',J?'Rate':'',J?'Gross':''],children:[(0,j.jsxs)(d.default,{style:{width:L[0]},children:[(0,j.jsxs)(i.T,{size:14,weight:"semibold",numberOfLines:1,children:[s?'\u25be':'\u25b8'," ",M(e.person)]}),(0,j.jsx)(i.Muted,{numberOfLines:1,children:D(e.person)})]}),(0,j.jsx)(i.T,{size:14,style:{width:L[1]},children:e.shifts}),(0,j.jsx)(i.T,{size:14,weight:"semibold",style:{width:L[2]},children:(0,u.decH)(e.confirmed)}),(0,j.jsx)(i.T,{size:14,weight:e.pending?'bold':'regular',colour:e.pending?h.colours.amber:h.colours.muted,style:{width:L[3]},children:e.pending?`\u26a0 ${(0,u.decH)(e.pending)}`:'0.00'}),(0,j.jsx)(i.T,{size:14,style:{width:L[4]},children:K?(0,u.decH)(e.confirmed):(0,u.hMm)(e.confirmed)}),(0,j.jsx)(i.T,{size:14,colour:h.colours.muted,style:{width:L[5]},children:J?null!=e.rate?(0,c.gbp)(e.rate):'\u2013':''}),(0,j.jsx)(i.T,{size:14,weight:"semibold",style:{width:L[6]},children:J?null!=e.gross?(0,c.gbp)(e.gross):'\u2013':''})]})}),s?(0,j.jsxs)(d.default,{style:{backgroundColor:h.colours.surface2,borderRadius:8,padding:8,marginBottom:8,gap:2},testID:`daily-${e.person.id}`,children:[(0,j.jsx)(t.TRow,{head:!0,children:['Date','In','Out','Break','Paid','Status'].map((e,s)=>(0,j.jsx)(i.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{width:[96,52,52,52,56,90][s]},children:e},e))}),e.days.map(e=>(0,j.jsxs)(t.TRow,{heads:['Date','In','Out','Break','Paid','Status'],children:[(0,j.jsx)(i.T,{size:13,style:{width:96},children:(0,u.dayMonth)(e.date)}),(0,j.jsx)(i.T,{size:13,style:{width:52},children:e.inT}),(0,j.jsx)(i.T,{size:13,style:{width:52},children:e.outT||'\u2013'}),(0,j.jsx)(i.T,{size:13,style:{width:52},children:'On now'===e.status?'\u2013':`${e.brk}m`}),(0,j.jsx)(i.T,{size:13,style:{width:56},children:'On now'===e.status?'\u2013':(0,u.hMm)(e.paid)}),(0,j.jsx)(i.T,{size:13,weight:"semibold",style:{width:90},colour:'Confirmed'===e.status?h.colours.ok:'Pending'===e.status?h.colours.amber:h.colours.blue,children:e.status})]},e.a.id)),e.days.length?null:(0,j.jsx)(i.Muted,{children:"No clocked shifts in this period."})]}):null]},e.person.id)}),(0,j.jsxs)(t.TRow,{heads:['','Shifts','Confirmed','Pending',K?'Tips h':'h:mm','',J?'Gross':''],style:{paddingVertical:8,borderTopWidth:2,borderColor:h.colours.gold},children:[(0,j.jsxs)(i.T,{size:14,weight:"bold",style:{width:L[0]},children:["Total (",q.length,")"]}),(0,j.jsx)(i.T,{size:14,weight:"bold",style:{width:L[1]},children:Q.s}),(0,j.jsx)(i.T,{size:14,weight:"bold",colour:h.colours.gold,style:{width:L[2]},children:(0,u.decH)(Q.c)}),(0,j.jsx)(i.T,{size:14,weight:"bold",colour:Q.p?h.colours.amber:h.colours.muted,style:{width:L[3]},children:(0,u.decH)(Q.p)}),(0,j.jsx)(i.T,{size:14,weight:"bold",style:{width:L[4]},children:K?(0,u.decH)(Q.c):(0,u.hMm)(Q.c)}),(0,j.jsx)(i.T,{size:14,style:{width:L[5]},children:" "}),(0,j.jsx)(i.T,{size:14,weight:"bold",style:{width:L[6]},children:J?(0,c.gbp)(Q.g):''})]})]})}),(0,j.jsxs)(i.Muted,{children:["Tap a name for each day. Hours are decimal (37.50 = 37 hours 30 minutes); h:mm is also in the export. Paid hours = clock out \u2212 clock in \u2212 break. ",J?'Gross is before tax, from confirmed hours only.':'Rates and gross show once you sign in with your personal link.']}),K?(0,j.jsx)(i.Button,{kind:"success",label:"Tips day: split tips for this period \u203a",onPress:()=>e('more','tipsday')}):null]})},_e.TipsDay=function({go:e}){const{rid:n,today:a,now:f}=(0,x.useCtx)(6e4),{pay:w,source:T}=(0,b.useVenuePay)(n),P=(0,l.useOwner)(e=>e.staff),k=(0,l.useOwner)(e=>e.attendance),C=(0,l.useOwner)(e=>e.tronc),R=(0,u.nextToPay)(w,'tips',a),[z,O]=(0,o.useState)(0),H=(0,u.tipsPeriod)(w,R.period.start,z),[W,N]=(0,o.useState)(''),[L,F]=(0,o.useState)({}),[V,A]=(0,o.useState)(null),E=(0,o.useMemo)(()=>S(H,P,k,f,{}),[H.key,P,k]),Y=e=>'owner'===e.role&&!C.includeOwner||'manager'===e.role&&!C.includeManagers,G=e=>L[e.id]??Y(e),U=E.filter(e=>e.confirmed>0||e.pending>0),_=Math.round(100*Number(W.replace(/[\xa3,\s]/g,''))),q=Number.isFinite(_)&&_>0&&_<=1e8&&/^\s*\xa3?\s*[\d,]+(\.\d{0,2})?\s*$/.test(W),J=U.filter(e=>!G(e.person)&&e.confirmed>0),{amounts:K}=(0,y.allocate)(q?_:0,J.map(e=>e.confirmed)),Q={};J.forEach((e,s)=>{Q[e.person.id]=K[s]});const X=J.reduce((e,s)=>e+s.confirmed,0),Z=Object.values(Q).reduce((e,s)=>e+s,0),ee=U.filter(e=>e.pending>0&&!G(e.person)),se=ee.reduce((e,s)=>e+s.pending,0),te=()=>[['Name','Role','Period start','Period end','Payday','Confirmed hours','Confirmed h:mm','Share %','Tips \xa3'],...U.map(e=>{const s=!G(e.person)&&e.confirmed>0;return[M(e.person),D(e.person),(0,u.ukDate)(H.start),(0,u.ukDate)(H.end),H.payday?(0,u.ukDate)(H.payday):'',(0,u.decH)(e.confirmed),(0,u.hMm)(e.confirmed),s&&X?(e.confirmed/X*100).toFixed(2):'0.00',s?B(Q[e.person.id]??0):G(e.person)?'excluded':'0.00']}),['TOTAL','',(0,u.ukDate)(H.start),(0,u.ukDate)(H.end),H.payday?(0,u.ukDate)(H.payday):'',(0,u.decH)(X),(0,u.hMm)(X),X?'100.00':'0.00',B(Z)]],oe=e=>{A(e),setTimeout(()=>A(null),6e3)};return(0,j.jsxs)(d.default,{style:{gap:10},testID:"tips-day",children:[(0,j.jsx)(i.Banner,{kind:"info",title:"Saving payouts and notifying staff are coming next",children:"For now this works out the split and exports it. Nothing is saved to the team, sent or paid."}),'none'===T?(0,j.jsxs)(i.Banner,{kind:"warn",title:"Tips dates not set up",children:[(0,j.jsx)(i.Muted,{children:"Using weekly tips for now."}),(0,j.jsx)(i.Button,{small:!0,kind:"ghost",label:"Set your pay dates \u203a",onPress:()=>e('more','paysettings')})]}):null,(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between'},children:[(0,j.jsx)(i.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",disabled:z<=-6,onPress:()=>O(z-1)}),(0,j.jsxs)(d.default,{style:{alignItems:'center',flex:1},children:[(0,j.jsx)(i.T,{weight:"bold",size:18,children:(0,u.rangeText)(H.start,H.end)}),(0,j.jsxs)(i.Muted,{children:[(0,u.ukDate)(H.start)," to ",(0,u.ukDate)(H.end)," \xb7 ",H.payday>=a?'paid':'was paid'," ",(0,u.dayMonth)(H.payday)]}),0===z?(0,j.jsx)(i.Badge,{kind:"gold",label:"Paid next"}):null]}),(0,j.jsx)(i.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:z>=1,onPress:()=>O(z+1)})]}),(0,j.jsxs)(i.Card,{highlight:h.colours.gold,children:[(0,j.jsx)(i.T,{weight:"semibold",children:"Total tips to share"}),(0,j.jsxs)(i.Row,{style:{alignItems:'center'},children:[(0,j.jsx)(i.T,{size:28,weight:"bold",colour:h.colours.gold,children:"\xa3"}),(0,j.jsx)(s.TextInput,{testID:"tips-total",accessibilityLabel:"Total tips in pounds",value:W,onChangeText:N,placeholder:"0.00",placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",style:[i.styles.input,{flex:1,fontSize:26,fontWeight:'700'}]})]}),W&&!q?(0,j.jsx)(i.T,{size:13,colour:h.colours.red,children:"Enter an amount like 1250.00"}):(0,j.jsx)(i.Muted,{children:"Shared by confirmed hours: share = total \xd7 (their hours \xf7 everyone's hours). Rounded to the penny; leftover pennies go to the largest shares so it adds up exactly."})]}),ee.length?(0,j.jsx)(r.default,{accessibilityRole:"button",onPress:()=>e('more','signoff'),testID:"tips-pending",children:(0,j.jsxs)(d.default,{style:{backgroundColor:h.colours.redBg,borderRadius:12,padding:12,borderLeftWidth:6,borderLeftColor:h.colours.red,gap:4},children:[(0,j.jsxs)(i.T,{weight:"bold",colour:h.colours.red,children:["\u26a0 Don't pay out yet: ",(0,u.decH)(se)," h not signed off"]}),(0,j.jsxs)(i.T,{size:14,children:[ee.map(e=>`${M(e.person)} (${(0,u.decH)(e.pending)} h)`).join(', '),". Pending hours are left out of the split, so these people would get less than they should."]}),(0,j.jsx)(i.T,{weight:"semibold",colour:h.colours.gold,children:"Sign off hours \u203a"})]})}):U.length?(0,j.jsx)(i.Banner,{kind:"success",title:"All hours in this fortnight are signed off"}):null,(0,j.jsx)(t.WideTable,{children:(0,j.jsxs)(d.default,{testID:"tips-table",children:[(0,j.jsx)(t.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:h.colours.border,paddingBottom:4},children:['Include','Name','Confirmed','Share','Tips'].map((e,s)=>(0,j.jsx)(i.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{width:[64,150,80,64,84][s]},children:e},e))}),U.map(e=>{const s=G(e.person),o=Q[e.person.id]??0;return(0,j.jsxs)(t.TRow,{heads:['Include','Name','Confirmed','Share','Tips'],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222',opacity:s?.5:1},children:[(0,j.jsx)(r.default,{accessibilityRole:"checkbox",accessibilityState:{checked:!s},accessibilityLabel:`Include ${M(e.person)}`,onPress:()=>F({...L,[e.person.id]:!s}),style:{width:64,minHeight:44,justifyContent:'center'},children:(0,j.jsx)(d.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:s?h.colours.muted:h.colours.ok,backgroundColor:s?'transparent':h.colours.okBg,alignItems:'center',justifyContent:'center'},children:(0,j.jsx)(i.T,{size:14,colour:h.colours.ok,children:s?'':'\u2713'})})}),(0,j.jsxs)(d.default,{style:{width:150},children:[(0,j.jsx)(i.T,{size:14,weight:"semibold",numberOfLines:1,children:M(e.person)}),(0,j.jsxs)(i.Muted,{numberOfLines:1,children:[s?'Excluded':D(e.person),e.pending?` \xb7 \u26a0 ${(0,u.decH)(e.pending)} h pending`:'']})]}),(0,j.jsxs)(i.T,{size:14,style:{width:80},children:[(0,u.decH)(e.confirmed)," h"]}),(0,j.jsx)(i.T,{size:14,colour:h.colours.muted,style:{width:64},children:!s&&X?`${(e.confirmed/X*100).toFixed(1)}%`:'\u2013'}),(0,j.jsx)(i.T,{size:15,weight:"bold",colour:s?h.colours.muted:h.colours.gold,style:{width:84},children:s?'\u2013':(0,c.gbp)(o)})]},e.person.id)}),(0,j.jsxs)(t.TRow,{heads:['','','Confirmed','Share','Tips'],style:{paddingVertical:8,borderTopWidth:2,borderColor:h.colours.gold},children:[(0,j.jsx)(i.T,{size:14,style:{width:64},children:" "}),(0,j.jsxs)(i.T,{size:14,weight:"bold",style:{width:150},children:["Total (",J.length," people)"]}),(0,j.jsxs)(i.T,{size:14,weight:"bold",style:{width:80},children:[(0,u.decH)(X)," h"]}),(0,j.jsx)(i.T,{size:14,style:{width:64},children:X?'100%':'\u2013'}),(0,j.jsx)(i.T,{size:15,weight:"bold",colour:q&&Z===_?h.colours.ok:h.colours.text,style:{width:84},children:(0,c.gbp)(Z)})]})]})}),U.length?null:(0,j.jsx)(i.Muted,{children:"No clocked hours in this fortnight yet."}),q&&X?(0,j.jsxs)(i.Muted,{children:["Check: ",J.length," shares add up to ",(0,c.gbp)(Z)," of ",(0,c.gbp)(_)," ",Z===_?'\u2713':'',". \xa3",(_/100/(X/60)).toFixed(4)," per confirmed hour."]}):null,(0,j.jsxs)(i.Muted,{children:["Owner ",C.includeOwner?'included':'left out'," and managers ",C.includeManagers?'included':'left out'," by default (your tipping policy in Tips (tronc)). Tick or untick anyone for this split."]}),(0,j.jsxs)(i.Row,{wrap:!0,gap:6,children:[(0,j.jsx)(i.Button,{small:!0,kind:"success",label:"Copy for spreadsheet",testID:"tips-copy",disabled:!q,onPress:async()=>{const e=await I(v(te()));oe(e?'Copied. Paste into the first cell of your spreadsheet.':'Copy is not available here. Use Download CSV.')}}),(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Download CSV",disabled:!q,onPress:()=>{(0,p.downloadText)(`tips-${H.start}-to-${H.end}.csv`,$(te())),oe('CSV downloaded.')}}),(0,j.jsx)(i.Button,{small:!0,kind:"secondary",label:"Print / PDF",disabled:!q,onPress:()=>{const e=te();(0,p.printTable)(`Tips ${(0,u.rangeText)(H.start,H.end)} (paid ${(0,u.dayMonth)(H.payday)})`,`Total ${(0,c.gbp)(_)} shared by confirmed hours${ee.length?` \xb7 WARNING ${(0,u.decH)(se)} h not signed off`:''}`,e[0],e.slice(1))}})]}),V?(0,j.jsx)(i.Banner,{kind:"success",title:V}):null]})},_e.PaydaysCard=function({go:e}){const{rid:s,today:t}=(0,x.useCtx)(6e4),{pay:o,source:r}=(0,b.useVenuePay)(s),a=(0,u.nextToPay)(o,'tips',t).period,l=(0,u.nextToPay)(o,'wage',t).period;return(0,j.jsxs)(d.default,{testID:"paydays-card",style:{backgroundColor:h.colours.surface,borderRadius:16,borderWidth:1,borderColor:h.colours.hairline,padding:16,gap:8},children:[(0,j.jsx)(n.CardHeading,{right:'none'===r?(0,j.jsx)(i.Badge,{kind:"amber",label:"Not set up"}):null,children:"Paydays"}),(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,j.jsxs)(i.T,{children:["Next tips payday: ",(0,j.jsx)(i.T,{weight:"semibold",colour:h.colours.goldLight,children:a.payday===t?'today':(0,u.dayMonth)(a.payday)})]}),(0,j.jsx)(i.Muted,{children:(0,u.rangeText)(a.start,a.end)})]}),(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,j.jsxs)(i.T,{children:["Next payday: ",(0,j.jsx)(i.T,{weight:"semibold",colour:h.colours.goldLight,children:l.payday===t?'today':(0,u.dayMonth)(l.payday)})]}),(0,j.jsxs)(i.Muted,{children:["period ",(0,u.rangeText)(l.start,l.end)]})]}),(0,j.jsxs)(n.ActionGrid,{testID:"paydays-actions",children:[(0,j.jsx)(n.ActionTile,{primary:!0,icon:"payroll",label:"Payroll hours",sub:"Copy or export",onPress:()=>e('more','hours'),testID:"paydays-hours"}),(0,j.jsx)(n.ActionTile,{icon:"tips",label:"Tips day",sub:"Share out tips",onPress:()=>e('more','tipsday'),testID:"paydays-tips"})]}),'settings'!==r?(0,j.jsx)(i.Button,{small:!0,kind:"ghost",label:"Pay & tips settings",onPress:()=>e('more','paysettings'),style:{alignSelf:'flex-start'}}):null]})},_e.MyPeriods=function({staffId:e}){const{rid:s,today:t,now:o,meId:n}=(0,x.useCtx)(6e4),r=e??n,{pay:a}=(0,b.useVenuePay)(s),c=(0,l.useOwner)(e=>e.attendance),p=(0,l.useOwner)(e=>e.staff.find(e=>e.id===r)),y=(0,u.wagePeriod)(a,t,0),f=(0,u.tipsPeriod)(a,t,0),w=e=>p?S(e,[p],c,o,{})[0]??null:null,T=(e,s,o)=>(0,j.jsxs)(d.default,{style:{flexGrow:1,flexBasis:160,backgroundColor:h.colours.surface,borderRadius:14,borderWidth:1,borderColor:h.colours.border,padding:12,gap:2},children:[(0,j.jsx)(i.T,{size:13,weight:"semibold",colour:h.colours.gold,children:e.toUpperCase()}),(0,j.jsxs)(i.Muted,{children:[(0,u.rangeText)(s.start,s.end)," \xb7 ",s.payday>=t?'paid':'was paid'," ",(0,u.dayMonth)(s.payday)]}),(0,j.jsxs)(i.T,{size:24,weight:"bold",children:[(0,u.decH)(o?.confirmed??0)," h"]}),(0,j.jsxs)(i.Muted,{children:["confirmed (",(0,u.hMm)(o?.confirmed??0),") \xb7 ",o?.shifts??0," shifts"]}),o?.pending?(0,j.jsxs)(i.T,{size:13,colour:h.colours.amber,children:["+ ",(0,u.decH)(o.pending)," h waiting for sign-off"]}):null]},e);return(0,j.jsx)(i.Row,{wrap:!0,gap:8,style:{alignItems:'stretch'},children:[T('This pay period',y,w(y)),T('This tips fortnight',f,w(f))]})};var s=_r(_d[0]),t=_r(_d[1]),o=_r(_d[2]),n=_r(_d[3]);_r(_d[4]);var r=e(_r(_d[5])),d=e(_r(_d[6])),i=_r(_d[7]),a=_r(_d[8]),l=_r(_d[9]),c=_r(_d[10]),u=_r(_d[11]),h=_r(_d[12]),p=_r(_d[13]),y=_r(_d[14]),f=_r(_d[15]),x=_r(_d[16]),b=_r(_d[17]),j=_r(_d[18]);const w={weekly:'Weekly',fortnightly:'Fortnightly',monthly:'Monthly'},T={none:'Keep the date',before:'Friday before',after:'Monday after'};const P=e=>`${e}${e%10==1&&11!==e?'st':e%10==2&&12!==e?'nd':e%10==3&&13!==e?'rd':'th'}`;function k({label:e,day:s,period:t}){return(0,j.jsxs)(i.Row,{style:{justifyContent:'space-between',flexWrap:'wrap'},children:[(0,j.jsxs)(i.T,{children:[e,": ",(0,j.jsx)(i.T,{weight:"bold",colour:h.colours.gold,children:(0,u.dayMonth)(s)})]}),(0,j.jsx)(i.Muted,{children:(0,u.rangeText)(t.start,t.end)})]})}const C=e=>{if(!e)return'';const s=new Date(e);return`${String(s.getHours()).padStart(2,'0')}:${String(s.getMinutes()).padStart(2,'0')}`};function S(e,s,t,o,n){const r=t.filter(s=>s.in&&s.date>=e.start&&s.date<=e.end);return s.map(e=>{const s=r.filter(s=>s.staffId===e.id).sort((e,s)=>e.date.localeCompare(s.date)||(e.in??'').localeCompare(s.in??'')).map(e=>{const s=(0,x.paidMins)(e,o),t=(0,l.attStatus)(e);return{a:e,date:e.date,inT:C(e.in),outT:C(e.out),brk:s.brk,paid:s.paid,status:'open'===t?'On now':'awaiting'===t?'Pending':'Confirmed'}}),t=e=>s.filter(s=>s.status===e).reduce((e,s)=>e+s.paid,0),d=t('Confirmed'),i=n[e.id];return{person:e,confirmed:d,pending:t('Pending'),open:t('On now'),shifts:s.filter(e=>'On now'!==e.status).length,days:s,rate:i,gross:null!=i?Math.round(d/60*i):void 0}}).filter(e=>e.days.length>0||e.person.active&&'owner'!==e.person.role)}const D=e=>`${l.ROLE_LABEL[e.role]}${e.job?` \xb7 ${e.job}`:''}`,M=e=>e.name.replace(' (example)',''),B=e=>null==e?'':(e/100).toFixed(2),R=e=>e.replace(/[\t\r\n]+/g,' '),z=e=>/[",\n]/.test(e)?`"${e.replace(/"/g,'""')}"`:e,v=e=>e.map(e=>e.map(R).join('\t')).join('\n'),$=e=>e.map(e=>e.map(z).join(',')).join('\r\n');function O(e,s,t,o){const n=['Name','Role','Period start','Period end','Confirmed hours','Confirmed h:mm','Pending hours','Pending h:mm','Shifts',...o?['Tips hours']:[],...t?['Rate \xa3/h','Gross \xa3']:[]],r=e.map(e=>[M(e.person),D(e.person),(0,u.ukDate)(s.start),(0,u.ukDate)(s.end),(0,u.decH)(e.confirmed),(0,u.hMm)(e.confirmed),(0,u.decH)(e.pending),(0,u.hMm)(e.pending),String(e.shifts),...o?[(0,u.decH)(e.confirmed)]:[],...t?[B(e.rate),B(e.gross)]:[]]),d=e.reduce((e,s)=>({c:e.c+s.confirmed,p:e.p+s.pending,s:e.s+s.shifts,g:e.g+(s.gross??0)}),{c:0,p:0,s:0,g:0});return[n,...r,['TOTAL','',(0,u.ukDate)(s.start),(0,u.ukDate)(s.end),(0,u.decH)(d.c),(0,u.hMm)(d.c),(0,u.decH)(d.p),(0,u.hMm)(d.p),String(d.s),...o?[(0,u.decH)(d.c)]:[],...t?['',B(d.g)]:[]]]}function H(e){return[['Name','Role','Date','In','Out','Break mins','Paid hours','Paid h:mm','Status'],...e.flatMap(e=>e.days.map(s=>[M(e.person),D(e.person),(0,u.ukDate)(s.date),s.inT,s.outT,'On now'===s.status?'':String(s.brk),'On now'===s.status?'':(0,u.decH)(s.paid),'On now'===s.status?'':(0,u.hMm)(s.paid),s.status]))]}async function I(e){if('undefined'==typeof document)return!1;try{if(navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}try{const s=document.createElement('textarea');s.value=e,s.style.position='fixed',s.style.opacity='0',document.body.appendChild(s),s.select();const t=document.execCommand('copy');return s.remove(),t}catch{return!1}}function W(e,s){const t=(0,u.nextToPay)(e,'wage',s),o=(0,u.nextToPay)(e,'tips',s),n=(0,u.wagePeriod)(e,t.period.start,-1),r=(0,u.tipsPeriod)(e,o.period.start,-1),d=e=>e.payday>=s?e.payday===s?'Pays today':`Pays ${(0,u.dayMonth)(e.payday)}`:`Paid ${(0,u.dayMonth)(e.payday)}`;return[{id:'wage',label:`Wages ${(0,u.rangeText)(t.period.start,t.period.end)}`,sub:d(t.period),period:t.period},{id:'wagePrev',label:`Wages ${(0,u.rangeText)(n.start,n.end)}`,sub:d(n),period:n},{id:'tips',label:`Tips ${(0,u.rangeText)(o.period.start,o.period.end)}`,sub:d(o.period),period:o.period},{id:'tipsPrev',label:`Tips ${(0,u.rangeText)(r.start,r.end)}`,sub:d(r),period:r}]}function N({onSet:e}){const[s,t]=(0,o.useState)(''),[n,r]=(0,o.useState)(''),a=(0,u.parseUk)(s),l=(0,u.parseUk)(n),c=!!a&&!!l&&l>=a&&(0,u.plusDays)(a,92)>=l;return(0,j.jsxs)(i.Row,{wrap:!0,gap:6,style:{alignItems:'flex-end'},children:[(0,j.jsx)(d.default,{style:{flexBasis:130,flexGrow:1},children:(0,j.jsx)(i.Field,{label:"From (DD/MM/YYYY)",value:s,onChangeText:t,placeholder:"23/10/2026"})}),(0,j.jsx)(d.default,{style:{flexBasis:130,flexGrow:1},children:(0,j.jsx)(i.Field,{label:"To (DD/MM/YYYY)",value:n,onChangeText:r,placeholder:"22/11/2026"})}),(0,j.jsx)(i.Button,{small:!0,kind:"success",label:"Show",disabled:!c,onPress:()=>c&&e((0,u.customPeriod)(a,l))}),s&&n&&!c?(0,j.jsx)(i.T,{size:13,colour:h.colours.red,children:"Use two dates, the second on or after the first, up to 3 months apart."}):null]})}const L=[150,54,62,62,48,62,70]},1007,[875,1337,30,1338,122,263,127,813,870,854,816,1109,821,1339,1009,1017,926,1110,24]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.useWeekSales=F,_e.Rota=function(){const{now:e,role:t,meId:n}=(0,C.useCtx)(6e4),o=(0,f.useOwner)(e=>e.staff).filter(e=>e.active),i=(0,f.useOwner)(e=>e.shifts),h=(0,C.useHourly)(),m=(0,f.useOwner)(e=>e.availability),p=(0,f.useOwner)(e=>e.leave),x=(0,f.useOwner)(e=>e.swaps),[I,v]=(0,l.useState)(0),[D,T]=(0,l.useState)(null),[$,M]=(0,l.useState)(null),[R,P]=(0,l.useState)('week'),[z,H]=(0,l.useState)(''),[W,E]=(0,l.useState)(''),[_,q]=(0,l.useState)(''),K='staff'!==t,U=(0,b.addMins)(L(e),7*I*1440);U.setHours(0,0,0,0);const V=F(U),G=V.sales,X='none'===V.mode,J=Array.from({length:7},(e,t)=>{const s=new Date(U);return s.setDate(U.getDate()+t),(0,b.ymd)(s)}),Q=(0,f.visibleShifts)(i,K).filter(e=>e.date>=J[0]&&e.date<=J[6]),Z=(()=>{const e=new Date(U);return e.setDate(e.getDate()-7),(0,b.ymd)(e)})(),ee=Q.filter(e=>!e.published||e.changed).length,te=i.filter(e=>e.date>=Z&&e.datep.some(s=>s.staffId===e&&'approved'===s.status&&s.from<=t&&t<=s.to),ne=J.map(e=>Q.filter(t=>t.date===e).reduce((e,t)=>{return e+(A(s=t)-Y(A(s)))*(h[s.staffId]??0);var s},0)),ae=ne.reduce((e,t)=>e+t,0),oe=G.reduce((e,t)=>e+t,0),ie=(e,t)=>t?Math.round(e/t*100):0,le=K?o:o.filter(e=>e.id===n),re=(0,a.useNarrow)(),de=Math.max(0,J.indexOf((0,b.ymd)(e))),[ce,ue]=(0,l.useState)(null),he=ce??de,fe=(e,t)=>!re||t===he,me=re?150:74;return(0,B.jsxs)(c.default,{style:{gap:10},children:[(0,B.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,B.jsx)(u.Chip,{label:"Week",selected:'week'===R,onPress:()=>P('week')}),(0,B.jsx)(u.Chip,{label:`Swaps & leave (${x.filter(e=>'open'===e.status).length+p.filter(e=>'pending'===e.status).length})`,selected:'requests'===R,onPress:()=>P('requests')}),(0,B.jsx)(u.Chip,{label:"Availability",selected:'availability'===R,onPress:()=>P('availability')})]}),'week'===R?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsx)(u.Button,{small:!0,kind:"ghost",label:"\u2039 Prev",accessibilityLabel:"Previous week",onPress:()=>{v(I-1),T(null)}}),(0,B.jsxs)(c.default,{style:{alignItems:'center',flex:1},children:[(0,B.jsxs)(u.T,{weight:"semibold",children:["Week of ",(0,b.niceDate)(U)]}),(0,B.jsxs)(u.Muted,{children:[0===I?'This week':1===I?'Next week':-1===I?'Last week':I>0?`In ${I} weeks`:-I+" weeks ago",K?' \xb7 tap a cell to add or edit':' \xb7 your shifts']})]}),(0,B.jsx)(u.Button,{small:!0,kind:"ghost",label:"Next \u203a",accessibilityLabel:"Next week",onPress:()=>{v(I+1),T(null)}})]}),K?(0,B.jsxs)(u.Row,{wrap:!0,gap:8,style:{alignItems:'center'},children:[(0,B.jsx)(u.Button,{small:!0,kind:"secondary",label:"Copy last week"+(te?` (${te})`:''),disabled:!te,testID:"rota-copy",onPress:()=>{const e=f.useOwner.getState().copyWeek(Z,J[0]);T(e?`Copied ${e} ${1===e?'shift':'shifts'} from last week as drafts. Check them, then publish.`:'Nothing to copy: those days are already filled.')}}),(0,B.jsx)(u.Button,{small:!0,kind:"success",label:ee?`Publish ${ee} ${1===ee?'change':'changes'}`:'Week published',disabled:!ee,testID:"rota-publish",onPress:()=>{const e=f.useOwner.getState().publishWeek(J[0]);T(`Published ${e} ${1===e?'shift':'shifts'}. Staff see them in their app.`)}}),ee?(0,B.jsx)(u.Badge,{kind:"amber",label:`${ee} unpublished`}):Q.length?(0,B.jsx)(u.Badge,{kind:"ok",label:"Visible to staff"}):null]}):null,D?(0,B.jsx)(u.Banner,{kind:"success",title:D}):null,re?(0,B.jsx)(u.Row,{wrap:!0,gap:6,children:C.DAY3.map((e,t)=>(0,B.jsx)(u.Chip,{label:`${e} ${(0,b.parseYmd)(J[t]).getDate()}`,selected:t===he,onPress:()=>ue(t)},e))}):null,(0,B.jsx)(d.default,{horizontal:!re,showsHorizontalScrollIndicator:!0,children:(0,B.jsxs)(c.default,{style:{gap:4},children:[(0,B.jsxs)(u.Row,{gap:4,children:[(0,B.jsx)(c.default,{style:{width:126}}),C.DAY3.map((t,s)=>(0,B.jsx)(c.default,{style:{width:me,alignItems:'center'},children:(0,B.jsxs)(u.T,{size:12,weight:"semibold",colour:J[s]===(0,b.ymd)(e)?w.colours.gold:w.colours.text,children:[t," ",(0,b.parseYmd)(J[s]).getDate()]})},t)).filter(fe)]}),le.map(e=>(0,B.jsxs)(u.Row,{gap:4,children:[(0,B.jsxs)(u.Row,{gap:6,style:{width:126},children:[(0,B.jsx)(S.StaffAvatar,{id:e.id,size:26}),(0,B.jsxs)(c.default,{style:{flex:1},children:[(0,B.jsx)(u.T,{size:12,numberOfLines:1,children:e.name.replace(' (example)','')}),(0,B.jsx)(u.Muted,{numberOfLines:1,children:e.job})]})]}),C.DAY3.map((t,s)=>{const n=(0,f.shiftOf)(Q,e.id,J[s]),a=(m[e.id]??[]).includes(s),o=se(e.id,J[s]);return(0,B.jsxs)(r.default,{accessibilityRole:"button",accessibilityLabel:`${e.name} ${C.DAY3[s]} ${n?`${(0,C.fmtH)(n.start)} to ${(0,C.fmtH)(n.end)}`:'no shift'}`,disabled:!K,onPress:()=>M({staffId:e.id,date:J[s],shift:n}),style:{width:me,height:48,borderRadius:10,borderWidth:1,borderStyle:n&&!n.published?'dashed':'solid',borderColor:n?n.published?w.colours.gold:w.colours.amber:w.colours.border,backgroundColor:n?n.published?'#2b2414':'#241f14':o?'#1d2a3a':a?'#2a1d1d':'transparent',alignItems:'center',justifyContent:'center'},children:[n?(0,B.jsxs)(u.T,{size:11,weight:"semibold",children:[(0,C.fmtH)(n.start),"\u2013",(0,C.fmtH)(n.end)]}):(0,B.jsx)(u.T,{size:11,colour:w.colours.muted,children:o?'Leave':a?'Unavail.':K?'Add':'\u2013'}),n&&(a||o)?(0,B.jsx)(u.T,{size:9,colour:w.colours.red,children:o?'on leave!':'unavailable'}):n&&K&&(!n.published||n.changed)?(0,B.jsx)(u.T,{size:9,colour:w.colours.amber,children:n.published?'changed':'draft'}):null]},s)}).filter(fe)]},e.id)),K?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(u.Row,{gap:4,children:[(0,B.jsx)(c.default,{style:{width:96},children:(0,B.jsx)(u.Muted,{children:"Labour"})}),ne.map((e,t)=>(0,B.jsx)(c.default,{style:{width:me,alignItems:'center'},children:(0,B.jsx)(u.T,{size:11,children:(0,j.gbp)(e).replace('.00','')})},t)).filter(fe)]}),X?null:(0,B.jsxs)(u.Row,{gap:4,children:[(0,B.jsx)(c.default,{style:{width:96},children:(0,B.jsx)(u.Muted,{children:'example'===V.mode?'Fcst sales (ex.)':'Fcst sales'})}),G.map((e,t)=>(0,B.jsx)(c.default,{style:{width:me,alignItems:'center'},children:(0,B.jsx)(u.T,{size:11,colour:w.colours.muted,children:e?`\xa3${Math.round(e/100)}`:'shut'})},t)).filter(fe)]}),X?null:(0,B.jsxs)(u.Row,{gap:4,children:[(0,B.jsx)(c.default,{style:{width:96},children:(0,B.jsx)(u.Muted,{children:"Labour %"})}),ne.map((e,t)=>{const s=ie(e,G[t]);return(0,B.jsx)(c.default,{style:{width:me,alignItems:'center'},children:(0,B.jsx)(u.T,{size:11,weight:"semibold",colour:G[t]?s>32?w.colours.red:s>26?w.colours.amber:w.colours.ok:w.colours.muted,children:G[t]?`${s}%`:'\u2013'})},t)}).filter(fe)]})]}):null]})}),K&&X?(0,B.jsx)(u.Card,{children:(0,B.jsxs)(c.default,{testID:"labour-no-forecast",style:{gap:6},children:[(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsx)(u.T,{weight:"semibold",children:"Labour this week"}),(0,B.jsx)(c.default,{testID:"labour-week-cost",children:(0,B.jsx)(u.T,{weight:"semibold",children:(0,j.gbp)(ae)})})]}),(0,B.jsxs)(u.Muted,{children:[(0,j.gbp)(ae)," labour from the rota (paid hours \xd7 hourly rates, owner salaries excluded)."]}),(0,B.jsx)(u.T,{weight:"semibold",colour:w.colours.gold,children:"Not enough history yet for labour vs sales"}),(0,B.jsx)(u.Muted,{children:`Forecasts start once CoverCharge has ${1===V.weeks?'1 week':`${V.weeks} weeks`} of your bookings and cash-ups. Until then no sales forecast or labour % is shown.`}),V.booked?(0,B.jsx)(c.default,{testID:"labour-booked",children:(0,B.jsxs)(u.T,{children:["Booked so far: ",V.booked," covers this week"]})}):null]})}):null,K&&!X?(0,B.jsxs)(u.Card,{children:[(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsx)(u.T,{weight:"semibold",children:"Labour vs forecast sales"}),(0,B.jsxs)(u.Row,{gap:6,children:['example'===V.mode?(0,B.jsx)(O.ExampleBadge,{}):null,(0,B.jsx)(u.Badge,{kind:ie(ae,oe)>30?'red':'ok',label:`${ie(ae,oe)}% this week`})]})]}),(0,B.jsxs)(u.Muted,{children:[(0,j.gbp)(ae)," labour (paid hours \xd7 hourly rates, owner salaries excluded) vs about ",(0,j.gbp)(oe)," forecast sales. Target 25\u201330%. ",'example'===V.mode?'Example figures: forecast sales use an example spend per cover.':'Forecast sales are your average takings for each weekday from your cash-ups.']}),(()=>{const e=ie(ne[5],G[5]);return e&&e<24?(0,B.jsxs)(u.T,{size:14,colour:w.colours.gold,children:["Tip: Saturday is forecast busy and labour is only ",e,"%. Consider an extra server 18:00\u201321:00."]}):null})()]}):null,K?(0,B.jsx)(u.Muted,{center:!0,children:"New and copied shifts are drafts (dashed) until you publish. Publishing only makes shifts visible in the Staff app and on the Display. Nothing is sent by text or email."}):null]}):null,'requests'===R?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(k.SectionHead,{title:"Shift swaps & cover"}),x.filter(e=>K||e.fromId===n||e.toId===n).map(e=>{const t=i.find(t=>t.id===e.shiftId),s=o.find(t=>t.id===e.fromId),n=o.find(t=>t.id===e.toId);return(0,B.jsxs)(u.Card,{children:[(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsxs)(u.T,{weight:"semibold",style:{flex:1},children:['swap'===e.kind?'Swap':'Cover needed',": ",s?.name]}),(0,B.jsx)(u.Badge,{kind:'open'===e.status?'amber':'approved'===e.status?'ok':'neutral',label:e.status})]}),(0,B.jsxs)(u.Muted,{children:[t?`${C.DAY3[t.day]} ${(0,C.fmtH)(t.start)}\u2013${(0,C.fmtH)(t.end)}`:'Shift',n?` \u2192 ${n.name}`:''," \xb7 ",e.note]}),'open'===e.status&&K?(0,B.jsxs)(u.Row,{gap:6,children:['cover'!==e.kind||e.toId?null:o.filter(t=>t.id!==e.fromId&&'owner'!==t.role).map(t=>(0,B.jsx)(u.Chip,{label:`Give to ${t.name.split(' ')[0]}`,onPress:()=>{f.useOwner.setState(s=>({swaps:s.swaps.map(s=>s.id===e.id?{...s,toId:t.id}:s)}))}},t.id)),(0,B.jsx)(u.Button,{small:!0,label:"Approve",disabled:!e.toId,onPress:()=>{f.useOwner.getState().setSwap(e.id,'approved');const s=e=>(o.find(t=>t.id===e)?.name??'').replace(' (example)','');(0,y.autoPost)('all','swap'===e.kind?`Shift swap: ${s(e.fromId)} \u2194 ${s(e.toId)} approved`:`Cover approved: ${s(e.toId)} covers ${s(e.fromId)}${t?` (${C.DAY3[t.day]} ${(0,C.fmtH)(t.start)}\u2013${(0,C.fmtH)(t.end)})`:''}`)}}),(0,B.jsx)(u.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>f.useOwner.getState().setSwap(e.id,'declined')})]}):null]},e.id)}),K?null:(0,B.jsxs)(u.Card,{children:[(0,B.jsx)(u.T,{weight:"semibold",children:"Ask for a swap or cover"}),(0,B.jsx)(u.Muted,{children:"Your shifts this week. Your manager approves every swap."}),Q.filter(e=>e.staffId===n).sort((e,t)=>e.date.localeCompare(t.date)).map(e=>{const t=x.some(t=>t.shiftId===e.id&&'open'===t.status);return(0,B.jsxs)(c.default,{style:{gap:4,paddingVertical:4},children:[(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsxs)(u.T,{size:14,weight:"medium",children:[C.DAY3[e.day]," ",(0,C.fmtH)(e.start),"\u2013",(0,C.fmtH)(e.end)]}),t?(0,B.jsx)(u.Badge,{kind:"amber",label:"Request open"}):null]}),t?null:(0,B.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,B.jsx)(u.Chip,{label:"Ask for cover",onPress:()=>{f.useOwner.getState().addSwap({shiftId:e.id,fromId:n,kind:'cover',note:'Can anyone cover?'}),(0,y.autoPost)('all',`Cover needed: ${C.DAY3[e.day]} ${(0,C.fmtH)(e.start)}\u2013${(0,C.fmtH)(e.end)} (${(o.find(e=>e.id===n)?.name??'').replace(' (example)','')})`)}}),o.filter(e=>e.id!==n&&'staff'===e.role).map(t=>(0,B.jsx)(u.Chip,{label:`Swap with ${t.name.replace(' (example)','')}`,onPress:()=>f.useOwner.getState().addSwap({shiftId:e.id,fromId:n,toId:t.id,kind:'swap',note:'Agreed between us'})},t.id))]})]},e.id)}),Q.some(e=>e.staffId===n)?null:(0,B.jsx)(u.Muted,{children:"No shifts on the rota this week."})]}),(0,B.jsx)(k.SectionHead,{title:"Holiday & leave"}),p.filter(e=>K||e.staffId===n).map(e=>(0,B.jsxs)(u.Card,{children:[(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsx)(u.T,{weight:"semibold",children:o.find(t=>t.id===e.staffId)?.name}),(0,B.jsx)(u.Badge,{kind:'pending'===e.status?'amber':'approved'===e.status?'ok':'red',label:e.status})]}),(0,B.jsxs)(u.Muted,{children:[(0,b.niceDate)((0,b.parseYmd)(e.from))," \u2013 ",(0,b.niceDate)((0,b.parseYmd)(e.to))," \xb7 ",e.reason]}),'pending'===e.status&&K?(0,B.jsxs)(u.Row,{gap:6,children:[(0,B.jsx)(u.Button,{small:!0,label:"Approve",onPress:()=>f.useOwner.getState().setLeave(e.id,'approved')}),(0,B.jsx)(u.Button,{small:!0,kind:"ghost",label:"Decline",onPress:()=>f.useOwner.getState().setLeave(e.id,'declined')})]}):null]},e.id)),(0,B.jsxs)(u.Card,{children:[(0,B.jsxs)(u.T,{weight:"semibold",children:["Request leave",K?' (as yourself)':'']}),(0,B.jsxs)(u.Row,{gap:6,children:[(0,B.jsx)(s.TextInput,{accessibilityLabel:"From date",placeholder:"From YYYY-MM-DD",placeholderTextColor:"#7D776C",value:z,onChangeText:H,style:[u.styles.input,{flex:1}]}),(0,B.jsx)(s.TextInput,{accessibilityLabel:"To date",placeholder:"To YYYY-MM-DD",placeholderTextColor:"#7D776C",value:W,onChangeText:E,style:[u.styles.input,{flex:1}]})]}),(0,B.jsx)(u.Field,{label:"Reason",value:_,onChangeText:q}),(0,B.jsx)(u.Button,{small:!0,label:"Send request",disabled:!/^\d{4}-\d{2}-\d{2}$/.test(z)||!/^\d{4}-\d{2}-\d{2}$/.test(W)||W{f.useOwner.getState().addLeave({staffId:n,from:z,to:W,reason:_.trim()||'Holiday'}),H(''),E(''),q('')}})]})]}):null,'availability'===R?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(u.Muted,{children:["Days each person can\u2019t work. ",K?'Tap to toggle.':'Tap to set your own.'," The rota flags clashes."]}),le.filter(e=>'owner'!==e.role||!K).map(e=>(0,B.jsxs)(u.Card,{children:[(0,B.jsxs)(u.Row,{gap:8,children:[(0,B.jsx)(S.StaffAvatar,{id:e.id,size:30}),(0,B.jsx)(u.T,{weight:"semibold",children:e.name})]}),(0,B.jsx)(u.Row,{wrap:!0,gap:4,children:C.DAY3.map((t,s)=>{const n=(m[e.id]??[]).includes(s);return(0,B.jsx)(u.Chip,{label:`${t} ${n?'\u2715':'\u2713'}`,selected:!n,onPress:()=>f.useOwner.getState().toggleAvail(e.id,s)},t)})})]},e.id))]}):null,$?(0,B.jsx)(N,{init:$,onClose:()=>M(null)}):null]})},_e.ClockInOut=function(){const{now:e,today:t,role:s,meId:a,me:d,r:h,rid:m}=(0,C.useCtx)(5e3),x=((0,I.useClockArea)(e=>e.areas[m]),(0,I.areaOf)(m));const j=(0,v.privateClockVenue)(m),[k,y]=(0,l.useState)(!1),O=(0,f.useOwner)(e=>e.consent[a]),R=(0,f.useOwner)(e=>e.attendance),P=(0,f.useOwner)(e=>e.shifts),[z,H]=(0,l.useState)(!1),[A,Y]=(0,l.useState)(null),[L,F]=(0,l.useState)(null),[N,_]=(0,l.useState)(void 0),[q,K]=(0,l.useState)(null),[U,V]=(0,l.useState)(!1),[G,X]=(0,l.useState)(null),J=R.filter(t=>t.staffId===a&&t.in&&!t.out&&e.getTime()-new Date(t.in).getTime()<72e6).sort((e,t)=>t.in.localeCompare(e.in))[0],Q=J&&(0,f.isOnBreak)(J)?J.breaks[J.breaks.length-1]:void 0,Z=(0,f.visibleShifts)(P,'staff'!==s).find(e=>e.staffId===a&&e.date===t),ee='staff'!==s,te=J?(0,C.paidMins)({in:J.in},e).worked:0,se=x.on&&(0,D.areaSet)(x),ne=J?.geo?.[J.geo.length-1],ae=async(s,n={})=>{Y(s),F(null),_(void 0);const l=await(0,T.clockAction)(s,{rid:m,staffId:a,date:t,at:new Date(e.getTime()).toISOString(),...n});return Y(null),l.ok?('out'===s&&l.att&&(K(l.att),(0,i.hrSettingsOf)(h.settings?.hr).on&&!o.useHr.getState().hasAnswered(m,l.att.id)&&X(l.att)),'in'===s&&K(null),!0):(F(l.message),_(l.fix),(0,$.notify)({id:'clock-blocked',tone:'warn',icon:'\ud83d\udccd',kicker:'CLOCK',title:l.message.split('. ')[0]+'.',body:l.message.split('. ').slice(1).join('. '),timeoutMs:9e3,testID:'clock-blocked'}),!1)};return O?(0,B.jsxs)(c.default,{style:{gap:10},children:[(0,B.jsxs)(u.Card,{highlight:w.colours.gold,children:[(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsxs)(u.Row,{gap:10,style:{flex:1},children:[(0,B.jsx)(S.StaffAvatar,{id:a,size:48}),(0,B.jsx)(u.T,{weight:"semibold",style:{flex:1},children:d})]}),(0,B.jsx)(u.Badge,{kind:J?'ok':'neutral',label:J?`On shift since ${(0,b.hm)(new Date(J.in))}`:'Not clocked in'})]}),(0,B.jsx)(u.Muted,{children:Z?`Today's shift: ${(0,C.fmtH)(Z.start)}\u2013${(0,C.fmtH)(Z.end)}`:'No shift on the rota today'}),(0,B.jsx)(c.default,{testID:"clock-area-line",children:(0,B.jsx)(u.T,{size:14,colour:w.colours.muted,children:se?j?`Location is checked only when you choose Clock in, at ${h.name}. Only pass or fail is saved.`:`\ud83d\udccd Your location is checked when you tap a button. You need to be at ${h.name}.`:x.on?'\ud83d\udccd The clock-in area isn\u2019t set yet, so location isn\u2019t checked.':'\ud83d\udccd Location checks are switched off for this venue.'})}),ne&&!0===ne.inside&&null!=ne.dist?(0,B.jsxs)(u.Muted,{children:["Last check: at the venue (about ",ne.dist," m from the centre)."]}):null,J?(0,B.jsx)(u.T,{size:30,weight:"bold",center:!0,children:(0,C.hmDur)(te)}):null,J&&Q?(0,B.jsx)(c.default,{testID:"on-break",children:(0,B.jsxs)(u.T,{size:15,weight:"semibold",colour:w.colours.gold,center:!0,children:["On a break since ",(0,b.hm)(new Date(Q.start))," \xb7 ",(0,f.loggedBreakMins)(J,e)," min so far"]})}):null,J?(0,B.jsxs)(B.Fragment,{children:[Q?(0,B.jsx)(u.Button,{testID:"break-end",kind:"success",label:'break_end'===A?'Checking your location\u2026':'End break',disabled:!!A,onPress:()=>{ae('break_end')}}):(0,B.jsx)(u.Button,{testID:"break-start",kind:"secondary",label:'break_start'===A?'Checking your location\u2026':'Start break',disabled:!!A,onPress:()=>{ae('break_start')}}),(0,B.jsx)(u.Button,{testID:"clock-out",kind:"danger",label:'out'===A?'Checking your location\u2026':'Clock out',disabled:!!A,onPress:()=>{J.breaks?.length?ae('out'):(F(null),H(!0))}})]}):(0,B.jsx)(u.Button,{testID:"clock-in",kind:"success",label:'in'===A?'Checking your location\u2026':'Clock in',disabled:!!A,onPress:()=>{j?y(!0):ae('in')}}),J?.breaks?.length?(0,B.jsxs)(u.Muted,{center:!0,children:["Breaks today: ",J.breaks.map(e=>`${(0,b.hm)(new Date(e.start))}\u2013${e.end?(0,b.hm)(new Date(e.end)):'now'}`).join(', ')," (",(0,f.loggedBreakMins)(J,e)," min)"]}):null,L?(0,B.jsx)(c.default,{testID:"clock-message",children:(0,B.jsx)(u.Banner,{kind:"warn",title:"Not recorded",children:L})}):null,L&&'settings'===N?(0,B.jsx)(u.Button,{testID:"clock-open-settings",label:"Open app settings",accessibilityLabel:"Open app settings, to allow location",onPress:M.openAppSettings}):null,L&&'location'===N?(0,B.jsx)(u.Button,{testID:"clock-open-location",label:"Open location settings",accessibilityLabel:"Open location settings, to turn on location",onPress:M.openLocationSettings}):null,L&&'update'===N?(0,B.jsx)(u.Button,{testID:"clock-check-update",label:"Look for the app update",accessibilityLabel:"Look for the app update",onPress:M.checkAppUpdate}):null]}),ee&&!(0,D.areaSet)(x)?(0,B.jsx)(c.default,{testID:"clock-area-warning",children:(0,B.jsx)(u.Banner,{kind:"warn",title:"Set the clock-in area",children:"Location isn\u2019t checked until a manager sets the venue\u2019s centre. Stand at the venue and go to Settings \u203a Advanced \u203a Clock-in area \u203a Use my current location."})}):null,(0,B.jsx)(r.default,{testID:"forgot-link",accessibilityRole:"button",onPress:()=>V(!0),style:{alignSelf:'center',padding:6},children:(0,B.jsx)(u.T,{size:14,colour:w.colours.gold,children:"Forgot to clock in or out?"})}),U?(0,B.jsx)(E,{onClose:()=>V(!1)}):null,(0,B.jsx)(p.BreakRoomCard,{staffId:a,name:d,now:e}),q?(()=>{const t=(0,C.paidMins)(q,e);return(0,B.jsxs)(u.Card,{highlight:w.colours.gold,children:[(0,B.jsxs)(u.T,{weight:"semibold",colour:w.colours.gold,children:["Clocked out at ",(0,b.hm)(new Date(q.out))]}),(0,B.jsxs)(u.T,{size:18,weight:"bold",children:["Clocked ",(0,C.hmDur)(t.worked),", break ",t.brk,"m, paid ",(0,C.hmDur)(t.paid)]}),(0,B.jsxs)(u.Muted,{children:["In ",(0,b.hm)(new Date(q.in))," \xb7 out ",(0,b.hm)(new Date(q.out))," \xb7 paid hours = (out \u2212 in) \u2212 break",q.breakAddedAtClockOut?' \xb7 break added at clock-out':'']}),t.worked>360&&0===t.brk?(0,B.jsx)(u.Banner,{kind:"info",title:"A note on breaks",children:"UK workers are generally entitled to a 20-minute rest break when working more than 6 hours. Your clock-out is saved; have a word with your manager if you didn\u2019t get one."}):null]})})():null,(0,B.jsx)(u.Sheet,{visible:k,onClose:()=>y(!1),title:"Why we ask for location",testID:"clock-location-reason",children:(0,B.jsxs)(c.default,{style:{gap:12},children:[(0,B.jsxs)(u.T,{children:["We check once that you are at ",h.name,", within about ",x.radius," m, when you clock in. Only pass or fail is saved, not your position. We never track you in the background."]}),(0,B.jsx)(u.T,{children:"If you refuse or are too far away, no clock-in is made. A manager can override it with a recorded reason."}),(0,B.jsx)(u.Button,{testID:"clock-location-continue",label:"Check my location and clock in",accessibilityLabel:"Check my location once and clock in at the pub",onPress:()=>{y(!1),ae('in')}}),(0,B.jsx)(u.Button,{testID:"clock-location-cancel",kind:"secondary",label:"Not now",onPress:()=>y(!1)})]})}),ee?(0,B.jsx)(W,{rid:m,today:t,now:e}):null,G?(0,B.jsx)(n.ShiftCheckout,{rid:m,shiftKey:G.id,day:G.date,meId:a,onClose:()=>X(null)}):null,(0,B.jsx)(u.Sheet,{visible:z,onClose:()=>H(!1),title:"Did you take a break? If so, how long?",children:(0,B.jsxs)(c.default,{testID:"forgot-break-prompt",style:{gap:10},children:[(0,B.jsx)(u.Muted,{children:"No break was recorded on this shift. Pick how long it was, or No break. Your manager can change it later in Hours."}),(0,B.jsx)(u.Row,{wrap:!0,gap:6,children:x.breakOptions.map(e=>(0,B.jsx)(u.Chip,{testID:`forgot-break-${e}`,label:(0,D.breakLabel)(e),disabled:e>=te,onPress:()=>{H(!1),ae('out',{addedBreak:e})}},e))}),(0,B.jsx)(u.Button,{testID:"forgot-break-none",kind:"secondary",label:"No break",onPress:()=>{H(!1),ae('out',{breakMins:0})}}),te>360?(0,B.jsx)(u.Muted,{children:"UK workers are generally entitled to a 20-minute rest break when working more than 6 hours."}):null,(0,B.jsx)(u.Muted,{children:j?'Clock-out and breaks do not use your location.':'Tip: your location is checked when you clock out, like clocking in.'})]})})]}):(0,B.jsx)(c.default,{style:{gap:10},children:(0,B.jsxs)(u.Card,{highlight:w.colours.gold,children:[(0,B.jsx)(u.T,{weight:"semibold",colour:w.colours.gold,children:"Before you clock in: location & your privacy"}),j?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(u.T,{size:14,children:["When you choose Clock in, we ask once for your phone\u2019s location to check you are at ",h.name,", within about ",x.radius," m."]}),(0,B.jsx)(u.T,{size:14,children:"Only pass or fail is kept with your clock-in time. Your map position, accuracy and distance are not saved. No location trails, background checks, clock-out checks or break checks."})]}):(0,B.jsxs)(B.Fragment,{children:[" ",(0,B.jsxs)(u.T,{size:14,children:["CoverCharge checks your phone\u2019s location ",(0,B.jsx)(u.T,{size:14,weight:"bold",children:"only at the moment you tap Clock in, Clock out, Start break or End break"}),", to confirm you are at ",h.name," (within about ",x.radius," m)."]}),(0,B.jsx)(u.T,{size:14,children:"\u2022 Your location is never tracked continuously or in the background."}),(0,B.jsx)(u.T,{size:14,children:"\u2022 With each clock record we keep that one reading (map position and how accurate the phone said it was), whether it was inside the area, and the time."}),(0,B.jsx)(u.T,{size:14,children:"\u2022 If the app is open while you\u2019re at the venue and you\u2019re not on the rota, it may ask whether you want to clock in (only if you have already allowed location)."})]}),(0,B.jsx)(u.T,{size:14,children:"\u2022 Your employer uses this for timesheets and pay (UK GDPR lawful basis: contract / legitimate interests)."}),(0,B.jsx)(u.T,{size:14,children:"\u2022 If your phone can\u2019t share its location, a manager can record it for you instead. You can see your own records anytime."}),(0,B.jsx)(u.T,{size:14,children:"\u2022 Records are kept for payroll (6 years, HMRC) and then deleted."}),(0,B.jsx)(u.Button,{label:"I understand \u2014 continue",onPress:()=>f.useOwner.getState().giveConsent(a,e.toISOString())})]})})},_e.Timesheets=function(){const{now:e,today:t,role:s,meId:n}=(0,C.useCtx)(3e4);return s!=='staff'?(0,B.jsx)(q,{now:e,today:t,meId:n}):(0,B.jsx)(_,{})};var t=_r(_d[0]),s=_r(_d[1]),n=_r(_d[2]),a=_r(_d[3]),o=_r(_d[4]),i=_r(_d[5]),l=_r(_d[6]),r=e(_r(_d[7])),d=e(_r(_d[8])),c=e(_r(_d[9])),u=_r(_d[10]),h=_r(_d[11]),f=_r(_d[12]),m=_r(_d[13]),p=_r(_d[14]),x=_r(_d[15]),j=_r(_d[16]),b=_r(_d[17]),w=_r(_d[18]),k=_r(_d[19]),y=_r(_d[20]),C=_r(_d[21]),S=_r(_d[22]),I=_r(_d[23]),v=_r(_d[24]),D=_r(_d[25]),T=_r(_d[26]),$=_r(_d[27]),M=_r(_d[28]),O=_r(_d[29]),R=_r(_d[30]),P=_r(_d[31]),B=_r(_d[32]);const z=2650,H=1900,A=e=>e.end-e.start,Y=e=>e>8?.5:e>6?.3333333333333333:0,L=e=>{const t=new Date(e);return t.setHours(0,0,0,0),t.setDate(t.getDate()-(0,C.weekday)(e)),t};function F(e){const{rid:t,r:s,now:n}=(0,C.useCtx)(6e4),a=(0,h.useBookings)(t),o=(0,h.useOrders)(t),i=(0,h.useEvents)(t),r=(0,O.useRealHistory)(t,n);return(0,l.useMemo)(()=>{const t=Array.from({length:7},(t,s)=>{const n=(0,b.addMins)(e,1440*s);return n.setHours(11,0,0,0),n}),n=a.filter(e=>!e.walkIn&&'confirmed'===e.status&&t.some(t=>(0,b.ymd)(t)===e.date)).reduce((e,t)=>e+t.partySize,0),l=(0,R.clampWeeks)(s.settings.forecastMinWeeks);return r?r.salesEnough?{mode:'real',weeks:l,booked:n,sales:t.map(e=>s.kitchenHours[e.getDay()]?r.takingsByDay[e.getDay()]??0:0)}:{mode:'none',weeks:l,booked:n,sales:t.map(()=>0)}:{mode:'example',weeks:l,booked:n,sales:t.map(e=>{const t=(0,x.forecastToday)(s,a,o,i,e);return t.open?t.restOfDay.covers*z+t.restOfDay.takeaway*H:0})}},[s,a,o,i,r,(0,b.ymd)(e)])}function N({init:e,onClose:t}){const s=(0,f.useOwner)(e=>e.staff),[n,a]=(0,l.useState)(e.shift?.start??12),[o,i]=(0,l.useState)(e.shift?.end??20),[r,d]=(0,l.useState)(e.shift?.breakAt),h=void 0===r||r>n&&rt.id===e.staffId);return(0,B.jsxs)(u.Sheet,{visible:!0,onClose:t,title:(0,P.shiftTitle)(m?.name??'',e.date),testID:"shift-sheet",children:[(0,B.jsx)(u.Row,{wrap:!0,gap:6,children:[['Lunch',11,16],['Dinner',16.5,22.5],['Double',11,21],['Close',17,23.5],['Late close',18,25]].map(([e,t,s])=>(0,B.jsx)(u.Chip,{label:`${e} ${(0,C.fmtH)(t)}\u2013${(0,C.fmtH)(s)}`,selected:n===t&&o===s,onPress:()=>{a(t),i(s)}},e))}),(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsx)(u.T,{children:"Start"}),(0,B.jsx)(u.Stepper,{testID:"shift-start",value:n,step:.5,min:P.SHIFT_MIN_START,max:o-1,onChange:a,format:C.fmtH,label:"Start time"})]}),(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,B.jsx)(u.T,{children:"End"}),(0,B.jsxs)(c.default,{style:{alignItems:'flex-end'},children:[(0,B.jsx)(u.Stepper,{testID:"shift-end",value:o,step:.5,min:n+1,max:P.SHIFT_MAX_END,onChange:i,format:C.fmtH,label:"End time"}),o>=24?(0,B.jsx)(u.Muted,{children:"next day"}):null]})]}),(0,B.jsxs)(u.Muted,{children:[(o-n).toFixed(1),"h scheduled",Y(o-n)?`, ${Math.round(60*Y(o-n))}m planned break`:'']}),(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},wrap:!0,gap:6,children:[(0,B.jsx)(u.T,{children:void 0===r?'Break: not set':'Break at'}),void 0===r?(0,B.jsx)(u.Chip,{label:"Set a break time",onPress:()=>d(Math.min(o-.5,Math.max(n+.5,Math.round(4*(n+Math.min(4,(o-n)/2)))/4)))}):(0,B.jsxs)(u.Row,{gap:6,children:[(0,B.jsx)(u.Stepper,{testID:"shift-break",value:r,step:.25,min:n+.25,max:o-.25,onChange:d,format:C.fmtH,label:"Break time"}),(0,B.jsx)(u.Chip,{label:"No set time",onPress:()=>d(void 0)})]})]}),(0,B.jsx)(u.Muted,{children:"Tip: with a break time, the person on this shift gets a break reminder at that time. Without one, they get it 4 hours after clocking in (change this in Settings, Advanced, Reminders)."}),(0,B.jsx)(u.Button,{label:e.shift?'Save shift':'Add shift',onPress:()=>{const s=f.useOwner.getState();e.shift?s.setShifts(s.shifts.map(t=>t.id===e.shift.id?{...t,start:n,end:o,breakAt:h?r:void 0,changed:!!t.published||t.changed}:t)):s.addShift({staffId:e.staffId,date:e.date,start:n,end:o,...void 0!==r&&h?{breakAt:r}:{}}),t()}}),(0,B.jsx)(u.Muted,{children:e.shift?.published?'Published: the change shows in the Staff app straight away and is marked as changed until you publish the week again.':'Draft: staff see it once you publish the week.'}),e.shift?(0,B.jsx)(u.Button,{kind:"danger",label:"Remove shift",onPress:()=>{f.useOwner.getState().removeShift(e.shift.id),t()}}):null]})}function W({rid:e,today:t,now:s}){const n=(0,f.useOwner)(e=>e.staff).filter(e=>e.active),a=(0,f.useOwner)(e=>e.attendance),o=(0,C.useSignedIn)(),{me:i,meId:r}=(0,C.useCtx)(3e4),[d,c]=(0,l.useState)(null),[h,m]=(0,l.useState)(''),[p,x]=(0,l.useState)(null),j=d?a.filter(e=>e.staffId===d&&e.in&&!e.out&&s.getTime()-new Date(e.in).getTime()<72e6)[0]:void 0,b=!!j&&(0,f.isOnBreak)(j),k=s=>{if(!d)return;const a=(0,T.managerClockAction)(s,{rid:e,staffId:d,date:t,at:(new Date).toISOString()},{id:o?.id??r,name:o?.name??i},h);if(!a.ok)return void x(a.message);const l=n.find(e=>e.id===d)?.name??'them';(0,$.notify)({id:'mgr-clock',title:`Recorded for ${l}`,body:`Reason kept with the record: ${h.trim()}`,timeoutMs:6e3}),m(''),x(null)};return(0,B.jsxs)(u.Card,{children:[(0,B.jsx)(u.T,{weight:"semibold",children:"Record it for someone"}),(0,B.jsx)(u.Muted,{children:"If someone\u2019s phone can\u2019t share its location, you can clock them in or out, or start or end their break. No location check; your reason is kept with the record."}),(0,B.jsx)(u.Row,{wrap:!0,gap:6,children:n.map(e=>(0,B.jsx)(u.Chip,{label:e.name,selected:d===e.id,onPress:()=>c(e.id)},e.id))}),d?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(u.Field,{label:"Reason (kept with the record)",value:h,onChangeText:m,placeholder:"e.g. Phone out of battery"}),(0,B.jsx)(u.Row,{wrap:!0,gap:6,children:j?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(u.Button,{kind:"secondary",label:b?'End their break':'Start their break',onPress:()=>k(b?'break_end':'break_start')}),(0,B.jsx)(u.Button,{kind:"secondary",label:"Clock them out",onPress:()=>k('out')})]}):(0,B.jsx)(u.Button,{testID:"mgr-clock-in",kind:"secondary",label:"Clock them in",onPress:()=>k('in')})}),p?(0,B.jsx)(u.T,{size:13,colour:w.colours.red,children:p}):null]}):null]})}function E({onClose:e}){const{now:t,today:s,meId:n}=(0,C.useCtx)(3e4),a=(0,f.useOwner)(e=>e.attendance),o=(0,f.useOwner)(e=>e.shifts),i=Array.from({length:7},(e,t)=>(0,b.ymd)((0,b.addMins)((0,b.parseYmd)(s),1440*-t))),[r,d]=(0,l.useState)(s),c=a.filter(e=>e.staffId===n&&e.date===r&&e.in).sort((e,t)=>t.in.localeCompare(e.in))[0],h=(0,f.visibleShifts)(o,!1).find(e=>e.staffId===n&&e.date===r),[p,x]=(0,l.useState)(c&&!c.out?'out':'in'),[j,k]=(0,l.useState)(h?Math.round(60*h.start):720),[y,S]=(0,l.useState)(h?Math.round(60*h.end):1200),[I,v]=(0,l.useState)(''),[D,T]=(0,l.useState)(!1),$=e=>`${String(Math.floor(e%1440/60)).padStart(2,'0')}:${String(e%60).padStart(2,'0')}`,M='out'!==p,O='in'!==p,R=M&&O&&y<=j,P=(e,t)=>(0,B.jsx)(u.Row,{gap:4,children:[-15,-5,5,15].map(s=>(0,B.jsx)(u.Button,{small:!0,kind:"ghost",label:s>0?`+${s}`:`${s}`,onPress:()=>e(Math.max(0,Math.min(2160,t+s)))},s))});return D?(0,B.jsxs)(u.Sheet,{visible:!0,onClose:e,title:"Request sent",children:[(0,B.jsx)(u.Banner,{kind:"success",title:"Sent to your manager",children:"They\u2019ll see it on the sign-off screen and fix the time. You\u2019ll see the change on your timesheet. Nothing is sent by text or email."}),(0,B.jsx)(u.Button,{label:"Done",onPress:e})]}):(0,B.jsxs)(u.Sheet,{visible:!0,onClose:e,title:"I forgot to clock in or out",testID:"request-sheet",children:[(0,B.jsx)(u.Muted,{children:"Pick the day and suggest the right time. Your manager checks it before it counts."}),(0,B.jsx)(u.Row,{wrap:!0,gap:6,children:i.map(e=>(0,B.jsx)(u.Chip,{label:e===s?'Today':(0,b.niceDate)((0,b.parseYmd)(e)).slice(0,10),selected:r===e,onPress:()=>d(e)},e))}),(0,B.jsxs)(u.Muted,{children:[h?`Your rota that day: ${(0,C.fmtH)(h.start)}\u2013${(0,C.fmtH)(h.end)}`:'Not on the rota that day',c?` \xb7 clocked ${(0,b.hm)(new Date(c.in))}\u2013${c.out?(0,b.hm)(new Date(c.out)):'no clock-out'}`:' \xb7 no clock record']}),(0,B.jsxs)(u.Row,{wrap:!0,gap:6,children:[(0,B.jsx)(u.Chip,{label:"Forgot to clock in",selected:'in'===p,onPress:()=>x('in')}),(0,B.jsx)(u.Chip,{label:"Forgot to clock out",selected:'out'===p,onPress:()=>x('out')}),(0,B.jsx)(u.Chip,{label:"Forgot both",selected:'both'===p,onPress:()=>x('both')})]}),M?(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsxs)(u.T,{size:18,weight:"bold",children:["In ",$(j)]}),P(k,j)]}):null,O?(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsxs)(u.T,{size:18,weight:"bold",children:["Out ",$(y),y>=1440?' (next day)':'']}),P(S,y)]}):null,R?(0,B.jsx)(u.T,{size:13,colour:w.colours.red,children:"Clock-out must be after clock-in."}):null,(0,B.jsx)(u.Field,{label:"Note for your manager (optional)",value:I,onChangeText:v,placeholder:"e.g. phone died",maxLength:200}),(0,B.jsx)(u.Button,{testID:"request-send",kind:"success",label:"Send to my manager",disabled:R,onPress:()=>{f.useOwner.getState().addTimeRequest({staffId:n,date:r,attendanceId:c?.id,kind:p,suggestedIn:M?(0,m.isoAt)(r,j):void 0,suggestedOut:O?(0,m.isoAt)(r,y):void 0,note:I.trim(),at:t.toISOString()}),T(!0)}})]})}function _(){const{now:e,today:t,meId:s}=(0,C.useCtx)(3e4),n=(0,f.useOwner)(e=>e.attendance),a=(0,f.useOwner)(e=>e.shifts),o=(0,f.useOwner)(e=>e.timeRequests),[i,r]=(0,l.useState)(!1),[d,h]=(0,l.useState)(null),p=(0,b.ymd)(L(e)),x=n.filter(e=>e.staffId===s&&e.in&&e.date>=(0,b.ymd)((0,b.addMins)((0,b.parseYmd)(t),-38880))).sort((e,t)=>t.date.localeCompare(e.date)||t.in.localeCompare(e.in)),j=x.filter(e=>e.date>=p),y=j.filter(f.isConfirmed).reduce((t,s)=>t+(0,C.paidMins)(s,e).paid,0),S=j.filter(e=>!(0,f.isConfirmed)(e)).reduce((t,s)=>t+(0,C.paidMins)(s,e).paid,0),I=o.filter(e=>e.staffId===s).sort((e,t)=>t.at.localeCompare(e.at)).slice(0,6);return(0,B.jsxs)(c.default,{style:{gap:10},testID:"my-timesheet",children:[(0,B.jsxs)(u.Card,{children:[(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between',alignItems:'flex-end'},children:[(0,B.jsxs)(c.default,{children:[(0,B.jsx)(u.T,{size:12,colour:w.colours.muted,children:"CONFIRMED THIS WEEK"}),(0,B.jsx)(u.T,{size:28,weight:"bold",colour:w.colours.ok,children:(0,C.hmDur)(y)})]}),(0,B.jsxs)(c.default,{style:{alignItems:'flex-end'},children:[(0,B.jsx)(u.T,{size:12,colour:w.colours.muted,children:"PENDING SIGN-OFF"}),(0,B.jsx)(u.T,{size:18,weight:"semibold",colour:S?w.colours.amber:w.colours.muted,children:(0,C.hmDur)(S)})]})]}),(0,B.jsx)(u.Muted,{children:"Your manager signs off your hours. Only confirmed hours count for pay. You can\u2019t change your own times; ask for a correction instead."})]}),(0,B.jsx)(u.Button,{testID:"forgot-clock",kind:"secondary",label:"I forgot to clock in or out",onPress:()=>r(!0)}),I.length?(0,B.jsx)(k.SectionHead,{title:"My correction requests"}):null,I.map(e=>(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between',paddingVertical:4},children:[(0,B.jsxs)(c.default,{style:{flex:1},children:[(0,B.jsxs)(u.T,{size:14,children:[(0,b.niceDate)((0,b.parseYmd)(e.date))," \xb7 ",'in'===e.kind?'Forgot to clock in':'out'===e.kind?'Forgot to clock out':'Forgot both']}),(0,B.jsxs)(u.Muted,{children:[e.suggestedIn?`in ${(0,b.hm)(new Date(e.suggestedIn))} `:'',e.suggestedOut?`out ${(0,b.hm)(new Date(e.suggestedOut))}`:'',e.resolvedBy?` \xb7 ${'applied'===e.status?'applied':'declined'} by ${e.resolvedBy.replace(' (example)','')}`:'']})]}),(0,B.jsx)(u.Badge,{kind:'open'===e.status?'blue':'applied'===e.status?'ok':'neutral',label:'open'===e.status?'Waiting':'applied'===e.status?'Applied':'Declined'})]},e.id)),(0,B.jsx)(k.SectionHead,{title:"My shifts",sub:"Last 4 weeks"}),x.map(t=>{const s=(0,f.shiftOf)((0,f.visibleShifts)(a,!1),t.staffId,t.date),n=(0,C.paidMins)(t,e),o=t.audit?.filter(e=>'confirmed'!==e.action).slice(-1)[0];return(0,B.jsxs)(u.Card,{onPress:()=>h(d===t.id?null:t.id),children:[(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsxs)(c.default,{style:{flex:1},children:[(0,B.jsx)(u.T,{weight:"semibold",children:(0,b.niceDate)((0,b.parseYmd)(t.date))}),(0,B.jsxs)(u.Muted,{children:[(0,b.hm)(new Date(t.in)),"\u2013",t.out?(0,b.hm)(new Date(t.out)):'on now',t.out?` \xb7 ${n.brk}m break \xb7 ${(0,C.hmDur)(n.paid)} paid`:'',s?` \xb7 rota ${(0,C.fmtH)(s.start)}\u2013${(0,C.fmtH)(s.end)}`:'']})]}),(0,B.jsx)(u.Badge,{kind:(0,m.statusKind)(t),label:'awaiting'===(0,f.attStatus)(t)?t.adjusted?'Adjusted \xb7 pending':'Pending':(0,m.statusLabel)(t)})]}),o?(0,B.jsxs)(u.T,{size:13,colour:w.colours.gold,children:["Adjusted by ",o.by.replace(' (example)',''),o.reason?`: ${o.reason}`:'']}):null,t.signOff?(0,B.jsxs)(u.Muted,{children:["Confirmed by ",t.signOff.by.replace(' (example)','')]}):null,d===t.id?(0,B.jsx)(m.AuditTrail,{a:t}):null]},t.id)}),x.length?null:(0,B.jsx)(u.Muted,{children:"No clocked shifts yet."}),i?(0,B.jsx)(E,{onClose:()=>r(!1)}):null]})}function q({now:e,today:s}){const n=(0,f.useOwner)(e=>e.staff),o=(0,f.useOwner)(e=>e.shifts),i=(0,C.useHourly)(),d=(0,f.useOwner)(e=>e.attendance),h=(0,f.useOwner)(e=>e.timeRequests),p=(0,f.useOwner)(e=>e.attLog),[x,y]=(0,l.useState)(s),[I,v]=(0,l.useState)(null),[D,T]=(0,l.useState)(!1),$=!!(0,C.useSignedIn)(),M=Array.from({length:7},(e,t)=>(0,b.ymd)((0,b.addMins)((0,b.parseYmd)(s),1440*-t))),O=d.filter(e=>e.date===x&&e.in),R=o.filter(e=>e.date===x&&!1!==e.published).filter(e=>!O.some(t=>t.staffId===e.staffId)),P=d.filter(e=>M.includes(e.date)&&e.out),z=P.filter(f.isConfirmed),H=z.reduce((t,s)=>t+(0,C.paidMins)(s,e).paid,0),A=P.filter(e=>!(0,f.isConfirmed)(e)).reduce((t,s)=>t+(0,C.paidMins)(s,e).paid,0),Y=z.reduce((t,s)=>t+(0,C.paidMins)(s,e).paid/60*(i[s.staffId]??0),0),L=['Staff,Date,Rostered,In,Out,Break (min),Paid hours,Rate,Pay,Status,Confirmed by,Tax note'].concat(z.sort((e,t)=>e.date.localeCompare(t.date)).map(t=>{const s=n.find(e=>e.id===t.staffId),a=(0,f.shiftOf)(o,t.staffId,t.date),l=(0,C.paidMins)(t,e),r=i[t.staffId]??0;return`${s?.name},${t.date},${a?`${(0,C.fmtH)(a.start)}-${(0,C.fmtH)(a.end)}`:'-'},${(0,b.hm)(new Date(t.in))},${(0,b.hm)(new Date(t.out))},${l.brk},${(l.paid/60).toFixed(2)},${(r/100).toFixed(2)},${(l.paid/60*r/100).toFixed(2)},${t.adjusted?'Confirmed (adjusted)':'Confirmed'},${t.signOff?.by??''},${s?.salaried?'Owner, no hourly wage':null==i[t.staffId]?'Rate not set':s?.noTax&&$?'No tax deducted':''}`}));return(0,B.jsxs)(c.default,{style:{gap:10},children:[(0,B.jsx)(u.Row,{wrap:!0,gap:6,children:M.map(e=>(0,B.jsx)(u.Chip,{label:e===s?'Today':(0,b.niceDate)((0,b.parseYmd)(e)).slice(0,6),selected:x===e,onPress:()=>y(e)},e))}),(0,B.jsxs)(u.Card,{children:[(0,B.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,B.jsx)(u.T,{weight:"semibold",children:"Last 7 days"}),(0,B.jsx)(u.Badge,{kind:"ok",label:`${(0,C.hmDur)(H)} confirmed`})]}),A?(0,B.jsxs)(u.T,{size:13,colour:w.colours.amber,children:[(0,C.hmDur)(A)," pending sign-off (not counted yet)"]}):null,(0,B.jsxs)(u.Muted,{children:["Labour cost ",(0,j.gbp)(Math.round(Y))," from confirmed hours (paid hours \xd7 hourly rates; owner salaries excluded). Sign off in Team \u203a Sign off hours."]})]}),(0,B.jsx)(a.WideTable,{children:(0,B.jsxs)(c.default,{style:{gap:2},children:[(0,B.jsx)(a.TRow,{head:!0,style:{borderBottomWidth:1,borderColor:w.colours.border,paddingBottom:4},children:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''].map((e,t)=>(0,B.jsx)(u.T,{size:12,weight:"semibold",colour:w.colours.gold,style:{width:[110,86,52,52,52,74,120,140,50][t]},children:e},e+t))}),O.map(t=>{const i=n.find(e=>e.id===t.staffId),l=(0,f.shiftOf)(o,t.staffId,x),d=(0,C.paidMins)(t,e),c=(0,m.flagsFor)(t,l,e,s,h).map(e=>e.label);return(0,B.jsxs)(a.TRow,{heads:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''],style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,B.jsxs)(u.Row,{gap:4,style:{width:110},children:[(0,B.jsx)(S.StaffAvatar,{id:t.staffId,size:20,ring:!1}),(0,B.jsx)(u.T,{size:12,style:{flex:1},numberOfLines:1,children:i?.name.replace(' (example)','')})]}),(0,B.jsx)(u.T,{size:12,style:{width:86},colour:w.colours.muted,children:l?`${(0,C.fmtH)(l.start)}\u2013${(0,C.fmtH)(l.end)}`:'\u2013'}),(0,B.jsx)(u.T,{size:12,style:{width:52},children:(0,b.hm)(new Date(t.in))}),(0,B.jsx)(u.T,{size:12,style:{width:52},children:t.out?(0,b.hm)(new Date(t.out)):'on'}),(0,B.jsx)(u.T,{size:12,style:{width:52},children:t.out?`${d.brk}m`:'\u2013'}),(0,B.jsx)(u.T,{size:12,weight:"semibold",style:{width:74},children:t.out?(0,C.hmDur)(d.paid):`${(0,C.hmDur)(d.worked)}\u2026`}),(0,B.jsx)(u.T,{size:11,style:{width:120},colour:'confirmed'===(0,f.attStatus)(t)?w.colours.ok:'open'===(0,f.attStatus)(t)?w.colours.blue:w.colours.amber,children:(0,m.statusLabel)(t)}),(0,B.jsx)(u.T,{size:11,style:{width:140},colour:c.length?w.colours.amber:w.colours.ok,children:c.join(', ')||'OK'}),(0,B.jsx)(r.default,{accessibilityRole:"button",accessibilityLabel:`Edit ${i?.name}`,onPress:()=>v(t),style:{width:50,minHeight:44,justifyContent:'center'},children:(0,B.jsx)(u.T,{size:12,colour:w.colours.gold,children:"Edit"})})]},t.id)}),R.map(t=>(0,B.jsxs)(a.TRow,{heads:['Staff','Rostered','In','Out','Break','Paid hours','Status','Flags',''],style:{paddingVertical:6},children:[(0,B.jsx)(u.T,{size:12,style:{width:110},children:n.find(e=>e.id===t.staffId)?.name.replace(' (example)','')}),(0,B.jsxs)(u.T,{size:12,style:{width:86},colour:w.colours.muted,children:[(0,C.fmtH)(t.start),"\u2013",(0,C.fmtH)(t.end)]}),(0,B.jsx)(u.T,{size:12,colour:x===s&&60*t.start>60*e.getHours()+e.getMinutes()?w.colours.muted:w.colours.red,children:x===s&&60*t.start>60*e.getHours()+e.getMinutes()?'Not started yet':'No clock-in'})]},t.id))]})}),O.length||R.length?null:(0,B.jsx)(u.Muted,{children:"No shifts or clock records for this day."}),(0,B.jsx)(u.Muted,{children:"Paid hours = (clock-out \u2212 clock-in) \u2212 break. Only confirmed hours count for pay, tips and the export."}),(0,B.jsx)(u.Button,{kind:"secondary",label:"Payroll export (CSV preview)",onPress:()=>T(!0)}),(0,B.jsx)(k.SectionHead,{title:"Audit log",sub:"Every manual change and sign-off"}),p.length?p.slice(0,12).map(e=>(0,B.jsxs)(u.Muted,{children:[(0,b.niceDate)(new Date(e.at))," ",(0,b.hm)(new Date(e.at))," \xb7 ",e.text]},e.id)):(0,B.jsx)(u.Muted,{children:"No manual changes yet."}),I?(0,B.jsx)(m.OverrideSheet,{a:I,staffId:I.staffId,date:I.date,onClose:()=>v(null)}):null,(0,B.jsxs)(u.Sheet,{visible:D,onClose:()=>T(!1),title:"Payroll export",children:[(0,B.jsxs)(u.Banner,{kind:"demo",title:"Preview: nothing is sent",children:["Confirmed hours only. ",A?`${(0,C.hmDur)(A)} still pending sign-off is left out.`:'']}),(0,B.jsxs)(c.default,{style:{backgroundColor:(0,t.soutersSurface)('#111'),borderRadius:8,padding:8},children:[L.slice(0,14).map((e,t)=>(0,B.jsx)(u.T,{size:10,colour:t?w.colours.text:w.colours.gold,children:e},t)),L.length>14?(0,B.jsxs)(u.Muted,{children:["\u2026 ",L.length-14," more rows"]}):null]}),(0,B.jsxs)(u.Muted,{children:[L.length-1," confirmed rows \xb7 paid hours (after breaks)."]})]})]})}},1008,[912,875,997,1337,1150,1151,30,263,151,127,813,819,854,1341,1028,868,816,818,821,1017,998,926,952,1206,987,953,1102,946,1289,1304,1302,1029,24]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"category",{enumerable:!0,get:function(){return C}}),_e.allocate=S,_e.Tips=function({go:e}={}){const{rid:w,now:M,today:v,role:$,meId:P,me:B}=(0,x.useCtx)(6e4),I=(0,a.useOwner)(e=>e.staff),R=(0,a.useOwner)(e=>e.attendance),A=(0,a.useOwner)(e=>e.shifts),F=(0,a.useOwner)(e=>e.tronc),D=(0,a.useOwner)(e=>e.troncCash),E=(0,a.useOwner)(e=>e.troncHistory),z=(0,a.useOwner)(e=>e.troncLog),L=(0,d.useOrders)(w),q=(0,f.useVenuePay)(w).pay,[V,N]=(0,n.useState)(-1),[H,_]=(0,n.useState)(''),[Y,K]=(0,n.useState)(!1),[W,U]=(0,n.useState)(!1),[G,Q]=(0,n.useState)(F.text),[J,X]=(0,n.useState)(null),Z='staff'!==$,ee='owner'===$,{s:te,e:se,key:oe}=(0,f.venueRange)(q,'tips',V,M),ne=`${(0,u.niceDate)(te)} \u2013 ${(0,u.niceDate)(se)} ${se.getFullYear()}`,ie=E.find(e=>e.key===oe),re=e=>a.useOwner.getState().setOwner({tronc:{...F,...e}}),le=(0,j.useSync)(e=>!!e.venueId&&'guest'!==e.kind),de=Math.round((se.getTime()-te.getTime())/864e5)+1,ae=(0,n.useMemo)(()=>{let e=L.filter(e=>e.createdAt.slice(0,10)>=(0,u.ymd)(te)&&e.createdAt.slice(0,10)<=(0,u.ymd)(se)).reduce((e,t)=>e+(t.tip??0),0);if(!o.LIVE_VENUE_BUILD&&!le)for(let t=0;tM)break;const o=(0,x.weekday)(s);0!==o&&1!==o&&(e+=Math.round(6e3+9e3*(0,y.hash)((0,u.ymd)(s)+'tip')))}return e},[oe,L.length,le]),ce=D[oe]??0,ue=ie?ie.pot:ae+ce,he=(0,n.useMemo)(()=>{const e={};for(let t=0;tv)break;const o=(0,u.ymd)(s);I.forEach(t=>{const s=R.filter(e=>e.staffId===t.id&&e.date===o&&e.out),n=s.filter(a.isConfirmed).reduce((e,t)=>e+(0,x.paidMins)(t,M).paid,0),i=s.filter(e=>!(0,a.isConfirmed)(e)).reduce((e,t)=>e+(0,x.paidMins)(t,M).paid,0);(n||i)&&(e[t.id]={paid:(e[t.id]?.paid??0)+n,est:(e[t.id]?.est??!1)||i>0})})}return e},[oe,R.length,A.length,I.length]),pe=I.filter(e=>e.active&&('staff'===e.role||'manager'===e.role&&F.includeManagers||'owner'===e.role&&F.includeOwner)),me=(0,n.useMemo)(()=>{if(ie)return ie.rows;const e=pe.map(e=>{const t=(he[e.id]?.paid??0)/60,s=F.points[C(e)]??1;return'hours'===F.method?t:'points'===F.method?t*s:'equal'===F.method?t>0?1:0:F.custom[e.id]??0}),{amounts:t}=S(ue,e),s=e.reduce((e,t)=>e+t,0);return pe.map((o,n)=>({staffId:o.id,hours:(he[o.id]?.paid??0)/60,points:F.points[C(o)]??1,pct:s?e[n]/s*100:0,amount:t[n]}))},[ie,pe.map(e=>e.id).join(),he,F,ue]),ge=me.reduce((e,t)=>e+t.amount,0),xe=ie?0:(()=>{const e=me.map(e=>e.pct);return S(ue,e).remainder})(),fe=Object.entries(F.custom).filter(([e])=>pe.some(t=>t.id===e)).reduce((e,[,t])=>e+t,0),ye='custom'===F.method&&Math.abs(fe-100)>.01,je=new Date(se.getFullYear(),se.getMonth()+2,0),we=[...E].sort((e,t)=>t.end.localeCompare(e.end))[0],be=0!==E.length&&(0,u.parseYmd)(we.end)<(0,u.addMins)(M,-89280),Te=['Staff,Category,Paid hours,Points,Share %,Amount \xa3'].concat(me.map(e=>{const t=I.find(t=>t.id===e.staffId);return`${k(t.name)},${C(t)},${e.hours.toFixed(2)},${e.points},${e.pct.toFixed(2)},${(e.amount/100).toFixed(2)}`}),[`TOTAL,,,,100.00,${(ge/100).toFixed(2)}`]);return Z?(0,b.jsxs)(r.default,{style:{gap:10},children:[(0,b.jsxs)(l.Card,{highlight:h.colours.gold,children:[(0,b.jsx)(l.T,{weight:"semibold",children:"Quick split: Tips day"}),(0,b.jsx)(l.Muted,{children:"Enter the total and it's shared by confirmed hours for the fortnight, to the penny. Tips periods follow your pay dates (Settings \u203a Pay & tips)."}),(0,b.jsxs)(l.Row,{wrap:!0,gap:6,children:[(0,b.jsx)(l.Button,{small:!0,kind:"success",label:"Open Tips day",onPress:()=>e?.('more','tipsday')}),(0,b.jsx)(l.Button,{small:!0,kind:"ghost",label:"Pay & tips settings",onPress:()=>e?.('more','paysettings')})]})]}),(0,b.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(l.Button,{small:!0,kind:"ghost",label:"\u2039 Earlier",onPress:()=>N(V-1)}),(0,b.jsxs)(r.default,{style:{alignItems:'center',flex:1},children:[(0,b.jsx)(l.T,{weight:"semibold",children:ne}),ie?(0,b.jsx)(l.Badge,{kind:"ok",label:`Approved & locked ${ie.lockedAt}`}):V>=0?(0,b.jsx)(l.Badge,{kind:"amber",label:"Period in progress"}):(0,b.jsx)(l.Badge,{kind:"neutral",label:"Not yet approved"})]}),(0,b.jsx)(l.Button,{small:!0,kind:"ghost",label:"Later \u203a",disabled:V>=0,onPress:()=>N(V+1)})]}),(0,b.jsxs)(l.Card,{children:[(0,b.jsx)(l.T,{weight:"semibold",children:"Tip pot"}),(0,b.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(l.T,{children:"Card tips on orders"}),(0,b.jsx)(l.T,{children:(0,c.gbp)(ie?ie.card:ae)})]}),(0,b.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(l.T,{children:"Cash tips"}),(0,b.jsx)(l.T,{children:(0,c.gbp)(ie?ie.cash:ce)})]}),ie?null:(0,b.jsxs)(l.Row,{gap:6,children:[(0,b.jsx)(s.TextInput,{accessibilityLabel:"Cash tips \xa3",placeholder:"Cash tips \xa3",placeholderTextColor:"#7D776C",keyboardType:"decimal-pad",value:H,onChangeText:_,style:[l.styles.input,{flex:1}]}),(0,b.jsx)(l.Button,{small:!0,kind:"secondary",label:"Set cash",disabled:!(Number(H)>=0)||''===H.trim(),onPress:()=>{a.useOwner.getState().setOwner({troncCash:{...D,[oe]:Math.round(100*Number(H))}}),_('')}})]}),(0,b.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(l.T,{weight:"bold",children:"Total pot"}),(0,b.jsx)(l.T,{size:20,weight:"bold",colour:h.colours.gold,children:(0,c.gbp)(ue)})]}),(0,b.jsx)(l.Muted,{children:le?'Card tips are the tips taken on orders in CoverCharge. Add cash tips above.':'Card tips are the tips on orders saved on this device (not connected to your venue yet).'})]}),ie?(0,b.jsxs)(l.Muted,{children:["Locked with method: ",T[ie.method],"."]}):(0,b.jsxs)(l.Card,{children:[(0,b.jsx)(l.T,{weight:"semibold",children:"Split method (venue policy)"}),(0,b.jsx)(l.Row,{wrap:!0,gap:6,children:Object.keys(T).map(e=>(0,b.jsx)(l.Chip,{label:T[e],selected:F.method===e,onPress:()=>ee&&re({method:e})},e))}),ee?null:(0,b.jsx)(l.Muted,{children:"Only the owner can change the policy."}),'points'===F.method?Object.entries(F.points).map(([e,t])=>(0,b.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(l.T,{children:e}),(0,b.jsx)(l.Row,{gap:6,children:(0,b.jsx)(l.Stepper,{value:t,step:.1,min:0,max:2,onChange:t=>ee&&re({points:{...F.points,[e]:Math.round(10*t)/10}}),format:e=>e.toFixed(1),label:`${e} points`})})]},e)):null,'custom'===F.method?(0,b.jsxs)(b.Fragment,{children:[pe.map(e=>(0,b.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(l.T,{style:{flex:1},children:k(e.name)}),(0,b.jsx)(s.TextInput,{accessibilityLabel:`${e.name} percent`,keyboardType:"decimal-pad",defaultValue:String(F.custom[e.id]??''),placeholder:"%",placeholderTextColor:"#7D776C",onEndEditing:t=>re({custom:{...F.custom,[e.id]:Number(t.nativeEvent.text)||0}}),onBlur:t=>{const s=Number(t?.target?.value??t?.nativeEvent?.text);Number.isFinite(s)&&re({custom:{...a.useOwner.getState().tronc.custom,[e.id]:s}})},style:[l.styles.input,{width:80,paddingVertical:4}]})]},e.id)),(0,b.jsxs)(l.T,{size:13,colour:ye?h.colours.red:h.colours.ok,children:["Total ",fe.toFixed(1),"%",ye?' (must be 100%)':' \u2713']})]}):null,(0,b.jsx)(l.Toggle,{label:"Include managers",value:F.includeManagers,onChange:e=>ee&&re({includeManagers:e})}),(0,b.jsx)(l.Toggle,{label:"Include owner",value:F.includeOwner,onChange:e=>ee&&re({includeOwner:e})}),F.includeOwner?(0,b.jsx)(l.Banner,{kind:"warn",title:"Owner included",children:"Employers must not keep tips. An owner may only share in tips for qualifying work they personally do; check the statutory Code of Practice before including yourself."}):null]}),(0,b.jsx)(i.default,{horizontal:!0,children:(0,b.jsxs)(r.default,{children:[(0,b.jsx)(l.Row,{gap:0,style:{borderBottomWidth:1,borderColor:h.colours.border,paddingBottom:4},children:['Staff','Paid hrs','Points','Share','Amount'].map((e,t)=>(0,b.jsx)(l.T,{size:12,weight:"semibold",colour:h.colours.gold,style:{width:[130,70,54,64,80][t]},children:e},e))}),me.map(e=>{const t=I.find(t=>t.id===e.staffId);return(0,b.jsxs)(l.Row,{gap:0,style:{paddingVertical:6,borderBottomWidth:1,borderColor:'#222'},children:[(0,b.jsxs)(l.T,{size:13,style:{width:130},numberOfLines:1,children:[k(t?.name),he[e.staffId]?.est&&!ie?'*':'']}),(0,b.jsx)(l.T,{size:13,style:{width:70},children:e.hours.toFixed(2)}),(0,b.jsx)(l.T,{size:13,style:{width:54},children:'points'===F.method||'points'===ie?.method?e.points.toFixed(1):'\u2013'}),(0,b.jsxs)(l.T,{size:13,style:{width:64},children:[e.pct.toFixed(1),"%"]}),(0,b.jsx)(l.T,{size:13,weight:"semibold",style:{width:80},children:(0,c.gbp)(e.amount)})]},e.staffId)}),(0,b.jsxs)(l.Row,{gap:0,style:{paddingVertical:6},children:[(0,b.jsx)(l.T,{size:13,weight:"bold",style:{width:318},children:"Total"}),(0,b.jsx)(l.T,{size:13,weight:"bold",colour:ge===ue?h.colours.ok:h.colours.red,style:{width:80},children:(0,c.gbp)(ge)})]})]})}),(0,b.jsxs)(l.Muted,{children:[ge===ue?`\u2713 Total equals the pot (${(0,c.gbp)(ue)}).`:'\u2717 Total does not equal the pot.',xe?` Rounding: ${xe}p left after rounding down went to the largest fractions, 1p each.`:''," * has hours still awaiting sign-off, which don\u2019t count until a manager confirms them. Paid hours already exclude breaks."]}),ie?null:(0,b.jsx)(l.Button,{label:"Approve & lock period",disabled:!ee||V>=0||ye||ge!==ue||ue<=0,onPress:()=>{const e=`${(0,u.niceDate)(M)} ${M.toTimeString().slice(0,5)}`,t={id:`tp-${oe}`,key:oe,label:ne,end:(0,u.ymd)(se),pot:ue,card:ae,cash:ce,method:F.method,rows:me,lockedAt:e,by:B};a.useOwner.getState().setOwner({troncHistory:[t,...E],troncLog:[{id:`tl-${Date.now()}`,at:M.toISOString(),text:`${B} approved & locked tips for ${ne}: ${(0,c.gbp)(ue)} split ${T[F.method].toLowerCase()} between ${me.filter(e=>e.amount>0).length} staff`},...z]})}}),!ie&&V>=0?(0,b.jsx)(l.Muted,{center:!0,children:"The current period can be approved once it has ended."}):null,ee||ie?null:(0,b.jsx)(l.Muted,{center:!0,children:"Only the owner can approve tips."}),(0,b.jsxs)(l.Row,{wrap:!0,gap:6,children:[(0,b.jsx)(l.Button,{small:!0,kind:"secondary",label:"Export CSV / PDF summary",onPress:()=>K(!0)}),ie?(0,b.jsx)(l.Button,{small:!0,kind:"secondary",label:ie.shared?'Shared \u2713':'Share with staff (chat)',disabled:!!ie.shared,onPress:()=>{(0,p.autoPost)('all',`Tips for ${ne} approved: ${(0,c.gbp)(ie.pot)} shared between ${ie.rows.filter(e=>e.amount>0).length} staff. See your own share in Team \u203a Tips.`),a.useOwner.getState().setOwner({troncHistory:E.map(e=>e.id===ie.id?{...e,shared:(0,u.niceDate)(M)}:e)}),X('Posted to All staff chat. Demo, nothing is sent.')}}):null]}),J?(0,b.jsx)(l.Banner,{kind:"demo",title:J}):null,(0,b.jsx)(m.SectionHead,{title:"Compliance checklist",sub:"Employment (Allocation of Tips) Act 2023, in force since 1 Oct 2024. Summary only, not legal advice."}),(0,b.jsxs)(l.Card,{children:[[[!0,'100% of qualifying tips passed to workers, no deductions',`Pot ${(0,c.gbp)(ue)} = allocated ${(0,c.gbp)(ge)}`],[F.text.trim().length>40,'Written tipping policy, available to staff','Stored in the app (template below)'],[!be,'Tips allocated by the end of the following month',`This period: by ${(0,u.niceDate)(je)} ${je.getFullYear()}`],[!0,'Tip records kept for 3 years',`${E.length} approved period(s) in the history`],[!0,'Staff can request their tip records',`${z.filter(e=>/requested/.test(e.text)).length} request(s) logged`]].map(([e,t,s])=>(0,b.jsxs)(l.Row,{style:{alignItems:'flex-start'},children:[(0,b.jsx)(l.T,{colour:e?h.colours.ok:h.colours.red,children:e?'\u2713':'\u2717'}),(0,b.jsxs)(r.default,{style:{flex:1},children:[(0,b.jsx)(l.T,{size:14,children:t}),(0,b.jsx)(l.Muted,{children:s})]})]},String(t))),(0,b.jsx)(l.Button,{small:!0,kind:"ghost",label:"View / edit tipping policy",onPress:()=>{Q(F.text),U(!0)}})]}),(0,b.jsx)(m.SectionHead,{title:"Tip history & audit log"}),E.map(e=>(0,b.jsxs)(l.Card,{children:[(0,b.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(l.T,{weight:"semibold",children:e.label}),(0,b.jsx)(l.T,{weight:"bold",children:(0,c.gbp)(e.pot)})]}),(0,b.jsxs)(l.Muted,{children:[T[e.method]," \xb7 ",e.rows.filter(e=>e.amount>0).length," staff \xb7 locked ",e.lockedAt," by ",e.by,e.shared?` \xb7 shared ${e.shared}`:'']})]},e.id)),z.map(e=>(0,b.jsxs)(l.Muted,{children:[(0,u.niceDate)(new Date(e.at))," \xb7 ",e.text]},e.id)),E.length||z.length?null:(0,b.jsx)(l.Muted,{children:"No approved periods yet."}),(0,b.jsxs)(l.Sheet,{visible:Y,onClose:()=>K(!1),title:"Tips summary export",children:[(0,b.jsx)(l.Banner,{kind:"demo",title:"Payroll export: not set up yet",children:"Nothing is sent. This will download a CSV or PDF payslip summary for payroll."}),(0,b.jsx)(r.default,{style:{backgroundColor:(0,t.soutersSurface)('#111'),borderRadius:8,padding:8},children:Te.map((e,t)=>(0,b.jsx)(l.T,{size:11,colour:t?h.colours.text:h.colours.gold,children:e},t))}),(0,b.jsxs)(l.Muted,{children:[ne," \xb7 ",T[ie?.method??F.method]]})]}),(0,b.jsxs)(l.Sheet,{visible:W,onClose:()=>U(!1),title:"Tipping policy",children:[(0,b.jsx)(s.TextInput,{accessibilityLabel:"Tipping policy",multiline:!0,editable:ee,value:G,onChangeText:Q,style:[l.styles.input,{minHeight:220,textAlignVertical:'top'}]}),ee?(0,b.jsx)(l.Button,{label:"Save policy",onPress:()=>{re({text:G}),U(!1)}}):null,(0,b.jsx)(l.Muted,{children:"Template only. Adapt it to your business."})]})]}):(0,b.jsx)(O,{})},_e.MyTips=O;var t=_r(_d[0]),s=_r(_d[1]),o=_r(_d[2]),n=_r(_d[3]),i=e(_r(_d[4])),r=e(_r(_d[5])),l=_r(_d[6]),d=_r(_d[7]),a=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),p=_r(_d[12]),m=_r(_d[13]),x=_r(_d[14]),f=_r(_d[15]),y=_r(_d[16]),j=_r(_d[17]),w=_r(_d[18]),b=_r(_d[19]);const T={hours:'By paid hours',points:'Hours \xd7 role points',equal:'Equal share',custom:'Custom %'},C=e=>'staff'!==e.role?'Manager':/porter|KP/i.test(e.job)?'KP':/kitchen|chef/i.test(e.job)?'Kitchen':/bar/i.test(e.job)?'Bar':'FOH',k=e=>(e??'').replace(' (example)','');function S(e,t){const s=t.reduce((e,t)=>e+t,0);if(!s||e<=0)return{amounts:t.map(()=>0),remainder:0};const o=t.map(t=>e*t/s),n=o.map(Math.floor);let i=e-n.reduce((e,t)=>e+t,0);const r=i;return o.map((e,t)=>({i:t,f:e-Math.floor(e)})).sort((e,t)=>t.f-e.f).forEach(({i:e})=>{i>0&&(n[e]+=1,i-=1)}),{amounts:n,remainder:r}}function O({staffId:e}={}){const t=(0,x.useCtx)(6e4),{now:s,me:o}=t,i=e??t.meId,d=(0,a.useOwner)(e=>e.tronc),u=(0,a.useOwner)(e=>e.troncHistory),p=(0,a.useOwner)(e=>e.troncLog),[m,f]=(0,n.useState)(!1),[y,j]=(0,n.useState)(null),C=u.flatMap(e=>e.rows.filter(e=>e.staffId===i).map(t=>({h:e,r:t})));return(0,b.jsxs)(r.default,{style:{gap:10},children:[(0,b.jsx)(w.TipGoalCard,{staffId:i}),(0,b.jsxs)(l.Card,{children:[(0,b.jsx)(l.T,{weight:"semibold",children:"My tips"}),(0,b.jsx)(l.Muted,{children:"Only your own tip history is shown. 100% of tips go to staff; nothing is deducted."})]}),C.map(({h:e,r:t})=>(0,b.jsxs)(l.Card,{children:[(0,b.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,b.jsx)(l.T,{weight:"semibold",children:e.label}),(0,b.jsx)(l.T,{weight:"bold",colour:h.colours.gold,children:(0,c.gbp)(t.amount)})]}),(0,b.jsxs)(l.Muted,{children:[(0,x.hmDur)(Math.round(60*t.hours))," paid \xb7 ",t.pct.toFixed(1),"% share \xb7 ",T[e.method]," \xb7 approved ",e.lockedAt]})]},e.id)),C.length?null:(0,b.jsx)(l.Muted,{children:"No approved tip periods yet. (Preview: approve a period in the Owner view first.)"}),(0,b.jsx)(l.Button,{kind:"secondary",label:"Request my tip records",onPress:()=>{a.useOwner.getState().setOwner({troncLog:[{id:`tl-${Date.now()}`,at:s.toISOString(),text:`${o} requested their tip records`},...p]}),j('Request logged for your manager (demo, nothing is sent).')}}),y?(0,b.jsx)(l.Banner,{kind:"success",title:y}):null,(0,b.jsx)(l.Button,{kind:"ghost",label:"Read the tipping policy",onPress:()=>f(!0)}),(0,b.jsx)(l.Sheet,{visible:m,onClose:()=>f(!1),title:"Tipping policy",children:(0,b.jsx)(l.T,{size:14,children:d.text})})]})}},1009,[912,875,833,30,151,127,813,819,854,816,818,821,998,1017,926,1110,1300,820,1340,24]); +__d(function(g,r,i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.AccidentBook=function({me:e,meId:t,now:n,app:d,seeAll:h}){const p=(0,l.useSafety)(e=>e.accidents),[y,b]=(0,s.useState)(h?'list':'add'),w=p.filter(e=>e.reportedById===t),f=p.length-w.length;return(0,u.jsxs)(a.default,{style:{gap:12},testID:"accident-book",children:[(0,u.jsx)(c.Tabs,{value:y,onChange:b,options:[{id:'add',label:'Report an accident or near miss'},{id:'list',label:h?`All entries (${p.length})`:`My entries (${w.length})`}]}),'add'===y?(0,u.jsx)(x,{me:e,meId:t,now:n,app:d,onSaved:()=>b('list')}):null,'list'===y?(0,u.jsxs)(c.Box,{testID:"accident-list",children:[(h?p:w).length?(h?p:w).map(e=>(0,u.jsx)(j,{a:e,manager:h},e.id)):(0,u.jsx)(o.Muted,{children:"No entries yet."}),!h&&f>0?(0,u.jsx)(a.default,{testID:"accident-others",children:(0,u.jsxs)(o.Muted,{children:[f," other entr",1===f?'y is':'ies are'," in the book. Only managers can see other people\u2019s entries and personal details."]})}):null]}):null,(0,u.jsx)(o.Muted,{children:"In an emergency call 999 first. The accident book is kept on this device for now; nothing is sent or reported to anyone."})]})};var t=r(_d[0]),s=r(_d[1]),n=e(r(_d[2])),a=e(r(_d[3])),o=r(_d[4]),l=r(_d[5]),d=r(_d[6]),c=r(_d[7]),u=r(_d[8]);const h=e=>String(e).padStart(2,'0'),p=e=>`${e.getFullYear()}-${h(e.getMonth()+1)}-${h(e.getDate())}T${h(e.getHours())}:${h(e.getMinutes())}`,y=e=>{const t=new Date(e);return Number.isNaN(t.getTime())?e:`${t.toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',year:'numeric'})} ${h(t.getHours())}:${h(t.getMinutes())}`};function x({me:e,meId:n,now:h,app:y,onSaved:x}){const[j,b]=(0,s.useState)({date:p(h).slice(0,10),time:p(h).slice(11),location:'',person:'',personType:'Staff',category:'',what:'',injury:'',firstAid:'',witnesses:'',reportedBy:e.replace(' (example)','')}),[w,f]=(0,s.useState)(''),[T,D]=(0,s.useState)(''),I=e=>b({...j,...e}),S='Near miss'===j.category,C=(e,s,n,l=!1)=>(0,u.jsxs)(a.default,{style:{gap:4},children:[(0,u.jsx)(o.T,{size:14,weight:"medium",colour:d.colours.muted,children:e}),(0,u.jsx)(t.TextInput,{accessibilityLabel:e,value:String(j[s]),onChangeText:e=>I({[s]:e}),placeholder:n,placeholderTextColor:"#7D776C",multiline:l,style:[o.styles.input,l&&{minHeight:70,textAlignVertical:'top'}]})]});return(0,u.jsxs)(c.Box,{testID:"accident-form",children:[(0,u.jsx)(o.T,{size:18,weight:"semibold",children:"Report an accident or near miss"}),(0,u.jsxs)(o.Row,{gap:8,children:[(0,u.jsxs)(a.default,{style:{flex:1,gap:4},children:[(0,u.jsx)(o.T,{size:14,weight:"medium",colour:d.colours.muted,children:"Date"}),(0,u.jsx)(t.TextInput,{accessibilityLabel:"Date",value:j.date,onChangeText:e=>I({date:e}),placeholder:"YYYY-MM-DD",placeholderTextColor:"#7D776C",style:[o.styles.input,{minWidth:0,width:40}]})]}),(0,u.jsxs)(a.default,{style:{width:110,gap:4},children:[(0,u.jsx)(o.T,{size:14,weight:"medium",colour:d.colours.muted,children:"Time"}),(0,u.jsx)(t.TextInput,{accessibilityLabel:"Time",value:j.time,onChangeText:e=>I({time:e}),placeholder:"HH:MM",placeholderTextColor:"#7D776C",style:o.styles.input})]})]}),(0,u.jsx)(o.T,{size:14,weight:"medium",colour:d.colours.muted,children:"What kind?"}),(0,u.jsx)(o.Row,{wrap:!0,gap:6,children:l.ACCIDENT_CATEGORIES.map(e=>(0,u.jsx)(o.Chip,{label:e,selected:j.category===e,onPress:()=>I({category:e})},e))}),C('Where it happened','location','e.g. kitchen pass, cellar steps, terrace'),C('Person involved','person','Name'),(0,u.jsx)(o.Row,{wrap:!0,gap:6,children:['Staff','Customer','Contractor','Visitor'].map(e=>(0,u.jsx)(o.Chip,{label:e,selected:j.personType===e,onPress:()=>I({personType:e})},e))}),C('What happened','what','Describe what happened, in order',!0),C('Injury','injury',S?'None (near miss)':'e.g. small cut to left thumb'),C('First aid given','firstAid','e.g. cleaned and plaster applied by \u2026'),C('Witnesses','witnesses','Names, or none'),C('Reported by','reportedBy','Your name'),w?(0,u.jsx)(o.Banner,{kind:"warn",children:w}):null,(0,u.jsx)(o.Button,{label:"Save to the accident book",testID:"accident-save",onPress:()=>/^\d{4}-\d{2}-\d{2}$/.test(j.date)&&/^([01]\d|2[0-3]):[0-5]\d$/.test(j.time)?j.category?j.location.trim()&&j.person.trim()&&j.what.trim()?(l.useSafety.getState().addAccident({when:`${j.date}T${j.time}`,location:j.location.trim(),person:j.person.trim(),personType:j.personType,category:j.category,what:j.what.trim(),injury:j.injury.trim()||(S?'None (near miss)':'Not recorded'),firstAid:j.firstAid.trim()||'None recorded',witnesses:j.witnesses.trim()||'None',reportedBy:j.reportedBy.trim()||e,reportedById:n,app:y}),D(`Saved to the accident book: ${j.category}, ${j.location.trim()}.`),f(''),b({...j,location:'',person:'',category:'',what:'',injury:'',firstAid:'',witnesses:''}),void x()):f('Fill in where it happened, who was involved and what happened.'):f('Pick what kind of accident or near miss it was.'):f('Enter the date as YYYY-MM-DD and the time as HH:MM.')}),T?(0,u.jsx)(a.default,{testID:"accident-saved",children:(0,u.jsx)(o.T,{size:14,colour:d.colours.ok,children:T})}):null,(0,u.jsx)(o.Muted,{children:"Personal details are only visible to managers. You can see your own entries."})]})}function j({a:e,manager:c}){const h=l.RIDDOR_CATEGORIES.includes(e.category),[p,x]=(0,s.useState)(e.riddorNote??''),[j,b]=(0,s.useState)(!1);return(0,u.jsxs)(a.default,{testID:"accident-entry",style:{paddingVertical:10,borderTopWidth:1,borderColor:d.colours.border,gap:4},children:[(0,u.jsxs)(n.default,{accessibilityRole:"button",accessibilityLabel:`${e.category} at ${e.location}`,onPress:()=>b(!j),children:[(0,u.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsxs)(o.T,{weight:"semibold",style:{flex:1},children:[e.category," \xb7 ",e.location]}),(0,u.jsx)(o.Badge,{kind:'Near miss'===e.category?'blue':h?'red':'amber',label:'Near miss'===e.category?'Near miss':h?'Serious':'Accident'})]}),(0,u.jsxs)(o.Muted,{children:[y(e.when)," \xb7 ",e.person," (",e.personType,") \xb7 reported by ",e.reportedBy]})]}),j||c?(0,u.jsxs)(a.default,{style:{gap:2},children:[(0,u.jsxs)(o.T,{size:14,children:["What happened: ",e.what]}),(0,u.jsxs)(o.T,{size:14,children:["Injury: ",e.injury]}),(0,u.jsxs)(o.T,{size:14,children:["First aid: ",e.firstAid]}),(0,u.jsxs)(o.T,{size:14,children:["Witnesses: ",e.witnesses]})]}):null,c&&h?(0,u.jsxs)(a.default,{testID:"riddor-prompt",style:{gap:6},children:[(0,u.jsx)(o.Banner,{kind:"danger",title:"Consider RIDDOR",children:"This may need reporting to the HSE under RIDDOR (for example a specified injury, over-7-day incapacitation, or a member of the public taken to hospital). Check the HSE\u2019s RIDDOR guidance and decide. CoverCharge never reports anything for you."}),(0,u.jsx)(t.TextInput,{accessibilityLabel:"RIDDOR decision note",value:p,onChangeText:x,placeholder:"Your decision, e.g. reported on \u2026 ref \u2026, or not reportable because \u2026",placeholderTextColor:"#7D776C",style:o.styles.input}),(0,u.jsx)(o.Button,{small:!0,label:"Save note",disabled:p===(e.riddorNote??''),onPress:()=>l.useSafety.getState().setRiddorNote(e.id,p)}),e.riddorNote?(0,u.jsxs)(o.Muted,{children:["Saved note: ",e.riddorNote]}):null]}):null]})}},1010,[875,30,263,127,813,1104,821,1339,24]); +__d(function(g,_r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.MissedBanner=v,_e.HaccpLog=function({me:e,meId:t,now:n,mode:s}){const[o,l]=(0,i.useState)('today'),r=(e,t)=>({id:e,label:t}),u='chef'===s?[r('today','Today'),r('units','Fridges & units'),r('record','Quick entry'),r('diary','Diary'),r('weekly','Weekly sign-off'),r('report','EHO report'),r('history','History'),r('limits','Safe limits'),r('probes','Wireless probes')]:'managers'===s?[r('today','Today'),r('units','Fridges & units'),r('diary','Diary'),r('weekly','Weekly sign-off'),r('report','EHO report'),r('history','History'),r('limits','Safe limits'),r('probes','Wireless probes')]:[r('today','Today'),r('record','Quick entry'),r('diary','Diary'),r('history','My entries')],h={me:e,meId:t,now:n,mode:s};return(0,y.jsxs)(d.default,{style:{gap:12},testID:"haccp-log",children:['today'!==o?(0,y.jsx)(v,{mode:s,now:n,onPress:()=>l('today')}):null,(0,y.jsx)(x.Tabs,{value:o,onChange:l,options:u}),'today'===o?(0,y.jsx)(b.TodayView,{who:h}):null,'units'===o?(0,y.jsx)(b.UnitsView,{who:h}):null,'record'===o?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(C,{who:h}),(0,y.jsx)(T,{who:h})]}):null,'diary'===o?(0,y.jsx)(b.DiaryView,{who:h}):null,'weekly'===o?(0,y.jsx)(b.WeeklyView,{who:h}):null,'report'===o?(0,y.jsx)(b.ReportView,{who:h}):null,'history'===o?(0,y.jsx)(S,{who:h}):null,'limits'===o?(0,y.jsx)(I,{mode:s,editable:'chef'===s}):null,'probes'===o?(0,y.jsx)(B,{mode:s,me:e,now:n}):null,(0,y.jsx)(c.Muted,{children:"Every reading here was entered by a person; the app never fills in or estimates a value. Sections follow Safer Food, Better Business (cross-contamination, cleaning, chilling, cooking, management). Your own HACCP plan (e.g. CookSafe) sets the limits that count. Saved on this device."})]})};var t=_r(_d[0]),n=_r(_d[1]),s=_r(_d[2]),o=_r(_d[3]),i=_r(_d[4]),l=e(_r(_d[5])),r=e(_r(_d[6])),d=e(_r(_d[7])),c=_r(_d[8]),u=_r(_d[9]),h=_r(_d[10]),p=_r(_d[11]),m=_r(_d[12]),x=_r(_d[13]),b=_r(_d[14]),y=_r(_d[15]);const f=e=>new Date(e).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}),j=e=>new Date(e).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'}),w=e=>{const t=e.trim().replace(',','.').replace(/^\u2212/,'-');return t&&/^-?\d+(\.\d+)?$/.test(t)?Number(t):null};function v({now:e,onPress:t,mode:s="managers"}){const o=(0,n.useSafetyView)(s).points,i=(0,n.useSafetyView)(s).entries,l=(0,h.missedChecks)(o,i,e);if(!l.length)return(0,y.jsx)(d.default,{testID:"haccp-uptodate",children:(0,y.jsx)(c.Banner,{kind:"success",title:"Food safety checks up to date",children:"No checks overdue right now."})});const u=(0,y.jsx)(d.default,{testID:"haccp-missed",children:(0,y.jsx)(c.Banner,{kind:"warn",title:`${l.length} food safety check${1===l.length?'':'s'} overdue`,children:l.map(e=>`${e.point.name} (due ${e.due})`).join(' \xb7 ')})});return t?(0,y.jsx)(r.default,{accessibilityRole:"button",accessibilityLabel:"Open the food safety log",onPress:t,children:u}):u}function k(e,t){u.useSafety.getState().addEntries(t.filter(t=>'chef'!==e.mode||(0,s.chefCanSee)(o.useOwner.getState().site,t.point)).map(t=>{const n=(0,h.isTempKind)(t.point.kind)?(0,h.inRange)(t.point,t.value):!!t.done;return{pointId:t.point.id,name:t.point.name,kind:t.point.kind,at:e.now.toISOString(),by:e.me.replace(' (example)',''),byId:e.meId,app:e.mode,value:t.value,done:t.done,ok:n,corrective:t.corrective?.trim()||void 0,note:t.note?.trim()||void 0,source:t.source,initials:(0,h.initialsOf)(e.me)}}))}function C({who:e}){const l=(0,n.useSafetyView)(e.mode).points,[u,m]=(0,i.useState)(''),[b,f]=(0,i.useState)(null),[j,v]=(0,i.useState)(''),[C,T]=(0,i.useState)(!1),[S,D]=(0,i.useState)(!1),I=(0,i.useRef)(null),P=(t,n)=>{if('chef'===e.mode&&!(0,s.chefCanSee)(o.useOwner.getState().site,t))return f(null),void v('That check is managed in the Managers app.');const i=(0,h.parseQuick)(t,l);D(n),v(''),f(i.map((e,t)=>({key:`${t}-${e.text}`,text:e.text,pointId:e.point?.id,value:null==e.value?'':String(e.value),done:!(!e.point||(0,h.isTempKind)(e.point.kind)||!/\b(done|yes|complete|completed|ok|signed)\b/i.test(e.text))||void 0,corrective:'',problem:e.problem})))},R=(e,t)=>f(n=>n&&n.map(n=>n.key===e?{...n,...t}:n)),B=(b??[]).map(e=>{const t=l.find(t=>t.id===e.pointId),n=w(e.value),s=!!t&&(0,h.isTempKind)(t.kind),o=!!t&&(s?null!=n:void 0!==e.done),i=t?s?null!=n?(0,h.inRange)(t,n):null:void 0===e.done?null:e.done:null;return{d:e,point:t,v:n,temp:s,ready:o,ok:i,needsAction:!1===i&&!e.corrective.trim()}}),L=B.length>0&&B.every(e=>e.ready&&!e.needsAction);return(0,y.jsxs)(x.Box,{testID:"haccp-quick",children:[(0,y.jsx)(c.T,{weight:"semibold",size:17,children:"Quick entry: say or type readings"}),(0,y.jsx)(c.Muted,{children:"For example \u201cwalk-in fridge 3, freezer minus 19\u201d. You check every value before anything is saved."}),(0,y.jsxs)(c.Row,{gap:8,children:[(0,y.jsx)(t.TextInput,{accessibilityLabel:"Readings",value:u,onChangeText:m,placeholder:"walk-in fridge 3, freezer minus 19",placeholderTextColor:"#7D776C",onSubmitEditing:()=>P(u,!1),style:[c.styles.input,{flex:1,minWidth:0,width:40}]}),(0,y.jsx)(r.default,{accessibilityRole:"button",accessibilityLabel:"Speak readings",testID:"haccp-mic",onPress:()=>{const e=(0,x.speechRecognition)();if(!e)return void v("Voice input isn't available in this browser (for example Huawei Browser). Please type the readings instead.");if(C)return void I.current?.stop();const t=new e;I.current=t,t.lang='en-GB',t.interimResults=!1,t.maxAlternatives=1,t.onresult=e=>{const t=e.results?.[0]?.[0]?.transcript??'';m(t),t&&P(t,!0)},t.onerror=()=>v("Didn't catch that. Try again or type the readings."),t.onend=()=>T(!1);try{t.start(),T(!0)}catch{v("Voice input couldn't start. Please type the readings.")}},style:{width:48,height:48,borderRadius:24,borderWidth:1.5,borderColor:p.colours.gold,alignItems:'center',justifyContent:'center',backgroundColor:C?p.colours.gold:'transparent'},children:(0,y.jsx)(c.T,{size:20,children:C?'\u25a0':'\ud83c\udfa4'})})]}),(0,y.jsx)(c.Button,{label:"Check readings",disabled:!u.trim(),onPress:()=>P(u,!1)}),j?(0,y.jsx)(d.default,{testID:"haccp-quick-msg",children:(0,y.jsx)(c.Banner,{kind:"info",children:j})}):null,b?(0,y.jsxs)(d.default,{style:{gap:10},testID:"haccp-confirm",children:[(0,y.jsxs)(c.T,{weight:"semibold",children:["Check these ",b.length," reading",1===b.length?'':'s']}),B.map(({d:e,point:n,temp:s,ok:o,needsAction:i})=>(0,y.jsxs)(d.default,{testID:"haccp-draft",style:{gap:6,padding:10,borderRadius:12,borderWidth:1,borderColor:!1===o?p.colours.red:p.colours.border,backgroundColor:p.colours.surface2},children:[(0,y.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsxs)(c.Muted,{style:{flex:1},children:["Heard: \u201c",e.text,"\u201d"]}),(0,y.jsx)(r.default,{accessibilityRole:"button",accessibilityLabel:`Remove ${n?.name??e.text}`,onPress:()=>f(t=>t.filter(t=>t.key!==e.key)),children:(0,y.jsx)(c.T,{colour:p.colours.muted,children:"\u2715"})})]}),n?(0,y.jsxs)(c.T,{weight:"semibold",children:[n.name," ",(0,y.jsxs)(c.Muted,{children:["\xb7 safe: ",(0,h.limitText)(n)]})]}):(0,y.jsxs)(d.default,{style:{gap:6},children:[(0,y.jsx)(c.T,{colour:p.colours.amber,children:e.problem}),(0,y.jsx)(c.Row,{wrap:!0,gap:6,children:l.map(t=>(0,y.jsx)(c.Chip,{label:t.name,onPress:()=>R(e.key,{pointId:t.id,problem:void 0})},t.id))})]}),n&&s?(0,y.jsxs)(c.Row,{gap:8,children:[(0,y.jsx)(t.TextInput,{accessibilityLabel:`Reading for ${n.name}`,value:e.value,onChangeText:t=>R(e.key,{value:t}),placeholder:"\xb0C",placeholderTextColor:"#7D776C",keyboardType:"numbers-and-punctuation",style:[c.styles.input,{width:96,fontSize:20}]}),(0,y.jsx)(c.T,{size:18,children:"\xb0C"}),null===o?(0,y.jsx)(c.Badge,{kind:"amber",label:"Type the reading"}):(0,y.jsx)(c.Badge,{kind:o?'ok':'red',label:o?'OK':'OUT OF RANGE'})]}):null,n&&!s?(0,y.jsxs)(c.Row,{gap:6,children:[(0,y.jsx)(c.Chip,{label:"Done",selected:!0===e.done,onPress:()=>R(e.key,{done:!0})}),(0,y.jsx)(c.Chip,{label:"Not done",selected:!1===e.done,onPress:()=>R(e.key,{done:!1})})]}):null,!1===o?(0,y.jsx)(t.TextInput,{accessibilityLabel:`Corrective action for ${n.name}`,value:e.corrective,onChangeText:t=>R(e.key,{corrective:t}),placeholder:"What did you do? e.g. moved stock, called engineer, re-checked",placeholderTextColor:"#7D776C",style:[c.styles.input,i&&{borderColor:p.colours.red}]}):null,i?(0,y.jsx)(c.T,{size:13,colour:p.colours.red,children:"A corrective action note is needed before saving."}):null]},e.key)),(0,y.jsxs)(c.Row,{gap:8,children:[(0,y.jsx)(c.Button,{label:`Save ${B.length} reading${1===B.length?'':'s'}`,testID:"haccp-save-quick",disabled:!L,onPress:()=>{k(e,B.map(e=>({point:e.point,value:e.temp?e.v:void 0,done:e.temp?void 0:e.d.done,corrective:e.d.corrective,source:S?'voice':'typed'}))),v(`Saved ${B.length} reading${1===B.length?'':'s'}.`),f(null),m('')},style:{flex:1}}),(0,y.jsx)(c.Button,{kind:"secondary",label:"Cancel",onPress:()=>{f(null),v('Nothing saved.')}})]}),(0,y.jsx)(c.Muted,{children:"Nothing is saved until you tap Save."})]}):null]})}function T({who:e}){const s=(0,n.useSafetyView)(e.mode).points,[o,l]=(0,i.useState)(s[0]?.id),[r,d]=(0,i.useState)(''),[u,m]=(0,i.useState)(),[b,f]=(0,i.useState)(''),[j,v]=(0,i.useState)(''),[C,T]=(0,i.useState)(''),S=s.find(e=>e.id===o),D=!!S&&(0,h.isTempKind)(S.kind),I=w(r),P=S?D?null==I?null:(0,h.inRange)(S,I):void 0===u?null:u:null,R=null!==P&&(P||b.trim());return(0,y.jsxs)(x.Box,{testID:"haccp-manual",children:[(0,y.jsx)(c.T,{weight:"semibold",size:17,children:"Record one check"}),(0,y.jsx)(c.Row,{wrap:!0,gap:6,children:s.map(e=>(0,y.jsx)(c.Chip,{label:e.name,selected:e.id===o,onPress:()=>{l(e.id),d(''),m(void 0),f(''),T('')}},e.id))}),S?(0,y.jsxs)(c.Muted,{children:[h.KIND_LABEL[S.kind]," \xb7 safe: ",(0,h.limitText)(S)]}):null,D?(0,y.jsxs)(c.Row,{gap:8,children:[(0,y.jsx)(t.TextInput,{accessibilityLabel:"Temperature reading",value:r,onChangeText:d,placeholder:"\xb0C",placeholderTextColor:"#7D776C",keyboardType:"numbers-and-punctuation",style:[c.styles.input,{width:110,fontSize:22}]}),(0,y.jsx)(c.T,{size:18,children:"\xb0C"}),null===P?null:(0,y.jsx)(c.Badge,{kind:P?'ok':'red',label:P?'OK':'OUT OF RANGE'})]}):(0,y.jsxs)(c.Row,{gap:6,children:[(0,y.jsx)(c.Chip,{label:"Done",selected:!0===u,onPress:()=>m(!0)}),(0,y.jsx)(c.Chip,{label:"Not done",selected:!1===u,onPress:()=>m(!1)})]}),!1===P?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(c.Banner,{kind:"danger",title:D?'Out of range':'Check not done',children:"Write what you did about it before saving (e.g. moved food, discarded, called the engineer, re-checked in 30 minutes)."}),(0,y.jsx)(t.TextInput,{accessibilityLabel:"Corrective action",value:b,onChangeText:f,placeholder:"Corrective action taken",placeholderTextColor:"#7D776C",style:c.styles.input})]}):null,(0,y.jsx)(t.TextInput,{accessibilityLabel:"Note (optional)",value:j,onChangeText:v,placeholder:"Note (optional), e.g. probe used, batch",placeholderTextColor:"#7D776C",style:c.styles.input}),(0,y.jsx)(c.Button,{label:"Save check",testID:"haccp-save-one",disabled:!R,onPress:()=>{k(e,[{point:S,value:D?I:void 0,done:D?void 0:u,corrective:b,note:j,source:'typed'}]),d(''),m(void 0),f(''),v(''),T(`Saved: ${S.name}.`)}}),C?(0,y.jsx)(c.T,{size:14,colour:p.colours.ok,children:C}):null]})}function S({who:e}){const t=(0,n.useSafetyView)(e.mode).entries,s=(0,n.useSafetyView)(e.mode).points,[o,l]=(0,i.useState)('7'),[r,u]=(0,i.useState)('all'),[m,b]=(0,i.useState)(!1),[f,j]=(0,i.useState)(''),w='staff'===e.mode,v=(0,i.useMemo)(()=>{const n=new Date(e.now);n.setHours(0,0,0,0);const s='today'===o?n.getTime():'all'===o?0:e.now.getTime()-864e5*Number(o);return t.filter(t=>!(w&&t.byId!==e.meId||!(new Date(t.at).getTime()>=s)||'all'!==r&&t.kind!==r||m&&t.ok))},[t,o,r,m,w,e.meId,e.now.getTime()]),k=Array.from(new Set(s.map(e=>e.kind))),C=e.now.toISOString().slice(0,10);return(0,y.jsxs)(x.Box,{testID:"haccp-history",children:[(0,y.jsx)(c.T,{weight:"semibold",size:17,children:w?'My entries':'Food safety log'}),(0,y.jsx)(c.Row,{wrap:!0,gap:6,children:[['today','Today'],['7','7 days'],['30','30 days'],['all','All']].map(([e,t])=>(0,y.jsx)(c.Chip,{label:t,selected:o===e,onPress:()=>l(e)},e))}),(0,y.jsxs)(c.Row,{wrap:!0,gap:6,children:[(0,y.jsx)(c.Chip,{label:"All checks",selected:'all'===r,onPress:()=>u('all')}),k.map(e=>(0,y.jsx)(c.Chip,{label:h.KIND_LABEL[e],selected:r===e,onPress:()=>u(e)},e))]}),(0,y.jsx)(c.Toggle,{label:"Out of range only",value:m,onChange:b}),(0,y.jsx)(d.default,{testID:"haccp-count",children:(0,y.jsxs)(c.Muted,{children:[v.length," entr",1===v.length?'y':'ies',v.filter(e=>!e.ok).length?` \xb7 ${v.filter(e=>!e.ok).length} out of range`:'']})}),v.length?v.slice(0,200).map(e=>(0,y.jsx)(D,{e:e},e.id)):(0,y.jsx)(c.Muted,{children:"No entries for these filters yet."}),w?null:(0,y.jsxs)(c.Row,{wrap:!0,gap:8,children:[(0,y.jsx)(c.Button,{small:!0,label:"Download CSV",testID:"haccp-csv",disabled:!v.length,onPress:()=>j((0,x.downloadText)(`food-safety-log-${C}.csv`,(0,h.toCsv)(v,s))?`CSV downloaded: ${v.length} entries.`:'Downloads work in the web app.')}),(0,y.jsx)(c.Button,{small:!0,kind:"secondary",label:"Print for EHO",testID:"haccp-print",disabled:!v.length,onPress:()=>j((0,x.printTable)('Food safety log (HACCP)',`${v.length} entries \xb7 printed ${e.now.toLocaleString('en-GB')} \xb7 all readings entered by staff`,h.LOG_HEAD,(0,h.logRows)(v,s))?'Print view opened in a new tab.':'Pop-ups are blocked: allow them to print.')})]}),f?(0,y.jsx)(c.T,{size:14,colour:p.colours.ok,children:f}):null]})}function D({e:e}){return(0,y.jsxs)(d.default,{testID:"haccp-row",style:{paddingVertical:8,borderTopWidth:1,borderColor:p.colours.border,gap:2},children:[(0,y.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(c.T,{size:15,weight:"medium",style:{flex:1},children:e.name}),(0,y.jsx)(c.T,{size:17,weight:"bold",colour:e.ok?p.colours.ok:p.colours.red,children:(0,h.fmtEntryValue)(e)})]}),(0,y.jsxs)(c.Row,{gap:6,children:[(0,y.jsx)(m.StaffAvatar,{id:e.byId,name:e.by,size:20,ring:!1}),(0,y.jsxs)(c.Muted,{style:{flex:1},children:[j(e.at)," ",f(e.at)," \xb7 ",e.initials??(0,h.initialsOf)(e.by)," ",e.by,'voice'===e.source?' \xb7 voice, confirmed':'probe'===e.source?' \xb7 probe':'',e.ok?'':' \xb7 OUT OF RANGE']})]}),e.corrective?(0,y.jsxs)(c.T,{size:13,colour:p.colours.amber,children:["Action: ",e.corrective]}):null,e.note?(0,y.jsxs)(c.Muted,{children:["Note: ",e.note]}):null,e.photo?(0,y.jsx)(l.default,{source:{uri:e.photo},style:{width:72,height:72,borderRadius:8},accessibilityLabel:"Corrective action photo"}):null]})}function I({editable:e,mode:t}){const s=(0,n.useSafetyView)(t).points,[o,l]=(0,i.useState)('');return(0,y.jsxs)(x.Box,{testID:"haccp-limits",children:[(0,y.jsx)(c.T,{weight:"semibold",size:17,children:"Check points and safe limits"}),(0,y.jsx)(c.Muted,{children:e?'Set the limits from your own HACCP plan. Leave min or max empty if it doesn\u2019t apply. Due times are daily reminders (24 h, comma separated).':'Set by the Head Chef in CoverCharge for Head Chef.'}),s.map(t=>(0,y.jsx)(P,{p:t,editable:e,onSaved:()=>l(`Saved limits for ${t.name}.`)},t.id)),e?(0,y.jsx)(R,{onAdded:e=>l(`Added ${e}.`)}):null,o?(0,y.jsx)(c.T,{size:14,colour:p.colours.ok,children:o}):null]})}function P({p:e,editable:n,onSaved:s}){const[o,l]=(0,i.useState)(null==e.min?'':String(e.min)),[r,m]=(0,i.useState)(null==e.max?'':String(e.max)),[x,b]=(0,i.useState)(e.due.join(', ')),f=(0,h.isTempKind)(e.kind),j=''===x.trim()||x.split(',').every(e=>/^\s*([01]\d|2[0-3]):[0-5]\d\s*$/.test(e)),v=o!==(null==e.min?'':String(e.min))||r!==(null==e.max?'':String(e.max))||x!==e.due.join(', '),k=j&&(''===o||null!=w(o))&&(''===r||null!=w(r));return n?(0,y.jsxs)(d.default,{style:{gap:6,paddingVertical:8,borderTopWidth:1,borderColor:p.colours.border},testID:`limit-${e.id}`,children:[(0,y.jsxs)(c.T,{weight:"medium",children:[e.name," ",(0,y.jsxs)(c.Muted,{children:["\xb7 ",h.KIND_LABEL[e.kind]]})]}),(0,y.jsxs)(c.Row,{wrap:!0,gap:8,children:[f?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(t.TextInput,{accessibilityLabel:`Minimum for ${e.name}`,value:o,onChangeText:l,placeholder:"min \xb0C",placeholderTextColor:"#7D776C",style:[c.styles.input,{width:90}]}),(0,y.jsx)(t.TextInput,{accessibilityLabel:`Maximum for ${e.name}`,value:r,onChangeText:m,placeholder:"max \xb0C",placeholderTextColor:"#7D776C",style:[c.styles.input,{width:90}]})]}):null,(0,y.jsx)(t.TextInput,{accessibilityLabel:`Due times for ${e.name}`,value:x,onChangeText:b,placeholder:"e.g. 09:00, 16:00",placeholderTextColor:"#7D776C",style:[c.styles.input,{flex:1,minWidth:140,width:40}]}),v?(0,y.jsx)(c.Button,{small:!0,label:"Save",disabled:!k,onPress:()=>{u.useSafety.getState().setPoint(e.id,{min:''===o?void 0:w(o),max:''===r?void 0:w(r),due:x.split(',').map(e=>e.trim()).filter(Boolean).sort()}),s()}}):null]}),j?null:(0,y.jsx)(c.T,{size:13,colour:p.colours.red,children:"Use 24-hour times like 09:00, 16:00."})]}):(0,y.jsxs)(c.Row,{style:{justifyContent:'space-between',paddingVertical:4},children:[(0,y.jsx)(c.T,{size:14,style:{flex:1},children:e.name}),(0,y.jsxs)(c.Muted,{children:[(0,h.limitText)(e),e.due.length?` \xb7 due ${e.due.join(', ')}`:'']})]})}function R({onAdded:e}){const[n,l]=(0,i.useState)(''),[r,m]=(0,i.useState)('fridge');return(0,y.jsxs)(d.default,{style:{gap:6,paddingTop:8,borderTopWidth:1,borderColor:p.colours.border},children:[(0,y.jsx)(c.T,{weight:"medium",children:"Add a check point"}),(0,y.jsx)(t.TextInput,{accessibilityLabel:"New check point name",value:n,onChangeText:l,placeholder:"e.g. Dessert fridge",placeholderTextColor:"#7D776C",style:c.styles.input}),(0,y.jsx)(c.Row,{wrap:!0,gap:6,children:Object.keys(h.KIND_LABEL).map(e=>(0,y.jsx)(c.Chip,{label:h.KIND_LABEL[e],selected:e===r,onPress:()=>m(e)},e))}),(0,y.jsx)(c.Button,{small:!0,label:"Add check point",disabled:!n.trim()||!(0,s.chefCanSee)(o.useOwner.getState().site,n),onPress:()=>{if(!(0,s.chefCanSee)(o.useOwner.getState().site,n))return;const t='fridge'===r?{max:5}:'freezer'===r?{max:-18}:'cook'===r?{min:75}:'hothold'===r?{min:63}:'cool'===r||'delivery'===r?{max:8}:{};u.useSafety.getState().addPoint({name:n.trim(),kind:r,due:[],aliases:[n.trim().toLowerCase()],...t}),e(n.trim()),l('')}})]})}function B({me:e,now:l,mode:r}){const h=(0,n.useSafetyView)(r).probes??[],m=(0,n.useSafetyView)(r).points.filter(e=>'fridge'===e.kind||'freezer'===e.kind),[b,f]=(0,i.useState)(!1),[j,w]=(0,i.useState)(''),[v,k]=(0,i.useState)(''),[C,T]=(0,i.useState)(null),[S,D]=(0,i.useState)(''),I=m.find(e=>e.id===v);return(0,y.jsxs)(x.Box,{testID:"haccp-probes",children:[(0,y.jsx)(c.T,{weight:"semibold",size:17,children:"Wireless probes"}),(0,y.jsx)(c.Muted,{children:"Wireless fridge and freezer probes. Once a probe is connected, its readings go into the food safety log tagged \u201cprobe\u201d with the time they were taken. Out-of-range probe readings still need a corrective action from a person."}),h.length?h.map(e=>(0,y.jsxs)(d.default,{testID:"probe-row",style:{gap:6,paddingVertical:10,borderTopWidth:1,borderColor:p.colours.border},children:[(0,y.jsxs)(c.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsxs)(d.default,{style:{flex:1,gap:2},children:[(0,y.jsx)(c.T,{weight:"semibold",children:e.name}),(0,y.jsx)(c.Muted,{children:e.location})]}),(0,y.jsx)(c.Badge,{kind:'connected'===e.status?'ok':'amber',label:'connected'===e.status?'Connected':'Not connected'})]}),(0,y.jsxs)(c.Row,{wrap:!0,gap:6,children:[(0,y.jsx)(c.Button,{small:!0,label:"Connect your probe",accessibilityLabel:`Connect your probe: ${e.name}`,onPress:()=>T(C===e.id?null:e.id)}),(0,y.jsx)(c.Button,{small:!0,kind:"ghost",label:"Remove",accessibilityLabel:`Remove probe ${e.name}`,onPress:()=>u.useSafety.getState().removeProbe(e.id)})]}),C===e.id?(0,y.jsxs)(d.default,{testID:"probe-connect",style:{gap:6,padding:10,borderRadius:12,borderWidth:1,borderColor:p.colours.gold},children:[(0,y.jsx)(c.T,{weight:"semibold",children:"Connect your probe"}),(0,y.jsxs)(c.T,{size:14,children:["1. Put the probe in ",e.location," and switch it on."]}),(0,y.jsx)(c.T,{size:14,children:"2. Keep this device near the probe."}),(0,y.jsx)(c.T,{size:14,children:"3. Tap Search for probe and pick it from the list."}),(0,y.jsx)(c.Button,{small:!0,kind:"secondary",label:"Search for probe",onPress:()=>D(`No probe found for ${e.name}. Probe hardware isn\u2019t set up yet, so it stays Not connected and nothing is added to the log.`)})]}):null]},e.id)):(0,y.jsx)(d.default,{testID:"probes-empty",children:(0,y.jsx)(c.Muted,{children:"No probes yet."})}),S?(0,y.jsx)(d.default,{testID:"probe-msg",children:(0,y.jsx)(c.Banner,{kind:"info",children:S})}):null,b?(0,y.jsxs)(d.default,{testID:"probe-add",style:{gap:8,padding:10,borderRadius:12,borderWidth:1,borderColor:p.colours.gold},children:[(0,y.jsx)(t.TextInput,{accessibilityLabel:"Probe name",value:j,onChangeText:w,placeholder:"e.g. Walk-in probe 1",placeholderTextColor:"#7D776C",style:[c.styles.input,{minWidth:0}]}),(0,y.jsx)(c.Muted,{children:"Where is it?"}),(0,y.jsx)(c.Row,{wrap:!0,gap:6,children:m.map(e=>(0,y.jsx)(c.Chip,{label:e.name,selected:v===e.id,onPress:()=>k(e.id)},e.id))}),(0,y.jsxs)(c.Row,{gap:8,children:[(0,y.jsx)(c.Button,{label:"Save probe",disabled:!j.trim()||!I,onPress:()=>{j.trim()&&I&&('chef'!==r||(0,s.chefCanSee)(o.useOwner.getState().site,I))&&(u.useSafety.getState().addProbe({name:j.trim(),pointId:I.id,location:I.name,addedBy:e.replace(' (example)',''),addedAt:l.toISOString()}),D(`Added \u201c${j.trim()}\u201d for ${I.name}. Next: connect your probe.`),w(''),k(''),f(!1))}}),(0,y.jsx)(c.Button,{kind:"ghost",label:"Cancel",onPress:()=>f(!1)})]})]}):(0,y.jsx)(c.Button,{kind:"secondary",label:"Add probe",onPress:()=>{f(!0),D('')}}),(0,y.jsx)(c.Muted,{children:"No probe hardware is connected, so no probe readings appear. The app never makes up a temperature."})]})}},1011,[875,1344,1023,854,30,196,263,127,813,1104,1112,821,952,1339,1345,24]); +__d(function(_g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.styliseOnDevice=p,_e.pickPhoto=b,_e.AvatarMaker=function({meId:e,me:h}){const u=(0,n.useAvatars)(t=>t.photos[e]),[g,f]=(0,t.useState)(null),[v,y]=(0,t.useState)(null),[x,j]=(0,t.useState)(!1),[w,I]=(0,t.useState)(!1),[k,P]=(0,t.useState)('');(0,t.useEffect)(()=>()=>{g&&URL.revokeObjectURL(g)},[g]);const M='undefined'!=typeof document,R=async e=>{P('');const t=await b(e);if(t){I(!0),j(!1);try{const e=await p(t);g&&URL.revokeObjectURL(g),f(URL.createObjectURL(t)),y(e)}catch{P("That photo couldn't be opened. Try a different one (JPEG or PNG).")}finally{I(!1)}}},S=()=>{g&&URL.revokeObjectURL(g),f(null),y(null),j(!1)},B=h.replace(' (example)','');return(0,c.jsxs)(o.default,{style:{gap:12},testID:"avatar-maker",children:[(0,c.jsxs)(d.Box,{children:[(0,c.jsxs)(s.Row,{gap:14,children:[(0,c.jsx)(l.StaffAvatar,{id:e,size:88}),(0,c.jsxs)(o.default,{style:{flex:1,gap:4},children:[(0,c.jsx)(s.T,{weight:"semibold",size:17,children:B}),(0,c.jsxs)(s.Muted,{children:[u?`Your avatar from a photo (made ${new Date(u.at).toLocaleDateString('en-GB')}).`:'Your default space-age avatar.'," It shows on rotas, chat, clock-in and sign-offs."]})]})]}),u?(0,c.jsx)(s.Button,{small:!0,kind:"secondary",label:"Back to my default avatar",testID:"avatar-own-reset",onPress:()=>{n.useAvatars.getState().reset(e,{id:e,role:'staff',name:B}),P('Back to your default avatar.')}}):null]}),(0,c.jsxs)(d.Box,{testID:"avatar-create",children:[(0,c.jsx)(s.T,{weight:"semibold",size:17,children:"Create my avatar from a photo"}),(0,c.jsx)(s.Muted,{children:"Upload a photo or take a selfie. Your phone turns it into a retro space-age avatar. The photo never leaves this device and isn't saved: only the finished avatar is kept."}),M?v?(0,c.jsxs)(o.default,{style:{gap:10},testID:"avatar-preview",children:[(0,c.jsxs)(s.Row,{gap:12,style:{justifyContent:'center'},children:[(0,c.jsxs)(o.default,{style:{alignItems:'center',gap:4},children:[g?(0,c.jsx)(a.default,{source:{uri:g},style:{width:96,height:96,borderRadius:12},accessibilityLabel:"Your photo"}):null,(0,c.jsx)(s.Muted,{children:"Your photo"})]}),(0,c.jsx)(s.T,{size:22,colour:i.colours.gold,children:"\u2192"}),(0,c.jsxs)(o.default,{style:{alignItems:'center',gap:4},children:[(0,c.jsx)(a.default,{source:{uri:v},style:{width:120,height:120,borderRadius:60,borderWidth:3,borderColor:i.colours.gold},accessibilityLabel:"Your new avatar preview",testID:"avatar-result"}),(0,c.jsx)(s.Muted,{children:"Your avatar"})]})]}),(0,c.jsxs)(r.default,{accessibilityRole:"checkbox",accessibilityState:{checked:x},accessibilityLabel:"I agree to use this avatar",testID:"avatar-consent",onPress:()=>j(!x),style:{flexDirection:'row',gap:10,alignItems:'flex-start',padding:10,borderRadius:12,borderWidth:1,borderColor:x?i.colours.gold:i.colours.border},children:[(0,c.jsx)(o.default,{style:{width:24,height:24,borderRadius:6,borderWidth:2,borderColor:i.colours.gold,backgroundColor:x?i.colours.gold:'transparent',alignItems:'center',justifyContent:'center'},children:x?(0,c.jsx)(s.T,{size:15,weight:"bold",colour:"#111",children:"\u2713"}):null}),(0,c.jsx)(s.T,{size:14,style:{flex:1},children:"I\u2019m happy for this avatar, made from my photo, to be shown to my team in CoverCharge. Only the finished avatar is shared; my photo isn\u2019t uploaded or kept, and a manager can reset my avatar."})]}),(0,c.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,c.jsx)(s.Button,{label:"Use as my avatar",testID:"avatar-save",disabled:!x,onPress:()=>{const t=n.useAvatars.getState().setOwn(e,e,v,B);P(t?'Saved: this is your avatar now.':"Couldn't save the avatar."),t&&S()}}),(0,c.jsx)(s.Button,{kind:"secondary",label:"Try another photo",onPress:S})]})]}):(0,c.jsxs)(s.Row,{wrap:!0,gap:8,children:[(0,c.jsx)(s.Button,{label:w?'Making your avatar\u2026':'Upload a photo',testID:"avatar-upload",disabled:w,onPress:()=>R(!1)}),(0,c.jsx)(s.Button,{kind:"secondary",label:"Take a selfie",testID:"avatar-selfie",disabled:w,onPress:()=>R(!0)})]}):(0,c.jsx)(s.Muted,{children:"Available in the web app."}),k?(0,c.jsx)(o.default,{testID:"avatar-msg",children:(0,c.jsx)(s.T,{size:14,colour:i.colours.ok,children:k})}):null,(0,c.jsx)(s.Banner,{kind:"info",title:"Coming soon: AI avatars",children:"A future version will use AI to draw you as a full cartoon in the same style. For now it's a simple filter that runs on your phone."})]})]})};var t=_r(_d[0]),a=e(_r(_d[1]));_r(_d[2]);var r=e(_r(_d[3])),o=e(_r(_d[4])),s=_r(_d[5]),l=_r(_d[6]),n=_r(_d[7]),i=_r(_d[8]),d=_r(_d[9]),c=_r(_d[10]);const h=['#1B1B1B','#4A3F35','#B89A72','#E9B949','#FFF4E0'].map(e=>[1,3,5].map(t=>parseInt(e.slice(t,t+2),16))),u=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5];function g(e){return new Promise((t,a)=>{const r=URL.createObjectURL(e),o=new window.Image;o.onload=()=>t({img:o,url:r}),o.onerror=()=>{URL.revokeObjectURL(r),a(new Error('bad image'))},o.src=r})}function f(e,t,a,r){e.beginPath(),e.moveTo(t,a-r),e.quadraticCurveTo(t+.18*r,a-.18*r,t+r,a),e.quadraticCurveTo(t+.18*r,a+.18*r,t,a+r),e.quadraticCurveTo(t-.18*r,a+.18*r,t-r,a),e.quadraticCurveTo(t-.18*r,a-.18*r,t,a-r),e.fill()}async function p(e){const{img:t,url:a}=await g(e);try{const e=112,a=256,r=document.createElement('canvas');r.width=e,r.height=e;const o=r.getContext('2d'),s=Math.min(t.width,t.height);o.drawImage(t,(t.width-s)/2,Math.max(0,(t.height-s)/2-.04*s),s,s,0,0,e,e);const l=o.getImageData(0,0,e,e),n=l.data,i=[];for(let e=0;ee-t),c=d[Math.floor(.04*d.length)],g=d[Math.floor(.96*d.length)]||255;for(let t=0;t{const a=document.createElement('input');a.type='file',a.accept='image/*',e&&a.setAttribute('capture','user'),a.onchange=()=>t(a.files?.[0]??null),a.click()})}},1012,[30,196,122,263,127,813,952,1200,821,1339,24]); +__d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEFAULT_LOYALTY",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"consentText",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"prettyCardNo",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"cleanCode",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"cardQr",{enumerable:!0,get:function(){return s}}),_e.readCardQr=function(e){const r=/^covercharge:card:[^:]+:([A-Za-z0-9-]{8,9})$/.exec(e.trim());return r?n(r[1]):null},Object.defineProperty(_e,"codeQr",{enumerable:!0,get:function(){return o}}),_e.checkSettings=function(e){return!Number.isInteger(e.stampsNeeded)||e.stampsNeeded<2||e.stampsNeeded>30?'Stamps needed must be between 2 and 30.':e.reward.trim()?e.reward.length>80?'Keep the reward under 80 letters.':e.gapMinutes<0||e.gapMinutes>1440?'Time between stamps must be 0 to 24 hours.':e.maxPerDay<1||e.maxPerDay>10?'Stamps a day must be 1 to 10.':!Number.isInteger(e.stampExpiryDays)||e.stampExpiryDays<0||e.stampExpiryDays>1095?'Stamps last 0 (never run out) to 1095 days.':!Number.isInteger(e.rewardExpiryDays)||e.rewardExpiryDays<0||e.rewardExpiryDays>1095?'Rewards last 0 (never run out) to 1095 days.':!e.referralOn||e.referralGiver.trim()&&e.referralFriend.trim()?e.referralMonthlyCap<0||e.referralMonthlyCap>50?'Friend rewards a month must be 0 to 50.':null:'Say what both people get before you switch Bring a friend on.':'Say what the reward is, for example Free dessert.'},_e.checkOffer=function(e){if(!e.title.trim())return'Give the offer a title.';if(e.title.length>80)return'Keep the title under 80 letters.';if(e.details.length>500)return'Keep the details under 500 letters.';const r=/^\d{4}-\d{2}-\d{2}$/;return e.startsOn&&!r.test(e.startsOn)?'Start date should look like 2026-11-30.':e.endsOn&&!r.test(e.endsOn)?'End date should look like 2026-11-30.':e.startsOn&&e.endsOn&&e.endsOn`I agree to ${e} keeping my name and the phone or email I give, only to run my stamp card and offers here. I can leave at any time and my details are removed.`,t=e=>e&&8===e.length?`${e.slice(0,4)}-${e.slice(4)}`:e,n=e=>e.toUpperCase().replace(/[^A-Z0-9]/g,''),s=(e,r)=>`covercharge:card:${e}:${r}`;const o=(e,r,t)=>`${e.replace(/\/$/,'')}/customer/${r}/loyalty?code=${t}`;const l=(e,r)=>e.isOn&&(!e.startsOn||e.startsOn<=r)&&(!e.endsOn||e.endsOn>=r),p=r=>r?{saved:!!r.updated_by,cardOn:!!r.card_on,stampsNeeded:r.stamps_needed??8,reward:r.reward??'',stampExpiryDays:r.stamp_expiry_days??0,rewardExpiryDays:r.reward_expiry_days??0,gapMinutes:r.gap_minutes??60,maxPerDay:r.max_per_day??1,referralOn:!!r.referral_on,referralGiver:r.referral_giver??'',referralFriend:r.referral_friend??'',referralMonthlyCap:r.referral_monthly_cap??5}:{...e},u=e=>({card_on:e.cardOn,stamps_needed:e.stampsNeeded,reward:e.reward.trim(),stamp_expiry_days:e.stampExpiryDays,reward_expiry_days:e.rewardExpiryDays,gap_minutes:e.gapMinutes,max_per_day:e.maxPerDay,referral_on:e.referralOn,referral_giver:e.referralGiver.trim(),referral_friend:e.referralFriend.trim(),referral_monthly_cap:e.referralMonthlyCap}),y=e=>({id:String(e.id),title:e.title??'',details:e.details??'',startsOn:e.starts_on??null,endsOn:e.ends_on??null,isOn:!1!==e.is_on})},1013,[]); +__d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SHOP_DEFAULT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"PAY_PLACEHOLDER",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"STATUS_WORDS",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"cleanGiftCode",{enumerable:!0,get:function(){return o}}),e.prettyGiftCode=function(t){const n=o(t);return 16===n.length?n.match(/.{4}/g).join('-'):n},e.poundsToPence=i,e.redeemKey=function(t=Math.random){const n='abcdefghijkmnpqrstuvwxyz23456789';let r='r-';for(let o=0;o<20;o++)r+=n[Math.floor(32*t())%32];return r},Object.defineProperty(e,"expiryWords",{enumerable:!0,get:function(){return c}}),e.amountsFromText=function(t){const n=t.split(/[,\s]+/).filter(Boolean).map(i);return!n.length||n.length>6||n.some(t=>null===t||t<100)?null:[...new Set(n)].sort((t,n)=>t-n)},e.basketTotal=function(t,n){return t.reduce((t,r)=>t+(n.find(t=>t.id===r.id)?.pricePence??0)*r.qty,0)},Object.defineProperty(e,"settingsFromRow",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"settingsToRow",{enumerable:!0,get:function(){return a}});const t={giftsOn:!1,shopOn:!1,expiryMonths:24,amounts:[2500,5e3,1e4],minPence:500,maxPence:25e3,terms:''},n='Gift cards are sold through your website. You can also pay at the bar or till.',r={'waiting-payment':'Waiting for payment at the till',active:'Ready to use',used:'Used up',expired:'Expired',void:'Cancelled',paid:'Paid',ready:'Ready to collect',collected:'Collected',cancelled:'Cancelled'},o=t=>(t??'').toUpperCase().replace(/[^A-Z0-9]/g,'');function i(t){const n=(t??'').trim().replace(/^\xa3/,'');return/^\d{1,4}(\.\d{1,2})?$/.test(n)?Math.round(100*Number(n)):null}const c=t=>t%12==0?`${t/12} year${12===t?'':'s'}`:`${t} months`;const s=n=>n?{giftsOn:!!n.gifts_on,shopOn:!!n.shop_on,expiryMonths:n.expiry_months??24,amounts:n.amounts??t.amounts,minPence:n.min_pence??500,maxPence:n.max_pence??25e3,terms:n.terms??''}:{...t},a=t=>({gifts_on:t.giftsOn,shop_on:t.shopOn,expiry_months:t.expiryMonths,amounts:t.amounts,min_pence:t.minPence,max_pence:t.maxPence,terms:t.terms})},1014,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"shopPublic",{enumerable:!0,get:function(){return p}}),e.myShop=async function(t){return await(0,n.guestSession)()?(0,n.rpc)('guest_my_shop',{p_slug:t}):{cards:[],orders:[]}},e.buyGift=async function(t,o){if(!await(0,n.guestSession)())throw new Error('No connection. Try again when you are back online.');return(0,n.rpc)('guest_gift_buy',{p_slug:t,p_amount:o.amount,p_recipient:o.recipient,p_from:o.from,p_message:o.message})},e.shopOrder=async function(t,o,c){if(!await(0,n.guestSession)())throw new Error('No connection. Try again when you are back online.');return(0,n.rpc)('guest_shop_order',{p_slug:t,p_lines:o,p_name:c})},Object.defineProperty(e,"giftCheck",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"giftRedeem",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"giftActivate",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"giftIssue",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"giftHonourWix",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"giftVoid",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"giftSummary",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"shopStatus",{enumerable:!0,get:function(){return v}}),e.waitingCards=async function(){const{data:t,error:n}=await c().from('gift_cards').select('id,last4,ref,initial_pence,balance_pence,status,source,recipient_name,issued_at,expires_at').eq('venue_id',s()).order('issued_at',{ascending:!1}).limit(60);if(n)throw n;return t??[]},e.shopOrders=async function(){const{data:t,error:n}=await c().from('shop_orders').select('*').eq('venue_id',s()).order('created_at',{ascending:!1}).limit(60);if(n)throw n;return t??[]},e.readShopSettings=async function(){const{data:t,error:n}=await c().from('shop_settings').select('*').eq('venue_id',s()).maybeSingle();if(n)throw n;return(0,o.settingsFromRow)(t)},e.saveShopSettings=async function(t){const{error:n}=await c().from('shop_settings').upsert({venue_id:s(),...(0,o.settingsToRow)(t),updated_by:u(),updated_at:(new Date).toISOString()},{onConflict:'venue_id'});if(n)throw n},e.readProducts=async function(){const{data:t,error:n}=await c().from('shop_products').select('*').eq('venue_id',s()).order('sort').order('name');if(n)throw n;return t??[]},e.saveProduct=async function(t){const n={venue_id:s(),name:t.name.trim(),details:t.details.trim(),price_pence:t.pricePence,stock:t.stock,is_live:t.live,updated_by:u(),updated_at:(new Date).toISOString()},{error:o}=t.id?await c().from('shop_products').update(n).eq('id',t.id):await c().from('shop_products').insert(n);if(o)throw o},Object.defineProperty(e,"payPublic",{enumerable:!0,get:function(){return S}}),e.payStart=async function(t,o,s){if(!await(0,n.guestSession)())throw new Error('No connection. Try again when you are back online.');const u='undefined'!=typeof window?window.location.href.split('?')[0]:'',{data:p,error:_}=await c().functions.invoke('pay-checkout',{body:{slug:t,kind:o,target:s,successUrl:u,cancelUrl:u}});if(_||!p?.url)throw new Error(p?.error??'Card payment isn\u2019t available yet. Pay at the bar or till.');if(!/^https:\/\/checkout\.stripe\.com\//.test(p.url))throw new Error('Card payment isn\u2019t available yet. Pay at the bar or till.');return p},Object.defineProperty(e,"payStatus",{enumerable:!0,get:function(){return P}}),e.readPaySettings=async function(){const{data:t,error:n}=await c().from('payment_settings').select('*').eq('venue_id',s()).maybeSingle();if(n)throw n;return{provider:t?.provider??'none',cardOn:!!t?.card_on,account:t?.stripe_account_id??''}},Object.defineProperty(e,"savePaySettings",{enumerable:!0,get:function(){return O}}),e.recentPayments=async function(){const{data:t,error:n}=await c().from('payments').select('id,kind,amount_pence,status,provider,created_at,paid_at').eq('venue_id',s()).order('created_at',{ascending:!1}).limit(20);if(n)throw n;return t??[]};var t=r(d[0]),n=r(d[1]),o=r(d[2]);const c=()=>(0,t.getSupabase)(),s=()=>{const t=n.useSync.getState().venueId;if(!t)throw new Error('Not connected to the venue yet.');return t},u=()=>(n.useSync.getState().staffRef??'').slice(0,80)||null,p=t=>(0,n.rpc)('shop_public',{p_slug:t});const _=t=>(0,n.rpc)('staff_gift_check',{p_venue:s(),p_code:t}),f=(t,o,c,u)=>(0,n.rpc)('staff_gift_redeem',{p_venue:s(),p_code:t,p_amount:o,p_key:c,p_by:u}),y=(t,o)=>(0,n.rpc)('staff_gift_activate',{p_card:t,p_by:o}),l=(t,o,c)=>(0,n.rpc)('staff_gift_issue',{p_venue:s(),p_amount:t,p_recipient:o,p_by:c}),b=(t,o,c)=>(0,n.rpc)('staff_gift_honour_wix',{p_venue:s(),p_code:t,p_balance:o,p_by:c}),w=(t,o,c)=>(0,n.rpc)('staff_gift_void',{p_card:t,p_reason:o,p_by:c}),h=()=>(0,n.rpc)('staff_gift_summary',{p_venue:s()}),v=(t,o,c,s)=>(0,n.rpc)('staff_shop_status',{p_order:t,p_status:o,p_reason:c,p_by:s});const S=async t=>{try{return await(0,n.rpc)('pay_public',{p_slug:t})}catch{return{provider:'none',cardOn:!1,testMode:!0}}};const P=t=>(0,n.rpc)('guest_pay_status',{p_payment:t});const O=t=>(0,n.rpc)('staff_payment_settings_save',{p_venue:s(),p_provider:t.provider,p_card_on:t.cardOn,p_account:t.account,p_by:u()})},1015,[862,820,1014]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.refreshCashAccess=r,e.setStaffCashUp=async function(c,o){const f=s.useSync.getState().venueId;if(!f)return{ok:!1,error:'Not connected. Try again when the app is online.'};const u=(0,t.getSupabase)();try{const{data:t}=await u.from('staff').select('id').eq('venue_id',f).eq('external_ref',c).maybeSingle();if(!t?.id)return{ok:!1,error:'This person isn\u2019t on the shared team list yet.'};const{error:s}=await u.rpc('set_staff_cash_up',{p_staff:t.id,p_on:o});return s?{ok:!1,error:/owner or manager/i.test(s.message)?'Only an owner or manager can change this.':'Could not save. Try again.'}:(n.useCashAccess.setState(t=>({byRef:{...t.byRef,[c]:o}})),r(),{ok:!0})}catch{return{ok:!1,error:'Could not save. Try again when the app is online.'}}};var t=_r(d[0]),s=_r(d[1]),n=_r(d[2]);async function r(){const r=s.useSync.getState().venueId;if(!r||'staff'!==s.useSync.getState().kind)return;const c=(0,t.getSupabase)();try{const[{data:t},{data:s}]=await Promise.all([c.rpc('my_cash_up_access',{p_venue:r}),c.from('staff').select('external_ref, can_cash_up').eq('venue_id',r)]),o={};if(Array.isArray(s))for(const t of s)t.external_ref&&(o[t.external_ref]=!!t.can_cash_up);n.useCashAccess.setState({mine:'boolean'==typeof t?t:n.useCashAccess.getState().mine,byRef:Array.isArray(s)?o:n.useCashAccess.getState().byRef,loaded:!0})}catch{}}},1016,[862,820,995]); +__d(function(g,_r,i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"RID",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"statusKind",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"statusLabel",{enumerable:!0,get:function(){return d}}),_e.nextStatus=function(e){return'new'===e.status||'acknowledged'===e.status?{to:'preparing',label:'Start preparing'}:'preparing'===e.status?{to:'ready',label:'takeaway'===e.type?'Mark ready (notify customer)':'Mark ready'}:'ready'===e.status?'takeaway'===e.type?{to:'collected',label:'Collected'}:{to:'served',label:'Served'}:null},Object.defineProperty(_e,"LIVE",{enumerable:!0,get:function(){return a}}),_e.busyLevel=b,_e.restOfDayLevel=function(e,r){const t=e.hours.filter(r=>!e.nextHour||r.hour>=e.nextHour.hour).reduce((e,r)=>!e||r.covers>e.covers?r:e,void 0);return{level:b(t?.covers??0,r.settings.capacityPerHour),peak:t}},_e.Tile=function({label:e,value:n,sub:c,onPress:u,accent:d,children:a}){const b=(0,s.jsxs)(t.default,{style:{flexGrow:1,flexBasis:150,backgroundColor:o.colours.surface,borderRadius:14,padding:12,borderWidth:1,borderColor:d??o.colours.border,gap:2},children:[(0,s.jsx)(l.T,{size:13,weight:"medium",colour:o.colours.muted,children:e}),(0,s.jsx)(l.T,{size:24,weight:"bold",colour:d??o.colours.text,children:n}),c?(0,s.jsx)(l.T,{size:13,colour:o.colours.muted,children:c}):null,a]});return u?(0,s.jsx)(r.default,{accessibilityRole:"button",accessibilityLabel:e,onPress:u,style:{flexGrow:1,flexBasis:150},children:b}):b},_e.SectionHead=function({title:e,right:r,sub:n}){return(0,s.jsxs)(t.default,{style:{gap:2,marginTop:6},children:[(0,s.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,s.jsx)(l.T,{weight:"semibold",size:o.font.large,colour:o.colours.gold,children:e}),r]}),n?(0,s.jsx)(l.Muted,{children:n}):null]})},_e.AlertBox=function({colour:e,title:r,children:n}){return(0,s.jsxs)(t.default,{style:{backgroundColor:o.colours.surface2,borderRadius:12,padding:10,borderLeftWidth:6,borderLeftColor:e,gap:6},children:[(0,s.jsx)(l.T,{weight:"bold",colour:e,children:r}),n]})},_e.Bars=function({data:e,max:r,highlight:n,height:c=110}){return(0,s.jsx)(l.Row,{gap:4,style:{alignItems:'flex-end'},children:e.map(e=>{const u=e.key===n,d=e.a+(e.b??0);return(0,s.jsxs)(t.default,{style:{alignItems:'center',flex:1,minWidth:26},children:[(0,s.jsx)(l.T,{size:11,colour:u?o.colours.gold:o.colours.muted,children:e.note??String(d)}),(0,s.jsxs)(t.default,{style:{height:c,width:'70%',justifyContent:'flex-end',borderBottomWidth:1,borderColor:o.colours.border},children:[e.b?(0,s.jsx)(t.default,{style:{height:Math.max(0,e.b/r*c),backgroundColor:u?o.colours.goldLight:'#6B5A3A'}}):null,(0,s.jsx)(t.default,{style:{height:Math.max(d?2:0,e.a/r*c),backgroundColor:u?o.colours.gold:'#9C7C45'}})]}),(0,s.jsx)(l.T,{size:11,colour:u?o.colours.gold:o.colours.muted,children:e.label})]},e.key)})})},Object.defineProperty(_e,"DemoTag",{enumerable:!0,get:function(){return f}}),_r(_d[0]);var r=e(_r(_d[1])),t=e(_r(_d[2])),l=_r(_d[3]),o=_r(_d[4]),n=_r(_d[5]),s=_r(_d[6]);const c=n.VENUE_RID,u=e=>'new'===e?'red':'ready'===e?'ok':'preparing'===e||'acknowledged'===e?'amber':'served'===e||'collected'===e?'blue':'neutral',d=e=>({new:'New',acknowledged:'Accepted',preparing:'Preparing',ready:'Ready',collected:'Collected',served:'Served',closed:'Closed',cancelled:'Cancelled'}[e.status]);const a=e=>!['collected','served','closed','cancelled'].includes(e.status);function b(e,r){const t=r?e/r:0;return t<.35?{label:'Quiet',colour:o.colours.ok,pct:t}:t<.6?{label:'Steady',colour:o.colours.blue,pct:t}:t<.85?{label:'Busy',colour:o.colours.amber,pct:t}:{label:'Very busy',colour:o.colours.red,pct:t}}const f=({label:e="DEMO"})=>(0,s.jsx)(l.Badge,{kind:"amber",label:e})},1017,[30,263,127,813,821,5,24]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.WhatsAppGuest=function({b:p,rid:o,kind:u="change"}){const c=(0,n.useRestaurant)(o);if(!c?.settings?.whatsapp||!(0,s.waNumber)(c.settings.whatsapp)||p.walkIn||!(0,s.waNumber)(p.phone))return null;const l=c.location?.split(',')[1]?.trim(),f=(0,s.staffWhatsAppTexts)({name:p.name,ref:p.ref,date:p.date,time:p.time,partySize:p.partySize},c.name,l&&!/fictional/i.test(l)?l:void 0),h='auto'===u?['confirmed','pending'].includes(p.status)?'confirm':'change':u,b=(0,s.waMeLink)(p.phone,'confirm'===h?f.confirm:f.change);return b?(0,r.jsx)(t.Button,{small:!0,kind:"secondary",label:"\ud83d\udcac WhatsApp guest",testID:`wa-guest-${p.ref}`,accessibilityLabel:`WhatsApp ${p.name}`,onPress:()=>{(0,s.openWhatsApp)(b)}}):null},_r(d[0]);var t=_r(d[1]),n=_r(d[2]),s=_r(d[3]),r=_r(d[4])},1018,[30,813,819,822,24]); +__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.requestChallenge=async function(t,s){const{data:u,error:o}=await n().rpc('venue_request_challenge',{p_slug:(0,e.queuedDatabaseSlug)(t),p_kind:s});if(o)throw o;return u},_e.sendVenueRequest=async function(t,s,u,o,c,l){const{data:_,error:p}=await n().rpc('submit_venue_request',{p_slug:(0,e.queuedDatabaseSlug)(t),p_kind:s,p_payload:u,p_challenge:o,p_answer:c,p_website:l});if(p)throw p;return _},_e.listVenueRequests=async function(e,t){const{data:s,error:u}=await n().from('venue_booking_requests').select('*').eq('venue_id',e).eq('kind',t).order('status',{ascending:!1}).order('created_at',{ascending:!1}).limit(100);if(u)throw u;return s||[]},_e.decideVenueRequest=async function(e,t){const{data:s,error:u}=await n().rpc('decide_venue_request',{p_id:e,p_decision:t});if(u)throw u;return s},Object.defineProperty(_e,"requestMessage",{enumerable:!0,get:function(){return s}});var e=r(d[0]),t=r(d[1]);const n=()=>(0,t.getSupabase)();const s=e=>{const t=String(e?.message||'');return/^(Requests are not enabled|Too many|Please complete|Enter your|Choose |This request|Only this venue)/.test(t)?t:'Unable to send or load requests. Check your connection and try again, or call the hotel.'}},1019,[6,862]); +__d(function(_g,_r,i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useStore",{enumerable:!0,get:function(){return n.useStore}}),_e.useNow=function(e=1e4){const r=(0,n.useStore)(e=>e.clock),[,u]=(0,t.useState)(0);return(0,t.useEffect)(()=>{const t=setInterval(()=>u(e=>e+1),e);return()=>clearInterval(t)},[e]),(0,n.nowFrom)(r)},Object.defineProperty(_e,"useRestaurant",{enumerable:!0,get:function(){return a}}),_e.useRecipeCards=c,_e.useAllMenu=f,_e.useMenu=function(e){const r=f(e);return(0,t.useMemo)(()=>r.filter(e=>!e.hidden),[r])},Object.defineProperty(_e,"useCustomer",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"useBasket",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"useOrders",{enumerable:!0,get:function(){return m}}),Object.defineProperty(_e,"useOrderAtTable",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"useOrder",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"useBookings",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"useWaitlist",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"useEvents",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"useStampCard",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"useGiftCards",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"useRatings",{enumerable:!0,get:function(){return M}}),Object.defineProperty(_e,"useAudit",{enumerable:!0,get:function(){return v}});var e=_r(_d[0]),t=_r(_d[1]),r=_r(_d[2]),n=_r(_d[3]),u=_r(_d[4]),s=_r(_d[5]),o=_r(_d[6]);_r(_d[7]);const a=e=>(0,n.useStore)(t=>t.restaurants.find(t=>t.id===e)),l=e=>(0,o.recipeCards)().subscribe(e),d=[];function c(e){return(0,t.useSyncExternalStore)(l,()=>e?(0,o.recipeCards)().list(e):d,()=>e?(0,o.recipeCards)().list(e):d)}function f(e){const u=(0,n.useStore)((0,r.useShallow)(t=>t.menu.filter(t=>t.restaurantId===e))),o=c(e);return(0,t.useMemo)(()=>(0,s.resolveMenu)(u),[u,o])}const b=()=>(0,n.useStore)(e=>e.customer),S=()=>(0,n.useStore)(e=>e.basket),g=(e,t)=>'table'!==t.type||(0,u.orderAtTableOn)(e.restaurants.find(e=>e.id===t.restaurantId)),m=e=>(0,n.useStore)((0,r.useShallow)(t=>t.orders.filter(r=>(!e||r.restaurantId===e)&&g(t,r)))),p=e=>(0,n.useStore)(t=>(0,u.orderAtTableOn)(t.restaurants.find(t=>t.id===e))),O=e=>(0,n.useStore)(t=>t.orders.find(t=>t.id===e)),y=e=>(0,n.useStore)((0,r.useShallow)(t=>e?t.bookings.filter(t=>t.restaurantId===e):t.bookings)),w=e=>(0,n.useStore)((0,r.useShallow)(t=>t.waitlist.filter(t=>t.restaurantId===e))),I=[],j=u=>{const s=(0,n.useStore)((0,r.useShallow)(e=>e.events.filter(e=>null===e.restaurantId||e.restaurantId===u))),o=(0,n.useStore)(e=>e.restaurants.find(e=>e.id===u)),a=o?(0,e.regularEventsOf)(o):I,l=(new Date).toISOString().slice(0,7);return(0,t.useMemo)(()=>{if(!u||!a.length)return s;const t=new Date,r=new Date(t.getFullYear(),t.getMonth()-2,1),n=new Date(t.getFullYear()+1,t.getMonth()+1,0),o=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`;return[...s,...(0,e.expandEvents)(u,a,o(r),o(n))]},[s,a,u,l])},P=e=>(0,n.useStore)(t=>t.stampCards.find(r=>r.restaurantId===e&&r.customerId===t.customer.id)),h=e=>(0,n.useStore)((0,r.useShallow)(t=>t.giftCards.filter(r=>(!e||r.restaurantId===e)&&r.ownerId===t.customer.id))),M=e=>(0,n.useStore)((0,r.useShallow)(t=>t.ratings.filter(t=>t.restaurantId===e))),v=e=>(0,n.useStore)((0,r.useShallow)(t=>t.audit.filter(t=>t.restaurantId===e)))},1020,[809,30,871,870,1239,1113,831,1093]); +__d(function(g,r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"METHOD_LABEL",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"DAY3",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"DAYS",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"wd",{enumerable:!0,get:function(){return i}}),e.dayRange=function(t){const n=[...new Set(t)].sort((t,n)=>t-n);if(!n.length)return'';if(7===n.length)return'every day';return n.every((t,o)=>o===0||t===n[o-1]+1)&&n.length>=3?`${o[n[0]]} to ${o[n[n.length-1]]}`:n.map(t=>o[t]).join(', ')},e.nextDelivery=a,Object.defineProperty(e,"niceDay",{enumerable:!0,get:function(){return d}}),e.remindersFor=function(t,n,o={}){const d=i(n);return t.filter(t=>t.orderDays.includes(d)).flatMap(t=>{if(o[t.id]&&new Date(o[t.id]).toDateString()===n.toDateString())return[];let d=!1;if(/^\d\d:\d\d$/.test(t.cutoff)){const[o,s]=t.cutoff.split(':').map(Number),i=new Date(n);i.setHours(o,s,0,0),d=n>i}const l=a(t,n),c=t.reminder||`Order ${t.name} today${l?` for ${s[i(l)]}`:''}`;return[{supplierId:t.id,name:t.name,text:`${c}${t.cutoff?d?` (cut-off ${t.cutoff} passed)`:` by ${t.cutoff}`:''}`,tone:d?'red':'amber',cutoffPassed:d}]})},e.orderLines=function(n,o,s,i=""){const a=n.items.filter(t=>(o[t.id]??0)>0).map(n=>`${(0,t.fishInStone)(i,n)?(0,t.fishQtyText)(i,n,o[n.id]):`${l(o[n.id])} ${n.unit}`} ${n.name}`.replace(/\s+/g,' ').trim());return s.split('\n').map(t=>t.trim()).filter(Boolean).forEach(t=>a.push(t)),a},e.orderMessage=function(t,n,o,s,i,l){const c=a(t,l);return[`Hi ${t.contact||t.name.split(' (')[0]}, order from ${n}${o?`, ${o}`:''}${c?` for ${d(c)}`:''}:`,...s.map(t=>`- ${t}`),'',`Thanks, ${i}`].join('\n')},e.intlDigits=c,Object.defineProperty(e,"smsLink",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"waLink",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"telLink",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"sid",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"ANCHORAGE_SHEETS",{enumerable:!0,get:function(){return k}});var t=r(_d[0]);const n={online:'Online',phone:'Phone',text:'Text message',whatsapp:'WhatsApp',tbc:'To be decided'},o=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],s=['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'],i=t=>(t.getDay()+6)%7;function a(t,n){const o=null!=t.deliversOn?[t.deliversOn]:t.deliveryDays;if(!o.length)return null;for(let t=1;t<=7;t++){const s=new Date(n);if(s.setDate(s.getDate()+t),o.includes(i(s)))return s}return null}const d=t=>t.toLocaleDateString('en-GB',{weekday:'long',day:'numeric',month:'long'});const l=t=>Number.isInteger(t)?String(t):t.toFixed(1).replace(/\.0$/,'');function c(t){const n=t.replace(/[^\d+]/g,'').replace(/^\+/,'');return n.startsWith('00')?n.slice(2):n.startsWith('0')?`44${n.slice(1)}`:n}const u=(t,n)=>`sms:${t.replace(/[^\d+]/g,'')}?&body=${encodeURIComponent(n)}`,m=(t,n)=>`https://wa.me/${c(t)}?text=${encodeURIComponent(n)}`,f=t=>`tel:${t.replace(/[^\d+]/g,'')}`;let p=0;const h=(t="os")=>`${t}-${Date.now().toString(36)}${(p++).toString(36)}`,y=(t,n,o)=>({id:t,name:n,unit:o}),b=t=>({number:'',url:'',deliveryDays:[],orderDays:[],cutoff:'',frequency:'',reminder:'',priceCapPerKg:0,seller:'',items:[],notes:'',...t}),k=[b({id:'os-reids',name:'Reids',goods:'Dry goods and frozen',method:'online',urlLabel:'Open Coldweb',deliveryDays:[0,1,2,3,4],frequency:'Order on Coldweb',items:[y('rd-chips','Frozen chips','boxes'),y('rd-oil','Fryer oil','tubs'),y('rd-flour','Flour','bags'),y('rd-rice','Rice','bags'),y('rd-peas','Frozen peas','bags')],notes:'Order on their Coldweb ordering site. Add the Coldweb link in Managers \u203a Settings \u203a Supplier order sheets, or here.'}),b({id:'os-veg',name:'Veg',goods:'Fruit and veg (supplier to be added)',method:'tbc',placeholder:!0,frequency:'To be added by Gordon',notes:'Placeholder: Gordon will add the veg supplier, how to order and delivery days.'}),b({id:'os-peroni',name:'J. Pieroni & Sons',goods:'Seafood (fish merchant, Ayr)',method:'phone',url:'https://pieronis.com',urlLabel:'Open pieronis.com',deliveryDays:[0,1,2,3,4,5],frequency:'Phone order',items:[y('pa-haddock','Haddock fillets','kg'),y('pa-mussels','Mussels','kg'),y('pa-scallops','Scallops','kg'),y('pa-salmon','Salmon','kg')],notes:'Phone order. Press Call, then read the order from the screen.'}),b({id:'os-spesbona',name:'Spes Bona',goods:'Langoustines and smoked haddock',method:'text',orderDays:[2],deliversOn:4,deliveryDays:[4],frequency:'Text on Wednesday for Friday',reminder:'Text Spes Bona today for Friday\u2019s langoustines and smoked haddock',items:[y('sb-langs','Langoustines','kg'),y('sb-smoked','Smoked haddock','kg')]}),b({id:'os-tarelgin',name:'Tarelgin',goods:'Butcher',method:'text',frequency:'Text order',items:[y('tg-steak','Ribeye steaks',''),y('tg-mince','Steak mince','kg'),y('tg-chicken','Chicken breasts',''),y('tg-sausage','Sausages','kg')]}),b({id:'os-mills',name:'Mills',goods:'Milk',method:'whatsapp',frequency:'WhatsApp message',items:[y('ml-milk','Milk','litres'),y('ml-cream','Double cream','litres'),y('ml-butter','Butter','kg')]}),b({id:'os-kittyfisher',name:'Kittyfisher boat (Big Sean)',goods:'Lobsters and crabs',method:'text',contact:'Sean',frequency:'Whenever stock is low',shellfish:!0,items:[y('kf-lobster','Lobsters',''),y('kf-crab','Crabs','')],notes:'Text Big Sean whenever the lobster or crab count runs low.'}),b({id:'os-lionsmane',name:'Lion\u2019s mane mushroom',goods:'Lion\u2019s mane mushrooms',method:'online',urlLabel:'Open seller',frequency:'Weekly or fortnightly',priceCapPerKg:2500,seller:'Cheapest UK seller (to be chosen)',items:[y('lm-kg','Lion\u2019s mane mushroom','kg')],notes:'Order online from the cheapest UK seller under the price cap. Check the price per kg before you buy.'})]},1021,[1024]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.BigText=D,_e.TimeGrid=v,_e.ScopePicker=I,_e.BlockNowSheet=B,_e.DatePicker=C,_e.AddBlockSheet=P,_e.FutureBlocksList=R,_e.BlocksScreen=L,_e.DisplayBlocksScreen=W,_e.DisplayBlocksMenu=function({rid:e,r:t,now:o,by:l,onClose:n}){const[a,i]=(0,s.useState)('menu');return'now'===a?(0,y.jsx)(B,{rid:e,r:t,now:o,by:l,wide:!0,onClose:n}):'future'===a?(0,y.jsx)(P,{rid:e,r:t,now:o,by:l,wide:!0,onClose:n}):'list'===a?(0,y.jsx)(W,{rid:e,r:t,now:o,by:l,onBack:n}):(0,y.jsxs)(m.Sheet,{visible:!0,onClose:n,title:"Block bookings",maxWidth:560,testID:"display-blocks-menu",children:[(0,y.jsx)(D,{wide:!0,testID:"dbm-now",label:"Block now",sub:"Pause bookings today",onPress:()=>i('now')}),(0,y.jsx)(D,{wide:!0,testID:"dbm-future",label:"Block future",sub:"A future date, time or tables",onPress:()=>i('future')}),(0,y.jsx)(D,{wide:!0,testID:"dbm-list",label:"All blocked times",sub:"See, change or remove a block",onPress:()=>i('list')}),(0,y.jsx)(m.Muted,{children:"Tip: anyone on the Display can add, change or remove a block. Removing asks you to confirm, and every change is logged."})]})};var t=_r(_d[0]),s=_r(_d[1]),o=e(_r(_d[2])),l=e(_r(_d[3])),n=e(_r(_d[4])),a=e(_r(_d[5])),i=e(_r(_d[6])),d=_r(_d[7]),r=_r(_d[8]),c=_r(_d[9]),u=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),g=_r(_d[13]),m=_r(_d[14]),x=_r(_d[15]),p=_r(_d[16]),f=_r(_d[17]),y=_r(_d[18]);const k=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],w=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],j=e=>{try{o.default.announceForAccessibility?.(e)}catch{}};function D({label:e,sub:t,onPress:s,selected:o,disabled:l,testID:a,a11y:i,wide:d}){return(0,y.jsxs)(n.default,{testID:a,accessibilityRole:"button",accessibilityLabel:i??(t?`${e}, ${t}`:e),accessibilityState:{selected:!!o,disabled:!!l},disabled:l,onPress:s,style:({pressed:e})=>({minHeight:52,minWidth:d?void 0:84,flexGrow:d?1:0,paddingHorizontal:14,paddingVertical:8,borderRadius:14,borderWidth:1.5,borderColor:o?b.colours.gold:b.colours.border,backgroundColor:o?b.colours.gold:e?b.colours.goldTint:b.colours.surface2,opacity:l?.35:1,justifyContent:'center'}),children:[(0,y.jsx)(m.T,{size:18,weight:"semibold",colour:o?b.colours.onGold:b.colours.goldLight,center:!0,children:e}),t?(0,y.jsx)(m.T,{size:13,colour:o?b.colours.onGold:b.colours.muted,center:!0,children:t}):null]})}function v({from:e,to:t,min:o,max:l,onChange:n,testID:a="time-grid"}){const[d,r]=(0,s.useState)(e?'to':'from'),c=(0,u.quarterTimes)(o,l),g=t=>{if('from'===d||!e||(0,h.toMins)(t)<=(0,h.toMins)(e))return n(t,void 0),r('to'),void j(`From ${(0,u.rangeText)(t,t).split('\u2013')[0]}. Now pick the end time.`);n(e,t),r('from'),j(`Block ${(0,u.rangeText)(e,t)}`)};return c.length?(0,y.jsxs)(i.default,{testID:a,style:{gap:6},children:[(0,y.jsxs)(m.T,{size:15,weight:"semibold",colour:b.colours.gold,children:['from'!==d&&e?'Now tap the end time':'Tap the start time',e?` \xb7 ${(0,u.rangeText)(e,t??e)}`:'']}),(0,y.jsx)(i.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:6},children:c.map(s=>{const o=!!e&&!!t&&(0,h.toMins)(s)>=(0,h.toMins)(e)&&(0,h.toMins)(s)<=(0,h.toMins)(t);return(0,y.jsx)(D,{testID:`${a}-${s.replace(':','')}`,label:(0,u.rangeText)(s,s).split('\u2013')[0],a11y:`${'from'===d?'From':'To'} ${(0,u.rangeText)(s,s).split('\u2013')[0]}`,selected:s===e||s===t||o,onPress:()=>g(s)},s)})})]}):(0,y.jsx)(m.Muted,{children:"No times left today."})}function I({rid:e,value:o,onChange:l}){const n=(0,c.usePlan)(e),[a,d]=(0,s.useState)(!!o.tables?.length);return(0,y.jsxs)(i.default,{style:{gap:6},testID:"block-scope",children:[(0,y.jsx)(m.T,{size:15,weight:"semibold",children:"Where (optional)"}),(0,y.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,y.jsx)(m.Chip,{testID:"scope-all",label:"All areas",selected:!o.areaId&&!o.tables?.length&&!a,onPress:()=>{d(!1),l({})}}),n.areas.map(e=>(0,y.jsx)(m.Chip,{testID:`scope-area-${e.id}`,label:e.name,selected:o.areaId===e.id,onPress:()=>{d(!1),l({areaId:e.id,areaName:e.name})}},e.id)),(0,y.jsx)(m.Chip,{testID:"scope-tables",label:"Some tables",selected:a,onPress:()=>{d(!0),l({tables:o.tables??[]})}})]}),a?(0,y.jsx)(m.Row,{wrap:!0,gap:6,children:n.tables.map(e=>{const s=!!o.tables?.includes(e.name);return(0,y.jsx)(m.Chip,{testID:`scope-table-${e.name}`,label:(0,t.tableNumbers)(e.name),selected:s,onPress:()=>l({tables:s?(o.tables??[]).filter(t=>t!==e.name):[...o.tables??[],e.name]})},e.id)})}):null]})}function T({value:e,note:t,onChange:s,onNote:o}){return(0,y.jsxs)(i.default,{style:{gap:6},children:[(0,y.jsx)(m.T,{size:15,weight:"semibold",children:"Reason (optional)"}),(0,y.jsx)(m.Row,{wrap:!0,gap:6,children:r.BLOCK_REASONS.map(t=>(0,y.jsx)(m.Chip,{label:t,selected:e===t,onPress:()=>s(e===t?void 0:t)},t))}),(0,y.jsx)(m.Field,{label:"Note (optional)",value:t,onChangeText:e=>o(e.slice(0,120)),placeholder:"e.g. Christening party",testID:"block-note"})]})}function S({line:e,clashes:t,testID:o="block-confirm"}){return(0,s.useEffect)(()=>{j(`${e}. ${t?`${t} booking${1===t?' is':'s are'} already in this time and will be kept.`:''}`)},[e,t]),(0,y.jsxs)(i.default,{testID:o,accessibilityLiveRegion:"polite",style:{borderWidth:1.5,borderColor:b.colours.gold,borderRadius:14,padding:12,gap:6,backgroundColor:b.colours.goldTint},children:[(0,y.jsx)(m.T,{size:19,weight:"semibold",colour:b.colours.gold,children:e}),t?(0,y.jsx)(m.T,{size:15,colour:b.colours.amber,testID:"block-clash-warning",children:`${t} booking${1===t?' is':'s are'} already in this time. ${1===t?'It is':'They are'} kept: call the guest${1===t?'':'s'} if needed.`}):(0,y.jsx)(m.Muted,{children:"No bookings in this time yet."})]})}const $=e=>(0,u.roundUpQuarter)(60*e.getHours()+e.getMinutes())-(e.getMinutes()%15==0?0:15);function B({rid:e,r:t,now:o,by:l,onClose:n,wide:a}){const g=(0,h.ymd)(o),p=(0,c.useDisplaySettings)(e),f=(0,u.openWindow)(t,g),k=(0,u.servicesOn)(t,g,p.serviceWindows),w=Math.max(f?.from??0,$(o)),B=(0,d.useBookings)(e),C=(0,c.usePlan)(e),[P,M]=(0,s.useState)({}),[R,L]=(0,s.useState)(!1),[W,z]=(0,s.useState)({}),[N,E]=(0,s.useState)(),[A,F]=(0,s.useState)(''),[O,_]=(0,s.useState)('pick'),[G,Y]=(0,s.useState)(''),q=!!f&&we&&e.to>w?{from:(0,h.fromMins)(Math.max(e.from,w)),to:(0,h.fromMins)(e.to)}:null,U=H(k.lunch),K=H(k.dinner),Q=q?[{id:'rest',label:'Rest of today',w:{from:(0,h.fromMins)(w),to:(0,h.fromMins)(f.to)}},{id:'hour',label:'Next hour',w:{from:(0,h.fromMins)(w),to:(0,h.fromMins)(Math.min(f.to,w+60))}},{id:'lunch',label:'Lunch',w:U},{id:'dinner',label:'Dinner',w:K}]:[],V=!!P.from&&!!P.to&&(0,h.toMins)(P.to)>(0,h.toMins)(P.from)&&!(W.tables&&!W.tables.length),J=V?(0,u.confirmLine)({dates:[g],from:P.from,to:P.to,today:g,...W}):'',X=V?(0,u.bookingsInWindow)(B,[g],P.from,P.to,W,e=>C.tables.find(t=>t.name===e)?.areaId).length:0;return(0,y.jsx)(m.Sheet,{visible:!0,onClose:n,title:"Block now",maxWidth:a?760:void 0,testID:"block-now-sheet",children:'done'===O?(0,y.jsxs)(i.default,{style:{gap:10},accessibilityLiveRegion:"polite",children:[(0,y.jsx)(m.T,{size:19,weight:"semibold",colour:b.colours.gold,testID:"block-now-done",children:G}),(0,y.jsx)(m.Muted,{children:"The customer app stops offering these times. Staff see the block on the plan and the timeline."}),(0,y.jsx)(m.Button,{label:"Done",onPress:n,testID:"block-now-close"})]}):'confirm'===O?(0,y.jsxs)(i.default,{style:{gap:10},children:[(0,y.jsx)(S,{line:J,clashes:X}),(0,y.jsx)(m.Button,{testID:"block-now-save",label:"Save block",onPress:()=>{const t=r.useBlocks.getState().add({rid:e,date:g,from:P.from,to:P.to,reason:N,note:A.trim()||void 0,by:l,...W});(0,x.pushBlocksToWix)(e,[t.id],'add'),Y(`Saved. ${J.replace(/^Block/,'Blocked')}.`),j(`Saved. ${J}`),_('done')}}),(0,y.jsx)(m.Button,{kind:"ghost",label:"Change",onPress:()=>_('pick')})]}):(0,y.jsxs)(i.default,{style:{gap:12},children:[(0,y.jsx)(m.Muted,{children:"Tip: pick a time, then check the one-line summary before you save. Bookings already made are kept."}),q?(0,y.jsxs)(i.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},testID:"block-now-quick",children:[Q.map(e=>(0,y.jsx)(D,{wide:!0,testID:`block-now-${e.id}`,label:e.label,sub:e.w?(0,u.rangeText)(e.w.from,e.w.to):'Not today',disabled:!e.w,selected:!R&&P.label===e.id,onPress:()=>{L(!1),M({...e.w,label:e.id})}},e.id)),(0,y.jsx)(D,{wide:!0,testID:"block-now-custom",label:"From\u2013To",sub:"Pick the times",selected:R,onPress:()=>{L(!0),M({})}})]}):(0,y.jsx)(m.T,{colour:b.colours.amber,children:"Closed for the rest of today. Use Add a block for another day."}),q&&R?(0,y.jsx)(v,{min:w,max:f.to,from:P.from,to:P.to,onChange:(e,t)=>M({from:e,to:t}),testID:"block-now-grid"}):null,q?(0,y.jsx)(I,{rid:e,value:W,onChange:z}):null,q?(0,y.jsx)(T,{value:N,note:A,onChange:E,onNote:F}):null,V?(0,y.jsx)(m.T,{size:16,weight:"semibold",colour:b.colours.goldLight,testID:"block-now-line",children:J}):null,(0,y.jsx)(m.Button,{testID:"block-now-next",label:"Check and save",disabled:!V,onPress:()=>_('confirm')})]})})}function C({value:e,end:t,range:o,min:l,onPick:a,testID:d="block-cal"}){const[r,c]=(0,s.useState)(()=>(e??l).slice(0,7)),g=(0,h.parseYmd)(`${r}-01`),x=(g.getDay()+6)%7,p=[...Array(x).fill(null)];for(let e=new Date(g);e.getMonth()===g.getMonth();e.setDate(e.getDate()+1))p.push((0,h.ymd)(e));const f=e=>{const t=(0,h.parseYmd)(`${r}-01`);t.setMonth(t.getMonth()+e),c((0,h.ymd)(t).slice(0,7))},k=s=>{if(!o||!e||t||sf(-1)}),(0,y.jsx)(m.T,{size:18,weight:"semibold",colour:b.colours.gold,accessibilityRole:"header",children:(0,u.monthLabel)(`${r}-01`)}),(0,y.jsx)(m.Button,{small:!0,kind:"secondary",label:"Later \u203a",accessibilityLabel:"Next month",onPress:()=>f(1)})]}),(0,y.jsx)(i.default,{style:{flexDirection:'row'},children:['Mon','Tue','Wed','Thu','Fri','Sat','Sun'].map(e=>(0,y.jsx)(m.T,{size:13,colour:b.colours.muted,center:!0,style:{flex:1},children:e},e))}),(0,y.jsx)(i.default,{style:{flexDirection:'row',flexWrap:'wrap'},children:p.map((s,o)=>{if(!s)return(0,y.jsx)(i.default,{style:{width:"14.285714285714286%",height:48}},`e${o}`);const a=se&&sk(s),style:{height:46,borderRadius:10,alignItems:'center',justifyContent:'center',backgroundColor:r?b.colours.gold:b.colours.surface2,borderWidth:1,borderColor:r?b.colours.gold:b.colours.border,opacity:a?.3:1},children:(0,y.jsx)(m.T,{size:17,weight:"semibold",colour:r?b.colours.onGold:b.colours.text,children:String((0,h.parseYmd)(s).getDate())})})},s)})})]})}function P({rid:e,r:t,now:o,by:l,onClose:n,wide:a,edit:g,onEdit:p}){const f=(0,h.ymd)(o),$=(0,d.useBookings)(e),B=(0,c.usePlan)(e),[P,M]=(0,s.useState)(g?.date),[R,L]=(0,s.useState)(),[W,z]=(0,s.useState)(!1),[N,E]=(0,s.useState)(g?!!g.wholeDay:null),[A,F]=(0,s.useState)(g&&!g.wholeDay?g.from:void 0),[O,_]=(0,s.useState)(g&&!g.wholeDay?g.to:void 0),[G,Y]=(0,s.useState)(g?{areaId:g.areaId,areaName:g.areaName,tables:g.tables}:{}),[q,H]=(0,s.useState)(g?.reason),[U,K]=(0,s.useState)(g?.note??''),[Q,V]=(0,s.useState)('none'),[J,X]=(0,s.useState)([]),[Z,ee]=(0,s.useState)(),[te,se]=(0,s.useState)(!1),[oe,le]=(0,s.useState)('pick'),[ne,ae]=(0,s.useState)(''),ie=P?(0,u.openWindow)(t,P):null,de=ie?.from??540,re=ie?.to??1380,ce=P?(0,h.parseYmd)(P).getDay():0,ue='weekly'===Q?{kind:'weekly',days:J.length?J:[ce]}:'last'===Q?{kind:'last',weekday:ce}:{kind:'none'},he=P?g?[P]:(0,u.blockDates)(P,W?R:void 0,ue,Z):[],be=N?'00:00':A,ge=N?'23:59':O,me=!!P&&he.length>0&&null!=N&&!!be&&!!ge&&(0,h.toMins)(ge)>(0,h.toMins)(be)&&('none'===Q||!!Z)&&!(G.tables&&!G.tables.length),xe=(0,u.repeatText)(ue,Z),pe=me?(0,u.confirmLine)({dates:he,from:be,to:ge,wholeDay:!!N,today:f,repeat:xe,...G}):'',fe=me?(0,u.bookingsInWindow)($,he,be,ge,G,e=>B.tables.find(t=>t.name===e)?.areaId).filter(e=>e.id!==g?.id).length:0;return(0,y.jsx)(m.Sheet,{visible:!0,onClose:n,title:g?'Edit block':'Add a block',maxWidth:a?760:void 0,testID:"add-block-sheet",children:'done'===oe?(0,y.jsxs)(i.default,{style:{gap:10},accessibilityLiveRegion:"polite",children:[(0,y.jsx)(m.T,{size:19,weight:"semibold",colour:b.colours.gold,testID:"add-block-done",children:ne}),(0,y.jsx)(m.Muted,{children:"It shows in Future blocks. The customer app won't offer these times."}),(0,y.jsx)(m.Button,{label:"Done",onPress:n,testID:"add-block-close"})]}):'confirm'===oe?(0,y.jsxs)(i.default,{style:{gap:10},children:[(0,y.jsx)(S,{line:pe,clashes:fe,testID:"add-block-confirm"}),(0,y.jsx)(m.Button,{testID:"add-block-save",label:g?'Save changes':'Save block',onPress:()=>{const t={from:be,to:ge,wholeDay:!!N||void 0,reason:q,note:U.trim()||void 0,areaId:G.areaId,areaName:G.areaName,tables:G.tables?.length?G.tables:void 0};if(g)return p?.({...t,date:P}),ae(`Saved. ${pe.replace(/^Block/,'Blocked')}.`),void le('done');const s=he.length>1?`s-${Date.now().toString(36)}`:void 0,o=r.useBlocks.getState().addMany(he.map(o=>({rid:e,date:o,by:l,...t,seriesId:s,repeatText:xe??(he.length>1?`${(0,u.longDate)(he[0])} to ${(0,u.longDate)(he[he.length-1])}`:void 0),until:'none'!==Q?Z:void 0})));(0,x.pushBlocksToWix)(e,o.map(e=>e.id),'add'),ae(`Saved. ${pe.replace(/^Block/,'Blocked')}.`),j(`Saved. ${pe}`),le('done')}}),(0,y.jsx)(m.Button,{kind:"ghost",label:"Change",onPress:()=>le('pick')})]}):(0,y.jsxs)(i.default,{style:{gap:12},children:[(0,y.jsx)(m.Muted,{children:"Tip: tap a date (or a first and last date for a range), choose Whole day or the times, then check the summary."}),g?null:(0,y.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,y.jsx)(m.Chip,{testID:"add-single",label:"One date",selected:!W,onPress:()=>{z(!1),L(void 0)}}),(0,y.jsx)(m.Chip,{testID:"add-range",label:"A range of dates",selected:W,onPress:()=>{z(!0),V('none')}})]}),(0,y.jsx)(C,{value:P,end:R,range:W&&!g,min:f,onPick:(e,t)=>{M(e),L(t)}}),P?(0,y.jsx)(m.T,{size:16,weight:"semibold",colour:b.colours.goldLight,testID:"add-dates",children:W&&R?`${(0,u.longDate)(P)} to ${(0,u.longDate)(R)}`:(0,u.longDate)(P)}):null,P?(0,y.jsxs)(i.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,y.jsx)(D,{wide:!0,testID:"add-whole-day",label:"Whole day",selected:!0===N,onPress:()=>E(!0)}),(0,y.jsx)(D,{wide:!0,testID:"add-times",label:"From\u2013To",sub:ie?`Open ${(0,u.rangeText)((0,h.fromMins)(ie.from),(0,h.fromMins)(ie.to))}`:'Closed that day',selected:!1===N,onPress:()=>E(!1)})]}):null,P&&!1===N?(0,y.jsx)(v,{min:de,max:re,from:A,to:O,onChange:(e,t)=>{F(e),_(t)},testID:"add-grid"}):null,P?(0,y.jsx)(I,{rid:e,value:G,onChange:Y}):null,P?(0,y.jsx)(T,{value:q,note:U,onChange:H,onNote:K}):null,!P||g||W?null:(0,y.jsxs)(i.default,{style:{gap:6},testID:"add-repeat",children:[(0,y.jsx)(m.T,{size:15,weight:"semibold",children:"Repeat (optional)"}),(0,y.jsxs)(m.Row,{wrap:!0,gap:6,children:[(0,y.jsx)(m.Chip,{testID:"repeat-none",label:"Does not repeat",selected:'none'===Q,onPress:()=>V('none')}),(0,y.jsx)(m.Chip,{testID:"repeat-weekly",label:"Every week",selected:'weekly'===Q,onPress:()=>{V('weekly'),J.length||X([ce])}}),(0,y.jsx)(m.Chip,{testID:"repeat-last",label:`Last ${k[ce]} of the month`,selected:'last'===Q,onPress:()=>V('last')})]}),'weekly'===Q?(0,y.jsx)(m.Row,{wrap:!0,gap:6,children:w.map((e,t)=>(0,y.jsx)(m.Chip,{testID:`repeat-day-${t}`,label:e,selected:J.includes(t),onPress:()=>X(J.includes(t)?J.filter(e=>e!==t):[...J,t])},e))}):null,'none'!==Q?(0,y.jsxs)(i.default,{style:{gap:6},children:[(0,y.jsx)(m.T,{size:15,weight:"semibold",children:"Until (needed)"}),(0,y.jsxs)(m.Row,{wrap:!0,gap:6,children:[[1,3,6,12].map(e=>{const t=(0,h.parseYmd)(P);t.setMonth(t.getMonth()+e);const s=(0,h.ymd)(t);return(0,y.jsx)(m.Chip,{testID:`until-${e}`,label:12===e?'1 year':`${e} month${e>1?'s':''}`,selected:Z===s,onPress:()=>{ee(s),se(!1)}},e)}),(0,y.jsx)(m.Chip,{testID:"until-pick",label:"Pick a date",selected:te,onPress:()=>se(!0)})]}),te?(0,y.jsx)(C,{value:Z,min:(0,u.addDays)(P,1),onPick:e=>ee(e),testID:"until-cal"}):null,Z?(0,y.jsx)(m.Muted,{children:`${xe} \xb7 ${he.length} date${1===he.length?'':'s'}`}):null]}):null]}),me?(0,y.jsx)(m.T,{size:16,weight:"semibold",colour:b.colours.goldLight,testID:"add-line",children:pe}):null,(0,y.jsx)(m.Button,{testID:"add-block-next",label:"Check and save",disabled:!me,onPress:()=>le('confirm')})]})})}function M({b:e,onEdit:t,onRemove:s}){const o=(0,u.whatText)(e);return(0,y.jsxs)(i.default,{testID:`fb-${e.id}`,style:{borderWidth:1,borderColor:b.colours.border,borderRadius:12,padding:12,gap:4,backgroundColor:b.colours.surface2},accessible:!1,children:[(0,y.jsxs)(m.T,{size:17,weight:"semibold",colour:b.colours.goldLight,children:[(0,u.longDate)(e.date)," \xb7 ",(0,u.rangeText)(e.from,e.to,e.wholeDay)]}),(0,y.jsxs)(m.T,{children:[o,e.reason?` \xb7 ${e.reason}`:'',e.note?` \xb7 ${e.note}`:'']}),e.repeatText?(0,y.jsx)(m.Muted,{children:e.repeatText}):null,(0,y.jsxs)(m.Muted,{size:13,children:["Added by ",e.by||'staff',e.editedBy?` \xb7 changed by ${e.editedBy}`:'']}),(0,y.jsxs)(m.Row,{gap:8,children:[(0,y.jsx)(m.Button,{small:!0,kind:"secondary",label:"Edit",accessibilityLabel:`Edit the block on ${(0,u.longDate)(e.date)}`,testID:`fb-edit-${e.id}`,onPress:t}),(0,y.jsx)(m.Button,{small:!0,kind:"ghost",label:"Remove",accessibilityLabel:`Remove the block on ${(0,u.longDate)(e.date)}`,testID:`fb-remove-${e.id}`,onPress:s})]})]})}function R({rid:e,r:t,now:o,by:l,display:n,wide:a}){const d=(0,r.useBlocks)(e=>e.blocks),c=(0,h.ymd)(o),g=(0,u.groupByMonth)(d,e,c,(0,h.hm)(o)),k=(0,s.useMemo)(()=>(0,u.ruleRows)(t,c),[t.id,c]),[w,D]=(0,s.useState)(null),[v,I]=(0,s.useState)(null),[T,S]=(0,s.useState)(''),$=e=>e.seriesId?d.filter(t=>t.seriesId===e.seriesId&&t.date>=c):[e],B=t=>{const s=t.length>1?`${t.length} blocks removed`:`Block on ${(0,u.longDate)(t[0].date)} removed`;if(!n)return t.forEach(e=>r.useBlocks.getState().remove(e.id,l)),(0,x.pushBlocksToWix)(e,t.map(e=>e.id),'remove'),S(`${s}. Bookings are open again for that time.`),j(s),void I(null);(async()=>{for(const e of t){if(!((0,f.isLive)()?await(0,p.displayBlockEdit)(e.id,'remove',{},l):{ok:!0}).ok)return void S('Could not remove it. Try again.');(0,f.isLive)()||r.useBlocks.getState().remove(e.id,l)}(0,x.pushBlocksToWix)(e,t.map(e=>e.id),'remove'),S(`${s}. Bookings are open again for that time.`),j(s),I(null)})()},C=(t,s)=>{if(!n)return r.useBlocks.getState().update(t.id,s,l),void(0,x.pushBlocksToWix)(e,[t.id],'edit');(async()=>{((0,f.isLive)()?await(0,p.displayBlockEdit)(t.id,'edit',s,l):{ok:!0}).ok?((0,f.isLive)()||r.useBlocks.getState().update(t.id,s,l),(0,x.pushBlocksToWix)(e,[t.id],'edit'),S(`Block on ${(0,u.longDate)(s.date??t.date)} changed.`)):S('Could not change it. Try again.')})()},R=[...new Set([...g.map(e=>e.month),...k.map(e=>(0,u.monthLabel)(e.date))])].sort((e,t)=>Date.parse(`1 ${e}`)-Date.parse(`1 ${t}`));return(0,y.jsxs)(i.default,{style:{gap:12},testID:"future-blocks",children:[T?(0,y.jsx)(i.default,{accessibilityLiveRegion:"polite",children:(0,y.jsx)(m.T,{colour:b.colours.goldLight,testID:"fb-msg",children:T})}):null,g.length?null:(0,y.jsx)(m.Muted,{testID:"fb-empty",children:"No blocks coming up. Online and staff bookings are open as normal."}),R.map(e=>{const t=g.find(t=>t.month===e)?.items??[],s=k.filter(t=>(0,u.monthLabel)(t.date)===e);return(0,y.jsxs)(i.default,{style:{gap:8},children:[(0,y.jsx)(m.T,{size:18,weight:"semibold",colour:b.colours.gold,accessibilityRole:"header",children:e}),t.map(e=>(0,y.jsx)(M,{b:e,onEdit:()=>D(e),onRemove:()=>I(e)},e.id)),s.map(e=>(0,y.jsxs)(i.default,{testID:`fb-rule-${e.date}`,style:{borderWidth:1,borderStyle:'dashed',borderColor:b.colours.border,borderRadius:12,padding:10,gap:2},children:[(0,y.jsxs)(m.T,{weight:"semibold",children:[(0,u.longDate)(e.date)," \xb7 ",e.name]}),(0,y.jsxs)(m.Muted,{children:[e.text," \xb7 regular rule, set in Settings \u203a Advanced \u203a Regular events"]})]},`${e.name}-${e.date}`))]},e)}),w?(0,y.jsx)(P,{rid:e,r:t,now:o,by:l,wide:a,edit:w,onClose:()=>D(null),onEdit:e=>C(w,e)}):null,v?(0,y.jsxs)(m.Sheet,{visible:!0,onClose:()=>I(null),title:"Remove this block?",testID:"fb-remove-confirm",children:[(0,y.jsx)(m.T,{size:17,children:`${(0,u.longDate)(v.date)}, ${(0,u.rangeText)(v.from,v.to,v.wholeDay)}, ${(0,u.whatText)(v).toLowerCase()}.`}),(0,y.jsx)(m.Muted,{children:"Bookings open again for that time. The removal is kept in the log."}),(0,y.jsx)(m.Button,{testID:"fb-remove-one",label:$(v).length>1?'Remove this date only':'Remove block',onPress:()=>B([v])}),$(v).length>1?(0,y.jsx)(m.Button,{testID:"fb-remove-series",kind:"secondary",label:`Remove all ${$(v).length} in this series`,onPress:()=>B($(v))}):null,(0,y.jsx)(m.Button,{kind:"ghost",label:"Keep it",onPress:()=>I(null)})]}):null]})}function L({rid:e,r:t,now:o,by:l,display:n,wide:a}){const[d,r]=(0,s.useState)(null);return(0,y.jsxs)(i.default,{style:{gap:12},testID:"blocks-screen",children:[(0,y.jsx)(m.Muted,{children:"Tip: Block now pauses new bookings today. Add a block closes a future date, a time, an area or some tables, once or every week. Existing bookings are always kept."}),(0,y.jsxs)(i.default,{style:{flexDirection:'row',flexWrap:'wrap',gap:8},children:[(0,y.jsx)(D,{wide:!0,testID:"blocks-now",label:"Block now",sub:"Today",onPress:()=>r('now')}),(0,y.jsx)(D,{wide:!0,testID:"blocks-add",label:"Add a block",sub:"Future dates",onPress:()=>r('add')})]}),(0,y.jsx)(m.T,{size:20,weight:"semibold",children:"Future blocks"}),(0,y.jsx)(R,{rid:e,r:t,now:o,by:l,display:n,wide:a}),'now'===d?(0,y.jsx)(B,{rid:e,r:t,now:o,by:l,wide:a,onClose:()=>r(null)}):null,'add'===d?(0,y.jsx)(P,{rid:e,r:t,now:o,by:l,wide:a,onClose:()=>r(null)}):null]})}function W({rid:e,r:t,now:s,by:o,onBack:n}){return(0,g.useBackLayer)(!0,n),(0,y.jsx)(l.default,{visible:!0,animationType:"fade",onRequestClose:n,children:(0,y.jsxs)(i.default,{style:{flex:1,backgroundColor:b.colours.bg,padding:16},testID:"display-blocks-screen",children:[(0,y.jsxs)(m.Row,{style:{justifyContent:'space-between'},children:[(0,y.jsx)(g.BackButton,{onPress:n,testID:"display-blocks-back"}),(0,y.jsx)(m.T,{size:22,weight:"semibold",colour:b.colours.gold,children:"Block bookings"}),(0,y.jsx)(i.default,{style:{width:96}})]}),(0,y.jsx)(a.default,{contentContainerStyle:{paddingBottom:40,maxWidth:900,width:'100%',alignSelf:'center'},children:(0,y.jsx)(L,{rid:e,r:t,now:s,by:o,display:!0,wide:!0})})]})})}},1022,[808,30,118,256,263,151,127,819,824,825,1394,818,821,990,813,1395,954,820,24]); +__d(function(g,_r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ANCHORAGE_ID",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"isAnchorage",{enumerable:!0,get:function(){return n}}),e.isBarFridge=r,Object.defineProperty(e,"chefCanSee",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"demoActor",{enumerable:!0,get:function(){return s}}),e.hasRealSignature=c,e.isDemoCard=function(t){return!c(t)&&(['example','sample','demo'].includes(t.origin||'')||s(t.updatedBy))},Object.defineProperty(e,"isSeedChefChat",{enumerable:!0,get:function(){return u}});const t='6349aa07-3fec-46e9-8c69-7b1b08494793',n=n=>'anchorage'===n||n===t;function r(t){if('string'==typeof t)return/\bbar[\s_-]*(?:fridge|refrigerat)|\b(?:fridge|refrigerator)[\s_-]*(?:in[\s_-]*the[\s_-]*)?bar\b|^cp-bar$/i.test(t);if(!t||'object'!=typeof t)return!1;const n=t;return!!r(['name','label','kind','unit','location','storage','storageLocation'].map(t=>n[t]).filter(t=>'string'==typeof t).join(' '))||['id','key','pointId','name','label','unit','location','storage','storageLocation','aliases'].some(t=>Array.isArray(n[t])?n[t].some(r):'string'==typeof n[t]&&r(n[t]))}const o=(t,o)=>!n(t)||!r(o),s=t=>'string'==typeof t&&/(?:\b(?:example|sample|demo)\b)/i.test(t);function c(t){return[t.signOff?.by,t.allergensConfirmed?.by].some(t=>!!t&&!s(t))}const f={'m-seed-all':'Welcome to the team chat on CoverCharge.','m-seed-kitchen':'Kitchen channel: Head Chef, kitchen team and managers.','m-seed-foh':'Front of house channel: front of house, bar and managers.','m-seed-managers':'Managers channel: owners, managers and the supervisor only.'},u=t=>'system'===t.from&&(!!f[t.id]&&f[t.id]===t.text||'m-seed-all'===t.id&&/this phone only/.test(t.text||''))},1023,[]); +__d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"KG_PER_STONE",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"HALF_STONE_KG",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"isFishName",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"fishInStone",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"halfStone",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"toStone",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"fromStone",{enumerable:!0,get:function(){return c}}),e.stoneText=b,e.stoneSpeech=h,Object.defineProperty(e,"fishQtyText",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"fishQtySpeech",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"quantityStep",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"stepQuantity",{enumerable:!0,get:function(){return v}}),Object.defineProperty(e,"inputQuantity",{enumerable:!0,get:function(){return P}}),Object.defineProperty(e,"quantityUnit",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"displayedCost",{enumerable:!0,get:function(){return k}}),e.parseStoneAmount=function(t){if('number'==typeof t)return Number.isFinite(t)?t:void 0;const n=t.toLowerCase().trim();if(/\b(?:kg|kilos?|kilograms?|grams?)\b/.test(n))return;const i=n.match(/(?:^|\s)(\d+(?:[.,]\d+)?)(\xbd)?(?:\s*(?:stone|st)\b|$)/);if(i)return Number(i[1].replace(',','.'))+(i[2]?.5:0);const o=n.match(/\b(zero|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve|thirteen|fourteen|fifteen|sixteen|seventeen|eighteen|nineteen|twenty)(?: and a half)?(?: stone| st|$)/);return o?l.indexOf(o[1])+(/and a half/.test(o[0])?.5:0):/(?:^|\s)(?:\xbd|(?:a )?half(?: a)?)(?: stone| st|$)/.test(n)?.5:void 0};var t=r(d[0]);const n=6.35029318,i=3.17514659,o=(t="")=>!/\b(?:vegan|vegetarian|banana|blossom|mushroom|sauce|stock|oil)\b|\(vg\)/i.test(t)&&/\b(?:fish|haddock|salmon|cod|hake|halibut|plaice|sole|turbot|trout|mackerel|monkfish|seabass|sea bass|seabream|sea bream|tuna|pollock|coley|whiting|sardines?|anchov(?:y|ies)|herring)\b/i.test(t),u=(n,i)=>(0,t.isAnchorage)(n)&&/^(kg|kilos?|kilograms?|st|stone)$/i.test(i.unit||'')&&o(i.name),s=t=>Math.round(2*(t+Number.EPSILON))/2,f=(t,i="kg")=>/^(st|stone)$/i.test(i)?t:t/n,c=(t,i="kg")=>/^(st|stone)$/i.test(i)?t:t*n;function b(t){const n=s(Math.abs(t)),i=Math.floor(n);return`${t<0&&n?'\u2212':''}${n%1?`${i||''}\xbd`:i} stone`}const l=['zero','one','two','three','four','five','six','seven','eight','nine','ten','eleven','twelve','thirteen','fourteen','fifteen','sixteen','seventeen','eighteen','nineteen','twenty'];function h(t){const n=s(Math.abs(t)),i=Math.floor(n);return`${t<0&&n?'minus ':''}${n%1?i?`${l[i]||i} and a half`:'half a':l[i]||i} stone`}const y=(t,n,i)=>u(t,n)?b(f(i,n.unit)):`${i} ${n.unit||''}`.trim(),p=(t,n,i)=>u(t,n)?h(f(i,n.unit)):y(t,n,i),O=(t,n)=>u(t,n)?c(.5,n.unit):'kg'===n.unit?.5:1,v=(t,n,i,o)=>u(t,n)?c(Math.max(0,s(f(i,n.unit))+.5*o),n.unit):Math.max(0,i+o*O(t,n)),P=(t,n,i)=>u(t,n)?c(s(i),n.unit):i,j=(t,n)=>u(t,n)?'stone':n.unit||'',k=(t,n,i)=>u(t,n)?i*c(1,n.unit):i},1024,[1023]); +__d(function(g,r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useShellStore",{enumerable:!0,get:function(){return _}}),Object.defineProperty(_e,"localShellfish",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"shellfish",{enumerable:!0,get:function(){return E}}),Object.defineProperty(_e,"useStockItems",{enumerable:!0,get:function(){return I}}),_e.venueCounts=w,_e.useShellfish=function(e,t,s){const a=I(e).filter(t=>'chef'!==s||(0,n.chefCanSee)(e,t)),o=_(t=>!!t.server[e]),d=_((0,l.useShallow)(t=>t.events.filter(s=>s.rid===e&&(!t.server[e]||k(s))))),u=_((0,l.useShallow)(t=>w(t,e))),c=(0,f.lastUndoable)(d),v=e=>a.find(t=>t.key===e);return{items:a,events:d,counts:u,undoable:c,synced:o,itemOf:v,isLow:e=>(0,f.isLowItem)(v(e),u[e]??0),sell:(n,a=!1)=>{const o=v(n),d=o&&(0,i.fishInStone)(e,o)?i.HALF_STONE_KG:a?.5:1;return!((u[n]??0){i>0&&E.append({rid:e,kind:n,delta:i,reason:'delivery',by:t,app:s})},recount:(n,i)=>{const a=i-(u[n]??0);a&&E.append({rid:e,kind:n,delta:a,reason:'count',by:t,app:s})},undoLast:()=>{c&&E.append({rid:e,kind:c.kind,delta:-c.delta,reason:'undo',by:t,app:s,undoes:c.id})}}};var e,t=r(_d[0]),s=r(_d[1]),n=r(_d[2]),i=r(_d[3]),a=r(_d[4]),o=r(_d[5]),d=(e=o)&&e.__esModule?e:{default:e};r(_d[6]);var u=r(_d[7]),c=r(_d[8]),l=r(_d[9]),f=r(_d[10]),v=r(_d[11]),p=r(_d[12]);const S=()=>{try{return(0,p.nowFrom)(p.useStore.getState().clock)}catch{return new Date}},h='covercharge-shellfish-v1',y='anchorage',_=(0,u.create)()((0,c.persist)(e=>({events:[],items:a.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD?{}:{[y]:f.ANCHORAGE_STOCK.map(e=>({...e}))},server:{},saveItem:(t,s)=>e(e=>{const n=e.items[t]??[];return{items:{...e.items,[t]:n.some(e=>e.key===s.key)?n.map(e=>e.key===s.key?s:e):[...n,s]}}}),removeItem:(t,s)=>e(e=>({items:{...e.items,[t]:(e.items[t]??[]).filter(e=>e.key!==s)}}))}),{name:h,storage:(0,c.createJSONStorage)(()=>d.default),version:4,partialize:e=>({events:e.events,items:e.items,server:e.server}),migrate:async e=>{t.LIVE_VENUE_BUILD&&e&&await(0,s.archiveChefCache)('tracked-stock',e);const n=e??{};return{events:(i=n.events,(i??[]).filter(e=>!e.id.startsWith('sf-seed-'))),items:n.items??(a.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD?{}:{[y]:f.ANCHORAGE_STOCK.map(e=>({...e}))}),server:n.server??{}};var i}})),b={list:e=>_.getState().events.filter(t=>t.rid===e),append:e=>{const t={...e,id:(0,v.uuid)(),at:e.at??S().toISOString()};return _.setState(e=>({events:[t,...e.events].slice(0,500)})),t},subscribe:e=>_.subscribe(e)},E=b;'undefined'!=typeof window&&window.addEventListener('storage',e=>{e.key===h&&_.persist.rehydrate()});const O=[],I=(e,t=!1)=>{const s=_(t=>t.items[e])??O;return t?s:s.filter(e=>e.active).sort((e,t)=>e.sort-t.sort)},k=e=>!e.id.startsWith('sf-');function w(e,t){const s=e.items[t]??[],n=e.server[t],i=e.events.filter(e=>e.rid===t);if(!n)return(0,f.countsOf)(i,s);const a=new Set(n.seen),o=new Date(Date.now()-2592e5).toISOString();return(0,f.countsOf)(i.filter(e=>k(e)&&!a.has(e.id)&&e.at>=o),s,n.counts)}},1025,[833,1131,1023,1024,5,1115,122,951,1116,871,1027,1032,870]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useOrderSheets",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"useSheets",{enumerable:!0,get:function(){return f}});var e,s=r(d[0]),t=r(d[1]),h=r(d[2]),n=r(d[3]),o=(e=n)&&e.__esModule?e:{default:e},c=r(d[4]),i=r(d[5]),u=r(d[6]);const p=()=>h.IS_ISOLATED_VENUE||s.LIVE_VENUE_BUILD?{}:{anchorage:u.ANCHORAGE_SHEETS.filter(e=>!e.placeholder).map(e=>({...e,items:e.items.map(e=>({...e}))}))},l=(0,c.create)()((0,i.persist)(e=>({sheets:p(),opened:{},upsert:(s,t)=>e(e=>{const h=e.sheets[s]??[];return{sheets:{...e.sheets,[s]:h.some(e=>e.id===t.id)?h.map(e=>e.id===t.id?t:e):[...h,t]}}}),patch:(s,t,h)=>e(e=>({sheets:{...e.sheets,[s]:(e.sheets[s]??[]).map(e=>e.id===t?{...e,...h}:e)}})),remove:(s,t)=>e(e=>({sheets:{...e.sheets,[s]:(e.sheets[s]??[]).filter(e=>e.id!==t)}})),markOpened:(s,t)=>e(e=>({opened:{...e.opened,[s]:t}})),reset:s=>e(e=>({sheets:{...e.sheets,[s]:'anchorage'===s&&p().anchorage||[]}}))}),{name:'covercharge-ordersheets-v1',storage:(0,i.createJSONStorage)(()=>o.default),version:3,migrate:async e=>{const h=e;return s.LIVE_VENUE_BUILD?(await(0,t.archiveChefCache)('order-sheets',h),{...h,sheets:{...h.sheets,anchorage:(h.sheets.anchorage||[]).filter(e=>!('os-veg'===e.id&&e.placeholder))}}):h}})),_=[],f=e=>l(s=>s.sheets[e])??_},1026,[833,1131,5,1115,951,1116,1021]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ANCHORAGE_STOCK",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"stockKey",{enumerable:!0,get:function(){return n}}),_e.countsOf=function(e,t=[],n={}){const s={...n};for(const e of t)s[e.key]=s[e.key]??0;for(const t of e)s[t.kind]=(s[t.kind]??0)+t.delta;const i=new Map(t.map(e=>[e.key,e]));return Object.fromEntries(Object.entries(s).map(([e,t])=>[e,o(i.get(e),t)]))},_e.lastUndoable=function(e){const t=new Set(e.filter(e=>e.undoes).map(e=>e.undoes));return e.find(e=>'undo'!==e.reason&&'count'!==e.reason&&!t.has(e.id))},Object.defineProperty(_e,"fmtCount",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"fmtStockCount",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"speakStockCount",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"isLowItem",{enumerable:!0,get:function(){return c}}),_e.describe=function(e,t){const n=(t?.name??e.kind).toLowerCase(),o=(t?.plural??`${e.kind}s`).toLowerCase(),u=t?i(e.rid,t,Math.abs(e.delta)):s(Math.abs(e.delta));return'delivery'===e.reason?`Delivery in: +${u} ${1===Math.abs(e.delta)?n:o}`:'sold-half'===e.reason?`Sold: half ${n}`:'sold'===e.reason?`Sold: ${u} ${1===Math.abs(e.delta)?n:o}`:'undo'===e.reason?`Undo (${e.delta>0?'+':'\u2212'}${u} ${n})`:`Count: ${u} ${o}`};var e=r(d[0]);const t=[{key:'lobster',name:'Lobster',plural:'Lobsters',unit:'half',lowAt:4,supplierId:'os-kittyfisher',icon:'\ud83e\udd9e',sort:1,active:!0},{key:'crab',name:'Crab',plural:'Crabs',unit:'whole',lowAt:4,supplierId:'os-kittyfisher',icon:'\ud83e\udd80',sort:2,active:!0}],n=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,'-').replace(/^-|-$/g,'').slice(0,40)||'item',o=(e,t)=>Math.max(0,'kg'===e?.unit?t:'half'===e?.unit?Math.round(2*t)/2:Math.round(t));const s=e=>{const t=Math.floor(e);return e-t>=.5?t?`${t}\xbd`:'\xbd':String(t)},i=(t,n,o)=>'kg'===n.unit?(0,e.fishQtyText)(t,n,o):s(o),u=(t,n,o)=>'kg'===n.unit?(0,e.fishQtySpeech)(t,n,o):s(o),c=(e,t)=>t<=(e?.lowAt??4)},1027,[1024]); +__d(function(g,_r,i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.gamesOn=function(){const e=m.useStore.getState().restaurants.find(e=>e.id===p.VENUE_RID);return!1!==e?.settings?.games},_e.usePlayable=v,Object.defineProperty(_e,"LENNY_GAME_URL",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"validGameUrl",{enumerable:!0,get:function(){return I}}),_e.gameBase=function(){const e=m.useStore.getState().restaurants.find(e=>e.id===p.VENUE_RID);return I(e?.settings?.gameUrl)??j},_e.BreakRoomCard=function({staffId:e,name:t,now:s}){const n=(0,m.useStore)(e=>!1!==e.restaurants.find(e=>e.id===p.VENUE_RID)?.settings?.games),[o,l]=(0,r.useState)(!1),c=v(e,s);return n?(0,k.jsxs)(u.Card,{children:[(0,k.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,k.jsx)(u.T,{weight:"semibold",children:"\ud83e\uded6 Break room"}),(0,k.jsx)(u.T,{size:13,colour:c?w.colours.ok:w.colours.muted,children:c?'Open':'Opens on your break'})]}),(0,k.jsx)(u.Muted,{children:"Lenny\u2019s Kitchen Chaos, with the team as characters and a shared leaderboard. Playable on a break or when you\u2019re not clocked in."}),(0,k.jsx)(u.Button,{testID:"break-room-open",kind:"secondary",label:"Open the Break room",onPress:()=>l(!0)}),o?(0,k.jsx)(R,{staffId:e,name:t,playable:c,onClose:()=>l(!1)}):null]}):null},Object.defineProperty(_e,"displayName",{enumerable:!0,get:function(){return S}}),_e.BreakRoom=R;var t=_r(_d[0]),r=_r(_d[1]),s=e(r),n=e(_r(_d[2]));_r(_d[3]);var o=e(_r(_d[4])),l=e(_r(_d[5])),c=_r(_d[6]),u=_r(_d[7]),d=_r(_d[8]),f=_r(_d[9]),y=_r(_d[10]),m=_r(_d[11]),p=_r(_d[12]),h=_r(_d[13]),b=_r(_d[14]),w=_r(_d[15]),k=_r(_d[16]);function v(e,t){const r=(0,f.useOwner)(e=>e.attendance);if(!e)return!0;const s=(0,f.openShiftOf)(r,e,t);return!s||(0,f.isOnBreak)(s)}const j='https://lennys-kitchen-chaos-13e285.deed.page/',I=e=>{try{const t=new URL(String(e??'').trim());return'https:'!==t.protocol||t.username||t.password?null:t.toString()}catch{return null}};function x(e){if('undefined'==typeof window)return null;const t=new URL(e);for(const e of['demo','unlock','name','staffId'])t.searchParams.delete(e);return t.searchParams.set('host','covercharge'),t.searchParams.set('hostOrigin',window.location.origin),{src:t.toString(),origin:t.origin}}const S=e=>String(e??'').replace(/\s*\(.*\)$/,'').replace(/\s+/g,' ').trim().slice(0,24).trim();function R({staffId:e,name:v,playable:R,onClose:E}){const C=(0,f.useOwner)(e=>e.staff),T=(0,d.useAvatars)(e=>e.photos),M=(0,y.useSetup)(e=>e.looks),P=(0,r.useRef)(null),[O,L]=(0,r.useState)({}),[U,N]=(0,r.useState)(!1),[_,B]=(0,r.useState)(null),D=(0,m.useStore)(e=>I(e.restaurants.find(e=>e.id===p.VENUE_RID)?.settings?.gameUrl)??j),$=(0,r.useMemo)(()=>x(D),[D]),q=$?.origin??'',A=(0,b.useSync)(e=>'staff'===e.kind?e.staffRef??null:null),z=!(!A||!e||A===e),G=z?null:A??e??null,V=S(v),[H,W]=(0,r.useState)(''),[F,K]=(0,r.useState)(null),Y=(0,r.useRef)(null),J=(0,r.useRef)(0),Q=(0,r.useRef)(null),X=(0,r.useRef)(R);X.current=R;const Z=(0,r.useMemo)(()=>C.filter(e=>e.active&&!e.name.includes('(example)')),[C]);(0,r.useEffect)(()=>{const e=setTimeout(()=>{const e={};for(const t of Z){const r=document.getElementById(`cc-av-${t.id}`)?.querySelector('svg');r&&(e[t.id]=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(r.outerHTML.includes('xmlns')?r.outerHTML:r.outerHTML.replace('clearTimeout(e)},[Z,M]);const ee=(0,r.useMemo)(()=>Z.map(e=>{const t=T[e.id]?.dataUrl??O[e.id],r={id:e.id,name:S(e.name),role:e.job||e.level||e.role};return t&&(r.avatarUrl=t),r}),[Z,T,O]),te=(0,r.useCallback)(e=>{try{q&&P.current?.contentWindow?.postMessage(e,q)}catch{}},[q]);return(0,r.useEffect)(()=>{const e=async e=>{if(!q||e.origin!==q||e.source!==P.current?.contentWindow)return;const t=e.data;if('string'!=typeof t?.type||!t.type.startsWith('lenny:'))return;if('lenny:ready'===t.type)return B('string'==typeof t.version?String(t.version).slice(0,12):null),void N(!0);const r=String(t.levelId??'').slice(0,40);if('lenny:scores:list'===t.type&&te({type:'lenny:scores:result',reqId:t.reqId,result:await(0,h.listScores)(r,Math.min(50,Number(t.limit)||10))}),'lenny:scores:submit'===t.type){const e=t.entry??{};if(!G||'string'==typeof e.staffId&&e.staffId!==G)return void te({type:'lenny:scores:result',reqId:t.reqId,result:{rank:null,entries:await(0,h.listScores)(r,10),id:null}});const s='string'==typeof e.characterId?e.characterId.slice(0,80):void 0;te({type:'lenny:scores:result',reqId:t.reqId,result:await(0,h.submitScore)(r,{score:Number(e.score)||0,stars:Number(e.stars)||0,badges:Array.isArray(e.badges)?e.badges.map(String).slice(0,30):[],stats:'object'==typeof e.stats&&e.stats?e.stats:{},characterId:s,character:'string'==typeof e.character?e.character.slice(0,60):void 0,staffId:G,name:V})})}'lenny:roundAbandoned'===t.type&&W('The last round was stopped because the player changed. No score was saved.'),'lenny:roundStart'===t.type&&W(''),'lenny:progress'===t.type&&G&&t.staffId===G&&(0,h.saveProgress)(G,t.progress),'lenny:gameComplete'===t.type&&G&&t.staffId===G&&W(!0===t.firstTime?'Game complete! Character select is now unlocked.':'Game complete again. Nice work!')};return window.addEventListener('message',e),()=>window.removeEventListener('message',e)},[te,G,V,q]),(0,r.useEffect)(()=>{N(!1),Y.current=null,Q.current=null},[$?.src]),(0,r.useEffect)(()=>{if(!U)return;const e=e=>{Q.current!==e&&(Q.current=e,te({type:'lenny:setPlayable',playable:e}))},t=z?null:`${G??''}|${V}`;if(t&&Y.current===t)return void e(R);const r=++J.current;Y.current=null,Q.current&&e(!1),t&&(0,h.loadProgress)(G).catch(()=>null).then(s=>{r===J.current&&(te({type:'lenny:setPlayer',name:V,staffId:G,...s?{progress:s}:{}}),Y.current=t,e(X.current))})},[U,z,G,V,R,te]),(0,r.useEffect)(()=>{U&&te({type:'lenny:setRoster',staff:ee})},[U,ee,te]),(0,r.useEffect)(()=>{U&&null!==F&&te({type:'lenny:setMuted',muted:F})},[U,F,te]),(0,k.jsx)(n.default,{visible:!0,animationType:"slide",onRequestClose:E,children:(0,k.jsxs)(l.default,{testID:"break-room",style:{flex:1,backgroundColor:(0,t.soutersSurface)('#000')},children:[(0,k.jsxs)(u.Row,{style:{justifyContent:'space-between',padding:10,backgroundColor:w.colours.bg},children:[(0,k.jsx)(u.T,{weight:"semibold",children:"\ud83e\uded6 Break room"}),(0,k.jsx)(l.default,{testID:R&&!z?'break-playable':'break-locked',accessibilityLabel:_?`Game version ${_}`:void 0,children:(0,k.jsx)(u.T,{size:13,colour:R?w.colours.ok:w.colours.gold,children:z?'Switching player\u2026':R?'On your break: enjoy!':'Back to work! Start a break to play.'})}),(0,k.jsxs)(u.Row,{gap:4,children:[(0,k.jsx)(o.default,{testID:"break-room-mute",accessibilityRole:"button",accessibilityLabel:F?'Turn sound and voice on':'Mute sound and voice',onPress:()=>K(!F),style:{padding:6},children:(0,k.jsx)(u.T,{weight:"semibold",colour:w.colours.gold,children:F?'Sound on':'Mute'})}),(0,k.jsx)(o.default,{testID:"break-room-close",accessibilityRole:"button",onPress:E,style:{padding:6},children:(0,k.jsx)(u.T,{weight:"semibold",colour:w.colours.gold,children:"Close"})})]})]}),H?(0,k.jsx)(l.default,{testID:"break-notice",style:{paddingHorizontal:10,paddingVertical:6,backgroundColor:w.colours.surface},children:(0,k.jsx)(u.T,{size:13,colour:w.colours.muted,children:H})}):null,$?s.default.createElement('iframe',{ref:P,src:$.src,key:$.src,title:'Lenny\u2019s Kitchen Chaos','data-testid':'break-game',allow:'autoplay; fullscreen',style:{flex:1,width:'100%',height:'100%',border:0,background:'#000'}}):(0,k.jsx)(l.default,{style:{flex:1,alignItems:'center',justifyContent:'center'},children:(0,k.jsx)(u.Muted,{children:"The Break room opens in the web app."})}),(0,k.jsx)(l.default,{style:{position:'absolute',left:-9999,top:0,width:64,height:64,opacity:0},pointerEvents:"none",children:Z.map(e=>(0,k.jsx)(l.default,{nativeID:`cc-av-${e.id}`,children:(0,k.jsx)(c.AvatarArt,{spec:null!=M[e.id]?(0,c.specFor)(`${e.id}#look${M[e.id]}`):(0,c.specFor)(e.id,e.name),size:96})},e.id))})]})})}},1028,[912,30,256,122,263,127,952,813,1200,854,1201,870,5,1333,820,821,24]); +__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"fmtH",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"fmtHDay",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"SHIFT_MIN_START",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"SHIFT_MAX_END",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"shiftTitle",{enumerable:!0,get:function(){return f}});var t=r(d[0]);const n=t=>{const n=(Math.round(60*t)%1440+1440)%1440;return`${String(Math.floor(n/60)).padStart(2,'0')}:${String(n%60).padStart(2,'0')}`},u=t=>`${n(t)}${t>=24?' (next day)':''}`,o=7,c=28,f=(n,u)=>`${n.replace(' (example)','')} \xb7 ${(0,t.niceDate)((0,t.parseYmd)(u))}`},1029,[818]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SHIFT_MANAGER_PERMS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"SHIFT_MANAGER_FEATURES",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"SHIFT_MANAGER_EXCLUDED",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"SHIFT_MANAGER_EXCLUDED_WORDS",{enumerable:!0,get:function(){return o}}),e.shiftManagerOn=function(n){return!(!n.inStaffApp||!n.managerAccess||'owner'===n.role)&&(n.live?n.perms.includes('shift.manager'):'staff'===n.app)},e.swapTargets=function(n,t){return n.filter(n=>n.active&&n.id!==t&&'owner'!==n.role)};const n=['bookings.manage','floor.manage','stock.manage','attendance.view','rota.swap','shift.manager'],t=['New, edit and cancel bookings; walk-ins; seat, move and finish tables; deposit status','Tables to clear','Block bookings and close the garden','Allergy checks','Sold out (86) and tracked stock','Who\u2019s clocked in','Approve shift swaps and cover'],s=['wages.view','wages.manage','orders.manage','staff.manage','roles.manage','venue.settings','devices.manage','rota.manage','suppliers.manage','suppliers.order','recipes.edit','recipes.signoff','outbox.view'],o='takings, wages, tips and payouts, HR, billing, venue settings and owner access'},1030,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"isLiveVenue",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"useLiveVenue",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"NOT_SET_UP",{enumerable:!0,get:function(){return f}});var t=r(d[0]),n=r(d[1]);const u=n=>!(t.PITCH||'live'!==n.mode&&'offline'!==n.mode||!n.venueId),o=()=>u(n.useSync.getState()),c=()=>(0,n.useSync)(t=>u(t)),f='Not set up yet'},1031,[2,820]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"uuid",{enumerable:!0,get:function(){return x}}),Object.defineProperty(e,"isUuid",{enumerable:!0,get:function(){return t}});const x=()=>globalThis.crypto&&'randomUUID'in globalThis.crypto?globalThis.crypto.randomUUID():'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g,x=>{const t=16*Math.random()|0;return('x'===x?t:3&t|8).toString(16)}),t=x=>'string'==typeof x&&/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(x)},1032,[]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"venueInfo",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"useVenueInfo",{enumerable:!0,get:function(){return o}});var t=_r(d[0]),n=_r(d[1]),r=_r(d[2]);const u=(t,n)=>{const r=n?.name??'Your venue',u=n?.location??'';return{rid:t,name:r,place:u,address:n?.address??[r,u].filter(Boolean).join(', '),tag:'#'+r.replace(/[^A-Za-z0-9]/g,'')}},s=s=>{const o=r.IS_ISOLATED_VENUE?r.VENUE_RID:s??n.useOwner.getState().site??r.VENUE_RID;return u(o,t.useStore.getState().restaurants.find(t=>t.id===o))},o=s=>{const o=(0,n.useOwner)(t=>t.site),c=r.IS_ISOLATED_VENUE?r.VENUE_RID:s??o??r.VENUE_RID,E=(0,t.useStore)(t=>t.restaurants.find(t=>t.id===c));return u(c,E)}},1033,[870,854,5]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.getCameraPermissionsAsync=l,_e.getMediaLibraryPermissionsAsync=y,_e.requestCameraPermissionsAsync=f,_e.requestMediaLibraryPermissionsAsync=b,Object.defineProperty(_e,"useMediaLibraryPermissions",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"useCameraPermissions",{enumerable:!0,get:function(){return w}}),_e.getPendingResultAsync=async function(){if(s.default.getPendingResultAsync)return s.default.getPendingResultAsync();return null},_e.launchCameraAsync=async function(e={}){if(!s.default.launchCameraAsync)throw new n.UnavailabilityError('ImagePicker','launchCameraAsync');const t=(0,o.mapDeprecatedOptions)(e);return await s.default.launchCameraAsync(c(t))},_e.launchImageLibraryAsync=async function(e={}){const t=(0,o.mapDeprecatedOptions)(e);if(!s.default.launchImageLibraryAsync)throw new n.UnavailabilityError('ImagePicker','launchImageLibraryAsync');t?.allowsEditing&&t.allowsMultipleSelection&&console.warn("[expo-image-picker] `allowsEditing` is not supported when `allowsMultipleSelection` is enabled and will be ignored.Disable either 'allowsEditing' or 'allowsMultipleSelection' in 'launchImageLibraryAsync' to fix this warning.");return await s.default.launchImageLibraryAsync(t)},Object.defineProperty(_e,"PermissionStatus",{enumerable:!0,get:function(){return n.PermissionStatus}});var e,n=r(d[0]),t=r(d[1]),s=(e=t)&&e.__esModule?e:{default:e},o=r(d[2]),u=r(d[3]);function c(e){const{aspect:t,quality:s,videoMaxDuration:o}=e;if(null!=t){const[e,s]=t;if(e<=0||s<=0)throw new n.CodedError('ERR_INVALID_ARGUMENT',`Invalid aspect ratio values ${e}:${s}. Provide positive numbers.`)}if(s&&(s<0||s>1))throw new n.CodedError('ERR_INVALID_ARGUMENT',`Invalid 'quality' value ${s}. Provide a value between 0 and 1.`);if(o&&o<0)throw new n.CodedError('ERR_INVALID_ARGUMENT',`Invalid 'videoMaxDuration' value ${o}. Provide a non-negative number.`);return e}async function l(){return s.default.getCameraPermissionsAsync()}async function y(e=!1){return s.default.getMediaLibraryPermissionsAsync(e)}async function f(){return s.default.requestCameraPermissionsAsync()}async function b(e=!1){return(0,s.default.requestMediaLibraryPermissionsAsync)(e)}Object.keys(u).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return u[e]}})});const P=(0,n.createPermissionHook)({getMethod:e=>y(e?.writeOnly),requestMethod:e=>b(e?.writeOnly)}),w=(0,n.createPermissionHook)({getMethod:l,requestMethod:f})},1034,[570,1281,1283,1282]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"hashOf",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"MASS_REMOVE",{enumerable:!0,get:function(){return c}}),_e.quietly=async function(e){l++;try{await e()}finally{l--;for(const e of u)e.resnapshot()}},Object.defineProperty(_e,"isQuiet",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"EntityBridge",{enumerable:!0,get:function(){return f}}),_e.venueChannel=function(e,t,n,s){let o=i().channel(`cc-live:${e}:${Math.random().toString(36).slice(2,8)}`);for(const{table:s,venueColumn:i}of t)o=o.on('postgres_changes',{event:'*',schema:'public',table:s,filter:`${i??'venue_id'}=eq.${e}`},e=>{n(s,'DELETE'===e.eventType?'delete':'upsert','DELETE'===e.eventType?e.old:e.new)});return o.subscribe(e=>s(e)),o},Object.defineProperty(_e,"onConnectivity",{enumerable:!0,get:function(){return t.onConnectivity}});var e=r(d[0]),t=r(d[1]),n=r(d[2]),s=r(d[3]);const i=()=>(0,e.getSupabase)(),o=e=>{if(null===e||'object'!=typeof e)return JSON.stringify(e)??'null';if(Array.isArray(e))return`[${e.map(o).join(',')}]`;const t=e;return`{${Object.keys(t).filter(e=>void 0!==t[e]).sort().map(e=>`${JSON.stringify(e)}:${o(t[e])}`).join(',')}}`},h=e=>{const t=o(e);let n=2166136261;for(let e=0;e>>0;return`${n.toString(36)}.${t.length}`},c=5;let l=0;const u=new Set;const p=()=>l>0;class f{known={};last=new Map;reconciled=!1;applying=!1;massOk=!1;unsub=null;constructor(e,t,n={}){this.spec=e,this.venueId=t,this.ev=n,this.kvKey=`known:${t}:${e.name}`}async start(){this.known=await n.kv.get(this.kvKey,{}),this.snapshotLocal(),u.add(this),this.unsub=this.spec.subscribe(()=>{l>0?this.snapshotLocal():!this.applying&&this.reconciled&&this.pushLocalChanges()})}stop(){this.unsub?.(),this.unsub=null,u.delete(this)}resnapshot(){this.snapshotLocal()}allowMassRemoveOnce(){this.massOk=!0}snapshotLocal(){this.last=new Map(this.spec.list().map(e=>[this.spec.key(e),h(e)]))}saveKnown(){n.kv.set(this.kvKey,this.known)}pending(e){return s.mutationQueue.hasPending(this.spec.table,this.venueId,e)}async read(){let e=i().from(this.spec.table).select('*').eq(this.spec.venueColumn??'venue_id',this.venueId);this.spec.filter&&(e=this.spec.filter(e));const{data:t,error:n}=await e.limit(2e3);if(n)throw n;const s=t??[];this.merge(s,!this.reconciled),this.reconciled=!0,this.spec.afterRead?.(s)}merge(e,t){const n=this.spec,s=new Map(n.list().map(e=>[n.key(e),e])),i=new Set,o=[],l=[],u=[],p=[];for(const t of e){const e=n.rowKey(t),c=n.fromRow(t);if(!c)continue;i.add(e),p.push(c);const l=h(c),f=s.get(e);if(!this.pending(e)){if(f){const t=h(f);if(t===l){this.known[e]=l;continue}if(this.known[e]&&t!==this.known[e]&&n.writable()&&n.syncable(f)){u.push(f);continue}}o.push(c),this.known[e]=l}}for(const[e,t]of s)i.has(e)||this.pending(e)||!n.syncable(t)||n.inWindow&&!n.inWindow(t)||(this.known[e]?l.push(e):n.writable()&&!n.supersededBy?.(t,p)&&u.push(t));const f=this.massOk;if(this.massOk=!1,l.length>c&&!f)this.ev.onSuspect?.(n.name,`read would remove ${l.length} of ${s.size}`),l.length=0,u.length=0;else for(const e of l)delete this.known[e];this.applyRemote(o,l);for(const e of u)this.write(e);this.saveKnown()}applyRemote(e,t){if(e.length||t.length){this.applying=!0;try{this.spec.apply(e,t)}finally{this.applying=!1}this.snapshotLocal(),this.ev.onActivity?.()}}remote(e,t){if(!this.reconciled)return;const n=this.spec,s=n.rowKey(t);if(this.pending(s))return;if('delete'===e){if(!this.last.has(s))return;return delete this.known[s],this.applyRemote([],[s]),this.saveKnown(),void n.onRemote?.(t,e)}const i=n.fromRow(t);if(!i)return;const o=h(i);this.known[s]=o,this.saveKnown(),this.last.get(s)!==o&&this.applyRemote([i],[]),n.onRemote?.(t,e)}pushLocalChanges(){const e=this.spec,t=new Map(e.list().map(t=>[e.key(t),t]));for(const[n,s]of t){const t=h(s);this.last.get(n)!==t&&(this.last.set(n,t),e.syncable(s)&&e.writable()&&this.known[n]!==t&&this.write(s))}const n=[...this.last.keys()].filter(e=>!t.has(e));for(const e of n)this.last.delete(e);const i=e.writable()&&!1!==e.deletes&&'insert'!==e.mode&&'update'!==e.mode?n.filter(e=>this.known[e]):[];if(e.protect&&i.length>c)return this.ev.onSuspect?.(e.name,`${i.length} items vanished at once; not deleted`),void this.saveKnown();for(const t of i)delete this.known[t],s.mutationQueue.enqueue({table:e.table,venueId:this.venueId,kind:'delete',rowKey:t,match:{...this.deleteMatch(t),venue_id:this.venueId}});this.saveKnown()}deleteMatch(e){return this.spec.matchKey?this.spec.matchKey(e):{id:e}}write(e){const t=this.spec,n=t.key(e);let i;try{i=t.toRow(e,this.venueId)}catch(e){return void this.ev.onError?.(t.name,String(e?.message??e))}if(this.known[n]=h(e),'update'===t.mode){const e=t.venueColumn??'venue_id';s.mutationQueue.enqueue({table:t.table,venueId:this.venueId,kind:'update',rowKey:n,values:i,match:{...t.matchKey?t.matchKey(n):{},[e]:this.venueId}})}else s.mutationQueue.enqueue({table:t.table,venueId:this.venueId,kind:'insert'===t.mode?'insert':'upsert',rowKey:n,values:i,conflictKey:t.conflict??'id'});this.ev.onActivity?.()}}},1091,[862,1196,1195,1094]); +__d(function(g,_r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"cashUpId",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"salesId",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"cashSettingsId",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"defaultCashSettings",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"useCashUp",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"useCashSettings",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"useTipsShow",{enumerable:!0,get:function(){return y}});var t=e(_r(d[0])),s=e(_r(d[1])),r=_r(d[2]),n=_r(d[3]),o=_r(d[4]),u=_r(d[5]),l=_r(d[6]);const c=(e,t)=>(0,o.uuidFrom)(`cashup:${e}:${t}`),p=(e,t)=>(0,o.uuidFrom)(`sales:${e}:${t}`),h=e=>(0,o.uuidFrom)(`cashup-settings:${e}`),f=e=>({id:h(e),cashFields:u.DEFAULT_CASHUP_FIELDS.map(e=>({...e})),salesFields:u.DEFAULT_SALES_FIELDS.map(e=>({...e}))}),S=e=>{const t='number'==typeof e.vals.cashTips?e.vals.cashTips:null,s='number'==typeof e.vals.cardTips?e.vals.cardTips:null;return!e.confirmedAt||null==t&&null==s?null:{rid:e.rid,date:e.date,total:Math.round(100*((t??0)+(s??0)))/100,postedAt:e.confirmedAt,postedBy:e.confirmedBy}},b=(0,r.create)()((0,n.persist)((e,t)=>({cashUps:[],sales:[],tips:[],pot:[],settings:{},show:{},seen:{},saveCashUp:t=>{const s={...t,id:c(t.rid,t.date)},r=S(s);return e(e=>({cashUps:[s,...e.cashUps.filter(e=>e.id!==s.id)],tips:r?[r,...e.tips.filter(e=>!(e.rid===r.rid&&e.date===r.date))]:e.tips})),s},saveSales:t=>{const s={...t,id:p(t.rid,t.weekStart)};return e(e=>({sales:[s,...e.sales.filter(e=>e.id!==s.id)]})),s},setFields:(t,s,r)=>e(e=>({settings:{...e.settings,[t]:{...e.settings[t]??f(t),[s]:r,updatedAt:(new Date).toISOString()}}})),resetFields:t=>e(e=>({settings:{...e.settings,[t]:{...f(t),updatedAt:(new Date).toISOString()}}})),setShow:(t,s)=>e(e=>({show:{...e.show,[t]:{...e.show[t]??{showToday:!0,showPot:!0},...s}}})),addPotEvent:t=>e(e=>({pot:[{...t,id:(0,l.uuid)(),at:(new Date).toISOString()},...e.pot]})),markSeen:(t,s)=>e(e=>({seen:{...e.seen,[t]:s}}))}),{name:'covercharge-cashup-v1',storage:(0,n.createJSONStorage)(()=>s.default),partialize:e=>({...e,cashUps:e.cashUps.map(e=>({...e,photos:e.photos.filter(e=>!e.startsWith('data:'))})),sales:e.sales.map(e=>({...e,photos:e.photos.filter(e=>!e.startsWith('data:'))}))})})),w=e=>{const s=b(t=>t.settings[e])??f(e);return t.default.useMemo(()=>({...s,cashFields:(0,u.withTakingsFields)(s.cashFields)}),[s])},y=e=>b(t=>t.show[e])??{showToday:!0,showPot:!0}},1092,[30,1115,951,1116,1103,1108,1032]); +__d(function(g,_r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useCardStore",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"photoStorageFull",{enumerable:!0,get:function(){return E}}),_e.setStoragePhotoResolver=function(e){j=e},_e.cachePhotoAs=function(e,t){if(C.getState().photos[e]===t)return;C.setState(r=>({photos:{...r.photos,[e]:t}}))},Object.defineProperty(_e,"readLocalPhoto",{enumerable:!0,get:function(){return M}}),Object.defineProperty(_e,"localRecipeCards",{enumerable:!0,get:function(){return $}}),_e.ensureCards=F;var e,t=_r(d[0]),r=_r(d[1]),n=_r(d[2]),s=_r(d[3]),o=_r(d[4]),a=_r(d[5]),c=(e=a)&&e.__esModule?e:{default:e};_r(d[6]);var u=_r(d[7]),l=_r(d[8]),f=_r(d[9]),m=_r(d[10]),h=_r(d[11]),p=_r(d[12]),S=_r(d[13]);const I='covercharge-recipecards-v1',y='covercharge-recipephotos-v1',O=()=>{try{return(0,S.nowFrom)(S.useStore.getState().clock)}catch{return new Date}},b=(0,u.create)()((0,l.persist)(()=>({cards:[],removed:[],log:[]}),{name:I,storage:(0,l.createJSONStorage)(()=>c.default),version:3,migrate:async e=>{const n=e;return t.LIVE_VENUE_BUILD?(await(0,r.archiveChefCache)('recipe-cards',n),{...n,cards:n.cards.filter(e=>!(0,s.isDemoCard)(e)),log:n.log.filter(e=>!(0,s.demoActor)(e.by))}):n}}));let w=!1;const v={getItem:e=>c.default.getItem(e),setItem:async(e,t)=>{try{await c.default.setItem(e,t),w=!1}catch{w=!0}},removeItem:e=>c.default.removeItem(e)},E=()=>w,C=(0,u.create)()((0,l.persist)(()=>({photos:{}}),{name:y,storage:(0,l.createJSONStorage)(()=>v),version:1})),_={lobster:_r(d[14]),skink:_r(d[15]),fishsupper:_r(d[16]),moules:_r(d[17]),stp:_r(d[18])};let A=0;const L=(e,t,r)=>{const n={id:`cl-${Date.now().toString(36)}${(A++).toString(36)}`,cardId:e.id,rid:e.restaurantId,at:O().toISOString(),by:t,text:r};b.setState(e=>({log:[n,...e.log].slice(0,300)}));try{S.useStore.getState().addAudit(e.restaurantId,'menu',`Recipe card: ${e.dish}: ${r} (${t})`)}catch{}},P=e=>b.setState(t=>({cards:t.cards.some(t=>t.id===e.id)?t.cards.map(t=>t.id===e.id?e:t):[...t.cards,e]}));let B=null,D=null;function U(){const e=b.getState().cards,r=t.LIVE_VENUE_BUILD?e.filter(e=>!(0,s.isDemoCard)(e)).map(e=>({...e,signOff:(0,s.demoActor)(e.signOff?.by)?null:e.signOff,allergensConfirmed:(0,s.demoActor)(e.allergensConfirmed?.by)?void 0:e.allergensConfirmed})):e;if(!D||B!==e){B=e;const t=new Map,n=new Map;for(const e of r)t.set(e.restaurantId,[...t.get(e.restaurantId)??[],e]),n.set(e.menuItemId,e);D={cards:r,byRid:t,byItem:n}}return D}const N=[];function V(e){if(!(0,f.canEditCards)(e.role))throw new Error('Only the head chef and managers can edit recipe cards.')}let j=null;const M=e=>C.getState().photos[e],$={mode:'local',list:e=>U().byRid.get(e)??N,get:e=>U().cards.find(t=>t.id===e),byMenuItem:e=>U().byItem.get(e),subscribe:e=>{const t=b.subscribe(e),r=C.subscribe(e);return()=>{t(),r()}},async create(e,t,r){V(r);const n=O().toISOString();k=!0;let s=t.menuItemId;try{s||(s=S.useStore.getState().addMenuItem({restaurantId:e,section:t.section,name:t.dish,description:t.description??'',price:t.price,dietary:[],allergens:t.allergens??{},prepMins:12,soldOut:!1,signOff:null}));const o={id:t.id??(0,f.uuid)(),restaurantId:e,menuItemId:s,dish:t.dish,section:t.section,price:t.price,photo:t.photo,ingredients:t.ingredients??[],steps:t.steps??[],allergens:t.allergens??{},dismissed:t.dismissed??[],allergenNotes:t.allergenNotes,signOff:null,wasLive:!1,origin:'new',version:1,createdAt:n,updatedAt:n,updatedBy:r.name};return b.setState(e=>({cards:[...e.cards.filter(e=>e.menuItemId!==o.menuItemId),o]})),L(o,r.name,'card created, awaiting sign-off'),o}finally{k=!1}},async update(e,t,r){V(r);const n=$.get(e);if(!n)throw new Error('Card not found');const s=(0,f.editCard)(n,t,r.name,O().toISOString());return s.changed&&(P(s.card),L(s.card,r.name,s.resetSignOff?'edited, sign-off reset to Awaiting sign-off':t.confirmAllergens&&1===Object.keys(t).length?'allergens confirmed':'edited')),s.card},async signOff(e,t){if(!(0,f.canSignOffCards)(t.role))throw new Error('Only the head chef can sign off a recipe card.');const r=$.get(e);if(!r)throw new Error('Card not found');const n=(0,f.signOffBlock)(r);if(n)throw new Error(n);const s=(0,f.signOffCard)(r,t.name,O().toISOString());return P(s),L(s,t.name,'signed off'),s},async remove(e,t){V(t);const r=$.get(e);r&&(b.setState(t=>({cards:t.cards.filter(t=>t.id!==e),removed:[...t.removed,r.menuItemId]})),S.useStore.setState(e=>({menu:e.menu.map(e=>e.id===r.menuItemId?{...e,hidden:!0}:e)})),L(r,t.name,'card removed (dish hidden from the menu)'))},async savePhoto(e,t,r){const n=`local:${t}:${Date.now().toString(36)}`;return C.setState(e=>({photos:{...Object.fromEntries(Object.entries(e.photos).filter(([e])=>!e.startsWith(`local:${t}:`))),[n]:r.dataUrl}})),n},photoSource(e){if(!e)return null;if(e.startsWith('asset:'))return _[e.slice(6)]??null;if(e.startsWith('local:')){const t=C.getState().photos[e];return t?{uri:t}:null}if(/^(https?:|data:)/.test(e))return{uri:e};const t=C.getState().photos[e];if(t)return{uri:t};const r=j?.(e);return r?{uri:r}:null}};let k=!1,R=!1;function F(){if(k)return;const e=S.useStore.getState().menu,{cards:r,removed:a}=b.getState(),c=new Set(r.map(e=>e.menuItemId)),u=e.filter(e=>!c.has(e.id)&&!a.includes(e.id));if(!u.length)return;const l=O().toISOString(),f=o.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD||!(0,n.examplesAllowed)()?[]:(0,p.exampleCards)(u),m=new Set(f.map(e=>e.menuItemId)),h=[...f,...u.filter(e=>!m.has(e.id)).map(e=>(0,p.importedCard)(t.LIVE_VENUE_BUILD&&(0,s.demoActor)(e.signOff?.by)?{...e,signOff:null}:e,l))];b.setState(e=>({cards:[...e.cards,...h]}))}(0,h.setMenuCardBridge)({cardFor:e=>U().byItem.get(e),menuItemAdded:e=>{if(k||!R)return;const t=O().toISOString(),r={...(0,p.importedCard)(e,t),id:(0,f.uuid)(),signOff:null,allergensConfirmed:void 0,wasLive:!1,origin:'new',updatedBy:'Added to the menu'};P(r),L(r,r.updatedBy,'card created from the menu, awaiting sign-off')},menuEdited:(e,t,r,n)=>{const s=U().byItem.get(e);if(!s)return;let o=(0,f.editCard)(s,t,r,O().toISOString()).card;n&&o.signOff&&(o={...o,signOff:null,version:o.version+1,updatedAt:O().toISOString(),updatedBy:r}),o!==s&&(P(o),L(o,r,s.signOff&&!o.signOff?'edited from the menu, sign-off reset':'edited from the menu'))},signOff:(e,t)=>{const r=U().byItem.get(e);r&&$.signOff(r.id,{name:t,role:'head-chef'}).catch(()=>{})}}),(0,m.setRecipeCardRepository)($);const x=e=>new Promise(t=>{e.hasHydrated()?t():e.onFinishHydration(()=>t())});Promise.all([x(S.useStore.persist),x(b.persist)]).then(()=>{R=!0,F(),S.useStore.subscribe((e,t)=>{e.menu!==t.menu&&F()})}),'undefined'!=typeof window&&window.addEventListener('storage',e=>{e.key===(0,o.venueKey)(I)&&b.persist.rehydrate(),e.key===(0,o.venueKey)(y)&&C.persist.rehydrate()})},1093,[833,1131,1118,1023,5,1115,122,951,1116,1103,831,1113,1141,870,1142,1143,1144,1145,1146]); +__d(function(g,_r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"MutationQueue",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"mutationQueue",{enumerable:!0,get:function(){return l}});var t=_r(d[0]),e=_r(d[1]),s=_r(d[2]);const r='queue:v1',n='queue:failed:v1',h=t=>`${t.table}|${t.venueId}|${t.rowKey}`;class o{items=[];failedItems=[];loaded=null;flushing=null;exec=null;listeners=new Set;onFailure=new Set;onSaved=new Set;retryTimer=null;waitTimer=null;backoffMs=2e3;now=()=>Date.now();constructor(){(0,t.onConnectivity)(t=>{t&&this.flush()})}setExecutor(t){this.exec=t}load(){return this.loaded||(this.loaded=(async()=>{const t=await e.kv.get(r,[]);this.items=[...t.map(t=>({...t,nextAt:void 0})),...this.items],this.failedItems=await e.kv.get(n,[]),this.emit()})()),this.loaded}get pending(){return this.items}get waiting(){return this.items.filter(t=>t.attempts>0)}get failed(){return this.failedItems}hasPending(t,e,s){return this.items.some(r=>r.table===t&&r.venueId===e&&r.rowKey===s)}async enqueue(t){await this.load();const s={...t,id:(0,e.uuid)(),createdAt:(new Date).toISOString(),attempts:0};return this.items.push(s),await this.persist(),this.flush(),s}nextReady(){const t=new Set,e=this.now();for(const s of this.items){const r=h(s);if(!t.has(r)){if(!(s.nextAt&&s.nextAt>e))return s;t.add(r)}}}remove(t){this.items=this.items.filter(e=>e!==t)}flush(){return this.flushing||(this.flushing=(async()=>{for(await this.load();this.exec;){const e=this.nextReady();if(!e)break;if(!(0,t.isOnline)()){this.scheduleRetry();break}try{const t=await this.exec(e);this.remove(e),this.backoffMs=2e3,'conflict'===t?this.fail(e,'conflict','Row changed on the server (version conflict) or is not visible to you'):this.onSaved.forEach(t=>t(e))}catch(r){e.attempts+=1,e.lastError=String(r?.message??r);const n=r??{};e.lastErr={code:n.code?String(n.code):void 0,status:Number(n.status)||void 0,message:e.lastError.slice(0,300)};const h=(0,s.classifyWriteError)(r);if('network'===h){e.attempts-=1,(0,t.setOnline)(!1),this.scheduleRetry(),await this.persist();break}'retry'===h?e.nextAt=this.now()+(0,s.retryDelayMs)(e.attempts):(this.remove(e),this.fail(e,'rejected',e.lastError))}await this.persist()}this.flushing=null,this.scheduleWaiting()})()),this.flushing}retryNow(){for(const t of this.items)t.nextAt=void 0;return this.flush()}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}onFailed(t){return this.onFailure.add(t),()=>{this.onFailure.delete(t)}}onDone(t){return this.onSaved.add(t),()=>{this.onSaved.delete(t)}}async clearFailed(){this.failedItems=[],await e.kv.set(n,[]),this.emit()}fail(t,s,r){const h={...t,lastError:r,failedAt:(new Date).toISOString(),reason:s};this.failedItems=[h,...this.failedItems].slice(0,100),e.kv.set(n,this.failedItems),this.onFailure.forEach(t=>t(h))}scheduleWaiting(){this.waitTimer&&(clearTimeout(this.waitTimer),this.waitTimer=null);const t=this.items.map(t=>t.nextAt??0).filter(t=>t>0);if(!t.length)return;const e=Math.max(500,Math.min(...t)-this.now());this.waitTimer=setTimeout(()=>{this.waitTimer=null,this.flush()},e)}scheduleRetry(){if(this.retryTimer)return;const e=this.backoffMs;this.backoffMs=Math.min(2*this.backoffMs,6e4),this.retryTimer=setTimeout(()=>{this.retryTimer=null,(0,t.setOnline)(!0),this.flush()},e)}async persist(){await e.kv.set(r,this.items),this.emit()}emit(){this.listeners.forEach(t=>t())}}const l=new o},1094,[1196,1195,1199]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SUPABASE_URL",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"SUPABASE_ANON_KEY",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"isSupabaseConfigured",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"REALTIME_TABLES",{enumerable:!0,get:function(){return s}});var t=r(d[0]);const n="https://rowdoidkftriylijobuy.supabase.co",o="sb_publishable_rPm723MQz6FwmFVHy6e1SA_ko-_-6GR",u=()=>!t.PITCH&&n.startsWith('https://')&&o.length>20,s=['bookings','walk_ins','blocks','table_plans','takeaway_orders','stock_counts']},1095,[2]); +__d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.pushState=f,e.turnOnPush=async function(){const u=await f();if('ios-home-screen'===u)return{ok:!1,message:'On iPhone, add this app to your Home Screen first (Share \u203a Add to Home Screen, iOS 16.4 or later), then open it from there.'};if('unsupported'===u)return{ok:!1,message:'This browser can\u2019t get phone notifications. Try Chrome on Android, or the app from your iPhone Home Screen.'};if('blocked'===u)return{ok:!1,message:'Notifications are blocked for this app. Allow them in your phone\u2019s settings, then try again.'};const c=i.useSync.getState();if('staff'!==c.kind||!c.venueId||!c.staffRef)return{ok:!1,message:'Sign in from your personal link first.'};if('granted'!==await Notification.requestPermission())return{ok:!1,message:'You didn\u2019t allow notifications, so nothing changed.'};const p=await navigator.serviceWorker.ready,h=(await p.pushManager.getSubscription()??await p.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:s(n.VAPID_PUBLIC_KEY)})).toJSON();if(!h.endpoint||!h.keys?.p256dh||!h.keys?.auth)return{ok:!1,message:'Your browser didn\u2019t give a usable subscription. Try again.'};const l=(0,t.getSupabase)(),{error:y}=await l.from('push_subscriptions').upsert({venue_id:c.venueId,staff_ref:c.staffRef,app:o.APP_VARIANT,endpoint:h.endpoint,p256dh:h.keys.p256dh,auth:h.keys.auth,user_agent:navigator.userAgent.slice(0,200)},{onConflict:'user_id,endpoint'});return y?{ok:!1,message:`Couldn\u2019t save this phone: ${y.message}`}:{ok:!0,message:'Phone notifications are on for this device.'}},e.turnOffPush=async function(){const n=await(navigator.serviceWorker?.getRegistration()),i=await(n?.pushManager.getSubscription());if(!i)return{ok:!0,message:'Phone notifications are off for this device.'};const o=i.endpoint;await i.unsubscribe();try{const n=(0,t.getSupabase)();await n.from('push_subscriptions').delete().eq('endpoint',o)}catch{}return{ok:!0,message:'Phone notifications are off for this device.'}};var n=r(d[0]),t=r(d[1]),i=r(d[2]),o=r(d[3]);const s=n=>{const t=atob(n.replace(/-/g,'+').replace(/_/g,'/')+'='.repeat((4-n.length%4)%4)),i=new Uint8Array(t.length);for(let n=0;n'undefined'!=typeof navigator&&/iPhone|iPad|iPod/.test(navigator.userAgent),c=()=>'undefined'!=typeof window&&(window.matchMedia?.('(display-mode: standalone)').matches||!0===navigator.standalone);async function f(){if('undefined'==typeof window||!('serviceWorker'in navigator))return'unsupported';if(!('PushManager'in window)||'undefined'==typeof Notification)return u()&&!c()?'ios-home-screen':'unsupported';if('denied'===Notification.permission)return'blocked';const n=await navigator.serviceWorker.getRegistration();return await(n?.pushManager.getSubscription())?'on':'off'}},1096,[1274,862,820,806]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SOON_TEXT",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"setVenueWords",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"getVenueWords",{enumerable:!0,get:function(){return u}}),e.askServer=async function(o,c,u,p){try{const l=(0,t.getSupabase)().functions.invoke(n,{body:{app:o,text:c,tools:u,...p?{receipt:p,spoken:!0,vocab:s}:{}}}),y=new Promise(t=>setTimeout(()=>t({data:null,error:new Error('timeout')}),1e4)),{data:f,error:b}=await Promise.race([l,y]);return b||!f||!0!==f.ready||f.busy?{kind:'soon'}:f.call?.name?{kind:'call',name:String(f.call.name),args:f.call.args??{}}:'string'==typeof f.text&&f.text.trim()?{kind:'text',text:f.text.trim()}:{kind:'soon'}}catch{return{kind:'soon'}}},e.transcribe=async function(n,o,c=8e3){try{const u=/mp4|m4a|aac/.test(o.type)?'m4a':/ogg/.test(o.type)?'ogg':/wav/.test(o.type)?'wav':'webm',l=new FormData;l.append('app',n),s.length&&l.append('keyterms',JSON.stringify(s)),l.append('file',o,`speech.${u}`);const y=(0,t.getSupabase)().functions.invoke(p,{body:l}),f=new Promise(t=>setTimeout(()=>t({data:null,error:new Error('timeout')}),c)),{data:b,error:k}=await Promise.race([y,f]);return k?{ok:!1,reason:'timeout'===String(k?.message)?'timeout':'offline'}:!0===b?.ok?{ok:!0,text:String(b.text??''),receipt:'string'==typeof b.receipt?b.receipt:void 0}:{ok:!1,reason:String(b?.reason??'busy'),text:'string'==typeof b?.text?b.text:void 0}}catch{return{ok:!1,reason:'offline'}}};var t=r(d[0]);const n='voice-assistant',o='Voice assistant is switching on soon. Until then I can do the everyday things, for example';let s=[];const c=t=>{s=t.slice(0,100)},u=()=>s;const p='voice-transcribe'},1097,[862]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"VOICE_ROLES",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"VOICE_ROLE_LABEL",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"useVoiceSettings",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"voiceOn",{enumerable:!0,get:function(){return f}}),_e.micExplainedFor=function(e){try{if('1'===b()?.getItem(s(e)))return!0}catch{}return u.getState().micExplained},_e.setMicExplainedFor=function(e){try{b()?.setItem(s(e),'1')}catch{}u.getState().setMicExplained(!0)};var e,n=r(d[0]),t=(e=n)&&e.__esModule?e:{default:e},c=r(d[1]),l=r(d[2]);const o=['owner','manager','staff','chef','display'],p={owner:'Owner (Managers app)',manager:'Managers (Managers app)',staff:'Staff app (full voice assistant, no money or HR)',chef:'Head Chef app',display:'Main Display'},u=(0,c.create)()((0,l.persist)(e=>({enabled:{},micExplained:!1,setEnabled:(n,t,c)=>e(e=>({enabled:{...e.enabled,[n]:{...e.enabled[n]??{},[t]:c}}})),setMicExplained:n=>e({micExplained:n})}),{name:'covercharge-voice-v1',version:4,storage:(0,l.createJSONStorage)(()=>t.default),migrate:(e,n)=>({enabled:n<2?{}:e?.enabled??{},micExplained:!!e?.micExplained}),merge:(e,n)=>({...n,enabled:e?.enabled??n.enabled,micExplained:e?.micExplained??n.micExplained}),partialize:e=>({enabled:e.enabled,micExplained:e.micExplained})})),f=(e,n,t)=>!1!==e[n]?.[t],s=e=>`cc-voice-mic-explained-${e}`,b=()=>{try{return'undefined'!=typeof window?window.localStorage:void 0}catch{return}}},1098,[1115,951,1116]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"desktopStt",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"desktopSttState",{enumerable:!0,get:function(){return u}}),_e.warmDesktopStt=function(){o()&&l()},Object.defineProperty(_e,"cleanHeard",{enumerable:!0,get:function(){return d}}),Object.defineProperty(_e,"tabletWithoutMic",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"canRecord",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"canListen",{enumerable:!0,get:function(){return w}}),_e.micPermission=b,Object.defineProperty(_e,"RATE",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"PRE_ROLL_MS",{enumerable:!0,get:function(){return M}}),Object.defineProperty(_e,"HANG_MS",{enumerable:!0,get:function(){return A}}),_e.releaseMic=O,Object.defineProperty(_e,"echoWanted",{enumerable:!0,get:function(){return R}}),Object.defineProperty(_e,"micConstraints",{enumerable:!0,get:function(){return j}}),_e.warmMic=async function(){try{if(o()||!y())return;if(!S&&'granted'!==await b())return;if(await D(),C){C.armedUntil=Date.now()+1500;try{C.ctx.resume?.()}catch{}}x()}catch{}},_e.disarmMic=function(){C&&!C.rec&&(C.armedUntil=0,C.ring=[],C.ringLen=0)},_e.askMic=async function(){try{return await D(),x(),!0}catch{return!1}},_e.wavOf=L,Object.defineProperty(_e,"MAX_CLIP_MS",{enumerable:!0,get:function(){return _}}),_e.listen=B,Object.defineProperty(_e,"CloudRecognition",{enumerable:!0,get:function(){return I}}),Object.defineProperty(_e,"speechRecognizer",{enumerable:!0,get:function(){return N}}),_e.levelMeter=async function(e){const t=n()?.navigator?.mediaDevices,r=n()?.AudioContext||n()?.webkitAudioContext;if(!t?.getUserMedia||!r)return()=>{};let o,i,a=0,c=!1;try{if(o=await t.getUserMedia({audio:!0}),c)return o.getTracks().forEach(e=>e.stop()),()=>{};i=new r;const s=i.createMediaStreamSource(o),u=i.createAnalyser();u.fftSize=512,s.connect(u);const l=new Uint8Array(u.fftSize),d=()=>{u.getByteTimeDomainData(l);let t=0;for(let e=0;e{}}return()=>{c=!0;try{n().cancelAnimationFrame(a)}catch{}try{o?.getTracks().forEach(e=>e.stop())}catch{}try{i?.close()}catch{}}},_e.yesNo=function(e){const t=e.toLowerCase().trim().replace(/[.!,]/g,'');return/^(yes|yeah|yep|yup|aye|confirm|confirmed|do it|go ahead|correct|that's right|ok|okay|yes please)\b/.test(t)?'yes':/^(no|nope|cancel|stop|don't|do not|wrong|never mind)\b/.test(t)?'no':null},Object.defineProperty(_e,"buzz",{enumerable:!0,get:function(){return W}});var e=_r(_d[0]),t=_r(_d[1]);const n=()=>'undefined'==typeof window?void 0:window,r=()=>n()?.ccDesktop,o=()=>!!r()?.stt&&!!r()?.sttWorker;let i=null,a=0;const c=new Map;let s='cold';const u=()=>s;function l(){if(i)return i;const e=n()?.Worker,t=r()?.sttWorker;return e&&t?(i=new e(t,{type:'module'}),s='loading',i.onmessage=e=>{const t=e.data??{};if(t.ready)return void(s='ready');t.failed&&(s='failed');const n=c.get(t.id);n&&(c.delete(t.id),n(t))},i.onerror=()=>{s='failed',c.forEach(e=>e({error:'stt-failed'})),c.clear()},i.postMessage({warm:!0}),i):null}const d=e=>e.replace(/\[[^\]]*\]|\([^)]*\)/g,' ').replace(/\s+/g,' ').trim();function f(e,t){let o,i,s,u,f=!1,p=!1;const y=[];let w=16e3;const b=()=>{try{s?.disconnect(),u?.disconnect()}catch{}try{o?.getTracks().forEach(e=>e.stop())}catch{}try{i?.close()}catch{}if(p)return;const n=y.reduce((e,t)=>e+t.length,0);if(n<.35*w)return void t('');const r=new Float32Array(n);let f=0;for(const e of y)r.set(e,f),f+=e.length;const b=16e3===w?r:h(r,w,16e3),v=l();if(!v)return void t('','stt-failed');e('Turning speech into text on this Mac\u2026');const M=++a;c.set(M,e=>t(d(e.text??''),e.error)),v.postMessage({id:M,audio:b},[b.buffer])};return(async()=>{try{if(r()?.askMic){if(!await r().askMic())return void t('','not-allowed')}if(o=await n().navigator.mediaDevices.getUserMedia({audio:{channelCount:1,echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0}}),f)return void b();const e=n().AudioContext||n().webkitAudioContext;try{i=new e({sampleRate:16e3})}catch{i=new e}w=i.sampleRate,u=i.createMediaStreamSource(o),s=i.createScriptProcessor(4096,1,1),s.onaudioprocess=e=>{f||y.push(new Float32Array(e.inputBuffer.getChannelData(0)))},u.connect(s),s.connect(i.destination),l()}catch(e){t('','NotAllowedError'===e?.name?'not-allowed':'audio-capture')}})(),{stop:()=>{f||(f=!0,b())},abort:()=>{p=!0,f=!0,b()}}}function h(e,t,n){const r=Math.round(e.length*n/t),o=new Float32Array(r),i=t/n;for(let t=0;t{const e=String(n()?.navigator?.userAgent??'');return/CoverChargeTablet\//.test(e)&&!/CoverChargeTablet\/[\d.]+ mic/.test(e)},y=()=>!p()&&!(!n()?.MediaRecorder||!n()?.navigator?.mediaDevices?.getUserMedia),w=()=>o()||y();async function b(){try{const e=n()?.navigator?.permissions?.query;if(!e)return'unknown';const t=await Promise.race([n().navigator.permissions.query({name:'microphone'}),new Promise(e=>setTimeout(()=>e(null),1500))]);return'granted'===t?.state||'denied'===t?.state||'prompt'===t?.state?t.state:'unknown'}catch{return'unknown'}}const v=16e3,M=500,A=450;let P,S=null,T=!1,k=!1,C=null;function U(){const e=C;if(C=null,e){try{e.node.disconnect(),e.src.disconnect()}catch{}try{e.ctx.close()}catch{}e.ring=[],e.rec=null}}function O(){clearTimeout(P),U();try{S?.getTracks().forEach(e=>e.stop())}catch{}S=null}const x=()=>{clearTimeout(P),P=setTimeout(O,/iPhone|iPad|iPod|Macintosh/.test(String(n()?.navigator?.userAgent??''))&&!r()?.mac?6e5:6e4)},R=()=>!1,j=(e=R())=>({audio:{channelCount:{ideal:1},sampleRate:{ideal:v},sampleSize:{ideal:16},echoCancellation:e,noiseSuppression:!0,autoGainControl:!0}});async function D(){clearTimeout(P);const e=R();if(S&&T===e&&S.getAudioTracks().some(e=>'live'===e.readyState))return S;if(S&&O(),S=await n().navigator.mediaDevices.getUserMedia(j(e)),T=e,!k){k=!0;try{n().document.addEventListener('visibilitychange',()=>{'hidden'===n().document.visibilityState&&O()})}catch{}}return E(S),S}function E(e){U();try{const t=n().AudioContext||n().webkitAudioContext;if(!t)return;let r;try{r=new t({sampleRate:v})}catch{r=new t}const o=r.createMediaStreamSource(e),i=r.createScriptProcessor(2048,1,1),a={ctx:r,node:i,src:o,rate:r.sampleRate,ring:[],ringLen:0,rec:null,frames:0,armedUntil:0,level:()=>{}},c=Math.round(.5*a.rate);i.onaudioprocess=e=>{const t=new Float32Array(e.inputBuffer.getChannelData(0));if(a.frames+=t.length,a.rec&&a.rec.push(t),!a.rec&&Date.now()>a.armedUntil)return a.ring=[],void(a.ringLen=0);for(a.ring.push(t),a.ringLen+=t.length;a.ring.length>1&&a.ringLen-a.ring[0].length>=c;)a.ringLen-=a.ring[0].length,a.ring.shift();let n=0;for(let e=0;ee+t.length,0),r=new Float32Array(n);let o=0;for(const t of e)r.set(t,o),o+=t.length;const i=t===v?r:h(r,t,v),a=new ArrayBuffer(44+2*i.length),c=new DataView(a),s=(e,t)=>{for(let n=0;n{clearTimeout(c),clearTimeout(s),S&&(S.rec=null,S.level=()=>{}),x()},k=(e,t,n)=>{h||f||(h=!0,o(e,t,n))};let U=!1;const O=async()=>{if(U)return;U=!0;const n=b,o=S?S.frames-P:0;if(T(),f)return;const i=Date.now()-y,a=!!n&&n.length>0&&o/M*1e3>.6*i?L(n,M):new Blob(w,{type:(p?.mimeType||w[0]?.type||'audio/webm').split(';')[0]});if(i<350||a.size<500)return void k('');r('Turning speech into text\u2026');const c=await(0,e.transcribe)(t,a);c.ok?k(c.text.trim(),void 0,{receipt:c.receipt}):k('',c.reason,{message:c.text})};(async()=>{try{const e=await D();if(d)return T(),void k('');if(S=C,S){try{S.ctx.resume?.()}catch{}b=[...S.ring],M=S.rate,P=S.frames-S.ringLen,S.rec=b,S.level=e=>{i?.(e),a&&!d&&(e>.12?(u=!0,l=0):u&&e<.05&&(l=l||Date.now(),Date.now()-l>1500&&j()))}}const t=F();p=new(n().MediaRecorder)(e,t?{mimeType:t,audioBitsPerSecond:48e3}:void 0),p.ondataavailable=e=>{e.data?.size&&w.push(e.data)},p.onstop=()=>{O()},p.onerror=()=>{b?.length?O():(T(),k('','audio-capture'))},p.start(),y=Date.now(),c=setTimeout(()=>{r('That\u2019s the 30-second limit. Sending now\u2026'),R()},_)}catch(e){T(),k('','NotAllowedError'===e?.name||'SecurityError'===e?.name?'not-allowed':'audio-capture')}})();const R=()=>{try{p&&'inactive'!==p.state?p.stop():O()}catch{O()}},j=()=>{d||(d=!0,p&&(s=setTimeout(R,a?0:A)))};return{stop:j,abort:()=>{f=!0,d=!0,clearTimeout(s);try{p&&'inactive'!==p.state&&p.stop()}catch{}T()}}}function B(e,t,n="owner",r,i=!1){return o()?f(e,t):y()?z(n,e,t,r,i):null}class I{lang='en-GB';interimResults=!1;continuous=!1;maxAlternatives=1;onresult=null;onerror=null;onend=null;l=null;start(){const e='customer'===t.APP_VARIANT?'owner':t.APP_VARIANT;if(this.l=B(()=>{},(e,t)=>{if(this.l=null,t)this.onerror?.({error:t});else if(e){const t=Object.assign([{transcript:e,confidence:1}],{isFinal:!0});this.onresult?.({resultIndex:0,results:[t]})}this.onend?.()},e,void 0,!0),!this.l)throw new Error('not-supported')}stop(){this.l?.stop()}abort(){const e=this.l;this.l=null,e?.abort(),e&&this.onend?.()}}const N=()=>w()?I:null;const W=(e=30)=>{try{n()?.navigator?.vibrate?.(e)}catch{}}},1099,[1097,806]); +__d(function(g,r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"HISTORY_LABEL",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"HISTORY_NOTE",{enumerable:!0,get:function(){return t}}),e.validPastDate=n,e.exactHistoryDate=function(o,t){if(1!==(o.match(/\b(?:\d{4}-\d{2}-\d{2}|\d{1,2}\/\d{1,2}\/\d{4}|\d{1,2}(?:st|nd|rd|th)?\s+[a-z]+\s+\d{4})\b/gi)??[]).length)return;const d=o.match(/\b(\d{4}-\d{2}-\d{2})\b/);let s=d?.[1];if(!s){const t=o.match(/\b(\d{1,2})\/(\d{1,2})\/(\d{4})\b/);t&&(s=`${t[3]}-${t[2].padStart(2,'0')}-${t[1].padStart(2,'0')}`)}if(!s){const t=o.toLowerCase().match(/\b(\d{1,2})(?:st|nd|rd|th)?\s+(january|february|march|april|may|june|july|august|september|october|november|december|jan|feb|mar|apr|jun|jul|aug|sep|sept|oct|nov|dec)\s+(\d{4})\b/),n=['jan','feb','mar','apr','may','jun','jul','aug','sep','oct','nov','dec'];t&&(s=`${t[3]}-${String(n.indexOf(t[2].slice(0,3))+1).padStart(2,'0')}-${t[1].padStart(2,'0')}`)}return s&&n(s,t)?s:void 0},Object.defineProperty(e,"historyDateLabel",{enumerable:!0,get:function(){return d}}),e.bookingDayText=function(o){const n=`Booked covers on ${d(o.date)}: ${null===o.booked_covers?'not recorded':o.booked_covers}.`,s=o.bookings.map(o=>`${o.time??'Time not recorded'}: party size ${null===o.covers?'not recorded':`${o.covers} Covers`}; ${o.table?`table ${o.table}`:'table not recorded'}; ${o.status??'status not recorded'}${o.counted?'':', excluded from Booked covers'}.`);return[n,...s,o.historical_records?"Includes previous booking system history (incomplete).":'',t,o.bookings.length?'':'No booking records found; incomplete history does not prove there were no bookings.',o.missing_covers?`${o.missing_covers} booking records have no party size; left blank.`:''].filter(Boolean).join(' ')};const o='Includes previous booking system history (incomplete)',t='Recovered booking records, not confirmed attendance. Cancelled bookings are shown but excluded from Booked covers.';function n(o,t){if(!/^\d{4}-\d{2}-\d{2}$/.test(o))return!1;const n=new Date(o+'T12:00:00Z');return!Number.isNaN(n.getTime())&&n.toISOString().slice(0,10)===o&&onew Date(o+'T12:00:00Z').toLocaleDateString('en-GB',{day:'numeric',month:'long',year:'numeric',timeZone:'Europe/London'})},1100,[]); +__d(function(_g,_r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.clockAction=async function(n,u){if((0,t.privateClockVenue)(u.rid)&&'in'!==n)return c(n,u,{action:n,at:u.at,inside:null,unchecked:!0});const f=(0,a.areaOf)(u.rid),k=f.on&&null!=f.lat&&null!=f.lng,l=k?await(u.fixFn??r.getFix)():'unavailable';if((0,t.privateClockVenue)(u.rid)&&'object'==typeof l&&(!Number.isFinite(l.acc)||l.acc>150))return{ok:!1,message:'Your phone\u2019s location is not accurate enough to confirm you are at the pub. Enable precise location, step near a window and try again, or ask a manager to record your clock-in with a reason.'};const g=k&&'object'!=typeof l?(0,s.locWhere)():'browser',p=(0,o.gate)(f,n,k?l:'unavailable',u.at,g);if(!p.allowed){const a='object'==typeof l?void 0:'app'===g&&'denied'===l?'settings':'app-phone-off'===g?'location':'app-old'===g&&'denied'===l?'update':void 0;return'update'===a&&(0,s.checkAppUpdate)(),{ok:!1,message:(p.message??'You need to be at the venue.')+((0,t.privateClockVenue)(u.rid)?' Ask a manager to record your clock-in with a reason using Record it for someone.':''),fix:a}}const w=c(n,u,p.geo);return w.ok&&p.warn?{...w,warn:p.warn}:w},e.managerClockAction=function(t,a,r,s){const u=(0,o.overrideGeo)(t,a.at,r,s);if(!u)return{ok:!1,message:'Type a short reason (at least 3 letters).'};const f=n.useOwner.getState().staff.find(t=>t.id===a.staffId)?.name??'staff',k=c(t,a,u,{adjusted:{by:r.name,at:a.at,reason:u.override.reason}});if(k.ok){const o={in:'clocked in',out:'clocked out',break_start:'started a break for',break_end:'ended a break for'}[t],s=`${r.name} ${o} ${f} (manager, no location check): ${u.override.reason}`;n.useOwner.setState(t=>({attLog:[{id:`al-${Date.now().toString(36)}`,at:a.at,text:s},...t.attLog]}))}return k};var t=_r(d[0]),a=_r(d[1]),n=_r(d[2]),o=_r(d[3]),r=_r(d[4]),s=_r(d[5]);function c(a,o,r,s={}){const c=(0,t.venueClockGeo)(o.rid,r),u=c?!1!==c.inside:void 0,f=n.useOwner.getState(),k=(0,n.openShiftOf)(f.attendance,o.staffId,o.at);if('in'===a){if(k)return{ok:!1,message:'You\u2019re already clocked in.'};f.clock(o.staffId,o.date,'in',o.at,u);const t=(0,n.openShiftOf)(n.useOwner.getState().attendance,o.staffId,o.at);return t&&n.useOwner.getState().patchAttendance(t.id,{...o.offRota?{offRota:!0}:{},...s},c),{ok:!0,att:t&&n.useOwner.getState().attendance.find(a=>a.id===t.id)}}if(!k)return{ok:!1,message:'You\u2019re not clocked in.'};if('out'===a){let t=o.breakMins;if(o.addedBreak&&o.addedBreak>0&&!k.breaks?.length){const a=new Date(o.at).getTime(),r=new Date(Math.max(new Date(k.in).getTime(),a-6e4*o.addedBreak)).toISOString();n.useOwner.getState().patchAttendance(k.id,{breaks:[{start:r,end:o.at}],breakAddedAtClockOut:o.addedBreak}),t=Math.round((a-new Date(r).getTime())/6e4)}return n.useOwner.getState().clock(o.staffId,o.date,'out',o.at,u,t),n.useOwner.getState().patchAttendance(k.id,s,c),{ok:!0,att:n.useOwner.getState().attendance.find(t=>t.id===k.id)}}return n.useOwner.getState().breakToggle(o.staffId,'break_start'===a?'start':'end',o.at)?(n.useOwner.getState().patchAttendance(k.id,s,c),{ok:!0,att:n.useOwner.getState().attendance.find(t=>t.id===k.id)}):{ok:!1,message:'break_start'===a?'You\u2019re already on a break.':'You\u2019re not on a break.'}}},1102,[987,1206,854,953,1273,1289]); +__d(function(_g,_r,_i,_a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"canEditCards",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"canSignOffCards",{enumerable:!0,get:function(){return i}}),e.suggestForIngredient=a,e.suggestAllergens=o,Object.defineProperty(e,"suggestedBy",{enumerable:!0,get:function(){return l}}),e.unresolved=c,e.applySuggestions=function(n){const t={...n.allergens};for(const i of c(n))t[i]='contains';return t},Object.defineProperty(e,"cardState",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"STATE_LABEL",{enumerable:!0,get:function(){return f}}),e.signOffBlock=function(n){if(!n.dish.trim())return'Give the dish a name first.';const t=c(n);return t.length?`Check the suggested allergens first: ${t.map(g).join(', ')}.`:n.allergensConfirmed?null:'Confirm the allergen list first.'},Object.defineProperty(e,"allergenList",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"CONTENT_FIELDS",{enumerable:!0,get:function(){return p}}),e.editCard=function(n,t,i,r){const{confirmAllergens:s,...a}=t,l=Object.keys(a).filter(t=>!h(a[t],n[t]));let u={...n};for(const n of l)u[n]=a[n];const f=l.some(n=>'allergens'===n||'dismissed'===n||'ingredients'===n);f&&!h(o(u.ingredients),o(n.ingredients))&&(u.allergensConfirmed=void 0);f&&(l.includes('allergens')||l.includes('dismissed'))&&(u.allergensConfirmed=void 0);let g=!1;!s||u.allergensConfirmed||c(u).length||(u.allergensConfirmed={by:i,at:r},g=!0);const m=l.length>0||g,p=l.length>0&&!!n.signOff;if(!m)return{card:n,changed:!1,resetSignOff:!1};l.length&&(u={...u,signOff:null,version:n.version+1});return{card:{...u,updatedAt:r,updatedBy:i},changed:m,resetSignOff:p}},e.signOffCard=function(n,t,i){return{...n,signOff:{by:t,at:i},wasLive:!0,updatedAt:i,updatedBy:t}},e.overlayItem=function(n,t){return t?{...n,name:t.dish,section:t.section,price:t.price,allergens:t.allergens,allergenNotes:t.allergenNotes,signOff:t.signOff?{by:t.signOff.by,at:t.signOff.at.slice(0,10)}:null,hidden:n.hidden||!t.signOff&&!t.wasLive,recipeCardId:t.id}:n},e.dishesFor=function(n,t){const i=n.filter(n=>!n.hidden),r=i.filter(n=>t.some(t=>'contains'===n.allergens[t])),s=i.filter(n=>!r.includes(n)&&t.some(t=>'may'===n.allergens[t])),a=i.filter(n=>!r.includes(n)&&!s.includes(n));return{contains:r,may:s,free:a}},e.filterCards=function(n,t,i,r="free-from"){const s=t.toLowerCase().split(/\s+/).filter(Boolean);return n.filter(n=>{const t=[n.dish,n.section,...n.ingredients.map(n=>n.name)].join(' ').toLowerCase();return!!s.every(n=>t.includes(n))&&(!i.length||('free-from'===r?i.every(t=>!n.allergens[t]):i.some(t=>!!n.allergens[t])))})},e.uuid=function(){const n=globalThis.crypto;if(n?.randomUUID)return n.randomUUID();const t=Array.from({length:16},()=>Math.floor(256*Math.random()));t[6]=15&t[6]|64,t[8]=63&t[8]|128;const i=t.map(n=>n.toString(16).padStart(2,'0')).join('');return`${i.slice(0,8)}-${i.slice(8,12)}-${i.slice(12,16)}-${i.slice(16,20)}-${i.slice(20)}`},e.uuidFrom=function(n){let t='';for(let i=0;i<4;i++){let r=2166136261^2654435761*i;for(let t=0;t>>0;t+=r.toString(16).padStart(8,'0')}const i=t.slice(0,12)+'4'+t.slice(13,16)+(3&parseInt(t[16],16)|8).toString(16)+t.slice(17,32);return`${i.slice(0,8)}-${i.slice(8,12)}-${i.slice(12,16)}-${i.slice(16,20)}-${i.slice(20,32)}`},Object.defineProperty(e,"RECIPE_CARD_EXTRA_COLUMNS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"STEP_SEP",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"photoPath",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"RECIPE_PHOTO_BUCKET",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"RECIPE_CARD_TABLE",{enumerable:!0,get:function(){return v}}),e.cardToRow=function(n,t){return{row:{id:n.id,venue_id:t,dish:n.dish,ingredients:n.ingredients.map(({name:n,qty:t,unit:i,allergens:r})=>({name:n,qty:t,unit:i,...r?.length?{allergens:r}:{}})),method:n.steps.join(y),allergens:m(n.allergens,'contains'),may_contain:m(n.allergens,'may'),photo_url:!n.photo||n.photo.startsWith('local:')||n.photo.startsWith('asset:')?null:n.photo,signed_off_by:n.signOff?.by??null,signed_off_at:n.signOff?.at??null,updated_at:n.updatedAt},extra:{menu_item_id:n.menuItemId,section:n.section,price_pence:n.price,dismissed:n.dismissed,allergen_notes:n.allergenNotes??null,allergens_confirmed_by:n.allergensConfirmed?.by??null,allergens_confirmed_at:n.allergensConfirmed?.at??null,was_live:n.wasLive,origin:n.origin,version:n.version,updated_by:n.updatedBy}}},e.rowToCard=function(n,t,i={}){const r={};n.may_contain.forEach(n=>{r[n]='may'}),n.allergens.forEach(n=>{r[n]='contains'});const s=n.updated_at??(new Date).toISOString();return{id:n.id,restaurantId:t,menuItemId:i.menu_item_id??n.id,dish:n.dish,section:i.section??'Mains',price:i.price_pence??null,photo:n.photo_url??void 0,ingredients:n.ingredients.map((t,i)=>({id:`${n.id}-i${i}`,...t})),steps:n.method?n.method.split(y).filter(n=>n.trim()):[],allergens:r,dismissed:i.dismissed??[],allergenNotes:i.allergen_notes??void 0,allergensConfirmed:i.allergens_confirmed_by?{by:i.allergens_confirmed_by,at:i.allergens_confirmed_at}:void 0,signOff:n.signed_off_by&&n.signed_off_at?{by:n.signed_off_by,at:n.signed_off_at}:null,wasLive:i.was_live??!!n.signed_off_by,origin:i.origin??'new',version:i.version??1,createdAt:s,updatedAt:s,updatedBy:i.updated_by??''}};var n=_r(d[0]);const t=n=>'head-chef'===n||'manager'===n||'owner'===n,i=n=>'head-chef'===n,r=[[/\b(flour(?!y)|wheat|bread|crumb|panko|pastry|brioche|buns?\b|crouton|crostini|batter|beer|ale\b|lager|stout|barley|malt|rye|spelt|oat|couscous|semolina|pasta|penne|macaroni|spaghetti|noodle|biscuit|sponge|crumble|roux|tempura|digestive|self.raising)/i,['gluten']],[/\b(prawn|langoustine|lobster|crab|shrimp|crayfish|scampi|shellfish)/i,['crustaceans']],[/\b(mussel|scallop|clam|cockle|squid|calamari|octopus|whelk|winkle|oyster(?! mushroom)|oyster sauce)/i,['molluscs']],[/\b(egg|mayonnaise|mayo|aioli|tartare|hollandaise|meringue|custard|brioche|bearnaise)/i,['eggs']],[/\b(fish(?!er)|haddock|cod|salmon|hake|anchov|tuna|mackerel|trout|sea bass|monkfish|pollock|halibut|kipper|worcester|fish sauce|caesar)/i,['fish']],[/\b(peanut|groundnut|satay)/i,['peanuts']],[/\b(almond|hazelnut|walnut|cashew|pecan|pistachio|macadamia|brazil nut|praline|frangipane|marzipan|pesto)/i,['treenuts']],[/\b(soy|soya|tofu|edamame|miso|tamari|tempeh)/i,['soya']],[/\b(milk|butter(?!nut)|cream|cheese|cheddar|parmesan|mozzarella|brie|yoghurt|yogurt|cr[e\xe8]me|ghee|ice cream|custard|butterscotch|toffee|fudge|buttermilk|mascarpone|ricotta|whey)/i,['milk']],[/\b(celery|celeriac|stock cube|beef stock|chicken stock|veg(etable)? stock)/i,['celery']],[/\b(mustard|dijon|vinaigrette|piccalilli)/i,['mustard']],[/\b(sesame|tahini|hummus|houmous)/i,['sesame']],[/\b(wine|vinegar|dried apricot|dried fruit|sulphite|sulfite|prosecco|cider|port\b|sherry|dates?\b|raisin|sultana)/i,['sulphites']],[/\blupin/i,['lupin']]],s=[[/gluten.free|\bgf\b/i,'gluten'],[/dairy.free|vegan (butter|cheese|cream)|oat milk|plant.based/i,'milk'],[/egg.free|vegan mayo/i,'eggs']];function a(t){const i=new Set(t.allergens??[]);for(const[n,s]of r)n.test(t.name)&&s.forEach(n=>i.add(n));for(const[n,r]of s)n.test(t.name)&&!(t.allergens??[]).includes(r)&&i.delete(r);return n.ALLERGENS.map(n=>n.id).filter(n=>i.has(n))}function o(t){const i=new Set(t.flatMap(a));return n.ALLERGENS.map(n=>n.id).filter(n=>i.has(n))}const l=(n,t)=>n.filter(n=>a(n).includes(t)).map(n=>n.name);function c(n){return o(n.ingredients).filter(t=>!n.allergens[t]&&!n.dismissed.includes(t))}const u=n=>n.signOff?'signed-off':'awaiting',f={'signed-off':'Signed off',awaiting:'Awaiting sign-off'};const g=t=>n.ALLERGENS.find(n=>n.id===t)?.short??t,m=(t,i)=>n.ALLERGENS.filter(n=>i?t[n.id]===i:!!t[n.id]).map(n=>n.id),p=['dish','section','price','photo','ingredients','steps','allergens','dismissed','allergenNotes'],h=(n,t)=>JSON.stringify(n??null)===JSON.stringify(t??null);const b={menu_item_id:'text',section:'text',price_pence:'integer null',dismissed:'text[]',allergen_notes:'text',allergens_confirmed_by:'text',allergens_confirmed_at:'timestamptz',was_live:'boolean',origin:'text',version:'integer',updated_by:'text'},y='\n',_=(n,t)=>`${n}/${t.id}-v${t.version}.jpg`,O='recipe-photos',v='recipe_cards'},1103,[814]); +__d(function(g,r,i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"ACCIDENT_CATEGORIES",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"RIDDOR_CATEGORIES",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"sid",{enumerable:!0,get:function(){return u}}),_e.isSeedAccident=w,Object.defineProperty(_e,"useSafety",{enumerable:!0,get:function(){return b}});var e,t=r(_d[0]),n=r(_d[1]),a=r(_d[2]),s=r(_d[3]),o=(e=s)&&e.__esModule?e:{default:e},d=r(_d[4]),c=r(_d[5]),l=r(_d[6]);const p=['Near miss','Slip, trip or fall','Cut','Burn or scald','Manual handling','Struck by an object','Allergic reaction','Fall from height','Fracture or dislocation','Taken to hospital','Lost consciousness','Off work more than 7 days','Other'],f=['Fall from height','Fracture or dislocation','Taken to hospital','Lost consciousness','Off work more than 7 days'];let y=0;const u=e=>`${e}-${Date.now().toString(36)}${(y++).toString(36)}`,h=(e,t,n)=>({id:e,when:t,location:'',person:'',personType:'Staff',category:'Near miss',what:'',injury:'None',firstAid:'None needed',witnesses:'',reportedBy:'',reportedById:'',app:'staff',createdAt:`${t}:00`,...n});function S(){const e=new Date,t=(t,n)=>{const a=new Date(e);return a.setDate(a.getDate()-t),`${a.toISOString().slice(0,10)}T${n}`};return[h('acc-ex1',t(3,'19:40'),{location:'Kitchen pass',person:'Server (example)',category:'Near miss',what:'Example: water on the floor by the pass after the glass washer leaked. Nobody slipped.',firstAid:'None needed',witnesses:'Bar (example)',reportedBy:'Server (example)',reportedById:'st-4',app:'staff'}),h('acc-ex2',t(6,'12:15'),{location:'Kitchen: fryer section',person:'Head Chef (example)',category:'Burn or scald',what:'Example: splash of hot oil on the back of the hand while changing the basket.',injury:'Small burn, back of left hand',firstAid:'Cooled under running water for 20 minutes, sterile dressing',witnesses:'None',reportedBy:'Head Chef (example)',reportedById:'st-3',app:'chef'})]}function w(e){const t=({when:e,createdAt:t,...n})=>JSON.stringify(n);return S().some(n=>n.id===e.id&&t(n)===t(e))}const b=(0,d.create)()((0,c.persist)(e=>({points:l.DEFAULT_POINTS,entries:[],accidents:a.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD?[]:S(),probes:[],diary:[],daySigns:[],weekly:[],addNote:t=>e(e=>({diary:[{...t,id:u('dn')},...e.diary??[]]})),signDay:t=>e(e=>({daySigns:[...(e.daySigns??[]).filter(e=>e.date!==t.date),t]})),signWeek:t=>e(e=>({weekly:[{...t,id:u('wk')},...(e.weekly??[]).filter(e=>e.week!==t.week)]})),addProbe:t=>e(e=>({probes:[...e.probes??[],{...t,id:u('pr'),status:'not-connected'}]})),removeProbe:t=>e(e=>({probes:(e.probes??[]).filter(e=>e.id!==t)})),addEntries:t=>e(e=>({entries:[...t.map(e=>({...e,id:u('hc')})),...e.entries]})),setPoint:(t,n)=>e(e=>({points:e.points.map(e=>e.id===t?{...e,...n}:e)})),addPoint:t=>e(e=>({points:[...e.points,{...t,id:u('cp')}]})),resetPoints:()=>e({points:l.DEFAULT_POINTS}),addAccident:t=>e(e=>({accidents:[{...t,id:u('acc'),createdAt:(new Date).toISOString()},...e.accidents]})),setRiddorNote:(t,n)=>e(e=>({accidents:e.accidents.map(e=>e.id===t?{...e,riddorNote:n}:e)}))}),{name:'covercharge-safety-v1',storage:(0,c.createJSONStorage)(()=>o.default),version:4,migrate:async(e,a)=>{if(t.LIVE_VENUE_BUILD&&e&&await(0,n.archiveChefCache)('safety',e),e&&a<2){const t=new Set((e.points??[]).map(e=>e.id));e.points=[...e.points??[],...l.DEFAULT_POINTS.filter(e=>!t.has(e.id))],e.diary=e.diary??[],e.daySigns=e.daySigns??[],e.weekly=e.weekly??[]}return t.LIVE_VENUE_BUILD&&e&&(e.accidents=(e.accidents||[]).filter(e=>!w(e))),e}}))},1104,[833,1131,5,1115,951,1116,1112]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"libraryRowId",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"personRowId",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"tickId",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"personKey",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"useDailyTasks",{enumerable:!0,get:function(){return L}}),Object.defineProperty(_e,"tasksOf",{enumerable:!0,get:function(){return O}});var e,t=r(d[0]),i=(e=t)&&e.__esModule?e:{default:e},s=r(d[1]),n=r(d[2]),o=r(d[3]),u=r(d[4]),c=r(d[5]);const l=e=>(0,o.uuidFrom)(`daily-task-library:${e}`),y=(e,t)=>(0,o.uuidFrom)(`daily-tasks:${e}:${t}`),b=(e,t,i,s)=>(0,o.uuidFrom)(`daily-task-tick:${e}:${(0,u.tickKey)(t,i,s)}`),f=()=>(new Date).toISOString(),k=(e,t)=>`${e}|${t}`,p=e=>u.DEFAULT_LIBRARY.map((t,i)=>({id:(0,o.uuidFrom)(`daily-task-lib:${e}:${i}`),text:t})),L=(0,s.create)()((0,n.persist)((e,t)=>({library:{},people:{},ticks:[],ensure:i=>{t().library[i]||e(e=>({library:{...e.library,[i]:{items:p(i)}}}))},setLibrary:(t,i)=>e(e=>({library:{...e.library,[t]:{items:i,updatedAt:f()}}})),addLibrary:(e,i)=>{const s=(0,u.cleanTaskText)(i);if(!s)return;const n=t().library[e]?.items??p(e);n.some(e=>e.text.toLowerCase()===s.toLowerCase()&&!e.archived)||t().setLibrary(e,[...n,{id:(0,c.uuid)(),text:s}])},setTasks:(t,i,s)=>e(e=>({people:{...e.people,[k(t,i)]:{tasks:s,updatedAt:f()}}})),addTask:(e,i,s,n)=>{const o=(0,u.cleanTaskText)(s);if(!o)return;const l=t().people[k(e,i)]?.tasks??[];l.some(e=>e.text.toLowerCase()===o.toLowerCase())||t().setTasks(e,i,[...l,{id:(0,c.uuid)(),text:o,...n?{libraryId:n}:{}}])},toggleTick:(t,i,s,n,o)=>e(e=>{const u=b(t,i,s,n);if(e.ticks.some(e=>e.id===u))return{ticks:e.ticks.filter(e=>e.id!==u)};const c=new Date(Date.now()-12096e5).toISOString().slice(0,10);return{ticks:[...e.ticks.filter(e=>e.forDate>=c),{id:u,rid:t,staffRef:i,taskId:s,forDate:n,byRef:o.id,byName:o.name,at:f()}]}}),resetLibrary:e=>t().setLibrary(e,p(e))}),{name:'covercharge-daily-tasks-v1',version:1,storage:(0,n.createJSONStorage)(()=>i.default)})),O=(e,t)=>L.getState().people[k(e,t)]?.tasks??[]},1105,[1115,951,1116,1103,1106,1032]); +__d(function(g,r,_i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TASK_MAX",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"cleanTaskText",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"appliesOn",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"tasksFor",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"tickKey",{enumerable:!0,get:function(){return u}}),e.progress=function(t,n,o,u,c){const s=i(t,c),f=new Set(n.filter(t=>t.staffRef===o&&t.forDate===u).map(t=>t.taskId));return{done:s.filter(t=>f.has(t.id)).length,total:s.length}},e.move=function(t,n,o){const i=n+o;if(n<0||i<0||n>=t.length||i>=t.length)return t;const u=[...t];return[u[n],u[i]]=[u[i],u[n]],u},Object.defineProperty(e,"hasTask",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"DEFAULT_LIBRARY",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"TASK_DAY_NAMES",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"isHeadChefP",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"isKitchenP",{enumerable:!0,get:function(){return d}}),e.canEditTasks=function(t,n){return!!t&&('owner'===t.role||'manager'===t.role||!!l(t)&&(t.id!==n.id&&'staff'===n.role&&!l(n)&&d(n)))};const t=80,n=n=>n.replace(/\s+/g,' ').trim().slice(0,t),o=(t,n)=>!t.days||0===t.days.length||t.days.includes(n),i=(t,n)=>t.filter(t=>o(t,n)),u=(t,n,o)=>`${t}|${n}|${o}`;const c=(t,o)=>t.some(t=>t.text.toLowerCase()===n(o).toLowerCase()),s=['Restock the bar fridges','Wipe down the menus','Check the toilets','Set the tables','Polish glasses','Empty the bins','Clean the coffee machine','Take out the recycling'],f=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],l=t=>'staff'===t.role&&('Head Chef'===t.level||/^head chef/i.test(t.job??'')),d=t=>'kitchen'===(t.dept??'').trim().toLowerCase()},1106,[]); +__d(function(g,_r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"LEGAL_LIMIT_MINS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"DEFAULT_BREAK_RULES",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"REMINDER_WINDOW_MINS",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"CHAIRS_TEXT",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"defaultChairs",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"DAY_NAMES",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"AUDIENCE_LABEL",{enumerable:!0,get:function(){return u}}),e.clampRules=s,Object.defineProperty(e,"validTime",{enumerable:!0,get:function(){return c}}),e.ukClock=d,e.reminderDue=function(t,n){const o=d(n);if(t.paused||!c(t.time)||!t.days.includes(o.dow))return{due:!1,forDate:o.ymd};const i=l(t.time);return{due:o.mins>=i&&o.mins=t.shiftEnd))return null;const r=m(t).filter(n=>n.at<=t.now),o=r.length?r[r.length-1]:null;if(!o)return null;if(t.nowr?o:null}return o};const t=360,n={on:!0,afterMins:240,repeatMins:30,snoozeMins:15},r=180,o='Time to put the chairs up on the tables',i=t=>({id:t,text:o,days:[5,0],time:'21:00',audience:'all',builtIn:'chairs'}),a=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],u={all:'Everyone on shift',foh:'Front of house',kitchen:'Kitchen'};function s(r){const o=(t,n,r,o)=>{const i=Math.round(Number(t));return Number.isFinite(i)?Math.min(o,Math.max(r,i)):n};return{on:!1!==r.on,afterMins:o(r.afterMins,n.afterMins,30,t),repeatMins:o(r.repeatMins,n.repeatMins,5,120),snoozeMins:o(r.snoozeMins,n.snoozeMins,5,60)}}const c=t=>/^([01]\d|2[0-3]):[0-5]\d$/.test(t);function d(t){const n='number'==typeof t?new Date(t):t,r=Object.fromEntries(new Intl.DateTimeFormat('en-GB',{timeZone:'Europe/London',weekday:'short',year:'numeric',month:'2-digit',day:'2-digit',hour:'2-digit',minute:'2-digit',hourCycle:'h23'}).formatToParts(n).map(t=>[t.type,t.value]));return{dow:a.indexOf(String(r.weekday).slice(0,3)),mins:60*Number(r.hour)+Number(r.minute),ymd:`${r.year}-${r.month}-${r.day}`}}const l=t=>60*Number(t.slice(0,2))+Number(t.slice(3,5));const f=(t,n)=>'all'===t||('kitchen'===t?n:!n);function m(t){const n=s(t.rules),r=t.clockIn??t.shiftStart;if(!n.on||void 0===r||t.hadBreak)return[];const o=r+216e5,i=Math.min(void 0!==t.rotaBreak&&t.rotaBreak>r?t.rotaBreak:r+6e4*n.afterMins,o),a=[{stage:1,at:i,label:void 0!==t.rotaBreak&&t.rotaBreak>r&&t.rotaBreak<=o?'Your break on the rota is now.':'Time for your break.'}],u=i+6e4*n.repeatMins;return a.push({stage:2,at:u,label:'Reminder: you haven\u2019t had your break yet.'}),o>u&&a.push({stage:3,at:o,label:'You\u2019ve worked 6 hours without a break. You need a 20-minute break (UK law).'}),a}},1107,[]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"TAKINGS_FIELDS",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"NO_SERVICE_SPLIT",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"TAKINGS_KEYS",{enumerable:!0,get:function(){return t}}),_e.withTakingsFields=function(t){t=t.filter(e=>!n.includes(e.key));const r=new Set(t.map(e=>e.key)),o=e.filter(e=>!r.has(e.key)).map(e=>({...e}));if(!o.length)return t;const l=t.findIndex(e=>'cash'===e.key),i=l<0?t.length:l+1;return[...t.slice(0,i),...o,...t.slice(i)]},Object.defineProperty(_e,"grossOf",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"DEFAULT_CASHUP_FIELDS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"DEFAULT_SALES_FIELDS",{enumerable:!0,get:function(){return l}}),_e.parseAmount=function(e,n="money"){const t=e.replace(/[\xa3,\s]/g,'');return t?'number'===n?/^\d{1,6}$/.test(t)?Number(t):null:/^-?\d{1,7}(\.\d{1,2})?$/.test(t)?Math.round(100*Number(t))/100:null:null},Object.defineProperty(_e,"isBlank",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"ymdUTC",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"addDaysYmd",{enumerable:!0,get:function(){return u}}),_e.weekStartOf=function(e){const n=(s(e).getUTCDay()+6)%7;return u(e,-n)},_e.combinedTips=function(e){const n='number'==typeof e.cashTips?e.cashTips:null,t='number'==typeof e.cardTips?e.cardTips:null;return null==n&&null==t?null:Math.round(100*((n??0)+(t??0)))/100},Object.defineProperty(_e,"takings",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"missing",{enumerable:!0,get:function(){return d}}),_e.dailySeries=function(e,n,t,r=c){const o=new Map(e.filter(e=>e.confirmedAt).map(e=>[e.date,e]));return Array.from({length:t},(e,l)=>{const i=u(n,l-t+1),a=o.get(i);return{date:i,value:a?r(a.vals):null}})},_e.weekCompare=function(e,n,t="net"){const r=n=>{const r=e.find(e=>e.weekStart===n&&e.confirmedAt),o=r?.vals[t];return'number'==typeof o?o:null},o=r(n),l=r(u(n,-7)),i=null!=o&&null!=l&&0!==l?Math.round((o-l)/l*1e3)/10:null;return{now:o,prev:l,change:i}},_e.tipsPot=function(e,n,t,r){const o=n.filter(e=>'payout'===e.kind&&e.throughDate).sort((e,n)=>e.at.localeCompare(n.at)),l=o[o.length-1],i=l?u(l.throughDate,1):t,a=e.filter(e=>e.date>=i&&e.date<=r).sort((e,n)=>e.date.localeCompare(n.date)),s=n.filter(e=>'correction'===e.kind&&e.forDate&&e.forDate>=i&&e.forDate<=r&&(!l||e.at>l.at)),c=Math.round(100*(a.reduce((e,n)=>e+n.total,0)+s.reduce((e,n)=>e+n.amount,0)))/100;return{from:i,total:Math.max(0,c),days:a,corrections:s,lastPayout:l??null,history:o.slice().reverse()}},_e.cashLocked=function(e,n=Date.now()){return!(!e.onServer||!e.confirmedAt)&&!(e.unlockedUntil&&Date.parse(e.unlockedUntil)>n)},_e.changedFields=function(e,n){const t=e??{},r=n??{},o=[],l=t.vals??{},i=r.vals??{};for(const e of new Set([...Object.keys(l),...Object.keys(i)]))JSON.stringify(l[e])!==JSON.stringify(i[e])&&o.push(e);JSON.stringify(t.categories??null)!==JSON.stringify(r.categories??null)&&(t.categories||r.categories)&&o.push('categories');JSON.stringify(t.photos??[])!==JSON.stringify(r.photos??[])&&e&&n&&o.push('photos');return o};const e=[{key:'gross',label:'Gross takings',kind:'money',fixed:!0,optional:!0},{key:'food',label:'Food takings (optional)',kind:'money',fixed:!0,optional:!0},{key:'drink',label:'Drink takings (optional)',kind:'money',fixed:!0,optional:!0}],n=['lunchGross','dinnerGross'],t=e.map(e=>e.key);const r=e=>'number'==typeof e.gross?e.gross:null,o=[{key:'card',label:'Card takings',kind:'money'},{key:'cash',label:'Cash takings',kind:'money'},...e,{key:'float',label:'Float (tills)',kind:'money'},{key:'cashTips',label:'Cash tips total',kind:'money',fixed:!0},{key:'cardTips',label:'Card tips total',kind:'money',fixed:!0},{key:'overUnder',label:'Over / under (discrepancy)',kind:'money'},{key:'notes',label:'Notes',kind:'text'}],l=[{key:'gross',label:'Gross sales',kind:'money'},{key:'net',label:'Net sales',kind:'money',fixed:!0},{key:'vat',label:'VAT',kind:'money'},{key:'covers',label:'Covers',kind:'number'},{key:'discounts',label:'Discounts',kind:'money'},{key:'refunds',label:'Refunds',kind:'money'}];const i=e=>null==e||''===e,a=e=>e.toISOString().slice(0,10),s=e=>new Date(`${e}T12:00:00Z`),u=(e,n)=>{const t=s(e);return t.setUTCDate(t.getUTCDate()+n),a(t)};const c=e=>{const n='number'==typeof e.card?e.card:null,t='number'==typeof e.cash?e.cash:null;return null==n&&null==t?null:(n??0)+(t??0)},d=(e,n)=>e.filter(e=>'text'!==e.kind&&!e.optional&&i(n[e.key])).map(e=>e.key)},1108,[]); +__d(function(g,r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"FALLBACK_PAY",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"ymdOf",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"dateOf",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"plusDays",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"daysBetween",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"isValidYmd",{enumerable:!0,get:function(){return y}}),_e.cleanPay=function(t){const n={...e,...t??{}};return{tipsFrequency:['weekly','fortnightly','monthly'].includes(n.tipsFrequency)?n.tipsFrequency:'fortnightly',tipsAnchorPayday:y(String(n.tipsAnchorPayday))?n.tipsAnchorPayday:e.tipsAnchorPayday,tipsEndsDaysBefore:Math.max(0,Math.min(13,Math.round(Number(n.tipsEndsDaysBefore)||0))),wagePayDay:Math.max(1,Math.min(31,Math.round(Number(n.wagePayDay)||28))),wageCutoffDay:Math.max(1,Math.min(28,Math.round(Number(n.wageCutoffDay)||1))),weekendRule:'before'===n.weekendRule||'after'===n.weekendRule?n.weekendRule:'none'}},_e.adjustWeekend=s,_e.wagePeriod=f,_e.tipsPeriod=m,_e.nextToPay=function(e,t,n){for(let a=-2;a<=2;a++){const u='wage'===t?f(e,n,a):m(e,n,a);if((u.payday??u.end)>=n)return{period:u,offset:a}}return{period:'wage'===t?f(e,n,0):m(e,n,0),offset:0}},_e.customPeriod=function(e,t){return{kind:'custom',start:e,end:t,key:`c-${e}-${t}`}},Object.defineProperty(_e,"ukDate",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"dayMonth",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"dm",{enumerable:!0,get:function(){return M}}),Object.defineProperty(_e,"rangeText",{enumerable:!0,get:function(){return $}}),_e.parseUk=function(e){const n=e.trim();if(y(n))return n;const a=/^(\d{1,2})[/.-](\d{1,2})[/.-](\d{2}|\d{4})$/.exec(n);if(!a)return null;const u=`${2===a[3].length?2e3+Number(a[3]):Number(a[3])}-${t(Number(a[2]))}-${t(Number(a[1]))}`;return y(u)?u:null},Object.defineProperty(_e,"decH",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"hMm",{enumerable:!0,get:function(){return F}});const e={tipsFrequency:'weekly',tipsAnchorPayday:'2026-01-05',tipsEndsDaysBefore:1,wagePayDay:31,wageCutoffDay:1,weekendRule:'none'},t=e=>String(e).padStart(2,'0'),n=e=>`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}`,a=e=>{const[t,n,a]=e.split('-').map(Number);return new Date(t,n-1,a,12)},u=(e,t)=>{const u=a(e);return u.setDate(u.getDate()+t),n(u)},o=(e,t)=>Math.round((a(t).getTime()-a(e).getTime())/864e5),i=(e,t)=>new Date(e,t+1,0).getDate(),c=(e,t,a)=>{const u=new Date(e,t,1,12),o=u.getFullYear(),c=u.getMonth();return n(new Date(o,c,Math.min(a,i(o,c)),12))},y=e=>/^\d{4}-\d{2}-\d{2}$/.test(e)&&n(a(e))===e;function s(e,t="none"){if('none'===t)return e;const n=a(e).getDay();return 6===n?u(e,'before'===t?-1:2):0===n?u(e,'before'===t?-2:1):e}function d(e,t,n){const o=c(t,n,e.wageCutoffDay),i=u(c(t,n+1,e.wageCutoffDay),-1),y=a(i);let d=c(y.getFullYear(),y.getMonth(),e.wagePayDay);return dn.end))break;a++}}return a}function m(e,t,n=0){return p(e,h(e,t)+n)}const b=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],D=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],w=e=>{const[t,n,a]=e.split('-');return`${a}/${n}/${t}`},P=e=>{const t=a(e);return`${b[t.getDay()]} ${t.getDate()} ${D[t.getMonth()]}`},M=e=>{const t=a(e);return`${t.getDate()} ${D[t.getMonth()]}`},$=(e,t,n=" to ")=>e.slice(0,4)===t.slice(0,4)?`${M(e)}${n}${M(t)}`:`${M(e)} ${e.slice(0,4)}${n}${M(t)} ${t.slice(0,4)}`;const k=e=>(Math.round(e/60*100)/100).toFixed(2),F=e=>`${Math.floor(e/60)}:${t(Math.round(e)%60)}`},1109,[]); +__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.payFor=u,_e.useVenuePay=function(s){const r=(0,n.useRestaurant)(s),o=(0,t.useOnboard)(e=>e.answers);return(0,e.useMemo)(()=>u(s,r?.settings.pay,o),[s,r?.settings.pay,o])},_e.venueRange=function(e,n,t,s){const u='wage'===n?(0,r.wagePeriod)(e,(0,r.ymdOf)(s),t):(0,r.tipsPeriod)(e,(0,r.ymdOf)(s),t),o=(0,r.dateOf)(u.start);o.setHours(0,0,0,0);const y=(0,r.dateOf)(u.end);return y.setHours(0,0,0,0),{s:o,e:y,key:u.key,payday:u.payday}};var e=_r(d[0]),n=_r(d[1]),t=_r(d[2]),s=_r(d[3]),r=_r(d[4]);function u(e,n,t){if(n)return{pay:(0,r.cleanPay)(n),source:'settings'};const u=t[e]?.pay??s.SEEDED_ANSWERS[e]?.pay;return u?{pay:(0,r.cleanPay)(u),source:'questionnaire'}:{pay:r.FALLBACK_PAY,source:'none'}}},1110,[30,1020,1111,1275,1109]); +__d(function(_g,r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useOnboard",{enumerable:!0,get:function(){return l}});var e,s=r(_d[0]),t=(e=s)&&e.__esModule?e:{default:e},p=r(_d[1]),u=r(_d[2]);const n=()=>{const e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`},l=(0,p.create)()((0,u.persist)(e=>({setup:{},answers:{},goals:{},replay:null,markStep:(s,t,p)=>e(e=>({setup:{...e.setup,[s]:{...e.setup[s]??{steps:{}},steps:{...e.setup[s]?.steps??{},[t]:p}}}})),welcome:s=>e(e=>({setup:{...e.setup,[s]:{...e.setup[s]??{steps:{}},welcomed:n()}}})),finish:s=>e(e=>({replay:null,setup:{...e.setup,[s]:{...e.setup[s]??{steps:{}},welcomed:e.setup[s]?.welcomed??n(),finished:n()}}})),restart:s=>e(e=>({setup:{...e.setup,[s]:{steps:{}}}})),setReplay:s=>e({replay:s}),saveAnswers:(s,t)=>e(e=>({answers:{...e.answers,[s]:t}})),setGoal:(s,t)=>e(e=>{const p={...e.goals};return t?p[s]=t:delete p[s],{goals:p}})}),{name:'covercharge-onboard-v1',version:1,storage:(0,u.createJSONStorage)(()=>t.default),partialize:e=>({setup:e.setup,answers:e.answers,goals:e.goals})}))},1111,[1115,951,1116]); +__d(function(g,_r,i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"KIND_LABEL",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"TEMP_KINDS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"isTempKind",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"SECTIONS",{enumerable:!0,get:function(){return r}}),Object.defineProperty(_e,"SECTION_LABEL",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"sectionOf",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"initialsOf",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"DEFAULT_POINTS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"limitText",{enumerable:!0,get:function(){return d}}),_e.inRange=u,_e.spokenNumber=p,_e.parseQuick=function(e,n){return e.split(/[,;\n]+|\s+and\s+|\.\s+/i).map(e=>e.trim()).filter(Boolean).map(e=>{const r=e.toLowerCase().replace(/[\u2010\u2013]/g,'-').replace(/-(?!\d)/g,' '),o=` ${r.replace(/[^a-z0-9.\- ]/g,' ').replace(/\s+/g,' ')} `;let a,l=0;for(const e of n)for(const n of[e.name.toLowerCase(),...e.aliases]){const t=n.replace(/-/g,' ').replace(/[^a-z0-9 ]/g,' ').replace(/\s+/g,' ').trim();t&&o.includes(` ${t} `)&&t.length>l&&(a=e,l=t.length)}const s=p(r);return a?t(a.kind)?null==s?{text:e,point:a,value:null,problem:'No temperature heard \u2014 type it in.'}:{text:e,point:a,value:s}:{text:e,point:a,value:null}:{text:e,value:s,problem:'Not sure which check this is \u2014 pick it below or type it.'}})},_e.missedChecks=function(e,n,t){const r=new Date(t);r.setHours(0,0,0,0);const o=60*t.getHours()+t.getMinutes(),a=[];for(const l of e){const e=l.due.filter(e=>f(e)<=o);if(!e.length)continue;const s=e[e.length-1],c=r.getTime()+6e4*f(e[0])-108e5,d=n.filter(e=>e.pointId===l.id&&new Date(e.at).getTime()>=c&&new Date(e.at).getTime()<=t.getTime()),u=e.length;d.lengthe.map(y).join(',')).join('\r\n')+'\r\n'},Object.defineProperty(_e,"SLOTS",{enumerable:!0,get:function(){return w}}),Object.defineProperty(_e,"SLOT_LABEL",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"SLOT_HINT",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"slotOf",{enumerable:!0,get:function(){return C}}),_e.todayTasks=function(e,n,t){const r=new Date(t);r.setHours(0,0,0,0);const o=60*t.getHours()+t.getMinutes(),a=[];for(const l of e){const e=[...l.due].sort();if(!e.length)continue;const s=r.getTime()+6e4*f(e[0])-108e5,c=n.filter(e=>e.pointId===l.id&&new Date(e.at).getTime()>=s&&new Date(e.at).getTime()<=t.getTime()).reverse().sort((e,n)=>e.at.localeCompare(n.at));e.forEach((e,n)=>{const t=c[n],r=f(e),s=t?'done':o>=r?'overdue':o>=r-60?'due':'upcoming';a.push({key:`${l.id}@${e}`,point:l,due:e,slot:C(e),status:s,entry:t})})}return a.sort((e,n)=>e.due.localeCompare(n.due)||e.point.name.localeCompare(n.point.name))},_e.unitStatus=function(e,n,t){const r=n.filter(n=>n.pointId===e.id&&null!=n.value).reverse().sort((e,n)=>e.at.localeCompare(n.at)),o=r[r.length-1];if(!o)return{rag:'none',history:r,why:'No readings yet'};const a=o.value;if(!u(e,a))return{rag:'red',latest:o,history:r,why:'Out of range'};const l=new Date(t);if(l.setHours(0,0,0,0),new Date(o.at).getTime()e.max-1||null!=e.min&&an.includes(e),r=['cross','cleaning','chilling','cooking','management'],o={cross:'Cross-contamination',cleaning:'Cleaning',chilling:'Chilling',cooking:'Cooking',management:'Management'},a={fridge:'chilling',freezer:'chilling',cool:'chilling',delivery:'chilling',cook:'cooking',hothold:'cooking',cleaning:'cleaning',allergen:'cross',check:'management'},l=e=>e.section??a[e.kind],s=e=>e.replace(' (example)','').split(/\s+/).filter(Boolean).map(e=>e[0]).join('').slice(0,3).toUpperCase(),c=[{id:'cp-walkin',name:'Walk-in fridge',kind:'fridge',max:5,due:['09:00','16:00'],aliases:['walk in fridge','walkin fridge','walk in','walk-in','walkin','cold room']},{id:'cp-prep',name:'Prep fridge',kind:'fridge',max:5,due:['09:00','16:00'],aliases:['prep fridge','prep']},{id:'cp-bar',name:'Bar fridge',kind:'fridge',max:5,due:['16:00'],aliases:['bar fridge','bar']},{id:'cp-freezer',name:'Freezer',kind:'freezer',max:-18,due:['09:00','16:00'],aliases:['freezer','chest freezer']},{id:'cp-cook',name:'Cooking: core temperature',kind:'cook',min:75,due:[],aliases:['core','cook','cooking','probe']},{id:'cp-cool',name:'Cooling: within 90 minutes',kind:'cool',max:8,due:[],aliases:['cooling','cool']},{id:'cp-hothold',name:'Hot hold: bain-marie',kind:'hothold',min:63,due:['18:00'],aliases:['hot hold','bain marie','bain-marie','hothold']},{id:'cp-del-chill',name:'Delivery: chilled',kind:'delivery',max:8,due:[],aliases:['chilled delivery','delivery chilled','delivery']},{id:'cp-del-frozen',name:'Delivery: frozen',kind:'delivery',max:-15,due:[],aliases:['frozen delivery','delivery frozen']},{id:'cp-clean',name:'Close-down clean signed off',kind:'cleaning',due:['23:00'],aliases:['cleaning','clean down','close down']},{id:'cp-allergen',name:'Allergen matrix checked against today\u2019s specials',kind:'allergen',due:['11:00'],aliases:['allergen','allergens']},{id:'cp-open-equip',name:'Fridges, freezers and other equipment working',kind:'check',section:'management',due:['09:00'],aliases:['equipment']},{id:'cp-open-staff',name:'Staff fit for work, in clean work clothes',kind:'check',section:'management',due:['09:00'],aliases:['staff fit']},{id:'cp-open-surfaces',name:'Prep areas, surfaces and utensils clean and disinfected',kind:'cleaning',due:['09:00'],aliases:['surfaces','prep areas']},{id:'cp-open-pests',name:'No signs of pests',kind:'check',section:'cleaning',due:['09:00'],aliases:['pests','pest']},{id:'cp-open-hands',name:'Hand-wash basins: hot water, soap and paper towels',kind:'check',section:'cross',due:['09:00'],aliases:['hand wash','handwash','soap']},{id:'cp-open-probe',name:'Probe thermometer working, probe wipes available',kind:'check',section:'management',due:['09:00'],aliases:['probe wipes','thermometer']},{id:'cp-mid-boards',name:'Raw and ready-to-eat kept apart; colour-coded boards in use',kind:'check',section:'cross',due:['12:00'],aliases:['boards','raw and ready to eat']},{id:'cp-close-stored',name:'Food covered, labelled, dated and put away',kind:'check',section:'chilling',due:['22:00'],aliases:['labelled','covered']},{id:'cp-close-useby',name:'Food past its use-by date thrown away',kind:'check',section:'chilling',due:['22:00'],aliases:['use by','use-by']},{id:'cp-close-waste',name:'Waste removed and bins relined',kind:'check',section:'cleaning',due:['22:00'],aliases:['waste','bins']}],d=e=>null!=e.min&&null!=e.max?`${e.min}\xb0C to ${e.max}\xb0C`:null!=e.max?`${e.max}\xb0C or colder`:null!=e.min?`${e.min}\xb0C or hotter`:'Done / not done';function u(e,n){return(null==e.min||n>=e.min)&&(null==e.max||n<=e.max)}const m={zero:0,nought:0,one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12,thirteen:13,fourteen:14,fifteen:15,sixteen:16,seventeen:17,eighteen:18,nineteen:19,twenty:20,thirty:30,forty:40,fifty:50,sixty:60,seventy:70,eighty:80,ninety:90};function p(e){const n=e.toLowerCase().replace(/\u2212/g,'-').replace(/degrees?|\xb0c?|celsius|centigrade/g,' '),t=/\b(minus|negative)\b/.test(n),r=n.match(/-?\d+(?:[.,]\d+)?/);if(r){const e=Number(r[0].replace(',','.'));return t&&e>0?-e:e}const o=n.split(/[^a-z]+/).filter(Boolean);let a=null,l=null,s=!1;for(const e of o)if('point'!==e){if(e in m){if(s){l=m[e];break}a=(a??0)+m[e]}}else s=!0;if(null==a)return null;const c=null!=l?Number(`${a}.${l}`):a;return t?-c:c}const f=e=>{const[n,t]=e.split(':').map(Number);return 60*n+t};const h=e=>null!=e.value?`${e.value}\xb0C`:e.done?'Done':'Not done',y=e=>{const n=null==e?'':String(e);return/[",\n]/.test(n)?`"${n.replace(/"/g,'""')}"`:n},k=['Date','Time','Check','Type','Reading','Safe limit','Result','Corrective action','Note','Recorded by','Entry'];function b(n,t){return n.map(n=>{const r=new Date(n.at),o=t.find(e=>e.id===n.pointId);return[r.toLocaleDateString('en-GB'),r.toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}),n.name,e[n.kind],h(n),o?d(o):'',n.ok?'OK':'OUT OF RANGE',n.corrective??'',n.note??'',n.by,'probe'===n.source?'Wireless probe':'voice'===n.source?'Voice (confirmed)':'Typed']})}const w=['opening','midday','closing'],v={opening:'Opening',midday:'Midday',closing:'Closing'},O={opening:'until 11:00',midday:'11:00 to 16:00',closing:'from 16:00'},C=e=>{const n=f(e);return n<660?'opening':n<960?'midday':'closing'};const T=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`,x=['Opening and closing checks were done every day (or the reason is in the diary)','Every out-of-range reading has a corrective action','Probe thermometers checked (iced water / boiling water) this week','Allergen information is up to date for menu and special changes','Cleaning schedule followed; no signs of pests','Staff trained on any changed safe methods']},1112,[]); +__d(function(g,r,_i,_a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"setMenuCardBridge",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"menuCardBridge",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"resolveItem",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"resolveMenu",{enumerable:!0,get:function(){return m}}),e.sortMenu=c;var t=r(d[0]);let n=null;const o=t=>{n=t},u=()=>n,i=o=>(0,t.overlayItem)(o,n?.cardFor(o.id)),m=t=>c(t.map(i));function c(t){return t.some(t=>'number'==typeof t.sort)?t.map((t,n)=>({m:t,i:n,k:'number'==typeof t.sort?t.sort:10*n})).sort((t,n)=>t.k-n.k||t.i-n.i).map(t=>t.m):t}},1113,[1103]); +__d(function(_g,_r,i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.nextTablesFree=function(t,r,o,l,u=[]){const m=`${l.getFullYear()}-${String(l.getMonth()+1).padStart(2,'0')}-${String(l.getDate()).padStart(2,'0')}`,f=(0,a.lastFoodOn)(t,m),d=f?new Date(`${m}T${f.time}:00`):null,b=t=>o.filter(a=>a.date===m&&'confirmed'===a.status&&(a.table??'').split('+').map(t=>t.trim()).includes(t)).map(t=>new Date(`${t.date}T${t.time}:00`)).filter(t=>t>=s(l,-20)).sort((t,a)=>t.getTime()-a.getTime())[0],c=[],g=[];for(const o of Object.values(r)){const r=o.table.name,m=b(r);if('free'===o.status){(!m||m>s(l,60))&&c.push(r);continue}if(!n.includes(o.status)||!o.booking)continue;const f=o.booking,h=f.seatedAt?new Date(f.seatedAt):new Date(`${f.date}T${f.time}:00`),$=(0,a.dwellFor)(t,f.partySize,u);let w=s(h,$.mins),T='maybe',p=`seated ${Math.max(0,Math.round((l.getTime()-h.getTime())/6e4))} min, usual ${$.mins} min`;'bill'===o.status?(w=s(l,10),T='likely',p='bill requested'):'dessert'===o.status?(w=new Date(Math.min(w.getTime(),s(l,25).getTime())),T='likely',p='on dessert'):'mains'===o.status&&(w=new Date(Math.min(Math.max(w.getTime(),s(l,35).getTime()),s(l,60).getTime())),p='mains out'),w=d?{drinksOnly:!0}:{}})}g.sort((t,a)=>t.at.getTime()-a.at.getTime());const h=Object.values(r).filter(t=>'blocked'!==t.status).length,$=h>0&&c.length<=Math.max(1,Math.round(.1*h));return{full:$,freeNow:c,list:g,waitFor:t=>g.find(a=>a.seats>=t)??null}},Object.defineProperty(e,"hhmm",{enumerable:!0,get:function(){return r}}),e.nextFreeSentence=function(a,n){if(a.freeNow.length&&!a.full)return`There are ${a.freeNow.length} tables free now: ${a.freeNow.slice(0,4).map(t=>`table ${t}`).join(', ')}.`;const s=a.list[0];if(!s)return a.freeNow.length?`${(0,t.tableNumbers)(a.freeNow[0])} is free now.`:'No table is due to free up before the bookings that follow; check the bookings list.';const o=Math.max(5,Math.round((s.at.getTime()-n.getTime())/6e4)),l=a.waitFor(2),u=a.waitFor(4);return`Next table free about ${r(s.at)} (table ${s.table}, ${s.seats} seats), ${s.confidence}, in about ${o} minutes.${l?` A table for 2: about ${r(l.at)}.`:''}${u?` A table for 4: about ${r(u.at)}.`:''}${s.drinksOnly?' That\u2019s after last food orders, so drinks only.':''}`};var t=_r(_d[0]),a=_r(_d[1]);const n=['seated','mains','dessert','bill'],s=(t,a)=>new Date(t.getTime()+6e4*a);const r=t=>`${String(t.getHours()).padStart(2,'0')}:${String(t.getMinutes()).padStart(2,'0')}`},1114,[808,809]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return f}});var e,t=r(d[0]),u=(e=t)&&e.__esModule?e:{default:e},n=r(d[1]),f={getItem:e=>u.default.getItem((0,n.venueKey)(e)),setItem:(e,t)=>u.default.setItem((0,n.venueKey)(e),t),removeItem:e=>u.default.removeItem((0,n.venueKey)(e))}},1115,[1119,5]); +__d(function(g,_r,i,_a3,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"combine",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"createJSONStorage",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"devtools",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"persist",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"redux",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"subscribeWithSelector",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"unstable_ssrSafe",{enumerable:!0,get:function(){return S}});const e=(e,t)=>(n,r,o)=>(o.dispatch=t=>(n(n=>e(n,t),!1,t),t),o.dispatchFromDevtools=!0,{dispatch:(...e)=>o.dispatch(...e),...t}),t=e=>!!e.dispatchFromDevtools&&"function"==typeof e.dispatch,n=new Map,r=e=>{const t=n.get(e);return t?Object.fromEntries(Object.entries(t.stores).map(([e,t])=>[e,t.getState()])):{}},o=(e,t,r)=>{if(void 0===e)return{type:"untracked",connection:t.connect(r)};const o=n.get(r.name);if(o)return{type:"tracked",store:e,...o};const s={connection:t.connect(r),stores:{}};return n.set(r.name,s),{type:"tracked",store:e,...s}},s=(e,t,r)=>{if(void 0===t)return;const o=n.get(e);(null==o?void 0:o.stores[t])===r&&(delete o.stores[t],0===Object.keys(o.stores).length&&n.delete(e))},a=/^at (?:new |async )?(.+?) \(/,l=/^([^@]+)@/;function c(e){var t,n,r;if(!e)return;const o=e.split("\n"),s=o.findIndex(e=>e.includes("api.setState"));if(s<0)return;const c=(null==(t=o[s+1])?void 0:t.trim())||"";return(null==(n=a.exec(c))?void 0:n[1])||(null==(r=l.exec(c))?void 0:r[1])}const u=(e,a={})=>(l,u,p)=>{const{enabled:f,anonymousActionType:y,store:h,...b}=a;let S;try{S=(null!=f?f:"production"!==(globalThis.__ExpoImportMetaRegistry.env?globalThis.__ExpoImportMetaRegistry.env.MODE:void 0))&&window.__REDUX_DEVTOOLS_EXTENSION__}catch(e){}if(!S)return e(l,u,p);const{connection:O,..._}=o(h,S,b);let w,E=!0;p.setState=(e,t,n)=>{const o=l(e,t);if(!E)return o;const s=void 0===n?{type:y||c((new Error).stack)||"anonymous"}:"string"==typeof n?{type:n}:n;return void 0===h?(null==O||O.send(s,u()),o):(null==O||O.send({...s,type:`${h}/${s.type}`},{...r(b.name),[h]:p.getState()}),o)},p.devtools={cleanup:()=>{null==w||w(),w=void 0,s(b.name,h,p),void 0!==h&&n.has(b.name)||!O||"function"!=typeof O.unsubscribe||O.unsubscribe()}};const I=(...e)=>{const t=E;E=!1,l(...e),E=t},j=e(p.setState,u,p);if("untracked"===_.type?null==O||O.init(j):(_.stores[_.store]=p,null==O||O.init(Object.fromEntries(Object.entries(_.stores).map(([e,t])=>[e,e===_.store?j:t.getState()])))),t(p)){let e=!1;const t=p.dispatch;p.dispatch=(...n)=>{"production"===(globalThis.__ExpoImportMetaRegistry.env?globalThis.__ExpoImportMetaRegistry.env.MODE:void 0)||"__setState"!==n[0].type||e||(console.warn('[zustand devtools middleware] "__setState" action type is reserved to set state from the devtools. Avoid using it.'),e=!0),t(...n)}}return w=O.subscribe(e=>{var n;const o="object"==typeof b.serialize?b.serialize.reviver:void 0;switch(e.type){case"ACTION":return"string"!=typeof e.payload?void console.error("[zustand devtools middleware] Unsupported action format"):v(e.payload,o,e=>{if("__setState"===e.type){if(void 0===h)return void I(e.state);1!==Object.keys(e.state).length&&console.error("\n [zustand devtools middleware] Unsupported __setState action format.\n When using 'store' option in devtools(), the 'state' should have only one key, which is a value of 'store' that was passed in devtools(),\n and value of this only key should be a state object. Example: { \"type\": \"__setState\", \"state\": { \"abc123Store\": { \"foo\": \"bar\" } } }\n ");const t=e.state[h];if(null==t)return;return void(JSON.stringify(p.getState())!==JSON.stringify(t)&&I(t))}t(p)&&p.dispatch(e)});case"DISPATCH":switch(e.payload.type){case"RESET":return I(j),void 0===h?null==O?void 0:O.init(p.getState()):null==O?void 0:O.init(r(b.name));case"COMMIT":return void 0===h?void(null==O||O.init(p.getState())):null==O?void 0:O.init(r(b.name));case"ROLLBACK":return v(e.state,o,e=>{if(void 0===h)return I(e),void(null==O||O.init(p.getState()));I(e[h]),null==O||O.init(r(b.name))});case"JUMP_TO_STATE":case"JUMP_TO_ACTION":return v(e.state,o,e=>{void 0!==h?JSON.stringify(p.getState())!==JSON.stringify(e[h])&&I(e[h]):I(e)});case"IMPORT_STATE":{const{nextLiftedState:t}=e.payload,r=null==(n=t.computedStates.slice(-1)[0])?void 0:n.state;if(!r)return;return I(void 0===h?r:r[h]),void(null==O||O.send(null,t))}case"PAUSE_RECORDING":return E=!E}return}}),j},v=(e,t,n)=>{let r;try{r=JSON.parse(e,t)}catch(e){console.error("[zustand devtools middleware] Could not parse the received json",e)}void 0!==r&&n(r)},p=e=>(t,n,r)=>{const o=r.subscribe;r.subscribe=(e,t,n)=>{let s=e;if(t){const o=(null==n?void 0:n.equalityFn)||Object.is;let a=e(r.getState());s=n=>{const r=e(n);if(!o(a,r)){const e=a;t(a=r,e)}},(null==n?void 0:n.fireImmediately)&&t(a,a)}return o(s)};return e(t,n,r)};function f(e,t){return(...n)=>Object.assign({},e,t(...n))}function y(e,t){let n;try{n=e()}catch(e){return}return{getItem:e=>{var r;const o=e=>null===e?null:JSON.parse(e,null==t?void 0:t.reviver),s=null!=(r=n.getItem(e))?r:null;return s instanceof Promise?s.then(o):o(s)},setItem:(e,r)=>n.setItem(e,JSON.stringify(r,null==t?void 0:t.replacer)),removeItem:e=>n.removeItem(e)}}const h=e=>t=>{try{const n=e(t);return n instanceof Promise?n:{then:e=>h(e)(n),catch(e){return this}}}catch(e){return{then(e){return this},catch:t=>h(t)(e)}}},b=(e,t)=>(n,r,o)=>{let s={storage:y(()=>window.localStorage),partialize:e=>e,version:0,merge:(e,t)=>({...t,...e}),...t},a=!1,l=0;const c=new Set,u=new Set;let v=s.storage;if(!v)return e((...e)=>{console.warn(`[zustand persist middleware] Unable to update item '${s.name}', the given storage is currently unavailable.`),n(...e)},r,o);const p=()=>{const e=s.partialize({...r()});return v.setItem(s.name,{state:e,version:s.version})},f=o.setState;o.setState=(...e)=>(f(...e),p());const b=e((...e)=>(n(...e),p()),r,o);let S;o.getInitialState=()=>b;const O=()=>{var e,t;if(!v)return;const o=++l;a=!1,c.forEach(e=>{var t;return e(null!=(t=r())?t:b)});const f=(null==(t=s.onRehydrateStorage)?void 0:t.call(s,null!=(e=r())?e:b))||void 0;return h(v.getItem.bind(v))(s.name).then(e=>{if(e){if("number"!=typeof e.version||e.version===s.version)return[!1,e.state];if(s.migrate){const t=s.migrate(e.state,e.version);return t instanceof Promise?t.then(e=>[!0,e]):[!0,t]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}return[!1,void 0]}).then(e=>{var t;if(o!==l)return;const[a,c]=e;return S=s.merge(c,null!=(t=r())?t:b),n(S,!0),a?p():void 0}).then(()=>{o===l&&(null==f||f(r(),void 0),S=r(),a=!0,u.forEach(e=>e(S)))}).catch(e=>{o===l&&(null==f||f(void 0,e))})};return o.persist={setOptions:e=>{s={...s,...e},e.storage&&(v=e.storage)},clearStorage:()=>{++l,null==v||v.removeItem(s.name)},getOptions:()=>s,rehydrate:()=>O(),hasHydrated:()=>a,onHydrate:e=>(c.add(e),()=>{c.delete(e)}),onFinishHydration:e=>(u.add(e),()=>{u.delete(e)})},s.skipHydration||O(),S||b};function S(e,t="undefined"==typeof window){return(n,r,o)=>{if(!t)return e(n,r,o);const s=()=>{throw new Error("Cannot set state of Zustand store in SSR")};return o.setState=s,e(s,r,o)}}},1116,[]); +__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useKitchenExtra",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"isManagerish",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"isHeadChef",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"isKitchenStaff",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"kitchenByRule",{enumerable:!0,get:function(){return l}}),_e.inKitchen=b,_e.inChannel=function(e,t){return!!t&&(e.startsWith('dm:')?e.split(':').slice(1).includes(t.id):'all'===e||('kitchen'===e?b(t):'managers'===e?o(t):'foh'===e&&(o(t)||/front|bar|server|waiting/i.test(t.job))))},Object.defineProperty(_e,"dmId",{enumerable:!0,get:function(){return h}});var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},c=r(d[1]),a=r(d[2]);const u=(0,c.create)()((0,a.persist)(e=>({extra:{},set:(t,n)=>e(e=>{const c={...e.extra};return null==n?delete c[t]:c[t]=n,{extra:c}})}),{name:'covercharge-kitchen-chat-v1',version:1,storage:(0,a.createJSONStorage)(()=>n.default)})),o=e=>!!e&&'staff'!==e.role,s=e=>!!e&&/head chef/i.test((e.level??'')+' '+e.job),f=e=>!!e&&(/^kitchen$/i.test(e.dept??'')||/chef|kitchen|\bkp\b|porter/i.test(e.job)),l=e=>!!e&&(o(e)||s(e)||f(e));function b(e){if(!e||!e.active)return!1;return u.getState().extra[e.id]??l(e)}const h=(e,t)=>`dm:${[e,t].sort().join(':')}`},1117,[1115,951,1116]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.setLiveData=c,e.requireRealData=function(){t=!0,c(!0)},Object.defineProperty(e,"liveData",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"examplesAllowed",{enumerable:!0,get:function(){return l}}),e.onDataModeChange=function(n){return s.add(n),()=>{s.delete(n)}},Object.defineProperty(e,"EXAMPLE_LABEL",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"notEnoughTip",{enumerable:!0,get:function(){return b}});const n=['anchorage','souters','kirkmichael','wildings','kirkton','abbotsford','greenside',"3idiots","cecchinis","mrbasrais","yasmins","williewastles","rupeeroom","smokinggoat","pizzaioli","drunkencoo"].includes("williewastles");let t=n,o=n;const s=new Set;function c(n){o!==(n=t||n)&&(o=n,s.forEach(n=>n()))}const u=()=>o,l=()=>!o;const f='Example figures',b=n=>`Forecasts start once CoverCharge has ${1===n?'1 week':`${n} weeks`} of your bookings and cash-ups.`},1118,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useAsyncStorage",{enumerable:!0,get:function(){return n.useAsyncStorage}}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return o}});var e,t=r(d[0]),u=(e=t)&&e.__esModule?e:{default:e},n=r(d[1]),o=u.default},1119,[1120,1124]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return i}});var e,t=r(d[0]);const o=((e=t)&&e.__esModule?e:{default:e}).default.bind({concatArrays:!0,ignoreUndefined:!0});function n(e,t){const n=window.localStorage.getItem(e);if(n){const l=JSON.parse(n),c=JSON.parse(t),s=JSON.stringify(o(l,c));window.localStorage.setItem(e,s)}else window.localStorage.setItem(e,t)}function l(e,t){return new Promise((o,n)=>{try{const n=e();t?.(null,n),o(n)}catch(e){t?.(e),n(e)}})}function c(e,t,o){return Promise.all(e).then(e=>{const n=o?.(e)??null;return t?.(null,n),Promise.resolve(n)},e=>(t?.(e),Promise.reject(e)))}const s={getItem:(e,t)=>l(()=>window.localStorage.getItem(e),t),setItem:(e,t,o)=>l(()=>window.localStorage.setItem(e,t),o),removeItem:(e,t)=>l(()=>window.localStorage.removeItem(e),t),mergeItem:(e,t,o)=>l(()=>n(e,t),o),clear:e=>l(()=>window.localStorage.clear(),e),getAllKeys:e=>l(()=>{const e=window.localStorage.length,t=[];for(let o=0;o{},multiGet:(e,t)=>c(e.map(e=>s.getItem(e)),t,t=>t.map((t,o)=>[e[o],t])),multiSet:(e,t)=>c(e.map(e=>s.setItem(e[0],e[1])),t),multiRemove:(e,t)=>c(e.map(e=>s.removeItem(e)),t),multiMerge:(e,t)=>c(e.map(e=>s.mergeItem(e[0],e[1])),t)};var i=s},1120,[1121]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u}});var e,t=r(d[0]),u=((e=t)&&e.__esModule?e:{default:e}).default},1121,[1122]); +__d(function(g,r,i,a,m,e,d){'use strict';const t=r(d[0]),{hasOwnProperty:n}=Object.prototype,{propertyIsEnumerable:o}=Object,c=(t,n,o)=>Object.defineProperty(t,n,{value:o,writable:!0,enumerable:!0,configurable:!0}),s=this,f={concatArrays:!1,ignoreUndefined:!1},l=t=>{const c=[];for(const o in t)n.call(t,o)&&c.push(o);if(Object.getOwnPropertySymbols){const n=Object.getOwnPropertySymbols(t);for(const s of n)o.call(t,s)&&c.push(s)}return c};function u(n){return Array.isArray(n)?y(n):t(n)?p(n):n}function y(t){const n=t.slice(0,0);return l(t).forEach(o=>{c(n,o,u(t[o]))}),n}function p(t){const n=null===Object.getPrototypeOf(t)?Object.create(null):{};return l(t).forEach(o=>{c(n,o,u(t[o]))}),n}const b=(t,n,o,s)=>(o.forEach(o=>{void 0===n[o]&&s.ignoreUndefined||(o in t&&t[o]!==Object.getPrototypeOf(t)?c(t,o,h(t[o],n[o],s)):c(t,o,u(n[o])))}),t),O=(t,o,s)=>{let f=t.slice(0,0),y=0;return[t,o].forEach(o=>{const p=[];for(let s=0;s!p.includes(t)),s)}),f};function h(n,o,c){return c.concatArrays&&Array.isArray(n)&&Array.isArray(o)?O(n,o,c):t(o)&&t(n)?b(n,o,l(o),c):u(o)}m.exports=function(...n){const o=h(u(f),this!==s&&this||{},f);let c={_:{}};for(const s of n)if(void 0!==s){if(!t(s))throw new TypeError('`'+s+'` is not an Option Object');c=h(c,{_:s},o)}return c._}},1122,[1123]); +__d(function(g,r,i,a,m,e,d){'use strict';m.exports=t=>{if('[object Object]'!==Object.prototype.toString.call(t))return!1;const o=Object.getPrototypeOf(t);return null===o||o===Object.prototype}},1123,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.useAsyncStorage=function(e){return{getItem:(...t)=>u.default.getItem(e,...t),setItem:(...t)=>u.default.setItem(e,...t),mergeItem:(...t)=>u.default.mergeItem(e,...t),removeItem:(...t)=>u.default.removeItem(e,...t)}};var e,t=r(d[0]),u=(e=t)&&e.__esModule?e:{default:e}},1124,[1120]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"createStore",{enumerable:!0,get:function(){return n}});const t=t=>{let n;const c=new Set,o=(t,o)=>{const s="function"==typeof t?t(n):t;if(!Object.is(s,n)){const t=n;n=(null!=o?o:"object"!=typeof s||null===s)?s:Object.assign({},n,s),c.forEach(c=>c(n,t))}},s=()=>n,u={setState:o,getState:s,getInitialState:()=>l,subscribe:t=>(c.add(t),()=>c.delete(t))},l=n=t(o,s,u);return u},n=n=>n?t(n):t},1125,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"create",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"useStore",{enumerable:!0,get:function(){return o}});var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},u=r(d[1]);const c=e=>e;function o(e,t=c){const u=n.default.useSyncExternalStore(e.subscribe,n.default.useCallback(()=>t(e.getState()),[e,t]),()=>t(e.getInitialState()));return n.default.useDebugValue(u),u}const s=e=>{const t=(0,u.createStore)(e),n=e=>o(t,e);return Object.assign(n,t),n},l=e=>e?s(e):s},1126,[30,1125]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"WILDINGS_LOCATION",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"WILDINGS_ADDRESS",{enumerable:!0,get:function(){return t}}),e.withWildingsAddress=function(r){return'wildings'===r.id?{...r,location:n,address:t}:r},e.withWildingsQuestionnaireAddress=function(n,r){return'wildings'===n&&r?{...r,venue:{...r.venue,address:t}}:r};const n='Maidens, KA26 9NR',t='Maidens Road, Maidens, KA26 9NR'},1127,[]); +__d(function(g,r,_i,_a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.sampleFingerprint=i,e.stripOwnerLiveSamples=function(n){const a={};for(const[s,o]of Object.entries(t.OWNER_SAMPLE_HASHES)){const t=n[s]||[];a[s]=t.filter(t=>!o.includes(i(t)))}a.chat=(n.chat||[]).filter(t=>!(0,s.isSeedChefChat)(t));const o=(n.changeRequests||[]).length-a.changeRequests.length;o&&(a.changesUsed=Math.max(0,(n.changesUsed||0)-o));return a},e.stripCoreLiveSamples=function(a){const c={...(0,n.stripCoreChefSamples)(a)};c.giftCards=(a.giftCards||[]).filter(s=>!t.CORE_SAMPLE_HASHES.giftCards.includes(i(s))),c.stampCards=(a.stampCards||[]).filter(s=>!t.CORE_SAMPLE_HASHES.stampCards.includes(i(s))),c.ratings=(a.ratings||[]).filter(t=>!(/^rt-[123]$/.test(t.id)&&(0,s.demoActor)(t.customerName))),i(a.customer)===t.LEGACY_CUSTOMER_HASH&&(c.customer={...a.customer,id:'',name:'',email:'',phone:'',allergies:[],allergyConsent:!1,referralCode:'',marketingOptIn:{}});return c.restaurants=(a.restaurants||[]).filter(t=>!('saltmarsh'===t.id&&['The Venue','Saltmarsh Bistro'].includes(t.name))),c.menu=(c.menu||a.menu||[]).filter(t=>'saltmarsh'!==t.restaurantId).map(t=>t.signOff?t:o(t)),c};var t=r(d[0]),s=r(d[1]),n=r(d[2]);const a=t=>Array.isArray(t)?t.map(a):t&&'object'==typeof t?Object.fromEntries(Object.entries(t).filter(([,t])=>void 0!==t&&'function'!=typeof t).sort(([t],[s])=>ts?1:0).map(([t,s])=>[t,a(s)])):t;function i(t){const s=JSON.stringify(a(t))??"null";let n=2166136261;for(let t=0;t>>0).toString(16)}const o=t=>Array.isArray(t)?t.map(o):t&&'object'==typeof t?Object.fromEntries(Object.entries(t).map(([t,s])=>[t,'allergenNotes'===t&&'string'==typeof s&&/\(example\)/i.test(s)?'':o(s)])):t},1128,[1129,1023,1130]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"OWNER_SAMPLE_HASHES",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"CORE_SAMPLE_HASHES",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"LEGACY_CUSTOMER_HASH",{enumerable:!0,get:function(){return b}});const c={referrals:["43f09bc0","c438fbad","96bf8c62","3399d421"],coats:["f51097ad","2f7efa3a"],merch:["ef6e14e","dbbc0999","dc233c1d"],merchOrders:["13b15512","bc27f242"],offers:["ad0fcde0","59e6c0cf"],photos:["53a60fd9","ab778a74","95de43cd"],changeRequests:["81c5be12","6819542c"],lost:["5bbf0d77","7d3aa9ed","850c049e"],campaigns:["9cdf8346","82150e7"],suppliers:["41df06e7","466e32ac","fa3d8eea","dfafa674","1e26fbd0","c195b120","5fc49e74","6aa8b0af","602fc2e4"],supplierOrders:["22636226","464d6a6a"]},f={giftCards:["b1bba36d","f029bc0e"],stampCards:["e7bedf6f","a3c8404d"]},b="4b1e9971"},1129,[]); +__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.stripCoreChefSamples=function(n){return{bookings:(n.bookings||[]).filter(n=>!((0,e.isAnchorage)(n.restaurantId)&&t[n.id]===n.name)),orders:(n.orders||[]).filter(t=>!((0,e.isAnchorage)(t.restaurantId)&&('ord-seed-1'===t.id&&'R. Gilmour'===t.customerName||'ord-seed-2'===t.id&&'Table 3 guest'===t.customerName))),waitlist:(n.waitlist||[]).filter(t=>!((0,e.isAnchorage)(t.restaurantId)&&('wl-1'===t.id&&'Paterson'===t.name||'wl-2'===t.id&&'Duncan'===t.name))),menu:(n.menu||[]).map(t=>(0,e.isAnchorage)(t.restaurantId)&&(0,e.demoActor)(t.signOff?.by)?{...t,signOff:null}:t),events:(n.events||[]).filter(e=>!(e.example&&('anchorage'===e.restaurantId||null===e.restaurantId))),audit:(n.audit||[]).filter(e=>!('anchorage'===e.restaurantId&&/Example sign-off \(demo\)/i.test(e.text)))}};var e=r(d[0]);const t={'bk-101':'Campbell','bk-102':'Fraser','bk-103':'McLeod','bk-104':'Kerr','bk-105':'Wallace','bk-106':'Boyd','bk-107':'Hamilton','bk-108':'Stewart','bk-109':'Murray'}},1130,[1023]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.archiveChefCache=async function(e,t){const n=JSON.stringify(t);let o=2166136261;for(let e=0;e>>0).toString(16)}`;const c=await i.default.getItem(s);if(c){if(JSON.stringify(JSON.parse(c).rows)===n)return;s+=`:${Date.now()}`}await i.default.setItem(s,JSON.stringify({at:(new Date).toISOString(),store:e,rows:t}))};var e,t=r(d[0]),i=(e=t)&&e.__esModule?e:{default:e}},1131,[1115]); +__d(function(g,_r,_i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"DEMO_CUSTOMER_ID",{enumerable:!0,get:function(){return c}}),_e.defaultSimStart=function(e=new Date){const t=new Date(e),r=(5-t.getDay()+7)%7;return t.setDate(t.getDate()+r),t.setHours(17,30,0,0),t},_e.buildSeed=function(d){if(r.LIVE_VENUE_BUILD&&!t.IS_ISOLATED_VENUE){const e=u(d);return{...e,restaurants:e.restaurants.filter(e=>'anchorage'===e.id),menu:o.anchorageMenu.map(e=>({...e,signOff:null})),bookings:[],waitlist:[],orders:[],stampCards:[],giftCards:[],events:e.events.filter(e=>!e.example),ratings:[],walkIns:{},counters:{order:0,table:0,booking:0},customer:{...e.customer,id:'',referralCode:'',name:'',email:'',phone:'',allergies:[],allergyConsent:!1,marketingOptIn:{}}}}return t.IS_ISOLATED_VENUE?{restaurants:[t.IS_QUEUED_VENUE?(0,e.queuedRestaurant)(t.VENUE_RID):t.IS_ABBOTSFORD?n.ABBOTSFORD_RESTAURANT:t.IS_KIRKTON?n.KIRKTON_RESTAURANT:t.IS_GREENSIDE?n.GREENSIDE_RESTAURANT:t.IS_WILDINGS?n.WILDINGS_RESTAURANT:t.IS_KIRKMICHAEL?n.KIRKMICHAEL_RESTAURANT:s.SOUTERS_RESTAURANT],menu:t.IS_SOUTERS?i.SOUTERS_MENU:[],customer:{id:'',name:'',email:'',phone:'',allergies:[],allergyConsent:!1,referralCode:'',marketingOptIn:{}},bookings:[],waitlist:[],orders:[],stampCards:[],giftCards:[],events:[],ratings:[],audit:[],alertAcks:{},walkIns:{},basket:{restaurantId:null,mode:'takeaway',lines:[]},counters:{order:0,table:0,booking:0}}:u(d)};var e=_r(_d[0]),t=_r(_d[1]),r=_r(_d[2]),n=_r(_d[3]),s=_r(_d[4]),i=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),l=_r(_d[8]);const c='cust-demo';function u(e){const t=(0,l.ymd)(e),r=e=>e.toISOString(),s=n.restaurants.map(e=>'anchorage'===e.id?{...e,sections:o.ANCHORAGE_SECTIONS}:e),i={id:c,name:'Alex Morgan',email:'alex.demo@example.com',phone:'07700 900123',allergies:[{allergen:'crustaceans',severity:'anaphylaxis'},{allergen:'mustard',severity:'allergy'}],allergyConsent:!0,referralCode:'ALEX-7K2Q',marketingOptIn:{anchorage:!0}},u=(n,s,i,o,d={})=>({id:n,ref:`BK-${n.slice(-3).toUpperCase()}`,restaurantId:'anchorage',customerId:null,name:s,partySize:i,date:t,time:o,allergies:[],notes:'',status:'confirmed',security:i>=6?'deposit':'none',depositPaid:0,...i>=6?{depositDue:1e3*i}:{},createdAt:r((0,l.addMins)(e,-4320)),...d}),m=[u('bk-101','Campbell',2,'17:00',{table:'12',status:'seated',seatedAt:r((0,l.addMins)(e,-28)),tags:['Regular']}),u('bk-102','Fraser',4,'17:30',{table:'10',tags:['VIP']}),u('bk-103','McLeod',2,'18:00',{table:'11',allergies:[{allergen:'gluten',severity:'coeliac'}],notes:'Anniversary',occasion:'anniversary'}),u('bk-104','Kerr',6,'18:00',{table:'18'}),u('bk-105','Wallace',3,'18:30',{table:'13'}),u('bk-106','Boyd',8,'19:00',{table:'1+2',dog:!0,allergies:[{allergen:'peanuts',severity:'anaphylaxis'}],notes:'Birthday \u2014 bringing a dog',occasion:'birthday'}),u('bk-107','Hamilton',2,'19:00',{table:'5'}),u('bk-108','Stewart',4,'19:30',{table:'19',tags:['Regular']}),u('bk-109','Murray',2,'20:00',{table:'16'})],p=[{id:'wl-1',restaurantId:'anchorage',number:1,name:'Paterson',partySize:2,joinedAt:r((0,l.addMins)(e,-12)),status:'waiting'},{id:'wl-2',restaurantId:'anchorage',number:2,name:'Duncan',partySize:4,joinedAt:r((0,l.addMins)(e,-4)),status:'waiting'}],h=(0,l.atTime)(e,'17:45'),I=[{id:'ord-seed-1',ref:'T-1041',restaurantId:'anchorage',customerId:'cust-other',customerName:'R. Gilmour',type:'takeaway',slotTime:r(h),lines:[{itemId:'a-fishsupper',name:'Fish Supper',qty:2,unitPrice:1800,choices:['Beer-battered'],notes:'',contains:[],may:[],overridden:!1,prepMins:12},{itemId:'a-chips',name:'Triple-Cooked Chips (V)',qty:1,unitPrice:450,choices:[],notes:'Extra salt',contains:[],may:[],overridden:!1,prepMins:6}],subtotal:4050,tip:0,giftCardApplied:0,total:4050,paid:4050,status:'acknowledged',createdAt:r((0,l.addMins)(e,-50)),allergies:[],readiness:{}},{id:'ord-seed-2',ref:'Q-2017',restaurantId:'anchorage',customerId:'cust-other2',customerName:'Table 3 guest',type:'table',tableNo:'3',lines:[{itemId:'a-moules',name:'Moules Marini\xe8re',qty:1,unitPrice:2200,choices:['Main 500g with triple-cooked chips (\xa322.00)'],notes:'',contains:[],may:[],overridden:!1,prepMins:10},{itemId:'a-claymore',name:'The Claymore Burger',qty:1,unitPrice:1800,choices:[],notes:'No gherkins',contains:[],may:[],overridden:!1,prepMins:14}],subtotal:4e3,tip:0,giftCardApplied:0,total:4e3,paid:0,status:'preparing',createdAt:r((0,l.addMins)(e,-18)),allergies:[],readiness:{}}],y=[{restaurantId:'anchorage',customerId:c,stamps:5,rewardsAvailable:0,history:[{at:'2026-08-15',source:'Dine-in (staff scan)'},{at:'2026-08-29',source:'Takeaway'},{at:'2026-09-12',source:'Table QR bill'},{at:'2026-10-02',source:'Takeaway'},{at:'2026-10-16',source:'Referral \u2014 friend\u2019s first visit'}]},{restaurantId:'saltmarsh',customerId:c,stamps:2,rewardsAvailable:0,history:[{at:'2026-09-01',source:'Dine-in'},{at:'2026-10-01',source:'Dine-in'}]}],b=[{id:'gc-1',code:'ANC-G7QX-4M2P-9TRE',restaurantId:'anchorage',initial:5e3,balance:2500,ownerId:c,recipientName:'Alex',message:'Happy birthday! (example)',createdAt:'2026-09-20'},{id:'gc-2',code:'WEB-OLD-10-EXAMPLE',restaurantId:'anchorage',initial:1e3,balance:1e3,ownerId:'legacy',recipientName:'Legacy website bookings voucher (example)',message:'',createdAt:'2026-06-01',legacy:!0}],k=[...d.SCOTTISH_BANK_HOLIDAYS.map((e,t)=>({id:`bh-${t}`,restaurantId:null,date:e.date,title:e.title+(e.notes&&!/substitute/i.test(e.notes)?` (${e.notes.toLowerCase()})`:''),kind:'bank-holiday',description:'Scottish bank holiday',example:!1,source:d.BANK_HOLIDAY_SOURCE})),{id:'ev-halloween',restaurantId:'anchorage',date:(0,l.ymd)(new Date(e.getFullYear(),9,31)),title:'Halloween weekend (example)',kind:'event',description:'Example event \u2014 busy weekend flag for the forecast.',example:!0},{id:'ev-xmas-party',restaurantId:'anchorage',date:'2026-12-04',title:'Christmas party nights begin (example)',kind:'event',description:'Example: festive set menu, deposit required for parties of 8+.',example:!0},{id:'ev-hogmanay',restaurantId:null,date:'2026-12-31',title:'Hogmanay',kind:'occasion',description:'Key dining date.',example:!1},{id:'ev-burns',restaurantId:'anchorage',date:'2027-01-25',title:'Burns Night Supper (example)',kind:'event',description:'EXAMPLE event: haggis, neeps & tatties, address to the haggis, set menu \xa348pp. Booking opens via the app.',example:!0},{id:'ev-valentines',restaurantId:null,date:'2027-02-14',title:"Valentine's Day",kind:'occasion',description:'Key dining date.',example:!1},{id:'ev-mothering',restaurantId:null,date:'2027-03-07',title:'Mothering Sunday (UK)',kind:'occasion',description:'Key dining date.',example:!1},{id:'ev-live',restaurantId:'anchorage',date:'2026-11-14',title:'Live acoustic music (example)',kind:'event',description:'EXAMPLE: local folk duo from 7pm.',example:!0},{id:'ev-school-xmas',restaurantId:null,date:'2026-12-23',title:'South Ayrshire schools close for Christmas',kind:'school-holiday',description:'23 Dec 2026 \u2013 4 Jan 2027',example:!1},{id:'ev-salt-quiz',restaurantId:'saltmarsh',date:'2026-11-05',title:'Quiz night (fictional)',kind:'event',description:'Fictional demo restaurant event.',example:!0}];return{restaurants:s,menu:[...o.anchorageMenu,...n.demoMenus],customer:i,bookings:m,waitlist:p,orders:I,stampCards:y,giftCards:b,events:k,ratings:[{id:'rt-1',restaurantId:'anchorage',customerId:'cust-x1',customerName:'Fiona (example)',stars:5,comment:'Best fish supper on the coast, and the staff were brilliant with my son\u2019s nut allergy.',createdAt:r((0,l.addMins)(e,-1560)),context:'Takeaway T-1032'},{id:'rt-2',restaurantId:'anchorage',customerId:'cust-x2',customerName:'Iain (example)',stars:4,comment:'Lovely langoustines. Bit of a wait for a table at 7.',createdAt:r((0,l.addMins)(e,-3e3)),context:'Dine-in, Table 6'},{id:'rt-3',restaurantId:'anchorage',customerId:'cust-x3',customerName:'Morag (example)',stars:2,comment:'Chips were cold by the time we collected.',createdAt:r((0,l.addMins)(e,-4320)),context:'Takeaway T-1019'}],audit:[],alertAcks:{},walkIns:{anchorage:6},basket:{restaurantId:null,mode:'takeaway',lines:[]},counters:{order:1042,table:2018,booking:110}}}},1132,[6,5,833,3,1133,1134,1135,1136,818]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SOUTERS_RESTAURANT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"SOUTERS_BOOKING_URL",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"SOUTERS_CONTACTS",{enumerable:!0,get:function(){return n}});const t={id:'souters',name:"Souter's Inn",tagline:'Culinary excellence meets country hospitality in Kirkoswald',location:'Kirkoswald, South Ayrshire',address:'47 Main Road, Kirkoswald, South Ayrshire KA19 8HY',phone:'01655 760653',website:'https://www.soutersinn.com/',fictional:!1,kitchenHours:{0:['09:00','21:00'],1:['09:00','21:00'],2:['09:00','21:00'],3:['09:00','21:00'],4:['09:00','21:00'],5:['09:00','21:00'],6:['09:00','21:00']},hoursNote:'Public hours: daily from 9am; food listed to 9pm. Closing time (9pm or 10pm) to confirm with the venue. Breakfast until 11.45am; main food from noon.',sections:[],settings:{slotMinutes:15,slotCap:3,bufferMins:5,leadMins:20,takeawayPaused:!0,bookingCoversPerSlot:16,stampTarget:8,stampReward:'',stampMinSpend:1e3,capacityPerHour:0,walkInShare:.35,turnMins:75,orderAtTable:!1,showTakeaway:!1,tableRequests:!0,shortName:"Souter's",deposit:{on:!1,perPersonPence:null,fromParty:null,refundable:null,cutoffHours:null,needsConfirmation:!0,wixLinksOn:!1,policy:'Table deposit policy not set. Ticketed event deposits are separate and are not a table policy.'}}},o='',n={email:'souters@southernayr.com',phone:'01655 760653'}},1133,[]); +__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SOUTERS_MENU",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"SOUTERS_MENU_COUNT",{enumerable:!0,get:function(){return t}});const s=[{id:"su-breakfast-full-breakfast",section:"Breakfast",name:"Full Breakfast",description:"Ayrshire Bacon, Link Sausage, Black Pudding, Potato Scone, Beans, Tomato, Mushrooms & Two Eggs (Poached, Scrambled or Fried) with White or Wholemeal Toast",price:1195,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-eggs-benedict",section:"Breakfast",name:"Eggs Benedict",description:"Two Poached Eggs along with Ayrshire Bacon served on Toasted Muffin topped with Hollandaise Sauce",price:1050,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-french-toast",section:"Breakfast",name:"French Toast",description:"Two Slices of Bloomer Eggy Bread with Ayrshire Bacon and a side of Maple Syrup",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-light-breakfast",section:"Breakfast",name:"Light Breakfast",description:"Ayrshire Bacon, Link Sausage, Beans, Tomato and Two Eggs served Poached, Scrambled or Fried with White or Wholemeal Toast",price:950,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-eggs-royale",section:"Breakfast",name:"Eggs Royale",description:"Two Poached Eggs with Flaked Smoked Salmon served on Toasted Muffin topped with Hollandaise Sauce",price:1150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-fried-scottish-pancakes",section:"Breakfast",name:"Fried Scottish Pancakes",description:"Scottish Pancakes with Ayrshire Bacon and a side of Maple Syrup",price:950,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-add-banana-to-fried-scottish-pancakes",section:"Breakfast add-ons",name:"Add Banana (to Fried Scottish Pancakes)",description:"",price:150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-add-two-eggs-poached-fried-or-scrambled-",section:"Breakfast add-ons",name:"Add Two Eggs \u2013 Poached, Fried or Scrambled (to Fried Scottish Pancakes)",description:"",price:200,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-vegetarian-breakfast",section:"Breakfast",name:"Vegetarian Breakfast",description:"Potato Scone, Tomato, Mushrooms, Beans and Two Eggs served Poached, Scrambled or Fried with White or Wholemeal Toast",price:925,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-smashed-avocado-benedict",section:"Breakfast",name:"Smashed Avocado Benedict",description:"Smashed Avocado Guacamole, 2 Poached Eggs served on Toasted Muffin topped with Hollandaise Sauce",price:1095,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-granola-bowl",section:"Breakfast",name:"Granola Bowl",description:"Almond and Raisin Granola topped with Berries, Natural Yoghurt and Honey",price:895,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-breakfast-burrito",section:"Breakfast",name:"Breakfast Burrito",description:"Crispy Bacon, Two Fried Eggs, Jalape\xf1o Salsa, Guacamole, Cheddar Cheese, Salad & Sour Cream",price:1150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-pancake-stack",section:"Breakfast",name:"Pancake Stack",description:"American style pancakes with Biscoff, Nutella, Chocolate Sauce & Fresh Strawberries",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-breakfast-roll",section:"Breakfast",name:"Breakfast Roll",description:"with a choice of Ayrshire Bacon, Pork Link Sausage, Potato Scone or Egg; 2 Items \xa34.75 | 3 Items \xa35.50",price:425,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-kids-breakfast",section:"Junior / Kids",name:"Kids Breakfast",description:"Pork Link Sausage, Beans, Potato Scone, served with a Slice of Toast",price:495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-kids-pancakes",section:"Junior / Kids",name:"Kids Pancakes",description:"American Style Pancakes served with Syrup, Nutella or Butter & Jam",price:495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-add-banana-or-strawberries-to-kids-panca",section:"Junior / Kids add-ons",name:"Add Banana or Strawberries (to Kids Pancakes)",description:"",price:150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-black-pudding-add-on",section:"Add-ons",name:"Black Pudding (add-on)",description:"",price:150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-beans-add-on",section:"Add-ons",name:"Beans (add-on)",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-smashed-avocado-add-on",section:"Add-ons",name:"Smashed Avocado (add-on)",description:"",price:200,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-pork-link-sausage-add-on",section:"Add-ons",name:"Pork Link Sausage (add-on)",description:"",price:150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-mushrooms-add-on",section:"Add-ons",name:"Mushrooms (add-on)",description:"",price:150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-tomato-add-on",section:"Add-ons",name:"Tomato (add-on)",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-ayrshire-bacon-2-add-on",section:"Add-ons",name:"Ayrshire Bacon (2) (add-on)",description:"",price:150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-haggis-add-on",section:"Add-ons",name:"Haggis (add-on)",description:"",price:150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-egg-add-on",section:"Add-ons",name:"Egg (add-on)",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-potato-scone-add-on",section:"Add-ons",name:"Potato Scone (add-on)",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-bucket-of-chips",section:"Add-ons",name:"Bucket of Chips",description:"",price:425,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-toasted-white-or-wholemeal-bread",section:"Add-ons",name:"Toasted White or Wholemeal Bread",description:"served with Butter and Preserve",price:450,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-white-coffee",section:"Coffee",name:"White Coffee",description:"",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-latte",section:"Coffee",name:"Latte",description:"",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-espresso",section:"Coffee",name:"Espresso",description:"",price:325,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-cappuccino",section:"Coffee",name:"Cappuccino",description:"",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-americano",section:"Coffee",name:"Americano",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-double-espresso",section:"Coffee",name:"Double Espresso",description:"",price:395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-macchiato",section:"Coffee",name:"Macchiato",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-flavour-shot-add-on",section:"Coffee add-ons",name:"Flavour Shot (add-on)",description:"",price:75,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-extra-shot-of-coffee-add-on",section:"Coffee add-ons",name:"Extra Shot of Coffee (add-on)",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-breakfast-tea",section:"Tea",name:"Breakfast Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-camomile-tea",section:"Tea",name:"Camomile Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-earl-grey-tea",section:"Tea",name:"Earl Grey Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-green-tea",section:"Tea",name:"Green Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-peppermint-tea",section:"Tea",name:"Peppermint Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-red-berry-tea",section:"Tea",name:"Red Berry Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-lemon-ginger-tea",section:"Tea",name:"Lemon & Ginger Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-hot-chocolate",section:"Hot chocolate",name:"Hot Chocolate",description:"",price:425,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-breakfast-luxury-hot-chocolate",section:"Hot chocolate",name:"Luxury Hot Chocolate",description:"with Cream & Marshmallows",price:475,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-freshly-baked-basket-of-bread-with-butte",section:"Starters / bread",name:"Freshly Baked Basket Of Bread With Butter",description:"",price:450,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-add-olive-oil-balsamic-vinegar",section:"Starters / bread",name:"Add Olive Oil & Balsamic Vinegar",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-soup-of-the-day",section:"Starters",name:"Soup of The Day",description:"served with Crusty Bread & Butter",price:650,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-a-la-carte-salad-of-poached-pear-blue-cheese",section:"Starters",name:"Salad Of Poached Pear & Blue Cheese",description:"with Candied Walnuts & French Vinaigrette",price:850,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-fresh-water-prawns",section:"Starters",name:"Fresh Water Prawns",description:"coated in Spicy Bang Bang Sauce, topped with Chopped Chilli, Peanuts & Coriander",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-sliced-melon-fresh-fruits",section:"Starters",name:"Sliced Melon & Fresh Fruits",description:"with Coulis & Raspberry Sorbet",price:850,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-chicken-liver-p-t",section:"Starters",name:"Chicken Liver P\xe2t\xe9",description:"with Oatcakes, Plum & Apple Chutney",price:850,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-crispy-salt-pepper-calamari",section:"Starters",name:"Crispy Salt & Pepper Calamari",description:"served with Garlic Mayo & Oriental Dressing",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-steamed-mussels",section:"Starters",name:"Steamed Mussels",description:"with White Wine, Garlic, Shallots & Cream, served with Garlic Bread",price:1150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-creamy-baked-garlic-mushrooms",section:"Starters",name:"Creamy Baked Garlic Mushrooms",description:"with a Cheddar Cheese Gratin",price:895,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-boiled-egg-crispy-bacon-caesar-salad",section:"Starters",name:"Boiled Egg & Crispy Bacon Caesar Salad",description:"with Parmesan & Croutons",price:850,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-grilled-honey-glazed-goat-s-cheese-salad",section:"Starters",name:"Grilled Honey Glazed Goat\u2019s Cheese Salad",description:"with Roquito Peppers & Chilli Jam",price:850,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-sticky-bbq-ribs-in-a-korean-gochujang-sa",section:"Starters",name:"Sticky BBQ Ribs in a Korean Gochujang Sauce",description:"with Onions, Peppers & Sesame Seeds",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-cioppino-fish-soup",section:"Starters",name:"Cioppino Fish Soup",description:"fired up with Fresh Chillies & Smoked Paprika, topped with Croutons & Parmesan",price:1095,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-8oz-fillet-steak",section:"From the grill",name:"8oz Fillet Steak",description:"All served with Tomatoes, Portobello Mushrooms, Onion Rings & your choice of Chips, Boiled or Mashed Potatoes. Includes choice of Peppercorn, Mustard or Red Wine Jus",price:3695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-10oz-sirloin-steak",section:"From the grill",name:"10oz Sirloin Steak",description:"All served with Tomatoes, Portobello Mushrooms, Onion Rings & your choice of Chips, Boiled or Mashed Potatoes. Includes choice of Peppercorn, Mustard or Red Wine Jus",price:3395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-rosemary-garlic-lamb-chops",section:"From the grill",name:"Rosemary & Garlic Lamb Chops",description:"All served with Tomatoes, Portobello Mushrooms, Onion Rings & your choice of Chips, Boiled or Mashed Potatoes. Includes choice of Peppercorn, Mustard or Red Wine Jus",price:2750,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-top-with-breaded-haggis-grill",section:"From the grill add-ons",name:"Top with Breaded Haggis (grill)",description:"",price:250,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-top-with-6-garlic-buttered-prawns-grill",section:"From the grill add-ons",name:"Top with 6 Garlic Buttered Prawns (grill)",description:"",price:750,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-steamed-fillet-of-salmon-with-cheese-gla",section:"Main courses",name:"Steamed Fillet of Salmon with Cheese Glaze",description:"served with Buttered Greens & Creamed Potatoes",price:2150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-breaded-haddock-chips",section:"Main courses",name:"Breaded Haddock & Chips",description:"with Homemade Tartare Sauce & Side Salad",price:1850,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-fish-of-the-day",section:"Main courses",name:"Fish of the Day",description:"Check Chef\u2019s Daily Specials",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,priceNote:"Ask staff",special:!0},{id:"su-a-la-carte-locally-caught-haggis-with-neeps-tatties",section:"Main courses",name:"Locally Caught Haggis with Neeps & Tatties",description:"served with Whisky Peppercorn Sauce & Greentails",price:1795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-breast-of-cajun-spiced-chicken",section:"Main courses",name:"Breast Of Cajun Spiced Chicken",description:"with Capsicums, Rice Pilaf & a Curried Coconut & Mango Chutney Sauce",price:1850,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-chicken-schnitzel",section:"Main courses",name:"Chicken Schnitzel",description:"Pan-Fried in Breadcrumbs, served with Crispy Bacon, Grilled Pineapple & Chips",price:1895,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-beef-steak-butcher-s-sausage-pie",section:"Main courses",name:"Beef Steak & Butcher\u2019s Sausage Pie",description:"with Creamed Potatoes & Buttered Carrots",price:1895,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-madras-spiced-lamb-curry",section:"Main courses",name:"Madras Spiced Lamb Curry",description:"with Chillies, Pineapple & Coriander, served with Aromatic Rice, Spiced Onions & a Poppadom",price:1895,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-pan-fried-lambs-liver",section:"Main courses",name:"Pan-Fried Lambs Liver",description:"with Saut\xe9ed Onions, Smoked Bacon, Grilled Tomato, Creamed Potatoes & Red Wine Gravy",price:1750,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-8oz-cheeseburger",section:"Main courses",name:"8oz Cheeseburger",description:"with Bacon, Peppered Mayo, Pickles & Tomato, served with Coleslaw & Chips",price:1795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-add-haggis-to-cheeseburger",section:"Main courses add-ons",name:"Add Haggis (to Cheeseburger)",description:"",price:250,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-panko-breaded-chicken-burger",section:"Main courses",name:"Panko Breaded Chicken Burger",description:"in a Toasted Brioche Bun, with Curried Slaw, Katsu Sauce & Chips",price:1795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-macaroni-cheese",section:"Main courses",name:"Macaroni Cheese",description:"with Leeks, English Mustard & Matured Cheddar, served with Garlic Bread",price:1795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-add-bacon-to-macaroni-cheese",section:"Main courses add-ons",name:"Add Bacon (to Macaroni Cheese)",description:"",price:150,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-penne-pasta-arrabbiata",section:"Main courses",name:"Penne Pasta Arrabbiata",description:"with Peppers, Vine Tomatoes, Chilli & Basil, served with Garlic Bread",price:1795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-melon-prawn-salad",section:"Salads",name:"Melon & Prawn Salad",description:"with Marie Rose Cocktail Dressing; served with a choice of Chips or Boiled Potatoes",price:1795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-ploughman-s-salad",section:"Salads",name:"Ploughman\u2019s Salad",description:"Souter\u2019s Sausage Roll, Matured Cheddar, Pickle, Gammon, Boiled Egg & Crusty Bread; served with a choice of Chips or Boiled Potatoes",price:1695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-cajun-spiced-fillet-of-salmon",section:"Salads",name:"Cajun Spiced Fillet Of Salmon",description:"with Curried Coleslaw, Cashew Nuts & a Chilli, Ginger & Citrus Dressing; served with a choice of Chips or Boiled Potatoes",price:1850,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-garlic-chicken-caesar-salad",section:"Salads",name:"Garlic Chicken Caesar Salad",description:"with Croutons, Parmesan, Baby Gem Lettuce, Boiled Egg & Caesar Dressing; served with a choice of Chips or Boiled Potatoes",price:1795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-prawn-smoked-salmon-sandwich",section:"Sandwiches",name:"Prawn & Smoked Salmon Sandwich",description:"with Rocket & Marie Rose Sauce; served on White or Malted Bread with Kettle Chips, Coleslaw & Side Salad. Available 12 Noon\u20135pm",price:1195,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-tuna-mayonnaise-sandwich",section:"Sandwiches",name:"Tuna Mayonnaise Sandwich",description:"with Red Onion, Cucumber & Gem Lettuce; served on White or Malted Bread with Kettle Chips, Coleslaw & Side Salad. Available 12 Noon\u20135pm",price:1050,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-spicy-bang-bang-chicken-sandwich",section:"Sandwiches",name:"Spicy Bang Bang Chicken Sandwich",description:"with Sriracha Mayonnaise, Peppers & Coriander; served on White or Malted Bread with Kettle Chips, Coleslaw & Side Salad. Available 12 Noon\u20135pm",price:1195,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-basil-pesto-chicken-sandwich",section:"Sandwiches",name:"Basil Pesto Chicken Sandwich",description:"with Tomatoes, Red Onion & Mayonnaise; served on White or Malted Bread with Kettle Chips, Coleslaw & Side Salad. Available 12 Noon\u20135pm",price:1095,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-smoked-ham-matured-cheddar-cheese-sandwi",section:"Sandwiches",name:"Smoked Ham & Matured Cheddar Cheese Sandwich",description:"with Mustard Mayonnaise; served on White or Malted Bread with Kettle Chips, Coleslaw & Side Salad. Available 12 Noon\u20135pm",price:1095,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-egg-mayonnaise-sandwich",section:"Sandwiches",name:"Egg Mayonnaise Sandwich",description:"with Spring Onion & Chives; served on White or Malted Bread with Kettle Chips, Coleslaw & Side Salad. Available 12 Noon\u20135pm",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-add-a-cup-of-soup-with-any-sandwich",section:"Sandwiches add-ons",name:"Add a Cup of Soup (with any Sandwich)",description:"",price:395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-chips",section:"Sides",name:"Chips",description:"",price:425,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-cajun-chips",section:"Sides",name:"Cajun Chips",description:"",price:495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-creamed-potatoes",section:"Sides",name:"Creamed Potatoes",description:"",price:450,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-onion-rings",section:"Sides",name:"Onion Rings",description:"",price:495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-mac-cheese-side",section:"Sides",name:"Mac & Cheese (side)",description:"",price:595,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-seasonal-mixed-vegetables",section:"Sides",name:"Seasonal Mixed Vegetables",description:"",price:450,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-souter-s-coleslaw",section:"Sides",name:"Souter\u2019s Coleslaw",description:"",price:395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-curried-coleslaw",section:"Sides",name:"Curried Coleslaw",description:"",price:395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-souter-s-side-salad",section:"Sides",name:"Souter\u2019s Side Salad",description:"",price:425,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-garlic-bread",section:"Sides",name:"Garlic Bread",description:"",price:395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-a-la-carte-garlic-bread-with-cheese",section:"Sides",name:"Garlic Bread with Cheese",description:"",price:450,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-fresh-fruit-salad-sorbet",section:"Starters",name:"Fresh Fruit Salad & Sorbet",description:"",price:300,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-soup-of-the-day",section:"Starters",name:"Soup of the Day",description:"",price:300,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-kids-garlic-bread-with-or-without-cheese",section:"Starters",name:"Garlic Bread (with or without Cheese)",description:"",price:300,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-macaroni-cheese",section:"Main courses",name:"Macaroni Cheese",description:"All main dishes served with carrots, peas and a choice of chips or mash",price:695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-breaded-goujons-of-chicken",section:"Main courses",name:"Breaded Goujons of Chicken",description:"All main dishes served with carrots, peas and a choice of chips or mash",price:695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-mini-breaded-fish",section:"Main courses",name:"Mini Breaded Fish",description:"All main dishes served with carrots, peas and a choice of chips or mash",price:695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-roast-chicken-salad",section:"Main courses",name:"Roast Chicken Salad",description:"All main dishes served with carrots, peas and a choice of chips or mash",price:695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-grilled-sausages-or-chicken-with-gravy",section:"Main courses",name:"Grilled Sausages or Chicken with Gravy",description:"All main dishes served with carrots, peas and a choice of chips or mash",price:695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-sticky-toffee-pudding",section:"Sweet treats",name:"Sticky Toffee Pudding",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-cone-from-the-counter",section:"Sweet treats",name:"Cone from the Counter",description:"",price:185,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-kids-ice-cream-sundae",section:"Sweet treats",name:"Kids Ice Cream Sundae",description:"Two scoops, Sprinkles, Flakes, along with a choice of Sauce \u2013 Chocolate / Strawberry",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-kids-juice-apple-orange-pineapple",section:"Drinks",name:"Juice \u2013 Apple / Orange / Pineapple",description:"",price:185,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-simply-fruit-shoot-orange-blackcurrant",section:"Drinks",name:"Simply Fruit Shoot \u2013 Orange / Blackcurrant",description:"",price:200,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-diluting-juice-orange-blackcurrant",section:"Drinks",name:"Diluting Juice \u2013 Orange / Blackcurrant",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-milk",section:"Drinks",name:"Milk",description:"",price:175,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-coke-diet-coke-lemonade",section:"Drinks",name:"Coke / Diet Coke / Lemonade",description:"",price:200,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-kids-kids-milk-shake-chocolate-strawberry",section:"Drinks",name:"Kids Milk Shake \u2013 Chocolate / Strawberry",description:"",price:250,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-souter-s-sticky-toffee-pudding",section:"Dessert",name:"Souter\u2019s Sticky Toffee Pudding",description:"with Butterscotch Sauce & Vanilla Ice Cream",price:795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-cherry-almond-tart",section:"Dessert",name:"Cherry & Almond Tart",description:"with Cr\xe8me Anglaise & Wild Cherry Ripple Ice Cream",price:795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-individual-banoffee-pie",section:"Dessert",name:"Individual Banoffee Pie",description:"topped with Chocolate Shavings, served with Salted Caramel Sauce & Banana Ice Cream",price:795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-souter-s-cheesecake-of-the-day",section:"Dessert",name:"Souter\u2019s Cheesecake of the Day",description:"Please ask your Server for Today\u2019s Choice",price:795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-desserts-warm-chocolate-fudge-cake",section:"Dessert",name:"Warm Chocolate Fudge Cake",description:"with Fresh Berries & Honeycomb Ice Cream",price:795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-lemon-meringue-pie",section:"Dessert",name:"Lemon Meringue Pie",description:"with Raspberries & Raspberry Ripple Ice Cream",price:795,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-fresh-fruit-salad",section:"Dessert",name:"Fresh Fruit Salad",description:"with Citrus Syrup served with Pouring Cream, Ice Cream or Sorbet",price:700,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-cheeseboard",section:"Dessert",name:"Cheeseboard",description:"A Selection of British & Continental Cheeses with Grapes, Fruit Chutney & Biscuits",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-affogato",section:"Dessert",name:"Affogato",description:"Vanilla Ice Cream with a Shot of Espresso",price:650,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-ice-cream-one-scoop",section:"Ice cream",name:"Ice Cream \u2013 One Scoop",description:"Please ask your Server for Today\u2019s Flavours",price:395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-desserts-ice-cream-two-scoops",section:"Ice cream",name:"Ice Cream \u2013 Two Scoops",description:"Please ask your Server for Today\u2019s Flavours",price:495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-desserts-ice-cream-three-scoops",section:"Ice cream",name:"Ice Cream \u2013 Three Scoops",description:"Please ask your Server for Today\u2019s Flavours",price:595,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-desserts-strawberry-snowball-delight",section:"Sundaes",name:"Strawberry Snowball Delight",description:"Vanilla & Strawberry Ice cream, Crushed Meringue, Fresh Strawberries, Strawberry Sauce, topped with a Snowball & a Wafer",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-biscoff-sundae",section:"Sundaes",name:"Biscoff Sundae",description:"Biscoff & Toffee Fudge Ice Cream, Whipped Cream, Crushed Lotus Biscoff Biscuits, Biscoff Topping Sauce & a Wafer",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-kinder-bueno-sundae",section:"Sundaes",name:"Kinder Bueno Sundae",description:"Kinder Bueno & Chocolate Ice Cream, Whipped Cream, Kinder Bueno Pieces, Chocolate Sauce & a Wafer",price:995,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-white-coffee",section:"Coffee",name:"White Coffee",description:"",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-latte",section:"Coffee",name:"Latte",description:"",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-cappuccino",section:"Coffee",name:"Cappuccino",description:"",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-macchiato",section:"Coffee",name:"Macchiato",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-americano",section:"Coffee",name:"Americano",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-espresso",section:"Coffee",name:"Espresso",description:"",price:325,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-double-espresso",section:"Coffee",name:"Double Espresso",description:"",price:395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-flavour-shot-add-on",section:"Coffee add-ons",name:"Flavour Shot (add-on)",description:"",price:75,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-extra-shot-of-coffee-add-on",section:"Coffee add-ons",name:"Extra Shot of Coffee (add-on)",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-breakfast-tea",section:"Tea",name:"Breakfast Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-camomile-tea",section:"Tea",name:"Camomile Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-earl-grey-tea",section:"Tea",name:"Earl Grey Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-green-tea",section:"Tea",name:"Green Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-peppermint-tea",section:"Tea",name:"Peppermint Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-red-berry-tea",section:"Tea",name:"Red Berry Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-lemon-ginger-tea",section:"Tea",name:"Lemon & Ginger Tea",description:"",price:350,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-hot-chocolate",section:"Hot chocolate",name:"Hot Chocolate",description:"",price:425,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-desserts-luxury-hot-chocolate",section:"Hot chocolate",name:"Luxury Hot Chocolate",description:"with Cream & Marshmallows",price:475,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-chilled-melon-seasonal-fruits",section:"Starters",name:"Chilled Melon & Seasonal Fruits",description:"with Fruit Coulis & Sorbet",price:850,dietary:["V","VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-creamy-garlic-mushrooms",section:"Starters",name:"Creamy Garlic Mushrooms",description:"with Cheddar Cheese & Crusty Bread",price:895,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-mediterranean-tomato-chunky-vegetable-so",section:"Starters",name:"Mediterranean Tomato & Chunky Vegetable Soup",description:"with Crusty Bread",price:650,dietary:["V","VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-honey-glazed-goats-cheese",section:"Starters",name:"Honey Glazed Goats Cheese",description:"with Tomato & Rocket Salad, Basil Pesto & Balsamic Dressing",price:850,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-freshly-baked-basket-of-bread",section:"Starters",name:"Freshly Baked Basket of Bread",description:"with Butter",price:450,dietary:["V","VG"],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-vegetarian-vegan-add-olive-oil-balsamic",section:"Starters",name:"Add Olive Oil & Balsamic",description:"",price:100,dietary:["V","VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-boiled-egg-caesar-salad",section:"Starters",name:"Boiled Egg Caesar Salad",description:"with Croutons, Garlic Dressing & Vegetarian Cheese Shavings",price:795,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-salad-of-poached-pear-candied-walnuts",section:"Starters",name:"Salad of Poached Pear & Candied Walnuts",description:"with French Vinaigrette",price:795,dietary:["V","VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-stuffed-peppers",section:"Main courses",name:"Stuffed Peppers",description:"with Braised Rice, Tomatoes, Basil & Brie, served with a Side Salad & a Bucket of Chips; without Brie is vegan",price:1795,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-vegetable-cashew-nut-stir-fry",section:"Main courses",name:"Vegetable & Cashew Nut Stir Fry",description:"with Hoisin, Ginger & Garlic, served with Aromatic Rice",price:1795,dietary:["V","VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-macaroni-cheese",section:"Main courses",name:"Macaroni Cheese",description:"with Coleman\u2019s Mustard, Leeks & Matured Cheddar, served with Garlic Bread",price:1795,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-pasta-arrabbiata",section:"Main courses",name:"Pasta Arrabbiata",description:"with Peppers, Tomatoes, Chilli & Basil, served with Garlic Bread",price:1795,dietary:["V","VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-creamy-coconut-vegetable-curry",section:"Main courses",name:"Creamy Coconut Vegetable Curry",description:"with Almonds, Cashew Nuts & Coriander, served with Rice, Spiced Onions & a Poppadom",price:1795,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-katsu-vegetable-curry",section:"Main courses",name:"Katsu Vegetable Curry",description:"with Almonds, Cashew Nuts & Coriander, served with Rice, Spiced Onions & a Poppadom",price:1795,dietary:["VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-fresh-fruit-salad",section:"Desserts",name:"Fresh Fruit Salad",description:"with Sorbet",price:700,dietary:["V","VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-sticky-toffee-pudding",section:"Desserts",name:"Sticky Toffee Pudding",description:"with Hot Caramel Sauce & Vanilla Ice Cream",price:795,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-cherry-almond-tart",section:"Desserts",name:"Cherry & Almond Tart",description:"with Wild Cherry Ripple Ice Cream",price:795,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-trillionaire-tart",section:"Desserts",name:"Trillionaire Tart",description:"with Chocolate Pastry, Caramel Toffee & Chocolate Style Ganache, served with Vegan Vanilla Ice Cream",price:795,dietary:["VG"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-individual-banoffee-pie",section:"Desserts",name:"Individual Banoffee Pie",description:"topped with Chocolate Shavings, served with Salted Caramel Sauce & Banana Ice Cream",price:795,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-warm-chocolate-fudge-cake",section:"Desserts",name:"Warm Chocolate Fudge Cake",description:"with Fresh Berries & Honeycomb Ice Cream",price:795,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-cheeseboard",section:"Desserts",name:"Cheeseboard",description:"served with Oatcakes & Seasonal Chutney",price:995,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-vegetarian-vegan-affogato",section:"Desserts",name:"Affogato",description:"1 Scoop of Plain Ice Cream with a shot of Espresso Coffee",price:650,dietary:["V"],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-floured-bap-with-ayrshire-bacon",section:"Morning (9am\u201312pm)",name:"Floured Bap with Ayrshire Bacon",description:"Available 9am\u201312pm",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-floured-bap-with-pork-link-sausage",section:"Morning (9am\u201312pm)",name:"Floured Bap with Pork Link Sausage",description:"Available 9am\u201312pm",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-floured-bap-with-poached-scrambled-fried",section:"Morning (9am\u201312pm)",name:"Floured Bap with Poached / Scrambled / Fried Egg",description:"Available 9am\u201312pm",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-extra-item-on-floured-bap",section:"Morning (9am\u201312pm)",name:"Extra Item (on Floured Bap)",description:"",price:100,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-traybakes",section:"Sweet treats",name:"Traybakes",description:"",price:375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-takeaway-freshly-baked-cakes",section:"Sweet treats",name:"Freshly Baked Cakes",description:"",price:450,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-freshly-baked-plain-fruit-scone",section:"Sweet treats",name:"Freshly Baked Plain / Fruit Scone",description:"",price:175,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-soup-of-the-day",section:"Hot food (12pm\u20139pm)",name:"Soup of the Day",description:"with Crusty Bread; available 12pm\u20139pm",price:450,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens. Price/availability to confirm with the venue.",prepMins:0,special:!0},{id:"su-takeaway-breaded-haddock-chips",section:"Hot food (12pm\u20139pm)",name:"Breaded Haddock & Chips",description:"with Tartare Sauce",price:1375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-steak-sausage-pie",section:"Hot food (12pm\u20139pm)",name:"Steak & Sausage Pie",description:"with Chips & Gravy",price:1375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-macaroni-cheese",section:"Hot food (12pm\u20139pm)",name:"Macaroni Cheese",description:"with Leeks, Mustard & Matured Cheddar, served with Chips",price:1375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-8oz-burger",section:"Hot food (12pm\u20139pm)",name:"8oz Burger",description:"with Bacon & Cheese, served with Chips",price:1375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-breaded-katsu-chicken-burger",section:"Hot food (12pm\u20139pm)",name:"Breaded Katsu Chicken Burger",description:"with Curried Slaw, served with Chips",price:1375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-cajun-chicken",section:"Hot food (12pm\u20139pm)",name:"Cajun Chicken",description:"with Rice & Coconut Curry Sauce",price:1375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-breaded-goat-s-cheese",section:"Hot food (12pm\u20139pm)",name:"Breaded Goat\u2019s Cheese",description:"with Tomato Salad, Pesto & Chutney, served with Chips",price:1375,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-basil-pesto-chicken-sandwich",section:"Sandwiches (12pm\u20135pm)",name:"Basil Pesto Chicken Sandwich",description:"with Tomatoes, Red Onion & Mayonnaise; sandwiches 12pm\u20135pm",price:695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-spicy-bang-bang-chicken-sandwich",section:"Sandwiches (12pm\u20135pm)",name:"Spicy Bang Bang Chicken Sandwich",description:"with Sriracha Mayonnaise, Peppers & Coriander; sandwiches 12pm\u20135pm",price:695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-smoked-ham-matured-cheddar-cheese-sandwi",section:"Sandwiches (12pm\u20135pm)",name:"Smoked Ham & Matured Cheddar Cheese Sandwich",description:"with Mustard Mayonnaise; sandwiches 12pm\u20135pm",price:695,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-tuna-mayonnaise-sandwich",section:"Sandwiches (12pm\u20135pm)",name:"Tuna Mayonnaise Sandwich",description:"with Red Onion, Cucumber & Gem Lettuce; sandwiches 12pm\u20135pm",price:595,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-takeaway-egg-mayonnaise-sandwich",section:"Sandwiches (12pm\u20135pm)",name:"Egg Mayonnaise Sandwich",description:"with Spring Onion & Chives; sandwiches 12pm\u20135pm",price:595,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-pork-fillet-escalopes",section:"Choose your cut",name:"Pork Fillet Escalopes",description:"All served with Grilled Tomato, Portobello Mushroom & your choice of side & sauce",price:2e3,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-8oz-scotch-beef-fillet",section:"Choose your cut",name:"8oz Scotch Beef Fillet",description:"All served with Grilled Tomato, Portobello Mushroom & your choice of side & sauce",price:3e3,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-8oz-scotch-sirloin",section:"Choose your cut",name:"8oz Scotch Sirloin",description:"All served with Grilled Tomato, Portobello Mushroom & your choice of side & sauce",price:2500,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-10oz-scotch-ribeye",section:"Choose your cut",name:"10oz Scotch Ribeye",description:"All served with Grilled Tomato, Portobello Mushroom & your choice of side & sauce",price:3e3,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-scotch-lamb-chops",section:"Choose your cut",name:"Scotch Lamb Chops",description:"All served with Grilled Tomato, Portobello Mushroom & your choice of side & sauce",price:2500,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-600gm-scotch-t-bone-steak",section:"Choose your cut",name:"600gm Scotch T-Bone Steak",description:"All served with Grilled Tomato, Portobello Mushroom & your choice of side & sauce",price:4500,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-souter-s-mixed-grill",section:"Choose your cut",name:"Souter\u2019s Mixed Grill",description:"4oz Sirloin / Chicken Breast / Lamb Chop / Pork Escalope; served with Grilled Tomato, Portobello Mushroom & your choice of side & sauce",price:3500,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-chunky-chips-included-side-choice",section:"Side (included)",name:"Chunky Chips (included side choice)",description:"Included side choice with cut",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-baby-boiled-potatoes-included-side-choic",section:"Side (included)",name:"Baby Boiled Potatoes (included side choice)",description:"Included side choice with cut",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-mashed-potato-included-side-choice",section:"Side (included)",name:"Mashed Potato (included side choice)",description:"Included side choice with cut",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-red-wine-jus-included-sauce-choice",section:"Sauce (included)",name:"Red Wine Jus (included sauce choice)",description:"Included sauce choice with cut",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-peppercorn-included-sauce-choice",section:"Sauce (included)",name:"Peppercorn (included sauce choice)",description:"Included sauce choice with cut",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-mustard-included-sauce-choice",section:"Sauce (included)",name:"Mustard (included sauce choice)",description:"Included sauce choice with cut",price:null,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-onion-rings",section:"Upgrade extras",name:"Onion Rings",description:"",price:495,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-garden-salad",section:"Upgrade extras",name:"Garden Salad",description:"",price:425,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-mixed-vegetables",section:"Upgrade extras",name:"Mixed Vegetables",description:"",price:450,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-haggis-cake",section:"Upgrade extras",name:"Haggis Cake",description:"",price:200,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-mac-cheese",section:"Upgrade extras",name:"Mac & Cheese",description:"",price:525,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-garlic-prawns",section:"Upgrade extras",name:"Garlic Prawns",description:"",price:750,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0},{id:"su-meat-feast-tuesday-souter-s-coleslaw",section:"Upgrade extras",name:"Souter\u2019s Coleslaw",description:"",price:395,dietary:[],allergens:{},allergenNotes:"Please speak to staff about allergens",prepMins:0}].map(s=>({...s,restaurantId:"souters",soldOut:!1,signOff:null})),t=215},1134,[]); +__d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ANCHORAGE_SECTIONS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"anchorageMenu",{enumerable:!0,get:function(){return o}});const i=i=>({id:i,name:'Served with',required:!0,multi:!1,choices:[{id:`${i}-custard`,label:'Custard',priceDelta:0,allergens:{}},{id:`${i}-icecream`,label:'Ice cream',priceDelta:0,allergens:{}},{id:`${i}-cream`,label:'Cream',priceDelta:0,allergens:{}},{id:`${i}-vegan`,label:'Vegan ice cream (ask server)',priceDelta:0,allergens:{}}]}),s=(i,s,n)=>({id:i,name:'Portion',required:!0,multi:!1,choices:[{id:`${i}-starter`,label:'Starter',priceDelta:0},{id:`${i}-main`,label:n,priceDelta:s}]}),n=[{id:'a-soup',section:'Starters',name:"Chef's Soup of the Day",description:'A heartwarming bowl of seasonal homemade soup, served with warm crusty bread and butter.',price:600,dietary:[],allergens:{},allergenNotes:'Recipe changes daily \u2014 check the day\u2019s soup.',prepMins:0},{id:'a-skink',section:'Starters',name:'Cullen Skink',description:'Traditional creamy soup made with locally smoked haddock, potatoes and leeks, served with warm crusty bread and butter.',price:900,dietary:[],allergens:{},prepMins:0},{id:'a-salmon',section:'Starters',name:'Scottish Smoked Salmon Roulade',description:'Delicate Scottish smoked salmon rolled with herb-infused cream cheese, served with garlic & herb crostini and dressed salad.',price:900,dietary:[],allergens:{},prepMins:0},{id:'a-haggis',section:'Starters',name:'Haggis Bon Bons',description:'Crisp golden panko-fried haggis balls, finished with a velvety Scotch whisky sauce and caramelised apple gel.',price:800,dietary:[],allergens:{},allergenNotes:'',prepMins:0},{id:'a-crabcakes',section:'Starters',name:'Spiced Crab Cakes',description:'Golden crab cakes, delicately seasoned with herbs and spices, served with crisp seasonal salad and house-made Marie Rose sauce.',price:900,dietary:[],allergens:{},allergenNotes:'',prepMins:0},{id:'a-tempura',section:'Starters',name:'Deluxe Mixed Tempura',description:"King prawns, chicken and lion's mane mushrooms in a light, crispy tempura batter, served with a dressed seasonal salad and house dipping sauce.",price:1e3,dietary:[],allergens:{},allergenNotes:'',prepMins:0,optionGroups:[s('tempura',900,'Main with triple-cooked chips (\xa319.00)')]},{id:'a-kingoyster',section:'Starters',name:"Pan-Seared King Oyster Mushroom 'Scallops' (VG)",description:"King oyster mushroom 'scallops' prepared with the chef's special recipe of the day. Ask your server or see our specials board for today's garnish and accompaniments.",price:1e3,dietary:['VG'],allergens:{},allergenNotes:'Garnish changes daily \u2014 sign-off needed for each version.',prepMins:0,special:!0,unsigned:!0,optionGroups:[s('kingoyster',800,'Main (\xa318.00)')]},{id:'a-fishsupper',section:'Mains',name:'Fish Supper',description:'Locally landed haddock, available beer-battered or breaded, served with buttered peas, triple-cooked chips and homemade tartare sauce.',price:1800,dietary:['GF option'],allergens:{},allergenNotes:'',prepMins:0,optionGroups:[{id:'fs-coat',name:'Coating',required:!0,multi:!1,choices:[{id:'fs-batter',label:'Beer-battered',priceDelta:0},{id:'fs-bread',label:'Breaded',priceDelta:0}]}]},{id:'a-lionsmane',section:'Mains',name:"Southern Fried Lion's Mane Burger (VG)",description:"Crispy southern fried lion's mane mushroom, layered with vegan cheese and garlic aioli, served with triple-cooked chips and golden onion rings.",price:1800,dietary:['VG'],allergens:{},prepMins:0},{id:'a-pie',section:'Mains',name:'Steak & Ale Pie',description:'Slow-braised beef in a rich ale jus beneath golden all-butter puff pastry, served with buttered seasonal vegetables.',price:1800,dietary:[],allergens:{},prepMins:0,optionGroups:[{id:'pie-side',name:'Served with',required:!0,multi:!1,choices:[{id:'chips',label:'Triple-cooked chips',priceDelta:0},{id:'creamed',label:'Creamed potatoes',priceDelta:0,allergens:{}}]}]},{id:'a-bananablossom',section:'Mains',name:"Beer-Battered Banana Blossom 'Fish' Goujons (VG)",description:'Crisp beer-battered banana blossom goujons, dusted with locally foraged truffle seaweed seasoning, served with triple-cooked chips, garden peas and vegan tartare sauce.',price:1700,dietary:['VG'],allergens:{},allergenNotes:'',prepMins:0},{id:'a-chicken',section:'Mains',name:'Roasted Breast of Chicken',description:'Golden pan-roasted chicken breast, served with creamed potatoes, buttered seasonal primaryBtns, and a fragrant lemon & thyme bouillon.',price:1900,dietary:[],allergens:{},prepMins:0},{id:'a-maccheese',section:'Mains',name:'Macaroni Cheese (V)',description:'Rich mature Cheddar macaroni finished with a golden cheese glaze, served with two slices of garlic bread.',price:1700,dietary:['V'],allergens:{},prepMins:0},{id:'a-penne',section:'Mains',name:'Cajun Chicken & Chorizo Penne Pasta',description:'Tender Cajun-spiced chicken strips, mixed peppers, red onion and smoky chorizo, tossed in a bold, creamy Cajun sauce, served with two slices of garlic bread.',price:1700,dietary:[],allergens:{},prepMins:0},{id:'a-caesar',section:'Mains',name:'Chicken Caesar Salad',description:'Tender pan-roasted chicken breast served on a bed of baby gem lettuce with golden garlic croutons, Parmesan and a classic Caesar dressing.',price:1800,dietary:[],allergens:{},allergenNotes:'',prepMins:0,optionGroups:[{id:'caesar-add',name:'Optional extras',required:!1,multi:!0,choices:[{id:'caesar-bacon',label:'Add smoked Ayrshire bacon',priceDelta:150}]}]},{id:'a-moules',section:'Mains',name:'Moules Marini\xe8re',description:'Fresh Scottish mussels, steamed to perfection in a rich, creamy white wine and garlic sauce.',price:1200,dietary:[],allergens:{},prepMins:0,optionGroups:[s('moules',1e3,'Main 500g with triple-cooked chips (\xa322.00)')]},{id:'a-fillet',section:'From the Grill',name:'8oz Fillet Steak',description:'Prime 8oz fillet steak served with truffled woodland mushrooms, seasonal primaryBtns, golden onion rings and triple-cooked chips.',price:3800,dietary:[],allergens:{},prepMins:0,optionGroups:[{id:'steak-sauce',name:'Sauce',required:!1,multi:!1,choices:[{id:'sauce-pepper',label:'Peppercorn sauce',priceDelta:0,allergens:{}},{id:'sauce-garlic',label:'Garlic butter',priceDelta:0,allergens:{}}]},{id:'steak-surf',name:'Surf & turf add-on',required:!1,multi:!1,choices:[{id:'surf-prawns',label:'Garlic prawns',priceDelta:800,allergens:{}},{id:'surf-scallops',label:'Scottish West Coast scallops',priceDelta:1e3,allergens:{}}]}]},{id:'a-claymore',section:'From the Grill',name:'The Claymore Burger',description:'One juicy 6oz homemade Scottish beef burger in a brioche bun with baby gem lettuce, tomato and gherkins, topped with cheese, smoked Ayrshire bacon and onion rings. Served with triple-cooked chips.',price:1800,dietary:[],allergens:{},prepMins:0,optionGroups:[{id:'claymore-add',name:'Optional extras',required:!1,multi:!0,choices:[{id:'claymore-haggis',label:'Add haggis and whisky sauce',priceDelta:150,allergens:{}}]}]},{id:'a-langoustines',section:"Captain's Table",name:'Whole Scottish Grilled Langoustines',description:'Locally caught whole Scottish langoustines grilled in garlic butter, served with a vibrant side salad and burnt lemon.',price:1700,dietary:[],allergens:{},prepMins:0,optionGroups:[s('lang',1200,'Main 500g with triple-cooked chips (\xa329.00)')]},{id:'a-scallops',section:"Captain's Table",name:'Pan-Seared West Coast Scallops',description:"Scottish West Coast scallops prepared to the chef's recipe of the day. Starter and main portions \u2014 see price on Specials Board.",price:null,priceNote:'See specials board',dietary:[],allergens:{},prepMins:0,special:!0,unsigned:!0},{id:'a-lobster',section:"Captain's Table",name:'Grilled Dunure Lobster',description:'Fresh Dunure lobster, caught locally by "Kitty Fisher", finished in rich garlic butter and served with a vibrant side salad, triple-cooked chips and burnt lemon. When available.',price:3500,dietary:[],allergens:{},prepMins:0,optionGroups:[{id:'lobster-size',name:'Size',required:!0,multi:!1,choices:[{id:'lob-half',label:'Half',priceDelta:0},{id:'lob-whole',label:'Whole (\xa365.00)',priceDelta:3e3}]}]},{id:'a-crab',section:"Captain's Table",name:'Grilled Dunure Crab',description:'Freshly landed Dunure brown crab, caught locally by "Kitty Fisher", finished in rich garlic butter and served with a vibrant side salad, triple-cooked chips and burnt lemon. When available.',price:4e3,dietary:[],allergens:{},prepMins:0},{id:'a-smorgasbord',section:'Platters',name:'Seafood Smorgasbord (serves one)',description:"250g langoustines, 3 pan-seared West Coast scallops, 250g fresh mussels, 6 garlic prawns and a roll of Scottish smoked salmon, with dressed side salad and warm crusty bread.",price:5e3,dietary:[],allergens:{},prepMins:0},{id:'a-deluxe',section:'Platters',name:'Deluxe Seafood Platter (serves two)',description:'One whole Dunure lobster, one whole Dunure crab, 500g whole langoustines, 500g moules marini\xe8re, pan-seared scallops, Scottish smoked salmon and 6 garlic prawns, with two portions of chips, side salad and warm crusty bread.',price:16500,dietary:[],allergens:{},prepMins:0},{id:'a-onionrings',section:'Sides',name:'House Beer-Battered Onion Rings (V)',description:'Crisp house beer-battered onion rings, served golden and crunchy.',price:450,dietary:['V'],allergens:{},allergenNotes:'',prepMins:0},{id:'a-garlicbread',section:'Sides',name:'Garlic Bread (V)',description:'Warm toasted garlic bread, finished with garlic & parsley butter.',price:450,dietary:['V'],allergens:{},prepMins:0,optionGroups:[{id:'gb-add',name:'Optional extras',required:!1,multi:!0,choices:[{id:'gb-cheese',label:'Add cheese',priceDelta:100}]}]},{id:'a-chips',section:'Sides',name:'Triple-Cooked Chips (V)',description:'Golden triple-cooked chips, lightly tossed in Maldon sea salt.',price:450,dietary:['V'],allergens:{},allergenNotes:'',prepMins:0,optionGroups:[{id:'chips-add',name:'Optional extras',required:!1,multi:!0,choices:[{id:'chips-cajun',label:'Add Cajun seasoning',priceDelta:0,allergens:{}}]}]},{id:'a-truffle',section:'Sides',name:'Parmesan & Truffle Fries (V)',description:'Crispy fries topped with finely grated parmesan and tossed in a winter truffle infused oil.',price:500,dietary:['V'],allergens:{},allergenNotes:'',prepMins:0},{id:'a-salad',section:'Sides',name:'Side Salad (VG)',description:'Seasonal mixed leaves with cucumber, red onion and mixed peppers, finished with a light vinaigrette.',price:450,dietary:['VG'],allergens:{},prepMins:0},{id:'a-brulee',section:'Desserts',name:"Chef's Cr\xe8me Br\xfbl\xe9e of the Day (V)",description:"Smooth Madagascan custard with a delicately caramelised sugar crust. Ask your server or see our specials board for today's flavour.",price:800,dietary:['V'],allergens:{},prepMins:0},{id:'a-crumble',section:'Desserts',name:'Seasonal Fruit Crumble (V)',description:'Slow-cooked seasonal fruit topped with a golden buttery crumble.',price:800,dietary:['V'],allergens:{},prepMins:0,optionGroups:[i('crumble')]},{id:'a-stp',section:'Desserts',name:'Sticky Toffee Pudding (V)',description:'A rich, homemade steamed date pudding, drenched in our signature homemade butterscotch sauce.',price:800,dietary:['V'],allergens:{},prepMins:0,optionGroups:[i('stp')]},{id:'a-cheesecake',section:'Desserts',name:'Cheesecake of the Day (V)',description:'A smooth, creamy cheesecake on a buttery biscuit base. Gluten-free and vegan options available.',price:800,dietary:['V'],allergens:{},prepMins:0,optionGroups:[i('cheesecake')]},{id:'a-affogato',section:'Desserts',name:'Affogato (V)',description:'Two scoops of creamy vanilla ice cream with a freshly brewed shot of Italian espresso poured over. Vegan options available.',price:800,dietary:['V'],allergens:{},prepMins:0},{id:'a-mini',section:'Mini Anchors (under 12s)',name:'Mini Anchors meal',description:'Under 12s only. Served with peas or beans. Includes a diluting juice drink & 2 scoops of ice cream. GF options available.',price:900,dietary:['GF option'],allergens:{},prepMins:0,optionGroups:[{id:'mini-main',name:'Choose a meal',required:!0,multi:!1,choices:[{id:'mini-burger',label:'Cheeseburger & chips',priceDelta:0,allergens:{}},{id:'mini-fish',label:'Fish goujons & chips',priceDelta:0,allergens:{}},{id:'mini-mac',label:"Mac 'n' cheese & chips (V)",priceDelta:0,allergens:{}},{id:'mini-chicken',label:'Chicken goujons & chips',priceDelta:0,allergens:{}}]},{id:'mini-veg',name:'With',required:!0,multi:!1,choices:[{id:'mini-peas',label:'Peas',priceDelta:0},{id:'mini-beans',label:'Beans',priceDelta:0}]}]}],t=['Starters','Mains','From the Grill',"Captain's Table",'Platters','Sides','Desserts','Mini Anchors (under 12s)'],o=n.map(({unsigned:i,soldOut:s,...n})=>({...n,allergens:{},allergenNotes:'',prepMins:0,optionGroups:n.optionGroups?.map(i=>({...i,choices:i.choices.map(i=>({...i,allergens:{}}))})),restaurantId:"anchorage",soldOut:!!s,signOff:null}))},1135,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SCOTTISH_BANK_HOLIDAYS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"BANK_HOLIDAY_SOURCE",{enumerable:!0,get:function(){return n}});const t=[{date:"2026-11-30",title:"St Andrew\u2019s Day",notes:""},{date:"2026-12-25",title:"Christmas Day",notes:""},{date:"2026-12-28",title:"Boxing Day",notes:"Substitute day"},{date:"2027-01-01",title:"New Year\u2019s Day",notes:""},{date:"2027-01-04",title:"2nd January",notes:"Substitute day"},{date:"2027-03-26",title:"Good Friday",notes:""},{date:"2027-05-03",title:"Early May bank holiday",notes:""},{date:"2027-05-31",title:"Spring bank holiday",notes:""},{date:"2027-08-02",title:"Summer bank holiday",notes:""},{date:"2027-11-30",title:"St Andrew\u2019s Day",notes:""},{date:"2027-12-27",title:"Christmas Day",notes:"Substitute day"},{date:"2027-12-28",title:"Boxing Day",notes:"Substitute day"},{date:"2028-01-03",title:"New Year\u2019s Day",notes:"Substitute day"},{date:"2028-01-04",title:"2nd January",notes:"Substitute day"},{date:"2028-04-14",title:"Good Friday",notes:""},{date:"2028-05-01",title:"Early May bank holiday",notes:""},{date:"2028-05-29",title:"Spring bank holiday",notes:""},{date:"2028-08-07",title:"Summer bank holiday",notes:""},{date:"2028-11-30",title:"St Andrew\u2019s Day",notes:""},{date:"2028-12-25",title:"Christmas Day",notes:""},{date:"2028-12-26",title:"Boxing Day",notes:""}],n='gov.uk/bank-holidays.json (Scotland)'},1136,[]); +__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"MESSAGING_CONFIG",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"previewProvider",{enumerable:!0,get:function(){return t}}),_e.relayProvider=n,Object.defineProperty(_e,"isLive",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"activeProvider",{enumerable:!0,get:function(){return s}});const e={mode:'preview',endpoint:'',smsService:'Twilio',emailService:'Postmark',smsSenderId:'ANCHORAGE',fromEmail:'bookings@your-venue.co.uk'},t={id:'preview',label:'Preview mode (nothing is sent)',live:!1,deliver:async()=>({ok:!0})};function n(e){return{id:'relay',label:'Your messaging server',live:!0,deliver:async t=>{try{const n=await fetch(e,{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({channel:t.channel,to:t.to,subject:t.subject,body:t.body,html:t.html,ref:t.ref,kind:t.kind,restaurantId:t.restaurantId})});if(!n.ok)return{ok:!1,error:`Server said ${n.status}`};return{ok:!0,providerId:(await n.json().catch(()=>({}))).id}}catch(e){return{ok:!1,error:e?.message??'Network error'}}}}}const o=()=>'live'===e.mode&&!!e.endpoint,s=()=>o()?n(e.endpoint):t},1137,[]); +__d(function(g,_r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TEMPLATE_LABEL",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"DEFAULT_TEMPLATES",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"PLACEHOLDERS",{enumerable:!0,get:function(){return a}}),Object.defineProperty(e,"teamName",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"longDate",{enumerable:!0,get:function(){return u}}),e.bookingVars=function(n,r){const o=n.allergies.map(n=>`${(0,t.allergenLabel)(n.allergen).toLowerCase()}`).join(', '),a=n.allergies.map(n=>`${(0,t.allergenLabel)(n.allergen)} (${(0,t.severityLabel)(n.severity).toLowerCase()})`).join(', '),i=`${n.partySize} ${1===n.partySize?'person':'people'}`,s={...c(r),first:l(n.name),name:n.name.trim(),date:u(n.date),time:n.time,covers:i,ref:n.ref};return{sms:{...s,allergy:n.allergies.length?` We\u2019ve noted the allergy (${o}) and the team will check it with you when you arrive.`:'',note:'',details:''},email:{...s,allergy:n.allergies.length?`Thank you for telling us about: ${a}. Our team will go through this with you when you arrive, and every dish for your table is checked at each step, from the kitchen to your table.`:'',note:n.notes.trim()?`Your note to us: "${n.notes.trim()}". We\u2019ll make sure the team sees it.`:'',details:[`Date: ${u(n.date)}`,`Time: ${n.time}`,`Table for: ${i}`,`Reference: ${n.ref}`].join('\n')}}},e.orderVars=function(r,o){const a=r.lines.reduce((t,n)=>t+n.qty,0),i=r.readyBy??r.slotTime,s=i?`at ${m(i)}`:'time to be confirmed',d=r.allergies.map(n=>(0,t.allergenLabel)(n.allergen).toLowerCase()).join(', '),u=r.allergies.map(n=>`${(0,t.allergenLabel)(n.allergen)} (${(0,t.severityLabel)(n.severity).toLowerCase()})`).join(', '),y={...c(o),first:l(r.customerName),name:r.customerName,ref:r.ref,items:`${a} ${1===a?'item':'items'}`,total:(0,n.gbp)(r.total),collect:s,date:'',time:i?m(i):'',covers:''};return{sms:{...y,allergy:r.allergies.length?` We\u2019ve noted your allergy (${d}); the kitchen checks every item.`:'',itemList:'',details:'',note:''},email:{...y,allergy:r.allergies.length?`You told us about: ${u}. The kitchen signs off every item against it before your order leaves the pass.`:'',itemList:r.lines.map(t=>`${t.qty} \xd7 ${t.name}${t.choices.length?` (${t.choices.join(', ')})`:''}`).join('\n'),details:[`Order: ${r.ref}`,`Collection: ${i?m(i):'time to be confirmed'}`,`Items: ${a}`,`Total: ${(0,n.gbp)(r.total)}`].join('\n'),note:''}}},e.fill=y,Object.defineProperty(e,"fillEmailText",{enumerable:!0,get:function(){return h}}),e.emailHtml=function(t,n){const r=n.accent??'#B8893E',o=t.split(/\n{2,}/).map(t=>{const n=t.split('\n');return n.length>1&&n.every(t=>/^[^:]{2,22}:\s.+/.test(t))?`${n.map(t=>{const n=t.indexOf(':');return``}).join('')}
${p(t.slice(0,n))}${p(t.slice(n+1).trim())}
`:n.length>1&&n.every(t=>/^\d+ \xd7/.test(t))?`
    ${n.map(t=>`
  • ${p(t)}
  • `).join('')}
`:`

${n.map(p).join('
')}

`}).join('');return`${p(n.preheader??'')}
${p(n.venue.toUpperCase())}
${o}
You\u2019re getting this because you made a booking or order with ${p(n.venue)}. It\u2019s about your booking only, not marketing.
`},e.smsParts=function(t){const n=b(t),r=!f.test(n),o=n.length,a=r?o<=70?1:Math.ceil(o/67):o<=160?1:Math.ceil(o/153);return{chars:o,parts:a,unicode:r}},Object.defineProperty(e,"toGsm",{enumerable:!0,get:function(){return b}});var t=_r(_d[0]),n=_r(_d[1]);const r={booking:{title:'Booking confirmed',when:'Every booking: online, phone or in person (and when you confirm a request)'},request:{title:'Booking request received',when:'Online bookings that need you to confirm them first'},declined:{title:'Booking request declined',when:'When you decline a booking request'},order:{title:'Takeaway order confirmed',when:'Every takeaway order from the app (and phone orders with a number)'}},o={booking:{sms:'Hi {first}, you\u2019re booked in at {venue}: {date} at {time}, {covers}. Ref {ref}.{allergy} Need to change or cancel? Just call {venuePhone}. See you soon, {team}',subject:'You\u2019re booked in at {venue}: {date} at {time}',body:'Hi {first},\n\nThank you for booking with us. We\u2019re really looking forward to welcoming you.\n\n{details}\n\n{allergy}\n\n{note}\n\nIf your plans change, just give us a ring on {venuePhone} and we\u2019ll happily move or cancel it for you. Please quote {ref}.\n\nYou\u2019ll find us at {address}.\n\nWarm wishes,\n{team}'},request:{sms:'Hi {first}, thanks for your booking request at {venue} for {date} at {time}, {covers}. We\u2019ll text you shortly to confirm. Ref {ref}. Questions? Call {venuePhone}. {team}',subject:'We\u2019ve got your booking request for {date}',body:'Hi {first},\n\nThank you for your booking request. A member of the team will look at it and confirm with you very shortly.\n\n{details}\n\n{allergy}\n\n{note}\n\nIf you have any questions in the meantime, call us on {venuePhone} and quote {ref}.\n\nWarm wishes,\n{team}'},declined:{sms:'Hi {first}, we\u2019re so sorry, we can\u2019t fit {covers} in on {date} at {time}. Please call {venuePhone} and we\u2019ll do our best to find another time. {team}',subject:'About your booking request for {date}',body:'Hi {first},\n\nThank you for asking to book with us. We\u2019re really sorry, but we can\u2019t fit your party in on {date} at {time}.\n\nWe\u2019d love to find another time that works. Give us a ring on {venuePhone} and we\u2019ll do our best.\n\nWith apologies and warm wishes,\n{team}'},order:{sms:'Hi {first}, thanks for your order {ref} from {venue}: {items}, {total}. Collection {collect}.{allergy} Questions? Call {venuePhone}. {team}',subject:'Your {venue} order {ref}',body:'Hi {first},\n\nThank you for your order. The kitchen has it and we\u2019ll have it ready for you.\n\n{details}\n\n{itemList}\n\n{allergy}\n\nAny questions, or need to change something? Call us on {venuePhone} and quote {ref}.\n\nYou\u2019ll find us at {address}.\n\nEnjoy!\n{team}'}},a=[{key:'first',what:'Guest\u2019s first name'},{key:'name',what:'Name on the booking'},{key:'venue',what:'Venue name'},{key:'date',what:'Day and date'},{key:'time',what:'Time'},{key:'covers',what:'e.g. 4 people'},{key:'ref',what:'Reference'},{key:'venuePhone',what:'Venue phone'},{key:'address',what:'Venue address'},{key:'team',what:'e.g. The Anchorage team'},{key:'allergy',what:'Allergy reassurance (only if one was noted)'},{key:'note',what:'Their note (email only)'},{key:'details',what:'Details box (email only)'},{key:'items',what:'Orders: e.g. 3 items'},{key:'total',what:'Orders: total'},{key:'collect',what:'Orders: collection time'},{key:'itemList',what:'Orders: list of items (email)'}],i=t=>/^the\s/i.test(t.trim())?`${t.trim()} team`:`The ${t.trim()} team`,l=t=>t.trim().replace(/^(mr|mrs|ms|miss|dr)\.?\s+/i,'').split(/\s+/)[0]||'there',s=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],d=['January','February','March','April','May','June','July','August','September','October','November','December'],u=t=>{const[n,r,o]=t.split('-').map(Number),a=new Date(n,r-1,o,12);return`${s[a.getDay()]} ${o} ${d[r-1]}`},m=t=>{const n=new Date(t);return`${String(n.getHours()).padStart(2,'0')}:${String(n.getMinutes()).padStart(2,'0')}`};function c(t){return{venue:t.name,venuePhone:t.phone||'the restaurant',address:t.address||t.location,team:i(t.name)}}function y(t,n){return t.replace(/\{(\w+)\}/g,(t,r)=>r in n?n[r]:t).replace(/[ \t]{2,}/g,' ').replace(/ +([.,])/g,'$1').trim()}const h=(t,n)=>y(t,n).split(/\n{2,}/).map(t=>t.trim()).filter(Boolean).join('\n\n'),p=t=>t.replace(/&/g,'&').replace(//g,'>').replace(/"/g,'"');const f=/^[A-Za-z0-9 \r\n@\xa3$\xa5\xe8\xe9\xf9\xec\xf2\xc7\xd8\xf8\xc5\xe5\u0394_\u03a6\u0393\u039b\u03a9\u03a0\u03a8\u03a3\u0398\u039e\xc6\xe6\xdf\xc9!"#\xa4%&'()*+,\-./:;<=>?\xa1\xc4\xd6\xd1\xdc\xa7\xbf\xe4\xf6\xf1\xfc\xe0^{}\\[~\]|\u20ac]*$/;const b=t=>t.replace(/[\u2018\u2019]/g,"'").replace(/[\u201c\u201d]/g,'"').replace(/[\u2013\u2014]/g,'-').replace(/\u2026/g,'...').replace(/\xd7/g,'x')},1138,[814,816]); +__d(function(g,r,i,a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.ukPhone=function(t){const s=(t??'').trim();if(!s)return{ok:!1,error:'A phone number is needed so we can send the confirmation.'};let l=s.replace(/[\s\-().]/g,'');l.startsWith('+44')?l='0'+l.slice(3):l.startsWith('0044')?l='0'+l.slice(4):/^44\d{10}$/.test(l)&&(l='0'+l.slice(2));l.startsWith('0(0)')&&(l=l.replace('0(0)','0'));l.startsWith('00')&&(l=l.slice(1));if(!/^0\d+$/.test(l))return{ok:!1,error:'Please use numbers only, for example 07700 900123.'};const n=/^07\d{9}$/.test(l),o=/^0[1238]\d{8,9}$/.test(l);if(!n&&!o)return{ok:!1,error:'That doesn\u2019t look like a UK mobile or landline. For example 07700 900123 or 01292 502826.'};const c=n?`${l.slice(0,5)} ${l.slice(5)}`:/^02/.test(l)?`${l.slice(0,3)} ${l.slice(3,7)} ${l.slice(7)}`:/^0(3|8)/.test(l)?`${l.slice(0,4)} ${l.slice(4,7)} ${l.slice(7)}`:`${l.slice(0,5)} ${l.slice(5)}`;return{ok:!0,e164:'+44'+l.slice(1),pretty:c,kind:n?'mobile':'landline'}},e.emailOk=function(t){const s=(t??'').trim();return!s||/^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/.test(s)}},1139,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"shallow",{enumerable:!0,get:function(){return c}});const t=t=>Symbol.iterator in t,n=t=>"entries"in t,o=(t,n)=>{const o=t instanceof Map?t:new Map(t.entries()),s=n instanceof Map?n:new Map(n.entries());if(o.size!==s.size)return!1;for(const[t,n]of o)if(!s.has(t)||!Object.is(n,s.get(t)))return!1;return!0},s=(t,n)=>{const o=t[Symbol.iterator](),s=n[Symbol.iterator]();let c=o.next(),u=s.next();for(;!c.done&&!u.done;){if(!Object.is(c.value,u.value))return!1;c=o.next(),u=s.next()}return!!c.done&&!!u.done};function c(c,u){return!!Object.is(c,u)||"object"==typeof c&&null!==c&&"object"==typeof u&&null!==u&&(Object.getPrototypeOf(c)===Object.getPrototypeOf(u)&&(t(c)&&t(u)?n(c)&&n(u)?o(c,u):s(c,u):o({entries:()=>Object.entries(c)},{entries:()=>Object.entries(u)})))}},1140,[]); +__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"EXAMPLE_TAG",{enumerable:!0,get:function(){return t}}),_e.exampleCards=function(t){return l.flatMap(l=>{const h=t.find(e=>e.id===l.menuItemId);if(!h)return[];return[{id:(0,e.uuidFrom)(`card:${h.restaurantId}:${h.id}`),restaurantId:h.restaurantId,menuItemId:h.id,dish:h.name,section:h.section,price:h.price,photo:l.photo,ingredients:o(l.menuItemId,l.ings),steps:l.steps,allergens:l.allergens,dismissed:l.dismissed??[],allergenNotes:l.notes,allergensConfirmed:{by:s.by,at:s.at},signOff:l.awaiting?null:s,wasLive:!0,origin:'example',version:l.awaiting?2:1,createdAt:n,updatedAt:l.awaiting?'2026-10-28T15:20:00.000Z':n,updatedBy:l.awaiting?'Example edit (demo)':s.by}]})},_e.importedCard=function(t,s){return{id:(0,e.uuidFrom)(`card:${t.restaurantId}:${t.id}`),restaurantId:t.restaurantId,menuItemId:t.id,dish:t.name,section:t.section,price:t.price,ingredients:[],steps:[],allergens:{...t.allergens},dismissed:[],allergenNotes:t.allergenNotes,allergensConfirmed:t.signOff?{by:t.signOff.by,at:t.signOff.at}:void 0,signOff:t.signOff?{by:t.signOff.by,at:t.signOff.at}:null,wasLive:!t.hidden||!!t.signOff,origin:'imported',version:1,createdAt:s,updatedAt:s,updatedBy:'Imported from the menu'}};var e=r(d[0]);const t='Example data',s={by:'Example sign-off (demo)',at:'2026-10-26T10:00:00.000Z'},n='2026-10-26T09:00:00.000Z',o=(e,t)=>t.map(([t,s,n],o)=>({id:`${e}-i${o}`,qty:t,unit:s,name:n})),l=[{menuItemId:'a-lobster',photo:'asset:lobster',ings:[['1','whole','Live Dunure lobster (c. 600 g, Kitty Fisher)'],['60','g','Garlic butter'],['\xbd','','Lemon, charred'],['60','g','Mixed leaves, cucumber and red onion'],['15','ml','House vinaigrette (Dijon mustard)'],['200','g','Triple-cooked chips']],steps:['Chill the lobster for 20 minutes, then dispatch humanely and split lengthways. Remove the stomach sac and the intestinal tract.','Crack the claws. Season the flesh and spoon over half the garlic butter.','Grill flesh side up for 6\u20138 minutes until just opaque; baste with the rest of the butter.','Char the lemon on the grill. Dress the salad at the pass.','Plate on the long board: lobster, claws alongside, salad, chips in the cone, lemon and a pot of the pan butter.'],allergens:{crustaceans:'contains',milk:'contains',mustard:'contains',gluten:'may',fish:'may'},notes:'Chips are cooked in a shared fryer (gluten, fish, crustaceans may be present).'},{menuItemId:'a-skink',photo:'asset:skink',ings:[['120','g','Smoked haddock, undyed'],['200','ml','Whole milk'],['20','g','Butter'],['60','g','Leek, sliced'],['40','g','Onion, diced'],['120','g','Floury potato, diced'],['1','tbsp','Parsley, chopped'],['1','slice','Crusty bread'],['10','g','Butter (portion)']],steps:['Poach the haddock in the milk for 5 minutes. Lift out, flake and keep the milk.','Sweat the leek and onion in the butter until soft, with no colour.','Add the potato and the poaching milk; simmer for 15 minutes until the potato breaks down.','Crush a third of the potato for body, return the haddock and season with pepper.','Serve in the warm bowl, parsley on top, bread and butter on the side.'],allergens:{fish:'contains',milk:'contains',gluten:'contains'}},{menuItemId:'a-fishsupper',photo:'asset:fishsupper',ings:[['200','g','Haddock fillet, locally landed'],['80','g','Self-raising flour'],['100','ml','Beer (lager)'],['250','g','Triple-cooked chips'],['80','g','Garden peas'],['10','g','Butter'],['40','g','Tartare sauce (mayonnaise, capers, gherkins)'],['\xbc','','Lemon']],steps:['Whisk the flour and cold beer to a thick batter; rest for 10 minutes.','Dust the haddock in flour, dip in the batter and lower into the fryer at 180 \xb0C for 5\u20136 minutes.','Fry the chips at 190 \xb0C until golden.','Warm the peas with the butter.','Plate the fish on the chips, peas in the ramekin, tartare and lemon on the side.'],allergens:{fish:'contains',gluten:'contains',eggs:'contains',milk:'contains',mustard:'may',crustaceans:'may',sulphites:'may'},notes:'Shared fryer. Tartare is made with mayonnaise (egg, may contain mustard). The beer in the batter may contain sulphites.'},{menuItemId:'a-moules',photo:'asset:moules',ings:[['500','g','Scottish rope mussels, cleaned'],['30','g','Butter'],['1','','Shallot, finely diced'],['2','cloves','Garlic, sliced'],['100','ml','Dry white wine'],['60','ml','Double cream'],['1','tbsp','Parsley, chopped'],['2','slices','Crusty bread']],steps:['Check every mussel: discard any that are cracked or stay open when tapped.','Sweat the shallot and garlic in the butter for 2 minutes.','Add the mussels and wine, cover and steam on a high heat for 3\u20134 minutes until they open.','Discard any that stay shut. Stir in the cream and parsley.','Serve in the deep bowl with the bread and an empty-shell bowl.'],allergens:{molluscs:'contains',milk:'contains',sulphites:'contains',gluten:'contains'}},{menuItemId:'a-stp',photo:'asset:stp',awaiting:!0,ings:[['30','g','Medjool dates, chopped'],['40','ml','Boiling water'],['25','g','Butter'],['30','g','Dark muscovado sugar'],['1','','Egg (\xbd per portion)'],['35','g','Self-raising flour'],['60','ml','Butterscotch sauce (butter, cream, brown sugar)']],steps:['Soak the dates in the boiling water for 10 minutes, then blitz.','Cream the butter and sugar, beat in the egg, fold in the flour and the dates.','Steam in buttered moulds for 35 minutes.','Warm the butterscotch sauce.','Turn out, pour over the sauce and serve with the guest\u2019s choice of custard, ice cream or cream.'],allergens:{gluten:'contains',milk:'contains',eggs:'contains',sulphites:'may'},notes:'Dried dates may contain sulphites. Accompaniments are chosen at order (see the dish options).'}]},1141,[1103]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/williewastles/chef-app/assets/assets/recipes/lobster.2fb3485c8e372972099259017358c1b8.jpg",width:800,height:600,toString(){return this.uri}}},1142,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/williewastles/chef-app/assets/assets/recipes/skink.4ce7b7c676f9cdcd0a060eda46f5a00e.jpg",width:800,height:600,toString(){return this.uri}}},1143,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/williewastles/chef-app/assets/assets/recipes/fishsupper.1609c58319e1e8721f5c639049fb054e.jpg",width:800,height:600,toString(){return this.uri}}},1144,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/williewastles/chef-app/assets/assets/recipes/moules.a4f342fc7e7fb62c8a0b5c1678bbea3f.jpg",width:800,height:600,toString(){return this.uri}}},1145,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/williewastles/chef-app/assets/assets/recipes/stp.1061ced765efdcafff2554adc3fc7113.jpg",width:800,height:600,toString(){return this.uri}}},1146,[]); +__d(function(g,r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"gid",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"SEED_CALC_INGREDIENTS",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"SEED_CALC_DISHES",{enumerable:!0,get:function(){return I}}),_e.stripGpSamples=y,Object.defineProperty(_e,"useGpCalc",{enumerable:!0,get:function(){return v}}),_e.useGpCalcView=function(){const e=v();return(0,t.useMemo)(()=>i.LIVE_VENUE_BUILD?{...e,...y(e)}:e,[e])};var e,i=r(_d[0]),t=r(_d[1]),s=r(_d[2]),a=r(_d[3]),n=r(_d[4]),c=(e=n)&&e.__esModule?e:{default:e},d=r(_d[5]),o=r(_d[6]),p=r(_d[7]);let l=0;const f=e=>`${e}-${Date.now().toString(36)}${(l++).toString(36)}`,h=(e,i,t,s,a,n=0,c=[])=>({id:e,name:i,packSize:t,packUnit:s,packPrice:a,wastePct:n,allergens:c}),u=e=>new Date(Date.now()-864e5*e).toISOString(),k={'gi-haddock':[8100,8700,8500],'gi-chicken':[4500,4600,4750],'gi-steak':[6200,5900,6e3],'gi-potato':[1450,1500,1600],'gi-oil':[3400,3300,3200]},S=[h('gi-haddock','Haddock fillet',5,'kg',8500,5,['fish']),h('gi-potato','Potatoes (chipping)',25,'kg',1600,20),h('gi-batter','Batter mix',3.5,'kg',770,0,['gluten']),h('gi-oil','Rapeseed oil',20,'L',3200),h('gi-peas','Garden peas (frozen)',2.5,'kg',450),h('gi-lemon','Lemons',80,'each',1600),h('gi-mayo','Mayonnaise',5,'L',1250,0,['eggs','mustard']),h('gi-capers','Capers',1,'kg',900,0,['sulphites']),h('gi-gherkin','Gherkins',2,'kg',700,0,['sulphites']),h('gi-steak','Braising steak',5,'kg',6e3,10),h('gi-pastry','Puff pastry',5,'kg',2250,0,['gluten','milk']),h('gi-onion','Onions',10,'kg',1e3,10),h('gi-stock','Beef stock',1,'L',350,0,['celery']),h('gi-chicken','Chicken breast',5,'kg',4750),h('gi-leaves','Cos lettuce',12,'each',960,15),h('gi-parmesan','Parmesan',1,'kg',1800,0,['milk']),h('gi-bread','Sourdough loaf',1,'each',300,0,['gluten']),h('gi-anchovy','Anchovies',.5,'kg',900,0,['fish']),h('gi-sponge','Date sponge (tray of 12)',1,'each',600,0,['gluten','eggs','milk']),h('gi-toffee','Toffee sauce',2,'L',1100,0,['milk']),h('gi-icecream','Vanilla ice cream',4,'L',1800,0,['milk','eggs'])].map(e=>({...e,prices:(k[e.id]??[e.packPrice]).map((e,i,t)=>({p:e,at:u(7*(t.length-i))}))})),P=(e,i,t,s,a,n,c,d="")=>({id:e,name:i,category:t,lines:s.map(([e,i,t])=>({ingId:e,qty:i,unit:t})),portions:a,target:70,menuPrice:n,status:c,description:d,allergens:[]}),I=[P('gd-chips','Chips (portion)','Sides',[['gi-potato',300,'g'],['gi-oil',50,'ml']],1,450,'ready','Hand-cut, twice-cooked chips.'),P('gd-tartare','Tartare sauce (batch of 20)','Sauces & extras',[['gi-mayo',1,'L'],['gi-capers',100,'g'],['gi-gherkin',150,'g'],['gi-lemon',2,'each']],20,void 0,'draft'),P('gd-fish','Fish & chips (example)','Mains',[['gi-haddock',220,'g'],['gi-batter',60,'g'],['dish:gd-chips',1,'each'],['gi-peas',80,'g'],['dish:gd-tartare',1,'each'],['gi-lemon',1,'each']],1,1695,'ready','Beer-battered haddock, chips, peas and tartare sauce.'),P('gd-pie','Steak pie (example)','Mains',[['gi-steak',2,'kg'],['gi-pastry',800,'g'],['gi-onion',500,'g'],['gi-stock',1,'L']],10,1595,'draft','Slow-braised steak under a puff pastry lid. Batch of 10.'),P('gd-caesar','Chicken Caesar (example)','Starters',[['gi-chicken',160,'g'],['gi-leaves',.5,'each'],['gi-parmesan',15,'g'],['gi-bread',.1,'each'],['gi-anchovy',8,'g']],1,1150,'draft'),P('gd-stp','Sticky toffee pudding (example)','Desserts',[['gi-sponge',.083,'each'],['gi-toffee',60,'ml'],['gi-icecream',70,'ml']],1,695,'ready','Warm date sponge, toffee sauce, vanilla ice cream.')];function y(e){const i=e=>I.some(i=>i.id===e.id&&JSON.stringify(i)===JSON.stringify(e))||/\(example\)/i.test(e.name),t=new Set(e.dishes.filter(e=>!i(e)).map(e=>e.id));let s=!0;for(;s;){s=!1;for(const i of e.dishes.filter(e=>t.has(e.id)))for(const e of i.lines)e.ingId.startsWith('dish:')&&!t.has(e.ingId.slice(5))&&(t.add(e.ingId.slice(5)),s=!0)}const a=e.dishes.filter(e=>t.has(e.id)),n=new Set(a.flatMap(e=>e.lines.map(e=>e.ingId))),c=e=>{const i=S.find(i=>i.id===e.id);if(!i)return!1;const t=({prices:e,...i})=>JSON.stringify(i);return t(i)===t(e)&&(!e.prices?.length||JSON.stringify(e.prices.map(e=>e.p))===JSON.stringify(i.prices?.map(e=>e.p)))};return{dishes:a,ingredients:e.ingredients.filter(e=>n.has(e.id)||!c(e))}}const v=(0,d.create)()((0,o.persist)((e,t)=>({ingredients:a.IS_ISOLATED_VENUE||i.LIVE_VENUE_BUILD?[]:S,dishes:a.IS_ISOLATED_VENUE||i.LIVE_VENUE_BUILD?[]:I,settings:{vatPct:20,pricePoints:!0,defaultTarget:70,multipleBasis:'inc',priceBasis:'latest',avgOf:5},alerts:[],saveIngredient:i=>{const s=t(),a=s.ingredients.find(e=>e.id===i.id),n=s.ingredients.map(e=>e.id===i.id?i:e);let c=s.alerts;if(a&&(a.packPrice!==i.packPrice||a.packSize!==i.packSize||a.wastePct!==i.wastePct)){const e=s.settings.vatPct,t=s.dishes.filter(e=>e.menuPrice).map(i=>{const t=(0,p.gpOf)((0,p.portionCost)(i,s.ingredients,s.dishes),i.menuPrice,e).gpPct,a=(0,p.gpOf)((0,p.portionCost)(i,n,s.dishes),i.menuPrice,e).gpPct;return{id:i.id,name:i.name,before:t,after:a,belowTarget:ae.aftere.packPrice/e.packSize/(1-(e.wastePct||0)/100),o=(d(i)-d(a))/d(a)*100;t.length&&(c=[{id:f('ma'),at:(new Date).toISOString(),ingredient:i.name,change:`${o>=0?'+':''}${o.toFixed(0)}%`,dishes:t},...c].slice(0,20))}e({ingredients:n,alerts:c})},addPricePaid:(e,i,s)=>{const a=t(),n=a.ingredients.find(i=>i.id===e);if(!(n&&i>0))return;const c=[...n.prices?.length?n.prices:[{p:n.packPrice,at:''}],{p:Math.round(i),at:s??(new Date).toISOString()}].slice(-20),d={...n,prices:c};t().saveIngredient({...d,packPrice:(0,p.costingPrice)(d,a.settings.priceBasis,a.settings.avgOf??5)})},addIngredient:i=>{const t=f('gi');return e(e=>({ingredients:[...e.ingredients,{...i,id:t}]})),t},saveDish:i=>e(e=>({dishes:e.dishes.some(e=>e.id===i.id)?e.dishes.map(e=>e.id===i.id?{...i,updatedAt:(new Date).toISOString()}:e):[{...i,updatedAt:(new Date).toISOString()},...e.dishes]})),removeDish:i=>e(e=>({dishes:e.dishes.filter(e=>e.id!==i)})),setSettings:i=>{const s={...t().settings,...i};if(e({settings:s}),void 0!==i.priceBasis||void 0!==i.avgOf)for(const e of t().ingredients){const i=(0,p.costingPrice)(e,s.priceBasis,s.avgOf??5);i!==e.packPrice&&t().saveIngredient({...e,packPrice:i})}},dismissAlert:i=>e(e=>({alerts:e.alerts.filter(e=>e.id!==i)}))}),{name:'covercharge-gpcalc-v1',storage:(0,o.createJSONStorage)(()=>c.default),version:4,migrate:async(e,t)=>(i.LIVE_VENUE_BUILD&&e&&(await(0,s.archiveChefCache)('gpcalc',e),e={...e,...y({...e,dishes:e.dishes||[],ingredients:e.ingredients||[]})}),t<2&&e&&(e.ingredients=(e.ingredients??[]).map(e=>e.prices?.length?e:{...e,prices:[{p:e.packPrice,at:(new Date).toISOString()}]}),e.settings={priceBasis:'latest',avgOf:5,...e.settings??{}}),e)}))},1147,[833,30,1131,5,1115,951,1116,1148]); +__d(function(g,r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DISH_CATEGORIES",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"pricesOf",{enumerable:!0,get:function(){return n}}),e.priceStats=i,Object.defineProperty(e,"costingPrice",{enumerable:!0,get:function(){return c}}),e.avgMenuPrice=function(t,n,i){const c=t.filter(t=>t.category===n&&t.menuPrice&&t.id!==i).map(t=>t.menuPrice);return c.length?{avg:Math.round(c.reduce((t,n)=>t+n,0)/c.length),count:c.length}:null},Object.defineProperty(e,"unitsFor",{enumerable:!0,get:function(){return a}}),e.lineCost=s,Object.defineProperty(e,"portionCost",{enumerable:!0,get:function(){return u}}),e.suggestAllergens=function t(n,i,c=[],o=0){const a=new Set;for(const s of n.lines)if(s.ingId.startsWith('dish:')){const n=c.find(t=>t.id===s.ingId.slice(5));n&&o<4&&((n.allergens??[]).forEach(t=>a.add(t)),t(n,i,c,o+1).forEach(t=>a.add(t)))}else i.find(t=>t.id===s.ingId)?.allergens?.forEach(t=>a.add(t));return[...a]},Object.defineProperty(e,"exVat",{enumerable:!0,get:function(){return d}}),e.gpOf=function(t,n,i){const c=d(n,i);return{ex:c,gpPct:c>0?(c-t)/c*100:0,cashGp:c-t,foodCostPct:c>0?t/c*100:0}},e.toPricePoint=f,e.suggestPrice=function(t,n,i,c){const o=Math.min(95,Math.max(0,n)),a=t/(1-o/100)*(1+i/100);return c?f(Math.ceil(a)):Math.ceil(a)},Object.defineProperty(e,"toneFor",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"money",{enumerable:!0,get:function(){return m}}),Object.defineProperty(e,"pct",{enumerable:!0,get:function(){return p}}),e.multipleOf=function(t,n,i,c="inc"){return t<=0?0:('inc'===c?n:d(n,i))/t},Object.defineProperty(e,"fmtX",{enumerable:!0,get:function(){return h}}),e.suggestForMultiple=function(t,n,i,c,o){const a=t*Math.max(0,n)*('ex'===c?1+i/100:1);return o?f(Math.ceil(a)):Math.ceil(a)};const t=['Starters','Mains','From the Grill','Sides','Desserts','Specials','Kids','Sauces & extras'],n=t=>t.prices?.length?t.prices:[{p:t.packPrice,at:''}];function i(t,i=5){const c=n(t),o=c.slice(-Math.max(1,i)),a=Math.round(o.reduce((t,n)=>t+n.p,0)/o.length);return{latest:c[c.length-1].p,avg:a,count:o.length,min:Math.min(...o.map(t=>t.p)),max:Math.max(...o.map(t=>t.p))}}const c=(t,n="latest",c=5)=>'average'===n?i(t,c).avg:i(t,c).latest;const o={kg:{dim:'mass',f:1e3},g:{dim:'mass',f:1},L:{dim:'vol',f:1e3},ml:{dim:'vol',f:1},each:{dim:'each',f:1}},a=t=>'mass'===o[t].dim?['g','kg']:'vol'===o[t].dim?['ml','L']:['each'];function s(t,n,i=[],c=0){if(t.ingId.startsWith('dish:')){const o=i.find(n=>n.id===t.ingId.slice(5));return o&&c<4?u(o,n,i,c+1)*t.qty:0}const a=n.find(n=>n.id===t.ingId);if(!a||!a.packSize)return 0;const s=o[a.packUnit],d=o[t.unit];if(!d||s.dim!==d.dim)return 0;const f=a.packPrice/(a.packSize*s.f),l=Math.min(95,Math.max(0,t.wastePct??a.wastePct??0));return t.qty*d.f*f/(1-l/100)}const u=(t,n,i=[],c=0)=>t.lines.reduce((t,o)=>t+s(o,n,i,c),0)/Math.max(1,t.portions||1);const d=(t,n)=>t/(1+n/100);function f(t){const n=Math.floor(t/100),i=t-100*n;return i<=50?100*n+50:i<=95?100*n+95:100*(n+1)+50}const l=(t,n)=>t>=n-.05?'ok':t>=n-5?'amber':'red',m=t=>`\xa3${(Math.round(t)/100).toFixed(2)}`,p=t=>`${t.toFixed(1)}%`;const h=t=>`${t.toFixed(1)}x`},1148,[]); +__d(function(g,r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.inviteFromLocation=function(n,t){const o=new URLSearchParams(n).get('invite');if(o)return o;const s=(t||'').match(/[#&]invite=([A-Za-z0-9_-]{10,})/);return s?s[1]:null},e.addressWithoutInvite=function(n){try{const t=new URL(n);t.searchParams.delete('invite');const o=t.hash.replace(/^#/,'').split('&').filter(n=>n&&!n.startsWith('invite=')).join('&');return t.hash=o?`#${o}`:'',t.toString()}catch{return n}},e.inviteRefusal=function(n){return/already been used/i.test(n)?'This link has already been used on another device. Ask your manager for a new one.':/expired/i.test(n)?'This link has expired. Ask your manager for a new one.':/replaced|switched off|not valid|invalid|unknown invite/i.test(n)?'This link has been replaced or switched off. Ask your manager for a new one.':/personal app link is incomplete/i.test(n)?'Open the complete personal iPhone link your manager sent.':/no longer active/i.test(n)?'This person is no longer on the team. Ask your manager if this is wrong.':null},Object.defineProperty(e,"WIPE_PREFIXES",{enumerable:!0,get:function(){return n}}),e.keysToWipe=function(t){return t.filter(t=>n.some(n=>t.startsWith(n)))};const n=['covercharge-','cc-sync:','cc-','sb-']},1149,[]); +__d(function(g,r,_i,a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"hrRemote",{enumerable:!0,get:function(){return y}}),_e.exampleHr=f,_e.stripHrSamples=m,Object.defineProperty(_e,"useHr",{enumerable:!0,get:function(){return q}});var e,t=r(_d[0]),s=r(_d[1]),n=r(_d[2]),o=r(_d[3]),i=r(_d[4]),u=(e=i)&&e.__esModule?e:{default:e},d=r(_d[5]),l=r(_d[6]),c=r(_d[7]),h=r(_d[8]);const y={live:!1,checkout:null,post:null,vote:null,moderate:null,reply:null,trend:null,shouts:null,log:null,refresh:null},v=(e,t,s)=>(0,c.oneWayToken)(e,`shift:${t}:${s}`),p=(e,t)=>{const s=new Date(`${e}T12:00:00Z`);return s.setUTCDate(s.getUTCDate()+t),s.toISOString().slice(0,10)};function f(e,t){const s=[];for(let n=14;n>=1;n--){const o=p(t,-n),i=4===n?2:4+7*n%4;for(let t=0;t!((0,s.isAnchorage)(e.venue)&&e.example)),questions:e.questions.filter(e=>!((0,s.isAnchorage)(e.venue)&&/^hrq-ex-[123]$/.test(e.id))),shouts:e.shouts.filter(e=>!((0,s.isAnchorage)(e.venue)&&/^hrs-ex-[123]$/.test(e.id)))}}const q=(0,d.create)()((0,l.persist)((e,t)=>({secret:(0,c.newSecret)(),answered:[],voted:{},checkins:[],questions:[],shouts:[],log:[],seeded:{},ensure:(s,i)=>{if(n.LIVE_VENUE_BUILD||o.IS_ISOLATED_VENUE||['souters','kirkmichael','wildings'].includes(s)||t().seeded[s]||y.live)return;const u=f(s,i);e(e=>({seeded:{...e.seeded,[s]:!0},checkins:[...e.checkins,...u.checkins],questions:[...e.questions,...u.questions],shouts:[...e.shouts,...u.shouts]}))},hasAnswered:(e,s)=>t().answered.includes(v(t().secret,e,s)),submit:s=>{const n=t(),o=v(n.secret,s.rid,s.shiftKey);if(n.answered.includes(o))return'already';const i=(0,c.checkInPayload)({venue:s.rid,day:s.day,token:o,morale:s.morale,staffing:s.staffing}),u=s.question?(0,c.cleanQuestion)(s.question):null,d=s.shoutTo?.trim().slice(0,80)||void 0,l=s.shoutBody?.trim().slice(0,280)||void 0;return e({answered:[...n.answered,o].slice(-300)}),y.live&&y.checkout?(y.checkout({rid:s.rid,shiftKey:'',day:i.day,morale:i.morale,staffing:i.staffing,question:u??void 0,kind:s.kind??'up',shoutTo:d,shoutBody:l,token:o}),'queued'):(e(e=>({checkins:[...e.checkins,{venue:i.venue,day:i.day,morale:i.morale,staffing:i.staffing}],questions:u?[...e.questions,{id:(0,h.uuid)(),venue:s.rid,body:u,kind:s.kind??'up',up:0,yes:0,no:0,hidden:!1,postedOn:s.day}]:e.questions,shouts:d?[...e.shouts,{id:(0,h.uuid)(),venue:s.rid,day:s.day,to:d,body:l}]:e.shouts})),'ok')},skip:(s,n)=>{const o=t(),i=v(o.secret,s,n);o.answered.includes(i)||e({answered:[...o.answered,i].slice(-300)})},post:(t,s,n,o)=>{const i=(0,c.cleanQuestion)(s);if(!i)return null;const u=(0,h.uuid)();return e(e=>({questions:[...e.questions,{id:u,venue:t,body:i,kind:n,up:0,yes:0,no:0,hidden:!1,postedOn:o}]})),y.live&&y.post&&y.post(t,u,i,n),u},vote:(s,n)=>{const o=t();if(o.voted[s])return!1;const i=o.questions.find(e=>e.id===s);if(!i||i.hidden)return!1;const u='up'===i.kind?1:n;return e({voted:{...o.voted,[s]:u},questions:o.questions.map(e=>e.id===s?(0,c.applyVote)(e,u):e)}),y.live&&y.vote&&y.vote(s,(0,c.oneWayToken)(o.secret,`vote:${s}`),u),!0},moderate:(s,n,o,i)=>{const u=t().questions.find(e=>e.id===s);u&&(e(e=>({questions:e.questions.map(e=>e.id===s?{...e,hidden:'hide'===n}:e),log:[{id:(0,h.uuid)(),venue:u.venue,questionId:s,action:n,reason:o.trim()||void 0,by:i,at:(new Date).toISOString()},...e.log].slice(0,500)})),y.live&&y.moderate&&y.moderate(s,n,o.trim()))},reply:(s,n,o)=>{const i=n.trim().slice(0,600),u=t().questions.find(e=>e.id===s);if(!u)return;const d=(new Date).toISOString();e(e=>({questions:e.questions.map(e=>e.id===s?{...e,reply:i||void 0,replyAt:i?d:void 0}:e),log:[{id:(0,h.uuid)(),venue:u.venue,questionId:s,action:'reply',by:o,at:d},...e.log].slice(0,500)})),y.live&&y.reply&&y.reply(s,i)},setRemoteBoard:(t,s)=>e(e=>({questions:[...e.questions.filter(e=>e.venue!==t),...s]})),upsertRemote:t=>e(e=>({questions:e.questions.some(e=>e.id===t.id)?e.questions.map(e=>e.id===t.id?t:e):[...e.questions,t]}))}),{name:'covercharge-hr-v1',version:3,storage:(0,l.createJSONStorage)(()=>u.default),migrate:async e=>n.LIVE_VENUE_BUILD&&e?(await(0,t.archiveChefCache)('hr',e),{...e,...m(e)}):e}))},1150,[1131,1023,833,5,1115,951,1116,1151,1032]); +__d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"MIN_ANSWERS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"DEFAULT_WORDING",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"DEFAULT_HR",{enumerable:!0,get:function(){return r}}),e.hrSettingsOf=function(t){const n=t??{},r=n.wording??{},s=Object.fromEntries(Object.entries(o).map(([t,n])=>[t,a(r[t],'intro'===t||'staffing'===t||'question'===t?160:60,n)]));return{on:!1!==n.on,askQuestion:!1!==n.askQuestion,askShout:!1!==n.askShout,board:!1!==n.board,wording:s}},Object.defineProperty(e,"MORALE_STEPS",{enumerable:!0,get:function(){return s}}),e.moraleWord=function(t,n=o){return t<=1?n.moraleLow:t>=5?n.moraleHigh:2===t?'Fairly low':3===t?'OK':'Good'},Object.defineProperty(e,"STAFF_STOPS",{enumerable:!0,get:function(){return u}}),e.snapStaffing=i,e.staffingWord=function(t,n=o){const r=i(t);return r<=12?n.staffLow:r<45?"A bit short":r<=55?n.staffMid:r<88?"A bit over":n.staffHigh},e.oneWayToken=function(n,o){return(0,t.sha256HexSync)(`cc-hr:${n}:${o}`).slice(0,40)},e.newSecret=function(){let t='';const n=globalThis.crypto;if(n?.getRandomValues){return n.getRandomValues(new Uint8Array(24)).forEach(n=>{t+=n.toString(16).padStart(2,'0')}),t}for(let n=0;n<48;n++)t+=Math.floor(16*Math.random()).toString(16);return t},e.checkInPayload=function(t){const n=Math.max(1,Math.min(5,Math.round(t.morale)));return{venue:t.venue,day:t.day,token:t.token,morale:n,staffing:null==t.staffing?null:i(t.staffing)}},e.dayResults=function(t,o=n){const r=new Map;for(const n of t){const t=r.get(n.day)??[];t.push(n),r.set(n.day,t)}const a=[];let s=0;for(const[t,n]of[...r.entries()].sort(([t],[n])=>t.localeCompare(n))){if(n.lengtht.staffing).filter(t=>null!=t);a.push({day:t,answers:n.length,morale:Math.round(n.reduce((t,n)=>t+n.morale,0)/n.length*10)/10,staffing:r.length?Math.round(r.reduce((t,n)=>t+n,0)/r.length):null,short:r.filter(t=>t<45).length,perfect:r.filter(t=>t>=45&&t<=55).length,over:r.filter(t=>t>55).length})}return{shown:a,held:s}},Object.defineProperty(e,"QUESTION_MAX",{enumerable:!0,get:function(){return f}}),e.cleanQuestion=function(t){const n=t.replace(/\s+/g,' ').trim().slice(0,f);return n.length>=3?n:null},e.boardOrder=function(t,n){const o=t=>'up'===t.kind?t.up:t.yes+t.no;return t.filter(t=>n||!t.hidden).sort((t,n)=>Number(t.hidden)-Number(n.hidden)||o(n)-o(t)||n.postedOn.localeCompare(t.postedOn)||t.id.localeCompare(n.id))},e.applyVote=function(t,n){return'up'===t.kind?{...t,up:t.up+1}:1===n?{...t,yes:t.yes+1}:{...t,no:t.no+1}};var t=_r(d[0]);const n=3,o={intro:'Before you go: 3 quick taps, about 15 seconds. Your name is never saved with your answers.',morale:'How was team morale today?',moraleLow:'Low',moraleHigh:'High',staffing:'Was there enough staff on today for the number of customers?',staffLow:'Not enough',staffMid:'Perfect',staffHigh:'Overstaffed',question:'Got a question you\u2019d like to post anonymously for the team to vote on?',shout:'Shout out a teammate?'},r={on:!0,askQuestion:!0,askShout:!0,board:!0,wording:o},a=(t,n,o)=>('string'==typeof t?t.trim().slice(0,n):'')||o;const s=[1,2,3,4,5];const u=[0,12.5,25,37.5,50,62.5,75,87.5,100].map(t=>Math.round(t));function i(t){const n=Math.max(0,Math.min(100,Number.isFinite(t)?t:50));return u.reduce((t,o)=>Math.abs(o-n)>>0;o.push(c>>>24&255,c>>>16&255,c>>>8&255,255&c,h>>>24&255,h>>>16&255,h>>>8&255,255&h);const l=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),u=new Uint32Array(64),f=(t,n)=>t>>>n|t<<32-n;for(let n=0;n>>3,e=f(u[t-2],17)^f(u[t-2],19)^u[t-2]>>>10;u[t]=u[t-16]+n+u[t-7]+e>>>0}let e=l[0],s=l[1],c=l[2],h=l[3],a=l[4],i=l[5],p=l[6],d=l[7];for(let n=0;n<64;n++){const o=d+(f(a,6)^f(a,11)^f(a,25))+(a&i^~a&p)+t[n]+u[n]>>>0,l=(f(e,2)^f(e,13)^f(e,22))+(e&s^e&c^s&c)>>>0;d=p,p=i,i=a,a=h+o>>>0,h=c,c=s,s=e,e=o+l>>>0}l[0]=l[0]+e>>>0,l[1]=l[1]+s>>>0,l[2]=l[2]+c>>>0,l[3]=l[3]+h>>>0,l[4]=l[4]+a>>>0,l[5]=l[5]+i>>>0,l[6]=l[6]+p>>>0,l[7]=l[7]+d>>>0}return Array.from(l).map(t=>t.toString(16).padStart(8,'0')).join('')};const t=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function n(t){const n=[];for(let e=0;e=55296&&o<=56319&&e+1=56320&&n<=57343&&(o=65536+(o-55296<<10)+(n-56320),e++)}o<128?n.push(o):o<2048?n.push(192|o>>6,128|63&o):o<65536?n.push(224|o>>12,128|o>>6&63,128|63&o):n.push(240|o>>18,128|o>>12&63,128|o>>6&63,128|63&o)}return n}},1152,[]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"FunctionRegion",{enumerable:!0,get:function(){return e.FunctionRegion}}),Object.defineProperty(_e,"FunctionsError",{enumerable:!0,get:function(){return e.FunctionsError}}),Object.defineProperty(_e,"FunctionsFetchError",{enumerable:!0,get:function(){return e.FunctionsFetchError}}),Object.defineProperty(_e,"FunctionsHttpError",{enumerable:!0,get:function(){return e.FunctionsHttpError}}),Object.defineProperty(_e,"FunctionsRelayError",{enumerable:!0,get:function(){return e.FunctionsRelayError}}),Object.defineProperty(_e,"PostgrestError",{enumerable:!0,get:function(){return t.PostgrestError}}),Object.defineProperty(_e,"StorageApiError",{enumerable:!0,get:function(){return r.StorageApiError}}),Object.defineProperty(_e,"SupabaseClient",{enumerable:!0,get:function(){return x}}),Object.defineProperty(_e,"createClient",{enumerable:!0,get:function(){return N}});var e=_r(d[0]),t=_r(d[1]),n=_r(d[2]);Object.keys(n).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return n[e]}})});var r=_r(d[3]),s=_r(d[4]);Object.keys(s).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return s[e]}})});let o,i="";var c;if("undefined"!=typeof Deno)i="deno",o=null===(c=Deno.version)||void 0===c?void 0:c.deno;else if("undefined"!=typeof document)i="web";else if("undefined"!=typeof navigator&&"ReactNative"===navigator.product)i="react-native";else{var u;i="node",o="undefined"!=typeof process?null===(u=process.version)||void 0===u?void 0:u.replace(/^v/,""):void 0}const l=[`runtime=${i}`];o&&l.push(`runtime-version=${o}`);const h={headers:{"X-Client-Info":`supabase-js/2.109.0; ${l.join("; ")}`}},f={schema:"public"},p={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},b={},v={enabled:!1,respectSamplingDecision:!0};let y=null;function w(){return e=this,t=void 0,r=function*(){try{const e=yield(null===y&&(y=import("@opentelemetry/api").catch(()=>null)),y);if(!e||!e.propagation||!e.context)return null;const t={};e.propagation.inject(e.context.active(),t);const n=t.traceparent;return n?{traceparent:n,tracestate:t.tracestate,baggage:t.baggage}:null}catch(e){return null}},new((n=void 0)||(n=Promise))(function(s,o){function i(e){try{u(r.next(e))}catch(e){o(e)}}function c(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(i,c)}u((r=r.apply(e,t||[])).next())});var e,t,n,r}function k(e){if(!e||"string"!=typeof e)return null;const t=e.split("-");if(4!==t.length)return null;const[n,r,s,o]=t;if(2!==n.length||32!==r.length||16!==s.length||2!==o.length)return null;const i=/^[0-9a-f]+$/i;return i.test(n)&&i.test(r)&&i.test(s)&&i.test(o)?"00000000000000000000000000000000"===r||"0000000000000000"===s?null:{version:n,traceId:r,parentId:s,traceFlags:o,isSampled:!(1&~parseInt(o,16))}:null}function O(e,t){if(!e||!t||0===t.length)return!1;let n;if(e instanceof URL)n=e;else try{n=new URL(e)}catch(e){return!1}for(const e of t)try{if("string"==typeof e){if(T(n.hostname,e))return!0}else if(e instanceof RegExp){if(e.test(n.hostname))return!0}else if("function"==typeof e&&e(n))return!0}catch(e){continue}return!1}function T(e,t){if(t===e)return!0;if(t.startsWith("*.")){const n=t.slice(2);if(e.endsWith(n)&&(e===n||e.endsWith("."+n)))return!0}return!1}function P(e){const t=[];try{const n=new URL(e);t.push(n.hostname)}catch(e){}return t.push("*.supabase.co","*.supabase.in"),t.push("localhost","127.0.0.1","[::1]"),t}function S(e){return(S="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function j(e,t){if("object"!=S(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=S(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function E(e){var t=j(e,"string");return"symbol"==S(t)?t:t+""}function U(e,t,n){return(t=E(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function A(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function R(e){for(var t=1;te?(...t)=>e(...t):(...e)=>fetch(...e),F=(e,t,n,r,s)=>{const o=C(r),i=Headers,c=!0===(null==s?void 0:s.enabled),u=!1!==(null==s?void 0:s.respectSamplingDecision),l=c?P(t):null;return async(t,r)=>{var s;const c=null!==(s=await n())&&void 0!==s?s:e;let h=new i(null==r?void 0:r.headers);if(h.has("apikey")||h.set("apikey",e),h.has("Authorization")||h.set("Authorization",`Bearer ${c}`),l){const e=await _(t,l,u);e&&(e.traceparent&&!h.has("traceparent")&&h.set("traceparent",e.traceparent),e.tracestate&&!h.has("tracestate")&&h.set("tracestate",e.tracestate),e.baggage&&!h.has("baggage")&&h.set("baggage",e.baggage))}return o(t,R(R({},r),{},{headers:h}))}};async function _(e,t,n){if(!O("string"==typeof e||e instanceof URL?e:e.url,t))return null;const r=await w();if(!r||!r.traceparent)return null;if(n){const e=k(r.traceparent);if(e&&!e.isSampled)return null}return r}function L(e){return"boolean"==typeof e?{enabled:e}:e}function I(e,t){var n,r,s,o,i,c;const{db:u,auth:l,realtime:h,global:f}=e,{db:p,auth:b,realtime:v,global:y}=t,w=L(e.tracePropagation),k=L(t.tracePropagation),O={db:R(R({},p),u),auth:R(R({},b),l),realtime:R(R({},v),h),storage:{},global:R(R(R({},y),f),{},{headers:R(R({},null!==(n=null==y?void 0:y.headers)&&void 0!==n?n:{}),null!==(r=null==f?void 0:f.headers)&&void 0!==r?r:{})}),tracePropagation:{enabled:null!==(s=null!==(o=null==w?void 0:w.enabled)&&void 0!==o?o:null==k?void 0:k.enabled)&&void 0!==s&&s,respectSamplingDecision:null===(i=null!==(c=null==w?void 0:w.respectSamplingDecision)&&void 0!==c?c:null==k?void 0:k.respectSamplingDecision)||void 0===i||i},accessToken:async()=>""};return e.accessToken?O.accessToken=e.accessToken:delete O.accessToken,O}function D(e){const t=null==e?void 0:e.trim();if(!t)throw new Error("supabaseUrl is required.");if(!t.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL((n=t).endsWith("/")?n:n+"/")}catch(e){throw Error("Invalid supabaseUrl: Provided URL is malformed.")}var n}var K=class extends s.AuthClient{constructor(e){super(e)}},x=class{constructor(e,n,s){var o,i;this.supabaseUrl=e,this.supabaseKey=n;const c=D(e);if(!n)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",c),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",c),this.storageUrl=new URL("storage/v1",c),this.functionsUrl=new URL("functions/v1",c);const u=`sb-${c.hostname.split(".")[0]}-auth-token`,l=I(null!=s?s:{},{db:f,realtime:b,auth:R(R({},p),{},{storageKey:u}),global:h,tracePropagation:v});var y;(this.settings=l,this.storageKey=null!==(o=l.auth.storageKey)&&void 0!==o?o:"",this.headers=null!==(i=l.global.headers)&&void 0!==i?i:{},l.accessToken)?(this.accessToken=l.accessToken,this.auth=new Proxy({},{get:(e,t)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(t)} is not possible`)}})):this.auth=this._initSupabaseAuthClient(null!==(y=l.auth)&&void 0!==y?y:{},this.headers,l.global.fetch);this.fetch=F(n,e,this._getAccessToken.bind(this),l.global.fetch,l.tracePropagation),this.realtime=this._initRealtimeClient(R({headers:this.headers,accessToken:this._getAccessToken.bind(this),fetch:this.fetch},l.realtime)),this.accessToken&&Promise.resolve(this.accessToken()).then(e=>this.realtime.setAuth(e)).catch(e=>console.warn("Failed to set initial Realtime auth token:",e)),this.rest=new t.PostgrestClient(new URL("rest/v1",c).href,{headers:this.headers,schema:l.db.schema,fetch:this.fetch,timeout:l.db.timeout,urlLengthLimit:l.db.urlLengthLimit}),this.storage=new r.StorageClient(this.storageUrl.href,this.headers,this.fetch,null==s?void 0:s.storage),l.accessToken||this._listenForAuthEvents()}get functions(){return new e.FunctionsClient(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e,t={},n={head:!1,get:!1,count:void 0}){return this.rest.rpc(e,t,n)}channel(e,t={config:{}}){return this.realtime.channel(e,t)}getChannels(){return this.realtime.getChannels()}removeChannel(e){return this.realtime.removeChannel(e)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var e,t,n=this;if(n.accessToken)return await n.accessToken();const{data:r}=await n.auth.getSession();return null!==(e=null===(t=r.session)||void 0===t?void 0:t.access_token)&&void 0!==e?e:n.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:t,detectSessionInUrl:n,storage:r,userStorage:s,storageKey:o,flowType:i,lock:c,debug:u,throwOnError:l,experimental:h,lockAcquireTimeout:f,skipAutoInitialize:p},b,v){const y={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new K({url:this.authUrl.href,headers:R(R({},y),b),storageKey:o,autoRefreshToken:e,persistSession:t,detectSessionInUrl:n,storage:r,userStorage:s,flowType:i,lock:c,debug:u,throwOnError:l,experimental:h,fetch:v,lockAcquireTimeout:f,skipAutoInitialize:p,hasCustomAuthorizationHeader:Object.keys(this.headers).some(e=>"authorization"===e.toLowerCase())})}_initRealtimeClient(e){return new n.RealtimeClient(this.realtimeUrl.href,R(R({},e),{},{params:R(R({},{apikey:this.supabaseKey}),null==e?void 0:e.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((e,t)=>{this._handleTokenChanged(e,"CLIENT",null==t?void 0:t.access_token)})}_handleTokenChanged(e,t,n){"TOKEN_REFRESHED"!==e&&"SIGNED_IN"!==e||this.changedAccessToken===n?"SIGNED_OUT"===e&&(this.realtime.setAuth(),"STORAGE"==t&&this.auth.signOut(),this.changedAccessToken=void 0):(this.changedAccessToken=n,this.realtime.setAuth(n))}};const N=(e,t,n)=>new x(e,t,n);(function(){if("undefined"!=typeof window)return!1;const e=globalThis.process;if(!e)return!1;const t=e.version;if(null==t)return!1;const n=t.match(/^v(\d+)\./);return!!n&&parseInt(n[1],10)<=18})()&&console.warn("\u26a0\ufe0f Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217")},1153,[1154,1159,1160,1175,1177]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"FunctionsClient",{enumerable:!0,get:function(){return n.FunctionsClient}}),Object.defineProperty(e,"FunctionsError",{enumerable:!0,get:function(){return t.FunctionsError}}),Object.defineProperty(e,"FunctionsFetchError",{enumerable:!0,get:function(){return t.FunctionsFetchError}}),Object.defineProperty(e,"FunctionsHttpError",{enumerable:!0,get:function(){return t.FunctionsHttpError}}),Object.defineProperty(e,"FunctionsRelayError",{enumerable:!0,get:function(){return t.FunctionsRelayError}}),Object.defineProperty(e,"FunctionRegion",{enumerable:!0,get:function(){return t.FunctionRegion}});var n=r(d[0]),t=r(d[1])},1154,[1155,1158]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"FunctionsClient",{enumerable:!0,get:function(){return s}});var t=r(d[0]),n=r(d[1]),o=r(d[2]);class s{constructor(t,{headers:s={},customFetch:c,region:l=o.FunctionRegion.Any}={}){this.url=t,this.headers=s,this.region=l,this.fetch=(0,n.resolveFetch)(c)}setAuth(t){this.headers.Authorization=`Bearer ${t}`}invoke(n){return(0,t.__awaiter)(this,arguments,void 0,function*(t,n={}){var s;let c,l;try{const{headers:u,method:f,body:h,signal:p,timeout:y}=n;let b={},{region:F}=n;F||(F=this.region);const v=new URL(`${this.url}/${t}`);let w;F&&'any'!==F&&(b['x-region']=F,v.searchParams.set('forceFunctionRegion',F));const j=!!u&&Object.keys(u).some(t=>'content-type'===t.toLowerCase());h&&!j?'undefined'!=typeof Blob&&h instanceof Blob||h instanceof ArrayBuffer?(b['Content-Type']='application/octet-stream',w=h):'string'==typeof h?(b['Content-Type']='text/plain',w=h):'undefined'!=typeof FormData&&h instanceof FormData?w=h:(b['Content-Type']='application/json',w=JSON.stringify(h)):w=!h||'string'==typeof h||'undefined'!=typeof Blob&&h instanceof Blob||h instanceof ArrayBuffer||'undefined'!=typeof FormData&&h instanceof FormData?h:JSON.stringify(h);let O=p;y&&(l=new AbortController,c=setTimeout(()=>l.abort(),y),p?(O=l.signal,p.addEventListener('abort',()=>l.abort())):O=l.signal);const x=yield this.fetch(v.toString(),{method:f||'POST',headers:Object.assign(Object.assign(Object.assign({},b),this.headers),u),body:w,signal:O}).catch(t=>{throw new o.FunctionsFetchError(t)}),B=x.headers.get('x-relay-error');if(B&&'true'===B)throw new o.FunctionsRelayError(x);if(!x.ok)throw new o.FunctionsHttpError(x);let C,T=(null!==(s=x.headers.get('Content-Type'))&&void 0!==s?s:'text/plain').split(';')[0].trim();return C='application/json'===T?yield x.json():'application/octet-stream'===T||'application/pdf'===T?yield x.blob():'text/event-stream'===T?x:'multipart/form-data'===T?yield x.formData():yield x.text(),{data:C,error:null,response:x}}catch(t){return{data:null,error:t,response:t instanceof o.FunctionsHttpError||t instanceof o.FunctionsRelayError?t.context:void 0}}finally{c&&clearTimeout(c)}})}}},1155,[1156,1157,1158]); +__d(function(_g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return G}}),_e.__extends=t,Object.defineProperty(_e,"__assign",{enumerable:!0,get:function(){return r}}),_e.__rest=n,_e.__decorate=o,_e.__param=a,_e.__esDecorate=i,_e.__runInitializers=c,_e.__propKey=u,_e.__setFunctionName=s,_e.__metadata=f,_e.__awaiter=l,_e.__generator=p,Object.defineProperty(_e,"__createBinding",{enumerable:!0,get:function(){return y}}),_e.__exportStar=_,_e.__values=d,_e.__read=h,_e.__spread=b,_e.__spreadArrays=v,_e.__spreadArray=w,_e.__await=m,_e.__asyncGenerator=g,_e.__asyncDelegator=O,_e.__asyncValues=j,_e.__makeTemplateObject=P,_e.__importStar=x,_e.__importDefault=T,_e.__classPrivateFieldGet=I,_e.__classPrivateFieldSet=D,_e.__classPrivateFieldIn=R,_e.__addDisposableResource=k,_e.__disposeResources=F,_e.__rewriteRelativeImportExtension=C;var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};function t(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}var r=function(){return r=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=0;c--)(o=e[c])&&(i=(a<3?o(i):a>3?o(t,r,i):o(t,r))||i);return a>3&&i&&Object.defineProperty(t,r,i),i}function a(e,t){return function(r,n){t(r,n,e)}}function i(e,t,r,n,o,a){function i(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var c,u=n.kind,s="getter"===u?"get":"setter"===u?"set":"value",f=!t&&e?n.static?e:e.prototype:null,l=t||(f?Object.getOwnPropertyDescriptor(f,n.name):{}),p=!1,y=r.length-1;y>=0;y--){var _={};for(var d in n)_[d]="access"===d?{}:n[d];for(var d in n.access)_.access[d]=n.access[d];_.addInitializer=function(e){if(p)throw new TypeError("Cannot add initializers after decoration has completed");a.push(i(e||null))};var h=(0,r[y])("accessor"===u?{get:l.get,set:l.set}:l[s],_);if("accessor"===u){if(void 0===h)continue;if(null===h||"object"!=typeof h)throw new TypeError("Object expected");(c=i(h.get))&&(l.get=c),(c=i(h.set))&&(l.set=c),(c=i(h.init))&&o.unshift(c)}else(c=i(h))&&("field"===u?o.unshift(c):l[s]=c)}f&&Object.defineProperty(f,n.name,l),p=!0}function c(e,t,r){for(var n=arguments.length>2,o=0;o0&&o[o.length-1])||6!==c[0]&&2!==c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function h(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,a=r.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)i.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(o)throw o.error}}return i}function b(){for(var e=[],t=0;t1||c(e,t)})},t&&(n[e]=t(n[e])))}function c(e,t){try{(r=o[e](t)).value instanceof m?Promise.resolve(r.value.v).then(u,s):f(a[0][2],r)}catch(e){f(a[0][3],e)}var r}function u(e){c("next",e)}function s(e){c("throw",e)}function f(e,t){e(t),a.shift(),a.length&&c(a[0][0],a[0][1])}}function O(e){var t,r;return t={},n("next"),n("throw",function(e){throw e}),n("return"),t[Symbol.iterator]=function(){return this},t;function n(n,o){t[n]=e[n]?function(t){return(r=!r)?{value:m(e[n](t)),done:!1}:o?o(t):t}:o}}function j(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=d(e),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise(function(n,a){o(n,a,(t=e[r](t)).done,t.value)})}}function o(e,t,r,n){Promise.resolve(n).then(function(t){e({value:t,done:r})},t)}}function P(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var S=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t},E=function(e){return E=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t},E(e)};function x(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r=E(e),n=0;nt?(...n)=>t(...n):(...t)=>fetch(...t)},1157,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"FunctionsError",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"FunctionsFetchError",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"FunctionsRelayError",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"FunctionsHttpError",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"FunctionRegion",{enumerable:!0,get:function(){return u}});class t extends Error{constructor(t,n="FunctionsError",s){super(t),this.name=n,this.context=s}toJSON(){return{name:this.name,message:this.message,context:this.context}}}class n extends t{constructor(t){super('Failed to send a request to the Edge Function','FunctionsFetchError',t)}}class s extends t{constructor(t){super('Relay Error invoking the Edge Function','FunctionsRelayError',t)}}class o extends t{constructor(t){super('Edge Function returned a non-2xx status code','FunctionsHttpError',t)}}var u;!(function(t){t.Any="any",t.ApNortheast1="ap-northeast-1",t.ApNortheast2="ap-northeast-2",t.ApSouth1="ap-south-1",t.ApSoutheast1="ap-southeast-1",t.ApSoutheast2="ap-southeast-2",t.CaCentral1="ca-central-1",t.EuCentral1="eu-central-1",t.EuWest1="eu-west-1",t.EuWest2="eu-west-2",t.EuWest3="eu-west-3",t.SaEast1="sa-east-1",t.UsEast1="us-east-1",t.UsWest1="us-west-1",t.UsWest2="us-west-2"})(u||(u={}))},1158,[]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"PostgrestBuilder",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"PostgrestClient",{enumerable:!0,get:function(){return $}}),Object.defineProperty(_e,"PostgrestError",{enumerable:!0,get:function(){return s}}),Object.defineProperty(_e,"PostgrestFilterBuilder",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"PostgrestQueryBuilder",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"PostgrestTransformBuilder",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return w}});const e=e=>Math.min(1e3*2**e,3e4),t=[520,503],r=["GET","HEAD","OPTIONS"];var s=class extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.code=e.code}toJSON(){return{name:this.name,message:this.message,details:this.details,hint:this.hint,code:this.code}}};function n(e,t){return new Promise(r=>{if(null==t?void 0:t.aborted)return void r();const s=setTimeout(()=>{null==t||t.removeEventListener("abort",n),r()},e);function n(){clearTimeout(s),r()}null==t||t.addEventListener("abort",n)})}function i(e,s,n,i){return!(!i||n>=3)&&(!!r.includes(e)&&!!t.includes(s))}var l=class{constructor(e){var t,r,s,n,i;this.shouldThrowOnError=!1,this.retryEnabled=!0,this.method=e.method,this.url=e.url,this.headers=new Headers(e.headers),this.schema=e.schema,this.body=e.body,this.shouldThrowOnError=null!==(t=e.shouldThrowOnError)&&void 0!==t&&t,this.signal=e.signal,this.isMaybeSingle=null!==(r=e.isMaybeSingle)&&void 0!==r&&r,this.shouldStripNulls=null!==(s=e.shouldStripNulls)&&void 0!==s&&s,this.urlLengthLimit=null!==(n=e.urlLengthLimit)&&void 0!==n?n:8e3,this.retryEnabled=null===(i=e.retry)||void 0===i||i,e.fetch?this.fetch=e.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}stripNulls(){if("text/csv"===this.headers.get("Accept"))throw new Error("stripNulls() cannot be used with csv()");return this.shouldStripNulls=!0,this}setHeader(e,t){return this.headers=new Headers(this.headers),this.headers.set(e,t),this}retry(e){return this.retryEnabled=e,this}then(t,s){var l=this;if(void 0===this.schema||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),"GET"!==this.method&&"HEAD"!==this.method&&this.headers.set("Content-Type","application/json"),this.shouldStripNulls){const e=this.headers.get("Accept");"application/vnd.pgrst.object+json"===e?this.headers.set("Accept","application/vnd.pgrst.object+json;nulls=stripped"):e&&"application/json"!==e||this.headers.set("Accept","application/vnd.pgrst.array+json;nulls=stripped")}const o=this.fetch;let h=(async()=>{let t=0;for(;;){const u={};let c;l.headers.forEach((e,t)=>{u[t]=e}),t>0&&(u["X-Retry-Count"]=String(t));try{c=await o(l.url.toString(),{method:l.method,headers:u,body:JSON.stringify(l.body,(e,t)=>"bigint"==typeof t?t.toString():t),signal:l.signal})}catch(s){if("AbortError"===(null==s?void 0:s.name)||"ABORT_ERR"===(null==s?void 0:s.code))throw s;if(!r.includes(l.method))throw s;if(l.retryEnabled&&t<3){const r=e(t);t++,await n(r,l.signal);continue}throw s}if(i(l.method,c.status,t,l.retryEnabled)){var s,h;const r=null!==(s=null===(h=c.headers)||void 0===h?void 0:h.get("Retry-After"))&&void 0!==s?s:null,i=null!==r?1e3*Math.max(0,parseInt(r,10)||0):e(t);await c.text(),t++,await n(i,l.signal);continue}return await l.processResponse(c)}})();return this.shouldThrowOnError||(h=h.catch(e=>{var t;let r="",s="",n="";const i=null==e?void 0:e.cause;if(i){var l,o,h,u;const t=null!==(l=null==i?void 0:i.message)&&void 0!==l?l:"",s=null!==(o=null==i?void 0:i.code)&&void 0!==o?o:"";r=`${null!==(h=null==e?void 0:e.name)&&void 0!==h?h:"FetchError"}: ${null==e?void 0:e.message}`,r+=`\n\nCaused by: ${null!==(u=null==i?void 0:i.name)&&void 0!==u?u:"Error"}: ${t}`,s&&(r+=` (${s})`),(null==i?void 0:i.stack)&&(r+=`\n${i.stack}`)}else{var c;r=null!==(c=null==e?void 0:e.stack)&&void 0!==c?c:""}const p=this.url.toString().length;return"AbortError"===(null==e?void 0:e.name)||"ABORT_ERR"===(null==e?void 0:e.code)?(n="",s="Request was aborted (timeout or manual cancellation)",p>this.urlLengthLimit&&(s+=`. Note: Your request URL is ${p} characters, which may exceed server limits. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [many IDs])), consider using an RPC function to pass values server-side.`)):"HeadersOverflowError"!==(null==i?void 0:i.name)&&"UND_ERR_HEADERS_OVERFLOW"!==(null==i?void 0:i.code)||(n="",s="HTTP headers exceeded server limits (typically 16KB)",p>this.urlLengthLimit&&(s+=`. Your request URL is ${p} characters. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [200+ IDs])), consider using an RPC function instead.`)),{success:!1,error:{message:`${null!==(t=null==e?void 0:e.name)&&void 0!==t?t:"FetchError"}: ${null==e?void 0:e.message}`,details:r,hint:s,code:n},data:null,count:null,status:0,statusText:""}})),h.then(t,s)}async processResponse(e){var t=this;let r=null,n=null,i=null,l=e.status,o=e.statusText;if(e.ok){var h,u;if("HEAD"!==t.method){var c;const i=await e.text();if(""===i);else if("text/csv"===t.headers.get("Accept"))n=i;else if(t.headers.get("Accept")&&(null===(c=t.headers.get("Accept"))||void 0===c?void 0:c.includes("application/vnd.pgrst.plan+text")))n=i;else try{n=JSON.parse(i)}catch(e){if(r={message:i},n=null,t.shouldThrowOnError)throw new s({message:i,details:"",hint:"",code:""})}}const p=null===(h=t.headers.get("Prefer"))||void 0===h?void 0:h.match(/count=(exact|planned|estimated)/),f=null===(u=e.headers.get("content-range"))||void 0===u?void 0:u.split("/");p&&f&&f.length>1&&(i=parseInt(f[1])),t.isMaybeSingle&&Array.isArray(n)&&(n.length>1?(r={code:"PGRST116",details:`Results contain ${n.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},n=null,i=null,l=406,o="Not Acceptable"):n=1===n.length?n[0]:null)}else{const i=await e.text();try{r=JSON.parse(i),Array.isArray(r)&&404===e.status&&(n=[],r=null,l=200,o="OK")}catch(t){404===e.status&&""===i?(l=204,o="No Content"):r={message:i}}if(r&&t.shouldThrowOnError)throw new s(r)}return{success:null===r,error:r,data:n,count:i,status:l,statusText:o}}returns(){return this}overrideTypes(){return this}},o=class extends l{throwOnError(){return super.throwOnError()}select(e){let t=!1;const r=(null!=e?e:"*").split("").map(e=>/\s/.test(e)&&!t?"":("\""===e&&(t=!t),e)).join("");return this.url.searchParams.set("select",r),this.headers.append("Prefer","return=representation"),this}order(e,{ascending:t=!0,nullsFirst:r,foreignTable:s,referencedTable:n=s}={}){const i=n?`${n}.order`:"order",l=this.url.searchParams.get(i);return this.url.searchParams.set(i,`${l?`${l},`:""}${e}.${t?"asc":"desc"}${void 0===r?"":r?".nullsfirst":".nullslast"}`),this}limit(e,{foreignTable:t,referencedTable:r=t}={}){const s=void 0===r?"limit":`${r}.limit`;return this.url.searchParams.set(s,`${e}`),this}range(e,t,{foreignTable:r,referencedTable:s=r}={}){const n=void 0===s?"offset":`${s}.offset`,i=void 0===s?"limit":`${s}.limit`;return this.url.searchParams.set(n,`${e}`),this.url.searchParams.set(i,""+(t-e+1)),this}abortSignal(e){return this.signal=e,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:e=!1,verbose:t=!1,settings:r=!1,buffers:s=!1,wal:n=!1,format:i="text"}={}){var l;const o=[e?"analyze":null,t?"verbose":null,r?"settings":null,s?"buffers":null,n?"wal":null].filter(Boolean).join("|"),h=null!==(l=this.headers.get("Accept"))&&void 0!==l?l:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${i}; for="${h}"; options=${o};`),this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(e){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${e}`),this}};const h=new RegExp("[,()]");var u=class extends o{throwOnError(){return super.throwOnError()}eq(e,t){return this.url.searchParams.append(e,`eq.${t}`),this}neq(e,t){return this.url.searchParams.append(e,`neq.${t}`),this}gt(e,t){return this.url.searchParams.append(e,`gt.${t}`),this}gte(e,t){return this.url.searchParams.append(e,`gte.${t}`),this}lt(e,t){return this.url.searchParams.append(e,`lt.${t}`),this}lte(e,t){return this.url.searchParams.append(e,`lte.${t}`),this}like(e,t){return this.url.searchParams.append(e,`like.${t}`),this}likeAllOf(e,t){return this.url.searchParams.append(e,`like(all).{${t.join(",")}}`),this}likeAnyOf(e,t){return this.url.searchParams.append(e,`like(any).{${t.join(",")}}`),this}ilike(e,t){return this.url.searchParams.append(e,`ilike.${t}`),this}ilikeAllOf(e,t){return this.url.searchParams.append(e,`ilike(all).{${t.join(",")}}`),this}ilikeAnyOf(e,t){return this.url.searchParams.append(e,`ilike(any).{${t.join(",")}}`),this}regexMatch(e,t){return this.url.searchParams.append(e,`match.${t}`),this}regexIMatch(e,t){return this.url.searchParams.append(e,`imatch.${t}`),this}is(e,t){return this.url.searchParams.append(e,`is.${t}`),this}isDistinct(e,t){return this.url.searchParams.append(e,`isdistinct.${t}`),this}in(e,t){const r=Array.from(new Set(t)).map(e=>"string"==typeof e&&h.test(e)?`"${e}"`:`${e}`).join(",");return this.url.searchParams.append(e,`in.(${r})`),this}notIn(e,t){const r=Array.from(new Set(t)).map(e=>"string"==typeof e&&h.test(e)?`"${e}"`:`${e}`).join(",");return this.url.searchParams.append(e,`not.in.(${r})`),this}contains(e,t){return"string"==typeof t?this.url.searchParams.append(e,`cs.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cs.{${t.join(",")}}`):this.url.searchParams.append(e,`cs.${JSON.stringify(t)}`),this}containedBy(e,t){return"string"==typeof t?this.url.searchParams.append(e,`cd.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cd.{${t.join(",")}}`):this.url.searchParams.append(e,`cd.${JSON.stringify(t)}`),this}rangeGt(e,t){return this.url.searchParams.append(e,`sr.${t}`),this}rangeGte(e,t){return this.url.searchParams.append(e,`nxl.${t}`),this}rangeLt(e,t){return this.url.searchParams.append(e,`sl.${t}`),this}rangeLte(e,t){return this.url.searchParams.append(e,`nxr.${t}`),this}rangeAdjacent(e,t){return this.url.searchParams.append(e,`adj.${t}`),this}overlaps(e,t){return"string"==typeof t?this.url.searchParams.append(e,`ov.${t}`):this.url.searchParams.append(e,`ov.{${t.join(",")}}`),this}textSearch(e,t,{config:r,type:s}={}){let n="";"plain"===s?n="pl":"phrase"===s?n="ph":"websearch"===s&&(n="w");const i=void 0===r?"":`(${r})`;return this.url.searchParams.append(e,`${n}fts${i}.${t}`),this}match(e){return Object.entries(e).filter(([e,t])=>void 0!==t).forEach(([e,t])=>{this.url.searchParams.append(e,`eq.${t}`)}),this}not(e,t,r){return this.url.searchParams.append(e,`not.${t}.${r}`),this}or(e,{foreignTable:t,referencedTable:r=t}={}){const s=r?`${r}.or`:"or";return this.url.searchParams.append(s,`(${e})`),this}filter(e,t,r){return this.url.searchParams.append(e,`${t}.${r}`),this}},c=class{constructor(e,{headers:t={},schema:r,fetch:s,urlLengthLimit:n=8e3,retry:i}){this.url=e,this.headers=new Headers(t),this.schema=r,this.fetch=s,this.urlLengthLimit=n,this.retry=i}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(e,t){const{head:r=!1,count:s}=null!=t?t:{},n=r?"HEAD":"GET";let i=!1;const l=(null!=e?e:"*").split("").map(e=>/\s/.test(e)&&!i?"":("\""===e&&(i=!i),e)).join(""),{url:o,headers:h}=this.cloneRequestState();return o.searchParams.set("select",l),s&&h.append("Prefer",`count=${s}`),new u({method:n,url:o,headers:h,schema:this.schema,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}insert(e,{count:t,defaultToNull:r=!0}={}){var s;const{url:n,headers:i}=this.cloneRequestState();if(t&&i.append("Prefer",`count=${t}`),r||i.append("Prefer","missing=default"),Array.isArray(e)){const t=e.reduce((e,t)=>e.concat(Object.keys(t)),[]);if(t.length>0){const e=[...new Set(t)].map(e=>`"${e}"`);n.searchParams.set("columns",e.join(","))}}return new u({method:"POST",url:n,headers:i,schema:this.schema,body:e,fetch:null!==(s=this.fetch)&&void 0!==s?s:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}upsert(e,{onConflict:t,ignoreDuplicates:r=!1,count:s,defaultToNull:n=!0}={}){var i;const{url:l,headers:o}=this.cloneRequestState();if(o.append("Prefer",`resolution=${r?"ignore":"merge"}-duplicates`),void 0!==t&&l.searchParams.set("on_conflict",t),s&&o.append("Prefer",`count=${s}`),n||o.append("Prefer","missing=default"),Array.isArray(e)){const t=e.reduce((e,t)=>e.concat(Object.keys(t)),[]);if(t.length>0){const e=[...new Set(t)].map(e=>`"${e}"`);l.searchParams.set("columns",e.join(","))}}return new u({method:"POST",url:l,headers:o,schema:this.schema,body:e,fetch:null!==(i=this.fetch)&&void 0!==i?i:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}update(e,{count:t}={}){var r;const{url:s,headers:n}=this.cloneRequestState();return t&&n.append("Prefer",`count=${t}`),new u({method:"PATCH",url:s,headers:n,schema:this.schema,body:e,fetch:null!==(r=this.fetch)&&void 0!==r?r:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}delete({count:e}={}){var t;const{url:r,headers:s}=this.cloneRequestState();return e&&s.append("Prefer",`count=${e}`),new u({method:"DELETE",url:r,headers:s,schema:this.schema,fetch:null!==(t=this.fetch)&&void 0!==t?t:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};function p(e){return(p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function f(e,t){if("object"!=p(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var s=r.call(e,t||"default");if("object"!=p(s))return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function y(e){var t=f(e,"string");return"symbol"==p(t)?t:t+""}function v(e,t,r){return(t=y(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function b(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,s)}return r}function P(e){for(var t=1;t0?(e,t)=>{const r=new AbortController,s=setTimeout(()=>r.abort(),n),i=null==t?void 0:t.signal;if(i){if(i.aborted)return clearTimeout(s),o(e,t);const n=()=>{clearTimeout(s),r.abort()};return i.addEventListener("abort",n,{once:!0}),o(e,P(P({},t),{},{signal:r.signal})).finally(()=>{clearTimeout(s),i.removeEventListener("abort",n)})}return o(e,P(P({},t),{},{signal:r.signal})).finally(()=>clearTimeout(s))}:o,this.retry=l}from(e){if(!e||"string"!=typeof e||""===e.trim())throw new Error("Invalid relation name: relation must be a non-empty string.");return new c(new URL(`${this.url}/${e}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}schema(t){return new e(this.url,{headers:this.headers,schema:t,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}rpc(e,t={},{head:r=!1,get:s=!1,count:n}={}){var i;let l;const o=new URL(`${this.url}/rpc/${e}`);let h;const c=e=>null!==e&&"object"==typeof e&&(!Array.isArray(e)||e.some(c)),p=r&&Object.values(t).some(c);p?(l="POST",h=t):r||s?(l=r?"HEAD":"GET",Object.entries(t).filter(([e,t])=>void 0!==t).map(([e,t])=>[e,Array.isArray(t)?`{${t.join(",")}}`:`${t}`]).forEach(([e,t])=>{o.searchParams.append(e,t)})):(l="POST",h=t);const f=new Headers(this.headers);return p?f.set("Prefer",n?`count=${n},return=minimal`:"return=minimal"):n&&f.set("Prefer",`count=${n}`),new u({method:l,url:o,headers:f,schema:this.schemaName,body:h,fetch:null!==(i=this.fetch)&&void 0!==i?i:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}},w={PostgrestClient:$,PostgrestQueryBuilder:c,PostgrestFilterBuilder:u,PostgrestTransformBuilder:o,PostgrestBuilder:l,PostgrestError:s}},1159,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"RealtimePresence",{enumerable:!0,get:function(){return o.default}}),Object.defineProperty(_e,"RealtimeChannel",{enumerable:!0,get:function(){return E.default}}),Object.defineProperty(_e,"RealtimeClient",{enumerable:!0,get:function(){return t.default}}),Object.defineProperty(_e,"RealtimePostgresFilterBuilder",{enumerable:!0,get:function(){return n.RealtimePostgresFilterBuilder}}),Object.defineProperty(_e,"postgresChangesFilter",{enumerable:!0,get:function(){return n.postgresChangesFilter}}),Object.defineProperty(_e,"REALTIME_LISTEN_TYPES",{enumerable:!0,get:function(){return n.REALTIME_LISTEN_TYPES}}),Object.defineProperty(_e,"REALTIME_POSTGRES_CHANGES_LISTEN_EVENT",{enumerable:!0,get:function(){return n.REALTIME_POSTGRES_CHANGES_LISTEN_EVENT}}),Object.defineProperty(_e,"REALTIME_PRESENCE_LISTEN_EVENTS",{enumerable:!0,get:function(){return u.REALTIME_PRESENCE_LISTEN_EVENTS}}),Object.defineProperty(_e,"REALTIME_SUBSCRIBE_STATES",{enumerable:!0,get:function(){return n.REALTIME_SUBSCRIBE_STATES}}),Object.defineProperty(_e,"REALTIME_CHANNEL_STATES",{enumerable:!0,get:function(){return n.REALTIME_CHANNEL_STATES}}),Object.defineProperty(_e,"WebSocketFactory",{enumerable:!0,get:function(){return l.default}});var t=e(r(d[0])),n=r(d[1]),E=e(n),u=r(d[2]),o=e(u),l=e(r(d[3]))},1160,[1161,1167,1168,1162]); +__d(function(g,r,i,a,m,_e2,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"default",{enumerable:!0,get:function(){return f}});var t=e(r(d[0])),n=r(d[1]),s=e(r(d[2])),o=r(d[3]),c=e(r(d[4])),l=e(r(d[5]));const h=25e3,u=[1e3,2e3,5e3,1e4];function k(){const e=new Map;return{get length(){return e.size},clear(){e.clear()},getItem:t=>e.has(t)?e.get(t):null,key(t){var n;return null!==(n=Array.from(e.keys())[t])&&void 0!==n?n:null},removeItem(t){e.delete(t)},setItem(t,n){e.set(t,String(n))}}}function p(){try{if('undefined'!=typeof globalThis&&globalThis.sessionStorage)return globalThis.sessionStorage}catch(e){}return k()}class f{get endPoint(){return this.socketAdapter.endPoint}get timeout(){return this.socketAdapter.timeout}get transport(){return this.socketAdapter.transport}get heartbeatCallback(){return this.socketAdapter.heartbeatCallback}get heartbeatIntervalMs(){return this.socketAdapter.heartbeatIntervalMs}get heartbeatTimer(){return this.worker?this._workerHeartbeatTimer:this.socketAdapter.heartbeatTimer}get pendingHeartbeatRef(){return this.worker?this._pendingWorkerHeartbeatRef:this.socketAdapter.pendingHeartbeatRef}get reconnectTimer(){return this.socketAdapter.reconnectTimer}get vsn(){return this.socketAdapter.vsn}get encode(){return this.socketAdapter.encode}get decode(){return this.socketAdapter.decode}get reconnectAfterMs(){return this.socketAdapter.reconnectAfterMs}get sendBuffer(){return this.socketAdapter.sendBuffer}get stateChangeCallbacks(){return this.socketAdapter.stateChangeCallbacks}constructor(e,t){var n;if(this.channels=new Array,this.accessTokenValue=null,this.accessToken=null,this.apiKey=null,this.httpEndpoint='',this.headers={},this.params={},this.ref=0,this.serializer=new s.default,this._manuallySetToken=!1,this._authPromise=null,this._workerHeartbeatTimer=void 0,this._pendingWorkerHeartbeatRef=null,this._pendingDisconnectTimer=null,this._disconnectOnEmptyChannelsAfterMs=0,this._resolveFetch=e=>e?(...t)=>e(...t):(...e)=>fetch(...e),!(null===(n=null==t?void 0:t.params)||void 0===n?void 0:n.apikey))throw new Error('API key is required to connect to Realtime');this.apiKey=t.params.apikey;const c=this._initializeOptions(t);this.socketAdapter=new l.default(e,c),this.httpEndpoint=(0,o.httpEndpointURL)(e),this.fetch=this._resolveFetch(null==t?void 0:t.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.isConnected())){this.accessToken&&!this._authPromise&&this._setAuthSafely('connect'),this._setupConnectionHandlers();try{this.socketAdapter.connect()}catch(e){const t=e.message;if(t.includes('Node.js'))throw new Error(`${t}\n\nTo use Realtime in Node.js, you need to provide a WebSocket implementation:\n\nOption 1: Use Node.js 22+ which has native WebSocket support\nOption 2: Install and provide the "ws" package:\n\n npm install ws\n\n import ws from "ws"\n const client = new RealtimeClient(url, {\n ...options,\n transport: ws\n })`);throw new Error(`WebSocket not available: ${t}`)}this._handleNodeJsRaceCondition()}}endpointURL(){return this.socketAdapter.endPointURL()}async disconnect(e,t){return this._cancelPendingDisconnect(),this.isDisconnecting()?'ok':await this.socketAdapter.disconnect(()=>{clearInterval(this._workerHeartbeatTimer),this._terminateWorker()},e,t)}getChannels(){return this.channels}async removeChannel(e){const t=await e.unsubscribe();return'ok'===t&&e.teardown(),t}async removeAllChannels(){const e=this.channels.map(async e=>{const t=await e.unsubscribe();return e.teardown(),t}),t=await Promise.all(e);return await this.disconnect(),t}log(e,t,n){this.socketAdapter.log(e,t,n)}connectionState(){return this.socketAdapter.connectionState()||n.CONNECTION_STATE.closed}isConnected(){return this.socketAdapter.isConnected()}isConnecting(){return this.socketAdapter.isConnecting()}isDisconnecting(){return this.socketAdapter.isDisconnecting()}channel(e,t={config:{}}){const n=`realtime:${e}`,s=this.getChannels().find(e=>e.topic===n);if(s)return s;{const n=new c.default(`realtime:${e}`,t,this);return this._cancelPendingDisconnect(),this.channels.push(n),n}}push(e){this.socketAdapter.push(e)}async setAuth(e=null){this._authPromise=this._performAuth(e);try{await this._authPromise}finally{this._authPromise=null}}_isManualToken(){return this._manuallySetToken}async sendHeartbeat(){this.socketAdapter.sendHeartbeat()}onHeartbeat(e){this.socketAdapter.heartbeatCallback=this._wrapHeartbeatCallback(e)}_makeRef(){return this.socketAdapter.makeRef()}_remove(e){this.channels=this.channels.filter(t=>t.topic!==e.topic),0===this.channels.length&&(this.log('transport','no channels remaining, scheduling disconnect'),this._schedulePendingDisconnect())}_schedulePendingDisconnect(){if(this._cancelPendingDisconnect(),0===this._disconnectOnEmptyChannelsAfterMs)return this.log('transport','disconnecting immediately - no channels'),void this.disconnect();this._pendingDisconnectTimer=setTimeout(()=>{this._pendingDisconnectTimer=null,0===this.channels.length&&(this.log('transport','deferred disconnect fired - no channels, disconnecting'),this.disconnect())},this._disconnectOnEmptyChannelsAfterMs),this.log('transport',`deferred disconnect scheduled in ${this._disconnectOnEmptyChannelsAfterMs}ms`)}_cancelPendingDisconnect(){null!==this._pendingDisconnectTimer&&(this.log('transport','pending disconnect cancelled - channel activity detected'),clearTimeout(this._pendingDisconnectTimer),this._pendingDisconnectTimer=null)}async _performAuth(e=null){let t,s=!1;if(e)t=e,s=!0;else if(this.accessToken)try{t=await this.accessToken()}catch(e){this.log('error','Error fetching access token from callback',e),t=this.accessTokenValue}else t=this.accessTokenValue;s?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=t&&(this.accessTokenValue=t,this.channels.forEach(e=>{const s={access_token:t,version:n.DEFAULT_VERSION};t&&e.updateJoinPayload(s),e.joinedOnce&&e.channelAdapter.isJoined()&&e.channelAdapter.push(n.CHANNEL_EVENTS.access_token,{access_token:t})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(e="general"){this._isManualToken()||this.setAuth().catch(t=>{this.log('error',`Error setting auth in ${e}`,t)})}_setupConnectionHandlers(){this.socketAdapter.onOpen(()=>{(this._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).catch(e=>{this.log('error','error waiting for auth on connect',e)}),this.worker&&!this.workerRef&&this._startWorkerHeartbeat()}),this.socketAdapter.onClose(()=>{this.worker&&this.workerRef&&this._terminateWorker()}),this.socketAdapter.onMessage(e=>{e.ref&&e.ref===this._pendingWorkerHeartbeatRef&&(this._pendingWorkerHeartbeatRef=null)})}_handleNodeJsRaceCondition(){this.socketAdapter.isConnected()&&this.socketAdapter.getSocket().onConnOpen()}_wrapHeartbeatCallback(e){return(t,n)=>{'sent'==t&&this._setAuthSafely(),e&&e(t,n)}}_startWorkerHeartbeat(){this.workerUrl?this.log('worker',`starting worker for from ${this.workerUrl}`):this.log('worker',"starting default worker");const e=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(e),this.workerRef.onerror=e=>{this.log('worker','worker error',e.message),this._terminateWorker(),this.disconnect()},this.workerRef.onmessage=e=>{'keepAlive'===e.data.event&&this.sendHeartbeat()},this.workerRef.postMessage({event:'start',interval:this.heartbeatIntervalMs})}_terminateWorker(){this.workerRef&&(this.log('worker','terminating worker'),this.workerRef.terminate(),this.workerRef=void 0)}_workerObjectUrl(e){let t;if(e)t=e;else{const e=new Blob(["\n addEventListener(\"message\", (e) => {\n if (e.data.event === \"start\") {\n setInterval(() => postMessage({ event: \"keepAlive\" }), e.data.interval);\n }\n });"],{type:'application/javascript'});t=URL.createObjectURL(e)}return t}_initializeOptions(e){var s,o,c,l,k,f,_,v,w,b,A,T;this.worker=null!==(s=null==e?void 0:e.worker)&&void 0!==s&&s,this.accessToken=null!==(o=null==e?void 0:e.accessToken)&&void 0!==o?o:null;const y={};let C,R;y.timeout=null!==(c=null==e?void 0:e.timeout)&&void 0!==c?c:n.DEFAULT_TIMEOUT,y.heartbeatIntervalMs=null!==(l=null==e?void 0:e.heartbeatIntervalMs)&&void 0!==l?l:h,this._disconnectOnEmptyChannelsAfterMs=null!==(k=null==e?void 0:e.disconnectOnEmptyChannelsAfterMs)&&void 0!==k?k:2*(null!==(f=null==e?void 0:e.heartbeatIntervalMs)&&void 0!==f?f:h),y.transport=null!==(_=null==e?void 0:e.transport)&&void 0!==_?_:t.default.getWebSocketConstructor(),y.params=null==e?void 0:e.params,y.logger=null==e?void 0:e.logger,y.heartbeatCallback=this._wrapHeartbeatCallback(null==e?void 0:e.heartbeatCallback),y.sessionStorage=null!==(v=null==e?void 0:e.sessionStorage)&&void 0!==v?v:p(),y.reconnectAfterMs=null!==(w=null==e?void 0:e.reconnectAfterMs)&&void 0!==w?w:e=>u[e-1]||1e4;const E=null!==(b=null==e?void 0:e.vsn)&&void 0!==b?b:n.DEFAULT_VSN;switch(E){case n.VSN_1_0_0:C=(e,t)=>t(JSON.stringify(e)),R=(e,t)=>t(JSON.parse(e));break;case n.VSN_2_0_0:C=this.serializer.encode.bind(this.serializer),R=this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${y.vsn}`)}if(y.vsn=E,y.encode=null!==(A=null==e?void 0:e.encode)&&void 0!==A?A:C,y.decode=null!==(T=null==e?void 0:e.decode)&&void 0!==T?T:R,y.beforeReconnect=this._reconnectAuth.bind(this),((null==e?void 0:e.logLevel)||(null==e?void 0:e.log_level))&&(this.logLevel=e.logLevel||e.log_level,y.params=Object.assign(Object.assign({},y.params),{log_level:this.logLevel})),this.worker){if('undefined'!=typeof window&&!window.Worker)throw new Error('Web Worker is not supported');this.workerUrl=null==e?void 0:e.workerUrl,y.autoSendHeartbeat=!this.worker}return y}async _reconnectAuth(){await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()}}},1161,[1162,1163,1165,1166,1167,1174]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"WebSocketFactory",{enumerable:!0,get:function(){return t}});class t{constructor(){}static detectEnvironment(){var t;if('undefined'!=typeof WebSocket)return{type:'native',wsConstructor:WebSocket};const o=globalThis;if('undefined'!=typeof globalThis&&void 0!==o.WebSocket)return{type:'native',wsConstructor:o.WebSocket};const n=void 0!==g?g:void 0;if(n&&void 0!==n.WebSocket)return{type:'native',wsConstructor:n.WebSocket};if('undefined'!=typeof globalThis&&void 0!==o.WebSocketPair&&void 0===globalThis.WebSocket)return{type:'cloudflare',error:'Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.',workaround:'Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime.'};if('undefined'!=typeof globalThis&&o.EdgeRuntime||'undefined'!=typeof navigator&&(null===(t=navigator.userAgent)||void 0===t?void 0:t.includes('Vercel-Edge')))return{type:'unsupported',error:'Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.',workaround:'Use serverless functions or a different deployment target for WebSocket functionality.'};const s=globalThis.process;if(s){const t=s.versions;if(t&&t.node){const o=t.node,n=parseInt(o.replace(/^v/,'').split('.')[0]);return n>=22?void 0!==globalThis.WebSocket?{type:'native',wsConstructor:globalThis.WebSocket}:{type:'unsupported',error:`Node.js ${n} detected but native WebSocket not found.`,workaround:'Provide a WebSocket implementation via the transport option.'}:{type:'unsupported',error:`Node.js ${n} detected without native WebSocket support.`,workaround:"For Node.js < 22, install \"ws\" package and provide it via the transport option:\nimport ws from \"ws\"\nnew RealtimeClient(url, { transport: ws })"}}}return{type:'unsupported',error:'Unknown JavaScript runtime without WebSocket support.',workaround:"Ensure you're running in a supported environment (browser, Node.js, Deno) or provide a custom WebSocket implementation."}}static getWebSocketConstructor(){const t=this.detectEnvironment();if(t.wsConstructor)return t.wsConstructor;let o=t.error||'WebSocket not supported in this environment.';throw t.workaround&&(o+=`\n\nSuggested solution: ${t.workaround}`),new Error(o)}static isWebSocketSupported(){try{const t=this.detectEnvironment();return'native'===t.type||'ws'===t.type}catch(t){return!1}}}var o=t},1162,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DEFAULT_VERSION",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"VSN_1_0_0",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"VSN_2_0_0",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"DEFAULT_VSN",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"VERSION",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"DEFAULT_TIMEOUT",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"WS_CLOSE_NORMAL",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"MAX_PUSH_BUFFER_SIZE",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"SOCKET_STATES",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"CHANNEL_STATES",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"CHANNEL_EVENTS",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"TRANSPORTS",{enumerable:!0,get:function(){return j}}),Object.defineProperty(e,"CONNECTION_STATE",{enumerable:!0,get:function(){return E}});var n=r(d[0]);const t=`realtime-js/${n.version}`,o='1.0.0',c='2.0.0',u=c,l=n.version,b=1e4,_=1e3,f=100,p={connecting:0,open:1,closing:2,closed:3},s={closed:'closed',errored:'errored',joined:'joined',joining:'joining',leaving:'leaving'},O={close:'phx_close',error:'phx_error',join:'phx_join',reply:'phx_reply',leave:'phx_leave',access_token:'access_token'},j={websocket:'websocket'},E={connecting:'connecting',open:'open',closing:'closing',closed:'closed'}},1163,[1164]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"version",{enumerable:!0,get:function(){return t}});const t='2.109.0'},1164,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}});class t{constructor(t){this.HEADER_LENGTH=1,this.USER_BROADCAST_PUSH_META_LENGTH=6,this.KINDS={userBroadcastPush:3,userBroadcast:4},this.BINARY_ENCODING=0,this.JSON_ENCODING=1,this.BROADCAST_EVENT='broadcast',this.allowedMetadataKeys=[],this.allowedMetadataKeys=null!=t?t:[]}encode(t,n){if(t.event===this.BROADCAST_EVENT&&!(t.payload instanceof ArrayBuffer)&&'string'==typeof t.payload.event)return n(this._binaryEncodeUserBroadcastPush(t));let s=[t.join_ref,t.ref,t.topic,t.event,t.payload];return n(JSON.stringify(s))}_binaryEncodeUserBroadcastPush(t){var n;return this._isArrayBuffer(null===(n=t.payload)||void 0===n?void 0:n.payload)?this._encodeBinaryUserBroadcastPush(t):this._encodeJsonUserBroadcastPush(t)}_encodeBinaryUserBroadcastPush(t){var n,s;const o=null!==(s=null===(n=t.payload)||void 0===n?void 0:n.payload)&&void 0!==s?s:new ArrayBuffer(0);return this._encodeUserBroadcastPush(t,this.BINARY_ENCODING,o)}_encodeJsonUserBroadcastPush(t){var n,s;const o=null!==(s=null===(n=t.payload)||void 0===n?void 0:n.payload)&&void 0!==s?s:{},c=(new TextEncoder).encode(JSON.stringify(o)).buffer;return this._encodeUserBroadcastPush(t,this.JSON_ENCODING,c)}_encodeUserBroadcastPush(t,n,s){var o,c;const l=t.topic,h=null!==(o=t.ref)&&void 0!==o?o:'',u=null!==(c=t.join_ref)&&void 0!==c?c:'',f=t.payload.event,y=this.allowedMetadataKeys?this._pick(t.payload,this.allowedMetadataKeys):{},_=0===Object.keys(y).length?'':JSON.stringify(y);if(u.length>255)throw new Error(`joinRef length ${u.length} exceeds maximum of 255`);if(h.length>255)throw new Error(`ref length ${h.length} exceeds maximum of 255`);if(l.length>255)throw new Error(`topic length ${l.length} exceeds maximum of 255`);if(f.length>255)throw new Error(`userEvent length ${f.length} exceeds maximum of 255`);if(_.length>255)throw new Error(`metadata length ${_.length} exceeds maximum of 255`);const A=this.USER_BROADCAST_PUSH_META_LENGTH+u.length+h.length+l.length+f.length+_.length,E=new ArrayBuffer(this.HEADER_LENGTH+A);let U=new DataView(E),B=0;U.setUint8(B++,this.KINDS.userBroadcastPush),U.setUint8(B++,u.length),U.setUint8(B++,h.length),U.setUint8(B++,l.length),U.setUint8(B++,f.length),U.setUint8(B++,_.length),U.setUint8(B++,n),Array.from(u,t=>U.setUint8(B++,t.charCodeAt(0))),Array.from(h,t=>U.setUint8(B++,t.charCodeAt(0))),Array.from(l,t=>U.setUint8(B++,t.charCodeAt(0))),Array.from(f,t=>U.setUint8(B++,t.charCodeAt(0))),Array.from(_,t=>U.setUint8(B++,t.charCodeAt(0)));var N=new Uint8Array(E.byteLength+s.byteLength);return N.set(new Uint8Array(E),0),N.set(new Uint8Array(s),E.byteLength),N.buffer}decode(t,n){if(this._isArrayBuffer(t)){return n(this._binaryDecode(t))}if('string'==typeof t){const s=JSON.parse(t),[o,c,l,h,u]=s;return n({join_ref:o,ref:c,topic:l,event:h,payload:u})}return n({})}_binaryDecode(t){const n=new DataView(t),s=n.getUint8(0),o=new TextDecoder;if(s===this.KINDS.userBroadcast)return this._decodeUserBroadcast(t,n,o)}_decodeUserBroadcast(t,n,s){const o=n.getUint8(1),c=n.getUint8(2),l=n.getUint8(3),h=n.getUint8(4);let u=this.HEADER_LENGTH+4;const f=s.decode(t.slice(u,u+o));u+=o;const y=s.decode(t.slice(u,u+c));u+=c;const _=s.decode(t.slice(u,u+l));u+=l;const A=t.slice(u,t.byteLength),E=h===this.JSON_ENCODING?JSON.parse(s.decode(A)):A,U={type:this.BROADCAST_EVENT,event:y,payload:E};return l>0&&(U.meta=JSON.parse(_)),{join_ref:null,ref:null,topic:f,event:this.BROADCAST_EVENT,payload:U}}_isArrayBuffer(t){var n;return t instanceof ArrayBuffer||'ArrayBuffer'===(null===(n=null==t?void 0:t.constructor)||void 0===n?void 0:n.name)}_pick(t,n){return t&&'object'==typeof t?Object.fromEntries(Object.entries(t).filter(([t])=>n.includes(t))):{}}}},1165,[]); +__d(function(g,r,i,a,m,e,d){"use strict";var t;Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"PostgresTypes",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"convertChangeData",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"convertColumn",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"convertCell",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"toBoolean",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"toNumber",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"toJson",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"toArray",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"toTimestampString",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"httpEndpointURL",{enumerable:!0,get:function(){return y}}),(function(t){t.abstime="abstime",t.bool="bool",t.date="date",t.daterange="daterange",t.float4="float4",t.float8="float8",t.int2="int2",t.int4="int4",t.int4range="int4range",t.int8="int8",t.int8range="int8range",t.json="json",t.jsonb="jsonb",t.money="money",t.numeric="numeric",t.oid="oid",t.reltime="reltime",t.text="text",t.time="time",t.timestamp="timestamp",t.timestamptz="timestamptz",t.timetz="timetz",t.tsrange="tsrange",t.tstzrange="tstzrange"})(t||(t={}));const n=(t,n,o={})=>{var s;const u=null!==(s=o.skipTypes)&&void 0!==s?s:[];return n?Object.keys(n).reduce((o,s)=>(o[s]=c(s,t,n,u),o),{}):{}},c=(t,n,c,u)=>{const p=n.find(n=>n.name===t),l=null==p?void 0:p.type,f=c[t];return l&&!u.includes(l)?o(l,f):s(f)},o=(n,c)=>{if('_'===n.charAt(0)){const t=n.slice(1,n.length);return f(c,t)}switch(n){case t.bool:return u(c);case t.float4:case t.float8:case t.int2:case t.int4:case t.int8:case t.numeric:case t.oid:return p(c);case t.json:case t.jsonb:return l(c);case t.timestamp:return b(c);case t.abstime:case t.date:case t.daterange:case t.int4range:case t.int8range:case t.money:case t.reltime:case t.text:case t.time:case t.timestamptz:case t.timetz:case t.tsrange:case t.tstzrange:default:return s(c)}},s=t=>t,u=t=>{switch(t){case't':return!0;case'f':return!1;default:return t}},p=t=>{if('string'==typeof t){const n=parseFloat(t);if(!Number.isNaN(n))return n}return t},l=t=>{if('string'==typeof t)try{return JSON.parse(t)}catch(n){return t}return t},f=(t,n)=>{if('string'!=typeof t)return t;const c=t.length-1,s=t[c];if('{'===t[0]&&'}'===s){let s;const u=t.slice(1,c);try{s=JSON.parse('['+u+']')}catch(t){s=u?u.split(','):[]}return s.map(t=>o(n,t))}return t},b=t=>'string'==typeof t?t.replace(' ','T'):t,y=t=>{const n=new URL(t);return n.protocol=n.protocol.replace(/^ws/i,'http'),n.pathname=n.pathname.replace(/\/+$/,'').replace(/\/socket\/websocket$/i,'').replace(/\/socket$/i,'').replace(/\/websocket$/i,''),''===n.pathname||'/'===n.pathname?n.pathname='/api/broadcast':n.pathname=n.pathname+'/api/broadcast',n.href}},1166,[]); +__d(function(g,_r,_i,a,m,_e2,_d2){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"RealtimePostgresFilterBuilder",{enumerable:!0,get:function(){return d.RealtimePostgresFilterBuilder}}),Object.defineProperty(_e2,"postgresChangesFilter",{enumerable:!0,get:function(){return d.postgresChangesFilter}}),Object.defineProperty(_e2,"default",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e2,"REALTIME_POSTGRES_CHANGES_LISTEN_EVENT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e2,"REALTIME_LISTEN_TYPES",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e2,"REALTIME_SUBSCRIBE_STATES",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e2,"REALTIME_CHANNEL_STATES",{enumerable:!0,get:function(){return h}});var t,n,i,s=_r(_d2[0]),r=e(_r(_d2[1])),o=_r(_d2[2]),c=(function(e){if(e&&e.__esModule)return e;var t={};return e&&Object.keys(e).forEach(function(n){if('default'!==n){var i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,t})(o),l=_r(_d2[3]),u=e(_r(_d2[4])),d=_r(_d2[5]);!(function(e){e.ALL="*",e.INSERT="INSERT",e.UPDATE="UPDATE",e.DELETE="DELETE"})(t||(t={})),(function(e){e.BROADCAST="broadcast",e.PRESENCE="presence",e.POSTGRES_CHANGES="postgres_changes",e.SYSTEM="system"})(n||(n={})),(function(e){e.SUBSCRIBED="SUBSCRIBED",e.TIMED_OUT="TIMED_OUT",e.CLOSED="CLOSED",e.CHANNEL_ERROR="CHANNEL_ERROR"})(i||(i={}));const h=s.CHANNEL_STATES;class p{get state(){return this.channelAdapter.state}set state(e){this.channelAdapter.state=e}get joinedOnce(){return this.channelAdapter.joinedOnce}get timeout(){return this.socket.timeout}get joinPush(){return this.channelAdapter.joinPush}get rejoinTimer(){return this.channelAdapter.rejoinTimer}constructor(e,t={config:{}},n){var i,s;if(this.topic=e,this.params=t,this.socket=n,this.bindings={},this.subTopic=e.replace(/^realtime:/i,''),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:'',enabled:!1},private:!1},t.config),this.channelAdapter=new u.default(this.socket.socketAdapter,e,this.params),this.presence=new r.default(this),this._onClose(()=>{this.socket._remove(this)}),this._updateFilterTransform(),this.broadcastEndpointURL=(0,o.httpEndpointURL)(this.socket.socketAdapter.endPointURL()),this.private=this.params.config.private||!1,!this.private&&(null===(s=null===(i=this.params.config)||void 0===i?void 0:i.broadcast)||void 0===s?void 0:s.replay))throw new Error(`tried to use replay on public channel '${this.topic}'. It must be a private channel.`)}subscribe(e,t=this.timeout){var r,o,c;if(this.socket.isConnected()||this.socket.connect(),this.channelAdapter.isClosed()){const{config:{broadcast:u,presence:d,private:h}}=this.params,p=null!==(o=null===(r=this.bindings.postgres_changes)||void 0===r?void 0:r.map(e=>e.filter))&&void 0!==o?o:[],E=!!this.bindings[n.PRESENCE]&&this.bindings[n.PRESENCE].length>0||!0===(null===(c=this.params.config.presence)||void 0===c?void 0:c.enabled),b={},f={broadcast:u,presence:Object.assign(Object.assign({},d),{enabled:E}),postgres_changes:p,private:h};this.socket.accessTokenValue&&(b.access_token=this.socket.accessTokenValue),this._onError(t=>{null==e||e(i.CHANNEL_ERROR,(0,l.normalizeChannelError)(t))}),this._onClose(()=>null==e?void 0:e(i.CLOSED)),this.updateJoinPayload(Object.assign({config:f},b)),this._updateFilterMessage(),this.channelAdapter.subscribe(t).receive('ok',async({postgres_changes:t})=>{this.socket._isManualToken()||this.socket.setAuth(),void 0!==t?this._updatePostgresBindings(t,e):null==e||e(i.SUBSCRIBED)}).receive('error',t=>{this.state=s.CHANNEL_STATES.errored;const n=Object.values(t).join(', ')||'error';null==e||e(i.CHANNEL_ERROR,new Error(n,{cause:t}))}).receive('timeout',()=>{null==e||e(i.TIMED_OUT)})}return this}_updatePostgresBindings(e,t){var n;const r=this.bindings.postgres_changes,o=null!==(n=null==r?void 0:r.length)&&void 0!==n?n:0,c=[];for(let n=0;n{var i,s,r;const o=this.channelAdapter.push(e.type,e,t.timeout||this.timeout);'broadcast'!==e.type||(null===(r=null===(s=null===(i=this.params)||void 0===i?void 0:i.config)||void 0===s?void 0:s.broadcast)||void 0===r?void 0:r.ack)||n('ok'),o.receive('ok',()=>n('ok')),o.receive('error',()=>n('error')),o.receive('timeout',()=>n('timed out'))});{console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated in the future. Please use httpSend() explicitly for REST delivery.");const{event:s,payload:r}=e,o={apikey:this.socket.apiKey?this.socket.apiKey:'','Content-Type':'application/json'};this.socket.accessTokenValue&&(o.Authorization=`Bearer ${this.socket.accessTokenValue}`);const c={method:'POST',headers:o,body:JSON.stringify({messages:[{topic:this.subTopic,event:s,payload:r,private:this.private}]})};try{const e=await this._fetchWithTimeout(this.broadcastEndpointURL,c,null!==(n=t.timeout)&&void 0!==n?n:this.timeout);return await(null===(i=e.body)||void 0===i?void 0:i.cancel()),e.ok?'ok':'error'}catch(e){return e instanceof Error&&'AbortError'===e.name?'timed out':'error'}}}updateJoinPayload(e){this.channelAdapter.updateJoinPayload(e)}async unsubscribe(e=this.timeout){return new Promise(t=>{this.channelAdapter.unsubscribe(e).receive('ok',()=>t('ok')).receive('timeout',()=>t('timed out')).receive('error',()=>t('error'))})}teardown(){this.channelAdapter.teardown()}async _fetchWithTimeout(e,t,n){const i=new AbortController,s=setTimeout(()=>i.abort(),n),r=await this.socket.fetch(e,Object.assign(Object.assign({},t),{signal:i.signal}));return clearTimeout(s),r}_on(e,t,n){const i=e.toLocaleLowerCase(),s=null==t?void 0:t.filter;(s instanceof d.RealtimePostgresFilterBuilder||'object'==typeof s&&null!==s&&'function'==typeof s.build)&&(t=Object.assign(Object.assign({},t),{filter:s.build()}));const r={type:i,filter:t,callback:n,ref:this.channelAdapter.on(e,n)};return this.bindings[i]?this.bindings[i].push(r):this.bindings[i]=[r],this._updateFilterMessage(),this}_onClose(e){this.channelAdapter.onClose(e)}_onError(e){this.channelAdapter.onError(e)}_updateFilterMessage(){this.channelAdapter.updateFilterBindings((e,t,n)=>{var i,s,r,o,c,l,u;const d=e.event.toLocaleLowerCase();if(this._notThisChannelEvent(d,n))return!1;const h=null===(i=this.bindings[d])||void 0===i?void 0:i.find(t=>t.ref===e.ref);if(!h)return!0;if(['broadcast','presence','postgres_changes'].includes(d)){if('id'in h){const e=h.id,n=null===(s=h.filter)||void 0===s?void 0:s.event;return e&&(null===(r=t.ids)||void 0===r?void 0:r.includes(e))&&('*'===n||(null==n?void 0:n.toLocaleLowerCase())===(null===(o=t.data)||void 0===o?void 0:o.type.toLocaleLowerCase()))}{const e=null===(l=null===(c=null==h?void 0:h.filter)||void 0===c?void 0:c.event)||void 0===l?void 0:l.toLocaleLowerCase();return'*'===e||e===(null===(u=null==t?void 0:t.event)||void 0===u?void 0:u.toLocaleLowerCase())}}return h.type.toLocaleLowerCase()===d})}_notThisChannelEvent(e,t){const{close:n,error:i,leave:r,join:o}=s.CHANNEL_EVENTS;return t&&[n,i,r,o].includes(e)&&t!==this.joinPush.ref}_updateFilterTransform(){this.channelAdapter.updatePayloadTransform((e,t,n)=>{if('object'==typeof t&&'ids'in t){const e=t.data,{schema:n,table:i,commit_timestamp:s,type:r,errors:o}=e,c={schema:n,table:i,commit_timestamp:s,eventType:r,new:{},old:{},errors:o};return Object.assign(Object.assign({},c),this._getPayloadRecords(e))}return t})}copyBindings(e){if(this.joinedOnce)throw new Error('cannot copy bindings into joined channel');for(const t in e.bindings)for(const n of e.bindings[t])this._on(n.type,n.filter,n.callback)}static isFilterValueEqual(e,t){return(null!=e?e:void 0)===(null!=t?t:void 0)}_getPayloadRecords(e){const t={new:{},old:{}};return'INSERT'!==e.type&&'UPDATE'!==e.type||(t.new=c.convertChangeData(e.columns,e.record)),'UPDATE'!==e.type&&'DELETE'!==e.type||(t.old=c.convertChangeData(e.columns,e.old_record)),t}}},1167,[1163,1168,1166,1171,1172,1173]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"REALTIME_PRESENCE_LISTEN_EVENTS",{enumerable:!0,get:function(){return t}});var e,t,n=r(d[0]),c=(e=n)&&e.__esModule?e:{default:e};!(function(e){e.SYNC="sync",e.JOIN="join",e.LEAVE="leave"})(t||(t={}));class u{get state(){return this.presenceAdapter.state}constructor(e,t){this.channel=e,this.presenceAdapter=new c.default(this.channel.channelAdapter,t)}}},1168,[1169]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}});var n=r(d[0]);class t{constructor(s,c){const u=o(c);this.presence=new n.Presence(s.getChannel(),u),this.presence.onJoin((n,c,o)=>{const u=t.onJoinPayload(n,c,o);s.getChannel().trigger('presence',u)}),this.presence.onLeave((n,c,o)=>{const u=t.onLeavePayload(n,c,o);s.getChannel().trigger('presence',u)}),this.presence.onSync(()=>{s.getChannel().trigger('presence',{event:'sync'})})}get state(){return t.transformState(this.presence.state)}static transformState(n){return n=c(n),Object.getOwnPropertyNames(n).reduce((t,c)=>{const o=n[c];return t[c]=s(o),t},{})}static onJoinPayload(n,t,c){return{event:'join',key:n,currentPresences:u(t),newPresences:s(c)}}static onLeavePayload(n,t,c){return{event:'leave',key:n,currentPresences:u(t),leftPresences:s(c)}}}function s(n){return n.metas.map(n=>(n.presence_ref=n.phx_ref,delete n.phx_ref,delete n.phx_ref_prev,n))}function c(n){return JSON.parse(JSON.stringify(n))}function o(n){return(null==n?void 0:n.events)&&{events:n.events}}function u(n){return(null==n?void 0:n.metas)?s(n):[]}},1169,[1170]); +__d(function(g,r,_i,a,_m,_e2,d){"use strict";Object.defineProperty(_e2,'__esModule',{value:!0}),Object.defineProperty(_e2,"Channel",{enumerable:!0,get:function(){return A}}),Object.defineProperty(_e2,"LongPoll",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e2,"Presence",{enumerable:!0,get:function(){return B}}),Object.defineProperty(_e2,"Push",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e2,"Serializer",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e2,"Socket",{enumerable:!0,get:function(){return $}}),Object.defineProperty(_e2,"Timer",{enumerable:!0,get:function(){return w}});var e=e=>{if("function"==typeof e)return e;return function(){return e}},t="undefined"!=typeof self?self:null,s="undefined"!=typeof window?window:null,i=t||s||globalThis,n=0,o=1,h=2,c=3,l="closed",u="errored",f="joined",p="joining",m="leaving",b="phx_close",k="phx_error",T="phx_join",y="phx_reply",C="phx_leave",v="longpoll",R="websocket",j=4,E="base64url.bearer.phx.",S=class{constructor(e,t,s,i){this.channel=e,this.event=t,this.payload=s||function(){return{}},this.receivedResp=null,this.timeout=i,this.timeoutTimer=null,this.recHooks=[],this.sent=!1,this.ref=void 0}resend(e){this.timeout=e,this.reset(),this.send()}send(){this.hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload(),ref:this.ref,join_ref:this.channel.joinRef()}))}receive(e,t){return this.hasReceived(e)&&t(this.receivedResp.response),this.recHooks.push({status:e,callback:t}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}destroy(){this.cancelRefEvent(),this.cancelTimeout()}matchReceive({status:e,response:t,_ref:s}){this.recHooks.filter(t=>t.status===e).forEach(e=>e.callback(t))}cancelRefEvent(){this.refEvent&&this.channel.off(this.refEvent)}cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null}startTimeout(){this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,e=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=e,this.matchReceive(e)}),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}trigger(e,t){this.channel.trigger(this.refEvent,{status:e,response:t})}},w=class{constructor(e,t){this.callback=e,this.timerCalc=t,this.timer=void 0,this.tries=0}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}},A=class{constructor(t,s,i){this.state=l,this.topic=t,this.params=e(s||{}),this.socket=i,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new S(this,T,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new w(()=>{this.socket.isConnected()&&this.rejoin()},this.socket.rejoinAfterMs),this.stateChangeRefs.push(this.socket.onError(()=>this.rejoinTimer.reset())),this.stateChangeRefs.push(this.socket.onOpen(()=>{this.rejoinTimer.reset(),this.isErrored()&&this.rejoin()})),this.joinPush.receive("ok",()=>{this.state=f,this.rejoinTimer.reset(),this.pushBuffer.forEach(e=>e.send()),this.pushBuffer=[]}),this.joinPush.receive("error",e=>{this.state=u,this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,e),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.onClose(()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log("channel",`close ${this.topic}`),this.state=l,this.socket.remove(this)}),this.onError(e=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,e),this.isJoining()&&this.joinPush.reset(),this.state=u,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.joinPush.receive("timeout",()=>{this.socket.hasLogger()&&this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),new S(this,C,e({}),this.timeout).send(),this.state=u,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(y,(e,t)=>{this.trigger(this.replyEventName(t),e)})}join(e=this.timeout){if(this.joinedOnce)throw new Error("tried to join multiple times. 'join' can only be called a single time per channel instance");return this.timeout=e,this.joinedOnce=!0,this.rejoin(),this.joinPush}teardown(){this.pushBuffer.forEach(e=>e.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=l,this.bindings=[]}onClose(e){this.on(b,e)}onError(e){return this.on(k,t=>e(t))}on(e,t){let s=this.bindingRef++;return this.bindings.push({event:e,ref:s,callback:t}),s}off(e,t){this.bindings=this.bindings.filter(s=>!(s.event===e&&(void 0===t||t===s.ref)))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(e,t,s=this.timeout){if(t=t||{},!this.joinedOnce)throw new Error(`tried to push '${e}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let i=new S(this,e,function(){return t},s);return this.canPush()?i.send():(i.startTimeout(),this.pushBuffer.push(i)),i}leave(t=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=m;let s=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(b,"leave")},i=new S(this,C,e({}),t);return i.receive("ok",()=>s()).receive("timeout",()=>s()),i.send(),this.canPush()||i.trigger("ok",{}),i}onMessage(e,t,s){return t}filterBindings(e,t,s){return!0}isMember(e,t,s,i){return this.topic===e&&(!i||i===this.joinRef()||(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:e,event:t,payload:s,joinRef:i}),!1))}joinRef(){return this.joinPush.ref}rejoin(e=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=p,this.joinPush.resend(e))}trigger(e,t,s,i){let n=this.onMessage(e,t,s,i);if(t&&!n)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let o=this.bindings.filter(i=>i.event===e&&this.filterBindings(i,t,s));for(let e=0;eu.abort(),o);l.signal=u.signal}return i.fetch(t,l).then(e=>e.text()).then(e=>this.parseJSON(e)).then(e=>c&&c(e)).catch(e=>{"AbortError"===e.name&&h?h():c&&c(null)}),u}static xdomainRequest(e,t,s,i,n,o,h){return e.timeout=n,e.open(t,s),e.onload=()=>{let t=this.parseJSON(e.responseText);h&&h(t)},o&&(e.ontimeout=o),e.onprogress=()=>{},e.send(i),e}static xhrRequest(e,t,s,i,n,o,h,c){e.open(t,s,!0),e.timeout=o;for(let[t,s]of Object.entries(i))e.setRequestHeader(t,s);return e.onerror=()=>c&&c(null),e.onreadystatechange=()=>{if(e.readyState===j&&c){let t=this.parseJSON(e.responseText);c(t)}},h&&(e.ontimeout=h),e.send(n),e}static parseJSON(e){if(!e||""===e)return null;try{return JSON.parse(e)}catch{return console&&console.log("failed to parse JSON response",e),null}}static serialize(e,t){let s=[];for(var i in e){if(!Object.prototype.hasOwnProperty.call(e,i))continue;let n=t?`${t}[${i}]`:i,o=e[i];"object"==typeof o?s.push(this.serialize(o,n)):s.push(encodeURIComponent(n)+"="+encodeURIComponent(o))}return s.join("&")}static appendParams(e,t){if(0===Object.keys(t).length)return e;let s=e.match(/\?/)?"&":"?";return`${e}${s}${this.serialize(t)}`}},L=e=>{let t="",s=new Uint8Array(e),i=s.byteLength;for(let e=0;ethis.poll(),0)}normalizeEndpoint(e){return e.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+R),"$1/"+v)}endpointURL(){return H.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(e,t,s){this.close(e,t,s),this.readyState=n}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===o||this.readyState===n}poll(){const e={Accept:"application/json"};this.authToken&&(e["X-Phoenix-AuthToken"]=this.authToken),this.ajax("GET",e,null,()=>this.ontimeout(),e=>{if(e){var{status:t,token:s,messages:i}=e;if(410===t&&null!==this.token)return this.onerror(410),void this.closeAndRetry(3410,"session_gone",!1);this.token=s}else t=0;switch(t){case 200:i.forEach(e=>{setTimeout(()=>this.onmessage({data:e}),0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=o,this.onopen({}),this.poll();break;case 403:this.onerror(403),this.close(1008,"forbidden",!1);break;case 0:case 500:this.onerror(500),this.closeAndRetry(1011,"internal server error",500);break;default:throw new Error(`unhandled poll status ${t}`)}})}send(e){"string"!=typeof e&&(e=L(e)),this.currentBatch?this.currentBatch.push(e):this.awaitingBatchAck?this.batchBuffer.push(e):(this.currentBatch=[e],this.currentBatchTimer=setTimeout(()=>{this.batchSend(this.currentBatch),this.currentBatch=null},0))}batchSend(e){this.awaitingBatchAck=!0,this.ajax("POST",{"Content-Type":"application/x-ndjson"},e.join("\n"),()=>this.onerror("timeout"),e=>{this.awaitingBatchAck=!1,e&&200===e.status?this.batchBuffer.length>0&&(this.batchSend(this.batchBuffer),this.batchBuffer=[]):(this.onerror(e&&e.status),this.closeAndRetry(1011,"internal server error",!1))})}close(e,t,s){for(let e of this.reqs)e.abort();this.readyState=c;let i=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:e,reason:t,wasClean:s});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,"undefined"!=typeof CloseEvent?this.onclose(new CloseEvent("close",i)):this.onclose(i)}ajax(e,t,s,i,n){let o;o=H.request(e,this.endpointURL(),t,s,this.timeout,()=>{this.reqs.delete(o),i()},e=>{this.reqs.delete(o),this.isActive()&&n(e)}),this.reqs.add(o)}},B=class e{constructor(t,s={}){let i=s.events||{state:"presence_state",diff:"presence_diff"};this.state={},this.pendingDiffs=[],this.channel=t,this.joinRef=null,this.caller={onJoin:function(){},onLeave:function(){},onSync:function(){}},this.channel.on(i.state,t=>{let{onJoin:s,onLeave:i,onSync:n}=this.caller;this.joinRef=this.channel.joinRef(),this.state=e.syncState(this.state,t,s,i),this.pendingDiffs.forEach(t=>{this.state=e.syncDiff(this.state,t,s,i)}),this.pendingDiffs=[],n()}),this.channel.on(i.diff,t=>{let{onJoin:s,onLeave:i,onSync:n}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(t):(this.state=e.syncDiff(this.state,t,s,i),n())})}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}list(t){return e.list(this.state,t)}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel.joinRef()}static syncState(e,t,s,i){let n=this.clone(e),o={},h={};return this.map(n,(e,s)=>{t[e]||(h[e]=s)}),this.map(t,(e,t)=>{let s=n[e];if(s){let i=t.metas.map(e=>e.phx_ref),n=s.metas.map(e=>e.phx_ref),c=t.metas.filter(e=>n.indexOf(e.phx_ref)<0),l=s.metas.filter(e=>i.indexOf(e.phx_ref)<0);c.length>0&&(o[e]=t,o[e].metas=c),l.length>0&&(h[e]=this.clone(s),h[e].metas=l)}else o[e]=t}),this.syncDiff(n,{joins:o,leaves:h},s,i)}static syncDiff(e,t,s,i){let{joins:n,leaves:o}=this.clone(t);return s||(s=function(){}),i||(i=function(){}),this.map(n,(t,i)=>{let n=e[t];if(e[t]=this.clone(i),n){let s=e[t].metas.map(e=>e.phx_ref),i=n.metas.filter(e=>s.indexOf(e.phx_ref)<0);e[t].metas.unshift(...i)}s(t,n,i)}),this.map(o,(t,s)=>{let n=e[t];if(!n)return;let o=s.metas.map(e=>e.phx_ref);n.metas=n.metas.filter(e=>o.indexOf(e.phx_ref)<0),i(t,n,s),0===n.metas.length&&delete e[t]}),e}static list(e,t){return t||(t=function(e,t){return t}),this.map(e,(e,s)=>t(e,s))}static map(e,t){return Object.getOwnPropertyNames(e).map(s=>t(s,e[s]))}static clone(e){return JSON.parse(JSON.stringify(e))}},O={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(e,t){if(e.payload.constructor===ArrayBuffer)return t(this.binaryEncode(e));{let s=[e.join_ref,e.ref,e.topic,e.event,e.payload];return t(JSON.stringify(s))}},decode(e,t){if(e.constructor===ArrayBuffer)return t(this.binaryDecode(e));{let[s,i,n,o,h]=JSON.parse(e);return t({join_ref:s,ref:i,topic:n,event:o,payload:h})}},binaryEncode(e){let{join_ref:t,ref:s,event:i,topic:n,payload:o}=e,h=this.META_LENGTH+t.length+s.length+n.length+i.length,c=new ArrayBuffer(this.HEADER_LENGTH+h),l=new DataView(c),u=0;l.setUint8(u++,this.KINDS.push),l.setUint8(u++,t.length),l.setUint8(u++,s.length),l.setUint8(u++,n.length),l.setUint8(u++,i.length),Array.from(t,e=>l.setUint8(u++,e.charCodeAt(0))),Array.from(s,e=>l.setUint8(u++,e.charCodeAt(0))),Array.from(n,e=>l.setUint8(u++,e.charCodeAt(0))),Array.from(i,e=>l.setUint8(u++,e.charCodeAt(0)));var f=new Uint8Array(c.byteLength+o.byteLength);return f.set(new Uint8Array(c),0),f.set(new Uint8Array(o),c.byteLength),f.buffer},binaryDecode(e){let t=new DataView(e),s=t.getUint8(0),i=new TextDecoder;switch(s){case this.KINDS.push:return this.decodePush(e,t,i);case this.KINDS.reply:return this.decodeReply(e,t,i);case this.KINDS.broadcast:return this.decodeBroadcast(e,t,i)}},decodePush(e,t,s){let i=t.getUint8(1),n=t.getUint8(2),o=t.getUint8(3),h=this.HEADER_LENGTH+this.META_LENGTH-1,c=s.decode(e.slice(h,h+i));h+=i;let l=s.decode(e.slice(h,h+n));h+=n;let u=s.decode(e.slice(h,h+o));return h+=o,{join_ref:c,ref:null,topic:l,event:u,payload:e.slice(h,e.byteLength)}},decodeReply(e,t,s){let i=t.getUint8(1),n=t.getUint8(2),o=t.getUint8(3),h=t.getUint8(4),c=this.HEADER_LENGTH+this.META_LENGTH,l=s.decode(e.slice(c,c+i));c+=i;let u=s.decode(e.slice(c,c+n));c+=n;let f=s.decode(e.slice(c,c+o));c+=o;let p=s.decode(e.slice(c,c+h));c+=h;let m=e.slice(c,e.byteLength);return{join_ref:l,ref:u,topic:f,event:y,payload:{status:p,response:m}}},decodeBroadcast(e,t,s){let i=t.getUint8(1),n=t.getUint8(2),o=this.HEADER_LENGTH+2,h=s.decode(e.slice(o,o+i));o+=i;let c=s.decode(e.slice(o,o+n));return o+=n,{join_ref:null,ref:null,topic:h,event:c,payload:e.slice(o,e.byteLength)}}},$=class{constructor(t,n={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=n.timeout||1e4,this.transport=n.transport||i.WebSocket||P,this.conn=void 0,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=n.longPollFallbackMs,this.fallbackTimer=null;let o=null;try{o=i&&i.sessionStorage}catch{}this.sessionStore=n.sessionStorage||o,this.establishedConnections=0,this.defaultEncoder=O.encode.bind(O),this.defaultDecoder=O.decode.bind(O),this.closeWasClean=!0,this.disconnecting=!1,this.binaryType=n.binaryType||"arraybuffer",this.connectClock=1,this.pageHidden=!1,this.encode=void 0,this.decode=void 0,this.transport!==P?(this.encode=n.encode||this.defaultEncoder,this.decode=n.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let h=null;s&&s.addEventListener&&(s.addEventListener("pagehide",e=>{this.conn&&(this.disconnect(),h=this.connectClock)}),s.addEventListener("pageshow",e=>{h===this.connectClock&&(h=null,this.connect())}),s.addEventListener("visibilitychange",()=>{"hidden"===document.visibilityState?this.pageHidden=!0:(this.pageHidden=!1,this.isConnected()||this.closeWasClean||this.teardown(()=>this.connect()))})),this.heartbeatIntervalMs=n.heartbeatIntervalMs||3e4,this.autoSendHeartbeat=n.autoSendHeartbeat??!0,this.heartbeatCallback=n.heartbeatCallback??(()=>{}),this.rejoinAfterMs=e=>n.rejoinAfterMs?n.rejoinAfterMs(e):[1e3,2e3,5e3][e-1]||1e4,this.reconnectAfterMs=e=>n.reconnectAfterMs?n.reconnectAfterMs(e):[10,50,100,150,200,250,500,1e3,2e3][e-1]||5e3,this.logger=n.logger||null,!this.logger&&n.debug&&(this.logger=(e,t,s)=>{console.log(`${e}: ${t}`,s)}),this.longpollerTimeout=n.longpollerTimeout||2e4,this.params=e(n.params||{}),this.endPoint=`${t}/${R}`,this.vsn=n.vsn||"2.0.0",this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.heartbeatSentAt=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new w(()=>{if(this.pageHidden)return this.log("Not reconnecting as page is hidden!"),void this.teardown();this.teardown(async()=>{n.beforeReconnect&&await n.beforeReconnect(),this.connect()})},this.reconnectAfterMs),this.authToken=n.authToken}getLongPollTransport(){return P}replaceTransport(e){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.conn&&(this.conn.close(),this.conn=null),this.transport=e}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let e=H.appendParams(H.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return"/"!==e.charAt(0)?e:"/"===e.charAt(1)?`${this.protocol()}:${e}`:`${this.protocol()}://${location.host}${e}`}disconnect(e,t,s){this.connectClock++,this.disconnecting=!0,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(()=>{this.disconnecting=!1,e&&e()},t,s)}connect(t){t&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=e(t)),this.conn&&!this.disconnecting||(this.longPollFallbackMs&&this.transport!==P?this.connectWithFallback(P,this.longPollFallbackMs):this.transportConnect())}log(e,t,s){this.logger&&this.logger(e,t,s)}hasLogger(){return null!==this.logger}onOpen(e){let t=this.makeRef();return this.stateChangeCallbacks.open.push([t,e]),t}onClose(e){let t=this.makeRef();return this.stateChangeCallbacks.close.push([t,e]),t}onError(e){let t=this.makeRef();return this.stateChangeCallbacks.error.push([t,e]),t}onMessage(e){let t=this.makeRef();return this.stateChangeCallbacks.message.push([t,e]),t}onHeartbeat(e){this.heartbeatCallback=e}ping(e){if(!this.isConnected())return!1;let t=this.makeRef(),s=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:t});let i=this.onMessage(n=>{n.ref===t&&(this.off([i]),e(Date.now()-s))});return!0}transportName(e){return e===P?"LongPoll":e.name}transportConnect(){let e;this.connectClock++,this.closeWasClean=!1,this.authToken&&(e=["phoenix",`${E}${btoa(this.authToken).replace(/=/g,"")}`]),this.conn=new this.transport(this.endPointURL(),e),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=()=>this.onConnOpen(),this.conn.onerror=e=>this.onConnError(e),this.conn.onmessage=e=>this.onConnMessage(e),this.conn.onclose=e=>this.onConnClose(e)}getSession(e){return this.sessionStore&&this.sessionStore.getItem(e)}storeSession(e,t){this.sessionStore&&this.sessionStore.setItem(e,t)}connectWithFallback(e,t=2500){clearTimeout(this.fallbackTimer);let s,i=!1,n=!0,o=this.transportName(e),h=t=>{this.log("transport",`falling back to ${o}...`,t),this.off([void 0,s]),n=!1,this.replaceTransport(e),this.transportConnect()};if(this.getSession(`phx:fallback:${o}`))return h("memorized");this.fallbackTimer=setTimeout(h,t),s=this.onError(e=>{this.log("transport","error",e),n&&!i&&(clearTimeout(this.fallbackTimer),h(e))}),this.fallbackRef&&this.off([this.fallbackRef]),this.fallbackRef=this.onOpen(()=>{if(i=!0,!n){let t=this.transportName(e);return this.primaryPassedHealthCheck||this.storeSession(`phx:fallback:${t}`,"true"),this.log("transport",`established ${t} fallback`)}clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(h,t),this.ping(e=>{this.log("transport","connected to primary after",e),this.primaryPassedHealthCheck=!0,clearTimeout(this.fallbackTimer)})}),this.transportConnect()}clearHeartbeats(){clearTimeout(this.heartbeatTimer),clearTimeout(this.heartbeatTimeoutTimer)}onConnOpen(){this.hasLogger()&&this.log("transport",`connected to ${this.endPointURL()}`),this.closeWasClean=!1,this.disconnecting=!1,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.autoSendHeartbeat&&this.resetHeartbeat(),this.triggerStateCallbacks("open")}heartbeatTimeout(){if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.hasLogger()&&this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(e){this.log("error","error in heartbeat callback",e)}this.triggerChanError(new Error("heartbeat timeout")),this.closeWasClean=!1,this.teardown(()=>this.reconnectTimer.scheduleTimeout(),1e3,"heartbeat timeout")}}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}teardown(e,t,s){if(!this.conn)return e&&e();const i=this.conn;this.waitForBufferDone(i,()=>{t?i.close(t,s||""):i.close(),this.waitForSocketClosed(i,()=>{this.conn===i&&(this.conn.onopen=function(){},this.conn.onerror=function(){},this.conn.onmessage=function(){},this.conn.onclose=function(){},this.conn=null),e&&e()})})}waitForBufferDone(e,t,s=1){5!==s&&e.bufferedAmount?setTimeout(()=>{this.waitForBufferDone(e,t,s+1)},150*s):t()}waitForSocketClosed(e,t,s=1){5!==s&&e.readyState!==c?setTimeout(()=>{this.waitForSocketClosed(e,t,s+1)},150*s):t()}onConnClose(e){this.conn&&(this.conn.onclose=()=>{}),this.hasLogger()&&this.log("transport","close",e),this.triggerChanError(e),this.clearHeartbeats(),this.closeWasClean||this.reconnectTimer.scheduleTimeout(),this.triggerStateCallbacks("close",e)}onConnError(e){this.hasLogger()&&this.log("transport","error",e);let t=this.transport,s=this.establishedConnections;this.triggerStateCallbacks("error",e,t,s),(t===this.transport||s>0)&&this.triggerChanError(e)}triggerChanError(e){this.channels.forEach(t=>{t.isErrored()||t.isLeaving()||t.isClosed()||t.trigger(k,e)})}connectionState(){switch(this.conn&&this.conn.readyState){case n:return"connecting";case o:return"open";case h:return"closing";default:return"closed"}}isConnected(){return"open"===this.connectionState()}remove(e){this.off(e.stateChangeRefs),this.channels=this.channels.filter(t=>t!==e)}off(e){for(let t in this.stateChangeCallbacks)this.stateChangeCallbacks[t]=this.stateChangeCallbacks[t].filter(([t])=>-1===e.indexOf(t))}channel(e,t={}){let s=new A(e,t,this);return this.channels.push(s),s}push(e){if(this.hasLogger()){let{topic:t,event:s,payload:i,ref:n,join_ref:o}=e;this.log("push",`${t} ${s} (${o}, ${n})`,i)}this.isConnected()?this.encode(e,e=>this.conn.send(e)):this.sendBuffer.push(()=>this.encode(e,e=>this.conn.send(e)))}makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}sendHeartbeat(){if(this.isConnected())if(this.pendingHeartbeatRef)this.heartbeatTimeout();else{this.pendingHeartbeatRef=this.makeRef(),this.heartbeatSentAt=Date.now(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(e){this.log("error","error in heartbeat callback",e)}this.heartbeatTimeoutTimer=setTimeout(()=>this.heartbeatTimeout(),this.heartbeatIntervalMs)}else try{this.heartbeatCallback("disconnected")}catch(e){this.log("error","error in heartbeat callback",e)}}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}onConnMessage(e){this.decode(e.data,e=>{let{topic:t,event:s,payload:i,ref:n,join_ref:o}=e;if(n&&n===this.pendingHeartbeatRef){const e=this.heartbeatSentAt?Date.now()-this.heartbeatSentAt:void 0;this.clearHeartbeats();try{this.heartbeatCallback("ok"===i.status?"ok":"error",e)}catch(e){this.log("error","error in heartbeat callback",e)}this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.autoSendHeartbeat&&(this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}this.hasLogger()&&this.log("receive",`${i.status||""} ${t} ${s} ${n&&"("+n+")"||""}`.trim(),i);for(let e=0;e{try{i(...t)}catch(t){this.log("error",`error in ${e} callback`,t)}})}catch(t){this.log("error",`error triggering ${e} callbacks`,t)}}leaveOpenTopic(e){let t=this.channels.find(t=>t.topic===e&&(t.isJoined()||t.isJoining()));t&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${e}"`),t.leave())}}},1170,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.normalizeChannelError=function(n){if(n instanceof Error)return n;if('string'==typeof n)return new Error(n);if(n&&'object'==typeof n){const o=n;if('number'==typeof o.code){const t='string'==typeof o.reason&&o.reason?` (${o.reason})`:'';return new Error(`socket closed: ${o.code}${t}`,{cause:n})}return new Error('channel error: transport failure',{cause:n})}return new Error('channel error: connection lost')}},1171,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t}});var n=r(d[0]);class t{constructor(n,t,s){const h=(o=s,{config:Object.assign({broadcast:{ack:!1,self:!1},presence:{key:'',enabled:!1},private:!1},o.config)});var o;this.channel=n.getSocket().channel(t,h),this.socket=n}get state(){return this.channel.state}set state(n){this.channel.state=n}get joinedOnce(){return this.channel.joinedOnce}get joinPush(){return this.channel.joinPush}get rejoinTimer(){return this.channel.rejoinTimer}on(n,t){return this.channel.on(n,t)}off(n,t){this.channel.off(n,t)}subscribe(n){return this.channel.join(n)}unsubscribe(n){return this.channel.leave(n)}teardown(){this.channel.teardown()}onClose(n){this.channel.onClose(n)}onError(n){return this.channel.onError(n)}push(t,s,h){let o;try{o=this.channel.push(t,s,h)}catch(n){throw new Error(`tried to push '${t}' to '${this.channel.topic}' before joining. Use channel.subscribe() before pushing events`)}if(this.channel.pushBuffer.length>n.MAX_PUSH_BUFFER_SIZE){const n=this.channel.pushBuffer.shift();n.cancelTimeout(),this.socket.log('channel',`discarded push due to buffer overflow: ${n.event}`,n.payload())}return o}updateJoinPayload(n){const t=this.channel.joinPush.payload();this.channel.joinPush.payload=()=>Object.assign(Object.assign({},t),n)}canPush(){return this.socket.isConnected()&&this.state===n.CHANNEL_STATES.joined}isJoined(){return this.state===n.CHANNEL_STATES.joined}isJoining(){return this.state===n.CHANNEL_STATES.joining}isClosed(){return this.state===n.CHANNEL_STATES.closed}isLeaving(){return this.state===n.CHANNEL_STATES.leaving}updateFilterBindings(n){this.channel.filterBindings=n}updatePayloadTransform(n){this.channel.onMessage=n}getChannel(){return this.channel}}},1172,[1163]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"RealtimePostgresFilterBuilder",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"postgresChangesFilter",{enumerable:!0,get:function(){return c}});const t=/[,()"\\]/,n=n=>t.test(n)||n!==n.trim(),s=t=>`"${t.replace(/\\/g,'\\\\').replace(/"/g,'\\"')}"`,u=t=>{const u=null===t?'null':String(t);return n(u)?s(u):u},l=t=>null===t?'null':String(t),h=(t,n)=>{if('in'===t){const t=Array.isArray(n)?n:[n];if(0===t.length)throw new Error('Realtime `in` filter requires at least one value.');return`in.(${Array.from(new Set(t)).map(t=>u(t)).join(',')})`}return'is'===t?`is.${l(n)}`:`${t}.${u(n)}`};class o{constructor(){this.filters=[]}add(t,n,s,u=!1){const l=u?'not.':'';return this.filters.push(`${t}=${l}${h(n,s)}`),this}eq(t,n){return this.add(t,'eq',n)}neq(t,n){return this.add(t,'neq',n)}gt(t,n){return this.add(t,'gt',n)}gte(t,n){return this.add(t,'gte',n)}lt(t,n){return this.add(t,'lt',n)}lte(t,n){return this.add(t,'lte',n)}in(t,n){return this.add(t,'in',n)}like(t,n){return this.add(t,'like',n)}ilike(t,n){return this.add(t,'ilike',n)}match(t,n){return this.add(t,'match',n)}imatch(t,n){return this.add(t,'imatch',n)}is(t,n){return this.add(t,'is',n)}isDistinct(t,n){return this.add(t,'isdistinct',n)}not(t,n,s){return this.add(t,n,s,!0)}build(){return this.filters.join(',')}toString(){return this.build()}}const c=()=>new o},1173,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return s}});var t=r(d[0]),n=r(d[1]);class s{constructor(n,s){this.socket=new t.Socket(n,s)}get timeout(){return this.socket.timeout}get endPoint(){return this.socket.endPoint}get transport(){return this.socket.transport}get heartbeatIntervalMs(){return this.socket.heartbeatIntervalMs}get heartbeatCallback(){return this.socket.heartbeatCallback}set heartbeatCallback(t){this.socket.heartbeatCallback=t}get heartbeatTimer(){return this.socket.heartbeatTimer}get pendingHeartbeatRef(){return this.socket.pendingHeartbeatRef}get reconnectTimer(){return this.socket.reconnectTimer}get vsn(){return this.socket.vsn}get encode(){return this.socket.encode}get decode(){return this.socket.decode}get reconnectAfterMs(){return this.socket.reconnectAfterMs}get sendBuffer(){return this.socket.sendBuffer}get stateChangeCallbacks(){return this.socket.stateChangeCallbacks}connect(){this.socket.connect()}disconnect(t,n,s,o=1e4){return new Promise(c=>{setTimeout(()=>c('timeout'),o),this.socket.disconnect(()=>{t(),c('ok')},n,s)})}push(t){this.socket.push(t)}log(t,n,s){this.socket.log(t,n,s)}makeRef(){return this.socket.makeRef()}onOpen(t){this.socket.onOpen(t)}onClose(t){this.socket.onClose(t)}onError(t){this.socket.onError(t)}onMessage(t){this.socket.onMessage(t)}isConnected(){return this.socket.isConnected()}isConnecting(){return this.socket.connectionState()==n.CONNECTION_STATE.connecting}isDisconnecting(){return this.socket.connectionState()==n.CONNECTION_STATE.closing}connectionState(){return this.socket.connectionState()}endPointURL(){return this.socket.endPointURL()}sendHeartbeat(){this.socket.sendHeartbeat()}getSocket(){return this.socket}}},1174,[1170,1163]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"StorageAnalyticsClient",{enumerable:!0,get:function(){return H}}),Object.defineProperty(_e,"StorageApiError",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"StorageClient",{enumerable:!0,get:function(){return ee}}),Object.defineProperty(_e,"StorageError",{enumerable:!0,get:function(){return i}}),Object.defineProperty(_e,"StorageUnknownError",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"StorageVectorsApiError",{enumerable:!0,get:function(){return y}}),Object.defineProperty(_e,"StorageVectorsClient",{enumerable:!0,get:function(){return X}}),Object.defineProperty(_e,"StorageVectorsError",{enumerable:!0,get:function(){return p}}),Object.defineProperty(_e,"StorageVectorsErrorCode",{enumerable:!0,get:function(){return v}}),Object.defineProperty(_e,"StorageVectorsUnknownError",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"VectorBucketApi",{enumerable:!0,get:function(){return W}}),Object.defineProperty(_e,"VectorBucketScope",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(_e,"VectorDataApi",{enumerable:!0,get:function(){return G}}),Object.defineProperty(_e,"VectorIndexApi",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(_e,"VectorIndexScope",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(_e,"isStorageError",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"isStorageVectorsError",{enumerable:!0,get:function(){return f}});var e=_r(d[0]);function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(e,r){if("object"!=t(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,r||"default");if("object"!=t(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}function n(e){var n=r(e,"string");return"symbol"==t(n)?n:n+""}function o(e,t,r){return(t=n(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function c(e){for(var t=1;t{if("object"!=typeof e||null===e)return!1;const t=Object.getPrototypeOf(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},k=e=>{if(Array.isArray(e))return e.map(e=>k(e));if("function"==typeof e||e!==Object(e))return e;const t={};return Object.entries(e).forEach(([e,r])=>{const n=e.replace(/([-_][a-z])/gi,e=>e.toUpperCase().replace(/[-_]/g,""));t[n]=k(r)}),t},x=e=>!(!e||"string"!=typeof e)&&(!(0===e.length||e.length>100)&&(e.trim()===e&&(!e.includes("/")&&!e.includes("\\")&&/^[\w!.\*'() &$@=;:+,?-]+$/.test(e)))),$=e=>{if("object"==typeof e&&null!==e){const t=e;if("string"==typeof t.msg)return t.msg;if("string"==typeof t.message)return t.message;if("string"==typeof t.error_description)return t.error_description;if("string"==typeof t.error)return t.error;if("object"==typeof t.error&&null!==t.error){const e=t.error;if("string"==typeof e.message)return e.message}}return JSON.stringify(e)},j=async(e,t,r,n)=>{if(null!==e&&"object"==typeof e&&"json"in e&&"function"==typeof e.json){const r=e;let o=parseInt(String(r.status),10);Number.isFinite(o)||(o=500),r.json().then(e=>{const r=(null==e?void 0:e.statusCode)||(null==e?void 0:e.code)||o+"";t(new l($(e),o,r,n))}).catch(()=>{const e=o+"";t(new l(r.statusText||`HTTP ${o} error`,o,e,n))})}else t(new h($(e),e,n))},B=(e,t,r,n)=>{const o={method:e,headers:(null==t?void 0:t.headers)||{}};if("GET"===e||"HEAD"===e||!n)return c(c({},o),r);if(S(n)){var s;const e=(null==t?void 0:t.headers)||{};let r;for(const[t,n]of Object.entries(e))"content-type"===t.toLowerCase()&&(r=n);o.headers=w(e,"Content-Type",null!==(s=r)&&void 0!==s?s:"application/json"),o.body=JSON.stringify(n)}else o.body=n;return(null==t?void 0:t.duplex)&&(o.duplex=t.duplex),c(c({},o),r)};async function P(e,t,r,n,o,s,c){return new Promise((i,u)=>{e(r,B(t,n,o,s)).then(e=>{if(!e.ok)throw e;if(null==n?void 0:n.noResolveJson)return e;if("vectors"===c){const t=e.headers.get("content-type");if("0"===e.headers.get("content-length")||204===e.status)return{};if(!t||!t.includes("application/json"))return{}}return e.json()}).then(e=>i(e)).catch(e=>j(e,u,0,c))})}function N(e="storage"){return{get:async(t,r,n,o)=>P(t,"GET",r,n,o,void 0,e),post:async(t,r,n,o,s)=>P(t,"POST",r,o,s,n,e),put:async(t,r,n,o,s)=>P(t,"PUT",r,o,s,n,e),head:async(t,r,n,o)=>P(t,"HEAD",r,c(c({},n),{},{noResolveJson:!0}),o,void 0,e),remove:async(t,r,n,o,s)=>P(t,"DELETE",r,o,s,n,e)}}const E=N("storage"),{get:C,post:V,put:I,head:T,remove:U}=E,_=N("vectors");var F=class{constructor(e,t={},r,n="storage"){var o;this.shouldThrowOnError=!1,this.url=e,this.headers=O(t),this.fetch=(o=r)?(...e)=>o(...e):(...e)=>fetch(...e),this.namespace=n}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,t){return this.headers=w(this.headers,e,t),this}async handleOperation(e){try{return{data:await e(),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(u(e))return{data:null,error:e};throw e}}};let R;R=Symbol.toStringTag;var L=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[R]="StreamDownloadBuilder",this.promise=null}then(e,t){return this.getPromise().then(e,t)}catch(e){return this.getPromise().catch(e)}finally(e){return this.getPromise().finally(e)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){try{return{data:(await this.downloadFn()).body,error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(u(e))return{data:null,error:e};throw e}}};let D;D=Symbol.toStringTag;var A=class{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[D]="BlobDownloadBuilder",this.promise=null}asStream(){return new L(this.downloadFn,this.shouldThrowOnError)}then(e,t){return this.getPromise().then(e,t)}catch(e){return this.getPromise().catch(e)}finally(e){return this.getPromise().finally(e)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){try{return{data:await(await this.downloadFn()).blob(),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(u(e))return{data:null,error:e};throw e}}};const M={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},z={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var J=class extends F{constructor(e,t={},r,n){super(e,t,n,"storage"),this.bucketId=r}async uploadOrUpdate(e,t,r,n){var o=this;return o.handleOperation(async()=>{let s;const i=c(c({},z),n);let u=c(c({},o.headers),"POST"===e&&{"x-upsert":String(i.upsert)});const l=i.metadata;if("undefined"!=typeof Blob&&r instanceof Blob?(s=new FormData,s.append("cacheControl",i.cacheControl),l&&s.append("metadata",o.encodeMetadata(l)),s.append("",r)):"undefined"!=typeof FormData&&r instanceof FormData?(s=r,s.has("cacheControl")||s.append("cacheControl",i.cacheControl),l&&!s.has("metadata")&&s.append("metadata",o.encodeMetadata(l))):(s=r,u["cache-control"]=`max-age=${i.cacheControl}`,u["content-type"]=i.contentType,l&&(u["x-metadata"]=o.toBase64(o.encodeMetadata(l))),("undefined"!=typeof ReadableStream&&s instanceof ReadableStream||s&&"object"==typeof s&&"pipe"in s&&"function"==typeof s.pipe)&&!i.duplex&&(i.duplex="half")),null==n?void 0:n.headers)for(const[e,t]of Object.entries(n.headers))u=w(u,e,t);const h=o._removeEmptyFolders(t),p=o._getFinalPath(h),f=await("PUT"==e?I:V)(o.fetch,`${o.url}/object/${p}`,s,c({headers:u},(null==i?void 0:i.duplex)?{duplex:i.duplex}:{}));return{path:h,id:f.Id,fullPath:f.Key}})}async upload(e,t,r){return this.uploadOrUpdate("POST",e,t,r)}async uploadToSignedUrl(e,t,r,n){var o=this;const s=o._removeEmptyFolders(e),i=o._getFinalPath(s),u=new URL(o.url+`/object/upload/sign/${i}`);return u.searchParams.set("token",t),o.handleOperation(async()=>{let e;const t=c(c({},z),n);let i=c(c({},o.headers),{"x-upsert":String(t.upsert)});const l=t.metadata;if("undefined"!=typeof Blob&&r instanceof Blob?(e=new FormData,e.append("cacheControl",t.cacheControl),l&&e.append("metadata",o.encodeMetadata(l)),e.append("",r)):"undefined"!=typeof FormData&&r instanceof FormData?(e=r,e.has("cacheControl")||e.append("cacheControl",t.cacheControl),l&&!e.has("metadata")&&e.append("metadata",o.encodeMetadata(l))):(e=r,i["cache-control"]=`max-age=${t.cacheControl}`,i["content-type"]=t.contentType,l&&(i["x-metadata"]=o.toBase64(o.encodeMetadata(l))),("undefined"!=typeof ReadableStream&&e instanceof ReadableStream||e&&"object"==typeof e&&"pipe"in e&&"function"==typeof e.pipe)&&!t.duplex&&(t.duplex="half")),null==n?void 0:n.headers)for(const[e,t]of Object.entries(n.headers))i=w(i,e,t);return{path:s,fullPath:(await I(o.fetch,u.toString(),e,c({headers:i},(null==t?void 0:t.duplex)?{duplex:t.duplex}:{}))).Key}})}async createSignedUploadUrl(e,t){var r=this;return r.handleOperation(async()=>{let n=r._getFinalPath(e);const o=c({},r.headers);(null==t?void 0:t.upsert)&&(o["x-upsert"]="true");const s=await V(r.fetch,`${r.url}/object/upload/sign/${n}`,{},{headers:o}),u=new URL(r.url+s.url),l=u.searchParams.get("token");if(!l)throw new i("No token returned by API");return{signedUrl:u.toString(),path:e,token:l}})}async update(e,t,r){return this.uploadOrUpdate("PUT",e,t,r)}async move(e,t,r){var n=this;return n.handleOperation(async()=>await V(n.fetch,`${n.url}/object/move`,{bucketId:n.bucketId,sourceKey:e,destinationKey:t,destinationBucket:null==r?void 0:r.destinationBucket},{headers:n.headers}))}async copy(e,t,r){var n=this;return n.handleOperation(async()=>({path:(await V(n.fetch,`${n.url}/object/copy`,{bucketId:n.bucketId,sourceKey:e,destinationKey:t,destinationBucket:null==r?void 0:r.destinationBucket},{headers:n.headers})).Key}))}async createSignedUrl(e,t,r){var n=this;return n.handleOperation(async()=>{let o=n._getFinalPath(e);const s="object"==typeof(null==r?void 0:r.transform)&&null!==r.transform&&Object.keys(r.transform).length>0;let i=await V(n.fetch,`${n.url}/object/sign/${o}`,c({expiresIn:t},s?{transform:r.transform}:{}),{headers:n.headers});const u=new URLSearchParams;(null==r?void 0:r.download)&&u.set("download",!0===r.download?"":r.download),null!=(null==r?void 0:r.cacheNonce)&&u.set("cacheNonce",String(r.cacheNonce));const l=u.toString();return{signedUrl:encodeURI(`${n.url}${i.signedURL}${l?`&${l}`:""}`)}})}async createSignedUrls(e,t,r){var n=this;return n.handleOperation(async()=>{const o=await V(n.fetch,`${n.url}/object/sign/${n.bucketId}`,{expiresIn:t,paths:e},{headers:n.headers}),s=new URLSearchParams;(null==r?void 0:r.download)&&s.set("download",!0===r.download?"":r.download),null!=(null==r?void 0:r.cacheNonce)&&s.set("cacheNonce",String(r.cacheNonce));const i=s.toString();return o.map(e=>c(c({},e),{},{signedUrl:e.signedURL?encodeURI(`${n.url}${e.signedURL}${i?`&${i}`:""}`):null}))})}download(e,t,r){const n="object"==typeof(null==t?void 0:t.transform)&&null!==t.transform&&Object.keys(t.transform).length>0?"render/image/authenticated":"object",o=new URLSearchParams;(null==t?void 0:t.transform)&&this.applyTransformOptsToQuery(o,t.transform),null!=(null==t?void 0:t.cacheNonce)&&o.set("cacheNonce",String(t.cacheNonce));const s=o.toString(),c=this._getFinalPath(e);return new A(()=>C(this.fetch,`${this.url}/${n}/${c}${s?`?${s}`:""}`,{headers:this.headers,noResolveJson:!0},r),this.shouldThrowOnError)}async info(e){var t=this;const r=t._getFinalPath(e);return t.handleOperation(async()=>k(await C(t.fetch,`${t.url}/object/info/${r}`,{headers:t.headers})))}async exists(e){var t=this;const r=t._getFinalPath(e);try{return await T(t.fetch,`${t.url}/object/${r}`,{headers:t.headers}),{data:!0,error:null}}catch(e){if(t.shouldThrowOnError)throw e;if(u(e)){var n;const t=e instanceof l?e.status:e instanceof h?null===(n=e.originalError)||void 0===n?void 0:n.status:void 0;if(void 0!==t&&[400,404].includes(t))return{data:!1,error:e}}throw e}}getPublicUrl(e,t){const r=this._getFinalPath(e),n=new URLSearchParams;(null==t?void 0:t.download)&&n.set("download",!0===t.download?"":t.download),(null==t?void 0:t.transform)&&this.applyTransformOptsToQuery(n,t.transform),null!=(null==t?void 0:t.cacheNonce)&&n.set("cacheNonce",String(t.cacheNonce));const o=n.toString(),s="object"==typeof(null==t?void 0:t.transform)&&null!==t.transform&&Object.keys(t.transform).length>0?"render/image":"object";return{data:{publicUrl:encodeURI(`${this.url}/${s}/public/${r}`)+(o?`?${o}`:"")}}}async remove(e){var t=this;return t.handleOperation(async()=>await U(t.fetch,`${t.url}/object/${t.bucketId}`,{prefixes:e},{headers:t.headers}))}async purgeCache(e,t,r){var n=this;return n.handleOperation(async()=>{const o=n._getFinalPath(e),s=new URLSearchParams;(null==t?void 0:t.transformations)&&s.set("transformations","true");const c=s.toString();return await U(n.fetch,`${n.url}/cdn/${o}${c?`?${c}`:""}`,{},{headers:n.headers},r)})}async list(e,t,r){var n=this;return n.handleOperation(async()=>{const o=(null==t?void 0:t.sortBy)?c(c({},M.sortBy),t.sortBy):M.sortBy,s=c(c(c({},M),t),{},{sortBy:o,prefix:e||""});return await V(n.fetch,`${n.url}/object/list/${n.bucketId}`,s,{headers:n.headers},r)})}async listV2(e,t){var r=this;return r.handleOperation(async()=>{const n=c({},e);return await V(r.fetch,`${r.url}/object/list-v2/${r.bucketId}`,n,{headers:r.headers},t)})}encodeMetadata(e){return JSON.stringify(e)}toBase64(e){return"undefined"!=typeof Buffer?Buffer.from(e).toString("base64"):btoa(e)}_getFinalPath(e){return`${this.bucketId}/${e.replace(/^\/+/,"")}`}_removeEmptyFolders(e){return e.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}applyTransformOptsToQuery(e,t){return t.width&&e.set("width",t.width.toString()),t.height&&e.set("height",t.height.toString()),t.resize&&e.set("resize",t.resize),t.format&&e.set("format",t.format),t.quality&&e.set("quality",t.quality.toString()),e}};const K={"X-Client-Info":"storage-js/2.109.0"};var q=class extends F{constructor(e,t={},r,n){const o=new URL(e);(null==n?void 0:n.useNewHostname)&&/supabase\.(co|in|red)$/.test(o.hostname)&&!o.hostname.includes("storage.supabase.")&&(o.hostname=o.hostname.replace("supabase.","storage.supabase."));super(o.href.replace(/\/$/,""),c(c({},K),t),r,"storage")}async listBuckets(e){var t=this;return t.handleOperation(async()=>{const r=t.listBucketOptionsToQueryString(e);return await C(t.fetch,`${t.url}/bucket${r}`,{headers:t.headers})})}async getBucket(e){var t=this;return t.handleOperation(async()=>await C(t.fetch,`${t.url}/bucket/${e}`,{headers:t.headers}))}async createBucket(e,t={public:!1}){var r=this;return r.handleOperation(async()=>await V(r.fetch,`${r.url}/bucket`,{id:e,name:e,type:t.type,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:r.headers}))}async updateBucket(e,t){var r=this;return r.handleOperation(async()=>await I(r.fetch,`${r.url}/bucket/${e}`,{id:e,name:e,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:r.headers}))}async emptyBucket(e){var t=this;return t.handleOperation(async()=>await V(t.fetch,`${t.url}/bucket/${e}/empty`,{},{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await U(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}))}async purgeBucketCache(e,t,r){var n=this;return n.handleOperation(async()=>{const o=new URLSearchParams;(null==t?void 0:t.transformations)&&o.set("transformations","true");const s=o.toString();return await U(n.fetch,`${n.url}/cdn/${e}${s?`?${s}`:""}`,{},{headers:n.headers},r)})}listBucketOptionsToQueryString(e){const t={};return e&&("limit"in e&&(t.limit=String(e.limit)),"offset"in e&&(t.offset=String(e.offset)),e.search&&(t.search=e.search),e.sortColumn&&(t.sortColumn=e.sortColumn),e.sortOrder&&(t.sortOrder=e.sortOrder)),Object.keys(t).length>0?"?"+new URLSearchParams(t).toString():""}},H=class extends F{constructor(e,t={},r){super(e.replace(/\/$/,""),c(c({},K),t),r,"storage")}async createBucket(e){var t=this;return t.handleOperation(async()=>await V(t.fetch,`${t.url}/bucket`,{name:e},{headers:t.headers}))}async listBuckets(e){var t=this;return t.handleOperation(async()=>{const r=new URLSearchParams;void 0!==(null==e?void 0:e.limit)&&r.set("limit",e.limit.toString()),void 0!==(null==e?void 0:e.offset)&&r.set("offset",e.offset.toString()),(null==e?void 0:e.sortColumn)&&r.set("sortColumn",e.sortColumn),(null==e?void 0:e.sortOrder)&&r.set("sortOrder",e.sortOrder),(null==e?void 0:e.search)&&r.set("search",e.search);const n=r.toString(),o=n?`${t.url}/bucket?${n}`:`${t.url}/bucket`;return await C(t.fetch,o,{headers:t.headers})})}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await U(t.fetch,`${t.url}/bucket/${e}`,{},{headers:t.headers}))}from(t){var r=this;if(!x(t))throw new i("Invalid bucket name: File, folder, and bucket names must follow AWS object key naming guidelines and should avoid the use of any other characters.");const n=new e.IcebergRestCatalog({baseUrl:this.url,catalogName:t,auth:{type:"custom",getHeaders:async()=>r.headers},fetch:this.fetch}),o=this.shouldThrowOnError;return new Proxy(n,{get(e,t){const r=e[t];return"function"!=typeof r?r:async(...t)=>{try{return{data:await r.apply(e,t),error:null}}catch(e){if(o)throw e;return{data:null,error:e}}}}})}},Q=class extends F{constructor(e,t={},r){super(e.replace(/\/$/,""),c(c({},K),{},{"Content-Type":"application/json"},t),r,"vectors")}async createIndex(e){var t=this;return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/CreateIndex`,e,{headers:t.headers})||{})}async getIndex(e,t){var r=this;return r.handleOperation(async()=>await _.post(r.fetch,`${r.url}/GetIndex`,{vectorBucketName:e,indexName:t},{headers:r.headers}))}async listIndexes(e){var t=this;return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/ListIndexes`,e,{headers:t.headers}))}async deleteIndex(e,t){var r=this;return r.handleOperation(async()=>await _.post(r.fetch,`${r.url}/DeleteIndex`,{vectorBucketName:e,indexName:t},{headers:r.headers})||{})}},G=class extends F{constructor(e,t={},r){super(e.replace(/\/$/,""),c(c({},K),{},{"Content-Type":"application/json"},t),r,"vectors")}async putVectors(e){var t=this;if(e.vectors.length<1||e.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/PutVectors`,e,{headers:t.headers})||{})}async getVectors(e){var t=this;return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/GetVectors`,e,{headers:t.headers}))}async listVectors(e){var t=this;if(void 0!==e.segmentCount){if(e.segmentCount<1||e.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(void 0!==e.segmentIndex&&(e.segmentIndex<0||e.segmentIndex>=e.segmentCount))throw new Error("segmentIndex must be between 0 and "+(e.segmentCount-1))}return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/ListVectors`,e,{headers:t.headers}))}async queryVectors(e){var t=this;return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/QueryVectors`,e,{headers:t.headers}))}async deleteVectors(e){var t=this;if(e.keys.length<1||e.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/DeleteVectors`,e,{headers:t.headers})||{})}},W=class extends F{constructor(e,t={},r){super(e.replace(/\/$/,""),c(c({},K),{},{"Content-Type":"application/json"},t),r,"vectors")}async createBucket(e){var t=this;return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}async getBucket(e){var t=this;return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/GetVectorBucket`,{vectorBucketName:e},{headers:t.headers}))}async listBuckets(e={}){var t=this;return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/ListVectorBuckets`,e,{headers:t.headers}))}async deleteBucket(e){var t=this;return t.handleOperation(async()=>await _.post(t.fetch,`${t.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:t.headers})||{})}},X=class extends W{constructor(e,t={}){super(e,t.headers||{},t.fetch)}from(e){return new Y(this.url,this.headers,e,this.fetch)}async createBucket(e){return(()=>super.createBucket)().call(this,e)}async getBucket(e){return(()=>super.getBucket)().call(this,e)}async listBuckets(e={}){return(()=>super.listBuckets)().call(this,e)}async deleteBucket(e){return(()=>super.deleteBucket)().call(this,e)}},Y=class extends Q{constructor(e,t,r,n){super(e,t,n),this.vectorBucketName=r}async createIndex(e){return(()=>super.createIndex)().call(this,c(c({},e),{},{vectorBucketName:this.vectorBucketName}))}async listIndexes(e={}){return(()=>super.listIndexes)().call(this,c(c({},e),{},{vectorBucketName:this.vectorBucketName}))}async getIndex(e){return(()=>super.getIndex)().call(this,this.vectorBucketName,e)}async deleteIndex(e){return(()=>super.deleteIndex)().call(this,this.vectorBucketName,e)}index(e){return new Z(this.url,this.headers,this.vectorBucketName,e,this.fetch)}},Z=class extends G{constructor(e,t,r,n,o){super(e,t,o),this.vectorBucketName=r,this.indexName=n}async putVectors(e){var t=this;return(()=>super.putVectors)().call(t,c(c({},e),{},{vectorBucketName:t.vectorBucketName,indexName:t.indexName}))}async getVectors(e){var t=this;return(()=>super.getVectors)().call(t,c(c({},e),{},{vectorBucketName:t.vectorBucketName,indexName:t.indexName}))}async listVectors(e={}){var t=this;return(()=>super.listVectors)().call(t,c(c({},e),{},{vectorBucketName:t.vectorBucketName,indexName:t.indexName}))}async queryVectors(e){var t=this;return(()=>super.queryVectors)().call(t,c(c({},e),{},{vectorBucketName:t.vectorBucketName,indexName:t.indexName}))}async deleteVectors(e){var t=this;return(()=>super.deleteVectors)().call(t,c(c({},e),{},{vectorBucketName:t.vectorBucketName,indexName:t.indexName}))}},ee=class extends q{constructor(e,t={},r,n){super(e,t,r,n)}from(e){return new J(this.url,this.headers,e,this.fetch)}get vectors(){return new X(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new H(this.url+"/iceberg",this.headers,this.fetch)}}},1175,[1176]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"IcebergError",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"IcebergRestCatalog",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"getCurrentSchema",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"isDecimalType",{enumerable:!0,get:function(){return T}}),Object.defineProperty(e,"isFixedType",{enumerable:!0,get:function(){return w}}),Object.defineProperty(e,"parseDecimalType",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"parseFixedType",{enumerable:!0,get:function(){return y}}),Object.defineProperty(e,"typesEqual",{enumerable:!0,get:function(){return x}});var t=class extends Error{constructor(t,a){super(t),this.name="IcebergError",this.status=a.status,this.icebergType=a.icebergType,this.icebergCode=a.icebergCode,this.details=a.details,this.isCommitStateUnknown="CommitStateUnknownException"===a.icebergType||[500,502,504].includes(a.status)&&!0===a.icebergType?.includes("CommitState")}isNotFound(){return 404===this.status}isConflict(){return 409===this.status}isAuthenticationTimeout(){return 419===this.status}};function a(t,a,s){const n=new URL(a,t);if(s)for(const[t,a]of Object.entries(s))void 0!==a&&n.searchParams.set(t,a);return n.toString()}async function s(t){return t&&"none"!==t.type?"bearer"===t.type?{Authorization:`Bearer ${t.token}`}:"header"===t.type?{[t.name]:t.value}:"custom"===t.type?await t.getHeaders():{}:{}}function n(n){const c=n.fetchImpl??globalThis.fetch;return{async request({method:o,path:p,query:u,body:l,headers:h}){const b=a(n.baseUrl,p,u),f=await s(n.auth),y=await c(b,{method:o,headers:{...l?{"Content-Type":"application/json"}:{},...f,...h},body:l?JSON.stringify(l):void 0}),T=await y.text(),w=(y.headers.get("content-type")||"").includes("application/json"),x=w&&T?JSON.parse(T):T;if(!y.ok){const a=w?x:void 0,s=a?.error;throw new t(s?.message??`Request failed with status ${y.status}`,{status:y.status,icebergType:s?.type,icebergCode:s?.code,details:a})}return{status:y.status,headers:y.headers,data:x}}}}function c(t){return t.join("\x1f")}var o=class{constructor(t,a=""){this.client=t,this.prefix=a}async listNamespaces(t){const a=t?{parent:c(t.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:a})).data.namespaces.map(t=>({namespace:t}))}async createNamespace(t,a){const s={namespace:t.namespace,properties:a?.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:s})).data}async dropNamespace(t){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${c(t.namespace)}`})}async loadNamespaceMetadata(t){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${c(t.namespace)}`})).data.properties}}async namespaceExists(a){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${c(a.namespace)}`}),!0}catch(a){if(a instanceof t&&404===a.status)return!1;throw a}}async createNamespaceIfNotExists(a,s){try{return await this.createNamespace(a,s)}catch(a){if(a instanceof t&&409===a.status)return;throw a}}};function p(t){return t.join("\x1f")}var u=class{constructor(t,a="",s){this.client=t,this.prefix=a,this.accessDelegation=s}async listTables(t){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${p(t.namespace)}/tables`})).data.identifiers}async createTable(t,a){const s={};this.accessDelegation&&(s["X-Iceberg-Access-Delegation"]=this.accessDelegation);return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${p(t.namespace)}/tables`,body:a,headers:s})).data.metadata}async updateTable(t,a){const s=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${p(t.namespace)}/tables/${t.name}`,body:a});return{"metadata-location":s.data["metadata-location"],metadata:s.data.metadata}}async dropTable(t,a){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${p(t.namespace)}/tables/${t.name}`,query:{purgeRequested:String(a?.purge??!1)}})}async loadTable(t){const a={};this.accessDelegation&&(a["X-Iceberg-Access-Delegation"]=this.accessDelegation);return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${p(t.namespace)}/tables/${t.name}`,headers:a})).data.metadata}async tableExists(a){const s={};this.accessDelegation&&(s["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${p(a.namespace)}/tables/${a.name}`,headers:s}),!0}catch(a){if(a instanceof t&&404===a.status)return!1;throw a}}async createTableIfNotExists(a,s){try{return await this.createTable(a,s)}catch(n){if(n instanceof t&&409===n.status)return await this.loadTable({namespace:a.namespace,name:s.name});throw n}}},l=class{constructor(t){let a="v1";t.catalogName&&(a+=`/${t.catalogName}`);const s=t.baseUrl.endsWith("/")?t.baseUrl:`${t.baseUrl}/`;this.client=n({baseUrl:s,auth:t.auth,fetchImpl:t.fetch}),this.accessDelegation=t.accessDelegation?.join(","),this.namespaceOps=new o(this.client,a),this.tableOps=new u(this.client,a,this.accessDelegation)}async listNamespaces(t){return this.namespaceOps.listNamespaces(t)}async createNamespace(t,a){return this.namespaceOps.createNamespace(t,a)}async dropNamespace(t){await this.namespaceOps.dropNamespace(t)}async loadNamespaceMetadata(t){return this.namespaceOps.loadNamespaceMetadata(t)}async listTables(t){return this.tableOps.listTables(t)}async createTable(t,a){return this.tableOps.createTable(t,a)}async updateTable(t,a){return this.tableOps.updateTable(t,a)}async dropTable(t,a){await this.tableOps.dropTable(t,a)}async loadTable(t){return this.tableOps.loadTable(t)}async namespaceExists(t){return this.namespaceOps.namespaceExists(t)}async tableExists(t){return this.tableOps.tableExists(t)}async createNamespaceIfNotExists(t,a){return this.namespaceOps.createNamespaceIfNotExists(t,a)}async createTableIfNotExists(t,a){return this.tableOps.createTableIfNotExists(t,a)}},h=/^decimal\s*\(\s*(\d+)\s*,\s*(\d+)\s*\)$/,b=/^fixed\s*\[\s*(\d+)\s*\]$/;function f(t){const a=t.match(h);return a?{precision:parseInt(a[1],10),scale:parseInt(a[2],10)}:null}function y(t){const a=t.match(b);return a?{length:parseInt(a[1],10)}:null}function T(t){return h.test(t)}function w(t){return b.test(t)}function x(t,a){const s=f(t),n=f(a);if(s&&n)return s.precision===n.precision&&s.scale===n.scale;const c=y(t),o=y(a);return c&&o?c.length===o.length:t===a}function O(t){return t.schemas.find(a=>a["schema-id"]===t["current-schema-id"])}},1176,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"navigatorLock",{enumerable:!0,get:function(){return l.navigatorLock}}),Object.defineProperty(_e,"NavigatorLockAcquireTimeoutError",{enumerable:!0,get:function(){return l.NavigatorLockAcquireTimeoutError}}),Object.defineProperty(_e,"lockInternals",{enumerable:!0,get:function(){return l.internals}}),Object.defineProperty(_e,"processLock",{enumerable:!0,get:function(){return l.processLock}}),Object.defineProperty(_e,"GoTrueAdminApi",{enumerable:!0,get:function(){return t.default}}),Object.defineProperty(_e,"GoTrueClient",{enumerable:!0,get:function(){return n.default}}),Object.defineProperty(_e,"AuthAdminApi",{enumerable:!0,get:function(){return o.default}}),Object.defineProperty(_e,"AuthClient",{enumerable:!0,get:function(){return u.default}});var t=e(r(d[0])),n=e(r(d[1])),o=e(r(d[2])),u=e(r(d[3])),c=r(d[4]);Object.keys(c).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return c[e]}})});var f=r(d[5]);Object.keys(f).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return f[e]}})});var l=r(d[6])},1177,[1178,1186,1193,1194,1185,1183,1188]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return u}});var t=r(d[0]),s=r(d[1]),n=r(d[2]),o=r(d[3]),h=r(d[4]);class u{constructor({url:t="",headers:s={},fetch:o,experimental:h}){this.url=t,this.headers=s,this.fetch=(0,n.resolveFetch)(o),this.experimental=null!=h?h:{},this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)},this.oauth={listClients:this._listOAuthClients.bind(this),createClient:this._createOAuthClient.bind(this),getClient:this._getOAuthClient.bind(this),updateClient:this._updateOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)},this.customProviders={listProviders:this._listCustomProviders.bind(this),createProvider:this._createCustomProvider.bind(this),getProvider:this._getCustomProvider.bind(this),updateProvider:this._updateCustomProvider.bind(this),deleteProvider:this._deleteCustomProvider.bind(this)},this.passkey={listPasskeys:this._adminListPasskeys.bind(this),deletePasskey:this._adminDeletePasskey.bind(this)}}async signOut(t,n=o.SIGN_OUT_SCOPES[0]){if(o.SIGN_OUT_SCOPES.indexOf(n)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${o.SIGN_OUT_SCOPES.join(', ')}`);try{return await(0,s._request)(this.fetch,'POST',`${this.url}/logout?scope=${n}`,{headers:this.headers,jwt:t,noResolveJson:!0}),{data:null,error:null}}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async inviteUserByEmail(t,n={}){try{return await(0,s._request)(this.fetch,'POST',`${this.url}/invite`,{body:{email:t,data:n.data},headers:this.headers,redirectTo:n.redirectTo,xform:s._userResponse})}catch(t){if((0,h.isAuthError)(t))return{data:{user:null},error:t};throw t}}async generateLink(n){try{const{options:o}=n,h=(0,t.__rest)(n,["options"]),u=Object.assign(Object.assign({},h),o);return'newEmail'in h&&(u.new_email=null==h?void 0:h.newEmail,delete u.newEmail),await(0,s._request)(this.fetch,'POST',`${this.url}/admin/generate_link`,{body:u,headers:this.headers,xform:s._generateLinkResponse,redirectTo:null==o?void 0:o.redirectTo})}catch(t){if((0,h.isAuthError)(t))return{data:{properties:null,user:null},error:t};throw t}}async createUser(t){try{return await(0,s._request)(this.fetch,'POST',`${this.url}/admin/users`,{body:t,headers:this.headers,xform:s._userResponse})}catch(t){if((0,h.isAuthError)(t))return{data:{user:null},error:t};throw t}}async listUsers(t){var n,o,u,l,c,f,_;try{const h={nextPage:null,lastPage:0,total:0},y=await(0,s._request)(this.fetch,'GET',`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:null!==(o=null===(n=null==t?void 0:t.page)||void 0===n?void 0:n.toString())&&void 0!==o?o:'',per_page:null!==(l=null===(u=null==t?void 0:t.perPage)||void 0===u?void 0:u.toString())&&void 0!==l?l:''},xform:s._noResolveJsonResponse});if(y.error)throw y.error;const v=await y.json(),p=null!==(c=y.headers.get('x-total-count'))&&void 0!==c?c:0,E=null!==(_=null===(f=y.headers.get('link'))||void 0===f?void 0:f.split(','))&&void 0!==_?_:[];return E.length>0&&(E.forEach(t=>{const s=parseInt(t.split(';')[0].split('=')[1].substring(0,1)),n=JSON.parse(t.split(';')[1].split('=')[1]);h[`${n}Page`]=s}),h.total=parseInt(p)),{data:Object.assign(Object.assign({},v),h),error:null}}catch(t){if((0,h.isAuthError)(t))return{data:{users:[]},error:t};throw t}}async getUserById(t){(0,n.validateUUID)(t);try{return await(0,s._request)(this.fetch,'GET',`${this.url}/admin/users/${t}`,{headers:this.headers,xform:s._userResponse})}catch(t){if((0,h.isAuthError)(t))return{data:{user:null},error:t};throw t}}async updateUserById(t,o){(0,n.validateUUID)(t);try{return await(0,s._request)(this.fetch,'PUT',`${this.url}/admin/users/${t}`,{body:o,headers:this.headers,xform:s._userResponse})}catch(t){if((0,h.isAuthError)(t))return{data:{user:null},error:t};throw t}}async deleteUser(t,o=!1){(0,n.validateUUID)(t);try{return await(0,s._request)(this.fetch,'DELETE',`${this.url}/admin/users/${t}`,{headers:this.headers,body:{should_soft_delete:o},xform:s._userResponse})}catch(t){if((0,h.isAuthError)(t))return{data:{user:null},error:t};throw t}}async _listFactors(t){(0,n.validateUUID)(t.userId);try{const{data:n,error:o}=await(0,s._request)(this.fetch,'GET',`${this.url}/admin/users/${t.userId}/factors`,{headers:this.headers,xform:t=>({data:{factors:t},error:null})});return{data:n,error:o}}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _deleteFactor(t){(0,n.validateUUID)(t.userId),(0,n.validateUUID)(t.id);try{return{data:await(0,s._request)(this.fetch,'DELETE',`${this.url}/admin/users/${t.userId}/factors/${t.id}`,{headers:this.headers}),error:null}}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _listOAuthClients(t){var n,o,u,l,c,f,_;try{const h={nextPage:null,lastPage:0,total:0},y=await(0,s._request)(this.fetch,'GET',`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:null!==(o=null===(n=null==t?void 0:t.page)||void 0===n?void 0:n.toString())&&void 0!==o?o:'',per_page:null!==(l=null===(u=null==t?void 0:t.perPage)||void 0===u?void 0:u.toString())&&void 0!==l?l:''},xform:s._noResolveJsonResponse});if(y.error)throw y.error;const v=await y.json(),p=null!==(c=y.headers.get('x-total-count'))&&void 0!==c?c:0,E=null!==(_=null===(f=y.headers.get('link'))||void 0===f?void 0:f.split(','))&&void 0!==_?_:[];return E.length>0&&(E.forEach(t=>{const s=parseInt(t.split(';')[0].split('=')[1].substring(0,1)),n=JSON.parse(t.split(';')[1].split('=')[1]);h[`${n}Page`]=s}),h.total=parseInt(p)),{data:Object.assign(Object.assign({},v),h),error:null}}catch(t){if((0,h.isAuthError)(t))return{data:{clients:[]},error:t};throw t}}async _createOAuthClient(t){try{return await(0,s._request)(this.fetch,'POST',`${this.url}/admin/oauth/clients`,{body:t,headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _getOAuthClient(t){try{return await(0,s._request)(this.fetch,'GET',`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _updateOAuthClient(t,n){try{return await(0,s._request)(this.fetch,'PUT',`${this.url}/admin/oauth/clients/${t}`,{body:n,headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _deleteOAuthClient(t){try{return await(0,s._request)(this.fetch,'DELETE',`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _regenerateOAuthClientSecret(t){try{return await(0,s._request)(this.fetch,'POST',`${this.url}/admin/oauth/clients/${t}/regenerate_secret`,{headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _listCustomProviders(t){try{const n={};return(null==t?void 0:t.type)&&(n.type=t.type),await(0,s._request)(this.fetch,'GET',`${this.url}/admin/custom-providers`,{headers:this.headers,query:n,xform:t=>{var s;return{data:{providers:null!==(s=null==t?void 0:t.providers)&&void 0!==s?s:[]},error:null}}})}catch(t){if((0,h.isAuthError)(t))return{data:{providers:[]},error:t};throw t}}async _createCustomProvider(t){try{return await(0,s._request)(this.fetch,'POST',`${this.url}/admin/custom-providers`,{body:t,headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _getCustomProvider(t){try{return await(0,s._request)(this.fetch,'GET',`${this.url}/admin/custom-providers/${t}`,{headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _updateCustomProvider(t,n){try{return await(0,s._request)(this.fetch,'PUT',`${this.url}/admin/custom-providers/${t}`,{body:n,headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _deleteCustomProvider(t){try{return await(0,s._request)(this.fetch,'DELETE',`${this.url}/admin/custom-providers/${t}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _adminListPasskeys(t){(0,n.assertPasskeyExperimentalEnabled)(this.experimental),(0,n.validateUUID)(t.userId);try{return await(0,s._request)(this.fetch,'GET',`${this.url}/admin/users/${t.userId}/passkeys`,{headers:this.headers,xform:t=>({data:t,error:null})})}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}async _adminDeletePasskey(t){(0,n.assertPasskeyExperimentalEnabled)(this.experimental),(0,n.validateUUID)(t.userId),(0,n.validateUUID)(t.passkeyId);try{return await(0,s._request)(this.fetch,'DELETE',`${this.url}/admin/users/${t.userId}/passkeys/${t.passkeyId}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(t){if((0,h.isAuthError)(t))return{data:null,error:t};throw t}}}},1178,[1156,1179,1182,1185,1183]); +__d(function(g,r,_i,_a2,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.handleError=i,_e._request=async function(e,o,t,n){var a;const i=Object.assign({},null==n?void 0:n.headers);i[s.API_VERSION_HEADER_NAME]||(i[s.API_VERSION_HEADER_NAME]=s.API_VERSIONS['2024-01-01'].name);(null==n?void 0:n.jwt)&&(i.Authorization=`Bearer ${n.jwt}`);const u=null!==(a=null==n?void 0:n.query)&&void 0!==a?a:{};(null==n?void 0:n.redirectTo)&&(u.redirect_to=n.redirectTo);const l=Object.keys(u).length?'?'+new URLSearchParams(u).toString():'',_=await c(e,o,t+l,{headers:i,noResolveJson:null==n?void 0:n.noResolveJson},{},null==n?void 0:n.body);return(null==n?void 0:n.xform)?null==n?void 0:n.xform(_):{data:Object.assign({},_),error:null}},_e._sessionResponse=l,_e._sessionResponsePassword=function(e){const s=l(e);!s.error&&e.weak_password&&'object'==typeof e.weak_password&&Array.isArray(e.weak_password.reasons)&&e.weak_password.reasons.length&&e.weak_password.message&&'string'==typeof e.weak_password.message&&e.weak_password.reasons.reduce((e,s)=>e&&'string'==typeof s,!0)&&(s.data.weak_password=e.weak_password);return s},_e._userResponse=function(e){var s;return{data:{user:null!==(s=e.user)&&void 0!==s?s:e},error:null}},_e._ssoResponse=function(e){return{data:e,error:null}},_e._generateLinkResponse=function(s){const{action_link:o,email_otp:t,hashed_token:n,redirect_to:a,verification_type:i}=s,u=(0,e.__rest)(s,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),c={action_link:o,email_otp:t,hashed_token:n,redirect_to:a,verification_type:i},l=Object.assign({},u);return{data:{properties:c,user:l},error:null}},_e._noResolveJsonResponse=function(e){return e};var e=r(d[0]),s=r(d[1]),o=r(d[2]),t=r(d[3]);const n=e=>{if('object'==typeof e&&null!==e){const s=e;if('string'==typeof s.msg)return s.msg;if('string'==typeof s.message)return s.message;if('string'==typeof s.error_description)return s.error_description;if('string'==typeof s.error)return s.error}return JSON.stringify(e)},a=[500,501,502,503,504,520,521,522,523,524,525,526,527,528,529,530];async function i(e){var i;if(!(0,o.looksLikeFetchResponse)(e))throw new t.AuthRetryableFetchError(n(e),0);if(a.includes(e.status))throw new t.AuthRetryableFetchError(n(e),e.status);let u,c;try{u=await e.json()}catch(e){throw new t.AuthUnknownError(n(e),e)}const l=(0,o.parseResponseAPIVersion)(e);if(l&&l.getTime()>=s.API_VERSIONS['2024-01-01'].timestamp&&'object'==typeof u&&u&&'string'==typeof u.code?c=u.code:'object'==typeof u&&u&&'string'==typeof u.error_code&&(c=u.error_code),c){if('weak_password'===c)throw new t.AuthWeakPasswordError(n(u),e.status,(null===(i=u.weak_password)||void 0===i?void 0:i.reasons)||[]);if('session_not_found'===c)throw new t.AuthSessionMissingError}else if('object'==typeof u&&u&&'object'==typeof u.weak_password&&u.weak_password&&Array.isArray(u.weak_password.reasons)&&u.weak_password.reasons.length&&u.weak_password.reasons.reduce((e,s)=>e&&'string'==typeof s,!0))throw new t.AuthWeakPasswordError(n(u),e.status,u.weak_password.reasons);throw new t.AuthApiError(n(u),e.status||500,c)}const u=(e,s,o,t)=>{const n={method:e,headers:(null==s?void 0:s.headers)||{}};return'GET'===e?n:(n.headers=Object.assign({'Content-Type':'application/json;charset=UTF-8'},null==s?void 0:s.headers),n.body=JSON.stringify(t),Object.assign(Object.assign({},n),o))};async function c(e,s,o,a,c,l){const _=u(s,a,c,l);let p;try{p=await e(o,Object.assign({},_))}catch(e){throw console.error(e),new t.AuthRetryableFetchError(n(e),0)}if(p.ok||await i(p),null==a?void 0:a.noResolveJson)return p;try{return await p.json()}catch(e){await i(e)}}function l(e){var s;let t=null;_(e)&&(t=Object.assign({},e),e.expires_at||(t.expires_at=(0,o.expiresAt)(e.expires_in)));return{data:{session:t,user:null!==(s=e.user)&&void 0!==s?s:'string'==typeof(null==e?void 0:e.id)?e:null},error:null}}function _(e){return!!e.access_token&&!!e.refresh_token&&!!e.expires_in}},1179,[1156,1180,1182,1183]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"AUTO_REFRESH_TICK_DURATION_MS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"AUTO_REFRESH_TICK_THRESHOLD",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"EXPIRY_MARGIN_MS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"REFRESH_FAILURE_COOLDOWN_MS",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"GOTRUE_URL",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"STORAGE_KEY",{enumerable:!0,get:function(){return _}}),Object.defineProperty(e,"AUDIENCE",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"DEFAULT_HEADERS",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"NETWORK_FAILURE",{enumerable:!0,get:function(){return R}}),Object.defineProperty(e,"API_VERSION_HEADER_NAME",{enumerable:!0,get:function(){return O}}),Object.defineProperty(e,"API_VERSIONS",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"BASE64URL_REGEX",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"JWKS_TTL",{enumerable:!0,get:function(){return A}});var t=r(d[0]);const n=3e4,u=3,o=9e4,c=6e4,E='http://localhost:9999',_='supabase.auth.token',b='',f={'X-Client-Info':`gotrue-js/${t.version}`},R={MAX_RETRIES:10,RETRY_INTERVAL:2},O='X-Supabase-Api-Version',p={'2024-01-01':{timestamp:Date.parse('2024-01-01T00:00:00.0Z'),name:'2024-01-01'}},l=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,A=6e5},1180,[1181]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"version",{enumerable:!0,get:function(){return t}});const t='2.109.0'},1181,[]); +__d(function(g,r,_i,a,m,_e2,d){"use strict";Object.defineProperty(_e2,'__esModule',{value:!0}),_e2.expiresAt=function(e){return Math.round(Date.now()/1e3)+e},_e2.generateCallbackId=function(){return Symbol('auth-callback')},Object.defineProperty(_e2,"isBrowser",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e2,"supportsLocalStorage",{enumerable:!0,get:function(){return i}}),_e2.parseParametersFromURL=function(e){const t={},n=new URL(e);if(n.hash&&'#'===n.hash[0])try{new URLSearchParams(n.hash.substring(1)).forEach((e,n)=>{t[n]=e})}catch(e){}return n.searchParams.forEach((e,n)=>{t[n]=e}),t},Object.defineProperty(_e2,"resolveFetch",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e2,"looksLikeFetchResponse",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e2,"setItemAsync",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e2,"getItemAsync",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e2,"removeItemAsync",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e2,"Deferred",{enumerable:!0,get:function(){return p}}),_e2.decodeJWT=function(o){const s=o.split('.');if(3!==s.length)throw new t.AuthInvalidJwtError('Invalid JWT structure');for(let n=0;n{setTimeout(()=>t(null),e)})},_e2.retryable=function(e,t){return new Promise((n,o)=>{(async()=>{for(let s=0;s<1/0;s++)try{const o=await e(s);if(!t(s,null,o))return void n(o)}catch(e){if(!t(s,e))return void o(e)}})()})},_e2.generatePKCEVerifier=b,_e2.generatePKCEChallenge=S,_e2.getCodeChallengeAndMethod=async function(e,t,n=!1){const o=b();let s=o;n&&(s+='/recovery');await l(e,`${t}-code-verifier`,s);const i=await S(o);return[i,o===i?'plain':'s256']},_e2.parseResponseAPIVersion=function(t){const n=t.headers.get(e.API_VERSION_HEADER_NAME);if(!n)return null;if(!n.match(P))return null;try{return new Date(`${n}T00:00:00.0Z`)}catch(e){return null}},_e2.validateExp=function(e){if(!e)throw new Error('Missing exp claim');const t=Math.floor(Date.now()/1e3);if(e<=t)throw new Error('JWT has expired')},_e2.getAlgorithm=function(e){switch(e){case'RS256':return{name:'RSASSA-PKCS1-v1_5',hash:{name:'SHA-256'}};case'ES256':return{name:'ECDSA',namedCurve:'P-256',hash:{name:'SHA-256'}};default:throw new Error('Invalid alg claim')}},_e2.validateUUID=function(e){if(!A.test(e))throw new Error('@supabase/auth-js: Expected parameter to be UUID but is not')},_e2.assertPasskeyExperimentalEnabled=function(e){if(!e.passkey)throw new Error('@supabase/auth-js: the passkey API is experimental and disabled by default. Enable it by passing `auth: { experimental: { passkey: true } }` to createClient (or to the GoTrueClient constructor).')},_e2.userNotAvailableProxy=function(){return new Proxy({},{get:(e,t)=>{if('__isUserNotAvailableProxy'===t)return!0;if('symbol'==typeof t){const e=t.toString();if('Symbol(Symbol.toPrimitive)'===e||'Symbol(Symbol.toStringTag)'===e||'Symbol(util.inspect.custom)'===e)return}throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${t}" property of the session object is not supported. Please use getUser() instead.`)},set:(e,t)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${t}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(e,t)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${t}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})},_e2.insecureUserWarningProxy=function(e,t){return new Proxy(e,{get:(e,n,o)=>{if('__isInsecureUserWarningProxy'===n)return!0;if('symbol'==typeof n){const t=n.toString();if('Symbol(Symbol.toPrimitive)'===t||'Symbol(Symbol.toStringTag)'===t||'Symbol(util.inspect.custom)'===t||'Symbol(nodejs.util.inspect.custom)'===t)return Reflect.get(e,n,o)}return t.value||'string'!=typeof n||(console.warn('Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server.'),t.value=!0),Reflect.get(e,n,o)}})},_e2.deepClone=function(e){return JSON.parse(JSON.stringify(e))};var e=r(d[0]),t=r(d[1]),n=r(d[2]);const o=()=>'undefined'!=typeof window&&'undefined'!=typeof document,s={tested:!1,writable:!1},i=()=>{if(!o())return!1;try{if('object'!=typeof globalThis.localStorage)return!1}catch(e){return!1}if(s.tested)return s.writable;const e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),s.tested=!0,s.writable=!0}catch(e){s.tested=!0,s.writable=!1}return s.writable};const u=e=>e?(...t)=>e(...t):(...e)=>fetch(...e),c=e=>'object'==typeof e&&null!==e&&'status'in e&&'ok'in e&&'json'in e&&'function'==typeof e.json,l=async(e,t,n)=>{await e.setItem(t,JSON.stringify(n))},f=async(e,t)=>{const n=await e.getItem(t);if(!n)return null;try{return JSON.parse(n)}catch(e){return null}},h=async(e,t)=>{await e.removeItem(t)};class p{constructor(){this.promise=new p.promiseConstructor((e,t)=>{this.resolve=e,this.reject=t})}}function y(e){return('0'+e.toString(16)).substr(-2)}function b(){const e=new Uint32Array(56);if('undefined'==typeof crypto){const e='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~',t=e.length;let n='';for(let o=0;o<56;o++)n+=e.charAt(Math.floor(Math.random()*t));return n}return crypto.getRandomValues(e),Array.from(e,y).join('')}async function w(e){const t=(new TextEncoder).encode(e),n=await crypto.subtle.digest('SHA-256',t),o=new Uint8Array(n);return Array.from(o).map(e=>String.fromCharCode(e)).join('')}async function S(e){if(!('undefined'!=typeof crypto&&void 0!==crypto.subtle&&'undefined'!=typeof TextEncoder))return console.warn('WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256.'),e;const t=await w(e);return btoa(t).replace(/\+/g,'-').replace(/\//g,'_').replace(/=+$/,'')}p.promiseConstructor=Promise;const P=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;const A=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/},1182,[1180,1183,1184]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"AuthError",{enumerable:!0,get:function(){return t}}),e.isAuthError=s,Object.defineProperty(e,"AuthApiError",{enumerable:!0,get:function(){return n}}),e.isAuthApiError=function(t){return s(t)&&'AuthApiError'===t.name},Object.defineProperty(e,"AuthUnknownError",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"CustomAuthError",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"AuthSessionMissingError",{enumerable:!0,get:function(){return c}}),e.isAuthSessionMissingError=function(t){return s(t)&&'AuthSessionMissingError'===t.name},Object.defineProperty(e,"AuthInvalidTokenResponseError",{enumerable:!0,get:function(){return h}}),Object.defineProperty(e,"AuthInvalidCredentialsError",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"AuthImplicitGrantRedirectError",{enumerable:!0,get:function(){return f}}),e.isAuthImplicitGrantRedirectError=function(t){return s(t)&&'AuthImplicitGrantRedirectError'===t.name},Object.defineProperty(e,"AuthPKCEGrantCodeExchangeError",{enumerable:!0,get:function(){return E}}),Object.defineProperty(e,"AuthPKCECodeVerifierMissingError",{enumerable:!0,get:function(){return A}}),e.isAuthPKCECodeVerifierMissingError=function(t){return s(t)&&'AuthPKCECodeVerifierMissingError'===t.name},Object.defineProperty(e,"AuthRetryableFetchError",{enumerable:!0,get:function(){return p}}),e.isAuthRetryableFetchError=function(t){return s(t)&&'AuthRetryableFetchError'===t.name},Object.defineProperty(e,"AuthRefreshDiscardedError",{enumerable:!0,get:function(){return b}}),e.isAuthRefreshDiscardedError=function(t){return s(t)&&'AuthRefreshDiscardedError'===t.name},Object.defineProperty(e,"AuthWeakPasswordError",{enumerable:!0,get:function(){return O}}),e.isAuthWeakPasswordError=function(t){return s(t)&&'AuthWeakPasswordError'===t.name},Object.defineProperty(e,"AuthInvalidJwtError",{enumerable:!0,get:function(){return P}});class t extends Error{constructor(t,s,n){super(t),this.__isAuthError=!0,this.name='AuthError',this.status=s,this.code=n}toJSON(){return{name:this.name,message:this.message,status:this.status,code:this.code}}}function s(t){return'object'==typeof t&&null!==t&&'__isAuthError'in t}class n extends t{constructor(t,s,n){super(t,s,n),this.name='AuthApiError',this.status=s,this.code=n}}class o extends t{constructor(t,s){super(t),this.name='AuthUnknownError',this.originalError=s}}class u extends t{constructor(t,s,n,o){super(t,n,o),this.name=s,this.status=n}}class c extends u{constructor(){super('Auth session missing!','AuthSessionMissingError',400,void 0)}}class h extends u{constructor(){super('Auth session or user missing','AuthInvalidTokenResponseError',500,void 0)}}class l extends u{constructor(t){super(t,'AuthInvalidCredentialsError',400,void 0)}}class f extends u{constructor(t,s=null){super(t,'AuthImplicitGrantRedirectError',500,void 0),this.details=null,this.details=s}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}class E extends u{constructor(t,s=null){super(t,'AuthPKCEGrantCodeExchangeError',500,void 0),this.details=null,this.details=s}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}class A extends u{constructor(){super("PKCE code verifier not found in storage. This can happen if the auth flow was initiated in a different browser or device, or if the storage was cleared. For SSR frameworks (Next.js, SvelteKit, etc.), use @supabase/ssr on both the server and client to store the code verifier in cookies.",'AuthPKCECodeVerifierMissingError',400,'pkce_code_verifier_not_found')}}class p extends u{constructor(t,s){super(t,'AuthRetryableFetchError',s,void 0)}}class b extends u{constructor(t="Refresh result discarded: session state changed mid-flight (e.g., concurrent signOut)"){super(t,'AuthRefreshDiscardedError',409,void 0)}}class O extends u{constructor(t,s,n){super(t,'AuthWeakPasswordError',s,'weak_password'),this.reasons=n}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{reasons:this.reasons})}}class P extends u{constructor(t){super(t,'AuthInvalidJwtError',400,'invalid_jwt')}}},1183,[]); +__d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.byteToBase64URL=o,e.byteFromBase64URL=i,e.stringToBase64URL=function(t){const u=[],n=t=>{u.push(t)},i={queue:0,queuedBits:0};return f(t,t=>{o(t,i,n)}),o(null,i,n),u.join('')},e.stringFromBase64URL=function(t){const u=[],n=t=>{u.push(String.fromCodePoint(t))},o={utf8seq:0,codepoint:0},s={queue:0,queuedBits:0},f=t=>{c(t,o,n)};for(let u=0;u{u.push(t)};for(let u=0;uu.push(t)),new Uint8Array(u)},e.bytesToBase64URL=function(t){const u=[],n={queue:0,queuedBits:0},i=t=>{u.push(t)};return t.forEach(t=>o(t,n,i)),o(null,n,i),u.join('')};const t='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_'.split(''),u=' \t\n\r='.split(''),n=(()=>{const n=new Array(128);for(let t=0;t=6;){const u=n.queue>>n.queuedBits-6&63;o(t[u]),n.queuedBits-=6}else if(n.queuedBits>0)for(n.queue=n.queue<<6-n.queuedBits,n.queuedBits=6;n.queuedBits>=6;){const u=n.queue>>n.queuedBits-6&63;o(t[u]),n.queuedBits-=6}}function i(t,u,o){const i=n[t];if(!(i>-1)){if(-2===i)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(t)}"`)}for(u.queue=u.queue<<6|i,u.queuedBits+=6;u.queuedBits>=8;)o(u.queue>>u.queuedBits-8&255),u.queuedBits-=8}function s(t,u){if(!(t<=127)){if(t<=2047)return u(192|t>>6),void u(128|63&t);if(t<=65535)return u(224|t>>12),u(128|t>>6&63),void u(128|63&t);if(t<=1114111)return u(240|t>>18),u(128|t>>12&63),u(128|t>>6&63),void u(128|63&t);throw new Error(`Unrecognized Unicode codepoint: ${t.toString(16)}`)}u(t)}function f(t,u){for(let n=0;n55295&&o<=56319){const u=1024*(o-55296)&65535;o=65536+(t.charCodeAt(n+1)-56320&65535|u),n+=1}s(o,u)}}function c(t,u,n){if(0===u.utf8seq){if(t<=127)return void n(t);for(let n=1;n<6;n+=1)if(!(t>>7-n&1)){u.utf8seq=n;break}if(2===u.utf8seq)u.codepoint=31&t;else if(3===u.utf8seq)u.codepoint=15&t;else{if(4!==u.utf8seq)throw new Error('Invalid UTF-8 sequence');u.codepoint=7&t}u.utf8seq-=1}else if(u.utf8seq>0){if(t<=127)throw new Error('Invalid UTF-8 sequence');u.codepoint=u.codepoint<<6|63&t,u.utf8seq-=1,0===u.utf8seq&&n(u.codepoint)}}},1184,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"SIGN_OUT_SCOPES",{enumerable:!0,get:function(){return t}});const t=['global','local','others']},1185,[]); +__d(function(e,t,s,r,i,n,a){"use strict";Object.defineProperty(n,'__esModule',{value:!0}),Object.defineProperty(n,"default",{enumerable:!0,get:function(){return A}});var o,l=t(a[0]),u=(o=l)&&o.__esModule?o:{default:o},h=t(a[1]),c=t(a[2]),d=t(a[3]),_=t(a[4]),g=t(a[5]),w=t(a[6]),y=t(a[7]),f=t(a[8]),p=t(a[9]),v=t(a[10]),b=t(a[11]);(0,y.polyfillGlobalThis)();const k={url:h.GOTRUE_URL,storageKey:h.STORAGE_KEY,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:h.DEFAULT_HEADERS,flowType:'implicit',debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:5e3,skipAutoInitialize:!1,experimental:{}},m={};class R{get jwks(){var e,t;return null!==(t=null===(e=m[this.storageKey])||void 0===e?void 0:e.jwks)&&void 0!==t?t:{keys:[]}}set jwks(e){m[this.storageKey]=Object.assign(Object.assign({},m[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,t;return null!==(t=null===(e=m[this.storageKey])||void 0===e?void 0:e.cachedAt)&&void 0!==t?t:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){m[this.storageKey]=Object.assign(Object.assign({},m[this.storageKey]),{cachedAt:e})}constructor(e){var t,s,r;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.autoRefreshTickTimeout=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.lastRefreshFailure=null,this._sessionRemovalEpoch=0,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lock=null,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log;const i=Object.assign(Object.assign({},k),e);if(this.storageKey=i.storageKey,this.instanceID=null!==(t=R.nextInstanceID[this.storageKey])&&void 0!==t?t:0,R.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!i.debug,'function'==typeof i.debug&&(this.logger=i.debug),this.instanceID>0&&(0,_.isBrowser)()){const e=`${this._logPrefix()} Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.`;console.warn(e),this.logDebugMessages&&console.trace(e)}if(this.persistSession=i.persistSession,this.autoRefreshToken=i.autoRefreshToken,this.experimental=null!==(s=i.experimental)&&void 0!==s?s:{},this.admin=new u.default({url:i.url,headers:i.headers,fetch:i.fetch,experimental:this.experimental}),this.url=i.url,this.headers=i.headers,this.fetch=(0,_.resolveFetch)(i.fetch),this.detectSessionInUrl=i.detectSessionInUrl,this.flowType=i.flowType,this.hasCustomAuthorizationHeader=i.hasCustomAuthorizationHeader,this.throwOnError=i.throwOnError,this.lockAcquireTimeout=i.lockAcquireTimeout,null!=i.lock&&(this.lock=i.lock),this.jwks||(this.jwks={keys:[]},this.jwks_cached_at=Number.MIN_SAFE_INTEGER),this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this),webauthn:new b.WebAuthnApi(this)},this.oauth={getAuthorizationDetails:this._getAuthorizationDetails.bind(this),approveAuthorization:this._approveAuthorization.bind(this),denyAuthorization:this._denyAuthorization.bind(this),listGrants:this._listOAuthGrants.bind(this),revokeGrant:this._revokeOAuthGrant.bind(this)},this.passkey={startRegistration:this._startPasskeyRegistration.bind(this),verifyRegistration:this._verifyPasskeyRegistration.bind(this),startAuthentication:this._startPasskeyAuthentication.bind(this),verifyAuthentication:this._verifyPasskeyAuthentication.bind(this),list:this._listPasskeys.bind(this),update:this._updatePasskey.bind(this),delete:this._deletePasskey.bind(this)},this.persistSession?(i.storage?this.storage=i.storage:(0,_.supportsLocalStorage)()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=(0,g.memoryLocalStorageAdapter)(this.memoryStorage)),i.userStorage&&(this.userStorage=i.userStorage)):(this.memoryStorage={},this.storage=(0,g.memoryLocalStorageAdapter)(this.memoryStorage)),(0,_.isBrowser)()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(e){console.error('Failed to create a new BroadcastChannel, multi-tab state changes will not be available',e)}null===(r=this.broadcastChannel)||void 0===r||r.addEventListener('message',async e=>{this._debug('received broadcast notification from other tab or client',e),'TOKEN_REFRESHED'!==e.data.event&&'SIGNED_IN'!==e.data.event||(this.lastRefreshFailure=null);try{await this._notifyAllSubscribers(e.data.event,e.data.session,!1)}catch(e){this._debug('#broadcastChannel','error',e)}})}i.skipAutoInitialize||this.initialize().catch(e=>{this._debug('#initialize()','error',e)})}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(e){if(this.throwOnError&&e&&e.error)throw e.error;return e}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${f.version}) ${(new Date).toISOString()}`}_debug(...e){return this.logDebugMessages&&this.logger(this._logPrefix(),...e),this}async initialize(){return this.initializePromise||(this.initializePromise=(async()=>null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._initialize()):await this._initialize())()),await this.initializePromise}async _initialize(){var e;try{let t={},s='none';if((0,_.isBrowser)()&&(t=(0,_.parseParametersFromURL)(window.location.href),this._isImplicitGrantCallback(t)?s='implicit':await this._isPKCECallback(t)&&(s='pkce')),(0,_.isBrowser)()&&this.detectSessionInUrl&&'none'!==s){const{data:r,error:i}=await this._getSessionFromURL(t,s);if(i){if(this._debug('#_initialize()','error detecting session from URL',i),(0,c.isAuthImplicitGrantRedirectError)(i)){const t=null===(e=i.details)||void 0===e?void 0:e.code;if('identity_already_exists'===t||'identity_not_found'===t||'single_identity_not_deletable'===t)return{error:i}}return{error:i}}const{session:n,redirectType:a}=r;return this._debug('#_initialize()','detected session in URL',n,'redirect type',a),await this._saveSession(n),setTimeout(async()=>{'recovery'===a?await this._notifyAllSubscribers('PASSWORD_RECOVERY',n):await this._notifyAllSubscribers('SIGNED_IN',n)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(e){return(0,c.isAuthError)(e)?this._returnResult({error:e}):this._returnResult({error:new c.AuthUnknownError('Unexpected error during initialization',e)})}finally{await this._handleVisibilityChange(),this._debug('#_initialize()','end')}}async signInAnonymously(e){var t,s,r;try{const i=await(0,d._request)(this.fetch,'POST',`${this.url}/signup`,{headers:this.headers,body:{data:null!==(s=null===(t=null==e?void 0:e.options)||void 0===t?void 0:t.data)&&void 0!==s?s:{},gotrue_meta_security:{captcha_token:null===(r=null==e?void 0:e.options)||void 0===r?void 0:r.captchaToken}},xform:d._sessionResponse}),{data:n,error:a}=i;if(a||!n)return this._returnResult({data:{user:null,session:null},error:a});const o=n.session,l=n.user;return n.session&&(await this._saveSession(n.session),await this._notifyAllSubscribers('SIGNED_IN',o)),this._returnResult({data:{user:l,session:o},error:null})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signUp(e){var t,s,r;try{let i;if('email'in e){const{email:s,password:r,options:n}=e;let a=null,o=null;'pkce'===this.flowType&&([a,o]=await(0,_.getCodeChallengeAndMethod)(this.storage,this.storageKey)),i=await(0,d._request)(this.fetch,'POST',`${this.url}/signup`,{headers:this.headers,redirectTo:null==n?void 0:n.emailRedirectTo,body:{email:s,password:r,data:null!==(t=null==n?void 0:n.data)&&void 0!==t?t:{},gotrue_meta_security:{captcha_token:null==n?void 0:n.captchaToken},code_challenge:a,code_challenge_method:o},xform:d._sessionResponse})}else{if(!('phone'in e))throw new c.AuthInvalidCredentialsError('You must provide either an email or phone number and a password');{const{phone:t,password:n,options:a}=e;i=await(0,d._request)(this.fetch,'POST',`${this.url}/signup`,{headers:this.headers,body:{phone:t,password:n,data:null!==(s=null==a?void 0:a.data)&&void 0!==s?s:{},channel:null!==(r=null==a?void 0:a.channel)&&void 0!==r?r:'sms',gotrue_meta_security:{captcha_token:null==a?void 0:a.captchaToken}},xform:d._sessionResponse})}}const{data:n,error:a}=i;if(a||!n)return await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:a});const o=n.session,l=n.user;return n.session&&(await this._saveSession(n.session),await this._notifyAllSubscribers('SIGNED_IN',o)),this._returnResult({data:{user:l,session:o},error:null})}catch(e){if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),(0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signInWithPassword(e){try{let t;if('email'in e){const{email:s,password:r,options:i}=e;t=await(0,d._request)(this.fetch,'POST',`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:s,password:r,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken}},xform:d._sessionResponsePassword})}else{if(!('phone'in e))throw new c.AuthInvalidCredentialsError('You must provide either an email or phone number and a password');{const{phone:s,password:r,options:i}=e;t=await(0,d._request)(this.fetch,'POST',`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:s,password:r,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken}},xform:d._sessionResponsePassword})}}const{data:s,error:r}=t;if(r)return this._returnResult({data:{user:null,session:null},error:r});if(!s||!s.session||!s.user){const e=new c.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null},error:e})}return s.session&&(await this._saveSession(s.session),await this._notifyAllSubscribers('SIGNED_IN',s.session)),this._returnResult({data:Object.assign({user:s.user,session:s.session},s.weak_password?{weakPassword:s.weak_password}:null),error:r})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signInWithOAuth(e){var t,s,r,i;return await this._handleProviderSignIn(e.provider,{redirectTo:null===(t=e.options)||void 0===t?void 0:t.redirectTo,scopes:null===(s=e.options)||void 0===s?void 0:s.scopes,queryParams:null===(r=e.options)||void 0===r?void 0:r.queryParams,skipBrowserRedirect:null===(i=e.options)||void 0===i?void 0:i.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,null!=this.lock?this._acquireLock(this.lockAcquireTimeout,async()=>this._exchangeCodeForSession(e)):this._exchangeCodeForSession(e)}async signInWithWeb3(e){const{chain:t}=e;switch(t){case'ethereum':return await this.signInWithEthereum(e);case'solana':return await this.signInWithSolana(e);default:throw new Error(`@supabase/auth-js: Unsupported chain "${t}"`)}}async signInWithEthereum(e){var t,s,r,i,n,a,o,l,u,h,g;let w,y;if('message'in e)w=e.message,y=e.signature;else{const{chain:h,wallet:c,statement:d,options:g}=e;let f;if((0,_.isBrowser)())if('object'==typeof c)f=c;else{const e=window;if(!('ethereum'in e)||'object'!=typeof e.ethereum||!('request'in e.ethereum)||'function'!=typeof e.ethereum.request)throw new Error("@supabase/auth-js: No compatible Ethereum wallet interface on the window object (window.ethereum) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'ethereum', wallet: resolvedUserWallet }) instead.");f=e.ethereum}else{if('object'!=typeof c||!(null==g?void 0:g.url))throw new Error('@supabase/auth-js: Both wallet and url must be specified in non-browser environments.');f=c}const p=new URL(null!==(t=null==g?void 0:g.url)&&void 0!==t?t:window.location.href),b=await f.request({method:'eth_requestAccounts'}).then(e=>e).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!b||0===b.length)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const k=(0,v.getAddress)(b[0]);let m=null===(s=null==g?void 0:g.signInWithEthereum)||void 0===s?void 0:s.chainId;if(!m){const e=await f.request({method:'eth_chainId'});m=(0,v.fromHex)(e)}const R={domain:p.host,address:k,statement:d,uri:p.href,version:'1',chainId:m,nonce:null===(r=null==g?void 0:g.signInWithEthereum)||void 0===r?void 0:r.nonce,issuedAt:null!==(n=null===(i=null==g?void 0:g.signInWithEthereum)||void 0===i?void 0:i.issuedAt)&&void 0!==n?n:new Date,expirationTime:null===(a=null==g?void 0:g.signInWithEthereum)||void 0===a?void 0:a.expirationTime,notBefore:null===(o=null==g?void 0:g.signInWithEthereum)||void 0===o?void 0:o.notBefore,requestId:null===(l=null==g?void 0:g.signInWithEthereum)||void 0===l?void 0:l.requestId,resources:null===(u=null==g?void 0:g.signInWithEthereum)||void 0===u?void 0:u.resources};w=(0,v.createSiweMessage)(R),y=await f.request({method:'personal_sign',params:[(0,v.toHex)(w),k]})}try{const{data:t,error:s}=await(0,d._request)(this.fetch,'POST',`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:'ethereum',message:w,signature:y},(null===(h=e.options)||void 0===h?void 0:h.captchaToken)?{gotrue_meta_security:{captcha_token:null===(g=e.options)||void 0===g?void 0:g.captchaToken}}:null),xform:d._sessionResponse});if(s)throw s;if(!t||!t.session||!t.user){const e=new c.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null},error:e})}return t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers('SIGNED_IN',t.session)),this._returnResult({data:Object.assign({},t),error:s})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signInWithSolana(e){var t,s,r,i,n,a,o,l,u,h,g,w;let y,f;if('message'in e)y=e.message,f=e.signature;else{const{chain:c,wallet:d,statement:g,options:w}=e;let p;if((0,_.isBrowser)())if('object'==typeof d)p=d;else{const e=window;if(!('solana'in e)||'object'!=typeof e.solana||!('signIn'in e.solana&&'function'==typeof e.solana.signIn||'signMessage'in e.solana&&'function'==typeof e.solana.signMessage))throw new Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.");p=e.solana}else{if('object'!=typeof d||!(null==w?void 0:w.url))throw new Error('@supabase/auth-js: Both wallet and url must be specified in non-browser environments.');p=d}const v=new URL(null!==(t=null==w?void 0:w.url)&&void 0!==t?t:window.location.href);if('signIn'in p&&p.signIn){const e=await p.signIn(Object.assign(Object.assign(Object.assign({issuedAt:(new Date).toISOString()},null==w?void 0:w.signInWithSolana),{version:'1',domain:v.host,uri:v.href}),g?{statement:g}:null));let t;if(Array.isArray(e)&&e[0]&&'object'==typeof e[0])t=e[0];else{if(!(e&&'object'==typeof e&&'signedMessage'in e&&'signature'in e))throw new Error('@supabase/auth-js: Wallet method signIn() returned unrecognized value');t=e}if(!('signedMessage'in t&&'signature'in t&&('string'==typeof t.signedMessage||t.signedMessage instanceof Uint8Array)&&t.signature instanceof Uint8Array))throw new Error('@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields');y='string'==typeof t.signedMessage?t.signedMessage:(new TextDecoder).decode(t.signedMessage),f=t.signature}else{if(!('signMessage'in p&&'function'==typeof p.signMessage&&'publicKey'in p&&'object'==typeof p&&p.publicKey&&'toBase58'in p.publicKey&&'function'==typeof p.publicKey.toBase58))throw new Error('@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API');y=[`${v.host} wants you to sign in with your Solana account:`,p.publicKey.toBase58(),...g?['',g,'']:[''],'Version: 1',`URI: ${v.href}`,`Issued At: ${null!==(r=null===(s=null==w?void 0:w.signInWithSolana)||void 0===s?void 0:s.issuedAt)&&void 0!==r?r:(new Date).toISOString()}`,...(null===(i=null==w?void 0:w.signInWithSolana)||void 0===i?void 0:i.notBefore)?[`Not Before: ${w.signInWithSolana.notBefore}`]:[],...(null===(n=null==w?void 0:w.signInWithSolana)||void 0===n?void 0:n.expirationTime)?[`Expiration Time: ${w.signInWithSolana.expirationTime}`]:[],...(null===(a=null==w?void 0:w.signInWithSolana)||void 0===a?void 0:a.chainId)?[`Chain ID: ${w.signInWithSolana.chainId}`]:[],...(null===(o=null==w?void 0:w.signInWithSolana)||void 0===o?void 0:o.nonce)?[`Nonce: ${w.signInWithSolana.nonce}`]:[],...(null===(l=null==w?void 0:w.signInWithSolana)||void 0===l?void 0:l.requestId)?[`Request ID: ${w.signInWithSolana.requestId}`]:[],...(null===(h=null===(u=null==w?void 0:w.signInWithSolana)||void 0===u?void 0:u.resources)||void 0===h?void 0:h.length)?['Resources',...w.signInWithSolana.resources.map(e=>`- ${e}`)]:[]].join('\n');const e=await p.signMessage((new TextEncoder).encode(y),'utf8');if(!(e&&e instanceof Uint8Array))throw new Error('@supabase/auth-js: Wallet signMessage() API returned an recognized value');f=e}}try{const{data:t,error:s}=await(0,d._request)(this.fetch,'POST',`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:'solana',message:y,signature:(0,p.bytesToBase64URL)(f)},(null===(g=e.options)||void 0===g?void 0:g.captchaToken)?{gotrue_meta_security:{captcha_token:null===(w=e.options)||void 0===w?void 0:w.captchaToken}}:null),xform:d._sessionResponse});if(s)throw s;if(!t||!t.session||!t.user){const e=new c.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null},error:e})}return t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers('SIGNED_IN',t.session)),this._returnResult({data:Object.assign({},t),error:s})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async _exchangeCodeForSession(e){const t=await(0,_.getItemAsync)(this.storage,`${this.storageKey}-code-verifier`),[s,r]=(null!=t?t:'').split('/');try{if(!s&&'pkce'===this.flowType)throw new c.AuthPKCECodeVerifierMissingError;const{data:t,error:i}=await(0,d._request)(this.fetch,'POST',`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:s},xform:d._sessionResponse});if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),i)throw i;if(!t||!t.session||!t.user){const e=new c.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null,redirectType:null},error:e})}return t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers('recovery'===r?'PASSWORD_RECOVERY':'SIGNED_IN',t.session)),this._returnResult({data:Object.assign(Object.assign({},t),{redirectType:null!=r?r:null}),error:i})}catch(e){if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),(0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null,redirectType:null},error:e});throw e}}async signInWithIdToken(e){try{const{options:t,provider:s,token:r,access_token:i,nonce:n}=e,a=await(0,d._request)(this.fetch,'POST',`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:s,id_token:r,access_token:i,nonce:n,gotrue_meta_security:{captcha_token:null==t?void 0:t.captchaToken}},xform:d._sessionResponse}),{data:o,error:l}=a;if(l)return this._returnResult({data:{user:null,session:null},error:l});if(!o||!o.session||!o.user){const e=new c.AuthInvalidTokenResponseError;return this._returnResult({data:{user:null,session:null},error:e})}return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers('SIGNED_IN',o.session)),this._returnResult({data:o,error:l})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signInWithOtp(e){var t,s,r,i,n;try{if('email'in e){const{email:r,options:i}=e;let n=null,a=null;'pkce'===this.flowType&&([n,a]=await(0,_.getCodeChallengeAndMethod)(this.storage,this.storageKey));const{error:o}=await(0,d._request)(this.fetch,'POST',`${this.url}/otp`,{headers:this.headers,body:{email:r,data:null!==(t=null==i?void 0:i.data)&&void 0!==t?t:{},create_user:null===(s=null==i?void 0:i.shouldCreateUser)||void 0===s||s,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken},code_challenge:n,code_challenge_method:a},redirectTo:null==i?void 0:i.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:o})}if('phone'in e){const{phone:t,options:s}=e,{data:a,error:o}=await(0,d._request)(this.fetch,'POST',`${this.url}/otp`,{headers:this.headers,body:{phone:t,data:null!==(r=null==s?void 0:s.data)&&void 0!==r?r:{},create_user:null===(i=null==s?void 0:s.shouldCreateUser)||void 0===i||i,gotrue_meta_security:{captcha_token:null==s?void 0:s.captchaToken},channel:null!==(n=null==s?void 0:s.channel)&&void 0!==n?n:'sms'}});return this._returnResult({data:{user:null,session:null,messageId:null==a?void 0:a.message_id},error:o})}throw new c.AuthInvalidCredentialsError('You must provide either an email or phone number.')}catch(e){if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),(0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async verifyOtp(e){var t,s;try{let r,i;'options'in e&&(r=null===(t=e.options)||void 0===t?void 0:t.redirectTo,i=null===(s=e.options)||void 0===s?void 0:s.captchaToken);const{data:n,error:a}=await(0,d._request)(this.fetch,'POST',`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:i}}),redirectTo:r,xform:d._sessionResponse});if(a)throw a;if(!n){throw new Error('An error occurred on token verification.')}const o=n.session,l=n.user;return(null==o?void 0:o.access_token)&&(await this._saveSession(o),await this._notifyAllSubscribers('recovery'==e.type?'PASSWORD_RECOVERY':'SIGNED_IN',o)),this._returnResult({data:{user:l,session:o},error:null})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async signInWithSSO(e){var t,s,r,i,n;try{let a=null,o=null;'pkce'===this.flowType&&([a,o]=await(0,_.getCodeChallengeAndMethod)(this.storage,this.storageKey));const l=await(0,d._request)(this.fetch,'POST',`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},'providerId'in e?{provider_id:e.providerId}:null),'domain'in e?{domain:e.domain}:null),{redirect_to:null!==(s=null===(t=e.options)||void 0===t?void 0:t.redirectTo)&&void 0!==s?s:void 0}),(null===(r=null==e?void 0:e.options)||void 0===r?void 0:r.captchaToken)?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:a,code_challenge_method:o}),headers:this.headers,xform:d._ssoResponse});return(null===(i=l.data)||void 0===i?void 0:i.url)&&(0,_.isBrowser)()&&!(null===(n=e.options)||void 0===n?void 0:n.skipBrowserRedirect)&&window.location.assign(l.data.url),this._returnResult(l)}catch(e){if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),(0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async reauthenticate(){return await this.initializePromise,null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._reauthenticate()):await this._reauthenticate()}async _reauthenticate(){try{return await this._useSession(async e=>{const{data:{session:t},error:s}=e;if(s)throw s;if(!t)throw new c.AuthSessionMissingError;const{error:r}=await(0,d._request)(this.fetch,'GET',`${this.url}/reauthenticate`,{headers:this.headers,jwt:t.access_token});return this._returnResult({data:{user:null,session:null},error:r})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async resend(e){try{const t=`${this.url}/resend`;if('email'in e){const{email:s,type:r,options:i}=e;let n=null,a=null;'pkce'===this.flowType&&([n,a]=await(0,_.getCodeChallengeAndMethod)(this.storage,this.storageKey));const{error:o}=await(0,d._request)(this.fetch,'POST',t,{headers:this.headers,body:{email:s,type:r,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken},code_challenge:n,code_challenge_method:a},redirectTo:null==i?void 0:i.emailRedirectTo});return o&&await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:o})}if('phone'in e){const{phone:s,type:r,options:i}=e,{data:n,error:a}=await(0,d._request)(this.fetch,'POST',t,{headers:this.headers,body:{phone:s,type:r,gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:null==n?void 0:n.message_id},error:a})}throw new c.AuthInvalidCredentialsError('You must provide either an email or phone number and a type')}catch(e){if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),(0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async getSession(){return await this.initializePromise,null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>this._useSession(async e=>e)):await this._useSession(async e=>e)}async _acquireLock(e,t){this._debug('#_acquireLock','begin',e);try{if(this.lockAcquired){const e=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),s=(async()=>(await e,await t()))();return this.pendingInLock.push((async()=>{try{await s}catch(e){}})()),s}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug('#_acquireLock','lock acquired for storage key',this.storageKey);try{this.lockAcquired=!0;const e=t();for(this.pendingInLock.push((async()=>{try{await e}catch(e){}})()),await e;this.pendingInLock.length;){const e=[...this.pendingInLock];await Promise.all(e),this.pendingInLock.splice(0,e.length)}return await e}finally{this._debug('#_acquireLock','lock released for storage key',this.storageKey),this.lockAcquired=!1}})}finally{this._debug('#_acquireLock','end')}}async _useSession(e){this._debug('#_useSession','begin');try{const t=await this.__loadSession();return await e(t)}finally{this._debug('#_useSession','end')}}async __loadSession(){this._debug('#__loadSession()','begin'),null==this.lock||this.lockAcquired||this._debug('#__loadSession()','used outside of an acquired lock!',(new Error).stack);try{let e=null;const t=await(0,_.getItemAsync)(this.storage,this.storageKey);if(this._debug('#getSession()','session from storage',t),null!==t&&(this._isValidSession(t)?e=t:(this._debug('#getSession()','session from storage is not valid'),await this._removeSession())),!e)return{data:{session:null},error:null};const s=!!e.expires_at&&1e3*e.expires_at-Date.now()Date.now())){const t=await(0,_.getItemAsync)(this.storage,this.storageKey);if(t&&t.refresh_token===e.refresh_token)return this._returnResult({data:{session:e},error:null})}return this._returnResult({data:{session:null},error:i})}return this._returnResult({data:{session:r},error:null})}finally{this._debug('#__loadSession()','end')}}async getUser(e){if(e)return await this._getUser(e);let t;return await this.initializePromise,t=null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser()):await this._getUser(),t.data.user&&(this.suppressGetSessionWarning=!0),t}async _getUser(e){try{return e?await(0,d._request)(this.fetch,'GET',`${this.url}/user`,{headers:this.headers,jwt:e,xform:d._userResponse}):await this._useSession(async e=>{var t,s,r;const{data:i,error:n}=e;if(n)throw n;return(null===(t=i.session)||void 0===t?void 0:t.access_token)||this.hasCustomAuthorizationHeader?await(0,d._request)(this.fetch,'GET',`${this.url}/user`,{headers:this.headers,jwt:null!==(r=null===(s=i.session)||void 0===s?void 0:s.access_token)&&void 0!==r?r:void 0,xform:d._userResponse}):{data:{user:null},error:new c.AuthSessionMissingError}})}catch(e){if((0,c.isAuthError)(e))return(0,c.isAuthSessionMissingError)(e)&&(await this._removeSession(),await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:e});throw e}}async updateUser(e,t={}){return await this.initializePromise,null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(e,t)):await this._updateUser(e,t)}async _updateUser(e,t={}){try{return await this._useSession(async s=>{const{data:r,error:i}=s;if(i)throw i;if(!r.session)throw new c.AuthSessionMissingError;const n=r.session;let a=null,o=null;'pkce'===this.flowType&&null!=e.email&&([a,o]=await(0,_.getCodeChallengeAndMethod)(this.storage,this.storageKey));const{data:l,error:u}=await(0,d._request)(this.fetch,'PUT',`${this.url}/user`,{headers:this.headers,redirectTo:null==t?void 0:t.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:a,code_challenge_method:o}),jwt:n.access_token,xform:d._userResponse});if(u)throw u;return n.user=l.user,await this._saveSession(n),await this._notifyAllSubscribers('USER_UPDATED',n),this._returnResult({data:{user:n.user},error:null})})}catch(e){if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),(0,c.isAuthError)(e))return this._returnResult({data:{user:null},error:e});throw e}}async setSession(e){return await this.initializePromise,null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._setSession(e)):await this._setSession(e)}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new c.AuthSessionMissingError;const t=Date.now()/1e3;let s=t,r=!0,i=null;const{payload:n}=(0,_.decodeJWT)(e.access_token);if(n.exp&&(s=n.exp,r=s<=t),r){const{data:t,error:s}=await this._callRefreshToken(e.refresh_token);if(s)return this._returnResult({data:{user:null,session:null},error:s});if(!t)return{data:{user:null,session:null},error:null};i=t}else{const{data:r,error:n}=await this._getUser(e.access_token);if(n)return this._returnResult({data:{user:null,session:null},error:n});i={access_token:e.access_token,refresh_token:e.refresh_token,user:r.user,token_type:'bearer',expires_in:s-t,expires_at:s},await this._saveSession(i),await this._notifyAllSubscribers('SIGNED_IN',i)}return this._returnResult({data:{user:i.user,session:i},error:null})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{session:null,user:null},error:e});throw e}}async refreshSession(e){return await this.initializePromise,null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._refreshSession(e)):await this._refreshSession(e)}async _refreshSession(e){try{return await this._useSession(async t=>{var s;if(!e){const{data:r,error:i}=t;if(i)throw i;e=null!==(s=r.session)&&void 0!==s?s:void 0}if(!(null==e?void 0:e.refresh_token))throw new c.AuthSessionMissingError;const{data:r,error:i}=await this._callRefreshToken(e.refresh_token);return i?this._returnResult({data:{user:null,session:null},error:i}):r?this._returnResult({data:{user:r.user,session:r},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async _getSessionFromURL(e,t){var s;try{if(!(0,_.isBrowser)())throw new c.AuthImplicitGrantRedirectError('No browser detected.');if(e.error||e.error_description||e.error_code)throw new c.AuthImplicitGrantRedirectError(e.error_description||'Error in URL with unspecified error_description',{error:e.error||'unspecified_error',code:e.error_code||'unspecified_code'});switch(t){case'implicit':if('pkce'===this.flowType)throw new c.AuthPKCEGrantCodeExchangeError('Not a valid PKCE flow url.');break;case'pkce':if('implicit'===this.flowType)throw new c.AuthImplicitGrantRedirectError('Not a valid implicit grant flow url.')}if('pkce'===t){if(this._debug('#_initialize()','begin','is PKCE flow',!0),!e.code)throw new c.AuthPKCEGrantCodeExchangeError('No code detected.');const{data:t,error:r}=await this._exchangeCodeForSession(e.code);if(r)throw r;const i=new URL(window.location.href);return i.searchParams.delete('code'),window.history.replaceState(window.history.state,'',i.toString()),{data:{session:t.session,redirectType:null!==(s=t.redirectType)&&void 0!==s?s:null},error:null}}const{provider_token:r,provider_refresh_token:i,access_token:n,refresh_token:a,expires_in:o,expires_at:l,token_type:u}=e;if(!(n&&o&&a&&u))throw new c.AuthImplicitGrantRedirectError('No session defined in URL');const d=Math.round(Date.now()/1e3),g=parseInt(o);let w=d+g;l&&(w=parseInt(l));const y=w-d;1e3*y<=h.AUTO_REFRESH_TICK_DURATION_MS&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${y}s, should have been closer to ${g}s`);const f=w-g;d-f>=120?console.warn('@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale',f,w,d):d-f<0&&console.warn('@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew',f,w,d);const{data:p,error:v}=await this._getUser(n);if(v)throw v;const b={provider_token:r,provider_refresh_token:i,access_token:n,expires_in:g,expires_at:w,refresh_token:a,token_type:u,user:p.user};return window.location.hash='',this._debug('#_getSessionFromURL()','clearing window.location.hash'),this._returnResult({data:{session:b,redirectType:e.type},error:null})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:{session:null,redirectType:null},error:e});throw e}}_isImplicitGrantCallback(e){return'function'==typeof this.detectSessionInUrl?this.detectSessionInUrl(new URL(window.location.href),e):Boolean(e.access_token||e.error||e.error_description||e.error_code)}async _isPKCECallback(e){const t=await(0,_.getItemAsync)(this.storage,`${this.storageKey}-code-verifier`);return!(!e.code||!t)}async signOut(e={scope:'global'}){return await this.initializePromise,null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(e)):await this._signOut(e)}async _signOut({scope:e}={scope:'global'}){return await this._useSession(async t=>{var s;const{data:r,error:i}=t;if(i&&!(0,c.isAuthSessionMissingError)(i))return this._returnResult({error:i});const n=null===(s=r.session)||void 0===s?void 0:s.access_token;if(n){const{error:t}=await this.admin.signOut(n,e);if(t&&(!(0,c.isAuthApiError)(t)||404!==t.status&&401!==t.status&&403!==t.status)&&!(0,c.isAuthSessionMissingError)(t))return this._returnResult({error:t})}return'others'!==e&&(await this._removeSession(),await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(e){const t=(0,_.generateCallbackId)(),s={id:t,callback:e,unsubscribe:()=>{this._debug('#unsubscribe()','state change callback with id removed',t),this.stateChangeEmitters.delete(t)}};return this._debug('#onAuthStateChange()','registered callback with id',t),this.stateChangeEmitters.set(t,s),(async()=>{await this.initializePromise,null!=this.lock?await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(t)}):await this._emitInitialSession(t)})(),{data:{subscription:s}}}async _emitInitialSession(e){return await this._useSession(async t=>{var s,r;try{const{data:{session:r},error:i}=t;if(i)throw i;await(null===(s=this.stateChangeEmitters.get(e))||void 0===s?void 0:s.callback('INITIAL_SESSION',r)),this._debug('INITIAL_SESSION','callback id',e,'session',r)}catch(t){await(null===(r=this.stateChangeEmitters.get(e))||void 0===r?void 0:r.callback('INITIAL_SESSION',null)),this._debug('INITIAL_SESSION','callback id',e,'error',t),(0,c.isAuthSessionMissingError)(t)?console.warn(t):console.error(t)}})}async resetPasswordForEmail(e,t={}){let s=null,r=null;'pkce'===this.flowType&&([s,r]=await(0,_.getCodeChallengeAndMethod)(this.storage,this.storageKey,!0));try{return await(0,d._request)(this.fetch,'POST',`${this.url}/recover`,{body:{email:e,code_challenge:s,code_challenge_method:r,gotrue_meta_security:{captcha_token:t.captchaToken}},headers:this.headers,redirectTo:t.redirectTo})}catch(e){if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),(0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async getUserIdentities(){var e;try{const{data:t,error:s}=await this.getUser();if(s)throw s;return this._returnResult({data:{identities:null!==(e=t.user.identities)&&void 0!==e?e:[]},error:null})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async linkIdentity(e){return'token'in e?this.linkIdentityIdToken(e):this.linkIdentityOAuth(e)}async linkIdentityOAuth(e){var t;try{const{data:s,error:r}=await this._useSession(async t=>{var s,r,i,n,a;const{data:o,error:l}=t;if(l)throw l;const u=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:null===(s=e.options)||void 0===s?void 0:s.redirectTo,scopes:null===(r=e.options)||void 0===r?void 0:r.scopes,queryParams:null===(i=e.options)||void 0===i?void 0:i.queryParams,skipBrowserRedirect:!0});return await(0,d._request)(this.fetch,'GET',u,{headers:this.headers,jwt:null!==(a=null===(n=o.session)||void 0===n?void 0:n.access_token)&&void 0!==a?a:void 0})});if(r)throw r;return(0,_.isBrowser)()&&!(null===(t=e.options)||void 0===t?void 0:t.skipBrowserRedirect)&&window.location.assign(null==s?void 0:s.url),this._returnResult({data:{provider:e.provider,url:null==s?void 0:s.url},error:null})}catch(t){if((0,c.isAuthError)(t))return this._returnResult({data:{provider:e.provider,url:null},error:t});throw t}}async linkIdentityIdToken(e){return await this._useSession(async t=>{var s;try{const{error:r,data:{session:i}}=t;if(r)throw r;const{options:n,provider:a,token:o,access_token:l,nonce:u}=e,h=await(0,d._request)(this.fetch,'POST',`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:null!==(s=null==i?void 0:i.access_token)&&void 0!==s?s:void 0,body:{provider:a,id_token:o,access_token:l,nonce:u,link_identity:!0,gotrue_meta_security:{captcha_token:null==n?void 0:n.captchaToken}},xform:d._sessionResponse}),{data:_,error:g}=h;return g?this._returnResult({data:{user:null,session:null},error:g}):_&&_.session&&_.user?(_.session&&(await this._saveSession(_.session),await this._notifyAllSubscribers('USER_UPDATED',_.session)),this._returnResult({data:_,error:g})):this._returnResult({data:{user:null,session:null},error:new c.AuthInvalidTokenResponseError})}catch(e){if(await(0,_.removeItemAsync)(this.storage,`${this.storageKey}-code-verifier`),(0,c.isAuthError)(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}})}async unlinkIdentity(e){try{return await this._useSession(async t=>{var s,r;const{data:i,error:n}=t;if(n)throw n;return await(0,d._request)(this.fetch,'DELETE',`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:null!==(r=null===(s=i.session)||void 0===s?void 0:s.access_token)&&void 0!==r?r:void 0})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _refreshAccessToken(e){const t="#_refreshAccessToken()";this._debug(t,'begin');try{const s=Date.now();return await(0,_.retryable)(async s=>(s>0&&await(0,_.sleep)(200*Math.pow(2,s-1)),this._debug(t,'refreshing attempt',s),await(0,d._request)(this.fetch,'POST',`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:d._sessionResponse})),(e,t)=>{const r=200*Math.pow(2,e);return t&&(0,c.isAuthRetryableFetchError)(t)&&Date.now()+r-sDate.now())?this._debug(r,'proactive refresh failed, access token still valid \u2014 preserving session'):await this._removeSession()}return this.lastRefreshFailure={refreshToken:e,result:s,expiresAt:Date.now()+h.REFRESH_FAILURE_COOLDOWN_MS},null===(t=this.refreshingDeferred)||void 0===t||t.resolve(s),s}throw null===(s=this.refreshingDeferred)||void 0===s||s.reject(i),i}finally{this.refreshingDeferred=null,this._debug(r,'end')}}async _notifyAllSubscribers(e,t,s=!0){const r=`#_notifyAllSubscribers(${e})`;this._debug(r,'begin',t,`broadcast = ${s}`);try{this.broadcastChannel&&s&&this.broadcastChannel.postMessage({event:e,session:t});const r=[],i=Array.from(this.stateChangeEmitters.values()).map(async s=>{try{await s.callback(e,t)}catch(e){r.push(e)}});if(await Promise.all(i),r.length>0){for(let e=0;ethis._autoRefreshTokenTick(),h.AUTO_REFRESH_TICK_DURATION_MS);this.autoRefreshTicker=e,e&&'object'==typeof e&&'function'==typeof e.unref?e.unref():'undefined'!=typeof Deno&&'function'==typeof Deno.unrefTimer&&Deno.unrefTimer(e);const t=setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0);this.autoRefreshTickTimeout=t,t&&'object'==typeof t&&'function'==typeof t.unref?t.unref():'undefined'!=typeof Deno&&'function'==typeof Deno.unrefTimer&&Deno.unrefTimer(t)}async _stopAutoRefresh(){this._debug('#_stopAutoRefresh()');const e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e);const t=this.autoRefreshTickTimeout;this.autoRefreshTickTimeout=null,t&&clearTimeout(t)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async dispose(){var e;this._removeVisibilityChangedCallback(),await this._stopAutoRefresh(),null===(e=this.broadcastChannel)||void 0===e||e.close(),this.broadcastChannel=null,this.stateChangeEmitters.clear()}async _autoRefreshTokenTick(){if(this._debug('#_autoRefreshTokenTick()','begin'),null==this.lock)if(null===this.refreshingDeferred)try{const e=Date.now();try{await this._useSession(async t=>{const{data:{session:s}}=t;if(!s||!s.refresh_token||!s.expires_at)return void this._debug('#_autoRefreshTokenTick()','no session');const r=Math.floor((1e3*s.expires_at-e)/h.AUTO_REFRESH_TICK_DURATION_MS);this._debug('#_autoRefreshTokenTick()',`access token expires in ${r} ticks, a tick lasts ${h.AUTO_REFRESH_TICK_DURATION_MS}ms, refresh threshold is ${h.AUTO_REFRESH_TICK_THRESHOLD} ticks`),r<=h.AUTO_REFRESH_TICK_THRESHOLD&&await this._callRefreshToken(s.refresh_token)})}catch(e){console.error('Auto refresh tick failed with error. This is likely a transient error.',e)}}finally{this._debug('#_autoRefreshTokenTick()','end')}else this._debug('#_autoRefreshTokenTick()','refresh already in flight, skipping');else try{await this._acquireLock(0,async()=>{try{const e=Date.now();try{return await this._useSession(async t=>{const{data:{session:s}}=t;if(!s||!s.refresh_token||!s.expires_at)return void this._debug('#_autoRefreshTokenTick()','no session');const r=Math.floor((1e3*s.expires_at-e)/h.AUTO_REFRESH_TICK_DURATION_MS);this._debug('#_autoRefreshTokenTick()',`access token expires in ${r} ticks, a tick lasts ${h.AUTO_REFRESH_TICK_DURATION_MS}ms, refresh threshold is ${h.AUTO_REFRESH_TICK_THRESHOLD} ticks`),r<=h.AUTO_REFRESH_TICK_THRESHOLD&&await this._callRefreshToken(s.refresh_token)})}catch(e){console.error('Auto refresh tick failed with error. This is likely a transient error.',e)}}finally{this._debug('#_autoRefreshTokenTick()','end')}})}catch(e){if(!(e instanceof w.LockAcquireTimeoutError))throw e;this._debug('auto refresh token tick lock not available')}}async _handleVisibilityChange(){if(this._debug('#_handleVisibilityChange()'),!(0,_.isBrowser)()||!(null===window||void 0===window?void 0:window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>{try{await this._onVisibilityChanged(!1)}catch(e){this._debug('#visibilityChangedCallback','error',e)}},null===window||void 0===window||window.addEventListener('visibilitychange',this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error('_handleVisibilityChange',e)}}async _onVisibilityChanged(e){const t=`#_onVisibilityChanged(${e})`;if(this._debug(t,'visibilityState',document.visibilityState),'visible'===document.visibilityState){if(this.autoRefreshToken&&this._startAutoRefresh(),!e)if(await this.initializePromise,null!=this.lock)await this._acquireLock(this.lockAcquireTimeout,async()=>{'visible'===document.visibilityState?await this._recoverAndRefresh():this._debug(t,'acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting')});else{if('visible'!==document.visibilityState)return void this._debug(t,'visibilityState is no longer visible, skipping recovery');await this._recoverAndRefresh()}}else'hidden'===document.visibilityState&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(e,t,s){const r=[`provider=${encodeURIComponent(t)}`];if((null==s?void 0:s.redirectTo)&&r.push(`redirect_to=${encodeURIComponent(s.redirectTo)}`),(null==s?void 0:s.scopes)&&r.push(`scopes=${encodeURIComponent(s.scopes)}`),'pkce'===this.flowType){const[e,t]=await(0,_.getCodeChallengeAndMethod)(this.storage,this.storageKey),s=new URLSearchParams({code_challenge:`${encodeURIComponent(e)}`,code_challenge_method:`${encodeURIComponent(t)}`});r.push(s.toString())}if(null==s?void 0:s.queryParams){const e=new URLSearchParams(s.queryParams);r.push(e.toString())}return(null==s?void 0:s.skipBrowserRedirect)&&r.push(`skip_http_redirect=${s.skipBrowserRedirect}`),`${e}?${r.join('&')}`}async _unenroll(e){try{return await this._useSession(async t=>{var s;const{data:r,error:i}=t;return i?this._returnResult({data:null,error:i}):await(0,d._request)(this.fetch,'DELETE',`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:null===(s=null==r?void 0:r.session)||void 0===s?void 0:s.access_token})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _enroll(e){try{return await this._useSession(async t=>{var s,r;const{data:i,error:n}=t;if(n)return this._returnResult({data:null,error:n});const a=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},'phone'===e.factorType?{phone:e.phone}:'totp'===e.factorType?{issuer:e.issuer}:{}),{data:o,error:l}=await(0,d._request)(this.fetch,'POST',`${this.url}/factors`,{body:a,headers:this.headers,jwt:null===(s=null==i?void 0:i.session)||void 0===s?void 0:s.access_token});return l?this._returnResult({data:null,error:l}):('totp'===e.factorType&&'totp'===o.type&&(null===(r=null==o?void 0:o.totp)||void 0===r?void 0:r.qr_code)&&(o.totp.qr_code=`data:image/svg+xml;utf-8,${o.totp.qr_code}`),this._returnResult({data:o,error:null}))})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _verify(e){const t=async()=>{try{return await this._useSession(async t=>{var s;const{data:r,error:i}=t;if(i)return this._returnResult({data:null,error:i});const n=Object.assign({challenge_id:e.challengeId},'webauthn'in e?{webauthn:Object.assign(Object.assign({},e.webauthn),{credential_response:'create'===e.webauthn.type?(0,b.serializeCredentialCreationResponse)(e.webauthn.credential_response):(0,b.serializeCredentialRequestResponse)(e.webauthn.credential_response)})}:{code:e.code}),{data:a,error:o}=await(0,d._request)(this.fetch,'POST',`${this.url}/factors/${e.factorId}/verify`,{body:n,headers:this.headers,jwt:null===(s=null==r?void 0:r.session)||void 0===s?void 0:s.access_token});return o?this._returnResult({data:null,error:o}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+a.expires_in},a)),await this._notifyAllSubscribers('MFA_CHALLENGE_VERIFIED',a),this._returnResult({data:a,error:o}))})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}};return null!=this.lock?this._acquireLock(this.lockAcquireTimeout,t):t()}async _challenge(e){const t=async()=>{try{return await this._useSession(async t=>{var s;const{data:r,error:i}=t;if(i)return this._returnResult({data:null,error:i});const n=await(0,d._request)(this.fetch,'POST',`${this.url}/factors/${e.factorId}/challenge`,{body:e,headers:this.headers,jwt:null===(s=null==r?void 0:r.session)||void 0===s?void 0:s.access_token});if(n.error)return n;const{data:a}=n;if('webauthn'!==a.type)return{data:a,error:null};switch(a.webauthn.type){case'create':return{data:Object.assign(Object.assign({},a),{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_options:Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:(0,b.deserializeCredentialCreationOptions)(a.webauthn.credential_options.publicKey)})})}),error:null};case'request':return{data:Object.assign(Object.assign({},a),{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_options:Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:(0,b.deserializeCredentialRequestOptions)(a.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}};return null!=this.lock?this._acquireLock(this.lockAcquireTimeout,t):t()}async _challengeAndVerify(e){const{data:t,error:s}=await this._challenge({factorId:e.factorId});return s?this._returnResult({data:null,error:s}):await this._verify({factorId:e.factorId,challengeId:t.id,code:e.code})}async _listFactors(){var e;const{data:{user:t},error:s}=await this.getUser();if(s)return{data:null,error:s};const r={all:[],phone:[],totp:[],webauthn:[]};for(const s of null!==(e=null==t?void 0:t.factors)&&void 0!==e?e:[])r.all.push(s),'verified'===s.status&&r[s.factor_type].push(s);return{data:r,error:null}}async _getAuthenticatorAssuranceLevel(e){var t,s,r,i;if(e)try{const{payload:r}=(0,_.decodeJWT)(e);let i=null;r.aal&&(i=r.aal);let n=i;const{data:{user:a},error:o}=await this.getUser(e);if(o)return this._returnResult({data:null,error:o});(null!==(s=null===(t=null==a?void 0:a.factors)||void 0===t?void 0:t.filter(e=>'verified'===e.status))&&void 0!==s?s:[]).length>0&&(n='aal2');return{data:{currentLevel:i,nextLevel:n,currentAuthenticationMethods:r.amr||[]},error:null}}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}const{data:{session:n},error:a}=await this.getSession();if(a)return this._returnResult({data:null,error:a});if(!n)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:o}=(0,_.decodeJWT)(n.access_token);let l=null;o.aal&&(l=o.aal);let u=l;(null!==(i=null===(r=n.user.factors)||void 0===r?void 0:r.filter(e=>'verified'===e.status))&&void 0!==i?i:[]).length>0&&(u='aal2');return{data:{currentLevel:l,nextLevel:u,currentAuthenticationMethods:o.amr||[]},error:null}}async _getAuthorizationDetails(e){try{return await this._useSession(async t=>{const{data:{session:s},error:r}=t;return r?this._returnResult({data:null,error:r}):s?await(0,d._request)(this.fetch,'GET',`${this.url}/oauth/authorizations/${e}`,{headers:this.headers,jwt:s.access_token,xform:e=>({data:e,error:null})}):this._returnResult({data:null,error:new c.AuthSessionMissingError})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _approveAuthorization(e,t){try{return await this._useSession(async s=>{const{data:{session:r},error:i}=s;if(i)return this._returnResult({data:null,error:i});if(!r)return this._returnResult({data:null,error:new c.AuthSessionMissingError});const n=await(0,d._request)(this.fetch,'POST',`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:r.access_token,body:{action:'approve'},xform:e=>({data:e,error:null})});return n.data&&n.data.redirect_url&&(0,_.isBrowser)()&&!(null==t?void 0:t.skipBrowserRedirect)&&window.location.assign(n.data.redirect_url),n})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _denyAuthorization(e,t){try{return await this._useSession(async s=>{const{data:{session:r},error:i}=s;if(i)return this._returnResult({data:null,error:i});if(!r)return this._returnResult({data:null,error:new c.AuthSessionMissingError});const n=await(0,d._request)(this.fetch,'POST',`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:r.access_token,body:{action:'deny'},xform:e=>({data:e,error:null})});return n.data&&n.data.redirect_url&&(0,_.isBrowser)()&&!(null==t?void 0:t.skipBrowserRedirect)&&window.location.assign(n.data.redirect_url),n})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _listOAuthGrants(){try{return await this._useSession(async e=>{const{data:{session:t},error:s}=e;return s?this._returnResult({data:null,error:s}):t?await(0,d._request)(this.fetch,'GET',`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:t.access_token,xform:e=>({data:e,error:null})}):this._returnResult({data:null,error:new c.AuthSessionMissingError})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _revokeOAuthGrant(e){try{return await this._useSession(async t=>{const{data:{session:s},error:r}=t;return r?this._returnResult({data:null,error:r}):s?(await(0,d._request)(this.fetch,'DELETE',`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:s.access_token,query:{client_id:e.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new c.AuthSessionMissingError})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async fetchJwk(e,t={keys:[]}){let s=t.keys.find(t=>t.kid===e);if(s)return s;const r=Date.now();if(s=this.jwks.keys.find(t=>t.kid===e),s&&this.jwks_cached_at+h.JWKS_TTL>r)return s;const{data:i,error:n}=await(0,d._request)(this.fetch,'GET',`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(n)throw n;return i.keys&&0!==i.keys.length?(this.jwks=i,this.jwks_cached_at=r,s=i.keys.find(t=>t.kid===e),s||null):null}async getClaims(e,t={}){try{let s=e;if(!s){const{data:e,error:t}=await this.getSession();if(t||!e.session)return this._returnResult({data:null,error:t});s=e.session.access_token}const{header:r,payload:i,signature:n,raw:{header:a,payload:o}}=(0,_.decodeJWT)(s);if(!(null==t?void 0:t.allowExpired))try{(0,_.validateExp)(i.exp)}catch(e){throw new c.AuthInvalidJwtError(e instanceof Error?e.message:'JWT validation failed')}const l=r.alg&&!r.alg.startsWith('HS')&&r.kid&&'crypto'in globalThis&&'subtle'in globalThis.crypto?await this.fetchJwk(r.kid,(null==t?void 0:t.keys)?{keys:t.keys}:null==t?void 0:t.jwks):null;if(!l){const{error:e}=await this.getUser(s);if(e)throw e;return{data:{claims:i,header:r,signature:n},error:null}}const u=(0,_.getAlgorithm)(r.alg),h=await crypto.subtle.importKey('jwk',l,u,!0,['verify']);if(!await crypto.subtle.verify(u,h,n,(0,p.stringToUint8Array)(`${a}.${o}`)))throw new c.AuthInvalidJwtError('Invalid JWT signature');return{data:{claims:i,header:r,signature:n},error:null}}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async signInWithPasskey(e){var t,s,r;(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{if(!(0,b.browserSupportsWebAuthn)())return this._returnResult({data:null,error:new c.AuthUnknownError('Browser does not support WebAuthn',null)});const{data:i,error:n}=await this._startPasskeyAuthentication({options:{captchaToken:null===(t=null==e?void 0:e.options)||void 0===t?void 0:t.captchaToken}});if(n||!i)return this._returnResult({data:null,error:n});const a=(0,b.deserializeCredentialRequestOptions)(i.options),o=null!==(r=null===(s=null==e?void 0:e.options)||void 0===s?void 0:s.signal)&&void 0!==r?r:b.webAuthnAbortService.createNewAbortSignal(),{data:l,error:u}=await(0,b.getCredential)({publicKey:a,signal:o});if(u||!l)return this._returnResult({data:null,error:null!=u?u:new c.AuthUnknownError('WebAuthn ceremony failed',null)});const h=(0,b.serializeCredentialRequestResponse)(l);return this._verifyPasskeyAuthentication({challengeId:i.challenge_id,credential:h})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async registerPasskey(e){var t,s;(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{if(!(0,b.browserSupportsWebAuthn)())return this._returnResult({data:null,error:new c.AuthUnknownError('Browser does not support WebAuthn',null)});const{data:r,error:i}=await this._startPasskeyRegistration();if(i||!r)return this._returnResult({data:null,error:i});const n=(0,b.deserializeCredentialCreationOptions)(r.options),a=null!==(s=null===(t=null==e?void 0:e.options)||void 0===t?void 0:t.signal)&&void 0!==s?s:b.webAuthnAbortService.createNewAbortSignal(),{data:o,error:l}=await(0,b.createCredential)({publicKey:n,signal:a});if(l||!o)return this._returnResult({data:null,error:null!=l?l:new c.AuthUnknownError('WebAuthn ceremony failed',null)});const u=(0,b.serializeCredentialCreationResponse)(o);return this._verifyPasskeyRegistration({challengeId:r.challenge_id,credential:u})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _startPasskeyRegistration(){(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{return await this._useSession(async e=>{const{data:{session:t},error:s}=e;if(s)return this._returnResult({data:null,error:s});if(!t)return this._returnResult({data:null,error:new c.AuthSessionMissingError});const{data:r,error:i}=await(0,d._request)(this.fetch,'POST',`${this.url}/passkeys/registration/options`,{headers:this.headers,jwt:t.access_token,body:{}});return i?this._returnResult({data:null,error:i}):this._returnResult({data:r,error:null})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _verifyPasskeyRegistration(e){(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{return await this._useSession(async t=>{const{data:{session:s},error:r}=t;if(r)return this._returnResult({data:null,error:r});if(!s)return this._returnResult({data:null,error:new c.AuthSessionMissingError});const{data:i,error:n}=await(0,d._request)(this.fetch,'POST',`${this.url}/passkeys/registration/verify`,{headers:this.headers,jwt:s.access_token,body:{challenge_id:e.challengeId,credential:e.credential}});return n?this._returnResult({data:null,error:n}):this._returnResult({data:i,error:null})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _startPasskeyAuthentication(e){var t;(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{const{data:s,error:r}=await(0,d._request)(this.fetch,'POST',`${this.url}/passkeys/authentication/options`,{headers:this.headers,body:{gotrue_meta_security:{captcha_token:null===(t=null==e?void 0:e.options)||void 0===t?void 0:t.captchaToken}}});return r?this._returnResult({data:null,error:r}):this._returnResult({data:s,error:null})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _verifyPasskeyAuthentication(e){(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{const{data:t,error:s}=await(0,d._request)(this.fetch,'POST',`${this.url}/passkeys/authentication/verify`,{headers:this.headers,body:{challenge_id:e.challengeId,credential:e.credential},xform:d._sessionResponse});return s?this._returnResult({data:null,error:s}):(t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers('SIGNED_IN',t.session)),this._returnResult({data:t,error:null}))}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _listPasskeys(){(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{return await this._useSession(async e=>{const{data:{session:t},error:s}=e;if(s)return this._returnResult({data:null,error:s});if(!t)return this._returnResult({data:null,error:new c.AuthSessionMissingError});const{data:r,error:i}=await(0,d._request)(this.fetch,'GET',`${this.url}/passkeys`,{headers:this.headers,jwt:t.access_token,xform:e=>({data:e,error:null})});return i?this._returnResult({data:null,error:i}):this._returnResult({data:r,error:null})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _updatePasskey(e){(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{return await this._useSession(async t=>{const{data:{session:s},error:r}=t;if(r)return this._returnResult({data:null,error:r});if(!s)return this._returnResult({data:null,error:new c.AuthSessionMissingError});const{data:i,error:n}=await(0,d._request)(this.fetch,'PATCH',`${this.url}/passkeys/${e.passkeyId}`,{headers:this.headers,jwt:s.access_token,body:{friendly_name:e.friendlyName}});return n?this._returnResult({data:null,error:n}):this._returnResult({data:i,error:null})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}async _deletePasskey(e){(0,_.assertPasskeyExperimentalEnabled)(this.experimental);try{return await this._useSession(async t=>{const{data:{session:s},error:r}=t;if(r)return this._returnResult({data:null,error:r});if(!s)return this._returnResult({data:null,error:new c.AuthSessionMissingError});const{error:i}=await(0,d._request)(this.fetch,'DELETE',`${this.url}/passkeys/${e.passkeyId}`,{headers:this.headers,jwt:s.access_token,noResolveJson:!0});return i?this._returnResult({data:null,error:i}):this._returnResult({data:null,error:null})})}catch(e){if((0,c.isAuthError)(e))return this._returnResult({data:null,error:e});throw e}}}R.nextInstanceID={};var A=R},1186,[1178,1180,1183,1179,1182,1187,1188,1189,1181,1184,1190,1191]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.memoryLocalStorageAdapter=function(t={}){return{getItem:o=>t[o]||null,setItem:(o,n)=>{t[o]=n},removeItem:o=>{delete t[o]}}}},1187,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"internals",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"LockAcquireTimeoutError",{enumerable:!0,get:function(){return t}}),Object.defineProperty(_e,"NavigatorLockAcquireTimeoutError",{enumerable:!0,get:function(){return n}}),Object.defineProperty(_e,"ProcessLockAcquireTimeoutError",{enumerable:!0,get:function(){return s}}),_e.navigatorLock=async function(e,t,s){o.debug&&console.log('@supabase/gotrue-js: navigatorLock: acquire lock',e,t);const c=new globalThis.AbortController;let l;t>0&&(l=setTimeout(()=>{c.abort(),o.debug&&console.log('@supabase/gotrue-js: navigatorLock acquire timed out',e)},t));await Promise.resolve();try{return await globalThis.navigator.locks.request(e,0===t?{mode:'exclusive',ifAvailable:!0}:{mode:'exclusive',signal:c.signal},async c=>{if(!c){if(0===t)throw o.debug&&console.log('@supabase/gotrue-js: navigatorLock: not immediately available',e),new n(`Acquiring an exclusive Navigator LockManager lock "${e}" immediately failed`);if(o.debug)try{const e=await globalThis.navigator.locks.query();console.log('@supabase/gotrue-js: Navigator LockManager state',JSON.stringify(e,null,' '))}catch(e){console.warn('@supabase/gotrue-js: Error when querying Navigator LockManager state',e)}return console.warn('@supabase/gotrue-js: Navigator LockManager returned a null lock when using #request without ifAvailable set to true, it appears this browser is not following the LockManager spec https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request'),clearTimeout(l),await s()}clearTimeout(l),o.debug&&console.log('@supabase/gotrue-js: navigatorLock: acquired',e,c.name);try{return await s()}finally{o.debug&&console.log('@supabase/gotrue-js: navigatorLock: released',e,c.name)}})}catch(u){if(t>0&&clearTimeout(l),null!==u&&'object'==typeof u&&'name'in u&&'AbortError'===u.name&&t>0){if(c.signal.aborted)return o.debug&&console.log('@supabase/gotrue-js: navigatorLock: acquire timeout, recovering by stealing lock',e),console.warn(`@supabase/gotrue-js: Lock "${e}" was not released within ${t}ms. This may indicate an orphaned lock from a component unmount (e.g., React Strict Mode). Forcefully acquiring the lock to recover.`),await Promise.resolve().then(()=>globalThis.navigator.locks.request(e,{mode:'exclusive',steal:!0},async t=>{if(!t)return console.warn('@supabase/gotrue-js: Navigator LockManager returned null lock even with steal: true'),await s();o.debug&&console.log('@supabase/gotrue-js: navigatorLock: recovered (stolen)',e,t.name);try{return await s()}finally{o.debug&&console.log('@supabase/gotrue-js: navigatorLock: released (stolen)',e,t.name)}}));throw o.debug&&console.log('@supabase/gotrue-js: navigatorLock: lock was stolen by another request',e),new n(`Lock "${e}" was released because another request stole it`)}throw u}},_e.processLock=async function(e,o,n){var l;const u=null!==(l=c[e])&&void 0!==l?l:Promise.resolve(),b=(async()=>{try{return await u,null}catch(e){return null}})(),k=(async()=>{let c=null;try{const t=o>=0?new Promise((t,n)=>{c=setTimeout(()=>{console.warn(`@supabase/gotrue-js: Lock "${e}" acquisition timed out after ${o}ms. This may be caused by another operation holding the lock. Consider increasing lockAcquireTimeout or checking for stuck operations.`),n(new s(`Acquiring process lock with name "${e}" timed out`))},o)}):null;await Promise.race([b,t].filter(e=>e)),null!==c&&clearTimeout(c)}catch(e){if(null!==c&&clearTimeout(c),e instanceof t)throw e}return await n()})();return c[e]=(async()=>{try{return await k}catch(e){if(e instanceof t){try{await u}catch(e){}return null}throw e}})(),await k};var e=r(d[0]);const o={debug:!!(globalThis&&(0,e.supportsLocalStorage)()&&globalThis.localStorage&&'true'===globalThis.localStorage.getItem('supabase.gotrue-js.locks.debug'))};class t extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class n extends t{}class s extends t{}const c={}},1188,[1182]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.polyfillGlobalThis=function(){if('object'==typeof globalThis)return;try{Object.defineProperty(Object.prototype,'__magic__',{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch(e){'undefined'!=typeof self&&(self.globalThis=self)}}},1189,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(t){if(!/^0x[a-fA-F0-9]{40}$/.test(t))throw new Error(`@supabase/auth-js: Address "${t}" is invalid.`);return t.toLowerCase()}Object.defineProperty(e,'__esModule',{value:!0}),e.getAddress=t,e.fromHex=function(t){return parseInt(t,16)},e.toHex=function(t){const n=(new TextEncoder).encode(t);return'0x'+Array.from(n,t=>t.toString(16).padStart(2,'0')).join('')},e.createSiweMessage=function(n){var s;const{chainId:o,domain:u,expirationTime:c,issuedAt:l=new Date,nonce:f,notBefore:I,requestId:v,resources:h,scheme:$,uri:w,version:E}=n;if(!Number.isInteger(o))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${o}`);if(!u)throw new Error("@supabase/auth-js: Invalid SIWE message field \"domain\". Domain must be provided.");if(f&&f.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${f}`);if(!w)throw new Error("@supabase/auth-js: Invalid SIWE message field \"uri\". URI must be provided.");if('1'!==E)throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${E}`);if(null===(s=n.statement)||void 0===s?void 0:s.includes('\n'))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${n.statement}`);const S=t(n.address),b=$?`${$}://${u}`:u,p=n.statement?`${n.statement}\n`:'',j=`${b} wants you to sign in with your Ethereum account:\n${S}\n\n${p}`;let x=`URI: ${w}\nVersion: ${E}\nChain ID: ${o}${f?`\nNonce: ${f}`:''}\nIssued At: ${l.toISOString()}`;c&&(x+=`\nExpiration Time: ${c.toISOString()}`);I&&(x+=`\nNot Before: ${I.toISOString()}`);v&&(x+=`\nRequest ID: ${v}`);if(h){let t='\nResources:';for(const n of h){if(!n||'string'!=typeof n)throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${n}`);t+=`\n- ${n}`}x+=t}return`${j}\n${x}`}},1190,[]); +__d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"WebAuthnError",{enumerable:!0,get:function(){return l.WebAuthnError}}),Object.defineProperty(e,"isWebAuthnError",{enumerable:!0,get:function(){return l.isWebAuthnError}}),Object.defineProperty(e,"identifyRegistrationError",{enumerable:!0,get:function(){return l.identifyRegistrationError}}),Object.defineProperty(e,"identifyAuthenticationError",{enumerable:!0,get:function(){return l.identifyAuthenticationError}}),Object.defineProperty(e,"WebAuthnAbortService",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"webAuthnAbortService",{enumerable:!0,get:function(){return u}}),e.deserializeCredentialCreationOptions=function(i){if(!i)throw new Error('Credential creation options are required');if('undefined'!=typeof PublicKeyCredential&&'parseCreationOptionsFromJSON'in PublicKeyCredential&&'function'==typeof PublicKeyCredential.parseCreationOptionsFromJSON)return PublicKeyCredential.parseCreationOptionsFromJSON(i);const{challenge:o,user:l,excludeCredentials:s}=i,u=(0,t.__rest)(i,["challenge","user","excludeCredentials"]),c=(0,n.base64UrlToUint8Array)(o).buffer,f=Object.assign(Object.assign({},l),{id:(0,n.base64UrlToUint8Array)(l.id).buffer}),h=Object.assign(Object.assign({},u),{challenge:c,user:f});if(s&&s.length>0){h.excludeCredentials=new Array(s.length);for(let t=0;t0){c.allowCredentials=new Array(l.length);for(let t=0;tnull!==t&&'object'==typeof t&&!Array.isArray(t),i=t=>t instanceof ArrayBuffer||ArrayBuffer.isView(t),o={};for(const l of t)if(l)for(const t in l){const s=l[t];if(void 0!==s)if(Array.isArray(s))o[t]=s;else if(i(s))o[t]=s;else if(n(s)){const i=o[t];n(i)?o[t]=p(i,s):o[t]=p(s)}else o[t]=s}return o}function w(t,n){return p(b,t,n||{})}function A(t,n){return p(y,t,n||{})}class O{constructor(t){this.client=t,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(t){return this.client.mfa.enroll(Object.assign(Object.assign({},t),{factorType:'webauthn'}))}async _challenge({factorId:t,webauthn:n,friendlyName:o,signal:l},s){var c;try{const{data:i,error:b}=await this.client.mfa.challenge({factorId:t,webauthn:n});if(!i)return{data:null,error:b};const y=null!=l?l:u.createNewAbortSignal();if('create'===i.webauthn.type){const{user:t}=i.webauthn.credential_options.publicKey;if(!t.name){const n=o;if(n)t.name=`${t.id}:${n}`;else{const n=(await this.client.getUser()).data.user,i=(null===(c=null==n?void 0:n.user_metadata)||void 0===c?void 0:c.name)||(null==n?void 0:n.email)||(null==n?void 0:n.id)||'User';t.name=`${t.id}:${i}`}}t.displayName||(t.displayName=t.name)}switch(i.webauthn.type){case'create':{const n=w(i.webauthn.credential_options.publicKey,null==s?void 0:s.create),{data:o,error:l}=await f({publicKey:n,signal:y});return o?{data:{factorId:t,challengeId:i.id,webauthn:{type:i.webauthn.type,credential_response:o}},error:null}:{data:null,error:l}}case'request':{const n=A(i.webauthn.credential_options.publicKey,null==s?void 0:s.request),{data:o,error:l}=await h(Object.assign(Object.assign({},i.webauthn.credential_options),{publicKey:n,signal:y}));return o?{data:{factorId:t,challengeId:i.id,webauthn:{type:i.webauthn.type,credential_response:o}},error:null}:{data:null,error:l}}}}catch(t){return(0,i.isAuthError)(t)?{data:null,error:t}:{data:null,error:new i.AuthUnknownError('Unexpected error in challenge',t)}}}async _verify({challengeId:t,factorId:n,webauthn:i}){return this.client.mfa.verify({factorId:n,challengeId:t,webauthn:i})}async _authenticate({factorId:t,webauthn:{rpId:n=('undefined'!=typeof window?window.location.hostname:void 0),rpOrigins:o=('undefined'!=typeof window?[window.location.origin]:void 0),signal:l}={}},s){if(!n)return{data:null,error:new i.AuthError('rpId is required for WebAuthn authentication')};try{if(!c())return{data:null,error:new i.AuthUnknownError('Browser does not support WebAuthn',null)};const{data:u,error:f}=await this.challenge({factorId:t,webauthn:{rpId:n,rpOrigins:o},signal:l},{request:s});if(!u)return{data:null,error:f};const{webauthn:h}=u;return this._verify({factorId:t,challengeId:u.challengeId,webauthn:{type:h.type,rpId:n,rpOrigins:o,credential_response:h.credential_response}})}catch(t){return(0,i.isAuthError)(t)?{data:null,error:t}:{data:null,error:new i.AuthUnknownError('Unexpected error in authenticate',t)}}}async _register({friendlyName:t,webauthn:{rpId:n=('undefined'!=typeof window?window.location.hostname:void 0),rpOrigins:o=('undefined'!=typeof window?[window.location.origin]:void 0),signal:l}={}},s){if(!n)return{data:null,error:new i.AuthError('rpId is required for WebAuthn registration')};try{if(!c())return{data:null,error:new i.AuthUnknownError('Browser does not support WebAuthn',null)};const{data:u,error:f}=await this._enroll({friendlyName:t});if(!u)return await this.client.mfa.listFactors().then(n=>{var i;return null===(i=n.data)||void 0===i?void 0:i.all.find(n=>'webauthn'===n.factor_type&&n.friendly_name===t&&'unverified'!==n.status)}).then(t=>t?this.client.mfa.unenroll({factorId:null==t?void 0:t.id}):void 0),{data:null,error:f};const{data:h,error:b}=await this._challenge({factorId:u.id,friendlyName:u.friendly_name,webauthn:{rpId:n,rpOrigins:o},signal:l},{create:s});return h?this._verify({factorId:u.id,challengeId:h.challengeId,webauthn:{rpId:n,rpOrigins:o,type:h.webauthn.type,credential_response:h.webauthn.credential_response}}):{data:null,error:b}}catch(t){return(0,i.isAuthError)(t)?{data:null,error:t}:{data:null,error:new i.AuthUnknownError('Unexpected error in register',t)}}}}},1191,[1156,1184,1183,1182,1192]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"WebAuthnError",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"WebAuthnUnknownError",{enumerable:!0,get:function(){return t}}),e.isWebAuthnError=function(n){return'object'==typeof n&&null!==n&&'__isWebAuthnError'in n},e.identifyRegistrationError=function({error:t,options:s}){var u,c,R;const{publicKey:E}=s;if(!E)throw Error('options was missing required publicKey property');if('AbortError'===t.name){if(s.signal instanceof AbortSignal)return new o({message:'Registration ceremony was sent an abort signal',code:'ERROR_CEREMONY_ABORTED',cause:t})}else if('ConstraintError'===t.name){if(!0===(null===(u=E.authenticatorSelection)||void 0===u?void 0:u.requireResidentKey))return new o({message:'Discoverable credentials were required but no available authenticator supported it',code:'ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT',cause:t});if('conditional'===s.mediation&&'required'===(null===(c=E.authenticatorSelection)||void 0===c?void 0:c.userVerification))return new o({message:'User verification was required during automatic registration but it could not be performed',code:'ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE',cause:t});if('required'===(null===(R=E.authenticatorSelection)||void 0===R?void 0:R.userVerification))return new o({message:'User verification was required but no available authenticator supported it',code:'ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT',cause:t})}else{if('InvalidStateError'===t.name)return new o({message:'The authenticator was previously registered',code:'ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED',cause:t});if('NotAllowedError'===t.name)return new o({message:t.message,code:'ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY',cause:t});if('NotSupportedError'===t.name){return 0===E.pubKeyCredParams.filter(n=>'public-key'===n.type).length?new o({message:'No entry in pubKeyCredParams was of type "public-key"',code:'ERROR_MALFORMED_PUBKEYCREDPARAMS',cause:t}):new o({message:'No available authenticator supported any of the specified pubKeyCredParams algorithms',code:'ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG',cause:t})}if('SecurityError'===t.name){const s=window.location.hostname;if(!(0,n.isValidDomain)(s))return new o({message:`${window.location.hostname} is an invalid domain`,code:'ERROR_INVALID_DOMAIN',cause:t});if(E.rp.id!==s)return new o({message:`The RP ID "${E.rp.id}" is invalid for this domain`,code:'ERROR_INVALID_RP_ID',cause:t})}else if('TypeError'===t.name){if(E.user.id.byteLength<1||E.user.id.byteLength>64)return new o({message:'User ID was not between 1 and 64 characters',code:'ERROR_INVALID_USER_ID_LENGTH',cause:t})}else if('UnknownError'===t.name)return new o({message:'The authenticator was unable to process the specified options, or could not create a new credential',code:'ERROR_AUTHENTICATOR_GENERAL_ERROR',cause:t})}return new o({message:'a Non-Webauthn related error has occurred',code:'ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY',cause:t})},e.identifyAuthenticationError=function({error:t,options:s}){const{publicKey:u}=s;if(!u)throw Error('options was missing required publicKey property');if('AbortError'===t.name){if(s.signal instanceof AbortSignal)return new o({message:'Authentication ceremony was sent an abort signal',code:'ERROR_CEREMONY_ABORTED',cause:t})}else{if('NotAllowedError'===t.name)return new o({message:t.message,code:'ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY',cause:t});if('SecurityError'===t.name){const s=window.location.hostname;if(!(0,n.isValidDomain)(s))return new o({message:`${window.location.hostname} is an invalid domain`,code:'ERROR_INVALID_DOMAIN',cause:t});if(u.rpId!==s)return new o({message:`The RP ID "${u.rpId}" is invalid for this domain`,code:'ERROR_INVALID_RP_ID',cause:t})}else if('UnknownError'===t.name)return new o({message:'The authenticator was unable to process the specified options, or could not create a new assertion signature',code:'ERROR_AUTHENTICATOR_GENERAL_ERROR',cause:t})}return new o({message:'a Non-Webauthn related error has occurred',code:'ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY',cause:t})};var n=r(d[0]);class o extends Error{constructor({message:n,code:o,cause:t,name:s}){var u;super(n,{cause:t}),this.__isWebAuthnError=!0,this.name=null!==(u=null!=s?s:t instanceof Error?t.name:void 0)&&void 0!==u?u:'Unknown Error',this.code=o}toJSON(){return{name:this.name,message:this.message,code:this.code}}}class t extends o{constructor(n,o){super({code:'ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY',cause:o,message:n}),this.name='WebAuthnUnknownError',this.originalError=o}}},1192,[1191]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u}});var e,t=r(d[0]);var u=((e=t)&&e.__esModule?e:{default:e}).default},1193,[1178]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return u}});var e,t=r(d[0]);var u=((e=t)&&e.__esModule?e:{default:e}).default},1194,[1186]); +__d(function(g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.setSyncNamespace=function(e){s=t.IS_ISOLATED_VENUE?`cc-sync:${t.VENUE_RID}:${e}:`:`cc-sync:${e}:`},Object.defineProperty(_e,"syncNamespace",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"kv",{enumerable:!0,get:function(){return i}}),_e.uuid=function(){const e=globalThis.crypto;if(e?.randomUUID)return e.randomUUID();const t=new Uint8Array(16);if(e?.getRandomValues)e.getRandomValues(t);else for(let e=0;e<16;e++)t[e]=Math.floor(256*Math.random());t[6]=15&t[6]|64,t[8]=63&t[8]|128;const n=Array.from(t,e=>e.toString(16).padStart(2,'0')).join('');return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20)}`};var e,t=r(d[0]),n=r(d[1]),c=(e=n)&&e.__esModule?e:{default:e};let s=t.IS_ISOLATED_VENUE?`cc-sync:${t.VENUE_RID}:`:'cc-sync:';const o=()=>s,i={async get(e,t){try{const n=await c.default.getItem(s+e);return null==n?t:JSON.parse(n)}catch{return t}},async set(e,t){try{await c.default.setItem(s+e,JSON.stringify(t))}catch{}},async remove(e){try{await c.default.removeItem(s+e)}catch{}}}},1195,[5,1115]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"isOnline",{enumerable:!0,get:function(){return t}}),_e.setOnline=o,_e.onConnectivity=function(e){return n.add(e),()=>{n.delete(e)}},_e.isNetworkError=function(e){if(!e)return!1;const n=String(e.message??e).toLowerCase();return 0===e.status||/network|fetch failed|failed to fetch|timeout|timed out|offline|econn|enotfound|socket/.test(n)};let e=!0;const n=new Set,t=()=>e;function o(t){t!==e&&(e=t,n.forEach(n=>n(e)))}const s=globalThis.window;s?.addEventListener&&('boolean'==typeof s.navigator?.onLine&&(e=s.navigator.onLine),s.addEventListener('online',()=>o(!0)),s.addEventListener('offline',()=>o(!1)))},1196,[]); +__d(function(g,_r,i,a,_m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"TableRepository",{enumerable:!0,get:function(){return u}}),e.executeMutation=async function(t){const s=(t,s)=>{throw Object.assign(t,{status:s})};if('rpc'===t.kind){const{error:n,status:r}=await o().rpc(t.fn,t.values??{});return n&&s(n,r),'ok'}const n=o().from(t.table);if('upsert'===t.kind||'insert'===t.kind){const{error:r,status:o}=await n.upsert(t.values??{},{onConflict:t.conflictKey??'id',ignoreDuplicates:'insert'===t.kind});return r&&s(r,o),'ok'}let r='update'===t.kind?n.update(t.values??{}):n.delete();for(const[s,n]of Object.entries(t.match??{}))r=r.eq(s,n);const{data:u,error:c,status:h}=await r.select();c&&s(c,h);return'update'!==t.kind||u&&0!==u.length?'ok':'conflict'};var t=_r(d[0]),s=_r(d[1]),n=_r(d[2]),r=_r(d[3]);const o=()=>(0,s.getSupabase)();class u{constructor(t,s={}){this.table=t,this.opts=s,this.keyOf=s.keyOf??(t=>String(t.id)),this.keyColumns=s.keyColumns??['id'],this.venueCol=s.venueColumn??'venue_id'}rows(s){return t.cache.rows(this.table,s)}get(s,n){return t.cache.get(this.table,s,n)}subscribe(s,n){return t.cache.subscribe(this.table,s,n)}hydrate(s){return t.cache.hydrate(this.table,s)}async refresh(s,n={}){let u=o().from(this.table).select('*').eq(this.venueCol,s);this.opts.orderBy&&(u=u.order(this.opts.orderBy.column,{ascending:this.opts.orderBy.ascending??!0})),n.filter&&(u=n.filter(u));const{data:c,error:h}=await u.limit(this.opts.limit??1e3);if(h)throw h;const l=c??[];return t.cache.replace(this.table,s,l.map(t=>[this.keyOf(t),t]),t=>r.mutationQueue.hasPending(this.table,s,t)),l}async create(s,o){const u={...1===this.keyColumns.length&&'id'===this.keyColumns[0]?{id:(0,n.uuid)()}:{},...o,[this.venueCol]:s},c=this.keyOf(u);return t.cache.put(this.table,s,c,u),await r.mutationQueue.enqueue({table:this.table,venueId:s,kind:'insert'===this.opts.writeMode?'insert':'upsert',rowKey:c,values:u,conflictKey:this.opts.conflictKey??'id'}),u}async update(s,n,o,u={}){const c=t.cache.get(this.table,s,n),h={...this.matchFor(n,c),...u,[this.venueCol]:s};t.cache.patch(this.table,s,n,{...o,updated_at:(new Date).toISOString()}),await r.mutationQueue.enqueue({table:this.table,venueId:s,kind:'update',rowKey:n,values:o,match:h})}async remove(s,n){const o=t.cache.get(this.table,s,n),u={...this.matchFor(n,o),[this.venueCol]:s};t.cache.remove(this.table,s,n),await r.mutationQueue.enqueue({table:this.table,venueId:s,kind:'delete',rowKey:n,match:u})}matchFor(t,s){if(1===this.keyColumns.length&&'id'===this.keyColumns[0])return{id:t};const n={};for(const t of this.keyColumns)n[t]=s?.[t];return n}}},1197,[1198,862,1195,1094]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"cache",{enumerable:!0,get:function(){return w}});var t=r(d[0]);const n=new Map,s=new Map,c=new Map,o=new Map,u=new Set,l=(t,n)=>`cache:${t}:${n}`;function f(t){let s=n.get(t);return s||(s=new Map,n.set(t,s)),s}function p(n){s.delete(n),c.get(n)?.forEach(t=>t());const u=o.get(n);u&&clearTimeout(u),o.set(n,setTimeout(()=>{o.delete(n),t.kv.set(n,Array.from(f(n).entries()))},250))}const w={async hydrate(n,s){const c=l(n,s);if(u.has(c))return;u.add(c);const o=await t.kv.get(c,[]),w=f(c);let h=0;for(const[t,n]of o)w.has(t)||(w.set(t,n),h++);h&&p(c)},rows(t,n){const c=l(t,n);let o=s.get(c);return o||(o=Array.from(f(c).values()),s.set(c,o)),o},get:(t,n,s)=>f(l(t,n)).get(s),put(t,n,s,c){f(l(t,n)).set(s,c),p(l(t,n))},patch(t,n,s,c){const o=f(l(t,n)),u=o.get(s);u&&(o.set(s,{...u,...c}),p(l(t,n)))},remove(t,n,s){f(l(t,n)).delete(s)&&p(l(t,n))},replace(t,s,c,o=()=>!1){const u=l(t,s),w=f(u),h=new Map(c);w.forEach((t,n)=>{o(n)&&h.set(n,t)}),n.set(u,h),p(u)},subscribe(t,n,s){const o=l(t,n);let u=c.get(o);return u||(u=new Set,c.set(o,u)),u.add(s),()=>{u?.delete(s)}},async clearVenue(o,f){for(const p of f){const f=l(p,o);n.delete(f),s.delete(f),u.delete(f),await t.kv.remove(f),c.get(f)?.forEach(t=>t())}}}},1198,[1195]); +__d(function(g,r,i,a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.classifyWriteError=function(o){if((0,e.isNetworkError)(o))return'network';const{code:n,status:c,msg:l}=t(o);return s(o)?'refused':/^(08|53|57|58)/.test(n)||['40001','40P01','55P03','23505','23503'].includes(n)||/^PGRST30[0-3]$/.test(n)||/jwt|token.*expired/i.test(l)||401===c||408===c||425===c||429===c||c>=500?'retry':409!==c||n?'refused':'retry'},Object.defineProperty(_e,"retryDelayMs",{enumerable:!0,get:function(){return o}}),_e.describeWrite=function(e){const t='rpc'===e.kind?(e.fn??'change').replace(/_/g,' '):n[e.table]??e.table.replace(/_/g,' ').replace(/s$/,''),s=e.values??{},o=s.guest_name??s.name??s.display_name??s.title??s.reason,c='string'==typeof o&&o.trim()?` for ${o.trim().slice(0,60)}`:'';return'delete'===e.kind?`deleting a ${t}${c}`:`the ${t}${c}`},_e.plainReason=function(e,o){const{code:n,status:c,msg:l}=t(e);if('refused'===o)return s(e)?'more than 20 deletes in 10 minutes from one sign-in are stopped to keep your data safe':'42501'===n||403===c||/row-level security|permission/i.test(l)?'your sign-in isn\u2019t allowed to change this':'conflict'===n?'it was changed or removed on another device first':/^(22|23)/.test(n)?'the shared system says some of the details aren\u2019t valid':'P0001'===n&&l?l.slice(0,140):l?`the shared system said: ${l.slice(0,120)}`:'the shared system refused it';return'23505'===n?'the shared system already has another copy of it':'23503'===n?'a related change has to save first':/^PGRST30/.test(n)||401===c||/jwt/i.test(l)?'your sign-in is being refreshed':'the shared system is busy'};var e=r(d[0]);const t=e=>{const t=e&&'object'==typeof e?e:{};return{msg:String(t.message??e??''),code:String(t.code??''),status:Number(t.status??0)||0,hint:String(t.hint??'')}},s=e=>{const s=t(e);return/delete guard/i.test(s.hint)||/too many .* deleted in 10 minutes/i.test(s.msg)};const o=e=>Math.min(5e3*Math.pow(3,Math.max(0,e-1)),3e5),n={bookings:'booking',walk_ins:'walk-in',blocks:'blocked time',sold_out_items:'sold-out mark',sold_out_links:'dish stock link',staff:'staff details',rota_shifts:'rota shift',stock_items:'stock item',stock_events:'stock count',stock_counts:'stock count',chat_messages:'chat message',recipe_cards:'recipe card',order_lists:'order list',order_list_items:'order list item',daily_task_ticks:'task tick',daily_tasks:'daily task',attendance:'clock in or out',cash_ups:'cash-up',table_plans:'table plan',guest_profiles:'guest profile',floor_live:'table status',venues:'venue settings',time_requests:'time-off request',scheduled_notifications:'reminder',suppliers:'supplier',supplier_orders:'supplier order',takeaway_orders:'takeaway order'}},1199,[1196]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useAvatars",{enumerable:!0,get:function(){return l}});var t,e=r(d[0]),o=(t=e)&&t.__esModule?t:{default:t},s=r(d[1]),n=r(d[2]);const l=(0,s.create)()((0,n.persist)((t,e)=>({photos:{},log:[],setOwn:(e,o,s,n)=>{if(!e||e!==o||!s.startsWith('data:image/'))return!1;const l=(new Date).toISOString();return t(t=>({photos:{...t.photos,[o]:{dataUrl:s,at:l}},log:[{id:`av-${Date.now().toString(36)}`,staffId:o,what:'made',by:n,at:l},...t.log].slice(0,100)})),!0},reset:(o,s)=>{if(s.id!==o&&'staff'===s.role)return!1;if(!e().photos[o])return!1;const n={...e().photos};return delete n[o],t(t=>({photos:n,log:[{id:`av-${Date.now().toString(36)}`,staffId:o,what:'reset',by:s.name,at:(new Date).toISOString()},...t.log].slice(0,100)})),!0}}),{name:'covercharge-avatars-v1',storage:(0,n.createJSONStorage)(()=>o.default),version:1}))},1200,[1115,951,1116]); +__d(function(_g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"SETUP_STEPS",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"ACCESS_LEVELS",{enumerable:!0,get:function(){return l}}),Object.defineProperty(_e,"ACCESS_ROLE",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"ACCESS_APP",{enumerable:!0,get:function(){return c}}),Object.defineProperty(_e,"accessOf",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"PERMS",{enumerable:!0,get:function(){return b}}),Object.defineProperty(_e,"DEFAULT_PERMS",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"DEFAULT_GRADES",{enumerable:!0,get:function(){return S}}),Object.defineProperty(_e,"useSetup",{enumerable:!0,get:function(){return O}}),Object.defineProperty(_e,"useSiteSetup",{enumerable:!0,get:function(){return P}}),Object.defineProperty(_e,"setupProgress",{enumerable:!0,get:function(){return w}});var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},i=r(d[1]),s=r(d[2]);const o=[{id:'venue',title:'Venue details & logo',sub:'Name, address, phone, your logo and order at table'},{id:'hours',title:'Opening hours',sub:'When the kitchen is open each day'},{id:'plan',title:'Areas & table plan',sub:'Your areas, tables and seats'},{id:'paygrades',title:'Pay grades',sub:'Named hourly rates for your team'},{id:'staff',title:'Add staff',sub:'Name, role, access, pay and avatar'},{id:'permissions',title:'Permissions',sub:'What each access level can do'},{id:'email',title:'Link email',sub:'Your work email address'},{id:'website',title:'Link website',sub:'Your website and booking link'},{id:'invites',title:'Staff invite links',sub:'Personal links for each person'}],l=['Owner','Manager','Supervisor','Head Chef','Staff'],u={Owner:'owner',Manager:'manager',Supervisor:'manager','Head Chef':'staff',Staff:'staff'},c={Owner:'Managers',Manager:'Managers',Supervisor:'Managers','Head Chef':'Head Chef',Staff:'Staff'},f=(e,t)=>l.includes(e??'')?e:'owner'===t?'Owner':'manager'===t?'Manager':'Staff',b=[{id:'bookings',label:'Take and change bookings'},{id:'walkins',label:'Seat walk-ins'},{id:'block',label:'Block bookings and close the garden'},{id:'tableplan',label:'Edit the table plan'},{id:'kitchen',label:'Kitchen tickets and allergy ticks'},{id:'menu',label:'Edit the menu and allergens'},{id:'rota',label:'Make the rota'},{id:'timesheets',label:'Approve timesheets'},{id:'pay',label:'See pay and wages'},{id:'takings',label:'See takings and reports'},{id:'staff',label:'Add staff and change access'},{id:'settings',label:'Change venue settings'},{id:'billing',label:'Plan and billing'}],p=e=>Object.fromEntries(b.map(t=>[t.id,e])),g=e=>({...p(!1),...Object.fromEntries(e.map(e=>[e,!0]))}),h={Owner:p(!0),Manager:{...p(!0),staff:!1,billing:!1},Supervisor:g(['bookings','walkins','block','tableplan','kitchen','rota']),'Head Chef':g(['kitchen','menu','rota']),Staff:g(['bookings','walkins'])},S=[{id:'pg-foh',name:'Front of house',pence:1271},{id:'pg-bar',name:'Bar team',pence:1271},{id:'pg-kp',name:'Kitchen porter',pence:1271},{id:'pg-cdp',name:'Chef de partie',pence:1450},{id:'pg-sup',name:'Supervisor',pence:1400}],k=()=>({done:{},grades:S.map(e=>({...e})),staffGrade:{},perms:JSON.parse(JSON.stringify(h)),email:'',website:'',bookingUrl:'',invites:{}}),O=(0,i.create)()((0,s.persist)((e,t)=>({sites:{},looks:{},patch:(t,n)=>e(e=>({sites:{...e.sites,[t]:{...e.sites[t]??k(),...n}}})),markDone:(e,n,i=!0)=>{const s={...(t().sites[e]??k()).done};i?s[n]=(new Date).toISOString():delete s[n],t().patch(e,{done:s})},setPerm:(e,n,i,s)=>{const o=t().sites[e]??k();'Owner'!==n&&t().patch(e,{perms:{...o.perms,[n]:{...o.perms[n],[i]:s}}})},resetPerms:e=>t().patch(e,{perms:JSON.parse(JSON.stringify(h))}),setLook:(t,n)=>e(e=>{const i={...e.looks};return null==n?delete i[t]:i[t]=n,{looks:i}})}),{name:'covercharge-setup-v1',storage:(0,s.createJSONStorage)(()=>n.default),version:1})),P=e=>O(t=>t.sites[e])??y,y=k(),w=e=>{const t=o.filter(t=>e.done[t.id]).length;return{done:t,total:o.length,pct:t/o.length}}},1201,[1115,951,1116]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"SEED_INGREDIENTS",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"SEED_RECIPES",{enumerable:!0,get:function(){return h}}),Object.defineProperty(_e,"WASTE_REASONS",{enumerable:!0,get:function(){return f}}),_e.stripKitchenExamples=S,Object.defineProperty(_e,"useKitchen",{enumerable:!0,get:function(){return w}});var e,t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),n=_r(_d[3]),r=_r(_d[4]),o=_r(_d[5]),d=(e=o)&&e.__esModule?e:{default:e},c=_r(_d[6]),l=_r(_d[7]);const p=(e,t,s,i,n,r,o,d=[],c)=>({id:e,name:t,unit:s,cost:i,supplierId:n,par:r,onHand:o,allergens:d,prevCost:c}),u=[p('haddock','Haddock fillet','kg',1848,'sup-1',14,9.5,['fish'],1650),p('smk-haddock','Smoked haddock','kg',1500,'sup-1',4,3.2,['fish']),p('smk-salmon','Smoked salmon','kg',2800,'sup-1',3,1.1,['fish']),p('crab','White and brown crab meat','kg',3800,'sup-1',3,2.4,['crustaceans']),p('mussels','Rope mussels','kg',450,'sup-1',12,0,['molluscs']),p('langoustine','Langoustines','kg',2600,'sup-1',6,4.5,['crustaceans']),p('lobster','Lobster (whole)','each',1800,'sup-1',6,4,['crustaceans']),p('prawns','Prawns (cooked, peeled)','kg',1400,'sup-1',3,2.6,['crustaceans']),p('beef-fillet','Beef fillet','kg',4800,'sup-2',4,2.9),p('steak','Braising steak','kg',1200,'sup-2',8,6.2),p('patty','Burger patty 6 oz','each',160,'sup-2',40,18),p('chicken','Chicken breast','kg',950,'sup-2',10,7.5),p('chorizo','Chorizo','kg',1400,'sup-2',2,1.6,['sulphites']),p('haggis','Haggis','kg',900,'sup-2',4,3.5,['gluten','celery']),p('potatoes','Potatoes (chipping)','kg',90,'sup-3',75,40),p('onions','Onions','kg',110,'sup-3',15,11),p('leaves','Salad leaves','kg',700,'sup-3',3,.8),p('lemons','Lemons','each',25,'sup-3',60,44),p('milk','Whole milk','L',110,'sup-4',20,14,['milk']),p('cream','Double cream','L',380,'sup-4',12,9,['milk']),p('butter','Butter','kg',850,'sup-4',6,4.5,['milk']),p('cheddar','Mature cheddar','kg',900,'sup-4',5,3.8,['milk']),p('parmesan','Parmesan','kg',1800,'sup-4',2,1.4,['milk']),p('eggs','Free-range eggs','each',28,'sup-4',120,90,['eggs']),p('ice-cream','Vanilla ice cream','L',450,'sup-4',10,7,['milk','eggs']),p('flour','Plain flour','kg',90,'sup-5',16,12,['gluten']),p('batter','Beer batter mix','kg',220,'sup-5',12,3.5,['gluten']),p('pastry','Puff pastry','kg',450,'sup-5',6,4.2,['gluten','milk']),p('macaroni','Macaroni','kg',180,'sup-5',6,5,['gluten']),p('penne','Penne','kg',180,'sup-5',6,4.5,['gluten']),p('buns','Brioche buns','each',45,'sup-5',40,30,['gluten','eggs','milk','sesame']),p('baguette','Garlic baguette','each',90,'sup-5',24,16,['gluten','milk']),p('oil','Rapeseed oil (fryer)','L',200,'sup-5',60,32),p('sponge','Sticky toffee sponge (portion)','each',95,'sup-5',30,22,['gluten','eggs','milk']),p('truffle-oil','Truffle oil','L',3e3,'sup-5',1,.6)],k=(e,t,s)=>({dishId:e,yield:t,lines:s.map(([e,t])=>({ing:e,qty:t}))}),h=[k('a-fishsupper','1 portion (220 g fillet)',[['haddock',.22],['batter',.06],['potatoes',.35],['oil',.05],['lemons',1]]),k('a-skink','1 bowl',[['smk-haddock',.08],['potatoes',.1],['milk',.15],['cream',.05],['onions',.03],['butter',.01]]),k('a-salmon','1 plate',[['smk-salmon',.07],['cream',.03],['leaves',.02],['lemons',1]]),k('a-haggis','1 plate',[['haggis',.1],['flour',.02],['eggs',1],['oil',.03]]),k('a-crabcakes','2 cakes',[['crab',.08],['potatoes',.06],['flour',.02],['eggs',1],['leaves',.02]]),k('a-tempura','1 plate',[['haddock',.07],['prawns',.05],['onions',.05],['batter',.06],['oil',.04],['lemons',1]]),k('a-mini','Kids fish & chips + ice cream',[['haddock',.1],['potatoes',.2],['batter',.03],['oil',.03],['ice-cream',.05]]),k('a-pie','1 pie',[['steak',.22],['pastry',.08],['onions',.05],['potatoes',.3],['oil',.03]]),k('a-chicken','1 plate',[['chicken',.22],['potatoes',.25],['cream',.05],['butter',.02]]),k('a-maccheese','1 bowl',[['macaroni',.12],['cheddar',.08],['milk',.2],['butter',.02],['flour',.015]]),k('a-penne','1 bowl',[['penne',.12],['chicken',.15],['chorizo',.04],['cream',.08],['parmesan',.01]]),k('a-caesar','1 plate',[['chicken',.16],['leaves',.08],['parmesan',.015],['eggs',1],['baguette',.25]]),k('a-moules','1 pot',[['mussels',.5],['cream',.08],['onions',.03],['baguette',.5]]),k('a-fillet','8 oz steak',[['beef-fillet',.227],['potatoes',.35],['onions',.05],['oil',.05],['butter',.02]]),k('a-claymore','1 burger',[['patty',1],['buns',1],['cheddar',.03],['potatoes',.3],['onions',.06],['batter',.03],['oil',.05]]),k('a-langoustines','1 plate',[['langoustine',.35],['butter',.03],['baguette',.5],['leaves',.03],['lemons',1]]),k('a-lobster','1 lobster',[['lobster',1],['butter',.04],['potatoes',.3],['oil',.04],['leaves',.03],['lemons',1]]),k('a-smorgasbord','Serves one',[['langoustine',.3],['mussels',.3],['crab',.08],['prawns',.1],['smk-salmon',.06],['leaves',.05],['lemons',2]]),k('a-deluxe','Serves two',[['lobster',1],['langoustine',.5],['crab',.15],['mussels',.5],['prawns',.15],['smk-salmon',.1],['leaves',.1],['lemons',3],['baguette',1]]),k('a-chips','1 side',[['potatoes',.35],['oil',.05]]),k('a-onionrings','1 side',[['onions',.15],['batter',.06],['oil',.04]]),k('a-garlicbread','1 side',[['baguette',.5],['butter',.02]]),k('a-truffle','1 side',[['potatoes',.35],['oil',.05],['parmesan',.015],['truffle-oil',.005]]),k('a-salad','1 side',[['leaves',.06],['lemons',.5]]),k('a-stp','1 portion',[['sponge',1],['cream',.05],['butter',.02],['ice-cream',.08]])],f=['Out of date','Spoiled','Over-production','Dropped / burnt','Returned by customer','Prep trim'],b=(e,t=10)=>{const s=new Date;return s.setDate(s.getDate()-e),s.setHours(t,0,0,0),s.toISOString()},y=e=>`${e}-${Math.random().toString(36).slice(2,8)}`;function v(){return{ingredients:u.map(e=>({...e})),recipes:h,targetGp:70,deliveries:[{id:'dl-today-fish',supplierId:'sup-1',due:'today',status:'expected',lines:[{ing:'haddock',ordered:10,received:8,price:1848},{ing:'mussels',ordered:12,received:12,price:450},{ing:'langoustine',ordered:3,received:3,price:2750},{ing:'smk-salmon',ordered:2,received:2,price:2800}]},{id:'dl-today-veg',supplierId:'sup-3',due:'today',status:'expected',lines:[{ing:'potatoes',ordered:50,received:50,price:90},{ing:'leaves',ordered:3,received:2,price:700},{ing:'lemons',ordered:30,received:30,price:25}]}],stockTakes:[{id:'stk-1',at:b(7,22),by:'Head Chef (example)',lines:[{ing:'haddock',expected:6,counted:5.4,cost:1650},{ing:'potatoes',expected:30,counted:28,cost:90},{ing:'cream',expected:8,counted:8,cost:380},{ing:'beef-fillet',expected:3.2,counted:3,cost:4800}]}],waste:[{id:'w1',at:b(1,21),by:'Head Chef (example)',item:'Haddock fillet',ing:'haddock',qty:.6,unit:'kg',reason:'Over-production',cost:1109},{id:'w2',at:b(2,15),by:'Head Chef (example)',item:'Salad leaves',ing:'leaves',qty:.5,unit:'kg',reason:'Spoiled',cost:350},{id:'w3',at:b(3,20),by:'Head Chef (example)',item:'Fish supper',qty:1,unit:'portion',reason:'Dropped / burnt',cost:517},{id:'w4',at:b(4,11),by:'Head Chef (example)',item:'Double cream',ing:'cream',qty:1,unit:'L',reason:'Out of date',cost:380},{id:'w5',at:b(5,22),by:'Head Chef (example)',item:'Chips',ing:'potatoes',qty:3,unit:'kg',reason:'Over-production',cost:270}],orders:[{id:'po-1',supplierId:'sup-1',at:b(1,13),by:'Head Chef (example)',status:'placed (by phone)',lines:[{ing:'haddock',qty:10,cost:1848},{ing:'mussels',qty:12,cost:450},{ing:'langoustine',qty:3,cost:2600},{ing:'smk-salmon',qty:2,cost:2800}],total:30520},{id:'po-2',supplierId:'sup-3',at:b(1,18),by:'Head Chef (example)',status:'placed (on website)',lines:[{ing:'potatoes',qty:50,cost:90},{ing:'leaves',qty:3,cost:700},{ing:'lemons',qty:30,cost:25}],total:7350}],prepTicks:{},temps:[{id:'t1',at:b(0,9),by:'Head Chef (example)',kind:'fridge',unit:'Walk-in fridge',temp:3},{id:'t2',at:b(0,9),by:'Head Chef (example)',kind:'freezer',unit:'Chest freezer',temp:-20}]}}function S(e){const t=v(),s=(e,t)=>t.some(t=>JSON.stringify(t)===JSON.stringify(e)),i=e.recipes.filter(e=>!s(e,t.recipes)),r=e.deliveries.filter(e=>!t.deliveries.some(t=>t.id===e.id&&t.supplierId===e.supplierId&&t.due===e.due&&'expected'===e.status&&!e.checkedBy&&!e.note&&JSON.stringify(t.lines)===JSON.stringify(e.lines))),o=e.stockTakes.filter(e=>!(0,n.demoActor)(e.by)),d=e.waste.filter(e=>!(0,n.demoActor)(e.by)),c=e.orders.filter(e=>!(0,n.demoActor)(e.by)),l=e.temps.filter(e=>!(0,n.demoActor)(e.by)),p=new Set([...i,...r,...o,...c].flatMap(e=>e.lines.map(e=>e.ing)));return d.forEach(e=>{e.ing&&p.add(e.ing)}),{ingredients:e.ingredients.filter(e=>p.has(e.id)||!s(e,t.ingredients)),recipes:i,deliveries:r,stockTakes:o,waste:d,orders:c,temps:l}}const w=(0,c.create)()((0,l.persist)(e=>({...r.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD?{targetGp:70,ingredients:[],recipes:[],deliveries:[],stockTakes:[],waste:[],orders:[],prepTicks:{},temps:[]}:v(),setTarget:t=>e({targetGp:Math.max(40,Math.min(90,Math.round(t)))}),setIngredient:(t,s)=>e(e=>({ingredients:e.ingredients.map(e=>e.id===t?{...e,...s}:e)})),setRecipeQty:(t,s,i)=>e(e=>({recipes:e.recipes.map(e=>e.dishId!==t?e:{...e,lines:i>0?e.lines.some(e=>e.ing===s)?e.lines.map(e=>e.ing===s?{...e,qty:i}:e):[...e.lines,{ing:s,qty:i}]:e.lines.filter(e=>e.ing!==s)})})),acceptDelivery:(t,i,n,o)=>e(e=>({deliveries:e.deliveries.map(e=>e.id===t?{...e,lines:i,status:'accepted',checkedBy:n,at:(new Date).toISOString(),note:o}:e),ingredients:e.ingredients.map(e=>{const t=i.find(t=>t.ing===e.id);return t?{...e,onHand:(0,s.fishInStone)(r.VENUE_RID,e)?e.onHand+t.received:Math.round(100*(e.onHand+t.received))/100,...t.price!==e.cost?{prevCost:e.cost,cost:t.price}:{}}:e})})),saveStockTake:(t,s)=>e(e=>({stockTakes:[{id:y('stk'),at:(new Date).toISOString(),by:s,lines:Object.entries(t).map(([t,s])=>{const i=e.ingredients.find(e=>e.id===t);return{ing:t,expected:i.onHand,counted:s,cost:i.cost}})},...e.stockTakes],ingredients:e.ingredients.map(e=>e.id in t?{...e,onHand:t[e.id]}:e)})),addWaste:t=>e(e=>({waste:[{...t,id:y('w'),at:(new Date).toISOString()},...e.waste],ingredients:t.ing?e.ingredients.map(e=>e.id===t.ing?{...e,onHand:Math.max(0,(0,s.fishInStone)(r.VENUE_RID,e)?e.onHand-t.qty:Math.round(100*(e.onHand-t.qty))/100)}:e):e.ingredients})),addOrder:t=>{const s=y('po');return e(e=>({orders:[{...t,id:s,at:(new Date).toISOString()},...e.orders]})),s},setOrderStatus:(t,s)=>e(e=>({orders:e.orders.map(e=>e.id===t?{...e,status:s}:e)})),tickPrep:(t,s)=>e(e=>{const i={...e.prepTicks};return s?i[t]={by:s,at:(new Date).toISOString()}:delete i[t],{prepTicks:i}}),addTemp:t=>e(e=>({temps:[{...t,id:y('t'),at:(new Date).toISOString()},...e.temps]})),reset:()=>e(r.IS_ISOLATED_VENUE||t.LIVE_VENUE_BUILD?{targetGp:70,ingredients:[],recipes:[],deliveries:[],stockTakes:[],waste:[],orders:[],prepTicks:{},temps:[]}:v())}),{name:'covercharge-kitchen-v1',version:3,storage:(0,l.createJSONStorage)(()=>d.default),migrate:async e=>{const s=e;return t.LIVE_VENUE_BUILD?(await(0,i.archiveChefCache)('kitchen',s),{...s,...S(s)}):s}}))},1202,[833,1024,1131,1023,5,1115,951,1116]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"GREENSIDE_PALETTE",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"GREENSIDE_DISPLAY",{enumerable:!0,get:function(){return o}});const t={bg:'#1A1A1A',surface:'#222222',surface2:'#292929',border:'#62675E',gold:'#7DB754',goldLight:'#AED28E',goldTint:'#25321E',goldMuted:'#A1C783',tile:'#222222',tilePressed:'#2D3428',accentBg:'rgba(125,183,84,0.13)',accentBorder:'rgba(125,183,84,0.55)',onGold:'#1A1A1A',ok:'#AED28E',okBg:'#25321E',blue:'#AED28E',blueBg:'#25321E'},o={quietBorder:'rgba(125,183,84,0.55)',quietPressed:'rgba(125,183,84,0.16)',primaryPressed:'#6D9F49'}},1203,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.fixSupplierNames=function(n){return n?s.reduce((s,[n,b])=>s.replace(n,b),n):n};const s=[[/\bAl{2}sons?'?s?\b|\bAlson's\b/g,'Alsons'],[/\bSpe[zs] ?[Bb]ona\b|\bSpezbona\b/g,'Spes Bona']]},1204,[]); +__d(function(g,r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DEFAULT_ORDER_LIST_SETTINGS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"UNITS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"DAY_FULL",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"normName",{enumerable:!0,get:function(){return a}}),e.findDuplicate=function(t,n,i,s){return t.find(t=>t.listId===n&&!t.removed&&'open'===t.status&&a(t.name)===a(i)&&u(t.unit)===u(s))},e.bumpQty=function(t,n,i,a,u){return{...t,qty:Math.round(100*(t.qty+n))/100,bumps:[...t.bumps??[],{by:i,name:a,qty:n,at:u}],updatedAt:u}},Object.defineProperty(e,"qtyText",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"validQty",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"liveItems",{enumerable:!0,get:function(){return d}}),e.finishOrder=function(t,n,i,a,u,s){const o=d(n,t.id),l=o.filter(t=>'got'!==t.status),c={id:s(),listId:t.id,listName:t.name,finishedAt:u,finishedBy:a.id,finishedByName:a.name,items:o.map(t=>({name:t.name,qty:t.qty,unit:t.unit,note:t.note,status:t.status,addedByName:t.addedByName})),carried:i?l.length:0},p=i?l.map(t=>({...t,status:'open',carried:'missing'===t.status?'missing':'not-got',statusBy:void 0,statusAt:void 0,updatedAt:u})):[],m=new Set(p.map(t=>t.id));return{round:c,drop:o.filter(t=>!m.has(t.id)).map(t=>t.id),carriedOver:p}},e.nextTripDate=p,e.tripText=function(t,n,a){const u=p(t,n,a);if(!u)return'Running list';const[,s,o]=u.split('-').map(Number);return"Next trip "+(u===n?'today':u===l(n,1)?'tomorrow':`${i[c(u)]} ${o} ${['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'][s-1]}`)},e.initials=function(t){const n=t.replace(/\(.*?\)/g,' ').split(/[^A-Za-z0-9]+/).filter(t=>t&&!['and','the','of','&'].includes(t.toLowerCase()));return n.length?(1===n.length?n[0].slice(0,2):n[0][0]+n[1][0]).toUpperCase():'?'},e.telHref=function(t){if(!t)return null;const n=t.trim().replace(/[^\d+]/g,'').replace(/(?!^)\+/g,'');return n.replace(/\D/g,'').length>=6?`tel:${n}`:null};const t={allowStaff:!0,defaultTripDay:5},n=['','cases','bottles','kegs','boxes','bags','packs','kg','litres','each'],i=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],a=t=>t.trim().toLowerCase().replace(/[\u2019']/g,"'").replace(/\s+/g,' ').replace(/s$/,''),u=t=>t.trim().toLowerCase().replace(/s$/,'');const s=t=>`${Number.isInteger(t.qty)?t.qty:t.qty.toFixed(2).replace(/0$/,'')}${t.unit?` ${t.unit}`:''}`,o=t=>Number.isFinite(t)&&t>0&&t<=9999,d=(t,n)=>t.filter(t=>t.listId===n&&!t.removed).sort((t,n)=>('open'===t.status?0:1)-('open'===n.status?0:1)||t.addedAt.localeCompare(n.addedAt));const l=(t,n)=>{const[i,a,u]=t.split('-').map(Number);return new Date(Date.UTC(i,a-1,u+n)).toISOString().slice(0,10)},c=t=>{const[n,i,a]=t.split('-').map(Number);return new Date(Date.UTC(n,i-1,a)).getUTCDay()};function p(n,i,a=t.defaultTripDay){if('trip'!==n.kind)return null;if(n.nextTrip&&n.nextTrip>=i)return n.nextTrip;const u=n.tripDay??a;return l(i,(u-c(i)+7)%7)}},1205,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useClockArea",{enumerable:!0,get:function(){return o}}),Object.defineProperty(_e,"areaOf",{enumerable:!0,get:function(){return _}});var e,t=r(d[0]),n=r(d[1]),s=r(d[2]),u=(e=s)&&e.__esModule?e:{default:e},c=r(d[3]),l=r(d[4]),E=r(d[5]);const o=(0,c.create)()((0,l.persist)(e=>({areas:(0,n.privateClockVenue)(t.VENUE_RID)?{[t.VENUE_RID]:(0,n.venueClockArea)(t.VENUE_RID)}:{},visiting:{},set:(s,u,c)=>e(e=>t.IS_ISOLATED_VENUE&&s!==t.VENUE_RID?e:{areas:{...e.areas,[s]:{...(0,n.venueClockArea)(s,{...e.areas[s]??{},...u}),updatedAt:(new Date).toISOString(),updatedBy:c}}}),reset:(s,u)=>e(e=>t.IS_ISOLATED_VENUE&&s!==t.VENUE_RID?e:{areas:{...e.areas,[s]:{...(0,n.venueClockArea)(s,{lat:e.areas[s]?.lat??null,lng:e.areas[s]?.lng??null}),updatedAt:(new Date).toISOString(),updatedBy:u}}}),setVisiting:t=>e(e=>({visiting:Object.fromEntries([...Object.entries(e.visiting).slice(-60),[t,!0]])}))}),{name:'covercharge-clock-area-v1',version:1,storage:(0,l.createJSONStorage)(()=>u.default)})),_=e=>t.IS_ISOLATED_VENUE&&e!==t.VENUE_RID?(0,E.cleanArea)(E.DEFAULT_CLOCK_AREA):(0,n.venueClockArea)(e,o.getState().areas[e]??{})},1206,[5,987,1115,951,1116,953]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.inviteStatus=function(){return{'st-tracy':{state:'used',usedAt:s(3e3),devices:2},'st-gordon':{state:'used',usedAt:s(2940),devices:2},'st-bisto':{state:'used',usedAt:s(1800),devices:1},'st-agate':{state:'used',usedAt:s(1680),devices:1},'st-lenny':{state:'used',usedAt:s(1560),devices:1},'st-finn':{state:'unused',expiresAt:a(52),devices:0},'st-eilidh':{state:'used',usedAt:s(1200),devices:1},'st-emily':{state:'expired',devices:0},'st-lillie':{state:'used',usedAt:s(480),devices:1},'st-jack':{state:'unused',expiresAt:a(70),devices:0}}},e.reissueInvite=async function(t){const s='st-bisto'===t?'chef':['st-tracy','st-gordon','st-agate'].includes(t)?'owner':'staff';return{ok:!0,token:'DEMO-link-not-real-0000',expiresAt:a(72),app:s}},e.unlockCashUp=async function(s,a,n){const c=new Date(Date.now()+18e5).toISOString();'cashup'===s?t.useCashUp.setState(t=>({cashUps:t.cashUps.map(t=>t.id===a?{...t,unlockedUntil:c}:t)})):t.useCashUp.setState(t=>({sales:t.sales.map(t=>t.id===a?{...t,unlockedUntil:c}:t)}));return{ok:!0,until:c}},e.cashAudit=async function(t){return[{at:s(780),action:'unlocked',by:'Morgan',tbl:'cash_ups',reason:'Card total keyed as 1,284 not 1,248',changed:[]},{at:s(768),action:'changed',by:'Alex',tbl:'cash_ups',changed:['card']},{at:s(840),action:'created',by:'Alex',tbl:'cash_ups',changed:[]}]},e.pitchRpc=function(t,s){switch(t){case'list_displays':return n;case'create_display_code':case'new_code_for_display':return[{code:'DEMO7K2QX',expires_at:a(24*Number(s.p_hours?Number(s.p_hours)/24:7))}];default:return[]}};var t=r(d[0]);const s=t=>new Date(Date.now()-6e4*t).toISOString(),a=t=>new Date(Date.now()+36e5*t).toISOString();const n=[{id:'pd-1',label:'Front desk tablet',can_write:!0,created_at:s(17280),last_seen_at:s(2),revoked_at:null,sessions:1,open_codes:0},{id:'pd-2',label:'Kitchen pass tablet',can_write:!1,created_at:s(12960),last_seen_at:s(5),revoked_at:null,sessions:1,open_codes:0}]},1207,[1092]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useChatSync",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"chatSynced",{enumerable:!0,get:function(){return n}});const t=(0,r(d[0]).create)(()=>({synced:!1,checked:!1})),n=()=>t.getState().synced},1208,[951]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1209,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var u in n)Object.defineProperty(t,u,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,u).get})})(e,{get Badge(){return x.Badge},get DarkTheme(){return y.DarkTheme},get DefaultTheme(){return _.DefaultTheme},get ErrorBoundary(){return v.ErrorBoundary},get ExperimentalStack(){return U.ExperimentalStack},get ExpoRoot(){return c.ExpoRoot},get Icon(){return x.Icon},get IsWithinNativeNavigator(){return B.IsWithinNativeNavigator},get Label(){return x.Label},get LocaleProvider(){return I.LocaleProvider},get NativeStackView(){return E.NativeStackView},get NavigationAwareActivity(){return R.NavigationAwareActivity},get Navigator(){return t.Navigator},get RouterActionHandling(){return C.RouterActionHandling},get Sitemap(){return b.Sitemap},get Slot(){return t.Slot},get SplashScreen(){return S},get StackRouter(){return C.StackRouter},get SuspenseFallback(){return f.SuspenseFallback},get TabRouter(){return C.TabRouter},get Tabs(){return M.Tabs},get ThemeProvider(){return T.ThemeProvider},get Unmatched(){return l.Unmatched},get VectorIcon(){return x.VectorIcon},get attachRouteState(){return C.attachRouteState},get createBaseStackProps(){return j.createBaseStackProps},get createBaseTabProps(){return D.createBaseTabProps},get createNativeStackProps(){return W.createNativeStackProps},get createStandardRouterNavigator(){return B.createStandardRouterNavigator},get enableLegacyHeaderAppearance(){return F.enableLegacyHeaderAppearance},get extendRouter(){return C.extendRouter},get extendRouterActions(){return C.extendRouterActions},get integrateWithRouter(){return B.integrateWithRouter},get isActionHandled(){return C.isActionHandled},get router(){return u.router},get unstable_PerformanceObserver(){return G.unstable_PerformanceObserver},get unstable_createStandardRouterNavigator(){return B.unstable_createStandardRouterNavigator},get unstable_enablePerformanceIntegration(){return G.unstable_enablePerformanceIntegration},get unstable_integrateWithRouter(){return B.unstable_integrateWithRouter},get unstable_performance(){return G.unstable_performance},get unstable_useIsNavigating(){return o.useIsNavigating},get unstable_useReconcileTabHistory(){return H.useReconcileTabHistory},get useCanGoBack(){return n.useCanGoBack},get useCurrentRouteInfo(){return n.useCurrentRouteInfo},get useFocusEffect(){return h.useFocusEffect},get useGlobalSearchParams(){return n.useGlobalSearchParams},get useIsFocused(){return N.useIsFocused},get useLoaderData(){return n.useLoaderData},get useLocalSearchParams(){return n.useLocalSearchParams},get useNavigation(){return P.useNavigation},get useNavigationContainerRef(){return n.useNavigationContainerRef},get usePathname(){return n.usePathname},get usePreventRemove(){return L.usePreventRemove},get useRootNavigation(){return n.useRootNavigation},get useRootNavigationState(){return n.useRootNavigationState},get useRoute(){return A.useRoute},get useRoutePath(){return O.useRoutePath},get useRouter(){return n.useRouter},get useScrollToTop(){return w.useScrollToTop},get useSegments(){return n.useSegments},get useSitemap(){return p.useSitemap},get useTheme(){return k.useTheme},get useUnstableGlobalHref(){return n.useUnstableGlobalHref},get withLayoutContext(){return s.withLayoutContext}});const t=r(d[0]),n=r(d[1]),u=r(d[2]),o=r(d[3]),s=r(d[4]),c=r(d[5]),l=r(d[6]),b=r(d[7]),p=r(d[8]),v=r(d[9]),f=r(d[10]),R=r(d[11]),S=q(r(d[12])),P=r(d[13]),h=r(d[14]),N=r(d[15]),y=r(d[16]),_=r(d[17]),T=r(d[18]),k=r(d[19]),I=r(d[20]),O=r(d[21]),w=r(d[22]),A=r(d[23]),L=r(d[24]),x=r(d[25]),B=r(d[26]),H=r(d[27]),j=r(d[28]),D=r(d[29]),W=r(d[30]),C=r(d[31]),E=r(d[32]),F=r(d[33]),G=r(d[34]),M=r(d[35]),U=r(d[36]);function V(t){if("function"!=typeof WeakMap)return null;var n=new WeakMap,u=new WeakMap;return(V=function(t){return t?u:n})(t)}function q(t,n){if(!n&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var u=V(n);if(u&&u.has(t))return u.get(t);var o={__proto__:null},s=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var c in t)if("default"!==c&&Object.prototype.hasOwnProperty.call(t,c)){var l=s?Object.getOwnPropertyDescriptor(t,c):null;l&&(l.get||l.set)?Object.defineProperty(o,c,l):o[c]=t[c]}return o.default=t,u&&u.set(t,o),o}},1210,[694,419,512,1211,712,32,766,757,760,1212,664,662,667,533,537,542,481,483,447,448,1213,488,489,478,476,524,711,657,725,1214,724,358,703,708,378,1215,1218]); +__d(function(g,r,i,a,m,e,d){"use strict";function n(){const t=r(d[0]);return n=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"useIsNavigating",{enumerable:!0,get:function(){return u}});const t=r(d[1]);function u(){return(0,n().use)(t.NavigationPendingContext)}},1211,[30,375]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const o=r(d[0]);return t=function(){return o},o}function o(){const t=r(d[1]);return o=function(){return t},t}function n(){const t=r(d[2]);return n=function(){return t},t}function l(){const t=r(d[3]);return l=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"ErrorBoundary",{enumerable:!0,get:function(){return f}});r(d[4]);const s=r(d[5]),c=r(d[6]),u=r(d[7]);function h({error:o}){return(0,t().jsxs)(n().View,{style:{marginBottom:12,gap:4,flexWrap:'wrap'},children:[(0,t().jsx)(n().Text,{role:"heading","aria-level":1,style:y.title,children:"Something went wrong"}),(0,t().jsxs)(n().Text,{testID:"router_error_message",role:"heading","aria-level":2,style:y.errorMessage,children:["Error: ",o.message]})]})}function f({error:f,retry:x}){const w=(0,o().use)(s.BottomTabBarHeightContext)?n().View:l().SafeAreaView,S=f instanceof c.ReactServerError;return(0,t().jsx)(n().View,{style:y.container,children:(0,t().jsxs)(w,{style:{flex:1,gap:8,maxWidth:720,marginHorizontal:'auto'},children:[S?(0,t().jsx)(b,{error:f}):(0,t().jsx)(h,{error:f}),(0,t().jsx)(n().View,{style:{flex:1}}),!1,(0,t().jsx)(u.Pressable,{testID:"router_error_retry",onPress:x,children:({hovered:o,pressed:l})=>(0,t().jsx)(n().View,{style:[y.buttonInner,(o||l)&&{backgroundColor:'white'}],children:(0,t().jsx)(n().Text,{style:[y.buttonText,{color:o||l?'black':'white'}],children:"Retry"})})})]})})}const x={404:'NOT_FOUND',500:'INTERNAL_SERVER_ERROR',503:'SERVICE_UNAVAILABLE',504:'GATEWAY_TIMEOUT'};function b({error:o}){let l=String(o.statusCode);l+=': '+(x[o.statusCode]??'Server Error');const s=o.headers.get('cf-ray'),c=o.headers.get('Date');return(0,t().jsxs)(n().View,{style:{padding:12,gap:8},children:[(0,t().jsx)(n().Text,{selectable:!0,allowFontScaling:!0,style:{fontSize:n().Platform.select({web:24,default:16}),fontWeight:'bold',marginBottom:4,color:'white'},children:l}),(0,t().jsx)(n().ScrollView,{style:{borderColor:'rgba(255,255,255,0.5)',borderTopWidth:n().StyleSheet.hairlineWidth,borderBottomWidth:n().StyleSheet.hairlineWidth,maxHeight:150},contentContainerStyle:{paddingVertical:4},children:(0,t().jsx)(n().Text,{testID:"router_error_message",selectable:!0,allowFontScaling:!0,style:{color:'white'},children:o.message})}),(0,t().jsx)(w,{title:"Code",right:o.statusCode}),s&&(0,t().jsx)(w,{title:"ID",right:s}),c&&(0,t().jsx)(w,{title:"Date",right:c}),o.url&&(0,t().jsx)(n().Text,{selectable:!0,allowFontScaling:!0,style:{fontSize:14,opacity:.5,color:'white'},children:o.url})]})}function w({title:o,right:l}){const s={fontSize:16,color:'white'};return(0,t().jsxs)(n().View,{style:{flexDirection:'row',justifyContent:'space-between'},children:[(0,t().jsx)(n().Text,{selectable:!0,allowFontScaling:!0,style:s,children:o}),l&&(0,t().jsx)(n().Text,{selectable:!0,allowFontScaling:!0,style:[s,y.code],children:l})]})}const y=n().StyleSheet.create({container:{flex:1,backgroundColor:'black',padding:24,alignItems:'stretch',justifyContent:'center'},title:{color:'white',fontSize:n().Platform.select({web:32,default:24}),fontWeight:'bold'},buttonText:{fontSize:18,fontWeight:'bold',color:'black',...n().Platform.select({web:{transitionDuration:'100ms'}})},buttonInner:{...n().Platform.select({web:{transitionDuration:'100ms'}}),paddingVertical:12,paddingHorizontal:24,borderColor:'white',borderWidth:2,marginLeft:8,justifyContent:'center',alignItems:'center'},code:{fontFamily:n().Platform.select({default:'Courier',ios:'Courier New',android:'monospace'}),fontWeight:'500'},errorMessage:{color:'white',fontSize:16},subtitle:{color:'white',fontSize:14,marginBottom:12},link:{color:'rgba(255,255,255,0.4)',textDecorationStyle:'solid',textDecorationLine:'underline',fontSize:14,textAlign:'center'}})},1212,[24,30,33,289,508,545,666,759]); +__d(function(g,r,i,a,m,e,d){"use strict";function n(){const t=r(d[0]);return n=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"LocaleProvider",{enumerable:!0,get:function(){return o}});const t=r(d[1]);function o({direction:o,children:c}){return(0,n().jsx)(t.LocaleDirContext.Provider,{value:o,children:c})}},1213,[24,429]); +__d(function(g,r,i,a,m,e,d){"use strict";function t({dispatch:t,isPreloaded:o,isRemovalPrevented:n,state:s}){return{isPreloaded:o,isRemovalPrevented:n,routeNames:s.routeNames,preload:o=>t({type:'PRELOAD',payload:{name:o}})}}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"createBaseTabProps",{enumerable:!0,get:function(){return t}})},1214,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),(function(t,o){for(var n in o)Object.defineProperty(t,n,{enumerable:!0,get:Object.getOwnPropertyDescriptor(o,n).get})})(e,{get BottomTabBar(){return n.BottomTabBar},get BottomTabBarHeightCallbackContext(){return n.BottomTabBarHeightCallbackContext},get BottomTabBarHeightContext(){return n.BottomTabBarHeightContext},get BottomTabView(){return n.BottomTabView},get SceneStyleInterpolators(){return u},get Tabs(){return n.default},get TransitionPresets(){return c},get TransitionSpecs(){return f},get createJSTabsProps(){return n.createJSTabsProps},get createStandardBottomTabNavigator(){return n.createStandardBottomTabNavigator},get default(){return s},get useBottomTabBarHeight(){return n.useBottomTabBarHeight}});const t=r(d[0]),o=r(d[1]),n=b(r(d[2])),u=b(r(d[3])),c=b(r(d[4])),f=b(r(d[5]));function l(t){if("function"!=typeof WeakMap)return null;var o=new WeakMap,n=new WeakMap;return(l=function(t){return t?n:o})(t)}function b(t,o){if(!o&&t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var n=l(o);if(n&&n.has(t))return n.get(t);var u={__proto__:null},c=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var f in t)if("default"!==f&&Object.prototype.hasOwnProperty.call(t,f)){var b=c?Object.getOwnPropertyDescriptor(t,f):null;b&&(b.get||b.set)?Object.defineProperty(u,f,b):u[f]=t[f]}return u.default=t,n&&n.set(t,u),u}n.default.Screen=o.Screen,n.default.Protected=t.Protected;const s=n.default},1215,[718,719,1216,546,547,548]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}function n(){const t=r(d[1]);return n=function(){return t},t}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get createJSTabsProps(){return h},get default(){return y}});const o=r(d[2]),s=r(d[3]),c=r(d[4]),u=r(d[5]),p=r(d[6]),f=r(d[7]);var l,b;function h(t){const{dispatch:n,state:o}=t;return{...(0,f.createBaseTabProps)(t),popNestedStackToTop:t=>{const s=o.routes.find(n=>n.key===t)?.state;s?.key&&n({...c.StackActions.popToTop(),target:s.key})}}}l=r(d[8]),b=e,Object.keys(l).forEach(function(t){"default"===t||Object.prototype.hasOwnProperty.call(b,t)||Object.defineProperty(b,t,{enumerable:!0,get:function(){return l[t]}})});const y=(0,u.integrateWithRouter)(s.createStandardBottomTabNavigator,c.TabRouter,{activityDefaultThreshold:1,processDescriptors:p.appendMissingPlaceholderTabDescriptors,processState:p.appendMissingPlaceholderTabRoutes,createProps:h,processScreens:s=>s.map(s=>{if('function'!=typeof s.options&&void 0!==s.options?.href){const{href:c,...u}=s.options;if(u.tabBarButton)throw new Error('Cannot use `href` and `tabBarButton` together.');return null===c?{...s,options:{...u,hidden:!0}}:{...s,options:{...u,tabBarButton:s=>{const u='web'===n().Platform.OS?s.children:(0,t().jsx)(n().Pressable,{children:s.children});return(0,t().jsx)(o.Link,{...s,style:[{display:'flex'},s.style],href:c,asChild:'web'!==n().Platform.OS,children:u})}}}}return s})})},1216,[24,33,508,652,427,711,1217,1214,545]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(t,n,o){const s=n.routeNames.filter(t=>!n.routes.some(n=>n.name===t));if(0===s.length)return t;const u=s.reduce((t,n)=>(t[n]=o({key:void 0,name:n}),t),{});return{...t,...u}}function n(t,n){if(!t.routeNames.some(n=>!t.routes.some(t=>t.name===n)))return t;const s=t.routes[t.index]?.key,u=t.routeNames.map(s=>{const u=t.routes.find(t=>t.name===s);return u||o(s,n)}),c=Math.max(0,u.findIndex(t=>t.key===s));return{...t,index:c,routes:u}}function o(t,n){const o=n[t];if(!o)throw new Error(`Could not find a descriptor for route "${t}". This is most likely a bug in expo-router. Please report it at https://github.com/expo/expo/issues.`);return{...o.route,key:t,name:t}}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get appendMissingPlaceholderTabDescriptors(){return t},get appendMissingPlaceholderTabRoutes(){return n}})},1217,[]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(){const n=r(d[0]);return t=function(){return n},n}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var u in n)Object.defineProperty(t,u,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,u).get})})(e,{get ExperimentalStack(){return c},get default(){return o}});const n=u(r(d[1]));function u(t){return t&&t.__esModule?t:{default:t}}const c=Object.assign(u=>(0,t().jsx)(n.default,{...u}),{Screen:n.default.Screen,Protected:n.default.Protected}),o=c},1218,[24,1219]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),(function(t,u){for(var n in u)Object.defineProperty(t,n,{enumerable:!0,get:Object.getOwnPropertyDescriptor(u,n).get})})(e,{get Stack(){return t.default},get default(){return l}});const t=c(r(d[0])),u=r(d[1]),n=r(d[2]);function c(t){return t&&t.__esModule?t:{default:t}}t.default.Screen=u.StackScreen,t.default.Header=u.StackHeader,t.default.Title=u.StackTitle,t.default.Toolbar=n.StackToolbar;const l=t.default},1219,[695,728,733]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t.default}});const t=o((n=r(d[0]),u=e,Object.keys(n).forEach(function(t){"default"===t||Object.prototype.hasOwnProperty.call(u,t)||Object.defineProperty(u,t,{enumerable:!0,get:function(){return n[t]}})}),n));var n,u;function o(t){return t&&t.__esModule?t:{default:t}}},1220,[1219]); +__d(function(g,r,i,a,m,e,d){"use strict";var t,n;Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get useIsPreview(){return s.useIsPreview},get usePreventZoomTransitionDismissal(){return o.usePreventZoomTransitionDismissal}}),t=r(d[0]),n=e,Object.keys(t).forEach(function(o){"default"===o||Object.prototype.hasOwnProperty.call(n,o)||Object.defineProperty(n,o,{enumerable:!0,get:function(){return t[o]}})});const o=r(d[1]),s=r(d[2])},1221,[508,1222,421]); +__d(function(g,r,i,a,m,e,d){"use strict";function n(n){}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"usePreventZoomTransitionDismissal",{enumerable:!0,get:function(){return n}})},1222,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"Color",{enumerable:!0,get:function(){return y}});r(d[0]);function t(t,n){return Object.keys(t).forEach(function(u){"default"===u||Object.prototype.hasOwnProperty.call(n,u)||Object.defineProperty(n,u,{enumerable:!0,get:function(){return t[u]}})}),t}t(r(d[1]),e),t(r(d[2]),e),t(r(d[3]),e),t(r(d[4]),e),t(r(d[5]),e);const n=new Proxy({},{get:(t,n)=>null}),u=new Proxy({},{get:(t,n)=>null}),o=new Proxy({},{get:(t,n)=>null}),l=new Proxy({},{get:(t,n)=>null}),c=new Proxy({get attr(){return u},get material(){return o},get dynamic(){return l}},{get:(t,n)=>n in t?t[n]:null}),y={get ios(){return n},get android(){return c}}},1223,[1224,1225,1226,1227,1228,1229]); +__d(function(g,r,i,a,m,e,d){"use strict";function t(t){return null}function n(t){return null}Object.defineProperty(e,"__esModule",{value:!0}),(function(t,n){for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:Object.getOwnPropertyDescriptor(n,o).get})})(e,{get Material3Color(){return n},get Material3DynamicColor(){return t}})},1224,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1225,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1226,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1227,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1228,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},1229,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"LIVE_HEAD_CHEF",{enumerable:!0,get:function(){return o}});var t=r(d[0]),n=r(d[1]),c=r(d[2]),_=r(d[3]);const o='chef'===t.APP_VARIANT&&(0,c.isAnchorage)(_.VENUE_RID)&&!n.PITCH},1230,[806,2,1023,5]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.useLiveState=function(){const e=(0,s.useSync)(e=>e.mode),n=(0,s.useSync)(e=>e.venueId),o=(0,s.useSync)(e=>e.lastSyncAt);return l.PITCH||n&&o?'ready':'signin'===e||'local'===e||'off'===e||'unpaired'===e?'nolink':'offline'===e?'offline':'connecting'},_e.LiveWait=function({state:n,title:o,testID:s}){const l='nolink'===n&&'display'===e.APP_VARIANT?h:p[n];return(0,f.jsxs)(t.default,{testID:s,accessible:!0,accessibilityLabel:`${o}: ${l}`,style:{borderRadius:16,borderWidth:1,borderColor:c.colours.border,backgroundColor:c.colours.surface,padding:14,gap:4},children:[(0,f.jsx)(u.T,{size:12,weight:"semibold",colour:c.colours.goldMuted,children:o.toUpperCase()}),(0,f.jsx)(u.T,{size:18,weight:"semibold",children:l})]})};var e=r(d[0]);r(d[1]);var n,o=r(d[2]),t=(n=o)&&n.__esModule?n:{default:n},s=r(d[3]),l=r(d[4]),c=r(d[5]),u=r(d[6]),f=r(d[7]);const p={connecting:'Connecting\u2026',offline:'No connection. The live numbers show again when this phone is back online.',nolink:'Not connected to the venue. Open your personal link from your manager on this phone to see live numbers.'},h="This Display isn't paired yet. Tap Not paired to pair it."},1231,[806,30,127,820,2,821,813,24]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"QUEUED_BRAND",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"QUEUED_PALETTE",{enumerable:!0,get:function(){return l}});var t=r(d[0]),n=r(d[1]);const c=n.queuedVenues[t.VENUE_RID]?.branding,l={bg:c?.ink,surface:'#222222',surface2:'#292929',border:'#686868',gold:c?.accent,goldLight:c?.smallTextAccent,goldMuted:c?.smallTextAccent,onGold:c?.onAccent,goldTint:'#292929',tile:'#222222',tilePressed:'#292929',ok:c?.smallTextAccent,okBg:'#292929',blue:c?.smallTextAccent,blueBg:'#292929'}},1232,[5,6]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ABBOTSFORD_BRAND_ACCENT",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"ABBOTSFORD_PALETTE",{enumerable:!0,get:function(){return n}});const t='#B89362',n={bg:'#32373C',surface:'#2A2F34',surface2:'#252A2F',tile:'#2A2F34',tilePressed:'#3D4349',border:'#777C81',gold:'#E5D08D',goldLight:'#F0DEA4',goldTint:'#3C372B',goldMuted:'#E5D08D',accentBg:'rgba(184,147,98,0.13)',accentBorder:'rgba(229,208,141,0.65)',onGold:'#0B0B0B',text:'#F8F4EA',muted:'#D7D1C7',ok:'#E5D08D',okBg:'#3C372B',blue:'#E5D08D',blueBg:'#3C372B'}},1233,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"KIRKTON_PALETTE",{enumerable:!0,get:function(){return t}});const t={bg:'#0B0B0B',surface:'#111111',surface2:'#141414',border:'#65554F',gold:'#B46C54',goldLight:'#D4A18E',goldTint:'#241A16',goldMuted:'#C99A86',tile:'#111111',tilePressed:'#141414',accentBg:'rgba(180,108,84,0.13)',accentBorder:'rgba(180,108,84,0.55)',onGold:'#0B0B0B',ok:'#D4A18E',okBg:'#241A16',blue:'#D4A18E',blueBg:'#241A16'}},1234,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"space",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"type",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"LINE",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"LINE_TIGHT",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"MIN_LINE",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"lineFor",{enumerable:!0,get:function(){return l}}),Object.defineProperty(e,"radii",{enumerable:!0,get:function(){return b}}),Object.defineProperty(e,"control",{enumerable:!0,get:function(){return f}}),Object.defineProperty(e,"caps",{enumerable:!0,get:function(){return p}}),Object.defineProperty(e,"layout",{enumerable:!0,get:function(){return y}});const t={xxs:2,xs:4,s:8,m:12,l:16,xl:24,xxl:32},n={micro:11,caption:12,small:14,body:16,large:18,title:22,hero:30,display:40},u=1.4,o=1.25,c=1.2,l=(t,n=u)=>Math.ceil(t*Math.max(n,c)),b={xs:4,s:8,m:12,button:14,l:16,xl:20,pill:999},f={min:48,tall:52,hero:56},p={letterSpacing:1.6},y={contentMax:640,headerSide:96}},1235,[]); +__d(function(_g,_r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.normaliseHex=n,e.hexToRgb=r,e.rgbToHex=o,e.hsvToRgb=s,Object.defineProperty(e,"hsvToHex",{enumerable:!0,get:function(){return a}}),e.hexToHsv=function(t){const{r:n,g:o,b:s}=r(t),a=n/255,c=o/255,u=s/255,i=Math.max(a,c,u),h=Math.min(a,c,u),l=i-h;let p=0;l&&(p=i===a?(c-u)/l%6:i===c?(u-a)/l+2:(a-c)/l+4);return{h:(60*p+360)%360,s:i?l/i:0,v:i}},e.luminance=c,e.contrast=u,e.shade=i,e.checkAccent=function(t,r,o,s){const a=n(t)??'#CFA45F',c=u(a,o),h=u(a,s),l=c>=h?o:s,p=[];Math.max(c,h)<4.5?p.push('Button text may be hard to read on this colour. We picked the clearer text colour for you, but a lighter or darker shade will read better.'):l===s&&p.push('This is a dark colour, so buttons use light text.');let b=a,d=0;for(;u(b,r)<4.5&&d<20;)b=i(a,.05*(d+1)),d++;b!==a&&p.push('This colour is hard to read on the dark background, so header text uses a lighter shade of it.');return{onAccent:l,accentText:b,tips:p}},e.pushRecent=function(t,r,o=8){const s=n(r);return s?[s,...(t??[]).filter(t=>t!==s)].slice(0,o):t??[]};const t=(t,n=0,r=1)=>Math.min(r,Math.max(n,t));function n(t){const n=t.trim().replace(/^#/,'');return/^[0-9a-fA-F]{3}$/.test(n)?'#'+n.split('').map(t=>t+t).join('').toUpperCase():/^[0-9a-fA-F]{6}$/.test(n)?'#'+n.toUpperCase():null}function r(t){const r=(n(t)??'#000000').slice(1);return{r:parseInt(r.slice(0,2),16),g:parseInt(r.slice(2,4),16),b:parseInt(r.slice(4,6),16)}}function o({r:n,g:r,b:o}){return'#'+[n,r,o].map(n=>Math.round(t(n,0,255)).toString(16).padStart(2,'0')).join('').toUpperCase()}function s({h:t,s:n,v:r}){const o=(t%360+360)%360/60,s=r*n,a=s*(1-Math.abs(o%2-1)),c=r-s,[u,i,h]=o<1?[s,a,0]:o<2?[a,s,0]:o<3?[0,s,a]:o<4?[0,a,s]:o<5?[a,0,s]:[s,0,a];return{r:255*(u+c),g:255*(i+c),b:255*(h+c)}}const a=t=>o(s(t));function c(t){const n=t=>{const n=t/255;return n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4)},{r:o,g:s,b:a}=r(t);return.2126*n(o)+.7152*n(s)+.0722*n(a)}function u(t,n){const r=c(t),o=c(n);return(Math.max(r,o)+.05)/(Math.min(r,o)+.05)}function i(t,n){const{r:s,g:a,b:c}=r(t),u=n>0?255:0,i=Math.abs(n);return o({r:s+(u-s)*i,g:a+(u-a)*i,b:c+(u-c)*i})}},1236,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.webLine=function(e,t){const u=n.default.flatten(e)||{},f='number'==typeof u.fontSize?u.fontSize:t,l='number'==typeof u.lineHeight?u.lineHeight:(0,o.lineFor)(f);return{lineHeight:String(Math.max(l/f,o.MIN_LINE))}},r(d[0]);var e,t=r(d[1]),n=(e=t)&&e.__esModule?e:{default:e},o=r(d[2])},1237,[122,46,1235]); +__d(function(g,_r,i,_a,_m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"localRepositories",{enumerable:!0,get:function(){return s}});var e=_r(d[0]);const a=()=>e.useStore.getState(),t=e=>Promise.resolve(e),s={customers:{update:async e=>a().updateCustomer(e),setAllergy:async(e,t)=>a().setAllergy(e,t)},menu:{updateItem:async(e,t)=>a().updateMenuItem(e,t),setSignOff:async(e,t)=>a().setSignOff(e,t)},orders:{placeFromBasket:e=>t(a().placeOrder(e)),accept:async(e,t,s)=>a().acceptOrder(e,t,s),setStatus:async(e,t,s)=>a().setOrderStatus(e,t,s),acknowledgeAllergy:async(e,t)=>a().ackOrderAllergy(e,t),acknowledgeReadiness:async(e,t,s)=>a().ackReadiness(e,t,s),recordHandoverCheck:async(e,t)=>a().handoverCheck(e,t),signAllergyStep:async(e,t,s)=>a().signAllergyStep(e,t,s),customerSignal:async(e,t)=>a().customerSignal(e,t),setSplit:async(e,t,s)=>a().setSplit(e,t,s),payTable:async(e,t)=>a().payTable(e,t)},bookings:{create:e=>t(a().createBooking(e)),setStatus:async(e,t)=>a().setBookingStatus(e,t),decide:async(e,t,s)=>a().decideBooking(e,t,s),acknowledgeAllergy:async(e,t)=>a().ackBookingAllergy(e,t),seatWalkIn:(e,s,n,c)=>t(a().seatWalkIn(e,s,n,c)),assignTable:async(e,t)=>a().setBookingTable(e,t),undoWalkIn:async e=>a().undoWalkIn(e),update:async(e,t)=>a().updateBooking(e,t)},waitlist:{join:(e,s,n,c)=>t(a().joinWaitlist(e,s,n,c)),setStatus:async(e,t)=>a().setWaitlistStatus(e,t),addWalkIn:async(e,t)=>a().addWalkIn(e,t)},loyalty:{addStamp:async(e,t,s)=>a().addStamp(e,t,s),redeemReward:async(e,t)=>a().redeemReward(e,t)},giftCards:{purchase:(e,s,n,c)=>t(a().buyGiftCard(e,s,n,c))},calendar:{addEvent:async e=>a().addEvent(e)},feedback:{add:async e=>a().addRating(e)},restaurants:{updateSettings:async(e,t)=>a().updateSettings(e,t)},alerts:{acknowledge:async(e,t)=>a().ackAlert(e,t)}}},1238,[870]); +__d(function(g,_r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"orderAtTableOn",{enumerable:!0,get:function(){return t}});const t=t=>!!t&&(t.settings.orderAtTable??!0)},1239,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/williewastles/chef-app/assets/assets/brand/3idiots.df4a76d2130f0e5b0042f06a8c88693a.png",width:1024,height:1024,toString(){return this.uri}}},1240,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/williewastles/chef-app/assets/assets/brand/cecchinis.ebf752fef363247848ae7c0d91938765.png",width:1024,height:1024,toString(){return this.uri}}},1241,[]); +__d(function(s,t,i,e,r,a,c){"use strict";r.exports={uri:"/williewastles/chef-app/assets/assets/brand/mrbasrais.7cc4086dd12ace82529795f1c9f8c900.png",width:1024,height:1024,toString(){return this.uri}}},1242,[]); +__d(function(s,t,i,e,r,a,n){"use strict";r.exports={uri:"/williewastles/chef-app/assets/assets/brand/yasmins.8482602e9f0a965655924835625cb02b.png",width:1024,height:1024,toString(){return this.uri}}},1243,[]); +__d(function(s,t,e,i,a,r,c){"use strict";a.exports={uri:"/williewastles/chef-app/assets/assets/brand/williewastles.055a77893ced99bf3a6c5402ba5baac6.png",width:1024,height:1024,toString(){return this.uri}}},1244,[]); +__d(function(e,t,s,i,r,a,n){"use strict";r.exports={uri:"/williewastles/chef-app/assets/assets/brand/rupeeroom.689e6fb536dc0845eeb174a1ec7bd346.png",width:1024,height:1024,toString(){return this.uri}}},1245,[]); +__d(function(t,s,i,a,e,r,n){"use strict";e.exports={uri:"/williewastles/chef-app/assets/assets/brand/smokinggoat.20a3a1970596ab43c5d6468d4ed549a7.png",width:1024,height:1024,toString(){return this.uri}}},1246,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/williewastles/chef-app/assets/assets/brand/pizzaioli.db8c000b62ee407121aa8b90ce45e170.png",width:1024,height:1024,toString(){return this.uri}}},1247,[]); +__d(function(t,e,s,i,r,a,n){"use strict";r.exports={uri:"/williewastles/chef-app/assets/assets/brand/drunkencoo.f6d92af3b14e4205a3deaf4434754c51.png",width:1024,height:1024,toString(){return this.uri}}},1248,[]); +__d(function(t,s,e,i,a,r,b){"use strict";a.exports={uri:"/williewastles/chef-app/assets/assets/brand/abbotsford.b26602bba5ce4969733c5422a45ad053.png",width:1024,height:1024,toString(){return this.uri}}},1249,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/williewastles/chef-app/assets/assets/brand/kirkton.bcf8d846df4861474d224a7a77f498fb.png",width:1024,height:1024,toString(){return this.uri}}},1250,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/williewastles/chef-app/assets/assets/brand/greenside.9d1556db97dcb903a3c57e2063ee2255.png",width:1024,height:1024,toString(){return this.uri}}},1251,[]); +__d(function(s,t,i,e,r,a,n){"use strict";r.exports={uri:"/williewastles/chef-app/assets/assets/brand/wildings.076f4fcd06d19a0af0205c410f461b14.png",width:1024,height:1024,toString(){return this.uri}}},1252,[]); +__d(function(t,e,i,s,r,a,c){"use strict";r.exports={uri:"/williewastles/chef-app/assets/assets/brand/kirkmichael.63b13cde7fd82eb622622b39ac80c394.png",width:1024,height:1024,toString(){return this.uri}}},1253,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/williewastles/chef-app/assets/assets/brand/souters.f4c58d9349b6e1700fe5abcc9e9b665c.png",width:1024,height:1024,toString(){return this.uri}}},1254,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/williewastles/chef-app/assets/assets/brand/anchorage.fea5ce2f6fd18bf2950aa21c0980ed8e.png",width:512,height:512,toString(){return this.uri}}},1255,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/williewastles/chef-app/assets/assets/brand/saltmarsh.85a6a65732635e5148478d743d9ca884.png",width:512,height:512,toString(){return this.uri}}},1256,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/williewastles/chef-app/assets/assets/brand/brae.8de9e89ac30966c6669de990370d8e40.png",width:512,height:512,toString(){return this.uri}}},1257,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/williewastles/chef-app/assets/assets/brand/3idiots-hero.e5dfd53739f05086b1956e72d585a66a.png",width:1024,height:1024,toString(){return this.uri}}},1258,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/williewastles/chef-app/assets/assets/brand/cecchinis-hero.f77780fcc94fd668cf35d66d6dc52d81.png",width:1024,height:1024,toString(){return this.uri}}},1259,[]); +__d(function(s,t,e,i,r,a,c){"use strict";r.exports={uri:"/williewastles/chef-app/assets/assets/brand/mrbasrais-hero.4ce74641cfcf52d099157c84005b9d2a.png",width:1024,height:1024,toString(){return this.uri}}},1260,[]); +__d(function(e,s,t,i,a,r,n){"use strict";a.exports={uri:"/williewastles/chef-app/assets/assets/brand/yasmins-hero.a5aef62e37dfcecbe0afc056186f4ad9.png",width:1024,height:1024,toString(){return this.uri}}},1261,[]); +__d(function(s,t,e,i,r,a,d){"use strict";r.exports={uri:"/williewastles/chef-app/assets/assets/brand/williewastles-hero.b9d53d27b66f903b5618a7177b2ffad4.png",width:1024,height:1024,toString(){return this.uri}}},1262,[]); +__d(function(t,a,e,s,r,i,c){"use strict";r.exports={uri:"/williewastles/chef-app/assets/assets/brand/rupeeroom-hero.969fa372add526aaacf3a6c009b8ac92.png",width:1024,height:1024,toString(){return this.uri}}},1263,[]); +__d(function(t,e,s,i,r,d,n){"use strict";r.exports={uri:"/williewastles/chef-app/assets/assets/brand/smokinggoat-hero.0588f17ef0eed7f757f22916cd4d37db.png",width:1600,height:900,toString(){return this.uri}}},1264,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/williewastles/chef-app/assets/assets/brand/pizzaioli-hero.1896657c08264cefb49b401891d5448d.png",width:1024,height:1024,toString(){return this.uri}}},1265,[]); +__d(function(t,e,s,i,r,c,n){"use strict";r.exports={uri:"/williewastles/chef-app/assets/assets/brand/drunkencoo-hero.65c21c4da9e466cf4bffc969639a1427.png",width:1600,height:900,toString(){return this.uri}}},1266,[]); +__d(function(e,t,s,i,r,a,c){"use strict";r.exports={uri:"/williewastles/chef-app/assets/assets/brand/abbotsford-hero.78fcb8ee06ee22c4ca659c9254db7512.png",width:1024,height:1024,toString(){return this.uri}}},1267,[]); +__d(function(t,s,i,e,r,n,h){"use strict";r.exports={uri:"/williewastles/chef-app/assets/assets/brand/kirkton-hero.9d0837b292c2f4f30f4521d806bb28c3.png",width:1024,height:1024,toString(){return this.uri}}},1268,[]); +__d(function(e,s,t,i,r,c,a){"use strict";r.exports={uri:"/williewastles/chef-app/assets/assets/brand/greenside-hero.1caec5a6cb939434cccb5f3a613b50f8.png",width:1024,height:1024,toString(){return this.uri}}},1269,[]); +__d(function(g,r,i,a,m,e,d){"use strict";m.exports={uri:"/williewastles/chef-app/assets/assets/brand/wildings-hero-logo-text.4661e4b935726f2511f9c17a1567c89a.png",width:1024,height:1024,toString(){return this.uri}}},1270,[]); +__d(function(e,t,i,s,r,a,c){"use strict";r.exports={uri:"/williewastles/chef-app/assets/assets/brand/kirkmichael-hero.63b13cde7fd82eb622622b39ac80c394.png",width:1024,height:1024,toString(){return this.uri}}},1271,[]); +__d(function(t,e,s,i,r,a,h){"use strict";r.exports={uri:"/williewastles/chef-app/assets/assets/brand/anchorage-hero.0450b828e4f9c1f4456240096598f6f5.png",width:1024,height:1024,toString(){return this.uri}}},1272,[]); +__d(function(_g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.getFix=function(e=1e4){const t='undefined'!=typeof navigator?navigator.geolocation:void 0;return t?new Promise(o=>{let n=!1;const c=e=>{n||(n=!0,o(e))},u=setTimeout(()=>c('timeout'),e+1500);try{t.getCurrentPosition(e=>{clearTimeout(u),c({lat:e.coords.latitude,lng:e.coords.longitude,acc:e.coords.accuracy??999})},e=>{clearTimeout(u),c(1===e.code?'denied':3===e.code?'timeout':'unavailable')},{enableHighAccuracy:!0,timeout:e,maximumAge:0})}catch{clearTimeout(u),c('unsupported')}}):Promise.resolve('unsupported')},_e.locationAllowed=async function(){try{const e=await(navigator.permissions?.query({name:'geolocation'}));return'granted'===e?.state}catch{return!1}}},1273,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"VAPID_PUBLIC_KEY",{enumerable:!0,get:function(){return t}});const t='BC3MoXpycbFY4Nf3czfBMaiD0iaMd1ugc70iUWZUiaScERZibFBsI9cmPAiNrlPN0b2_wJR-wgutj4eC8suarQ0'},1274,[]); +__d(function(g,r,i,a,m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"SEEDED_ANSWERS",{enumerable:!0,get:function(){return f}});var n=r(d[0]),t=e(r(d[1])),l=e(r(d[2])),o=e(r(d[3])),s=e(r(d[4])),u=e(r(d[5])),p=e(r(d[6])),h=r(d[7]),c=r(d[8]);const f={...Object.fromEntries(Object.entries(n.queuedVenues).map(([e,n])=>[e,(0,h.cleanQuestionnaire)(n.questionnaire,e)??{}])),greenside:(0,h.cleanQuestionnaire)(t.default,'greenside')??{},abbotsford:(0,h.cleanQuestionnaire)(l.default,'abbotsford')??{},kirkton:(0,h.cleanQuestionnaire)(o.default,'kirkton')??{},wildings:(0,h.cleanQuestionnaire)(s.default,'wildings')??{},kirkmichael:(0,h.cleanQuestionnaire)(u.default,'kirkmichael')??{},souters:(0,h.cleanQuestionnaire)(p.default,'souters')??{},anchorage:{source:'from-config',submittedAt:'2026-10-01',onboardedAt:'2026-10-01',pay:c.ANCHORAGE_PAY},saltmarsh:{source:'signup-form',submittedAt:'2026-10-27',venue:{name:'The Venue',tagline:'Seasonal small plates by the harbour (fictional)',address:'4 Quay Street, Port Ailsa (fictional)',phone:'01632 960 418',email:'hello@thevenue.example',website:'thevenue.example'},tables:{template:'bistro',tables:14,covers:48,areas:['Inside','Terrace']},team:[{name:'Morven Reid (example)',role:'owner',job:'Owner',email:'morven@thevenue.example'},{name:'Callum Shaw (example)',role:'manager',job:'General manager',email:'callum@thevenue.example'},{name:'Isla Grant (example)',role:'staff',job:'Head chef'},{name:'Ruaridh Bell (example)',role:'staff',job:'Waiter',phone:'07700 900 311'},{name:'Ellie Muir (example)',role:'staff',job:'Waiter'}],suppliers:[{name:'Ailsa Fish Co (example)',category:'Fish',phone:'01632 960 101'},{name:'Hillside Dairy (example)',category:'Dairy',email:'orders@hillside.example'}],pay:{tipsFrequency:'fortnightly',tipsAnchorPayday:'2026-11-06',tipsEndsDaysBefore:5,wagePayDay:28,wageCutoffDay:20,weekendRule:'before'},accounts:[{provider:'gmail',handle:'hello@thevenue.example'},{provider:'wix',handle:'thevenue.example'},{provider:'instagram',handle:'@thevenue.demo'},{provider:'facebook',handle:'The Venue'},{provider:'google-business',handle:'The Venue'},{provider:'sumup',handle:'The Venue'},{provider:'xero',handle:'The Venue Ltd'}],features:{bookings:!0,takeaway:!0,orderAtTable:!0,tips:!0,rota:!0,games:!1,specials:!0},notes:'Fictional example answers for the demo venue.'}}},1275,[6,1276,1277,1278,866,865,1279,864,3]); +__d(function(e,a,n,s,o,r,t){o.exports={version:1,venueId:"greenside",source:"from-config",submittedAt:"2026-11-06",venue:{name:"The Greenside Restaurant",tagline:"Restaurant \u2022 Wood Fired Pizza \u2022 Maybole",address:"5 Greenside, Maybole, South Ayrshire KA19 7DG",phone:"01655 889685",email:"info@thegreensiderestaurant.co.uk",website:"https://thegreensiderestaurant.co.uk/",hasLogo:!0,emailNeedsConfirmation:!0},hours:{days:{0:["10:00","00:00"],1:null,2:null,3:["10:00","23:00"],4:["10:00","23:00"],5:["10:00","00:00"],6:["10:00","00:00"]},note:"Closed Monday and Tuesday. Venue Wednesday and Thursday 10:00\u201323:00, Friday to Sunday 10:00\u201300:00. Kitchen Wednesday, Thursday and Sunday 10:00\u201320:00; Friday and Saturday 10:00\u201321:00. Cash only."},tables:{template:"restaurant",tables:null,covers:null,areas:["Restaurant","Beer garden"],needsConfirmation:!0,note:"Historical figure about 50 covers inside and about 48 in seasonal beer garden (former GM LinkedIn). Names, tables and covers need Gordon's confirmation. Bar and restaurant only \u2014 no accommodation."},team:[],suppliers:[],accounts:[],features:{bookings:!0,takeaway:!1,orderAtTable:!1,tips:!0,rota:!0,games:!0,specials:!0},notes:"Separate greenside tenant. No staff, invites or table plan yet. Cash only; no card payments or deposits. CoverCharge manager-confirmed table requests only, with Call01655 889685 as backup. Menu, allergens, public email, pay settings and deposit policy need confirmation. No external booking or ordering links."}},1276,[]); +__d(function(e,o,a,t,r,n,s){r.exports={version:1,venueId:"abbotsford",source:"from-config",submittedAt:"2026-11-06",venue:{name:"The Abbotsford Hotel",tagline:"Get Hungry. Get Curious.",address:"14 Corsehill Road, Ayr KA7 2ST",phone:"01292 261506",email:"info@abbotsfordhotel.co.uk",website:"https://www.abbotsfordhotel.co.uk/",hasLogo:!0},hours:{days:{0:["10:00","20:30"],1:["10:00","20:30"],2:["10:00","20:30"],3:["10:00","20:30"],4:["10:00","20:30"],5:["10:00","20:30"],6:["10:00","20:30"]},note:"Daily 10:00\u201320:30 \u2014 to confirm with the hotel. Copper Bar hours to confirm."},tables:{template:"restaurant",tables:null,covers:null,areas:[],needsConfirmation:!0,note:"Rowan seats up to 120 (published). Restaurant and bar covers/tables unknown."},team:[],suppliers:[],accounts:[{provider:"facebook",handle:"TheAbbotsfordHotel"},{provider:"instagram",handle:"@abbotsfordhotelayr"},{provider:"tiktok",handle:"@the.abbotsford.hotel.ayr"}],features:{bookings:!0,takeaway:!1,orderAtTable:!1,tips:!0,rota:!0,games:!0,specials:!0},notes:"Separate abbotsford tenant. Epicurious restaurant and The Copper Bar. CoverCharge dining and room requests require manager confirmation. No external booking links, no room inventory module or external booking integrations. Zero staff/invites/sample data. Deposit, manager, team, table plan/covers, Copper Bar hours, dog policy and allergens to confirm."}},1277,[]); +__d(function(e,n,t,a,o,r,i){o.exports={version:1,venueId:"kirkton",source:"from-config",submittedAt:"2026-11-06",venue:{name:"The Kirkton Inn",tagline:"Bar and restaurant in Dalrymple, Ayrshire \u2014 Burns country hospitality",address:"1-3 Main Street, Dalrymple, East Ayrshire KA6 6DF",phone:"",email:"",website:"",hasLogo:!0},hours:{days:{0:null,1:null,2:null,3:null,4:null,5:null,6:null},note:"Current opening and kitchen hours to confirm. No service times set."},tables:{template:"restaurant",tables:null,covers:null,areas:[],needsConfirmation:!0,note:"Table plan and capacity to confirm."},team:[],suppliers:[],accounts:[],features:{bookings:!0,takeaway:!1,orderAtTable:!1,tips:!0,rota:!0,games:!0,specials:!0},notes:"Separate kirkton tenant. No staff or personal links. Room inventory and current letting to confirm; room functionality deferred. No external booking integrations. Phone, public email, website, current hours, capacity, table plan, takeaway, pay and deposit policy to confirm. Archived 2019 menus are provisional and not saleable stock."}},1278,[]); +__d(function(e,o,r,s,a,t,n){a.exports={version:1,venueId:"souters",source:"from-config",submittedAt:"2026-11-05",onboardedAt:"2026-11-05",venue:{name:"Souter's Inn",tagline:"Culinary excellence meets country hospitality in Kirkoswald",address:"47 Main Road, Kirkoswald, South Ayrshire KA19 8HY",phone:"01655 760653",email:"souters@southernayr.com",website:"https://www.soutersinn.com/",hasLogo:!0},hours:{days:{0:["09:00","21:00"],1:["09:00","21:00"],2:["09:00","21:00"],3:["09:00","21:00"],4:["09:00","21:00"],5:["09:00","21:00"],6:["09:00","21:00"]},note:"Open daily 9am\u20139pm. Breakfast 9\u201311.45am; main food service from noon. Confirm last orders with the venue."},tables:{template:"restaurant",tables:0,covers:130,areas:[]},team:[],suppliers:[{name:"Pollok Williamson Butchers",category:"Meat",phone:"",email:""}],accounts:[{provider:"instagram",handle:"@soutersinn"},{provider:"facebook",handle:"Souter's Inn"},{provider:"gmail",handle:"souters@southernayr.com"},{provider:"tripadvisor",handle:"Souter's Inn Kirkoswald"},{provider:"google-business",handle:"Souter's Inn"}],features:{bookings:!0,takeaway:!0,orderAtTable:!1,tips:!0,rota:!0,games:!0,specials:!0},notes:"Part of Southern Ayr Limited (Brian Daly). Sister venues: Abbotsford Hotel, The Brig, Bridges Bar, Wellingtons. Bookings: guests request a table in CoverCharge. Deposit default suggested \xa310pp from party of 6 \u2014 confirm with venue (published \xa310pp for some events). Regional Scottish Thistle Award Best Eating Experience 2026. Brand accent from official logo SVG fill #A4622E. Real table plan, manager contact, team, priced menu and deposit confirmation still required; no tables or staff seeded."}},1279,[]); +__d(function(g,_r,_i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.pickPhotos=function(t={}){const a=t.source??'camera';return'undefined'==typeof document?n(a):new Promise(t=>{const n=document.createElement('input');n.type='file',n.accept='image/*',n.multiple=!0,'camera'===a&&n.setAttribute('capture','environment'),n.setAttribute('data-testid','camera'===a?'photo-input':'gallery-input'),n.style.display='none',n.onchange=async()=>{const a=Array.from(n.files??[]).slice(0,8),o=[];for(const t of a)try{o.push(await r(t))}catch{}n.remove(),t(o)},document.body.appendChild(n),n.click()})},e.shrink=r,e.uploadPhoto=async function(n,r,o,c){const i=a.useSync.getState();if('staff'!==i.kind||!i.venueId)return null;try{const a=await(await fetch(o)).blob(),s=`${i.venueId}/${n}/${r}-${Date.now()}-${c}.jpg`,{error:u}=await(0,t.getSupabase)().storage.from('cashup-photos').upload(s,a,{contentType:'image/jpeg',upsert:!1});return u?null:s}catch{return null}},e.photoUrl=async function(a){if(a.startsWith('data:'))return a;try{const{data:n}=await(0,t.getSupabase)().storage.from('cashup-photos').createSignedUrl(a,600);return n?.signedUrl??null}catch{return null}},_r(d[0]);var t=_r(d[1]),a=_r(d[2]);async function n(t){try{const a=_r(d[3],"expo-image-picker"),n={mediaTypes:['images'],quality:.7,base64:!0,allowsMultipleSelection:'gallery'===t,selectionLimit:8};if('camera'===t){if(!(await a.requestCameraPermissionsAsync()).granted)return[]}const r='camera'===t?await a.launchCameraAsync(n):await a.launchImageLibraryAsync(n);return r.canceled?[]:r.assets.filter(t=>t.base64).map(t=>`data:image/jpeg;base64,${t.base64}`)}catch{return[]}}function r(t,a=1600){return new Promise((n,r)=>{const o=URL.createObjectURL(t),c=new Image;c.onload=()=>{const t=Math.min(1,a/Math.max(c.width,c.height)),r=document.createElement('canvas');r.width=Math.round(c.width*t),r.height=Math.round(c.height*t),r.getContext('2d').drawImage(c,0,0,r.width,r.height),URL.revokeObjectURL(o),n(r.toDataURL('image/jpeg',.78))},c.onerror=()=>{URL.revokeObjectURL(o),r(new Error('not an image'))},c.src=o})}},1280,[122,862,820,1034]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return c}});var t=r(d[0]),n=r(d[1]),s=r(d[2]);const o={images:'image/*',videos:'video/mp4,video/quicktime,video/x-m4v,video/*',livePhotos:''};var c={launchImageLibraryAsync:async({mediaTypes:t=['images'],allowsMultipleSelection:n=!1,base64:s=!1})=>'undefined'==typeof window||'undefined'==typeof document?{canceled:!0,assets:null}:await u({mediaTypes:t,allowsMultipleSelection:n,base64:s}),launchCameraAsync:async({mediaTypes:t=['images'],allowsMultipleSelection:n=!1,base64:s=!1,cameraType:o})=>'undefined'==typeof window||'undefined'==typeof document?{canceled:!0,assets:null}:await u({mediaTypes:t,allowsMultipleSelection:n,capture:o??!0,base64:s}),getCameraPermissionsAsync:async()=>l(),requestCameraPermissionsAsync:async()=>l(),getMediaLibraryPermissionsAsync:async t=>l(),requestMediaLibraryPermissionsAsync:async t=>l()};function l(){return{status:t.PermissionStatus.GRANTED,expires:'never',granted:!0,canAskAgain:!0}}function u({mediaTypes:t,capture:o=!1,allowsMultipleSelection:c=!1,base64:l}){const u=w((0,s.parseMediaTypes)(t)),p=document.createElement('input');if(p.style.display='none',p.setAttribute('type','file'),p.setAttribute('accept',u),p.setAttribute('id',String(Math.random())),p.setAttribute('data-testid','file-input'),c&&p.setAttribute('multiple','multiple'),o)switch(o){case!0:p.setAttribute('capture','camera');break;case n.CameraType.front:p.setAttribute('capture','user');break;case n.CameraType.back:p.setAttribute('capture','environment')}return document.body.appendChild(p),new Promise(t=>{p.addEventListener('change',async()=>{if(p.files?.length){const n=c?p.files:[p.files[0]];try{const s=await Promise.all(Array.from(n).filter(t=>null!=t).map(t=>f(t,{base64:l})));t({canceled:!1,assets:s})}catch(n){t(Promise.reject(n))}}else t({canceled:!0,assets:null});document.body.removeChild(p)}),p.addEventListener('cancel',()=>{p.dispatchEvent(new Event('change'))});const n=new MouseEvent('click');p.dispatchEvent(n)})}async function p(t){return new Promise(n=>{const s=new Image;s.onload=()=>{n({width:s.naturalWidth??s.width,height:s.naturalHeight??s.height})},s.onerror=()=>n({width:0,height:0}),s.src=t})}async function y(t){return new Promise(n=>{const s=document.createElement('video');s.preload='metadata',s.onloadedmetadata=()=>{n({width:s.videoWidth,height:s.videoHeight,duration:s.duration})},s.onerror=()=>n({width:0,height:0,duration:0}),s.src=t})}async function h(t){return new Promise((n,s)=>{const o=new FileReader;o.onerror=()=>{s(new Error('Failed to read the selected media because the operation failed.'))},o.onload=t=>{const o=t.target?.result;'string'==typeof o?n(o.split(',')?.[1]??''):s(new Error('Failed to read file as base64'))},o.readAsDataURL(t)})}async function f(t,n){const s=t.type,o=URL.createObjectURL(t);let c,l;if(s.startsWith('image/'))c=await p(o);else{if(!s.startsWith('video/'))throw new Error(`Unsupported file type: ${s}. Only images and videos are supported.`);c=await y(o)}return n.base64&&(l=await h(t)),{uri:o,width:c.width,height:c.height,type:s.startsWith('image/')?'image':'video',mimeType:s,fileName:t.name,fileSize:t.size,file:t,...void 0!==c.duration&&{duration:c.duration},...l&&{base64:l}}}function w(t){const n=t.filter(t=>'livePhotos'!==t);if(0===n.length)return'image/*';let s='';for(const t of n)s.includes(o[t])||(s=s.concat(',',o[t]));return s}},1281,[570,1282,1283]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"MediaTypeOptions",{enumerable:!0,get:function(){return t}}),Object.defineProperty(e,"VideoExportPreset",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"UIImagePickerControllerQualityType",{enumerable:!0,get:function(){return u}}),Object.defineProperty(e,"UIImagePickerPresentationStyle",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"UIImagePickerPreferredAssetRepresentationMode",{enumerable:!0,get:function(){return c}}),Object.defineProperty(e,"CameraType",{enumerable:!0,get:function(){return l}});let t=(function(t){return t.All="All",t.Videos="Videos",t.Images="Images",t})({}),n=(function(t){return t[t.Passthrough=0]="Passthrough",t[t.LowQuality=1]="LowQuality",t[t.MediumQuality=2]="MediumQuality",t[t.HighestQuality=3]="HighestQuality",t[t.H264_640x480=4]="H264_640x480",t[t.H264_960x540=5]="H264_960x540",t[t.H264_1280x720=6]="H264_1280x720",t[t.H264_1920x1080=7]="H264_1920x1080",t[t.H264_3840x2160=8]="H264_3840x2160",t[t.HEVC_1920x1080=9]="HEVC_1920x1080",t[t.HEVC_3840x2160=10]="HEVC_3840x2160",t})({}),u=(function(t){return t[t.High=0]="High",t[t.Medium=1]="Medium",t[t.Low=2]="Low",t[t.VGA640x480=3]="VGA640x480",t[t.IFrame1280x720=4]="IFrame1280x720",t[t.IFrame960x540=5]="IFrame960x540",t})({}),o=(function(t){return t.FULL_SCREEN="fullScreen",t.PAGE_SHEET="pageSheet",t.FORM_SHEET="formSheet",t.CURRENT_CONTEXT="currentContext",t.OVER_FULL_SCREEN="overFullScreen",t.OVER_CURRENT_CONTEXT="overCurrentContext",t.POPOVER="popover",t.AUTOMATIC="automatic",t})({}),c=(function(t){return t.Automatic="automatic",t.Compatible="compatible",t.Current="current",t})({}),l=(function(t){return t.back="back",t.front="front",t})({})},1282,[]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.parseMediaTypes=p,e.mapDeprecatedOptions=function(s){if(!s.mediaTypes)return s;return{...s,mediaTypes:p(s.mediaTypes??[])}};var s=r(d[0]);function p(p){const n={Images:['images'],Videos:['videos'],All:['images','videos']};return p===s.MediaTypeOptions.Images||p===s.MediaTypeOptions.Videos||p===s.MediaTypeOptions.All?(console.warn('[expo-image-picker] `ImagePicker.MediaTypeOptions` have been deprecated. Use `ImagePicker.MediaType` or an array of `ImagePicker.MediaType` instead.'),n[p]):'string'==typeof p?[p]:p}},1283,[1282]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.readSheet=async function(l,u,c){const f=u.filter(t=>!t.startsWith('data:'));try{const u=n.useSync.getState();if('staff'!==u.kind||!u.venueId||!f.length)return{vals:o(c),reader:null,note:s};const{data:h,error:y}=await(0,t.getSupabase)().functions.invoke('cashup-read',{body:{kind:l,venueId:u.venueId,paths:f,fields:c.filter(t=>'text'!==t.kind).map(t=>({key:t.key,label:t.label,kind:t.kind}))}});if(y||!h||'object'!=typeof h||!h.vals)return{vals:o(c),reader:null,note:s};const p=o(c);for(const t of c){const n=h.vals[t.key];'number'==typeof n&&Number.isFinite(n)&&(p[t.key]=Math.round(100*n)/100)}const v=Object.values(p).filter(t=>null!=t).length;return v?{vals:p,categories:Array.isArray(h.categories)?h.categories:[],reader:String(h.reader??'photo reader'),note:`${v} figure${1===v?'':'s'} read from the photo. Check each one against the photo before you confirm.`}:{vals:p,reader:null,note:'The photo couldn\u2019t be read clearly, so type the figures from it.'}}catch{return{vals:o(c),reader:null,note:s}}};var t=r(d[0]),n=r(d[1]);const o=t=>Object.fromEntries(t.map(t=>[t.key,null])),s='Automatic reading isn\u2019t switched on yet, so type the figures from the photo. Nothing is filled in for you.'},1284,[862,820]); +__d(function(g,_r,_i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.pickSpreadsheet=function(){return'undefined'==typeof document?Promise.resolve({error:'Upload a spreadsheet from the Managers app in a web browser.'}):new Promise(e=>{const s=document.createElement('input');s.type='file',s.accept='.csv,.xlsx,text/csv,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',s.setAttribute('data-testid','sheet-input'),s.style.display='none',s.onchange=async()=>{const t=s.files?.[0];if(s.remove(),!t)return e(null);if(t.size>5242880)return e({error:'That file is over 5 MB. Export just the takings columns and try again.'});try{const s=/\.xlsx$/i.test(t.name)?await(0,c.readXlsx)(await t.arrayBuffer()):(0,r.parseCsv)(await t.text());e(s.length?{name:t.name,rows:s}:{error:'The file looks empty.'})}catch(s){e({error:s instanceof Error?s.message:'The file couldn\u2019t be read. Try saving it as CSV.'})}},document.body.appendChild(s),s.click()})},_e.SpreadsheetImport=function({rid:e,file:t,who:c,onClose:v,onSaved:w,locked:x}){const[y,$]=(0,s.useState)(!0),b=y?t.rows[0]:t.rows[0].map((e,s)=>`Column ${s+1}`),[j,k]=(0,s.useState)(()=>(0,r.guessMapping)(t.rows[0])),[C,T]=(0,s.useState)(!1),[D,S]=(0,s.useState)('map'),B=(0,n.useCashUp)(e=>e.cashUps),I=(0,s.useMemo)(()=>new Set(B.filter(s=>s.rid===e&&s.confirmedAt&&null!=(0,i.grossOf)(s.vals)).map(e=>e.date)),[B,e]),M=(0,s.useMemo)(()=>(0,r.buildPreview)(t.rows,j,y,I),[t.rows,j,y,I]),P=M.filter(e=>e.ok&&!(e.date&&x(e.date))),R=P.filter(e=>'saved'!==e.dup||C),z=P.filter(e=>'saved'===e.dup).length,L=M.filter(e=>!e.ok).length,U=M.filter(e=>e.ok&&e.date&&x(e.date)).length,E=null!=j.date&&null!=j.gross;return(0,u.jsxs)(l.Sheet,{visible:!0,onClose:v,title:"Upload a spreadsheet",maxWidth:1e3,testID:"sheet-import",children:[(0,u.jsx)(l.Muted,{children:`${t.name} \xb7 ${t.rows.length-(y?1:0)} row${t.rows.length-(y?1:0)==1?'':'s'}`}),'map'===D?(0,u.jsxs)(o.default,{style:{gap:10},testID:"sheet-map",children:[(0,u.jsx)(l.T,{size:17,weight:"semibold",children:"1. Which column is which?"}),(0,u.jsx)(l.Muted,{children:"Tip: Date and Gross takings are needed. Food, drink, card and cash are optional. Leave a column as \u201cNot in the file\u201d if you don\u2019t have it."}),(0,u.jsx)(l.Toggle,{testID:"sheet-header",label:"The first row is headings",value:y,onChange:$}),r.COLS.map(e=>(0,u.jsxs)(o.default,{style:{gap:4},testID:`sheet-col-${e.key}`,children:[(0,u.jsxs)(l.Row,{gap:6,children:[(0,u.jsx)(l.T,{weight:"semibold",children:e.label}),e.required?(0,u.jsx)(l.Badge,{kind:"gold",label:"NEEDED"}):(0,u.jsx)(l.Muted,{children:"optional"})]}),(0,u.jsxs)(l.Row,{wrap:!0,gap:6,children:[e.required?null:(0,u.jsx)(l.Chip,{label:"Not in the file",selected:null==j[e.key],onPress:()=>k({...j,[e.key]:void 0})}),b.map((s,o)=>(0,u.jsx)(l.Chip,{testID:`sheet-col-${e.key}-${o}`,label:s||`Column ${o+1}`,sub:y?void 0:t.rows[0][o],selected:j[e.key]===o,onPress:()=>{const s={...j};Object.keys(s).forEach(e=>{s[e]===o&&delete s[e]}),s[e.key]=o,k(s)}},o))]})]},e.key)),(0,u.jsx)(l.Button,{testID:"sheet-to-preview",label:"Preview",disabled:!E,onPress:()=>{S('preview'),f(`${M.filter(e=>e.ok).length} rows ready, ${L} with problems.`)}})]}):null,'preview'===D?(0,u.jsxs)(o.default,{style:{gap:10},testID:"sheet-preview",children:[(0,u.jsx)(l.T,{size:17,weight:"semibold",children:"2. Check the preview"}),(0,u.jsx)(o.default,{accessibilityLiveRegion:"polite",children:(0,u.jsx)(l.T,{testID:"sheet-summary",children:`${P.length} night${1===P.length?'':'s'} ready${L?` \xb7 ${L} row${1===L?'':'s'} with a problem (not saved)`:''}${U?` \xb7 ${U} signed off and locked (not changed)`:''}`})}),z?(0,u.jsx)(l.Banner,{kind:"warn",title:`${z} date${1===z?' already has':'s already have'} takings in CoverCharge`,children:(0,u.jsxs)(o.default,{style:{gap:6},children:[(0,u.jsx)(l.Toggle,{testID:"sheet-replace",label:"Replace those nights\u2019 takings with the spreadsheet",value:C,onChange:T}),(0,u.jsx)(l.Muted,{children:C?'Those nights will be replaced (the change is logged).':'Those nights are skipped; their saved takings are kept.'})]})}):null,M.slice(0,62).map(e=>{const s=e.ok&&'saved'===e.dup&&!C,t=e.ok&&!!e.date&&x(e.date),n=e.ok?t?'Locked: not changed':s?'Already saved: skipped':'saved'===e.dup?'Replaces saved takings':'Ready':e.errors.join('; ');return(0,u.jsxs)(o.default,{testID:`sheet-row-${e.line}`,accessible:!0,accessibilityLabel:`Row ${e.line}: ${e.date?m(e.date):'no date'}, gross ${p(e.vals.gross)}. ${n}`,style:{paddingVertical:8,gap:2,borderBottomWidth:1,borderBottomColor:h.colours.hairline,opacity:!e.ok||s||t?.75:1},children:[(0,u.jsxs)(l.Row,{style:{justifyContent:'space-between'},children:[(0,u.jsx)(l.T,{size:15,weight:"semibold",children:`Row ${e.line} \xb7 ${e.date?m(e.date):'no date'}`}),(0,u.jsx)(l.T,{size:15,weight:"semibold",colour:h.colours.goldLight,children:p(e.vals.gross)})]}),(()=>{const s=['food','drink','card','cash'].filter(s=>null!=j[s]&&null!=e.vals[s]).map(s=>`${s[0].toUpperCase()}${s.slice(1)} ${p(e.vals[s])}`);return s.length?(0,u.jsx)(l.T,{size:13,colour:h.colours.text,children:s.join(' \xb7 ')}):null})(),(0,u.jsx)(l.T,{size:13,colour:e.ok?h.colours.muted:h.colours.amber,children:n})]},e.line)}),M.length>62?(0,u.jsx)(l.Muted,{children:`\u2026and ${M.length-62} more rows.`}):null,(0,u.jsxs)(o.default,{style:{gap:8},children:[(0,u.jsx)(l.Button,{testID:"sheet-to-confirm",label:`Next: save ${R.length} night${1===R.length?'':'s'}`,disabled:!R.length,onPress:()=>S('confirm')}),(0,u.jsx)(l.Button,{kind:"secondary",label:"Change columns",onPress:()=>S('map')})]})]}):null,'confirm'===D?(0,u.jsxs)(o.default,{style:{gap:10},testID:"sheet-confirm",children:[(0,u.jsx)(l.T,{size:17,weight:"semibold",children:"3. Confirm"}),(0,u.jsxs)(o.default,{style:{borderWidth:1.5,borderColor:h.colours.gold,borderRadius:14,padding:12,gap:4,backgroundColor:h.colours.goldTint},accessibilityLiveRegion:"polite",children:[(0,u.jsx)(l.T,{size:18,weight:"semibold",colour:h.colours.gold,children:`Save takings for ${R.length} night${1===R.length?'':'s'}`}),(0,u.jsx)(l.T,{children:R.length?`${m(R.map(e=>e.date).sort()[0])} to ${m(R.map(e=>e.date).sort().slice(-1)[0])} \xb7 gross ${p(Math.round(100*R.reduce((e,s)=>e+(s.vals.gross??0),0))/100)} in total`:''}),(0,u.jsx)(l.Muted,{children:`Saved as confirmed by ${c.name}. Each night is logged. ${C&&z?`${z} saved night${1===z?' is':'s are'} replaced.`:z?`${z} already-saved night${1===z?' is':'s are'} skipped.`:''}`})]}),(0,u.jsx)(l.Button,{testID:"sheet-save",label:"Confirm and save",onPress:()=>{const s=(new Date).toISOString(),o=n.useCashUp.getState();for(const l of R){const n=o.cashUps.find(s=>s.rid===e&&s.date===l.date);o.saveCashUp({rid:e,date:l.date,vals:{...n?.vals??{},...(0,r.rowVals)(l)},photos:n?.photos??[],confirmedBy:c.name,confirmedAt:s,readBy:`spreadsheet: ${t.name}`.slice(0,80)})}const l=R.length,i=`Takings saved for ${l} night${1===l?'':'s'} from ${t.name}.`;f(i),w(i)}}),(0,u.jsx)(l.Button,{kind:"secondary",label:"Back to the preview",onPress:()=>S('preview')})]}):null]})};var s=_r(d[0]),t=e(_r(d[1]));_r(d[2]);var o=e(_r(d[3])),l=_r(d[4]),n=_r(d[5]),i=_r(d[6]),r=_r(d[7]),h=_r(d[8]),c=_r(d[9]),u=_r(d[10]);const p=e=>null==e?'\u2014':`\xa3${e.toLocaleString('en-GB',{minimumFractionDigits:2,maximumFractionDigits:2})}`,m=e=>new Date(`${e}T12:00:00Z`).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short',year:'numeric',timeZone:'UTC'}),f=e=>{try{t.default.announceForAccessibility?.(e)}catch{}}},1285,[30,118,122,127,813,1092,1108,1286,821,1287,24]); +__d(function(g,_r,_i,_a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"COLS",{enumerable:!0,get:function(){return n}}),e.parseCsv=function(t){const n=t.replace(/^\uFEFF/,''),r=n.split(/\r?\n/,1)[0]??'',s=t=>r.split(t).length-1,a=[',',';','\t'].sort((t,n)=>s(n)-s(t))[0],o=[];let l=[],d='',i=!1;for(let t=0;tt.some(t=>''!==t.trim())).map(t=>t.map(t=>t.trim()))},e.guessMapping=function(t){const n={},s=new Set;for(const a of['date','food','drink','card','cash','gross']){const o=t.findIndex((t,n)=>!s.has(n)&&r[a].test(t)&&!('gross'===a&&/tips?/i.test(t))&&!('cash'===a&&/tips?|float/i.test(t)));o>=0&&(n[a]=o,s.add(o))}return n},e.parseDateCell=l,e.buildPreview=function(r,s,a,o){const d=a?r.slice(1):r,i=new Map,u=d.map((r,o)=>{const d=[],i=t=>null==s[t]?'':(r[s[t]]??'').trim(),u=null==s.date?null:l(i('date'));u||d.push(i('date')?`Date \u201c${i('date')}\u201d not understood`:'No date');const c={};for(const r of n){if('date'===r.key||null==s[r.key])continue;const n=i(r.key);if(!n){c[r.key]=null,r.required&&d.push(`No ${r.label.toLowerCase()}`);continue}const a=(0,t.parseAmount)(n.replace(/^\((.*)\)$/,'-$1'));null==a&&d.push(`${r.label} \u201c${n}\u201d not a \xa3 amount`),c[r.key]=a}return null==s.gross&&d.push('No gross column'),{line:o+(a?2:1),date:u,vals:c,errors:d,dup:null,ok:!1}});for(const t of u)t.date&&i.set(t.date,(i.get(t.date)??0)+1);for(const t of u)t.date&&(i.get(t.date)??0)>1?(t.dup='file',t.errors.push('This date is in the file more than once')):t.date&&o.has(t.date)&&(t.dup='saved'),t.ok=!t.errors.length;return u},e.rowVals=function(t){const n={};for(const r of['gross','food','drink','card','cash'])r in t.vals&&(n[r]=t.vals[r]??null);return n};var t=_r(_d[0]);const n=[{key:'date',label:'Date',required:!0},{key:'gross',label:'Gross takings',required:!0},{key:'food',label:'Food'},{key:'drink',label:'Drink'},{key:'card',label:'Card'},{key:'cash',label:'Cash'}];const r={date:/^(date|day|night|trading ?date|business ?date)\b/i,gross:/(gross|total ?takings|takings|total ?sales|sales ?total|turnover|^total$)/i,food:/\bfood\b|kitchen/i,drink:/\bdrinks?\b|\bbar\b|bev(erage)?s?|wet/i,card:/\bcard\b|pdq|debit|credit/i,cash:/\bcash\b/i};const s=['jan','feb','mar','apr','may','jun','jul','aug','sep','oct','nov','dec'],a=t=>String(t).padStart(2,'0'),o=(t,n,r)=>{const s=new Date(Date.UTC(t,n-1,r));return s.getUTCFullYear()===t&&s.getUTCMonth()===n-1&&s.getUTCDate()===r?`${t}-${a(n)}-${a(r)}`:null};function l(t){const n=t.trim();let r;if(r=n.match(/^(\d{4})-(\d{1,2})-(\d{1,2})(?:[ T].*)?$/))return o(+r[1],+r[2],+r[3]);if(r=n.match(/^(\d{1,2})[/.-](\d{1,2})[/.-](\d{2}|\d{4})(?: .*)?$/))return o(2===r[3].length?+r[3]+2e3:+r[3],+r[2],+r[1]);if(r=n.match(/^(?:[a-z]+,? )?(\d{1,2})(?:st|nd|rd|th)? ([a-z]{3})[a-z]*,? (\d{4})$/i)){const t=s.indexOf(r[2].toLowerCase());return t<0?null:o(+r[3],t+1,+r[1])}if(/^\d{5}(\.\d+)?$/.test(n)){const t=Math.floor(+n);if(t<36526||t>73050)return null;const r=new Date(Date.UTC(1899,11,30)+864e5*t);return o(r.getUTCFullYear(),r.getUTCMonth()+1,r.getUTCDate())}return null}},1286,[1108]); +__d(function(g,_r,_i,a,_m,e,_d){"use strict";async function t(t){const r=globalThis.DecompressionStream;if(!r)throw new Error('This browser can\u2019t open .xlsx files. Save the sheet as CSV and upload that.');const n=new Blob([t]).stream().pipeThrough(new r('deflate-raw'));return new Uint8Array(await new Response(n).arrayBuffer())}async function r(r,n){const s=new Uint8Array(r),o=new DataView(r),i={};let c=-1;for(let t=s.length-22;t>=Math.max(0,s.length-66e3);t--)if(101010256===o.getUint32(t,!0)){c=t;break}if(c<0)throw new Error('This isn\u2019t a readable .xlsx file.');const l=o.getUint16(c+10,!0);let h=o.getUint32(c+16,!0);const f=new TextDecoder;for(let r=0;r'xl/sharedStrings.xml'===t||/^xl\/worksheets\/sheet\d+\.xml$/.test(t)),i=Object.keys(o).filter(t=>t.startsWith('xl/worksheets/')).sort()[0];if(!i)throw new Error('No worksheet found in this file.');const c=[...(o['xl/sharedStrings.xml']??'').matchAll(/([\s\S]*?)<\/si>/g)].map(t=>n([...t[1].matchAll(/]*>([\s\S]*?)<\/t>/g)].map(t=>t[1]).join(''))),l=[];for(const t of o[i].matchAll(/]*>([\s\S]*?)<\/row>/g)){const r=[];for(const o of t[1].matchAll(/]*?)(?:\/>|>([\s\S]*?)<\/c>)/g)){const t=o[1],i=o[2]??'',l=t.match(/r="([A-Z]+\d+)"/)?.[1],h=t.match(/t="(\w+)"/)?.[1],f=i.match(/([\s\S]*?)<\/v>/)?.[1],w=i.match(/]*>([\s\S]*?)<\/t>/)?.[1],m='s'===h?c[Number(f)]??'':n('inlineStr'===h?w??'':f??'');r[l?s(l):r.length]=m}l.push(Array.from(r,t=>(t??'').trim()))}return l.filter(t=>t.some(t=>''!==t))};const n=t=>t.replace(/</g,'<').replace(/>/g,'>').replace(/"/g,'"').replace(/'/g,"'").replace(/&#(\d+);/g,(t,r)=>String.fromCharCode(+r)).replace(/&/g,'&'),s=t=>{const r=t.replace(/\d+/g,'');let n=0;for(const t of r)n=26*n+(t.charCodeAt(0)-64);return n-1}},1287,[]); +__d(function(g,_r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.useLockedFor=function(e){const n=(0,c.useCashUp)(e=>e.cashUps),s=(0,c.useCashUp)(e=>e.sales);return(0,o.useCallback)((o,l)=>{const i='cashup'===o?n.find(n=>n.rid===e&&n.date===l):s.find(n=>n.rid===e&&n.weekStart===l);return!!i&&(0,h.cashLocked)(t.PITCH&&i.confirmedAt?{...i,onServer:!0}:i)},[n,s,e])},Object.defineProperty(_e,"lockedMessage",{enumerable:!0,get:function(){return y}}),_e.auditLine=j,_e.CashLockControls=function({kind:e,item:s,label:c}){const y=(0,k.useSync)(e=>'staff'===e.kind&&!!e.venueId)||t.PITCH,b=(0,k.useSync)(e=>e.perms.includes('*')||e.perms.includes('roles.manage')),x=(0,u.useOwner)(e=>e.previewRole),C=b||t.PITCH&&'owner'===x,[$,w]=(0,o.useState)(!1),[I,S]=(0,o.useState)(''),[P,L]=(0,o.useState)(!1),[T,U]=(0,o.useState)(null);if(!y||!(s.onServer||t.PITCH&&s.confirmedAt))return null;const v=(0,h.cashLocked)(t.PITCH?{...s,onServer:!0}:s),H=async()=>{L(!0);const n=await(0,k.unlockCashUp)(e,s.id,I.trim());L(!1),n.ok?(w(!1),S(''),(0,f.notify)({id:'cash-unlock',icon:'\ud83d\udd11',title:`${c} unlocked for 30 minutes`,body:'Correct it now. It locks again by itself, and the change is logged with your name.',timeoutMs:8e3})):(0,f.notify)({id:'cash-unlock',tone:'warn',title:'Not unlocked',body:n.message,timeoutMs:8e3})};return(0,p.jsxs)(l.default,{testID:`cash-lock-${s.id}`,style:{gap:4},children:[(0,p.jsxs)(i.Row,{gap:6,wrap:!0,children:[v?(0,p.jsx)(i.Badge,{kind:"gold",label:"Signed off"}):(0,p.jsx)(i.Badge,{kind:"neutral",label:`Unlocked until ${new Date(s.unlockedUntil??'').toLocaleTimeString('en-GB',{timeZone:'Europe/London',hour:'2-digit',minute:'2-digit'})}`}),v&&C&&!$?(0,p.jsx)(i.Button,{small:!0,kind:"ghost",testID:`cash-unlock-${s.id}`,label:"Unlock to correct",onPress:()=>w(!0)}):null,(0,p.jsx)(i.Button,{small:!0,kind:"ghost",testID:`cash-history-${s.id}`,label:T?'Hide history \u25b4':'History \u25be',onPress:()=>{T?U(null):(0,k.readCashAudit)(s.id).then(U)}})]}),v&&!C?(0,p.jsx)(i.Muted,{size:12,children:"Only an owner can unlock it to make a correction."}):null,$?(0,p.jsxs)(l.default,{style:{gap:4},children:[(0,p.jsx)(n.TextInput,{testID:`cash-unlock-reason-${s.id}`,value:I,onChangeText:S,placeholder:"Why does it need changing?",placeholderTextColor:r.colours.muted,maxLength:200,style:{minHeight:36,borderRadius:8,borderWidth:1,borderColor:r.colours.hairline,color:r.colours.text,paddingHorizontal:8}}),(0,p.jsxs)(i.Row,{gap:6,children:[(0,p.jsx)(i.Button,{small:!0,testID:`cash-unlock-yes-${s.id}`,label:P?'Unlocking\u2026':'Unlock for 30 minutes',disabled:P||I.trim().length<3,onPress:()=>{H()}}),(0,p.jsx)(i.Button,{small:!0,kind:"ghost",label:"Cancel",onPress:()=>{w(!1),S('')}})]})]}):null,T?T.length?T.map((e,n)=>(0,p.jsx)(i.Muted,{size:12,children:j(e)},n)):(0,p.jsx)(i.Muted,{size:12,children:"No history yet."}):null]})};var e,n=_r(d[0]),t=_r(d[1]),o=_r(d[2]),s=_r(d[3]),l=(e=s)&&e.__esModule?e:{default:e},i=_r(d[4]),r=_r(d[5]),c=_r(d[6]),u=_r(d[7]),h=_r(d[8]),k=_r(d[9]),f=_r(d[10]),p=_r(d[11]);const y=(e,n)=>`The ${'cashup'===e?'cash up':'weekly sales report'} for ${n} is signed off and locked. An owner can tap \u201cUnlock to correct\u201d on it.`,b={created:'signed off',changed:'changed',unlocked:'unlocked',deleted:'removed'},x=e=>new Date(e).toLocaleString('en-GB',{timeZone:'Europe/London',day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'});function j(e){const n=e.changed.length&&'changed'===e.action?` (${e.changed.slice(0,6).join(', ')}${e.changed.length>6?'\u2026':''})`:'';return`${x(e.at)} \xb7 ${e.by} ${b[e.action]??e.action}${n}${e.reason?`: \u201c${e.reason}\u201d`:''}`}},1288,[875,2,30,127,813,821,1092,854,1108,820,946,24]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"inPhoneApp",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"canOpenAppSettings",{enumerable:!0,get:function(){return c}}),e.openAppSettings=function(){try{t()?.openSettings?.()}catch{}},e.openLocationSettings=function(){try{t()?.openLocationSettings?.()}catch{}},e.appLocationPermission=function(){try{return t()?.locationPermission?.()??null}catch{return null}},e.phoneLocationOn=p,e.checkAppUpdate=function(){try{t()?.checkUpdate?.()}catch{}},e.locWhere=function(){if(!o()){const t=String(n()?.navigator?.userAgent??'');return/iPhone|iPad|iPod/.test(t)||/Macintosh/.test(t)&&(n()?.navigator?.maxTouchPoints??0)>1?'iphone':'browser'}return c()?p()?'app':'app-phone-off':'app-old'};const n=()=>'undefined'!=typeof window?window:void 0,t=()=>{const t=n()?.CoverChargeNative;return t&&'object'==typeof t?t:null},o=()=>/CoverChargePhone\//.test(String(n()?.navigator?.userAgent??'')),c=()=>'function'==typeof t()?.openSettings;function p(){try{const n=t()?.locationOn?.();return!1!==n}catch{return!0}}},1289,[]); +__d(function(g,r,_i,a,m,_e,d){"use strict";function t(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.SplitFlap=function({value:t,height:e=52,colour:o="#F5F1E8",min:i=2,sound:n,testID:u}){const s=String(Math.max(0,Math.round(t))).padStart(i,' '),h=Math.round(.68*e);return(0,c.jsx)(l.default,{testID:u,accessible:!0,accessibilityLabel:String(Math.max(0,Math.round(t))),style:{flexDirection:'row',gap:3},children:s.split('').map((t,i)=>(0,c.jsx)(x,{ch:' '===t?'':t,h:e,colour:o,size:h,sound:n&&i===s.length-1},s.length-i))})};var e=r(d[0]),o=t(r(d[1])),i=t(r(d[2])),n=t(r(d[3])),l=t(r(d[4])),u=r(d[5]),s=r(d[6]),c=r(d[7]);let h=!1;o.default.isReduceMotionEnabled?.().then(t=>{h=!!t}).catch(()=>{}),o.default.addEventListener?.('reduceMotionChanged',t=>{h=!!t});const f='#1B1A1D',p='#201F22';function b({ch:t,h:e,w:o,colour:n,part:u,size:h}){return(0,c.jsx)(l.default,{style:{height:e/2,width:o,overflow:'hidden',backgroundColor:'top'===u?p:f,borderTopLeftRadius:'top'===u?8:0,borderTopRightRadius:'top'===u?8:0,borderBottomLeftRadius:'bottom'===u?8:0,borderBottomRightRadius:'bottom'===u?8:0},children:(0,c.jsx)(i.default.Text,{allowFontScaling:!1,style:{position:'absolute',left:0,right:0,top:'top'===u?0:-e/2,height:e,lineHeight:e,textAlign:'center',fontSize:h,fontFamily:s.fonts.bold,color:n,includeFontPadding:!1},children:t})})}function x({ch:t,h:o,colour:s,size:f,sound:p}){const x=Math.round(.7*o),[j,v]=(0,e.useState)(t),[w,R]=(0,e.useState)(t),y=(0,e.useRef)(new i.default.Value(0)).current,M=(0,e.useRef)(new i.default.Value(1)).current,V=(0,e.useRef)(!0);(0,e.useEffect)(()=>{if(V.current)return V.current=!1,v(t),void R(t);if(t!==j){if(h)return R(t),void v(t);R(j),v(t),y.setValue(0),M.setValue(1),p&&(0,u.flapClick)(),i.default.sequence([i.default.timing(y,{toValue:1,duration:210,easing:n.default.in(n.default.quad),useNativeDriver:!0}),i.default.timing(M,{toValue:0,duration:210,easing:n.default.out(n.default.quad),useNativeDriver:!0})]).start(()=>R(t))}},[t]);const z=o/4,F=y.interpolate({inputRange:[0,1],outputRange:['0deg','-90deg']}),S=M.interpolate({inputRange:[0,1],outputRange:['0deg','90deg']}),D=w!==j;return(0,c.jsxs)(l.default,{style:{width:x,height:o},children:[(0,c.jsx)(b,{ch:j,h:o,w:x,colour:s,part:"top",size:f}),(0,c.jsx)(b,{ch:D?w:j,h:o,w:x,colour:s,part:"bottom",size:f}),D?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(i.default.View,{style:{position:'absolute',top:0,left:0,transform:[{perspective:400},{translateY:z},{rotateX:F},{translateY:-z}],backfaceVisibility:'hidden'},children:(0,c.jsx)(b,{ch:w,h:o,w:x,colour:s,part:"top",size:f})}),(0,c.jsx)(i.default.View,{style:{position:'absolute',top:o/2,left:0,transform:[{perspective:400},{translateY:-z},{rotateX:S},{translateY:z}],backfaceVisibility:'hidden'},children:(0,c.jsx)(b,{ch:j,h:o,w:x,colour:s,part:"bottom",size:f})})]}):null,(0,c.jsx)(l.default,{pointerEvents:"none",style:{position:'absolute',left:0,right:0,top:o/2-.5,height:1,backgroundColor:'rgba(0,0,0,0.75)'}})]})}},1290,[30,118,120,224,127,922,821,24]); +__d(function(g,_r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.LastFoodBanner=function({rid:e,now:o,big:c}){const f=(0,l.useRestaurant)(e),h=u(o),$=(0,l.useEvents)(e).filter(e=>e.date===h&&'regular'===e.source),b=f?(0,s.lastFoodOn)(f,h):null;if(!b)return null;const T=new Date(`${h}T${b.time}:00`),p=Math.round((T.getTime()-o.getTime())/6e4),_=$[0],j=_?`${_.title}${_.time?` from ${(0,s.fmt12)(_.time)}`:''}`:'';if(p>90&&!_)return null;if(p<-60)return null;const w=p>=0&&p<=15,x=p<0,D=w?n.colours.redBg:x?n.colours.surface2:n.colours.goldTint,F=w?n.colours.red:x?n.colours.hairline:n.colours.accentBorder,M=w?'#FFD9D4':x?n.colours.muted:n.colours.goldLight,y=c?1.3:1,B=x?`Kitchen closed for food \xb7 last orders were ${(0,s.fmt12)(b.time)}`:w?`Last food orders in ${Math.max(0,p)} min (${(0,s.fmt12)(b.time)})`:`Last food orders ${(0,s.fmt12)(b.time)}`;return(0,d.jsxs)(t.default,{testID:w?'last-food-warning':'last-food-banner',accessibilityRole:"text",style:{borderRadius:14,borderWidth:w?2:1,borderColor:F,backgroundColor:D,paddingVertical:10*y,paddingHorizontal:14,gap:2},children:[(0,d.jsxs)(r.T,{size:17*y,weight:"bold",colour:M,children:[w?'\u23f0 ':'\ud83c\udf7d ',B]}),j||'kitchen closes'!==b.reason?(0,d.jsx)(r.T,{size:13*y,colour:n.colours.muted,children:[j?`Tonight: ${j}`:'','kitchen closes'!==b.reason&&b.reason!==_?.title?`Early last orders (${b.reason})`:''].filter(Boolean).join(' \xb7 ')}):null]})},_r(_d[0]);var e,o=_r(_d[1]),t=(e=o)&&e.__esModule?e:{default:e},r=_r(_d[2]),l=_r(_d[3]),s=_r(_d[4]),n=_r(_d[5]),d=_r(_d[6]);const u=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`},1291,[30,127,813,819,809,821,24]); +__d(function(_g,_r,i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.useNextFree=j,_e.NextTableFreeCard=function({rid:e,now:s,big:r,always:d}){const u=(0,n.useRestaurant)(e),c=j(e,s);if(!u||!c||!(0,h.nextTableOn)(u))return null;if(!c.full&&!d)return null;const T=c.list.slice(0,3),w=c.waitFor(2),p=c.waitFor(4),y=(0,h.lastFoodOn)(u,x(s)),M=r?1.25:1,F=(e,r)=>(0,g.jsxs)(l.default,{style:{flex:1,borderRadius:12,borderWidth:1,borderColor:f.colours.hairline,backgroundColor:f.colours.tile,padding:10},testID:`wait-for-${e}`,children:[(0,g.jsxs)(o.Muted,{children:["Wait for ",e]}),(0,g.jsx)(o.T,{size:20*M,weight:"bold",colour:f.colours.goldLight,children:r?`About ${Math.max(5,Math.round((r.at.getTime()-s.getTime())/6e4))} min`:'\u2014'}),(0,g.jsx)(o.Muted,{children:r?`${(0,t.tableNumbers)(r.table)} \xb7 ${r.confidence}`:'nothing due yet'})]});return(0,g.jsxs)(l.default,{testID:"next-table-free",accessibilityRole:"summary",style:{borderRadius:16,borderWidth:1,borderColor:f.colours.accentBorder,backgroundColor:f.colours.surface,padding:14,gap:8},children:[(0,g.jsxs)(o.Row,{style:{justifyContent:'space-between'},children:[(0,g.jsx)(o.T,{size:12,weight:"semibold",colour:f.colours.goldMuted,style:{letterSpacing:1.4},children:c.full?'FULL \xb7 NEXT TABLE FREE':'NEXT TABLE FREE'}),(0,g.jsx)(o.Badge,{kind:"amber",label:"ESTIMATE"})]}),T.length?(0,g.jsxs)(o.T,{size:22*M,weight:"bold",children:["About ",(0,b.hhmm)(T[0].at)," ",(0,g.jsxs)(o.T,{size:16*M,colour:f.colours.muted,children:["(",(0,t.tableNumbers)(T[0].table),", ",T[0].seats," seats \xb7 ",T[0].confidence,")"]})]}):(0,g.jsx)(o.T,{size:18*M,weight:"semibold",children:c.freeNow.length?`Free now: ${c.freeNow.map(e=>`${(0,t.tableNumbers)(e)}`).join(', ')}`:'No table due to free up before its next booking'}),T.slice(1).map(e=>(0,g.jsxs)(o.Muted,{children:["Then about ",(0,b.hhmm)(e.at)," \xb7 ",(0,t.tableNumbers)(e.table)," (",e.seats," seats) \xb7 ",e.confidence," \xb7 ",e.why]},e.table)),T[0]?(0,g.jsxs)(o.Muted,{children:[(0,t.tableNumbers)(T[0].table),": ",T[0].why,"."]}):null,(0,g.jsxs)(o.Row,{gap:8,children:[F(2,w),F(4,p)]}),T.some(e=>e.drinksOnly)&&y?(0,g.jsxs)(o.T,{size:13,colour:f.colours.amber,children:["After last food orders (",(0,h.fmt12)(y.time),") a table is for drinks only."]}):null,(0,g.jsx)(o.Muted,{children:"Tap Bill requested or Table finished on the plan and this updates straight away."})]})};var e,t=_r(_d[0]),s=_r(_d[1]),r=_r(_d[2]),l=(e=r)&&e.__esModule?e:{default:e},o=_r(_d[3]),n=_r(_d[4]),d=_r(_d[5]),u=_r(_d[6]),c=_r(_d[7]),b=_r(_d[8]),h=_r(_d[9]),f=_r(_d[10]),g=_r(_d[11]);const x=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,'0')}-${String(e.getDate()).padStart(2,'0')}`,T=e=>(0,b.hhmm)(e);function j(e,t){const r=(0,n.useRestaurant)(e),l=(0,u.usePlan)(e),o=(0,n.useBookings)(e),h=(0,n.useOrders)(e),f=(0,u.useFloor)(t=>t.live[e]),g=(0,d.useBlocks)(e=>e.blocks),j=t.getTime()/6e4|0;return(0,s.useMemo)(()=>{if(!r)return null;const s=x(t),n=(0,d.closedAreasAt)(g,e,s,T(t)),u=(0,c.floorView)(l,o,h,f??{},t,r.settings.turnMins,n);return(0,b.nextTablesFree)(r,u,o.filter(e=>e.date===s),t,o)},[r,l,o,h,f,g,j])}},1292,[808,30,127,813,819,824,825,826,1114,809,821,24]); +__d(function(_g,_r,_i,_a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"MAX",{enumerable:!0,get:function(){return e}}),Object.defineProperty(_e,"TARGET",{enumerable:!0,get:function(){return t}}),_e.compressOnWeb=r,_e.capturePlatingPhoto=async function(e){{const n=await(t='camera'===e,new Promise(e=>{const n=document.createElement('input');n.type='file',n.accept='image/*',t&&n.setAttribute('capture','environment'),n.style.display='none',n.setAttribute('data-testid',t?'photo-input-camera':'photo-input-library'),n.onchange=()=>{const t=n.files?.[0]??null;n.remove(),e(t)},n.oncancel=()=>{n.remove(),e(null)},document.body.appendChild(n),n.click()}));if(!n)return null;return{...await r(n),originalBytes:n.size}}var t},Object.defineProperty(_e,"kb",{enumerable:!0,get:function(){return a}});!(function(e){if(e&&e.__esModule)return e;var t={};e&&Object.keys(e).forEach(function(n){if('default'!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e})(_r(_d[0]));_r(_d[1]);const e=1024,t=225280,n=e=>Math.round(3*(e.length-e.indexOf(',')-1)/4);async function r(r,a=e,o=t){const i='string'==typeof r?r:URL.createObjectURL(r);try{const e=await new Promise((e,t)=>{const n=new window.Image;n.onload=()=>e(n),n.onerror=()=>t(new Error('That file is not a photo we can read.')),n.src=i}),t=Math.min(1,a/Math.max(e.naturalWidth,e.naturalHeight)),r=Math.max(1,Math.round(e.naturalWidth*t)),c=Math.max(1,Math.round(e.naturalHeight*t)),u=document.createElement('canvas');u.width=r,u.height=c;const l=u.getContext('2d');l.fillStyle='#ffffff',l.fillRect(0,0,r,c),l.drawImage(e,0,0,r,c);let f=.8,s=u.toDataURL('image/jpeg',f);for(;n(s)>o&&f>.4;)f-=.1,s=u.toDataURL('image/jpeg',f);return{dataUrl:s,width:r,height:c,bytes:n(s)}}finally{'string'!=typeof r&&URL.revokeObjectURL(i)}}const a=e=>`${Math.max(1,Math.round(e/1024))} KB`},1293,[1034,122]); +__d(function(_g,r,_i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"useLogoCache",{enumerable:!0,get:function(){return s}}),_e.squareLogo=async function(e,t=256){const n=await new Promise((t,n)=>{const o=new window.Image;o.onload=()=>t(o),o.onerror=()=>n(new Error('That file is not a picture we can read.')),o.src=e}),o=Math.min(n.naturalWidth,n.naturalHeight),i=(n.naturalWidth-o)/2,s=(n.naturalHeight-o)/2,c=document.createElement('canvas');c.width=t,c.height=t;const u=c.getContext('2d');return u.fillStyle='#ffffff',u.fillRect(0,0,t,t),u.drawImage(n,i,s,o,o,0,0,t,t),c.toDataURL('image/jpeg',.85)};var e,t=r(d[0]),n=(e=t)&&e.__esModule?e:{default:e},o=r(d[1]),i=r(d[2]);const s=(0,o.create)()((0,i.persist)(e=>({byList:{},put:(t,n)=>e(e=>({byList:{...e.byList,[t]:n}})),drop:t=>e(e=>{const n={...e.byList};return delete n[t],{byList:n}})}),{name:'covercharge-order-logos-v1',storage:(0,i.createJSONStorage)(()=>n.default)}))},1294,[1115,951,1116]); +__d(function(g,r,i,_a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.TodaysBookings=function({rid:o,today:s,by:p,app:x}){const v=(0,l.useBookings)(o).filter(e=>e.date===s&&(0,u.ACTIVE)(e)).sort((e,t)=>e.time.localeCompare(t.time)),B=v.reduce((e,t)=>e+(t.diet?.vegan??0),0),C=v.reduce((e,t)=>e+(t.diet?.vegetarian??0),0);return(0,y.jsxs)(n.default,{style:{gap:12},testID:"todays-bookings",children:[(0,y.jsx)(j.CoversToday,{rid:o}),(0,y.jsx)(h.PlattersBooked,{rid:o,date:s,label:"Platters booked today"}),B||C?(0,y.jsxs)(a.T,{colour:c.colours.ok,children:["\u24cb ",B?`${B} vegan`:'',B&&C?' \xb7 ':'',C?`${C} vegetarian`:''," today"]}):null,(0,y.jsx)(h.KitchenSignoffs,{rid:o,today:s,by:p,app:x,showAll:!0}),v.length?v.map(s=>(0,y.jsxs)(n.default,{style:{gap:6,padding:14,borderRadius:16,borderWidth:1,borderColor:c.colours.hairline,backgroundColor:c.colours.surface},children:[(0,y.jsxs)(a.T,{weight:"semibold",children:[s.time," \xb7 ",s.walkIn?`Walk-in ${s.ref}`:s.name," \xb7 ",s.partySize," covers",s.table?` \xb7 ${(0,e.tableNumbers)(s.table)}`:'']}),(0,y.jsx)(t.DepositChip,{b:s,money:!0,testID:`kitchen-deposit-${s.id}`}),(0,y.jsx)(b.BookingTableButton,{rid:o,booking:s,readOnly:'chef'===x}),'chef'!==x&&s.walkIn?(0,y.jsx)(k.CancelWalkInButton,{rid:o,b:s,small:!0}):null,s.notes?(0,y.jsxs)(a.T,{size:16,testID:`kitchen-notes-${s.id}`,children:["Notes: ",s.notes]}):null,(0,y.jsx)(f.BookingEditButton,{rid:o,booking:s,who:p,inStaffApp:'staff'===x}),(0,y.jsx)(h.BookingNeeds,{b:s}),'seated'===(0,u.shownStatus)(s)?(0,y.jsx)(a.Muted,{children:"Seated"}):'finished'===s.status?(0,y.jsx)(a.Muted,{children:"Finished"}):null]},s.id)):(0,y.jsx)(a.Muted,{children:"No bookings today yet."})]})};var e=r(d[0]),t=r(d[1]);r(d[2]);var o,s=r(d[3]),n=(o=s)&&o.__esModule?o:{default:o},a=r(d[4]),l=r(d[5]),u=r(d[6]),c=r(d[7]),h=r(d[8]),b=r(d[9]),k=r(d[10]),f=r(d[11]),j=r(d[12]),y=r(d[13])},1295,[808,950,30,127,813,819,828,821,949,914,948,915,920,24]); +__d(function(g,r,i,_a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"tableButtonLabel",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"tableButtonA11y",{enumerable:!0,get:function(){return s}}),e.tableOptions=function(t,n,o){const s=t.tables.map(t=>t.name).sort(l),c=new Set;return(t.joins??[]).forEach(t=>{t.tables.length>1&&c.add(t.tables.slice().sort(l).join('+'))}),[...n.map(t=>t.table),o].forEach(t=>{const n=a(t);n.length>1&&c.add(n.slice().sort(l).join('+'))}),[...s,...[...c].sort(l)]},e.tableOverlaps=function(t,l,o,s=90){const c=a(l);if(!c.length)return[];const b={...t,table:l};return o.filter(l=>l.id!==t.id&&l.date===t.date&&!['cancelled','noshow','finished'].includes(l.status)&&a(l.table).some(t=>c.includes(t))&&(0,n.startOf)(b)<(0,n.endOf)(l,s)&&(0,n.startOf)(l)<(0,n.endOf)(b,s))},Object.defineProperty(e,"tablePatch",{enumerable:!0,get:function(){return c}});var t=r(d[0]),n=r(d[1]);const a=t=>t?t.split('+').map(t=>t.trim()).filter(Boolean):[],l=(t,n)=>t.localeCompare(n,'en-GB',{numeric:!0}),o=n=>(0,t.tableNumbers)(n)||'No table',s=(n,a)=>`${(0,t.tableNumbersA11y)(n)}${a?'':', change table'}`;const c=t=>({table:t||void 0,tableSetHere:!0})},1296,[808,826]); +__d(function(g,_r,_i,a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.nextDays=c,Object.defineProperty(_e,"openOn",{enumerable:!0,get:function(){return u}}),_e.BookingDatePicker=function({r:e,today:l,value:b,onChange:m}){const[f,x]=(0,t.useState)(!1),p=(0,r.ymd)(l),j=c(l,9),D=(e,t)=>0===t?'Today':1===t?'Tomorrow':`${(0,r.dayShort)(e)} ${e.getDate()}`,w=j.some(e=>(0,r.ymd)(e)===b),C=(0,r.parseYmd)(b),[P,T]=(0,t.useState)(()=>({y:C.getFullYear(),m:C.getMonth()})),v=(new Date(P.y,P.m,1,12).getDay()+6)%7,M=new Date(P.y,P.m+1,0).getDate(),R=[...Array.from({length:v},()=>null),...Array.from({length:M},(e,t)=>new Date(P.y,P.m,t+1,12))];for(;R.length%7;)R.push(null);const k=12*(P.y-l.getFullYear())+P.m-l.getMonth(),F=e=>T(({y:t,m:o})=>{const s=new Date(t,o+e,1);return{y:s.getFullYear(),m:s.getMonth()}});return(0,i.jsxs)(s.default,{testID:"nb-date",style:{gap:6},children:[(0,i.jsxs)(d.Row,{wrap:!0,gap:6,children:[j.map((t,o)=>(0,i.jsx)(d.Chip,{label:D(t,o),sub:u(e,t)?void 0:'Closed',selected:b===(0,r.ymd)(t),onPress:()=>{m((0,r.ymd)(t)),x(!1)}},(0,r.ymd)(t))),w?null:(0,i.jsx)(d.Chip,{label:(0,r.niceDate)(C),sub:u(e,C)?void 0:'Closed',selected:!0,onPress:()=>x(!0)}),(0,i.jsx)(d.Chip,{label:f?'Close calendar':'\ud83d\udcc5 Pick date',selected:f,onPress:()=>{f||T({y:C.getFullYear(),m:C.getMonth()}),x(!f)}})]}),f?(0,i.jsxs)(s.default,{testID:"nb-calendar",style:{borderWidth:1,borderColor:n.colours.border,borderRadius:14,padding:10,gap:6,backgroundColor:n.colours.surface2,maxWidth:420},children:[(0,i.jsxs)(d.Row,{style:{justifyContent:'space-between'},children:[(0,i.jsx)(o.default,{accessibilityRole:"button",accessibilityLabel:"Previous month",disabled:k<=0,onPress:()=>F(-1),style:{padding:8,opacity:k<=0?.3:1},children:(0,i.jsx)(d.T,{size:20,colour:n.colours.gold,children:"\u2039"})}),(0,i.jsxs)(d.T,{weight:"semibold",children:[(0,r.monthLong)(P.m)," ",P.y]}),(0,i.jsx)(o.default,{accessibilityRole:"button",accessibilityLabel:"Next month",disabled:k>=h,onPress:()=>F(1),style:{padding:8,opacity:k>=h?.3:1},children:(0,i.jsx)(d.T,{size:20,colour:n.colours.gold,children:"\u203a"})})]}),(0,i.jsx)(s.default,{style:{flexDirection:'row'},children:y.map(e=>(0,i.jsx)(d.T,{size:12,colour:n.colours.muted,center:!0,style:{flex:1},children:e},e))}),Array.from({length:R.length/7},(t,l)=>(0,i.jsx)(s.default,{style:{flexDirection:'row',gap:4},children:R.slice(7*l,7*l+7).map((t,l)=>{if(!t)return(0,i.jsx)(s.default,{style:{flex:1,height:40}},l);const c=(0,r.ymd)(t),y=c{m(c),x(!1)},style:{flex:1,height:40,borderRadius:10,alignItems:'center',justifyContent:'center',borderWidth:c===p?1.5:0,borderColor:n.colours.gold,backgroundColor:h?n.colours.gold:'transparent',opacity:y?.3:1},children:(0,i.jsx)(d.T,{size:15,weight:h?'bold':'regular',colour:h?n.colours.onGold:f?n.colours.muted:n.colours.text,style:f&&!y?{textDecorationLine:'line-through'}:void 0,children:t.getDate()})},l)})},l)),(0,i.jsx)(d.Muted,{children:"Past dates can\u2019t be booked. Crossed-out days: closed (per the venue\u2019s hours)."})]}):null]})};var t=_r(_d[0]),o=e(_r(_d[1])),s=e(_r(_d[2])),l=_r(_d[3]),r=_r(_d[4]),n=_r(_d[5]),d=_r(_d[6]),i=_r(_d[7]);function c(e,t){const o=new Date(e);return o.setHours(12,0,0,0),Array.from({length:t},(e,t)=>{const s=new Date(o);return s.setDate(o.getDate()+t),s})}const u=(e,t)=>!!(0,l.hoursFor)(e,t),y=['Mon','Tue','Wed','Thu','Fri','Sat','Sun'],h=12},1297,[30,263,127,815,818,821,813,24]); +__d(function(g,r,i,a,_m,_e,d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.MenuAllergyCheck=function({rid:e,allergens:j,audience:m="guest"}){const b=(0,t.useMenu)(e),[x,y]=(0,s.useState)(!1);if(!j.length)return null;const{contains:p,may:M,free:k}=(0,c.dishesFor)(b,j),w=k.filter(e=>!e.signOff),S=k.filter(e=>e.signOff),_=j.map(o.allergenLabel).join(', '),C=e=>e.map(e=>e.name).join(', ')||'none';return(0,f.jsxs)(l.default,{testID:"menu-allergy-check",style:{gap:6,borderWidth:1,borderColor:p.length?h.colours.red:h.colours.border,borderRadius:12,padding:10,backgroundColor:h.colours.surface2},children:[(0,f.jsxs)(u.T,{weight:"semibold",children:["Allergy check against the menu (",_,")"]}),(0,f.jsxs)(u.T,{size:14,colour:h.colours.red,children:["Contains: ",p.length," dish",1===p.length?'':'es']}),(0,f.jsxs)(u.T,{size:14,colour:h.colours.amber,children:["May contain: ",M.length]}),(0,f.jsxs)(u.T,{size:14,colour:h.colours.ok,children:["Free from ",1===j.length?'it':'them'," (signed off): ",S.length]}),w.length?(0,f.jsxs)(u.Muted,{children:[w.length," more awaiting the head chef's sign-off, so not shown as safe."]}):null,(0,f.jsx)(n.default,{testID:"menu-allergy-details",accessibilityRole:"button",onPress:()=>y(!x),hitSlop:6,children:(0,f.jsx)(u.T,{size:14,colour:h.colours.gold,children:x?'Hide dishes':'Show dishes'})}),x?(0,f.jsxs)(l.default,{style:{gap:4},children:[(0,f.jsxs)(u.Muted,{children:["Contains: ",C(p)]}),(0,f.jsxs)(u.Muted,{children:["May contain: ",C(M)]}),(0,f.jsxs)(u.Muted,{children:["Free from: ",C(S)]})]}):null,(0,f.jsx)(u.Muted,{children:'guest'===m?'From the kitchen\u2019s signed-off recipe cards. Specials on the board are checked by staff on the day.':'From the signed-off recipe cards. Specials on the board have their own allergens. Still check with the guest and the kitchen.'})]})};var s=r(d[0]),n=e(r(d[1])),l=e(r(d[2])),t=r(d[3]),o=r(d[4]),c=r(d[5]),h=r(d[6]),u=r(d[7]),f=r(d[8])},1298,[30,263,127,819,814,1103,821,813,24]); +__d(function(g,_r,_i,a,_m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"VAT",{enumerable:!0,get:function(){return r}}),Object.defineProperty(e,"exVat",{enumerable:!0,get:function(){return n}}),e.dishCost=i,Object.defineProperty(e,"gpPct",{enumerable:!0,get:function(){return o}}),Object.defineProperty(e,"priceForTarget",{enumerable:!0,get:function(){return c}}),e.costings=function(r,c,s,u){const d=(0,t.dishStats)(r);return c.map(t=>{const c=r.find(r=>r.id===t.dishId);if(!c||null==c.price)return null;const p=i(t,s),l=n(c.price),f=o(p,c.price),b=d.find(t=>t.item.id===c.id)?.sold??0;return{item:c,recipe:t,cost:p,priceInc:c.price,priceEx:l,gp:f,cashGp:l-p,below:ft.prevCost&&t.prevCost!==t.cost).map(s=>{const u=(s.cost-(s.prevCost??s.cost))/(s.prevCost??1)*100,d=r.filter(t=>t.lines.some(t=>t.ing===s.id)).map(r=>{const u=t.find(t=>t.id===r.dishId);if(!u||null==u.price)return null;const d=o(i(r,n,{ing:s.id,cost:s.prevCost}),u.price),p=o(i(r,n),u.price);return{item:u,before:d,after:p,dropped:d>=c&&pt.dropped),below:d.filter(t=>t.below)}})},e.weekGp=function(t,r,n){const i=t.reduce((t,r)=>t+r.priceEx*r.soldWeek,0),o=t.reduce((t,r)=>t+r.cost*r.soldWeek,0),c=o+r+Math.max(0,n);return{sales:i,theoCost:o,actualCost:c,theo:i?(i-o)/i*100:0,actual:i?(i-c)/i*100:0}},Object.defineProperty(e,"fmtQty",{enumerable:!0,get:function(){return s}});var t=_r(_d[0]);const r=.2,n=t=>Math.round(t/1.2);function i(t,r,n){return Math.round(t.lines.reduce((t,i)=>{const o=r.find(t=>t.id===i.ing);return t+(n&&n.ing===i.ing?n.cost:o?.cost??0)*i.qty},0))}const o=(t,r)=>{const i=n(r);return i>0?(i-t)/i*100:0},c=(t,r)=>50*Math.ceil(t/(1-r/100)*1.2/50);const s=(t,r)=>`${Number.isInteger(t)?t:t.toFixed(t<1?3:2).replace(/0+$/,'').replace(/\.$/,'')} ${'each'===r?'':r}`.trim()},1299,[1300]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"hash",{enumerable:!0,get:function(){return a}}),Object.defineProperty(_e,"CHANNELS",{enumerable:!0,get:function(){return n}}),_e.revenueHistory=function(e,n,r=28){const s=[];if(!(0,o.examplesAllowed)())return s;for(let o=r;o>=1;o--){const r=(0,t.addMins)(n,1440*-o),i=!!e.kitchenHours[r.getDay()],d=[1.05,0,0,.6,.7,1,1.2][r.getDay()]*('anchorage'===e.id?1:.6),l=o=>.85+.3*a((0,t.ymd)(r)+o+e.id),u=i?Math.round(24e4*d*l('d')):0,c=i?Math.round(95e3*d*l('t')):0,p=i?Math.round(52e3*d*l('q')):0;s.push({date:r,label:(0,t.niceDate)(r).slice(0,6),byChannel:{'Dine-in':u,Takeaway:c,'Table QR':p},total:u+c+p,covers:i?Math.round(150*d*l('c')):0})}return s},_e.dishStats=function(e){return(0,o.examplesAllowed)()?e.filter(e=>null!=e.price).map(e=>{const t=Math.round(20+260*a(e.id+'s')),o=.24+.22*a(e.id+'c'),n=e.price??0,r=Math.round(n*(1-o));return{item:e,sold:t,revenue:t*n,costPct:o,margin:r,gp:r*t}}):[]},_e.quadrant=function(e,t,o,a){return e>=o?t>=a?'Star':'Plough horse':t>=a?'Puzzle':'Dog'},Object.defineProperty(_e,"QUADRANT_TIP",{enumerable:!0,get:function(){return r}}),_e.crmCustomers=function(){return(0,o.examplesAllowed)()?s.map((e,t)=>{const o=a(e+t);return{id:0===t?'cust-demo':`cr-${t}`,name:`${e} ${i[t]}${0===t?'':' (example)'}`,phone:`07700 900${String(100+7*t).slice(-3)}`,visits:1+Math.round(18*o),lastVisit:`${1+Math.round(27*o)} days ago`,spend:Math.round(3e3+6e4*o),allergies:0===t?['Crustaceans (anaphylaxis)','Mustard']:o>.8?['Gluten (coeliac)']:o<.1?['Peanuts']:[],stamps:0===t?5:Math.round(7*o),optIn:o>.25,channel:n[Math.floor(3*o)%3],birthday:o>.6?`${1+Math.round(27*o)} Nov`:void 0}}):[]},Object.defineProperty(_e,"STOCK",{enumerable:!0,get:function(){return d}}),Object.defineProperty(_e,"stockList",{enumerable:!0,get:function(){return l}}),_e.insights=function(a,n,r,s,i,l,c){const p=[];if(!(0,o.examplesAllowed)())return u(a,n,r,s,i,l,c);const h=new Date(l);h.setDate(h.getDate()+((6-h.getDay()+7)%7||7)),h.setHours(0,0,0,0);const b=(0,e.forecastToday)(a,n,r,s,h),m=Math.round(b.restOfDay.covers/Math.max(1,b.multiplier)),y=Math.max(35,Math.round(100*(b.multiplier-1))+35);p.push({id:'sat',icon:'\ud83d\udcc8',tone:'gold',title:`${(0,t.niceDate)(h)} forecast +${y}%: add 1 server 6\u20139pm`,body:`Example: about ${Math.round(m*(1+y/100))} covers expected vs about ${m} on a usual Saturday (bookings pace + Halloween weekend flag).`,action:{label:'Open rota',tab:'more',sub:'rota'}});const f=(0,e.forecastToday)(a,n,r,s,l),v=d[0],w=Math.ceil((f.restOfDay.covers+2*f.restOfDay.takeaway)*v.perCover);p.push({id:'haddock',icon:'\ud83d\udc1f',tone:'red',title:`Haddock low: ${v.onHand} portions left`,body:`Tonight\u2019s forecast needs about ${w}. Call the supplier before 18:00 or mark the fish supper sold out at ${v.onHand} sold.`,action:{label:'Prep list',tab:'more',sub:'prep'}});const k=s.find(e=>/Burns/.test(e.title));if(k){const e=Math.max(1,Math.round((new Date(k.date).getTime()-l.getTime())/6048e5));p.push({id:'burns',icon:'\ud83e\udd43',tone:'blue',title:`Burns Night in ${e} weeks: open bookings?`,body:'Last year\u2019s equivalent nights sold out about 3 weeks ahead (example). Publish the set menu and push to opted-in regulars.',action:{label:'Plan campaign',tab:'more',sub:'marketing'}})}const M=n.filter(e=>e.date===(0,t.venueYmd)(l)&&'noshow'===e.status).length;p.push({id:'noshow',icon:'\ud83e\ude91',tone:'amber',title:M?`${M} no-show today: deposits for 6+?`:'Deposits for bigger tables (example)',body:'Deposits are set per venue in Settings \u203a Advanced \u203a Deposits. Consider them on Fri/Sat after 19:00.',action:{label:'Bookings',tab:'bookings'}});const C=i.filter(e=>e.stars<=2).length;C&&p.push({id:'reviews',icon:'\ud83d\udcac',tone:'red',title:`${C} low rating this week: cold chips at collection`,body:'Readiness alerts now time bagging 5 min before pickup. Reply to say thanks and invite them back.',action:{label:'Reviews',tab:'more',sub:'reviews'}});return p.push({id:'commission',icon:'\ud83d\udcb7',tone:'ok',title:'You kept about \xa31,240 in commission this month',body:'Example: \xa34,140 of direct takeaway orders that would have cost about 30% on delivery apps.',action:{label:'Analytics',tab:'more',sub:'analytics'}}),p.push({id:'covers',icon:'\ud83c\udf7d\ufe0f',tone:'gold',title:`${c} covers so far today`,body:'Lobster special is the top add-on tonight. Suggest it with the scallops (example).'}),p};var e=_r(_d[0]),t=_r(_d[1]),o=_r(_d[2]);const a=e=>{let t=2166136261;for(let o=0;o>>0)/4294967295},n=['Dine-in','Takeaway','Table QR'];const r={Star:'Keep: high margin and popular. Feature it.','Plough horse':'Popular, low margin: nudge the price or trim the cost.',Puzzle:'High margin, few sales: promote it or rename it.',Dog:'Low margin, few sales: consider removing it.'},s=['Alex','Fiona','Iain','Morag','Callum','Eilidh','Ross','Kirsty','Euan','Shona','Hamish','Isla','Craig','Ailsa','Neil','Catriona'],i=['Morgan','Campbell','Fraser','McLeod','Kerr','Wallace','Boyd','Hamilton','Stewart','Murray','Paterson','Duncan','Gilmour','Reid','Ross','Grant'];const d=[{cat:'Fish & seafood',id:'haddock',name:'Haddock fillets',unit:'portions',onHand:8,perCover:.22,par:40},{cat:'Fruit & veg',id:'chips',name:'Chipping potatoes',unit:'kg',onHand:25,perCover:.18,par:40},{cat:'Fish & seafood',id:'langoustine',name:'Langoustines',unit:'kg',onHand:4,perCover:.03,par:6},{cat:'Fish & seafood',id:'mussels',name:'Mussels',unit:'kg',onHand:10,perCover:.05,par:12},{cat:'Fish & seafood',id:'scallops',name:'Scallops',unit:'portions',onHand:14,perCover:.06,par:20},{cat:'Meat',id:'beef',name:'Burger patties',unit:'each',onHand:30,perCover:.1,par:40},{cat:'Fruit & veg',id:'peas',name:'Garden peas',unit:'kg',onHand:6,perCover:.04,par:8},{cat:'Dairy',id:'tartare',name:'House tartare sauce',unit:'tubs',onHand:5,perCover:.05,par:10}],l=()=>(0,o.examplesAllowed)()?d:[];function u(o,a,n,r,s,i,d){const l=[],u=(0,e.forecastToday)(o,a,n,r,i);u.enough||l.push({id:'history',icon:'\ud83d\udcc5',tone:'gold',title:'Not enough history yet',body:u.suggestions[0]?.replace(/^Not enough history yet\. /,'')??'',action:{label:'Settings \u203a Advanced',tab:'more',sub:'advanced'}});const c=(0,t.ymd)(i),p=a.filter(e=>e.date===c&&'noshow'===e.status).length;p&&l.push({id:'noshow',icon:'\ud83e\ude91',tone:'amber',title:`${p} no-show${1===p?'':'s'} today`,body:'Think about a deposit for larger parties (Settings \u203a Advanced \u203a Deposits).',action:{label:'Bookings',tab:'bookings'}});const h=s.filter(e=>e.stars<=2).length;h&&l.push({id:'reviews',icon:'\ud83d\udcac',tone:'red',title:`${h} low rating${1===h?'':'s'} to read`,body:'Read what they said, reply to say thanks and invite them back.',action:{label:'Reviews',tab:'more',sub:'reviews'}});const b=r.filter(e=>e.date>=c).sort((e,t)=>e.date.localeCompare(t.date))[0];return b&&l.push({id:'event',icon:'\ud83d\udcc5',tone:'blue',title:`Coming up: ${b.title}`,body:`${(0,t.niceDate)(new Date(b.date+'T12:00:00'))}. Check your rota and think about a promo.`,action:{label:'Forecast',tab:'forecast'}}),l.push({id:'covers',icon:'\ud83c\udf7d\ufe0f',tone:'gold',title:`${d} covers so far today`,body:'Seated bookings and walk-ins recorded in CoverCharge today.'}),l}},1300,[868,818,1118]); +__d(function(g,r,i,a,m,e,_d){"use strict";function t(t,n){const o={};for(let c=0;c<7;c++){o[c]={};const u=n[c]??0;for(const[n,s]of Object.entries(t))o[c][Number(n)]=Math.round(s*u)}return o}Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"EXAMPLE_HISTORY",{enumerable:!0,get:function(){return s}}),Object.defineProperty(e,"EXAMPLE_ACCURACY",{enumerable:!0,get:function(){return f}});const n={12:18,13:26,14:16,15:9,16:10,17:22,18:36,19:38,20:20},o={12:2,13:2,14:1,15:1,16:2,17:4,18:6,19:5,20:2},c={0:1.05,1:0,2:0,3:.6,4:.7,5:1,6:1.15},u={0:.6,1:.5,2:.5,3:.6,4:.7,5:.9,6:1},s={anchorage:{covers:t(n,c),takeaway:t(o,c)},default:{covers:t(n,u),takeaway:t(o,u)}},f='Example: last 4 weeks within \xb118% of actual covers'},1301,[]); +__d(function(g,r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"DEFAULT_MIN_WEEKS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(e,"clampWeeks",{enumerable:!0,get:function(){return o}}),e.buildHistory=function(o,a,c,u,d,f=n){const l=(0,t.ymd)(d),y=(0,t.ymd)(new Date(d.getTime()-48384e5)),h=t=>t>=y&&tt.rid===o&&h(t.date));for(const t of k)D.add(t.date);const T=[...D].sort(),w=T.length?s(T[0],l):0,j=w>=7*f&&T.length>=2*f,O=t=>{const n={},o={};for(const t of T){const n=new Date(t+'T12:00:00').getDay();o[n]=(o[n]??0)+1}for(const[o,s]of Object.entries(t)){const t=new Date(o+'T12:00:00').getDay();n[t]??={};for(const[o,a]of Object.entries(s))n[t][Number(o)]=(n[t][Number(o)]??0)+a}for(const t of Object.keys(n))for(const s of Object.keys(n[+t]))n[+t][+s]=n[+t][+s]/(o[+t]||1);return n},M=Array.from({length:7},()=>[]);for(const t of k)'number'==typeof t.takings&&t.takings>0&&M[new Date(t.date+'T12:00:00').getDay()].push(Math.round(100*t.takings));const N=M.map(t=>t.length?Math.round(t.reduce((t,n)=>t+n,0)/t.length):null),_=k.filter(t=>'number'==typeof t.takings&&t.takings>0),E=(_.length?s(_.map(t=>t.date).sort()[0],l):0)>=7*f&&_.length>=2*f;return{covers:O(b),takeaway:O(p),days:T.length,spanDays:w,enough:j,minWeeks:f,takingsByDay:N,cashUps:_.length,salesEnough:E}};var t=r(_d[0]);const n=2,o=t=>{const o=Math.round(Number(t));return Number.isFinite(o)&&o>=1&&o<=8?o:n},s=(t,n)=>Math.round((new Date(n+'T12:00:00').getTime()-new Date(t+'T12:00:00').getTime())/864e5)},1302,[818]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"CHEF_ID",{enumerable:!0,get:function(){return x}}),_e.useChef=C,Object.defineProperty(_e,"isLow",{enumerable:!0,get:function(){return k}}),Object.defineProperty(_e,"stockValue",{enumerable:!0,get:function(){return j}}),Object.defineProperty(_e,"within7",{enumerable:!0,get:function(){return v}}),_e.useWeek=function(){const{k:e,c:r,now:t}=C(6e4),o=e.waste.filter(e=>v(e.at,t)).reduce((e,r)=>e+r.cost,0),n=e.stockTakes[0],s=n?n.lines.reduce((e,r)=>e+(r.expected-r.counted)*r.cost,0):0;return{...(0,b.weekGp)(r,o,s),wasteWeek:o,variance:Math.round(s)}},_e.useForecast=function(){const{r:e,rid:r,now:t}=C(6e4),o=(0,i.useBookings)(r),n=(0,i.useOrders)(r),s=(0,i.useEvents)(r),d=(0,u.useRealHistory)(r,t),c=(0,l.forecastToday)(e,o,n,s,t,d??void 0),f=c.hours.reduce((e,r)=>e+r.covers,0),b=c.hours.reduce((e,r)=>e+r.booked,0),p=c.hours.reduce((e,r)=>e+r.historicalCovers,0),y=c.enough&&p?Math.round((f-p)/p*100):0,w=['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'][(0,h.weekday)(t)],x=c.enough?`${w} ${y>=0?'+':''}${y}%${c.example?' (example figures)':''}`:'Not enough history yet';return{f:c,covers:f,booked:b,typical:p,pct:y,day:w,label:x,enough:c.enough,example:c.example}},_e.Tile=function({label:e,value:r,sub:t,tone:o,onPress:s,testID:i}){const d='red'===o?f.colours.red:'amber'===o?f.colours.amber:'ok'===o?f.colours.ok:f.colours.text;return(0,w.jsxs)(n.default,{testID:i,accessibilityRole:s?'button':void 0,accessibilityLabel:`${e}: ${r}`,onPress:s,style:({pressed:e})=>({flexGrow:1,flexBasis:150,minWidth:140,padding:12,borderRadius:14,borderWidth:1,borderColor:'red'===o?f.colours.red:f.colours.border,backgroundColor:e?'#1d1a14':f.colours.surface,gap:2}),children:[(0,w.jsx)(c.Muted,{children:e}),(0,w.jsx)(c.T,{size:22,weight:"bold",colour:d,children:r}),t?(0,w.jsx)(c.T,{size:12,colour:f.colours.muted,children:t}):null]})},_e.Seg=function({value:e,options:r,onChange:t}){return(0,w.jsx)(c.Row,{wrap:!0,gap:6,children:r.map(r=>(0,w.jsx)(n.default,{accessibilityRole:"tab",accessibilityState:{selected:e===r.id},accessibilityLabel:r.label,onPress:()=>t(r.id),style:{paddingHorizontal:12,paddingVertical:7,minHeight:44,minWidth:44,alignItems:'center',justifyContent:'center',borderRadius:999,borderWidth:1,borderColor:e===r.id?f.colours.gold:f.colours.border,backgroundColor:e===r.id?f.colours.goldTint:'transparent'},children:(0,w.jsx)(c.T,{size:13,weight:e===r.id?'semibold':'regular',colour:e===r.id?f.colours.goldLight:f.colours.text,children:r.label})},r.id))})},_e.Bar=function({pct:e,colour:r=f.colours.gold}){return(0,w.jsx)(s.default,{style:{height:6,borderRadius:3,backgroundColor:f.colours.surface2,overflow:'hidden'},children:(0,w.jsx)(s.default,{style:{width:`${Math.max(0,Math.min(100,e))}%`,height:6,backgroundColor:r}})})},Object.defineProperty(_e,"pct1",{enumerable:!0,get:function(){return S}});var r=_r(_d[0]),t=e(_r(_d[1])),o=_r(_d[2]),n=e(_r(_d[3])),s=e(_r(_d[4])),i=_r(_d[5]),d=_r(_d[6]),u=_r(_d[7]),l=_r(_d[8]),c=_r(_d[9]),f=_r(_d[10]),h=_r(_d[11]),b=_r(_d[12]),p=_r(_d[13]),y=_r(_d[14]),w=_r(_d[15]);const x=y.ROSTER.find(e=>'chef'===e.app)?.id??'';function C(e=3e4){const n=(0,d.useOwner)(e=>e.site),s=(0,i.useRestaurant)(n),u=(0,d.useOwner)(e=>e.staff),l=u.find(e=>e.id===x)?.name??'Head Chef',c=(0,i.useNow)(e),f=(0,i.useAllMenu)(n),h=(0,p.useKitchen)(),y=t.default.useMemo(()=>{const e=r.LIVE_HEAD_CHEF?{...h,...(0,p.stripKitchenExamples)(h)}:h,t=e.ingredients.filter(e=>(0,o.chefCanSee)(n,e)),s=new Set(e.ingredients.filter(e=>!(0,o.chefCanSee)(n,e)).map(e=>e.id));return{...e,ingredients:t,temps:e.temps.filter(e=>(0,o.chefCanSee)(n,e)),waste:e.waste.filter(e=>(0,o.chefCanSee)(n,e)&&!s.has(e.ing||'')),deliveries:e.deliveries.filter(e=>(0,o.chefCanSee)(n,e)).map(e=>({...e,lines:e.lines.filter(e=>!s.has(e.ing))})),orders:e.orders.filter(e=>(0,o.chefCanSee)(n,e)).map(e=>({...e,lines:e.lines.filter(e=>!s.has(e.ing))}))}},[h,n]),w=(0,b.costings)(f,y.recipes,y.ingredients,y.targetGp);return{rid:n,r:s,me:l,now:c,menu:f,k:y,c:w}}const k=(e,r)=>e>0&&e<.5*r,j=e=>Math.round(e.reduce((e,r)=>e+r.onHand*r.cost,0)),v=(e,r)=>r.getTime()-new Date(e).getTime()<6048e5;const S=e=>`${e.toFixed(1)}%`},1303,[1230,30,1023,263,127,819,854,1304,868,813,821,926,1299,1202,14,24]); +__d(function(g,_r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.useRealHistory=function(e,t){const o=(0,l.useExamples)(),n=(0,r.useBookings)(e),c=(0,r.useOrders)(e),f=(0,u.useCashUp)(e=>e.cashUps),y=(0,k.clampWeeks)((0,h.useStore)(s=>s.restaurants.find(s=>s.id===e)?.settings.forecastMinWeeks)),b=t.toDateString();return(0,s.useMemo)(()=>o?null:(0,k.buildHistory)(e,n,c,f.map(e=>({rid:e.rid,date:e.date,takings:(0,p.takings)(e.vals)})),t,y),[o,e,n,c,f,y,b])},Object.defineProperty(_e,"ExampleBadge",{enumerable:!0,get:function(){return b}}),_e.NotEnoughHistory=function({weeks:e,booked:s,what:t="Forecasts",testID:r="not-enough-history"}){return(0,y.jsx)(n.Card,{children:(0,y.jsxs)(o.default,{testID:r,style:{gap:6},children:[(0,y.jsx)(n.T,{weight:"semibold",colour:f.colours.gold,children:"Not enough history yet"}),(0,y.jsx)(n.Muted,{children:'Forecasts'===t?(0,c.notEnoughTip)(e):`${t} start once CoverCharge has ${1===e?'1 week':`${e} weeks`} of your bookings and cash-ups.`}),s?(0,y.jsx)(o.default,{testID:`${r}-booked`,children:(0,y.jsxs)(n.T,{children:["Booked so far: ",s," covers"]})}):null,(0,y.jsx)(n.Muted,{children:"Tip: upload or add your bookings and do the cash up each night. Managers can change how much history is needed in Settings \u203a Advanced."})]})})};var e,s=_r(d[0]),t=_r(d[1]),o=(e=t)&&e.__esModule?e:{default:e},n=_r(d[2]),r=_r(d[3]),u=_r(d[4]),c=_r(d[5]),l=_r(d[6]),h=_r(d[7]),p=_r(d[8]),k=_r(d[9]),f=_r(d[10]),y=_r(d[11]);const b=()=>(0,y.jsx)(n.Badge,{kind:"amber",label:c.EXAMPLE_LABEL.toUpperCase()})},1304,[30,127,813,819,1092,1118,1305,870,1108,1302,821,24]); +__d(function(g,r,i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"useExamples",{enumerable:!0,get:function(){return l}});var t=r(d[0]),n=r(d[1]);const l=()=>(0,t.useSyncExternalStore)(n.onDataModeChange,n.examplesAllowed,n.examplesAllowed)},1305,[30,1118]); +__d(function(g,_r,_i,_a,m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.GpScreen=function({initial:e="dishes"}){const[t,l]=(0,s.useState)(e),{k:o}=(0,c.useChef)(),d=(0,a.useKitchen)(e=>e.setTarget);return(0,h.jsxs)(i.default,{style:{gap:12},children:[(0,h.jsx)(n.Card,{children:(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsxs)(i.default,{style:{flex:1},children:[(0,h.jsx)(n.T,{weight:"semibold",children:"Target GP"}),(0,h.jsx)(n.Muted,{children:"Dishes under target are flagged red."})]}),(0,h.jsx)(n.Button,{small:!0,kind:"secondary",label:"\u2212",accessibilityLabel:"Lower target",onPress:()=>d(o.targetGp-1)}),(0,h.jsxs)(n.T,{size:22,weight:"bold",colour:r.colours.gold,children:[o.targetGp,"%"]}),(0,h.jsx)(n.Button,{small:!0,kind:"secondary",label:"+",accessibilityLabel:"Raise target",onPress:()=>d(o.targetGp+1)})]})}),(0,h.jsx)(c.Seg,{value:t,onChange:l,options:[{id:'dishes',label:'Recipe cards & GP'},{id:'changes',label:'Price changes'},{id:'week',label:'Theoretical vs actual'},{id:'engineering',label:'Menu engineering'}]}),'dishes'===t?(0,h.jsx)(u,{}):'changes'===t?(0,h.jsx)(j,{}):'week'===t?(0,h.jsx)(b,{}):(0,h.jsx)(w,{})]})};var s=_r(_d[0]),t=e(_r(_d[1])),i=e(_r(_d[2])),n=_r(_d[3]),l=_r(_d[4]),r=_r(_d[5]),o=_r(_d[6]),d=_r(_d[7]),c=_r(_d[8]),a=_r(_d[9]),h=_r(_d[10]);function u(){const{c:e,k:t}=(0,c.useChef)(),[l,r]=(0,s.useState)(null),o=e.filter(e=>e.below),d=[...e].sort((e,s)=>e.gp-s.gp),a=e.find(e=>e.item.id===l);return e.length?(0,h.jsxs)(i.default,{style:{gap:10},children:[(0,h.jsx)(n.Muted,{children:"Menu prices include VAT (20%). GP is worked out on the price ex VAT: (price ex VAT \u2212 dish cost) \xf7 price ex VAT. VAT figures are for information only."}),o.length?(0,h.jsxs)(n.Banner,{kind:"danger",title:`${o.length} of ${e.length} dishes below ${t.targetGp}%`,children:[o.slice(0,6).map(e=>e.item.name).join(', '),o.length>6?'\u2026':'']}):(0,h.jsx)(n.Banner,{kind:"success",title:"All costed dishes on target"}),d.map(e=>(0,h.jsx)(p,{d:e,onPress:()=>r(e.item.id)},e.item.id)),(0,h.jsx)(n.Sheet,{visible:!!a,onClose:()=>r(null),title:a?.item.name??'',children:a?(0,h.jsx)(x,{d:a}):null})]}):(0,h.jsx)(n.Muted,{children:"No costed dishes yet. Add your real recipes and ingredient costs to see GP."})}function p({d:e,onPress:s}){return(0,h.jsxs)(t.default,{accessibilityRole:"button",accessibilityLabel:`${e.item.name}, GP ${e.gp.toFixed(1)} percent`,onPress:s,style:({pressed:s})=>({padding:12,borderRadius:12,borderWidth:1,borderColor:e.below?r.colours.red:r.colours.border,backgroundColor:s?'#1d1a14':e.below?r.colours.redBg:r.colours.surface,gap:2}),children:[(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{weight:"medium",style:{flex:1},children:e.item.name}),(0,h.jsx)(n.T,{weight:"bold",colour:e.below?r.colours.red:r.colours.ok,children:(0,c.pct1)(e.gp)})]}),(0,h.jsxs)(n.Muted,{children:["Cost ",(0,l.gbp)(e.cost)," \xb7 ",(0,l.gbp)(e.priceInc)," inc VAT (",(0,l.gbp)(e.priceEx)," ex) \xb7 cash GP ",(0,l.gbp)(e.cashGp)]}),e.below?(0,h.jsxs)(n.T,{size:12,colour:r.colours.red,children:["Below ",e.target,"%: price for target ",(0,l.gbp)((0,d.priceForTarget)(e.cost,e.target))," inc VAT"]}):null]})}function x({d:e}){const s=(0,a.useKitchen)(),t=s.recipes.find(s=>s.dishId===e.item.id);return(0,h.jsxs)(i.default,{style:{gap:8},children:[(0,h.jsxs)(n.Muted,{children:["Recipe card \xb7 ",t.yield]}),t.lines.map(t=>{const r=s.ingredients.find(e=>e.id===t.ing);if(!r)return null;const o='each'===r.unit?1:'kg'===r.unit&&t.qty<.1?.005:.01;return(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsxs)(i.default,{style:{flex:1},children:[(0,h.jsx)(n.T,{size:14,children:r.name}),(0,h.jsxs)(n.Muted,{children:[(0,l.gbp)(r.cost)," per ",r.unit]})]}),(0,h.jsx)(n.Button,{small:!0,kind:"ghost",label:"\u2212",accessibilityLabel:`Less ${r.name}`,onPress:()=>s.setRecipeQty(e.item.id,t.ing,Math.max(0,Math.round(1e3*(t.qty-o))/1e3))}),(0,h.jsx)(n.T,{size:13,style:{width:64,textAlign:'center'},children:(0,d.fmtQty)(t.qty,r.unit)}),(0,h.jsx)(n.Button,{small:!0,kind:"ghost",label:"+",accessibilityLabel:`More ${r.name}`,onPress:()=>s.setRecipeQty(e.item.id,t.ing,Math.round(1e3*(t.qty+o))/1e3)}),(0,h.jsx)(n.T,{size:13,style:{width:60,textAlign:'right'},children:(0,l.gbp)(Math.round(r.cost*t.qty))})]},t.ing)}),(0,h.jsxs)(i.default,{style:{borderTopWidth:1,borderColor:r.colours.border,paddingTop:8,gap:4},children:[(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{children:"Dish cost"}),(0,h.jsx)(n.T,{weight:"semibold",children:(0,l.gbp)(e.cost)})]}),(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{children:"Selling price inc VAT"}),(0,h.jsx)(n.T,{children:(0,l.gbp)(e.priceInc)})]}),(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.Muted,{children:"VAT (20%, for info)"}),(0,h.jsx)(n.Muted,{children:(0,l.gbp)(e.priceInc-e.priceEx)})]}),(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{children:"Price ex VAT"}),(0,h.jsx)(n.T,{children:(0,l.gbp)(e.priceEx)})]}),(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{children:"Cash GP"}),(0,h.jsx)(n.T,{weight:"semibold",children:(0,l.gbp)(e.cashGp)})]}),(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{children:"GP %"}),(0,h.jsx)(n.T,{weight:"bold",colour:e.below?r.colours.red:r.colours.ok,children:(0,c.pct1)(e.gp)})]}),(0,h.jsxs)(n.Banner,{kind:e.below?'warn':'info',title:`Price that hits ${e.target}%: ${(0,l.gbp)((0,d.priceForTarget)(e.cost,e.target))} inc VAT`,children:["Or bring the dish cost down to ",(0,l.gbp)(Math.floor(e.priceEx*(1-e.target/100))),". Prices are changed in CoverCharge for Managers (Menu & allergens)."]})]})]})}function j(){const{menu:e,k:s}=(0,c.useChef)(),t=(0,d.priceImpacts)(e,s.recipes,s.ingredients,s.targetGp);return t.length?(0,h.jsx)(i.default,{style:{gap:10},children:t.map(e=>(0,h.jsxs)(n.Card,{highlight:e.dropped.length?r.colours.red:void 0,children:[(0,h.jsxs)(n.T,{weight:"semibold",children:[e.ing.name," ",e.pct>0?'+':'',e.pct.toFixed(0),"%: ",e.dropped.length," dish",1===e.dropped.length?'':'es'," drop below target"]}),(0,h.jsxs)(n.Muted,{children:[(0,l.gbp)(e.ing.prevCost??0)," \u2192 ",(0,l.gbp)(e.ing.cost)," per ",e.ing.unit]}),e.dishes.map(e=>(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{size:14,style:{flex:1},children:e.item.name}),(0,h.jsxs)(n.T,{size:13,colour:r.colours.muted,children:[(0,c.pct1)(e.before)," \u2192 "]}),(0,h.jsx)(n.T,{size:13,weight:"semibold",colour:e.below?r.colours.red:r.colours.ok,children:(0,c.pct1)(e.after)}),e.dropped?(0,h.jsx)(n.Badge,{kind:"red",label:"NOW BELOW"}):null]},e.item.id))]},e.ing.id))}):(0,h.jsx)(n.Muted,{children:"No ingredient price changes since the last deliveries."})}function b(){const{k:e}=(0,c.useChef)(),s=(0,c.useWeek)();return s.sales?(0,h.jsxs)(i.default,{style:{gap:10},children:[(0,h.jsxs)(n.Row,{wrap:!0,gap:10,children:[(0,h.jsx)(c.Tile,{label:"Theoretical GP (recipes \xd7 sales)",value:(0,c.pct1)(s.theo),tone:s.theoe.soldWeek>0),t=s.reduce((e,s)=>e+s.soldWeek,0)/Math.max(1,s.length),r=s.reduce((e,s)=>e+s.cashGp,0)/Math.max(1,s.length),d={Star:[],'Plough horse':[],Puzzle:[],Dog:[]};return s.forEach(e=>d[(0,o.quadrant)(e.soldWeek,e.cashGp,t,r)].push(e)),(0,h.jsxs)(i.default,{style:{gap:10},children:[s.length?(0,h.jsx)(n.Muted,{children:"Popularity (sold per week) against cash GP per dish, using the live menu from CoverCharge for Managers. Example sales figures."}):(0,h.jsx)(n.Muted,{children:"Needs dish sales figures, which CoverCharge doesn't have on a real venue yet (no till link). Nothing is guessed."}),Object.keys(d).map(e=>(0,h.jsxs)(n.Card,{children:[(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{weight:"semibold",children:'Star'===e?'\u2b50 Stars':'Plough horse'===e?'\ud83d\udc0e Plough horses':'Puzzle'===e?'\u2754 Puzzles':'\ud83d\udc15 Dogs'}),(0,h.jsx)(n.Badge,{kind:"gold",label:`${d[e].length}`})]}),(0,h.jsx)(n.Muted,{children:o.QUADRANT_TIP[e]}),d[e].map(e=>(0,h.jsxs)(n.Row,{style:{justifyContent:'space-between'},children:[(0,h.jsx)(n.T,{size:14,style:{flex:1},children:e.item.name}),(0,h.jsxs)(n.Muted,{children:[e.soldWeek,"/wk \xb7 ",(0,l.gbp)(e.cashGp)," \xb7 ",(0,c.pct1)(e.gp)]})]},e.item.id))]},e))]})}},1306,[30,263,127,813,816,821,1300,1299,1303,1202,24]); +__d(function(g,_r,_i,_a,_m,_e,_d){"use strict";function e(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(_e,'__esModule',{value:!0}),_e.PrepScreen=function(){const{k:e,menu:t,me:s,now:i}=(0,M.useChef)(),{covers:n,label:r,typical:l,enough:a,booked:o,f:c}=(0,M.useForecast)(),f=(0,w.ymd)(i),m=(0,T.dishStats)(t).filter(t=>e.recipes.some(e=>e.dishId===t.item.id)&&!['Sides','Desserts'].includes(t.item.section)),p=m.reduce((e,t)=>e+t.sold,0)||1,x=m.map(e=>({id:e.item.id,name:e.item.name,qty:Math.ceil(.85*n*(e.sold/p)*1.1)})).filter(e=>e.qty>0).sort((e,t)=>t.qty-e.qty),y={};x.forEach(t=>e.recipes.find(e=>e.dishId===t.id)?.lines.forEach(e=>{y[e.ing]=(y[e.ing]??0)+e.qty*t.qty}));const b=[{id:'haddock',text:`Portion ${x.filter(e=>['a-fishsupper','a-mini','a-tempura'].includes(e.id)).reduce((e,t)=>e+t.qty,0)} haddock portions (fish supper, tempura, Mini Anchors)`},{id:'chips',text:`Peel, cut and blanch ${(0,v.fmtQty)(Math.ceil(2*(y.potatoes??0))/2,'kg')} chipping potatoes`},{id:'batter',text:`Make up ${(0,v.fmtQty)(Math.ceil(10*(y.batter??0))/10+.5,'kg')} beer batter`},{id:'leaves',text:`Wash and spin ${(0,v.fmtQty)(Math.ceil(10*(y.leaves??0))/10,'kg')} salad leaves`},{id:'mussels',text:`Clean and debeard ${(0,v.fmtQty)(Math.ceil(2*(y.mussels??0))/2,'kg')} mussels (discard any open that don't close)`},{id:'sauce',text:'Garlic butter, tartare and Marie Rose: check, make and date-label'}],j=(0,B.useKitchen)(e=>e.tickPrep),C=[...b.map(e=>({key:`${f}:task:${e.id}`,text:e.text})),...x.map(e=>({key:`${f}:dish:${e.id}`,text:`${e.qty} \xd7 ${e.name}`}))],S=C.filter(t=>e.prepTicks[t.key]).length;return e.recipes.length&&e.ingredients.length?(0,D.jsxs)(h.default,{style:{gap:10},children:[a?null:(0,D.jsx)(u.Banner,{kind:"info",title:`Booked so far: ${o} covers`,children:`Not enough history yet. Forecasts start once CoverCharge has ${c.minWeeks} weeks of your bookings and cash-ups. Prep from what is booked and your own judgement.`}),a?(0,D.jsxs)(u.Banner,{kind:"info",title:`${r}: ${n} covers forecast`,children:["A typical ",r.split(' ')[0]," is about ",l," covers. Portions below are scaled from the forecast, bookings and the usual dish mix, plus 10% cover."]}):null,(0,D.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,D.jsx)(u.T,{weight:"semibold",children:"Prep list for today"}),(0,D.jsx)(u.Badge,{kind:S===C.length?'ok':'gold',label:`${S}/${C.length} done`})]}),C.map((t,i)=>{const n=e.prepTicks[t.key];return(0,D.jsxs)(d.default,{accessibilityRole:"checkbox",accessibilityState:{checked:!!n},accessibilityLabel:t.text,onPress:()=>j(t.key,n?null:s),style:{flexDirection:'row',gap:10,alignItems:'center',padding:10,borderRadius:10,borderWidth:1,borderColor:n?k.colours.ok:k.colours.border,backgroundColor:k.colours.surface,marginTop:i===b.length?8:0},children:[(0,D.jsx)(u.T,{size:18,colour:n?k.colours.ok:k.colours.muted,children:n?'\u2611':'\u2610'}),(0,D.jsxs)(h.default,{style:{flex:1},children:[(0,D.jsx)(u.T,{size:14,style:n?{textDecorationLine:'line-through',color:k.colours.muted}:void 0,children:t.text}),n?(0,D.jsxs)(u.Muted,{children:[n.by," \xb7 ",new Date(n.at).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})]}):null]})]},t.key)})]}):(0,D.jsx)(u.Muted,{children:"No prep list yet. Add your real recipe costs and ingredients to build it."})},_e.WasteScreen=function(){const{k:e,me:n,now:r,rid:l}=(0,M.useChef)(),a=(0,M.useWeek)(),d=(0,B.useKitchen)(e=>e.addWaste),[f,m]=(0,o.useState)(e.ingredients[0]?.id),[p,x]=(0,o.useState)(''),[y,j]=(0,o.useState)('Over-production'),w=e.ingredients.find(e=>e.id===f),C=Number(p.replace(',','.'))||0,S=C>=0&&(!w||!(0,s.fishInStone)(l,w)||Number.isInteger(2*C)),T=w&&S?(0,s.inputQuantity)(l,w,C):0,v=e.waste.filter(e=>(0,M.within7)(e.at,r));return w?(0,D.jsxs)(h.default,{style:{gap:10},children:[(0,D.jsxs)(u.Row,{wrap:!0,gap:10,children:[(0,D.jsx)(M.Tile,{label:"Waste this week",value:(0,b.gbp)(a.wasteWeek),sub:`${v.length} entries`,tone:a.sales&&a.wasteWeek/a.sales>.02?'amber':'ok'}),(0,D.jsx)(M.Tile,{label:"Waste as % of food sales",value:a.sales?(0,M.pct1)(a.wasteWeek/a.sales*100):'\u2014',sub:a.sales?'Food sales ex VAT, this week':'Needs dish sales (no till link yet)'})]}),(0,D.jsxs)(u.Card,{children:[(0,D.jsx)(u.T,{weight:"semibold",children:"Log waste"}),(0,D.jsx)(c.default,{horizontal:!0,showsHorizontalScrollIndicator:!1,children:(0,D.jsx)(u.Row,{gap:6,children:e.ingredients.map(e=>(0,D.jsx)(u.Chip,{label:e.name,selected:e.id===f,onPress:()=>m(e.id)},e.id))})}),(0,D.jsxs)(u.Row,{gap:8,children:[(0,D.jsx)(t.TextInput,{accessibilityLabel:`Waste quantity in ${(0,s.quantityUnit)(l,w)}`,accessibilityValue:{text:(0,i.ingredientSpeech)(l,w,T)},keyboardType:"decimal-pad",value:p,onChangeText:x,placeholder:`qty (${(0,s.quantityUnit)(l,w)})`,placeholderTextColor:k.colours.muted,style:{flex:1,minHeight:44,borderWidth:1,borderColor:k.colours.border,borderRadius:8,padding:8,color:k.colours.text}}),(0,D.jsx)(u.T,{children:(0,s.quantityUnit)(l,w)}),(0,D.jsx)(u.T,{weight:"semibold",colour:k.colours.gold,children:(0,b.gbp)(Math.round(T*w.cost))})]}),(0,s.fishInStone)(l,w)?(0,D.jsxs)(u.Row,{children:[(0,D.jsx)(u.Button,{small:!0,kind:"secondary",label:"Less",accessibilityLabel:`Waste half a stone less ${w.name}`,onPress:()=>x(String(Math.max(0,(0,s.halfStone)(C)-.5)))}),(0,D.jsx)(u.Button,{small:!0,kind:"secondary",label:"More",accessibilityLabel:`Waste half a stone more ${w.name}`,onPress:()=>x(String((0,s.halfStone)(C)+.5))}),(0,D.jsx)(u.Muted,{children:"Half-stone amounts"})]}):null,(0,D.jsx)(u.Row,{wrap:!0,gap:6,children:B.WASTE_REASONS.map(e=>(0,D.jsx)(u.Chip,{label:e,selected:e===y,onPress:()=>j(e)},e))}),(0,D.jsx)(u.Button,{label:"Add to waste log",disabled:T<=0,onPress:()=>{d({by:n,item:w.name,ing:w.id,qty:T,unit:w.unit,reason:y,cost:Math.round(T*w.cost)}),x('')}}),(0,D.jsx)(u.Muted,{children:"Logged waste also comes off stock."})]}),e.waste.slice(0,20).map(e=>(0,D.jsxs)(u.Row,{style:{justifyContent:'space-between',paddingVertical:2},children:[(0,D.jsxs)(h.default,{style:{flex:1},children:[(0,D.jsxs)(u.T,{size:14,children:[e.item," \xb7 ",(0,i.ingredientQty)(l,{name:e.item,unit:e.unit},e.qty)]}),(0,D.jsxs)(u.Muted,{children:[e.reason," \xb7 ",new Date(e.at).toLocaleDateString('en-GB',{weekday:'short',day:'numeric',month:'short'})," \xb7 ",e.by]})]}),(0,D.jsx)(u.T,{size:14,children:(0,b.gbp)(e.cost)})]},e.id))]}):(0,D.jsx)(u.Muted,{children:"No stock items yet. Add your real ingredients before logging waste."})},_e.AllergenScreen=function({openCards:e}={}){const{k:t,me:s,rid:i}=(0,M.useChef)(),n=(0,f.useRecipeCards)(i),r=(0,x.auditView)('chef',(0,f.useAudit)(i)).filter(e=>/allergen|recipe card|sign/i.test(e.text)).slice(0,12),l=n.slice().sort((e,t)=>e.section.localeCompare(t.section)||e.dish.localeCompare(t.dish)).map(e=>{const s=t.recipes.find(t=>t.dishId===e.menuItemId),i=new Set(s?s.lines.flatMap(e=>t.ingredients.find(t=>t.id===e.ing)?.allergens??[]):[]),n=[...i].filter(t=>!e.allergens[t]);return{card:e,fromCosting:i,missing:n}}),a={name:s,role:'head-chef'};return(0,D.jsxs)(h.default,{style:{gap:10},testID:"allergen-matrix",children:[(0,D.jsx)(u.Muted,{children:"The 14 allergens from each recipe card (C contains, m may contain). These are what guests see on the menu, takeaway and the booking allergy check. A red cell means the costing recipe uses an ingredient with that allergen but the card doesn't list it."}),e?(0,D.jsx)(u.Button,{testID:"open-recipe-cards",small:!0,kind:"secondary",label:"Open recipe cards \u203a",onPress:e}):null,(0,D.jsx)(c.default,{horizontal:!0,children:(0,D.jsxs)(h.default,{children:[(0,D.jsxs)(u.Row,{gap:0,children:[(0,D.jsx)(h.default,{style:{width:150},children:(0,D.jsx)(u.Muted,{children:"Dish"})}),y.ALLERGENS.map(e=>(0,D.jsx)(h.default,{style:{width:34,alignItems:'center'},children:(0,D.jsx)(u.T,{size:10,colour:k.colours.muted,children:e.short})},e.id))]}),l.map(({card:e,fromCosting:t})=>(0,D.jsxs)(u.Row,{gap:0,style:{borderTopWidth:1,borderColor:k.colours.border,paddingVertical:4},children:[(0,D.jsx)(h.default,{style:{width:150},children:(0,D.jsx)(u.T,{size:12,numberOfLines:2,children:e.dish})}),y.ALLERGENS.map(s=>{const i=e.allergens[s.id],n=t.has(s.id)&&!i;return(0,D.jsx)(h.default,{accessibilityLabel:`${e.dish} ${s.label}: ${'contains'===i?'contains':'may'===i?'may contain':n?'in the costing recipe, not on the card':'no'}`,style:{width:34,height:24,alignItems:'center',justifyContent:'center',backgroundColor:n?k.colours.redBg:'transparent'},children:(0,D.jsx)(u.T,{size:11,weight:'contains'===i?'bold':'regular',colour:n?k.colours.red:'contains'===i?k.colours.gold:i?k.colours.muted:'#444',children:'contains'===i?'C':'may'===i?'m':n?'!':'\xb7'})},s.id)})]},e.id))]})}),(0,D.jsx)(u.Muted,{children:"C card says contains \xb7 m may contain \xb7 ! in the costing recipe but not on the card"}),l.filter(e=>e.missing.length||!e.card.signOff).map(({card:t,missing:s})=>(0,D.jsxs)(u.Card,{highlight:s.length?k.colours.red:k.colours.amber,children:[(0,D.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,D.jsx)(u.T,{weight:"semibold",style:{flex:1},children:t.dish}),t.signOff?(0,D.jsx)(u.Badge,{kind:"ok",label:"Signed off"}):(0,D.jsx)(u.Badge,{kind:"amber",label:"Awaiting sign-off"})]}),s.length?(0,D.jsxs)(u.T,{size:13,colour:k.colours.red,children:["Costing recipe has ",s.map(e=>y.ALLERGENS.find(t=>t.id===e)?.short).join(', '),", not on the card"]}):null,(0,D.jsxs)(u.Row,{wrap:!0,gap:8,children:[s.length?(0,D.jsx)(u.Button,{small:!0,label:"Add to the card",onPress:()=>{const e={...t.allergens};s.forEach(t=>{e[t]='contains'}),(0,m.recipeCards)().update(t.id,{allergens:e},a).catch(()=>{})}}):null,e?(0,D.jsx)(u.Button,{small:!0,kind:"secondary",label:"Check and sign off on the card",onPress:e}):null]})]},t.id)),(0,D.jsxs)(u.Card,{children:[(0,D.jsx)(u.T,{weight:"semibold",children:"Audit log"}),r.length?r.map(e=>(0,D.jsxs)(u.Muted,{children:[new Date(e.at).toLocaleString('en-GB',{day:'numeric',month:'short',hour:'2-digit',minute:'2-digit'})," \xb7 ",e.text]},e.id)):(0,D.jsx)(u.Muted,{children:"No allergen changes yet."})]})]})},_e.ComplianceScreen=function(){const{k:e,me:s,now:i,rid:r}=(0,M.useChef)(),l=(0,w.ymd)(i),a=(0,B.useKitchen)(e=>e.addTemp),c=(0,p.useOwner)(e=>e.checks),{tick:f,untick:m}=p.useOwner.getState(),[x,y]=(0,o.useState)('fridge'),b=A.find(e=>e.id===x),j={...b,units:b.units.filter(e=>(0,n.chefCanSee)(r,e))},[C,S]=(0,o.useState)(j.units[0]),[T,v]=(0,o.useState)(''),R=Number(T.replace(',','.')),$=T.trim()&&!Number.isNaN(R)?j.ok(R):null,I=e.temps.filter(e=>e.at.slice(0,10)===l),L=(e,t,i)=>{const n=c[e];return(0,D.jsxs)(d.default,{accessibilityRole:"checkbox",accessibilityState:{checked:!!n},accessibilityLabel:t,onPress:()=>n?m(e):f(e,s,(new Date).toISOString()),style:{flexDirection:'row',gap:10,alignItems:'center',paddingVertical:6},children:[(0,D.jsx)(u.T,{size:18,colour:n?k.colours.ok:k.colours.muted,children:n?'\u2611':'\u2610'}),(0,D.jsxs)(h.default,{style:{flex:1},children:[(0,D.jsx)(u.T,{size:14,children:t}),(0,D.jsx)(u.Muted,{children:n?`${n.by} \xb7 ${new Date(n.at).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})}`:i??''})]})]},e)};return(0,D.jsxs)(h.default,{style:{gap:10},children:[(0,D.jsxs)(u.Card,{children:[(0,D.jsx)(u.T,{weight:"semibold",children:"Record a temperature"}),(0,D.jsx)(u.Row,{wrap:!0,gap:6,children:A.map(e=>(0,D.jsx)(u.Chip,{label:e.label,selected:e.id===x,onPress:()=>{y(e.id),S(e.units.filter(e=>(0,n.chefCanSee)(r,e))[0])}},e.id))}),(0,D.jsx)(u.Row,{wrap:!0,gap:6,children:j.units.map(e=>(0,D.jsx)(u.Chip,{label:e,selected:e===C,onPress:()=>S(e)},e))}),(0,D.jsx)(u.Muted,{children:j.rule}),(0,D.jsxs)(u.Row,{gap:8,children:[(0,D.jsx)(t.TextInput,{accessibilityLabel:"Temperature in degrees C",keyboardType:"numbers-and-punctuation",value:T,onChangeText:v,placeholder:"\xb0C",placeholderTextColor:k.colours.muted,style:{width:90,borderWidth:1,borderColor:k.colours.border,borderRadius:8,padding:8,color:k.colours.text}}),null===$?null:(0,D.jsx)(u.Badge,{kind:!0===$?'ok':'warn'===$?'amber':'red',label:!0===$?'OK':'warn'===$?'CHECK':'OUT OF RANGE'}),(0,D.jsx)(u.Button,{small:!0,label:"Save",disabled:null===$,onPress:()=>{a({by:s,kind:x,unit:C,temp:R,note:!0===$?void 0:'Action needed'}),v('')}})]}),!1===$?(0,D.jsx)(u.Banner,{kind:"danger",title:"Out of range",children:"Record what you did (e.g. moved food, called the engineer, cooked longer) and re-check."}):null]}),(0,D.jsxs)(u.Card,{children:[(0,D.jsxs)(u.T,{weight:"semibold",children:["Today's readings (",I.length,")"]}),I.length?I.map(e=>{const t=A.find(t=>t.id===e.kind)?.ok(e.temp);return(0,D.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,D.jsx)(u.T,{size:14,style:{flex:1},children:e.unit}),(0,D.jsx)(u.Muted,{children:new Date(e.at).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})}),(0,D.jsxs)(u.T,{size:14,weight:"semibold",colour:!0===t?k.colours.ok:'warn'===t?k.colours.amber:k.colours.red,children:[e.temp,"\xb0C"]})]},e.id)}):(0,D.jsx)(u.Muted,{children:"None yet today."})]}),(0,D.jsxs)(u.Card,{children:[(0,D.jsx)(u.T,{weight:"semibold",children:"Opening and closing checks"}),(0,D.jsx)(u.Muted,{children:"Day-to-day checks in the style of a CookSafe diary. Your own CookSafe manual is the record that counts."}),P.map(e=>L(`${l}:kc-${e.id}`,e.text))]}),(0,D.jsxs)(u.Card,{children:[(0,D.jsx)(u.T,{weight:"semibold",children:"Cleaning schedule"}),N.map(e=>L('Daily'===e.freq?`${l}:kcl-${e.id}`:`wk${Math.floor(i.getTime()/6048e5)}:kcl-${e.id}`,e.text,e.freq))]})]})},_e.TeamScreen=function(){const{rid:e,r:t,me:s,now:i,menu:n}=(0,M.useChef)(15e3),[r,a]=(0,o.useState)('live'),d=(0,S.useSignedIn)(),c=(0,o.useMemo)(()=>({meId:d?.id??M.CHEF_ID,role:'staff'}),[d?.id]);return(0,D.jsx)(C.ChatAsCtx.Provider,{value:c,children:(0,D.jsxs)(h.default,{style:{gap:10},children:[(0,D.jsx)(q,{sub:r,setSub:a}),'live'===r?(0,D.jsx)(E,{}):'soldout'===r?(0,D.jsx)(l.SoldOutList,{rid:e,by:s}):'team'===r?(0,D.jsx)(G,{}):(0,D.jsx)(W,{}),void 0,void 0,void 0,void 0,void 0]})})};var t=_r(_d[0]),s=_r(_d[1]),i=_r(_d[2]),n=_r(_d[3]),r=_r(_d[4]),l=_r(_d[5]),a=_r(_d[6]),o=_r(_d[7]),d=e(_r(_d[8])),c=e(_r(_d[9])),h=e(_r(_d[10])),u=_r(_d[11]),f=_r(_d[12]),m=_r(_d[13]),p=_r(_d[14]),x=_r(_d[15]),y=_r(_d[16]),b=_r(_d[17]),j=_r(_d[18]),w=_r(_d[19]),k=_r(_d[20]),C=_r(_d[21]),S=_r(_d[22]),T=_r(_d[23]),v=_r(_d[24]),R=_r(_d[25]),$=_r(_d[26]),M=_r(_d[27]),B=_r(_d[28]),I=_r(_d[29]),L=_r(_d[30]),O=_r(_d[31]),z=_r(_d[32]),D=_r(_d[33]);const A=[{id:'fridge',label:'Fridge',units:['Walk-in fridge','Prep fridge','Bar fridge'],rule:'Target 5\xb0C or below (8\xb0C maximum)',ok:e=>e<=5||e<=8&&'warn'},{id:'freezer',label:'Freezer',units:['Chest freezer','Upright freezer'],rule:'Target \u221218\xb0C or below',ok:e=>e<=-18||e<=-15&&'warn'},{id:'cook',label:'Cooking (core)',units:['Fish','Chicken','Pie','Burger'],rule:'Core 75\xb0C or above',ok:e=>e>=75},{id:'reheat',label:'Reheating',units:['Soup','Skink','Sauce'],rule:'Core 82\xb0C or above (Scotland)',ok:e=>e>=82},{id:'hot hold',label:'Hot holding',units:['Bain-marie','Soup kettle'],rule:'63\xb0C or above',ok:e=>e>=63},{id:'cool',label:'Cooling',units:['Stock','Rice','Braise'],rule:'Below 8\xb0C, cooled as quickly as possible (aim for 90 minutes)',ok:e=>e<8||'warn'}],N=[{id:'surfaces',text:'Work surfaces and boards cleaned and sanitised',freq:'Daily'},{id:'fryers',text:'Fryers filtered, oil checked',freq:'Daily'},{id:'floors',text:'Floors and drains',freq:'Daily'},{id:'handwash',text:'Wash-hand basins stocked (soap, towels)',freq:'Daily'},{id:'fridges',text:'Fridges emptied and cleaned',freq:'Weekly'},{id:'extract',text:'Extraction canopy filters',freq:'Weekly'}],P=[{id:'open-temps',text:'Opening: fridge and freezer temperatures recorded',when:'Opening'},{id:'open-fit',text:'Opening: staff fit for work (no sickness or diarrhoea in 48 hours)',when:'Opening'},{id:'open-probe',text:'Opening: probe thermometer checked and wiped',when:'Opening'},{id:'close-label',text:'Closing: food covered, labelled and dated',when:'Closing'},{id:'close-dates',text:'Closing: anything past its use-by removed',when:'Closing'},{id:'close-clean',text:'Closing: cleaning schedule done',when:'Closing'}];function q({sub:e,setSub:t}){const{total:s}=(0,C.useChatUnread)();return(0,D.jsx)(M.Seg,{value:e,onChange:t,options:[{id:'live',label:'Live tickets'},{id:'soldout',label:'Sold out'},{id:'team',label:"Who's on & rota"},{id:'chat',label:s?`Chat (${s})`:'Chat'}]})}function W(){return(0,D.jsx)(C.Chat,{go:()=>{}})}function E(){const{rid:e,r:t,me:s,now:i}=(0,M.useChef)(15e3),n=(0,f.useStore)(e=>e.bookings),l=(0,f.useOrders)(e),o=l.filter(e=>(0,a.waitingForStaff)(e)).length,d=l.filter(a.kitchenCanSee).filter(e=>['new','acknowledged','preparing'].includes(e.status)||'ready'===e.status&&'pass'===(0,$.nextStep)(e,(0,$.linkedBooking)(e,n))),c=(e,t)=>!!(0,$.statusBlock)(e,t,(0,$.linkedBooking)(e,n)),m=(0,x.ticketView)('chef',d),p=(0,f.useStore)(e=>e.setOrderStatus),b=(0,f.useStore)(e=>e.ackReadiness),w=d.flatMap(e=>(0,j.readinessFor)(e,t,i)).filter(e=>'due'===e.state||'overdue'===e.state);return(0,D.jsxs)(h.default,{style:{gap:8},children:[w.length?(0,D.jsx)(u.Banner,{kind:"warn",title:`${w.length} readiness alert${w.length>1?'s':''}`,children:w.map(e=>e.detail).join(' \xb7 ')}):(0,D.jsx)(u.Muted,{children:"No readiness alerts right now."}),o?(0,D.jsxs)(u.Muted,{children:[o," table order",o>1?'s':''," waiting for front of house to accept (the first order from a new phone). It shows here once accepted."]}):null,m.length?m.map(e=>(0,D.jsxs)(u.Card,{highlight:e.allergies.length&&(0,$.nextStep)(e,(0,$.linkedBooking)(e,n))&&'ready'!==e.status?k.colours.red:void 0,children:[(0,D.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,D.jsxs)(u.T,{weight:"semibold",children:['table'===e.type?`${(0,r.tableNumbers)(e.tableNo)}`:`Takeaway ${e.slotTime?new Date(e.slotTime).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'}):''}`," \xb7 ",e.ref]}),(0,D.jsx)(u.Badge,{kind:'new'===e.status?'amber':'gold',label:e.status.toUpperCase()})]}),e.lines.map((e,t)=>(0,D.jsxs)(u.T,{size:14,children:[e.qty," \xd7 ",e.name]},t)),e.allergies.length?(0,D.jsxs)(u.T,{size:13,colour:k.colours.red,children:["\u26a0 Allergy: ",e.allergies.map(e=>`${y.ALLERGENS.find(t=>t.id===e.allergen)?.label} (${e.severity})`).join(', ')]}):null,'takeaway'===e.type&&e.accepted?(0,D.jsxs)(u.T,{size:13,colour:k.colours.ok,children:["\u2713 Confirmed by ",e.accepted.by,Object.keys(e.allergyTicks??{}).length?` \xb7 kitchen checked: ${Object.keys(e.allergyTicks).map(e=>y.ALLERGENS.find(t=>t.id===e)?.label??e).join(', ')}`:'']}):null,e.allergies.length?(0,D.jsx)(R.AllergyChain,{o:e,me:s}):null,(0,D.jsxs)(u.Row,{wrap:!0,gap:8,children:['preparing'!==e.status&&'ready'!==e.status?(0,D.jsx)(u.Button,{small:!0,label:"Start",testID:`start-${e.ref}`,disabled:c(e,'preparing'),onPress:()=>{p(e.id,'preparing',s),'takeaway'===e.type&&b(e.id,'cook',s)}}):null,'ready'!==e.status?(0,D.jsx)(u.Button,{small:!0,kind:"success",label:"Ready",testID:`ready-${e.ref}`,disabled:c(e,'ready'),onPress:()=>p(e.id,'ready',s)}):null]})]},e.id)):(0,D.jsx)(u.Muted,{children:"No live tickets. New orders from the customer app and the Staff app show here."})]})}const F=(e,t)=>{const[s,i,n]=e.split('-').map(Number);return(0,w.ymd)(new Date(s,i-1,n+t))};function G(){const{now:e,today:t}={...(0,M.useChef)(6e4),today:(0,w.ymd)(new Date)},{staff:s,shifts:i}=(0,x.rotaView)('chef',(0,p.useOwner)(e=>e.staff),(0,p.useOwner)(e=>e.shifts)),n=(0,p.useOwner)(e=>e.attendance).filter(e=>e.date===t&&e.in&&!e.out),r=(0,S.weekday)(e),l=s.filter(e=>/kitchen|chef|kp/i.test(e.job+e.name)),a=(0,O.useSession)(e=>e.meId),o=(0,z.useSync)(e=>e.staffRef),d=a??o??M.CHEF_ID,c=(0,p.useOwner)(e=>e.staff.find(e=>e.id===d)?.name??'Chef').replace(/\s*\(.*\)$/,'');return(0,D.jsxs)(h.default,{style:{gap:10},children:[(0,D.jsx)(L.BreakRoomCard,{staffId:d,name:c,now:e}),(0,D.jsxs)(u.Card,{children:[(0,D.jsx)(u.T,{weight:"semibold",children:"On now"}),n.length?n.map(e=>(0,D.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,D.jsxs)(u.Row,{gap:8,style:{flex:1},children:[(0,D.jsx)(I.StaffAvatar,{id:e.staffId,size:28}),(0,D.jsx)(u.T,{size:14,children:s.find(t=>t.id===e.staffId)?.name??e.staffId})]}),(0,D.jsxs)(u.Muted,{children:["since ",new Date(e.in).toLocaleTimeString('en-GB',{hour:'2-digit',minute:'2-digit'})]})]},e.id)):(0,D.jsx)(u.Muted,{children:"Nobody clocked in yet."})]}),(0,D.jsxs)(u.Card,{children:[(0,D.jsxs)(u.T,{weight:"semibold",children:["Today on the rota (",S.DAY3[r],")"]}),i.filter(e=>e.date===t).map(e=>(0,D.jsxs)(u.Row,{style:{justifyContent:'space-between'},children:[(0,D.jsxs)(u.Row,{gap:8,style:{flex:1},children:[(0,D.jsx)(I.StaffAvatar,{id:e.staffId,size:28}),(0,D.jsx)(u.T,{size:14,children:s.find(t=>t.id===e.staffId)?.name})]}),(0,D.jsxs)(u.Muted,{children:[(0,S.fmtH)(e.start),"\u2013",(0,S.fmtH)(e.end)]})]},e.id))]}),(0,D.jsxs)(u.Card,{children:[(0,D.jsx)(u.T,{weight:"semibold",children:"Kitchen rota this week"}),l.map(e=>(0,D.jsxs)(h.default,{style:{gap:4},children:[(0,D.jsx)(u.T,{size:14,children:e.name}),(0,D.jsx)(u.Row,{wrap:!0,gap:4,children:S.DAY3.map((s,n)=>{const l=i.find(s=>s.staffId===e.id&&s.date===F(t,n-r));return(0,D.jsxs)(h.default,{style:{width:44,padding:4,borderRadius:6,backgroundColor:l?k.colours.goldTint:k.colours.surface2,alignItems:'center'},children:[(0,D.jsx)(u.T,{size:10,colour:k.colours.muted,children:s}),(0,D.jsx)(u.T,{size:10,children:l?`${(0,S.fmtH)(l.start).slice(0,2)}\u2013${(0,S.fmtH)(l.end).slice(0,2)}`:'off'})]},s)})})]},e.id)),(0,D.jsx)(u.Muted,{children:"Rota changes, swaps and leave are made in CoverCharge for Managers. This view shows shifts only."})]})]})}},1307,[875,1024,1308,1023,808,991,874,30,263,151,127,813,819,831,854,807,814,816,1309,818,821,998,926,1300,1299,938,939,1303,1202,952,1028,858,820,24]); +__d(function(g,r,_i,a,m,e,d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),Object.defineProperty(e,"ingredientQty",{enumerable:!0,get:function(){return i}}),Object.defineProperty(e,"ingredientSpeech",{enumerable:!0,get:function(){return f}});var t=r(d[0]),n=r(d[1]);const i=(i,f,u)=>(0,n.fishInStone)(i,f)?(0,n.fishQtyText)(i,f,u):(0,t.fmtQty)(u,f.unit||''),f=(t,f,u)=>(0,n.fishInStone)(t,f)?(0,n.fishQtySpeech)(t,f,u):i(t,f,u)},1308,[1299,1024]); +__d(function(g,_r,i,_a,m,e,_d){"use strict";Object.defineProperty(e,'__esModule',{value:!0}),e.readinessFor=function(a,d,r){if('takeaway'!==a.type||!a.slotTime)return[];if(['collected','cancelled','closed'].includes(a.status))return[];const s=new Date(a.slotTime),n=d.settings.bufferMins,o=a.lines.map(a=>({name:a.name,qty:a.qty,at:(0,t.addMins)(s,-(a.prepMins+n))})),u=o.reduce((t,a)=>a.at{if(a)return'done';const d=r.getTime()-t.getTime();return d<0?'upcoming':d>3e5?'overdue':'due'},y=['ready','collected'].includes(a.status);return[{id:`${a.id}:cook`,orderId:a.id,stage:'cook',due:u,state:l(u,!!a.readiness.cook||y),detail:o.sort((t,a)=>t.at.getTime()-a.at.getTime()).map(t=>{return`${t.qty}\xd7 ${t.name} at ${a=t.at,`${String(a.getHours()).padStart(2,'0')}:${String(a.getMinutes()).padStart(2,'0')}`}`;var a}).join(' \xb7 ')},{id:`${a.id}:bag`,orderId:a.id,stage:'bag',due:c,state:l(c,!!a.readiness.bag||y),detail:'Bag, add sauces/drinks, check against ticket and allergy flags'},{id:`${a.id}:ready`,orderId:a.id,stage:'ready',due:s,state:l(s,y),detail:'Mark ready \u2014 sends the customer a "your order is ready" notification'}]};var t=_r(_d[0])},1309,[818]); +__d(function(g,r,i,a,m,_e,d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),Object.defineProperty(_e,"inlineStyles",{enumerable:!0,get:function(){return n.inlineStyles}}),Object.defineProperty(_e,"loadLocalRawResource",{enumerable:!0,get:function(){return n.loadLocalRawResource}}),Object.defineProperty(_e,"LocalSvg",{enumerable:!0,get:function(){return n.LocalSvg}}),Object.defineProperty(_e,"SvgCss",{enumerable:!0,get:function(){return n.SvgCss}}),Object.defineProperty(_e,"SvgCssUri",{enumerable:!0,get:function(){return n.SvgCssUri}}),Object.defineProperty(_e,"SvgWithCss",{enumerable:!0,get:function(){return n.SvgWithCss}}),Object.defineProperty(_e,"SvgWithCssUri",{enumerable:!0,get:function(){return n.SvgWithCssUri}}),Object.defineProperty(_e,"WithLocalSvg",{enumerable:!0,get:function(){return n.WithLocalSvg}}),Object.defineProperty(_e,"default",{enumerable:!0,get:function(){return f.default}}),Object.defineProperty(_e,"camelCase",{enumerable:!0,get:function(){return e.camelCase}}),Object.defineProperty(_e,"fetchText",{enumerable:!0,get:function(){return t.fetchText}}),Object.defineProperty(_e,"parse",{enumerable:!0,get:function(){return e.parse}}),Object.defineProperty(_e,"SvgAst",{enumerable:!0,get:function(){return e.SvgAst}}),Object.defineProperty(_e,"SvgFromUri",{enumerable:!0,get:function(){return e.SvgFromUri}}),Object.defineProperty(_e,"SvgFromXml",{enumerable:!0,get:function(){return e.SvgFromXml}}),Object.defineProperty(_e,"SvgUri",{enumerable:!0,get:function(){return e.SvgUri}}),Object.defineProperty(_e,"SvgXml",{enumerable:!0,get:function(){return e.SvgXml}});var e=r(d[0]),t=r(d[1]),n=r(d[2]),u=r(d[3]);Object.keys(u).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return u[e]}})});var o=r(d[4]);Object.keys(o).forEach(function(e){'default'===e||Object.prototype.hasOwnProperty.call(_e,e)||Object.defineProperty(_e,e,{enumerable:!0,get:function(){return o[e]}})});var c,f=(c=o)&&c.__esModule?c:{default:c}},1310,[1311,1312,1331,1332,1314]); +__d(function(g,_r,_i,a,m,_e,_d){"use strict";Object.defineProperty(_e,'__esModule',{value:!0}),_e.SvgAst=c,_e.SvgXml=l,_e.SvgUri=function(r){const{onError:o=i,uri:s,onLoad:c,fallback:u}=r,[f,p]=(0,t.useState)(null),[d,h]=(0,t.useState)(!1);if((0,t.useEffect)(()=>{s?(0,n.fetchText)(s).then(t=>{p(t),d&&h(!1),c?.()}).catch(t=>{o(t),h(!0)}):p(null)},[o,s,c]),d)return u??null;return e.createElement(l,{xml:f,override:r,fallback:u})},Object.defineProperty(_e,"SvgFromXml",{enumerable:!0,get:function(){return u}}),Object.defineProperty(_e,"SvgFromUri",{enumerable:!0,get:function(){return f}}),Object.defineProperty(_e,"camelCase",{enumerable:!0,get:function(){return d}}),_e.getStyle=h,_e.astToReact=x,_e.parse=j,Object.defineProperty(_e,"tags",{enumerable:!0,get:function(){return r.tags}});var t=_r(_d[0]),e=(function(t){if(t&&t.__esModule)return t;var e={};return t&&Object.keys(t).forEach(function(n){if('default'!==n){var r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:function(){return t[n]}})}}),e.default=t,e})(t),n=_r(_d[1]),r=_r(_d[2]);function o(){return o=Object.assign?Object.assign.bind():function(t){for(var e=1;enull!==o?j(o):null,[o]);return e.createElement(c,{ast:r,override:s||n})}catch(t){return r(t),l??null}}class u extends t.Component{state={ast:null};componentDidMount(){this.parse(this.props.xml)}componentDidUpdate(t){const{xml:e}=this.props;e!==t.xml&&this.parse(e)}parse(t){const{onError:e=i}=this.props;try{this.setState({ast:t?j(t):null})}catch(t){const n=t;e({...n,message:`[RNSVG] Couldn't parse SVG, reason: ${n.message}`})}}render(){const{props:t,state:{ast:n}}=this;return e.createElement(c,{ast:n,override:t.override||t})}}class f extends t.Component{state={xml:null};componentDidMount(){this.fetch(this.props.uri)}componentDidUpdate(t){const{uri:e}=this.props;e!==t.uri&&this.fetch(e)}async fetch(t){try{this.setState({xml:t?await(0,n.fetchText)(t):null})}catch(t){console.error(t)}}render(){const{props:t,state:{xml:n}}=this;return e.createElement(u,{xml:n,override:t,onError:t.onError})}}const p=(t,e)=>e.toUpperCase(),d=t=>t.replace(/[:-]([a-z])/g,p);function h(t){const e={},n=t.split(';').filter(t=>t.trim()),{length:r}=n;for(let t=0;tb(' ',t.length);function v(t,e){const n=t.split('\n'),r=n.length;let o=e,s=0;for(;s=t))break;o-=t}const c=t.slice(0,e).replace(/^\t+/,y),i=/(^|\n).*$/.exec(c),l=i&&i[0]||'',u=t.slice(e),f=/.*(\n|$)/.exec(u);return{line:s,column:o,snippet:`${l}${f&&f[0]}\n${b(' ',l.length)}^`}}const E=/[a-zA-Z0-9:_-]/,O=/